@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,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.PropertyGridWrapper = void 0;
|
|
23
|
-
/*---------------------------------------------------------------------------------------------
|
|
24
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
|
-
*--------------------------------------------------------------------------------------------*/
|
|
27
|
-
const React = __importStar(require("react"));
|
|
28
|
-
const presentation_components_1 = require("@itwin/presentation-components");
|
|
29
|
-
const PropertyGrid_1 = require("./PropertyGrid");
|
|
30
|
-
require("../customUI/GroupQueryBuilderCustomUI.scss");
|
|
31
|
-
const PropertyGridWrapperContext_1 = require("../context/PropertyGridWrapperContext");
|
|
32
|
-
const QueryBuilder_1 = require("../QueryBuilder");
|
|
33
|
-
/* This approach uses PresentationPropertyDataProvider to all the work of querying the backend and
|
|
34
|
-
providing the content to the PropertyGrid component. */
|
|
35
|
-
class PropertyGridWrapper extends React.Component {
|
|
36
|
-
constructor(props) {
|
|
37
|
-
super(props);
|
|
38
|
-
this.createPropertyDataProvider = (keys, imodel) => {
|
|
39
|
-
const dataProvider = new presentation_components_1.PresentationPropertyDataProvider({
|
|
40
|
-
imodel,
|
|
41
|
-
ruleset: presentation_components_1.DEFAULT_PROPERTY_GRID_RULESET,
|
|
42
|
-
});
|
|
43
|
-
dataProvider.keys = keys;
|
|
44
|
-
dataProvider.isNestedPropertyCategoryGroupingEnabled = true;
|
|
45
|
-
return dataProvider;
|
|
46
|
-
};
|
|
47
|
-
this.state = {};
|
|
48
|
-
}
|
|
49
|
-
createDataProvider() {
|
|
50
|
-
if (!this.props.imodel || this.props.keys.isEmpty) {
|
|
51
|
-
this.setState({ dataProvider: undefined });
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const dataProvider = this.createPropertyDataProvider(this.props.keys, this.props.imodel);
|
|
55
|
-
this.context.setQueryBuilder(new QueryBuilder_1.QueryBuilder(dataProvider));
|
|
56
|
-
this.setState({ dataProvider });
|
|
57
|
-
}
|
|
58
|
-
componentDidMount() {
|
|
59
|
-
this.createDataProvider();
|
|
60
|
-
}
|
|
61
|
-
componentDidUpdate(prevProps) {
|
|
62
|
-
if (prevProps.keys === this.props.keys) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
this.createDataProvider();
|
|
66
|
-
}
|
|
67
|
-
render() {
|
|
68
|
-
const dataProvider = this.state.dataProvider;
|
|
69
|
-
return (React.createElement(React.Fragment, null,
|
|
70
|
-
dataProvider && React.createElement(PropertyGrid_1.PropertyGrid, { dataProvider: dataProvider }),
|
|
71
|
-
!dataProvider && (React.createElement("div", { className: "gmw-select-element-hint" },
|
|
72
|
-
React.createElement("span", null, "Select an element to see its properties.")))));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
exports.PropertyGridWrapper = PropertyGridWrapper;
|
|
76
|
-
PropertyGridWrapper.contextType = PropertyGridWrapperContext_1.PropertyGridWrapperContext;
|
|
77
|
-
//# 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,6CAA+B;AAC/B,4EAAiH;AACjH,iDAA8C;AAC9C,sDAAoD;AACpD,sFAAmF;AACnF,kDAA+C;AAa/C;0DAC0D;AAC1D,MAAa,mBAAoB,SAAQ,KAAK,CAAC,SAG9C;IAEC,YAAY,KAA8C;QACxD,KAAK,CAAC,KAAK,CAAC,CAAC;QAIP,+BAA0B,GAAG,CAAC,IAAY,EAAE,MAAwB,EAAoC,EAAE;YAChH,MAA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jD,CACP,CACA,CACJ,CAAC;IACJ,CAAC;;AA3DH,kDA4DC;AAxDiB,+BAAW,GAAG,uDAA0B,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport { DEFAULT_PROPERTY_GRID_RULESET, PresentationPropertyDataProvider } from \"@itwin/presentation-components\";\nimport { PropertyGrid } from \"./PropertyGrid\";\nimport \"../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,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module PropertyGrid
|
|
8
|
-
*/
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
-
if (mod && mod.__esModule) return mod;
|
|
23
|
-
var result = {};
|
|
24
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
-
__setModuleDefault(result, mod);
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
-
};
|
|
31
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.PropertyList = exports.getPropertyKey = void 0;
|
|
33
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
34
|
-
const React = __importStar(require("react"));
|
|
35
|
-
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
36
|
-
const core_react_1 = require("@itwin/core-react");
|
|
37
|
-
const PropertyRender_1 = require("./PropertyRender");
|
|
38
|
-
/**
|
|
39
|
-
* Get unique key for property record
|
|
40
|
-
* @internal
|
|
41
|
-
*/
|
|
42
|
-
function getPropertyKey(propertyCategory, propertyRecord) {
|
|
43
|
-
return propertyCategory.name + propertyRecord.property.name;
|
|
44
|
-
}
|
|
45
|
-
exports.getPropertyKey = getPropertyKey;
|
|
46
|
-
/** A React component that renders multiple properties within a category as a list.
|
|
47
|
-
* @public
|
|
48
|
-
*/
|
|
49
|
-
class PropertyList extends React.Component {
|
|
50
|
-
constructor(props) {
|
|
51
|
-
super(props);
|
|
52
|
-
this._listRef = React.createRef();
|
|
53
|
-
this._onEditCommit = (args) => {
|
|
54
|
-
// istanbul ignore else
|
|
55
|
-
if (this.props.onEditCommit && this.props.category)
|
|
56
|
-
this.props.onEditCommit(args, this.props.category);
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
afterRender() {
|
|
60
|
-
if (this.props.orientation !== core_react_1.Orientation.Horizontal ||
|
|
61
|
-
!this._listRef.current) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const width = this._listRef.current.getBoundingClientRect().width;
|
|
65
|
-
if (this.props.setWidth && width !== this.props.width) {
|
|
66
|
-
this.props.setWidth(width);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
/** @internal */
|
|
70
|
-
componentDidMount() {
|
|
71
|
-
this.afterRender();
|
|
72
|
-
}
|
|
73
|
-
/** @internal */
|
|
74
|
-
componentDidUpdate() {
|
|
75
|
-
this.afterRender();
|
|
76
|
-
}
|
|
77
|
-
/** @internal */
|
|
78
|
-
render() {
|
|
79
|
-
const propertyListClassName = classnames_1.default((this.props.orientation === core_react_1.Orientation.Horizontal) ? "gmw-components-property-list--horizontal" : "gmw-components-property-list--vertical", this.props.className);
|
|
80
|
-
return (React.createElement("div", { className: propertyListClassName, style: this.props.style, ref: this._listRef }, this.props.properties.map((propertyRecord) => {
|
|
81
|
-
const key = this.props.category ? getPropertyKey(this.props.category, propertyRecord) : propertyRecord.property.name;
|
|
82
|
-
return (React.createElement(PropertyRender_1.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 === appui_abstract_1.PropertyValueFormat.Primitive ? this.props.onPropertyClicked : undefined, onRightClick: propertyRecord.value.valueFormat === appui_abstract_1.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 }));
|
|
83
|
-
})));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
exports.PropertyList = PropertyList;
|
|
87
|
-
//# sourceMappingURL=PropertyList.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyList.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyList.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4DAAoC;AACpC,6CAA+B;AAE/B,0DAA4D;AAE5D,kDAAgD;AAQhD,qDAAoD;AA2CpD;;;GAGG;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,CAAC,KAAK,CAAC,WAAW,EACnC,oBAAoB,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe,EAChD,4BAA4B,EAAE,IAAI,CAAC,KAAK,CAAC,4BAA4B,EACrE,SAAS,EAAE,GAAG,KAAK,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAChD,YAAY,EAAE,IAAI,CAAC,aAAa,EAChC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EACrC,qBAAqB,EAAE,IAAI,CAAC,KAAK,CAAC,qBAAqB,EACvD,qBAAqB,EAAE,IAAI,CAAC,KAAK,CAAC,qBAAqB,EACvD,0BAA0B,EAAE,IAAI,CAAC,KAAK,CAAC,0BAA0B,EACjE,0BAA0B,EAAE,IAAI,CAAC,KAAK,CAAC,0BAA0B,EACjE,yBAAyB,EAAE,IAAI,CAAC,KAAK,CAAC,yBAAyB,EAC/D,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,EACjC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GACvB,CAAC,CAAC;QACR,CAAC,CAAC,CACE,CACP,CAAC;IACJ,CAAC;CACF;AA9ED,oCA8EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module PropertyGrid\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { PropertyRecord} from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { CommonProps, RatioChangeResult } from \"@itwin/core-react\";\nimport { Orientation } from \"@itwin/core-react\";\nimport type {\n ActionButtonRenderer,\n PropertyCategory,\n PropertyUpdatedArgs,\n PropertyValueRendererManager,\n} from \"@itwin/components-react\";\n\nimport { PropertyRenderer } from \"./PropertyRender\";\nimport type { PropertyGridColumnInfo } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns\";\n\n/** Properties of [[PropertyList]] React component\n * @public\n */\nexport interface PropertyListProps extends CommonProps {\n orientation: Orientation;\n category?: PropertyCategory;\n properties: PropertyRecord[];\n selectedPropertyKey?: string;\n onPropertyClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyRightClicked?: (property: PropertyRecord, key?: string) => void;\n onPropertyContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;\n columnRatio?: number;\n /** Callback to column ratio changed event */\n onColumnChanged?: (ratio: number) => void | RatioChangeResult;\n propertyValueRendererManager?: PropertyValueRendererManager;\n editingPropertyKey?: string;\n onEditCommit?: (args: PropertyUpdatedArgs, category: PropertyCategory) => void;\n onEditCancel?: () => void;\n /** Enables/disables property hovering effect */\n isPropertyHoverEnabled?: boolean;\n /** Enables/disables property selection */\n isPropertySelectionEnabled?: boolean;\n /** Enables/disables property right click selection */\n isPropertyRightClickSelectionEnabled?: boolean;\n /** Array of action button renderers */\n actionButtonRenderers?: ActionButtonRenderer[];\n /** Is resize handle hovered */\n isResizeHandleHovered?: boolean;\n /** Callback to hover event change */\n onResizeHandleHoverChanged?: (isHovered: boolean) => void;\n /** Is resize handle being dragged */\n isResizeHandleBeingDragged?: boolean;\n /** Callback to drag event change */\n onResizeHandleDragChanged?: (isDragStarted: boolean) => void;\n /** Information for styling property grid columns */\n columnInfo?: PropertyGridColumnInfo;\n setWidth?: React.Dispatch<React.SetStateAction<number>>;\n width: number;\n}\n\n/**\n * Get unique key for property record\n * @internal\n */\nexport function getPropertyKey(propertyCategory: PropertyCategory, propertyRecord: PropertyRecord) {\n return propertyCategory.name + propertyRecord.property.name;\n}\n\n/** A React component that renders multiple properties within a category as a list.\n * @public\n */\nexport class PropertyList extends React.Component<PropertyListProps> {\n\n constructor(props: PropertyListProps) {\n super(props);\n }\n\n private _listRef = React.createRef<HTMLDivElement>();\n\n private _onEditCommit = (args: PropertyUpdatedArgs) => {\n // istanbul ignore else\n if (this.props.onEditCommit && this.props.category)\n this.props.onEditCommit(args, this.props.category);\n };\n\n private afterRender() {\n if (\n this.props.orientation !== Orientation.Horizontal ||\n !this._listRef.current\n ) {\n return;\n }\n const width = this._listRef.current.getBoundingClientRect().width;\n if (this.props.setWidth && width !== this.props.width) {\n this.props.setWidth(width);\n }\n }\n\n /** @internal */\n public override componentDidMount() {\n this.afterRender();\n }\n\n /** @internal */\n public override componentDidUpdate() {\n this.afterRender();\n }\n\n /** @internal */\n public override render() {\n const propertyListClassName = classnames(\n (this.props.orientation === Orientation.Horizontal) ? \"gmw-components-property-list--horizontal\" : \"gmw-components-property-list--vertical\",\n this.props.className,\n );\n\n return (\n <div className={propertyListClassName} style={this.props.style} ref={this._listRef}>\n {this.props.properties.map((propertyRecord: PropertyRecord) => {\n const key = this.props.category ? getPropertyKey(this.props.category, propertyRecord) : propertyRecord.property.name;\n return (\n <PropertyRenderer\n key={key}\n uniqueKey={key}\n isHoverable={this.props.isPropertyHoverEnabled}\n isSelectable={this.props.isPropertySelectionEnabled}\n isSelected={key === this.props.selectedPropertyKey}\n propertyRecord={propertyRecord}\n orientation={this.props.orientation}\n onClick={propertyRecord.value.valueFormat === PropertyValueFormat.Primitive ? this.props.onPropertyClicked : undefined}\n onRightClick={propertyRecord.value.valueFormat === PropertyValueFormat.Primitive ? this.props.onPropertyRightClicked : undefined}\n onContextMenu={this.props.onPropertyContextMenu}\n columnRatio={this.props.columnRatio}\n onColumnRatioChanged={this.props.onColumnChanged}\n propertyValueRendererManager={this.props.propertyValueRendererManager}\n isEditing={key === this.props.editingPropertyKey}\n onEditCommit={this._onEditCommit}\n onEditCancel={this.props.onEditCancel}\n actionButtonRenderers={this.props.actionButtonRenderers}\n isResizeHandleHovered={this.props.isResizeHandleHovered}\n onResizeHandleHoverChanged={this.props.onResizeHandleHoverChanged}\n isResizeHandleBeingDragged={this.props.isResizeHandleBeingDragged}\n onResizeHandleDragChanged={this.props.onResizeHandleDragChanged}\n columnInfo={this.props.columnInfo}\n width={this.props.width}\n />);\n })}\n </div>\n );\n }\n}\n"]}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import type { PropertyRecord } from "@itwin/appui-abstract";
|
|
3
|
-
import type { Orientation, RatioChangeResult } from "@itwin/core-react";
|
|
4
|
-
import type { ActionButtonRenderer, PropertyUpdatedArgs, PropertyValueRendererManager } from "@itwin/components-react";
|
|
5
|
-
import type { PropertyGridColumnInfo } from "@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns";
|
|
6
|
-
import type { HighlightingComponentProps } from "@itwin/components-react/lib/cjs/components-react/common/HighlightingComponentProps";
|
|
7
|
-
/** Properties shared by all renderers and PropertyView
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export interface SharedRendererProps {
|
|
11
|
-
/** PropertyRecord to render */
|
|
12
|
-
propertyRecord: PropertyRecord;
|
|
13
|
-
/** Unique string, that identifies this property component. Should be used if onClick or onRightClick are provided */
|
|
14
|
-
uniqueKey?: string;
|
|
15
|
-
/** Orientation to use for displaying the property */
|
|
16
|
-
orientation: Orientation;
|
|
17
|
-
/** Controls component selection */
|
|
18
|
-
isSelected?: boolean;
|
|
19
|
-
/** Called when property gets clicked. If undefined, clicking is disabled */
|
|
20
|
-
onClick?: (property: PropertyRecord, key?: string) => void;
|
|
21
|
-
/** Called when property gets right clicked. If undefined, right clicking is not working */
|
|
22
|
-
onRightClick?: (property: PropertyRecord, key?: string) => void;
|
|
23
|
-
/** Called to show a context menu for properties */
|
|
24
|
-
onContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;
|
|
25
|
-
/** Ratio between label and value cells */
|
|
26
|
-
columnRatio?: number;
|
|
27
|
-
/** Callback to column ratio changed event */
|
|
28
|
-
onColumnRatioChanged?: (ratio: number) => void | RatioChangeResult;
|
|
29
|
-
/** Indicates that properties have *hover* effect */
|
|
30
|
-
isHoverable?: boolean;
|
|
31
|
-
/** Indicates that properties can be selected */
|
|
32
|
-
isSelectable?: boolean;
|
|
33
|
-
/** Width of the whole property element */
|
|
34
|
-
width?: number;
|
|
35
|
-
/** Array of action button renderers @beta */
|
|
36
|
-
actionButtonRenderers?: ActionButtonRenderer[];
|
|
37
|
-
/** Is resize handle hovered */
|
|
38
|
-
isResizeHandleHovered?: boolean;
|
|
39
|
-
/** Callback to hover event change */
|
|
40
|
-
onResizeHandleHoverChanged?: (isHovered: boolean) => void;
|
|
41
|
-
/** Is resize handle being dragged */
|
|
42
|
-
isResizeHandleBeingDragged?: boolean;
|
|
43
|
-
/** Callback to drag event change */
|
|
44
|
-
onResizeHandleDragChanged?: (isDragStarted: boolean) => void;
|
|
45
|
-
/** Information for styling property grid columns */
|
|
46
|
-
columnInfo?: PropertyGridColumnInfo;
|
|
47
|
-
}
|
|
48
|
-
/** Properties of [[PropertyRenderer]] React component
|
|
49
|
-
* @public
|
|
50
|
-
*/
|
|
51
|
-
export interface PropertyRendererProps extends SharedRendererProps {
|
|
52
|
-
/** Custom value renderer */
|
|
53
|
-
propertyValueRendererManager?: PropertyValueRendererManager;
|
|
54
|
-
/** Multiplier of how much the property is indented to the right */
|
|
55
|
-
indentation?: number;
|
|
56
|
-
/** Indicates property is being edited @beta */
|
|
57
|
-
isEditing?: boolean;
|
|
58
|
-
/** Called when property edit is committed. @beta */
|
|
59
|
-
onEditCommit?: (args: PropertyUpdatedArgs) => void;
|
|
60
|
-
/** Called when property edit is cancelled. @beta */
|
|
61
|
-
onEditCancel?: () => void;
|
|
62
|
-
/** Props used for highlighting. @beta */
|
|
63
|
-
highlight?: HighlightingComponentProps;
|
|
64
|
-
}
|
|
65
|
-
/** State of [[PropertyRenderer]] React component
|
|
66
|
-
* @internal
|
|
67
|
-
*/
|
|
68
|
-
interface PropertyRendererState {
|
|
69
|
-
/** Currently loaded property value */
|
|
70
|
-
displayValue?: React.ReactNode;
|
|
71
|
-
}
|
|
72
|
-
/** A React component that renders properties
|
|
73
|
-
* @public
|
|
74
|
-
*/
|
|
75
|
-
export declare class PropertyRenderer extends React.Component<PropertyRendererProps, PropertyRendererState> {
|
|
76
|
-
/** @internal */
|
|
77
|
-
readonly state: Readonly<PropertyRendererState>;
|
|
78
|
-
static getLabelOffset(indentation?: number, orientation?: Orientation, width?: number, columnRatio?: number, minColumnLabelWidth?: number): number;
|
|
79
|
-
private updateDisplayValue;
|
|
80
|
-
private _onEditCommit;
|
|
81
|
-
private _onEditCancel;
|
|
82
|
-
/** Display property record value in an editor */
|
|
83
|
-
updateDisplayValueAsEditor(props: PropertyRendererProps): void;
|
|
84
|
-
/** @internal */
|
|
85
|
-
componentDidMount(): void;
|
|
86
|
-
/** @internal */
|
|
87
|
-
componentDidUpdate(prevProps: PropertyRendererProps): void;
|
|
88
|
-
/** @internal */
|
|
89
|
-
render(): JSX.Element;
|
|
90
|
-
}
|
|
91
|
-
export {};
|
|
92
|
-
//# sourceMappingURL=PropertyRender.d.ts.map
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.PropertyRenderer = void 0;
|
|
23
|
-
/*---------------------------------------------------------------------------------------------
|
|
24
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
|
-
*--------------------------------------------------------------------------------------------*/
|
|
27
|
-
const React = __importStar(require("react"));
|
|
28
|
-
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
29
|
-
const components_react_1 = require("@itwin/components-react");
|
|
30
|
-
const NonPrimitivePropertyRenderer_1 = require("./NonPrimitivePropertyRenderer");
|
|
31
|
-
const PrimitivePropertyRenderer_1 = require("./PrimitivePropertyRenderer");
|
|
32
|
-
const CommonPropertyRenderer_1 = require("@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer");
|
|
33
|
-
const createNewDisplayValue_1 = require("./createNewDisplayValue");
|
|
34
|
-
/** A React component that renders properties
|
|
35
|
-
* @public
|
|
36
|
-
*/
|
|
37
|
-
class PropertyRenderer extends React.Component {
|
|
38
|
-
constructor() {
|
|
39
|
-
super(...arguments);
|
|
40
|
-
/** @internal */
|
|
41
|
-
this.state = {
|
|
42
|
-
displayValue: components_react_1.UiComponents.translate("general.loading"),
|
|
43
|
-
};
|
|
44
|
-
this._onEditCommit = (args) => {
|
|
45
|
-
// istanbul ignore else
|
|
46
|
-
if (this.props.onEditCommit) {
|
|
47
|
-
this.props.onEditCommit(args);
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
this._onEditCancel = () => {
|
|
51
|
-
// istanbul ignore else
|
|
52
|
-
if (this.props.onEditCancel) {
|
|
53
|
-
this.props.onEditCancel();
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
static getLabelOffset(indentation, orientation, width, columnRatio, minColumnLabelWidth) {
|
|
58
|
-
return CommonPropertyRenderer_1.CommonPropertyRenderer.getLabelOffset(indentation, orientation, width, columnRatio, minColumnLabelWidth);
|
|
59
|
-
}
|
|
60
|
-
updateDisplayValue(props) {
|
|
61
|
-
if (props.isEditing) {
|
|
62
|
-
this.updateDisplayValueAsEditor(props);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const displayValue = createNewDisplayValue_1.createNewDisplayValue(props.orientation, props.propertyRecord, props.indentation, props.propertyValueRendererManager);
|
|
66
|
-
this.setState({ displayValue });
|
|
67
|
-
}
|
|
68
|
-
/** Display property record value in an editor */
|
|
69
|
-
updateDisplayValueAsEditor(props) {
|
|
70
|
-
this.setState({
|
|
71
|
-
displayValue: (React.createElement(components_react_1.EditorContainer, { propertyRecord: props.propertyRecord, onCommit: this._onEditCommit, onCancel: this._onEditCancel, setFocus: true })),
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
/** @internal */
|
|
75
|
-
componentDidMount() {
|
|
76
|
-
this.updateDisplayValue(this.props);
|
|
77
|
-
}
|
|
78
|
-
/** @internal */
|
|
79
|
-
componentDidUpdate(prevProps) {
|
|
80
|
-
if (prevProps.propertyRecord !== this.props.propertyRecord ||
|
|
81
|
-
prevProps.isEditing !== this.props.isEditing ||
|
|
82
|
-
prevProps.orientation !== this.props.orientation) {
|
|
83
|
-
this.updateDisplayValue(this.props);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
/** @internal */
|
|
87
|
-
render() {
|
|
88
|
-
const { ...props } = this.props;
|
|
89
|
-
const primitiveRendererProps = {
|
|
90
|
-
...props,
|
|
91
|
-
valueElement: this.state.displayValue,
|
|
92
|
-
indentation: this.props.indentation,
|
|
93
|
-
};
|
|
94
|
-
switch (this.props.propertyRecord.value.valueFormat) {
|
|
95
|
-
case appui_abstract_1.PropertyValueFormat.Primitive:
|
|
96
|
-
return (React.createElement(PrimitivePropertyRenderer_1.PrimitivePropertyRenderer, { ...primitiveRendererProps }));
|
|
97
|
-
case appui_abstract_1.PropertyValueFormat.Array:
|
|
98
|
-
// If array is empty, render it as a primitive property
|
|
99
|
-
if (this.props.propertyRecord.value.valueFormat === appui_abstract_1.PropertyValueFormat.Array
|
|
100
|
-
&& this.props.propertyRecord.value.items.length === 0)
|
|
101
|
-
return (React.createElement(PrimitivePropertyRenderer_1.PrimitivePropertyRenderer, { ...primitiveRendererProps }));
|
|
102
|
-
// eslint-disable-next-line no-fallthrough
|
|
103
|
-
case appui_abstract_1.PropertyValueFormat.Struct:
|
|
104
|
-
return (React.createElement(NonPrimitivePropertyRenderer_1.NonPrimitivePropertyRenderer, { isCollapsible: true, ...primitiveRendererProps }));
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
exports.PropertyRenderer = PropertyRenderer;
|
|
109
|
-
//# sourceMappingURL=PropertyRender.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyRender.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyRender.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6CAA+B;AAE/B,0DAA4D;AAQ5D,8DAGiC;AAEjC,iFAA8E;AAC9E,2EAAwE;AAGxE,yIAAsI;AACtI,mEAAgE;AAsEhE;;GAEG;AACH,MAAa,gBAAiB,SAAQ,KAAK,CAAC,SAG3C;IAHD;;QAIE,gBAAgB;QACS,UAAK,GAAoC;YAChE,YAAY,EAAE,+BAAY,CAAC,SAAS,CAAC,iBAAiB,CAAC;SACxD,CAAC;QAiCM,kBAAa,GAAG,CAAC,IAAyB,EAAE,EAAE;YACpD,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE;gBAC3B,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;aAC/B;QACH,CAAC,CAAC;QAEM,kBAAa,GAAG,GAAG,EAAE;YAC3B,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,YAA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W,KAAK,IAAI,CAAC,KAAK,CAAC,WAAW,EAChD;YACA,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACrC;IACH,CAAC;IAED,gBAAgB;IACA,MAAM;QACpB,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAChC,MAAM,sBAAsB,GAA2B;YACrD,GAAG,KAAK;YACR,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY;YACrC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW;SACpC,CAAC;QAEF,QAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE;YACnD,KAAK,oCAAmB,CAAC,SAAS;gBAChC,OAAO,CACL,oBAAC,qDAAyB,OAAK,sBAAsB,GAAI,CAC1D,CAAC;YACJ,KAAK,oCAAmB,CAAC,KAAK;gBAC5B,uDAAuD;gBACvD,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,KAAK;uBACxE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;oBACrD,OAAO,CACL,oBAAC,qDAAyB,OAAK,sBAAsB,GAAI,CAC1D,CAAC;YACN,0CAA0C;YAC1C,KAAK,oCAAmB,CAAC,MAAM;gBAC7B,OAAO,CACL,oBAAC,2DAA4B,IAC3B,aAAa,EAAE,IAAI,KACf,sBAAsB,GAC1B,CACH,CAAC;SACL;IACH,CAAC;CACF;AAnHD,4CAmHC","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 type { Orientation, RatioChangeResult } from \"@itwin/core-react\";\nimport type {\n ActionButtonRenderer,\n PrimitiveRendererProps,\n PropertyUpdatedArgs,\n PropertyValueRendererManager,\n} from \"@itwin/components-react\";\nimport {\n EditorContainer,\n UiComponents,\n} from \"@itwin/components-react\";\n\nimport { NonPrimitivePropertyRenderer } from \"./NonPrimitivePropertyRenderer\";\nimport { PrimitivePropertyRenderer } from \"./PrimitivePropertyRenderer\";\nimport type { PropertyGridColumnInfo } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/PropertyGridColumns\";\nimport type { HighlightingComponentProps } from \"@itwin/components-react/lib/cjs/components-react/common/HighlightingComponentProps\";\nimport { CommonPropertyRenderer } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer\";\nimport { createNewDisplayValue } from \"./createNewDisplayValue\";\n\n/** Properties shared by all renderers and PropertyView\n * @public\n */\nexport interface SharedRendererProps {\n /** PropertyRecord to render */\n propertyRecord: PropertyRecord;\n /** Unique string, that identifies this property component. Should be used if onClick or onRightClick are provided */\n uniqueKey?: string;\n /** Orientation to use for displaying the property */\n orientation: Orientation;\n /** Controls component selection */\n isSelected?: boolean;\n /** Called when property gets clicked. If undefined, clicking is disabled */\n onClick?: (property: PropertyRecord, key?: string) => void;\n /** Called when property gets right clicked. If undefined, right clicking is not working */\n onRightClick?: (property: PropertyRecord, key?: string) => void;\n /** Called to show a context menu for properties */\n onContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;\n /** Ratio between label and value cells */\n columnRatio?: number;\n /** Callback to column ratio changed event */\n onColumnRatioChanged?: (ratio: number) => void | RatioChangeResult;\n /** Indicates that properties have *hover* effect */\n isHoverable?: boolean;\n /** Indicates that properties can be selected */\n isSelectable?: boolean;\n /** Width of the whole property element */\n width?: number;\n /** Array of action button renderers @beta */\n actionButtonRenderers?: ActionButtonRenderer[];\n /** Is resize handle hovered */\n isResizeHandleHovered?: boolean;\n /** Callback to hover event change */\n onResizeHandleHoverChanged?: (isHovered: boolean) => void;\n /** Is resize handle being dragged */\n isResizeHandleBeingDragged?: boolean;\n /** Callback to drag event change */\n onResizeHandleDragChanged?: (isDragStarted: boolean) => void;\n /** Information for styling property grid columns */\n columnInfo?: PropertyGridColumnInfo;\n}\n\n/** Properties of [[PropertyRenderer]] React component\n * @public\n */\nexport interface PropertyRendererProps extends SharedRendererProps {\n /** Custom value renderer */\n propertyValueRendererManager?: PropertyValueRendererManager;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Indicates property is being edited @beta */\n isEditing?: boolean;\n /** Called when property edit is committed. @beta */\n onEditCommit?: (args: PropertyUpdatedArgs) => void;\n /** Called when property edit is cancelled. @beta */\n onEditCancel?: () => void;\n /** Props used for highlighting. @beta */\n highlight?: HighlightingComponentProps;\n}\n\n/** State of [[PropertyRenderer]] React component\n * @internal\n */\ninterface PropertyRendererState {\n /** Currently loaded property value */\n displayValue?: React.ReactNode;\n}\n\n/** A React component that renders properties\n * @public\n */\nexport class PropertyRenderer extends React.Component<\nPropertyRendererProps,\nPropertyRendererState\n> {\n /** @internal */\n public override readonly state: Readonly<PropertyRendererState> = {\n displayValue: UiComponents.translate(\"general.loading\"),\n };\n\n public static getLabelOffset(\n indentation?: number,\n orientation?: Orientation,\n width?: number,\n columnRatio?: number,\n minColumnLabelWidth?: number,\n ): number {\n return CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation,\n width,\n columnRatio,\n minColumnLabelWidth,\n );\n }\n\n private updateDisplayValue(props: PropertyRendererProps) {\n if (props.isEditing) {\n this.updateDisplayValueAsEditor(props);\n return;\n }\n\n const displayValue = createNewDisplayValue(\n props.orientation,\n props.propertyRecord,\n props.indentation,\n props.propertyValueRendererManager,\n );\n this.setState({ displayValue });\n }\n\n private _onEditCommit = (args: PropertyUpdatedArgs) => {\n // istanbul ignore else\n if (this.props.onEditCommit) {\n this.props.onEditCommit(args);\n }\n };\n\n private _onEditCancel = () => {\n // istanbul ignore else\n if (this.props.onEditCancel) {\n this.props.onEditCancel();\n }\n };\n\n /** Display property record value in an editor */\n public updateDisplayValueAsEditor(props: PropertyRendererProps) {\n this.setState({\n displayValue: (\n <EditorContainer\n propertyRecord={props.propertyRecord}\n onCommit={this._onEditCommit}\n onCancel={this._onEditCancel}\n setFocus={true}\n />\n ),\n });\n }\n\n /** @internal */\n public override componentDidMount() {\n this.updateDisplayValue(this.props);\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyRendererProps) {\n if (\n prevProps.propertyRecord !== this.props.propertyRecord ||\n prevProps.isEditing !== this.props.isEditing ||\n prevProps.orientation !== this.props.orientation\n ) {\n this.updateDisplayValue(this.props);\n }\n }\n\n /** @internal */\n public override render() {\n const { ...props } = this.props;\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...props,\n valueElement: this.state.displayValue,\n indentation: this.props.indentation,\n };\n\n switch (this.props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return (\n <PrimitivePropertyRenderer {...primitiveRendererProps} />\n );\n case PropertyValueFormat.Array:\n // If array is empty, render it as a primitive property\n if (this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array\n && this.props.propertyRecord.value.items.length === 0)\n return (\n <PrimitivePropertyRenderer {...primitiveRendererProps} />\n );\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n return (\n <NonPrimitivePropertyRenderer\n isCollapsible={true}\n {...primitiveRendererProps}\n />\n );\n }\n }\n}\n"]}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import "./PropertyView.scss";
|
|
3
|
-
import type { SharedRendererProps } from "./PropertyRender";
|
|
4
|
-
/** Properties of [[PropertyView]] React component
|
|
5
|
-
* @public
|
|
6
|
-
*/
|
|
7
|
-
export interface PropertyViewProps extends SharedRendererProps {
|
|
8
|
-
/** Property label as a React element */
|
|
9
|
-
labelElement: React.ReactNode;
|
|
10
|
-
/** Property value as a React element */
|
|
11
|
-
valueElement?: React.ReactNode;
|
|
12
|
-
/** Render callback for property value. If specified, `valueElement` is ignored. */
|
|
13
|
-
valueElementRenderer?: () => React.ReactNode;
|
|
14
|
-
/** Multiplier of how much the property is indented to the right */
|
|
15
|
-
indentation?: number;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* A React component that renders property as label/value pair
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
export declare const PropertyView: (props: PropertyViewProps) => JSX.Element;
|
|
22
|
-
//# sourceMappingURL=PropertyView.d.ts.map
|