@veeqo/transfigure 0.0.4 → 0.0.6

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 (223) hide show
  1. package/dist/BusinessLogic/types.d.ts +2 -0
  2. package/dist/components/TableManagement/DndContainer.d.ts +11 -0
  3. package/dist/components/TableManagement/TableManagement.d.ts +6 -0
  4. package/dist/components/TableManagement/TableManagementGlyph.d.ts +4 -0
  5. package/dist/components/TableManagement/TableManagementModal.d.ts +2 -0
  6. package/dist/components/TableManagement/components/ColumnGroup.d.ts +2 -0
  7. package/dist/components/TableManagement/components/ColumnItem.d.ts +2 -0
  8. package/dist/components/TableManagement/components/DroppableArea.d.ts +8 -0
  9. package/dist/components/TableManagement/components/SortableItem.d.ts +7 -0
  10. package/dist/components/TableManagement/components/styled.d.ts +28 -0
  11. package/dist/components/TableManagement/components/types.d.ts +11 -0
  12. package/dist/components/TableManagement/hooks/useCollisionDetectionStrategy/index.d.ts +1 -0
  13. package/dist/components/TableManagement/hooks/useCollisionDetectionStrategy/types.d.ts +4 -0
  14. package/dist/components/TableManagement/hooks/useCollisionDetectionStrategy/useCollisionDetectionStrategy.d.ts +5 -0
  15. package/dist/components/TableManagement/hooks/useDragHandlers/index.d.ts +1 -0
  16. package/dist/components/TableManagement/hooks/useDragHandlers/types.d.ts +6 -0
  17. package/dist/components/TableManagement/hooks/useDragHandlers/useDragHandlers.d.ts +9 -0
  18. package/dist/components/TableManagement/index.d.ts +1 -0
  19. package/dist/components/TableManagement/types.d.ts +17 -0
  20. package/dist/components/TableManagement/utils/filterColumnsBySearch/filterColumnsBySearch.d.ts +2 -0
  21. package/dist/components/TableManagement/utils/filterColumnsBySearch/index.d.ts +1 -0
  22. package/dist/hooks/index.d.ts +1 -0
  23. package/dist/hooks/useHiddenColumns/index.d.ts +1 -0
  24. package/dist/hooks/useHiddenColumns/useHiddenColumns.d.ts +7 -0
  25. package/dist/hooks/usePersistColumns/index.d.ts +1 -0
  26. package/dist/hooks/usePersistColumns/usePersistColumns.d.ts +6 -0
  27. package/dist/index.cjs +1 -1
  28. package/dist/index.d.ts +1 -0
  29. package/dist/index.js +79 -75
  30. package/dist/index100.cjs +13 -0
  31. package/dist/index100.js +19 -0
  32. package/dist/index101.cjs +1 -0
  33. package/dist/index101.js +38 -0
  34. package/dist/index102.cjs +1 -0
  35. package/dist/index102.js +44 -0
  36. package/dist/index103.cjs +7 -0
  37. package/dist/index103.js +12 -0
  38. package/dist/index11.cjs +1 -1
  39. package/dist/index11.js +1 -1
  40. package/dist/index12.cjs +1 -1
  41. package/dist/index12.js +1 -1
  42. package/dist/index13.cjs +1 -1
  43. package/dist/index13.js +1 -1
  44. package/dist/index14.cjs +1 -1
  45. package/dist/index14.js +2 -2
  46. package/dist/index15.cjs +1 -1
  47. package/dist/index15.js +2 -2
  48. package/dist/index16.cjs +1 -1
  49. package/dist/index16.js +1 -1
  50. package/dist/index17.cjs +1 -1
  51. package/dist/index17.js +1 -1
  52. package/dist/index18.cjs +1 -1
  53. package/dist/index18.js +2 -2
  54. package/dist/index19.cjs +1 -1
  55. package/dist/index19.js +2 -2
  56. package/dist/index2.cjs +1 -1
  57. package/dist/index2.js +2 -2
  58. package/dist/index20.cjs +1 -1
  59. package/dist/index20.js +3 -3
  60. package/dist/index21.cjs +1 -1
  61. package/dist/index21.js +2 -2
  62. package/dist/index22.cjs +1 -1
  63. package/dist/index22.js +2 -2
  64. package/dist/index23.cjs +1 -1
  65. package/dist/index23.js +3 -3
  66. package/dist/index24.cjs +1 -1
  67. package/dist/index24.js +3 -3
  68. package/dist/index25.cjs +1 -1
  69. package/dist/index25.js +1 -1
  70. package/dist/index26.cjs +1 -1
  71. package/dist/index26.js +2 -2
  72. package/dist/index27.cjs +1 -1
  73. package/dist/index27.js +2 -2
  74. package/dist/index28.cjs +1 -1
  75. package/dist/index28.js +3 -3
  76. package/dist/index29.cjs +1 -1
  77. package/dist/index29.js +1 -1
  78. package/dist/index3.cjs +1 -1
  79. package/dist/index3.js +2 -2
  80. package/dist/index30.cjs +1 -1
  81. package/dist/index30.js +1 -1
  82. package/dist/index31.cjs +1 -1
  83. package/dist/index31.js +1 -1
  84. package/dist/index32.cjs +1 -1
  85. package/dist/index32.js +1 -1
  86. package/dist/index33.cjs +1 -1
  87. package/dist/index33.js +5 -5
  88. package/dist/index34.cjs +1 -1
  89. package/dist/index34.js +1 -1
  90. package/dist/index35.cjs +1 -1
  91. package/dist/index35.js +1 -1
  92. package/dist/index36.cjs +1 -1
  93. package/dist/index36.js +3 -3
  94. package/dist/index37.cjs +1 -1
  95. package/dist/index37.js +3 -3
  96. package/dist/index38.cjs +1 -1
  97. package/dist/index38.js +4 -4
  98. package/dist/index39.cjs +1 -1
  99. package/dist/index39.js +1 -1
  100. package/dist/index4.cjs +1 -1
  101. package/dist/index4.js +2 -2
  102. package/dist/index41.cjs +1 -1
  103. package/dist/index41.js +4 -4
  104. package/dist/index43.cjs +1 -1
  105. package/dist/index43.js +46 -19
  106. package/dist/index44.cjs +1 -1
  107. package/dist/index44.js +19 -2
  108. package/dist/index45.cjs +1 -1
  109. package/dist/index45.js +2 -23
  110. package/dist/index46.cjs +1 -1
  111. package/dist/index46.js +23 -2
  112. package/dist/index47.cjs +1 -1
  113. package/dist/index47.js +2 -4
  114. package/dist/index48.cjs +1 -1
  115. package/dist/index48.js +4 -11
  116. package/dist/index49.cjs +1 -1
  117. package/dist/index49.js +10 -12
  118. package/dist/index5.cjs +1 -1
  119. package/dist/index5.js +2 -2
  120. package/dist/index50.cjs +1 -1
  121. package/dist/index50.js +12 -11
  122. package/dist/index51.cjs +1 -1
  123. package/dist/index51.js +11 -184
  124. package/dist/index52.cjs +1 -1
  125. package/dist/index52.js +183 -25
  126. package/dist/index53.cjs +1 -1
  127. package/dist/index53.js +26 -24
  128. package/dist/index54.cjs +1 -1
  129. package/dist/index54.js +19 -22
  130. package/dist/index55.cjs +1 -1
  131. package/dist/index55.js +25 -90
  132. package/dist/index56.cjs +1 -1
  133. package/dist/index56.js +92 -8
  134. package/dist/index57.cjs +1 -1
  135. package/dist/index57.js +8 -50
  136. package/dist/index58.cjs +1 -1
  137. package/dist/index58.js +49 -60
  138. package/dist/index59.cjs +1 -1
  139. package/dist/index59.js +61 -17
  140. package/dist/index6.cjs +1 -1
  141. package/dist/index6.js +4 -4
  142. package/dist/index60.cjs +1 -1
  143. package/dist/index60.js +18 -316
  144. package/dist/index61.cjs +1 -1
  145. package/dist/index61.js +25 -59
  146. package/dist/index62.cjs +1 -1
  147. package/dist/index62.js +309 -50
  148. package/dist/index63.cjs +1 -1
  149. package/dist/index63.js +54 -31
  150. package/dist/index64.cjs +1 -1
  151. package/dist/index64.js +52 -27
  152. package/dist/index65.cjs +1 -1
  153. package/dist/index65.js +37 -4
  154. package/dist/index66.cjs +1 -1
  155. package/dist/index66.js +32 -9
  156. package/dist/index67.cjs +1 -1
  157. package/dist/index67.js +4 -17
  158. package/dist/index68.cjs +1 -1
  159. package/dist/index68.js +9 -19
  160. package/dist/index69.cjs +1 -1
  161. package/dist/index69.js +16 -46
  162. package/dist/index70.cjs +1 -1
  163. package/dist/index70.js +19 -17
  164. package/dist/index71.cjs +1 -1
  165. package/dist/index71.js +48 -2
  166. package/dist/index72.cjs +1 -1
  167. package/dist/index72.js +21 -9
  168. package/dist/index73.cjs +1 -3
  169. package/dist/index73.js +2 -14
  170. package/dist/index74.cjs +1 -1
  171. package/dist/index74.js +8 -8
  172. package/dist/index75.cjs +3 -1
  173. package/dist/index75.js +13 -28
  174. package/dist/index76.cjs +1 -19
  175. package/dist/index76.js +9 -24
  176. package/dist/index77.cjs +1 -1
  177. package/dist/index77.js +154 -14
  178. package/dist/index78.cjs +1 -12
  179. package/dist/index78.js +19 -16
  180. package/dist/index80.cjs +1 -1
  181. package/dist/index80.js +13 -22
  182. package/dist/index81.cjs +104 -1
  183. package/dist/index81.js +119 -23
  184. package/dist/index82.cjs +1 -1
  185. package/dist/index82.js +58 -2
  186. package/dist/index83.cjs +1 -13
  187. package/dist/index83.js +28 -16
  188. package/dist/index84.cjs +1 -80
  189. package/dist/index84.js +2 -95
  190. package/dist/index85.cjs +1 -1
  191. package/dist/index85.js +33 -35
  192. package/dist/index86.cjs +1 -1
  193. package/dist/index86.js +8 -63
  194. package/dist/index87.cjs +1 -7
  195. package/dist/index87.js +29 -10
  196. package/dist/index88.cjs +1 -0
  197. package/dist/index88.js +24 -0
  198. package/dist/index89.cjs +19 -0
  199. package/dist/index89.js +26 -0
  200. package/dist/index9.cjs +1 -1
  201. package/dist/index9.js +17 -15
  202. package/dist/index90.cjs +12 -0
  203. package/dist/index90.js +18 -0
  204. package/dist/index91.cjs +1 -0
  205. package/dist/index91.js +17 -0
  206. package/dist/index92.cjs +1 -0
  207. package/dist/index92.js +26 -0
  208. package/dist/index93.cjs +1 -0
  209. package/dist/index93.js +4 -0
  210. package/dist/index94.cjs +1 -0
  211. package/dist/index94.js +21 -0
  212. package/dist/index95.cjs +1 -0
  213. package/dist/index95.js +10 -0
  214. package/dist/index96.cjs +1 -0
  215. package/dist/index96.js +66 -0
  216. package/dist/index97.cjs +1 -0
  217. package/dist/index97.js +32 -0
  218. package/dist/index98.cjs +1 -0
  219. package/dist/index98.js +65 -0
  220. package/dist/index99.cjs +80 -0
  221. package/dist/index99.js +97 -0
  222. package/dist/types.d.ts +8 -0
  223. package/package.json +11 -2
