@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
|
@@ -12,7 +12,6 @@ import { MappingImportWizardModal } from "./MappingImportWizardModal";
|
|
|
12
12
|
import { useMappingClient } from "./context/MappingClientContext";
|
|
13
13
|
import { BlockingOverlay } from "./BlockingOverlay";
|
|
14
14
|
import { HorizontalTile } from "./HorizontalTile";
|
|
15
|
-
import { clearAll } from "./viewerUtils";
|
|
16
15
|
import { useGroupingMappingApiConfig } from "./context/GroupingApiConfigContext";
|
|
17
16
|
const defaultDisplayStrings = {
|
|
18
17
|
mappings: "Mappings",
|
|
@@ -22,7 +21,7 @@ const fetchMappings = async (setMappings, iModelId, setIsLoading, getAccessToken
|
|
|
22
21
|
setIsLoading(true);
|
|
23
22
|
const accessToken = await getAccessToken();
|
|
24
23
|
const mappings = await mappingsClient.getMappings(accessToken, iModelId);
|
|
25
|
-
setMappings(mappings);
|
|
24
|
+
setMappings(mappings.sort((a, b) => a.mappingName.localeCompare(b.mappingName)));
|
|
26
25
|
}
|
|
27
26
|
catch (error) {
|
|
28
27
|
handleError(error.status);
|
|
@@ -44,22 +43,18 @@ const toggleExtraction = async (getAccessToken, mappingsClient, iModelId, mappin
|
|
|
44
43
|
}
|
|
45
44
|
};
|
|
46
45
|
export const Mappings = ({ onClickAddMapping, onClickMappingTitle, onClickMappingModify, displayStrings: userDisplayStrings, }) => {
|
|
47
|
-
var _a;
|
|
48
46
|
const { getAccessToken, iModelId } = useGroupingMappingApiConfig();
|
|
49
47
|
const mappingClient = useMappingClient();
|
|
50
|
-
const [showDeleteModal, setShowDeleteModal] = useState(
|
|
48
|
+
const [showDeleteModal, setShowDeleteModal] = useState(undefined);
|
|
51
49
|
const [showImportModal, setShowImportModal] = useState(false);
|
|
52
50
|
const [showBlockingOverlay, setShowBlockingOverlay] = useState(false);
|
|
53
|
-
const [selectedMapping, setSelectedMapping] = useState(undefined);
|
|
54
51
|
const [isLoading, setIsLoading] = useState(true);
|
|
55
52
|
const [mappings, setMappings] = useState([]);
|
|
56
|
-
const displayStrings = { ...defaultDisplayStrings, ...userDisplayStrings };
|
|
53
|
+
const displayStrings = React.useMemo(() => ({ ...defaultDisplayStrings, ...userDisplayStrings }), [userDisplayStrings]);
|
|
57
54
|
useEffect(() => {
|
|
58
55
|
void fetchMappings(setMappings, iModelId, setIsLoading, getAccessToken, mappingClient);
|
|
59
56
|
}, [getAccessToken, mappingClient, iModelId, setIsLoading]);
|
|
60
57
|
const refresh = useCallback(async () => {
|
|
61
|
-
clearAll();
|
|
62
|
-
setSelectedMapping(undefined);
|
|
63
58
|
setMappings([]);
|
|
64
59
|
await fetchMappings(setMappings, iModelId, setIsLoading, getAccessToken, mappingClient);
|
|
65
60
|
}, [getAccessToken, mappingClient, iModelId, setMappings]);
|
|
@@ -75,15 +70,14 @@ export const Mappings = ({ onClickAddMapping, onClickMappingTitle, onClickMappin
|
|
|
75
70
|
React.createElement(IconButton, { title: "Refresh", onClick: refresh, disabled: isLoading, styleType: 'borderless' },
|
|
76
71
|
React.createElement(SvgRefresh, null))),
|
|
77
72
|
isLoading ? (React.createElement(LoadingOverlay, null)) : mappings.length === 0 ? (React.createElement(EmptyMessage, { message: `No ${displayStrings.mappings} available.` })) : (React.createElement("div", { className: "gmw-mappings-list" }, mappings
|
|
78
|
-
.sort((a, b) => { var _a; return (_a = a.mappingName.localeCompare(b.mappingName)) !== null && _a !== void 0 ? _a : 1; })
|
|
79
73
|
.map((mapping) => {
|
|
80
74
|
var _a, _b;
|
|
81
75
|
return (React.createElement(HorizontalTile, { key: mapping.id, title: mapping.mappingName ? mapping.mappingName : "Untitled", subText: (_a = mapping.description) !== null && _a !== void 0 ? _a : "", subtextToolTip: (_b = mapping.description) !== null && _b !== void 0 ? _b : "", titleTooltip: mapping.mappingName, onClickTitle: () => onClickMappingTitle ? onClickMappingTitle(mapping) : undefined, actionGroup: React.createElement(DropdownMenu, { menuItems: (close) => [
|
|
82
76
|
onClickMappingModify ? (React.createElement(MenuItem, { key: 0, onClick: () => {
|
|
83
77
|
onClickMappingModify(mapping);
|
|
78
|
+
close();
|
|
84
79
|
}, icon: React.createElement(SvgEdit, null) }, "Modify")) : [],
|
|
85
80
|
React.createElement(MenuItem, { key: 1, onClick: async () => {
|
|
86
|
-
setSelectedMapping(mapping);
|
|
87
81
|
setShowBlockingOverlay(true);
|
|
88
82
|
close();
|
|
89
83
|
await toggleExtraction(getAccessToken, mappingClient, iModelId, mapping);
|
|
@@ -93,8 +87,7 @@ export const Mappings = ({ onClickAddMapping, onClickMappingTitle, onClickMappin
|
|
|
93
87
|
? "Disable extraction"
|
|
94
88
|
: "Enable extraction"),
|
|
95
89
|
React.createElement(MenuItem, { key: 2, onClick: () => {
|
|
96
|
-
|
|
97
|
-
setShowDeleteModal(true);
|
|
90
|
+
setShowDeleteModal(mapping);
|
|
98
91
|
close();
|
|
99
92
|
}, icon: React.createElement(SvgDelete, null) }, "Remove"),
|
|
100
93
|
].flatMap((m) => m) },
|
|
@@ -104,10 +97,10 @@ export const Mappings = ({ onClickAddMapping, onClickMappingTitle, onClickMappin
|
|
|
104
97
|
height: "16px",
|
|
105
98
|
} }))) }));
|
|
106
99
|
})))),
|
|
107
|
-
React.createElement(DeleteModal, { entityName:
|
|
100
|
+
React.createElement(DeleteModal, { entityName: showDeleteModal === null || showDeleteModal === void 0 ? void 0 : showDeleteModal.mappingName, onClose: () => setShowDeleteModal(undefined), onDelete: async () => {
|
|
108
101
|
var _a;
|
|
109
102
|
const accessToken = await getAccessToken();
|
|
110
|
-
await mappingClient.deleteMapping(accessToken, iModelId, (_a =
|
|
103
|
+
await mappingClient.deleteMapping(accessToken, iModelId, (_a = showDeleteModal === null || showDeleteModal === void 0 ? void 0 : showDeleteModal.id) !== null && _a !== void 0 ? _a : "");
|
|
111
104
|
}, refresh: refresh }),
|
|
112
105
|
React.createElement(MappingImportWizardModal, { show: showImportModal, setShow: setShowImportModal, onFinish: refresh, displayStrings: displayStrings })));
|
|
113
106
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mapping.js","sourceRoot":"","sources":["../../../../src/widget/components/Mapping.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,SAAS,EACT,OAAO,EACP,UAAU,EACV,UAAU,GACX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,OAAO,GACR,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EACL,YAAY,EACZ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------------------------------------------------------------------------\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 SvgAdd,\n SvgDelete,\n SvgEdit,\n SvgImport,\n SvgMore,\n SvgProcess,\n SvgRefresh,\n} from \"@itwin/itwinui-icons-react\";\nimport {\n Button,\n DropdownMenu,\n IconButton,\n MenuItem,\n Surface,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useState } from \"react\";\nimport {\n EmptyMessage,\n handleError,\n LoadingOverlay,\n} from \"./utils\";\nimport \"./Mapping.scss\";\nimport DeleteModal from \"./DeleteModal\";\nimport { MappingImportWizardModal } from \"./MappingImportWizardModal\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport type { IMappingsClient, Mapping } from \"@itwin/insights-client\";\nimport { BlockingOverlay } from \"./BlockingOverlay\";\nimport { HorizontalTile } from \"./HorizontalTile\";\nimport { clearAll } from \"./viewerUtils\";\nimport type { GetAccessTokenFn } from \"./context/GroupingApiConfigContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport type { CreateTypeFromInterface } from \"../utils\";\n\nexport type IMappingTyped = CreateTypeFromInterface<Mapping>;\n\nconst defaultDisplayStrings = {\n mappings: \"Mappings\",\n};\nexport interface MappingsProps {\n onClickAddMapping?: () => void;\n onClickMappingTitle?: (mapping: Mapping) => void;\n onClickMappingModify?: (mapping: Mapping) => void;\n displayStrings?: Partial<typeof defaultDisplayStrings>;\n}\n\nconst fetchMappings = async (\n setMappings: React.Dispatch<React.SetStateAction<Mapping[]>>,\n iModelId: string,\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>,\n getAccessToken: GetAccessTokenFn,\n mappingsClient: IMappingsClient\n) => {\n try {\n setIsLoading(true);\n const accessToken = await getAccessToken();\n const mappings = await mappingsClient.getMappings(accessToken, iModelId);\n setMappings(mappings);\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n};\n\nconst toggleExtraction = async (\n getAccessToken: GetAccessTokenFn,\n mappingsClient: IMappingsClient,\n iModelId: string,\n mapping: Mapping\n) => {\n try {\n const newState = mapping.extractionEnabled;\n const accessToken = await getAccessToken();\n await mappingsClient.updateMapping(accessToken, iModelId, mapping.id, {\n extractionEnabled: newState,\n });\n } catch (error: any) {\n handleError(error.status);\n }\n};\n\nexport const Mappings = ({\n onClickAddMapping,\n onClickMappingTitle,\n onClickMappingModify,\n displayStrings: userDisplayStrings,\n}: MappingsProps) => {\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);\n const [showImportModal, setShowImportModal] = useState<boolean>(false);\n const [showBlockingOverlay, setShowBlockingOverlay] =\n useState<boolean>(false);\n const [selectedMapping, setSelectedMapping] = useState<Mapping | undefined>(\n undefined\n );\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [mappings, setMappings] = useState<Mapping[]>([]);\n const displayStrings = { ...defaultDisplayStrings, ...userDisplayStrings };\n\n useEffect(() => {\n void fetchMappings(\n setMappings,\n iModelId,\n setIsLoading,\n getAccessToken,\n mappingClient\n );\n }, [getAccessToken, mappingClient, iModelId, setIsLoading]);\n\n const refresh = useCallback(async () => {\n clearAll();\n setSelectedMapping(undefined);\n setMappings([]);\n await fetchMappings(\n setMappings,\n iModelId,\n setIsLoading,\n getAccessToken,\n mappingClient\n );\n }, [getAccessToken, mappingClient, iModelId, setMappings]);\n\n return (\n <>\n <BlockingOverlay isVisible={showBlockingOverlay} />\n <Surface className=\"gmw-mappings-container\">\n <div className=\"gmw-table-toolbar\">\n <div className=\"gmw-button-spacing\">\n {onClickAddMapping &&\n <Button\n startIcon={<SvgAdd />}\n onClick={onClickAddMapping}\n styleType=\"high-visibility\"\n >\n New\n </Button>\n }\n <IconButton\n title={`Import ${displayStrings.mappings}`}\n onClick={() => setShowImportModal(true)}\n >\n <SvgImport />\n </IconButton>\n </div>\n <IconButton\n title=\"Refresh\"\n onClick={refresh}\n disabled={isLoading}\n styleType='borderless'\n >\n <SvgRefresh />\n </IconButton>\n </div>\n {isLoading ? (\n <LoadingOverlay />\n ) : mappings.length === 0 ? (\n <EmptyMessage message={`No ${displayStrings.mappings} available.`} />\n ) : (\n <div className=\"gmw-mappings-list\">\n {mappings\n .sort(\n (a, b) => a.mappingName.localeCompare(b.mappingName) ?? 1\n )\n .map((mapping) => (\n <HorizontalTile\n key={mapping.id}\n title={\n mapping.mappingName ? mapping.mappingName : \"Untitled\"\n }\n subText={mapping.description ?? \"\"}\n subtextToolTip={mapping.description ?? \"\"}\n titleTooltip={mapping.mappingName}\n onClickTitle={() => onClickMappingTitle ? onClickMappingTitle(mapping) : undefined}\n actionGroup={\n <DropdownMenu\n menuItems={(close: () => void) => [\n onClickMappingModify ? (\n <MenuItem\n key={0}\n onClick={() => {\n onClickMappingModify(mapping);\n }}\n icon={<SvgEdit />}\n >\n Modify\n </MenuItem>\n ) : [],\n <MenuItem\n key={1}\n onClick={async () => {\n setSelectedMapping(mapping);\n setShowBlockingOverlay(true);\n close();\n await toggleExtraction(\n getAccessToken,\n mappingClient,\n iModelId,\n mapping\n );\n await refresh();\n setShowBlockingOverlay(false);\n }}\n icon={<SvgProcess />}\n >\n {mapping.extractionEnabled\n ? \"Disable extraction\"\n : \"Enable extraction\"}\n </MenuItem>,\n <MenuItem\n key={2}\n onClick={() => {\n setSelectedMapping(mapping);\n setShowDeleteModal(true);\n close();\n }}\n icon={<SvgDelete />}\n >\n Remove\n </MenuItem>,\n ].flatMap((m) => m)}\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 </div>\n )}\n </Surface>\n <DeleteModal\n entityName={selectedMapping?.mappingName ?? \"\"}\n show={showDeleteModal}\n setShow={setShowDeleteModal}\n onDelete={async () => {\n const accessToken = await getAccessToken();\n await mappingClient.deleteMapping(\n accessToken,\n iModelId,\n selectedMapping?.id ?? \"\"\n );\n }}\n refresh={refresh}\n />\n <MappingImportWizardModal\n show={showImportModal}\n setShow={setShowImportModal}\n onFinish={refresh}\n displayStrings={displayStrings}\n />\n </>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Mapping.js","sourceRoot":"","sources":["../../../../src/widget/components/Mapping.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EACL,MAAM,EACN,SAAS,EACT,OAAO,EACP,SAAS,EACT,OAAO,EACP,UAAU,EACV,UAAU,GACX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,OAAO,GACR,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,gBAAgB,CAAC;AACxB,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AAKjF,MAAM,qBAAqB,GAAG;IAC5B,QAAQ,EAAE,UAAU;CACrB,CAAC;AAQF,MAAM,aAAa,GAAG,KAAK,EACzB,WAA4D,EAC5D,QAAgB,EAChB,YAA2D,EAC3D,cAAgC,EAChC,cAA+B,EAC/B,EAAE;IACF,IAAI;QACF,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,MAAM,WAAW,GAAG,MAAM,cAAc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MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;gBAC3C,MAAM,aAAa,CAAC,aAAa,CAC/B,WAAW,EACX,QAAQ,EACR,MAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,EAAE,mCAAI,EAAE,CAC1B,CAAC;YACJ,CAAC,EACD,OAAO,EAAE,OAAO,GAChB;QACF,oBAAC,wBAAwB,IACvB,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,OAAO,EACjB,cAAc,EAAE,cAAc,GAC9B,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 SvgAdd,\n SvgDelete,\n SvgEdit,\n SvgImport,\n SvgMore,\n SvgProcess,\n SvgRefresh,\n} from \"@itwin/itwinui-icons-react\";\nimport {\n Button,\n DropdownMenu,\n IconButton,\n MenuItem,\n Surface,\n} from \"@itwin/itwinui-react\";\nimport React, { useCallback, useEffect, useState } from \"react\";\nimport {\n EmptyMessage,\n handleError,\n LoadingOverlay,\n} from \"./utils\";\nimport \"./Mapping.scss\";\nimport DeleteModal from \"./DeleteModal\";\nimport { MappingImportWizardModal } from \"./MappingImportWizardModal\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport type { IMappingsClient, Mapping } from \"@itwin/insights-client\";\nimport { BlockingOverlay } from \"./BlockingOverlay\";\nimport { HorizontalTile } from \"./HorizontalTile\";\nimport type { GetAccessTokenFn } from \"./context/GroupingApiConfigContext\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\nimport type { CreateTypeFromInterface } from \"../utils\";\n\nexport type IMappingTyped = CreateTypeFromInterface<Mapping>;\n\nconst defaultDisplayStrings = {\n mappings: \"Mappings\",\n};\nexport interface MappingsProps {\n onClickAddMapping?: () => void;\n onClickMappingTitle?: (mapping: Mapping) => void;\n onClickMappingModify?: (mapping: Mapping) => void;\n displayStrings?: Partial<typeof defaultDisplayStrings>;\n}\n\nconst fetchMappings = async (\n setMappings: React.Dispatch<React.SetStateAction<Mapping[]>>,\n iModelId: string,\n setIsLoading: React.Dispatch<React.SetStateAction<boolean>>,\n getAccessToken: GetAccessTokenFn,\n mappingsClient: IMappingsClient\n) => {\n try {\n setIsLoading(true);\n const accessToken = await getAccessToken();\n const mappings = await mappingsClient.getMappings(accessToken, iModelId);\n setMappings(mappings.sort((a, b) => a.mappingName.localeCompare(b.mappingName)));\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n};\n\nconst toggleExtraction = async (\n getAccessToken: GetAccessTokenFn,\n mappingsClient: IMappingsClient,\n iModelId: string,\n mapping: Mapping\n) => {\n try {\n const newState = mapping.extractionEnabled;\n const accessToken = await getAccessToken();\n await mappingsClient.updateMapping(accessToken, iModelId, mapping.id, {\n extractionEnabled: newState,\n });\n } catch (error: any) {\n handleError(error.status);\n }\n};\n\nexport const Mappings = ({\n onClickAddMapping,\n onClickMappingTitle,\n onClickMappingModify,\n displayStrings: userDisplayStrings,\n}: MappingsProps) => {\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n const [showDeleteModal, setShowDeleteModal] = useState<Mapping | undefined>(undefined);\n const [showImportModal, setShowImportModal] = useState<boolean>(false);\n const [showBlockingOverlay, setShowBlockingOverlay] =\n useState<boolean>(false);\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [mappings, setMappings] = useState<Mapping[]>([]);\n const displayStrings = React.useMemo(\n () => ({ ...defaultDisplayStrings, ...userDisplayStrings }),\n [userDisplayStrings]\n );\n\n useEffect(() => {\n void fetchMappings(\n setMappings,\n iModelId,\n setIsLoading,\n getAccessToken,\n mappingClient\n );\n }, [getAccessToken, mappingClient, iModelId, setIsLoading]);\n\n const refresh = useCallback(async () => {\n setMappings([]);\n await fetchMappings(\n setMappings,\n iModelId,\n setIsLoading,\n getAccessToken,\n mappingClient\n );\n }, [getAccessToken, mappingClient, iModelId, setMappings]);\n\n return (\n <>\n <BlockingOverlay isVisible={showBlockingOverlay} />\n <Surface className=\"gmw-mappings-container\">\n <div className=\"gmw-table-toolbar\">\n <div className=\"gmw-button-spacing\">\n {onClickAddMapping &&\n <Button\n startIcon={<SvgAdd />}\n onClick={onClickAddMapping}\n styleType=\"high-visibility\"\n >\n New\n </Button>\n }\n <IconButton\n title={`Import ${displayStrings.mappings}`}\n onClick={() => setShowImportModal(true)}\n >\n <SvgImport />\n </IconButton>\n </div>\n <IconButton\n title=\"Refresh\"\n onClick={refresh}\n disabled={isLoading}\n styleType='borderless'\n >\n <SvgRefresh />\n </IconButton>\n </div>\n {isLoading ? (\n <LoadingOverlay />\n ) : mappings.length === 0 ? (\n <EmptyMessage message={`No ${displayStrings.mappings} available.`} />\n ) : (\n <div className=\"gmw-mappings-list\">\n {mappings\n .map((mapping) => (\n <HorizontalTile\n key={mapping.id}\n title={\n mapping.mappingName ? mapping.mappingName : \"Untitled\"\n }\n subText={mapping.description ?? \"\"}\n subtextToolTip={mapping.description ?? \"\"}\n titleTooltip={mapping.mappingName}\n onClickTitle={() => onClickMappingTitle ? onClickMappingTitle(mapping) : undefined}\n actionGroup={\n <DropdownMenu\n menuItems={(close: () => void) => [\n onClickMappingModify ? (\n <MenuItem\n key={0}\n onClick={() => {\n onClickMappingModify(mapping);\n close();\n }}\n icon={<SvgEdit />}\n >\n Modify\n </MenuItem>\n ) : [],\n <MenuItem\n key={1}\n onClick={async () => {\n setShowBlockingOverlay(true);\n close();\n await toggleExtraction(\n getAccessToken,\n mappingClient,\n iModelId,\n mapping\n );\n await refresh();\n setShowBlockingOverlay(false);\n }}\n icon={<SvgProcess />}\n >\n {mapping.extractionEnabled\n ? \"Disable extraction\"\n : \"Enable extraction\"}\n </MenuItem>,\n <MenuItem\n key={2}\n onClick={() => {\n setShowDeleteModal(mapping);\n close();\n }}\n icon={<SvgDelete />}\n >\n Remove\n </MenuItem>,\n ].flatMap((m) => m)}\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 </div>\n )}\n </Surface>\n <DeleteModal\n entityName={showDeleteModal?.mappingName}\n onClose={() => setShowDeleteModal(undefined)}\n onDelete={async () => {\n const accessToken = await getAccessToken();\n await mappingClient.deleteMapping(\n accessToken,\n iModelId,\n showDeleteModal?.id ?? \"\"\n );\n }}\n refresh={refresh}\n />\n <MappingImportWizardModal\n show={showImportModal}\n setShow={setShowImportModal}\n onFinish={refresh}\n displayStrings={displayStrings}\n />\n </>\n );\n};\n"]}
|
|
@@ -24,7 +24,7 @@ export const MappingAction = ({ mapping, onSaveSuccess, onClickCancel, displaySt
|
|
|
24
24
|
});
|
|
25
25
|
const [validator, showValidationMessage] = useValidator();
|
|
26
26
|
const [isLoading, setIsLoading] = useState(false);
|
|
27
|
-
const displayStrings = { ...defaultDisplayStrings, ...userDisplayStrings };
|
|
27
|
+
const displayStrings = React.useMemo(() => ({ ...defaultDisplayStrings, ...userDisplayStrings }), [userDisplayStrings]);
|
|
28
28
|
const onSave = async () => {
|
|
29
29
|
var _a, _b, _c;
|
|
30
30
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappingAction.js","sourceRoot":"","sources":["../../../../src/widget/components/MappingAction.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACnF,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,YAAY,EAAE,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,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;gBACF,oBAAC,YAAY,IACX,EAAE,EAAC,mBAAmB,EACtB,IAAI,EAAC,mBAAmB,EACxB,KAAK,EAAC,0BAA0B,EAChC,aAAa,EAAC,OAAO,EACrB,OAAO,EAAE,MAAM,CAAC,iBAAiB,EACjC,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;wBAClB,SAAS,CAAC,EAAE,GAAG,MAAM,EAAE,iBAAiB,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC,CAAC;oBAC3E,CAAC,GACD,CACO,CACP;QACN,oBAAC,WAAW,IACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,aAAa,EACvB,gBAAgB,EAAE,CAAC,MAAM,CAAC,IAAI,EAC9B,SAAS,EAAE,SAAS,GACpB,CACD,CACJ,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport { Fieldset, LabeledInput, Small, ToggleSwitch } from \"@itwin/itwinui-react\";\nimport React, { useState } from \"react\";\nimport ActionPanel from \"./ActionPanel\";\nimport useValidator, { NAME_REQUIREMENTS } from \"../hooks/useValidator\";\nimport { handleError, handleInputChange } from \"./utils\";\nimport \"./MappingAction.scss\";\nimport { useMappingClient } from \"./context/MappingClientContext\";\nimport type { Mapping } from \"@itwin/insights-client\";\nimport { useGroupingMappingApiConfig } from \"./context/GroupingApiConfigContext\";\n\nconst defaultDisplayStrings = {\n mappingDetails: \"Mapping Details\",\n};\n\nexport interface MappingActionProps {\n mapping?: Mapping;\n onSaveSuccess: () => void;\n onClickCancel?: () => void;\n displayStrings?: Partial<typeof defaultDisplayStrings>;\n}\n\nexport const MappingAction = ({ mapping, onSaveSuccess, onClickCancel, displayStrings: userDisplayStrings }: MappingActionProps) => {\n const { getAccessToken, iModelId } = useGroupingMappingApiConfig();\n const mappingClient = useMappingClient();\n const [values, setValues] = useState({\n name: mapping?.mappingName ?? \"\",\n description: mapping?.description ?? \"\",\n extractionEnabled: mapping?.extractionEnabled ?? true,\n });\n const [validator, showValidationMessage] = useValidator();\n const [isLoading, setIsLoading] = useState<boolean>(false);\n\n const displayStrings = React.useMemo(\n () => ({ ...defaultDisplayStrings, ...userDisplayStrings }),\n [userDisplayStrings]\n );\n\n const onSave = async () => {\n try {\n if (!validator.allValid()) {\n showValidationMessage(true);\n return;\n }\n setIsLoading(true);\n const accessToken = await getAccessToken();\n mapping\n ? await mappingClient.updateMapping(accessToken, iModelId, mapping.id, {\n mappingName: values.name,\n description: values.description,\n extractionEnabled: values.extractionEnabled,\n })\n : await mappingClient.createMapping(accessToken, iModelId, {\n mappingName: values.name,\n description: values.description,\n extractionEnabled: values.extractionEnabled,\n });\n setValues({\n name: mapping?.mappingName ?? \"\",\n description: mapping?.description ?? \"\",\n extractionEnabled: mapping?.extractionEnabled ?? true,\n });\n onSaveSuccess();\n } catch (error: any) {\n handleError(error.status);\n } finally {\n setIsLoading(false);\n }\n };\n\n return (\n <>\n <div className='gmw-details-form-container'>\n <Fieldset legend={displayStrings.mappingDetails} className='gmw-details-form'>\n <Small className='gmw-field-legend'>\n Asterisk * indicates mandatory fields.\n </Small>\n <LabeledInput\n id='name'\n name='name'\n label='Name'\n value={values.name}\n required\n onChange={(event) => {\n handleInputChange(event, values, setValues);\n validator.showMessageFor(\"name\");\n }}\n message={validator.message(\"name\", values.name, NAME_REQUIREMENTS)}\n status={\n validator.message(\"name\", values.name, NAME_REQUIREMENTS)\n ? \"negative\"\n : undefined\n }\n onBlur={() => {\n validator.showMessageFor(\"name\");\n }}\n onBlurCapture={(event) => {\n handleInputChange(event, values, setValues);\n validator.showMessageFor(\"name\");\n }}\n />\n <LabeledInput\n id='description'\n name='description'\n label='Description'\n value={values.description}\n onChange={(event) => {\n handleInputChange(event, values, setValues);\n }}\n />\n <ToggleSwitch\n id='extractionEnabled'\n name='extractionEnabled'\n label='Extract data from iModel'\n labelPosition=\"right\"\n checked={values.extractionEnabled}\n onChange={(event) => {\n setValues({ ...values, extractionEnabled: event.currentTarget.checked });\n }}\n />\n </Fieldset>\n </div>\n <ActionPanel\n onSave={onSave}\n onCancel={onClickCancel}\n isSavingDisabled={!values.name}\n isLoading={isLoading}\n />\n </>\n );\n};\n"]}
|
|
@@ -18,7 +18,7 @@ export const MappingImportWizardModal = ({ show, setShow, onFinish, displayStrin
|
|
|
18
18
|
const [selectedIModelId, setSelectedIModelId] = useState("");
|
|
19
19
|
const [selectedMappings, setSelectedMappings] = useState([]);
|
|
20
20
|
const [importing, setImporting] = useState(false);
|
|
21
|
-
const displayStrings = { ...defaultDisplayStrings, ...userDisplayStrings };
|
|
21
|
+
const displayStrings = React.useMemo(() => ({ ...defaultDisplayStrings, ...userDisplayStrings }), [userDisplayStrings]);
|
|
22
22
|
const steps = useRef([
|
|
23
23
|
{
|
|
24
24
|
name: "Select source project",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MappingImportWizardModal.js","sourceRoot":"","sources":["../../../../src/widget/components/MappingImportWizardModal.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,iCAAiC,CAAC;AACzC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,OAAO,oBAAoB,MAAM,yBAAyB,CAAC;AAE3D,MAAM,qBAAqB,GAAG;IAC5B,QAAQ,EAAE,UAAU;CACrB,CAAC;AAQF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,EACvC,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,cAAc,EAAE,kBAAkB,GACJ,EA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gB,EAC1B,QAAQ,EAAE,CAAC,gBAAgB,EAAE,EAAE;wCAC7B,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;wCACtC,cAAc,CAAC,CAAC,CAAC,CAAC;oCACpB,CAAC,EACD,QAAQ,EAAE,OAAO,EACjB,MAAM,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,WAAW,GAAG,CAAC,CAAC,EAC7C,cAAc,EAAE,cAAc,GAC9B,CACE;4BACL,WAAW,KAAK,CAAC,IAAI,CACpB,oBAAC,oBAAoB,IACnB,cAAc,EAAE,gBAAgB,EAChC,gBAAgB,EAAE,gBAAgB,EAClC,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,mBAAmB,EAAE,mBAAmB,EACxC,MAAM,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,WAAW,GAAG,CAAC,CAAC,EAC7C,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,KAAK,IAAI,EAAE;oCACnB,MAAM,OAAO,EAAE,CAAC;oCAChB,YAAY,CAAC,KAAK,CAAC,CAAC;gCACtB,CAAC,EACD,cAAc,EAAE,cAAc,GAC9B,CACH,CACA,CACJ,CAAC;oBACJ;wBACE,OAAO,IAAI,CAAC;iBACf;YACH,CAAC,CAAC,EAAE,CACA,CACA,CACT,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React, { useRef, useState } from \"react\";\nimport type { StepProperties } from \"@itwin/itwinui-react\";\nimport { Modal, Wizard } from \"@itwin/itwinui-react\";\nimport SelectProject from \"./SelectProject\";\nimport \"./MappingImportWizardModal.scss\";\nimport SelectIModel from \"./SelectIModel\";\nimport SelectMappings from \"./SelectMappings\";\nimport type { IMappingTyped } from \"./Mapping\";\nimport ConfirmMappingImport from \"./ConfirmMappingsImport\";\n\nconst defaultDisplayStrings = {\n mappings: \"Mappings\",\n};\ninterface MappingImportWizardModalProps {\n show: boolean;\n setShow: React.Dispatch<React.SetStateAction<boolean>>;\n onFinish: () => Promise<void>;\n displayStrings?: Partial<typeof defaultDisplayStrings>;\n}\n\nexport const MappingImportWizardModal = ({\n show,\n setShow,\n onFinish,\n displayStrings: userDisplayStrings,\n}: MappingImportWizardModalProps) => {\n const [currentStep, setCurrentStep] = useState<number>(0);\n const [selectedProjectId, setSelectedProjectId] = useState<string>(\"\");\n const [selectedIModelId, setSelectedIModelId] = useState<string>(\"\");\n const [selectedMappings, setSelectedMappings] = useState<IMappingTyped[]>([]);\n const [importing, setImporting] = useState<boolean>(false);\n\n const displayStrings = React.useMemo(\n () => ({ ...defaultDisplayStrings, ...userDisplayStrings }),\n [userDisplayStrings]\n );\n\n const steps = useRef<StepProperties[]>([\n {\n name: \"Select source project\",\n description: `Select the source project to bring your ${displayStrings.mappings} from.`,\n },\n {\n name: \"Select iModel\",\n description: \"Select an iModel within the project you have selected.\",\n },\n {\n name: `Select ${displayStrings.mappings}`,\n description: `Select one or more ${displayStrings.mappings} to import.`,\n },\n {\n name: \"Rename & Confirm\",\n description:\n \"Rename and confirm your selections. Click import when finished.\",\n },\n ]);\n\n const onClose = async () => {\n setShow(false);\n setCurrentStep(0);\n await onFinish();\n };\n\n return (\n <Modal\n title={`Import ${displayStrings.mappings}`}\n modalRootId='grouping-mapping-widget'\n isOpen={show}\n closeOnEsc={false}\n closeOnExternalClick={false}\n isDismissible={!importing}\n styleType='fullPage'\n onClose={async () => {\n await onClose();\n }}\n >\n <div className='gmw-import-wizard-body-container'>\n <Wizard\n currentStep={currentStep}\n steps={steps.current}\n onStepClick={\n importing ? undefined : (index: number) => setCurrentStep(index)\n }\n />\n\n {(() => {\n switch (currentStep) {\n case 0:\n return (\n <SelectProject\n onSelect={(project) => {\n setSelectedProjectId(project.id);\n setCurrentStep(1);\n }}\n onCancel={onClose}\n />\n );\n case 1:\n return (\n <SelectIModel\n projectId={selectedProjectId}\n onSelect={(iModel) => {\n setSelectedIModelId(iModel.id);\n setCurrentStep(2);\n }}\n backFn={() => setCurrentStep(currentStep - 1)}\n onCancel={onClose}\n />\n );\n case 2:\n case 3:\n // Preserve table state within Select Mappings\n return (\n <>\n <div\n style={{ display: currentStep === 2 ? \"flex\" : \"none\" }}\n className=\"gmw-mappings-container\"\n >\n <SelectMappings\n iModelId={selectedIModelId}\n onSelect={(selectedMappings) => {\n setSelectedMappings(selectedMappings);\n setCurrentStep(3);\n }}\n onCancel={onClose}\n backFn={() => setCurrentStep(currentStep - 1)}\n displayStrings={displayStrings}\n />\n </div>\n {currentStep === 3 && (\n <ConfirmMappingImport\n sourceiModelId={selectedIModelId}\n selectedMappings={selectedMappings}\n importing={importing}\n setImporting={setImporting}\n setSelectedMappings={setSelectedMappings}\n backFn={() => setCurrentStep(currentStep - 1)}\n onCancel={onClose}\n onFinish={async () => {\n await onClose();\n setImporting(false);\n }}\n displayStrings={displayStrings}\n />\n )}\n </>\n );\n default:\n return null;\n }\n })()}\n </div>\n </Modal>\n );\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { PropertyRecord } from "@itwin/appui-abstract";
|
|
3
|
+
import "./PropertyAction.scss";
|
|
4
|
+
export interface PropertyActionProps {
|
|
5
|
+
property: PropertyRecord;
|
|
6
|
+
}
|
|
7
|
+
export declare const PropertyAction: ({ property }: PropertyActionProps) => JSX.Element;
|
|
8
|
+
//# sourceMappingURL=PropertyAction.d.ts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
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 React, { useCallback, useEffect, useState } from "react";
|
|
6
|
+
import { PropertyValueFormat } from "@itwin/appui-abstract";
|
|
7
|
+
import { usePropertyGridWrapper } from "./context/PropertyGridWrapperContext";
|
|
8
|
+
import { Checkbox } from "@itwin/itwinui-react";
|
|
9
|
+
import "./PropertyAction.scss";
|
|
10
|
+
const usePropertySelection = (property, currentPropertyList, queryBuilder) => {
|
|
11
|
+
const [isCheckboxLoading, setIsCheckboxLoading] = useState(false);
|
|
12
|
+
const checkIfPropertyIsSelected = useCallback((property) => {
|
|
13
|
+
if (property.value.valueFormat === PropertyValueFormat.Primitive) {
|
|
14
|
+
return currentPropertyList.includes(property);
|
|
15
|
+
}
|
|
16
|
+
if (property.value.valueFormat === PropertyValueFormat.Array) {
|
|
17
|
+
return (property.value.items.length === 0 &&
|
|
18
|
+
currentPropertyList.includes(property));
|
|
19
|
+
}
|
|
20
|
+
return Object.values(property.value.members).every((subProp) => checkIfPropertyIsSelected(subProp));
|
|
21
|
+
}, [currentPropertyList]);
|
|
22
|
+
const isPropertySelected = checkIfPropertyIsSelected(property);
|
|
23
|
+
const addProperty = useCallback(async (prop) => {
|
|
24
|
+
if (prop.value.valueFormat === PropertyValueFormat.Primitive &&
|
|
25
|
+
!currentPropertyList.includes(prop) &&
|
|
26
|
+
(await (queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.addProperty(prop)))) {
|
|
27
|
+
setIsCheckboxLoading(false);
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}, [currentPropertyList, queryBuilder]);
|
|
32
|
+
const removeProperty = useCallback(async (prop) => {
|
|
33
|
+
if (currentPropertyList.includes(prop)) {
|
|
34
|
+
await (queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.removeProperty(prop));
|
|
35
|
+
setIsCheckboxLoading(false);
|
|
36
|
+
}
|
|
37
|
+
}, [currentPropertyList, queryBuilder]);
|
|
38
|
+
return {
|
|
39
|
+
isPropertySelected,
|
|
40
|
+
addProperty,
|
|
41
|
+
removeProperty,
|
|
42
|
+
isCheckboxLoading,
|
|
43
|
+
setIsCheckboxLoading,
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export const PropertyAction = ({ property }) => {
|
|
47
|
+
const { currentPropertyList, queryBuilder, setCurrentPropertyList, setQuery, isUpdating, } = usePropertyGridWrapper();
|
|
48
|
+
const { isPropertySelected, addProperty, removeProperty, isCheckboxLoading, setIsCheckboxLoading, } = usePropertySelection(property, currentPropertyList, queryBuilder);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
setIsCheckboxLoading(isPropertySelected && isUpdating);
|
|
51
|
+
}, [isPropertySelected, isUpdating, setIsCheckboxLoading]);
|
|
52
|
+
const onPropertySelectionChanged = useCallback(async () => {
|
|
53
|
+
var _a, _b;
|
|
54
|
+
if (isPropertySelected) {
|
|
55
|
+
await removeProperty(property);
|
|
56
|
+
setCurrentPropertyList((prevList) => prevList.filter((x) => x !== property));
|
|
57
|
+
setQuery((_a = queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.buildQueryString()) !== null && _a !== void 0 ? _a : "");
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
if (await addProperty(property)) {
|
|
61
|
+
setCurrentPropertyList((prevList) => prevList.concat(property));
|
|
62
|
+
setQuery((_b = queryBuilder === null || queryBuilder === void 0 ? void 0 : queryBuilder.buildQueryString()) !== null && _b !== void 0 ? _b : "");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, [
|
|
66
|
+
addProperty,
|
|
67
|
+
isPropertySelected,
|
|
68
|
+
property,
|
|
69
|
+
removeProperty,
|
|
70
|
+
queryBuilder,
|
|
71
|
+
setCurrentPropertyList,
|
|
72
|
+
setQuery,
|
|
73
|
+
]);
|
|
74
|
+
return (React.createElement("div", { className: "gmw-property-selection-checkbox" }, property.value.valueFormat === PropertyValueFormat.Primitive &&
|
|
75
|
+
property.value.value !== undefined && (React.createElement(Checkbox, { checked: isPropertySelected, onChange: onPropertySelectionChanged, disabled: isUpdating, isLoading: isCheckboxLoading }))));
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=PropertyAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PropertyAction.js","sourceRoot":"","sources":["../../../../src/widget/components/PropertyAction.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,uBAAuB,CAAC;AAO/B,MAAM,oBAAoB,GAAG,CAC3B,QAAwB,EACxB,mBAAqC,EACrC,YAAsC,EACtC,EAAE;IACF,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAElE,MAAM,yBAAyB,GAAG,WAAW,CAC3C,CAAC,QAAwB,EAAW,EAAE;QACpC,IAAI,QAAQ,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS,EAAE;YAChE,OAAO,mBAAmB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;SAC/C;QAED,IAAI,QAAQ,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,KAAK,EAAE;YAC5D,OAAO,CACL,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;gBACjC,mBAAmB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACvC,CAAC;SACH;QACD,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,CAChD,CAAC,OAAuB,EAAE,EAAE,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAChE,CAAC;IACJ,CAAC,EACD,CAAC,mBAAm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0BAA0B,EACpC,QAAQ,EAAE,UAAU,EACpB,SAAS,EAAE,iBAAiB,GAC5B,CACH,CACG,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport React, { useCallback, useEffect, useState } from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { usePropertyGridWrapper } from \"./context/PropertyGridWrapperContext\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport \"./PropertyAction.scss\";\nimport type { QueryBuilder } from \"./QueryBuilder\";\n\nexport interface PropertyActionProps {\n property: PropertyRecord;\n}\n\nconst usePropertySelection = (\n property: PropertyRecord,\n currentPropertyList: PropertyRecord[],\n queryBuilder: QueryBuilder | undefined\n) => {\n const [isCheckboxLoading, setIsCheckboxLoading] = useState(false);\n\n const checkIfPropertyIsSelected = useCallback(\n (property: PropertyRecord): boolean => {\n if (property.value.valueFormat === PropertyValueFormat.Primitive) {\n return currentPropertyList.includes(property);\n }\n\n if (property.value.valueFormat === PropertyValueFormat.Array) {\n return (\n property.value.items.length === 0 &&\n currentPropertyList.includes(property)\n );\n }\n return Object.values(property.value.members).every(\n (subProp: PropertyRecord) => checkIfPropertyIsSelected(subProp)\n );\n },\n [currentPropertyList]\n );\n\n const isPropertySelected = checkIfPropertyIsSelected(property);\n\n const addProperty = useCallback(\n async (prop: PropertyRecord) => {\n if (\n prop.value.valueFormat === PropertyValueFormat.Primitive &&\n !currentPropertyList.includes(prop) &&\n (await queryBuilder?.addProperty(prop))\n ) {\n setIsCheckboxLoading(false);\n return true;\n }\n return false;\n },\n [currentPropertyList, queryBuilder]\n );\n\n const removeProperty = useCallback(\n async (prop: PropertyRecord) => {\n if (currentPropertyList.includes(prop)) {\n await queryBuilder?.removeProperty(prop);\n setIsCheckboxLoading(false);\n }\n },\n [currentPropertyList, queryBuilder]\n );\n\n return {\n isPropertySelected,\n addProperty,\n removeProperty,\n isCheckboxLoading,\n setIsCheckboxLoading,\n };\n};\n\nexport const PropertyAction = ({ property }: PropertyActionProps) => {\n const {\n currentPropertyList,\n queryBuilder,\n setCurrentPropertyList,\n setQuery,\n isUpdating,\n } = usePropertyGridWrapper();\n\n const {\n isPropertySelected,\n addProperty,\n removeProperty,\n isCheckboxLoading,\n setIsCheckboxLoading,\n } = usePropertySelection(property, currentPropertyList, queryBuilder);\n\n useEffect(() => {\n setIsCheckboxLoading(isPropertySelected && isUpdating);\n }, [isPropertySelected, isUpdating, setIsCheckboxLoading]);\n\n const onPropertySelectionChanged = useCallback(async () => {\n if (isPropertySelected) {\n await removeProperty(property);\n setCurrentPropertyList((prevList) =>\n prevList.filter((x) => x !== property)\n );\n setQuery(queryBuilder?.buildQueryString() ?? \"\");\n } else {\n if (await addProperty(property)) {\n setCurrentPropertyList((prevList) => prevList.concat(property));\n setQuery(queryBuilder?.buildQueryString() ?? \"\");\n }\n }\n }, [\n addProperty,\n isPropertySelected,\n property,\n removeProperty,\n queryBuilder,\n setCurrentPropertyList,\n setQuery,\n ]);\n\n return (\n <div className=\"gmw-property-selection-checkbox\">\n {property.value.valueFormat === PropertyValueFormat.Primitive &&\n property.value.value !== undefined && (\n <Checkbox\n checked={isPropertySelected}\n onChange={onPropertySelectionChanged}\n disabled={isUpdating}\n isLoading={isCheckboxLoading}\n />\n )}\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
|
|
6
|
+
.gmw-property-selection-checkbox {
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
}
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { IGroupTyped } from "./Grouping";
|
|
3
2
|
import "./PropertyMenu.scss";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
group:
|
|
8
|
-
|
|
3
|
+
import type { CalculatedProperty, CustomCalculation, Group, GroupProperty, Mapping } from "@itwin/insights-client";
|
|
4
|
+
export interface PropertyMenuProps {
|
|
5
|
+
mapping: Mapping;
|
|
6
|
+
group: Group;
|
|
7
|
+
color: string;
|
|
8
|
+
onClickAddGroupProperty?: () => void;
|
|
9
|
+
onClickModifyGroupProperty?: (groupProperty: GroupProperty) => void;
|
|
10
|
+
onClickAddCalculatedProperty?: () => void;
|
|
11
|
+
onClickModifyCalculatedProperty?: (calculatedProperty: CalculatedProperty) => void;
|
|
12
|
+
onClickAddCustomCalculationProperty?: () => void;
|
|
13
|
+
onClickModifyCustomCalculation?: (customCalculation: CustomCalculation) => void;
|
|
9
14
|
hideGroupProps?: boolean;
|
|
10
15
|
hideCalculatedProps?: boolean;
|
|
11
16
|
hideCustomCalculationProps?: boolean;
|
|
12
17
|
}
|
|
13
|
-
export declare
|
|
14
|
-
DEFAULT = "default",
|
|
15
|
-
ADD_GROUP_PROPERTY = "add_group_property",
|
|
16
|
-
MODIFY_GROUP_PROPERTY = "modify_group_property",
|
|
17
|
-
ADD_CALCULATED_PROPERTY = "add_calculated_property",
|
|
18
|
-
MODIFY_CALCULATED_PROPERTY = "modify_calculated_property",
|
|
19
|
-
ADD_CUSTOM_CALCULATION = "add_custom_calculation",
|
|
20
|
-
MODIFY_CUSTOM_CALCULATION = "modify_custom_calculation"
|
|
21
|
-
}
|
|
22
|
-
export declare const PropertyMenu: ({ iModelId, mappingId, group, goBack, hideGroupProps, hideCalculatedProps, hideCustomCalculationProps, }: PropertyModifyProps) => JSX.Element;
|
|
23
|
-
export {};
|
|
18
|
+
export declare const PropertyMenu: ({ mapping, group, color, onClickAddGroupProperty, onClickModifyGroupProperty, onClickAddCalculatedProperty, onClickModifyCalculatedProperty, onClickAddCustomCalculationProperty, onClickModifyCustomCalculation, hideGroupProps, hideCalculatedProps, hideCustomCalculationProps, }: PropertyMenuProps) => JSX.Element;
|
|
24
19
|
//# sourceMappingURL=PropertyMenu.d.ts.map
|