@veeqo/transfigure 1.1.2 → 1.1.3

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 (230) hide show
  1. package/dist/BusinessLogic/mocks.d.ts +1 -1
  2. package/dist/BusinessLogic/types.d.ts +2 -1
  3. package/dist/hooks/useUrlParams/useUrlParams.test.d.ts +1 -0
  4. package/dist/index.cjs +1 -1
  5. package/dist/index.js +160 -158
  6. package/dist/index10.cjs +1 -1
  7. package/dist/index10.js +184 -18
  8. package/dist/index100.cjs +19 -1
  9. package/dist/index100.js +24 -21
  10. package/dist/index101.cjs +1 -1
  11. package/dist/index101.js +32 -23
  12. package/dist/index102.cjs +1 -80
  13. package/dist/index102.js +28 -100
  14. package/dist/index103.cjs +80 -1
  15. package/dist/index103.js +101 -19
  16. package/dist/index104.cjs +1 -1
  17. package/dist/index104.js +2 -8
  18. package/dist/index105.cjs +1 -1
  19. package/dist/index105.js +17 -62
  20. package/dist/index106.cjs +1 -1
  21. package/dist/index106.js +7 -29
  22. package/dist/index107.cjs +1 -1
  23. package/dist/index107.js +64 -2
  24. package/dist/index108.cjs +1 -13
  25. package/dist/index108.js +30 -17
  26. package/dist/index109.cjs +13 -1
  27. package/dist/index109.js +14 -33
  28. package/dist/index11.cjs +1 -1
  29. package/dist/index11.js +18 -21
  30. package/dist/index111.cjs +1 -7
  31. package/dist/index111.js +36 -10
  32. package/dist/index112.cjs +7 -1
  33. package/dist/index112.js +10 -63
  34. package/dist/index113.cjs +1 -1
  35. package/dist/index113.js +3 -3
  36. package/dist/index114.cjs +1 -0
  37. package/dist/index114.js +65 -0
  38. package/dist/index12.cjs +1 -1
  39. package/dist/index12.js +19 -41
  40. package/dist/index13.cjs +1 -1
  41. package/dist/index13.js +41 -23
  42. package/dist/index14.cjs +1 -1
  43. package/dist/index14.js +24 -36
  44. package/dist/index15.cjs +1 -1
  45. package/dist/index15.js +37 -33
  46. package/dist/index16.cjs +1 -1
  47. package/dist/index16.js +32 -49
  48. package/dist/index17.cjs +1 -1
  49. package/dist/index17.js +47 -38
  50. package/dist/index18.cjs +1 -1
  51. package/dist/index18.js +29 -29
  52. package/dist/index19.cjs +1 -1
  53. package/dist/index19.js +41 -58
  54. package/dist/index2.cjs +1 -1
  55. package/dist/index2.js +2 -5
  56. package/dist/index20.cjs +1 -1
  57. package/dist/index20.js +48 -42
  58. package/dist/index21.cjs +1 -1
  59. package/dist/index21.js +50 -44
  60. package/dist/index22.cjs +1 -1
  61. package/dist/index22.js +46 -7
  62. package/dist/index23.cjs +1 -1
  63. package/dist/index23.js +7 -11
  64. package/dist/index24.cjs +1 -1
  65. package/dist/index24.js +11 -64
  66. package/dist/index25.cjs +1 -1
  67. package/dist/index25.js +40 -39
  68. package/dist/index26.cjs +1 -1
  69. package/dist/index26.js +60 -37
  70. package/dist/index27.cjs +1 -1
  71. package/dist/index27.js +36 -53
  72. package/dist/index28.cjs +1 -1
  73. package/dist/index28.js +54 -51
  74. package/dist/index29.cjs +1 -1
  75. package/dist/index29.js +50 -81
  76. package/dist/index3.cjs +1 -1
  77. package/dist/index3.js +5 -5
  78. package/dist/index30.cjs +1 -1
  79. package/dist/index30.js +81 -35
  80. package/dist/index31.cjs +1 -1
  81. package/dist/index31.js +38 -33
  82. package/dist/index32.cjs +1 -1
  83. package/dist/index32.js +33 -10
  84. package/dist/index33.cjs +1 -1
  85. package/dist/index33.js +10 -39
  86. package/dist/index34.cjs +1 -1
  87. package/dist/index34.js +38 -102
  88. package/dist/index35.cjs +1 -1
  89. package/dist/index35.js +103 -19
  90. package/dist/index36.cjs +1 -1
  91. package/dist/index36.js +17 -134
  92. package/dist/index37.cjs +1 -1
  93. package/dist/index37.js +135 -49
  94. package/dist/index38.cjs +1 -1
  95. package/dist/index38.js +51 -32
  96. package/dist/index39.cjs +1 -1
  97. package/dist/index39.js +31 -53
  98. package/dist/index4.cjs +1 -1
  99. package/dist/index4.js +5 -5
  100. package/dist/index40.cjs +1 -1
  101. package/dist/index40.js +54 -48
  102. package/dist/index41.cjs +1 -1
  103. package/dist/index41.js +41 -81
  104. package/dist/index42.cjs +1 -1
  105. package/dist/index42.js +81 -41
  106. package/dist/index43.cjs +1 -1
  107. package/dist/index43.js +48 -5
  108. package/dist/index44.cjs +1 -1
  109. package/dist/index44.js +5 -45
  110. package/dist/index45.cjs +1 -1
  111. package/dist/index45.js +44 -38
  112. package/dist/index46.cjs +1 -1
  113. package/dist/index46.js +39 -19
  114. package/dist/index47.cjs +1 -1
  115. package/dist/index47.js +19 -8
  116. package/dist/index48.cjs +1 -1
  117. package/dist/index48.js +7 -22
  118. package/dist/index49.cjs +1 -1
  119. package/dist/index49.js +23 -2
  120. package/dist/index5.cjs +1 -1
  121. package/dist/index5.js +5 -9
  122. package/dist/index50.cjs +1 -1
  123. package/dist/index50.js +2 -4
  124. package/dist/index51.cjs +1 -1
  125. package/dist/index51.js +4 -11
  126. package/dist/index52.cjs +1 -1
  127. package/dist/index52.js +10 -12
  128. package/dist/index53.cjs +1 -1
  129. package/dist/index53.js +12 -11
  130. package/dist/index54.cjs +1 -1
  131. package/dist/index54.js +11 -184
  132. package/dist/index55.cjs +1 -1
  133. package/dist/index55.js +183 -25
  134. package/dist/index56.cjs +1 -1
  135. package/dist/index56.js +26 -24
  136. package/dist/index57.cjs +1 -1
  137. package/dist/index57.js +19 -22
  138. package/dist/index58.cjs +1 -1
  139. package/dist/index58.js +25 -97
  140. package/dist/index59.cjs +1 -1
  141. package/dist/index59.js +99 -8
  142. package/dist/index6.cjs +1 -1
  143. package/dist/index6.js +8 -75
  144. package/dist/index60.cjs +1 -1
  145. package/dist/index60.js +8 -51
  146. package/dist/index61.cjs +1 -1
  147. package/dist/index61.js +50 -60
  148. package/dist/index62.cjs +1 -1
  149. package/dist/index62.js +57 -18
  150. package/dist/index63.cjs +1 -1
  151. package/dist/index63.js +22 -18
  152. package/dist/index64.cjs +1 -1
  153. package/dist/index64.js +16 -26
  154. package/dist/index65.cjs +1 -1
  155. package/dist/index65.js +26 -10
  156. package/dist/index66.cjs +1 -1
  157. package/dist/index66.js +21 -331
  158. package/dist/index67.cjs +1 -1
  159. package/dist/index67.js +337 -55
  160. package/dist/index68.cjs +1 -1
  161. package/dist/index68.js +50 -47
  162. package/dist/index69.cjs +1 -1
  163. package/dist/index69.js +51 -32
  164. package/dist/index7.cjs +1 -1
  165. package/dist/index7.js +76 -4
  166. package/dist/index70.cjs +1 -1
  167. package/dist/index70.js +30 -24
  168. package/dist/index71.cjs +1 -1
  169. package/dist/index71.js +26 -32
  170. package/dist/index72.cjs +1 -1
  171. package/dist/index72.js +37 -12
  172. package/dist/index73.cjs +1 -1
  173. package/dist/index73.js +13 -9
  174. package/dist/index74.cjs +1 -1
  175. package/dist/index74.js +9 -17
  176. package/dist/index75.cjs +1 -1
  177. package/dist/index75.js +14 -16
  178. package/dist/index76.cjs +1 -1
  179. package/dist/index76.js +18 -49
  180. package/dist/index77.cjs +1 -1
  181. package/dist/index77.js +50 -21
  182. package/dist/index78.cjs +1 -1
  183. package/dist/index78.js +21 -7
  184. package/dist/index79.cjs +1 -1
  185. package/dist/index79.js +7 -2
  186. package/dist/index8.cjs +1 -1
  187. package/dist/index8.js +4 -14
  188. package/dist/index80.cjs +1 -1
  189. package/dist/index80.js +2 -9
  190. package/dist/index81.cjs +1 -3
  191. package/dist/index81.js +8 -13
  192. package/dist/index82.cjs +3 -1
  193. package/dist/index82.js +13 -8
  194. package/dist/index83.cjs +1 -1
  195. package/dist/index83.js +7 -116
  196. package/dist/index84.cjs +1 -1
  197. package/dist/index84.js +117 -18
  198. package/dist/index85.cjs +1 -11
  199. package/dist/index85.js +19 -16
  200. package/dist/index86.cjs +11 -1
  201. package/dist/index86.js +16 -41
  202. package/dist/index87.cjs +1 -1
  203. package/dist/index87.js +40 -8
  204. package/dist/index88.cjs +1 -1
  205. package/dist/index88.js +9 -13
  206. package/dist/index89.cjs +1 -104
  207. package/dist/index89.js +13 -120
  208. package/dist/index9.cjs +1 -1
  209. package/dist/index9.js +13 -181
  210. package/dist/index90.cjs +104 -1
  211. package/dist/index90.js +117 -65
  212. package/dist/index91.cjs +1 -1
  213. package/dist/index91.js +63 -24
  214. package/dist/index92.cjs +1 -1
  215. package/dist/index92.js +29 -2
  216. package/dist/index93.cjs +1 -1
  217. package/dist/index93.js +2 -41
  218. package/dist/index94.cjs +1 -1
  219. package/dist/index94.js +39 -9
  220. package/dist/index95.cjs +1 -1
  221. package/dist/index95.js +10 -14
  222. package/dist/index97.cjs +1 -1
  223. package/dist/index97.js +19 -31
  224. package/dist/index98.cjs +1 -1
  225. package/dist/index98.js +23 -28
  226. package/dist/index99.cjs +1 -19
  227. package/dist/index99.js +14 -23
  228. package/dist/mobx/Filters/Filters.d.ts +1 -1
  229. package/dist/types.d.ts +4 -0
  230. package/package.json +1 -1
