@gridsuite/commons-ui 0.62.0 → 0.63.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AuthenticationRouter/AuthenticationRouter.d.ts +21 -20
- package/dist/components/AuthenticationRouter/AuthenticationRouter.js +15 -13
- package/dist/components/AuthenticationRouter/index.d.ts +4 -7
- package/dist/components/AuthenticationRouter/index.js +2 -2
- package/dist/components/CardErrorBoundary/card-error-boundary.d.ts +0 -1
- package/dist/components/CardErrorBoundary/card-error-boundary.js +5 -3
- package/dist/components/CardErrorBoundary/index.d.ts +3 -7
- package/dist/components/CardErrorBoundary/index.js +2 -2
- package/dist/components/CustomAGGrid/custom-aggrid.js +1 -1
- package/dist/components/CustomAGGrid/custom-aggrid.style.js +5 -5
- package/dist/components/DirectoryItemSelector/directory-item-selector.d.ts +2 -3
- package/dist/components/DirectoryItemSelector/directory-item-selector.js +108 -105
- package/dist/components/ElementSearchDialog/element-search-dialog.d.ts +1 -1
- package/dist/components/ElementSearchDialog/element-search-dialog.js +2 -2
- package/dist/components/ElementSearchDialog/element-search-input.d.ts +1 -1
- package/dist/components/ElementSearchDialog/element-search-input.js +4 -6
- package/dist/components/ElementSearchDialog/equipment-item.d.ts +3 -3
- package/dist/components/ElementSearchDialog/equipment-item.js +13 -13
- package/dist/components/ElementSearchDialog/index.d.ts +3 -3
- package/dist/components/ElementSearchDialog/index.js +5 -5
- package/dist/components/ElementSearchDialog/tag-renderer.d.ts +11 -12
- package/dist/components/ElementSearchDialog/tag-renderer.js +5 -6
- package/dist/components/ElementSearchDialog/use-element-search.d.ts +2 -2
- package/dist/components/ElementSearchDialog/use-element-search.js +2 -2
- package/dist/components/ExpandableGroup/expandable-group.d.ts +3 -3
- package/dist/components/ExpandableGroup/expandable-group.js +6 -6
- package/dist/components/ExpandableGroup/index.d.ts +3 -7
- package/dist/components/ExpandableGroup/index.js +2 -2
- package/dist/components/FlatParameters/FlatParameters.d.ts +1 -1
- package/dist/components/FlatParameters/FlatParameters.js +46 -46
- package/dist/components/FlatParameters/index.d.ts +3 -7
- package/dist/components/Login/Login.d.ts +1 -7
- package/dist/components/Login/Login.js +3 -9
- package/dist/components/Login/Logout.d.ts +1 -1
- package/dist/components/Login/Logout.js +11 -11
- package/dist/components/Login/index.d.ts +3 -7
- package/dist/components/Login/index.js +2 -2
- package/dist/components/MuiVirtualizedTable/ColumnHeader.js +9 -8
- package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.d.ts +24 -9
- package/dist/components/MuiVirtualizedTable/KeyedColumnsRowIndexer.js +200 -205
- package/dist/components/MuiVirtualizedTable/MuiVirtualizedTable.js +6 -6
- package/dist/components/MuiVirtualizedTable/index.d.ts +2 -2
- package/dist/components/MuiVirtualizedTable/index.js +3 -3
- package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.d.ts +1 -1
- package/dist/components/MultipleSelectionDialog/MultipleSelectionDialog.js +5 -15
- package/dist/components/MultipleSelectionDialog/index.d.ts +3 -7
- package/dist/components/MultipleSelectionDialog/index.js +2 -2
- package/dist/components/OverflowableText/index.d.ts +3 -7
- package/dist/components/OverflowableText/overflowable-text.js +2 -2
- package/dist/components/ReportViewer/filter-button.d.ts +1 -1
- package/dist/components/ReportViewer/filter-button.js +3 -3
- package/dist/components/ReportViewer/index.d.ts +3 -7
- package/dist/components/ReportViewer/index.js +2 -2
- package/dist/components/ReportViewer/log-report-item.d.ts +1 -1
- package/dist/components/ReportViewer/log-report-item.js +12 -9
- package/dist/components/ReportViewer/log-report.js +3 -3
- package/dist/components/ReportViewer/log-table.d.ts +2 -1
- package/dist/components/ReportViewer/log-table.js +6 -5
- package/dist/components/ReportViewer/multi-select-list.d.ts +1 -1
- package/dist/components/ReportViewer/multi-select-list.js +3 -3
- package/dist/components/ReportViewer/report-item.js +4 -3
- package/dist/components/ReportViewer/report-viewer.js +11 -12
- package/dist/components/ReportViewerDialog/index.d.ts +3 -7
- package/dist/components/ReportViewerDialog/index.js +2 -2
- package/dist/components/SignInCallbackHandler/SignInCallbackHandler.d.ts +2 -2
- package/dist/components/SignInCallbackHandler/SignInCallbackHandler.js +3 -3
- package/dist/components/SignInCallbackHandler/index.d.ts +3 -7
- package/dist/components/SignInCallbackHandler/index.js +2 -2
- package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.d.ts +2 -2
- package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.js +3 -3
- package/dist/components/SilentRenewCallbackHandler/index.d.ts +3 -7
- package/dist/components/SilentRenewCallbackHandler/index.js +2 -2
- package/dist/components/SnackbarProvider/SnackbarProvider.d.ts +1 -1
- package/dist/components/SnackbarProvider/SnackbarProvider.js +14 -13
- package/dist/components/SnackbarProvider/index.d.ts +3 -7
- package/dist/components/SnackbarProvider/index.js +2 -2
- package/dist/components/TopBar/AboutDialog.d.ts +2 -3
- package/dist/components/TopBar/AboutDialog.js +151 -153
- package/dist/components/TopBar/GridLogo.d.ts +2 -2
- package/dist/components/TopBar/GridLogo.js +24 -24
- package/dist/components/TopBar/TopBar.d.ts +5 -29
- package/dist/components/TopBar/TopBar.js +9 -33
- package/dist/components/TopBar/index.d.ts +1 -1
- package/dist/components/TopBar/index.js +1 -1
- package/dist/components/TreeViewFinder/TreeViewFinder.js +51 -45
- package/dist/components/TreeViewFinder/index.d.ts +1 -1
- package/dist/components/TreeViewFinder/index.js +1 -1
- package/dist/components/dialogs/custom-mui-dialog.d.ts +2 -2
- package/dist/components/dialogs/custom-mui-dialog.js +5 -5
- package/dist/components/dialogs/description-modification-dialog.d.ts +7 -3
- package/dist/components/dialogs/description-modification-dialog.js +11 -5
- package/dist/components/dialogs/modify-element-selection.d.ts +1 -2
- package/dist/components/dialogs/modify-element-selection.js +21 -13
- package/dist/components/dialogs/popup-confirmation-dialog.d.ts +7 -3
- package/dist/components/dialogs/popup-confirmation-dialog.js +3 -6
- package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.d.ts +4 -5
- package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.js +123 -16
- package/dist/components/filter/criteria-based/criteria-based-filter-form.d.ts +1 -2
- package/dist/components/filter/criteria-based/criteria-based-filter-form.js +6 -5
- package/dist/components/filter/criteria-based/criteria-based-filter-utils.js +27 -20
- package/dist/components/filter/criteria-based/criteria-based-form.d.ts +1 -2
- package/dist/components/filter/criteria-based/criteria-based-form.js +17 -6
- package/dist/components/filter/criteria-based/filter-free-properties.d.ts +5 -3
- package/dist/components/filter/criteria-based/filter-free-properties.js +69 -13
- package/dist/components/filter/criteria-based/filter-properties.d.ts +1 -6
- package/dist/components/filter/criteria-based/filter-properties.js +124 -16
- package/dist/components/filter/criteria-based/filter-property.d.ts +1 -2
- package/dist/components/filter/criteria-based/filter-property.js +16 -16
- package/dist/components/filter/expert/expert-filter-constants.d.ts +8 -1
- package/dist/components/filter/expert/expert-filter-constants.js +7 -0
- package/dist/components/filter/expert/expert-filter-edition-dialog.d.ts +3 -4
- package/dist/components/filter/expert/expert-filter-edition-dialog.js +128 -15
- package/dist/components/filter/expert/expert-filter-form.d.ts +2 -2
- package/dist/components/filter/expert/expert-filter-form.js +115 -20
- package/dist/components/filter/expert/expert-filter-utils.d.ts +2 -2
- package/dist/components/filter/expert/expert-filter-utils.js +58 -46
- package/dist/components/filter/expert/expert-filter.type.d.ts +4 -0
- package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.d.ts +3 -4
- package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.js +136 -16
- package/dist/components/filter/explicit-naming/explicit-naming-filter-form.d.ts +4 -5
- package/dist/components/filter/explicit-naming/explicit-naming-filter-form.js +241 -24
- package/dist/components/filter/filter-creation-dialog.d.ts +3 -4
- package/dist/components/filter/filter-creation-dialog.js +125 -13
- package/dist/components/filter/filter-form.d.ts +4 -5
- package/dist/components/filter/filter-form.js +73 -14
- package/dist/components/filter/utils/filter-api.js +1 -1
- package/dist/components/filter/utils/filter-form-utils.js +1 -1
- package/dist/components/inputs/react-hook-form/ExpandingTextField.d.ts +1 -2
- package/dist/components/inputs/react-hook-form/ExpandingTextField.js +5 -5
- package/dist/components/inputs/react-hook-form/ag-grid-table/bottom-right-buttons.d.ts +1 -2
- package/dist/components/inputs/react-hook-form/ag-grid-table/bottom-right-buttons.js +102 -13
- package/dist/components/inputs/react-hook-form/ag-grid-table/cell-editors/numericEditor.d.ts +7 -6
- package/dist/components/inputs/react-hook-form/ag-grid-table/cell-editors/numericEditor.js +13 -15
- package/dist/components/inputs/react-hook-form/ag-grid-table/csv-uploader/csv-uploader.d.ts +7 -3
- package/dist/components/inputs/react-hook-form/ag-grid-table/csv-uploader/csv-uploader.js +220 -61
- package/dist/components/inputs/react-hook-form/ag-grid-table/custom-ag-grid-table.d.ts +1 -2
- package/dist/components/inputs/react-hook-form/ag-grid-table/custom-ag-grid-table.js +243 -11
- package/dist/components/inputs/react-hook-form/autocomplete-inputs/autocomplete-input.d.ts +4 -2
- package/dist/components/inputs/react-hook-form/autocomplete-inputs/autocomplete-input.js +12 -12
- package/dist/components/inputs/react-hook-form/autocomplete-inputs/multiple-autocomplete-input.d.ts +1 -1
- package/dist/components/inputs/react-hook-form/autocomplete-inputs/multiple-autocomplete-input.js +2 -2
- package/dist/components/inputs/react-hook-form/booleans/boolean-input.d.ts +1 -1
- package/dist/components/inputs/react-hook-form/booleans/boolean-input.js +2 -2
- package/dist/components/inputs/react-hook-form/booleans/checkbox-input.d.ts +1 -1
- package/dist/components/inputs/react-hook-form/booleans/checkbox-input.js +3 -3
- package/dist/components/inputs/react-hook-form/booleans/switch-input.d.ts +1 -1
- package/dist/components/inputs/react-hook-form/booleans/switch-input.js +3 -3
- package/dist/components/inputs/react-hook-form/directory-items-input.d.ts +11 -3
- package/dist/components/inputs/react-hook-form/directory-items-input.js +11 -11
- package/dist/components/inputs/react-hook-form/error-management/error-input.d.ts +2 -2
- package/dist/components/inputs/react-hook-form/error-management/error-input.js +7 -9
- package/dist/components/inputs/react-hook-form/error-management/field-error-alert.d.ts +2 -2
- package/dist/components/inputs/react-hook-form/error-management/field-error-alert.js +2 -4
- package/dist/components/inputs/react-hook-form/error-management/mid-form-error.d.ts +2 -2
- package/dist/components/inputs/react-hook-form/error-management/mid-form-error.js +2 -2
- package/dist/components/inputs/react-hook-form/numbers/float-input.d.ts +1 -2
- package/dist/components/inputs/react-hook-form/numbers/float-input.js +6 -5
- package/dist/components/inputs/react-hook-form/numbers/integer-input.d.ts +1 -1
- package/dist/components/inputs/react-hook-form/numbers/integer-input.js +5 -5
- package/dist/components/inputs/react-hook-form/provider/custom-form-provider.d.ts +1 -1
- package/dist/components/inputs/react-hook-form/provider/custom-form-provider.js +11 -8
- package/dist/components/inputs/react-hook-form/provider/use-custom-form-context.d.ts +2 -1
- package/dist/components/inputs/react-hook-form/provider/use-custom-form-context.js +1 -1
- package/dist/components/inputs/react-hook-form/radio-input.d.ts +1 -1
- package/dist/components/inputs/react-hook-form/radio-input.js +2 -8
- package/dist/components/inputs/react-hook-form/range-input.d.ts +1 -2
- package/dist/components/inputs/react-hook-form/range-input.js +5 -5
- package/dist/components/inputs/react-hook-form/raw-read-only-input.d.ts +2 -1
- package/dist/components/inputs/react-hook-form/raw-read-only-input.js +1 -1
- package/dist/components/inputs/react-hook-form/select-inputs/countries-input.d.ts +1 -3
- package/dist/components/inputs/react-hook-form/select-inputs/countries-input.js +4 -8
- package/dist/components/inputs/react-hook-form/select-inputs/input-with-popup-confirmation.d.ts +3 -1
- package/dist/components/inputs/react-hook-form/select-inputs/input-with-popup-confirmation.js +4 -4
- package/dist/components/inputs/react-hook-form/select-inputs/mui-select-input.d.ts +1 -2
- package/dist/components/inputs/react-hook-form/select-inputs/mui-select-input.js +11 -10
- package/dist/components/inputs/react-hook-form/select-inputs/select-input.d.ts +1 -2
- package/dist/components/inputs/react-hook-form/select-inputs/select-input.js +16 -8
- package/dist/components/inputs/react-hook-form/slider-input.d.ts +1 -1
- package/dist/components/inputs/react-hook-form/slider-input.js +6 -6
- package/dist/components/inputs/react-hook-form/text-input.d.ts +6 -2
- package/dist/components/inputs/react-hook-form/text-input.js +9 -9
- package/dist/components/inputs/react-hook-form/unique-name-input.d.ts +4 -6
- package/dist/components/inputs/react-hook-form/unique-name-input.js +12 -12
- package/dist/components/inputs/react-hook-form/utils/cancel-button.d.ts +9 -10
- package/dist/components/inputs/react-hook-form/utils/cancel-button.js +2 -6
- package/dist/components/inputs/react-hook-form/utils/field-label.d.ts +1 -1
- package/dist/components/inputs/react-hook-form/utils/field-label.js +3 -3
- package/dist/components/inputs/react-hook-form/utils/functions.js +1 -1
- package/dist/components/inputs/react-hook-form/utils/submit-button.d.ts +9 -10
- package/dist/components/inputs/react-hook-form/utils/submit-button.js +2 -6
- package/dist/components/inputs/react-hook-form/utils/text-field-with-adornment.d.ts +1 -2
- package/dist/components/inputs/react-hook-form/utils/text-field-with-adornment.js +7 -7
- package/dist/components/inputs/react-query-builder/add-button.d.ts +1 -2
- package/dist/components/inputs/react-query-builder/add-button.js +13 -10
- package/dist/components/inputs/react-query-builder/combinator-selector.d.ts +1 -2
- package/dist/components/inputs/react-query-builder/combinator-selector.js +7 -6
- package/dist/components/inputs/react-query-builder/composite-rule-editor/group-value-editor.d.ts +1 -1
- package/dist/components/inputs/react-query-builder/composite-rule-editor/group-value-editor.js +2 -2
- package/dist/components/inputs/react-query-builder/composite-rule-editor/rule-value-editor.d.ts +1 -1
- package/dist/components/inputs/react-query-builder/composite-rule-editor/rule-value-editor.js +5 -5
- package/dist/components/inputs/react-query-builder/country-value-editor.d.ts +1 -2
- package/dist/components/inputs/react-query-builder/country-value-editor.js +18 -18
- package/dist/components/inputs/react-query-builder/custom-react-query-builder.d.ts +1 -1
- package/dist/components/inputs/react-query-builder/custom-react-query-builder.js +92 -19
- package/dist/components/inputs/react-query-builder/element-value-editor.d.ts +7 -3
- package/dist/components/inputs/react-query-builder/element-value-editor.js +50 -62
- package/dist/components/inputs/react-query-builder/property-value-editor.d.ts +1 -2
- package/dist/components/inputs/react-query-builder/property-value-editor.js +5 -5
- package/dist/components/inputs/react-query-builder/remove-button.d.ts +1 -2
- package/dist/components/inputs/react-query-builder/remove-button.js +26 -7
- package/dist/components/inputs/react-query-builder/text-value-editor.d.ts +1 -2
- package/dist/components/inputs/react-query-builder/text-value-editor.js +17 -17
- package/dist/components/inputs/react-query-builder/translated-value-editor.d.ts +1 -2
- package/dist/components/inputs/react-query-builder/translated-value-editor.js +22 -26
- package/dist/components/inputs/react-query-builder/value-editor.d.ts +1 -2
- package/dist/components/inputs/react-query-builder/value-editor.js +119 -18
- package/dist/components/inputs/react-query-builder/value-selector.d.ts +1 -1
- package/dist/components/inputs/react-query-builder/value-selector.js +2 -2
- package/dist/components/inputs/select-clearable.d.ts +1 -2
- package/dist/components/inputs/select-clearable.js +6 -5
- package/dist/components/translations/card-error-boundary-en.d.ts +2 -2
- package/dist/components/translations/card-error-boundary-en.js +2 -2
- package/dist/components/translations/card-error-boundary-fr.d.ts +2 -2
- package/dist/components/translations/card-error-boundary-fr.js +2 -2
- package/dist/components/translations/common-button-en.d.ts +2 -2
- package/dist/components/translations/common-button-en.js +2 -2
- package/dist/components/translations/common-button-fr.d.ts +2 -2
- package/dist/components/translations/common-button-fr.js +2 -2
- package/dist/components/translations/directory-items-input-en.d.ts +2 -2
- package/dist/components/translations/directory-items-input-en.js +2 -2
- package/dist/components/translations/directory-items-input-fr.d.ts +2 -2
- package/dist/components/translations/directory-items-input-fr.js +2 -2
- package/dist/components/translations/element-search-en.d.ts +2 -2
- package/dist/components/translations/element-search-en.js +2 -2
- package/dist/components/translations/element-search-fr.d.ts +2 -2
- package/dist/components/translations/element-search-fr.js +2 -2
- package/dist/components/translations/equipment-search-en.d.ts +2 -2
- package/dist/components/translations/equipment-search-en.js +2 -2
- package/dist/components/translations/equipment-search-fr.d.ts +2 -2
- package/dist/components/translations/equipment-search-fr.js +2 -2
- package/dist/components/translations/filter-en.d.ts +3 -2
- package/dist/components/translations/filter-en.js +3 -2
- package/dist/components/translations/filter-expert-en.d.ts +2 -2
- package/dist/components/translations/filter-expert-en.js +2 -2
- package/dist/components/translations/filter-expert-fr.d.ts +2 -2
- package/dist/components/translations/filter-expert-fr.js +2 -2
- package/dist/components/translations/filter-fr.d.ts +3 -2
- package/dist/components/translations/filter-fr.js +3 -2
- package/dist/components/translations/flat-parameters-en.d.ts +2 -2
- package/dist/components/translations/flat-parameters-en.js +2 -2
- package/dist/components/translations/flat-parameters-fr.d.ts +2 -2
- package/dist/components/translations/flat-parameters-fr.js +2 -2
- package/dist/components/translations/inputs-en.d.ts +2 -2
- package/dist/components/translations/inputs-en.js +2 -2
- package/dist/components/translations/inputs-fr.d.ts +2 -2
- package/dist/components/translations/inputs-fr.js +2 -2
- package/dist/components/translations/login-en.d.ts +2 -2
- package/dist/components/translations/login-en.js +2 -2
- package/dist/components/translations/login-fr.d.ts +2 -2
- package/dist/components/translations/login-fr.js +2 -2
- package/dist/components/translations/multiple-selection-dialog-en.d.ts +2 -2
- package/dist/components/translations/multiple-selection-dialog-en.js +2 -2
- package/dist/components/translations/multiple-selection-dialog-fr.d.ts +2 -2
- package/dist/components/translations/multiple-selection-dialog-fr.js +2 -2
- package/dist/components/translations/report-viewer-en.d.ts +2 -2
- package/dist/components/translations/report-viewer-en.js +2 -2
- package/dist/components/translations/report-viewer-fr.d.ts +2 -2
- package/dist/components/translations/report-viewer-fr.js +2 -2
- package/dist/components/translations/table-en.d.ts +2 -2
- package/dist/components/translations/table-en.js +2 -2
- package/dist/components/translations/table-fr.d.ts +2 -2
- package/dist/components/translations/table-fr.js +2 -2
- package/dist/components/translations/top-bar-en.d.ts +2 -2
- package/dist/components/translations/top-bar-en.js +2 -2
- package/dist/components/translations/top-bar-fr.d.ts +2 -2
- package/dist/components/translations/top-bar-fr.js +2 -2
- package/dist/components/translations/treeview-finder-en.d.ts +2 -2
- package/dist/components/translations/treeview-finder-en.js +2 -2
- package/dist/components/translations/treeview-finder-fr.d.ts +2 -2
- package/dist/components/translations/treeview-finder-fr.js +2 -2
- package/dist/hooks/localized-countries-hook.js +1 -1
- package/dist/hooks/predefined-properties-hook.d.ts +2 -1
- package/dist/hooks/predefined-properties-hook.js +2 -2
- package/dist/hooks/useDebounce.d.ts +2 -1
- package/dist/hooks/useDebounce.js +1 -1
- package/dist/hooks/useIntlRef.d.ts +2 -1
- package/dist/hooks/useIntlRef.js +1 -1
- package/dist/hooks/usePrevious.d.ts +2 -0
- package/dist/hooks/usePrevious.js +12 -0
- package/dist/hooks/useSnackMessage.d.ts +2 -2
- package/dist/hooks/useSnackMessage.js +36 -36
- package/dist/index.d.ts +27 -16
- package/dist/index.js +183 -159
- package/dist/redux/authActions.d.ts +56 -0
- package/dist/redux/commonStore.d.ts +4 -3
- package/dist/redux/commonStore.js +2 -1
- package/dist/services/apps-metadata.js +1 -1
- package/dist/services/directory.js +6 -6
- package/dist/services/explore.js +14 -12
- package/dist/services/index.d.ts +0 -5
- package/dist/services/study.js +2 -2
- package/dist/services/utils.d.ts +1 -1
- package/dist/services/utils.js +26 -26
- package/dist/utils/AuthService.d.ts +9 -8
- package/dist/utils/AuthService.js +77 -76
- package/dist/utils/ElementIcon.d.ts +3 -2
- package/dist/utils/ElementIcon.js +4 -3
- package/dist/utils/ElementType.d.ts +3 -6
- package/dist/utils/EquipmentType.js +3 -3
- package/dist/utils/FetchStatus.d.ts +2 -1
- package/dist/utils/FetchStatus.js +1 -1
- package/dist/utils/Metadata.d.ts +15 -0
- package/dist/utils/Metadata.js +1 -0
- package/dist/utils/UserManagerMock.d.ts +50 -25
- package/dist/utils/UserManagerMock.js +118 -11
- package/dist/utils/algos.d.ts +2 -1
- package/dist/utils/algos.js +2 -2
- package/dist/utils/equipment-types-for-predefined-properties-mapper.d.ts +2 -1
- package/dist/utils/equipment-types-for-predefined-properties-mapper.js +3 -1
- package/dist/utils/field-constants.d.ts +2 -1
- package/dist/utils/field-constants.js +1 -1
- package/dist/utils/functions.js +5 -2
- package/dist/utils/types.d.ts +1 -1
- package/dist/utils/yup-config.js +1 -2
- package/package.json +10 -4
- package/dist/chunks/criteria-based-filter-edition-dialog.CAT38SvB.js +0 -1694
- package/dist/chunks/filter-properties.B7-q_yPf.js +0 -195
- package/dist/redux/actions.d.ts +0 -54
- /package/dist/assets/{criteria-based-filter-edition-dialog.css → expert-filter-form.css} +0 -0
- /package/dist/redux/{actions.js → authActions.js} +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ElementExistsType } from '../../../utils/ElementType';
|
|
2
2
|
import { UUID } from 'crypto';
|
|
3
|
-
import { FunctionComponent } from 'react';
|
|
4
3
|
|
|
5
4
|
export interface ExpertFilterEditionDialogProps {
|
|
6
5
|
id: string;
|
|
@@ -15,8 +14,8 @@ export interface ExpertFilterEditionDialogProps {
|
|
|
15
14
|
}>;
|
|
16
15
|
setSelectionForCopy: (selection: any) => void;
|
|
17
16
|
activeDirectory?: UUID;
|
|
18
|
-
elementExists?:
|
|
17
|
+
elementExists?: ElementExistsType;
|
|
19
18
|
language?: string;
|
|
20
19
|
}
|
|
21
|
-
declare
|
|
20
|
+
declare function ExpertFilterEditionDialog({ id, name, titleId, open, onClose, broadcastChannel, selectionForCopy, getFilterById, setSelectionForCopy, activeDirectory, elementExists, language, }: ExpertFilterEditionDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
22
21
|
export default ExpertFilterEditionDialog;
|
|
@@ -1,18 +1,131 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
7
|
-
import "../../../hooks/useSnackMessage.js";
|
|
8
|
-
import "../../dialogs/custom-mui-dialog.js";
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useCallback } from "react";
|
|
3
|
+
import { useForm } from "react-hook-form";
|
|
4
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
5
|
+
import FieldConstants from "../../../utils/field-constants.js";
|
|
6
|
+
import { noSelectionForCopy } from "../../../utils/equipment-types.js";
|
|
7
|
+
import { useSnackMessage } from "../../../hooks/useSnackMessage.js";
|
|
8
|
+
import CustomMuiDialog from "../../dialogs/custom-mui-dialog.js";
|
|
9
9
|
import "../../../utils/yup-config.js";
|
|
10
|
-
import
|
|
11
|
-
import "
|
|
12
|
-
import "
|
|
13
|
-
import "
|
|
14
|
-
import "
|
|
15
|
-
import "
|
|
10
|
+
import FilterForm from "../filter-form.js";
|
|
11
|
+
import { expertFilterSchema, EXPERT_FILTER_QUERY } from "./expert-filter-form.js";
|
|
12
|
+
import { saveExpertFilter } from "../utils/filter-api.js";
|
|
13
|
+
import { importExpertRules } from "./expert-filter-utils.js";
|
|
14
|
+
import { FilterType } from "../constants/filter-constants.js";
|
|
15
|
+
import FetchStatus from "../../../utils/FetchStatus.js";
|
|
16
|
+
import * as yup from "yup";
|
|
17
|
+
const formSchema = yup.object().shape({
|
|
18
|
+
[FieldConstants.NAME]: yup.string().trim().required("nameEmpty"),
|
|
19
|
+
[FieldConstants.FILTER_TYPE]: yup.string().required(),
|
|
20
|
+
[FieldConstants.EQUIPMENT_TYPE]: yup.string().required(),
|
|
21
|
+
...expertFilterSchema
|
|
22
|
+
}).required();
|
|
23
|
+
function ExpertFilterEditionDialog({
|
|
24
|
+
id,
|
|
25
|
+
name,
|
|
26
|
+
titleId,
|
|
27
|
+
open,
|
|
28
|
+
onClose,
|
|
29
|
+
broadcastChannel,
|
|
30
|
+
selectionForCopy,
|
|
31
|
+
getFilterById,
|
|
32
|
+
setSelectionForCopy,
|
|
33
|
+
activeDirectory,
|
|
34
|
+
elementExists,
|
|
35
|
+
language
|
|
36
|
+
}) {
|
|
37
|
+
var _a;
|
|
38
|
+
const { snackError } = useSnackMessage();
|
|
39
|
+
const [dataFetchStatus, setDataFetchStatus] = useState(FetchStatus.IDLE);
|
|
40
|
+
const formMethods = useForm({
|
|
41
|
+
resolver: yupResolver(formSchema)
|
|
42
|
+
});
|
|
43
|
+
const {
|
|
44
|
+
reset,
|
|
45
|
+
formState: { errors }
|
|
46
|
+
} = formMethods;
|
|
47
|
+
const nameError = errors[FieldConstants.NAME];
|
|
48
|
+
const isValidating = (_a = errors.root) == null ? void 0 : _a.isValidating;
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (id && open) {
|
|
51
|
+
setDataFetchStatus(FetchStatus.FETCHING);
|
|
52
|
+
getFilterById(id).then((response) => {
|
|
53
|
+
setDataFetchStatus(FetchStatus.FETCH_SUCCESS);
|
|
54
|
+
reset({
|
|
55
|
+
[FieldConstants.NAME]: name,
|
|
56
|
+
[FieldConstants.FILTER_TYPE]: FilterType.EXPERT.id,
|
|
57
|
+
[FieldConstants.EQUIPMENT_TYPE]: response[FieldConstants.EQUIPMENT_TYPE],
|
|
58
|
+
[EXPERT_FILTER_QUERY]: importExpertRules(
|
|
59
|
+
response[EXPERT_FILTER_QUERY]
|
|
60
|
+
)
|
|
61
|
+
});
|
|
62
|
+
}).catch((error) => {
|
|
63
|
+
setDataFetchStatus(FetchStatus.FETCH_ERROR);
|
|
64
|
+
snackError({
|
|
65
|
+
messageTxt: error.message,
|
|
66
|
+
headerId: "cannotRetrieveFilter"
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}, [id, name, open, reset, snackError, getFilterById]);
|
|
71
|
+
const onSubmit = useCallback(
|
|
72
|
+
(filterForm) => {
|
|
73
|
+
saveExpertFilter(
|
|
74
|
+
id,
|
|
75
|
+
filterForm[EXPERT_FILTER_QUERY],
|
|
76
|
+
filterForm[FieldConstants.EQUIPMENT_TYPE],
|
|
77
|
+
filterForm[FieldConstants.NAME],
|
|
78
|
+
"",
|
|
79
|
+
// The description can not be edited from this dialog
|
|
80
|
+
false,
|
|
81
|
+
null,
|
|
82
|
+
onClose,
|
|
83
|
+
(error) => {
|
|
84
|
+
snackError({
|
|
85
|
+
messageTxt: error
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
if (selectionForCopy.sourceItemUuid === id) {
|
|
90
|
+
setSelectionForCopy(noSelectionForCopy);
|
|
91
|
+
broadcastChannel.postMessage({
|
|
92
|
+
noSelectionForCopy
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
[
|
|
97
|
+
broadcastChannel,
|
|
98
|
+
id,
|
|
99
|
+
onClose,
|
|
100
|
+
selectionForCopy.sourceItemUuid,
|
|
101
|
+
snackError,
|
|
102
|
+
setSelectionForCopy
|
|
103
|
+
]
|
|
104
|
+
);
|
|
105
|
+
const isDataReady = dataFetchStatus === FetchStatus.FETCH_SUCCESS;
|
|
106
|
+
return /* @__PURE__ */ jsx(
|
|
107
|
+
CustomMuiDialog,
|
|
108
|
+
{
|
|
109
|
+
open,
|
|
110
|
+
onClose,
|
|
111
|
+
onSave: onSubmit,
|
|
112
|
+
formSchema,
|
|
113
|
+
formMethods,
|
|
114
|
+
titleId,
|
|
115
|
+
removeOptional: true,
|
|
116
|
+
disabledSave: !!nameError || !!isValidating,
|
|
117
|
+
isDataFetching: dataFetchStatus === FetchStatus.FETCHING,
|
|
118
|
+
language,
|
|
119
|
+
children: isDataReady && /* @__PURE__ */ jsx(
|
|
120
|
+
FilterForm,
|
|
121
|
+
{
|
|
122
|
+
activeDirectory,
|
|
123
|
+
elementExists
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
}
|
|
16
129
|
export {
|
|
17
|
-
|
|
130
|
+
ExpertFilterEditionDialog as default
|
|
18
131
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FieldType } from './expert-filter.type';
|
|
2
|
-
import { FunctionComponent } from 'react';
|
|
3
2
|
|
|
4
3
|
import * as yup from 'yup';
|
|
5
4
|
export declare const EXPERT_FILTER_QUERY = "rules";
|
|
5
|
+
export declare const rqbQuerySchemaValidator: (schema: yup.Schema) => yup.Schema<any, any, any, "">;
|
|
6
6
|
export declare const expertFilterSchema: {
|
|
7
7
|
rules: yup.ObjectSchema<{}, yup.AnyObject, {}, "">;
|
|
8
8
|
};
|
|
@@ -17,5 +17,5 @@ export declare function getExpertFilterEmptyFormData(): {
|
|
|
17
17
|
}[];
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
declare
|
|
20
|
+
declare function ExpertFilterForm(): import("react/jsx-runtime").JSX.Element;
|
|
21
21
|
export default ExpertFilterForm;
|
|
@@ -1,22 +1,117 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "react";
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
import {
|
|
6
|
-
import "react-hook-form";
|
|
7
|
-
import "
|
|
8
|
-
import "
|
|
9
|
-
import "
|
|
10
|
-
import "./expert-filter.
|
|
11
|
-
import "
|
|
12
|
-
import "
|
|
13
|
-
import "../../../utils/field-constants.js";
|
|
14
|
-
import "../../inputs/react-hook-form/select-inputs/input-with-popup-confirmation.js";
|
|
15
|
-
import "../../inputs/react-hook-form/select-inputs/select-input.js";
|
|
16
|
-
import "../constants/filter-constants.js";
|
|
1
|
+
import '../../../assets/expert-filter-form.css';
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useMemo } from "react";
|
|
4
|
+
import Grid from "@mui/material/Grid";
|
|
5
|
+
import { formatQuery } from "react-querybuilder";
|
|
6
|
+
import { useFormContext, useWatch } from "react-hook-form";
|
|
7
|
+
import * as yup from "yup";
|
|
8
|
+
import { v4 } from "uuid";
|
|
9
|
+
import { useIntl } from "react-intl";
|
|
10
|
+
import { testQuery } from "./expert-filter-utils.js";
|
|
11
|
+
import { COMBINATOR_OPTIONS, OPERATOR_OPTIONS, EXPERT_FILTER_EQUIPMENTS, RULES, fields } from "./expert-filter-constants.js";
|
|
12
|
+
import { FieldType } from "./expert-filter.type.js";
|
|
13
|
+
import FieldConstants from "../../../utils/field-constants.js";
|
|
14
|
+
import InputWithPopupConfirmation from "../../inputs/react-hook-form/select-inputs/input-with-popup-confirmation.js";
|
|
15
|
+
import SelectInput from "../../inputs/react-hook-form/select-inputs/select-input.js";
|
|
16
|
+
import { FilterType } from "../constants/filter-constants.js";
|
|
17
|
+
import CustomReactQueryBuilder from "../../inputs/react-query-builder/custom-react-query-builder.js";
|
|
18
|
+
yup.setLocale({
|
|
19
|
+
mixed: {
|
|
20
|
+
required: "YupRequired",
|
|
21
|
+
notType: ({ type }) => {
|
|
22
|
+
if (type === "number") {
|
|
23
|
+
return "YupNotTypeNumber";
|
|
24
|
+
}
|
|
25
|
+
return "YupNotTypeDefault";
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const EXPERT_FILTER_QUERY = "rules";
|
|
30
|
+
function isSupportedEquipmentType(equipmentType) {
|
|
31
|
+
return Object.values(EXPERT_FILTER_EQUIPMENTS).map((equipments) => equipments.id).includes(equipmentType);
|
|
32
|
+
}
|
|
33
|
+
const rqbQuerySchemaValidator = (schema) => schema.test(RULES.EMPTY_GROUP, RULES.EMPTY_GROUP, (query) => {
|
|
34
|
+
return testQuery(RULES.EMPTY_GROUP, query);
|
|
35
|
+
}).test(RULES.EMPTY_RULE, RULES.EMPTY_RULE, (query) => {
|
|
36
|
+
return testQuery(RULES.EMPTY_RULE, query);
|
|
37
|
+
}).test(RULES.INCORRECT_RULE, RULES.INCORRECT_RULE, (query) => {
|
|
38
|
+
return testQuery(RULES.INCORRECT_RULE, query);
|
|
39
|
+
}).test(RULES.BETWEEN_RULE, RULES.BETWEEN_RULE, (query) => {
|
|
40
|
+
return testQuery(RULES.BETWEEN_RULE, query);
|
|
41
|
+
});
|
|
42
|
+
const expertFilterSchema = {
|
|
43
|
+
[EXPERT_FILTER_QUERY]: yup.object().when([FieldConstants.FILTER_TYPE], {
|
|
44
|
+
is: FilterType.EXPERT.id,
|
|
45
|
+
then: (schema) => schema.when([FieldConstants.EQUIPMENT_TYPE], {
|
|
46
|
+
is: (equipmentType) => isSupportedEquipmentType(equipmentType),
|
|
47
|
+
then: rqbQuerySchemaValidator
|
|
48
|
+
})
|
|
49
|
+
})
|
|
50
|
+
};
|
|
51
|
+
const defaultQuery = {
|
|
52
|
+
combinator: COMBINATOR_OPTIONS.AND.name,
|
|
53
|
+
rules: [
|
|
54
|
+
{
|
|
55
|
+
id: v4(),
|
|
56
|
+
field: FieldType.ID,
|
|
57
|
+
operator: OPERATOR_OPTIONS.CONTAINS.name,
|
|
58
|
+
value: ""
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
};
|
|
62
|
+
function getExpertFilterEmptyFormData() {
|
|
63
|
+
return {
|
|
64
|
+
[EXPERT_FILTER_QUERY]: defaultQuery
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function ExpertFilterForm() {
|
|
68
|
+
const intl = useIntl();
|
|
69
|
+
const { getValues, setValue } = useFormContext();
|
|
70
|
+
const openConfirmationPopup = useCallback(() => {
|
|
71
|
+
return formatQuery(getValues(EXPERT_FILTER_QUERY), "json_without_ids") !== formatQuery(defaultQuery, "json_without_ids");
|
|
72
|
+
}, [getValues]);
|
|
73
|
+
const handleResetOnConfirmation = useCallback(() => {
|
|
74
|
+
setValue(EXPERT_FILTER_QUERY, defaultQuery);
|
|
75
|
+
}, [setValue]);
|
|
76
|
+
const watchEquipmentType = useWatch({
|
|
77
|
+
name: FieldConstants.EQUIPMENT_TYPE
|
|
78
|
+
});
|
|
79
|
+
const translatedFields = useMemo(() => {
|
|
80
|
+
var _a;
|
|
81
|
+
return (_a = fields[watchEquipmentType]) == null ? void 0 : _a.map((field) => {
|
|
82
|
+
return {
|
|
83
|
+
...field,
|
|
84
|
+
label: intl.formatMessage({ id: field.label })
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
}, [intl, watchEquipmentType]);
|
|
88
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, item: true, spacing: 2, children: [
|
|
89
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
|
|
90
|
+
InputWithPopupConfirmation,
|
|
91
|
+
{
|
|
92
|
+
Input: SelectInput,
|
|
93
|
+
name: FieldConstants.EQUIPMENT_TYPE,
|
|
94
|
+
options: Object.values(EXPERT_FILTER_EQUIPMENTS),
|
|
95
|
+
label: "equipmentType",
|
|
96
|
+
shouldOpenPopup: openConfirmationPopup,
|
|
97
|
+
resetOnConfirmation: handleResetOnConfirmation,
|
|
98
|
+
message: "changeTypeMessage",
|
|
99
|
+
validateButtonLabel: "button.changeType"
|
|
100
|
+
}
|
|
101
|
+
) }),
|
|
102
|
+
watchEquipmentType && isSupportedEquipmentType(watchEquipmentType) && /* @__PURE__ */ jsx(
|
|
103
|
+
CustomReactQueryBuilder,
|
|
104
|
+
{
|
|
105
|
+
name: EXPERT_FILTER_QUERY,
|
|
106
|
+
fields: translatedFields
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
] });
|
|
110
|
+
}
|
|
17
111
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
112
|
+
EXPERT_FILTER_QUERY,
|
|
113
|
+
ExpertFilterForm as default,
|
|
114
|
+
expertFilterSchema,
|
|
115
|
+
getExpertFilterEmptyFormData,
|
|
116
|
+
rqbQuerySchemaValidator
|
|
22
117
|
};
|
|
@@ -81,7 +81,7 @@ export declare const getOperators: (fieldName: string, intl: IntlShape) => {
|
|
|
81
81
|
export declare function exportExpertRules(query: RuleGroupType): RuleGroupTypeExport;
|
|
82
82
|
export declare function importExpertRules(query: RuleGroupTypeExport): RuleGroupType;
|
|
83
83
|
export declare function countRules(query: RuleGroupTypeAny): number;
|
|
84
|
-
export declare const testQuery: (check: string, query: RuleGroupTypeAny) => boolean;
|
|
85
84
|
export declare const queryValidator: QueryValidator;
|
|
86
|
-
export declare
|
|
85
|
+
export declare const testQuery: (check: string, query: RuleGroupTypeAny) => boolean;
|
|
87
86
|
export declare function getNumberOfSiblings(path: number[], query: RuleGroupTypeAny): number;
|
|
87
|
+
export declare function recursiveRemove(query: RuleGroupTypeAny, path: number[]): RuleGroupTypeAny;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defaultOperators, getParentPath,
|
|
2
|
-
import { FieldType, DataType } from "./expert-filter.type.js";
|
|
1
|
+
import { defaultOperators, getParentPath, findPath, remove } from "react-querybuilder";
|
|
3
2
|
import { validate } from "uuid";
|
|
3
|
+
import { FieldType, DataType } from "./expert-filter.type.js";
|
|
4
4
|
import { FIELDS_OPTIONS, OPERATOR_OPTIONS, RULES } from "./expert-filter-constants.js";
|
|
5
5
|
import { isBlankOrEmpty, microUnitToUnit, unitToMicroUnit } from "../../../utils/conversion-utils.js";
|
|
6
6
|
const microUnits = [
|
|
@@ -37,10 +37,10 @@ const getDataType = (fieldName, operator) => {
|
|
|
37
37
|
};
|
|
38
38
|
const getOperators = (fieldName, intl) => {
|
|
39
39
|
const field = Object.values(FIELDS_OPTIONS).find(
|
|
40
|
-
(
|
|
40
|
+
(fieldOption) => fieldOption.name === fieldName
|
|
41
41
|
);
|
|
42
42
|
switch (field == null ? void 0 : field.dataType) {
|
|
43
|
-
case DataType.STRING:
|
|
43
|
+
case DataType.STRING: {
|
|
44
44
|
let stringOperators = [
|
|
45
45
|
OPERATOR_OPTIONS.CONTAINS,
|
|
46
46
|
OPERATOR_OPTIONS.IS,
|
|
@@ -63,8 +63,9 @@ const getOperators = (fieldName, intl) => {
|
|
|
63
63
|
name: operator.name,
|
|
64
64
|
label: intl.formatMessage({ id: operator.label })
|
|
65
65
|
}));
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
}
|
|
67
|
+
case DataType.NUMBER: {
|
|
68
|
+
const numberOperators = [
|
|
68
69
|
OPERATOR_OPTIONS.EQUALS,
|
|
69
70
|
OPERATOR_OPTIONS.GREATER,
|
|
70
71
|
OPERATOR_OPTIONS.GREATER_OR_EQUALS,
|
|
@@ -78,7 +79,8 @@ const getOperators = (fieldName, intl) => {
|
|
|
78
79
|
name: operator.name,
|
|
79
80
|
label: intl.formatMessage({ id: operator.label })
|
|
80
81
|
}));
|
|
81
|
-
|
|
82
|
+
}
|
|
83
|
+
case DataType.BOOLEAN: {
|
|
82
84
|
let booleanOperators = [OPERATOR_OPTIONS.EQUALS];
|
|
83
85
|
if (field.name === FieldType.AUTOMATE) {
|
|
84
86
|
booleanOperators = [
|
|
@@ -90,7 +92,8 @@ const getOperators = (fieldName, intl) => {
|
|
|
90
92
|
name: operator.name,
|
|
91
93
|
label: intl.formatMessage({ id: operator.label })
|
|
92
94
|
}));
|
|
93
|
-
|
|
95
|
+
}
|
|
96
|
+
case DataType.ENUM: {
|
|
94
97
|
let enumOperators = [
|
|
95
98
|
OPERATOR_OPTIONS.EQUALS,
|
|
96
99
|
OPERATOR_OPTIONS.NOT_EQUALS,
|
|
@@ -105,13 +108,15 @@ const getOperators = (fieldName, intl) => {
|
|
|
105
108
|
name: operator.name,
|
|
106
109
|
label: intl.formatMessage({ id: operator.label })
|
|
107
110
|
}));
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
}
|
|
112
|
+
case DataType.PROPERTY: {
|
|
113
|
+
const propertiesOperators = [OPERATOR_OPTIONS.IS];
|
|
110
114
|
return propertiesOperators.map((operator) => ({
|
|
111
115
|
name: operator.name,
|
|
112
116
|
label: intl.formatMessage({ id: operator.label })
|
|
113
117
|
}));
|
|
114
|
-
|
|
118
|
+
}
|
|
119
|
+
case DataType.COMBINATOR: {
|
|
115
120
|
const combinatorOperators = [OPERATOR_OPTIONS.IS];
|
|
116
121
|
if (field.name === FieldType.REMOTE_REGULATED_TERMINAL) {
|
|
117
122
|
combinatorOperators.push(OPERATOR_OPTIONS.EXISTS);
|
|
@@ -121,16 +126,17 @@ const getOperators = (fieldName, intl) => {
|
|
|
121
126
|
name: operator.name,
|
|
122
127
|
label: intl.formatMessage({ id: operator.label })
|
|
123
128
|
}));
|
|
129
|
+
}
|
|
130
|
+
default:
|
|
131
|
+
return defaultOperators;
|
|
124
132
|
}
|
|
125
|
-
return defaultOperators;
|
|
126
133
|
};
|
|
127
134
|
function changeValueUnit(value, field) {
|
|
128
135
|
if (microUnits.includes(field)) {
|
|
129
136
|
if (!Array.isArray(value)) {
|
|
130
137
|
return microUnitToUnit(value);
|
|
131
|
-
} else {
|
|
132
|
-
return value.map((a) => microUnitToUnit(a));
|
|
133
138
|
}
|
|
139
|
+
return value.map((a) => microUnitToUnit(a));
|
|
134
140
|
}
|
|
135
141
|
return value;
|
|
136
142
|
}
|
|
@@ -143,6 +149,7 @@ function exportExpertRules(query) {
|
|
|
143
149
|
return transformCompositeRule(rule);
|
|
144
150
|
}
|
|
145
151
|
return {
|
|
152
|
+
id: rule.id,
|
|
146
153
|
field: rule.field,
|
|
147
154
|
operator: dataType !== DataType.PROPERTY ? (_a = Object.values(OPERATOR_OPTIONS).find(
|
|
148
155
|
(operator) => operator.name === rule.operator
|
|
@@ -166,6 +173,7 @@ function exportExpertRules(query) {
|
|
|
166
173
|
})
|
|
167
174
|
);
|
|
168
175
|
return {
|
|
176
|
+
id: compositeGroup.id,
|
|
169
177
|
combinator: compositeGroup.combinator,
|
|
170
178
|
dataType: DataType.COMBINATOR,
|
|
171
179
|
rules: transformedRules,
|
|
@@ -180,11 +188,11 @@ function exportExpertRules(query) {
|
|
|
180
188
|
const transformedRules = group.rules.map((ruleOrGroup) => {
|
|
181
189
|
if ("rules" in ruleOrGroup) {
|
|
182
190
|
return transformGroup(ruleOrGroup);
|
|
183
|
-
} else {
|
|
184
|
-
return transformRule(ruleOrGroup);
|
|
185
191
|
}
|
|
192
|
+
return transformRule(ruleOrGroup);
|
|
186
193
|
});
|
|
187
194
|
return {
|
|
195
|
+
id: group.id,
|
|
188
196
|
combinator: group.combinator,
|
|
189
197
|
dataType: DataType.COMBINATOR,
|
|
190
198
|
rules: transformedRules
|
|
@@ -200,21 +208,21 @@ function importExpertRules(query) {
|
|
|
200
208
|
propertyValues: rule.propertyValues,
|
|
201
209
|
propertyOperator: rule.operator
|
|
202
210
|
};
|
|
203
|
-
}
|
|
211
|
+
}
|
|
212
|
+
if (rule.values) {
|
|
204
213
|
if (rule.dataType === DataType.NUMBER) {
|
|
205
214
|
return rule.values.map((value) => parseFloat(value)).map((numberValue) => {
|
|
206
215
|
return microUnits.includes(rule.field) ? unitToMicroUnit(numberValue) : numberValue;
|
|
207
216
|
}).sort((a, b) => a - b);
|
|
208
|
-
} else {
|
|
209
|
-
return rule.values.sort();
|
|
210
217
|
}
|
|
211
|
-
|
|
212
|
-
return microUnits.includes(rule.field) ? unitToMicroUnit(parseFloat(rule.value)) : rule.value;
|
|
218
|
+
return rule.values.sort();
|
|
213
219
|
}
|
|
220
|
+
return microUnits.includes(rule.field) ? unitToMicroUnit(parseFloat(rule.value)) : rule.value;
|
|
214
221
|
}
|
|
215
222
|
function transformRule(rule) {
|
|
216
223
|
var _a;
|
|
217
224
|
return {
|
|
225
|
+
id: rule.id,
|
|
218
226
|
field: rule.field,
|
|
219
227
|
operator: rule.dataType !== DataType.PROPERTY ? (_a = Object.values(OPERATOR_OPTIONS).find(
|
|
220
228
|
(operator) => operator.customName === rule.operator
|
|
@@ -235,6 +243,7 @@ function importExpertRules(query) {
|
|
|
235
243
|
{}
|
|
236
244
|
);
|
|
237
245
|
return {
|
|
246
|
+
id: group.id,
|
|
238
247
|
field: group.field,
|
|
239
248
|
operator: (_a = Object.values(OPERATOR_OPTIONS).find(
|
|
240
249
|
(operator) => operator.customName === group.operator
|
|
@@ -249,16 +258,14 @@ function importExpertRules(query) {
|
|
|
249
258
|
const transformedRules = group.rules.map((ruleOrGroup) => {
|
|
250
259
|
if ("rules" in ruleOrGroup) {
|
|
251
260
|
if ("field" in ruleOrGroup && "operator" in ruleOrGroup) {
|
|
252
|
-
return transformCompositeGroup(
|
|
253
|
-
ruleOrGroup
|
|
254
|
-
);
|
|
261
|
+
return transformCompositeGroup(ruleOrGroup);
|
|
255
262
|
}
|
|
256
263
|
return transformGroup(ruleOrGroup);
|
|
257
|
-
} else {
|
|
258
|
-
return transformRule(ruleOrGroup);
|
|
259
264
|
}
|
|
265
|
+
return transformRule(ruleOrGroup);
|
|
260
266
|
});
|
|
261
267
|
return {
|
|
268
|
+
id: group.id,
|
|
262
269
|
combinator: group.combinator,
|
|
263
270
|
rules: transformedRules
|
|
264
271
|
};
|
|
@@ -266,27 +273,23 @@ function importExpertRules(query) {
|
|
|
266
273
|
return transformGroup(query);
|
|
267
274
|
}
|
|
268
275
|
function countRules(query) {
|
|
276
|
+
if (!query) {
|
|
277
|
+
return 0;
|
|
278
|
+
}
|
|
269
279
|
if ("rules" in query) {
|
|
270
280
|
const group = query;
|
|
271
281
|
return group.rules.reduce(
|
|
272
282
|
(sum, ruleOrGroup) => sum + countRules(ruleOrGroup),
|
|
273
283
|
0
|
|
274
284
|
);
|
|
275
|
-
} else {
|
|
276
|
-
return 1;
|
|
277
285
|
}
|
|
286
|
+
return 1;
|
|
278
287
|
}
|
|
279
|
-
const testQuery = (check, query) => {
|
|
280
|
-
const queryValidatorResult = queryValidator(query);
|
|
281
|
-
return !Object.values(queryValidatorResult).some((ruleValidation) => {
|
|
282
|
-
if (typeof ruleValidation !== "boolean" && ruleValidation.reasons) {
|
|
283
|
-
return ruleValidation.reasons.includes(check);
|
|
284
|
-
}
|
|
285
|
-
return false;
|
|
286
|
-
});
|
|
287
|
-
};
|
|
288
288
|
const queryValidator = (query) => {
|
|
289
289
|
const result = {};
|
|
290
|
+
if (!query) {
|
|
291
|
+
return result;
|
|
292
|
+
}
|
|
290
293
|
const validateRule = (rule) => {
|
|
291
294
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
292
295
|
const isValueAnArray = Array.isArray(rule.value);
|
|
@@ -304,7 +307,7 @@ const queryValidator = (query) => {
|
|
|
304
307
|
valid: false,
|
|
305
308
|
reasons: [RULES.EMPTY_RULE]
|
|
306
309
|
};
|
|
307
|
-
} else if (isNaN(parseFloat(rule.value[0])) || isNaN(parseFloat(rule.value[1]))) {
|
|
310
|
+
} else if (Number.isNaN(parseFloat(rule.value[0])) || Number.isNaN(parseFloat(rule.value[1]))) {
|
|
308
311
|
result[rule.id] = {
|
|
309
312
|
valid: false,
|
|
310
313
|
reasons: [RULES.INCORRECT_RULE]
|
|
@@ -325,7 +328,7 @@ const queryValidator = (query) => {
|
|
|
325
328
|
valid: false,
|
|
326
329
|
reasons: [RULES.EMPTY_RULE]
|
|
327
330
|
};
|
|
328
|
-
} else if (rule.id && isNumberInput && isNaN(parseFloat(rule.value))) {
|
|
331
|
+
} else if (rule.id && isNumberInput && Number.isNaN(parseFloat(rule.value))) {
|
|
329
332
|
result[rule.id] = {
|
|
330
333
|
valid: false,
|
|
331
334
|
reasons: [RULES.INCORRECT_RULE]
|
|
@@ -381,17 +384,26 @@ const queryValidator = (query) => {
|
|
|
381
384
|
validateGroup(query);
|
|
382
385
|
return result;
|
|
383
386
|
};
|
|
387
|
+
const testQuery = (check, query) => {
|
|
388
|
+
const queryValidatorResult = queryValidator(query);
|
|
389
|
+
return !Object.values(queryValidatorResult).some((ruleValidation) => {
|
|
390
|
+
if (typeof ruleValidation !== "boolean" && ruleValidation.reasons) {
|
|
391
|
+
return ruleValidation.reasons.includes(check);
|
|
392
|
+
}
|
|
393
|
+
return false;
|
|
394
|
+
});
|
|
395
|
+
};
|
|
396
|
+
function getNumberOfSiblings(path, query) {
|
|
397
|
+
var _a;
|
|
398
|
+
const parentPath = getParentPath(path);
|
|
399
|
+
const parentGroup = findPath(parentPath, query);
|
|
400
|
+
return (_a = parentGroup == null ? void 0 : parentGroup.rules) == null ? void 0 : _a.length;
|
|
401
|
+
}
|
|
384
402
|
function recursiveRemove(query, path) {
|
|
385
403
|
if (getNumberOfSiblings(path, query) === 1 && path.toString() !== [0].toString()) {
|
|
386
404
|
return recursiveRemove(query, getParentPath(path));
|
|
387
|
-
} else {
|
|
388
|
-
return remove(query, path);
|
|
389
405
|
}
|
|
390
|
-
|
|
391
|
-
function getNumberOfSiblings(path, query) {
|
|
392
|
-
const parentPath = getParentPath(path);
|
|
393
|
-
const parentGroup = findPath(parentPath, query);
|
|
394
|
-
return parentGroup.rules.length;
|
|
406
|
+
return remove(query, path);
|
|
395
407
|
}
|
|
396
408
|
export {
|
|
397
409
|
countRules,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UUID } from 'crypto';
|
|
1
2
|
import { FullField } from 'react-querybuilder';
|
|
2
3
|
|
|
3
4
|
export declare enum OperatorType {
|
|
@@ -117,6 +118,7 @@ export type OperatorOption = {
|
|
|
117
118
|
label: string;
|
|
118
119
|
};
|
|
119
120
|
export interface RuleTypeExport {
|
|
121
|
+
id?: UUID;
|
|
120
122
|
field: FieldType;
|
|
121
123
|
operator: OperatorType;
|
|
122
124
|
value: string | number | undefined;
|
|
@@ -126,6 +128,7 @@ export interface RuleTypeExport {
|
|
|
126
128
|
propertyValues?: string[];
|
|
127
129
|
}
|
|
128
130
|
export interface RuleGroupTypeExport {
|
|
131
|
+
id?: UUID;
|
|
129
132
|
combinator: CombinatorType;
|
|
130
133
|
dataType: DataType;
|
|
131
134
|
field?: FieldType;
|
|
@@ -139,6 +142,7 @@ export interface CompositeField extends FullField {
|
|
|
139
142
|
};
|
|
140
143
|
}
|
|
141
144
|
export interface CompositeGroup {
|
|
145
|
+
id?: string;
|
|
142
146
|
combinator: string;
|
|
143
147
|
rules: {
|
|
144
148
|
[field: string]: CompositeRule;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ElementExistsType } from '../../../utils/ElementType';
|
|
2
2
|
import { UUID } from 'crypto';
|
|
3
|
-
import { FunctionComponent } from 'react';
|
|
4
3
|
|
|
5
4
|
interface ExplicitNamingFilterEditionDialogProps {
|
|
6
5
|
id: string;
|
|
@@ -13,8 +12,8 @@ interface ExplicitNamingFilterEditionDialogProps {
|
|
|
13
12
|
setSelectionForCopy: (selection: any) => void;
|
|
14
13
|
getFilterById: (id: string) => Promise<any>;
|
|
15
14
|
activeDirectory?: UUID;
|
|
16
|
-
elementExists?:
|
|
15
|
+
elementExists?: ElementExistsType;
|
|
17
16
|
language?: string;
|
|
18
17
|
}
|
|
19
|
-
declare
|
|
18
|
+
declare function ExplicitNamingFilterEditionDialog({ id, name, titleId, open, onClose, broadcastChannel, selectionForCopy, setSelectionForCopy, getFilterById, activeDirectory, elementExists, language, }: ExplicitNamingFilterEditionDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
20
19
|
export default ExplicitNamingFilterEditionDialog;
|