package/dist/index62.js CHANGED
@@ -1,59 +1,318 @@
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 "./index43.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);
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 "./index45.js";
9
+ import { RangeFilter as w } from "./index64.js";
10
+ import { NumberRangeFilter as P } from "./index63.js";
11
+ import { ALL_VIEW_ID as O } from "./index72.js";
12
+ import { isValidDateRange as V } from "./index70.js";
13
+ import { BusinessLogicManager as y } from "./index8.js";
14
+ class W {
15
+ constructor() {
16
+ // PAGINATION
17
+ f(this, "defaultPageSize");
18
+ f(this, "pageSize");
19
+ f(this, "currentPage");
20
+ // DEFAULT FILTERS
21
+ f(this, "defaultFilters");
22
+ f(this, "defaultArrayFilters");
23
+ f(this, "defaultDateRangeFilters");
24
+ f(this, "defaultNumberRangeFilters");
25
+ // CURRENT FILTERS
26
+ f(this, "filters");
27
+ f(this, "arrayFilters");
28
+ f(this, "dateRangeFilters");
29
+ f(this, "numberRangeFilters");
30
+ // VIEWS
31
+ f(this, "activeViewId");
32
+ // VISIBILITY STATE
33
+ f(this, "isFiltersDropdownVisible");
34
+ f(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
+ f(this, "updateUrl", (e = !1) => {
38
+ try {
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);
19
43
  }
20
44
  });
21
- s(this, "setDates", (t, e) => {
22
- this.gte = t, this.lte = e;
23
- });
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);
28
- });
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;
45
+ // PAGINATION
46
+ f(this, "setCurrentPage", (e) => {
47
+ this.currentPage = e;
48
+ });
49
+ f(this, "setPageSize", (e) => {
50
+ this.pageSize = e;
51
+ });
52
+ // TEXT FILTERS
53
+ f(this, "setFilter", (e, l) => {
54
+ this.filters.set(e, l), this.updateUrl();
55
+ });
56
+ f(this, "clearFilter", (e) => {
57
+ this.filters.set(e, ""), this.updateUrl();
58
+ });
59
+ // ARRAY FILTERS
60
+ f(this, "setArrayFilter", (e, l) => {
61
+ this.arrayFilters.set(e, l), this.updateUrl();
62
+ });
63
+ f(this, "clearArrayFilter", (e) => {
64
+ this.arrayFilters.set(e, []), this.updateUrl();
65
+ });
66
+ // RANGE FILTERS
67
+ f(this, "setRangeFilter", ({
68
+ key: e,
69
+ range: l,
70
+ dates: r
71
+ }) => {
72
+ l.setFilterType(e), l.setDates(r.start, r.end), this.updateUrl();
73
+ });
74
+ f(this, "clearRangeFilter", (e) => {
75
+ const l = this.dateRangeFilters.get(e);
76
+ l && (l.clear(), this.updateUrl());
77
+ });
78
+ // NUMBER RANGE FILTERS
79
+ f(this, "setNumberRangeFilter", ({
80
+ numberRange: e,
81
+ gte: l,
82
+ lte: r
83
+ }) => {
84
+ e.setGte(l), e.setLte(r), this.updateUrl();
85
+ });
86
+ f(this, "clearNumberRangeFilter", (e) => {
87
+ const l = this.numberRangeFilters.get(e);
88
+ l && (l.clear(), this.updateUrl());
89
+ });
90
+ // CLEARING ALL FILTERS
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
+ });
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
+ });
102
+ });
103
+ // VIEWS
104
+ f(this, "setActiveViewId", (e) => {
105
+ this.activeViewId = e, this.updateUrl();
106
+ });
107
+ // VISIBILITY
108
+ f(this, "toggleFiltersDropdownVisible", (e) => {
109
+ this.isFiltersDropdownVisible = e;
110
+ });
111
+ // FILTER GROUPS
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
+ });
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
+ })
128
+ ), this.defaultNumberRangeFilters = new Map(
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
+ })
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
+ })
138
+ ), this.numberRangeFilters = new Map(
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
+ })
143
+ ), this.activeViewId = e.id;
144
+ });
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
+ this.activeViewId = s;
152
+ return;
153
+ }
154
+ if (i === a && t.includes(Number(s))) {
155
+ this.pageSize = Number(s);
156
+ return;
157
+ }
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
+ }
163
+ if (p)
164
+ switch (p.filterType) {
165
+ case m.CHECKBOX:
166
+ s && R.set(i, s.split(","));
167
+ break;
168
+ case m.DATE_RANGE:
169
+ let d;
170
+ if (s === "CUSTOM") {
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
+ break;
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
+ break;
181
+ case m.TEXT:
182
+ case m.NUMBER:
183
+ case m.RADIO:
184
+ F.set(i, s);
185
+ break;
186
+ }
187
+ }), this.filters = F, this.arrayFilters = R, this.dateRangeFilters = M, this.numberRangeFilters = S, this.updateUrl();
188
+ });
189
+ f(this, "discardChanges", (e = !1) => {
190
+ this.pageSize = this.defaultPageSize;
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
+ });
199
+ const { GROUP_MAP: e } = y.getBusinessLogic(), l = Array.from(e.values()).flatMap((r) => r.fields);
200
+ this.filters = new Map(
201
+ l.filter(
202
+ (r) => r.filterType === m.TEXT || r.filterType === m.NUMBER || r.filterType === m.RADIO || r.filterType === m.DATE_RANGE
203
+ ).map((r) => [r.id, ""])
204
+ ), this.arrayFilters = new Map(
205
+ l.filter((r) => r.filterType === m.CHECKBOX).map((r) => [r.id, []])
206
+ ), this.dateRangeFilters = new Map(
207
+ l.filter((r) => r.filterType === m.DATE_RANGE).map((r) => [r.id, new w()])
208
+ ), this.numberRangeFilters = new Map(
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
+ })
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
+ });
252
+ }
253
+ get hasActiveFilters() {
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);
42
256
  }
