@starasia/admin 1.3.1 → 1.3.2

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.es.js CHANGED
@@ -51,10 +51,10 @@ export * from "@starasia/progress";
51
51
  export * from "@starasia/stepper";
52
52
  export * from "@starasia/accordion";
53
53
  export * from "@starasia/story-record";
54
- import { Skeleton as lA } from "@starasia/skeleton";
54
+ import { Skeleton as cA } from "@starasia/skeleton";
55
55
  export * from "@starasia/skeleton";
56
56
  import { jsx as A, jsxs as s, Fragment as U } from "react/jsx-runtime";
57
- import gA, { createContext as ue, useState as b, useContext as ke, memo as _, useRef as eA, useEffect as W, useLayoutEffect as NA, useMemo as cA, isValidElement as Ae, forwardRef as KA, useCallback as ZA, Children as Ee, useImperativeHandle as Me } from "react";
57
+ import sA, { createContext as ue, useState as b, useContext as ke, memo as _, useRef as eA, useEffect as W, useLayoutEffect as NA, useMemo as gA, isValidElement as Ae, forwardRef as KA, useCallback as ZA, Children as Ee, useImperativeHandle as Me } from "react";
58
58
  import "@starasia/css/dist/style.css";
59
59
  import { useSearchParams as uA, useNavigate as ee, useLocation as fA, Outlet as TA, Link as me, useParams as ie } from "react-router";
60
60
  import ye from "react-easy-crop";
@@ -359,7 +359,7 @@ function Ft({
359
359
  });
360
360
  });
361
361
  }, [I.pathname, w.menus]);