package/dist/index6.js CHANGED
@@ -1,78 +1,11 @@
1
- import a from "axios";
2
- import { AxiosErrorType as e } from "./index79.js";
3
- import { filterOptionalArgsGetDelete as y, filterOptionalArgs as p } from "./index80.js";
4
- import { filterErrorStack as i } from "./index81.js";
5
- import { injectIntoError as E } from "./index82.js";
6
- const m = async (n, s) => {
7
- const o = new Error(), r = y(n, s);
8
- try {
9
- return await a.get(...r);
10
- } catch (t) {
11
- throw i(o), E({ customError: o, originalError: t, type: e.GET }), t;
12
- }
13
- }, w = async (n, s) => {
14
- const o = new Error(), r = y(n, s);
15
- try {
16
- return await a.delete(...r);
17
- } catch (t) {
18
- throw i(o), E({ customError: o, originalError: t, type: e.DELETE }), t;
19
- }
20
- }, g = async (n, s, o) => {
21
- const r = new Error(), t = p(n, s, o);
22
- try {
23
- return await a.post(...t);
24
- } catch (c) {
25
- throw i(r), E({ customError: r, originalError: c, type: e.POST }), c;
26
- }
27
- }, l = async (n, s, o) => {
28
- const r = new Error(), t = p(n, s, o);
29
- try {
30
- return await a.patch(...t);
31
- } catch (c) {
32
- throw i(r), E({ customError: r, originalError: c, type: e.PATCH }), c;
33
- }
34
- }, h = async (n, s, o) => {
35
- const r = new Error(), t = p(n, s, o);
36
- try {
37
- return await a.put(...t);
38
- } catch (c) {
39
- throw i(r), E({ customError: r, originalError: c, type: e.PUT }), c;
40
- }
41
- }, u = async (n, s, o) => {
42
- const r = new Error(), t = p(n, s, o);
43
- try {
44
- return await a.postForm(...t);
45
- } catch (c) {
46
- throw i(r), E({ customError: r, originalError: c, type: e.POST_FORM }), c;
47
- }
48
- }, T = async (n, s, o) => {
49
- const r = new Error(), t = p(n, s, o);
50
- try {
51
- return await a.putForm(...t);
52
- } catch (c) {
53
- throw i(r), E({ customError: r, originalError: c, type: e.PUT_FORM }), c;
54
- }
55
- }, F = async (n, s, o) => {
56
- const r = new Error(), t = p(n, s, o);
57
- try {
58
- return await a.patchForm(...t);
59
- } catch (c) {
60
- throw i(r), E({ customError: r, originalError: c, type: e.PATCH_FORM }), c;
61
- }
62
- }, P = {
63
- get: m,
64
- delete: w,
65
- post: g,
66
- patch: l,
67
- put: h,
68
- postForm: u,
69
- putForm: T,
70
- patchForm: F,
71
- CancelToken: a.CancelToken,
72
- isCancel: a.isCancel,
73
- getUri: a.getUri,
74
- isAxiosError: a.isAxiosError
1
+ import { deserialise as r } from "kitsu-core";
2
+ import { axios as e } from "./index7.js";
3
+ import { withCSRF as i } from "./index52.js";
4
+ import { vndAPI as s } from "./index53.js";
5
+ const n = async ({ attributes: t }) => {
6
+ const o = await e.post("/api/v2/custom_views", { data: { attributes: t, type: "custom_view" } }, i(s));
7
+ return r(o.data);
75
8
  };
76
9
  export {
77
- P as axios
10
+ n as createCustomView
78
11
  };
package/dist/index60.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("swr"),c=require("react"),x=require("./index77.cjs"),E=require("./index76.cjs"),O=require("./index63.cjs"),S=require("./index47.cjs"),y=require("./index7.cjs"),C=require("./index53.cjs"),I=e=>e&&e.__esModule?e:{default:e},b=I(v),i=x.createAllView(),P=()=>{const{DEFAULT_PAGE_NUMBER:e,DEFAULT_PAGE_SIZE:m,VIEW_TYPE:w}=y.useBusinessLogic(),{canUpdateCustomViews:V,orderedListOfCustomViews:u,defaultCustomViewId:p,isLoading:_}=O.useCustomViews({type:w}),{data:n,isLoading:M,error:A,mutate:g}=b.default(`/api/v2/custom_views?filter[type]=${w}&page[number]=${e}&page[size]=${m}`,C.fetcherV2,S.SWR_HOOK_OPTIONS),f=c.useMemo(()=>({fixedViews:[i],customViews:[],viewsMap:new Map([[i.id,i]])}),[]),{viewsMap:L,customViews:o,fixedViews:l}=c.useMemo(()=>n?n.reduce((s,r)=>{const t=E.viewsAdapter({view:r,canUpdateCustomViews:V});return s.viewsMap.set(r.id,t),r.editable?s.customViews.push(t):s.fixedViews.push(t),s},{fixedViews:[i],customViews:[],viewsMap:new Map([[i.id,i]])}):f,[n,f,V]),q=c.useMemo(()=>o.sort((s,r)=>{const t=Array.isArray(u)?u:[],a=t.indexOf(s.id),d=t.indexOf(r.id);return a===-1&&d===-1?0:a===-1?1:d===-1?-1:a-d}),[o,u]);return{defaultCustomViewId:p,viewsArray:[...l,...o],fixedViews:l,customViews:o,sortedCustomViews:q,viewsMap:L,isLoading:M||_,error:A,mutate:g}};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/index60.js CHANGED
@@ -1,54 +1,11 @@
1
- import g from "swr";
2
- import { useMemo as d } from "react";
3
- import { createAllView as O } from "./index77.js";
4
- import { viewsAdapter as v } from "./index76.js";
5
- import { useCustomViews as C } from "./index63.js";
6
- import { SWR_HOOK_OPTIONS as I } from "./index47.js";
7
- import { useBusinessLogic as y } from "./index7.js";
8
- import { fetcherV2 as S } from "./index53.js";
9
- const s = O(), B = () => {
10
- const { DEFAULT_PAGE_NUMBER: V, DEFAULT_PAGE_SIZE: c, VIEW_TYPE: a } = y(), {
11
- canUpdateCustomViews: w,
12
- orderedListOfCustomViews: o,
13
- defaultCustomViewId: l,
14
- isLoading: x
15
- } = C({ type: a }), { data: n, isLoading: A, error: L, mutate: E } = g(
16
- `/api/v2/custom_views?filter[type]=${a}&page[number]=${V}&page[size]=${c}`,
17
- S,
18
- I
19
- ), f = d(
20
- () => ({
21
- fixedViews: [s],
22
- customViews: [],
23
- viewsMap: /* @__PURE__ */ new Map([[s.id, s]])
24
- }),
25
- []
26
- ), { viewsMap: M, customViews: r, fixedViews: p } = d(() => n ? n.reduce(
27
- (e, t) => {
28
- const i = v({ view: t, canUpdateCustomViews: w });
29
- return e.viewsMap.set(t.id, i), t.editable ? e.customViews.push(i) : e.fixedViews.push(i), e;
30
- },
31
- {
32
- fixedViews: [s],
33
- customViews: [],
34
- viewsMap: /* @__PURE__ */ new Map([[s.id, s]])
35
- }
36
- ) : f, [n, f, w]), _ = d(() => r.sort((e, t) => {
37
- const i = Array.isArray(o) ? o : [], u = i.indexOf(e.id), m = i.indexOf(t.id);
38
- return u === -1 && m === -1 ? 0 : u === -1 ? 1 : m === -1 ? -1 : u - m;
39
- }), [r, o]);
40
- return {
41
- defaultCustomViewId: l,
42
- viewsArray: [...p, ...r],
43
- fixedViews: p,
44
- customViews: r,
45
- sortedCustomViews: _,
46
- viewsMap: M,
47
- isLoading: A || x,
48
- error: L,
49
- mutate: E
50
- };
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;
51
8
  };
52
9
  export {
53
- B as useViews
10
+ i as useStores
54
11
  };
package/dist/index61.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react"),h=require("./index77.cjs"),E=require("./index63.cjs"),I=require("./index60.cjs"),C=require("./index7.cjs"),S=require("./index59.cjs"),F=()=>{const{VIEW_TYPE:m,SEARCH_FILTER_ID:c}=C.useBusinessLogic(),{Filters:{activeViewId:d,initFiltersFromView:e,initFromUrl:t,discardChanges:u,updateUrl:L,setFilter:f}}=S.useStores(),{isLoading:v}=E.useCustomViews({type:m}),{viewsMap:s,defaultCustomViewId:w,isLoading:p}=I.useViews(),g=p||v;V.useEffect(()=>{if(g)return;const i=new URLSearchParams(window.location.search),l=i.get("view"),o=i.get(c),n=i.size>0;if(!d){if(l){const r=s.get(l);if(r)e(r),n&&t();else{const a=s.get(w);a&&(e(a),n&&t(!1))}}else{const r=s.get(w);if(r)e(r),u(!0),n&&t();else{const a=s.get(h.ALL_VIEW_ID);a&&e(a)}}o&&f(c,o)}},[c,d,w,u,e,t,g,f,L,s]),V.useEffect(()=>{const i=()=>{const o=new URLSearchParams(window.location.search).get("view");if(!o)return;const n=s.get(o);n&&(e(n),t())};return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[u,e,t,s])};exports.useViewUrlChange=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("swr"),c=require("react"),x=require("./index78.cjs"),E=require("./index77.cjs"),O=require("./index64.cjs"),S=require("./index48.cjs"),y=require("./index8.cjs"),C=require("./index54.cjs"),I=e=>e&&e.__esModule?e:{default:e},b=I(v),i=x.createAllView(),P=()=>{const{DEFAULT_PAGE_NUMBER:e,DEFAULT_PAGE_SIZE:m,VIEW_TYPE:w}=y.useBusinessLogic(),{canUpdateCustomViews:V,orderedListOfCustomViews:u,defaultCustomViewId:p,isLoading:_}=O.useCustomViews({type:w}),{data:n,isLoading:M,error:A,mutate:g}=b.default(`/api/v2/custom_views?filter[type]=${w}&page[number]=${e}&page[size]=${m}`,C.fetcherV2,S.SWR_HOOK_OPTIONS),f=c.useMemo(()=>({fixedViews:[i],customViews:[],viewsMap:new Map([[i.id,i]])}),[]),{viewsMap:L,customViews:o,fixedViews:l}=c.useMemo(()=>n?n.reduce((s,r)=>{const t=E.viewsAdapter({view:r,canUpdateCustomViews:V});return s.viewsMap.set(r.id,t),r.editable?s.customViews.push(t):s.fixedViews.push(t),s},{fixedViews:[i],customViews:[],viewsMap:new Map([[i.id,i]])}):f,[n,f,V]),q=c.useMemo(()=>o.sort((s,r)=>{const t=Array.isArray(u)?u:[],a=t.indexOf(s.id),d=t.indexOf(r.id);return a===-1&&d===-1?0:a===-1?1:d===-1?-1:a-d}),[o,u]);return{defaultCustomViewId:p,viewsArray:[...l,...o],fixedViews:l,customViews:o,sortedCustomViews:q,viewsMap:L,isLoading:M||_,error:A,mutate:g}};exports.useViews=P;
package/dist/index61.js CHANGED
@@ -1,64 +1,54 @@
1
- import { useEffect as u } from "react";
2
- import { ALL_VIEW_ID as h } from "./index77.js";
3
- import { useCustomViews as I } from "./index63.js";
4
- import { useViews as E } from "./index60.js";
5
- import { useBusinessLogic as F } from "./index7.js";
6
- import { useStores as C } from "./index59.js";
7
- const A = () => {
8
- const { VIEW_TYPE: g, SEARCH_FILTER_ID: c } = F(), {
9
- Filters: {
10
- activeViewId: d,
11
- initFiltersFromView: e,
12
- initFromUrl: i,
13
- discardChanges: w,
14
- updateUrl: L,
15
- setFilter: l
1
+ import g from "swr";
2
+ import { useMemo as d } from "react";
3
+ import { createAllView as O } from "./index78.js";
4
+ import { viewsAdapter as v } from "./index77.js";
5
+ import { useCustomViews as C } from "./index64.js";
6
+ import { SWR_HOOK_OPTIONS as I } from "./index48.js";
7
+ import { useBusinessLogic as y } from "./index8.js";
8
+ import { fetcherV2 as S } from "./index54.js";
9
+ const s = O(), B = () => {
10
+ const { DEFAULT_PAGE_NUMBER: V, DEFAULT_PAGE_SIZE: c, VIEW_TYPE: a } = y(), {
11
+ canUpdateCustomViews: w,
12
+ orderedListOfCustomViews: o,
13
+ defaultCustomViewId: l,
14
+ isLoading: x
15
+ } = C({ type: a }), { data: n, isLoading: A, error: L, mutate: E } = g(
16
+ `/api/v2/custom_views?filter[type]=${a}&page[number]=${V}&page[size]=${c}`,
17
+ S,
18
+ I
19
+ ), f = d(
20
+ () => ({
21
+ fixedViews: [s],
22
+ customViews: [],
23
+ viewsMap: /* @__PURE__ */ new Map([[s.id, s]])
24
+ }),
25
+ []
26
+ ), { viewsMap: M, customViews: r, fixedViews: p } = d(() => n ? n.reduce(
27
+ (e, t) => {
28
+ const i = v({ view: t, canUpdateCustomViews: w });
29
+ return e.viewsMap.set(t.id, i), t.editable ? e.customViews.push(i) : e.fixedViews.push(i), e;
30
+ },
31
+ {
32
+ fixedViews: [s],
33
+ customViews: [],
34
+ viewsMap: /* @__PURE__ */ new Map([[s.id, s]])
16
35
  }
17
- } = C(), { isLoading: v } = I({ type: g }), { viewsMap: t, defaultCustomViewId: f, isLoading: V } = E(), p = V || 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(h);
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]);
36
+ ) : f, [n, f, w]), _ = d(() => r.sort((e, t) => {
37
+ const i = Array.isArray(o) ? o : [], u = i.indexOf(e.id), m = i.indexOf(t.id);
38
+ return u === -1 && m === -1 ? 0 : u === -1 ? 1 : m === -1 ? -1 : u - m;
39
+ }), [r, o]);
40
+ return {
41
+ defaultCustomViewId: l,
42
+ viewsArray: [...p, ...r],
43
+ fixedViews: p,
44
+ customViews: r,
45
+ sortedCustomViews: _,
46
+ viewsMap: M,
47
+ isLoading: A || x,
48
+ error: L,
49
+ mutate: E
50
+ };
61
51
  };
62
52
  export {
63
- A as useViewUrlChange
53
+ B as useViews
64
54
  };
package/dist/index62.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),i=require("./index7.cjs"),a=require("./index59.cjs"),c=()=>{const{SEARCH_FILTER_ID:s}=i.useBusinessLogic(),{Filters:{initFromUrl:e,setFilter:r}}=a.useStores();o.useEffect(()=>{const n=new URLSearchParams(window.location.search).get(s);e(),n&&r(s,n)},[s,e,r]),o.useEffect(()=>{const t=()=>e();return window.addEventListener("popstate",t),()=>window.removeEventListener("popstate",t)},[e])};exports.useUrlChange=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react"),h=require("./index78.cjs"),E=require("./index64.cjs"),I=require("./index61.cjs"),C=require("./index8.cjs"),S=require("./index60.cjs"),F=()=>{const{VIEW_TYPE:m,SEARCH_FILTER_ID:c}=C.useBusinessLogic(),{Filters:{activeViewId:d,initFiltersFromView:e,initFromUrl:t,discardChanges:u,updateUrl:L,setFilter:f}}=S.useStores(),{isLoading:v}=E.useCustomViews({type:m}),{viewsMap:s,defaultCustomViewId:w,isLoading:p}=I.useViews(),g=p||v;V.useEffect(()=>{if(g)return;const i=new URLSearchParams(window.location.search),l=i.get("view"),o=i.get(c),n=i.size>0;if(!d){if(l){const r=s.get(l);if(r)e(r),n&&t();else{const a=s.get(w);a&&(e(a),n&&t(!1))}}else{const r=s.get(w);if(r)e(r),u(!0),n&&t();else{const a=s.get(h.ALL_VIEW_ID);a&&e(a)}}o&&f(c,o)}},[c,d,w,u,e,t,g,f,L,s]),V.useEffect(()=>{const i=()=>{const o=new URLSearchParams(window.location.search).get("view");if(!o)return;const n=s.get(o);n&&(e(n),t())};return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[u,e,t,s])};exports.useViewUrlChange=F;
package/dist/index62.js CHANGED
@@ -1,25 +1,64 @@
1
- import { useEffect as n } from "react";
2
- import { useBusinessLogic as a } from "./index7.js";
3
- import { useStores as i } from "./index59.js";
4
- const w = () => {
5
- const { SEARCH_FILTER_ID: t } = a(), {
1
+ import { useEffect as u } from "react";
2
+ import { ALL_VIEW_ID as h } from "./index78.js";
3
+ import { useCustomViews as I } from "./index64.js";
4
+ import { useViews as E } from "./index61.js";
5
+ import { useBusinessLogic as F } from "./index8.js";
6
+ import { useStores as C } from "./index60.js";
7
+ const A = () => {
8
+ const { VIEW_TYPE: g, SEARCH_FILTER_ID: c } = F(), {
6
9
  Filters: {
7
- initFromUrl: e,
8
- setFilter: s
10
+ activeViewId: d,
11
+ initFiltersFromView: e,
12
+ initFromUrl: i,
13
+ discardChanges: w,
14
+ updateUrl: L,
15
+ setFilter: l
16
+ }
17
+ } = C(), { isLoading: v } = I({ type: g }), { viewsMap: t, defaultCustomViewId: f, isLoading: V } = E(), p = V || 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(h);
36
+ n && e(n);
37
+ }
38
+ }
39
+ a && l(c, a);
9
40
  }