43
- get filterSelection() {
44
- const { DEFAULT_DATE_PRESET: t } = c.getBusinessLogic();
45
- return this.filterType ? f.get(this.filterType) ?? t : t;
257
+ get activeFilterKeysList() {
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])];
46
262
  }
47
- get filterLabel() {
48
- return this.filterSelection.label;
263
+ get queryParams() {
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
+ return Array.from(this.filters.entries()).filter(
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();
49
276
  }
50
- get selectedRange() {
51
- return {
52
- start: this.gte,
53
- end: this.lte
54
- };
277
+ get hasUnsavedChanges() {
278
+ if (this.activeViewId === O) return !1;
279
+ if (this.defaultPageSize !== this.pageSize) return !0;
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
+ }))
285
+ return !0;
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
+ });
293
+ if (n || h)
294
+ return !0;
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
+ });
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
+ return !0;
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
+ });
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;
55
314
  }
56
315
  }
57
316
  export {
58
- L as RangeFilter
317
+ W as Filters
59
318
  };
package/dist/index63.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,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 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/index63.js CHANGED
@@ -1,39 +1,62 @@
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 o, 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}`, d = `${e.label} (Copy ${this.draftCount + 1})`, n = {
11
- ...t,
12
- id: s,
13
- label: d,
14
- originalView: e
15
- };
16
- return this.draftViewsMap.set(s, n), this.incrementDraftViewCount(), n;
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
17
  });
18
- r(this, "removeDraftViewById", (t) => {
19
- this.draftViewsMap.has(t) && this.draftViewsMap.delete(t);
18
+ e(this, "setLte", (t) => {
19
+ this.lte = t;
20
20
  });
21
- r(this, "incrementDraftViewCount", () => {
22
- this.draftCount += 1;
21
+ e(this, "clear", () => {
22
+ this.setGte(void 0), this.setLte(void 0);
23
23
  });
24
- V(this, {
25
- draftViewsList: u,
26
- draftViewsMap: o,
27
- draftCount: o,
28
- addDraftView: i,
29
- removeDraftViewById: i,
30
- incrementDraftViewCount: i
31
- }), this.draftCount = 0, this.draftViewsMap = /* @__PURE__ */ new Map();
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.";
49
+ }
50
+ get isValidLte() {
51
+ return !(this.lte === void 0 || this.lte === this.lteMax);
52
+ }
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` : "";
32
55
  }
