@itwin/grouping-mapping-widget 0.3.5 → 0.5.1
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/lib/cjs/formula/FormulaDataTypeResolver.d.ts +12 -0
- package/lib/cjs/formula/FormulaDataTypeResolver.js +50 -0
- package/lib/cjs/formula/FormulaDataTypeResolver.js.map +1 -0
- package/lib/cjs/formula/FormulaFunctionProvider.js +59 -59
- package/lib/cjs/formula/FormulaFunctionProvider.js.map +1 -1
- package/lib/cjs/formula/FormulaOperatorsProvider.js +7 -7
- package/lib/cjs/formula/FormulaOperatorsProvider.js.map +1 -1
- package/lib/cjs/formula/FormulaTokensDataTypeResolver.d.ts +6 -0
- package/lib/cjs/formula/{FormulaTokensValidator.js → FormulaTokensDataTypeResolver.js} +32 -32
- package/lib/cjs/formula/FormulaTokensDataTypeResolver.js.map +1 -0
- package/lib/cjs/formula/Types.d.ts +2 -2
- package/lib/cjs/formula/Types.js.map +1 -1
- package/lib/cjs/grouping-mapping-widget.d.ts +9 -0
- package/lib/cjs/grouping-mapping-widget.js +9 -1
- package/lib/cjs/grouping-mapping-widget.js.map +1 -1
- package/lib/cjs/widget/GroupingMappingWidget.d.ts +3 -4
- package/lib/cjs/widget/GroupingMappingWidget.js +3 -4
- package/lib/cjs/widget/GroupingMappingWidget.js.map +1 -1
- package/lib/cjs/widget/IMappingClient.d.ts +327 -0
- package/lib/cjs/widget/IMappingClient.js +7 -0
- package/lib/cjs/widget/IMappingClient.js.map +1 -0
- package/lib/cjs/widget/components/CalculatedPropertyAction.js +7 -5
- package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/CalculatedPropertyTable.js +6 -5
- package/lib/cjs/widget/components/CalculatedPropertyTable.js.map +1 -1
- package/lib/cjs/widget/components/ConfirmMappingsImport.js +6 -4
- package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/cjs/widget/components/CustomCalculationAction.js +7 -5
- package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/cjs/widget/components/CustomCalculationTable.js +6 -5
- package/lib/cjs/widget/components/CustomCalculationTable.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.d.ts +2 -1
- package/lib/cjs/widget/components/GroupAction.js +21 -13
- package/lib/cjs/widget/components/GroupAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupPropertyAction.js +19 -9
- package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupPropertyTable.js +6 -5
- package/lib/cjs/widget/components/GroupPropertyTable.js.map +1 -1
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.js +8 -5
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.js.map +1 -1
- package/lib/cjs/widget/components/GroupTile.d.ts +13 -0
- package/lib/cjs/widget/components/GroupTile.js +18 -0
- package/lib/cjs/widget/components/GroupTile.js.map +1 -0
- package/lib/cjs/widget/components/GroupTile.scss +32 -0
- package/lib/cjs/widget/components/Grouping.js +215 -165
- package/lib/cjs/widget/components/Grouping.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.scss +39 -4
- package/lib/cjs/widget/components/GroupingMapping.d.ts +18 -11
- package/lib/cjs/widget/components/GroupingMapping.js +24 -15
- package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
- package/lib/cjs/widget/components/Mapping.js +20 -16
- package/lib/cjs/widget/components/Mapping.js.map +1 -1
- package/lib/cjs/widget/components/MappingAction.js +7 -5
- package/lib/cjs/widget/components/MappingAction.js.map +1 -1
- package/lib/cjs/widget/components/PropertyMenu.js +17 -18
- package/lib/cjs/widget/components/PropertyMenu.js.map +1 -1
- package/lib/cjs/widget/components/QueryBuilder.d.ts +10 -5
- package/lib/cjs/widget/components/QueryBuilder.js +223 -142
- package/lib/cjs/widget/components/QueryBuilder.js.map +1 -1
- package/lib/cjs/widget/components/SelectIModel.js +13 -4
- package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
- package/lib/cjs/widget/components/SelectMappings.js +9 -7
- package/lib/cjs/widget/components/SelectMappings.js.map +1 -1
- package/lib/cjs/widget/components/SelectProject.js +13 -4
- package/lib/cjs/widget/components/SelectProject.js.map +1 -1
- package/lib/cjs/widget/components/{GroupQueryBuilderContext.d.ts → context/GroupQueryBuilderContext.d.ts} +2 -1
- package/lib/cjs/widget/components/{GroupQueryBuilderContext.js → context/GroupQueryBuilderContext.js} +2 -1
- package/lib/cjs/widget/components/context/GroupQueryBuilderContext.js.map +1 -0
- package/lib/cjs/widget/components/context/GroupingApiConfigContext.d.ts +11 -0
- package/lib/cjs/widget/components/context/GroupingApiConfigContext.js +37 -0
- package/lib/cjs/widget/components/context/GroupingApiConfigContext.js.map +1 -0
- package/lib/cjs/widget/components/context/MappingClientContext.d.ts +7 -0
- package/lib/cjs/widget/components/context/MappingClientContext.js +30 -0
- package/lib/cjs/widget/components/context/MappingClientContext.js.map +1 -0
- package/lib/cjs/widget/components/property-grid/PropertyGrid.d.ts +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js +5 -5
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +2 -2
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyView.js +14 -6
- package/lib/cjs/widget/components/property-grid/PropertyView.js.map +1 -1
- package/lib/cjs/widget/components/utils.d.ts +6 -2
- package/lib/cjs/widget/components/utils.js +9 -13
- package/lib/cjs/widget/components/utils.js.map +1 -1
- package/lib/cjs/widget/components/utils.scss +12 -3
- package/lib/cjs/widget/components/viewerUtils.d.ts +19 -0
- package/lib/cjs/widget/components/viewerUtils.js +224 -3
- package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
- package/lib/cjs/widget/hooks/useFormulaValidation.js +3 -2
- package/lib/cjs/widget/hooks/useFormulaValidation.js.map +1 -1
- package/lib/esm/formula/FormulaDataTypeResolver.d.ts +12 -0
- package/lib/esm/formula/FormulaDataTypeResolver.js +46 -0
- package/lib/esm/formula/FormulaDataTypeResolver.js.map +1 -0
- package/lib/esm/formula/FormulaFunctionProvider.js +59 -59
- package/lib/esm/formula/FormulaFunctionProvider.js.map +1 -1
- package/lib/esm/formula/FormulaOperatorsProvider.js +7 -7
- package/lib/esm/formula/FormulaOperatorsProvider.js.map +1 -1
- package/lib/esm/formula/FormulaTokensDataTypeResolver.d.ts +6 -0
- package/lib/esm/formula/{FormulaTokensValidator.js → FormulaTokensDataTypeResolver.js} +30 -30
- package/lib/esm/formula/FormulaTokensDataTypeResolver.js.map +1 -0
- package/lib/esm/formula/Types.d.ts +2 -2
- package/lib/esm/formula/Types.js.map +1 -1
- package/lib/esm/grouping-mapping-widget.d.ts +9 -0
- package/lib/esm/grouping-mapping-widget.js +6 -0
- package/lib/esm/grouping-mapping-widget.js.map +1 -1
- package/lib/esm/widget/GroupingMappingWidget.d.ts +3 -4
- package/lib/esm/widget/GroupingMappingWidget.js +3 -4
- package/lib/esm/widget/GroupingMappingWidget.js.map +1 -1
- package/lib/esm/widget/IMappingClient.d.ts +327 -0
- package/lib/esm/widget/IMappingClient.js +6 -0
- package/lib/esm/widget/IMappingClient.js.map +1 -0
- package/lib/esm/widget/components/CalculatedPropertyAction.js +9 -7
- package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/CalculatedPropertyTable.js +7 -6
- package/lib/esm/widget/components/CalculatedPropertyTable.js.map +1 -1
- package/lib/esm/widget/components/ConfirmMappingsImport.js +8 -6
- package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/esm/widget/components/CustomCalculationAction.js +9 -7
- package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/esm/widget/components/CustomCalculationTable.js +7 -6
- package/lib/esm/widget/components/CustomCalculationTable.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.d.ts +2 -1
- package/lib/esm/widget/components/GroupAction.js +24 -16
- package/lib/esm/widget/components/GroupAction.js.map +1 -1
- package/lib/esm/widget/components/GroupPropertyAction.js +21 -11
- package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/GroupPropertyTable.js +7 -6
- package/lib/esm/widget/components/GroupPropertyTable.js.map +1 -1
- package/lib/esm/widget/components/GroupQueryBuilderContainer.js +8 -5
- package/lib/esm/widget/components/GroupQueryBuilderContainer.js.map +1 -1
- package/lib/esm/widget/components/GroupTile.d.ts +13 -0
- package/lib/esm/widget/components/GroupTile.js +11 -0
- package/lib/esm/widget/components/GroupTile.js.map +1 -0
- package/lib/esm/widget/components/GroupTile.scss +32 -0
- package/lib/esm/widget/components/Grouping.js +220 -170
- package/lib/esm/widget/components/Grouping.js.map +1 -1
- package/lib/esm/widget/components/Grouping.scss +39 -4
- package/lib/esm/widget/components/GroupingMapping.d.ts +18 -11
- package/lib/esm/widget/components/GroupingMapping.js +25 -15
- package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
- package/lib/esm/widget/components/Mapping.js +22 -18
- package/lib/esm/widget/components/Mapping.js.map +1 -1
- package/lib/esm/widget/components/MappingAction.js +9 -7
- package/lib/esm/widget/components/MappingAction.js.map +1 -1
- package/lib/esm/widget/components/PropertyMenu.js +20 -21
- package/lib/esm/widget/components/PropertyMenu.js.map +1 -1
- package/lib/esm/widget/components/QueryBuilder.d.ts +10 -5
- package/lib/esm/widget/components/QueryBuilder.js +224 -143
- package/lib/esm/widget/components/QueryBuilder.js.map +1 -1
- package/lib/esm/widget/components/SelectIModel.js +14 -5
- package/lib/esm/widget/components/SelectIModel.js.map +1 -1
- package/lib/esm/widget/components/SelectMappings.js +11 -9
- package/lib/esm/widget/components/SelectMappings.js.map +1 -1
- package/lib/esm/widget/components/SelectProject.js +14 -5
- package/lib/esm/widget/components/SelectProject.js.map +1 -1
- package/lib/esm/widget/components/{GroupQueryBuilderContext.d.ts → context/GroupQueryBuilderContext.d.ts} +2 -1
- package/lib/esm/widget/components/{GroupQueryBuilderContext.js → context/GroupQueryBuilderContext.js} +2 -1
- package/lib/esm/widget/components/context/GroupQueryBuilderContext.js.map +1 -0
- package/lib/esm/widget/components/context/GroupingApiConfigContext.d.ts +11 -0
- package/lib/esm/widget/components/context/GroupingApiConfigContext.js +14 -0
- package/lib/esm/widget/components/context/GroupingApiConfigContext.js.map +1 -0
- package/lib/esm/widget/components/context/MappingClientContext.d.ts +7 -0
- package/lib/esm/widget/components/context/MappingClientContext.js +25 -0
- package/lib/esm/widget/components/context/MappingClientContext.js.map +1 -0
- package/lib/esm/widget/components/property-grid/PropertyGrid.d.ts +1 -1
- package/lib/esm/widget/components/property-grid/PropertyGrid.js +6 -6
- package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +1 -1
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +2 -2
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyView.js +14 -6
- package/lib/esm/widget/components/property-grid/PropertyView.js.map +1 -1
- package/lib/esm/widget/components/utils.d.ts +6 -2
- package/lib/esm/widget/components/utils.js +6 -11
- package/lib/esm/widget/components/utils.js.map +1 -1
- package/lib/esm/widget/components/utils.scss +12 -3
- package/lib/esm/widget/components/viewerUtils.d.ts +19 -0
- package/lib/esm/widget/components/viewerUtils.js +207 -3
- package/lib/esm/widget/components/viewerUtils.js.map +1 -1
- package/lib/esm/widget/hooks/useFormulaValidation.js +3 -2
- package/lib/esm/widget/hooks/useFormulaValidation.js.map +1 -1
- package/package.json +29 -29
- package/lib/cjs/formula/FormulaTokensValidator.d.ts +0 -5
- package/lib/cjs/formula/FormulaTokensValidator.js.map +0 -1
- package/lib/cjs/formula/FormulaValidator.d.ts +0 -3
- package/lib/cjs/formula/FormulaValidator.js +0 -35
- package/lib/cjs/formula/FormulaValidator.js.map +0 -1
- package/lib/cjs/widget/components/GroupQueryBuilderContext.js.map +0 -1
- package/lib/esm/formula/FormulaTokensValidator.d.ts +0 -5
- package/lib/esm/formula/FormulaTokensValidator.js.map +0 -1
- package/lib/esm/formula/FormulaValidator.d.ts +0 -3
- package/lib/esm/formula/FormulaValidator.js +0 -31
- package/lib/esm/formula/FormulaValidator.js.map +0 -1
- package/lib/esm/widget/components/GroupQueryBuilderContext.js.map +0 -1
|
@@ -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;AAO/B,8DAIiC;AAGjC,6KAEyH;AACzH,kDAA4E;AAG5E,iDAA8C;AAC9C,+BAA6B;AAG7B,0EAAuE;AACvE,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,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE;gBACtB,OAAO,eAAO,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;oBAC9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AAC,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} from \"@itwin/components-react\";\nimport {\n PropertyCategoryBlock,\n PropertyGridCommons,\n PropertyGridEventsRelatedPropsSupplier,\n} from \"@itwin/components-react\";\nimport type {\n ColumnResizeRelatedPropertyListProps} from \"@itwin/components-react/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier\";\nimport {\n ColumnResizingPropertyListPropsSupplier,\n} 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 \"../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='gm-components-property-grid-loader'>\n <ProgressRadial indeterminate />\n </div>\n );\n }\n\n return (\n <div className='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 \"components-property-grid-wrapper\",\n this.props.className\n )}\n style={this.props.style}\n >\n <div\n className={classnames(\n \"components-property-grid\",\n \"components-smallEditor-host\"\n )}\n >\n <div className='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='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,8D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AC,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,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,qBAAqB,IACjC,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=\"gm-components-property-grid-loader\">\n <ProgressRadial indeterminate />\n </div>\n );\n }\n\n return (\n <div className=\"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 \"components-property-grid-wrapper\",\n this.props.className\n )}\n style={this.props.style}\n >\n <div\n className={classnames(\n \"components-property-grid\",\n \"components-smallEditor-host\"\n )}\n >\n <div className=\"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=\"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"]}
|
|
@@ -6,7 +6,7 @@ interface PropertyGridWrapperState {
|
|
|
6
6
|
dataProvider?: PresentationPropertyDataProvider;
|
|
7
7
|
}
|
|
8
8
|
export declare class PropertyGridWrapperApp extends React.Component<PropertyProps, PropertyGridWrapperState> {
|
|
9
|
-
static contextType: React.Context<import("../GroupQueryBuilderContext").PropertySelection>;
|
|
9
|
+
static contextType: React.Context<import("../context/GroupQueryBuilderContext").PropertySelection>;
|
|
10
10
|
constructor(props: PropertyProps | Readonly<PropertyProps>);
|
|
11
11
|
private createDataProvider;
|
|
12
12
|
componentDidMount(): void;
|
|
@@ -28,7 +28,7 @@ const React = __importStar(require("react"));
|
|
|
28
28
|
const GroupQueryBuilderApi_1 = require("../../../api/GroupQueryBuilderApi");
|
|
29
29
|
const PropertyGrid_1 = require("./PropertyGrid");
|
|
30
30
|
require("../GroupQueryBuilder.scss");
|
|
31
|
-
const GroupQueryBuilderContext_1 = require("../GroupQueryBuilderContext");
|
|
31
|
+
const GroupQueryBuilderContext_1 = require("../context/GroupQueryBuilderContext");
|
|
32
32
|
/* This approach uses PresentationPropertyDataProvider to all the work of querying the backend and
|
|
33
33
|
providing the content to the PropertyGrid component. */
|
|
34
34
|
class PropertyGridWrapperApp extends React.Component {
|
|
@@ -58,7 +58,7 @@ class PropertyGridWrapperApp extends React.Component {
|
|
|
58
58
|
const dataProvider = this.state.dataProvider;
|
|
59
59
|
return (React.createElement(React.Fragment, null,
|
|
60
60
|
dataProvider && React.createElement(PropertyGrid_1.PropertyGrid, { dataProvider: dataProvider }),
|
|
61
|
-
!dataProvider && (React.createElement("div", { className:
|
|
61
|
+
!dataProvider && (React.createElement("div", { className: "select-element-hint" },
|
|
62
62
|
React.createElement("span", null, "Select an element to see its properties.")))));
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyGridWrapper.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyGridWrapper.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6CAA+B;AAI/B,4EAAyE;AACzE,iDAA8C;AAC9C,qCAAmC;AACnC,
|
|
1
|
+
{"version":3,"file":"PropertyGridWrapper.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyGridWrapper.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6CAA+B;AAI/B,4EAAyE;AACzE,iDAA8C;AAC9C,qCAAmC;AACnC,kFAA+E;AAM/E;0DAC0D;AAC1D,MAAa,sBAAuB,SAAQ,KAAK,CAAC,SAGjD;IAEC,YAAY,KAA8C;QACxD,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAEO,kBAAkB;QACxB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE;YACjD,IAAI,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CAAC;YAC3C,OAAO;SACR;QAED,MAAM,YAAY,GAAG,2CAAoB,CAAC,0BAA0B,CAClE,IAAI,CAAC,KAAK,CAAC,IAAI,EACf,IAAI,CAAC,KAAK,CAAC,MAAM,CAClB,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,GAAG,YAAY,CAAC;QAEtD,IAAI,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;IAClC,CAAC;IAEe,iBAAiB;QAC/B,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;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,qBAAqB;gBAClC,6EAAqD,CACjD,CACP,CACA,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=\"select-element-hint\">\n <span>Select an element to see its properties.</span>\n </div>\n )}\n </>\n );\n }\n}\n"]}
|
|
@@ -29,7 +29,7 @@ const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
|
29
29
|
const core_react_1 = require("@itwin/core-react");
|
|
30
30
|
const components_react_1 = require("@itwin/components-react");
|
|
31
31
|
require("./PropertyView.scss");
|
|
32
|
-
const GroupQueryBuilderContext_1 = require("../GroupQueryBuilderContext");
|
|
32
|
+
const GroupQueryBuilderContext_1 = require("../context/GroupQueryBuilderContext");
|
|
33
33
|
const react_1 = require("react");
|
|
34
34
|
const PropertyGridColumns_1 = require("@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns");
|
|
35
35
|
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
@@ -135,6 +135,11 @@ const PropertyView = (props) => {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
}, [_removeSelectedProperty]);
|
|
138
|
+
React.useEffect(() => {
|
|
139
|
+
if (!context.currentPropertyList.includes(props.propertyRecord)) {
|
|
140
|
+
setIsPropertySelected(false);
|
|
141
|
+
}
|
|
142
|
+
}, [context.currentPropertyList, props.propertyRecord]);
|
|
138
143
|
React.useEffect(() => {
|
|
139
144
|
if (props === null || props === void 0 ? void 0 : props.propertyRecord) {
|
|
140
145
|
if (isPropertySelected) {
|
|
@@ -155,8 +160,9 @@ const PropertyView = (props) => {
|
|
|
155
160
|
context.isRendering,
|
|
156
161
|
]);
|
|
157
162
|
React.useEffect(() => {
|
|
158
|
-
if (!context.isRendering)
|
|
163
|
+
if (!context.isRendering) {
|
|
159
164
|
setIsCheckboxLoading(false);
|
|
165
|
+
}
|
|
160
166
|
}, [context.isRendering]);
|
|
161
167
|
const _onPropertySelectionChanged = () => {
|
|
162
168
|
setIsPropertySelected(!isPropertySelected);
|
|
@@ -207,14 +213,16 @@ const PropertyView = (props) => {
|
|
|
207
213
|
const needActionButtons = !!props.actionButtonRenderers;
|
|
208
214
|
const columnsStyleProvider = new PropertyGridColumns_1.PropertyGridColumnStyleProvider(props.columnInfo);
|
|
209
215
|
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);
|
|
210
|
-
return (React.createElement("div", { style: columnsStyleProvider.getStyle(props.orientation, needActionButtons, ratio, needElementSeparator), className: getClassName(props), onClick: _onClick, onContextMenu: _onContextMenu, onMouseEnter: _onMouseEnter, onMouseLeave: _onMouseLeave, role:
|
|
211
|
-
React.createElement("div", { className:
|
|
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: "components-property-record-label" },
|
|
212
218
|
props.propertyRecord.value.valueFormat ===
|
|
213
|
-
appui_abstract_1.PropertyValueFormat.Primitive && (React.createElement(itwinui_react_1.Checkbox, { style: { marginLeft: offset }, className:
|
|
219
|
+
appui_abstract_1.PropertyValueFormat.Primitive && (React.createElement(itwinui_react_1.Checkbox, { style: { marginLeft: offset }, className: "components-property-selection-checkbox", checked: isPropertySelected, onChange: _onPropertySelectionChanged, disabled: context.isLoading ||
|
|
220
|
+
context.isRendering ||
|
|
221
|
+
props.propertyRecord.value.value === undefined, isLoading: isCheckboxLoading })),
|
|
214
222
|
props.labelElement),
|
|
215
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,
|
|
216
224
|
props.propertyRecord.value.valueFormat ===
|
|
217
|
-
appui_abstract_1.PropertyValueFormat.Primitive ? (React.createElement("div", { className:
|
|
225
|
+
appui_abstract_1.PropertyValueFormat.Primitive ? (React.createElement("div", { className: "components-property-record-value" },
|
|
218
226
|
React.createElement("span", null, props.valueElementRenderer
|
|
219
227
|
? props.valueElementRenderer()
|
|
220
228
|
: props.valueElement))) : undefined,
|
|
@@ -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,0EAAuE;AACvE,iCAAoC;AACpC,mIAA4I;AAC5I,wDAAgD;AAChD,yIAAsI;AAgBtI;;;GAGG;AACI,MAAM,YAAY,GAAG,CAAC,KA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AAC,cAAc,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,EACtG,SAAS,EAAE,iBAAiB,GAC5B,CACH;YACA,KAAK,CAAC,YAAY,CACf;QACL,oBAAoB,CAAC,CAAC,CAAC,CACtB,oBAAC,6BAAgB,IACf,WAAW,EAAE,KAAK,CAAC,KAAK,EACxB,cAAc,EAAE,KAAK,CAAC,oBAAoB,EAC1C,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,qBAAqB,EAAE,KAAK,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,kCAAkC;YAC/C,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;AAxSW,QAAA,YAAY,gBAwSvB","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 \"../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\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 (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 }, [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 ? \"components-property-record--horizontal\"\n : \"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='components-property-record-label'>\n {props.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive && (\n <Checkbox\n style={{ marginLeft: offset }}\n className='components-property-selection-checkbox'\n checked={isPropertySelected}\n onChange={_onPropertySelectionChanged}\n disabled={context.isLoading || context.isRendering || (props.propertyRecord.value.value === undefined)}\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='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/Propert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AAoB,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 ? \"components-property-record--horizontal\"\n : \"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=\"components-property-record-label\">\n {props.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Primitive && (\n <Checkbox\n style={{ marginLeft: offset }}\n className=\"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=\"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"]}
|
|
@@ -2,7 +2,6 @@ import "./utils.scss";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import type { ISelectionProvider, SelectionChangeEventArgs } from "@itwin/presentation-frontend";
|
|
4
4
|
import type { IModelConnection } from "@itwin/core-frontend";
|
|
5
|
-
import { ReportingClient } from "@itwin/insights-client";
|
|
6
5
|
export declare const onSelectionChanged: (evt: SelectionChangeEventArgs, selectionProvider: ISelectionProvider) => void;
|
|
7
6
|
export interface WidgetHeaderProps {
|
|
8
7
|
title: string;
|
|
@@ -13,6 +12,11 @@ export declare const WidgetHeader: ({ title, disabled, returnFn, }: WidgetHeader
|
|
|
13
12
|
export declare const handleInputChange: <T>(e: React.ChangeEvent<HTMLInputElement>, values: T, setValues: React.Dispatch<React.SetStateAction<T>>) => void;
|
|
14
13
|
export declare const fetchIdsFromQuery: (query: string, iModelConnection: IModelConnection) => Promise<string[]>;
|
|
15
14
|
export declare const handleError: (errorStatus: number) => void;
|
|
15
|
+
export declare const LoadingOverlay: () => JSX.Element;
|
|
16
|
+
interface EmptyMessageProps {
|
|
17
|
+
message: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const EmptyMessage: ({ message }: EmptyMessageProps) => JSX.Element;
|
|
16
20
|
export declare const LoadingSpinner: () => JSX.Element;
|
|
17
|
-
export
|
|
21
|
+
export {};
|
|
18
22
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.LoadingSpinner = exports.EmptyMessage = exports.LoadingOverlay = exports.handleError = exports.fetchIdsFromQuery = exports.handleInputChange = exports.WidgetHeader = exports.onSelectionChanged = void 0;
|
|
7
7
|
/*---------------------------------------------------------------------------------------------
|
|
8
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -13,7 +13,6 @@ const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
|
13
13
|
require("./utils.scss");
|
|
14
14
|
const react_1 = __importDefault(require("react"));
|
|
15
15
|
const core_common_1 = require("@itwin/core-common");
|
|
16
|
-
const insights_client_1 = require("@itwin/insights-client");
|
|
17
16
|
const onSelectionChanged = (evt, selectionProvider) => {
|
|
18
17
|
/* eslint-disable no-console */
|
|
19
18
|
const selection = selectionProvider.getSelection(evt.imodel, evt.level);
|
|
@@ -116,20 +115,17 @@ const handleError = (errorStatus) => {
|
|
|
116
115
|
itwinui_react_1.toaster.negative(errorMessage);
|
|
117
116
|
};
|
|
118
117
|
exports.handleError = handleError;
|
|
118
|
+
const LoadingOverlay = () => (react_1.default.createElement("div", { className: 'gm-center-overlay' },
|
|
119
|
+
react_1.default.createElement(itwinui_react_1.Text, null, "Loading"),
|
|
120
|
+
react_1.default.createElement(itwinui_react_1.ProgressRadial, { indeterminate: true }),
|
|
121
|
+
react_1.default.createElement(itwinui_react_1.Text, null, "Please wait...")));
|
|
122
|
+
exports.LoadingOverlay = LoadingOverlay;
|
|
123
|
+
const EmptyMessage = ({ message }) => (react_1.default.createElement("div", { className: 'gm-center-overlay' },
|
|
124
|
+
react_1.default.createElement(itwinui_react_1.Text, null, message)));
|
|
125
|
+
exports.EmptyMessage = EmptyMessage;
|
|
119
126
|
const LoadingSpinner = () => {
|
|
120
127
|
return (react_1.default.createElement("div", { className: "gm-loading-spinner" },
|
|
121
128
|
react_1.default.createElement(itwinui_react_1.ProgressRadial, { size: "small", indeterminate: true })));
|
|
122
129
|
};
|
|
123
130
|
exports.LoadingSpinner = LoadingSpinner;
|
|
124
|
-
const prefixUrl = (baseUrl, prefix) => {
|
|
125
|
-
if (prefix && baseUrl) {
|
|
126
|
-
return baseUrl.replace("api.bentley.com", `${prefix}-api.bentley.com`);
|
|
127
|
-
}
|
|
128
|
-
return baseUrl;
|
|
129
|
-
};
|
|
130
|
-
const getReportingClient = (prefix) => {
|
|
131
|
-
const url = prefixUrl(insights_client_1.REPORTING_BASE_PATH, prefix);
|
|
132
|
-
return new insights_client_1.ReportingClient(url);
|
|
133
|
-
};
|
|
134
|
-
exports.getReportingClient = getReportingClient;
|
|
135
131
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/widget/components/utils.tsx"],"names":[],"mappings":";;;;;;AAAA;;;+FAG+F;AAC/F,oEAA4D;AAC5D,wDAAqE;AACrE,wBAAsB;AACtB,kDAA0B;AAM1B,oDAAoD;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/widget/components/utils.tsx"],"names":[],"mappings":";;;;;;AAAA;;;+FAG+F;AAC/F,oEAA4D;AAC5D,wDAAqE;AACrE,wBAAsB;AACtB,kDAA0B;AAM1B,oDAAoD;AAE7C,MAAM,kBAAkB,GAAG,CAChC,GAA6B,EA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AAC,oBAAI,kBAAe;IACpB,8BAAC,8BAAc,IAAC,aAAa,SAAG;IAChC,8BAAC,oBAAI,yBAAsB,CACvB,CACP,CAAC;AANW,QAAA,cAAc,kBAMzB;AAMK,MAAM,YAAY,GAAG,CAAC,EAAE,OAAO,EAAqB,EAAE,EAAE,CAAC,CAC9D,uCAAK,SAAS,EAAC,mBAAmB;IAChC,8BAAC,oBAAI,QAAE,OAAO,CAAQ,CAClB,CACP,CAAC;AAJW,QAAA,YAAY,gBAIvB;AAEK,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,OAAO,CACL,uCAAK,SAAS,EAAC,oBAAoB;QACjC,8BAAC,8BAAc,IAAC,IAAI,EAAC,OAAO,EAAC,aAAa,SAAG,CACzC,CACP,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB","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 { SvgChevronLeft } from \"@itwin/itwinui-icons-react\";\nimport { ProgressRadial, Text, toaster } from \"@itwin/itwinui-react\";\nimport \"./utils.scss\";\nimport React from \"react\";\nimport type {\n ISelectionProvider,\n SelectionChangeEventArgs,\n} from \"@itwin/presentation-frontend\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { QueryRowFormat } from \"@itwin/core-common\";\n\nexport const onSelectionChanged = (\n evt: SelectionChangeEventArgs,\n selectionProvider: ISelectionProvider,\n) => {\n /* eslint-disable no-console */\n const selection = selectionProvider.getSelection(evt.imodel, evt.level);\n if (selection.isEmpty) {\n console.log(\"========== Selection cleared ==========\");\n } else {\n console.log(\"========== Selection change ===========\");\n if (selection.instanceKeys.size !== 0) {\n // log all selected ECInstance ids grouped by ECClass name\n console.log(\"ECInstances:\");\n selection.instanceKeys.forEach((ids, ecclass) => {\n console.log(`${ecclass}: [${[...ids].join(\",\")}]`);\n });\n }\n if (selection.nodeKeys.size !== 0) {\n // log all selected node keys\n console.log(\"Nodes:\");\n selection.nodeKeys.forEach((key) => console.log(JSON.stringify(key)));\n }\n console.log(\"=======================================\");\n }\n /* eslint-enable no-console */\n};\n\nexport interface WidgetHeaderProps {\n title: string;\n disabled?: boolean;\n returnFn?: () => Promise<void>;\n}\n\nexport const WidgetHeader = ({\n title,\n disabled = false,\n returnFn,\n}: WidgetHeaderProps) => {\n return (\n <div className='widget-header-container'>\n {returnFn && (\n <div\n className={disabled ? \"chevron-disabled\" : \"chevron\"}\n onClick={disabled ? undefined : returnFn}\n >\n <SvgChevronLeft />\n </div>\n )}\n <Text className='title' variant='title'>\n {title}\n </Text>\n </div>\n );\n};\n\nexport const handleInputChange = <T,>(\n e: React.ChangeEvent<HTMLInputElement>,\n values: T,\n setValues: React.Dispatch<React.SetStateAction<T>>,\n) => {\n const { name, value } = e.target;\n\n setValues({\n ...values,\n [name]: value,\n });\n};\n\nexport const fetchIdsFromQuery = async (\n query: string,\n iModelConnection: IModelConnection,\n) => {\n if (query === \"\") {\n return [];\n }\n const ids: string[] = [];\n const rowIterator = iModelConnection.query(query, undefined, {\n rowFormat: QueryRowFormat.UseJsPropertyNames,\n });\n while (true) {\n const { done, value } = await rowIterator.next();\n if (done) {\n break;\n }\n if (Object.keys(value).includes(\"id\")) {\n ids.push(value.id);\n } else if (Object.keys(value).includes(\"element.id\")) {\n ids.push(value[\"element.id\"]);\n } else if (Object.keys(value).includes(\"eCInstanceId\")) {\n ids.push(value.eCInstanceId);\n }\n }\n return ids;\n};\n\nexport const handleError = (errorStatus: number) => {\n let errorMessage = \"Error! \";\n switch (errorStatus) {\n case 401:\n errorMessage += `You are unauthorized to do this operation.`;\n break;\n case 403:\n errorMessage += `You don't have permission to access the requested resource.`;\n break;\n case 404:\n errorMessage += `The requested resource was not found.`;\n break;\n case 409:\n errorMessage += `This property name is already being used.`;\n break;\n case 422:\n errorMessage += `Unable to process the request.`;\n break;\n case 429:\n errorMessage += `Too many requests.`;\n break;\n case 500:\n errorMessage += `Internal server error.`;\n break;\n case 502:\n errorMessage += `Bad gateway.`;\n break;\n case 503:\n errorMessage += `Service unavailable.`;\n break;\n default:\n errorMessage += `Something went wrong!`;\n }\n toaster.negative(errorMessage);\n\n};\n\nexport const LoadingOverlay = () => (\n <div className='gm-center-overlay'>\n <Text>Loading</Text>\n <ProgressRadial indeterminate />\n <Text>Please wait...</Text>\n </div>\n);\n\ninterface EmptyMessageProps {\n message: string;\n}\n\nexport const EmptyMessage = ({ message }: EmptyMessageProps) => (\n <div className='gm-center-overlay'>\n <Text>{message}</Text>\n </div>\n);\n\nexport const LoadingSpinner = () => {\n return (\n <div className=\"gm-loading-spinner\">\n <ProgressRadial size=\"small\" indeterminate />\n </div>\n );\n};\n"]}
|
|
@@ -2,9 +2,9 @@
|
|
|
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
|
-
@import
|
|
6
|
-
@import
|
|
7
|
-
@import
|
|
5
|
+
@import "~@itwin/itwinui-css/scss/variables";
|
|
6
|
+
@import "~@itwin/itwinui-css/scss/icon/index";
|
|
7
|
+
@import "~@itwin/itwinui-css/scss/button/index";
|
|
8
8
|
|
|
9
9
|
.widget-header-container {
|
|
10
10
|
display: flex;
|
|
@@ -39,3 +39,12 @@
|
|
|
39
39
|
display: flex;
|
|
40
40
|
align-items: center;
|
|
41
41
|
}
|
|
42
|
+
|
|
43
|
+
.gm-center-overlay {
|
|
44
|
+
display: flex;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
align-items: center;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
gap: $iui-baseline;
|
|
49
|
+
height: 100%;
|
|
50
|
+
}
|
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
import type { IModelConnection } from "@itwin/core-frontend";
|
|
2
|
+
import type { FeatureAppearance } from "@itwin/core-common";
|
|
3
|
+
import { FeatureOverrideType } from "@itwin/core-common";
|
|
2
4
|
import { KeySet } from "@itwin/presentation-common";
|
|
5
|
+
export declare const isolateElementsByKeys: (keySet: KeySet, replace?: boolean) => Promise<string[]>;
|
|
6
|
+
export declare const isolateElementsById: (elementIds: string[], iModelConnection: IModelConnection, replace?: boolean) => Promise<string[]>;
|
|
7
|
+
export declare const isolateElements: (hilitedIds: string[], replace?: boolean) => void;
|
|
8
|
+
export declare const clearIsolatedElements: () => void;
|
|
9
|
+
export declare const hideElementsById: (elementIds: string[], iModelConnection: IModelConnection, replace?: boolean) => Promise<string[]>;
|
|
10
|
+
export declare const hideElements: (hilitedIds: string[], replace?: boolean) => void;
|
|
11
|
+
export declare const clearHiddenElements: () => void;
|
|
12
|
+
export declare const overrideElementsById: (iModelConnection: IModelConnection, elementIds: string[], color: string, overrideType?: FeatureOverrideType) => Promise<string[]>;
|
|
13
|
+
export declare const overrideElements: (hilitedIds: string[], color: string, overrideType?: FeatureOverrideType) => void;
|
|
14
|
+
export declare const clearOverriddenElements: () => void;
|
|
15
|
+
export declare const emphasizeElements: (hilitedIds: string[], defaultAppearance?: FeatureAppearance | undefined, replace?: boolean) => void;
|
|
16
|
+
export declare const emphasisElementsById: (iModelConnection: IModelConnection, elementIds: string[], defaultAppearance?: FeatureAppearance | undefined, replace?: boolean) => Promise<string[]>;
|
|
17
|
+
export declare const emphasizeElementsByKeys: (keySet: KeySet, defaultAppearance?: FeatureAppearance | undefined, replace?: boolean) => Promise<string[]>;
|
|
3
18
|
export declare const visualizeElementsById: (elementIds: string[], color: string, iModelConnection: IModelConnection, replace?: boolean, wantEmphasis?: boolean) => Promise<string[]>;
|
|
4
19
|
export declare const visualizeElementsByKeys: (keySet: KeySet, color: string, replace?: boolean, wantEmphasis?: boolean) => Promise<string[]>;
|
|
5
20
|
export declare const visualizeElements: (elementIds: string[], color: string, replace?: boolean, wantEmphasis?: boolean) => void;
|
|
21
|
+
export declare const transparentOverriddenElements: () => void;
|
|
6
22
|
export declare const zoomToElements: (elementIds: string[]) => Promise<void>;
|
|
23
|
+
export declare const getHiliteIds: (elementIds: string[], iModelConnection: IModelConnection) => Promise<string[]>;
|
|
7
24
|
export declare const manufactureKeys: (elementIds: string[], iModelConnection: IModelConnection) => Promise<KeySet>;
|
|
8
25
|
export declare const clearEmphasizedElements: () => void;
|
|
26
|
+
export declare const clearEmphasizedOverriddenElements: () => void;
|
|
27
|
+
export declare const clearAll: () => void;
|
|
9
28
|
//# sourceMappingURL=viewerUtils.d.ts.map
|