@itwin/grouping-mapping-widget 0.25.2 → 0.26.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/GroupingMapping.d.ts +5 -5
- package/lib/cjs/WidgetShell/GroupingMapping.js.map +1 -1
- package/lib/cjs/WidgetShell/GroupingMappingWidget.d.ts +4 -0
- package/lib/cjs/WidgetShell/GroupingMappingWidget.js +4 -0
- package/lib/cjs/WidgetShell/GroupingMappingWidget.js.map +1 -1
- package/lib/cjs/components/GroupingMappingContext.d.ts +19 -3
- package/lib/cjs/components/GroupingMappingContext.js +27 -9
- package/lib/cjs/components/GroupingMappingContext.js.map +1 -1
- package/lib/cjs/components/Groups/Editing/GroupAction.d.ts +10 -2
- package/lib/cjs/components/Groups/Editing/GroupAction.js +9 -5
- package/lib/cjs/components/Groups/Editing/GroupAction.js.map +1 -1
- package/lib/cjs/components/Groups/GroupColorLegend.d.ts +3 -3
- package/lib/cjs/components/Groups/GroupColorLegend.js.map +1 -1
- package/lib/cjs/components/Groups/GroupListItem.d.ts +4 -4
- package/lib/cjs/components/Groups/GroupListItem.js +6 -3
- package/lib/cjs/components/Groups/GroupListItem.js.map +1 -1
- package/lib/cjs/components/Groups/GroupListItem.scss +14 -0
- package/lib/cjs/components/Groups/GroupMenuActions.d.ts +4 -4
- package/lib/cjs/components/Groups/GroupMenuActions.js.map +1 -1
- package/lib/cjs/components/Groups/GroupMenuActions.scss +2 -0
- package/lib/cjs/components/Groups/GroupOverlapProgressBar.d.ts +2 -2
- package/lib/cjs/components/Groups/GroupOverlapProgressBar.js.map +1 -1
- package/lib/cjs/components/Groups/Groups.d.ts +12 -4
- package/lib/cjs/components/Groups/Groups.js +4 -0
- package/lib/cjs/components/Groups/Groups.js.map +1 -1
- package/lib/cjs/components/Groups/GroupsShowHideButtons.d.ts +4 -4
- package/lib/cjs/components/Groups/GroupsShowHideButtons.js.map +1 -1
- package/lib/cjs/components/Groups/GroupsView.d.ts +19 -11
- package/lib/cjs/components/Groups/GroupsView.js +4 -0
- package/lib/cjs/components/Groups/GroupsView.js.map +1 -1
- package/lib/cjs/components/Groups/GroupsVisualization.d.ts +8 -0
- package/lib/cjs/components/Groups/GroupsVisualization.js +8 -4
- package/lib/cjs/components/Groups/GroupsVisualization.js.map +1 -1
- package/lib/cjs/components/Groups/OverlappedElementsInformationPanel.d.ts +3 -3
- package/lib/cjs/components/Groups/OverlappedElementsInformationPanel.js.map +1 -1
- package/lib/cjs/components/Groups/QueryBuilder/QueryBuilderCustomUI.d.ts +2 -2
- package/lib/cjs/components/Groups/QueryBuilder/QueryBuilderCustomUI.js.map +1 -1
- package/lib/cjs/components/Groups/groupsHelpers.d.ts +2 -2
- package/lib/cjs/components/Groups/groupsHelpers.js.map +1 -1
- package/lib/cjs/components/Groups/hooks/useFetchGroups.d.ts +3 -3
- package/lib/cjs/components/Groups/hooks/useFetchGroups.js +6 -5
- package/lib/cjs/components/Groups/hooks/useFetchGroups.js.map +1 -1
- package/lib/cjs/components/Groups/hooks/useGroupsOperations.d.ts +15 -7
- package/lib/cjs/components/Groups/hooks/useGroupsOperations.js +9 -5
- package/lib/cjs/components/Groups/hooks/useGroupsOperations.js.map +1 -1
- package/lib/cjs/components/Groups/hooks/useKeySetHiliteQueries.d.ts +4 -4
- package/lib/cjs/components/Groups/hooks/useKeySetHiliteQueries.js.map +1 -1
- package/lib/cjs/components/Mappings/Editing/MappingAction.d.ts +8 -0
- package/lib/cjs/components/Mappings/Editing/MappingAction.js +7 -2
- package/lib/cjs/components/Mappings/Editing/MappingAction.js.map +1 -1
- package/lib/cjs/components/Mappings/Extraction/ExtractionMessageModal.js +3 -1
- package/lib/cjs/components/Mappings/Extraction/ExtractionMessageModal.js.map +1 -1
- package/lib/cjs/components/Mappings/Import/ConfirmMappingsImport.d.ts +1 -2
- package/lib/cjs/components/Mappings/Import/ConfirmMappingsImport.js +4 -3
- package/lib/cjs/components/Mappings/Import/ConfirmMappingsImport.js.map +1 -1
- package/lib/cjs/components/Mappings/Import/MappingImportWizardModal.js +1 -1
- package/lib/cjs/components/Mappings/Import/MappingImportWizardModal.js.map +1 -1
- package/lib/cjs/components/Mappings/Mappings.d.ts +8 -0
- package/lib/cjs/components/Mappings/Mappings.js +4 -0
- package/lib/cjs/components/Mappings/Mappings.js.map +1 -1
- package/lib/cjs/components/Mappings/MappingsView.d.ts +7 -0
- package/lib/cjs/components/Mappings/MappingsView.js +4 -0
- package/lib/cjs/components/Mappings/MappingsView.js.map +1 -1
- package/lib/cjs/components/Mappings/hooks/useFetchExtractionStatus.d.ts +1 -2
- package/lib/cjs/components/Mappings/hooks/useFetchExtractionStatus.js +9 -8
- package/lib/cjs/components/Mappings/hooks/useFetchExtractionStatus.js.map +1 -1
- package/lib/cjs/components/Mappings/hooks/useFetchMappingExtractionStatus.js +5 -4
- package/lib/cjs/components/Mappings/hooks/useFetchMappingExtractionStatus.js.map +1 -1
- package/lib/cjs/components/Mappings/hooks/useFetchMappings.js +1 -1
- package/lib/cjs/components/Mappings/hooks/useFetchMappings.js.map +1 -1
- package/lib/cjs/components/Mappings/hooks/useMappingsOperations.d.ts +9 -2
- package/lib/cjs/components/Mappings/hooks/useMappingsOperations.js +12 -8
- package/lib/cjs/components/Mappings/hooks/useMappingsOperations.js.map +1 -1
- package/lib/cjs/components/Mappings/hooks/useRunExtraction.d.ts +1 -1
- package/lib/cjs/components/Mappings/hooks/useRunExtraction.js +20 -14
- package/lib/cjs/components/Mappings/hooks/useRunExtraction.js.map +1 -1
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.d.ts +10 -2
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.js +20 -7
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.js.map +1 -1
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.d.ts +11 -3
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js +19 -7
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js.map +1 -1
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.d.ts +3 -3
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.js +6 -4
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.js.map +1 -1
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.d.ts +10 -2
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.js +52 -34
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.js.map +1 -1
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.d.ts +3 -3
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.js +6 -4
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.js.map +1 -1
- package/lib/cjs/components/Properties/GroupColorToggle.d.ts +2 -2
- package/lib/cjs/components/Properties/GroupColorToggle.js.map +1 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.d.ts +12 -4
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js +24 -18
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.d.ts +3 -3
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.js +6 -4
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.js.map +1 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyUtils.d.ts +3 -5
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyUtils.js +0 -26
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyUtils.js.map +1 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js +3 -3
- package/lib/cjs/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js.map +1 -1
- package/lib/cjs/components/Properties/PropertyMenu.d.ts +13 -5
- package/lib/cjs/components/Properties/PropertyMenu.js +12 -14
- package/lib/cjs/components/Properties/PropertyMenu.js.map +1 -1
- package/lib/cjs/components/Properties/PropertyMenuWithVisualization.d.ts +8 -0
- package/lib/cjs/components/Properties/PropertyMenuWithVisualization.js +4 -0
- package/lib/cjs/components/Properties/PropertyMenuWithVisualization.js.map +1 -1
- package/lib/cjs/components/Properties/hooks/useFormulaValidation.d.ts +2 -1
- package/lib/cjs/components/Properties/hooks/useFormulaValidation.js +8 -4
- package/lib/cjs/components/Properties/hooks/useFormulaValidation.js.map +1 -1
- package/lib/cjs/components/Properties/hooks/usePropertiesQuery.d.ts +4 -0
- package/lib/cjs/components/Properties/hooks/usePropertiesQuery.js +12 -0
- package/lib/cjs/components/Properties/hooks/usePropertiesQuery.js.map +1 -0
- package/lib/cjs/components/context/ExtractionClientContext.js +3 -3
- package/lib/cjs/components/context/ExtractionClientContext.js.map +1 -1
- package/lib/cjs/components/context/GroupingApiConfigContext.d.ts +16 -0
- package/lib/cjs/components/context/GroupingApiConfigContext.js +7 -0
- package/lib/cjs/components/context/GroupingApiConfigContext.js.map +1 -1
- package/lib/cjs/components/context/GroupsClientContext.d.ts +20 -0
- package/lib/cjs/components/context/GroupsClientContext.js +45 -0
- package/lib/cjs/components/context/GroupsClientContext.js.map +1 -0
- package/lib/cjs/components/context/MappingClientContext.d.ts +12 -0
- package/lib/cjs/components/context/MappingClientContext.js +14 -2
- package/lib/cjs/components/context/MappingClientContext.js.map +1 -1
- package/lib/cjs/components/context/PropertiesClientContext.d.ts +20 -0
- package/lib/cjs/components/context/PropertiesClientContext.js +45 -0
- package/lib/cjs/components/context/PropertiesClientContext.js.map +1 -0
- package/lib/cjs/components/customUI/GroupQueryBuilderCustomUI.d.ts +4 -0
- package/lib/cjs/components/customUI/GroupQueryBuilderCustomUI.js +4 -0
- package/lib/cjs/components/customUI/GroupQueryBuilderCustomUI.js.map +1 -1
- package/lib/cjs/components/customUI/GroupingMappingCustomUI.d.ts +15 -3
- package/lib/cjs/components/customUI/GroupingMappingCustomUI.js +3 -0
- package/lib/cjs/components/customUI/GroupingMappingCustomUI.js.map +1 -1
- package/lib/cjs/components/customUI/ManualGroupingCustomUI.d.ts +4 -0
- package/lib/cjs/components/customUI/ManualGroupingCustomUI.js +4 -0
- package/lib/cjs/components/customUI/ManualGroupingCustomUI.js.map +1 -1
- package/lib/cjs/components/customUI/SearchGroupingCustomUI.d.ts +4 -0
- package/lib/cjs/components/customUI/SearchGroupingCustomUI.js +4 -0
- package/lib/cjs/components/customUI/SearchGroupingCustomUI.js.map +1 -1
- package/lib/cjs/formula/FormulaDataTypeResolver.d.ts +1 -0
- package/lib/cjs/formula/FormulaDataTypeResolver.js +1 -0
- package/lib/cjs/formula/FormulaDataTypeResolver.js.map +1 -1
- package/lib/cjs/formula/FormulaFunctionProvider.js +41 -41
- package/lib/cjs/formula/FormulaFunctionProvider.js.map +1 -1
- package/lib/cjs/formula/FormulaOperatorsProvider.js +3 -3
- package/lib/cjs/formula/FormulaOperatorsProvider.js.map +1 -1
- package/lib/cjs/formula/FormulaTokensDataTypeResolver.js +2 -2
- package/lib/cjs/formula/FormulaTokensDataTypeResolver.js.map +1 -1
- package/lib/cjs/formula/IResult.d.ts +3 -0
- package/lib/cjs/formula/IResult.js.map +1 -1
- package/lib/cjs/formula/Types.d.ts +16 -1
- package/lib/cjs/formula/Types.js.map +1 -1
- package/lib/cjs/grouping-mapping-widget.d.ts +2 -0
- package/lib/cjs/grouping-mapping-widget.js +11 -1
- package/lib/cjs/grouping-mapping-widget.js.map +1 -1
- package/lib/cjs/test/GroupPropertyUtils.test.js +0 -39
- package/lib/cjs/test/GroupPropertyUtils.test.js.map +1 -1
- package/lib/cjs/test/GroupingMappingCustomUI.test.js +19 -8
- package/lib/cjs/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/lib/esm/WidgetShell/GroupingMapping.d.ts +5 -5
- package/lib/esm/WidgetShell/GroupingMapping.js.map +1 -1
- package/lib/esm/WidgetShell/GroupingMappingWidget.d.ts +4 -0
- package/lib/esm/WidgetShell/GroupingMappingWidget.js +4 -0
- package/lib/esm/WidgetShell/GroupingMappingWidget.js.map +1 -1
- package/lib/esm/components/GroupingMappingContext.d.ts +19 -3
- package/lib/esm/components/GroupingMappingContext.js +27 -9
- package/lib/esm/components/GroupingMappingContext.js.map +1 -1
- package/lib/esm/components/Groups/Editing/GroupAction.d.ts +10 -2
- package/lib/esm/components/Groups/Editing/GroupAction.js +9 -5
- package/lib/esm/components/Groups/Editing/GroupAction.js.map +1 -1
- package/lib/esm/components/Groups/GroupColorLegend.d.ts +3 -3
- package/lib/esm/components/Groups/GroupColorLegend.js.map +1 -1
- package/lib/esm/components/Groups/GroupListItem.d.ts +4 -4
- package/lib/esm/components/Groups/GroupListItem.js +6 -3
- package/lib/esm/components/Groups/GroupListItem.js.map +1 -1
- package/lib/esm/components/Groups/GroupListItem.scss +14 -0
- package/lib/esm/components/Groups/GroupMenuActions.d.ts +4 -4
- package/lib/esm/components/Groups/GroupMenuActions.js.map +1 -1
- package/lib/esm/components/Groups/GroupMenuActions.scss +2 -0
- package/lib/esm/components/Groups/GroupOverlapProgressBar.d.ts +2 -2
- package/lib/esm/components/Groups/GroupOverlapProgressBar.js.map +1 -1
- package/lib/esm/components/Groups/Groups.d.ts +12 -4
- package/lib/esm/components/Groups/Groups.js +4 -0
- package/lib/esm/components/Groups/Groups.js.map +1 -1
- package/lib/esm/components/Groups/GroupsShowHideButtons.d.ts +4 -4
- package/lib/esm/components/Groups/GroupsShowHideButtons.js.map +1 -1
- package/lib/esm/components/Groups/GroupsView.d.ts +19 -11
- package/lib/esm/components/Groups/GroupsView.js +4 -0
- package/lib/esm/components/Groups/GroupsView.js.map +1 -1
- package/lib/esm/components/Groups/GroupsVisualization.d.ts +8 -0
- package/lib/esm/components/Groups/GroupsVisualization.js +8 -4
- package/lib/esm/components/Groups/GroupsVisualization.js.map +1 -1
- package/lib/esm/components/Groups/OverlappedElementsInformationPanel.d.ts +3 -3
- package/lib/esm/components/Groups/OverlappedElementsInformationPanel.js.map +1 -1
- package/lib/esm/components/Groups/QueryBuilder/QueryBuilderCustomUI.d.ts +2 -2
- package/lib/esm/components/Groups/QueryBuilder/QueryBuilderCustomUI.js.map +1 -1
- package/lib/esm/components/Groups/groupsHelpers.d.ts +2 -2
- package/lib/esm/components/Groups/groupsHelpers.js.map +1 -1
- package/lib/esm/components/Groups/hooks/useFetchGroups.d.ts +3 -3
- package/lib/esm/components/Groups/hooks/useFetchGroups.js +6 -5
- package/lib/esm/components/Groups/hooks/useFetchGroups.js.map +1 -1
- package/lib/esm/components/Groups/hooks/useGroupsOperations.d.ts +15 -7
- package/lib/esm/components/Groups/hooks/useGroupsOperations.js +9 -5
- package/lib/esm/components/Groups/hooks/useGroupsOperations.js.map +1 -1
- package/lib/esm/components/Groups/hooks/useKeySetHiliteQueries.d.ts +4 -4
- package/lib/esm/components/Groups/hooks/useKeySetHiliteQueries.js.map +1 -1
- package/lib/esm/components/Mappings/Editing/MappingAction.d.ts +8 -0
- package/lib/esm/components/Mappings/Editing/MappingAction.js +7 -2
- package/lib/esm/components/Mappings/Editing/MappingAction.js.map +1 -1
- package/lib/esm/components/Mappings/Extraction/ExtractionMessageModal.js +3 -1
- package/lib/esm/components/Mappings/Extraction/ExtractionMessageModal.js.map +1 -1
- package/lib/esm/components/Mappings/Import/ConfirmMappingsImport.d.ts +1 -2
- package/lib/esm/components/Mappings/Import/ConfirmMappingsImport.js +4 -3
- package/lib/esm/components/Mappings/Import/ConfirmMappingsImport.js.map +1 -1
- package/lib/esm/components/Mappings/Import/MappingImportWizardModal.js +1 -1
- package/lib/esm/components/Mappings/Import/MappingImportWizardModal.js.map +1 -1
- package/lib/esm/components/Mappings/Mappings.d.ts +8 -0
- package/lib/esm/components/Mappings/Mappings.js +4 -0
- package/lib/esm/components/Mappings/Mappings.js.map +1 -1
- package/lib/esm/components/Mappings/MappingsView.d.ts +7 -0
- package/lib/esm/components/Mappings/MappingsView.js +4 -0
- package/lib/esm/components/Mappings/MappingsView.js.map +1 -1
- package/lib/esm/components/Mappings/hooks/useFetchExtractionStatus.d.ts +1 -2
- package/lib/esm/components/Mappings/hooks/useFetchExtractionStatus.js +9 -8
- package/lib/esm/components/Mappings/hooks/useFetchExtractionStatus.js.map +1 -1
- package/lib/esm/components/Mappings/hooks/useFetchMappingExtractionStatus.js +6 -5
- package/lib/esm/components/Mappings/hooks/useFetchMappingExtractionStatus.js.map +1 -1
- package/lib/esm/components/Mappings/hooks/useFetchMappings.js +1 -1
- package/lib/esm/components/Mappings/hooks/useFetchMappings.js.map +1 -1
- package/lib/esm/components/Mappings/hooks/useMappingsOperations.d.ts +9 -2
- package/lib/esm/components/Mappings/hooks/useMappingsOperations.js +13 -9
- package/lib/esm/components/Mappings/hooks/useMappingsOperations.js.map +1 -1
- package/lib/esm/components/Mappings/hooks/useRunExtraction.d.ts +1 -1
- package/lib/esm/components/Mappings/hooks/useRunExtraction.js +20 -14
- package/lib/esm/components/Mappings/hooks/useRunExtraction.js.map +1 -1
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.d.ts +10 -2
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.js +21 -8
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.js.map +1 -1
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.d.ts +11 -3
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js +20 -8
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyActionWithVisuals.js.map +1 -1
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.d.ts +3 -3
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.js +6 -4
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.js.map +1 -1
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.d.ts +10 -2
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.js +53 -35
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.js.map +1 -1
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.d.ts +3 -3
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.js +6 -4
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.js.map +1 -1
- package/lib/esm/components/Properties/GroupColorToggle.d.ts +2 -2
- package/lib/esm/components/Properties/GroupColorToggle.js.map +1 -1
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.d.ts +12 -4
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js +24 -18
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.d.ts +3 -3
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.js +6 -4
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.js.map +1 -1
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyUtils.d.ts +3 -5
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyUtils.js +0 -26
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyUtils.js.map +1 -1
- package/lib/esm/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js +3 -3
- package/lib/esm/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js.map +1 -1
- package/lib/esm/components/Properties/PropertyMenu.d.ts +13 -5
- package/lib/esm/components/Properties/PropertyMenu.js +12 -14
- package/lib/esm/components/Properties/PropertyMenu.js.map +1 -1
- package/lib/esm/components/Properties/PropertyMenuWithVisualization.d.ts +8 -0
- package/lib/esm/components/Properties/PropertyMenuWithVisualization.js +4 -0
- package/lib/esm/components/Properties/PropertyMenuWithVisualization.js.map +1 -1
- package/lib/esm/components/Properties/hooks/useFormulaValidation.d.ts +2 -1
- package/lib/esm/components/Properties/hooks/useFormulaValidation.js +8 -4
- package/lib/esm/components/Properties/hooks/useFormulaValidation.js.map +1 -1
- package/lib/esm/components/Properties/hooks/usePropertiesQuery.d.ts +4 -0
- package/lib/esm/components/Properties/hooks/usePropertiesQuery.js +8 -0
- package/lib/esm/components/Properties/hooks/usePropertiesQuery.js.map +1 -0
- package/lib/esm/components/context/ExtractionClientContext.js +3 -3
- package/lib/esm/components/context/ExtractionClientContext.js.map +1 -1
- package/lib/esm/components/context/GroupingApiConfigContext.d.ts +16 -0
- package/lib/esm/components/context/GroupingApiConfigContext.js +7 -0
- package/lib/esm/components/context/GroupingApiConfigContext.js.map +1 -1
- package/lib/esm/components/context/GroupsClientContext.d.ts +20 -0
- package/lib/esm/components/context/GroupsClientContext.js +39 -0
- package/lib/esm/components/context/GroupsClientContext.js.map +1 -0
- package/lib/esm/components/context/MappingClientContext.d.ts +12 -0
- package/lib/esm/components/context/MappingClientContext.js +15 -3
- package/lib/esm/components/context/MappingClientContext.js.map +1 -1
- package/lib/esm/components/context/PropertiesClientContext.d.ts +20 -0
- package/lib/esm/components/context/PropertiesClientContext.js +39 -0
- package/lib/esm/components/context/PropertiesClientContext.js.map +1 -0
- package/lib/esm/components/customUI/GroupQueryBuilderCustomUI.d.ts +4 -0
- package/lib/esm/components/customUI/GroupQueryBuilderCustomUI.js +4 -0
- package/lib/esm/components/customUI/GroupQueryBuilderCustomUI.js.map +1 -1
- package/lib/esm/components/customUI/GroupingMappingCustomUI.d.ts +15 -3
- package/lib/esm/components/customUI/GroupingMappingCustomUI.js +3 -0
- package/lib/esm/components/customUI/GroupingMappingCustomUI.js.map +1 -1
- package/lib/esm/components/customUI/ManualGroupingCustomUI.d.ts +4 -0
- package/lib/esm/components/customUI/ManualGroupingCustomUI.js +4 -0
- package/lib/esm/components/customUI/ManualGroupingCustomUI.js.map +1 -1
- package/lib/esm/components/customUI/SearchGroupingCustomUI.d.ts +4 -0
- package/lib/esm/components/customUI/SearchGroupingCustomUI.js +4 -0
- package/lib/esm/components/customUI/SearchGroupingCustomUI.js.map +1 -1
- package/lib/esm/formula/FormulaDataTypeResolver.d.ts +1 -0
- package/lib/esm/formula/FormulaDataTypeResolver.js +1 -0
- package/lib/esm/formula/FormulaDataTypeResolver.js.map +1 -1
- package/lib/esm/formula/FormulaFunctionProvider.js +41 -41
- package/lib/esm/formula/FormulaFunctionProvider.js.map +1 -1
- package/lib/esm/formula/FormulaOperatorsProvider.js +3 -3
- package/lib/esm/formula/FormulaOperatorsProvider.js.map +1 -1
- package/lib/esm/formula/FormulaTokensDataTypeResolver.js +2 -2
- package/lib/esm/formula/FormulaTokensDataTypeResolver.js.map +1 -1
- package/lib/esm/formula/IResult.d.ts +3 -0
- package/lib/esm/formula/IResult.js.map +1 -1
- package/lib/esm/formula/Types.d.ts +16 -1
- package/lib/esm/formula/Types.js.map +1 -1
- package/lib/esm/grouping-mapping-widget.d.ts +2 -0
- package/lib/esm/grouping-mapping-widget.js +2 -0
- package/lib/esm/grouping-mapping-widget.js.map +1 -1
- package/lib/esm/test/GroupPropertyUtils.test.js +0 -39
- package/lib/esm/test/GroupPropertyUtils.test.js.map +1 -1
- package/lib/esm/test/GroupingMappingCustomUI.test.js +19 -8
- package/lib/esm/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/package.json +3 -2
- package/lib/cjs/components/Properties/hooks/useCalculatedPropertiesQuery.d.ts +0 -4
- package/lib/cjs/components/Properties/hooks/useCalculatedPropertiesQuery.js +0 -12
- package/lib/cjs/components/Properties/hooks/useCalculatedPropertiesQuery.js.map +0 -1
- package/lib/cjs/components/Properties/hooks/useCustomCalculationsQuery.d.ts +0 -4
- package/lib/cjs/components/Properties/hooks/useCustomCalculationsQuery.js +0 -12
- package/lib/cjs/components/Properties/hooks/useCustomCalculationsQuery.js.map +0 -1
- package/lib/cjs/components/Properties/hooks/useGroupPropertiesQuery.d.ts +0 -4
- package/lib/cjs/components/Properties/hooks/useGroupPropertiesQuery.js +0 -12
- package/lib/cjs/components/Properties/hooks/useGroupPropertiesQuery.js.map +0 -1
- package/lib/esm/components/Properties/hooks/useCalculatedPropertiesQuery.d.ts +0 -4
- package/lib/esm/components/Properties/hooks/useCalculatedPropertiesQuery.js +0 -8
- package/lib/esm/components/Properties/hooks/useCalculatedPropertiesQuery.js.map +0 -1
- package/lib/esm/components/Properties/hooks/useCustomCalculationsQuery.d.ts +0 -4
- package/lib/esm/components/Properties/hooks/useCustomCalculationsQuery.js +0 -8
- package/lib/esm/components/Properties/hooks/useCustomCalculationsQuery.js.map +0 -1
- package/lib/esm/components/Properties/hooks/useGroupPropertiesQuery.d.ts +0 -4
- package/lib/esm/components/Properties/hooks/useGroupPropertiesQuery.js +0 -8
- package/lib/esm/components/Properties/hooks/useGroupPropertiesQuery.js.map +0 -1
|
@@ -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,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,CAA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,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(\"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"]}
|
|
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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,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 { GroupMinimalList, IGroupsClient, 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 = (): GroupMinimalList => ({\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>();\nconst groupsClientMock = moq.Mock.ofType<IGroupsClient>();\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 const actualMappingContextModule = jest.requireActual(\"../components/context/MappingClientContext\");\n return {\n ...actualMappingContextModule,\n useMappingClient: () => mappingClientMock.object,\n };\n});\n\njest.mock(\"../components/context/GroupsClientContext\", () => {\n const actualGroupsContextModule = jest.requireActual(\"../components/context/GroupsClientContext\");\n return {\n ...actualGroupsContextModule,\n useGroupsClient: () => groupsClientMock.object,\n };\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 groupsClientMock\n .setup(async (x) => x.getGroups(moq.It.isAny(), moq.It.isAny(), moq.It.isAny()))\n .returns(async () => Promise.resolve(mockGroups));\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"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { GroupMinimal, Mapping, Property } from "@itwin/insights-client";
|
|
3
3
|
import type { GroupingMappingContextProps } from "../components/GroupingMappingContext";
|
|
4
4
|
import "./GroupingMapping.scss";
|
|
5
5
|
import type { ContextCustomUI } from "../components/customUI/GroupingMappingCustomUI";
|
|
@@ -22,10 +22,10 @@ export interface Route {
|
|
|
22
22
|
}
|
|
23
23
|
export interface GroupingRouteFields {
|
|
24
24
|
mapping?: Mapping;
|
|
25
|
-
group?:
|
|
26
|
-
property?:
|
|
27
|
-
calculatedProperty?:
|
|
28
|
-
customCalculation?:
|
|
25
|
+
group?: GroupMinimal;
|
|
26
|
+
property?: Property;
|
|
27
|
+
calculatedProperty?: Property;
|
|
28
|
+
customCalculation?: Property;
|
|
29
29
|
groupContextCustomUI?: Exclude<ContextCustomUI["uiComponent"], undefined>;
|
|
30
30
|
queryGenerationType?: string;
|
|
31
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingMapping.js","sourceRoot":"","sources":["../../../src/WidgetShell/GroupingMapping.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GroupingMapping.js","sourceRoot":"","sources":["../../../src/WidgetShell/GroupingMapping.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,wBAAwB,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAK/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EACL,OAAO,GACR,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAI7E,MAAM,CAAN,IAAY,SAUX;AAVD,WAAY,SAAS;IACnB,iDAAQ,CAAA;IACR,6DAAc,CAAA;IACd,6CAAM,CAAA;IACN,uDAAW,CAAA;IACX,yEAAoB,CAAA;IACpB,qDAAU,CAAA;IACV,6DAAc,CAAA;IACd,iFAAwB,CAAA;IACxB,+FAA+B,CAAA;AACjC,CAAC,EAVW,SAAS,KAAT,SAAS,QAUpB;AAkBD,MAAM,eAAe,GAAG,CAAC,KAA2B,EAAE,EAAE;IACtD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAU;QAC5D,EAAE,IAAI,EAAE,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,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QACD,2DAA2D;QAC3D,GAAG,KAAK,CAAC,SAAS,IAAI,iBAAiB;KACxC,EACD,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,CAC9B,CAAC;IAEF,OAAO,CACL,oBAAC,sBAAsB,IACrB,QAAQ,EAAE,QAAQ,KACd,KAAK,EACT,SAAS,EAAE,gBAAgB;QAE3B,6BAAK,SAAS,EAAC,6BAA6B;YAC1C,oBAAC,qBAAqB,IACpB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,GAC1B;YACF,oBAAC,sBAAsB,IACrB,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,GACd,CACE,CACiB,CAC1B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type {\n GroupMinimal,\n Mapping,\n Property,\n} from \"@itwin/insights-client\";\nimport React, { useCallback, useMemo, useState } from \"react\";\nimport type { GroupingMappingContextProps } from \"../components/GroupingMappingContext\";\nimport { GroupingMappingContext } from \"../components/GroupingMappingContext\";\nimport \"./GroupingMapping.scss\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport type {\n ContextCustomUI,\n GroupingMappingCustomUI,\n} from \"../components/customUI/GroupingMappingCustomUI\";\nimport { GroupingMappingCustomUIType } from \"../components/customUI/GroupingMappingCustomUI\";\nimport {\n SvgList,\n} from \"@itwin/itwinui-icons-react\";\nimport { GroupingMappingContent } from \"./GroupingMappingContent\";\nimport { GroupingMappingHeader } from \"./GroupingMappingHeader\";\nimport { defaultGroupingUI } from \"../components/customUI/DefaultGroupingUI\";\n\nexport type GroupingMappingProps = Omit<GroupingMappingContextProps, \"iModelId\">;\n\nexport enum RouteStep {\n Mappings,\n MappingsAction,\n Groups,\n GroupAction,\n GroupContextCustomUI,\n Properties,\n PropertyAction,\n CalculatedPropertyAction,\n CustomCalculationPropertyAction,\n}\n\nexport interface Route {\n step: RouteStep;\n title: string;\n groupingRouteFields: GroupingRouteFields;\n}\nexport interface GroupingRouteFields {\n mapping?: Mapping;\n group?: GroupMinimal;\n property?: Property;\n calculatedProperty?: Property;\n customCalculation?: Property;\n // Optional prop but cannot be declared undefined.\n groupContextCustomUI?: Exclude<ContextCustomUI[\"uiComponent\"], undefined>;\n queryGenerationType?: string;\n}\n\nconst GroupingMapping = (props: GroupingMappingProps) => {\n const [routingHistory, setRoutingHistory] = useState<Route[]>([\n { step: RouteStep.Mappings, title: \"Mapping\", groupingRouteFields: {} },\n ]);\n const currentRoute = routingHistory[routingHistory.length - 1];\n const activeIModelConnection = useActiveIModelConnection();\n const iModelConnection = props.iModelConnection ?? activeIModelConnection;\n const iModelId = iModelConnection?.iModelId ?? \"\";\n const navigateTo = useCallback((toRoute: (prev: Route | undefined) => Route) => {\n setRoutingHistory((r) => [...r, toRoute(r[r.length - 1])]);\n }, []);\n\n const goBack = useCallback(() => {\n const updatedRouting = [...routingHistory];\n updatedRouting.pop();\n setRoutingHistory(updatedRouting);\n }, [routingHistory]);\n\n const injectedCustomUI = useMemo<GroupingMappingCustomUI[]>(\n () => [\n {\n name: \"Properties\",\n displayLabel: \"Properties\",\n type: GroupingMappingCustomUIType.Context,\n icon: <SvgList />,\n onClick: (group) =>\n navigateTo((prev) => ({\n step: RouteStep.Properties,\n title: group.groupName,\n groupingRouteFields: { ...prev?.groupingRouteFields, group },\n })),\n },\n // No group UI's provided means the widget provides its own\n ...props.customUIs ?? defaultGroupingUI,\n ],\n [props.customUIs, navigateTo]\n );\n\n return (\n <GroupingMappingContext\n iModelId={iModelId}\n {...props}\n customUIs={injectedCustomUI}\n >\n <div className=\"gmw-group-mapping-container\">\n <GroupingMappingHeader\n goBack={goBack}\n currentRoute={currentRoute}\n />\n <GroupingMappingContent\n routingHistory={routingHistory}\n navigateTo={navigateTo}\n goBack={goBack}\n />\n </div>\n </GroupingMappingContext>\n );\n};\n\nexport default GroupingMapping;\n"]}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { UiItemsProvider, Widget } from "@itwin/appui-react";
|
|
2
2
|
import { StagePanelLocation, StagePanelSection } from "@itwin/appui-react";
|
|
3
3
|
import type { GroupingMappingProps } from "./GroupingMapping";
|
|
4
|
+
/**
|
|
5
|
+
* UI Provider for Grouping & Mapping Widget
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
4
8
|
export declare class GroupingMappingProvider implements UiItemsProvider {
|
|
5
9
|
private readonly _props;
|
|
6
10
|
readonly id = "GroupingMappingProvider";
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { StagePanelLocation, StagePanelSection, StageUsage, } from "@itwin/appui-react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import GroupingMapping from "./GroupingMapping";
|
|
4
|
+
/**
|
|
5
|
+
* UI Provider for Grouping & Mapping Widget
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
4
8
|
export class GroupingMappingProvider {
|
|
5
9
|
constructor(_props = {}) {
|
|
6
10
|
this._props = _props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupingMappingWidget.js","sourceRoot":"","sources":["../../../src/WidgetShell/GroupingMappingWidget.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,GACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,MAAM,OAAO,uBAAuB;IAGlC,YAA6B,SAA+B,EAAE;QAAjC,WAAM,GAAN,MAAM,CAA2B;QAF9C,OAAE,GAAG,yBAAyB,CAAC;IAEmB,CAAC;IAE5D,cAAc,CACnB,QAAgB,EAChB,UAAkB,EAClB,QAA4B,EAC5B,OAA2B;QAE3B,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,IAAI,QAAQ,KAAK,kBAAkB,CAAC,IAAI;YACpC,OAAO,KAAK,iBAAiB,CAAC,KAAK;YACnC,UAAU,KAAK,UAAU,CAAC,OAAO,EACnC;YACA,MAAM,qBAAqB,GAAW;gBACpC,EAAE,EAAE,uBAAuB;gBAC3B,KAAK,EAAE,oBAAoB;gBAC3B,OAAO,EAAE,oBAAC,eAAe,OAAK,IAAI,CAAC,MAAM,GAAI;aAC9C,CAAC;YAEF,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACrC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type {\n UiItemsProvider,\n Widget,\n} from \"@itwin/appui-react\";\nimport {\n StagePanelLocation,\n StagePanelSection,\n StageUsage,\n} from \"@itwin/appui-react\";\nimport React from \"react\";\nimport type { GroupingMappingProps } from \"./GroupingMapping\";\nimport GroupingMapping from \"./GroupingMapping\";\n\nexport class GroupingMappingProvider implements UiItemsProvider {\n public readonly id = \"GroupingMappingProvider\";\n\n constructor(private readonly _props: GroupingMappingProps = {}) { }\n\n public provideWidgets(\n _stageId: string,\n stageUsage: string,\n location: StagePanelLocation,\n section?: StagePanelSection,\n ): ReadonlyArray<Widget> {\n const widgets: Widget[] = [];\n if (location === StagePanelLocation.Left &&\n section === StagePanelSection.Start &&\n stageUsage === StageUsage.General\n ) {\n const GroupingMappingWidget: Widget = {\n id: \"GroupingMappingWidget\",\n label: \"Grouping & Mapping\",\n content: <GroupingMapping {...this._props} />,\n };\n\n widgets.push(GroupingMappingWidget);\n }\n\n return widgets;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"GroupingMappingWidget.js","sourceRoot":"","sources":["../../../src/WidgetShell/GroupingMappingWidget.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,GACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD;;;GAGG;AACH,MAAM,OAAO,uBAAuB;IAGlC,YAA6B,SAA+B,EAAE;QAAjC,WAAM,GAAN,MAAM,CAA2B;QAF9C,OAAE,GAAG,yBAAyB,CAAC;IAEmB,CAAC;IAE5D,cAAc,CACnB,QAAgB,EAChB,UAAkB,EAClB,QAA4B,EAC5B,OAA2B;QAE3B,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,IAAI,QAAQ,KAAK,kBAAkB,CAAC,IAAI;YACpC,OAAO,KAAK,iBAAiB,CAAC,KAAK;YACnC,UAAU,KAAK,UAAU,CAAC,OAAO,EACnC;YACA,MAAM,qBAAqB,GAAW;gBACpC,EAAE,EAAE,uBAAuB;gBAC3B,KAAK,EAAE,oBAAoB;gBAC3B,OAAO,EAAE,oBAAC,eAAe,OAAK,IAAI,CAAC,MAAM,GAAI;aAC9C,CAAC;YAEF,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;SACrC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type {\n UiItemsProvider,\n Widget,\n} from \"@itwin/appui-react\";\nimport {\n StagePanelLocation,\n StagePanelSection,\n StageUsage,\n} from \"@itwin/appui-react\";\nimport React from \"react\";\nimport type { GroupingMappingProps } from \"./GroupingMapping\";\nimport GroupingMapping from \"./GroupingMapping\";\n\n/**\n * UI Provider for Grouping & Mapping Widget\n * @public\n */\nexport class GroupingMappingProvider implements UiItemsProvider {\n public readonly id = \"GroupingMappingProvider\";\n\n constructor(private readonly _props: GroupingMappingProps = {}) { }\n\n public provideWidgets(\n _stageId: string,\n stageUsage: string,\n location: StagePanelLocation,\n section?: StagePanelSection,\n ): ReadonlyArray<Widget> {\n const widgets: Widget[] = [];\n if (location === StagePanelLocation.Left &&\n section === StagePanelSection.Start &&\n stageUsage === StageUsage.General\n ) {\n const GroupingMappingWidget: Widget = {\n id: \"GroupingMappingWidget\",\n label: \"Grouping & Mapping\",\n content: <GroupingMapping {...this._props} />,\n };\n\n widgets.push(GroupingMappingWidget);\n }\n\n return widgets;\n }\n}\n"]}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { IModelConnection } from "@itwin/core-frontend";
|
|
3
3
|
import type { ClientPrefix, GetAccessTokenFn } from "./context/GroupingApiConfigContext";
|
|
4
|
-
import type { IExtractionClient, IMappingsClient } from "@itwin/insights-client";
|
|
4
|
+
import type { IExtractionClient, IGroupsClient, IMappingsClient, IPropertiesClient } from "@itwin/insights-client";
|
|
5
5
|
import type { GroupingMappingCustomUI } from "./customUI/GroupingMappingCustomUI";
|
|
6
6
|
import { QueryClient } from "@tanstack/react-query";
|
|
7
|
+
/**
|
|
8
|
+
* Props for the {@link GroupingMappingContext} component.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
7
11
|
export interface GroupingMappingContextProps {
|
|
8
12
|
/**
|
|
9
13
|
* Custom callback to retrieve access token.
|
|
@@ -15,13 +19,21 @@ export interface GroupingMappingContextProps {
|
|
|
15
19
|
iModelId: string;
|
|
16
20
|
/**
|
|
17
21
|
* Used for iTwin and iModel APIs.
|
|
18
|
-
* Also used for Mapping API if a custom
|
|
22
|
+
* Also used for Mapping API if a custom IMappingsClient is not provided.
|
|
19
23
|
*/
|
|
20
24
|
prefix?: ClientPrefix;
|
|
21
25
|
/**
|
|
22
26
|
* A custom implementation of MappingClient.
|
|
23
27
|
*/
|
|
24
|
-
|
|
28
|
+
mappingsClient?: IMappingsClient;
|
|
29
|
+
/**
|
|
30
|
+
* A custom implementation of GroupsClient.
|
|
31
|
+
*/
|
|
32
|
+
groupsClient?: IGroupsClient;
|
|
33
|
+
/**
|
|
34
|
+
* A custom implementation of PropertiesClient.
|
|
35
|
+
*/
|
|
36
|
+
propertiesClient?: IPropertiesClient;
|
|
25
37
|
/**
|
|
26
38
|
* A custom implementation of ExtractionClient.
|
|
27
39
|
*/
|
|
@@ -40,5 +52,9 @@ export interface GroupingMappingContextProps {
|
|
|
40
52
|
queryClient?: QueryClient;
|
|
41
53
|
children?: React.ReactNode;
|
|
42
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Grouping and Mapping Context providers required for all components.
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
43
59
|
export declare const GroupingMappingContext: (props: GroupingMappingContextProps) => JSX.Element;
|
|
44
60
|
//# sourceMappingURL=GroupingMappingContext.d.ts.map
|
|
@@ -16,6 +16,8 @@ import { toaster } from "@itwin/itwinui-react";
|
|
|
16
16
|
import { getErrorMessage } from "../common/utils";
|
|
17
17
|
import { TErrCodes } from "./Constants";
|
|
18
18
|
import { ExtractionStatusJobContext } from "./context/ExtractionStateJobContext";
|
|
19
|
+
import { createGroupsClient, GroupsClientContext } from "./context/GroupsClientContext";
|
|
20
|
+
import { createPropertiesClient, PropertiesClientContext } from "./context/PropertiesClientContext";
|
|
19
21
|
const authorizationClientGetAccessToken = async () => (await IModelApp.authorizationClient?.getAccessToken()) ?? "";
|
|
20
22
|
const defaultQueryClient = new QueryClient({
|
|
21
23
|
defaultOptions: {
|
|
@@ -48,11 +50,19 @@ const defaultQueryClient = new QueryClient({
|
|
|
48
50
|
},
|
|
49
51
|
}),
|
|
50
52
|
});
|
|
53
|
+
/**
|
|
54
|
+
* Grouping and Mapping Context providers required for all components.
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
51
57
|
export const GroupingMappingContext = (props) => {
|
|
52
58
|
const activeIModelConnection = useActiveIModelConnection();
|
|
53
|
-
const
|
|
59
|
+
const mappingsClientProp = props.mappingsClient ?? props.prefix;
|
|
60
|
+
const groupsClientProp = props.groupsClient ?? props.prefix;
|
|
61
|
+
const propertiesClientProp = props.propertiesClient ?? props.prefix;
|
|
54
62
|
const extractionClientProp = props.extractionClient ?? props.prefix;
|
|
55
|
-
const [mappingClient, setMappingClient] = useState(createMappingClient(
|
|
63
|
+
const [mappingClient, setMappingClient] = useState(createMappingClient(mappingsClientProp));
|
|
64
|
+
const [groupsClient, setGroupsClient] = useState(createGroupsClient(groupsClientProp));
|
|
65
|
+
const [propertiesClient, setPropertiesClient] = useState(createPropertiesClient(propertiesClientProp));
|
|
56
66
|
const [extractionClient, setExtractionClient] = useState(createExtractionClient(extractionClientProp));
|
|
57
67
|
const [customUIs, setCustomUIs] = useState(createGroupingMappingCustomUI(props.customUIs));
|
|
58
68
|
const [apiConfig, setApiConfig] = useState({
|
|
@@ -84,8 +94,14 @@ export const GroupingMappingContext = (props) => {
|
|
|
84
94
|
}));
|
|
85
95
|
}, [activeIModelConnection, props.getAccessToken, props.iModelConnection, props.iModelId, props.prefix]);
|
|
86
96
|
useEffect(() => {
|
|
87
|
-
setMappingClient(createMappingClient(
|
|
88
|
-
}, [
|
|
97
|
+
setMappingClient(createMappingClient(mappingsClientProp));
|
|
98
|
+
}, [mappingsClientProp]);
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
setGroupsClient(createGroupsClient(groupsClientProp));
|
|
101
|
+
}, [groupsClientProp]);
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
setPropertiesClient(createPropertiesClient(propertiesClientProp));
|
|
104
|
+
}, [propertiesClientProp]);
|
|
89
105
|
useEffect(() => {
|
|
90
106
|
setExtractionClient(createExtractionClient(extractionClientProp));
|
|
91
107
|
}, [extractionClientProp]);
|
|
@@ -125,10 +141,12 @@ export const GroupingMappingContext = (props) => {
|
|
|
125
141
|
return (React.createElement(QueryClientProvider, { client: queryClient },
|
|
126
142
|
React.createElement(GroupingMappingApiConfigContext.Provider, { value: apiConfig },
|
|
127
143
|
React.createElement(MappingClientContext.Provider, { value: mappingClient },
|
|
128
|
-
React.createElement(
|
|
129
|
-
React.createElement(
|
|
130
|
-
React.createElement(
|
|
131
|
-
React.createElement(
|
|
132
|
-
React.createElement(
|
|
144
|
+
React.createElement(GroupsClientContext.Provider, { value: groupsClient },
|
|
145
|
+
React.createElement(PropertiesClientContext.Provider, { value: propertiesClient },
|
|
146
|
+
React.createElement(ExtractionClientContext.Provider, { value: extractionClient },
|
|
147
|
+
React.createElement(ExtractionStatusJobContext.Provider, { value: extractionStateJobContextValue },
|
|
148
|
+
React.createElement(GroupingMappingCustomUIContext.Provider, { value: customUIContextValue },
|
|
149
|
+
React.createElement(GroupHilitedElementsContext.Provider, { value: hilitedElementsContextValue },
|
|
150
|
+
React.createElement(PropertiesGroupColorContext.Provider, { value: propertiesContextValue }, props.children)))))))))));
|
|
133
151
|
};
|
|
134
152
|
//# 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,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,M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AgB,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 activeIModelConnection = 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 ?? activeIModelConnection,\n }));\n }, [activeIModelConnection, 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"]}
|
|
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,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AACpF,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;AACxC,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,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AAG,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,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY;oBAC/C,oBAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,gBAAgB;wBACvD,oBAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,gBAAgB;4BACvD,oBAAC,0BAA0B,CAAC,QAAQ,IAAC,KAAK,EAAE,8BAA8B;gCACxE,oBAAC,8BAA8B,CAAC,QAAQ,IAAC,KAAK,EAAE,oBAAoB;oCAClE,oBAAC,2BAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,2BAA2B;wCACtE,oBAAC,2BAA2B,CAAC,QAAQ,IAAC,KAAK,EAAE,sBAAsB,IAChE,KAAK,CAAC,QAAQ,CACsB,CACF,CACC,CACN,CACL,CACF,CACN,CACD,CACS,CACvB,CACvB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type {\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, IGroupsClient, IMappingsClient, IPropertiesClient } from \"@itwin/insights-client\";\nimport { createGroupingMappingCustomUI, GroupingMappingCustomUIContext } from \"./context/GroupingMappingCustomUIContext\";\nimport type { GroupingMappingCustomUI } from \"./customUI/GroupingMappingCustomUI\";\nimport type { OverlappedElementsMetadata } from \"./context/GroupHilitedElementsContext\";\nimport { GroupHilitedElementsContext } from \"./context/GroupHilitedElementsContext\";\nimport { PropertiesGroupColorContext } from \"./context/PropertiesGroupColorContext\";\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { createExtractionClient, ExtractionClientContext } from \"./context/ExtractionClientContext\";\nimport type { Query } from \"@tanstack/react-query\";\nimport { MutationCache, QueryCache, QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\nimport { toaster } from \"@itwin/itwinui-react\";\nimport { getErrorMessage } from \"../common/utils\";\nimport { TErrCodes } from \"./Constants\";\nimport { ExtractionStatusJobContext } from \"./context/ExtractionStateJobContext\";\nimport { createGroupsClient, GroupsClientContext } from \"./context/GroupsClientContext\";\nimport { createPropertiesClient, PropertiesClientContext } from \"./context/PropertiesClientContext\";\n\n/**\n * Props for the {@link GroupingMappingContext} component.\n * @public\n */\nexport interface GroupingMappingContextProps {\n /**\n * Custom callback to retrieve access token.\n */\n getAccessToken?: GetAccessTokenFn;\n /**\n * The iTwin iModel Id.\n */\n iModelId: string;\n /**\n * Used for iTwin and iModel APIs.\n * Also used for Mapping API if a custom IMappingsClient is not provided.\n */\n prefix?: ClientPrefix;\n /**\n * A custom implementation of MappingClient.\n */\n mappingsClient?: IMappingsClient;\n /**\n * A custom implementation of GroupsClient.\n */\n groupsClient?: IGroupsClient;\n /**\n * A custom implementation of PropertiesClient.\n */\n propertiesClient?: IPropertiesClient;\n /**\n * A custom implementation of ExtractionClient.\n */\n extractionClient?: IExtractionClient;\n /**\n * Custom UI to add and update groups or provide additional group context capabilities.\n */\n customUIs?: GroupingMappingCustomUI[];\n /**\n * A custom iModelConnection to use instead of the active iModelConnection from UiFramework.\n */\n iModelConnection?: IModelConnection;\n /**\n * A custom QueryClient. If not provided, a default QueryClient will be used.\n */\n queryClient?: QueryClient;\n children?: React.ReactNode;\n}\n\nconst authorizationClientGetAccessToken = async () =>\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\n/**\n * Grouping and Mapping Context providers required for all components.\n * @public\n */\nexport const GroupingMappingContext = (props: GroupingMappingContextProps) => {\n const activeIModelConnection = useActiveIModelConnection();\n const mappingsClientProp: IMappingsClient | ClientPrefix = props.mappingsClient ?? props.prefix;\n const groupsClientProp: IGroupsClient | ClientPrefix = props.groupsClient ?? props.prefix;\n const propertiesClientProp: IPropertiesClient | ClientPrefix = props.propertiesClient ?? props.prefix;\n const extractionClientProp: IExtractionClient | ClientPrefix = props.extractionClient ?? props.prefix;\n const [mappingClient, setMappingClient] = useState<IMappingsClient>(createMappingClient(mappingsClientProp));\n const [groupsClient, setGroupsClient] = useState<IGroupsClient>(createGroupsClient(groupsClientProp));\n const [propertiesClient, setPropertiesClient] = useState<IPropertiesClient>(createPropertiesClient(propertiesClientProp));\n const [extractionClient, setExtractionClient] = useState<IExtractionClient>(createExtractionClient(extractionClientProp));\n const [customUIs, setCustomUIs] = useState<GroupingMappingCustomUI[]>(\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 ?? activeIModelConnection,\n }));\n }, [activeIModelConnection, props.getAccessToken, props.iModelConnection, props.iModelId, props.prefix]);\n\n useEffect(() => {\n setMappingClient(createMappingClient(mappingsClientProp));\n }, [mappingsClientProp]);\n\n useEffect(()=>{\n setGroupsClient(createGroupsClient(groupsClientProp));\n }, [groupsClientProp]);\n\n useEffect(()=>{\n setPropertiesClient(createPropertiesClient(propertiesClientProp));\n }, [propertiesClientProp]);\n\n useEffect(() => {\n setExtractionClient(createExtractionClient(extractionClientProp));\n }, [extractionClientProp]);\n\n useEffect(() => {\n setCustomUIs(createGroupingMappingCustomUI(props.customUIs));\n }, [props.customUIs]);\n\n const hilitedElementsContextValue = useMemo(\n () => ({\n showGroupColor,\n setShowGroupColor,\n hiddenGroupsIds,\n setHiddenGroupsIds,\n groups,\n setGroups,\n numberOfVisualizedGroups,\n setNumberOfVisualizedGroups,\n isOverlappedColored,\n setIsOverlappedColored,\n currentHilitedGroups,\n setCurrentHilitedGroups,\n isVisualizationsEnabled,\n setIsVisualizationsEnabled,\n overlappedElementsMetadata,\n setOverlappedElementsMetadata,\n }),\n [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 <GroupsClientContext.Provider value={groupsClient}>\n <PropertiesClientContext.Provider value={propertiesClient}>\n <ExtractionClientContext.Provider value={extractionClient}>\n <ExtractionStatusJobContext.Provider value={extractionStateJobContextValue}>\n <GroupingMappingCustomUIContext.Provider value={customUIContextValue}>\n <GroupHilitedElementsContext.Provider value={hilitedElementsContextValue}>\n <PropertiesGroupColorContext.Provider value={propertiesContextValue}>\n {props.children}\n </PropertiesGroupColorContext.Provider>\n </GroupHilitedElementsContext.Provider>\n </GroupingMappingCustomUIContext.Provider>\n </ExtractionStatusJobContext.Provider>\n </ExtractionClientContext.Provider>\n </PropertiesClientContext.Provider>\n </GroupsClientContext.Provider>\n </MappingClientContext.Provider>\n </GroupingMappingApiConfigContext.Provider>\n </QueryClientProvider>\n );\n};\n"]}
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "./GroupAction.scss";
|
|
3
|
-
import type {
|
|
3
|
+
import type { GroupMinimal } from "@itwin/insights-client";
|
|
4
4
|
declare const defaultDisplayStrings: {
|
|
5
5
|
groupDetails: string;
|
|
6
6
|
groupBy: string;
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Props for the {@link GroupAction} component.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
8
12
|
export interface GroupActionProps {
|
|
9
13
|
mappingId: string;
|
|
10
14
|
shouldVisualize: boolean;
|
|
11
|
-
group?:
|
|
15
|
+
group?: GroupMinimal;
|
|
12
16
|
queryGenerationType: string;
|
|
13
17
|
onSaveSuccess: () => void;
|
|
14
18
|
onClickCancel?: () => void;
|
|
15
19
|
displayStrings?: Partial<typeof defaultDisplayStrings>;
|
|
16
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Component to create or update a group.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
17
25
|
export declare const GroupAction: (props: GroupActionProps) => JSX.Element;
|
|
18
26
|
export {};
|
|
19
27
|
//# sourceMappingURL=GroupAction.d.ts.map
|
|
@@ -4,7 +4,6 @@ import { LoadingSpinner } from "../../SharedComponents/LoadingSpinner";
|
|
|
4
4
|
import "./GroupAction.scss";
|
|
5
5
|
import useValidator from "../../Properties/hooks/useValidator";
|
|
6
6
|
import { useGroupingMappingApiConfig } from "../../context/GroupingApiConfigContext";
|
|
7
|
-
import { useMappingClient } from "../../context/MappingClientContext";
|
|
8
7
|
import { useGroupingMappingCustomUI } from "../../context/GroupingMappingCustomUIContext";
|
|
9
8
|
import { GroupingMappingCustomUIType } from "../../customUI/GroupingMappingCustomUI";
|
|
10
9
|
import { QueryBuilderStep } from "../QueryBuilder/QueryBuilderStep";
|
|
@@ -13,6 +12,7 @@ import { QueryBuilderActionPanel } from "../QueryBuilder/QueryBuilderActionPanel
|
|
|
13
12
|
import { GroupDetailsActionPanel } from "./GroupDetailsActionPanel";
|
|
14
13
|
import { useVisualization } from "../hooks/useVisualization";
|
|
15
14
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
15
|
+
import { useGroupsClient } from "../../context/GroupsClientContext";
|
|
16
16
|
const defaultDisplayStrings = {
|
|
17
17
|
groupDetails: "Group Details",
|
|
18
18
|
groupBy: "Group By",
|
|
@@ -22,12 +22,16 @@ var GroupActionStep;
|
|
|
22
22
|
GroupActionStep[GroupActionStep["QueryBuilder"] = 0] = "QueryBuilder";
|
|
23
23
|
GroupActionStep[GroupActionStep["GroupDetails"] = 1] = "GroupDetails";
|
|
24
24
|
})(GroupActionStep || (GroupActionStep = {}));
|
|
25
|
+
/**
|
|
26
|
+
* Component to create or update a group.
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
25
29
|
export const GroupAction = (props) => {
|
|
26
|
-
const { getAccessToken,
|
|
30
|
+
const { getAccessToken, iModelConnection } = useGroupingMappingApiConfig();
|
|
27
31
|
if (!iModelConnection) {
|
|
28
32
|
throw new Error("This component requires an active iModelConnection.");
|
|
29
33
|
}
|
|
30
|
-
const
|
|
34
|
+
const groupsClient = useGroupsClient();
|
|
31
35
|
const groupUIs = useGroupingMappingCustomUI().customUIs
|
|
32
36
|
.filter((p) => p.type === GroupingMappingCustomUIType.Grouping);
|
|
33
37
|
const [details, setDetails] = useState({
|
|
@@ -76,8 +80,8 @@ export const GroupAction = (props) => {
|
|
|
76
80
|
const accessToken = await getAccessToken();
|
|
77
81
|
const currentQuery = query || simpleSelectionQuery;
|
|
78
82
|
return props.group
|
|
79
|
-
?
|
|
80
|
-
:
|
|
83
|
+
? groupsClient.updateGroup(accessToken, props.mappingId, props.group.id, { ...details, query: currentQuery })
|
|
84
|
+
: groupsClient.createGroup(accessToken, props.mappingId, { ...details, query: currentQuery });
|
|
81
85
|
};
|
|
82
86
|
const { mutate: onSaveMutate, isLoading: isSaveLoading } = useMutation(saveGroup, {
|
|
83
87
|
onSuccess: async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupAction.js","sourceRoot":"","sources":["../../../../../src/components/Groups/Editing/GroupAction.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,MAAM,GACP,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,oBAAoB,CAAC;AAC5B,OAAO,YAAY,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAE1F,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAErF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEpE,MAAM,qBAAqB,GAAG;IAC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aAAa,aAGf,CACL,CACL,CACJ,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 type {\n SelectOption,\n} from \"@itwin/itwinui-react\";\nimport {\n Button,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { LoadingSpinner } from \"../../SharedComponents/LoadingSpinner\";\nimport \"./GroupAction.scss\";\nimport useValidator from \"../../Properties/hooks/useValidator\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { useMappingClient } from \"../../context/MappingClientContext\";\nimport { useGroupingMappingCustomUI } from \"../../context/GroupingMappingCustomUIContext\";\nimport type { GroupingCustomUI } from \"../../customUI/GroupingMappingCustomUI\";\nimport { GroupingMappingCustomUIType } from \"../../customUI/GroupingMappingCustomUI\";\nimport type { Group } from \"@itwin/insights-client\";\nimport { QueryBuilderStep } from \"../QueryBuilder/QueryBuilderStep\";\nimport { GroupDetailsStep } from \"./GroupDetailsStep\";\nimport { QueryBuilderActionPanel } from \"../QueryBuilder/QueryBuilderActionPanel\";\nimport { GroupDetailsActionPanel } from \"./GroupDetailsActionPanel\";\nimport { useVisualization } from \"../hooks/useVisualization\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\n\nconst defaultDisplayStrings = {\n groupDetails: \"Group Details\",\n groupBy: \"Group By\",\n};\n\nenum GroupActionStep {\n QueryBuilder,\n GroupDetails,\n}\n\nexport interface GroupActionProps {\n mappingId: string;\n shouldVisualize: boolean;\n group?: Group;\n queryGenerationType: string;\n onSaveSuccess: () => void;\n onClickCancel?: () => void;\n displayStrings?: Partial<typeof defaultDisplayStrings>;\n}\n\nexport const GroupAction = (props: GroupActionProps) => {\n const { getAccessToken, iModelId, iModelConnection } = useGroupingMappingApiConfig();\n if (!iModelConnection) {\n throw new Error(\"This component requires an active iModelConnection.\");\n }\n const mappingClient = useMappingClient();\n const groupUIs: GroupingCustomUI[] = useGroupingMappingCustomUI().customUIs\n .filter((p) => p.type === GroupingMappingCustomUIType.Grouping) as GroupingCustomUI[];\n const [details, setDetails] = useState({\n groupName: props.group?.groupName ?? \"\",\n description: props.group?.description ?? \"\",\n });\n const [query, setQuery] = useState<string>(\"\");\n const [queryRowCount, setQueryRowCount] = useState<number>(0);\n\n const [validator, setShowValidationMessage] = useValidator();\n const queryClient = useQueryClient();\n\n const [queryGenerationType, setQueryGenerationType] = useState(\n props.queryGenerationType,\n );\n const {\n isRendering,\n simpleSelectionQuery,\n setSimpleSelectionQuery,\n clearPresentationSelection,\n resetView,\n } = useVisualization(\n props.shouldVisualize,\n iModelConnection,\n query,\n queryGenerationType\n );\n\n const [currentStep, setCurrentStep] = React.useState(GroupActionStep.QueryBuilder);\n\n const displayStrings = React.useMemo(\n () => ({ ...defaultDisplayStrings, ...props.displayStrings }),\n [props.displayStrings]\n );\n\n useEffect(() => setQueryGenerationType(props.queryGenerationType), [props.queryGenerationType]);\n\n const fetchQueryRowCount = async (query: string) => {\n const rowCount = (await iModelConnection.createQueryReader(`SELECT count(*) FROM (${query})`).next()).value[0];\n return rowCount as number;\n };\n\n const { mutate, isLoading: isQueryLoading } = useMutation(fetchQueryRowCount, {\n onSuccess: (result) => {\n setQueryRowCount(result);\n },\n });\n\n useEffect(() => {\n if (query) {\n mutate(query);\n } else {\n setQueryRowCount(0);\n }\n }, [iModelConnection, query, mutate]);\n\n const getOptions = useMemo(\n (): SelectOption<string>[] =>\n groupUIs.map((ui) => ({\n label: ui.displayLabel,\n value: ui.name,\n icon: ui.icon,\n })),\n [groupUIs]\n );\n\n const onChange = useCallback(\n async (value: string) => {\n setQueryGenerationType(value);\n clearPresentationSelection();\n setQuery(\"\");\n setSimpleSelectionQuery(\"\");\n await resetView();\n },\n [clearPresentationSelection, resetView, setSimpleSelectionQuery]\n );\n\n const saveGroup = async () => {\n const accessToken = await getAccessToken();\n const currentQuery = query || simpleSelectionQuery;\n\n return props.group\n ? mappingClient.updateGroup(\n accessToken,\n iModelId,\n props.mappingId,\n props.group.id,\n { ...details, query: currentQuery }\n )\n : mappingClient.createGroup(\n accessToken,\n iModelId,\n props.mappingId,\n { ...details, query: currentQuery }\n );\n };\n\n const { mutate: onSaveMutate, isLoading: isSaveLoading } = useMutation(saveGroup, {\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: [\"groups\"] });\n clearPresentationSelection();\n setDetails({\n groupName: props.group?.groupName ?? \"\",\n description: props.group?.description ?? \"\",\n });\n setCurrentStep(GroupActionStep.QueryBuilder);\n setShowValidationMessage(false);\n props.onSaveSuccess();\n\n },\n });\n\n const isQueryBuilderStep = currentStep === GroupActionStep.QueryBuilder;\n const isGroupDetailsStep = currentStep === GroupActionStep.GroupDetails;\n\n const isLoading = isSaveLoading || isQueryLoading;\n\n const isUpdating = isLoading || isRendering;\n\n const isBlockingActions = !(details.groupName && (query || simpleSelectionQuery)) || isRendering || isLoading;\n\n const onClickSave = useCallback(() => {\n if (!validator.allValid()) {\n setShowValidationMessage(true);\n return;\n }\n onSaveMutate();\n }, [onSaveMutate, setShowValidationMessage, validator]);\n\n const onClickBack = useCallback(() => {\n setCurrentStep(GroupActionStep.QueryBuilder);\n }, []);\n\n const onClickCancel = useCallback(() => {\n clearPresentationSelection();\n if (props.onClickCancel) {\n props.onClickCancel();\n }\n }, [clearPresentationSelection, props]);\n\n const onClickNext = useCallback(() => {\n setCurrentStep(GroupActionStep.GroupDetails);\n }, []);\n\n return (\n <>\n <div className=\"gmw-group-add-modify-container\">\n <QueryBuilderStep\n queryRowCount={queryRowCount}\n isHidden={!isQueryBuilderStep}\n queryGenerationType={queryGenerationType}\n groupUIs={groupUIs}\n isUpdating={isUpdating}\n resetView={resetView}\n setQuery={setQuery}\n onChange={onChange}\n getOptions={getOptions}\n displayStrings={{ ...displayStrings }}\n group={props.group}\n />\n {isGroupDetailsStep && <GroupDetailsStep\n details={details}\n setDetails={setDetails}\n validator={validator}\n displayStrings={{ ...displayStrings }}\n />}\n </div>\n <div className='gmw-action-panel'>\n {isLoading &&\n <LoadingSpinner />\n }\n {isQueryBuilderStep && (\n <QueryBuilderActionPanel onClickNext={onClickNext} />\n )}\n {isGroupDetailsStep && (\n <GroupDetailsActionPanel\n isSaveDisabled={isBlockingActions}\n onClickSave={onClickSave}\n onClickBack={onClickBack}\n />\n )}\n {props.onClickCancel && <Button\n type='button'\n id='cancel'\n onClick={onClickCancel}\n >\n Cancel\n </Button>}\n </div>\n </>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"GroupAction.js","sourceRoot":"","sources":["../../../../../src/components/Groups/Editing/GroupAction.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,MAAM,GACP,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,oBAAoB,CAAC;AAC5B,OAAO,YAAY,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAE1F,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAErF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;A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I,EAAC,QAAQ,EACb,EAAE,EAAC,QAAQ,EACX,OAAO,EAAE,aAAa,aAGf,CACL,CACL,CACJ,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 type {\n SelectOption,\n} from \"@itwin/itwinui-react\";\nimport {\n Button,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { LoadingSpinner } from \"../../SharedComponents/LoadingSpinner\";\nimport \"./GroupAction.scss\";\nimport useValidator from \"../../Properties/hooks/useValidator\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { useGroupingMappingCustomUI } from \"../../context/GroupingMappingCustomUIContext\";\nimport type { GroupingCustomUI } from \"../../customUI/GroupingMappingCustomUI\";\nimport { GroupingMappingCustomUIType } from \"../../customUI/GroupingMappingCustomUI\";\nimport type { GroupMinimal } from \"@itwin/insights-client\";\nimport { QueryBuilderStep } from \"../QueryBuilder/QueryBuilderStep\";\nimport { GroupDetailsStep } from \"./GroupDetailsStep\";\nimport { QueryBuilderActionPanel } from \"../QueryBuilder/QueryBuilderActionPanel\";\nimport { GroupDetailsActionPanel } from \"./GroupDetailsActionPanel\";\nimport { useVisualization } from \"../hooks/useVisualization\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { useGroupsClient } from \"../../context/GroupsClientContext\";\n\nconst defaultDisplayStrings = {\n groupDetails: \"Group Details\",\n groupBy: \"Group By\",\n};\n\nenum GroupActionStep {\n QueryBuilder,\n GroupDetails,\n}\n\n/**\n * Props for the {@link GroupAction} component.\n * @public\n */\nexport interface GroupActionProps {\n mappingId: string;\n shouldVisualize: boolean;\n group?: GroupMinimal;\n queryGenerationType: string;\n onSaveSuccess: () => void;\n onClickCancel?: () => void;\n displayStrings?: Partial<typeof defaultDisplayStrings>;\n}\n\n/**\n * Component to create or update a group.\n * @public\n */\nexport const GroupAction = (props: GroupActionProps) => {\n const { getAccessToken, iModelConnection } = useGroupingMappingApiConfig();\n if (!iModelConnection) {\n throw new Error(\"This component requires an active iModelConnection.\");\n }\n const groupsClient = useGroupsClient();\n const groupUIs: GroupingCustomUI[] = useGroupingMappingCustomUI().customUIs\n .filter((p) => p.type === GroupingMappingCustomUIType.Grouping) as GroupingCustomUI[];\n const [details, setDetails] = useState({\n groupName: props.group?.groupName ?? \"\",\n description: props.group?.description ?? \"\",\n });\n const [query, setQuery] = useState<string>(\"\");\n const [queryRowCount, setQueryRowCount] = useState<number>(0);\n\n const [validator, setShowValidationMessage] = useValidator();\n const queryClient = useQueryClient();\n\n const [queryGenerationType, setQueryGenerationType] = useState(\n props.queryGenerationType,\n );\n const {\n isRendering,\n simpleSelectionQuery,\n setSimpleSelectionQuery,\n clearPresentationSelection,\n resetView,\n } = useVisualization(\n props.shouldVisualize,\n iModelConnection,\n query,\n queryGenerationType\n );\n\n const [currentStep, setCurrentStep] = React.useState(GroupActionStep.QueryBuilder);\n\n const displayStrings = React.useMemo(\n () => ({ ...defaultDisplayStrings, ...props.displayStrings }),\n [props.displayStrings]\n );\n\n useEffect(() => setQueryGenerationType(props.queryGenerationType), [props.queryGenerationType]);\n\n const fetchQueryRowCount = async (query: string) => {\n const rowCount = (await iModelConnection.createQueryReader(`SELECT count(*) FROM (${query})`).next()).value[0];\n return rowCount as number;\n };\n\n const { mutate, isLoading: isQueryLoading } = useMutation(fetchQueryRowCount, {\n onSuccess: (result) => {\n setQueryRowCount(result);\n },\n });\n\n useEffect(() => {\n if (query) {\n mutate(query);\n } else {\n setQueryRowCount(0);\n }\n }, [iModelConnection, query, mutate]);\n\n const getOptions = useMemo(\n (): SelectOption<string>[] =>\n groupUIs.map((ui) => ({\n label: ui.displayLabel,\n value: ui.name,\n icon: ui.icon,\n })),\n [groupUIs]\n );\n\n const onChange = useCallback(\n async (value: string) => {\n setQueryGenerationType(value);\n clearPresentationSelection();\n setQuery(\"\");\n setSimpleSelectionQuery(\"\");\n await resetView();\n },\n [clearPresentationSelection, resetView, setSimpleSelectionQuery]\n );\n\n const saveGroup = async () => {\n const accessToken = await getAccessToken();\n const currentQuery = query || simpleSelectionQuery;\n\n return props.group\n ? groupsClient.updateGroup(\n accessToken,\n props.mappingId,\n props.group.id,\n { ...details, query: currentQuery }\n )\n : groupsClient.createGroup(\n accessToken,\n props.mappingId,\n { ...details, query: currentQuery }\n );\n };\n\n const { mutate: onSaveMutate, isLoading: isSaveLoading } = useMutation(saveGroup, {\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: [\"groups\"] });\n clearPresentationSelection();\n setDetails({\n groupName: props.group?.groupName ?? \"\",\n description: props.group?.description ?? \"\",\n });\n setCurrentStep(GroupActionStep.QueryBuilder);\n setShowValidationMessage(false);\n props.onSaveSuccess();\n\n },\n });\n\n const isQueryBuilderStep = currentStep === GroupActionStep.QueryBuilder;\n const isGroupDetailsStep = currentStep === GroupActionStep.GroupDetails;\n\n const isLoading = isSaveLoading || isQueryLoading;\n\n const isUpdating = isLoading || isRendering;\n\n const isBlockingActions = !(details.groupName && (query || simpleSelectionQuery)) || isRendering || isLoading;\n\n const onClickSave = useCallback(() => {\n if (!validator.allValid()) {\n setShowValidationMessage(true);\n return;\n }\n onSaveMutate();\n }, [onSaveMutate, setShowValidationMessage, validator]);\n\n const onClickBack = useCallback(() => {\n setCurrentStep(GroupActionStep.QueryBuilder);\n }, []);\n\n const onClickCancel = useCallback(() => {\n clearPresentationSelection();\n if (props.onClickCancel) {\n props.onClickCancel();\n }\n }, [clearPresentationSelection, props]);\n\n const onClickNext = useCallback(() => {\n setCurrentStep(GroupActionStep.GroupDetails);\n }, []);\n\n return (\n <>\n <div className=\"gmw-group-add-modify-container\">\n <QueryBuilderStep\n queryRowCount={queryRowCount}\n isHidden={!isQueryBuilderStep}\n queryGenerationType={queryGenerationType}\n groupUIs={groupUIs}\n isUpdating={isUpdating}\n resetView={resetView}\n setQuery={setQuery}\n onChange={onChange}\n getOptions={getOptions}\n displayStrings={{ ...displayStrings }}\n group={props.group}\n />\n {isGroupDetailsStep && <GroupDetailsStep\n details={details}\n setDetails={setDetails}\n validator={validator}\n displayStrings={{ ...displayStrings }}\n />}\n </div>\n <div className='gmw-action-panel'>\n {isLoading &&\n <LoadingSpinner />\n }\n {isQueryBuilderStep && (\n <QueryBuilderActionPanel onClickNext={onClickNext} />\n )}\n {isGroupDetailsStep && (\n <GroupDetailsActionPanel\n isSaveDisabled={isBlockingActions}\n onClickSave={onClickSave}\n onClickBack={onClickBack}\n />\n )}\n {props.onClickCancel && <Button\n type='button'\n id='cancel'\n onClick={onClickCancel}\n >\n Cancel\n </Button>}\n </div>\n </>\n );\n};\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { GroupMinimal } from "@itwin/insights-client";
|
|
3
3
|
import "./GroupColorLegend.scss";
|
|
4
4
|
interface GroupColorLegendProps {
|
|
5
|
-
group:
|
|
6
|
-
groups:
|
|
5
|
+
group: GroupMinimal;
|
|
6
|
+
groups: GroupMinimal[];
|
|
7
7
|
}
|
|
8
8
|
export declare const GroupColorLegend: ({ group, groups }: GroupColorLegendProps) => JSX.Element;
|
|
9
9
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GroupColorLegend.js","sourceRoot":"","sources":["../../../../src/components/Groups/GroupColorLegend.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,yBAAyB,CAAC;AAOjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,EAAyB,EAAE,EAAE,CAAC,CAC5E,oBAAC,UAAU,IAAC,SAAS,EAAC,YAAY;IAChC,6BACE,SAAS,EAAC,kBAAkB,EAC5B,KAAK,EAAE;YACL,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,CAAC,CAAC;SAC3E,GACD,CACS,CACd,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport { IconButton } from \"@itwin/itwinui-react\";\nimport type {
|
|
1
|
+
{"version":3,"file":"GroupColorLegend.js","sourceRoot":"","sources":["../../../../src/components/Groups/GroupColorLegend.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,yBAAyB,CAAC;AAOjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,EAAyB,EAAE,EAAE,CAAC,CAC5E,oBAAC,UAAU,IAAC,SAAS,EAAC,YAAY;IAChC,6BACE,SAAS,EAAC,kBAAkB,EAC5B,KAAK,EAAE;YACL,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE,CAAC,CAAC;SAC3E,GACD,CACS,CACd,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React from \"react\";\nimport { IconButton } from \"@itwin/itwinui-react\";\nimport type { GroupMinimal } from \"@itwin/insights-client\";\nimport { getGroupColor } from \"./groupsHelpers\";\nimport \"./GroupColorLegend.scss\";\n\ninterface GroupColorLegendProps {\n group: GroupMinimal;\n groups: GroupMinimal[];\n}\n\nexport const GroupColorLegend = ({ group, groups }: GroupColorLegendProps) => (\n <IconButton styleType=\"borderless\">\n <div\n className=\"gmw-color-legend\"\n style={{\n backgroundColor: getGroupColor(groups.findIndex((g) => g.id === group.id)),\n }}\n />\n </IconButton>\n);\n"]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { GroupMinimal } from "@itwin/insights-client";
|
|
3
3
|
import type { ContextCustomUI, GroupingCustomUI } from "../customUI/GroupingMappingCustomUI";
|
|
4
4
|
import type { GroupsProps } from "./Groups";
|
|
5
5
|
import "./GroupListItem.scss";
|
|
6
6
|
export interface GroupListItemProps extends Omit<GroupsProps, "onClickAddGroup"> {
|
|
7
|
-
group:
|
|
7
|
+
group: GroupMinimal;
|
|
8
8
|
groupUIs: GroupingCustomUI[];
|
|
9
9
|
contextUIs: ContextCustomUI[];
|
|
10
|
-
setShowDeleteModal: (showDeleteModal:
|
|
11
|
-
setActiveOverlapInfoPanelGroup?: (activeOverlapInfoPanelGroup:
|
|
10
|
+
setShowDeleteModal: (showDeleteModal: GroupMinimal) => void;
|
|
11
|
+
setActiveOverlapInfoPanelGroup?: (activeOverlapInfoPanelGroup: GroupMinimal) => void;
|
|
12
12
|
}
|
|
13
13
|
export declare const GroupListItem: ({ onClickGroupTitle, disableActions, group, ...rest }: GroupListItemProps) => JSX.Element;
|
|
14
14
|
//# sourceMappingURL=GroupListItem.d.ts.map
|