@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/index55.js CHANGED
@@ -1,95 +1,30 @@
1
- import { useState as h } from "react";
2
- import { parseDate as c } from "@internationalized/date";
3
- import { NumberRangeFilter as R } from "./index61.js";
4
- import { RangeFilter as T } from "./index62.js";
5
- import { useViews as I } from "./index57.js";
6
- import { useBusinessLogic as M } from "./index7.js";
7
- import { useStores as V } from "./index56.js";
8
- import { patchCustomView as C } from "./index4.js";
9
- const P = () => {
1
+ import { useMemo as p } from "react";
2
+ import { getAsyncOptions as m } from "./index68.js";
3
+ import { getFetcherFunction as f } from "./index69.js";
4
+ import h from "swr/immutable";
5
+ import { useStores as u } from "./index57.js";
6
+ const b = ({ filterData: t }) => {
7
+ var c;
10
8
  const {
11
- DATE_RANGE_FILTERS: l,
12
- NUMBER_RANGE_FILTERS: p,
13
- SEARCH_FILTER_ID: g,
14
- VIEW_TYPE: F
15
- } = M(), {
16
- Filters: {
17
- activeViewId: o,
18
- filters: u,
19
- arrayFilters: w,
20
- dateRangeFilters: y,
21
- numberRangeFilters: b,
22
- initFiltersFromView: d
9
+ Filters: { filters: r }
10
+ } = u(), e = r.get(t.id), { data: s } = h(
11
+ (c = t.fetchAsyncFilterOptions) == null ? void 0 : c.URL,
12
+ () => {
13
+ var o;
14
+ return f({
15
+ fetcherName: (o = t.fetchAsyncFilterOptions) == null ? void 0 : o.fetcher
16
+ })(t.fetchAsyncFilterOptions.URL);
23
17
  },
24
- Views: { draftViewsMap: E }
25
- } = V(), { viewsMap: f, mutate: A } = I(), [S, a] = h(!1), n = () => {
26
- if (!o) throw Error("No active view");
27
- const r = {};
28
- Array.from(u.entries()).filter(([t, e]) => e !== "" && t !== g).forEach(([t, e]) => {
29
- r[t] = e;
30
- }), Array.from(w.entries()).filter(([, t]) => t.length > 0).forEach(([t, e]) => {
31
- r[t] = e;
32
- }), Array.from(y.entries()).filter(([, t]) => t.filterType !== void 0).forEach(([t, e]) => {
33
- e.filterType === "CUSTOM" ? r[t] = {
34
- gte: e.gte.toString(),
35
- lte: e.lte.toString()
36
- } : r[t] = e.filterType;
37
- }), Array.from(b.entries()).filter(([, t]) => t.gte !== void 0 || t.lte !== void 0).forEach(([t, e]) => {
38
- r[t] = {}, e.gte !== void 0 && (r[t].gte = e.gte.toString()), e.isValidLte && e.lte && (r[t].lte = e.lte.toString());
39
- });
40
- let i = f.get(o);
41
- return f.has(o) || (i = E.get(o)), { arg: {
42
- type: F,
43
- filters: {
44
- filter: r,
45
- page: i == null ? void 0 : i.page
46
- },
47
- title: i == null ? void 0 : i.label
48
- }, currentView: i };
49
- };
50
- return {
51
- getActiveViewInAPIFormat: n,
52
- saveChanges: async () => {
53
- if (o)
54
- try {
55
- a(!0);
56
- const { arg: r, currentView: i } = n();
57
- await C(o, { attributes: r }), await A();
58
- const m = {
59
- ...i,
60
- filterMaps: {
61
- filters: new Map(
62
- Object.entries(r.filters.filter).filter(
63
- ([t, e]) => !Array.isArray(e) && typeof e == "string" && !l.includes(t)
64
- ).map(([t, e]) => [t, e])
65
- ),
66
- arrayFilters: new Map(
67
- Object.entries(r.filters.filter).filter(([, t]) => Array.isArray(t)).map(([t, e]) => [t, e])
68
- ),
69
- rangeFilters: new Map(
70
- Object.entries(r.filters.filter).filter(([t]) => l.includes(t)).map(([t, e]) => {
71
- const s = new T();
72
- return typeof e == "object" ? (s.setFilterType("CUSTOM"), s.setDates(c(e.gte), c(e.lte))) : s.setFilterType(e), [t, s];
73
- })
74
- ),
75
- numberRangeFilters: new Map(
76
- Object.entries(r.filters.filter).filter(([t]) => p.includes(t)).map(([t, e]) => {
77
- const s = new R({ filterId: t });
78
- return e.gte && s.setGte(Number(e.gte)), e.lte && s.setLte(Number(e.lte)), [t, s];
79
- })
80
- )
81
- }
82
- };
83
- d(m);
84
- } catch (r) {
85
- console.log(r);
86
- } finally {
87
- a(!1);
88
- }
89
- },
90
- isSubmitting: S
91
- };
18
+ { revalidateOnFocus: !1 }
19
+ );
20
+ return { filterLabel: p(() => {
21
+ var o;
22
+ if (!t.options && !t.fetchAsyncFilterOptions)
23
+ return e;
24
+ const n = s ? m({ data: s, config: t.fetchAsyncFilterOptions }) : t.options;
25
+ return ((o = n == null ? void 0 : n.find((i) => i.value.toString() === (e == null ? void 0 : e.toString()))) == null ? void 0 : o.label) || "";
26
+ }, [s, t.options, e, t.fetchAsyncFilterOptions]) };
92
27
  };
93
28
  export {
94
- P as usePersistUnsavedChanges
29
+ b as useFilterLabel
95
30
  };
package/dist/index56.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),r=require("mobx-react"),o=()=>{const e=t.useContext(r.MobXProviderContext);if(!e)throw new Error("useStores must be used within a StoresProvider.");return e};exports.useStores=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("react"),g=require("@internationalized/date"),R=require("./index63.cjs"),T=require("./index64.cjs"),M=require("./index58.cjs"),I=require("./index7.cjs"),V=require("./index57.cjs"),C=require("./index4.cjs"),q=()=>{const{DATE_RANGE_FILTERS:a,NUMBER_RANGE_FILTERS:u,SEARCH_FILTER_ID:p,VIEW_TYPE:m}=I.useBusinessLogic(),{Filters:{activeViewId:n,filters:F,arrayFilters:d,dateRangeFilters:w,numberRangeFilters:y,initFiltersFromView:b},Views:{draftViewsMap:S}}=V.useStores(),{viewsMap:l,mutate:E}=M.useViews(),[h,o]=A.useState(!1),f=()=>{if(!n)throw Error("No active view");const r={};Array.from(F.entries()).filter(([e,t])=>t!==""&&e!==p).forEach(([e,t])=>{r[e]=t}),Array.from(d.entries()).filter(([,e])=>e.length>0).forEach(([e,t])=>{r[e]=t}),Array.from(w.entries()).filter(([,e])=>e.filterType!==void 0).forEach(([e,t])=>{t.filterType==="CUSTOM"?r[e]={gte:t.gte.toString(),lte:t.lte.toString()}:r[e]=t.filterType}),Array.from(y.entries()).filter(([,e])=>e.gte!==void 0||e.lte!==void 0).forEach(([e,t])=>{r[e]={},t.gte!==void 0&&(r[e].gte=t.gte.toString()),t.isValidLte&&t.lte&&(r[e].lte=t.lte.toString())});let i=l.get(n);return l.has(n)||(i=S.get(n)),{arg:{type:m,filters:{filter:r,page:i==null?void 0:i.page},title:i==null?void 0:i.label},currentView:i}};return{getActiveViewInAPIFormat:f,saveChanges:async()=>{if(n)try{o(!0);const{arg:r,currentView:i}=f();await C.patchCustomView(n,{attributes:r}),await E();const c={...i,filterMaps:{filters:new Map(Object.entries(r.filters.filter).filter(([e,t])=>!Array.isArray(t)&&typeof t=="string"&&!a.includes(e)).map(([e,t])=>[e,t])),arrayFilters:new Map(Object.entries(r.filters.filter).filter(([,e])=>Array.isArray(e)).map(([e,t])=>[e,t])),rangeFilters:new Map(Object.entries(r.filters.filter).filter(([e])=>a.includes(e)).map(([e,t])=>{const s=new T.RangeFilter;return typeof t=="object"?(s.setFilterType("CUSTOM"),s.setDates(g.parseDate(t.gte),g.parseDate(t.lte))):s.setFilterType(t),[e,s]})),numberRangeFilters:new Map(Object.entries(r.filters.filter).filter(([e])=>u.includes(e)).map(([e,t])=>{const s=new R.NumberRangeFilter({filterId:e});return t.gte&&s.setGte(Number(t.gte)),t.lte&&s.setLte(Number(t.lte)),[e,s]}))}};b(c)}catch(r){console.log(r)}finally{o(!1)}},isSubmitting:h}};exports.usePersistUnsavedChanges=q;
package/dist/index56.js CHANGED
@@ -1,11 +1,95 @@
1
- import { useContext as o } from "react";
2
- import { MobXProviderContext as t } from "mobx-react";
3
- const i = () => {
4
- const r = o(t);
5
- if (!r)
6
- throw new Error("useStores must be used within a StoresProvider.");
7
- return r;
1
+ import { useState as h } from "react";
2
+ import { parseDate as c } from "@internationalized/date";
3
+ import { NumberRangeFilter as R } from "./index63.js";
4
+ import { RangeFilter as T } from "./index64.js";
5
+ import { useViews as I } from "./index58.js";
6
+ import { useBusinessLogic as M } from "./index7.js";
7
+ import { useStores as V } from "./index57.js";
8
+ import { patchCustomView as C } from "./index4.js";
9
+ const P = () => {
10
+ const {
11
+ DATE_RANGE_FILTERS: l,
12
+ NUMBER_RANGE_FILTERS: p,
13
+ SEARCH_FILTER_ID: g,
14
+ VIEW_TYPE: F
15
+ } = M(), {
16
+ Filters: {
17
+ activeViewId: o,
18
+ filters: u,
19
+ arrayFilters: w,
20
+ dateRangeFilters: y,
21
+ numberRangeFilters: b,
22
+ initFiltersFromView: d
23
+ },
24
+ Views: { draftViewsMap: E }
25
+ } = V(), { viewsMap: f, mutate: A } = I(), [S, a] = h(!1), n = () => {
26
+ if (!o) throw Error("No active view");
27
+ const r = {};
28
+ Array.from(u.entries()).filter(([t, e]) => e !== "" && t !== g).forEach(([t, e]) => {
29
+ r[t] = e;
30
+ }), Array.from(w.entries()).filter(([, t]) => t.length > 0).forEach(([t, e]) => {
31
+ r[t] = e;
32
+ }), Array.from(y.entries()).filter(([, t]) => t.filterType !== void 0).forEach(([t, e]) => {
33
+ e.filterType === "CUSTOM" ? r[t] = {
34
+ gte: e.gte.toString(),
35
+ lte: e.lte.toString()
36
+ } : r[t] = e.filterType;
37
+ }), Array.from(b.entries()).filter(([, t]) => t.gte !== void 0 || t.lte !== void 0).forEach(([t, e]) => {
38
+ r[t] = {}, e.gte !== void 0 && (r[t].gte = e.gte.toString()), e.isValidLte && e.lte && (r[t].lte = e.lte.toString());
39
+ });
40
+ let i = f.get(o);
41
+ return f.has(o) || (i = E.get(o)), { arg: {
42
+ type: F,
43
+ filters: {
44
+ filter: r,
45
+ page: i == null ? void 0 : i.page
46
+ },
47
+ title: i == null ? void 0 : i.label
48
+ }, currentView: i };
49
+ };
50
+ return {
51
+ getActiveViewInAPIFormat: n,
52
+ saveChanges: async () => {
53
+ if (o)
54
+ try {
55
+ a(!0);
56
+ const { arg: r, currentView: i } = n();
57
+ await C(o, { attributes: r }), await A();
58
+ const m = {
59
+ ...i,
60
+ filterMaps: {
61
+ filters: new Map(
62
+ Object.entries(r.filters.filter).filter(
63
+ ([t, e]) => !Array.isArray(e) && typeof e == "string" && !l.includes(t)
64
+ ).map(([t, e]) => [t, e])
65
+ ),
66
+ arrayFilters: new Map(
67
+ Object.entries(r.filters.filter).filter(([, t]) => Array.isArray(t)).map(([t, e]) => [t, e])
68
+ ),
69
+ rangeFilters: new Map(
70
+ Object.entries(r.filters.filter).filter(([t]) => l.includes(t)).map(([t, e]) => {
71
+ const s = new T();
72
+ return typeof e == "object" ? (s.setFilterType("CUSTOM"), s.setDates(c(e.gte), c(e.lte))) : s.setFilterType(e), [t, s];
73
+ })
74
+ ),
75
+ numberRangeFilters: new Map(
76
+ Object.entries(r.filters.filter).filter(([t]) => p.includes(t)).map(([t, e]) => {
77
+ const s = new R({ filterId: t });
78
+ return e.gte && s.setGte(Number(e.gte)), e.lte && s.setLte(Number(e.lte)), [t, s];
79
+ })
80
+ )
81
+ }
82
+ };
83
+ d(m);
84
+ } catch (r) {
85
+ console.log(r);
86
+ } finally {
87
+ a(!1);
88
+ }
89
+ },
90
+ isSubmitting: S
91
+ };
8
92
  };
9
93
  export {
10
- i as useStores
94
+ P as usePersistUnsavedChanges
11
95
  };
package/dist/index57.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("swr"),c=require("react"),q=require("./index70.cjs"),y=require("./index69.cjs"),S=require("./index59.cjs"),b=require("./index7.cjs"),I=require("./index50.cjs"),h=e=>e&&e.__esModule?e:{default:e},O=h(E),t=q.createAllView(),P=()=>{const{DEFAULT_PAGE_NUMBER:e,DEFAULT_PAGE_SIZE:m,VIEW_TYPE:w}=b.useBusinessLogic(),{canUpdateCustomViews:V,orderedListOfCustomViews:o,defaultCustomViewId:p,isLoading:g,isValidating:M}=S.useCustomViews({type:w}),{data:n,isLoading:A,isValidating:_,error:L,mutate:v}=O.default(`/api/v2/custom_views?filter[type]=${w}&page[number]=${e}&page[size]=${m}`,I.fetcherV2),f=c.useMemo(()=>({fixedViews:[t],customViews:[],viewsMap:new Map([[t.id,t]])}),[]),{viewsMap:x,customViews:u,fixedViews:l}=c.useMemo(()=>n?n.reduce((s,r)=>{const i=y.viewsAdapter({view:r,canUpdateCustomViews:V});return s.viewsMap.set(r.id,i),r.editable?s.customViews.push(i):s.fixedViews.push(i),s},{fixedViews:[t],customViews:[],viewsMap:new Map([[t.id,t]])}):f,[n,f,V]),C=c.useMemo(()=>u.sort((s,r)=>{const i=Array.isArray(o)?o:[],a=i.indexOf(s.id),d=i.indexOf(r.id);return a===-1&&d===-1?0:a===-1?1:d===-1?-1:a-d}),[u,o]);return{defaultCustomViewId:p,viewsArray:[...l,...u],fixedViews:l,customViews:u,sortedCustomViews:C,viewsMap:x,isLoading:A||_||g||M,error:L,mutate:v}};exports.useViews=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),r=require("mobx-react"),o=()=>{const e=t.useContext(r.MobXProviderContext);if(!e)throw new Error("useStores must be used within a StoresProvider.");return e};exports.useStores=o;
package/dist/index57.js CHANGED
@@ -1,53 +1,11 @@
1
- import _ from "swr";
2
- import { useMemo as d } from "react";
3
- import { createAllView as y } from "./index70.js";
4
- import { viewsAdapter as I } from "./index69.js";
5
- import { useCustomViews as U } from "./index59.js";
6
- import { useBusinessLogic as b } from "./index7.js";
7
- import { fetcherV2 as h } from "./index50.js";
8
- const s = y(), F = () => {
9
- const { DEFAULT_PAGE_NUMBER: p, DEFAULT_PAGE_SIZE: c, VIEW_TYPE: m } = b(), {
10
- canUpdateCustomViews: w,
11
- orderedListOfCustomViews: o,
12
- defaultCustomViewId: l,
13
- isLoading: g,
14
- isValidating: x
15
- } = U({ type: m }), { data: n, isLoading: A, isValidating: L, error: E, mutate: M } = _(
16
- `/api/v2/custom_views?filter[type]=${m}&page[number]=${p}&page[size]=${c}`,
17
- h
18
- ), V = d(
19
- () => ({
20
- fixedViews: [s],
21
- customViews: [],
22
- viewsMap: /* @__PURE__ */ new Map([[s.id, s]])
23
- }),
24
- []
25
- ), { viewsMap: C, customViews: r, fixedViews: f } = d(() => n ? n.reduce(
26
- (e, t) => {
27
- const i = I({ view: t, canUpdateCustomViews: w });
28
- return e.viewsMap.set(t.id, i), t.editable ? e.customViews.push(i) : e.fixedViews.push(i), e;
29
- },
30
- {
31
- fixedViews: [s],
32
- customViews: [],
33
- viewsMap: /* @__PURE__ */ new Map([[s.id, s]])
34
- }
35
- ) : V, [n, V, w]), v = d(() => r.sort((e, t) => {
36
- const i = Array.isArray(o) ? o : [], a = i.indexOf(e.id), u = i.indexOf(t.id);
37
- return a === -1 && u === -1 ? 0 : a === -1 ? 1 : u === -1 ? -1 : a - u;
38
- }), [r, o]);
39
- return {
40
- defaultCustomViewId: l,
41
- viewsArray: [...f, ...r],
42
- fixedViews: f,
43
- customViews: r,
44
- sortedCustomViews: v,
45
- viewsMap: C,
46
- isLoading: A || L || g || x,
47
- error: E,
48
- mutate: M
49
- };
1
+ import { useContext as o } from "react";
2
+ import { MobXProviderContext as t } from "mobx-react";
3
+ const i = () => {
4
+ const r = o(t);
5
+ if (!r)
6
+ throw new Error("useStores must be used within a StoresProvider.");
7
+ return r;
50
8
  };
51
9
  export {
52
- F as useViews
10
+ i as useStores
53
11
  };
package/dist/index58.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react"),E=require("./index70.cjs"),I=require("./index59.cjs"),C=require("./index57.cjs"),S=require("./index7.cjs"),F=require("./index56.cjs"),q=()=>{const{VIEW_TYPE:m,SEARCH_FILTER_ID:c}=S.useBusinessLogic(),{Filters:{activeViewId:d,initFiltersFromView:e,initFromUrl:t,discardChanges:u,updateUrl:L,setFilter:f}}=F.useStores(),{isLoading:v,isValidating:p}=I.useCustomViews({type:m}),{viewsMap:s,defaultCustomViewId:w,isLoading:h}=C.useViews(),g=p||h||v;V.useEffect(()=>{if(g)return;const i=new URLSearchParams(window.location.search),l=i.get("view"),a=i.get(c),n=i.size>0;if(!d){if(l){const o=s.get(l);if(o)e(o),n&&t();else{const r=s.get(w);r&&(e(r),n&&t(!1))}}else{const o=s.get(w);if(o)e(o),u(!0),n&&t();else{const r=s.get(E.ALL_VIEW_ID);r&&e(r)}}a&&f(c,a)}},[c,d,w,u,e,t,g,f,L,s]),V.useEffect(()=>{const i=()=>{const a=new URLSearchParams(window.location.search).get("view");if(!a)return;const n=s.get(a);n&&(e(n),t())};return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[u,e,t,s])};exports.useViewUrlChange=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("swr"),c=require("react"),q=require("./index72.cjs"),y=require("./index71.cjs"),S=require("./index60.cjs"),b=require("./index7.cjs"),I=require("./index51.cjs"),h=e=>e&&e.__esModule?e:{default:e},O=h(E),t=q.createAllView(),P=()=>{const{DEFAULT_PAGE_NUMBER:e,DEFAULT_PAGE_SIZE:m,VIEW_TYPE:w}=b.useBusinessLogic(),{canUpdateCustomViews:V,orderedListOfCustomViews:o,defaultCustomViewId:p,isLoading:g,isValidating:M}=S.useCustomViews({type:w}),{data:n,isLoading:A,isValidating:_,error:L,mutate:v}=O.default(`/api/v2/custom_views?filter[type]=${w}&page[number]=${e}&page[size]=${m}`,I.fetcherV2),f=c.useMemo(()=>({fixedViews:[t],customViews:[],viewsMap:new Map([[t.id,t]])}),[]),{viewsMap:x,customViews:u,fixedViews:l}=c.useMemo(()=>n?n.reduce((s,r)=>{const i=y.viewsAdapter({view:r,canUpdateCustomViews:V});return s.viewsMap.set(r.id,i),r.editable?s.customViews.push(i):s.fixedViews.push(i),s},{fixedViews:[t],customViews:[],viewsMap:new Map([[t.id,t]])}):f,[n,f,V]),C=c.useMemo(()=>u.sort((s,r)=>{const i=Array.isArray(o)?o:[],a=i.indexOf(s.id),d=i.indexOf(r.id);return a===-1&&d===-1?0:a===-1?1:d===-1?-1:a-d}),[u,o]);return{defaultCustomViewId:p,viewsArray:[...l,...u],fixedViews:l,customViews:u,sortedCustomViews:C,viewsMap:x,isLoading:A||_||g||M,error:L,mutate:v}};exports.useViews=P;
package/dist/index58.js CHANGED
@@ -1,64 +1,53 @@
1
- import { useEffect as u } from "react";
2
- import { ALL_VIEW_ID as I } from "./index70.js";
3
- import { useCustomViews as E } from "./index59.js";
4
- import { useViews as F } from "./index57.js";
5
- import { useBusinessLogic as C } from "./index7.js";
6
- import { useStores as D } from "./index56.js";
7
- const T = () => {
8
- const { VIEW_TYPE: g, SEARCH_FILTER_ID: c } = C(), {
9
- Filters: {
10
- activeViewId: d,
11
- initFiltersFromView: e,
12
- initFromUrl: i,
13
- discardChanges: w,
14
- updateUrl: L,
15
- setFilter: l
1
+ import _ from "swr";
2
+ import { useMemo as d } from "react";
3
+ import { createAllView as y } from "./index72.js";
4
+ import { viewsAdapter as I } from "./index71.js";
5
+ import { useCustomViews as U } from "./index60.js";
6
+ import { useBusinessLogic as b } from "./index7.js";
7
+ import { fetcherV2 as h } from "./index51.js";
8
+ const s = y(), F = () => {
9
+ const { DEFAULT_PAGE_NUMBER: p, DEFAULT_PAGE_SIZE: c, VIEW_TYPE: m } = b(), {
10
+ canUpdateCustomViews: w,
11
+ orderedListOfCustomViews: o,
12
+ defaultCustomViewId: l,
13
+ isLoading: g,
14
+ isValidating: x
15
+ } = U({ type: m }), { data: n, isLoading: A, isValidating: L, error: E, mutate: M } = _(
16
+ `/api/v2/custom_views?filter[type]=${m}&page[number]=${p}&page[size]=${c}`,
17
+ h
18
+ ), V = d(
19
+ () => ({
20
+ fixedViews: [s],
21
+ customViews: [],
22
+ viewsMap: /* @__PURE__ */ new Map([[s.id, s]])
23
+ }),
24
+ []
25
+ ), { viewsMap: C, customViews: r, fixedViews: f } = d(() => n ? n.reduce(
26
+ (e, t) => {
27
+ const i = I({ view: t, canUpdateCustomViews: w });
28
+ return e.viewsMap.set(t.id, i), t.editable ? e.customViews.push(i) : e.fixedViews.push(i), e;
29
+ },
30
+ {
31
+ fixedViews: [s],
32
+ customViews: [],
33
+ viewsMap: /* @__PURE__ */ new Map([[s.id, s]])
16
34
  }
17
- } = D(), { isLoading: V, isValidating: v } = E({ type: g }), { viewsMap: t, defaultCustomViewId: f, isLoading: h } = F(), p = v || h || V;
18
- u(() => {
19
- if (p) return;
20
- const s = new URLSearchParams(window.location.search), m = s.get("view"), a = s.get(c), o = s.size > 0;
21
- if (!d) {
22
- if (m) {
23
- const r = t.get(m);
24
- if (r)
25
- e(r), o && i();
26
- else {
27
- const n = t.get(f);
28
- n && (e(n), o && i(!1));
29
- }
30
- } else {
31
- const r = t.get(f);
32
- if (r)
33
- e(r), w(!0), o && i();
34
- else {
35
- const n = t.get(I);
36
- n && e(n);
37
- }
38
- }
39
- a && l(c, a);
40
- }
41
- }, [
42
- c,
43
- d,
44
- f,
45
- w,
46
- e,
47
- i,
48
- p,
49
- l,
50
- L,
51
- t
52
- ]), u(() => {
53
- const s = () => {
54
- const a = new URLSearchParams(window.location.search).get("view");
55
- if (!a) return;
56
- const o = t.get(a);
57
- o && (e(o), i());
58
- };
59
- return window.addEventListener("popstate", s), () => window.removeEventListener("popstate", s);
60
- }, [w, e, i, t]);
35
+ ) : V, [n, V, w]), v = d(() => r.sort((e, t) => {
36
+ const i = Array.isArray(o) ? o : [], a = i.indexOf(e.id), u = i.indexOf(t.id);
37
+ return a === -1 && u === -1 ? 0 : a === -1 ? 1 : u === -1 ? -1 : a - u;
38
+ }), [r, o]);
39
+ return {
40
+ defaultCustomViewId: l,
41
+ viewsArray: [...f, ...r],
42
+ fixedViews: f,
43
+ customViews: r,
44
+ sortedCustomViews: v,
45
+ viewsMap: C,
46
+ isLoading: A || L || g || x,
47
+ error: E,
48
+ mutate: M
49
+ };
61
50
  };
62
51
  export {
63
- T as useViewUrlChange
52
+ F as useViews
64
53
  };
package/dist/index59.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("swr"),v=require("./index50.cjs"),S=s=>s&&s.__esModule?s:{default:s},h=S(a),y=({type:s})=>{var o,t,i,n,u,r,c,m;const{data:e,isLoading:_,isValidating:l,error:w,mutate:f}=h.default("/current_user",v.fetcherV1),p=(t=(o=e==null?void 0:e.settings)==null?void 0:o.custom_view_positions)==null?void 0:t[s],V=(u=(n=(i=e==null?void 0:e.settings)==null?void 0:i.default_custom_views)==null?void 0:n[s])==null?void 0:u.toString(),d=!!((r=e==null?void 0:e.permissions)!=null&&r.delete_company_custom_views),g=!!((c=e==null?void 0:e.permissions)!=null&&c.update_company_custom_views),C=!!((m=e==null?void 0:e.permissions)!=null&&m.share_custom_views);return{canDeleteCustomViews:d,canUpdateCustomViews:g,canShareCustomViews:C,orderedListOfCustomViews:p,defaultCustomViewId:V,isLoading:_,isValidating:l,error:w,mutate:f}};exports.useCustomViews=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react"),E=require("./index72.cjs"),I=require("./index60.cjs"),C=require("./index58.cjs"),S=require("./index7.cjs"),F=require("./index57.cjs"),q=()=>{const{VIEW_TYPE:m,SEARCH_FILTER_ID:c}=S.useBusinessLogic(),{Filters:{activeViewId:d,initFiltersFromView:e,initFromUrl:t,discardChanges:u,updateUrl:L,setFilter:f}}=F.useStores(),{isLoading:v,isValidating:p}=I.useCustomViews({type:m}),{viewsMap:s,defaultCustomViewId:w,isLoading:h}=C.useViews(),g=p||h||v;V.useEffect(()=>{if(g)return;const i=new URLSearchParams(window.location.search),l=i.get("view"),a=i.get(c),n=i.size>0;if(!d){if(l){const o=s.get(l);if(o)e(o),n&&t();else{const r=s.get(w);r&&(e(r),n&&t(!1))}}else{const o=s.get(w);if(o)e(o),u(!0),n&&t();else{const r=s.get(E.ALL_VIEW_ID);r&&e(r)}}a&&f(c,a)}},[c,d,w,u,e,t,g,f,L,s]),V.useEffect(()=>{const i=()=>{const a=new URLSearchParams(window.location.search).get("view");if(!a)return;const n=s.get(a);n&&(e(n),t())};return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[u,e,t,s])};exports.useViewUrlChange=q;
package/dist/index59.js CHANGED
@@ -1,20 +1,64 @@
1
- import h from "swr";
2
- import { fetcherV1 as B } from "./index50.js";
3
- const d = ({ type: e }) => {
4
- var o, t, i, n, r, m, u, c;
5
- const { data: s, isLoading: _, isValidating: w, error: p, mutate: l } = h("/current_user", B), V = (t = (o = s == null ? void 0 : s.settings) == null ? void 0 : o.custom_view_positions) == null ? void 0 : t[e], f = (r = (n = (i = s == null ? void 0 : s.settings) == null ? void 0 : i.default_custom_views) == null ? void 0 : n[e]) == null ? void 0 : r.toString(), C = !!((m = s == null ? void 0 : s.permissions) != null && m.delete_company_custom_views), g = !!((u = s == null ? void 0 : s.permissions) != null && u.update_company_custom_views), v = !!((c = s == null ? void 0 : s.permissions) != null && c.share_custom_views);
6
- return {
7
- canDeleteCustomViews: C,
8
- canUpdateCustomViews: g,
9
- canShareCustomViews: v,
10
- orderedListOfCustomViews: V,
11
- defaultCustomViewId: f,
12
- isLoading: _,
13
- isValidating: w,
14
- error: p,
15
- mutate: l
16
- };
1
+ import { useEffect as u } from "react";
2
+ import { ALL_VIEW_ID as I } from "./index72.js";
3
+ import { useCustomViews as E } from "./index60.js";
4
+ import { useViews as F } from "./index58.js";
5
+ import { useBusinessLogic as C } from "./index7.js";
6
+ import { useStores as D } from "./index57.js";
7
+ const T = () => {
8
+ const { VIEW_TYPE: g, SEARCH_FILTER_ID: c } = C(), {
9
+ Filters: {
10
+ activeViewId: d,
11
+ initFiltersFromView: e,
12
+ initFromUrl: i,
13
+ discardChanges: w,
14
+ updateUrl: L,
15
+ setFilter: l
16
+ }
17
+ } = D(), { isLoading: V, isValidating: v } = E({ type: g }), { viewsMap: t, defaultCustomViewId: f, isLoading: h } = F(), p = v || h || V;
18
+ u(() => {
19
+ if (p) return;
20
+ const s = new URLSearchParams(window.location.search), m = s.get("view"), a = s.get(c), o = s.size > 0;
21
+ if (!d) {
22
+ if (m) {
23
+ const r = t.get(m);
24
+ if (r)
25
+ e(r), o && i();
26
+ else {
27
+ const n = t.get(f);
28
+ n && (e(n), o && i(!1));
29
+ }
30
+ } else {
31
+ const r = t.get(f);
32
+ if (r)
33
+ e(r), w(!0), o && i();
34
+ else {
35
+ const n = t.get(I);
36
+ n && e(n);
37
+ }
38
+ }
39
+ a && l(c, a);
40
+ }
41
+ }, [
42
+ c,
43
+ d,
44
+ f,
45
+ w,
46
+ e,
47
+ i,
48
+ p,
49
+ l,
50
+ L,
51
+ t
52
+ ]), u(() => {
53
+ const s = () => {
54
+ const a = new URLSearchParams(window.location.search).get("view");
55
+ if (!a) return;
56
+ const o = t.get(a);
57
+ o && (e(o), i());
58
+ };
59
+ return window.addEventListener("popstate", s), () => window.removeEventListener("popstate", s);
60
+ }, [w, e, i, t]);
17
61
  };
18
62
  export {
19
- d as useCustomViews
63
+ T as useViewUrlChange
20
64
  };
package/dist/index6.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("axios"),i=require("./index71.cjs"),s=require("./index72.cjs"),l=require("./index73.cjs"),E=require("./index74.cjs"),p=t=>t&&t.__esModule?t:{default:t},c=p(u),y=async(t,a)=>{const o=new Error,r=s.filterOptionalArgsGetDelete(t,a);try{return await c.default.get(...r)}catch(e){throw l.filterErrorStack(o),E.injectIntoError({customError:o,originalError:e,type:i.AxiosErrorType.GET}),e}},f=async(t,a)=>{const o=new Error,r=s.filterOptionalArgsGetDelete(t,a);try{return await c.default.delete(...r)}catch(e){throw l.filterErrorStack(o),E.injectIntoError({customError:o,originalError:e,type:i.AxiosErrorType.DELETE}),e}},g=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.post(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.POST}),n}},w=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.patch(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.PATCH}),n}},A=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.put(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.PUT}),n}},d=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.postForm(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.POST_FORM}),n}},h=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.putForm(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.PUT_FORM}),n}},T=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.patchForm(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.PATCH_FORM}),n}},m={get:y,delete:f,post:g,patch:w,put:A,postForm:d,putForm:h,patchForm:T,CancelToken:c.default.CancelToken,isCancel:c.default.isCancel,getUri:c.default.getUri,isAxiosError:c.default.isAxiosError};exports.axios=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("axios"),i=require("./index73.cjs"),s=require("./index74.cjs"),l=require("./index75.cjs"),E=require("./index76.cjs"),p=t=>t&&t.__esModule?t:{default:t},c=p(u),y=async(t,a)=>{const o=new Error,r=s.filterOptionalArgsGetDelete(t,a);try{return await c.default.get(...r)}catch(e){throw l.filterErrorStack(o),E.injectIntoError({customError:o,originalError:e,type:i.AxiosErrorType.GET}),e}},f=async(t,a)=>{const o=new Error,r=s.filterOptionalArgsGetDelete(t,a);try{return await c.default.delete(...r)}catch(e){throw l.filterErrorStack(o),E.injectIntoError({customError:o,originalError:e,type:i.AxiosErrorType.DELETE}),e}},g=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.post(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.POST}),n}},w=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.patch(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.PATCH}),n}},A=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.put(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.PUT}),n}},d=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.postForm(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.POST_FORM}),n}},h=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.putForm(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.PUT_FORM}),n}},T=async(t,a,o)=>{const r=new Error,e=s.filterOptionalArgs(t,a,o);try{return await c.default.patchForm(...e)}catch(n){throw l.filterErrorStack(r),E.injectIntoError({customError:r,originalError:n,type:i.AxiosErrorType.PATCH_FORM}),n}},m={get:y,delete:f,post:g,patch:w,put:A,postForm:d,putForm:h,patchForm:T,CancelToken:c.default.CancelToken,isCancel:c.default.isCancel,getUri:c.default.getUri,isAxiosError:c.default.isAxiosError};exports.axios=m;
package/dist/index6.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import a from "axios";
2
- import { AxiosErrorType as e } from "./index71.js";
3
- import { filterOptionalArgsGetDelete as y, filterOptionalArgs as p } from "./index72.js";
4
- import { filterErrorStack as i } from "./index73.js";
5
- import { injectIntoError as E } from "./index74.js";
2
+ import { AxiosErrorType as e } from "./index73.js";
3
+ import { filterOptionalArgsGetDelete as y, filterOptionalArgs as p } from "./index74.js";
4
+ import { filterErrorStack as i } from "./index75.js";
5
+ import { injectIntoError as E } from "./index76.js";
6
6
  const m = async (n, s) => {
7
7
  const o = new Error(), r = y(n, s);
8
8
  try {
package/dist/index60.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var N=Object.defineProperty;var C=(d,e,l)=>e in d?N(d,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):d[e]=l;var g=(d,e,l)=>C(d,typeof e!="symbol"?e+"":e,l);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("mobx"),U=require("@veeqo/ui"),D=require("@internationalized/date"),P=require("lodash/isEqual"),u=require("./index44.cjs"),b=require("./index62.cjs"),L=require("./index61.cjs"),v=require("./index70.cjs"),V=require("./index68.cjs"),y=require("./index8.cjs"),B=d=>d&&d.__esModule?d:{default:d},I=B(P);class G{constructor(){g(this,"defaultPageSize");g(this,"pageSize");g(this,"currentPage");g(this,"defaultFilters");g(this,"defaultArrayFilters");g(this,"defaultDateRangeFilters");g(this,"defaultNumberRangeFilters");g(this,"filters");g(this,"arrayFilters");g(this,"dateRangeFilters");g(this,"numberRangeFilters");g(this,"activeViewId");g(this,"isFiltersDropdownVisible");g(this,"initDefaultFilterMaps",()=>{this.defaultFilters=new Map(this.filters),this.defaultArrayFilters=new Map(this.arrayFilters),this.defaultDateRangeFilters=new Map(this.dateRangeFilters),this.defaultNumberRangeFilters=new Map(this.numberRangeFilters)});g(this,"updateUrl",(e=!1)=>{try{const l=`${window.location.pathname}?${this.queryParams}`;e?window.history.pushState({},"",l):window.history.replaceState({},"",l)}catch(l){console.log(l)}});g(this,"setCurrentPage",e=>{this.currentPage=e});g(this,"setPageSize",e=>{this.pageSize=e});g(this,"setFilter",(e,l)=>{this.filters.set(e,l),this.updateUrl()});g(this,"clearFilter",e=>{this.filters.set(e,""),this.updateUrl()});g(this,"setArrayFilter",(e,l)=>{this.arrayFilters.set(e,l),this.updateUrl()});g(this,"clearArrayFilter",e=>{this.arrayFilters.set(e,[]),this.updateUrl()});g(this,"setRangeFilter",({key:e,range:l,dates:r})=>{l.setFilterType(e),l.setDates(r.start,r.end),this.updateUrl()});g(this,"clearRangeFilter",e=>{const l=this.dateRangeFilters.get(e);l&&(l.clear(),this.updateUrl())});g(this,"setNumberRangeFilter",({numberRange:e,gte:l,lte:r})=>{e.setGte(l),e.setLte(r),this.updateUrl()});g(this,"clearNumberRangeFilter",e=>{const l=this.numberRangeFilters.get(e);l&&(l.clear(),this.updateUrl())});g(this,"clearAllFilters",(e=!1)=>{const{SEARCH_FILTER_ID:l}=y.BusinessLogicManager.getBusinessLogic();this.filters.forEach((r,t)=>{t!==l&&this.filters.set(t,"")}),this.arrayFilters.forEach((r,t)=>this.arrayFilters.set(t,[])),this.dateRangeFilters.forEach(r=>r.clear()),this.numberRangeFilters.forEach(r=>r.clear()),e||this.updateUrl()});g(this,"clearFiltersForGroup",e=>{const{GROUP_MAP:l}=y.BusinessLogicManager.getBusinessLogic(),r=l.get(e);r&&r.fields.forEach(t=>{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)})});g(this,"setActiveViewId",e=>{this.activeViewId=e,this.updateUrl()});g(this,"toggleFiltersDropdownVisible",e=>{this.isFiltersDropdownVisible=e});g(this,"getFiltersForGroup",e=>{const{GROUP_MAP:l}=y.BusinessLogicManager.getBusinessLogic(),r=l.get(e);if(!r)return{};const t={};return r.fields.forEach(a=>{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)}),t});g(this,"initFiltersFromView",e=>{var r;const{PAGE_SIZE_OPTIONS:l}=y.BusinessLogicManager.getBusinessLogic();(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(Array.from(e.filterMaps.rangeFilters.entries()).map(([t,a])=>{const n=new b.RangeFilter(a.filterType);return a.gte&&a.lte&&n.setDates(a.gte,a.lte),[t,n]})),this.defaultNumberRangeFilters=new Map(Array.from(e.filterMaps.numberRangeFilters.entries()).map(([t,a])=>{const n=a.clone();return a.gte&&n.setGte(a.gte),a.lte&&n.setLte(a.lte),[t,n]})),this.filters=new Map(e.filterMaps.filters),this.arrayFilters=new Map(e.filterMaps.arrayFilters),this.dateRangeFilters=new Map(Array.from(e.filterMaps.rangeFilters.entries()).map(([t,a])=>{const n=new b.RangeFilter(a.filterType);return a.gte&&a.lte&&n.setDates(a.gte,a.lte),[t,n]})),this.numberRangeFilters=new Map(Array.from(e.filterMaps.numberRangeFilters.entries()).map(([t,a])=>{const n=a.clone();return a.gte&&n.setGte(a.gte),a.lte&&n.setLte(a.lte),[t,n]})),this.activeViewId=e.id});g(this,"initFromUrl",(e=!0)=>{const{GROUP_MAP:l,NUMBER_RANGE_FILTERS:r,PAGE_SIZE_OPTIONS:t,PAGE_SIZE_FILTER_ID:a}=y.BusinessLogicManager.getBusinessLogic(),n=new URLSearchParams(window.location.search),f=Array.from(l.values()).flatMap(i=>i.fields),F=new Map,w=new Map,M=new Map,R=new Map,o=new Map;Array.from(n.entries()).forEach(([i,s])=>{(i.includes("_gte")||i.includes("_lte"))&&o.set(i,s)}),Array.from(n.entries()).forEach(([i,s])=>{if(i==="view"&&e){this.activeViewId=s;return}if(i===a&&t.includes(Number(s))){this.pageSize=Number(s);return}let p=f.find(c=>c.id===i);if(!p){const c=i.replace(/_[gl]te$/,"");r.includes(c)&&(p=f.find(m=>m.id===c))}if(p)switch(p.filterType){case u.FilterChoiceValue.CHECKBOX:s&&w.set(i,s.split(","));break;case u.FilterChoiceValue.DATE_RANGE:let c;if(s==="CUSTOM"){c=new b.RangeFilter("CUSTOM");const S=o.get(`${i}_gte`),_=o.get(`${i}_lte`);S&&_&&c.setDates(D.parseDate(S),D.parseDate(_))}else V.isValidDateRange(s)?c=new b.RangeFilter(s):c=new b.RangeFilter(U.DateRanges.TODAY);M.set(i,c);break;case u.FilterChoiceValue.NUMBER_RANGE:const m=new L.NumberRangeFilter({filterId:p.id}),A=i.replace(/_[gl]te$/,""),E=o.get(`${A}_gte`),T=o.get(`${A}_lte`);E&&m.setGte(Number(E)),T&&m.setLte(Number(T)),R.set(A,m);break;case u.FilterChoiceValue.TEXT:case u.FilterChoiceValue.NUMBER:case u.FilterChoiceValue.RADIO:F.set(i,s);break}}),this.filters=F,this.arrayFilters=w,this.dateRangeFilters=M,this.numberRangeFilters=R,this.updateUrl()});g(this,"discardChanges",(e=!1)=>{this.pageSize=this.defaultPageSize;const{SEARCH_FILTER_ID:l}=y.BusinessLogicManager.getBusinessLogic(),r=new Map(this.defaultFilters);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)=>{const n=new b.RangeFilter(t.filterType);n.setDates(t.gte,t.lte),this.dateRangeFilters.set(a,n)}),this.numberRangeFilters.clear(),this.defaultNumberRangeFilters.forEach((t,a)=>{this.numberRangeFilters.set(a,t.clone())}),this.updateUrl(e)});const{GROUP_MAP:e}=y.BusinessLogicManager.getBusinessLogic(),l=Array.from(e.values()).flatMap(r=>r.fields);this.filters=new Map(l.filter(r=>r.filterType===u.FilterChoiceValue.TEXT||r.filterType===u.FilterChoiceValue.NUMBER||r.filterType===u.FilterChoiceValue.RADIO||r.filterType===u.FilterChoiceValue.DATE_RANGE).map(r=>[r.id,""])),this.arrayFilters=new Map(l.filter(r=>r.filterType===u.FilterChoiceValue.CHECKBOX).map(r=>[r.id,[]])),this.dateRangeFilters=new Map(l.filter(r=>r.filterType===u.FilterChoiceValue.DATE_RANGE).map(r=>[r.id,new b.RangeFilter])),this.numberRangeFilters=new Map(l.filter(r=>r.filterType===u.FilterChoiceValue.NUMBER_RANGE).map(r=>{const t=new L.NumberRangeFilter({filterId:r.id});return[r.id,t]})),this.defaultArrayFilters=new Map,this.defaultFilters=new Map,this.defaultDateRangeFilters=new Map,this.defaultNumberRangeFilters=new Map,this.currentPage=1,this.pageSize=10,this.defaultPageSize=10,this.initDefaultFilterMaps(),this.isFiltersDropdownVisible=!1,this.activeViewId=void 0,h.makeObservable(this,{defaultPageSize:h.observable,pageSize:h.observable,currentPage:h.observable,defaultFilters:h.observable,defaultArrayFilters:h.observable,defaultDateRangeFilters:h.observable,defaultNumberRangeFilters:h.observable,filters:h.observable,arrayFilters:h.observable,numberRangeFilters:h.observable,dateRangeFilters:h.observable,isFiltersDropdownVisible:h.observable,activeViewId:h.observable,setPageSize:h.action,setCurrentPage:h.action,toggleFiltersDropdownVisible:h.action,setActiveViewId:h.action,setFilter:h.action,setArrayFilter:h.action,setRangeFilter:h.action,setNumberRangeFilter:h.action,clearFilter:h.action,clearArrayFilter:h.action,clearRangeFilter:h.action,clearNumberRangeFilter:h.action,clearAllFilters:h.action,getFiltersForGroup:h.action,clearFiltersForGroup:h.action,initFromUrl:h.action,initFiltersFromView:h.action,initDefaultFilterMaps:h.action,discardChanges:h.action,updateUrl:h.action,hasActiveFilters:h.computed,activeFilterKeysList:h.computed,queryParams:h.computed,hasUnsavedChanges:h.computed})}get hasActiveFilters(){const{GROUP_MAP:e}=y.BusinessLogicManager.getBusinessLogic(),l=Array.from(e.values()).flatMap(t=>t.fields),r=new Set(l.map(t=>t.id));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)}get activeFilterKeysList(){const{DATE_RANGE_FILTERS:e,NUMBER_RANGE_FILTERS:l}=y.BusinessLogicManager.getBusinessLogic(),r=Array.from(this.filters.entries()).filter(([F,w])=>w!==""&&!e.includes(F)&&!l.includes(F)).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);return[...new Set([...r,...t,...a,...n])]}get queryParams(){const{DATE_RANGE_FILTERS:e,NUMBER_RANGE_FILTERS:l,PAGE_SIZE_FILTER_ID:r,PAGE_NUMBER_FILTER_ID:t}=y.BusinessLogicManager.getBusinessLogic(),a=new URLSearchParams;return Array.from(this.filters.entries()).filter(([n,f])=>f!==""&&!e.includes(n)&&!l.includes(n)).forEach(([n,f])=>{a.append(n,f)}),Array.from(this.arrayFilters.entries()).filter(([,n])=>n.length>0).forEach(([n,f])=>{a.append(n,f.join(","))}),Array.from(this.dateRangeFilters.entries()).filter(([,n])=>n.filterType!==void 0).forEach(([n,f])=>{a.set(n,f.filterType),f.filterType==="CUSTOM"&&(a.set(`${n}_gte`,f.gte.toString()),a.set(`${n}_lte`,f.lte.toString()))}),Array.from(this.numberRangeFilters.entries()).filter(([,n])=>n.isActive).forEach(([n,f])=>{f.gte!==void 0&&a.set(`${n}_gte`,f.gte.toString()),f.isValidLte&&a.set(`${n}_lte`,f.lte.toString())}),this.activeViewId&&a.set("view",this.activeViewId),a.set(r,this.pageSize.toString()),a.set(t,this.currentPage.toString()),a.toString()}get hasUnsavedChanges(){if(this.activeViewId===v.ALL_VIEW_ID)return!1;if(this.defaultPageSize!==this.pageSize)return!0;const{GROUP_MAP:e,SEARCH_FILTER_ID:l}=y.BusinessLogicManager.getBusinessLogic(),r=Array.from(e.values()).flatMap(o=>o.fields),t=new Set(r.map(o=>o.id));if(Array.from(this.filters.entries()).filter(([o])=>o!==l&&t.has(o)).some(([o,i])=>{const s=this.defaultFilters.get(o);return s===void 0&&i!==""||s!==void 0&&i!==s}))return!0;const n=Array.from(this.defaultArrayFilters.entries()).filter(([o])=>t.has(o)).some(([o,i])=>{const s=this.defaultArrayFilters.get(o)||[];return i.length>0||s.length>0?i.length!==s.length||!I.default(i,s):!1}),f=Array.from(this.arrayFilters.entries()).filter(([o])=>t.has(o)).some(([o,i])=>{const s=this.defaultArrayFilters.get(o)||[];return i.length>0||s.length>0?i.length!==s.length||!I.default(i,s):!1});if(n||f)return!0;const F=Array.from(this.numberRangeFilters.entries()).filter(([o])=>t.has(o)).some(([o,i])=>{const s=this.defaultNumberRangeFilters.get(o);return!i.isEqual(s)});if(Array.from(this.defaultNumberRangeFilters.entries()).filter(([o])=>t.has(o)).some(([o,i])=>{const s=this.numberRangeFilters.get(o);return!i.isEqual(s)})||F)return!0;const M=Array.from(this.defaultDateRangeFilters.entries()).filter(([o])=>t.has(o)).some(([o,i])=>{var p,c,m,A;const s=this.dateRangeFilters.get(o);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())!==((c=s.gte)==null?void 0:c.toString())||((m=i.lte)==null?void 0:m.toString())!==((A=s.lte)==null?void 0:A.toString()):!1});return Array.from(this.dateRangeFilters.entries()).filter(([o])=>t.has(o)).some(([o,i])=>{var p,c,m,A;const s=this.defaultDateRangeFilters.get(o);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())!==((c=s.gte)==null?void 0:c.toString())||((m=i.lte)==null?void 0:m.toString())!==((A=s.lte)==null?void 0:A.toString()):!1})||M}}exports.Filters=G;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("swr"),v=require("./index51.cjs"),S=s=>s&&s.__esModule?s:{default:s},h=S(a),y=({type:s})=>{var o,t,i,n,u,r,c,m;const{data:e,isLoading:_,isValidating:l,error:w,mutate:f}=h.default("/current_user",v.fetcherV1),p=(t=(o=e==null?void 0:e.settings)==null?void 0:o.custom_view_positions)==null?void 0:t[s],V=(u=(n=(i=e==null?void 0:e.settings)==null?void 0:i.default_custom_views)==null?void 0:n[s])==null?void 0:u.toString(),d=!!((r=e==null?void 0:e.permissions)!=null&&r.delete_company_custom_views),g=!!((c=e==null?void 0:e.permissions)!=null&&c.update_company_custom_views),C=!!((m=e==null?void 0:e.permissions)!=null&&m.share_custom_views);return{canDeleteCustomViews:d,canUpdateCustomViews:g,canShareCustomViews:C,orderedListOfCustomViews:p,defaultCustomViewId:V,isLoading:_,isValidating:l,error:w,mutate:f}};exports.useCustomViews=y;