@itwin/grouping-mapping-widget 0.5.5 → 0.5.8
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/grouping-mapping-widget.d.ts +2 -2
- package/lib/cjs/grouping-mapping-widget.js +1 -1
- package/lib/cjs/grouping-mapping-widget.js.map +1 -1
- package/lib/cjs/widget/components/ActionPanel.js +2 -2
- package/lib/cjs/widget/components/ActionPanel.js.map +1 -1
- package/lib/cjs/widget/components/ActionPanel.scss +1 -1
- package/lib/cjs/widget/components/BlockingOverlay.js +2 -2
- package/lib/cjs/widget/components/BlockingOverlay.js.map +1 -1
- package/lib/cjs/widget/components/BlockingOverlay.scss +3 -3
- package/lib/cjs/widget/components/CalculatedPropertyAction.js +5 -5
- package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/CalculatedPropertyAction.scss +4 -4
- package/lib/cjs/widget/components/ConfirmMappingsImport.js +12 -12
- package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/cjs/widget/components/ConfirmMappingsImport.scss +10 -10
- package/lib/cjs/widget/components/CustomCalculationAction.js +3 -3
- package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/cjs/widget/components/CustomCalculationAction.scss +2 -2
- package/lib/cjs/widget/components/DeleteModal.js +2 -2
- package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
- package/lib/cjs/widget/components/DeleteModal.scss +2 -2
- package/lib/cjs/widget/components/GroupAction.js +8 -8
- package/lib/cjs/widget/components/GroupAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.scss +6 -6
- package/lib/cjs/widget/components/GroupPropertyAction.js +6 -6
- package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupPropertyAction.scss +6 -10
- package/lib/cjs/widget/components/GroupQueryBuilder.scss +4 -4
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.js +3 -3
- package/lib/cjs/widget/components/GroupQueryBuilderContainer.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.js +14 -16
- package/lib/cjs/widget/components/Grouping.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.scss +8 -7
- package/lib/cjs/widget/components/GroupingMapping.js +1 -1
- package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMapping.scss +4 -10
- package/lib/cjs/widget/components/HorizontalTile.d.ts +13 -0
- package/lib/cjs/widget/components/HorizontalTile.js +18 -0
- package/lib/cjs/widget/components/HorizontalTile.js.map +1 -0
- package/lib/{esm/widget/components/GroupTile.scss → cjs/widget/components/HorizontalTile.scss} +4 -4
- package/lib/cjs/widget/components/Mapping.js +38 -58
- package/lib/cjs/widget/components/Mapping.js.map +1 -1
- package/lib/cjs/widget/components/Mapping.scss +22 -8
- package/lib/cjs/widget/components/MappingAction.js +3 -3
- package/lib/cjs/widget/components/MappingAction.js.map +1 -1
- package/lib/cjs/widget/components/MappingAction.scss +2 -2
- package/lib/cjs/widget/components/MappingImportWizardModal.js +2 -2
- package/lib/cjs/widget/components/MappingImportWizardModal.js.map +1 -1
- package/lib/cjs/widget/components/MappingImportWizardModal.scss +3 -3
- package/lib/cjs/widget/components/PropertyMenu.js +9 -9
- package/lib/cjs/widget/components/PropertyMenu.js.map +1 -1
- package/lib/cjs/widget/components/PropertyMenu.scss +7 -7
- package/lib/cjs/widget/components/SelectIModel.js +3 -3
- package/lib/cjs/widget/components/SelectIModel.js.map +1 -1
- package/lib/cjs/widget/components/SelectIModel.scss +2 -6
- package/lib/cjs/widget/components/SelectMapping.scss +2 -2
- package/lib/cjs/widget/components/SelectMappings.js +3 -3
- package/lib/cjs/widget/components/SelectMappings.js.map +1 -1
- package/lib/cjs/widget/components/SelectProject.js +28 -20
- package/lib/cjs/widget/components/SelectProject.js.map +1 -1
- package/lib/cjs/widget/components/SelectProject.scss +5 -5
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +0 -1
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js +0 -1
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js +6 -6
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyGrid.scss +12 -12
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyList.js +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyList.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyView.js +5 -5
- package/lib/cjs/widget/components/property-grid/PropertyView.js.map +1 -1
- package/lib/cjs/widget/components/property-grid/PropertyView.scss +13 -62
- package/lib/cjs/widget/components/utils.js +6 -6
- package/lib/cjs/widget/components/utils.js.map +1 -1
- package/lib/cjs/widget/components/utils.scss +6 -6
- package/lib/esm/grouping-mapping-widget.d.ts +2 -2
- package/lib/esm/grouping-mapping-widget.js +1 -1
- package/lib/esm/grouping-mapping-widget.js.map +1 -1
- package/lib/esm/widget/components/ActionPanel.js +2 -2
- package/lib/esm/widget/components/ActionPanel.js.map +1 -1
- package/lib/esm/widget/components/ActionPanel.scss +1 -1
- package/lib/esm/widget/components/BlockingOverlay.js +2 -2
- package/lib/esm/widget/components/BlockingOverlay.js.map +1 -1
- package/lib/esm/widget/components/BlockingOverlay.scss +3 -3
- package/lib/esm/widget/components/CalculatedPropertyAction.js +5 -5
- package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/CalculatedPropertyAction.scss +4 -4
- package/lib/esm/widget/components/ConfirmMappingsImport.js +12 -12
- package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/esm/widget/components/ConfirmMappingsImport.scss +10 -10
- package/lib/esm/widget/components/CustomCalculationAction.js +3 -3
- package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/esm/widget/components/CustomCalculationAction.scss +2 -2
- package/lib/esm/widget/components/DeleteModal.js +2 -2
- package/lib/esm/widget/components/DeleteModal.js.map +1 -1
- package/lib/esm/widget/components/DeleteModal.scss +2 -2
- package/lib/esm/widget/components/GroupAction.js +8 -8
- package/lib/esm/widget/components/GroupAction.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.scss +6 -6
- package/lib/esm/widget/components/GroupPropertyAction.js +6 -6
- package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/GroupPropertyAction.scss +6 -10
- package/lib/esm/widget/components/GroupQueryBuilder.scss +4 -4
- package/lib/esm/widget/components/GroupQueryBuilderContainer.js +3 -3
- package/lib/esm/widget/components/GroupQueryBuilderContainer.js.map +1 -1
- package/lib/esm/widget/components/Grouping.js +14 -16
- package/lib/esm/widget/components/Grouping.js.map +1 -1
- package/lib/esm/widget/components/Grouping.scss +8 -7
- package/lib/esm/widget/components/GroupingMapping.js +1 -1
- package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
- package/lib/esm/widget/components/GroupingMapping.scss +4 -10
- package/lib/esm/widget/components/HorizontalTile.d.ts +13 -0
- package/lib/esm/widget/components/HorizontalTile.js +11 -0
- package/lib/esm/widget/components/HorizontalTile.js.map +1 -0
- package/lib/{cjs/widget/components/GroupTile.scss → esm/widget/components/HorizontalTile.scss} +4 -4
- package/lib/esm/widget/components/Mapping.js +41 -61
- package/lib/esm/widget/components/Mapping.js.map +1 -1
- package/lib/esm/widget/components/Mapping.scss +22 -8
- package/lib/esm/widget/components/MappingAction.js +3 -3
- package/lib/esm/widget/components/MappingAction.js.map +1 -1
- package/lib/esm/widget/components/MappingAction.scss +2 -2
- package/lib/esm/widget/components/MappingImportWizardModal.js +2 -2
- package/lib/esm/widget/components/MappingImportWizardModal.js.map +1 -1
- package/lib/esm/widget/components/MappingImportWizardModal.scss +3 -3
- package/lib/esm/widget/components/PropertyMenu.js +9 -9
- package/lib/esm/widget/components/PropertyMenu.js.map +1 -1
- package/lib/esm/widget/components/PropertyMenu.scss +7 -7
- package/lib/esm/widget/components/SelectIModel.js +3 -3
- package/lib/esm/widget/components/SelectIModel.js.map +1 -1
- package/lib/esm/widget/components/SelectIModel.scss +2 -6
- package/lib/esm/widget/components/SelectMapping.scss +2 -2
- package/lib/esm/widget/components/SelectMappings.js +3 -3
- package/lib/esm/widget/components/SelectMappings.js.map +1 -1
- package/lib/esm/widget/components/SelectProject.js +30 -22
- package/lib/esm/widget/components/SelectProject.js.map +1 -1
- package/lib/esm/widget/components/SelectProject.scss +5 -5
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +0 -1
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js +0 -1
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyGrid.js +6 -6
- package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyGrid.scss +12 -12
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +1 -1
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyList.js +1 -1
- package/lib/esm/widget/components/property-grid/PropertyList.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyView.js +5 -5
- package/lib/esm/widget/components/property-grid/PropertyView.js.map +1 -1
- package/lib/esm/widget/components/property-grid/PropertyView.scss +13 -62
- package/lib/esm/widget/components/utils.js +6 -6
- package/lib/esm/widget/components/utils.js.map +1 -1
- package/lib/esm/widget/components/utils.scss +6 -6
- package/package.json +1 -1
- package/lib/cjs/widget/components/GroupTile.d.ts +0 -13
- package/lib/cjs/widget/components/GroupTile.js +0 -18
- package/lib/cjs/widget/components/GroupTile.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.scss +0 -16
- package/lib/esm/widget/components/GroupTile.d.ts +0 -13
- package/lib/esm/widget/components/GroupTile.js +0 -11
- package/lib/esm/widget/components/GroupTile.js.map +0 -1
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.scss +0 -16
|
@@ -26,9 +26,9 @@ const react_1 = __importStar(require("react"));
|
|
|
26
26
|
const GroupingApiConfigContext_1 = require("./context/GroupingApiConfigContext");
|
|
27
27
|
require("./SelectProject.scss");
|
|
28
28
|
const tabsWithIcons = [
|
|
29
|
-
react_1.default.createElement(itwinui_react_1.Tab, { key:
|
|
30
|
-
react_1.default.createElement(itwinui_react_1.Tab, { key:
|
|
31
|
-
react_1.default.createElement(itwinui_react_1.Tab, { key:
|
|
29
|
+
react_1.default.createElement(itwinui_react_1.Tab, { key: "favorite", label: "Favorite projects", startIcon: react_1.default.createElement(itwinui_icons_react_1.SvgStarHollow, null) }),
|
|
30
|
+
react_1.default.createElement(itwinui_react_1.Tab, { key: "recents", label: "Recent projects", startIcon: react_1.default.createElement(itwinui_icons_react_1.SvgCalendar, null) }),
|
|
31
|
+
react_1.default.createElement(itwinui_react_1.Tab, { key: "all", label: "My projects", startIcon: react_1.default.createElement(itwinui_icons_react_1.SvgList, null) }),
|
|
32
32
|
];
|
|
33
33
|
const SelectProject = ({ onSelect, onCancel }) => {
|
|
34
34
|
const { getAccessToken, prefix } = GroupingApiConfigContext_1.useGroupingMappingApiConfig();
|
|
@@ -36,7 +36,10 @@ const SelectProject = ({ onSelect, onCancel }) => {
|
|
|
36
36
|
const [searchInput, setSearchInput] = react_1.useState("");
|
|
37
37
|
const [activeSearchInput, setActiveSearchInput] = react_1.useState("");
|
|
38
38
|
const [accessToken, setAccessToken] = react_1.useState();
|
|
39
|
-
const [apiOverrides, setApiOverrides] = react_1.useState({
|
|
39
|
+
const [apiOverrides, setApiOverrides] = react_1.useState({
|
|
40
|
+
serverEnvironmentPrefix: prefix,
|
|
41
|
+
});
|
|
42
|
+
const [searched, setSearched] = react_1.useState(false);
|
|
40
43
|
react_1.useEffect(() => setApiOverrides({ serverEnvironmentPrefix: prefix }), [prefix]);
|
|
41
44
|
react_1.useEffect(() => {
|
|
42
45
|
const fetchAccessToken = async () => {
|
|
@@ -47,29 +50,34 @@ const SelectProject = ({ onSelect, onCancel }) => {
|
|
|
47
50
|
}, [getAccessToken]);
|
|
48
51
|
const startSearch = react_1.useCallback(() => {
|
|
49
52
|
setActiveSearchInput(searchInput);
|
|
53
|
+
setSearched(true);
|
|
50
54
|
}, [searchInput]);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
55
|
+
const clearSearch = react_1.useCallback(() => {
|
|
56
|
+
setSearchInput("");
|
|
57
|
+
setActiveSearchInput("");
|
|
58
|
+
setSearched(false);
|
|
59
|
+
}, []);
|
|
60
|
+
react_1.useEffect(() => {
|
|
61
|
+
if (searchInput.length === 0) {
|
|
62
|
+
setSearched(false);
|
|
63
|
+
clearSearch();
|
|
64
|
+
}
|
|
65
|
+
}, [searchInput, setSearched, clearSearch]);
|
|
66
|
+
return (react_1.default.createElement("div", { className: "gmw-select-project-grid-container" },
|
|
67
|
+
react_1.default.createElement(itwinui_react_1.HorizontalTabs, { labels: tabsWithIcons, onTabSelected: setProjectType, activeIndex: projectType, type: "borderless", contentClassName: "gmw-grid-holding-tab" },
|
|
68
|
+
react_1.default.createElement(itwinui_react_1.LabeledInput, { displayStyle: "inline", iconDisplayStyle: "inline", className: "gmw-search-input", label: "Search", value: searchInput, placeholder: "Search....", onChange: (event) => {
|
|
54
69
|
const { target: { value }, } = event;
|
|
55
70
|
setSearchInput(value);
|
|
56
71
|
}, onKeyDown: (event) => {
|
|
57
72
|
if (event.key === "Enter") {
|
|
58
73
|
startSearch();
|
|
59
74
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
react_1.default.createElement("div", { className: 'project-grid' },
|
|
67
|
-
react_1.default.createElement(imodel_browser_react_1.ProjectGrid, { onThumbnailClick: onSelect, accessToken: accessToken, apiOverrides: apiOverrides, filterOptions: activeSearchInput, requestType: projectType === 0
|
|
68
|
-
? "favorites"
|
|
69
|
-
: projectType === 1
|
|
70
|
-
? "recents"
|
|
71
|
-
: "" })),
|
|
72
|
-
react_1.default.createElement("div", { className: 'select-project-action-panel' },
|
|
75
|
+
}, svgIcon: searched ? (react_1.default.createElement(itwinui_react_1.IconButton, { onClick: clearSearch, styleType: "borderless" },
|
|
76
|
+
react_1.default.createElement(itwinui_icons_react_1.SvgClose, null))) : (react_1.default.createElement(itwinui_react_1.IconButton, { onClick: startSearch, styleType: "borderless" },
|
|
77
|
+
react_1.default.createElement(itwinui_icons_react_1.SvgSearch, null))) })),
|
|
78
|
+
react_1.default.createElement("div", { className: "gmw-project-grid" },
|
|
79
|
+
react_1.default.createElement(imodel_browser_react_1.ProjectGrid, { onThumbnailClick: onSelect, accessToken: accessToken, apiOverrides: apiOverrides, filterOptions: activeSearchInput, requestType: projectType === 0 ? "favorites" : projectType === 1 ? "recents" : "" })),
|
|
80
|
+
react_1.default.createElement("div", { className: "gmw-select-project-action-panel" },
|
|
73
81
|
react_1.default.createElement(itwinui_react_1.Button, { onClick: onCancel }, "Cancel"))));
|
|
74
82
|
};
|
|
75
83
|
exports.default = SelectProject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectProject.js","sourceRoot":"","sources":["../../../../src/widget/components/SelectProject.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAUA,
|
|
1
|
+
{"version":3,"file":"SelectProject.js","sourceRoot":"","sources":["../../../../src/widget/components/SelectProject.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAUA,sEAA0D;AAC1D,oEAMoC;AACpC,wDAM8B;AAC9B,+CAAgE;AAChE,iFAAiF;AACjF,gCAA8B;AAE9B,MAAM,aAAa,GAAG;IACpB,8BAAC,mBAAG,IAC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CAAC;gBACxB,CAAC,EACD,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;oBACnB,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE;wBACzB,WAAW,EAAE,CAAC;qBACf;gBACH,CAAC,EACD,OAAO,EACL,QAAQ,CAAC,CAAC,CAAC,CACT,8BAAC,0BAAU,IAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAC,YAAY;oBACtD,8BAAC,8BAAQ,OAAG,CACD,CACd,CAAC,CAAC,CAAC,CACF,8BAAC,0BAAU,IAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAC,YAAY;oBACtD,8BAAC,+BAAS,OAAG,CACF,CACd,GAEH,CACa;QACjB,uCAAK,SAAS,EAAC,kBAAkB;YAC/B,8BAAC,kCAAW,IACV,gBAAgB,EAAE,QAAQ,EAC1B,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,iBAAiB,EAChC,WAAW,EACT,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAEtE,CACE;QACN,uCAAK,SAAS,EAAC,iCAAiC;YAC9C,8BAAC,sBAAM,IAAC,OAAO,EAAE,QAAQ,aAAiB,CACtC,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,aAAa,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { AccessToken } from \"@itwin/core-bentley\";\nimport type {\n ApiOverrides,\n IModelFull,\n ProjectFull,\n} from \"@itwin/imodel-browser-react\";\nimport { ProjectGrid } from \"@itwin/imodel-browser-react\";\nimport {\n SvgCalendar,\n SvgClose,\n SvgList,\n SvgSearch,\n SvgStarHollow,\n} from \"@itwin/itwinui-icons-react\";\nimport {\n Button,\n HorizontalTabs,\n IconButton,\n LabeledInput,\n Tab,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useState } from \"react\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport \"./SelectProject.scss\";\n\nconst tabsWithIcons = [\n <Tab\n key=\"favorite\"\n label=\"Favorite projects\"\n startIcon={<SvgStarHollow />}\n />,\n <Tab key=\"recents\" label=\"Recent projects\" startIcon={<SvgCalendar />} />,\n <Tab key=\"all\" label=\"My projects\" startIcon={<SvgList />} />,\n];\ninterface SelectProjectProps {\n onSelect: (project: ProjectFull) => void;\n onCancel: () => void;\n}\nconst SelectProject = ({ onSelect, onCancel }: SelectProjectProps) => {\n const { getAccessToken, prefix } = useGroupingMappingApiConfig();\n const [projectType, setProjectType] = useState<number>(0);\n const [searchInput, setSearchInput] = useState<string>(\"\");\n const [activeSearchInput, setActiveSearchInput] = useState<string>(\"\");\n const [accessToken, setAccessToken] = useState<AccessToken>();\n const [apiOverrides, setApiOverrides] = useState<ApiOverrides<IModelFull[]>>({\n serverEnvironmentPrefix: prefix,\n });\n const [searched, setSearched] = useState<boolean>(false);\n\n useEffect(\n () => setApiOverrides({ serverEnvironmentPrefix: prefix }),\n [prefix]\n );\n\n useEffect(() => {\n const fetchAccessToken = async () => {\n const accessToken = await getAccessToken();\n setAccessToken(accessToken);\n };\n void fetchAccessToken();\n }, [getAccessToken]);\n\n const startSearch = useCallback(() => {\n setActiveSearchInput(searchInput);\n setSearched(true);\n }, [searchInput]);\n\n const clearSearch = useCallback(() => {\n setSearchInput(\"\");\n setActiveSearchInput(\"\");\n setSearched(false);\n }, []);\n\n useEffect(() => {\n if (searchInput.length === 0) {\n setSearched(false);\n clearSearch();\n }\n }, [searchInput, setSearched, clearSearch]);\n\n return (\n <div className=\"gmw-select-project-grid-container\">\n <HorizontalTabs\n labels={tabsWithIcons}\n onTabSelected={setProjectType}\n activeIndex={projectType}\n type={\"borderless\"}\n contentClassName=\"gmw-grid-holding-tab\"\n >\n <LabeledInput\n displayStyle=\"inline\"\n iconDisplayStyle=\"inline\"\n className=\"gmw-search-input\"\n label=\"Search\"\n value={searchInput}\n placeholder=\"Search....\"\n onChange={(event) => {\n const {\n target: { value },\n } = event;\n setSearchInput(value);\n }}\n onKeyDown={(event) => {\n if (event.key === \"Enter\") {\n startSearch();\n }\n }}\n svgIcon={\n searched ? (\n <IconButton onClick={clearSearch} styleType=\"borderless\">\n <SvgClose />\n </IconButton>\n ) : (\n <IconButton onClick={startSearch} styleType=\"borderless\">\n <SvgSearch />\n </IconButton>\n )\n }\n />\n </HorizontalTabs>\n <div className=\"gmw-project-grid\">\n <ProjectGrid\n onThumbnailClick={onSelect}\n accessToken={accessToken}\n apiOverrides={apiOverrides}\n filterOptions={activeSearchInput}\n requestType={\n projectType === 0 ? \"favorites\" : projectType === 1 ? \"recents\" : \"\"\n }\n />\n </div>\n <div className=\"gmw-select-project-action-panel\">\n <Button onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n );\n};\n\nexport default SelectProject;\n"]}
|
|
@@ -4,28 +4,28 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
@import '~@itwin/itwinui-css/scss/variables';
|
|
6
6
|
|
|
7
|
-
.select-project-grid-container {
|
|
7
|
+
.gmw-select-project-grid-container {
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: column;
|
|
10
10
|
flex-grow: 1;
|
|
11
11
|
min-height: 0;
|
|
12
12
|
|
|
13
|
-
.search-input {
|
|
13
|
+
.gmw-search-input {
|
|
14
14
|
margin-left: auto;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.project-grid {
|
|
17
|
+
.gmw-project-grid {
|
|
18
18
|
overflow: auto;
|
|
19
19
|
flex-grow: 1;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.grid-holding-tab {
|
|
22
|
+
.gmw-grid-holding-tab {
|
|
23
23
|
display: flex;
|
|
24
24
|
flex-direction: column;
|
|
25
25
|
gap: $iui-baseline;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.select-project-action-panel {
|
|
28
|
+
.gmw-select-project-action-panel {
|
|
29
29
|
display: flex;
|
|
30
30
|
justify-content: center;
|
|
31
31
|
padding: $iui-baseline * 2 $iui-m $iui-baseline;
|
|
@@ -30,7 +30,6 @@ const CommonPropertyRenderer_1 = require("@itwin/components-react/lib/cjs/compon
|
|
|
30
30
|
const components_react_1 = require("@itwin/components-react");
|
|
31
31
|
const PropertyRender_1 = require("./PropertyRender");
|
|
32
32
|
const PropertyView_1 = require("./PropertyView");
|
|
33
|
-
require("./NonPrimitivePropertyRenderer.scss");
|
|
34
33
|
/** React Component that renders struct and array properties
|
|
35
34
|
* @public
|
|
36
35
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NonPrimitivePropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/NonPrimitivePropertyRenderer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6CAA+B;AAC/B,0DAA4E;AAC5E,yIAAsI;AACtI,8DAA4E;
|
|
1
|
+
{"version":3,"file":"NonPrimitivePropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/NonPrimitivePropertyRenderer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6CAA+B;AAC/B,0DAA4E;AAC5E,yIAAsI;AACtI,8DAA4E;AAC5E,qDAAoD;AACpD,iDAA8C;AAoB9C;;GAEG;AACH,MAAa,4BAA6B,SAAQ,KAAK,CAAC,SAGvD;IAHD;;QAIE,gBAAgB;QACS,UAAK,GAAsC;YAClE,0FAA0F;YAC1F,UAAU,EACR,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU;SACpE,CAAC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AAG,GAAG,WAAW,CAAC,IAAI,IAAI,KAAK,EAAE,CAAC;YAClD,OAAO,IAAI,+BAAc,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;QACrD,CAAC,CACF,CAAC;QAEF,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IA2BD,gBAAgB;IACA,MAAM;QACpB,IAAI,KAAK,GACP,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC;QACjD,IACE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,KAAK,oCAAmB,CAAC,KAAK,EACzE;YACA,KAAK,GAAG,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC;SAChD;QAED,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAChC,OAAO,CACL;YACG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAC1B,oBAAC,2BAAY,IACX,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAC/C,KAAK,GACT,CACH,CAAC,CAAC,CAAC,SAAS;YAEZ,IAAI,CAAC,KAAK,CAAC,UAAU;gBACpB,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,CAAC;gBACxC,CAAC,CAAC,SAAS,CACZ,CACJ,CAAC;IACJ,CAAC;CACF;AApHD,oEAoHC","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 { PropertyRecord, PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { CommonPropertyRenderer } from \"@itwin/components-react/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer\";\nimport { NonPrimitivePropertyLabelRenderer } from \"@itwin/components-react\";\nimport { PropertyRenderer } from \"./PropertyRender\";\nimport { PropertyView } from \"./PropertyView\";\nimport type { PrimitiveRendererProps } from \"./PrimitivePropertyRenderer\";\n\n/** Properties of [[NonPrimitivePropertyRenderer]] React component\n * @public\n */\nexport interface NonPrimitivePropertyRendererProps\n extends PrimitiveRendererProps {\n /** Can struct/array property be collapsed */\n isCollapsible?: boolean;\n}\n\n/** State of [[NonPrimitivePropertyRenderer]] React component\n * @internal\n */\ninterface NonPrimitivePropertyRendererState {\n /** Is struct/array property expanded */\n isExpanded?: boolean;\n}\n\n/** React Component that renders struct and array properties\n * @public\n */\nexport class NonPrimitivePropertyRenderer extends React.Component<\nNonPrimitivePropertyRendererProps,\nNonPrimitivePropertyRendererState\n> {\n /** @internal */\n public override readonly state: NonPrimitivePropertyRendererState = {\n /** If it's not collapsible, that means it's expanded by default and can't be collapsed */\n isExpanded:\n !this.props.isCollapsible || this.props.propertyRecord.autoExpand,\n };\n\n private _onExpanded = () => {\n this.setState({ isExpanded: true });\n };\n\n private _onCollapsed = () => {\n this.setState({ isExpanded: false });\n };\n\n private getLabel(\n props: NonPrimitivePropertyRendererProps,\n state: NonPrimitivePropertyRendererState,\n ): React.ReactNode {\n const { orientation, indentation, width, columnRatio, columnInfo } = props;\n const offset = CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation,\n width,\n columnRatio,\n columnInfo?.minLabelWidth,\n );\n\n let displayLabel = props.propertyRecord.property.displayLabel;\n if (\n this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array\n ) {\n displayLabel = `${displayLabel} (${this.props.propertyRecord.value.items.length})`;\n }\n\n return (\n <NonPrimitivePropertyLabelRenderer\n isExpanded={!!state.isExpanded}\n onExpand={this._onExpanded}\n onCollapse={this._onCollapsed}\n offset={offset}\n renderColon={false}\n >\n {displayLabel}\n </NonPrimitivePropertyLabelRenderer>\n );\n }\n\n private overrideArrayChildrenNames(items: PropertyRecord[]) {\n const modifiedProperties: PropertyRecord[] = items.map(\n (item, index): PropertyRecord => {\n const newProperty = { ...item.property };\n newProperty.displayLabel = `[${index + 1}]`;\n newProperty.name = `${newProperty.name}_${index}`;\n return new PropertyRecord(item.value, newProperty);\n },\n );\n\n return modifiedProperties;\n }\n\n private _renderPropertyForItem = (item: PropertyRecord) => {\n const prefix = this.props.uniqueKey\n ? this.props.uniqueKey\n : this.props.propertyRecord.property.name;\n const uniqueKey = `${prefix}_${item.property.name}`;\n return (\n <PropertyRenderer\n key={uniqueKey}\n uniqueKey={uniqueKey}\n propertyRecord={item}\n indentation={this.props.indentation ? this.props.indentation + 1 : 1}\n orientation={this.props.orientation}\n columnRatio={this.props.columnRatio}\n actionButtonRenderers={this.props.actionButtonRenderers}\n onColumnRatioChanged={this.props.onColumnRatioChanged}\n width={this.props.width}\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 />\n );\n };\n\n /** @internal */\n public override render() {\n let items: PropertyRecord[] =\n this.props.propertyRecord.getChildrenRecords();\n if (\n this.props.propertyRecord.value.valueFormat === PropertyValueFormat.Array\n ) {\n items = this.overrideArrayChildrenNames(items);\n }\n\n const { ...props } = this.props;\n return (\n <>\n {this.props.isCollapsible ? (\n <PropertyView\n labelElement={this.getLabel(this.props, this.state)}\n {...props}\n />\n ) : undefined}\n\n {this.state.isExpanded\n ? items.map(this._renderPropertyForItem)\n : undefined}\n </>\n );\n }\n}\n"]}
|
|
@@ -163,13 +163,13 @@ class PropertyGrid extends React.Component {
|
|
|
163
163
|
render() {
|
|
164
164
|
var _a, _b;
|
|
165
165
|
if (this.state.loadStart) {
|
|
166
|
-
return (React.createElement("div", { className: "
|
|
166
|
+
return (React.createElement("div", { className: "gmw-components-property-grid-loader" },
|
|
167
167
|
React.createElement(itwinui_react_1.ProgressRadial, { indeterminate: true })));
|
|
168
168
|
}
|
|
169
|
-
return (React.createElement("div", { className: "table-box-inner" },
|
|
170
|
-
React.createElement(components_react_1.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_1.default("components-property-grid-wrapper", this.props.className), style: this.props.style },
|
|
171
|
-
React.createElement("div", { className: classnames_1.default("components-property-grid", "components-smallEditor-host") },
|
|
172
|
-
React.createElement("div", { className: "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 }))))),
|
|
169
|
+
return (React.createElement("div", { className: "gmw-table-box-inner" },
|
|
170
|
+
React.createElement(components_react_1.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_1.default("gmw-components-property-grid-wrapper", this.props.className), style: this.props.style },
|
|
171
|
+
React.createElement("div", { className: classnames_1.default("gmw-components-property-grid", "components-smallEditor-host") },
|
|
172
|
+
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 }))))),
|
|
173
173
|
React.createElement(core_react_1.ResizableContainerObserver, { onResize: this._onResize }))))));
|
|
174
174
|
}
|
|
175
175
|
}
|
|
@@ -193,6 +193,6 @@ const NestedCategoryBlock = (props) => {
|
|
|
193
193
|
const [width, setWidth] = React.useState(1);
|
|
194
194
|
return (React.createElement(components_react_1.PropertyCategoryBlock, { category: props.categorizedRecords.category, onExpansionToggled: props.onCategoryExpansionToggled },
|
|
195
195
|
props.categorizedRecords.records.length ? (React.createElement(ColumnResizingPropertyListPropsSupplier_1.ColumnResizingPropertyListPropsSupplier, { orientation: props.orientation, width: width }, (partialListProps) => (React.createElement(PropertyList_1.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,
|
|
196
|
-
props.categorizedRecords.children.length ? (React.createElement("div", { className: "property-categories" }, props.categorizedRecords.children.map((categorizedChildRecords) => (React.createElement(NestedCategoryBlock, { ...props, key: categorizedChildRecords.category.name, categorizedRecords: categorizedChildRecords }))))) : undefined));
|
|
196
|
+
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));
|
|
197
197
|
};
|
|
198
198
|
//# sourceMappingURL=PropertyGrid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyGrid.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyGrid.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,4DAAoC;AACpC,iCAAgC;AAChC,6CAA+B;AAQ/B,8DAIiC;AAEjC,6KAA0K;AAC1K,kDAA4E;AAG5E,iDAA8C;AAC9C,+BAA6B;AAG7B,kFAA+E;AAC/E,wDAAsD;AAwCtD;;GAEG;AACH,MAAa,YAAa,SAAQ,KAAK,CAAC,SAGvC;IAQC,gBAAgB;IAChB,YAAY,KAAwB;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QARP,eAAU,GAAG,KAAK,CAAC;QACnB,qBAAgB,GAAG,KAAK,CAAC;QACzB,2BAAsB,GAAG,KAAK,CAAC;QA2D/B,2BAAsB,GAAG,GAAG,EAAE;YACpC,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;QACzB,CAAC,CAAC;QAqEM,cAAS,GAAG,CAAC,KAAa,EAAE,EAAE;YACpC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAChC,CAAC,CAAC;QAEM,gCAA2B,GAAG,CAAC,YAAoB,EAAE,EAAE;YAC7D,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE;gBACtB,OAAO,eAAO,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,E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AC,CAAC,CAAC,SAAS,CACS,CACzB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport classnames from \"classnames\";\nimport { produce } from \"immer\";\nimport * as React from \"react\";\nimport type { DisposeFunc } from \"@itwin/core-bentley\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type {\n CommonPropertyGridProps,\n PropertyCategory,\n PropertyData,\n} from \"@itwin/components-react\";\nimport {\n PropertyCategoryBlock,\n PropertyGridCommons,\n PropertyGridEventsRelatedPropsSupplier,\n} from \"@itwin/components-react\";\nimport type { ColumnResizeRelatedPropertyListProps } from \"@itwin/components-react/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier\";\nimport { ColumnResizingPropertyListPropsSupplier } from \"@itwin/components-react/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier\";\nimport { Orientation, ResizableContainerObserver } from \"@itwin/core-react\";\n\nimport type { PropertyListProps } from \"./PropertyList\";\nimport { PropertyList } from \"./PropertyList\";\nimport \"./PropertyGrid.scss\";\n\nimport type { PresentationPropertyDataProvider } from \"@itwin/presentation-components\";\nimport { GroupQueryBuilderContext } from \"../context/GroupQueryBuilderContext\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\n\n/** Properties for [[PropertyGrid]] React component\n * @public\n */\nexport interface PropertyGridProps extends CommonPropertyGridProps {\n /** Property data provider */\n dataProvider: PresentationPropertyDataProvider;\n}\n\n/** Property Category in the [[PropertyGrid]] state\n * @public\n * @deprecated This was part of [[PropertyGrid]] internal state and should've never been public. The component is not using it anymore.\n */\nexport interface PropertyGridCategory {\n propertyCategory: PropertyCategory;\n propertyCount: number;\n properties: PropertyRecord[];\n}\n\ninterface CategorizedPropertyGridRecords {\n category: PropertyCategory;\n records: PropertyRecord[];\n children: CategorizedPropertyGridRecords[];\n}\n\n/** State of [[PropertyGrid]] React component\n * @internal\n */\ninterface PropertyGridState {\n /** List of PropertyGrid categories */\n categories: CategorizedPropertyGridRecords[];\n /** Actual orientation used by the property grid */\n orientation: Orientation;\n /** If property grid currently loading data, the loading start time */\n loadStart?: Date;\n /** Width of PropertyGrid */\n width: number;\n}\n\n/** PropertyGrid React component.\n * @public\n */\nexport class PropertyGrid extends React.Component<\nPropertyGridProps,\nPropertyGridState\n> {\n private _dataChangesListenerDisposeFunc?: DisposeFunc;\n private _isMounted = false;\n private _isInDataRequest = false;\n private _hasPendingDataRequest = false;\n\n static override contextType = GroupQueryBuilderContext;\n\n /** @internal */\n constructor(props: PropertyGridProps) {\n super(props);\n this.state = {\n categories: [],\n orientation: this.getPreferredOrientation(),\n width: 0,\n };\n }\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this._dataChangesListenerDisposeFunc =\n this.props.dataProvider.onDataChanged.addListener(\n this._onPropertyDataChanged\n );\n\n void this.gatherData();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n // istanbul ignore else\n if (this._dataChangesListenerDisposeFunc) {\n this._dataChangesListenerDisposeFunc();\n this._dataChangesListenerDisposeFunc = undefined;\n }\n this._isMounted = false;\n }\n\n public override componentDidUpdate(prevProps: PropertyGridProps) {\n if (this.props.dataProvider !== prevProps.dataProvider) {\n // istanbul ignore else\n if (this._dataChangesListenerDisposeFunc) {\n this._dataChangesListenerDisposeFunc();\n }\n this._dataChangesListenerDisposeFunc =\n this.props.dataProvider.onDataChanged.addListener(\n this._onPropertyDataChanged\n );\n\n void this.gatherData();\n }\n\n if (\n this.props.orientation !== prevProps.orientation ||\n this.props.isOrientationFixed !== prevProps.isOrientationFixed ||\n this.props.horizontalOrientationMinWidth !==\n prevProps.horizontalOrientationMinWidth\n ) {\n this.updateOrientation(this.state.width);\n }\n }\n\n private _onPropertyDataChanged = () => {\n void this.gatherData();\n };\n\n private async gatherData(): Promise<void> {\n if (this._isInDataRequest) {\n this._hasPendingDataRequest = true;\n return;\n }\n\n this.setState((prev) =>\n prev.loadStart ? null : { loadStart: new Date() }\n );\n\n this._isInDataRequest = true;\n let propertyData: PropertyData;\n try {\n propertyData = await this.props.dataProvider.getData();\n } finally {\n this._isInDataRequest = false;\n }\n\n if (!this._isMounted) {\n return;\n }\n\n if (this._hasPendingDataRequest) {\n this._hasPendingDataRequest = false;\n return this.gatherData();\n }\n\n this.setState((prevState) => {\n const buildCategoriesHierarchy = (\n newCategories: PropertyCategory[],\n stateCategories: CategorizedPropertyGridRecords[] | undefined\n ) =>\n newCategories.map((category): CategorizedPropertyGridRecords => {\n const matchingStateCategory = findCategory(\n stateCategories ?? [],\n category.name,\n false\n );\n return {\n category: {\n ...category,\n expand:\n matchingStateCategory?.category?.expand ?? category.expand,\n },\n records: propertyData.records[category.name] ?? [],\n children: buildCategoriesHierarchy(\n category.childCategories ?? [],\n matchingStateCategory?.children\n ),\n };\n });\n return {\n categories: buildCategoriesHierarchy(\n propertyData.categories,\n prevState.categories\n ),\n loadStart: undefined,\n };\n });\n }\n\n private getPreferredOrientation(): Orientation {\n return this.props.orientation !== undefined\n ? this.props.orientation\n : Orientation.Horizontal;\n }\n\n private _onResize = (width: number) => {\n this.updateOrientation(width);\n };\n\n private _onCategoryExpansionToggled = (categoryName: string) => {\n this.setState((state) => {\n return produce(state, (draft) => {\n const records = findCategory(draft.categories, categoryName, true);\n // istanbul ignore else\n if (records) {\n const category = records.category;\n category.expand = !category.expand;\n }\n });\n });\n };\n\n private updateOrientation(width: number): void {\n const { orientation, isOrientationFixed, horizontalOrientationMinWidth } = {\n ...this.props,\n };\n const currentOrientation = PropertyGridCommons.getCurrentOrientation(\n width,\n orientation,\n isOrientationFixed,\n horizontalOrientationMinWidth\n );\n\n if (\n currentOrientation !== this.state.orientation ||\n width !== this.state.width\n ) {\n this.setState({ orientation: currentOrientation, width });\n }\n }\n\n /** @internal */\n public override render() {\n if (this.state.loadStart) {\n return (\n <div className=\"gm-components-property-grid-loader\">\n <ProgressRadial indeterminate />\n </div>\n );\n }\n\n return (\n <div className=\"table-box-inner\">\n <PropertyGridEventsRelatedPropsSupplier\n isPropertySelectionEnabled={\n this.props.isPropertySelectionEnabled ?? false\n }\n isPropertySelectionOnRightClickEnabled={\n this.props.isPropertySelectionOnRightClickEnabled\n }\n isPropertyEditingEnabled={this.props.isPropertyEditingEnabled}\n isPropertyHoverEnabled={this.props.isPropertyHoverEnabled ?? false}\n onPropertyContextMenu={this.props.onPropertyContextMenu}\n onPropertyUpdated={this.props.onPropertyUpdated}\n onPropertySelectionChanged={this.props.onPropertySelectionChanged}\n >\n {(selectionContext) => (\n <div\n className={classnames(\n \"components-property-grid-wrapper\",\n this.props.className\n )}\n style={this.props.style}\n >\n <div\n className={classnames(\n \"components-property-grid\",\n \"components-smallEditor-host\"\n )}\n >\n <div className=\"property-categories\">\n {this.state.categories.map(\n (categorizedRecords: CategorizedPropertyGridRecords) => (\n <NestedCategoryBlock\n {...selectionContext}\n key={categorizedRecords.category.name}\n categorizedRecords={categorizedRecords}\n onCategoryExpansionToggled={\n this._onCategoryExpansionToggled\n }\n orientation={this.state.orientation}\n propertyValueRendererManager={\n this.props.propertyValueRendererManager\n }\n actionButtonRenderers={this.props.actionButtonRenderers}\n />\n )\n )}\n </div>\n </div>\n <ResizableContainerObserver onResize={this._onResize} />\n </div>\n )}\n </PropertyGridEventsRelatedPropsSupplier>\n </div>\n );\n }\n}\n\nfunction findCategory(\n categories: CategorizedPropertyGridRecords[],\n lookupName: string,\n recurseIntoChildren: boolean\n): CategorizedPropertyGridRecords | undefined {\n for (const category of categories) {\n if (category.category.name === lookupName) {\n return category;\n }\n if (recurseIntoChildren) {\n const matchingChild = findCategory(\n category.children,\n lookupName,\n recurseIntoChildren\n );\n if (matchingChild) {\n return matchingChild;\n }\n }\n }\n return undefined;\n}\n\ninterface NestedCategoryBlockProps\n extends Omit<\n PropertyListProps,\n keyof ColumnResizeRelatedPropertyListProps | \"properties\"\n > {\n categorizedRecords: CategorizedPropertyGridRecords;\n onCategoryExpansionToggled: (categoryName: string) => void;\n orientation: Orientation;\n}\nconst NestedCategoryBlock = (props: NestedCategoryBlockProps) => {\n const [width, setWidth] = React.useState(1);\n return (\n <PropertyCategoryBlock\n category={props.categorizedRecords.category}\n onExpansionToggled={props.onCategoryExpansionToggled}\n >\n {props.categorizedRecords.records.length ? (\n <ColumnResizingPropertyListPropsSupplier\n orientation={props.orientation}\n width={width}\n >\n {(partialListProps: ColumnResizeRelatedPropertyListProps) => (\n <PropertyList\n {...partialListProps}\n orientation={props.orientation}\n category={props.categorizedRecords.category}\n properties={props.categorizedRecords.records}\n selectedPropertyKey={props.selectedPropertyKey}\n onPropertyClicked={props.onPropertyClicked}\n onPropertyRightClicked={props.onPropertyRightClicked}\n onPropertyContextMenu={props.onPropertyContextMenu}\n propertyValueRendererManager={props.propertyValueRendererManager}\n editingPropertyKey={props.editingPropertyKey}\n onEditCommit={props.onEditCommit}\n onEditCancel={props.onEditCancel}\n isPropertyHoverEnabled={props.isPropertyHoverEnabled}\n isPropertySelectionEnabled={props.isPropertySelectionEnabled}\n isPropertyRightClickSelectionEnabled={\n props.isPropertyRightClickSelectionEnabled\n }\n actionButtonRenderers={props.actionButtonRenderers}\n setWidth={setWidth}\n width={width}\n />\n )}\n </ColumnResizingPropertyListPropsSupplier>\n ) : undefined}\n {props.categorizedRecords.children.length ? (\n <div className=\"property-categories\">\n {props.categorizedRecords.children.map((categorizedChildRecords) => (\n <NestedCategoryBlock\n {...props}\n key={categorizedChildRecords.category.name}\n categorizedRecords={categorizedChildRecords}\n />\n ))}\n </div>\n ) : undefined}\n </PropertyCategoryBlock>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"PropertyGrid.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyGrid.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,4DAAoC;AACpC,iCAAgC;AAChC,6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B,EAAE,KAAK,CAAC,kBAAkB,EAC5C,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,sBAAsB,EAAE,KAAK,CAAC,sBAAsB,EACpD,0BAA0B,EAAE,KAAK,CAAC,0BAA0B,EAC5D,oCAAoC,EAClC,KAAK,CAAC,oCAAoC,EAE5C,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,EAClD,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,GACZ,CACH,CACuC,CAC3C,CAAC,CAAC,CAAC,SAAS;QACZ,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAC1C,6BAAK,SAAS,EAAC,yBAAyB,IACrC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAClE,oBAAC,mBAAmB,OACd,KAAK,EACT,GAAG,EAAE,uBAAuB,CAAC,QAAQ,CAAC,IAAI,EAC1C,kBAAkB,EAAE,uBAAuB,GAC3C,CACH,CAAC,CACE,CACP,CAAC,CAAC,CAAC,SAAS,CACS,CACzB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport classnames from \"classnames\";\nimport { produce } from \"immer\";\nimport * as React from \"react\";\nimport type { DisposeFunc } from \"@itwin/core-bentley\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type {\n CommonPropertyGridProps,\n PropertyCategory,\n PropertyData,\n} from \"@itwin/components-react\";\nimport {\n PropertyCategoryBlock,\n PropertyGridCommons,\n PropertyGridEventsRelatedPropsSupplier,\n} from \"@itwin/components-react\";\nimport type { ColumnResizeRelatedPropertyListProps } from \"@itwin/components-react/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier\";\nimport { ColumnResizingPropertyListPropsSupplier } from \"@itwin/components-react/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier\";\nimport { Orientation, ResizableContainerObserver } from \"@itwin/core-react\";\n\nimport type { PropertyListProps } from \"./PropertyList\";\nimport { PropertyList } from \"./PropertyList\";\nimport \"./PropertyGrid.scss\";\n\nimport type { PresentationPropertyDataProvider } from \"@itwin/presentation-components\";\nimport { GroupQueryBuilderContext } from \"../context/GroupQueryBuilderContext\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\n\n/** Properties for [[PropertyGrid]] React component\n * @public\n */\nexport interface PropertyGridProps extends CommonPropertyGridProps {\n /** Property data provider */\n dataProvider: PresentationPropertyDataProvider;\n}\n\n/** Property Category in the [[PropertyGrid]] state\n * @public\n * @deprecated This was part of [[PropertyGrid]] internal state and should've never been public. The component is not using it anymore.\n */\nexport interface PropertyGridCategory {\n propertyCategory: PropertyCategory;\n propertyCount: number;\n properties: PropertyRecord[];\n}\n\ninterface CategorizedPropertyGridRecords {\n category: PropertyCategory;\n records: PropertyRecord[];\n children: CategorizedPropertyGridRecords[];\n}\n\n/** State of [[PropertyGrid]] React component\n * @internal\n */\ninterface PropertyGridState {\n /** List of PropertyGrid categories */\n categories: CategorizedPropertyGridRecords[];\n /** Actual orientation used by the property grid */\n orientation: Orientation;\n /** If property grid currently loading data, the loading start time */\n loadStart?: Date;\n /** Width of PropertyGrid */\n width: number;\n}\n\n/** PropertyGrid React component.\n * @public\n */\nexport class PropertyGrid extends React.Component<\nPropertyGridProps,\nPropertyGridState\n> {\n private _dataChangesListenerDisposeFunc?: DisposeFunc;\n private _isMounted = false;\n private _isInDataRequest = false;\n private _hasPendingDataRequest = false;\n\n static override contextType = GroupQueryBuilderContext;\n\n /** @internal */\n constructor(props: PropertyGridProps) {\n super(props);\n this.state = {\n categories: [],\n orientation: this.getPreferredOrientation(),\n width: 0,\n };\n }\n\n /** @internal */\n public override componentDidMount() {\n this._isMounted = true;\n this._dataChangesListenerDisposeFunc =\n this.props.dataProvider.onDataChanged.addListener(\n this._onPropertyDataChanged\n );\n\n void this.gatherData();\n }\n\n /** @internal */\n public override componentWillUnmount() {\n // istanbul ignore else\n if (this._dataChangesListenerDisposeFunc) {\n this._dataChangesListenerDisposeFunc();\n this._dataChangesListenerDisposeFunc = undefined;\n }\n this._isMounted = false;\n }\n\n public override componentDidUpdate(prevProps: PropertyGridProps) {\n if (this.props.dataProvider !== prevProps.dataProvider) {\n // istanbul ignore else\n if (this._dataChangesListenerDisposeFunc) {\n this._dataChangesListenerDisposeFunc();\n }\n this._dataChangesListenerDisposeFunc =\n this.props.dataProvider.onDataChanged.addListener(\n this._onPropertyDataChanged\n );\n\n void this.gatherData();\n }\n\n if (\n this.props.orientation !== prevProps.orientation ||\n this.props.isOrientationFixed !== prevProps.isOrientationFixed ||\n this.props.horizontalOrientationMinWidth !==\n prevProps.horizontalOrientationMinWidth\n ) {\n this.updateOrientation(this.state.width);\n }\n }\n\n private _onPropertyDataChanged = () => {\n void this.gatherData();\n };\n\n private async gatherData(): Promise<void> {\n if (this._isInDataRequest) {\n this._hasPendingDataRequest = true;\n return;\n }\n\n this.setState((prev) =>\n prev.loadStart ? null : { loadStart: new Date() }\n );\n\n this._isInDataRequest = true;\n let propertyData: PropertyData;\n try {\n propertyData = await this.props.dataProvider.getData();\n } finally {\n this._isInDataRequest = false;\n }\n\n if (!this._isMounted) {\n return;\n }\n\n if (this._hasPendingDataRequest) {\n this._hasPendingDataRequest = false;\n return this.gatherData();\n }\n\n this.setState((prevState) => {\n const buildCategoriesHierarchy = (\n newCategories: PropertyCategory[],\n stateCategories: CategorizedPropertyGridRecords[] | undefined\n ) =>\n newCategories.map((category): CategorizedPropertyGridRecords => {\n const matchingStateCategory = findCategory(\n stateCategories ?? [],\n category.name,\n false\n );\n return {\n category: {\n ...category,\n expand:\n matchingStateCategory?.category?.expand ?? category.expand,\n },\n records: propertyData.records[category.name] ?? [],\n children: buildCategoriesHierarchy(\n category.childCategories ?? [],\n matchingStateCategory?.children\n ),\n };\n });\n return {\n categories: buildCategoriesHierarchy(\n propertyData.categories,\n prevState.categories\n ),\n loadStart: undefined,\n };\n });\n }\n\n private getPreferredOrientation(): Orientation {\n return this.props.orientation !== undefined\n ? this.props.orientation\n : Orientation.Horizontal;\n }\n\n private _onResize = (width: number) => {\n this.updateOrientation(width);\n };\n\n private _onCategoryExpansionToggled = (categoryName: string) => {\n this.setState((state) => {\n return produce(state, (draft) => {\n const records = findCategory(draft.categories, categoryName, true);\n // istanbul ignore else\n if (records) {\n const category = records.category;\n category.expand = !category.expand;\n }\n });\n });\n };\n\n private updateOrientation(width: number): void {\n const { orientation, isOrientationFixed, horizontalOrientationMinWidth } = {\n ...this.props,\n };\n const currentOrientation = PropertyGridCommons.getCurrentOrientation(\n width,\n orientation,\n isOrientationFixed,\n horizontalOrientationMinWidth\n );\n\n if (\n currentOrientation !== this.state.orientation ||\n width !== this.state.width\n ) {\n this.setState({ orientation: currentOrientation, width });\n }\n }\n\n /** @internal */\n public override render() {\n if (this.state.loadStart) {\n return (\n <div className=\"gmw-components-property-grid-loader\">\n <ProgressRadial indeterminate />\n </div>\n );\n }\n\n return (\n <div className=\"gmw-table-box-inner\">\n <PropertyGridEventsRelatedPropsSupplier\n isPropertySelectionEnabled={\n this.props.isPropertySelectionEnabled ?? false\n }\n isPropertySelectionOnRightClickEnabled={\n this.props.isPropertySelectionOnRightClickEnabled\n }\n isPropertyEditingEnabled={this.props.isPropertyEditingEnabled}\n isPropertyHoverEnabled={this.props.isPropertyHoverEnabled ?? false}\n onPropertyContextMenu={this.props.onPropertyContextMenu}\n onPropertyUpdated={this.props.onPropertyUpdated}\n onPropertySelectionChanged={this.props.onPropertySelectionChanged}\n >\n {(selectionContext) => (\n <div\n className={classnames(\n \"gmw-components-property-grid-wrapper\",\n this.props.className\n )}\n style={this.props.style}\n >\n <div\n className={classnames(\n \"gmw-components-property-grid\",\n \"components-smallEditor-host\"\n )}\n >\n <div className= \"gmw-property-categories\">\n {this.state.categories.map(\n (categorizedRecords: CategorizedPropertyGridRecords) => (\n <NestedCategoryBlock\n {...selectionContext}\n key={categorizedRecords.category.name}\n categorizedRecords={categorizedRecords}\n onCategoryExpansionToggled={\n this._onCategoryExpansionToggled\n }\n orientation={this.state.orientation}\n propertyValueRendererManager={\n this.props.propertyValueRendererManager\n }\n actionButtonRenderers={this.props.actionButtonRenderers}\n />\n )\n )}\n </div>\n </div>\n <ResizableContainerObserver onResize={this._onResize} />\n </div>\n )}\n </PropertyGridEventsRelatedPropsSupplier>\n </div>\n );\n }\n}\n\nfunction findCategory(\n categories: CategorizedPropertyGridRecords[],\n lookupName: string,\n recurseIntoChildren: boolean\n): CategorizedPropertyGridRecords | undefined {\n for (const category of categories) {\n if (category.category.name === lookupName) {\n return category;\n }\n if (recurseIntoChildren) {\n const matchingChild = findCategory(\n category.children,\n lookupName,\n recurseIntoChildren\n );\n if (matchingChild) {\n return matchingChild;\n }\n }\n }\n return undefined;\n}\n\ninterface NestedCategoryBlockProps\n extends Omit<\n PropertyListProps,\n keyof ColumnResizeRelatedPropertyListProps | \"properties\"\n > {\n categorizedRecords: CategorizedPropertyGridRecords;\n onCategoryExpansionToggled: (categoryName: string) => void;\n orientation: Orientation;\n}\nconst NestedCategoryBlock = (props: NestedCategoryBlockProps) => {\n const [width, setWidth] = React.useState(1);\n return (\n <PropertyCategoryBlock\n category={props.categorizedRecords.category}\n onExpansionToggled={props.onCategoryExpansionToggled}\n >\n {props.categorizedRecords.records.length ? (\n <ColumnResizingPropertyListPropsSupplier\n orientation={props.orientation}\n width={width}\n >\n {(partialListProps: ColumnResizeRelatedPropertyListProps) => (\n <PropertyList\n {...partialListProps}\n orientation={props.orientation}\n category={props.categorizedRecords.category}\n properties={props.categorizedRecords.records}\n selectedPropertyKey={props.selectedPropertyKey}\n onPropertyClicked={props.onPropertyClicked}\n onPropertyRightClicked={props.onPropertyRightClicked}\n onPropertyContextMenu={props.onPropertyContextMenu}\n propertyValueRendererManager={props.propertyValueRendererManager}\n editingPropertyKey={props.editingPropertyKey}\n onEditCommit={props.onEditCommit}\n onEditCancel={props.onEditCancel}\n isPropertyHoverEnabled={props.isPropertyHoverEnabled}\n isPropertySelectionEnabled={props.isPropertySelectionEnabled}\n isPropertyRightClickSelectionEnabled={\n props.isPropertyRightClickSelectionEnabled\n }\n actionButtonRenderers={props.actionButtonRenderers}\n setWidth={setWidth}\n width={width}\n />\n )}\n </ColumnResizingPropertyListPropsSupplier>\n ) : undefined}\n {props.categorizedRecords.children.length ? (\n <div className=\"gmw-property-categories\">\n {props.categorizedRecords.children.map((categorizedChildRecords) => (\n <NestedCategoryBlock\n {...props}\n key={categorizedChildRecords.category.name}\n categorizedRecords={categorizedChildRecords}\n />\n ))}\n </div>\n ) : undefined}\n </PropertyCategoryBlock>\n );\n};\n"]}
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
@import '~@itwin/core-react/lib/cjs/core-react/expandable/list';
|
|
6
6
|
@import '~@itwin/core-react/lib/cjs/core-react/scrollbar';
|
|
7
7
|
|
|
8
|
-
.
|
|
8
|
+
.gmw-components-property-grid-loader {
|
|
9
9
|
display: flex;
|
|
10
10
|
justify-content: center;
|
|
11
11
|
align-items: center;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
.components-property-grid {
|
|
15
|
-
.property-categories {
|
|
14
|
+
.gmw-components-property-grid {
|
|
15
|
+
.gmw-property-categories {
|
|
16
16
|
@include uicore-expandable-blocks-list;
|
|
17
17
|
|
|
18
18
|
display: grid;
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
color: $buic-foreground-body;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.components-property-grid-wrapper {
|
|
30
|
+
.gmw-components-property-grid-wrapper {
|
|
31
31
|
width: 100%;
|
|
32
32
|
height: 100%;
|
|
33
33
|
overflow-y: auto;
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
@include uicore-scrollbar();
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
@mixin components-property-list {
|
|
39
|
+
@mixin gmw-components-property-list {
|
|
40
40
|
width: 100%;
|
|
41
41
|
|
|
42
|
-
.components--selected {
|
|
42
|
+
.gmw-components--selected {
|
|
43
43
|
background-color: $buic-row-selection;
|
|
44
44
|
outline: 1px solid $buic-foreground-primary;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
.components--clickable {
|
|
47
|
+
.gmw-components--clickable {
|
|
48
48
|
cursor: pointer;
|
|
49
49
|
|
|
50
50
|
&:hover {
|
|
@@ -52,20 +52,20 @@
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
.components--hoverable:hover {
|
|
55
|
+
.gmw-components--hoverable:hover {
|
|
56
56
|
background-color: $buic-row-hover;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
.components-property-list--horizontal {
|
|
61
|
-
@include components-property-list;
|
|
60
|
+
.gmw-components-property-list--horizontal {
|
|
61
|
+
@include gmw-components-property-list;
|
|
62
62
|
|
|
63
63
|
display: grid;
|
|
64
64
|
grid-row-gap: 0px;
|
|
65
65
|
overflow: hidden;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
.components-property-list--vertical {
|
|
69
|
-
@include components-property-list;
|
|
68
|
+
.gmw-components-property-list--vertical {
|
|
69
|
+
@include gmw-components-property-list;
|
|
70
70
|
// margin-top: -13px;
|
|
71
71
|
}
|
|
@@ -58,7 +58,7 @@ class PropertyGridWrapperApp extends React.Component {
|
|
|
58
58
|
const dataProvider = this.state.dataProvider;
|
|
59
59
|
return (React.createElement(React.Fragment, null,
|
|
60
60
|
dataProvider && React.createElement(PropertyGrid_1.PropertyGrid, { dataProvider: dataProvider }),
|
|
61
|
-
!dataProvider && (React.createElement("div", { className: "select-element-hint" },
|
|
61
|
+
!dataProvider && (React.createElement("div", { className: "gmw-select-element-hint" },
|
|
62
62
|
React.createElement("span", null, "Select an element to see its properties.")))));
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyGridWrapper.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyGridWrapper.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6CAA+B;AAI/B,4EAAyE;AACzE,iDAA8C;AAC9C,qCAAmC;AACnC,kFAA+E;AAM/E;0DAC0D;AAC1D,MAAa,sBAAuB,SAAQ,KAAK,CAAC,SAGjD;IAEC,YAAY,KAA8C;QACxD,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAEO,kBAAkB;QACxB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE;YACjD,IAAI,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CAAC;YAC3C,OAAO;SACR;QAED,MAAM,YAAY,GAAG,2CAAoB,CAAC,0BAA0B,CAClE,IAAI,CAAC,KAAK,CAAC,IAAI,EACf,IAAI,CAAC,KAAK,CAAC,MAAM,CAClB,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,GAAG,YAAY,CAAC;QAEtD,IAAI,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;IAClC,CAAC;IAEe,iBAAiB;QAC/B,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;IAEe,kBAAkB,CAAC,SAAwB;QACzD,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;YACtC,OAAO;SACR;QAED,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;IAEe,MAAM;QACpB,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;QAC7C,OAAO,CACL;YACG,YAAY,IAAI,oBAAC,2BAAY,IAAC,YAAY,EAAE,YAAY,GAAI;YAC5D,CAAC,YAAY,IAAI,CAChB,6BAAK,SAAS,EAAC,
|
|
1
|
+
{"version":3,"file":"PropertyGridWrapper.js","sourceRoot":"","sources":["../../../../../src/widget/components/property-grid/PropertyGridWrapper.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6CAA+B;AAI/B,4EAAyE;AACzE,iDAA8C;AAC9C,qCAAmC;AACnC,kFAA+E;AAM/E;0DAC0D;AAC1D,MAAa,sBAAuB,SAAQ,KAAK,CAAC,SAGjD;IAEC,YAAY,KAA8C;QACxD,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IAClB,CAAC;IAEO,kBAAkB;QACxB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE;YACjD,IAAI,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CAAC;YAC3C,OAAO;SACR;QAED,MAAM,YAAY,GAAG,2CAAoB,CAAC,0BAA0B,CAClE,IAAI,CAAC,KAAK,CAAC,IAAI,EACf,IAAI,CAAC,KAAK,CAAC,MAAM,CAClB,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,GAAG,YAAY,CAAC;QAEtD,IAAI,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;IAClC,CAAC;IAEe,iBAAiB;QAC/B,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;IAEe,kBAAkB,CAAC,SAAwB;QACzD,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;YACtC,OAAO;SACR;QAED,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC5B,CAAC;IAEe,MAAM;QACpB,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;QAC7C,OAAO,CACL;YACG,YAAY,IAAI,oBAAC,2BAAY,IAAC,YAAY,EAAE,YAAY,GAAI;YAC5D,CAAC,YAAY,IAAI,CAChB,6BAAK,SAAS,EAAC,yBAAyB;gBACtC,6EAAqD,CACjD,CACP,CACA,CACJ,CAAC;IACJ,CAAC;;AAjDH,wDAkDC;AA9CiB,kCAAW,GAAG,mDAAwB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport type { PresentationPropertyDataProvider } from \"@itwin/presentation-components\";\n\nimport type { PropertyProps } from \"../../../api/GroupQueryBuilderApi\";\nimport { GroupQueryBuilderApi } from \"../../../api/GroupQueryBuilderApi\";\nimport { PropertyGrid } from \"./PropertyGrid\";\nimport \"../GroupQueryBuilder.scss\";\nimport { GroupQueryBuilderContext } from \"../context/GroupQueryBuilderContext\";\n\ninterface PropertyGridWrapperState {\n dataProvider?: PresentationPropertyDataProvider;\n}\n\n/* This approach uses PresentationPropertyDataProvider to all the work of querying the backend and\n providing the content to the PropertyGrid component. */\nexport class PropertyGridWrapperApp extends React.Component<\nPropertyProps,\nPropertyGridWrapperState\n> {\n static override contextType = GroupQueryBuilderContext;\n constructor(props: PropertyProps | Readonly<PropertyProps>) {\n super(props);\n this.state = {};\n }\n\n private createDataProvider() {\n if (!this.props.imodel || this.props.keys.isEmpty) {\n this.setState({ dataProvider: undefined });\n return;\n }\n\n const dataProvider = GroupQueryBuilderApi.createPropertyDataProvider(\n this.props.keys,\n this.props.imodel\n );\n this.context.queryBuilder.dataProvider = dataProvider;\n\n this.setState({ dataProvider });\n }\n\n public override componentDidMount() {\n this.createDataProvider();\n }\n\n public override componentDidUpdate(prevProps: PropertyProps) {\n if (prevProps.keys === this.props.keys) {\n return;\n }\n\n this.createDataProvider();\n }\n\n public override render() {\n const dataProvider = this.state.dataProvider;\n return (\n <>\n {dataProvider && <PropertyGrid dataProvider={dataProvider} />}\n {!dataProvider && (\n <div className=\"gmw-select-element-hint\">\n <span>Select an element to see its properties.</span>\n </div>\n )}\n </>\n );\n }\n}\n"]}
|
|
@@ -76,7 +76,7 @@ class PropertyList extends React.Component {
|
|
|
76
76
|
}
|
|
77
77
|
/** @internal */
|
|
78
78
|
render() {
|
|
79
|
-
const propertyListClassName = classnames_1.default((this.props.orientation === core_react_1.Orientation.Horizontal) ? "components-property-list--horizontal" : "components-property-list--vertical", this.props.className);
|
|
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
80
|
return (React.createElement("div", { className: propertyListClassName, style: this.props.style, ref: this._listRef }, this.props.properties.map((propertyRecord) => {
|
|
81
81
|
const key = this.props.category ? getPropertyKey(this.props.category, propertyRecord) : propertyRecord.property.name;
|
|
82
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 }));
|
|
@@ -1 +1 @@
|
|
|
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;AACH,SAAgB,cAAc,CAAC,gBAAkC,EAAE,cAA8B;IAC/F,OAAO,gBAAgB,CAAC,IAAI,GAAG,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC9D,CAAC;AAFD,wCAEC;AAED;;GAEG;AACH,MAAa,YAAa,SAAQ,KAAK,CAAC,SAA4B;IAElE,YAAY,KAAwB;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QAGP,aAAQ,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAE7C,kBAAa,GAAG,CAAC,IAAyB,EAAE,EAAE;YACpD,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ;gBAChD,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACvD,CAAC,CAAC;IARF,CAAC;IAUO,WAAW;QACjB,IACE,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,wBAAW,CAAC,UAAU;YACjD,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EACtB;YACA,OAAO;SACR;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC,KAAK,CAAC;QAClE,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;YACrD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SAC5B;IACH,CAAC;IAED,gBAAgB;IACA,iBAAiB;QAC/B,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAED,gBAAgB;IACA,kBAAkB;QAChC,IAAI,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;IAED,gBAAgB;IACA,MAAM;QACpB,MAAM,qBAAqB,GAAG,oBAAU,CACtC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,KAAK,wBAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,
|
|
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;AACH,SAAgB,cAAc,CAAC,gBAAkC,EAAE,cAA8B;IAC/F,OAAO,gBAAgB,CAAC,IAAI,GAAG,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC;AAC9D,CAAC;AAFD,wCAEC;AAED;;GAEG;AACH,MAAa,YAAa,SAAQ,KAAK,CAAC,SAA4B;IAElE,YAAY,KAAwB;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QAGP,aAAQ,GAAG,KAAK,CAAC,SAAS,EAAkB,CAAC;QAE7C,kBAAa,GAAG,CAAC,IAAyB,EAAE,EAAE;YACpD,uBAAuB;YACvB,IAAI,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ;gBAChD,IAAI,CAAC,KAAK,CAAC,YAAY,CA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jE,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"]}
|
|
@@ -194,8 +194,8 @@ const PropertyView = (props) => {
|
|
|
194
194
|
};
|
|
195
195
|
const getClassName = (viewProps) => {
|
|
196
196
|
let propertyRecordClassName = viewProps.orientation === core_react_1.Orientation.Horizontal
|
|
197
|
-
? "components-property-record--horizontal"
|
|
198
|
-
: "components-property-record--vertical";
|
|
197
|
+
? "gmw-components-property-record--horizontal"
|
|
198
|
+
: "gmw-components-property-record--vertical";
|
|
199
199
|
if (viewProps.isSelected) {
|
|
200
200
|
propertyRecordClassName += " components--selected";
|
|
201
201
|
}
|
|
@@ -214,15 +214,15 @@ const PropertyView = (props) => {
|
|
|
214
214
|
const columnsStyleProvider = new PropertyGridColumns_1.PropertyGridColumnStyleProvider(props.columnInfo);
|
|
215
215
|
const offset = CommonPropertyRenderer_1.CommonPropertyRenderer.getLabelOffset(props.indentation, props.orientation, props.width, props.columnRatio, (_a = props.columnInfo) === null || _a === void 0 ? void 0 : _a.minLabelWidth);
|
|
216
216
|
return (React.createElement("div", { style: columnsStyleProvider.getStyle(props.orientation, needActionButtons, ratio, needElementSeparator), className: getClassName(props), onClick: _onClick, onContextMenu: _onContextMenu, onMouseEnter: _onMouseEnter, onMouseLeave: _onMouseLeave, role: "presentation" },
|
|
217
|
-
React.createElement("div", { className: "components-property-record-label" },
|
|
217
|
+
React.createElement("div", { className: "gmw-components-property-record-label" },
|
|
218
218
|
props.propertyRecord.value.valueFormat ===
|
|
219
|
-
appui_abstract_1.PropertyValueFormat.Primitive && (React.createElement(itwinui_react_1.Checkbox, { style: { marginLeft: offset }, className: "components-property-selection-checkbox", checked: isPropertySelected, onChange: _onPropertySelectionChanged, disabled: context.isLoading ||
|
|
219
|
+
appui_abstract_1.PropertyValueFormat.Primitive && (React.createElement(itwinui_react_1.Checkbox, { style: { marginLeft: offset }, className: "gmw-components-property-selection-checkbox", checked: isPropertySelected, onChange: _onPropertySelectionChanged, disabled: context.isLoading ||
|
|
220
220
|
context.isRendering ||
|
|
221
221
|
props.propertyRecord.value.value === undefined, isLoading: isCheckboxLoading })),
|
|
222
222
|
props.labelElement),
|
|
223
223
|
needElementSeparator ? (React.createElement(core_react_1.ElementSeparator, { movableArea: props.width, onRatioChanged: props.onColumnRatioChanged, ratio: ratio, orientation: props.orientation, isResizeHandleHovered: props.isResizeHandleHovered, onResizeHandleHoverChanged: props.onResizeHandleHoverChanged, isResizeHandleBeingDragged: props.isResizeHandleBeingDragged, onResizeHandleDragChanged: props.onResizeHandleDragChanged })) : undefined,
|
|
224
224
|
props.propertyRecord.value.valueFormat ===
|
|
225
|
-
appui_abstract_1.PropertyValueFormat.Primitive ? (React.createElement("div", { className: "components-property-record-value" },
|
|
225
|
+
appui_abstract_1.PropertyValueFormat.Primitive ? (React.createElement("div", { className: "gmw-components-property-record-value" },
|
|
226
226
|
React.createElement("span", null, props.valueElementRenderer
|
|
227
227
|
? props.valueElementRenderer()
|
|
228
228
|
: props.valueElement))) : undefined,
|