10
- } = i();
11
- n(() => {
12
- const r = new URLSearchParams(window.location.search).get(t);
13
- e(), r && s(t, r);
14
41
  }, [
15
- t,
42
+ c,
43
+ d,
44
+ f,
45
+ w,
16
46
  e,
17
- s
18
- ]), n(() => {
19
- const o = () => e();
20
- return window.addEventListener("popstate", o), () => window.removeEventListener("popstate", o);
21
- }, [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]);
22
61
  };
23
62
  export {
24
- w as useUrlChange
63
+ A as useViewUrlChange
25
64
  };
package/dist/index63.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index47.cjs"),C=require("swr"),v=require("./index53.cjs"),O=e=>e&&e.__esModule?e:{default:e},h=O(C),q=({type:e})=>{var o,t,i,n,u,r,c,_;const{data:s,isLoading:m,isValidating:l,error:w,mutate:f}=h.default("/current_user",v.fetcherV1,g.SWR_HOOK_OPTIONS),p=(t=(o=s==null?void 0:s.settings)==null?void 0:o.custom_view_positions)==null?void 0:t[e],V=(u=(n=(i=s==null?void 0:s.settings)==null?void 0:i.default_custom_views)==null?void 0:n[e])==null?void 0:u.toString(),S=!!((r=s==null?void 0:s.permissions)!=null&&r.delete_company_custom_views),a=!!((c=s==null?void 0:s.permissions)!=null&&c.update_company_custom_views),d=!!((_=s==null?void 0:s.permissions)!=null&&_.share_custom_views);return{canDeleteCustomViews:S,canUpdateCustomViews:a,canShareCustomViews:d,orderedListOfCustomViews:p,defaultCustomViewId:V,isLoading:m,isValidating:l,error:w,mutate:f}};exports.useCustomViews=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),i=require("./index8.cjs"),a=require("./index60.cjs"),c=()=>{const{SEARCH_FILTER_ID:s}=i.useBusinessLogic(),{Filters:{initFromUrl:e,setFilter:r}}=a.useStores();o.useEffect(()=>{const n=new URLSearchParams(window.location.search).get(s);e(),n&&r(s,n)},[s,e,r]),o.useEffect(()=>{const t=()=>e();return window.addEventListener("popstate",t),()=>window.removeEventListener("popstate",t)},[e])};exports.useUrlChange=c;
package/dist/index63.js CHANGED
@@ -1,21 +1,25 @@
1
- import { SWR_HOOK_OPTIONS as O } from "./index47.js";
2
- import S from "swr";
3
- import { fetcherV1 as h } from "./index53.js";
4
- const R = ({ type: e }) => {
5
- var o, t, i, n, r, m, u, c;
6
- const { data: s, isLoading: _, isValidating: p, error: w, mutate: l } = S("/current_user", h, O), 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);
7
- return {
8
- canDeleteCustomViews: C,
9
- canUpdateCustomViews: g,
10
- canShareCustomViews: v,
11
- orderedListOfCustomViews: V,
12
- defaultCustomViewId: f,
13
- isLoading: _,
14
- isValidating: p,
15
- error: w,
16
- mutate: l
17
- };
1
+ import { useEffect as n } from "react";
2
+ import { useBusinessLogic as a } from "./index8.js";
3
+ import { useStores as i } from "./index60.js";
4
+ const w = () => {
5
+ const { SEARCH_FILTER_ID: t } = a(), {
6
+ Filters: {
7
+ initFromUrl: e,
8
+ setFilter: s
9
+ }
10
+ } = i();
11
+ n(() => {
12
+ const r = new URLSearchParams(window.location.search).get(t);
13
+ e(), r && s(t, r);
14
+ }, [
15
+ t,
16
+ e,
17
+ s
18
+ ]), n(() => {
19
+ const o = () => e();
20
+ return window.addEventListener("popstate", o), () => window.removeEventListener("popstate", o);
21
+ }, [e]);
18
22
  };
