@veeqo/transfigure 1.2.2 → 1.2.4
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/BusinessLogic/mocks.d.ts +10 -0
- package/dist/index10.cjs +1 -1
- package/dist/index10.js +88 -78
- package/dist/index100.cjs +19 -1
- package/dist/index100.js +24 -21
- package/dist/index102.cjs +1 -12
- package/dist/index102.js +21 -16
- package/dist/index103.cjs +1 -1
- package/dist/index103.js +28 -23
- package/dist/index105.cjs +12 -1
- package/dist/index105.js +16 -24
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +1 -1
- package/dist/index108.cjs +1 -1
- package/dist/index108.js +1 -1
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +1 -1
- package/dist/index116.cjs +7 -1
- package/dist/index116.js +10 -47
- package/dist/index117.cjs +1 -7
- package/dist/index117.js +47 -10
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +1 -1
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +1 -1
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +1 -1
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +1 -1
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +1 -1
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +2 -2
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +71 -71
- package/dist/index63.cjs +1 -1
- package/dist/index63.js +35 -33
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +11 -10
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +46 -44
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +202 -201
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +41 -29
- package/dist/index80.cjs +1 -1
- package/dist/index80.js +1 -1
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +5 -41
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +41 -9
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +8 -4
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +7 -7
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +7 -13
- package/dist/index92.cjs +1 -104
- package/dist/index92.js +13 -120
- package/dist/index93.cjs +104 -1
- package/dist/index93.js +117 -65
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +63 -24
- package/dist/index95.cjs +1 -1
- package/dist/index95.js +29 -2
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +2 -41
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +39 -9
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +10 -6
- package/dist/index99.cjs +1 -19
- package/dist/index99.js +24 -24
- package/dist/mobx/Filters/Filters.d.ts +1 -1
- package/dist/storybookHelpers/apiMocks/views/custom_views.d.ts +45 -4
- package/package.json +5 -2
package/dist/index63.js
CHANGED
|
@@ -1,64 +1,66 @@
|
|
|
1
|
-
import { useEffect as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { useEffect as g } from "react";
|
|
2
|
+
import V from "qs";
|
|
3
|
+
import { ALL_VIEW_ID as E } from "./index79.js";
|
|
4
|
+
import { useCustomViews as F } from "./index65.js";
|
|
5
|
+
import { useViews as C } from "./index62.js";
|
|
6
|
+
import { useBusinessLogic as D } from "./index8.js";
|
|
7
|
+
import { useStores as P } from "./index61.js";
|
|
8
|
+
const R = () => {
|
|
9
|
+
const { VIEW_TYPE: v, SEARCH_FILTER_ID: c } = D(), {
|
|
9
10
|
Filters: {
|
|
10
11
|
activeViewId: d,
|
|
11
12
|
initFiltersFromView: e,
|
|
12
13
|
initFromUrl: i,
|
|
13
14
|
discardChanges: w,
|
|
14
15
|
updateUrl: L,
|
|
15
|
-
setFilter:
|
|
16
|
+
setFilter: p
|
|
16
17
|
}
|
|
17
|
-
} =
|
|
18
|
-
|
|
19
|
-
if (
|
|
20
|
-
const s =
|
|
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;
|
|
21
22
|
if (!d) {
|
|
22
|
-
if (
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
-
e(
|
|
23
|
+
if (u) {
|
|
24
|
+
const a = t.get(u);
|
|
25
|
+
if (a)
|
|
26
|
+
e(a), o && i();
|
|
26
27
|
else {
|
|
27
|
-
const
|
|
28
|
-
|
|
28
|
+
const f = t.get(m);
|
|
29
|
+
f && (e(f), o && i(!1));
|
|
29
30
|
}
|
|
30
31
|
} else {
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
e(
|
|
32
|
+
const a = t.get(m);
|
|
33
|
+
if (a)
|
|
34
|
+
e(a), w(!0), o && i();
|
|
34
35
|
else {
|
|
35
|
-
const
|
|
36
|
-
|
|
36
|
+
const f = t.get(E);
|
|
37
|
+
f ? e(f) : r != null && r[0] && e(r[0]);
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
+
n && p(c, n);
|
|
40
41
|
}
|
|
41
42
|
}, [
|
|
42
43
|
c,
|
|
43
44
|
d,
|
|
44
|
-
|
|
45
|
+
m,
|
|
45
46
|
w,
|
|
46
47
|
e,
|
|
47
48
|
i,
|
|
48
|
-
p,
|
|
49
49
|
l,
|
|
50
|
+
p,
|
|
50
51
|
L,
|
|
51
|
-
t
|
|
52
|
-
|
|
52
|
+
t,
|
|
53
|
+
r
|
|
54
|
+
]), g(() => {
|
|
53
55
|
const s = () => {
|
|
54
|
-
const
|
|
55
|
-
if (!
|
|
56
|
-
const o = t.get(
|
|
56
|
+
const n = V.parse(window.location.search, { ignoreQueryPrefix: !0 }).view;
|
|
57
|
+
if (!n) return;
|
|
58
|
+
const o = t.get(n);
|
|
57
59
|
o && (e(o), i());
|
|
58
60
|
};
|
|
59
61
|
return window.addEventListener("popstate", s), () => window.removeEventListener("popstate", s);
|
|
60
62
|
}, [w, e, i, t]);
|
|
61
63
|
};
|
|
62
64
|
export {
|
|
63
|
-
|
|
65
|
+
R as useViewUrlChange
|
|
64
66
|
};
|
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 n=require("react"),i=require("qs"),u=require("./index8.cjs"),a=require("./index61.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/index64.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import { useEffect as n } from "react";
|
|
2
|
+
import i from "qs";
|
|
2
3
|
import { useBusinessLogic as a } from "./index8.js";
|
|
3
|
-
import { useStores as
|
|
4
|
-
const
|
|
4
|
+
import { useStores as p } from "./index61.js";
|
|
5
|
+
const d = () => {
|
|
5
6
|
const { SEARCH_FILTER_ID: t } = a(), {
|
|
6
7
|
Filters: {
|
|
7
8
|
initFromUrl: e,
|
|
8
|
-
setFilter:
|
|
9
|
+
setFilter: o
|
|
9
10
|
}
|
|
10
|
-
} =
|
|
11
|
+
} = p();
|
|
11
12
|
n(() => {
|
|
12
|
-
const
|
|
13
|
-
e(),
|
|
13
|
+
const s = i.parse(window.location.search, { ignoreQueryPrefix: !0 })[t];
|
|
14
|
+
e(), s && o(t, s);
|
|
14
15
|
}, [
|
|
15
16
|
t,
|
|
16
17
|
e,
|
|
17
|
-
|
|
18
|
+
o
|
|
18
19
|
]), n(() => {
|
|
19
|
-
const
|
|
20
|
-
return window.addEventListener("popstate",
|
|
20
|
+
const r = () => e();
|
|
21
|
+
return window.addEventListener("popstate", r), () => window.removeEventListener("popstate", r);
|
|
21
22
|
}, [e]);
|
|
22
23
|
};
|
|
23
24
|
export {
|
|
24
|
-
|
|
25
|
+
d as useUrlChange
|
|
25
26
|
};
|
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 n=require("react"),c=require("./index2.cjs"),M=require("qs"),y=require("./index8.cjs"),_=require("./index61.cjs"),k=e=>e&&e.__esModule?e:{default:e},i=k(M),w=()=>{const{SORT_FILTER_ID:e,SORTING_MODE:a}=y.useBusinessLogic(),{Filters:{queryParamsObject:d},Table:{sortParam:o,sortState:t,setSortState:u}}=_.useStores(),g=n.useMemo(()=>{const r={...d};switch(a){case c.SortingMode.CORAL:t.columnId&&(r.sort_order=t.direction,r.sort=t.columnId);break;case c.SortingMode.MONOLITH:default:o&&(r[e]=o)}return i.default.stringify(r,{arrayFormat:"brackets"})},[d,o,a,e,t]),l=n.useCallback(()=>{const r=i.default.parse(window.location.search,{ignoreQueryPrefix:!0});switch(a){case c.SortingMode.CORAL:if(!t.columnId||r.sort_order===t.direction&&r.sort===t.columnId)break;r.sort_order=t.direction,r.sort=t.columnId;break;case c.SortingMode.MONOLITH:default:if(!o)break;if(r[e]===o)return;r[e]=o}const s=i.default.stringify(r,{arrayFormat:"brackets"});s&&window.history.replaceState({},"",`${window.location.pathname}?${s}`)},[a,e,o,t]),f=n.useCallback(()=>{const r=i.default.parse(window.location.search,{ignoreQueryPrefix:!0}),s=r[e],S=r.sort_order,m=r.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("-"),I=b?"desc":"asc",O=b?s.slice(1):s;u({columnId:O,direction:I})}}},[a,e,u]);return n.useEffect(()=>{f()},[f]),n.useEffect(()=>{l()},[t,l]),{queryParams:g,updateCurrentUrlWithTableSort:l}};exports.useUrlParams=w;
|
package/dist/index67.js
CHANGED
|
@@ -1,60 +1,62 @@
|
|
|
1
|
-
import { useMemo as
|
|
2
|
-
import { SortingMode as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { useMemo as h, useCallback as b, useEffect as I } from "react";
|
|
2
|
+
import { SortingMode as c } from "./index2.js";
|
|
3
|
+
import i from "qs";
|
|
4
|
+
import { useBusinessLogic as k } from "./index8.js";
|
|
5
|
+
import { useStores as y } from "./index61.js";
|
|
6
|
+
const _ = () => {
|
|
7
|
+
const { SORT_FILTER_ID: o, SORTING_MODE: a } = k(), {
|
|
8
|
+
Filters: { queryParamsObject: l },
|
|
9
|
+
Table: { sortParam: e, sortState: t, setSortState: n }
|
|
10
|
+
} = y(), O = h(() => {
|
|
11
|
+
const r = { ...l };
|
|
12
|
+
switch (a) {
|
|
13
|
+
case c.CORAL:
|
|
14
|
+
t.columnId && (r.sort_order = t.direction, r.sort = t.columnId);
|
|
14
15
|
break;
|
|
15
|
-
case
|
|
16
|
+
case c.MONOLITH:
|
|
16
17
|
default:
|
|
17
|
-
|
|
18
|
+
e && (r[o] = e);
|
|
18
19
|
}
|
|
19
|
-
return
|
|
20
|
-
}, [
|
|
21
|
-
const
|
|
22
|
-
switch (
|
|
23
|
-
case
|
|
24
|
-
if (!
|
|
20
|
+
return i.stringify(r, { arrayFormat: "brackets" });
|
|
21
|
+
}, [l, e, a, o, t]), u = b(() => {
|
|
22
|
+
const r = i.parse(window.location.search, { ignoreQueryPrefix: !0 });
|
|
23
|
+
switch (a) {
|
|
24
|
+
case c.CORAL:
|
|
25
|
+
if (!t.columnId || r.sort_order === t.direction && r.sort === t.columnId)
|
|
25
26
|
break;
|
|
26
|
-
|
|
27
|
+
r.sort_order = t.direction, r.sort = t.columnId;
|
|
27
28
|
break;
|
|
28
|
-
case
|
|
29
|
+
case c.MONOLITH:
|
|
29
30
|
default:
|
|
30
|
-
if (!
|
|
31
|
-
if (
|
|
32
|
-
|
|
31
|
+
if (!e) break;
|
|
32
|
+
if (r[o] === e) return;
|
|
33
|
+
r[o] = e;
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
const s = i.stringify(r, { arrayFormat: "brackets" });
|
|
36
|
+
s && window.history.replaceState({}, "", `${window.location.pathname}?${s}`);
|
|
37
|
+
}, [a, o, e, t]), d = b(() => {
|
|
38
|
+
const r = i.parse(window.location.search, { ignoreQueryPrefix: !0 }), s = r[o], m = r.sort_order, f = r.sort;
|
|
39
|
+
switch (a) {
|
|
40
|
+
case c.CORAL:
|
|
41
|
+
m && f && n({ columnId: f, direction: m });
|
|
40
42
|
break;
|
|
41
|
-
case
|
|
43
|
+
case c.MONOLITH:
|
|
42
44
|
default: {
|
|
43
|
-
if (!
|
|
44
|
-
const S =
|
|
45
|
-
n({ columnId:
|
|
45
|
+
if (!s) break;
|
|
46
|
+
const S = s.startsWith("-"), p = S ? "desc" : "asc", w = S ? s.slice(1) : s;
|
|
47
|
+
n({ columnId: w, direction: p });
|
|
46
48
|
}
|
|
47
49
|
}
|
|
48
|
-
}, [
|
|
50
|
+
}, [a, o, n]);
|
|
49
51
|
return I(() => {
|
|
50
|
-
|
|
51
|
-
}, [
|
|
52
|
-
|
|
53
|
-
}, [
|
|
54
|
-
queryParams:
|
|
55
|
-
updateCurrentUrlWithTableSort:
|
|
52
|
+
d();
|
|
53
|
+
}, [d]), I(() => {
|
|
54
|
+
u();
|
|
55
|
+
}, [t, u]), {
|
|
56
|
+
queryParams: O,
|
|
57
|
+
updateCurrentUrlWithTableSort: u
|
|
56
58
|
};
|
|
57
59
|
};
|
|
58
60
|
export {
|
|
59
|
-
|
|
61
|
+
_ as useUrlParams
|
|
60
62
|
};
|
package/dist/index68.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var O=Object.defineProperty;var V=(A,t,a)=>t in A?O(A,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):A[t]=a;var g=(A,t,a)=>V(A,typeof t!="symbol"?t+"":t,a);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("mobx"),L=require("@veeqo/ui"),I=require("@internationalized/date"),B=require("lodash/isEqual"),p=require("./index49.cjs"),P=require("./index2.cjs"),w=require("./index70.cjs"),N=require("./index69.cjs"),G=require("./index79.cjs"),q=require("./index77.cjs"),b=require("./index9.cjs"),z=A=>A&&A.__esModule?A:{default:A},C=z(B);class ${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,SORTING_MODE:s}=b.BusinessLogicManager.getBusinessLogic(),e=new URLSearchParams(window.location.search),r=e.get(a),n=e.get("sort_order"),f=e.get("sort");let c="";switch(s){case P.SortingMode.CORAL:if(n&&f){const m=this.queryParamsObject;m.set("sort",f),m.set("sort_order",n),c=`${window.location.pathname}?${m.toString()}`}break;case P.SortingMode.MONOLITH:default:if(r){const m=this.queryParamsObject;m.set(a,r),c=`${window.location.pathname}?${m.toString()}`}}r||(c=`${window.location.pathname}?${this.queryParams}`),t?window.history.pushState({},"",c):window.history.replaceState({},"",c)}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}=b.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}=b.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}=b.BusinessLogicManager.getBusinessLogic(),s=a.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});g(this,"initFiltersFromView",t=>{var s;const{PAGE_SIZE_OPTIONS:a}=b.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,r])=>{const n=new w.RangeFilter(r.filterType);return r.gte&&r.lte&&n.setDates(r.gte,r.lte),[e,n]})),this.defaultNumberRangeFilters=new Map(Array.from(t.filterMaps.numberRangeFilters.entries()).map(([e,r])=>{const n=r.clone();return r.gte&&n.setGte(r.gte),r.lte&&n.setLte(r.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,r])=>{const n=new w.RangeFilter(r.filterType);return r.gte&&r.lte&&n.setDates(r.gte,r.lte),[e,n]})),this.numberRangeFilters=new Map(Array.from(t.filterMaps.numberRangeFilters.entries()).map(([e,r])=>{const n=r.clone();return r.gte&&n.setGte(r.gte),r.lte&&n.setLte(r.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:r,PAGE_SIZE_FILTER_ID:n}=b.BusinessLogicManager.getBusinessLogic(),f=new URLSearchParams(window.location.search),c=Array.from(a.values()).flatMap(i=>i.fields),m=new Map,R=new Map,E=new Map,h=new Map,l=new Map;Array.from(f.entries()).forEach(([i,u])=>{(i.includes("[gte]")||i.includes("[lte]")||i.includes("[relative]"))&&l.set(i,u)}),Array.from(f.entries()).forEach(([i,u])=>{if(i==="view"&&t){this.activeViewId=u;return}if(i===n&&r.includes(Number(u))){this.pageSize=Number(u);return}let y=c.find(F=>F.id===i);const d=i.replace(/\[(gte|lte|relative)\]$/,"");if(y||(s.includes(d)?y=c.find(F=>F.id===d):e.includes(d)&&(y=c.find(F=>F.id===d))),!!y)switch(y.filterType){case p.FilterChoiceValue.CHECKBOX:if(u)if(R.has(i)){const M=R.get(i);M==null||M.push(u)}else R.set(i,[u]);break;case p.FilterChoiceValue.DATE_RANGE:let F;if(q.isValidDateRange(u))F=new w.RangeFilter(u);else{const M=l.get(`${d}[gte]`),D=l.get(`${d}[lte]`);if(M&&D)try{const U=I.parseDate(M),v=I.parseDate(D);F=new w.RangeFilter("CUSTOM"),F.setDates(U,v)}catch{F=new w.RangeFilter(L.DateRanges.TODAY)}else F=new w.RangeFilter(L.DateRanges.TODAY)}E.set(d,F);break;case p.FilterChoiceValue.NUMBER_RANGE:const S=new N.NumberRangeFilter({filterId:y.id}),T=l.get(`${d}[gte]`),_=l.get(`${d}[lte]`);T&&S.setGte(Number(T)),_&&S.setLte(Number(_)),h.set(d,S);break;case p.FilterChoiceValue.TEXT:case p.FilterChoiceValue.NUMBER:case p.FilterChoiceValue.RADIO:m.set(i,u);break}}),this.filters=m,this.arrayFilters=R,this.dateRangeFilters=E,this.numberRangeFilters=h,this.updateUrl()});g(this,"discardChanges",(t=!1)=>{this.pageSize=this.defaultPageSize;const{SEARCH_FILTER_ID:a}=b.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,r)=>{const n=new w.RangeFilter(e.filterType);n.setDates(e.gte,e.lte),this.dateRangeFilters.set(r,n)}),this.numberRangeFilters.clear(),this.defaultNumberRangeFilters.forEach((e,r)=>{this.numberRangeFilters.set(r,e.clone())}),this.updateUrl(t)});const{GROUP_MAP:t}=b.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 w.RangeFilter])),this.numberRangeFilters=new Map(a.filter(s=>s.filterType===p.FilterChoiceValue.NUMBER_RANGE).map(s=>{const e=new N.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}=b.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}=b.BusinessLogicManager.getBusinessLogic(),s=Array.from(this.filters.entries()).filter(([c,m])=>m!==""&&!t.includes(c)&&!a.includes(c)).map(([c])=>c),e=Array.from(this.arrayFilters.entries()).filter(([,c])=>c.length>0).map(([c])=>c),r=Array.from(this.dateRangeFilters.entries()).filter(([,c])=>c.filterType!==void 0).map(([c])=>c),n=Array.from(this.numberRangeFilters.entries()).filter(([,c])=>c.isActive).map(([c])=>c);return[...new Set([...s,...e,...r,...n])]}get queryParamsObject(){const{DATE_RANGE_FILTERS:t,NUMBER_RANGE_FILTERS:a,PAGE_SIZE_FILTER_ID:s,PAGE_NUMBER_FILTER_ID:e}=b.BusinessLogicManager.getBusinessLogic(),r=new URLSearchParams;return Array.from(this.filters.entries()).filter(([n,f])=>f!==""&&!t.includes(n)&&!a.includes(n)).forEach(([n,f])=>{r.append(n,f)}),Array.from(this.arrayFilters.entries()).filter(([,n])=>n.length>0).forEach(([n,f])=>{f.forEach(c=>{r.append(n,c)})}),Array.from(this.dateRangeFilters.entries()).filter(([,n])=>n.filterType!==void 0).forEach(([n,f])=>{f.filterType==="CUSTOM"?(r.set(`${n}[gte]`,f.gte.toString()),r.set(`${n}[lte]`,f.lte.toString())):r.set(`${n}[relative]`,f.filterType)}),Array.from(this.numberRangeFilters.entries()).filter(([,n])=>n.isActive).forEach(([n,f])=>{f.gte!==void 0&&r.set(`${n}[gte]`,f.gte.toString()),f.isValidLte&&r.set(`${n}[lte]`,f.lte.toString())}),this.activeViewId&&r.set("view",this.activeViewId),r.set(s,this.pageSize.toString()),r.set(e,this.currentPage.toString()),r}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}=b.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 i=this.defaultFilters.get(h);return i===void 0&&l!==""||i!==void 0&&l!==i}))return!0;const n=Array.from(this.defaultArrayFilters.entries()).filter(([h])=>e.has(h)).some(([h,l])=>{const i=this.defaultArrayFilters.get(h)||[];return l.length>0||i.length>0?l.length!==i.length||!C.default(l,i):!1}),f=Array.from(this.arrayFilters.entries()).filter(([h])=>e.has(h)).some(([h,l])=>{const i=this.defaultArrayFilters.get(h)||[];return l.length>0||i.length>0?l.length!==i.length||!C.default(l,i):!1});if(n||f)return!0;const c=Array.from(this.numberRangeFilters.entries()).filter(([h])=>e.has(h)).some(([h,l])=>{const i=this.defaultNumberRangeFilters.get(h);return!l.isEqual(i)});if(Array.from(this.defaultNumberRangeFilters.entries()).filter(([h])=>e.has(h)).some(([h,l])=>{const i=this.numberRangeFilters.get(h);return!l.isEqual(i)})||c)return!0;const R=Array.from(this.defaultDateRangeFilters.entries()).filter(([h])=>e.has(h)).some(([h,l])=>{var u,y,d,F;const i=this.dateRangeFilters.get(h);return l!=null&&l.filterType&&!(i!=null&&i.filterType)||i!=null&&i.filterType&&!(l!=null&&l.filterType)||(i==null?void 0:i.filterType)!==(l==null?void 0:l.filterType)?!0:(i==null?void 0:i.filterType)==="CUSTOM"&&(l==null?void 0:l.filterType)==="CUSTOM"?((u=l.gte)==null?void 0:u.toString())!==((y=i.gte)==null?void 0:y.toString())||((d=l.lte)==null?void 0:d.toString())!==((F=i.lte)==null?void 0:F.toString()):!1});return Array.from(this.dateRangeFilters.entries()).filter(([h])=>e.has(h)).some(([h,l])=>{var u,y,d,F;const i=this.defaultDateRangeFilters.get(h);return l!=null&&l.filterType&&!(i!=null&&i.filterType)||i!=null&&i.filterType&&!(l!=null&&l.filterType)||(i==null?void 0:i.filterType)!==(l==null?void 0:l.filterType)?!0:(i==null?void 0:i.filterType)==="CUSTOM"&&(l==null?void 0:l.filterType)==="CUSTOM"?((u=l.gte)==null?void 0:u.toString())!==((y=i.gte)==null?void 0:y.toString())||((d=l.lte)==null?void 0:d.toString())!==((F=i.lte)==null?void 0:F.toString()):!1})||R}}exports.Filters=$;
|
|
1
|
+
"use strict";var I=Object.defineProperty;var N=(y,t,l)=>t in y?I(y,t,{enumerable:!0,configurable:!0,writable:!0,value:l}):y[t]=l;var u=(y,t,l)=>N(y,typeof t!="symbol"?t+"":t,l);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("mobx"),C=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"),v=require("./index2.cjs"),b=require("./index70.cjs"),D=require("./index69.cjs"),G=require("./index79.cjs"),L=require("./index77.cjs"),d=require("./index9.cjs"),T=y=>y&&y.__esModule?y:{default:y},P=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],f=e.sort_order,c=e.sort;let o="";switch(s){case v.SortingMode.CORAL:if(f&&c){const g={...this.queryParamsObject,sort:c,sort_order:f};o=`${window.location.pathname}?${R.default.stringify(g,{arrayFormat:"brackets"})}`}break;case v.SortingMode.MONOLITH:default:if(r){const g={...this.queryParamsObject,[l]:r};o=`${window.location.pathname}?${R.default.stringify(g,{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.updateUrl()});u(this,"clearFilter",t=>{this.filters.set(t,""),this.updateUrl()});u(this,"setArrayFilter",(t,l)=>{this.arrayFilters.set(t,l),this.updateUrl()});u(this,"clearArrayFilter",t=>{this.arrayFilters.set(t,[]),this.updateUrl()});u(this,"setRangeFilter",({key:t,range:l,dates:s})=>{l.setFilterType(t),l.setDates(s.start,s.end),this.updateUrl()});u(this,"clearRangeFilter",t=>{const l=this.dateRangeFilters.get(t);l&&(l.clear(),this.updateUrl())});u(this,"setNumberRangeFilter",({numberRange:t,gte:l,lte:s})=>{t.setGte(l),t.setLte(s),this.updateUrl()});u(this,"clearNumberRangeFilter",t=>{const l=this.numberRangeFilters.get(t);l&&(l.clear(),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()),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.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 f=new b.RangeFilter(r.filterType);return r.gte&&r.lte&&f.setDates(r.gte,r.lte),[e,f]})),this.defaultNumberRangeFilters=new Map(Array.from(t.filterMaps.numberRangeFilters.entries()).map(([e,r])=>{const f=r.clone();return r.gte&&f.setGte(r.gte),r.lte&&f.setLte(r.lte),[e,f]})),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 f=new b.RangeFilter(r.filterType);return r.gte&&r.lte&&f.setDates(r.gte,r.lte),[e,f]})),this.numberRangeFilters=new Map(Array.from(t.filterMaps.numberRangeFilters.entries()).map(([e,r])=>{const f=r.clone();return r.gte&&f.setGte(r.gte),r.lte&&f.setLte(r.lte),[e,f]})),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}),f=Array.from(l.values()).flatMap(n=>n.fields),c=new Map,o=new Map,g=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||{};f.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"&&L.isValidDateRange(i))g.set(n.id,new b.RangeFilter(i));else if(typeof i=="object"&&i!==null){const a=i;if(a.relative&&L.isValidDateRange(a.relative))g.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),g.set(n.id,m)}catch{g.set(n.id,new b.RangeFilter(C.DateRanges.TODAY))}}break;case F.FilterChoiceValue.NUMBER_RANGE:if(typeof i=="object"&&i!==null){const a=i,p=new D.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")&&c.set(n.id,String(i));break}}),this.filters=c,this.arrayFilters=o,this.dateRangeFilters=g,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 f=new b.RangeFilter(e.filterType);f.setDates(e.gte,e.lte),this.dateRangeFilters.set(r,f)}),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 D.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,g])=>g!==""&&!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),f=Array.from(this.numberRangeFilters.entries()).filter(([,o])=>o.isActive).map(([o])=>o);return[...new Set([...s,...e,...r,...f])]}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(([c,o])=>o!==""&&!t.includes(c)&&!l.includes(c)).forEach(([c,o])=>{M.default(r,c,o)}),Array.from(this.arrayFilters.entries()).filter(([,c])=>c.length>0).forEach(([c,o])=>{M.default(r,c,o)}),Array.from(this.dateRangeFilters.entries()).filter(([,c])=>c.filterType!==void 0).forEach(([c,o])=>{o.filterType==="CUSTOM"?M.default(r,c,{gte:o.gte.toString(),lte:o.lte.toString()}):M.default(r,c,{relative:o.filterType})}),Array.from(this.numberRangeFilters.entries()).filter(([,c])=>c.isActive).forEach(([c,o])=>{const g={};o.gte!==void 0&&(g.gte=o.gte),o.isValidLte&&(g.lte=o.lte),M.default(r,c,g)});const f={filter:r,[s]:String(this.pageSize),[e]:String(this.currentPage)};return this.activeViewId&&(f.view=this.activeViewId),f}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 f=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||!P.default(i,a):!1}),c=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||!P.default(i,a):!1});if(f||c)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;
|