@m4l/components 9.3.23 → 9.3.24-JT04112025.beta.2
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/@types/export.d.ts +6 -0
- package/@types/types.d.ts +26 -1
- package/components/DataGrid/DataGrid.js +6 -2
- package/components/DataGrid/Datagrid.styles.js +67 -18
- package/components/DataGrid/constants.d.ts +19 -0
- package/components/DataGrid/formatters/ColumnIconFormatter/formatter.d.ts +1 -2
- package/components/DataGrid/formatters/ColumnIconFormatter/formatter.js +3 -6
- package/components/DataGrid/formatters/ColumnIconFormatter/types.d.ts +2 -4
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/formatter.js +7 -1
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/types.d.ts +1 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/formatter.d.ts +8 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/formatter.js +16 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/index.d.ts +3 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/index.js +1 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/types.d.ts +5 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/useColumnTags.d.ts +9 -0
- package/components/DataGrid/formatters/ColumnTagsFormatter/useColumnTags.js +60 -0
- package/components/DataGrid/formatters/index.d.ts +1 -0
- package/components/DataGrid/hooks/useModalCardDetail.d.ts +2 -2
- package/components/DataGrid/hooks/useModalCardDetail.js +49 -48
- package/components/DataGrid/slots/DataGridEnum.d.ts +2 -0
- package/components/DataGrid/slots/DataGridEnum.js +2 -0
- package/components/DataGrid/slots/DataGridSlot.d.ts +3 -1
- package/components/DataGrid/slots/DataGridSlot.js +45 -37
- package/components/DataGrid/subcomponents/Cards/helpers/calculateCardHeight.d.ts +18 -0
- package/components/DataGrid/subcomponents/Cards/helpers/calculateCardHeight.js +10 -0
- package/components/DataGrid/subcomponents/Cards/helpers/scrollToCardElement.d.ts +9 -0
- package/components/DataGrid/subcomponents/Cards/helpers/scrollToCardElement.js +25 -0
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.d.ts +1 -2
- package/components/DataGrid/subcomponents/Cards/hooks/useCardContent.js +62 -73
- package/components/DataGrid/subcomponents/Cards/index.js +71 -16
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardDetails/index.js +36 -18
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.d.ts +1 -1
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardHeader/index.js +13 -20
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.d.ts +6 -1
- package/components/DataGrid/subcomponents/Cards/subcomponents/CardRow/index.js +67 -36
- package/components/DataGrid/subcomponents/Cards/subcomponents/IntersectCard/index.js +9 -2
- package/components/DataGrid/subcomponents/Cards/subcomponents/LazyLoadCard/index.js +4 -2
- package/components/DataGrid/subcomponents/Cards/types.d.ts +50 -1
- package/components/DataGrid/subcomponents/CheckboxCellAdapter/index.js +5 -2
- package/components/DataGrid/subcomponents/ControlNavigate/ControlNavigate.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/RowsCount/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfig/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/Settings/subcomponents/ColumnsConfigCards/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/ViewMode/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettings/index.js +1 -1
- package/components/DataGrid/subcomponents/HeaderActions/subcomponents/hooks/useModalSettingsCards/index.js +1 -1
- package/components/DataGrid/subcomponents/Table/index.js +60 -41
- package/components/DataGrid/subcomponents/Table/subcomponents/CheckboxFormatter.js +16 -18
- package/components/DataGrid/subcomponents/Table/subcomponents/DraggableHeaderRenderer.js +3 -3
- package/components/DataGrid/subcomponents/Table/subcomponents/HeaderRenderClick/HeaderRenderClick.js +1 -1
- package/components/DataGrid/subcomponents/editors/TextEditor/index.js +1 -1
- package/components/DataGrid/tests/helpers/types.d.ts +3 -0
- package/components/DataGrid/types.d.ts +17 -2
- package/components/DynamicFilter/helpers/formatToInitialFilters.js +3 -3
- package/components/DynamicFilter/subcomponents/FieldTypes/BooleanFilter/helpers.js +11 -3
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.js +16 -4
- package/components/DynamicFilter/subcomponents/FieldTypes/NumberFilter/helpers.js +11 -8
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectAsyncFilter/helpers.js +21 -8
- package/components/DynamicFilter/subcomponents/FieldTypes/SelectFilter/helpers.js +18 -8
- package/components/DynamicFilter/subcomponents/FieldTypes/StringFilter/helpers.js +5 -3
- package/components/ObjectLogs/slots/ObjectLogsSlots.js +3 -5
- package/components/formatters/IconsFormatter/IconsFormatter.d.ts +6 -0
- package/components/formatters/IconsFormatter/IconsFormatter.js +22 -0
- package/components/formatters/IconsFormatter/IconsFormatter.styles.d.ts +2 -0
- package/components/formatters/IconsFormatter/IconsFormatter.styles.js +29 -0
- package/components/formatters/IconsFormatter/constants.d.ts +1 -0
- package/components/formatters/IconsFormatter/constants.js +4 -0
- package/components/{DataGrid/formatters/ColumnIconFormatter → formatters/IconsFormatter}/helpers/renderIcon.d.ts +2 -2
- package/components/formatters/IconsFormatter/helpers/renderIcon.js +24 -0
- package/components/formatters/IconsFormatter/helpers/renderMultipleIcons.d.ts +7 -0
- package/components/formatters/IconsFormatter/helpers/renderMultipleIcons.js +16 -0
- package/components/formatters/IconsFormatter/index.d.ts +3 -0
- package/components/formatters/IconsFormatter/index.js +1 -0
- package/components/formatters/IconsFormatter/slots/IconsFormatterEnum.d.ts +5 -0
- package/components/formatters/IconsFormatter/slots/IconsFormatterEnum.js +9 -0
- package/components/formatters/IconsFormatter/slots/IconsFormatterSlots.d.ts +9 -0
- package/components/formatters/IconsFormatter/slots/IconsFormatterSlots.js +22 -0
- package/components/formatters/IconsFormatter/types.d.ts +57 -0
- package/components/formatters/IconsFormatter/types.js +1 -0
- package/components/formatters/TagsFormatter/TagsFormatter.d.ts +5 -0
- package/components/formatters/TagsFormatter/TagsFormatter.js +28 -0
- package/components/formatters/TagsFormatter/TagsFormatter.styles.d.ts +2 -0
- package/components/formatters/TagsFormatter/TagsFormatter.styles.js +41 -0
- package/components/formatters/TagsFormatter/constants.d.ts +5 -0
- package/components/formatters/TagsFormatter/constants.js +11 -0
- package/components/formatters/TagsFormatter/helpers/renderMultipleTag.d.ts +8 -0
- package/components/formatters/TagsFormatter/helpers/renderMultipleTag.js +19 -0
- package/components/formatters/TagsFormatter/helpers/renderTag.d.ts +7 -0
- package/components/formatters/TagsFormatter/helpers/renderTag.js +9 -0
- package/components/formatters/TagsFormatter/helpers/validateHexColor.d.ts +8 -0
- package/components/formatters/TagsFormatter/helpers/validateHexColor.js +9 -0
- package/components/formatters/TagsFormatter/index.d.ts +2 -0
- package/components/formatters/TagsFormatter/index.js +1 -0
- package/components/formatters/TagsFormatter/slots/TagsFormatterEnum.d.ts +5 -0
- package/components/formatters/TagsFormatter/slots/TagsFormatterEnum.js +9 -0
- package/components/formatters/TagsFormatter/slots/TagsFormatterSlots.d.ts +6 -0
- package/components/formatters/TagsFormatter/slots/TagsFormatterSlots.js +16 -0
- package/components/formatters/TagsFormatter/subcomponents/Tag/Tag.d.ts +5 -0
- package/components/formatters/TagsFormatter/subcomponents/Tag/Tag.js +35 -0
- package/components/formatters/TagsFormatter/subcomponents/Tag/index.d.ts +0 -0
- package/components/formatters/TagsFormatter/types.d.ts +47 -0
- package/components/formatters/index.d.ts +6 -5
- package/contexts/ModalContext/index.js +5 -5
- package/index.js +62 -56
- package/package.json +1 -1
- package/components/DataGrid/formatters/ColumnIconFormatter/constants.js +0 -4
- package/components/DataGrid/formatters/ColumnIconFormatter/helpers/renderIcon.js +0 -58
- package/components/DataGrid/formatters/ColumnIconFormatter/helpers/renderMultipleIcons.d.ts +0 -7
- package/components/DataGrid/formatters/ColumnIconFormatter/helpers/renderMultipleIcons.js +0 -19
|
@@ -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 (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
|
|
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(
|
|
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(
|
|
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 (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
|
|
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(
|
|
90
|
+
)} - ${dateFormatter.formatDate(
|
|
91
|
+
filter.operand2,
|
|
92
|
+
dateFormatter.datetimeFormat
|
|
93
|
+
)}` : "";
|
|
87
94
|
} else {
|
|
88
|
-
labelOperands = filter.operand1 ? dateFormatter.formatDate(
|
|
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(
|
|
102
|
+
labelOperator: getLabel(
|
|
103
|
+
`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`
|
|
104
|
+
),
|
|
93
105
|
labelOperands
|
|
94
106
|
};
|
|
95
107
|
}
|
|
@@ -15,12 +15,10 @@ class NumberFilterHelpers {
|
|
|
15
15
|
const defaultOperand1 = field.defaultOperand1 ?? null;
|
|
16
16
|
const defaultOperand2 = field.defaultOperand2 ?? null;
|
|
17
17
|
let isSet = false;
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
isSet = defaultOperand1 !== null ? true : false;
|
|
23
|
-
}
|
|
18
|
+
if (["b"].includes(dOperator)) {
|
|
19
|
+
isSet = defaultOperand1 !== null && defaultOperand2 !== null ? true : false;
|
|
20
|
+
} else {
|
|
21
|
+
isSet = defaultOperand1 !== null ? true : false;
|
|
24
22
|
}
|
|
25
23
|
return {
|
|
26
24
|
id: 0,
|
|
@@ -85,7 +83,9 @@ class NumberFilterHelpers {
|
|
|
85
83
|
}
|
|
86
84
|
return {
|
|
87
85
|
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
88
|
-
labelOperator: getLabel(
|
|
86
|
+
labelOperator: getLabel(
|
|
87
|
+
`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`
|
|
88
|
+
),
|
|
89
89
|
labelOperands
|
|
90
90
|
};
|
|
91
91
|
}
|
|
@@ -100,7 +100,10 @@ class NumberFilterHelpers {
|
|
|
100
100
|
),
|
|
101
101
|
formValueOperand2: Yup.mixed().when(["formValueOperator.id"], {
|
|
102
102
|
is: "b",
|
|
103
|
-
then: Yup.number().typeError(getLabel(DICCTIONARY.error_operand_mustbe_number)).min(
|
|
103
|
+
then: Yup.number().typeError(getLabel(DICCTIONARY.error_operand_mustbe_number)).min(
|
|
104
|
+
Yup.ref("formValueOperand1"),
|
|
105
|
+
getLabel(DICCTIONARY.error_less_than_start)
|
|
106
|
+
)
|
|
104
107
|
})
|
|
105
108
|
});
|
|
106
109
|
}
|
|
@@ -27,13 +27,16 @@ class SelectAsyncFilterHelpers {
|
|
|
27
27
|
let operandsArray = [];
|
|
28
28
|
if (isMultiple) {
|
|
29
29
|
dOperator = field.defaultOperator ?? "in";
|
|
30
|
-
isSet =
|
|
30
|
+
isSet = defaultOperandsArray !== null && defaultOperandsArray.length > 0;
|
|
31
31
|
if (field.defaultOperandsArray !== void 0 && Array.isArray(field.defaultOperandsArray)) {
|
|
32
|
-
operandsArray = filterValidOperandsArraySelectAsync(
|
|
32
|
+
operandsArray = filterValidOperandsArraySelectAsync(
|
|
33
|
+
field.defaultOperandsArray,
|
|
34
|
+
field
|
|
35
|
+
);
|
|
33
36
|
}
|
|
34
37
|
} else {
|
|
35
38
|
dOperator = field.defaultOperator ?? "e";
|
|
36
|
-
isSet =
|
|
39
|
+
isSet = defaultOperand1 ? true : false;
|
|
37
40
|
}
|
|
38
41
|
const defaultCommonFilter = {
|
|
39
42
|
id: 0,
|
|
@@ -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?.(
|
|
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?.(
|
|
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(
|
|
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(
|
|
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(
|
|
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") {
|
|
@@ -26,13 +26,15 @@ class SelectFilterHelpers {
|
|
|
26
26
|
let operandsArray = [];
|
|
27
27
|
if (isMultiple) {
|
|
28
28
|
dOperator = field.defaultOperator ?? "in";
|
|
29
|
-
isSet =
|
|
29
|
+
isSet = defaultOperandsArray !== null && defaultOperandsArray.length > 0;
|
|
30
30
|
if (field.defaultOperandsArray !== void 0 && Array.isArray(field.defaultOperandsArray)) {
|
|
31
|
-
operandsArray = filterValidOperandsArraySelect(
|
|
31
|
+
operandsArray = filterValidOperandsArraySelect(
|
|
32
|
+
field.defaultOperandsArray
|
|
33
|
+
);
|
|
32
34
|
}
|
|
33
35
|
} else {
|
|
34
36
|
dOperator = field.defaultOperator ?? "e";
|
|
35
|
-
isSet =
|
|
37
|
+
isSet = defaultOperand1 !== null;
|
|
36
38
|
}
|
|
37
39
|
const defaultCommonFilter = {
|
|
38
40
|
id: 0,
|
|
@@ -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(
|
|
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(
|
|
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(
|
|
151
|
-
|
|
152
|
-
|
|
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
|
}
|
|
@@ -12,8 +12,8 @@ class StringFilterHelpers {
|
|
|
12
12
|
getDefaultFilter(field, fixed) {
|
|
13
13
|
const defaultOperand1 = field.defaultOperand1;
|
|
14
14
|
let isSet = false;
|
|
15
|
-
if (
|
|
16
|
-
isSet =
|
|
15
|
+
if (defaultOperand1 !== null && typeof defaultOperand1 === "string") {
|
|
16
|
+
isSet = true;
|
|
17
17
|
}
|
|
18
18
|
const defaultFilter = {
|
|
19
19
|
id: 0,
|
|
@@ -64,7 +64,9 @@ class StringFilterHelpers {
|
|
|
64
64
|
const labelOperands = filter.operand1 !== void 0 ? filter.operand1 + "" : "";
|
|
65
65
|
return {
|
|
66
66
|
labelField: filter.field.label ?? getLabel(filter.field.dictionaryId),
|
|
67
|
-
labelOperator: getLabel(
|
|
67
|
+
labelOperator: getLabel(
|
|
68
|
+
`${DYNAMIC_FILTER_DICTIONARY_ID}.operator_${filter.operator}`
|
|
69
|
+
),
|
|
68
70
|
labelOperands
|
|
69
71
|
};
|
|
70
72
|
}
|
|
@@ -41,11 +41,11 @@ styled(IconButton, {
|
|
|
41
41
|
name: OBJECT_LOGS_KEY_COMPONENT,
|
|
42
42
|
slot: ObjectLogsSlots.iconButtonStyled
|
|
43
43
|
})(objectLogsStyles?.iconButtonStyled);
|
|
44
|
-
|
|
44
|
+
styled(Icon, {
|
|
45
45
|
name: OBJECT_LOGS_KEY_COMPONENT,
|
|
46
46
|
slot: ObjectLogsSlots.iconStyled
|
|
47
47
|
})(objectLogsStyles?.iconStyled);
|
|
48
|
-
|
|
48
|
+
styled(Icon, {
|
|
49
49
|
name: OBJECT_LOGS_KEY_COMPONENT,
|
|
50
50
|
slot: ObjectLogsSlots.iconClickeableStyled
|
|
51
51
|
})(objectLogsStyles?.iconClickeableStyled);
|
|
@@ -57,8 +57,6 @@ export {
|
|
|
57
57
|
ContainerWrapperStyled as C,
|
|
58
58
|
DetailDialogComponent as D,
|
|
59
59
|
GridWrapperStyled as G,
|
|
60
|
-
IconClickeableStyled as I,
|
|
61
60
|
StackStyled as S,
|
|
62
|
-
WindowBaseStyled as W
|
|
63
|
-
IconStyled as a
|
|
61
|
+
WindowBaseStyled as W
|
|
64
62
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { r as renderIcon } from "./helpers/renderIcon.js";
|
|
3
|
+
import { r as renderMultipleIcons } from "./helpers/renderMultipleIcons.js";
|
|
4
|
+
const IconsFormatter = (props) => {
|
|
5
|
+
const { icons } = props;
|
|
6
|
+
const iconsArray = useMemo(() => {
|
|
7
|
+
if (!icons) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
return Array.isArray(icons) ? icons : [icons];
|
|
11
|
+
}, [icons]);
|
|
12
|
+
if (!iconsArray || iconsArray.length === 0) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
if (iconsArray.length === 1) {
|
|
16
|
+
return renderIcon(iconsArray[0]);
|
|
17
|
+
}
|
|
18
|
+
return renderMultipleIcons(iconsArray);
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
IconsFormatter as I
|
|
22
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const iconsFormatterStyles = {
|
|
2
|
+
/**
|
|
3
|
+
* Estilo del contenedor de array de iconos
|
|
4
|
+
*/
|
|
5
|
+
iconsContainer: ({ theme }) => ({
|
|
6
|
+
display: "flex",
|
|
7
|
+
alignItems: "center",
|
|
8
|
+
flexWrap: "wrap",
|
|
9
|
+
gap: theme.vars.size.baseSpacings.sp1,
|
|
10
|
+
maxHeight: "100%",
|
|
11
|
+
overflow: "hidden"
|
|
12
|
+
}),
|
|
13
|
+
/**
|
|
14
|
+
* Estilo del icono
|
|
15
|
+
*/
|
|
16
|
+
icon: () => ({
|
|
17
|
+
flexShrink: 0
|
|
18
|
+
}),
|
|
19
|
+
/**
|
|
20
|
+
* Estilo del icono clickeable
|
|
21
|
+
*/
|
|
22
|
+
iconClickeable: () => ({
|
|
23
|
+
cursor: "pointer",
|
|
24
|
+
flexShrink: 0
|
|
25
|
+
})
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
iconsFormatterStyles as i
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ICONS_FORMATTER_KEY_COMPONENT = "M4LIconsFormatter";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IconConfig } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Helper que renderiza un único icono
|
|
4
4
|
* @param iconConfig - Configuración del icono
|
|
5
5
|
* @param key - Clave opcional para listas
|
|
6
6
|
* @returns Componente de icono renderizado
|
|
7
7
|
*/
|
|
8
|
-
export declare function renderIcon(iconConfig:
|
|
8
|
+
export declare function renderIcon(iconConfig: IconConfig, key?: number): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { I as IconClickeableStyled, a as IconStyled } from "../slots/IconsFormatterSlots.js";
|
|
3
|
+
function renderIcon(iconConfig, key) {
|
|
4
|
+
const { iconUrl, onClick, tooltip, dataTestId, color, visible, size } = iconConfig;
|
|
5
|
+
if (visible === false) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
const IconComponent = onClick ? IconClickeableStyled : IconStyled;
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
IconComponent,
|
|
11
|
+
{
|
|
12
|
+
src: iconUrl,
|
|
13
|
+
onClick,
|
|
14
|
+
tooltipContent: tooltip,
|
|
15
|
+
instaceDataTestId: dataTestId,
|
|
16
|
+
color,
|
|
17
|
+
size
|
|
18
|
+
},
|
|
19
|
+
key
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
renderIcon as r
|
|
24
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IconConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Helper que renderiza múltiples iconos
|
|
4
|
+
* @param icons - Array de configuraciones de iconos
|
|
5
|
+
* @returns Componente contenedor con múltiples iconos
|
|
6
|
+
*/
|
|
7
|
+
export declare function renderMultipleIcons(icons: IconConfig[]): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { b as IconsContainerStyled } from "../slots/IconsFormatterSlots.js";
|
|
3
|
+
import { r as renderIcon } from "./renderIcon.js";
|
|
4
|
+
function renderMultipleIcons(icons) {
|
|
5
|
+
const visibleIcons = icons.filter((icon) => icon.visible !== false);
|
|
6
|
+
if (visibleIcons.length === 0) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
if (visibleIcons.length === 1) {
|
|
10
|
+
return renderIcon(visibleIcons[0]);
|
|
11
|
+
}
|
|
12
|
+
return /* @__PURE__ */ jsx(IconsContainerStyled, { children: visibleIcons.map((icon, index) => renderIcon(icon, index)) });
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
renderMultipleIcons as r
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var IconsFormatterSlots = /* @__PURE__ */ ((IconsFormatterSlots2) => {
|
|
2
|
+
IconsFormatterSlots2["iconsContainer"] = "iconsContainer";
|
|
3
|
+
IconsFormatterSlots2["icon"] = "icon";
|
|
4
|
+
IconsFormatterSlots2["iconClickeable"] = "iconClickeable";
|
|
5
|
+
return IconsFormatterSlots2;
|
|
6
|
+
})(IconsFormatterSlots || {});
|
|
7
|
+
export {
|
|
8
|
+
IconsFormatterSlots as I
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const IconsContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
|
|
2
|
+
ownerState?: any;
|
|
3
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
|
|
4
|
+
export declare const IconStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../Icon').IconProps, keyof import('../../../Icon').IconProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
|
|
5
|
+
ownerState?: any;
|
|
6
|
+
}, {}, {}>;
|
|
7
|
+
export declare const IconClickeableStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../Icon').IconProps, keyof import('../../../Icon').IconProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown> & {
|
|
8
|
+
ownerState?: any;
|
|
9
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { styled } from "@mui/material";
|
|
2
|
+
import { I as ICONS_FORMATTER_KEY_COMPONENT } from "../constants.js";
|
|
3
|
+
import { I as IconsFormatterSlots } from "./IconsFormatterEnum.js";
|
|
4
|
+
import { i as iconsFormatterStyles } from "../IconsFormatter.styles.js";
|
|
5
|
+
import { I as Icon } from "../../../Icon/Icon.js";
|
|
6
|
+
const IconsContainerStyled = styled("div", {
|
|
7
|
+
name: ICONS_FORMATTER_KEY_COMPONENT,
|
|
8
|
+
slot: IconsFormatterSlots.iconsContainer
|
|
9
|
+
})(iconsFormatterStyles.iconsContainer);
|
|
10
|
+
const IconStyled = styled(Icon, {
|
|
11
|
+
name: ICONS_FORMATTER_KEY_COMPONENT,
|
|
12
|
+
slot: IconsFormatterSlots.icon
|
|
13
|
+
})(iconsFormatterStyles.icon);
|
|
14
|
+
const IconClickeableStyled = styled(Icon, {
|
|
15
|
+
name: ICONS_FORMATTER_KEY_COMPONENT,
|
|
16
|
+
slot: IconsFormatterSlots.iconClickeable
|
|
17
|
+
})(iconsFormatterStyles.iconClickeable);
|
|
18
|
+
export {
|
|
19
|
+
IconClickeableStyled as I,
|
|
20
|
+
IconStyled as a,
|
|
21
|
+
IconsContainerStyled as b
|
|
22
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
import { DeepKeyOf } from '../../../utils/types';
|
|
3
|
+
import { Sizes } from '@m4l/styles';
|
|
4
|
+
import { IconsFormatterSlots } from './slots/IconsFormatterEnum';
|
|
5
|
+
import { M4LOverridesStyleRules } from '../../../@types/augmentations';
|
|
6
|
+
import { ICONS_FORMATTER_KEY_COMPONENT } from './constants';
|
|
7
|
+
export type IconColorDeep = DeepKeyOf<Theme['vars']['palette']> | string;
|
|
8
|
+
/**
|
|
9
|
+
* Configuración para un solo icono
|
|
10
|
+
*/
|
|
11
|
+
export interface IconConfig {
|
|
12
|
+
/**
|
|
13
|
+
* URL o ruta de la imagen del icono
|
|
14
|
+
*/
|
|
15
|
+
iconUrl: string;
|
|
16
|
+
/**
|
|
17
|
+
* Tooltip que se mostrará al pasar el cursor sobre el icono
|
|
18
|
+
*/
|
|
19
|
+
tooltip?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Función que se ejecuta al hacer clic en el icono
|
|
22
|
+
*/
|
|
23
|
+
onClick?: () => void;
|
|
24
|
+
/**
|
|
25
|
+
* Data test id para testing
|
|
26
|
+
*/
|
|
27
|
+
dataTestId?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Controla la visibilidad del icono
|
|
30
|
+
*/
|
|
31
|
+
visible?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Color del icono
|
|
34
|
+
*/
|
|
35
|
+
color?: IconColorDeep;
|
|
36
|
+
/**
|
|
37
|
+
* Tamaño del icono
|
|
38
|
+
*/
|
|
39
|
+
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Props para el IconsFormatter
|
|
43
|
+
*/
|
|
44
|
+
export interface IconsFormatterProps {
|
|
45
|
+
/**
|
|
46
|
+
* Array de configuraciones de iconos (puede ser uno o varios)
|
|
47
|
+
*/
|
|
48
|
+
icons: IconConfig | IconConfig[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Tipos de slots disponibles para el TagFormatter
|
|
52
|
+
*/
|
|
53
|
+
export type IconsFormatterSlotsType = IconsFormatterSlots;
|
|
54
|
+
/**
|
|
55
|
+
* Estilos aplicables al TagFormatter
|
|
56
|
+
*/
|
|
57
|
+
export type IconsFormatterStyles = M4LOverridesStyleRules<IconsFormatterSlotsType, typeof ICONS_FORMATTER_KEY_COMPONENT, Theme>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { r as renderTag } from "./helpers/renderTag.js";
|
|
3
|
+
import { r as renderMultipleTags } from "./helpers/renderMultipleTag.js";
|
|
4
|
+
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
5
|
+
const TagsFormatter = (props) => {
|
|
6
|
+
const { tags, className, size } = props;
|
|
7
|
+
const { currentSize } = useComponentSize(size);
|
|
8
|
+
const tagsArray = useMemo(() => {
|
|
9
|
+
if (!tags) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return Array.isArray(tags) ? tags : [tags];
|
|
13
|
+
}, [tags]);
|
|
14
|
+
if (!tagsArray || tagsArray.length === 0) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
if (tagsArray.length === 1) {
|
|
18
|
+
return renderTag({
|
|
19
|
+
tag: tagsArray[0],
|
|
20
|
+
size: currentSize,
|
|
21
|
+
className
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return renderMultipleTags(tagsArray, currentSize, className);
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
TagsFormatter as T
|
|
28
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { g as getSizeStyles } from "../../../utils/getSizeStyles/getSizeStyles.js";
|
|
2
|
+
import { getContrastTextColor } from "@m4l/graphics";
|
|
3
|
+
const tagsFormatterStyles = {
|
|
4
|
+
/**
|
|
5
|
+
* Contenedor de multiple tags
|
|
6
|
+
*/
|
|
7
|
+
tagsContainer: ({ theme }) => ({
|
|
8
|
+
display: "flex",
|
|
9
|
+
flexWrap: "wrap",
|
|
10
|
+
gap: theme.vars.size.baseSpacings.sp1,
|
|
11
|
+
maxHeight: "100%",
|
|
12
|
+
overflow: "hidden"
|
|
13
|
+
}),
|
|
14
|
+
/**
|
|
15
|
+
* Estilos del tag individual
|
|
16
|
+
*/
|
|
17
|
+
tag: ({ theme, ownerState }) => {
|
|
18
|
+
const backgroundColor = ownerState?.backgroundColor || "#000000";
|
|
19
|
+
const textColor = getContrastTextColor(backgroundColor);
|
|
20
|
+
return {
|
|
21
|
+
display: "inline-block",
|
|
22
|
+
paddingLeft: theme.vars.size.baseSpacings.sp2,
|
|
23
|
+
paddingRight: theme.vars.size.baseSpacings.sp2,
|
|
24
|
+
borderRadius: theme.vars.size.borderRadius.r1,
|
|
25
|
+
cursor: "default",
|
|
26
|
+
maxWidth: "200px",
|
|
27
|
+
whiteSpace: "nowrap",
|
|
28
|
+
overflow: "hidden",
|
|
29
|
+
textOverflow: "ellipsis",
|
|
30
|
+
verticalAlign: "middle",
|
|
31
|
+
...getSizeStyles(theme, ownerState?.size || "medium", "base"),
|
|
32
|
+
...theme.typography.body,
|
|
33
|
+
lineHeight: getSizeStyles(theme, ownerState?.size || "medium", "base").height,
|
|
34
|
+
backgroundColor,
|
|
35
|
+
color: textColor
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
tagsFormatterStyles as t
|
|
41
|
+
};
|