19
23
  export {
20
- R as useCustomViews
24
+ w as useUrlChange
21
25
  };
package/dist/index64.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("lodash"),m=require("./index7.cjs"),C=require("./index59.cjs"),I=require("./index60.cjs"),a=()=>{var i;const{DEFAULT_HIDDEN_COLUMNS:n,DEFAULT_VISIBLE_COLUMNS:d}=m.useBusinessLogic(),{Filters:{activeViewId:u}}=C.useStores(),{viewsMap:r,isLoading:s}=I.useViews();if(!u||s)return{isLoading:s,orderedColumnIds:void 0,hiddenColumnIds:[]};const o=r.get(u),e=(i=o==null?void 0:o.columns)==null?void 0:i.columnIds;if(c.isArray(e)&&e.length>0){const l=[...n,...d].filter(t=>!e.includes(t));return{isLoading:s,orderedColumnIds:e,hiddenColumnIds:l}}return{isLoading:s,orderedColumnIds:void 0,hiddenColumnIds:n}};exports.useColumns=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index48.cjs"),C=require("swr"),v=require("./index54.cjs"),O=e=>e&&e.__esModule?e:{default:e},h=O(C),q=({type:e})=>{var o,t,i,n,u,r,c,_;const{data:s,isLoading:m,isValidating:l,error:w,mutate:f}=h.default("/current_user",v.fetcherV1,g.SWR_HOOK_OPTIONS),p=(t=(o=s==null?void 0:s.settings)==null?void 0:o.custom_view_positions)==null?void 0:t[e],V=(u=(n=(i=s==null?void 0:s.settings)==null?void 0:i.default_custom_views)==null?void 0:n[e])==null?void 0:u.toString(),S=!!((r=s==null?void 0:s.permissions)!=null&&r.delete_company_custom_views),a=!!((c=s==null?void 0:s.permissions)!=null&&c.update_company_custom_views),d=!!((_=s==null?void 0:s.permissions)!=null&&_.share_custom_views);return{canDeleteCustomViews:S,canUpdateCustomViews:a,canShareCustomViews:d,orderedListOfCustomViews:p,defaultCustomViewId:V,isLoading:m,isValidating:l,error:w,mutate:f}};exports.useCustomViews=q;
package/dist/index64.js CHANGED
@@ -1,31 +1,21 @@
1
- import { isArray as u } from "lodash";
2
- import { useBusinessLogic as c } from "./index7.js";
3
- import { useStores as C } from "./index59.js";
4
- import { useViews as I } from "./index60.js";
5
- const g = () => {
6
- var i;
7
- const { DEFAULT_HIDDEN_COLUMNS: e, DEFAULT_VISIBLE_COLUMNS: r } = c(), { Filters: { activeViewId: d } } = C(), { viewsMap: l, isLoading: o } = I();
8
- if (!d || o)
9
- return {
10
- isLoading: o,
11
- orderedColumnIds: void 0,
12
- hiddenColumnIds: []
13
- };
14
- const n = l.get(d), s = (i = n == null ? void 0 : n.columns) == null ? void 0 : i.columnIds;
15
- if (u(s) && s.length > 0) {
16
- const t = [...e, ...r].filter((m) => !s.includes(m));
17
- return {
18
- isLoading: o,
19
- orderedColumnIds: s,
20
- hiddenColumnIds: t
21
- };
22
- }
1
+ import { SWR_HOOK_OPTIONS as O } from "./index48.js";
2
+ import S from "swr";
3
+ import { fetcherV1 as h } from "./index54.js";
4
+ const R = ({ type: e }) => {
5
+ var o, t, i, n, r, m, u, c;
6
+ const { data: s, isLoading: _, isValidating: p, error: w, mutate: l } = S("/current_user", h, O), 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);
23
7
  return {
24
- isLoading: o,
25
- orderedColumnIds: void 0,
26
- hiddenColumnIds: e
8
+ canDeleteCustomViews: C,
9
+ canUpdateCustomViews: g,
10
+ canShareCustomViews: v,
11
+ orderedListOfCustomViews: V,
12
+ defaultCustomViewId: f,
13
+ isLoading: _,
14
+ isValidating: p,
15
+ error: w,
16
+ mutate: l
27
17
  };
28
18
  };
