@itwin/grouping-mapping-widget 0.30.1 → 0.31.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/WidgetShell/Router/GroupingMappingRouter.js +3 -1
- package/lib/cjs/WidgetShell/Router/GroupingMappingRouter.js.map +1 -1
- package/lib/cjs/components/GroupingMappingContext.js +5 -0
- package/lib/cjs/components/GroupingMappingContext.js.map +1 -1
- package/lib/cjs/components/Groups/GroupColorLegend.d.ts +2 -4
- package/lib/cjs/components/Groups/GroupColorLegend.js +2 -3
- package/lib/cjs/components/Groups/GroupColorLegend.js.map +1 -1
- package/lib/cjs/components/Groups/GroupsVisualization.d.ts +2 -1
- package/lib/cjs/components/Groups/GroupsVisualization.js +10 -5
- package/lib/cjs/components/Groups/GroupsVisualization.js.map +1 -1
- package/lib/cjs/components/Properties/GroupColorToggle.d.ts +2 -1
- package/lib/cjs/components/Properties/GroupColorToggle.js +11 -2
- package/lib/cjs/components/Properties/GroupColorToggle.js.map +1 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.d.ts +2 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.js +2 -2
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.js.map +1 -1
- package/lib/cjs/components/Properties/PropertyMenu.d.ts +2 -1
- package/lib/cjs/components/Properties/PropertyMenu.js +2 -2
- package/lib/cjs/components/Properties/PropertyMenu.js.map +1 -1
- package/lib/cjs/components/Properties/PropertyMenuWithVisualization.d.ts +3 -1
- package/lib/cjs/components/Properties/PropertyMenuWithVisualization.js +2 -2
- package/lib/cjs/components/Properties/PropertyMenuWithVisualization.js.map +1 -1
- package/lib/cjs/components/Properties/PropertyTable.d.ts +2 -1
- package/lib/cjs/components/Properties/PropertyTable.js +3 -2
- package/lib/cjs/components/Properties/PropertyTable.js.map +1 -1
- package/lib/cjs/components/context/GroupHilitedElementsContext.d.ts +2 -0
- package/lib/cjs/components/context/GroupHilitedElementsContext.js +2 -0
- package/lib/cjs/components/context/GroupHilitedElementsContext.js.map +1 -1
- package/lib/esm/WidgetShell/Router/GroupingMappingRouter.js +3 -1
- package/lib/esm/WidgetShell/Router/GroupingMappingRouter.js.map +1 -1
- package/lib/esm/components/GroupingMappingContext.js +5 -0
- package/lib/esm/components/GroupingMappingContext.js.map +1 -1
- package/lib/esm/components/Groups/GroupColorLegend.d.ts +2 -4
- package/lib/esm/components/Groups/GroupColorLegend.js +2 -3
- package/lib/esm/components/Groups/GroupColorLegend.js.map +1 -1
- package/lib/esm/components/Groups/GroupsVisualization.d.ts +2 -1
- package/lib/esm/components/Groups/GroupsVisualization.js +11 -6
- package/lib/esm/components/Groups/GroupsVisualization.js.map +1 -1
- package/lib/esm/components/Properties/GroupColorToggle.d.ts +2 -1
- package/lib/esm/components/Properties/GroupColorToggle.js +11 -2
- package/lib/esm/components/Properties/GroupColorToggle.js.map +1 -1
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.d.ts +2 -1
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.js +2 -2
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.js.map +1 -1
- package/lib/esm/components/Properties/PropertyMenu.d.ts +2 -1
- package/lib/esm/components/Properties/PropertyMenu.js +2 -2
- package/lib/esm/components/Properties/PropertyMenu.js.map +1 -1
- package/lib/esm/components/Properties/PropertyMenuWithVisualization.d.ts +3 -1
- package/lib/esm/components/Properties/PropertyMenuWithVisualization.js +2 -2
- package/lib/esm/components/Properties/PropertyMenuWithVisualization.js.map +1 -1
- package/lib/esm/components/Properties/PropertyTable.d.ts +2 -1
- package/lib/esm/components/Properties/PropertyTable.js +3 -2
- package/lib/esm/components/Properties/PropertyTable.js.map +1 -1
- package/lib/esm/components/context/GroupHilitedElementsContext.d.ts +2 -0
- package/lib/esm/components/context/GroupHilitedElementsContext.js +2 -0
- package/lib/esm/components/context/GroupHilitedElementsContext.js.map +1 -1
- package/package.json +1 -1
|
@@ -39,7 +39,7 @@ const PropertiesClientContext_1 = require("../context/PropertiesClientContext");
|
|
|
39
39
|
* Component to display the properties of a group.
|
|
40
40
|
* @public
|
|
41
41
|
*/
|
|
42
|
-
const PropertyMenu = ({ mapping, group, onClickAddGroupProperty, onClickModifyGroupProperty, hideRefreshIcon, hideGroupProps = false, }) => {
|
|
42
|
+
const PropertyMenu = ({ mapping, group, onClickAddGroupProperty, onClickModifyGroupProperty, hideRefreshIcon, onGroupPropertyDelete, hideGroupProps = false, }) => {
|
|
43
43
|
const groupId = group.id;
|
|
44
44
|
const mappingId = mapping.id;
|
|
45
45
|
const { getAccessToken, iModelId } = (0, GroupingApiConfigContext_1.useGroupingMappingApiConfig)();
|
|
@@ -47,7 +47,7 @@ const PropertyMenu = ({ mapping, group, onClickAddGroupProperty, onClickModifyGr
|
|
|
47
47
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
48
48
|
const { data: groupProperties, isFetching: isLoadingGroupProperties } = (0, usePropertiesQuery_1.usePropertiesQuery)(iModelId, mappingId, groupId, getAccessToken, propertiesClient);
|
|
49
49
|
const refreshGroupProperties = (0, react_1.useCallback)(async () => queryClient.invalidateQueries({ queryKey: ["properties", iModelId, mappingId, group.id] }), [group.id, iModelId, mappingId, queryClient]);
|
|
50
|
-
return (react_1.default.createElement("div", { className: "gmw-property-menu-wrapper" }, !hideGroupProps && (react_1.default.createElement(GroupPropertyTable_1.GroupPropertyTable, { iModelId: iModelId, mappingId: mappingId, groupId: groupId, onClickAdd: onClickAddGroupProperty, onClickModify: onClickModifyGroupProperty, isLoading: isLoadingGroupProperties, groupProperties: groupProperties ? groupProperties.properties : [], refresh: refreshGroupProperties, hideRefreshIcon: hideRefreshIcon }))));
|
|
50
|
+
return (react_1.default.createElement("div", { className: "gmw-property-menu-wrapper" }, !hideGroupProps && (react_1.default.createElement(GroupPropertyTable_1.GroupPropertyTable, { iModelId: iModelId, mappingId: mappingId, groupId: groupId, onClickAdd: onClickAddGroupProperty, onClickModify: onClickModifyGroupProperty, isLoading: isLoadingGroupProperties, groupProperties: groupProperties ? groupProperties.properties : [], refresh: refreshGroupProperties, hideRefreshIcon: hideRefreshIcon, onGroupPropertyDelete: onGroupPropertyDelete }))));
|
|
51
51
|
};
|
|
52
52
|
exports.PropertyMenu = PropertyMenu;
|
|
53
53
|
//# sourceMappingURL=PropertyMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyMenu.js","sourceRoot":"","sources":["../../../../src/components/Properties/PropertyMenu.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,+CAA2C;AAC3C,+BAA6B;AAC7B,6EAA0E;AAC1E,kFAAkF;AAElF,mEAAgE;AAChE,uDAAuD;AACvD,gFAAyE;
|
|
1
|
+
{"version":3,"file":"PropertyMenu.js","sourceRoot":"","sources":["../../../../src/components/Properties/PropertyMenu.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,+CAA2C;AAC3C,+BAA6B;AAC7B,6EAA0E;AAC1E,kFAAkF;AAElF,mEAAgE;AAChE,uDAAuD;AACvD,gFAAyE;AAsBzE;;;GAGG;AACI,MAAM,YAAY,GAAG,CAAC,EAC3B,OAAO,EACP,KAAK,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,eAAe,EACf,qBAAqB,EACrB,cAAc,GAAG,KAAK,GACJ,EAAE,EAAE;IACtB,MAAM,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;IACzB,MAAM,SAAS,GAAG,OAAO,CAAC,EAAE,CAAC;IAC7B,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,IAAA,sDAA2B,GAAE,CAAC;IACnE,MAAM,gBAAgB,GAAG,IAAA,6CAAmB,GAAE,CAAC;IAC/C,MAAM,WAAW,GAAG,IAAA,4BAAc,GAAE,CAAC;IAErC,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,UAAU,EAAE,wBAAwB,EAAE,GAAG,IAAA,uCAAkB,EAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,gBAAgB,CAAC,CAAC;IAE3J,MAAM,sBAAsB,GAAG,IAAA,mBAAW,EACxC,KAAK,IAAI,EAAE,CAAC,WAAW,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,EACtG,CAAC,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC,CAC7C,CAAC;IAEF,OAAO,CACL,uCAAK,SAAS,EAAC,2BAA2B,IACvC,CAAC,cAAc,IAAI,CAClB,8BAAC,uCAAkB,IACjB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,uBAAuB,EACnC,aAAa,EAAE,0BAA0B,EACzC,SAAS,EAAE,wBAAwB,EACnC,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAClE,OAAO,EAAE,sBAAsB,EAC/B,eAAe,EAAE,eAAe,EAChC,qBAAqB,EAAE,qBAAqB,GAC5C,CACH,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AAxCW,QAAA,YAAY,gBAwCvB","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport React, { useCallback } from \"react\";\nimport \"./PropertyMenu.scss\";\nimport { GroupPropertyTable } from \"./GroupProperties/GroupPropertyTable\";\nimport { useGroupingMappingApiConfig } from \"../context/GroupingApiConfigContext\";\nimport type { GroupMinimal, Mapping, Property } from \"@itwin/insights-client\";\nimport { usePropertiesQuery } from \"./hooks/usePropertiesQuery\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { usePropertiesClient } from \"../context/PropertiesClientContext\";\n\n/**\n * Props for the {@link PropertyMenu} component.\n * @public\n */\nexport interface PropertyMenuProps {\n mapping: Mapping;\n group: GroupMinimal;\n onClickAddGroupProperty?: () => void;\n onClickModifyGroupProperty?: (groupProperty: Property) => void;\n onClickAddCalculatedProperty?: () => void;\n onClickModifyCalculatedProperty?: (calculatedProperty: Property) => void;\n onClickAddCustomCalculationProperty?: () => void;\n onClickModifyCustomCalculation?: (customCalculation: Property) => void;\n hideGroupProps?: boolean;\n hideCalculatedProps?: boolean;\n hideCustomCalculationProps?: boolean;\n hideRefreshIcon?: boolean;\n onGroupPropertyDelete?: () => void;\n}\n\n/**\n * Component to display the properties of a group.\n * @public\n */\nexport const PropertyMenu = ({\n mapping,\n group,\n onClickAddGroupProperty,\n onClickModifyGroupProperty,\n hideRefreshIcon,\n onGroupPropertyDelete,\n hideGroupProps = false,\n}: PropertyMenuProps) => {\n const groupId = group.id;\n const mappingId = mapping.id;\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const propertiesClient = usePropertiesClient();\n const queryClient = useQueryClient();\n\n const { data: groupProperties, isFetching: isLoadingGroupProperties } = usePropertiesQuery(iModelId, mappingId, groupId, getAccessToken, propertiesClient);\n\n const refreshGroupProperties = useCallback(\n async () => queryClient.invalidateQueries({ queryKey: [\"properties\", iModelId, mappingId, group.id] }),\n [group.id, iModelId, mappingId, queryClient],\n );\n\n return (\n <div className=\"gmw-property-menu-wrapper\">\n {!hideGroupProps && (\n <GroupPropertyTable\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n onClickAdd={onClickAddGroupProperty}\n onClickModify={onClickModifyGroupProperty}\n isLoading={isLoadingGroupProperties}\n groupProperties={groupProperties ? groupProperties.properties : []}\n refresh={refreshGroupProperties}\n hideRefreshIcon={hideRefreshIcon}\n onGroupPropertyDelete={onGroupPropertyDelete}\n />\n )}\n </div>\n );\n};\n"]}
|
|
@@ -7,10 +7,12 @@ import "./PropertyMenuWithVisualization.scss";
|
|
|
7
7
|
*/
|
|
8
8
|
export interface PropertyMenuWithVisualizationProps extends PropertyMenuProps {
|
|
9
9
|
color: string;
|
|
10
|
+
disableZoom?: boolean;
|
|
11
|
+
onGroupPropertyDelete?: () => void;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* Component to display a property menu with visualization.
|
|
13
15
|
* @public
|
|
14
16
|
*/
|
|
15
|
-
export declare const PropertyMenuWithVisualization: ({ group, color, hideRefreshIcon, ...rest }: PropertyMenuWithVisualizationProps) => JSX.Element;
|
|
17
|
+
export declare const PropertyMenuWithVisualization: ({ group, color, hideRefreshIcon, disableZoom, ...rest }: PropertyMenuWithVisualizationProps) => JSX.Element;
|
|
16
18
|
//# sourceMappingURL=PropertyMenuWithVisualization.d.ts.map
|
|
@@ -39,11 +39,11 @@ require("./PropertyMenuWithVisualization.scss");
|
|
|
39
39
|
* Component to display a property menu with visualization.
|
|
40
40
|
* @public
|
|
41
41
|
*/
|
|
42
|
-
const PropertyMenuWithVisualization = ({ group, color, hideRefreshIcon, ...rest }) => {
|
|
42
|
+
const PropertyMenuWithVisualization = ({ group, color, hideRefreshIcon, disableZoom, ...rest }) => {
|
|
43
43
|
const [isInformationPanelOpen, setIsInformationPanelOpen] = (0, react_1.useState)(false);
|
|
44
44
|
return (react_1.default.createElement(itwinui_react_1.InformationPanelWrapper, { className: "gmw-property-menu-vis-wrapper" },
|
|
45
45
|
react_1.default.createElement("div", { className: "gmw-property-menu-vis-toolbar" },
|
|
46
|
-
react_1.default.createElement(GroupColorToggle_1.GroupColorToggle, { group: group, color: color, labelPosition: "left" }),
|
|
46
|
+
react_1.default.createElement(GroupColorToggle_1.GroupColorToggle, { group: group, color: color, labelPosition: "left", disableZoom: disableZoom }),
|
|
47
47
|
react_1.default.createElement(itwinui_react_1.IconButton, { styleType: "borderless", onClick: () => setIsInformationPanelOpen(true), title: "Group Information" },
|
|
48
48
|
react_1.default.createElement(itwinui_icons_react_1.SvgProperties, null))),
|
|
49
49
|
react_1.default.createElement(PropertyMenu_1.PropertyMenu, { group: group, hideRefreshIcon: hideRefreshIcon, ...rest }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyMenuWithVisualization.js","sourceRoot":"","sources":["../../../../src/components/Properties/PropertyMenuWithVisualization.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,+CAAwC;AAExC,iDAA8C;AAC9C,yDAAsD;AACtD,wDAA2E;AAC3E,mEAAgE;AAChE,oEAA2D;AAC3D,gDAA8C;
|
|
1
|
+
{"version":3,"file":"PropertyMenuWithVisualization.js","sourceRoot":"","sources":["../../../../src/components/Properties/PropertyMenuWithVisualization.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,+CAAwC;AAExC,iDAA8C;AAC9C,yDAAsD;AACtD,wDAA2E;AAC3E,mEAAgE;AAChE,oEAA2D;AAC3D,gDAA8C;AAY9C;;;GAGG;AACI,MAAM,6BAA6B,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,IAAI,EAAsC,EAAE,EAAE;IAC3I,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,CAAC,GAAG,IAAA,gBAAQ,EAAU,KAAK,CAAC,CAAC;IAErF,OAAO,CACL,8BAAC,uCAAuB,IAAC,SAAS,EAAC,+BAA+B;QAChE,uCAAK,SAAS,EAAC,+BAA+B;YAC5C,8BAAC,mCAAgB,IAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAC,MAAM,EAAC,WAAW,EAAE,WAAW,GAAI;YAC/F,8BAAC,0BAAU,IAAC,SAAS,EAAC,YAAY,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAC,mBAAmB;gBAC1G,8BAAC,mCAAa,OAAG,CACN,CACT;QACN,8BAAC,2BAAY,IAAC,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,KAAM,IAAI,GAAI;QAC1E,8BAAC,6CAAqB,IAAC,MAAM,EAAE,sBAAsB,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,GAAI,CAClI,CAC3B,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,6BAA6B,iCAexC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport React, { useState } from \"react\";\nimport type { PropertyMenuProps } from \"./PropertyMenu\";\nimport { PropertyMenu } from \"./PropertyMenu\";\nimport { GroupColorToggle } from \"./GroupColorToggle\";\nimport { IconButton, InformationPanelWrapper } from \"@itwin/itwinui-react\";\nimport { GroupInformationPanel } from \"./GroupInformationPanel\";\nimport { SvgProperties } from \"@itwin/itwinui-icons-react\";\nimport \"./PropertyMenuWithVisualization.scss\";\n\n/**\n * Properties for the {@link PropertyMenuWithVisualization} component.\n * @public\n */\nexport interface PropertyMenuWithVisualizationProps extends PropertyMenuProps {\n color: string;\n disableZoom?: boolean;\n onGroupPropertyDelete?: () => void;\n}\n\n/**\n * Component to display a property menu with visualization.\n * @public\n */\nexport const PropertyMenuWithVisualization = ({ group, color, hideRefreshIcon, disableZoom, ...rest }: PropertyMenuWithVisualizationProps) => {\n const [isInformationPanelOpen, setIsInformationPanelOpen] = useState<boolean>(false);\n\n return (\n <InformationPanelWrapper className=\"gmw-property-menu-vis-wrapper\">\n <div className=\"gmw-property-menu-vis-toolbar\">\n <GroupColorToggle group={group} color={color} labelPosition=\"left\" disableZoom={disableZoom} />\n <IconButton styleType=\"borderless\" onClick={() => setIsInformationPanelOpen(true)} title=\"Group Information\">\n <SvgProperties />\n </IconButton>\n </div>\n <PropertyMenu group={group} hideRefreshIcon={hideRefreshIcon} {...rest} />\n <GroupInformationPanel isOpen={isInformationPanelOpen} onClose={() => setIsInformationPanelOpen(false)} query={group.query} groupName={group.groupName} />\n </InformationPanelWrapper>\n );\n};\n"]}
|
|
@@ -14,6 +14,7 @@ export interface PropertyTableProps<T extends PropertyTableItem> {
|
|
|
14
14
|
refreshProperties: () => Promise<void>;
|
|
15
15
|
deleteProperty: (propertyId: string) => Promise<void>;
|
|
16
16
|
hideRefreshIcon?: boolean;
|
|
17
|
+
onGroupPropertyDelete?: () => void;
|
|
17
18
|
}
|
|
18
|
-
export declare const PropertyTable: <T extends PropertyTableItem>({ propertyType, columnsFactory, data, isLoading, onClickAdd, refreshProperties, deleteProperty, hideRefreshIcon, }: PropertyTableProps<T>) => JSX.Element;
|
|
19
|
+
export declare const PropertyTable: <T extends PropertyTableItem>({ propertyType, columnsFactory, data, isLoading, onClickAdd, refreshProperties, deleteProperty, hideRefreshIcon, onGroupPropertyDelete, }: PropertyTableProps<T>) => JSX.Element;
|
|
19
20
|
//# sourceMappingURL=PropertyTable.d.ts.map
|
|
@@ -36,11 +36,12 @@ const react_1 = __importStar(require("react"));
|
|
|
36
36
|
const DeleteModal_1 = __importDefault(require("../SharedComponents/DeleteModal"));
|
|
37
37
|
const PropertyTableToolbar_1 = require("./PropertyTableToolbar");
|
|
38
38
|
require("./PropertyTable.scss");
|
|
39
|
-
const PropertyTable = ({ propertyType, columnsFactory, data, isLoading, onClickAdd, refreshProperties, deleteProperty, hideRefreshIcon, }) => {
|
|
39
|
+
const PropertyTable = ({ propertyType, columnsFactory, data, isLoading, onClickAdd, refreshProperties, deleteProperty, hideRefreshIcon, onGroupPropertyDelete, }) => {
|
|
40
40
|
const [showDeleteModal, setShowDeleteModal] = (0, react_1.useState)(undefined);
|
|
41
41
|
const handleDeleteProperty = (0, react_1.useCallback)(async () => {
|
|
42
42
|
await deleteProperty(showDeleteModal?.id ?? "");
|
|
43
|
-
|
|
43
|
+
onGroupPropertyDelete?.();
|
|
44
|
+
}, [deleteProperty, showDeleteModal?.id, onGroupPropertyDelete]);
|
|
44
45
|
const handleShowDeleteModal = (0, react_1.useCallback)((property) => {
|
|
45
46
|
setShowDeleteModal(property);
|
|
46
47
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyTable.js","sourceRoot":"","sources":["../../../../src/components/Properties/PropertyTable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,wDAA6C;AAC7C,+CAA8D;AAG9D,kFAA0D;AAC1D,iEAA8D;AAC9D,gCAA8B;
|
|
1
|
+
{"version":3,"file":"PropertyTable.js","sourceRoot":"","sources":["../../../../src/components/Properties/PropertyTable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,wDAA6C;AAC7C,+CAA8D;AAG9D,kFAA0D;AAC1D,iEAA8D;AAC9D,gCAA8B;AAmBvB,MAAM,aAAa,GAAG,CAA8B,EACzD,YAAY,EACZ,cAAc,EACd,IAAI,EACJ,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,qBAAqB,GACC,EAAE,EAAE;IAC1B,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,IAAA,gBAAQ,EAAgB,SAAS,CAAC,CAAC;IAEjF,MAAM,oBAAoB,GAAG,IAAA,mBAAW,EAAC,KAAK,IAAI,EAAE;QAClD,MAAM,cAAc,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,qBAAqB,EAAE,EAAE,CAAC;IAC5B,CAAC,EAAE,CAAC,cAAc,EAAE,eAAe,EAAE,EAAE,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAEjE,MAAM,qBAAqB,GAAG,IAAA,mBAAW,EAAC,CAAC,QAAW,EAAE,EAAE;QACxD,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,sBAAsB,GAAG,GAAG,EAAE;QAClC,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAChC,CAAC,CAAC;IAEF,MAAM,eAAe,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,cAAc,CAAC,qBAAqB,CAAC,EAAE,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAEtH,OAAO,CACL,uCAAK,SAAS,EAAC,8BAA8B;QAC3C,8BAAC,2CAAoB,IACnB,YAAY,EAAE,YAAY,EAC1B,kBAAkB,EAAE,UAAU,EAC9B,iBAAiB,EAAE,iBAAiB,EACpC,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,eAAe,GAChC;QACF,8BAAC,qBAAK,IACJ,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAC3B,OAAO,EAAC,iBAAiB,EACzB,OAAO,EAAE,eAAe,EACxB,iBAAiB,EAAE,MAAM,YAAY,aAAa,EAClD,UAAU,QACV,SAAS,EAAE,SAAS,GACpB;QACD,eAAe,IAAI,8BAAC,qBAAW,IAAC,UAAU,EAAE,eAAe,CAAC,YAAY,EAAE,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,oBAAoB,GAAI,CAC1I,CACP,CAAC;AACJ,CAAC,CAAC;AAhDW,QAAA,aAAa,iBAgDxB","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 { Table } from \"@itwin/itwinui-react\";\nimport React, { useCallback, useMemo, useState } from \"react\";\nimport type { Column } from \"react-table\";\nimport type { CreateTypeFromInterface } from \"../../common/utils\";\nimport DeleteModal from \"../SharedComponents/DeleteModal\";\nimport { PropertyTableToolbar } from \"./PropertyTableToolbar\";\nimport \"./PropertyTable.scss\";\n\nexport interface PropertyTableItem {\n propertyName: string;\n id: string;\n}\n\nexport interface PropertyTableProps<T extends PropertyTableItem> {\n propertyType: string;\n columnsFactory: (handleShowDeleteModal: (value: T) => void) => Array<Column<T>>;\n data: T[];\n isLoading: boolean;\n onClickAdd?: () => void;\n refreshProperties: () => Promise<void>;\n deleteProperty: (propertyId: string) => Promise<void>;\n hideRefreshIcon?: boolean;\n onGroupPropertyDelete?: () => void;\n}\n\nexport const PropertyTable = <T extends PropertyTableItem>({\n propertyType,\n columnsFactory,\n data,\n isLoading,\n onClickAdd,\n refreshProperties,\n deleteProperty,\n hideRefreshIcon,\n onGroupPropertyDelete,\n}: PropertyTableProps<T>) => {\n const [showDeleteModal, setShowDeleteModal] = useState<T | undefined>(undefined);\n\n const handleDeleteProperty = useCallback(async () => {\n await deleteProperty(showDeleteModal?.id ?? \"\");\n onGroupPropertyDelete?.();\n }, [deleteProperty, showDeleteModal?.id, onGroupPropertyDelete]);\n\n const handleShowDeleteModal = useCallback((property: T) => {\n setShowDeleteModal(property);\n }, []);\n\n const handleCloseDeleteModal = () => {\n setShowDeleteModal(undefined);\n };\n\n const memoizedColumns = useMemo(() => columnsFactory(handleShowDeleteModal), [columnsFactory, handleShowDeleteModal]);\n\n return (\n <div className=\"gmw-property-table-container\">\n <PropertyTableToolbar\n propertyType={propertyType}\n onClickAddProperty={onClickAdd}\n refreshProperties={refreshProperties}\n isLoading={isLoading}\n hideRefreshIcon={hideRefreshIcon}\n />\n <Table<CreateTypeFromInterface<T>>\n data={isLoading ? [] : data}\n density=\"extra-condensed\"\n columns={memoizedColumns}\n emptyTableContent={`No ${propertyType} Properties`}\n isSortable\n isLoading={isLoading}\n />\n {showDeleteModal && <DeleteModal entityName={showDeleteModal.propertyName} onClose={handleCloseDeleteModal} onDelete={handleDeleteProperty} />}\n </div>\n );\n};\n"]}
|
|
@@ -25,6 +25,8 @@ export interface GroupHilitedElements {
|
|
|
25
25
|
setOverlappedElementsMetadata: (overlappedElementsMetaData: OverlappedElementsMetadata) => void;
|
|
26
26
|
setIsOverlappedColored: (isOverlappedColored: boolean | ((isOverlappedColored: boolean) => boolean)) => void;
|
|
27
27
|
setIsVisualizationsEnabled: (isVisualizationsEnabled: boolean | ((isVisualizationsEnabled: boolean) => boolean)) => void;
|
|
28
|
+
groupColors: Map<string, string>;
|
|
29
|
+
setGroupColors: (colors: Map<string, string>) => void;
|
|
28
30
|
}
|
|
29
31
|
export declare const GroupHilitedElementsContext: React.Context<GroupHilitedElements>;
|
|
30
32
|
export declare const useGroupHilitedElementsContext: () => GroupHilitedElements;
|
|
@@ -46,6 +46,8 @@ exports.GroupHilitedElementsContext = React.createContext({
|
|
|
46
46
|
setOverlappedElementsMetadata: () => { },
|
|
47
47
|
setIsOverlappedColored: () => { },
|
|
48
48
|
setIsVisualizationsEnabled: () => { },
|
|
49
|
+
setGroupColors: () => { },
|
|
50
|
+
groupColors: new Map(),
|
|
49
51
|
});
|
|
50
52
|
const useGroupHilitedElementsContext = () => {
|
|
51
53
|
const context = React.useContext(exports.GroupHilitedElementsContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupHilitedElementsContext.js","sourceRoot":"","sources":["../../../../src/components/context/GroupHilitedElementsContext.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,6CAA+B;
|
|
1
|
+
{"version":3,"file":"GroupHilitedElementsContext.js","sourceRoot":"","sources":["../../../../src/components/context/GroupHilitedElementsContext.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;gGAGgG;AAChG,6CAA+B;AAkClB,QAAA,2BAA2B,GAAG,KAAK,CAAC,aAAa,CAAuB;IACnF,eAAe,EAAE,IAAI,GAAG,EAAE;IAC1B,cAAc,EAAE,KAAK;IACrB,oBAAoB,EAAE,CAAC;IACvB,0BAA0B,EAAE;QAC1B,sBAAsB,EAAE,IAAI,GAAG,EAAE;QACjC,iBAAiB,EAAE,IAAI,GAAG,EAAE;QAC5B,2BAA2B,EAAE,EAAE;KAChC;IACD,uBAAuB,EAAE,KAAK;IAC9B,mBAAmB,EAAE,KAAK;IAC1B,kBAAkB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC5B,iBAAiB,EAAE,GAAG,EAAE,GAAE,CAAC;IAC3B,2BAA2B,EAAE,GAAG,EAAE,GAAE,CAAC;IACrC,6BAA6B,EAAE,GAAG,EAAE,GAAE,CAAC;IACvC,sBAAsB,EAAE,GAAG,EAAE,GAAE,CAAC;IAChC,0BAA0B,EAAE,GAAG,EAAE,GAAE,CAAC;IACpC,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;IACxB,WAAW,EAAE,IAAI,GAAG,EAAE;CACvB,CAAC,CAAC;AAEI,MAAM,8BAA8B,GAAG,GAAyB,EAAE;IACvE,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,mCAA2B,CAAC,CAAC;IAC9D,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,6FAA6F,CAAC,CAAC;KAChH;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AANW,QAAA,8BAA8B,kCAMzC","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\";\nexport interface OverlappedInfo {\n groupIds: string[];\n elements: string[];\n}\n\nexport interface OverlappedElementGroupPairs {\n elementIds: Set<string>;\n groupIds: Set<string>;\n}\n\nexport interface OverlappedElementsMetadata {\n overlappedElementsInfo: Map<string, OverlappedInfo[]>;\n groupElementsInfo: Map<string, number>;\n overlappedElementGroupPairs: OverlappedElementGroupPairs[];\n}\n\nexport interface GroupHilitedElements {\n hiddenGroupsIds: Set<string>;\n showGroupColor: boolean;\n currentHilitedGroups: number;\n overlappedElementsMetadata: OverlappedElementsMetadata;\n isVisualizationsEnabled: boolean;\n isOverlappedColored: boolean;\n setHiddenGroupsIds: (hiddenGroupIds: Set<string>) => void;\n setShowGroupColor: (showGroupColor: boolean | ((showGroupColor: boolean) => boolean)) => void;\n setNumberOfVisualizedGroups: (numberOfVisualizedGroups: number | ((numberOfVisualizedGroups: number) => number)) => void;\n setOverlappedElementsMetadata: (overlappedElementsMetaData: OverlappedElementsMetadata) => void;\n setIsOverlappedColored: (isOverlappedColored: boolean | ((isOverlappedColored: boolean) => boolean)) => void;\n setIsVisualizationsEnabled: (isVisualizationsEnabled: boolean | ((isVisualizationsEnabled: boolean) => boolean)) => void;\n groupColors: Map<string, string>;\n setGroupColors: (colors: Map<string, string>) => void;\n}\n\nexport const GroupHilitedElementsContext = React.createContext<GroupHilitedElements>({\n hiddenGroupsIds: new Set(),\n showGroupColor: false,\n currentHilitedGroups: 0,\n overlappedElementsMetadata: {\n overlappedElementsInfo: new Map(),\n groupElementsInfo: new Map(),\n overlappedElementGroupPairs: [],\n },\n isVisualizationsEnabled: false,\n isOverlappedColored: false,\n setHiddenGroupsIds: () => {},\n setShowGroupColor: () => {},\n setNumberOfVisualizedGroups: () => {},\n setOverlappedElementsMetadata: () => {},\n setIsOverlappedColored: () => {},\n setIsVisualizationsEnabled: () => {},\n setGroupColors: () => {},\n groupColors: new Map(),\n});\n\nexport const useGroupHilitedElementsContext = (): GroupHilitedElements => {\n const context = React.useContext(GroupHilitedElementsContext);\n if (!context) {\n throw new Error(\"useGroupHilitedElementsContext should be used within a GroupHilitedElementsContext provider\");\n }\n return context;\n};\n"]}
|
|
@@ -11,9 +11,11 @@ import { Mappings } from "../../components/Mappings/Mappings";
|
|
|
11
11
|
import { MappingAction } from "../../components/Mappings/Editing/MappingAction";
|
|
12
12
|
import { PropertyMenuWithVisualization } from "../../components/Properties/PropertyMenuWithVisualization";
|
|
13
13
|
import { GroupsVisualization } from "../../components/Groups/GroupsVisualization";
|
|
14
|
+
import { useGroupHilitedElementsContext } from "../../components/context/GroupHilitedElementsContext";
|
|
14
15
|
export const GroupingMappingRouter = ({ currentRoute, navigateTo, goBack, hideRefreshIcon, }) => {
|
|
15
16
|
const { iModelId } = useGroupingMappingApiConfig();
|
|
16
17
|
const { mapping, group, property, groupContextCustomUI, queryGenerationType } = currentRoute.groupingRouteFields;
|
|
18
|
+
const { showGroupColor, groupColors } = useGroupHilitedElementsContext();
|
|
17
19
|
switch (currentRoute.step) {
|
|
18
20
|
case RouteStep.Mappings:
|
|
19
21
|
return (React.createElement(Mappings, { onClickAddMapping: () => navigateTo(() => ({ step: RouteStep.MappingsAction, title: "Add Mapping", groupingRouteFields: {} })), onClickMappingTitle: (mapping) => {
|
|
@@ -70,7 +72,7 @@ export const GroupingMappingRouter = ({ currentRoute, navigateTo, goBack, hideRe
|
|
|
70
72
|
return null;
|
|
71
73
|
case RouteStep.Properties:
|
|
72
74
|
if (mapping && group) {
|
|
73
|
-
return (React.createElement(PropertyMenuWithVisualization, { mapping: mapping, group: group, color: "red", onClickAddGroupProperty: () => navigateTo((prev) => ({ step: RouteStep.PropertyAction, title: "Add Property", groupingRouteFields: { ...prev?.groupingRouteFields } })), onClickModifyGroupProperty: (gp) => navigateTo((prev) => ({
|
|
75
|
+
return (React.createElement(PropertyMenuWithVisualization, { mapping: mapping, group: group, color: showGroupColor ? groupColors.get(group.id) ?? "red" : "red", onClickAddGroupProperty: () => navigateTo((prev) => ({ step: RouteStep.PropertyAction, title: "Add Property", groupingRouteFields: { ...prev?.groupingRouteFields } })), onClickModifyGroupProperty: (gp) => navigateTo((prev) => ({
|
|
74
76
|
step: RouteStep.PropertyAction,
|
|
75
77
|
title: gp.propertyName,
|
|
76
78
|
groupingRouteFields: { ...prev?.groupingRouteFields, property: gp },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingMappingRouter.js","sourceRoot":"","sources":["../../../../src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C,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;wBACpB,IAAI,EAAE,SAAS,CAAC,+BAA+B;wBAC/C,KAAK,EAAE,2BAA2B;wBAClC,mBAAmB,EAAE,EAAE,GAAG,IAAI,EAAE,mBAAmB,EAAE;qBACtD,CAAC,CAAC,EAEL,8BAA8B,EAAE,CAAC,EAAE,EAAE,EAAE,CACrC,UAAU,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;wBACpB,IAAI,EAAE,SAAS,CAAC,+BAA+B;wBAC/C,KAAK,EAAE,EAAE,CAAC,YAAY;wBACtB,mBAAmB,EAAE,EAAE,GAAG,IAAI,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,EAAE,EAAE;qBAC7E,CAAC,CAAC,EAEL,eAAe,EAAE,eAAe,GAChC,CACH,CAAC;aACH;YACD,OAAO,IAAI,CAAC;QACd,KAAK,SAAS,CAAC,cAAc,CAAC,CAAC;YAC7B,IAAI,OAAO,IAAI,KAAK,EAAE;gBACpB,OAAO,oBAAC,mBAAmB,IAAC,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAI,CAAC;aAC5I;YACD,OAAO,IAAI,CAAC;SACb;QACD;YACE,OAAO,IAAI,CAAC;KACf;AACH,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport { useGroupingMappingApiConfig } from \"../../components/context/GroupingApiConfigContext\";\nimport { GroupAction } from \"../../components/Groups/Editing/GroupAction\";\nimport type { Route } from \"../GroupingMapping\";\nimport { RouteStep } from \"../GroupingMapping\";\nimport { GroupPropertyAction } from \"../../components/Properties/GroupProperties/GroupPropertyAction\";\nimport { Mappings } from \"../../components/Mappings/Mappings\";\nimport { MappingAction } from \"../../components/Mappings/Editing/MappingAction\";\nimport { PropertyMenuWithVisualization } from \"../../components/Properties/PropertyMenuWithVisualization\";\nimport { GroupsVisualization } from \"../../components/Groups/GroupsVisualization\";\n\nexport const GroupingMappingRouter = ({\n currentRoute,\n navigateTo,\n goBack,\n hideRefreshIcon,\n}: {\n currentRoute: Route;\n navigateTo: (toRoute: (prev: Route | undefined) => Route) => void;\n goBack: () => void;\n hideRefreshIcon?: boolean;\n}) => {\n const { iModelId } = useGroupingMappingApiConfig();\n const { mapping, group, property, groupContextCustomUI, queryGenerationType } = currentRoute.groupingRouteFields;\n\n switch (currentRoute.step) {\n case RouteStep.Mappings:\n return (\n <Mappings\n onClickAddMapping={() => navigateTo(() => ({ step: RouteStep.MappingsAction, title: \"Add Mapping\", groupingRouteFields: {} }))}\n onClickMappingTitle={(mapping) => {\n navigateTo(() => ({\n step: RouteStep.Groups,\n groupingRouteFields: { mapping },\n title: mapping.mappingName,\n }));\n }}\n onClickMappingModify={(mapping) => {\n navigateTo(() => ({\n step: RouteStep.MappingsAction,\n groupingRouteFields: { mapping },\n title: mapping.mappingName,\n }));\n }}\n hideRefreshIcon={hideRefreshIcon}\n />\n );\n case RouteStep.MappingsAction:\n return <MappingAction mapping={mapping} onClickCancel={goBack} onSaveSuccess={goBack} />;\n case RouteStep.Groups:\n if (mapping) {\n return (\n <GroupsVisualization\n mapping={mapping}\n onClickAddGroup={(qType) =>\n navigateTo((prev) => ({\n step: RouteStep.GroupAction,\n groupingRouteFields: { ...prev?.groupingRouteFields, queryGenerationType: qType },\n title: \"Add Group\",\n }))\n }\n onClickGroupTitle={(g) =>\n navigateTo((prev) => ({\n step: RouteStep.Properties,\n title: g.groupName,\n groupingRouteFields: { ...prev?.groupingRouteFields, group: g },\n }))\n }\n onClickGroupModify={(g, qType) =>\n navigateTo((prev) => ({\n step: RouteStep.GroupAction,\n title: g.groupName,\n groupingRouteFields: { ...prev?.groupingRouteFields, group: g, queryGenerationType: qType },\n }))\n }\n onClickRenderContextCustomUI={(ccUI, g, displayLabel) =>\n navigateTo((prev) => ({\n step: RouteStep.GroupContextCustomUI,\n title: displayLabel,\n groupingRouteFields: { ...prev?.groupingRouteFields, group: g, groupContextCustomUI: ccUI },\n }))\n }\n hideRefreshIcon={hideRefreshIcon}\n />\n );\n }\n return null;\n case RouteStep.GroupAction:\n if (mapping) {\n if (queryGenerationType) {\n return (\n <GroupAction\n shouldVisualize\n mappingId={mapping.id}\n group={group}\n onClickCancel={goBack}\n onSaveSuccess={goBack}\n queryGenerationType={queryGenerationType}\n />\n );\n }\n }\n return null;\n case RouteStep.GroupContextCustomUI:\n if (mapping && group && groupContextCustomUI) {\n return React.createElement(groupContextCustomUI, {\n iModelId,\n mappingId: mapping.id,\n groupId: group.id,\n });\n }\n return null;\n case RouteStep.Properties:\n if (mapping && group) {\n return (\n <PropertyMenuWithVisualization\n mapping={mapping}\n group={group}\n color=\"red\"\n onClickAddGroupProperty={() =>\n navigateTo((prev) => ({ step: RouteStep.PropertyAction, title: \"Add Property\", groupingRouteFields: { ...prev?.groupingRouteFields } }))\n }\n onClickModifyGroupProperty={(gp) =>\n navigateTo((prev) => ({\n step: RouteStep.PropertyAction,\n title: gp.propertyName,\n groupingRouteFields: { ...prev?.groupingRouteFields, property: gp },\n }))\n }\n onClickAddCalculatedProperty={() =>\n navigateTo((prev) => ({\n step: RouteStep.CalculatedPropertyAction,\n title: \"Create Calculated Property\",\n groupingRouteFields: { ...prev?.groupingRouteFields },\n }))\n }\n onClickModifyCalculatedProperty={(cp) =>\n navigateTo((prev) => ({\n step: RouteStep.CalculatedPropertyAction,\n title: cp.propertyName,\n groupingRouteFields: { ...prev?.groupingRouteFields, calculatedProperty: cp },\n }))\n }\n onClickAddCustomCalculationProperty={() =>\n navigateTo((prev) => ({\n step: RouteStep.CustomCalculationPropertyAction,\n title: \"Create Custom Calculation\",\n groupingRouteFields: { ...prev?.groupingRouteFields },\n }))\n }\n onClickModifyCustomCalculation={(cc) =>\n navigateTo((prev) => ({\n step: RouteStep.CustomCalculationPropertyAction,\n title: cc.propertyName,\n groupingRouteFields: { ...prev?.groupingRouteFields, customCalculation: cc },\n }))\n }\n hideRefreshIcon={hideRefreshIcon}\n />\n );\n }\n return null;\n case RouteStep.PropertyAction: {\n if (mapping && group) {\n return <GroupPropertyAction mappingId={mapping.id} group={group} groupProperty={property} onSaveSuccess={goBack} onClickCancel={goBack} />;\n }\n return null;\n }\n default:\n return null;\n }\n};\n"]}
|
|
1
|
+
{"version":3,"file":"GroupingMappingRouter.js","sourceRoot":"","sources":["../../../../src/WidgetShell/Router/GroupingMappingRouter.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,2BAA2B,EAAE,MAAM,mDAAmD,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;AAE1E,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iEAAiE,CAAC;AACtG,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,iDAAiD,CAAC;AAChF,OAAO,EAAE,6BAA6B,EAAE,MAAM,2DAA2D,CAAC;AAC1G,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAClF,OAAO,EAAE,8BAA8B,EAAE,MAAM,sDAAsD,CAAC;AAEtG,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EACpC,YAAY,EACZ,UAAU,EACV,MAAM,EACN,eAAe,GAMhB,EAAE,EAAE;IACH,MAAM,EAAE,QAAQ,EAAE,GAAG,2BAA2B,EAAE,CAAC;IACnD,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,GAAG,YAAY,CAAC,mBAAmB,C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AAO,oBAAC,mBAAmB,IAAC,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAI,CAAC;aAC5I;YACD,OAAO,IAAI,CAAC;SACb;QACD;YACE,OAAO,IAAI,CAAC;KACf;AACH,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport { useGroupingMappingApiConfig } from \"../../components/context/GroupingApiConfigContext\";\nimport { GroupAction } from \"../../components/Groups/Editing/GroupAction\";\nimport type { Route } from \"../GroupingMapping\";\nimport { RouteStep } from \"../GroupingMapping\";\nimport { GroupPropertyAction } from \"../../components/Properties/GroupProperties/GroupPropertyAction\";\nimport { Mappings } from \"../../components/Mappings/Mappings\";\nimport { MappingAction } from \"../../components/Mappings/Editing/MappingAction\";\nimport { PropertyMenuWithVisualization } from \"../../components/Properties/PropertyMenuWithVisualization\";\nimport { GroupsVisualization } from \"../../components/Groups/GroupsVisualization\";\nimport { useGroupHilitedElementsContext } from \"../../components/context/GroupHilitedElementsContext\";\n\nexport const GroupingMappingRouter = ({\n currentRoute,\n navigateTo,\n goBack,\n hideRefreshIcon,\n}: {\n currentRoute: Route;\n navigateTo: (toRoute: (prev: Route | undefined) => Route) => void;\n goBack: () => void;\n hideRefreshIcon?: boolean;\n}) => {\n const { iModelId } = useGroupingMappingApiConfig();\n const { mapping, group, property, groupContextCustomUI, queryGenerationType } = currentRoute.groupingRouteFields;\n const { showGroupColor, groupColors } = useGroupHilitedElementsContext();\n\n switch (currentRoute.step) {\n case RouteStep.Mappings:\n return (\n <Mappings\n onClickAddMapping={() => navigateTo(() => ({ step: RouteStep.MappingsAction, title: \"Add Mapping\", groupingRouteFields: {} }))}\n onClickMappingTitle={(mapping) => {\n navigateTo(() => ({\n step: RouteStep.Groups,\n groupingRouteFields: { mapping },\n title: mapping.mappingName,\n }));\n }}\n onClickMappingModify={(mapping) => {\n navigateTo(() => ({\n step: RouteStep.MappingsAction,\n groupingRouteFields: { mapping },\n title: mapping.mappingName,\n }));\n }}\n hideRefreshIcon={hideRefreshIcon}\n />\n );\n case RouteStep.MappingsAction:\n return <MappingAction mapping={mapping} onClickCancel={goBack} onSaveSuccess={goBack} />;\n case RouteStep.Groups:\n if (mapping) {\n return (\n <GroupsVisualization\n mapping={mapping}\n onClickAddGroup={(qType) =>\n navigateTo((prev) => ({\n step: RouteStep.GroupAction,\n groupingRouteFields: { ...prev?.groupingRouteFields, queryGenerationType: qType },\n title: \"Add Group\",\n }))\n }\n onClickGroupTitle={(g) =>\n navigateTo((prev) => ({\n step: RouteStep.Properties,\n title: g.groupName,\n groupingRouteFields: { ...prev?.groupingRouteFields, group: g },\n }))\n }\n onClickGroupModify={(g, qType) =>\n navigateTo((prev) => ({\n step: RouteStep.GroupAction,\n title: g.groupName,\n groupingRouteFields: { ...prev?.groupingRouteFields, group: g, queryGenerationType: qType },\n }))\n }\n onClickRenderContextCustomUI={(ccUI, g, displayLabel) =>\n navigateTo((prev) => ({\n step: RouteStep.GroupContextCustomUI,\n title: displayLabel,\n groupingRouteFields: { ...prev?.groupingRouteFields, group: g, groupContextCustomUI: ccUI },\n }))\n }\n hideRefreshIcon={hideRefreshIcon}\n />\n );\n }\n return null;\n case RouteStep.GroupAction:\n if (mapping) {\n if (queryGenerationType) {\n return (\n <GroupAction\n shouldVisualize\n mappingId={mapping.id}\n group={group}\n onClickCancel={goBack}\n onSaveSuccess={goBack}\n queryGenerationType={queryGenerationType}\n />\n );\n }\n }\n return null;\n case RouteStep.GroupContextCustomUI:\n if (mapping && group && groupContextCustomUI) {\n return React.createElement(groupContextCustomUI, {\n iModelId,\n mappingId: mapping.id,\n groupId: group.id,\n });\n }\n return null;\n case RouteStep.Properties:\n if (mapping && group) {\n return (\n <PropertyMenuWithVisualization\n mapping={mapping}\n group={group}\n color={showGroupColor ? groupColors.get(group.id) ?? \"red\" : \"red\"}\n onClickAddGroupProperty={() =>\n navigateTo((prev) => ({ step: RouteStep.PropertyAction, title: \"Add Property\", groupingRouteFields: { ...prev?.groupingRouteFields } }))\n }\n onClickModifyGroupProperty={(gp) =>\n navigateTo((prev) => ({\n step: RouteStep.PropertyAction,\n title: gp.propertyName,\n groupingRouteFields: { ...prev?.groupingRouteFields, property: gp },\n }))\n }\n onClickAddCalculatedProperty={() =>\n navigateTo((prev) => ({\n step: RouteStep.CalculatedPropertyAction,\n title: \"Create Calculated Property\",\n groupingRouteFields: { ...prev?.groupingRouteFields },\n }))\n }\n onClickModifyCalculatedProperty={(cp) =>\n navigateTo((prev) => ({\n step: RouteStep.CalculatedPropertyAction,\n title: cp.propertyName,\n groupingRouteFields: { ...prev?.groupingRouteFields, calculatedProperty: cp },\n }))\n }\n onClickAddCustomCalculationProperty={() =>\n navigateTo((prev) => ({\n step: RouteStep.CustomCalculationPropertyAction,\n title: \"Create Custom Calculation\",\n groupingRouteFields: { ...prev?.groupingRouteFields },\n }))\n }\n onClickModifyCustomCalculation={(cc) =>\n navigateTo((prev) => ({\n step: RouteStep.CustomCalculationPropertyAction,\n title: cc.propertyName,\n groupingRouteFields: { ...prev?.groupingRouteFields, customCalculation: cc },\n }))\n }\n hideRefreshIcon={hideRefreshIcon}\n />\n );\n }\n return null;\n case RouteStep.PropertyAction: {\n if (mapping && group) {\n return <GroupPropertyAction mappingId={mapping.id} group={group} groupProperty={property} onSaveSuccess={goBack} onClickCancel={goBack} />;\n }\n return null;\n }\n default:\n return null;\n }\n};\n"]}
|
|
@@ -74,6 +74,7 @@ export const GroupingMappingContext = (props) => {
|
|
|
74
74
|
const [hiddenGroupsIds, setHiddenGroupsIds] = useState(new Set());
|
|
75
75
|
const [showGroupColor, setShowGroupColor] = useState(false);
|
|
76
76
|
const [propertiesShowGroup, setPropertiesShowGroup] = useState(false);
|
|
77
|
+
const [groupColors, setGroupColors] = useState(new Map());
|
|
77
78
|
const [groups, setGroups] = useState([]);
|
|
78
79
|
const [numberOfVisualizedGroups, setNumberOfVisualizedGroups] = useState(0);
|
|
79
80
|
const [isOverlappedColored, setIsOverlappedColored] = useState(false);
|
|
@@ -127,6 +128,8 @@ export const GroupingMappingContext = (props) => {
|
|
|
127
128
|
setIsVisualizationsEnabled,
|
|
128
129
|
overlappedElementsMetadata,
|
|
129
130
|
setOverlappedElementsMetadata,
|
|
131
|
+
groupColors,
|
|
132
|
+
setGroupColors,
|
|
130
133
|
}), [
|
|
131
134
|
showGroupColor,
|
|
132
135
|
hiddenGroupsIds,
|
|
@@ -136,6 +139,8 @@ export const GroupingMappingContext = (props) => {
|
|
|
136
139
|
currentHilitedGroups,
|
|
137
140
|
isVisualizationsEnabled,
|
|
138
141
|
overlappedElementsMetadata,
|
|
142
|
+
groupColors,
|
|
143
|
+
setGroupColors,
|
|
139
144
|
]);
|
|
140
145
|
const propertiesContextValue = useMemo(() => ({
|
|
141
146
|
showGroupColor: propertiesShowGroup,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingMappingContext.js","sourceRoot":"","sources":["../../../src/components/GroupingMappingContext.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAE3F,OAAO,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,MAAM,0CAA0C,CAAC;AAGzH,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAE,2BAA2B,EAAE,MAAM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AmB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY;oBAC/C,oBAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,gBAAgB;wBACvD,oBAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,gBAAgB;4BACvD,oBAAC,0BAA0B,CAAC,QAAQ,IAAC,KAAK,EAAE,8BAA8B;gCACxE,oBAAC,8BAA8B,CAAC,QAAQ,IAAC,KAAK,EAAE,oBAAoB;oCAClE,oBAAC,2BAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,2BAA2B;wCACtE,oBAAC,2BAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,sBAAsB,IAAG,KAAK,CAAC,QAAQ,CAAwC,CACvF,CACC,CACN,CACL,CACF,CACN,CACD,CACS,CACvB,CACvB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type { ClientPrefix, GetAccessTokenFn, GroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport { GroupingMappingApiConfigContext } from \"./context/GroupingApiConfigContext\";\nimport { createMappingClient, MappingClientContext } from \"./context/MappingClientContext\";\nimport type { Group, IExtractionClient, IGroupsClient, IMappingsClient, IPropertiesClient } from \"@itwin/insights-client\";\nimport { createGroupingMappingCustomUI, GroupingMappingCustomUIContext } from \"./context/GroupingMappingCustomUIContext\";\nimport type { GroupingMappingCustomUI } from \"./customUI/GroupingMappingCustomUI\";\nimport type { OverlappedElementsMetadata } from \"./context/GroupHilitedElementsContext\";\nimport { GroupHilitedElementsContext } from \"./context/GroupHilitedElementsContext\";\nimport { PropertiesGroupColorContext } from \"./context/PropertiesGroupColorContext\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { createExtractionClient, ExtractionClientContext } from \"./context/ExtractionClientContext\";\nimport type { Query } from \"@tanstack/react-query\";\nimport { MutationCache, QueryCache, QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\nimport { toaster } from \"@itwin/itwinui-react\";\nimport { getErrorMessage } from \"../common/utils\";\nimport { TErrCodes } from \"./Constants\";\nimport { ExtractionStatusJobContext } from \"./context/ExtractionStateJobContext\";\nimport { createGroupsClient, GroupsClientContext } from \"./context/GroupsClientContext\";\nimport { createPropertiesClient, PropertiesClientContext } from \"./context/PropertiesClientContext\";\n\n/**\n * Props for the {@link GroupingMappingContext} component.\n * @public\n */\nexport interface GroupingMappingContextProps {\n /**\n * Custom callback to retrieve access token.\n */\n getAccessToken?: GetAccessTokenFn;\n /**\n * The iTwin iModel Id.\n */\n iModelId: string;\n /**\n * Used for iTwin and iModel APIs.\n * Also used for Mapping API if a custom IMappingsClient is not provided.\n */\n changeSetId?: string;\n prefix?: ClientPrefix;\n /**\n * A custom implementation of MappingClient.\n */\n mappingsClient?: IMappingsClient;\n /**\n * A custom implementation of GroupsClient.\n */\n groupsClient?: IGroupsClient;\n /**\n * A custom implementation of PropertiesClient.\n */\n propertiesClient?: IPropertiesClient;\n /**\n * A custom implementation of ExtractionClient.\n */\n extractionClient?: IExtractionClient;\n /**\n * Custom UI to add and update groups or provide additional group context capabilities.\n */\n customUIs?: GroupingMappingCustomUI[];\n /**\n * A custom iModelConnection to use instead of the active iModelConnection from UiFramework.\n */\n iModelConnection?: IModelConnection;\n /**\n * A custom QueryClient. If not provided, a default QueryClient will be used.\n */\n queryClient?: QueryClient;\n children?: React.ReactNode;\n}\n\nconst authorizationClientGetAccessToken = async () => (await IModelApp.authorizationClient?.getAccessToken()) ?? \"\";\n\nconst defaultQueryClient = new QueryClient({\n defaultOptions: {\n queries: {\n refetchOnWindowFocus: false,\n staleTime: 20 * 60 * 1000, // 20 minutes\n },\n },\n queryCache: new QueryCache({\n onError: (error: any, query: Query) => {\n switch (query.meta?.errorCode) {\n case TErrCodes.QUERY_HILITE_FETCH_FAILED:\n toaster.negative(query.meta?.message as string);\n break;\n default: {\n if (error.status) toaster.negative(getErrorMessage(error.status));\n else toaster.negative(\"An error occurred while fetching data.\");\n }\n }\n },\n }),\n mutationCache: new MutationCache({\n onError: (error: any) => {\n if (error.status) toaster.negative(getErrorMessage(error.status));\n else toaster.negative(\"A network error occured while processing this action.\");\n },\n }),\n});\n\n/**\n * Grouping and Mapping Context providers required for all components.\n * @public\n */\nexport const GroupingMappingContext = (props: GroupingMappingContextProps) => {\n const activeIModelConnection = useActiveIModelConnection();\n const mappingsClientProp: IMappingsClient | ClientPrefix = props.mappingsClient ?? props.prefix;\n const groupsClientProp: IGroupsClient | ClientPrefix = props.groupsClient ?? props.prefix;\n const propertiesClientProp: IPropertiesClient | ClientPrefix = props.propertiesClient ?? props.prefix;\n const extractionClientProp: IExtractionClient | ClientPrefix = props.extractionClient ?? props.prefix;\n const [mappingClient, setMappingClient] = useState<IMappingsClient>(createMappingClient(mappingsClientProp));\n const [groupsClient, setGroupsClient] = useState<IGroupsClient>(createGroupsClient(groupsClientProp));\n const [propertiesClient, setPropertiesClient] = useState<IPropertiesClient>(createPropertiesClient(propertiesClientProp));\n const [extractionClient, setExtractionClient] = useState<IExtractionClient>(createExtractionClient(extractionClientProp));\n const [customUIs, setCustomUIs] = useState<GroupingMappingCustomUI[]>(createGroupingMappingCustomUI(props.customUIs));\n const [apiConfig, setApiConfig] = useState<GroupingMappingApiConfig>({\n getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,\n iModelId: props.iModelId,\n prefix: props.prefix,\n changeSetId: props.changeSetId,\n });\n const [hiddenGroupsIds, setHiddenGroupsIds] = useState<Set<string>>(new Set());\n const [showGroupColor, setShowGroupColor] = useState<boolean>(false);\n const [propertiesShowGroup, setPropertiesShowGroup] = useState<boolean>(false);\n const [groups, setGroups] = useState<Group[]>([]);\n const [numberOfVisualizedGroups, setNumberOfVisualizedGroups] = useState(0);\n const [isOverlappedColored, setIsOverlappedColored] = useState<boolean>(false);\n const [currentHilitedGroups, setCurrentHilitedGroups] = useState<number>(1);\n const [isVisualizationsEnabled, setIsVisualizationsEnabled] = useState<boolean>(false);\n const [overlappedElementsMetadata, setOverlappedElementsMetadata] = useState<OverlappedElementsMetadata>({\n overlappedElementsInfo: new Map(),\n groupElementsInfo: new Map(),\n overlappedElementGroupPairs: [],\n });\n const queryClient = props.queryClient ?? defaultQueryClient;\n const [mappingIdJobInfo, setMappingIdJobInfo] = useState<Map<string, string>>(new Map());\n\n useEffect(() => {\n setApiConfig(() => ({\n prefix: props.prefix,\n iModelId: props.iModelId,\n getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,\n iModelConnection: props.iModelConnection ?? activeIModelConnection,\n changeSetId: props.changeSetId,\n }));\n }, [activeIModelConnection, props.changeSetId, props.getAccessToken, props.iModelConnection, props.iModelId, props.prefix]);\n\n useEffect(() => {\n setMappingClient(createMappingClient(mappingsClientProp));\n }, [mappingsClientProp]);\n\n useEffect(() => {\n setGroupsClient(createGroupsClient(groupsClientProp));\n }, [groupsClientProp]);\n\n useEffect(() => {\n setPropertiesClient(createPropertiesClient(propertiesClientProp));\n }, [propertiesClientProp]);\n\n useEffect(() => {\n setExtractionClient(createExtractionClient(extractionClientProp));\n }, [extractionClientProp]);\n\n useEffect(() => {\n setCustomUIs(createGroupingMappingCustomUI(props.customUIs));\n }, [props.customUIs]);\n\n const hilitedElementsContextValue = useMemo(\n () => ({\n showGroupColor,\n setShowGroupColor,\n hiddenGroupsIds,\n setHiddenGroupsIds,\n groups,\n setGroups,\n numberOfVisualizedGroups,\n setNumberOfVisualizedGroups,\n isOverlappedColored,\n setIsOverlappedColored,\n currentHilitedGroups,\n setCurrentHilitedGroups,\n isVisualizationsEnabled,\n setIsVisualizationsEnabled,\n overlappedElementsMetadata,\n setOverlappedElementsMetadata,\n }),\n [\n showGroupColor,\n hiddenGroupsIds,\n groups,\n numberOfVisualizedGroups,\n isOverlappedColored,\n currentHilitedGroups,\n isVisualizationsEnabled,\n overlappedElementsMetadata,\n ],\n );\n\n const propertiesContextValue = useMemo(\n () => ({\n showGroupColor: propertiesShowGroup,\n setShowGroupColor: setPropertiesShowGroup,\n }),\n [propertiesShowGroup],\n );\n\n const customUIContextValue = useMemo(\n () => ({\n customUIs,\n setCustomUIs,\n }),\n [customUIs],\n );\n\n const extractionStateJobContextValue = useMemo(\n () => ({\n mappingIdJobInfo,\n setMappingIdJobInfo,\n }),\n [mappingIdJobInfo],\n );\n\n return (\n <QueryClientProvider client={queryClient}>\n <GroupingMappingApiConfigContext.Provider value={apiConfig}>\n <MappingClientContext.Provider value={mappingClient}>\n <GroupsClientContext.Provider value={groupsClient}>\n <PropertiesClientContext.Provider value={propertiesClient}>\n <ExtractionClientContext.Provider value={extractionClient}>\n <ExtractionStatusJobContext.Provider value={extractionStateJobContextValue}>\n <GroupingMappingCustomUIContext.Provider value={customUIContextValue}>\n <GroupHilitedElementsContext.Provider value={hilitedElementsContextValue}>\n <PropertiesGroupColorContext.Provider value={propertiesContextValue}>{props.children}</PropertiesGroupColorContext.Provider>\n </GroupHilitedElementsContext.Provider>\n </GroupingMappingCustomUIContext.Provider>\n </ExtractionStatusJobContext.Provider>\n </ExtractionClientContext.Provider>\n </PropertiesClientContext.Provider>\n </GroupsClientContext.Provider>\n </MappingClientContext.Provider>\n </GroupingMappingApiConfigContext.Provider>\n </QueryClientProvider>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"GroupingMappingContext.js","sourceRoot":"","sources":["../../../src/components/GroupingMappingContext.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,+BAA+B,EAAE,MAAM,oCAAo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AAC,EACF,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,MAAM,8BAA8B,GAAG,OAAO,CAC5C,GAAG,EAAE,CAAC,CAAC;QACL,gBAAgB;QAChB,mBAAmB;KACpB,CAAC,EACF,CAAC,gBAAgB,CAAC,CACnB,CAAC;IAEF,OAAO,CACL,oBAAC,mBAAmB,IAAC,MAAM,EAAE,WAAW;QACtC,oBAAC,+BAA+B,CAAC,QAAQ,IAAC,KAAK,EAAE,SAAS;YACxD,oBAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa;gBACjD,oBAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY;oBAC/C,oBAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,gBAAgB;wBACvD,oBAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,gBAAgB;4BACvD,oBAAC,0BAA0B,CAAC,QAAQ,IAAC,KAAK,EAAE,8BAA8B;gCACxE,oBAAC,8BAA8B,CAAC,QAAQ,IAAC,KAAK,EAAE,oBAAoB;oCAClE,oBAAC,2BAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,2BAA2B;wCACtE,oBAAC,2BAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,sBAAsB,IAAG,KAAK,CAAC,QAAQ,CAAwC,CACvF,CACC,CACN,CACL,CACF,CACN,CACD,CACS,CACvB,CACvB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type { ClientPrefix, GetAccessTokenFn, GroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport { GroupingMappingApiConfigContext } from \"./context/GroupingApiConfigContext\";\nimport { createMappingClient, MappingClientContext } from \"./context/MappingClientContext\";\nimport type { Group, IExtractionClient, IGroupsClient, IMappingsClient, IPropertiesClient } from \"@itwin/insights-client\";\nimport { createGroupingMappingCustomUI, GroupingMappingCustomUIContext } from \"./context/GroupingMappingCustomUIContext\";\nimport type { GroupingMappingCustomUI } from \"./customUI/GroupingMappingCustomUI\";\nimport type { OverlappedElementsMetadata } from \"./context/GroupHilitedElementsContext\";\nimport { GroupHilitedElementsContext } from \"./context/GroupHilitedElementsContext\";\nimport { PropertiesGroupColorContext } from \"./context/PropertiesGroupColorContext\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { createExtractionClient, ExtractionClientContext } from \"./context/ExtractionClientContext\";\nimport type { Query } from \"@tanstack/react-query\";\nimport { MutationCache, QueryCache, QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\nimport { toaster } from \"@itwin/itwinui-react\";\nimport { getErrorMessage } from \"../common/utils\";\nimport { TErrCodes } from \"./Constants\";\nimport { ExtractionStatusJobContext } from \"./context/ExtractionStateJobContext\";\nimport { createGroupsClient, GroupsClientContext } from \"./context/GroupsClientContext\";\nimport { createPropertiesClient, PropertiesClientContext } from \"./context/PropertiesClientContext\";\n\n/**\n * Props for the {@link GroupingMappingContext} component.\n * @public\n */\nexport interface GroupingMappingContextProps {\n /**\n * Custom callback to retrieve access token.\n */\n getAccessToken?: GetAccessTokenFn;\n /**\n * The iTwin iModel Id.\n */\n iModelId: string;\n /**\n * Used for iTwin and iModel APIs.\n * Also used for Mapping API if a custom IMappingsClient is not provided.\n */\n changeSetId?: string;\n prefix?: ClientPrefix;\n /**\n * A custom implementation of MappingClient.\n */\n mappingsClient?: IMappingsClient;\n /**\n * A custom implementation of GroupsClient.\n */\n groupsClient?: IGroupsClient;\n /**\n * A custom implementation of PropertiesClient.\n */\n propertiesClient?: IPropertiesClient;\n /**\n * A custom implementation of ExtractionClient.\n */\n extractionClient?: IExtractionClient;\n /**\n * Custom UI to add and update groups or provide additional group context capabilities.\n */\n customUIs?: GroupingMappingCustomUI[];\n /**\n * A custom iModelConnection to use instead of the active iModelConnection from UiFramework.\n */\n iModelConnection?: IModelConnection;\n /**\n * A custom QueryClient. If not provided, a default QueryClient will be used.\n */\n queryClient?: QueryClient;\n children?: React.ReactNode;\n}\n\nconst authorizationClientGetAccessToken = async () => (await IModelApp.authorizationClient?.getAccessToken()) ?? \"\";\n\nconst defaultQueryClient = new QueryClient({\n defaultOptions: {\n queries: {\n refetchOnWindowFocus: false,\n staleTime: 20 * 60 * 1000, // 20 minutes\n },\n },\n queryCache: new QueryCache({\n onError: (error: any, query: Query) => {\n switch (query.meta?.errorCode) {\n case TErrCodes.QUERY_HILITE_FETCH_FAILED:\n toaster.negative(query.meta?.message as string);\n break;\n default: {\n if (error.status) toaster.negative(getErrorMessage(error.status));\n else toaster.negative(\"An error occurred while fetching data.\");\n }\n }\n },\n }),\n mutationCache: new MutationCache({\n onError: (error: any) => {\n if (error.status) toaster.negative(getErrorMessage(error.status));\n else toaster.negative(\"A network error occured while processing this action.\");\n },\n }),\n});\n\n/**\n * Grouping and Mapping Context providers required for all components.\n * @public\n */\nexport const GroupingMappingContext = (props: GroupingMappingContextProps) => {\n const activeIModelConnection = useActiveIModelConnection();\n const mappingsClientProp: IMappingsClient | ClientPrefix = props.mappingsClient ?? props.prefix;\n const groupsClientProp: IGroupsClient | ClientPrefix = props.groupsClient ?? props.prefix;\n const propertiesClientProp: IPropertiesClient | ClientPrefix = props.propertiesClient ?? props.prefix;\n const extractionClientProp: IExtractionClient | ClientPrefix = props.extractionClient ?? props.prefix;\n const [mappingClient, setMappingClient] = useState<IMappingsClient>(createMappingClient(mappingsClientProp));\n const [groupsClient, setGroupsClient] = useState<IGroupsClient>(createGroupsClient(groupsClientProp));\n const [propertiesClient, setPropertiesClient] = useState<IPropertiesClient>(createPropertiesClient(propertiesClientProp));\n const [extractionClient, setExtractionClient] = useState<IExtractionClient>(createExtractionClient(extractionClientProp));\n const [customUIs, setCustomUIs] = useState<GroupingMappingCustomUI[]>(createGroupingMappingCustomUI(props.customUIs));\n const [apiConfig, setApiConfig] = useState<GroupingMappingApiConfig>({\n getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,\n iModelId: props.iModelId,\n prefix: props.prefix,\n changeSetId: props.changeSetId,\n });\n const [hiddenGroupsIds, setHiddenGroupsIds] = useState<Set<string>>(new Set());\n const [showGroupColor, setShowGroupColor] = useState<boolean>(false);\n const [propertiesShowGroup, setPropertiesShowGroup] = useState<boolean>(false);\n const [groupColors, setGroupColors] = useState<Map<string, string>>(new Map());\n const [groups, setGroups] = useState<Group[]>([]);\n const [numberOfVisualizedGroups, setNumberOfVisualizedGroups] = useState(0);\n const [isOverlappedColored, setIsOverlappedColored] = useState<boolean>(false);\n const [currentHilitedGroups, setCurrentHilitedGroups] = useState<number>(1);\n const [isVisualizationsEnabled, setIsVisualizationsEnabled] = useState<boolean>(false);\n const [overlappedElementsMetadata, setOverlappedElementsMetadata] = useState<OverlappedElementsMetadata>({\n overlappedElementsInfo: new Map(),\n groupElementsInfo: new Map(),\n overlappedElementGroupPairs: [],\n });\n const queryClient = props.queryClient ?? defaultQueryClient;\n const [mappingIdJobInfo, setMappingIdJobInfo] = useState<Map<string, string>>(new Map());\n\n useEffect(() => {\n setApiConfig(() => ({\n prefix: props.prefix,\n iModelId: props.iModelId,\n getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,\n iModelConnection: props.iModelConnection ?? activeIModelConnection,\n changeSetId: props.changeSetId,\n }));\n }, [activeIModelConnection, props.changeSetId, props.getAccessToken, props.iModelConnection, props.iModelId, props.prefix]);\n\n useEffect(() => {\n setMappingClient(createMappingClient(mappingsClientProp));\n }, [mappingsClientProp]);\n\n useEffect(() => {\n setGroupsClient(createGroupsClient(groupsClientProp));\n }, [groupsClientProp]);\n\n useEffect(() => {\n setPropertiesClient(createPropertiesClient(propertiesClientProp));\n }, [propertiesClientProp]);\n\n useEffect(() => {\n setExtractionClient(createExtractionClient(extractionClientProp));\n }, [extractionClientProp]);\n\n useEffect(() => {\n setCustomUIs(createGroupingMappingCustomUI(props.customUIs));\n }, [props.customUIs]);\n\n const hilitedElementsContextValue = useMemo(\n () => ({\n showGroupColor,\n setShowGroupColor,\n hiddenGroupsIds,\n setHiddenGroupsIds,\n groups,\n setGroups,\n numberOfVisualizedGroups,\n setNumberOfVisualizedGroups,\n isOverlappedColored,\n setIsOverlappedColored,\n currentHilitedGroups,\n setCurrentHilitedGroups,\n isVisualizationsEnabled,\n setIsVisualizationsEnabled,\n overlappedElementsMetadata,\n setOverlappedElementsMetadata,\n groupColors,\n setGroupColors,\n }),\n [\n showGroupColor,\n hiddenGroupsIds,\n groups,\n numberOfVisualizedGroups,\n isOverlappedColored,\n currentHilitedGroups,\n isVisualizationsEnabled,\n overlappedElementsMetadata,\n groupColors,\n setGroupColors,\n ],\n );\n\n const propertiesContextValue = useMemo(\n () => ({\n showGroupColor: propertiesShowGroup,\n setShowGroupColor: setPropertiesShowGroup,\n }),\n [propertiesShowGroup],\n );\n\n const customUIContextValue = useMemo(\n () => ({\n customUIs,\n setCustomUIs,\n }),\n [customUIs],\n );\n\n const extractionStateJobContextValue = useMemo(\n () => ({\n mappingIdJobInfo,\n setMappingIdJobInfo,\n }),\n [mappingIdJobInfo],\n );\n\n return (\n <QueryClientProvider client={queryClient}>\n <GroupingMappingApiConfigContext.Provider value={apiConfig}>\n <MappingClientContext.Provider value={mappingClient}>\n <GroupsClientContext.Provider value={groupsClient}>\n <PropertiesClientContext.Provider value={propertiesClient}>\n <ExtractionClientContext.Provider value={extractionClient}>\n <ExtractionStatusJobContext.Provider value={extractionStateJobContextValue}>\n <GroupingMappingCustomUIContext.Provider value={customUIContextValue}>\n <GroupHilitedElementsContext.Provider value={hilitedElementsContextValue}>\n <PropertiesGroupColorContext.Provider value={propertiesContextValue}>{props.children}</PropertiesGroupColorContext.Provider>\n </GroupHilitedElementsContext.Provider>\n </GroupingMappingCustomUIContext.Provider>\n </ExtractionStatusJobContext.Provider>\n </ExtractionClientContext.Provider>\n </PropertiesClientContext.Provider>\n </GroupsClientContext.Provider>\n </MappingClientContext.Provider>\n </GroupingMappingApiConfigContext.Provider>\n </QueryClientProvider>\n );\n};\n"]}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { GroupMinimal } from "@itwin/insights-client";
|
|
3
2
|
import "./GroupColorLegend.scss";
|
|
4
3
|
interface GroupColorLegendProps {
|
|
5
|
-
|
|
6
|
-
groups: GroupMinimal[];
|
|
4
|
+
backgroundColor: string;
|
|
7
5
|
}
|
|
8
|
-
export declare const GroupColorLegend: ({
|
|
6
|
+
export declare const GroupColorLegend: ({ backgroundColor }: GroupColorLegendProps) => JSX.Element;
|
|
9
7
|
export {};
|
|
10
8
|
//# sourceMappingURL=GroupColorLegend.d.ts.map
|
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import React from "react";
|
|
6
6
|
import { IconButton } from "@itwin/itwinui-react";
|
|
7
|
-
import { getGroupColor } from "./groupsHelpers";
|
|
8
7
|
import "./GroupColorLegend.scss";
|
|
9
|
-
export const GroupColorLegend = ({
|
|
8
|
+
export const GroupColorLegend = ({ backgroundColor }) => (React.createElement(IconButton, { styleType: "borderless" },
|
|
10
9
|
React.createElement("div", { className: "gmw-color-legend", style: {
|
|
11
|
-
backgroundColor
|
|
10
|
+
backgroundColor,
|
|
12
11
|
} })));
|
|
13
12
|
//# sourceMappingURL=GroupColorLegend.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupColorLegend.js","sourceRoot":"","sources":["../../../../src/components/Groups/GroupColorLegend.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"GroupColorLegend.js","sourceRoot":"","sources":["../../../../src/components/Groups/GroupColorLegend.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,yBAAyB,CAAC;AAMjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAE,eAAe,EAAyB,EAAE,EAAE,CAAC,CAC9E,oBAAC,UAAU,IAAC,SAAS,EAAC,YAAY;IAChC,6BACE,SAAS,EAAC,kBAAkB,EAC5B,KAAK,EAAE;YACL,eAAe;SAChB,GACD,CACS,CACd,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport { IconButton } from \"@itwin/itwinui-react\";\nimport \"./GroupColorLegend.scss\";\n\ninterface GroupColorLegendProps {\n backgroundColor: string;\n}\n\nexport const GroupColorLegend = ({ backgroundColor }: GroupColorLegendProps) => (\n <IconButton styleType=\"borderless\">\n <div\n className=\"gmw-color-legend\"\n style={{\n backgroundColor,\n }}\n />\n </IconButton>\n);\n"]}
|
|
@@ -13,10 +13,11 @@ export interface GroupsVisualizationProps extends GroupsProps {
|
|
|
13
13
|
hideRefreshIcon?: boolean;
|
|
14
14
|
deleteConfirmationContentFactory?: (group: GroupMinimal) => JSX.Element;
|
|
15
15
|
groupDeleteCallback?: (group: GroupMinimal) => void;
|
|
16
|
+
disableZoom?: boolean;
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* Component to visualize groups and their elements.
|
|
19
20
|
* @public
|
|
20
21
|
*/
|
|
21
|
-
export declare const GroupsVisualization: ({ emphasizeElements, isNonEmphasizedSelectable, onClickGroupModify, onClickAddGroup, mapping, hideVisualizationToggle, hideRefreshIcon, deleteConfirmationContentFactory, groupDeleteCallback, ...rest }: GroupsVisualizationProps) => JSX.Element;
|
|
22
|
+
export declare const GroupsVisualization: ({ emphasizeElements, isNonEmphasizedSelectable, onClickGroupModify, onClickAddGroup, mapping, hideVisualizationToggle, hideRefreshIcon, deleteConfirmationContentFactory, groupDeleteCallback, disableZoom, ...rest }: GroupsVisualizationProps) => JSX.Element;
|
|
22
23
|
//# sourceMappingURL=GroupsVisualization.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
2
|
import { useGroupHilitedElementsContext } from "../context/GroupHilitedElementsContext";
|
|
3
|
-
import { generateOverlappedGroups, hideGroupConsideringOverlaps, hideGroupIds, visualizeGroupColors } from "./groupsHelpers";
|
|
3
|
+
import { generateOverlappedGroups, getGroupColor, hideGroupConsideringOverlaps, hideGroupIds, visualizeGroupColors } from "./groupsHelpers";
|
|
4
4
|
import { clearEmphasizedElements, clearEmphasizedOverriddenElements, clearHiddenElements, hideElements, zoomToElements } from "../../common/viewerUtils";
|
|
5
5
|
import { Groups } from "./Groups";
|
|
6
6
|
import { GroupColorLegend } from "./GroupColorLegend";
|
|
@@ -19,14 +19,14 @@ import { useGroupsClient } from "../context/GroupsClientContext";
|
|
|
19
19
|
* Component to visualize groups and their elements.
|
|
20
20
|
* @public
|
|
21
21
|
*/
|
|
22
|
-
export const GroupsVisualization = ({ emphasizeElements = true, isNonEmphasizedSelectable = false, onClickGroupModify, onClickAddGroup, mapping, hideVisualizationToggle, hideRefreshIcon, deleteConfirmationContentFactory, groupDeleteCallback, ...rest }) => {
|
|
22
|
+
export const GroupsVisualization = ({ emphasizeElements = true, isNonEmphasizedSelectable = false, onClickGroupModify, onClickAddGroup, mapping, hideVisualizationToggle, hideRefreshIcon, deleteConfirmationContentFactory, groupDeleteCallback, disableZoom, ...rest }) => {
|
|
23
23
|
const { iModelConnection } = useGroupingMappingApiConfig();
|
|
24
24
|
if (!iModelConnection) {
|
|
25
25
|
throw new Error("This component requires an active iModelConnection.");
|
|
26
26
|
}
|
|
27
27
|
const [isAlertClosed, setIsAlertClosed] = useState(true);
|
|
28
28
|
const [isAlertExpanded, setIsAlertExpanded] = useState(false);
|
|
29
|
-
const { hiddenGroupsIds, showGroupColor, setShowGroupColor, isOverlappedColored, setHiddenGroupsIds, setNumberOfVisualizedGroups, isVisualizationsEnabled, setIsVisualizationsEnabled, overlappedElementsMetadata, setOverlappedElementsMetadata, } = useGroupHilitedElementsContext();
|
|
29
|
+
const { hiddenGroupsIds, showGroupColor, setShowGroupColor, isOverlappedColored, setHiddenGroupsIds, setNumberOfVisualizedGroups, isVisualizationsEnabled, setIsVisualizationsEnabled, overlappedElementsMetadata, setOverlappedElementsMetadata, groupColors, setGroupColors, } = useGroupHilitedElementsContext();
|
|
30
30
|
const { getAccessToken } = useGroupingMappingApiConfig();
|
|
31
31
|
const groupsClient = useGroupsClient();
|
|
32
32
|
const { data: groups, isFetched: isGroupsFetched, isFetching: isGroupsFetching } = useFetchGroups(mapping.id, getAccessToken, groupsClient);
|
|
@@ -45,7 +45,7 @@ export const GroupsVisualization = ({ emphasizeElements = true, isNonEmphasizedS
|
|
|
45
45
|
const visualizationMutation = useMutation({
|
|
46
46
|
mutationFn: triggerVisualization,
|
|
47
47
|
onSuccess: (allIds) => {
|
|
48
|
-
if (isMounted) {
|
|
48
|
+
if (isMounted && !disableZoom) {
|
|
49
49
|
zoomToElementsMutation.mutate(allIds);
|
|
50
50
|
}
|
|
51
51
|
},
|
|
@@ -169,12 +169,17 @@ export const GroupsVisualization = ({ emphasizeElements = true, isNonEmphasizedS
|
|
|
169
169
|
onClickAddGroup(type);
|
|
170
170
|
clearEmphasizedElements();
|
|
171
171
|
}, [onClickAddGroup]);
|
|
172
|
+
useEffect(() => {
|
|
173
|
+
if (isGroupsFetched) {
|
|
174
|
+
setGroupColors(new Map(groups?.map((g, i) => [g.id, getGroupColor(i)]) ?? []));
|
|
175
|
+
}
|
|
176
|
+
}, [groups, isGroupsFetched, setGroupColors]);
|
|
172
177
|
const groupActionButtonRenderers = useMemo(() => isVisualizationsEnabled
|
|
173
178
|
? [
|
|
174
|
-
(props) => (showGroupColor ? React.createElement(GroupColorLegend, {
|
|
179
|
+
(props) => (showGroupColor ? React.createElement(GroupColorLegend, { backgroundColor: groupColors.get(props.group.id) ?? "" }) : []),
|
|
175
180
|
(props) => (React.createElement(GroupsShowHideButtons, { ...props, isLoadingQuery: !(isVisualizationsEnabled && isGroupsFetched && isGroupsQueriesReady), showGroup: showGroup, hideGroup: hideSingleGroupWrapper })),
|
|
176
181
|
].flat()
|
|
177
|
-
: [], [
|
|
182
|
+
: [], [hideSingleGroupWrapper, isGroupsFetched, isGroupsQueriesReady, isVisualizationsEnabled, showGroup, showGroupColor, groupColors]);
|
|
178
183
|
const overlappedAlert = useMemo(() => overlappedElementsMetadata.overlappedElementsInfo.size > 0 && isAlertClosed && showGroupColor ? (React.createElement(Alert, { onClose: () => setIsAlertClosed(false), clickableText: isAlertExpanded ? "Less Details" : "More Details", clickableTextProps: { onClick: () => setIsAlertExpanded(!isAlertExpanded) } },
|
|
179
184
|
"Overlapping elements are colored ",
|
|
180
185
|
React.createElement(Text, { className: "gmw-red-text" }, "red"),
|