@m4l/components 9.3.19-JT03102025.beta.1 → 9.3.20-JT10102025.beta.1

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.
@@ -30,9 +30,9 @@ function formatToInitialFilters(appliedFilters) {
30
30
  return {
31
31
  name: af.field.name,
32
32
  operator: af.operator,
33
- ...operand1 ? { operand1 } : {},
34
- ...operand2 ? { operand2 } : {},
35
- ...operandArray ? { operandArray } : {}
33
+ ...operand1 !== void 0 ? { operand1 } : {},
34
+ ...operand2 !== void 0 ? { operand2 } : {},
35
+ ...operandArray !== void 0 ? { operandArray } : {}
36
36
  };
37
37
  });
38
38
  }
@@ -11,12 +11,16 @@ class BooleanFilterHelpers {
11
11
  */
12
12
  getDefaultFilter(field, fixed) {
13
13
  const defaultOperand1 = field.defaultOperand1;
14
+ let isSet = false;
15
+ if (fixed && defaultOperand1 !== void 0 && typeof defaultOperand1 === "boolean") {
16
+ isSet = true;
17
+ }
14
18
  const defaultFilter = {
15
19
  id: 0,
16
20
  fieldType: "boolean",
17
21
  field,
18
22
  fixed,
19
- isSet: true,
23
+ isSet,
20
24
  operator: "e",
21
25
  operand1: true
22
26
  };
@@ -45,7 +49,9 @@ class BooleanFilterHelpers {
45
49
  const operator = filterValueBoolean ? filterValueBoolean.operator : field.defaultOperator ?? "e";
46
50
  const formValueOperand1 = filterValueBoolean ? {
47
51
  value: filterValueBoolean.operand1,
48
- label: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operand_${filterValueBoolean.operand1}`)
52
+ label: getLabel(
53
+ `${DYNAMIC_FILTER_DICTIONARY_ID}.operand_${filterValueBoolean.operand1}`
54
+ )
49
55
  } : null;
50
56
  return {
51
57
  fieldType: "boolean",
@@ -63,7 +69,9 @@ class BooleanFilterHelpers {
63
69
  const labelOperands = filter.operand1 ? getLabel(DICCTIONARY.operand_true) : getLabel(DICCTIONARY.operand_false);
64
70
  return {
65
71
  labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
66
- labelOperator: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`),
72
+ labelOperator: getLabel(
73
+ `${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`
74
+ ),
67
75
  labelOperands
68
76
  };
69
77
  }
@@ -18,12 +18,16 @@ class DateTimeFilterHelpers {
18
18
  defaultEndDate.setHours(23, 59, 59, 999);
19
19
  const defaultOperand1 = field.defaultOperand1 && field.defaultOperand1 instanceof Date ? field.defaultOperand1 : defaultStartDate;
20
20
  const defaultOperand2 = field.defaultOperand2 && field.defaultOperand2 instanceof Date ? field.defaultOperand2 : defaultEndDate;
21
+ let isSet = false;
22
+ if (fixed && defaultOperand1 !== void 0) {
23
+ isSet = true;
24
+ }
21
25
  return {
22
26
  id: 0,
23
27
  fieldType: "datetime",
24
28
  field,
25
29
  fixed,
26
- isSet: true,
30
+ isSet,
27
31
  operator: "b",
28
32
  operand1: defaultOperand1,
29
33
  operand2: defaultOperand2
@@ -83,13 +87,21 @@ class DateTimeFilterHelpers {
83
87
  labelOperands = filter.operand1 && filter.operand2 ? `${dateFormatter.formatDate(
84
88
  filter.operand1,
85
89
  dateFormatter.datetimeFormat
86
- )} - ${dateFormatter.formatDate(filter.operand2, dateFormatter.datetimeFormat)}` : "";
90
+ )} - ${dateFormatter.formatDate(
91
+ filter.operand2,
92
+ dateFormatter.datetimeFormat
93
+ )}` : "";
87
94
  } else {
88
- labelOperands = filter.operand1 ? dateFormatter.formatDate(filter.operand1, dateFormatter.datetimeFormat) : "";
95
+ labelOperands = filter.operand1 ? dateFormatter.formatDate(
96
+ filter.operand1,
97
+ dateFormatter.datetimeFormat
98
+ ) : "";
89
99
  }
90
100
  return {
91
101
  labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
92
- labelOperator: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`),
102
+ labelOperator: getLabel(
103
+ `${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`
104
+ ),
93
105
  labelOperands
94
106
  };
95
107
  }