362
- const sA = (m) => {
362
+ const nA = (m) => {
363
363
  Z((y) => {
364
364
  const S = new Set(y);
365
365
  return S.has(m) ? S.delete(m) : S.add(m), S;
@@ -382,7 +382,7 @@ function Ft({
382
382
  const S = w.menus.find((tA) => tA.id === m), v = (y = S == null ? void 0 : S.items[0]) == null ? void 0 : y.to;
383
383
  v && B(v);
384
384
  }
385
- }, le = cA(() => {
385
+ }, le = gA(() => {
386
386
  if (H !== null)
387
387
  return w.menus.filter(
388
388
  (S) => S.id === H || S.parentGroupId === H
@@ -648,7 +648,7 @@ function Ft({
648
648
  "button",
649
649
  {
650
650
  onClick: () => {
651
- S ? sA(y.id) : B(y.to);
651
+ S ? nA(y.id) : B(y.to);
652
652
  },
653
653
  style: {
654
654
  width: "100%",
@@ -1111,14 +1111,14 @@ const zt = _(
1111
1111
  lastIndex: t,
1112
1112
  labelAlign: n = "top"
1113
1113
  }) => {
1114
- const l = cA(
1114
+ const l = gA(
1115
1115
  () => ({
1116
1116
  padding: 0,
1117
1117
  paddingBottom: t ? 0 : 8,
1118
1118
  verticalAlign: n
1119
1119
  }),
1120
1120
  [t]
1121
- ), c = cA(
1121
+ ), c = gA(
1122
1122
  () => ({
1123
1123
  padding: 0,
1124
1124
  paddingRight: 8,
@@ -1151,7 +1151,7 @@ const zt = _(
1151
1151
  fields: o = [],
1152
1152
  labelWidth: t = 150
1153
1153
  }) => {
1154
- const n = cA(
1154
+ const n = gA(
1155
1155
  () => be(o, e),
1156
1156
  [o, e]
1157
1157
  ), l = n.length > 2, c = () => {
@@ -1565,7 +1565,7 @@ const zt = _(
1565
1565
  iconProps: c,
1566
1566
  variant: g = "default"
1567
1567
  }) => {
1568
- const C = cA(
1568
+ const C = gA(
1569
1569
  () => ({
1570
1570
  zIndex: 10,
1571
1571
  width: "150px",
@@ -1601,7 +1601,7 @@ const zt = _(
1601
1601
  Q.id || w
1602
1602
  )) })
1603
1603
  ] });
1604
- }, qt = _(qe), re = gA.memo(({ text: e, onClose: i }) => {
1604
+ }, qt = _(qe), re = sA.memo(({ text: e, onClose: i }) => {
1605
1605
  var o, t;
1606
1606
  const r = zA();
1607
1607
  return /* @__PURE__ */ s(
@@ -1642,7 +1642,7 @@ const zt = _(
1642
1642
  ]
1643
1643
  }
1644
1644
  );
1645
- }), Te = gA.memo(({ items: e = [], onClose: i }) => /* @__PURE__ */ A(
1645
+ }), Te = sA.memo(({ items: e = [], onClose: i }) => /* @__PURE__ */ A(
1646
1646
  a,
1647
1647
  {
1648
1648
  direction: "row",
@@ -1672,10 +1672,10 @@ const zt = _(
1672
1672
  }
1673
1673
  let r = new Date(e);
1674
1674
  return r = typeof e != "object" ? void 0 : r, r;
1675
- }, Re = gA.memo(({ title: e, resetButton: i }) => /* @__PURE__ */ s(a, { direction: "row", justify: "space-between", marginBottom: "md", children: [
1675
+ }, Re = sA.memo(({ title: e, resetButton: i }) => /* @__PURE__ */ s(a, { direction: "row", justify: "space-between", marginBottom: "md", children: [
1676
1676
  /* @__PURE__ */ A(a, { children: /* @__PURE__ */ A(d, { fontWeight: "bold", children: e }) }),
1677
1677
  /* @__PURE__ */ A(a, { children: /* @__PURE__ */ A(BA, { onClick: i == null ? void 0 : i.onClick, children: /* @__PURE__ */ A(d, { fontWeight: "bold", color: "error", children: (i == null ? void 0 : i.label) || "Reset" }) }) })
1678
- ] })), ve = gA.memo(
1678
+ ] })), ve = sA.memo(
1679
1679
  ({ value: e, options: i = [], onChange: r, multiple: o }) => {
1680
1680
  const t = (e == null ? void 0 : e.map((c) => c.value)) || [], n = (i == null ? void 0 : i.filter((c) => t.includes(c.value))) || [], l = (c) => {
1681
1681
  const g = [...n];
@@ -1692,7 +1692,7 @@ const zt = _(
1692
1692
  g
1693
1693
  )) });
1694
1694
  }
1695
- ), oe = gA.memo(
1695
+ ), oe = sA.memo(
1696
1696
  KA(
1697
1697
  ({
1698
1698
  label: e,
@@ -1793,7 +1793,7 @@ const zt = _(
1793
1793
  ] });
1794
1794
  }
1795
1795
  )
1796
- ), Pe = gA.memo(
1796
+ ), Pe = sA.memo(
1797
1797
  ({
1798
1798
  show: e,
1799
1799
  title: i,
@@ -1847,7 +1847,7 @@ const zt = _(
1847
1847
  }
1848
1848
  ) });
1849
1849
  }
1850
- ), Ve = gA.memo(({ active: e, onClick: i }) => {
1850
+ ), Ve = sA.memo(({ active: e, onClick: i }) => {
1851
1851
  var o, t;
1852
1852
  const r = zA();
1853
1853
  return /* @__PURE__ */ A(
@@ -2058,7 +2058,7 @@ const nr = (e) => {
2058
2058
  }), r;
2059
2059
  }, cr = (e) => {
2060
2060
  var R;
2061
- const i = cA(() => ({ ...ei, ...e }), [e]), [r, o] = b(!1), [t, n] = b(!1), [l] = b(void 0), c = () => n(!0), g = () => n(!1), C = t ? g : c, Q = () => {
2061
+ const i = gA(() => ({ ...ei, ...e }), [e]), [r, o] = b(!1), [t, n] = b(!1), [l] = b(void 0), c = () => n(!0), g = () => n(!1), C = t ? g : c, Q = () => {
2062
2062
  o(!0);
2063
2063
  }, w = (x) => {
2064
2064
  o(x);
@@ -2398,6 +2398,21 @@ const nr = (e) => {
2398
2398
  children: /* @__PURE__ */ A(d, { color: "error", fontWeight: "semibold", children: "Reset" })
2399
2399
  }
2400
2400
  ) }),
2401
+ t == null ? void 0 : t.map(({ minWidth: z, content: iA, title: nA, onClickContainer: LA }) => /* @__PURE__ */ s(
2402
+ a,
2403
+ {
2404
+ gap: "sm",
2405
+ onClick: LA,
2406
+ style: {
2407
+ minWidth: z
2408
+ },
2409
+ children: [
2410
+ nA && /* @__PURE__ */ A(q.SubH3, { children: nA }),
2411
+ iA
2412
+ ]
2413
+ },
2414
+ (nA || "") + x
2415
+ )),
2401
2416
  !!(w != null && w.length) && /* @__PURE__ */ A(
2402
2417
  O,
2403
2418
  {
@@ -2502,21 +2517,6 @@ const nr = (e) => {
2502
2517
  ]
2503
2518
  }
2504
2519
  ),
2505
- t == null ? void 0 : t.map(({ minWidth: z, content: iA, title: sA, onClickContainer: LA }) => /* @__PURE__ */ s(
2506
- a,
2507
- {
2508
- gap: "sm",
2509
- onClick: LA,
2510
- style: {
2511
- minWidth: z
2512
- },
2513
- children: [
2514
- /* @__PURE__ */ A(q.SubH3, { children: sA }),
2515
- iA
2516
- ]
2517
- },
2518
- sA + x
2519
- )),
2520
2520
  /* @__PURE__ */ A(
2521
2521
  Ei,
2522
2522
  {
@@ -2601,7 +2601,8 @@ const nr = (e) => {
2601
2601
  paddingBottom: "8px",
2602
2602
  borderBottom: "1px solid var(--starasia-ui-utility-fill-default)",
2603
2603
  flexShrink: 0,
2604
- zIndex: 2,
2604
+ position: "relative",
2605
+ zIndex: 10,
2605
2606
  flexDirection: o ? "row" : "column-reverse",
2606
2607
  gap: "16px"
2607
2608
  },
@@ -2716,7 +2717,7 @@ const nr = (e) => {
2716
2717
  }
2717
2718
  );
2718
2719
  }, Si = ({ filter: e, columnTitle: i }) => {
2719
- const [r, o] = b(!1), t = eA(null), n = eA(null), l = eA(null), [c, g] = b(""), [C, Q] = b({ top: 0, left: 0 }), w = e.selectedValues, B = cA(() => c ? e.options.filter(
2720
+ const [r, o] = b(!1), t = eA(null), n = eA(null), l = eA(null), [c, g] = b(""), [C, Q] = b({ top: 0, left: 0 }), w = e.selectedValues, B = gA(() => c ? e.options.filter(
2720
2721
  (h) => h.label.toLowerCase().includes(c.toLowerCase())
2721
2722
  ) : e.options, [e.options, c]);
2722
2723
  W(() => {
@@ -3158,11 +3159,11 @@ const nr = (e) => {
3158
3159
  }
3159
3160
  ),
3160
3161
  /* @__PURE__ */ A(Qe, { children: n ? /* @__PURE__ */ A(QA, { children: /* @__PURE__ */ A(CA, { colSpan: e.length + 1, children: /* @__PURE__ */ s(a, { style: { gap: "16px" }, children: [
3161
- /* @__PURE__ */ A(lA, { variant: "list" }),
3162
- /* @__PURE__ */ A(lA, { variant: "list" }),
3163
- /* @__PURE__ */ A(lA, { variant: "list" }),
3164
- /* @__PURE__ */ A(lA, { variant: "list" }),
3165
- /* @__PURE__ */ A(lA, { variant: "list" })
3162
+ /* @__PURE__ */ A(cA, { variant: "list" }),
3163
+ /* @__PURE__ */ A(cA, { variant: "list" }),
3164
+ /* @__PURE__ */ A(cA, { variant: "list" }),
3165
+ /* @__PURE__ */ A(cA, { variant: "list" }),
3166
+ /* @__PURE__ */ A(cA, { variant: "list" })
3166
3167
  ] }) }) }) : !(i != null && i.length) && h ? /* @__PURE__ */ A(QA, { children: /* @__PURE__ */ A(CA, { colSpan: e.length + 1, children: h }) }) : i == null ? void 0 : i.map((k, G) => /* @__PURE__ */ s(
3167
3168
  QA,
3168
3169
  {
@@ -3252,7 +3253,7 @@ const nr = (e) => {
3252
3253
  onClick: () => t(k.id, k),
3253
3254
  iconLeft: /* @__PURE__ */ A(M, { name: "Trash1", size: "sm", style: { color: "rgb(var(--starasia-ui-raw-color-red-600))" } })
3254
3255
  }
3255
- ) }, "delete") : E === "custom" ? /* @__PURE__ */ A(gA.Fragment, { children: I == null ? void 0 : I(k) }, "custom") : null;
3256
+ ) }, "delete") : E === "custom" ? /* @__PURE__ */ A(sA.Fragment, { children: I == null ? void 0 : I(k) }, "custom") : null;
3256
3257
  }) }) }) : null
3257
3258
  ]
3258
3259
  },
@@ -3470,9 +3471,9 @@ const Qr = bi(Oi), kA = ({
3470
3471
  condition: !!(o != null && o.length),
3471
3472
  isLoading: c,
3472
3473
  loading: /* @__PURE__ */ s(a, { marginTop: "sm", gap: "md", children: [
3473
- /* @__PURE__ */ A(lA, { variant: "list" }),
3474
- /* @__PURE__ */ A(lA, { variant: "list" }),
3475
- /* @__PURE__ */ A(lA, { variant: "list" })
3474
+ /* @__PURE__ */ A(cA, { variant: "list" }),
3475
+ /* @__PURE__ */ A(cA, { variant: "list" }),
3476
+ /* @__PURE__ */ A(cA, { variant: "list" })
3476
3477
  ] }),
3477
3478
  children: /* @__PURE__ */ A(
3478
3479
  YA,
@@ -3825,7 +3826,7 @@ const Qr = bi(Oi), kA = ({
3825
3826
  color: e.color || "gray-700",
3826
3827
  children: e.children
3827
3828
  }
3828
- ), nA = (e) => /* @__PURE__ */ A(d, { color: "red-600", fontSize: "sm", children: e.message }), Ni = ({
3829
+ ), lA = (e) => /* @__PURE__ */ A(d, { color: "red-600", fontSize: "sm", children: e.message }), Ni = ({
3829
3830
  size: e = "md",
3830
3831
  direction: i = "vertical",
3831
3832
  requiredTitle: r = "(Required)",
@@ -3904,7 +3905,7 @@ const Qr = bi(Oi), kA = ({
3904
3905
  fullWidth: !0
3905
3906
  }
3906
3907
  ),
3907
- !n && t.errorMessage && /* @__PURE__ */ A(nA, { message: t.errorMessage }),
3908
+ !n && t.errorMessage && /* @__PURE__ */ A(lA, { message: t.errorMessage }),
3908
3909
  t.inputProps.extended && t.inputProps.extended
3909
3910
  ] })
3910
3911
  ]
@@ -3995,7 +3996,7 @@ const Qr = bi(Oi), kA = ({
3995
3996
  )
3996
3997
  }
3997
3998
  ),
3998
- !n && t.errorMessage && /* @__PURE__ */ A(nA, { message: t.errorMessage }),
3999
+ !n && t.errorMessage && /* @__PURE__ */ A(lA, { message: t.errorMessage }),
3999
4000
  t.inputProps.extended && t.inputProps.extended
4000
4001
  ] })
4001
4002
  ]
@@ -4311,7 +4312,7 @@ const Ji = (e) => {
4311
4312
  status: t.errorMessage ? "error" : "default"
4312
4313
  }
4313
4314
  ),
4314
- !n && t.errorMessage && /* @__PURE__ */ A(nA, { message: t.errorMessage })
4315
+ !n && t.errorMessage && /* @__PURE__ */ A(lA, { message: t.errorMessage })
4315
4316
  ] })
4316
4317
  ]
4317
4318
  }
