@veeqo/transfigure 0.0.21 → 0.0.22

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 (256) hide show
  1. package/dist/components/Filters/ActiveFilters/Variants/common/ActiveFilterFooter/ActiveFilterFooter.d.ts +6 -0
  2. package/dist/components/Filters/ActiveFilters/Variants/common/ActiveFilterFooter/index.d.ts +1 -0
  3. package/dist/components/Filters/ActiveFilters/Variants/common/ActiveFilterHeader/ActiveFilterHeader.d.ts +5 -0
  4. package/dist/components/Filters/ActiveFilters/Variants/common/ActiveFilterHeader/index.d.ts +1 -0
  5. package/dist/components/Filters/ActiveFilters/Variants/common/index.d.ts +2 -0
  6. package/dist/components/Filters/ActiveFilters/Variants/index.d.ts +3 -1
  7. package/dist/components/Filters/ActiveFilters/index.d.ts +0 -1
  8. package/dist/components/RefreshButton/RefreshButton.d.ts +2 -1
  9. package/dist/components/RefreshButton/{usePollListOrders.d.ts → usePollData.d.ts} +1 -1
  10. package/dist/components/Views/PillNotifications/constants.d.ts +25 -0
  11. package/dist/components/Views/PillNotifications/variants/DraftPill/DraftPill.d.ts +5 -0
  12. package/dist/components/Views/PillNotifications/variants/DraftPill/index.d.ts +1 -0
  13. package/dist/components/Views/PillNotifications/variants/UnsavedChangesPill/UnsavedChangesPill.d.ts +7 -0
  14. package/dist/components/Views/PillNotifications/variants/UnsavedChangesPill/index.d.ts +1 -0
  15. package/dist/components/Views/PillNotifications/variants/styled.d.ts +324 -0
  16. package/dist/components/Views/index.d.ts +1 -1
  17. package/dist/context/ModalContext/mocks/mockUseModal.d.ts +4 -4
  18. package/dist/hooks/useViewCountsHook/useViewCountsHook.d.ts +1 -1
  19. package/dist/hooks/useViews/mocks.d.ts +2 -0
  20. package/dist/hooks/useViews/useViews.d.ts +1 -2
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +121 -119
  23. package/dist/index100.cjs +1 -1
  24. package/dist/index100.js +2 -36
  25. package/dist/index101.cjs +1 -1
  26. package/dist/index101.js +36 -19
  27. package/dist/index102.cjs +1 -1
  28. package/dist/index102.js +25 -7
  29. package/dist/index103.cjs +13 -1
  30. package/dist/index103.js +16 -63
  31. package/dist/index104.cjs +1 -1
  32. package/dist/index104.js +18 -29
  33. package/dist/index105.cjs +1 -1
  34. package/dist/index105.js +8 -63
  35. package/dist/index106.cjs +1 -13
  36. package/dist/index106.js +63 -16
  37. package/dist/index107.cjs +1 -1
  38. package/dist/index107.js +30 -42
  39. package/dist/index108.cjs +1 -7
  40. package/dist/index108.js +63 -10
  41. package/dist/index109.cjs +1 -0
  42. package/dist/index109.js +49 -0
  43. package/dist/index11.cjs +1 -1
  44. package/dist/index11.js +1 -1
  45. package/dist/index110.cjs +7 -0
  46. package/dist/index110.js +12 -0
  47. package/dist/index111.cjs +1 -0
  48. package/dist/index111.js +44 -0
  49. package/dist/index12.cjs +1 -1
  50. package/dist/index12.js +1 -1
  51. package/dist/index13.cjs +1 -1
  52. package/dist/index13.js +14 -14
  53. package/dist/index14.cjs +1 -1
  54. package/dist/index14.js +36 -41
  55. package/dist/index15.cjs +1 -1
  56. package/dist/index15.js +33 -37
  57. package/dist/index16.cjs +1 -1
  58. package/dist/index16.js +49 -32
  59. package/dist/index17.cjs +1 -1
  60. package/dist/index17.js +38 -48
  61. package/dist/index18.cjs +1 -1
  62. package/dist/index18.js +27 -28
  63. package/dist/index19.cjs +1 -1
  64. package/dist/index19.js +37 -38
  65. package/dist/index2.cjs +1 -1
  66. package/dist/index2.js +2 -2
  67. package/dist/index20.cjs +1 -1
  68. package/dist/index20.js +36 -37
  69. package/dist/index21.cjs +1 -1
  70. package/dist/index21.js +20 -21
  71. package/dist/index22.cjs +1 -1
  72. package/dist/index22.js +7 -46
  73. package/dist/index23.cjs +1 -1
  74. package/dist/index23.js +12 -61
  75. package/dist/index24.cjs +1 -1
  76. package/dist/index24.js +36 -35
  77. package/dist/index25.cjs +1 -1
  78. package/dist/index25.js +55 -34
  79. package/dist/index26.cjs +1 -1
  80. package/dist/index26.js +34 -52
  81. package/dist/index27.cjs +1 -1
  82. package/dist/index27.js +54 -51
  83. package/dist/index28.cjs +1 -1
  84. package/dist/index28.js +50 -81
  85. package/dist/index29.cjs +1 -1
  86. package/dist/index29.js +80 -33
  87. package/dist/index3.cjs +1 -1
  88. package/dist/index3.js +2 -2
  89. package/dist/index30.cjs +1 -1
  90. package/dist/index30.js +37 -33
  91. package/dist/index31.cjs +1 -1
  92. package/dist/index31.js +33 -10
  93. package/dist/index32.cjs +1 -1
  94. package/dist/index32.js +10 -40
  95. package/dist/index33.cjs +1 -1
  96. package/dist/index33.js +39 -102
  97. package/dist/index34.cjs +1 -1
  98. package/dist/index34.js +103 -19
  99. package/dist/index35.cjs +1 -1
  100. package/dist/index35.js +17 -135
  101. package/dist/index36.cjs +1 -1
  102. package/dist/index36.js +135 -49
  103. package/dist/index37.cjs +1 -1
  104. package/dist/index37.js +51 -50
  105. package/dist/index38.cjs +1 -1
  106. package/dist/index38.js +31 -49
  107. package/dist/index39.cjs +1 -1
  108. package/dist/index39.js +48 -71
  109. package/dist/index4.cjs +1 -1
  110. package/dist/index4.js +2 -2
  111. package/dist/index40.cjs +1 -1
  112. package/dist/index40.js +58 -79
  113. package/dist/index41.cjs +1 -1
  114. package/dist/index41.js +81 -41
  115. package/dist/index42.cjs +1 -1
  116. package/dist/index42.js +48 -5
  117. package/dist/index43.cjs +1 -1
  118. package/dist/index43.js +5 -42
  119. package/dist/index44.cjs +1 -1
  120. package/dist/index44.js +42 -25
  121. package/dist/index45.cjs +1 -1
  122. package/dist/index45.js +30 -19
  123. package/dist/index46.cjs +1 -1
  124. package/dist/index46.js +19 -8
  125. package/dist/index47.cjs +1 -1
  126. package/dist/index47.js +7 -22
  127. package/dist/index48.cjs +1 -1
  128. package/dist/index48.js +23 -2
  129. package/dist/index49.cjs +1 -1
  130. package/dist/index49.js +2 -4
  131. package/dist/index5.cjs +1 -1
  132. package/dist/index5.js +2 -2
  133. package/dist/index50.cjs +1 -1
  134. package/dist/index50.js +4 -11
  135. package/dist/index51.cjs +1 -1
  136. package/dist/index51.js +10 -12
  137. package/dist/index52.cjs +1 -1
  138. package/dist/index52.js +12 -11
  139. package/dist/index53.cjs +1 -1
  140. package/dist/index53.js +11 -184
  141. package/dist/index54.cjs +1 -1
  142. package/dist/index54.js +183 -25
  143. package/dist/index55.cjs +1 -1
  144. package/dist/index55.js +26 -24
  145. package/dist/index56.cjs +1 -1
  146. package/dist/index56.js +19 -22
  147. package/dist/index57.cjs +1 -1
  148. package/dist/index57.js +25 -90
  149. package/dist/index58.cjs +1 -1
  150. package/dist/index58.js +93 -8
  151. package/dist/index59.cjs +1 -1
  152. package/dist/index59.js +8 -51
  153. package/dist/index6.cjs +1 -1
  154. package/dist/index6.js +4 -4
  155. package/dist/index60.cjs +1 -1
  156. package/dist/index60.js +50 -60
  157. package/dist/index61.cjs +1 -1
  158. package/dist/index61.js +61 -18
  159. package/dist/index62.cjs +1 -1
  160. package/dist/index62.js +16 -23
  161. package/dist/index63.cjs +1 -1
  162. package/dist/index63.js +25 -315
  163. package/dist/index64.cjs +1 -1
  164. package/dist/index64.js +311 -55
  165. package/dist/index65.cjs +1 -1
  166. package/dist/index65.js +50 -47
  167. package/dist/index66.cjs +1 -1
  168. package/dist/index66.js +51 -32
  169. package/dist/index67.cjs +1 -1
  170. package/dist/index67.js +30 -24
  171. package/dist/index68.cjs +1 -1
  172. package/dist/index68.js +32 -4
  173. package/dist/index69.cjs +1 -1
  174. package/dist/index69.js +4 -9
  175. package/dist/index70.cjs +1 -1
  176. package/dist/index70.js +9 -17
  177. package/dist/index71.cjs +1 -1
  178. package/dist/index71.js +14 -16
  179. package/dist/index72.cjs +1 -1
  180. package/dist/index72.js +18 -47
  181. package/dist/index73.cjs +1 -1
  182. package/dist/index73.js +48 -21
  183. package/dist/index74.cjs +1 -1
  184. package/dist/index74.js +21 -2
  185. package/dist/index75.cjs +1 -1
  186. package/dist/index75.js +2 -9
  187. package/dist/index76.cjs +1 -3
  188. package/dist/index76.js +8 -13
  189. package/dist/index77.cjs +3 -1
  190. package/dist/index77.js +13 -8
  191. package/dist/index78.cjs +1 -1
  192. package/dist/index78.js +7 -141
  193. package/dist/index79.cjs +1 -1
  194. package/dist/index79.js +142 -18
  195. package/dist/index80.cjs +1 -8
  196. package/dist/index80.js +19 -12
  197. package/dist/index81.cjs +8 -1
  198. package/dist/index81.js +12 -41
  199. package/dist/index82.cjs +1 -1
  200. package/dist/index82.js +40 -8
  201. package/dist/index83.cjs +1 -1
  202. package/dist/index83.js +9 -18
  203. package/dist/index84.cjs +1 -1
  204. package/dist/index84.js +31 -13
  205. package/dist/index85.cjs +1 -104
  206. package/dist/index85.js +27 -118
  207. package/dist/index86.cjs +1 -1
  208. package/dist/index86.js +14 -67
  209. package/dist/index87.cjs +19 -1
  210. package/dist/index87.js +24 -29
  211. package/dist/index88.cjs +1 -1
  212. package/dist/index88.js +21 -2
  213. package/dist/index89.cjs +12 -1
  214. package/dist/index89.js +16 -41
  215. package/dist/index90.cjs +80 -1
  216. package/dist/index90.js +103 -11
  217. package/dist/index91.cjs +1 -1
  218. package/dist/index91.js +13 -24
  219. package/dist/index92.cjs +100 -15
  220. package/dist/index92.js +115 -19
  221. package/dist/index93.cjs +1 -1
  222. package/dist/index93.js +65 -30
  223. package/dist/index94.cjs +1 -1
  224. package/dist/index94.js +29 -29
  225. package/dist/index95.cjs +1 -1
  226. package/dist/index95.js +2 -22
  227. package/dist/index96.cjs +1 -80
  228. package/dist/index96.js +41 -96
  229. package/dist/index97.cjs +1 -12
  230. package/dist/index97.js +11 -16
  231. package/dist/index98.cjs +1 -1
  232. package/dist/index98.js +17 -14
  233. package/dist/index99.cjs +1 -1
  234. package/dist/index99.js +24 -2
  235. package/dist/mobx/Filters/tests/Filters.arrayFilters.test.d.ts +1 -0
  236. package/dist/mobx/Filters/tests/Filters.clearOperations.test.d.ts +1 -0
  237. package/dist/mobx/Filters/tests/Filters.dateRangeFilters.test.d.ts +1 -0
  238. package/dist/mobx/Filters/tests/Filters.hasUnsavedChanges.test.d.ts +1 -0
  239. package/dist/mobx/Filters/tests/Filters.numberRangeFilters.test.d.ts +1 -0
  240. package/dist/mobx/Filters/tests/Filters.pagination.test.d.ts +1 -0
  241. package/dist/mobx/Filters/tests/Filters.textFilters.test.d.ts +1 -0
  242. package/dist/mobx/Filters/tests/Filters.urlHandling.test.d.ts +1 -0
  243. package/dist/mobx/Filters/tests/Filters.views.test.d.ts +1 -0
  244. package/dist/mobx/Notifications/Notifications.d.ts +7 -8
  245. package/dist/mobx/Notifications/Notifications.test.d.ts +1 -0
  246. package/dist/mobx/Notifications/index.d.ts +1 -0
  247. package/dist/mobx/NumberRangeFilter/NumberRangeFilter.test.d.ts +1 -0
  248. package/dist/mobx/RangeFilter/RangeFilter.test.d.ts +1 -0
  249. package/dist/mobx/Views/Views.test.d.ts +1 -0
  250. package/package.json +1 -1
  251. package/dist/components/Views/PillNotifications/InfoPill.d.ts +0 -1
  252. package/dist/components/Views/PillNotifications/styled.d.ts +0 -34
  253. package/dist/components/Views/UnsavedChanges/UnsavedChanges.d.ts +0 -5
  254. package/dist/components/Views/UnsavedChanges/index.d.ts +0 -1
  255. /package/dist/components/Filters/ActiveFilters/{ActiveFilterTag → Variants/ActiveFilterTag}/ActiveFilterTag.d.ts +0 -0
  256. /package/dist/components/Filters/ActiveFilters/{ActiveFilterTag → Variants/ActiveFilterTag}/index.d.ts +0 -0
