@itwin/grouping-mapping-widget 0.9.0 → 0.9.2

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.
Files changed (85) hide show
  1. package/lib/cjs/test/GroupPropertyUtils.test.js +61 -1
  2. package/lib/cjs/test/GroupPropertyUtils.test.js.map +1 -1
  3. package/lib/cjs/test/GroupingMappingCustomUI.test.js +44 -53
  4. package/lib/cjs/test/GroupingMappingCustomUI.test.js.map +1 -1
  5. package/lib/cjs/test/QueryBuilder.test.js +30 -2
  6. package/lib/cjs/test/QueryBuilder.test.js.map +1 -1
  7. package/lib/cjs/test/QueryBuilder.testdata.js +471 -7
  8. package/lib/cjs/test/QueryBuilder.testdata.js.map +1 -1
  9. package/lib/cjs/test/QueryBuilderTestData.d.ts +3 -1
  10. package/lib/cjs/test/QueryBuilderTestData.js.map +1 -1
  11. package/lib/cjs/widget/components/GroupAction.js +2 -21
  12. package/lib/cjs/widget/components/GroupAction.js.map +1 -1
  13. package/lib/cjs/widget/components/GroupPropertyUtils.js +2 -1
  14. package/lib/cjs/widget/components/GroupPropertyUtils.js.map +1 -1
  15. package/lib/cjs/widget/components/GroupQueryBuilderContainer.d.ts +3 -2
  16. package/lib/cjs/widget/components/GroupQueryBuilderContainer.js +38 -45
  17. package/lib/cjs/widget/components/GroupQueryBuilderContainer.js.map +1 -1
  18. package/lib/cjs/widget/components/Grouping.js +1 -1
  19. package/lib/cjs/widget/components/Grouping.js.map +1 -1
  20. package/lib/cjs/widget/components/Grouping.scss +1 -1
  21. package/lib/cjs/widget/components/QueryBuilder.d.ts +35 -21
  22. package/lib/cjs/widget/components/QueryBuilder.js +153 -181
  23. package/lib/cjs/widget/components/QueryBuilder.js.map +1 -1
  24. package/lib/cjs/widget/components/context/PropertyGridWrapperContext.d.ts +15 -0
  25. package/lib/cjs/widget/components/context/{GroupQueryBuilderContext.js → PropertyGridWrapperContext.js} +13 -9
  26. package/lib/cjs/widget/components/context/PropertyGridWrapperContext.js.map +1 -0
  27. package/lib/cjs/widget/components/property-grid/PropertyGrid.d.ts +1 -1
  28. package/lib/cjs/widget/components/property-grid/PropertyGrid.js +2 -2
  29. package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +1 -1
  30. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +10 -4
  31. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +18 -8
  32. package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
  33. package/lib/cjs/widget/components/property-grid/PropertyView.d.ts +1 -1
  34. package/lib/cjs/widget/components/property-grid/PropertyView.js +46 -60
  35. package/lib/cjs/widget/components/property-grid/PropertyView.js.map +1 -1
  36. package/lib/cjs/widget/components/viewerUtils.js +1 -3
  37. package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
  38. package/lib/esm/test/GroupPropertyUtils.test.js +61 -1
  39. package/lib/esm/test/GroupPropertyUtils.test.js.map +1 -1
  40. package/lib/esm/test/GroupingMappingCustomUI.test.js +45 -54
  41. package/lib/esm/test/GroupingMappingCustomUI.test.js.map +1 -1
  42. package/lib/esm/test/QueryBuilder.test.js +31 -3
  43. package/lib/esm/test/QueryBuilder.test.js.map +1 -1
  44. package/lib/esm/test/QueryBuilder.testdata.js +471 -7
  45. package/lib/esm/test/QueryBuilder.testdata.js.map +1 -1
  46. package/lib/esm/test/QueryBuilderTestData.d.ts +3 -1
  47. package/lib/esm/test/QueryBuilderTestData.js.map +1 -1
  48. package/lib/esm/widget/components/GroupAction.js +2 -21
  49. package/lib/esm/widget/components/GroupAction.js.map +1 -1
  50. package/lib/esm/widget/components/GroupPropertyUtils.js +2 -1
  51. package/lib/esm/widget/components/GroupPropertyUtils.js.map +1 -1
  52. package/lib/esm/widget/components/GroupQueryBuilderContainer.d.ts +3 -2
  53. package/lib/esm/widget/components/GroupQueryBuilderContainer.js +34 -25
  54. package/lib/esm/widget/components/GroupQueryBuilderContainer.js.map +1 -1
  55. package/lib/esm/widget/components/Grouping.js +1 -1
  56. package/lib/esm/widget/components/Grouping.js.map +1 -1
  57. package/lib/esm/widget/components/Grouping.scss +1 -1
  58. package/lib/esm/widget/components/QueryBuilder.d.ts +35 -21
  59. package/lib/esm/widget/components/QueryBuilder.js +153 -181
  60. package/lib/esm/widget/components/QueryBuilder.js.map +1 -1
  61. package/lib/esm/widget/components/context/PropertyGridWrapperContext.d.ts +15 -0
  62. package/lib/esm/widget/components/context/{GroupQueryBuilderContext.js → PropertyGridWrapperContext.js} +11 -8
  63. package/lib/esm/widget/components/context/PropertyGridWrapperContext.js.map +1 -0
  64. package/lib/esm/widget/components/property-grid/PropertyGrid.d.ts +1 -1
  65. package/lib/esm/widget/components/property-grid/PropertyGrid.js +2 -2
  66. package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +1 -1
  67. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +10 -4
  68. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +16 -6
  69. package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
  70. package/lib/esm/widget/components/property-grid/PropertyView.d.ts +1 -1
  71. package/lib/esm/widget/components/property-grid/PropertyView.js +32 -30
  72. package/lib/esm/widget/components/property-grid/PropertyView.js.map +1 -1
  73. package/lib/esm/widget/components/viewerUtils.js +1 -3
  74. package/lib/esm/widget/components/viewerUtils.js.map +1 -1
  75. package/package.json +2 -2
  76. package/lib/cjs/api/GroupQueryBuilderApi.d.ts +0 -15
  77. package/lib/cjs/api/GroupQueryBuilderApi.js +0 -27
  78. package/lib/cjs/api/GroupQueryBuilderApi.js.map +0 -1
  79. package/lib/cjs/widget/components/context/GroupQueryBuilderContext.d.ts +0 -16
  80. package/lib/cjs/widget/components/context/GroupQueryBuilderContext.js.map +0 -1
  81. package/lib/esm/api/GroupQueryBuilderApi.d.ts +0 -15
  82. package/lib/esm/api/GroupQueryBuilderApi.js +0 -23
  83. package/lib/esm/api/GroupQueryBuilderApi.js.map +0 -1
  84. package/lib/esm/widget/components/context/GroupQueryBuilderContext.d.ts +0 -16
  85. package/lib/esm/widget/components/context/GroupQueryBuilderContext.js.map +0 -1
@@ -46,7 +46,7 @@ export declare class PropertyGrid extends React.Component<PropertyGridProps, Pro
46
46
  private _isMounted;
47
47
  private _isInDataRequest;
48
48
  private _hasPendingDataRequest;
49
- static contextType: React.Context<import("../context/GroupQueryBuilderContext").PropertySelection>;
49
+ static contextType: React.Context<import("../context/PropertyGridWrapperContext").PropertySelection>;
50
50
  /** @internal */
51
51
  constructor(props: PropertyGridProps);
52
52
  /** @internal */
