@gridsuite/commons-ui 0.56.0 → 0.57.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 (29) hide show
  1. package/dist/chunks/{criteria-based-filter-edition-dialog.DxqH-mLe.js → criteria-based-filter-edition-dialog.BEXoNmzz.js} +1 -1
  2. package/dist/components/TopBar/TopBar.js +371 -429
  3. package/dist/components/filter/constants/expert-filter-constants.d.ts +5 -0
  4. package/dist/components/filter/constants/expert-filter-constants.js +5 -0
  5. package/dist/components/filter/criteria-based/criteria-based-filter-edition-dialog.js +1 -1
  6. package/dist/components/filter/expert/expert-filter-edition-dialog.js +1 -1
  7. package/dist/components/filter/expert/expert-filter-form.js +1 -1
  8. package/dist/components/filter/expert/expert-filter-utils.d.ts +73 -1
  9. package/dist/components/filter/expert/expert-filter-utils.js +7 -5
  10. package/dist/components/filter/expert/expert-filter.type.d.ts +1 -0
  11. package/dist/components/filter/expert/expert-filter.type.js +1 -0
  12. package/dist/components/filter/explicit-naming/explicit-naming-filter-edition-dialog.js +1 -1
  13. package/dist/components/filter/explicit-naming/explicit-naming-filter-form.js +1 -1
  14. package/dist/components/filter/filter-creation-dialog.js +1 -1
  15. package/dist/components/filter/filter-form.js +1 -1
  16. package/dist/components/react-hook-form/ag-grid-table-rhf/bottom-right-buttons.js +1 -1
  17. package/dist/components/react-hook-form/ag-grid-table-rhf/csv-uploader/csv-uploader.js +1 -1
  18. package/dist/components/react-hook-form/ag-grid-table-rhf/custom-ag-grid-table.js +1 -1
  19. package/dist/components/react-query-builder-inputs/custom-react-query-builder.js +1 -1
  20. package/dist/components/react-query-builder-inputs/element-value-editor.js +1 -1
  21. package/dist/components/react-query-builder-inputs/remove-button.js +1 -1
  22. package/dist/components/react-query-builder-inputs/value-editor.js +1 -1
  23. package/dist/components/translations/filter-en.d.ts +22 -0
  24. package/dist/components/translations/filter-en.js +23 -0
  25. package/dist/components/translations/filter-fr.d.ts +22 -0
  26. package/dist/components/translations/filter-fr.js +23 -0
  27. package/dist/index.d.ts +2 -0
  28. package/dist/index.js +77 -73
  29. package/package.json +4 -5
@@ -77,6 +77,11 @@ export declare const OPERATOR_OPTIONS: {
77
77
  customName: OperatorType;
78
78
  label: string;
79
79
  };