package/dist/index55.js CHANGED
@@ -1,27 +1,29 @@
1
- import { useMemo as i } from "react";
2
- import { getAsyncOptions as m } from "./index69.js";
3
- import { getFetcherFunction as p } from "./index70.js";
4
- import l from "swr/immutable";
5
- import { useStores as f } from "./index58.js";
6
- const a = ({ filterData: e }) => {
7
- var s;
8
- const {
9
- Filters: { arrayFilters: c }
10
- } = f(), o = c.get(e.id), { data: n } = l(
11
- (s = e.fetchAsyncFilterOptions) == null ? void 0 : s.URL,
12
- () => {
13
- var t;
14
- return p({
15
- fetcherName: (t = e.fetchAsyncFilterOptions) == null ? void 0 : t.fetcher
16
- })(e.fetchAsyncFilterOptions.URL);
17
- },
18
- { revalidateOnFocus: !1 }
19
- );
20
- return { filterLabel: i(() => {
21
- const r = n ? m({ data: n, config: e.fetchAsyncFilterOptions }) : e.options;
22
- return (r == null ? void 0 : r.filter((t) => o == null ? void 0 : o.includes(t.value.toString())).map((t) => t.label).join(", ")) || "";
23
- }, [n, e.options, o, e.fetchAsyncFilterOptions]) };
1
+ import { useViews as a } from "./index60.js";
2
+ import { useStores as f } from "./index59.js";
3
+ const d = () => {
4
+ const { viewsMap: r } = a(), {
5
+ Filters: { activeViewId: i, initFiltersFromView: o, updateUrl: s },
6
+ Views: { addDraftView: w, draftViewsMap: n }
7
+ } = f();
8
+ return { duplicateView: () => {
9
+ if (!i)
10
+ throw Error("Creating views from all is not supported...implement me");
11
+ if (r.has(i)) {
12
+ const e = r.get(i);
13
+ if (!e)
14
+ throw Error("Could not find view in viewsMap");
15
+ const t = w({ ...e });
16
+ o(t);
17
+ } else {
18
+ const e = n.get(i);
19
+ if (!e)
20
+ throw Error("Could not find view in draftViewsMap");
21
+ const t = w({ ...e });
22
+ o(t);
23
+ }
24
+ s();
25
+ } };
24
26
  };
25
27
  export {
26
- a as useFilterArrayLabel
28
+ d as useDuplicateActiveView
27
29
  };
package/dist/index56.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),l=require("./index69.cjs"),F=require("./index70.cjs"),f=require("swr/immutable"),h=require("./index58.cjs"),p=e=>e&&e.__esModule?e:{default:e},d=p(f),y=({filterData:e})=>{var o;const{Filters:{filters:r}}=h.useStores(),t=r.get(e.id),{data:c}=d.default((o=e.fetchAsyncFilterOptions)==null?void 0:o.URL,()=>{var n;return F.getFetcherFunction({fetcherName:(n=e.fetchAsyncFilterOptions)==null?void 0:n.fetcher})(e.fetchAsyncFilterOptions.URL)},{revalidateOnFocus:!1});return{filterLabel:u.useMemo(()=>{var n;if(!e.options&&!e.fetchAsyncFilterOptions)return t;const s=c?l.getAsyncOptions({data:c,config:e.fetchAsyncFilterOptions}):e.options;return((n=s==null?void 0:s.find(i=>i.value.toString()===(t==null?void 0:t.toString())))==null?void 0:n.label)||""},[c,e.options,t,e.fetchAsyncFilterOptions])}};exports.useFilterLabel=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),u=require("./index70.cjs"),l=require("./index71.cjs"),a=require("swr/immutable"),F=require("./index59.cjs"),y=e=>e&&e.__esModule?e:{default:e},d=y(a),f=({filterData:e})=>{var r;const{Filters:{arrayFilters:o}}=F.useStores(),s=o.get(e.id),{data:c}=d.default((r=e.fetchAsyncFilterOptions)==null?void 0:r.URL,()=>{var t;return l.getFetcherFunction({fetcherName:(t=e.fetchAsyncFilterOptions)==null?void 0:t.fetcher})(e.fetchAsyncFilterOptions.URL)},{revalidateOnFocus:!1});return{filterLabel:i.useMemo(()=>{const n=c?u.getAsyncOptions({data:c,config:e.fetchAsyncFilterOptions}):e.options;return(n==null?void 0:n.filter(t=>s==null?void 0:s.includes(t.value.toString())).map(t=>t.label).join(", "))||""},[c,e.options,s,e.fetchAsyncFilterOptions])}};exports.useFilterArrayLabel=f;
package/dist/index56.js CHANGED
@@ -1,30 +1,27 @@
1
- import { useMemo as p } from "react";
2
- import { getAsyncOptions as m } from "./index69.js";
3
- import { getFetcherFunction as f } from "./index70.js";
4
- import h from "swr/immutable";
5
- import { useStores as u } from "./index58.js";
6
- const b = ({ filterData: t }) => {
7
- var c;
1
+ import { useMemo as i } from "react";
2
+ import { getAsyncOptions as m } from "./index70.js";
3
+ import { getFetcherFunction as p } from "./index71.js";
4
+ import l from "swr/immutable";
5
+ import { useStores as f } from "./index59.js";
6
+ const a = ({ filterData: e }) => {
7
+ var s;
8
8
  const {
9
- Filters: { filters: r }
10
- } = u(), e = r.get(t.id), { data: s } = h(
11
- (c = t.fetchAsyncFilterOptions) == null ? void 0 : c.URL,
9
+ Filters: { arrayFilters: c }
10
+ } = f(), o = c.get(e.id), { data: n } = l(
11
+ (s = e.fetchAsyncFilterOptions) == null ? void 0 : s.URL,
12
12
  () => {
13
- var o;
14
- return f({
15
- fetcherName: (o = t.fetchAsyncFilterOptions) == null ? void 0 : o.fetcher
16
- })(t.fetchAsyncFilterOptions.URL);
13
+ var t;
14
+ return p({
15
+ fetcherName: (t = e.fetchAsyncFilterOptions) == null ? void 0 : t.fetcher
16
+ })(e.fetchAsyncFilterOptions.URL);
17
17
  },
18
18
  { revalidateOnFocus: !1 }
19
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]) };
20
+ return { filterLabel: i(() => {
21
+ const r = n ? m({ data: n, config: e.fetchAsyncFilterOptions }) : e.options;
22
+ return (r == null ? void 0 : r.filter((t) => o == null ? void 0 : o.includes(t.value.toString())).map((t) => t.label).join(", ")) || "";
23
+ }, [n, e.options, o, e.fetchAsyncFilterOptions]) };
27
24
  };