@@ -35,7 +35,7 @@ const ColumnResizingPropertyListPropsSupplier_1 = require("@itwin/components-rea
35
35
  const core_react_1 = require("@itwin/core-react");
36
36
  const PropertyList_1 = require("./PropertyList");
37
37
  require("./PropertyGrid.scss");
38
- const GroupQueryBuilderContext_1 = require("../context/GroupQueryBuilderContext");
38
+ const PropertyGridWrapperContext_1 = require("../context/PropertyGridWrapperContext");
39
39
  const itwinui_react_1 = require("@itwin/itwinui-react");
40
40
  /** PropertyGrid React component.
41
41
  * @public
@@ -174,7 +174,7 @@ class PropertyGrid extends React.Component {
174
174
  }
175
175
  }
176
176
  exports.PropertyGrid = PropertyGrid;
177
- PropertyGrid.contextType = GroupQueryBuilderContext_1.GroupQueryBuilderContext;
177
+ PropertyGrid.contextType = PropertyGridWrapperContext_1.PropertyGridWrapperContext;
178
178
  function findCategory(categories, lookupName, recurseIntoChildren) {
179
179
  for (const category of categories) {
180
180
  if (category.category.name === lookupName) {
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyGrid.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyGrid.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,4DAAoC;AACpC,iCAAgC;AAChC,6CAA+B;AAQ/B,8DAIiC;AAEjC,6KAA0K;AAC1K,kDAA4E;AAG5E,iDAA8C;AAC9C,+BAA6B;AAG7B,kFAA+E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,EAChC,sBAAsB,EAAE,KAAK,CAAC,sBAAsB,EACpD,0BAA0B,EAAE,KAAK,CAAC,0BAA0B,EAC5D,oCAAoC,EAClC,KAAK,CAAC,oCAAoC,EAE5C,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,EAClD,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,GACZ,CACH,CACuC,CAC3C,CAAC,CAAC,CAAC,SAAS;QACZ,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAC1C,6BAAK,SAAS,EAAC,yBAAyB,IACrC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAClE,oBAAC,mBAAmB,OACd,KAAK,EACT,GAAG,EAAE,uBAAuB,CAAC,QAAQ,CAAC,IAAI,EAC1C,kBAAkB,EAAE,uBAAuB,GAC3C,CACH,CAAC,CACE,CACP,CAAC,CAAC,CAAC,SAAS,CACS,CACzB,CAAC;AACJ,CAAC,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 classnames from \"classnames\";\nimport { produce } from \"immer\";\nimport * as React from \"react\";\nimport type { DisposeFunc } from \"@itwin/core-bentley\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type {\n CommonPropertyGridProps,\n PropertyCategory,\n PropertyData,\n} from \"@itwin/components-react\";\nimport {\n PropertyCategoryBlock,\n PropertyGridCommons,\n PropertyGridEventsRelatedPropsSupplier,\n} from \"@itwin/components-react\";\nimport type { ColumnResizeRelatedPropertyListProps } from \"@itwin/components-react/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier\";\nimport { ColumnResizingPropertyListPropsSupplier } from \"@itwin/components-react/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier\";\nimport { Orientation, ResizableContainerObserver } from \"@itwin/core-react\";\n\nimport type { PropertyListProps } from \"./PropertyList\";\nimport { PropertyList } from \"./PropertyList\";\nimport \"./PropertyGrid.scss\";\n\nimport type { PresentationPropertyDataProvider } from \"@itwin/presentation-components\";\nimport { GroupQueryBuilderContext } from \"../context/GroupQueryBuilderContext\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\n\n/** Properties for [[PropertyGrid]] React component\n * @public\n */\nexport interface PropertyGridProps extends CommonPropertyGridProps {\n /** Property data provider */\n dataProvider: PresentationPropertyDataProvider;\n}\n\n/** Property Category in the [[PropertyGrid]] state\n * @public\n * @deprecated This was part of [[PropertyGrid]] internal state and should've never been public. The component is not using it anymore.\n */\nexport interface PropertyGridCategory {\n propertyCategory: PropertyCategory;\n propertyCount: number;\n properties: PropertyRecord[];\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<\nPropertyGridProps,\nPropertyGridState\n> {\n private _dataChangesListenerDisposeFunc?: DisposeFunc;\n private _isMounted = false;\n private _isInDataRequest = false;\n private _hasPendingDataRequest = false;\n\n static override contextType = GroupQueryBuilderContext;\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 =\n this.props.dataProvider.onDataChanged.addListener(\n this._onPropertyDataChanged\n );\n\n void 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 }\n this._dataChangesListenerDisposeFunc =\n this.props.dataProvider.onDataChanged.addListener(\n this._onPropertyDataChanged\n );\n\n void this.gatherData();\n }\n\n if (\n this.props.orientation !== prevProps.orientation ||\n this.props.isOrientationFixed !== prevProps.isOrientationFixed ||\n this.props.horizontalOrientationMinWidth !==\n prevProps.horizontalOrientationMinWidth\n ) {\n this.updateOrientation(this.state.width);\n }\n }\n\n private _onPropertyDataChanged = () => {\n void 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) =>\n prev.loadStart ? null : { loadStart: new Date() }\n );\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\n if (this._hasPendingDataRequest) {\n this._hasPendingDataRequest = false;\n return this.gatherData();\n }\n\n this.setState((prevState) => {\n const buildCategoriesHierarchy = (\n newCategories: PropertyCategory[],\n stateCategories: CategorizedPropertyGridRecords[] | undefined\n ) =>\n newCategories.map((category): CategorizedPropertyGridRecords => {\n const matchingStateCategory = findCategory(\n stateCategories ?? [],\n category.name,\n false\n );\n return {\n category: {\n ...category,\n expand:\n matchingStateCategory?.category?.expand ?? category.expand,\n },\n records: propertyData.records[category.name] ?? [],\n children: buildCategoriesHierarchy(\n category.childCategories ?? [],\n matchingStateCategory?.children\n ),\n };\n });\n return {\n categories: buildCategoriesHierarchy(\n propertyData.categories,\n prevState.categories\n ),\n loadStart: undefined,\n };\n });\n }\n\n private getPreferredOrientation(): Orientation {\n return this.props.orientation !== undefined\n ? this.props.orientation\n : 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 } = {\n ...this.props,\n };\n const currentOrientation = PropertyGridCommons.getCurrentOrientation(\n width,\n orientation,\n isOrientationFixed,\n horizontalOrientationMinWidth\n );\n\n if (\n currentOrientation !== this.state.orientation ||\n width !== this.state.width\n ) {\n this.setState({ orientation: currentOrientation, width });\n }\n }\n\n /** @internal */\n public override render() {\n if (this.state.loadStart) {\n return (\n <div className=\"gmw-components-property-grid-loader\">\n <ProgressRadial indeterminate />\n </div>\n );\n }\n\n return (\n <div className=\"gmw-table-box-inner\">\n <PropertyGridEventsRelatedPropsSupplier\n isPropertySelectionEnabled={\n this.props.isPropertySelectionEnabled ?? false\n }\n isPropertySelectionOnRightClickEnabled={\n this.props.isPropertySelectionOnRightClickEnabled\n }\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\n className={classnames(\n \"gmw-components-property-grid-wrapper\",\n this.props.className\n )}\n style={this.props.style}\n >\n <div\n className={classnames(\n \"gmw-components-property-grid\",\n \"components-smallEditor-host\"\n )}\n >\n <div className= \"gmw-property-categories\">\n {this.state.categories.map(\n (categorizedRecords: CategorizedPropertyGridRecords) => (\n <NestedCategoryBlock\n {...selectionContext}\n key={categorizedRecords.category.name}\n categorizedRecords={categorizedRecords}\n onCategoryExpansionToggled={\n this._onCategoryExpansionToggled\n }\n orientation={this.state.orientation}\n propertyValueRendererManager={\n this.props.propertyValueRendererManager\n }\n actionButtonRenderers={this.props.actionButtonRenderers}\n />\n )\n )}\n </div>\n </div>\n <ResizableContainerObserver onResize={this._onResize} />\n </div>\n )}\n </PropertyGridEventsRelatedPropsSupplier>\n </div>\n );\n }\n}\n\nfunction findCategory(\n categories: CategorizedPropertyGridRecords[],\n lookupName: string,\n recurseIntoChildren: boolean\n): CategorizedPropertyGridRecords | undefined {\n for (const category of categories) {\n if (category.category.name === lookupName) {\n return category;\n }\n if (recurseIntoChildren) {\n const matchingChild = findCategory(\n category.children,\n lookupName,\n recurseIntoChildren\n );\n if (matchingChild) {\n return matchingChild;\n }\n }\n }\n return undefined;\n}\n\ninterface NestedCategoryBlockProps\n extends Omit<\n PropertyListProps,\n keyof ColumnResizeRelatedPropertyListProps | \"properties\"\n > {\n categorizedRecords: CategorizedPropertyGridRecords;\n onCategoryExpansionToggled: (categoryName: string) => void;\n orientation: Orientation;\n}\nconst NestedCategoryBlock = (props: NestedCategoryBlockProps) => {\n const [width, setWidth] = React.useState(1);\n return (\n <PropertyCategoryBlock\n category={props.categorizedRecords.category}\n onExpansionToggled={props.onCategoryExpansionToggled}\n >\n {props.categorizedRecords.records.length ? (\n <ColumnResizingPropertyListPropsSupplier\n orientation={props.orientation}\n width={width}\n >\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={\n props.isPropertyRightClickSelectionEnabled\n }\n actionButtonRenderers={props.actionButtonRenderers}\n setWidth={setWidth}\n width={width}\n />\n )}\n </ColumnResizingPropertyListPropsSupplier>\n ) : undefined}\n {props.categorizedRecords.children.length ? (\n <div className=\"gmw-property-categories\">\n {props.categorizedRecords.children.map((categorizedChildRecords) => (\n <NestedCategoryBlock\n {...props}\n key={categorizedChildRecords.category.name}\n categorizedRecords={categorizedChildRecords}\n />\n ))}\n </div>\n ) : undefined}\n </PropertyCategoryBlock>\n );\n};\n"]}
1
+ {"version":3,"file":"PropertyGrid.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyGrid.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,4DAAoC;AACpC,iCAAgC;AAChC,6CAA+B;AAQ/B,8DAIiC;AAEjC,6KAA0K;AAC1K,kDAA4E;AAG5E,iDAA8C;AAC9C,+BAA6B;AAG7B,sFAAmF;AACnF,wDAAsD;AAwCtD;;GAEG;AACH,MAAa,YAAa,SAAQ,KAAK,CAAC,SAGvC;IAQC,gBAAgB;IAChB,YAAY,KAAwB;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QARP,eAAU,GAAG,KAAK,CAAC;QACnB,qBAAgB,GAAG,KAAK,CAAC;QACzB,2BAAsB,GAAG,KAAK,CAAC;QA2D/B,2BAAsB,GAAG,GAAG,EAAE;YACpC,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;QACzB,CAAC,CAAC;QAqEM,cAAS,GAAG,CAAC,KAAa,EAAE,EAAE;YACpC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC,CAAC;QAEM,gCAA2B,GAAG,CAAC,YAAoB,EAAE,EAAE;YAC7D,IAAI,CAAC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uBAAuB,CAAC,QAAQ,CAAC,IAAI,EAC1C,kBAAkB,EAAE,uBAAuB,GAC3C,CACH,CAAC,CACE,CACP,CAAC,CAAC,CAAC,SAAS,CACS,CACzB,CAAC;AACJ,CAAC,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 classnames from \"classnames\";\nimport { produce } from \"immer\";\nimport * as React from \"react\";\nimport type { DisposeFunc } from \"@itwin/core-bentley\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type {\n CommonPropertyGridProps,\n PropertyCategory,\n PropertyData,\n} from \"@itwin/components-react\";\nimport {\n PropertyCategoryBlock,\n PropertyGridCommons,\n PropertyGridEventsRelatedPropsSupplier,\n} from \"@itwin/components-react\";\nimport type { ColumnResizeRelatedPropertyListProps } from \"@itwin/components-react/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier\";\nimport { ColumnResizingPropertyListPropsSupplier } from \"@itwin/components-react/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier\";\nimport { Orientation, ResizableContainerObserver } from \"@itwin/core-react\";\n\nimport type { PropertyListProps } from \"./PropertyList\";\nimport { PropertyList } from \"./PropertyList\";\nimport \"./PropertyGrid.scss\";\n\nimport type { PresentationPropertyDataProvider } from \"@itwin/presentation-components\";\nimport { PropertyGridWrapperContext } from \"../context/PropertyGridWrapperContext\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\n\n/** Properties for [[PropertyGrid]] React component\n * @public\n */\nexport interface PropertyGridProps extends CommonPropertyGridProps {\n /** Property data provider */\n dataProvider: PresentationPropertyDataProvider;\n}\n\n/** Property Category in the [[PropertyGrid]] state\n * @public\n * @deprecated This was part of [[PropertyGrid]] internal state and should've never been public. The component is not using it anymore.\n */\nexport interface PropertyGridCategory {\n propertyCategory: PropertyCategory;\n propertyCount: number;\n properties: PropertyRecord[];\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<\nPropertyGridProps,\nPropertyGridState\n> {\n private _dataChangesListenerDisposeFunc?: DisposeFunc;\n private _isMounted = false;\n private _isInDataRequest = false;\n private _hasPendingDataRequest = false;\n\n static override contextType = PropertyGridWrapperContext;\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 =\n this.props.dataProvider.onDataChanged.addListener(\n this._onPropertyDataChanged\n );\n\n void 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 }\n this._dataChangesListenerDisposeFunc =\n this.props.dataProvider.onDataChanged.addListener(\n this._onPropertyDataChanged\n );\n\n void this.gatherData();\n }\n\n if (\n this.props.orientation !== prevProps.orientation ||\n this.props.isOrientationFixed !== prevProps.isOrientationFixed ||\n this.props.horizontalOrientationMinWidth !==\n prevProps.horizontalOrientationMinWidth\n ) {\n this.updateOrientation(this.state.width);\n }\n }\n\n private _onPropertyDataChanged = () => {\n void 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) =>\n prev.loadStart ? null : { loadStart: new Date() }\n );\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\n if (this._hasPendingDataRequest) {\n this._hasPendingDataRequest = false;\n return this.gatherData();\n }\n\n this.setState((prevState) => {\n const buildCategoriesHierarchy = (\n newCategories: PropertyCategory[],\n stateCategories: CategorizedPropertyGridRecords[] | undefined\n ) =>\n newCategories.map((category): CategorizedPropertyGridRecords => {\n const matchingStateCategory = findCategory(\n stateCategories ?? [],\n category.name,\n false\n );\n return {\n category: {\n ...category,\n expand:\n matchingStateCategory?.category?.expand ?? category.expand,\n },\n records: propertyData.records[category.name] ?? [],\n children: buildCategoriesHierarchy(\n category.childCategories ?? [],\n matchingStateCategory?.children\n ),\n };\n });\n return {\n categories: buildCategoriesHierarchy(\n propertyData.categories,\n prevState.categories\n ),\n loadStart: undefined,\n };\n });\n }\n\n private getPreferredOrientation(): Orientation {\n return this.props.orientation !== undefined\n ? this.props.orientation\n : 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 } = {\n ...this.props,\n };\n const currentOrientation = PropertyGridCommons.getCurrentOrientation(\n width,\n orientation,\n isOrientationFixed,\n horizontalOrientationMinWidth\n );\n\n if (\n currentOrientation !== this.state.orientation ||\n width !== this.state.width\n ) {\n this.setState({ orientation: currentOrientation, width });\n }\n }\n\n /** @internal */\n public override render() {\n if (this.state.loadStart) {\n return (\n <div className=\"gmw-components-property-grid-loader\">\n <ProgressRadial indeterminate />\n </div>\n );\n }\n\n return (\n <div className=\"gmw-table-box-inner\">\n <PropertyGridEventsRelatedPropsSupplier\n isPropertySelectionEnabled={\n this.props.isPropertySelectionEnabled ?? false\n }\n isPropertySelectionOnRightClickEnabled={\n this.props.isPropertySelectionOnRightClickEnabled\n }\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\n className={classnames(\n \"gmw-components-property-grid-wrapper\",\n this.props.className\n )}\n style={this.props.style}\n >\n <div\n className={classnames(\n \"gmw-components-property-grid\",\n \"components-smallEditor-host\"\n )}\n >\n <div className=\"gmw-property-categories\">\n {this.state.categories.map(\n (categorizedRecords: CategorizedPropertyGridRecords) => (\n <NestedCategoryBlock\n {...selectionContext}\n key={categorizedRecords.category.name}\n categorizedRecords={categorizedRecords}\n onCategoryExpansionToggled={\n this._onCategoryExpansionToggled\n }\n orientation={this.state.orientation}\n propertyValueRendererManager={\n this.props.propertyValueRendererManager\n }\n actionButtonRenderers={this.props.actionButtonRenderers}\n />\n )\n )}\n </div>\n </div>\n <ResizableContainerObserver onResize={this._onResize} />\n </div>\n )}\n </PropertyGridEventsRelatedPropsSupplier>\n </div>\n );\n }\n}\n\nfunction findCategory(\n categories: CategorizedPropertyGridRecords[],\n lookupName: string,\n recurseIntoChildren: boolean\n): CategorizedPropertyGridRecords | undefined {\n for (const category of categories) {\n if (category.category.name === lookupName) {\n return category;\n }\n if (recurseIntoChildren) {\n const matchingChild = findCategory(\n category.children,\n lookupName,\n recurseIntoChildren\n );\n if (matchingChild) {\n return matchingChild;\n }\n }\n }\n return undefined;\n}\n\ninterface NestedCategoryBlockProps\n extends Omit<\n PropertyListProps,\n keyof ColumnResizeRelatedPropertyListProps | \"properties\"\n > {\n categorizedRecords: CategorizedPropertyGridRecords;\n onCategoryExpansionToggled: (categoryName: string) => void;\n orientation: Orientation;\n}\nconst NestedCategoryBlock = (props: NestedCategoryBlockProps) => {\n const [width, setWidth] = React.useState(1);\n return (\n <PropertyCategoryBlock\n category={props.categorizedRecords.category}\n onExpansionToggled={props.onCategoryExpansionToggled}\n >\n {props.categorizedRecords.records.length ? (\n <ColumnResizingPropertyListPropsSupplier\n orientation={props.orientation}\n width={width}\n >\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={\n props.isPropertyRightClickSelectionEnabled\n }\n actionButtonRenderers={props.actionButtonRenderers}\n setWidth={setWidth}\n width={width}\n />\n )}\n </ColumnResizingPropertyListPropsSupplier>\n ) : undefined}\n {props.categorizedRecords.children.length ? (\n <div className=\"gmw-property-categories\">\n {props.categorizedRecords.children.map((categorizedChildRecords) => (\n <NestedCategoryBlock\n {...props}\n key={categorizedChildRecords.category.name}\n categorizedRecords={categorizedChildRecords}\n />\n ))}\n </div>\n ) : undefined}\n </PropertyCategoryBlock>\n );\n};\n"]}
@@ -1,13 +1,19 @@
1
1
  import * as React from "react";