33
- get draftViewsList() {
34
- return Array.from(this.draftViewsMap.entries()).map(([, t]) => t);
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;
35
58
  }
36
59
  }
37
60
  export {
38
- h as Views
61
+ u as NumberRangeFilter
39
62
  };
package/dist/index64.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 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("./index44.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/index64.js CHANGED
@@ -1,34 +1,59 @@
1
- var m = Object.defineProperty;
2
- var r = (o, t, s) => t in o ? m(o, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : o[t] = s;
3
- var e = (o, t, s) => r(o, typeof t != "symbol" ? t + "" : t, s);
4
- import { makeObservable as h, action as i, observable as n } from "mobx";
5
- import { uid as c } from "uid/secure";
6
- class y {
7
- constructor() {
8
- e(this, "toasts");
9
- e(this, "timeouts");
10
- e(this, "notify", (t) => {
11
- const s = {
12
- ...t,
13
- key: c()
14
- };
15
- this.toasts = [...this.toasts, s];
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 "./index44.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
+ }
16
20
  });
17
- e(this, "setToasts", (t) => {
18
- this.toasts = t;
21
+ s(this, "setDates", (t, e) => {
22
+ this.gte = t, this.lte = e;
19
23
  });
20
- e(this, "removeByKey", (t) => {
21
- const s = this.timeouts.get(t);
22
- s && (clearTimeout(s), this.timeouts.delete(t)), this.toasts = this.toasts.filter((a) => a.key !== t);
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);
23
28
  });
24
- h(this, {
25
- toasts: n,
26
- notify: i,
27
- setToasts: i,
28
- removeByKey: i
29
- }), this.toasts = [], this.timeouts = /* @__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;
49
+ }
50
+ get selectedRange() {
51
+ return {
52
+ start: this.gte,
53
+ end: this.lte
54
+ };
30
55
  }
31
56
  }
32
57
  export {
33
- y as Notifications
58
+ L as RangeFilter
34
59
  };
package/dist/index65.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),s=require("mobx-react"),n=({children:e,Filters:i,Views:r,Notifications:t})=>o.jsx(s.Provider,{Filters:i,Views:r,Notifications:t,children:e});exports.MobXProvider=n;
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,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;
package/dist/index65.js CHANGED
@@ -1,6 +1,39 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import { Provider as s } from "mobx-react";
3
- const n = ({ children: i, Filters: o, Views: r, Notifications: t }) => /* @__PURE__ */ e(s, { Filters: o, Views: r, Notifications: t, children: i });
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 o, 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}`, d = `${e.label} (Copy ${this.draftCount + 1})`, n = {
11
+ ...t,
12
+ id: s,
13
+ label: d,
14
+ originalView: e
15
+ };
16
+ return this.draftViewsMap.set(s, n), this.incrementDraftViewCount(), n;
17
+ });
18
+ r(this, "removeDraftViewById", (t) => {
19
+ this.draftViewsMap.has(t) && this.draftViewsMap.delete(t);
20
+ });
21
+ r(this, "incrementDraftViewCount", () => {
22
+ this.draftCount += 1;
23
+ });
24
+ V(this, {
25
+ draftViewsList: u,
26
+ draftViewsMap: o,
27
+ draftCount: o,
28
+ addDraftView: i,
29
+ removeDraftViewById: i,
30
+ incrementDraftViewCount: i
31
+ }), this.draftCount = 0, this.draftViewsMap = /* @__PURE__ */ new Map();
32
+ }
33
+ get draftViewsList() {
34
+ return Array.from(this.draftViewsMap.entries()).map(([, t]) => t);
35
+ }
36
+ }
4
37
  export {
5
- n as MobXProvider
38
+ h as Views
6
39
  };
package/dist/index66.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("lodash/get"),s=t=>t&&t.__esModule?t:{default:t},l=s(o),a=({data:t,config:e})=>!e||!t?[]:t.map(r=>{const u=l.default(r,e.labelProperty),n=l.default(r,e.valueProperty);return{label:u,value:n.toString()}});exports.getAsyncOptions=a;
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;