@veeqo/transfigure 2.2.0 → 2.3.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.
Files changed (98) hide show
  1. package/dist/api/types.d.ts +4 -0
  2. package/dist/hooks/usePersistUnsavedChanges/usePersistUnsavedChanges.d.ts +1 -0
  3. package/dist/index100.cjs +1 -1
  4. package/dist/index100.js +19 -48
  5. package/dist/index101.cjs +1 -1
  6. package/dist/index101.js +17 -28
  7. package/dist/index102.cjs +1 -1
  8. package/dist/index102.js +24 -21
  9. package/dist/index104.cjs +1 -1
  10. package/dist/index104.js +14 -17
  11. package/dist/index107.cjs +1 -1
  12. package/dist/index107.js +49 -23
  13. package/dist/index108.cjs +1 -80
  14. package/dist/index108.js +28 -97
  15. package/dist/index109.cjs +80 -1
  16. package/dist/index109.js +98 -19
  17. package/dist/index11.cjs +1 -1
  18. package/dist/index11.js +1 -1
  19. package/dist/index110.cjs +1 -1
  20. package/dist/index110.js +18 -7
  21. package/dist/index111.cjs +1 -1
  22. package/dist/index111.js +7 -60
  23. package/dist/index112.cjs +1 -1
  24. package/dist/index112.js +57 -26
  25. package/dist/index113.cjs +1 -13
  26. package/dist/index113.js +30 -17
  27. package/dist/index115.cjs +13 -1
  28. package/dist/index115.js +15 -24
  29. package/dist/index116.cjs +1 -1
  30. package/dist/index116.js +22 -32
  31. package/dist/index117.cjs +1 -1
  32. package/dist/index117.js +36 -5
  33. package/dist/index118.cjs +1 -1
  34. package/dist/index118.js +5 -63
  35. package/dist/index119.cjs +1 -7
  36. package/dist/index119.js +63 -10
  37. package/dist/index120.cjs +7 -1
  38. package/dist/index120.js +10 -47
  39. package/dist/index121.cjs +1 -0
  40. package/dist/index121.js +49 -0
  41. package/dist/index13.cjs +1 -1
  42. package/dist/index13.js +1 -1
  43. package/dist/index17.cjs +1 -1
  44. package/dist/index17.js +1 -1
  45. package/dist/index19.cjs +1 -1
  46. package/dist/index19.js +2 -2
  47. package/dist/index20.cjs +1 -1
  48. package/dist/index20.js +1 -1
  49. package/dist/index22.cjs +1 -1
  50. package/dist/index22.js +1 -1
  51. package/dist/index30.cjs +1 -1
  52. package/dist/index30.js +1 -1
  53. package/dist/index31.cjs +1 -1
  54. package/dist/index31.js +1 -1
  55. package/dist/index34.cjs +1 -1
  56. package/dist/index34.js +1 -1
  57. package/dist/index36.cjs +1 -1
  58. package/dist/index36.js +2 -2
  59. package/dist/index40.cjs +1 -1
  60. package/dist/index40.js +1 -1
  61. package/dist/index41.cjs +1 -1
  62. package/dist/index41.js +1 -1
  63. package/dist/index42.cjs +1 -1
  64. package/dist/index42.js +1 -1
  65. package/dist/index46.cjs +1 -1
  66. package/dist/index46.js +1 -1
  67. package/dist/index47.cjs +1 -1
  68. package/dist/index47.js +2 -2
  69. package/dist/index61.cjs +1 -1
  70. package/dist/index61.js +42 -44
  71. package/dist/index68.cjs +1 -1
  72. package/dist/index68.js +41 -40
  73. package/dist/index69.cjs +1 -1
  74. package/dist/index69.js +236 -209
  75. package/dist/index79.cjs +1 -1
  76. package/dist/index79.js +1 -1
  77. package/dist/index87.cjs +1 -1
  78. package/dist/index87.js +4 -116
  79. package/dist/index88.cjs +1 -1
  80. package/dist/index88.js +115 -39
  81. package/dist/index89.cjs +1 -1
  82. package/dist/index89.js +41 -9
  83. package/dist/index90.cjs +1 -1
  84. package/dist/index90.js +9 -2
  85. package/dist/index91.cjs +1 -1
  86. package/dist/index91.js +2 -5
  87. package/dist/index92.cjs +1 -1
  88. package/dist/index92.js +2 -2
  89. package/dist/index94.cjs +1 -1
  90. package/dist/index94.js +2 -2
  91. package/dist/index99.cjs +1 -1
  92. package/dist/index99.js +8 -14
  93. package/dist/mobx/Filters/Filters.d.ts +12 -1
  94. package/dist/storybookHelpers/StoryWrapper.d.ts +1 -1
  95. package/dist/utils/sortUtils/index.d.ts +2 -0
  96. package/dist/utils/sortUtils/sortUtils.d.ts +11 -0
  97. package/dist/utils/sortUtils/sortUtils.test.d.ts +1 -0
  98. package/package.json +1 -1
