@itwin/components-react 5.19.0 → 5.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/lib/components-react/UiComponents.js +2 -1
- package/lib/components-react/UiComponents.js.map +1 -1
- package/lib/components-react/common/ImageRenderer.js +1 -1
- package/lib/components-react/common/ImageRenderer.js.map +1 -1
- package/lib/components-react/common/SubscriptionScheduler.js +1 -1
- package/lib/components-react/common/SubscriptionScheduler.js.map +1 -1
- package/lib/components-react/common/selection/SelectionHandler.js +20 -2
- package/lib/components-react/common/selection/SelectionHandler.js.map +1 -1
- package/lib/components-react/converters/BooleanTypeConverter.js +4 -4
- package/lib/components-react/converters/BooleanTypeConverter.js.map +1 -1
- package/lib/components-react/converters/PointTypeConverter.js +1 -0
- package/lib/components-react/converters/PointTypeConverter.js.map +1 -1
- package/lib/components-react/converters/TypeConverterManager.js +2 -1
- package/lib/components-react/converters/TypeConverterManager.js.map +1 -1
- package/lib/components-react/datepicker/IntlFormatter.js +1 -0
- package/lib/components-react/datepicker/IntlFormatter.js.map +1 -1
- package/lib/components-react/editors/BooleanEditor.js +23 -26
- package/lib/components-react/editors/BooleanEditor.js.map +1 -1
- package/lib/components-react/editors/CustomNumberEditor.js +92 -97
- package/lib/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/components-react/editors/DateTimeEditor.js +60 -63
- package/lib/components-react/editors/DateTimeEditor.js.map +1 -1
- package/lib/components-react/editors/EnumButtonGroupEditor.js +23 -26
- package/lib/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
- package/lib/components-react/editors/EnumEditor.js +30 -33
- package/lib/components-react/editors/EnumEditor.js.map +1 -1
- package/lib/components-react/editors/IconEditor.js +16 -16
- package/lib/components-react/editors/IconEditor.js.map +1 -1
- package/lib/components-react/editors/ImageCheckBoxEditor.js +22 -25
- package/lib/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
- package/lib/components-react/editors/NumericInputEditor.js +26 -29
- package/lib/components-react/editors/NumericInputEditor.js.map +1 -1
- package/lib/components-react/editors/PopupButton.js +26 -29
- package/lib/components-react/editors/PopupButton.js.map +1 -1
- package/lib/components-react/editors/PropertyEditorManager.js +2 -4
- package/lib/components-react/editors/PropertyEditorManager.js.map +1 -1
- package/lib/components-react/editors/SliderEditor.js +65 -68
- package/lib/components-react/editors/SliderEditor.js.map +1 -1
- package/lib/components-react/editors/TextEditor.js +22 -25
- package/lib/components-react/editors/TextEditor.js.map +1 -1
- package/lib/components-react/editors/TextareaEditor.js +29 -32
- package/lib/components-react/editors/TextareaEditor.js.map +1 -1
- package/lib/components-react/editors/ToggleEditor.js +26 -29
- package/lib/components-react/editors/ToggleEditor.js.map +1 -1
- package/lib/components-react/filter-builder/FilterBuilderState.js +1 -0
- package/lib/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/components-react/filtering/FilteringInput.js +36 -36
- package/lib/components-react/filtering/FilteringInput.js.map +1 -1
- package/lib/components-react/filtering/ResultSelector.js +50 -50
- package/lib/components-react/filtering/ResultSelector.js.map +1 -1
- package/lib/components-react/iconpicker/IconPickerButton.js +18 -18
- package/lib/components-react/iconpicker/IconPickerButton.js.map +1 -1
- package/lib/components-react/new-editors/editors/FormattedNumericInput.d.ts +3 -2
- package/lib/components-react/new-editors/editors/FormattedNumericInput.d.ts.map +1 -1
- package/lib/components-react/new-editors/editors/FormattedNumericInput.js +2 -2
- package/lib/components-react/new-editors/editors/FormattedNumericInput.js.map +1 -1
- package/lib/components-react/properties/ValueRendererManager.js +6 -7
- package/lib/components-react/properties/ValueRendererManager.js.map +1 -1
- package/lib/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +17 -17
- package/lib/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/components-react/properties/renderers/PropertyGridColumns.js +4 -3
- package/lib/components-react/properties/renderers/PropertyGridColumns.js.map +1 -1
- package/lib/components-react/properties/renderers/PropertyView.js +23 -23
- package/lib/components-react/properties/renderers/PropertyView.js.map +1 -1
- package/lib/components-react/properties/renderers/label/NonPrimitivePropertyLabelRenderer.js +6 -9
- package/lib/components-react/properties/renderers/label/NonPrimitivePropertyLabelRenderer.js.map +1 -1
- package/lib/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.js +9 -12
- package/lib/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.js.map +1 -1
- package/lib/components-react/propertygrid/MergingPropertyDataProvider.js +2 -1
- package/lib/components-react/propertygrid/MergingPropertyDataProvider.js.map +1 -1
- package/lib/components-react/propertygrid/PropertyCategoryRendererManager.js +2 -4
- package/lib/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
- package/lib/components-react/propertygrid/SimplePropertyDataProvider.js +6 -4
- package/lib/components-react/propertygrid/SimplePropertyDataProvider.js.map +1 -1
- package/lib/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +26 -29
- package/lib/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
- package/lib/components-react/propertygrid/component/PropertyCategoryBlock.js +3 -3
- package/lib/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
- package/lib/components-react/propertygrid/component/PropertyGridCommons.js +9 -9
- package/lib/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js +22 -22
- package/lib/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
- package/lib/components-react/propertygrid/component/PropertyList.js +5 -5
- package/lib/components-react/propertygrid/component/PropertyList.js.map +1 -1
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.js +29 -29
- package/lib/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/components-react/propertygrid/dataproviders/FilteringDataProvider.js +12 -14
- package/lib/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
- package/lib/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +3 -0
- package/lib/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
- package/lib/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -1
- package/lib/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
- package/lib/components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer.js +1 -1
- package/lib/components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer.js.map +1 -1
- package/lib/components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer.js +1 -1
- package/lib/components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer.js.map +1 -1
- package/lib/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.js +1 -3
- package/lib/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.js.map +1 -1
- package/lib/components-react/propertygrid/internal/PropertyGridEventHandler.js +11 -10
- package/lib/components-react/propertygrid/internal/PropertyGridEventHandler.js.map +1 -1
- package/lib/components-react/propertygrid/internal/PropertyGridModel.js +3 -3
- package/lib/components-react/propertygrid/internal/PropertyGridModel.js.map +1 -1
- package/lib/components-react/propertygrid/internal/PropertyGridModelSource.js +4 -2
- package/lib/components-react/propertygrid/internal/PropertyGridModelSource.js.map +1 -1
- package/lib/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js +2 -0
- package/lib/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js.map +1 -1
- package/lib/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.js +2 -0
- package/lib/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.js.map +1 -1
- package/lib/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +6 -1
- package/lib/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
- package/lib/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +10 -7
- package/lib/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
- package/lib/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +3 -0
- package/lib/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
- package/lib/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +8 -8
- package/lib/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/components-react/toolbar/InternalToolbarComponent.js +4 -4
- package/lib/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
- package/lib/components-react/toolbar/utilities/Direction.js +12 -12
- package/lib/components-react/toolbar/utilities/Direction.js.map +1 -1
- package/lib/components-react/tree/HighlightingEngine.js +3 -1
- package/lib/components-react/tree/HighlightingEngine.js.map +1 -1
- package/lib/components-react/tree/SimpleTreeDataProvider.js +1 -0
- package/lib/components-react/tree/SimpleTreeDataProvider.js.map +1 -1
- package/lib/components-react/tree/controlled/TreeEventDispatcher.js +5 -1
- package/lib/components-react/tree/controlled/TreeEventDispatcher.js.map +1 -1
- package/lib/components-react/tree/controlled/TreeEventHandler.js +10 -14
- package/lib/components-react/tree/controlled/TreeEventHandler.js.map +1 -1
- package/lib/components-react/tree/controlled/TreeModel.js +7 -9
- package/lib/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/components-react/tree/controlled/TreeModelSource.js +3 -2
- package/lib/components-react/tree/controlled/TreeModelSource.js.map +1 -1
- package/lib/components-react/tree/controlled/TreeNodeLoader.js +11 -3
- package/lib/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/components-react/tree/controlled/component/TreeRenderer.js +1 -4
- package/lib/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
- package/lib/components-react/tree/controlled/internal/SparseTree.js +7 -5
- package/lib/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
- package/lib/components-react/tree/controlled/internal/TreeModelMutator.js +3 -0
- package/lib/components-react/tree/controlled/internal/TreeModelMutator.js.map +1 -1
- package/lib/components-react/tree/controlled/internal/TreeSelectionManager.js +56 -51
- package/lib/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositePropertyDataFilterer.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AASH,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE;;;GAGG;AACH,MAAM,CAAN,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,2DAAG,CAAA;IACH,yDAAE,CAAA;AACJ,CAAC,EAHW,mBAAmB,KAAnB,mBAAmB,QAG9B;AAED;;;GAGG;AACH,MAAM,OAAO,6BAA8B,SAAQ,wBAAwB;
|
|
1
|
+
{"version":3,"file":"CompositePropertyDataFilterer.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AASH,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE;;;GAGG;AACH,MAAM,CAAN,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,2DAAG,CAAA;IACH,yDAAE,CAAA;AACJ,CAAC,EAHW,mBAAmB,KAAnB,mBAAmB,QAG9B;AAED;;;GAGG;AACH,MAAM,OAAO,6BAA8B,SAAQ,wBAAwB;IAE/D;IACA;IACA;IAHV,YACU,aAAoC,EACpC,SAA8B,EAC9B,cAAqC;QAE7C,KAAK,EAAE,CAAC;QAJA,kBAAa,GAAb,aAAa,CAAuB;QACpC,cAAS,GAAT,SAAS,CAAqB;QAC9B,mBAAc,GAAd,cAAc,CAAuB;QAG7C,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,WAAW,CAAC,GAAG,EAAE,CAClD,IAAI,CAAC,eAAe,CAAC,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CAAC,aAAa,CAAC;QAC7C,IAAI,CAAC,aAAa;YAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAEpD,MAAM,aAAa,GAAG,kBAAkB,CACtC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,EACjD,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAClD,CAAC;QAEF,OAAO;YACL,aAAa,EAAE,IAAI;YACnB,uBAAuB,EACrB,GAAG,CAAC,uBAAuB,IAAI,GAAG,CAAC,uBAAuB;YAC5D,6BAA6B,EAC3B,GAAG,CAAC,6BAA6B,IAAI,GAAG,CAAC,6BAA6B;YACxE,YAAY,EAAE,kBAAkB,CAAC,GAAG,CAAC,YAAY,EAAE,GAAG,CAAC,YAAY,CAAC;YACpE,aAAa;SACd,CAAC;IACJ,CAAC;CACF;AAED,SAAS,kBAAkB,CAAC,GAAuB,EAAE,GAAuB;IAC1E,IAAI,SAAS,KAAK,GAAG,IAAI,SAAS,KAAK,GAAG;QAAE,OAAO,SAAS,CAAC;IAC7D,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,kBAAkB,CACzB,GAA+B,EAC/B,GAA+B;IAE/B,IAAI,SAAS,KAAK,GAAG,IAAI,SAAS,KAAK,GAAG;QAAE,OAAO,SAAS,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider.js\";\nimport type {\n FilteredType,\n IPropertyDataFilterer,\n PropertyDataFilterResult,\n} from \"./PropertyDataFiltererBase.js\";\nimport { PropertyDataFiltererBase } from \"./PropertyDataFiltererBase.js\";\n\n/**\n * Logical operator for composite filterer.\n * @public\n */\nexport enum CompositeFilterType {\n And,\n Or,\n}\n\n/**\n * Composite PropertyData filter which can join two filters using logic operators\n * @public\n */\nexport class CompositePropertyDataFilterer extends PropertyDataFiltererBase {\n public constructor(\n private _leftFilterer: IPropertyDataFilterer,\n private _operator: CompositeFilterType,\n private _rightFilterer: IPropertyDataFilterer\n ) {\n super();\n this._leftFilterer.onFilterChanged.addListener(() =>\n this.onFilterChanged.raiseEvent()\n );\n this._rightFilterer.onFilterChanged.addListener(() =>\n this.onFilterChanged.raiseEvent()\n );\n }\n\n public get isActive() {\n return this._leftFilterer.isActive || this._rightFilterer.isActive;\n }\n\n public async recordMatchesFilter(\n node: PropertyRecord,\n parents: PropertyRecord[]\n ): Promise<PropertyDataFilterResult> {\n const [lhs, rhs] = await Promise.all([\n this._leftFilterer.recordMatchesFilter(node, parents),\n this._rightFilterer.recordMatchesFilter(node, parents),\n ]);\n\n return this.getFiltererResult(lhs, rhs);\n }\n\n public async categoryMatchesFilter(\n node: PropertyCategory,\n parents: PropertyCategory[]\n ): Promise<PropertyDataFilterResult> {\n const [lhs, rhs] = await Promise.all([\n this._leftFilterer.categoryMatchesFilter(node, parents),\n this._rightFilterer.categoryMatchesFilter(node, parents),\n ]);\n\n return this.getFiltererResult(lhs, rhs);\n }\n\n private getFiltererResult(\n lhs: PropertyDataFilterResult,\n rhs: PropertyDataFilterResult\n ) {\n const matchesFilter =\n this._operator === CompositeFilterType.And\n ? lhs.matchesFilter && rhs.matchesFilter\n : lhs.matchesFilter || rhs.matchesFilter;\n if (!matchesFilter) return { matchesFilter: false };\n\n const filteredTypes = joinNullableArrays(\n lhs.matchesFilter ? lhs.filteredTypes : undefined,\n rhs.matchesFilter ? rhs.filteredTypes : undefined\n );\n\n return {\n matchesFilter: true,\n shouldExpandNodeParents:\n lhs.shouldExpandNodeParents || rhs.shouldExpandNodeParents,\n shouldForceIncludeDescendants:\n lhs.shouldForceIncludeDescendants || rhs.shouldForceIncludeDescendants,\n matchesCount: sumNullableNumbers(lhs.matchesCount, rhs.matchesCount),\n filteredTypes,\n };\n }\n}\n\nfunction sumNullableNumbers(lhs: number | undefined, rhs: number | undefined) {\n if (undefined === lhs && undefined === rhs) return undefined;\n return (lhs ?? 0) + (rhs ?? 0);\n}\n\nfunction joinNullableArrays(\n lhs: FilteredType[] | undefined,\n rhs: FilteredType[] | undefined\n) {\n if (undefined === lhs && undefined === rhs) return undefined;\n return [...(lhs ?? []), ...(rhs ?? [])];\n}\n"]}
|
|
@@ -13,9 +13,9 @@ import { FilteredType, PropertyRecordDataFiltererBase, } from "./PropertyDataFil
|
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
15
|
export class DisplayValuePropertyDataFilterer extends PropertyRecordDataFiltererBase {
|
|
16
|
+
_filterText = "";
|
|
16
17
|
constructor(filterText = "") {
|
|
17
18
|
super();
|
|
18
|
-
this._filterText = "";
|
|
19
19
|
this._filterText = filterText.toLowerCase().trim();
|
|
20
20
|
}
|
|
21
21
|
get filterText() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DisplayValuePropertyDataFilterer.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAE/E,OAAO,EACL,YAAY,EACZ,8BAA8B,GAC/B,MAAM,+BAA+B,CAAC;AAEvC;;;GAGG;AACH,MAAM,OAAO,gCAAiC,SAAQ,8BAA8B;
|
|
1
|
+
{"version":3,"file":"DisplayValuePropertyDataFilterer.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAE/E,OAAO,EACL,YAAY,EACZ,8BAA8B,GAC/B,MAAM,+BAA+B,CAAC;AAEvC;;;GAGG;AACH,MAAM,OAAO,gCAAiC,SAAQ,8BAA8B;IAC1E,WAAW,GAAW,EAAE,CAAC;IAEjC,YAAmB,aAAqB,EAAE;QACxC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IACrD,CAAC;IAED,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAW,UAAU,CAAC,KAAa;QACjC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAC9C,IAAI,UAAU,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;YACnC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC9B,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;QACpC,CAAC;IACH,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,UAAU,KAAK,EAAE,CAAC;IAChC,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAC9B,IAAoB;QAEpB,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;QAEnD,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS;YAC1D,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAElC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;QAClE,MAAM,YAAY,GAAG,oBAAoB,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAEzE,IAAI,YAAY,KAAK,CAAC;YAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAExD,OAAO;YACL,aAAa,EAAE,IAAI;YACnB,uBAAuB,EAAE,IAAI;YAC7B,YAAY;YACZ,aAAa,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC;SACpC,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { countMatchesInString } from \"../../../common/countMatchesInString.js\";\nimport type { PropertyDataFilterResult } from \"./PropertyDataFiltererBase.js\";\nimport {\n FilteredType,\n PropertyRecordDataFiltererBase,\n} from \"./PropertyDataFiltererBase.js\";\n\n/**\n * Property data filterer which matches on Primitive Property Record display value text.\n * @public\n */\nexport class DisplayValuePropertyDataFilterer extends PropertyRecordDataFiltererBase {\n private _filterText: string = \"\";\n\n public constructor(filterText: string = \"\") {\n super();\n this._filterText = filterText.toLowerCase().trim();\n }\n\n public get filterText(): string {\n return this._filterText;\n }\n\n public set filterText(value: string) {\n const lowerValue = value.toLowerCase().trim();\n if (lowerValue !== this.filterText) {\n this._filterText = lowerValue;\n this.onFilterChanged.raiseEvent();\n }\n }\n\n public get isActive() {\n return this.filterText !== \"\";\n }\n\n public async recordMatchesFilter(\n node: PropertyRecord\n ): Promise<PropertyDataFilterResult> {\n if (!this.isActive) return { matchesFilter: true };\n\n if (node.value.valueFormat !== PropertyValueFormat.Primitive)\n return { matchesFilter: false };\n\n const displayValue = node.value.displayValue?.toLowerCase() ?? \"\";\n const matchesCount = countMatchesInString(displayValue, this.filterText);\n\n if (matchesCount === 0) return { matchesFilter: false };\n\n return {\n matchesFilter: true,\n shouldExpandNodeParents: true,\n matchesCount,\n filteredTypes: [FilteredType.Value],\n };\n }\n}\n"]}
|
package/lib/components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer.js
CHANGED
|
@@ -12,9 +12,9 @@ import { FilteredType, PropertyRecordDataFiltererBase, } from "./PropertyDataFil
|
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
14
|
export class LabelPropertyDataFilterer extends PropertyRecordDataFiltererBase {
|
|
15
|
+
_filterText = "";
|
|
15
16
|
constructor(filterText = "") {
|
|
16
17
|
super();
|
|
17
|
-
this._filterText = "";
|
|
18
18
|
this._filterText = filterText.toLowerCase().trim();
|
|
19
19
|
}
|
|
20
20
|
get filterText() {
|
package/lib/components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LabelPropertyDataFilterer.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAE/E,OAAO,EACL,YAAY,EACZ,8BAA8B,GAC/B,MAAM,+BAA+B,CAAC;AAEvC;;;GAGG;AACH,MAAM,OAAO,yBAA0B,SAAQ,8BAA8B;
|
|
1
|
+
{"version":3,"file":"LabelPropertyDataFilterer.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MA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KAAK,CAAC;SACpC,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { countMatchesInString } from \"../../../common/countMatchesInString.js\";\nimport type { PropertyDataFilterResult } from \"./PropertyDataFiltererBase.js\";\nimport {\n FilteredType,\n PropertyRecordDataFiltererBase,\n} from \"./PropertyDataFiltererBase.js\";\n\n/**\n * PropertyData filter which matches on any record type label and includes descendant nodes on match\n * @public\n */\nexport class LabelPropertyDataFilterer extends PropertyRecordDataFiltererBase {\n private _filterText: string = \"\";\n\n public constructor(filterText: string = \"\") {\n super();\n this._filterText = filterText.toLowerCase().trim();\n }\n\n public get filterText(): string {\n return this._filterText;\n }\n\n public set filterText(value: string) {\n const lowerValue = value.toLowerCase().trim();\n if (lowerValue !== this.filterText) {\n this._filterText = lowerValue;\n this.onFilterChanged.raiseEvent();\n }\n }\n\n public get isActive() {\n return this.filterText !== \"\";\n }\n\n public async recordMatchesFilter(\n node: PropertyRecord\n ): Promise<PropertyDataFilterResult> {\n if (!this.isActive) return { matchesFilter: true };\n\n const displayLabel = node.property.displayLabel.toLowerCase();\n const matchesCount = countMatchesInString(displayLabel, this.filterText);\n if (matchesCount === 0) return { matchesFilter: false };\n\n return {\n matchesFilter: true,\n shouldExpandNodeParents: true,\n shouldForceIncludeDescendants: true,\n matchesCount,\n filteredTypes: [FilteredType.Label],\n };\n }\n}\n"]}
|
package/lib/components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer.js
CHANGED
|
@@ -12,9 +12,9 @@ import { FilteredType, PropertyCategoryDataFiltererBase, } from "./PropertyDataF
|
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
14
|
export class PropertyCategoryLabelFilterer extends PropertyCategoryDataFiltererBase {
|
|
15
|
+
_filterText = "";
|
|
15
16
|
constructor(filterText = "") {
|
|
16
17
|
super();
|
|
17
|
-
this._filterText = "";
|
|
18
18
|
this._filterText = filterText.toLowerCase().trim();
|
|
19
19
|
}
|
|
20
20
|
get filterText() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyCategoryLabelFilterer.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAG/E,OAAO,EACL,YAAY,EACZ,gCAAgC,GACjC,MAAM,+BAA+B,CAAC;AAEvC;;;GAGG;AACH,MAAM,OAAO,6BAA8B,SAAQ,gCAAgC;
|
|
1
|
+
{"version":3,"file":"PropertyCategoryLabelFilterer.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAG/E,OAAO,EACL,YAAY,EACZ,gCAAgC,GACjC,MAAM,+BAA+B,CAAC;AAEvC;;;GAGG;AACH,MAAM,OAAO,6BAA8B,SAAQ,gCAAgC;IACzE,WAAW,GAAW,EAAE,CAAC;IAEjC,YAAmB,aAAqB,EAAE;QACxC,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IACrD,CAAC;IAED,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAW,UAAU,CAAC,KAAa;QACjC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;QAC9C,IAAI,UAAU,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;YACnC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC9B,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;QACpC,CAAC;IACH,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,UAAU,KAAK,EAAE,CAAC;IAChC,CAAC;IAEM,KAAK,CAAC,qBAAqB,CAChC,IAAsB;QAEtB,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;QAEnD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;QAC9C,MAAM,YAAY,GAAG,oBAAoB,CAAC,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAEzE,IAAI,YAAY,KAAK,CAAC;YAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAExD,OAAO;YACL,aAAa,EAAE,IAAI;YACnB,uBAAuB,EAAE,IAAI;YAC7B,6BAA6B,EAAE,IAAI;YACnC,YAAY;YACZ,aAAa,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC;SACvC,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport { countMatchesInString } from \"../../../common/countMatchesInString.js\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider.js\";\nimport type { PropertyDataFilterResult } from \"./PropertyDataFiltererBase.js\";\nimport {\n FilteredType,\n PropertyCategoryDataFiltererBase,\n} from \"./PropertyDataFiltererBase.js\";\n\n/**\n * PropertyData filterer which matches on PropertyCategory's label.\n * @public\n */\nexport class PropertyCategoryLabelFilterer extends PropertyCategoryDataFiltererBase {\n private _filterText: string = \"\";\n\n public constructor(filterText: string = \"\") {\n super();\n this._filterText = filterText.toLowerCase().trim();\n }\n\n public get filterText(): string {\n return this._filterText;\n }\n\n public set filterText(value: string) {\n const lowerValue = value.toLowerCase().trim();\n if (lowerValue !== this.filterText) {\n this._filterText = lowerValue;\n this.onFilterChanged.raiseEvent();\n }\n }\n\n public get isActive() {\n return this.filterText !== \"\";\n }\n\n public async categoryMatchesFilter(\n node: PropertyCategory\n ): Promise<PropertyDataFilterResult> {\n if (!this.isActive) return { matchesFilter: true };\n\n const displayLabel = node.label.toLowerCase();\n const matchesCount = countMatchesInString(displayLabel, this.filterText);\n\n if (matchesCount === 0) return { matchesFilter: false };\n\n return {\n matchesFilter: true,\n shouldExpandNodeParents: true,\n shouldForceIncludeDescendants: true,\n matchesCount,\n filteredTypes: [FilteredType.Category],\n };\n }\n}\n"]}
|
package/lib/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.js
CHANGED
|
@@ -27,9 +27,7 @@ export class PropertyFilterChangeEvent extends BeEvent {
|
|
|
27
27
|
* @public
|
|
28
28
|
*/
|
|
29
29
|
export class PropertyDataFiltererBase {
|
|
30
|
-
|
|
31
|
-
this.onFilterChanged = new PropertyFilterChangeEvent();
|
|
32
|
-
}
|
|
30
|
+
onFilterChanged = new PropertyFilterChangeEvent();
|
|
33
31
|
}
|
|
34
32
|
/**
|
|
35
33
|
* An abstract implementation of [[IPropertyDataFilterer]] that can be used as base for all
|
package/lib/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyDataFiltererBase.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C;;;GAGG;AACH,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,uDAAQ,CAAA;IACR,iDAAK,CAAA;IACL,iDAAK,CAAA;AACP,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAuCD;;;GAGG;AACH,MAAM,OAAO,yBAA0B,SAAQ,OAAsC;CAAG;AAoBxF;;;GAGG;AACH,MAAM,OAAgB,wBAAwB;
|
|
1
|
+
{"version":3,"file":"PropertyDataFiltererBase.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAG9C;;;GAGG;AACH,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,uDAAQ,CAAA;IACR,iDAAK,CAAA;IACL,iDAAK,CAAA;AACP,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAuCD;;;GAGG;AACH,MAAM,OAAO,yBAA0B,SAAQ,OAAsC;CAAG;AAoBxF;;;GAGG;AACH,MAAM,OAAgB,wBAAwB;IAGrC,eAAe,GACpB,IAAI,yBAAyB,EAAE,CAAC;CAUnC;AAED;;;;GAIG;AACH,MAAM,OAAgB,gCAAiC,SAAQ,wBAAwB;IAC9E,KAAK,CAAC,mBAAmB;QAC9B,OAAO,EAAE,aAAa,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3C,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAgB,8BAA+B,SAAQ,wBAAwB;IAC5E,KAAK,CAAC,qBAAqB;QAChC,OAAO,EAAE,aAAa,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3C,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider.js\";\n\n/**\n * Enumeration of possible component filtered types\n * @public\n */\nexport enum FilteredType {\n Category,\n Label,\n Value,\n}\n\n/**\n * Data structure for storing [[IPropertyDataFilterer]] matching results\n * @public\n */\nexport interface PropertyDataFilterResult {\n /** Indicates whether provided item matched filter */\n matchesFilter: boolean;\n\n /**\n * Indicates whether descendants nodes should be forcefully included in filtered results.\n * Can only be true for nodes that have `matchesFilter` set to true.\n */\n shouldForceIncludeDescendants?: boolean;\n\n /**\n * Indicates whether parents of node should be expanded up to this match node.\n * Can only be true for nodes that have `matchesFilter` set to true.\n */\n shouldExpandNodeParents?: boolean;\n\n /**\n * Indicates how many times filter was matched in the provided item.\n */\n matchesCount?: number;\n\n /**\n * Indicates what item types were matched.\n */\n filteredTypes?: FilteredType[];\n}\n\n/**\n * A signature for property data change listeners\n * @public\n */\nexport declare type PropertyFilterChangesListener = () => void;\n\n/**\n * An event broadcasted when property filter changes\n * @public\n */\nexport class PropertyFilterChangeEvent extends BeEvent<PropertyFilterChangesListener> {}\n\n/**\n * An interface for a filterer that filters [[PropertyData]] based on content of [[PropertyRecord]]\n * and [[PropertyCategory]] objects.\n * @public\n */\nexport interface IPropertyDataFilterer {\n readonly isActive: boolean;\n recordMatchesFilter: (\n node: PropertyRecord,\n parents: PropertyRecord[]\n ) => Promise<PropertyDataFilterResult>;\n categoryMatchesFilter: (\n node: PropertyCategory,\n parents: PropertyCategory[]\n ) => Promise<PropertyDataFilterResult>;\n onFilterChanged: PropertyFilterChangeEvent;\n}\n\n/**\n * An abstract implementation of [[IPropertyDataFilterer]] to share common behavior between different implementations.\n * @public\n */\nexport abstract class PropertyDataFiltererBase\n implements IPropertyDataFilterer\n{\n public onFilterChanged: PropertyFilterChangeEvent =\n new PropertyFilterChangeEvent();\n public abstract get isActive(): boolean;\n public abstract recordMatchesFilter(\n node: PropertyRecord,\n parents: PropertyRecord[]\n ): Promise<PropertyDataFilterResult>;\n public abstract categoryMatchesFilter(\n node: PropertyCategory,\n parents: PropertyCategory[]\n ): Promise<PropertyDataFilterResult>;\n}\n\n/**\n * An abstract implementation of [[IPropertyDataFilterer]] that can be used as base for all\n * filterers that filter based on [[PropertyCategory]] content.\n * @public\n */\nexport abstract class PropertyCategoryDataFiltererBase extends PropertyDataFiltererBase {\n public async recordMatchesFilter(): Promise<PropertyDataFilterResult> {\n return { matchesFilter: !this.isActive };\n }\n}\n\n/**\n * An abstract implementation of [[IPropertyDataFilterer]] that can be used as base for all\n * filterers that filter based on [[PropertyRecord]] content.\n * @public\n */\nexport abstract class PropertyRecordDataFiltererBase extends PropertyDataFiltererBase {\n public async categoryMatchesFilter(): Promise<PropertyDataFilterResult> {\n return { matchesFilter: !this.isActive };\n }\n}\n"]}
|
|
@@ -7,18 +7,19 @@
|
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
9
|
export class PropertyGridEventHandler {
|
|
10
|
+
_modelSource;
|
|
10
11
|
constructor(_modelSource) {
|
|
11
12
|
this._modelSource = _modelSource;
|
|
12
|
-
/**
|
|
13
|
-
* Flips isExpand on item by given selectionKey
|
|
14
|
-
* @param selectionKey item to be modified
|
|
15
|
-
*/
|
|
16
|
-
this.onExpansionToggled = (selectionKey) => {
|
|
17
|
-
this._modelSource.modifyModel((draftModel) => {
|
|
18
|
-
const item = draftModel.getItem(selectionKey);
|
|
19
|
-
item.isExpanded = !item.isExpanded;
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Flips isExpand on item by given selectionKey
|
|
16
|
+
* @param selectionKey item to be modified
|
|
17
|
+
*/
|
|
18
|
+
onExpansionToggled = (selectionKey) => {
|
|
19
|
+
this._modelSource.modifyModel((draftModel) => {
|
|
20
|
+
const item = draftModel.getItem(selectionKey);
|
|
21
|
+
item.isExpanded = !item.isExpanded;
|
|
22
|
+
});
|
|
23
|
+
};
|
|
23
24
|
}
|
|
24
25
|
//# sourceMappingURL=PropertyGridEventHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyGridEventHandler.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/internal/PropertyGridEventHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAehG;;;GAGG;AACH,MAAM,OAAO,wBAAwB;
|
|
1
|
+
{"version":3,"file":"PropertyGridEventHandler.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/internal/PropertyGridEventHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAehG;;;GAGG;AACH,MAAM,OAAO,wBAAwB;IACR;IAA3B,YAA2B,YAAsC;QAAtC,iBAAY,GAAZ,YAAY,CAA0B;IAAG,CAAC;IAErE;;;OAGG;IACI,kBAAkB,GAAG,CAAC,YAAoB,EAAE,EAAE;QACnD,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,UAAU,EAAE,EAAE;YAC3C,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;YAC9C,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;CACH","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport type { IPropertyGridModelSource } from \"./PropertyGridModelSource.js\";\n\n/**\n * Handles events and changes on PropertyGridModel data.\n * @public\n */\nexport interface IPropertyGridEventHandler {\n onExpansionToggled: (selectionKey: string) => void;\n}\n\n/**\n * Handles events and changes on PropertyGridModel data.\n * @public\n */\nexport class PropertyGridEventHandler {\n public constructor(private _modelSource: IPropertyGridModelSource) {}\n\n /**\n * Flips isExpand on item by given selectionKey\n * @param selectionKey item to be modified\n */\n public onExpansionToggled = (selectionKey: string) => {\n this._modelSource.modifyModel((draftModel) => {\n const item = draftModel.getItem(selectionKey);\n item.isExpanded = !item.isExpanded;\n });\n };\n}\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
var _a;
|
|
2
1
|
/*---------------------------------------------------------------------------------------------
|
|
3
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -12,9 +11,11 @@ import { immerable } from "immer";
|
|
|
12
11
|
* @public
|
|
13
12
|
*/
|
|
14
13
|
export class MutablePropertyGridModel {
|
|
14
|
+
_gridItemFactory;
|
|
15
|
+
[immerable] = true;
|
|
16
|
+
_categories;
|
|
15
17
|
constructor(propertyData, _gridItemFactory) {
|
|
16
18
|
this._gridItemFactory = _gridItemFactory;
|
|
17
|
-
this[_a] = true;
|
|
18
19
|
this._categories = propertyData.categories.map((category) => this._gridItemFactory.createGridCategory(category, propertyData.records));
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
@@ -72,5 +73,4 @@ export class MutablePropertyGridModel {
|
|
|
72
73
|
return visibleItems;
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
|
-
_a = immerable;
|
|
76
76
|
//# sourceMappingURL=PropertyGridModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyGridModel.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/internal/PropertyGridModel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PropertyGridModel.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/internal/PropertyGridModel.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAqClC;;;GAGG;AACH,MAAM,OAAO,wBAAwB;IAQzB;IALH,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAElB,W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,GAAG,QAAQ,CAAC,qBAAqB,EAAE,CAAC,CACnD,CAAC;QAEF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;OAGG;IACI,kBAAkB;QACvB,MAAM,YAAY,GAA2B,EAAE,CAAC;QAChD,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CACpC,YAAY,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,4BAA4B,EAAE,CAAC,CAC9D,CAAC;QAEF,OAAO,YAAY,CAAC;IACtB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport { immerable } from \"immer\";\nimport type {\n PropertyCategory,\n PropertyData,\n} from \"../PropertyDataProvider.js\";\nimport type {\n FlatGridItem,\n GridCategoryItem,\n} from \"./flat-items/FlatGridItem.js\";\nimport type {\n IMutableFlatGridItem,\n IMutableGridCategoryItem,\n} from \"./flat-items/MutableFlatGridItem.js\";\nimport type { IMutableGridItemFactory } from \"./flat-items/MutableGridItemFactory.js\";\n\n/**\n * PropertyGridModel interface for working with immutable FlatGridItems\n * @public\n */\nexport interface IPropertyGridModel {\n getItem: (selectionKey: string) => FlatGridItem;\n getRootCategories: () => GridCategoryItem[];\n getFlatGrid: () => FlatGridItem[];\n getVisibleFlatGrid: () => FlatGridItem[];\n}\n\n/**\n * PropertyGridModel interface for working with mutable FlatGridItems\n * @public\n */\nexport interface IMutablePropertyGridModel {\n getItem: (selectionKey: string) => IMutableFlatGridItem;\n getRootCategories: () => IMutableGridCategoryItem[];\n getFlatGrid: () => IMutableFlatGridItem[];\n getVisibleFlatGrid: () => IMutableFlatGridItem[];\n}\n\n/**\n * Implementation of PropertyGridModel for working with and converting PropertyData to mutable FlatGridItems\n * @public\n */\nexport class MutablePropertyGridModel\n implements IPropertyGridModel, IMutablePropertyGridModel\n{\n public [immerable] = true;\n\n private _categories: IMutableGridCategoryItem[];\n public constructor(\n propertyData: PropertyData,\n private _gridItemFactory: IMutableGridItemFactory\n ) {\n this._categories = propertyData.categories.map(\n (category: PropertyCategory) =>\n this._gridItemFactory.createGridCategory(category, propertyData.records)\n );\n }\n\n /**\n * Retrieves grid item from model.\n * @param selectionKey unique key for identifying item to retrieve.\n */\n public getItem(selectionKey: string) {\n const item = this.findItem(this._categories, selectionKey);\n if (!item)\n throw new Error(`Grid item at provided key not found: ${selectionKey}`);\n\n return item;\n }\n\n /**\n * Walks the grid item hierarchy and finds item matching key\n * @param items items and their descendants to check\n * @param selectionKey unique key for identifying item\n * @returns FlatGridItem if items with key exists, undefined otherwise\n */\n private findItem(\n items: IMutableFlatGridItem[],\n selectionKey: string\n ): IMutableFlatGridItem | undefined {\n for (const item of items) {\n // Each items key is prefixed with it's parent key, so we can ignore the ones that aren't prefixed to reduce checking unnecessary branches.\n if (!selectionKey.startsWith(item.selectionKey)) continue;\n\n if (item.selectionKey === selectionKey) return item;\n\n const foundItem = this.findItem(item.getChildren(), selectionKey);\n if (foundItem) return foundItem;\n }\n\n return undefined;\n }\n\n /**\n * Gets all GridCategoryItems that do not have parent categories.\n * @returns array of GridCategoryItems\n */\n public getRootCategories(): IMutableGridCategoryItem[] {\n return this._categories;\n }\n\n /**\n * Gets an array of all FlatGridItems.\n * @returns 1-Dimensional array of GridCategories and CategorizedProperties\n */\n public getFlatGrid(): IMutableFlatGridItem[] {\n const flatGrid: IMutableFlatGridItem[] = [];\n this._categories.forEach((category) =>\n flatGrid.push(...category.getDescendantsAndSelf())\n );\n\n return flatGrid;\n }\n\n /**\n * Gets an array of all currently visible FlatGridItems.\n * @returns 1-Dimensional array of GridCategories and CategorizedProperties\n */\n public getVisibleFlatGrid(): IMutableFlatGridItem[] {\n const visibleItems: IMutableFlatGridItem[] = [];\n this._categories.forEach((category) =>\n visibleItems.push(...category.getVisibleDescendantsAndSelf())\n );\n\n return visibleItems;\n }\n}\n"]}
|
|
@@ -14,10 +14,12 @@ import { PropertyGridModelChangeEvent } from "./PropertyGridModelChangeEvent.js"
|
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
16
|
export class PropertyGridModelSource {
|
|
17
|
+
_gridFactory;
|
|
18
|
+
_model;
|
|
19
|
+
/** Event that is emitted every time property model is changed. */
|
|
20
|
+
onModelChanged = new PropertyGridModelChangeEvent();
|
|
17
21
|
constructor(_gridFactory) {
|
|
18
22
|
this._gridFactory = _gridFactory;
|
|
19
|
-
/** Event that is emitted every time property model is changed. */
|
|
20
|
-
this.onModelChanged = new PropertyGridModelChangeEvent();
|
|
21
23
|
}
|
|
22
24
|
getFullModelMap(fullModel) {
|
|
23
25
|
const fullModelMap = new Map();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyGridModelSource.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/internal/PropertyGridModelSource.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAQhC,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAUjF;;;;GAIG;AACH,MAAM,OAAO,uBAAuB;
|
|
1
|
+
{"version":3,"file":"PropertyGridModelSource.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/internal/PropertyGridModelSource.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAQhC,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAUjF;;;;GAIG;AACH,MAAM,OAAO,uBAAuB;IAKP;IAJnB,MAAM,CAA6B;IAC3C,kEAAkE;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AEpD,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO;QAEzB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC7C,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC;IACnC,CAAC;IAED,mCAAmC;IAC5B,QAAQ;QACb,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport { produce } from \"immer\";\nimport type { PropertyData } from \"../PropertyDataProvider.js\";\nimport type { IMutableFlatGridItem } from \"./flat-items/MutableFlatGridItem.js\";\nimport type { IMutableGridItemFactory } from \"./flat-items/MutableGridItemFactory.js\";\nimport type {\n IMutablePropertyGridModel,\n IPropertyGridModel,\n} from \"./PropertyGridModel.js\";\nimport { MutablePropertyGridModel } from \"./PropertyGridModel.js\";\nimport { PropertyGridModelChangeEvent } from \"./PropertyGridModelChangeEvent.js\";\n\n/** @public */\nexport interface IPropertyGridModelSource {\n onModelChanged: PropertyGridModelChangeEvent;\n setPropertyData: (data: PropertyData) => void;\n modifyModel(callback: (model: IMutablePropertyGridModel) => void): void;\n getModel(): IPropertyGridModel | undefined;\n}\n\n/**\n * Controls property grid model.\n * It is used to modify property grid model model and inform when the model changes.\n * @public\n */\nexport class PropertyGridModelSource implements IPropertyGridModelSource {\n private _model?: IMutablePropertyGridModel;\n /** Event that is emitted every time property model is changed. */\n public onModelChanged = new PropertyGridModelChangeEvent();\n\n public constructor(private _gridFactory: IMutableGridItemFactory) {}\n\n private getFullModelMap(\n fullModel: IMutableFlatGridItem[]\n ): Map<string, IMutableFlatGridItem> {\n const fullModelMap = new Map<string, IMutableFlatGridItem>();\n for (const item of fullModel) {\n const key = item.selectionKey;\n fullModelMap.set(key, item);\n }\n\n return fullModelMap;\n }\n\n private moveOldModelState(\n oldModel: IMutablePropertyGridModel,\n newModel: IMutablePropertyGridModel\n ) {\n const oldModelMap = this.getFullModelMap(oldModel.getFlatGrid());\n const flatGrid = newModel.getFlatGrid();\n\n flatGrid.forEach((gridItem) => {\n const oldGridItem = oldModelMap.get(gridItem.selectionKey);\n if (oldGridItem) gridItem.isExpanded = oldGridItem.isExpanded;\n });\n }\n\n public setPropertyData(data: PropertyData) {\n const newModel = new MutablePropertyGridModel(data, this._gridFactory);\n if (this._model !== undefined && data.reusePropertyDataState)\n this.moveOldModelState(this._model, newModel);\n\n this._model = newModel;\n this.onModelChanged.raiseEvent();\n }\n\n /**\n * Modifies property grid model using provided callback.\n * If changes to model are detected, onModelChanged emits an event to all subscribers.\n */\n public modifyModel(\n callback: (model: IMutablePropertyGridModel) => void\n ): void {\n if (!this._model) return;\n\n this._model = produce(this._model, callback);\n this.onModelChanged.raiseEvent();\n }\n\n /** Returns property grid model. */\n public getModel(): IPropertyGridModel | undefined {\n return this._model;\n }\n}\n"]}
|
package/lib/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js
CHANGED
|
@@ -12,6 +12,8 @@ import { FlatGridItemType, MutableCategorizedProperty, } from "./MutableFlatGrid
|
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
14
|
export class MutableCategorizedArrayProperty extends MutableCategorizedProperty {
|
|
15
|
+
_renderLabel;
|
|
16
|
+
_children;
|
|
15
17
|
constructor(record, parentSelectionKey, parentCategorySelectionKey, depth, gridItemFactory, overrideName, overrideDisplayLabel) {
|
|
16
18
|
super(FlatGridItemType.Array, record, parentSelectionKey, parentCategorySelectionKey, depth, overrideName, overrideDisplayLabel);
|
|
17
19
|
this._renderLabel = !record.property.hideCompositePropertyLabel;
|
package/lib/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutableCategorizedArrayProperty.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AACH,OAAO,EAEL,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EACL,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAGlC;;;GAGG;AACH,MAAM,OAAO,+BACX,SAAQ,0BAA0B;
|
|
1
|
+
{"version":3,"file":"MutableCategorizedArrayProperty.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG;;GAEG;AACH,OAAO,EAEL,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EACL,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAGlC;;;GAGG;AACH,MAAM,OAAO,+BACX,SAAQ,0BAA0B;IAG1B,YAAY,CAAU;IACtB,SAAS,CAAoC;IAErD,YACE,MAAsB,EACtB,kBAA0B,EAC1B,0BAAkC,EAClC,KAAa,EACb,eAAwC,EACxC,YAAqB,EACrB,oBAA6B;QAE7B,KAAK,CACH,gBAAgB,CAAC,KAAK,EACtB,MAAM,EACN,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,EACL,YAAY,EACZ,oBAAoB,CACrB,CAAC;QACF,IAAI,CAAC,YAAY,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAC;QAChE,MAAM,aAAa,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YAChE,MAAM,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EAAE,CAAC;IACnC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport {\n type PropertyRecord,\n PropertyValueFormat,\n} from \"@itwin/appui-abstract\";\nimport type {\n IMutableCategorizedPropertyItem,\n IMutableFlatGridItem,\n} from \"./MutableFlatGridItem.js\";\nimport {\n FlatGridItemType,\n MutableCategorizedProperty,\n} from \"./MutableFlatGridItem.js\";\nimport type { IMutableGridItemFactory } from \"./MutableGridItemFactory.js\";\n\n/**\n * Mutable wrapper object for PropertyRecord with array valueFormat which provides methods for working with and managing record children hierarchies.\n * @public\n */\nexport class MutableCategorizedArrayProperty\n extends MutableCategorizedProperty\n implements IMutableCategorizedPropertyItem\n{\n private _renderLabel: boolean;\n private _children: IMutableCategorizedPropertyItem[];\n\n public constructor(\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n gridItemFactory: IMutableGridItemFactory,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) {\n super(\n FlatGridItemType.Array,\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n overrideName,\n overrideDisplayLabel\n );\n this._renderLabel = !record.property.hideCompositePropertyLabel;\n const childrenDepth = depth + (this._renderLabel ? 1 : 0);\n this._children = record.getChildrenRecords().map((child, index) => {\n const newName = `${child.property.name}_${index}`;\n let newDisplayLabel = `[${index + 1}]`;\n if (\n child.description &&\n child.value.valueFormat !== PropertyValueFormat.Primitive\n ) {\n newDisplayLabel += ` ${child.description}`;\n }\n\n return gridItemFactory.createCategorizedProperty(\n child,\n this.selectionKey,\n parentCategorySelectionKey,\n childrenDepth,\n newName,\n newDisplayLabel\n );\n });\n }\n\n public get type(): FlatGridItemType.Array {\n return FlatGridItemType.Array;\n }\n\n public getChildren(): IMutableCategorizedPropertyItem[] {\n return this._children;\n }\n\n public override getDescendantsAndSelf() {\n return this._renderLabel\n ? super.getDescendantsAndSelf()\n : this.getDescendants();\n }\n\n public override getVisibleDescendants(): IMutableFlatGridItem[] {\n const descendants: IMutableFlatGridItem[] = [];\n if (this.isExpanded || !this._renderLabel) {\n // always render children if not rendering the label, otherwise there's no way to expand\n // this item to make children visible\n this.getChildren().forEach((child) =>\n descendants.push(...child.getVisibleDescendantsAndSelf())\n );\n }\n return descendants;\n }\n\n public override getVisibleDescendantsAndSelf() {\n return this._renderLabel\n ? super.getVisibleDescendantsAndSelf()\n : this.getVisibleDescendants();\n }\n}\n"]}
|
package/lib/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.js
CHANGED
|
@@ -8,6 +8,8 @@ import { FlatGridItemType, MutableCategorizedProperty, } from "./MutableFlatGrid
|
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
10
|
export class MutableCategorizedStructProperty extends MutableCategorizedProperty {
|
|
11
|
+
_renderLabel;
|
|
12
|
+
_children;
|
|
11
13
|
constructor(record, parentSelectionKey, parentCategorySelectionKey, depth, gridItemFactory, overrideName, overrideDisplayLabel) {
|
|
12
14
|
super(FlatGridItemType.Struct, record, parentSelectionKey, parentCategorySelectionKey, depth, overrideName, overrideDisplayLabel);
|
|
13
15
|
this._renderLabel = !record.property.hideCompositePropertyLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutableCategorizedStructProperty.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAUhG,OAAO,EACL,gBAAgB,EAChB,0BAA0B,GAC3B,MAAM,0BAA0B,CAAC;AAGlC;;;GAGG;AACH,MAAM,OAAO,gCACX,SAAQ,0BAA0B;
|
|
1
|
+
{"version":3,"file":"MutableCategorizedStructProperty.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/internal/flat-items/MutableCategor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CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YAC1C,wFAAwF;YACxF,qCAAqC;YACrC,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CACnC,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,4BAA4B,EAAE,CAAC,CAC1D,CAAC;QACJ,CAAC;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAEe,4BAA4B;QAC1C,OAAO,IAAI,CAAC,YAAY;YACtB,CAAC,CAAC,KAAK,CAAC,4BAA4B,EAAE;YACtC,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;IACnC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type {\n IMutableCategorizedPropertyItem,\n IMutableFlatGridItem,\n} from \"./MutableFlatGridItem.js\";\nimport {\n FlatGridItemType,\n MutableCategorizedProperty,\n} from \"./MutableFlatGridItem.js\";\nimport type { IMutableGridItemFactory } from \"./MutableGridItemFactory.js\";\n\n/**\n * Mutable wrapper object for PropertyRecord with struct valueFormat which provides methods for working with and managing record children hierarchies.\n * @public\n */\nexport class MutableCategorizedStructProperty\n extends MutableCategorizedProperty\n implements IMutableCategorizedPropertyItem\n{\n private _renderLabel: boolean;\n private _children: IMutableCategorizedPropertyItem[];\n\n public constructor(\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n gridItemFactory: IMutableGridItemFactory,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) {\n super(\n FlatGridItemType.Struct,\n record,\n parentSelectionKey,\n parentCategorySelectionKey,\n depth,\n overrideName,\n overrideDisplayLabel\n );\n this._renderLabel = !record.property.hideCompositePropertyLabel;\n const childrenDepth = depth + (this._renderLabel ? 1 : 0);\n this._children = record.getChildrenRecords().map((value) => {\n return gridItemFactory.createCategorizedProperty(\n value,\n this.selectionKey,\n this.parentCategorySelectionKey,\n childrenDepth\n );\n });\n }\n\n public get type(): FlatGridItemType.Struct {\n return FlatGridItemType.Struct;\n }\n\n public getChildren(): IMutableCategorizedPropertyItem[] {\n return this._children;\n }\n\n public override getDescendantsAndSelf() {\n return this._renderLabel\n ? super.getDescendantsAndSelf()\n : this.getDescendants();\n }\n\n public override getVisibleDescendants(): IMutableFlatGridItem[] {\n const descendants: IMutableFlatGridItem[] = [];\n if (this.isExpanded || !this._renderLabel) {\n // always render children if not rendering the label, otherwise there's no way to expand\n // this item to make children visible\n this.getChildren().forEach((child) =>\n descendants.push(...child.getVisibleDescendantsAndSelf())\n );\n }\n return descendants;\n }\n\n public override getVisibleDescendantsAndSelf() {\n return this._renderLabel\n ? super.getVisibleDescendantsAndSelf()\n : this.getVisibleDescendants();\n }\n}\n"]}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { FlatGridItemType, MutableFlatPropertyGridItem, } from "./MutableFlatGridItem.js";
|
|
2
2
|
/** @internal */
|
|
3
3
|
export class MutableCustomGridCategory extends MutableFlatPropertyGridItem {
|
|
4
|
+
_children;
|
|
5
|
+
_renderer;
|
|
6
|
+
type = FlatGridItemType.Category;
|
|
7
|
+
label;
|
|
8
|
+
name;
|
|
9
|
+
selectionKey;
|
|
4
10
|
constructor(category, recordsDict, gridItemFactory, parentSelectionKey, depth) {
|
|
5
11
|
super(depth, parentSelectionKey, parentSelectionKey);
|
|
6
|
-
this.type = FlatGridItemType.Category;
|
|
7
12
|
this.name = category.name;
|
|
8
13
|
this.label = category.label;
|
|
9
14
|
this.isExpanded = category.expand;
|
package/lib/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutableCustomGridCategory.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,0BAA0B,CAAC;AAIlC,gBAAgB;AAChB,MAAM,OAAO,yBACX,SAAQ,2BAA2B;
|
|
1
|
+
{"version":3,"file":"MutableCustomGridCategory.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,gBAAgB,EAChB,2BAA2B,GAC5B,MAAM,0BAA0B,CAAC;AAIlC,gBAAgB;AAChB,MAAM,OAAO,yBACX,SAAQ,2BAA2B;IAGlB,SAAS,CAAoC;IAC7C,SAAS,CAA+B;IAEzC,IAAI,GAAG,gBAAgB,CAAC,QAAiB,CAAC;IAC1C,KAAK,CAAS;IACd,IAAI,CAAS;IACb,YAAY,CAAS;IAErC,YACE,QAA0B,EAC1B,WAAgC,EAChC,eAAwC,EACxC,kBAAsC,EACtC,KAAa;QAEb,KAAK,CAAC,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;QAErD,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC;QAClC,IAAI,CAAC,YAAY;YACf,kBAAkB,KAAK,SAAS;gBAC9B,CAAC,CAAC,IAAI,CAAC,IAAI;gBACX,CAAC,CAAC,GAAG,kBAAkB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QAC3C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC;QAEnC,oHAAoH;QACpH,uBAAuB;QACvB,MAAM,eAAe,GAAG,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACzD,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAC7C,eAAe,CAAC,yBAAyB,CACvC,KAAK,EACL,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,YAAY,EACjB,CAAC,CACF,CACF,CAAC;QAEF,IAAI,CAAC,wBAAwB,GAAG,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,IAAW,eAAe;QACxB,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,MAAM,EAAE,IAAI,CAAC,UAAU;YACvB,QAAQ,EAAE,IAAI,CAAC,SAAS;SACzB,CAAC;IACJ,CAAC;IAED,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC,KAAK,KAAK,CAAC,CAAC;IAC1B,CAAC;IAED,IAAoB,wBAAwB;QAC1C,OAAO,IAAI,CAAC,yBAAyB,CAAC;IACxC,CAAC;IAED,IAAoB,wBAAwB,CAAC,KAAa;QACxD,IAAI,CAAC,yBAAyB,GAAG,KAAK,GAAG,CAAC,CAAC;IAC7C,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEe,4BAA4B;QAC1C,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport type { PropertyCategory } from \"../../PropertyDataProvider.js\";\nimport type {\n IMutableCategorizedPropertyItem,\n IMutableFlatGridItem,\n IMutableGridCategoryItem,\n} from \"./MutableFlatGridItem.js\";\nimport {\n FlatGridItemType,\n MutableFlatPropertyGridItem,\n} from \"./MutableFlatGridItem.js\";\nimport type { CategoryRecordsDict } from \"./MutableGridCategory.js\";\nimport type { IMutableGridItemFactory } from \"./MutableGridItemFactory.js\";\n\n/** @internal */\nexport class MutableCustomGridCategory\n extends MutableFlatPropertyGridItem\n implements IMutableGridCategoryItem\n{\n private readonly _children: IMutableCategorizedPropertyItem[];\n private readonly _renderer: PropertyCategory[\"renderer\"];\n\n public readonly type = FlatGridItemType.Category as const;\n public readonly label: string;\n public readonly name: string;\n public readonly selectionKey: string;\n\n public constructor(\n category: PropertyCategory,\n recordsDict: CategoryRecordsDict,\n gridItemFactory: IMutableGridItemFactory,\n parentSelectionKey: string | undefined,\n depth: number\n ) {\n super(depth, parentSelectionKey, parentSelectionKey);\n\n this.name = category.name;\n this.label = category.label;\n this.isExpanded = category.expand;\n this.selectionKey =\n parentSelectionKey === undefined\n ? this.name\n : `${parentSelectionKey}_${this.name}`;\n this._renderer = category.renderer;\n\n // Even though categories are nested and have their own depth, categorized properties depth is counted starting with\n // the parent category.\n const categoryRecords = recordsDict[category.name] ?? [];\n this._children = categoryRecords.map((value) =>\n gridItemFactory.createCategorizedProperty(\n value,\n this.selectionKey,\n this.selectionKey,\n 0\n )\n );\n\n this.lastInNumberOfCategories = -1;\n }\n\n public get derivedCategory(): PropertyCategory {\n return {\n name: this.name,\n label: this.label,\n expand: this.isExpanded,\n renderer: this._renderer,\n };\n }\n\n public get isRootCategory(): boolean {\n return this.depth === 0;\n }\n\n public override get lastInNumberOfCategories(): number {\n return this._lastInNumberOfCategories;\n }\n\n public override set lastInNumberOfCategories(value: number) {\n this._lastInNumberOfCategories = value + 1;\n }\n\n public getSelf() {\n return this;\n }\n\n public getChildren(): IMutableFlatGridItem[] {\n return this._children;\n }\n\n public override getVisibleDescendantsAndSelf(): IMutableFlatGridItem[] {\n return [this];\n }\n}\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
var _a;
|
|
2
1
|
/*---------------------------------------------------------------------------------------------
|
|
3
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -27,15 +26,18 @@ export var FlatGridItemType;
|
|
|
27
26
|
* @public
|
|
28
27
|
*/
|
|
29
28
|
export class MutableFlatPropertyGridItem {
|
|
29
|
+
_depth;
|
|
30
|
+
_parentSelectionKey;
|
|
31
|
+
_parentCategorySelectionKey;
|
|
32
|
+
[immerable] = true;
|
|
33
|
+
key = Guid.createValue();
|
|
34
|
+
_isExpanded = false;
|
|
35
|
+
_lastInNumberOfCategories = 0;
|
|
36
|
+
_isLastInRootCategory = false;
|
|
30
37
|
constructor(_depth, _parentSelectionKey, _parentCategorySelectionKey) {
|
|
31
38
|
this._depth = _depth;
|
|
32
39
|
this._parentSelectionKey = _parentSelectionKey;
|
|
33
40
|
this._parentCategorySelectionKey = _parentCategorySelectionKey;
|
|
34
|
-
this[_a] = true;
|
|
35
|
-
this.key = Guid.createValue();
|
|
36
|
-
this._isExpanded = false;
|
|
37
|
-
this._lastInNumberOfCategories = 0;
|
|
38
|
-
this._isLastInRootCategory = false;
|
|
39
41
|
if (this._depth < 0)
|
|
40
42
|
throw new Error("Depth cannot be negative");
|
|
41
43
|
}
|
|
@@ -124,12 +126,13 @@ export class MutableFlatPropertyGridItem {
|
|
|
124
126
|
children[children.length - 1].isLastInRootCategory = value;
|
|
125
127
|
}
|
|
126
128
|
}
|
|
127
|
-
_a = immerable;
|
|
128
129
|
/**
|
|
129
130
|
* Base class for all Mutable CategorizedProperties
|
|
130
131
|
* @public
|
|
131
132
|
*/
|
|
132
133
|
export class MutableCategorizedProperty extends MutableFlatPropertyGridItem {
|
|
134
|
+
_derivedRecord;
|
|
135
|
+
_selectionKey;
|
|
133
136
|
constructor(type, record, parentSelectionKey, parentCategorySelectionKey, depth, overrideName, overrideDisplayLabel) {
|
|
134
137
|
super(depth, parentSelectionKey, parentCategorySelectionKey);
|
|
135
138
|
const recordType = this.valueTypeToFlatGridType(record.value.valueFormat);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutableFlatGridItem.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG3C;;;;;GAKG;AACH,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,+DAAQ,CAAA;IACR,iEAAS,CAAA;IACT,yDAAK,CAAA;IACL,2DAAM,CAAA;AACR,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAgCD;;;GAGG;AACH,MAAM,OAAgB,2BAA2B;IAU/C,YACU,MAAc,EACd,mBAAuC,EACvC,2BAA+C;QAF/C,WAAM,GAAN,MAAM,CAAQ;QACd,wBAAmB,GAAnB,mBAAmB,CAAoB;QACvC,gCAA2B,GAA3B,2BAA2B,CAAoB;QAVlD,QAAW,GAAG,IAAI,CAAC;QAEV,QAAG,GAAW,IAAI,CAAC,WAAW,EAAE,CAAC;QACvC,gBAAW,GAAY,KAAK,CAAC;QAC7B,8BAAyB,GAAW,CAAC,CAAC;QACtC,0BAAqB,GAAY,KAAK,CAAC;QAO/C,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACnE,CAAC;IAMD,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAW,kBAAkB;QAC3B,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IAED,IAAW,0BAA0B;QACnC,OAAO,IAAI,CAAC,2BAA2B,CAAC;IAC1C,CAAC;IAED,IAAW,UAAU;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAW,UAAU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,EAAE,GAAG,EAAE,GAAG,mBAAmB,EAAE,CAAC;QACvE,MAAM,OAAO,GAAG,YAAY,IAAI,IAAI,CAAC;QACrC,MAAM,eAAe,GAAG,eAAe,IAAI,YAAY,CAAC;QAExD,OAAO,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC;IACvE,CAAC;IAED;;OAEG;IACK,iBAAiB,CACvB,MAAsB,EACtB,6BAAkD;QAElD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;QAC9C,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,KAAK,EAAE,6BAA6B,CAAC,CAAC;QAE3E,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAoB,0BAA0B;QAC5C,OAAO,KAAK,CAAC,0BAA2B,CAAC;IAC3C,CAAC;IAED,IAAoB,kBAAkB;QACpC,OAAO,KAAK,CAAC,kBAAmB,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport { immerable } from \"immer\";\nimport type { PropertyDescription } from \"@itwin/appui-abstract\";\nimport { PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { Guid } from \"@itwin/core-bentley\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider.js\";\n\n/**\n * Types of FlatGridItems for differentiating what property FlatGridItem is wrapping.\n * Category for PropertyCategory\n * (Primitive, Array, Struct) for PropertyRecord with valueFormats: (Primitive, Array, Struct)\n * @public\n */\nexport enum FlatGridItemType {\n Category,\n Primitive,\n Array,\n Struct,\n}\n\n/**\n * Type which extracts FlatGridItemTypes relevant for working with CategorizedProperties\n * @public\n */\nexport type CategorizedPropertyTypes =\n | FlatGridItemType.Array\n | FlatGridItemType.Primitive\n | FlatGridItemType.Struct;\n\n/**\n * Base mutable data structure defining common methods and properties for both CategorizedProperties and GridCategoryItems\n * @public\n */\nexport interface IMutableFlatPropertyGridItem {\n readonly type: FlatGridItemType;\n readonly key: string;\n readonly selectionKey: string;\n readonly parentSelectionKey: string | undefined;\n readonly parentCategorySelectionKey: string | undefined;\n readonly depth: number;\n readonly label: string;\n lastInNumberOfCategories: number;\n isLastInRootCategory: boolean;\n isExpanded: boolean;\n getDescendantsAndSelf(): IMutableFlatGridItem[];\n getVisibleDescendantsAndSelf(): IMutableFlatGridItem[];\n getChildren(): IMutableFlatGridItem[];\n getLastVisibleDescendantOrSelf(): IMutableFlatGridItem;\n}\n\n/**\n * Base class for all FlatPropertyGrid items\n * @public\n */\nexport abstract class MutableFlatPropertyGridItem\n implements IMutableFlatPropertyGridItem\n{\n public [immerable] = true;\n\n public readonly key: string = Guid.createValue();\n protected _isExpanded: boolean = false;\n protected _lastInNumberOfCategories: number = 0;\n protected _isLastInRootCategory: boolean = false;\n\n public constructor(\n private _depth: number,\n private _parentSelectionKey: string | undefined,\n private _parentCategorySelectionKey: string | undefined\n ) {\n if (this._depth < 0) throw new Error(\"Depth cannot be negative\");\n }\n\n public abstract type: FlatGridItemType;\n public abstract label: string;\n public abstract selectionKey: string;\n\n public get depth() {\n return this._depth;\n }\n\n public get parentSelectionKey() {\n return this._parentSelectionKey;\n }\n\n public get parentCategorySelectionKey() {\n return this._parentCategorySelectionKey;\n }\n\n public get isExpanded() {\n return this._isExpanded;\n }\n\n public set isExpanded(value: boolean) {\n this._isExpanded = value;\n }\n\n public abstract getChildren(): IMutableFlatGridItem[];\n public abstract getSelf(): IMutableFlatGridItem;\n\n protected getDescendants() {\n const descendants: IMutableFlatGridItem[] = [];\n this.getChildren().forEach((child) =>\n descendants.push(...child.getDescendantsAndSelf())\n );\n\n return descendants;\n }\n\n /**\n * Gets a flat list of all FlatGridItems beneath this flat grid item including itself in depth first visiting order.\n */\n public getDescendantsAndSelf(): IMutableFlatGridItem[] {\n return [this.getSelf(), ...this.getDescendants()];\n }\n\n /**\n * Gets a flat list of visible FlatGridItems beneath this flat grid item.\n */\n public getVisibleDescendants(): IMutableFlatGridItem[] {\n const descendants: IMutableFlatGridItem[] = [];\n if (this.isExpanded)\n this.getChildren().forEach((child) =>\n descendants.push(...child.getVisibleDescendantsAndSelf())\n );\n return descendants;\n }\n\n /**\n * Gets a flat list of visible FlatGridItems beneath this flat grid item and itself in depth first visiting order.\n */\n public getVisibleDescendantsAndSelf(): IMutableFlatGridItem[] {\n return [this.getSelf(), ...this.getVisibleDescendants()];\n }\n\n /**\n * @returns self if item is not expanded, last visible descendant of this item otherwise.\n */\n public getLastVisibleDescendantOrSelf(): IMutableFlatGridItem {\n if (!this.isExpanded) return this.getSelf();\n\n const children = this.getChildren();\n if (children.length < 1) return this.getSelf();\n\n return children[children.length - 1].getLastVisibleDescendantOrSelf();\n }\n\n /**\n * Sets lastInNumberOfCategories value and sends it down to this items last child\n * @internal\n */\n public get lastInNumberOfCategories(): number {\n if (this.isExpanded && this.getChildren().length > 0) return 0;\n\n return this._lastInNumberOfCategories;\n }\n\n public set lastInNumberOfCategories(value: number) {\n this._lastInNumberOfCategories = value;\n const children = this.getChildren();\n if (children.length < 1) return;\n\n children[children.length - 1].lastInNumberOfCategories = value;\n }\n\n /**\n * Gets and sets isLastInRootCategory value and sends it down to this items last child\n * @internal\n */\n public get isLastInRootCategory(): boolean {\n if (this.isExpanded && this.getChildren().length > 0) return false;\n\n return this._isLastInRootCategory;\n }\n\n public set isLastInRootCategory(value: boolean) {\n this._isLastInRootCategory = value;\n const children = this.getChildren();\n if (children.length < 1) return;\n\n children[children.length - 1].isLastInRootCategory = value;\n }\n}\n\n/**\n * Data structure which describes methods and properties to be held by Mutable GridCategoryItems\n * @public\n */\nexport interface IMutableGridCategoryItem extends IMutableFlatPropertyGridItem {\n type: FlatGridItemType.Category;\n name: string;\n derivedCategory: PropertyCategory;\n isRootCategory: boolean;\n}\n\n/**\n * Data structure which describes methods and properties to be held by Mutable CategorizedPropertyItems\n * @public\n */\nexport interface IMutableCategorizedPropertyItem\n extends IMutableFlatPropertyGridItem {\n readonly type: CategorizedPropertyTypes;\n readonly derivedRecord: PropertyRecord;\n readonly parentCategorySelectionKey: string;\n readonly parentSelectionKey: string;\n\n getChildren(): IMutableCategorizedPropertyItem[];\n}\n\n/**\n * Type which describes mutable GridCategoryItem or CategorizedProperty\n * @public\n */\nexport type IMutableFlatGridItem =\n | IMutableCategorizedPropertyItem\n | IMutableGridCategoryItem;\n\n/**\n * Base class for all Mutable CategorizedProperties\n * @public\n */\nexport abstract class MutableCategorizedProperty\n extends MutableFlatPropertyGridItem\n implements Partial<IMutableCategorizedPropertyItem>\n{\n private _derivedRecord: PropertyRecord;\n private _selectionKey: string;\n\n public constructor(\n type: CategorizedPropertyTypes,\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) {\n super(depth, parentSelectionKey, parentCategorySelectionKey);\n\n const recordType = this.valueTypeToFlatGridType(record.value.valueFormat);\n if (recordType !== type) {\n const expectedTypeStr = FlatGridItemType[type];\n const actualTypeStr = FlatGridItemType[recordType];\n throw Error(\n `Record with incorrect value format passed to property: expected ${expectedTypeStr}, got ${actualTypeStr}`\n );\n }\n\n const overriddenProperty = this.makeOverriddenProperty(\n record.property,\n overrideName,\n overrideDisplayLabel\n );\n this._derivedRecord = this.makeDerivedRecord(record, overriddenProperty);\n\n this._selectionKey = `${this.parentSelectionKey}_${this.derivedRecord.property.name}`;\n this._isExpanded = !!record.autoExpand;\n }\n\n public abstract override type: CategorizedPropertyTypes;\n public abstract override getChildren(): IMutableCategorizedPropertyItem[];\n\n /**\n * Maps PropertyRecord valueFormat to FlatGridItemType\n * @param valueType valueFormat to map\n * @returns mapped FlatGridItemType\n */\n private valueTypeToFlatGridType(valueType: PropertyValueFormat) {\n switch (valueType) {\n case PropertyValueFormat.Primitive:\n return FlatGridItemType.Primitive;\n case PropertyValueFormat.Array:\n return FlatGridItemType.Array;\n case PropertyValueFormat.Struct:\n return FlatGridItemType.Struct;\n\n default:\n const unhandledType: never = valueType;\n throw Error(\n `Property Value Format not handled: ${String(unhandledType)}`\n );\n }\n }\n\n /**\n * Make new property description with overridden fields.\n * @param propertyDescription property description to override.\n * @param overrideName property description name to override.\n * @param overrideDisplay property description display name to override.\n */\n private makeOverriddenProperty(\n propertyDescription: PropertyDescription,\n overrideName?: string,\n overrideDisplay?: string\n ): PropertyDescription {\n const { name, displayLabel, ...property } = { ...propertyDescription };\n const newName = overrideName ?? name;\n const newDisplayLabel = overrideDisplay ?? displayLabel;\n\n return { ...property, name: newName, displayLabel: newDisplayLabel };\n }\n\n /**\n * Gets derived property record that has it's property description field overridden\n */\n private makeDerivedRecord(\n record: PropertyRecord,\n overriddenPropertyDescription: PropertyDescription\n ) {\n const { value, property, ...others } = record;\n const newRecord = new PropertyRecord(value, overriddenPropertyDescription);\n\n return Object.assign(newRecord, others);\n }\n\n public getSelf(): IMutableCategorizedPropertyItem {\n return this;\n }\n\n public override get parentCategorySelectionKey() {\n return super.parentCategorySelectionKey!;\n }\n\n public override get parentSelectionKey() {\n return super.parentSelectionKey!;\n }\n\n /**\n * Unique selection key made of parent selectionKey and this property name.\n */\n public get selectionKey() {\n return this._selectionKey;\n }\n\n public get label() {\n return this._derivedRecord.property.displayLabel;\n }\n\n /**\n * Record with overridden property description.\n */\n public get derivedRecord() {\n return this._derivedRecord;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MutableFlatGridItem.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5E,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG3C;;;;;GAKG;AACH,MAAM,CAAN,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,+DAAQ,CAAA;IACR,iEAAS,CAAA;IACT,yDAAK,CAAA;IACL,2DAAM,CAAA;AACR,CAAC,EALW,gBAAgB,KAAhB,gBAAgB,QAK3B;AAgCD;;;GAGG;AACH,MAAM,OAAgB,2BAA2B;IAWrC;IACA;IACA;IAVH,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;IAEV,GAAG,GAAW,IAAI,CAAC,WAAW,EAAE,CAAC;IACvC,WAAW,GAAY,KAAK,CAAC;IAC7B,yBAAyB,GAAW,CAAC,CAAC;IACtC,qBAAqB,GAAY,KAAK,CAAC;IAEjD,YACU,MAAc,EACd,mBAAuC,EACvC,2BAA+C;QAF/C,WAAM,GAAN,MAAM,CAAQ;QACd,wBAAmB,GAAnB,mBAAmB,CAAoB;QACvC,gCAA2B,GAA3B,2BAA2B,CAAoB;QAEvD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACnE,CAAC;IAMD,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAW,kBAAkB;QAC3B,OAAO,IAAI,CAAC,mBAAmB,CAAC;IAClC,CAAC;IAED,IAAW,0BAA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AE,CAC9D,CAAC;QACN,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACK,sBAAsB,CAC5B,mBAAwC,EACxC,YAAqB,EACrB,eAAwB;QAExB,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,QAAQ,EAAE,GAAG,EAAE,GAAG,mBAAmB,EAAE,CAAC;QACvE,MAAM,OAAO,GAAG,YAAY,IAAI,IAAI,CAAC;QACrC,MAAM,eAAe,GAAG,eAAe,IAAI,YAAY,CAAC;QAExD,OAAO,EAAE,GAAG,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC;IACvE,CAAC;IAED;;OAEG;IACK,iBAAiB,CACvB,MAAsB,EACtB,6BAAkD;QAElD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC;QAC9C,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC,KAAK,EAAE,6BAA6B,CAAC,CAAC;QAE3E,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC1C,CAAC;IAEM,OAAO;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAoB,0BAA0B;QAC5C,OAAO,KAAK,CAAC,0BAA2B,CAAC;IAC3C,CAAC;IAED,IAAoB,kBAAkB;QACpC,OAAO,KAAK,CAAC,kBAAmB,CAAC;IACnC,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport { immerable } from \"immer\";\nimport type { PropertyDescription } from \"@itwin/appui-abstract\";\nimport { PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { Guid } from \"@itwin/core-bentley\";\nimport type { PropertyCategory } from \"../../PropertyDataProvider.js\";\n\n/**\n * Types of FlatGridItems for differentiating what property FlatGridItem is wrapping.\n * Category for PropertyCategory\n * (Primitive, Array, Struct) for PropertyRecord with valueFormats: (Primitive, Array, Struct)\n * @public\n */\nexport enum FlatGridItemType {\n Category,\n Primitive,\n Array,\n Struct,\n}\n\n/**\n * Type which extracts FlatGridItemTypes relevant for working with CategorizedProperties\n * @public\n */\nexport type CategorizedPropertyTypes =\n | FlatGridItemType.Array\n | FlatGridItemType.Primitive\n | FlatGridItemType.Struct;\n\n/**\n * Base mutable data structure defining common methods and properties for both CategorizedProperties and GridCategoryItems\n * @public\n */\nexport interface IMutableFlatPropertyGridItem {\n readonly type: FlatGridItemType;\n readonly key: string;\n readonly selectionKey: string;\n readonly parentSelectionKey: string | undefined;\n readonly parentCategorySelectionKey: string | undefined;\n readonly depth: number;\n readonly label: string;\n lastInNumberOfCategories: number;\n isLastInRootCategory: boolean;\n isExpanded: boolean;\n getDescendantsAndSelf(): IMutableFlatGridItem[];\n getVisibleDescendantsAndSelf(): IMutableFlatGridItem[];\n getChildren(): IMutableFlatGridItem[];\n getLastVisibleDescendantOrSelf(): IMutableFlatGridItem;\n}\n\n/**\n * Base class for all FlatPropertyGrid items\n * @public\n */\nexport abstract class MutableFlatPropertyGridItem\n implements IMutableFlatPropertyGridItem\n{\n public [immerable] = true;\n\n public readonly key: string = Guid.createValue();\n protected _isExpanded: boolean = false;\n protected _lastInNumberOfCategories: number = 0;\n protected _isLastInRootCategory: boolean = false;\n\n public constructor(\n private _depth: number,\n private _parentSelectionKey: string | undefined,\n private _parentCategorySelectionKey: string | undefined\n ) {\n if (this._depth < 0) throw new Error(\"Depth cannot be negative\");\n }\n\n public abstract type: FlatGridItemType;\n public abstract label: string;\n public abstract selectionKey: string;\n\n public get depth() {\n return this._depth;\n }\n\n public get parentSelectionKey() {\n return this._parentSelectionKey;\n }\n\n public get parentCategorySelectionKey() {\n return this._parentCategorySelectionKey;\n }\n\n public get isExpanded() {\n return this._isExpanded;\n }\n\n public set isExpanded(value: boolean) {\n this._isExpanded = value;\n }\n\n public abstract getChildren(): IMutableFlatGridItem[];\n public abstract getSelf(): IMutableFlatGridItem;\n\n protected getDescendants() {\n const descendants: IMutableFlatGridItem[] = [];\n this.getChildren().forEach((child) =>\n descendants.push(...child.getDescendantsAndSelf())\n );\n\n return descendants;\n }\n\n /**\n * Gets a flat list of all FlatGridItems beneath this flat grid item including itself in depth first visiting order.\n */\n public getDescendantsAndSelf(): IMutableFlatGridItem[] {\n return [this.getSelf(), ...this.getDescendants()];\n }\n\n /**\n * Gets a flat list of visible FlatGridItems beneath this flat grid item.\n */\n public getVisibleDescendants(): IMutableFlatGridItem[] {\n const descendants: IMutableFlatGridItem[] = [];\n if (this.isExpanded)\n this.getChildren().forEach((child) =>\n descendants.push(...child.getVisibleDescendantsAndSelf())\n );\n return descendants;\n }\n\n /**\n * Gets a flat list of visible FlatGridItems beneath this flat grid item and itself in depth first visiting order.\n */\n public getVisibleDescendantsAndSelf(): IMutableFlatGridItem[] {\n return [this.getSelf(), ...this.getVisibleDescendants()];\n }\n\n /**\n * @returns self if item is not expanded, last visible descendant of this item otherwise.\n */\n public getLastVisibleDescendantOrSelf(): IMutableFlatGridItem {\n if (!this.isExpanded) return this.getSelf();\n\n const children = this.getChildren();\n if (children.length < 1) return this.getSelf();\n\n return children[children.length - 1].getLastVisibleDescendantOrSelf();\n }\n\n /**\n * Sets lastInNumberOfCategories value and sends it down to this items last child\n * @internal\n */\n public get lastInNumberOfCategories(): number {\n if (this.isExpanded && this.getChildren().length > 0) return 0;\n\n return this._lastInNumberOfCategories;\n }\n\n public set lastInNumberOfCategories(value: number) {\n this._lastInNumberOfCategories = value;\n const children = this.getChildren();\n if (children.length < 1) return;\n\n children[children.length - 1].lastInNumberOfCategories = value;\n }\n\n /**\n * Gets and sets isLastInRootCategory value and sends it down to this items last child\n * @internal\n */\n public get isLastInRootCategory(): boolean {\n if (this.isExpanded && this.getChildren().length > 0) return false;\n\n return this._isLastInRootCategory;\n }\n\n public set isLastInRootCategory(value: boolean) {\n this._isLastInRootCategory = value;\n const children = this.getChildren();\n if (children.length < 1) return;\n\n children[children.length - 1].isLastInRootCategory = value;\n }\n}\n\n/**\n * Data structure which describes methods and properties to be held by Mutable GridCategoryItems\n * @public\n */\nexport interface IMutableGridCategoryItem extends IMutableFlatPropertyGridItem {\n type: FlatGridItemType.Category;\n name: string;\n derivedCategory: PropertyCategory;\n isRootCategory: boolean;\n}\n\n/**\n * Data structure which describes methods and properties to be held by Mutable CategorizedPropertyItems\n * @public\n */\nexport interface IMutableCategorizedPropertyItem\n extends IMutableFlatPropertyGridItem {\n readonly type: CategorizedPropertyTypes;\n readonly derivedRecord: PropertyRecord;\n readonly parentCategorySelectionKey: string;\n readonly parentSelectionKey: string;\n\n getChildren(): IMutableCategorizedPropertyItem[];\n}\n\n/**\n * Type which describes mutable GridCategoryItem or CategorizedProperty\n * @public\n */\nexport type IMutableFlatGridItem =\n | IMutableCategorizedPropertyItem\n | IMutableGridCategoryItem;\n\n/**\n * Base class for all Mutable CategorizedProperties\n * @public\n */\nexport abstract class MutableCategorizedProperty\n extends MutableFlatPropertyGridItem\n implements Partial<IMutableCategorizedPropertyItem>\n{\n private _derivedRecord: PropertyRecord;\n private _selectionKey: string;\n\n public constructor(\n type: CategorizedPropertyTypes,\n record: PropertyRecord,\n parentSelectionKey: string,\n parentCategorySelectionKey: string,\n depth: number,\n overrideName?: string,\n overrideDisplayLabel?: string\n ) {\n super(depth, parentSelectionKey, parentCategorySelectionKey);\n\n const recordType = this.valueTypeToFlatGridType(record.value.valueFormat);\n if (recordType !== type) {\n const expectedTypeStr = FlatGridItemType[type];\n const actualTypeStr = FlatGridItemType[recordType];\n throw Error(\n `Record with incorrect value format passed to property: expected ${expectedTypeStr}, got ${actualTypeStr}`\n );\n }\n\n const overriddenProperty = this.makeOverriddenProperty(\n record.property,\n overrideName,\n overrideDisplayLabel\n );\n this._derivedRecord = this.makeDerivedRecord(record, overriddenProperty);\n\n this._selectionKey = `${this.parentSelectionKey}_${this.derivedRecord.property.name}`;\n this._isExpanded = !!record.autoExpand;\n }\n\n public abstract override type: CategorizedPropertyTypes;\n public abstract override getChildren(): IMutableCategorizedPropertyItem[];\n\n /**\n * Maps PropertyRecord valueFormat to FlatGridItemType\n * @param valueType valueFormat to map\n * @returns mapped FlatGridItemType\n */\n private valueTypeToFlatGridType(valueType: PropertyValueFormat) {\n switch (valueType) {\n case PropertyValueFormat.Primitive:\n return FlatGridItemType.Primitive;\n case PropertyValueFormat.Array:\n return FlatGridItemType.Array;\n case PropertyValueFormat.Struct:\n return FlatGridItemType.Struct;\n\n default:\n const unhandledType: never = valueType;\n throw Error(\n `Property Value Format not handled: ${String(unhandledType)}`\n );\n }\n }\n\n /**\n * Make new property description with overridden fields.\n * @param propertyDescription property description to override.\n * @param overrideName property description name to override.\n * @param overrideDisplay property description display name to override.\n */\n private makeOverriddenProperty(\n propertyDescription: PropertyDescription,\n overrideName?: string,\n overrideDisplay?: string\n ): PropertyDescription {\n const { name, displayLabel, ...property } = { ...propertyDescription };\n const newName = overrideName ?? name;\n const newDisplayLabel = overrideDisplay ?? displayLabel;\n\n return { ...property, name: newName, displayLabel: newDisplayLabel };\n }\n\n /**\n * Gets derived property record that has it's property description field overridden\n */\n private makeDerivedRecord(\n record: PropertyRecord,\n overriddenPropertyDescription: PropertyDescription\n ) {\n const { value, property, ...others } = record;\n const newRecord = new PropertyRecord(value, overriddenPropertyDescription);\n\n return Object.assign(newRecord, others);\n }\n\n public getSelf(): IMutableCategorizedPropertyItem {\n return this;\n }\n\n public override get parentCategorySelectionKey() {\n return super.parentCategorySelectionKey!;\n }\n\n public override get parentSelectionKey() {\n return super.parentSelectionKey!;\n }\n\n /**\n * Unique selection key made of parent selectionKey and this property name.\n */\n public get selectionKey() {\n return this._selectionKey;\n }\n\n public get label() {\n return this._derivedRecord.property.displayLabel;\n }\n\n /**\n * Record with overridden property description.\n */\n public get derivedRecord() {\n return this._derivedRecord;\n }\n}\n"]}
|
|
@@ -8,6 +8,9 @@ import { FlatGridItemType, MutableFlatPropertyGridItem, } from "./MutableFlatGri
|
|
|
8
8
|
* @public
|
|
9
9
|
*/
|
|
10
10
|
export class MutableGridCategory extends MutableFlatPropertyGridItem {
|
|
11
|
+
_children;
|
|
12
|
+
_selectionKey;
|
|
13
|
+
_category;
|
|
11
14
|
constructor(category, recordsDict, gridItemFactory, parentSelectionKey, depth = 0) {
|
|
12
15
|
super(depth, parentSelectionKey, parentSelectionKey);
|
|
13
16
|
this._category = {
|