80
+ NOT_EXISTS: {
81
+ name: OperatorType;
82
+ customName: OperatorType;
83
+ label: string;
84
+ };
80
85
  LOWER: {
81
86
  name: string;
82
87
  customName: OperatorType;
@@ -79,6 +79,11 @@ const OPERATOR_OPTIONS = {
79
79
  customName: OperatorType.EXISTS,
80
80
  label: "exists"
81
81
  },
82
+ NOT_EXISTS: {
83
+ name: OperatorType.NOT_EXISTS,
84
+ customName: OperatorType.NOT_EXISTS,
85
+ label: "not_exists"
86
+ },
82
87
  // Number
83
88
  LOWER: { name: "<", customName: OperatorType.LOWER, label: "lessThan" },
84
89
  LOWER_OR_EQUALS: {
@@ -8,7 +8,7 @@ import "react-hook-form";
8
8
  import "@hookform/resolvers/yup";
9
9
  import "./criteria-based-filter-form.js";
10
10
  import "../../../utils/yup-config.js";
11
- import { b, b as b2, p } from "../../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
11
+ import { b, b as b2, p } from "../../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
12
12
  import "../constants/filter-constants.js";
13
13
  import "../../../utils/FetchStatus.js";
14
14
  import "yup";
@@ -7,7 +7,7 @@ import "@hookform/resolvers/yup";
7
7
  import "../../../hooks/useSnackMessage.js";
8
8
  import "../../dialogs/custom-mui-dialog.js";
9
9
  import "../../../utils/yup-config.js";
10
- import { E, E as E2 } from "../../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
10
+ import { E, E as E2 } from "../../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
11
11
  import "../utils/filters-utils.js";
12
12
  import "./expert-filter-utils.js";
13
13
  import "../filter-context.js";
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "@mui/material/Grid";
4
4
  import "react-querybuilder";
5
- import { k, n, l, m } from "../../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
5
+ import { k, n, l, m } from "../../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
6
6
  import "react-hook-form";
7
7
  import "./expert-filter-utils.js";
8
8
  import "../constants/expert-filter-constants.js";
@@ -8,7 +8,79 @@ type CustomRuleGroupType = RuleGroupType & {
8
8
  export declare const getOperators: (fieldName: string, intl: IntlShape) => {
9
9
  name: string;
10
10
  label: string;
11
- }[];
11
+ }[] | ({
12
+ readonly name: "=";
13
+ readonly value: "=";
14
+ readonly label: "=";
15
+ } | {
16
+ readonly name: "!=";
17
+ readonly value: "!=";
18
+ readonly label: "!=";
19
+ } | {
20
+ readonly name: "<";
21
+ readonly value: "<";
22
+ readonly label: "<";
23
+ } | {
24
+ readonly name: ">";
25
+ readonly value: ">";
26
+ readonly label: ">";
27
+ } | {
28
+ readonly name: "<=";
29
+ readonly value: "<=";
30
+ readonly label: "<=";
31
+ } | {
32
+ readonly name: ">=";
33
+ readonly value: ">=";
34
+ readonly label: ">=";
35
+ } | {
36
+ readonly name: "contains";
37
+ readonly value: "contains";
38
+ readonly label: "contains";
39
+ } | {
40
+ readonly name: "beginsWith";
41
+ readonly value: "beginsWith";
42
+ readonly label: "begins with";
43
+ } | {
44
+ readonly name: "endsWith";
45
+ readonly value: "endsWith";
46
+ readonly label: "ends with";
47
+ } | {
48
+ readonly name: "doesNotContain";
49
+ readonly value: "doesNotContain";
50
+ readonly label: "does not contain";
51
+ } | {
52
+ readonly name: "doesNotBeginWith";
53
+ readonly value: "doesNotBeginWith";
54
+ readonly label: "does not begin with";
55
+ } | {
56
+ readonly name: "doesNotEndWith";
57
+ readonly value: "doesNotEndWith";
58
+ readonly label: "does not end with";
59
+ } | {
60
+ readonly name: "null";
61
+ readonly value: "null";
62
+ readonly label: "is null";
63
+ } | {
64
+ readonly name: "notNull";
65
+ readonly value: "notNull";
66
+ readonly label: "is not null";
67
+ } | {
68
+ readonly name: "in";
69
+ readonly value: "in";
70
+ readonly label: "in";
71
+ } | {
72
+ readonly name: "notIn";
73
+ readonly value: "notIn";
74
+ readonly label: "not in";
75
+ } | {
76
+ readonly name: "between";
77
+ readonly value: "between";
78
+ readonly label: "between";
79
+ } | {
80
+ readonly name: "notBetween";
81
+ readonly value: "notBetween";
82
+ readonly label: "not between";
83
+ })[];
12
84
  export declare function exportExpertRules(query: CustomRuleGroupType): RuleGroupTypeExport;
13
85
  export declare function importExpertRules(query: RuleGroupTypeExport): CustomRuleGroupType;
14
86
  export declare function countRules(query: RuleGroupTypeAny): number;
@@ -30,7 +30,8 @@ const getOperators = (fieldName, intl) => {
30
30
  OPERATOR_OPTIONS.BEGINS_WITH,
31
31
  OPERATOR_OPTIONS.ENDS_WITH,
32
32
  OPERATOR_OPTIONS.IN,
33
- OPERATOR_OPTIONS.EXISTS
33
+ OPERATOR_OPTIONS.EXISTS,
34
+ OPERATOR_OPTIONS.NOT_EXISTS
34
35
  ];
35
36
  if (field.name === FieldType.ID || field.name === FieldType.VOLTAGE_LEVEL_ID || field.name === FieldType.VOLTAGE_LEVEL_ID_1 || field.name === FieldType.VOLTAGE_LEVEL_ID_2) {
36
37
  operators.push(OPERATOR_OPTIONS.IS_PART_OF);
@@ -38,7 +39,7 @@ const getOperators = (fieldName, intl) => {
38
39
  }
39
40
  if (field.name === FieldType.ID) {
40
41
  operators = operators.filter(
41
- (field2) => field2.name !== OperatorType.EXISTS
42
+ (field2) => field2.name !== OperatorType.EXISTS && field2.name !== OperatorType.NOT_EXISTS
42
43
  );
43
44
  }
44
45
  return operators.map((operator) => ({
@@ -53,7 +54,8 @@ const getOperators = (fieldName, intl) => {
53
54
  OPERATOR_OPTIONS.LOWER,
54
55
  OPERATOR_OPTIONS.LOWER_OR_EQUALS,
55
56
  OPERATOR_OPTIONS.BETWEEN,
56
- OPERATOR_OPTIONS.EXISTS
57
+ OPERATOR_OPTIONS.EXISTS,
58
+ OPERATOR_OPTIONS.NOT_EXISTS
57
59
  ].map((operator) => ({
58
60
  name: operator.name,
59
61
  label: intl.formatMessage({ id: operator.label })
@@ -107,7 +109,7 @@ function exportExpertRules(query) {
107
109
  operator: dataType !== DataType.PROPERTY ? (_a = Object.values(OPERATOR_OPTIONS).find(
108
110
  (operator) => operator.name === rule.operator
109
111
  )) == null ? void 0 : _a.customName : rule.value.propertyOperator,
110
- value: !isValueAnArray && rule.operator !== OperatorType.EXISTS && dataType !== DataType.PROPERTY ? changeValueUnit(rule.value, rule.field) : void 0,
112
+ value: !isValueAnArray && rule.operator !== OperatorType.EXISTS && rule.operator !== OperatorType.NOT_EXISTS && dataType !== DataType.PROPERTY ? changeValueUnit(rule.value, rule.field) : void 0,
111
113
  values: isValueAnArray && dataType !== DataType.PROPERTY ? changeValueUnit(rule.value, rule.field) : void 0,
112
114
  dataType,
113
115
  propertyName: dataType === DataType.PROPERTY ? rule.value.propertyName : void 0,
@@ -204,7 +206,7 @@ const queryValidator = (query) => {
204
206
  const isValueAnArray = Array.isArray(rule.value);
205
207
  const isNumberInput = getDataType(rule.field, rule.operator) === DataType.NUMBER && !isValueAnArray;
206
208
  const isStringInput = getDataType(rule.field, rule.operator) === DataType.STRING && !isValueAnArray;
207
- if (rule.id && rule.operator === OPERATOR_OPTIONS.EXISTS.name) {
209
+ if (rule.id && (rule.operator === OPERATOR_OPTIONS.EXISTS.name || rule.operator === OPERATOR_OPTIONS.NOT_EXISTS.name)) {
208
210
  result[rule.id] = {
209
211
  valid: true,
210
212
  reasons: void 0
@@ -18,6 +18,7 @@ export declare enum OperatorType {
18
18
  BEGINS_WITH = "BEGINS_WITH",
19
19
  ENDS_WITH = "ENDS_WITH",
20
20
  EXISTS = "EXISTS",
21
+ NOT_EXISTS = "NOT_EXISTS",
21
22
  IS_PART_OF = "IS_PART_OF",
22
23
  IS_NOT_PART_OF = "IS_NOT_PART_OF"
23
24
  }
@@ -12,6 +12,7 @@ var OperatorType = /* @__PURE__ */ ((OperatorType2) => {
12
12
  OperatorType2["BEGINS_WITH"] = "BEGINS_WITH";
13
13
  OperatorType2["ENDS_WITH"] = "ENDS_WITH";
14
14
  OperatorType2["EXISTS"] = "EXISTS";
15
+ OperatorType2["NOT_EXISTS"] = "NOT_EXISTS";
15
16
  OperatorType2["IS_PART_OF"] = "IS_PART_OF";
16
17
  OperatorType2["IS_NOT_PART_OF"] = "IS_NOT_PART_OF";
17
18
  return OperatorType2;
@@ -7,7 +7,7 @@ import "@hookform/resolvers/yup";
7
7
  import "../../../hooks/useSnackMessage.js";
8
8
  import "../../dialogs/custom-mui-dialog.js";
9
9
  import "../../../utils/yup-config.js";
10
- import { a } from "../../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
10
+ import { a } from "../../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
11
11
  import "../constants/field-constants.js";
12
12
  import "uuid";
13
13
  import "../constants/equipment-types.js";
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "../constants/field-constants.js";
4
4
  import "../../../utils/yup-config.js";
5
- import { d, f, e, g } from "../../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
5
+ import { d, f, e, g } from "../../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
6
6
  import "react-intl";
7
7
  import "react-hook-form";
8
8
  import "@mui/material/Grid";
@@ -5,7 +5,7 @@ import "react-hook-form";
5
5
  import "../../hooks/useSnackMessage.js";
6
6
  import "../dialogs/custom-mui-dialog.js";
7
7
  import "./criteria-based/criteria-based-filter-form.js";
8
- import { F } from "../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
8
+ import { F } from "../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
9
9
  import "./constants/field-constants.js";
10
10
  import "../../utils/yup-config.js";
11
11
  import "@hookform/resolvers/yup";
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
2
2
  import "../react-hook-form/unique-name-input.js";
3
3
  import "./constants/field-constants.js";
4
4
  import "./criteria-based/criteria-based-filter-form.js";
5
- import { o } from "../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
5
+ import { o } from "../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
6
6
  import "react-hook-form";
7
7
  import "@mui/material";
8
8
  import "../react-hook-form/radio-input.js";
@@ -4,7 +4,7 @@ import "@mui/material/IconButton";
4
4
  import "@mui/icons-material";
5
5
  import "@mui/icons-material/ControlPoint";
6
6
  import "@mui/icons-material/Delete";
7
- import { B } from "../../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
7
+ import { B } from "../../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
8
8
  import "react";
9
9
  import "react-intl";
10
10
  import "@mui/material/styles";
@@ -37,7 +37,7 @@ import "../../../filter/constants/field-constants.js";
37
37
  import "yup";
38
38
  import "../../../dialogs/popup-confirmation-dialog.js";
39
39
  import "../../../filter/utils/criteria-based-utils.js";
40
- import { c } from "../../../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
40
+ import { c } from "../../../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
41
41
  import "ag-grid-react";
42
42
  import "ag-grid-community/styles/ag-grid.css";
43
43
  import "ag-grid-community/styles/ag-theme-alpine.css";
@@ -5,7 +5,7 @@ import "ag-grid-react";
5
5
  import "ag-grid-community/styles/ag-grid.css";
6
6
  import "ag-grid-community/styles/ag-theme-alpine.css";
7
7
  import "@mui/material";
8
- import { C, R, C as C2 } from "../../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
8
+ import { C, R, C as C2 } from "../../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
9
9
  import "react-intl";
10
10
  import "../../filter/constants/field-constants.js";
11
11
  export {
@@ -7,7 +7,7 @@ import "@react-querybuilder/material";
7
7
  import "react-querybuilder";
8
8
  import "react-intl";
9
9
  import "react-hook-form";
10
- import { j } from "../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
10
+ import { j } from "../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
11
11
  import "./combinator-selector.js";
12
12
  import "./add-button.js";
13
13
  import "./value-selector.js";
@@ -28,7 +28,7 @@ import "yup";
28
28
  import "../react-hook-form/provider/use-custom-form-context.js";
29
29
  import "../dialogs/popup-confirmation-dialog.js";
30
30
  import "../filter/utils/criteria-based-utils.js";
31
- import { i } from "../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
31
+ import { i } from "../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
32
32
  import "ag-grid-react";
33
33
  import "ag-grid-community/styles/ag-grid.css";
34
34
  import "ag-grid-community/styles/ag-theme-alpine.css";
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
2
2
  import "@mui/material/IconButton";
3
3
  import "@mui/icons-material/Delete";
4
4
  import "react-hook-form";
5
- import { h } from "../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
5
+ import { h } from "../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
6
6
  import "../filter/expert/expert-filter-utils.js";
7
7
  export {
8
8
  h as default
@@ -9,7 +9,7 @@ import "react-hook-form";
9
9
  import "../filter/constants/field-constants.js";
10
10
  import "../filter/expert/expert-filter.type.js";
11
11
  import "../filter/constants/equipment-types.js";
12
- import { V } from "../../chunks/criteria-based-filter-edition-dialog.DxqH-mLe.js";
12
+ import { V } from "../../chunks/criteria-based-filter-edition-dialog.BEXoNmzz.js";
13
13
  import "../../utils/ElementType.js";
14
14
  import "./property-value-editor.js";
15
15
  import "../filter/constants/filter-constants.js";
@@ -0,0 +1,22 @@
1
+ export default filter_en;
2
+ declare namespace filter_en {
3
+ export let OR: string;
4
+ export let AND: string;
5
+ export let rule: string;
6
+ export let subGroup: string;
7
+ export let is: string;
8
+ export let contains: string;
9
+ export let beginsWith: string;
10
+ export let endsWith: string;
11
+ export let exists: string;
12
+ export let not_exists: string;
13
+ export let between: string;
14
+ let _in: string;
15
+ export { _in as in };
16
+ export let isPartOf: string;
17
+ export let isNotPartOf: string;
18
+ export let emptyRule: string;
19
+ export let incorrectRule: string;
20
+ export let betweenRule: string;
21
+ export let emptyGroup: string;
22
+ }
@@ -0,0 +1,23 @@
1
+ const filter_en = {
2
+ OR: "OR",
3
+ AND: "AND",
4
+ rule: "rule",
5
+ subGroup: "subgroup",
6
+ is: "is",
7
+ contains: "contains",
8
+ beginsWith: "begins with",
9
+ endsWith: "ends with",
10
+ exists: "exists",
11
+ not_exists: "not exists",
12
+ between: "between",
13
+ in: "in",
14
+ isPartOf: "is part of",
15
+ isNotPartOf: "is not part of",
16
+ emptyRule: "Filter contains an empty field",
17
+ incorrectRule: "Filter contains an incorrect field",
18
+ betweenRule: "Left value of 'between' rule have to be lower than the right value",
19
+ emptyGroup: "Filter contains an empty group. Consider removing it or adding rules to this group"
20
+ };
21
+ export {
22
+ filter_en as default
23
+ };
@@ -0,0 +1,22 @@
1
+ export default filter_fr;
2
+ declare namespace filter_fr {
3
+ export let OR: string;
4
+ export let AND: string;
5
+ export let rule: string;
6
+ export let subGroup: string;
7
+ export let is: string;
8
+ export let contains: string;
9
+ export let beginsWith: string;
10
+ export let endsWith: string;
11
+ export let exists: string;
12
+ export let not_exists: string;
13
+ export let between: string;
14
+ let _in: string;
15
+ export { _in as in };
16
+ export let isPartOf: string;
17
+ export let isNotPartOf: string;
18
+ export let emptyRule: string;
19
+ export let incorrectRule: string;
20
+ export let betweenRule: string;
21
+ export let emptyGroup: string;
22
+ }
@@ -0,0 +1,23 @@
1
+ const filter_fr = {
2
+ OR: "OU",
3
+ AND: "ET",
4
+ rule: "règle",
5
+ subGroup: "sous-groupe",
6
+ is: "est",
7
+ contains: "contient",
8
+ beginsWith: "commence par",
9
+ endsWith: "finit par",
10
+ exists: "existe",
11
+ not_exists: "n'existe pas",
12
+ between: "entre",
13
+ in: "dans",
14
+ isPartOf: "fait partie de",
15
+ isNotPartOf: "ne fait pas partie de",
16
+ emptyRule: "Le filtre contient un champ vide",
17
+ incorrectRule: "Le filtre contient un champ incorrect",
18
+ betweenRule: "La valeur de gauche d'une règle 'entre' doit être inférieure à la valeur de droite",
19
+ emptyGroup: "Le filtre contient un groupe vide. Supprimez le ou ajoutez des règles à ce groupe"
20
+ };
21
+ export {
22
+ filter_fr as default
23
+ };
package/dist/index.d.ts CHANGED
@@ -82,6 +82,8 @@ export { default as element_search_en } from './components/translations/element-
82
82
  export { default as element_search_fr } from './components/translations/element-search-fr';
83
83
  export { default as equipment_search_en } from './components/translations/equipment-search-en';
84
84
  export { default as equipment_search_fr } from './components/translations/equipment-search-fr';
85
+ export { default as filter_en } from './components/translations/filter-en';
86
+ export { default as filter_fr } from './components/translations/filter-fr';
85
87
  export { default as card_error_boundary_en } from './components/translations/card-error-boundary-en';
86
88
  export { default as card_error_boundary_fr } from './components/translations/card-error-boundary-fr';
87
89
  export { default as flat_parameters_en } from './components/translations/flat-parameters-en';