@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
package/dist/components/inputs/react-query-builder/composite-rule-editor/rule-value-editor.js
CHANGED
|
@@ -8,7 +8,7 @@ const styles = {
|
|
|
8
8
|
alignItems: "baseline"
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
function RuleValueEditor(props) {
|
|
12
12
|
var _a, _b;
|
|
13
13
|
const {
|
|
14
14
|
schema: {
|
|
@@ -20,10 +20,10 @@ const RuleValueEditor = (props) => {
|
|
|
20
20
|
} = props;
|
|
21
21
|
const intl = useIntl();
|
|
22
22
|
const operator = (rule == null ? void 0 : rule.operator) ?? ((_a = fieldData.operators) == null ? void 0 : _a.map((op) => op.name)[0]);
|
|
23
|
-
const handleOnChangeOperator = (
|
|
23
|
+
const handleOnChangeOperator = (newOperator) => {
|
|
24
24
|
handleOnChangeRule({
|
|
25
25
|
...rule,
|
|
26
|
-
operator:
|
|
26
|
+
operator: newOperator
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
const handleOnChangeValue = (value) => {
|
|
@@ -45,7 +45,7 @@ const RuleValueEditor = (props) => {
|
|
|
45
45
|
},
|
|
46
46
|
variant: "standard",
|
|
47
47
|
children: (_b = fieldData.operators) == null ? void 0 : _b.map(
|
|
48
|
-
(
|
|
48
|
+
(option) => /* @__PURE__ */ jsx(MenuItem, { value: option.name, children: intl.formatMessage({ id: option.label }) }, option.name)
|
|
49
49
|
)
|
|
50
50
|
}
|
|
51
51
|
) }),
|
|
@@ -59,7 +59,7 @@ const RuleValueEditor = (props) => {
|
|
|
59
59
|
}
|
|
60
60
|
) })
|
|
61
61
|
] });
|
|
62
|
-
}
|
|
62
|
+
}
|
|
63
63
|
export {
|
|
64
64
|
RuleValueEditor as default
|
|
65
65
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
1
|
import { ValueEditorProps } from 'react-querybuilder';
|
|
3
2
|
|
|
4
|
-
declare
|
|
3
|
+
declare function CountryValueEditor(props: ValueEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
5
4
|
export default CountryValueEditor;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { MaterialValueEditor } from "@react-querybuilder/material";
|
|
3
3
|
import { Autocomplete, TextField } from "@mui/material";
|
|
4
|
+
import { useMemo } from "react";
|
|
4
5
|
import useConvertValue from "./use-convert-value.js";
|
|
5
6
|
import useValid from "./use-valid.js";
|
|
6
7
|
import { useLocalizedCountries } from "../../../hooks/localized-countries-hook.js";
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
const CountryValueEditor = (props) => {
|
|
8
|
+
import useCustomFormContext from "../react-hook-form/provider/use-custom-form-context.js";
|
|
9
|
+
function CountryValueEditor(props) {
|
|
10
10
|
const { language } = useCustomFormContext();
|
|
11
11
|
const { translate, countryCodes } = useLocalizedCountries(language);
|
|
12
|
+
const { value, handleOnChange } = props;
|
|
12
13
|
const countriesList = useMemo(
|
|
13
14
|
() => countryCodes.map((country) => {
|
|
14
15
|
return { name: country, label: translate(country) };
|
|
@@ -17,7 +18,7 @@ const CountryValueEditor = (props) => {
|
|
|
17
18
|
);
|
|
18
19
|
useConvertValue(props);
|
|
19
20
|
const valid = useValid(props);
|
|
20
|
-
if (!Array.isArray(
|
|
21
|
+
if (!Array.isArray(value)) {
|
|
21
22
|
return /* @__PURE__ */ jsx(
|
|
22
23
|
MaterialValueEditor,
|
|
23
24
|
{
|
|
@@ -26,21 +27,20 @@ const CountryValueEditor = (props) => {
|
|
|
26
27
|
title: void 0
|
|
27
28
|
}
|
|
28
29
|
);
|
|
29
|
-
} else {
|
|
30
|
-
return /* @__PURE__ */ jsx(
|
|
31
|
-
Autocomplete,
|
|
32
|
-
{
|
|
33
|
-
value: props.value,
|
|
34
|
-
options: countryCodes,
|
|
35
|
-
getOptionLabel: (code) => translate(code),
|
|
36
|
-
onChange: (event, value) => props.handleOnChange(value),
|
|
37
|
-
multiple: true,
|
|
38
|
-
fullWidth: true,
|
|
39
|
-
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid })
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
30
|
}
|
|
43
|
-
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
Autocomplete,
|
|
33
|
+
{
|
|
34
|
+
value,
|
|
35
|
+
options: countryCodes,
|
|
36
|
+
getOptionLabel: (code) => translate(code),
|
|
37
|
+
onChange: (event, newValue) => handleOnChange(newValue),
|
|
38
|
+
multiple: true,
|
|
39
|
+
fullWidth: true,
|
|
40
|
+
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid })
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
44
|
export {
|
|
45
45
|
CountryValueEditor as default
|
|
46
46
|
};
|
|
@@ -4,5 +4,5 @@ interface CustomReactQueryBuilderProps {
|
|
|
4
4
|
name: string;
|
|
5
5
|
fields: Field[];
|
|
6
6
|
}
|
|
7
|
-
declare
|
|
7
|
+
declare function CustomReactQueryBuilder(props: CustomReactQueryBuilderProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export default CustomReactQueryBuilder;
|
|
@@ -1,21 +1,94 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
2
|
-
import "@mui/material/Grid";
|
|
3
|
-
import "@react-querybuilder/dnd";
|
|
4
|
-
import "react-dnd";
|
|
5
|
-
import "react-dnd-html5-backend";
|
|
6
|
-
import "@react-querybuilder/material";
|
|
7
|
-
import "react-querybuilder";
|
|
8
|
-
import "react-intl";
|
|
9
|
-
import "react-hook-form";
|
|
10
|
-
import {
|
|
11
|
-
import "./combinator-selector.js";
|
|
12
|
-
import "./add-button.js";
|
|
13
|
-
import "./value-
|
|
14
|
-
import "
|
|
15
|
-
import "../../filter/expert/expert-filter-constants.js";
|
|
16
|
-
import "../react-hook-form/error-management/error-input.js";
|
|
17
|
-
import "../react-hook-form/error-management/field-error-alert.js";
|
|
18
|
-
import "../../filter/expert/expert-filter-utils.js";
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import Grid from "@mui/material/Grid";
|
|
3
|
+
import { QueryBuilderDnD } from "@react-querybuilder/dnd";
|
|
4
|
+
import * as ReactDnD from "react-dnd";
|
|
5
|
+
import * as ReactDndHtml5Backend from "react-dnd-html5-backend";
|
|
6
|
+
import { QueryBuilderMaterial } from "@react-querybuilder/material";
|
|
7
|
+
import { formatQuery, QueryBuilder } from "react-querybuilder";
|
|
8
|
+
import { useIntl } from "react-intl";
|
|
9
|
+
import { useFormContext } from "react-hook-form";
|
|
10
|
+
import { useCallback, useMemo } from "react";
|
|
11
|
+
import CombinatorSelector from "./combinator-selector.js";
|
|
12
|
+
import AddButton from "./add-button.js";
|
|
13
|
+
import ValueEditor from "./value-editor.js";
|
|
14
|
+
import ValueSelector from "./value-selector.js";
|
|
15
|
+
import { COMBINATOR_OPTIONS } from "../../filter/expert/expert-filter-constants.js";
|
|
16
|
+
import ErrorInput from "../react-hook-form/error-management/error-input.js";
|
|
17
|
+
import FieldErrorAlert from "../react-hook-form/error-management/field-error-alert.js";
|
|
18
|
+
import { countRules, getOperators, queryValidator } from "../../filter/expert/expert-filter-utils.js";
|
|
19
|
+
import RemoveButton from "./remove-button.js";
|
|
20
|
+
function RuleAddButton(props) {
|
|
21
|
+
return /* @__PURE__ */ jsx(AddButton, { ...props, label: "rule" });
|
|
22
|
+
}
|
|
23
|
+
function GroupAddButton(props) {
|
|
24
|
+
return /* @__PURE__ */ jsx(AddButton, { ...props, label: "subGroup" });
|
|
25
|
+
}
|
|
26
|
+
function CustomReactQueryBuilder(props) {
|
|
27
|
+
const { name, fields } = props;
|
|
28
|
+
const {
|
|
29
|
+
getValues,
|
|
30
|
+
setValue,
|
|
31
|
+
watch,
|
|
32
|
+
formState: { isSubmitted }
|
|
33
|
+
// Set to true after the form is submitted. Will remain true until the reset method is invoked.
|
|
34
|
+
} = useFormContext();
|
|
35
|
+
const intl = useIntl();
|
|
36
|
+
const query = watch(name);
|
|
37
|
+
const handleQueryChange = useCallback(
|
|
38
|
+
(newQuery) => {
|
|
39
|
+
const oldQuery = getValues(name);
|
|
40
|
+
const hasQueryChanged = formatQuery(oldQuery, "json_without_ids") !== formatQuery(newQuery, "json_without_ids");
|
|
41
|
+
const hasAddedRules = countRules(newQuery) > countRules(oldQuery);
|
|
42
|
+
setValue(name, newQuery, {
|
|
43
|
+
shouldDirty: hasQueryChanged,
|
|
44
|
+
shouldValidate: isSubmitted && hasQueryChanged && !hasAddedRules
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
[getValues, setValue, isSubmitted, name]
|
|
48
|
+
);
|
|
49
|
+
const combinators = useMemo(() => {
|
|
50
|
+
return Object.values(COMBINATOR_OPTIONS).map((c) => ({
|
|
51
|
+
name: c.name,
|
|
52
|
+
label: intl.formatMessage({ id: c.label })
|
|
53
|
+
}));
|
|
54
|
+
}, [intl]);
|
|
55
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
56
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(QueryBuilderMaterial, { children: /* @__PURE__ */ jsx(
|
|
57
|
+
QueryBuilderDnD,
|
|
58
|
+
{
|
|
59
|
+
dnd: { ...ReactDnD, ...ReactDndHtml5Backend },
|
|
60
|
+
children: /* @__PURE__ */ jsx(
|
|
61
|
+
QueryBuilder,
|
|
62
|
+
{
|
|
63
|
+
fields,
|
|
64
|
+
query,
|
|
65
|
+
addRuleToNewGroups: true,
|
|
66
|
+
combinators,
|
|
67
|
+
onQueryChange: handleQueryChange,
|
|
68
|
+
getOperators: (fieldName) => getOperators(fieldName, intl),
|
|
69
|
+
validator: queryValidator,
|
|
70
|
+
controlClassnames: {
|
|
71
|
+
queryBuilder: "queryBuilder-branches"
|
|
72
|
+
},
|
|
73
|
+
controlElements: {
|
|
74
|
+
addRuleAction: RuleAddButton,
|
|
75
|
+
addGroupAction: GroupAddButton,
|
|
76
|
+
combinatorSelector: CombinatorSelector,
|
|
77
|
+
removeRuleAction: RemoveButton,
|
|
78
|
+
removeGroupAction: RemoveButton,
|
|
79
|
+
valueEditor: ValueEditor,
|
|
80
|
+
operatorSelector: ValueSelector,
|
|
81
|
+
fieldSelector: ValueSelector,
|
|
82
|
+
valueSourceSelector: ValueSelector
|
|
83
|
+
},
|
|
84
|
+
listsAsArrays: true
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
) }) }),
|
|
89
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(ErrorInput, { name, InputField: FieldErrorAlert }) })
|
|
90
|
+
] });
|
|
91
|
+
}
|
|
19
92
|
export {
|
|
20
|
-
|
|
93
|
+
CustomReactQueryBuilder as default
|
|
21
94
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2024, RTE (http://www.rte-france.com)
|
|
3
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
4
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
5
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
6
|
+
*/
|
|
3
7
|
interface ElementValueEditorProps {
|
|
4
8
|
name: string;
|
|
5
9
|
elementType: string;
|
|
@@ -10,5 +14,5 @@ interface ElementValueEditorProps {
|
|
|
10
14
|
itemFilter?: any;
|
|
11
15
|
defaultValue?: any;
|
|
12
16
|
}
|
|
13
|
-
declare
|
|
17
|
+
declare function ElementValueEditor(props: ElementValueEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
14
18
|
export default ElementValueEditor;
|
|
@@ -1,64 +1,52 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
2
|
-
import "
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
import "@mui/material/DialogTitle";
|
|
51
|
-
import "@mui/material/DialogContent";
|
|
52
|
-
import "@mui/material/DialogActions";
|
|
53
|
-
import "react-papaparse";
|
|
54
|
-
import "@mui/material/Button";
|
|
55
|
-
import "react-csv-downloader";
|
|
56
|
-
import "@mui/material/Alert";
|
|
57
|
-
import "papaparse";
|
|
58
|
-
import "@mui/icons-material/Check";
|
|
59
|
-
import "@mui/material/CircularProgress";
|
|
60
|
-
import "@mui/material/TextField";
|
|
61
|
-
import "../../filter/utils/filter-form-utils.js";
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { validate } from "uuid";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import useCustomFormContext from "../react-hook-form/provider/use-custom-form-context.js";
|
|
5
|
+
import { fetchElementsInfos } from "../../../services/explore.js";
|
|
6
|
+
import DirectoryItemsInput from "../react-hook-form/directory-items-input.js";
|
|
7
|
+
function ElementValueEditor(props) {
|
|
8
|
+
const {
|
|
9
|
+
defaultValue,
|
|
10
|
+
name,
|
|
11
|
+
elementType,
|
|
12
|
+
equipmentTypes,
|
|
13
|
+
titleId,
|
|
14
|
+
hideErrorMessage,
|
|
15
|
+
itemFilter,
|
|
16
|
+
onChange
|
|
17
|
+
} = props;
|
|
18
|
+
const { setValue } = useCustomFormContext();
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (defaultValue && Array.isArray(defaultValue) && defaultValue.length > 0 && defaultValue[0].length > 0 && validate(defaultValue[0])) {
|
|
21
|
+
fetchElementsInfos(defaultValue).then((childrenWithMetadata) => {
|
|
22
|
+
setValue(
|
|
23
|
+
name,
|
|
24
|
+
childrenWithMetadata.map((v) => {
|
|
25
|
+
return {
|
|
26
|
+
id: v.elementUuid,
|
|
27
|
+
name: v.elementName,
|
|
28
|
+
specificMetadata: v.specificMetadata
|
|
29
|
+
};
|
|
30
|
+
})
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}, [name, defaultValue, elementType, setValue]);
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
DirectoryItemsInput,
|
|
37
|
+
{
|
|
38
|
+
name,
|
|
39
|
+
elementType,
|
|
40
|
+
equipmentTypes,
|
|
41
|
+
titleId,
|
|
42
|
+
hideErrorMessage,
|
|
43
|
+
label: "filter",
|
|
44
|
+
itemFilter,
|
|
45
|
+
onChange,
|
|
46
|
+
labelRequiredFromContext: false
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
}
|
|
62
50
|
export {
|
|
63
|
-
|
|
51
|
+
ElementValueEditor as default
|
|
64
52
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ValueEditorProps } from 'react-querybuilder';
|
|
2
|
-
import { FunctionComponent } from 'react';
|
|
3
2
|
|
|
4
3
|
interface ExpertFilterPropertyProps {
|
|
5
4
|
equipmentType: string;
|
|
6
5
|
valueEditorProps: ValueEditorProps;
|
|
7
6
|
}
|
|
8
|
-
declare
|
|
7
|
+
declare function PropertyValueEditor(props: ExpertFilterPropertyProps): import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
export default PropertyValueEditor;
|
|
@@ -2,13 +2,13 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useMemo, useCallback } from "react";
|
|
3
3
|
import Grid from "@mui/material/Grid";
|
|
4
4
|
import { Autocomplete, TextField, Select, MenuItem } from "@mui/material";
|
|
5
|
-
import useValid from "./use-valid.js";
|
|
6
5
|
import { useIntl } from "react-intl";
|
|
7
|
-
import
|
|
6
|
+
import useValid from "./use-valid.js";
|
|
8
7
|
import { OPERATOR_OPTIONS } from "../../filter/expert/expert-filter-constants.js";
|
|
9
|
-
import
|
|
8
|
+
import FieldConstants from "../../../utils/field-constants.js";
|
|
9
|
+
import usePredefinedProperties from "../../../hooks/predefined-properties-hook.js";
|
|
10
10
|
const PROPERTY_VALUE_OPERATORS = [OPERATOR_OPTIONS.IN];
|
|
11
|
-
|
|
11
|
+
function PropertyValueEditor(props) {
|
|
12
12
|
const { equipmentType, valueEditorProps } = props;
|
|
13
13
|
const valid = useValid(valueEditorProps);
|
|
14
14
|
const intl = useIntl();
|
|
@@ -94,7 +94,7 @@ const PropertyValueEditor = (props) => {
|
|
|
94
94
|
}
|
|
95
95
|
) })
|
|
96
96
|
] });
|
|
97
|
-
}
|
|
97
|
+
}
|
|
98
98
|
export {
|
|
99
99
|
PropertyValueEditor as default
|
|
100
100
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
1
|
import { ActionWithRulesProps } from 'react-querybuilder';
|
|
3
2
|
|
|
4
|
-
declare
|
|
3
|
+
declare function RemoveButton(props: ActionWithRulesProps): import("react/jsx-runtime").JSX.Element;
|
|
5
4
|
export default RemoveButton;
|
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
2
|
-
import "@mui/material/IconButton";
|
|
3
|
-
import "@mui/icons-material/Delete";
|
|
4
|
-
import "react-hook-form";
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import IconButton from "@mui/material/IconButton";
|
|
3
|
+
import DeleteIcon from "@mui/icons-material/Delete";
|
|
4
|
+
import { useController } from "react-hook-form";
|
|
5
|
+
import { getNumberOfSiblings, recursiveRemove } from "../../filter/expert/expert-filter-utils.js";
|
|
6
|
+
const EXPERT_FILTER_QUERY = "rules";
|
|
7
|
+
function RemoveButton(props) {
|
|
8
|
+
const { path, className } = props;
|
|
9
|
+
const {
|
|
10
|
+
field: { value: query, onChange }
|
|
11
|
+
} = useController({ name: EXPERT_FILTER_QUERY });
|
|
12
|
+
function handleDelete() {
|
|
13
|
+
onChange(recursiveRemove(query, path));
|
|
14
|
+
}
|
|
15
|
+
const isLastRuleOrGroup = path.toString() === [0].toString() && getNumberOfSiblings(path, query) === 1;
|
|
16
|
+
return /* @__PURE__ */ jsx(
|
|
17
|
+
IconButton,
|
|
18
|
+
{
|
|
19
|
+
size: "small",
|
|
20
|
+
onClick: () => handleDelete(),
|
|
21
|
+
className,
|
|
22
|
+
children: !isLastRuleOrGroup && /* @__PURE__ */ jsx(DeleteIcon, {})
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
7
26
|
export {
|
|
8
|
-
|
|
27
|
+
RemoveButton as default
|
|
9
28
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
1
|
import { ValueEditorProps } from 'react-querybuilder';
|
|
3
2
|
|
|
4
|
-
declare
|
|
3
|
+
declare function TextValueEditor(props: ValueEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
5
4
|
export default TextValueEditor;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { MaterialValueEditor } from "@react-querybuilder/material";
|
|
3
|
-
import useConvertValue from "./use-convert-value.js";
|
|
4
3
|
import { Autocomplete, TextField } from "@mui/material";
|
|
4
|
+
import useConvertValue from "./use-convert-value.js";
|
|
5
5
|
import useValid from "./use-valid.js";
|
|
6
|
-
|
|
6
|
+
function TextValueEditor(props) {
|
|
7
7
|
useConvertValue(props);
|
|
8
8
|
const valid = useValid(props);
|
|
9
|
-
|
|
9
|
+
const { value, handleOnChange } = props;
|
|
10
|
+
if (!Array.isArray(value)) {
|
|
10
11
|
return /* @__PURE__ */ jsx(
|
|
11
12
|
MaterialValueEditor,
|
|
12
13
|
{
|
|
@@ -14,21 +15,20 @@ const TextValueEditor = (props) => {
|
|
|
14
15
|
title: void 0
|
|
15
16
|
}
|
|
16
17
|
);
|
|
17
|
-
} else {
|
|
18
|
-
return /* @__PURE__ */ jsx(
|
|
19
|
-
Autocomplete,
|
|
20
|
-
{
|
|
21
|
-
value: props.value,
|
|
22
|
-
freeSolo: true,
|
|
23
|
-
options: [],
|
|
24
|
-
onChange: (event, value) => props.handleOnChange(value),
|
|
25
|
-
multiple: true,
|
|
26
|
-
fullWidth: true,
|
|
27
|
-
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid })
|
|
28
|
-
}
|
|
29
|
-
);
|
|
30
18
|
}
|
|
31
|
-
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
Autocomplete,
|
|
21
|
+
{
|
|
22
|
+
value,
|
|
23
|
+
freeSolo: true,
|
|
24
|
+
options: [],
|
|
25
|
+
onChange: (event, newValue) => handleOnChange(newValue),
|
|
26
|
+
multiple: true,
|
|
27
|
+
fullWidth: true,
|
|
28
|
+
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid })
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
32
|
export {
|
|
33
33
|
TextValueEditor as default
|
|
34
34
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
1
|
import { ValueEditorProps } from 'react-querybuilder';
|
|
3
2
|
|
|
4
|
-
declare
|
|
3
|
+
declare function TranslatedValueEditor(props: ValueEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
5
4
|
export default TranslatedValueEditor;
|
|
@@ -2,34 +2,31 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo } from "react";
|
|
3
3
|
import { MaterialValueEditor } from "@react-querybuilder/material";
|
|
4
4
|
import { useIntl } from "react-intl";
|
|
5
|
-
import useConvertValue from "./use-convert-value.js";
|
|
6
5
|
import { Autocomplete, TextField } from "@mui/material";
|
|
6
|
+
import useConvertValue from "./use-convert-value.js";
|
|
7
7
|
import useValid from "./use-valid.js";
|
|
8
|
-
|
|
8
|
+
function TranslatedValueEditor(props) {
|
|
9
9
|
const intl = useIntl();
|
|
10
|
+
const { values, value, handleOnChange } = props;
|
|
10
11
|
const translatedValues = useMemo(() => {
|
|
11
|
-
|
|
12
|
-
return (_a = props.values) == null ? void 0 : _a.map((v) => {
|
|
12
|
+
return values == null ? void 0 : values.map((v) => {
|
|
13
13
|
return {
|
|
14
14
|
name: v.name,
|
|
15
15
|
label: intl.formatMessage({ id: v.label })
|
|
16
16
|
};
|
|
17
17
|
});
|
|
18
|
-
}, [intl,
|
|
18
|
+
}, [intl, values]);
|
|
19
19
|
const translatedValuesAutocomplete = useMemo(() => {
|
|
20
|
-
if (!
|
|
20
|
+
if (!values) {
|
|
21
21
|
return {};
|
|
22
22
|
}
|
|
23
23
|
return Object.fromEntries(
|
|
24
|
-
|
|
25
|
-
v.name,
|
|
26
|
-
intl.formatMessage({ id: v.label })
|
|
27
|
-
])
|
|
24
|
+
values.map((v) => [v.name, intl.formatMessage({ id: v.label })])
|
|
28
25
|
);
|
|
29
|
-
}, [intl,
|
|
26
|
+
}, [intl, values]);
|
|
30
27
|
useConvertValue(props);
|
|
31
28
|
const valid = useValid(props);
|
|
32
|
-
if (!Array.isArray(
|
|
29
|
+
if (!Array.isArray(value)) {
|
|
33
30
|
return /* @__PURE__ */ jsx(
|
|
34
31
|
MaterialValueEditor,
|
|
35
32
|
{
|
|
@@ -38,21 +35,20 @@ const TranslatedValueEditor = (props) => {
|
|
|
38
35
|
title: void 0
|
|
39
36
|
}
|
|
40
37
|
);
|
|
41
|
-
} else {
|
|
42
|
-
return /* @__PURE__ */ jsx(
|
|
43
|
-
Autocomplete,
|
|
44
|
-
{
|
|
45
|
-
value: props.value,
|
|
46
|
-
options: Object.keys(translatedValuesAutocomplete),
|
|
47
|
-
getOptionLabel: (code) => translatedValuesAutocomplete[code],
|
|
48
|
-
onChange: (event, value) => props.handleOnChange(value),
|
|
49
|
-
multiple: true,
|
|
50
|
-
fullWidth: true,
|
|
51
|
-
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid })
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
38
|
}
|
|
55
|
-
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
40
|
+
Autocomplete,
|
|
41
|
+
{
|
|
42
|
+
value,
|
|
43
|
+
options: Object.keys(translatedValuesAutocomplete),
|
|
44
|
+
getOptionLabel: (code) => translatedValuesAutocomplete[code],
|
|
45
|
+
onChange: (event, newValue) => handleOnChange(newValue),
|
|
46
|
+
multiple: true,
|
|
47
|
+
fullWidth: true,
|
|
48
|
+
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid })
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
56
52
|
export {
|
|
57
53
|
TranslatedValueEditor as default
|
|
58
54
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
1
|
import { ValueEditorProps } from 'react-querybuilder';
|
|
3
2
|
|
|
4
|
-
declare
|
|
3
|
+
declare function ValueEditor(props: ValueEditorProps): import("react/jsx-runtime").JSX.Element | null;
|
|
5
4
|
export default ValueEditor;
|