@@ -4435,7 +4436,7 @@ const Ji = (e) => {
4435
4436
  )
4436
4437
  }
4437
4438
  ),
4438
- !l && n.errorMessage && /* @__PURE__ */ A(nA, { message: n.errorMessage })
4439
+ !l && n.errorMessage && /* @__PURE__ */ A(lA, { message: n.errorMessage })
4439
4440
  ]
4440
4441
  }
4441
4442
  );
@@ -4513,7 +4514,7 @@ const Ji = (e) => {
4513
4514
  )
4514
4515
  }
4515
4516
  ),
4516
- o.errorMessage && /* @__PURE__ */ A(nA, { message: o.errorMessage })
4517
+ o.errorMessage && /* @__PURE__ */ A(lA, { message: o.errorMessage })
4517
4518
  ]
4518
4519
  }
4519
4520
  );
@@ -4595,7 +4596,7 @@ const Ji = (e) => {
4595
4596
  status: t.errorMessage ? "error" : "default"
4596
4597
  }
4597
4598
  ),
4598
- !n && t.errorMessage && /* @__PURE__ */ A(nA, { message: t.errorMessage })
4599
+ !n && t.errorMessage && /* @__PURE__ */ A(lA, { message: t.errorMessage })
4599
4600
  ] })
4600
4601
  ]
