@gridsuite/commons-ui 0.61.4 → 0.63.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/dist/components/AuthenticationRouter/AuthenticationRouter.d.ts +1 -1
- package/dist/components/AuthenticationRouter/AuthenticationRouter.js +5 -5
- package/dist/components/AuthenticationRouter/index.d.ts +3 -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 +1 -1
- 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 +1 -1
- 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 +1 -2
- 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 +2 -27
- 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 +1 -1
- 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 +1 -2
- package/dist/components/filter/expert/expert-filter-form.js +141 -20
- package/dist/components/filter/expert/expert-filter-utils.d.ts +2 -2
- package/dist/components/filter/expert/expert-filter-utils.js +45 -46
- 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/useSnackMessage.d.ts +2 -2
- package/dist/hooks/useSnackMessage.js +36 -36
- package/dist/index.d.ts +13 -14
- package/dist/index.js +163 -157
- package/dist/redux/commonStore.d.ts +1 -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 +21 -12
- package/dist/utils/AuthService.js +88 -143
- 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/assets/{criteria-based-filter-edition-dialog.css → expert-filter-form.css} +0 -0
|
@@ -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,5 +1,4 @@
|
|
|
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";
|
|
@@ -17,5 +16,5 @@ export declare function getExpertFilterEmptyFormData(): {
|
|
|
17
16
|
}[];
|
|
18
17
|
};
|
|
19
18
|
};
|
|
20
|
-
declare
|
|
19
|
+
declare function ExpertFilterForm(): import("react/jsx-runtime").JSX.Element;
|
|
21
20
|
export default ExpertFilterForm;
|
|
@@ -1,22 +1,143 @@
|
|
|
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 { RULES, COMBINATOR_OPTIONS, OPERATOR_OPTIONS, EXPERT_FILTER_EQUIPMENTS, 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 expertFilterSchema = {
|
|
34
|
+
[EXPERT_FILTER_QUERY]: yup.object().when([FieldConstants.FILTER_TYPE], {
|
|
35
|
+
is: FilterType.EXPERT.id,
|
|
36
|
+
then: (schema) => schema.when([FieldConstants.EQUIPMENT_TYPE], {
|
|
37
|
+
is: (equipmentType) => isSupportedEquipmentType(equipmentType),
|
|
38
|
+
then: (innerSchema) => innerSchema.test(
|
|
39
|
+
RULES.EMPTY_GROUP,
|
|
40
|
+
RULES.EMPTY_GROUP,
|
|
41
|
+
(query) => {
|
|
42
|
+
return testQuery(
|
|
43
|
+
RULES.EMPTY_GROUP,
|
|
44
|
+
query
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
).test(
|
|
48
|
+
RULES.EMPTY_RULE,
|
|
49
|
+
RULES.EMPTY_RULE,
|
|
50
|
+
(query) => {
|
|
51
|
+
return testQuery(
|
|
52
|
+
RULES.EMPTY_RULE,
|
|
53
|
+
query
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
).test(
|
|
57
|
+
RULES.INCORRECT_RULE,
|
|
58
|
+
RULES.INCORRECT_RULE,
|
|
59
|
+
(query) => {
|
|
60
|
+
return testQuery(
|
|
61
|
+
RULES.INCORRECT_RULE,
|
|
62
|
+
query
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
).test(
|
|
66
|
+
RULES.BETWEEN_RULE,
|
|
67
|
+
RULES.BETWEEN_RULE,
|
|
68
|
+
(query) => {
|
|
69
|
+
return testQuery(
|
|
70
|
+
RULES.BETWEEN_RULE,
|
|
71
|
+
query
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
};
|
|
78
|
+
const defaultQuery = {
|
|
79
|
+
combinator: COMBINATOR_OPTIONS.AND.name,
|
|
80
|
+
rules: [
|
|
81
|
+
{
|
|
82
|
+
id: v4(),
|
|
83
|
+
field: FieldType.ID,
|
|
84
|
+
operator: OPERATOR_OPTIONS.CONTAINS.name,
|
|
85
|
+
value: ""
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
};
|
|
89
|
+
function getExpertFilterEmptyFormData() {
|
|
90
|
+
return {
|
|
91
|
+
[EXPERT_FILTER_QUERY]: defaultQuery
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function ExpertFilterForm() {
|
|
95
|
+
const intl = useIntl();
|
|
96
|
+
const { getValues, setValue } = useFormContext();
|
|
97
|
+
const openConfirmationPopup = useCallback(() => {
|
|
98
|
+
return formatQuery(getValues(EXPERT_FILTER_QUERY), "json_without_ids") !== formatQuery(defaultQuery, "json_without_ids");
|
|
99
|
+
}, [getValues]);
|
|
100
|
+
const handleResetOnConfirmation = useCallback(() => {
|
|
101
|
+
setValue(EXPERT_FILTER_QUERY, defaultQuery);
|
|
102
|
+
}, [setValue]);
|
|
103
|
+
const watchEquipmentType = useWatch({
|
|
104
|
+
name: FieldConstants.EQUIPMENT_TYPE
|
|
105
|
+
});
|
|
106
|
+
const translatedFields = useMemo(() => {
|
|
107
|
+
var _a;
|
|
108
|
+
return (_a = fields[watchEquipmentType]) == null ? void 0 : _a.map((field) => {
|
|
109
|
+
return {
|
|
110
|
+
...field,
|
|
111
|
+
label: intl.formatMessage({ id: field.label })
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
}, [intl, watchEquipmentType]);
|
|
115
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, item: true, spacing: 2, children: [
|
|
116
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
|
|
117
|
+
InputWithPopupConfirmation,
|
|
118
|
+
{
|
|
119
|
+
Input: SelectInput,
|
|
120
|
+
name: FieldConstants.EQUIPMENT_TYPE,
|
|
121
|
+
options: Object.values(EXPERT_FILTER_EQUIPMENTS),
|
|
122
|
+
label: "equipmentType",
|
|
123
|
+
shouldOpenPopup: openConfirmationPopup,
|
|
124
|
+
resetOnConfirmation: handleResetOnConfirmation,
|
|
125
|
+
message: "changeTypeMessage",
|
|
126
|
+
validateButtonLabel: "button.changeType"
|
|
127
|
+
}
|
|
128
|
+
) }),
|
|
129
|
+
watchEquipmentType && isSupportedEquipmentType(watchEquipmentType) && /* @__PURE__ */ jsx(
|
|
130
|
+
CustomReactQueryBuilder,
|
|
131
|
+
{
|
|
132
|
+
name: EXPERT_FILTER_QUERY,
|
|
133
|
+
fields: translatedFields
|
|
134
|
+
}
|
|
135
|
+
)
|
|
136
|
+
] });
|
|
137
|
+
}
|
|
17
138
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
139
|
+
EXPERT_FILTER_QUERY,
|
|
140
|
+
ExpertFilterForm as default,
|
|
141
|
+
expertFilterSchema,
|
|
142
|
+
getExpertFilterEmptyFormData
|
|
22
143
|
};
|
|
@@ -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
|
}
|
|
@@ -180,9 +186,8 @@ function exportExpertRules(query) {
|
|
|
180
186
|
const transformedRules = group.rules.map((ruleOrGroup) => {
|
|
181
187
|
if ("rules" in ruleOrGroup) {
|
|
182
188
|
return transformGroup(ruleOrGroup);
|
|
183
|
-
} else {
|
|
184
|
-
return transformRule(ruleOrGroup);
|
|
185
189
|
}
|
|
190
|
+
return transformRule(ruleOrGroup);
|
|
186
191
|
});
|
|
187
192
|
return {
|
|
188
193
|
combinator: group.combinator,
|
|
@@ -200,17 +205,16 @@ function importExpertRules(query) {
|
|
|
200
205
|
propertyValues: rule.propertyValues,
|
|
201
206
|
propertyOperator: rule.operator
|
|
202
207
|
};
|
|
203
|
-
}
|
|
208
|
+
}
|
|
209
|
+
if (rule.values) {
|
|
204
210
|
if (rule.dataType === DataType.NUMBER) {
|
|
205
211
|
return rule.values.map((value) => parseFloat(value)).map((numberValue) => {
|
|
206
212
|
return microUnits.includes(rule.field) ? unitToMicroUnit(numberValue) : numberValue;
|
|
207
213
|
}).sort((a, b) => a - b);
|
|
208
|
-
} else {
|
|
209
|
-
return rule.values.sort();
|
|
210
214
|
}
|
|
211
|
-
|
|
212
|
-
return microUnits.includes(rule.field) ? unitToMicroUnit(parseFloat(rule.value)) : rule.value;
|
|
215
|
+
return rule.values.sort();
|
|
213
216
|
}
|
|
217
|
+
return microUnits.includes(rule.field) ? unitToMicroUnit(parseFloat(rule.value)) : rule.value;
|
|
214
218
|
}
|
|
215
219
|
function transformRule(rule) {
|
|
216
220
|
var _a;
|
|
@@ -249,14 +253,11 @@ function importExpertRules(query) {
|
|
|
249
253
|
const transformedRules = group.rules.map((ruleOrGroup) => {
|
|
250
254
|
if ("rules" in ruleOrGroup) {
|
|
251
255
|
if ("field" in ruleOrGroup && "operator" in ruleOrGroup) {
|
|
252
|
-
return transformCompositeGroup(
|
|
253
|
-
ruleOrGroup
|
|
254
|
-
);
|
|
256
|
+
return transformCompositeGroup(ruleOrGroup);
|
|
255
257
|
}
|
|
256
258
|
return transformGroup(ruleOrGroup);
|
|
257
|
-
} else {
|
|
258
|
-
return transformRule(ruleOrGroup);
|
|
259
259
|
}
|
|
260
|
+
return transformRule(ruleOrGroup);
|
|
260
261
|
});
|
|
261
262
|
return {
|
|
262
263
|
combinator: group.combinator,
|
|
@@ -272,19 +273,9 @@ function countRules(query) {
|
|
|
272
273
|
(sum, ruleOrGroup) => sum + countRules(ruleOrGroup),
|
|
273
274
|
0
|
|
274
275
|
);
|
|
275
|
-
} else {
|
|
276
|
-
return 1;
|
|
277
276
|
}
|
|
277
|
+
return 1;
|
|
278
278
|
}
|
|
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
279
|
const queryValidator = (query) => {
|
|
289
280
|
const result = {};
|
|
290
281
|
const validateRule = (rule) => {
|
|
@@ -304,7 +295,7 @@ const queryValidator = (query) => {
|
|
|
304
295
|
valid: false,
|
|
305
296
|
reasons: [RULES.EMPTY_RULE]
|
|
306
297
|
};
|
|
307
|
-
} else if (isNaN(parseFloat(rule.value[0])) || isNaN(parseFloat(rule.value[1]))) {
|
|
298
|
+
} else if (Number.isNaN(parseFloat(rule.value[0])) || Number.isNaN(parseFloat(rule.value[1]))) {
|
|
308
299
|
result[rule.id] = {
|
|
309
300
|
valid: false,
|
|
310
301
|
reasons: [RULES.INCORRECT_RULE]
|
|
@@ -325,7 +316,7 @@ const queryValidator = (query) => {
|
|
|
325
316
|
valid: false,
|
|
326
317
|
reasons: [RULES.EMPTY_RULE]
|
|
327
318
|
};
|
|
328
|
-
} else if (rule.id && isNumberInput && isNaN(parseFloat(rule.value))) {
|
|
319
|
+
} else if (rule.id && isNumberInput && Number.isNaN(parseFloat(rule.value))) {
|
|
329
320
|
result[rule.id] = {
|
|
330
321
|
valid: false,
|
|
331
322
|
reasons: [RULES.INCORRECT_RULE]
|
|
@@ -381,18 +372,26 @@ const queryValidator = (query) => {
|
|
|
381
372
|
validateGroup(query);
|
|
382
373
|
return result;
|
|
383
374
|
};
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
375
|
+
const testQuery = (check, query) => {
|
|
376
|
+
const queryValidatorResult = queryValidator(query);
|
|
377
|
+
return !Object.values(queryValidatorResult).some((ruleValidation) => {
|
|
378
|
+
if (typeof ruleValidation !== "boolean" && ruleValidation.reasons) {
|
|
379
|
+
return ruleValidation.reasons.includes(check);
|
|
380
|
+
}
|
|
381
|
+
return false;
|
|
382
|
+
});
|
|
383
|
+
};
|
|
391
384
|
function getNumberOfSiblings(path, query) {
|
|
392
385
|
const parentPath = getParentPath(path);
|
|
393
386
|
const parentGroup = findPath(parentPath, query);
|
|
394
387
|
return parentGroup.rules.length;
|
|
395
388
|
}
|
|
389
|
+
function recursiveRemove(query, path) {
|
|
390
|
+
if (getNumberOfSiblings(path, query) === 1 && path.toString() !== [0].toString()) {
|
|
391
|
+
return recursiveRemove(query, getParentPath(path));
|
|
392
|
+
}
|
|
393
|
+
return remove(query, path);
|
|
394
|
+
}
|
|
396
395
|
export {
|
|
397
396
|
countRules,
|
|
398
397
|
exportExpertRules,
|
|
@@ -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;
|