@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/index60.js CHANGED
@@ -1,318 +1,318 @@
1
- var P = Object.defineProperty;
2
- var C = (w, t, a) => t in w ? P(w, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : w[t] = a;
3
- var o = (w, t, a) => C(w, typeof t != "symbol" ? t + "" : t, a);
4
- import { makeObservable as L, computed as b, action as F, observable as d } from "mobx";
5
- import { DateRanges as G } from "@veeqo/ui";
6
- import { parseDate as U } from "@internationalized/date";
7
- import D from "lodash/isEqual";
8
- import { FilterChoiceValue as u } from "./index44.js";
9
- import { RangeFilter as A } from "./index62.js";
10
- import { NumberRangeFilter as I } from "./index61.js";
11
- import { ALL_VIEW_ID as v } from "./index70.js";
12
- import { isValidDateRange as O } from "./index68.js";
13
- import { BusinessLogicManager as p } from "./index8.js";
14
- class Q {
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
- o(this, "defaultPageSize");
18
- o(this, "pageSize");
19
- o(this, "currentPage");
17
+ f(this, "defaultPageSize");
18
+ f(this, "pageSize");
19
+ f(this, "currentPage");
20
20
  // DEFAULT FILTERS
21
- o(this, "defaultFilters");
22
- o(this, "defaultArrayFilters");
23
- o(this, "defaultDateRangeFilters");
24
- o(this, "defaultNumberRangeFilters");
21
+ f(this, "defaultFilters");
22
+ f(this, "defaultArrayFilters");
23
+ f(this, "defaultDateRangeFilters");
24
+ f(this, "defaultNumberRangeFilters");
25
25
  // CURRENT FILTERS
26
- o(this, "filters");
27
- o(this, "arrayFilters");
28
- o(this, "dateRangeFilters");
29
- o(this, "numberRangeFilters");
26
+ f(this, "filters");
27
+ f(this, "arrayFilters");
28
+ f(this, "dateRangeFilters");
29
+ f(this, "numberRangeFilters");
30
30
  // VIEWS
31
- o(this, "activeViewId");
31
+ f(this, "activeViewId");
32
32
  // VISIBILITY STATE
33
- o(this, "isFiltersDropdownVisible");
34
- o(this, "initDefaultFilterMaps", () => {
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
- o(this, "updateUrl", (t = !1) => {
37
+ f(this, "updateUrl", (e = !1) => {
38
38
  try {
39
- const a = `${window.location.pathname}?${this.queryParams}`;
40
- t ? window.history.pushState({}, "", a) : window.history.replaceState({}, "", a);
41
- } catch (a) {
42
- console.log(a);
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
- o(this, "setCurrentPage", (t) => {
47
- this.currentPage = t;
46
+ f(this, "setCurrentPage", (e) => {
47
+ this.currentPage = e;
48
48
  });
49
- o(this, "setPageSize", (t) => {
50
- this.pageSize = t;
49
+ f(this, "setPageSize", (e) => {
50
+ this.pageSize = e;
51
51
  });
52
52
  // TEXT FILTERS
53
- o(this, "setFilter", (t, a) => {
54
- this.filters.set(t, a), this.updateUrl();
53
+ f(this, "setFilter", (e, l) => {
54
+ this.filters.set(e, l), this.updateUrl();
55
55
  });
56
- o(this, "clearFilter", (t) => {
57
- this.filters.set(t, ""), this.updateUrl();
56
+ f(this, "clearFilter", (e) => {
57
+ this.filters.set(e, ""), this.updateUrl();
58
58
  });
59
59
  // ARRAY FILTERS
60
- o(this, "setArrayFilter", (t, a) => {
61
- this.arrayFilters.set(t, a), this.updateUrl();
60
+ f(this, "setArrayFilter", (e, l) => {
61
+ this.arrayFilters.set(e, l), this.updateUrl();
62
62
  });
63
- o(this, "clearArrayFilter", (t) => {
64
- this.arrayFilters.set(t, []), this.updateUrl();
63
+ f(this, "clearArrayFilter", (e) => {
64
+ this.arrayFilters.set(e, []), this.updateUrl();
65
65
  });
66
66
  // RANGE FILTERS
67
- o(this, "setRangeFilter", ({
68
- key: t,
69
- range: a,
70
- dates: i
67
+ f(this, "setRangeFilter", ({
68
+ key: e,
69
+ range: l,
70
+ dates: r
71
71
  }) => {
72
- a.setFilterType(t), a.setDates(i.start, i.end), this.updateUrl();
72
+ l.setFilterType(e), l.setDates(r.start, r.end), this.updateUrl();
73
73
  });
74
- o(this, "clearRangeFilter", (t) => {
75
- const a = this.dateRangeFilters.get(t);
76
- a && (a.clear(), this.updateUrl());
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
- o(this, "setNumberRangeFilter", ({
80
- numberRange: t,
81
- gte: a,
82
- lte: i
79
+ f(this, "setNumberRangeFilter", ({
80
+ numberRange: e,
81
+ gte: l,
82
+ lte: r
83
83
  }) => {
84
- t.setGte(a), t.setLte(i), this.updateUrl();
84
+ e.setGte(l), e.setLte(r), this.updateUrl();
85
85
  });
86
- o(this, "clearNumberRangeFilter", (t) => {
87
- const a = this.numberRangeFilters.get(t);
88
- a && (a.clear(), this.updateUrl());
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
- o(this, "clearAllFilters", (t = !1) => {
92
- const { SEARCH_FILTER_ID: a } = p.getBusinessLogic();
93
- this.filters.forEach((i, e) => {
94
- e !== a && this.filters.set(e, "");
95
- }), this.arrayFilters.forEach((i, e) => this.arrayFilters.set(e, [])), this.dateRangeFilters.forEach((i) => i.clear()), this.numberRangeFilters.forEach((i) => i.clear()), t || this.updateUrl();
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
- o(this, "clearFiltersForGroup", (t) => {
98
- const { GROUP_MAP: a } = p.getBusinessLogic(), i = a.get(t);
99
- i && i.fields.forEach((e) => {
100
- this.arrayFilters.has(e.id) ? this.clearArrayFilter(e.id) : this.dateRangeFilters.has(e.id) ? this.clearRangeFilter(e.id) : this.numberRangeFilters.has(e.id) ? this.clearNumberRangeFilter(e.id) : this.clearFilter(e.id);
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
- o(this, "setActiveViewId", (t) => {
105
- this.activeViewId = t, this.updateUrl();
104
+ f(this, "setActiveViewId", (e) => {
105
+ this.activeViewId = e, this.updateUrl();
106
106
  });
107
107
  // VISIBILITY
108
- o(this, "toggleFiltersDropdownVisible", (t) => {
109
- this.isFiltersDropdownVisible = t;
108
+ f(this, "toggleFiltersDropdownVisible", (e) => {
109
+ this.isFiltersDropdownVisible = e;
110
110
  });
111
111
  // FILTER GROUPS
112
- o(this, "getFiltersForGroup", (t) => {
113
- const { GROUP_MAP: a } = p.getBusinessLogic(), i = a.get(t);
114
- if (!i) return {};
115
- const e = {};
116
- return i.fields.forEach((r) => {
117
- this.arrayFilters.has(r.id) ? e[r.id] = this.arrayFilters.get(r.id) : this.dateRangeFilters.has(r.id) ? e[r.id] = this.dateRangeFilters.get(r.id) : this.numberRangeFilters.has(r.id) ? e[r.id] = this.numberRangeFilters.get(r.id) : e[r.id] = this.filters.get(r.id);
118
- }), e;
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
- o(this, "initFiltersFromView", (t) => {
121
- var i;
122
- const { PAGE_SIZE_OPTIONS: a } = p.getBusinessLogic();
123
- (i = t.page) != null && i.size && a.includes(t.page.size) && (this.defaultPageSize = t.page.size, this.pageSize = t.page.size), this.defaultFilters = new Map(t.filterMaps.filters), this.defaultArrayFilters = new Map(t.filterMaps.arrayFilters), this.defaultDateRangeFilters = new Map(
124
- Array.from(t.filterMaps.rangeFilters.entries()).map(([e, r]) => {
125
- const f = new A(r.filterType);
126
- return r.gte && r.lte && f.setDates(r.gte, r.lte), [e, f];
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(t.filterMaps.numberRangeFilters.entries()).map(([e, r]) => {
130
- const f = r.clone();
131
- return r.gte && f.setGte(r.gte), r.lte && f.setLte(r.lte), [e, f];
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(t.filterMaps.filters), this.arrayFilters = new Map(t.filterMaps.arrayFilters), this.dateRangeFilters = new Map(
134
- Array.from(t.filterMaps.rangeFilters.entries()).map(([e, r]) => {
135
- const f = new A(r.filterType);
136
- return r.gte && r.lte && f.setDates(r.gte, r.lte), [e, f];
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(t.filterMaps.numberRangeFilters.entries()).map(([e, r]) => {
140
- const f = r.clone();
141
- return r.gte && f.setGte(r.gte), r.lte && f.setLte(r.lte), [e, f];
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 = t.id;
143
+ ), this.activeViewId = e.id;
144
144
  });
145
- o(this, "initFromUrl", (t = !0) => {
146
- const { GROUP_MAP: a, NUMBER_RANGE_FILTERS: i, PAGE_SIZE_OPTIONS: e } = p.getBusinessLogic(), r = new URLSearchParams(window.location.search), f = Array.from(a.values()).flatMap((n) => n.fields), R = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Map();
147
- Array.from(r.entries()).forEach(([n, s]) => {
148
- (n.includes("_gte") || n.includes("_lte")) && M.set(n, s);
149
- }), Array.from(r.entries()).forEach(([n, s]) => {
150
- if (n === "view" && t) {
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 (n === "page" && e.includes(Number(s))) {
154
+ if (i === a && t.includes(Number(s))) {
155
155
  this.pageSize = Number(s);
156
156
  return;
157
157
  }
158
- let l = f.find((g) => g.id === n);
159
- if (!l) {
160
- const g = n.replace(/_[gl]te$/, "");
161
- i.includes(g) && (l = f.find((m) => m.id === g));
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 (l)
164
- switch (l.filterType) {
165
- case u.CHECKBOX:
166
- s && h.set(n, s.split(","));
163
+ if (p)
164
+ switch (p.filterType) {
165
+ case m.CHECKBOX:
166
+ s && R.set(i, s.split(","));
167
167
  break;
168
- case u.DATE_RANGE:
169
- let g;
168
+ case m.DATE_RANGE:
169
+ let d;
170
170
  if (s === "CUSTOM") {
171
- g = new A("CUSTOM");
172
- const _ = M.get(`${n}_gte`), N = M.get(`${n}_lte`);
173
- _ && N && g.setDates(U(_), U(N));
174
- } else O(s) ? g = new A(s) : g = new A(G.TODAY);
175
- T.set(n, g);
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 u.NUMBER_RANGE:
178
- const m = new I({ filterId: l.id }), c = n.replace(/_[gl]te$/, ""), y = M.get(`${c}_gte`), S = M.get(`${c}_lte`);
179
- y && m.setGte(Number(y)), S && m.setLte(Number(S)), E.set(c, m);
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 u.TEXT:
182
- case u.NUMBER:
183
- case u.RADIO:
184
- R.set(n, s);
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 = R, this.arrayFilters = h, this.dateRangeFilters = T, this.numberRangeFilters = E, this.updateUrl();
187
+ }), this.filters = F, this.arrayFilters = R, this.dateRangeFilters = M, this.numberRangeFilters = S, this.updateUrl();
188
188
  });
189
- o(this, "discardChanges", (t = !1) => {
189
+ f(this, "discardChanges", (e = !1) => {
190
190
  this.pageSize = this.defaultPageSize;
191
- const { SEARCH_FILTER_ID: a } = p.getBusinessLogic(), i = new Map(this.defaultFilters);
192
- this.filters.has(a) && i.set(a, this.filters.get(a)), this.filters = i, this.arrayFilters = new Map(this.defaultArrayFilters), this.dateRangeFilters.clear(), this.defaultDateRangeFilters.forEach((e, r) => {
193
- const f = new A(e.filterType);
194
- f.setDates(e.gte, e.lte), this.dateRangeFilters.set(r, f);
195
- }), this.numberRangeFilters.clear(), this.defaultNumberRangeFilters.forEach((e, r) => {
196
- this.numberRangeFilters.set(r, e.clone());
197
- }), this.updateUrl(t);
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: t } = p.getBusinessLogic(), a = Array.from(t.values()).flatMap((i) => i.fields);
199
+ const { GROUP_MAP: e } = y.getBusinessLogic(), l = Array.from(e.values()).flatMap((r) => r.fields);
200
200
  this.filters = new Map(
201
- a.filter(
202
- (i) => i.filterType === u.TEXT || i.filterType === u.NUMBER || i.filterType === u.RADIO || i.filterType === u.DATE_RANGE
203
- ).map((i) => [i.id, ""])
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
- a.filter((i) => i.filterType === u.CHECKBOX).map((i) => [i.id, []])
205
+ l.filter((r) => r.filterType === m.CHECKBOX).map((r) => [r.id, []])
206
206
  ), this.dateRangeFilters = new Map(
207
- a.filter((i) => i.filterType === u.DATE_RANGE).map((i) => [i.id, new A()])
207
+ l.filter((r) => r.filterType === m.DATE_RANGE).map((r) => [r.id, new w()])
208
208
  ), this.numberRangeFilters = new Map(
209
- a.filter((i) => i.filterType === u.NUMBER_RANGE).map((i) => {
210
- const e = new I({ filterId: i.id });
211
- return [i.id, e];
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, L(this, {
214
- defaultPageSize: d,
215
- pageSize: d,
216
- currentPage: d,
217
- defaultFilters: d,
218
- defaultArrayFilters: d,
219
- defaultDateRangeFilters: d,
220
- defaultNumberRangeFilters: d,
221
- filters: d,
222
- arrayFilters: d,
223
- numberRangeFilters: d,
224
- dateRangeFilters: d,
225
- isFiltersDropdownVisible: d,
226
- activeViewId: d,
227
- setPageSize: F,
228
- setCurrentPage: F,
229
- toggleFiltersDropdownVisible: F,
230
- setActiveViewId: F,
231
- setFilter: F,
232
- setArrayFilter: F,
233
- setRangeFilter: F,
234
- setNumberRangeFilter: F,
235
- clearFilter: F,
236
- clearArrayFilter: F,
237
- clearRangeFilter: F,
238
- clearNumberRangeFilter: F,
239
- clearAllFilters: F,
240
- getFiltersForGroup: F,
241
- clearFiltersForGroup: F,
242
- initFromUrl: F,
243
- initFiltersFromView: F,
244
- initDefaultFilterMaps: F,
245
- discardChanges: F,
246
- updateUrl: F,
247
- hasActiveFilters: b,
248
- activeFilterKeysList: b,
249
- queryParams: b,
250
- hasUnsavedChanges: b
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: t } = p.getBusinessLogic(), a = Array.from(t.values()).flatMap((e) => e.fields), i = new Set(a.map((e) => e.id));
255
- return Array.from(this.filters.entries()).filter(([e]) => i.has(e)).some(([, e]) => e !== "") || Array.from(this.arrayFilters.entries()).filter(([e]) => i.has(e)).some(([, e]) => e.length > 0) || Array.from(this.dateRangeFilters.entries()).filter(([e]) => i.has(e)).some(([, e]) => e.filterType !== void 0) || Array.from(this.numberRangeFilters.entries()).filter(([e]) => i.has(e)).some(([, e]) => e.isActive);
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: t, NUMBER_RANGE_FILTERS: a } = p.getBusinessLogic(), i = Array.from(this.filters.entries()).filter(
259
- ([h, T]) => T !== "" && !t.includes(h) && !a.includes(h)
260
- ).map(([h]) => h), e = Array.from(this.arrayFilters.entries()).filter(([, h]) => h.length > 0).map(([h]) => h), r = Array.from(this.dateRangeFilters.entries()).filter(([, h]) => h.filterType !== void 0).map(([h]) => h), f = Array.from(this.numberRangeFilters.entries()).filter(([, h]) => h.isActive).map(([h]) => h);
261
- return [.../* @__PURE__ */ new Set([...i, ...e, ...r, ...f])];
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: t, NUMBER_RANGE_FILTERS: a } = p.getBusinessLogic(), i = new URLSearchParams();
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
- ([e, r]) => r !== "" && !t.includes(e) && !a.includes(e)
267
- ).forEach(([e, r]) => {
268
- i.append(e, r);
269
- }), Array.from(this.arrayFilters.entries()).filter(([, e]) => e.length > 0).forEach(([e, r]) => {
270
- i.append(e, r.join(","));
271
- }), Array.from(this.dateRangeFilters.entries()).filter(([, e]) => e.filterType !== void 0).forEach(([e, r]) => {
272
- i.set(e, r.filterType), r.filterType === "CUSTOM" && (i.set(`${e}_gte`, r.gte.toString()), i.set(`${e}_lte`, r.lte.toString()));
273
- }), Array.from(this.numberRangeFilters.entries()).filter(([, e]) => e.isActive).forEach(([e, r]) => {
274
- r.gte !== void 0 && i.set(`${e}_gte`, r.gte.toString()), r.isValidLte && i.set(`${e}_lte`, r.lte.toString());
275
- }), this.activeViewId && i.set("view", this.activeViewId), i.set("page", this.pageSize.toString()), i.toString();
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 === v) return !1;
278
+ if (this.activeViewId === O) return !1;
279
279
  if (this.defaultPageSize !== this.pageSize) return !0;
280
- const { GROUP_MAP: t, SEARCH_FILTER_ID: a } = p.getBusinessLogic(), i = Array.from(t.values()).flatMap((n) => n.fields), e = new Set(i.map((n) => n.id));
281
- if (Array.from(this.filters.entries()).filter(([n]) => n !== a && e.has(n)).some(([n, s]) => {
282
- const l = this.defaultFilters.get(n);
283
- return l === void 0 && s !== "" || l !== void 0 && s !== l;
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 f = Array.from(this.defaultArrayFilters.entries()).filter(([n]) => e.has(n)).some(([n, s]) => {
287
- const l = this.defaultArrayFilters.get(n) || [];
288
- return s.length > 0 || l.length > 0 ? s.length !== l.length || !D(s, l) : !1;
289
- }), R = Array.from(this.arrayFilters.entries()).filter(([n]) => e.has(n)).some(([n, s]) => {
290
- const l = this.defaultArrayFilters.get(n) || [];
291
- return s.length > 0 || l.length > 0 ? s.length !== l.length || !D(s, l) : !1;
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 (f || R)
293
+ if (n || h)
294
294
  return !0;
295
- const h = Array.from(this.numberRangeFilters.entries()).filter(([n]) => e.has(n)).some(([n, s]) => {
296
- const l = this.defaultNumberRangeFilters.get(n);
297
- return !s.isEqual(l);
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(([n]) => e.has(n)).some(([n, s]) => {
300
- const l = this.numberRangeFilters.get(n);
301
- return !s.isEqual(l);
302
- }) || h)
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 E = Array.from(this.defaultDateRangeFilters.entries()).filter(([n]) => e.has(n)).some(([n, s]) => {
305
- var g, m, c, y;
306
- const l = this.dateRangeFilters.get(n);
307
- return s != null && s.filterType && !(l != null && l.filterType) || l != null && l.filterType && !(s != null && s.filterType) || (l == null ? void 0 : l.filterType) !== (s == null ? void 0 : s.filterType) ? !0 : (l == null ? void 0 : l.filterType) === "CUSTOM" && (s == null ? void 0 : s.filterType) === "CUSTOM" ? ((g = s.gte) == null ? void 0 : g.toString()) !== ((m = l.gte) == null ? void 0 : m.toString()) || ((c = s.lte) == null ? void 0 : c.toString()) !== ((y = l.lte) == null ? void 0 : y.toString()) : !1;
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(([n]) => e.has(n)).some(([n, s]) => {
310
- var g, m, c, y;
311
- const l = this.defaultDateRangeFilters.get(n);
312
- return s != null && s.filterType && !(l != null && l.filterType) || l != null && l.filterType && !(s != null && s.filterType) || (l == null ? void 0 : l.filterType) !== (s == null ? void 0 : s.filterType) ? !0 : (l == null ? void 0 : l.filterType) === "CUSTOM" && (s == null ? void 0 : s.filterType) === "CUSTOM" ? ((g = s.gte) == null ? void 0 : g.toString()) !== ((m = l.gte) == null ? void 0 : m.toString()) || ((c = s.lte) == null ? void 0 : c.toString()) !== ((y = l.lte) == null ? void 0 : y.toString()) : !1;
313
- }) || E;
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
- Q as Filters
317
+ W as Filters
318
318
  };
package/dist/index75.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),n=require("react"),l=require("./index87.cjs"),v=({children:i,style:o,className:c})=>{const r=n.useRef(null),[u,f]=n.useState(0);return n.useEffect(()=>{const e=r.current,s=()=>{if(e){const{top:a}=e.getBoundingClientRect();f(a)}};s();const t=new ResizeObserver(s);return e&&t.observe(e),()=>{e&&t.unobserve(e),t.disconnect()}},[]),d.jsx(l.AdaptiveStyledContainer,{style:o,className:c,offset:u,ref:r,children:i})};exports.AdaptiveHeightContainer=v;
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;