@veeqo/transfigure 1.0.0 → 1.1.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 (151) hide show
  1. package/dist/hooks/index.d.ts +1 -0
  2. package/dist/hooks/useUrlChange/index.d.ts +1 -0
  3. package/dist/hooks/useUrlChange/useUrlChange.d.ts +7 -0
  4. package/dist/hooks/useViewCountsHook/useViewCountsHook.d.ts +1 -1
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.js +52 -50
  7. package/dist/index100.cjs +1 -19
  8. package/dist/index100.js +28 -23
  9. package/dist/index102.cjs +1 -1
  10. package/dist/index102.js +24 -2
  11. package/dist/index103.cjs +1 -1
  12. package/dist/index103.js +1 -1
  13. package/dist/index104.cjs +1 -1
  14. package/dist/index104.js +1 -1
  15. package/dist/index107.cjs +1 -13
  16. package/dist/index107.js +2 -17
  17. package/dist/index108.cjs +13 -1
  18. package/dist/index108.js +14 -33
  19. package/dist/index110.cjs +1 -7
  20. package/dist/index110.js +36 -10
  21. package/dist/index111.cjs +7 -1
  22. package/dist/index111.js +10 -63
  23. package/dist/index112.cjs +1 -1
  24. package/dist/index112.js +58 -42
  25. package/dist/index113.cjs +1 -0
  26. package/dist/index113.js +49 -0
  27. package/dist/index15.cjs +1 -1
  28. package/dist/index15.js +1 -1
  29. package/dist/index19.cjs +1 -1
  30. package/dist/index19.js +1 -1
  31. package/dist/index20.cjs +1 -1
  32. package/dist/index20.js +2 -2
  33. package/dist/index21.cjs +1 -1
  34. package/dist/index21.js +2 -2
  35. package/dist/index24.cjs +1 -1
  36. package/dist/index24.js +2 -2
  37. package/dist/index25.cjs +1 -1
  38. package/dist/index25.js +2 -2
  39. package/dist/index27.cjs +1 -1
  40. package/dist/index27.js +1 -1
  41. package/dist/index29.cjs +1 -1
  42. package/dist/index29.js +2 -2
  43. package/dist/index32.cjs +1 -1
  44. package/dist/index32.js +1 -1
  45. package/dist/index34.cjs +1 -1
  46. package/dist/index34.js +4 -4
  47. package/dist/index36.cjs +1 -1
  48. package/dist/index36.js +1 -1
  49. package/dist/index37.cjs +1 -1
  50. package/dist/index37.js +1 -1
  51. package/dist/index38.cjs +1 -1
  52. package/dist/index38.js +1 -1
  53. package/dist/index39.cjs +1 -1
  54. package/dist/index39.js +2 -2
  55. package/dist/index42.cjs +1 -1
  56. package/dist/index42.js +1 -1
  57. package/dist/index44.cjs +1 -1
  58. package/dist/index44.js +2 -2
  59. package/dist/index45.cjs +1 -1
  60. package/dist/index45.js +3 -3
  61. package/dist/index54.cjs +1 -1
  62. package/dist/index54.js +3 -3
  63. package/dist/index56.cjs +1 -1
  64. package/dist/index56.js +2 -2
  65. package/dist/index57.cjs +1 -1
  66. package/dist/index57.js +2 -2
  67. package/dist/index58.cjs +1 -1
  68. package/dist/index58.js +2 -2
  69. package/dist/index6.cjs +1 -1
  70. package/dist/index6.js +4 -4
  71. package/dist/index60.cjs +1 -1
  72. package/dist/index60.js +3 -3
  73. package/dist/index61.cjs +1 -1
  74. package/dist/index61.js +2 -2
  75. package/dist/index62.cjs +1 -1
  76. package/dist/index62.js +22 -18
  77. package/dist/index63.cjs +1 -1
  78. package/dist/index63.js +16 -26
  79. package/dist/index64.cjs +1 -1
  80. package/dist/index64.js +26 -10
  81. package/dist/index65.cjs +1 -1
  82. package/dist/index65.js +13 -326
  83. package/dist/index66.cjs +1 -1
  84. package/dist/index66.js +321 -55
  85. package/dist/index67.cjs +1 -1
  86. package/dist/index67.js +50 -47
  87. package/dist/index68.cjs +1 -1
  88. package/dist/index68.js +51 -32
  89. package/dist/index69.cjs +1 -1
  90. package/dist/index69.js +30 -24
  91. package/dist/index70.cjs +1 -1
  92. package/dist/index70.js +26 -32
  93. package/dist/index71.cjs +1 -1
  94. package/dist/index71.js +37 -12
  95. package/dist/index72.cjs +1 -1
  96. package/dist/index72.js +13 -9
  97. package/dist/index73.cjs +1 -1
  98. package/dist/index73.js +9 -17
  99. package/dist/index74.cjs +1 -1
  100. package/dist/index74.js +14 -16
  101. package/dist/index75.cjs +1 -1
  102. package/dist/index75.js +18 -49
  103. package/dist/index76.cjs +1 -1
  104. package/dist/index76.js +50 -21
  105. package/dist/index77.cjs +1 -1
  106. package/dist/index77.js +21 -7
  107. package/dist/index78.cjs +1 -1
  108. package/dist/index78.js +7 -2
  109. package/dist/index79.cjs +1 -1
  110. package/dist/index79.js +2 -9
  111. package/dist/index80.cjs +1 -3
  112. package/dist/index80.js +8 -13
  113. package/dist/index81.cjs +3 -1
  114. package/dist/index81.js +13 -8
  115. package/dist/index82.cjs +1 -11
  116. package/dist/index82.js +9 -16
  117. package/dist/index83.cjs +11 -1
  118. package/dist/index83.js +16 -41
  119. package/dist/index84.cjs +1 -1
  120. package/dist/index84.js +40 -8
  121. package/dist/index85.cjs +1 -1
  122. package/dist/index85.js +9 -118
  123. package/dist/index86.cjs +1 -1
  124. package/dist/index86.js +117 -18
  125. package/dist/index87.cjs +1 -1
  126. package/dist/index87.js +19 -13
  127. package/dist/index88.cjs +1 -104
  128. package/dist/index88.js +13 -120
  129. package/dist/index89.cjs +104 -1
  130. package/dist/index89.js +117 -65
  131. package/dist/index90.cjs +1 -1
  132. package/dist/index90.js +63 -24
  133. package/dist/index91.cjs +1 -1
  134. package/dist/index91.js +29 -2
  135. package/dist/index92.cjs +1 -1
  136. package/dist/index92.js +2 -41
  137. package/dist/index93.cjs +1 -1
  138. package/dist/index93.js +39 -9
  139. package/dist/index94.cjs +1 -1
  140. package/dist/index94.js +10 -23
  141. package/dist/index95.cjs +1 -12
  142. package/dist/index95.js +21 -16
  143. package/dist/index96.cjs +19 -1
  144. package/dist/index96.js +24 -33
  145. package/dist/index97.cjs +1 -1
  146. package/dist/index97.js +12 -26
  147. package/dist/index98.cjs +12 -1
  148. package/dist/index98.js +16 -21
  149. package/dist/index99.cjs +1 -1
  150. package/dist/index99.js +32 -14
  151. package/package.json +1 -1
