@veeqo/transfigure 2.1.2 → 2.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.
- package/dist/constants/helpGuideUrls.d.ts +3 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +81 -79
- package/dist/index100.cjs +1 -1
- package/dist/index100.js +10 -14
- package/dist/index101.cjs +1 -1
- package/dist/index101.js +24 -21
- package/dist/index102.cjs +18 -11
- package/dist/index102.js +20 -12
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +49 -6
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +29 -50
- package/dist/index105.cjs +1 -1
- package/dist/index105.js +12 -26
- package/dist/index106.cjs +10 -78
- package/dist/index106.js +13 -95
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +21 -24
- package/dist/index108.cjs +80 -1
- package/dist/index108.js +98 -2
- package/dist/index109.cjs +1 -1
- package/dist/index109.js +2 -19
- package/dist/index110.cjs +1 -1
- package/dist/index110.js +18 -7
- package/dist/index111.cjs +1 -1
- package/dist/index111.js +7 -63
- package/dist/index112.cjs +1 -1
- package/dist/index112.js +57 -26
- package/dist/index113.cjs +1 -13
- package/dist/index113.js +30 -17
- package/dist/index114.cjs +1 -1
- package/dist/index114.js +32 -22
- package/dist/index115.cjs +13 -1
- package/dist/index115.js +14 -33
- package/dist/index116.cjs +1 -7
- package/dist/index116.js +26 -10
- package/dist/index118.cjs +1 -1
- package/dist/index118.js +1 -1
- package/dist/index119.cjs +7 -1
- package/dist/index119.js +10 -47
- package/dist/index120.cjs +1 -0
- package/dist/index120.js +49 -0
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +2 -2
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +1 -1
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +1 -1
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +2 -2
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +2 -2
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +1 -1
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +4 -4
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +2 -2
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +2 -2
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +2 -2
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +3 -3
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +4 -4
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +4 -4
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +1 -1
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +2 -2
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +2 -2
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +3 -3
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +3 -3
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +1 -1
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +1 -1
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +1 -1
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +1 -1
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +6 -6
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +1 -1
- package/dist/index38.cjs +1 -1
- package/dist/index38.js +1 -1
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +3 -3
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +2 -2
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +3 -3
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +4 -4
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +2 -2
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +4 -4
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +4 -4
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +3 -3
- package/dist/index49.cjs +1 -1
- package/dist/index49.js +4 -9
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +2 -2
- package/dist/index50.cjs +1 -1
- package/dist/index50.js +9 -23
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +23 -2
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +2 -4
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +4 -11
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +10 -12
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +12 -11
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +11 -184
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +183 -25
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +26 -24
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +19 -22
- package/dist/index6.cjs +1 -1
- package/dist/index6.js +2 -2
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +25 -97
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +99 -8
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +8 -33
- package/dist/index63.cjs +1 -1
- package/dist/index63.js +33 -63
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +59 -19
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +23 -18
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +16 -29
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +30 -59
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +60 -349
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +345 -53
- package/dist/index7.cjs +1 -1
- package/dist/index7.js +4 -4
- package/dist/index70.cjs +1 -1
- package/dist/index70.js +48 -47
- package/dist/index71.cjs +1 -1
- package/dist/index71.js +51 -32
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +30 -24
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +26 -32
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +38 -4
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +4 -13
- package/dist/index76.cjs +1 -1
- package/dist/index76.js +12 -16
- package/dist/index77.cjs +1 -1
- package/dist/index77.js +14 -16
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +18 -65
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +66 -24
- package/dist/index80.cjs +1 -1
- package/dist/index80.js +24 -21
- package/dist/index81.cjs +1 -1
- package/dist/index81.js +20 -6
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +7 -2
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +2 -9
- package/dist/index84.cjs +1 -3
- package/dist/index84.js +8 -13
- package/dist/index85.cjs +3 -1
- package/dist/index85.js +13 -8
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +9 -2
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +40 -39
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +2 -41
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +41 -9
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +8 -17
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +18 -13
- package/dist/index93.cjs +1 -104
- package/dist/index93.js +7 -119
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +13 -68
- package/dist/index95.cjs +104 -1
- package/dist/index95.js +118 -27
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +68 -2
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +26 -39
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +2 -11
- package/dist/index99.cjs +1 -19
- package/dist/index99.js +41 -24
- package/package.json +1 -1
package/dist/index62.js
CHANGED
|
@@ -1,36 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const $ = () => {
|
|
9
|
-
const { DEFAULT_PAGE_NUMBER: d, DEFAULT_PAGE_SIZE: f, VIEW_TYPE: t } = C(), {
|
|
10
|
-
canUpdateCustomViews: o,
|
|
11
|
-
orderedListOfCustomViews: r,
|
|
12
|
-
defaultCustomViewId: p,
|
|
13
|
-
isLoading: c
|
|
14
|
-
} = I({ type: t }), { data: n, isLoading: w, error: V, mutate: L } = O(
|
|
15
|
-
`/api/v2/custom_views?filter[type]=${t}&page[number]=${d}&page[size]=${f}`,
|
|
16
|
-
y,
|
|
17
|
-
x
|
|
18
|
-
), { viewsMap: g, customViews: e, fixedViews: m } = a(() => v({ data: n, canUpdateCustomViews: o }), [n, o]), E = a(() => e.sort((_, A) => {
|
|
19
|
-
const u = Array.isArray(r) ? r : [], s = u.indexOf(_.id), i = u.indexOf(A.id);
|
|
20
|
-
return s === -1 && i === -1 ? 0 : s === -1 ? 1 : i === -1 ? -1 : s - i;
|
|
21
|
-
}), [e, r]);
|
|
22
|
-
return {
|
|
23
|
-
defaultCustomViewId: p,
|
|
24
|
-
viewsArray: [...m, ...e],
|
|
25
|
-
fixedViews: m,
|
|
26
|
-
customViews: e,
|
|
27
|
-
sortedCustomViews: E,
|
|
28
|
-
viewsMap: g,
|
|
29
|
-
isLoading: w || c,
|
|
30
|
-
error: V,
|
|
31
|
-
mutate: L
|
|
32
|
-
};
|
|
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;
|
|
33
8
|
};
|
|
34
9
|
export {
|
|
35
|
-
|
|
10
|
+
i as useStores
|
|
36
11
|
};
|
package/dist/index63.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("swr"),d=require("react"),q=require("./index50.cjs"),y=require("./index8.cjs"),A=require("./index66.cjs"),C=require("./index56.cjs"),S=require("./index81.cjs"),I=e=>e&&e.__esModule?e:{default:e},M=I(O),v=()=>{const{DEFAULT_PAGE_NUMBER:e,DEFAULT_PAGE_SIZE:f,VIEW_TYPE:o}=y.useBusinessLogic(),{canUpdateCustomViews:u,orderedListOfCustomViews:t,defaultCustomViewId:w,isLoading:V}=A.useCustomViews({type:o}),{data:n,isLoading:m,error:_,mutate:g}=M.default(`/api/v2/custom_views?filter[type]=${o}&page[number]=${e}&page[size]=${f}`,C.fetcherV2,q.SWR_HOOK_OPTIONS),{viewsMap:l,customViews:s,fixedViews:c}=d.useMemo(()=>S.organiseViews({data:n,canUpdateCustomViews:u}),[n,u]),L=d.useMemo(()=>s.sort((p,E)=>{const a=Array.isArray(t)?t:[],i=a.indexOf(p.id),r=a.indexOf(E.id);return i===-1&&r===-1?0:i===-1?1:r===-1?-1:i-r}),[s,t]);return{defaultCustomViewId:w,viewsArray:[...c,...s],fixedViews:c,customViews:s,sortedCustomViews:L,viewsMap:l,isLoading:m||V,error:_,mutate:g}};exports.useViews=v;
|
package/dist/index63.js
CHANGED
|
@@ -1,66 +1,36 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
const
|
|
9
|
-
const {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (a)
|
|
34
|
-
e(a), w(!0), o && i();
|
|
35
|
-
else {
|
|
36
|
-
const f = t.get(E);
|
|
37
|
-
f ? e(f) : r != null && r[0] && e(r[0]);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
n && p(c, n);
|
|
41
|
-
}
|
|
42
|
-
}, [
|
|
43
|
-
c,
|
|
44
|
-
d,
|
|
45
|
-
m,
|
|
46
|
-
w,
|
|
47
|
-
e,
|
|
48
|
-
i,
|
|
49
|
-
l,
|
|
50
|
-
p,
|
|
51
|
-
L,
|
|
52
|
-
t,
|
|
53
|
-
r
|
|
54
|
-
]), g(() => {
|
|
55
|
-
const s = () => {
|
|
56
|
-
const n = V.parse(window.location.search, { ignoreQueryPrefix: !0 }).view;
|
|
57
|
-
if (!n) return;
|
|
58
|
-
const o = t.get(n);
|
|
59
|
-
o && (e(o), i());
|
|
60
|
-
};
|
|
61
|
-
return window.addEventListener("popstate", s), () => window.removeEventListener("popstate", s);
|
|
62
|
-
}, [w, e, i, t]);
|
|
1
|
+
import O from "swr";
|
|
2
|
+
import { useMemo as a } from "react";
|
|
3
|
+
import { SWR_HOOK_OPTIONS as x } from "./index50.js";
|
|
4
|
+
import { useBusinessLogic as C } from "./index8.js";
|
|
5
|
+
import { useCustomViews as I } from "./index66.js";
|
|
6
|
+
import { fetcherV2 as y } from "./index56.js";
|
|
7
|
+
import { organiseViews as v } from "./index81.js";
|
|
8
|
+
const $ = () => {
|
|
9
|
+
const { DEFAULT_PAGE_NUMBER: d, DEFAULT_PAGE_SIZE: f, VIEW_TYPE: t } = C(), {
|
|
10
|
+
canUpdateCustomViews: o,
|
|
11
|
+
orderedListOfCustomViews: r,
|
|
12
|
+
defaultCustomViewId: p,
|
|
13
|
+
isLoading: c
|
|
14
|
+
} = I({ type: t }), { data: n, isLoading: w, error: V, mutate: L } = O(
|
|
15
|
+
`/api/v2/custom_views?filter[type]=${t}&page[number]=${d}&page[size]=${f}`,
|
|
16
|
+
y,
|
|
17
|
+
x
|
|
18
|
+
), { viewsMap: g, customViews: e, fixedViews: m } = a(() => v({ data: n, canUpdateCustomViews: o }), [n, o]), E = a(() => e.sort((_, A) => {
|
|
19
|
+
const u = Array.isArray(r) ? r : [], s = u.indexOf(_.id), i = u.indexOf(A.id);
|
|
20
|
+
return s === -1 && i === -1 ? 0 : s === -1 ? 1 : i === -1 ? -1 : s - i;
|
|
21
|
+
}), [e, r]);
|
|
22
|
+
return {
|
|
23
|
+
defaultCustomViewId: p,
|
|
24
|
+
viewsArray: [...m, ...e],
|
|
25
|
+
fixedViews: m,
|
|
26
|
+
customViews: e,
|
|
27
|
+
sortedCustomViews: E,
|
|
28
|
+
viewsMap: g,
|
|
29
|
+
isLoading: w || c,
|
|
30
|
+
error: V,
|
|
31
|
+
mutate: L
|
|
32
|
+
};
|
|
63
33
|
};
|
|
64
34
|
export {
|
|
65
|
-
|
|
35
|
+
$ as useViews
|
|
66
36
|
};
|
package/dist/index64.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react"),q=require("qs"),E=require("./index80.cjs"),I=require("./index66.cjs"),C=require("./index63.cjs"),D=require("./index8.cjs"),F=require("./index62.cjs"),P=t=>t&&t.__esModule?t:{default:t},v=P(q),S=()=>{const{VIEW_TYPE:t,SEARCH_FILTER_ID:l}=D.useBusinessLogic(),{Filters:{activeViewId:g,initFiltersFromView:e,initFromUrl:i,discardChanges:f,updateUrl:L,setFilter:V}}=F.useStores(),{isLoading:_}=I.useCustomViews({type:t}),{viewsMap:s,defaultCustomViewId:w,isLoading:h,viewsArray:n}=C.useViews(),p=h||_;m.useEffect(()=>{if(p)return;const o=v.default.parse(window.location.search,{ignoreQueryPrefix:!0}),d=o.view,a=o[l],r=Object.keys(o).length>0;if(!g){if(d){const u=s.get(d);if(u)e(u),r&&i();else{const c=s.get(w);c&&(e(c),r&&i(!1))}}else{const u=s.get(w);if(u)e(u),f(!0),r&&i();else{const c=s.get(E.ALL_VIEW_ID);c?e(c):n!=null&&n[0]&&e(n[0])}}a&&V(l,a)}},[l,g,w,f,e,i,p,V,L,s,n]),m.useEffect(()=>{const o=()=>{const a=v.default.parse(window.location.search,{ignoreQueryPrefix:!0}).view;if(!a)return;const r=s.get(a);r&&(e(r),i())};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[f,e,i,s])};exports.useViewUrlChange=S;
|
package/dist/index64.js
CHANGED
|
@@ -1,26 +1,66 @@
|
|
|
1
|
-
import { useEffect as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { useEffect as g } from "react";
|
|
2
|
+
import V from "qs";
|
|
3
|
+
import { ALL_VIEW_ID as E } from "./index80.js";
|
|
4
|
+
import { useCustomViews as F } from "./index66.js";
|
|
5
|
+
import { useViews as C } from "./index63.js";
|
|
6
|
+
import { useBusinessLogic as D } from "./index8.js";
|
|
7
|
+
import { useStores as P } from "./index62.js";
|
|
8
|
+
const R = () => {
|
|
9
|
+
const { VIEW_TYPE: v, SEARCH_FILTER_ID: c } = D(), {
|
|
7
10
|
Filters: {
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
activeViewId: d,
|
|
12
|
+
initFiltersFromView: e,
|
|
13
|
+
initFromUrl: i,
|
|
14
|
+
discardChanges: w,
|
|
15
|
+
updateUrl: L,
|
|
16
|
+
setFilter: p
|
|
17
|
+
}
|
|
18
|
+
} = P(), { isLoading: I } = F({ type: v }), { viewsMap: t, defaultCustomViewId: m, isLoading: h, viewsArray: r } = C(), l = h || I;
|
|
19
|
+
g(() => {
|
|
20
|
+
if (l) return;
|
|
21
|
+
const s = V.parse(window.location.search, { ignoreQueryPrefix: !0 }), u = s.view, n = s[c], o = Object.keys(s).length > 0;
|
|
22
|
+
if (!d) {
|
|
23
|
+
if (u) {
|
|
24
|
+
const a = t.get(u);
|
|
25
|
+
if (a)
|
|
26
|
+
e(a), o && i();
|
|
27
|
+
else {
|
|
28
|
+
const f = t.get(m);
|
|
29
|
+
f && (e(f), o && i(!1));
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
const a = t.get(m);
|
|
33
|
+
if (a)
|
|
34
|
+
e(a), w(!0), o && i();
|
|
35
|
+
else {
|
|
36
|
+
const f = t.get(E);
|
|
37
|
+
f ? e(f) : r != null && r[0] && e(r[0]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
n && p(c, n);
|
|
10
41
|
}
|
|
11
|
-
} = p();
|
|
12
|
-
n(() => {
|
|
13
|
-
const s = i.parse(window.location.search, { ignoreQueryPrefix: !0 })[t];
|
|
14
|
-
e(), s && o(t, s);
|
|
15
42
|
}, [
|
|
16
|
-
|
|
43
|
+
c,
|
|
44
|
+
d,
|
|
45
|
+
m,
|
|
46
|
+
w,
|
|
17
47
|
e,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
48
|
+
i,
|
|
49
|
+
l,
|
|
50
|
+
p,
|
|
51
|
+
L,
|
|
52
|
+
t,
|
|
53
|
+
r
|
|
54
|
+
]), g(() => {
|
|
55
|
+
const s = () => {
|
|
56
|
+
const n = V.parse(window.location.search, { ignoreQueryPrefix: !0 }).view;
|
|
57
|
+
if (!n) return;
|
|
58
|
+
const o = t.get(n);
|
|
59
|
+
o && (e(o), i());
|
|
60
|
+
};
|
|
61
|
+
return window.addEventListener("popstate", s), () => window.removeEventListener("popstate", s);
|
|
62
|
+
}, [w, e, i, t]);
|
|
23
63
|
};
|
|
24
64
|
export {
|
|
25
|
-
|
|
65
|
+
R as useViewUrlChange
|
|
26
66
|
};
|
package/dist/index65.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),i=require("qs"),u=require("./index8.cjs"),a=require("./index62.cjs"),c=e=>e&&e.__esModule?e:{default:e},l=c(i),d=()=>{const{SEARCH_FILTER_ID:e}=u.useBusinessLogic(),{Filters:{initFromUrl:t,setFilter:r}}=a.useStores();n.useEffect(()=>{const o=l.default.parse(window.location.search,{ignoreQueryPrefix:!0})[e];t(),o&&r(e,o)},[e,t,r]),n.useEffect(()=>{const s=()=>t();return window.addEventListener("popstate",s),()=>window.removeEventListener("popstate",s)},[t])};exports.useUrlChange=d;
|
package/dist/index65.js
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { useEffect as n } from "react";
|
|
2
|
+
import i from "qs";
|
|
3
|
+
import { useBusinessLogic as a } from "./index8.js";
|
|
4
|
+
import { useStores as p } from "./index62.js";
|
|
5
|
+
const d = () => {
|
|
6
|
+
const { SEARCH_FILTER_ID: t } = a(), {
|
|
7
|
+
Filters: {
|
|
8
|
+
initFromUrl: e,
|
|
9
|
+
setFilter: o
|
|
10
|
+
}
|
|
11
|
+
} = p();
|
|
12
|
+
n(() => {
|
|
13
|
+
const s = i.parse(window.location.search, { ignoreQueryPrefix: !0 })[t];
|
|
14
|
+
e(), s && o(t, s);
|
|
15
|
+
}, [
|
|
16
|
+
t,
|
|
17
|
+
e,
|
|
18
|
+
o
|
|
19
|
+
]), n(() => {
|
|
20
|
+
const r = () => e();
|
|
21
|
+
return window.addEventListener("popstate", r), () => window.removeEventListener("popstate", r);
|
|
22
|
+
}, [e]);
|
|
18
23
|
};
|
|
19
24
|
export {
|
|
20
|
-
|
|
25
|
+
d as useUrlChange
|
|
21
26
|
};
|
package/dist/index66.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index50.cjs"),C=require("swr"),v=require("./index56.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/index66.js
CHANGED
|
@@ -1,34 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { DEFAULT_HIDDEN_COLUMNS: r, DEFAULT_VISIBLE_COLUMNS: l } = C(), { Filters: { activeViewId: d } } = I(), { viewsMap: t, isLoading: o, error: n } = f();
|
|
8
|
-
if (!d || o)
|
|
9
|
-
return {
|
|
10
|
-
isLoading: o,
|
|
11
|
-
error: n,
|
|
12
|
-
orderedColumnIds: void 0,
|
|
13
|
-
hiddenColumnIds: []
|
|
14
|
-
};
|
|
15
|
-
const e = t.get(d), s = (i = e == null ? void 0 : e.columns) == null ? void 0 : i.columnIds;
|
|
16
|
-
if (c(s) && s.length > 0) {
|
|
17
|
-
const m = [...r, ...l].filter((u) => !s.includes(u));
|
|
18
|
-
return {
|
|
19
|
-
isLoading: o,
|
|
20
|
-
error: n,
|
|
21
|
-
orderedColumnIds: s,
|
|
22
|
-
hiddenColumnIds: m
|
|
23
|
-
};
|
|
24
|
-
}
|
|
1
|
+
import { SWR_HOOK_OPTIONS as O } from "./index50.js";
|
|
2
|
+
import S from "swr";
|
|
3
|
+
import { fetcherV1 as h } from "./index56.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);
|
|
25
7
|
return {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
|
30
17
|
};
|
|
31
18
|
};
|
|
32
19
|
export {
|
|
33
|
-
|
|
20
|
+
R as useCustomViews
|
|
34
21
|
};
|
package/dist/index67.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("lodash/isArray"),a=require("./index8.cjs"),C=require("./index62.cjs"),I=require("./index63.cjs"),_=s=>s&&s.__esModule?s:{default:s},f=_(m),L=()=>{var t;const{DEFAULT_HIDDEN_COLUMNS:s,DEFAULT_VISIBLE_COLUMNS:i}=a.useBusinessLogic(),{Filters:{activeViewId:r}}=C.useStores(),{viewsMap:d,isLoading:e,error:n}=I.useViews();if(!r||e)return{isLoading:e,error:n,orderedColumnIds:void 0,hiddenColumnIds:[]};const u=d.get(r),o=(t=u==null?void 0:u.columns)==null?void 0:t.columnIds;if(f.default(o)&&o.length>0){const l=[...s,...i].filter(c=>!o.includes(c));return{isLoading:e,error:n,orderedColumnIds:o,hiddenColumnIds:l}}return{isLoading:e,error:n,orderedColumnIds:void 0,hiddenColumnIds:s}};exports.useColumns=L;
|
package/dist/index67.js
CHANGED
|
@@ -1,63 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
default:
|
|
31
|
-
if (!o) break;
|
|
32
|
-
if (r[e] === o) return;
|
|
33
|
-
r[e] = o;
|
|
34
|
-
}
|
|
35
|
-
const s = i.stringify(r, { arrayFormat: "brackets" });
|
|
36
|
-
s && window.history.replaceState({}, "", `${window.location.pathname}?${s}`);
|
|
37
|
-
}, [a, e, o, t]), l = I(() => {
|
|
38
|
-
const r = i.parse(window.location.search, { ignoreQueryPrefix: !0 }), s = r[e], m = r.sort_order, f = r.sort;
|
|
39
|
-
switch (a) {
|
|
40
|
-
case c.CORAL:
|
|
41
|
-
m && f && n({ columnId: f, direction: m });
|
|
42
|
-
break;
|
|
43
|
-
case c.MONOLITH:
|
|
44
|
-
default: {
|
|
45
|
-
if (!s) break;
|
|
46
|
-
const S = s.startsWith("-"), h = S ? "desc" : "asc", k = S ? s.slice(1) : s;
|
|
47
|
-
n({ columnId: k, direction: h });
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}, [a, e, n]);
|
|
51
|
-
return b(() => {
|
|
52
|
-
l();
|
|
53
|
-
}, [l]), b(() => {
|
|
54
|
-
u();
|
|
55
|
-
}, [t, u]), {
|
|
56
|
-
queryParams: p,
|
|
57
|
-
hasActiveView: O,
|
|
58
|
-
updateCurrentUrlWithTableSort: u
|
|
1
|
+
import c from "lodash/isArray";
|
|
2
|
+
import { useBusinessLogic as C } from "./index8.js";
|
|
3
|
+
import { useStores as I } from "./index62.js";
|
|
4
|
+
import { useViews as f } from "./index63.js";
|
|
5
|
+
const v = () => {
|
|
6
|
+
var i;
|
|
7
|
+
const { DEFAULT_HIDDEN_COLUMNS: r, DEFAULT_VISIBLE_COLUMNS: l } = C(), { Filters: { activeViewId: d } } = I(), { viewsMap: t, isLoading: o, error: n } = f();
|
|
8
|
+
if (!d || o)
|
|
9
|
+
return {
|
|
10
|
+
isLoading: o,
|
|
11
|
+
error: n,
|
|
12
|
+
orderedColumnIds: void 0,
|
|
13
|
+
hiddenColumnIds: []
|
|
14
|
+
};
|
|
15
|
+
const e = t.get(d), s = (i = e == null ? void 0 : e.columns) == null ? void 0 : i.columnIds;
|
|
16
|
+
if (c(s) && s.length > 0) {
|
|
17
|
+
const m = [...r, ...l].filter((u) => !s.includes(u));
|
|
18
|
+
return {
|
|
19
|
+
isLoading: o,
|
|
20
|
+
error: n,
|
|
21
|
+
orderedColumnIds: s,
|
|
22
|
+
hiddenColumnIds: m
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
isLoading: o,
|
|
27
|
+
error: n,
|
|
28
|
+
orderedColumnIds: void 0,
|
|
29
|
+
hiddenColumnIds: r
|
|
59
30
|
};
|
|
60
31
|
};
|
|
61
32
|
export {
|
|
62
|
-
|
|
33
|
+
v as useColumns
|
|
63
34
|
};
|
package/dist/index68.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var L=Object.defineProperty;var I=(y,t,l)=>t in y?L(y,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):y[t]=l;var u=(y,t,l)=>I(y,typeof t!="symbol"?t+"":t,l);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("mobx"),N=require("@veeqo/ui"),_=require("@internationalized/date"),V=require("lodash/isEqual"),O=require("lodash/get"),U=require("lodash/set"),B=require("qs"),F=require("./index49.cjs"),P=require("./index2.cjs"),b=require("./index70.cjs"),v=require("./index69.cjs"),G=require("./index79.cjs"),C=require("./index77.cjs"),d=require("./index9.cjs"),T=y=>y&&y.__esModule?y:{default:y},D=T(V),q=T(O),M=T(U),R=T(B);class z{constructor(){u(this,"defaultPageSize");u(this,"pageSize");u(this,"currentPage");u(this,"defaultFilters");u(this,"defaultArrayFilters");u(this,"defaultDateRangeFilters");u(this,"defaultNumberRangeFilters");u(this,"filters");u(this,"arrayFilters");u(this,"dateRangeFilters");u(this,"numberRangeFilters");u(this,"activeViewId");u(this,"isFiltersDropdownVisible");u(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)});u(this,"updateUrl",(t=!1)=>{try{const{SORT_FILTER_ID:l,SORTING_MODE:s}=d.BusinessLogicManager.getBusinessLogic(),e=R.default.parse(window.location.search,{ignoreQueryPrefix:!0}),r=e[l],g=e.sort_order,f=e.sort;let o="";switch(s){case P.SortingMode.CORAL:if(g&&f){const c={...this.queryParamsObject,sort:f,sort_order:g};o=`${window.location.pathname}?${R.default.stringify(c,{arrayFormat:"brackets"})}`}break;case P.SortingMode.MONOLITH:default:if(r){const c={...this.queryParamsObject,[l]:r};o=`${window.location.pathname}?${R.default.stringify(c,{arrayFormat:"brackets"})}`}}r||(o=`${window.location.pathname}?${this.queryParams}`),t?window.history.pushState({},"",o):window.history.replaceState({},"",o)}catch(l){console.log(l)}});u(this,"setCurrentPage",t=>{this.currentPage=t});u(this,"setPageSize",t=>{this.pageSize=t,this.updateUrl()});u(this,"setFilter",(t,l)=>{this.filters.set(t,l),this.setCurrentPage(1),this.updateUrl()});u(this,"clearFilter",t=>{this.filters.set(t,""),this.setCurrentPage(1),this.updateUrl()});u(this,"setArrayFilter",(t,l)=>{this.arrayFilters.set(t,l),this.setCurrentPage(1),this.updateUrl()});u(this,"clearArrayFilter",t=>{this.arrayFilters.set(t,[]),this.setCurrentPage(1),this.updateUrl()});u(this,"setRangeFilter",({key:t,range:l,dates:s})=>{l.setFilterType(t),l.setDates(s.start,s.end),this.setCurrentPage(1),this.updateUrl()});u(this,"clearRangeFilter",t=>{const l=this.dateRangeFilters.get(t);l&&(l.clear(),this.setCurrentPage(1),this.updateUrl())});u(this,"setNumberRangeFilter",({numberRange:t,gte:l,lte:s})=>{t.setGte(l),t.setLte(s),this.setCurrentPage(1),this.updateUrl()});u(this,"clearNumberRangeFilter",t=>{const l=this.numberRangeFilters.get(t);l&&(l.clear(),this.setCurrentPage(1),this.updateUrl())});u(this,"clearAllFilters",(t=!1)=>{const{SEARCH_FILTER_ID:l}=d.BusinessLogicManager.getBusinessLogic();this.filters.forEach((s,e)=>{e!==l&&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()),this.setCurrentPage(1),t||this.updateUrl()});u(this,"clearFiltersForGroup",t=>{const{GROUP_MAP:l}=d.BusinessLogicManager.getBusinessLogic(),s=l.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)})});u(this,"setActiveViewId",t=>{this.activeViewId=t,this.updateUrl()});u(this,"toggleFiltersDropdownVisible",t=>{this.isFiltersDropdownVisible=t});u(this,"getFiltersForGroup",t=>{const{GROUP_MAP:l}=d.BusinessLogicManager.getBusinessLogic(),s=l.get(t);if(!s)return{};const e={};return s.fields.forEach(r=>{this.arrayFilters.has(r.id)?e[r.id]=this.arrayFilters.get(r.id):this.dateRangeFilters.has(r.id)?e[r.id]=this.dateRangeFilters.get(r.id):this.numberRangeFilters.has(r.id)?e[r.id]=this.numberRangeFilters.get(r.id):e[r.id]=this.filters.get(r.id)}),e});u(this,"initFiltersFromView",t=>{var s;const{PAGE_SIZE_OPTIONS:l}=d.BusinessLogicManager.getBusinessLogic();(s=t.page)!=null&&s.size&&l.includes(t.page.size)&&(this.defaultPageSize=t.page.size,this.pageSize=t.page.size),this.setCurrentPage(1),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,r])=>{const g=new b.RangeFilter(r.filterType);return r.gte&&r.lte&&g.setDates(r.gte,r.lte),[e,g]})),this.defaultNumberRangeFilters=new Map(Array.from(t.filterMaps.numberRangeFilters.entries()).map(([e,r])=>{const g=r.clone();return r.gte&&g.setGte(r.gte),r.lte&&g.setLte(r.lte),[e,g]})),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,r])=>{const g=new b.RangeFilter(r.filterType);return r.gte&&r.lte&&g.setDates(r.gte,r.lte),[e,g]})),this.numberRangeFilters=new Map(Array.from(t.filterMaps.numberRangeFilters.entries()).map(([e,r])=>{const g=r.clone();return r.gte&&g.setGte(r.gte),r.lte&&g.setLte(r.lte),[e,g]})),this.activeViewId=t.id});u(this,"initFromUrl",(t=!0)=>{const{GROUP_MAP:l,PAGE_SIZE_OPTIONS:s,PAGE_SIZE_FILTER_ID:e}=d.BusinessLogicManager.getBusinessLogic(),r=R.default.parse(window.location.search,{ignoreQueryPrefix:!0}),g=Array.from(l.values()).flatMap(n=>n.fields),f=new Map,o=new Map,c=new Map,E=new Map;t&&r.view&&(this.activeViewId=r.view),r[e]&&s.includes(Number(r[e]))&&(this.pageSize=Number(r[e]));const S=r.filter||{};g.forEach(n=>{const i=q.default(S,n.id);if(i!==void 0)switch(n.filterType){case F.FilterChoiceValue.CHECKBOX:Array.isArray(i)?o.set(n.id,i):i&&o.set(n.id,[i]);break;case F.FilterChoiceValue.DATE_RANGE:if(typeof i=="string"&&C.isValidDateRange(i))c.set(n.id,new b.RangeFilter(i));else if(typeof i=="object"&&i!==null){const a=i;if(a.relative&&C.isValidDateRange(a.relative))c.set(n.id,new b.RangeFilter(a.relative));else if(a.gte&&a.lte)try{const p=_.parseDate(a.gte),w=_.parseDate(a.lte),m=new b.RangeFilter("CUSTOM");m.setDates(p,w),c.set(n.id,m)}catch{c.set(n.id,new b.RangeFilter(N.DateRanges.TODAY))}}break;case F.FilterChoiceValue.NUMBER_RANGE:if(typeof i=="object"&&i!==null){const a=i,p=new v.NumberRangeFilter({filterId:n.id});a.gte!==void 0&&p.setGte(Number(a.gte)),a.lte!==void 0&&p.setLte(Number(a.lte)),E.set(n.id,p)}break;case F.FilterChoiceValue.TEXT:case F.FilterChoiceValue.NUMBER:case F.FilterChoiceValue.RADIO:(typeof i=="string"||typeof i=="number")&&f.set(n.id,String(i));break}}),this.filters=f,this.arrayFilters=o,this.dateRangeFilters=c,this.numberRangeFilters=E,this.updateUrl()});u(this,"discardChanges",(t=!1)=>{this.pageSize=this.defaultPageSize;const{SEARCH_FILTER_ID:l}=d.BusinessLogicManager.getBusinessLogic(),s=new Map(this.defaultFilters);this.filters.has(l)&&s.set(l,this.filters.get(l)),this.filters=s,this.arrayFilters=new Map(this.defaultArrayFilters),this.dateRangeFilters.clear(),this.defaultDateRangeFilters.forEach((e,r)=>{const g=new b.RangeFilter(e.filterType);g.setDates(e.gte,e.lte),this.dateRangeFilters.set(r,g)}),this.numberRangeFilters.clear(),this.defaultNumberRangeFilters.forEach((e,r)=>{this.numberRangeFilters.set(r,e.clone())}),this.updateUrl(t)});const{GROUP_MAP:t}=d.BusinessLogicManager.getBusinessLogic(),l=Array.from(t.values()).flatMap(s=>s.fields);this.filters=new Map(l.filter(s=>s.filterType===F.FilterChoiceValue.TEXT||s.filterType===F.FilterChoiceValue.NUMBER||s.filterType===F.FilterChoiceValue.RADIO||s.filterType===F.FilterChoiceValue.DATE_RANGE).map(s=>[s.id,""])),this.arrayFilters=new Map(l.filter(s=>s.filterType===F.FilterChoiceValue.CHECKBOX).map(s=>[s.id,[]])),this.dateRangeFilters=new Map(l.filter(s=>s.filterType===F.FilterChoiceValue.DATE_RANGE).map(s=>[s.id,new b.RangeFilter])),this.numberRangeFilters=new Map(l.filter(s=>s.filterType===F.FilterChoiceValue.NUMBER_RANGE).map(s=>{const e=new v.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,h.makeObservable(this,{defaultPageSize:h.observable,pageSize:h.observable,currentPage:h.observable,defaultFilters:h.observable,defaultArrayFilters:h.observable,defaultDateRangeFilters:h.observable,defaultNumberRangeFilters:h.observable,filters:h.observable,arrayFilters:h.observable,numberRangeFilters:h.observable,dateRangeFilters:h.observable,isFiltersDropdownVisible:h.observable,activeViewId:h.observable,setPageSize:h.action,setCurrentPage:h.action,toggleFiltersDropdownVisible:h.action,setActiveViewId:h.action,setFilter:h.action,setArrayFilter:h.action,setRangeFilter:h.action,setNumberRangeFilter:h.action,clearFilter:h.action,clearArrayFilter:h.action,clearRangeFilter:h.action,clearNumberRangeFilter:h.action,clearAllFilters:h.action,getFiltersForGroup:h.action,clearFiltersForGroup:h.action,initFromUrl:h.action,initFiltersFromView:h.action,initDefaultFilterMaps:h.action,discardChanges:h.action,updateUrl:h.action,hasActiveFilters:h.computed,activeFilterKeysList:h.computed,queryParamsObject:h.computed,queryParams:h.computed,hasUnsavedChanges:h.computed})}get hasActiveFilters(){const{GROUP_MAP:t}=d.BusinessLogicManager.getBusinessLogic(),l=Array.from(t.values()).flatMap(e=>e.fields),s=new Set(l.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:l}=d.BusinessLogicManager.getBusinessLogic(),s=Array.from(this.filters.entries()).filter(([o,c])=>c!==""&&!t.includes(o)&&!l.includes(o)).map(([o])=>o),e=Array.from(this.arrayFilters.entries()).filter(([,o])=>o.length>0).map(([o])=>o),r=Array.from(this.dateRangeFilters.entries()).filter(([,o])=>o.filterType!==void 0).map(([o])=>o),g=Array.from(this.numberRangeFilters.entries()).filter(([,o])=>o.isActive).map(([o])=>o);return[...new Set([...s,...e,...r,...g])]}get queryParamsObject(){const{DATE_RANGE_FILTERS:t,NUMBER_RANGE_FILTERS:l,PAGE_SIZE_FILTER_ID:s,PAGE_NUMBER_FILTER_ID:e}=d.BusinessLogicManager.getBusinessLogic(),r={};Array.from(this.filters.entries()).filter(([f,o])=>o!==""&&!t.includes(f)&&!l.includes(f)).forEach(([f,o])=>{M.default(r,f,o)}),Array.from(this.arrayFilters.entries()).filter(([,f])=>f.length>0).forEach(([f,o])=>{M.default(r,f,o)}),Array.from(this.dateRangeFilters.entries()).filter(([,f])=>f.filterType!==void 0).forEach(([f,o])=>{o.filterType==="CUSTOM"?M.default(r,f,{gte:o.gte.toString(),lte:o.lte.toString()}):M.default(r,f,{relative:o.filterType})}),Array.from(this.numberRangeFilters.entries()).filter(([,f])=>f.isActive).forEach(([f,o])=>{const c={};o.gte!==void 0&&(c.gte=o.gte),o.isValidLte&&(c.lte=o.lte),M.default(r,f,c)});const g={filter:r,[s]:String(this.pageSize),[e]:String(this.currentPage)};return this.activeViewId&&(g.view=this.activeViewId),g}get queryParams(){return R.default.stringify(this.queryParamsObject,{arrayFormat:"brackets"})}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:l}=d.BusinessLogicManager.getBusinessLogic(),s=Array.from(t.values()).flatMap(n=>n.fields),e=new Set(s.map(n=>n.id));if(Array.from(this.filters.entries()).filter(([n])=>n!==l&&e.has(n)).some(([n,i])=>{const a=this.defaultFilters.get(n);return a===void 0&&i!==""||a!==void 0&&i!==a}))return!0;const g=Array.from(this.defaultArrayFilters.entries()).filter(([n])=>e.has(n)).some(([n,i])=>{const a=this.defaultArrayFilters.get(n)||[];return i.length>0||a.length>0?i.length!==a.length||!D.default(i,a):!1}),f=Array.from(this.arrayFilters.entries()).filter(([n])=>e.has(n)).some(([n,i])=>{const a=this.defaultArrayFilters.get(n)||[];return i.length>0||a.length>0?i.length!==a.length||!D.default(i,a):!1});if(g||f)return!0;const o=Array.from(this.numberRangeFilters.entries()).filter(([n])=>e.has(n)).some(([n,i])=>{const a=this.defaultNumberRangeFilters.get(n);return!i.isEqual(a)});if(Array.from(this.defaultNumberRangeFilters.entries()).filter(([n])=>e.has(n)).some(([n,i])=>{const a=this.numberRangeFilters.get(n);return!i.isEqual(a)})||o)return!0;const E=Array.from(this.defaultDateRangeFilters.entries()).filter(([n])=>e.has(n)).some(([n,i])=>{var p,w,m,A;const a=this.dateRangeFilters.get(n);return i!=null&&i.filterType&&!(a!=null&&a.filterType)||a!=null&&a.filterType&&!(i!=null&&i.filterType)||(a==null?void 0:a.filterType)!==(i==null?void 0:i.filterType)?!0:(a==null?void 0:a.filterType)==="CUSTOM"&&(i==null?void 0:i.filterType)==="CUSTOM"?((p=i.gte)==null?void 0:p.toString())!==((w=a.gte)==null?void 0:w.toString())||((m=i.lte)==null?void 0:m.toString())!==((A=a.lte)==null?void 0:A.toString()):!1});return Array.from(this.dateRangeFilters.entries()).filter(([n])=>e.has(n)).some(([n,i])=>{var p,w,m,A;const a=this.defaultDateRangeFilters.get(n);return i!=null&&i.filterType&&!(a!=null&&a.filterType)||a!=null&&a.filterType&&!(i!=null&&i.filterType)||(a==null?void 0:a.filterType)!==(i==null?void 0:i.filterType)?!0:(a==null?void 0:a.filterType)==="CUSTOM"&&(i==null?void 0:i.filterType)==="CUSTOM"?((p=i.gte)==null?void 0:p.toString())!==((w=a.gte)==null?void 0:w.toString())||((m=i.lte)==null?void 0:m.toString())!==((A=a.lte)==null?void 0:A.toString()):!1})||E}}exports.Filters=z;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),c=require("./index2.cjs"),y=require("qs"),_=require("./index8.cjs"),h=require("./index62.cjs"),k=r=>r&&r.__esModule?r:{default:r},n=k(y),L=()=>{const{SORT_FILTER_ID:r,SORTING_MODE:a}=_.useBusinessLogic(),{Filters:{queryParamsObject:l,activeViewId:g},Table:{sortParam:o,sortState:t,setSortState:u}}=h.useStores(),I=!!g,O=i.useMemo(()=>{const e={...l};switch(a){case c.SortingMode.CORAL:t.columnId&&(e.sort_order=t.direction,e.sort=t.columnId);break;case c.SortingMode.MONOLITH:default:o&&(e[r]=o)}return n.default.stringify(e,{arrayFormat:"brackets"})},[l,o,a,r,t]),d=i.useCallback(()=>{const e=n.default.parse(window.location.search,{ignoreQueryPrefix:!0});switch(a){case c.SortingMode.CORAL:if(!t.columnId||e.sort_order===t.direction&&e.sort===t.columnId)break;e.sort_order=t.direction,e.sort=t.columnId;break;case c.SortingMode.MONOLITH:default:if(!o)break;if(e[r]===o)return;e[r]=o}const s=n.default.stringify(e,{arrayFormat:"brackets"});s&&window.history.replaceState({},"",`${window.location.pathname}?${s}`)},[a,r,o,t]),f=i.useCallback(()=>{const e=n.default.parse(window.location.search,{ignoreQueryPrefix:!0}),s=e[r],S=e.sort_order,m=e.sort;switch(a){case c.SortingMode.CORAL:S&&m&&u({columnId:m,direction:S});break;case c.SortingMode.MONOLITH:default:{if(!s)break;const b=s.startsWith("-"),w=b?"desc":"asc",M=b?s.slice(1):s;u({columnId:M,direction:w})}}},[a,r,u]);return i.useEffect(()=>{f()},[f]),i.useEffect(()=>{d()},[t,d]),{queryParams:O,hasActiveView:I,updateCurrentUrlWithTableSort:d}};exports.useUrlParams=L;
|