4601
4602
  }
@@ -4678,7 +4679,7 @@ const Ji = (e) => {
4678
4679
  description: n.description
4679
4680
  }
4680
4681
  ),
4681
- n.errorMessage && /* @__PURE__ */ A(nA, { message: n.errorMessage })
4682
+ n.errorMessage && /* @__PURE__ */ A(lA, { message: n.errorMessage })
4682
4683
  ]
4683
4684
  }
4684
4685
  );
@@ -4820,7 +4821,7 @@ const Ji = (e) => {
4820
4821
  )
4821
4822
  }
4822
4823
  ),
4823
- !n && t.errorMessage && /* @__PURE__ */ A(nA, { message: t.errorMessage })
4824
+ !n && t.errorMessage && /* @__PURE__ */ A(lA, { message: t.errorMessage })
4824
4825
  ] })
4825
4826
  ]
4826
4827
  }
@@ -4885,8 +4886,8 @@ const vA = {
4885
4886
  },
4886
4887
  []
4887
4888
  ), AA = (J) => {
4888
- var sA;
4889
- const z = (sA = J.target.files) == null ? void 0 : sA[0];
4889
+ var nA;
4890
+ const z = (nA = J.target.files) == null ? void 0 : nA[0];
4890
4891
  if (!z) return;
4891
4892
  const iA = new FileReader();
4892
4893
  iA.onload = () => {
@@ -5163,7 +5164,7 @@ const vA = {
5163
5164
  ),
5164
5165
  /* @__PURE__ */ s(T, { gap: "xs", children: [
5165
5166
  /* @__PURE__ */ A(_i, { ...n.inputProps }),
5166
- !l && n.errorMessage && /* @__PURE__ */ A(nA, { message: n.errorMessage })
5167
+ !l && n.errorMessage && /* @__PURE__ */ A(lA, { message: n.errorMessage })
5167
5168
  ] })
5168
5169
  ]
5169
5170
  }
@@ -6968,7 +6969,7 @@ const Gr = () => {
6968
6969
  function Or(e) {
6969
6970
  var o, t;
6970
6971
  const i = e.decodedAccessToken;
6971
- return cA(() => {
6972
+ return gA(() => {
6972
6973
  var g, C;
6973
6974
  const n = ((C = (g = i == null ? void 0 : i.access) == null ? void 0 : g.role) == null ? void 0 : C.code) ?? "", l = Object.keys(e.role).reduce(
6974
6975
  (Q, w) => {