@itwin/grouping-mapping-widget 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/widget/components/ConfirmMappingsImport.js +1 -1
- package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.js +50 -66
- package/lib/cjs/widget/components/GroupAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.scss +0 -18
- package/lib/cjs/widget/components/GroupDetails.d.ts +13 -0
- package/lib/cjs/widget/components/GroupDetails.js +34 -0
- package/lib/cjs/widget/components/GroupDetails.js.map +1 -0
- package/lib/cjs/widget/components/GroupDetailsActionPanel.d.ts +8 -0
- package/lib/cjs/widget/components/GroupDetailsActionPanel.js +19 -0
- package/lib/cjs/widget/components/GroupDetailsActionPanel.js.map +1 -0
- package/lib/cjs/widget/components/GroupDetailsStep.d.ts +13 -0
- package/lib/cjs/widget/components/GroupDetailsStep.js +25 -0
- package/lib/cjs/widget/components/GroupDetailsStep.js.map +1 -0
- package/lib/cjs/widget/components/GroupDetailsStep.scss +11 -0
- package/lib/cjs/widget/components/Grouping.js +1 -2
- package/lib/cjs/widget/components/Grouping.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMapping.js +1 -1
- package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMappingHeader.d.ts +1 -2
- package/lib/cjs/widget/components/GroupingMappingHeader.js +9 -2
- package/lib/cjs/widget/components/GroupingMappingHeader.js.map +1 -1
- package/lib/cjs/widget/components/Mapping.js +2 -3
- package/lib/cjs/widget/components/Mapping.js.map +1 -1
- package/lib/cjs/widget/components/MappingAction.js +1 -1
- package/lib/cjs/widget/components/MappingAction.js.map +1 -1
- package/lib/cjs/widget/components/MappingImportWizardModal.js +1 -1
- package/lib/cjs/widget/components/MappingImportWizardModal.js.map +1 -1
- package/lib/cjs/widget/components/PropertyAction.d.ts +8 -0
- package/lib/cjs/widget/components/PropertyAction.js +100 -0
- package/lib/cjs/widget/components/PropertyAction.js.map +1 -0
- package/lib/cjs/widget/components/PropertyAction.scss +9 -0
- package/lib/cjs/widget/components/QueryBuilder.d.ts +1 -1
- package/lib/cjs/widget/components/QueryBuilder.js +4 -4
- package/lib/cjs/widget/components/QueryBuilder.js.map +1 -1
- package/lib/cjs/widget/components/QueryBuilderActionPanel.d.ts +6 -0
- package/lib/cjs/widget/components/QueryBuilderActionPanel.js +17 -0
- package/lib/cjs/widget/components/QueryBuilderActionPanel.js.map +1 -0
- package/lib/cjs/widget/components/QueryBuilderCustomUI.d.ts +11 -0
- package/lib/cjs/widget/components/QueryBuilderCustomUI.js +27 -0
- package/lib/cjs/widget/components/QueryBuilderCustomUI.js.map +1 -0
- package/lib/cjs/widget/components/QueryBuilderStep.d.ts +16 -0
- package/lib/cjs/widget/components/QueryBuilderStep.js +30 -0
- package/lib/cjs/widget/components/QueryBuilderStep.js.map +1 -0
- package/lib/cjs/widget/components/QueryBuilderStep.scss +18 -0
- package/lib/cjs/widget/components/SelectMappings.js +1 -1
- package/lib/cjs/widget/components/SelectMappings.js.map +1 -1
- package/lib/cjs/widget/components/StatusIcon.d.ts +15 -0
- package/lib/cjs/widget/components/StatusIcon.js +26 -0
- package/lib/cjs/widget/components/StatusIcon.js.map +1 -0
- package/lib/cjs/widget/components/StatusIcon.scss +26 -0
- package/lib/cjs/widget/components/context/PropertyGridWrapperContext.d.ts +1 -3
- package/lib/cjs/widget/components/context/PropertyGridWrapperContext.js +0 -2
- package/lib/cjs/widget/components/context/PropertyGridWrapperContext.js.map +1 -1
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.d.ts +1 -1
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.js +51 -32
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.scss +25 -17
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js +1 -1
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.scss +1 -0
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js +1 -1
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.scss +1 -0
- package/lib/cjs/widget/components/utils.d.ts +1 -1
- package/lib/cjs/widget/components/utils.js.map +1 -1
- package/lib/esm/widget/components/ConfirmMappingsImport.js +1 -1
- package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.js +53 -69
- package/lib/esm/widget/components/GroupAction.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.scss +0 -18
- package/lib/esm/widget/components/GroupDetails.d.ts +13 -0
- package/lib/esm/widget/components/GroupDetails.js +27 -0
- package/lib/esm/widget/components/GroupDetails.js.map +1 -0
- package/lib/esm/widget/components/GroupDetailsActionPanel.d.ts +8 -0
- package/lib/esm/widget/components/GroupDetailsActionPanel.js +12 -0
- package/lib/esm/widget/components/GroupDetailsActionPanel.js.map +1 -0
- package/lib/esm/widget/components/GroupDetailsStep.d.ts +13 -0
- package/lib/esm/widget/components/GroupDetailsStep.js +18 -0
- package/lib/esm/widget/components/GroupDetailsStep.js.map +1 -0
- package/lib/esm/widget/components/GroupDetailsStep.scss +11 -0
- package/lib/esm/widget/components/Grouping.js +1 -2
- package/lib/esm/widget/components/Grouping.js.map +1 -1
- package/lib/esm/widget/components/GroupingMapping.js +1 -1
- package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
- package/lib/esm/widget/components/GroupingMappingHeader.d.ts +1 -2
- package/lib/esm/widget/components/GroupingMappingHeader.js +9 -2
- package/lib/esm/widget/components/GroupingMappingHeader.js.map +1 -1
- package/lib/esm/widget/components/Mapping.js +2 -3
- package/lib/esm/widget/components/Mapping.js.map +1 -1
- package/lib/esm/widget/components/MappingAction.js +1 -1
- package/lib/esm/widget/components/MappingAction.js.map +1 -1
- package/lib/esm/widget/components/MappingImportWizardModal.js +1 -1
- package/lib/esm/widget/components/MappingImportWizardModal.js.map +1 -1
- package/lib/esm/widget/components/PropertyAction.d.ts +8 -0
- package/lib/esm/widget/components/PropertyAction.js +77 -0
- package/lib/esm/widget/components/PropertyAction.js.map +1 -0
- package/lib/esm/widget/components/PropertyAction.scss +9 -0
- package/lib/esm/widget/components/QueryBuilder.d.ts +1 -1
- package/lib/esm/widget/components/QueryBuilder.js +4 -4
- package/lib/esm/widget/components/QueryBuilder.js.map +1 -1
- package/lib/esm/widget/components/QueryBuilderActionPanel.d.ts +6 -0
- package/lib/esm/widget/components/QueryBuilderActionPanel.js +10 -0
- package/lib/esm/widget/components/QueryBuilderActionPanel.js.map +1 -0
- package/lib/esm/widget/components/QueryBuilderCustomUI.d.ts +11 -0
- package/lib/esm/widget/components/QueryBuilderCustomUI.js +20 -0
- package/lib/esm/widget/components/QueryBuilderCustomUI.js.map +1 -0
- package/lib/esm/widget/components/QueryBuilderStep.d.ts +16 -0
- package/lib/esm/widget/components/QueryBuilderStep.js +23 -0
- package/lib/esm/widget/components/QueryBuilderStep.js.map +1 -0
- package/lib/esm/widget/components/QueryBuilderStep.scss +18 -0
- package/lib/esm/widget/components/SelectMappings.js +1 -1
- package/lib/esm/widget/components/SelectMappings.js.map +1 -1
- package/lib/esm/widget/components/StatusIcon.d.ts +15 -0
- package/lib/esm/widget/components/StatusIcon.js +19 -0
- package/lib/esm/widget/components/StatusIcon.js.map +1 -0
- package/lib/esm/widget/components/StatusIcon.scss +26 -0
- package/lib/esm/widget/components/context/PropertyGridWrapperContext.d.ts +1 -3
- package/lib/esm/widget/components/context/PropertyGridWrapperContext.js +0 -2
- package/lib/esm/widget/components/context/PropertyGridWrapperContext.js.map +1 -1
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.d.ts +1 -1
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.js +53 -34
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.js.map +1 -1
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.scss +25 -17
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js +2 -2
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -1
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.scss +1 -0
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js +2 -2
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -1
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.scss +1 -0
- package/lib/esm/widget/components/utils.d.ts +1 -1
- package/lib/esm/widget/components/utils.js.map +1 -1
- package/package.json +1 -1
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +0 -32
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js +0 -91
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.d.ts +0 -26
- package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.js +0 -62
- package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyGrid.d.ts +0 -67
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js +0 -198
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyGrid.scss +0 -71
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +0 -23
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +0 -77
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyList.d.ts +0 -69
- package/lib/cjs/widget/components/property-grid/PropertyList.js +0 -87
- package/lib/cjs/widget/components/property-grid/PropertyList.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyRender.d.ts +0 -92
- package/lib/cjs/widget/components/property-grid/PropertyRender.js +0 -109
- package/lib/cjs/widget/components/property-grid/PropertyRender.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyView.d.ts +0 -22
- package/lib/cjs/widget/components/property-grid/PropertyView.js +0 -232
- package/lib/cjs/widget/components/property-grid/PropertyView.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyView.scss +0 -77
- package/lib/cjs/widget/components/property-grid/countMatchesInString.d.ts +0 -8
- package/lib/cjs/widget/components/property-grid/countMatchesInString.js +0 -32
- package/lib/cjs/widget/components/property-grid/countMatchesInString.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/createNewDisplayValue.d.ts +0 -10
- package/lib/cjs/widget/components/property-grid/createNewDisplayValue.js +0 -65
- package/lib/cjs/widget/components/property-grid/createNewDisplayValue.js.map +0 -1
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +0 -32
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js +0 -68
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.d.ts +0 -26
- package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.js +0 -39
- package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyGrid.d.ts +0 -67
- package/lib/esm/widget/components/property-grid/PropertyGrid.js +0 -172
- package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyGrid.scss +0 -71
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +0 -23
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +0 -54
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyList.d.ts +0 -69
- package/lib/esm/widget/components/property-grid/PropertyList.js +0 -60
- package/lib/esm/widget/components/property-grid/PropertyList.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyRender.d.ts +0 -92
- package/lib/esm/widget/components/property-grid/PropertyRender.js +0 -86
- package/lib/esm/widget/components/property-grid/PropertyRender.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyView.d.ts +0 -22
- package/lib/esm/widget/components/property-grid/PropertyView.js +0 -209
- package/lib/esm/widget/components/property-grid/PropertyView.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyView.scss +0 -77
- package/lib/esm/widget/components/property-grid/countMatchesInString.d.ts +0 -8
- package/lib/esm/widget/components/property-grid/countMatchesInString.js +0 -28
- package/lib/esm/widget/components/property-grid/countMatchesInString.js.map +0 -1
- package/lib/esm/widget/components/property-grid/createNewDisplayValue.d.ts +0 -10
- package/lib/esm/widget/components/property-grid/createNewDisplayValue.js +0 -42
- package/lib/esm/widget/components/property-grid/createNewDisplayValue.js.map +0 -1
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import * as React from "react";
|
|
6
|
-
import { Orientation } from "@itwin/core-react";
|
|
7
|
-
import { PrimitivePropertyLabelRenderer } from "@itwin/components-react";
|
|
8
|
-
import { HighlightedText } from "@itwin/components-react/lib/cjs/components-react/common/HighlightedText";
|
|
9
|
-
import { PropertyView } from "./PropertyView";
|
|
10
|
-
import { CommonPropertyRenderer } from "@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer";
|
|
11
|
-
/** React Component that renders primitive properties
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
export class PrimitivePropertyRenderer extends React.Component {
|
|
15
|
-
/** @internal */
|
|
16
|
-
render() {
|
|
17
|
-
var _a, _b;
|
|
18
|
-
const { highlight, indentation, ...props } = this.props;
|
|
19
|
-
const displayLabel = this.props.propertyRecord.property.displayLabel;
|
|
20
|
-
const offset = CommonPropertyRenderer.getLabelOffset(indentation, props.orientation, props.width, props.columnRatio, (_a = props.columnInfo) === null || _a === void 0 ? void 0 : _a.minLabelWidth);
|
|
21
|
-
const activeMatchIndex = this.props.propertyRecord.property.name ===
|
|
22
|
-
((_b = highlight === null || highlight === void 0 ? void 0 : highlight.activeHighlight) === null || _b === void 0 ? void 0 : _b.highlightedItemIdentifier)
|
|
23
|
-
? highlight.activeHighlight.highlightIndex
|
|
24
|
-
: undefined;
|
|
25
|
-
const label = highlight
|
|
26
|
-
? HighlightedText({
|
|
27
|
-
text: displayLabel,
|
|
28
|
-
searchText: highlight.highlightedText,
|
|
29
|
-
activeMatchIndex,
|
|
30
|
-
})
|
|
31
|
-
: displayLabel;
|
|
32
|
-
return (React.createElement(PropertyView, { ...this.props, labelElement: React.createElement(PrimitivePropertyLabelRenderer
|
|
33
|
-
// Added offset to account for checkbox
|
|
34
|
-
, {
|
|
35
|
-
// Added offset to account for checkbox
|
|
36
|
-
offset: offset + 24, renderColon: this.props.orientation === Orientation.Horizontal, tooltip: displayLabel }, label) }));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=PrimitivePropertyRenderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PrimitivePropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PrimitivePropertyRenderer.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,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AAE,YAAY,IAEpB,KAAK,CACyB,GAEnC,CACH,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport { Orientation } from \"@itwin/core-react\";\nimport { PrimitivePropertyLabelRenderer } from \"@itwin/components-react\";\nimport type { HighlightingComponentProps } from \"@itwin/components-react/lib/cjs/components-react/common/HighlightingComponentProps\";\nimport { HighlightedText } from \"@itwin/components-react/lib/cjs/components-react/common/HighlightedText\";\n\nimport { PropertyView } from \"./PropertyView\";\nimport type { SharedRendererProps } from \"./PropertyRender\";\nimport { CommonPropertyRenderer } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer\";\n\n/** Properties of [[PrimitivePropertyRenderer]] React component\n * @public\n */\nexport interface PrimitiveRendererProps extends SharedRendererProps {\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 /** Properties used for highlighting\n * @beta\n */\n highlight?: HighlightingComponentProps;\n}\n\n/** React Component that renders primitive properties\n * @public\n */\nexport class PrimitivePropertyRenderer extends React.Component<PrimitiveRendererProps> {\n /** @internal */\n public override render() {\n const { highlight, indentation, ...props } = this.props;\n const displayLabel = this.props.propertyRecord.property.displayLabel;\n const offset = CommonPropertyRenderer.getLabelOffset(\n indentation,\n props.orientation,\n props.width,\n props.columnRatio,\n props.columnInfo?.minLabelWidth,\n );\n\n const activeMatchIndex =\n this.props.propertyRecord.property.name ===\n highlight?.activeHighlight?.highlightedItemIdentifier\n ? highlight.activeHighlight.highlightIndex\n : undefined;\n const label = highlight\n ? HighlightedText({\n text: displayLabel,\n searchText: highlight.highlightedText,\n activeMatchIndex,\n })\n : displayLabel;\n\n return (\n <PropertyView\n {...this.props}\n labelElement={\n <PrimitivePropertyLabelRenderer\n // Added offset to account for checkbox\n offset={offset + 24}\n renderColon={this.props.orientation === Orientation.Horizontal}\n tooltip={displayLabel}\n >\n {label}\n </PrimitivePropertyLabelRenderer>\n }\n />\n );\n }\n}\n"]}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import type { PropertyRecord } from "@itwin/appui-abstract";
|
|
3
|
-
import type { CommonPropertyGridProps, PropertyCategory } from "@itwin/components-react";
|
|
4
|
-
import { Orientation } from "@itwin/core-react";
|
|
5
|
-
import "./PropertyGrid.scss";
|
|
6
|
-
import type { PresentationPropertyDataProvider } from "@itwin/presentation-components";
|
|
7
|
-
/** Properties for [[PropertyGrid]] React component
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export interface PropertyGridProps extends CommonPropertyGridProps {
|
|
11
|
-
/** Property data provider */
|
|
12
|
-
dataProvider: PresentationPropertyDataProvider;
|
|
13
|
-
}
|
|
14
|
-
/** Property Category in the [[PropertyGrid]] state
|
|
15
|
-
* @public
|
|
16
|
-
* @deprecated This was part of [[PropertyGrid]] internal state and should've never been public. The component is not using it anymore.
|
|
17
|
-
*/
|
|
18
|
-
export interface PropertyGridCategory {
|
|
19
|
-
propertyCategory: PropertyCategory;
|
|
20
|
-
propertyCount: number;
|
|
21
|
-
properties: PropertyRecord[];
|
|
22
|
-
}
|
|
23
|
-
interface CategorizedPropertyGridRecords {
|
|
24
|
-
category: PropertyCategory;
|
|
25
|
-
records: PropertyRecord[];
|
|
26
|
-
children: CategorizedPropertyGridRecords[];
|
|
27
|
-
}
|
|
28
|
-
/** State of [[PropertyGrid]] React component
|
|
29
|
-
* @internal
|
|
30
|
-
*/
|
|
31
|
-
interface PropertyGridState {
|
|
32
|
-
/** List of PropertyGrid categories */
|
|
33
|
-
categories: CategorizedPropertyGridRecords[];
|
|
34
|
-
/** Actual orientation used by the property grid */
|
|
35
|
-
orientation: Orientation;
|
|
36
|
-
/** If property grid currently loading data, the loading start time */
|
|
37
|
-
loadStart?: Date;
|
|
38
|
-
/** Width of PropertyGrid */
|
|
39
|
-
width: number;
|
|
40
|
-
}
|
|
41
|
-
/** PropertyGrid React component.
|
|
42
|
-
* @public
|
|
43
|
-
*/
|
|
44
|
-
export declare class PropertyGrid extends React.Component<PropertyGridProps, PropertyGridState> {
|
|
45
|
-
private _dataChangesListenerDisposeFunc?;
|
|
46
|
-
private _isMounted;
|
|
47
|
-
private _isInDataRequest;
|
|
48
|
-
private _hasPendingDataRequest;
|
|
49
|
-
static contextType: React.Context<import("../context/PropertyGridWrapperContext").PropertySelection>;
|
|
50
|
-
/** @internal */
|
|
51
|
-
constructor(props: PropertyGridProps);
|
|
52
|
-
/** @internal */
|
|
53
|
-
componentDidMount(): void;
|
|
54
|
-
/** @internal */
|
|
55
|
-
componentWillUnmount(): void;
|
|
56
|
-
componentDidUpdate(prevProps: PropertyGridProps): void;
|
|
57
|
-
private _onPropertyDataChanged;
|
|
58
|
-
private gatherData;
|
|
59
|
-
private getPreferredOrientation;
|
|
60
|
-
private _onResize;
|
|
61
|
-
private _onCategoryExpansionToggled;
|
|
62
|
-
private updateOrientation;
|
|
63
|
-
/** @internal */
|
|
64
|
-
render(): JSX.Element;
|
|
65
|
-
}
|
|
66
|
-
export {};
|
|
67
|
-
//# sourceMappingURL=PropertyGrid.d.ts.map
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import classnames from "classnames";
|
|
6
|
-
import { produce } from "immer";
|
|
7
|
-
import * as React from "react";
|
|
8
|
-
import { PropertyCategoryBlock, PropertyGridCommons, PropertyGridEventsRelatedPropsSupplier, } from "@itwin/components-react";
|
|
9
|
-
import { ColumnResizingPropertyListPropsSupplier } from "@itwin/components-react/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier";
|
|
10
|
-
import { Orientation, ResizableContainerObserver } from "@itwin/core-react";
|
|
11
|
-
import { PropertyList } from "./PropertyList";
|
|
12
|
-
import "./PropertyGrid.scss";
|
|
13
|
-
import { PropertyGridWrapperContext } from "../context/PropertyGridWrapperContext";
|
|
14
|
-
import { ProgressRadial } from "@itwin/itwinui-react";
|
|
15
|
-
/** PropertyGrid React component.
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
export class PropertyGrid extends React.Component {
|
|
19
|
-
/** @internal */
|
|
20
|
-
constructor(props) {
|
|
21
|
-
super(props);
|
|
22
|
-
this._isMounted = false;
|
|
23
|
-
this._isInDataRequest = false;
|
|
24
|
-
this._hasPendingDataRequest = false;
|
|
25
|
-
this._onPropertyDataChanged = () => {
|
|
26
|
-
void this.gatherData();
|
|
27
|
-
};
|
|
28
|
-
this._onResize = (width) => {
|
|
29
|
-
this.updateOrientation(width);
|
|
30
|
-
};
|
|
31
|
-
this._onCategoryExpansionToggled = (categoryName) => {
|
|
32
|
-
this.setState((state) => {
|
|
33
|
-
return produce(state, (draft) => {
|
|
34
|
-
const records = findCategory(draft.categories, categoryName, true);
|
|
35
|
-
// istanbul ignore else
|
|
36
|
-
if (records) {
|
|
37
|
-
const category = records.category;
|
|
38
|
-
category.expand = !category.expand;
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
this.state = {
|
|
44
|
-
categories: [],
|
|
45
|
-
orientation: this.getPreferredOrientation(),
|
|
46
|
-
width: 0,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
/** @internal */
|
|
50
|
-
componentDidMount() {
|
|
51
|
-
this._isMounted = true;
|
|
52
|
-
this._dataChangesListenerDisposeFunc =
|
|
53
|
-
this.props.dataProvider.onDataChanged.addListener(this._onPropertyDataChanged);
|
|
54
|
-
void this.gatherData();
|
|
55
|
-
}
|
|
56
|
-
/** @internal */
|
|
57
|
-
componentWillUnmount() {
|
|
58
|
-
// istanbul ignore else
|
|
59
|
-
if (this._dataChangesListenerDisposeFunc) {
|
|
60
|
-
this._dataChangesListenerDisposeFunc();
|
|
61
|
-
this._dataChangesListenerDisposeFunc = undefined;
|
|
62
|
-
}
|
|
63
|
-
this._isMounted = false;
|
|
64
|
-
}
|
|
65
|
-
componentDidUpdate(prevProps) {
|
|
66
|
-
if (this.props.dataProvider !== prevProps.dataProvider) {
|
|
67
|
-
// istanbul ignore else
|
|
68
|
-
if (this._dataChangesListenerDisposeFunc) {
|
|
69
|
-
this._dataChangesListenerDisposeFunc();
|
|
70
|
-
}
|
|
71
|
-
this._dataChangesListenerDisposeFunc =
|
|
72
|
-
this.props.dataProvider.onDataChanged.addListener(this._onPropertyDataChanged);
|
|
73
|
-
void this.gatherData();
|
|
74
|
-
}
|
|
75
|
-
if (this.props.orientation !== prevProps.orientation ||
|
|
76
|
-
this.props.isOrientationFixed !== prevProps.isOrientationFixed ||
|
|
77
|
-
this.props.horizontalOrientationMinWidth !==
|
|
78
|
-
prevProps.horizontalOrientationMinWidth) {
|
|
79
|
-
this.updateOrientation(this.state.width);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
async gatherData() {
|
|
83
|
-
if (this._isInDataRequest) {
|
|
84
|
-
this._hasPendingDataRequest = true;
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
this.setState((prev) => prev.loadStart ? null : { loadStart: new Date() });
|
|
88
|
-
this._isInDataRequest = true;
|
|
89
|
-
let propertyData;
|
|
90
|
-
try {
|
|
91
|
-
propertyData = await this.props.dataProvider.getData();
|
|
92
|
-
}
|
|
93
|
-
finally {
|
|
94
|
-
this._isInDataRequest = false;
|
|
95
|
-
}
|
|
96
|
-
if (!this._isMounted) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (this._hasPendingDataRequest) {
|
|
100
|
-
this._hasPendingDataRequest = false;
|
|
101
|
-
return this.gatherData();
|
|
102
|
-
}
|
|
103
|
-
this.setState((prevState) => {
|
|
104
|
-
const buildCategoriesHierarchy = (newCategories, stateCategories) => newCategories.map((category) => {
|
|
105
|
-
var _a, _b, _c, _d;
|
|
106
|
-
const matchingStateCategory = findCategory(stateCategories !== null && stateCategories !== void 0 ? stateCategories : [], category.name, false);
|
|
107
|
-
return {
|
|
108
|
-
category: {
|
|
109
|
-
...category,
|
|
110
|
-
expand: (_b = (_a = matchingStateCategory === null || matchingStateCategory === void 0 ? void 0 : matchingStateCategory.category) === null || _a === void 0 ? void 0 : _a.expand) !== null && _b !== void 0 ? _b : category.expand,
|
|
111
|
-
},
|
|
112
|
-
records: (_c = propertyData.records[category.name]) !== null && _c !== void 0 ? _c : [],
|
|
113
|
-
children: buildCategoriesHierarchy((_d = category.childCategories) !== null && _d !== void 0 ? _d : [], matchingStateCategory === null || matchingStateCategory === void 0 ? void 0 : matchingStateCategory.children),
|
|
114
|
-
};
|
|
115
|
-
});
|
|
116
|
-
return {
|
|
117
|
-
categories: buildCategoriesHierarchy(propertyData.categories, prevState.categories),
|
|
118
|
-
loadStart: undefined,
|
|
119
|
-
};
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
getPreferredOrientation() {
|
|
123
|
-
return this.props.orientation !== undefined
|
|
124
|
-
? this.props.orientation
|
|
125
|
-
: Orientation.Horizontal;
|
|
126
|
-
}
|
|
127
|
-
updateOrientation(width) {
|
|
128
|
-
const { orientation, isOrientationFixed, horizontalOrientationMinWidth } = {
|
|
129
|
-
...this.props,
|
|
130
|
-
};
|
|
131
|
-
const currentOrientation = PropertyGridCommons.getCurrentOrientation(width, orientation, isOrientationFixed, horizontalOrientationMinWidth);
|
|
132
|
-
if (currentOrientation !== this.state.orientation ||
|
|
133
|
-
width !== this.state.width) {
|
|
134
|
-
this.setState({ orientation: currentOrientation, width });
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
/** @internal */
|
|
138
|
-
render() {
|
|
139
|
-
var _a, _b;
|
|
140
|
-
if (this.state.loadStart) {
|
|
141
|
-
return (React.createElement("div", { className: "gmw-components-property-grid-loader" },
|
|
142
|
-
React.createElement(ProgressRadial, { indeterminate: true })));
|
|
143
|
-
}
|
|
144
|
-
return (React.createElement("div", { className: "gmw-table-box-inner" },
|
|
145
|
-
React.createElement(PropertyGridEventsRelatedPropsSupplier, { isPropertySelectionEnabled: (_a = this.props.isPropertySelectionEnabled) !== null && _a !== void 0 ? _a : false, isPropertySelectionOnRightClickEnabled: this.props.isPropertySelectionOnRightClickEnabled, isPropertyEditingEnabled: this.props.isPropertyEditingEnabled, isPropertyHoverEnabled: (_b = this.props.isPropertyHoverEnabled) !== null && _b !== void 0 ? _b : false, onPropertyContextMenu: this.props.onPropertyContextMenu, onPropertyUpdated: this.props.onPropertyUpdated, onPropertySelectionChanged: this.props.onPropertySelectionChanged }, (selectionContext) => (React.createElement("div", { className: classnames("gmw-components-property-grid-wrapper", this.props.className), style: this.props.style },
|
|
146
|
-
React.createElement("div", { className: classnames("gmw-components-property-grid", "components-smallEditor-host") },
|
|
147
|
-
React.createElement("div", { className: "gmw-property-categories" }, this.state.categories.map((categorizedRecords) => (React.createElement(NestedCategoryBlock, { ...selectionContext, key: categorizedRecords.category.name, categorizedRecords: categorizedRecords, onCategoryExpansionToggled: this._onCategoryExpansionToggled, orientation: this.state.orientation, propertyValueRendererManager: this.props.propertyValueRendererManager, actionButtonRenderers: this.props.actionButtonRenderers }))))),
|
|
148
|
-
React.createElement(ResizableContainerObserver, { onResize: this._onResize }))))));
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
PropertyGrid.contextType = PropertyGridWrapperContext;
|
|
152
|
-
function findCategory(categories, lookupName, recurseIntoChildren) {
|
|
153
|
-
for (const category of categories) {
|
|
154
|
-
if (category.category.name === lookupName) {
|
|
155
|
-
return category;
|
|
156
|
-
}
|
|
157
|
-
if (recurseIntoChildren) {
|
|
158
|
-
const matchingChild = findCategory(category.children, lookupName, recurseIntoChildren);
|
|
159
|
-
if (matchingChild) {
|
|
160
|
-
return matchingChild;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return undefined;
|
|
165
|
-
}
|
|
166
|
-
const NestedCategoryBlock = (props) => {
|
|
167
|
-
const [width, setWidth] = React.useState(1);
|
|
168
|
-
return (React.createElement(PropertyCategoryBlock, { category: props.categorizedRecords.category, onExpansionToggled: props.onCategoryExpansionToggled },
|
|
169
|
-
props.categorizedRecords.records.length ? (React.createElement(ColumnResizingPropertyListPropsSupplier, { orientation: props.orientation, width: width }, (partialListProps) => (React.createElement(PropertyList, { ...partialListProps, orientation: props.orientation, category: props.categorizedRecords.category, properties: props.categorizedRecords.records, selectedPropertyKey: props.selectedPropertyKey, onPropertyClicked: props.onPropertyClicked, onPropertyRightClicked: props.onPropertyRightClicked, onPropertyContextMenu: props.onPropertyContextMenu, propertyValueRendererManager: props.propertyValueRendererManager, editingPropertyKey: props.editingPropertyKey, onEditCommit: props.onEditCommit, onEditCancel: props.onEditCancel, isPropertyHoverEnabled: props.isPropertyHoverEnabled, isPropertySelectionEnabled: props.isPropertySelectionEnabled, isPropertyRightClickSelectionEnabled: props.isPropertyRightClickSelectionEnabled, actionButtonRenderers: props.actionButtonRenderers, setWidth: setWidth, width: width })))) : undefined,
|
|
170
|
-
props.categorizedRecords.children.length ? (React.createElement("div", { className: "gmw-property-categories" }, props.categorizedRecords.children.map((categorizedChildRecords) => (React.createElement(NestedCategoryBlock, { ...props, key: categorizedChildRecords.category.name, categorizedRecords: categorizedChildRecords }))))) : undefined));
|
|
171
|
-
};
|
|
172
|
-
//# sourceMappingURL=PropertyGrid.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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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AAW,EAAE,KAAK,CAAC,WAAW,EAC9B,QAAQ,EAAE,KAAK,CAAC,kBAAkB,CAAC,QAAQ,EAC3C,UAAU,EAAE,KAAK,CAAC,kBAAkB,CAAC,OAAO,EAC5C,mBAAmB,EAAE,KAAK,CAAC,mBAAmB,EAC9C,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,EAC1C,sBAAsB,EAAE,KAAK,CAAC,sBAAsB,EACpD,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,EAClD,4BAA4B,EAAE,KAAK,CAAC,4BAA4B,EAChE,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAC5C,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,sBAAsB,EAAE,KAAK,CAAC,sBAAsB,EACpD,0BAA0B,EAAE,KAAK,CAAC,0BAA0B,EAC5D,oCAAoC,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,71 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
@import '~@itwin/core-react/lib/cjs/core-react/expandable/list';
|
|
6
|
-
@import '~@itwin/core-react/lib/cjs/core-react/scrollbar';
|
|
7
|
-
|
|
8
|
-
.gmw-components-property-grid-loader {
|
|
9
|
-
display: flex;
|
|
10
|
-
justify-content: center;
|
|
11
|
-
align-items: center;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.gmw-components-property-grid {
|
|
15
|
-
.gmw-property-categories {
|
|
16
|
-
@include uicore-expandable-blocks-list;
|
|
17
|
-
|
|
18
|
-
display: grid;
|
|
19
|
-
grid-row-gap: 6px;
|
|
20
|
-
padding: 3px;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
padding-top: 6px;
|
|
24
|
-
padding-bottom: 6px;
|
|
25
|
-
|
|
26
|
-
user-select: none;
|
|
27
|
-
color: $buic-foreground-body;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.gmw-components-property-grid-wrapper {
|
|
31
|
-
width: 100%;
|
|
32
|
-
height: 100%;
|
|
33
|
-
overflow-y: auto;
|
|
34
|
-
|
|
35
|
-
@include uicore-touch-scrolling;
|
|
36
|
-
@include uicore-scrollbar();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@mixin gmw-components-property-list {
|
|
40
|
-
width: 100%;
|
|
41
|
-
|
|
42
|
-
.gmw-components--selected {
|
|
43
|
-
background-color: $buic-row-selection;
|
|
44
|
-
outline: 1px solid $buic-foreground-primary;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.gmw-components--clickable {
|
|
48
|
-
cursor: pointer;
|
|
49
|
-
|
|
50
|
-
&:hover {
|
|
51
|
-
background: $buic-row-hover;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.gmw-components--hoverable:hover {
|
|
56
|
-
background-color: $buic-row-hover;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.gmw-components-property-list--horizontal {
|
|
61
|
-
@include gmw-components-property-list;
|
|
62
|
-
|
|
63
|
-
display: grid;
|
|
64
|
-
grid-row-gap: 0px;
|
|
65
|
-
overflow: hidden;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.gmw-components-property-list--vertical {
|
|
69
|
-
@include gmw-components-property-list;
|
|
70
|
-
// margin-top: -13px;
|
|
71
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { PresentationPropertyDataProvider } from "@itwin/presentation-components";
|
|
3
|
-
import "../customUI/GroupQueryBuilderCustomUI.scss";
|
|
4
|
-
import type { KeySet } from "@itwin/presentation-common";
|
|
5
|
-
import type { IModelConnection } from "@itwin/core-frontend";
|
|
6
|
-
interface PropertyGridWrapperState {
|
|
7
|
-
dataProvider?: PresentationPropertyDataProvider;
|
|
8
|
-
}
|
|
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>;
|
|
15
|
-
constructor(props: PropertyProps | Readonly<PropertyProps>);
|
|
16
|
-
private createPropertyDataProvider;
|
|
17
|
-
private createDataProvider;
|
|
18
|
-
componentDidMount(): void;
|
|
19
|
-
componentDidUpdate(prevProps: PropertyProps): void;
|
|
20
|
-
render(): JSX.Element;
|
|
21
|
-
}
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=PropertyGridWrapper.d.ts.map
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import * as React from "react";
|
|
6
|
-
import { DEFAULT_PROPERTY_GRID_RULESET, PresentationPropertyDataProvider } from "@itwin/presentation-components";
|
|
7
|
-
import { PropertyGrid } from "./PropertyGrid";
|
|
8
|
-
import "../customUI/GroupQueryBuilderCustomUI.scss";
|
|
9
|
-
import { PropertyGridWrapperContext } from "../context/PropertyGridWrapperContext";
|
|
10
|
-
import { QueryBuilder } from "../QueryBuilder";
|
|
11
|
-
/* This approach uses PresentationPropertyDataProvider to all the work of querying the backend and
|
|
12
|
-
providing the content to the PropertyGrid component. */
|
|
13
|
-
export class PropertyGridWrapper extends React.Component {
|
|
14
|
-
constructor(props) {
|
|
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
|
-
};
|
|
25
|
-
this.state = {};
|
|
26
|
-
}
|
|
27
|
-
createDataProvider() {
|
|
28
|
-
if (!this.props.imodel || this.props.keys.isEmpty) {
|
|
29
|
-
this.setState({ dataProvider: undefined });
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
const dataProvider = this.createPropertyDataProvider(this.props.keys, this.props.imodel);
|
|
33
|
-
this.context.setQueryBuilder(new QueryBuilder(dataProvider));
|
|
34
|
-
this.setState({ dataProvider });
|
|
35
|
-
}
|
|
36
|
-
componentDidMount() {
|
|
37
|
-
this.createDataProvider();
|
|
38
|
-
}
|
|
39
|
-
componentDidUpdate(prevProps) {
|
|
40
|
-
if (prevProps.keys === this.props.keys) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
this.createDataProvider();
|
|
44
|
-
}
|
|
45
|
-
render() {
|
|
46
|
-
const dataProvider = this.state.dataProvider;
|
|
47
|
-
return (React.createElement(React.Fragment, null,
|
|
48
|
-
dataProvider && React.createElement(PropertyGrid, { dataProvider: dataProvider }),
|
|
49
|
-
!dataProvider && (React.createElement("div", { className: "gmw-select-element-hint" },
|
|
50
|
-
React.createElement("span", null, "Select an element to see its properties.")))));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
PropertyGridWrapper.contextType = PropertyGridWrapperContext;
|
|
54
|
-
//# sourceMappingURL=PropertyGridWrapper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,4CAA4C,CAAC;AACpD,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 \"../customUI/GroupQueryBuilderCustomUI.scss\";\nimport { PropertyGridWrapperContext } from \"../context/PropertyGridWrapperContext\";\nimport { QueryBuilder } from \"../QueryBuilder\";\nimport type { KeySet } from \"@itwin/presentation-common\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\n\ninterface PropertyGridWrapperState {\n dataProvider?: PresentationPropertyDataProvider;\n}\n\ninterface PropertyProps {\n keys: KeySet;\n imodel?: IModelConnection;\n}\n\n/* This approach uses PresentationPropertyDataProvider to all the work of querying the backend and\n providing the content to the PropertyGrid component. */\nexport class PropertyGridWrapper extends React.Component<\nPropertyProps,\nPropertyGridWrapperState\n> {\n static override contextType = PropertyGridWrapperContext;\n constructor(props: PropertyProps | Readonly<PropertyProps>) {\n super(props);\n this.state = {};\n }\n\n private createPropertyDataProvider = (keys: KeySet, imodel: IModelConnection): PresentationPropertyDataProvider => {\n const dataProvider = new PresentationPropertyDataProvider({\n imodel,\n ruleset: DEFAULT_PROPERTY_GRID_RULESET,\n });\n dataProvider.keys = keys;\n dataProvider.isNestedPropertyCategoryGroupingEnabled = true;\n return dataProvider;\n }\n\n private createDataProvider() {\n if (!this.props.imodel || this.props.keys.isEmpty) {\n this.setState({ dataProvider: undefined });\n return;\n }\n\n const dataProvider = this.createPropertyDataProvider(\n this.props.keys,\n this.props.imodel\n );\n this.context.setQueryBuilder(new QueryBuilder(dataProvider));\n\n this.setState({ dataProvider });\n }\n\n public override componentDidMount() {\n this.createDataProvider();\n }\n\n public override componentDidUpdate(prevProps: PropertyProps) {\n if (prevProps.keys === this.props.keys) {\n return;\n }\n\n this.createDataProvider();\n }\n\n public override render() {\n const dataProvider = this.state.dataProvider;\n return (\n <>\n {dataProvider && <PropertyGrid dataProvider={dataProvider} />}\n {!dataProvider && (\n <div className=\"gmw-select-element-hint\">\n <span>Select an element to see its properties.</span>\n </div>\n )}\n </>\n );\n }\n}\n"]}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module PropertyGrid
|
|
3
|
-
*/
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
import type { PropertyRecord } from "@itwin/appui-abstract";
|
|
6
|
-
import type { CommonProps, RatioChangeResult } from "@itwin/core-react";
|
|
7
|
-
import { Orientation } from "@itwin/core-react";
|
|
8
|
-
import type { ActionButtonRenderer, PropertyCategory, PropertyUpdatedArgs, PropertyValueRendererManager } from "@itwin/components-react";
|
|
9
|
-
import type { PropertyGridColumnInfo } from "@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns";
|
|
10
|
-
/** Properties of [[PropertyList]] React component
|
|
11
|
-
* @public
|
|
12
|
-
*/
|
|
13
|
-
export interface PropertyListProps extends CommonProps {
|
|
14
|
-
orientation: Orientation;
|
|
15
|
-
category?: PropertyCategory;
|
|
16
|
-
properties: PropertyRecord[];
|
|
17
|
-
selectedPropertyKey?: string;
|
|
18
|
-
onPropertyClicked?: (property: PropertyRecord, key?: string) => void;
|
|
19
|
-
onPropertyRightClicked?: (property: PropertyRecord, key?: string) => void;
|
|
20
|
-
onPropertyContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;
|
|
21
|
-
columnRatio?: number;
|
|
22
|
-
/** Callback to column ratio changed event */
|
|
23
|
-
onColumnChanged?: (ratio: number) => void | RatioChangeResult;
|
|
24
|
-
propertyValueRendererManager?: PropertyValueRendererManager;
|
|
25
|
-
editingPropertyKey?: string;
|
|
26
|
-
onEditCommit?: (args: PropertyUpdatedArgs, category: PropertyCategory) => void;
|
|
27
|
-
onEditCancel?: () => void;
|
|
28
|
-
/** Enables/disables property hovering effect */
|
|
29
|
-
isPropertyHoverEnabled?: boolean;
|
|
30
|
-
/** Enables/disables property selection */
|
|
31
|
-
isPropertySelectionEnabled?: boolean;
|
|
32
|
-
/** Enables/disables property right click selection */
|
|
33
|
-
isPropertyRightClickSelectionEnabled?: boolean;
|
|
34
|
-
/** Array of action button renderers */
|
|
35
|
-
actionButtonRenderers?: ActionButtonRenderer[];
|
|
36
|
-
/** Is resize handle hovered */
|
|
37
|
-
isResizeHandleHovered?: boolean;
|
|
38
|
-
/** Callback to hover event change */
|
|
39
|
-
onResizeHandleHoverChanged?: (isHovered: boolean) => void;
|
|
40
|
-
/** Is resize handle being dragged */
|
|
41
|
-
isResizeHandleBeingDragged?: boolean;
|
|
42
|
-
/** Callback to drag event change */
|
|
43
|
-
onResizeHandleDragChanged?: (isDragStarted: boolean) => void;
|
|
44
|
-
/** Information for styling property grid columns */
|
|
45
|
-
columnInfo?: PropertyGridColumnInfo;
|
|
46
|
-
setWidth?: React.Dispatch<React.SetStateAction<number>>;
|
|
47
|
-
width: number;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Get unique key for property record
|
|
51
|
-
* @internal
|
|
52
|
-
*/
|
|
53
|
-
export declare function getPropertyKey(propertyCategory: PropertyCategory, propertyRecord: PropertyRecord): string;
|
|
54
|
-
/** A React component that renders multiple properties within a category as a list.
|
|
55
|
-
* @public
|
|
56
|
-
*/
|
|
57
|
-
export declare class PropertyList extends React.Component<PropertyListProps> {
|
|
58
|
-
constructor(props: PropertyListProps);
|
|
59
|
-
private _listRef;
|
|
60
|
-
private _onEditCommit;
|
|
61
|
-
private afterRender;
|
|
62
|
-
/** @internal */
|
|
63
|
-
componentDidMount(): void;
|
|
64
|
-
/** @internal */
|
|
65
|
-
componentDidUpdate(): void;
|
|
66
|
-
/** @internal */
|
|
67
|
-
render(): JSX.Element;
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=PropertyList.d.ts.map
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
/** @packageDocumentation
|
|
6
|
-
* @module PropertyGrid
|
|
7
|
-
*/
|
|
8
|
-
import classnames from "classnames";
|
|
9
|
-
import * as React from "react";
|
|
10
|
-
import { PropertyValueFormat } from "@itwin/appui-abstract";
|
|
11
|
-
import { Orientation } from "@itwin/core-react";
|
|
12
|
-
import { PropertyRenderer } from "./PropertyRender";
|
|
13
|
-
/**
|
|
14
|
-
* Get unique key for property record
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
export function getPropertyKey(propertyCategory, propertyRecord) {
|
|
18
|
-
return propertyCategory.name + propertyRecord.property.name;
|
|
19
|
-
}
|
|
20
|
-
/** A React component that renders multiple properties within a category as a list.
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
export class PropertyList extends React.Component {
|
|
24
|
-
constructor(props) {
|
|
25
|
-
super(props);
|
|
26
|
-
this._listRef = React.createRef();
|
|
27
|
-
this._onEditCommit = (args) => {
|
|
28
|
-
// istanbul ignore else
|
|
29
|
-
if (this.props.onEditCommit && this.props.category)
|
|
30
|
-
this.props.onEditCommit(args, this.props.category);
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
afterRender() {
|
|
34
|
-
if (this.props.orientation !== Orientation.Horizontal ||
|
|
35
|
-
!this._listRef.current) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const width = this._listRef.current.getBoundingClientRect().width;
|
|
39
|
-
if (this.props.setWidth && width !== this.props.width) {
|
|
40
|
-
this.props.setWidth(width);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/** @internal */
|
|
44
|
-
componentDidMount() {
|
|
45
|
-
this.afterRender();
|
|
46
|
-
}
|
|
47
|
-
/** @internal */
|
|
48
|
-
componentDidUpdate() {
|
|
49
|
-
this.afterRender();
|
|
50
|
-
}
|
|
51
|
-
/** @internal */
|
|
52
|
-
render() {
|
|
53
|
-
const propertyListClassName = classnames((this.props.orientation === Orientation.Horizontal) ? "gmw-components-property-list--horizontal" : "gmw-components-property-list--vertical", this.props.className);
|
|
54
|
-
return (React.createElement("div", { className: propertyListClassName, style: this.props.style, ref: this._listRef }, this.props.properties.map((propertyRecord) => {
|
|
55
|
-
const key = this.props.category ? getPropertyKey(this.props.category, propertyRecord) : propertyRecord.property.name;
|
|
56
|
-
return (React.createElement(PropertyRenderer, { key: key, uniqueKey: key, isHoverable: this.props.isPropertyHoverEnabled, isSelectable: this.props.isPropertySelectionEnabled, isSelected: key === this.props.selectedPropertyKey, propertyRecord: propertyRecord, orientation: this.props.orientation, onClick: propertyRecord.value.valueFormat === PropertyValueFormat.Primitive ? this.props.onPropertyClicked : undefined, onRightClick: propertyRecord.value.valueFormat === PropertyValueFormat.Primitive ? this.props.onPropertyRightClicked : undefined, onContextMenu: this.props.onPropertyContextMenu, columnRatio: this.props.columnRatio, onColumnRatioChanged: this.props.onColumnChanged, propertyValueRendererManager: this.props.propertyValueRendererManager, isEditing: key === this.props.editingPropertyKey, onEditCommit: this._onEditCommit, onEditCancel: this.props.onEditCancel, actionButtonRenderers: this.props.actionButtonRenderers, isResizeHandleHovered: this.props.isResizeHandleHovered, onResizeHandleHoverChanged: this.props.onResizeHandleHoverChanged, isResizeHandleBeingDragged: this.props.isResizeHandleBeingDragged, onResizeHandleDragChanged: this.props.onResizeHandleDragChanged, columnInfo: this.props.columnInfo, width: this.props.width }));
|
|
57
|
-
})));
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=PropertyList.js.map
|