@m4l/components 1.0.9 → 1.0.11

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 (67) hide show
  1. package/components/AccountPopover/{index.85964263.js → index.62b1290b.js} +2 -2
  2. package/components/AppBar/{index.233917e6.js → index.b48343d8.js} +2 -2
  3. package/components/CommonActions/{index.5f5362d4.js → index.19f39dca.js} +3 -3
  4. package/components/DynamicFilter/helpers/index.609b3915.js +557 -0
  5. package/components/DynamicFilter/index.0f04f223.js +363 -0
  6. package/components/DynamicFilter/slots/{index.79811999.js → index.00b68384.js} +5 -5
  7. package/components/DynamicFilter/store/index.85a2812f.js +254 -0
  8. package/components/DynamicFilter/subcomponents/index.86c6fda2.js +586 -0
  9. package/components/FieldLabel/{index.61450047.js → index.1577ac9c.js} +1 -1
  10. package/components/HamburgerMenu/{index.6da952c3.js → index.6c82741d.js} +2 -2
  11. package/components/Icon/{index.0d591435.js → index.8ecfb193.js} +2 -2
  12. package/components/Image/{index.7b1ce7d6.js → index.4a822ede.js} +1 -1
  13. package/components/LoadingError/{index.5b8a819d.js → index.9e829e8d.js} +2 -2
  14. package/components/MFLoader/{index.6f690259.js → index.29f445e2.js} +1 -1
  15. package/components/ModalDialog/{index.bdae9c06.js → index.96c4aba3.js} +1 -1
  16. package/components/NoItemSelected/{index.71727588.js → index.0ae9f28f.js} +1 -1
  17. package/components/ObjectLogs/{index.5e18c08e.js → index.40c5047f.js} +5 -5
  18. package/components/PDFViewer/{index.e5b7b58c.js → index.651cc4b6.js} +1 -1
  19. package/components/Page/{index.bf61755b.js → index.1d08818c.js} +1 -1
  20. package/components/PaperForm/{index.2c5d1c14.js → index.1a8b10d4.js} +1 -1
  21. package/components/Period/{index.9f3a2531.js → index.236971ae.js} +2 -2
  22. package/components/PrintingSystem/{index.e166c8d5.js → index.9fdae551.js} +13 -13
  23. package/components/PrintingSystem/subcomponents/BodyNode/{index.ff5bd9ba.js → index.794dbc69.js} +1 -1
  24. package/components/PrintingSystem/subcomponents/ChartNode/{index.e78e9c90.js → index.6bbf7d75.js} +1 -1
  25. package/components/PrintingSystem/subcomponents/DividerNode/{index.1ff8a100.js → index.015a2212.js} +1 -1
  26. package/components/PrintingSystem/subcomponents/FooterNode/{index.7078b267.js → index.08eeb1d2.js} +1 -1
  27. package/components/PrintingSystem/subcomponents/GridNode/{index.45007400.js → index.23995699.js} +1 -1
  28. package/components/PrintingSystem/subcomponents/HeaderNode/{index.c19c37d6.js → index.3fa36620.js} +1 -1
  29. package/components/PrintingSystem/subcomponents/PaperNode/{index.3a620060.js → index.8b7d43f4.js} +1 -1
  30. package/components/PrintingSystem/subcomponents/PropertyValueNode/{index.c158a2b6.js → index.9856c572.js} +1 -1
  31. package/components/PrintingSystem/subcomponents/SectionNode/{index.cc08a0f8.js → index.89b3a4e0.js} +1 -1
  32. package/components/PrintingSystem/subcomponents/TextBoxNode/{index.a37d8efa.js → index.dc6e9dc2.js} +1 -1
  33. package/components/PropertyValue/{index.2e61bd86.js → index.646a7e8b.js} +2 -2
  34. package/components/SideBar/{index.a645fbb3.js → index.d221254d.js} +4 -4
  35. package/components/ToastContainer/{index.c1ae5efc.js → index.7f246bbd.js} +1 -1
  36. package/components/areas/contexts/AreasContext/{index.ed31c72d.js → index.0815f278.js} +2 -2
  37. package/components/areas/{dictionary.ffe082b0.js → dictionary.6168209a.js} +2 -2
  38. package/components/areas/hooks/useAreas/{index.dca83673.js → index.4039e30d.js} +1 -1
  39. package/components/hook-form/RHFAutocompleteAsync/{index.58439d31.js → index.69f5661d.js} +2 -2
  40. package/components/hook-form/RHFCheckbox/{index.52645cbc.js → index.13de27db.js} +2 -2
  41. package/components/hook-form/RHFColorPicker/{index.ad3a7448.js → index.66004599.js} +5 -5
  42. package/components/hook-form/RHFDateTime/{index.0bb4279e.js → index.dfe07e18.js} +3 -3
  43. package/components/hook-form/RHFPeriod/{index.8075a132.js → index.d852649b.js} +3 -3
  44. package/components/hook-form/RHFTextField/{index.8d9e389c.js → index.d207efc1.js} +3 -3
  45. package/components/hook-form/RHFUpload/{index.bb7f617e.js → index.955a4ba5.js} +2 -2
  46. package/components/maps/components/GpsTools/{index.a32b12b7.js → index.01acaf3e.js} +2 -2
  47. package/components/maps/{index.595f5894.js → index.a1bf63f2.js} +9 -9
  48. package/components/modal/{WindowBase.57f82667.js → WindowBase.390b0910.js} +3 -3
  49. package/components/modal/{WindowConfirm.21342f0a.js → WindowConfirm.243e1bef.js} +5 -5
  50. package/components/mui_extended/Accordion/{index.232b14c4.js → index.f7a17c83.js} +2 -2
  51. package/components/mui_extended/Button/{index.6276c580.js → index.52852c42.js} +4 -4
  52. package/components/mui_extended/CheckBox/{index.2bf3b459.js → index.01218423.js} +1 -1
  53. package/components/mui_extended/IconButton/{index.20a5a0be.js → index.d5b273e6.js} +1 -1
  54. package/components/mui_extended/Pager/{index.2a5203df.js → index.8960227c.js} +3 -3
  55. package/components/mui_extended/Popover/{index.fda32ba1.js → index.146ded9e.js} +12 -11
  56. package/components/mui_extended/Tab/{index.03742bb6.js → index.37d588d6.js} +15 -15
  57. package/components/mui_extended/ToggleButton/{index.7a4779c7.js → index.c441b949.js} +1 -1
  58. package/components/mui_extended/ToggleIconButton/{index.29fdefaa.js → index.8a84f25e.js} +1 -1
  59. package/components/popups/PopupsProvider/{index.6b5befba.js → index.d4caacc3.js} +1 -1
  60. package/components/popups/PopupsViewer/{index.c7940ab0.js → index.42312806.js} +3 -3
  61. package/contexts/ModalContext/{index.e126d383.js → index.5f77a463.js} +1 -1
  62. package/hooks/useFormAddEdit/{index.42356b18.js → index.ecb77e67.js} +2 -2
  63. package/hooks/useModal/{index.20c3f2be.js → index.d14c7e46.js} +4 -4
  64. package/index.js +64 -61
  65. package/package.json +1 -1
  66. package/{vendor.e16cc0cc.js → vendor.5b266106.js} +49 -49
  67. package/components/DynamicFilter/index.d698a952.js +0 -1721
