Skip to content

Commit

Permalink
Generate nested options for merged configuration components (#28410)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexslavr authored Dec 2, 2024
1 parent 532fdce commit 097faf6
Show file tree
Hide file tree
Showing 30 changed files with 464 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"axe-core": "4.10.2",
"cheerio": "1.0.0-rc.10",
"codelyzer": "6.0.2",
"devextreme-internal-tools": "16.0.0-beta.13.1",
"devextreme-internal-tools": "16.0.0-beta.15",
"http-server": "14.1.1",
"husky": "8.0.3",
"jest": "29.7.0",
Expand Down
14 changes: 13 additions & 1 deletion packages/devextreme-angular/src/ui/diagram/nested/group-dxi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import {
NgModule,
Host,
SkipSelf,
Input
Input,
ContentChildren,
forwardRef,
QueryList
} from '@angular/core';


Expand All @@ -18,6 +21,7 @@ import {
NestedOptionHost,
} from 'devextreme-angular/core';
import { CollectionNestedOption } from 'devextreme-angular/core';
import { DxiDiagramCommandComponent } from './command-dxi';


@Component({
Expand Down Expand Up @@ -81,6 +85,14 @@ export class DxiDiagramGroupComponent extends CollectionNestedOption {
}


@ContentChildren(forwardRef(() => DxiDiagramCommandComponent))
get commandsChildren(): QueryList<DxiDiagramCommandComponent> {
return this._getOption('commands');
}
set commandsChildren(value) {
this.setChildren('commands', value);
}

constructor(@SkipSelf() @Host() parentOptionHost: NestedOptionHost,
@Host() optionHost: NestedOptionHost) {
super();
Expand Down
104 changes: 103 additions & 1 deletion packages/devextreme-angular/src/ui/form/nested/item-dxi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import {
Inject,
AfterViewInit,
SkipSelf,
Input
Input,
ContentChildren,
forwardRef,
QueryList
} from '@angular/core';

import { DOCUMENT } from '@angular/common';
Expand All @@ -30,6 +33,17 @@ import {
DxTemplateHost
} from 'devextreme-angular/core';
import { CollectionNestedOption } from 'devextreme-angular/core';
import { DxiFormAsyncRuleComponent } from './async-rule-dxi';
import { DxiFormCompareRuleComponent } from './compare-rule-dxi';
import { DxiFormCustomRuleComponent } from './custom-rule-dxi';
import { DxiFormEmailRuleComponent } from './email-rule-dxi';
import { DxiFormNumericRuleComponent } from './numeric-rule-dxi';
import { DxiFormPatternRuleComponent } from './pattern-rule-dxi';
import { DxiFormRangeRuleComponent } from './range-rule-dxi';
import { DxiFormRequiredRuleComponent } from './required-rule-dxi';
import { DxiFormStringLengthRuleComponent } from './string-length-rule-dxi';
import { DxiFormTabComponent } from './tab-dxi';
import { DxiFormValidationRuleComponent } from './validation-rule-dxi';


@Component({
Expand Down Expand Up @@ -302,6 +316,94 @@ export class DxiFormItemComponent extends CollectionNestedOption implements Afte
}


@ContentChildren(forwardRef(() => DxiFormAsyncRuleComponent))
get asyncRulesChildren(): QueryList<DxiFormAsyncRuleComponent> {
return this._getOption('validationRules');
}
set asyncRulesChildren(value) {
this.setChildren('validationRules', value);
}

@ContentChildren(forwardRef(() => DxiFormCompareRuleComponent))
get compareRulesChildren(): QueryList<DxiFormCompareRuleComponent> {
return this._getOption('validationRules');
}
set compareRulesChildren(value) {
this.setChildren('validationRules', value);
}

@ContentChildren(forwardRef(() => DxiFormCustomRuleComponent))
get customRulesChildren(): QueryList<DxiFormCustomRuleComponent> {
return this._getOption('validationRules');
}
set customRulesChildren(value) {
this.setChildren('validationRules', value);
}

@ContentChildren(forwardRef(() => DxiFormEmailRuleComponent))
get emailRulesChildren(): QueryList<DxiFormEmailRuleComponent> {
return this._getOption('validationRules');
}
set emailRulesChildren(value) {
this.setChildren('validationRules', value);
}

@ContentChildren(forwardRef(() => DxiFormNumericRuleComponent))
get numericRulesChildren(): QueryList<DxiFormNumericRuleComponent> {
return this._getOption('validationRules');
}
set numericRulesChildren(value) {
this.setChildren('validationRules', value);
}

@ContentChildren(forwardRef(() => DxiFormPatternRuleComponent))
get patternRulesChildren(): QueryList<DxiFormPatternRuleComponent> {
return this._getOption('validationRules');
}
set patternRulesChildren(value) {
this.setChildren('validationRules', value);
}

@ContentChildren(forwardRef(() => DxiFormRangeRuleComponent))
get rangeRulesChildren(): QueryList<DxiFormRangeRuleComponent> {
return this._getOption('validationRules');
}
set rangeRulesChildren(value) {
this.setChildren('validationRules', value);
}

@ContentChildren(forwardRef(() => DxiFormRequiredRuleComponent))
get requiredRulesChildren(): QueryList<DxiFormRequiredRuleComponent> {
return this._getOption('validationRules');
}
set requiredRulesChildren(value) {
this.setChildren('validationRules', value);
}

@ContentChildren(forwardRef(() => DxiFormStringLengthRuleComponent))
get stringLengthRulesChildren(): QueryList<DxiFormStringLengthRuleComponent> {
return this._getOption('validationRules');
}
set stringLengthRulesChildren(value) {
this.setChildren('validationRules', value);
}

@ContentChildren(forwardRef(() => DxiFormTabComponent))
get tabsChildren(): QueryList<DxiFormTabComponent> {
return this._getOption('tabs');
}
set tabsChildren(value) {
this.setChildren('tabs', value);
}

@ContentChildren(forwardRef(() => DxiFormValidationRuleComponent))
get validationRulesChildren(): QueryList<DxiFormValidationRuleComponent> {
return this._getOption('validationRules');
}
set validationRulesChildren(value) {
this.setChildren('validationRules', value);
}

constructor(@SkipSelf() @Host() parentOptionHost: NestedOptionHost,
@Host() optionHost: NestedOptionHost,
private renderer: Renderer2,
Expand Down
9 changes: 9 additions & 0 deletions packages/devextreme-react/src/bar-gauge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,9 @@ const _componentSubtitle = (props: ISubtitleProps) => {
...props,
elementDescriptor: {
OptionName: "subtitle",
ExpectedChildren: {
font: { optionName: "font", isCollectionItem: false }
},
},
});
};
Expand Down Expand Up @@ -679,6 +682,12 @@ const _componentTitle = (props: ITitleProps) => {
...props,
elementDescriptor: {
OptionName: "title",
ExpectedChildren: {
barGaugeTitleSubtitle: { optionName: "subtitle", isCollectionItem: false },
font: { optionName: "font", isCollectionItem: false },
legendTitleSubtitle: { optionName: "subtitle", isCollectionItem: false },
margin: { optionName: "margin", isCollectionItem: false }
},
},
});
};
Expand Down
39 changes: 39 additions & 0 deletions packages/devextreme-react/src/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1691,6 +1691,9 @@ const _componentConstantLineStyle = (props: IConstantLineStyleProps) => {
...props,
elementDescriptor: {
OptionName: "constantLineStyle",
ExpectedChildren: {
commonAxisSettingsConstantLineStyleLabel: { optionName: "label", isCollectionItem: false }
},
},
});
};
Expand Down Expand Up @@ -2037,6 +2040,13 @@ const _componentHoverStyle = (props: IHoverStyleProps) => {
...props,
elementDescriptor: {
OptionName: "hoverStyle",
ExpectedChildren: {
border: { optionName: "border", isCollectionItem: false },
color: { optionName: "color", isCollectionItem: false },
hatching: { optionName: "hatching", isCollectionItem: false },
pointBorder: { optionName: "border", isCollectionItem: false },
seriesBorder: { optionName: "border", isCollectionItem: false }
},
},
});
};
Expand Down Expand Up @@ -2067,6 +2077,11 @@ const _componentImage = (props: IImageProps) => {
...props,
elementDescriptor: {
OptionName: "image",
ExpectedChildren: {
height: { optionName: "height", isCollectionItem: false },
url: { optionName: "url", isCollectionItem: false },
width: { optionName: "width", isCollectionItem: false }
},
},
});
};
Expand Down Expand Up @@ -2135,6 +2150,14 @@ const _componentLabel = (props: ILabelProps) => {
...props,
elementDescriptor: {
OptionName: "label",
ExpectedChildren: {
argumentFormat: { optionName: "argumentFormat", isCollectionItem: false },
border: { optionName: "border", isCollectionItem: false },
connector: { optionName: "connector", isCollectionItem: false },
font: { optionName: "font", isCollectionItem: false },
format: { optionName: "format", isCollectionItem: false },
seriesBorder: { optionName: "border", isCollectionItem: false }
},
TemplateProps: [{
tmplOption: "template",
render: "render",
Expand Down Expand Up @@ -2785,6 +2808,13 @@ const _componentSelectionStyle = (props: ISelectionStyleProps) => {
...props,
elementDescriptor: {
OptionName: "selectionStyle",
ExpectedChildren: {
border: { optionName: "border", isCollectionItem: false },
color: { optionName: "color", isCollectionItem: false },
hatching: { optionName: "hatching", isCollectionItem: false },
pointBorder: { optionName: "border", isCollectionItem: false },
seriesBorder: { optionName: "border", isCollectionItem: false }
},
},
});
};
Expand Down Expand Up @@ -3176,6 +3206,9 @@ const _componentSubtitle = (props: ISubtitleProps) => {
...props,
elementDescriptor: {
OptionName: "subtitle",
ExpectedChildren: {
font: { optionName: "font", isCollectionItem: false }
},
},
});
};
Expand Down Expand Up @@ -3268,6 +3301,12 @@ const _componentTitle = (props: ITitleProps) => {
...props,
elementDescriptor: {
OptionName: "title",
ExpectedChildren: {
chartTitleSubtitle: { optionName: "subtitle", isCollectionItem: false },
font: { optionName: "font", isCollectionItem: false },
legendTitleSubtitle: { optionName: "subtitle", isCollectionItem: false },
margin: { optionName: "margin", isCollectionItem: false }
},
},
});
};
Expand Down
5 changes: 5 additions & 0 deletions packages/devextreme-react/src/data-grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1838,6 +1838,11 @@ const _componentHeaderFilter = (props: IHeaderFilterProps) => {
...props,
elementDescriptor: {
OptionName: "headerFilter",
ExpectedChildren: {
columnHeaderFilterSearch: { optionName: "search", isCollectionItem: false },
dataGridHeaderFilterSearch: { optionName: "search", isCollectionItem: false },
dataGridHeaderFilterTexts: { optionName: "texts", isCollectionItem: false }
},
},
});
};
Expand Down
3 changes: 3 additions & 0 deletions packages/devextreme-react/src/diagram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,9 @@ const _componentGroup = (props: IGroupProps) => {
elementDescriptor: {
OptionName: "groups",
IsCollectionItem: true,
ExpectedChildren: {
command: { optionName: "commands", isCollectionItem: true }
},
},
});
};
Expand Down
17 changes: 17 additions & 0 deletions packages/devextreme-react/src/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,23 @@ const _componentItem = (props: IItemProps) => {
elementDescriptor: {
OptionName: "items",
IsCollectionItem: true,
ExpectedChildren: {
AsyncRule: { optionName: "validationRules", isCollectionItem: true },
buttonOptions: { optionName: "buttonOptions", isCollectionItem: false },
colCountByScreen: { optionName: "colCountByScreen", isCollectionItem: false },
CompareRule: { optionName: "validationRules", isCollectionItem: true },
CustomRule: { optionName: "validationRules", isCollectionItem: true },
EmailRule: { optionName: "validationRules", isCollectionItem: true },
label: { optionName: "label", isCollectionItem: false },
NumericRule: { optionName: "validationRules", isCollectionItem: true },
PatternRule: { optionName: "validationRules", isCollectionItem: true },
RangeRule: { optionName: "validationRules", isCollectionItem: true },
RequiredRule: { optionName: "validationRules", isCollectionItem: true },
StringLengthRule: { optionName: "validationRules", isCollectionItem: true },
tab: { optionName: "tabs", isCollectionItem: true },
tabPanelOptions: { optionName: "tabPanelOptions", isCollectionItem: false },
validationRule: { optionName: "validationRules", isCollectionItem: true }
},
TemplateProps: [{
tmplOption: "tabTemplate",
render: "tabRender",
Expand Down
9 changes: 9 additions & 0 deletions packages/devextreme-react/src/funnel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,9 @@ const _componentSubtitle = (props: ISubtitleProps) => {
...props,
elementDescriptor: {
OptionName: "subtitle",
ExpectedChildren: {
font: { optionName: "font", isCollectionItem: false }
},
},
});
};
Expand Down Expand Up @@ -851,6 +854,12 @@ const _componentTitle = (props: ITitleProps) => {
...props,
elementDescriptor: {
OptionName: "title",
ExpectedChildren: {
font: { optionName: "font", isCollectionItem: false },
funnelTitleSubtitle: { optionName: "subtitle", isCollectionItem: false },
legendTitleSubtitle: { optionName: "subtitle", isCollectionItem: false },
margin: { optionName: "margin", isCollectionItem: false }
},
},
});
};
Expand Down
5 changes: 5 additions & 0 deletions packages/devextreme-react/src/gantt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,11 @@ const _componentHeaderFilter = (props: IHeaderFilterProps) => {
...props,
elementDescriptor: {
OptionName: "headerFilter",
ExpectedChildren: {
columnHeaderFilterSearch: { optionName: "search", isCollectionItem: false },
ganttHeaderFilterSearch: { optionName: "search", isCollectionItem: false },
texts: { optionName: "texts", isCollectionItem: false }
},
},
});
};
Expand Down
9 changes: 9 additions & 0 deletions packages/devextreme-react/src/pie-chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1262,6 +1262,9 @@ const _componentSubtitle = (props: ISubtitleProps) => {
...props,
elementDescriptor: {
OptionName: "subtitle",
ExpectedChildren: {
font: { optionName: "font", isCollectionItem: false }
},
},
});
};
Expand Down Expand Up @@ -1300,6 +1303,12 @@ const _componentTitle = (props: ITitleProps) => {
...props,
elementDescriptor: {
OptionName: "title",
ExpectedChildren: {
font: { optionName: "font", isCollectionItem: false },
legendTitleSubtitle: { optionName: "subtitle", isCollectionItem: false },
margin: { optionName: "margin", isCollectionItem: false },
pieChartTitleSubtitle: { optionName: "subtitle", isCollectionItem: false }
},
},
});
};
Expand Down
Loading

0 comments on commit 097faf6

Please sign in to comment.