Skip to content

Commit 233e24a

Browse files
authored
feat(package): individual module imports for list components (#386)
This allows components to be imported individually without having to install an unused, optional dependency. Deprecations - ListModule: Use TreeListModule and ListModule for basic list only
1 parent 0c93cf0 commit 233e24a

File tree

9 files changed

+28
-16
lines changed

9 files changed

+28
-16
lines changed

src/app/list/basic-list/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ export { ListComponent } from './list.component';
22
export { ListConfig } from './list-config';
33
export { ListExpandToggleComponent } from './list-expand-toggle.component';
44
export { ListModule } from './list.module';
5-
export { ListModule as BasicListModule } from './list.module';

src/app/list/basic-list/list-config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { ListBaseConfig } from '../list-base-config';
1+
import { ListConfigBase } from '../list-config-base';
22

33
/**
44
* A config containing properties for list view
55
*/
6-
export class ListConfig extends ListBaseConfig {
6+
export class ListConfig extends ListConfigBase {
77
/**
88
* Set to true to hide the close button in the expansion area. Default is false
99
*/

src/app/list/basic-list/list.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ import { NgModule } from '@angular/core';
55
import { EmptyStateModule } from '../../empty-state/empty-state.module';
66
import { ListComponent } from './list.component';
77
import { ListConfig } from './list-config';
8+
import { ListEvent } from '../list-event';
89
import { ListExpandToggleComponent } from './list-expand-toggle.component';
910
import { PipeModule } from '../../pipe/pipe.module';
1011

1112
export {
1213
ListConfig,
13-
ListExpandToggleComponent
14+
ListEvent
1415
};
1516

1617
/**

src/app/list/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export { ListBase } from './list-base';
2-
export { ListBaseConfig } from './list-base-config';
2+
export { ListConfigBase } from './list-config-base';
33
export { ListEvent } from './list-event';
44

55
export * from './basic-list/index';

src/app/list/list-base.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
} from '@angular/core';
77

88
import { Action } from '../action/action';
9-
import { ListBaseConfig } from './list-base-config';
9+
import { ListConfigBase } from './list-config-base';
1010
import { ListEvent } from './list-event';
1111

1212
/**
@@ -88,9 +88,9 @@ export abstract class ListBase {
8888
/**
8989
* Return component config
9090
*
91-
* @returns {ListBaseConfig} The component config
91+
* @returns {ListConfigBase} The component config
9292
*/
93-
protected abstract getConfig(): ListBaseConfig;
93+
protected abstract getConfig(): ListConfigBase;
9494

9595
// Accessors
9696

src/app/list/list-base-config.ts renamed to src/app/list/list-config-base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { EmptyStateConfig } from '../empty-state/empty-state-config';
33
/**
44
* A config containing properties for tree list
55
*/
6-
export class ListBaseConfig {
6+
export class ListConfigBase {
77
/**
88
* Handle double clicking (item remains selected on a double click). Default is false
99
*/

src/app/list/list.module.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { FormsModule } from '@angular/forms';
33
import { NgModule } from '@angular/core';
44

55
import { ListBase } from './list-base';
6-
import { ListBaseConfig } from './list-base-config';
6+
import { ListConfigBase } from './list-config-base';
77
import { ListEvent } from './list-event';
88
import { ListComponent } from './basic-list/list.component';
99
import { ListModule as BasicListModule } from './basic-list/list.module';
@@ -15,7 +15,7 @@ import { TreeListModule } from './tree-list/tree-list.module';
1515

1616
export {
1717
ListBase,
18-
ListBaseConfig,
18+
ListConfigBase,
1919
ListConfig,
2020
ListEvent,
2121
TreeListConfig
@@ -24,7 +24,12 @@ export {
2424
/**
2525
* A module containing objects associated with list components
2626
*
27-
* @deprecated Use BasicListModule or TreeListModule
27+
* @deprecated Use individual module imports
28+
*
29+
* import {
30+
* ListModule, // basic list only
31+
* TreeListModule
32+
* } from 'patternfly-ng/list';
2833
*/
2934
@NgModule({
3035
imports: [
@@ -35,4 +40,8 @@ export {
3540
],
3641
exports: [ListComponent, ListExpandToggleComponent, TreeListComponent]
3742
})
38-
export class ListModule {}
43+
export class ListModule {
44+
constructor() {
45+
console.log('patternfly-ng: ListModule is deprecated; use TreeListModule and ListModule for basic list only');
46+
}
47+
}

src/app/list/tree-list/tree-list-config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { ListBaseConfig } from '../list-base-config';
1+
import { ListConfigBase } from '../list-config-base';
22

33
/**
44
* A config containing properties for tree list
55
*/
6-
export class TreeListConfig extends ListBaseConfig {
6+
export class TreeListConfig extends ListConfigBase {
77
/**
88
* Indent children by the given value in pixels
99
*/

src/app/list/tree-list/tree-list.module.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ import { CommonModule } from '@angular/common';
22
import { FormsModule } from '@angular/forms';
33
import { NgModule } from '@angular/core';
44

5+
import { TreeModule } from 'angular-tree-component';
6+
57
import { EmptyStateModule } from '../../empty-state/empty-state.module';
8+
import { ListEvent } from '../list-event';
69
import { TreeListComponent } from './tree-list.component';
710
import { TreeListConfig } from './tree-list-config';
8-
import { TreeModule } from 'angular-tree-component';
911

1012
export {
13+
ListEvent,
1114
TreeListConfig
1215
};
1316

0 commit comments

Comments
 (0)