Skip to content

Commit

Permalink
Check content children for new components same as for old ones
Browse files Browse the repository at this point in the history
  • Loading branch information
alexslavr committed Dec 27, 2024
1 parent 3023703 commit ba53277
Show file tree
Hide file tree
Showing 47 changed files with 453 additions and 227 deletions.
2 changes: 1 addition & 1 deletion packages/devextreme-angular/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,4 @@ export { DxValidationGroupComponent, DxValidationGroupModule } from 'devextreme-
export { DxValidationSummaryComponent, DxValidationSummaryModule } from 'devextreme-angular/ui/validation-summary';
export { DxValidatorComponent, DxValidatorModule } from 'devextreme-angular/ui/validator';
export { DxVectorMapComponent, DxVectorMapModule } from 'devextreme-angular/ui/vector-map';
export * as Common from './common/index';
export * as Common from './common';
9 changes: 6 additions & 3 deletions packages/devextreme-angular/src/ui/accordion/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,10 @@ export class DxAccordionComponent<TItem = any, TKey = any> extends DxComponent i
return this._getOption('items');
}
set itemsChildren(value) {
this.setContentChildren('items', value, 'DxiAccordionItemComponent');
this.setChildren('items', value);
if (this.checkContentChildren('items', value, 'DxiAccordionItemComponent')) {
this.setContentChildren('items', value, 'DxiAccordionItemComponent');
this.setChildren('items', value);
}
}


Expand All @@ -725,7 +727,8 @@ export class DxAccordionComponent<TItem = any, TKey = any> extends DxComponent i
}
set itemsLegacyChildren(value) {
if (this.checkContentChildren('items', value, 'DxiItemComponent')) {
this.setChildren('items', value);
this.setContentChildren('items', value, 'DxiItemComponent');
this.setChildren('items', value);
}
}

Expand Down
9 changes: 6 additions & 3 deletions packages/devextreme-angular/src/ui/action-sheet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,8 +506,10 @@ export class DxActionSheetComponent<TItem = any, TKey = any> extends DxComponent
return this._getOption('items');
}
set itemsChildren(value) {
this.setContentChildren('items', value, 'DxiActionSheetItemComponent');
this.setChildren('items', value);
if (this.checkContentChildren('items', value, 'DxiActionSheetItemComponent')) {
this.setContentChildren('items', value, 'DxiActionSheetItemComponent');
this.setChildren('items', value);
}
}


Expand All @@ -517,7 +519,8 @@ export class DxActionSheetComponent<TItem = any, TKey = any> extends DxComponent
}
set itemsLegacyChildren(value) {
if (this.checkContentChildren('items', value, 'DxiItemComponent')) {
this.setChildren('items', value);
this.setContentChildren('items', value, 'DxiItemComponent');
this.setChildren('items', value);
}
}

Expand Down
18 changes: 12 additions & 6 deletions packages/devextreme-angular/src/ui/autocomplete/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1363,17 +1363,21 @@ export class DxAutocompleteComponent extends DxComponent implements OnDestroy, C
return this._getOption('buttons');
}
set buttonsChildren(value) {
this.setContentChildren('buttons', value, 'DxiAutocompleteButtonComponent');
this.setChildren('buttons', value);
if (this.checkContentChildren('buttons', value, 'DxiAutocompleteButtonComponent')) {
this.setContentChildren('buttons', value, 'DxiAutocompleteButtonComponent');
this.setChildren('buttons', value);
}
}

@ContentChildren(DxiAutocompleteItemComponent)
get itemsChildren(): QueryList<DxiAutocompleteItemComponent> {
return this._getOption('items');
}
set itemsChildren(value) {
this.setContentChildren('items', value, 'DxiAutocompleteItemComponent');
this.setChildren('items', value);
if (this.checkContentChildren('items', value, 'DxiAutocompleteItemComponent')) {
this.setContentChildren('items', value, 'DxiAutocompleteItemComponent');
this.setChildren('items', value);
}
}


Expand All @@ -1383,7 +1387,8 @@ export class DxAutocompleteComponent extends DxComponent implements OnDestroy, C
}
set buttonsLegacyChildren(value) {
if (this.checkContentChildren('buttons', value, 'DxiButtonComponent')) {
this.setChildren('buttons', value);
this.setContentChildren('buttons', value, 'DxiButtonComponent');
this.setChildren('buttons', value);
}
}

