@itwin/grouping-mapping-widget 0.5.8 → 0.7.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/README.md +84 -0
- package/lib/cjs/grouping-mapping-widget.d.ts +1 -1
- package/lib/cjs/grouping-mapping-widget.js +3 -2
- package/lib/cjs/grouping-mapping-widget.js.map +1 -1
- package/lib/cjs/test/GroupingMappingCustomUI.test.d.ts +2 -0
- package/lib/cjs/test/GroupingMappingCustomUI.test.js +162 -0
- package/lib/cjs/test/GroupingMappingCustomUI.test.js.map +1 -0
- package/lib/cjs/test/WidgetHeader.test.d.ts +2 -0
- package/lib/cjs/test/WidgetHeader.test.js +36 -0
- package/lib/cjs/test/WidgetHeader.test.js.map +1 -0
- package/lib/cjs/test/test-utils.d.ts +72 -0
- package/lib/cjs/test/test-utils.js +71 -0
- package/lib/cjs/test/test-utils.js.map +1 -0
- package/lib/cjs/widget/components/CalculatedPropertyAction.d.ts +2 -2
- package/lib/cjs/widget/components/CalculatedPropertyAction.js +13 -13
- package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/CalculatedPropertyTable.d.ts +5 -5
- package/lib/cjs/widget/components/CalculatedPropertyTable.js.map +1 -1
- package/lib/cjs/widget/components/ConfirmMappingsImport.d.ts +3 -3
- package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/cjs/widget/components/CustomCalculationAction.d.ts +2 -2
- package/lib/cjs/widget/components/CustomCalculationAction.js +5 -5
- package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/cjs/widget/components/CustomCalculationTable.d.ts +5 -5
- package/lib/cjs/widget/components/CustomCalculationTable.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.d.ts +4 -3
- package/lib/cjs/widget/components/GroupAction.js +82 -75
- package/lib/cjs/widget/components/GroupAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.scss +1 -13
- package/lib/cjs/widget/components/GroupPropertyAction.d.ts +2 -1
- package/lib/cjs/widget/components/GroupPropertyAction.js +27 -26
- package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupPropertyTable.d.ts +5 -5
- package/lib/cjs/widget/components/GroupPropertyTable.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.d.ts +6 -1
- package/lib/cjs/widget/components/Grouping.js +128 -66
- package/lib/cjs/widget/components/Grouping.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.scss +21 -2
- package/lib/cjs/widget/components/GroupingMapping.d.ts +8 -3
- package/lib/cjs/widget/components/GroupingMapping.js +22 -9
- package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
- package/lib/cjs/widget/components/Mapping.d.ts +1 -1
- package/lib/cjs/widget/components/Mapping.js +6 -7
- package/lib/cjs/widget/components/Mapping.js.map +1 -1
- package/lib/cjs/widget/components/Mapping.scss +4 -5
- package/lib/cjs/widget/components/MappingAction.js +1 -2
- package/lib/cjs/widget/components/MappingAction.js.map +1 -1
- package/lib/cjs/widget/components/MappingImportWizardModal.js.map +1 -1
- package/lib/cjs/widget/components/PropertyMenu.d.ts +2 -2
- package/lib/cjs/widget/components/PropertyMenu.js +7 -8
- package/lib/cjs/widget/components/PropertyMenu.js.map +1 -1
- package/lib/cjs/widget/components/SelectMappings.d.ts +2 -2
- package/lib/cjs/widget/components/SelectMappings.js +2 -2
- package/lib/cjs/widget/components/SelectMappings.js.map +1 -1
- package/lib/cjs/widget/components/context/GroupingMappingCustomUIContext.d.ts +6 -0
- package/lib/cjs/widget/components/context/GroupingMappingCustomUIContext.js +25 -0
- package/lib/cjs/widget/components/context/GroupingMappingCustomUIContext.js.map +1 -0
- package/lib/cjs/widget/components/context/MappingClientContext.d.ts +5 -5
- package/lib/cjs/widget/components/context/MappingClientContext.js +1 -5
- package/lib/cjs/widget/components/context/MappingClientContext.js.map +1 -1
- package/lib/cjs/widget/components/customUI/GroupingMappingCustomUI.d.ts +91 -0
- package/lib/cjs/widget/components/customUI/GroupingMappingCustomUI.js +9 -0
- package/lib/cjs/widget/components/customUI/GroupingMappingCustomUI.js.map +1 -0
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.d.ts +6 -0
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js +31 -0
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -0
- package/lib/{esm/widget/IMappingClient.js → cjs/widget/components/customUI/ManualGroupingCustomUI.scss} +13 -2
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.d.ts +6 -0
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js +97 -0
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -0
- package/lib/cjs/widget/{IMappingClient.js → components/customUI/SearchGroupingCustomUI.scss} +13 -3
- package/lib/esm/grouping-mapping-widget.d.ts +1 -1
- package/lib/esm/grouping-mapping-widget.js +1 -1
- package/lib/esm/grouping-mapping-widget.js.map +1 -1
- package/lib/esm/test/GroupingMappingCustomUI.test.d.ts +2 -0
- package/lib/esm/test/GroupingMappingCustomUI.test.js +138 -0
- package/lib/esm/test/GroupingMappingCustomUI.test.js.map +1 -0
- package/lib/esm/test/WidgetHeader.test.d.ts +2 -0
- package/lib/esm/test/WidgetHeader.test.js +31 -0
- package/lib/esm/test/WidgetHeader.test.js.map +1 -0
- package/lib/esm/test/test-utils.d.ts +72 -0
- package/lib/esm/test/test-utils.js +42 -0
- package/lib/esm/test/test-utils.js.map +1 -0
- package/lib/esm/widget/components/CalculatedPropertyAction.d.ts +2 -2
- package/lib/esm/widget/components/CalculatedPropertyAction.js +13 -13
- package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/CalculatedPropertyTable.d.ts +5 -5
- package/lib/esm/widget/components/CalculatedPropertyTable.js.map +1 -1
- package/lib/esm/widget/components/ConfirmMappingsImport.d.ts +3 -3
- package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/esm/widget/components/CustomCalculationAction.d.ts +2 -2
- package/lib/esm/widget/components/CustomCalculationAction.js +5 -5
- package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/esm/widget/components/CustomCalculationTable.d.ts +5 -5
- package/lib/esm/widget/components/CustomCalculationTable.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.d.ts +4 -3
- package/lib/esm/widget/components/GroupAction.js +85 -78
- package/lib/esm/widget/components/GroupAction.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.scss +1 -13
- package/lib/esm/widget/components/GroupPropertyAction.d.ts +2 -1
- package/lib/esm/widget/components/GroupPropertyAction.js +27 -26
- package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/GroupPropertyTable.d.ts +5 -5
- package/lib/esm/widget/components/GroupPropertyTable.js.map +1 -1
- package/lib/esm/widget/components/Grouping.d.ts +6 -1
- package/lib/esm/widget/components/Grouping.js +128 -66
- package/lib/esm/widget/components/Grouping.js.map +1 -1
- package/lib/esm/widget/components/Grouping.scss +21 -2
- package/lib/esm/widget/components/GroupingMapping.d.ts +8 -3
- package/lib/esm/widget/components/GroupingMapping.js +23 -10
- package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
- package/lib/esm/widget/components/Mapping.d.ts +1 -1
- package/lib/esm/widget/components/Mapping.js +6 -7
- package/lib/esm/widget/components/Mapping.js.map +1 -1
- package/lib/esm/widget/components/Mapping.scss +4 -5
- package/lib/esm/widget/components/MappingAction.js +1 -2
- package/lib/esm/widget/components/MappingAction.js.map +1 -1
- package/lib/esm/widget/components/MappingImportWizardModal.js.map +1 -1
- package/lib/esm/widget/components/PropertyMenu.d.ts +2 -2
- package/lib/esm/widget/components/PropertyMenu.js +7 -8
- package/lib/esm/widget/components/PropertyMenu.js.map +1 -1
- package/lib/esm/widget/components/SelectMappings.d.ts +2 -2
- package/lib/esm/widget/components/SelectMappings.js +2 -2
- package/lib/esm/widget/components/SelectMappings.js.map +1 -1
- package/lib/esm/widget/components/context/GroupingMappingCustomUIContext.d.ts +6 -0
- package/lib/esm/widget/components/context/GroupingMappingCustomUIContext.js +20 -0
- package/lib/esm/widget/components/context/GroupingMappingCustomUIContext.js.map +1 -0
- package/lib/esm/widget/components/context/MappingClientContext.d.ts +5 -5
- package/lib/esm/widget/components/context/MappingClientContext.js +2 -6
- package/lib/esm/widget/components/context/MappingClientContext.js.map +1 -1
- package/lib/esm/widget/components/customUI/GroupingMappingCustomUI.d.ts +91 -0
- package/lib/esm/widget/components/customUI/GroupingMappingCustomUI.js +6 -0
- package/lib/esm/widget/components/customUI/GroupingMappingCustomUI.js.map +1 -0
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.d.ts +6 -0
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js +26 -0
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -0
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.scss +17 -0
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.d.ts +6 -0
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js +92 -0
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -0
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.scss +17 -0
- package/package.json +18 -4
- package/lib/cjs/widget/IMappingClient.d.ts +0 -327
- package/lib/cjs/widget/IMappingClient.js.map +0 -1
- package/lib/esm/widget/IMappingClient.d.ts +0 -327
- package/lib/esm/widget/IMappingClient.js.map +0 -1
|
@@ -61,8 +61,8 @@ const convertToPropertyMap = (groupProperties, calculatedProperties, customCalcu
|
|
|
61
61
|
return map;
|
|
62
62
|
};
|
|
63
63
|
export const PropertyMenu = ({ iModelId, mappingId, group, goBack, hideGroupProps = false, hideCalculatedProps = false, hideCustomCalculationProps = false, }) => {
|
|
64
|
-
var _a, _b
|
|
65
|
-
const groupId =
|
|
64
|
+
var _a, _b;
|
|
65
|
+
const groupId = group.id;
|
|
66
66
|
const { getAccessToken } = useGroupingMappingApiConfig();
|
|
67
67
|
const mappingClient = useMappingClient();
|
|
68
68
|
const iModelConnection = useActiveIModelConnection();
|
|
@@ -88,9 +88,8 @@ export const PropertyMenu = ({ iModelId, mappingId, group, goBack, hideGroupProp
|
|
|
88
88
|
const { isLoading: isLoadingCustomCalculations, data: customCalculations, refreshData: refreshCustomCalculations } = useCombinedFetchRefresh(fetchCustomCalculations);
|
|
89
89
|
useEffect(() => {
|
|
90
90
|
const initialize = async () => {
|
|
91
|
-
var _a;
|
|
92
91
|
try {
|
|
93
|
-
const query =
|
|
92
|
+
const query = group.query;
|
|
94
93
|
const queryRowCount = await iModelConnection.queryRowCount(query);
|
|
95
94
|
if (queryRowCount === 0) {
|
|
96
95
|
toaster.warning("The query is valid but produced no results.");
|
|
@@ -148,7 +147,7 @@ export const PropertyMenu = ({ iModelId, mappingId, group, goBack, hideGroupProp
|
|
|
148
147
|
case PropertyMenuView.ADD_GROUP_PROPERTY:
|
|
149
148
|
return (React.createElement(GroupPropertyAction, { iModelId: iModelId, mappingId: mappingId, groupId: groupId, keySet: keySet !== null && keySet !== void 0 ? keySet : new KeySet(), returnFn: groupPropertyReturn }));
|
|
150
149
|
case PropertyMenuView.MODIFY_GROUP_PROPERTY:
|
|
151
|
-
return (React.createElement(GroupPropertyAction, { iModelId: iModelId, mappingId: mappingId, groupId: groupId, keySet: keySet !== null && keySet !== void 0 ? keySet : new KeySet(), groupPropertyId: (
|
|
150
|
+
return (React.createElement(GroupPropertyAction, { iModelId: iModelId, mappingId: mappingId, groupId: groupId, keySet: keySet !== null && keySet !== void 0 ? keySet : new KeySet(), groupPropertyId: (_a = selectedGroupProperty === null || selectedGroupProperty === void 0 ? void 0 : selectedGroupProperty.id) !== null && _a !== void 0 ? _a : "", groupPropertyName: (_b = selectedGroupProperty === null || selectedGroupProperty === void 0 ? void 0 : selectedGroupProperty.propertyName) !== null && _b !== void 0 ? _b : "", returnFn: groupPropertyReturn }));
|
|
152
151
|
case PropertyMenuView.ADD_CALCULATED_PROPERTY:
|
|
153
152
|
return (React.createElement(CalculatedPropertyAction, { iModelId: iModelId, mappingId: mappingId, groupId: groupId, ids: resolvedHiliteIds, returnFn: calculatedPropertyReturn }));
|
|
154
153
|
case PropertyMenuView.MODIFY_CALCULATED_PROPERTY:
|
|
@@ -160,7 +159,7 @@ export const PropertyMenu = ({ iModelId, mappingId, group, goBack, hideGroupProp
|
|
|
160
159
|
default:
|
|
161
160
|
return (React.createElement(InformationPanelWrapper, { className: 'gmw-property-menu-wrapper' },
|
|
162
161
|
React.createElement("div", { className: 'gmw-property-header' },
|
|
163
|
-
React.createElement(WidgetHeader, { title: `${
|
|
162
|
+
React.createElement(WidgetHeader, { title: `${group.groupName}`, returnFn: goBack }),
|
|
164
163
|
React.createElement(IconButton, { styleType: 'borderless', onClick: () => setIsInformationPanelOpen(true) },
|
|
165
164
|
React.createElement(SvgProperties, null))),
|
|
166
165
|
React.createElement("div", { className: 'gmw-property-menu-container' },
|
|
@@ -172,10 +171,10 @@ export const PropertyMenu = ({ iModelId, mappingId, group, goBack, hideGroupProp
|
|
|
172
171
|
React.createElement(CustomCalculationTable, { iModelId: iModelId, mappingId: mappingId, groupId: groupId, onCustomCalculationModify: onCustomCalculationModify, setSelectedCustomCalculation: setSelectedCustomCalculation, setGroupModifyView: setPropertyMenuView, isLoadingCustomCalculations: isLoadingCustomCalculations, customCalculations: customCalculations, refreshCustomCalculations: refreshCustomCalculations, selectedCustomCalculation: selectedCustomCalculation })))),
|
|
173
172
|
React.createElement(InformationPanel, { className: 'gmw-information-panel', isOpen: isInformationPanelOpen },
|
|
174
173
|
React.createElement(InformationPanelHeader, { onClose: () => setIsInformationPanelOpen(false) },
|
|
175
|
-
React.createElement(Text, { variant: 'subheading' }, `${
|
|
174
|
+
React.createElement(Text, { variant: 'subheading' }, `${group.groupName} Information`)),
|
|
176
175
|
React.createElement(InformationPanelBody, null,
|
|
177
176
|
React.createElement("div", { className: 'gmw-information-body' },
|
|
178
|
-
React.createElement(LabeledTextarea, { label: 'Query', rows: 15, readOnly: true, defaultValue:
|
|
177
|
+
React.createElement(LabeledTextarea, { label: 'Query', rows: 15, readOnly: true, defaultValue: group.query }))))));
|
|
179
178
|
}
|
|
180
179
|
};
|
|
181
180
|
//# sourceMappingURL=PropertyMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyMenu.js","sourceRoot":"","sources":["../../../../src/widget/components/PropertyMenu.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EACL,iCAAiC,EACjC,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EACvB,cAAc,GACf,MAAM,eAAe,CAAC;AAEvB,OAAO,qBAAqB,CAAC;AAC7B,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAElE,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAItD,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,eAAe,EACf,cAAc,EACd,IAAI,EACJ,OAAO,GACR,MAAM,sBAAsB,CAAC;AAK9B,OAAO,sBAAsB,MAAM,0BAA0B,CAAC;AAC9D,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,u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,EAAC,oBAAoB;wBACjC,oBAAC,sBAAsB,IACrB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,yBAAyB,EAAE,yBAAyB,EACpD,4BAA4B,EAAE,4BAA4B,EAC1D,kBAAkB,EAAE,mBAAmB,EACvC,2BAA2B,EAAE,2BAA2B,EACxD,kBAAkB,EAAE,kBAAkB,EACtC,yBAAyB,EAAE,yBAAyB,EACpD,yBAAyB,EAAE,yBAAyB,GACpD,CACE,CACP,CACG;gBACN,oBAAC,gBAAgB,IACf,SAAS,EAAC,uBAAuB,EACjC,MAAM,EAAE,sBAAsB;oBAE9B,oBAAC,sBAAsB,IACrB,OAAO,EAAE,GAAG,EAAE,CAAC,yBAAyB,CAAC,KAAK,CAAC;wBAE/C,oBAAC,IAAI,IAAC,OAAO,EAAC,YAAY,IAAE,GAAG,MAAA,KAAK,CAAC,SAAS,mCAAI,EAAE,cAAc,CAAQ,CACnD;oBACzB,oBAAC,oBAAoB;wBACnB,6BAAK,SAAS,EAAC,sBAAsB;4BACnC,oBAAC,eAAe,IACd,KAAK,EAAC,OAAO,EACb,IAAI,EAAE,EAAE,EACR,QAAQ,QACR,YAAY,EAAE,MAAA,KAAK,CAAC,KAAK,mCAAI,EAAE,GAC/B,CACE,CACe,CACN,CACK,CAC3B,CAAC;KACL;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 type { IModelConnection } from \"@itwin/core-frontend\";\nimport { Presentation } from \"@itwin/presentation-frontend\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\n\nimport { WidgetHeader } from \"./utils\";\nimport {\n clearEmphasizedOverriddenElements,\n manufactureKeys,\n visualizeElements,\n visualizeElementsByKeys,\n zoomToElements,\n} from \"./viewerUtils\";\nimport type { GroupType } from \"./Grouping\";\nimport \"./PropertyMenu.scss\";\nimport GroupPropertyAction from \"./GroupPropertyAction\";\nimport CalculatedPropertyAction from \"./CalculatedPropertyAction\";\nimport type { GroupPropertyType } from \"./GroupPropertyTable\";\nimport GroupPropertyTable from \"./GroupPropertyTable\";\nimport type {\n CalculatedPropertyType,\n} from \"./CalculatedPropertyTable\";\nimport CalculatedPropertyTable from \"./CalculatedPropertyTable\";\nimport {\n IconButton,\n InformationPanel,\n InformationPanelBody,\n InformationPanelHeader,\n InformationPanelWrapper,\n LabeledTextarea,\n ProgressRadial,\n Text,\n toaster,\n} from \"@itwin/itwinui-react\";\nimport type { CellProps } from \"react-table\";\nimport type {\n CustomCalculationType,\n} from \"./CustomCalculationTable\";\nimport CustomCalculationTable from \"./CustomCalculationTable\";\nimport CustomCalculationAction from \"./CustomCalculationAction\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport { SvgProperties } from \"@itwin/itwinui-icons-react\";\nimport type { PossibleDataType, PropertyMap } from \"../../formula/Types\";\nimport { useCombinedFetchRefresh } from \"../hooks/useFetchData\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\n\ninterface PropertyModifyProps {\n iModelId: string;\n mappingId: string;\n group: GroupType;\n goBack: () => Promise<void>;\n hideGroupProps?: boolean;\n hideCalculatedProps?: boolean;\n hideCustomCalculationProps?: boolean;\n}\n\nexport enum PropertyMenuView {\n DEFAULT = \"default\",\n ADD_GROUP_PROPERTY = \"add_group_property\",\n MODIFY_GROUP_PROPERTY = \"modify_group_property\",\n ADD_CALCULATED_PROPERTY = \"add_calculated_property\",\n MODIFY_CALCULATED_PROPERTY = \"modify_calculated_property\",\n ADD_CUSTOM_CALCULATION = \"add_custom_calculation\",\n MODIFY_CUSTOM_CALCULATION = \"modify_custom_calculation\",\n}\n\nconst stringToPossibleDataType = (str?: string): PossibleDataType => {\n if (!str)\n return \"Undefined\";\n\n switch (str.toLowerCase()) {\n case \"double\":\n case \"number\": return \"Number\";\n case \"string\": return \"String\";\n case \"boolean\": return \"Boolean\";\n default: return \"Undefined\";\n }\n};\n\nconst convertToPropertyMap = (\n groupProperties: GroupPropertyType[],\n calculatedProperties: CalculatedPropertyType[],\n customCalculations: CustomCalculationType[],\n selectedPropertyName?: string\n): PropertyMap => {\n const map: PropertyMap = {};\n const selectedLowerName = selectedPropertyName?.toLowerCase();\n\n groupProperties.forEach((p) => {\n const lowerName = p.propertyName?.toLowerCase();\n if (lowerName && lowerName !== selectedLowerName)\n map[lowerName] = stringToPossibleDataType(p.dataType);\n });\n\n calculatedProperties.forEach((p) => {\n const lowerName = p.propertyName?.toLowerCase();\n if (lowerName)\n map[lowerName] = \"Number\";\n });\n\n customCalculations.forEach((p) => {\n const lowerName = p.propertyName?.toLowerCase();\n if (lowerName && lowerName !== selectedLowerName)\n map[lowerName] = stringToPossibleDataType(p.dataType);\n });\n\n return map;\n};\n\nexport const PropertyMenu = ({\n iModelId,\n mappingId,\n group,\n goBack,\n hideGroupProps = false,\n hideCalculatedProps = false,\n hideCustomCalculationProps = false,\n}: PropertyModifyProps) => {\n const groupId = group.id ?? \"\";\n\n const { getAccessToken } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n\n const iModelConnection = useActiveIModelConnection() as IModelConnection;\n const [propertyMenuView, setPropertyMenuView] = useState<PropertyMenuView>(\n PropertyMenuView.DEFAULT,\n );\n const [selectedGroupProperty, setSelectedGroupProperty] =\n useState<GroupPropertyType | undefined>(undefined);\n const [selectedCalculatedProperty, setSelectedCalculatedProperty] =\n useState<CalculatedPropertyType | undefined>(undefined);\n const [selectedCustomCalculation, setSelectedCustomCalculation] =\n useState<CustomCalculationType | undefined>(undefined);\n const [isInformationPanelOpen, setIsInformationPanelOpen] =\n useState<boolean>(false);\n const [resolvedHiliteIds, setResolvedHiliteIds] = useState<string[]>([]);\n const [keySet, setKeySet] = useState<KeySet>();\n const [isLoading, setIsLoading] = useState<boolean>(true);\n\n const fetchGroupProperties = useMemo(\n () => {\n return async () => mappingClient.getGroupProperties((await getAccessToken()), iModelId, mappingId, groupId);\n },\n [getAccessToken, mappingClient, iModelId, mappingId, groupId],\n );\n const { isLoading: isLoadingGroupProperties, data: groupProperties, refreshData: refreshGroupProperties } =\n useCombinedFetchRefresh<GroupPropertyType>(fetchGroupProperties);\n\n const fetchCalculatedProperties = useMemo(\n () => {\n return async () => mappingClient.getCalculatedProperties((await getAccessToken()), iModelId, mappingId, groupId);\n },\n [getAccessToken, mappingClient, iModelId, mappingId, groupId],\n );\n const { isLoading: isLoadingCalculatedProperties, data: calculatedProperties, refreshData: refreshCalculatedProperties } =\n useCombinedFetchRefresh<CalculatedPropertyType>(fetchCalculatedProperties);\n\n const fetchCustomCalculations = useMemo(\n () => {\n return async () => mappingClient.getCustomCalculations((await getAccessToken()), iModelId, mappingId, groupId);\n },\n [getAccessToken, mappingClient, iModelId, mappingId, groupId],\n );\n const { isLoading: isLoadingCustomCalculations, data: customCalculations, refreshData: refreshCustomCalculations } =\n useCombinedFetchRefresh<CustomCalculationType>(fetchCustomCalculations);\n\n useEffect(() => {\n const initialize = async () => {\n try {\n const query = group.query ?? \"\";\n const queryRowCount = await iModelConnection.queryRowCount(query);\n if (queryRowCount === 0) {\n toaster.warning(\"The query is valid but produced no results.\");\n await goBack();\n }\n const keys = await manufactureKeys(query, iModelConnection);\n setKeySet(keys);\n Presentation.selection.clearSelection(\n \"GroupingMappingWidget\",\n iModelConnection,\n );\n clearEmphasizedOverriddenElements();\n const resolvedIds = await visualizeElementsByKeys(keys, \"red\");\n await zoomToElements(resolvedIds);\n setResolvedHiliteIds(resolvedIds);\n setIsLoading(false);\n } catch {\n toaster.negative(`Could not load ${group.groupName}.`);\n await goBack();\n }\n };\n void initialize();\n }, [iModelConnection, group.query, goBack, group.groupName]);\n\n const onGroupPropertyModify = useCallback(\n (value: CellProps<GroupPropertyType>) => {\n setSelectedGroupProperty(value.row.original);\n setPropertyMenuView(PropertyMenuView.MODIFY_GROUP_PROPERTY);\n },\n [],\n );\n\n const onCalculatedPropertyModify = useCallback(\n (value: CellProps<CalculatedPropertyType>) => {\n setSelectedCalculatedProperty(value.row.original);\n setPropertyMenuView(PropertyMenuView.MODIFY_CALCULATED_PROPERTY);\n },\n [],\n );\n\n const onCustomCalculationModify = useCallback(\n (value: CellProps<CustomCalculationType>) => {\n setSelectedCustomCalculation(value.row.original);\n setPropertyMenuView(PropertyMenuView.MODIFY_CUSTOM_CALCULATION);\n },\n [],\n );\n\n const groupPropertyReturn = useCallback(async (modified: boolean) => {\n setPropertyMenuView(PropertyMenuView.DEFAULT);\n modified && await refreshGroupProperties();\n }, [refreshGroupProperties]);\n\n const calculatedPropertyReturn = useCallback(async (modified: boolean) => {\n visualizeElements(resolvedHiliteIds, \"red\");\n await zoomToElements(resolvedHiliteIds);\n setPropertyMenuView(PropertyMenuView.DEFAULT);\n modified && await refreshCalculatedProperties();\n }, [resolvedHiliteIds, refreshCalculatedProperties]);\n\n const customCalculationReturn = useCallback(async (modified: boolean) => {\n setPropertyMenuView(PropertyMenuView.DEFAULT);\n modified && await refreshCustomCalculations();\n }, [refreshCustomCalculations]);\n\n if (isLoading) {\n return (\n <div className='gmw-loading-overlay'>\n <Text>Loading Group</Text>\n <ProgressRadial indeterminate />\n <Text>Please wait...</Text>\n </div>\n );\n }\n\n switch (propertyMenuView) {\n case PropertyMenuView.ADD_GROUP_PROPERTY:\n return (\n <GroupPropertyAction\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n keySet={keySet ?? new KeySet()}\n returnFn={groupPropertyReturn}\n />\n );\n case PropertyMenuView.MODIFY_GROUP_PROPERTY:\n return (\n <GroupPropertyAction\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n keySet={keySet ?? new KeySet()}\n groupPropertyId={selectedGroupProperty?.id ?? \"\"}\n groupPropertyName={selectedGroupProperty?.propertyName ?? \"\"}\n returnFn={groupPropertyReturn}\n />\n );\n case PropertyMenuView.ADD_CALCULATED_PROPERTY:\n return (\n <CalculatedPropertyAction\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n ids={resolvedHiliteIds}\n returnFn={calculatedPropertyReturn}\n />\n );\n case PropertyMenuView.MODIFY_CALCULATED_PROPERTY:\n return (\n <CalculatedPropertyAction\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n property={selectedCalculatedProperty}\n ids={resolvedHiliteIds}\n returnFn={calculatedPropertyReturn}\n />\n );\n case PropertyMenuView.ADD_CUSTOM_CALCULATION:\n return (\n <CustomCalculationAction\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n properties={convertToPropertyMap(groupProperties, calculatedProperties, customCalculations)}\n returnFn={customCalculationReturn}\n />\n );\n case PropertyMenuView.MODIFY_CUSTOM_CALCULATION:\n return (\n <CustomCalculationAction\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n properties={convertToPropertyMap(groupProperties, calculatedProperties, customCalculations, selectedCustomCalculation?.propertyName)}\n customCalculation={selectedCustomCalculation}\n returnFn={customCalculationReturn}\n />\n );\n default:\n return (\n <InformationPanelWrapper className='gmw-property-menu-wrapper'>\n <div className='gmw-property-header'>\n <WidgetHeader\n title={`${group.groupName ?? \"\"}`}\n returnFn={goBack}\n />\n <IconButton\n styleType='borderless'\n onClick={() => setIsInformationPanelOpen(true)}\n >\n <SvgProperties />\n </IconButton>\n </div>\n <div className='gmw-property-menu-container'>\n {!hideGroupProps && (\n <div className='gmw-property-table'>\n <GroupPropertyTable\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n onGroupPropertyModify={onGroupPropertyModify}\n setSelectedGroupProperty={setSelectedGroupProperty}\n setGroupModifyView={setPropertyMenuView}\n isLoadingGroupProperties={isLoadingGroupProperties}\n groupProperties={groupProperties}\n refreshGroupProperties={refreshGroupProperties}\n selectedGroupProperty={selectedGroupProperty}\n />\n </div>\n )}\n\n {!hideCalculatedProps && (\n <div className='gmw-property-table'>\n <CalculatedPropertyTable\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n onCalculatedPropertyModify={onCalculatedPropertyModify}\n setSelectedCalculatedProperty={setSelectedCalculatedProperty}\n setGroupModifyView={setPropertyMenuView}\n isLoadingCalculatedProperties={isLoadingCalculatedProperties}\n calculatedProperties={calculatedProperties}\n refreshCalculatedProperties={refreshCalculatedProperties}\n selectedCalculatedProperty={selectedCalculatedProperty}\n />\n </div>\n )}\n {!hideCustomCalculationProps && (\n <div className='gmw-property-table'>\n <CustomCalculationTable\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n onCustomCalculationModify={onCustomCalculationModify}\n setSelectedCustomCalculation={setSelectedCustomCalculation}\n setGroupModifyView={setPropertyMenuView}\n isLoadingCustomCalculations={isLoadingCustomCalculations}\n customCalculations={customCalculations}\n refreshCustomCalculations={refreshCustomCalculations}\n selectedCustomCalculation={selectedCustomCalculation}\n />\n </div>\n )}\n </div>\n <InformationPanel\n className='gmw-information-panel'\n isOpen={isInformationPanelOpen}\n >\n <InformationPanelHeader\n onClose={() => setIsInformationPanelOpen(false)}\n >\n <Text variant='subheading'>{`${group.groupName ?? \"\"} Information`}</Text>\n </InformationPanelHeader>\n <InformationPanelBody>\n <div className='gmw-information-body'>\n <LabeledTextarea\n label='Query'\n rows={15}\n readOnly\n defaultValue={group.query ?? \"\"}\n />\n </div>\n </InformationPanelBody>\n </InformationPanel>\n </InformationPanelWrapper>\n );\n }\n};\n"]}
|
|
1
|
+
{"version":3,"file":"PropertyMenu.js","sourceRoot":"","sources":["../../../../src/widget/components/PropertyMenu.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EA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S,cAAc,CAAQ,CAC7C;oBACzB,oBAAC,oBAAoB;wBACnB,6BAAK,SAAS,EAAC,sBAAsB;4BACnC,oBAAC,eAAe,IACd,KAAK,EAAC,OAAO,EACb,IAAI,EAAE,EAAE,EACR,QAAQ,QACR,YAAY,EAAE,KAAK,CAAC,KAAK,GACzB,CACE,CACe,CACN,CACK,CAC3B,CAAC;KACL;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 type { IModelConnection } from \"@itwin/core-frontend\";\nimport { Presentation } from \"@itwin/presentation-frontend\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\n\nimport { WidgetHeader } from \"./utils\";\nimport {\n clearEmphasizedOverriddenElements,\n manufactureKeys,\n visualizeElements,\n visualizeElementsByKeys,\n zoomToElements,\n} from \"./viewerUtils\";\nimport type { IGroupTyped } from \"./Grouping\";\nimport \"./PropertyMenu.scss\";\nimport GroupPropertyAction from \"./GroupPropertyAction\";\nimport CalculatedPropertyAction from \"./CalculatedPropertyAction\";\nimport type { IGroupPropertyTyped } from \"./GroupPropertyTable\";\nimport GroupPropertyTable from \"./GroupPropertyTable\";\nimport type {\n ICalculatedPropertyTyped,\n} from \"./CalculatedPropertyTable\";\nimport CalculatedPropertyTable from \"./CalculatedPropertyTable\";\nimport {\n IconButton,\n InformationPanel,\n InformationPanelBody,\n InformationPanelHeader,\n InformationPanelWrapper,\n LabeledTextarea,\n ProgressRadial,\n Text,\n toaster,\n} from \"@itwin/itwinui-react\";\nimport type { CellProps } from \"react-table\";\nimport type {\n ICustomCalculationTyped,\n} from \"./CustomCalculationTable\";\nimport CustomCalculationTable from \"./CustomCalculationTable\";\nimport CustomCalculationAction from \"./CustomCalculationAction\";\nimport { KeySet } from \"@itwin/presentation-common\";\nimport { SvgProperties } from \"@itwin/itwinui-icons-react\";\nimport type { PossibleDataType, PropertyMap } from \"../../formula/Types\";\nimport { useCombinedFetchRefresh } from \"../hooks/useFetchData\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\n\ninterface PropertyModifyProps {\n iModelId: string;\n mappingId: string;\n group: IGroupTyped;\n goBack: () => Promise<void>;\n hideGroupProps?: boolean;\n hideCalculatedProps?: boolean;\n hideCustomCalculationProps?: boolean;\n}\n\nexport enum PropertyMenuView {\n DEFAULT = \"default\",\n ADD_GROUP_PROPERTY = \"add_group_property\",\n MODIFY_GROUP_PROPERTY = \"modify_group_property\",\n ADD_CALCULATED_PROPERTY = \"add_calculated_property\",\n MODIFY_CALCULATED_PROPERTY = \"modify_calculated_property\",\n ADD_CUSTOM_CALCULATION = \"add_custom_calculation\",\n MODIFY_CUSTOM_CALCULATION = \"modify_custom_calculation\",\n}\n\nconst stringToPossibleDataType = (str?: string): PossibleDataType => {\n if (!str)\n return \"Undefined\";\n\n switch (str.toLowerCase()) {\n case \"double\":\n case \"number\": return \"Number\";\n case \"string\": return \"String\";\n case \"boolean\": return \"Boolean\";\n default: return \"Undefined\";\n }\n};\n\nconst convertToPropertyMap = (\n groupProperties: IGroupPropertyTyped[],\n calculatedProperties: ICalculatedPropertyTyped[],\n customCalculations: ICustomCalculationTyped[],\n selectedPropertyName?: string\n): PropertyMap => {\n const map: PropertyMap = {};\n const selectedLowerName = selectedPropertyName?.toLowerCase();\n\n groupProperties.forEach((p) => {\n const lowerName = p.propertyName?.toLowerCase();\n if (lowerName && lowerName !== selectedLowerName)\n map[lowerName] = stringToPossibleDataType(p.dataType);\n });\n\n calculatedProperties.forEach((p) => {\n const lowerName = p.propertyName?.toLowerCase();\n if (lowerName)\n map[lowerName] = \"Number\";\n });\n\n customCalculations.forEach((p) => {\n const lowerName = p.propertyName?.toLowerCase();\n if (lowerName && lowerName !== selectedLowerName)\n map[lowerName] = stringToPossibleDataType(p.dataType);\n });\n\n return map;\n};\n\nexport const PropertyMenu = ({\n iModelId,\n mappingId,\n group,\n goBack,\n hideGroupProps = false,\n hideCalculatedProps = false,\n hideCustomCalculationProps = false,\n}: PropertyModifyProps) => {\n const groupId = group.id;\n\n const { getAccessToken } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n\n const iModelConnection = useActiveIModelConnection() as IModelConnection;\n const [propertyMenuView, setPropertyMenuView] = useState<PropertyMenuView>(\n PropertyMenuView.DEFAULT,\n );\n const [selectedGroupProperty, setSelectedGroupProperty] =\n useState<IGroupPropertyTyped | undefined>(undefined);\n const [selectedCalculatedProperty, setSelectedCalculatedProperty] =\n useState<ICalculatedPropertyTyped | undefined>(undefined);\n const [selectedCustomCalculation, setSelectedCustomCalculation] =\n useState<ICustomCalculationTyped | undefined>(undefined);\n const [isInformationPanelOpen, setIsInformationPanelOpen] =\n useState<boolean>(false);\n const [resolvedHiliteIds, setResolvedHiliteIds] = useState<string[]>([]);\n const [keySet, setKeySet] = useState<KeySet>();\n const [isLoading, setIsLoading] = useState<boolean>(true);\n\n const fetchGroupProperties = useMemo(\n () => {\n return async () => mappingClient.getGroupProperties((await getAccessToken()), iModelId, mappingId, groupId);\n },\n [getAccessToken, mappingClient, iModelId, mappingId, groupId],\n );\n const { isLoading: isLoadingGroupProperties, data: groupProperties, refreshData: refreshGroupProperties } =\n useCombinedFetchRefresh<IGroupPropertyTyped>(fetchGroupProperties);\n\n const fetchCalculatedProperties = useMemo(\n () => {\n return async () => mappingClient.getCalculatedProperties((await getAccessToken()), iModelId, mappingId, groupId);\n },\n [getAccessToken, mappingClient, iModelId, mappingId, groupId],\n );\n const { isLoading: isLoadingCalculatedProperties, data: calculatedProperties, refreshData: refreshCalculatedProperties } =\n useCombinedFetchRefresh<ICalculatedPropertyTyped>(fetchCalculatedProperties);\n\n const fetchCustomCalculations = useMemo(\n () => {\n return async () => mappingClient.getCustomCalculations((await getAccessToken()), iModelId, mappingId, groupId);\n },\n [getAccessToken, mappingClient, iModelId, mappingId, groupId],\n );\n const { isLoading: isLoadingCustomCalculations, data: customCalculations, refreshData: refreshCustomCalculations } =\n useCombinedFetchRefresh<ICustomCalculationTyped>(fetchCustomCalculations);\n\n useEffect(() => {\n const initialize = async () => {\n try {\n const query = group.query;\n const queryRowCount = await iModelConnection.queryRowCount(query);\n if (queryRowCount === 0) {\n toaster.warning(\"The query is valid but produced no results.\");\n await goBack();\n }\n const keys = await manufactureKeys(query, iModelConnection);\n setKeySet(keys);\n Presentation.selection.clearSelection(\n \"GroupingMappingWidget\",\n iModelConnection,\n );\n clearEmphasizedOverriddenElements();\n const resolvedIds = await visualizeElementsByKeys(keys, \"red\");\n await zoomToElements(resolvedIds);\n setResolvedHiliteIds(resolvedIds);\n setIsLoading(false);\n } catch {\n toaster.negative(`Could not load ${group.groupName}.`);\n await goBack();\n }\n };\n void initialize();\n }, [iModelConnection, group.query, goBack, group.groupName]);\n\n const onGroupPropertyModify = useCallback(\n (value: CellProps<IGroupPropertyTyped>) => {\n setSelectedGroupProperty(value.row.original);\n setPropertyMenuView(PropertyMenuView.MODIFY_GROUP_PROPERTY);\n },\n [],\n );\n\n const onCalculatedPropertyModify = useCallback(\n (value: CellProps<ICalculatedPropertyTyped>) => {\n setSelectedCalculatedProperty(value.row.original);\n setPropertyMenuView(PropertyMenuView.MODIFY_CALCULATED_PROPERTY);\n },\n [],\n );\n\n const onCustomCalculationModify = useCallback(\n (value: CellProps<ICustomCalculationTyped>) => {\n setSelectedCustomCalculation(value.row.original);\n setPropertyMenuView(PropertyMenuView.MODIFY_CUSTOM_CALCULATION);\n },\n [],\n );\n\n const groupPropertyReturn = useCallback(async (modified: boolean) => {\n setPropertyMenuView(PropertyMenuView.DEFAULT);\n modified && await refreshGroupProperties();\n }, [refreshGroupProperties]);\n\n const calculatedPropertyReturn = useCallback(async (modified: boolean) => {\n visualizeElements(resolvedHiliteIds, \"red\");\n await zoomToElements(resolvedHiliteIds);\n setPropertyMenuView(PropertyMenuView.DEFAULT);\n modified && await refreshCalculatedProperties();\n }, [resolvedHiliteIds, refreshCalculatedProperties]);\n\n const customCalculationReturn = useCallback(async (modified: boolean) => {\n setPropertyMenuView(PropertyMenuView.DEFAULT);\n modified && await refreshCustomCalculations();\n }, [refreshCustomCalculations]);\n\n if (isLoading) {\n return (\n <div className='gmw-loading-overlay'>\n <Text>Loading Group</Text>\n <ProgressRadial indeterminate />\n <Text>Please wait...</Text>\n </div>\n );\n }\n\n switch (propertyMenuView) {\n case PropertyMenuView.ADD_GROUP_PROPERTY:\n return (\n <GroupPropertyAction\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n keySet={keySet ?? new KeySet()}\n returnFn={groupPropertyReturn}\n />\n );\n case PropertyMenuView.MODIFY_GROUP_PROPERTY:\n return (\n <GroupPropertyAction\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n keySet={keySet ?? new KeySet()}\n groupPropertyId={selectedGroupProperty?.id ?? \"\"}\n groupPropertyName={selectedGroupProperty?.propertyName ?? \"\"}\n returnFn={groupPropertyReturn}\n />\n );\n case PropertyMenuView.ADD_CALCULATED_PROPERTY:\n return (\n <CalculatedPropertyAction\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n ids={resolvedHiliteIds}\n returnFn={calculatedPropertyReturn}\n />\n );\n case PropertyMenuView.MODIFY_CALCULATED_PROPERTY:\n return (\n <CalculatedPropertyAction\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n property={selectedCalculatedProperty}\n ids={resolvedHiliteIds}\n returnFn={calculatedPropertyReturn}\n />\n );\n case PropertyMenuView.ADD_CUSTOM_CALCULATION:\n return (\n <CustomCalculationAction\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n properties={convertToPropertyMap(groupProperties, calculatedProperties, customCalculations)}\n returnFn={customCalculationReturn}\n />\n );\n case PropertyMenuView.MODIFY_CUSTOM_CALCULATION:\n return (\n <CustomCalculationAction\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n properties={convertToPropertyMap(groupProperties, calculatedProperties, customCalculations, selectedCustomCalculation?.propertyName)}\n customCalculation={selectedCustomCalculation}\n returnFn={customCalculationReturn}\n />\n );\n default:\n return (\n <InformationPanelWrapper className='gmw-property-menu-wrapper'>\n <div className='gmw-property-header'>\n <WidgetHeader\n title={`${group.groupName}`}\n returnFn={goBack}\n />\n <IconButton\n styleType='borderless'\n onClick={() => setIsInformationPanelOpen(true)}\n >\n <SvgProperties />\n </IconButton>\n </div>\n <div className='gmw-property-menu-container'>\n {!hideGroupProps && (\n <div className='gmw-property-table'>\n <GroupPropertyTable\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n onGroupPropertyModify={onGroupPropertyModify}\n setSelectedGroupProperty={setSelectedGroupProperty}\n setGroupModifyView={setPropertyMenuView}\n isLoadingGroupProperties={isLoadingGroupProperties}\n groupProperties={groupProperties}\n refreshGroupProperties={refreshGroupProperties}\n selectedGroupProperty={selectedGroupProperty}\n />\n </div>\n )}\n\n {!hideCalculatedProps && (\n <div className='gmw-property-table'>\n <CalculatedPropertyTable\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n onCalculatedPropertyModify={onCalculatedPropertyModify}\n setSelectedCalculatedProperty={setSelectedCalculatedProperty}\n setGroupModifyView={setPropertyMenuView}\n isLoadingCalculatedProperties={isLoadingCalculatedProperties}\n calculatedProperties={calculatedProperties}\n refreshCalculatedProperties={refreshCalculatedProperties}\n selectedCalculatedProperty={selectedCalculatedProperty}\n />\n </div>\n )}\n {!hideCustomCalculationProps && (\n <div className='gmw-property-table'>\n <CustomCalculationTable\n iModelId={iModelId}\n mappingId={mappingId}\n groupId={groupId}\n onCustomCalculationModify={onCustomCalculationModify}\n setSelectedCustomCalculation={setSelectedCustomCalculation}\n setGroupModifyView={setPropertyMenuView}\n isLoadingCustomCalculations={isLoadingCustomCalculations}\n customCalculations={customCalculations}\n refreshCustomCalculations={refreshCustomCalculations}\n selectedCustomCalculation={selectedCustomCalculation}\n />\n </div>\n )}\n </div>\n <InformationPanel\n className='gmw-information-panel'\n isOpen={isInformationPanelOpen}\n >\n <InformationPanelHeader\n onClose={() => setIsInformationPanelOpen(false)}\n >\n <Text variant='subheading'>{`${group.groupName} Information`}</Text>\n </InformationPanelHeader>\n <InformationPanelBody>\n <div className='gmw-information-body'>\n <LabeledTextarea\n label='Query'\n rows={15}\n readOnly\n defaultValue={group.query}\n />\n </div>\n </InformationPanelBody>\n </InformationPanel>\n </InformationPanelWrapper>\n );\n }\n};\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { IMappingTyped } from "./Mapping";
|
|
3
3
|
import "./SelectMapping.scss";
|
|
4
4
|
interface SelectMappingsProps {
|
|
5
5
|
iModelId: string;
|
|
6
|
-
onSelect: (selectedMappings:
|
|
6
|
+
onSelect: (selectedMappings: IMappingTyped[]) => void;
|
|
7
7
|
onCancel: () => void;
|
|
8
8
|
backFn: () => void;
|
|
9
9
|
}
|
|
@@ -4,11 +4,11 @@ import { useMappingClient } from "./context/MappingClientContext";
|
|
|
4
4
|
import "./SelectMapping.scss";
|
|
5
5
|
import { handleError } from "./utils";
|
|
6
6
|
import { useGroupingMappingApiConfig } from "./context/GroupingApiConfigContext";
|
|
7
|
-
const fetchMappings = async (setMappings, iModelId, setIsLoading, getAccessToken,
|
|
7
|
+
const fetchMappings = async (setMappings, iModelId, setIsLoading, getAccessToken, mappingsClient) => {
|
|
8
8
|
try {
|
|
9
9
|
setIsLoading(true);
|
|
10
10
|
const accessToken = await getAccessToken();
|
|
11
|
-
const mappings = await
|
|
11
|
+
const mappings = await mappingsClient.getMappings(accessToken, iModelId);
|
|
12
12
|
setMappings(mappings);
|
|
13
13
|
}
|
|
14
14
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMappings.js","sourceRoot":"","sources":["../../../../src/widget/components/SelectMappings.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,MAAM,EACN,KAAK,EACL,YAAY,EACZ,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"SelectMappings.js","sourceRoot":"","sources":["../../../../src/widget/components/SelectMappings.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,MAAM,EACN,KAAK,EACL,YAAY,EACZ,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAEjF,MAAM,aAAa,GAAG,KAAK,EACzB,WAA4D,EAC5D,QAAgB,EAChB,YAA2D,EAC3D,cAAgC,EAChC,cAA+B,EAC/B,EAAE;IACF,IAAI;QACF,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,WAAW,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACzE,WAAW,CAAC,QAAQ,CAAC,CAAC;KACvB;IAAC,OAAO,KAAU,EAAE;QACnB,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KAC3B;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AC;IACrD,MAAM,SAAS,GAAG,WAAW,CAC3B,CAAC,KAAkC,EAAE,EAAE,CAAC,CACtC,oBAAC,cAAc,OAAK,KAAK,EAAE,YAAY,EAAE,YAAY,GAAI,CAC1D,EACD,CAAC,YAAY,CAAC,CACf,CAAC;IAEF,OAAO,CACL,6BAAK,SAAS,EAAC,8BAA8B;QAC3C,oBAAC,KAAK,IACJ,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,eAAe,EACxB,SAAS,EAAC,0BAA0B,EACpC,iBAAiB,EAAC,wBAAwB,EAC1C,UAAU,QACV,YAAY,QACZ,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,CAAC,UAAuC,EAAE,EAAE;gBACpD,UAAU,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC;YAChD,CAAC,EACD,iBAAiB,EAAE,SAAS,GAC5B;QACF,6BAAK,SAAS,EAAC,yBAAyB;YACtC,oBAAC,MAAM,IAAC,OAAO,EAAE,MAAM,WAAe;YACtC,oBAAC,MAAM,IACL,SAAS,EAAC,iBAAiB,EAC3B,OAAO,EAAE,GAAG,EAAE;oBACZ,QAAQ,CAAC,gBAAgB,CAAC,CAAC;gBAC7B,CAAC,EACD,QAAQ,EAAE,SAAS,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,WAG7C;YACT,oBAAC,MAAM,IAAC,OAAO,EAAE,QAAQ,aAAiB,CACtC,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type {\n TablePaginatorRendererProps,\n} from \"@itwin/itwinui-react\";\nimport {\n Button,\n Table,\n tableFilters,\n TablePaginator,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { IMappingsClient, Mapping } from \"@itwin/insights-client\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport type { IMappingTyped } from \"./Mapping\";\nimport \"./SelectMapping.scss\";\nimport { handleError } from \"./utils\";\nimport type { GetAccessTokenFn } from \"./context/GroupingApiConfigContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\n\nconst fetchMappings = async (\n setMappings: React.Dispatch<React.SetStateAction<Mapping[]>>,\n iModelId: string,\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>,\n getAccessToken: GetAccessTokenFn,\n mappingsClient: IMappingsClient\n) => {\n try {\n setIsLoading(true);\n const accessToken = await getAccessToken();\n const mappings = await mappingsClient.getMappings(accessToken, iModelId);\n setMappings(mappings);\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n};\n\ninterface SelectMappingsProps {\n iModelId: string;\n onSelect: (selectedMappings: IMappingTyped[]) => void;\n onCancel: () => void;\n backFn: () => void;\n}\n\nconst SelectMappings = ({\n iModelId,\n onSelect,\n onCancel,\n backFn,\n}: SelectMappingsProps) => {\n const { getAccessToken } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [selectedMappings, setSelectedMappings] = useState<IMappingTyped[]>([]);\n const [mappings, setMappings] = useState<Mapping[]>([]);\n\n useEffect(() => {\n void fetchMappings(setMappings, iModelId, setIsLoading, getAccessToken, mappingClient);\n }, [getAccessToken, mappingClient, iModelId, setIsLoading]);\n\n const mappingsColumns = useMemo(\n () => [\n {\n Header: \"Table\",\n columns: [\n {\n id: \"mappingName\",\n Header: \"Mapping Name\",\n accessor: \"mappingName\",\n Filter: tableFilters.TextFilter(),\n },\n {\n id: \"description\",\n Header: \"Description\",\n accessor: \"description\",\n Filter: tableFilters.TextFilter(),\n },\n ],\n },\n ],\n []\n );\n\n const pageSizeList = useMemo(() => [10, 25, 50], []);\n const paginator = useCallback(\n (props: TablePaginatorRendererProps) => (\n <TablePaginator {...props} pageSizeList={pageSizeList} />\n ),\n [pageSizeList]\n );\n\n return (\n <div className='gmw-select-mapping-container'>\n <Table<IMappingTyped>\n data={mappings}\n columns={mappingsColumns}\n className='gmw-select-mapping-table'\n emptyTableContent='No Mappings available.'\n isSortable\n isSelectable\n isLoading={isLoading}\n onSelect={(selectData: IMappingTyped[] | undefined) => {\n selectData && setSelectedMappings(selectData);\n }}\n paginatorRenderer={paginator}\n />\n <div className='gmw-import-action-panel'>\n <Button onClick={backFn}>Back</Button>\n <Button\n styleType='high-visibility'\n onClick={() => {\n onSelect(selectedMappings);\n }}\n disabled={isLoading || selectedMappings.length === 0}\n >\n Next\n </Button>\n <Button onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n );\n};\n\nexport default SelectMappings;\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { GroupingMappingCustomUI } from "../customUI/GroupingMappingCustomUI";
|
|
3
|
+
export declare const createGroupingMappingCustomUI: (customUIs: GroupingMappingCustomUI[] | undefined) => GroupingMappingCustomUI[];
|
|
4
|
+
export declare const GroupingMappingCustomUIContext: import("react").Context<GroupingMappingCustomUI[]>;
|
|
5
|
+
export declare const useGroupingMappingCustomUI: () => GroupingMappingCustomUI[];
|
|
6
|
+
//# sourceMappingURL=GroupingMappingCustomUIContext.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { createContext, useContext } from "react";
|
|
6
|
+
export const createGroupingMappingCustomUI = (customUIs) => {
|
|
7
|
+
if (undefined === customUIs) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
return customUIs;
|
|
11
|
+
};
|
|
12
|
+
export const GroupingMappingCustomUIContext = createContext([]);
|
|
13
|
+
export const useGroupingMappingCustomUI = () => {
|
|
14
|
+
const context = useContext(GroupingMappingCustomUIContext);
|
|
15
|
+
if (!context) {
|
|
16
|
+
throw new Error("useGroupingMappingCustomUI should be used within a GroupingMappingCustomUIContext provider");
|
|
17
|
+
}
|
|
18
|
+
return context;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=GroupingMappingCustomUIContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupingMappingCustomUIContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/GroupingMappingCustomUIContext.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGlD,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,SAAgD,EACrB,EAAE;IAC7B,IAAI,SAAS,KAAK,SAAS,EAAE;QAC3B,OAAO,EAAE,CAAC;KACX;IACD,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,aAAa,CAA4B,EAAE,CAAC,CAAC;AAE3F,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAG,EAAE;IAC7C,MAAM,OAAO,GAAG,UAAU,CAAC,8BAA8B,CAAC,CAAC;IAC3D,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,4FAA4F,CAC7F,CAAC;KACH;IACD,OAAO,OAAO,CAAC;AACjB,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 { createContext, useContext } from \"react\";\nimport type { GroupingMappingCustomUI } from \"../customUI/GroupingMappingCustomUI\";\n\nexport const createGroupingMappingCustomUI = (\n customUIs: GroupingMappingCustomUI[] | undefined,\n): GroupingMappingCustomUI[] => {\n if (undefined === customUIs) {\n return [];\n }\n return customUIs;\n};\n\nexport const GroupingMappingCustomUIContext = createContext<GroupingMappingCustomUI[]>([]);\n\nexport const useGroupingMappingCustomUI = () => {\n const context = useContext(GroupingMappingCustomUIContext);\n if (!context) {\n throw new Error(\n \"useGroupingMappingCustomUI should be used within a GroupingMappingCustomUIContext provider\",\n );\n }\n return context;\n};\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { IMappingsClient } from "@itwin/insights-client";
|
|
3
3
|
import type { ClientPrefix } from "./GroupingApiConfigContext";
|
|
4
|
-
export declare const createDefaultMappingClient: (prefix?: ClientPrefix) =>
|
|
5
|
-
export declare const createMappingClient: (clientProp:
|
|
6
|
-
export declare const MappingClientContext: import("react").Context<
|
|
7
|
-
export declare const useMappingClient: () =>
|
|
4
|
+
export declare const createDefaultMappingClient: (prefix?: ClientPrefix) => IMappingsClient;
|
|
5
|
+
export declare const createMappingClient: (clientProp: IMappingsClient | ClientPrefix) => IMappingsClient;
|
|
6
|
+
export declare const MappingClientContext: import("react").Context<IMappingsClient>;
|
|
7
|
+
export declare const useMappingClient: () => IMappingsClient;
|
|
8
8
|
//# sourceMappingURL=MappingClientContext.d.ts.map
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { REPORTING_BASE_PATH, ReportingClient } from "@itwin/insights-client";
|
|
1
|
+
import { MappingsClient, REPORTING_BASE_PATH } from "@itwin/insights-client";
|
|
6
2
|
import { createContext, useContext } from "react";
|
|
7
3
|
const prefixUrl = (baseUrl, prefix) => {
|
|
8
4
|
if (prefix && baseUrl) {
|
|
@@ -12,7 +8,7 @@ const prefixUrl = (baseUrl, prefix) => {
|
|
|
12
8
|
};
|
|
13
9
|
export const createDefaultMappingClient = (prefix) => {
|
|
14
10
|
const url = prefixUrl(REPORTING_BASE_PATH, prefix);
|
|
15
|
-
return new
|
|
11
|
+
return new MappingsClient(url);
|
|
16
12
|
};
|
|
17
13
|
export const createMappingClient = (clientProp) => {
|
|
18
14
|
if (undefined === clientProp || typeof clientProp === "string") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappingClientContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/MappingClientContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MappingClientContext.js","sourceRoot":"","sources":["../../../../../src/widget/components/context/MappingClientContext.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGlD,MAAM,SAAS,GAAG,CAAC,OAAgB,EAAE,MAAe,EAAE,EAAE;IACtD,IAAI,MAAM,IAAI,OAAO,EAAE;QACrB,OAAO,OAAO,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,MAAM,kBAAkB,CAAC,CAAC;KACxE;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,MAAqB,EAAmB,EAAE;IACnF,MAAM,GAAG,GAAG,SAAS,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;IACnD,OAAO,IAAI,cAAc,CAAC,GAAG,CAAC,CAAC;AACjC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,UAA0C,EAAE,EAAE;IAChF,IAAI,SAAS,KAAK,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAC9D,OAAO,0BAA0B,CAAC,UAA0B,CAAC,CAAC;KAC/D;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAkB,0BAA0B,EAAE,CAAC,CAAC;AAEjG,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,OAAO,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACjD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,wEAAwE,CACzE,CAAC;KACH;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { IMappingsClient} from \"@itwin/insights-client\";\nimport { MappingsClient, REPORTING_BASE_PATH } from \"@itwin/insights-client\";\nimport { createContext, useContext } from \"react\";\nimport type { ClientPrefix } from \"./GroupingApiConfigContext\";\n\nconst prefixUrl = (baseUrl?: string, prefix?: string) => {\n if (prefix && baseUrl) {\n return baseUrl.replace(\"api.bentley.com\", `${prefix}-api.bentley.com`);\n }\n return baseUrl;\n};\n\nexport const createDefaultMappingClient = (prefix?: ClientPrefix): IMappingsClient => {\n const url = prefixUrl(REPORTING_BASE_PATH, prefix);\n return new MappingsClient(url);\n};\n\nexport const createMappingClient = (clientProp: IMappingsClient | ClientPrefix) => {\n if (undefined === clientProp || typeof clientProp === \"string\") {\n return createDefaultMappingClient(clientProp as ClientPrefix);\n }\n return clientProp;\n};\nexport const MappingClientContext = createContext<IMappingsClient>(createDefaultMappingClient());\n\nexport const useMappingClient = () => {\n const context = useContext(MappingClientContext);\n if (!context) {\n throw new Error(\n \"useMappingClient should be used within a MappingClientContext provider\"\n );\n }\n return context;\n};\n"]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
export declare enum GroupingMappingCustomUIType {
|
|
3
|
+
Grouping = 0,
|
|
4
|
+
Context = 1
|
|
5
|
+
}
|
|
6
|
+
export declare type GroupingMappingCustomUI = GroupingCustomUI | ContextCustomUI;
|
|
7
|
+
/** Custom UI Definitions. */
|
|
8
|
+
export interface IGroupingMappingCustomUI {
|
|
9
|
+
/**
|
|
10
|
+
* See GroupingMappingCustomUIType.
|
|
11
|
+
*/
|
|
12
|
+
type: GroupingMappingCustomUIType;
|
|
13
|
+
/**
|
|
14
|
+
* Unique identifier of the custom UI.
|
|
15
|
+
*/
|
|
16
|
+
name: string;
|
|
17
|
+
/**
|
|
18
|
+
* Display label in the widget.
|
|
19
|
+
*/
|
|
20
|
+
displayLabel: string;
|
|
21
|
+
/**
|
|
22
|
+
* Optional icon, will be shown before display label in widget.
|
|
23
|
+
*/
|
|
24
|
+
icon?: ReactElement;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Context custom UI type definition.
|
|
28
|
+
*/
|
|
29
|
+
export interface ContextCustomUI extends IGroupingMappingCustomUI {
|
|
30
|
+
/**
|
|
31
|
+
* See GroupingMappingCustomUIType.
|
|
32
|
+
*/
|
|
33
|
+
type: GroupingMappingCustomUIType.Context;
|
|
34
|
+
/**
|
|
35
|
+
* User defined component for UI interaction with grouping mapping widget.
|
|
36
|
+
*/
|
|
37
|
+
uiComponent?: (props: ContextCustomUIProps) => JSX.Element;
|
|
38
|
+
/**
|
|
39
|
+
* Callback function for context custom UI menu item click event.
|
|
40
|
+
*/
|
|
41
|
+
onClick?: (groupId: string, mappingId: string, iModelId: string) => void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Group custom UI type definition.
|
|
45
|
+
*/
|
|
46
|
+
export interface GroupingCustomUI extends IGroupingMappingCustomUI {
|
|
47
|
+
/**
|
|
48
|
+
* See GroupingMappingCustomUIType.
|
|
49
|
+
*/
|
|
50
|
+
type: GroupingMappingCustomUIType.Grouping;
|
|
51
|
+
/**
|
|
52
|
+
* Custom UI Component to build query interactively. Refer to SearchGroupingCustomUI/ManualGroupingCustomUI.
|
|
53
|
+
*/
|
|
54
|
+
uiComponent: (props: GroupingCustomUIProps) => JSX.Element;
|
|
55
|
+
}
|
|
56
|
+
/** Custom UI Component props definitions. */
|
|
57
|
+
/**
|
|
58
|
+
* Context custom UI component arguments definition.
|
|
59
|
+
*/
|
|
60
|
+
export interface ContextCustomUIProps {
|
|
61
|
+
/**
|
|
62
|
+
* IModel Id.
|
|
63
|
+
*/
|
|
64
|
+
iModelId: string;
|
|
65
|
+
/**
|
|
66
|
+
* Mapping Id.
|
|
67
|
+
*/
|
|
68
|
+
mappingId: string;
|
|
69
|
+
/**
|
|
70
|
+
* Group Id.
|
|
71
|
+
*/
|
|
72
|
+
groupId: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Group custom UI component arguments definition.
|
|
76
|
+
*/
|
|
77
|
+
export interface GroupingCustomUIProps {
|
|
78
|
+
/**
|
|
79
|
+
* To validate and update current query.
|
|
80
|
+
*/
|
|
81
|
+
updateQuery: (query: string) => void;
|
|
82
|
+
/**
|
|
83
|
+
* To get the query loading status.
|
|
84
|
+
*/
|
|
85
|
+
isUpdating?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* To reset the viewer.
|
|
88
|
+
*/
|
|
89
|
+
resetView?: () => Promise<void>;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=GroupingMappingCustomUI.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export var GroupingMappingCustomUIType;
|
|
2
|
+
(function (GroupingMappingCustomUIType) {
|
|
3
|
+
GroupingMappingCustomUIType[GroupingMappingCustomUIType["Grouping"] = 0] = "Grouping";
|
|
4
|
+
GroupingMappingCustomUIType[GroupingMappingCustomUIType["Context"] = 1] = "Context";
|
|
5
|
+
})(GroupingMappingCustomUIType || (GroupingMappingCustomUIType = {}));
|
|
6
|
+
//# sourceMappingURL=GroupingMappingCustomUI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupingMappingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/GroupingMappingCustomUI.ts"],"names":[],"mappings":"AAMA,MAAM,CAAN,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACrC,qFAAQ,CAAA;IACR,mFAAO,CAAA;AACT,CAAC,EAHW,2BAA2B,KAA3B,2BAA2B,QAGtC","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 { ReactElement } from \"react\";\n\nexport enum GroupingMappingCustomUIType {\n Grouping,\n Context,\n}\n\nexport type GroupingMappingCustomUI = GroupingCustomUI | ContextCustomUI;\n\n/** Custom UI Definitions. */\n\nexport interface IGroupingMappingCustomUI {\n /**\n * See GroupingMappingCustomUIType.\n */\n type: GroupingMappingCustomUIType;\n /**\n * Unique identifier of the custom UI.\n */\n name: string;\n /**\n * Display label in the widget.\n */\n displayLabel: string;\n /**\n * Optional icon, will be shown before display label in widget.\n */\n icon?: ReactElement;\n}\n\n/**\n * Context custom UI type definition.\n */\nexport interface ContextCustomUI extends IGroupingMappingCustomUI {\n /**\n * See GroupingMappingCustomUIType.\n */\n type: GroupingMappingCustomUIType.Context;\n /**\n * User defined component for UI interaction with grouping mapping widget.\n */\n uiComponent?: (props: ContextCustomUIProps) => JSX.Element;\n /**\n * Callback function for context custom UI menu item click event.\n */\n onClick?: (groupId: string, mappingId: string, iModelId: string) => void;\n}\n\n/**\n * Group custom UI type definition.\n */\nexport interface GroupingCustomUI extends IGroupingMappingCustomUI {\n /**\n * See GroupingMappingCustomUIType.\n */\n type: GroupingMappingCustomUIType.Grouping;\n /**\n * Custom UI Component to build query interactively. Refer to SearchGroupingCustomUI/ManualGroupingCustomUI.\n */\n uiComponent: (props: GroupingCustomUIProps) => JSX.Element;\n}\n\n/** Custom UI Component props definitions. */\n\n/**\n * Context custom UI component arguments definition.\n */\nexport interface ContextCustomUIProps {\n /**\n * IModel Id.\n */\n iModelId: string;\n /**\n * Mapping Id.\n */\n mappingId: string;\n /**\n * Group Id.\n */\n groupId: string;\n}\n\n/**\n * Group custom UI component arguments definition.\n */\nexport interface GroupingCustomUIProps {\n /**\n * To validate and update current query.\n */\n updateQuery: (query: string) => void;\n /**\n * To get the query loading status.\n */\n isUpdating?: boolean;\n /**\n * To reset the viewer.\n */\n resetView?: () => Promise<void>;\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./ManualGroupingCustomUI.scss";
|
|
3
|
+
import type { GroupingCustomUIProps } from "./GroupingMappingCustomUI";
|
|
4
|
+
declare const ManualGroupingCustomUI: ({ updateQuery, isUpdating, resetView, }: GroupingCustomUIProps) => JSX.Element;
|
|
5
|
+
export default ManualGroupingCustomUI;
|
|
6
|
+
//# sourceMappingURL=ManualGroupingCustomUI.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { Button, LabeledTextarea, Text } from "@itwin/itwinui-react";
|
|
7
|
+
import { LoadingSpinner } from "../utils";
|
|
8
|
+
import "./ManualGroupingCustomUI.scss";
|
|
9
|
+
const ManualGroupingCustomUI = ({ updateQuery, isUpdating, resetView, }) => {
|
|
10
|
+
const [manualInput, setManualInput] = React.useState("");
|
|
11
|
+
return (React.createElement("div", { className: 'gmw-manual-form' },
|
|
12
|
+
React.createElement(Text, null, "Generate group using an ECSQL query. Please select ECInstanceId and ECClassId columns in the query."),
|
|
13
|
+
React.createElement(LabeledTextarea, { label: 'Query', required: true, value: manualInput, onChange: (event) => setManualInput(event.target.value), disabled: isUpdating, placeholder: `E.g. "SELECT ECInstanceId, ECClassId FROM BisCore:PhysicalElement"` }),
|
|
14
|
+
React.createElement("div", { className: 'gmw-manual-actions' },
|
|
15
|
+
isUpdating && React.createElement(LoadingSpinner, null),
|
|
16
|
+
React.createElement(Button, { disabled: isUpdating, onClick: () => updateQuery(manualInput) }, "Apply"),
|
|
17
|
+
React.createElement(Button, { disabled: isUpdating, onClick: async () => {
|
|
18
|
+
updateQuery("");
|
|
19
|
+
setManualInput("");
|
|
20
|
+
if (resetView) {
|
|
21
|
+
await resetView();
|
|
22
|
+
}
|
|
23
|
+
} }, "Clear"))));
|
|
24
|
+
};
|
|
25
|
+
export default ManualGroupingCustomUI;
|
|
26
|
+
//# sourceMappingURL=ManualGroupingCustomUI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ManualGroupingCustomUI.js","sourceRoot":"","sources":["../../../../../src/widget/components/customUI/ManualGroupingCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,+BAA+B,CAAC;AAGvC,MAAM,sBAAsB,GAAG,CAAC,EAC9B,WAAW,EACX,UAAU,EACV,SAAS,GACa,EAAE,EAAE;IAC1B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEzD,OAAO,CACL,6BAAK,SAAS,EAAC,iBAAiB;QAC9B,oBAAC,IAAI,8GAEE;QACP,oBAAC,eAAe,IACd,KAAK,EAAC,OAAO,EACb,QAAQ,QACR,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACvD,QAAQ,EAAE,UAAU,EACpB,WAAW,EAAE,oEAAoE,GACjF;QACF,6BAAK,SAAS,EAAC,oBAAoB;YAChC,UAAU,IAAI,oBAAC,cAAc,OAAG;YACjC,oBAAC,MAAM,IAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,YAE5D;YACT,oBAAC,MAAM,IACL,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,KAAK,IAAI,EAAE;oBAClB,WAAW,CAAC,EAAE,CAAC,CAAC;oBAChB,cAAc,CAAC,EAAE,CAAC,CAAC;oBACnB,IAAI,SAAS,EAAE;wBACb,MAAM,SAAS,EAAE,CAAC;qBACnB;gBACH,CAAC,YAGM,CACL,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,sBAAsB,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 { Button, LabeledTextarea, Text } from \"@itwin/itwinui-react\";\nimport { LoadingSpinner } from \"../utils\";\nimport \"./ManualGroupingCustomUI.scss\";\nimport type { GroupingCustomUIProps } from \"./GroupingMappingCustomUI\";\n\nconst ManualGroupingCustomUI = ({\n updateQuery,\n isUpdating,\n resetView,\n}: GroupingCustomUIProps) => {\n const [manualInput, setManualInput] = React.useState(\"\");\n\n return (\n <div className='gmw-manual-form'>\n <Text>\n Generate group using an ECSQL query. Please select ECInstanceId and ECClassId columns in the query.\n </Text>\n <LabeledTextarea\n label='Query'\n required\n value={manualInput}\n onChange={(event) => setManualInput(event.target.value)}\n disabled={isUpdating}\n placeholder={`E.g. \"SELECT ECInstanceId, ECClassId FROM BisCore:PhysicalElement\"`}\n />\n <div className='gmw-manual-actions'>\n {isUpdating && <LoadingSpinner />}\n <Button disabled={isUpdating} onClick={() => updateQuery(manualInput)}>\n Apply\n </Button>\n <Button\n disabled={isUpdating}\n onClick={async () => {\n updateQuery(\"\");\n setManualInput(\"\");\n if (resetView) {\n await resetView();\n }\n }}\n >\n Clear\n </Button>\n </div>\n </div>\n );\n};\n\nexport default ManualGroupingCustomUI;\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
@import "~@itwin/itwinui-css/scss/variables";
|
|
6
|
+
|
|
7
|
+
.gmw-manual-form {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: $iui-baseline;
|
|
11
|
+
margin-top: $iui-baseline;
|
|
12
|
+
> .gmw-manual-actions {
|
|
13
|
+
display: flex;
|
|
14
|
+
justify-content: flex-end;
|
|
15
|
+
gap: $iui-s;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { GroupingCustomUIProps } from "./GroupingMappingCustomUI";
|
|
3
|
+
import "./SearchGroupingCustomUI.scss";
|
|
4
|
+
declare const SearchGroupingCustomUI: ({ updateQuery, isUpdating, resetView, }: GroupingCustomUIProps) => JSX.Element;
|
|
5
|
+
export default SearchGroupingCustomUI;
|
|
6
|
+
//# sourceMappingURL=SearchGroupingCustomUI.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { Button, LabeledTextarea, Text } from "@itwin/itwinui-react";
|
|
7
|
+
import { LoadingSpinner } from "../utils";
|
|
8
|
+
import "./SearchGroupingCustomUI.scss";
|
|
9
|
+
const SearchGroupingCustomUI = ({ updateQuery, isUpdating, resetView, }) => {
|
|
10
|
+
const [searchInput, setSearchInput] = React.useState("");
|
|
11
|
+
const isWrappedInQuotes = (text) => {
|
|
12
|
+
return text.startsWith(`"`) && text.endsWith(`"`);
|
|
13
|
+
};
|
|
14
|
+
const needsAndOperator = (token, index, searchQuery) => isWrappedInQuotes(token) ||
|
|
15
|
+
(index === 1 && isWrappedInQuotes(searchQuery[0]));
|
|
16
|
+
const generateSearchQuery = (searchQuery) => {
|
|
17
|
+
if (searchQuery.length === 0) {
|
|
18
|
+
updateQuery("");
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
let generatedSearchQuery = `SELECT be.ECInstanceId, be.ECClassId FROM bis.geometricelement3d be `;
|
|
22
|
+
generatedSearchQuery += `LEFT JOIN bis.SpatialCategory cat ON be.Category.Id = cat.ECInstanceID LEFT JOIN ecdbmeta.ECClassDef ecc ON be.ECClassId = ecc.ECInstanceId `;
|
|
23
|
+
generatedSearchQuery += `LEFT JOIN bis.PhysicalType pt ON be.TypeDefinition.Id = pt.ECInstanceID`;
|
|
24
|
+
generatedSearchQuery += ` WHERE `;
|
|
25
|
+
generatedSearchQuery += `((${searchQuery
|
|
26
|
+
.map((token, index) => `${index === 0
|
|
27
|
+
? ""
|
|
28
|
+
: needsAndOperator(token, index, searchQuery)
|
|
29
|
+
? "AND"
|
|
30
|
+
: "OR"} be.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token}%'`)
|
|
31
|
+
.join(" ")}) OR (${searchQuery
|
|
32
|
+
.map((token, index) => `${index === 0
|
|
33
|
+
? ""
|
|
34
|
+
: needsAndOperator(token, index, searchQuery)
|
|
35
|
+
? "AND"
|
|
36
|
+
: "OR"} be.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token}%'`)
|
|
37
|
+
.join(" ")})) OR ((${searchQuery
|
|
38
|
+
.map((token, index) => `${index === 0
|
|
39
|
+
? ""
|
|
40
|
+
: needsAndOperator(token, index, searchQuery)
|
|
41
|
+
? "AND"
|
|
42
|
+
: "OR"} cat.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token}%'`)
|
|
43
|
+
.join(" ")}) OR (${searchQuery
|
|
44
|
+
.map((token, index) => `${index === 0
|
|
45
|
+
? ""
|
|
46
|
+
: needsAndOperator(token, index, searchQuery)
|
|
47
|
+
? "AND"
|
|
48
|
+
: "OR"} cat.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token}%'`)
|
|
49
|
+
.join(" ")})) OR (${searchQuery
|
|
50
|
+
.map((token, index) => `${index === 0
|
|
51
|
+
? ""
|
|
52
|
+
: needsAndOperator(token, index, searchQuery)
|
|
53
|
+
? "AND"
|
|
54
|
+
: "OR"} ecc.name LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token}%'`)
|
|
55
|
+
.join(" ")})`;
|
|
56
|
+
// Physical Types
|
|
57
|
+
generatedSearchQuery += ` OR ((${searchQuery
|
|
58
|
+
.map((token, index) => `${index === 0
|
|
59
|
+
? ""
|
|
60
|
+
: needsAndOperator(token, index, searchQuery)
|
|
61
|
+
? "AND"
|
|
62
|
+
: "OR"} pt.codevalue LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token}%'`)
|
|
63
|
+
.join(" ")}) OR (${searchQuery
|
|
64
|
+
.map((token, index) => `${index === 0
|
|
65
|
+
? ""
|
|
66
|
+
: needsAndOperator(token, index, searchQuery)
|
|
67
|
+
? "AND"
|
|
68
|
+
: "OR"} pt.userlabel LIKE '%${isWrappedInQuotes(token) ? token.slice(1, -1) : token}%'`)
|
|
69
|
+
.join(" ")})) `;
|
|
70
|
+
updateQuery(generatedSearchQuery);
|
|
71
|
+
};
|
|
72
|
+
return (React.createElement("div", { className: 'gmw-search-form' },
|
|
73
|
+
React.createElement(Text, null, "Generate a query by keywords. Keywords wrapped in double quotes will be considered a required criteria."),
|
|
74
|
+
React.createElement(LabeledTextarea, { label: 'Query Keywords', required: true, value: searchInput, onChange: (event) => setSearchInput(event.target.value), disabled: isUpdating, placeholder: `E.g. "red" chair` }),
|
|
75
|
+
React.createElement("div", { className: 'gmw-search-actions' },
|
|
76
|
+
isUpdating && React.createElement(LoadingSpinner, null),
|
|
77
|
+
React.createElement(Button, { disabled: isUpdating, onClick: () => generateSearchQuery(searchInput
|
|
78
|
+
? searchInput
|
|
79
|
+
.replace(/(\r\n|\n|\r)/gm, "")
|
|
80
|
+
.trim()
|
|
81
|
+
.split(" ")
|
|
82
|
+
: []) }, "Apply"),
|
|
83
|
+
React.createElement(Button, { disabled: isUpdating, onClick: async () => {
|
|
84
|
+
updateQuery("");
|
|
85
|
+
setSearchInput("");
|
|
86
|
+
if (resetView) {
|
|
87
|
+
await resetView();
|
|
88
|
+
}
|
|
89
|
+
} }, "Clear"))));
|
|
90
|
+
};
|
|
91
|
+
export default SearchGroupingCustomUI;
|
|
92
|
+
//# sourceMappingURL=SearchGroupingCustomUI.js.map
|