@@ -0,0 +1,586 @@
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { useMemo, useState, useEffect } from "react";
3
+ import { useModuleDictionary, useEnvironment, useModuleSkeleton } from "@m4l/core";
4
+ import { B as BOOLEAN_OPERATORS, S as STRING_OPERATORS, b as DATE_TIME_OPERATORS, N as NUMBER_OPERATORS, c as SELECT_OPERATORS, A as ALL_FIELD } from "../../areas/constants.0d3ba950.js";
5
+ import { g as getDynamicFilterDictionary, D as DICCTIONARY } from "../../areas/dictionary.6168209a.js";
6
+ import { R as RHFAutocomplete } from "../../../vendor.5b266106.js";
7
+ import { R as RHFTextField } from "../../hook-form/RHFTextField/index.d207efc1.js";
8
+ import { useFormContext, useWatch } from "react-hook-form";
9
+ import { R as RHFDateTime } from "../../hook-form/RHFDateTime/index.dfe07e18.js";
10
+ import { u as useDynamicFilterStore } from "../store/index.85a2812f.js";
11
+ import { R as RHFAutocompleteAsync } from "../../hook-form/RHFAutocompleteAsync/index.69f5661d.js";
12
+ import { I as InputFilterStyled, a as InputFilterIconStyled, b as InputFilterInputStyled, A as AppliedFilterChipStyled, c as AppliedFilterChipIconStyled, d as AppliedFilterChipInfoStyled, e as AppliedFilterChipInfoFieldNameStyled, f as AppliedFilterChipInfoOperatorStyled, g as AppliedFilterChipInfoOperandsStyled, h as AppliedFilterChipRemoveButtonStyled, i as AppliedFiltersStyled, j as AppliedFilterInnerContainerStyled, k as ActionsSkeletonButtonStyled, l as ActionsStyled, m as ActionsClearButtonStyled, n as ActionsSubmitButtonStyled, R as RootStyled, o as InnerContainerStyled } from "../slots/index.00b68384.js";
13
+ import { g as getPropDataTestId } from "../../../test/getNameDataTestId.aee44365.js";
14
+ import { D as DynamicFilterSlots } from "../index.0f04f223.js";
15
+ import { Skeleton } from "@mui/material";
16
+ import { a as PopoverMenuFields, b as PopoverFilter } from "../../mui_extended/Popover/index.146ded9e.js";
17
+ import { S as ScrollBar } from "../../ScrollBar/index.1e89bb44.js";
18
+ import { useFormatter } from "@m4l/graphics";
19
+ import { B as BooleanFilterHelpers, S as StringFilterHelpers, N as NumberFilterHelpers, D as DateTimeFilterHelpers, b as SelectFilterHelpers } from "../helpers/index.609b3915.js";
20
+ function BooleanFilter() {
21
+ const { getLabel } = useModuleDictionary();
22
+ const operators = useMemo(
23
+ () => BOOLEAN_OPERATORS.map((o) => ({
24
+ id: o,
25
+ label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
26
+ })),
27
+ [getLabel]
28
+ );
29
+ const optionsYesNo = useMemo(
30
+ () => [
31
+ {
32
+ value: true,
33
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.operand_true))
34
+ },
35
+ {
36
+ value: false,
37
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.operand_false))
38
+ }
39
+ ],
40
+ [getLabel]
41
+ );
42
+ return /* @__PURE__ */ jsxs("div", { children: [
43
+ /* @__PURE__ */ jsx(
44
+ RHFAutocomplete,
45
+ {
46
+ name: "formValueOperator",
47
+ autoComplete: "off",
48
+ options: operators,
49
+ getOptionLabel: (option) => option.label,
50
+ isOptionEqualToValue: (option, value) => option.id === value.id,
51
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_boolean_operator))
52
+ }
53
+ ),
54
+ /* @__PURE__ */ jsx(
55
+ RHFAutocomplete,
56
+ {
57
+ name: "formValueOperand1",
58
+ autoComplete: "off",
59
+ options: optionsYesNo,
60
+ getOptionLabel: (option) => option.label,
61
+ isOptionEqualToValue: (option, value) => option.value === value.value,
62
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_boolean_operand1))
63
+ }
64
+ )
65
+ ] });
66
+ }
67
+ function StringFilter() {
68
+ const { getLabel } = useModuleDictionary();
69
+ const operators = useMemo(
70
+ () => STRING_OPERATORS.map((o) => ({
71
+ id: o,
72
+ label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
73
+ })),
74
+ [getLabel]
75
+ );
76
+ return /* @__PURE__ */ jsxs("div", { children: [
77
+ /* @__PURE__ */ jsx(
78
+ RHFAutocomplete,
79
+ {
80
+ name: "formValueOperator",
81
+ autoComplete: "off",
82
+ options: operators,
83
+ getOptionLabel: (option) => option.label,
84
+ isOptionEqualToValue: (option, value) => option.id === value.id,
85
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operator_string))
86
+ }
87
+ ),
88
+ /* @__PURE__ */ jsx(
89
+ RHFTextField,
90
+ {
91
+ name: "formValueOperand1",
92
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand1_string))
93
+ }
94
+ )
95
+ ] });
96
+ }
97
+ function DateTimeFilter() {
98
+ const { getLabel } = useModuleDictionary();
99
+ const { control } = useFormContext();
100
+ const operator = useWatch({
101
+ control,
102
+ name: "formValueOperator"
103
+ });
104
+ const operators = useMemo(
105
+ () => DATE_TIME_OPERATORS.map((o) => ({
106
+ id: o,
107
+ label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
108
+ })),
109
+ [getLabel]
110
+ );
111
+ return /* @__PURE__ */ jsxs("div", { children: [
112
+ /* @__PURE__ */ jsx(
113
+ RHFAutocomplete,
114
+ {
115
+ name: "formValueOperator",
116
+ autoComplete: "off",
117
+ options: operators,
118
+ getOptionLabel: (option) => option.label,
119
+ isOptionEqualToValue: (option, value) => option.id === value.id,
120
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operator_date_time))
121
+ }
122
+ ),
123
+ /* @__PURE__ */ jsx(
124
+ RHFDateTime,
125
+ {
126
+ name: "formValueOperand1",
127
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand1_date_time))
128
+ }
129
+ ),
130
+ operator && operator.id === "b" && /* @__PURE__ */ jsx(
131
+ RHFDateTime,
132
+ {
133
+ name: "formValueOperand2",
134
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand2_date_time))
135
+ }
136
+ )
137
+ ] });
138
+ }
139
+ function NumberFilter() {
140
+ const { getLabel } = useModuleDictionary();
141
+ const { control } = useFormContext();
142
+ const operator = useWatch({
143
+ control,
144
+ name: "formValueOperator"
145
+ });
146
+ const operators = useMemo(
147
+ () => NUMBER_OPERATORS.map((o) => ({
148
+ id: o,
149
+ label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
150
+ })),
151
+ [getLabel]
152
+ );
153
+ return /* @__PURE__ */ jsxs("div", { children: [
154
+ /* @__PURE__ */ jsx(
155
+ RHFAutocomplete,
156
+ {
157
+ name: "formValueOperator",
158
+ autoComplete: "off",
159
+ options: operators,
160
+ getOptionLabel: (option) => option.label,
161
+ isOptionEqualToValue: (option, value) => option.id === value.id,
162
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operator_number))
163
+ }
164
+ ),
165
+ /* @__PURE__ */ jsx(
166
+ RHFTextField,
167
+ {
168
+ name: "formValueOperand1",
169
+ type: "number",
170
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand1_number))
171
+ }
172
+ ),
173
+ operator && operator.id === "b" && /* @__PURE__ */ jsx(
174
+ RHFTextField,
175
+ {
176
+ name: "formValueOperand2",
177
+ type: "number",
178
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_operand2_number))
179
+ }
180
+ )
181
+ ] });
182
+ }
183
+ function SelectFilter() {
184
+ const { getLabel } = useModuleDictionary();
185
+ const field = useDynamicFilterStore((state) => state.popoverFilterData?.field);
186
+ if (!field?.selectOptions?.endPoint) {
187
+ throw new Error("El filtro tipo Select requiere la configuraci\xF3n del Endpoint");
188
+ }
189
+ const autocompleteProps = field?.selectOptions;
190
+ const operators = useMemo(
191
+ () => SELECT_OPERATORS.map((o) => ({
192
+ id: o,
193
+ label: getLabel(getDynamicFilterDictionary(`operator_${o}`))
194
+ })),
195
+ [getLabel]
196
+ );
197
+ return /* @__PURE__ */ jsxs("div", { children: [
198
+ /* @__PURE__ */ jsx(
199
+ RHFAutocomplete,
200
+ {
201
+ name: "formValueOperator",
202
+ autoComplete: "off",
203
+ options: operators,
204
+ getOptionLabel: (option) => option.label,
205
+ isOptionEqualToValue: (option, value) => option.id === value.id,
206
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_select_operator))
207
+ }
208
+ ),
209
+ /* @__PURE__ */ jsx(
210
+ RHFAutocompleteAsync,
211
+ {
212
+ ...autocompleteProps,
213
+ name: "formValueOperandsArray",
214
+ autoComplete: "off",
215
+ label: getLabel(getDynamicFilterDictionary(DICCTIONARY.label_select_operands_array))
216
+ }
217
+ )
218
+ ] });
219
+ }
220
+ const helpersStrategies = {
221
+ boolean: new BooleanFilterHelpers(),
222
+ string: new StringFilterHelpers(),
223
+ number: new NumberFilterHelpers(),
224
+ datetime: new DateTimeFilterHelpers(),
225
+ select: new SelectFilterHelpers(),
226
+ __default__: () => {
227
+ throw new Error("Type no defined");
228
+ }
229
+ };
230
+ function fieldFactory(type) {
231
+ const selectedHelper = helpersStrategies?.[type];
232
+ if (!selectedHelper) {
233
+ return helpersStrategies.__default__();
234
+ }
235
+ return selectedHelper;
236
+ }
237
+ function useDynamicFilterBase() {
238
+ const ownerState = useDynamicFilterStore((state) => state.ownerState);
239
+ const dataTestId = useDynamicFilterStore((state) => state.dataTestId);
240
+ return { ownerState, dataTestId };
241
+ }
242
+ function useInputFilter() {
243
+ const [selectedFieldIndex, setSelectedFieldIndex] = useState(-1);
244
+ const [filteredFields, setFilteredFields] = useState([]);
245
+ const { host_static_assets, environment_assets } = useEnvironment();
246
+ const { getLabel } = useModuleDictionary();
247
+ const isSkeleton = useModuleSkeleton();
248
+ const anchorEl = useDynamicFilterStore((state) => state.fnAnchorEl);
249
+ const withAllField = useDynamicFilterStore((state) => state.withAllField);
250
+ const availableFields = useDynamicFilterStore((state) => state.availableFields);
251
+ const inputData = useDynamicFilterStore((state) => state.inputData);
252
+ const {
253
+ addFilter,
254
+ closePopoverMenuFields,
255
+ getFieldByName,
256
+ getNewId,
257
+ hidePopoverFilter,
258
+ openPopoverMenuFields,
259
+ setInEdition,
260
+ setInputData,
261
+ showPopoverFilterForAdd
262
+ } = useDynamicFilterStore((state) => state.actions);
263
+ useEffect(() => {
264
+ if (!anchorEl) {
265
+ setFilteredFields([]);
266
+ } else {
267
+ setFilteredFields(
268
+ availableFields.filter(
269
+ (field) => (field.label ?? getLabel(field.dictionaryId)).includes(inputData)
270
+ )
271
+ );
272
+ setSelectedFieldIndex(-1);
273
+ }
274
+ }, [anchorEl, inputData, availableFields, getLabel]);
275
+ function handleOpenPopUpClickItem(field) {
276
+ closePopoverMenuFields();
277
+ if (anchorEl)
278
+ showPopoverFilterForAdd(anchorEl(), field);
279
+ }
280
+ const inputHandlersProps = {
281
+ onFocus: (event) => {
282
+ openPopoverMenuFields(event.currentTarget);
283
+ setInEdition(true);
284
+ },
285
+ onChange: (event) => {
286
+ setInputData(event.target.value);
287
+ if (!anchorEl) {
288
+ openPopoverMenuFields(event.currentTarget);
289
+ }
290
+ hidePopoverFilter(true);
291
+ },
292
+ onKeyDown: (event) => {
293
+ if (event.key === "ArrowDown") {
294
+ let newIndex = -1;
295
+ if (filteredFields.length > 0) {
296
+ if (selectedFieldIndex < filteredFields.length - 1) {
297
+ newIndex = selectedFieldIndex + 1;
298
+ } else {
299
+ newIndex = filteredFields.length - 1;
300
+ }
301
+ }
302
+ setSelectedFieldIndex(newIndex);
303
+ }
304
+ if (event.key === "ArrowUp") {
305
+ let newIndex = -1;
306
+ if (filteredFields.length > 0) {
307
+ if (selectedFieldIndex > -1) {
308
+ newIndex = selectedFieldIndex - 1;
309
+ }
310
+ }
311
+ setSelectedFieldIndex(newIndex);
312
+ }
313
+ if (event.key === "Escape") {
314
+ closePopoverMenuFields();
315
+ }
316
+ if (event.key !== "Enter")
317
+ return;
318
+ if (selectedFieldIndex === -1) {
319
+ if (inputData.trim() === "") {
320
+ closePopoverMenuFields();
321
+ return;
322
+ }
323
+ if (withAllField) {
324
+ addFilter({
325
+ id: getNewId(),
326
+ fieldType: "string",
327
+ field: getFieldByName(ALL_FIELD.name),
328
+ isSet: true,
329
+ fixed: false,
330
+ operator: "c",
331
+ operand1: inputData
332
+ });
333
+ setInputData("");
334
+ closePopoverMenuFields();
335
+ }
336
+ } else {
337
+ handleOpenPopUpClickItem(filteredFields[selectedFieldIndex]);
338
+ }
339
+ }
340
+ };
341
+ return {
342
+ iconUrl: `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/filter.svg`,
343
+ isSkeleton,
344
+ inputPlaceHolder: getLabel(getDynamicFilterDictionary(DICCTIONARY.input_placeholder)),
345
+ inputData,
346
+ inputHandlersProps,
347
+ canRender: !(!withAllField && availableFields.length === 0),
348
+ filteredFields,
349
+ selectedFieldIndex
350
+ };
351
+ }
352
+ function InputFilterSkeleton() {
353
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
354
+ /* @__PURE__ */ jsx(
355
+ Skeleton,
356
+ {
357
+ variant: "circular",
358
+ width: "16px",
359
+ height: "16px",
360
+ sx: { minWidth: "16px", minHeight: "16px" }
361
+ }
362
+ ),
363
+ /* @__PURE__ */ jsx(Skeleton, { variant: "text", width: "100%", height: "16px", sx: { minWidth: "80px" } })
364
+ ] });
365
+ }
366
+ const InputFilter = () => {
367
+ const {
368
+ iconUrl,
369
+ isSkeleton,
370
+ inputPlaceHolder,
371
+ inputData,
372
+ inputHandlersProps,
373
+ canRender,
374
+ filteredFields,
375
+ selectedFieldIndex
376
+ } = useInputFilter();
377
+ if (!canRender)
378
+ return null;
379
+ if (isSkeleton) {
380
+ return /* @__PURE__ */ jsx(InputFilterStyled, { ownerState: {}, children: /* @__PURE__ */ jsx(InputFilterSkeleton, {}) });
381
+ }
382
+ return /* @__PURE__ */ jsxs(InputFilterStyled, { ownerState: {}, children: [
383
+ /* @__PURE__ */ jsx(InputFilterIconStyled, { src: iconUrl, ownerState: {} }),
384
+ /* @__PURE__ */ jsx(
385
+ InputFilterInputStyled,
386
+ {
387
+ type: "text",
388
+ value: inputData,
389
+ placeholder: inputPlaceHolder,
390
+ ownerState: {},
391
+ ...inputHandlersProps
392
+ }
393
+ ),
394
+ /* @__PURE__ */ jsx(PopoverMenuFields, { fields: filteredFields, selectFieldIndex: selectedFieldIndex })
395
+ ] });
396
+ };
397
+ const InputFilter$1 = InputFilter;
398
+ function useAppliedFilters() {
399
+ const appliedFilter = useDynamicFilterStore((state) => state.appliedFilters);
400
+ const isSkeleton = useDynamicFilterStore((state) => state.ownerState.isSkeleton);
401
+ const appliedFiltersSorted = [...appliedFilter].sort(
402
+ (filterA, filterB) => filterA.isSet !== filterB.isSet ? Number(filterA.isSet) - Number(filterB.isSet) : filterB.id - filterA.id
403
+ );
404
+ return {
405
+ appliedFiltersSorted,
406
+ isSkeleton
407
+ };
408
+ }
409
+ function useAppliedFilterChip(filter) {
410
+ const { host_static_assets, environment_assets } = useEnvironment();
411
+ const { getLabel } = useModuleDictionary();
412
+ const formatters = useFormatter();
413
+ const { hidePopoverFilter, removeFilter, showPopoverFilterForEdit } = useDynamicFilterStore(
414
+ (state) => state.actions
415
+ );
416
+ const removeIconUrl = `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/clear.svg`;
417
+ const labels = useMemo(() => {
418
+ return fieldFactory(filter.field.type).getLabels(filter, getLabel, formatters, filter.field);
419
+ }, [filter, getLabel]);
420
+ function onDelete() {
421
+ hidePopoverFilter(false);
422
+ removeFilter(filter.id);
423
+ }
424
+ function onEditFilter(event) {
425
+ hidePopoverFilter(false);
426
+ const currentTarget = event.currentTarget;
427
+ setTimeout(() => showPopoverFilterForEdit(currentTarget, filter), 10);
428
+ }
429
+ return {
430
+ onDelete,
431
+ onEditFilter,
432
+ removeIconUrl,
433
+ iconFieldUrl: filter.field?.urlIcon,
434
+ labels
435
+ };
436
+ }
437
+ function AppliedFilterChip(props) {
438
+ const { fixed } = props;
439
+ const { onEditFilter, onDelete, iconFieldUrl, removeIconUrl, labels } = useAppliedFilterChip(props);
440
+ return /* @__PURE__ */ jsxs(AppliedFilterChipStyled, { ownerState: {}, children: [
441
+ iconFieldUrl && /* @__PURE__ */ jsx(AppliedFilterChipIconStyled, { onClick: onEditFilter, src: iconFieldUrl, ownerState: {} }),
442
+ /* @__PURE__ */ jsxs(AppliedFilterChipInfoStyled, { onClick: onEditFilter, ownerState: {}, children: [
443
+ /* @__PURE__ */ jsx(AppliedFilterChipInfoFieldNameStyled, { ownerState: {}, children: labels.labelField }),
444
+ /* @__PURE__ */ jsx(AppliedFilterChipInfoOperatorStyled, { ownerState: {}, children: labels.labelOperator }),
445
+ /* @__PURE__ */ jsx(AppliedFilterChipInfoOperandsStyled, { ownerState: {}, children: labels.labelOperands })
446
+ ] }),
447
+ !fixed && /* @__PURE__ */ jsx(
448
+ AppliedFilterChipRemoveButtonStyled,
449
+ {
450
+ src: removeIconUrl,
451
+ size: "small",
452
+ dictionaryTooltipId: "dynamic_filter.tooltip_clear_filter",
453
+ onClick: onDelete,
454
+ ownerState: {}
455
+ }
456
+ )
457
+ ] });
458
+ }
459
+ function AppliedFilters() {
460
+ const { appliedFiltersSorted, isSkeleton } = useAppliedFilters();
461
+ if (isSkeleton) {
462
+ return /* @__PURE__ */ jsx(AppliedFiltersStyled, { ownerState: {} });
463
+ }
464
+ return /* @__PURE__ */ jsx(AppliedFiltersStyled, { ownerState: {}, children: /* @__PURE__ */ jsx(ScrollBar, { children: /* @__PURE__ */ jsx(AppliedFilterInnerContainerStyled, { ownerState: {}, children: appliedFiltersSorted?.map((filter) => /* @__PURE__ */ jsx(AppliedFilterChip, { ...filter }, filter.id)) }) }) });
465
+ }
466
+ const ASSETS_URL = "frontend/components/dynamic_filter/assets/icons";
467
+ const ASSETS = {
468
+ refresh: "restart.svg",
469
+ search: "search.svg"
470
+ };
471
+ function useFilterActions() {
472
+ const { host_static_assets, environment_assets } = useEnvironment();
473
+ const automatic = useDynamicFilterStore((state) => state.automatic);
474
+ const isSkeleton = useDynamicFilterStore((state) => state.ownerState.isSkeleton);
475
+ const isValid = useDynamicFilterStore((state) => state.ownerState.isValid);
476
+ const isDirty = useDynamicFilterStore((state) => state.ownerState.isDirty);
477
+ const appliedFilters = useDynamicFilterStore((state) => state.appliedFilters);
478
+ const { hidePopoverFilter, clearFilters, fireOnChangeFilters } = useDynamicFilterStore(
479
+ (state) => state.actions
480
+ );
481
+ function onClickClearFilters() {
482
+ hidePopoverFilter(false);
483
+ clearFilters();
484
+ fireOnChangeFilters();
485
+ }
486
+ const filterIconUrl = `${host_static_assets}/${environment_assets}/${ASSETS_URL}/${automatic ? ASSETS.refresh : ASSETS.search}`;
487
+ const clearIconUrl = `${host_static_assets}/${environment_assets}/frontend/components/dynamic_filter/assets/icons/close.svg`;
488
+ const canShowRemoveAction = appliedFilters.findIndex((f) => !f.fixed) > -1;
489
+ const filterButtonDictionaryTooltip = getDynamicFilterDictionary(
490
+ isValid ? isDirty ? DICCTIONARY.filter_tooltip_dirty : DICCTIONARY.filter_tooltip_refresh : DICCTIONARY.filter_tooltip_invalid
491
+ );
492
+ return {
493
+ isSkeleton,
494
+ filterIconUrl,
495
+ clearIconUrl,
496
+ canShowRemoveAction,
497
+ onClickClearFilters,
498
+ onClickFilter: fireOnChangeFilters,
499
+ filterButtonDictionaryTooltip,
500
+ ownerState: { isValid }
501
+ };
502
+ }
503
+ function FilterActionsSkeleton() {
504
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
505
+ /* @__PURE__ */ jsx(ActionsSkeletonButtonStyled, { ownerState: {}, children: /* @__PURE__ */ jsx(Skeleton, { variant: "circular", width: "16px", height: "16px" }) }),
506
+ /* @__PURE__ */ jsx(ActionsSkeletonButtonStyled, { ownerState: {}, children: /* @__PURE__ */ jsx(Skeleton, { variant: "circular", width: "16px", height: "16px" }) })
507
+ ] });
508
+ }
509
+ function FilterActions() {
510
+ const {
511
+ isSkeleton,
512
+ filterIconUrl,
513
+ clearIconUrl,
514
+ canShowRemoveAction,
515
+ onClickClearFilters,
516
+ onClickFilter,
517
+ filterButtonDictionaryTooltip,
518
+ ownerState
519
+ } = useFilterActions();
520
+ if (isSkeleton) {
521
+ return /* @__PURE__ */ jsx(ActionsStyled, { ownerState: {}, children: /* @__PURE__ */ jsx(FilterActionsSkeleton, {}) });
522
+ }
523
+ return /* @__PURE__ */ jsxs(ActionsStyled, { ownerState: {}, children: [
524
+ canShowRemoveAction && /* @__PURE__ */ jsx(
525
+ ActionsClearButtonStyled,
526
+ {
527
+ src: clearIconUrl,
528
+ onClick: onClickClearFilters,
529
+ dictionaryTooltipId: "dynamic_filter.tooltip_clear_filters",
530
+ ownerState: {}
531
+ }
532
+ ),
533
+ /* @__PURE__ */ jsx(
534
+ ActionsSubmitButtonStyled,
535
+ {
536
+ src: filterIconUrl,
537
+ "aria-label": "settings",
538
+ dictionaryTooltipId: filterButtonDictionaryTooltip,
539
+ onClick: onClickFilter,
540
+ ownerState: { ...ownerState }
541
+ }
542
+ )
543
+ ] });
544
+ }
545
+ function DataTypeComponent(props) {
546
+ const { formFilter, statusLoad } = props;
547
+ const { setFocus } = useFormContext();
548
+ const Component = fieldFactory(formFilter.field.type).getComponent();
549
+ useEffect(() => {
550
+ setTimeout(() => setFocus("formValueOperand1"), 100);
551
+ }, [statusLoad]);
552
+ return /* @__PURE__ */ jsx(Component, {});
553
+ }
554
+ function DynamicFilterBase() {
555
+ const { ownerState, dataTestId } = useDynamicFilterBase();
556
+ return /* @__PURE__ */ jsx(
557
+ RootStyled,
558
+ {
559
+ ownerState: { ...ownerState },
560
+ ...getPropDataTestId(dataTestId, DynamicFilterSlots.root),
561
+ children: /* @__PURE__ */ jsxs(
562
+ InnerContainerStyled,
563
+ {
564
+ ownerState: { ...ownerState },
565
+ ...getPropDataTestId(dataTestId, DynamicFilterSlots.innerContainer),
566
+ children: [
567
+ /* @__PURE__ */ jsx(InputFilter$1, {}),
568
+ /* @__PURE__ */ jsx(AppliedFilters, {}),
569
+ /* @__PURE__ */ jsx(FilterActions, {}),
570
+ /* @__PURE__ */ jsx(PopoverFilter, {})
571
+ ]
572
+ }
573
+ )
574
+ }
575
+ );
576
+ }
577
+ export {
578
+ BooleanFilter as B,
579
+ DateTimeFilter as D,
580
+ NumberFilter as N,
581
+ StringFilter as S,
582
+ SelectFilter as a,
583
+ DynamicFilterBase as b,
584
+ DataTypeComponent as c,
585
+ fieldFactory as f
586
+ };
@@ -6,7 +6,7 @@ import { e as componentName } from "../areas/constants.0d3ba950.js";
6
6
  import { g as getComponentUtilityClass } from "../../utils/index.c64c2dd1.js";
