@m4l/components 9.33.2-beta-feature-731-code-editor.0 → 9.33.2-beta-m4lcom-756-dynamicfilter-bug-con-las-fechas-aplicadas.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/types.d.ts +0 -11
- package/components/DynamicFilter/helpers/getPurgedInitialFiltersApplied.d.ts +2 -1
- package/components/DynamicFilter/helpers/getPurgedInitialFiltersApplied.d.ts.map +1 -1
- package/components/DynamicFilter/helpers/getPurgedInitialFiltersApplied.js +5 -4
- package/components/DynamicFilter/hooks/useUserTimeZoneName.d.ts +8 -0
- package/components/DynamicFilter/hooks/useUserTimeZoneName.d.ts.map +1 -0
- package/components/DynamicFilter/hooks/useUserTimeZoneName.js +8 -0
- package/components/DynamicFilter/store/DynamicFilterContext.d.ts.map +1 -1
- package/components/DynamicFilter/store/DynamicFilterContext.js +38 -36
- package/components/DynamicFilter/store/DynamicFilterStore.d.ts.map +1 -1
- package/components/DynamicFilter/store/DynamicFilterStore.js +2 -1
- package/components/DynamicFilter/store/types.d.ts +7 -1
- package/components/DynamicFilter/store/types.d.ts.map +1 -1
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.d.ts +3 -3
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.d.ts.map +1 -1
- package/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.js +57 -56
- package/components/DynamicFilter/subcomponents/FieldTypes/FieldTypeInterface.d.ts +15 -3
- package/components/DynamicFilter/subcomponents/FieldTypes/FieldTypeInterface.d.ts.map +1 -1
- package/components/DynamicFilter/subcomponents/InputFilter/InputFilter.d.ts +1 -1
- package/components/DynamicFilter/subcomponents/InputFilter/InputFilter.d.ts.map +1 -1
- package/components/DynamicFilter/subcomponents/InputFilter/InputFilter.js +25 -26
- package/components/DynamicFilter/subcomponents/InputFilter/useInputFilter.d.ts +0 -4
- package/components/DynamicFilter/subcomponents/InputFilter/useInputFilter.d.ts.map +1 -1
- package/components/DynamicFilter/subcomponents/InputFilter/useInputFilter.js +23 -27
- package/components/DynamicFilter/subcomponents/PopoverFilter/usePopoverFilter.d.ts.map +1 -1
- package/components/DynamicFilter/subcomponents/PopoverFilter/usePopoverFilter.js +31 -30
- package/components/MFIsolationApp/MFIsolationApp.d.ts.map +1 -1
- package/components/MFIsolationApp/MFIsolationApp.js +81 -85
- package/components/extended/index.d.ts +0 -1
- package/components/extended/index.d.ts.map +1 -1
- package/components/hook-form/index.d.ts +0 -1
- package/components/hook-form/index.d.ts.map +1 -1
- package/index.js +552 -565
- package/package.json +4 -7
- package/components/MFIsolationApp/subcomponents/ThemeSettingsHostToolsBridge/ThemeSettingsHostToolsBridge.d.ts +0 -5
- package/components/MFIsolationApp/subcomponents/ThemeSettingsHostToolsBridge/ThemeSettingsHostToolsBridge.d.ts.map +0 -1
- package/components/MFIsolationApp/subcomponents/ThemeSettingsHostToolsBridge/ThemeSettingsHostToolsBridge.js +0 -14
- package/components/MFIsolationApp/subcomponents/ThemeSettingsHostToolsBridge/index.d.ts +0 -2
- package/components/MFIsolationApp/subcomponents/ThemeSettingsHostToolsBridge/index.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.d.ts +0 -6
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.js +0 -380
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.styles.d.ts +0 -3
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.styles.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.styles.js +0 -344
- package/components/extended/ReactSimpleCodeEditor/constants.d.ts +0 -83
- package/components/extended/ReactSimpleCodeEditor/constants.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/constants.js +0 -149
- package/components/extended/ReactSimpleCodeEditor/dictionary.d.ts +0 -12
- package/components/extended/ReactSimpleCodeEditor/dictionary.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/dictionary.js +0 -8
- package/components/extended/ReactSimpleCodeEditor/helpers/highlighting.d.ts +0 -58
- package/components/extended/ReactSimpleCodeEditor/helpers/highlighting.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/helpers/highlighting.js +0 -1063
- package/components/extended/ReactSimpleCodeEditor/helpers/languageIcon.d.ts +0 -6
- package/components/extended/ReactSimpleCodeEditor/helpers/languageIcon.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/helpers/languageIcon.js +0 -7
- package/components/extended/ReactSimpleCodeEditor/helpers/resolveEditorComponent.d.ts +0 -6
- package/components/extended/ReactSimpleCodeEditor/helpers/resolveEditorComponent.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/helpers/resolveEditorComponent.js +0 -9
- package/components/extended/ReactSimpleCodeEditor/index.d.ts +0 -4
- package/components/extended/ReactSimpleCodeEditor/index.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorEnum.d.ts +0 -20
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorEnum.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorEnum.js +0 -4
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorSlots.d.ts +0 -90
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorSlots.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorSlots.js +0 -73
- package/components/extended/ReactSimpleCodeEditor/slots/index.d.ts +0 -3
- package/components/extended/ReactSimpleCodeEditor/slots/index.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/types.d.ts +0 -460
- package/components/extended/ReactSimpleCodeEditor/types.d.ts.map +0 -1
- package/components/hook-form/RHFCodeEditor/RHFCodeEditor.d.ts +0 -7
- package/components/hook-form/RHFCodeEditor/RHFCodeEditor.d.ts.map +0 -1
- package/components/hook-form/RHFCodeEditor/RHFCodeEditor.js +0 -6
- package/components/hook-form/RHFCodeEditor/index.d.ts +0 -3
- package/components/hook-form/RHFCodeEditor/index.d.ts.map +0 -1
package/@types/types.d.ts
CHANGED
|
@@ -373,10 +373,6 @@ import {
|
|
|
373
373
|
ReactJsonViewerOwnerState,
|
|
374
374
|
ReactJsonViewerSlotsType,
|
|
375
375
|
} from '../components/extended/React-Json-Viewer/types';
|
|
376
|
-
import {
|
|
377
|
-
CodeEditorOwnerState,
|
|
378
|
-
CodeEditorSlotsType,
|
|
379
|
-
} from '../components/extended/ReactSimpleCodeEditor/types';
|
|
380
376
|
import {
|
|
381
377
|
ResizableOwnerState as ReactResizableOwnerState,
|
|
382
378
|
ResizableSlotsType,
|
|
@@ -503,7 +499,6 @@ declare module '@mui/material/styles' {
|
|
|
503
499
|
M4LFixedSizeList: FixedSizeListSlotsType;
|
|
504
500
|
M4LVariableSizeList: VariableSizeListSlotsType;
|
|
505
501
|
M4LReactJsonViewer: ReactJsonViewerSlotsType;
|
|
506
|
-
M4LCodeEditor: CodeEditorSlotsType;
|
|
507
502
|
M4LResizable: ResizableSlotsType;
|
|
508
503
|
M4LResizableBox: ResizableBoxSlotsType;
|
|
509
504
|
M4LImageSelector: ImageSelectorSlotsType;
|
|
@@ -619,7 +614,6 @@ declare module '@mui/material/styles' {
|
|
|
619
614
|
M4LFixedSizeList: Partial<FixedSizeListOwnerState>;
|
|
620
615
|
M4LVariableSizeList: Partial<VariableSizeListOwnerState>;
|
|
621
616
|
M4LReactJsonViewer: Partial<ReactJsonViewerOwnerState>;
|
|
622
|
-
M4LCodeEditor: Partial<CodeEditorOwnerState>;
|
|
623
617
|
M4LResizable: Partial<ReactResizableOwnerState>;
|
|
624
618
|
M4LResizableBox: Partial<ResizableBoxOwnerState>;
|
|
625
619
|
M4LImageSelector: Partial<ImageSelectorOwnerState>;
|
|
@@ -1174,11 +1168,6 @@ declare module '@mui/material/styles' {
|
|
|
1174
1168
|
styleOverrides?: ComponentsOverrides<Theme>['M4LReactJsonViewer'];
|
|
1175
1169
|
variants?: ComponentsVariants['M4LReactJsonViewer'];
|
|
1176
1170
|
};
|
|
1177
|
-
M4LCodeEditor?: {
|
|
1178
|
-
defaultProps?: ComponentsPropsList['M4LCodeEditor'];
|
|
1179
|
-
styleOverrides?: ComponentsOverrides<Theme>['M4LCodeEditor'];
|
|
1180
|
-
variants?: ComponentsVariants['M4LCodeEditor'];
|
|
1181
|
-
};
|
|
1182
1171
|
M4LResizable?: {
|
|
1183
1172
|
defaultProps?: ComponentsPropsList['M4LResizable'];
|
|
1184
1173
|
styleOverrides?: ComponentsOverrides<Theme>['M4LResizable'];
|
|
@@ -4,7 +4,8 @@ import { FilterField, FilterFieldApplied, InitialFilterApplied } from '../types'
|
|
|
4
4
|
* @param fields todos los campos que pueden aparecer en el filtro no Inclute el AllField
|
|
5
5
|
* @param initialFilters Filtros que van a ser purgados (Eliminados si tienen errores)
|
|
6
6
|
* @param getFieldByName Funcion para obtener el Field a través del nombre
|
|
7
|
+
* @param timeZoneName Zona horaria del usuario para construir los filtros por defecto de fecha
|
|
7
8
|
* @returns Array de filtros aplicados excluyendo los que tengan errores
|
|
8
9
|
*/
|
|
9
|
-
export declare function getPurgedInitialFiltersApplied(fields: Array<FilterField>, initialFilters: Array<InitialFilterApplied>, getFieldByName: (name: string) => FilterField): Array<FilterFieldApplied>;
|
|
10
|
+
export declare function getPurgedInitialFiltersApplied(fields: Array<FilterField>, initialFilters: Array<InitialFilterApplied>, getFieldByName: (name: string) => FilterField, timeZoneName?: string): Array<FilterFieldApplied>;
|
|
10
11
|
//# sourceMappingURL=getPurgedInitialFiltersApplied.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPurgedInitialFiltersApplied.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/DynamicFilter/helpers/getPurgedInitialFiltersApplied.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEtF
|
|
1
|
+
{"version":3,"file":"getPurgedInitialFiltersApplied.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/DynamicFilter/helpers/getPurgedInitialFiltersApplied.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEtF;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,KAAK,CAAC,WAAW,CAAC,EAC1B,cAAc,EAAE,KAAK,CAAC,oBAAoB,CAAC,EAC3C,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,WAAW,EAC7C,YAAY,CAAC,EAAE,MAAM,GACpB,KAAK,CAAC,kBAAkB,CAAC,CA2D3B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fieldFactory as p } from "../subcomponents/FieldTypes/fieldFactory.js";
|
|
2
|
-
function
|
|
2
|
+
function x(f, t, a, c) {
|
|
3
3
|
const o = [], i = [];
|
|
4
4
|
for (let n = 0; n < t.length; n++)
|
|
5
5
|
try {
|
|
@@ -16,7 +16,7 @@ function u(f, t, a) {
|
|
|
16
16
|
};
|
|
17
17
|
if (!e)
|
|
18
18
|
continue;
|
|
19
|
-
p(e.type).verifyFilter(d, e) && (r.fieldType === "datetime" && (r.operand1 = /* @__PURE__ */ new Date(r.operand1 + ""), r.operand2 = /* @__PURE__ */ new Date(r.operand2 + "")), e.presence === "fixed" && (i.findIndex((
|
|
19
|
+
p(e.type).verifyFilter(d, e) && (r.fieldType === "datetime" && (r.operand1 = /* @__PURE__ */ new Date(r.operand1 + ""), r.operand2 = /* @__PURE__ */ new Date(r.operand2 + "")), e.presence === "fixed" && (i.findIndex((s) => s === e.name) === -1 ? (r.fixed = !0, i.push(e.name)) : r.fixed = !1), r.isSet = !0, r.id = o.length + 1, o.push(r));
|
|
20
20
|
} catch {
|
|
21
21
|
}
|
|
22
22
|
for (let n = 0; n < f.length; n++) {
|
|
@@ -24,7 +24,8 @@ function u(f, t, a) {
|
|
|
24
24
|
if ((d.presence === "initialized" || d.presence === "fixed") && !t.find((e) => e.name === d.name)) {
|
|
25
25
|
const e = p(d.type).getDefaultFilter(
|
|
26
26
|
d,
|
|
27
|
-
d.presence === "fixed"
|
|
27
|
+
d.presence === "fixed",
|
|
28
|
+
c
|
|
28
29
|
);
|
|
29
30
|
e.id = -(o.length + 1), o.push(e);
|
|
30
31
|
}
|
|
@@ -32,5 +33,5 @@ function u(f, t, a) {
|
|
|
32
33
|
return o;
|
|
33
34
|
}
|
|
34
35
|
export {
|
|
35
|
-
|
|
36
|
+
x as getPurgedInitialFiltersApplied
|
|
36
37
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read the user-preference time-zone name (e.g. "America/Bogota") without
|
|
3
|
+
* throwing when the DynamicFilter is rendered outside a UserPreferencesProvider
|
|
4
|
+
* (isolated tests and stories). Returns undefined when no preference time zone
|
|
5
|
+
* is available, which keeps the previous local-time behavior.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useUserTimeZoneName(): string | undefined;
|
|
8
|
+
//# sourceMappingURL=useUserTimeZoneName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUserTimeZoneName.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/DynamicFilter/hooks/useUserTimeZoneName.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,GAAG,SAAS,CAGxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicFilterContext.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/DynamicFilter/store/DynamicFilterContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DynamicFilterContext.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/DynamicFilter/store/DynamicFilterContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAYf,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAQhE,QAAA,MAAM,oBAAoB,6GAAiD,CAAC;AAC5E,UAAU,yBAA0B,SAAQ,kBAAkB;IAC5D,QAAQ,EAAE,SAAS,CAAC;CACrB;AACD;;GAEG;AACH,QAAA,MAAM,qBAAqB,wHA0MzB,CAAC;AAEH,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { jsx as $ } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { forwardRef as V, useRef as
|
|
2
|
+
import { forwardRef as V, useRef as Z, useImperativeHandle as j, useEffect as s, createContext as B } from "react";
|
|
3
3
|
import { useStore as r } from "zustand";
|
|
4
4
|
import { shallow as i } from "zustand/shallow";
|
|
5
|
-
import { useModuleDictionary as
|
|
6
|
-
import { useIsMobile as
|
|
7
|
-
import { useComponentSize as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
5
|
+
import { useModuleDictionary as H, useEnvironment as U, useModuleSkeleton as q } from "@m4l/core";
|
|
6
|
+
import { useIsMobile as G, useFirstRender as J } from "@m4l/graphics";
|
|
7
|
+
import { useComponentSize as Q } from "../../../hooks/useComponentSize/index.js";
|
|
8
|
+
import { useUserTimeZoneName as W } from "../hooks/useUserTimeZoneName.js";
|
|
9
|
+
import { ALL_FIELD as X } from "../constants.js";
|
|
10
|
+
import { formatToRawFilter as Y } from "../helpers/formatToRowFilter.js";
|
|
11
|
+
import { formatToInitialFilters as K } from "../helpers/formatToInitialFilters.js";
|
|
12
|
+
import { createDynamicFilterStore as ee } from "./DynamicFilterStore.js";
|
|
13
|
+
const te = B(null), de = V((g, S) => {
|
|
13
14
|
const {
|
|
14
15
|
automatic: f = !0,
|
|
15
16
|
withAllField: h = !0,
|
|
@@ -23,12 +24,12 @@ const K = H(null), fe = V((g, S) => {
|
|
|
23
24
|
storeId: R,
|
|
24
25
|
storeDevtoolsEnabled: b = !1,
|
|
25
26
|
visibleRefresh: l = !0
|
|
26
|
-
} = g, { currentSize: n } =
|
|
27
|
-
e.current || (e.current =
|
|
27
|
+
} = g, { currentSize: n } = Q(w), { getLabel: A } = H(), M = W(), e = Z(null), { host_static_assets: x, environment_assets: z } = U(), a = !G(), c = q(), I = J([a, c]);
|
|
28
|
+
e.current || (e.current = ee(
|
|
28
29
|
{
|
|
29
30
|
allField: {
|
|
30
|
-
...
|
|
31
|
-
urlIcon: `${
|
|
31
|
+
...X,
|
|
32
|
+
urlIcon: `${x}/${z}/frontend/components/dynamic_filter/assets/icons/all_fields.svg`
|
|
32
33
|
},
|
|
33
34
|
withAllField: h,
|
|
34
35
|
fields: v,
|
|
@@ -38,6 +39,7 @@ const K = H(null), fe = V((g, S) => {
|
|
|
38
39
|
size: n,
|
|
39
40
|
storeId: R,
|
|
40
41
|
visibleRefresh: l,
|
|
42
|
+
timeZoneName: M,
|
|
41
43
|
ownerState: {
|
|
42
44
|
isSkeleton: c,
|
|
43
45
|
isDirty: !1,
|
|
@@ -50,44 +52,44 @@ const K = H(null), fe = V((g, S) => {
|
|
|
50
52
|
},
|
|
51
53
|
b
|
|
52
54
|
), e.current.getState().actions.init(y));
|
|
53
|
-
const
|
|
55
|
+
const O = r(
|
|
54
56
|
e.current,
|
|
55
57
|
(t) => t.actions.fireOnChangeFilters,
|
|
56
58
|
i
|
|
57
|
-
),
|
|
59
|
+
), P = r(
|
|
58
60
|
e.current,
|
|
59
61
|
(t) => t.actions.openPopoverMenuFields,
|
|
60
62
|
i
|
|
61
|
-
),
|
|
63
|
+
), _ = r(
|
|
62
64
|
e.current,
|
|
63
65
|
(t) => t.actions.showPopoverFilterForAdd,
|
|
64
66
|
i
|
|
65
|
-
),
|
|
67
|
+
), L = (t) => {
|
|
66
68
|
try {
|
|
67
69
|
const o = e.current?.getState();
|
|
68
70
|
if (!o)
|
|
69
71
|
return;
|
|
70
|
-
const
|
|
72
|
+
const d = o.actions.getFieldByName(t), k = o.appliedFilters.some(
|
|
71
73
|
(F) => F.field.name === t && F.isSet
|
|
72
|
-
),
|
|
73
|
-
if (k && !
|
|
74
|
+
), N = d.multiple;
|
|
75
|
+
if (k && !N)
|
|
74
76
|
return;
|
|
75
|
-
|
|
77
|
+
_(d);
|
|
76
78
|
} catch (o) {
|
|
77
79
|
throw new Error(`Error al agregar el filtro externo: ${o}`);
|
|
78
80
|
}
|
|
79
|
-
},
|
|
81
|
+
}, T = r(
|
|
80
82
|
e.current,
|
|
81
83
|
(t) => () => t.appliedFilters,
|
|
82
84
|
i
|
|
83
85
|
);
|
|
84
|
-
|
|
85
|
-
fireOnChangeFilter:
|
|
86
|
-
openPopoverMenuFields:
|
|
87
|
-
addExternalFilter:
|
|
88
|
-
getCurrentFilters:
|
|
86
|
+
j(S, () => ({
|
|
87
|
+
fireOnChangeFilter: O,
|
|
88
|
+
openPopoverMenuFields: P,
|
|
89
|
+
addExternalFilter: L,
|
|
90
|
+
getCurrentFilters: T
|
|
89
91
|
}));
|
|
90
|
-
const
|
|
92
|
+
const m = r(
|
|
91
93
|
e.current,
|
|
92
94
|
(t) => t.countOnChangeFiltersApplied,
|
|
93
95
|
i
|
|
@@ -97,15 +99,15 @@ const K = H(null), fe = V((g, S) => {
|
|
|
97
99
|
i
|
|
98
100
|
);
|
|
99
101
|
return s(() => {
|
|
100
|
-
if (
|
|
102
|
+
if (m === 0)
|
|
101
103
|
return;
|
|
102
104
|
const t = e.current?.getState();
|
|
103
105
|
t && C?.(
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
K(t.appliedFilters),
|
|
107
|
+
Y(t.appliedFilters)
|
|
106
108
|
);
|
|
107
|
-
}, [
|
|
108
|
-
|
|
109
|
+
}, [m]), s(() => {
|
|
110
|
+
I || e.current?.getState().actions.setExternalState({ isMobile: !a, isSkeleton: c });
|
|
109
111
|
}, [a, c]), s(() => {
|
|
110
112
|
if (f) {
|
|
111
113
|
e.current?.getState().actions.fireOnChangeFilters();
|
|
@@ -115,9 +117,9 @@ const K = H(null), fe = V((g, S) => {
|
|
|
115
117
|
u && p && u();
|
|
116
118
|
}, [p, u]), s(() => {
|
|
117
119
|
e.current?.getState().size !== n && e.current?.getState().actions.setSize(n), e.current?.getState().visibleRefresh !== l && e.current?.getState().actions.setVisibleRefresh(l);
|
|
118
|
-
}, [n, l]), /* @__PURE__ */ $(
|
|
120
|
+
}, [n, l]), /* @__PURE__ */ $(te.Provider, { value: e.current, children: E });
|
|
119
121
|
});
|
|
120
122
|
export {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
te as DynamicFilterContext,
|
|
124
|
+
de as DynamicFilterProvider
|
|
123
125
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicFilterStore.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/DynamicFilter/store/DynamicFilterStore.ts"],"names":[],"mappings":"AAaA,OAAO,EAAsB,6BAA6B,EAAsB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAgDnH;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GAAI,WAAW,iBAAiB,EAAE,8BAA4B,
|
|
1
|
+
{"version":3,"file":"DynamicFilterStore.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/DynamicFilter/store/DynamicFilterStore.ts"],"names":[],"mappings":"AAaA,OAAO,EAAsB,6BAA6B,EAAsB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAgDnH;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GAAI,WAAW,iBAAiB,EAAE,8BAA4B,8DA4PlG,CAAC;AACF,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
|
|
@@ -73,6 +73,12 @@ export interface DynamicFilterState extends Pick<DynamicFilterProps, 'visibleRef
|
|
|
73
73
|
* Función utilizada para el dictionary
|
|
74
74
|
*/
|
|
75
75
|
getLabel: GetLabelType;
|
|
76
|
+
/**
|
|
77
|
+
* "timeZoneName" IANA time-zone name from the user preferences (e.g.
|
|
78
|
+
* "America/Bogota"). Date filters use it so the picker, the applied chip and
|
|
79
|
+
* the network query all agree on the user's clock. Undefined = local time.
|
|
80
|
+
*/
|
|
81
|
+
timeZoneName?: string;
|
|
76
82
|
}
|
|
77
83
|
export interface DynamicFilterStateWithActions extends DynamicFilterState {
|
|
78
84
|
actions: {
|
|
@@ -182,5 +188,5 @@ export interface DynamicFilterStateWithActions extends DynamicFilterState {
|
|
|
182
188
|
setVisibleRefresh: (newVisibleRefresh: boolean) => void;
|
|
183
189
|
};
|
|
184
190
|
}
|
|
185
|
-
export type InitialStoreProps = Pick<DynamicFilterState, 'automatic' | 'fields' | 'withAllField' | 'getLabel' | 'allField' | 'ownerState' | 'dataTestId' | 'size' | 'storeId' | 'visibleRefresh'>;
|
|
191
|
+
export type InitialStoreProps = Pick<DynamicFilterState, 'automatic' | 'fields' | 'withAllField' | 'getLabel' | 'allField' | 'ownerState' | 'dataTestId' | 'size' | 'storeId' | 'visibleRefresh' | 'timeZoneName'>;
|
|
186
192
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/DynamicFilter/store/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,UAAU,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ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/DynamicFilter/store/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,UAAU,EACX,MAAM,UAAU,CAAC;AAClB,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAGrC,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAKlB;AACD,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IACjE,OAAO,EAAE,KAAK,CAAC;IACf;;OAEG;IACH,KAAK,EAAE,WAAW,CAAC;CACpB;AACD,MAAM,WAAW,qBAAsB,SAAQ,qBAAqB;IAClE,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,MAAM,EAAE,kBAAkB,CAAC;IAC3B,KAAK,EAAE,WAAW,CAAC;CACpB;AACD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,GAAG,qBAAqB,CAAC;AAC7E;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,YAAY,CAAC,CAAC;AAG7E;;GAEG;AACH,MAAM,WAAW,kBACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,gBAAgB,GAAG,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,SAAS,GAAG,cAAc,GAAG,QAAQ,CAAC;IAChI;;OAEG;IACH,UAAU,EAAE,UAAU,CAAC;IACvB;;OAEG;IACH,QAAQ,EAAE,WAAW,CAAC;IAEtB;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;OAEG;IACH,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AIG;QACH,SAAS,EAAE,CAAC,SAAS,EAAE,kBAAkB,KAAK,IAAI,CAAC;QACnD;;;;WAIG;QACH,YAAY,EAAE,CAAC,YAAY,EAAE,iBAAiB,KAAK,IAAI,CAAC;QACxD;;;;WAIG;QACH,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;QAC1C;;;;WAIG;QACH,YAAY,EAAE,CAAC,YAAY,EAAE,OAAO,KAAK,IAAI,CAAC;QAC9C;;;;WAIG;QACH,gBAAgB,EAAE,CAAC,gBAAgB,EAAE,kBAAkB,KAAK,IAAI,CAAC;QACjE;;;;WAIG;QACH,qBAAqB,EAAE,MAAM,IAAI,CAAC;QAClC;;WAEG;QACH,sBAAsB,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;QAEzD;;WAEG;QACH,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC,KAAK,IAAI,CAAC;QAC5D;;WAEG;QACH,iBAAiB,EAAE,CAAC,iBAAiB,EAAE,OAAO,KAAK,IAAI,CAAC;KACzD,CAAC;CACH;AACD,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,kBAAkB,EAClB,WAAW,GAAG,QAAQ,GAAG,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,GAAG,YAAY,GAAE,MAAM,GAAG,SAAS,GAAG,gBAAgB,GAAG,cAAc,CACxJ,CAAC"}
|
|
@@ -12,15 +12,15 @@ export declare class DateTimeFilterHelpers implements IFieldType<FormFilterValue
|
|
|
12
12
|
/**
|
|
13
13
|
* getDefaultFilter devuelve un filtro por defecto para un campo de fecha y hora.
|
|
14
14
|
*/
|
|
15
|
-
getDefaultFilter(field: FilterField, fixed: boolean): FilterFieldApplied;
|
|
15
|
+
getDefaultFilter(field: FilterField, fixed: boolean, timeZoneName?: string): FilterFieldApplied;
|
|
16
16
|
/**
|
|
17
17
|
* getFormValue convierte un valor de filtro en un valor de formulario.
|
|
18
18
|
*/
|
|
19
|
-
getFormValue(field: FilterField, getLabel: GetLabelType, filterValueDateTime?: FilterValue): FormFilterValueDateTime;
|
|
19
|
+
getFormValue(field: FilterField, getLabel: GetLabelType, filterValueDateTime?: FilterValue, timeZoneName?: string): FormFilterValueDateTime;
|
|
20
20
|
/**
|
|
21
21
|
* getFilterFromFormValue convierte un valor de formulario en un valor de filtro.
|
|
22
22
|
*/
|
|
23
|
-
getFilterFromFormValue(formFilterValue: FormFilterValueDateTime): FilterValue;
|
|
23
|
+
getFilterFromFormValue(formFilterValue: FormFilterValueDateTime, timeZoneName?: string): FilterValue;
|
|
24
24
|
/**
|
|
25
25
|
* getlabels devuelve las etiquetas de un filtro de fecha y hora.
|
|
26
26
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../../../../../packages/components/src/components/DynamicFilter/subcomponents/FieldTypes/DateTimeFilter/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0D,YAAY,EAAE,MAAM,WAAW,CAAC;AACjG,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,OAAO,KAAK,EACV,mBAAmB,EAEnB,WAAW,EACX,kBAAkB,EAClB,WAAW,EAEX,uBAAuB,EAEvB,oBAAoB,EACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAqF,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC3J;;GAEG;AACH,qBAAa,qBACb,YAAW,UAAU,CAAC,uBAAuB,CAAC;IAE5C,YAAY;IAGZ;;OAEG;IACH,gBAAgB,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,kBAAkB;IAuC/F;;OAEG;IACH,YAAY,CACV,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,YAAY,EACtB,mBAAmB,CAAC,EAAE,WAAW,EACjC,YAAY,CAAC,EAAE,MAAM,GACpB,uBAAuB;IAoC1B;;OAEG;IACH,sBAAsB,CACpB,eAAe,EAAE,uBAAuB,EACxC,YAAY,CAAC,EAAE,MAAM,GACpB,WAAW;IAwBd;;OAEG;IACH,SAAS,CACP,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE,YAAY,EACtB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,WAAW,GAClB,mBAAmB;IA8BtB;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE,WAAW,GAAG,gBAAgB,CAAC,uBAAuB,CAAC;IA+BjG;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO;CAuB1E"}
|
|
@@ -1,87 +1,88 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
1
|
+
import { convertDateToUserTimeZone as d, convertDateFromUserTimeZone as l } from "@m4l/core";
|
|
2
|
+
import * as u from "yup";
|
|
3
|
+
import { DATE_TIME_OPERATORS as V } from "../../../constants.js";
|
|
4
|
+
import { DYNAMIC_FILTER_DICTIONARY_ID as c, DICCTIONARY as p } from "../../../dictionary.js";
|
|
5
|
+
import { DateTimeFilter as T } from "./index.js";
|
|
6
|
+
import { startOfDay as F, endOfDay as b, differenceInDays as I } from "date-fns";
|
|
7
|
+
import { isValidDate as m } from "../../../../../utils/isValidDate.js";
|
|
8
|
+
import { createValidationSchema as w, createValidationFullObject as x, createValidationPartialObject as $ } from "../../../../hook-form/RHFormProvider/schema.js";
|
|
9
|
+
class g {
|
|
9
10
|
getComponent() {
|
|
10
|
-
return
|
|
11
|
+
return T;
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* getDefaultFilter devuelve un filtro por defecto para un campo de fecha y hora.
|
|
14
15
|
*/
|
|
15
|
-
getDefaultFilter(e, o) {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
let
|
|
20
|
-
return
|
|
16
|
+
getDefaultFilter(e, o, a) {
|
|
17
|
+
const t = d(/* @__PURE__ */ new Date(), a), r = new Date(t), n = new Date(t);
|
|
18
|
+
r.setHours(0, 0, 0, 0), n.setHours(23, 59, 59, 999);
|
|
19
|
+
const s = e.defaultOperand1 && e.defaultOperand1 instanceof Date ? e.defaultOperand1 : l(r, a), i = e.defaultOperand2 && e.defaultOperand2 instanceof Date ? e.defaultOperand2 : l(n, a);
|
|
20
|
+
let f = !1;
|
|
21
|
+
return s !== void 0 && (f = !0), {
|
|
21
22
|
id: 0,
|
|
22
23
|
fieldType: "datetime",
|
|
23
24
|
field: e,
|
|
24
25
|
fixed: o,
|
|
25
|
-
isSet:
|
|
26
|
+
isSet: f,
|
|
26
27
|
operator: "b",
|
|
27
|
-
operand1:
|
|
28
|
-
operand2:
|
|
28
|
+
operand1: s,
|
|
29
|
+
operand2: i
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
32
33
|
* getFormValue convierte un valor de filtro en un valor de formulario.
|
|
33
34
|
*/
|
|
34
|
-
getFormValue(e, o, a) {
|
|
35
|
-
const r = a,
|
|
35
|
+
getFormValue(e, o, a, t) {
|
|
36
|
+
const r = a, n = r ? r.operator : e.defaultOperator ?? "b", s = d(/* @__PURE__ */ new Date(), t), i = F(s), f = b(s), O = e.defaultOperand1 && e.defaultOperand1 instanceof Date ? d(e.defaultOperand1, t) : i, D = e.defaultOperand2 && e.defaultOperand2 instanceof Date ? d(e.defaultOperand2, t) : f, _ = r ? d(r.operand1, t) : O, y = r && r.operator === "b" ? d(r.operand2, t) : D;
|
|
36
37
|
return {
|
|
37
38
|
fieldType: "datetime",
|
|
38
39
|
formValueOperator: {
|
|
39
|
-
id:
|
|
40
|
-
label: o(`${
|
|
40
|
+
id: n,
|
|
41
|
+
label: o(`${c}.operator_${n}`)
|
|
41
42
|
},
|
|
42
|
-
formValueOperand1:
|
|
43
|
-
formValueOperand2:
|
|
43
|
+
formValueOperand1: _,
|
|
44
|
+
formValueOperand2: y
|
|
44
45
|
};
|
|
45
46
|
}
|
|
46
47
|
/**
|
|
47
48
|
* getFilterFromFormValue convierte un valor de formulario en un valor de filtro.
|
|
48
49
|
*/
|
|
49
|
-
getFilterFromFormValue(e) {
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
const r = e.formValueOperand2;
|
|
50
|
+
getFilterFromFormValue(e, o) {
|
|
51
|
+
const a = e.formValueOperator.id, t = l(e.formValueOperand1, o);
|
|
52
|
+
if (a === "b") {
|
|
53
|
+
const r = e.formValueOperand2, n = r && l(r, o);
|
|
53
54
|
return {
|
|
54
55
|
fieldType: "datetime",
|
|
55
|
-
operator:
|
|
56
|
-
operand1:
|
|
57
|
-
operand2:
|
|
56
|
+
operator: a,
|
|
57
|
+
operand1: t,
|
|
58
|
+
operand2: n
|
|
58
59
|
};
|
|
59
60
|
} else
|
|
60
61
|
return {
|
|
61
62
|
fieldType: "datetime",
|
|
62
|
-
operator:
|
|
63
|
-
operand1:
|
|
63
|
+
operator: a,
|
|
64
|
+
operand1: t
|
|
64
65
|
};
|
|
65
66
|
}
|
|
66
67
|
/**
|
|
67
68
|
* getlabels devuelve las etiquetas de un filtro de fecha y hora.
|
|
68
69
|
*/
|
|
69
|
-
getLabels(e, o, a,
|
|
70
|
-
const { dateFormatter:
|
|
70
|
+
getLabels(e, o, a, t) {
|
|
71
|
+
const { dateFormatter: r } = a;
|
|
71
72
|
let n;
|
|
72
|
-
return e.operator === "b" ? n = e.operand1 && e.operand2 ? `${
|
|
73
|
+
return e.operator === "b" ? n = e.operand1 && e.operand2 ? `${r.formatDate(
|
|
73
74
|
e.operand1,
|
|
74
|
-
|
|
75
|
-
)} - ${
|
|
75
|
+
r.datetimeFormat
|
|
76
|
+
)} - ${r.formatDate(
|
|
76
77
|
e.operand2,
|
|
77
|
-
|
|
78
|
-
)}` : "" : n = e.operand1 ?
|
|
78
|
+
r.datetimeFormat
|
|
79
|
+
)}` : "" : n = e.operand1 ? r.formatDate(
|
|
79
80
|
e.operand1,
|
|
80
|
-
|
|
81
|
+
r.datetimeFormat
|
|
81
82
|
) : "", {
|
|
82
83
|
labelField: e.field.label ?? o(e.field.dictionaryId),
|
|
83
84
|
labelOperator: o(
|
|
84
|
-
`${
|
|
85
|
+
`${c}.operator_${e.operator}`
|
|
85
86
|
),
|
|
86
87
|
labelOperands: n
|
|
87
88
|
};
|
|
@@ -91,22 +92,22 @@ class v {
|
|
|
91
92
|
*/
|
|
92
93
|
getSchema(e, o) {
|
|
93
94
|
const a = o?.maxDays;
|
|
94
|
-
return
|
|
95
|
-
formValueOperator:
|
|
96
|
-
formValueOperand1:
|
|
97
|
-
formValueOperand2:
|
|
95
|
+
return w(x($({
|
|
96
|
+
formValueOperator: u.object().nullable().required(e(p.error_operator_required)),
|
|
97
|
+
formValueOperand1: u.date().required(e(p.error_invalid_date)).typeError(e(p.error_invalid_date)),
|
|
98
|
+
formValueOperand2: u.mixed().when(["formValueOperator.id"], {
|
|
98
99
|
is: "b",
|
|
99
|
-
then:
|
|
100
|
-
|
|
101
|
-
e(
|
|
100
|
+
then: u.date().typeError(e(p.error_invalid_date)).min(
|
|
101
|
+
u.ref("formValueOperand1"),
|
|
102
|
+
e(p.error_invalid_date)
|
|
102
103
|
).test(
|
|
103
104
|
"max-days",
|
|
104
|
-
`${e(
|
|
105
|
-
function(
|
|
106
|
-
if (!a || !
|
|
105
|
+
`${e(p.error_max_days_exceeded)} (Máx. ${a})`,
|
|
106
|
+
function(t) {
|
|
107
|
+
if (!a || !t)
|
|
107
108
|
return !0;
|
|
108
|
-
const
|
|
109
|
-
return
|
|
109
|
+
const r = this.parent.formValueOperand1;
|
|
110
|
+
return r ? I(t, r) <= a : !0;
|
|
110
111
|
}
|
|
111
112
|
)
|
|
112
113
|
})
|
|
@@ -116,9 +117,9 @@ class v {
|
|
|
116
117
|
* verifyFilter verifica si un filtro de fecha y hora es válido.
|
|
117
118
|
*/
|
|
118
119
|
verifyFilter(e, o) {
|
|
119
|
-
return !(typeof e.operator != "string" ||
|
|
120
|
+
return !(typeof e.operator != "string" || V.findIndex((a) => a === e.operator) === -1 || typeof e.operand1 != "string" || !m(new Date(e.operand1)) || e.operator === "b" && (typeof e.operand2 != "string" || !m(new Date(e.operand1))));
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
export {
|
|
123
|
-
|
|
124
|
+
g as DateTimeFilterHelpers
|
|
124
125
|
};
|
|
@@ -10,11 +10,23 @@ export interface IFieldType<T extends RHFormValues> {
|
|
|
10
10
|
getComponent(): FC<{
|
|
11
11
|
[key: string]: any;
|
|
12
12
|
}>;
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* `timeZoneName` (optional) lets date-based field types build their default
|
|
15
|
+
* operands in the user-preference time zone. Non-date field types ignore it.
|
|
16
|
+
*/
|
|
17
|
+
getDefaultFilter(field: FilterField, fixed: boolean, timeZoneName?: string): FilterFieldApplied;
|
|
14
18
|
getLabels(filter: FilterFieldApplied, getLabel: GetLabelType, formatters: Formatters, field: FilterField): DataTypeFilerLabels;
|
|
15
19
|
getSchema(getLabel: GetLabelType, field?: FilterField): ValidationSchema<T>;
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
/**
|
|
21
|
+
* `timeZoneName` (optional) lets date-based field types convert stored
|
|
22
|
+
* instants into the wall-clock the picker shows. Non-date field types ignore it.
|
|
23
|
+
*/
|
|
24
|
+
getFormValue(field: FilterField, getLabel: GetLabelType, filterValue?: FilterValue, timeZoneName?: string): T;
|
|
25
|
+
/**
|
|
26
|
+
* `timeZoneName` (optional) lets date-based field types convert the picker
|
|
27
|
+
* wall-clock back into the stored instant. Non-date field types ignore it.
|
|
28
|
+
*/
|
|
29
|
+
getFilterFromFormValue(formFilterValue: T, timeZoneName?: string): FilterValue;
|
|
18
30
|
verifyFilter(filter: InitialFilterApplied, field?: FilterField): boolean;
|
|
19
31
|
}
|
|
20
32
|
//# sourceMappingURL=FieldTypeInterface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldTypeInterface.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicFilter/subcomponents/FieldTypes/FieldTypeInterface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,OAAO,KAAK,EACV,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAEzF;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,YAAY;IAChD,YAAY,IAAI,EAAE,CAAC;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC,CAAC;IAC3C,gBAAgB,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"FieldTypeInterface.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicFilter/subcomponents/FieldTypes/FieldTypeInterface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM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contiene el input
|
|
4
4
|
* "Filtrar por" y el listado de campos disponibles.
|
|
5
5
|
*/
|
|
6
|
-
declare const InputFilter: () => import("@emotion/react/jsx-runtime").JSX.Element
|
|
6
|
+
declare const InputFilter: () => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
7
7
|
export default InputFilter;
|
|
8
8
|
//# sourceMappingURL=InputFilter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputFilter.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicFilter/subcomponents/InputFilter/InputFilter.tsx"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,QAAA,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"InputFilter.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/DynamicFilter/subcomponents/InputFilter/InputFilter.tsx"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,QAAA,MAAM,WAAW,wDA8ChB,CAAC;AACF,eAAe,WAAW,CAAC"}
|