Expand All @@ -1393,7 +1398,8 @@ export class DxAutocompleteComponent extends DxComponent implements OnDestroy, C
}
set itemsLegacyChildren(value) {
if (this.checkContentChildren('items', value, 'DxiItemComponent')) {
this.setChildren('items', value);
this.setContentChildren('items', value, 'DxiItemComponent');
this.setChildren('items', value);
}
}

Expand Down
9 changes: 6 additions & 3 deletions packages/devextreme-angular/src/ui/box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,10 @@ export class DxBoxComponent<TItem = any, TKey = any> extends DxComponent impleme
return this._getOption('items');
}
set itemsChildren(value) {
this.setContentChildren('items', value, 'DxiBoxItemComponent');
this.setChildren('items', value);
if (this.checkContentChildren('items', value, 'DxiBoxItemComponent')) {
this.setContentChildren('items', value, 'DxiBoxItemComponent');
this.setChildren('items', value);
}
}


Expand All @@ -430,7 +432,8 @@ export class DxBoxComponent<TItem = any, TKey = any> extends DxComponent impleme
}
set itemsLegacyChildren(value) {
if (this.checkContentChildren('items', value, 'DxiItemComponent')) {
this.setChildren('items', value);
this.setContentChildren('items', value, 'DxiItemComponent');
this.setChildren('items', value);
}
}

Expand Down
9 changes: 6 additions & 3 deletions packages/devextreme-angular/src/ui/button-group/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,8 +499,10 @@ export class DxButtonGroupComponent extends DxComponent implements OnDestroy, On
return this._getOption('items');
}
set itemsChildren(value) {
this.setContentChildren('items', value, 'DxiButtonGroupItemComponent');
this.setChildren('items', value);
if (this.checkContentChildren('items', value, 'DxiButtonGroupItemComponent')) {
this.setContentChildren('items', value, 'DxiButtonGroupItemComponent');
this.setChildren('items', value);
}
}


Expand All @@ -510,7 +512,8 @@ export class DxButtonGroupComponent extends DxComponent implements OnDestroy, On
}
set itemsLegacyChildren(value) {
if (this.checkContentChildren('items', value, 'DxiItemComponent')) {
this.setChildren('items', value);
this.setContentChildren('items', value, 'DxiItemComponent');
this.setChildren('items', value);
}
}

Expand Down
36 changes: 24 additions & 12 deletions packages/devextreme-angular/src/ui/chart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1447,35 +1447,43 @@ export class DxChartComponent extends DxComponent implements OnDestroy, OnChange
return this._getOption('annotations');
}
set annotationsChildren(value) {
this.setContentChildren('annotations', value, 'DxiChartAnnotationComponent');
this.setChildren('annotations', value);
if (this.checkContentChildren('annotations', value, 'DxiChartAnnotationComponent')) {
this.setContentChildren('annotations', value, 'DxiChartAnnotationComponent');
this.setChildren('annotations', value);
}
}

@ContentChildren(DxiChartPaneComponent)
get panesChildren(): QueryList<DxiChartPaneComponent> {
return this._getOption('panes');
}
set panesChildren(value) {
this.setContentChildren('panes', value, 'DxiChartPaneComponent');
this.setChildren('panes', value);
if (this.checkContentChildren('panes', value, 'DxiChartPaneComponent')) {
this.setContentChildren('panes', value, 'DxiChartPaneComponent');
this.setChildren('panes', value);
}
}

@ContentChildren(DxiChartSeriesComponent)
get seriesChildren(): QueryList<DxiChartSeriesComponent> {
return this._getOption('series');
}
set seriesChildren(value) {
this.setContentChildren('series', value, 'DxiChartSeriesComponent');
this.setChildren('series', value);
if (this.checkContentChildren('series', value, 'DxiChartSeriesComponent')) {
this.setContentChildren('series', value, 'DxiChartSeriesComponent');
this.setChildren('series', value);
}
}

@ContentChildren(DxiChartValueAxisComponent)
get valueAxesChildren(): QueryList<DxiChartValueAxisComponent> {
return this._getOption('valueAxis');
}
set valueAxesChildren(value) {
this.setContentChildren('valueAxis', value, 'DxiChartValueAxisComponent');
this.setChildren('valueAxis', value);
if (this.checkContentChildren('valueAxis', value, 'DxiChartValueAxisComponent')) {
this.setContentChildren('valueAxis', value, 'DxiChartValueAxisComponent');
this.setChildren('valueAxis', value);
}
}