package/dist/index69.js CHANGED
@@ -1,22 +1,31 @@
1
- var C = Object.defineProperty;
2
- var U = (b, t, l) => t in b ? C(b, t, { enumerable: !0, configurable: !0, writable: !0, value: l }) : b[t] = l;
3
- var h = (b, t, l) => U(b, typeof t != "symbol" ? t + "" : t, l);
4
- import { makeObservable as O, computed as M, action as F, observable as c } from "mobx";
5
- import { DateRanges as L } from "@veeqo/ui";
6
- import { parseDate as _ } from "@internationalized/date";
7
- import D from "lodash/isEqual";
8
- import G from "lodash/get";
9
- import R from "lodash/set";
10
- import T from "qs";
11
- import { FilterChoiceValue as m } from "./index50.js";
12
- import { SortingMode as I } from "./index2.js";
13
- import { RangeFilter as w } from "./index71.js";
14
- import { NumberRangeFilter as v } from "./index70.js";
15
- import { ALL_VIEW_ID as V } from "./index80.js";
16
- import { isValidDateRange as N } from "./index78.js";
17
- import { BusinessLogicManager as d } from "./index9.js";
18
- class ee {
19
- constructor() {
1
+ var V = Object.defineProperty;
2
+ var B = (R, t, s) => t in R ? V(R, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : R[t] = s;
3
+ var h = (R, t, s) => B(R, typeof t != "symbol" ? t + "" : t, s);
4
+ import { makeObservable as z, computed as M, action as c, observable as d } from "mobx";
5
+ import { DateRanges as q } from "@veeqo/ui";
6
+ import { parseDate as v } from "@internationalized/date";
7
+ import N from "lodash/isEqual";
8
+ import j from "lodash/get";
9
+ import P from "lodash/set";
10
+ import I from "qs";
11
+ import { FilterChoiceValue as p } from "./index50.js";
12
+ import { SortingMode as C } from "./index2.js";
13
+ import { RangeFilter as b } from "./index71.js";
14
+ import { NumberRangeFilter as O } from "./index70.js";
15
+ import { parseSortString as U } from "./index99.js";
16
+ import { ALL_VIEW_ID as K } from "./index80.js";
17
+ import { isValidDateRange as L } from "./index78.js";
18
+ import { BusinessLogicManager as S } from "./index9.js";
19
+ class le {
20
+ /**
21
+ * @param tableStore - Optional reference to the Table store for sort state
22
+ * tracking in custom views. Sort state lives on Table (for the UI table
23
+ * component) but needs to participate in view persistence (owned by Filters).
24
+ * Filters reads Table.sortState for comparison and writes to it via setSortState
25
+ * on view initialisation and discard. This store-to-store coupling is intentional but
26
+ * should not be treated as a pattern to follow — keep stores decoupled wherever possible.
27
+ */
28
+ constructor(t) {
20
29
  // PAGINATION
21
30
  h(this, "defaultPageSize");
22
31
  h(this, "pageSize");
@@ -33,32 +42,35 @@ class ee {
33
42
  h(this, "numberRangeFilters");
34
43
  // VIEWS
35
44
  h(this, "activeViewId");
45
+ // SORT
46
+ h(this, "defaultSortState");
47
+ h(this, "tableStore");
36
48
  // VISIBILITY STATE
37
49
  h(this, "isFiltersDropdownVisible");
38
50
  h(this, "initDefaultFilterMaps", () => {
39
- this.defaultFilters = new Map(this.filters), this.defaultArrayFilters = new Map(this.arrayFilters), this.defaultDateRangeFilters = new Map(this.dateRangeFilters), this.defaultNumberRangeFilters = new Map(this.numberRangeFilters);
51
+ this.defaultFilters = new Map(this.filters), this.defaultArrayFilters = new Map(this.arrayFilters), this.defaultDateRangeFilters = new Map(this.dateRangeFilters), this.defaultNumberRangeFilters = new Map(this.numberRangeFilters), this.defaultSortState = { columnId: "", direction: "asc" };
40
52
  });
41
53
  h(this, "updateUrl", (t = !1) => {
42
54
  try {
43
- const { SORT_FILTER_ID: l, SORTING_MODE: s } = d.getBusinessLogic(), e = T.parse(window.location.search, { ignoreQueryPrefix: !0 }), i = e[l], f = e.sort_order, g = e.sort;
44
- let o = "";
45
- switch (s) {
46
- case I.CORAL:
47
- if (f && g) {
48
- const u = { ...this.queryParamsObject, sort: g, sort_order: f };
49
- o = `${window.location.pathname}?${T.stringify(u, { arrayFormat: "brackets" })}`;
55
+ const { SORT_FILTER_ID: s, SORTING_MODE: n } = S.getBusinessLogic(), e = I.parse(window.location.search, { ignoreQueryPrefix: !0 }), o = e[s], g = e.sort_order, i = e.sort;
56
+ let r = "";
57
+ switch (n) {
58
+ case C.CORAL:
59
+ if (g && i) {
60
+ const m = { ...this.queryParamsObject, sort: i, sort_order: g };
61
+ r = `${window.location.pathname}?${I.stringify(m, { arrayFormat: "brackets" })}`;
50
62
  }
51
63
  break;
52
- case I.MONOLITH:
64
+ case C.MONOLITH:
53
65
  default:
54
- if (i) {
55
- const u = { ...this.queryParamsObject, [l]: i };
56
- o = `${window.location.pathname}?${T.stringify(u, { arrayFormat: "brackets" })}`;
66
+ if (o) {
67
+ const m = { ...this.queryParamsObject, [s]: o };
68
+ r = `${window.location.pathname}?${I.stringify(m, { arrayFormat: "brackets" })}`;
57
69
  }
58
70
  }
59
- i || (o = `${window.location.pathname}?${this.queryParams}`), t ? window.history.pushState({}, "", o) : window.history.replaceState({}, "", o);
60
- } catch (l) {
61
- console.log(l);
71
+ o || (r = `${window.location.pathname}?${this.queryParams}`), t ? window.history.pushState({}, "", r) : window.history.replaceState({}, "", r);
72
+ } catch (s) {
73
+ console.log(s);
62
74
  }
63
75
  });
64
76
  // PAGINATION
@@ -69,15 +81,15 @@ class ee {
69
81
  this.pageSize = t, this.updateUrl();
70
82
  });
71
83
  // TEXT FILTERS
72
- h(this, "setFilter", (t, l) => {
73
- this.filters.set(t, l), this.setCurrentPage(1), this.updateUrl();
84
+ h(this, "setFilter", (t, s) => {
85
+ this.filters.set(t, s), this.setCurrentPage(1), this.updateUrl();
74
86
  });
75
87
  h(this, "clearFilter", (t) => {
76
88
  this.filters.set(t, ""), this.setCurrentPage(1), this.updateUrl();
77
89
  });
78
90
  // ARRAY FILTERS
79
- h(this, "setArrayFilter", (t, l) => {
80
- this.arrayFilters.set(t, l), this.setCurrentPage(1), this.updateUrl();
91
+ h(this, "setArrayFilter", (t, s) => {
92
+ this.arrayFilters.set(t, s), this.setCurrentPage(1), this.updateUrl();
81
93
  });
82
94
  h(this, "clearArrayFilter", (t) => {
83
95
  this.arrayFilters.set(t, []), this.setCurrentPage(1), this.updateUrl();
@@ -85,37 +97,37 @@ class ee {
85
97
  // RANGE FILTERS
86
98
  h(this, "setRangeFilter", ({
87
99
  key: t,
88
- range: l,
89
- dates: s
100
+ range: s,
101
+ dates: n
90
102
  }) => {
91
- l.setFilterType(t), l.setDates(s.start, s.end), this.setCurrentPage(1), this.updateUrl();
103
+ s.setFilterType(t), s.setDates(n.start, n.end), this.setCurrentPage(1), this.updateUrl();
92
104
  });
93
105
  h(this, "clearRangeFilter", (t) => {
94
- const l = this.dateRangeFilters.get(t);
95
- l && (l.clear(), this.setCurrentPage(1), this.updateUrl());
106
+ const s = this.dateRangeFilters.get(t);
107
+ s && (s.clear(), this.setCurrentPage(1), this.updateUrl());
96
108
  });
97
109
  // NUMBER RANGE FILTERS
98
110
  h(this, "setNumberRangeFilter", ({
99
111
  numberRange: t,
100
- gte: l,
101
- lte: s
112
+ gte: s,
113
+ lte: n
102
114
  }) => {
103
- t.setGte(l), t.setLte(s), this.setCurrentPage(1), this.updateUrl();
115
+ t.setGte(s), t.setLte(n), this.setCurrentPage(1), this.updateUrl();
104
116
  });
105
117
  h(this, "clearNumberRangeFilter", (t) => {
106
- const l = this.numberRangeFilters.get(t);
107
- l && (l.clear(), this.setCurrentPage(1), this.updateUrl());
118
+ const s = this.numberRangeFilters.get(t);
119
+ s && (s.clear(), this.setCurrentPage(1), this.updateUrl());
108
120
  });
109
121
  // CLEARING ALL FILTERS
110
122
  h(this, "clearAllFilters", (t = !1) => {
111
- const { SEARCH_FILTER_ID: l } = d.getBusinessLogic();
112
- this.filters.forEach((s, e) => {
113
- e !== l && this.filters.set(e, "");
114
- }), this.arrayFilters.forEach((s, e) => this.arrayFilters.set(e, [])), this.dateRangeFilters.forEach((s) => s.clear()), this.numberRangeFilters.forEach((s) => s.clear()), this.setCurrentPage(1), t || this.updateUrl();
123
+ const { SEARCH_FILTER_ID: s } = S.getBusinessLogic();
124
+ this.filters.forEach((n, e) => {
125
+ e !== s && this.filters.set(e, "");
126
+ }), this.arrayFilters.forEach((n, e) => this.arrayFilters.set(e, [])), this.dateRangeFilters.forEach((n) => n.clear()), this.numberRangeFilters.forEach((n) => n.clear()), this.setCurrentPage(1), t || this.updateUrl();
115
127
  });
116
128
  h(this, "clearFiltersForGroup", (t) => {
117
- const { GROUP_MAP: l } = d.getBusinessLogic(), s = l.get(t);
118
- s && s.fields.forEach((e) => {
129
+ const { GROUP_MAP: s } = S.getBusinessLogic(), n = s.get(t);
130
+ n && n.fields.forEach((e) => {
119
131
  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);
120
132
  });
121
133
  });
@@ -129,139 +141,153 @@ class ee {
129
141
  });
130
142
  // FILTER GROUPS
131
143
  h(this, "getFiltersForGroup", (t) => {
132
- const { GROUP_MAP: l } = d.getBusinessLogic(), s = l.get(t);
133
- if (!s) return {};
144
+ const { GROUP_MAP: s } = S.getBusinessLogic(), n = s.get(t);
145
+ if (!n) return {};
134
146
  const e = {};
135
- return s.fields.forEach((i) => {
136
- this.arrayFilters.has(i.id) ? e[i.id] = this.arrayFilters.get(i.id) : this.dateRangeFilters.has(i.id) ? e[i.id] = this.dateRangeFilters.get(i.id) : this.numberRangeFilters.has(i.id) ? e[i.id] = this.numberRangeFilters.get(i.id) : e[i.id] = this.filters.get(i.id);
147
+ return n.fields.forEach((o) => {
148
+ this.arrayFilters.has(o.id) ? e[o.id] = this.arrayFilters.get(o.id) : this.dateRangeFilters.has(o.id) ? e[o.id] = this.dateRangeFilters.get(o.id) : this.numberRangeFilters.has(o.id) ? e[o.id] = this.numberRangeFilters.get(o.id) : e[o.id] = this.filters.get(o.id);
137
149
  }), e;
138
150
  });
139
151
  h(this, "initFiltersFromView", (t) => {
140
- var s;
141
- const { PAGE_SIZE_OPTIONS: l } = d.getBusinessLogic();
142
- (s = t.page) != null && s.size && l.includes(t.page.size) && (this.defaultPageSize = t.page.size, this.pageSize = t.page.size), this.setCurrentPage(1), this.defaultFilters = new Map(t.filterMaps.filters), this.defaultArrayFilters = new Map(t.filterMaps.arrayFilters), this.defaultDateRangeFilters = new Map(
143
- Array.from(t.filterMaps.rangeFilters.entries()).map(([e, i]) => {
144
- const f = new w(i.filterType);
145
- return i.gte && i.lte && f.setDates(i.gte, i.lte), [e, f];
152
+ var e, o;
153
+ const { PAGE_SIZE_OPTIONS: s } = S.getBusinessLogic();
154
+ (e = t.page) != null && e.size && s.includes(t.page.size) && (this.defaultPageSize = t.page.size, this.pageSize = t.page.size), this.setCurrentPage(1), this.defaultFilters = new Map(t.filterMaps.filters), this.defaultArrayFilters = new Map(t.filterMaps.arrayFilters), this.defaultDateRangeFilters = new Map(
155
+ Array.from(t.filterMaps.rangeFilters.entries()).map(([g, i]) => {
156
+ const r = new b(i.filterType);
157
+ return i.gte && i.lte && r.setDates(i.gte, i.lte), [g, r];
146
158
  })
147
159
  ), this.defaultNumberRangeFilters = new Map(
148
- Array.from(t.filterMaps.numberRangeFilters.entries()).map(([e, i]) => {
149
- const f = i.clone();
150
- return i.gte && f.setGte(i.gte), i.lte && f.setLte(i.lte), [e, f];
160
+ Array.from(t.filterMaps.numberRangeFilters.entries()).map(([g, i]) => {
161
+ const r = i.clone();
162
+ return i.gte && r.setGte(i.gte), i.lte && r.setLte(i.lte), [g, r];
151
163
  })
152
164
  ), this.filters = new Map(t.filterMaps.filters), this.arrayFilters = new Map(t.filterMaps.arrayFilters), this.dateRangeFilters = new Map(
153
- Array.from(t.filterMaps.rangeFilters.entries()).map(([e, i]) => {
154
- const f = new w(i.filterType);
155
- return i.gte && i.lte && f.setDates(i.gte, i.lte), [e, f];
165
+ Array.from(t.filterMaps.rangeFilters.entries()).map(([g, i]) => {
166
+ const r = new b(i.filterType);
167
+ return i.gte && i.lte && r.setDates(i.gte, i.lte), [g, r];
156
168
  })
157
169
  ), this.numberRangeFilters = new Map(
158
- Array.from(t.filterMaps.numberRangeFilters.entries()).map(([e, i]) => {
159
- const f = i.clone();
160
- return i.gte && f.setGte(i.gte), i.lte && f.setLte(i.lte), [e, f];
170
+ Array.from(t.filterMaps.numberRangeFilters.entries()).map(([g, i]) => {
171
+ const r = i.clone();
172
+ return i.gte && r.setGte(i.gte), i.lte && r.setLte(i.lte), [g, r];
161
173
  })
162
- ), this.activeViewId = t.id;
174
+ );
175
+ const n = U(t.sort);
176
+ this.defaultSortState = n, (o = this.tableStore) == null || o.setSortState(n), this.activeViewId = t.id;
163
177
  });
164
178
  h(this, "initFromUrl", (t = !0) => {
165
- const { GROUP_MAP: l, PAGE_SIZE_OPTIONS: s, PAGE_SIZE_FILTER_ID: e } = d.getBusinessLogic(), i = T.parse(window.location.search, {
179
+ var w, A;
180
+ const { GROUP_MAP: s, PAGE_SIZE_OPTIONS: n, PAGE_SIZE_FILTER_ID: e, SORT_FILTER_ID: o } = S.getBusinessLogic(), g = I.parse(window.location.search, {
166
181
  ignoreQueryPrefix: !0
167
- }), f = Array.from(l.values()).flatMap((n) => n.fields), g = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map();
168
- t && i.view && (this.activeViewId = i.view), i[e] && s.includes(Number(i[e])) && (this.pageSize = Number(i[e]));
169
- const P = i.filter || {};
170
- f.forEach((n) => {
171
- const r = G(P, n.id);
172
- if (r !== void 0)
173
- switch (n.filterType) {
174
- case m.CHECKBOX:
175
- Array.isArray(r) ? o.set(n.id, r) : r && o.set(n.id, [r]);
182
+ }), i = Array.from(s.values()).flatMap((u) => u.fields), r = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Map();
183
+ t && g.view && (this.activeViewId = g.view), g[e] && n.includes(Number(g[e])) && (this.pageSize = Number(g[e]));
184
+ const f = g.filter || {};
185
+ i.forEach((u) => {
186
+ const F = j(f, u.id);
187
+ if (F !== void 0)
188
+ switch (u.filterType) {
189
+ case p.CHECKBOX:
190
+ Array.isArray(F) ? m.set(u.id, F) : F && m.set(u.id, [F]);
176
191
  break;
177
- case m.DATE_RANGE:
178
- if (typeof r == "string" && N(r))
179
- u.set(n.id, new w(r));
180
- else if (typeof r == "object" && r !== null) {
181
- const a = r;
182
- if (a.relative && N(a.relative))
183
- u.set(n.id, new w(a.relative));
184
- else if (a.gte && a.lte)
192
+ case p.DATE_RANGE:
193
+ if (typeof F == "string" && L(F))
194
+ E.set(u.id, new b(F));
195
+ else if (typeof F == "object" && F !== null) {
196
+ const y = F;
197
+ if (y.relative && L(y.relative))
198
+ E.set(u.id, new b(y.relative));
199
+ else if (y.gte && y.lte)
185
200
  try {
186
- const p = _(a.gte), A = _(a.lte), y = new w("CUSTOM");
187
- y.setDates(p, A), u.set(n.id, y);
201
+ const T = v(y.gte), G = v(y.lte), D = new b("CUSTOM");
202
+ D.setDates(T, G), E.set(u.id, D);
188
203
  } catch {
189
- u.set(n.id, new w(L.TODAY));
204
+ E.set(u.id, new b(q.TODAY));
190
205
  }
191
206
  }
192
207
  break;
193
- case m.NUMBER_RANGE:
194
- if (typeof r == "object" && r !== null) {
195
- const a = r, p = new v({ filterId: n.id });
196
- a.gte !== void 0 && p.setGte(Number(a.gte)), a.lte !== void 0 && p.setLte(Number(a.lte)), S.set(n.id, p);
208
+ case p.NUMBER_RANGE:
209
+ if (typeof F == "object" && F !== null) {
210
+ const y = F, T = new O({ filterId: u.id });
211
+ y.gte !== void 0 && T.setGte(Number(y.gte)), y.lte !== void 0 && T.setLte(Number(y.lte)), _.set(u.id, T);
197
212
  }
198
213
  break;
199
- case m.TEXT:
200
- case m.NUMBER:
201
- case m.RADIO:
202
- (typeof r == "string" || typeof r == "number") && g.set(n.id, String(r));
214
+ case p.TEXT:
215
+ case p.NUMBER:
216
+ case p.RADIO:
217
+ (typeof F == "string" || typeof F == "number") && r.set(u.id, String(F));
203
218
  break;
204
219
  }
205
- }), this.filters = g, this.arrayFilters = o, this.dateRangeFilters = u, this.numberRangeFilters = S, this.updateUrl();
220
+ }), this.filters = r, this.arrayFilters = m, this.dateRangeFilters = E, this.numberRangeFilters = _;
221
+ const l = g[o] || g.sort, a = g.sort_order;
222
+ if (a && g.sort)
223
+ (w = this.tableStore) == null || w.setSortState({ columnId: g.sort, direction: a });
224
+ else if (l) {
225
+ const u = U(l);
226
+ u.columnId && ((A = this.tableStore) == null || A.setSortState(u));
227
+ }
228
+ this.updateUrl();
206
229
  });
207
230
  h(this, "discardChanges", (t = !1) => {
231
+ var e;
208
232
  this.pageSize = this.defaultPageSize;
209
- const { SEARCH_FILTER_ID: l } = d.getBusinessLogic(), s = new Map(this.defaultFilters);
210
- this.filters.has(l) && s.set(l, this.filters.get(l)), this.filters = s, this.arrayFilters = new Map(this.defaultArrayFilters), this.dateRangeFilters.clear(), this.defaultDateRangeFilters.forEach((e, i) => {
211
- const f = new w(e.filterType);
212
- f.setDates(e.gte, e.lte), this.dateRangeFilters.set(i, f);
213
- }), this.numberRangeFilters.clear(), this.defaultNumberRangeFilters.forEach((e, i) => {
214
- this.numberRangeFilters.set(i, e.clone());
215
- }), this.updateUrl(t);
233
+ const { SEARCH_FILTER_ID: s } = S.getBusinessLogic(), n = new Map(this.defaultFilters);
234
+ this.filters.has(s) && n.set(s, this.filters.get(s)), this.filters = n, this.arrayFilters = new Map(this.defaultArrayFilters), this.dateRangeFilters.clear(), this.defaultDateRangeFilters.forEach((o, g) => {
235
+ const i = new b(o.filterType);
236
+ i.setDates(o.gte, o.lte), this.dateRangeFilters.set(g, i);
237
+ }), this.numberRangeFilters.clear(), this.defaultNumberRangeFilters.forEach((o, g) => {
238
+ this.numberRangeFilters.set(g, o.clone());
239
+ }), (e = this.tableStore) == null || e.setSortState(this.defaultSortState), this.updateUrl(t);
216
240
  });
217
- const { GROUP_MAP: t } = d.getBusinessLogic(), l = Array.from(t.values()).flatMap((s) => s.fields);
241
+ const { GROUP_MAP: s } = S.getBusinessLogic(), n = Array.from(s.values()).flatMap((e) => e.fields);
218
242
  this.filters = new Map(
219
- l.filter(
220
- (s) => s.filterType === m.TEXT || s.filterType === m.NUMBER || s.filterType === m.RADIO || s.filterType === m.DATE_RANGE
221
- ).map((s) => [s.id, ""])
243
+ n.filter(
244
+ (e) => e.filterType === p.TEXT || e.filterType === p.NUMBER || e.filterType === p.RADIO || e.filterType === p.DATE_RANGE
245
+ ).map((e) => [e.id, ""])
222
246
  ), this.arrayFilters = new Map(
223
- l.filter((s) => s.filterType === m.CHECKBOX).map((s) => [s.id, []])
247
+ n.filter((e) => e.filterType === p.CHECKBOX).map((e) => [e.id, []])
224
248
  ), this.dateRangeFilters = new Map(
225
- l.filter((s) => s.filterType === m.DATE_RANGE).map((s) => [s.id, new w()])
249
+ n.filter((e) => e.filterType === p.DATE_RANGE).map((e) => [e.id, new b()])
226
250
  ), this.numberRangeFilters = new Map(
227
- l.filter((s) => s.filterType === m.NUMBER_RANGE).map((s) => {
228
- const e = new v({ filterId: s.id });
229
- return [s.id, e];
251
+ n.filter((e) => e.filterType === p.NUMBER_RANGE).map((e) => {
252
+ const o = new O({ filterId: e.id });
253
+ return [e.id, o];
230
254
  })
231
- ), 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, O(this, {
232
- defaultPageSize: c,
233
- pageSize: c,
234
- currentPage: c,
235
- defaultFilters: c,
236
- defaultArrayFilters: c,
237
- defaultDateRangeFilters: c,
238
- defaultNumberRangeFilters: c,
239
- filters: c,
240
- arrayFilters: c,
241
- numberRangeFilters: c,
242
- dateRangeFilters: c,
243
- isFiltersDropdownVisible: c,
244
- activeViewId: c,
245
- setPageSize: F,
246
- setCurrentPage: F,
247
- toggleFiltersDropdownVisible: F,
248
- setActiveViewId: F,
249
- setFilter: F,
250
- setArrayFilter: F,
251
- setRangeFilter: F,
252
- setNumberRangeFilter: F,
253
- clearFilter: F,
254
- clearArrayFilter: F,
255
- clearRangeFilter: F,
256
- clearNumberRangeFilter: F,
257
- clearAllFilters: F,
258
- getFiltersForGroup: F,
259
- clearFiltersForGroup: F,
260
- initFromUrl: F,
261
- initFiltersFromView: F,
262
- initDefaultFilterMaps: F,
263
- discardChanges: F,
264
- updateUrl: F,
255
+ ), 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, this.defaultSortState = { columnId: "", direction: "asc" }, this.tableStore = t, z(this, {
256
+ defaultPageSize: d,
257
+ pageSize: d,
258
+ currentPage: d,
259
+ defaultFilters: d,
260
+ defaultArrayFilters: d,
261
+ defaultDateRangeFilters: d,
262
+ defaultNumberRangeFilters: d,
263
+ filters: d,
264
+ arrayFilters: d,
265
+ numberRangeFilters: d,
266
+ dateRangeFilters: d,
267
+ isFiltersDropdownVisible: d,
268
+ activeViewId: d,
269
+ defaultSortState: d,
270
+ tableStore: d.ref,
271
+ setPageSize: c,
272
+ setCurrentPage: c,
273
+ toggleFiltersDropdownVisible: c,
274
+ setActiveViewId: c,
275
+ setFilter: c,
276
+ setArrayFilter: c,
277
+ setRangeFilter: c,
278
+ setNumberRangeFilter: c,
279
+ clearFilter: c,
280
+ clearArrayFilter: c,
281
+ clearRangeFilter: c,
282
+ clearNumberRangeFilter: c,
283
+ clearAllFilters: c,
284
+ getFiltersForGroup: c,
285
+ clearFiltersForGroup: c,
286
+ initFromUrl: c,
287
+ initFiltersFromView: c,
288
+ initDefaultFilterMaps: c,
289
+ discardChanges: c,
290
+ updateUrl: c,
265
291
  hasActiveFilters: M,
266
292
  activeFilterKeysList: M,
267
293
  queryParamsObject: M,
@@ -270,83 +296,84 @@ class ee {
270
296
  });
271
297
  }
272
298
  get hasActiveFilters() {
273
- const { GROUP_MAP: t } = d.getBusinessLogic(), l = Array.from(t.values()).flatMap((e) => e.fields), s = new Set(l.map((e) => e.id));
274
- return Array.from(this.filters.entries()).filter(([e]) => s.has(e)).some(([, e]) => e !== "") || Array.from(this.arrayFilters.entries()).filter(([e]) => s.has(e)).some(([, e]) => e.length > 0) || Array.from(this.dateRangeFilters.entries()).filter(([e]) => s.has(e)).some(([, e]) => e.filterType !== void 0) || Array.from(this.numberRangeFilters.entries()).filter(([e]) => s.has(e)).some(([, e]) => e.isActive);
299
+ const { GROUP_MAP: t } = S.getBusinessLogic(), s = Array.from(t.values()).flatMap((e) => e.fields), n = new Set(s.map((e) => e.id));
300
+ return Array.from(this.filters.entries()).filter(([e]) => n.has(e)).some(([, e]) => e !== "") || Array.from(this.arrayFilters.entries()).filter(([e]) => n.has(e)).some(([, e]) => e.length > 0) || Array.from(this.dateRangeFilters.entries()).filter(([e]) => n.has(e)).some(([, e]) => e.filterType !== void 0) || Array.from(this.numberRangeFilters.entries()).filter(([e]) => n.has(e)).some(([, e]) => e.isActive);
275
301
  }
276
302
  get activeFilterKeysList() {
277
- const { DATE_RANGE_FILTERS: t, NUMBER_RANGE_FILTERS: l } = d.getBusinessLogic(), s = Array.from(this.filters.entries()).filter(
278
- ([o, u]) => u !== "" && !t.includes(o) && !l.includes(o)
279
- ).map(([o]) => o), e = Array.from(this.arrayFilters.entries()).filter(([, o]) => o.length > 0).map(([o]) => o), i = Array.from(this.dateRangeFilters.entries()).filter(([, o]) => o.filterType !== void 0).map(([o]) => o), f = Array.from(this.numberRangeFilters.entries()).filter(([, o]) => o.isActive).map(([o]) => o);
280
- return [.../* @__PURE__ */ new Set([...s, ...e, ...i, ...f])];
303
+ const { DATE_RANGE_FILTERS: t, NUMBER_RANGE_FILTERS: s } = S.getBusinessLogic(), n = Array.from(this.filters.entries()).filter(
304
+ ([r, m]) => m !== "" && !t.includes(r) && !s.includes(r)
305
+ ).map(([r]) => r), e = Array.from(this.arrayFilters.entries()).filter(([, r]) => r.length > 0).map(([r]) => r), o = Array.from(this.dateRangeFilters.entries()).filter(([, r]) => r.filterType !== void 0).map(([r]) => r), g = Array.from(this.numberRangeFilters.entries()).filter(([, r]) => r.isActive).map(([r]) => r);
306
+ return [.../* @__PURE__ */ new Set([...n, ...e, ...o, ...g])];
281
307
  }
282
308
  get queryParamsObject() {
283
- const { DATE_RANGE_FILTERS: t, NUMBER_RANGE_FILTERS: l, PAGE_SIZE_FILTER_ID: s, PAGE_NUMBER_FILTER_ID: e } = d.getBusinessLogic(), i = {};
309
+ const { DATE_RANGE_FILTERS: t, NUMBER_RANGE_FILTERS: s, PAGE_SIZE_FILTER_ID: n, PAGE_NUMBER_FILTER_ID: e } = S.getBusinessLogic(), o = {};
284
310
  Array.from(this.filters.entries()).filter(
285
- ([g, o]) => o !== "" && !t.includes(g) && !l.includes(g)
286
- ).forEach(([g, o]) => {
287
- R(i, g, o);
288
- }), Array.from(this.arrayFilters.entries()).filter(([, g]) => g.length > 0).forEach(([g, o]) => {
289
- R(i, g, o);
290
- }), Array.from(this.dateRangeFilters.entries()).filter(([, g]) => g.filterType !== void 0).forEach(([g, o]) => {
291
- o.filterType === "CUSTOM" ? R(i, g, {
292
- gte: o.gte.toString(),
293
- lte: o.lte.toString()
294
- }) : R(i, g, { relative: o.filterType });
295
- }), Array.from(this.numberRangeFilters.entries()).filter(([, g]) => g.isActive).forEach(([g, o]) => {
296
- const u = {};
297
- o.gte !== void 0 && (u.gte = o.gte), o.isValidLte && (u.lte = o.lte), R(i, g, u);
311
+ ([i, r]) => r !== "" && !t.includes(i) && !s.includes(i)
312
+ ).forEach(([i, r]) => {
313
+ P(o, i, r);
314
+ }), Array.from(this.arrayFilters.entries()).filter(([, i]) => i.length > 0).forEach(([i, r]) => {
315
+ P(o, i, r);
316
+ }), Array.from(this.dateRangeFilters.entries()).filter(([, i]) => i.filterType !== void 0).forEach(([i, r]) => {
317
+ r.filterType === "CUSTOM" ? P(o, i, {
318
+ gte: r.gte.toString(),
319
+ lte: r.lte.toString()
320
+ }) : P(o, i, { relative: r.filterType });
321
+ }), Array.from(this.numberRangeFilters.entries()).filter(([, i]) => i.isActive).forEach(([i, r]) => {
322
+ const m = {};
323
+ r.gte !== void 0 && (m.gte = r.gte), r.isValidLte && (m.lte = r.lte), P(o, i, m);
298
324
  });
299
- const f = {
300
- filter: i,
301
- [s]: String(this.pageSize),
325
+ const g = {
326
+ filter: o,
327
+ [n]: String(this.pageSize),
302
328
  [e]: String(this.currentPage)
303
329
  };
304
- return this.activeViewId && (f.view = this.activeViewId), f;
330
+ return this.activeViewId && (g.view = this.activeViewId), g;
305
331
  }
306
332
  get queryParams() {
307
- return T.stringify(this.queryParamsObject, {
333
+ return I.stringify(this.queryParamsObject, {
308
334
  arrayFormat: "brackets"
309
335
  });
310
336
  }
311
337
  get hasUnsavedChanges() {
312
- if (this.activeViewId === V) return !1;
313
- if (this.defaultPageSize !== this.pageSize) return !0;
314
- const { GROUP_MAP: t, SEARCH_FILTER_ID: l } = d.getBusinessLogic(), s = Array.from(t.values()).flatMap((n) => n.fields), e = new Set(s.map((n) => n.id));
315
- if (Array.from(this.filters.entries()).filter(([n]) => n !== l && e.has(n)).some(([n, r]) => {
316
- const a = this.defaultFilters.get(n);
317
- return a === void 0 && r !== "" || a !== void 0 && r !== a;
338
+ if (this.activeViewId === K) return !1;
339
+ if (this.defaultPageSize !== this.pageSize || this.tableStore && (this.tableStore.sortState.columnId !== this.defaultSortState.columnId || this.tableStore.sortState.direction !== this.defaultSortState.direction))
340
+ return !0;
341
+ const { GROUP_MAP: t, SEARCH_FILTER_ID: s } = S.getBusinessLogic(), n = Array.from(t.values()).flatMap((f) => f.fields), e = new Set(n.map((f) => f.id));
342
+ if (Array.from(this.filters.entries()).filter(([f]) => f !== s && e.has(f)).some(([f, l]) => {
343
+ const a = this.defaultFilters.get(f);
344
+ return a === void 0 && l !== "" || a !== void 0 && l !== a;
318
345
  }))
319
346
  return !0;
320
- const f = Array.from(this.defaultArrayFilters.entries()).filter(([n]) => e.has(n)).some(([n, r]) => {
321
- const a = this.defaultArrayFilters.get(n) || [];
322
- return r.length > 0 || a.length > 0 ? r.length !== a.length || !D(r, a) : !1;
323
- }), g = Array.from(this.arrayFilters.entries()).filter(([n]) => e.has(n)).some(([n, r]) => {
324
- const a = this.defaultArrayFilters.get(n) || [];
325
- return r.length > 0 || a.length > 0 ? r.length !== a.length || !D(r, a) : !1;
347
+ const g = Array.from(this.defaultArrayFilters.entries()).filter(([f]) => e.has(f)).some(([f, l]) => {
348
+ const a = this.defaultArrayFilters.get(f) || [];
349
+ return l.length > 0 || a.length > 0 ? l.length !== a.length || !N(l, a) : !1;
350
+ }), i = Array.from(this.arrayFilters.entries()).filter(([f]) => e.has(f)).some(([f, l]) => {
351
+ const a = this.defaultArrayFilters.get(f) || [];
352
+ return l.length > 0 || a.length > 0 ? l.length !== a.length || !N(l, a) : !1;
326
353
  });
327
- if (f || g)
354
+ if (g || i)
328
355
  return !0;
329
- const o = Array.from(this.numberRangeFilters.entries()).filter(([n]) => e.has(n)).some(([n, r]) => {
330
- const a = this.defaultNumberRangeFilters.get(n);
331
- return !r.isEqual(a);
356
+ const r = Array.from(this.numberRangeFilters.entries()).filter(([f]) => e.has(f)).some(([f, l]) => {
357
+ const a = this.defaultNumberRangeFilters.get(f);
358
+ return !l.isEqual(a);
332
359
  });
333
- if (Array.from(this.defaultNumberRangeFilters.entries()).filter(([n]) => e.has(n)).some(([n, r]) => {
334
- const a = this.numberRangeFilters.get(n);
335
- return !r.isEqual(a);
336
- }) || o)
360
+ if (Array.from(this.defaultNumberRangeFilters.entries()).filter(([f]) => e.has(f)).some(([f, l]) => {
361
+ const a = this.numberRangeFilters.get(f);
362
+ return !l.isEqual(a);
363
+ }) || r)
337
364
  return !0;
338
- const S = Array.from(this.defaultDateRangeFilters.entries()).filter(([n]) => e.has(n)).some(([n, r]) => {
339
- var p, A, y, E;
340
- const a = this.dateRangeFilters.get(n);
341
- return r != null && r.filterType && !(a != null && a.filterType) || a != null && a.filterType && !(r != null && r.filterType) || (a == null ? void 0 : a.filterType) !== (r == null ? void 0 : r.filterType) ? !0 : (a == null ? void 0 : a.filterType) === "CUSTOM" && (r == null ? void 0 : r.filterType) === "CUSTOM" ? ((p = r.gte) == null ? void 0 : p.toString()) !== ((A = a.gte) == null ? void 0 : A.toString()) || ((y = r.lte) == null ? void 0 : y.toString()) !== ((E = a.lte) == null ? void 0 : E.toString()) : !1;
365
+ const E = Array.from(this.defaultDateRangeFilters.entries()).filter(([f]) => e.has(f)).some(([f, l]) => {
366
+ var w, A, u, F;
367
+ const a = this.dateRangeFilters.get(f);
368
+ return l != null && l.filterType && !(a != null && a.filterType) || a != null && a.filterType && !(l != null && l.filterType) || (a == null ? void 0 : a.filterType) !== (l == null ? void 0 : l.filterType) ? !0 : (a == null ? void 0 : a.filterType) === "CUSTOM" && (l == null ? void 0 : l.filterType) === "CUSTOM" ? ((w = l.gte) == null ? void 0 : w.toString()) !== ((A = a.gte) == null ? void 0 : A.toString()) || ((u = l.lte) == null ? void 0 : u.toString()) !== ((F = a.lte) == null ? void 0 : F.toString()) : !1;
342
369
  });
343
- return Array.from(this.dateRangeFilters.entries()).filter(([n]) => e.has(n)).some(([n, r]) => {
344
- var p, A, y, E;
345
- const a = this.defaultDateRangeFilters.get(n);
346
- return r != null && r.filterType && !(a != null && a.filterType) || a != null && a.filterType && !(r != null && r.filterType) || (a == null ? void 0 : a.filterType) !== (r == null ? void 0 : r.filterType) ? !0 : (a == null ? void 0 : a.filterType) === "CUSTOM" && (r == null ? void 0 : r.filterType) === "CUSTOM" ? ((p = r.gte) == null ? void 0 : p.toString()) !== ((A = a.gte) == null ? void 0 : A.toString()) || ((y = r.lte) == null ? void 0 : y.toString()) !== ((E = a.lte) == null ? void 0 : E.toString()) : !1;
347
- }) || S;
370
+ return Array.from(this.dateRangeFilters.entries()).filter(([f]) => e.has(f)).some(([f, l]) => {
371
+ var w, A, u, F;
372
+ const a = this.defaultDateRangeFilters.get(f);
373
+ return l != null && l.filterType && !(a != null && a.filterType) || a != null && a.filterType && !(l != null && l.filterType) || (a == null ? void 0 : a.filterType) !== (l == null ? void 0 : l.filterType) ? !0 : (a == null ? void 0 : a.filterType) === "CUSTOM" && (l == null ? void 0 : l.filterType) === "CUSTOM" ? ((w = l.gte) == null ? void 0 : w.toString()) !== ((A = a.gte) == null ? void 0 : A.toString()) || ((u = l.lte) == null ? void 0 : u.toString()) !== ((F = a.lte) == null ? void 0 : F.toString()) : !1;
374
+ }) || E;
348
375
  }
349
376
  }
350
377
  export {
351
- ee as Filters
378
+ le as Filters
352
379
  };
package/dist/index79.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("@internationalized/date"),f=require("./index71.cjs"),F=require("./index70.cjs"),R=require("lodash/get"),A=require("./index104.cjs"),_=require("./index9.cjs"),T=r=>r&&r.__esModule?r:{default:r},n=T(R),h=({view:r,canUpdateCustomViews:g})=>{var u,c;const{DATE_RANGE_FILTERS:a,NUMBER_RANGE_FILTERS:o,GROUP_MAP:p}=_.BusinessLogicManager.getBusinessLogic(),s=Array.from(p.values()).flatMap(e=>e.fields),l=r.filters.filter||{},{colourPalette:m,customTextColour:b}=A.getViewTheme((u=r.view_attributes)==null?void 0:u.type);return{id:r.id,label:r.title,viewFilters:l,filterMaps:{filters:new Map(s.filter(e=>!a.includes(e.id)&&!o.includes(e.id)&&e.filterType!=="checkbox").map(e=>{const t=n.default(l,e.id);return[e.id,t!==void 0&&!Array.isArray(t)&&typeof t!="object"?String(t):""]}).filter(([,e])=>e!=="")),arrayFilters:new Map(s.filter(e=>e.filterType==="checkbox").map(e=>{const t=n.default(l,e.id);return[e.id,Array.isArray(t)?t:[]]}).filter(([,e])=>e.length>0)),rangeFilters:new Map(s.filter(e=>a.includes(e.id)).map(e=>{const t=n.default(l,e.id);if(!t)return null;let i;if(typeof t=="string")i=new f.RangeFilter(t);else if(typeof t=="object"&&t.gte&&t.lte){i=new f.RangeFilter("CUSTOM");const y=d.parseDate(t.gte),M=d.parseDate(t.lte);i.setDates(y,M)}else return null;return[e.id,i]}).filter(e=>e!==null)),numberRangeFilters:new Map(s.filter(e=>o.includes(e.id)).map(e=>{const t=n.default(l,e.id);if(!t||typeof t!="object")return null;const i=new F.NumberRangeFilter({filterId:e.id});return t.lte!==void 0&&i.setLte(Number(t.lte)),t.gte!==void 0&&i.setGte(Number(t.gte)),[e.id,i]}).filter(e=>e!==null))},page:r.filters.page,editable:r.editable&&g,isShared:r.shared,columns:r.columns,sort:(c=r.filters)==null?void 0:c.sort,colourPalette:m,customTextColour:b}};exports.viewsAdapter=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("@internationalized/date"),f=require("./index71.cjs"),F=require("./index70.cjs"),R=require("lodash/get"),A=require("./index101.cjs"),_=require("./index9.cjs"),T=r=>r&&r.__esModule?r:{default:r},n=T(R),h=({view:r,canUpdateCustomViews:g})=>{var u,c;const{DATE_RANGE_FILTERS:a,NUMBER_RANGE_FILTERS:o,GROUP_MAP:p}=_.BusinessLogicManager.getBusinessLogic(),s=Array.from(p.values()).flatMap(e=>e.fields),l=r.filters.filter||{},{colourPalette:m,customTextColour:b}=A.getViewTheme((u=r.view_attributes)==null?void 0:u.type);return{id:r.id,label:r.title,viewFilters:l,filterMaps:{filters:new Map(s.filter(e=>!a.includes(e.id)&&!o.includes(e.id)&&e.filterType!=="checkbox").map(e=>{const t=n.default(l,e.id);return[e.id,t!==void 0&&!Array.isArray(t)&&typeof t!="object"?String(t):""]}).filter(([,e])=>e!=="")),arrayFilters:new Map(s.filter(e=>e.filterType==="checkbox").map(e=>{const t=n.default(l,e.id);return[e.id,Array.isArray(t)?t:[]]}).filter(([,e])=>e.length>0)),rangeFilters:new Map(s.filter(e=>a.includes(e.id)).map(e=>{const t=n.default(l,e.id);if(!t)return null;let i;if(typeof t=="string")i=new f.RangeFilter(t);else if(typeof t=="object"&&t.gte&&t.lte){i=new f.RangeFilter("CUSTOM");const y=d.parseDate(t.gte),M=d.parseDate(t.lte);i.setDates(y,M)}else return null;return[e.id,i]}).filter(e=>e!==null)),numberRangeFilters:new Map(s.filter(e=>o.includes(e.id)).map(e=>{const t=n.default(l,e.id);if(!t||typeof t!="object")return null;const i=new F.NumberRangeFilter({filterId:e.id});return t.lte!==void 0&&i.setLte(Number(t.lte)),t.gte!==void 0&&i.setGte(Number(t.gte)),[e.id,i]}).filter(e=>e!==null))},page:r.filters.page,editable:r.editable&&g,isShared:r.shared,columns:r.columns,sort:(c=r.filters)==null?void 0:c.sort,colourPalette:m,customTextColour:b}};exports.viewsAdapter=h;
package/dist/index79.js CHANGED
@@ -2,7 +2,7 @@ import { parseDate as c } from "@internationalized/date";
2
2
  import { RangeFilter as p } from "./index71.js";
3
3
  import { NumberRangeFilter as M } from "./index70.js";
4
4
  import n from "lodash/get";
5
- import { getViewTheme as F } from "./index104.js";
5
+ import { getViewTheme as F } from "./index101.js";
6
6
  import { BusinessLogicManager as R } from "./index9.js";
7
7
  const S = ({
8
8
  view: r,
package/dist/index87.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("@veeqo/ui"),t=require("react"),j=require("./index92.cjs"),o=require("./index93.cjs"),w=require("./index94.cjs"),T=require("./index95.cjs"),r=require("./index96.cjs"),D=require("./index97.cjs"),V=require("./index49.cjs"),b=require("./index98.cjs"),H=({onClose:u,columnDefinitions:I,hiddenColumns:d,visibleColumns:m,pinnedLeftColumnIds:G,pinnedRightColumnIds:f})=>{const[c,p]=t.useState(""),a=t.useMemo(()=>new Map(I.map(s=>[s.id,s])),[]),[i,C]=t.useState(()=>({[r.ColumnGroupIds.Hidden]:d,[r.ColumnGroupIds.Visible]:m})),y=t.useMemo(()=>{const s=i[r.ColumnGroupIds.Visible].map(l=>a.get(`${l}`));return b.filterColumnsBySearch(s,c)},[i,a,c]),v=t.useMemo(()=>{const s=i[r.ColumnGroupIds.Hidden].map(l=>a.get(`${l}`));return b.filterColumnsBySearch(s,c)},[i,a,c]),{isSavingColumns:h,saveColumns:M}=D.usePersistColumns({pinnedLeftColumnIds:G,pinnedRightColumnIds:f}),k=()=>{p(""),C({[r.ColumnGroupIds.Hidden]:d,[r.ColumnGroupIds.Visible]:m})},x=t.useCallback(s=>{if(p(s),!s){const l=new Set([...d,...m]);C(S=>({[r.ColumnGroupIds.Hidden]:S[r.ColumnGroupIds.Hidden].filter(g=>l.has(`${g}`)),[r.ColumnGroupIds.Visible]:S[r.ColumnGroupIds.Visible].filter(g=>l.has(`${g}`))}))}},[d,m]),q=t.useCallback(s=>{const l=a.get(`${s}`);return l?e.jsx(T.ColumnItem,{column:l,isDragOverlay:!0}):null},[a]);return e.jsx(n.Modal,{variant:"lg",style:{overflowY:"hidden"},shouldShow:!0,onClose:()=>u==null?void 0:u(),headerSlot:e.jsxs(o.HeaderContainer,{children:[e.jsxs(n.Stack,{direction:"horizontal",alignX:"between",alignY:"center",children:[e.jsxs(n.Stack,{direction:"horizontal",alignX:"start",alignY:"center",spacing:"sm",children:[e.jsx(n.ListBoardIcon,{height:n.theme.sizes.lg,width:n.theme.sizes.lg}),e.jsx(n.Text,{variant:"headingLarge",as:"h1",children:"Table management"})]}),e.jsx(n.Button,{"aria-label":"Close modal",onClick:u,variant:"flat",iconSlot:e.jsx(n.CloseIcon,{})})]}),e.jsxs(n.Text,{variant:"subheadingMedium",children:["Show, hide, or change the order of the columns in the view, so you always see the data that's most important to you. Learn more with our"," ",e.jsx(n.Anchor,{href:V.helpGuideUrls.ORDER_VIEWS_AND_TABLE_CUSTOMIZATION,target:"_blank",children:"help guide"}),"."]}),e.jsx(n.Text,{variant:"headingSmall",children:"Column management"}),e.jsx(o.ColumnSearch,{name:"column-search-query",placeholder:"Search",value:c,onChange:x,onClearClick:()=>x(""),fill:"100%"})]}),leftActions:[{label:"Reset",onClick:k,variant:"default",disabled:h}],rightActions:[{label:"Cancel",onClick:u,variant:"default",disabled:h},{label:"Save",onClick:()=>M({visibleColumns:i[r.ColumnGroupIds.Visible]}),variant:"primary",disabled:h,loading:h}],children:e.jsx(n.Stack,{spacing:"md",alignX:"stretch",children:e.jsx(n.Stack,{spacing:4,alignX:"stretch",children:e.jsx(w.DndContainer,{items:i,setItems:C,renderDragOverlay:q,children:e.jsx(o.Container,{children:e.jsxs(o.ColumnGroupsGrid,{columns:2,spacing:"xl",children:[e.jsx(j.ColumnGroup,{id:r.ColumnGroupIds.Visible,title:"Shown columns:",columns:y}),e.jsx(o.VerticalSeparator,{children:e.jsx(o.VerticalText,{children:"Drag & Drop columns"})}),e.jsx(j.ColumnGroup,{id:r.ColumnGroupIds.Hidden,title:"Hidden columns:",columns:v})]})})})})})})};exports.TableManagementModal=H;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="_actionsHeaderContainer_fgqms_1",t={actionsHeaderContainer:e};exports.actionsHeaderContainer=e;exports.default=t;