@veeqo/transfigure 0.0.3 → 0.0.4
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/dist/BusinessLogic/types.d.ts +2 -0
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +1 -1
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +1 -1
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +1 -1
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +1 -1
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +1 -1
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +1 -1
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +1 -1
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +1 -1
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +230 -230
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +28 -23
- package/dist/index76.cjs +19 -1
- package/dist/index76.js +23 -28
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +1 -1
- package/dist/index78.cjs +11 -18
- package/dist/index78.js +12 -20
- package/dist/index79.cjs +80 -1
- package/dist/index79.js +95 -22
- package/dist/index80.cjs +1 -80
- package/dist/index80.js +22 -95
- package/dist/index81.cjs +1 -12
- package/dist/index81.js +24 -16
- package/dist/index83.cjs +13 -1
- package/dist/index83.js +14 -33
- package/dist/index84.cjs +80 -1
- package/dist/index84.js +94 -62
- package/dist/index85.cjs +1 -13
- package/dist/index85.js +33 -14
- package/dist/index86.cjs +1 -80
- package/dist/index86.js +62 -94
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +21 -19
- package/package.json +1 -1
package/dist/index60.js
CHANGED
|
@@ -1,318 +1,318 @@
|
|
|
1
|
-
var
|
|
2
|
-
var C = (
|
|
3
|
-
var
|
|
4
|
-
import { makeObservable as
|
|
5
|
-
import { DateRanges as
|
|
6
|
-
import { parseDate as
|
|
7
|
-
import
|
|
8
|
-
import { FilterChoiceValue as
|
|
9
|
-
import { RangeFilter as
|
|
10
|
-
import { NumberRangeFilter as
|
|
11
|
-
import { ALL_VIEW_ID as
|
|
12
|
-
import { isValidDateRange as
|
|
13
|
-
import { BusinessLogicManager as
|
|
14
|
-
class
|
|
1
|
+
var L = Object.defineProperty;
|
|
2
|
+
var C = (E, e, l) => e in E ? L(E, e, { enumerable: !0, configurable: !0, writable: !0, value: l }) : E[e] = l;
|
|
3
|
+
var f = (E, e, l) => C(E, typeof e != "symbol" ? e + "" : e, l);
|
|
4
|
+
import { makeObservable as G, computed as T, action as g, observable as u } from "mobx";
|
|
5
|
+
import { DateRanges as v } from "@veeqo/ui";
|
|
6
|
+
import { parseDate as N } from "@internationalized/date";
|
|
7
|
+
import U from "lodash/isEqual";
|
|
8
|
+
import { FilterChoiceValue as m } from "./index44.js";
|
|
9
|
+
import { RangeFilter as w } from "./index62.js";
|
|
10
|
+
import { NumberRangeFilter as P } from "./index61.js";
|
|
11
|
+
import { ALL_VIEW_ID as O } from "./index70.js";
|
|
12
|
+
import { isValidDateRange as V } from "./index68.js";
|
|
13
|
+
import { BusinessLogicManager as y } from "./index8.js";
|
|
14
|
+
class W {
|
|
15
15
|
constructor() {
|
|
16
16
|
// PAGINATION
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
f(this, "defaultPageSize");
|
|
18
|
+
f(this, "pageSize");
|
|
19
|
+
f(this, "currentPage");
|
|
20
20
|
// DEFAULT FILTERS
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
f(this, "defaultFilters");
|
|
22
|
+
f(this, "defaultArrayFilters");
|
|
23
|
+
f(this, "defaultDateRangeFilters");
|
|
24
|
+
f(this, "defaultNumberRangeFilters");
|
|
25
25
|
// CURRENT FILTERS
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
f(this, "filters");
|
|
27
|
+
f(this, "arrayFilters");
|
|
28
|
+
f(this, "dateRangeFilters");
|
|
29
|
+
f(this, "numberRangeFilters");
|
|
30
30
|
// VIEWS
|
|
31
|
-
|
|
31
|
+
f(this, "activeViewId");
|
|
32
32
|
// VISIBILITY STATE
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
f(this, "isFiltersDropdownVisible");
|
|
34
|
+
f(this, "initDefaultFilterMaps", () => {
|
|
35
35
|
this.defaultFilters = new Map(this.filters), this.defaultArrayFilters = new Map(this.arrayFilters), this.defaultDateRangeFilters = new Map(this.dateRangeFilters), this.defaultNumberRangeFilters = new Map(this.numberRangeFilters);
|
|
36
36
|
});
|
|
37
|
-
|
|
37
|
+
f(this, "updateUrl", (e = !1) => {
|
|
38
38
|
try {
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
} catch (
|
|
42
|
-
console.log(
|
|
39
|
+
const l = `${window.location.pathname}?${this.queryParams}`;
|
|
40
|
+
e ? window.history.pushState({}, "", l) : window.history.replaceState({}, "", l);
|
|
41
|
+
} catch (l) {
|
|
42
|
+
console.log(l);
|
|
43
43
|
}
|
|
44
44
|
});
|
|
45
45
|
// PAGINATION
|
|
46
|
-
|
|
47
|
-
this.currentPage =
|
|
46
|
+
f(this, "setCurrentPage", (e) => {
|
|
47
|
+
this.currentPage = e;
|
|
48
48
|
});
|
|
49
|
-
|
|
50
|
-
this.pageSize =
|
|
49
|
+
f(this, "setPageSize", (e) => {
|
|
50
|
+
this.pageSize = e;
|
|
51
51
|
});
|
|
52
52
|
// TEXT FILTERS
|
|
53
|
-
|
|
54
|
-
this.filters.set(
|
|
53
|
+
f(this, "setFilter", (e, l) => {
|
|
54
|
+
this.filters.set(e, l), this.updateUrl();
|
|
55
55
|
});
|
|
56
|
-
|
|
57
|
-
this.filters.set(
|
|
56
|
+
f(this, "clearFilter", (e) => {
|
|
57
|
+
this.filters.set(e, ""), this.updateUrl();
|
|
58
58
|
});
|
|
59
59
|
// ARRAY FILTERS
|
|
60
|
-
|
|
61
|
-
this.arrayFilters.set(
|
|
60
|
+
f(this, "setArrayFilter", (e, l) => {
|
|
61
|
+
this.arrayFilters.set(e, l), this.updateUrl();
|
|
62
62
|
});
|
|
63
|
-
|
|
64
|
-
this.arrayFilters.set(
|
|
63
|
+
f(this, "clearArrayFilter", (e) => {
|
|
64
|
+
this.arrayFilters.set(e, []), this.updateUrl();
|
|
65
65
|
});
|
|
66
66
|
// RANGE FILTERS
|
|
67
|
-
|
|
68
|
-
key:
|
|
69
|
-
range:
|
|
70
|
-
dates:
|
|
67
|
+
f(this, "setRangeFilter", ({
|
|
68
|
+
key: e,
|
|
69
|
+
range: l,
|
|
70
|
+
dates: r
|
|
71
71
|
}) => {
|
|
72
|
-
|
|
72
|
+
l.setFilterType(e), l.setDates(r.start, r.end), this.updateUrl();
|
|
73
73
|
});
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
|
|
74
|
+
f(this, "clearRangeFilter", (e) => {
|
|
75
|
+
const l = this.dateRangeFilters.get(e);
|
|
76
|
+
l && (l.clear(), this.updateUrl());
|
|
77
77
|
});
|
|
78
78
|
// NUMBER RANGE FILTERS
|
|
79
|
-
|
|
80
|
-
numberRange:
|
|
81
|
-
gte:
|
|
82
|
-
lte:
|
|
79
|
+
f(this, "setNumberRangeFilter", ({
|
|
80
|
+
numberRange: e,
|
|
81
|
+
gte: l,
|
|
82
|
+
lte: r
|
|
83
83
|
}) => {
|
|
84
|
-
|
|
84
|
+
e.setGte(l), e.setLte(r), this.updateUrl();
|
|
85
85
|
});
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
86
|
+
f(this, "clearNumberRangeFilter", (e) => {
|
|
87
|
+
const l = this.numberRangeFilters.get(e);
|
|
88
|
+
l && (l.clear(), this.updateUrl());
|
|
89
89
|
});
|
|
90
90
|
// CLEARING ALL FILTERS
|
|
91
|
-
|
|
92
|
-
const { SEARCH_FILTER_ID:
|
|
93
|
-
this.filters.forEach((
|
|
94
|
-
|
|
95
|
-
}), this.arrayFilters.forEach((
|
|
91
|
+
f(this, "clearAllFilters", (e = !1) => {
|
|
92
|
+
const { SEARCH_FILTER_ID: l } = y.getBusinessLogic();
|
|
93
|
+
this.filters.forEach((r, t) => {
|
|
94
|
+
t !== l && this.filters.set(t, "");
|
|
95
|
+
}), this.arrayFilters.forEach((r, t) => this.arrayFilters.set(t, [])), this.dateRangeFilters.forEach((r) => r.clear()), this.numberRangeFilters.forEach((r) => r.clear()), e || this.updateUrl();
|
|
96
96
|
});
|
|
97
|
-
|
|
98
|
-
const { GROUP_MAP:
|
|
99
|
-
|
|
100
|
-
this.arrayFilters.has(
|
|
97
|
+
f(this, "clearFiltersForGroup", (e) => {
|
|
98
|
+
const { GROUP_MAP: l } = y.getBusinessLogic(), r = l.get(e);
|
|
99
|
+
r && r.fields.forEach((t) => {
|
|
100
|
+
this.arrayFilters.has(t.id) ? this.clearArrayFilter(t.id) : this.dateRangeFilters.has(t.id) ? this.clearRangeFilter(t.id) : this.numberRangeFilters.has(t.id) ? this.clearNumberRangeFilter(t.id) : this.clearFilter(t.id);
|
|
101
101
|
});
|
|
102
102
|
});
|
|
103
103
|
// VIEWS
|
|
104
|
-
|
|
105
|
-
this.activeViewId =
|
|
104
|
+
f(this, "setActiveViewId", (e) => {
|
|
105
|
+
this.activeViewId = e, this.updateUrl();
|
|
106
106
|
});
|
|
107
107
|
// VISIBILITY
|
|
108
|
-
|
|
109
|
-
this.isFiltersDropdownVisible =
|
|
108
|
+
f(this, "toggleFiltersDropdownVisible", (e) => {
|
|
109
|
+
this.isFiltersDropdownVisible = e;
|
|
110
110
|
});
|
|
111
111
|
// FILTER GROUPS
|
|
112
|
-
|
|
113
|
-
const { GROUP_MAP:
|
|
114
|
-
if (!
|
|
115
|
-
const
|
|
116
|
-
return
|
|
117
|
-
this.arrayFilters.has(
|
|
118
|
-
}),
|
|
112
|
+
f(this, "getFiltersForGroup", (e) => {
|
|
113
|
+
const { GROUP_MAP: l } = y.getBusinessLogic(), r = l.get(e);
|
|
114
|
+
if (!r) return {};
|
|
115
|
+
const t = {};
|
|
116
|
+
return r.fields.forEach((a) => {
|
|
117
|
+
this.arrayFilters.has(a.id) ? t[a.id] = this.arrayFilters.get(a.id) : this.dateRangeFilters.has(a.id) ? t[a.id] = this.dateRangeFilters.get(a.id) : this.numberRangeFilters.has(a.id) ? t[a.id] = this.numberRangeFilters.get(a.id) : t[a.id] = this.filters.get(a.id);
|
|
118
|
+
}), t;
|
|
119
119
|
});
|
|
120
|
-
|
|
121
|
-
var
|
|
122
|
-
const { PAGE_SIZE_OPTIONS:
|
|
123
|
-
(
|
|
124
|
-
Array.from(
|
|
125
|
-
const
|
|
126
|
-
return
|
|
120
|
+
f(this, "initFiltersFromView", (e) => {
|
|
121
|
+
var r;
|
|
122
|
+
const { PAGE_SIZE_OPTIONS: l } = y.getBusinessLogic();
|
|
123
|
+
(r = e.page) != null && r.size && l.includes(e.page.size) && (this.defaultPageSize = e.page.size, this.pageSize = e.page.size), this.defaultFilters = new Map(e.filterMaps.filters), this.defaultArrayFilters = new Map(e.filterMaps.arrayFilters), this.defaultDateRangeFilters = new Map(
|
|
124
|
+
Array.from(e.filterMaps.rangeFilters.entries()).map(([t, a]) => {
|
|
125
|
+
const n = new w(a.filterType);
|
|
126
|
+
return a.gte && a.lte && n.setDates(a.gte, a.lte), [t, n];
|
|
127
127
|
})
|
|
128
128
|
), this.defaultNumberRangeFilters = new Map(
|
|
129
|
-
Array.from(
|
|
130
|
-
const
|
|
131
|
-
return
|
|
129
|
+
Array.from(e.filterMaps.numberRangeFilters.entries()).map(([t, a]) => {
|
|
130
|
+
const n = a.clone();
|
|
131
|
+
return a.gte && n.setGte(a.gte), a.lte && n.setLte(a.lte), [t, n];
|
|
132
132
|
})
|
|
133
|
-
), this.filters = new Map(
|
|
134
|
-
Array.from(
|
|
135
|
-
const
|
|
136
|
-
return
|
|
133
|
+
), this.filters = new Map(e.filterMaps.filters), this.arrayFilters = new Map(e.filterMaps.arrayFilters), this.dateRangeFilters = new Map(
|
|
134
|
+
Array.from(e.filterMaps.rangeFilters.entries()).map(([t, a]) => {
|
|
135
|
+
const n = new w(a.filterType);
|
|
136
|
+
return a.gte && a.lte && n.setDates(a.gte, a.lte), [t, n];
|
|
137
137
|
})
|
|
138
138
|
), this.numberRangeFilters = new Map(
|
|
139
|
-
Array.from(
|
|
140
|
-
const
|
|
141
|
-
return
|
|
139
|
+
Array.from(e.filterMaps.numberRangeFilters.entries()).map(([t, a]) => {
|
|
140
|
+
const n = a.clone();
|
|
141
|
+
return a.gte && n.setGte(a.gte), a.lte && n.setLte(a.lte), [t, n];
|
|
142
142
|
})
|
|
143
|
-
), this.activeViewId =
|
|
143
|
+
), this.activeViewId = e.id;
|
|
144
144
|
});
|
|
145
|
-
|
|
146
|
-
const { GROUP_MAP:
|
|
147
|
-
Array.from(
|
|
148
|
-
(
|
|
149
|
-
}), Array.from(
|
|
150
|
-
if (
|
|
145
|
+
f(this, "initFromUrl", (e = !0) => {
|
|
146
|
+
const { GROUP_MAP: l, NUMBER_RANGE_FILTERS: r, PAGE_SIZE_OPTIONS: t, PAGE_SIZE_FILTER_ID: a } = y.getBusinessLogic(), n = new URLSearchParams(window.location.search), h = Array.from(l.values()).flatMap((i) => i.fields), F = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
147
|
+
Array.from(n.entries()).forEach(([i, s]) => {
|
|
148
|
+
(i.includes("_gte") || i.includes("_lte")) && o.set(i, s);
|
|
149
|
+
}), Array.from(n.entries()).forEach(([i, s]) => {
|
|
150
|
+
if (i === "view" && e) {
|
|
151
151
|
this.activeViewId = s;
|
|
152
152
|
return;
|
|
153
153
|
}
|
|
154
|
-
if (
|
|
154
|
+
if (i === a && t.includes(Number(s))) {
|
|
155
155
|
this.pageSize = Number(s);
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
|
-
let
|
|
159
|
-
if (!
|
|
160
|
-
const
|
|
161
|
-
|
|
158
|
+
let p = h.find((d) => d.id === i);
|
|
159
|
+
if (!p) {
|
|
160
|
+
const d = i.replace(/_[gl]te$/, "");
|
|
161
|
+
r.includes(d) && (p = h.find((c) => c.id === d));
|
|
162
162
|
}
|
|
163
|
-
if (
|
|
164
|
-
switch (
|
|
165
|
-
case
|
|
166
|
-
s &&
|
|
163
|
+
if (p)
|
|
164
|
+
switch (p.filterType) {
|
|
165
|
+
case m.CHECKBOX:
|
|
166
|
+
s && R.set(i, s.split(","));
|
|
167
167
|
break;
|
|
168
|
-
case
|
|
169
|
-
let
|
|
168
|
+
case m.DATE_RANGE:
|
|
169
|
+
let d;
|
|
170
170
|
if (s === "CUSTOM") {
|
|
171
|
-
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
} else
|
|
175
|
-
|
|
171
|
+
d = new w("CUSTOM");
|
|
172
|
+
const I = o.get(`${i}_gte`), D = o.get(`${i}_lte`);
|
|
173
|
+
I && D && d.setDates(N(I), N(D));
|
|
174
|
+
} else V(s) ? d = new w(s) : d = new w(v.TODAY);
|
|
175
|
+
M.set(i, d);
|
|
176
176
|
break;
|
|
177
|
-
case
|
|
178
|
-
const
|
|
179
|
-
|
|
177
|
+
case m.NUMBER_RANGE:
|
|
178
|
+
const c = new P({ filterId: p.id }), A = i.replace(/_[gl]te$/, ""), b = o.get(`${A}_gte`), _ = o.get(`${A}_lte`);
|
|
179
|
+
b && c.setGte(Number(b)), _ && c.setLte(Number(_)), S.set(A, c);
|
|
180
180
|
break;
|
|
181
|
-
case
|
|
182
|
-
case
|
|
183
|
-
case
|
|
184
|
-
|
|
181
|
+
case m.TEXT:
|
|
182
|
+
case m.NUMBER:
|
|
183
|
+
case m.RADIO:
|
|
184
|
+
F.set(i, s);
|
|
185
185
|
break;
|
|
186
186
|
}
|
|
187
|
-
}), this.filters =
|
|
187
|
+
}), this.filters = F, this.arrayFilters = R, this.dateRangeFilters = M, this.numberRangeFilters = S, this.updateUrl();
|
|
188
188
|
});
|
|
189
|
-
|
|
189
|
+
f(this, "discardChanges", (e = !1) => {
|
|
190
190
|
this.pageSize = this.defaultPageSize;
|
|
191
|
-
const { SEARCH_FILTER_ID:
|
|
192
|
-
this.filters.has(
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
}), this.numberRangeFilters.clear(), this.defaultNumberRangeFilters.forEach((
|
|
196
|
-
this.numberRangeFilters.set(
|
|
197
|
-
}), this.updateUrl(
|
|
191
|
+
const { SEARCH_FILTER_ID: l } = y.getBusinessLogic(), r = new Map(this.defaultFilters);
|
|
192
|
+
this.filters.has(l) && r.set(l, this.filters.get(l)), this.filters = r, this.arrayFilters = new Map(this.defaultArrayFilters), this.dateRangeFilters.clear(), this.defaultDateRangeFilters.forEach((t, a) => {
|
|
193
|
+
const n = new w(t.filterType);
|
|
194
|
+
n.setDates(t.gte, t.lte), this.dateRangeFilters.set(a, n);
|
|
195
|
+
}), this.numberRangeFilters.clear(), this.defaultNumberRangeFilters.forEach((t, a) => {
|
|
196
|
+
this.numberRangeFilters.set(a, t.clone());
|
|
197
|
+
}), this.updateUrl(e);
|
|
198
198
|
});
|
|
199
|
-
const { GROUP_MAP:
|
|
199
|
+
const { GROUP_MAP: e } = y.getBusinessLogic(), l = Array.from(e.values()).flatMap((r) => r.fields);
|
|
200
200
|
this.filters = new Map(
|
|
201
|
-
|
|
202
|
-
(
|
|
203
|
-
).map((
|
|
201
|
+
l.filter(
|
|
202
|
+
(r) => r.filterType === m.TEXT || r.filterType === m.NUMBER || r.filterType === m.RADIO || r.filterType === m.DATE_RANGE
|
|
203
|
+
).map((r) => [r.id, ""])
|
|
204
204
|
), this.arrayFilters = new Map(
|
|
205
|
-
|
|
205
|
+
l.filter((r) => r.filterType === m.CHECKBOX).map((r) => [r.id, []])
|
|
206
206
|
), this.dateRangeFilters = new Map(
|
|
207
|
-
|
|
207
|
+
l.filter((r) => r.filterType === m.DATE_RANGE).map((r) => [r.id, new w()])
|
|
208
208
|
), this.numberRangeFilters = new Map(
|
|
209
|
-
|
|
210
|
-
const
|
|
211
|
-
return [
|
|
209
|
+
l.filter((r) => r.filterType === m.NUMBER_RANGE).map((r) => {
|
|
210
|
+
const t = new P({ filterId: r.id });
|
|
211
|
+
return [r.id, t];
|
|
212
212
|
})
|
|
213
|
-
), this.defaultArrayFilters = /* @__PURE__ */ new Map(), this.defaultFilters = /* @__PURE__ */ new Map(), this.defaultDateRangeFilters = /* @__PURE__ */ new Map(), this.defaultNumberRangeFilters = /* @__PURE__ */ new Map(), this.currentPage = 1, this.pageSize = 10, this.defaultPageSize = 10, this.initDefaultFilterMaps(), this.isFiltersDropdownVisible = !1, this.activeViewId = void 0,
|
|
214
|
-
defaultPageSize:
|
|
215
|
-
pageSize:
|
|
216
|
-
currentPage:
|
|
217
|
-
defaultFilters:
|
|
218
|
-
defaultArrayFilters:
|
|
219
|
-
defaultDateRangeFilters:
|
|
220
|
-
defaultNumberRangeFilters:
|
|
221
|
-
filters:
|
|
222
|
-
arrayFilters:
|
|
223
|
-
numberRangeFilters:
|
|
224
|
-
dateRangeFilters:
|
|
225
|
-
isFiltersDropdownVisible:
|
|
226
|
-
activeViewId:
|
|
227
|
-
setPageSize:
|
|
228
|
-
setCurrentPage:
|
|
229
|
-
toggleFiltersDropdownVisible:
|
|
230
|
-
setActiveViewId:
|
|
231
|
-
setFilter:
|
|
232
|
-
setArrayFilter:
|
|
233
|
-
setRangeFilter:
|
|
234
|
-
setNumberRangeFilter:
|
|
235
|
-
clearFilter:
|
|
236
|
-
clearArrayFilter:
|
|
237
|
-
clearRangeFilter:
|
|
238
|
-
clearNumberRangeFilter:
|
|
239
|
-
clearAllFilters:
|
|
240
|
-
getFiltersForGroup:
|
|
241
|
-
clearFiltersForGroup:
|
|
242
|
-
initFromUrl:
|
|
243
|
-
initFiltersFromView:
|
|
244
|
-
initDefaultFilterMaps:
|
|
245
|
-
discardChanges:
|
|
246
|
-
updateUrl:
|
|
247
|
-
hasActiveFilters:
|
|
248
|
-
activeFilterKeysList:
|
|
249
|
-
queryParams:
|
|
250
|
-
hasUnsavedChanges:
|
|
213
|
+
), this.defaultArrayFilters = /* @__PURE__ */ new Map(), this.defaultFilters = /* @__PURE__ */ new Map(), this.defaultDateRangeFilters = /* @__PURE__ */ new Map(), this.defaultNumberRangeFilters = /* @__PURE__ */ new Map(), this.currentPage = 1, this.pageSize = 10, this.defaultPageSize = 10, this.initDefaultFilterMaps(), this.isFiltersDropdownVisible = !1, this.activeViewId = void 0, G(this, {
|
|
214
|
+
defaultPageSize: u,
|
|
215
|
+
pageSize: u,
|
|
216
|
+
currentPage: u,
|
|
217
|
+
defaultFilters: u,
|
|
218
|
+
defaultArrayFilters: u,
|
|
219
|
+
defaultDateRangeFilters: u,
|
|
220
|
+
defaultNumberRangeFilters: u,
|
|
221
|
+
filters: u,
|
|
222
|
+
arrayFilters: u,
|
|
223
|
+
numberRangeFilters: u,
|
|
224
|
+
dateRangeFilters: u,
|
|
225
|
+
isFiltersDropdownVisible: u,
|
|
226
|
+
activeViewId: u,
|
|
227
|
+
setPageSize: g,
|
|
228
|
+
setCurrentPage: g,
|
|
229
|
+
toggleFiltersDropdownVisible: g,
|
|
230
|
+
setActiveViewId: g,
|
|
231
|
+
setFilter: g,
|
|
232
|
+
setArrayFilter: g,
|
|
233
|
+
setRangeFilter: g,
|
|
234
|
+
setNumberRangeFilter: g,
|
|
235
|
+
clearFilter: g,
|
|
236
|
+
clearArrayFilter: g,
|
|
237
|
+
clearRangeFilter: g,
|
|
238
|
+
clearNumberRangeFilter: g,
|
|
239
|
+
clearAllFilters: g,
|
|
240
|
+
getFiltersForGroup: g,
|
|
241
|
+
clearFiltersForGroup: g,
|
|
242
|
+
initFromUrl: g,
|
|
243
|
+
initFiltersFromView: g,
|
|
244
|
+
initDefaultFilterMaps: g,
|
|
245
|
+
discardChanges: g,
|
|
246
|
+
updateUrl: g,
|
|
247
|
+
hasActiveFilters: T,
|
|
248
|
+
activeFilterKeysList: T,
|
|
249
|
+
queryParams: T,
|
|
250
|
+
hasUnsavedChanges: T
|
|
251
251
|
});
|
|
252
252
|
}
|
|
253
253
|
get hasActiveFilters() {
|
|
254
|
-
const { GROUP_MAP:
|
|
255
|
-
return Array.from(this.filters.entries()).filter(([
|
|
254
|
+
const { GROUP_MAP: e } = y.getBusinessLogic(), l = Array.from(e.values()).flatMap((t) => t.fields), r = new Set(l.map((t) => t.id));
|
|
255
|
+
return Array.from(this.filters.entries()).filter(([t]) => r.has(t)).some(([, t]) => t !== "") || Array.from(this.arrayFilters.entries()).filter(([t]) => r.has(t)).some(([, t]) => t.length > 0) || Array.from(this.dateRangeFilters.entries()).filter(([t]) => r.has(t)).some(([, t]) => t.filterType !== void 0) || Array.from(this.numberRangeFilters.entries()).filter(([t]) => r.has(t)).some(([, t]) => t.isActive);
|
|
256
256
|
}
|
|
257
257
|
get activeFilterKeysList() {
|
|
258
|
-
const { DATE_RANGE_FILTERS:
|
|
259
|
-
([
|
|
260
|
-
).map(([
|
|
261
|
-
return [.../* @__PURE__ */ new Set([...
|
|
258
|
+
const { DATE_RANGE_FILTERS: e, NUMBER_RANGE_FILTERS: l } = y.getBusinessLogic(), r = Array.from(this.filters.entries()).filter(
|
|
259
|
+
([F, R]) => R !== "" && !e.includes(F) && !l.includes(F)
|
|
260
|
+
).map(([F]) => F), t = Array.from(this.arrayFilters.entries()).filter(([, F]) => F.length > 0).map(([F]) => F), a = Array.from(this.dateRangeFilters.entries()).filter(([, F]) => F.filterType !== void 0).map(([F]) => F), n = Array.from(this.numberRangeFilters.entries()).filter(([, F]) => F.isActive).map(([F]) => F);
|
|
261
|
+
return [.../* @__PURE__ */ new Set([...r, ...t, ...a, ...n])];
|
|
262
262
|
}
|
|
263
263
|
get queryParams() {
|
|
264
|
-
const { DATE_RANGE_FILTERS:
|
|
264
|
+
const { DATE_RANGE_FILTERS: e, NUMBER_RANGE_FILTERS: l, PAGE_SIZE_FILTER_ID: r, PAGE_NUMBER_FILTER_ID: t } = y.getBusinessLogic(), a = new URLSearchParams();
|
|
265
265
|
return Array.from(this.filters.entries()).filter(
|
|
266
|
-
([
|
|
267
|
-
).forEach(([
|
|
268
|
-
|
|
269
|
-
}), Array.from(this.arrayFilters.entries()).filter(([,
|
|
270
|
-
|
|
271
|
-
}), Array.from(this.dateRangeFilters.entries()).filter(([,
|
|
272
|
-
|
|
273
|
-
}), Array.from(this.numberRangeFilters.entries()).filter(([,
|
|
274
|
-
|
|
275
|
-
}), this.activeViewId &&
|
|
266
|
+
([n, h]) => h !== "" && !e.includes(n) && !l.includes(n)
|
|
267
|
+
).forEach(([n, h]) => {
|
|
268
|
+
a.append(n, h);
|
|
269
|
+
}), Array.from(this.arrayFilters.entries()).filter(([, n]) => n.length > 0).forEach(([n, h]) => {
|
|
270
|
+
a.append(n, h.join(","));
|
|
271
|
+
}), Array.from(this.dateRangeFilters.entries()).filter(([, n]) => n.filterType !== void 0).forEach(([n, h]) => {
|
|
272
|
+
a.set(n, h.filterType), h.filterType === "CUSTOM" && (a.set(`${n}_gte`, h.gte.toString()), a.set(`${n}_lte`, h.lte.toString()));
|
|
273
|
+
}), Array.from(this.numberRangeFilters.entries()).filter(([, n]) => n.isActive).forEach(([n, h]) => {
|
|
274
|
+
h.gte !== void 0 && a.set(`${n}_gte`, h.gte.toString()), h.isValidLte && a.set(`${n}_lte`, h.lte.toString());
|
|
275
|
+
}), this.activeViewId && a.set("view", this.activeViewId), a.set(r, this.pageSize.toString()), a.set(t, this.currentPage.toString()), a.toString();
|
|
276
276
|
}
|
|
277
277
|
get hasUnsavedChanges() {
|
|
278
|
-
if (this.activeViewId ===
|
|
278
|
+
if (this.activeViewId === O) return !1;
|
|
279
279
|
if (this.defaultPageSize !== this.pageSize) return !0;
|
|
280
|
-
const { GROUP_MAP:
|
|
281
|
-
if (Array.from(this.filters.entries()).filter(([
|
|
282
|
-
const
|
|
283
|
-
return
|
|
280
|
+
const { GROUP_MAP: e, SEARCH_FILTER_ID: l } = y.getBusinessLogic(), r = Array.from(e.values()).flatMap((o) => o.fields), t = new Set(r.map((o) => o.id));
|
|
281
|
+
if (Array.from(this.filters.entries()).filter(([o]) => o !== l && t.has(o)).some(([o, i]) => {
|
|
282
|
+
const s = this.defaultFilters.get(o);
|
|
283
|
+
return s === void 0 && i !== "" || s !== void 0 && i !== s;
|
|
284
284
|
}))
|
|
285
285
|
return !0;
|
|
286
|
-
const
|
|
287
|
-
const
|
|
288
|
-
return
|
|
289
|
-
}),
|
|
290
|
-
const
|
|
291
|
-
return
|
|
286
|
+
const n = Array.from(this.defaultArrayFilters.entries()).filter(([o]) => t.has(o)).some(([o, i]) => {
|
|
287
|
+
const s = this.defaultArrayFilters.get(o) || [];
|
|
288
|
+
return i.length > 0 || s.length > 0 ? i.length !== s.length || !U(i, s) : !1;
|
|
289
|
+
}), h = Array.from(this.arrayFilters.entries()).filter(([o]) => t.has(o)).some(([o, i]) => {
|
|
290
|
+
const s = this.defaultArrayFilters.get(o) || [];
|
|
291
|
+
return i.length > 0 || s.length > 0 ? i.length !== s.length || !U(i, s) : !1;
|
|
292
292
|
});
|
|
293
|
-
if (
|
|
293
|
+
if (n || h)
|
|
294
294
|
return !0;
|
|
295
|
-
const
|
|
296
|
-
const
|
|
297
|
-
return !
|
|
295
|
+
const F = Array.from(this.numberRangeFilters.entries()).filter(([o]) => t.has(o)).some(([o, i]) => {
|
|
296
|
+
const s = this.defaultNumberRangeFilters.get(o);
|
|
297
|
+
return !i.isEqual(s);
|
|
298
298
|
});
|
|
299
|
-
if (Array.from(this.defaultNumberRangeFilters.entries()).filter(([
|
|
300
|
-
const
|
|
301
|
-
return !
|
|
302
|
-
}) ||
|
|
299
|
+
if (Array.from(this.defaultNumberRangeFilters.entries()).filter(([o]) => t.has(o)).some(([o, i]) => {
|
|
300
|
+
const s = this.numberRangeFilters.get(o);
|
|
301
|
+
return !i.isEqual(s);
|
|
302
|
+
}) || F)
|
|
303
303
|
return !0;
|
|
304
|
-
const
|
|
305
|
-
var
|
|
306
|
-
const
|
|
307
|
-
return
|
|
304
|
+
const M = Array.from(this.defaultDateRangeFilters.entries()).filter(([o]) => t.has(o)).some(([o, i]) => {
|
|
305
|
+
var p, d, c, A;
|
|
306
|
+
const s = this.dateRangeFilters.get(o);
|
|
307
|
+
return i != null && i.filterType && !(s != null && s.filterType) || s != null && s.filterType && !(i != null && i.filterType) || (s == null ? void 0 : s.filterType) !== (i == null ? void 0 : i.filterType) ? !0 : (s == null ? void 0 : s.filterType) === "CUSTOM" && (i == null ? void 0 : i.filterType) === "CUSTOM" ? ((p = i.gte) == null ? void 0 : p.toString()) !== ((d = s.gte) == null ? void 0 : d.toString()) || ((c = i.lte) == null ? void 0 : c.toString()) !== ((A = s.lte) == null ? void 0 : A.toString()) : !1;
|
|
308
308
|
});
|
|
309
|
-
return Array.from(this.dateRangeFilters.entries()).filter(([
|
|
310
|
-
var
|
|
311
|
-
const
|
|
312
|
-
return
|
|
313
|
-
}) ||
|
|
309
|
+
return Array.from(this.dateRangeFilters.entries()).filter(([o]) => t.has(o)).some(([o, i]) => {
|
|
310
|
+
var p, d, c, A;
|
|
311
|
+
const s = this.defaultDateRangeFilters.get(o);
|
|
312
|
+
return i != null && i.filterType && !(s != null && s.filterType) || s != null && s.filterType && !(i != null && i.filterType) || (s == null ? void 0 : s.filterType) !== (i == null ? void 0 : i.filterType) ? !0 : (s == null ? void 0 : s.filterType) === "CUSTOM" && (i == null ? void 0 : i.filterType) === "CUSTOM" ? ((p = i.gte) == null ? void 0 : p.toString()) !== ((d = s.gte) == null ? void 0 : d.toString()) || ((c = i.lte) == null ? void 0 : c.toString()) !== ((A = s.lte) == null ? void 0 : A.toString()) : !1;
|
|
313
|
+
}) || M;
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
export {
|
|
317
|
-
|
|
317
|
+
W as Filters
|
|
318
318
|
};
|
package/dist/index75.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("@veeqo/ui"),r=({shouldShow:a,viewName:n,onCancel:t,onDelete:o})=>e.jsx(i.Modal,{headerTitle:`Delete '${n}' view?`,"data-testid":"act-react-listing-custom-confirmation-popup",variant:"sm",shouldShow:a,onClose:t,rightActions:[{className:"act-react-listing-custom-confirmation-popup-cancel",label:"Cancel",onClick:t,variant:"default"},{className:"act-react-listing-custom-confirmation-popup-delete",label:"Delete",onClick:o,variant:"primaryDestructive"}],showHeaderCloseButton:!0,children:e.jsx(i.Text,{variant:"body",children:"This cannot be undone."})});exports.Confirmation=r;
|