28
25
  export {
29
- b as useFilterLabel
26
+ a as useFilterArrayLabel
30
27
  };
package/dist/index57.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),g=require("@internationalized/date"),A=require("./index64.cjs"),T=require("./index65.cjs"),M=require("./index59.cjs"),I=require("./index7.cjs"),V=require("./index58.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(),[R,o]=h.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 A.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:R}};exports.usePersistUnsavedChanges=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),l=require("./index70.cjs"),F=require("./index71.cjs"),f=require("swr/immutable"),h=require("./index59.cjs"),p=e=>e&&e.__esModule?e:{default:e},d=p(f),y=({filterData:e})=>{var o;const{Filters:{filters:r}}=h.useStores(),t=r.get(e.id),{data:c}=d.default((o=e.fetchAsyncFilterOptions)==null?void 0:o.URL,()=>{var n;return F.getFetcherFunction({fetcherName:(n=e.fetchAsyncFilterOptions)==null?void 0:n.fetcher})(e.fetchAsyncFilterOptions.URL)},{revalidateOnFocus:!1});return{filterLabel:u.useMemo(()=>{var n;if(!e.options&&!e.fetchAsyncFilterOptions)return t;const s=c?l.getAsyncOptions({data:c,config:e.fetchAsyncFilterOptions}):e.options;return((n=s==null?void 0:s.find(i=>i.value.toString()===(t==null?void 0:t.toString())))==null?void 0:n.label)||""},[c,e.options,t,e.fetchAsyncFilterOptions])}};exports.useFilterLabel=y;
package/dist/index57.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 "./index64.js";
4
- import { RangeFilter as T } from "./index65.js";
5
- import { useViews as I } from "./index59.js";
6
- import { useBusinessLogic as M } from "./index7.js";
7
- import { useStores as V } from "./index58.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 "./index70.js";
3
+ import { getFetcherFunction as f } from "./index71.js";
4
+ import h from "swr/immutable";
5
+ import { useStores as u } from "./index59.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/index58.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"),T=require("./index65.cjs"),M=require("./index66.cjs"),I=require("./index60.cjs"),V=require("./index7.cjs"),v=require("./index59.cjs"),C=require("./index4.cjs"),N=()=>{const{DATE_RANGE_FILTERS:n,NUMBER_RANGE_FILTERS:u,SEARCH_FILTER_ID:p,VIEW_TYPE:m}=V.useBusinessLogic(),{Filters:{activeViewId:a,filters:y,arrayFilters:F,dateRangeFilters:d,numberRangeFilters:w,initFiltersFromView:b},Views:{draftViewsMap:S},Notifications:{notify:h}}=v.useStores(),{viewsMap:l,mutate:E}=I.useViews(),[R,o]=A.useState(!1),f=()=>{if(!a)throw Error("No active view");const r={};Array.from(y.entries()).filter(([e,t])=>t!==""&&e!==p).forEach(([e,t])=>{r[e]=t}),Array.from(F.entries()).filter(([,e])=>e.length>0).forEach(([e,t])=>{r[e]=t}),Array.from(d.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(w.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(a);return l.has(a)||(i=S.get(a)),{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(a)try{o(!0);const{arg:r,currentView:i}=f();await C.patchCustomView(a,{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"&&!n.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])=>n.includes(e)).map(([e,t])=>{const s=new M.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 T.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),h({type:"error",text:"Failed to save changes to your view"})}finally{o(!1)}},isSubmitting:R}};exports.usePersistUnsavedChanges=N;
package/dist/index58.js CHANGED
@@ -1,11 +1,96 @@
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 R } from "react";
2
+ import { parseDate as m } from "@internationalized/date";
3
+ import { NumberRangeFilter as T } from "./index65.js";
4
+ import { RangeFilter as I } from "./index66.js";
5
+ import { useViews as M } from "./index60.js";
6
+ import { useBusinessLogic as N } from "./index7.js";
7
+ import { useStores as V } from "./index59.js";
8
+ import { patchCustomView as v } from "./index4.js";
9
+ const x = () => {
10
+ const {
11
+ DATE_RANGE_FILTERS: a,
12
+ NUMBER_RANGE_FILTERS: p,
13
+ SEARCH_FILTER_ID: g,
14
+ VIEW_TYPE: y
15
+ } = N(), {
16
+ Filters: {
17
+ activeViewId: o,
18
+ filters: F,
19
+ arrayFilters: u,
20
+ dateRangeFilters: w,
21
+ numberRangeFilters: d,
22
+ initFiltersFromView: b
23
+ },
24
+ Views: { draftViewsMap: E },
25
+ Notifications: { notify: A }
26
+ } = V(), { viewsMap: l, mutate: h } = M(), [S, f] = R(!1), n = () => {
27
+ if (!o) throw Error("No active view");
28
+ const r = {};
29
+ Array.from(F.entries()).filter(([t, e]) => e !== "" && t !== g).forEach(([t, e]) => {
30
+ r[t] = e;
31
+ }), Array.from(u.entries()).filter(([, t]) => t.length > 0).forEach(([t, e]) => {
32
+ r[t] = e;
33
+ }), Array.from(w.entries()).filter(([, t]) => t.filterType !== void 0).forEach(([t, e]) => {
34
+ e.filterType === "CUSTOM" ? r[t] = {
35
+ gte: e.gte.toString(),
36
+ lte: e.lte.toString()
37
+ } : r[t] = e.filterType;
38
+ }), Array.from(d.entries()).filter(([, t]) => t.gte !== void 0 || t.lte !== void 0).forEach(([t, e]) => {
39
+ r[t] = {}, e.gte !== void 0 && (r[t].gte = e.gte.toString()), e.isValidLte && e.lte && (r[t].lte = e.lte.toString());
40
+ });
41
+ let i = l.get(o);
42
+ return l.has(o) || (i = E.get(o)), { arg: {
43
+ type: y,
44
+ filters: {
45
+ filter: r,
46
+ page: i == null ? void 0 : i.page
47
+ },
48
+ title: i == null ? void 0 : i.label
49
+ }, currentView: i };
50
+ };
51
+ return {
52
+ getActiveViewInAPIFormat: n,
53
+ saveChanges: async () => {
54
+ if (o)
55
+ try {
56
+ f(!0);
57
+ const { arg: r, currentView: i } = n();
58
+ await v(o, { attributes: r }), await h();
59
+ const c = {
60
+ ...i,
61
+ filterMaps: {
62
+ filters: new Map(
63
+ Object.entries(r.filters.filter).filter(
64
+ ([t, e]) => !Array.isArray(e) && typeof e == "string" && !a.includes(t)
65
+ ).map(([t, e]) => [t, e])
66
+ ),
67
+ arrayFilters: new Map(
68
+ Object.entries(r.filters.filter).filter(([, t]) => Array.isArray(t)).map(([t, e]) => [t, e])
69
+ ),
70
+ rangeFilters: new Map(
71
+ Object.entries(r.filters.filter).filter(([t]) => a.includes(t)).map(([t, e]) => {
72
+ const s = new I();
73
+ return typeof e == "object" ? (s.setFilterType("CUSTOM"), s.setDates(m(e.gte), m(e.lte))) : s.setFilterType(e), [t, s];
74
+ })
75
+ ),
76
+ numberRangeFilters: new Map(
77
+ Object.entries(r.filters.filter).filter(([t]) => p.includes(t)).map(([t, e]) => {
78
+ const s = new T({ filterId: t });
79
+ return e.gte && s.setGte(Number(e.gte)), e.lte && s.setLte(Number(e.lte)), [t, s];
80
+ })
81
+ )
82
+ }
83
+ };
84
+ b(c);
85
+ } catch (r) {
86
+ console.log(r), A({ type: "error", text: "Failed to save changes to your view" });
87
+ } finally {
88
+ f(!1);
89
+ }
90
+ },
91
+ isSubmitting: S
92
+ };
8
93
  };
9
94
  export {
10
- i as useStores
95
+ x as usePersistUnsavedChanges
11
96
  };
package/dist/index59.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("swr"),c=require("react"),x=require("./index73.cjs"),E=require("./index72.cjs"),O=require("./index61.cjs"),S=require("./index46.cjs"),y=require("./index7.cjs"),C=require("./index52.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/index59.js CHANGED
@@ -1,54 +1,11 @@
1
- import g from "swr";
2
- import { useMemo as d } from "react";
3
- import { createAllView as O } from "./index73.js";
4
- import { viewsAdapter as v } from "./index72.js";
5
- import { useCustomViews as C } from "./index61.js";
6
- import { SWR_HOOK_OPTIONS as I } from "./index46.js";
7
- import { useBusinessLogic as y } from "./index7.js";
8
- import { fetcherV2 as S } from "./index52.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/index6.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("axios"),i=require("./index74.cjs"),s=require("./index75.cjs"),l=require("./index76.cjs"),E=require("./index77.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("./index75.cjs"),s=require("./index76.cjs"),l=require("./index77.cjs"),E=require("./index78.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 "./index74.js";
3
- import { filterOptionalArgsGetDelete as y, filterOptionalArgs as p } from "./index75.js";
4
- import { filterErrorStack as i } from "./index76.js";
5
- import { injectIntoError as E } from "./index77.js";
2
+ import { AxiosErrorType as e } from "./index75.js";
3
+ import { filterOptionalArgsGetDelete as y, filterOptionalArgs as p } from "./index76.js";
4
+ import { filterErrorStack as i } from "./index77.js";
5
+ import { injectIntoError as E } from "./index78.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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const V=require("react"),h=require("./index73.cjs"),E=require("./index61.cjs"),I=require("./index59.cjs"),C=require("./index7.cjs"),S=require("./index58.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 a=s.get(l);if(a)e(a),n&&t();else{const r=s.get(w);r&&(e(r),n&&t(!1))}}else{const a=s.get(w);if(a)e(a),u(!0),n&&t();else{const r=s.get(h.ALL_VIEW_ID);r&&e(r)}}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("./index74.cjs"),E=require("./index73.cjs"),O=require("./index62.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;
package/dist/index60.js CHANGED
@@ -1,64 +1,54 @@
1
- import { useEffect as u } from "react";
2
- import { ALL_VIEW_ID as h } from "./index73.js";
3
- import { useCustomViews as I } from "./index61.js";
4
- import { useViews as E } from "./index59.js";
5
- import { useBusinessLogic as F } from "./index7.js";
6
- import { useStores as C } from "./index58.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 "./index74.js";
4
+ import { viewsAdapter as v } from "./index73.js";
5
+ import { useCustomViews as C } from "./index62.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]])
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/index61.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index46.cjs"),C=require("swr"),v=require("./index52.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 V=require("react"),h=require("./index74.cjs"),E=require("./index62.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 a=s.get(l);if(a)e(a),n&&t();else{const r=s.get(w);r&&(e(r),n&&t(!1))}}else{const a=s.get(w);if(a)e(a),u(!0),n&&t();else{const r=s.get(h.ALL_VIEW_ID);r&&e(r)}}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;