2
- import type { PresentationPropertyDataProvider } from "@itwin/presentation-components";
3
- import type { PropertyProps } from "../../../api/GroupQueryBuilderApi";
2
+ import { PresentationPropertyDataProvider } from "@itwin/presentation-components";
4
3
  import "../GroupQueryBuilder.scss";
4
+ import type { KeySet } from "@itwin/presentation-common";
5
+ import type { IModelConnection } from "@itwin/core-frontend";
5
6
  interface PropertyGridWrapperState {
6
7
  dataProvider?: PresentationPropertyDataProvider;
7
8
  }
8
- export declare class PropertyGridWrapperApp extends React.Component<PropertyProps, PropertyGridWrapperState> {
9
- static contextType: React.Context<import("../context/GroupQueryBuilderContext").PropertySelection>;
9
+ interface PropertyProps {
10
+ keys: KeySet;
11
+ imodel?: IModelConnection;
12
+ }
13
+ export declare class PropertyGridWrapper extends React.Component<PropertyProps, PropertyGridWrapperState> {
14
+ static contextType: React.Context<import("../context/PropertyGridWrapperContext").PropertySelection>;
10
15
  constructor(props: PropertyProps | Readonly<PropertyProps>);
16
+ private createPropertyDataProvider;
11
17
  private createDataProvider;
12
18
  componentDidMount(): void;
13
19
  componentDidUpdate(prevProps: PropertyProps): void;
@@ -19,21 +19,31 @@ var __importStar = (this && this.__importStar) || function (mod) {
19
19
  return result;
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.PropertyGridWrapperApp = void 0;
22
+ exports.PropertyGridWrapper = void 0;
23
23
  /*---------------------------------------------------------------------------------------------
24
24
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
25
  * See LICENSE.md in the project root for license terms and full copyright notice.
26
26
  *--------------------------------------------------------------------------------------------*/
27
27
  const React = __importStar(require("react"));
28
- const GroupQueryBuilderApi_1 = require("../../../api/GroupQueryBuilderApi");
28
+ const presentation_components_1 = require("@itwin/presentation-components");
29
29
  const PropertyGrid_1 = require("./PropertyGrid");
30
30
  require("../GroupQueryBuilder.scss");
31
- const GroupQueryBuilderContext_1 = require("../context/GroupQueryBuilderContext");
31
+ const PropertyGridWrapperContext_1 = require("../context/PropertyGridWrapperContext");
32
+ const QueryBuilder_1 = require("../QueryBuilder");
32
33
  /* This approach uses PresentationPropertyDataProvider to all the work of querying the backend and
33
34
  providing the content to the PropertyGrid component. */
34
- class PropertyGridWrapperApp extends React.Component {
35
+ class PropertyGridWrapper extends React.Component {
35
36
  constructor(props) {
36
37
  super(props);
38
+ this.createPropertyDataProvider = (keys, imodel) => {
39
+ const dataProvider = new presentation_components_1.PresentationPropertyDataProvider({
40
+ imodel,
41
+ ruleset: presentation_components_1.DEFAULT_PROPERTY_GRID_RULESET,
42
+ });
43
+ dataProvider.keys = keys;
44
+ dataProvider.isNestedPropertyCategoryGroupingEnabled = true;
45
+ return dataProvider;
46
+ };
37
47
  this.state = {};
38
48
  }
39
49
  createDataProvider() {
@@ -41,8 +51,8 @@ class PropertyGridWrapperApp extends React.Component {
41
51
  this.setState({ dataProvider: undefined });
42
52
  return;
43
53
  }
44
- const dataProvider = GroupQueryBuilderApi_1.GroupQueryBuilderApi.createPropertyDataProvider(this.props.keys, this.props.imodel);
45
- this.context.queryBuilder.dataProvider = dataProvider;
54
+ const dataProvider = this.createPropertyDataProvider(this.props.keys, this.props.imodel);
55
+ this.context.setQueryBuilder(new QueryBuilder_1.QueryBuilder(dataProvider));
46
56
  this.setState({ dataProvider });
47
57
  }
48
58
  componentDidMount() {
@@ -62,6 +72,6 @@ class PropertyGridWrapperApp extends React.Component {
62
72
  React.createElement("span", null, "Select an element to see its properties.")))));
63
73
  }
64
74
  }
65
- exports.PropertyGridWrapperApp = PropertyGridWrapperApp;
66
- PropertyGridWrapperApp.contextType = GroupQueryBuilderContext_1.GroupQueryBuilderContext;
75
+ exports.PropertyGridWrapper = PropertyGridWrapper;
76
+ PropertyGridWrapper.contextType = PropertyGridWrapperContext_1.PropertyGridWrapperContext;
67
77
  //# sourceMappingURL=PropertyGridWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyGridWrapper.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyGridWrapper.tsx"],"names":[],"mappings":";;;;;;;;;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,CACJ,CAAC;IACJ,CAAC;;AAjDH,wDAkDC;AA9CiB,kCAAW,GAAG,mDAAwB,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 * as React from \"react\";\nimport type { PresentationPropertyDataProvider } from \"@itwin/presentation-components\";\n\nimport type { PropertyProps } from \"../../../api/GroupQueryBuilderApi\";\nimport { GroupQueryBuilderApi } from \"../../../api/GroupQueryBuilderApi\";\nimport { PropertyGrid } from \"./PropertyGrid\";\nimport \"../GroupQueryBuilder.scss\";\nimport { GroupQueryBuilderContext } from \"../context/GroupQueryBuilderContext\";\n\ninterface PropertyGridWrapperState {\n dataProvider?: PresentationPropertyDataProvider;\n}\n\n/* This approach uses PresentationPropertyDataProvider to all the work of querying the backend and\n providing the content to the PropertyGrid component. */\nexport class PropertyGridWrapperApp extends React.Component<\nPropertyProps,\nPropertyGridWrapperState\n> {\n static override contextType = GroupQueryBuilderContext;\n constructor(props: PropertyProps | Readonly<PropertyProps>) {\n super(props);\n this.state = {};\n }\n\n private createDataProvider() {\n if (!this.props.imodel || this.props.keys.isEmpty) {\n this.setState({ dataProvider: undefined });\n return;\n }\n\n const dataProvider = GroupQueryBuilderApi.createPropertyDataProvider(\n this.props.keys,\n this.props.imodel\n );\n this.context.queryBuilder.dataProvider = dataProvider;\n\n this.setState({ dataProvider });\n }\n\n public override componentDidMount() {\n this.createDataProvider();\n }\n\n public override componentDidUpdate(prevProps: PropertyProps) {\n if (prevProps.keys === this.props.keys) {\n return;\n }\n\n this.createDataProvider();\n }\n\n public override render() {\n const dataProvider = this.state.dataProvider;\n return (\n <>\n {dataProvider && <PropertyGrid dataProvider={dataProvider} />}\n {!dataProvider && (\n <div className=\"gmw-select-element-hint\">\n <span>Select an element to see its properties.</span>\n </div>\n )}\n </>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"PropertyGrid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;IAEe,kBAAkB,CAAC,SAAwB;QACzD,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;YACtC,OAAO;SACR;QAED,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;IAEe,MAAM;QACpB,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;QAC7C,OAAO,CACL;YACG,YAAY,IAAI,oBAAC,2BAAY,IAAC,YAAY,EAAE,YAAY,GAAI;YAC5D,CAAC,YAAY,IAAI,CAChB,6BAAK,SAAS,EAAC,yBAAyB;gBACtC,6EAAqD,CACjD,CACP,CACA,CACJ,CAAC;IACJ,CAAC;;AA3DH,kDA4DC;AAxDiB,+BAAW,GAAG,uDAA0B,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 * as React from \"react\";\nimport { DEFAULT_PROPERTY_GRID_RULESET, PresentationPropertyDataProvider } from \"@itwin/presentation-components\";\nimport { PropertyGrid } from \"./PropertyGrid\";\nimport \"../GroupQueryBuilder.scss\";\nimport { PropertyGridWrapperContext } from \"../context/PropertyGridWrapperContext\";\nimport { QueryBuilder } from \"../QueryBuilder\";\nimport type { KeySet } from \"@itwin/presentation-common\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\n\ninterface PropertyGridWrapperState {\n dataProvider?: PresentationPropertyDataProvider;\n}\n\ninterface PropertyProps {\n keys: KeySet;\n imodel?: IModelConnection;\n}\n\n/* This approach uses PresentationPropertyDataProvider to all the work of querying the backend and\n providing the content to the PropertyGrid component. */\nexport class PropertyGridWrapper extends React.Component<\nPropertyProps,\nPropertyGridWrapperState\n> {\n static override contextType = PropertyGridWrapperContext;\n constructor(props: PropertyProps | Readonly<PropertyProps>) {\n super(props);\n this.state = {};\n }\n\n private createPropertyDataProvider = (keys: KeySet, imodel: IModelConnection): PresentationPropertyDataProvider => {\n const dataProvider = new PresentationPropertyDataProvider({\n imodel,\n ruleset: DEFAULT_PROPERTY_GRID_RULESET,\n });\n dataProvider.keys = keys;\n dataProvider.isNestedPropertyCategoryGroupingEnabled = true;\n return dataProvider;\n }\n\n private createDataProvider() {\n if (!this.props.imodel || this.props.keys.isEmpty) {\n this.setState({ dataProvider: undefined });\n return;\n }\n\n const dataProvider = this.createPropertyDataProvider(\n this.props.keys,\n this.props.imodel\n );\n this.context.setQueryBuilder(new QueryBuilder(dataProvider));\n\n this.setState({ dataProvider });\n }\n\n public override componentDidMount() {\n this.createDataProvider();\n }\n\n public override componentDidUpdate(prevProps: PropertyProps) {\n if (prevProps.keys === this.props.keys) {\n return;\n }\n\n this.createDataProvider();\n }\n\n public override render() {\n const dataProvider = this.state.dataProvider;\n return (\n <>\n {dataProvider && <PropertyGrid dataProvider={dataProvider} />}\n {!dataProvider && (\n <div className=\"gmw-select-element-hint\">\n <span>Select an element to see its properties.</span>\n </div>\n )}\n </>\n );\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import React from "react";
2
2
  import "./PropertyView.scss";
3
3
  import type { SharedRendererProps } from "./PropertyRender";
4
4
  /** Properties of [[PropertyView]] React component
@@ -1,22 +1,6 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
20
4
  };
21
5
  Object.defineProperty(exports, "__esModule", { value: true });
22
6
  exports.PropertyView = void 0;
@@ -24,26 +8,27 @@ exports.PropertyView = void 0;
24
8
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
25
9
  * See LICENSE.md in the project root for license terms and full copyright notice.
26
10
  *--------------------------------------------------------------------------------------------*/
27
- const React = __importStar(require("react"));
11
+ const react_1 = __importDefault(require("react"));
12
+ const react_2 = require("react");
28
13
  const appui_abstract_1 = require("@itwin/appui-abstract");
29
14
  const core_react_1 = require("@itwin/core-react");
30
15
  const components_react_1 = require("@itwin/components-react");
31
16
  require("./PropertyView.scss");
32
- const GroupQueryBuilderContext_1 = require("../context/GroupQueryBuilderContext");
33
- const react_1 = require("react");
17
+ const react_3 = require("react");
34
18
  const PropertyGridColumns_1 = require("@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns");
35
19
  const itwinui_react_1 = require("@itwin/itwinui-react");
36
20
  const CommonPropertyRenderer_1 = require("@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer");
21
+ const PropertyGridWrapperContext_1 = require("../context/PropertyGridWrapperContext");
37
22
  /**
38
23
  * A React component that renders property as label/value pair
39
24
  * @public
40
25
  */
41
26
  const PropertyView = (props) => {
42
27
  var _a;
43
- const context = React.useContext(GroupQueryBuilderContext_1.GroupQueryBuilderContext);
44
- const [isCheckboxLoading, setIsCheckboxLoading] = React.useState(false);
28
+ const [isCheckboxLoading, setIsCheckboxLoading] = react_2.useState(false);
29
+ const { currentPropertyList, queryBuilder, setCurrentPropertyList, setQuery, isUpdating, } = PropertyGridWrapperContext_1.usePropertyGridWrapper();
45
30
  const _validatePropertySelection = () => {
46
- if (context.currentPropertyList.includes(props.propertyRecord)) {
31
+ if (currentPropertyList.includes(props.propertyRecord)) {
47
32
  return true;
48
33
  }
49
34
  // Check if all subproperties are selected
@@ -55,13 +40,13 @@ const PropertyView = (props) => {
55
40
  const _validateNestedPropertiesSelection = (prop) => {
56
41
  switch (prop.value.valueFormat) {
57
42
  case appui_abstract_1.PropertyValueFormat.Primitive:
58
- if (!context.currentPropertyList.includes(prop)) {
43
+ if (!currentPropertyList.includes(prop)) {
59
44
  return false;
60
45
  }
61
46
  break;
62
47
  case appui_abstract_1.PropertyValueFormat.Array:
63
48
  if (prop.value.items.length === 0) {
64
- if (!context.currentPropertyList.includes(prop)) {
49
+ if (!currentPropertyList.includes(prop)) {
65
50
  return false;
66
51
  }
67
52
  }
@@ -77,22 +62,23 @@ const PropertyView = (props) => {
77
62
  }
78
63
  return true;
79
64
  };
80
- const [isHovered, setIsHovered] = React.useState(false);
81
- const [isPropertySelected, setIsPropertySelected] = React.useState(_validatePropertySelection());
82
- const _addSelectedProperty = react_1.useCallback(async (prop) => {
65
+ const [isHovered, setIsHovered] = react_2.useState(false);
66
+ const [isPropertySelected, setIsPropertySelected] = react_2.useState(_validatePropertySelection());
67
+ const _addSelectedProperty = react_3.useCallback(async (prop) => {
68
+ var _a;
83
69
  // TODO: roof selected item/category value is an object but format is primitive(needs further exploration)
84
- if (!context.currentPropertyList.includes(prop) &&
70
+ if (!currentPropertyList.includes(prop) &&
85
71
  prop.value.valueFormat === appui_abstract_1.PropertyValueFormat.Primitive) {
86
- if (!(await context.queryBuilder.addProperty(prop))) {
72
+ if (!(await (queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.addProperty(prop)))) {
87
73
  setIsCheckboxLoading(false);
88
74
  setIsPropertySelected(false);
89
75
  return;
90
76
  }
91
- context.setCurrentPropertyList(context.currentPropertyList.concat(prop));
92
- context.setQuery(context.queryBuilder.buildQueryString());
77
+ setCurrentPropertyList(currentPropertyList.concat(prop));
78
+ setQuery((_a = queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.buildQueryString()) !== null && _a !== void 0 ? _a : "");
93
79
  }
94
- }, [context]);
95
- const _addNestedProperties = react_1.useCallback((prop) => {
80
+ }, [currentPropertyList, queryBuilder, setCurrentPropertyList, setQuery]);
81
+ const _addNestedProperties = react_3.useCallback((prop) => {
96
82
  switch (prop.value.valueFormat) {
97
83
  case appui_abstract_1.PropertyValueFormat.Primitive:
98
84
  void _addSelectedProperty(prop);
@@ -110,14 +96,15 @@ const PropertyView = (props) => {
110
96
  }
111
97
  }
112
98
  }, [_addSelectedProperty]);
113
- const _removeSelectedProperty = react_1.useCallback(async (prop) => {
114
- if (context.currentPropertyList.includes(prop)) {
115
- context.setCurrentPropertyList(context.currentPropertyList.filter((x) => x !== prop));
116
- await context.queryBuilder.removeProperty(prop);
117
- context.setQuery(context.queryBuilder.buildQueryString());
118
- }
119
- }, [context]);
120
- const _removeNestedProperties = react_1.useCallback((prop) => {
99
+ const _removeSelectedProperty = react_3.useCallback(async (prop) => {
100
+ var _a;
101
+ if (currentPropertyList.includes(prop)) {
102
+ setCurrentPropertyList(currentPropertyList.filter((x) => x !== prop));
103
+ await (queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.removeProperty(prop));
104
+ setQuery((_a = queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.buildQueryString()) !== null && _a !== void 0 ? _a : "");
105
+ }
106
+ }, [currentPropertyList, queryBuilder, setCurrentPropertyList, setQuery]);
107
+ const _removeNestedProperties = react_3.useCallback((prop) => {
121
108
  switch (prop.value.valueFormat) {
122
109
  case appui_abstract_1.PropertyValueFormat.Primitive:
123
110
  void _removeSelectedProperty(prop);
@@ -135,15 +122,15 @@ const PropertyView = (props) => {
135
122
  }
136
123
  }
137
124
  }, [_removeSelectedProperty]);
138
- React.useEffect(() => {
139
- if (!context.currentPropertyList.includes(props.propertyRecord)) {
125
+ react_2.useEffect(() => {
126
+ if (!currentPropertyList.includes(props.propertyRecord)) {
140
127
  setIsPropertySelected(false);
141
128
  }
142
- }, [context.currentPropertyList, props.propertyRecord]);
143
- React.useEffect(() => {
129
+ }, [currentPropertyList, props.propertyRecord]);
130
+ react_2.useEffect(() => {
144
131
  if (props === null || props === void 0 ? void 0 : props.propertyRecord) {
145
132
  if (isPropertySelected) {
146
- if (context.isRendering) {
133
+ if (isUpdating) {
147
134
  setIsCheckboxLoading(true);
148
135
  }
149
136
  _addNestedProperties(props.propertyRecord);
@@ -157,13 +144,13 @@ const PropertyView = (props) => {
157
144
  _removeNestedProperties,
158
145
  isPropertySelected,
159
146
  props.propertyRecord,
160
- context.isRendering,
147
+ isUpdating,
161
148
  ]);
162
- React.useEffect(() => {
163
- if (!context.isRendering) {
149
+ react_2.useEffect(() => {
150
+ if (!isUpdating) {
164
151
  setIsCheckboxLoading(false);
165
152
  }
166
- }, [context.isRendering]);
153
+ }, [isUpdating]);
167
154
  const _onPropertySelectionChanged = () => {
168
155
  setIsPropertySelected(!isPropertySelected);
169
156
  };
@@ -213,20 +200,19 @@ const PropertyView = (props) => {
213
200
  const needActionButtons = !!props.actionButtonRenderers;
214
201
  const columnsStyleProvider = new PropertyGridColumns_1.PropertyGridColumnStyleProvider(props.columnInfo);
215
202
  const offset = CommonPropertyRenderer_1.CommonPropertyRenderer.getLabelOffset(props.indentation, props.orientation, props.width, props.columnRatio, (_a = props.columnInfo) === null || _a === void 0 ? void 0 : _a.minLabelWidth);
216
- return (React.createElement("div", { style: columnsStyleProvider.getStyle(props.orientation, needActionButtons, ratio, needElementSeparator), className: getClassName(props), onClick: _onClick, onContextMenu: _onContextMenu, onMouseEnter: _onMouseEnter, onMouseLeave: _onMouseLeave, role: "presentation" },
217
- React.createElement("div", { className: "gmw-components-property-record-label" },
203
+ return (react_1.default.createElement("div", { style: columnsStyleProvider.getStyle(props.orientation, needActionButtons, ratio, needElementSeparator), className: getClassName(props), onClick: _onClick, onContextMenu: _onContextMenu, onMouseEnter: _onMouseEnter, onMouseLeave: _onMouseLeave, role: "presentation" },
204
+ react_1.default.createElement("div", { className: "gmw-components-property-record-label" },
218
205
  props.propertyRecord.value.valueFormat ===
219
- appui_abstract_1.PropertyValueFormat.Primitive && (React.createElement(itwinui_react_1.Checkbox, { style: { marginLeft: offset }, className: "gmw-components-property-selection-checkbox", checked: isPropertySelected, onChange: _onPropertySelectionChanged, disabled: context.isLoading ||
220
- context.isRendering ||
206
+ appui_abstract_1.PropertyValueFormat.Primitive && (react_1.default.createElement(itwinui_react_1.Checkbox, { style: { marginLeft: offset }, className: "gmw-components-property-selection-checkbox", checked: isPropertySelected, onChange: _onPropertySelectionChanged, disabled: isUpdating ||
221
207
  props.propertyRecord.value.value === undefined, isLoading: isCheckboxLoading })),
222
208
  props.labelElement),
223
- needElementSeparator ? (React.createElement(core_react_1.ElementSeparator, { movableArea: props.width, onRatioChanged: props.onColumnRatioChanged, ratio: ratio, orientation: props.orientation, isResizeHandleHovered: props.isResizeHandleHovered, onResizeHandleHoverChanged: props.onResizeHandleHoverChanged, isResizeHandleBeingDragged: props.isResizeHandleBeingDragged, onResizeHandleDragChanged: props.onResizeHandleDragChanged })) : undefined,
209
+ needElementSeparator ? (react_1.default.createElement(core_react_1.ElementSeparator, { movableArea: props.width, onRatioChanged: props.onColumnRatioChanged, ratio: ratio, orientation: props.orientation, isResizeHandleHovered: props.isResizeHandleHovered, onResizeHandleHoverChanged: props.onResizeHandleHoverChanged, isResizeHandleBeingDragged: props.isResizeHandleBeingDragged, onResizeHandleDragChanged: props.onResizeHandleDragChanged })) : undefined,
224
210
  props.propertyRecord.value.valueFormat ===
225
- appui_abstract_1.PropertyValueFormat.Primitive ? (React.createElement("div", { className: "gmw-components-property-record-value" },
226
- React.createElement("span", null, props.valueElementRenderer
211
+ appui_abstract_1.PropertyValueFormat.Primitive ? (react_1.default.createElement("div", { className: "gmw-components-property-record-value" },
212
+ react_1.default.createElement("span", null, props.valueElementRenderer
227
213
  ? props.valueElementRenderer()
228
214
  : props.valueElement))) : undefined,
229
- props.actionButtonRenderers ? (React.createElement(components_react_1.ActionButtonList, { orientation: props.orientation, property: props.propertyRecord, isPropertyHovered: isHovered, actionButtonRenderers: props.actionButtonRenderers })) : undefined));
215
+ props.actionButtonRenderers ? (react_1.default.createElement(components_react_1.ActionButtonList, { orientation: props.orientation, property: props.propertyRecord, isPropertyHovered: isHovered, actionButtonRenderers: props.actionButtonRenderers })) : undefined));
230
216
  };
231
217
  exports.PropertyView = PropertyView;
232
218
  //# sourceMappingURL=PropertyView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyView.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6CAA+B;AAE/B,0DAA4D;AAC5D,kDAAkE;AAClE,8DAA2D;AAE3D,+BAA6B;AAE7B,kFAA+E;AAC/E,iCAAoC;AACpC,mIAA4I;AAC5I,wDAAgD;AAChD,yIAAsI;AAgBtI;;;GAGG;AACI,MAAM,YAAY,GAAG,CAAC,KAAwB,EAAE,EAAE;;IACvD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,mDAAwB,CAAC,CAAC;IAC3D,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExE,MAAM,0BAA0B,GAAG,GAAG,EAAE;QACtC,IAAI,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE;YAC9D,OAAO,IAAI,CAAC;SACb;QACD,0CAA0C;QAC1C,IAAI,CAAC,kCAAkC,CAAC,KAAK,CAAC,cAAc,CAAC,EAAE;YAC7D,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,MAAM,kCAAkC,GAAG,CAAC,IAAoB,EAAE,EAAE;QAClE,QAAQ,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;YAC9B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AAK,CAAC,qBAAqB,EAClD,0BAA0B,EAAE,KAAK,CAAC,0BAA0B,EAC5D,0BAA0B,EAAE,KAAK,CAAC,0BAA0B,EAC5D,yBAAyB,EAAE,KAAK,CAAC,yBAAyB,GAC1D,CACH,CAAC,CAAC,CAAC,SAAS;QACZ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW;YACrC,oCAAmB,CAAC,SAAS,CAAC,CAAC,CAAC,CAC9B,6BAAK,SAAS,EAAC,sCAAsC;YACnD,kCACG,KAAK,CAAC,oBAAoB;gBACzB,CAAC,CAAC,KAAK,CAAC,oBAAoB,EAAE;gBAC9B,CAAC,CAAC,KAAK,CAAC,YAAY,CACjB,CACH,CACP,CAAC,CAAC,CAAC,SAAS;QACd,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAC7B,oBAAC,mCAAgB,IACf,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,QAAQ,EAAE,KAAK,CAAC,cAAc,EAC9B,iBAAiB,EAAE,SAAS,EAC5B,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,GAClD,CACH,CAAC,CAAC,CAAC,SAAS,CACT,CACP,CAAC;AACJ,CAAC,CAAC;AAlTW,QAAA,YAAY,gBAkTvB","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 * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { ElementSeparator, Orientation } from \"@itwin/core-react\";\nimport { ActionButtonList } from \"@itwin/components-react\";\n\nimport \"./PropertyView.scss\";\nimport type { SharedRendererProps } from \"./PropertyRender\";\nimport { GroupQueryBuilderContext } from \"../context/GroupQueryBuilderContext\";\nimport { useCallback } from \"react\";\nimport { PropertyGridColumnStyleProvider } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport { CommonPropertyRenderer } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer\";\n\n/** Properties of [[PropertyView]] React component\n * @public\n */\nexport interface PropertyViewProps extends SharedRendererProps {\n /** Property label as a React element */\n labelElement: React.ReactNode;\n /** Property value as a React element */\n valueElement?: React.ReactNode;\n /** Render callback for property value. If specified, `valueElement` is ignored. */\n valueElementRenderer?: () => React.ReactNode;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n}\n\n/**\n * A React component that renders property as label/value pair\n * @public\n */\nexport const PropertyView = (props: PropertyViewProps) => {\n const context = React.useContext(GroupQueryBuilderContext);\n const [isCheckboxLoading, setIsCheckboxLoading] = React.useState(false);\n\n const _validatePropertySelection = () => {\n if (context.currentPropertyList.includes(props.propertyRecord)) {\n return true;\n }\n // Check if all subproperties are selected\n if (!_validateNestedPropertiesSelection(props.propertyRecord)) {\n return false;\n }\n return true;\n };\n\n const _validateNestedPropertiesSelection = (prop: PropertyRecord) => {\n switch (prop.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n if (!context.currentPropertyList.includes(prop)) {\n return false;\n }\n break;\n case PropertyValueFormat.Array:\n if (prop.value.items.length === 0) {\n if (!context.currentPropertyList.includes(prop)) {\n return false;\n }\n }\n break;\n case PropertyValueFormat.Struct:\n for (const subPropName in prop.value.members) {\n if (\n Object.prototype.hasOwnProperty.call(\n prop.value.members,\n subPropName\n )\n ) {\n if (\n !_validateNestedPropertiesSelection(\n prop.value.members[subPropName]\n )\n ) {\n return false;\n }\n }\n }\n }\n return true;\n };\n\n const [isHovered, setIsHovered] = React.useState<boolean>(false);\n const [isPropertySelected, setIsPropertySelected] = React.useState<boolean>(\n _validatePropertySelection()\n );\n\n const _addSelectedProperty = useCallback(\n async (prop: PropertyRecord) => {\n // TODO: roof selected item/category value is an object but format is primitive(needs further exploration)\n if (\n !context.currentPropertyList.includes(prop) &&\n prop.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n if (!(await context.queryBuilder.addProperty(prop))) {\n setIsCheckboxLoading(false);\n setIsPropertySelected(false);\n return;\n }\n context.setCurrentPropertyList(\n context.currentPropertyList.concat(prop)\n );\n context.setQuery(context.queryBuilder.buildQueryString());\n }\n },\n [context]\n );\n\n const _addNestedProperties = useCallback(\n (prop: PropertyRecord) => {\n switch (prop.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n void _addSelectedProperty(prop);\n break;\n case PropertyValueFormat.Array:\n if (prop.value.items.length === 0) {\n void _addSelectedProperty(prop);\n }\n break;\n case PropertyValueFormat.Struct:\n for (const subPropName in prop.value.members) {\n if (\n Object.prototype.hasOwnProperty.call(\n prop.value.members,\n subPropName\n )\n ) {\n _addNestedProperties(prop.value.members[subPropName]);\n }\n }\n }\n },\n [_addSelectedProperty]\n );\n\n const _removeSelectedProperty = useCallback(\n async (prop: PropertyRecord): Promise<void> => {\n if (context.currentPropertyList.includes(prop)) {\n context.setCurrentPropertyList(\n context.currentPropertyList.filter((x: PropertyRecord) => x !== prop)\n );\n await context.queryBuilder.removeProperty(prop);\n context.setQuery(context.queryBuilder.buildQueryString());\n }\n },\n [context]\n );\n\n const _removeNestedProperties = useCallback(\n (prop: PropertyRecord) => {\n switch (prop.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n void _removeSelectedProperty(prop);\n break;\n case PropertyValueFormat.Array:\n if (prop.value.items.length === 0) {\n void _removeSelectedProperty(prop);\n }\n break;\n case PropertyValueFormat.Struct:\n for (const subPropName in prop.value.members) {\n if (\n Object.prototype.hasOwnProperty.call(\n prop.value.members,\n subPropName\n )\n ) {\n _removeNestedProperties(prop.value.members[subPropName]);\n }\n }\n }\n },\n [_removeSelectedProperty]\n );\n\n React.useEffect(() => {\n if (!context.currentPropertyList.includes(props.propertyRecord)) {\n setIsPropertySelected(false);\n }\n }, [context.currentPropertyList, props.propertyRecord]);\n\n React.useEffect(() => {\n if (props?.propertyRecord) {\n if (isPropertySelected) {\n if (context.isRendering) {\n setIsCheckboxLoading(true);\n }\n _addNestedProperties(props.propertyRecord);\n } else {\n _removeNestedProperties(props.propertyRecord);\n }\n }\n }, [\n _addNestedProperties,\n _removeNestedProperties,\n isPropertySelected,\n props.propertyRecord,\n context.isRendering,\n ]);\n\n React.useEffect(() => {\n if (!context.isRendering) {\n setIsCheckboxLoading(false);\n }\n }, [context.isRendering]);\n\n const _onPropertySelectionChanged = () => {\n setIsPropertySelected(!isPropertySelected);\n };\n\n const _onClick = () => {\n if (props.onClick) {\n props.onClick(props.propertyRecord, props.uniqueKey);\n }\n };\n\n const _onMouseEnter = () => {\n if (props.isHoverable) {\n setIsHovered(true);\n }\n };\n\n const _onMouseLeave = () => {\n if (props.isHoverable) {\n setIsHovered(false);\n }\n };\n\n const _onContextMenu = (e: React.MouseEvent) => {\n if (props.onContextMenu) {\n props.onContextMenu(props.propertyRecord, e);\n }\n if (props.onRightClick) {\n props.onRightClick(props.propertyRecord, props.uniqueKey);\n }\n e.preventDefault();\n return false;\n };\n\n const getClassName = (viewProps: PropertyViewProps) => {\n let propertyRecordClassName =\n viewProps.orientation === Orientation.Horizontal\n ? \"gmw-components-property-record--horizontal\"\n : \"gmw-components-property-record--vertical\";\n if (viewProps.isSelected) {\n propertyRecordClassName += \" components--selected\";\n }\n if (viewProps.onClick) {\n propertyRecordClassName += \" components--clickable\";\n }\n if (viewProps.isHoverable) {\n propertyRecordClassName += \" components--hoverable\";\n }\n return propertyRecordClassName;\n };\n\n const ratio = props.columnRatio ? props.columnRatio : 0.25;\n const needElementSeparator =\n props.orientation === Orientation.Horizontal &&\n !!props.onColumnRatioChanged;\n const needActionButtons = !!props.actionButtonRenderers;\n const columnsStyleProvider = new PropertyGridColumnStyleProvider(\n props.columnInfo\n );\n\n const offset = CommonPropertyRenderer.getLabelOffset(\n props.indentation,\n props.orientation,\n props.width,\n props.columnRatio,\n props.columnInfo?.minLabelWidth\n );\n\n return (\n <div\n style={columnsStyleProvider.getStyle(\n props.orientation,\n needActionButtons,\n ratio,\n needElementSeparator\n )}\n className={getClassName(props)}\n onClick={_onClick}\n onContextMenu={_onContextMenu}\n onMouseEnter={_onMouseEnter}\n onMouseLeave={_onMouseLeave}\n role=\"presentation\"\n >\n <div className=\"gmw-components-property-record-label\">\n {props.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive && (\n <Checkbox\n style={{ marginLeft: offset }}\n className=\"gmw-components-property-selection-checkbox\"\n checked={isPropertySelected}\n onChange={_onPropertySelectionChanged}\n disabled={\n context.isLoading ||\n context.isRendering ||\n props.propertyRecord.value.value === undefined\n }\n isLoading={isCheckboxLoading}\n />\n )}\n {props.labelElement}\n </div>\n {needElementSeparator ? (\n <ElementSeparator\n movableArea={props.width}\n onRatioChanged={props.onColumnRatioChanged}\n ratio={ratio}\n orientation={props.orientation}\n isResizeHandleHovered={props.isResizeHandleHovered}\n onResizeHandleHoverChanged={props.onResizeHandleHoverChanged}\n isResizeHandleBeingDragged={props.isResizeHandleBeingDragged}\n onResizeHandleDragChanged={props.onResizeHandleDragChanged}\n />\n ) : undefined}\n {props.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive ? (\n <div className=\"gmw-components-property-record-value\">\n <span>\n {props.valueElementRenderer\n ? props.valueElementRenderer()\n : props.valueElement}\n </span>\n </div>\n ) : undefined}\n {props.actionButtonRenderers ? (\n <ActionButtonList\n orientation={props.orientation}\n property={props.propertyRecord}\n isPropertyHovered={isHovered}\n actionButtonRenderers={props.actionButtonRenderers}\n />\n ) : undefined}\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"PropertyView.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyView.tsx"],"names":[],"mappings":";;;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,iCAA4C;AAE5C,0DAA4D;AAC5D,kDAAkE;AAClE,8DAA2D;AAC3D,+BAA6B;AAE7B,iCAAoC;AACpC,mIAA4I;AAC5I,wDAAgD;AA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5B,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,GAClD,CACH,CAAC,CAAC,CAAC,SAAS,CACT,CACP,CAAC;AACJ,CAAC,CAAC;AAvTW,QAAA,YAAY,gBAuTvB","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 React from \"react\";\nimport { useEffect, useState } from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { ElementSeparator, Orientation } from \"@itwin/core-react\";\nimport { ActionButtonList } from \"@itwin/components-react\";\nimport \"./PropertyView.scss\";\nimport type { SharedRendererProps } from \"./PropertyRender\";\nimport { useCallback } from \"react\";\nimport { PropertyGridColumnStyleProvider } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport { CommonPropertyRenderer } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer\";\nimport { usePropertyGridWrapper } from \"../context/PropertyGridWrapperContext\";\n\n/** Properties of [[PropertyView]] React component\n * @public\n */\nexport interface PropertyViewProps extends SharedRendererProps {\n /** Property label as a React element */\n labelElement: React.ReactNode;\n /** Property value as a React element */\n valueElement?: React.ReactNode;\n /** Render callback for property value. If specified, `valueElement` is ignored. */\n valueElementRenderer?: () => React.ReactNode;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n}\n\n/**\n * A React component that renders property as label/value pair\n * @public\n */\nexport const PropertyView = (props: PropertyViewProps) => {\n const [isCheckboxLoading, setIsCheckboxLoading] = useState(false);\n const {\n currentPropertyList,\n queryBuilder,\n setCurrentPropertyList,\n setQuery,\n isUpdating,\n } = usePropertyGridWrapper();\n\n const _validatePropertySelection = () => {\n if (currentPropertyList.includes(props.propertyRecord)) {\n return true;\n }\n // Check if all subproperties are selected\n if (!_validateNestedPropertiesSelection(props.propertyRecord)) {\n return false;\n }\n return true;\n };\n\n const _validateNestedPropertiesSelection = (prop: PropertyRecord) => {\n switch (prop.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n if (!currentPropertyList.includes(prop)) {\n return false;\n }\n break;\n case PropertyValueFormat.Array:\n if (prop.value.items.length === 0) {\n if (!currentPropertyList.includes(prop)) {\n return false;\n }\n }\n break;\n case PropertyValueFormat.Struct:\n for (const subPropName in prop.value.members) {\n if (\n Object.prototype.hasOwnProperty.call(\n prop.value.members,\n subPropName\n )\n ) {\n if (\n !_validateNestedPropertiesSelection(\n prop.value.members[subPropName]\n )\n ) {\n return false;\n }\n }\n }\n }\n return true;\n };\n\n const [isHovered, setIsHovered] = useState<boolean>(false);\n const [isPropertySelected, setIsPropertySelected] = useState<boolean>(\n _validatePropertySelection()\n );\n\n const _addSelectedProperty = useCallback(\n async (prop: PropertyRecord) => {\n // TODO: roof selected item/category value is an object but format is primitive(needs further exploration)\n if (\n !currentPropertyList.includes(prop) &&\n prop.value.valueFormat === PropertyValueFormat.Primitive\n ) {\n if (!(await queryBuilder?.addProperty(prop))) {\n setIsCheckboxLoading(false);\n setIsPropertySelected(false);\n return;\n }\n setCurrentPropertyList(\n currentPropertyList.concat(prop)\n );\n setQuery(queryBuilder?.buildQueryString() ?? \"\");\n }\n },\n [currentPropertyList, queryBuilder, setCurrentPropertyList, setQuery]\n );\n\n const _addNestedProperties = useCallback(\n (prop: PropertyRecord) => {\n switch (prop.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n void _addSelectedProperty(prop);\n break;\n case PropertyValueFormat.Array:\n if (prop.value.items.length === 0) {\n void _addSelectedProperty(prop);\n }\n break;\n case PropertyValueFormat.Struct:\n for (const subPropName in prop.value.members) {\n if (\n Object.prototype.hasOwnProperty.call(\n prop.value.members,\n subPropName\n )\n ) {\n _addNestedProperties(prop.value.members[subPropName]);\n }\n }\n }\n },\n [_addSelectedProperty]\n );\n\n const _removeSelectedProperty = useCallback(\n async (prop: PropertyRecord): Promise<void> => {\n if (currentPropertyList.includes(prop)) {\n setCurrentPropertyList(\n currentPropertyList.filter((x: PropertyRecord) => x !== prop)\n );\n await queryBuilder?.removeProperty(prop);\n setQuery(queryBuilder?.buildQueryString() ?? \"\");\n }\n },\n [currentPropertyList, queryBuilder, setCurrentPropertyList, setQuery]\n );\n\n const _removeNestedProperties = useCallback(\n (prop: PropertyRecord) => {\n switch (prop.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n void _removeSelectedProperty(prop);\n break;\n case PropertyValueFormat.Array:\n if (prop.value.items.length === 0) {\n void _removeSelectedProperty(prop);\n }\n break;\n case PropertyValueFormat.Struct:\n for (const subPropName in prop.value.members) {\n if (\n Object.prototype.hasOwnProperty.call(\n prop.value.members,\n subPropName\n )\n ) {\n _removeNestedProperties(prop.value.members[subPropName]);\n }\n }\n }\n },\n [_removeSelectedProperty]\n );\n\n useEffect(() => {\n if (!currentPropertyList.includes(props.propertyRecord)) {\n setIsPropertySelected(false);\n }\n }, [currentPropertyList, props.propertyRecord]);\n\n useEffect(() => {\n if (props?.propertyRecord) {\n if (isPropertySelected) {\n if (isUpdating) {\n setIsCheckboxLoading(true);\n }\n _addNestedProperties(props.propertyRecord);\n } else {\n _removeNestedProperties(props.propertyRecord);\n }\n }\n }, [\n _addNestedProperties,\n _removeNestedProperties,\n isPropertySelected,\n props.propertyRecord,\n isUpdating,\n ]);\n\n useEffect(() => {\n if (!isUpdating) {\n setIsCheckboxLoading(false);\n }\n }, [isUpdating]);\n\n const _onPropertySelectionChanged = () => {\n setIsPropertySelected(!isPropertySelected);\n };\n\n const _onClick = () => {\n if (props.onClick) {\n props.onClick(props.propertyRecord, props.uniqueKey);\n }\n };\n\n const _onMouseEnter = () => {\n if (props.isHoverable) {\n setIsHovered(true);\n }\n };\n\n const _onMouseLeave = () => {\n if (props.isHoverable) {\n setIsHovered(false);\n }\n };\n\n const _onContextMenu = (e: React.MouseEvent) => {\n if (props.onContextMenu) {\n props.onContextMenu(props.propertyRecord, e);\n }\n if (props.onRightClick) {\n props.onRightClick(props.propertyRecord, props.uniqueKey);\n }\n e.preventDefault();\n return false;\n };\n\n const getClassName = (viewProps: PropertyViewProps) => {\n let propertyRecordClassName =\n viewProps.orientation === Orientation.Horizontal\n ? \"gmw-components-property-record--horizontal\"\n : \"gmw-components-property-record--vertical\";\n if (viewProps.isSelected) {\n propertyRecordClassName += \" components--selected\";\n }\n if (viewProps.onClick) {\n propertyRecordClassName += \" components--clickable\";\n }\n if (viewProps.isHoverable) {\n propertyRecordClassName += \" components--hoverable\";\n }\n return propertyRecordClassName;\n };\n\n const ratio = props.columnRatio ? props.columnRatio : 0.25;\n const needElementSeparator =\n props.orientation === Orientation.Horizontal &&\n !!props.onColumnRatioChanged;\n const needActionButtons = !!props.actionButtonRenderers;\n const columnsStyleProvider = new PropertyGridColumnStyleProvider(\n props.columnInfo\n );\n\n const offset = CommonPropertyRenderer.getLabelOffset(\n props.indentation,\n props.orientation,\n props.width,\n props.columnRatio,\n props.columnInfo?.minLabelWidth\n );\n\n return (\n <div\n style={columnsStyleProvider.getStyle(\n props.orientation,\n needActionButtons,\n ratio,\n needElementSeparator\n )}\n className={getClassName(props)}\n onClick={_onClick}\n onContextMenu={_onContextMenu}\n onMouseEnter={_onMouseEnter}\n onMouseLeave={_onMouseLeave}\n role=\"presentation\"\n >\n <div className=\"gmw-components-property-record-label\">\n {props.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive && (\n <Checkbox\n style={{ marginLeft: offset }}\n className=\"gmw-components-property-selection-checkbox\"\n checked={isPropertySelected}\n onChange={_onPropertySelectionChanged}\n disabled={\n isUpdating ||\n props.propertyRecord.value.value === undefined\n }\n isLoading={isCheckboxLoading}\n />\n )}\n {props.labelElement}\n </div>\n {needElementSeparator ? (\n <ElementSeparator\n movableArea={props.width}\n onRatioChanged={props.onColumnRatioChanged}\n ratio={ratio}\n orientation={props.orientation}\n isResizeHandleHovered={props.isResizeHandleHovered}\n onResizeHandleHoverChanged={props.onResizeHandleHoverChanged}\n isResizeHandleBeingDragged={props.isResizeHandleBeingDragged}\n onResizeHandleDragChanged={props.onResizeHandleDragChanged}\n />\n ) : undefined}\n {props.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive ? (\n <div className=\"gmw-components-property-record-value\">\n <span>\n {props.valueElementRenderer\n ? props.valueElementRenderer()\n : props.valueElement}\n </span>\n </div>\n ) : undefined}\n {props.actionButtonRenderers ? (\n <ActionButtonList\n orientation={props.orientation}\n property={props.propertyRecord}\n isPropertyHovered={isHovered}\n actionButtonRenderers={props.actionButtonRenderers}\n />\n ) : undefined}\n </div>\n );\n};\n"]}
@@ -268,10 +268,8 @@ const getHiliteIds = async (query, iModelConnection) => {
268
268
  };
269
269
  exports.getHiliteIds = getHiliteIds;
270
270
  const manufactureKeys = async (query, iModelConnection) => {
271
- query;
272
- iModelConnection;
273
271
  if (query === "") {
274
- new presentation_common_1.KeySet();
272
+ return new presentation_common_1.KeySet();
275
273
  }
276
274
  const queryWithIdAndECClassName = `SELECT q.ECInstanceId, ec_classname(e.ECClassId) FROM (${query}) q JOIN BisCore.Element e on e.ECInstanceId = q.ECInstanceId`;
277
275
  const rowIterator = iModelConnection.query(queryWithIdAndECClassName, undefined, {