Skip to content

Commit 097faf6

Browse files
authored
Generate nested options for merged configuration components (#28410)
1 parent 532fdce commit 097faf6

30 files changed

+464
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"axe-core": "4.10.2",
4545
"cheerio": "1.0.0-rc.10",
4646
"codelyzer": "6.0.2",
47-
"devextreme-internal-tools": "16.0.0-beta.13.1",
47+
"devextreme-internal-tools": "16.0.0-beta.15",
4848
"http-server": "14.1.1",
4949
"husky": "8.0.3",
5050
"jest": "29.7.0",

packages/devextreme-angular/src/ui/diagram/nested/group-dxi.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import {
66
NgModule,
77
Host,
88
SkipSelf,
9-
Input
9+
Input,
10+
ContentChildren,
11+
forwardRef,
12+
QueryList
1013
} from '@angular/core';
1114

1215

@@ -18,6 +21,7 @@ import {
1821
NestedOptionHost,
1922
} from 'devextreme-angular/core';
2023
import { CollectionNestedOption } from 'devextreme-angular/core';
24+
import { DxiDiagramCommandComponent } from './command-dxi';
2125

2226

2327
@Component({
@@ -81,6 +85,14 @@ export class DxiDiagramGroupComponent extends CollectionNestedOption {
8185
}
8286

8387

88+
@ContentChildren(forwardRef(() => DxiDiagramCommandComponent))
89+
get commandsChildren(): QueryList<DxiDiagramCommandComponent> {
90+
return this._getOption('commands');
91+
}
92+
set commandsChildren(value) {
93+
this.setChildren('commands', value);
94+
}
95+
8496
constructor(@SkipSelf() @Host() parentOptionHost: NestedOptionHost,
8597
@Host() optionHost: NestedOptionHost) {
8698
super();

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

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ import {
1010
Inject,
1111
AfterViewInit,
1212
SkipSelf,
13-
Input
13+
Input,
14+
ContentChildren,
15+
forwardRef,
16+
QueryList
1417
} from '@angular/core';
1518

1619
import { DOCUMENT } from '@angular/common';
@@ -30,6 +33,17 @@ import {
3033
DxTemplateHost
3134
} from 'devextreme-angular/core';
3235
import { CollectionNestedOption } from 'devextreme-angular/core';
36+
import { DxiFormAsyncRuleComponent } from './async-rule-dxi';
37+
import { DxiFormCompareRuleComponent } from './compare-rule-dxi';
38+
import { DxiFormCustomRuleComponent } from './custom-rule-dxi';
39+
import { DxiFormEmailRuleComponent } from './email-rule-dxi';
40+
import { DxiFormNumericRuleComponent } from './numeric-rule-dxi';
41+
import { DxiFormPatternRuleComponent } from './pattern-rule-dxi';
42+
import { DxiFormRangeRuleComponent } from './range-rule-dxi';
43+
import { DxiFormRequiredRuleComponent } from './required-rule-dxi';
44+
import { DxiFormStringLengthRuleComponent } from './string-length-rule-dxi';
45+
import { DxiFormTabComponent } from './tab-dxi';
46+
import { DxiFormValidationRuleComponent } from './validation-rule-dxi';
3347

3448

3549
@Component({
@@ -302,6 +316,94 @@ export class DxiFormItemComponent extends CollectionNestedOption implements Afte
302316
}
303317

304318

319+
@ContentChildren(forwardRef(() => DxiFormAsyncRuleComponent))
320+
get asyncRulesChildren(): QueryList<DxiFormAsyncRuleComponent> {
321+
return this._getOption('validationRules');
322+
}
323+
set asyncRulesChildren(value) {
324+
this.setChildren('validationRules', value);
325+
}
326+
327+
@ContentChildren(forwardRef(() => DxiFormCompareRuleComponent))
328+
get compareRulesChildren(): QueryList<DxiFormCompareRuleComponent> {
329+
return this._getOption('validationRules');
330+
}
331+
set compareRulesChildren(value) {
332+
this.setChildren('validationRules', value);
333+
}
334+
335+
@ContentChildren(forwardRef(() => DxiFormCustomRuleComponent))
336+
get customRulesChildren(): QueryList<DxiFormCustomRuleComponent> {
337+
return this._getOption('validationRules');
338+
}
339+
set customRulesChildren(value) {
340+
this.setChildren('validationRules', value);
341+
}
342+
343+
@ContentChildren(forwardRef(() => DxiFormEmailRuleComponent))
344+
get emailRulesChildren(): QueryList<DxiFormEmailRuleComponent> {
345+
return this._getOption('validationRules');
346+
}
347+
set emailRulesChildren(value) {
348+
this.setChildren('validationRules', value);
349+
}
350+
351+
@ContentChildren(forwardRef(() => DxiFormNumericRuleComponent))
352+
get numericRulesChildren(): QueryList<DxiFormNumericRuleComponent> {
353+
return this._getOption('validationRules');
354+
}
355+
set numericRulesChildren(value) {
356+
this.setChildren('validationRules', value);
357+
}
358+
359+
@ContentChildren(forwardRef(() => DxiFormPatternRuleComponent))
360+
get patternRulesChildren(): QueryList<DxiFormPatternRuleComponent> {
361+
return this._getOption('validationRules');
362+
}
363+
set patternRulesChildren(value) {
364+
this.setChildren('validationRules', value);
365+
}
366+
367+
@ContentChildren(forwardRef(() => DxiFormRangeRuleComponent))
368+
get rangeRulesChildren(): QueryList<DxiFormRangeRuleComponent> {
369+
return this._getOption('validationRules');
370+
}
371+
set rangeRulesChildren(value) {
372+
this.setChildren('validationRules', value);
373+
}
374+
375+
@ContentChildren(forwardRef(() => DxiFormRequiredRuleComponent))
376+
get requiredRulesChildren(): QueryList<DxiFormRequiredRuleComponent> {
377+
return this._getOption('validationRules');
378+
}
379+
set requiredRulesChildren(value) {
380+
this.setChildren('validationRules', value);
381+
}
382+
383+
@ContentChildren(forwardRef(() => DxiFormStringLengthRuleComponent))
384+
get stringLengthRulesChildren(): QueryList<DxiFormStringLengthRuleComponent> {
385+
return this._getOption('validationRules');
386+
}
387+
set stringLengthRulesChildren(value) {
388+
this.setChildren('validationRules', value);
389+
}
390+
391+
@ContentChildren(forwardRef(() => DxiFormTabComponent))
392+
get tabsChildren(): QueryList<DxiFormTabComponent> {
393+
return this._getOption('tabs');
394+
}
395+
set tabsChildren(value) {
396+
this.setChildren('tabs', value);
397+
}
398+
399+
@ContentChildren(forwardRef(() => DxiFormValidationRuleComponent))
400+
get validationRulesChildren(): QueryList<DxiFormValidationRuleComponent> {
401+
return this._getOption('validationRules');
402+
}
403+
set validationRulesChildren(value) {
404+
this.setChildren('validationRules', value);
405+
}
406+
305407
constructor(@SkipSelf() @Host() parentOptionHost: NestedOptionHost,
306408
@Host() optionHost: NestedOptionHost,
307409
private renderer: Renderer2,

packages/devextreme-react/src/bar-gauge.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,9 @@ const _componentSubtitle = (props: ISubtitleProps) => {
641641
...props,
642642
elementDescriptor: {
643643
OptionName: "subtitle",
644+
ExpectedChildren: {
645+
font: { optionName: "font", isCollectionItem: false }
646+
},
644647
},
645648
});
646649
};
@@ -679,6 +682,12 @@ const _componentTitle = (props: ITitleProps) => {
679682
...props,
680683
elementDescriptor: {
681684
OptionName: "title",
685+
ExpectedChildren: {
686+
barGaugeTitleSubtitle: { optionName: "subtitle", isCollectionItem: false },
687+
font: { optionName: "font", isCollectionItem: false },
688+
legendTitleSubtitle: { optionName: "subtitle", isCollectionItem: false },
689+
margin: { optionName: "margin", isCollectionItem: false }
690+
},
682691
},
683692
});
684693
};

packages/devextreme-react/src/chart.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,6 +1691,9 @@ const _componentConstantLineStyle = (props: IConstantLineStyleProps) => {
16911691
...props,
16921692
elementDescriptor: {
16931693
OptionName: "constantLineStyle",
1694+
ExpectedChildren: {
1695+
commonAxisSettingsConstantLineStyleLabel: { optionName: "label", isCollectionItem: false }
1696+
},
16941697
},
16951698
});
16961699
};
@@ -2037,6 +2040,13 @@ const _componentHoverStyle = (props: IHoverStyleProps) => {
20372040
...props,
20382041
elementDescriptor: {
20392042
OptionName: "hoverStyle",
2043+
ExpectedChildren: {
2044+
border: { optionName: "border", isCollectionItem: false },
2045+
color: { optionName: "color", isCollectionItem: false },
2046+
hatching: { optionName: "hatching", isCollectionItem: false },
2047+
pointBorder: { optionName: "border", isCollectionItem: false },
2048+
seriesBorder: { optionName: "border", isCollectionItem: false }
2049+
},
20402050
},
20412051
});
20422052
};
@@ -2067,6 +2077,11 @@ const _componentImage = (props: IImageProps) => {
20672077
...props,
20682078
elementDescriptor: {
20692079
OptionName: "image",
2080+
ExpectedChildren: {
2081+
height: { optionName: "height", isCollectionItem: false },
2082+
url: { optionName: "url", isCollectionItem: false },
2083+
width: { optionName: "width", isCollectionItem: false }
2084+
},
20702085
},
20712086
});
20722087
};
@@ -2135,6 +2150,14 @@ const _componentLabel = (props: ILabelProps) => {
21352150
...props,
21362151
elementDescriptor: {
21372152
OptionName: "label",
2153+
ExpectedChildren: {
2154+
argumentFormat: { optionName: "argumentFormat", isCollectionItem: false },
2155+
border: { optionName: "border", isCollectionItem: false },
2156+
connector: { optionName: "connector", isCollectionItem: false },
2157+
font: { optionName: "font", isCollectionItem: false },
2158+
format: { optionName: "format", isCollectionItem: false },
2159+
seriesBorder: { optionName: "border", isCollectionItem: false }
2160+
},
21382161
TemplateProps: [{
21392162
tmplOption: "template",
21402163
render: "render",
@@ -2785,6 +2808,13 @@ const _componentSelectionStyle = (props: ISelectionStyleProps) => {
27852808
...props,
27862809
elementDescriptor: {
27872810
OptionName: "selectionStyle",
2811+
ExpectedChildren: {
2812+
border: { optionName: "border", isCollectionItem: false },
2813+
color: { optionName: "color", isCollectionItem: false },
2814+
hatching: { optionName: "hatching", isCollectionItem: false },
2815+
pointBorder: { optionName: "border", isCollectionItem: false },
2816+
seriesBorder: { optionName: "border", isCollectionItem: false }
2817+
},
27882818
},
27892819
});
27902820
};
@@ -3176,6 +3206,9 @@ const _componentSubtitle = (props: ISubtitleProps) => {
31763206
...props,
31773207
elementDescriptor: {
31783208
OptionName: "subtitle",
3209+
ExpectedChildren: {
3210+
font: { optionName: "font", isCollectionItem: false }
3211+
},
31793212
},
31803213
});
31813214
};
@@ -3268,6 +3301,12 @@ const _componentTitle = (props: ITitleProps) => {
32683301
...props,
32693302
elementDescriptor: {
32703303
OptionName: "title",
3304+
ExpectedChildren: {
3305+
chartTitleSubtitle: { optionName: "subtitle", isCollectionItem: false },
3306+
font: { optionName: "font", isCollectionItem: false },
3307+
legendTitleSubtitle: { optionName: "subtitle", isCollectionItem: false },
3308+
margin: { optionName: "margin", isCollectionItem: false }
3309+
},
32713310
},
32723311
});
32733312
};