package/dist/index66.js CHANGED
@@ -1,62 +1,328 @@
1
- var b = Object.defineProperty;
2
- var v = (l, t, i) => t in l ? b(l, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : l[t] = i;
3
- var e = (l, t, i) => v(l, typeof t != "symbol" ? t + "" : t, i);
4
- import { makeObservable as L, action as n, observable as h, computed as c } from "mobx";
5
- import { BusinessLogicManager as x } from "./index8.js";
6
- class u {
7
- constructor({ filterId: t }) {
8
- e(this, "filterId");
9
- e(this, "gteMinLabel");
10
- e(this, "gteMin");
11
- e(this, "lteMaxLabel");
12
- e(this, "lteMax");
13
- e(this, "gte");
14
- e(this, "lte");
15
- e(this, "setGte", (t) => {
16
- this.gte = t;
17
- });
18
- e(this, "setLte", (t) => {
19
- this.lte = t;
20
- });
21
- e(this, "clear", () => {
22
- this.setGte(void 0), this.setLte(void 0);
23
- });
24
- e(this, "clone", () => {
25
- const t = new u({ filterId: this.filterId });
26
- return t.setGte(this.gte), t.setLte(this.lte), t;
27
- });
28
- e(this, "isEqual", (t) => !(!t || this.lte !== t.lte || this.gte !== t.gte));
29
- var a, o;
30
- L(this, {
31
- filterId: h,
32
- filterLabel: c,
33
- gte: h,
34
- lte: h,
35
- lteMax: h,
36
- gteMin: h,
37
- setGte: n,
38
- setLte: n,
39
- clear: n
40
- }), this.filterId = t;
41
- const { FIELDS_MAP: i } = x.getBusinessLogic(), s = i.get(this.filterId), f = (a = s == null ? void 0 : s.options) == null ? void 0 : a.every(
42
- (r) => r.value && Number.isInteger(Number(r.value))
43
- );
44
- if (s && f && ((o = s.options) == null ? void 0 : o.length) === 2) {
45
- const [r, g] = s.options, M = Number(r.value), d = Number(g.value);
46
- this.gteMin = M, this.gteMinLabel = r.label, this.lteMax = d, this.lteMaxLabel = g.label;
47
- } else
48
- this.gte = 0, this.gteMin = 0, this.gteMinLabel = "Min.", this.lte = 100, this.lteMax = 100, this.lteMaxLabel = "Max.";
1
+ var L = Object.defineProperty;
2
+ var C = (E, t, l) => t in E ? L(E, t, { enumerable: !0, configurable: !0, writable: !0, value: l }) : E[t] = l;
3
+ var h = (E, t, l) => C(E, typeof t != "symbol" ? t + "" : t, l);
4
+ import { makeObservable as G, computed as M, action as g, observable as c } from "mobx";
5
+ import { DateRanges as O } from "@veeqo/ui";
6
+ import { parseDate as D } from "@internationalized/date";
7
+ import U from "lodash/isEqual";
8
+ import { FilterChoiceValue as d } from "./index47.js";
9
+ import { RangeFilter as w } from "./index68.js";
10
+ import { NumberRangeFilter as N } from "./index67.js";
11
+ import { ALL_VIEW_ID as v } from "./index77.js";
12
+ import { isValidDateRange as B } from "./index75.js";
13
+ import { BusinessLogicManager as m } from "./index8.js";
14
+ class W {
15
+ constructor() {
16
+ // PAGINATION
17
+ h(this, "defaultPageSize");
18
+ h(this, "pageSize");
19
+ h(this, "currentPage");
20
+ // DEFAULT FILTERS
21
+ h(this, "defaultFilters");
22
+ h(this, "defaultArrayFilters");
23
+ h(this, "defaultDateRangeFilters");
24
+ h(this, "defaultNumberRangeFilters");
25
+ // CURRENT FILTERS
26
+ h(this, "filters");
27
+ h(this, "arrayFilters");
28
+ h(this, "dateRangeFilters");
29
+ h(this, "numberRangeFilters");
30
+ // VIEWS
31
+ h(this, "activeViewId");
32
+ // VISIBILITY STATE
33
+ h(this, "isFiltersDropdownVisible");
34
+ h(this, "initDefaultFilterMaps", () => {
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
+ });
37
+ h(this, "updateUrl", (t = !1) => {
38
+ try {
39
+ const { SORT_FILTER_ID: l } = m.getBusinessLogic(), e = new URLSearchParams(window.location.search).get(l);
40
+ let i;
41
+ if (e) {
42
+ const n = this.queryParamsObject;
43
+ n.set(l, e), i = `${window.location.pathname}?${n.toString()}`;
44
+ } else
45
+ i = `${window.location.pathname}?${this.queryParams}`;
46
+ t ? window.history.pushState({}, "", i) : window.history.replaceState({}, "", i);
47
+ } catch (l) {
48
+ console.log(l);
49
+ }
50
+ });
51
+ // PAGINATION
52
+ h(this, "setCurrentPage", (t) => {
53
+ this.currentPage = t;
54
+ });
55
+ h(this, "setPageSize", (t) => {
56
+ this.pageSize = t, this.updateUrl();
57
+ });
58
+ // TEXT FILTERS
59
+ h(this, "setFilter", (t, l) => {
60
+ this.filters.set(t, l), this.updateUrl();
61
+ });
62
+ h(this, "clearFilter", (t) => {
63
+ this.filters.set(t, ""), this.updateUrl();
64
+ });
65
+ // ARRAY FILTERS
66
+ h(this, "setArrayFilter", (t, l) => {
67
+ this.arrayFilters.set(t, l), this.updateUrl();
68
+ });
69
+ h(this, "clearArrayFilter", (t) => {
70
+ this.arrayFilters.set(t, []), this.updateUrl();
71
+ });
72
+ // RANGE FILTERS
73
+ h(this, "setRangeFilter", ({
74
+ key: t,
75
+ range: l,
76
+ dates: s
77
+ }) => {
78
+ l.setFilterType(t), l.setDates(s.start, s.end), this.updateUrl();
79
+ });
80
+ h(this, "clearRangeFilter", (t) => {
81
+ const l = this.dateRangeFilters.get(t);
82
+ l && (l.clear(), this.updateUrl());
83
+ });
84
+ // NUMBER RANGE FILTERS
85
+ h(this, "setNumberRangeFilter", ({
86
+ numberRange: t,
87
+ gte: l,
88
+ lte: s
89
+ }) => {
90
+ t.setGte(l), t.setLte(s), this.updateUrl();
91
+ });
92
+ h(this, "clearNumberRangeFilter", (t) => {
93
+ const l = this.numberRangeFilters.get(t);
94
+ l && (l.clear(), this.updateUrl());
95
+ });
96
+ // CLEARING ALL FILTERS
97
+ h(this, "clearAllFilters", (t = !1) => {
98
+ const { SEARCH_FILTER_ID: l } = m.getBusinessLogic();
99
+ this.filters.forEach((s, e) => {
100
+ e !== l && this.filters.set(e, "");
101
+ }), this.arrayFilters.forEach((s, e) => this.arrayFilters.set(e, [])), this.dateRangeFilters.forEach((s) => s.clear()), this.numberRangeFilters.forEach((s) => s.clear()), t || this.updateUrl();
102
+ });
103
+ h(this, "clearFiltersForGroup", (t) => {
104
+ const { GROUP_MAP: l } = m.getBusinessLogic(), s = l.get(t);
105
+ s && s.fields.forEach((e) => {
106
+ 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);
107
+ });
108
+ });
109
+ // VIEWS
110
+ h(this, "setActiveViewId", (t) => {
111
+ this.activeViewId = t, this.updateUrl();
112
+ });
113
+ // VISIBILITY
114
+ h(this, "toggleFiltersDropdownVisible", (t) => {
115
+ this.isFiltersDropdownVisible = t;
116
+ });
117
+ // FILTER GROUPS
118
+ h(this, "getFiltersForGroup", (t) => {
119
+ const { GROUP_MAP: l } = m.getBusinessLogic(), s = l.get(t);
120
+ if (!s) return {};
121
+ const e = {};
122
+ return s.fields.forEach((i) => {
123
+ 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);
124
+ }), e;
125
+ });
126
+ h(this, "initFiltersFromView", (t) => {
127
+ var s;
128
+ const { PAGE_SIZE_OPTIONS: l } = m.getBusinessLogic();
129
+ (s = t.page) != null && s.size && l.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(
130
+ Array.from(t.filterMaps.rangeFilters.entries()).map(([e, i]) => {
131
+ const n = new w(i.filterType);
132
+ return i.gte && i.lte && n.setDates(i.gte, i.lte), [e, n];
133
+ })
134
+ ), this.defaultNumberRangeFilters = new Map(
135
+ Array.from(t.filterMaps.numberRangeFilters.entries()).map(([e, i]) => {
136
+ const n = i.clone();
137
+ return i.gte && n.setGte(i.gte), i.lte && n.setLte(i.lte), [e, n];
138
+ })
139
+ ), this.filters = new Map(t.filterMaps.filters), this.arrayFilters = new Map(t.filterMaps.arrayFilters), this.dateRangeFilters = new Map(
140
+ Array.from(t.filterMaps.rangeFilters.entries()).map(([e, i]) => {
141
+ const n = new w(i.filterType);
142
+ return i.gte && i.lte && n.setDates(i.gte, i.lte), [e, n];
143
+ })
144
+ ), this.numberRangeFilters = new Map(
145
+ Array.from(t.filterMaps.numberRangeFilters.entries()).map(([e, i]) => {
146
+ const n = i.clone();
147
+ return i.gte && n.setGte(i.gte), i.lte && n.setLte(i.lte), [e, n];
148
+ })
149
+ ), this.activeViewId = t.id;
150
+ });
151
+ h(this, "initFromUrl", (t = !0) => {
152
+ const { GROUP_MAP: l, NUMBER_RANGE_FILTERS: s, PAGE_SIZE_OPTIONS: e, PAGE_SIZE_FILTER_ID: i } = m.getBusinessLogic(), n = new URLSearchParams(window.location.search), f = Array.from(l.values()).flatMap((r) => r.fields), F = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map(), T = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
153
+ Array.from(n.entries()).forEach(([r, a]) => {
154
+ (r.includes("_gte") || r.includes("_lte")) && o.set(r, a);
155
+ }), Array.from(n.entries()).forEach(([r, a]) => {
156
+ if (r === "view" && t) {
157
+ this.activeViewId = a;
158
+ return;
159
+ }
160
+ if (r === i && e.includes(Number(a))) {
161
+ this.pageSize = Number(a);
162
+ return;
163
+ }
164
+ let p = f.find((u) => u.id === r);
165
+ if (!p) {
166
+ const u = r.replace(/_[gl]te$/, "");
167
+ s.includes(u) && (p = f.find((y) => y.id === u));
168
+ }
169
+ if (p)
170
+ switch (p.filterType) {
171
+ case d.CHECKBOX:
172
+ a && R.set(r, a.split(","));
173
+ break;
174
+ case d.DATE_RANGE:
175
+ let u;
176
+ if (a === "CUSTOM") {
177
+ u = new w("CUSTOM");
178
+ const I = o.get(`${r}_gte`), P = o.get(`${r}_lte`);
179
+ I && P && u.setDates(D(I), D(P));
180
+ } else B(a) ? u = new w(a) : u = new w(O.TODAY);
181
+ S.set(r, u);
182
+ break;
183
+ case d.NUMBER_RANGE:
184
+ const y = new N({ filterId: p.id }), A = r.replace(/_[gl]te$/, ""), b = o.get(`${A}_gte`), _ = o.get(`${A}_lte`);
185
+ b && y.setGte(Number(b)), _ && y.setLte(Number(_)), T.set(A, y);
186
+ break;
187
+ case d.TEXT:
188
+ case d.NUMBER:
189
+ case d.RADIO:
190
+ F.set(r, a);
191
+ break;
192
+ }
193
+ }), this.filters = F, this.arrayFilters = R, this.dateRangeFilters = S, this.numberRangeFilters = T, this.updateUrl();
194
+ });
195
+ h(this, "discardChanges", (t = !1) => {
196
+ this.pageSize = this.defaultPageSize;
197
+ const { SEARCH_FILTER_ID: l } = m.getBusinessLogic(), s = new Map(this.defaultFilters);
198
+ 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) => {
199
+ const n = new w(e.filterType);
200
+ n.setDates(e.gte, e.lte), this.dateRangeFilters.set(i, n);
201
+ }), this.numberRangeFilters.clear(), this.defaultNumberRangeFilters.forEach((e, i) => {
202
+ this.numberRangeFilters.set(i, e.clone());
203
+ }), this.updateUrl(t);
204
+ });
205
+ const { GROUP_MAP: t } = m.getBusinessLogic(), l = Array.from(t.values()).flatMap((s) => s.fields);
206
+ this.filters = new Map(
207
+ l.filter(
208
+ (s) => s.filterType === d.TEXT || s.filterType === d.NUMBER || s.filterType === d.RADIO || s.filterType === d.DATE_RANGE
209
+ ).map((s) => [s.id, ""])
210
+ ), this.arrayFilters = new Map(
211
+ l.filter((s) => s.filterType === d.CHECKBOX).map((s) => [s.id, []])
212
+ ), this.dateRangeFilters = new Map(
213
+ l.filter((s) => s.filterType === d.DATE_RANGE).map((s) => [s.id, new w()])
214
+ ), this.numberRangeFilters = new Map(
215
+ l.filter((s) => s.filterType === d.NUMBER_RANGE).map((s) => {
216
+ const e = new N({ filterId: s.id });
217
+ return [s.id, e];
218
+ })
219
+ ), 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, {
220
+ defaultPageSize: c,
221
+ pageSize: c,
222
+ currentPage: c,
223
+ defaultFilters: c,
224
+ defaultArrayFilters: c,
225
+ defaultDateRangeFilters: c,
226
+ defaultNumberRangeFilters: c,
227
+ filters: c,
228
+ arrayFilters: c,
229
+ numberRangeFilters: c,
230
+ dateRangeFilters: c,
231
+ isFiltersDropdownVisible: c,
232
+ activeViewId: c,
233
+ setPageSize: g,
234
+ setCurrentPage: g,
235
+ toggleFiltersDropdownVisible: g,
236
+ setActiveViewId: g,
237
+ setFilter: g,
238
+ setArrayFilter: g,
239
+ setRangeFilter: g,
240
+ setNumberRangeFilter: g,
241
+ clearFilter: g,
242
+ clearArrayFilter: g,
243
+ clearRangeFilter: g,
244
+ clearNumberRangeFilter: g,
245
+ clearAllFilters: g,
246
+ getFiltersForGroup: g,
247
+ clearFiltersForGroup: g,
248
+ initFromUrl: g,
249
+ initFiltersFromView: g,
250
+ initDefaultFilterMaps: g,
251
+ discardChanges: g,
252
+ updateUrl: g,
253
+ hasActiveFilters: M,
254
+ activeFilterKeysList: M,
255
+ queryParamsObject: M,
256
+ queryParams: M,
257
+ hasUnsavedChanges: M
258
+ });
259
+ }
260
+ get hasActiveFilters() {
261
+ const { GROUP_MAP: t } = m.getBusinessLogic(), l = Array.from(t.values()).flatMap((e) => e.fields), s = new Set(l.map((e) => e.id));
262
+ 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);
263
+ }
264
+ get activeFilterKeysList() {
265
+ const { DATE_RANGE_FILTERS: t, NUMBER_RANGE_FILTERS: l } = m.getBusinessLogic(), s = Array.from(this.filters.entries()).filter(
266
+ ([F, R]) => R !== "" && !t.includes(F) && !l.includes(F)
267
+ ).map(([F]) => F), e = Array.from(this.arrayFilters.entries()).filter(([, F]) => F.length > 0).map(([F]) => F), i = 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);
268
+ return [.../* @__PURE__ */ new Set([...s, ...e, ...i, ...n])];
49
269
  }
