@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.
- package/dist/components/Filters/ActiveFilters/Variants/common/ActiveFilterFooter/ActiveFilterFooter.d.ts +6 -0
- package/dist/components/Filters/ActiveFilters/Variants/common/ActiveFilterFooter/index.d.ts +1 -0
- package/dist/components/Filters/ActiveFilters/Variants/common/ActiveFilterHeader/ActiveFilterHeader.d.ts +5 -0
- package/dist/components/Filters/ActiveFilters/Variants/common/ActiveFilterHeader/index.d.ts +1 -0
- package/dist/components/Filters/ActiveFilters/Variants/common/index.d.ts +2 -0
- package/dist/components/Filters/ActiveFilters/Variants/index.d.ts +3 -1
- package/dist/components/Filters/ActiveFilters/index.d.ts +0 -1
- package/dist/components/RefreshButton/RefreshButton.d.ts +2 -1
- package/dist/components/RefreshButton/{usePollListOrders.d.ts → usePollData.d.ts} +1 -1
- package/dist/components/Views/PillNotifications/constants.d.ts +25 -0
- package/dist/components/Views/PillNotifications/variants/DraftPill/DraftPill.d.ts +5 -0
- package/dist/components/Views/PillNotifications/variants/DraftPill/index.d.ts +1 -0
- package/dist/components/Views/PillNotifications/variants/UnsavedChangesPill/UnsavedChangesPill.d.ts +7 -0
- package/dist/components/Views/PillNotifications/variants/UnsavedChangesPill/index.d.ts +1 -0
- package/dist/components/Views/PillNotifications/variants/styled.d.ts +324 -0
- package/dist/components/Views/index.d.ts +1 -1
- package/dist/context/ModalContext/mocks/mockUseModal.d.ts +4 -4
- package/dist/hooks/useViewCountsHook/useViewCountsHook.d.ts +1 -1
- package/dist/hooks/useViews/mocks.d.ts +2 -0
- package/dist/hooks/useViews/useViews.d.ts +1 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +121 -119
- package/dist/index100.cjs +1 -1
- package/dist/index100.js +2 -36
- package/dist/index101.cjs +1 -1
- package/dist/index101.js +36 -19
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +25 -7
- package/dist/index103.cjs +13 -1
- package/dist/index103.js +16 -63
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +18 -29
- package/dist/index105.cjs +1 -1
- package/dist/index105.js +8 -63
- package/dist/index106.cjs +1 -13
- package/dist/index106.js +63 -16
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +30 -42
- package/dist/index108.cjs +1 -7
- package/dist/index108.js +63 -10
- package/dist/index109.cjs +1 -0
- package/dist/index109.js +49 -0
- package/dist/index11.cjs +1 -1
- package/dist/index11.js +1 -1
- package/dist/index110.cjs +7 -0
- package/dist/index110.js +12 -0
- package/dist/index111.cjs +1 -0
- package/dist/index111.js +44 -0
- package/dist/index12.cjs +1 -1
- package/dist/index12.js +1 -1
- package/dist/index13.cjs +1 -1
- package/dist/index13.js +14 -14
- package/dist/index14.cjs +1 -1
- package/dist/index14.js +36 -41
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +33 -37
- package/dist/index16.cjs +1 -1
- package/dist/index16.js +49 -32
- package/dist/index17.cjs +1 -1
- package/dist/index17.js +38 -48
- package/dist/index18.cjs +1 -1
- package/dist/index18.js +27 -28
- package/dist/index19.cjs +1 -1
- package/dist/index19.js +37 -38
- package/dist/index2.cjs +1 -1
- package/dist/index2.js +2 -2
- package/dist/index20.cjs +1 -1
- package/dist/index20.js +36 -37
- package/dist/index21.cjs +1 -1
- package/dist/index21.js +20 -21
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +7 -46
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +12 -61
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +36 -35
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +55 -34
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +34 -52
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +54 -51
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +50 -81
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +80 -33
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +2 -2
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +37 -33
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +33 -10
- package/dist/index32.cjs +1 -1
- package/dist/index32.js +10 -40
- package/dist/index33.cjs +1 -1
- package/dist/index33.js +39 -102
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +103 -19
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +17 -135
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +135 -49
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +51 -50
- package/dist/index38.cjs +1 -1
- package/dist/index38.js +31 -49
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +48 -71
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +2 -2
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +58 -79
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +81 -41
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +48 -5
- package/dist/index43.cjs +1 -1
- package/dist/index43.js +5 -42
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +42 -25
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +30 -19
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +19 -8
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +7 -22
- package/dist/index48.cjs +1 -1
- package/dist/index48.js +23 -2
- package/dist/index49.cjs +1 -1
- package/dist/index49.js +2 -4
- package/dist/index5.cjs +1 -1
- package/dist/index5.js +2 -2
- package/dist/index50.cjs +1 -1
- package/dist/index50.js +4 -11
- package/dist/index51.cjs +1 -1
- package/dist/index51.js +10 -12
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +12 -11
- package/dist/index53.cjs +1 -1
- package/dist/index53.js +11 -184
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +183 -25
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +26 -24
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +19 -22
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +25 -90
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +93 -8
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +8 -51
- package/dist/index6.cjs +1 -1
- package/dist/index6.js +4 -4
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +50 -60
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +61 -18
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +16 -23
- package/dist/index63.cjs +1 -1
- package/dist/index63.js +25 -315
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +311 -55
- package/dist/index65.cjs +1 -1
- package/dist/index65.js +50 -47
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +51 -32
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +30 -24
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +32 -4
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +4 -9
- package/dist/index70.cjs +1 -1
- package/dist/index70.js +9 -17
- package/dist/index71.cjs +1 -1
- package/dist/index71.js +14 -16
- package/dist/index72.cjs +1 -1
- package/dist/index72.js +18 -47
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +48 -21
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +21 -2
- package/dist/index75.cjs +1 -1
- package/dist/index75.js +2 -9
- package/dist/index76.cjs +1 -3
- package/dist/index76.js +8 -13
- package/dist/index77.cjs +3 -1
- package/dist/index77.js +13 -8
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +7 -141
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +142 -18
- package/dist/index80.cjs +1 -8
- package/dist/index80.js +19 -12
- package/dist/index81.cjs +8 -1
- package/dist/index81.js +12 -41
- package/dist/index82.cjs +1 -1
- package/dist/index82.js +40 -8
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +9 -18
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +31 -13
- package/dist/index85.cjs +1 -104
- package/dist/index85.js +27 -118
- package/dist/index86.cjs +1 -1
- package/dist/index86.js +14 -67
- package/dist/index87.cjs +19 -1
- package/dist/index87.js +24 -29
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +21 -2
- package/dist/index89.cjs +12 -1
- package/dist/index89.js +16 -41
- package/dist/index90.cjs +80 -1
- package/dist/index90.js +103 -11
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +13 -24
- package/dist/index92.cjs +100 -15
- package/dist/index92.js +115 -19
- package/dist/index93.cjs +1 -1
- package/dist/index93.js +65 -30
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +29 -29
- package/dist/index95.cjs +1 -1
- package/dist/index95.js +2 -22
- package/dist/index96.cjs +1 -80
- package/dist/index96.js +41 -96
- package/dist/index97.cjs +1 -12
- package/dist/index97.js +11 -16
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +17 -14
- package/dist/index99.cjs +1 -1
- package/dist/index99.js +24 -2
- package/dist/mobx/Filters/tests/Filters.arrayFilters.test.d.ts +1 -0
- package/dist/mobx/Filters/tests/Filters.clearOperations.test.d.ts +1 -0
- package/dist/mobx/Filters/tests/Filters.dateRangeFilters.test.d.ts +1 -0
- package/dist/mobx/Filters/tests/Filters.hasUnsavedChanges.test.d.ts +1 -0
- package/dist/mobx/Filters/tests/Filters.numberRangeFilters.test.d.ts +1 -0
- package/dist/mobx/Filters/tests/Filters.pagination.test.d.ts +1 -0
- package/dist/mobx/Filters/tests/Filters.textFilters.test.d.ts +1 -0
- package/dist/mobx/Filters/tests/Filters.urlHandling.test.d.ts +1 -0
- package/dist/mobx/Filters/tests/Filters.views.test.d.ts +1 -0
- package/dist/mobx/Notifications/Notifications.d.ts +7 -8
- package/dist/mobx/Notifications/Notifications.test.d.ts +1 -0
- package/dist/mobx/Notifications/index.d.ts +1 -0
- package/dist/mobx/NumberRangeFilter/NumberRangeFilter.test.d.ts +1 -0
- package/dist/mobx/RangeFilter/RangeFilter.test.d.ts +1 -0
- package/dist/mobx/Views/Views.test.d.ts +1 -0
- package/package.json +1 -1
- package/dist/components/Views/PillNotifications/InfoPill.d.ts +0 -1
- package/dist/components/Views/PillNotifications/styled.d.ts +0 -34
- package/dist/components/Views/UnsavedChanges/UnsavedChanges.d.ts +0 -5
- package/dist/components/Views/UnsavedChanges/index.d.ts +0 -1
- /package/dist/components/Filters/ActiveFilters/{ActiveFilterTag → Variants/ActiveFilterTag}/ActiveFilterTag.d.ts +0 -0
- /package/dist/components/Filters/ActiveFilters/{ActiveFilterTag → Variants/ActiveFilterTag}/index.d.ts +0 -0
package/dist/index55.js
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
28
|
+
d as useDuplicateActiveView
|
|
27
29
|
};
|
package/dist/index56.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 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
|
|
2
|
-
import { getAsyncOptions as m } from "./
|
|
3
|
-
import { getFetcherFunction as
|
|
4
|
-
import
|
|
5
|
-
import { useStores as
|
|
6
|
-
const
|
|
7
|
-
var
|
|
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: {
|
|
10
|
-
} =
|
|
11
|
-
(
|
|
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
|
|
14
|
-
return
|
|
15
|
-
fetcherName: (
|
|
16
|
-
})(
|
|
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:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
26
|
+
a as useFilterArrayLabel
|
|
30
27
|
};
|
package/dist/index57.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 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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
29
|
+
b as useFilterLabel
|
|
95
30
|
};
|
package/dist/index58.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 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 {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
95
|
+
x as usePersistUnsavedChanges
|
|
11
96
|
};
|
package/dist/index59.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 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
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
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("./
|
|
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 "./
|
|
3
|
-
import { filterOptionalArgsGetDelete as y, filterOptionalArgs as p } from "./
|
|
4
|
-
import { filterErrorStack as i } from "./
|
|
5
|
-
import { injectIntoError as E } from "./
|
|
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
|
|
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
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
53
|
+
B as useViews
|
|
64
54
|
};
|
package/dist/index61.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 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;
|