packages/devextreme-react/src/data-grid.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,6 +1838,11 @@ const _componentHeaderFilter = (props: IHeaderFilterProps) => {
18381838
...props,
18391839
elementDescriptor: {
18401840
OptionName: "headerFilter",
1841+
ExpectedChildren: {
1842+
columnHeaderFilterSearch: { optionName: "search", isCollectionItem: false },
1843+
dataGridHeaderFilterSearch: { optionName: "search", isCollectionItem: false },
1844+
dataGridHeaderFilterTexts: { optionName: "texts", isCollectionItem: false }
1845+
},
18411846
},
18421847
});
18431848
};

packages/devextreme-react/src/diagram.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,9 @@ const _componentGroup = (props: IGroupProps) => {
474474
elementDescriptor: {
475475
OptionName: "groups",
476476
IsCollectionItem: true,
477+
ExpectedChildren: {
478+
command: { optionName: "commands", isCollectionItem: true }
479+
},
477480
},
478481
});
479482
};

packages/devextreme-react/src/form.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,23 @@ const _componentItem = (props: IItemProps) => {
453453
elementDescriptor: {
454454
OptionName: "items",
455455
IsCollectionItem: true,
456+
ExpectedChildren: {
457+
AsyncRule: { optionName: "validationRules", isCollectionItem: true },
458+
buttonOptions: { optionName: "buttonOptions", isCollectionItem: false },
459+
colCountByScreen: { optionName: "colCountByScreen", isCollectionItem: false },
460+
CompareRule: { optionName: "validationRules", isCollectionItem: true },
461+
CustomRule: { optionName: "validationRules", isCollectionItem: true },
462+
EmailRule: { optionName: "validationRules", isCollectionItem: true },
463+
label: { optionName: "label", isCollectionItem: false },
464+
NumericRule: { optionName: "validationRules", isCollectionItem: true },
465+
PatternRule: { optionName: "validationRules", isCollectionItem: true },
466+
RangeRule: { optionName: "validationRules", isCollectionItem: true },
467+
RequiredRule: { optionName: "validationRules", isCollectionItem: true },
468+
StringLengthRule: { optionName: "validationRules", isCollectionItem: true },
469+
tab: { optionName: "tabs", isCollectionItem: true },
470+
tabPanelOptions: { optionName: "tabPanelOptions", isCollectionItem: false },
471+
validationRule: { optionName: "validationRules", isCollectionItem: true }
472+
},
456473
TemplateProps: [{
457474
tmplOption: "tabTemplate",
458475
render: "tabRender",

packages/devextreme-react/src/funnel.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,9 @@ const _componentSubtitle = (props: ISubtitleProps) => {
813813
...props,
814814
elementDescriptor: {
815815
OptionName: "subtitle",
816+
ExpectedChildren: {
817+
font: { optionName: "font", isCollectionItem: false }
818+
},
816819
},
817820
});
818821
};
@@ -851,6 +854,12 @@ const _componentTitle = (props: ITitleProps) => {
851854
...props,
852855
elementDescriptor: {
853856
OptionName: "title",
857+
ExpectedChildren: {
858+
font: { optionName: "font", isCollectionItem: false },
859+
funnelTitleSubtitle: { optionName: "subtitle", isCollectionItem: false },
860+
legendTitleSubtitle: { optionName: "subtitle", isCollectionItem: false },
861+
margin: { optionName: "margin", isCollectionItem: false }
862+
},
854863
},
855864
});
856865
};

packages/devextreme-react/src/gantt.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,11 @@ const _componentHeaderFilter = (props: IHeaderFilterProps) => {
526526
...props,
527527
elementDescriptor: {
528528
OptionName: "headerFilter",
529+
ExpectedChildren: {
530+
columnHeaderFilterSearch: { optionName: "search", isCollectionItem: false },
531+
ganttHeaderFilterSearch: { optionName: "search", isCollectionItem: false },
532+
texts: { optionName: "texts", isCollectionItem: false }
533+
},
529534
},
530535
});
531536
};

0 commit comments

Comments
 (0)