7
7
  import clsx from "clsx";
8
8
  import { T as Typography } from "../mui_extended/Typography/index.463f613f.js";
9
- import { I as Icon } from "../Icon/index.0d591435.js";
9
+ import { I as Icon } from "../Icon/index.8ecfb193.js";
10
10
  const FieldLabelRoot = styled("label")(({ theme }) => ({
11
11
  ...theme.components?.M4LFieldLabel?.styleOverrides
12
12
  }));
@@ -5,8 +5,8 @@ import { generateUtilityClasses, generateUtilityClass } from "@mui/material";
5
5
  import { unstable_composeClasses } from "@mui/base";
6
6
  import { r as componentName, H as HAMBURGER_MENU_PREFIX, T as TEST_PROP_ID } from "../areas/constants.0d3ba950.js";
7
7
  import { useEnvironment } from "@m4l/core";
8
- import { S as SideBar } from "../SideBar/index.a645fbb3.js";
9
- import { I as IconButton } from "../mui_extended/IconButton/index.20a5a0be.js";
8
+ import { S as SideBar } from "../SideBar/index.d221254d.js";
9
+ import { I as IconButton } from "../mui_extended/IconButton/index.d5b273e6.js";
10
10
  const HamburgerMenuRoot = styled("header")(({ theme }) => ({
11
11
  ...theme.components?.M4LHamburgerMenuCommercial?.styleOverrides
12
12
  }));