@@ -29,7 +29,10 @@ class SelectAsyncFilterHelpers {
29
29
  dOperator = field.defaultOperator ?? "in";
30
30
  isSet = fixed ? defaultOperandsArray !== null && defaultOperandsArray.length > 0 ? true : false : false;
31
31
  if (field.defaultOperandsArray !== void 0 && Array.isArray(field.defaultOperandsArray)) {
32
- operandsArray = filterValidOperandsArraySelectAsync(field.defaultOperandsArray, field);
32
+ operandsArray = filterValidOperandsArraySelectAsync(
33
+ field.defaultOperandsArray,
34
+ field
35
+ );
33
36
  }
34
37
  } else {
35
38
  dOperator = field.defaultOperator ?? "e";
@@ -122,15 +125,21 @@ class SelectAsyncFilterHelpers {
122
125
  let labelOperands = "";
123
126
  if (isMultiple) {
124
127
  labelOperands = operandsArray?.reduce?.((label, operand) => {
125
- const textLabel = field.selectAsyncOptions?.getOptionLabel?.(operand) || "";
128
+ const textLabel = field.selectAsyncOptions?.getOptionLabel?.(
129
+ operand
130
+ ) || "";
126
131
  return label ? `${label} | ${textLabel}` : textLabel;
127
132
  }, "")?.toString() || "?";
128
133
  } else {
129
- labelOperands = (field.selectAsyncOptions?.getOptionLabel?.(filter.operand1) ?? "?") + "";
134
+ labelOperands = (field.selectAsyncOptions?.getOptionLabel?.(
135
+ filter.operand1
136
+ ) ?? "?") + "";
130
137
  }
131
138
  return {
132
139
  labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
133
- labelOperator: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`),
140
+ labelOperator: getLabel(
141
+ `${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`
142
+ ),
134
143
  labelOperands
135
144
  };
136
145
  }
@@ -163,7 +172,9 @@ class SelectAsyncFilterHelpers {
163
172
  return false;
164
173
  }
165
174
  if (isMultiple) {
166
- if (SELECT_ASYNC_OPERATORS_MULTIPLE.findIndex((f) => f === filter.operator) === -1) {
175
+ if (SELECT_ASYNC_OPERATORS_MULTIPLE.findIndex(
176
+ (f) => f === filter.operator
177
+ ) === -1) {
167
178
  return false;
168
179
  }
169
180
  if (!filter.operandsArray || typeof filter.operandsArray !== "object") {
@@ -180,7 +191,9 @@ class SelectAsyncFilterHelpers {
180
191
  return false;
181
192
  }
182
193
  } else {
183
- if (SELECT_ASYNC_OPERATORS_SINGLE.findIndex((f) => f === filter.operator) === -1) {
194
+ if (SELECT_ASYNC_OPERATORS_SINGLE.findIndex(
195
+ (f) => f === filter.operator
196
+ ) === -1) {
184
197
  return false;
185
198
  }
186
199
  if (!filter.operand1 || typeof filter.operand1 !== "object") {
@@ -28,7 +28,9 @@ class SelectFilterHelpers {
28
28
  dOperator = field.defaultOperator ?? "in";
29
29
  isSet = fixed ? defaultOperandsArray !== null && defaultOperandsArray.length > 0 ? true : false : false;
30
30
  if (field.defaultOperandsArray !== void 0 && Array.isArray(field.defaultOperandsArray)) {
31
- operandsArray = filterValidOperandsArraySelect(field.defaultOperandsArray);
31
+ operandsArray = filterValidOperandsArraySelect(
32
+ field.defaultOperandsArray
33
+ );
32
34
  }
33
35
  } else {
34
36
  dOperator = field.defaultOperator ?? "e";
@@ -123,7 +125,9 @@ class SelectFilterHelpers {
123
125
  let labelOperands = "";
124
126
  if (isMultiple) {
125
127
  labelOperands = operandsArray?.reduce?.((label, operand) => {
126
- const textLabel = field.selectOptions?.options.find((option) => option.id === operand)?.label || "";
128
+ const textLabel = field.selectOptions?.options.find(
129
+ (option) => option.id === operand
130
+ )?.label || "";
127
131
  return label ? `${label} | ${textLabel}` : textLabel;
128
132
  }, "")?.toString() || "?";
129
133
  } else {
@@ -131,7 +135,9 @@ class SelectFilterHelpers {
131
135
  }
132
136
  return {
133
137
  labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
134
- labelOperator: getLabel(`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`),
138
+ labelOperator: getLabel(
139
+ `${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`
140
+ ),
135
141
  labelOperands
136
142
  };
137
143
  }
@@ -147,9 +153,13 @@ class SelectFilterHelpers {
147
153
  }),
148
154
  formValueOperand1: Yup.mixed().when(["multiple"], {
149
155
  is: false,
150
- then: Yup.mixed().test("is-string-or-number", getLabel(DICCTIONARY.error_operand_required), (value) => {
151
- return typeof value === "string" || typeof value === "number";
152
- }).required(getLabel(DICCTIONARY.error_operand_required))
156
+ then: Yup.mixed().test(
157
+ "is-string-or-number",
158
+ getLabel(DICCTIONARY.error_operand_required),
159
+ (value) => {
160
+ return typeof value === "string" || typeof value === "number";
161
+ }
162
+ ).required(getLabel(DICCTIONARY.error_operand_required))
153
163
  })
154
164
  });
155
165
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.3.19-JT03102025.beta.1",
3
+ "version": "9.3.20-JT10102025.beta.1",
4
4
  "license": "UNLICENSED",
5
5
  "description": "M4L Components",
6
6
  "lint-staged": {