@pivotfinancialtechnologies/admin-frontend-blueprint-template 0.0.3-dev.10 → 0.0.3-dev.11
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/README.md +6 -1
- package/dist/PermissionVisibility-DWlTcq5R.js +24 -0
- package/dist/PermissionVisibility-DcNQuqAD.cjs +1 -0
- package/dist/SettingsSectionBase-S_Y2d_vs.js +475 -0
- package/dist/SettingsSectionBase-Yx14wvkV.cjs +1 -0
- package/dist/TopBarNavLayout-BkDwDvQf.js +62 -0
- package/dist/TopBarNavLayout-DGP6BWzi.cjs +1 -0
- package/dist/admin-frontend-blueprint-template.css +1 -1
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/date-DxdnAP5U.js +13 -0
- package/dist/date-RB_2ERsI.cjs +1 -0
- package/dist/formatters.cjs +1 -1
- package/dist/formatters.js +1 -1
- package/dist/hooks.cjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +4 -4
- package/dist/layout.cjs +1 -1
- package/dist/layout.js +1 -1
- package/dist/security.cjs +1 -1
- package/dist/security.js +1 -1
- package/dist/useSize-BLbsGFVL.cjs +1 -0
- package/dist/useUrlForm-CxnAS6tK.cjs +1 -0
- package/package.json +3 -2
- package/dist/PermissionVisibility-CXHamZv5.cjs +0 -1
- package/dist/PermissionVisibility-DhDN-Z93.js +0 -24
- package/dist/SettingsSectionBase-CfT9p06Q.js +0 -475
- package/dist/SettingsSectionBase-PZs1Wgw1.cjs +0 -1
- package/dist/TopBarNavLayout-C0qRr2Lo.js +0 -62
- package/dist/TopBarNavLayout-CVxxYLc9.cjs +0 -1
- package/dist/date-1EP6oPlF.cjs +0 -1
- package/dist/date-BEtsfEKV.js +0 -389
- package/dist/jsx-runtime-DMhOxOJN.cjs +0 -14
- package/dist/jsx-runtime-gfdvceKf.js +0 -615
- package/dist/useSize-Dk1SOOLH.cjs +0 -1
- package/dist/useUrlForm-KA9CehKJ.cjs +0 -1
package/dist/formatters.js
CHANGED
package/dist/hooks.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useSize-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useSize-BLbsGFVL.cjs"),r=require("./useUrlForm-CxnAS6tK.cjs");exports.useSize=e.useSize;exports.useUrlForm=r.useUrlForm;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./query-Br3l_kxt.cjs"),a=require("./api-nTm6UPd6.cjs"),i=require("./date-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./query-Br3l_kxt.cjs"),a=require("./api-nTm6UPd6.cjs"),i=require("./date-RB_2ERsI.cjs"),t=require("./phone-DmQ5SK-X.cjs"),e=require("./SettingsSectionBase-Yx14wvkV.cjs"),l=require("./PermissionVisibility-DcNQuqAD.cjs"),r=require("./TopBarNavLayout-DGP6BWzi.cjs"),u=require("./useSize-BLbsGFVL.cjs"),s=require("./useUrlForm-CxnAS6tK.cjs"),m=require("./toast-CCrs9yfw.cjs");exports.buildQueryParams=o.buildQueryParams;exports.createHttpQueryParams=o.createHttpQueryParams;exports.createHttpQueryParamsFromData=o.createHttpQueryParamsFromData;exports.createApiBaseQuery=a.createApiBaseQuery;exports.getApiError=a.getApiError;exports.mapProblemDetails=a.mapProblemDetails;exports.wrapApiCall=a.wrapApiCall;exports.formatDateOnly=i.formatDateOnly;exports.formatDateTime=i.formatDateTime;exports.localeLoader=i.localeLoader;exports.currencyFormatter=t.currencyFormatter;exports.formatCurrency=t.formatCurrency;exports.formatDateDuration=t.formatDateDuration;exports.formatPhone=t.formatPhone;exports.parseMoney=t.parseMoney;exports.BooleanTag=e.BooleanTag;exports.Datatable=e.Datatable;exports.SelectItem=e.SelectItem;exports.SelectMultipleItems=e.SelectMultipleItems;exports.SettingGroup=e.SettingGroup;exports.SettingsSectionBase=e.SettingsSectionBase;exports.SimpleDatatable=e.SimpleDatatable;exports.SimpleHTMLDatatable=e.SimpleHTMLDatatable;exports.TableCellTag=e.TableCellTag;exports.copyTextToClipboard=e.copyTextToClipboard;exports.createCopyableText=e.createCopyableText;exports.createPageRequest=e.createPageRequest;exports.createTableCopyMenu=e.createTableCopyMenu;exports.useConfirmDialog=e.useConfirmDialog;exports.AuthRoute=l.AuthRoute;exports.PermissionVisibility=l.PermissionVisibility;exports.UnAuthRoute=l.UnAuthRoute;exports.ThemeSwitch=r.ThemeSwitch;exports.TopBarNavLayout=r.TopBarNavLayout;exports.Topbar=r.Topbar;exports.useTheme=r.useTheme;exports.useSize=u.useSize;exports.useUrlForm=s.useUrlForm;exports.showToast=m.showToast;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { b as r, c as t, a as s } from "./query-CherHJOV.js";
|
|
2
2
|
import { c as m, g as p, m as l, w as i } from "./api-CzCTYMlh.js";
|
|
3
|
-
import { f as c, a as f, l as T } from "./date-
|
|
3
|
+
import { f as c, a as f, l as T } from "./date-DxdnAP5U.js";
|
|
4
4
|
import { c as n, f as y, a as x, b as D, p as S } from "./phone-DtDgQ5qk.js";
|
|
5
|
-
import { B as h, D as P, S as C, a as A, b as B, c as d, d as w, e as M, T as Q, g as F, h as H, i as L, f as R, u as U } from "./SettingsSectionBase-
|
|
6
|
-
import { A as q, P as v, U as z } from "./PermissionVisibility-
|
|
7
|
-
import { T as G, a as N, b as O, u as V } from "./TopBarNavLayout-
|
|
5
|
+
import { B as h, D as P, S as C, a as A, b as B, c as d, d as w, e as M, T as Q, g as F, h as H, i as L, f as R, u as U } from "./SettingsSectionBase-S_Y2d_vs.js";
|
|
6
|
+
import { A as q, P as v, U as z } from "./PermissionVisibility-DWlTcq5R.js";
|
|
7
|
+
import { T as G, a as N, b as O, u as V } from "./TopBarNavLayout-BkDwDvQf.js";
|
|
8
8
|
import { u as k } from "./useSize-Ci0PbN9W.js";
|
|
9
9
|
import { u as K } from "./useUrlForm-BYTOPBsx.js";
|
|
10
10
|
import { s as X } from "./toast-B3QUItIK.js";
|
package/dist/layout.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./TopBarNavLayout-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./TopBarNavLayout-DGP6BWzi.cjs");exports.ThemeSwitch=e.ThemeSwitch;exports.TopBarNavLayout=e.TopBarNavLayout;exports.Topbar=e.Topbar;exports.useTheme=e.useTheme;
|
package/dist/layout.js
CHANGED
package/dist/security.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./PermissionVisibility-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./PermissionVisibility-DcNQuqAD.cjs");exports.AuthRoute=i.AuthRoute;exports.PermissionVisibility=i.PermissionVisibility;exports.UnAuthRoute=i.UnAuthRoute;
|
package/dist/security.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("react"),o=require("@react-hook/resize-observer"),r=require("use-debounce"),h=(t,s=150)=>{const[c,i]=n.useState({width:0,height:0}),u=r.useDebouncedCallback(e=>{i({width:e.contentRect.width,height:e.contentRect.height})},s);return o(t,u),c};exports.useSize=h;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const u=require("react"),a=require("react-router-dom"),m=require("./query-Br3l_kxt.cjs"),p=(r,t)=>{if(Array.isArray(r)){const o=r[0];return typeof o=="number"?t.map(Number):typeof o=="boolean"?t.map(c=>c==="true"):t}const e=t[0];return r instanceof Date?new Date(e):typeof r=="number"?Number(e):typeof r=="boolean"?e==="true":e},b=r=>{const[t,e]=a.useSearchParams(),[o,c]=u.useState(r);return u.useEffect(()=>{const n={...r};Object.keys(r).forEach(s=>{const i=t.getAll(String(s));i.length&&(n[s]=p(r[s],i))}),c(n)},[r,t]),{values:o,setValues:n=>{const s=m.buildQueryParams(n);e(s),c(n)}}};exports.useUrlForm=b;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pivotfinancialtechnologies/admin-frontend-blueprint-template",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.3-dev.
|
|
4
|
+
"version": "0.0.3-dev.11",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -51,7 +51,8 @@
|
|
|
51
51
|
"**/*.css"
|
|
52
52
|
],
|
|
53
53
|
"scripts": {
|
|
54
|
-
"build": "tsc -b && vite build",
|
|
54
|
+
"build": "tsc -b && vite build && npm run check:built-package",
|
|
55
|
+
"check:built-package": "node scripts/check-built-package.mjs",
|
|
55
56
|
"pack": "npm pack",
|
|
56
57
|
"lint": "eslint .",
|
|
57
58
|
"format:agents": "prettier --write AGENTS.md",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./jsx-runtime-DMhOxOJN.cjs"),o=require("react"),i=require("react-router-dom"),c=({isAuthenticated:t,loginUrl:r,onBeforeNavigateLogin:u})=>{const n=i.useNavigate(),s=o.useRef(!1);return o.useEffect(()=>{if(t){s.current=!1;return}s.current||(s.current=!0,u?.(),n(r,{replace:!0}))},[t,r,n,u]),t?e.jsxRuntimeExports.jsx(i.Outlet,{}):null},R=({isAuthenticated:t,homeUrl:r})=>t?e.jsxRuntimeExports.jsx(i.Navigate,{to:r}):e.jsxRuntimeExports.jsx(i.Outlet,{}),j=({requiredPermissions:t,gainPermissions:r,matchMode:u="any",children:n,fallback:s=null})=>!t.length||!r?.length?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:s}):(u==="all"?t.every(x=>r.includes(x)):t.some(x=>r.includes(x)))?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:n}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:s});exports.AuthRoute=c;exports.PermissionVisibility=j;exports.UnAuthRoute=R;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-gfdvceKf.js";
|
|
2
|
-
import { useRef as l, useEffect as o } from "react";
|
|
3
|
-
import { useNavigate as m, Outlet as c, Navigate as f } from "react-router-dom";
|
|
4
|
-
const p = ({ isAuthenticated: t, loginUrl: r, onBeforeNavigateLogin: n }) => {
|
|
5
|
-
const u = m(), s = l(!1);
|
|
6
|
-
return o(() => {
|
|
7
|
-
if (t) {
|
|
8
|
-
s.current = !1;
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
s.current || (s.current = !0, n?.(), u(r, { replace: !0 }));
|
|
12
|
-
}, [t, r, u, n]), t ? /* @__PURE__ */ e.jsx(c, {}) : null;
|
|
13
|
-
}, R = ({ isAuthenticated: t, homeUrl: r }) => t ? /* @__PURE__ */ e.jsx(f, { to: r }) : /* @__PURE__ */ e.jsx(c, {}), d = ({
|
|
14
|
-
requiredPermissions: t,
|
|
15
|
-
gainPermissions: r,
|
|
16
|
-
matchMode: n = "any",
|
|
17
|
-
children: u,
|
|
18
|
-
fallback: s = null
|
|
19
|
-
}) => !t.length || !r?.length ? /* @__PURE__ */ e.jsx(e.Fragment, { children: s }) : (n === "all" ? t.every((a) => r.includes(a)) : t.some((a) => r.includes(a))) ? /* @__PURE__ */ e.jsx(e.Fragment, { children: u }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: s });
|
|
20
|
-
export {
|
|
21
|
-
p as A,
|
|
22
|
-
d as P,
|
|
23
|
-
R as U
|
|
24
|
-
};
|
|
@@ -1,475 +0,0 @@
|
|
|
1
|
-
import { j as e } from "./jsx-runtime-gfdvceKf.js";
|
|
2
|
-
import { Tag as B, Menu as F, MenuItem as j, Divider as ne, PopoverNext as se, Button as R, Intent as E, Spinner as le, Alert as re, FormGroup as ie, H6 as oe, Section as ae } from "@blueprintjs/core";
|
|
3
|
-
import ce, { useState as k, useRef as L, useMemo as M, useEffect as Y, useCallback as $ } from "react";
|
|
4
|
-
import { Select as V, MultiSelect as de } from "@blueprintjs/select";
|
|
5
|
-
import { Table as J, TableLoadingOption as K, FocusMode as Q, SelectionModes as X, Column as Z, ColumnHeaderCell as ue, Cell as D } from "@blueprintjs/table";
|
|
6
|
-
import { u as q } from "./useSize-Ci0PbN9W.js";
|
|
7
|
-
import { a as H } from "./date-BEtsfEKV.js";
|
|
8
|
-
import { parseISO as xe, isValid as me } from "date-fns";
|
|
9
|
-
import { s as U } from "./toast-B3QUItIK.js";
|
|
10
|
-
const ke = ({ value: n, trueLabel: t = "Yes", falseLabel: s = "No" }) => {
|
|
11
|
-
if (n == null) return null;
|
|
12
|
-
const r = n === !0;
|
|
13
|
-
return /* @__PURE__ */ e.jsx(B, { intent: r ? "success" : "danger", children: r ? t : s });
|
|
14
|
-
}, O = (n = 0, t = 10, s) => ({
|
|
15
|
-
sort: s,
|
|
16
|
-
page: n,
|
|
17
|
-
pageSize: t
|
|
18
|
-
}), G = (n) => {
|
|
19
|
-
if (n == null)
|
|
20
|
-
return "";
|
|
21
|
-
if (n instanceof Date)
|
|
22
|
-
return H(n);
|
|
23
|
-
const t = String(n);
|
|
24
|
-
if (/^\d{4}-\d{2}-\d{2}/.test(t)) {
|
|
25
|
-
const s = xe(t);
|
|
26
|
-
if (me(s))
|
|
27
|
-
return H(s);
|
|
28
|
-
}
|
|
29
|
-
return t;
|
|
30
|
-
}, pe = (n) => {
|
|
31
|
-
const t = document.createElement("textarea");
|
|
32
|
-
t.value = n, t.style.position = "fixed", t.style.top = "0", t.style.left = "0", t.style.opacity = "0", document.body.appendChild(t), t.select();
|
|
33
|
-
try {
|
|
34
|
-
return document.execCommand("copy");
|
|
35
|
-
} catch (s) {
|
|
36
|
-
return console.error("Fallback copy failed", s), !1;
|
|
37
|
-
} finally {
|
|
38
|
-
document.body.removeChild(t);
|
|
39
|
-
}
|
|
40
|
-
}, W = async (n) => {
|
|
41
|
-
if (!navigator.clipboard) {
|
|
42
|
-
pe(n);
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
await navigator.clipboard.writeText(n);
|
|
46
|
-
}, ee = (n, t, s, r) => {
|
|
47
|
-
const o = n.getTarget(), a = o.rows?.[0] ?? -1, c = o.cols?.[0] ?? -1, d = t[c]?.name, f = s?.[a], x = f?.[t[c].key], g = a > -1 && c > -1 ? G(x) : "";
|
|
48
|
-
return /* @__PURE__ */ e.jsxs(F, { children: [
|
|
49
|
-
/* @__PURE__ */ e.jsx(
|
|
50
|
-
j,
|
|
51
|
-
{
|
|
52
|
-
text: d ? `Copy ${d} (Ctrl+C)` : "Copy (Ctrl+C)",
|
|
53
|
-
onClick: async () => {
|
|
54
|
-
a > -1 && c > -1 && (await W(g), U({ message: d ? `${d} Copied` : "Text Copied", intent: "success" }));
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
-1
|
|
58
|
-
),
|
|
59
|
-
r?.map((b, C) => /* @__PURE__ */ e.jsx(
|
|
60
|
-
j,
|
|
61
|
-
{
|
|
62
|
-
text: `Copy ${b.label}`,
|
|
63
|
-
onClick: async () => {
|
|
64
|
-
await W(b.copyContent(f)), U({ message: `${b.label} copied`, intent: "success" });
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
C
|
|
68
|
-
))
|
|
69
|
-
] });
|
|
70
|
-
}, he = [5, 15, 25, 50, 100], Te = ({
|
|
71
|
-
columns: n,
|
|
72
|
-
request: t,
|
|
73
|
-
data: s,
|
|
74
|
-
isLoading: r,
|
|
75
|
-
onRequestChange: o,
|
|
76
|
-
actionButtons: a,
|
|
77
|
-
getIntent: c,
|
|
78
|
-
onDoubleClick: d,
|
|
79
|
-
resetKey: f
|
|
80
|
-
}) => {
|
|
81
|
-
const [x, g] = k(n), b = L(null), { width: C } = q(b), h = s?.content ?? [], u = (l) => {
|
|
82
|
-
o(O(0, t.pageSize, l));
|
|
83
|
-
}, v = () => {
|
|
84
|
-
s && !s.last && o(O(t.page + 1, t.pageSize, t.sort));
|
|
85
|
-
}, I = () => {
|
|
86
|
-
s && !s.first && o(O(t.page - 1, t.pageSize, t.sort));
|
|
87
|
-
}, z = (l) => {
|
|
88
|
-
o(O(0, l, t.sort));
|
|
89
|
-
}, _ = (l) => /* @__PURE__ */ e.jsxs(F, { children: [
|
|
90
|
-
/* @__PURE__ */ e.jsx(j, { text: "Sort Ascending", icon: "sort-asc", onClick: () => u([{ field: l, direction: "asc" }]) }),
|
|
91
|
-
/* @__PURE__ */ e.jsx(j, { text: "Sort Descending", icon: "sort-desc", onClick: () => u([{ field: l, direction: "desc" }]) }),
|
|
92
|
-
/* @__PURE__ */ e.jsx(j, { text: "Unsort", onClick: () => u(void 0) })
|
|
93
|
-
] }), P = (l, m, p) => l.customCellRenderer ? l.customCellRenderer(m) : /* @__PURE__ */ e.jsx(e.Fragment, { children: p }), A = async (l, m) => {
|
|
94
|
-
const y = h[l]?.[n[m].key], w = G(y);
|
|
95
|
-
return navigator.clipboard || await W(w), w;
|
|
96
|
-
}, i = M(() => x.filter((l) => l.visible), [x]), N = (l) => {
|
|
97
|
-
const m = i.reduce((T, te) => T + (te.width ?? 0), 0), p = i.filter((T) => T.width !== void 0).length;
|
|
98
|
-
let w = (l - m - 38) / (i.length - p);
|
|
99
|
-
return w < 100 && (w = 100), i.map((T) => T.width ?? w);
|
|
100
|
-
}, S = M(() => N(C), [C, i]);
|
|
101
|
-
return Y(() => {
|
|
102
|
-
f && t.page !== 0 && o(O(0, t.pageSize, t.sort));
|
|
103
|
-
}, [f]), /* @__PURE__ */ e.jsxs("div", { children: [
|
|
104
|
-
/* @__PURE__ */ e.jsxs("div", { className: "table-form-actions", children: [
|
|
105
|
-
/* @__PURE__ */ e.jsx("div", { className: "table-form" }),
|
|
106
|
-
/* @__PURE__ */ e.jsxs("div", { className: "table-actions", children: [
|
|
107
|
-
a && a,
|
|
108
|
-
a && /* @__PURE__ */ e.jsx(ne, { style: { height: "20px" } }),
|
|
109
|
-
/* @__PURE__ */ e.jsx(
|
|
110
|
-
se,
|
|
111
|
-
{
|
|
112
|
-
placement: "bottom-start",
|
|
113
|
-
content: /* @__PURE__ */ e.jsx(F, { children: x.map((l) => /* @__PURE__ */ e.jsx(
|
|
114
|
-
j,
|
|
115
|
-
{
|
|
116
|
-
shouldDismissPopover: !1,
|
|
117
|
-
onClick: (m) => {
|
|
118
|
-
m.preventDefault(), g(
|
|
119
|
-
(p) => p.map((y) => y.key === l.key ? { ...y, visible: !y.visible } : y)
|
|
120
|
-
);
|
|
121
|
-
},
|
|
122
|
-
text: /* @__PURE__ */ e.jsxs("div", { className: "columns-visibility-menu", children: [
|
|
123
|
-
/* @__PURE__ */ e.jsx("input", { type: "checkbox", checked: l.visible, readOnly: !0, style: { pointerEvents: "none" } }),
|
|
124
|
-
l.name
|
|
125
|
-
] })
|
|
126
|
-
},
|
|
127
|
-
l.name
|
|
128
|
-
)) }),
|
|
129
|
-
renderTarget: ({ isOpen: l, ...m }) => /* @__PURE__ */ e.jsx(R, { ...m, text: "Columns Visibility", endIcon: "double-caret-vertical" })
|
|
130
|
-
}
|
|
131
|
-
)
|
|
132
|
-
] })
|
|
133
|
-
] }),
|
|
134
|
-
/* @__PURE__ */ e.jsx("div", { ref: b, children: /* @__PURE__ */ e.jsx(
|
|
135
|
-
J,
|
|
136
|
-
{
|
|
137
|
-
cellRendererDependencies: [t, s, S],
|
|
138
|
-
columnWidths: S,
|
|
139
|
-
numRows: h?.length ?? 0,
|
|
140
|
-
getCellClipboardData: A,
|
|
141
|
-
defaultRowHeight: 25,
|
|
142
|
-
enableColumnResizing: !1,
|
|
143
|
-
enableRowResizing: !1,
|
|
144
|
-
enableMultipleSelection: !1,
|
|
145
|
-
selectionModes: X.ROWS_AND_CELLS,
|
|
146
|
-
focusMode: Q.ROW,
|
|
147
|
-
loadingOptions: r ? [K.COLUMN_HEADERS] : [],
|
|
148
|
-
bodyContextMenuRenderer: (l) => ee(l, n, h ?? []),
|
|
149
|
-
children: i.map((l) => /* @__PURE__ */ e.jsx(
|
|
150
|
-
Z,
|
|
151
|
-
{
|
|
152
|
-
name: l.name,
|
|
153
|
-
cellRenderer: (m) => {
|
|
154
|
-
if (!h)
|
|
155
|
-
return /* @__PURE__ */ e.jsx(D, {});
|
|
156
|
-
const p = h[m], y = c ? c(p) : E.NONE;
|
|
157
|
-
return /* @__PURE__ */ e.jsx(D, { intent: y, interactive: !0, className: "h-full", children: /* @__PURE__ */ e.jsx(
|
|
158
|
-
"div",
|
|
159
|
-
{
|
|
160
|
-
className: "absolute inset-0 px-2 py-1 flex items-center",
|
|
161
|
-
onDoubleClick: () => {
|
|
162
|
-
d && d(p);
|
|
163
|
-
},
|
|
164
|
-
children: P(l, p, p[l.key])
|
|
165
|
-
}
|
|
166
|
-
) });
|
|
167
|
-
},
|
|
168
|
-
columnHeaderCellRenderer: () => /* @__PURE__ */ e.jsx(ue, { name: l.name, menuRenderer: () => _(l.sortKey ?? l.key) })
|
|
169
|
-
},
|
|
170
|
-
l.key
|
|
171
|
-
))
|
|
172
|
-
}
|
|
173
|
-
) }),
|
|
174
|
-
/* @__PURE__ */ e.jsxs("div", { className: "table-pagination", children: [
|
|
175
|
-
/* @__PURE__ */ e.jsxs("div", { className: "rows-select-container", children: [
|
|
176
|
-
/* @__PURE__ */ e.jsx("span", { children: "Rows per page: " }),
|
|
177
|
-
/* @__PURE__ */ e.jsx(
|
|
178
|
-
V,
|
|
179
|
-
{
|
|
180
|
-
items: he,
|
|
181
|
-
itemRenderer: (l, { handleClick: m }) => /* @__PURE__ */ e.jsx(j, { text: l, onClick: m }, l),
|
|
182
|
-
onItemSelect: z,
|
|
183
|
-
filterable: !1,
|
|
184
|
-
disabled: r,
|
|
185
|
-
children: /* @__PURE__ */ e.jsx(R, { text: t.pageSize, endIcon: "double-caret-vertical" })
|
|
186
|
-
}
|
|
187
|
-
)
|
|
188
|
-
] }),
|
|
189
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-row items-center", children: [
|
|
190
|
-
r && /* @__PURE__ */ e.jsx(le, { size: 20 }),
|
|
191
|
-
/* @__PURE__ */ e.jsx(R, { onClick: I, disabled: r || (s ? s.first : !0), children: "Previous" }),
|
|
192
|
-
/* @__PURE__ */ e.jsxs("span", { className: "pagination-page-info", children: [
|
|
193
|
-
"Page ",
|
|
194
|
-
s ? s.number + 1 : 1,
|
|
195
|
-
" of ",
|
|
196
|
-
s ? s.totalPages : 1
|
|
197
|
-
] }),
|
|
198
|
-
/* @__PURE__ */ e.jsx(R, { onClick: v, disabled: r || (s ? s.last : r), children: "Next" })
|
|
199
|
-
] })
|
|
200
|
-
] })
|
|
201
|
-
] });
|
|
202
|
-
}, Oe = ({
|
|
203
|
-
value: n,
|
|
204
|
-
trueText: t = "Yes",
|
|
205
|
-
falseText: s = "No",
|
|
206
|
-
trueIntent: r,
|
|
207
|
-
falseIntent: o,
|
|
208
|
-
round: a = !0,
|
|
209
|
-
minimal: c = !0
|
|
210
|
-
}) => n == null ? null : /* @__PURE__ */ e.jsx(B, { intent: n ? r : o, round: a, minimal: c, children: n ? t : s }), fe = [5, 15, 25, 50, 100, 200], Me = ({
|
|
211
|
-
columns: n,
|
|
212
|
-
data: t,
|
|
213
|
-
actionButtons: s,
|
|
214
|
-
isLoading: r,
|
|
215
|
-
getIntent: o,
|
|
216
|
-
pageSize: a,
|
|
217
|
-
extraCopyMenus: c
|
|
218
|
-
}) => {
|
|
219
|
-
const [d, f] = k(a), [x, g] = k(0), b = L(null), { width: C } = q(b), h = d != null, u = M(() => !h || !t ? 1 : Math.ceil(t.length / d) || 1, [t, d, h]), v = M(() => {
|
|
220
|
-
if (!t) return [];
|
|
221
|
-
if (!h) return t;
|
|
222
|
-
const i = x * d;
|
|
223
|
-
return t.slice(i, i + d);
|
|
224
|
-
}, [t, x, d, h]), I = (t?.length ?? 0) > 23 && !h, z = (i) => {
|
|
225
|
-
f(i), g(0);
|
|
226
|
-
}, _ = (i) => {
|
|
227
|
-
const N = n.reduce((p, y) => p + (y.width ?? 0), 0), S = n.filter((p) => p.width !== void 0).length;
|
|
228
|
-
let m = (i - N - 38) / (n.length - S);
|
|
229
|
-
return m < 150 && (m = 150), n.map((p) => p.width ?? m);
|
|
230
|
-
}, P = M(() => _(C), [C, n]), A = async (i, N) => {
|
|
231
|
-
const l = t?.[i]?.[n[N].key], m = G(l);
|
|
232
|
-
return navigator.clipboard || await W(m), m;
|
|
233
|
-
};
|
|
234
|
-
return ce.useEffect(() => {
|
|
235
|
-
g(0);
|
|
236
|
-
}, [t]), /* @__PURE__ */ e.jsxs(
|
|
237
|
-
"div",
|
|
238
|
-
{
|
|
239
|
-
className: "simple-datatable",
|
|
240
|
-
style: I ? { height: "70vh", overflow: "auto" } : void 0,
|
|
241
|
-
ref: b,
|
|
242
|
-
children: [
|
|
243
|
-
s && /* @__PURE__ */ e.jsx("div", { className: "flex justify-end mb-2", children: s }),
|
|
244
|
-
/* @__PURE__ */ e.jsx(
|
|
245
|
-
J,
|
|
246
|
-
{
|
|
247
|
-
loadingOptions: r ? [K.COLUMN_HEADERS] : [],
|
|
248
|
-
getCellClipboardData: A,
|
|
249
|
-
cellRendererDependencies: [v, n, P, x],
|
|
250
|
-
numRows: v.length,
|
|
251
|
-
defaultRowHeight: 25,
|
|
252
|
-
enableColumnResizing: !1,
|
|
253
|
-
enableRowResizing: !1,
|
|
254
|
-
enableMultipleSelection: !1,
|
|
255
|
-
selectionModes: X.ROWS_AND_CELLS,
|
|
256
|
-
columnWidths: P,
|
|
257
|
-
focusMode: Q.ROW,
|
|
258
|
-
bodyContextMenuRenderer: (i) => ee(i, n, v, c),
|
|
259
|
-
children: n.map((i) => /* @__PURE__ */ e.jsx(
|
|
260
|
-
Z,
|
|
261
|
-
{
|
|
262
|
-
name: i.name,
|
|
263
|
-
cellRenderer: (N) => {
|
|
264
|
-
const S = v[N], l = o ? o(S) : E.NONE;
|
|
265
|
-
return S ? /* @__PURE__ */ e.jsx(D, { intent: l, children: i.customCellRenderer ? i.customCellRenderer(S) : /* @__PURE__ */ e.jsx(e.Fragment, { children: S[i.key] }) }) : /* @__PURE__ */ e.jsx(D, { intent: l });
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
|
-
i.key
|
|
269
|
-
))
|
|
270
|
-
},
|
|
271
|
-
`table-page-${x}-${d ?? "all"}`
|
|
272
|
-
),
|
|
273
|
-
h && /* @__PURE__ */ e.jsxs("div", { className: "table-pagination flex items-center justify-between mt-2", children: [
|
|
274
|
-
/* @__PURE__ */ e.jsxs("div", { className: "rows-select-container flex items-center gap-2", children: [
|
|
275
|
-
/* @__PURE__ */ e.jsx("span", { children: "Rows per page: " }),
|
|
276
|
-
/* @__PURE__ */ e.jsx(
|
|
277
|
-
V,
|
|
278
|
-
{
|
|
279
|
-
items: fe,
|
|
280
|
-
itemRenderer: (i, { handleClick: N }) => /* @__PURE__ */ e.jsx(j, { text: i, onClick: N }, i),
|
|
281
|
-
onItemSelect: z,
|
|
282
|
-
filterable: !1,
|
|
283
|
-
children: /* @__PURE__ */ e.jsx(R, { text: d, endIcon: "double-caret-vertical" })
|
|
284
|
-
}
|
|
285
|
-
)
|
|
286
|
-
] }),
|
|
287
|
-
/* @__PURE__ */ e.jsxs("div", { className: "flex flex-row items-center gap-2", children: [
|
|
288
|
-
/* @__PURE__ */ e.jsx(R, { onClick: () => g((i) => Math.max(0, i - 1)), disabled: x === 0, children: "Previous" }),
|
|
289
|
-
/* @__PURE__ */ e.jsxs("span", { className: "pagination-page-info px-2", children: [
|
|
290
|
-
"Page ",
|
|
291
|
-
x + 1,
|
|
292
|
-
" of ",
|
|
293
|
-
u
|
|
294
|
-
] }),
|
|
295
|
-
/* @__PURE__ */ e.jsx(
|
|
296
|
-
R,
|
|
297
|
-
{
|
|
298
|
-
onClick: () => g((i) => Math.min(u - 1, i + 1)),
|
|
299
|
-
disabled: x >= u - 1,
|
|
300
|
-
children: "Next"
|
|
301
|
-
}
|
|
302
|
-
)
|
|
303
|
-
] })
|
|
304
|
-
] })
|
|
305
|
-
]
|
|
306
|
-
}
|
|
307
|
-
);
|
|
308
|
-
}, Pe = ({ columns: n, data: t, getIntent: s }) => /* @__PURE__ */ e.jsxs("table", { className: "bp6-html-table simple-html-datatable w-full", children: [
|
|
309
|
-
/* @__PURE__ */ e.jsx("thead", { children: /* @__PURE__ */ e.jsx("tr", { children: n.map((r, o) => /* @__PURE__ */ e.jsx("th", { style: { width: r.width }, children: r.name }, o)) }) }),
|
|
310
|
-
/* @__PURE__ */ e.jsx("tbody", { children: (t ?? []).map((r, o) => {
|
|
311
|
-
const a = s ? s(r) : E.NONE;
|
|
312
|
-
return /* @__PURE__ */ e.jsx("tr", { className: a !== E.NONE ? `bp6-intent-${a}` : "", children: n.map((c, d) => /* @__PURE__ */ e.jsx("td", { children: c.customCellRenderer ? c.customCellRenderer(r) : r[c.key] }, d)) }, o);
|
|
313
|
-
}) })
|
|
314
|
-
] }), Ee = () => {
|
|
315
|
-
const [n, t] = k(!1), [s, r] = k(null), [o, a] = k(null);
|
|
316
|
-
return [$((f) => (r(f), t(!0), new Promise((x) => {
|
|
317
|
-
a(() => x);
|
|
318
|
-
})), []), /* @__PURE__ */ e.jsx(
|
|
319
|
-
re,
|
|
320
|
-
{
|
|
321
|
-
isOpen: n,
|
|
322
|
-
intent: "primary",
|
|
323
|
-
confirmButtonText: "Yes",
|
|
324
|
-
cancelButtonText: "No",
|
|
325
|
-
onConfirm: () => {
|
|
326
|
-
t(!1), o?.(!0), a(null);
|
|
327
|
-
},
|
|
328
|
-
onClose: () => {
|
|
329
|
-
t(!1), o?.(!1), a(null);
|
|
330
|
-
},
|
|
331
|
-
children: s
|
|
332
|
-
}
|
|
333
|
-
)];
|
|
334
|
-
}, De = ({
|
|
335
|
-
selectedValue: n,
|
|
336
|
-
items: t = [],
|
|
337
|
-
required: s = !1,
|
|
338
|
-
disabled: r,
|
|
339
|
-
onSelect: o,
|
|
340
|
-
renderSelected: a,
|
|
341
|
-
renderMenuText: c,
|
|
342
|
-
getValueByItem: d,
|
|
343
|
-
getItemByValue: f,
|
|
344
|
-
renderMenuLabel: x,
|
|
345
|
-
onBlur: g,
|
|
346
|
-
intent: b = "none"
|
|
347
|
-
}) => {
|
|
348
|
-
const C = s ? t : [null, ...t], h = n === void 0 ? void 0 : f(n);
|
|
349
|
-
return /* @__PURE__ */ e.jsx(
|
|
350
|
-
V,
|
|
351
|
-
{
|
|
352
|
-
items: C,
|
|
353
|
-
disabled: r,
|
|
354
|
-
onItemSelect: (u) => {
|
|
355
|
-
o(u ?? void 0);
|
|
356
|
-
},
|
|
357
|
-
filterable: !1,
|
|
358
|
-
popoverProps: {
|
|
359
|
-
onClose: () => {
|
|
360
|
-
g?.();
|
|
361
|
-
}
|
|
362
|
-
},
|
|
363
|
-
itemRenderer: (u, { handleClick: v }) => u ? /* @__PURE__ */ e.jsx(
|
|
364
|
-
j,
|
|
365
|
-
{
|
|
366
|
-
text: c(u),
|
|
367
|
-
onClick: v,
|
|
368
|
-
labelElement: x?.(u)
|
|
369
|
-
},
|
|
370
|
-
String(d(u))
|
|
371
|
-
) : /* @__PURE__ */ e.jsx(j, { text: "— None —", onClick: v }, "__none"),
|
|
372
|
-
noResults: /* @__PURE__ */ e.jsx(j, { disabled: !0, text: "No records." }),
|
|
373
|
-
children: /* @__PURE__ */ e.jsx(
|
|
374
|
-
R,
|
|
375
|
-
{
|
|
376
|
-
text: a(h) ?? "Select Value",
|
|
377
|
-
intent: b,
|
|
378
|
-
endIcon: "double-caret-vertical"
|
|
379
|
-
}
|
|
380
|
-
)
|
|
381
|
-
}
|
|
382
|
-
);
|
|
383
|
-
}, We = ({
|
|
384
|
-
items: n = [],
|
|
385
|
-
selectedValues: t = [],
|
|
386
|
-
required: s = !1,
|
|
387
|
-
disabled: r,
|
|
388
|
-
getValueByItem: o,
|
|
389
|
-
getItemByValue: a,
|
|
390
|
-
renderSelected: c,
|
|
391
|
-
renderMenuText: d,
|
|
392
|
-
renderMenuLabel: f,
|
|
393
|
-
onBlur: x,
|
|
394
|
-
onSelect: g,
|
|
395
|
-
onRemove: b
|
|
396
|
-
}) => {
|
|
397
|
-
const C = t.map((u) => a(u)), h = (u) => {
|
|
398
|
-
s && C.length <= 1 || b(u);
|
|
399
|
-
};
|
|
400
|
-
return /* @__PURE__ */ e.jsx(
|
|
401
|
-
de,
|
|
402
|
-
{
|
|
403
|
-
disabled: r,
|
|
404
|
-
items: n,
|
|
405
|
-
selectedItems: C,
|
|
406
|
-
onItemSelect: g,
|
|
407
|
-
onRemove: h,
|
|
408
|
-
popoverProps: {
|
|
409
|
-
onClose: () => {
|
|
410
|
-
x?.();
|
|
411
|
-
}
|
|
412
|
-
},
|
|
413
|
-
itemRenderer: (u, { handleClick: v }) => /* @__PURE__ */ e.jsx(
|
|
414
|
-
j,
|
|
415
|
-
{
|
|
416
|
-
text: d(u),
|
|
417
|
-
labelElement: f?.(u),
|
|
418
|
-
onClick: v
|
|
419
|
-
},
|
|
420
|
-
String(o(u))
|
|
421
|
-
),
|
|
422
|
-
noResults: /* @__PURE__ */ e.jsx(j, { disabled: !0, text: "No records." }),
|
|
423
|
-
tagRenderer: (u) => c(u)
|
|
424
|
-
}
|
|
425
|
-
);
|
|
426
|
-
}, Ie = ({ label: n, helpText: t, children: s }) => /* @__PURE__ */ e.jsx(
|
|
427
|
-
ie,
|
|
428
|
-
{
|
|
429
|
-
label: /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-start gap-1", children: /* @__PURE__ */ e.jsx(oe, { className: "m-0 whitespace-nowrap w-30", children: n }) }),
|
|
430
|
-
helperText: t,
|
|
431
|
-
inline: !0,
|
|
432
|
-
contentClassName: "w-full",
|
|
433
|
-
children: s
|
|
434
|
-
}
|
|
435
|
-
), ge = (n) => {
|
|
436
|
-
const [t, s] = k(n);
|
|
437
|
-
Y(() => {
|
|
438
|
-
s(n);
|
|
439
|
-
}, [n]);
|
|
440
|
-
const r = $((a, c) => JSON.stringify(a) !== JSON.stringify(c), []), o = $(
|
|
441
|
-
(a, c) => s((d) => ({ ...d, [a]: c })),
|
|
442
|
-
[]
|
|
443
|
-
);
|
|
444
|
-
return { value: t, setField: o, setValue: s, hasChanges: r };
|
|
445
|
-
}, ze = (n) => {
|
|
446
|
-
const { title: t, updatedAt: s, onChange: r, settings: o, getContent: a } = n, { value: c, setField: d, setValue: f, hasChanges: x } = ge(o), g = x(o, c);
|
|
447
|
-
return /* @__PURE__ */ e.jsx(
|
|
448
|
-
ae,
|
|
449
|
-
{
|
|
450
|
-
title: t,
|
|
451
|
-
rightElement: /* @__PURE__ */ e.jsx(R, { type: "button", intent: "primary", disabled: !g, onClick: () => r(c), children: "Save" }),
|
|
452
|
-
subtitle: /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
453
|
-
"Updated At: ",
|
|
454
|
-
H(s)
|
|
455
|
-
] }),
|
|
456
|
-
children: /* @__PURE__ */ e.jsx("div", { className: "m-4", children: a ? a(c, d, f) : null })
|
|
457
|
-
}
|
|
458
|
-
);
|
|
459
|
-
};
|
|
460
|
-
export {
|
|
461
|
-
ke as B,
|
|
462
|
-
Te as D,
|
|
463
|
-
De as S,
|
|
464
|
-
Oe as T,
|
|
465
|
-
We as a,
|
|
466
|
-
Ie as b,
|
|
467
|
-
ze as c,
|
|
468
|
-
Me as d,
|
|
469
|
-
Pe as e,
|
|
470
|
-
ee as f,
|
|
471
|
-
W as g,
|
|
472
|
-
G as h,
|
|
473
|
-
O as i,
|
|
474
|
-
Ee as u
|
|
475
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./jsx-runtime-DMhOxOJN.cjs"),r=require("@blueprintjs/core"),j=require("react"),D=require("@blueprintjs/select"),f=require("@blueprintjs/table"),H=require("./useSize-Dk1SOOLH.cjs"),B=require("./date-1EP6oPlF.cjs"),$=require("date-fns"),A=require("./toast-CCrs9yfw.cjs"),G=({value:s,trueLabel:t="Yes",falseLabel:n="No"})=>{if(s==null)return null;const o=s===!0;return e.jsxRuntimeExports.jsx(r.Tag,{intent:o?"success":"danger",children:o?t:n})},w=(s=0,t=10,n)=>({sort:n,page:s,pageSize:t}),O=s=>{if(s==null)return"";if(s instanceof Date)return B.formatDateTime(s);const t=String(s);if(/^\d{4}-\d{2}-\d{2}/.test(t)){const n=$.parseISO(t);if($.isValid(n))return B.formatDateTime(n)}return t},L=s=>{const t=document.createElement("textarea");t.value=s,t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.opacity="0",document.body.appendChild(t),t.select();try{return document.execCommand("copy")}catch(n){return console.error("Fallback copy failed",n),!1}finally{document.body.removeChild(t)}},I=async s=>{if(!navigator.clipboard){L(s);return}await navigator.clipboard.writeText(s)},F=(s,t,n,o)=>{const a=s.getTarget(),c=a.rows?.[0]??-1,x=a.cols?.[0]??-1,u=t[x]?.name,E=n?.[c],m=E?.[t[x].key],b=c>-1&&x>-1?O(m):"";return e.jsxRuntimeExports.jsxs(r.Menu,{children:[e.jsxRuntimeExports.jsx(r.MenuItem,{text:u?`Copy ${u} (Ctrl+C)`:"Copy (Ctrl+C)",onClick:async()=>{c>-1&&x>-1&&(await I(b),A.showToast({message:u?`${u} Copied`:"Text Copied",intent:"success"}))}},-1),o?.map((C,g)=>e.jsxRuntimeExports.jsx(r.MenuItem,{text:`Copy ${C.label}`,onClick:async()=>{await I(C.copyContent(E)),A.showToast({message:`${C.label} copied`,intent:"success"})}},g))]})},U=[5,15,25,50,100],Y=({columns:s,request:t,data:n,isLoading:o,onRequestChange:a,actionButtons:c,getIntent:x,onDoubleClick:u,resetKey:E})=>{const[m,b]=j.useState(s),C=j.useRef(null),{width:g}=H.useSize(C),h=n?.content??[],d=i=>{a(w(0,t.pageSize,i))},S=()=>{n&&!n.last&&a(w(t.page+1,t.pageSize,t.sort))},P=()=>{n&&!n.first&&a(w(t.page-1,t.pageSize,t.sort))},W=i=>{a(w(0,i,t.sort))},z=i=>e.jsxRuntimeExports.jsxs(r.Menu,{children:[e.jsxRuntimeExports.jsx(r.MenuItem,{text:"Sort Ascending",icon:"sort-asc",onClick:()=>d([{field:i,direction:"asc"}])}),e.jsxRuntimeExports.jsx(r.MenuItem,{text:"Sort Descending",icon:"sort-desc",onClick:()=>d([{field:i,direction:"desc"}])}),e.jsxRuntimeExports.jsx(r.MenuItem,{text:"Unsort",onClick:()=>d(void 0)})]}),k=(i,p,R)=>i.customCellRenderer?i.customCellRenderer(p):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:R}),_=async(i,p)=>{const y=h[i]?.[s[p].key],M=O(y);return navigator.clipboard||await I(M),M},l=j.useMemo(()=>m.filter(i=>i.visible),[m]),N=i=>{const p=l.reduce((T,V)=>T+(V.width??0),0),R=l.filter(T=>T.width!==void 0).length;let M=(i-p-38)/(l.length-R);return M<100&&(M=100),l.map(T=>T.width??M)},v=j.useMemo(()=>N(g),[g,l]);return j.useEffect(()=>{E&&t.page!==0&&a(w(0,t.pageSize,t.sort))},[E]),e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("div",{className:"table-form-actions",children:[e.jsxRuntimeExports.jsx("div",{className:"table-form"}),e.jsxRuntimeExports.jsxs("div",{className:"table-actions",children:[c&&c,c&&e.jsxRuntimeExports.jsx(r.Divider,{style:{height:"20px"}}),e.jsxRuntimeExports.jsx(r.PopoverNext,{placement:"bottom-start",content:e.jsxRuntimeExports.jsx(r.Menu,{children:m.map(i=>e.jsxRuntimeExports.jsx(r.MenuItem,{shouldDismissPopover:!1,onClick:p=>{p.preventDefault(),b(R=>R.map(y=>y.key===i.key?{...y,visible:!y.visible}:y))},text:e.jsxRuntimeExports.jsxs("div",{className:"columns-visibility-menu",children:[e.jsxRuntimeExports.jsx("input",{type:"checkbox",checked:i.visible,readOnly:!0,style:{pointerEvents:"none"}}),i.name]})},i.name))}),renderTarget:({isOpen:i,...p})=>e.jsxRuntimeExports.jsx(r.Button,{...p,text:"Columns Visibility",endIcon:"double-caret-vertical"})})]})]}),e.jsxRuntimeExports.jsx("div",{ref:C,children:e.jsxRuntimeExports.jsx(f.Table,{cellRendererDependencies:[t,n,v],columnWidths:v,numRows:h?.length??0,getCellClipboardData:_,defaultRowHeight:25,enableColumnResizing:!1,enableRowResizing:!1,enableMultipleSelection:!1,selectionModes:f.SelectionModes.ROWS_AND_CELLS,focusMode:f.FocusMode.ROW,loadingOptions:o?[f.TableLoadingOption.COLUMN_HEADERS]:[],bodyContextMenuRenderer:i=>F(i,s,h??[]),children:l.map(i=>e.jsxRuntimeExports.jsx(f.Column,{name:i.name,cellRenderer:p=>{if(!h)return e.jsxRuntimeExports.jsx(f.Cell,{});const R=h[p],y=x?x(R):r.Intent.NONE;return e.jsxRuntimeExports.jsx(f.Cell,{intent:y,interactive:!0,className:"h-full",children:e.jsxRuntimeExports.jsx("div",{className:"absolute inset-0 px-2 py-1 flex items-center",onDoubleClick:()=>{u&&u(R)},children:k(i,R,R[i.key])})})},columnHeaderCellRenderer:()=>e.jsxRuntimeExports.jsx(f.ColumnHeaderCell,{name:i.name,menuRenderer:()=>z(i.sortKey??i.key)})},i.key))})}),e.jsxRuntimeExports.jsxs("div",{className:"table-pagination",children:[e.jsxRuntimeExports.jsxs("div",{className:"rows-select-container",children:[e.jsxRuntimeExports.jsx("span",{children:"Rows per page: "}),e.jsxRuntimeExports.jsx(D.Select,{items:U,itemRenderer:(i,{handleClick:p})=>e.jsxRuntimeExports.jsx(r.MenuItem,{text:i,onClick:p},i),onItemSelect:W,filterable:!1,disabled:o,children:e.jsxRuntimeExports.jsx(r.Button,{text:t.pageSize,endIcon:"double-caret-vertical"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center",children:[o&&e.jsxRuntimeExports.jsx(r.Spinner,{size:20}),e.jsxRuntimeExports.jsx(r.Button,{onClick:P,disabled:o||(n?n.first:!0),children:"Previous"}),e.jsxRuntimeExports.jsxs("span",{className:"pagination-page-info",children:["Page ",n?n.number+1:1," of ",n?n.totalPages:1]}),e.jsxRuntimeExports.jsx(r.Button,{onClick:S,disabled:o||(n?n.last:o),children:"Next"})]})]})]})},J=({value:s,trueText:t="Yes",falseText:n="No",trueIntent:o,falseIntent:a,round:c=!0,minimal:x=!0})=>s==null?null:e.jsxRuntimeExports.jsx(r.Tag,{intent:s?o:a,round:c,minimal:x,children:s?t:n}),K=[5,15,25,50,100,200],Q=({columns:s,data:t,actionButtons:n,isLoading:o,getIntent:a,pageSize:c,extraCopyMenus:x})=>{const[u,E]=j.useState(c),[m,b]=j.useState(0),C=j.useRef(null),{width:g}=H.useSize(C),h=u!=null,d=j.useMemo(()=>!h||!t?1:Math.ceil(t.length/u)||1,[t,u,h]),S=j.useMemo(()=>{if(!t)return[];if(!h)return t;const l=m*u;return t.slice(l,l+u)},[t,m,u,h]),P=(t?.length??0)>23&&!h,W=l=>{E(l),b(0)},z=l=>{const N=s.reduce((R,y)=>R+(y.width??0),0),v=s.filter(R=>R.width!==void 0).length;let p=(l-N-38)/(s.length-v);return p<150&&(p=150),s.map(R=>R.width??p)},k=j.useMemo(()=>z(g),[g,s]),_=async(l,N)=>{const i=t?.[l]?.[s[N].key],p=O(i);return navigator.clipboard||await I(p),p};return j.useEffect(()=>{b(0)},[t]),e.jsxRuntimeExports.jsxs("div",{className:"simple-datatable",style:P?{height:"70vh",overflow:"auto"}:void 0,ref:C,children:[n&&e.jsxRuntimeExports.jsx("div",{className:"flex justify-end mb-2",children:n}),e.jsxRuntimeExports.jsx(f.Table,{loadingOptions:o?[f.TableLoadingOption.COLUMN_HEADERS]:[],getCellClipboardData:_,cellRendererDependencies:[S,s,k,m],numRows:S.length,defaultRowHeight:25,enableColumnResizing:!1,enableRowResizing:!1,enableMultipleSelection:!1,selectionModes:f.SelectionModes.ROWS_AND_CELLS,columnWidths:k,focusMode:f.FocusMode.ROW,bodyContextMenuRenderer:l=>F(l,s,S,x),children:s.map(l=>e.jsxRuntimeExports.jsx(f.Column,{name:l.name,cellRenderer:N=>{const v=S[N],i=a?a(v):r.Intent.NONE;return v?e.jsxRuntimeExports.jsx(f.Cell,{intent:i,children:l.customCellRenderer?l.customCellRenderer(v):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:v[l.key]})}):e.jsxRuntimeExports.jsx(f.Cell,{intent:i})}},l.key))},`table-page-${m}-${u??"all"}`),h&&e.jsxRuntimeExports.jsxs("div",{className:"table-pagination flex items-center justify-between mt-2",children:[e.jsxRuntimeExports.jsxs("div",{className:"rows-select-container flex items-center gap-2",children:[e.jsxRuntimeExports.jsx("span",{children:"Rows per page: "}),e.jsxRuntimeExports.jsx(D.Select,{items:K,itemRenderer:(l,{handleClick:N})=>e.jsxRuntimeExports.jsx(r.MenuItem,{text:l,onClick:N},l),onItemSelect:W,filterable:!1,children:e.jsxRuntimeExports.jsx(r.Button,{text:u,endIcon:"double-caret-vertical"})})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center gap-2",children:[e.jsxRuntimeExports.jsx(r.Button,{onClick:()=>b(l=>Math.max(0,l-1)),disabled:m===0,children:"Previous"}),e.jsxRuntimeExports.jsxs("span",{className:"pagination-page-info px-2",children:["Page ",m+1," of ",d]}),e.jsxRuntimeExports.jsx(r.Button,{onClick:()=>b(l=>Math.min(d-1,l+1)),disabled:m>=d-1,children:"Next"})]})]})]})},X=({columns:s,data:t,getIntent:n})=>e.jsxRuntimeExports.jsxs("table",{className:"bp6-html-table simple-html-datatable w-full",children:[e.jsxRuntimeExports.jsx("thead",{children:e.jsxRuntimeExports.jsx("tr",{children:s.map((o,a)=>e.jsxRuntimeExports.jsx("th",{style:{width:o.width},children:o.name},a))})}),e.jsxRuntimeExports.jsx("tbody",{children:(t??[]).map((o,a)=>{const c=n?n(o):r.Intent.NONE;return e.jsxRuntimeExports.jsx("tr",{className:c!==r.Intent.NONE?`bp6-intent-${c}`:"",children:s.map((x,u)=>e.jsxRuntimeExports.jsx("td",{children:x.customCellRenderer?x.customCellRenderer(o):o[x.key]},u))},a)})})]}),Z=()=>{const[s,t]=j.useState(!1),[n,o]=j.useState(null),[a,c]=j.useState(null),x=j.useCallback(E=>(o(E),t(!0),new Promise(m=>{c(()=>m)})),[]),u=e.jsxRuntimeExports.jsx(r.Alert,{isOpen:s,intent:"primary",confirmButtonText:"Yes",cancelButtonText:"No",onConfirm:()=>{t(!1),a?.(!0),c(null)},onClose:()=>{t(!1),a?.(!1),c(null)},children:n});return[x,u]},q=({selectedValue:s,items:t=[],required:n=!1,disabled:o,onSelect:a,renderSelected:c,renderMenuText:x,getValueByItem:u,getItemByValue:E,renderMenuLabel:m,onBlur:b,intent:C="none"})=>{const g=n?t:[null,...t],h=s===void 0?void 0:E(s);return e.jsxRuntimeExports.jsx(D.Select,{items:g,disabled:o,onItemSelect:d=>{a(d??void 0)},filterable:!1,popoverProps:{onClose:()=>{b?.()}},itemRenderer:(d,{handleClick:S})=>d?e.jsxRuntimeExports.jsx(r.MenuItem,{text:x(d),onClick:S,labelElement:m?.(d)},String(u(d))):e.jsxRuntimeExports.jsx(r.MenuItem,{text:"— None —",onClick:S},"__none"),noResults:e.jsxRuntimeExports.jsx(r.MenuItem,{disabled:!0,text:"No records."}),children:e.jsxRuntimeExports.jsx(r.Button,{text:c(h)??"Select Value",intent:C,endIcon:"double-caret-vertical"})})},ee=({items:s=[],selectedValues:t=[],required:n=!1,disabled:o,getValueByItem:a,getItemByValue:c,renderSelected:x,renderMenuText:u,renderMenuLabel:E,onBlur:m,onSelect:b,onRemove:C})=>{const g=t.map(d=>c(d)),h=d=>{n&&g.length<=1||C(d)};return e.jsxRuntimeExports.jsx(D.MultiSelect,{disabled:o,items:s,selectedItems:g,onItemSelect:b,onRemove:h,popoverProps:{onClose:()=>{m?.()}},itemRenderer:(d,{handleClick:S})=>e.jsxRuntimeExports.jsx(r.MenuItem,{text:u(d),labelElement:E?.(d),onClick:S},String(a(d))),noResults:e.jsxRuntimeExports.jsx(r.MenuItem,{disabled:!0,text:"No records."}),tagRenderer:d=>x(d)})},te=({label:s,helpText:t,children:n})=>e.jsxRuntimeExports.jsx(r.FormGroup,{label:e.jsxRuntimeExports.jsx("div",{className:"flex flex-col items-start gap-1",children:e.jsxRuntimeExports.jsx(r.H6,{className:"m-0 whitespace-nowrap w-30",children:s})}),helperText:t,inline:!0,contentClassName:"w-full",children:n}),se=s=>{const[t,n]=j.useState(s);j.useEffect(()=>{n(s)},[s]);const o=j.useCallback((c,x)=>JSON.stringify(c)!==JSON.stringify(x),[]),a=j.useCallback((c,x)=>n(u=>({...u,[c]:x})),[]);return{value:t,setField:a,setValue:n,hasChanges:o}},ne=s=>{const{title:t,updatedAt:n,onChange:o,settings:a,getContent:c}=s,{value:x,setField:u,setValue:E,hasChanges:m}=se(a),b=m(a,x);return e.jsxRuntimeExports.jsx(r.Section,{title:t,rightElement:e.jsxRuntimeExports.jsx(r.Button,{type:"button",intent:"primary",disabled:!b,onClick:()=>o(x),children:"Save"}),subtitle:e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:["Updated At: ",B.formatDateTime(n)]}),children:e.jsxRuntimeExports.jsx("div",{className:"m-4",children:c?c(x,u,E):null})})};exports.BooleanTag=G;exports.Datatable=Y;exports.SelectItem=q;exports.SelectMultipleItems=ee;exports.SettingGroup=te;exports.SettingsSectionBase=ne;exports.SimpleDatatable=Q;exports.SimpleHTMLDatatable=X;exports.TableCellTag=J;exports.copyTextToClipboard=I;exports.createCopyableText=O;exports.createPageRequest=w;exports.createTableCopyMenu=F;exports.useConfirmDialog=Z;
|