@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.
- package/lib/cjs/test/GroupPropertyUtils.test.js +61 -1
- package/lib/cjs/test/GroupPropertyUtils.test.js.map +1 -1
- package/lib/cjs/test/GroupingMappingCustomUI.test.js +44 -53
- package/lib/cjs/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/lib/cjs/test/QueryBuilder.test.js +30 -2
- package/lib/cjs/test/QueryBuilder.test.js.map +1 -1
- package/lib/cjs/test/QueryBuilder.testdata.js +471 -7
- package/lib/cjs/test/QueryBuilder.testdata.js.map +1 -1
- package/lib/cjs/test/QueryBuilderTestData.d.ts +3 -1
- package/lib/cjs/test/QueryBuilderTestData.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.js +2 -21
- package/lib/cjs/widget/components/GroupAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupPropertyUtils.js +2 -1
- package/lib/cjs/widget/components/GroupPropertyUtils.js.map +1 -1
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.d.ts +3 -2
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.js +38 -45
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.js +1 -1
- package/lib/cjs/widget/components/Grouping.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.scss +1 -1
- package/lib/cjs/widget/components/QueryBuilder.d.ts +35 -21
- package/lib/cjs/widget/components/QueryBuilder.js +153 -181
- package/lib/cjs/widget/components/QueryBuilder.js.map +1 -1
- package/lib/cjs/widget/components/context/PropertyGridWrapperContext.d.ts +15 -0
- package/lib/cjs/widget/components/context/{GroupQueryBuilderContext.js → PropertyGridWrapperContext.js} +13 -9
- package/lib/cjs/widget/components/context/PropertyGridWrapperContext.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 +2 -2
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +10 -4
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +18 -8
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyView.d.ts +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyView.js +46 -60
- package/lib/cjs/widget/components/property-grid/PropertyView.js.map +1 -1
- package/lib/cjs/widget/components/viewerUtils.js +1 -3
- package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
- package/lib/esm/test/GroupPropertyUtils.test.js +61 -1
- package/lib/esm/test/GroupPropertyUtils.test.js.map +1 -1
- package/lib/esm/test/GroupingMappingCustomUI.test.js +45 -54
- package/lib/esm/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/lib/esm/test/QueryBuilder.test.js +31 -3
- package/lib/esm/test/QueryBuilder.test.js.map +1 -1
- package/lib/esm/test/QueryBuilder.testdata.js +471 -7
- package/lib/esm/test/QueryBuilder.testdata.js.map +1 -1
- package/lib/esm/test/QueryBuilderTestData.d.ts +3 -1
- package/lib/esm/test/QueryBuilderTestData.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.js +2 -21
- package/lib/esm/widget/components/GroupAction.js.map +1 -1
- package/lib/esm/widget/components/GroupPropertyUtils.js +2 -1
- package/lib/esm/widget/components/GroupPropertyUtils.js.map +1 -1
- package/lib/esm/widget/components/GroupQueryBuilderContainer.d.ts +3 -2
- package/lib/esm/widget/components/GroupQueryBuilderContainer.js +34 -25
- package/lib/esm/widget/components/GroupQueryBuilderContainer.js.map +1 -1
- package/lib/esm/widget/components/Grouping.js +1 -1
- package/lib/esm/widget/components/Grouping.js.map +1 -1
- package/lib/esm/widget/components/Grouping.scss +1 -1
- package/lib/esm/widget/components/QueryBuilder.d.ts +35 -21
- package/lib/esm/widget/components/QueryBuilder.js +153 -181
- package/lib/esm/widget/components/QueryBuilder.js.map +1 -1
- package/lib/esm/widget/components/context/PropertyGridWrapperContext.d.ts +15 -0
- package/lib/esm/widget/components/context/{GroupQueryBuilderContext.js → PropertyGridWrapperContext.js} +11 -8
- package/lib/esm/widget/components/context/PropertyGridWrapperContext.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 +2 -2
- package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +10 -4
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +16 -6
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyView.d.ts +1 -1
- package/lib/esm/widget/components/property-grid/PropertyView.js +32 -30
- package/lib/esm/widget/components/property-grid/PropertyView.js.map +1 -1
- package/lib/esm/widget/components/viewerUtils.js +1 -3
- package/lib/esm/widget/components/viewerUtils.js.map +1 -1
- package/package.json +2 -2
- package/lib/cjs/api/GroupQueryBuilderApi.d.ts +0 -15
- package/lib/cjs/api/GroupQueryBuilderApi.js +0 -27
- package/lib/cjs/api/GroupQueryBuilderApi.js.map +0 -1
- package/lib/cjs/widget/components/context/GroupQueryBuilderContext.d.ts +0 -16
- package/lib/cjs/widget/components/context/GroupQueryBuilderContext.js.map +0 -1
- package/lib/esm/api/GroupQueryBuilderApi.d.ts +0 -15
- package/lib/esm/api/GroupQueryBuilderApi.js +0 -23
- package/lib/esm/api/GroupQueryBuilderApi.js.map +0 -1
- package/lib/esm/widget/components/context/GroupQueryBuilderContext.d.ts +0 -16
- 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/
|
|
49
|
+
static contextType: React.Context<import("../context/PropertyGridWrapperContext").PropertySelection>;
|
|
50
50
|
/** @internal */
|
|
51
51
|
constructor(props: PropertyGridProps);
|
|
52
52
|
/** @internal */
|
|
@@ -10,7 +10,7 @@ import { ColumnResizingPropertyListPropsSupplier } from "@itwin/components-react
|
|
|
10
10
|
import { Orientation, ResizableContainerObserver } from "@itwin/core-react";
|
|
11
11
|
import { PropertyList } from "./PropertyList";
|
|
12
12
|
import "./PropertyGrid.scss";
|
|
13
|
-
import {
|
|
13
|
+
import { PropertyGridWrapperContext } from "../context/PropertyGridWrapperContext";
|
|
14
14
|
import { ProgressRadial } from "@itwin/itwinui-react";
|
|
15
15
|
/** PropertyGrid React component.
|
|
16
16
|
* @public
|
|
@@ -148,7 +148,7 @@ export class PropertyGrid extends React.Component {
|
|
|
148
148
|
React.createElement(ResizableContainerObserver, { onResize: this._onResize }))))));
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
|
-
PropertyGrid.contextType =
|
|
151
|
+
PropertyGrid.contextType = PropertyGridWrapperContext;
|
|
152
152
|
function findCategory(categories, lookupName, recurseIntoChildren) {
|
|
153
153
|
for (const category of categories) {
|
|
154
154
|
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,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,sCAAsC,GACvC,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,uCAAuC,EAAE,MAAM,iHAAiH,CAAC;AAC1K,OAAO,EAAE,WAAW,EAA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BAAqB,EAAE,KAAK,CAAC,qBAAqB,EAClD,4BAA4B,EAAE,KAAK,CAAC,4BAA4B,EAChE,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAC5C,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,sBAAsB,EAAE,KAAK,CAAC,sBAAsB,EACpD,0BAA0B,EAAE,KAAK,CAAC,0BAA0B,EAC5D,oCAAoC,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,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,sCAAsC,GACvC,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,uCAAuC,EAAE,MAAM,iHAAiH,CAAC;AAC1K,OAAO,EAAE,WAAW,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAG5E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,qBAAqB,CAAC;AAG7B,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE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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 { 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
|
|
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
|
-
|
|
9
|
-
|
|
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;
|
|
@@ -3,15 +3,25 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from "react";
|
|
6
|
-
import {
|
|
6
|
+
import { DEFAULT_PROPERTY_GRID_RULESET, PresentationPropertyDataProvider } from "@itwin/presentation-components";
|
|
7
7
|
import { PropertyGrid } from "./PropertyGrid";
|
|
8
8
|
import "../GroupQueryBuilder.scss";
|
|
9
|
-
import {
|
|
9
|
+
import { PropertyGridWrapperContext } from "../context/PropertyGridWrapperContext";
|
|
10
|
+
import { QueryBuilder } from "../QueryBuilder";
|
|
10
11
|
/* This approach uses PresentationPropertyDataProvider to all the work of querying the backend and
|
|
11
12
|
providing the content to the PropertyGrid component. */
|
|
12
|
-
export class
|
|
13
|
+
export class PropertyGridWrapper extends React.Component {
|
|
13
14
|
constructor(props) {
|
|
14
15
|
super(props);
|
|
16
|
+
this.createPropertyDataProvider = (keys, imodel) => {
|
|
17
|
+
const dataProvider = new PresentationPropertyDataProvider({
|
|
18
|
+
imodel,
|
|
19
|
+
ruleset: DEFAULT_PROPERTY_GRID_RULESET,
|
|
20
|
+
});
|
|
21
|
+
dataProvider.keys = keys;
|
|
22
|
+
dataProvider.isNestedPropertyCategoryGroupingEnabled = true;
|
|
23
|
+
return dataProvider;
|
|
24
|
+
};
|
|
15
25
|
this.state = {};
|
|
16
26
|
}
|
|
17
27
|
createDataProvider() {
|
|
@@ -19,8 +29,8 @@ export class PropertyGridWrapperApp extends React.Component {
|
|
|
19
29
|
this.setState({ dataProvider: undefined });
|
|
20
30
|
return;
|
|
21
31
|
}
|
|
22
|
-
const dataProvider =
|
|
23
|
-
this.context.
|
|
32
|
+
const dataProvider = this.createPropertyDataProvider(this.props.keys, this.props.imodel);
|
|
33
|
+
this.context.setQueryBuilder(new QueryBuilder(dataProvider));
|
|
24
34
|
this.setState({ dataProvider });
|
|
25
35
|
}
|
|
26
36
|
componentDidMount() {
|
|
@@ -40,5 +50,5 @@ export class PropertyGridWrapperApp extends React.Component {
|
|
|
40
50
|
React.createElement("span", null, "Select an element to see its properties.")))));
|
|
41
51
|
}
|
|
42
52
|
}
|
|
43
|
-
|
|
53
|
+
PropertyGridWrapper.contextType = PropertyGridWrapperContext;
|
|
44
54
|
//# sourceMappingURL=PropertyGridWrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyGridWrapper.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyGridWrapper.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PropertyGridWrapper.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyGridWrapper.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,6BAA6B,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AACjH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAa/C;0DAC0D;AAC1D,MAAM,OAAO,mBAAoB,SAAQ,KAAK,CAAC,SAG9C;IAEC,YAAY,KAA8C;QACxD,KAAK,CAAC,KAAK,CAAC,CAAC;QAIP,+BAA0B,GAAG,CAAC,IAAY,EAAE,MAAwB,EAAoC,EAAE;YAChH,MAAM,YAAY,GAAG,IAAI,gCAAgC,CAAC;gBACxD,MAAM;gBACN,OAAO,EAAE,6BAA6B;aACvC,CAAC,CAAC;YACH,YAAY,CAAC,IAAI,GAAG,IAAI,CAAC;YACzB,YAAY,CAAC,uCAAuC,GAAG,IAAI,CAAC;YAC5D,OAAO,YAAY,CAAC;QACtB,CAAC,CAAA;QAXC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAYO,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,IAAI,CAAC,0BAA0B,CAClD,IAAI,CAAC,KAAK,CAAC,IAAI,EACf,IAAI,CAAC,KAAK,CAAC,MAAM,CAClB,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;QAE7D,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,YAAY,IAAC,YAAY,EAAE,YAAY,GAAI;YAC5D,CAAC,YAAY,IAAI,CAChB,6BAAK,SAAS,EAAC,yBAAyB;gBACtC,6EAAqD,CACjD,CACP,CACA,CACJ,CAAC;IACJ,CAAC;;AAvDe,+BAAW,GAAG,0BAA0B,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"]}
|
|
@@ -2,26 +2,27 @@
|
|
|
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
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
6
7
|
import { PropertyValueFormat } from "@itwin/appui-abstract";
|
|
7
8
|
import { ElementSeparator, Orientation } from "@itwin/core-react";
|
|
8
9
|
import { ActionButtonList } from "@itwin/components-react";
|
|
9
10
|
import "./PropertyView.scss";
|
|
10
|
-
import { GroupQueryBuilderContext } from "../context/GroupQueryBuilderContext";
|
|
11
11
|
import { useCallback } from "react";
|
|
12
12
|
import { PropertyGridColumnStyleProvider } from "@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns";
|
|
13
13
|
import { Checkbox } from "@itwin/itwinui-react";
|
|
14
14
|
import { CommonPropertyRenderer } from "@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer";
|
|
15
|
+
import { usePropertyGridWrapper } from "../context/PropertyGridWrapperContext";
|
|
15
16
|
/**
|
|
16
17
|
* A React component that renders property as label/value pair
|
|
17
18
|
* @public
|
|
18
19
|
*/
|
|
19
20
|
export const PropertyView = (props) => {
|
|
20
21
|
var _a;
|
|
21
|
-
const
|
|
22
|
-
const
|
|
22
|
+
const [isCheckboxLoading, setIsCheckboxLoading] = useState(false);
|
|
23
|
+
const { currentPropertyList, queryBuilder, setCurrentPropertyList, setQuery, isUpdating, } = usePropertyGridWrapper();
|
|
23
24
|
const _validatePropertySelection = () => {
|
|
24
|
-
if (
|
|
25
|
+
if (currentPropertyList.includes(props.propertyRecord)) {
|
|
25
26
|
return true;
|
|
26
27
|
}
|
|
27
28
|
// Check if all subproperties are selected
|
|
@@ -33,13 +34,13 @@ export const PropertyView = (props) => {
|
|
|
33
34
|
const _validateNestedPropertiesSelection = (prop) => {
|
|
34
35
|
switch (prop.value.valueFormat) {
|
|
35
36
|
case PropertyValueFormat.Primitive:
|
|
36
|
-
if (!
|
|
37
|
+
if (!currentPropertyList.includes(prop)) {
|
|
37
38
|
return false;
|
|
38
39
|
}
|
|
39
40
|
break;
|
|
40
41
|
case PropertyValueFormat.Array:
|
|
41
42
|
if (prop.value.items.length === 0) {
|
|
42
|
-
if (!
|
|
43
|
+
if (!currentPropertyList.includes(prop)) {
|
|
43
44
|
return false;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
@@ -55,21 +56,22 @@ export const PropertyView = (props) => {
|
|
|
55
56
|
}
|
|
56
57
|
return true;
|
|
57
58
|
};
|
|
58
|
-
const [isHovered, setIsHovered] =
|
|
59
|
-
const [isPropertySelected, setIsPropertySelected] =
|
|
59
|
+
const [isHovered, setIsHovered] = useState(false);
|
|
60
|
+
const [isPropertySelected, setIsPropertySelected] = useState(_validatePropertySelection());
|
|
60
61
|
const _addSelectedProperty = useCallback(async (prop) => {
|
|
62
|
+
var _a;
|
|
61
63
|
// TODO: roof selected item/category value is an object but format is primitive(needs further exploration)
|
|
62
|
-
if (!
|
|
64
|
+
if (!currentPropertyList.includes(prop) &&
|
|
63
65
|
prop.value.valueFormat === PropertyValueFormat.Primitive) {
|
|
64
|
-
if (!(await
|
|
66
|
+
if (!(await (queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.addProperty(prop)))) {
|
|
65
67
|
setIsCheckboxLoading(false);
|
|
66
68
|
setIsPropertySelected(false);
|
|
67
69
|
return;
|
|
68
70
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
setCurrentPropertyList(currentPropertyList.concat(prop));
|
|
72
|
+
setQuery((_a = queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.buildQueryString()) !== null && _a !== void 0 ? _a : "");
|
|
71
73
|
}
|
|
72
|
-
}, [
|
|
74
|
+
}, [currentPropertyList, queryBuilder, setCurrentPropertyList, setQuery]);
|
|
73
75
|
const _addNestedProperties = useCallback((prop) => {
|
|
74
76
|
switch (prop.value.valueFormat) {
|
|
75
77
|
case PropertyValueFormat.Primitive:
|
|
@@ -89,12 +91,13 @@ export const PropertyView = (props) => {
|
|
|
89
91
|
}
|
|
90
92
|
}, [_addSelectedProperty]);
|
|
91
93
|
const _removeSelectedProperty = useCallback(async (prop) => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
var _a;
|
|
95
|
+
if (currentPropertyList.includes(prop)) {
|
|
96
|
+
setCurrentPropertyList(currentPropertyList.filter((x) => x !== prop));
|
|
97
|
+
await (queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.removeProperty(prop));
|
|
98
|
+
setQuery((_a = queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.buildQueryString()) !== null && _a !== void 0 ? _a : "");
|
|
96
99
|
}
|
|
97
|
-
}, [
|
|
100
|
+
}, [currentPropertyList, queryBuilder, setCurrentPropertyList, setQuery]);
|
|
98
101
|
const _removeNestedProperties = useCallback((prop) => {
|
|
99
102
|
switch (prop.value.valueFormat) {
|
|
100
103
|
case PropertyValueFormat.Primitive:
|
|
@@ -113,15 +116,15 @@ export const PropertyView = (props) => {
|
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
118
|
}, [_removeSelectedProperty]);
|
|
116
|
-
|
|
117
|
-
if (!
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (!currentPropertyList.includes(props.propertyRecord)) {
|
|
118
121
|
setIsPropertySelected(false);
|
|
119
122
|
}
|
|
120
|
-
}, [
|
|
121
|
-
|
|
123
|
+
}, [currentPropertyList, props.propertyRecord]);
|
|
124
|
+
useEffect(() => {
|
|
122
125
|
if (props === null || props === void 0 ? void 0 : props.propertyRecord) {
|
|
123
126
|
if (isPropertySelected) {
|
|
124
|
-
if (
|
|
127
|
+
if (isUpdating) {
|
|
125
128
|
setIsCheckboxLoading(true);
|
|
126
129
|
}
|
|
127
130
|
_addNestedProperties(props.propertyRecord);
|
|
@@ -135,13 +138,13 @@ export const PropertyView = (props) => {
|
|
|
135
138
|
_removeNestedProperties,
|
|
136
139
|
isPropertySelected,
|
|
137
140
|
props.propertyRecord,
|
|
138
|
-
|
|
141
|
+
isUpdating,
|
|
139
142
|
]);
|
|
140
|
-
|
|
141
|
-
if (!
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
if (!isUpdating) {
|
|
142
145
|
setIsCheckboxLoading(false);
|
|
143
146
|
}
|
|
144
|
-
}, [
|
|
147
|
+
}, [isUpdating]);
|
|
145
148
|
const _onPropertySelectionChanged = () => {
|
|
146
149
|
setIsPropertySelected(!isPropertySelected);
|
|
147
150
|
};
|
|
@@ -194,8 +197,7 @@ export const PropertyView = (props) => {
|
|
|
194
197
|
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" },
|
|
195
198
|
React.createElement("div", { className: "gmw-components-property-record-label" },
|
|
196
199
|
props.propertyRecord.value.valueFormat ===
|
|
197
|
-
PropertyValueFormat.Primitive && (React.createElement(Checkbox, { style: { marginLeft: offset }, className: "gmw-components-property-selection-checkbox", checked: isPropertySelected, onChange: _onPropertySelectionChanged, disabled:
|
|
198
|
-
context.isRendering ||
|
|
200
|
+
PropertyValueFormat.Primitive && (React.createElement(Checkbox, { style: { marginLeft: offset }, className: "gmw-components-property-selection-checkbox", checked: isPropertySelected, onChange: _onPropertySelectionChanged, disabled: isUpdating ||
|
|
199
201
|
props.propertyRecord.value.value === undefined, isLoading: isCheckboxLoading })),
|
|
200
202
|
props.labelElement),
|
|
201
203
|
needElementSeparator ? (React.createElement(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,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyView.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyView.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,+BAA+B,EAAE,MAAM,2FAA2F,CAAC;AAC5I,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,sBAAsB,EAAE,MAAM,8FAA8F,CAAC;AAgBtI;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAwB,EAAE,EAAE;;IACvD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,wBAAwB,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,CA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AE,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,mBAAmB,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,gBAAgB,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","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,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAA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AAC,CAAC,SAAS;QACZ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW;YACrC,mBAAmB,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,gBAAgB,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","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"]}
|
|
@@ -246,10 +246,8 @@ export const getHiliteIds = async (query, iModelConnection) => {
|
|
|
246
246
|
return [];
|
|
247
247
|
};
|
|
248
248
|
export const manufactureKeys = async (query, iModelConnection) => {
|
|
249
|
-
query;
|
|
250
|
-
iModelConnection;
|
|
251
249
|
if (query === "") {
|
|
252
|
-
new KeySet();
|
|
250
|
+
return new KeySet();
|
|
253
251
|
}
|
|
254
252
|
const queryWithIdAndECClassName = `SELECT q.ECInstanceId, ec_classname(e.ECClassId) FROM (${query}) q JOIN BisCore.Element e on e.ECInstanceId = q.ECInstanceId`;
|
|
255
253
|
const rowIterator = iModelConnection.query(queryWithIdAndECClassName, undefined, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewerUtils.js","sourceRoot":"","sources":["../../../../src/widget/components/viewerUtils.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEnF,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,EACxC,MAAc,EACd,OAAO,GAAG,KAAK,EACf,EAAE;IACF,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,EAAE;QACvC,OAAO,EAAE,CAAC;KACX;IAED,MAAM,EAAE,GAAG,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;IAE9C,MAAM,cAAc,GAAsB,iBAAiB,CAAC,MAAM,CAAC;QACjE,MAAM,EAAE,EAAE,CAAC,MAAM;KAClB,CAAC,CAAC;IACH,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACtD,IAAI,GAAG,CAAC,QAAQ,EAAE;QAChB,MAAM,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC9B,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC9B,OAAO,GAAG,CAAC;KACZ;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,EACzC,KAAa,EACb,gBAAkC,EAClC,OAAO,GAAG,KAAK,EACf,EAAE;IACF,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,EAAE;QACvC,OAAO,EAAE,CA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,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,EAAE;IACpD,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,EAAE;QACvC,OAAO;KACR;IACD,MAAM,EAAE,GAAG,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;IAC9C,MAAM,IAAI,GAAG,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC/C,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,EAAE;QACvC,OAAO;KACR;IACD,MAAM,EAAE,GAAG,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;IAC9C,MAAM,IAAI,GAAG,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC/C,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;AAC/B,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 type { IModelConnection, ViewChangeOptions } from \"@itwin/core-frontend\";\nimport { EmphasizeElements, IModelApp } from \"@itwin/core-frontend\";\nimport type { FeatureAppearance } from \"@itwin/core-common\";\nimport { ColorDef, FeatureOverrideType, QueryRowFormat } from \"@itwin/core-common\";\nimport type { InstanceKey } from \"@itwin/presentation-common\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport { HiliteSetProvider } from \"@itwin/presentation-frontend\";\n\nexport const isolateElementsByKeys = async (\n keySet: KeySet,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n isolateElements(ids, replace);\n return ids;\n }\n return [];\n};\n\nexport const isolateElementsByQuery = async (\n query: string,\n iModelConnection: IModelConnection,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(query, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n isolateElements(ids, replace);\n return ids;\n }\n return [];\n};\n\nexport const isolateElements = (hilitedIds: string[], replace = false) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.isolateElements(hilitedIds, vp, replace);\n};\n\nexport const clearIsolatedElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearIsolatedElements(vp);\n};\n\nexport const hideElementsByQuery = async (\n query: string,\n iModelConnection: IModelConnection,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(query, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n hideElements(ids, replace);\n return ids;\n }\n return [];\n};\n\nexport const hideElements = (hilitedIds: string[], replace = false) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.hideElements(hilitedIds, vp, replace);\n};\n\nexport const clearHiddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearHiddenElements(vp);\n};\n\nexport const overrideElementsByQuery = async (\n iModelConnection: IModelConnection,\n query: string,\n color: string,\n overrideType = FeatureOverrideType.ColorOnly,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(query, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n overrideElements(ids, color, overrideType);\n return ids;\n }\n return [];\n};\n\nexport const overrideElements = (\n hilitedIds: string[],\n color: string,\n overrideType = FeatureOverrideType.ColorOnly,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.overrideElements(\n hilitedIds,\n vp,\n ColorDef.fromString(color),\n overrideType,\n true,\n );\n};\n\nexport const clearOverriddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearOverriddenElements(vp);\n};\n\nexport const emphasizeElements = (\n hilitedIds: string[],\n defaultAppearance: FeatureAppearance | undefined = undefined,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.wantEmphasis = true;\n emph.emphasizeElements(hilitedIds, vp, defaultAppearance, replace);\n};\n\nexport const emphasisElementsByQuery = async (\n iModelConnection: IModelConnection,\n query: string,\n defaultAppearance: FeatureAppearance | undefined = undefined,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(query, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n emphasizeElements(ids, defaultAppearance, replace);\n return ids;\n }\n return [];\n};\n\nexport const emphasizeElementsByKeys = async (\n keySet: KeySet,\n defaultAppearance: FeatureAppearance | undefined = undefined,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n emphasizeElements(ids, defaultAppearance, replace);\n return ids;\n }\n return [];\n};\n\nexport const visualizeElementsByQuery = async (\n query: string,\n color: string,\n iModelConnection: IModelConnection,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(query, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n visualizeElements(ids, color, replace, wantEmphasis);\n return ids;\n }\n return [];\n};\n\nexport const visualizeElementsByKeys = async (\n keySet: KeySet,\n color: string,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n visualizeElements(ids, color, replace, wantEmphasis);\n return ids;\n }\n return [];\n};\n\nexport const visualizeElements = (\n elementIds: string[],\n color: string,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.overrideElements(\n elementIds,\n vp,\n ColorDef.fromString(color),\n FeatureOverrideType.ColorAndAlpha,\n true,\n );\n if (!wantEmphasis) {\n return;\n }\n emph.wantEmphasis = true;\n emph.emphasizeElements(elementIds, vp, undefined, replace);\n};\n\nexport const transparentOverriddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n const ids = emph.getOverriddenElements()?.values();\n if (ids) {\n const toOverride = new Set<string>();\n Array.from(ids).forEach((a) => a.forEach((id) => toOverride.add(id)));\n emph.overrideElements(\n toOverride,\n vp,\n ColorDef.red.withAlpha(50),\n FeatureOverrideType.AlphaOnly,\n true,\n );\n }\n};\n\nexport const zoomToElements = async (elementIds: string[]) => {\n if (!IModelApp.viewManager.selectedView || elementIds.length === 0) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const viewChangeOpts: ViewChangeOptions = {};\n viewChangeOpts.animateFrustumChange = true;\n // It was removed. Should be a prop to be passed to lookAtViewAlignedVolume within the implementation.\n // viewChangeOpts.marginPercent = new MarginPercent(0.1, 0.1, 0.1, 0.1);\n await vp.zoomToElements(elementIds, { ...viewChangeOpts });\n};\n\nexport const getHiliteIds = async (\n query: string,\n iModelConnection: IModelConnection,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(query, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n return [...set.elements];\n }\n return [];\n};\n\nexport const manufactureKeys = async (\n query: string,\n iModelConnection: IModelConnection,\n): Promise<KeySet> => {\n query;\n iModelConnection;\n if (query === \"\") {\n new KeySet();\n }\n const queryWithIdAndECClassName = `SELECT q.ECInstanceId, ec_classname(e.ECClassId) FROM (${query}) q JOIN BisCore.Element e on e.ECInstanceId = q.ECInstanceId`;\n\n const rowIterator = iModelConnection.query(queryWithIdAndECClassName, undefined, {\n rowFormat: QueryRowFormat.UseECSqlPropertyIndexes,\n });\n\n const keys: InstanceKey[] = [];\n\n for await (const value of rowIterator) {\n keys.push({ id: value[0], className: value[1] });\n }\n\n return new KeySet(keys);\n};\n\nexport const clearEmphasizedElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearEmphasizedElements(vp);\n};\n\nexport const clearEmphasizedOverriddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearEmphasizedElements(vp);\n emph.clearOverriddenElements(vp);\n};\n\nexport const clearAll = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearEmphasizedElements(vp);\n emph.clearOverriddenElements(vp);\n emph.clearHiddenElements(vp);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"viewerUtils.js","sourceRoot":"","sources":["../../../../src/widget/components/viewerUtils.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEnF,OAAO,EA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,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,EAAE;QACvC,OAAO;KACR;IACD,MAAM,EAAE,GAAG,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC;IAC9C,MAAM,IAAI,GAAG,iBAAiB,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAC/C,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IACjC,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;AAC/B,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 type { IModelConnection, ViewChangeOptions } from \"@itwin/core-frontend\";\nimport { EmphasizeElements, IModelApp } from \"@itwin/core-frontend\";\nimport type { FeatureAppearance } from \"@itwin/core-common\";\nimport { ColorDef, FeatureOverrideType, QueryRowFormat } from \"@itwin/core-common\";\nimport type { InstanceKey } from \"@itwin/presentation-common\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport { HiliteSetProvider } from \"@itwin/presentation-frontend\";\n\nexport const isolateElementsByKeys = async (\n keySet: KeySet,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n isolateElements(ids, replace);\n return ids;\n }\n return [];\n};\n\nexport const isolateElementsByQuery = async (\n query: string,\n iModelConnection: IModelConnection,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(query, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n isolateElements(ids, replace);\n return ids;\n }\n return [];\n};\n\nexport const isolateElements = (hilitedIds: string[], replace = false) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.isolateElements(hilitedIds, vp, replace);\n};\n\nexport const clearIsolatedElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearIsolatedElements(vp);\n};\n\nexport const hideElementsByQuery = async (\n query: string,\n iModelConnection: IModelConnection,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(query, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n hideElements(ids, replace);\n return ids;\n }\n return [];\n};\n\nexport const hideElements = (hilitedIds: string[], replace = false) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.hideElements(hilitedIds, vp, replace);\n};\n\nexport const clearHiddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearHiddenElements(vp);\n};\n\nexport const overrideElementsByQuery = async (\n iModelConnection: IModelConnection,\n query: string,\n color: string,\n overrideType = FeatureOverrideType.ColorOnly,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(query, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n overrideElements(ids, color, overrideType);\n return ids;\n }\n return [];\n};\n\nexport const overrideElements = (\n hilitedIds: string[],\n color: string,\n overrideType = FeatureOverrideType.ColorOnly,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.overrideElements(\n hilitedIds,\n vp,\n ColorDef.fromString(color),\n overrideType,\n true,\n );\n};\n\nexport const clearOverriddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearOverriddenElements(vp);\n};\n\nexport const emphasizeElements = (\n hilitedIds: string[],\n defaultAppearance: FeatureAppearance | undefined = undefined,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.wantEmphasis = true;\n emph.emphasizeElements(hilitedIds, vp, defaultAppearance, replace);\n};\n\nexport const emphasisElementsByQuery = async (\n iModelConnection: IModelConnection,\n query: string,\n defaultAppearance: FeatureAppearance | undefined = undefined,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(query, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n emphasizeElements(ids, defaultAppearance, replace);\n return ids;\n }\n return [];\n};\n\nexport const emphasizeElementsByKeys = async (\n keySet: KeySet,\n defaultAppearance: FeatureAppearance | undefined = undefined,\n replace = false,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n emphasizeElements(ids, defaultAppearance, replace);\n return ids;\n }\n return [];\n};\n\nexport const visualizeElementsByQuery = async (\n query: string,\n color: string,\n iModelConnection: IModelConnection,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(query, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n visualizeElements(ids, color, replace, wantEmphasis);\n return ids;\n }\n return [];\n};\n\nexport const visualizeElementsByKeys = async (\n keySet: KeySet,\n color: string,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n const ids = [...set.elements];\n visualizeElements(ids, color, replace, wantEmphasis);\n return ids;\n }\n return [];\n};\n\nexport const visualizeElements = (\n elementIds: string[],\n color: string,\n replace = false,\n wantEmphasis = true,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n\n emph.overrideElements(\n elementIds,\n vp,\n ColorDef.fromString(color),\n FeatureOverrideType.ColorAndAlpha,\n true,\n );\n if (!wantEmphasis) {\n return;\n }\n emph.wantEmphasis = true;\n emph.emphasizeElements(elementIds, vp, undefined, replace);\n};\n\nexport const transparentOverriddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n const ids = emph.getOverriddenElements()?.values();\n if (ids) {\n const toOverride = new Set<string>();\n Array.from(ids).forEach((a) => a.forEach((id) => toOverride.add(id)));\n emph.overrideElements(\n toOverride,\n vp,\n ColorDef.red.withAlpha(50),\n FeatureOverrideType.AlphaOnly,\n true,\n );\n }\n};\n\nexport const zoomToElements = async (elementIds: string[]) => {\n if (!IModelApp.viewManager.selectedView || elementIds.length === 0) {\n return;\n }\n\n const vp = IModelApp.viewManager.selectedView;\n const viewChangeOpts: ViewChangeOptions = {};\n viewChangeOpts.animateFrustumChange = true;\n // It was removed. Should be a prop to be passed to lookAtViewAlignedVolume within the implementation.\n // viewChangeOpts.marginPercent = new MarginPercent(0.1, 0.1, 0.1, 0.1);\n await vp.zoomToElements(elementIds, { ...viewChangeOpts });\n};\n\nexport const getHiliteIds = async (\n query: string,\n iModelConnection: IModelConnection,\n) => {\n if (!IModelApp.viewManager.selectedView) {\n return [];\n }\n\n const vp = IModelApp.viewManager.selectedView;\n\n const keySet = await manufactureKeys(query, iModelConnection);\n const hiliteProvider: HiliteSetProvider = HiliteSetProvider.create({\n imodel: vp.iModel,\n });\n const set = await hiliteProvider.getHiliteSet(keySet);\n if (set.elements) {\n return [...set.elements];\n }\n return [];\n};\n\nexport const manufactureKeys = async (\n query: string,\n iModelConnection: IModelConnection,\n): Promise<KeySet> => {\n if (query === \"\") {\n return new KeySet();\n }\n const queryWithIdAndECClassName = `SELECT q.ECInstanceId, ec_classname(e.ECClassId) FROM (${query}) q JOIN BisCore.Element e on e.ECInstanceId = q.ECInstanceId`;\n\n const rowIterator = iModelConnection.query(queryWithIdAndECClassName, undefined, {\n rowFormat: QueryRowFormat.UseECSqlPropertyIndexes,\n });\n\n const keys: InstanceKey[] = [];\n\n for await (const value of rowIterator) {\n keys.push({ id: value[0], className: value[1] });\n }\n\n return new KeySet(keys);\n};\n\nexport const clearEmphasizedElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearEmphasizedElements(vp);\n};\n\nexport const clearEmphasizedOverriddenElements = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearEmphasizedElements(vp);\n emph.clearOverriddenElements(vp);\n};\n\nexport const clearAll = () => {\n if (!IModelApp.viewManager.selectedView) {\n return;\n }\n const vp = IModelApp.viewManager.selectedView;\n const emph = EmphasizeElements.getOrCreate(vp);\n emph.clearEmphasizedElements(vp);\n emph.clearOverriddenElements(vp);\n emph.clearHiddenElements(vp);\n};\n"]}
|