50
- get isValidLte() {
51
- return !(this.lte === void 0 || this.lte === this.lteMax);
270
+ get queryParamsObject() {
271
+ const { DATE_RANGE_FILTERS: t, NUMBER_RANGE_FILTERS: l, PAGE_SIZE_FILTER_ID: s, PAGE_NUMBER_FILTER_ID: e } = m.getBusinessLogic(), i = new URLSearchParams();
272
+ return Array.from(this.filters.entries()).filter(
273
+ ([n, f]) => f !== "" && !t.includes(n) && !l.includes(n)
274
+ ).forEach(([n, f]) => {
275
+ i.append(n, f);
276
+ }), Array.from(this.arrayFilters.entries()).filter(([, n]) => n.length > 0).forEach(([n, f]) => {
277
+ i.append(n, f.join(","));
278
+ }), Array.from(this.dateRangeFilters.entries()).filter(([, n]) => n.filterType !== void 0).forEach(([n, f]) => {
279
+ i.set(n, f.filterType), f.filterType === "CUSTOM" && (i.set(`${n}_gte`, f.gte.toString()), i.set(`${n}_lte`, f.lte.toString()));
280
+ }), Array.from(this.numberRangeFilters.entries()).filter(([, n]) => n.isActive).forEach(([n, f]) => {
281
+ f.gte !== void 0 && i.set(`${n}_gte`, f.gte.toString()), f.isValidLte && i.set(`${n}_lte`, f.lte.toString());
282
+ }), this.activeViewId && i.set("view", this.activeViewId), i.set(s, this.pageSize.toString()), i.set(e, this.currentPage.toString()), i;
52
283
  }
53
- get filterLabel() {
54
- return this.gte === void 0 && this.lte === void 0 ? "" : this.isValidLte ? `Between ${this.gte} and ${this.lte}` : this.gte !== void 0 ? `${this.gte} or more` : "";
284
+ get queryParams() {
285
+ return this.queryParamsObject.toString();
55
286
  }
56
- get isActive() {
57
- return this.gte === this.gteMin && this.lte === this.lteMax || this.gte === this.lte || this.gte === void 0 && this.lte === void 0 ? !1 : this.gte !== void 0 ? !0 : this.lte !== void 0 && this.lte < this.lteMax;
287
+ get hasUnsavedChanges() {
288
+ if (this.activeViewId === v) return !1;
289
+ if (this.defaultPageSize !== this.pageSize) return !0;
290
+ const { GROUP_MAP: t, SEARCH_FILTER_ID: l } = m.getBusinessLogic(), s = Array.from(t.values()).flatMap((o) => o.fields), e = new Set(s.map((o) => o.id));
291
+ if (Array.from(this.filters.entries()).filter(([o]) => o !== l && e.has(o)).some(([o, r]) => {
292
+ const a = this.defaultFilters.get(o);
293
+ return a === void 0 && r !== "" || a !== void 0 && r !== a;
294
+ }))
295
+ return !0;
296
+ const n = Array.from(this.defaultArrayFilters.entries()).filter(([o]) => e.has(o)).some(([o, r]) => {
297
+ const a = this.defaultArrayFilters.get(o) || [];
298
+ return r.length > 0 || a.length > 0 ? r.length !== a.length || !U(r, a) : !1;
299
+ }), f = Array.from(this.arrayFilters.entries()).filter(([o]) => e.has(o)).some(([o, r]) => {
300
+ const a = this.defaultArrayFilters.get(o) || [];
301
+ return r.length > 0 || a.length > 0 ? r.length !== a.length || !U(r, a) : !1;
302
+ });
303
+ if (n || f)
304
+ return !0;
305
+ const F = Array.from(this.numberRangeFilters.entries()).filter(([o]) => e.has(o)).some(([o, r]) => {
306
+ const a = this.defaultNumberRangeFilters.get(o);
307
+ return !r.isEqual(a);
308
+ });
309
+ if (Array.from(this.defaultNumberRangeFilters.entries()).filter(([o]) => e.has(o)).some(([o, r]) => {
310
+ const a = this.numberRangeFilters.get(o);
311
+ return !r.isEqual(a);
312
+ }) || F)
313
+ return !0;
314
+ const S = Array.from(this.defaultDateRangeFilters.entries()).filter(([o]) => e.has(o)).some(([o, r]) => {
315
+ var p, u, y, A;
316
+ const a = this.dateRangeFilters.get(o);
317
+ 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()) !== ((u = a.gte) == null ? void 0 : u.toString()) || ((y = r.lte) == null ? void 0 : y.toString()) !== ((A = a.lte) == null ? void 0 : A.toString()) : !1;
318
+ });
319
+ return Array.from(this.dateRangeFilters.entries()).filter(([o]) => e.has(o)).some(([o, r]) => {
320
+ var p, u, y, A;
321
+ const a = this.defaultDateRangeFilters.get(o);
322
+ 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()) !== ((u = a.gte) == null ? void 0 : u.toString()) || ((y = r.lte) == null ? void 0 : y.toString()) !== ((A = a.lte) == null ? void 0 : A.toString()) : !1;
323
+ }) || S;
58
324
  }
59
325
  }