Expand All @@ -1485,7 +1493,8 @@ export class DxChartComponent extends DxComponent implements OnDestroy, OnChange
}
set annotationsLegacyChildren(value) {
if (this.checkContentChildren('annotations', value, 'DxiAnnotationComponent')) {
this.setChildren('annotations', value);
this.setContentChildren('annotations', value, 'DxiAnnotationComponent');
this.setChildren('annotations', value);
}
}

Expand All @@ -1495,7 +1504,8 @@ export class DxChartComponent extends DxComponent implements OnDestroy, OnChange
}
set panesLegacyChildren(value) {
if (this.checkContentChildren('panes', value, 'DxiPaneComponent')) {
this.setChildren('panes', value);
this.setContentChildren('panes', value, 'DxiPaneComponent');
this.setChildren('panes', value);
}
}

Expand All @@ -1505,7 +1515,8 @@ export class DxChartComponent extends DxComponent implements OnDestroy, OnChange
}
set seriesLegacyChildren(value) {
if (this.checkContentChildren('series', value, 'DxiSeriesComponent')) {
this.setChildren('series', value);
this.setContentChildren('series', value, 'DxiSeriesComponent');
this.setChildren('series', value);
}
}

Expand All @@ -1515,7 +1526,8 @@ export class DxChartComponent extends DxComponent implements OnDestroy, OnChange
}
set valueAxisLegacyChildren(value) {
if (this.checkContentChildren('valueAxis', value, 'DxiValueAxisComponent')) {
this.setChildren('valueAxis', value);
this.setContentChildren('valueAxis', value, 'DxiValueAxisComponent');
this.setChildren('valueAxis', value);
}
}

Expand Down
27 changes: 18 additions & 9 deletions packages/devextreme-angular/src/ui/chat/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,26 +618,32 @@ export class DxChatComponent extends DxComponent implements OnDestroy, OnChanges
return this._getOption('alerts');
}
set alertsChildren(value) {
this.setContentChildren('alerts', value, 'DxiChatAlertComponent');
this.setChildren('alerts', value);
if (this.checkContentChildren('alerts', value, 'DxiChatAlertComponent')) {
this.setContentChildren('alerts', value, 'DxiChatAlertComponent');
this.setChildren('alerts', value);
}
}

@ContentChildren(DxiChatItemComponent)
get itemsChildren(): QueryList<DxiChatItemComponent> {
return this._getOption('items');
}
set itemsChildren(value) {
this.setContentChildren('items', value, 'DxiChatItemComponent');
this.setChildren('items', value);
if (this.checkContentChildren('items', value, 'DxiChatItemComponent')) {
this.setContentChildren('items', value, 'DxiChatItemComponent');
this.setChildren('items', value);
}
}

@ContentChildren(DxiChatTypingUserComponent)
get typingUsersChildren(): QueryList<DxiChatTypingUserComponent> {
return this._getOption('typingUsers');
}
set typingUsersChildren(value) {
this.setContentChildren('typingUsers', value, 'DxiChatTypingUserComponent');
this.setChildren('typingUsers', value);
if (this.checkContentChildren('typingUsers', value, 'DxiChatTypingUserComponent')) {
this.setContentChildren('typingUsers', value, 'DxiChatTypingUserComponent');
this.setChildren('typingUsers', value);
}
}


Expand All @@ -647,7 +653,8 @@ export class DxChatComponent extends DxComponent implements OnDestroy, OnChanges
}
set alertsLegacyChildren(value) {
if (this.checkContentChildren('alerts', value, 'DxiAlertComponent')) {
this.setChildren('alerts', value);
this.setContentChildren('alerts', value, 'DxiAlertComponent');
this.setChildren('alerts', value);
}
}

Expand All @@ -657,7 +664,8 @@ export class DxChatComponent extends DxComponent implements OnDestroy, OnChanges
}
set itemsLegacyChildren(value) {
if (this.checkContentChildren('items', value, 'DxiItemComponent')) {
this.setChildren('items', value);
this.setContentChildren('items', value, 'DxiItemComponent');
this.setChildren('items', value);
}
}

Expand All @@ -667,7 +675,8 @@ export class DxChatComponent extends DxComponent implements OnDestroy, OnChanges
}
set typingUsersLegacyChildren(value) {
if (this.checkContentChildren('typingUsers', value, 'DxiTypingUserComponent')) {
this.setChildren('typingUsers', value);
this.setContentChildren('typingUsers', value, 'DxiTypingUserComponent');
this.setChildren('typingUsers', value);
}
}