29
19
  export {
30
- g as useColumns
20
+ R as useCustomViews
31
21
  };
package/dist/index65.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),o=require("./index7.cjs"),a=require("./index59.cjs"),n=()=>{const{SORT_FILTER_ID:t}=o.useBusinessLogic(),{Filters:{queryParamsObject:s},Table:{sortParam:e}}=a.useStores();return{queryParams:u.useMemo(()=>{const r=s;return e&&r.set(t,e),r.toString()},[s,e])}};exports.useUrlParams=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("lodash"),m=require("./index8.cjs"),C=require("./index60.cjs"),I=require("./index61.cjs"),a=()=>{var i;const{DEFAULT_HIDDEN_COLUMNS:n,DEFAULT_VISIBLE_COLUMNS:d}=m.useBusinessLogic(),{Filters:{activeViewId:u}}=C.useStores(),{viewsMap:r,isLoading:s}=I.useViews();if(!u||s)return{isLoading:s,orderedColumnIds:void 0,hiddenColumnIds:[]};const o=r.get(u),e=(i=o==null?void 0:o.columns)==null?void 0:i.columnIds;if(c.isArray(e)&&e.length>0){const l=[...n,...d].filter(t=>!e.includes(t));return{isLoading:s,orderedColumnIds:e,hiddenColumnIds:l}}return{isLoading:s,orderedColumnIds:void 0,hiddenColumnIds:n}};exports.useColumns=a;
package/dist/index65.js CHANGED
@@ -1,15 +1,31 @@
1
- import { useMemo as o } from "react";
2
- import { useBusinessLogic as a } from "./index7.js";
3
- import { useStores as m } from "./index59.js";
4
- const p = () => {
5
- const { SORT_FILTER_ID: e } = a(), { Filters: { queryParamsObject: s }, Table: { sortParam: r } } = m();
1
+ import { isArray as u } from "lodash";
2
+ import { useBusinessLogic as c } from "./index8.js";
3
+ import { useStores as C } from "./index60.js";
4
+ import { useViews as I } from "./index61.js";
5
+ const g = () => {
6
+ var i;
7
+ const { DEFAULT_HIDDEN_COLUMNS: e, DEFAULT_VISIBLE_COLUMNS: r } = c(), { Filters: { activeViewId: d } } = C(), { viewsMap: l, isLoading: o } = I();
8
+ if (!d || o)
9
+ return {
10
+ isLoading: o,
11
+ orderedColumnIds: void 0,
12
+ hiddenColumnIds: []
13
+ };
14
+ const n = l.get(d), s = (i = n == null ? void 0 : n.columns) == null ? void 0 : i.columnIds;
15
+ if (u(s) && s.length > 0) {
16
+ const t = [...e, ...r].filter((m) => !s.includes(m));
17
+ return {
18
+ isLoading: o,
19
+ orderedColumnIds: s,
20
+ hiddenColumnIds: t
21
+ };
22
+ }
6
23
  return {
7
- queryParams: o(() => {
8
- const t = s;
9
- return r && t.set(e, r), t.toString();
10
- }, [s, r])
24
+ isLoading: o,
25
+ orderedColumnIds: void 0,
26
+ hiddenColumnIds: e
11
27
  };
12
28
  };
13
29
  export {
14
- p as useUrlParams
30
+ g as useColumns
15
31
  };
package/dist/index66.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var C=Object.defineProperty;var V=(b,t,a)=>t in b?C(b,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):b[t]=a;var g=(b,t,a)=>V(b,typeof t!="symbol"?t+"":t,a);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("mobx"),L=require("@veeqo/ui"),P=require("@internationalized/date"),B=require("lodash/isEqual"),p=require("./index47.cjs"),A=require("./index68.cjs"),I=require("./index67.cjs"),G=require("./index77.cjs"),O=require("./index75.cjs"),y=require("./index8.cjs"),q=b=>b&&b.__esModule?b:{default:b},N=q(B);class z{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",(t=!1)=>{try{const{SORT_FILTER_ID:a}=y.BusinessLogicManager.getBusinessLogic(),e=new URLSearchParams(window.location.search).get(a);let i;if(e){const n=this.queryParamsObject;n.set(a,e),i=`${window.location.pathname}?${n.toString()}`}else i=`${window.location.pathname}?${this.queryParams}`;t?window.history.pushState({},"",i):window.history.replaceState({},"",i)}catch(a){console.log(a)}});g(this,"setCurrentPage",t=>{this.currentPage=t});g(this,"setPageSize",t=>{this.pageSize=t,this.updateUrl()});g(this,"setFilter",(t,a)=>{this.filters.set(t,a),this.updateUrl()});g(this,"clearFilter",t=>{this.filters.set(t,""),this.updateUrl()});g(this,"setArrayFilter",(t,a)=>{this.arrayFilters.set(t,a),this.updateUrl()});g(this,"clearArrayFilter",t=>{this.arrayFilters.set(t,[]),this.updateUrl()});g(this,"setRangeFilter",({key:t,range:a,dates:s})=>{a.setFilterType(t),a.setDates(s.start,s.end),this.updateUrl()});g(this,"clearRangeFilter",t=>{const a=this.dateRangeFilters.get(t);a&&(a.clear(),this.updateUrl())});g(this,"setNumberRangeFilter",({numberRange:t,gte:a,lte:s})=>{t.setGte(a),t.setLte(s),this.updateUrl()});g(this,"clearNumberRangeFilter",t=>{const a=this.numberRangeFilters.get(t);a&&(a.clear(),this.updateUrl())});g(this,"clearAllFilters",(t=!1)=>{const{SEARCH_FILTER_ID:a}=y.BusinessLogicManager.getBusinessLogic();this.filters.forEach((s,e)=>{e!==a&&this.filters.set(e,"")}),this.arrayFilters.forEach((s,e)=>this.arrayFilters.set(e,[])),this.dateRangeFilters.forEach(s=>s.clear()),this.numberRangeFilters.forEach(s=>s.clear()),t||this.updateUrl()});g(this,"clearFiltersForGroup",t=>{const{GROUP_MAP:a}=y.BusinessLogicManager.getBusinessLogic(),s=a.get(t);s&&s.fields.forEach(e=>{this.arrayFilters.has(e.id)?this.clearArrayFilter(e.id):this.dateRangeFilters.has(e.id)?this.clearRangeFilter(e.id):this.numberRangeFilters.has(e.id)?this.clearNumberRangeFilter(e.id):this.clearFilter(e.id)})});g(this,"setActiveViewId",t=>{this.activeViewId=t,this.updateUrl()});g(this,"toggleFiltersDropdownVisible",t=>{this.isFiltersDropdownVisible=t});g(this,"getFiltersForGroup",t=>{const{GROUP_MAP:a}=y.BusinessLogicManager.getBusinessLogic(),s=a.get(t);if(!s)return{};const e={};return s.fields.forEach(i=>{this.arrayFilters.has(i.id)?e[i.id]=this.arrayFilters.get(i.id):this.dateRangeFilters.has(i.id)?e[i.id]=this.dateRangeFilters.get(i.id):this.numberRangeFilters.has(i.id)?e[i.id]=this.numberRangeFilters.get(i.id):e[i.id]=this.filters.get(i.id)}),e});g(this,"initFiltersFromView",t=>{var s;const{PAGE_SIZE_OPTIONS:a}=y.BusinessLogicManager.getBusinessLogic();(s=t.page)!=null&&s.size&&a.includes(t.page.size)&&(this.defaultPageSize=t.page.size,this.pageSize=t.page.size),this.defaultFilters=new Map(t.filterMaps.filters),this.defaultArrayFilters=new Map(t.filterMaps.arrayFilters),this.defaultDateRangeFilters=new Map(Array.from(t.filterMaps.rangeFilters.entries()).map(([e,i])=>{const n=new A.RangeFilter(i.filterType);return i.gte&&i.lte&&n.setDates(i.gte,i.lte),[e,n]})),this.defaultNumberRangeFilters=new Map(Array.from(t.filterMaps.numberRangeFilters.entries()).map(([e,i])=>{const n=i.clone();return i.gte&&n.setGte(i.gte),i.lte&&n.setLte(i.lte),[e,n]})),this.filters=new Map(t.filterMaps.filters),this.arrayFilters=new Map(t.filterMaps.arrayFilters),this.dateRangeFilters=new Map(Array.from(t.filterMaps.rangeFilters.entries()).map(([e,i])=>{const n=new A.RangeFilter(i.filterType);return i.gte&&i.lte&&n.setDates(i.gte,i.lte),[e,n]})),this.numberRangeFilters=new Map(Array.from(t.filterMaps.numberRangeFilters.entries()).map(([e,i])=>{const n=i.clone();return i.gte&&n.setGte(i.gte),i.lte&&n.setLte(i.lte),[e,n]})),this.activeViewId=t.id});g(this,"initFromUrl",(t=!0)=>{const{GROUP_MAP:a,NUMBER_RANGE_FILTERS:s,DATE_RANGE_FILTERS:e,PAGE_SIZE_OPTIONS:i,PAGE_SIZE_FILTER_ID:n}=y.BusinessLogicManager.getBusinessLogic(),F=new URLSearchParams(window.location.search),f=Array.from(a.values()).flatMap(r=>r.fields),w=new Map,R=new Map,M=new Map,h=new Map,l=new Map;Array.from(F.entries()).forEach(([r,u])=>{(r.includes("[gte]")||r.includes("[lte]")||r.includes("[relative]"))&&l.set(r,u)}),Array.from(F.entries()).forEach(([r,u])=>{if(r==="view"&&t){this.activeViewId=u;return}if(r===n&&i.includes(Number(u))){this.pageSize=Number(u);return}let m=f.find(c=>c.id===r);const d=r.replace(/\[(gte|lte|relative)\]$/,"");if(m||(s.includes(d)?m=f.find(c=>c.id===d):e.includes(d)&&(m=f.find(c=>c.id===d))),!!m)switch(m.filterType){case p.FilterChoiceValue.CHECKBOX:u&&R.set(r,u.split(","));break;case p.FilterChoiceValue.DATE_RANGE:let c;if(O.isValidDateRange(u))c=new A.RangeFilter(u);else{const _=l.get(`${d}[gte]`),D=l.get(`${d}[lte]`);if(_&&D)try{const U=P.parseDate(_),v=P.parseDate(D);c=new A.RangeFilter("CUSTOM"),c.setDates(U,v)}catch{c=new A.RangeFilter(L.DateRanges.TODAY)}else c=new A.RangeFilter(L.DateRanges.TODAY)}M.set(d,c);break;case p.FilterChoiceValue.NUMBER_RANGE:const E=new I.NumberRangeFilter({filterId:m.id}),S=l.get(`${d}[gte]`),T=l.get(`${d}[lte]`);S&&E.setGte(Number(S)),T&&E.setLte(Number(T)),h.set(d,E);break;case p.FilterChoiceValue.TEXT:case p.FilterChoiceValue.NUMBER:case p.FilterChoiceValue.RADIO:w.set(r,u);break}}),this.filters=w,this.arrayFilters=R,this.dateRangeFilters=M,this.numberRangeFilters=h,this.updateUrl()});g(this,"discardChanges",(t=!1)=>{this.pageSize=this.defaultPageSize;const{SEARCH_FILTER_ID:a}=y.BusinessLogicManager.getBusinessLogic(),s=new Map(this.defaultFilters);this.filters.has(a)&&s.set(a,this.filters.get(a)),this.filters=s,this.arrayFilters=new Map(this.defaultArrayFilters),this.dateRangeFilters.clear(),this.defaultDateRangeFilters.forEach((e,i)=>{const n=new A.RangeFilter(e.filterType);n.setDates(e.gte,e.lte),this.dateRangeFilters.set(i,n)}),this.numberRangeFilters.clear(),this.defaultNumberRangeFilters.forEach((e,i)=>{this.numberRangeFilters.set(i,e.clone())}),this.updateUrl(t)});const{GROUP_MAP:t}=y.BusinessLogicManager.getBusinessLogic(),a=Array.from(t.values()).flatMap(s=>s.fields);this.filters=new Map(a.filter(s=>s.filterType===p.FilterChoiceValue.TEXT||s.filterType===p.FilterChoiceValue.NUMBER||s.filterType===p.FilterChoiceValue.RADIO||s.filterType===p.FilterChoiceValue.DATE_RANGE).map(s=>[s.id,""])),this.arrayFilters=new Map(a.filter(s=>s.filterType===p.FilterChoiceValue.CHECKBOX).map(s=>[s.id,[]])),this.dateRangeFilters=new Map(a.filter(s=>s.filterType===p.FilterChoiceValue.DATE_RANGE).map(s=>[s.id,new A.RangeFilter])),this.numberRangeFilters=new Map(a.filter(s=>s.filterType===p.FilterChoiceValue.NUMBER_RANGE).map(s=>{const e=new I.NumberRangeFilter({filterId:s.id});return[s.id,e]})),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,o.makeObservable(this,{defaultPageSize:o.observable,pageSize:o.observable,currentPage:o.observable,defaultFilters:o.observable,defaultArrayFilters:o.observable,defaultDateRangeFilters:o.observable,defaultNumberRangeFilters:o.observable,filters:o.observable,arrayFilters:o.observable,numberRangeFilters:o.observable,dateRangeFilters:o.observable,isFiltersDropdownVisible:o.observable,activeViewId:o.observable,setPageSize:o.action,setCurrentPage:o.action,toggleFiltersDropdownVisible:o.action,setActiveViewId:o.action,setFilter:o.action,setArrayFilter:o.action,setRangeFilter:o.action,setNumberRangeFilter:o.action,clearFilter:o.action,clearArrayFilter:o.action,clearRangeFilter:o.action,clearNumberRangeFilter:o.action,clearAllFilters:o.action,getFiltersForGroup:o.action,clearFiltersForGroup:o.action,initFromUrl:o.action,initFiltersFromView:o.action,initDefaultFilterMaps:o.action,discardChanges:o.action,updateUrl:o.action,hasActiveFilters:o.computed,activeFilterKeysList:o.computed,queryParamsObject:o.computed,queryParams:o.computed,hasUnsavedChanges:o.computed})}get hasActiveFilters(){const{GROUP_MAP:t}=y.BusinessLogicManager.getBusinessLogic(),a=Array.from(t.values()).flatMap(e=>e.fields),s=new Set(a.map(e=>e.id));return Array.from(this.filters.entries()).filter(([e])=>s.has(e)).some(([,e])=>e!=="")||Array.from(this.arrayFilters.entries()).filter(([e])=>s.has(e)).some(([,e])=>e.length>0)||Array.from(this.dateRangeFilters.entries()).filter(([e])=>s.has(e)).some(([,e])=>e.filterType!==void 0)||Array.from(this.numberRangeFilters.entries()).filter(([e])=>s.has(e)).some(([,e])=>e.isActive)}get activeFilterKeysList(){const{DATE_RANGE_FILTERS:t,NUMBER_RANGE_FILTERS:a}=y.BusinessLogicManager.getBusinessLogic(),s=Array.from(this.filters.entries()).filter(([f,w])=>w!==""&&!t.includes(f)&&!a.includes(f)).map(([f])=>f),e=Array.from(this.arrayFilters.entries()).filter(([,f])=>f.length>0).map(([f])=>f),i=Array.from(this.dateRangeFilters.entries()).filter(([,f])=>f.filterType!==void 0).map(([f])=>f),n=Array.from(this.numberRangeFilters.entries()).filter(([,f])=>f.isActive).map(([f])=>f);return[...new Set([...s,...e,...i,...n])]}get queryParamsObject(){const{DATE_RANGE_FILTERS:t,NUMBER_RANGE_FILTERS:a,PAGE_SIZE_FILTER_ID:s,PAGE_NUMBER_FILTER_ID:e}=y.BusinessLogicManager.getBusinessLogic(),i=new URLSearchParams;return Array.from(this.filters.entries()).filter(([n,F])=>F!==""&&!t.includes(n)&&!a.includes(n)).forEach(([n,F])=>{i.append(n,F)}),Array.from(this.arrayFilters.entries()).filter(([,n])=>n.length>0).forEach(([n,F])=>{i.append(n,F.join(","))}),Array.from(this.dateRangeFilters.entries()).filter(([,n])=>n.filterType!==void 0).forEach(([n,F])=>{F.filterType==="CUSTOM"?(i.set(`${n}[gte]`,F.gte.toString()),i.set(`${n}[lte]`,F.lte.toString())):i.set(`${n}[relative]`,F.filterType)}),Array.from(this.numberRangeFilters.entries()).filter(([,n])=>n.isActive).forEach(([n,F])=>{F.gte!==void 0&&i.set(`${n}[gte]`,F.gte.toString()),F.isValidLte&&i.set(`${n}[lte]`,F.lte.toString())}),this.activeViewId&&i.set("view",this.activeViewId),i.set(s,this.pageSize.toString()),i.set(e,this.currentPage.toString()),i}get queryParams(){return this.queryParamsObject.toString()}get hasUnsavedChanges(){if(this.activeViewId===G.ALL_VIEW_ID)return!1;if(this.defaultPageSize!==this.pageSize)return!0;const{GROUP_MAP:t,SEARCH_FILTER_ID:a}=y.BusinessLogicManager.getBusinessLogic(),s=Array.from(t.values()).flatMap(h=>h.fields),e=new Set(s.map(h=>h.id));if(Array.from(this.filters.entries()).filter(([h])=>h!==a&&e.has(h)).some(([h,l])=>{const r=this.defaultFilters.get(h);return r===void 0&&l!==""||r!==void 0&&l!==r}))return!0;const n=Array.from(this.defaultArrayFilters.entries()).filter(([h])=>e.has(h)).some(([h,l])=>{const r=this.defaultArrayFilters.get(h)||[];return l.length>0||r.length>0?l.length!==r.length||!N.default(l,r):!1}),F=Array.from(this.arrayFilters.entries()).filter(([h])=>e.has(h)).some(([h,l])=>{const r=this.defaultArrayFilters.get(h)||[];return l.length>0||r.length>0?l.length!==r.length||!N.default(l,r):!1});if(n||F)return!0;const f=Array.from(this.numberRangeFilters.entries()).filter(([h])=>e.has(h)).some(([h,l])=>{const r=this.defaultNumberRangeFilters.get(h);return!l.isEqual(r)});if(Array.from(this.defaultNumberRangeFilters.entries()).filter(([h])=>e.has(h)).some(([h,l])=>{const r=this.numberRangeFilters.get(h);return!l.isEqual(r)})||f)return!0;const R=Array.from(this.defaultDateRangeFilters.entries()).filter(([h])=>e.has(h)).some(([h,l])=>{var u,m,d,c;const r=this.dateRangeFilters.get(h);return l!=null&&l.filterType&&!(r!=null&&r.filterType)||r!=null&&r.filterType&&!(l!=null&&l.filterType)||(r==null?void 0:r.filterType)!==(l==null?void 0:l.filterType)?!0:(r==null?void 0:r.filterType)==="CUSTOM"&&(l==null?void 0:l.filterType)==="CUSTOM"?((u=l.gte)==null?void 0:u.toString())!==((m=r.gte)==null?void 0:m.toString())||((d=l.lte)==null?void 0:d.toString())!==((c=r.lte)==null?void 0:c.toString()):!1});return Array.from(this.dateRangeFilters.entries()).filter(([h])=>e.has(h)).some(([h,l])=>{var u,m,d,c;const r=this.defaultDateRangeFilters.get(h);return l!=null&&l.filterType&&!(r!=null&&r.filterType)||r!=null&&r.filterType&&!(l!=null&&l.filterType)||(r==null?void 0:r.filterType)!==(l==null?void 0:l.filterType)?!0:(r==null?void 0:r.filterType)==="CUSTOM"&&(l==null?void 0:l.filterType)==="CUSTOM"?((u=l.gte)==null?void 0:u.toString())!==((m=r.gte)==null?void 0:m.toString())||((d=l.lte)==null?void 0:d.toString())!==((c=r.lte)==null?void 0:c.toString()):!1})||R}}exports.Filters=z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),a=require("./index2.cjs"),n=require("./index8.cjs"),i=require("./index60.cjs"),m=()=>{const{SORT_FILTER_ID:t,SORTING_MODE:o}=n.useBusinessLogic(),{Filters:{queryParamsObject:u},Table:{sortParam:r,sortState:e}}=i.useStores();return{queryParams:c.useMemo(()=>{const s=u;switch(o){case a.SortingMode.CORAL:e.columnId&&(s.set("sort_order",e.direction),s.set("sort",e.columnId));break;case a.SortingMode.MONOLITH:default:r&&s.set(t,r)}return s.toString()},[u,r,o,t,e])}};exports.useUrlParams=m;