@veeqo/transfigure 1.2.4 → 1.2.6
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/index.cjs +1 -1
- package/dist/index.js +158 -157
- package/dist/index100.cjs +11 -18
- package/dist/index100.js +12 -20
- package/dist/index101.cjs +1 -1
- package/dist/index101.js +37 -14
- package/dist/index102.cjs +1 -1
- package/dist/index102.js +29 -21
- package/dist/index103.cjs +19 -1
- package/dist/index103.js +24 -38
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +21 -29
- package/dist/index105.cjs +1 -12
- package/dist/index105.js +15 -16
- package/dist/index106.cjs +1 -80
- package/dist/index106.js +24 -101
- package/dist/index107.cjs +80 -1
- package/dist/index107.js +101 -19
- package/dist/index108.cjs +1 -1
- package/dist/index108.js +18 -7
- package/dist/index109.cjs +1 -1
- package/dist/index109.js +7 -63
- package/dist/index110.cjs +1 -1
- package/dist/index110.js +60 -26
- package/dist/index111.cjs +1 -1
- package/dist/index111.js +30 -2
- package/dist/index113.cjs +1 -1
- package/dist/index113.js +2 -36
- package/dist/index114.cjs +1 -1
- package/dist/index114.js +32 -22
- package/dist/index115.cjs +1 -1
- package/dist/index115.js +25 -62
- package/dist/index116.cjs +1 -7
- package/dist/index116.js +63 -10
- package/dist/index118.cjs +7 -0
- package/dist/index118.js +12 -0
- package/dist/index2.cjs +1 -1
- package/dist/index2.js +3 -2
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +1 -1
- package/dist/index31.cjs +1 -1
- package/dist/index31.js +1 -1
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +1 -1
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +39 -38
- 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/index41.cjs +1 -1
- package/dist/index41.js +1 -1
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +1 -1
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +1 -1
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +2 -2
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +2 -2
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +114 -114
- package/dist/index78.cjs +1 -1
- package/dist/index78.js +22 -19
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +7 -5
- package/dist/index80.cjs +1 -1
- package/dist/index80.js +1 -1
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +1 -1
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +1 -1
- package/dist/index87.cjs +1 -1
- package/dist/index87.js +116 -39
- package/dist/index88.cjs +1 -1
- package/dist/index88.js +19 -9
- package/dist/index89.cjs +1 -1
- package/dist/index89.js +39 -116
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +9 -19
- package/dist/index91.cjs +1 -1
- package/dist/index91.js +13 -7
- package/dist/index92.cjs +104 -1
- package/dist/index92.js +120 -13
- package/dist/index93.cjs +1 -104
- package/dist/index93.js +65 -117
- package/dist/index94.cjs +1 -1
- package/dist/index94.js +24 -63
- package/dist/index95.cjs +1 -1
- package/dist/index95.js +2 -29
- package/dist/index96.cjs +1 -1
- package/dist/index96.js +41 -2
- package/dist/index97.cjs +1 -1
- package/dist/index97.js +9 -39
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +17 -10
- package/dist/index99.cjs +1 -1
- package/dist/index99.js +6 -23
- package/dist/storybookHelpers/apiMocks/views/custom_views.d.ts +7 -0
- package/dist/types.d.ts +14 -0
- package/dist/utils/getViewTheme/getViewTheme.d.ts +21 -0
- package/dist/utils/getViewTheme/getViewTheme.test.d.ts +1 -0
- package/dist/utils/getViewTheme/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index36.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { ViewTab as
|
|
1
|
+
import { jsxs as H, Fragment as U, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useState as $, useRef as z, useMemo as S } from "react";
|
|
3
|
+
import { ViewTab as G, Loader as J, theme as K } from "@veeqo/ui";
|
|
4
4
|
import { observer as Q } from "mobx-react";
|
|
5
5
|
import { useCustomViews as X } from "./index65.js";
|
|
6
6
|
import { useViews as Z } from "./index62.js";
|
|
7
7
|
import { PillNotifications as b } from "./index40.js";
|
|
8
8
|
import { ViewDropdowns as ee } from "./index43.js";
|
|
9
9
|
import { useDropdownManager as oe } from "./index56.js";
|
|
10
|
-
import { useViewCounts as ie } from "./
|
|
10
|
+
import { useViewCounts as ie } from "./index101.js";
|
|
11
11
|
import { useBusinessLogic as te } from "./index8.js";
|
|
12
12
|
import { useStores as re } from "./index61.js";
|
|
13
|
-
import { Confirmation as se } from "./
|
|
13
|
+
import { Confirmation as se } from "./index102.js";
|
|
14
14
|
const ve = Q(({ view: e }) => {
|
|
15
|
-
const { VIEW_TYPE:
|
|
16
|
-
Filters: { activeViewId: d, initFiltersFromView: f, discardChanges: m, initFromUrl: u, filters:
|
|
17
|
-
Views: { draftViewsMap:
|
|
18
|
-
Notifications: { notify:
|
|
19
|
-
} = re(), { viewsMap: w, defaultCustomViewId:
|
|
20
|
-
const
|
|
15
|
+
const { VIEW_TYPE: L, IS_VIEWS_READONLY: n, SEARCH_FILTER_ID: c } = te(), {
|
|
16
|
+
Filters: { activeViewId: d, initFiltersFromView: f, discardChanges: m, initFromUrl: u, filters: T, setFilter: x },
|
|
17
|
+
Views: { draftViewsMap: E },
|
|
18
|
+
Notifications: { notify: F }
|
|
19
|
+
} = re(), { viewsMap: w, defaultCustomViewId: y, isLoading: N } = Z(), { isLoading: A } = X({ type: L }), { viewCounts: I, isLoadingViewCounts: R } = ie(), [i, _] = $(null), k = (o) => {
|
|
20
|
+
const D = T.get(c);
|
|
21
21
|
if (w.has(o)) {
|
|
22
22
|
const r = w.get(o);
|
|
23
23
|
r && (f(r), m(!0), u());
|
|
24
24
|
} else {
|
|
25
|
-
const r =
|
|
26
|
-
r ? (f(r), m(!0), u()) :
|
|
25
|
+
const r = E.get(o);
|
|
26
|
+
r ? (f(r), m(!0), u()) : F({
|
|
27
27
|
type: "error",
|
|
28
28
|
text: "Failed to load view"
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
}, a = (e == null ? void 0 : e.id) === d, t = e.originalView !== void 0, p = e.originalView === void 0,
|
|
33
|
-
!
|
|
31
|
+
D && x(c, D);
|
|
32
|
+
}, a = (e == null ? void 0 : e.id) === d, t = e.originalView !== void 0, p = e.originalView === void 0, M = I, l = (e == null ? void 0 : e.label) || "", P = N || A, V = z(!1);
|
|
33
|
+
!P && !V.current && a && e.id === y && i && (V.current = !0, i && d === e.id && window.requestAnimationFrame(() => {
|
|
34
34
|
var o;
|
|
35
35
|
(o = i.parentElement) == null || o.scrollBy({
|
|
36
36
|
behavior: "smooth",
|
|
@@ -39,44 +39,45 @@ const ve = Q(({ view: e }) => {
|
|
|
39
39
|
}));
|
|
40
40
|
const h = S(() => t ? "draft" : e.editable ? "saved" : "fixed", [t, e.editable]), {
|
|
41
41
|
actions: {
|
|
42
|
-
create: { handleSaveDraft:
|
|
42
|
+
create: { handleSaveDraft: j },
|
|
43
43
|
menu: { toggleDropdown: g },
|
|
44
|
-
delete: { closeDeleteConfirmation:
|
|
44
|
+
delete: { closeDeleteConfirmation: B, handleDelete: O, handleDeleteDraftView: v }
|
|
45
45
|
},
|
|
46
|
-
state: { shouldShowDeleteConfirmation:
|
|
47
|
-
actions:
|
|
48
|
-
state:
|
|
49
|
-
} = oe(e),
|
|
46
|
+
state: { shouldShowDeleteConfirmation: W },
|
|
47
|
+
actions: Y,
|
|
48
|
+
state: C
|
|
49
|
+
} = oe(e), q = S(() => {
|
|
50
50
|
if (!n) {
|
|
51
51
|
if (p) return g;
|
|
52
52
|
if (t) return v;
|
|
53
53
|
}
|
|
54
54
|
}, [v, t, p, g, n]);
|
|
55
|
-
return /* @__PURE__ */ U
|
|
55
|
+
return /* @__PURE__ */ H(U, { children: [
|
|
56
56
|
/* @__PURE__ */ s(
|
|
57
|
-
|
|
57
|
+
G,
|
|
58
58
|
{
|
|
59
|
-
|
|
59
|
+
customTextColour: e.customTextColour,
|
|
60
|
+
colourPalette: e.colourPalette,
|
|
60
61
|
className: "act-react-listing-custom-view",
|
|
61
62
|
active: a,
|
|
62
63
|
id: e == null ? void 0 : e.id,
|
|
63
64
|
name: l,
|
|
64
65
|
type: n ? void 0 : h,
|
|
65
|
-
count:
|
|
66
|
-
|
|
66
|
+
count: R ? /* @__PURE__ */ s(
|
|
67
|
+
J,
|
|
67
68
|
{
|
|
68
69
|
type: "ThreeDots",
|
|
69
70
|
width: 12,
|
|
70
71
|
height: 12,
|
|
71
|
-
color: a ? "#fff" :
|
|
72
|
+
color: a ? "#fff" : K.colors.neutral.ink.dark
|
|
72
73
|
}
|
|
73
|
-
) :
|
|
74
|
-
onClick:
|
|
75
|
-
subAction:
|
|
74
|
+
) : M,
|
|
75
|
+
onClick: k,
|
|
76
|
+
subAction: q,
|
|
76
77
|
ariaContext: "orders",
|
|
77
|
-
ref:
|
|
78
|
+
ref: _,
|
|
78
79
|
"aria-controls": "options-dropdown",
|
|
79
|
-
"aria-expanded":
|
|
80
|
+
"aria-expanded": C.shouldShowDropdown,
|
|
80
81
|
"aria-haspopup": "dialog"
|
|
81
82
|
},
|
|
82
83
|
e == null ? void 0 : e.id
|
|
@@ -84,10 +85,10 @@ const ve = Q(({ view: e }) => {
|
|
|
84
85
|
/* @__PURE__ */ s(
|
|
85
86
|
se,
|
|
86
87
|
{
|
|
87
|
-
shouldShow:
|
|
88
|
+
shouldShow: W,
|
|
88
89
|
viewName: l,
|
|
89
|
-
onCancel:
|
|
90
|
-
onDelete:
|
|
90
|
+
onCancel: B,
|
|
91
|
+
onDelete: O
|
|
91
92
|
}
|
|
92
93
|
),
|
|
93
94
|
/* @__PURE__ */ s(
|
|
@@ -97,10 +98,10 @@ const ve = Q(({ view: e }) => {
|
|
|
97
98
|
isActive: a,
|
|
98
99
|
initialViewName: l,
|
|
99
100
|
shouldShowCreateViewNotification: t,
|
|
100
|
-
handleSaveDraft:
|
|
101
|
+
handleSaveDraft: j
|
|
101
102
|
}
|
|
102
103
|
),
|
|
103
|
-
!n && /* @__PURE__ */ s(ee, { referenceElement: i, tab: e, ...
|
|
104
|
+
!n && /* @__PURE__ */ s(ee, { referenceElement: i, tab: e, ...Y, ...C })
|
|
104
105
|
] });
|
|
105
106
|
});
|
|
106
107
|
export {
|
package/dist/index39.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index103.cjs"),g=require("./index52.cjs"),j=require("./index51.cjs"),M=({tab:i,onMakeDefault:l,onEdit:n,onDuplicate:s,onDelete:o,shouldShowDropdown:a,handleCloseDropdown:c})=>{const{openModal:r}=g.useModal(),d=()=>{r(j.ModalId.ORDERS_TABLE_MANAGEMENT),c()},m=i.label!=="Picking In Progress"&&i.editable,u=i.default!==!1&&i.editable,p=i.editable,b=i.editable;return a?e.jsxs(t.MenuItems,{children:[u&&e.jsx(t.Item,{onClick:l,className:"act-react-listing-custom-view-make-default-menu-item",children:"Make default view"}),b&&e.jsx(t.Item,{onClick:n,className:"act-react-listing-custom-view-edit-menu-item",role:"option",children:"Edit"}),e.jsx(t.Item,{onClick:s,className:"act-react-listing-custom-view-duplicate-menu-item",role:"option",children:"Duplicate"}),m&&e.jsx(t.Item,{onClick:o,className:"act-react-listing-custom-view-delete-menu-item",role:"option",children:"Delete"}),p&&e.jsxs(e.Fragment,{children:[e.jsx(t.Divider,{}),e.jsx(t.Item,{onClick:d,role:"option",children:"Table management"})]})]}):null};exports.OptionsDropdown=M;
|
package/dist/index39.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs as t, jsx as i, Fragment as f } from "react/jsx-runtime";
|
|
2
|
-
import { MenuItems as M, Item as l, Divider as h } from "./
|
|
2
|
+
import { MenuItems as M, Item as l, Divider as h } from "./index103.js";
|
|
3
3
|
import { useModal as k } from "./index52.js";
|
|
4
4
|
import { ModalId as T } from "./index51.js";
|
|
5
5
|
const N = ({
|
package/dist/index40.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),P=require("mobx-react"),g=require("./index62.cjs"),o=require("framer-motion"),m=require("./index61.cjs"),v=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),P=require("mobx-react"),g=require("./index62.cjs"),o=require("framer-motion"),m=require("./index61.cjs"),v=require("./index104.cjs"),f=require("./index42.cjs"),h=P.observer(({tabType:s,isActive:r,shouldShowCreateViewNotification:a,handleSaveDraft:i})=>{var t;const{Filters:{hasUnsavedChanges:c,discardChanges:l,activeViewId:n}}=m.useStores(),{viewsMap:u}=g.useViews(),d=n&&((t=u.get(n))==null?void 0:t.label);return e.jsxs(e.Fragment,{children:[e.jsx(o.AnimatePresence,{children:s==="draft"&&r&&a&&e.jsx(v.DraftPill,{onClick:i})}),e.jsx(o.AnimatePresence,{children:c&&r&&s==="saved"&&e.jsx(f.UnsavedChangesPill,{viewName:d,onDiscard:()=>l(),onSaveDraft:i})})]})});exports.PillNotifications=h;
|
package/dist/index40.js
CHANGED
|
@@ -3,7 +3,7 @@ import { observer as h } from "mobx-react";
|
|
|
3
3
|
import { useViews as v } from "./index62.js";
|
|
4
4
|
import { AnimatePresence as n } from "framer-motion";
|
|
5
5
|
import { useStores as g } from "./index61.js";
|
|
6
|
-
import { DraftPill as w } from "./
|
|
6
|
+
import { DraftPill as w } from "./index104.js";
|
|
7
7
|
import { UnsavedChangesPill as C } from "./index42.js";
|
|
8
8
|
const U = h(
|
|
9
9
|
({
|
package/dist/index41.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),n=require("react"),m=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),n=require("react"),m=require("./index105.cjs"),g=require("./index65.cjs"),S=require("./index62.cjs"),b=require("./index4.cjs"),y=require("./index8.cjs"),V=require("./index61.cjs"),p=require("./index12.cjs"),q=()=>{const{VIEW_TYPE:u}=y.useBusinessLogic(),{sortedCustomViews:s,isLoading:a}=S.useViews(),{mutate:c}=g.useCustomViews({type:u}),[l,t]=n.useState(s);n.useEffect(()=>{t(s)},[s]);const{Notifications:{notify:w}}=V.useStores(),d=async o=>{t(o);const r=o.map(e=>e.id);try{await b.patchCurrentUser({user_setting_attributes:{custom_view_positions:{order:r}}}),await c(e=>({...e,settings:{...e.settings,custom_view_positions:{...e.settings.custom_view_positions,order:r}}}),{revalidate:!1})}catch{t(s),w({type:"error",text:"Failed to update order of views"})}};return a||!s.length?null:i.jsx(p.ErrorBoundary,{children:i.jsx(m.LegacySortableViews,{views:l,onChange:d,className:"act-sortable-views"})})};exports.SortableViews=q;
|
package/dist/index41.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useState as f, useEffect as l } from "react";
|
|
3
|
-
import { LegacySortableViews as w } from "./
|
|
3
|
+
import { LegacySortableViews as w } from "./index105.js";
|
|
4
4
|
import { useCustomViews as d } from "./index65.js";
|
|
5
5
|
import { useViews as g } from "./index62.js";
|
|
6
6
|
import { patchCurrentUser as _ } from "./index4.js";
|
package/dist/index42.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("@veeqo/ui"),c=require("mobx-react"),l=require("./index60.cjs"),n=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("@veeqo/ui"),c=require("mobx-react"),l=require("./index60.cjs"),n=require("./index107.cjs"),d=i.theme.colors.secondary.blue.base,h=c.observer(({onDiscard:r,viewName:s,onSaveDraft:a})=>{const{saveChanges:o,isSubmitting:t}=l.usePersistUnsavedChanges();return e.jsx(n.Notification,{children:e.jsx(n.Container,{children:e.jsxs(i.Stack,{direction:"horizontal",alignY:"center",children:[e.jsx(n.Glyph,{ariaLabel:"attention",name:"attention",color:d}),e.jsxs(n.Wrap,{children:[e.jsx(n.Text,{variant:"body",margin:"0 4px 0 0",children:"You have unsaved changes to"}),s&&e.jsxs(n.Bold,{variant:"bodyBoldDark",children:["'",s,"'"]})]}),e.jsx(i.Button,{onClick:r,size:"sm",children:"Discard changes"}),e.jsxs(i.ActionMenu,{ctaProps:{children:"Save changes",variant:"primary"},children:[e.jsx(i.ActionMenu.Item,{onAction:a,isDisabled:t,children:e.jsx(n.Text,{variant:"body",children:"Create new view"})}),e.jsx(i.ActionMenu.Item,{onAction:o,isDisabled:t,children:e.jsxs(i.Stack,{direction:"horizontal",spacing:1,alignY:"center",children:[e.jsx(n.Text,{variant:"body",children:"Save changes to"}),e.jsx(n.Text,{variant:"bodyBold",children:s})]})})]})]})})})});exports.UnsavedChangesPill=h;
|
package/dist/index42.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as n, jsxs as e } from "react/jsx-runtime";
|
|
|
2
2
|
import { Stack as t, theme as d, Button as h, ActionMenu as o } from "@veeqo/ui";
|
|
3
3
|
import { observer as m } from "mobx-react";
|
|
4
4
|
import { usePersistUnsavedChanges as v } from "./index60.js";
|
|
5
|
-
import { Notification as b, Container as g, Glyph as p, Wrap as u, Text as i, Bold as y } from "./
|
|
5
|
+
import { Notification as b, Container as g, Glyph as p, Wrap as u, Text as i, Bold as y } from "./index107.js";
|
|
6
6
|
const C = d.colors.secondary.blue.base, k = m(({
|
|
7
7
|
onDiscard: c,
|
|
8
8
|
viewName: r,
|
package/dist/index44.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),S=require("mobx-react"),i=require("@veeqo/ui"),u=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),S=require("mobx-react"),i=require("@veeqo/ui"),u=require("./index100.cjs"),m=require("./index41.cjs"),q=require("./index62.cjs"),f=require("./index63.cjs"),p=require("./index37.cjs"),c=require("./index36.cjs"),v=require("./index8.cjs"),b=require("./index61.cjs"),a=require("./index12.cjs"),C=S.observer(({className:l})=>{const{IS_VIEWS_READONLY:r}=v.useBusinessLogic(),{Views:{draftViewsList:d}}=b.useStores(),{viewsArray:w,fixedViews:x}=q.useViews(),[n,o]=t.useState(!1),[V,h]=t.useState(null),j=()=>o(!1);return f.useViewUrlChange(),e.jsxs(e.Fragment,{children:[e.jsxs(i.ViewsContainer,{onClickMenu:r?void 0:()=>o(!0),ariaMenuControls:r?void 0:"views-menu",ariaMenuExpanded:r?!1:n,ref:h,className:l,children:[w.map(s=>e.jsx(a.ErrorBoundary,{children:e.jsx(c.ViewTab,{view:s})},s.id)),d.map(s=>e.jsx(a.ErrorBoundary,{children:e.jsx(c.ViewTab,{view:s})},s.id))]}),!r&&n&&e.jsx(i.Popover,{id:"views-menu",anchorElement:V,placement:"bottom",onShouldClose:()=>o(!1),children:e.jsxs(i.Card.Surface,{children:[e.jsx(u.FixedViews,{children:x.map(s=>e.jsx(i.Text,{variant:"placeholder",children:s.label},s.id||s.label))}),e.jsx(m.SortableViews,{}),e.jsx(u.Divider,{}),e.jsx(p.CreateView,{hideActionsPopover:j})]})})]})});exports.ViewList=C;
|
package/dist/index44.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsxs as s, Fragment as w, jsx as e } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState as n } from "react";
|
|
3
3
|
import { observer as V } from "mobx-react";
|
|
4
4
|
import { ViewsContainer as v, Popover as S, Card as x, Text as C } from "@veeqo/ui";
|
|
5
|
-
import { FixedViews as L, Divider as A } from "./
|
|
5
|
+
import { FixedViews as L, Divider as A } from "./index100.js";
|
|
6
6
|
import { SortableViews as E } from "./index41.js";
|
|
7
7
|
import { useViews as b } from "./index62.js";
|
|
8
8
|
import { useViewUrlChange as M } from "./index63.js";
|
package/dist/index46.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),N=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),N=require("./index87.cjs"),b=require("@veeqo/ui"),_=require("./index88.cjs"),j=require("mobx-react"),y=require("./index8.cjs"),B=require("./index52.cjs"),I=require("./index61.cjs"),O=require("./index62.cjs"),g=require("./index51.cjs"),w=j.observer(({columnDefinitions:T,pinnedRightColumnIds:i=[],pinnedLeftColumnIds:a=[]})=>{var M;const{DEFAULT_HIDDEN_COLUMNS:E,DEFAULT_VISIBLE_COLUMNS:p}=y.useBusinessLogic(),t=[...a,...i],l=E.filter(s=>!t.includes(s)),c=p.filter(s=>!t.includes(s)),S=[...l,...c],{closeModal:h,isModalOpen:q,openModal:A}=B.useModal(),{Filters:{activeViewId:n},Views:{draftViewsMap:f}}=I.useStores(),{viewsMap:x,isLoading:D}=O.useViews();if(!n||D)return null;const e=x.get(n),r=Array.isArray((M=e==null?void 0:e.columns)==null?void 0:M.columnIds),u=r?e.columns.columnIds.filter(s=>!t.includes(s)):c,L=r?S.filter(s=>!u.includes(s)):l,d=f.has(n),m=!(e!=null&&e.editable),v=m||d,C=d?"Please create a view to use table management":m?"Please choose a custom view to use table management":"Table management";return o.jsxs(o.Fragment,{children:[o.jsx(b.Tooltip,{text:C,children:o.jsx(b.Button,{"aria-label":"Open table management",onClick:()=>A(g.ModalId.ORDERS_TABLE_MANAGEMENT),size:"sm",iconSlot:o.jsx(_.TableManagementGlyph,{}),disabled:v})}),q(g.ModalId.ORDERS_TABLE_MANAGEMENT)&&o.jsx(N.TableManagementModal,{pinnedRightColumnIds:i,pinnedLeftColumnIds:a,visibleColumns:u,hiddenColumns:L,columnDefinitions:T,onClose:h})]})});exports.TableManagement=w;
|
package/dist/index46.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as v, Fragment as B, jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import { TableManagementModal as O } from "./
|
|
2
|
+
import { TableManagementModal as O } from "./index87.js";
|
|
3
3
|
import { Tooltip as w, Button as x } from "@veeqo/ui";
|
|
4
|
-
import { TableManagementGlyph as F } from "./
|
|
4
|
+
import { TableManagementGlyph as F } from "./index88.js";
|
|
5
5
|
import { observer as I } from "mobx-react";
|
|
6
6
|
import { useBusinessLogic as y } from "./index8.js";
|
|
7
7
|
import { useModal as P } from "./index52.js";
|
package/dist/index47.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),h=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),h=require("./index89.cjs"),e=require("@veeqo/ui"),o=require("./index90.cjs"),d=require("./index61.cjs"),m=({isLoading:a,refetch:n,trackMetricClick:s,tooltipText:l="Refresh data",buttonProps:i={size:"sm",variant:"default"}})=>{const{hasChanges:r,acknowledgeButtonClick:u}=h.usePollData(),{Notifications:{notify:c}}=d.useStores(),f=async()=>{try{await n(),await u(),s==null||s()}catch{c({type:"error",text:"Failed to refresh data"})}};return t.jsxs(e.Tooltip,{className:o.default.refreshTooltip,text:l,children:[t.jsx(e.Button,{className:o.default.refreshButton,onClick:f,loading:a,disabled:a,iconSlot:t.jsx(e.RefreshIcon,{color:e.theme.colors.neutral.ink.base}),"aria-label":r?"refresh table with changes":"refresh table","aria-live":"polite",...i}),t.jsx(e.Indicator,{className:o.default.refreshIndicator,color:"red",size:"xs",style:{opacity:r?1:0}})]})};exports.RefreshButton=m;
|
package/dist/index47.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as m, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { usePollData as c } from "./
|
|
2
|
+
import { usePollData as c } from "./index89.js";
|
|
3
3
|
import { Tooltip as d, Button as p, RefreshIcon as u, theme as y, Indicator as x } from "@veeqo/ui";
|
|
4
|
-
import t from "./
|
|
4
|
+
import t from "./index90.js";
|
|
5
5
|
import { useStores as b } from "./index61.js";
|
|
6
6
|
const j = ({
|
|
7
7
|
isLoading: s,
|
package/dist/index68.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;
|