60
326
  export {
61
- u as NumberRangeFilter
327
+ W as Filters
62
328
  };
package/dist/index67.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var c=Object.defineProperty;var g=(r,e,t)=>e in r?c(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var i=(r,e,t)=>g(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("mobx"),a=require("@veeqo/ui"),l=require("./index46.cjs"),o=require("./index8.cjs");class u{constructor(e){i(this,"filterType");i(this,"gte");i(this,"lte");i(this,"setFilterType",e=>{if(e===this.filterType)return;const t=e||l.DateValue.TODAY;if(this.filterType=t,t!=="CUSTOM"){const n=a.getDateRange(t);n&&(this.gte=n.start,this.lte=n.end)}});i(this,"setDates",(e,t)=>{this.gte=e,this.lte=t});i(this,"clear",()=>{this.filterType=void 0;const{DEFAULT_DATE_RANGE:e}=o.BusinessLogicManager.getBusinessLogic();e&&this.setDates(e.start,e.end)});s.makeObservable(this,{filterType:s.observable,gte:s.observable,lte:s.observable,filterSelection:s.computed,filterLabel:s.computed,selectedRange:s.computed,setFilterType:s.action,setDates:s.action,clear:s.action});const t=e&&e!=="CUSTOM"?a.getDateRange(e):null,{DEFAULT_DATE_RANGE:n}=o.BusinessLogicManager.getBusinessLogic();this.filterType=e,this.gte=(t==null?void 0:t.start)??n.start,this.lte=(t==null?void 0:t.end)??n.end}get filterSelection(){const{DEFAULT_DATE_PRESET:e}=o.BusinessLogicManager.getBusinessLogic();return this.filterType?l.DateOptionMap.get(this.filterType)??e:e}get filterLabel(){return this.filterSelection.label}get selectedRange(){return{start:this.gte,end:this.lte}}}exports.RangeFilter=u;
1
+ "use strict";var c=Object.defineProperty;var M=(r,e,s)=>e in r?c(r,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[e]=s;var t=(r,e,s)=>M(r,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("mobx"),d=require("./index8.cjs");class n{constructor({filterId:e}){t(this,"filterId");t(this,"gteMinLabel");t(this,"gteMin");t(this,"lteMaxLabel");t(this,"lteMax");t(this,"gte");t(this,"lte");t(this,"setGte",e=>{this.gte=e});t(this,"setLte",e=>{this.lte=e});t(this,"clear",()=>{this.setGte(void 0),this.setLte(void 0)});t(this,"clone",()=>{const e=new n({filterId:this.filterId});return e.setGte(this.gte),e.setLte(this.lte),e});t(this,"isEqual",e=>!(!e||this.lte!==e.lte||this.gte!==e.gte));var h,o;i.makeObservable(this,{filterId:i.observable,filterLabel:i.computed,gte:i.observable,lte:i.observable,lteMax:i.observable,gteMin:i.observable,setGte:i.action,setLte:i.action,clear:i.action}),this.filterId=e;const{FIELDS_MAP:s}=d.BusinessLogicManager.getBusinessLogic(),l=s.get(this.filterId),u=(h=l==null?void 0:l.options)==null?void 0:h.every(a=>a.value&&Number.isInteger(Number(a.value)));if(l&&u&&((o=l.options)==null?void 0:o.length)===2){const[a,g]=l.options,b=Number(a.value),f=Number(g.value);this.gteMin=b,this.gteMinLabel=a.label,this.lteMax=f,this.lteMaxLabel=g.label}else this.gte=0,this.gteMin=0,this.gteMinLabel="Min.",this.lte=100,this.lteMax=100,this.lteMaxLabel="Max."}get isValidLte(){return!(this.lte===void 0||this.lte===this.lteMax)}get filterLabel(){return this.gte===void 0&&this.lte===void 0?"":this.isValidLte?`Between ${this.gte} and ${this.lte}`:this.gte!==void 0?`${this.gte} or more`:""}get isActive(){return this.gte===this.gteMin&&this.lte===this.lteMax||this.gte===this.lte||this.gte===void 0&&this.lte===void 0?!1:this.gte!==void 0?!0:this.lte!==void 0&&this.lte<this.lteMax}}exports.NumberRangeFilter=n;
package/dist/index67.js CHANGED
@@ -1,59 +1,62 @@
1
- var g = Object.defineProperty;
2
- var h = (i, t, e) => t in i ? g(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var s = (i, t, e) => h(i, typeof t != "symbol" ? t + "" : t, e);
4
- import { makeObservable as p, action as l, computed as n, observable as o } from "mobx";
5
- import { getDateRange as a } from "@veeqo/ui";
6
- import { DateValue as T, DateOptionMap as f } from "./index46.js";
7
- import { BusinessLogicManager as c } from "./index8.js";
8
- class L {
9
- constructor(t) {
10
- s(this, "filterType");
11
- s(this, "gte");
12
- s(this, "lte");
13
- s(this, "setFilterType", (t) => {
14
- if (t === this.filterType) return;
15
- const e = t || T.TODAY;
16
- if (this.filterType = e, e !== "CUSTOM") {
17
- const r = a(e);
18
- r && (this.gte = r.start, this.lte = r.end);
19
- }
1
+ var b = Object.defineProperty;
2
+ var v = (l, t, i) => t in l ? b(l, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : l[t] = i;
3
+ var e = (l, t, i) => v(l, typeof t != "symbol" ? t + "" : t, i);
4
+ import { makeObservable as L, action as n, observable as h, computed as c } from "mobx";
5
+ import { BusinessLogicManager as x } from "./index8.js";
6
+ class u {
7
+ constructor({ filterId: t }) {
8
+ e(this, "filterId");
9
+ e(this, "gteMinLabel");
10
+ e(this, "gteMin");
11
+ e(this, "lteMaxLabel");
12
+ e(this, "lteMax");
13
+ e(this, "gte");
14
+ e(this, "lte");
15
+ e(this, "setGte", (t) => {
16
+ this.gte = t;
20
17
  });
21
- s(this, "setDates", (t, e) => {
22
- this.gte = t, this.lte = e;
18
+ e(this, "setLte", (t) => {
19
+ this.lte = t;
23
20
  });
24
- s(this, "clear", () => {
25
- this.filterType = void 0;
26
- const { DEFAULT_DATE_RANGE: t } = c.getBusinessLogic();
27
- t && this.setDates(t.start, t.end);
21
+ e(this, "clear", () => {
22
+ this.setGte(void 0), this.setLte(void 0);
28
23
  });
29
- p(this, {
30
- filterType: o,
31
- gte: o,
32
- lte: o,
33
- filterSelection: n,
34
- filterLabel: n,
35
- selectedRange: n,
36
- setFilterType: l,
37
- setDates: l,
38
- clear: l
24
+ e(this, "clone", () => {
25
+ const t = new u({ filterId: this.filterId });
26
+ return t.setGte(this.gte), t.setLte(this.lte), t;
39
27
  });
40
- const e = t && t !== "CUSTOM" ? a(t) : null, { DEFAULT_DATE_RANGE: r } = c.getBusinessLogic();
41
- this.filterType = t, this.gte = (e == null ? void 0 : e.start) ?? r.start, this.lte = (e == null ? void 0 : e.end) ?? r.end;
28
+ e(this, "isEqual", (t) => !(!t || this.lte !== t.lte || this.gte !== t.gte));
29
+ var a, o;
30
+ L(this, {
31
+ filterId: h,
32
+ filterLabel: c,
33
+ gte: h,
34
+ lte: h,
35
+ lteMax: h,
36
+ gteMin: h,
37
+ setGte: n,
38
+ setLte: n,
39
+ clear: n
40
+ }), this.filterId = t;
41
+ const { FIELDS_MAP: i } = x.getBusinessLogic(), s = i.get(this.filterId), f = (a = s == null ? void 0 : s.options) == null ? void 0 : a.every(
42
+ (r) => r.value && Number.isInteger(Number(r.value))
43
+ );
44
+ if (s && f && ((o = s.options) == null ? void 0 : o.length) === 2) {
45
+ const [r, g] = s.options, M = Number(r.value), d = Number(g.value);
46
+ this.gteMin = M, this.gteMinLabel = r.label, this.lteMax = d, this.lteMaxLabel = g.label;
47
+ } else
48
+ this.gte = 0, this.gteMin = 0, this.gteMinLabel = "Min.", this.lte = 100, this.lteMax = 100, this.lteMaxLabel = "Max.";
42
49
  }
43
- get filterSelection() {
44
- const { DEFAULT_DATE_PRESET: t } = c.getBusinessLogic();
45
- return this.filterType ? f.get(this.filterType) ?? t : t;
50
+ get isValidLte() {
51
+ return !(this.lte === void 0 || this.lte === this.lteMax);
46
52
  }
47
53
  get filterLabel() {
48
- return this.filterSelection.label;
54
+ return this.gte === void 0 && this.lte === void 0 ? "" : this.isValidLte ? `Between ${this.gte} and ${this.lte}` : this.gte !== void 0 ? `${this.gte} or more` : "";
49
55
  }
50
- get selectedRange() {
51
- return {
52
- start: this.gte,
53
- end: this.lte
54
- };
56
+ get isActive() {
57
+ return this.gte === this.gteMin && this.lte === this.lteMax || this.gte === this.lte || this.gte === void 0 && this.lte === void 0 ? !1 : this.gte !== void 0 ? !0 : this.lte !== void 0 && this.lte < this.lteMax;
55
58
  }
56
59
  }
57
60
  export {
58
- L as RangeFilter
61
+ u as NumberRangeFilter
59
62
  };
package/dist/index68.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var d=Object.defineProperty;var f=(r,t,e)=>t in r?d(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var i=(r,t,e)=>f(r,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("mobx");class w{constructor(){i(this,"draftCount");i(this,"draftViewsMap");i(this,"addDraftView",t=>{const e=t.originalView||t,s=`${e.id}-draft${this.draftCount}`,o=`${e.label} (Copy ${this.draftCount+1})`,n={...t,id:s,label:o,editable:!0,originalView:e};return this.draftViewsMap.set(s,n),this.incrementDraftViewCount(),n});i(this,"removeDraftViewById",t=>{this.draftViewsMap.has(t)&&this.draftViewsMap.delete(t)});i(this,"incrementDraftViewCount",()=>{this.draftCount+=1});a.makeObservable(this,{draftViewsList:a.computed,draftViewsMap:a.observable,draftCount:a.observable,addDraftView:a.action,removeDraftViewById:a.action,incrementDraftViewCount:a.action}),this.draftCount=0,this.draftViewsMap=new Map}get draftViewsList(){return Array.from(this.draftViewsMap.entries()).map(([,t])=>t)}}exports.Views=w;
1
+ "use strict";var c=Object.defineProperty;var g=(r,e,t)=>e in r?c(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var i=(r,e,t)=>g(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("mobx"),a=require("@veeqo/ui"),l=require("./index46.cjs"),o=require("./index8.cjs");class u{constructor(e){i(this,"filterType");i(this,"gte");i(this,"lte");i(this,"setFilterType",e=>{if(e===this.filterType)return;const t=e||l.DateValue.TODAY;if(this.filterType=t,t!=="CUSTOM"){const n=a.getDateRange(t);n&&(this.gte=n.start,this.lte=n.end)}});i(this,"setDates",(e,t)=>{this.gte=e,this.lte=t});i(this,"clear",()=>{this.filterType=void 0;const{DEFAULT_DATE_RANGE:e}=o.BusinessLogicManager.getBusinessLogic();e&&this.setDates(e.start,e.end)});s.makeObservable(this,{filterType:s.observable,gte:s.observable,lte:s.observable,filterSelection:s.computed,filterLabel:s.computed,selectedRange:s.computed,setFilterType:s.action,setDates:s.action,clear:s.action});const t=e&&e!=="CUSTOM"?a.getDateRange(e):null,{DEFAULT_DATE_RANGE:n}=o.BusinessLogicManager.getBusinessLogic();this.filterType=e,this.gte=(t==null?void 0:t.start)??n.start,this.lte=(t==null?void 0:t.end)??n.end}get filterSelection(){const{DEFAULT_DATE_PRESET:e}=o.BusinessLogicManager.getBusinessLogic();return this.filterType?l.DateOptionMap.get(this.filterType)??e:e}get filterLabel(){return this.filterSelection.label}get selectedRange(){return{start:this.gte,end:this.lte}}}exports.RangeFilter=u;
package/dist/index68.js CHANGED
@@ -1,40 +1,59 @@
1
- var f = Object.defineProperty;
2
- var w = (a, t, e) => t in a ? f(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
3
- var r = (a, t, e) => w(a, typeof t != "symbol" ? t + "" : t, e);
4
- import { makeObservable as V, action as i, observable as d, computed as u } from "mobx";
5
- class h {
6
- constructor() {
7
- r(this, "draftCount");
8
- r(this, "draftViewsMap");
9
- r(this, "addDraftView", (t) => {
10
- const e = t.originalView || t, s = `${e.id}-draft${this.draftCount}`, o = `${e.label} (Copy ${this.draftCount + 1})`, n = {
11
- ...t,
12
- id: s,
13
- label: o,
14
- editable: !0,
15
- originalView: e
16
- };
17
- return this.draftViewsMap.set(s, n), this.incrementDraftViewCount(), n;
1
+ var g = Object.defineProperty;
2
+ var h = (i, t, e) => t in i ? g(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var s = (i, t, e) => h(i, typeof t != "symbol" ? t + "" : t, e);
4
+ import { makeObservable as p, action as l, computed as n, observable as o } from "mobx";
5
+ import { getDateRange as a } from "@veeqo/ui";
6
+ import { DateValue as T, DateOptionMap as f } from "./index46.js";
7
+ import { BusinessLogicManager as c } from "./index8.js";
8
+ class L {
9
+ constructor(t) {
10
+ s(this, "filterType");
11
+ s(this, "gte");
12
+ s(this, "lte");
13
+ s(this, "setFilterType", (t) => {
14
+ if (t === this.filterType) return;
15
+ const e = t || T.TODAY;
16
+ if (this.filterType = e, e !== "CUSTOM") {
17
+ const r = a(e);
18
+ r && (this.gte = r.start, this.lte = r.end);
19
+ }
18
20
  });
19
- r(this, "removeDraftViewById", (t) => {
20
- this.draftViewsMap.has(t) && this.draftViewsMap.delete(t);
21
+ s(this, "setDates", (t, e) => {
22
+ this.gte = t, this.lte = e;
21
23
  });
22
- r(this, "incrementDraftViewCount", () => {
23
- this.draftCount += 1;
24
+ s(this, "clear", () => {
25
+ this.filterType = void 0;
26
+ const { DEFAULT_DATE_RANGE: t } = c.getBusinessLogic();
27
+ t && this.setDates(t.start, t.end);
24
28
  });
25
- V(this, {
26
- draftViewsList: u,
27
- draftViewsMap: d,
28
- draftCount: d,
29
- addDraftView: i,
30
- removeDraftViewById: i,
31
- incrementDraftViewCount: i
32
- }), this.draftCount = 0, this.draftViewsMap = /* @__PURE__ */ new Map();
29
+ p(this, {
30
+ filterType: o,
31
+ gte: o,
32
+ lte: o,
33
+ filterSelection: n,
34
+ filterLabel: n,
35
+ selectedRange: n,
36
+ setFilterType: l,
37
+ setDates: l,
38
+ clear: l
39
+ });
40
+ const e = t && t !== "CUSTOM" ? a(t) : null, { DEFAULT_DATE_RANGE: r } = c.getBusinessLogic();
41
+ this.filterType = t, this.gte = (e == null ? void 0 : e.start) ?? r.start, this.lte = (e == null ? void 0 : e.end) ?? r.end;
42
+ }
43
+ get filterSelection() {
44
+ const { DEFAULT_DATE_PRESET: t } = c.getBusinessLogic();
45
+ return this.filterType ? f.get(this.filterType) ?? t : t;
46
+ }
47
+ get filterLabel() {
48
+ return this.filterSelection.label;
33
49
  }
34
- get draftViewsList() {
35
- return Array.from(this.draftViewsMap.entries()).map(([, t]) => t);
50
+ get selectedRange() {
51
+ return {
52
+ start: this.gte,
53
+ end: this.lte
54
+ };
36
55
  }
37
56
  }
38
57
  export {
39
- h as Views
58
+ L as RangeFilter
40
59
  };
package/dist/index69.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var r=Object.defineProperty;var c=(e,t,s)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var o=(e,t,s)=>c(e,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("mobx"),n=require("uid/secure");class u{constructor(){o(this,"toasts");o(this,"timeouts");o(this,"notify",t=>{const s={...t,key:n.uid()};this.toasts=[...this.toasts,s]});o(this,"setToasts",t=>{this.toasts=t});o(this,"removeByKey",t=>{const s=this.timeouts.get(t);s&&(clearTimeout(s),this.timeouts.delete(t)),this.toasts=this.toasts.filter(a=>a.key!==t)});i.makeObservable(this,{toasts:i.observable,notify:i.action,setToasts:i.action,removeByKey:i.action}),this.toasts=[],this.timeouts=new Map}}exports.Notifications=u;
1
+ "use strict";var d=Object.defineProperty;var f=(r,t,e)=>t in r?d(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var i=(r,t,e)=>f(r,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("mobx");class w{constructor(){i(this,"draftCount");i(this,"draftViewsMap");i(this,"addDraftView",t=>{const e=t.originalView||t,s=`${e.id}-draft${this.draftCount}`,o=`${e.label} (Copy ${this.draftCount+1})`,n={...t,id:s,label:o,editable:!0,originalView:e};return this.draftViewsMap.set(s,n),this.incrementDraftViewCount(),n});i(this,"removeDraftViewById",t=>{this.draftViewsMap.has(t)&&this.draftViewsMap.delete(t)});i(this,"incrementDraftViewCount",()=>{this.draftCount+=1});a.makeObservable(this,{draftViewsList:a.computed,draftViewsMap:a.observable,draftCount:a.observable,addDraftView:a.action,removeDraftViewById:a.action,incrementDraftViewCount:a.action}),this.draftCount=0,this.draftViewsMap=new Map}get draftViewsList(){return Array.from(this.draftViewsMap.entries()).map(([,t])=>t)}}exports.Views=w;