@@ -2,11 +2,11 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { Marker } from "react-leaflet";
3
3
  import L__default from "leaflet";
4
4
  import { s as componentName, I as ICON_PREFIX, T as TEST_PROP_ID, L as LABEL_BK_COLOR_DEFAULT, t as LABEL_COLOR_DEFAULT } from "../areas/constants.0d3ba950.js";
5
- import { m as mapClasses } from "../maps/index.595f5894.js";
5
+ import { m as mapClasses } from "../maps/index.a1bf63f2.js";
6
6
  import clsx from "clsx";
7
7
  import { useEnvironment } from "@m4l/core";
8
8
  import { generateUtilityClasses, generateUtilityClass, styled as styled$1 } from "@mui/material";
9
- import { u as useSideBar, g as getNameDataTestId$1 } from "../SideBar/index.a645fbb3.js";
9
+ import { u as useSideBar, g as getNameDataTestId$1 } from "../SideBar/index.d221254d.js";
10
10
  import { styled } from "@mui/material/styles";
11
11
  import { unstable_composeClasses } from "@mui/base";
12
12
  import { useResponsiveDesktop } from "@m4l/graphics";
@@ -5,7 +5,7 @@ import clsx from "clsx";
5
5
  import { generateUtilityClasses, generateUtilityClass } from "@mui/material";
