@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.
- package/dist/assets/criteria-based-filter-edition-dialog.css +168 -0
- package/dist/chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js +1673 -0
- package/dist/chunks/filter-properties.GRon8-ML.js +195 -0
- package/dist/components/DirectoryItemSelector/directory-item-selector.d.ts +13 -3
- package/dist/components/DirectoryItemSelector/directory-item-selector.js +14 -10
- package/dist/components/dialogs/custom-mui-dialog.d.ts +21 -0
- package/dist/components/dialogs/custom-mui-dialog.js +87 -0
- package/dist/components/dialogs/description-modification-dialog.d.ts +11 -0
- package/dist/components/dialogs/description-modification-dialog.js +71 -0
- package/dist/components/dialogs/popup-confirmation-dialog.d.ts +11 -0
- package/dist/components/dialogs/popup-confirmation-dialog.js +38 -0
- package/dist/components/filter/constants/equipment-types.d.ts +72 -0
- package/dist/components/filter/constants/equipment-types.js +63 -0
- package/dist/components/filter/constants/expert-filter-constants.d.ts +546 -0
- package/dist/components/filter/constants/expert-filter-constants.js +663 -0
- package/dist/components/filter/constants/field-constants.d.ts +45 -0
- package/dist/components/filter/constants/field-constants.js +43 -0
- package/dist/components/filter/constants/filter-constants.d.ts +21 -0
- package/dist/components/filter/constants/filter-constants.js +10 -0
- package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.d.ts +29 -0
- package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.js +19 -0
- package/dist/components/filter/criteria-based/criteria-based-filter-form.d.ts +15 -0
- package/dist/components/filter/criteria-based/criteria-based-filter-form.js +33 -0
- package/dist/components/filter/criteria-based/criteria-based-filter-utils.d.ts +37 -0
- package/dist/components/filter/criteria-based/criteria-based-filter-utils.js +127 -0
- package/dist/components/filter/criteria-based/criteria-based-form.d.ts +7 -0
- package/dist/components/filter/criteria-based/criteria-based-form.js +50 -0
- package/dist/components/filter/criteria-based/filter-free-properties.d.ts +10 -0
- package/dist/components/filter/criteria-based/filter-free-properties.js +15 -0
- package/dist/components/filter/criteria-based/filter-properties.d.ts +21 -0
- package/dist/components/filter/criteria-based/filter-properties.js +19 -0
- package/dist/components/filter/criteria-based/filter-property.d.ts +19 -0
- package/dist/components/filter/criteria-based/filter-property.js +67 -0
- package/dist/components/filter/expert/expert-filter-edition-dialog.d.ts +28 -0
- package/dist/components/filter/expert/expert-filter-edition-dialog.js +20 -0
- package/dist/components/filter/expert/expert-filter-form.d.ts +21 -0
- package/dist/components/filter/expert/expert-filter-form.js +22 -0
- package/dist/components/filter/expert/expert-filter-utils.d.ts +19 -0
- package/dist/components/filter/expert/expert-filter-utils.js +302 -0
- package/dist/components/filter/expert/expert-filter.type.d.ts +113 -0
- package/dist/components/filter/expert/expert-filter.type.js +103 -0
- package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.d.ts +22 -0
- package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.js +19 -0
- package/dist/components/filter/explicit-naming/explicit-naming-filter-form.d.ts +22 -0
- package/dist/components/filter/explicit-naming/explicit-naming-filter-form.js +23 -0
- package/dist/components/filter/filter-context.d.ts +12 -0
- package/dist/components/filter/filter-context.js +10 -0
- package/dist/components/filter/filter-creation-dialog.d.ts +21 -0
- package/dist/components/filter/filter-creation-dialog.js +17 -0
- package/dist/components/filter/filter-form.d.ts +11 -0
- package/dist/components/filter/filter-form.js +14 -0
- package/dist/components/filter/utils/criteria-based-utils.d.ts +28 -0
- package/dist/components/filter/utils/criteria-based-utils.js +197 -0
- package/dist/components/filter/utils/filters-utils.d.ts +5 -0
- package/dist/components/filter/utils/filters-utils.js +99 -0
- package/dist/components/inputs/select-clearable.d.ts +14 -0
- package/dist/components/inputs/select-clearable.js +40 -0
- package/dist/components/react-hook-form/ExpandingTextField.d.ts +1 -1
- package/dist/components/react-hook-form/ExpandingTextField.js +0 -37
- package/dist/components/react-hook-form/ag-grid-table-rhf/bottom-right-buttons.d.ts +17 -0
- package/dist/components/react-hook-form/ag-grid-table-rhf/bottom-right-buttons.js +15 -0
- package/dist/components/react-hook-form/ag-grid-table-rhf/cell-editors/numericEditor.d.ts +23 -0
- package/dist/components/react-hook-form/ag-grid-table-rhf/cell-editors/numericEditor.js +70 -0
- package/dist/components/react-hook-form/ag-grid-table-rhf/csv-uploader/csv-uploader.d.ts +16 -0
- package/dist/components/react-hook-form/ag-grid-table-rhf/csv-uploader/csv-uploader.js +69 -0
- package/dist/components/react-hook-form/ag-grid-table-rhf/custom-ag-grid-table.d.ts +23 -0
- package/dist/components/react-hook-form/ag-grid-table-rhf/custom-ag-grid-table.js +15 -0
- package/dist/components/react-hook-form/autocomplete-input.d.ts +17 -29
- package/dist/components/react-hook-form/autocomplete-input.js +4 -15
- package/dist/components/react-hook-form/autocomplete-inputs/multiple-autocomplete-input.d.ts +2 -0
- package/dist/components/react-hook-form/autocomplete-inputs/multiple-autocomplete-input.js +46 -0
- package/dist/components/react-hook-form/directory-items-input.d.ts +0 -3
- package/dist/components/react-hook-form/directory-items-input.js +5 -6
- package/dist/components/react-hook-form/error-management/error-input.d.ts +13 -4
- package/dist/components/react-hook-form/error-management/error-input.js +7 -7
- package/dist/components/react-hook-form/error-management/field-error-alert.d.ts +6 -3
- package/dist/components/react-hook-form/error-management/field-error-alert.js +3 -1
- package/dist/components/react-hook-form/numbers/float-input.d.ts +5 -17
- package/dist/components/react-hook-form/numbers/float-input.js +3 -5
- package/dist/components/react-hook-form/numbers/integer-input.d.ts +15 -12
- package/dist/components/react-hook-form/numbers/utils.d.ts +8 -2
- package/dist/components/react-hook-form/provider/custom-form-provider.d.ts +1 -0
- package/dist/components/react-hook-form/provider/custom-form-provider.js +12 -3
- package/dist/components/react-hook-form/radio-input.d.ts +14 -17
- package/dist/components/react-hook-form/radio-input.js +7 -9
- package/dist/components/react-hook-form/range-input.d.ts +54 -0
- package/dist/components/react-hook-form/range-input.js +118 -0
- package/dist/components/react-hook-form/select-inputs/countries-input.d.ts +8 -0
- package/dist/components/react-hook-form/select-inputs/countries-input.js +36 -0
- package/dist/components/react-hook-form/select-inputs/input-with-popup-confirmation.d.ts +2 -0
- package/dist/components/react-hook-form/select-inputs/input-with-popup-confirmation.js +61 -0
- package/dist/components/react-hook-form/select-inputs/mui-select-input.d.ts +12 -0
- package/dist/components/react-hook-form/select-inputs/mui-select-input.js +25 -0
- package/dist/components/react-hook-form/select-inputs/select-input.d.ts +9 -0
- package/dist/components/react-hook-form/select-inputs/select-input.js +37 -0
- package/dist/components/react-hook-form/text-input.d.ts +23 -32
- package/dist/components/react-hook-form/text-input.js +6 -20
- package/dist/components/react-hook-form/unique-name-input.d.ts +21 -0
- package/dist/components/react-hook-form/unique-name-input.js +129 -0
- package/dist/components/react-hook-form/utils/cancel-button.d.ts +9 -8
- package/dist/components/react-hook-form/utils/field-label.d.ts +12 -5
- package/dist/components/react-hook-form/utils/field-label.js +5 -1
- package/dist/components/react-hook-form/utils/functions.d.ts +12 -4
- package/dist/components/react-hook-form/utils/functions.js +21 -1
- package/dist/components/react-hook-form/utils/submit-button.d.ts +9 -8
- package/dist/components/react-hook-form/utils/text-field-with-adornment.d.ts +11 -11
- package/dist/components/react-hook-form/utils/text-field-with-adornment.js +18 -23
- package/dist/components/react-query-builder-inputs/add-button.d.ts +8 -0
- package/dist/components/react-query-builder-inputs/add-button.js +17 -0
- package/dist/components/react-query-builder-inputs/combinator-selector.d.ts +5 -0
- package/dist/components/react-query-builder-inputs/combinator-selector.js +38 -0
- package/dist/components/react-query-builder-inputs/country-value-editor.d.ts +5 -0
- package/dist/components/react-query-builder-inputs/country-value-editor.js +46 -0
- package/dist/components/react-query-builder-inputs/custom-react-query-builder.d.ts +8 -0
- package/dist/components/react-query-builder-inputs/custom-react-query-builder.js +21 -0
- package/dist/components/react-query-builder-inputs/element-value-editor.d.ts +14 -0
- package/dist/components/react-query-builder-inputs/element-value-editor.js +69 -0
- package/dist/components/react-query-builder-inputs/property-value-editor.d.ts +9 -0
- package/dist/components/react-query-builder-inputs/property-value-editor.js +100 -0
- package/dist/components/react-query-builder-inputs/remove-button.d.ts +5 -0
- package/dist/components/react-query-builder-inputs/remove-button.js +9 -0
- package/dist/components/react-query-builder-inputs/text-value-editor.d.ts +5 -0
- package/dist/components/react-query-builder-inputs/text-value-editor.js +34 -0
- package/dist/components/react-query-builder-inputs/translated-value-editor.d.ts +5 -0
- package/dist/components/react-query-builder-inputs/translated-value-editor.js +58 -0
- package/dist/components/react-query-builder-inputs/use-convert-value.d.ts +9 -0
- package/dist/components/react-query-builder-inputs/use-convert-value.js +24 -0
- package/dist/components/react-query-builder-inputs/use-valid.d.ts +7 -0
- package/dist/components/react-query-builder-inputs/use-valid.js +13 -0
- package/dist/components/react-query-builder-inputs/value-editor.d.ts +5 -0
- package/dist/components/react-query-builder-inputs/value-editor.js +18 -0
- package/dist/components/react-query-builder-inputs/value-selector.d.ts +4 -0
- package/dist/components/react-query-builder-inputs/value-selector.js +14 -0
- package/dist/hooks/localized-countries-hook.d.ts +6 -0
- package/dist/hooks/localized-countries-hook.js +45 -0
- package/dist/hooks/predefined-properties-hook.d.ts +18 -0
- package/dist/hooks/predefined-properties-hook.js +43 -0
- package/dist/hooks/useDebounce.d.ts +7 -1
- package/dist/hooks/useSnackMessage.d.ts +23 -5
- package/dist/hooks/useSnackMessage.js +14 -12
- package/dist/index.d.ts +87 -142
- package/dist/index.js +168 -91
- package/dist/utils/FetchStatus.d.ts +12 -0
- package/dist/utils/FetchStatus.js +9 -0
- package/dist/utils/conversion-utils.d.ts +12 -0
- package/dist/utils/conversion-utils.js +22 -0
- package/dist/utils/equipment-types-for-predefined-properties-mapper.d.ts +3 -0
- package/dist/utils/equipment-types-for-predefined-properties-mapper.js +31 -0
- package/dist/utils/functions.d.ts +14 -0
- package/dist/utils/functions.js +16 -0
- package/dist/utils/types.d.ts +21 -0
- package/dist/utils/types.js +1 -0
- package/dist/utils/yup-config.d.ts +8 -0
- package/dist/utils/yup-config.js +16 -0
- package/package.json +15 -2
- package/dist/components/react-hook-form/select-input.d.ts +0 -17
- package/dist/components/react-hook-form/select-input.js +0 -30
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { FormattedMessage } from "react-intl";
|
|
3
3
|
import { getIn } from "yup";
|
|
4
|
+
import { Grid } from "@mui/material";
|
|
4
5
|
function genHelperPreviousValue(previousValue, adornment) {
|
|
5
6
|
return {
|
|
6
7
|
...(previousValue || previousValue === 0) && {
|
|
@@ -27,9 +28,28 @@ const isFieldRequired = (fieldName, schema, values) => {
|
|
|
27
28
|
const { schema: fieldSchema, parent: parentValues } = getIn(schema, fieldName, values) || {};
|
|
28
29
|
return ((_a = fieldSchema.describe({ parent: parentValues })) == null ? void 0 : _a.optional) === false;
|
|
29
30
|
};
|
|
31
|
+
const gridItem = (field, size = 6) => {
|
|
32
|
+
return /* @__PURE__ */ jsx(Grid, { item: true, xs: size, alignItems: "start", children: field });
|
|
33
|
+
};
|
|
34
|
+
const isFloatNumber = (val) => {
|
|
35
|
+
return /^-?[0-9]*[.,]?[0-9]*$/.test(val);
|
|
36
|
+
};
|
|
37
|
+
const toFloatOrNullValue = (value) => {
|
|
38
|
+
if (value === "-") {
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
if (value === "0") {
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
const tmp = (value == null ? void 0 : value.replace(",", ".")) || "";
|
|
45
|
+
return parseFloat(tmp) || null;
|
|
46
|
+
};
|
|
30
47
|
export {
|
|
31
48
|
genHelperError,
|
|
32
49
|
genHelperPreviousValue,
|
|
50
|
+
gridItem,
|
|
33
51
|
identity,
|
|
34
|
-
isFieldRequired
|
|
52
|
+
isFieldRequired,
|
|
53
|
+
isFloatNumber,
|
|
54
|
+
toFloatOrNullValue
|
|
35
55
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { default as PropTypes } from 'prop-types';
|
|
2
|
+
|
|
3
|
+
declare const SubmitButton: {
|
|
4
|
+
({ ...buttonProps }: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
propTypes: {
|
|
8
|
+
buttonProps: PropTypes.Requireable<object>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
2
11
|
export default SubmitButton;
|
|
3
|
-
declare function SubmitButton({ ...buttonProps }: {
|
|
4
|
-
[x: string]: any;
|
|
5
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
declare namespace SubmitButton {
|
|
7
|
-
namespace propTypes {
|
|
8
|
-
let buttonProps: PropTypes.Requireable<object>;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Input } from '../../../utils/types.ts';
|
|
2
|
+
import { TextFieldProps } from '@mui/material';
|
|
3
|
+
import { FunctionComponent } from 'react';
|
|
4
|
+
|
|
5
|
+
export type TextFieldWithAdornmentProps = TextFieldProps & {
|
|
6
|
+
value: Input;
|
|
7
|
+
adornmentPosition: string;
|
|
8
|
+
adornmentText: string;
|
|
9
|
+
handleClearValue?: () => void;
|
|
10
|
+
};
|
|
11
|
+
declare const TextFieldWithAdornment: FunctionComponent<TextFieldWithAdornmentProps>;
|
|
2
12
|
export default TextFieldWithAdornment;
|
|
3
|
-
declare function TextFieldWithAdornment(props: any): import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
declare namespace TextFieldWithAdornment {
|
|
5
|
-
namespace propTypes {
|
|
6
|
-
let adornmentPosition: PropTypes.Validator<string>;
|
|
7
|
-
let adornmentText: PropTypes.Validator<string>;
|
|
8
|
-
let value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
9
|
-
let variant: PropTypes.Requireable<string>;
|
|
10
|
-
let handleClearValue: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useCallback } from "react";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
3
|
import { Clear } from "@mui/icons-material";
|
|
5
4
|
import { InputAdornment, IconButton, TextField } from "@mui/material";
|
|
6
5
|
const TextFieldWithAdornment = (props) => {
|
|
@@ -13,20 +12,23 @@ const TextFieldWithAdornment = (props) => {
|
|
|
13
12
|
...otherProps
|
|
14
13
|
} = props;
|
|
15
14
|
const [isFocused, setIsFocused] = useState(false);
|
|
16
|
-
const getAdornmentStyle = useCallback(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
const getAdornmentStyle = useCallback(
|
|
16
|
+
(variant2) => {
|
|
17
|
+
if (variant2 === "filled") {
|
|
18
|
+
return {
|
|
19
|
+
alignItems: "start",
|
|
20
|
+
marginBottom: "0.4em"
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
if (variant2 === "standard") {
|
|
24
|
+
return {
|
|
25
|
+
marginBottom: "0.3em"
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return void 0;
|
|
29
|
+
},
|
|
30
|
+
[]
|
|
31
|
+
);
|
|
30
32
|
const getClearAdornment = useCallback(
|
|
31
33
|
(position) => {
|
|
32
34
|
return /* @__PURE__ */ jsx(InputAdornment, { position, children: /* @__PURE__ */ jsx(IconButton, { onClick: handleClearValue, children: /* @__PURE__ */ jsx(Clear, {}) }) });
|
|
@@ -39,7 +41,7 @@ const TextFieldWithAdornment = (props) => {
|
|
|
39
41
|
InputAdornment,
|
|
40
42
|
{
|
|
41
43
|
position,
|
|
42
|
-
sx: getAdornmentStyle(variant),
|
|
44
|
+
sx: variant && getAdornmentStyle(variant),
|
|
43
45
|
children: adornmentText
|
|
44
46
|
}
|
|
45
47
|
);
|
|
@@ -84,13 +86,6 @@ const TextFieldWithAdornment = (props) => {
|
|
|
84
86
|
}
|
|
85
87
|
);
|
|
86
88
|
};
|
|
87
|
-
TextFieldWithAdornment.propTypes = {
|
|
88
|
-
adornmentPosition: PropTypes.string.isRequired,
|
|
89
|
-
adornmentText: PropTypes.string.isRequired,
|
|
90
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
91
|
-
variant: PropTypes.string,
|
|
92
|
-
handleClearValue: PropTypes.func
|
|
93
|
-
};
|
|
94
89
|
export {
|
|
95
90
|
TextFieldWithAdornment as default
|
|
96
91
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { ActionWithRulesAndAddersProps } from 'react-querybuilder';
|
|
3
|
+
|
|
4
|
+
interface ActionWithRulesAndAddersWithLabelProps extends ActionWithRulesAndAddersProps {
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
declare const AddButton: FunctionComponent<ActionWithRulesAndAddersWithLabelProps>;
|
|
8
|
+
export default AddButton;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "@mui/material";
|
|
3
|
+
import AddIcon from "@mui/icons-material/ControlPoint";
|
|
4
|
+
import { FormattedMessage } from "react-intl";
|
|
5
|
+
const AddButton = (props) => /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
|
|
6
|
+
Button,
|
|
7
|
+
{
|
|
8
|
+
startIcon: /* @__PURE__ */ jsx(AddIcon, {}),
|
|
9
|
+
onClick: props.handleOnClick,
|
|
10
|
+
size: "small",
|
|
11
|
+
className: "add-button",
|
|
12
|
+
children: /* @__PURE__ */ jsx(FormattedMessage, { id: props.label })
|
|
13
|
+
}
|
|
14
|
+
) });
|
|
15
|
+
export {
|
|
16
|
+
AddButton as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback } from "react";
|
|
3
|
+
import PopupConfirmationDialog from "../dialogs/popup-confirmation-dialog.js";
|
|
4
|
+
import { MaterialValueSelector } from "@react-querybuilder/material";
|
|
5
|
+
const CombinatorSelector = (props) => {
|
|
6
|
+
const [tempCombinator, setTempCombinator] = useState(props.value);
|
|
7
|
+
const [openPopup, setOpenPopup] = useState(false);
|
|
8
|
+
const handlePopupConfirmation = useCallback(() => {
|
|
9
|
+
props.handleOnChange(tempCombinator);
|
|
10
|
+
setOpenPopup(false);
|
|
11
|
+
}, [props, tempCombinator]);
|
|
12
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13
|
+
/* @__PURE__ */ jsx(
|
|
14
|
+
PopupConfirmationDialog,
|
|
15
|
+
{
|
|
16
|
+
message: "changeOperatorMessage",
|
|
17
|
+
validateButtonLabel: "button.changeOperator",
|
|
18
|
+
openConfirmationPopup: openPopup,
|
|
19
|
+
setOpenConfirmationPopup: setOpenPopup,
|
|
20
|
+
handlePopupConfirmation
|
|
21
|
+
}
|
|
22
|
+
),
|
|
23
|
+
/* @__PURE__ */ jsx(
|
|
24
|
+
MaterialValueSelector,
|
|
25
|
+
{
|
|
26
|
+
...props,
|
|
27
|
+
title: void 0,
|
|
28
|
+
handleOnChange: (newCombinator) => {
|
|
29
|
+
setTempCombinator(newCombinator);
|
|
30
|
+
setOpenPopup(true);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
] });
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
CombinatorSelector as default
|
|
38
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MaterialValueEditor } from "@react-querybuilder/material";
|
|
3
|
+
import { Autocomplete, TextField } from "@mui/material";
|
|
4
|
+
import useConvertValue from "./use-convert-value.js";
|
|
5
|
+
import useValid from "./use-valid.js";
|
|
6
|
+
import { useLocalizedCountries } from "../../hooks/localized-countries-hook.js";
|
|
7
|
+
import { useCustomFormContext } from "../react-hook-form/provider/use-custom-form-context.js";
|
|
8
|
+
import { useMemo } from "react";
|
|
9
|
+
const CountryValueEditor = (props) => {
|
|
10
|
+
const { language } = useCustomFormContext();
|
|
11
|
+
const { translate, countryCodes } = useLocalizedCountries(language);
|
|
12
|
+
const countriesList = useMemo(
|
|
13
|
+
() => countryCodes.map((country) => {
|
|
14
|
+
return { name: country, label: translate(country) };
|
|
15
|
+
}),
|
|
16
|
+
[countryCodes, translate]
|
|
17
|
+
);
|
|
18
|
+
useConvertValue(props);
|
|
19
|
+
const valid = useValid(props);
|
|
20
|
+
if (!Array.isArray(props.value)) {
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
MaterialValueEditor,
|
|
23
|
+
{
|
|
24
|
+
...props,
|
|
25
|
+
values: countriesList,
|
|
26
|
+
title: void 0
|
|
27
|
+
}
|
|
28
|
+
);
|
|
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
|
+
}
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
CountryValueEditor as default
|
|
46
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Field } from 'react-querybuilder';
|
|
2
|
+
|
|
3
|
+
interface CustomReactQueryBuilderProps {
|
|
4
|
+
name: string;
|
|
5
|
+
fields: Field[];
|
|
6
|
+
}
|
|
7
|
+
declare const CustomReactQueryBuilder: (props: CustomReactQueryBuilderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default CustomReactQueryBuilder;
|
|
@@ -0,0 +1,21 @@
|
|
|
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 { j } from "../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
|
|
11
|
+
import "./combinator-selector.js";
|
|
12
|
+
import "./add-button.js";
|
|
13
|
+
import "./value-selector.js";
|
|
14
|
+
import "react";
|
|
15
|
+
import "../filter/constants/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";
|
|
19
|
+
export {
|
|
20
|
+
j as default
|
|
21
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
|
|
3
|
+
interface ElementValueEditorProps {
|
|
4
|
+
name: string;
|
|
5
|
+
elementType: string;
|
|
6
|
+
equipmentTypes?: string[];
|
|
7
|
+
titleId: string;
|
|
8
|
+
hideErrorMessage: boolean;
|
|
9
|
+
onChange?: (e: any) => void;
|
|
10
|
+
itemFilter?: any;
|
|
11
|
+
defaultValue?: any;
|
|
12
|
+
}
|
|
13
|
+
declare const ElementValueEditor: FunctionComponent<ElementValueEditorProps>;
|
|
14
|
+
export default ElementValueEditor;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import "uuid";
|
|
4
|
+
import "../TreeViewFinder/TreeViewFinder.js";
|
|
5
|
+
import "../TopBar/TopBar.js";
|
|
6
|
+
import "../TopBar/GridLogo.js";
|
|
7
|
+
import "../TopBar/AboutDialog.js";
|
|
8
|
+
import "../SnackbarProvider/SnackbarProvider.js";
|
|
9
|
+
import "react-router-dom";
|
|
10
|
+
import "../../utils/AuthService.js";
|
|
11
|
+
import "@mui/material";
|
|
12
|
+
import "@mui/icons-material";
|
|
13
|
+
import "react-intl";
|
|
14
|
+
import "../MuiVirtualizedTable/MuiVirtualizedTable.js";
|
|
15
|
+
import "../ReportViewer/report-item.js";
|
|
16
|
+
import "../ReportViewer/log-table.js";
|
|
17
|
+
import "../ReportViewer/report-tree-view-context.js";
|
|
18
|
+
import "@mui/x-tree-view";
|
|
19
|
+
import "../OverflowableText/overflowable-text.js";
|
|
20
|
+
import "../ElementSearchDialog/element-search-dialog.js";
|
|
21
|
+
import "../ElementSearchDialog/tag-renderer.js";
|
|
22
|
+
import "../react-hook-form/utils/submit-button.js";
|
|
23
|
+
import "../react-hook-form/utils/cancel-button.js";
|
|
24
|
+
import "../react-hook-form/provider/custom-form-provider.js";
|
|
25
|
+
import "../dialogs/description-modification-dialog.js";
|
|
26
|
+
import "react-hook-form";
|
|
27
|
+
import "yup";
|
|
28
|
+
import "../react-hook-form/provider/use-custom-form-context.js";
|
|
29
|
+
import "../dialogs/popup-confirmation-dialog.js";
|
|
30
|
+
import "../filter/utils/criteria-based-utils.js";
|
|
31
|
+
import { i } from "../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
|
|
32
|
+
import "ag-grid-react";
|
|
33
|
+
import "ag-grid-community/styles/ag-grid.css";
|
|
34
|
+
import "ag-grid-community/styles/ag-theme-alpine.css";
|
|
35
|
+
import "autosuggest-highlight/match";
|
|
36
|
+
import "autosuggest-highlight/parse";
|
|
37
|
+
import "clsx";
|
|
38
|
+
import "../CardErrorBoundary/card-error-boundary.js";
|
|
39
|
+
import "notistack";
|
|
40
|
+
import "../react-hook-form/slider-input.js";
|
|
41
|
+
import "../react-hook-form/numbers/integer-input.js";
|
|
42
|
+
import "../react-hook-form/booleans/checkbox-input.js";
|
|
43
|
+
import "../react-hook-form/booleans/switch-input.js";
|
|
44
|
+
import "../react-hook-form/directory-items-input.js";
|
|
45
|
+
import "../../chunks/filter-properties.GRon8-ML.js";
|
|
46
|
+
import "@mui/icons-material/Delete";
|
|
47
|
+
import "@mui/material/IconButton";
|
|
48
|
+
import "@mui/material/Grid";
|
|
49
|
+
import "../filter/expert/expert-filter-utils.js";
|
|
50
|
+
import "../react-hook-form/range-input.js";
|
|
51
|
+
import "../react-hook-form/select-inputs/mui-select-input.js";
|
|
52
|
+
import "localized-countries";
|
|
53
|
+
import "localized-countries/data/fr";
|
|
54
|
+
import "localized-countries/data/en";
|
|
55
|
+
import "@mui/material/Dialog";
|
|
56
|
+
import "@mui/material/DialogTitle";
|
|
57
|
+
import "@mui/material/DialogContent";
|
|
58
|
+
import "@mui/material/DialogActions";
|
|
59
|
+
import "react-papaparse";
|
|
60
|
+
import "@mui/material/Button";
|
|
61
|
+
import "react-csv-downloader";
|
|
62
|
+
import "@mui/material/Alert";
|
|
63
|
+
import "@mui/icons-material/Check";
|
|
64
|
+
import "@mui/material/CircularProgress";
|
|
65
|
+
import "@mui/material/TextField";
|
|
66
|
+
import "../filter/filter-context.js";
|
|
67
|
+
export {
|
|
68
|
+
i as default
|
|
69
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ValueEditorProps } from 'react-querybuilder';
|
|
2
|
+
import { FunctionComponent } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ExpertFilterPropertyProps {
|
|
5
|
+
equipmentType: string;
|
|
6
|
+
valueEditorProps: ValueEditorProps;
|
|
7
|
+
}
|
|
8
|
+
declare const PropertyValueEditor: FunctionComponent<ExpertFilterPropertyProps>;
|
|
9
|
+
export default PropertyValueEditor;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useCallback } from "react";
|
|
3
|
+
import Grid from "@mui/material/Grid";
|
|
4
|
+
import { Autocomplete, TextField, Select, MenuItem } from "@mui/material";
|
|
5
|
+
import useValid from "./use-valid.js";
|
|
6
|
+
import { useIntl } from "react-intl";
|
|
7
|
+
import { FieldConstants } from "../filter/constants/field-constants.js";
|
|
8
|
+
import { OPERATOR_OPTIONS } from "../filter/constants/expert-filter-constants.js";
|
|
9
|
+
import { usePredefinedProperties } from "../../hooks/predefined-properties-hook.js";
|
|
10
|
+
const PROPERTY_VALUE_OPERATORS = [OPERATOR_OPTIONS.IN];
|
|
11
|
+
const PropertyValueEditor = (props) => {
|
|
12
|
+
const { equipmentType, valueEditorProps } = props;
|
|
13
|
+
const valid = useValid(valueEditorProps);
|
|
14
|
+
const intl = useIntl();
|
|
15
|
+
const { propertyName, propertyOperator, propertyValues } = (valueEditorProps == null ? void 0 : valueEditorProps.value) ?? {};
|
|
16
|
+
const [equipmentPredefinedProps, setEquipmentType] = usePredefinedProperties(equipmentType);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
setEquipmentType(equipmentType);
|
|
19
|
+
}, [equipmentType, setEquipmentType]);
|
|
20
|
+
const predefinedNames = useMemo(() => {
|
|
21
|
+
return Object.keys(equipmentPredefinedProps ?? {}).sort();
|
|
22
|
+
}, [equipmentPredefinedProps]);
|
|
23
|
+
const predefinedValues = useMemo(() => {
|
|
24
|
+
const predefinedForName = equipmentPredefinedProps == null ? void 0 : equipmentPredefinedProps[propertyName];
|
|
25
|
+
if (!predefinedForName) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
return [...new Set(predefinedForName)].sort();
|
|
29
|
+
}, [equipmentPredefinedProps, propertyName]);
|
|
30
|
+
const onChange = useCallback(
|
|
31
|
+
(field, value) => {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
let updatedValue = {
|
|
34
|
+
...valueEditorProps == null ? void 0 : valueEditorProps.value,
|
|
35
|
+
[FieldConstants.PROPERTY_OPERATOR]: ((_a = valueEditorProps == null ? void 0 : valueEditorProps.value) == null ? void 0 : _a.propertyOperator) ?? PROPERTY_VALUE_OPERATORS[0].customName,
|
|
36
|
+
[field]: value
|
|
37
|
+
};
|
|
38
|
+
if (field === FieldConstants.PROPERTY_NAME) {
|
|
39
|
+
updatedValue = {
|
|
40
|
+
...updatedValue,
|
|
41
|
+
[FieldConstants.PROPERTY_VALUES]: []
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
(_b = valueEditorProps == null ? void 0 : valueEditorProps.handleOnChange) == null ? void 0 : _b.call(valueEditorProps, updatedValue);
|
|
45
|
+
},
|
|
46
|
+
[valueEditorProps]
|
|
47
|
+
);
|
|
48
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, item: true, spacing: 1, children: [
|
|
49
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 5, children: /* @__PURE__ */ jsx(
|
|
50
|
+
Autocomplete,
|
|
51
|
+
{
|
|
52
|
+
value: propertyName ?? "",
|
|
53
|
+
options: predefinedNames,
|
|
54
|
+
freeSolo: true,
|
|
55
|
+
autoSelect: true,
|
|
56
|
+
forcePopupIcon: true,
|
|
57
|
+
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid }),
|
|
58
|
+
onChange: (event, value) => {
|
|
59
|
+
onChange(FieldConstants.PROPERTY_NAME, value);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
) }),
|
|
63
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 2.5, children: /* @__PURE__ */ jsx(
|
|
64
|
+
Select,
|
|
65
|
+
{
|
|
66
|
+
value: propertyOperator ?? PROPERTY_VALUE_OPERATORS[0].customName,
|
|
67
|
+
size: "medium",
|
|
68
|
+
error: !valid,
|
|
69
|
+
onChange: (event, value) => {
|
|
70
|
+
onChange(FieldConstants.PROPERTY_OPERATOR, value);
|
|
71
|
+
},
|
|
72
|
+
children: PROPERTY_VALUE_OPERATORS.map((operator) => /* @__PURE__ */ jsx(
|
|
73
|
+
MenuItem,
|
|
74
|
+
{
|
|
75
|
+
value: operator.customName,
|
|
76
|
+
children: intl.formatMessage({ id: operator.label })
|
|
77
|
+
},
|
|
78
|
+
operator.customName
|
|
79
|
+
))
|
|
80
|
+
}
|
|
81
|
+
) }),
|
|
82
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 4.5, children: /* @__PURE__ */ jsx(
|
|
83
|
+
Autocomplete,
|
|
84
|
+
{
|
|
85
|
+
value: propertyValues ?? [],
|
|
86
|
+
options: predefinedValues ?? [],
|
|
87
|
+
multiple: true,
|
|
88
|
+
renderInput: (params) => /* @__PURE__ */ jsx(TextField, { ...params, error: !valid }),
|
|
89
|
+
freeSolo: true,
|
|
90
|
+
autoSelect: true,
|
|
91
|
+
onChange: (event, value) => {
|
|
92
|
+
onChange(FieldConstants.PROPERTY_VALUES, value);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
) })
|
|
96
|
+
] });
|
|
97
|
+
};
|
|
98
|
+
export {
|
|
99
|
+
PropertyValueEditor as default
|
|
100
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "@mui/material/IconButton";
|
|
3
|
+
import "@mui/icons-material/Delete";
|
|
4
|
+
import "react-hook-form";
|
|
5
|
+
import { h } from "../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
|
|
6
|
+
import "../filter/expert/expert-filter-utils.js";
|
|
7
|
+
export {
|
|
8
|
+
h as default
|
|
9
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MaterialValueEditor } from "@react-querybuilder/material";
|
|
3
|
+
import useConvertValue from "./use-convert-value.js";
|
|
4
|
+
import { Autocomplete, TextField } from "@mui/material";
|
|
5
|
+
import useValid from "./use-valid.js";
|
|
6
|
+
const TextValueEditor = (props) => {
|
|
7
|
+
useConvertValue(props);
|
|
8
|
+
const valid = useValid(props);
|
|
9
|
+
if (!Array.isArray(props.value)) {
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
MaterialValueEditor,
|
|
12
|
+
{
|
|
13
|
+
...props,
|
|
14
|
+
title: void 0
|
|
15
|
+
}
|
|
16
|
+
);
|
|
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
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
TextValueEditor as default
|
|
34
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { MaterialValueEditor } from "@react-querybuilder/material";
|
|
4
|
+
import { useIntl } from "react-intl";
|
|
5
|
+
import useConvertValue from "./use-convert-value.js";
|
|
6
|
+
import { Autocomplete, TextField } from "@mui/material";
|
|
7
|
+
import useValid from "./use-valid.js";
|
|
8
|
+
const TranslatedValueEditor = (props) => {
|
|
9
|
+
const intl = useIntl();
|
|
10
|
+
const translatedValues = useMemo(() => {
|
|
11
|
+
var _a;
|
|
12
|
+
return (_a = props.values) == null ? void 0 : _a.map((v) => {
|
|
13
|
+
return {
|
|
14
|
+
name: v.name,
|
|
15
|
+
label: intl.formatMessage({ id: v.label })
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
}, [intl, props.values]);
|
|
19
|
+
const translatedValuesAutocomplete = useMemo(() => {
|
|
20
|
+
if (!props.values) {
|
|
21
|
+
return {};
|
|
22
|
+
}
|
|
23
|
+
return Object.fromEntries(
|
|
24
|
+
props.values.map((v) => [
|
|
25
|
+
v.name,
|
|
26
|
+
intl.formatMessage({ id: v.label })
|
|
27
|
+
])
|
|
28
|
+
);
|
|
29
|
+
}, [intl, props.values]);
|
|
30
|
+
useConvertValue(props);
|
|
31
|
+
const valid = useValid(props);
|
|
32
|
+
if (!Array.isArray(props.value)) {
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
MaterialValueEditor,
|
|
35
|
+
{
|
|
36
|
+
...props,
|
|
37
|
+
values: translatedValues,
|
|
38
|
+
title: void 0
|
|
39
|
+
}
|
|
40
|
+
);
|
|
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
|
+
}
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
TranslatedValueEditor as default
|
|
58
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ValueEditorProps } from 'react-querybuilder';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Hook that convert a value of RQB from any to any[] and vice versa when the operator changes
|
|
5
|
+
* PS : can be extended to manage more than the IN operator
|
|
6
|
+
* PS 2 : don't use this if the operator can be another array operator (like BETWEEN) or change a bit the conditions
|
|
7
|
+
*/
|
|
8
|
+
declare const useConvertValue: ({ operator, value, fieldData: { defaultValue }, handleOnChange, }: ValueEditorProps) => void;
|
|
9
|
+
export default useConvertValue;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { OPERATOR_OPTIONS } from "../filter/constants/expert-filter-constants.js";
|
|
3
|
+
const useConvertValue = ({
|
|
4
|
+
operator,
|
|
5
|
+
value,
|
|
6
|
+
fieldData: { defaultValue },
|
|
7
|
+
handleOnChange
|
|
8
|
+
}) => {
|
|
9
|
+
useEffect(
|
|
10
|
+
() => {
|
|
11
|
+
if (operator === OPERATOR_OPTIONS.IN.name && !Array.isArray(value)) {
|
|
12
|
+
handleOnChange(value ? [value] : []);
|
|
13
|
+
} else if (operator !== OPERATOR_OPTIONS.IN.name && Array.isArray(value)) {
|
|
14
|
+
handleOnChange(value.length ? value[0] : defaultValue);
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
// We want to trigger this useEffect only if the operator change
|
|
18
|
+
// eslint-disable-next-line
|
|
19
|
+
[operator]
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
useConvertValue as default
|
|
24
|
+
};
|