@itwin/grouping-mapping-widget 0.11.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/grouping-mapping-widget.d.ts +4 -1
- package/lib/cjs/grouping-mapping-widget.js +7 -1
- package/lib/cjs/grouping-mapping-widget.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/widget/components/CalculatedPropertyAction.d.ts +7 -9
- package/lib/cjs/widget/components/CalculatedPropertyAction.js +49 -24
- package/lib/cjs/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/CalculatedPropertyTable.d.ts +9 -16
- package/lib/cjs/widget/components/CalculatedPropertyTable.js +29 -31
- package/lib/cjs/widget/components/CalculatedPropertyTable.js.map +1 -1
- package/lib/cjs/widget/components/CalculatedPropertyTable.scss +9 -0
- package/lib/cjs/widget/components/ConfirmMappingsImport.js +1 -1
- package/lib/cjs/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/cjs/widget/components/CustomCalculationAction.d.ts +6 -9
- package/lib/cjs/widget/components/CustomCalculationAction.js +79 -9
- package/lib/cjs/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/cjs/widget/components/CustomCalculationTable.d.ts +8 -16
- package/lib/cjs/widget/components/CustomCalculationTable.js +22 -29
- package/lib/cjs/widget/components/CustomCalculationTable.js.map +1 -1
- package/lib/cjs/widget/components/DeleteModal.d.ts +4 -5
- package/lib/cjs/widget/components/DeleteModal.js +9 -13
- package/lib/cjs/widget/components/DeleteModal.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.js +51 -66
- package/lib/cjs/widget/components/GroupAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupAction.scss +0 -18
- package/lib/cjs/widget/components/GroupDetails.d.ts +13 -0
- package/lib/cjs/widget/components/GroupDetails.js +34 -0
- package/lib/cjs/widget/components/GroupDetails.js.map +1 -0
- package/lib/cjs/widget/components/GroupDetailsActionPanel.d.ts +8 -0
- package/lib/cjs/widget/components/GroupDetailsActionPanel.js +19 -0
- package/lib/cjs/widget/components/GroupDetailsActionPanel.js.map +1 -0
- package/lib/cjs/widget/components/GroupDetailsStep.d.ts +13 -0
- package/lib/cjs/widget/components/GroupDetailsStep.js +25 -0
- package/lib/cjs/widget/components/GroupDetailsStep.js.map +1 -0
- package/lib/cjs/widget/components/GroupDetailsStep.scss +11 -0
- package/lib/cjs/widget/components/GroupInformationPanel.d.ts +10 -0
- package/lib/cjs/widget/components/GroupInformationPanel.js +23 -0
- package/lib/cjs/widget/components/GroupInformationPanel.js.map +1 -0
- package/lib/cjs/widget/components/GroupInformationPanel.scss +13 -0
- package/lib/cjs/widget/components/GroupPropertyAction.d.ts +6 -9
- package/lib/cjs/widget/components/GroupPropertyAction.js +26 -15
- package/lib/cjs/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/cjs/widget/components/GroupPropertyTable.d.ts +8 -15
- package/lib/cjs/widget/components/GroupPropertyTable.js +23 -28
- package/lib/cjs/widget/components/GroupPropertyTable.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.d.ts +2 -1
- package/lib/cjs/widget/components/Grouping.js +13 -17
- package/lib/cjs/widget/components/Grouping.js.map +1 -1
- package/lib/cjs/widget/components/Grouping.scss +2 -9
- package/lib/cjs/widget/components/GroupingMapping.js +1 -2
- package/lib/cjs/widget/components/GroupingMapping.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMappingContent.js +8 -4
- package/lib/cjs/widget/components/GroupingMappingContent.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMappingContext.js +17 -1
- package/lib/cjs/widget/components/GroupingMappingContext.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMappingHeader.d.ts +1 -2
- package/lib/cjs/widget/components/GroupingMappingHeader.js +10 -3
- package/lib/cjs/widget/components/GroupingMappingHeader.js.map +1 -1
- package/lib/cjs/widget/components/GroupingMappingRouter.js +23 -2
- package/lib/cjs/widget/components/GroupingMappingRouter.js.map +1 -1
- package/lib/cjs/widget/components/GroupsAddButton.d.ts +9 -0
- package/lib/cjs/widget/components/GroupsAddButton.js +17 -0
- package/lib/cjs/widget/components/GroupsAddButton.js.map +1 -0
- package/lib/cjs/widget/components/GroupsAddButton.scss +7 -0
- package/lib/cjs/widget/components/Mapping.js +7 -14
- package/lib/cjs/widget/components/Mapping.js.map +1 -1
- package/lib/cjs/widget/components/MappingAction.js +1 -1
- package/lib/cjs/widget/components/MappingAction.js.map +1 -1
- package/lib/cjs/widget/components/MappingImportWizardModal.js +1 -1
- package/lib/cjs/widget/components/MappingImportWizardModal.js.map +1 -1
- package/lib/cjs/widget/components/PropertyAction.d.ts +8 -0
- package/lib/cjs/widget/components/PropertyAction.js +100 -0
- package/lib/cjs/widget/components/PropertyAction.js.map +1 -0
- package/lib/cjs/widget/components/PropertyAction.scss +9 -0
- package/lib/cjs/widget/components/PropertyMenu.d.ts +12 -17
- package/lib/cjs/widget/components/PropertyMenu.js +52 -155
- package/lib/cjs/widget/components/PropertyMenu.js.map +1 -1
- package/lib/cjs/widget/components/PropertyMenu.scss +4 -28
- package/lib/cjs/widget/components/PropertyNameCell.d.ts +11 -0
- package/lib/cjs/widget/components/PropertyNameCell.js +15 -0
- package/lib/cjs/widget/components/PropertyNameCell.js.map +1 -0
- package/lib/cjs/widget/components/PropertyTable.d.ts +18 -0
- package/lib/cjs/widget/components/PropertyTable.js +54 -0
- package/lib/cjs/widget/components/PropertyTable.js.map +1 -0
- package/lib/cjs/widget/components/PropertyTable.scss +11 -0
- package/lib/cjs/widget/components/PropertyTableToolbar.d.ts +10 -0
- package/lib/cjs/widget/components/PropertyTableToolbar.js +23 -0
- package/lib/cjs/widget/components/PropertyTableToolbar.js.map +1 -0
- package/lib/cjs/widget/components/PropertyTableToolbar.scss +12 -0
- package/lib/cjs/widget/components/QueryBuilder.d.ts +1 -1
- package/lib/cjs/widget/components/QueryBuilder.js +4 -4
- package/lib/cjs/widget/components/QueryBuilder.js.map +1 -1
- package/lib/cjs/widget/components/QueryBuilderActionPanel.d.ts +6 -0
- package/lib/cjs/widget/components/QueryBuilderActionPanel.js +17 -0
- package/lib/cjs/widget/components/QueryBuilderActionPanel.js.map +1 -0
- package/lib/cjs/widget/components/QueryBuilderCustomUI.d.ts +11 -0
- package/lib/cjs/widget/components/QueryBuilderCustomUI.js +27 -0
- package/lib/cjs/widget/components/QueryBuilderCustomUI.js.map +1 -0
- package/lib/cjs/widget/components/QueryBuilderStep.d.ts +16 -0
- package/lib/cjs/widget/components/QueryBuilderStep.js +30 -0
- package/lib/cjs/widget/components/QueryBuilderStep.js.map +1 -0
- package/lib/cjs/widget/components/QueryBuilderStep.scss +18 -0
- package/lib/cjs/widget/components/SelectMappings.js +1 -1
- package/lib/cjs/widget/components/SelectMappings.js.map +1 -1
- package/lib/cjs/widget/components/StatusIcon.d.ts +15 -0
- package/lib/cjs/widget/components/StatusIcon.js +26 -0
- package/lib/cjs/widget/components/StatusIcon.js.map +1 -0
- package/lib/cjs/widget/components/StatusIcon.scss +26 -0
- package/lib/cjs/widget/components/ToggleGroupVisibility.d.ts +9 -0
- package/lib/cjs/widget/components/ToggleGroupVisibility.js +16 -0
- package/lib/cjs/widget/components/ToggleGroupVisibility.js.map +1 -0
- package/lib/cjs/widget/components/ToggleGroupVisibility.scss +9 -0
- package/lib/cjs/widget/components/WidgetHeader.d.ts +9 -0
- package/lib/cjs/widget/components/WidgetHeader.js +22 -0
- package/lib/cjs/widget/components/WidgetHeader.js.map +1 -0
- package/lib/cjs/widget/components/WidgetHeader.scss +36 -0
- package/lib/cjs/widget/components/context/GroupHilitedElementsContext.d.ts +6 -1
- package/lib/cjs/widget/components/context/GroupHilitedElementsContext.js.map +1 -1
- package/lib/cjs/widget/components/context/PropertiesContext.d.ts +15 -0
- package/lib/cjs/widget/components/context/PropertiesContext.js +43 -0
- package/lib/cjs/widget/components/context/PropertiesContext.js.map +1 -0
- package/lib/cjs/widget/components/context/PropertyGridWrapperContext.d.ts +1 -3
- package/lib/cjs/widget/components/context/PropertyGridWrapperContext.js +0 -2
- package/lib/cjs/widget/components/context/PropertyGridWrapperContext.js.map +1 -1
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.d.ts +1 -1
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.js +51 -32
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/customUI/GroupQueryBuilderCustomUI.scss +25 -17
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js +1 -1
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/customUI/ManualGroupingCustomUI.scss +1 -0
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js +1 -1
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -1
- package/lib/cjs/widget/components/customUI/SearchGroupingCustomUI.scss +1 -0
- package/lib/cjs/widget/components/groupsHelpers.d.ts +6 -3
- package/lib/cjs/widget/components/groupsHelpers.js +43 -40
- package/lib/cjs/widget/components/groupsHelpers.js.map +1 -1
- package/lib/cjs/widget/components/utils.d.ts +1 -7
- package/lib/cjs/widget/components/utils.js +1 -9
- package/lib/cjs/widget/components/utils.js.map +1 -1
- package/lib/cjs/widget/components/utils.scss +0 -29
- package/lib/cjs/widget/components/viewerUtils.d.ts +4 -2
- package/lib/cjs/widget/components/viewerUtils.js +4 -22
- package/lib/cjs/widget/components/viewerUtils.js.map +1 -1
- package/lib/cjs/widget/hooks/useFetchData.d.ts +3 -5
- package/lib/cjs/widget/hooks/useFetchData.js +9 -7
- package/lib/cjs/widget/hooks/useFetchData.js.map +1 -1
- package/lib/esm/grouping-mapping-widget.d.ts +4 -1
- package/lib/esm/grouping-mapping-widget.js +3 -0
- package/lib/esm/grouping-mapping-widget.js.map +1 -1
- package/lib/esm/test/WidgetHeader.test.js +1 -1
- package/lib/esm/test/WidgetHeader.test.js.map +1 -1
- package/lib/esm/widget/components/CalculatedPropertyAction.d.ts +7 -9
- package/lib/esm/widget/components/CalculatedPropertyAction.js +50 -27
- package/lib/esm/widget/components/CalculatedPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/CalculatedPropertyTable.d.ts +9 -16
- package/lib/esm/widget/components/CalculatedPropertyTable.js +30 -31
- package/lib/esm/widget/components/CalculatedPropertyTable.js.map +1 -1
- package/lib/esm/widget/components/CalculatedPropertyTable.scss +9 -0
- package/lib/esm/widget/components/ConfirmMappingsImport.js +1 -1
- package/lib/esm/widget/components/ConfirmMappingsImport.js.map +1 -1
- package/lib/esm/widget/components/CustomCalculationAction.d.ts +6 -9
- package/lib/esm/widget/components/CustomCalculationAction.js +79 -11
- package/lib/esm/widget/components/CustomCalculationAction.js.map +1 -1
- package/lib/esm/widget/components/CustomCalculationTable.d.ts +8 -16
- package/lib/esm/widget/components/CustomCalculationTable.js +23 -29
- package/lib/esm/widget/components/CustomCalculationTable.js.map +1 -1
- package/lib/esm/widget/components/DeleteModal.d.ts +4 -5
- package/lib/esm/widget/components/DeleteModal.js +9 -13
- package/lib/esm/widget/components/DeleteModal.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.js +54 -69
- package/lib/esm/widget/components/GroupAction.js.map +1 -1
- package/lib/esm/widget/components/GroupAction.scss +0 -18
- package/lib/esm/widget/components/GroupDetails.d.ts +13 -0
- package/lib/esm/widget/components/GroupDetails.js +27 -0
- package/lib/esm/widget/components/GroupDetails.js.map +1 -0
- package/lib/esm/widget/components/GroupDetailsActionPanel.d.ts +8 -0
- package/lib/esm/widget/components/GroupDetailsActionPanel.js +12 -0
- package/lib/esm/widget/components/GroupDetailsActionPanel.js.map +1 -0
- package/lib/esm/widget/components/GroupDetailsStep.d.ts +13 -0
- package/lib/esm/widget/components/GroupDetailsStep.js +18 -0
- package/lib/esm/widget/components/GroupDetailsStep.js.map +1 -0
- package/lib/esm/widget/components/GroupDetailsStep.scss +11 -0
- package/lib/esm/widget/components/GroupInformationPanel.d.ts +10 -0
- package/lib/esm/widget/components/GroupInformationPanel.js +16 -0
- package/lib/esm/widget/components/GroupInformationPanel.js.map +1 -0
- package/lib/esm/widget/components/GroupInformationPanel.scss +13 -0
- package/lib/esm/widget/components/GroupPropertyAction.d.ts +6 -9
- package/lib/esm/widget/components/GroupPropertyAction.js +25 -15
- package/lib/esm/widget/components/GroupPropertyAction.js.map +1 -1
- package/lib/esm/widget/components/GroupPropertyTable.d.ts +8 -15
- package/lib/esm/widget/components/GroupPropertyTable.js +24 -28
- package/lib/esm/widget/components/GroupPropertyTable.js.map +1 -1
- package/lib/esm/widget/components/Grouping.d.ts +2 -1
- package/lib/esm/widget/components/Grouping.js +15 -19
- package/lib/esm/widget/components/Grouping.js.map +1 -1
- package/lib/esm/widget/components/Grouping.scss +2 -9
- package/lib/esm/widget/components/GroupingMapping.js +1 -2
- package/lib/esm/widget/components/GroupingMapping.js.map +1 -1
- package/lib/esm/widget/components/GroupingMappingContent.js +9 -5
- package/lib/esm/widget/components/GroupingMappingContent.js.map +1 -1
- package/lib/esm/widget/components/GroupingMappingContext.js +17 -1
- package/lib/esm/widget/components/GroupingMappingContext.js.map +1 -1
- package/lib/esm/widget/components/GroupingMappingHeader.d.ts +1 -2
- package/lib/esm/widget/components/GroupingMappingHeader.js +10 -3
- package/lib/esm/widget/components/GroupingMappingHeader.js.map +1 -1
- package/lib/esm/widget/components/GroupingMappingRouter.js +23 -2
- package/lib/esm/widget/components/GroupingMappingRouter.js.map +1 -1
- package/lib/esm/widget/components/GroupsAddButton.d.ts +9 -0
- package/lib/esm/widget/components/GroupsAddButton.js +10 -0
- package/lib/esm/widget/components/GroupsAddButton.js.map +1 -0
- package/lib/esm/widget/components/GroupsAddButton.scss +7 -0
- package/lib/esm/widget/components/Mapping.js +7 -14
- package/lib/esm/widget/components/Mapping.js.map +1 -1
- package/lib/esm/widget/components/MappingAction.js +1 -1
- package/lib/esm/widget/components/MappingAction.js.map +1 -1
- package/lib/esm/widget/components/MappingImportWizardModal.js +1 -1
- package/lib/esm/widget/components/MappingImportWizardModal.js.map +1 -1
- package/lib/esm/widget/components/PropertyAction.d.ts +8 -0
- package/lib/esm/widget/components/PropertyAction.js +77 -0
- package/lib/esm/widget/components/PropertyAction.js.map +1 -0
- package/lib/esm/widget/components/PropertyAction.scss +9 -0
- package/lib/esm/widget/components/PropertyMenu.d.ts +12 -17
- package/lib/esm/widget/components/PropertyMenu.js +54 -154
- package/lib/esm/widget/components/PropertyMenu.js.map +1 -1
- package/lib/esm/widget/components/PropertyMenu.scss +4 -28
- package/lib/esm/widget/components/PropertyNameCell.d.ts +11 -0
- package/lib/esm/widget/components/PropertyNameCell.js +8 -0
- package/lib/esm/widget/components/PropertyNameCell.js.map +1 -0
- package/lib/esm/widget/components/PropertyTable.d.ts +18 -0
- package/lib/esm/widget/components/PropertyTable.js +28 -0
- package/lib/esm/widget/components/PropertyTable.js.map +1 -0
- package/lib/esm/widget/components/PropertyTable.scss +11 -0
- package/lib/esm/widget/components/PropertyTableToolbar.d.ts +10 -0
- package/lib/esm/widget/components/PropertyTableToolbar.js +16 -0
- package/lib/esm/widget/components/PropertyTableToolbar.js.map +1 -0
- package/lib/esm/widget/components/PropertyTableToolbar.scss +12 -0
- package/lib/esm/widget/components/QueryBuilder.d.ts +1 -1
- package/lib/esm/widget/components/QueryBuilder.js +4 -4
- package/lib/esm/widget/components/QueryBuilder.js.map +1 -1
- package/lib/esm/widget/components/QueryBuilderActionPanel.d.ts +6 -0
- package/lib/esm/widget/components/QueryBuilderActionPanel.js +10 -0
- package/lib/esm/widget/components/QueryBuilderActionPanel.js.map +1 -0
- package/lib/esm/widget/components/QueryBuilderCustomUI.d.ts +11 -0
- package/lib/esm/widget/components/QueryBuilderCustomUI.js +20 -0
- package/lib/esm/widget/components/QueryBuilderCustomUI.js.map +1 -0
- package/lib/esm/widget/components/QueryBuilderStep.d.ts +16 -0
- package/lib/esm/widget/components/QueryBuilderStep.js +23 -0
- package/lib/esm/widget/components/QueryBuilderStep.js.map +1 -0
- package/lib/esm/widget/components/QueryBuilderStep.scss +18 -0
- package/lib/esm/widget/components/SelectMappings.js +1 -1
- package/lib/esm/widget/components/SelectMappings.js.map +1 -1
- package/lib/esm/widget/components/StatusIcon.d.ts +15 -0
- package/lib/esm/widget/components/StatusIcon.js +19 -0
- package/lib/esm/widget/components/StatusIcon.js.map +1 -0
- package/lib/esm/widget/components/StatusIcon.scss +26 -0
- package/lib/esm/widget/components/ToggleGroupVisibility.d.ts +9 -0
- package/lib/esm/widget/components/ToggleGroupVisibility.js +9 -0
- package/lib/esm/widget/components/ToggleGroupVisibility.js.map +1 -0
- package/lib/esm/widget/components/ToggleGroupVisibility.scss +9 -0
- package/lib/esm/widget/components/WidgetHeader.d.ts +9 -0
- package/lib/esm/widget/components/WidgetHeader.js +15 -0
- package/lib/esm/widget/components/WidgetHeader.js.map +1 -0
- package/lib/esm/widget/components/WidgetHeader.scss +36 -0
- package/lib/esm/widget/components/context/GroupHilitedElementsContext.d.ts +6 -1
- package/lib/esm/widget/components/context/GroupHilitedElementsContext.js.map +1 -1
- package/lib/esm/widget/components/context/PropertiesContext.d.ts +15 -0
- package/lib/esm/widget/components/context/PropertiesContext.js +20 -0
- package/lib/esm/widget/components/context/PropertiesContext.js.map +1 -0
- package/lib/esm/widget/components/context/PropertyGridWrapperContext.d.ts +1 -3
- package/lib/esm/widget/components/context/PropertyGridWrapperContext.js +0 -2
- package/lib/esm/widget/components/context/PropertyGridWrapperContext.js.map +1 -1
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.d.ts +1 -1
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.js +53 -34
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.js.map +1 -1
- package/lib/esm/widget/components/customUI/GroupQueryBuilderCustomUI.scss +25 -17
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js +2 -2
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.js.map +1 -1
- package/lib/esm/widget/components/customUI/ManualGroupingCustomUI.scss +1 -0
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js +2 -2
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.js.map +1 -1
- package/lib/esm/widget/components/customUI/SearchGroupingCustomUI.scss +1 -0
- package/lib/esm/widget/components/groupsHelpers.d.ts +6 -3
- package/lib/esm/widget/components/groupsHelpers.js +41 -40
- package/lib/esm/widget/components/groupsHelpers.js.map +1 -1
- package/lib/esm/widget/components/utils.d.ts +1 -7
- package/lib/esm/widget/components/utils.js +0 -7
- package/lib/esm/widget/components/utils.js.map +1 -1
- package/lib/esm/widget/components/utils.scss +0 -29
- package/lib/esm/widget/components/viewerUtils.d.ts +4 -2
- package/lib/esm/widget/components/viewerUtils.js +3 -20
- package/lib/esm/widget/components/viewerUtils.js.map +1 -1
- package/lib/esm/widget/hooks/useFetchData.d.ts +3 -5
- package/lib/esm/widget/hooks/useFetchData.js +9 -7
- package/lib/esm/widget/hooks/useFetchData.js.map +1 -1
- package/package.json +1 -1
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +0 -32
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js +0 -91
- package/lib/cjs/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.d.ts +0 -26
- package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.js +0 -62
- package/lib/cjs/widget/components/property-grid/PrimitivePropertyRenderer.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyGrid.d.ts +0 -67
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js +0 -198
- package/lib/cjs/widget/components/property-grid/PropertyGrid.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyGrid.scss +0 -71
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.d.ts +0 -23
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js +0 -77
- package/lib/cjs/widget/components/property-grid/PropertyGridWrapper.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyList.d.ts +0 -69
- package/lib/cjs/widget/components/property-grid/PropertyList.js +0 -87
- package/lib/cjs/widget/components/property-grid/PropertyList.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyRender.d.ts +0 -92
- package/lib/cjs/widget/components/property-grid/PropertyRender.js +0 -109
- package/lib/cjs/widget/components/property-grid/PropertyRender.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyView.d.ts +0 -22
- package/lib/cjs/widget/components/property-grid/PropertyView.js +0 -232
- package/lib/cjs/widget/components/property-grid/PropertyView.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/PropertyView.scss +0 -77
- package/lib/cjs/widget/components/property-grid/countMatchesInString.d.ts +0 -8
- package/lib/cjs/widget/components/property-grid/countMatchesInString.js +0 -32
- package/lib/cjs/widget/components/property-grid/countMatchesInString.js.map +0 -1
- package/lib/cjs/widget/components/property-grid/createNewDisplayValue.d.ts +0 -10
- package/lib/cjs/widget/components/property-grid/createNewDisplayValue.js +0 -65
- package/lib/cjs/widget/components/property-grid/createNewDisplayValue.js.map +0 -1
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.d.ts +0 -32
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js +0 -68
- package/lib/esm/widget/components/property-grid/NonPrimitivePropertyRenderer.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.d.ts +0 -26
- package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.js +0 -39
- package/lib/esm/widget/components/property-grid/PrimitivePropertyRenderer.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyGrid.d.ts +0 -67
- package/lib/esm/widget/components/property-grid/PropertyGrid.js +0 -172
- package/lib/esm/widget/components/property-grid/PropertyGrid.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyGrid.scss +0 -71
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.d.ts +0 -23
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js +0 -54
- package/lib/esm/widget/components/property-grid/PropertyGridWrapper.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyList.d.ts +0 -69
- package/lib/esm/widget/components/property-grid/PropertyList.js +0 -60
- package/lib/esm/widget/components/property-grid/PropertyList.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyRender.d.ts +0 -92
- package/lib/esm/widget/components/property-grid/PropertyRender.js +0 -86
- package/lib/esm/widget/components/property-grid/PropertyRender.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyView.d.ts +0 -22
- package/lib/esm/widget/components/property-grid/PropertyView.js +0 -209
- package/lib/esm/widget/components/property-grid/PropertyView.js.map +0 -1
- package/lib/esm/widget/components/property-grid/PropertyView.scss +0 -77
- package/lib/esm/widget/components/property-grid/countMatchesInString.d.ts +0 -8
- package/lib/esm/widget/components/property-grid/countMatchesInString.js +0 -28
- package/lib/esm/widget/components/property-grid/countMatchesInString.js.map +0 -1
- package/lib/esm/widget/components/property-grid/createNewDisplayValue.d.ts +0 -10
- package/lib/esm/widget/components/property-grid/createNewDisplayValue.js +0 -42
- package/lib/esm/widget/components/property-grid/createNewDisplayValue.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmMappingsImport.js","sourceRoot":"","sources":["../../../../src/widget/components/ConfirmMappingsImport.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAM8B;AAC9B,+CAAmD;AAEnD,wCAAsC;AACtC,oEAAoE;AACpE,sEAAwE;AACxE,mCAAsC;AACtC,yEAAkE;AAClE,iFAAiF;AAEjF,MAAM,qBAAqB,GAAG;IAC5B,QAAQ,EAAE,UAAU;CACrB,CAAC;AAcF,MAAM,oBAAoB,GAAG,CAAC,E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,CAAC,CAAC,UAAU;4BACZ,CAAC,CAAC,SAAS,EAEf,MAAM,EAAE,GAAG,EAAE;4BACX,SAAS,CAAC,cAAc,CAAC,WAAW,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;wBACpD,CAAC,EACD,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE;4BACvB,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;4BAC3B,SAAS,CAAC,cAAc,CAAC,WAAW,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;wBACpD,CAAC,GACD;oBACF,2CAAM,OAAO,CAAC,WAAW,CAAO,CAC5B;gBACN,uCAAK,SAAS,EAAC,gBAAgB,GAAG,CAC9B,CACP,CAAC,CACE,CACF;QACN,uCAAK,SAAS,EAAC,yBAAyB;YACtC,8BAAC,sBAAM,IAAC,OAAO,EAAE,MAAM,WAAe;YACtC,8BAAC,sBAAM,IAAC,SAAS,EAAC,iBAAiB,EAAC,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,QAAQ,EAAE,aAE1D;YACT,8BAAC,sBAAM,IAAC,OAAO,EAAE,QAAQ,aAAiB,CACtC,CACF,CACP,CACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,oBAAoB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport {\n Button,\n LabeledInput,\n MiddleTextTruncation,\n ProgressLinear,\n Text,\n} from \"@itwin/itwinui-react\";\nimport React, { useEffect, useState } from \"react\";\nimport type { IMappingTyped } from \"./Mapping\";\nimport \"./ConfirmMappingsImport.scss\";\nimport { SvgStatusSuccessHollow } from \"@itwin/itwinui-icons-react\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport { handleError } from \"./utils\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\n\nconst defaultDisplayStrings = {\n mappings: \"Mappings\",\n};\n\ninterface ConfirmMappingImportProps {\n sourceiModelId: string;\n selectedMappings: IMappingTyped[];\n importing: boolean;\n setImporting: React.Dispatch<React.SetStateAction<boolean>>;\n setSelectedMappings: React.Dispatch<React.SetStateAction<IMappingTyped[]>>;\n backFn: () => void;\n onCancel: () => void;\n onFinish: () => void;\n displayStrings?: Partial<typeof defaultDisplayStrings>;\n}\n\nconst ConfirmMappingImport = ({\n sourceiModelId,\n selectedMappings,\n importing,\n setImporting,\n setSelectedMappings,\n backFn,\n onCancel,\n onFinish,\n displayStrings: userDisplayStrings,\n}: ConfirmMappingImportProps) => {\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n\n const [importCount, setImportCount] = useState<number>(0);\n const [currentlyImporting, setCurrentlyImporting] = useState<string>(\"\");\n const [validator, showValidationMessage] = useValidator();\n const [errored, setErrored] = useState<boolean>(false);\n\n const displayStrings = { ...defaultDisplayStrings, ...userDisplayStrings };\n\n useEffect(() => {\n setSelectedMappings((selectedMappings) =>\n selectedMappings.map((mapping) => ({\n ...mapping,\n mappingName: `${mapping.mappingName}_Copy`,\n })),\n );\n }, [setSelectedMappings]);\n\n const handleChange = (\n e: React.ChangeEvent<HTMLInputElement>,\n index: number,\n ) => {\n const newState = [...selectedMappings];\n newState[index] = {\n ...newState[index],\n mappingName: e.target.value,\n };\n setSelectedMappings(newState);\n };\n\n const onImport = async () => {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n setImporting(true);\n try {\n for (const selectedMapping of selectedMappings) {\n setCurrentlyImporting(selectedMapping.mappingName ?? \"\");\n const accessToken = await getAccessToken();\n await mappingClient.copyMapping(\n accessToken,\n sourceiModelId,\n selectedMapping.id ?? \"\",\n {\n targetIModelId: iModelId ?? \"\",\n mappingName: selectedMapping.mappingName ?? \"\",\n },\n );\n setImportCount((importCount) => importCount + 1);\n }\n } catch (error: any) {\n handleError(error);\n setErrored(true);\n }\n };\n\n return (\n <>\n {importing ? (\n <div className='gmw-import-progress-container'>\n <div className='gmw-import-progress-bar'>\n <div className='gmw-import-progress-bar-description'>\n {\n !errored ? importCount !== selectedMappings.length ? (\n <>\n <Text variant='title'>Importing</Text>\n <Text>{`We are currently importing the ${displayStrings.mappings.toLocaleLowerCase()}.`}</Text>\n </>\n ) : (\n <>\n <Text variant='title'>Done!</Text>\n <Text>{`Your imported ${displayStrings.mappings.toLocaleLowerCase()} are ready.`}</Text>\n </>\n ) :\n <>\n <Text variant='title'>Error!</Text>\n <Text>{`Sorry, there was an error importing some or all ${displayStrings.mappings}.`}</Text>\n </>}\n </div>\n <ProgressLinear\n value={(importCount / selectedMappings.length) * 100}\n labels={\n importCount === selectedMappings.length\n ? [\"Import done!\", <SvgStatusSuccessHollow key='0' />]\n : [\n <>\n <Text>Copying</Text>\n <MiddleTextTruncation text={currentlyImporting} />\n </>,\n `${importCount}/${selectedMappings.length}`,\n ]\n }\n status={\n !errored ?\n importCount === selectedMappings.length ? \"positive\" : undefined : \"negative\"\n }\n />\n </div>\n <div className='gmw-import-action-panel'>\n <Button\n disabled={!errored && importCount !== selectedMappings.length}\n onClick={() => {\n setImporting(false);\n setImportCount(0);\n setCurrentlyImporting(\"\");\n setErrored(false);\n }}\n >\n Back\n </Button>\n <Button\n styleType='high-visibility'\n disabled={!errored && importCount !== selectedMappings.length}\n onClick={() => onFinish()}\n >\n Close\n </Button>\n </div>\n </div>\n ) : (\n <div className='gmw-rename-confirm-container '>\n <div className='gmw-mapping-rename-container'>\n <div className='gmw-mapping-row-header-container'>\n <div className='gmw-mapping-row'>\n <Text variant='leading'>{displayStrings.mappings}</Text>\n <Text variant='leading'>Description</Text>\n </div>\n </div>\n <div className='gmw-mapping-row-body'>\n {selectedMappings.map((mapping, index) => (\n <div className='gmw-mapping-row-container' key={mapping.id}>\n <div className='gmw-mapping-row'>\n <LabeledInput\n value={mapping.mappingName}\n name={`mapping_${mapping.id}`}\n required\n onChange={(event) => {\n handleChange(event, index);\n validator.showMessageFor(`mapping_${mapping.id}`);\n }}\n message={validator.message(\n `mapping_${mapping.id}`,\n mapping.mappingName,\n NAME_REQUIREMENTS,\n )}\n status={\n validator.message(\n `mapping_${mapping.id}`,\n mapping.mappingName,\n NAME_REQUIREMENTS,\n )\n ? \"negative\"\n : undefined\n }\n onBlur={() => {\n validator.showMessageFor(`mapping_${mapping.id}`);\n }}\n onBlurCapture={(event) => {\n handleChange(event, index);\n validator.showMessageFor(`mapping_${mapping.id}`);\n }}\n />\n <div>{mapping.description}</div>\n </div>\n <div className='gmw-border-div' />\n </div>\n ))}\n </div>\n </div>\n <div className='gmw-import-action-panel'>\n <Button onClick={backFn}>Back</Button>\n <Button styleType='high-visibility' onClick={async () => onImport()}>\n Import\n </Button>\n <Button onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n )}\n </>\n );\n};\n\nexport default ConfirmMappingImport;\n"]}
|
|
1
|
+
{"version":3,"file":"ConfirmMappingsImport.js","sourceRoot":"","sources":["../../../../src/widget/components/ConfirmMappingsImport.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAM8B;AAC9B,+CAAmD;AAEnD,wCAAsC;AACtC,oEAAoE;AACpE,sEAAwE;AACxE,mCAAsC;AACtC,yEAAkE;AAClE,iFAAiF;AAEjF,MAAM,qBAAqB,GAAG;IAC5B,QAAQ,EAAE,UAAU;CACrB,CAAC;AAcF,MAAM,oBAAoB,GAAG,CAAC,EAC5B,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,cAAc,EAAE,kBAAkB,GACR,EAAE,EAAE;IAC9B,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,sDAA2B,EAAE,CAAC;IACnE,MAAM,aAAa,GAAG,uCAAgB,EAAE,CAAC;IAEzC,MAAM,C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AAK,EAAE,EAAE;4BACvB,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;4BAC3B,SAAS,CAAC,cAAc,CAAC,WAAW,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;wBACpD,CAAC,GACD;oBACF,2CAAM,OAAO,CAAC,WAAW,CAAO,CAC5B;gBACN,uCAAK,SAAS,EAAC,gBAAgB,GAAG,CAC9B,CACP,CAAC,CACE,CACF;QACN,uCAAK,SAAS,EAAC,yBAAyB;YACtC,8BAAC,sBAAM,IAAC,OAAO,EAAE,MAAM,WAAe;YACtC,8BAAC,sBAAM,IAAC,SAAS,EAAC,iBAAiB,EAAC,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,QAAQ,EAAE,aAE1D;YACT,8BAAC,sBAAM,IAAC,OAAO,EAAE,QAAQ,aAAiB,CACtC,CACF,CACP,CACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,oBAAoB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport {\n Button,\n LabeledInput,\n MiddleTextTruncation,\n ProgressLinear,\n Text,\n} from \"@itwin/itwinui-react\";\nimport React, { useEffect, useState } from \"react\";\nimport type { IMappingTyped } from \"./Mapping\";\nimport \"./ConfirmMappingsImport.scss\";\nimport { SvgStatusSuccessHollow } from \"@itwin/itwinui-icons-react\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport { handleError } from \"./utils\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\n\nconst defaultDisplayStrings = {\n mappings: \"Mappings\",\n};\n\ninterface ConfirmMappingImportProps {\n sourceiModelId: string;\n selectedMappings: IMappingTyped[];\n importing: boolean;\n setImporting: React.Dispatch<React.SetStateAction<boolean>>;\n setSelectedMappings: React.Dispatch<React.SetStateAction<IMappingTyped[]>>;\n backFn: () => void;\n onCancel: () => void;\n onFinish: () => void;\n displayStrings?: Partial<typeof defaultDisplayStrings>;\n}\n\nconst ConfirmMappingImport = ({\n sourceiModelId,\n selectedMappings,\n importing,\n setImporting,\n setSelectedMappings,\n backFn,\n onCancel,\n onFinish,\n displayStrings: userDisplayStrings,\n}: ConfirmMappingImportProps) => {\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n\n const [importCount, setImportCount] = useState<number>(0);\n const [currentlyImporting, setCurrentlyImporting] = useState<string>(\"\");\n const [validator, showValidationMessage] = useValidator();\n const [errored, setErrored] = useState<boolean>(false);\n\n const displayStrings = React.useMemo(\n () => ({ ...defaultDisplayStrings, ...userDisplayStrings }),\n [userDisplayStrings]\n );\n\n useEffect(() => {\n setSelectedMappings((selectedMappings) =>\n selectedMappings.map((mapping) => ({\n ...mapping,\n mappingName: `${mapping.mappingName}_Copy`,\n })),\n );\n }, [setSelectedMappings]);\n\n const handleChange = (\n e: React.ChangeEvent<HTMLInputElement>,\n index: number,\n ) => {\n const newState = [...selectedMappings];\n newState[index] = {\n ...newState[index],\n mappingName: e.target.value,\n };\n setSelectedMappings(newState);\n };\n\n const onImport = async () => {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n setImporting(true);\n try {\n for (const selectedMapping of selectedMappings) {\n setCurrentlyImporting(selectedMapping.mappingName ?? \"\");\n const accessToken = await getAccessToken();\n await mappingClient.copyMapping(\n accessToken,\n sourceiModelId,\n selectedMapping.id ?? \"\",\n {\n targetIModelId: iModelId ?? \"\",\n mappingName: selectedMapping.mappingName ?? \"\",\n },\n );\n setImportCount((importCount) => importCount + 1);\n }\n } catch (error: any) {\n handleError(error);\n setErrored(true);\n }\n };\n\n return (\n <>\n {importing ? (\n <div className='gmw-import-progress-container'>\n <div className='gmw-import-progress-bar'>\n <div className='gmw-import-progress-bar-description'>\n {\n !errored ? importCount !== selectedMappings.length ? (\n <>\n <Text variant='title'>Importing</Text>\n <Text>{`We are currently importing the ${displayStrings.mappings.toLocaleLowerCase()}.`}</Text>\n </>\n ) : (\n <>\n <Text variant='title'>Done!</Text>\n <Text>{`Your imported ${displayStrings.mappings.toLocaleLowerCase()} are ready.`}</Text>\n </>\n ) :\n <>\n <Text variant='title'>Error!</Text>\n <Text>{`Sorry, there was an error importing some or all ${displayStrings.mappings}.`}</Text>\n </>}\n </div>\n <ProgressLinear\n value={(importCount / selectedMappings.length) * 100}\n labels={\n importCount === selectedMappings.length\n ? [\"Import done!\", <SvgStatusSuccessHollow key='0' />]\n : [\n <>\n <Text>Copying</Text>\n <MiddleTextTruncation text={currentlyImporting} />\n </>,\n `${importCount}/${selectedMappings.length}`,\n ]\n }\n status={\n !errored ?\n importCount === selectedMappings.length ? \"positive\" : undefined : \"negative\"\n }\n />\n </div>\n <div className='gmw-import-action-panel'>\n <Button\n disabled={!errored && importCount !== selectedMappings.length}\n onClick={() => {\n setImporting(false);\n setImportCount(0);\n setCurrentlyImporting(\"\");\n setErrored(false);\n }}\n >\n Back\n </Button>\n <Button\n styleType='high-visibility'\n disabled={!errored && importCount !== selectedMappings.length}\n onClick={() => onFinish()}\n >\n Close\n </Button>\n </div>\n </div>\n ) : (\n <div className='gmw-rename-confirm-container '>\n <div className='gmw-mapping-rename-container'>\n <div className='gmw-mapping-row-header-container'>\n <div className='gmw-mapping-row'>\n <Text variant='leading'>{displayStrings.mappings}</Text>\n <Text variant='leading'>Description</Text>\n </div>\n </div>\n <div className='gmw-mapping-row-body'>\n {selectedMappings.map((mapping, index) => (\n <div className='gmw-mapping-row-container' key={mapping.id}>\n <div className='gmw-mapping-row'>\n <LabeledInput\n value={mapping.mappingName}\n name={`mapping_${mapping.id}`}\n required\n onChange={(event) => {\n handleChange(event, index);\n validator.showMessageFor(`mapping_${mapping.id}`);\n }}\n message={validator.message(\n `mapping_${mapping.id}`,\n mapping.mappingName,\n NAME_REQUIREMENTS,\n )}\n status={\n validator.message(\n `mapping_${mapping.id}`,\n mapping.mappingName,\n NAME_REQUIREMENTS,\n )\n ? \"negative\"\n : undefined\n }\n onBlur={() => {\n validator.showMessageFor(`mapping_${mapping.id}`);\n }}\n onBlurCapture={(event) => {\n handleChange(event, index);\n validator.showMessageFor(`mapping_${mapping.id}`);\n }}\n />\n <div>{mapping.description}</div>\n </div>\n <div className='gmw-border-div' />\n </div>\n ))}\n </div>\n </div>\n <div className='gmw-import-action-panel'>\n <Button onClick={backFn}>Back</Button>\n <Button styleType='high-visibility' onClick={async () => onImport()}>\n Import\n </Button>\n <Button onClick={onCancel}>Cancel</Button>\n </div>\n </div>\n )}\n </>\n );\n};\n\nexport default ConfirmMappingImport;\n"]}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "./CalculatedPropertyAction.scss";
|
|
3
|
-
import type { ICustomCalculationTyped } from "./CustomCalculationTable";
|
|
4
3
|
import "./CustomCalculationAction.scss";
|
|
5
|
-
import type {
|
|
6
|
-
interface
|
|
7
|
-
iModelId: string;
|
|
4
|
+
import type { CustomCalculation } from "@itwin/insights-client";
|
|
5
|
+
export interface CustomCalculationActionProps {
|
|
8
6
|
mappingId: string;
|
|
9
7
|
groupId: string;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
customCalculation?: CustomCalculation;
|
|
9
|
+
onSaveSuccess: () => void;
|
|
10
|
+
onClickCancel?: () => void;
|
|
13
11
|
}
|
|
14
|
-
declare const CustomCalculationAction: ({
|
|
15
|
-
export default CustomCalculationAction;
|
|
12
|
+
export declare const CustomCalculationAction: ({ mappingId, groupId, customCalculation, onSaveSuccess, onClickCancel, }: CustomCalculationActionProps) => JSX.Element;
|
|
16
13
|
//# sourceMappingURL=CustomCalculationAction.d.ts.map
|
|
@@ -22,6 +22,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.CustomCalculationAction = void 0;
|
|
25
26
|
/*---------------------------------------------------------------------------------------------
|
|
26
27
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
27
28
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -38,17 +39,84 @@ const useFormulaValidation_1 = require("../hooks/useFormulaValidation");
|
|
|
38
39
|
const MappingClientContext_1 = require("./context/MappingClientContext");
|
|
39
40
|
const GroupingApiConfigContext_1 = require("./context/GroupingApiConfigContext");
|
|
40
41
|
const insights_client_1 = require("@itwin/insights-client");
|
|
41
|
-
const
|
|
42
|
+
const PropertiesContext_1 = require("./context/PropertiesContext");
|
|
43
|
+
const stringToPossibleDataType = (str) => {
|
|
44
|
+
switch (str === null || str === void 0 ? void 0 : str.toLowerCase()) {
|
|
45
|
+
case "double":
|
|
46
|
+
case "number": return "Number";
|
|
47
|
+
case "string": return "String";
|
|
48
|
+
case "boolean": return "Boolean";
|
|
49
|
+
default: return "Undefined";
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const convertToPropertyMap = (groupProperties, calculatedProperties, customCalculations, selectedPropertyName) => {
|
|
53
|
+
const map = {};
|
|
54
|
+
const selectedLowerName = selectedPropertyName === null || selectedPropertyName === void 0 ? void 0 : selectedPropertyName.toLowerCase();
|
|
55
|
+
groupProperties.forEach((p) => {
|
|
56
|
+
var _a;
|
|
57
|
+
const lowerName = (_a = p.propertyName) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
58
|
+
if (lowerName && lowerName !== selectedLowerName)
|
|
59
|
+
map[lowerName] = stringToPossibleDataType(p.dataType);
|
|
60
|
+
});
|
|
61
|
+
calculatedProperties.forEach((p) => {
|
|
62
|
+
var _a;
|
|
63
|
+
const lowerName = (_a = p.propertyName) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
64
|
+
if (lowerName)
|
|
65
|
+
map[lowerName] = "Number";
|
|
66
|
+
});
|
|
67
|
+
customCalculations.forEach((p) => {
|
|
68
|
+
var _a;
|
|
69
|
+
const lowerName = (_a = p.propertyName) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
70
|
+
if (lowerName && lowerName !== selectedLowerName)
|
|
71
|
+
map[lowerName] = stringToPossibleDataType(p.dataType);
|
|
72
|
+
});
|
|
73
|
+
return map;
|
|
74
|
+
};
|
|
75
|
+
const CustomCalculationAction = ({ mappingId, groupId, customCalculation, onSaveSuccess, onClickCancel, }) => {
|
|
42
76
|
var _a, _b, _c;
|
|
43
|
-
const { getAccessToken } = GroupingApiConfigContext_1.useGroupingMappingApiConfig();
|
|
77
|
+
const { getAccessToken, iModelId } = GroupingApiConfigContext_1.useGroupingMappingApiConfig();
|
|
44
78
|
const mappingClient = MappingClientContext_1.useMappingClient();
|
|
45
79
|
const [propertyName, setPropertyName] = react_1.useState((_a = customCalculation === null || customCalculation === void 0 ? void 0 : customCalculation.propertyName) !== null && _a !== void 0 ? _a : "");
|
|
46
80
|
const [formula, setFormula] = react_1.useState((_b = customCalculation === null || customCalculation === void 0 ? void 0 : customCalculation.formula) !== null && _b !== void 0 ? _b : "");
|
|
81
|
+
const { groupProperties, setGroupProperties, calculatedProperties, setCalculatedProperties, customCalculationProperties, setCustomCalculationProperties, } = PropertiesContext_1.usePropertiesContext();
|
|
47
82
|
const [quantityType, setQuantityType] = react_1.useState((_c = customCalculation === null || customCalculation === void 0 ? void 0 : customCalculation.quantityType) !== null && _c !== void 0 ? _c : insights_client_1.QuantityType.Undefined);
|
|
48
|
-
const [isLoading, setIsLoading] = react_1.useState(
|
|
83
|
+
const [isLoading, setIsLoading] = react_1.useState(true);
|
|
49
84
|
const [formulaErrorMessage, setFormulaErrorMessage] = react_1.useState("");
|
|
50
85
|
const [validator, showValidationMessage] = useValidator_1.default();
|
|
86
|
+
const [properties, setProperties] = react_1.useState({});
|
|
51
87
|
const { isValid, forceValidation } = useFormulaValidation_1.useFormulaValidation(propertyName.toLowerCase(), formula, properties, setFormulaErrorMessage);
|
|
88
|
+
const initialize = react_1.useCallback(async () => {
|
|
89
|
+
const accessToken = await getAccessToken();
|
|
90
|
+
const [groupProps, calcProps, customCalcProps] = await Promise.all([
|
|
91
|
+
mappingClient.getGroupProperties(accessToken, iModelId, mappingId, groupId),
|
|
92
|
+
mappingClient.getCalculatedProperties(accessToken, iModelId, mappingId, groupId),
|
|
93
|
+
mappingClient.getCustomCalculations(accessToken, iModelId, mappingId, groupId),
|
|
94
|
+
]);
|
|
95
|
+
setGroupProperties(groupProps);
|
|
96
|
+
setCalculatedProperties(calcProps);
|
|
97
|
+
setCustomCalculationProperties(customCalcProps);
|
|
98
|
+
}, [getAccessToken, groupId, iModelId, mappingClient, mappingId, setCalculatedProperties, setCustomCalculationProperties, setGroupProperties]);
|
|
99
|
+
const fetchAllProperties = react_1.useCallback(async () => {
|
|
100
|
+
setIsLoading(true);
|
|
101
|
+
try {
|
|
102
|
+
if (!groupProperties || !calculatedProperties || !customCalculationProperties) {
|
|
103
|
+
await initialize();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
utils_1.handleError(error.status);
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
setIsLoading(false);
|
|
111
|
+
}
|
|
112
|
+
}, [calculatedProperties, customCalculationProperties, groupProperties, initialize]);
|
|
113
|
+
react_1.useEffect(() => {
|
|
114
|
+
const propertiesMap = convertToPropertyMap(groupProperties !== null && groupProperties !== void 0 ? groupProperties : [], calculatedProperties !== null && calculatedProperties !== void 0 ? calculatedProperties : [], customCalculationProperties !== null && customCalculationProperties !== void 0 ? customCalculationProperties : []);
|
|
115
|
+
setProperties(propertiesMap);
|
|
116
|
+
}, [calculatedProperties, customCalculationProperties, groupProperties]);
|
|
117
|
+
react_1.useEffect(() => {
|
|
118
|
+
void fetchAllProperties();
|
|
119
|
+
}, [fetchAllProperties]);
|
|
52
120
|
const onSave = async () => {
|
|
53
121
|
if (!validator.allValid()) {
|
|
54
122
|
showValidationMessage(true);
|
|
@@ -71,7 +139,10 @@ const CustomCalculationAction = ({ iModelId, mappingId, groupId, properties, cus
|
|
|
71
139
|
formula,
|
|
72
140
|
quantityType,
|
|
73
141
|
});
|
|
74
|
-
|
|
142
|
+
onSaveSuccess();
|
|
143
|
+
setPropertyName("");
|
|
144
|
+
setFormula("");
|
|
145
|
+
setQuantityType(insights_client_1.QuantityType.Undefined);
|
|
75
146
|
}
|
|
76
147
|
catch (error) {
|
|
77
148
|
// error instanceof Response refuses to be true when it should be.
|
|
@@ -86,13 +157,12 @@ const CustomCalculationAction = ({ iModelId, mappingId, groupId, properties, cus
|
|
|
86
157
|
else {
|
|
87
158
|
utils_1.handleError(error.status);
|
|
88
159
|
}
|
|
160
|
+
}
|
|
161
|
+
finally {
|
|
89
162
|
setIsLoading(false);
|
|
90
163
|
}
|
|
91
164
|
};
|
|
92
165
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
93
|
-
react_1.default.createElement(utils_1.WidgetHeader, { title: customCalculation
|
|
94
|
-
? `${customCalculation.propertyName}`
|
|
95
|
-
: "Create Custom Calculation", returnFn: async () => returnFn(false) }),
|
|
96
166
|
react_1.default.createElement("div", { className: 'gmw-custom-calculation-action-container' },
|
|
97
167
|
react_1.default.createElement(itwinui_react_1.Fieldset, { legend: 'Custom Calculation Details', className: 'gmw-details-form' },
|
|
98
168
|
react_1.default.createElement(itwinui_react_1.Small, { className: 'gmw-field-legend' }, "Asterisk * indicates mandatory fields."),
|
|
@@ -111,7 +181,7 @@ const CustomCalculationAction = ({ iModelId, mappingId, groupId, properties, cus
|
|
|
111
181
|
setFormula(event.target.value);
|
|
112
182
|
}, message: formulaErrorMessage, status: formulaErrorMessage ? "negative" : undefined }),
|
|
113
183
|
react_1.default.createElement(itwinui_react_1.LabeledSelect, { label: 'Quantity Type', disabled: isLoading, options: GroupPropertyAction_1.quantityTypesSelectionOptions, value: quantityType, onChange: setQuantityType, onShow: () => { }, onHide: () => { } }))),
|
|
114
|
-
react_1.default.createElement(ActionPanel_1.default, { onSave: onSave, onCancel:
|
|
184
|
+
react_1.default.createElement(ActionPanel_1.default, { onSave: onSave, onCancel: onClickCancel, isSavingDisabled: !(formula && propertyName && isValid), isLoading: isLoading })));
|
|
115
185
|
};
|
|
116
|
-
exports.
|
|
186
|
+
exports.CustomCalculationAction = CustomCalculationAction;
|
|
117
187
|
//# sourceMappingURL=CustomCalculationAction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomCalculationAction.js","sourceRoot":"","sources":["../../../../src/widget/components/CustomCalculationAction.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAM8B;AAC9B,+CAAwC;AACxC,gEAAwC;AACxC,sEAAwE;AACxE,mCAAoD;AACpD,2CAAyC;AAEzC,0CAAwC;AACxC,+DAAsE;AACtE,wEAAqE;AAErE,yEAAkE;AAClE,iFAAiF;AACjF,4DAAsD;AAWtD,MAAM,uBAAuB,GAAG,CAAC,EAC/B,QAAQ,EACR,SAAS,EACT,OAAO,EACP,UAAU,EACV,iBAAiB,EACjB,QAAQ,GACsB,EAAE,EAAE;;IAClC,MAAM,EAAE,cAAc,EAAE,GAAG,sDAA2B,EAAE,CAAC;IACzD,MAAM,aAAa,GAAG,uCAAgB,EAAE,CAAC;IACzC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,gBAAQ,CAC9C,MAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,YAAY,mCAAI,EAAE,CACtC,CAAC;IACF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,gBAAQ,CACpC,MAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,OAAO,mCAAI,EAAE,CACjC,CAAC;IACF,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,gBAAQ,CAAe,MAAA,iBAA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CAAC;wBACxD,CAAC,CAAC,UAAU;wBACZ,CAAC,CAAC,SAAS,EAEf,MAAM,EAAE,GAAG,EAAE;wBACX,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;oBACnC,CAAC,EACD,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE;wBACvB,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;wBACpC,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;oBACnC,CAAC,GACD;gBACF,8BAAC,+BAAe,IACd,KAAK,EAAE,OAAO,EACd,QAAQ,QACR,IAAI,EAAC,SAAS,EACd,KAAK,EAAC,SAAS,EACf,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;wBAClB,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;oBACjC,CAAC,EACD,OAAO,EAAE,mBAAmB,EAC5B,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,GACpD;gBACF,8BAAC,6BAAa,IACZ,KAAK,EAAC,eAAe,EACrB,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,mDAA6B,EACtC,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,EACjB,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,GACjB,CACO,CACP;QACN,8BAAC,qBAAW,IACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,KAAK,IAAI,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,EACrC,gBAAgB,EAAE,CAAC,CAAC,OAAO,IAAI,YAAY,IAAI,OAAO,CAAC,EACvD,SAAS,EAAE,SAAS,GACpB,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,uBAAuB,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 Fieldset,\n LabeledInput,\n LabeledSelect,\n LabeledTextarea,\n Small,\n} from \"@itwin/itwinui-react\";\nimport React, { useState } from \"react\";\nimport ActionPanel from \"./ActionPanel\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport { handleError, WidgetHeader } from \"./utils\";\nimport \"./CalculatedPropertyAction.scss\";\nimport type { ICustomCalculationTyped } from \"./CustomCalculationTable\";\nimport \"./CustomCalculationAction.scss\";\nimport { quantityTypesSelectionOptions } from \"./GroupPropertyAction\";\nimport { useFormulaValidation } from \"../hooks/useFormulaValidation\";\nimport type { PropertyMap } from \"../../formula/Types\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport { QuantityType } from \"@itwin/insights-client\";\n\ninterface CalculatedPropertyActionProps {\n iModelId: string;\n mappingId: string;\n groupId: string;\n properties: PropertyMap;\n customCalculation?: ICustomCalculationTyped;\n returnFn: (modified: boolean) => Promise<void>;\n}\n\nconst CustomCalculationAction = ({\n iModelId,\n mappingId,\n groupId,\n properties,\n customCalculation,\n returnFn,\n}: CalculatedPropertyActionProps) => {\n const { getAccessToken } = 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 [isLoading, setIsLoading] = useState<boolean>(false);\n const [formulaErrorMessage, setFormulaErrorMessage] = useState<string>(\"\");\n const [validator, showValidationMessage] = useValidator();\n const { isValid, forceValidation } = useFormulaValidation(propertyName.toLowerCase(), formula, properties, setFormulaErrorMessage);\n\n const onSave = async () => {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n if (!forceValidation()) {\n return;\n }\n try {\n setIsLoading(true);\n const accessToken = await getAccessToken();\n customCalculation\n ? await mappingClient.updateCustomCalculation(\n accessToken,\n iModelId,\n mappingId,\n groupId,\n customCalculation.id,\n {\n propertyName,\n formula,\n quantityType,\n }\n )\n : await mappingClient.createCustomCalculation(\n accessToken,\n iModelId,\n mappingId,\n groupId,\n {\n propertyName,\n formula,\n quantityType,\n }\n );\n await returnFn(true);\n } catch (error: any) {\n // error instanceof Response refuses to be true when it should be.\n if (error.status === 422) {\n error = error as Response;\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 setIsLoading(false);\n }\n };\n\n return (\n <>\n <WidgetHeader\n title={\n customCalculation\n ? `${customCalculation.propertyName}`\n : \"Create Custom Calculation\"\n }\n returnFn={async () => returnFn(false)}\n />\n <div className='gmw-custom-calculation-action-container'>\n <Fieldset legend='Custom Calculation Details' className='gmw-details-form'>\n <Small className='gmw-field-legend'>\n Asterisk * indicates mandatory fields.\n </Small>\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 <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 />\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={async () => returnFn(false)}\n isSavingDisabled={!(formula && propertyName && isValid)}\n isLoading={isLoading}\n />\n </>\n );\n};\n\nexport default CustomCalculationAction;\n"]}
|
|
1
|
+
{"version":3,"file":"CustomCalculationAction.js","sourceRoot":"","sources":["../../../../src/widget/components/CustomCalculationAction.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAM8B;AAC9B,+CAAgE;AAChE,gEAAwC;AACxC,sEAAwE;AACxE,mCAAsC;AACtC,2CAAyC;AACzC,0CAAwC;AACxC,+DAAsE;AACtE,wEAAqE;AAErE,yEAAkE;AAClE,iFAAiF;AAEjF,4DAAsD;AACtD,mEAAmE;AAUnE,MAAM,wBAAwB,GAAG,CAAC,GAAY,EAAoB,EAAE;IAClE,QAAQ,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,WAAW,EAAE,EAAE;QAC1B,KAAK,QAAQ,CAAC;QACd,KAAK,QAAQ,CAAC,CAAC,OAAO,QAAQ,CAAC;QAC/B,KAAK,QAAQ,CAAC,CAAC,OAAO,QAAQ,CAAC;QAC/B,KAAK,SAAS,CAAC,CAAC,OAAO,SAAS,CAAC;QACjC,OAAO,CAAC,CAAC,OAAO,WAAW,CAAC;KAC7B;AACH,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAC3B,eAAgC,EAChC,oBAA0C,EAC1C,kBAAuC,EACvC,oBAA6B,EAChB,EAAE;IACf,MAAM,GAAG,GAAgB,EAAE,CAAC;IAC5B,MAAM,iBAAiB,GAAG,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,WAAW,EAAE,CAAC;IAE9D,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;;QAC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B,EAC5B,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,GACpD;gBACF,8BAAC,6BAAa,IACZ,KAAK,EAAC,eAAe,EACrB,QAAQ,EAAE,SAAS,EACnB,OAAO,EAAE,mDAA6B,EACtC,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,eAAe,EACzB,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,EACjB,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,GACjB,CACO,CACP;QACN,8BAAC,qBAAW,IACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,aAAa,EACvB,gBAAgB,EAAE,CAAC,CAAC,OAAO,IAAI,YAAY,IAAI,OAAO,CAAC,EACvD,SAAS,EAAE,SAAS,GACpB,CACD,CACJ,CAAC;AACJ,CAAC,CAAC;AAxLW,QAAA,uBAAuB,2BAwLlC","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 Fieldset,\n LabeledInput,\n LabeledSelect,\n LabeledTextarea,\n Small,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useState } from \"react\";\nimport ActionPanel from \"./ActionPanel\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport { handleError } from \"./utils\";\nimport \"./CalculatedPropertyAction.scss\";\nimport \"./CustomCalculationAction.scss\";\nimport { quantityTypesSelectionOptions } from \"./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 { usePropertiesContext } from \"./context/PropertiesContext\";\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 {\n groupProperties,\n setGroupProperties,\n calculatedProperties,\n setCalculatedProperties,\n customCalculationProperties,\n setCustomCalculationProperties,\n } = usePropertiesContext();\n const [quantityType, setQuantityType] = useState<QuantityType>(customCalculation?.quantityType ?? QuantityType.Undefined);\n const [isLoading, setIsLoading] = useState<boolean>(true);\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\n const initialize = useCallback(async () => {\n const accessToken = await getAccessToken();\n const [groupProps, calcProps, customCalcProps] = await Promise.all([\n mappingClient.getGroupProperties(accessToken, iModelId, mappingId, groupId),\n mappingClient.getCalculatedProperties(accessToken, iModelId, mappingId, groupId),\n mappingClient.getCustomCalculations(accessToken, iModelId, mappingId, groupId),\n ]);\n setGroupProperties(groupProps);\n setCalculatedProperties(calcProps);\n setCustomCalculationProperties(customCalcProps);\n }, [getAccessToken, groupId, iModelId, mappingClient, mappingId, setCalculatedProperties, setCustomCalculationProperties, setGroupProperties]);\n\n const fetchAllProperties = useCallback(async () => {\n setIsLoading(true);\n try {\n if (!groupProperties || !calculatedProperties || !customCalculationProperties) {\n await initialize();\n }\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n }, [calculatedProperties, customCalculationProperties, groupProperties, initialize]);\n\n useEffect(() => {\n const propertiesMap = convertToPropertyMap(groupProperties ?? [], calculatedProperties ?? [], customCalculationProperties ?? []);\n setProperties(propertiesMap);\n }, [calculatedProperties, customCalculationProperties, groupProperties]);\n\n useEffect(() => {\n void fetchAllProperties();\n }, [fetchAllProperties]);\n\n const onSave = async () => {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n if (!forceValidation()) {\n return;\n }\n try {\n setIsLoading(true);\n const accessToken = await getAccessToken();\n customCalculation\n ? await mappingClient.updateCustomCalculation(\n accessToken,\n iModelId,\n mappingId,\n groupId,\n customCalculation.id,\n {\n propertyName,\n formula,\n quantityType,\n }\n )\n : await mappingClient.createCustomCalculation(\n accessToken,\n iModelId,\n mappingId,\n groupId,\n {\n propertyName,\n formula,\n quantityType,\n }\n );\n onSaveSuccess();\n setPropertyName(\"\");\n setFormula(\"\");\n setQuantityType(QuantityType.Undefined);\n } catch (error: any) {\n // error instanceof Response refuses to be true when it should be.\n if (error.status === 422) {\n error = error as Response;\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 } finally {\n setIsLoading(false);\n }\n };\n\n return (\n <>\n <div className='gmw-custom-calculation-action-container'>\n <Fieldset legend='Custom Calculation Details' className='gmw-details-form'>\n <Small className='gmw-field-legend'>\n Asterisk * indicates mandatory fields.\n </Small>\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 <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 />\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,21 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import type { CreateTypeFromInterface } from "../utils";
|
|
3
|
-
import { PropertyMenuView } from "./PropertyMenu";
|
|
4
|
-
import type { CellProps } from "react-table";
|
|
1
|
+
/// <reference types="react" />
|
|
5
2
|
import type { CustomCalculation } from "@itwin/insights-client";
|
|
6
|
-
export
|
|
7
|
-
interface CustomCalculationTableProps {
|
|
8
|
-
iModelId: string;
|
|
3
|
+
export interface CustomCalculationTableProps {
|
|
9
4
|
mappingId: string;
|
|
10
5
|
groupId: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
refreshCustomCalculations: () => Promise<void>;
|
|
17
|
-
selectedCustomCalculation?: ICustomCalculationTyped;
|
|
6
|
+
onClickAdd?: () => void;
|
|
7
|
+
onClickModify?: (value: CustomCalculation) => void;
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
customCalculations: CustomCalculation[];
|
|
10
|
+
refresh: () => Promise<void>;
|
|
18
11
|
}
|
|
19
|
-
declare const CustomCalculationTable: ({
|
|
20
|
-
export default CustomCalculationTable;
|
|
12
|
+
export declare const CustomCalculationTable: ({ mappingId, groupId, onClickAdd, onClickModify, isLoading, customCalculations, refresh, }: CustomCalculationTableProps) => JSX.Element;
|
|
21
13
|
//# sourceMappingURL=CustomCalculationTable.d.ts.map
|
|
@@ -18,10 +18,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.CustomCalculationTable = void 0;
|
|
25
23
|
/*---------------------------------------------------------------------------------------------
|
|
26
24
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
27
25
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -29,16 +27,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
27
|
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
30
28
|
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
31
29
|
const react_1 = __importStar(require("react"));
|
|
32
|
-
const PropertyMenu_1 = require("./PropertyMenu");
|
|
33
|
-
const DeleteModal_1 = __importDefault(require("./DeleteModal"));
|
|
34
30
|
const MappingClientContext_1 = require("./context/MappingClientContext");
|
|
31
|
+
const PropertyNameCell_1 = require("./PropertyNameCell");
|
|
32
|
+
const PropertyTable_1 = require("./PropertyTable");
|
|
35
33
|
const GroupingApiConfigContext_1 = require("./context/GroupingApiConfigContext");
|
|
36
|
-
const CustomCalculationTable = ({
|
|
37
|
-
var _a;
|
|
38
|
-
const { getAccessToken } = GroupingApiConfigContext_1.useGroupingMappingApiConfig();
|
|
34
|
+
const CustomCalculationTable = ({ mappingId, groupId, onClickAdd, onClickModify, isLoading, customCalculations, refresh, }) => {
|
|
39
35
|
const mappingClient = MappingClientContext_1.useMappingClient();
|
|
40
|
-
const
|
|
41
|
-
const
|
|
36
|
+
const { getAccessToken, iModelId } = GroupingApiConfigContext_1.useGroupingMappingApiConfig();
|
|
37
|
+
const columnsFactory = react_1.useCallback((handleShowDeleteModal) => [
|
|
42
38
|
{
|
|
43
39
|
Header: "Table",
|
|
44
40
|
columns: [
|
|
@@ -46,7 +42,7 @@ const CustomCalculationTable = ({ iModelId, mappingId, groupId, setSelectedCusto
|
|
|
46
42
|
id: "propertyName",
|
|
47
43
|
Header: "Custom Calculation",
|
|
48
44
|
accessor: "propertyName",
|
|
49
|
-
Cell: (value) => (react_1.default.createElement(
|
|
45
|
+
Cell: (value) => (react_1.default.createElement(PropertyNameCell_1.PropertyNameCell, { property: value.row.original, onClickModify: onClickModify })),
|
|
50
46
|
},
|
|
51
47
|
{
|
|
52
48
|
id: "formula",
|
|
@@ -58,14 +54,16 @@ const CustomCalculationTable = ({ iModelId, mappingId, groupId, setSelectedCusto
|
|
|
58
54
|
Header: "",
|
|
59
55
|
width: 80,
|
|
60
56
|
Cell: (value) => {
|
|
61
|
-
return (react_1.default.createElement(itwinui_react_1.DropdownMenu, { menuItems: (close) => [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
return (react_1.default.createElement(itwinui_react_1.DropdownMenu, { menuItems: (close) => [onClickModify ? [
|
|
58
|
+
react_1.default.createElement(itwinui_react_1.MenuItem, { key: 0, onClick: () => {
|
|
59
|
+
onClickModify(value.row.original);
|
|
60
|
+
close();
|
|
61
|
+
}, icon: react_1.default.createElement(itwinui_icons_react_1.SvgEdit, null) }, "Modify")
|
|
62
|
+
] : [], react_1.default.createElement(itwinui_react_1.MenuItem, { key: 1, onClick: () => {
|
|
63
|
+
handleShowDeleteModal(value.row.original);
|
|
66
64
|
close();
|
|
67
65
|
}, icon: react_1.default.createElement(itwinui_icons_react_1.SvgDelete, null) }, "Remove"),
|
|
68
|
-
] },
|
|
66
|
+
].flatMap((p) => p) },
|
|
69
67
|
react_1.default.createElement(itwinui_react_1.IconButton, { styleType: 'borderless' },
|
|
70
68
|
react_1.default.createElement(itwinui_icons_react_1.SvgMore, { style: {
|
|
71
69
|
width: "16px",
|
|
@@ -75,17 +73,12 @@ const CustomCalculationTable = ({ iModelId, mappingId, groupId, setSelectedCusto
|
|
|
75
73
|
},
|
|
76
74
|
],
|
|
77
75
|
},
|
|
78
|
-
], [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
react_1.default.createElement(DeleteModal_1.default, { entityName: (_a = selectedCustomCalculation === null || selectedCustomCalculation === void 0 ? void 0 : selectedCustomCalculation.propertyName) !== null && _a !== void 0 ? _a : "", show: showCustomCalculationDeleteModal, setShow: setShowCustomCalculationDeleteModal, onDelete: async () => {
|
|
85
|
-
var _a;
|
|
86
|
-
const accessToken = await getAccessToken();
|
|
87
|
-
await mappingClient.deleteCustomCalculation(accessToken, iModelId, mappingId, groupId, (_a = selectedCustomCalculation === null || selectedCustomCalculation === void 0 ? void 0 : selectedCustomCalculation.id) !== null && _a !== void 0 ? _a : "");
|
|
88
|
-
}, refresh: refreshCustomCalculations })));
|
|
76
|
+
], [onClickModify]);
|
|
77
|
+
const deleteProperty = react_1.useCallback(async (propertyId) => {
|
|
78
|
+
const accessToken = await getAccessToken();
|
|
79
|
+
await mappingClient.deleteCustomCalculation(accessToken, iModelId, mappingId, groupId, propertyId);
|
|
80
|
+
}, [getAccessToken, groupId, iModelId, mappingClient, mappingId]);
|
|
81
|
+
return (react_1.default.createElement(PropertyTable_1.PropertyTable, { propertyType: "Custom Calculation", columnsFactory: columnsFactory, data: customCalculations, isLoading: isLoading, onClickAdd: onClickAdd, refreshProperties: refresh, deleteProperty: deleteProperty }));
|
|
89
82
|
};
|
|
90
|
-
exports.
|
|
83
|
+
exports.CustomCalculationTable = CustomCalculationTable;
|
|
91
84
|
//# sourceMappingURL=CustomCalculationTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomCalculationTable.js","sourceRoot":"","sources":["../../../../src/widget/components/CustomCalculationTable.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CustomCalculationTable.js","sourceRoot":"","sources":["../../../../src/widget/components/CustomCalculationTable.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,oEAIoC;AACpC,wDAI8B;AAC9B,+CAA2C;AAG3C,yEAAkE;AAClE,yDAAsD;AACtD,mDAAgD;AAChD,iFAAiF;AAY1E,MAAM,sBAAsB,GAAG,CAAC,EACrC,SAAS,EACT,OAAO,EACP,UAAU,EACV,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,OAAO,GACqB,EAAE,EAAE;IAChC,MAAM,aAAa,GAAG,uCAAgB,EAAE,CAAC;IACzC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,GAAG,sDAA2B,EAAE,CAAC;IAEnE,MAAM,cAAc,GAAG,mBAAW,CAChC,CAAC,qBAAyD,EAAE,EAAE,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N,KAAK,EAAE;wCACL,KAAK,EAAE,MAAM;wCACb,MAAM,EAAE,MAAM;qCACf,GACD,CACS,CACA,CAChB,CAAC;oBACJ,CAAC;iBACF;aACF;SACF;KACF,EACD,CAAC,aAAa,CAAC,CAChB,CAAC;IAEF,MAAM,cAAc,GAAG,mBAAW,CAAC,KAAK,EAAE,UAAkB,EAAE,EAAE;QAC9D,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;QAC3C,MAAM,aAAa,CAAC,uBAAuB,CACzC,WAAW,EACX,QAAQ,EACR,SAAS,EACT,OAAO,EACP,UAAU,CACX,CAAC;IACJ,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC;IAElE,OAAO,CACL,8BAAC,6BAAa,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;AAvGW,QAAA,sBAAsB,0BAuGjC","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 SvgDelete,\n SvgEdit,\n SvgMore,\n} from \"@itwin/itwinui-icons-react\";\nimport {\n DropdownMenu,\n IconButton,\n MenuItem,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback } from \"react\";\nimport type { CellProps } from \"react-table\";\nimport type { CustomCalculation } from \"@itwin/insights-client\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport { PropertyNameCell } from \"./PropertyNameCell\";\nimport { PropertyTable } from \"./PropertyTable\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\n\nexport interface CustomCalculationTableProps {\n mappingId: string;\n groupId: string;\n onClickAdd?: () => void;\n onClickModify?: (value: CustomCalculation) => void;\n isLoading: boolean;\n customCalculations: CustomCalculation[];\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 mappingClient = useMappingClient();\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n\n const columnsFactory = useCallback(\n (handleShowDeleteModal: (value: CustomCalculation) => void) => [\n {\n Header: \"Table\",\n columns: [\n {\n id: \"propertyName\",\n Header: \"Custom Calculation\",\n accessor: \"propertyName\",\n Cell: (value: CellProps<CustomCalculation>) => (\n <PropertyNameCell\n property={value.row.original}\n onClickModify={onClickModify}\n />\n ),\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<CustomCalculation>) => {\n return (\n <DropdownMenu\n menuItems={(close: () => void) => [onClickModify ? [\n <MenuItem\n key={0}\n onClick={() => {\n onClickModify(value.row.original);\n close();\n }}\n icon={<SvgEdit />}\n >\n Modify\n </MenuItem>] : [],\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 <IconButton styleType='borderless'>\n <SvgMore\n style={{\n width: \"16px\",\n height: \"16px\",\n }}\n />\n </IconButton>\n </DropdownMenu>\n );\n },\n },\n ],\n },\n ],\n [onClickModify],\n );\n\n const deleteProperty = useCallback(async (propertyId: string) => {\n const accessToken = await getAccessToken();\n await mappingClient.deleteCustomCalculation(\n accessToken,\n iModelId,\n mappingId,\n groupId,\n propertyId,\n );\n }, [getAccessToken, groupId, iModelId, mappingClient, mappingId]);\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\n"]}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import "./DeleteModal.scss";
|
|
3
3
|
export interface DeleteModalProps {
|
|
4
|
-
entityName
|
|
5
|
-
|
|
6
|
-
setShow: React.Dispatch<React.SetStateAction<boolean>>;
|
|
4
|
+
entityName?: string;
|
|
5
|
+
onClose: () => void;
|
|
7
6
|
onDelete: () => Promise<void>;
|
|
8
7
|
refresh: () => Promise<void>;
|
|
9
8
|
}
|
|
10
|
-
export declare const DeleteModal: ({ entityName,
|
|
9
|
+
export declare const DeleteModal: ({ entityName, onClose, onDelete, refresh, }: DeleteModalProps) => JSX.Element;
|
|
11
10
|
export default DeleteModal;
|
|
12
11
|
//# sourceMappingURL=DeleteModal.d.ts.map
|
|
@@ -28,37 +28,33 @@ const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
29
|
require("./DeleteModal.scss");
|
|
30
30
|
const utils_1 = require("./utils");
|
|
31
|
-
const DeleteModal = ({ entityName,
|
|
32
|
-
const [
|
|
31
|
+
const DeleteModal = ({ entityName, onClose, onDelete, refresh, }) => {
|
|
32
|
+
const [isDeleting, setIsDeleting] = react_1.useState(false);
|
|
33
33
|
const deleteCallback = async () => {
|
|
34
34
|
try {
|
|
35
|
-
|
|
35
|
+
setIsDeleting(true);
|
|
36
36
|
await onDelete();
|
|
37
|
-
setShow(false);
|
|
38
37
|
await refresh();
|
|
38
|
+
onClose();
|
|
39
39
|
}
|
|
40
40
|
catch (error) {
|
|
41
41
|
utils_1.handleError(error.status);
|
|
42
42
|
}
|
|
43
43
|
finally {
|
|
44
|
-
|
|
44
|
+
setIsDeleting(false);
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
48
|
-
react_1.default.createElement(itwinui_react_1.Modal, { title: 'Confirm', modalRootId: 'grouping-mapping-widget', isOpen:
|
|
49
|
-
setShow(false);
|
|
50
|
-
} },
|
|
48
|
+
react_1.default.createElement(itwinui_react_1.Modal, { title: 'Confirm', modalRootId: 'grouping-mapping-widget', isOpen: !!entityName, isDismissible: !isDeleting, onClose: onClose },
|
|
51
49
|
react_1.default.createElement("div", { className: "gmw-delete-modal-body-text" },
|
|
52
50
|
react_1.default.createElement(itwinui_react_1.Leading, null, "Are you sure you want to delete"),
|
|
53
51
|
react_1.default.createElement("strong", null, react_1.default.createElement(itwinui_react_1.MiddleTextTruncation, { text: `${entityName}?` }))),
|
|
54
52
|
react_1.default.createElement(itwinui_react_1.ModalButtonBar, null,
|
|
55
|
-
|
|
53
|
+
isDeleting &&
|
|
56
54
|
react_1.default.createElement("div", { className: "gmw-loading-delete" },
|
|
57
55
|
react_1.default.createElement(utils_1.LoadingSpinner, null)),
|
|
58
|
-
react_1.default.createElement(itwinui_react_1.Button, { styleType: 'high-visibility', onClick: deleteCallback, disabled:
|
|
59
|
-
react_1.default.createElement(itwinui_react_1.Button, { styleType: 'default', onClick:
|
|
60
|
-
setShow(false);
|
|
61
|
-
}, disabled: isLoading }, "Cancel")))));
|
|
56
|
+
react_1.default.createElement(itwinui_react_1.Button, { styleType: 'high-visibility', onClick: deleteCallback, disabled: isDeleting }, "Delete"),
|
|
57
|
+
react_1.default.createElement(itwinui_react_1.Button, { styleType: 'default', onClick: onClose, disabled: isDeleting }, "Cancel")))));
|
|
62
58
|
};
|
|
63
59
|
exports.DeleteModal = DeleteModal;
|
|
64
60
|
exports.default = exports.DeleteModal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeleteModal.js","sourceRoot":"","sources":["../../../../src/widget/components/DeleteModal.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAM8B;AAC9B,+CAAwC;AACxC,8BAA4B;AAC5B,mCAAsD;
|
|
1
|
+
{"version":3,"file":"DeleteModal.js","sourceRoot":"","sources":["../../../../src/widget/components/DeleteModal.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,wDAM8B;AAC9B,+CAAwC;AACxC,8BAA4B;AAC5B,mCAAsD;AAS/C,MAAM,WAAW,GAAG,CAAC,EAC1B,UAAU,EACV,OAAO,EACP,QAAQ,EACR,OAAO,GACU,EAAE,EAAE;IACrB,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,gBAAQ,CAAU,KAAK,CAAC,CAAC;IAE7D,MAAM,cAAc,GAAG,KAAK,IAAI,EAAE;QAChC,IAAI;YACF,aAAa,CAAC,IAAI,CAAC,CAAC;YACpB,MAAM,QAAQ,EAAE,CAAC;YACjB,MAAM,OAAO,EAAE,CAAC;YAChB,OAAO,EAAE,CAAC;SACX;QAAC,OAAO,KAAU,EAAE;YACnB,mBAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SAC3B;gBAAS;YACR,aAAa,CAAC,KAAK,CAAC,CAAC;SACtB;IACH,CAAC,CAAC;IAEF,OAAO,CACL;QACE,8BAAC,qBAAK,IACJ,KAAK,EAAC,SAAS,EACf,WAAW,EAAC,yBAAyB,EACrC,MAAM,EAAE,CAAC,CAAC,UAAU,EACpB,aAAa,EAAE,CAAC,UAAU,EAC1B,OAAO,EAAE,OAAO;YAEhB,uCAAK,SAAS,EAAC,4BAA4B;gBACzC,8BAAC,uBAAO,0CAEE;gBACV,8CACG,8BAAC,oCAAoB,IAAC,IAAI,EAAE,GAAG,UAAU,GAAG,GAAI,CAC1C,CACL;YACN,8BAAC,8BAAc;gBACZ,UAAU;oBACT,uCAAK,SAAS,EAAC,oBAAoB;wBACjC,8BAAC,sBAAc,OAAG,CACd;gBACR,8BAAC,sBAAM,IAAC,SAAS,EAAC,iBAAiB,EAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,UAAU,aAExE;gBACT,8BAAC,sBAAM,IACL,SAAS,EAAC,SAAS,EACnB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,UAAU,aAGb,CACM,CACX,CACP,CACJ,CAAC;AACJ,CAAC,CAAC;AAzDW,QAAA,WAAW,eAyDtB;AAEF,kBAAe,mBAAW,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport {\n Button,\n Leading,\n MiddleTextTruncation,\n Modal,\n ModalButtonBar,\n} from \"@itwin/itwinui-react\";\nimport React, { useState } from \"react\";\nimport \"./DeleteModal.scss\";\nimport { handleError, LoadingSpinner } from \"./utils\";\n\nexport interface DeleteModalProps {\n entityName?: string;\n onClose: () => void;\n onDelete: () => Promise<void>;\n refresh: () => Promise<void>;\n}\n\nexport const DeleteModal = ({\n entityName,\n onClose,\n onDelete,\n refresh,\n}: DeleteModalProps) => {\n const [isDeleting, setIsDeleting] = useState<boolean>(false);\n\n const deleteCallback = async () => {\n try {\n setIsDeleting(true);\n await onDelete();\n await refresh();\n onClose();\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsDeleting(false);\n }\n };\n\n return (\n <>\n <Modal\n title='Confirm'\n modalRootId='grouping-mapping-widget'\n isOpen={!!entityName}\n isDismissible={!isDeleting}\n onClose={onClose}\n >\n <div className=\"gmw-delete-modal-body-text\">\n <Leading>\n Are you sure you want to delete\n </Leading>\n <strong>\n {<MiddleTextTruncation text={`${entityName}?`} />}\n </strong>\n </div>\n <ModalButtonBar>\n {isDeleting &&\n <div className=\"gmw-loading-delete\">\n <LoadingSpinner />\n </div>}\n <Button styleType='high-visibility' onClick={deleteCallback} disabled={isDeleting}>\n Delete\n </Button>\n <Button\n styleType='default'\n onClick={onClose}\n disabled={isDeleting}\n >\n Cancel\n </Button>\n </ModalButtonBar>\n </Modal>\n </>\n );\n};\n\nexport default DeleteModal;\n"]}
|