6
6
  import { unstable_composeClasses } from "@mui/base";
7
7
  import { useBase, useEnvironment, evaluateWithContext } from "@m4l/core";
8
- import { c as classes, g as getSize } from "../PrintingSystem/index.e166c8d5.js";
8
+ import { c as classes, g as getSize } from "../PrintingSystem/index.9fdae551.js";
9
9
  import QRCode from "qrcode.react";
10
10
  const ImageRoot = styled("div")(({ theme }) => ({
11
11
  ...theme.components?.M4LImage?.styleOverrides
@@ -6,9 +6,9 @@ import { unstable_composeClasses } from "@mui/base";
6
6
  import { v as componentName } from "../areas/constants.0d3ba950.js";
7
7
  import { styled } from "@mui/material/styles";
8
8
  import { L as LinearProgressIndeterminate } from "../mui_extended/LinearProgress/index.e9455b2e.js";
9
- import { I as Icon } from "../Icon/index.0d591435.js";
9
+ import { I as Icon } from "../Icon/index.8ecfb193.js";
10
10
  import { T as Typography } from "../mui_extended/Typography/index.463f613f.js";
11
- import { B as Button } from "../mui_extended/Button/index.6276c580.js";
11
+ import { B as Button } from "../mui_extended/Button/index.52852c42.js";
12
12
  generateUtilityClasses(componentName, [
13
13
  "root",
14
14
  "loadingErrorLoading",
@@ -13,7 +13,7 @@ import { generateUtilityClasses, generateUtilityClass, styled } from "@mui/mater
13
13
  import { unstable_composeClasses } from "@mui/base";
14
14
  import { w as componentName } from "../areas/constants.0d3ba950.js";
15
15
  import { a as LinearProgress } from "../mui_extended/LinearProgress/index.e9455b2e.js";
16
- import { L as LoadingError } from "../LoadingError/index.5b8a819d.js";
16
+ import { L as LoadingError } from "../LoadingError/index.9e829e8d.js";
17
17
  const mfLoaderClasses = generateUtilityClasses(componentName, [
18
18
  "root",
19
19
  "containerLinearProgress"
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useTheme, Dialog, Paper } from "@mui/material";
3
3
  import { c as cjs } from "../../react-draggable.0cc9b257.js";
4
- import { u as useModal } from "../../hooks/useModal/index.20c3f2be.js";
4
+ import { u as useModal } from "../../hooks/useModal/index.d14c7e46.js";
5
5
  import { R as ResizeableWindow } from "../Resizeable/index.414ff687.js";
6
6
  import { useIsMobile } from "@m4l/graphics";
7
7
  import { m as modalUtilityClasses } from "../modal/index.5bce430d.js";
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useEnvironment, useModuleDictionary, useModuleSkeleton } from "@m4l/core";
3
- import { I as Image } from "../Image/index.7b1ce7d6.js";
3
+ import { I as Image } from "../Image/index.4a822ede.js";
4
4
  import { styled } from "@mui/material/styles";
5
5
  import { generateUtilityClasses, generateUtilityClass, Skeleton } from "@mui/material";
6
6
  import { useMemo } from "react";