Expand Down
9 changes: 6 additions & 3 deletions packages/devextreme-angular/src/ui/color-box/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1111,8 +1111,10 @@ export class DxColorBoxComponent extends DxComponent implements OnDestroy, Contr
return this._getOption('buttons');
}
set buttonsChildren(value) {
this.setContentChildren('buttons', value, 'DxiColorBoxButtonComponent');
this.setChildren('buttons', value);
if (this.checkContentChildren('buttons', value, 'DxiColorBoxButtonComponent')) {
this.setContentChildren('buttons', value, 'DxiColorBoxButtonComponent');
this.setChildren('buttons', value);
}
}


Expand All @@ -1122,7 +1124,8 @@ export class DxColorBoxComponent extends DxComponent implements OnDestroy, Contr
}
set buttonsLegacyChildren(value) {
if (this.checkContentChildren('buttons', value, 'DxiButtonComponent')) {
this.setChildren('buttons', value);
this.setContentChildren('buttons', value, 'DxiButtonComponent');
this.setChildren('buttons', value);
}
}

Expand Down
9 changes: 6 additions & 3 deletions packages/devextreme-angular/src/ui/context-menu/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,10 @@ export class DxContextMenuComponent<TKey = any> extends DxComponent implements O
return this._getOption('items');
}
set itemsChildren(value) {
this.setContentChildren('items', value, 'DxiContextMenuItemComponent');
this.setChildren('items', value);
if (this.checkContentChildren('items', value, 'DxiContextMenuItemComponent')) {
this.setContentChildren('items', value, 'DxiContextMenuItemComponent');
this.setChildren('items', value);
}
}


Expand All @@ -842,7 +844,8 @@ export class DxContextMenuComponent<TKey = any> extends DxComponent implements O
}
set itemsLegacyChildren(value) {
if (this.checkContentChildren('items', value, 'DxiItemComponent')) {
this.setChildren('items', value);
this.setContentChildren('items', value, 'DxiItemComponent');
this.setChildren('items', value);
}
}

Expand Down
18 changes: 12 additions & 6 deletions packages/devextreme-angular/src/ui/data-grid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2066,17 +2066,21 @@ export class DxDataGridComponent<TRowData = any, TKey = any> extends DxComponent
return this._getOption('columns');
}
set columnsChildren(value) {
this.setContentChildren('columns', value, 'DxiDataGridColumnComponent');
this.setChildren('columns', value);
if (this.checkContentChildren('columns', value, 'DxiDataGridColumnComponent')) {
this.setContentChildren('columns', value, 'DxiDataGridColumnComponent');
this.setChildren('columns', value);
}
}

@ContentChildren(DxiDataGridSortByGroupSummaryInfoComponent)
get sortByGroupSummaryInfosChildren(): QueryList<DxiDataGridSortByGroupSummaryInfoComponent> {
return this._getOption('sortByGroupSummaryInfo');
}
set sortByGroupSummaryInfosChildren(value) {
this.setContentChildren('sortByGroupSummaryInfo', value, 'DxiDataGridSortByGroupSummaryInfoComponent');
this.setChildren('sortByGroupSummaryInfo', value);
if (this.checkContentChildren('sortByGroupSummaryInfo', value, 'DxiDataGridSortByGroupSummaryInfoComponent')) {
this.setContentChildren('sortByGroupSummaryInfo', value, 'DxiDataGridSortByGroupSummaryInfoComponent');
this.setChildren('sortByGroupSummaryInfo', value);
}
}


Expand All @@ -2086,7 +2090,8 @@ export class DxDataGridComponent<TRowData = any, TKey = any> extends DxComponent
}
set columnsLegacyChildren(value) {
if (this.checkContentChildren('columns', value, 'DxiColumnComponent')) {
this.setChildren('columns', value);
this.setContentChildren('columns', value, 'DxiColumnComponent');
this.setChildren('columns', value);
}
}

Expand All @@ -2096,7 +2101,8 @@ export class DxDataGridComponent<TRowData = any, TKey = any> extends DxComponent
}
set sortByGroupSummaryInfoLegacyChildren(value) {
if (this.checkContentChildren('sortByGroupSummaryInfo', value, 'DxiSortByGroupSummaryInfoComponent')) {
this.setChildren('sortByGroupSummaryInfo', value);
this.setContentChildren('sortByGroupSummaryInfo', value, 'DxiSortByGroupSummaryInfoComponent');
this.setChildren('sortByGroupSummaryInfo', value);
}
}

Expand Down
Loading

0 comments on commit ba53277

Please sign in to comment.