@itwin/grouping-mapping-widget 0.25.1 → 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 +4 -2
- 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 +4 -2
- 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":"OverlappedElementsInformationPanel.js","sourceRoot":"","sources":["../../../../src/components/Groups/OverlappedElementsInformationPanel.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,EACL,IAAI,EACJ,OAAO,GACR,MAAM,sBAAsB,CAAC;AAC9B,OAAO,2CAA2C,CAAC;AAInD,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC;AACxF,OAAO,EAAE,iCAAiC,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAgBrI,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,EACjD,KAAK,EACL,OAAO,EACP,sBAAsB,EACtB,MAAM,GACkC,EAAE,EAAE;IAC5C,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,GACzD,QAAQ,CAAU,KAAK,CAAC,CAAC;IAC3B,MAAM,EAAE,sBAAsB,EAAE,GAAG,8BAA8B,EAAE,CAAC;IAC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AC,gBAAgB,IAAC,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,SAAS,EAAC,yBAAyB;QACpE,oBAAC,sBAAsB,IAAC,OAAO,EAAE,WAAW;YAC1C,oBAAC,IAAI,IAAC,OAAO,EAAC,SAAS,IAAE,mBAAmB,KAAK,EAAE,SAAS,EAAE,CAAQ,CAC/C;QACzB,oBAAC,oBAAoB,IAAC,SAAS,EAAC,sBAAsB;YACpD,oBAAC,KAAK,IACJ,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,GAAG,EACT,iBAAiB,EAAC,cAAc,EAChC,SAAS,EAAE,uBAAuB,EAClC,UAAU,EAAE,IAAI,EAChB,YAAY,QACZ,aAAa,EAAC,QAAQ,EACtB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,GAAG,EAAE,CAAC,SAAS,GAC9B,CACmB,CACN,CACpB,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 from \"react\";\nimport { useCallback, useMemo, useState } from \"react\";\nimport type { CreateTypeFromInterface } from \"../../common/utils\";\nimport {\n InformationPanel,\n InformationPanelBody,\n InformationPanelHeader,\n Table,\n Text,\n toaster,\n} from \"@itwin/itwinui-react\";\nimport \"./OverlappedElementsInformationPanel.scss\";\nimport type {
|
|
1
|
+
{"version":3,"file":"OverlappedElementsInformationPanel.js","sourceRoot":"","sources":["../../../../src/components/Groups/OverlappedElementsInformationPanel.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,EACL,IAAI,EACJ,OAAO,GACR,MAA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AI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC7C,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;gBACtD,MAAM,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;aACnD;SACF;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,QAAQ,CAAC,qDAAqD,CAAC,CAAC;YACxE,+BAA+B;YAC/B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACtB;gBAAS;YACR,YAAY,CAAC,KAAK,CAAC,CAAC;SACrB;IACH,CAAC,EACD,EAAE,CACH,CAAC;IAEF,OAAO,CACL,oBAAC,gBAAgB,IAAC,MAAM,EAAE,CAAC,CAAC,KAAK,EAAE,SAAS,EAAC,yBAAyB;QACpE,oBAAC,sBAAsB,IAAC,OAAO,EAAE,WAAW;YAC1C,oBAAC,IAAI,IAAC,OAAO,EAAC,SAAS,IAAE,mBAAmB,KAAK,EAAE,SAAS,EAAE,CAAQ,CAC/C;QACzB,oBAAC,oBAAoB,IAAC,SAAS,EAAC,sBAAsB;YACpD,oBAAC,KAAK,IACJ,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,GAAG,EACT,iBAAiB,EAAC,cAAc,EAChC,SAAS,EAAE,uBAAuB,EAClC,UAAU,EAAE,IAAI,EAChB,YAAY,QACZ,aAAa,EAAC,QAAQ,EACtB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,GAAG,EAAE,CAAC,SAAS,GAC9B,CACmB,CACN,CACpB,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 from \"react\";\nimport { useCallback, useMemo, useState } from \"react\";\nimport type { CreateTypeFromInterface } from \"../../common/utils\";\nimport {\n InformationPanel,\n InformationPanelBody,\n InformationPanelHeader,\n Table,\n Text,\n toaster,\n} from \"@itwin/itwinui-react\";\nimport \"./OverlappedElementsInformationPanel.scss\";\nimport type { GroupMinimal } from \"@itwin/insights-client\";\nimport type { OverlappedInfo } from \"../context/GroupHilitedElementsContext\";\nimport type { CellProps, Column } from \"react-table\";\nimport { useGroupHilitedElementsContext } from \"../context/GroupHilitedElementsContext\";\nimport { clearEmphasizedOverriddenElements, clearHiddenElements, visualizeElements, zoomToElements } from \"../../common/viewerUtils\";\n\nexport interface OverlappedElementsInformationPanelProps {\n group?: GroupMinimal;\n onClose: () => void;\n overlappedElementsInfo: Map<string, OverlappedInfo[]>;\n groups: GroupMinimal[];\n}\n\nexport interface OverlappedElementsDisplayProps {\n overlappedElements: string;\n groups: string[];\n elementsIds: string[];\n}\ntype OverlappedTyped = CreateTypeFromInterface<OverlappedElementsDisplayProps>;\n\nexport const OverlappedElementsInformationPanel = ({\n group,\n onClose,\n overlappedElementsInfo,\n groups,\n}: OverlappedElementsInformationPanelProps) => {\n const [isOverlappedInfoLoading, setIsOverlappedInfoLoading] =\n useState<boolean>(false);\n const { setIsOverlappedColored } = useGroupHilitedElementsContext();\n const [isLoading, setIsLoading] = useState<boolean>(false);\n\n const columns = useMemo(\n (): Column<OverlappedTyped>[] =>[\n {\n id: \"number\",\n Header: \"Overlapped elements\",\n accessor: \"overlappedElements\",\n },\n {\n id: \"groups\",\n Header: \"Groups\",\n accessor: \"groups\",\n Cell: (value: CellProps<OverlappedTyped>) => {\n return (\n <div>\n {value.row.original.groups.map((groupName, index) => (\n <div key={index}>{groupName}</div>\n ))}\n </div>\n );\n },\n },\n ],\n []\n );\n\n const key = group ? group.id : \"\";\n const overlappedInfo = overlappedElementsInfo.get(key);\n\n const arr: OverlappedElementsDisplayProps[] = useMemo(() => {\n setIsOverlappedInfoLoading(true);\n const result: OverlappedElementsDisplayProps[] = [];\n if (overlappedInfo) {\n setIsOverlappedColored(true);\n overlappedInfo.forEach((array) => {\n const groupNames: string[] = [];\n array.groupIds.forEach((groupId) => {\n const group = groups.find((group) => group.id === groupId);\n if (group) {\n groupNames.push(group.groupName);\n }\n });\n result.push({\n overlappedElements: array.elements.length.toString(),\n groups: groupNames,\n elementsIds: array.elements,\n });\n });\n }\n setIsOverlappedInfoLoading(false);\n return result;\n }, [overlappedInfo, groups, setIsOverlappedColored]);\n\n const handleClose = () => {\n setIsOverlappedColored(false);\n onClose();\n };\n\n const onSelect = useCallback(\n async (\n selectedData: CreateTypeFromInterface<OverlappedElementsDisplayProps>[] | undefined\n ) => {\n try {\n setIsLoading(true);\n clearEmphasizedOverriddenElements();\n clearHiddenElements();\n if (selectedData && selectedData.length !== 0) {\n visualizeElements(selectedData[0].elementsIds, \"red\");\n await zoomToElements(selectedData[0].elementsIds);\n }\n } catch (error) {\n toaster.negative(\"There was an error visualizing overlapped elements.\");\n /* eslint-disable no-console */\n console.error(error);\n } finally {\n setIsLoading(false);\n }\n },\n []\n );\n\n return (\n <InformationPanel isOpen={!!group} className=\"gmw-overlap-information\">\n <InformationPanelHeader onClose={handleClose}>\n <Text variant=\"leading\">{`Overlap Info of ${group?.groupName}`}</Text>\n </InformationPanelHeader>\n <InformationPanelBody className=\"gmw-information-body\">\n <Table<OverlappedTyped>\n columns={columns}\n data={arr}\n emptyTableContent=\"No Overlaps.\"\n isLoading={isOverlappedInfoLoading}\n isSortable={true}\n isSelectable\n selectionMode=\"single\"\n onSelect={onSelect}\n isRowDisabled={() => isLoading}\n />\n </InformationPanelBody>\n </InformationPanel>\n );\n};\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { GroupingCustomUI } from "../../customUI/GroupingMappingCustomUI";
|
|
3
|
-
import type {
|
|
3
|
+
import type { GroupMinimal } from "@itwin/insights-client";
|
|
4
4
|
export interface QueryBuilderCustomUIProps {
|
|
5
5
|
queryGenerationType: string;
|
|
6
6
|
groupUIs: GroupingCustomUI[];
|
|
7
7
|
isUpdating: boolean;
|
|
8
8
|
resetView: () => Promise<void>;
|
|
9
9
|
setQuery: (query: string) => void;
|
|
10
|
-
group?:
|
|
10
|
+
group?: GroupMinimal;
|
|
11
11
|
}
|
|
12
12
|
export declare const QueryBuilderCustomUI: ({ queryGenerationType, groupUIs, isUpdating, resetView, setQuery, group, }: QueryBuilderCustomUIProps) => JSX.Element;
|
|
13
13
|
//# sourceMappingURL=QueryBuilderCustomUI.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryBuilderCustomUI.js","sourceRoot":"","sources":["../../../../../src/components/Groups/QueryBuilder/QueryBuilderCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAYnE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACnC,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,SAAS,EACT,QAAQ,EACR,KAAK,GACqB,EAAE,EAAE;IAC9B,IAAI,mBAAmB,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE;QACzD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,mBAAmB,CAAC,CAAC;QAC9E,IAAI,gBAAgB,EAAE;YACpB,OAAO,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,WAAW,EAAE;gBACvD,WAAW,EAAE,QAAQ;gBACrB,UAAU;gBACV,SAAS;gBACT,oBAAoB,EAAE,KAAK,EAAE,KAAK;aACnC,CAAC,CAAC;SACJ;KACF;IACD,OAAO,oBAAC,YAAY,IAAC,OAAO,EAAC,uCAAuC,GAAG,CAAC;AAC1E,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 type { GroupingCustomUI } from \"../../customUI/GroupingMappingCustomUI\";\nimport { EmptyMessage } from \"../../SharedComponents/EmptyMessage\";\nimport type {
|
|
1
|
+
{"version":3,"file":"QueryBuilderCustomUI.js","sourceRoot":"","sources":["../../../../../src/components/Groups/QueryBuilder/QueryBuilderCustomUI.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAYnE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EACnC,mBAAmB,EACnB,QAAQ,EACR,UAAU,EACV,SAAS,EACT,QAAQ,EACR,KAAK,GACqB,EAAE,EAAE;IAC9B,IAAI,mBAAmB,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE;QACzD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,mBAAmB,CAAC,CAAC;QAC9E,IAAI,gBAAgB,EAAE;YACpB,OAAO,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,WAAW,EAAE;gBACvD,WAAW,EAAE,QAAQ;gBACrB,UAAU;gBACV,SAAS;gBACT,oBAAoB,EAAE,KAAK,EAAE,KAAK;aACnC,CAAC,CAAC;SACJ;KACF;IACD,OAAO,oBAAC,YAAY,IAAC,OAAO,EAAC,uCAAuC,GAAG,CAAC;AAC1E,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 type { GroupingCustomUI } from \"../../customUI/GroupingMappingCustomUI\";\nimport { EmptyMessage } from \"../../SharedComponents/EmptyMessage\";\nimport type { GroupMinimal } from \"@itwin/insights-client\";\n\nexport interface QueryBuilderCustomUIProps {\n queryGenerationType: string;\n groupUIs: GroupingCustomUI[];\n isUpdating: boolean;\n resetView: () => Promise<void>;\n setQuery: (query: string) => void;\n group?: GroupMinimal;\n}\n\nexport const QueryBuilderCustomUI = ({\n queryGenerationType,\n groupUIs,\n isUpdating,\n resetView,\n setQuery,\n group,\n}: QueryBuilderCustomUIProps) => {\n if (queryGenerationType && queryGenerationType.length > 0) {\n const selectedCustomUI = groupUIs.find((e) => e.name === queryGenerationType);\n if (selectedCustomUI) {\n return React.createElement(selectedCustomUI.uiComponent, {\n updateQuery: setQuery,\n isUpdating,\n resetView,\n initialEditModeQuery: group?.query,\n });\n }\n }\n return <EmptyMessage message=\"No query generation method selected. \" />;\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IModelConnection } from "@itwin/core-frontend";
|
|
2
|
-
import type {
|
|
2
|
+
import type { GroupMinimal } from "@itwin/insights-client";
|
|
3
3
|
import type { OverlappedElementGroupPairs, OverlappedInfo } from "../context/GroupHilitedElementsContext";
|
|
4
4
|
export declare const getGroupColor: (index: number) => string;
|
|
5
5
|
export declare type GroupsElementIds = {
|
|
@@ -8,7 +8,7 @@ export declare type GroupsElementIds = {
|
|
|
8
8
|
}[];
|
|
9
9
|
export declare const hideGroupIds: (hiddenGroupIds: Set<string>, groupsWithGroupedOverlaps: OverlappedElementGroupPairs[]) => void;
|
|
10
10
|
export declare const visualizeGroupColors: (hiddenGroupsIds: Set<string>, groupsWithGroupedOverlaps: OverlappedElementGroupPairs[], setNumberOfVisualizedGroups: (numberOfVisualizedGroups: number | ((numberOfVisualizedGroups: number) => number)) => void, doEmphasizeElements?: boolean) => Promise<string[]>;
|
|
11
|
-
export declare const getHiliteIdsAndKeysetFromGroup: (iModelConnection: IModelConnection, group:
|
|
11
|
+
export declare const getHiliteIdsAndKeysetFromGroup: (iModelConnection: IModelConnection, group: GroupMinimal) => Promise<{
|
|
12
12
|
query: string;
|
|
13
13
|
result: {
|
|
14
14
|
keySet: import("@itwin/presentation-common").KeySet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groupsHelpers.js","sourceRoot":"","sources":["../../../../src/components/Groups/groupsHelpers.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAIzD,OAAO,EAAE,iCAAiC,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEnK,MAAM,uBAAuB,GAAG,GAAG,CAAC,CAAE,8CAA8C;AACpF,MAAM,eAAe,GAAG,EAAE,CAAC,CAAW,gFAAgF;AACtH,MAAM,mBAAmB,GAAG,EAAE,CAAC,CAAO,oDAAoD;AAC1F,MAAM,mBAAmB,GAAG,GAAG,CAAC,CAAM,gDAAgD;AACtF,MAAM,mBAAmB,GAAG,EAAE,CAAC,CAAO,gDAAgD;AACtF,MAAM,WAAW,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7C,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,aAAqB,GAAG,EAAE,YAAoB,EAAE,EAAE,EAAE;IACpF,OAAO,OAAO,GAAG,KAAK,UAAU,MAAM,SAAS,IAAI,CAAC;AACtD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAa,EAAE,EAAE;IAC7C,IAAI,GAAG,GAAG,CAAC,KAAK,GAAG,WAAW,GAAG,uBAAuB,GAAG,eAAe,CAAC,GAAG,GAAG,CAAC;IAElF,OAAO,GAAG,IAAI,mBAAmB,IAAI,GAAG,IAAI,mBAAmB,EAAE;QAC/D,GAAG,GAAG,CAAC,GAAG,GAAG,mBAAmB,CAAC,GAAG,GAAG,CAAC;KACzC;IAED,OAAO,WAAW,CA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C,IAAI,CAAC,CAAC;qBACrC;iBACF;aACF;SACF;KACF;IAED,qDAAqD;IACrD,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC;AACtD,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 { FeatureOverrideType } from \"@itwin/core-common\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { Group } from \"@itwin/insights-client\";\nimport type { OverlappedElementGroupPairs, OverlappedInfo } from \"../context/GroupHilitedElementsContext\";\nimport { clearEmphasizedOverriddenElements, clearHiddenElements, emphasizeElements, getHiliteIds, hideElements, overrideElements } from \"../../common/viewerUtils\";\n\nconst GOLDEN_ANGLE_MULTIPLIER = 1.5; // Multiplier to spread colors more uniformly.\nconst BASE_HUE_OFFSET = 60; // Initial hue offset to avoid certain colors e.g 0 offset would begin with red.\nconst HUE_ADJUSTMENT_STEP = 15; // Step to adjust the hue to avoid the red spectrum.\nconst RED_HUE_LOWER_BOUND = 330; // Lower bound of the red hue spectrum to avoid.\nconst RED_HUE_UPPER_BOUND = 30; // Upper bound of the red hue spectrum to avoid.\nconst GOLDENANGLE = 180 * (3 - Math.sqrt(5));\n\nconst generateHSL = (hue: number, saturation: number = 100, lightness: number = 50) => {\n return `hsl(${hue}, ${saturation}%, ${lightness}%)`;\n};\n\nexport const getGroupColor = (index: number) => {\n let hue = (index * GOLDENANGLE * GOLDEN_ANGLE_MULTIPLIER + BASE_HUE_OFFSET) % 360;\n\n while (hue >= RED_HUE_LOWER_BOUND || hue <= RED_HUE_UPPER_BOUND) {\n hue = (hue + HUE_ADJUSTMENT_STEP) % 360;\n }\n\n return generateHSL(hue);\n};\n\nconst processGroupVisualization = async (\n overlappedElementGroupPairs: OverlappedElementGroupPairs,\n hiddenGroupsIds: Set<string>,\n doEmphasizeElements: boolean,\n color: string,\n replace: boolean,\n setNumberOfVisualizedGroups: (numberOfVisualizedGroups: number | ((numberOfVisualizedGroups: number) => number)) => void,\n) => {\n const hilitedIds = Array.from(overlappedElementGroupPairs.elementIds);\n\n overrideElements(hilitedIds, color, FeatureOverrideType.ColorAndAlpha, replace);\n setNumberOfVisualizedGroups((numberOfVisualizedGroups) => numberOfVisualizedGroups + 1);\n\n doEmphasizeElements && emphasizeElements(hilitedIds, undefined);\n\n for (const id of overlappedElementGroupPairs.groupIds) {\n if (hiddenGroupsIds.has(id)) {\n return [];\n }\n }\n return hilitedIds;\n};\n\nexport type GroupsElementIds = {\n groupId: string;\n elementIds: string[];\n}[];\n\nexport const hideGroupIds = (hiddenGroupIds: Set<string>, groupsWithGroupedOverlaps: OverlappedElementGroupPairs[] ) => {\n hiddenGroupIds.forEach((groupId) => {\n hideGroupConsideringOverlaps(groupsWithGroupedOverlaps, groupId, hiddenGroupIds);\n });\n};\n\nexport const visualizeGroupColors = async (\n hiddenGroupsIds: Set<string>,\n groupsWithGroupedOverlaps: OverlappedElementGroupPairs[],\n setNumberOfVisualizedGroups: (numberOfVisualizedGroups: number | ((numberOfVisualizedGroups: number) => number)) => void,\n doEmphasizeElements: boolean = true,\n) => {\n clearEmphasizedOverriddenElements();\n\n const singleGroupPromises = groupsWithGroupedOverlaps\n .filter((group) => group.groupIds.size === 1)\n .map(async (group, index) =>\n processGroupVisualization(\n group,\n hiddenGroupsIds,\n doEmphasizeElements,\n getGroupColor(index), // color for single group\n false, // Shouldn't matter as replacement only accounts for same colored overrides.\n setNumberOfVisualizedGroups,\n )\n );\n\n const overlappedGroupPromises = groupsWithGroupedOverlaps\n .filter((group) => group.groupIds.size !== 1)\n .map(async (group) =>\n processGroupVisualization(\n group,\n hiddenGroupsIds,\n doEmphasizeElements,\n generateHSL(0), // color for group of overlapped elements\n false,\n setNumberOfVisualizedGroups,\n )\n );\n\n clearHiddenElements();\n\n const allPromises = [...singleGroupPromises, ...overlappedGroupPromises];\n\n const allIds = (await Promise.all(allPromises)).flat();\n return allIds;\n};\n\nexport const getHiliteIdsAndKeysetFromGroup = async (\n iModelConnection: IModelConnection,\n group: Group,\n) => {\n const query = group.query;\n const result = await getHiliteIds(query, iModelConnection);\n return {query, result};\n\n};\n\nconst getOverlappedElementsInfo = (overlappedElements: OverlappedElementGroupPairs[]) => {\n const overlappedElementsInfo: Map<string, OverlappedInfo[]> = new Map();\n\n overlappedElements.forEach((elementGroup) => {\n const { elementIds, groupIds } = elementGroup;\n\n groupIds.forEach((group) => {\n const otherGroups = Array.from(groupIds).filter((grp) => grp !== group);\n const overlappedInfoArray = overlappedElementsInfo.get(group) ?? [];\n overlappedInfoArray.push({ groupIds: otherGroups, elements: Array.from(elementIds) });\n overlappedElementsInfo.set(group, overlappedInfoArray);\n });\n });\n return overlappedElementsInfo;\n};\n\nconst mergeElementsByGroup = (elems: Map<string, Set<string>>) => {\n const mergedList: Map<string, OverlappedElementGroupPairs> = new Map();\n elems.forEach((groupIds, elementId) => {\n const sortedGroups = Array.from(groupIds).sort();\n const key = sortedGroups.join(\"-\");\n const overlap = mergedList.get(key);\n if (overlap) {\n overlap.elementIds.add(elementId);\n } else {\n mergedList.set(key, { elementIds: new Set([elementId]), groupIds });\n }\n });\n return mergedList;\n};\n\nexport const generateOverlappedGroups = (\n groupsElementIds: GroupsElementIds,\n) => {\n const elems: Map<string, Set<string>> = new Map();\n const groupElementCount: Map<string, number> = new Map();\n\n // Build the elems map for associations between elements and their groups.\n for (const groupInfo of groupsElementIds) {\n for (const elem of groupInfo.elementIds) {\n const elemGroups = elems.get(elem) || new Set<string>();\n elemGroups.add(groupInfo.groupId);\n elems.set(elem, elemGroups);\n }\n groupElementCount.set(groupInfo.groupId, groupInfo.elementIds.length);\n }\n\n // Construct the unique list of all groups and their overlapped groups combinations\n const allGroups: OverlappedElementGroupPairs[] = groupsElementIds.map((groupInfo) => {\n const nonOverlappingElements = Array.from(new Set(groupInfo.elementIds)).filter((elem) => elems.get(elem)!.size === 1);\n groupElementCount.set(groupInfo.groupId, groupInfo.elementIds.length);\n return { elementIds: new Set(nonOverlappingElements), groupIds: new Set([groupInfo.groupId]) };\n });\n\n const mergedList = mergeElementsByGroup(elems);\n const overlappedGroupsInformation: OverlappedElementGroupPairs[] = Array.from(mergedList.values()).filter((value) => value.groupIds.size > 1);\n\n return { groupsWithGroupedOverlaps: [...allGroups, ...overlappedGroupsInformation], overlappedElementsInfo: getOverlappedElementsInfo(overlappedGroupsInformation), numberOfElementsInGroups: groupElementCount };\n};\n\nexport const hideGroupConsideringOverlaps = (\n overlappedElementGroupPairs: OverlappedElementGroupPairs[],\n groupIdToHide: string,\n hiddenGroupsIds: Set<string>\n) => {\n const elementsToPotentiallyHide = new Set<string>();\n\n // Check each entry in overlappedElementGroupPairs\n for (const entry of overlappedElementGroupPairs) {\n // If the groupToHide is part of this entry\n if (entry.groupIds.has(groupIdToHide)) {\n // If this is a unique entry (no overlaps for this group), add all its elements to hide list\n if (entry.groupIds.size === 1) {\n for (const elem of entry.elementIds) {\n elementsToPotentiallyHide.add(elem);\n }\n } else {\n // If there are overlaps, only hide if all overlapping groups are hidden\n const allOtherGroupsHidden = Array.from(entry.groupIds).every(\n (groupId) =>\n groupId === groupIdToHide || hiddenGroupsIds.has(groupId)\n );\n if (allOtherGroupsHidden) {\n for (const elem of entry.elementIds) {\n elementsToPotentiallyHide.add(elem);\n }\n }\n }\n }\n }\n\n // Now hide all elements in elementsToPotentiallyHide\n hideElements(Array.from(elementsToPotentiallyHide));\n};\n"]}
|
|
1
|
+
{"version":3,"file":"groupsHelpers.js","sourceRoot":"","sources":["../../../../src/components/Groups/groupsHelpers.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAIzD,OAAO,EAAE,iCAAiC,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0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AAE,iBAAiB,EAAE,CAAC;AACpN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAC1C,2BAA0D,EAC1D,aAAqB,EACrB,eAA4B,EAC5B,EAAE;IACF,MAAM,yBAAyB,GAAG,IAAI,GAAG,EAAU,CAAC;IAEpD,kDAAkD;IAClD,KAAK,MAAM,KAAK,IAAI,2BAA2B,EAAE;QAC/C,2CAA2C;QAC3C,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;YACrC,4FAA4F;YAC5F,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,EAAE;gBAC7B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,UAAU,EAAE;oBACnC,yBAAyB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;iBACrC;aACF;iBAAM;gBACL,wEAAwE;gBACxE,MAAM,oBAAoB,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,KAAK,CAC3D,CAAC,OAAO,EAAE,EAAE,CACV,OAAO,KAAK,aAAa,IAAI,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,CAC5D,CAAC;gBACF,IAAI,oBAAoB,EAAE;oBACxB,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,UAAU,EAAE;wBACnC,yBAAyB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;qBACrC;iBACF;aACF;SACF;KACF;IAED,qDAAqD;IACrD,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC;AACtD,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 { FeatureOverrideType } from \"@itwin/core-common\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { GroupMinimal } from \"@itwin/insights-client\";\nimport type { OverlappedElementGroupPairs, OverlappedInfo } from \"../context/GroupHilitedElementsContext\";\nimport { clearEmphasizedOverriddenElements, clearHiddenElements, emphasizeElements, getHiliteIds, hideElements, overrideElements } from \"../../common/viewerUtils\";\n\nconst GOLDEN_ANGLE_MULTIPLIER = 1.5; // Multiplier to spread colors more uniformly.\nconst BASE_HUE_OFFSET = 60; // Initial hue offset to avoid certain colors e.g 0 offset would begin with red.\nconst HUE_ADJUSTMENT_STEP = 15; // Step to adjust the hue to avoid the red spectrum.\nconst RED_HUE_LOWER_BOUND = 330; // Lower bound of the red hue spectrum to avoid.\nconst RED_HUE_UPPER_BOUND = 30; // Upper bound of the red hue spectrum to avoid.\nconst GOLDENANGLE = 180 * (3 - Math.sqrt(5));\n\nconst generateHSL = (hue: number, saturation: number = 100, lightness: number = 50) => {\n return `hsl(${hue}, ${saturation}%, ${lightness}%)`;\n};\n\nexport const getGroupColor = (index: number) => {\n let hue = (index * GOLDENANGLE * GOLDEN_ANGLE_MULTIPLIER + BASE_HUE_OFFSET) % 360;\n\n while (hue >= RED_HUE_LOWER_BOUND || hue <= RED_HUE_UPPER_BOUND) {\n hue = (hue + HUE_ADJUSTMENT_STEP) % 360;\n }\n\n return generateHSL(hue);\n};\n\nconst processGroupVisualization = async (\n overlappedElementGroupPairs: OverlappedElementGroupPairs,\n hiddenGroupsIds: Set<string>,\n doEmphasizeElements: boolean,\n color: string,\n replace: boolean,\n setNumberOfVisualizedGroups: (numberOfVisualizedGroups: number | ((numberOfVisualizedGroups: number) => number)) => void,\n) => {\n const hilitedIds = Array.from(overlappedElementGroupPairs.elementIds);\n\n overrideElements(hilitedIds, color, FeatureOverrideType.ColorAndAlpha, replace);\n setNumberOfVisualizedGroups((numberOfVisualizedGroups) => numberOfVisualizedGroups + 1);\n\n doEmphasizeElements && emphasizeElements(hilitedIds, undefined);\n\n for (const id of overlappedElementGroupPairs.groupIds) {\n if (hiddenGroupsIds.has(id)) {\n return [];\n }\n }\n return hilitedIds;\n};\n\nexport type GroupsElementIds = {\n groupId: string;\n elementIds: string[];\n}[];\n\nexport const hideGroupIds = (hiddenGroupIds: Set<string>, groupsWithGroupedOverlaps: OverlappedElementGroupPairs[] ) => {\n hiddenGroupIds.forEach((groupId) => {\n hideGroupConsideringOverlaps(groupsWithGroupedOverlaps, groupId, hiddenGroupIds);\n });\n};\n\nexport const visualizeGroupColors = async (\n hiddenGroupsIds: Set<string>,\n groupsWithGroupedOverlaps: OverlappedElementGroupPairs[],\n setNumberOfVisualizedGroups: (numberOfVisualizedGroups: number | ((numberOfVisualizedGroups: number) => number)) => void,\n doEmphasizeElements: boolean = true,\n) => {\n clearEmphasizedOverriddenElements();\n\n const singleGroupPromises = groupsWithGroupedOverlaps\n .filter((group) => group.groupIds.size === 1)\n .map(async (group, index) =>\n processGroupVisualization(\n group,\n hiddenGroupsIds,\n doEmphasizeElements,\n getGroupColor(index), // color for single group\n false, // Shouldn't matter as replacement only accounts for same colored overrides.\n setNumberOfVisualizedGroups,\n )\n );\n\n const overlappedGroupPromises = groupsWithGroupedOverlaps\n .filter((group) => group.groupIds.size !== 1)\n .map(async (group) =>\n processGroupVisualization(\n group,\n hiddenGroupsIds,\n doEmphasizeElements,\n generateHSL(0), // color for group of overlapped elements\n false,\n setNumberOfVisualizedGroups,\n )\n );\n\n clearHiddenElements();\n\n const allPromises = [...singleGroupPromises, ...overlappedGroupPromises];\n\n const allIds = (await Promise.all(allPromises)).flat();\n return allIds;\n};\n\nexport const getHiliteIdsAndKeysetFromGroup = async (\n iModelConnection: IModelConnection,\n group: GroupMinimal,\n) => {\n const query = group.query;\n const result = await getHiliteIds(query, iModelConnection);\n return {query, result};\n\n};\n\nconst getOverlappedElementsInfo = (overlappedElements: OverlappedElementGroupPairs[]) => {\n const overlappedElementsInfo: Map<string, OverlappedInfo[]> = new Map();\n\n overlappedElements.forEach((elementGroup) => {\n const { elementIds, groupIds } = elementGroup;\n\n groupIds.forEach((group) => {\n const otherGroups = Array.from(groupIds).filter((grp) => grp !== group);\n const overlappedInfoArray = overlappedElementsInfo.get(group) ?? [];\n overlappedInfoArray.push({ groupIds: otherGroups, elements: Array.from(elementIds) });\n overlappedElementsInfo.set(group, overlappedInfoArray);\n });\n });\n return overlappedElementsInfo;\n};\n\nconst mergeElementsByGroup = (elems: Map<string, Set<string>>) => {\n const mergedList: Map<string, OverlappedElementGroupPairs> = new Map();\n elems.forEach((groupIds, elementId) => {\n const sortedGroups = Array.from(groupIds).sort();\n const key = sortedGroups.join(\"-\");\n const overlap = mergedList.get(key);\n if (overlap) {\n overlap.elementIds.add(elementId);\n } else {\n mergedList.set(key, { elementIds: new Set([elementId]), groupIds });\n }\n });\n return mergedList;\n};\n\nexport const generateOverlappedGroups = (\n groupsElementIds: GroupsElementIds,\n) => {\n const elems: Map<string, Set<string>> = new Map();\n const groupElementCount: Map<string, number> = new Map();\n\n // Build the elems map for associations between elements and their groups.\n for (const groupInfo of groupsElementIds) {\n for (const elem of groupInfo.elementIds) {\n const elemGroups = elems.get(elem) || new Set<string>();\n elemGroups.add(groupInfo.groupId);\n elems.set(elem, elemGroups);\n }\n groupElementCount.set(groupInfo.groupId, groupInfo.elementIds.length);\n }\n\n // Construct the unique list of all groups and their overlapped groups combinations\n const allGroups: OverlappedElementGroupPairs[] = groupsElementIds.map((groupInfo) => {\n const nonOverlappingElements = Array.from(new Set(groupInfo.elementIds)).filter((elem) => elems.get(elem)!.size === 1);\n groupElementCount.set(groupInfo.groupId, groupInfo.elementIds.length);\n return { elementIds: new Set(nonOverlappingElements), groupIds: new Set([groupInfo.groupId]) };\n });\n\n const mergedList = mergeElementsByGroup(elems);\n const overlappedGroupsInformation: OverlappedElementGroupPairs[] = Array.from(mergedList.values()).filter((value) => value.groupIds.size > 1);\n\n return { groupsWithGroupedOverlaps: [...allGroups, ...overlappedGroupsInformation], overlappedElementsInfo: getOverlappedElementsInfo(overlappedGroupsInformation), numberOfElementsInGroups: groupElementCount };\n};\n\nexport const hideGroupConsideringOverlaps = (\n overlappedElementGroupPairs: OverlappedElementGroupPairs[],\n groupIdToHide: string,\n hiddenGroupsIds: Set<string>\n) => {\n const elementsToPotentiallyHide = new Set<string>();\n\n // Check each entry in overlappedElementGroupPairs\n for (const entry of overlappedElementGroupPairs) {\n // If the groupToHide is part of this entry\n if (entry.groupIds.has(groupIdToHide)) {\n // If this is a unique entry (no overlaps for this group), add all its elements to hide list\n if (entry.groupIds.size === 1) {\n for (const elem of entry.elementIds) {\n elementsToPotentiallyHide.add(elem);\n }\n } else {\n // If there are overlaps, only hide if all overlapping groups are hidden\n const allOtherGroupsHidden = Array.from(entry.groupIds).every(\n (groupId) =>\n groupId === groupIdToHide || hiddenGroupsIds.has(groupId)\n );\n if (allOtherGroupsHidden) {\n for (const elem of entry.elementIds) {\n elementsToPotentiallyHide.add(elem);\n }\n }\n }\n }\n }\n\n // Now hide all elements in elementsToPotentiallyHide\n hideElements(Array.from(elementsToPotentiallyHide));\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IGroupsClient } from "@itwin/insights-client";
|
|
2
2
|
import type { GetAccessTokenFn } from "../../context/GroupingApiConfigContext";
|
|
3
|
-
export declare const fetchGroups: (
|
|
4
|
-
export declare const useFetchGroups: (
|
|
3
|
+
export declare const fetchGroups: (mappingId: string, getAccessToken: GetAccessTokenFn, groupsClient: IGroupsClient) => Promise<import("@itwin/insights-client").GroupMinimal[]>;
|
|
4
|
+
export declare const useFetchGroups: (mappingId: string, getAccessToken: GetAccessTokenFn, groupsClient: IGroupsClient) => import("@tanstack/react-query").UseQueryResult<import("@itwin/insights-client").GroupMinimal[], unknown>;
|
|
5
5
|
//# sourceMappingURL=useFetchGroups.d.ts.map
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { PreferReturn } from "@itwin/insights-client";
|
|
1
2
|
import { useQuery } from "@tanstack/react-query";
|
|
2
|
-
export const fetchGroups = async (
|
|
3
|
+
export const fetchGroups = async (mappingId, getAccessToken, groupsClient) => {
|
|
3
4
|
const accessToken = await getAccessToken();
|
|
4
|
-
const
|
|
5
|
-
return groups;
|
|
5
|
+
const groupsList = await groupsClient.getGroups(accessToken, mappingId, PreferReturn.Minimal);
|
|
6
|
+
return groupsList.groups;
|
|
6
7
|
};
|
|
7
|
-
export const useFetchGroups = (
|
|
8
|
+
export const useFetchGroups = (mappingId, getAccessToken, groupsClient) => {
|
|
8
9
|
return useQuery({
|
|
9
10
|
queryKey: ["groups", mappingId],
|
|
10
|
-
queryFn: async () => fetchGroups(
|
|
11
|
+
queryFn: async () => fetchGroups(mappingId, getAccessToken, groupsClient),
|
|
11
12
|
});
|
|
12
13
|
};
|
|
13
14
|
//# sourceMappingURL=useFetchGroups.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFetchGroups.js","sourceRoot":"","sources":["../../../../../src/components/Groups/hooks/useFetchGroups.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAC9B,
|
|
1
|
+
{"version":3,"file":"useFetchGroups.js","sourceRoot":"","sources":["../../../../../src/components/Groups/hooks/useFetchGroups.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAC9B,SAAiB,EACjB,cAAgC,EAChC,YAA2B,EAC5B,EAAE;IACD,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;IAC3C,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAC9F,OAAO,UAAU,CAAC,MAAM,CAAC;AAC3B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAiB,EAAE,cAAgC,EAAE,YAA2B,EAAE,EAAE;IACjH,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;QAC/B,OAAO,EAAG,KAAK,IAAI,EAAE,CAAC,WAAW,CAAC,SAAS,EAAE,cAAc,EAAE,YAAY,CAAC;KAC3E,CAAC,CAAC;AACL,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 { IGroupsClient } from \"@itwin/insights-client\";\nimport { PreferReturn } from \"@itwin/insights-client\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport type { GetAccessTokenFn } from \"../../context/GroupingApiConfigContext\";\n\nexport const fetchGroups = async (\n mappingId: string,\n getAccessToken: GetAccessTokenFn,\n groupsClient: IGroupsClient\n)=> {\n const accessToken = await getAccessToken();\n const groupsList = await groupsClient.getGroups(accessToken, mappingId, PreferReturn.Minimal);\n return groupsList.groups;\n};\n\nexport const useFetchGroups = (mappingId: string, getAccessToken: GetAccessTokenFn, groupsClient: IGroupsClient) => {\n return useQuery({\n queryKey: [\"groups\", mappingId],\n queryFn: async () => fetchGroups(mappingId, getAccessToken, groupsClient),\n });\n};\n"]}
|
|
@@ -1,22 +1,30 @@
|
|
|
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
|
+
/**
|
|
5
|
+
* Props for the {@link useGroupsOperations} hook.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
4
8
|
export interface GroupsOperationsProps {
|
|
5
9
|
mappingId: string;
|
|
6
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Custom hook to handle group operations.
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
7
15
|
export declare const useGroupsOperations: ({ mappingId, }: GroupsOperationsProps) => {
|
|
8
|
-
groups:
|
|
16
|
+
groups: GroupMinimal[] | undefined;
|
|
9
17
|
isLoading: boolean;
|
|
10
18
|
refresh: () => Promise<void>;
|
|
11
|
-
onDeleteGroup: (group:
|
|
12
|
-
setShowDeleteModal: import("react").Dispatch<import("react").SetStateAction<
|
|
13
|
-
showDeleteModal:
|
|
19
|
+
onDeleteGroup: (group: GroupMinimal) => Promise<void>;
|
|
20
|
+
setShowDeleteModal: import("react").Dispatch<import("react").SetStateAction<GroupMinimal | undefined>>;
|
|
21
|
+
showDeleteModal: GroupMinimal | undefined;
|
|
14
22
|
groupUIs: GroupingCustomUI[];
|
|
15
23
|
contextUIs: ContextCustomUI[];
|
|
16
24
|
errorMessage: string | undefined;
|
|
17
25
|
setErrorMessage: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
|
|
18
|
-
activeOverlapInfoPanelGroup:
|
|
19
|
-
setActiveOverlapInfoPanelGroup: import("react").Dispatch<import("react").SetStateAction<
|
|
26
|
+
activeOverlapInfoPanelGroup: GroupMinimal | undefined;
|
|
27
|
+
setActiveOverlapInfoPanelGroup: import("react").Dispatch<import("react").SetStateAction<GroupMinimal | undefined>>;
|
|
20
28
|
overlappedElementsInfo: Map<string, import("../../context/GroupHilitedElementsContext").OverlappedInfo[]>;
|
|
21
29
|
};
|
|
22
30
|
//# sourceMappingURL=useGroupsOperations.d.ts.map
|
|
@@ -7,27 +7,31 @@ import { useGroupingMappingApiConfig } from "../../context/GroupingApiConfigCont
|
|
|
7
7
|
import { GroupingMappingCustomUIType } from "../../customUI/GroupingMappingCustomUI";
|
|
8
8
|
import { useGroupingMappingCustomUI } from "../../context/GroupingMappingCustomUIContext";
|
|
9
9
|
import { useGroupHilitedElementsContext } from "../../context/GroupHilitedElementsContext";
|
|
10
|
-
import { useMappingClient } from "../../context/MappingClientContext";
|
|
11
10
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
12
11
|
import { useFetchGroups } from "./useFetchGroups";
|
|
12
|
+
import { useGroupsClient } from "../../context/GroupsClientContext";
|
|
13
|
+
/**
|
|
14
|
+
* Custom hook to handle group operations.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
13
17
|
export const useGroupsOperations = ({ mappingId, }) => {
|
|
14
|
-
const { getAccessToken
|
|
18
|
+
const { getAccessToken } = useGroupingMappingApiConfig();
|
|
15
19
|
const { overlappedElementsMetadata: { overlappedElementsInfo } } = useGroupHilitedElementsContext();
|
|
16
|
-
const
|
|
20
|
+
const groupsClient = useGroupsClient();
|
|
17
21
|
const groupUIs = useGroupingMappingCustomUI().customUIs.filter((p) => p.type === GroupingMappingCustomUIType.Grouping);
|
|
18
22
|
const contextUIs = useGroupingMappingCustomUI().customUIs.filter((p) => p.type === GroupingMappingCustomUIType.Context);
|
|
19
23
|
const [showDeleteModal, setShowDeleteModal] = useState(undefined);
|
|
20
24
|
const [errorMessage, setErrorMessage] = useState(undefined);
|
|
21
25
|
const [activeOverlapInfoPanelGroup, setActiveOverlapInfoPanelGroup] = useState(undefined);
|
|
22
26
|
const queryClient = useQueryClient();
|
|
23
|
-
const { data: groups, isLoading } = useFetchGroups(
|
|
27
|
+
const { data: groups, isLoading } = useFetchGroups(mappingId, getAccessToken, groupsClient);
|
|
24
28
|
const refresh = useCallback(async () => {
|
|
25
29
|
await queryClient.invalidateQueries({ queryKey: ["groups", mappingId] });
|
|
26
30
|
}, [mappingId, queryClient]);
|
|
27
31
|
const deleteGroupMutation = useMutation({
|
|
28
32
|
mutationFn: async (group) => {
|
|
29
33
|
const accessToken = await getAccessToken();
|
|
30
|
-
await
|
|
34
|
+
await groupsClient.deleteGroup(accessToken, mappingId, group.id);
|
|
31
35
|
},
|
|
32
36
|
onSuccess: refresh,
|
|
33
37
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGroupsOperations.js","sourceRoot":"","sources":["../../../../../src/components/Groups/hooks/useGroupsOperations.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAErF,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,8BAA8B,EAAE,MAAM,2CAA2C,CAAC;AAC3F,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useGroupsOperations.js","sourceRoot":"","sources":["../../../../../src/components/Groups/hooks/useGroupsOperations.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAErF,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,8BAA8B,EAAE,MAAM,2CAA2C,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAUpE;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAClC,SAAS,GACa,EAAE,EAAE;IAC1B,MAAM,EAAE,cAAc,EAAE,GAAG,2BAA2B,EAAE,CAAC;IACzD,MAAM,EAAE,0BAA0B,EAAE,EAAG,sBAAsB,EAAE,EAAE,GAAG,8BAA8B,EAAE,CAAC;IAErG,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IACvC,MAAM,QAAQ,GACZ,0BAA0B,EAAE,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E;QAClD,mBAAmB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC,CAAC;IAEF,OAAO;QACL,MAAM;QACN,SAAS;QACT,OAAO;QACP,aAAa;QACb,kBAAkB;QAClB,eAAe;QACf,QAAQ;QACR,UAAU;QACV,YAAY;QACZ,eAAe;QACf,2BAA2B;QAC3B,8BAA8B;QAC9B,sBAAsB;KACvB,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 { useCallback, useState } from \"react\";\nimport type { GroupMinimal } from \"@itwin/insights-client\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport type { ContextCustomUI, GroupingCustomUI } from \"../../customUI/GroupingMappingCustomUI\";\nimport { GroupingMappingCustomUIType } from \"../../customUI/GroupingMappingCustomUI\";\nimport { useGroupingMappingCustomUI } from \"../../context/GroupingMappingCustomUIContext\";\nimport { useGroupHilitedElementsContext } from \"../../context/GroupHilitedElementsContext\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { useFetchGroups } from \"./useFetchGroups\";\nimport { useGroupsClient } from \"../../context/GroupsClientContext\";\n\n/**\n * Props for the {@link useGroupsOperations} hook.\n * @internal\n */\nexport interface GroupsOperationsProps {\n mappingId: string;\n}\n\n/**\n * Custom hook to handle group operations.\n * @internal\n */\nexport const useGroupsOperations = ({\n mappingId,\n}: GroupsOperationsProps) => {\n const { getAccessToken } = useGroupingMappingApiConfig();\n const { overlappedElementsMetadata: { overlappedElementsInfo } } = useGroupHilitedElementsContext();\n\n const groupsClient = useGroupsClient();\n const groupUIs: GroupingCustomUI[] =\n useGroupingMappingCustomUI().customUIs.filter(\n (p) => p.type === GroupingMappingCustomUIType.Grouping\n ) as GroupingCustomUI[];\n const contextUIs: ContextCustomUI[] =\n useGroupingMappingCustomUI().customUIs.filter(\n (p) => p.type === GroupingMappingCustomUIType.Context\n ) as ContextCustomUI[];\n const [showDeleteModal, setShowDeleteModal] = useState<GroupMinimal | undefined>(\n undefined\n );\n const [errorMessage, setErrorMessage] = useState<string | undefined>(undefined);\n const [activeOverlapInfoPanelGroup, setActiveOverlapInfoPanelGroup] = useState<GroupMinimal | undefined>(undefined);\n const queryClient = useQueryClient();\n\n const { data: groups, isLoading } = useFetchGroups(mappingId, getAccessToken, groupsClient);\n\n const refresh = useCallback(async () => {\n await queryClient.invalidateQueries({queryKey: [\"groups\", mappingId]});\n }, [mappingId, queryClient]);\n\n const deleteGroupMutation = useMutation(\n {\n mutationFn: async (group: GroupMinimal) => {\n const accessToken = await getAccessToken();\n await groupsClient.deleteGroup(accessToken, mappingId, group.id);\n },\n onSuccess: refresh,\n }\n );\n\n const onDeleteGroup = async (group: GroupMinimal) => {\n deleteGroupMutation.mutate(group);\n };\n\n return {\n groups,\n isLoading,\n refresh,\n onDeleteGroup,\n setShowDeleteModal,\n showDeleteModal,\n groupUIs,\n contextUIs,\n errorMessage,\n setErrorMessage,\n activeOverlapInfoPanelGroup,\n setActiveOverlapInfoPanelGroup,\n overlappedElementsInfo,\n };\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IModelConnection } from "@itwin/core-frontend";
|
|
2
|
-
import type {
|
|
2
|
+
import type { GroupMinimal } from "@itwin/insights-client";
|
|
3
3
|
import type { KeySet } from "@itwin/presentation-common";
|
|
4
4
|
import { TErrCodes } from "../../Constants";
|
|
5
5
|
export interface QueryResults {
|
|
@@ -9,7 +9,7 @@ export interface QueryResults {
|
|
|
9
9
|
ids: string[];
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
export declare const createQueryForHiliteIdsAndKeyset: (group:
|
|
12
|
+
export declare const createQueryForHiliteIdsAndKeyset: (group: GroupMinimal, iModelConnection: IModelConnection, enabled: boolean) => {
|
|
13
13
|
queryKey: string[];
|
|
14
14
|
queryFn: () => Promise<{
|
|
15
15
|
query: string;
|
|
@@ -25,8 +25,8 @@ export declare const createQueryForHiliteIdsAndKeyset: (group: Group, iModelConn
|
|
|
25
25
|
message: string;
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
export declare const useGroupKeySetQuery: (group:
|
|
29
|
-
export declare const useKeySetHiliteQueries: (groups:
|
|
28
|
+
export declare const useGroupKeySetQuery: (group: GroupMinimal, iModelConnection: IModelConnection, enabled: boolean) => import("@tanstack/react-query").UseQueryResult<QueryResults, unknown>;
|
|
29
|
+
export declare const useKeySetHiliteQueries: (groups: GroupMinimal[], enabled: boolean, iModelConnection: IModelConnection) => {
|
|
30
30
|
groupQueries: Pick<import("@tanstack/react-query").UseQueryResult<QueryResults, unknown>, "data" | "isFetching" | "isFetched" | "refetch">[];
|
|
31
31
|
};
|
|
32
32
|
//# sourceMappingURL=useKeySetHiliteQueries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeySetHiliteQueries.js","sourceRoot":"","sources":["../../../../../src/components/Groups/hooks/useKeySetHiliteQueries.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAQjE,EAAE,CAAC;AAIJ,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"useKeySetHiliteQueries.js","sourceRoot":"","sources":["../../../../../src/components/Groups/hooks/useKeySetHiliteQueries.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAu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AAE,CAAC,gCAAgC,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC,EACrH,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvC,MAAM,cAAc,GAAG,UAAU,CAAW,EAAE,OAAO,EAAE,CAAC,CAAC;IAEzD,MAAM,YAAY,GAAG,yBAAyB,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC;IAE/G,OAAO,EAAE,YAAY,EAAE,CAAC;AAC1B,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { GroupMinimal } from \"@itwin/insights-client\";\nimport type { KeySet } from \"@itwin/presentation-common\";\nimport type { UseQueryOptions } from \"@tanstack/react-query\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useQueries } from \"@tanstack/react-query\";\nimport { useMemo } from \"react\";\nimport { useMemoizedCollectionPick } from \"../../../common/hooks/useMemoizedCollectionPick\";\nimport { TErrCodes } from \"../../Constants\";\nimport { getHiliteIdsAndKeysetFromGroup } from \"../groupsHelpers\";\n\nexport interface QueryResults {\n query: string;\n result: {\n keySet: KeySet;\n ids: string[];\n };\n}[];\n\ntype TQueries = UseQueryOptions<QueryResults>[];\n\nexport const createQueryForHiliteIdsAndKeyset = (group: GroupMinimal, iModelConnection: IModelConnection, enabled: boolean) => ({\n queryKey: [\"group\", \"hiliteids\", group.query],\n queryFn: async () => getHiliteIdsAndKeysetFromGroup(iModelConnection, group),\n enabled,\n staleTime: Infinity,\n meta: { errorCode:TErrCodes.QUERY_HILITE_FETCH_FAILED, message: `Failed to resolve ${group.groupName}.` },\n});\n\nexport const useGroupKeySetQuery = (group: GroupMinimal, iModelConnection: IModelConnection, enabled: boolean) => {\n const query = useMemo(() => createQueryForHiliteIdsAndKeyset(group, iModelConnection, enabled), [enabled, group, iModelConnection]);\n\n return useQuery<QueryResults>(query);\n};\n\nexport const useKeySetHiliteQueries = (groups: GroupMinimal[], enabled: boolean, iModelConnection: IModelConnection) => {\n const queries = useMemo(() => groups.map((group) => createQueryForHiliteIdsAndKeyset(group, iModelConnection, enabled)),\n [groups, iModelConnection, enabled]);\n\n const useQueriesHook = useQueries<TQueries>({ queries });\n\n const groupQueries = useMemoizedCollectionPick(useQueriesHook, [\"data\", \"isFetching\", \"isFetched\", \"refetch\"]);\n\n return { groupQueries };\n};\n"]}
|
|
@@ -4,12 +4,20 @@ import type { Mapping } from "@itwin/insights-client";
|
|
|
4
4
|
declare const defaultDisplayStrings: {
|
|
5
5
|
mappingDetails: string;
|
|
6
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Props for the {@link MappingAction} component.
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
7
11
|
export interface MappingActionProps {
|
|
8
12
|
mapping?: Mapping;
|
|
9
13
|
onSaveSuccess: () => void;
|
|
10
14
|
onClickCancel?: () => void;
|
|
11
15
|
displayStrings?: Partial<typeof defaultDisplayStrings>;
|
|
12
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Component to create or update a mapping.
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
13
21
|
export declare const MappingAction: ({ mapping, onSaveSuccess, onClickCancel, displayStrings: userDisplayStrings }: MappingActionProps) => JSX.Element;
|
|
14
22
|
export {};
|
|
15
23
|
//# sourceMappingURL=MappingAction.d.ts.map
|
|
@@ -14,6 +14,10 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
|
14
14
|
const defaultDisplayStrings = {
|
|
15
15
|
mappingDetails: "Mapping Details",
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Component to create or update a mapping.
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
17
21
|
export const MappingAction = ({ mapping, onSaveSuccess, onClickCancel, displayStrings: userDisplayStrings }) => {
|
|
18
22
|
const { getAccessToken, iModelId } = useGroupingMappingApiConfig();
|
|
19
23
|
const mappingClient = useMappingClient();
|
|
@@ -29,8 +33,8 @@ export const MappingAction = ({ mapping, onSaveSuccess, onClickCancel, displaySt
|
|
|
29
33
|
mutationFn: async (newMapping) => {
|
|
30
34
|
const accessToken = await getAccessToken();
|
|
31
35
|
return mapping
|
|
32
|
-
? mappingClient.updateMapping(accessToken,
|
|
33
|
-
: mappingClient.createMapping(accessToken,
|
|
36
|
+
? mappingClient.updateMapping(accessToken, mapping.id, newMapping)
|
|
37
|
+
: mappingClient.createMapping(accessToken, newMapping);
|
|
34
38
|
},
|
|
35
39
|
onSuccess: async () => {
|
|
36
40
|
await queryClient.invalidateQueries({ queryKey: ["mappings"] });
|
|
@@ -43,6 +47,7 @@ export const MappingAction = ({ mapping, onSaveSuccess, onClickCancel, displaySt
|
|
|
43
47
|
return;
|
|
44
48
|
}
|
|
45
49
|
saveMutation({
|
|
50
|
+
iModelId,
|
|
46
51
|
mappingName: values.name,
|
|
47
52
|
description: values.description,
|
|
48
53
|
extractionEnabled: values.extractionEnabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappingAction.js","sourceRoot":"","sources":["../../../../../src/components/Mappings/Editing/MappingAction.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,WAAW,MAAM,oCAAoC,CAAC;AAC7D,OAAO,YAAY,EAAE,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACtF,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE,OAAO,EAAE,2BAA2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AAW,EACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;wBAClB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;oBAC9C,CAAC,GACD;gBACF,oBAAC,YAAY,IACX,EAAE,EAAC,mBAAmB,EACtB,IAAI,EAAC,mBAAmB,EACxB,KAAK,EAAC,0BAA0B,EAChC,aAAa,EAAC,OAAO,EACrB,OAAO,EAAE,MAAM,CAAC,iBAAiB,EACjC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;wBAClB,SAAS,CAAC,EAAE,GAAG,MAAM,EAAE,iBAAiB,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC;oBAC3E,CAAC,GACD,CACO,CACP;QACN,oBAAC,WAAW,IACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,aAAa,EACvB,gBAAgB,EAAE,CAAC,MAAM,CAAC,IAAI,EAC9B,SAAS,EAAE,SAAS,GACpB,CACD,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 { Fieldset, LabeledInput, Text, ToggleSwitch } from \"@itwin/itwinui-react\";\nimport React, { useState } from \"react\";\nimport ActionPanel from \"../../SharedComponents/ActionPanel\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../../Properties/hooks/useValidator\";\nimport \"./MappingAction.scss\";\nimport { useMappingClient } from \"../../context/MappingClientContext\";\nimport type { Mapping, MappingCreate } from \"@itwin/insights-client\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { handleInputChange } from \"../../../common/utils\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\n\nconst defaultDisplayStrings = {\n mappingDetails: \"Mapping Details\",\n};\n\n/**\n * Props for the {@link MappingAction} component.\n * @public\n */\nexport interface MappingActionProps {\n mapping?: Mapping;\n onSaveSuccess: () => void;\n onClickCancel?: () => void;\n displayStrings?: Partial<typeof defaultDisplayStrings>;\n}\n\n/**\n * Component to create or update a mapping.\n * @public\n */\nexport const MappingAction = ({ mapping, onSaveSuccess, onClickCancel, displayStrings: userDisplayStrings }: MappingActionProps) => {\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n const [values, setValues] = useState({\n name: mapping?.mappingName ?? \"\",\n description: mapping?.description ?? \"\",\n extractionEnabled: mapping?.extractionEnabled ?? true,\n });\n const [validator, showValidationMessage] = useValidator();\n const queryClient = useQueryClient();\n\n const displayStrings = React.useMemo(\n () => ({ ...defaultDisplayStrings, ...userDisplayStrings }),\n [userDisplayStrings]\n );\n\n const { mutate: saveMutation, isLoading } = useMutation(\n {\n mutationFn: async (newMapping: MappingCreate) => {\n const accessToken = await getAccessToken();\n return mapping\n ? mappingClient.updateMapping(accessToken, mapping.id, newMapping)\n : mappingClient.createMapping(accessToken, newMapping);\n },\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: [\"mappings\"] });\n onSaveSuccess();\n },\n }\n );\n\n const onSave = async () => {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n saveMutation({\n iModelId,\n mappingName: values.name,\n description: values.description,\n extractionEnabled: values.extractionEnabled,\n });\n };\n\n return (\n <>\n <div className='gmw-details-form-container'>\n <Fieldset legend={displayStrings.mappingDetails} className='gmw-details-form'>\n <Text variant='small' as='small' className='gmw-field-legend'>\n Asterisk * indicates mandatory fields.\n </Text>\n <LabeledInput\n id='name'\n name='name'\n label='Name'\n value={values.name}\n required\n onChange={(event) => {\n handleInputChange(event, values, setValues);\n validator.showMessageFor(\"name\");\n }}\n message={validator.message(\"name\", values.name, NAME_REQUIREMENTS)}\n status={\n validator.message(\"name\", values.name, NAME_REQUIREMENTS)\n ? \"negative\"\n : undefined\n }\n onBlur={() => {\n validator.showMessageFor(\"name\");\n }}\n onBlurCapture={(event) => {\n handleInputChange(event, values, setValues);\n validator.showMessageFor(\"name\");\n }}\n />\n <LabeledInput\n id='description'\n name='description'\n label='Description'\n value={values.description}\n onChange={(event) => {\n handleInputChange(event, values, setValues);\n }}\n />\n <ToggleSwitch\n id='extractionEnabled'\n name='extractionEnabled'\n label='Extract data from iModel'\n labelPosition=\"right\"\n checked={values.extractionEnabled}\n onChange={(event) => {\n setValues({ ...values, extractionEnabled: event.currentTarget.checked });\n }}\n />\n </Fieldset>\n </div>\n <ActionPanel\n onSave={onSave}\n onCancel={onClickCancel}\n isSavingDisabled={!values.name}\n isLoading={isLoading}\n />\n </>\n );\n};\n"]}
|
|
@@ -14,11 +14,13 @@ import { useQueries } from "@tanstack/react-query";
|
|
|
14
14
|
import { useMemoizedCollectionPick } from "../../../common/hooks/useMemoizedCollectionPick";
|
|
15
15
|
import { fetchGroups } from "../../Groups/hooks/useFetchGroups";
|
|
16
16
|
import { useFetchMappings } from "../hooks/useFetchMappings";
|
|
17
|
+
import { useGroupsClient } from "../../context/GroupsClientContext";
|
|
17
18
|
export const ExtractionMessageModal = ({ isOpen, onClose, extractionMessageData, timestamp }) => {
|
|
18
19
|
const [formattedExtractionMessage, setFormattedExtractionMessage] = useState(undefined);
|
|
19
20
|
const groupingMappingApiConfig = useGroupingMappingApiConfig();
|
|
20
21
|
const { iModelId, getAccessToken } = groupingMappingApiConfig;
|
|
21
22
|
const mappingClient = useMappingClient();
|
|
23
|
+
const groupsClient = useGroupsClient();
|
|
22
24
|
const { data: mappings, isLoading: isMappingsLoading } = useFetchMappings(iModelId, getAccessToken, mappingClient);
|
|
23
25
|
const [formattedTimestamp, setFormattedTimestamp] = useState("");
|
|
24
26
|
const getMappingName = useCallback((mappingId, mappings) => {
|
|
@@ -39,9 +41,9 @@ export const ExtractionMessageModal = ({ isOpen, onClose, extractionMessageData,
|
|
|
39
41
|
// useQueries to fetch all group names
|
|
40
42
|
const groupQueriesResults = useQueries({
|
|
41
43
|
queries: Array.from(extractionInfo.values()).map(({ mappingId }) => ({
|
|
42
|
-
queryKey: ["groups", mappingId],
|
|
44
|
+
queryKey: ["mapping", "groups", mappingId],
|
|
43
45
|
queryFn: async () => {
|
|
44
|
-
const groups = await fetchGroups(
|
|
46
|
+
const groups = await fetchGroups(mappingId, groupingMappingApiConfig.getAccessToken, groupsClient);
|
|
45
47
|
// Return both mappingId and groups in the result
|
|
46
48
|
return { mappingId, groups };
|
|
47
49
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtractionMessageModal.js","sourceRoot":"","sources":["../../../../../src/components/Mappings/Extraction/ExtractionMessageModal.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACjI,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAgB7D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EAAE,M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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 { Button, DefaultCell, Icon, Modal, ModalButtonBar, ModalContent, Table, tableFilters, Text } from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { CreateTypeFromInterface } from \"../../../common/utils\";\nimport \"./ExtractionMessageModal.scss\";\nimport { SvgClock } from \"@itwin/itwinui-icons-react\";\nimport type { CellRendererProps, Column } from \"react-table\";\nimport { StatusIcon } from \"../../SharedComponents/StatusIcon\";\nimport { ExtractionLogCustomFilter } from \"./ExtractionLogCustomFilter\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { useMappingClient } from \"../../context/MappingClientContext\";\nimport type { Mapping } from \"@itwin/insights-client\";\nimport { useQueries } from \"@tanstack/react-query\";\nimport { useMemoizedCollectionPick } from \"../../../common/hooks/useMemoizedCollectionPick\";\nimport { fetchGroups } from \"../../Groups/hooks/useFetchGroups\";\nimport { useFetchMappings } from \"../hooks/useFetchMappings\";\n\nexport interface ExtractionMessageData {\n date: string;\n category: string;\n level: string;\n message: string;\n}\n\nexport interface ExtractionMessageModalProps {\n isOpen: boolean;\n onClose: () => void;\n extractionMessageData: ExtractionMessageData[];\n timestamp: string;\n}\n\nexport const ExtractionMessageModal = ({ isOpen, onClose, extractionMessageData, timestamp }: ExtractionMessageModalProps) => {\n const [formattedExtractionMessage, setFormattedExtractionMessage] = useState<ExtractionMessageData[] | undefined>(undefined);\n const groupingMappingApiConfig = useGroupingMappingApiConfig();\n const { iModelId, getAccessToken } = groupingMappingApiConfig;\n const mappingClient = useMappingClient();\n const { data: mappings, isLoading: isMappingsLoading } = useFetchMappings(iModelId, getAccessToken, mappingClient);\n const [formattedTimestamp, setFormattedTimestamp] = useState<string>(\"\");\n\n const getMappingName = useCallback((mappingId: string, mappings: Mapping[]) => {\n return mappings.find((mapping) => mapping.id === mappingId)?.mappingName ?? \"\";\n }, []);\n\n const extractionInfo = useMemo(() => {\n const infoMap = new Map<string, { mappingId: string, groupId: string }>();\n\n extractionMessageData.forEach((message) => {\n const splittedMessage = message.message.split(\" \");\n const mappingId = splittedMessage[splittedMessage.indexOf(\"MappingId:\") + 1]?.match(/^([^,]+),$/)?.[1];\n const groupId = splittedMessage[splittedMessage.indexOf(\"GroupId:\") + 1]?.match(/^([^,]+).$/)?.[1];\n\n if (mappingId && groupId) {\n infoMap.set(message.message, { mappingId, groupId });\n }\n });\n\n return infoMap;\n }, [extractionMessageData]);\n\n // useQueries to fetch all group names\n const groupQueriesResults = useQueries({\n queries: Array.from(extractionInfo.values()).map(({ mappingId }) => ({\n queryKey: [\"groups\", mappingId],\n queryFn: async () => {\n const groups = await fetchGroups(groupingMappingApiConfig.iModelId, mappingId, groupingMappingApiConfig.getAccessToken, mappingClient);\n // Return both mappingId and groups in the result\n return { mappingId, groups };\n },\n })),\n });\n\n // Workaround to get data from useQueries with more stability\n const pickedResult = useMemoizedCollectionPick(groupQueriesResults, [\"data\", \"error\", \"isLoading\", \"isSuccess\"]);\n\n useEffect(() => {\n if (pickedResult.every((query) => query.isSuccess) && mappings) {\n const formattedMessages = extractionMessageData.map((extractionMessage) => {\n let replacedMessage: string = extractionMessage.message;\n\n const info = extractionInfo.get(extractionMessage.message);\n if (info) {\n const { mappingId, groupId } = info;\n\n const queryResult = pickedResult.find((result) => result.data?.mappingId === mappingId);\n const groupName = queryResult?.data?.groups?.find((group) => group.id === groupId)?.groupName;\n\n if (replacedMessage.includes(\"MappingId:\")) {\n const mappingName = getMappingName(mappingId, mappings);\n replacedMessage = replacedMessage.replace(/MappingId: [\\w-]+/, `Mapping: ${mappingName}`);\n }\n\n if (replacedMessage.includes(\"GroupId:\")) {\n replacedMessage = replacedMessage.replace(/GroupId: [\\w-]+/, `Group: ${groupName ? groupName : \"<Not Found>\"}`);\n }\n }\n\n return { ...extractionMessage, message: replacedMessage };\n });\n\n setFormattedExtractionMessage(formattedMessages);\n }\n }, [extractionMessageData, mappings, extractionInfo, getMappingName, pickedResult]);\n\n useEffect(() => {\n const newDateTime: Date = new Date(timestamp);\n const options: Intl.DateTimeFormatOptions = {\n day: \"numeric\", month: \"numeric\", year: \"numeric\",\n hour: \"2-digit\", minute: \"2-digit\",\n };\n setFormattedTimestamp(newDateTime.toLocaleString(undefined, options));\n }, [timestamp]);\n\n const translatedLabels = useMemo(() => ({\n filter: \"Filter\",\n clear: \"Clear\",\n }), []);\n\n const columns = useMemo(\n (): Column<CreateTypeFromInterface<ExtractionMessageData>>[] => [\n {\n id: \"category\",\n Header: \"Category\",\n accessor: \"category\",\n fieldType: \"text\",\n Filter: ExtractionLogCustomFilter,\n filter: \"equals\",\n },\n {\n id: \"level\",\n Header: \"Level\",\n accessor: \"level\",\n cellRenderer: ({ cellElementProps, cellProps }: CellRendererProps<CreateTypeFromInterface<ExtractionMessageData>>) => {\n const level = cellProps.row.original.level;\n return (\n <DefaultCell\n cellElementProps={cellElementProps}\n cellProps={cellProps}\n startIcon={\n level === \"Error\" ? (\n <StatusIcon status='error' />\n ) : level === \"Warning\" ? (\n <StatusIcon status='warning' />\n ) : level === \"Info\" ? (\n <StatusIcon status='informational' />\n ) : <StatusIcon status='trace' />\n }\n >\n {level}\n </DefaultCell>\n );\n },\n Filter: ExtractionLogCustomFilter,\n filter: \"equals\",\n },\n {\n id: \"message\",\n Header: \"Message\",\n accessor: \"message\",\n width: \"25vw\",\n fieldType: \"text\",\n Filter: tableFilters.TextFilter(translatedLabels),\n },\n ],\n [translatedLabels]\n );\n const isLoading = pickedResult.some((query) => query.isLoading) || isMappingsLoading;\n\n return (\n <Modal className=\"gmw-message-modal-container\"\n title=\"Extraction Logs\"\n isOpen={isOpen}\n onClose={onClose}\n closeOnExternalClick={false}\n >\n <ModalContent>\n <div className=\"gmw-timestamp-icon\">\n <Icon\n title=\"Extraction Timestamp\"\n size=\"medium\"\n >\n <SvgClock />\n </Icon>\n <Text>{formattedTimestamp}</Text>\n </div>\n <Table<CreateTypeFromInterface<ExtractionMessageData>>\n columns={columns}\n data={formattedExtractionMessage ?? []}\n emptyTableContent={\"\"}\n emptyFilteredTableContent=\"No results match filters.\"\n className=\"gmw-extraction-message-table-container\"\n isLoading={isLoading}\n />\n </ModalContent>\n <ModalButtonBar>\n <Button\n onClick={onClose}\n styleType=\"high-visibility\"\n >\n Close\n </Button>\n </ModalButtonBar>\n </Modal>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ExtractionMessageModal.js","sourceRoot":"","sources":["../../../../../src/components/Mappings/Extraction/ExtractionMessageModal.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AACjI,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iDAAiD,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,e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BAAC,cAAc;YACb,oBAAC,MAAM,IACL,OAAO,EAAE,OAAO,EAChB,SAAS,EAAC,iBAAiB,YAGpB,CACM,CACX,CACT,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 { Button, DefaultCell, Icon, Modal, ModalButtonBar, ModalContent, Table, tableFilters, Text } from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport type { CreateTypeFromInterface } from \"../../../common/utils\";\nimport \"./ExtractionMessageModal.scss\";\nimport { SvgClock } from \"@itwin/itwinui-icons-react\";\nimport type { CellRendererProps, Column } from \"react-table\";\nimport { StatusIcon } from \"../../SharedComponents/StatusIcon\";\nimport { ExtractionLogCustomFilter } from \"./ExtractionLogCustomFilter\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { useMappingClient } from \"../../context/MappingClientContext\";\nimport type { GroupMinimal, Mapping } from \"@itwin/insights-client\";\nimport { useQueries } from \"@tanstack/react-query\";\nimport { useMemoizedCollectionPick } from \"../../../common/hooks/useMemoizedCollectionPick\";\nimport { fetchGroups } from \"../../Groups/hooks/useFetchGroups\";\nimport { useFetchMappings } from \"../hooks/useFetchMappings\";\nimport { useGroupsClient } from \"../../context/GroupsClientContext\";\n\nexport interface ExtractionMessageData {\n date: string;\n category: string;\n level: string;\n message: string;\n}\n\nexport interface ExtractionMessageModalProps {\n isOpen: boolean;\n onClose: () => void;\n extractionMessageData: ExtractionMessageData[];\n timestamp: string;\n}\n\nexport const ExtractionMessageModal = ({ isOpen, onClose, extractionMessageData, timestamp }: ExtractionMessageModalProps) => {\n const [formattedExtractionMessage, setFormattedExtractionMessage] = useState<ExtractionMessageData[] | undefined>(undefined);\n const groupingMappingApiConfig = useGroupingMappingApiConfig();\n const { iModelId, getAccessToken } = groupingMappingApiConfig;\n const mappingClient = useMappingClient();\n const groupsClient = useGroupsClient();\n const { data: mappings, isLoading: isMappingsLoading } = useFetchMappings(iModelId, getAccessToken, mappingClient);\n const [formattedTimestamp, setFormattedTimestamp] = useState<string>(\"\");\n\n const getMappingName = useCallback((mappingId: string, mappings: Mapping[]) => {\n return mappings.find((mapping) => mapping.id === mappingId)?.mappingName ?? \"\";\n }, []);\n\n const extractionInfo = useMemo(() => {\n const infoMap = new Map<string, { mappingId: string, groupId: string }>();\n\n extractionMessageData.forEach((message) => {\n const splittedMessage = message.message.split(\" \");\n const mappingId = splittedMessage[splittedMessage.indexOf(\"MappingId:\") + 1]?.match(/^([^,]+),$/)?.[1];\n const groupId = splittedMessage[splittedMessage.indexOf(\"GroupId:\") + 1]?.match(/^([^,]+).$/)?.[1];\n\n if (mappingId && groupId) {\n infoMap.set(message.message, { mappingId, groupId });\n }\n });\n\n return infoMap;\n }, [extractionMessageData]);\n\n // useQueries to fetch all group names\n const groupQueriesResults = useQueries({\n queries: Array.from(extractionInfo.values()).map(({ mappingId }) => ({\n queryKey: [\"mapping\", \"groups\", mappingId],\n queryFn: async () => {\n const groups = await fetchGroups(mappingId, groupingMappingApiConfig.getAccessToken, groupsClient);\n // Return both mappingId and groups in the result\n return { mappingId, groups };\n },\n })),\n });\n\n // Workaround to get data from useQueries with more stability\n const pickedResult = useMemoizedCollectionPick(groupQueriesResults, [\"data\", \"error\", \"isLoading\", \"isSuccess\"]);\n\n useEffect(() => {\n if (pickedResult.every((query) => query.isSuccess) && mappings) {\n const formattedMessages = extractionMessageData.map((extractionMessage) => {\n let replacedMessage: string = extractionMessage.message;\n\n const info = extractionInfo.get(extractionMessage.message);\n if (info) {\n const { mappingId, groupId } = info;\n\n const queryResult = pickedResult.find((result) => result.data?.mappingId === mappingId);\n const groupName = queryResult?.data?.groups?.find((group: GroupMinimal) => group.id === groupId)?.groupName;\n\n if (replacedMessage.includes(\"MappingId:\")) {\n const mappingName = getMappingName(mappingId, mappings);\n replacedMessage = replacedMessage.replace(/MappingId: [\\w-]+/, `Mapping: ${mappingName}`);\n }\n\n if (replacedMessage.includes(\"GroupId:\")) {\n replacedMessage = replacedMessage.replace(/GroupId: [\\w-]+/, `Group: ${groupName ? groupName : \"<Not Found>\"}`);\n }\n }\n\n return { ...extractionMessage, message: replacedMessage };\n });\n\n setFormattedExtractionMessage(formattedMessages);\n }\n }, [extractionMessageData, mappings, extractionInfo, getMappingName, pickedResult]);\n\n useEffect(() => {\n const newDateTime: Date = new Date(timestamp);\n const options: Intl.DateTimeFormatOptions = {\n day: \"numeric\", month: \"numeric\", year: \"numeric\",\n hour: \"2-digit\", minute: \"2-digit\",\n };\n setFormattedTimestamp(newDateTime.toLocaleString(undefined, options));\n }, [timestamp]);\n\n const translatedLabels = useMemo(() => ({\n filter: \"Filter\",\n clear: \"Clear\",\n }), []);\n\n const columns = useMemo(\n (): Column<CreateTypeFromInterface<ExtractionMessageData>>[] => [\n {\n id: \"category\",\n Header: \"Category\",\n accessor: \"category\",\n fieldType: \"text\",\n Filter: ExtractionLogCustomFilter,\n filter: \"equals\",\n },\n {\n id: \"level\",\n Header: \"Level\",\n accessor: \"level\",\n cellRenderer: ({ cellElementProps, cellProps }: CellRendererProps<CreateTypeFromInterface<ExtractionMessageData>>) => {\n const level = cellProps.row.original.level;\n return (\n <DefaultCell\n cellElementProps={cellElementProps}\n cellProps={cellProps}\n startIcon={\n level === \"Error\" ? (\n <StatusIcon status='error' />\n ) : level === \"Warning\" ? (\n <StatusIcon status='warning' />\n ) : level === \"Info\" ? (\n <StatusIcon status='informational' />\n ) : <StatusIcon status='trace' />\n }\n >\n {level}\n </DefaultCell>\n );\n },\n Filter: ExtractionLogCustomFilter,\n filter: \"equals\",\n },\n {\n id: \"message\",\n Header: \"Message\",\n accessor: \"message\",\n width: \"25vw\",\n fieldType: \"text\",\n Filter: tableFilters.TextFilter(translatedLabels),\n },\n ],\n [translatedLabels]\n );\n const isLoading = pickedResult.some((query) => query.isLoading) || isMappingsLoading;\n\n return (\n <Modal className=\"gmw-message-modal-container\"\n title=\"Extraction Logs\"\n isOpen={isOpen}\n onClose={onClose}\n closeOnExternalClick={false}\n >\n <ModalContent>\n <div className=\"gmw-timestamp-icon\">\n <Icon\n title=\"Extraction Timestamp\"\n size=\"medium\"\n >\n <SvgClock />\n </Icon>\n <Text>{formattedTimestamp}</Text>\n </div>\n <Table<CreateTypeFromInterface<ExtractionMessageData>>\n columns={columns}\n data={formattedExtractionMessage ?? []}\n emptyTableContent={\"\"}\n emptyFilteredTableContent=\"No results match filters.\"\n className=\"gmw-extraction-message-table-container\"\n isLoading={isLoading}\n />\n </ModalContent>\n <ModalButtonBar>\n <Button\n onClick={onClose}\n styleType=\"high-visibility\"\n >\n Close\n </Button>\n </ModalButtonBar>\n </Modal>\n );\n};\n"]}
|
|
@@ -5,7 +5,6 @@ declare const defaultDisplayStrings: {
|
|
|
5
5
|
mappings: string;
|
|
6
6
|
};
|
|
7
7
|
interface ConfirmMappingImportProps {
|
|
8
|
-
sourceiModelId: string;
|
|
9
8
|
selectedMappings: IMappingTyped[];
|
|
10
9
|
importing: boolean;
|
|
11
10
|
setImporting: React.Dispatch<React.SetStateAction<boolean>>;
|
|
@@ -15,6 +14,6 @@ interface ConfirmMappingImportProps {
|
|
|
15
14
|
onFinish: () => void;
|
|
16
15
|
displayStrings?: Partial<typeof defaultDisplayStrings>;
|
|
17
16
|
}
|
|
18
|
-
declare const ConfirmMappingImport: ({
|
|
17
|
+
declare const ConfirmMappingImport: ({ selectedMappings, importing, setImporting, setSelectedMappings, backFn, onCancel, onFinish, displayStrings: userDisplayStrings, }: ConfirmMappingImportProps) => JSX.Element;
|
|
19
18
|
export default ConfirmMappingImport;
|
|
20
19
|
//# sourceMappingURL=ConfirmMappingsImport.d.ts.map
|