@itwin/grouping-mapping-widget 0.23.1 → 0.25.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/GroupingMappingContent.js +2 -2
- package/lib/cjs/WidgetShell/GroupingMappingContent.js.map +1 -1
- package/lib/cjs/common/hooks/useIsMounted.d.ts +2 -1
- package/lib/cjs/common/hooks/useIsMounted.js +3 -3
- package/lib/cjs/common/hooks/useIsMounted.js.map +1 -1
- package/lib/cjs/components/Constants.d.ts +3 -0
- package/lib/cjs/components/Constants.js +5 -2
- package/lib/cjs/components/Constants.js.map +1 -1
- package/lib/cjs/components/GroupingMappingContext.js +12 -14
- package/lib/cjs/components/GroupingMappingContext.js.map +1 -1
- package/lib/cjs/components/Groups/{GroupItem.d.ts → GroupListItem.d.ts} +4 -3
- package/lib/cjs/components/Groups/GroupListItem.js +49 -0
- package/lib/cjs/components/Groups/GroupListItem.js.map +1 -0
- package/lib/cjs/components/Groups/GroupListItem.scss +13 -0
- package/lib/cjs/components/Groups/GroupsView.js +2 -2
- package/lib/cjs/components/Groups/GroupsView.js.map +1 -1
- package/lib/cjs/components/Groups/GroupsVisualization.js +33 -11
- package/lib/cjs/components/Groups/GroupsVisualization.js.map +1 -1
- package/lib/cjs/components/Groups/groupsHelpers.d.ts +1 -1
- package/lib/cjs/components/Groups/groupsHelpers.js +1 -1
- package/lib/cjs/components/Groups/groupsHelpers.js.map +1 -1
- package/lib/cjs/components/Groups/hooks/useKeySetHiliteQueries.d.ts +2 -2
- package/lib/cjs/components/Groups/hooks/useKeySetHiliteQueries.js.map +1 -1
- package/lib/cjs/components/Mappings/Extraction/ExtractionMessageModal.js +27 -18
- package/lib/cjs/components/Mappings/Extraction/ExtractionMessageModal.js.map +1 -1
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.d.ts +3 -0
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.js +17 -0
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.js.map +1 -0
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.d.ts +3 -0
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.js +16 -0
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.js.map +1 -0
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.d.ts +3 -0
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.js +17 -0
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.js.map +1 -0
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.d.ts +9 -0
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.js +21 -0
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.js.map +1 -0
- package/lib/cjs/components/Mappings/Extraction/ExtractionStatus.d.ts +17 -0
- package/lib/cjs/components/Mappings/Extraction/ExtractionStatus.js +79 -0
- package/lib/cjs/components/Mappings/Extraction/ExtractionStatus.js.map +1 -0
- package/lib/cjs/components/Mappings/Extraction/ExtractionStatus.scss +40 -0
- package/lib/cjs/components/Mappings/MappingListItem.d.ts +20 -0
- package/lib/cjs/components/Mappings/MappingListItem.js +96 -0
- package/lib/cjs/components/Mappings/MappingListItem.js.map +1 -0
- package/lib/cjs/components/Mappings/MappingListItem.scss +13 -0
- package/lib/cjs/components/Mappings/MappingViewActionGroup.d.ts +1 -1
- package/lib/cjs/components/Mappings/MappingViewActionGroup.js +3 -3
- package/lib/cjs/components/Mappings/MappingViewActionGroup.js.map +1 -1
- package/lib/cjs/components/Mappings/MappingsView.d.ts +2 -0
- package/lib/cjs/components/Mappings/MappingsView.js +28 -4
- package/lib/cjs/components/Mappings/MappingsView.js.map +1 -1
- package/lib/cjs/components/Mappings/MappingsView.scss +0 -5
- package/lib/cjs/components/Mappings/hooks/useFetchExtractionStatus.d.ts +3 -1
- package/lib/cjs/components/Mappings/hooks/useFetchExtractionStatus.js +7 -4
- package/lib/cjs/components/Mappings/hooks/useFetchExtractionStatus.js.map +1 -1
- package/lib/cjs/components/Mappings/hooks/useFetchMappingExtractionStatus.d.ts +20 -0
- package/lib/cjs/components/Mappings/hooks/useFetchMappingExtractionStatus.js +55 -0
- package/lib/cjs/components/Mappings/hooks/useFetchMappingExtractionStatus.js.map +1 -0
- package/lib/cjs/components/Mappings/hooks/useMappingsOperations.d.ts +8 -0
- package/lib/cjs/components/Mappings/hooks/useMappingsOperations.js +29 -5
- package/lib/cjs/components/Mappings/hooks/useMappingsOperations.js.map +1 -1
- package/lib/cjs/components/Mappings/hooks/useRunExtraction.d.ts +14 -0
- package/lib/cjs/components/Mappings/hooks/useRunExtraction.js +42 -0
- package/lib/cjs/components/Mappings/hooks/useRunExtraction.js.map +1 -0
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.js +17 -25
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.js.map +1 -1
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js +18 -25
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js.map +1 -1
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.js +35 -38
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.js.map +1 -1
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.js +28 -59
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.js.map +1 -1
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.js +37 -40
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.js.map +1 -1
- package/lib/cjs/components/Properties/GroupColorToggle.js +30 -26
- package/lib/cjs/components/Properties/GroupColorToggle.js.map +1 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js +62 -167
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.scss +1 -46
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyListItem.d.ts +13 -0
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyListItem.js +21 -0
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyListItem.js.map +1 -0
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyListItem.scss +14 -0
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.js +34 -37
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.js.map +1 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyUtils.js +65 -51
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyUtils.js.map +1 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.d.ts +12 -0
- package/lib/cjs/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js +147 -0
- package/lib/cjs/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js.map +1 -0
- package/lib/cjs/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.scss +49 -0
- package/lib/cjs/components/Properties/GroupProperties/SortableHorizontalTile.d.ts +4 -4
- package/lib/cjs/components/Properties/GroupProperties/SortableHorizontalTile.js +4 -3
- package/lib/cjs/components/Properties/GroupProperties/SortableHorizontalTile.js.map +1 -1
- package/lib/cjs/components/Properties/PropertyMenu.js +11 -15
- package/lib/cjs/components/Properties/PropertyMenu.js.map +1 -1
- package/lib/cjs/components/Properties/PropertyTable.js +1 -1
- package/lib/cjs/components/Properties/PropertyTable.js.map +1 -1
- package/lib/cjs/components/Properties/hooks/useCalculatedPropertiesQuery.d.ts +4 -0
- package/lib/cjs/components/Properties/hooks/useCalculatedPropertiesQuery.js +12 -0
- package/lib/cjs/components/Properties/hooks/useCalculatedPropertiesQuery.js.map +1 -0
- package/lib/cjs/components/Properties/hooks/useCustomCalculationsQuery.d.ts +4 -0
- package/lib/cjs/components/Properties/hooks/useCustomCalculationsQuery.js +12 -0
- package/lib/cjs/components/Properties/hooks/useCustomCalculationsQuery.js.map +1 -0
- package/lib/cjs/components/Properties/hooks/useGroupPropertiesQuery.d.ts +4 -0
- package/lib/cjs/components/Properties/hooks/useGroupPropertiesQuery.js +12 -0
- package/lib/cjs/components/Properties/hooks/useGroupPropertiesQuery.js.map +1 -0
- package/lib/cjs/components/SharedComponents/DeleteModal.d.ts +1 -2
- package/lib/cjs/components/SharedComponents/DeleteModal.js +1 -2
- package/lib/cjs/components/SharedComponents/DeleteModal.js.map +1 -1
- package/lib/cjs/components/context/ExtractionStateJobContext.d.ts +8 -0
- package/lib/cjs/components/context/ExtractionStateJobContext.js +44 -0
- package/lib/cjs/components/context/ExtractionStateJobContext.js.map +1 -0
- package/lib/cjs/components/context/PropertiesGroupColorContext.d.ts +8 -0
- package/lib/cjs/components/context/{PropertiesContext.js → PropertiesGroupColorContext.js} +7 -10
- package/lib/cjs/components/context/PropertiesGroupColorContext.js.map +1 -0
- package/lib/cjs/test/GroupingMappingCustomUI.test.js +3 -3
- package/lib/cjs/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/lib/esm/WidgetShell/GroupingMappingContent.js +2 -2
- package/lib/esm/WidgetShell/GroupingMappingContent.js.map +1 -1
- package/lib/esm/common/hooks/useIsMounted.d.ts +2 -1
- package/lib/esm/common/hooks/useIsMounted.js +4 -4
- package/lib/esm/common/hooks/useIsMounted.js.map +1 -1
- package/lib/esm/components/Constants.d.ts +3 -0
- package/lib/esm/components/Constants.js +3 -0
- package/lib/esm/components/Constants.js.map +1 -1
- package/lib/esm/components/GroupingMappingContext.js +12 -14
- package/lib/esm/components/GroupingMappingContext.js.map +1 -1
- package/lib/esm/components/Groups/{GroupItem.d.ts → GroupListItem.d.ts} +4 -3
- package/lib/esm/components/Groups/GroupListItem.js +22 -0
- package/lib/esm/components/Groups/GroupListItem.js.map +1 -0
- package/lib/esm/components/Groups/GroupListItem.scss +13 -0
- package/lib/esm/components/Groups/GroupsView.js +3 -3
- package/lib/esm/components/Groups/GroupsView.js.map +1 -1
- package/lib/esm/components/Groups/GroupsVisualization.js +33 -11
- package/lib/esm/components/Groups/GroupsVisualization.js.map +1 -1
- package/lib/esm/components/Groups/groupsHelpers.d.ts +1 -1
- package/lib/esm/components/Groups/groupsHelpers.js +1 -1
- package/lib/esm/components/Groups/groupsHelpers.js.map +1 -1
- package/lib/esm/components/Groups/hooks/useKeySetHiliteQueries.d.ts +2 -2
- package/lib/esm/components/Groups/hooks/useKeySetHiliteQueries.js.map +1 -1
- package/lib/esm/components/Mappings/Extraction/ExtractionMessageModal.js +27 -18
- package/lib/esm/components/Mappings/Extraction/ExtractionMessageModal.js.map +1 -1
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.d.ts +3 -0
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.js +10 -0
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.js.map +1 -0
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.d.ts +3 -0
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.js +9 -0
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.js.map +1 -0
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.d.ts +3 -0
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.js +10 -0
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.js.map +1 -0
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.d.ts +9 -0
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.js +14 -0
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.js.map +1 -0
- package/lib/esm/components/Mappings/Extraction/ExtractionStatus.d.ts +17 -0
- package/lib/esm/components/Mappings/Extraction/ExtractionStatus.js +52 -0
- package/lib/esm/components/Mappings/Extraction/ExtractionStatus.js.map +1 -0
- package/lib/esm/components/Mappings/Extraction/ExtractionStatus.scss +40 -0
- package/lib/esm/components/Mappings/MappingListItem.d.ts +20 -0
- package/lib/esm/components/Mappings/MappingListItem.js +69 -0
- package/lib/esm/components/Mappings/MappingListItem.js.map +1 -0
- package/lib/esm/components/Mappings/MappingListItem.scss +13 -0
- package/lib/esm/components/Mappings/MappingViewActionGroup.d.ts +1 -1
- package/lib/esm/components/Mappings/MappingViewActionGroup.js +1 -1
- package/lib/esm/components/Mappings/MappingViewActionGroup.js.map +1 -1
- package/lib/esm/components/Mappings/MappingsView.d.ts +2 -0
- package/lib/esm/components/Mappings/MappingsView.js +31 -7
- package/lib/esm/components/Mappings/MappingsView.js.map +1 -1
- package/lib/esm/components/Mappings/MappingsView.scss +0 -5
- package/lib/esm/components/Mappings/hooks/useFetchExtractionStatus.d.ts +3 -1
- package/lib/esm/components/Mappings/hooks/useFetchExtractionStatus.js +7 -4
- package/lib/esm/components/Mappings/hooks/useFetchExtractionStatus.js.map +1 -1
- package/lib/esm/components/Mappings/hooks/useFetchMappingExtractionStatus.d.ts +20 -0
- package/lib/esm/components/Mappings/hooks/useFetchMappingExtractionStatus.js +49 -0
- package/lib/esm/components/Mappings/hooks/useFetchMappingExtractionStatus.js.map +1 -0
- package/lib/esm/components/Mappings/hooks/useMappingsOperations.d.ts +8 -0
- package/lib/esm/components/Mappings/hooks/useMappingsOperations.js +30 -6
- package/lib/esm/components/Mappings/hooks/useMappingsOperations.js.map +1 -1
- package/lib/esm/components/Mappings/hooks/useRunExtraction.d.ts +14 -0
- package/lib/esm/components/Mappings/hooks/useRunExtraction.js +38 -0
- package/lib/esm/components/Mappings/hooks/useRunExtraction.js.map +1 -0
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.js +17 -25
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.js.map +1 -1
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js +18 -25
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js.map +1 -1
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.js +35 -38
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.js.map +1 -1
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.js +29 -60
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.js.map +1 -1
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.js +37 -40
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.js.map +1 -1
- package/lib/esm/components/Properties/GroupColorToggle.js +32 -28
- package/lib/esm/components/Properties/GroupColorToggle.js.map +1 -1
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js +64 -169
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.scss +1 -46
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyListItem.d.ts +13 -0
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyListItem.js +14 -0
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyListItem.js.map +1 -0
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyListItem.scss +14 -0
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.js +34 -37
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.js.map +1 -1
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyUtils.js +65 -51
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyUtils.js.map +1 -1
- package/lib/esm/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.d.ts +12 -0
- package/lib/esm/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js +117 -0
- package/lib/esm/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js.map +1 -0
- package/lib/esm/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.scss +49 -0
- package/lib/esm/components/Properties/GroupProperties/SortableHorizontalTile.d.ts +4 -4
- package/lib/esm/components/Properties/GroupProperties/SortableHorizontalTile.js +3 -4
- package/lib/esm/components/Properties/GroupProperties/SortableHorizontalTile.js.map +1 -1
- package/lib/esm/components/Properties/PropertyMenu.js +12 -16
- package/lib/esm/components/Properties/PropertyMenu.js.map +1 -1
- package/lib/esm/components/Properties/PropertyTable.js +1 -1
- package/lib/esm/components/Properties/PropertyTable.js.map +1 -1
- package/lib/esm/components/Properties/hooks/useCalculatedPropertiesQuery.d.ts +4 -0
- package/lib/esm/components/Properties/hooks/useCalculatedPropertiesQuery.js +8 -0
- package/lib/esm/components/Properties/hooks/useCalculatedPropertiesQuery.js.map +1 -0
- package/lib/esm/components/Properties/hooks/useCustomCalculationsQuery.d.ts +4 -0
- package/lib/esm/components/Properties/hooks/useCustomCalculationsQuery.js +8 -0
- package/lib/esm/components/Properties/hooks/useCustomCalculationsQuery.js.map +1 -0
- package/lib/esm/components/Properties/hooks/useGroupPropertiesQuery.d.ts +4 -0
- package/lib/esm/components/Properties/hooks/useGroupPropertiesQuery.js +8 -0
- package/lib/esm/components/Properties/hooks/useGroupPropertiesQuery.js.map +1 -0
- package/lib/esm/components/SharedComponents/DeleteModal.d.ts +1 -2
- package/lib/esm/components/SharedComponents/DeleteModal.js +1 -2
- package/lib/esm/components/SharedComponents/DeleteModal.js.map +1 -1
- package/lib/esm/components/context/ExtractionStateJobContext.d.ts +8 -0
- package/lib/esm/components/context/ExtractionStateJobContext.js +17 -0
- package/lib/esm/components/context/ExtractionStateJobContext.js.map +1 -0
- package/lib/esm/components/context/PropertiesGroupColorContext.d.ts +8 -0
- package/lib/esm/components/context/{PropertiesContext.js → PropertiesGroupColorContext.js} +5 -8
- package/lib/esm/components/context/PropertiesGroupColorContext.js.map +1 -0
- package/lib/esm/test/GroupingMappingCustomUI.test.js +3 -3
- package/lib/esm/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/package.json +3 -2
- package/lib/cjs/components/Groups/GroupItem.js +0 -23
- package/lib/cjs/components/Groups/GroupItem.js.map +0 -1
- package/lib/cjs/components/Properties/hooks/useFetchData.d.ts +0 -7
- package/lib/cjs/components/Properties/hooks/useFetchData.js +0 -43
- package/lib/cjs/components/Properties/hooks/useFetchData.js.map +0 -1
- package/lib/cjs/components/SharedComponents/HorizontalTile.d.ts +0 -19
- package/lib/cjs/components/SharedComponents/HorizontalTile.js +0 -27
- package/lib/cjs/components/SharedComponents/HorizontalTile.js.map +0 -1
- package/lib/cjs/components/SharedComponents/HorizontalTile.scss +0 -58
- package/lib/cjs/components/context/PropertiesContext.d.ts +0 -15
- package/lib/cjs/components/context/PropertiesContext.js.map +0 -1
- package/lib/esm/components/Groups/GroupItem.js +0 -16
- package/lib/esm/components/Groups/GroupItem.js.map +0 -1
- package/lib/esm/components/Properties/hooks/useFetchData.d.ts +0 -7
- package/lib/esm/components/Properties/hooks/useFetchData.js +0 -37
- package/lib/esm/components/Properties/hooks/useFetchData.js.map +0 -1
- package/lib/esm/components/SharedComponents/HorizontalTile.d.ts +0 -19
- package/lib/esm/components/SharedComponents/HorizontalTile.js +0 -20
- package/lib/esm/components/SharedComponents/HorizontalTile.js.map +0 -1
- package/lib/esm/components/SharedComponents/HorizontalTile.scss +0 -58
- package/lib/esm/components/context/PropertiesContext.d.ts +0 -15
- package/lib/esm/components/context/PropertiesContext.js.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useCustomCalculationsQuery = void 0;
|
|
4
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
+
const useCustomCalculationsQuery = (iModelId, mappingId, groupId, getAccessToken, mappingsClient) => {
|
|
6
|
+
return (0, react_query_1.useQuery)({
|
|
7
|
+
queryKey: ["customCalculations", iModelId, mappingId, groupId],
|
|
8
|
+
queryFn: async () => mappingsClient.getCustomCalculations(await getAccessToken(), iModelId, mappingId, groupId),
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
exports.useCustomCalculationsQuery = useCustomCalculationsQuery;
|
|
12
|
+
//# sourceMappingURL=useCustomCalculationsQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCustomCalculationsQuery.js","sourceRoot":"","sources":["../../../../../src/components/Properties/hooks/useCustomCalculationsQuery.ts"],"names":[],"mappings":";;;AAKA,uDAAiD;AAG1C,MAAM,0BAA0B,GAAG,CAAC,QAAgB,EAAE,SAAiB,EAAE,OAAe,EAAE,cAAgC,EAAE,cAA+B,EAAE,EAAE;IACpK,OAAO,IAAA,sBAAQ,EAAC;QACd,QAAQ,EAAE,CAAC,oBAAoB,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;QAC9D,OAAO,EAAG,KAAK,IAAI,EAAE,CAAC,cAAc,CAAC,qBAAqB,CAAC,MAAM,cAAc,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;KACjH,CAAC,CAAC;AACL,CAAC,CAAC;AALW,QAAA,0BAA0B,8BAKrC","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 { useQuery } from \"@tanstack/react-query\";\nimport type { GetAccessTokenFn } from \"../../context/GroupingApiConfigContext\";\n\nexport const useCustomCalculationsQuery = (iModelId: string, mappingId: string, groupId: string, getAccessToken: GetAccessTokenFn, mappingsClient: IMappingsClient) => {\n return useQuery({\n queryKey: [\"customCalculations\", iModelId, mappingId, groupId],\n queryFn: async () => mappingsClient.getCustomCalculations(await getAccessToken(), iModelId, mappingId, groupId),\n });\n};\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IMappingsClient } from "@itwin/insights-client";
|
|
2
|
+
import type { GetAccessTokenFn } from "../../context/GroupingApiConfigContext";
|
|
3
|
+
export declare const useGroupPropertiesQuery: (iModelId: string, mappingId: string, groupId: string, getAccessToken: GetAccessTokenFn, mappingsClient: IMappingsClient) => import("@tanstack/react-query").UseQueryResult<import("@itwin/insights-client").GroupProperty[], unknown>;
|
|
4
|
+
//# sourceMappingURL=useGroupPropertiesQuery.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGroupPropertiesQuery = void 0;
|
|
4
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
+
const useGroupPropertiesQuery = (iModelId, mappingId, groupId, getAccessToken, mappingsClient) => {
|
|
6
|
+
return (0, react_query_1.useQuery)({
|
|
7
|
+
queryKey: ["groupProperties", iModelId, mappingId, groupId],
|
|
8
|
+
queryFn: async () => mappingsClient.getGroupProperties(await getAccessToken(), iModelId, mappingId, groupId),
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
exports.useGroupPropertiesQuery = useGroupPropertiesQuery;
|
|
12
|
+
//# sourceMappingURL=useGroupPropertiesQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGroupPropertiesQuery.js","sourceRoot":"","sources":["../../../../../src/components/Properties/hooks/useGroupPropertiesQuery.ts"],"names":[],"mappings":";;;AAKA,uDAAiD;AAG1C,MAAM,uBAAuB,GAAG,CAAC,QAAgB,EAAE,SAAiB,EAAE,OAAe,EAAE,cAAgC,EAAE,cAA+B,EAAE,EAAE;IACjK,OAAO,IAAA,sBAAQ,EAAC;QACd,QAAQ,EAAE,CAAC,iBAAiB,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;QAC3D,OAAO,EAAG,KAAK,IAAI,EAAE,CAAC,cAAc,CAAC,kBAAkB,CAAC,MAAM,cAAc,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC;KAC9G,CAAC,CAAC;AACL,CAAC,CAAC;AALW,QAAA,uBAAuB,2BAKlC","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 { useQuery } from \"@tanstack/react-query\";\nimport type { GetAccessTokenFn } from \"../../context/GroupingApiConfigContext\";\n\nexport const useGroupPropertiesQuery = (iModelId: string, mappingId: string, groupId: string, getAccessToken: GetAccessTokenFn, mappingsClient: IMappingsClient) => {\n return useQuery({\n queryKey: [\"groupProperties\", iModelId, mappingId, groupId],\n queryFn: async () => mappingsClient.getGroupProperties(await getAccessToken(), iModelId, mappingId, groupId),\n });\n};\n"]}
|
|
@@ -4,8 +4,7 @@ export interface DeleteModalProps {
|
|
|
4
4
|
entityName: string;
|
|
5
5
|
onClose: () => void;
|
|
6
6
|
onDelete: () => Promise<void>;
|
|
7
|
-
refresh?: () => Promise<void>;
|
|
8
7
|
}
|
|
9
|
-
export declare const DeleteModal: ({ entityName, onClose, onDelete,
|
|
8
|
+
export declare const DeleteModal: ({ entityName, onClose, onDelete, }: DeleteModalProps) => JSX.Element;
|
|
10
9
|
export default DeleteModal;
|
|
11
10
|
//# sourceMappingURL=DeleteModal.d.ts.map
|
|
@@ -33,12 +33,11 @@ const react_query_1 = require("@tanstack/react-query");
|
|
|
33
33
|
const react_1 = __importStar(require("react"));
|
|
34
34
|
require("./DeleteModal.scss");
|
|
35
35
|
const LoadingSpinner_1 = require("./LoadingSpinner");
|
|
36
|
-
const DeleteModal = ({ entityName, onClose, onDelete,
|
|
36
|
+
const DeleteModal = ({ entityName, onClose, onDelete, }) => {
|
|
37
37
|
const [localEntityName] = (0, react_1.useState)(entityName);
|
|
38
38
|
const deleteMutation = (0, react_query_1.useMutation)({
|
|
39
39
|
mutationFn: onDelete,
|
|
40
40
|
onSuccess: async () => {
|
|
41
|
-
refresh && await refresh();
|
|
42
41
|
onClose();
|
|
43
42
|
},
|
|
44
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteModal.js","sourceRoot":"","sources":["../../../../src/components/SharedComponents/DeleteModal.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAM8B;AAC9B,uDAAoD;AACpD,+CAAqD;AACrD,8BAA4B;AAC5B,qDAAkD;
|
|
1
|
+
{"version":3,"file":"DeleteModal.js","sourceRoot":"","sources":["../../../../src/components/SharedComponents/DeleteModal.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAM8B;AAC9B,uDAAoD;AACpD,+CAAqD;AACrD,8BAA4B;AAC5B,qDAAkD;AAQ3C,MAAM,WAAW,GAAG,CAAC,EAC1B,UAAU,EACV,OAAO,EACP,QAAQ,GACS,EAAE,EAAE;IACrB,MAAM,CAAC,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAC,UAAU,CAAC,CAAC;IAE/C,MAAM,cAAc,GAAG,IAAA,yBAAW,EAAC;QACjC,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,KAAK,IAAI,EAAE;YACpB,OAAO,EAAE,CAAC;QACZ,CAAC;KACF,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QACtC,cAAc,CAAC,MAAM,EAAE,CAAC;IAC1B,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IAErB,OAAO,CACL;QACE,8BAAC,qBAAK,IACJ,KAAK,EAAC,SAAS,EACf,WAAW,EAAC,yBAAyB,EACrC,MAAM,EAAE,CAAC,CAAC,eAAe,EACzB,aAAa,EAAE,CAAC,cAAc,CAAC,SAAS,EACxC,OAAO,EAAE,OAAO;YAEhB,uCAAK,SAAS,EAAC,4BAA4B;gBACzC,8BAAC,oBAAI,IAAC,OAAO,EAAC,SAAS,EAAC,EAAE,EAAC,IAAI,sCAExB;gBACP,8CACG,8BAAC,oCAAoB,IAAC,IAAI,EAAE,GAAG,UAAU,GAAG,GAAI,CAC1C,CACL;YACN,8BAAC,8BAAc;gBACZ,cAAc,CAAC,SAAS;oBACvB,uCAAK,SAAS,EAAC,oBAAoB;wBACjC,8BAAC,+BAAc,OAAG,CACd;gBACR,8BAAC,sBAAM,IAAC,SAAS,EAAC,iBAAiB,EAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,cAAc,CAAC,SAAS,aAEtF;gBACT,8BAAC,sBAAM,IACL,SAAS,EAAC,SAAS,EACnB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,cAAc,CAAC,SAAS,aAG3B,CACM,CACX,CACP,CACJ,CAAC;AACJ,CAAC,CAAC;AAtDW,QAAA,WAAW,eAsDtB;AAEF,kBAAe,mBAAW,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 {\n Button,\n MiddleTextTruncation,\n Modal,\n ModalButtonBar,\n Text,\n} from \"@itwin/itwinui-react\";\nimport { useMutation } from \"@tanstack/react-query\";\nimport React, { useCallback, useState } from \"react\";\nimport \"./DeleteModal.scss\";\nimport { LoadingSpinner } from \"./LoadingSpinner\";\n\nexport interface DeleteModalProps {\n entityName: string;\n onClose: () => void;\n onDelete: () => Promise<void>;\n}\n\nexport const DeleteModal = ({\n entityName,\n onClose,\n onDelete,\n}: DeleteModalProps) => {\n const [localEntityName] = useState(entityName);\n\n const deleteMutation = useMutation({\n mutationFn: onDelete,\n onSuccess: async () => {\n onClose();\n },\n });\n\n const deleteCallback = useCallback(() => {\n deleteMutation.mutate();\n }, [deleteMutation]);\n\n return (\n <>\n <Modal\n title='Confirm'\n modalRootId='grouping-mapping-widget'\n isOpen={!!localEntityName}\n isDismissible={!deleteMutation.isLoading}\n onClose={onClose}\n >\n <div className=\"gmw-delete-modal-body-text\">\n <Text variant=\"leading\" as=\"h3\">\n Are you sure you want to delete\n </Text>\n <strong>\n {<MiddleTextTruncation text={`${entityName}?`} />}\n </strong>\n </div>\n <ModalButtonBar>\n {deleteMutation.isLoading &&\n <div className=\"gmw-loading-delete\">\n <LoadingSpinner />\n </div>}\n <Button styleType='high-visibility' onClick={deleteCallback} disabled={deleteMutation.isLoading}>\n Delete\n </Button>\n <Button\n styleType='default'\n onClick={onClose}\n disabled={deleteMutation.isLoading}\n >\n Cancel\n </Button>\n </ModalButtonBar>\n </Modal>\n </>\n );\n};\n\nexport default DeleteModal;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ExtractionStatusJob {
|
|
3
|
+
mappingIdJobInfo: Map<string, string>;
|
|
4
|
+
setMappingIdJobInfo: (mappingIdJobInfo: Map<string, string> | ((mappingIdJobInfo: Map<string, string>) => Map<string, string>)) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const ExtractionStatusJobContext: React.Context<ExtractionStatusJob>;
|
|
7
|
+
export declare const useExtractionStateJobContext: () => ExtractionStatusJob;
|
|
8
|
+
//# sourceMappingURL=ExtractionStateJobContext.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.useExtractionStateJobContext = exports.ExtractionStatusJobContext = void 0;
|
|
27
|
+
/*---------------------------------------------------------------------------------------------
|
|
28
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
29
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
30
|
+
*--------------------------------------------------------------------------------------------*/
|
|
31
|
+
const React = __importStar(require("react"));
|
|
32
|
+
exports.ExtractionStatusJobContext = React.createContext({
|
|
33
|
+
mappingIdJobInfo: new Map(),
|
|
34
|
+
setMappingIdJobInfo: () => { },
|
|
35
|
+
});
|
|
36
|
+
const useExtractionStateJobContext = () => {
|
|
37
|
+
const context = React.useContext(exports.ExtractionStatusJobContext);
|
|
38
|
+
if (!context) {
|
|
39
|
+
throw new Error("useExtractionStateJobContext should be used within a ExtractionStatusJobContext provider");
|
|
40
|
+
}
|
|
41
|
+
return context;
|
|
42
|
+
};
|
|
43
|
+
exports.useExtractionStateJobContext = useExtractionStateJobContext;
|
|
44
|
+
//# sourceMappingURL=ExtractionStateJobContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExtractionStateJobContext.js","sourceRoot":"","sources":["../../../../src/components/context/ExtractionStateJobContext.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6CAA+B;AAOlB,QAAA,0BAA0B,GAAG,KAAK,CAAC,aAAa,CAAsB;IACjF,gBAAgB,EAAE,IAAI,GAAG,EAAE;IAC3B,mBAAmB,EAAE,GAAG,EAAE,GAAG,CAAC;CAC/B,CAAC,CAAC;AAEI,MAAM,4BAA4B,GAAG,GAAwB,EAAE;IACpE,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,kCAA0B,CAAC,CAAC;IAC7D,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,0FAA0F,CAC3F,CAAC;KACH;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AARW,QAAA,4BAA4B,gCAQvC","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\";\n\nexport interface ExtractionStatusJob {\n mappingIdJobInfo: Map<string, string>; // key: mappingId, value: jobId\n setMappingIdJobInfo: (mappingIdJobInfo: Map<string, string> | ((mappingIdJobInfo: Map<string, string>) => Map<string, string>)) => void;\n}\n\nexport const ExtractionStatusJobContext = React.createContext<ExtractionStatusJob>({\n mappingIdJobInfo: new Map(),\n setMappingIdJobInfo: () => { },\n});\n\nexport const useExtractionStateJobContext = (): ExtractionStatusJob => {\n const context = React.useContext(ExtractionStatusJobContext);\n if (!context) {\n throw new Error(\n \"useExtractionStateJobContext should be used within a ExtractionStatusJobContext provider\"\n );\n }\n return context;\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface PropertiesGroupColor {
|
|
3
|
+
showGroupColor: boolean;
|
|
4
|
+
setShowGroupColor: (showGroupColor: boolean | ((showGroupColor: boolean) => boolean)) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const PropertiesGroupColorContext: React.Context<PropertiesGroupColor>;
|
|
7
|
+
export declare const usePropertiesGroupColorContext: () => PropertiesGroupColor;
|
|
8
|
+
//# sourceMappingURL=PropertiesGroupColorContext.d.ts.map
|
|
@@ -23,25 +23,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.usePropertiesGroupColorContext = exports.PropertiesGroupColorContext = void 0;
|
|
27
27
|
/*---------------------------------------------------------------------------------------------
|
|
28
28
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
29
29
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
30
30
|
*--------------------------------------------------------------------------------------------*/
|
|
31
31
|
const React = __importStar(require("react"));
|
|
32
|
-
exports.
|
|
32
|
+
exports.PropertiesGroupColorContext = React.createContext({
|
|
33
33
|
showGroupColor: false,
|
|
34
|
-
setGroupProperties: () => { },
|
|
35
|
-
setCalculatedProperties: () => { },
|
|
36
|
-
setCustomCalculationProperties: () => { },
|
|
37
34
|
setShowGroupColor: () => { },
|
|
38
35
|
});
|
|
39
|
-
const
|
|
40
|
-
const context = React.useContext(exports.
|
|
36
|
+
const usePropertiesGroupColorContext = () => {
|
|
37
|
+
const context = React.useContext(exports.PropertiesGroupColorContext);
|
|
41
38
|
if (!context) {
|
|
42
|
-
throw new Error("
|
|
39
|
+
throw new Error("usePropertiesGroupColorContext should be used within a PropertiesGroupColorContext provider");
|
|
43
40
|
}
|
|
44
41
|
return context;
|
|
45
42
|
};
|
|
46
|
-
exports.
|
|
47
|
-
//# sourceMappingURL=
|
|
43
|
+
exports.usePropertiesGroupColorContext = usePropertiesGroupColorContext;
|
|
44
|
+
//# sourceMappingURL=PropertiesGroupColorContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertiesGroupColorContext.js","sourceRoot":"","sources":["../../../../src/components/context/PropertiesGroupColorContext.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,6CAA+B;AAOlB,QAAA,2BAA2B,GAAG,KAAK,CAAC,aAAa,CAAuB;IACnF,cAAc,EAAE,KAAK;IACrB,iBAAiB,EAAE,GAAG,EAAE,GAAG,CAAC;CAC7B,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,CACb,6FAA6F,CAC9F,CAAC;KACH;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AARW,QAAA,8BAA8B,kCAQzC","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\";\n\nexport interface PropertiesGroupColor {\n showGroupColor: boolean;\n setShowGroupColor: (showGroupColor: boolean | ((showGroupColor: boolean) => boolean)) => void;\n}\n\nexport const PropertiesGroupColorContext = React.createContext<PropertiesGroupColor>({\n showGroupColor: false,\n setShowGroupColor: () => { },\n});\n\nexport const usePropertiesGroupColorContext = (): PropertiesGroupColor => {\n const context = React.useContext(PropertiesGroupColorContext);\n if (!context) {\n throw new Error(\n \"usePropertiesGroupColorContext should be used within a PropertiesGroupColorContext provider\"\n );\n }\n return context;\n};\n"]}
|
|
@@ -120,7 +120,7 @@ describe("Groups View", () => {
|
|
|
120
120
|
await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
|
|
121
121
|
// Assert
|
|
122
122
|
// Should have the correct random mockGroups.groups count listed
|
|
123
|
-
const horizontalTiles = test_utils_1.screen.getAllByTestId("
|
|
123
|
+
const horizontalTiles = test_utils_1.screen.getAllByTestId("group-list-item");
|
|
124
124
|
expect(horizontalTiles).toHaveLength(mockGroups.groups.length);
|
|
125
125
|
horizontalTiles.forEach((horizontalTile, index) => {
|
|
126
126
|
const groupTile = (0, test_utils_1.within)(horizontalTile);
|
|
@@ -195,7 +195,7 @@ describe("Groups View", () => {
|
|
|
195
195
|
await (0, test_utils_1.waitForElementToBeRemoved)(() => test_utils_1.screen.getByText(/loading/i));
|
|
196
196
|
// Assert
|
|
197
197
|
// Should have the right group number
|
|
198
|
-
const horizontalTiles = test_utils_1.screen.getAllByTestId("
|
|
198
|
+
const horizontalTiles = test_utils_1.screen.getAllByTestId("group-list-item");
|
|
199
199
|
expect(horizontalTiles).toHaveLength(mockGroups.groups.length);
|
|
200
200
|
// Click on first group more icon
|
|
201
201
|
const moreButton = test_utils_1.screen.getAllByTestId("gmw-more-button");
|
|
@@ -246,7 +246,7 @@ describe("Groups View", () => {
|
|
|
246
246
|
// Callback should have been called with correct parameters
|
|
247
247
|
expect(onClickAddGroup).toBeCalledWith(mockGroupingUI.name);
|
|
248
248
|
// Check the group tile number
|
|
249
|
-
const horizontalTiles = test_utils_1.screen.getAllByTestId("
|
|
249
|
+
const horizontalTiles = test_utils_1.screen.getAllByTestId("group-list-item");
|
|
250
250
|
expect(horizontalTiles).toHaveLength(mockGroups.groups.length);
|
|
251
251
|
// Click on first group more icon
|
|
252
252
|
const moreButton = test_utils_1.screen.getAllByTestId("gmw-more-button");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingMappingCustomUI.test.js","sourceRoot":"","sources":["../../../src/test/GroupingMappingCustomUI.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,qCAAmC;AACnC,2CAAwC;AACxC,wEAAiF;AAEjF,6CAA+B;AAG/B,6EAAoD;AACpD,mDAAuF;AAEvF,MAAM,WAAW,GAAG,aAAK,CAAC,Q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e,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAE/D,iCAAiC;QACjC,MAAM,UAAU,GAAG,mBAAM,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC;QAC5D,MAAM,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAE1D,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QAEhC,mCAAmC;QACnC,MAAM,gBAAgB,GAAG,mBAAM,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC;QAExE,MAAM,CAAC,gBAAgB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACzC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACtD,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;QAC1E,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAExD,0BAA0B;QAC1B,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QAEtC,2DAA2D;QAC3D,MAAM,CAAC,gCAAgC,CAAC,CAAC,cAAc,CAAC,wBAAwB,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACtI,CAAC,CAAC,CAAC;AACL,CAAC,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 \"@testing-library/jest-dom\";\nimport { faker } from \"@faker-js/faker\";\nimport { GroupingMappingCustomUIType, Groups } from \"../grouping-mapping-widget\";\nimport type { GroupCollection, IMappingsClient, Mapping } from \"@itwin/insights-client\";\nimport * as moq from \"typemoq\";\nimport type { IModelConnection, ViewManager } from \"@itwin/core-frontend\";\nimport type { ContextCustomUIProps, GroupingCustomUIProps, GroupingMappingCustomUI } from \"../grouping-mapping-widget\";\nimport userEvent from \"@testing-library/user-event\";\nimport { render, screen, waitForElementToBeRemoved, within } from \"../test/test-utils\";\n\nconst mockITwinId = faker.datatype.uuid();\nconst mockIModelId = faker.datatype.uuid();\nconst mockMappingId = faker.datatype.uuid();\nconst mockMapping: Mapping = {\n id: mockMappingId,\n mappingName: \"mOcKmApPiNg1\",\n description: \"mOcKmApPiNgDeScRiPtIoN1\",\n createdBy: faker.random.alpha(),\n createdOn: faker.date.past().toDateString(),\n modifiedBy: faker.random.alpha(),\n modifiedOn: faker.date.past().toDateString(),\n extractionEnabled: false,\n _links: {\n imodel: {\n href: \"\",\n },\n },\n};\n\nconst groupsFactory = (): GroupCollection => ({\n groups: Array.from(\n { length: faker.datatype.number({ min: 3, max: 5 }) },\n (_, index) => ({\n id: `${faker.datatype.uuid()}`,\n groupName: `mOcKgRoUp${index}`,\n description: `mOcKgRoUpDeScRiPtIoN${index}`,\n query: `mOcKgRoUpQuErY${index}`,\n _links: {\n imodel: {\n href: \"\",\n },\n mapping: {\n href: \"\",\n },\n },\n })\n ),\n _links: {\n next: undefined,\n self: {\n href: \"\",\n },\n },\n});\n\nconst connectionMock = moq.Mock.ofType<IModelConnection>();\nconst viewManagerMock = moq.Mock.ofType<ViewManager>();\nconst mappingClientMock = moq.Mock.ofType<IMappingsClient>();\n\njest.mock(\"@itwin/appui-react\", () => ({\n ...jest.requireActual(\"@itwin/appui-react\"),\n useActiveIModelConnection: () => connectionMock.object,\n}));\n\njest.mock(\"@itwin/core-frontend\", () => ({\n ...jest.requireActual(\"@itwin/core-frontend\"),\n IModelApp: {\n viewManager: {},\n },\n}));\n\njest.mock(\"../components/context/MappingClientContext\", () => ({\n ...jest.requireActual(\"../components/context/MappingClientContext\"),\n useMappingClient: () => mappingClientMock.object,\n}));\n\njest.mock(\"../common/utils\", () => ({\n ...jest.requireActual(\"../common/utils\"),\n enableExperimentalFeatures: jest.fn,\n}));\n\nconst mockGroups = groupsFactory();\n\ndescribe(\"Groups View\", () => {\n beforeEach(async () => {\n connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId);\n connectionMock.setup((x) => x.iTwinId).returns(() => mockITwinId);\n\n mappingClientMock\n .setup(async (x) => x.getGroups(moq.It.isAny(), moq.It.isAny(), moq.It.isAny()))\n .returns(async () => Promise.resolve(mockGroups.groups));\n });\n\n afterEach(() => {\n connectionMock.reset();\n mappingClientMock.reset();\n viewManagerMock.reset();\n });\n\n it(\"List all groups\", async () => {\n // Arange\n\n // Act\n const user = userEvent.setup();\n render(\n <Groups\n mapping={mockMapping}\n onClickAddGroup={jest.fn()}\n onClickGroupModify={jest.fn()}\n onClickGroupTitle={jest.fn}\n onClickRenderContextCustomUI={jest.fn()}\n />\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n\n // Should have the correct random mockGroups.groups count listed\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n horizontalTiles.forEach((horizontalTile, index) => {\n const groupTile = within(horizontalTile);\n expect(\n groupTile.getByText(\n mockGroups.groups[index].groupName\n )\n ).toBeInTheDocument();\n expect(\n groupTile.getByText(\n mockGroups.groups[index].description ?? \"\"\n )\n ).toBeInTheDocument();\n });\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should only have the permanent delete context item.\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(1);\n expect(contextMenuItems[0]).toHaveTextContent(\"Remove\");\n });\n\n it(\"Set up grouping custom UI\", async () => {\n // Arange\n const mockedUIComponent = (_props: GroupingCustomUIProps) => React.createElement(\"div\");\n const mockGroupingUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Grouping,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedUIComponent,\n };\n\n const groupingMappingCustomUIMock = [mockGroupingUI];\n\n // Act\n const { user } = render(\n <Groups\n mapping={mockMapping}\n onClickAddGroup={jest.fn()}\n onClickGroupModify={jest.fn()}\n onClickGroupTitle={jest.fn}\n onClickRenderContextCustomUI={jest.fn()}\n />,\n groupingMappingCustomUIMock\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have exactly 1 add method with given configuration\n const addCustom = screen.getAllByTestId(\"gmw-add-0\");\n expect(addCustom).toHaveLength(1);\n expect(addCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n // Each group should have a more icon button\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n expect(moreButton.length).toBeGreaterThan(0);\n\n // Click on first more icon\n await user.click(moreButton[0]);\n\n // Should have 2 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(2);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n\n // Hover on 'Edit'\n await user.hover(contextMenuItems[0]);\n\n // Should have exactly 1 sub menu item\n const editCustom = screen.getAllByTestId(`gmw-edit-0`);\n expect(editCustom).toHaveLength(1);\n expect(editCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n // Click on the edit custom UI\n await user.click(editCustom[0]);\n\n const groupName = screen.getAllByText(mockGroups.groups[0].groupName);\n expect(groupName).toHaveLength(1);\n });\n\n it(\"Set up context custom UI - should have add context menu\", async () => {\n // Arange\n const mockedUIComponent = (_props: ContextCustomUIProps) => React.createElement(\"div\");\n const mockContextUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Context,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedUIComponent,\n };\n\n const groupingMappingCustomUIMock = [mockContextUI];\n const onClickRenderContextCustomUIMock = jest.fn();\n\n // Act\n const { user } = render(\n <Groups\n mapping={mockMapping}\n onClickAddGroup={jest.fn()}\n onClickGroupModify={jest.fn()}\n onClickGroupTitle={jest.fn}\n onClickRenderContextCustomUI={onClickRenderContextCustomUIMock}\n />,\n groupingMappingCustomUIMock\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n\n // Should have the right group number\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 2 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(2);\n expect(contextMenuItems[0]).toHaveTextContent(mockContextUI.displayLabel);\n expect(contextMenuItems[1]).toHaveTextContent(\"Remove\");\n\n // Click on the context ui\n await user.click(contextMenuItems[0]);\n\n // Callback should have been called with correct parameters\n expect(onClickRenderContextCustomUIMock).toBeCalledWith(mockedUIComponent, mockGroups.groups[0], mockContextUI.displayLabel);\n });\n\n it(\"Set up both grouping and context custom UI\", async () => {\n // Arange\n const mockedGroupingUIComponent = (_props: GroupingCustomUIProps) => React.createElement(\"div\");\n const mockedContextUIComponent = (_props: ContextCustomUIProps) => React.createElement(\"div\");\n const mockGroupingUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Grouping,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedGroupingUIComponent,\n };\n const mockContextUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Context,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedContextUIComponent,\n };\n\n const groupingMappingCustomUIMock = [mockContextUI, mockGroupingUI];\n const onClickAddGroup = jest.fn();\n const onClickRenderContextCustomUIMock = jest.fn();\n\n // Act\n const { user } = render(\n <Groups\n mapping={mockMapping}\n onClickAddGroup={onClickAddGroup}\n onClickGroupModify={jest.fn()}\n onClickGroupTitle={jest.fn}\n onClickRenderContextCustomUI={onClickRenderContextCustomUIMock}\n />,\n groupingMappingCustomUIMock\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have exactly 1 add method with given configuration\n const addCustom = screen.getAllByTestId(\"gmw-add-0\");\n expect(addCustom).toHaveLength(1);\n expect(addCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n await user.click(addCustom[0]);\n\n // Callback should have been called with correct parameters\n expect(onClickAddGroup).toBeCalledWith(mockGroupingUI.name);\n\n // Check the group tile number\n const horizontalTiles = screen.getAllByTestId(\"gmw-horizontal-tile\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 3 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n\n expect(contextMenuItems).toHaveLength(3);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n expect(contextMenuItems[1]).toHaveTextContent(mockContextUI.displayLabel);\n expect(contextMenuItems[2]).toHaveTextContent(\"Remove\");\n\n // Click on the context ui\n await user.click(contextMenuItems[1]);\n\n // Callback should have been called with correct parameters\n expect(onClickRenderContextCustomUIMock).toBeCalledWith(mockedContextUIComponent, mockGroups.groups[0], mockContextUI.displayLabel);\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"GroupingMappingCustomUI.test.js","sourceRoot":"","sources":["../../../src/test/GroupingMappingCustomUI.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,kDAA0B;AAC1B,qCAAmC;AACnC,2CAAwC;AACxC,wEAAiF;AAEjF,6CAA+B;AAG/B,6EAAoD;AACpD,mDAAuF;AAEvF,MAAM,WAAW,GAAG,aAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC1C,MAAM,YAAY,GAAG,aAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC3C,MAAM,aAAa,GAAG,aAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC5C,MAAM,WAAW,GAAY;IAC3B,EAAE,EAAE,aAAa;IACjB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,yBAAyB;IACtC,SAAS,EAAE,aAAK,CAAC,MAAM,CAAC,KAAK,EAAE;IAC/B,SAAS,EAAE,aAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE;IAC3C,UAAU,EAAE,aAAK,CAAC,MAAM,CAAC,KAAK,EAAE;IAChC,UAAU,EAAE,aAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,YAAY,EAAE;IAC5C,iBAAiB,EAAE,KAAK;IACxB,MAAM,EAAE;QACN,MAAM,EAAE;YACN,IAAI,EAAE,EAAE;SACT;KACF;CACF,CAAC;AAEF,MAAM,aAAa,GAAG,GAAoB,EAAE,CAAC,CAAC;IAC5C,MAAM,EAAE,KAAK,CAAC,IAAI,CAChB,EAAE,MAAM,EAAE,aAAK,CAAC,QAAQ,CAAC,MAAM,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AC1B,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;QAEtC,2DAA2D;QAC3D,MAAM,CAAC,gCAAgC,CAAC,CAAC,cAAc,CAAC,wBAAwB,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACtI,CAAC,CAAC,CAAC;AACL,CAAC,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 \"@testing-library/jest-dom\";\nimport { faker } from \"@faker-js/faker\";\nimport { GroupingMappingCustomUIType, Groups } from \"../grouping-mapping-widget\";\nimport type { GroupCollection, IMappingsClient, Mapping } from \"@itwin/insights-client\";\nimport * as moq from \"typemoq\";\nimport type { IModelConnection, ViewManager } from \"@itwin/core-frontend\";\nimport type { ContextCustomUIProps, GroupingCustomUIProps, GroupingMappingCustomUI } from \"../grouping-mapping-widget\";\nimport userEvent from \"@testing-library/user-event\";\nimport { render, screen, waitForElementToBeRemoved, within } from \"../test/test-utils\";\n\nconst mockITwinId = faker.datatype.uuid();\nconst mockIModelId = faker.datatype.uuid();\nconst mockMappingId = faker.datatype.uuid();\nconst mockMapping: Mapping = {\n id: mockMappingId,\n mappingName: \"mOcKmApPiNg1\",\n description: \"mOcKmApPiNgDeScRiPtIoN1\",\n createdBy: faker.random.alpha(),\n createdOn: faker.date.past().toDateString(),\n modifiedBy: faker.random.alpha(),\n modifiedOn: faker.date.past().toDateString(),\n extractionEnabled: false,\n _links: {\n imodel: {\n href: \"\",\n },\n },\n};\n\nconst groupsFactory = (): GroupCollection => ({\n groups: Array.from(\n { length: faker.datatype.number({ min: 3, max: 5 }) },\n (_, index) => ({\n id: `${faker.datatype.uuid()}`,\n groupName: `mOcKgRoUp${index}`,\n description: `mOcKgRoUpDeScRiPtIoN${index}`,\n query: `mOcKgRoUpQuErY${index}`,\n _links: {\n imodel: {\n href: \"\",\n },\n mapping: {\n href: \"\",\n },\n },\n })\n ),\n _links: {\n next: undefined,\n self: {\n href: \"\",\n },\n },\n});\n\nconst connectionMock = moq.Mock.ofType<IModelConnection>();\nconst viewManagerMock = moq.Mock.ofType<ViewManager>();\nconst mappingClientMock = moq.Mock.ofType<IMappingsClient>();\n\njest.mock(\"@itwin/appui-react\", () => ({\n ...jest.requireActual(\"@itwin/appui-react\"),\n useActiveIModelConnection: () => connectionMock.object,\n}));\n\njest.mock(\"@itwin/core-frontend\", () => ({\n ...jest.requireActual(\"@itwin/core-frontend\"),\n IModelApp: {\n viewManager: {},\n },\n}));\n\njest.mock(\"../components/context/MappingClientContext\", () => ({\n ...jest.requireActual(\"../components/context/MappingClientContext\"),\n useMappingClient: () => mappingClientMock.object,\n}));\n\njest.mock(\"../common/utils\", () => ({\n ...jest.requireActual(\"../common/utils\"),\n enableExperimentalFeatures: jest.fn,\n}));\n\nconst mockGroups = groupsFactory();\n\ndescribe(\"Groups View\", () => {\n beforeEach(async () => {\n connectionMock.setup((x) => x.iModelId).returns(() => mockIModelId);\n connectionMock.setup((x) => x.iTwinId).returns(() => mockITwinId);\n\n mappingClientMock\n .setup(async (x) => x.getGroups(moq.It.isAny(), moq.It.isAny(), moq.It.isAny()))\n .returns(async () => Promise.resolve(mockGroups.groups));\n });\n\n afterEach(() => {\n connectionMock.reset();\n mappingClientMock.reset();\n viewManagerMock.reset();\n });\n\n it(\"List all groups\", async () => {\n // Arange\n\n // Act\n const user = userEvent.setup();\n render(\n <Groups\n mapping={mockMapping}\n onClickAddGroup={jest.fn()}\n onClickGroupModify={jest.fn()}\n onClickGroupTitle={jest.fn}\n onClickRenderContextCustomUI={jest.fn()}\n />\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n\n // Should have the correct random mockGroups.groups count listed\n const horizontalTiles = screen.getAllByTestId(\"group-list-item\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n horizontalTiles.forEach((horizontalTile, index) => {\n const groupTile = within(horizontalTile);\n expect(\n groupTile.getByText(\n mockGroups.groups[index].groupName\n )\n ).toBeInTheDocument();\n expect(\n groupTile.getByText(\n mockGroups.groups[index].description ?? \"\"\n )\n ).toBeInTheDocument();\n });\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should only have the permanent delete context item.\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(1);\n expect(contextMenuItems[0]).toHaveTextContent(\"Remove\");\n });\n\n it(\"Set up grouping custom UI\", async () => {\n // Arange\n const mockedUIComponent = (_props: GroupingCustomUIProps) => React.createElement(\"div\");\n const mockGroupingUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Grouping,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedUIComponent,\n };\n\n const groupingMappingCustomUIMock = [mockGroupingUI];\n\n // Act\n const { user } = render(\n <Groups\n mapping={mockMapping}\n onClickAddGroup={jest.fn()}\n onClickGroupModify={jest.fn()}\n onClickGroupTitle={jest.fn}\n onClickRenderContextCustomUI={jest.fn()}\n />,\n groupingMappingCustomUIMock\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have exactly 1 add method with given configuration\n const addCustom = screen.getAllByTestId(\"gmw-add-0\");\n expect(addCustom).toHaveLength(1);\n expect(addCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n // Each group should have a more icon button\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n expect(moreButton.length).toBeGreaterThan(0);\n\n // Click on first more icon\n await user.click(moreButton[0]);\n\n // Should have 2 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(2);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n\n // Hover on 'Edit'\n await user.hover(contextMenuItems[0]);\n\n // Should have exactly 1 sub menu item\n const editCustom = screen.getAllByTestId(`gmw-edit-0`);\n expect(editCustom).toHaveLength(1);\n expect(editCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n // Click on the edit custom UI\n await user.click(editCustom[0]);\n\n const groupName = screen.getAllByText(mockGroups.groups[0].groupName);\n expect(groupName).toHaveLength(1);\n });\n\n it(\"Set up context custom UI - should have add context menu\", async () => {\n // Arange\n const mockedUIComponent = (_props: ContextCustomUIProps) => React.createElement(\"div\");\n const mockContextUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Context,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedUIComponent,\n };\n\n const groupingMappingCustomUIMock = [mockContextUI];\n const onClickRenderContextCustomUIMock = jest.fn();\n\n // Act\n const { user } = render(\n <Groups\n mapping={mockMapping}\n onClickAddGroup={jest.fn()}\n onClickGroupModify={jest.fn()}\n onClickGroupTitle={jest.fn}\n onClickRenderContextCustomUI={onClickRenderContextCustomUIMock}\n />,\n groupingMappingCustomUIMock\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n\n // Should have the right group number\n const horizontalTiles = screen.getAllByTestId(\"group-list-item\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 2 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n expect(contextMenuItems).toHaveLength(2);\n expect(contextMenuItems[0]).toHaveTextContent(mockContextUI.displayLabel);\n expect(contextMenuItems[1]).toHaveTextContent(\"Remove\");\n\n // Click on the context ui\n await user.click(contextMenuItems[0]);\n\n // Callback should have been called with correct parameters\n expect(onClickRenderContextCustomUIMock).toBeCalledWith(mockedUIComponent, mockGroups.groups[0], mockContextUI.displayLabel);\n });\n\n it(\"Set up both grouping and context custom UI\", async () => {\n // Arange\n const mockedGroupingUIComponent = (_props: GroupingCustomUIProps) => React.createElement(\"div\");\n const mockedContextUIComponent = (_props: ContextCustomUIProps) => React.createElement(\"div\");\n const mockGroupingUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Grouping,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedGroupingUIComponent,\n };\n const mockContextUI: GroupingMappingCustomUI = {\n type: GroupingMappingCustomUIType.Context,\n name: \"mOcKgRoUpInGuI\",\n displayLabel: \"Mock Grouping UI\",\n uiComponent: mockedContextUIComponent,\n };\n\n const groupingMappingCustomUIMock = [mockContextUI, mockGroupingUI];\n const onClickAddGroup = jest.fn();\n const onClickRenderContextCustomUIMock = jest.fn();\n\n // Act\n const { user } = render(\n <Groups\n mapping={mockMapping}\n onClickAddGroup={onClickAddGroup}\n onClickGroupModify={jest.fn()}\n onClickGroupTitle={jest.fn}\n onClickRenderContextCustomUI={onClickRenderContextCustomUIMock}\n />,\n groupingMappingCustomUIMock\n );\n\n await waitForElementToBeRemoved(() => screen.getByText(/loading/i));\n\n // Assert\n const addButton = screen.getAllByTestId(\"gmw-add-group-button\");\n expect(addButton).toHaveLength(1);\n\n // Click on 'Add Group' button\n await user.click(addButton[0]);\n\n // Should have exactly 1 add method with given configuration\n const addCustom = screen.getAllByTestId(\"gmw-add-0\");\n expect(addCustom).toHaveLength(1);\n expect(addCustom[0]).toHaveTextContent(mockGroupingUI.displayLabel);\n\n await user.click(addCustom[0]);\n\n // Callback should have been called with correct parameters\n expect(onClickAddGroup).toBeCalledWith(mockGroupingUI.name);\n\n // Check the group tile number\n const horizontalTiles = screen.getAllByTestId(\"group-list-item\");\n expect(horizontalTiles).toHaveLength(mockGroups.groups.length);\n\n // Click on first group more icon\n const moreButton = screen.getAllByTestId(\"gmw-more-button\");\n expect(moreButton).toHaveLength(mockGroups.groups.length);\n\n await user.click(moreButton[0]);\n\n // Should have 3 context menu items\n const contextMenuItems = screen.getAllByTestId(\"gmw-context-menu-item\");\n\n expect(contextMenuItems).toHaveLength(3);\n expect(contextMenuItems[0]).toHaveTextContent(\"Edit\");\n expect(contextMenuItems[1]).toHaveTextContent(mockContextUI.displayLabel);\n expect(contextMenuItems[2]).toHaveTextContent(\"Remove\");\n\n // Click on the context ui\n await user.click(contextMenuItems[1]);\n\n // Callback should have been called with correct parameters\n expect(onClickRenderContextCustomUIMock).toBeCalledWith(mockedContextUIComponent, mockGroups.groups[0], mockContextUI.displayLabel);\n });\n});\n"]}
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import React, { useEffect } from "react";
|
|
6
6
|
import { useGroupHilitedElementsContext } from "../components/context/GroupHilitedElementsContext";
|
|
7
|
-
import {
|
|
7
|
+
import { usePropertiesGroupColorContext } from "../components/context/PropertiesGroupColorContext";
|
|
8
8
|
import { GroupingMappingRouter } from "./Router/GroupingMappingRouter";
|
|
9
9
|
import { clearAll } from "../common/viewerUtils";
|
|
10
10
|
export const GroupingMappingContent = ({ routingHistory, navigateTo, goBack, }) => {
|
|
11
11
|
const { setShowGroupColor, setHiddenGroupsIds } = useGroupHilitedElementsContext();
|
|
12
|
-
const { setShowGroupColor: setPropertiesShowGroup } =
|
|
12
|
+
const { setShowGroupColor: setPropertiesShowGroup } = usePropertiesGroupColorContext();
|
|
13
13
|
const currentRoute = routingHistory[routingHistory.length - 1];
|
|
14
14
|
// Clean up group visualization when in mappings
|
|
15
15
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingMappingContent.js","sourceRoot":"","sources":["../../../src/WidgetShell/GroupingMappingContent.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,8BAA8B,EAAE,MAAM,mDAAmD,CAAC;AACnG,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"GroupingMappingContent.js","sourceRoot":"","sources":["../../../src/WidgetShell/GroupingMappingContent.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,8BAA8B,EAAE,MAAM,mDAAmD,CAAC;AACnG,OAAO,EAAE,8BAA8B,EAAE,MAAM,mDAAmD,CAAC;AAEnG,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,cAAc,EACd,UAAU,EACV,MAAM,GAKP,EAAE,EAAE;IACH,MAAM,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,GAAG,8BAA8B,EAAE,CAAC;IACnF,MAAM,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,GAAG,8BAA8B,EAAE,CAAC;IACvF,MAAM,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE/D,gDAAgD;IAChD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,iBAAiB,CAAC,KAAK,CAAC,CAAC;YACzB,kBAAkB,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC;YAC9B,QAAQ,EAAE,CAAC;YACX,2CAA2C;SAC5C;aAAM,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;YACtC,sBAAsB,CAAC,KAAK,CAAC,CAAC;SAC/B;IACH,CAAC,EAAE,CAAC,cAAc,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAEpF,OAAO,CACL,oBAAC,qBAAqB,IACpB,YAAY,EAAE,YAAY,EAC1B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,GACd,CACH,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 } from \"react\";\nimport { useGroupHilitedElementsContext } from \"../components/context/GroupHilitedElementsContext\";\nimport { usePropertiesGroupColorContext } from \"../components/context/PropertiesGroupColorContext\";\nimport type { Route } from \"./GroupingMapping\";\nimport { GroupingMappingRouter } from \"./Router/GroupingMappingRouter\";\nimport { clearAll } from \"../common/viewerUtils\";\n\nexport const GroupingMappingContent = ({\n routingHistory,\n navigateTo,\n goBack,\n}: {\n routingHistory: Route[];\n navigateTo: (toRoute: (prev: Route | undefined) => Route) => void;\n goBack: () => void;\n}) => {\n const { setShowGroupColor, setHiddenGroupsIds } = useGroupHilitedElementsContext();\n const { setShowGroupColor: setPropertiesShowGroup } = usePropertiesGroupColorContext();\n const currentRoute = routingHistory[routingHistory.length - 1];\n\n // Clean up group visualization when in mappings\n useEffect(() => {\n if (routingHistory.length === 1) {\n setShowGroupColor(false);\n setHiddenGroupsIds(new Set());\n clearAll();\n // Turn off visualiztion in properties menu\n } else if (routingHistory.length === 2) {\n setPropertiesShowGroup(false);\n }\n }, [routingHistory, setHiddenGroupsIds, setPropertiesShowGroup, setShowGroupColor]);\n\n return (\n <GroupingMappingRouter\n currentRoute={currentRoute}\n navigateTo={navigateTo}\n goBack={goBack}\n />\n );\n};\n"]}
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import {
|
|
5
|
+
import { useEffect, useRef } from "react";
|
|
6
6
|
export const useIsMounted = () => {
|
|
7
|
-
const
|
|
7
|
+
const isMounted = useRef(false);
|
|
8
8
|
useEffect(() => {
|
|
9
|
+
isMounted.current = true;
|
|
9
10
|
return () => {
|
|
10
|
-
|
|
11
|
+
isMounted.current = false;
|
|
11
12
|
};
|
|
12
13
|
}, []);
|
|
13
|
-
const isMounted = useCallback(() => isMountedRef.current, []);
|
|
14
14
|
return isMounted;
|
|
15
15
|
};
|
|
16
16
|
//# sourceMappingURL=useIsMounted.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsMounted.js","sourceRoot":"","sources":["../../../../src/common/hooks/useIsMounted.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useIsMounted.js","sourceRoot":"","sources":["../../../../src/common/hooks/useIsMounted.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE;IAC/B,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAEhC,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;QACzB,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;QAC5B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,SAAS,CAAC;AACnB,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 { useEffect, useRef } from \"react\";\n\nexport const useIsMounted = () => {\n const isMounted = useRef(false);\n\n useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n return isMounted;\n};\n"]}
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
export const STATUS_CHECK_INTERVAL = 5000;
|
|
6
|
+
export const ANIMATION_DELAY = "3s";
|
|
7
|
+
export const ANIMATION_DURATION = "1s";
|
|
5
8
|
// Types of error codes that get handled by query cache error handler.
|
|
6
9
|
export var TErrCodes;
|
|
7
10
|
(function (TErrCodes) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../src/components/Constants.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../../src/components/Constants.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAC1C,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AACpC,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEvC,sEAAsE;AACtE,MAAM,CAAN,IAAY,SAEX;AAFD,WAAY,SAAS;IACnB,mFAAyB,CAAA,CAAC,2DAA2D;AACvF,CAAC,EAFW,SAAS,KAAT,SAAS,QAEpB","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*--------------------------------------------------------------------------------------------*/\nexport const STATUS_CHECK_INTERVAL = 5000;\nexport const ANIMATION_DELAY = \"3s\";\nexport const ANIMATION_DURATION = \"1s\";\n\n// Types of error codes that get handled by query cache error handler.\nexport enum TErrCodes {\n QUERY_HILITE_FETCH_FAILED // Error code when failing to fetch hilite ids for a group.\n}\n"]}
|
|
@@ -8,13 +8,14 @@ import { GroupingMappingApiConfigContext } from "./context/GroupingApiConfigCont
|
|
|
8
8
|
import { createMappingClient, MappingClientContext, } from "./context/MappingClientContext";
|
|
9
9
|
import { createGroupingMappingCustomUI, GroupingMappingCustomUIContext } from "./context/GroupingMappingCustomUIContext";
|
|
10
10
|
import { GroupHilitedElementsContext } from "./context/GroupHilitedElementsContext";
|
|
11
|
-
import {
|
|
11
|
+
import { PropertiesGroupColorContext } from "./context/PropertiesGroupColorContext";
|
|
12
12
|
import { useActiveIModelConnection } from "@itwin/appui-react";
|
|
13
13
|
import { createExtractionClient, ExtractionClientContext } from "./context/ExtractionClientContext";
|
|
14
14
|
import { MutationCache, QueryCache, QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
15
15
|
import { toaster } from "@itwin/itwinui-react";
|
|
16
16
|
import { getErrorMessage } from "../common/utils";
|
|
17
17
|
import { TErrCodes } from "./Constants";
|
|
18
|
+
import { ExtractionStatusJobContext } from "./context/ExtractionStateJobContext";
|
|
18
19
|
const authorizationClientGetAccessToken = async () => (await IModelApp.authorizationClient?.getAccessToken()) ?? "";
|
|
19
20
|
const defaultQueryClient = new QueryClient({
|
|
20
21
|
defaultOptions: {
|
|
@@ -63,9 +64,6 @@ export const GroupingMappingContext = (props) => {
|
|
|
63
64
|
const [showGroupColor, setShowGroupColor] = useState(false);
|
|
64
65
|
const [propertiesShowGroup, setPropertiesShowGroup] = useState(false);
|
|
65
66
|
const [groups, setGroups] = useState([]);
|
|
66
|
-
const [groupProperties, setGroupProperties] = useState([]);
|
|
67
|
-
const [calculatedProperties, setCalculatedProperties] = useState([]);
|
|
68
|
-
const [customCalculationProperties, setCustomCalculationProperties] = useState([]);
|
|
69
67
|
const [numberOfVisualizedGroups, setNumberOfVisualizedGroups] = useState(0);
|
|
70
68
|
const [isOverlappedColored, setIsOverlappedColored] = useState(false);
|
|
71
69
|
const [currentHilitedGroups, setCurrentHilitedGroups] = useState(1);
|
|
@@ -76,6 +74,7 @@ export const GroupingMappingContext = (props) => {
|
|
|
76
74
|
overlappedElementGroupPairs: [],
|
|
77
75
|
});
|
|
78
76
|
const queryClient = props.queryClient ?? defaultQueryClient;
|
|
77
|
+
const [mappingIdJobInfo, setMappingIdJobInfo] = useState(new Map());
|
|
79
78
|
useEffect(() => {
|
|
80
79
|
setApiConfig(() => ({
|
|
81
80
|
prefix: props.prefix,
|
|
@@ -114,23 +113,22 @@ export const GroupingMappingContext = (props) => {
|
|
|
114
113
|
const propertiesContextValue = useMemo(() => ({
|
|
115
114
|
showGroupColor: propertiesShowGroup,
|
|
116
115
|
setShowGroupColor: setPropertiesShowGroup,
|
|
117
|
-
|
|
118
|
-
setGroupProperties,
|
|
119
|
-
calculatedProperties,
|
|
120
|
-
setCalculatedProperties,
|
|
121
|
-
customCalculationProperties,
|
|
122
|
-
setCustomCalculationProperties,
|
|
123
|
-
}), [calculatedProperties, customCalculationProperties, groupProperties, propertiesShowGroup]);
|
|
116
|
+
}), [propertiesShowGroup]);
|
|
124
117
|
const customUIContextValue = useMemo(() => ({
|
|
125
118
|
customUIs,
|
|
126
119
|
setCustomUIs,
|
|
127
120
|
}), [customUIs]);
|
|
121
|
+
const extractionStateJobContextValue = useMemo(() => ({
|
|
122
|
+
mappingIdJobInfo,
|
|
123
|
+
setMappingIdJobInfo,
|
|
124
|
+
}), [mappingIdJobInfo]);
|
|
128
125
|
return (React.createElement(QueryClientProvider, { client: queryClient },
|
|
129
126
|
React.createElement(GroupingMappingApiConfigContext.Provider, { value: apiConfig },
|
|
130
127
|
React.createElement(MappingClientContext.Provider, { value: mappingClient },
|
|
131
128
|
React.createElement(ExtractionClientContext.Provider, { value: extractionClient },
|
|
132
|
-
React.createElement(
|
|
133
|
-
React.createElement(
|
|
134
|
-
React.createElement(
|
|
129
|
+
React.createElement(ExtractionStatusJobContext.Provider, { value: extractionStateJobContextValue },
|
|
130
|
+
React.createElement(GroupingMappingCustomUIContext.Provider, { value: customUIContextValue },
|
|
131
|
+
React.createElement(GroupHilitedElementsContext.Provider, { value: hilitedElementsContextValue },
|
|
132
|
+
React.createElement(PropertiesGroupColorContext.Provider, { value: propertiesContextValue }, props.children)))))))));
|
|
135
133
|
};
|
|
136
134
|
//# sourceMappingURL=GroupingMappingContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingMappingContext.js","sourceRoot":"","sources":["../../../src/components/GroupingMappingContext.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAMjD,OAAO,EAAE,+BAA+B,EAAE,MAAM,oCAAoC,CAAC;AACrF,OAAO,EACL,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,MAAM,0CAA0C,CAAC;AAGzH,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAEpG,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACpG,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAuCxC,MAAM,i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AAE,aAAa;gBACjD,oBAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,gBAAgB;oBACvD,oBAAC,8BAA8B,CAAC,QAAQ,IAAC,KAAK,EAAE,oBAAoB;wBAClE,oBAAC,2BAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,2BAA2B;4BACtE,oBAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,sBAAsB,IACtD,KAAK,CAAC,QAAQ,CACY,CACQ,CACC,CACT,CACL,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 {\n ClientPrefix,\n GetAccessTokenFn,\n GroupingMappingApiConfig,\n} from \"./context/GroupingApiConfigContext\";\nimport { GroupingMappingApiConfigContext } from \"./context/GroupingApiConfigContext\";\nimport {\n createMappingClient,\n MappingClientContext,\n} from \"./context/MappingClientContext\";\nimport type { CalculatedProperty, CustomCalculation, Group, GroupProperty, IExtractionClient, IMappingsClient } 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 { PropertiesContext } from \"./context/PropertiesContext\";\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\";\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 {@link client} is not provided.\n */\n prefix?: ClientPrefix;\n /**\n * A custom implementation of MappingClient.\n */\n client?: IMappingsClient;\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 () =>\n (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)\n toaster.negative(getErrorMessage(error.status));\n else\n toaster.negative(\"An error occurred while fetching data.\");\n }\n }\n },\n }),\n mutationCache: new MutationCache({\n onError: (error: any) => {\n if (error.status)\n toaster.negative(getErrorMessage(error.status));\n else\n toaster.negative(\"A network error occured while processing this action.\");\n },\n }),\n});\n\nexport const GroupingMappingContext = (props: GroupingMappingContextProps) => {\n const activeIModelConntextion = useActiveIModelConnection();\n const clientProp: IMappingsClient | ClientPrefix = props.client ?? props.prefix;\n const extractionClientProp: IExtractionClient | ClientPrefix = props.extractionClient ?? props.prefix;\n const [mappingClient, setMappingClient] = useState<IMappingsClient>(createMappingClient(clientProp));\n const [extractionClient, setExtractionClient] = useState<IExtractionClient>(createExtractionClient(extractionClientProp));\n const [customUIs, setCustomUIs] = useState<GroupingMappingCustomUI[]>(\n createGroupingMappingCustomUI(props.customUIs),\n );\n const [apiConfig, setApiConfig] = useState<GroupingMappingApiConfig>({\n getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,\n iModelId: props.iModelId,\n prefix: props.prefix,\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 [groupProperties, setGroupProperties] = useState<GroupProperty[]>([]);\n const [calculatedProperties, setCalculatedProperties] = useState<CalculatedProperty[]>([]);\n const [customCalculationProperties, setCustomCalculationProperties] = useState<CustomCalculation[]>([]);\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\n useEffect(() => {\n setApiConfig(() => ({\n prefix: props.prefix,\n iModelId: props.iModelId,\n getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,\n iModelConnection: props.iModelConnection ?? activeIModelConntextion,\n }));\n }, [activeIModelConntextion, props.getAccessToken, props.iModelConnection, props.iModelId, props.prefix]);\n\n useEffect(() => {\n setMappingClient(createMappingClient(clientProp));\n }, [clientProp]);\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 [showGroupColor, hiddenGroupsIds, groups, numberOfVisualizedGroups, isOverlappedColored, currentHilitedGroups, isVisualizationsEnabled, overlappedElementsMetadata]\n );\n\n const propertiesContextValue = useMemo(\n () => ({\n showGroupColor: propertiesShowGroup,\n setShowGroupColor: setPropertiesShowGroup,\n groupProperties,\n setGroupProperties,\n calculatedProperties,\n setCalculatedProperties,\n customCalculationProperties,\n setCustomCalculationProperties,\n }),\n [calculatedProperties, customCalculationProperties, groupProperties, propertiesShowGroup]\n );\n\n const customUIContextValue = useMemo(() => ({\n customUIs,\n setCustomUIs,\n }), [customUIs]);\n\n return (\n <QueryClientProvider client={queryClient}>\n <GroupingMappingApiConfigContext.Provider value={apiConfig}>\n <MappingClientContext.Provider value={mappingClient}>\n <ExtractionClientContext.Provider value={extractionClient}>\n <GroupingMappingCustomUIContext.Provider value={customUIContextValue}>\n <GroupHilitedElementsContext.Provider value={hilitedElementsContextValue}>\n <PropertiesContext.Provider value={propertiesContextValue}>\n {props.children}\n </PropertiesContext.Provider>\n </GroupHilitedElementsContext.Provider>\n </GroupingMappingCustomUIContext.Provider>\n </ExtractionClientContext.Provider>\n </MappingClientContext.Provider>\n </GroupingMappingApiConfigContext.Provider>\n </QueryClientProvider>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"GroupingMappingContext.js","sourceRoot":"","sources":["../../../src/components/GroupingMappingContext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BAA6B;KAC9B,CAAC,EACF,CAAC,cAAc,EAAE,eAAe,EAAE,MAAM,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,0BAA0B,CAAC,CACpK,CAAC;IAEF,MAAM,sBAAsB,GAAG,OAAO,CACpC,GAAG,EAAE,CAAC,CAAC;QACL,cAAc,EAAE,mBAAmB;QACnC,iBAAiB,EAAE,sBAAsB;KAC1C,CAAC,EACF,CAAC,mBAAmB,CAAC,CACtB,CAAC;IAEF,MAAM,oBAAoB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC1C,SAAS;QACT,YAAY;KACb,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEjB,MAAM,8BAA8B,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACpD,gBAAgB;QAChB,mBAAmB;KACpB,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAExB,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,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,gBAAgB;oBACvD,oBAAC,0BAA0B,CAAC,QAAQ,IAAC,KAAK,EAAE,8BAA8B;wBACxE,oBAAC,8BAA8B,CAAC,QAAQ,IAAC,KAAK,EAAE,oBAAoB;4BAClE,oBAAC,2BAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,2BAA2B;gCACtE,oBAAC,2BAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,sBAAsB,IAChE,KAAK,CAAC,QAAQ,CACsB,CACF,CACC,CACN,CACL,CACL,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 {\n ClientPrefix,\n GetAccessTokenFn,\n GroupingMappingApiConfig,\n} from \"./context/GroupingApiConfigContext\";\nimport { GroupingMappingApiConfigContext } from \"./context/GroupingApiConfigContext\";\nimport {\n createMappingClient,\n MappingClientContext,\n} from \"./context/MappingClientContext\";\nimport type { Group, IExtractionClient, IMappingsClient } 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\";\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 {@link client} is not provided.\n */\n prefix?: ClientPrefix;\n /**\n * A custom implementation of MappingClient.\n */\n client?: IMappingsClient;\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 () =>\n (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)\n toaster.negative(getErrorMessage(error.status));\n else\n toaster.negative(\"An error occurred while fetching data.\");\n }\n }\n },\n }),\n mutationCache: new MutationCache({\n onError: (error: any) => {\n if (error.status)\n toaster.negative(getErrorMessage(error.status));\n else\n toaster.negative(\"A network error occured while processing this action.\");\n },\n }),\n});\n\nexport const GroupingMappingContext = (props: GroupingMappingContextProps) => {\n const activeIModelConntextion = useActiveIModelConnection();\n const clientProp: IMappingsClient | ClientPrefix = props.client ?? props.prefix;\n const extractionClientProp: IExtractionClient | ClientPrefix = props.extractionClient ?? props.prefix;\n const [mappingClient, setMappingClient] = useState<IMappingsClient>(createMappingClient(clientProp));\n const [extractionClient, setExtractionClient] = useState<IExtractionClient>(createExtractionClient(extractionClientProp));\n const [customUIs, setCustomUIs] = useState<GroupingMappingCustomUI[]>(\n createGroupingMappingCustomUI(props.customUIs),\n );\n const [apiConfig, setApiConfig] = useState<GroupingMappingApiConfig>({\n getAccessToken: props.getAccessToken ?? authorizationClientGetAccessToken,\n iModelId: props.iModelId,\n prefix: props.prefix,\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 ?? activeIModelConntextion,\n }));\n }, [activeIModelConntextion, props.getAccessToken, props.iModelConnection, props.iModelId, props.prefix]);\n\n useEffect(() => {\n setMappingClient(createMappingClient(clientProp));\n }, [clientProp]);\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 [showGroupColor, hiddenGroupsIds, groups, numberOfVisualizedGroups, isOverlappedColored, currentHilitedGroups, isVisualizationsEnabled, overlappedElementsMetadata]\n );\n\n const propertiesContextValue = useMemo(\n () => ({\n showGroupColor: propertiesShowGroup,\n setShowGroupColor: setPropertiesShowGroup,\n }),\n [propertiesShowGroup]\n );\n\n const customUIContextValue = useMemo(() => ({\n customUIs,\n setCustomUIs,\n }), [customUIs]);\n\n const extractionStateJobContextValue = useMemo(() => ({\n mappingIdJobInfo,\n setMappingIdJobInfo,\n }), [mappingIdJobInfo]);\n\n return (\n <QueryClientProvider client={queryClient}>\n <GroupingMappingApiConfigContext.Provider value={apiConfig}>\n <MappingClientContext.Provider value={mappingClient}>\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}>\n {props.children}\n </PropertiesGroupColorContext.Provider>\n </GroupHilitedElementsContext.Provider>\n </GroupingMappingCustomUIContext.Provider>\n </ExtractionStatusJobContext.Provider>\n </ExtractionClientContext.Provider>\n </MappingClientContext.Provider>\n </GroupingMappingApiConfigContext.Provider>\n </QueryClientProvider>\n );\n};\n"]}
|