Skip to content

Commit 8789966

Browse files
Rework nested items (T1300985)
1 parent 14d091b commit 8789966

File tree

482 files changed

+4772
-5542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

482 files changed

+4772
-5542
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { InjectionToken } from '@angular/core';
2+
3+
export const PROPERTY_TOKEN_items = new InjectionToken<string>('property-token-items');
4+
export const PROPERTY_TOKEN_buttons = new InjectionToken<string>('property-token-buttons');
5+
export const PROPERTY_TOKEN_toolbarItems = new InjectionToken<string>('property-token-toolbarItems');
6+
export const PROPERTY_TOKEN_validationRules = new InjectionToken<string>('property-token-validationRules');
7+
export const PROPERTY_TOKEN_changes = new InjectionToken<string>('property-token-changes');
8+
export const PROPERTY_TOKEN_columns = new InjectionToken<string>('property-token-columns');
9+
export const PROPERTY_TOKEN_customOperations = new InjectionToken<string>('property-token-customOperations');
10+
export const PROPERTY_TOKEN_fields = new InjectionToken<string>('property-token-fields');
11+
export const PROPERTY_TOKEN_tabs = new InjectionToken<string>('property-token-tabs');
12+
export const PROPERTY_TOKEN_annotations = new InjectionToken<string>('property-token-annotations');
13+
export const PROPERTY_TOKEN_breaks = new InjectionToken<string>('property-token-breaks');
14+
export const PROPERTY_TOKEN_constantLines = new InjectionToken<string>('property-token-constantLines');
15+
export const PROPERTY_TOKEN_panes = new InjectionToken<string>('property-token-panes');
16+
export const PROPERTY_TOKEN_series = new InjectionToken<string>('property-token-series');
17+
export const PROPERTY_TOKEN_strips = new InjectionToken<string>('property-token-strips');
18+
export const PROPERTY_TOKEN_valueAxis = new InjectionToken<string>('property-token-valueAxis');
19+
export const PROPERTY_TOKEN_alerts = new InjectionToken<string>('property-token-alerts');
20+
export const PROPERTY_TOKEN_typingUsers = new InjectionToken<string>('property-token-typingUsers');
21+
export const PROPERTY_TOKEN_ranges = new InjectionToken<string>('property-token-ranges');
22+
export const PROPERTY_TOKEN_groupItems = new InjectionToken<string>('property-token-groupItems');
23+
export const PROPERTY_TOKEN_sortByGroupSummaryInfo = new InjectionToken<string>('property-token-sortByGroupSummaryInfo');
24+
export const PROPERTY_TOKEN_totalItems = new InjectionToken<string>('property-token-totalItems');
25+
export const PROPERTY_TOKEN_commands = new InjectionToken<string>('property-token-commands');
26+
export const PROPERTY_TOKEN_connectionPoints = new InjectionToken<string>('property-token-connectionPoints');
27+
export const PROPERTY_TOKEN_customShapes = new InjectionToken<string>('property-token-customShapes');
28+
export const PROPERTY_TOKEN_groups = new InjectionToken<string>('property-token-groups');
29+
export const PROPERTY_TOKEN_fileSelectionItems = new InjectionToken<string>('property-token-fileSelectionItems');
30+
export const PROPERTY_TOKEN_stripLines = new InjectionToken<string>('property-token-stripLines');
31+
export const PROPERTY_TOKEN_mentions = new InjectionToken<string>('property-token-mentions');
32+
export const PROPERTY_TOKEN_menuItems = new InjectionToken<string>('property-token-menuItems');
33+
export const PROPERTY_TOKEN_locations = new InjectionToken<string>('property-token-locations');
34+
export const PROPERTY_TOKEN_markers = new InjectionToken<string>('property-token-markers');
35+
export const PROPERTY_TOKEN_routes = new InjectionToken<string>('property-token-routes');
36+
export const PROPERTY_TOKEN_cols = new InjectionToken<string>('property-token-cols');
37+
export const PROPERTY_TOKEN_location = new InjectionToken<string>('property-token-location');
38+
export const PROPERTY_TOKEN_rows = new InjectionToken<string>('property-token-rows');
39+
export const PROPERTY_TOKEN_resources = new InjectionToken<string>('property-token-resources');
40+
export const PROPERTY_TOKEN_views = new InjectionToken<string>('property-token-views');
41+
export const PROPERTY_TOKEN_layers = new InjectionToken<string>('property-token-layers');
42+
export const PROPERTY_TOKEN_legends = new InjectionToken<string>('property-token-legends');
43+
export const PROPERTY_TOKEN_center = new InjectionToken<string>('property-token-center');
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"lib": {
3+
"entryFile": "index.ts"
4+
}
5+
}

