@itwin/components-react 4.0.0-dev.2 → 4.0.0-dev.3
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/LICENSE.md +1 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.d.ts +4 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.d.ts.map +1 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js +4 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts +22 -25
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js +19 -81
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.d.ts +80 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.d.ts.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.js +83 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.js.map +1 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts +14 -3
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js +22 -12
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.scss +4 -0
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +25 -16
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js +22 -14
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +14 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +11 -5
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.d.ts +16 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js +11 -5
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.d.ts +14 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +11 -5
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts +50 -7
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +60 -8
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/Operators.d.ts +23 -5
- package/lib/cjs/components-react/filter-builder/Operators.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/Operators.js +25 -7
- package/lib/cjs/components-react/filter-builder/Operators.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/Types.d.ts +24 -4
- package/lib/cjs/components-react/filter-builder/Types.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/Types.js +11 -1
- package/lib/cjs/components-react/filter-builder/Types.js.map +1 -1
- package/lib/cjs/components-react/properties/LinkHandler.d.ts +2 -2
- package/lib/cjs/components-react/properties/LinkHandler.js +1 -1
- package/lib/cjs/components-react/properties/LinkHandler.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.d.ts +3 -3
- package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -1
- package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/PropertyDataProvider.d.ts +2 -2
- package/lib/cjs/components-react/propertygrid/PropertyDataProvider.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGrid.d.ts +2 -0
- package/lib/cjs/components-react/propertygrid/component/PropertyGrid.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGrid.js +1 -0
- package/lib/cjs/components-react/propertygrid/component/PropertyGrid.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.d.ts +5 -10
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +3 -3
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +11 -0
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +2 -2
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridEventHandler.d.ts +2 -2
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridEventHandler.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridEventHandler.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.d.ts +3 -3
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.js +3 -3
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridHooks.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModel.d.ts +3 -3
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModel.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModel.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelChangeEvent.d.ts +2 -2
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelChangeEvent.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelChangeEvent.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelSource.d.ts +2 -2
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelSource.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelSource.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelSource.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/FlatGridItem.d.ts +4 -4
- package/lib/cjs/components-react/propertygrid/internal/flat-items/FlatGridItem.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedPrimitiveProperty.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedPrimitiveProperty.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedPrimitiveProperty.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.d.ts +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.d.ts +8 -8
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +3 -3
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.d.ts +2 -2
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.d.ts +2 -2
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts +3 -6
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts +1 -4
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.d.ts +2 -5
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
- package/lib/cjs/components-react.d.ts +4 -6
- package/lib/cjs/components-react.d.ts.map +1 -1
- package/lib/cjs/components-react.js +4 -6
- package/lib/cjs/components-react.js.map +1 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.d.ts +4 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.d.ts.map +1 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.js +4 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts +22 -25
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilder.js +12 -73
- package/lib/esm/components-react/filter-builder/FilterBuilder.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.d.ts +80 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.d.ts.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.js +60 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.js.map +1 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts +14 -3
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js +17 -7
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.scss +4 -0
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts +25 -16
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js +15 -7
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +14 -2
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +7 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.d.ts +16 -2
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +7 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.d.ts +14 -2
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +7 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts +50 -7
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js +54 -3
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/esm/components-react/filter-builder/Operators.d.ts +23 -5
- package/lib/esm/components-react/filter-builder/Operators.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/Operators.js +23 -5
- package/lib/esm/components-react/filter-builder/Operators.js.map +1 -1
- package/lib/esm/components-react/filter-builder/Types.d.ts +24 -4
- package/lib/esm/components-react/filter-builder/Types.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/Types.js +11 -1
- package/lib/esm/components-react/filter-builder/Types.js.map +1 -1
- package/lib/esm/components-react/properties/LinkHandler.d.ts +2 -2
- package/lib/esm/components-react/properties/LinkHandler.js +1 -1
- package/lib/esm/components-react/properties/LinkHandler.js.map +1 -1
- package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.d.ts +3 -3
- package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -1
- package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
- package/lib/esm/components-react/propertygrid/PropertyDataProvider.d.ts +2 -2
- package/lib/esm/components-react/propertygrid/PropertyDataProvider.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGrid.d.ts +2 -0
- package/lib/esm/components-react/propertygrid/component/PropertyGrid.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGrid.js +1 -0
- package/lib/esm/components-react/propertygrid/component/PropertyGrid.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.d.ts +5 -10
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +3 -3
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +11 -0
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.d.ts +2 -2
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridEventHandler.d.ts +2 -2
- package/lib/esm/components-react/propertygrid/internal/PropertyGridEventHandler.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridEventHandler.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.d.ts +3 -3
- package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.js +3 -3
- package/lib/esm/components-react/propertygrid/internal/PropertyGridHooks.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModel.d.ts +3 -3
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModel.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModel.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelChangeEvent.d.ts +2 -2
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelChangeEvent.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelChangeEvent.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelSource.d.ts +2 -2
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelSource.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelSource.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelSource.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/FlatGridItem.d.ts +4 -4
- package/lib/esm/components-react/propertygrid/internal/flat-items/FlatGridItem.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedPrimitiveProperty.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedPrimitiveProperty.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedPrimitiveProperty.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.d.ts +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.d.ts +8 -8
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +3 -3
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.d.ts +2 -2
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.d.ts +2 -2
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts +3 -6
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts +1 -4
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.d.ts +2 -5
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
- package/lib/esm/components-react.d.ts +4 -6
- package/lib/esm/components-react.d.ts.map +1 -1
- package/lib/esm/components-react.js +4 -6
- package/lib/esm/components-react.js.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBuilderState.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderState.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAS,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAA8B,MAAM,aAAa,CAAC;AACzH,OAAO,EAAE,yBAAyB,EAAsC,MAAM,SAAS,CAAC;AA2BxF,aAAa;AACb,MAAM,OAAO,4BAA4B;IACvC,YAAoB,QAAiG;QAAjG,aAAQ,GAAR,QAAQ,CAAyF;IAAI,CAAC;IAElH,WAAW,CAAC,OAA2D;QAC7E,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACl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W,CAAC,MAA0B,EAAE,QAAgB;IAC/D,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE;QACtB,OAAO,EAAE,QAAQ;QACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,MAAsB;IAClD,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAC9B,IAAI,yBAAyB,CAAC,MAAM,CAAC,EAAE;QACrC,OAAO;YACL,SAAS,EAAE;gBACT,EAAE;gBACF,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;aAC9D;SACF,CAAC;KACH;IACD,OAAO;QACL,SAAS,EAAE;YACT,EAAE;YACF,QAAQ,EAAE,+BAA+B,CAAC,GAAG;YAC7C,KAAK,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;SACjC;KACF,CAAC;AACJ,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*--------------------------------------------------------------------------------------------*/\nimport { Draft, produce } from \"immer\";\nimport * as React from \"react\";\nimport { PropertyDescription, PropertyValue } from \"@itwin/appui-abstract\";\nimport { Guid } from \"@itwin/core-bentley\";\nimport { isUnaryPropertyFilterOperator, PropertyFilterRuleGroupOperator, PropertyFilterRuleOperator } from \"./Operators\";\nimport { isPropertyFilterRuleGroup, PropertyFilter, PropertyFilterRule } from \"./Types\";\n\n/** @alpha */\nexport interface PropertyFilterBuilderState {\n rootGroup: PropertyFilterBuilderRuleGroup;\n}\n\n/** @alpha */\nexport type PropertyFilterBuilderRuleGroupItem = PropertyFilterBuilderRuleGroup | PropertyFilterBuilderRule;\n\n/** @alpha */\nexport interface PropertyFilterBuilderRuleGroup {\n id: string;\n groupId?: string;\n operator: PropertyFilterRuleGroupOperator;\n items: PropertyFilterBuilderRuleGroupItem[];\n}\n\n/** @alpha */\nexport interface PropertyFilterBuilderRule {\n id: string;\n groupId: string;\n property?: PropertyDescription;\n operator?: PropertyFilterRuleOperator;\n value?: PropertyValue;\n}\n\n/** @alpha */\nexport class PropertyFilterBuilderActions {\n constructor(private setState: (setter: (prevState: PropertyFilterBuilderState) => PropertyFilterBuilderState) => void) { }\n\n private updateState(updater: (state: Draft<PropertyFilterBuilderState>) => void) {\n this.setState(produce(updater));\n }\n\n public addItem(path: string[], itemType: \"RULE_GROUP\" | \"RULE\") {\n this.updateState((state) => {\n const parentGroup = findRuleGroup(state.rootGroup, path);\n if (!parentGroup)\n return;\n const item = itemType === \"RULE_GROUP\" ? createEmptyRuleGroup(parentGroup.id) : createEmptyRule(parentGroup.id);\n parentGroup.items.push(item);\n });\n }\n\n public removeItem(path: string[]) {\n function removeItemFromGroup(state: Draft<PropertyFilterBuilderState>, pathToItem: string[]) {\n const pathToParent = pathToItem.slice(0, -1);\n const parentGroup = findRuleGroup(state.rootGroup, pathToParent);\n if (!parentGroup)\n return;\n const itemId = pathToItem[pathToItem.length - 1];\n const itemIndex = parentGroup.items.findIndex((item) => item.id === itemId);\n if (itemIndex === -1)\n return;\n parentGroup.items.splice(itemIndex, 1);\n if (parentGroup.items.length === 0)\n removeItemFromGroup(state, pathToParent);\n }\n\n this.updateState((state) => {\n removeItemFromGroup(state, path);\n });\n }\n\n public setRuleGroupOperator(path: string[], operator: PropertyFilterRuleGroupOperator) {\n this.updateState((state) => {\n const group = findRuleGroup(state.rootGroup, path);\n if (!group)\n return;\n group.operator = operator;\n });\n }\n\n public setRuleProperty(path: string[], property?: PropertyDescription) {\n this.updateState((state) => {\n const rule = findRule(state.rootGroup, path);\n if (!rule)\n return;\n rule.property = property;\n rule.value = undefined;\n });\n }\n\n public setRuleOperator(path: string[], operator: PropertyFilterRuleOperator) {\n this.updateState((state) => {\n const rule = findRule(state.rootGroup, path);\n if (!rule)\n return;\n if (isUnaryPropertyFilterOperator(operator))\n rule.value = undefined;\n rule.operator = operator;\n });\n }\n\n public setRuleValue(path: string[], value: PropertyValue) {\n this.updateState((state) => {\n const rule = findRule(state.rootGroup, path);\n if (!rule)\n return;\n rule.value = value;\n });\n }\n}\n\n/** @alpha */\nexport function isPropertyFilterBuilderRuleGroup(item: PropertyFilterBuilderRuleGroupItem): item is PropertyFilterBuilderRuleGroup {\n return (item as any).items !== undefined;\n}\n\n/** @alpha */\nexport function usePropertyFilterBuilderState(initialFilter?: PropertyFilter) {\n const [state, setState] = React.useState<PropertyFilterBuilderState>(\n () => initialFilter ? convertFilterToState(initialFilter) : { rootGroup: createEmptyRuleGroup() }\n );\n const [actions] = React.useState(() => new PropertyFilterBuilderActions(setState));\n\n return { state, actions };\n}\n\nfunction createEmptyRule(groupId: string): PropertyFilterBuilderRule {\n return {\n id: Guid.createValue(),\n groupId,\n };\n}\n\nfunction createEmptyRuleGroup(groupId?: string): PropertyFilterBuilderRuleGroup {\n const id = Guid.createValue();\n return {\n id,\n groupId,\n operator: PropertyFilterRuleGroupOperator.And,\n items: [createEmptyRule(id)],\n };\n}\n\nfunction findRuleGroup(rootGroup: PropertyFilterBuilderRuleGroup, path: string[]): PropertyFilterBuilderRuleGroup | undefined {\n if (path.length === 0)\n return rootGroup;\n\n const [currentItemId, ...rest] = path;\n const currentItem = rootGroup.items.find((item) => item.id === currentItemId);\n if (!currentItem || !isPropertyFilterBuilderRuleGroup(currentItem))\n return undefined;\n\n return findRuleGroup(currentItem, rest);\n}\n\nfunction findRule(rootGroup: PropertyFilterBuilderRuleGroup, path: string[]): PropertyFilterBuilderRule | undefined {\n if (path.length === 0)\n return undefined;\n\n const [currentItemId, ...rest] = path;\n const currentItem = rootGroup.items.find((item) => item.id === currentItemId);\n if (!currentItem)\n return undefined;\n\n if (isPropertyFilterBuilderRuleGroup(currentItem))\n return findRule(currentItem, rest);\n\n return currentItem;\n}\n\nfunction getRuleGroupItem(filter: PropertyFilter, parentId: string): PropertyFilterBuilderRuleGroupItem {\n const id = Guid.createValue();\n if (isPropertyFilterRuleGroup(filter))\n return {\n id,\n groupId: parentId,\n operator: filter.operator,\n items: filter.rules.map((rule) => getRuleGroupItem(rule, id)),\n };\n return getRuleItem(filter, id);\n}\n\nfunction getRuleItem(filter: PropertyFilterRule, parentId: string) {\n return {\n id: Guid.createValue(),\n groupId: parentId,\n property: filter.property,\n operator: filter.operator,\n value: filter.value,\n };\n}\n\nfunction convertFilterToState(filter: PropertyFilter): PropertyFilterBuilderState {\n const id = Guid.createValue();\n if (isPropertyFilterRuleGroup(filter)) {\n return {\n rootGroup: {\n id,\n operator: filter.operator,\n items: filter.rules.map((rule) => getRuleGroupItem(rule, id)),\n },\n };\n }\n return {\n rootGroup: {\n id,\n operator: PropertyFilterRuleGroupOperator.And,\n items: [getRuleItem(filter, id)],\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FilterBuilderState.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/FilterBuilderState.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAS,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAsC,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,6BAA6B,EAAE,+BAA+B,EAA8B,MAAM,aAAa,CAAC;AACzH,OAAO,EAAE,yBAAyB,EAAsC,MAAM,SAAS,CAAC;AAiDxF;;;GAGG;AACH,MAAM,OAAO,4BAA4B;IACvC,YAAoB,QAAiG;QAAjG,aAAQ,GAAR,QAAQ,C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AC,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;SAC9D,CAAC;IACJ,OAAO,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,WAAW,CAAC,MAA0B,EAAE,QAAgB;IAC/D,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE;QACtB,OAAO,EAAE,QAAQ;QACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,MAAsB;IAClD,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAC9B,IAAI,yBAAyB,CAAC,MAAM,CAAC,EAAE;QACrC,OAAO;YACL,SAAS,EAAE;gBACT,EAAE;gBACF,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;aAC9D;SACF,CAAC;KACH;IACD,OAAO;QACL,SAAS,EAAE;YACT,EAAE;YACF,QAAQ,EAAE,+BAA+B,CAAC,GAAG;YAC7C,KAAK,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;SACjC;KACF,CAAC;AACJ,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 PropertyFilterBuilder\n */\n\nimport { Draft, produce } from \"immer\";\nimport * as React from \"react\";\nimport { PropertyDescription, PropertyValue, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { Guid } from \"@itwin/core-bentley\";\nimport { isUnaryPropertyFilterOperator, PropertyFilterRuleGroupOperator, PropertyFilterRuleOperator } from \"./Operators\";\nimport { isPropertyFilterRuleGroup, PropertyFilter, PropertyFilterRule } from \"./Types\";\n\n/**\n * Data structure that describes [[PropertyFilterBuilder]] component state.\n * @internal\n */\nexport interface PropertyFilterBuilderState {\n /** Root group of rules in [[PropertyFilterBuilder]] component. */\n rootGroup: PropertyFilterBuilderRuleGroup;\n}\n\n/**\n * Type that describes [[PropertyFilterBuilder]] component group item.\n * @internal\n */\nexport type PropertyFilterBuilderRuleGroupItem = PropertyFilterBuilderRuleGroup | PropertyFilterBuilderRule;\n\n/**\n * Data structure that describes [[PropertyFilterBuilder]] component rule group.\n * @internal\n */\nexport interface PropertyFilterBuilderRuleGroup {\n /** Id of this rule group. */\n id: string;\n /** Id of rule group that this group is nested in. */\n groupId?: string;\n /** Operator that should join items in this group. */\n operator: PropertyFilterRuleGroupOperator;\n /** Items in this group. */\n items: PropertyFilterBuilderRuleGroupItem[];\n}\n\n/**\n * Data structure that describes [[PropertyFilterBuilder]] component single rule.\n * @internal\n */\nexport interface PropertyFilterBuilderRule {\n /** Id of this rule. */\n id: string;\n /** Id of rule group that this rule is nested in. */\n groupId: string;\n /** Property used in this rule. */\n property?: PropertyDescription;\n /** Operator that should be used to compare property value. */\n operator?: PropertyFilterRuleOperator;\n /** Value that property should be compared to. */\n value?: PropertyValue;\n}\n\n/**\n * Actions for controlling [[PropertyFilterBuilder]] component state.\n * @internal\n */\nexport class PropertyFilterBuilderActions {\n constructor(private setState: (setter: (prevState: PropertyFilterBuilderState) => PropertyFilterBuilderState) => void) { }\n\n private updateState(updater: (state: Draft<PropertyFilterBuilderState>) => void) {\n this.setState(produce(updater));\n }\n\n /** Adds new rule or group of rules to the group specified by path. */\n public addItem(path: string[], itemType: \"RULE_GROUP\" | \"RULE\") {\n this.updateState((state) => {\n const parentGroup = findRuleGroup(state.rootGroup, path);\n if (!parentGroup)\n return;\n const item = itemType === \"RULE_GROUP\" ? createEmptyRuleGroup(parentGroup.id) : createEmptyRule(parentGroup.id);\n parentGroup.items.push(item);\n });\n }\n\n /** Removes item specified by path. */\n public removeItem(path: string[]) {\n function removeItemFromGroup(state: Draft<PropertyFilterBuilderState>, pathToItem: string[]) {\n const pathToParent = pathToItem.slice(0, -1);\n const parentGroup = findRuleGroup(state.rootGroup, pathToParent);\n if (!parentGroup)\n return;\n const itemId = pathToItem[pathToItem.length - 1];\n const itemIndex = parentGroup.items.findIndex((item) => item.id === itemId);\n if (itemIndex === -1)\n return;\n parentGroup.items.splice(itemIndex, 1);\n if (parentGroup.items.length === 0)\n removeItemFromGroup(state, pathToParent);\n }\n\n this.updateState((state) => {\n removeItemFromGroup(state, path);\n });\n }\n\n /** Sets operator of rule group specified by the path. */\n public setRuleGroupOperator(path: string[], operator: PropertyFilterRuleGroupOperator) {\n this.updateState((state) => {\n const group = findRuleGroup(state.rootGroup, path);\n if (!group)\n return;\n group.operator = operator;\n });\n }\n\n /** Sets property of rule specified by the path. */\n public setRuleProperty(path: string[], property?: PropertyDescription) {\n this.updateState((state) => {\n const rule = findRule(state.rootGroup, path);\n if (!rule)\n return;\n rule.property = property;\n rule.value = undefined;\n });\n }\n\n /** Sets operator of rule specified by the path. */\n public setRuleOperator(path: string[], operator: PropertyFilterRuleOperator) {\n this.updateState((state) => {\n const rule = findRule(state.rootGroup, path);\n if (!rule)\n return;\n if (isUnaryPropertyFilterOperator(operator))\n rule.value = undefined;\n rule.operator = operator;\n });\n }\n\n /** Sets value of rule specified by the path. */\n public setRuleValue(path: string[], value: PropertyValue) {\n this.updateState((state) => {\n const rule = findRule(state.rootGroup, path);\n if (!rule)\n return;\n rule.value = value;\n });\n }\n}\n\n/**\n * Function to check if supplied [[PropertyFilterBuilderRuleGroupItem]] is [[PropertyFilterBuilderRuleGroup]].\n * @internal\n */\nexport function isPropertyFilterBuilderRuleGroup(item: PropertyFilterBuilderRuleGroupItem): item is PropertyFilterBuilderRuleGroup {\n return (item as any).items !== undefined;\n}\n\n/**\n * Custom hook that creates state for [[PropertyFilterBuilder]] component. It creates empty state or initializes\n * state from supplied initial filter.\n * @internal\n */\nexport function usePropertyFilterBuilderState(initialFilter?: PropertyFilter) {\n const [state, setState] = React.useState<PropertyFilterBuilderState>(\n () => initialFilter ? convertFilterToState(initialFilter) : { rootGroup: createEmptyRuleGroup() }\n );\n const [actions] = React.useState(() => new PropertyFilterBuilderActions(setState));\n\n return { state, actions };\n}\n\n/** @internal */\nexport function buildPropertyFilter(groupItem: PropertyFilterBuilderRuleGroupItem): PropertyFilter | undefined {\n if (isPropertyFilterBuilderRuleGroup(groupItem))\n return buildPropertyFilterFromRuleGroup(groupItem);\n return buildPropertyFilterFromRule(groupItem);\n}\n\nfunction buildPropertyFilterFromRuleGroup(rootGroup: PropertyFilterBuilderRuleGroup): PropertyFilter | undefined {\n if (rootGroup.items.length === 0)\n return undefined;\n\n const rules = new Array<PropertyFilter>();\n for (const item of rootGroup.items) {\n const rule = buildPropertyFilter(item);\n if (!rule)\n return undefined;\n rules.push(rule);\n }\n\n if (rules.length === 1)\n return rules[0];\n\n return {\n operator: rootGroup.operator,\n rules,\n };\n}\n\nfunction buildPropertyFilterFromRule(rule: PropertyFilterBuilderRule): PropertyFilter | undefined {\n const { property, operator, value } = rule;\n if (!property || operator === undefined)\n return undefined;\n\n if (!isUnaryPropertyFilterOperator(operator) && (value === undefined || value.valueFormat !== PropertyValueFormat.Primitive || value.value === undefined))\n return undefined;\n\n return { property, operator, value };\n}\n\nfunction createEmptyRule(groupId: string): PropertyFilterBuilderRule {\n return {\n id: Guid.createValue(),\n groupId,\n };\n}\n\nfunction createEmptyRuleGroup(groupId?: string): PropertyFilterBuilderRuleGroup {\n const id = Guid.createValue();\n return {\n id,\n groupId,\n operator: PropertyFilterRuleGroupOperator.And,\n items: [createEmptyRule(id)],\n };\n}\n\nfunction findRuleGroup(rootGroup: PropertyFilterBuilderRuleGroup, path: string[]): PropertyFilterBuilderRuleGroup | undefined {\n if (path.length === 0)\n return rootGroup;\n\n const [currentItemId, ...rest] = path;\n const currentItem = rootGroup.items.find((item) => item.id === currentItemId);\n if (!currentItem || !isPropertyFilterBuilderRuleGroup(currentItem))\n return undefined;\n\n return findRuleGroup(currentItem, rest);\n}\n\nfunction findRule(rootGroup: PropertyFilterBuilderRuleGroup, path: string[]): PropertyFilterBuilderRule | undefined {\n if (path.length === 0)\n return undefined;\n\n const [currentItemId, ...rest] = path;\n const currentItem = rootGroup.items.find((item) => item.id === currentItemId);\n if (!currentItem)\n return undefined;\n\n if (isPropertyFilterBuilderRuleGroup(currentItem))\n return findRule(currentItem, rest);\n\n return currentItem;\n}\n\nfunction getRuleGroupItem(filter: PropertyFilter, parentId: string): PropertyFilterBuilderRuleGroupItem {\n const id = Guid.createValue();\n if (isPropertyFilterRuleGroup(filter))\n return {\n id,\n groupId: parentId,\n operator: filter.operator,\n items: filter.rules.map((rule) => getRuleGroupItem(rule, id)),\n };\n return getRuleItem(filter, id);\n}\n\nfunction getRuleItem(filter: PropertyFilterRule, parentId: string) {\n return {\n id: Guid.createValue(),\n groupId: parentId,\n property: filter.property,\n operator: filter.operator,\n value: filter.value,\n };\n}\n\nfunction convertFilterToState(filter: PropertyFilter): PropertyFilterBuilderState {\n const id = Guid.createValue();\n if (isPropertyFilterRuleGroup(filter)) {\n return {\n rootGroup: {\n id,\n operator: filter.operator,\n items: filter.rules.map((rule) => getRuleGroupItem(rule, id)),\n },\n };\n }\n return {\n rootGroup: {\n id,\n operator: PropertyFilterRuleGroupOperator.And,\n items: [getRuleItem(filter, id)],\n },\n };\n}\n"]}
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module PropertyFilterBuilder
|
|
3
|
+
*/
|
|
1
4
|
import { PropertyDescription } from "@itwin/appui-abstract";
|
|
2
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Logical operator for joining rules.
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
3
9
|
export declare enum PropertyFilterRuleGroupOperator {
|
|
4
10
|
And = 0,
|
|
5
11
|
Or = 1
|
|
6
12
|
}
|
|
7
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Operators for comparing property value in rule.
|
|
15
|
+
* @beta
|
|
16
|
+
*/
|
|
8
17
|
export declare enum PropertyFilterRuleOperator {
|
|
9
18
|
IsTrue = 0,
|
|
10
19
|
IsFalse = 1,
|
|
@@ -18,10 +27,19 @@ export declare enum PropertyFilterRuleOperator {
|
|
|
18
27
|
IsNull = 9,
|
|
19
28
|
IsNotNull = 10
|
|
20
29
|
}
|
|
21
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Function that returns set of available operator based on property type.
|
|
32
|
+
* @beta
|
|
33
|
+
*/
|
|
22
34
|
export declare function getPropertyFilterOperators(property: PropertyDescription): PropertyFilterRuleOperator[];
|
|
23
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Function that returns display label for rule operator.
|
|
37
|
+
* @beta
|
|
38
|
+
*/
|
|
24
39
|
export declare function getPropertyFilterOperatorLabel(operator: PropertyFilterRuleOperator): string;
|
|
25
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Function that checks if supplied operator is unary.
|
|
42
|
+
* @beta
|
|
43
|
+
*/
|
|
26
44
|
export declare function isUnaryPropertyFilterOperator(operator: PropertyFilterRuleOperator): boolean;
|
|
27
45
|
//# sourceMappingURL=Operators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operators.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/Operators.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAqB,MAAM,uBAAuB,CAAC;AAG/E
|
|
1
|
+
{"version":3,"file":"Operators.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/Operators.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAqB,MAAM,uBAAuB,CAAC;AAG/E;;;GAGG;AACH,oBAAY,+BAA+B;IACzC,GAAG,IAAA;IACH,EAAE,IAAA;CACH;AAED;;;GAGG;AACH,oBAAY,0BAA0B;IACpC,MAAM,IAAA;IACN,OAAO,IAAA;IAEP,OAAO,IAAA;IACP,UAAU,IAAA;IAEV,OAAO,IAAA;IACP,cAAc,IAAA;IACd,IAAI,IAAA;IACJ,WAAW,IAAA;IAEX,IAAI,IAAA;IAEJ,MAAM,IAAA;IACN,SAAS,KAAA;CACV;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,mBAAmB,gCA2CvE;AAGD;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,0BAA0B,UAyBlF;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,0BAA0B,WASjF"}
|
|
@@ -2,15 +2,24 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module PropertyFilterBuilder
|
|
7
|
+
*/
|
|
5
8
|
import { StandardTypeNames } from "@itwin/appui-abstract";
|
|
6
9
|
import { UiComponents } from "../UiComponents";
|
|
7
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Logical operator for joining rules.
|
|
12
|
+
* @beta
|
|
13
|
+
*/
|
|
8
14
|
export var PropertyFilterRuleGroupOperator;
|
|
9
15
|
(function (PropertyFilterRuleGroupOperator) {
|
|
10
16
|
PropertyFilterRuleGroupOperator[PropertyFilterRuleGroupOperator["And"] = 0] = "And";
|
|
11
17
|
PropertyFilterRuleGroupOperator[PropertyFilterRuleGroupOperator["Or"] = 1] = "Or";
|
|
12
18
|
})(PropertyFilterRuleGroupOperator || (PropertyFilterRuleGroupOperator = {}));
|
|
13
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Operators for comparing property value in rule.
|
|
21
|
+
* @beta
|
|
22
|
+
*/
|
|
14
23
|
export var PropertyFilterRuleOperator;
|
|
15
24
|
(function (PropertyFilterRuleOperator) {
|
|
16
25
|
PropertyFilterRuleOperator[PropertyFilterRuleOperator["IsTrue"] = 0] = "IsTrue";
|
|
@@ -25,7 +34,10 @@ export var PropertyFilterRuleOperator;
|
|
|
25
34
|
PropertyFilterRuleOperator[PropertyFilterRuleOperator["IsNull"] = 9] = "IsNull";
|
|
26
35
|
PropertyFilterRuleOperator[PropertyFilterRuleOperator["IsNotNull"] = 10] = "IsNotNull";
|
|
27
36
|
})(PropertyFilterRuleOperator || (PropertyFilterRuleOperator = {}));
|
|
28
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Function that returns set of available operator based on property type.
|
|
39
|
+
* @beta
|
|
40
|
+
*/
|
|
29
41
|
export function getPropertyFilterOperators(property) {
|
|
30
42
|
const typename = property.typename;
|
|
31
43
|
if (typename === StandardTypeNames.Bool || typename === StandardTypeNames.Boolean) {
|
|
@@ -66,7 +78,10 @@ export function getPropertyFilterOperators(property) {
|
|
|
66
78
|
return operators;
|
|
67
79
|
}
|
|
68
80
|
/* istanbul ignore next */
|
|
69
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* Function that returns display label for rule operator.
|
|
83
|
+
* @beta
|
|
84
|
+
*/
|
|
70
85
|
export function getPropertyFilterOperatorLabel(operator) {
|
|
71
86
|
switch (operator) {
|
|
72
87
|
case PropertyFilterRuleOperator.IsTrue:
|
|
@@ -93,7 +108,10 @@ export function getPropertyFilterOperatorLabel(operator) {
|
|
|
93
108
|
return UiComponents.translate("filterBuilder.operators.isNotNull");
|
|
94
109
|
}
|
|
95
110
|
}
|
|
96
|
-
/**
|
|
111
|
+
/**
|
|
112
|
+
* Function that checks if supplied operator is unary.
|
|
113
|
+
* @beta
|
|
114
|
+
*/
|
|
97
115
|
export function isUnaryPropertyFilterOperator(operator) {
|
|
98
116
|
switch (operator) {
|
|
99
117
|
case PropertyFilterRuleOperator.IsTrue:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operators.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/Operators.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAuB,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"Operators.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/Operators.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAuB,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;GAGG;AACH,MAAM,CAAN,IAAY,+BAGX;AAHD,WAAY,+BAA+B;IACzC,mFAAG,CAAA;IACH,iFAAE,CAAA;AACJ,CAAC,EAHW,+BAA+B,KAA/B,+BAA+B,QAG1C;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,0BAgBX;AAhBD,WAAY,0BAA0B;IACpC,+EAAM,CAAA;IACN,iFAAO,CAAA;IAEP,iFAAO,CAAA;IACP,uFAAU,CAAA;IAEV,iFAAO,CAAA;IACP,+FAAc,CAAA;IACd,2EAAI,CAAA;IACJ,yFAAW,CAAA;IAEX,2EAAI,CAAA;IAEJ,+EAAM,CAAA;IACN,sFAAS,CAAA;AACX,CAAC,EAhBW,0BAA0B,KAA1B,0BAA0B,QAgBrC;AAED;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAC,QAA6B;IACtE,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;IAEnC,IAAI,QAAQ,KAAK,iBAAiB,CAAC,IAAI,IAAI,QAAQ,KAAK,iBAAiB,CAAC,OAAO,EAAE;QACjF,OAAO;YACL,0BAA0B,CAAC,MAAM;YACjC,0BAA0B,CA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BAA+B,CAAC,CAAC;QACjE,KAAK,0BAA0B,CAAC,UAAU;YACxC,OAAO,YAAY,CAAC,SAAS,CAAC,kCAAkC,CAAC,CAAC;QACpE,KAAK,0BAA0B,CAAC,OAAO;YACrC,OAAO,GAAG,CAAC;QACb,KAAK,0BAA0B,CAAC,cAAc;YAC5C,OAAO,IAAI,CAAC;QACd,KAAK,0BAA0B,CAAC,IAAI;YAClC,OAAO,GAAG,CAAC;QACb,KAAK,0BAA0B,CAAC,WAAW;YACzC,OAAO,IAAI,CAAC;QACd,KAAK,0BAA0B,CAAC,IAAI;YAClC,OAAO,YAAY,CAAC,SAAS,CAAC,kCAAkC,CAAC,CAAC;QACpE,KAAK,0BAA0B,CAAC,MAAM;YACpC,OAAO,YAAY,CAAC,SAAS,CAAC,gCAAgC,CAAC,CAAC;QAClE,KAAK,0BAA0B,CAAC,SAAS;YACvC,OAAO,YAAY,CAAC,SAAS,CAAC,mCAAmC,CAAC,CAAC;KACtE;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,6BAA6B,CAAC,QAAoC;IAChF,QAAQ,QAAQ,EAAE;QAChB,KAAK,0BAA0B,CAAC,MAAM,CAAC;QACvC,KAAK,0BAA0B,CAAC,OAAO,CAAC;QACxC,KAAK,0BAA0B,CAAC,MAAM,CAAC;QACvC,KAAK,0BAA0B,CAAC,SAAS;YACvC,OAAO,IAAI,CAAC;KACf;IACD,OAAO,KAAK,CAAC;AACf,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 PropertyFilterBuilder\n */\n\nimport { PropertyDescription, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { UiComponents } from \"../UiComponents\";\n\n/**\n * Logical operator for joining rules.\n * @beta\n */\nexport enum PropertyFilterRuleGroupOperator {\n And,\n Or,\n}\n\n/**\n * Operators for comparing property value in rule.\n * @beta\n */\nexport enum PropertyFilterRuleOperator {\n IsTrue,\n IsFalse,\n\n IsEqual,\n IsNotEqual,\n\n Greater,\n GreaterOrEqual,\n Less,\n LessOrEqual,\n\n Like,\n\n IsNull,\n IsNotNull,\n}\n\n/**\n * Function that returns set of available operator based on property type.\n * @beta\n */\nexport function getPropertyFilterOperators(property: PropertyDescription) {\n const typename = property.typename;\n\n if (typename === StandardTypeNames.Bool || typename === StandardTypeNames.Boolean) {\n return [\n PropertyFilterRuleOperator.IsTrue,\n PropertyFilterRuleOperator.IsFalse,\n ];\n }\n\n const operators = [\n PropertyFilterRuleOperator.IsEqual,\n PropertyFilterRuleOperator.IsNotEqual,\n PropertyFilterRuleOperator.IsNull,\n PropertyFilterRuleOperator.IsNotNull,\n ];\n\n if (typename === StandardTypeNames.Number\n || typename === StandardTypeNames.Int\n || typename === StandardTypeNames.Integer\n || typename === StandardTypeNames.Double\n || typename === StandardTypeNames.Float\n || typename === StandardTypeNames.Hex\n || typename === StandardTypeNames.Hexadecimal\n || typename === StandardTypeNames.ShortDate\n || typename === StandardTypeNames.DateTime) {\n return [\n ...operators,\n PropertyFilterRuleOperator.Greater,\n PropertyFilterRuleOperator.GreaterOrEqual,\n PropertyFilterRuleOperator.Less,\n PropertyFilterRuleOperator.LessOrEqual,\n ];\n }\n\n if (typename === StandardTypeNames.String || typename === StandardTypeNames.Text) {\n return [\n ...operators,\n PropertyFilterRuleOperator.Like,\n ];\n }\n\n return operators;\n}\n\n/* istanbul ignore next */\n/**\n * Function that returns display label for rule operator.\n * @beta\n */\nexport function getPropertyFilterOperatorLabel(operator: PropertyFilterRuleOperator) {\n switch (operator) {\n case PropertyFilterRuleOperator.IsTrue:\n return UiComponents.translate(\"filterBuilder.operators.isTrue\");\n case PropertyFilterRuleOperator.IsFalse:\n return UiComponents.translate(\"filterBuilder.operators.isFalse\");\n case PropertyFilterRuleOperator.IsEqual:\n return UiComponents.translate(\"filterBuilder.operators.equal\");\n case PropertyFilterRuleOperator.IsNotEqual:\n return UiComponents.translate(\"filterBuilder.operators.notEqual\");\n case PropertyFilterRuleOperator.Greater:\n return \">\";\n case PropertyFilterRuleOperator.GreaterOrEqual:\n return \">=\";\n case PropertyFilterRuleOperator.Less:\n return \"<\";\n case PropertyFilterRuleOperator.LessOrEqual:\n return \"<=\";\n case PropertyFilterRuleOperator.Like:\n return UiComponents.translate(\"filterBuilder.operators.contains\");\n case PropertyFilterRuleOperator.IsNull:\n return UiComponents.translate(\"filterBuilder.operators.isNull\");\n case PropertyFilterRuleOperator.IsNotNull:\n return UiComponents.translate(\"filterBuilder.operators.isNotNull\");\n }\n}\n\n/**\n * Function that checks if supplied operator is unary.\n * @beta\n */\nexport function isUnaryPropertyFilterOperator(operator: PropertyFilterRuleOperator) {\n switch (operator) {\n case PropertyFilterRuleOperator.IsTrue:\n case PropertyFilterRuleOperator.IsFalse:\n case PropertyFilterRuleOperator.IsNull:\n case PropertyFilterRuleOperator.IsNotNull:\n return true;\n }\n return false;\n}\n"]}
|
|
@@ -1,18 +1,38 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module PropertyFilterBuilder
|
|
3
|
+
*/
|
|
1
4
|
import { PropertyDescription, PropertyValue } from "@itwin/appui-abstract";
|
|
2
5
|
import { PropertyFilterRuleGroupOperator, PropertyFilterRuleOperator } from "./Operators";
|
|
3
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Type that describes property filter.
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
4
10
|
export declare type PropertyFilter = PropertyFilterRule | PropertyFilterRuleGroup;
|
|
5
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Data structure that describes group of filter rules.
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
6
15
|
export interface PropertyFilterRuleGroup {
|
|
16
|
+
/** Operator that should join rules in this group. */
|
|
7
17
|
operator: PropertyFilterRuleGroupOperator;
|
|
18
|
+
/** Rules in this group. */
|
|
8
19
|
rules: Array<PropertyFilter>;
|
|
9
20
|
}
|
|
10
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Data structure that describes single filter rule.
|
|
23
|
+
* @beta
|
|
24
|
+
*/
|
|
11
25
|
export interface PropertyFilterRule {
|
|
26
|
+
/** Property used in this rule. */
|
|
12
27
|
property: PropertyDescription;
|
|
28
|
+
/** Operator that should be used to compare property value. */
|
|
13
29
|
operator: PropertyFilterRuleOperator;
|
|
30
|
+
/** Value that property should be compared to. */
|
|
14
31
|
value?: PropertyValue;
|
|
15
32
|
}
|
|
16
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Function that checks if supplied filter is rule group.
|
|
35
|
+
* @beta
|
|
36
|
+
*/
|
|
17
37
|
export declare function isPropertyFilterRuleGroup(filter: PropertyFilter): filter is PropertyFilterRuleGroup;
|
|
18
38
|
//# sourceMappingURL=Types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/Types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,+BAA+B,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAE1F
|
|
1
|
+
{"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/Types.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,+BAA+B,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAE1F;;;GAGG;AACH,oBAAY,cAAc,GAAG,kBAAkB,GAAG,uBAAuB,CAAC;AAE1E;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,qDAAqD;IACrD,QAAQ,EAAE,+BAA+B,CAAC;IAC1C,2BAA2B;IAC3B,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,kCAAkC;IAClC,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,8DAA8D;IAC9D,QAAQ,EAAE,0BAA0B,CAAC;IACrC,iDAAiD;IACjD,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,IAAI,uBAAuB,CAEnG"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module PropertyFilterBuilder
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Function that checks if supplied filter is rule group.
|
|
10
|
+
* @beta
|
|
11
|
+
*/
|
|
2
12
|
export function isPropertyFilterRuleGroup(filter) {
|
|
3
13
|
return filter.rules !== undefined;
|
|
4
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Types.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/Types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Types.js","sourceRoot":"","sources":["../../../../src/components-react/filter-builder/Types.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAmCH;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAsB;IAC9D,OAAQ,MAAc,CAAC,KAAK,KAAK,SAAS,CAAC;AAC7C,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 PropertyFilterBuilder\n */\n\nimport { PropertyDescription, PropertyValue } from \"@itwin/appui-abstract\";\nimport { PropertyFilterRuleGroupOperator, PropertyFilterRuleOperator } from \"./Operators\";\n\n/**\n * Type that describes property filter.\n * @beta\n */\nexport type PropertyFilter = PropertyFilterRule | PropertyFilterRuleGroup;\n\n/**\n * Data structure that describes group of filter rules.\n * @beta\n */\nexport interface PropertyFilterRuleGroup {\n /** Operator that should join rules in this group. */\n operator: PropertyFilterRuleGroupOperator;\n /** Rules in this group. */\n rules: Array<PropertyFilter>;\n}\n\n/**\n * Data structure that describes single filter rule.\n * @beta\n */\nexport interface PropertyFilterRule {\n /** Property used in this rule. */\n property: PropertyDescription;\n /** Operator that should be used to compare property value. */\n operator: PropertyFilterRuleOperator;\n /** Value that property should be compared to. */\n value?: PropertyValue;\n}\n\n/**\n * Function that checks if supplied filter is rule group.\n * @beta\n */\nexport function isPropertyFilterRuleGroup(filter: PropertyFilter): filter is PropertyFilterRuleGroup {\n return (filter as any).rules !== undefined;\n}\n"]}
|
|
@@ -14,7 +14,7 @@ export declare const renderLinks: (text: string, links: LinkElementsInfo, highli
|
|
|
14
14
|
export declare const withLinks: (stringValue: string, links?: LinkElementsInfo | undefined, highlight?: ((text: string) => React.ReactNode) | undefined) => React.ReactNode;
|
|
15
15
|
/**
|
|
16
16
|
* Properties for [[LinksRenderer]] component.
|
|
17
|
-
* @
|
|
17
|
+
* @public
|
|
18
18
|
*/
|
|
19
19
|
export interface LinksRendererProps {
|
|
20
20
|
value: string;
|
|
@@ -23,7 +23,7 @@ export interface LinksRendererProps {
|
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* React component for rendering string with links.
|
|
26
|
-
* @
|
|
26
|
+
* @public
|
|
27
27
|
*/
|
|
28
28
|
export declare function LinksRenderer(props: LinksRendererProps): JSX.Element;
|
|
29
29
|
//# sourceMappingURL=LinkHandler.d.ts.map
|
|
@@ -72,7 +72,7 @@ export const withLinks = (stringValue, links, highlight) => {
|
|
|
72
72
|
};
|
|
73
73
|
/**
|
|
74
74
|
* React component for rendering string with links.
|
|
75
|
-
* @
|
|
75
|
+
* @public
|
|
76
76
|
*/
|
|
77
77
|
export function LinksRenderer(props) {
|
|
78
78
|
return React.createElement(React.Fragment, null, withLinks(props.value, props.links, props.highlighter));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkHandler.js","sourceRoot":"","sources":["../../../../src/components-react/properties/LinkHandler.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,iCAAiC;AACjC,SAAS,SAAS,CAAC,IAAY,EAAE,KAAuB,EAAE,SAA6C;IACrG,OAAO,CACL,oBAAC,gBAAgB,IACf,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC,IAEA,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAClB,CACpB,CAAC;AACJ,CAAC;AAID,SAAS,eAAe,CAAC,MAAa,EAAE,MAAa;IACnD,IAAI,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;QAC7B,OAAO,CAAC,CAAC;IACX,IAAI,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;QAC7B,OAAO,CAAC,CAAC,CAAC;IACZ,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,cAAc,CAAC,IAAY,EAAE,SAA6C;IACjF,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CA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AC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,KAAK,IAAG,IAAI,CAAkB,CAAC,CAAC;AACzF,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY,EAAE,SAA4C;IACnF,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,KAAuB,EAAE,SAA6C,EAAmB,EAAE;IACnI,OAAO,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,WAAmB,EAAE,KAAwB,EAAE,SAA6C,EAAmB,EAAE;IACzI,IAAI,KAAK;QACP,OAAO,WAAW,CAAC,WAAW,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACpD,IAAI,SAAS;QACX,OAAO,iBAAiB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IACnD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAYF;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,OAAO,0CAAG,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAI,CAAC;AACvE,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 Properties\n */\n\nimport * as React from \"react\";\nimport { BentleyError, BentleyStatus } from \"@itwin/core-bentley\";\nimport { LinkElementsInfo } from \"@itwin/appui-abstract\";\nimport { UnderlinedButton } from \"@itwin/core-react\";\n\n/** Render a single anchor tag */\nfunction renderTag(text: string, links: LinkElementsInfo, highlight?: (text: string) => React.ReactNode) {\n return (\n <UnderlinedButton\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n links.onClick(text);\n }}\n >\n {highlight ? highlight(text) : text}\n </UnderlinedButton>\n );\n}\n\ninterface Match { start: number, end: number }\n\nfunction matchComparison(matchA: Match, matchB: Match) {\n if (matchA.start > matchB.start)\n return 1;\n if (matchB.start > matchA.start)\n return -1;\n return 0;\n}\n\nfunction renderTextPart(text: string, highlight?: (text: string) => React.ReactNode): React.ReactNode {\n return highlight ? highlight(text) : text;\n}\n\nfunction renderText(text: string, links: LinkElementsInfo, highlight?: (text: string) => React.ReactNode): React.ReactNode {\n const { matcher } = links;\n\n if (!matcher)\n return renderTag(text, links, highlight);\n\n const matches = matcher(text);\n\n // Sort just to be sure\n matches.sort(matchComparison);\n\n const parts: React.ReactNode[] = [];\n let lastIndex = 0;\n for (const match of matches) {\n // If matches overlap there must be something wrong with the matcher\n if (lastIndex > match.start)\n throw new BentleyError(BentleyStatus.ERROR, \"renderText: matcher returned overlapping matches\");\n\n if (lastIndex < match.start)\n parts.push(renderTextPart(text.substring(lastIndex, match.start), highlight));\n\n const anchorText = text.substring(match.start, match.end);\n parts.push(renderTag(anchorText, links, highlight));\n\n lastIndex = match.end;\n }\n if (text.length > lastIndex)\n parts.push(renderTextPart(text.substring(lastIndex), highlight));\n\n // Need to map, because React complains about the lack of keys\n return parts.map((part, index) => <React.Fragment key={index}>{part}</React.Fragment>);\n}\n\nfunction renderHighlighted(text: string, highlight: (text: string) => React.ReactNode) {\n return highlight(text);\n}\n\n/** Renders anchor tag by wrapping or splitting provided text\n * @public\n */\nexport const renderLinks = (text: string, links: LinkElementsInfo, highlight?: (text: string) => React.ReactNode): React.ReactNode => {\n return renderText(text, links, highlight);\n};\n\n/** If record has links, wraps stringValue in them, otherwise returns unchanged stringValue\n * Optionally it can highlight text\n * @public\n */\nexport const withLinks = (stringValue: string, links?: LinkElementsInfo, highlight?: (text: string) => React.ReactNode): React.ReactNode => {\n if (links)\n return renderLinks(stringValue, links, highlight);\n if (highlight)\n return renderHighlighted(stringValue, highlight);\n return stringValue;\n};\n\n/**\n * Properties for [[LinksRenderer]] component.\n * @
|
|
1
|
+
{"version":3,"file":"LinkHandler.js","sourceRoot":"","sources":["../../../../src/components-react/properties/LinkHandler.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,iCAAiC;AACjC,SAAS,SAAS,CAAC,IAAY,EAAE,KAAuB,EAAE,SAA6C;IACrG,OAAO,CACL,oBAAC,gBAAgB,IACf,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC,IAEA,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAClB,CACpB,CAAC;AACJ,CAAC;AAID,SAAS,eAAe,CAAC,MAAa,EAAE,MAAa;IACnD,IAAI,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;QAC7B,OAAO,CAAC,CAAC;IACX,IAAI,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;QAC7B,OAAO,CAAC,CAAC,CAAC;IACZ,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,cAAc,CAAC,IAAY,EAAE,SAA6C;IACjF,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5C,CAAC;AAED,SAAS,UAAU,CAAC,IAAY,EAAE,KAAuB,EAAE,SAA6C;IACtG,MAA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AC,CAAC;AACzF,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY,EAAE,SAA4C;IACnF,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,KAAuB,EAAE,SAA6C,EAAmB,EAAE;IACnI,OAAO,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,WAAmB,EAAE,KAAwB,EAAE,SAA6C,EAAmB,EAAE;IACzI,IAAI,KAAK;QACP,OAAO,WAAW,CAAC,WAAW,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACpD,IAAI,SAAS;QACX,OAAO,iBAAiB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IACnD,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAYF;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,OAAO,0CAAG,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAI,CAAC;AACvE,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 Properties\n */\n\nimport * as React from \"react\";\nimport { BentleyError, BentleyStatus } from \"@itwin/core-bentley\";\nimport { LinkElementsInfo } from \"@itwin/appui-abstract\";\nimport { UnderlinedButton } from \"@itwin/core-react\";\n\n/** Render a single anchor tag */\nfunction renderTag(text: string, links: LinkElementsInfo, highlight?: (text: string) => React.ReactNode) {\n return (\n <UnderlinedButton\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n links.onClick(text);\n }}\n >\n {highlight ? highlight(text) : text}\n </UnderlinedButton>\n );\n}\n\ninterface Match { start: number, end: number }\n\nfunction matchComparison(matchA: Match, matchB: Match) {\n if (matchA.start > matchB.start)\n return 1;\n if (matchB.start > matchA.start)\n return -1;\n return 0;\n}\n\nfunction renderTextPart(text: string, highlight?: (text: string) => React.ReactNode): React.ReactNode {\n return highlight ? highlight(text) : text;\n}\n\nfunction renderText(text: string, links: LinkElementsInfo, highlight?: (text: string) => React.ReactNode): React.ReactNode {\n const { matcher } = links;\n\n if (!matcher)\n return renderTag(text, links, highlight);\n\n const matches = matcher(text);\n\n // Sort just to be sure\n matches.sort(matchComparison);\n\n const parts: React.ReactNode[] = [];\n let lastIndex = 0;\n for (const match of matches) {\n // If matches overlap there must be something wrong with the matcher\n if (lastIndex > match.start)\n throw new BentleyError(BentleyStatus.ERROR, \"renderText: matcher returned overlapping matches\");\n\n if (lastIndex < match.start)\n parts.push(renderTextPart(text.substring(lastIndex, match.start), highlight));\n\n const anchorText = text.substring(match.start, match.end);\n parts.push(renderTag(anchorText, links, highlight));\n\n lastIndex = match.end;\n }\n if (text.length > lastIndex)\n parts.push(renderTextPart(text.substring(lastIndex), highlight));\n\n // Need to map, because React complains about the lack of keys\n return parts.map((part, index) => <React.Fragment key={index}>{part}</React.Fragment>);\n}\n\nfunction renderHighlighted(text: string, highlight: (text: string) => React.ReactNode) {\n return highlight(text);\n}\n\n/** Renders anchor tag by wrapping or splitting provided text\n * @public\n */\nexport const renderLinks = (text: string, links: LinkElementsInfo, highlight?: (text: string) => React.ReactNode): React.ReactNode => {\n return renderText(text, links, highlight);\n};\n\n/** If record has links, wraps stringValue in them, otherwise returns unchanged stringValue\n * Optionally it can highlight text\n * @public\n */\nexport const withLinks = (stringValue: string, links?: LinkElementsInfo, highlight?: (text: string) => React.ReactNode): React.ReactNode => {\n if (links)\n return renderLinks(stringValue, links, highlight);\n if (highlight)\n return renderHighlighted(stringValue, highlight);\n return stringValue;\n};\n\n/**\n * Properties for [[LinksRenderer]] component.\n * @public\n */\nexport interface LinksRendererProps {\n value: string;\n links?: LinkElementsInfo;\n highlighter?: (text: string) => React.ReactNode;\n}\n\n/**\n * React component for rendering string with links.\n * @public\n */\nexport function LinksRenderer(props: LinksRendererProps) {\n return <>{withLinks(props.value, props.links, props.highlighter)}</>;\n}\n"]}
|
|
@@ -6,7 +6,7 @@ import { VirtualizedPropertyGridContext } from "./component/VirtualizedPropertyG
|
|
|
6
6
|
import { GridCategoryItem } from "./internal/flat-items/FlatGridItem";
|
|
7
7
|
/**
|
|
8
8
|
* Props that property category renderer receives.
|
|
9
|
-
* @
|
|
9
|
+
* @public
|
|
10
10
|
*/
|
|
11
11
|
export interface PropertyCategoryRendererProps {
|
|
12
12
|
/** The category being rendered. */
|
|
@@ -18,13 +18,13 @@ export interface PropertyCategoryRendererProps {
|
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Factory function that produces custom property category components.
|
|
21
|
-
* @
|
|
21
|
+
* @public
|
|
22
22
|
*/
|
|
23
23
|
export declare type PropertyCategoryRenderer = (categoryItem: GridCategoryItem) => React.ComponentType<PropertyCategoryRendererProps> | undefined;
|
|
24
24
|
/**
|
|
25
25
|
* Keeps a record of currently registered property category renderers and determines which renderers get invoked for
|
|
26
26
|
* each category.
|
|
27
|
-
* @
|
|
27
|
+
* @public
|
|
28
28
|
*/
|
|
29
29
|
export declare class PropertyCategoryRendererManager {
|
|
30
30
|
private _categoryRenderers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyCategoryRendererManager.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/PropertyCategoryRendererManager.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAyBH;;;;GAIG;AACH,MAAM,OAAO,+BAA+B;IAA5C;QACU,uBAAkB,GAAG,IAAI,GAAG,EAAoC,CAAC;IA4B3E,CAAC;IAxBC,mFAAmF;IAC5E,oBAAoB,CAAC,YAA8B;;QACxD,IAAI,YAAY,CAAC,eAAe,CAAC,QAAQ,KAAK,SAAS,EAAE;YACvD,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,MAAA,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,YAAY,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,0CAAG,YAAY,CAAC,CAAC;IACjG,CAAC;IAED,qGAAqG;IAC9F,WAAW,CAAC,YAAoB,EAAE,gBAA0C,EAAE,QAAQ,GAAG,KAAK;QACnG,IAAI,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE;YAC1D,MAAM,SAAS,GAAG,+BAA+B,CAAC,IAAI,CAAC;YACvD,MAAM,UAAU,GAAG,+BAA+B,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC;YAC9E,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,IAAI,UAAU,qBAAqB,YAAY,wDAAwD,CAAC,CAAC;SACtI;QAED,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;IAC9D,CAAC;IAED,sDAAsD;IAC/C,cAAc,CAAC,YAAoB;QACxC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC/C,CAAC;;AAzBa,8CAAc,GAAG,IAAI,+BAA+B,EAAE,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 * as React from \"react\";\nimport { VirtualizedPropertyGridContext } from \"./component/VirtualizedPropertyGrid\";\nimport { GridCategoryItem } from \"./internal/flat-items/FlatGridItem\";\n\n/**\n * Props that property category renderer receives.\n * @
|
|
1
|
+
{"version":3,"file":"PropertyCategoryRendererManager.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/PropertyCategoryRendererManager.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAyBH;;;;GAIG;AACH,MAAM,OAAO,+BAA+B;IAA5C;QACU,uBAAkB,GAAG,IAAI,GAAG,EAAoC,CAAC;IA4B3E,CAAC;IAxBC,mFAAmF;IAC5E,oBAAoB,CAAC,YAA8B;;QACxD,IAAI,YAAY,CAAC,eAAe,CAAC,QAAQ,KAAK,SAAS,EAAE;YACvD,OAAO,SAAS,CAAC;SAClB;QAED,OAAO,MAAA,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,YAAY,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,0CAAG,YAAY,CAAC,CAAC;IACjG,CAAC;IAED,qGAAqG;IAC9F,WAAW,CAAC,YAAoB,EAAE,gBAA0C,EAAE,QAAQ,GAAG,KAAK;QACnG,IAAI,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE;YAC1D,MAAM,SAAS,GAAG,+BAA+B,CAAC,IAAI,CAAC;YACvD,MAAM,UAAU,GAAG,+BAA+B,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC;YAC9E,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,IAAI,UAAU,qBAAqB,YAAY,wDAAwD,CAAC,CAAC;SACtI;QAED,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;IAC9D,CAAC;IAED,sDAAsD;IAC/C,cAAc,CAAC,YAAoB;QACxC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC/C,CAAC;;AAzBa,8CAAc,GAAG,IAAI,+BAA+B,EAAE,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 * as React from \"react\";\nimport { VirtualizedPropertyGridContext } from \"./component/VirtualizedPropertyGrid\";\nimport { GridCategoryItem } from \"./internal/flat-items/FlatGridItem\";\n\n/**\n * Props that property category renderer receives.\n * @public\n */\nexport interface PropertyCategoryRendererProps {\n /** The category being rendered. */\n categoryItem: GridCategoryItem;\n /** Context of the surrounding property grid. */\n gridContext: VirtualizedPropertyGridContext;\n /** Sets the allocated height for category contents. */\n onHeightChanged: (newHeight: number) => void;\n}\n\n/**\n * Factory function that produces custom property category components.\n * @public\n */\nexport type PropertyCategoryRenderer = (categoryItem: GridCategoryItem) => React.ComponentType<PropertyCategoryRendererProps> | undefined;\n\n/**\n * Keeps a record of currently registered property category renderers and determines which renderers get invoked for\n * each category.\n * @public\n */\nexport class PropertyCategoryRendererManager {\n private _categoryRenderers = new Map<string, PropertyCategoryRenderer>();\n\n public static defaultManager = new PropertyCategoryRendererManager();\n\n /** Retrieves a category rendering component based for the passed category item. */\n public getCategoryComponent(categoryItem: GridCategoryItem): React.ComponentType<PropertyCategoryRendererProps> | undefined {\n if (categoryItem.derivedCategory.renderer === undefined) {\n return undefined;\n }\n\n return this._categoryRenderers.get(categoryItem.derivedCategory.renderer.name)?.(categoryItem);\n }\n\n /** Registers a renderer factory function to be invoked on categories with specific renderer name. */\n public addRenderer(rendererName: string, categoryRenderer: PropertyCategoryRenderer, override = false): void {\n if (this._categoryRenderers.has(rendererName) && !override) {\n const className = PropertyCategoryRendererManager.name;\n const methodName = PropertyCategoryRendererManager.prototype.addRenderer.name;\n throw new Error(`${className}.${methodName} error: renderer '${rendererName}' has already been added. Did you mean to override it?`);\n }\n\n this._categoryRenderers.set(rendererName, categoryRenderer);\n }\n\n /** Removes previous renderer factory registration. */\n public removeRenderer(rendererName: string): void {\n this._categoryRenderers.delete(rendererName);\n }\n}\n"]}
|
|
@@ -28,8 +28,8 @@ export interface PropertyData {
|
|
|
28
28
|
[categoryName: string]: PropertyRecord[];
|
|
29
29
|
};
|
|
30
30
|
/**
|
|
31
|
-
* Should state of existing property data in the component be
|
|
32
|
-
* @
|
|
31
|
+
* Should state of existing property data in the component be re-used for this property data
|
|
32
|
+
* @beta
|
|
33
33
|
*/
|
|
34
34
|
reusePropertyDataState?: boolean;
|
|
35
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyDataProvider.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/PropertyDataProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAsC9C;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,OAAoC;CAAI","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 { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { BeEvent } from \"@itwin/core-bentley\";\n\n/**\n * Contains metadata about a group of Properties.\n * @public\n */\nexport interface PropertyCategory {\n name: string;\n label: string;\n expand: boolean;\n childCategories?: PropertyCategory[];\n renderer?: {\n name: string;\n };\n}\n\n/**\n * Interface for property data provided to the PropertyGrid React component.\n * @public\n */\nexport interface PropertyData {\n label: PropertyRecord;\n description?: string;\n categories: PropertyCategory[];\n records: { [categoryName: string]: PropertyRecord[] };\n\n /**\n * Should state of existing property data in the component be
|
|
1
|
+
{"version":3,"file":"PropertyDataProvider.js","sourceRoot":"","sources":["../../../../src/components-react/propertygrid/PropertyDataProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAsC9C;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,OAAoC;CAAI","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 { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { BeEvent } from \"@itwin/core-bentley\";\n\n/**\n * Contains metadata about a group of Properties.\n * @public\n */\nexport interface PropertyCategory {\n name: string;\n label: string;\n expand: boolean;\n childCategories?: PropertyCategory[];\n renderer?: {\n name: string;\n };\n}\n\n/**\n * Interface for property data provided to the PropertyGrid React component.\n * @public\n */\nexport interface PropertyData {\n label: PropertyRecord;\n description?: string;\n categories: PropertyCategory[];\n records: { [categoryName: string]: PropertyRecord[] };\n\n /**\n * Should state of existing property data in the component be re-used for this property data\n * @beta\n */\n reusePropertyDataState?: boolean;\n}\n\n/** A signature for property data change listeners\n * @public\n */\nexport declare type PropertyDataChangesListener = () => void;\n\n/** An event broadcasted on property data changes\n * @public\n */\nexport class PropertyDataChangeEvent extends BeEvent<PropertyDataChangesListener> { }\n\n/**\n * An interface for property data provider which returns\n * property data and broadcasts an event when the data changes\n * @public\n */\nexport interface IPropertyDataProvider {\n /** Returns property data. */\n getData: (() => Promise<PropertyData>);\n /** Property data change event. */\n onDataChanged: PropertyDataChangeEvent;\n}\n"]}
|
|
@@ -9,6 +9,7 @@ import { IPropertyDataProvider, PropertyCategory } from "../PropertyDataProvider
|
|
|
9
9
|
import { CommonPropertyGridProps } from "./PropertyGridCommons";
|
|
10
10
|
/** Properties for [[PropertyGrid]] React component
|
|
11
11
|
* @public
|
|
12
|
+
* @deprecated in 3.x. Use [[VirtualizedPropertyGrid]] instead.
|
|
12
13
|
*/
|
|
13
14
|
export interface PropertyGridProps extends CommonPropertyGridProps {
|
|
14
15
|
/** Property data provider */
|
|
@@ -34,6 +35,7 @@ interface PropertyGridState {
|
|
|
34
35
|
}
|
|
35
36
|
/** PropertyGrid React component.
|
|
36
37
|
* @public
|
|
38
|
+
* @deprecated in 3.x. Use [[VirtualizedPropertyGrid]] instead.
|
|
37
39
|
*/
|
|
38
40
|
export declare class PropertyGrid extends React.Component<PropertyGridProps, PropertyGridState> {
|
|
39
41
|
private _dataChangesListenerDisposeFunc?;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyGrid.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/PropertyGrid.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,qBAAqB,CAAC;AAG7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAA8B,MAAM,mBAAmB,CAAC;AAE5E,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAgB,MAAM,yBAAyB,CAAC;AAGhG,OAAO,EAAE,uBAAuB,EAAuB,MAAM,uBAAuB,CAAC;AAIrF
|
|
1
|
+
{"version":3,"file":"PropertyGrid.d.ts","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/PropertyGrid.tsx"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,qBAAqB,CAAC;AAG7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAA8B,MAAM,mBAAmB,CAAC;AAE5E,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAgB,MAAM,yBAAyB,CAAC;AAGhG,OAAO,EAAE,uBAAuB,EAAuB,MAAM,uBAAuB,CAAC;AAIrF;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,uBAAuB;IAChE,6BAA6B;IAC7B,YAAY,EAAE,qBAAqB,CAAC;CACrC;AAED,UAAU,8BAA8B;IACtC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,QAAQ,EAAE,8BAA8B,EAAE,CAAC;CAC5C;AAED;;GAEG;AACH,UAAU,iBAAiB;IACzB,sCAAsC;IACtC,UAAU,EAAE,8BAA8B,EAAE,CAAC;IAC7C,mDAAmD;IACnD,WAAW,EAAE,WAAW,CAAC;IACzB,uEAAuE;IACvE,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,qBAAa,YAAa,SAAQ,KAAK,CAAC,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IACrF,OAAO,CAAC,+BAA+B,CAAC,CAAc;IACtD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,sBAAsB,CAAS;IAEvC,gBAAgB;gBACJ,KAAK,EAAE,iBAAiB;IASpC,gBAAgB;IACA,iBAAiB;IAQjC,gBAAgB;IACA,oBAAoB;IASpB,kBAAkB,CAAC,SAAS,EAAE,iBAAiB;IAiB/D,OAAO,CAAC,sBAAsB,CAG5B;YAEY,UAAU;IAyCxB,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,SAAS,CAEf;IAEF,OAAO,CAAC,2BAA2B,CAWjC;IAEF,OAAO,CAAC,iBAAiB;IAQzB,gBAAgB;IACA,MAAM;CA4CvB"}
|
|
@@ -18,6 +18,7 @@ import { PropertyGridEventsRelatedPropsSupplier } from "./PropertyGridEventsRela
|
|
|
18
18
|
import { PropertyList } from "./PropertyList";
|
|
19
19
|
/** PropertyGrid React component.
|
|
20
20
|
* @public
|
|
21
|
+
* @deprecated in 3.x. Use [[VirtualizedPropertyGrid]] instead.
|
|
21
22
|
*/
|
|
22
23
|
export class PropertyGrid extends React.Component {
|
|
23
24
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyGrid.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/PropertyGrid.tsx"],"names":[],"mappings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AC3C,UAAU,EAAE,KAAK,CAAC,kBAAkB,CAAC,OAAO,EAC5C,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,EAC1C,sBAAsB,EAAE,KAAK,CAAC,sBAAsB,EACpD,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,EAClD,4BAA4B,EAAE,KAAK,CAAC,4BAA4B,EAChE,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAC5C,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,sBAAsB,EAAE,KAAK,CAAC,sBAAsB,EACpD,0BAA0B,EAAE,KAAK,CAAC,0BAA0B,EAC5D,oCAAoC,EAAE,KAAK,CAAC,oCAAoC,EAChF,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,GAClD,CACH,CACuC,CAC3C,CAAC,CAAC,CAAC,SAAS;QACZ,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAC1C,6BAAK,SAAS,EAAC,qBAAqB,IAEhC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,uBAAuB,EAAE,EAAE,CAAC,CACjE,oBAAC,mBAAmB,OAAK,KAAK,EAAE,GAAG,EAAE,uBAAuB,CAAC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,EAAE,uBAAuB,GAAI,CAC5H,CAAC,CAEA,CACP,CAAC,CAAC,CAAC,SAAS,CACS,CACzB,CAAC;AACJ,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\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport \"./PropertyGrid.scss\";\nimport classnames from \"classnames\";\nimport { produce } from \"immer\";\nimport * as React from \"react\";\nimport { DisposeFunc } from \"@itwin/core-bentley\";\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { Orientation, ResizableContainerObserver } from \"@itwin/core-react\";\nimport { DelayedSpinner } from \"../../common/DelayedSpinner\";\nimport { IPropertyDataProvider, PropertyCategory, PropertyData } from \"../PropertyDataProvider\";\nimport { ColumnResizeRelatedPropertyListProps, ColumnResizingPropertyListPropsSupplier } from \"./ColumnResizingPropertyListPropsSupplier\";\nimport { PropertyCategoryBlock } from \"./PropertyCategoryBlock\";\nimport { CommonPropertyGridProps, PropertyGridCommons } from \"./PropertyGridCommons\";\nimport { PropertyGridEventsRelatedPropsSupplier } from \"./PropertyGridEventsRelatedPropsSupplier\";\nimport { PropertyList, PropertyListProps } from \"./PropertyList\";\n\n/** Properties for [[PropertyGrid]] React component\n * @public\n */\nexport interface PropertyGridProps extends CommonPropertyGridProps {\n /** Property data provider */\n dataProvider: IPropertyDataProvider;\n}\n\ninterface CategorizedPropertyGridRecords {\n category: PropertyCategory;\n records: PropertyRecord[];\n children: CategorizedPropertyGridRecords[];\n}\n\n/** State of [[PropertyGrid]] React component\n * @internal\n */\ninterface PropertyGridState {\n /** List of PropertyGrid categories */\n categories: CategorizedPropertyGridRecords[];\n /** Actual orientation used by the property grid */\n orientation: Orientation;\n /** If property grid currently loading data, the loading start time */\n loadStart?: Date;\n /** Width of PropertyGrid */\n width: number;\n}\n\n/** PropertyGrid React component.\n * @public\n */\nexport class PropertyGrid extends React.Component<PropertyGridProps, PropertyGridState> {\n private _dataChangesListenerDisposeFunc?: DisposeFunc;\n private _isMounted = false;\n private _isInDataRequest = false;\n private _hasPendingDataRequest = false;\n\n /** @internal */\n constructor(props: PropertyGridProps) {\n super(props);\n this.state = {\n categories: [],\n orientation: this.getPreferredOrientation(),\n width: 0,\n };\n }\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this._dataChangesListenerDisposeFunc = this.props.dataProvider.onDataChanged.addListener(this._onPropertyDataChanged);\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.gatherData();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n // istanbul ignore else\n if (this._dataChangesListenerDisposeFunc) {\n this._dataChangesListenerDisposeFunc();\n this._dataChangesListenerDisposeFunc = undefined;\n }\n this._isMounted = false;\n }\n\n public override componentDidUpdate(prevProps: PropertyGridProps) {\n if (this.props.dataProvider !== prevProps.dataProvider) {\n // istanbul ignore else\n if (this._dataChangesListenerDisposeFunc)\n this._dataChangesListenerDisposeFunc();\n this._dataChangesListenerDisposeFunc = this.props.dataProvider.onDataChanged.addListener(this._onPropertyDataChanged);\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.gatherData();\n }\n\n if (this.props.orientation !== prevProps.orientation\n || this.props.isOrientationFixed !== prevProps.isOrientationFixed\n || this.props.horizontalOrientationMinWidth !== prevProps.horizontalOrientationMinWidth)\n this.updateOrientation(this.state.width);\n }\n\n private _onPropertyDataChanged = () => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.gatherData();\n };\n\n private async gatherData(): Promise<void> {\n if (this._isInDataRequest) {\n this._hasPendingDataRequest = true;\n return;\n }\n\n this.setState((prev) => prev.loadStart ? null : { loadStart: new Date() });\n\n this._isInDataRequest = true;\n let propertyData: PropertyData;\n try {\n propertyData = await this.props.dataProvider.getData();\n } finally {\n this._isInDataRequest = false;\n }\n\n if (!this._isMounted)\n return;\n\n if (this._hasPendingDataRequest) {\n this._hasPendingDataRequest = false;\n return this.gatherData();\n }\n\n this.setState((prevState) => {\n const buildCategoriesHierarchy = (newCategories: PropertyCategory[], stateCategories: CategorizedPropertyGridRecords[] | undefined) =>\n newCategories.map((category): CategorizedPropertyGridRecords => {\n const matchingStateCategory = findCategory(stateCategories ?? [], category.name, false);\n return {\n category: { ...category, expand: matchingStateCategory?.category?.expand ?? category.expand },\n records: propertyData.records[category.name] ?? [],\n children: buildCategoriesHierarchy(category.childCategories ?? [], matchingStateCategory?.children),\n };\n });\n return {\n categories: buildCategoriesHierarchy(propertyData.categories, prevState.categories),\n loadStart: undefined,\n };\n });\n }\n\n private getPreferredOrientation(): Orientation {\n return (this.props.orientation !== undefined) ? this.props.orientation : Orientation.Horizontal;\n }\n\n private _onResize = (width: number) => {\n this.updateOrientation(width);\n };\n\n private _onCategoryExpansionToggled = (categoryName: string) => {\n this.setState((state) => {\n return produce(state, (draft) => {\n const records = findCategory(draft.categories, categoryName, true);\n // istanbul ignore else\n if (records) {\n const category = records.category;\n category.expand = !category.expand;\n }\n });\n });\n };\n\n private updateOrientation(width: number): void {\n const { orientation, isOrientationFixed, horizontalOrientationMinWidth } = { ...this.props };\n const currentOrientation = PropertyGridCommons.getCurrentOrientation(width, orientation, isOrientationFixed, horizontalOrientationMinWidth);\n\n if (currentOrientation !== this.state.orientation || width !== this.state.width)\n this.setState({ orientation: currentOrientation, width });\n }\n\n /** @internal */\n public override render() {\n if (this.state.loadStart) {\n return (\n <div className=\"components-property-grid-loader\">\n <DelayedSpinner loadStart={this.state.loadStart} size=\"large\" />\n </div>\n );\n }\n\n return (\n <PropertyGridEventsRelatedPropsSupplier\n isPropertySelectionEnabled={this.props.isPropertySelectionEnabled ?? false}\n isPropertySelectionOnRightClickEnabled={this.props.isPropertySelectionOnRightClickEnabled}\n isPropertyEditingEnabled={this.props.isPropertyEditingEnabled}\n isPropertyHoverEnabled={this.props.isPropertyHoverEnabled ?? false}\n onPropertyContextMenu={this.props.onPropertyContextMenu}\n onPropertyUpdated={this.props.onPropertyUpdated}\n onPropertySelectionChanged={this.props.onPropertySelectionChanged}\n >\n {(selectionContext) => (\n <div className={classnames(\"components-property-grid-wrapper\", this.props.className)} style={this.props.style}>\n <div className={classnames(\"components-property-grid\", \"components-smallEditor-host\")}>\n <div className=\"property-categories\">\n {\n this.state.categories.map((categorizedRecords: CategorizedPropertyGridRecords) => (\n <NestedCategoryBlock\n {...selectionContext}\n key={categorizedRecords.category.name}\n categorizedRecords={categorizedRecords}\n onCategoryExpansionToggled={this._onCategoryExpansionToggled}\n orientation={this.state.orientation}\n propertyValueRendererManager={this.props.propertyValueRendererManager}\n actionButtonRenderers={this.props.actionButtonRenderers}\n />\n ))\n }\n </div>\n </div>\n <ResizableContainerObserver onResize={this._onResize} />\n </div>\n )}\n </PropertyGridEventsRelatedPropsSupplier>\n );\n }\n}\n\nfunction findCategory(categories: CategorizedPropertyGridRecords[], lookupName: string, recurseIntoChildren: boolean): CategorizedPropertyGridRecords | undefined {\n for (const category of categories) {\n if (category.category.name === lookupName)\n return category;\n if (recurseIntoChildren) {\n const matchingChild = findCategory(category.children, lookupName, recurseIntoChildren);\n if (matchingChild)\n return matchingChild;\n }\n }\n return undefined;\n}\n\ninterface NestedCategoryBlockProps extends Omit<PropertyListProps, (keyof ColumnResizeRelatedPropertyListProps) | \"properties\"> {\n categorizedRecords: CategorizedPropertyGridRecords;\n onCategoryExpansionToggled: (categoryName: string) => void;\n orientation: Orientation;\n}\nfunction NestedCategoryBlock(props: NestedCategoryBlockProps) {\n return (\n <PropertyCategoryBlock\n category={props.categorizedRecords.category}\n onExpansionToggled={props.onCategoryExpansionToggled}\n >\n {props.categorizedRecords.records.length ? (\n <ColumnResizingPropertyListPropsSupplier orientation={props.orientation}>\n {(partialListProps: ColumnResizeRelatedPropertyListProps) => (\n <PropertyList\n {...partialListProps}\n orientation={props.orientation}\n category={props.categorizedRecords.category}\n properties={props.categorizedRecords.records}\n selectedPropertyKey={props.selectedPropertyKey}\n onPropertyClicked={props.onPropertyClicked}\n onPropertyRightClicked={props.onPropertyRightClicked}\n onPropertyContextMenu={props.onPropertyContextMenu}\n propertyValueRendererManager={props.propertyValueRendererManager}\n editingPropertyKey={props.editingPropertyKey}\n onEditCommit={props.onEditCommit}\n onEditCancel={props.onEditCancel}\n isPropertyHoverEnabled={props.isPropertyHoverEnabled}\n isPropertySelectionEnabled={props.isPropertySelectionEnabled}\n isPropertyRightClickSelectionEnabled={props.isPropertyRightClickSelectionEnabled}\n actionButtonRenderers={props.actionButtonRenderers}\n />\n )}\n </ColumnResizingPropertyListPropsSupplier>\n ) : undefined}\n {props.categorizedRecords.children.length ? (\n <div className=\"property-categories\">\n {\n props.categorizedRecords.children.map((categorizedChildRecords) => (\n <NestedCategoryBlock {...props} key={categorizedChildRecords.category.name} categorizedRecords={categorizedChildRecords} />\n ))\n }\n </div>\n ) : undefined}\n </PropertyCategoryBlock>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PropertyGrid.js","sourceRoot":"","sources":["../../../../../src/components-react/propertygrid/component/PropertyGrid.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F;;GAEG;AACH,OAAO,qBAAqB,CAAC;AAC7B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,WAAW,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAwC,uCAAuC,EAAE,MAAM,2CAA2C,CAAC;AAC1I,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAA2B,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,sCAAsC,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AA+BjE;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK,CAAC,SAA+C;IAMrF,gBAAgB;IAChB,YAAY,KAAwB;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QANP,eAAU,GAAG,KAAK,CAAC;QACnB,qBAAgB,GAAG,KAAK,CAAC;QACzB,2BAAsB,GAAG,KAAK,CAAC;QAgD/B,2BAAsB,GAAG,GAAG,EAAE;YACpC,mEAAmE;YACnE,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,CAAC,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I,CAC5H,CAAC,CAEA,CACP,CAAC,CAAC,CAAC,SAAS,CACS,CACzB,CAAC;AACJ,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\n/** @packageDocumentation\n * @module PropertyGrid\n */\nimport \"./PropertyGrid.scss\";\nimport classnames from \"classnames\";\nimport { produce } from \"immer\";\nimport * as React from \"react\";\nimport { DisposeFunc } from \"@itwin/core-bentley\";\nimport { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { Orientation, ResizableContainerObserver } from \"@itwin/core-react\";\nimport { DelayedSpinner } from \"../../common/DelayedSpinner\";\nimport { IPropertyDataProvider, PropertyCategory, PropertyData } from \"../PropertyDataProvider\";\nimport { ColumnResizeRelatedPropertyListProps, ColumnResizingPropertyListPropsSupplier } from \"./ColumnResizingPropertyListPropsSupplier\";\nimport { PropertyCategoryBlock } from \"./PropertyCategoryBlock\";\nimport { CommonPropertyGridProps, PropertyGridCommons } from \"./PropertyGridCommons\";\nimport { PropertyGridEventsRelatedPropsSupplier } from \"./PropertyGridEventsRelatedPropsSupplier\";\nimport { PropertyList, PropertyListProps } from \"./PropertyList\";\n\n/** Properties for [[PropertyGrid]] React component\n * @public\n * @deprecated in 3.x. Use [[VirtualizedPropertyGrid]] instead.\n */\nexport interface PropertyGridProps extends CommonPropertyGridProps {\n /** Property data provider */\n dataProvider: IPropertyDataProvider;\n}\n\ninterface CategorizedPropertyGridRecords {\n category: PropertyCategory;\n records: PropertyRecord[];\n children: CategorizedPropertyGridRecords[];\n}\n\n/** State of [[PropertyGrid]] React component\n * @internal\n */\ninterface PropertyGridState {\n /** List of PropertyGrid categories */\n categories: CategorizedPropertyGridRecords[];\n /** Actual orientation used by the property grid */\n orientation: Orientation;\n /** If property grid currently loading data, the loading start time */\n loadStart?: Date;\n /** Width of PropertyGrid */\n width: number;\n}\n\n/** PropertyGrid React component.\n * @public\n * @deprecated in 3.x. Use [[VirtualizedPropertyGrid]] instead.\n */\nexport class PropertyGrid extends React.Component<PropertyGridProps, PropertyGridState> { // eslint-disable-line deprecation/deprecation\n private _dataChangesListenerDisposeFunc?: DisposeFunc;\n private _isMounted = false;\n private _isInDataRequest = false;\n private _hasPendingDataRequest = false;\n\n /** @internal */\n constructor(props: PropertyGridProps) { // eslint-disable-line deprecation/deprecation\n super(props);\n this.state = {\n categories: [],\n orientation: this.getPreferredOrientation(),\n width: 0,\n };\n }\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this._dataChangesListenerDisposeFunc = this.props.dataProvider.onDataChanged.addListener(this._onPropertyDataChanged);\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.gatherData();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n // istanbul ignore else\n if (this._dataChangesListenerDisposeFunc) {\n this._dataChangesListenerDisposeFunc();\n this._dataChangesListenerDisposeFunc = undefined;\n }\n this._isMounted = false;\n }\n\n public override componentDidUpdate(prevProps: PropertyGridProps) { // eslint-disable-line deprecation/deprecation\n if (this.props.dataProvider !== prevProps.dataProvider) {\n // istanbul ignore else\n if (this._dataChangesListenerDisposeFunc)\n this._dataChangesListenerDisposeFunc();\n this._dataChangesListenerDisposeFunc = this.props.dataProvider.onDataChanged.addListener(this._onPropertyDataChanged);\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.gatherData();\n }\n\n if (this.props.orientation !== prevProps.orientation\n || this.props.isOrientationFixed !== prevProps.isOrientationFixed\n || this.props.horizontalOrientationMinWidth !== prevProps.horizontalOrientationMinWidth)\n this.updateOrientation(this.state.width);\n }\n\n private _onPropertyDataChanged = () => {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.gatherData();\n };\n\n private async gatherData(): Promise<void> {\n if (this._isInDataRequest) {\n this._hasPendingDataRequest = true;\n return;\n }\n\n this.setState((prev) => prev.loadStart ? null : { loadStart: new Date() });\n\n this._isInDataRequest = true;\n let propertyData: PropertyData;\n try {\n propertyData = await this.props.dataProvider.getData();\n } finally {\n this._isInDataRequest = false;\n }\n\n if (!this._isMounted)\n return;\n\n if (this._hasPendingDataRequest) {\n this._hasPendingDataRequest = false;\n return this.gatherData();\n }\n\n this.setState((prevState) => {\n const buildCategoriesHierarchy = (newCategories: PropertyCategory[], stateCategories: CategorizedPropertyGridRecords[] | undefined) =>\n newCategories.map((category): CategorizedPropertyGridRecords => {\n const matchingStateCategory = findCategory(stateCategories ?? [], category.name, false);\n return {\n category: { ...category, expand: matchingStateCategory?.category?.expand ?? category.expand },\n records: propertyData.records[category.name] ?? [],\n children: buildCategoriesHierarchy(category.childCategories ?? [], matchingStateCategory?.children),\n };\n });\n return {\n categories: buildCategoriesHierarchy(propertyData.categories, prevState.categories),\n loadStart: undefined,\n };\n });\n }\n\n private getPreferredOrientation(): Orientation {\n return (this.props.orientation !== undefined) ? this.props.orientation : Orientation.Horizontal;\n }\n\n private _onResize = (width: number) => {\n this.updateOrientation(width);\n };\n\n private _onCategoryExpansionToggled = (categoryName: string) => {\n this.setState((state) => {\n return produce(state, (draft) => {\n const records = findCategory(draft.categories, categoryName, true);\n // istanbul ignore else\n if (records) {\n const category = records.category;\n category.expand = !category.expand;\n }\n });\n });\n };\n\n private updateOrientation(width: number): void {\n const { orientation, isOrientationFixed, horizontalOrientationMinWidth } = { ...this.props };\n const currentOrientation = PropertyGridCommons.getCurrentOrientation(width, orientation, isOrientationFixed, horizontalOrientationMinWidth);\n\n if (currentOrientation !== this.state.orientation || width !== this.state.width)\n this.setState({ orientation: currentOrientation, width });\n }\n\n /** @internal */\n public override render() {\n if (this.state.loadStart) {\n return (\n <div className=\"components-property-grid-loader\">\n <DelayedSpinner loadStart={this.state.loadStart} size=\"large\" />\n </div>\n );\n }\n\n return (\n <PropertyGridEventsRelatedPropsSupplier\n isPropertySelectionEnabled={this.props.isPropertySelectionEnabled ?? false}\n isPropertySelectionOnRightClickEnabled={this.props.isPropertySelectionOnRightClickEnabled}\n isPropertyEditingEnabled={this.props.isPropertyEditingEnabled}\n isPropertyHoverEnabled={this.props.isPropertyHoverEnabled ?? false}\n onPropertyContextMenu={this.props.onPropertyContextMenu}\n onPropertyUpdated={this.props.onPropertyUpdated}\n onPropertySelectionChanged={this.props.onPropertySelectionChanged}\n >\n {(selectionContext) => (\n <div className={classnames(\"components-property-grid-wrapper\", this.props.className)} style={this.props.style}>\n <div className={classnames(\"components-property-grid\", \"components-smallEditor-host\")}>\n <div className=\"property-categories\">\n {\n this.state.categories.map((categorizedRecords: CategorizedPropertyGridRecords) => (\n <NestedCategoryBlock\n {...selectionContext}\n key={categorizedRecords.category.name}\n categorizedRecords={categorizedRecords}\n onCategoryExpansionToggled={this._onCategoryExpansionToggled}\n orientation={this.state.orientation}\n propertyValueRendererManager={this.props.propertyValueRendererManager}\n actionButtonRenderers={this.props.actionButtonRenderers}\n />\n ))\n }\n </div>\n </div>\n <ResizableContainerObserver onResize={this._onResize} />\n </div>\n )}\n </PropertyGridEventsRelatedPropsSupplier>\n );\n }\n}\n\nfunction findCategory(categories: CategorizedPropertyGridRecords[], lookupName: string, recurseIntoChildren: boolean): CategorizedPropertyGridRecords | undefined {\n for (const category of categories) {\n if (category.category.name === lookupName)\n return category;\n if (recurseIntoChildren) {\n const matchingChild = findCategory(category.children, lookupName, recurseIntoChildren);\n if (matchingChild)\n return matchingChild;\n }\n }\n return undefined;\n}\n\ninterface NestedCategoryBlockProps extends Omit<PropertyListProps, (keyof ColumnResizeRelatedPropertyListProps) | \"properties\"> {\n categorizedRecords: CategorizedPropertyGridRecords;\n onCategoryExpansionToggled: (categoryName: string) => void;\n orientation: Orientation;\n}\nfunction NestedCategoryBlock(props: NestedCategoryBlockProps) {\n return (\n <PropertyCategoryBlock\n category={props.categorizedRecords.category}\n onExpansionToggled={props.onCategoryExpansionToggled}\n >\n {props.categorizedRecords.records.length ? (\n <ColumnResizingPropertyListPropsSupplier orientation={props.orientation}>\n {(partialListProps: ColumnResizeRelatedPropertyListProps) => (\n <PropertyList\n {...partialListProps}\n orientation={props.orientation}\n category={props.categorizedRecords.category}\n properties={props.categorizedRecords.records}\n selectedPropertyKey={props.selectedPropertyKey}\n onPropertyClicked={props.onPropertyClicked}\n onPropertyRightClicked={props.onPropertyRightClicked}\n onPropertyContextMenu={props.onPropertyContextMenu}\n propertyValueRendererManager={props.propertyValueRendererManager}\n editingPropertyKey={props.editingPropertyKey}\n onEditCommit={props.onEditCommit}\n onEditCancel={props.onEditCancel}\n isPropertyHoverEnabled={props.isPropertyHoverEnabled}\n isPropertySelectionEnabled={props.isPropertySelectionEnabled}\n isPropertyRightClickSelectionEnabled={props.isPropertyRightClickSelectionEnabled}\n actionButtonRenderers={props.actionButtonRenderers}\n />\n )}\n </ColumnResizingPropertyListPropsSupplier>\n ) : undefined}\n {props.categorizedRecords.children.length ? (\n <div className=\"property-categories\">\n {\n props.categorizedRecords.children.map((categorizedChildRecords) => (\n <NestedCategoryBlock {...props} key={categorizedChildRecords.category.name} categorizedRecords={categorizedChildRecords} />\n ))\n }\n </div>\n ) : undefined}\n </PropertyCategoryBlock>\n );\n}\n"]}
|
|
@@ -43,22 +43,17 @@ export interface CommonPropertyGridProps extends CommonProps {
|
|
|
43
43
|
isPropertySelectionOnRightClickEnabled?: boolean;
|
|
44
44
|
/** Callback to property selection */
|
|
45
45
|
onPropertySelectionChanged?: (property: PropertyRecord) => void;
|
|
46
|
-
/** Enables/disables property editing
|
|
47
|
-
* @beta */
|
|
46
|
+
/** Enables/disables property editing */
|
|
48
47
|
isPropertyEditingEnabled?: boolean;
|
|
49
|
-
/** Callback for when properties are being edited
|
|
50
|
-
* @beta */
|
|
48
|
+
/** Callback for when properties are being edited */
|
|
51
49
|
onPropertyEditing?: (args: PropertyEditingArgs, category: PropertyCategory) => void;
|
|
52
|
-
/** Callback for when properties are updated
|
|
53
|
-
* @beta */
|
|
50
|
+
/** Callback for when properties are updated */
|
|
54
51
|
onPropertyUpdated?: (args: PropertyUpdatedArgs, category: PropertyCategory) => Promise<boolean>;
|
|
55
52
|
/** Custom property value renderer manager */
|
|
56
53
|
propertyValueRendererManager?: PropertyValueRendererManager;
|
|
57
|
-
/** Indicates whether the orientation is fixed and does not auto-switch to Vertical when the width is too narrow. Defaults to false.
|
|
58
|
-
* @beta */
|
|
54
|
+
/** Indicates whether the orientation is fixed and does not auto-switch to Vertical when the width is too narrow. Defaults to false. */
|
|
59
55
|
isOrientationFixed?: boolean;
|
|
60
|
-
/** The minimum width before the auto-switch to Vertical when the width is too narrow. Defaults to 300.
|
|
61
|
-
* @beta */
|
|
56
|
+
/** The minimum width before the auto-switch to Vertical when the width is too narrow. Defaults to 300. */
|
|
62
57
|
horizontalOrientationMinWidth?: number;
|
|
63
58
|
/** Minimum allowed label column width, after which resizing stops */
|
|
64
59
|
minLabelWidth?: number;
|