@gridsuite/commons-ui 0.55.0 → 0.56.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.
Files changed (157) hide show
  1. package/dist/assets/criteria-based-filter-edition-dialog.css +168 -0
  2. package/dist/chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js +1673 -0
  3. package/dist/chunks/filter-properties.GRon8-ML.js +195 -0
  4. package/dist/components/DirectoryItemSelector/directory-item-selector.d.ts +13 -3
  5. package/dist/components/DirectoryItemSelector/directory-item-selector.js +14 -10
  6. package/dist/components/dialogs/custom-mui-dialog.d.ts +21 -0
  7. package/dist/components/dialogs/custom-mui-dialog.js +87 -0
  8. package/dist/components/dialogs/description-modification-dialog.d.ts +11 -0
  9. package/dist/components/dialogs/description-modification-dialog.js +71 -0
  10. package/dist/components/dialogs/popup-confirmation-dialog.d.ts +11 -0
  11. package/dist/components/dialogs/popup-confirmation-dialog.js +38 -0
  12. package/dist/components/filter/constants/equipment-types.d.ts +72 -0
  13. package/dist/components/filter/constants/equipment-types.js +63 -0
  14. package/dist/components/filter/constants/expert-filter-constants.d.ts +546 -0
  15. package/dist/components/filter/constants/expert-filter-constants.js +663 -0
  16. package/dist/components/filter/constants/field-constants.d.ts +45 -0
  17. package/dist/components/filter/constants/field-constants.js +43 -0
  18. package/dist/components/filter/constants/filter-constants.d.ts +21 -0
  19. package/dist/components/filter/constants/filter-constants.js +10 -0
  20. package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.d.ts +29 -0
  21. package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.js +19 -0
  22. package/dist/components/filter/criteria-based/criteria-based-filter-form.d.ts +15 -0
  23. package/dist/components/filter/criteria-based/criteria-based-filter-form.js +33 -0
  24. package/dist/components/filter/criteria-based/criteria-based-filter-utils.d.ts +37 -0
  25. package/dist/components/filter/criteria-based/criteria-based-filter-utils.js +127 -0
  26. package/dist/components/filter/criteria-based/criteria-based-form.d.ts +7 -0
  27. package/dist/components/filter/criteria-based/criteria-based-form.js +50 -0
  28. package/dist/components/filter/criteria-based/filter-free-properties.d.ts +10 -0
  29. package/dist/components/filter/criteria-based/filter-free-properties.js +15 -0
  30. package/dist/components/filter/criteria-based/filter-properties.d.ts +21 -0
  31. package/dist/components/filter/criteria-based/filter-properties.js +19 -0
  32. package/dist/components/filter/criteria-based/filter-property.d.ts +19 -0
  33. package/dist/components/filter/criteria-based/filter-property.js +67 -0
  34. package/dist/components/filter/expert/expert-filter-edition-dialog.d.ts +28 -0
  35. package/dist/components/filter/expert/expert-filter-edition-dialog.js +20 -0
  36. package/dist/components/filter/expert/expert-filter-form.d.ts +21 -0
  37. package/dist/components/filter/expert/expert-filter-form.js +22 -0
  38. package/dist/components/filter/expert/expert-filter-utils.d.ts +19 -0
  39. package/dist/components/filter/expert/expert-filter-utils.js +302 -0
  40. package/dist/components/filter/expert/expert-filter.type.d.ts +113 -0
  41. package/dist/components/filter/expert/expert-filter.type.js +103 -0
  42. package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.d.ts +22 -0
  43. package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.js +19 -0
  44. package/dist/components/filter/explicit-naming/explicit-naming-filter-form.d.ts +22 -0
  45. package/dist/components/filter/explicit-naming/explicit-naming-filter-form.js +23 -0
  46. package/dist/components/filter/filter-context.d.ts +12 -0
  47. package/dist/components/filter/filter-context.js +10 -0
  48. package/dist/components/filter/filter-creation-dialog.d.ts +21 -0
  49. package/dist/components/filter/filter-creation-dialog.js +17 -0
  50. package/dist/components/filter/filter-form.d.ts +11 -0
  51. package/dist/components/filter/filter-form.js +14 -0
  52. package/dist/components/filter/utils/criteria-based-utils.d.ts +28 -0
  53. package/dist/components/filter/utils/criteria-based-utils.js +197 -0
  54. package/dist/components/filter/utils/filters-utils.d.ts +5 -0
  55. package/dist/components/filter/utils/filters-utils.js +99 -0
  56. package/dist/components/inputs/select-clearable.d.ts +14 -0
  57. package/dist/components/inputs/select-clearable.js +40 -0
  58. package/dist/components/react-hook-form/ExpandingTextField.d.ts +1 -1
  59. package/dist/components/react-hook-form/ExpandingTextField.js +0 -37
  60. package/dist/components/react-hook-form/ag-grid-table-rhf/bottom-right-buttons.d.ts +17 -0
  61. package/dist/components/react-hook-form/ag-grid-table-rhf/bottom-right-buttons.js +15 -0
  62. package/dist/components/react-hook-form/ag-grid-table-rhf/cell-editors/numericEditor.d.ts +23 -0
  63. package/dist/components/react-hook-form/ag-grid-table-rhf/cell-editors/numericEditor.js +70 -0
  64. package/dist/components/react-hook-form/ag-grid-table-rhf/csv-uploader/csv-uploader.d.ts +16 -0
  65. package/dist/components/react-hook-form/ag-grid-table-rhf/csv-uploader/csv-uploader.js +69 -0
  66. package/dist/components/react-hook-form/ag-grid-table-rhf/custom-ag-grid-table.d.ts +23 -0
  67. package/dist/components/react-hook-form/ag-grid-table-rhf/custom-ag-grid-table.js +15 -0
  68. package/dist/components/react-hook-form/autocomplete-input.d.ts +17 -29
  69. package/dist/components/react-hook-form/autocomplete-input.js +4 -15
  70. package/dist/components/react-hook-form/autocomplete-inputs/multiple-autocomplete-input.d.ts +2 -0
  71. package/dist/components/react-hook-form/autocomplete-inputs/multiple-autocomplete-input.js +46 -0
  72. package/dist/components/react-hook-form/directory-items-input.d.ts +0 -3
  73. package/dist/components/react-hook-form/directory-items-input.js +5 -6
  74. package/dist/components/react-hook-form/error-management/error-input.d.ts +13 -4
  75. package/dist/components/react-hook-form/error-management/error-input.js +7 -7
  76. package/dist/components/react-hook-form/error-management/field-error-alert.d.ts +6 -3
  77. package/dist/components/react-hook-form/error-management/field-error-alert.js +3 -1
  78. package/dist/components/react-hook-form/numbers/float-input.d.ts +5 -17
  79. package/dist/components/react-hook-form/numbers/float-input.js +3 -5
  80. package/dist/components/react-hook-form/numbers/integer-input.d.ts +15 -12
  81. package/dist/components/react-hook-form/numbers/utils.d.ts +8 -2
  82. package/dist/components/react-hook-form/provider/custom-form-provider.d.ts +1 -0
  83. package/dist/components/react-hook-form/provider/custom-form-provider.js +12 -3
  84. package/dist/components/react-hook-form/radio-input.d.ts +14 -17
  85. package/dist/components/react-hook-form/radio-input.js +7 -9
  86. package/dist/components/react-hook-form/range-input.d.ts +54 -0
  87. package/dist/components/react-hook-form/range-input.js +118 -0
  88. package/dist/components/react-hook-form/select-inputs/countries-input.d.ts +8 -0
  89. package/dist/components/react-hook-form/select-inputs/countries-input.js +36 -0
  90. package/dist/components/react-hook-form/select-inputs/input-with-popup-confirmation.d.ts +2 -0
  91. package/dist/components/react-hook-form/select-inputs/input-with-popup-confirmation.js +61 -0
  92. package/dist/components/react-hook-form/select-inputs/mui-select-input.d.ts +12 -0
  93. package/dist/components/react-hook-form/select-inputs/mui-select-input.js +25 -0
  94. package/dist/components/react-hook-form/select-inputs/select-input.d.ts +9 -0
  95. package/dist/components/react-hook-form/select-inputs/select-input.js +37 -0
  96. package/dist/components/react-hook-form/text-input.d.ts +23 -32
  97. package/dist/components/react-hook-form/text-input.js +6 -20
  98. package/dist/components/react-hook-form/unique-name-input.d.ts +21 -0
  99. package/dist/components/react-hook-form/unique-name-input.js +129 -0
  100. package/dist/components/react-hook-form/utils/cancel-button.d.ts +9 -8
  101. package/dist/components/react-hook-form/utils/field-label.d.ts +12 -5
  102. package/dist/components/react-hook-form/utils/field-label.js +5 -1
  103. package/dist/components/react-hook-form/utils/functions.d.ts +12 -4
  104. package/dist/components/react-hook-form/utils/functions.js +21 -1
  105. package/dist/components/react-hook-form/utils/submit-button.d.ts +9 -8
  106. package/dist/components/react-hook-form/utils/text-field-with-adornment.d.ts +11 -11
  107. package/dist/components/react-hook-form/utils/text-field-with-adornment.js +18 -23
  108. package/dist/components/react-query-builder-inputs/add-button.d.ts +8 -0
  109. package/dist/components/react-query-builder-inputs/add-button.js +17 -0
  110. package/dist/components/react-query-builder-inputs/combinator-selector.d.ts +5 -0
  111. package/dist/components/react-query-builder-inputs/combinator-selector.js +38 -0
  112. package/dist/components/react-query-builder-inputs/country-value-editor.d.ts +5 -0
  113. package/dist/components/react-query-builder-inputs/country-value-editor.js +46 -0
  114. package/dist/components/react-query-builder-inputs/custom-react-query-builder.d.ts +8 -0
  115. package/dist/components/react-query-builder-inputs/custom-react-query-builder.js +21 -0
  116. package/dist/components/react-query-builder-inputs/element-value-editor.d.ts +14 -0
  117. package/dist/components/react-query-builder-inputs/element-value-editor.js +69 -0
  118. package/dist/components/react-query-builder-inputs/property-value-editor.d.ts +9 -0
  119. package/dist/components/react-query-builder-inputs/property-value-editor.js +100 -0
  120. package/dist/components/react-query-builder-inputs/remove-button.d.ts +5 -0
  121. package/dist/components/react-query-builder-inputs/remove-button.js +9 -0
  122. package/dist/components/react-query-builder-inputs/text-value-editor.d.ts +5 -0
  123. package/dist/components/react-query-builder-inputs/text-value-editor.js +34 -0
  124. package/dist/components/react-query-builder-inputs/translated-value-editor.d.ts +5 -0
  125. package/dist/components/react-query-builder-inputs/translated-value-editor.js +58 -0
  126. package/dist/components/react-query-builder-inputs/use-convert-value.d.ts +9 -0
  127. package/dist/components/react-query-builder-inputs/use-convert-value.js +24 -0
  128. package/dist/components/react-query-builder-inputs/use-valid.d.ts +7 -0
  129. package/dist/components/react-query-builder-inputs/use-valid.js +13 -0
  130. package/dist/components/react-query-builder-inputs/value-editor.d.ts +5 -0
  131. package/dist/components/react-query-builder-inputs/value-editor.js +18 -0
  132. package/dist/components/react-query-builder-inputs/value-selector.d.ts +4 -0
  133. package/dist/components/react-query-builder-inputs/value-selector.js +14 -0
  134. package/dist/hooks/localized-countries-hook.d.ts +6 -0
  135. package/dist/hooks/localized-countries-hook.js +45 -0
  136. package/dist/hooks/predefined-properties-hook.d.ts +18 -0
  137. package/dist/hooks/predefined-properties-hook.js +43 -0
  138. package/dist/hooks/useDebounce.d.ts +7 -1
  139. package/dist/hooks/useSnackMessage.d.ts +23 -5
  140. package/dist/hooks/useSnackMessage.js +14 -12
  141. package/dist/index.d.ts +87 -142
  142. package/dist/index.js +168 -91
  143. package/dist/utils/FetchStatus.d.ts +12 -0
  144. package/dist/utils/FetchStatus.js +9 -0
  145. package/dist/utils/conversion-utils.d.ts +12 -0
  146. package/dist/utils/conversion-utils.js +22 -0
  147. package/dist/utils/equipment-types-for-predefined-properties-mapper.d.ts +3 -0
  148. package/dist/utils/equipment-types-for-predefined-properties-mapper.js +31 -0
  149. package/dist/utils/functions.d.ts +14 -0
  150. package/dist/utils/functions.js +16 -0
  151. package/dist/utils/types.d.ts +21 -0
  152. package/dist/utils/types.js +1 -0
  153. package/dist/utils/yup-config.d.ts +8 -0
  154. package/dist/utils/yup-config.js +16 -0
  155. package/package.json +15 -2
  156. package/dist/components/react-hook-form/select-input.d.ts +0 -17
  157. package/dist/components/react-hook-form/select-input.js +0 -30