packages/devextreme-angular/src/ui/accordion/index.ts

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ import {
3838
DxTemplateModule,
3939
NestedOptionHost,
4040
IterableDifferHelper,
41-
WatcherHelper
41+
WatcherHelper,
42+
CollectionNestedOption,
4243
} from 'devextreme-angular/core';
4344

4445
import { DxiItemModule } from 'devextreme-angular/ui/nested';
4546

4647
import { DxiAccordionItemModule } from 'devextreme-angular/ui/accordion/nested';
47-
48-
import { DxiItemComponent } from 'devextreme-angular/ui/nested';
49-
50-
import { DxiAccordionItemComponent } from 'devextreme-angular/ui/accordion/nested';
48+
import {
49+
PROPERTY_TOKEN_items,
50+
} from 'devextreme-angular/core/tokens';
5151

5252

5353
/**
@@ -68,6 +68,12 @@ import { DxiAccordionItemComponent } from 'devextreme-angular/ui/accordion/neste
6868
]
6969
})
7070
export class DxAccordionComponent<TItem = any, TKey = any> extends DxComponent implements OnDestroy, OnChanges, DoCheck {
71+
72+
@ContentChildren(PROPERTY_TOKEN_items)
73+
set _itemsContentChildren(value: QueryList<CollectionNestedOption>) {
74+
this.setChildren('items', value);
75+
}
76+
7177
instance: DxAccordion<TItem, TKey> = null;
7278

7379
/**
@@ -712,26 +718,6 @@ export class DxAccordionComponent<TItem = any, TKey = any> extends DxComponent i
712718

713719

714720

715-
@ContentChildren(DxiAccordionItemComponent)
716-
get itemsChildren(): QueryList<DxiAccordionItemComponent> {
717-
return this._getOption('items');
718-
}
719-
set itemsChildren(value) {
720-
this._setChildren('items', value, 'DxiAccordionItemComponent');
721-
}
722-
723-
724-
@ContentChildren(DxiItemComponent)
725-
get itemsLegacyChildren(): QueryList<DxiItemComponent> {
726-
return this._getOption('items');
727-
}
728-
set itemsLegacyChildren(value) {
729-
this._setChildren('items', value, 'DxiItemComponent');
730-
}
731-
732-
733-
734-
735721
constructor(elementRef: ElementRef, ngZone: NgZone, templateHost: DxTemplateHost,
736722
private _watcherHelper: WatcherHelper,
737723
private _idh: IterableDifferHelper,

packages/devextreme-angular/src/ui/accordion/nested/item-dxi.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,26 @@ import {
2323
extractTemplate,
2424
DxTemplateDirective,
2525
IDxTemplateHost,
26-
DxTemplateHost
26+
DxTemplateHost,
2727
} from 'devextreme-angular/core';
2828
import { CollectionNestedOption } from 'devextreme-angular/core';
2929

30+
import { PROPERTY_TOKEN_items } from 'devextreme-angular/core/tokens';
3031

3132
@Component({
3233
selector: 'dxi-accordion-item',
3334
standalone: true,
3435
template: '<ng-content></ng-content>',
3536
styles: [':host { display: block; }'],
3637
imports: [ DxIntegrationModule ],
37-
providers: [NestedOptionHost, DxTemplateHost]
38+
providers: [
39+
NestedOptionHost,
40+
DxTemplateHost,
41+
{
42+
provide: PROPERTY_TOKEN_items,
43+
useExisting: DxiAccordionItemComponent,
44+
}
45+
]
3846
})
3947
export class DxiAccordionItemComponent extends CollectionNestedOption implements AfterViewInit,
4048
IDxTemplateHost {

packages/devextreme-angular/src/ui/action-sheet/index.ts

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,16 @@ import {
3838
DxTemplateModule,
3939
NestedOptionHost,
4040
IterableDifferHelper,
41-
WatcherHelper
41+
WatcherHelper,
42+
CollectionNestedOption,
4243
} from 'devextreme-angular/core';
4344

4445
import { DxiItemModule } from 'devextreme-angular/ui/nested';
4546

4647
import { DxiActionSheetItemModule } from 'devextreme-angular/ui/action-sheet/nested';
47-
48-
import { DxiItemComponent } from 'devextreme-angular/ui/nested';
49-
50-
import { DxiActionSheetItemComponent } from 'devextreme-angular/ui/action-sheet/nested';
48+
import {
49+
PROPERTY_TOKEN_items,
50+
} from 'devextreme-angular/core/tokens';
5151

5252

5353
/**
@@ -68,6 +68,12 @@ import { DxiActionSheetItemComponent } from 'devextreme-angular/ui/action-sheet/
6868
]
6969
})
7070
export class DxActionSheetComponent<TItem = any, TKey = any> extends DxComponent implements OnDestroy, OnChanges, DoCheck {
71+
72+
@ContentChildren(PROPERTY_TOKEN_items)
73+
set _itemsContentChildren(value: QueryList<CollectionNestedOption>) {
74+
this.setChildren('items', value);
75+
}
76+
7177
instance: DxActionSheet<TItem, TKey> = null;
7278

7379
/**
@@ -504,26 +510,6 @@ export class DxActionSheetComponent<TItem = any, TKey = any> extends DxComponent
504510

505511

506512

507-
@ContentChildren(DxiActionSheetItemComponent)
508-
get itemsChildren(): QueryList<DxiActionSheetItemComponent> {
509-
return this._getOption('items');
510-
}
511-
set itemsChildren(value) {
512-
this._setChildren('items', value, 'DxiActionSheetItemComponent');
513-
}
514-
515-
516-
@ContentChildren(DxiItemComponent)
517-
get itemsLegacyChildren(): QueryList<DxiItemComponent> {
518-
return this._getOption('items');
519-
}
520-
set itemsLegacyChildren(value) {
521-
this._setChildren('items', value, 'DxiItemComponent');
522-
}
523-
524-
525-
526-
527513
constructor(elementRef: ElementRef, ngZone: NgZone, templateHost: DxTemplateHost,
528514
private _watcherHelper: WatcherHelper,
529515
private _idh: IterableDifferHelper,

packages/devextreme-angular/src/ui/action-sheet/nested/item-dxi.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,26 @@ import {
2525
extractTemplate,
2626
DxTemplateDirective,
2727
IDxTemplateHost,
28-
DxTemplateHost
28+
DxTemplateHost,
2929
} from 'devextreme-angular/core';
3030
import { CollectionNestedOption } from 'devextreme-angular/core';
3131

32+
import { PROPERTY_TOKEN_items } from 'devextreme-angular/core/tokens';
3233

3334
@Component({
3435
selector: 'dxi-action-sheet-item',
3536
standalone: true,
3637
template: '<ng-content></ng-content>',
3738
styles: [':host { display: block; }'],
3839
imports: [ DxIntegrationModule ],
39-
providers: [NestedOptionHost, DxTemplateHost]
40+
providers: [
41+
NestedOptionHost,
42+
DxTemplateHost,
43+
{
44+
provide: PROPERTY_TOKEN_items,
45+
useExisting: DxiActionSheetItemComponent,
46+
}
47+
]
4048
})
4149
export class DxiActionSheetItemComponent extends CollectionNestedOption implements AfterViewInit,
4250
IDxTemplateHost {

packages/devextreme-angular/src/ui/autocomplete/index.ts

Lines changed: 23 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ import {
4747
DxTemplateModule,
4848
NestedOptionHost,
4949
IterableDifferHelper,
50-
WatcherHelper
50+
WatcherHelper,
51+
CollectionNestedOption,
5152
} from 'devextreme-angular/core';
5253

5354
import { DxiButtonModule } from 'devextreme-angular/ui/nested';
@@ -82,12 +83,11 @@ import { DxoAutocompletePositionModule } from 'devextreme-angular/ui/autocomplet
8283
import { DxoAutocompleteShowModule } from 'devextreme-angular/ui/autocomplete/nested';
8384
import { DxoAutocompleteToModule } from 'devextreme-angular/ui/autocomplete/nested';
8485
import { DxiAutocompleteToolbarItemModule } from 'devextreme-angular/ui/autocomplete/nested';
85-
86-
import { DxiButtonComponent } from 'devextreme-angular/ui/nested';
87-
import { DxiItemComponent } from 'devextreme-angular/ui/nested';
88-
89-
import { DxiAutocompleteButtonComponent } from 'devextreme-angular/ui/autocomplete/nested';
90-
import { DxiAutocompleteItemComponent } from 'devextreme-angular/ui/autocomplete/nested';
86+
import {
87+
PROPERTY_TOKEN_buttons,
88+
PROPERTY_TOKEN_items,
89+
PROPERTY_TOKEN_toolbarItems,
90+
} from 'devextreme-angular/core/tokens';
9191

9292

9393

@@ -115,6 +115,22 @@ const CUSTOM_VALUE_ACCESSOR_PROVIDER = {
115115
]
116116
})
117117
export class DxAutocompleteComponent extends DxComponent implements OnDestroy, ControlValueAccessor, OnChanges, DoCheck {
118+
119+
@ContentChildren(PROPERTY_TOKEN_buttons)
120+
set _buttonsContentChildren(value: QueryList<CollectionNestedOption>) {
121+
this.setChildren('buttons', value);
122+
}
123+
124+
@ContentChildren(PROPERTY_TOKEN_items)
125+
set _itemsContentChildren(value: QueryList<CollectionNestedOption>) {
126+
this.setChildren('items', value);
127+
}
128+
129+
@ContentChildren(PROPERTY_TOKEN_toolbarItems)
130+
set _toolbarItemsContentChildren(value: QueryList<CollectionNestedOption>) {
131+
this.setChildren('toolbarItems', value);
132+
}
133+
118134
instance: DxAutocomplete = null;
119135

120136
/**
@@ -1361,42 +1377,6 @@ export class DxAutocompleteComponent extends DxComponent implements OnDestroy, C
13611377
@HostListener('onBlur', ['$event']) touched = (_) => {};
13621378

13631379

1364-
@ContentChildren(DxiAutocompleteButtonComponent)
1365-
get buttonsChildren(): QueryList<DxiAutocompleteButtonComponent> {
1366-
return this._getOption('buttons');
1367-
}
1368-
set buttonsChildren(value) {
1369-
this._setChildren('buttons', value, 'DxiAutocompleteButtonComponent');
1370-
}
1371-
1372-
@ContentChildren(DxiAutocompleteItemComponent)
1373-
get itemsChildren(): QueryList<DxiAutocompleteItemComponent> {
1374-
return this._getOption('items');
1375-
}
1376-
set itemsChildren(value) {
1377-
this._setChildren('items', value, 'DxiAutocompleteItemComponent');
1378-
}
1379-
1380-
1381-
@ContentChildren(DxiButtonComponent)
1382-
get buttonsLegacyChildren(): QueryList<DxiButtonComponent> {
1383-
return this._getOption('buttons');
1384-
}
1385-
set buttonsLegacyChildren(value) {
1386-
this._setChildren('buttons', value, 'DxiButtonComponent');
1387-
}
1388-
1389-
@ContentChildren(DxiItemComponent)
1390-
get itemsLegacyChildren(): QueryList<DxiItemComponent> {
1391-
return this._getOption('items');
1392-
}
1393-
set itemsLegacyChildren(value) {
1394-
this._setChildren('items', value, 'DxiItemComponent');
1395-
}
1396-
1397-
1398-
1399-
14001380
constructor(elementRef: ElementRef, ngZone: NgZone, templateHost: DxTemplateHost,
14011381
private _watcherHelper: WatcherHelper,
14021382
private _idh: IterableDifferHelper,

packages/devextreme-angular/src/ui/autocomplete/nested/button-dxi.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,21 @@ import {
2121
} from 'devextreme-angular/core';
2222
import { CollectionNestedOption } from 'devextreme-angular/core';
2323

24+
import { PROPERTY_TOKEN_buttons } from 'devextreme-angular/core/tokens';
2425

2526
@Component({
2627
selector: 'dxi-autocomplete-button',
2728
standalone: true,
2829
template: '',
2930
styles: [''],
3031
imports: [ DxIntegrationModule ],
31-
providers: [NestedOptionHost]
32+
providers: [
33+
NestedOptionHost,
34+
{
35+
provide: PROPERTY_TOKEN_buttons,
36+
useExisting: DxiAutocompleteButtonComponent,
37+
}
38+
]
3239
})
3340
export class DxiAutocompleteButtonComponent extends CollectionNestedOption {
3441
@Input()

0 commit comments

Comments
 (0)