@itwin/grouping-mapping-widget 0.25.2 → 0.26.1
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/LICENSE.md +9 -9
- package/README.md +115 -115
- package/lib/cjs/WidgetShell/GroupingMapping.d.ts +5 -5
- package/lib/cjs/WidgetShell/GroupingMapping.js +2 -4
- package/lib/cjs/WidgetShell/GroupingMapping.js.map +1 -1
- package/lib/cjs/WidgetShell/GroupingMappingContent.js +4 -4
- package/lib/cjs/WidgetShell/GroupingMappingContent.js.map +1 -1
- package/lib/cjs/WidgetShell/GroupingMappingHeader.d.ts +1 -1
- package/lib/cjs/WidgetShell/GroupingMappingHeader.js +5 -5
- package/lib/cjs/WidgetShell/GroupingMappingHeader.js.map +1 -1
- package/lib/cjs/WidgetShell/GroupingMappingWidget.d.ts +4 -0
- package/lib/cjs/WidgetShell/GroupingMappingWidget.js +5 -3
- package/lib/cjs/WidgetShell/GroupingMappingWidget.js.map +1 -1
- package/lib/cjs/WidgetShell/Router/GroupingMappingRouter.js +28 -8
- package/lib/cjs/WidgetShell/Router/GroupingMappingRouter.js.map +1 -1
- package/lib/cjs/WidgetShell/WidgetHeader/WidgetHeader.d.ts +1 -1
- package/lib/cjs/WidgetShell/WidgetHeader/WidgetHeader.js +7 -7
- package/lib/cjs/WidgetShell/WidgetHeader/WidgetHeader.js.map +1 -1
- package/lib/cjs/common/hooks/useIsMounted.js +3 -3
- package/lib/cjs/common/hooks/useIsMounted.js.map +1 -1
- package/lib/cjs/common/hooks/useMemoizedCollectionPick.js +3 -3
- package/lib/cjs/common/hooks/useMemoizedCollectionPick.js.map +1 -1
- package/lib/cjs/common/utils.js +3 -3
- package/lib/cjs/common/utils.js.map +1 -1
- package/lib/cjs/common/viewerUtils.js +2 -2
- package/lib/cjs/common/viewerUtils.js.map +1 -1
- package/lib/cjs/components/Constants.js +4 -4
- package/lib/cjs/components/Constants.js.map +1 -1
- package/lib/cjs/components/GroupingMappingContext.d.ts +19 -3
- package/lib/cjs/components/GroupingMappingContext.js +40 -13
- 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 +16 -14
- package/lib/cjs/components/Groups/Editing/GroupAction.js.map +1 -1
- package/lib/cjs/components/Groups/Editing/GroupDetails.d.ts +1 -1
- package/lib/cjs/components/Groups/Editing/GroupDetails.js +5 -7
- package/lib/cjs/components/Groups/Editing/GroupDetails.js.map +1 -1
- package/lib/cjs/components/Groups/Editing/GroupDetailsActionPanel.d.ts +1 -1
- package/lib/cjs/components/Groups/Editing/GroupDetailsActionPanel.js +4 -4
- package/lib/cjs/components/Groups/Editing/GroupDetailsActionPanel.js.map +1 -1
- package/lib/cjs/components/Groups/Editing/GroupDetailsStep.js +4 -4
- package/lib/cjs/components/Groups/Editing/GroupDetailsStep.js.map +1 -1
- package/lib/cjs/components/Groups/GroupColorLegend.d.ts +3 -3
- package/lib/cjs/components/Groups/GroupColorLegend.js +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 -4
- 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 +17 -6
- 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 +7 -3
- package/lib/cjs/components/Groups/Groups.js.map +1 -1
- package/lib/cjs/components/Groups/GroupsAddButton.d.ts +1 -1
- package/lib/cjs/components/Groups/GroupsAddButton.js +4 -4
- package/lib/cjs/components/Groups/GroupsAddButton.js.map +1 -1
- package/lib/cjs/components/Groups/GroupsAddButton.scss +1 -1
- package/lib/cjs/components/Groups/GroupsShowHideButtons.d.ts +5 -5
- package/lib/cjs/components/Groups/GroupsShowHideButtons.js +2 -2
- 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 +12 -10
- package/lib/cjs/components/Groups/GroupsView.js.map +1 -1
- package/lib/cjs/components/Groups/GroupsView.scss +1 -1
- package/lib/cjs/components/Groups/GroupsVisualization.d.ts +8 -0
- package/lib/cjs/components/Groups/GroupsVisualization.js +27 -24
- package/lib/cjs/components/Groups/GroupsVisualization.js.map +1 -1
- package/lib/cjs/components/Groups/GroupsVisualizationActions.js +4 -4
- package/lib/cjs/components/Groups/GroupsVisualizationActions.js.map +1 -1
- package/lib/cjs/components/Groups/OverlappedElementsInformationPanel.d.ts +4 -4
- package/lib/cjs/components/Groups/OverlappedElementsInformationPanel.js +4 -4
- package/lib/cjs/components/Groups/OverlappedElementsInformationPanel.js.map +1 -1
- package/lib/cjs/components/Groups/OverlappedElementsInformationPanel.scss +7 -7
- package/lib/cjs/components/Groups/QueryBuilder/QueryBuilder.js +13 -35
- package/lib/cjs/components/Groups/QueryBuilder/QueryBuilder.js.map +1 -1
- package/lib/cjs/components/Groups/QueryBuilder/QueryBuilderActionPanel.js +4 -4
- package/lib/cjs/components/Groups/QueryBuilder/QueryBuilderActionPanel.js.map +1 -1
- package/lib/cjs/components/Groups/QueryBuilder/QueryBuilderCustomUI.d.ts +3 -3
- package/lib/cjs/components/Groups/QueryBuilder/QueryBuilderCustomUI.js +4 -4
- package/lib/cjs/components/Groups/QueryBuilder/QueryBuilderCustomUI.js.map +1 -1
- package/lib/cjs/components/Groups/QueryBuilder/QueryBuilderStep.js +4 -4
- package/lib/cjs/components/Groups/QueryBuilder/QueryBuilderStep.js.map +1 -1
- package/lib/cjs/components/Groups/ToggleGroupVisibility.js +3 -3
- package/lib/cjs/components/Groups/ToggleGroupVisibility.js.map +1 -1
- package/lib/cjs/components/Groups/groupsHelpers.d.ts +2 -2
- package/lib/cjs/components/Groups/groupsHelpers.js +8 -4
- 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 +16 -8
- package/lib/cjs/components/Groups/hooks/useGroupsOperations.js +14 -10
- 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/Groups/hooks/useVisualization.js +2 -4
- package/lib/cjs/components/Groups/hooks/useVisualization.js.map +1 -1
- package/lib/cjs/components/Mappings/BlockingOverlay.js +3 -3
- package/lib/cjs/components/Mappings/BlockingOverlay.js.map +1 -1
- package/lib/cjs/components/Mappings/Editing/MappingAction.d.ts +8 -0
- package/lib/cjs/components/Mappings/Editing/MappingAction.js +16 -15
- package/lib/cjs/components/Mappings/Editing/MappingAction.js.map +1 -1
- package/lib/cjs/components/Mappings/Extraction/ExtractionLogCustomFilter.d.ts +1 -1
- package/lib/cjs/components/Mappings/Extraction/ExtractionLogCustomFilter.js +1 -1
- package/lib/cjs/components/Mappings/Extraction/ExtractionLogCustomFilter.js.map +1 -1
- package/lib/cjs/components/Mappings/Extraction/ExtractionMessageModal.js +12 -7
- package/lib/cjs/components/Mappings/Extraction/ExtractionMessageModal.js.map +1 -1
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.js +3 -3
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.js.map +1 -1
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.js +3 -3
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.js.map +1 -1
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.js +3 -3
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.js.map +1 -1
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.js +3 -3
- package/lib/cjs/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.js.map +1 -1
- package/lib/cjs/components/Mappings/Extraction/ExtractionStatus.d.ts +1 -1
- package/lib/cjs/components/Mappings/Extraction/ExtractionStatus.js +9 -9
- package/lib/cjs/components/Mappings/Extraction/ExtractionStatus.js.map +1 -1
- package/lib/cjs/components/Mappings/Extraction/ExtractionStatusIcon.js +4 -4
- package/lib/cjs/components/Mappings/Extraction/ExtractionStatusIcon.js.map +1 -1
- package/lib/cjs/components/Mappings/Import/ConfirmMappingsImport.d.ts +1 -2
- package/lib/cjs/components/Mappings/Import/ConfirmMappingsImport.js +30 -33
- package/lib/cjs/components/Mappings/Import/ConfirmMappingsImport.js.map +1 -1
- package/lib/cjs/components/Mappings/Import/MappingImportWizardModal.d.ts +1 -1
- package/lib/cjs/components/Mappings/Import/MappingImportWizardModal.js +4 -4
- package/lib/cjs/components/Mappings/Import/MappingImportWizardModal.js.map +1 -1
- package/lib/cjs/components/Mappings/Import/SelectIModel.d.ts +1 -1
- package/lib/cjs/components/Mappings/Import/SelectIModel.js +5 -5
- package/lib/cjs/components/Mappings/Import/SelectIModel.js.map +1 -1
- package/lib/cjs/components/Mappings/Import/SelectITwin.js +2 -2
- package/lib/cjs/components/Mappings/Import/SelectITwin.js.map +1 -1
- package/lib/cjs/components/Mappings/Import/SelectITwin.scss +1 -1
- package/lib/cjs/components/Mappings/Import/SelectMappings.d.ts +1 -1
- package/lib/cjs/components/Mappings/Import/SelectMappings.js +7 -7
- package/lib/cjs/components/Mappings/Import/SelectMappings.js.map +1 -1
- package/lib/cjs/components/Mappings/MappingListItem.js.map +1 -1
- package/lib/cjs/components/Mappings/MappingViewActionGroup.d.ts +1 -1
- package/lib/cjs/components/Mappings/MappingViewActionGroup.js +6 -6
- package/lib/cjs/components/Mappings/MappingViewActionGroup.js.map +1 -1
- package/lib/cjs/components/Mappings/Mappings.d.ts +8 -0
- package/lib/cjs/components/Mappings/Mappings.js +7 -3
- 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 +17 -15
- 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 +11 -8
- package/lib/cjs/components/Mappings/hooks/useFetchExtractionStatus.js.map +1 -1
- package/lib/cjs/components/Mappings/hooks/useFetchMappingExtractionStatus.d.ts +1 -1
- package/lib/cjs/components/Mappings/hooks/useFetchMappingExtractionStatus.js +8 -7
- package/lib/cjs/components/Mappings/hooks/useFetchMappingExtractionStatus.js.map +1 -1
- package/lib/cjs/components/Mappings/hooks/useFetchMappings.js +2 -2
- 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 +44 -22
- package/lib/cjs/components/Mappings/hooks/useMappingsOperations.js.map +1 -1
- package/lib/cjs/components/Mappings/hooks/useRunExtraction.d.ts +2 -2
- package/lib/cjs/components/Mappings/hooks/useRunExtraction.js +27 -19
- package/lib/cjs/components/Mappings/hooks/useRunExtraction.js.map +1 -1
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.d.ts +11 -3
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyAction.js +28 -15
- 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 +30 -20
- 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 +7 -5
- package/lib/cjs/components/Properties/CalculatedProperties/CalculatedPropertyTable.js.map +1 -1
- package/lib/cjs/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.js +4 -6
- package/lib/cjs/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.js.map +1 -1
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.d.ts +11 -3
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.js +74 -50
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.js.map +1 -1
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationAction.scss +1 -1
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.d.ts +3 -3
- package/lib/cjs/components/Properties/CustomCalculations/CustomCalculationTable.js +21 -15
- 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 +4 -4
- package/lib/cjs/components/Properties/GroupColorToggle.js.map +1 -1
- package/lib/cjs/components/Properties/GroupInformationPanel.js +3 -3
- package/lib/cjs/components/Properties/GroupInformationPanel.js.map +1 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.d.ts +13 -5
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js +41 -42
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyListItem.d.ts +1 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyListItem.js +5 -5
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyListItem.js.map +1 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.d.ts +4 -4
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyTable.js +20 -16
- 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 +20 -65
- package/lib/cjs/components/Properties/GroupProperties/GroupPropertyUtils.js.map +1 -1
- package/lib/cjs/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js +20 -29
- package/lib/cjs/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js.map +1 -1
- package/lib/cjs/components/Properties/GroupProperties/SaveModal.d.ts +1 -1
- package/lib/cjs/components/Properties/GroupProperties/SaveModal.js +7 -7
- package/lib/cjs/components/Properties/GroupProperties/SaveModal.js.map +1 -1
- package/lib/cjs/components/Properties/GroupProperties/SortableHorizontalTile.js +4 -4
- package/lib/cjs/components/Properties/GroupProperties/SortableHorizontalTile.js.map +1 -1
- package/lib/cjs/components/Properties/PropertyAction.js +9 -21
- package/lib/cjs/components/Properties/PropertyAction.js.map +1 -1
- package/lib/cjs/components/Properties/PropertyMenu.d.ts +13 -5
- package/lib/cjs/components/Properties/PropertyMenu.js +16 -18
- 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 +9 -5
- package/lib/cjs/components/Properties/PropertyMenuWithVisualization.js.map +1 -1
- package/lib/cjs/components/Properties/PropertyNameCell.d.ts +1 -1
- package/lib/cjs/components/Properties/PropertyNameCell.js +4 -4
- package/lib/cjs/components/Properties/PropertyNameCell.js.map +1 -1
- package/lib/cjs/components/Properties/PropertyTable.js +5 -6
- package/lib/cjs/components/Properties/PropertyTable.js.map +1 -1
- package/lib/cjs/components/Properties/PropertyTableToolbar.d.ts +1 -1
- package/lib/cjs/components/Properties/PropertyTableToolbar.js +4 -4
- package/lib/cjs/components/Properties/PropertyTableToolbar.js.map +1 -1
- package/lib/cjs/components/Properties/hooks/useFormulaValidation.d.ts +2 -1
- package/lib/cjs/components/Properties/hooks/useFormulaValidation.js +11 -7
- 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/Properties/hooks/useValidator.js +4 -4
- package/lib/cjs/components/Properties/hooks/useValidator.js.map +1 -1
- package/lib/cjs/components/SharedComponents/ActionPanel.d.ts +1 -1
- package/lib/cjs/components/SharedComponents/ActionPanel.js +9 -10
- package/lib/cjs/components/SharedComponents/ActionPanel.js.map +1 -1
- package/lib/cjs/components/SharedComponents/DeleteModal.d.ts +1 -1
- package/lib/cjs/components/SharedComponents/DeleteModal.js +9 -10
- package/lib/cjs/components/SharedComponents/DeleteModal.js.map +1 -1
- package/lib/cjs/components/SharedComponents/EmptyMessage.js +4 -4
- package/lib/cjs/components/SharedComponents/EmptyMessage.js.map +1 -1
- package/lib/cjs/components/SharedComponents/LoadingOverlay.js +4 -4
- package/lib/cjs/components/SharedComponents/LoadingOverlay.js.map +1 -1
- package/lib/cjs/components/SharedComponents/LoadingSpinner.js +3 -3
- package/lib/cjs/components/SharedComponents/LoadingSpinner.js.map +1 -1
- package/lib/cjs/components/SharedComponents/StatusIcon.js +3 -3
- package/lib/cjs/components/SharedComponents/StatusIcon.js.map +1 -1
- package/lib/cjs/components/context/ExtractionClientContext.js +3 -3
- package/lib/cjs/components/context/ExtractionClientContext.js.map +1 -1
- package/lib/cjs/components/context/ExtractionStateJobContext.js +3 -3
- package/lib/cjs/components/context/ExtractionStateJobContext.js.map +1 -1
- package/lib/cjs/components/context/GroupHilitedElementsContext.js +3 -3
- package/lib/cjs/components/context/GroupHilitedElementsContext.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/GroupingMappingCustomUIContext.js +3 -3
- package/lib/cjs/components/context/GroupingMappingCustomUIContext.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/IModelsClientContext.js.map +1 -1
- package/lib/cjs/components/context/ITwinsClientContext.js +3 -3
- package/lib/cjs/components/context/ITwinsClientContext.js.map +1 -1
- 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/context/PropertiesGroupColorContext.js +3 -3
- package/lib/cjs/components/context/PropertiesGroupColorContext.js.map +1 -1
- package/lib/cjs/components/context/PropertyGridWrapperContext.js +3 -3
- package/lib/cjs/components/context/PropertyGridWrapperContext.js.map +1 -1
- package/lib/cjs/components/customUI/DefaultGroupingUI.js +3 -3
- package/lib/cjs/components/customUI/DefaultGroupingUI.js.map +1 -1
- package/lib/cjs/components/customUI/GroupQueryBuilderCustomUI.d.ts +5 -1
- package/lib/cjs/components/customUI/GroupQueryBuilderCustomUI.js +17 -18
- 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 +5 -1
- package/lib/cjs/components/customUI/ManualGroupingCustomUI.js +12 -8
- package/lib/cjs/components/customUI/ManualGroupingCustomUI.js.map +1 -1
- package/lib/cjs/components/customUI/SearchGroupingCustomUI.d.ts +5 -1
- package/lib/cjs/components/customUI/SearchGroupingCustomUI.js +20 -45
- package/lib/cjs/components/customUI/SearchGroupingCustomUI.js.map +1 -1
- package/lib/cjs/decorators/BboxDimensionsDecorator.js +3 -10
- package/lib/cjs/decorators/BboxDimensionsDecorator.js.map +1 -1
- package/lib/cjs/formula/FormulaDataTypeResolver.d.ts +1 -0
- package/lib/cjs/formula/FormulaDataTypeResolver.js +4 -3
- package/lib/cjs/formula/FormulaDataTypeResolver.js.map +1 -1
- package/lib/cjs/formula/FormulaFunctionProvider.js +146 -65
- package/lib/cjs/formula/FormulaFunctionProvider.js.map +1 -1
- package/lib/cjs/formula/FormulaOperatorsProvider.js +139 -45
- package/lib/cjs/formula/FormulaOperatorsProvider.js.map +1 -1
- package/lib/cjs/formula/FormulaSplitter.js +63 -13
- package/lib/cjs/formula/FormulaSplitter.js.map +1 -1
- package/lib/cjs/formula/FormulaTokensDataTypeResolver.js +9 -16
- 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/InfixToPostfixConverter.js +4 -4
- package/lib/cjs/formula/InfixToPostfixConverter.js.map +1 -1
- package/lib/cjs/formula/InputStream.js +3 -3
- package/lib/cjs/formula/InputStream.js.map +1 -1
- package/lib/cjs/formula/ParenthesisValidator.js +3 -3
- package/lib/cjs/formula/ParenthesisValidator.js.map +1 -1
- package/lib/cjs/formula/Queue.js +3 -3
- package/lib/cjs/formula/Queue.js.map +1 -1
- package/lib/cjs/formula/Stack.js +3 -3
- package/lib/cjs/formula/Stack.js.map +1 -1
- package/lib/cjs/formula/StringBuilder.js +3 -3
- package/lib/cjs/formula/StringBuilder.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/formula/Utils.js +4 -4
- package/lib/cjs/formula/Utils.js.map +1 -1
- package/lib/cjs/grouping-mapping-widget.d.ts +5 -3
- package/lib/cjs/grouping-mapping-widget.js +14 -4
- package/lib/cjs/grouping-mapping-widget.js.map +1 -1
- package/lib/cjs/test/GroupPropertyUtils.test.js +27 -65
- package/lib/cjs/test/GroupPropertyUtils.test.js.map +1 -1
- package/lib/cjs/test/GroupingMappingCustomUI.test.js +21 -12
- package/lib/cjs/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/lib/cjs/test/MockFactory.js +3 -3
- package/lib/cjs/test/MockFactory.js.map +1 -1
- package/lib/cjs/test/PropertyFieldsHelpers.js +3 -3
- package/lib/cjs/test/PropertyFieldsHelpers.js.map +1 -1
- package/lib/cjs/test/QueryBuilder.test.js +3 -3
- package/lib/cjs/test/QueryBuilder.test.js.map +1 -1
- package/lib/cjs/test/QueryBuilder.testdata.js +3 -3
- package/lib/cjs/test/QueryBuilder.testdata.js.map +1 -1
- package/lib/cjs/test/QueryBuilderTestData.js.map +1 -1
- package/lib/cjs/test/WidgetHeader.test.js +3 -3
- package/lib/cjs/test/WidgetHeader.test.js.map +1 -1
- package/lib/cjs/test/test-utils.js +4 -4
- package/lib/cjs/test/test-utils.js.map +1 -1
- package/lib/esm/WidgetShell/GroupingMapping.d.ts +5 -5
- package/lib/esm/WidgetShell/GroupingMapping.js +3 -5
- package/lib/esm/WidgetShell/GroupingMapping.js.map +1 -1
- package/lib/esm/WidgetShell/GroupingMappingContent.js +4 -4
- package/lib/esm/WidgetShell/GroupingMappingContent.js.map +1 -1
- package/lib/esm/WidgetShell/GroupingMappingHeader.d.ts +1 -1
- package/lib/esm/WidgetShell/GroupingMappingHeader.js +5 -5
- package/lib/esm/WidgetShell/GroupingMappingHeader.js.map +1 -1
- package/lib/esm/WidgetShell/GroupingMappingWidget.d.ts +4 -0
- package/lib/esm/WidgetShell/GroupingMappingWidget.js +6 -4
- package/lib/esm/WidgetShell/GroupingMappingWidget.js.map +1 -1
- package/lib/esm/WidgetShell/Router/GroupingMappingRouter.js +28 -8
- package/lib/esm/WidgetShell/Router/GroupingMappingRouter.js.map +1 -1
- package/lib/esm/WidgetShell/WidgetHeader/WidgetHeader.d.ts +1 -1
- package/lib/esm/WidgetShell/WidgetHeader/WidgetHeader.js +7 -7
- package/lib/esm/WidgetShell/WidgetHeader/WidgetHeader.js.map +1 -1
- package/lib/esm/common/hooks/useIsMounted.js +3 -3
- package/lib/esm/common/hooks/useIsMounted.js.map +1 -1
- package/lib/esm/common/hooks/useMemoizedCollectionPick.js +3 -3
- package/lib/esm/common/hooks/useMemoizedCollectionPick.js.map +1 -1
- package/lib/esm/common/utils.js +3 -3
- package/lib/esm/common/utils.js.map +1 -1
- package/lib/esm/common/viewerUtils.js +2 -2
- package/lib/esm/common/viewerUtils.js.map +1 -1
- package/lib/esm/components/Constants.js +4 -4
- package/lib/esm/components/Constants.js.map +1 -1
- package/lib/esm/components/GroupingMappingContext.d.ts +19 -3
- package/lib/esm/components/GroupingMappingContext.js +41 -14
- 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 +17 -15
- package/lib/esm/components/Groups/Editing/GroupAction.js.map +1 -1
- package/lib/esm/components/Groups/Editing/GroupDetails.d.ts +1 -1
- package/lib/esm/components/Groups/Editing/GroupDetails.js +5 -7
- package/lib/esm/components/Groups/Editing/GroupDetails.js.map +1 -1
- package/lib/esm/components/Groups/Editing/GroupDetailsActionPanel.d.ts +1 -1
- package/lib/esm/components/Groups/Editing/GroupDetailsActionPanel.js +4 -4
- package/lib/esm/components/Groups/Editing/GroupDetailsActionPanel.js.map +1 -1
- package/lib/esm/components/Groups/Editing/GroupDetailsStep.js +4 -4
- package/lib/esm/components/Groups/Editing/GroupDetailsStep.js.map +1 -1
- package/lib/esm/components/Groups/GroupColorLegend.d.ts +3 -3
- package/lib/esm/components/Groups/GroupColorLegend.js +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 -4
- 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 +17 -6
- 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 +7 -3
- package/lib/esm/components/Groups/Groups.js.map +1 -1
- package/lib/esm/components/Groups/GroupsAddButton.d.ts +1 -1
- package/lib/esm/components/Groups/GroupsAddButton.js +4 -4
- package/lib/esm/components/Groups/GroupsAddButton.js.map +1 -1
- package/lib/esm/components/Groups/GroupsAddButton.scss +1 -1
- package/lib/esm/components/Groups/GroupsShowHideButtons.d.ts +5 -5
- package/lib/esm/components/Groups/GroupsShowHideButtons.js +2 -2
- 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 +14 -12
- package/lib/esm/components/Groups/GroupsView.js.map +1 -1
- package/lib/esm/components/Groups/GroupsView.scss +1 -1
- package/lib/esm/components/Groups/GroupsVisualization.d.ts +8 -0
- package/lib/esm/components/Groups/GroupsVisualization.js +29 -26
- package/lib/esm/components/Groups/GroupsVisualization.js.map +1 -1
- package/lib/esm/components/Groups/GroupsVisualizationActions.js +4 -4
- package/lib/esm/components/Groups/GroupsVisualizationActions.js.map +1 -1
- package/lib/esm/components/Groups/OverlappedElementsInformationPanel.d.ts +4 -4
- package/lib/esm/components/Groups/OverlappedElementsInformationPanel.js +5 -5
- package/lib/esm/components/Groups/OverlappedElementsInformationPanel.js.map +1 -1
- package/lib/esm/components/Groups/OverlappedElementsInformationPanel.scss +7 -7
- package/lib/esm/components/Groups/QueryBuilder/QueryBuilder.js +13 -35
- package/lib/esm/components/Groups/QueryBuilder/QueryBuilder.js.map +1 -1
- package/lib/esm/components/Groups/QueryBuilder/QueryBuilderActionPanel.js +4 -4
- package/lib/esm/components/Groups/QueryBuilder/QueryBuilderActionPanel.js.map +1 -1
- package/lib/esm/components/Groups/QueryBuilder/QueryBuilderCustomUI.d.ts +3 -3
- package/lib/esm/components/Groups/QueryBuilder/QueryBuilderCustomUI.js +4 -4
- package/lib/esm/components/Groups/QueryBuilder/QueryBuilderCustomUI.js.map +1 -1
- package/lib/esm/components/Groups/QueryBuilder/QueryBuilderStep.js +4 -4
- package/lib/esm/components/Groups/QueryBuilder/QueryBuilderStep.js.map +1 -1
- package/lib/esm/components/Groups/ToggleGroupVisibility.js +3 -3
- package/lib/esm/components/Groups/ToggleGroupVisibility.js.map +1 -1
- package/lib/esm/components/Groups/groupsHelpers.d.ts +2 -2
- package/lib/esm/components/Groups/groupsHelpers.js +9 -5
- 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 +16 -8
- package/lib/esm/components/Groups/hooks/useGroupsOperations.js +14 -10
- 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/Groups/hooks/useVisualization.js +3 -5
- package/lib/esm/components/Groups/hooks/useVisualization.js.map +1 -1
- package/lib/esm/components/Mappings/BlockingOverlay.js +3 -3
- package/lib/esm/components/Mappings/BlockingOverlay.js.map +1 -1
- package/lib/esm/components/Mappings/Editing/MappingAction.d.ts +8 -0
- package/lib/esm/components/Mappings/Editing/MappingAction.js +16 -15
- package/lib/esm/components/Mappings/Editing/MappingAction.js.map +1 -1
- package/lib/esm/components/Mappings/Extraction/ExtractionLogCustomFilter.d.ts +1 -1
- package/lib/esm/components/Mappings/Extraction/ExtractionLogCustomFilter.js +1 -1
- package/lib/esm/components/Mappings/Extraction/ExtractionLogCustomFilter.js.map +1 -1
- package/lib/esm/components/Mappings/Extraction/ExtractionMessageModal.js +12 -7
- package/lib/esm/components/Mappings/Extraction/ExtractionMessageModal.js.map +1 -1
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.js +3 -3
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/QueuedExtractionState.js.map +1 -1
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.js +3 -3
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/RunningExtractionState.js.map +1 -1
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.js +3 -3
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/StartingExtractionState.js.map +1 -1
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.js +3 -3
- package/lib/esm/components/Mappings/Extraction/ExtractionStates/TerminalExtractionState.js.map +1 -1
- package/lib/esm/components/Mappings/Extraction/ExtractionStatus.d.ts +1 -1
- package/lib/esm/components/Mappings/Extraction/ExtractionStatus.js +9 -9
- package/lib/esm/components/Mappings/Extraction/ExtractionStatus.js.map +1 -1
- package/lib/esm/components/Mappings/Extraction/ExtractionStatusIcon.js +4 -4
- package/lib/esm/components/Mappings/Extraction/ExtractionStatusIcon.js.map +1 -1
- package/lib/esm/components/Mappings/Import/ConfirmMappingsImport.d.ts +1 -2
- package/lib/esm/components/Mappings/Import/ConfirmMappingsImport.js +31 -34
- package/lib/esm/components/Mappings/Import/ConfirmMappingsImport.js.map +1 -1
- package/lib/esm/components/Mappings/Import/MappingImportWizardModal.d.ts +1 -1
- package/lib/esm/components/Mappings/Import/MappingImportWizardModal.js +4 -4
- package/lib/esm/components/Mappings/Import/MappingImportWizardModal.js.map +1 -1
- package/lib/esm/components/Mappings/Import/SelectIModel.d.ts +1 -1
- package/lib/esm/components/Mappings/Import/SelectIModel.js +5 -5
- package/lib/esm/components/Mappings/Import/SelectIModel.js.map +1 -1
- package/lib/esm/components/Mappings/Import/SelectITwin.js +2 -2
- package/lib/esm/components/Mappings/Import/SelectITwin.js.map +1 -1
- package/lib/esm/components/Mappings/Import/SelectITwin.scss +1 -1
- package/lib/esm/components/Mappings/Import/SelectMappings.d.ts +1 -1
- package/lib/esm/components/Mappings/Import/SelectMappings.js +8 -8
- package/lib/esm/components/Mappings/Import/SelectMappings.js.map +1 -1
- package/lib/esm/components/Mappings/MappingListItem.js.map +1 -1
- package/lib/esm/components/Mappings/MappingViewActionGroup.d.ts +1 -1
- package/lib/esm/components/Mappings/MappingViewActionGroup.js +8 -8
- package/lib/esm/components/Mappings/MappingViewActionGroup.js.map +1 -1
- package/lib/esm/components/Mappings/Mappings.d.ts +8 -0
- package/lib/esm/components/Mappings/Mappings.js +7 -3
- 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 +19 -17
- 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 +11 -8
- package/lib/esm/components/Mappings/hooks/useFetchExtractionStatus.js.map +1 -1
- package/lib/esm/components/Mappings/hooks/useFetchMappingExtractionStatus.d.ts +1 -1
- package/lib/esm/components/Mappings/hooks/useFetchMappingExtractionStatus.js +9 -8
- package/lib/esm/components/Mappings/hooks/useFetchMappingExtractionStatus.js.map +1 -1
- package/lib/esm/components/Mappings/hooks/useFetchMappings.js +2 -2
- 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 +45 -23
- package/lib/esm/components/Mappings/hooks/useMappingsOperations.js.map +1 -1
- package/lib/esm/components/Mappings/hooks/useRunExtraction.d.ts +2 -2
- package/lib/esm/components/Mappings/hooks/useRunExtraction.js +27 -19
- package/lib/esm/components/Mappings/hooks/useRunExtraction.js.map +1 -1
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.d.ts +11 -3
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyAction.js +30 -17
- 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 +33 -23
- 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 +8 -6
- package/lib/esm/components/Properties/CalculatedProperties/CalculatedPropertyTable.js.map +1 -1
- package/lib/esm/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.js +5 -7
- package/lib/esm/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.js.map +1 -1
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.d.ts +11 -3
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.js +76 -52
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.js.map +1 -1
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationAction.scss +1 -1
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.d.ts +3 -3
- package/lib/esm/components/Properties/CustomCalculations/CustomCalculationTable.js +23 -17
- 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 +4 -4
- package/lib/esm/components/Properties/GroupColorToggle.js.map +1 -1
- package/lib/esm/components/Properties/GroupInformationPanel.js +3 -3
- package/lib/esm/components/Properties/GroupInformationPanel.js.map +1 -1
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.d.ts +13 -5
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js +43 -44
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyAction.js.map +1 -1
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyListItem.d.ts +1 -1
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyListItem.js +5 -5
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyListItem.js.map +1 -1
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.d.ts +4 -4
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyTable.js +22 -18
- 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 +21 -66
- package/lib/esm/components/Properties/GroupProperties/GroupPropertyUtils.js.map +1 -1
- package/lib/esm/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js +26 -35
- package/lib/esm/components/Properties/GroupProperties/GroupsPropertiesSelectionModal.js.map +1 -1
- package/lib/esm/components/Properties/GroupProperties/SaveModal.d.ts +1 -1
- package/lib/esm/components/Properties/GroupProperties/SaveModal.js +8 -8
- package/lib/esm/components/Properties/GroupProperties/SaveModal.js.map +1 -1
- package/lib/esm/components/Properties/GroupProperties/SortableHorizontalTile.js +4 -4
- package/lib/esm/components/Properties/GroupProperties/SortableHorizontalTile.js.map +1 -1
- package/lib/esm/components/Properties/PropertyAction.js +9 -21
- package/lib/esm/components/Properties/PropertyAction.js.map +1 -1
- package/lib/esm/components/Properties/PropertyMenu.d.ts +13 -5
- package/lib/esm/components/Properties/PropertyMenu.js +16 -18
- 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 +9 -5
- package/lib/esm/components/Properties/PropertyMenuWithVisualization.js.map +1 -1
- package/lib/esm/components/Properties/PropertyNameCell.d.ts +1 -1
- package/lib/esm/components/Properties/PropertyNameCell.js +4 -4
- package/lib/esm/components/Properties/PropertyNameCell.js.map +1 -1
- package/lib/esm/components/Properties/PropertyTable.js +5 -6
- package/lib/esm/components/Properties/PropertyTable.js.map +1 -1
- package/lib/esm/components/Properties/PropertyTableToolbar.d.ts +1 -1
- package/lib/esm/components/Properties/PropertyTableToolbar.js +4 -4
- package/lib/esm/components/Properties/PropertyTableToolbar.js.map +1 -1
- package/lib/esm/components/Properties/hooks/useFormulaValidation.d.ts +2 -1
- package/lib/esm/components/Properties/hooks/useFormulaValidation.js +11 -7
- 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/Properties/hooks/useValidator.js +4 -4
- package/lib/esm/components/Properties/hooks/useValidator.js.map +1 -1
- package/lib/esm/components/SharedComponents/ActionPanel.d.ts +1 -1
- package/lib/esm/components/SharedComponents/ActionPanel.js +9 -10
- package/lib/esm/components/SharedComponents/ActionPanel.js.map +1 -1
- package/lib/esm/components/SharedComponents/DeleteModal.d.ts +1 -1
- package/lib/esm/components/SharedComponents/DeleteModal.js +10 -11
- package/lib/esm/components/SharedComponents/DeleteModal.js.map +1 -1
- package/lib/esm/components/SharedComponents/EmptyMessage.js +4 -4
- package/lib/esm/components/SharedComponents/EmptyMessage.js.map +1 -1
- package/lib/esm/components/SharedComponents/LoadingOverlay.js +4 -4
- package/lib/esm/components/SharedComponents/LoadingOverlay.js.map +1 -1
- package/lib/esm/components/SharedComponents/LoadingSpinner.js +3 -3
- package/lib/esm/components/SharedComponents/LoadingSpinner.js.map +1 -1
- package/lib/esm/components/SharedComponents/StatusIcon.js +3 -3
- package/lib/esm/components/SharedComponents/StatusIcon.js.map +1 -1
- package/lib/esm/components/context/ExtractionClientContext.js +3 -3
- package/lib/esm/components/context/ExtractionClientContext.js.map +1 -1
- package/lib/esm/components/context/ExtractionStateJobContext.js +3 -3
- package/lib/esm/components/context/ExtractionStateJobContext.js.map +1 -1
- package/lib/esm/components/context/GroupHilitedElementsContext.js +3 -3
- package/lib/esm/components/context/GroupHilitedElementsContext.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/GroupingMappingCustomUIContext.js +3 -3
- package/lib/esm/components/context/GroupingMappingCustomUIContext.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/IModelsClientContext.js.map +1 -1
- package/lib/esm/components/context/ITwinsClientContext.js +3 -3
- package/lib/esm/components/context/ITwinsClientContext.js.map +1 -1
- 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/context/PropertiesGroupColorContext.js +3 -3
- package/lib/esm/components/context/PropertiesGroupColorContext.js.map +1 -1
- package/lib/esm/components/context/PropertyGridWrapperContext.js +3 -3
- package/lib/esm/components/context/PropertyGridWrapperContext.js.map +1 -1
- package/lib/esm/components/customUI/DefaultGroupingUI.js +3 -3
- package/lib/esm/components/customUI/DefaultGroupingUI.js.map +1 -1
- package/lib/esm/components/customUI/GroupQueryBuilderCustomUI.d.ts +5 -1
- package/lib/esm/components/customUI/GroupQueryBuilderCustomUI.js +18 -19
- 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 +5 -1
- package/lib/esm/components/customUI/ManualGroupingCustomUI.js +12 -8
- package/lib/esm/components/customUI/ManualGroupingCustomUI.js.map +1 -1
- package/lib/esm/components/customUI/SearchGroupingCustomUI.d.ts +5 -1
- package/lib/esm/components/customUI/SearchGroupingCustomUI.js +20 -45
- package/lib/esm/components/customUI/SearchGroupingCustomUI.js.map +1 -1
- package/lib/esm/decorators/BboxDimensionsDecorator.js +5 -12
- package/lib/esm/decorators/BboxDimensionsDecorator.js.map +1 -1
- package/lib/esm/formula/FormulaDataTypeResolver.d.ts +1 -0
- package/lib/esm/formula/FormulaDataTypeResolver.js +4 -3
- package/lib/esm/formula/FormulaDataTypeResolver.js.map +1 -1
- package/lib/esm/formula/FormulaFunctionProvider.js +146 -65
- package/lib/esm/formula/FormulaFunctionProvider.js.map +1 -1
- package/lib/esm/formula/FormulaOperatorsProvider.js +139 -45
- package/lib/esm/formula/FormulaOperatorsProvider.js.map +1 -1
- package/lib/esm/formula/FormulaSplitter.js +63 -13
- package/lib/esm/formula/FormulaSplitter.js.map +1 -1
- package/lib/esm/formula/FormulaTokensDataTypeResolver.js +9 -16
- 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/InfixToPostfixConverter.js +5 -5
- package/lib/esm/formula/InfixToPostfixConverter.js.map +1 -1
- package/lib/esm/formula/InputStream.js +3 -3
- package/lib/esm/formula/InputStream.js.map +1 -1
- package/lib/esm/formula/ParenthesisValidator.js +3 -3
- package/lib/esm/formula/ParenthesisValidator.js.map +1 -1
- package/lib/esm/formula/Queue.js +3 -3
- package/lib/esm/formula/Queue.js.map +1 -1
- package/lib/esm/formula/Stack.js +3 -3
- package/lib/esm/formula/Stack.js.map +1 -1
- package/lib/esm/formula/StringBuilder.js +3 -3
- package/lib/esm/formula/StringBuilder.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/formula/Utils.js +4 -4
- package/lib/esm/formula/Utils.js.map +1 -1
- package/lib/esm/grouping-mapping-widget.d.ts +5 -3
- package/lib/esm/grouping-mapping-widget.js +8 -6
- package/lib/esm/grouping-mapping-widget.js.map +1 -1
- package/lib/esm/test/GroupPropertyUtils.test.js +28 -66
- package/lib/esm/test/GroupPropertyUtils.test.js.map +1 -1
- package/lib/esm/test/GroupingMappingCustomUI.test.js +21 -12
- package/lib/esm/test/GroupingMappingCustomUI.test.js.map +1 -1
- package/lib/esm/test/MockFactory.js +3 -3
- package/lib/esm/test/MockFactory.js.map +1 -1
- package/lib/esm/test/PropertyFieldsHelpers.js +3 -3
- package/lib/esm/test/PropertyFieldsHelpers.js.map +1 -1
- package/lib/esm/test/QueryBuilder.test.js +3 -3
- package/lib/esm/test/QueryBuilder.test.js.map +1 -1
- package/lib/esm/test/QueryBuilder.testdata.js +3 -3
- package/lib/esm/test/QueryBuilder.testdata.js.map +1 -1
- package/lib/esm/test/QueryBuilderTestData.js.map +1 -1
- package/lib/esm/test/WidgetHeader.test.js +3 -3
- package/lib/esm/test/WidgetHeader.test.js.map +1 -1
- package/lib/esm/test/test-utils.js +4 -4
- package/lib/esm/test/test-utils.js.map +1 -1
- package/package.json +10 -5
- 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,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { Property } from "@itwin/insights-client";
|
|
3
3
|
import "./CalculatedPropertyTable.scss";
|
|
4
4
|
export interface CalculatedPropertyTableProps {
|
|
5
5
|
mappingId: string;
|
|
6
6
|
groupId: string;
|
|
7
7
|
onClickAdd?: () => void;
|
|
8
|
-
onClickModify?: (value:
|
|
8
|
+
onClickModify?: (value: Property) => void;
|
|
9
9
|
isLoading: boolean;
|
|
10
|
-
calculatedProperties:
|
|
10
|
+
calculatedProperties: Property[];
|
|
11
11
|
refresh: () => Promise<void>;
|
|
12
12
|
}
|
|
13
13
|
export declare const CalculatedPropertyTable: ({ mappingId, groupId, onClickAdd, onClickModify, isLoading, calculatedProperties, refresh, }: CalculatedPropertyTableProps) => JSX.Element;
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { SvgDelete, SvgEdit, SvgMore } from "@itwin/itwinui-icons-react";
|
|
6
|
-
import { DropdownMenu, IconButton, MenuItem
|
|
6
|
+
import { DropdownMenu, IconButton, MenuItem } from "@itwin/itwinui-react";
|
|
7
7
|
import React, { useCallback } from "react";
|
|
8
|
-
import { useMappingClient } from "../../context/MappingClientContext";
|
|
9
8
|
import "./CalculatedPropertyTable.scss";
|
|
10
9
|
import { PropertyNameCell } from "../PropertyNameCell";
|
|
11
10
|
import { PropertyTable } from "../PropertyTable";
|
|
12
11
|
import { useGroupingMappingApiConfig } from "../../context/GroupingApiConfigContext";
|
|
13
12
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
13
|
+
import { usePropertiesClient } from "../../context/PropertiesClientContext";
|
|
14
14
|
export const CalculatedPropertyTable = ({ mappingId, groupId, onClickAdd, onClickModify, isLoading, calculatedProperties, refresh, }) => {
|
|
15
|
-
const
|
|
15
|
+
const propertiesClient = usePropertiesClient();
|
|
16
16
|
const { getAccessToken, iModelId } = useGroupingMappingApiConfig();
|
|
17
17
|
const queryClient = useQueryClient();
|
|
18
18
|
const columnsFactory = useCallback((handleShowDeleteModal) => [
|
|
@@ -20,7 +20,7 @@ export const CalculatedPropertyTable = ({ mappingId, groupId, onClickAdd, onClic
|
|
|
20
20
|
id: "propertyName",
|
|
21
21
|
Header: "Calculated Property",
|
|
22
22
|
accessor: "propertyName",
|
|
23
|
-
Cell: (value) =>
|
|
23
|
+
Cell: (value) => React.createElement(PropertyNameCell, { property: value.row.original, onClickModify: onClickModify }),
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
id: "dropdown",
|
|
@@ -49,9 +49,11 @@ export const CalculatedPropertyTable = ({ mappingId, groupId, onClickAdd, onClic
|
|
|
49
49
|
const { mutateAsync: deleteProperty } = useMutation({
|
|
50
50
|
mutationFn: async (propertyId) => {
|
|
51
51
|
const accessToken = await getAccessToken();
|
|
52
|
-
await
|
|
52
|
+
await propertiesClient.deleteProperty(accessToken, mappingId, groupId, propertyId);
|
|
53
|
+
},
|
|
54
|
+
onSuccess: async () => {
|
|
55
|
+
await queryClient.invalidateQueries({ queryKey: ["properties", iModelId, mappingId, groupId] });
|
|
53
56
|
},
|
|
54
|
-
onSuccess: async () => queryClient.invalidateQueries({ queryKey: ["calculatedProperties", iModelId, mappingId, groupId] }),
|
|
55
57
|
});
|
|
56
58
|
return (React.createElement(PropertyTable, { propertyType: "Calculated", columnsFactory: columnsFactory, data: calculatedProperties, isLoading: isLoading, onClickAdd: onClickAdd, refreshProperties: refresh, deleteProperty: deleteProperty }));
|
|
57
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalculatedPropertyTable.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CalculatedProperties/CalculatedPropertyTable.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,
|
|
1
|
+
{"version":3,"file":"CalculatedPropertyTable.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CalculatedProperties/CalculatedPropertyTable.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAG3C,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAY5E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EACtC,SAAS,EACT,OAAO,EACP,UAAU,EACV,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,OAAO,GACsB,EAAE,EAAE;IACjC,MAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAC/C,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,2BAA2B,EAAE,CAAC;IACnE,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,qBAAgD,EAAsB,EAAE,CAAC;QACxE;YACE,EAAE,EAAE,cAAc;YAClB,MAAM,EAAE,qBAAqB;YAC7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CAAC;YAC3C,MAAM,gBAAgB,CAAC,cAAc,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QACrF,CAAC;QACD,SAAS,EAAE,KAAK,IAAI,EAAE;YACpB,MAAM,WAAW,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QAClG,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,CACL,oBAAC,aAAa,IACZ,YAAY,EAAC,YAAY,EACzB,cAAc,EAAE,cAAc,EAC9B,IAAI,EAAE,oBAAoB,EAC1B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,OAAO,EAC1B,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport { SvgDelete, SvgEdit, SvgMore } from \"@itwin/itwinui-icons-react\";\nimport { DropdownMenu, IconButton, MenuItem } from \"@itwin/itwinui-react\";\nimport React, { useCallback } from \"react\";\nimport type { CellProps, Column } from \"react-table\";\nimport type { Property } from \"@itwin/insights-client\";\nimport \"./CalculatedPropertyTable.scss\";\nimport { PropertyNameCell } from \"../PropertyNameCell\";\nimport { PropertyTable } from \"../PropertyTable\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { usePropertiesClient } from \"../../context/PropertiesClientContext\";\n\nexport interface CalculatedPropertyTableProps {\n mappingId: string;\n groupId: string;\n onClickAdd?: () => void;\n onClickModify?: (value: Property) => void;\n isLoading: boolean;\n calculatedProperties: Property[];\n refresh: () => Promise<void>;\n}\n\nexport const CalculatedPropertyTable = ({\n mappingId,\n groupId,\n onClickAdd,\n onClickModify,\n isLoading,\n calculatedProperties,\n refresh,\n}: CalculatedPropertyTableProps) => {\n const propertiesClient = usePropertiesClient();\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const queryClient = useQueryClient();\n\n const columnsFactory = useCallback(\n (handleShowDeleteModal: (value: Property) => void): Column<Property>[] => [\n {\n id: \"propertyName\",\n Header: \"Calculated Property\",\n accessor: \"propertyName\",\n Cell: (value: CellProps<Property>) => <PropertyNameCell property={value.row.original} onClickModify={onClickModify} />,\n },\n {\n id: \"dropdown\",\n Header: \"\",\n width: 80,\n Cell: (value: CellProps<Property>) => {\n return (\n <DropdownMenu\n menuItems={(close: () => void) =>\n [\n onClickModify\n ? [\n <MenuItem\n key={0}\n onClick={() => {\n onClickModify(value.row.original);\n close();\n }}\n icon={<SvgEdit />}\n >\n Modify\n </MenuItem>,\n ]\n : [],\n <MenuItem\n key={1}\n onClick={() => {\n handleShowDeleteModal(value.row.original);\n close();\n }}\n icon={<SvgDelete />}\n >\n Remove\n </MenuItem>,\n ].flatMap((p) => p)\n }\n >\n <IconButton styleType=\"borderless\">\n <SvgMore />\n </IconButton>\n </DropdownMenu>\n );\n },\n },\n ],\n [onClickModify],\n );\n\n const { mutateAsync: deleteProperty } = useMutation({\n mutationFn: async (propertyId: string) => {\n const accessToken = await getAccessToken();\n await propertiesClient.deleteProperty(accessToken, mappingId, groupId, propertyId);\n },\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: [\"properties\", iModelId, mappingId, groupId] });\n },\n });\n\n return (\n <PropertyTable\n propertyType=\"Calculated\"\n columnsFactory={columnsFactory}\n data={calculatedProperties}\n isLoading={isLoading}\n onClickAdd={onClickAdd}\n refreshProperties={refresh}\n deleteProperty={deleteProperty}\n />\n );\n};\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { CalculatedPropertyType
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { CalculatedPropertyType } from "@itwin/insights-client";
|
|
6
6
|
import React, { useCallback } from "react";
|
|
7
7
|
import { NAME_REQUIREMENTS } from "../hooks/useValidator";
|
|
8
8
|
import { LabeledInput, LabeledSelect } from "@itwin/itwinui-react";
|
|
@@ -26,9 +26,7 @@ export const SharedCalculatedPropertyForms = ({ propertyName, setPropertyName, t
|
|
|
26
26
|
React.createElement(LabeledInput, { value: propertyName, required: true, name: "name", label: "Name", onChange: (event) => {
|
|
27
27
|
setPropertyName(event.target.value);
|
|
28
28
|
validator.showMessageFor("name");
|
|
29
|
-
}, message: validator.message("name", propertyName, NAME_REQUIREMENTS), status: validator.message("name", propertyName, NAME_REQUIREMENTS)
|
|
30
|
-
? "negative"
|
|
31
|
-
: undefined, onBlur: () => {
|
|
29
|
+
}, message: validator.message("name", propertyName, NAME_REQUIREMENTS), status: validator.message("name", propertyName, NAME_REQUIREMENTS) ? "negative" : undefined, onBlur: () => {
|
|
32
30
|
validator.showMessageFor("name");
|
|
33
31
|
}, onBlurCapture: (event) => {
|
|
34
32
|
setPropertyName(event.target.value);
|
package/lib/esm/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SharedCalculatedPropertyForms.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"SharedCalculatedPropertyForms.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CalculatedProperties/SharedCalculatedPropertyForms.ts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K,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACpC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC,EACD,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,iBAAiB,CAAC,EACnE,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,EAC3F,MAAM,EAAE,GAAG,EAAE;gBACX,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC,EACD,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE;gBACvB,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACpC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACnC,CAAC,GACD;QACF,oBAAC,aAAa,IACZ,KAAK,EAAC,eAAe,EACrB,QAAQ,QACR,OAAO,EAAE,yCAAyC,EAAE,EACpD,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,OAAO,EACjB,YAAY,EAAE,YAAY,EAC1B,oBAAoB,EAAE,oBAAoB,EAC1C,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,EAChB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,GAChB,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 { CalculatedPropertyType } from \"@itwin/insights-client\";\nimport React, { useCallback } from \"react\";\nimport { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { LabeledInput, LabeledSelect } from \"@itwin/itwinui-react\";\nimport type SimpleReactValidator from \"simple-react-validator\";\n\ninterface SharedCalculatedPropertyFormsProps {\n propertyName: string;\n setPropertyName: (value: string) => void;\n type: CalculatedPropertyType | undefined;\n setType: (value: CalculatedPropertyType | undefined) => void;\n validator: SimpleReactValidator;\n itemRenderer?: (option: SelectOption<string>) => JSX.Element;\n selectedItemRenderer?: (option: SelectOption<string>) => JSX.Element;\n}\n\nexport const SharedCalculatedPropertyForms = ({\n propertyName,\n setPropertyName,\n type,\n setType,\n validator,\n itemRenderer,\n selectedItemRenderer,\n}: SharedCalculatedPropertyFormsProps) => {\n const generateOptionsFromCalculatedPropertyType = useCallback(() => {\n const options: SelectOption<CalculatedPropertyType>[] = [];\n\n const indexableEnum = CalculatedPropertyType as unknown as { [key: string]: string };\n\n for (const key in indexableEnum) {\n if (typeof indexableEnum[key] === \"string\" && key !== \"Undefined\") {\n // Generate labels by adding space between capitals\n const label = key\n .replace(/([A-Z])/g, \" $1\")\n .trim()\n .replace(/^\\w/, (c) => c.toUpperCase());\n options.push({ value: indexableEnum[key] as CalculatedPropertyType, label });\n }\n }\n return options;\n }, []);\n\n return (\n <>\n <LabeledInput\n value={propertyName}\n required\n name=\"name\"\n label=\"Name\"\n onChange={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n message={validator.message(\"name\", propertyName, NAME_REQUIREMENTS)}\n status={validator.message(\"name\", propertyName, NAME_REQUIREMENTS) ? \"negative\" : undefined}\n onBlur={() => {\n validator.showMessageFor(\"name\");\n }}\n onBlurCapture={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n />\n <LabeledSelect<CalculatedPropertyType>\n label=\"Quantity Type\"\n required\n options={generateOptionsFromCalculatedPropertyType()}\n value={type}\n onChange={setType}\n itemRenderer={itemRenderer}\n selectedItemRenderer={selectedItemRenderer}\n onShow={() => {}}\n onHide={() => {}}\n />\n </>\n );\n};\n"]}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "./CustomCalculationAction.scss";
|
|
3
|
-
import type {
|
|
3
|
+
import type { Property } from "@itwin/insights-client";
|
|
4
|
+
/**
|
|
5
|
+
* Props for the {@link CustomCalculationAction} component.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
4
8
|
export interface CustomCalculationActionProps {
|
|
5
9
|
mappingId: string;
|
|
6
10
|
groupId: string;
|
|
7
|
-
customCalculation?:
|
|
11
|
+
customCalculation?: Property;
|
|
8
12
|
onSaveSuccess: () => void;
|
|
9
13
|
onClickCancel?: () => void;
|
|
10
14
|
}
|
|
11
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Component to create or update a custom calculation property.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare const CustomCalculationAction: ({ mappingId, groupId, customCalculation, onSaveSuccess, onClickCancel }: CustomCalculationActionProps) => JSX.Element;
|
|
12
20
|
//# sourceMappingURL=CustomCalculationAction.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Alert, Fieldset, LabeledInput, LabeledSelect, LabeledTextarea, Text
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Alert, Fieldset, LabeledInput, LabeledSelect, LabeledTextarea, Text } from "@itwin/itwinui-react";
|
|
6
6
|
import React, { useEffect, useState } from "react";
|
|
7
7
|
import ActionPanel from "../../SharedComponents/ActionPanel";
|
|
8
8
|
import useValidator, { NAME_REQUIREMENTS } from "../hooks/useValidator";
|
|
@@ -10,78 +10,100 @@ import { handleError } from "../../../common/utils";
|
|
|
10
10
|
import "./CustomCalculationAction.scss";
|
|
11
11
|
import { quantityTypesSelectionOptions } from "../GroupProperties/GroupPropertyAction";
|
|
12
12
|
import { useFormulaValidation } from "../hooks/useFormulaValidation";
|
|
13
|
-
import { useMappingClient } from "../../context/MappingClientContext";
|
|
14
13
|
import { useGroupingMappingApiConfig } from "../../context/GroupingApiConfigContext";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { useCustomCalculationsQuery } from "../hooks/useCustomCalculationsQuery";
|
|
18
|
-
import { useGroupPropertiesQuery } from "../hooks/useGroupPropertiesQuery";
|
|
14
|
+
import { DataType } from "@itwin/insights-client";
|
|
15
|
+
import { usePropertiesQuery } from "../hooks/usePropertiesQuery";
|
|
19
16
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
17
|
+
import { usePropertiesClient } from "../../context/PropertiesClientContext";
|
|
20
18
|
const stringToPossibleDataType = (str) => {
|
|
21
19
|
switch (str?.toLowerCase()) {
|
|
22
20
|
case "double":
|
|
23
|
-
|
|
24
|
-
case "
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
return "Double";
|
|
22
|
+
case "integer":
|
|
23
|
+
return "Integer";
|
|
24
|
+
case "string":
|
|
25
|
+
return "String";
|
|
26
|
+
case "boolean":
|
|
27
|
+
return "Boolean";
|
|
28
|
+
default:
|
|
29
|
+
return "Undefined";
|
|
27
30
|
}
|
|
28
31
|
};
|
|
29
|
-
const convertToPropertyMap = (
|
|
32
|
+
const convertToPropertyMap = (properties, selectedPropertyName) => {
|
|
30
33
|
const map = {};
|
|
31
34
|
const selectedLowerName = selectedPropertyName?.toLowerCase();
|
|
32
|
-
|
|
33
|
-
const lowerName = p.propertyName?.toLowerCase();
|
|
34
|
-
if (lowerName && lowerName !== selectedLowerName)
|
|
35
|
-
map[lowerName] = stringToPossibleDataType(p.dataType);
|
|
36
|
-
});
|
|
37
|
-
calculatedProperties.forEach((p) => {
|
|
38
|
-
const lowerName = p.propertyName?.toLowerCase();
|
|
39
|
-
if (lowerName)
|
|
40
|
-
map[lowerName] = "Number";
|
|
41
|
-
});
|
|
42
|
-
customCalculations.forEach((p) => {
|
|
35
|
+
properties.forEach((p) => {
|
|
43
36
|
const lowerName = p.propertyName?.toLowerCase();
|
|
44
37
|
if (lowerName && lowerName !== selectedLowerName)
|
|
45
38
|
map[lowerName] = stringToPossibleDataType(p.dataType);
|
|
46
39
|
});
|
|
47
40
|
return map;
|
|
48
41
|
};
|
|
49
|
-
|
|
42
|
+
const inferToPropertyDataType = (value) => {
|
|
43
|
+
switch (value) {
|
|
44
|
+
case "Double":
|
|
45
|
+
return DataType.Double;
|
|
46
|
+
case "Integer":
|
|
47
|
+
return DataType.Integer;
|
|
48
|
+
case "String":
|
|
49
|
+
return DataType.String;
|
|
50
|
+
case "Boolean":
|
|
51
|
+
return DataType.Boolean;
|
|
52
|
+
default:
|
|
53
|
+
return DataType.String;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Component to create or update a custom calculation property.
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
export const CustomCalculationAction = ({ mappingId, groupId, customCalculation, onSaveSuccess, onClickCancel }) => {
|
|
50
61
|
const { getAccessToken, iModelId } = useGroupingMappingApiConfig();
|
|
51
|
-
const
|
|
62
|
+
const propertiesClient = usePropertiesClient();
|
|
52
63
|
const [propertyName, setPropertyName] = useState(customCalculation?.propertyName ?? "");
|
|
53
64
|
const [formula, setFormula] = useState(customCalculation?.formula ?? "");
|
|
54
|
-
const [quantityType, setQuantityType] = useState(customCalculation?.quantityType ??
|
|
65
|
+
const [quantityType, setQuantityType] = useState(customCalculation?.quantityType ?? undefined);
|
|
55
66
|
const [formulaErrorMessage, setFormulaErrorMessage] = useState("");
|
|
56
67
|
const [validator, showValidationMessage] = useValidator();
|
|
57
68
|
const [properties, setProperties] = useState({});
|
|
58
|
-
const { isValid, forceValidation } = useFormulaValidation(propertyName.toLowerCase(), formula, properties, setFormulaErrorMessage);
|
|
69
|
+
const { isValid, forceValidation, inferredDataType } = useFormulaValidation(propertyName.toLowerCase(), formula, properties, setFormulaErrorMessage);
|
|
59
70
|
const queryClient = useQueryClient();
|
|
60
|
-
const { data: groupProperties, isFetching: isLoadingGroupProperties } =
|
|
61
|
-
const { data: calculatedProperties, isFetching: isLoadingCalculatedProperties } = useCalculatedPropertiesQuery(iModelId, mappingId, groupId, getAccessToken, mappingClient);
|
|
62
|
-
const { data: customCalculationProperties, isFetching: isLoadingCustomCalculations } = useCustomCalculationsQuery(iModelId, mappingId, groupId, getAccessToken, mappingClient);
|
|
71
|
+
const { data: groupProperties, isFetching: isLoadingGroupProperties } = usePropertiesQuery(iModelId, mappingId, groupId, getAccessToken, propertiesClient);
|
|
63
72
|
useEffect(() => {
|
|
64
|
-
const propertiesMap = convertToPropertyMap(groupProperties ?? []
|
|
73
|
+
const propertiesMap = convertToPropertyMap(groupProperties?.properties ?? []);
|
|
65
74
|
setProperties(propertiesMap);
|
|
66
|
-
}, [
|
|
75
|
+
}, [groupProperties]);
|
|
67
76
|
const { mutate: saveMutation, isLoading: isSaving } = useMutation(async () => {
|
|
68
77
|
const accessToken = await getAccessToken();
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
if (customCalculation) {
|
|
79
|
+
return propertiesClient.updateProperty(accessToken, mappingId, groupId, customCalculation.id, {
|
|
80
|
+
propertyName,
|
|
81
|
+
dataType: customCalculation.dataType,
|
|
82
|
+
formula,
|
|
83
|
+
quantityType,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
if (inferredDataType) {
|
|
87
|
+
return propertiesClient.createProperty(accessToken, mappingId, groupId, {
|
|
88
|
+
propertyName,
|
|
89
|
+
dataType: inferToPropertyDataType(inferredDataType),
|
|
90
|
+
formula,
|
|
91
|
+
quantityType,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return;
|
|
72
95
|
}, {
|
|
73
96
|
onSuccess: async () => {
|
|
74
|
-
await queryClient.invalidateQueries({ queryKey: ["
|
|
97
|
+
await queryClient.invalidateQueries({ queryKey: ["properties", iModelId, mappingId, groupId] });
|
|
75
98
|
onSaveSuccess();
|
|
76
99
|
setPropertyName("");
|
|
77
100
|
setFormula("");
|
|
78
|
-
setQuantityType(
|
|
101
|
+
setQuantityType(undefined);
|
|
79
102
|
},
|
|
80
103
|
onError: async (error) => {
|
|
81
104
|
if (error.status === 422) {
|
|
82
105
|
const erroredResponse = await error.json();
|
|
83
|
-
if (erroredResponse.error.code === "InvalidInsightsRequest" &&
|
|
84
|
-
erroredResponse.error.target === "formula") {
|
|
106
|
+
if (erroredResponse.error.code === "InvalidInsightsRequest" && erroredResponse.error.target === "formula") {
|
|
85
107
|
setFormulaErrorMessage(erroredResponse.error.message);
|
|
86
108
|
}
|
|
87
109
|
}
|
|
@@ -100,29 +122,31 @@ export const CustomCalculationAction = ({ mappingId, groupId, customCalculation,
|
|
|
100
122
|
}
|
|
101
123
|
saveMutation();
|
|
102
124
|
};
|
|
103
|
-
const isLoading = isSaving || isLoadingGroupProperties
|
|
125
|
+
const isLoading = isSaving || isLoadingGroupProperties;
|
|
104
126
|
return (React.createElement(React.Fragment, null,
|
|
105
|
-
React.createElement("div", { className:
|
|
106
|
-
React.createElement(Fieldset, { legend:
|
|
107
|
-
React.createElement(Text, { variant:
|
|
108
|
-
React.createElement(LabeledInput, { value: propertyName, required: true, name:
|
|
127
|
+
React.createElement("div", { className: "gmw-custom-calculation-action-container" },
|
|
128
|
+
React.createElement(Fieldset, { legend: "Custom Calculation Details", className: "gmw-details-form" },
|
|
129
|
+
React.createElement(Text, { variant: "small", as: "small", className: "gmw-field-legend" }, "Asterisk * indicates mandatory fields."),
|
|
130
|
+
React.createElement(LabeledInput, { value: propertyName, required: true, name: "name", label: "Name", disabled: isLoading, onChange: (event) => {
|
|
109
131
|
setPropertyName(event.target.value);
|
|
110
132
|
validator.showMessageFor("name");
|
|
111
|
-
}, message: validator.message("name", propertyName, NAME_REQUIREMENTS), status: validator.message("name", propertyName, NAME_REQUIREMENTS)
|
|
112
|
-
? "negative"
|
|
113
|
-
: undefined, onBlur: () => {
|
|
133
|
+
}, message: validator.message("name", propertyName, NAME_REQUIREMENTS), status: validator.message("name", propertyName, NAME_REQUIREMENTS) ? "negative" : undefined, onBlur: () => {
|
|
114
134
|
validator.showMessageFor("name");
|
|
115
135
|
}, onBlurCapture: (event) => {
|
|
116
136
|
setPropertyName(event.target.value);
|
|
117
137
|
validator.showMessageFor("name");
|
|
118
138
|
} }),
|
|
119
|
-
React.createElement(Alert, { type:
|
|
120
|
-
|
|
139
|
+
React.createElement(Alert, { type: "informational", clickableText: "Click here.", clickableTextProps: {
|
|
140
|
+
href: "https://developer.bentley.com/apis/grouping-and-mapping/operations/create-property/#customcalculations",
|
|
141
|
+
target: "_blank",
|
|
142
|
+
rel: "noreferrer",
|
|
143
|
+
} }, "To learn more about creating custom calculation formulas, view the documentation."),
|
|
144
|
+
React.createElement(LabeledTextarea, { value: formula, required: true, name: "formula", label: "Formula", disabled: isLoading, onChange: (event) => {
|
|
121
145
|
setFormula(event.target.value);
|
|
122
146
|
}, message: formulaErrorMessage, status: formulaErrorMessage ? "negative" : undefined, onBlurCapture: () => {
|
|
123
147
|
forceValidation();
|
|
124
148
|
} }),
|
|
125
|
-
React.createElement(LabeledSelect, { label:
|
|
149
|
+
React.createElement(LabeledSelect, { label: "Quantity Type", disabled: isLoading, options: quantityTypesSelectionOptions, value: quantityType, onChange: setQuantityType, onShow: () => { }, onHide: () => { }, placeholder: "No Quantity Type" }))),
|
|
126
150
|
React.createElement(ActionPanel, { onSave: onSave, onCancel: onClickCancel, isSavingDisabled: !(formula && propertyName && isValid), isLoading: isLoading })));
|
|
127
151
|
};
|
|
128
152
|
//# sourceMappingURL=CustomCalculationAction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomCalculationAction.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CustomCalculations/CustomCalculationAction.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AA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B,EAAE,CAAC,CAAC,OAAO,IAAI,YAAY,IAAI,OAAO,CAAC,EACvD,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 {\n Alert,\n Fieldset,\n LabeledInput,\n LabeledSelect,\n LabeledTextarea,\n Text,\n} from \"@itwin/itwinui-react\";\nimport React, { useEffect, useState } from \"react\";\nimport ActionPanel from \"../../SharedComponents/ActionPanel\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport { handleError } from \"../../../common/utils\";\nimport \"./CustomCalculationAction.scss\";\nimport { quantityTypesSelectionOptions } from \"../GroupProperties/GroupPropertyAction\";\nimport { useFormulaValidation } from \"../hooks/useFormulaValidation\";\nimport type { PossibleDataType, PropertyMap } from \"../../../formula/Types\";\nimport { useMappingClient } from \"../../context/MappingClientContext\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport type { CalculatedProperty, CustomCalculation, GroupProperty } from \"@itwin/insights-client\";\nimport { QuantityType } from \"@itwin/insights-client\";\nimport { useCalculatedPropertiesQuery } from \"../hooks/useCalculatedPropertiesQuery\";\nimport { useCustomCalculationsQuery } from \"../hooks/useCustomCalculationsQuery\";\nimport { useGroupPropertiesQuery } from \"../hooks/useGroupPropertiesQuery\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\n\nexport interface CustomCalculationActionProps {\n mappingId: string;\n groupId: string;\n customCalculation?: CustomCalculation;\n onSaveSuccess: () => void;\n onClickCancel?: () => void;\n}\n\nconst stringToPossibleDataType = (str?: string): PossibleDataType => {\n switch (str?.toLowerCase()) {\n case \"double\":\n case \"number\": return \"Number\";\n case \"string\": return \"String\";\n case \"boolean\": return \"Boolean\";\n default: return \"Undefined\";\n }\n};\n\nconst convertToPropertyMap = (\n groupProperties: GroupProperty[],\n calculatedProperties: CalculatedProperty[],\n customCalculations: CustomCalculation[],\n selectedPropertyName?: string\n): PropertyMap => {\n const map: PropertyMap = {};\n const selectedLowerName = selectedPropertyName?.toLowerCase();\n\n groupProperties.forEach((p) => {\n const lowerName = p.propertyName?.toLowerCase();\n if (lowerName && lowerName !== selectedLowerName)\n map[lowerName] = stringToPossibleDataType(p.dataType);\n });\n\n calculatedProperties.forEach((p) => {\n const lowerName = p.propertyName?.toLowerCase();\n if (lowerName)\n map[lowerName] = \"Number\";\n });\n\n customCalculations.forEach((p) => {\n const lowerName = p.propertyName?.toLowerCase();\n if (lowerName && lowerName !== selectedLowerName)\n map[lowerName] = stringToPossibleDataType(p.dataType);\n });\n\n return map;\n};\n\nexport const CustomCalculationAction = ({\n mappingId,\n groupId,\n customCalculation,\n onSaveSuccess,\n onClickCancel,\n}: CustomCalculationActionProps) => {\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n const [propertyName, setPropertyName] = useState<string>(\n customCalculation?.propertyName ?? \"\",\n );\n const [formula, setFormula] = useState<string>(\n customCalculation?.formula ?? \"\",\n );\n const [quantityType, setQuantityType] = useState<QuantityType>(customCalculation?.quantityType ?? QuantityType.Undefined);\n const [formulaErrorMessage, setFormulaErrorMessage] = useState<string>(\"\");\n const [validator, showValidationMessage] = useValidator();\n const [properties, setProperties] = useState<PropertyMap>({});\n const { isValid, forceValidation } = useFormulaValidation(propertyName.toLowerCase(), formula, properties, setFormulaErrorMessage);\n const queryClient = useQueryClient();\n\n const { data: groupProperties, isFetching: isLoadingGroupProperties } = useGroupPropertiesQuery(iModelId, mappingId, groupId, getAccessToken, mappingClient);\n const { data: calculatedProperties, isFetching: isLoadingCalculatedProperties } = useCalculatedPropertiesQuery(iModelId, mappingId, groupId, getAccessToken, mappingClient);\n const { data: customCalculationProperties, isFetching: isLoadingCustomCalculations } = useCustomCalculationsQuery(iModelId, mappingId, groupId, getAccessToken, mappingClient);\n\n useEffect(() => {\n const propertiesMap = convertToPropertyMap(groupProperties ?? [], calculatedProperties ?? [], customCalculationProperties ?? []);\n setProperties(propertiesMap);\n }, [calculatedProperties, customCalculationProperties, groupProperties]);\n\n const { mutate: saveMutation, isLoading: isSaving } = useMutation(async () => {\n\n const accessToken = await getAccessToken();\n\n return customCalculation\n ? mappingClient.updateCustomCalculation(\n accessToken,\n iModelId,\n mappingId,\n groupId,\n customCalculation.id,\n { propertyName, formula, quantityType }\n )\n : mappingClient.createCustomCalculation(\n accessToken,\n iModelId,\n mappingId,\n groupId,\n { propertyName, formula, quantityType }\n );\n }, {\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: [\"customCalculations\", iModelId, mappingId, groupId] });\n onSaveSuccess();\n setPropertyName(\"\");\n setFormula(\"\");\n setQuantityType(QuantityType.Undefined);\n },\n onError: async (error: any) => {\n if (error.status === 422) {\n const erroredResponse = await error.json();\n if (\n erroredResponse.error.code === \"InvalidInsightsRequest\" &&\n erroredResponse.error.target === \"formula\"\n ) {\n setFormulaErrorMessage(erroredResponse.error.message);\n }\n } else {\n handleError(error.status);\n }\n },\n });\n\n const onSave = () => {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n if (!forceValidation()) {\n return;\n }\n saveMutation();\n };\n\n const isLoading = isSaving || isLoadingGroupProperties || isLoadingCalculatedProperties || isLoadingCustomCalculations;\n\n return (\n <>\n <div className='gmw-custom-calculation-action-container'>\n <Fieldset legend='Custom Calculation Details' className='gmw-details-form'>\n <Text variant='small' as='small' className='gmw-field-legend'>\n Asterisk * indicates mandatory fields.\n </Text>\n <LabeledInput\n value={propertyName}\n required\n name='name'\n label='Name'\n disabled={isLoading}\n onChange={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n message={validator.message(\"name\", propertyName, NAME_REQUIREMENTS)}\n status={\n validator.message(\"name\", propertyName, NAME_REQUIREMENTS)\n ? \"negative\"\n : undefined\n }\n onBlur={() => {\n validator.showMessageFor(\"name\");\n }}\n onBlurCapture={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n />\n <Alert\n type='informational'\n clickableText='Click here.'\n clickableTextProps={{ href: \"https://developer.bentley.com/apis/insights/operations/create-customcalculation/\", target: \"_blank\", rel: \"noreferrer\" }}\n >\n To learn more about creating custom calculation formulas, view the documentation.\n </Alert>\n <LabeledTextarea\n value={formula}\n required\n name='formula'\n label='Formula'\n disabled={isLoading}\n onChange={(event) => {\n setFormula(event.target.value);\n }}\n message={formulaErrorMessage}\n status={formulaErrorMessage ? \"negative\" : undefined}\n onBlurCapture={() => {\n forceValidation();\n }}\n />\n <LabeledSelect<QuantityType>\n label='Quantity Type'\n disabled={isLoading}\n options={quantityTypesSelectionOptions}\n value={quantityType}\n onChange={setQuantityType}\n onShow={() => { }}\n onHide={() => { }}\n />\n </Fieldset>\n </div>\n <ActionPanel\n onSave={onSave}\n onCancel={onClickCancel}\n isSavingDisabled={!(formula && propertyName && isValid)}\n isLoading={isLoading}\n />\n </>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"CustomCalculationAction.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CustomCalculations/CustomCalculationAction.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC3G,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,WAAW,MAAM,oCAAoC,CAAC;AAC7D,OAAO,YAAY,EAAE,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAAE,6BAA6B,EAAE,MAAM,wCAAwC,CAAC;AACvF,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AS,EACnB,OAAO,EAAE,6BAA6B,EACtC,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,EAChB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,EAChB,WAAW,EAAC,kBAAkB,GAC9B,CACO,CACP;QACN,oBAAC,WAAW,IAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC,CAAC,OAAO,IAAI,YAAY,IAAI,OAAO,CAAC,EAAE,SAAS,EAAE,SAAS,GAAI,CACtI,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 { Alert, Fieldset, LabeledInput, LabeledSelect, LabeledTextarea, Text } from \"@itwin/itwinui-react\";\nimport React, { useEffect, useState } from \"react\";\nimport ActionPanel from \"../../SharedComponents/ActionPanel\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport { handleError } from \"../../../common/utils\";\nimport \"./CustomCalculationAction.scss\";\nimport { quantityTypesSelectionOptions } from \"../GroupProperties/GroupPropertyAction\";\nimport { useFormulaValidation } from \"../hooks/useFormulaValidation\";\nimport type { PossibleDataType, PropertyMap } from \"../../../formula/Types\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport type { Property, QuantityType } from \"@itwin/insights-client\";\nimport { DataType } from \"@itwin/insights-client\";\nimport type { DataType as FormulaDataType } from \"../../../formula/Types\";\nimport { usePropertiesQuery } from \"../hooks/usePropertiesQuery\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { usePropertiesClient } from \"../../context/PropertiesClientContext\";\n\n/**\n * Props for the {@link CustomCalculationAction} component.\n * @public\n */\nexport interface CustomCalculationActionProps {\n mappingId: string;\n groupId: string;\n customCalculation?: Property;\n onSaveSuccess: () => void;\n onClickCancel?: () => void;\n}\n\nconst stringToPossibleDataType = (str?: string): PossibleDataType => {\n switch (str?.toLowerCase()) {\n case \"double\":\n return \"Double\";\n case \"integer\":\n return \"Integer\";\n case \"string\":\n return \"String\";\n case \"boolean\":\n return \"Boolean\";\n default:\n return \"Undefined\";\n }\n};\n\nconst convertToPropertyMap = (properties: Property[], selectedPropertyName?: string): PropertyMap => {\n const map: PropertyMap = {};\n const selectedLowerName = selectedPropertyName?.toLowerCase();\n\n properties.forEach((p) => {\n const lowerName = p.propertyName?.toLowerCase();\n if (lowerName && lowerName !== selectedLowerName) map[lowerName] = stringToPossibleDataType(p.dataType);\n });\n\n return map;\n};\n\nconst inferToPropertyDataType = (value: FormulaDataType): DataType => {\n switch (value) {\n case \"Double\":\n return DataType.Double;\n case \"Integer\":\n return DataType.Integer;\n case \"String\":\n return DataType.String;\n case \"Boolean\":\n return DataType.Boolean;\n default:\n return DataType.String;\n }\n};\n\n/**\n * Component to create or update a custom calculation property.\n * @public\n */\nexport const CustomCalculationAction = ({ mappingId, groupId, customCalculation, onSaveSuccess, onClickCancel }: CustomCalculationActionProps) => {\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const propertiesClient = usePropertiesClient();\n const [propertyName, setPropertyName] = useState<string>(customCalculation?.propertyName ?? \"\");\n const [formula, setFormula] = useState<string>(customCalculation?.formula ?? \"\");\n const [quantityType, setQuantityType] = useState<QuantityType | undefined>(customCalculation?.quantityType ?? undefined);\n const [formulaErrorMessage, setFormulaErrorMessage] = useState<string>(\"\");\n const [validator, showValidationMessage] = useValidator();\n const [properties, setProperties] = useState<PropertyMap>({});\n const { isValid, forceValidation, inferredDataType } = useFormulaValidation(propertyName.toLowerCase(), formula, properties, setFormulaErrorMessage);\n const queryClient = useQueryClient();\n\n const { data: groupProperties, isFetching: isLoadingGroupProperties } = usePropertiesQuery(iModelId, mappingId, groupId, getAccessToken, propertiesClient);\n\n useEffect(() => {\n const propertiesMap = convertToPropertyMap(groupProperties?.properties ?? []);\n setProperties(propertiesMap);\n }, [groupProperties]);\n\n const { mutate: saveMutation, isLoading: isSaving } = useMutation(\n async () => {\n const accessToken = await getAccessToken();\n\n if (customCalculation) {\n return propertiesClient.updateProperty(accessToken, mappingId, groupId, customCalculation.id, {\n propertyName,\n dataType: customCalculation.dataType,\n formula,\n quantityType,\n });\n }\n\n if (inferredDataType) {\n return propertiesClient.createProperty(accessToken, mappingId, groupId, {\n propertyName,\n dataType: inferToPropertyDataType(inferredDataType),\n formula,\n quantityType,\n });\n }\n return;\n },\n {\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: [\"properties\", iModelId, mappingId, groupId] });\n onSaveSuccess();\n setPropertyName(\"\");\n setFormula(\"\");\n setQuantityType(undefined);\n },\n onError: async (error: any) => {\n if (error.status === 422) {\n const erroredResponse = await error.json();\n if (erroredResponse.error.code === \"InvalidInsightsRequest\" && erroredResponse.error.target === \"formula\") {\n setFormulaErrorMessage(erroredResponse.error.message);\n }\n } else {\n handleError(error.status);\n }\n },\n },\n );\n\n const onSave = () => {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n if (!forceValidation()) {\n return;\n }\n saveMutation();\n };\n\n const isLoading = isSaving || isLoadingGroupProperties;\n\n return (\n <>\n <div className=\"gmw-custom-calculation-action-container\">\n <Fieldset legend=\"Custom Calculation Details\" className=\"gmw-details-form\">\n <Text variant=\"small\" as=\"small\" className=\"gmw-field-legend\">\n Asterisk * indicates mandatory fields.\n </Text>\n <LabeledInput\n value={propertyName}\n required\n name=\"name\"\n label=\"Name\"\n disabled={isLoading}\n onChange={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n message={validator.message(\"name\", propertyName, NAME_REQUIREMENTS)}\n status={validator.message(\"name\", propertyName, NAME_REQUIREMENTS) ? \"negative\" : undefined}\n onBlur={() => {\n validator.showMessageFor(\"name\");\n }}\n onBlurCapture={(event) => {\n setPropertyName(event.target.value);\n validator.showMessageFor(\"name\");\n }}\n />\n <Alert\n type=\"informational\"\n clickableText=\"Click here.\"\n clickableTextProps={{\n href: \"https://developer.bentley.com/apis/grouping-and-mapping/operations/create-property/#customcalculations\",\n target: \"_blank\",\n rel: \"noreferrer\",\n }}\n >\n To learn more about creating custom calculation formulas, view the documentation.\n </Alert>\n <LabeledTextarea\n value={formula}\n required\n name=\"formula\"\n label=\"Formula\"\n disabled={isLoading}\n onChange={(event) => {\n setFormula(event.target.value);\n }}\n message={formulaErrorMessage}\n status={formulaErrorMessage ? \"negative\" : undefined}\n onBlurCapture={() => {\n forceValidation();\n }}\n />\n <LabeledSelect<QuantityType | undefined>\n label=\"Quantity Type\"\n disabled={isLoading}\n options={quantityTypesSelectionOptions}\n value={quantityType}\n onChange={setQuantityType}\n onShow={() => {}}\n onHide={() => {}}\n placeholder=\"No Quantity Type\"\n />\n </Fieldset>\n </div>\n <ActionPanel onSave={onSave} onCancel={onClickCancel} isSavingDisabled={!(formula && propertyName && isValid)} isLoading={isLoading} />\n </>\n );\n};\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { Property } from "@itwin/insights-client";
|
|
3
3
|
export interface CustomCalculationTableProps {
|
|
4
4
|
mappingId: string;
|
|
5
5
|
groupId: string;
|
|
6
6
|
onClickAdd?: () => void;
|
|
7
|
-
onClickModify?: (value:
|
|
7
|
+
onClickModify?: (value: Property) => void;
|
|
8
8
|
isLoading: boolean;
|
|
9
|
-
customCalculations:
|
|
9
|
+
customCalculations: Property[];
|
|
10
10
|
refresh: () => Promise<void>;
|
|
11
11
|
}
|
|
12
12
|
export declare const CustomCalculationTable: ({ mappingId, groupId, onClickAdd, onClickModify, isLoading, customCalculations, refresh, }: CustomCalculationTableProps) => JSX.Element;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { SvgDelete, SvgEdit, SvgMore
|
|
6
|
-
import { DropdownMenu, IconButton, MenuItem
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { SvgDelete, SvgEdit, SvgMore } from "@itwin/itwinui-icons-react";
|
|
6
|
+
import { DropdownMenu, IconButton, MenuItem } from "@itwin/itwinui-react";
|
|
7
7
|
import React, { useCallback } from "react";
|
|
8
|
-
import { useMappingClient } from "../../context/MappingClientContext";
|
|
9
8
|
import { PropertyNameCell } from "../PropertyNameCell";
|
|
10
9
|
import { PropertyTable } from "../PropertyTable";
|
|
11
10
|
import { useGroupingMappingApiConfig } from "../../context/GroupingApiConfigContext";
|
|
12
11
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
12
|
+
import { usePropertiesClient } from "../../context/PropertiesClientContext";
|
|
13
13
|
export const CustomCalculationTable = ({ mappingId, groupId, onClickAdd, onClickModify, isLoading, customCalculations, refresh, }) => {
|
|
14
|
-
const
|
|
14
|
+
const propertiesClient = usePropertiesClient();
|
|
15
15
|
const { getAccessToken, iModelId } = useGroupingMappingApiConfig();
|
|
16
16
|
const queryClient = useQueryClient();
|
|
17
17
|
const columnsFactory = useCallback((handleShowDeleteModal) => [
|
|
@@ -19,7 +19,7 @@ export const CustomCalculationTable = ({ mappingId, groupId, onClickAdd, onClick
|
|
|
19
19
|
id: "propertyName",
|
|
20
20
|
Header: "Custom Calculation",
|
|
21
21
|
accessor: "propertyName",
|
|
22
|
-
Cell: (value) =>
|
|
22
|
+
Cell: (value) => React.createElement(PropertyNameCell, { property: value.row.original, onClickModify: onClickModify }),
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
id: "formula",
|
|
@@ -31,17 +31,21 @@ export const CustomCalculationTable = ({ mappingId, groupId, onClickAdd, onClick
|
|
|
31
31
|
Header: "",
|
|
32
32
|
width: 80,
|
|
33
33
|
Cell: (value) => {
|
|
34
|
-
return (React.createElement(DropdownMenu, { menuItems: (close) => [
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
return (React.createElement(DropdownMenu, { menuItems: (close) => [
|
|
35
|
+
onClickModify
|
|
36
|
+
? [
|
|
37
|
+
React.createElement(MenuItem, { key: 0, onClick: () => {
|
|
38
|
+
onClickModify(value.row.original);
|
|
39
|
+
close();
|
|
40
|
+
}, icon: React.createElement(SvgEdit, null) }, "Modify"),
|
|
41
|
+
]
|
|
42
|
+
: [],
|
|
43
|
+
React.createElement(MenuItem, { key: 1, onClick: () => {
|
|
40
44
|
handleShowDeleteModal(value.row.original);
|
|
41
45
|
close();
|
|
42
46
|
}, icon: React.createElement(SvgDelete, null) }, "Remove"),
|
|
43
47
|
].flatMap((p) => p) },
|
|
44
|
-
React.createElement(IconButton, { styleType:
|
|
48
|
+
React.createElement(IconButton, { styleType: "borderless" },
|
|
45
49
|
React.createElement(SvgMore, null))));
|
|
46
50
|
},
|
|
47
51
|
},
|
|
@@ -49,9 +53,11 @@ export const CustomCalculationTable = ({ mappingId, groupId, onClickAdd, onClick
|
|
|
49
53
|
const { mutateAsync: deleteProperty } = useMutation({
|
|
50
54
|
mutationFn: async (propertyId) => {
|
|
51
55
|
const accessToken = await getAccessToken();
|
|
52
|
-
await
|
|
56
|
+
await propertiesClient.deleteProperty(accessToken, mappingId, groupId, propertyId);
|
|
57
|
+
},
|
|
58
|
+
onSuccess: async () => {
|
|
59
|
+
await queryClient.invalidateQueries({ queryKey: ["properties", iModelId, mappingId, groupId] });
|
|
53
60
|
},
|
|
54
|
-
onSuccess: async () => queryClient.invalidateQueries({ queryKey: ["customCalculations", iModelId, mappingId, groupId] }),
|
|
55
61
|
});
|
|
56
62
|
return (React.createElement(PropertyTable, { propertyType: "Custom Calculation", columnsFactory: columnsFactory, data: customCalculations, isLoading: isLoading, onClickAdd: onClickAdd, refreshProperties: refresh, deleteProperty: deleteProperty }));
|
|
57
63
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomCalculationTable.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CustomCalculations/CustomCalculationTable.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"CustomCalculationTable.js","sourceRoot":"","sources":["../../../../../src/components/Properties/CustomCalculations/CustomCalculationTable.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAG3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAY5E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EACrC,SAAS,EACT,OAAO,EACP,UAAU,EACV,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,OAAO,GACqB,EAAE,EAAE;IAChC,MAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAC/C,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,2BAA2B,EAAE,CAAC;IACnE,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IAErC,M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,CAAC;SACF;KACF,EACD,CAAC,aAAa,CAAC,CAChB,CAAC;IAEF,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,WAAW,CAAC;QAClD,UAAU,EAAE,KAAK,EAAE,UAAkB,EAAE,EAAE;YACvC,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;YAC3C,MAAM,gBAAgB,CAAC,cAAc,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QACrF,CAAC;QACD,SAAS,EAAE,KAAK,IAAI,EAAE;YACpB,MAAM,WAAW,CAAC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,CAAC,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QAClG,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,CACL,oBAAC,aAAa,IACZ,YAAY,EAAC,oBAAoB,EACjC,cAAc,EAAE,cAAc,EAC9B,IAAI,EAAE,kBAAkB,EACxB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,iBAAiB,EAAE,OAAO,EAC1B,cAAc,EAAE,cAAc,GAC9B,CACH,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport { SvgDelete, SvgEdit, SvgMore } from \"@itwin/itwinui-icons-react\";\nimport { DropdownMenu, IconButton, MenuItem } from \"@itwin/itwinui-react\";\nimport React, { useCallback } from \"react\";\nimport type { CellProps, Column } from \"react-table\";\nimport type { Property } from \"@itwin/insights-client\";\nimport { PropertyNameCell } from \"../PropertyNameCell\";\nimport { PropertyTable } from \"../PropertyTable\";\nimport { useGroupingMappingApiConfig } from \"../../context/GroupingApiConfigContext\";\nimport { useMutation, useQueryClient } from \"@tanstack/react-query\";\nimport { usePropertiesClient } from \"../../context/PropertiesClientContext\";\n\nexport interface CustomCalculationTableProps {\n mappingId: string;\n groupId: string;\n onClickAdd?: () => void;\n onClickModify?: (value: Property) => void;\n isLoading: boolean;\n customCalculations: Property[];\n refresh: () => Promise<void>;\n}\n\nexport const CustomCalculationTable = ({\n mappingId,\n groupId,\n onClickAdd,\n onClickModify,\n isLoading,\n customCalculations,\n refresh,\n}: CustomCalculationTableProps) => {\n const propertiesClient = usePropertiesClient();\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const queryClient = useQueryClient();\n\n const columnsFactory = useCallback(\n (handleShowDeleteModal: (value: Property) => void): Column<Property>[] => [\n {\n id: \"propertyName\",\n Header: \"Custom Calculation\",\n accessor: \"propertyName\",\n Cell: (value: CellProps<Property>) => <PropertyNameCell property={value.row.original} onClickModify={onClickModify} />,\n },\n {\n id: \"formula\",\n Header: \"Formula\",\n accessor: \"formula\",\n },\n {\n id: \"dropdown\",\n Header: \"\",\n width: 80,\n Cell: (value: CellProps<Property>) => {\n return (\n <DropdownMenu\n menuItems={(close: () => void) =>\n [\n onClickModify\n ? [\n <MenuItem\n key={0}\n onClick={() => {\n onClickModify(value.row.original);\n close();\n }}\n icon={<SvgEdit />}\n >\n Modify\n </MenuItem>,\n ]\n : [],\n <MenuItem\n key={1}\n onClick={() => {\n handleShowDeleteModal(value.row.original);\n close();\n }}\n icon={<SvgDelete />}\n >\n Remove\n </MenuItem>,\n ].flatMap((p) => p)\n }\n >\n <IconButton styleType=\"borderless\">\n <SvgMore />\n </IconButton>\n </DropdownMenu>\n );\n },\n },\n ],\n [onClickModify],\n );\n\n const { mutateAsync: deleteProperty } = useMutation({\n mutationFn: async (propertyId: string) => {\n const accessToken = await getAccessToken();\n await propertiesClient.deleteProperty(accessToken, mappingId, groupId, propertyId);\n },\n onSuccess: async () => {\n await queryClient.invalidateQueries({ queryKey: [\"properties\", iModelId, mappingId, groupId] });\n },\n });\n\n return (\n <PropertyTable\n propertyType=\"Custom Calculation\"\n columnsFactory={columnsFactory}\n data={customCalculations}\n isLoading={isLoading}\n onClickAdd={onClickAdd}\n refreshProperties={refresh}\n deleteProperty={deleteProperty}\n />\n );\n};\n"]}
|