@@ -0,0 +1,69 @@
1
+ import "react/jsx-runtime";
2
+ import "@mui/material/Dialog";
3
+ import "@mui/material/DialogTitle";
4
+ import "@mui/material/DialogContent";
5
+ import "@mui/material/DialogActions";
6
+ import "react-papaparse";
7
+ import "@mui/material/Button";
8
+ import "react";
9
+ import "@mui/material/Grid";
10
+ import "react-intl";
11
+ import "react-csv-downloader";
12
+ import "@mui/material/Alert";
13
+ import "@mui/material";
14
+ import "react-hook-form";
15
+ import "../../../TreeViewFinder/TreeViewFinder.js";
16
+ import "../../../TopBar/TopBar.js";
17
+ import "../../../TopBar/GridLogo.js";
18
+ import "../../../TopBar/AboutDialog.js";
19
+ import "../../../SnackbarProvider/SnackbarProvider.js";
20
+ import "react-router-dom";
21
+ import "../../../../utils/AuthService.js";
22
+ import "@mui/icons-material";
23
+ import "../../../MuiVirtualizedTable/MuiVirtualizedTable.js";
24
+ import "../../../ReportViewer/report-item.js";
25
+ import "uuid";
26
+ import "../../../ReportViewer/log-table.js";
27
+ import "../../../ReportViewer/report-tree-view-context.js";
28
+ import "@mui/x-tree-view";
29
+ import "../../../OverflowableText/overflowable-text.js";
30
+ import "../../../ElementSearchDialog/element-search-dialog.js";
31
+ import "../../../ElementSearchDialog/tag-renderer.js";
32
+ import "../../utils/submit-button.js";
33
+ import "../../utils/cancel-button.js";
34
+ import "../../provider/custom-form-provider.js";
35
+ import "../../../dialogs/description-modification-dialog.js";
36
+ import "../../../filter/constants/field-constants.js";
37
+ import "yup";
38
+ import "../../../dialogs/popup-confirmation-dialog.js";
39
+ import "../../../filter/utils/criteria-based-utils.js";
40
+ import { c } from "../../../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
41
+ import "ag-grid-react";
42
+ import "ag-grid-community/styles/ag-grid.css";
43
+ import "ag-grid-community/styles/ag-theme-alpine.css";
44
+ import "autosuggest-highlight/match";
45
+ import "autosuggest-highlight/parse";
46
+ import "clsx";
47
+ import "../../../CardErrorBoundary/card-error-boundary.js";
48
+ import "notistack";
49
+ import "../../slider-input.js";
50
+ import "../../numbers/integer-input.js";
51
+ import "../../booleans/checkbox-input.js";
52
+ import "../../booleans/switch-input.js";
53
+ import "@mui/icons-material/Folder";
54
+ import "../../../filter/filter-context.js";
55
+ import "../../../../chunks/filter-properties.GRon8-ML.js";
56
+ import "@mui/icons-material/Delete";
57
+ import "@mui/material/IconButton";
58
+ import "../../../filter/expert/expert-filter-utils.js";
59
+ import "../../range-input.js";
60
+ import "../../select-inputs/mui-select-input.js";
61
+ import "localized-countries";
62
+ import "localized-countries/data/fr";
63
+ import "localized-countries/data/en";
64
+ import "@mui/icons-material/Check";
65
+ import "@mui/material/CircularProgress";
66
+ import "@mui/material/TextField";
67
+ export {
68
+ c as default
69
+ };
@@ -0,0 +1,23 @@
1
+ import { FunctionComponent } from 'react';
2
+
3
+ export declare const ROW_DRAGGING_SELECTION_COLUMN_DEF: {
4
+ rowDrag: boolean;
5
+ headerCheckboxSelection: boolean;
6
+ checkboxSelection: boolean;
7
+ maxWidth: number;
8
+ }[];
9
+ export interface CustomAgGridTableProps {
10
+ name: string;
11
+ columnDefs: any;
12
+ makeDefaultRowData: any;
13
+ csvProps: unknown;
14
+ cssProps: unknown;
15
+ defaultColDef: unknown;
16
+ pagination: boolean;
17
+ paginationPageSize: number;
18
+ suppressRowClickSelection: boolean;
19
+ alwaysShowVerticalScroll: boolean;
20
+ stopEditingWhenCellsLoseFocus: boolean;
21
+ }
22
+ export declare const CustomAgGridTable: FunctionComponent<CustomAgGridTableProps>;
23
+ export default CustomAgGridTable;
@@ -0,0 +1,15 @@
1
+ import "react/jsx-runtime";
2
+ import "react";
3
+ import "react-hook-form";
4
+ import "ag-grid-react";
5
+ import "ag-grid-community/styles/ag-grid.css";
6
+ import "ag-grid-community/styles/ag-theme-alpine.css";
7
+ import "@mui/material";
8
+ import { C, R, C as C2 } from "../../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
9
+ import "react-intl";
10
+ import "../../filter/constants/field-constants.js";
11
+ export {
12
+ C as CustomAgGridTable,
13
+ R as ROW_DRAGGING_SELECTION_COLUMN_DEF,
14
+ C2 as default
15
+ };
@@ -1,30 +1,18 @@
1
- import { default as PropTypes } from 'prop-types';
2
- import { identity } from './utils/functions';
3
- export default AutocompleteInput;
4
- declare function AutocompleteInput({ name, label, options, outputTransform, inputTransform, readOnly, previousValue, allowNewValue, onChangeCallback, formProps, ...props }: {
5
- [x: string]: any;
6
- name: any;
7
- label: any;
8
- options: any;
9
- outputTransform?: typeof identity | undefined;
10
- inputTransform?: typeof identity | undefined;
11
- readOnly?: boolean | undefined;
12
- previousValue: any;
13
- allowNewValue: any;
14
- onChangeCallback: any;
15
- formProps: any;
16
- }): import("react/jsx-runtime").JSX.Element;
17
- declare namespace AutocompleteInput {
18
- namespace propTypes {
19
- let name: PropTypes.Validator<string>;
20
- let label: PropTypes.Requireable<string>;
21
- let options: PropTypes.Validator<any[]>;
22
- let outputTransform: PropTypes.Requireable<(...args: any[]) => any>;
23
- let inputTransform: PropTypes.Requireable<(...args: any[]) => any>;
24
- let readOnly: PropTypes.Requireable<boolean>;
25
- let previousValue: PropTypes.Requireable<any>;
26
- let allowNewValue: PropTypes.Requireable<boolean>;
27
- let onChangeCallback: PropTypes.Requireable<(...args: any[]) => any>;
28
- let formProps: PropTypes.Requireable<object>;
29
- }
1
+ import { Option } from '../../utils/types.ts';
2
+ import { FunctionComponent } from 'react';
3
+ import { AutocompleteProps, TextFieldProps } from '@mui/material';
4
+
5
+ export interface AutocompleteInputProps extends Omit<AutocompleteProps<Option, boolean | undefined, boolean | undefined, boolean | undefined>, 'value' | 'onChange' | 'renderInput'> {
6
+ name: string;
7
+ options: Option[];
8
+ label?: string;
9
+ outputTransform?: (value: Option) => Option;
10
+ inputTransform?: (value: Option | any) => Option | null;
11
+ readOnly?: boolean;
12
+ previousValue?: string;
13
+ allowNewValue?: boolean;
14
+ onChangeCallback?: () => void;
15
+ formProps?: Omit<TextFieldProps, 'value' | 'onChange' | 'inputRef' | 'inputProps' | 'InputProps'>;
30
16
  }
17
+ declare const AutocompleteInput: FunctionComponent<AutocompleteInputProps>;
18
+ export default AutocompleteInput;
@@ -1,5 +1,4 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import PropTypes from "prop-types";
3
2
  import { Autocomplete, TextField } from "@mui/material";
4
3
  import { useController } from "react-hook-form";
5
4
  import { isFieldRequired, genHelperPreviousValue, genHelperError, identity } from "./utils/functions.js";
@@ -32,7 +31,9 @@ const AutocompleteInput = ({
32
31
  onChange(outputTransform(value2));
33
32
  return;
34
33
  }
35
- const matchingOption = options.find((option) => option.id === value2);
34
+ const matchingOption = options.find(
35
+ (option) => typeof option !== "string" && option.id === value2
36
+ );
36
37
  if (matchingOption) {
37
38
  onChange(outputTransform(matchingOption));
38
39
  return;
@@ -42,7 +43,7 @@ const AutocompleteInput = ({
42
43
  return /* @__PURE__ */ jsx(
43
44
  Autocomplete,
44
45
  {
45
- value: inputTransform(value),
46
+ value: inputTransform(value || ""),
46
47
  onChange: (_, data) => handleChange(data),
47
48
  ...allowNewValue && {
48
49
  freeSolo: true,
@@ -79,18 +80,6 @@ const AutocompleteInput = ({
79
80
  }
80
81
  );
81
82
  };
82
- AutocompleteInput.propTypes = {
83
- name: PropTypes.string.isRequired,
84
- label: PropTypes.string,
85
- options: PropTypes.array.isRequired,
86
- outputTransform: PropTypes.func,
87
- inputTransform: PropTypes.func,
88
- readOnly: PropTypes.bool,
89
- previousValue: PropTypes.any,
90
- allowNewValue: PropTypes.bool,
91
- onChangeCallback: PropTypes.func,
92
- formProps: PropTypes.object
93
- };
94
83
  export {
95
84
  AutocompleteInput as default
96
85
  };
@@ -0,0 +1,2 @@
1
+ declare const MultipleAutocompleteInput: ({ name, ...props }: any) => import("react/jsx-runtime").JSX.Element;
2
+ export default MultipleAutocompleteInput;
@@ -0,0 +1,46 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { useWatch, useFieldArray } from "react-hook-form";
4
+ import AutocompleteInput from "../autocomplete-input.js";
5
+ const MultipleAutocompleteInput = ({ name, ...props }) => {
6
+ const [unsavedInput, setUnsavedInput] = useState("");
7
+ const watchAutocompleteValues = useWatch({
8
+ name
9
+ });
10
+ const { append } = useFieldArray({
11
+ name
12
+ });
13
+ const handleOnBlur = () => {
14
+ if (unsavedInput && !watchAutocompleteValues.includes(unsavedInput)) {
15
+ append(unsavedInput);
16
+ }
17
+ setUnsavedInput("");
18
+ };
19
+ const outputTransform = (values) => {
20
+ const newValues = values.map((val) => val.trim());
21
+ return newValues.filter(
22
+ (val, index) => newValues.indexOf(val) === index
23
+ );
24
+ };
25
+ return /* @__PURE__ */ jsx(
26
+ AutocompleteInput,
27
+ {
28
+ name,
29
+ fullWidth: true,
30
+ options: [],
31
+ allowNewValue: true,
32
+ clearOnBlur: true,
33
+ disableClearable: true,
34
+ outputTransform,
35
+ onInputChange: (_, val) => setUnsavedInput(val.trim() ?? ""),
36
+ onBlur: handleOnBlur,
37
+ blurOnSelect: false,
38
+ multiple: true,
39
+ ChipProps: { size: "small" },
40
+ ...props
41
+ }
42
+ );
43
+ };
44
+ export {
45
+ MultipleAutocompleteInput as default
46
+ };
@@ -13,9 +13,6 @@ export interface DirectoryItemsInputProps {
13
13
  onRowChanged?: (a: boolean) => void;
14
14
  onChange?: (e: any) => void;
15
15
  disable?: boolean;
16
- fetchDirectoryContent: (directoryUuid: UUID, elementTypes: string[]) => Promise<any>;
17
- fetchRootFolders: (types: string[]) => Promise<any>;
18
- fetchElementsInfos: (ids: UUID[], elementTypes: string[], equipmentTypes?: string[]) => Promise<any>;
19
16
  labelRequiredFromContext?: boolean;
20
17
  fetchDirectoryElementPath?: (id: UUID) => Promise<any[]>;
21
18
  }
@@ -1,19 +1,20 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { FormControl, Chip, Grid, Tooltip, IconButton } from "@mui/material";
3
3
  import { OverflowableText } from "../OverflowableText/overflowable-text.js";
4
- import { useSnackMessage } from "../../hooks/useSnackMessage.js";
5
4
  import FieldLabel from "./utils/field-label.js";
6
5
  import FolderIcon from "@mui/icons-material/Folder";
7
- import { useState, useMemo, useCallback } from "react";
6
+ import { useState, useMemo, useContext, useCallback } from "react";
8
7
  import { useFieldArray, useController } from "react-hook-form";
9
8
  import { useIntl } from "react-intl";
10
- import ErrorInput from "./error-management/error-input.js";
11
9
  import MidFormError from "./error-management/mid-form-error.js";
12
10
  import { RawReadOnlyInput } from "./raw-read-only-input.js";
13
11
  import { mergeSx } from "../../utils/styles.js";
14
12
  import DirectoryItemSelector from "../DirectoryItemSelector/directory-item-selector.js";
15
13
  import { useCustomFormContext } from "./provider/use-custom-form-context.js";
16
14
  import { isFieldRequired } from "./utils/functions.js";
15
+ import ErrorInput from "./error-management/error-input.js";
16
+ import { useSnackMessage } from "../../hooks/useSnackMessage.js";
17
+ import { FilterContext } from "../filter/filter-context.js";
17
18
  const NAME = "name";
18
19
  const styles = {
19
20
  formDirectoryElements1: {
@@ -57,9 +58,6 @@ const DirectoryItemsInput = ({
57
58
  onRowChanged,
58
59
  onChange,
59
60
  disable = false,
60
- fetchDirectoryContent,
61
- fetchRootFolders,
62
- fetchElementsInfos,
63
61
  labelRequiredFromContext = true,
64
62
  fetchDirectoryElementPath
65
63
  }) => {
@@ -79,6 +77,7 @@ const DirectoryItemsInput = ({
79
77
  });
80
78
  const formContext = useCustomFormContext();
81
79
  const { getValues, validationSchema } = formContext;
80
+ const { fetchDirectoryContent, fetchRootFolders, fetchElementsInfos } = useContext(FilterContext);
82
81
  const {
83
82
  fieldState: { error }
84
83
  } = useController({
@@ -1,5 +1,14 @@
1
+ import { default as React, FunctionComponent } from 'react';
2
+
3
+ export type ErrorMessage = {
4
+ id: string;
5
+ value: string;
6
+ } | string;
7
+ export interface ErrorInputProps {
8
+ name: string;
9
+ InputField: ({ message, }: {
10
+ message: string | React.ReactNode;
11
+ }) => React.ReactNode;
12
+ }
13
+ declare const ErrorInput: FunctionComponent<ErrorInputProps>;
1
14
  export default ErrorInput;
2
- declare function ErrorInput({ name, InputField }: {
3
- name: any;
4
- InputField: any;
5
- }): import("react/jsx-runtime").JSX.Element;
@@ -2,7 +2,10 @@ import { jsx, Fragment } from "react/jsx-runtime";
2
2
  import { useRef, useEffect } from "react";
3
3
  import { FormattedMessage } from "react-intl";
4
4
  import { useController } from "react-hook-form";
5
- const ErrorInput = ({ name, InputField }) => {
5
+ const ErrorInput = ({
6
+ name,
7
+ InputField
8
+ }) => {
6
9
  const {
7
10
  fieldState: { error },
8
11
  formState: { isSubmitting }
@@ -30,12 +33,9 @@ const ErrorInput = ({ name, InputField }) => {
30
33
  errorRef.current.scrollIntoView({ behavior: "smooth" });
31
34
  }
32
35
  }, [isSubmitting]);
33
- return /* @__PURE__ */ jsx(Fragment, { children: (error == null ? void 0 : error.message) && /* @__PURE__ */ jsx("div", { ref: errorRef, children: /* @__PURE__ */ jsx(
34
- InputField,
35
- {
36
- message: /* @__PURE__ */ jsx(FormattedMessage, { ...errorProps(error == null ? void 0 : error.message) })
37
- }
38
- ) }) });
36
+ return /* @__PURE__ */ jsx(Fragment, { children: (error == null ? void 0 : error.message) && /* @__PURE__ */ jsx("div", { ref: errorRef, children: InputField({
37
+ message: /* @__PURE__ */ jsx(FormattedMessage, { ...errorProps(error == null ? void 0 : error.message) })
38
+ }) }) });
39
39
  };
40
40
  export {
41
41
  ErrorInput as default
@@ -1,4 +1,7 @@
1
+ import { default as React, FunctionComponent } from 'react';
2
+
3
+ interface FieldErrorAlertProps {
4
+ message: string | React.ReactNode;
5
+ }
6
+ declare const FieldErrorAlert: FunctionComponent<FieldErrorAlertProps>;
1
7
  export default FieldErrorAlert;
2
- declare function FieldErrorAlert({ message }: {
3
- message: any;
4
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,8 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Grid, Alert } from "@mui/material";
3
- const FieldErrorAlert = ({ message }) => {
3
+ const FieldErrorAlert = ({
4
+ message
5
+ }) => {
4
6
  return /* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Alert, { severity: "error", children: message }) });
5
7
  };
6
8
  export {
@@ -1,18 +1,6 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { TextInputProps } from '../text-input';
3
+
4
+ export type FloatInputProps = Omit<TextInputProps, 'outputTransform' | 'inputTransform' | 'acceptValue'>;
5
+ declare const FloatInput: FunctionComponent<FloatInputProps>;
1
6
  export default FloatInput;
2
- declare function FloatInput(props: any): import("react/jsx-runtime").JSX.Element;
3
- declare namespace FloatInput {
4
- let propTypes: {
5
- name: import('prop-types').Requireable<string>;
6
- label: import('prop-types').Requireable<string>;
7
- labelValues: import('prop-types').Requireable<object>;
8
- id: import('prop-types').Requireable<string>;
9
- adornment: import('prop-types').Requireable<object>;
10
- customAdornment: import('prop-types').Requireable<object>;
11
- outputTransform: import('prop-types').Requireable<(...args: any[]) => any>;
12
- inputTransform: import('prop-types').Requireable<(...args: any[]) => any>;
13
- acceptValue: import('prop-types').Requireable<(...args: any[]) => any>;
14
- previousValue: import('prop-types').Requireable<any>;
15
- clearable: import('prop-types').Requireable<boolean>;
16
- formProps: import('prop-types').Requireable<object>;
17
- };
18
- }
@@ -11,12 +11,13 @@ const FloatInput = (props) => {
11
11
  const inputTransform = (value) => {
12
12
  if (typeof value == "number" && !isNaN(value)) {
13
13
  return normalizeFixed(value);
14
- } else {
14
+ } else if (typeof value == "string") {
15
15
  if (["-", "."].includes(value)) {
16
16
  return value;
17
17
  }
18
- return value === null || isNaN(value) ? "" : value;
18
+ return Number.isNaN(value) ? "" : value;
19
19
  }
20
+ return "";
20
21
  };
21
22
  const outputTransform = (value) => {
22
23
  if (value === "-") {
@@ -42,9 +43,6 @@ const FloatInput = (props) => {
42
43
  }
43
44
  );
44
45
  };
45
- FloatInput.propTypes = {
46
- ...TextInput.propTypes
47
- };
48
46
  export {
49
47
  FloatInput as default
50
48
  };
@@ -2,17 +2,20 @@ export default IntegerInput;
2
2
  declare function IntegerInput(props: any): import("react/jsx-runtime").JSX.Element;
3
3
  declare namespace IntegerInput {
4
4
  let propTypes: {
5
- name: import('prop-types').Requireable<string>;
6
- label: import('prop-types').Requireable<string>;
7
- labelValues: import('prop-types').Requireable<object>;
8
- id: import('prop-types').Requireable<string>;
9
- adornment: import('prop-types').Requireable<object>;
10
- customAdornment: import('prop-types').Requireable<object>;
11
- outputTransform: import('prop-types').Requireable<(...args: any[]) => any>;
12
- inputTransform: import('prop-types').Requireable<(...args: any[]) => any>;
13
- acceptValue: import('prop-types').Requireable<(...args: any[]) => any>;
14
- previousValue: import('prop-types').Requireable<any>;
15
- clearable: import('prop-types').Requireable<boolean>;
16
- formProps: import('prop-types').Requireable<object>;
5
+ name?: import('react').Validator<string> | undefined;
6
+ label?: import('react').Validator<string | null | undefined> | undefined;
7
+ labelValues?: import('react').Validator<any> | undefined;
8
+ id?: import('react').Validator<string | null | undefined> | undefined;
9
+ adornment?: import('react').Validator<{
10
+ position: string;
11
+ text: string;
12
+ } | null | undefined> | undefined;
13
+ customAdornment?: import('react').Validator<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null | undefined> | undefined;
14
+ outputTransform?: import('react').Validator<((value: string) => import("../../../utils/types").Input | null) | null | undefined> | undefined;
15
+ inputTransform?: import('react').Validator<((value: import("../../../utils/types").Input) => string) | null | undefined> | undefined;
16
+ acceptValue?: import('react').Validator<((value: string) => boolean) | null | undefined> | undefined;
17
+ previousValue?: import('react').Validator<import("../../../utils/types").Input | null | undefined> | undefined;
18
+ clearable?: import('react').Validator<boolean | null | undefined> | undefined;
19
+ formProps?: import('react').Validator<Omit<import("@mui/material").TextFieldProps | import("../utils/text-field-with-adornment").TextFieldWithAdornmentProps, "onChange" | "value" | "InputProps" | "inputProps" | "inputRef"> | null | undefined> | undefined;
17
20
  };
18
21
  }
@@ -1,2 +1,8 @@
1
- export function isIntegerNumber(val: any): boolean;
2
- export function isFloatNumber(val: any): boolean;
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
+ */
7
+ export declare const isIntegerNumber: (val: string) => boolean;
8
+ export declare const isFloatNumber: (val: string) => boolean;
@@ -5,6 +5,7 @@ import * as yup from 'yup';
5
5
  type CustomFormContextProps = {
6
6
  removeOptional?: boolean;
7
7
  validationSchema: yup.AnySchema;
8
+ language?: string;
8
9
  };
9
10
  export type MergedFormContextProps = UseFormReturn<any> & CustomFormContextProps;
10
11
  type CustomFormProviderProps = PropsWithChildren<MergedFormContextProps>;
@@ -2,18 +2,27 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { createContext } from "react";
3
3
  import { FormProvider } from "react-hook-form";
4
4
  import * as yup from "yup";
5
+ import { getSystemLanguage } from "../../../hooks/localized-countries-hook.js";
5
6
  const CustomFormContext = createContext({
6
7
  removeOptional: false,
7
- validationSchema: yup.object()
8
+ validationSchema: yup.object(),
9
+ language: getSystemLanguage()
8
10
  });
9
11
  const CustomFormProvider = (props) => {
10
- const { validationSchema, removeOptional, children, ...formMethods } = props;
12
+ const {
13
+ validationSchema,
14
+ removeOptional,
15
+ language,
16
+ children,
17
+ ...formMethods
18
+ } = props;
11
19
  return /* @__PURE__ */ jsx(FormProvider, { ...formMethods, children: /* @__PURE__ */ jsx(
12
20
  CustomFormContext.Provider,
13
21
  {
14
22
  value: {
15
23
  validationSchema,
16
- removeOptional
24
+ removeOptional,
25
+ language
17
26
  },
18
27
  children
19
28
  }
@@ -1,18 +1,15 @@
1
- import { default as PropTypes } from 'prop-types';
2
- export default RadioInput;
3
- declare function RadioInput({ name, label, id, options, formProps }: {
4
- name: any;
5
- label: any;
6
- id: any;
7
- options: any;
8
- formProps: any;
9
- }): import("react/jsx-runtime").JSX.Element;
10
- declare namespace RadioInput {
11
- namespace propTypes {
12
- let name: PropTypes.Validator<string>;
13
- let label: PropTypes.Requireable<string>;
14
- let id: PropTypes.Requireable<string>;
15
- let options: PropTypes.Validator<any[]>;
16
- let formProps: PropTypes.Requireable<object>;
17
- }
1
+ import { RadioGroupProps } from '@mui/material';
2
+
3
+ type RadioOptions = Array<{
4
+ id: string;
5
+ label: string;
6
+ }>;
7
+ interface RadioInputProps {
8
+ name: string;
9
+ label?: string;
10
+ id?: string;
11
+ options: RadioOptions;
12
+ formProps?: Omit<RadioGroupProps, 'value'>;
18
13
  }
14
+ declare const RadioInput: ({ name, label, id, options, formProps, }: RadioInputProps) => import("react/jsx-runtime").JSX.Element;
15
+ export default RadioInput;
@@ -1,10 +1,15 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
- import PropTypes from "prop-types";
3
2
  import { FormControl, FormLabel, RadioGroup, FormControlLabel, Radio } from "@mui/material";
4
3
  import { FormattedMessage } from "react-intl";
5
4
  import { useController } from "react-hook-form";
6
5
  import FieldLabel from "./utils/field-label.js";
7
- const RadioInput = ({ name, label, id, options, formProps }) => {
6
+ const RadioInput = ({
7
+ name,
8
+ label,
9
+ id,
10
+ options,
11
+ formProps
12
+ }) => {
8
13
  const {
9
14
  field: { onChange, value }
10
15
  } = useController({ name });
@@ -31,13 +36,6 @@ const RadioInput = ({ name, label, id, options, formProps }) => {
31
36
  )
32
37
  ] });
33
38
  };
34
- RadioInput.propTypes = {
35
- name: PropTypes.string.isRequired,
36
- label: PropTypes.string,
37
- id: PropTypes.string,
38
- options: PropTypes.array.isRequired,
39
- formProps: PropTypes.object
40
- };
41
39
  export {
42
40
  RadioInput as default
43
41
  };
@@ -0,0 +1,54 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { default as yup } from '../../utils/yup-config.ts';
3
+
4
+ export declare const RangeType: {
5
+ EQUALITY: {
6
+ id: string;
7
+ label: string;
8
+ };
9
+ GREATER_THAN: {
10
+ id: string;
11
+ label: string;
12
+ };
13
+ GREATER_OR_EQUAL: {
14
+ id: string;
15
+ label: string;
16
+ };
17
+ LESS_THAN: {
18
+ id: string;
19
+ label: string;
20
+ };
21
+ LESS_OR_EQUAL: {
22
+ id: string;
23
+ label: string;
24
+ };
25
+ RANGE: {
26
+ id: string;
27
+ label: string;
28
+ };
29
+ };
30
+ export declare const DEFAULT_RANGE_VALUE: {
31
+ type: string;
32
+ value1: null;
33
+ value2: null;
34
+ };
35
+ export declare const getRangeInputDataForm: (name: string, rangeValue: unknown) => {
36
+ [x: string]: unknown;
37
+ };
38
+ export declare const getRangeInputSchema: (name: string) => {
39
+ [x: string]: yup.ObjectSchema<{
40
+ type: string | undefined;
41
+ value1: number | undefined;
42
+ value2: number | undefined;
43
+ }, yup.AnyObject, {
44
+ type: undefined;
45
+ value1: undefined;
46
+ value2: undefined;
47
+ }, "">;
48
+ };
49
+ interface RangeInputProps {
50
+ name: string;
51
+ label: string;
52
+ }
53
+ declare const RangeInput: FunctionComponent<RangeInputProps>;
54
+ export default RangeInput;