@realtek/core-theme 0.0.214 → 0.0.215

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-lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { C as e, E as t, S as n, T as r, _ as i, a, b as o, c as s, d as c, f as l, g as u, h as d, i as f, l as p, m, n as h, o as g, p as _, r as v, s as y, t as b, u as x, v as S, w as C, x as w, y as T } from "./authApi-CVxnHdIU.js";
2
- import { $ as E, $t as D, A as O, An as k, At as A, B as j, Bn as M, Bt as ee, C as N, Cn as te, Ct as ne, D as re, Dn as ie, Dt as ae, E as oe, En as se, Et as P, F as ce, Fn as le, Ft as ue, G as de, Gn as fe, Gt as pe, H as me, Hn as he, Ht as ge, I as _e, In as ve, It as ye, J as be, Jn as xe, Jt as Se, K as Ce, Kn as we, Kt as Te, L as Ee, Ln as De, Lt as Oe, M as ke, Mn as Ae, Mt as je, N as Me, Nn as Ne, Nt as Pe, O as Fe, On as Ie, Ot as Le, P as Re, Pn as ze, Pt as Be, Q as Ve, Qn as He, Qt as Ue, R as We, Rn as Ge, Rt as Ke, S as qe, Sn as Je, St as Ye, T as Xe, Tn as Ze, Tt as Qe, U as $e, Un as et, Ut as tt, V as nt, Vn as rt, Vt as it, W as at, Wn as ot, Wt as st, X as ct, Xn as F, Xt as lt, Y as ut, Yn as dt, Yt as ft, Z as pt, Zn as mt, Zt as ht, _ as gt, _n as _t, _t as vt, a as yt, an as bt, at as xt, b as St, bn as Ct, bt as wt, c as Tt, cn as Et, ct as Dt, d as Ot, dn as kt, dt as At, en as jt, et as Mt, f as Nt, fn as Pt, ft as Ft, g as It, gn as Lt, gt as Rt, h as zt, hn as Bt, ht as Vt, i as Ht, in as Ut, it as Wt, j as Gt, jn as Kt, jt as qt, k as Jt, kn as Yt, kt as Xt, l as Zt, ln as Qt, lt as $t, m as en, mn as tn, mt as nn, n as rn, nn as an, nt as on, o as sn, on as cn, ot as ln, p as un, pn as dn, pt as fn, q as pn, qn as mn, qt as hn, r as gn, rn as _n, rt as vn, s as yn, sn as bn, st as xn, t as Sn, tn as Cn, tt as wn, u as Tn, un as En, ut as Dn, v as On, vn as kn, vt as An, w as jn, wn as Mn, wt as Nn, x as Pn, xn as Fn, xt as In, y as Ln, yn as Rn, yt as zn, z as Bn, zn as Vn, zt as Hn } from "./Breadcrumb-DD4Cy0gv.js";
2
+ import { $ as E, $t as D, A as O, An as k, At as A, B as j, Bn as M, Bt as ee, C as N, Cn as te, Ct as ne, D as re, Dn as ie, Dt as ae, E as oe, En as se, Et as P, F as ce, Fn as le, Ft as ue, G as de, Gn as fe, Gt as pe, H as me, Hn as he, Ht as ge, I as _e, In as ve, It as ye, J as be, Jn as xe, Jt as Se, K as Ce, Kn as we, Kt as Te, L as Ee, Ln as De, Lt as Oe, M as ke, Mn as Ae, Mt as je, N as Me, Nn as Ne, Nt as Pe, O as Fe, On as Ie, Ot as Le, P as Re, Pn as ze, Pt as Be, Q as Ve, Qn as He, Qt as Ue, R as We, Rn as Ge, Rt as Ke, S as qe, Sn as Je, St as Ye, T as Xe, Tn as Ze, Tt as Qe, U as $e, Un as et, Ut as tt, V as nt, Vn as rt, Vt as it, W as at, Wn as ot, Wt as st, X as ct, Xn as F, Xt as lt, Y as ut, Yn as dt, Yt as ft, Z as pt, Zn as mt, Zt as ht, _ as gt, _n as _t, _t as vt, a as yt, an as bt, at as xt, b as St, bn as Ct, bt as wt, c as Tt, cn as Et, ct as Dt, d as Ot, dn as kt, dt as At, en as jt, et as Mt, f as Nt, fn as Pt, ft as Ft, g as It, gn as Lt, gt as Rt, h as zt, hn as Bt, ht as Vt, i as Ht, in as Ut, it as Wt, j as Gt, jn as Kt, jt as qt, k as Jt, kn as Yt, kt as Xt, l as Zt, ln as Qt, lt as $t, m as en, mn as tn, mt as nn, n as rn, nn as an, nt as on, o as sn, on as cn, ot as ln, p as un, pn as dn, pt as fn, q as pn, qn as mn, qt as hn, r as gn, rn as _n, rt as vn, s as yn, sn as bn, st as xn, t as Sn, tn as Cn, tt as wn, u as Tn, un as En, ut as Dn, v as On, vn as kn, vt as An, w as jn, wn as Mn, wt as Nn, x as Pn, xn as Fn, xt as In, y as Ln, yn as Rn, yt as zn, z as Bn, zn as Vn, zt as Hn } from "./Breadcrumb-C8GAMPzl.js";
3
3
  import { i as Un } from "./diceCandidateMapper-BKRGwz7g.js";
4
4
  import Wn, { Fragment as Gn, createContext as Kn, useCallback as qn, useContext as Jn, useEffect as I, useMemo as L, useRef as Yn, useState as R } from "react";
5
5
  import { Alert as Xn, AutoComplete as Zn, Avatar as Qn, Badge as $n, Breadcrumb as er, Button as z, Card as tr, Checkbox as nr, Col as B, Collapse as rr, DatePicker as ir, Divider as ar, Drawer as or, Dropdown as sr, Empty as cr, Flex as lr, Form as V, Input as H, InputNumber as ur, Layout as dr, Mentions as fr, Menu as pr, Modal as mr, Pagination as hr, Popconfirm as gr, Popover as _r, Progress as vr, Radio as yr, Result as br, Row as xr, Select as U, Space as W, Spin as Sr, Statistic as Cr, Steps as wr, Switch as G, Table as Tr, Tabs as Er, Tag as K, TimePicker as Dr, Tooltip as q, Tree as Or, Typography as kr, Upload as Ar, message as J } from "antd";
@@ -6063,7 +6063,7 @@ function ip(e, t) {
6063
6063
  }
6064
6064
  }
6065
6065
  function ap(e) {
6066
- if (Array.isArray(e)) return e;
6066
+ if (Array.isArray(e)) return e.flatMap((e) => ap(e));
6067
6067
  if (!e || typeof e != "object") return [];
6068
6068
  let t = e.uploadedFileName ?? e.name ?? Object.entries(e).find(([e]) => e.endsWith("UploadName"))?.[1] ?? "", n = e.location ?? e.url ?? Object.entries(e).find(([e]) => e.endsWith("CopyLocation"))?.[1] ?? "";
6069
6069
  return !t && !n ? [] : [{
@@ -6071,7 +6071,8 @@ function ap(e) {
6071
6071
  name: t || "file",
6072
6072
  status: "done",
6073
6073
  url: n,
6074
- existing: !0
6074
+ existing: !0,
6075
+ stored: e
6075
6076
  }];
6076
6077
  }
6077
6078
  var op = (e) => e == null || e === "", sp = (e) => String(e).replace(/<[^>]*>/g, "").replace(/&nbsp;/g, " ").replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").trim(), cp = ({ label: e, message: t, value: n, compare: r, text: i }) => ({ validator: (a, o) => op(o) || r(Number(o), Number(n)) ? Promise.resolve() : Promise.reject(Error(t ?? `${e} ${i} ${n}`)) });
@@ -9468,15 +9469,20 @@ function ah({ field: e }) {
9468
9469
  className: "v1-detail-value",
9469
9470
  style: d,
9470
9471
  children: h(e)
9471
- }), _ = (e) => /* @__PURE__ */ X("span", {
9472
+ }), _ = (e) => /* @__PURE__ */ X(Um, {
9473
+ strong: !0,
9474
+ className: "v1-detail-value v1-detail-token",
9475
+ style: d,
9476
+ children: h(e)
9477
+ }), v = (e) => /* @__PURE__ */ X("span", {
9472
9478
  className: "v1-detail-value v1-detail-tags",
9473
9479
  children: /* @__PURE__ */ X(K, {
9474
9480
  color: f,
9475
9481
  children: h(e)
9476
9482
  })
9477
- }), v = th(e);
9478
- if (v !== "document" && Wm(t) && !s.showEmpty) return g(l);
9479
- switch (v) {
9483
+ }), y = th(e);
9484
+ if (y !== "document" && Wm(t) && !s.showEmpty) return g(l);
9485
+ switch (y) {
9480
9486
  case "document": return /* @__PURE__ */ X(rh, {
9481
9487
  value: t,
9482
9488
  mode: s.documentMode || "preview",
@@ -9485,7 +9491,7 @@ function ah({ field: e }) {
9485
9491
  });
9486
9492
  case "text": return g(m(Qm(t, o, u)));
9487
9493
  case "tag":
9488
- case "chip": return _(m(Qm(t, o, u)));
9494
+ case "chip": return v(m(Qm(t, o, u)));
9489
9495
  case "badge": {
9490
9496
  let e = h(Qm(t, o, u));
9491
9497
  return /* @__PURE__ */ X("span", {
@@ -9533,7 +9539,7 @@ function ah({ field: e }) {
9533
9539
  case "phone": {
9534
9540
  let e = Qm(t, !1, u), n = nh(e);
9535
9541
  return /* @__PURE__ */ Z("a", {
9536
- className: "v1-detail-value",
9542
+ className: "v1-detail-value v1-detail-token",
9537
9543
  href: `tel:${e.replace(/[^0-9+]/g, "")}`,
9538
9544
  children: [
9539
9545
  /* @__PURE__ */ X(Ki, {}),
@@ -9544,12 +9550,12 @@ function ah({ field: e }) {
9544
9550
  }
9545
9551
  case "date": {
9546
9552
  let e = La(t), n = s.dateFormat || c.dateFormat;
9547
- return g(m(e.isValid() ? e.format(n) : Qm(t, o, u)));
9553
+ return _(m(e.isValid() ? e.format(n) : Qm(t, o, u)));
9548
9554
  }
9549
- case "currency": return g(m(ih(t, s)));
9555
+ case "currency": return _(m(ih(t, s)));
9550
9556
  case "budget": {
9551
9557
  let e = ih(t, s), n = s.unit ? String(s.unit) : "", r = n && s.budgetUnitMap ? s.budgetUnitMap[n] ?? n : n;
9552
- return g(`${e}${r ? `/${r}` : ""}`);
9558
+ return _(`${e}${r ? `/${r}` : ""}`);
9553
9559
  }
9554
9560
  case "html": return /* @__PURE__ */ X("span", {
9555
9561
  className: "v1-detail-value",
@@ -9559,8 +9565,8 @@ function ah({ field: e }) {
9559
9565
  default: break;
9560
9566
  }
9561
9567
  if (Wm(t)) return g(l);
9562
- let y = n === "date", b = typeof t == "string" && Gm.test(t.trim());
9563
- if (y || b) {
9568
+ let b = n === "date", x = typeof t == "string" && Gm.test(t.trim());
9569
+ if (b || x) {
9564
9570
  let e = La(t);
9565
9571
  if (e.isValid()) return g(m(e.format(c.dateFormat)));
9566
9572
  }
@@ -9738,25 +9744,66 @@ function mh({ moduleName: e, id: t, refreshKey: n = 0, onDescriptionSaved: r })
9738
9744
  if (t.isValid()) return t.format(e?.renderOptions?.dateFormat || Mt().dateFormat);
9739
9745
  }
9740
9746
  return (e?.formatter === "phone" || e?.type === "phone") && E(n) || n;
9741
- }, k = (e, t, n, r) => {
9742
- let i = e.map((e) => O(e, n(e).value)).filter((e) => e !== ""), a = typeof t.combineLabel == "string" && t.combineLabel.trim() ? t.combineLabel : t.label ?? t.field;
9743
- return /* @__PURE__ */ X(B, {
9744
- xs: 24,
9745
- sm: 12,
9746
- lg: t.detailCol ?? t.col ?? 8,
9747
+ }, k = (e, t) => {
9748
+ let n = String(e?.label ?? "").trim();
9749
+ if (!n) return "";
9750
+ let r = String(t ?? "").toLowerCase().split(/[\s/]+/).filter(Boolean), i = n.split(/\s+/), a = 0;
9751
+ for (; a < i.length;) {
9752
+ let e = i[a].toLowerCase();
9753
+ if (!r.some((t) => t === e || t.startsWith(e) || e.startsWith(t))) break;
9754
+ a += 1;
9755
+ }
9756
+ return i.slice(a).join(" ").trim();
9757
+ }, A = (e, t, n, r) => {
9758
+ let i = e.map((e) => ({
9759
+ field: e,
9760
+ cell: n(e)
9761
+ })), a = i.filter(({ cell: e }) => ee(e)).map(({ cell: e }) => ({
9762
+ ...e,
9763
+ renderType: "document"
9764
+ })).filter((e) => Me(e.value).length > 0), o = typeof t.combineLabel == "string" && t.combineLabel.trim() ? t.combineLabel : t.label ?? t.field, s = i.filter(({ cell: e }) => !ee(e)).map(({ field: e, cell: t }) => ({
9765
+ key: e.field,
9766
+ label: k(e, o),
9767
+ text: O(e, t.value)
9768
+ })).filter((e) => e.text !== ""), c = s.map((e) => `${e.label ? `${e.label} ` : ""}${e.text}`).join(" · "), l = C({
9769
+ detailCol: t.detailCol,
9770
+ value: c
9771
+ });
9772
+ return /* @__PURE__ */ X("div", {
9773
+ className: "v1-detail-cell v1-detail-cell--wrap",
9774
+ style: { "--v1-cell-span": a.length ? Math.max(l, 2) : l },
9747
9775
  children: /* @__PURE__ */ Z("div", {
9748
9776
  className: "v1-detail-field",
9749
- children: [/* @__PURE__ */ X(oh, {
9750
- type: "secondary",
9751
- className: "v1-detail-label",
9752
- children: a
9753
- }), /* @__PURE__ */ X("div", {
9754
- className: "v1-detail-value",
9755
- children: i.length ? i.join(" · ") : "—"
9756
- })]
9777
+ children: [
9778
+ /* @__PURE__ */ X(oh, {
9779
+ type: "secondary",
9780
+ className: "v1-detail-label",
9781
+ title: o,
9782
+ children: o
9783
+ }),
9784
+ (s.length > 0 || a.length === 0) && /* @__PURE__ */ X("div", {
9785
+ className: "v1-detail-value v1-detail-parts",
9786
+ children: s.length ? s.map((e, t) => /* @__PURE__ */ Z("span", {
9787
+ className: "v1-detail-part",
9788
+ children: [
9789
+ t > 0 && /* @__PURE__ */ X("span", {
9790
+ className: "v1-detail-part-sep",
9791
+ "aria-hidden": "true",
9792
+ children: "·"
9793
+ }),
9794
+ e.label && /* @__PURE__ */ X("span", {
9795
+ className: "v1-detail-part-label",
9796
+ children: e.label
9797
+ }),
9798
+ /* @__PURE__ */ X("span", { children: e.text })
9799
+ ]
9800
+ }, `${e.key}-part`)) : "—"
9801
+ }),
9802
+ a.map((e) => /* @__PURE__ */ X(ah, { field: e }, `${e.field}-doc`))
9803
+ ]
9757
9804
  })
9758
9805
  }, `${t.field}-merged${r}`);
9759
- }, A = (e, t, n = "") => {
9806
+ }, j = (e, t, n = "") => {
9760
9807
  let r = /* @__PURE__ */ new Set(), i = [];
9761
9808
  return e.forEach((a) => {
9762
9809
  let o = a.combineKey?.trim?.();
@@ -9766,13 +9813,13 @@ function mh({ moduleName: e, id: t, refreshKey: n = 0, onDescriptionSaved: r })
9766
9813
  let a = e.filter((e) => e.combineKey?.trim?.() === o);
9767
9814
  if (a.length > 1) {
9768
9815
  let e = a.find((e) => e.combineLabel) ?? a[0];
9769
- i.push(k(a, e, t, n));
9816
+ i.push(A(a, e, t, n));
9770
9817
  return;
9771
9818
  }
9772
9819
  }
9773
9820
  i.push(T(t(a), n));
9774
9821
  }), i;
9775
- }, j = L(() => {
9822
+ }, M = L(() => {
9776
9823
  let e = {};
9777
9824
  for (let t of g) {
9778
9825
  let n = t.fieldName || t.field || "file";
@@ -9783,7 +9830,25 @@ function mh({ moduleName: e, id: t, refreshKey: n = 0, onDescriptionSaved: r })
9783
9830
  });
9784
9831
  }
9785
9832
  return e;
9786
- }, [g]), M = (e) => e.type === "file" || e.type === "document" || e.renderType === "document", ee = (e) => j[e.field] || e.fileKey && j[e.fileKey] || null, N = (e, t) => {
9833
+ }, [g]), ee = (e) => e.type === "file" || e.type === "document" || e.renderType === "document", N = (e) => M[e.field] || e.fileKey && M[e.fileKey] || null, te = (e) => String(e?.name || e?.location || "").trim().toLowerCase(), ne = (e) => {
9834
+ let [t] = Me(e);
9835
+ return !t || !t.location && !t.url ? null : te(t);
9836
+ }, re = (e, t = []) => {
9837
+ let n = /* @__PURE__ */ new Set(), r = [], i = (e) => {
9838
+ if (e == null || e === "") return;
9839
+ let t = ne(e);
9840
+ t !== null && (t && n.has(t) || (t && n.add(t), r.push(e)));
9841
+ };
9842
+ return t.forEach(i), (Array.isArray(e) ? e : [e]).forEach(i), r;
9843
+ }, ie = (e) => Me(e).map(te).filter(Boolean), ae = (e) => {
9844
+ let t = (e.validations ?? []).find((e) => e?.type === "maxFiles");
9845
+ return t ? Math.max(1, Number(t.value ?? 1)) : ch(e.multiple) ? Math.max(1, Number(e.maxCount ?? 5)) : Math.max(1, Number(e.maxCount ?? 1));
9846
+ }, oe = (e, t, n) => {
9847
+ let r = ae(e);
9848
+ if (t.length <= r) return t;
9849
+ let [i] = ie(n);
9850
+ return (i ? [...t].sort((e, t) => Number(ne(t) === i) - Number(ne(e) === i)) : t).slice(0, r);
9851
+ }, se = (e, t) => {
9787
9852
  if (e.type === "file" || e.type === "document") return {
9788
9853
  ...e,
9789
9854
  renderType: "document",
@@ -9794,24 +9859,29 @@ function mh({ moduleName: e, id: t, refreshKey: n = 0, onDescriptionSaved: r })
9794
9859
  ...e,
9795
9860
  value: n
9796
9861
  };
9797
- }, te = (e) => {
9798
- if (!M(e)) return e;
9799
- let t = ee(e);
9800
- return t && t.length ? {
9862
+ }, P = (e) => {
9863
+ if (!ee(e)) return e;
9864
+ let t = oe(e, re(e.value, N(e) ?? []), e.value);
9865
+ return t.length ? {
9801
9866
  ...e,
9802
9867
  renderType: "document",
9803
9868
  value: t
9804
9869
  } : e;
9805
- }, ne = (e, t, n) => {
9806
- let r = e.name ?? e.id ?? String(t), i = Array.isArray(e.rows) ? e.rows : [];
9807
- return /* @__PURE__ */ X(tr, {
9870
+ }, ce = (e, t, n) => {
9871
+ let r = e.name ?? e.id ?? String(t), i = Array.isArray(e.rows) ? e.rows : [], a = new Set(i.flatMap((e) => ie(e))), o = [], s = /* @__PURE__ */ new Set();
9872
+ return n.filter(ee).forEach((e) => {
9873
+ (N(e) ?? []).forEach((e) => {
9874
+ let t = te(e);
9875
+ !t || a.has(t) || s.has(t) || (s.add(t), o.push(e));
9876
+ });
9877
+ }), /* @__PURE__ */ Z(tr, {
9808
9878
  size: "small",
9809
9879
  className: "v1-card v1-detail-card",
9810
9880
  title: /* @__PURE__ */ X(fh, {
9811
9881
  icon: sh[t % sh.length],
9812
9882
  title: e.label ?? e.name ?? "Details"
9813
9883
  }),
9814
- children: i.length === 0 ? /* @__PURE__ */ X(cr, {
9884
+ children: [i.length === 0 && o.length === 0 ? /* @__PURE__ */ X(cr, {
9815
9885
  image: cr.PRESENTED_IMAGE_SIMPLE,
9816
9886
  description: `No ${e.label ?? "records"} added`
9817
9887
  }) : i.map((t, r) => /* @__PURE__ */ Z("div", {
@@ -9826,9 +9896,21 @@ function mh({ moduleName: e, id: t, refreshKey: n = 0, onDescriptionSaved: r })
9826
9896
  ]
9827
9897
  }), /* @__PURE__ */ X("div", {
9828
9898
  className: "v1-detail-grid",
9829
- children: A(n, (e) => N(e, t), `-${r}`)
9899
+ children: j(n, (e) => se(e, t), `-${r}`)
9830
9900
  })]
9831
- }, r))
9901
+ }, r)), o.length > 0 && /* @__PURE__ */ X("div", {
9902
+ className: "v1-detail-addrow-item",
9903
+ children: /* @__PURE__ */ X("div", {
9904
+ className: "v1-detail-grid",
9905
+ children: T({
9906
+ field: `${r}-files`,
9907
+ label: "Uploaded Files",
9908
+ renderType: "document",
9909
+ detailCol: 24,
9910
+ value: o
9911
+ })
9912
+ })
9913
+ })]
9832
9914
  }, r);
9833
9915
  };
9834
9916
  return /* @__PURE__ */ X(Sr, {
@@ -9847,7 +9929,7 @@ function mh({ moduleName: e, id: t, refreshKey: n = 0, onDescriptionSaved: r })
9847
9929
  !o && !c && v.length === 0 && /* @__PURE__ */ X(cr, { description: "No detail fields are configured." }),
9848
9930
  v.map((e, t) => {
9849
9931
  let n = e.name ?? e.id ?? String(t), r = b ? e.fields.filter((e) => e.field !== b.key) : e.fields;
9850
- return r.length ? e.addRow ? ne(e, t, r) : /* @__PURE__ */ X(tr, {
9932
+ return r.length ? e.addRow ? ce(e, t, r) : /* @__PURE__ */ X(tr, {
9851
9933
  size: "small",
9852
9934
  className: "v1-card v1-detail-card",
9853
9935
  title: /* @__PURE__ */ X(fh, {
@@ -9856,7 +9938,7 @@ function mh({ moduleName: e, id: t, refreshKey: n = 0, onDescriptionSaved: r })
9856
9938
  }),
9857
9939
  children: /* @__PURE__ */ X("div", {
9858
9940
  className: "v1-detail-grid",
9859
- children: A(r, te)
9941
+ children: j(r, P)
9860
9942
  })
9861
9943
  }, n) : null;
9862
9944
  }),
@@ -27011,7 +27093,7 @@ function HC() {
27011
27093
  }));
27012
27094
  t(n);
27013
27095
  let r = DC(n);
27014
- a(OC(r)), D("all", r);
27096
+ a(OC(r)), A("all", r);
27015
27097
  }).catch(() => t([])).finally(() => r(!1));
27016
27098
  }, []), I(() => {
27017
27099
  Pe({ limit: 200 }).then(_).catch(() => _([]));
@@ -27025,45 +27107,49 @@ function HC() {
27025
27107
  }
27026
27108
  }));
27027
27109
  }
27028
- function D(e, t) {
27029
- (t ?? w).find((t) => t.key === e) && (E(e, {
27110
+ let D = (e) => e !== "all" && !!(v.clientId || v.region), O = (e) => D(e) ? v : {}, k = (e) => D(e) ? `${v.clientId}|${v.region}` : "";
27111
+ function A(e, t) {
27112
+ if (!(t ?? w).find((t) => t.key === e)) return;
27113
+ let n = k(e);
27114
+ E(e, {
27030
27115
  loading: !0,
27031
27116
  error: ""
27032
- }), Be(e === "all" ? "" : e, e === "jobs" ? v : {}).then((t) => E(e, {
27117
+ }), Be(e === "all" ? "" : e, O(e)).then((t) => E(e, {
27033
27118
  groups: t,
27034
27119
  loading: !1,
27035
- loaded: !0
27120
+ loaded: !0,
27121
+ scopeKey: n
27036
27122
  })).catch((t) => E(e, {
27037
27123
  error: t.message || "Could not load groups",
27038
27124
  loading: !1
27039
- })));
27125
+ }));
27040
27126
  }
27041
- function O(e) {
27042
- D(e, null);
27127
+ function j(e) {
27128
+ A(e, null);
27043
27129
  }
27044
- function k(e) {
27045
- s(e), i[e]?.loaded || O(e);
27130
+ function M(e) {
27131
+ s(e), (!i[e]?.loaded || i[e]?.scopeKey !== k(e)) && j(e);
27046
27132
  }
27047
- function A() {
27133
+ function ee() {
27048
27134
  d(null), l(!0);
27049
27135
  }
27050
- function j(e) {
27136
+ function N(e) {
27051
27137
  d(e), l(!0);
27052
27138
  }
27053
- function M() {
27139
+ function te() {
27054
27140
  l(!1), d(null);
27055
27141
  }
27056
- async function ee() {
27057
- M(), O(o), o !== "all" && O("all");
27142
+ async function ne() {
27143
+ te(), j(o), o !== "all" && j("all");
27058
27144
  }
27059
- async function N(e) {
27145
+ async function re(e) {
27060
27146
  try {
27061
- await Ye(e), J.success("Group deleted"), O(o), o !== "all" && O("all");
27147
+ await Ye(e, se()), J.success("Group deleted"), j(o), o !== "all" && j("all");
27062
27148
  } catch (e) {
27063
27149
  J.error(e.message || "Could not delete group");
27064
27150
  }
27065
27151
  }
27066
- async function te(e) {
27152
+ async function ie(e) {
27067
27153
  let t = e.map((e, t) => ({
27068
27154
  g: e,
27069
27155
  index: t
@@ -27072,37 +27158,48 @@ function HC() {
27072
27158
  await Promise.all(t.map(({ g: e, index: t }) => Ie(e.id, {
27073
27159
  ...e,
27074
27160
  order: t
27075
- }, ie(e.module || o)))), J.success("Group order updated"), O(o), o !== "all" && O("all");
27161
+ }, se(e.module || o)))), J.success("Group order updated"), j(o), o !== "all" && j("all");
27076
27162
  } catch (e) {
27077
- J.error(e.message || "Could not reorder groups"), O(o);
27163
+ J.error(e.message || "Could not reorder groups"), j(o);
27078
27164
  }
27079
27165
  }
27080
- function ne(e) {
27166
+ function ae(e) {
27081
27167
  p(hC[e]);
27082
27168
  }
27083
- function re(e) {
27169
+ function oe(e) {
27084
27170
  let t = {
27085
27171
  ...v,
27086
27172
  ...e
27087
27173
  };
27088
- y(t), o === "jobs" && (E("jobs", {
27174
+ if (y(t), a((e) => {
27175
+ let t = {};
27176
+ for (let [n, r] of Object.entries(e)) t[n] = n === o ? r : {
27177
+ ...r,
27178
+ loaded: !1
27179
+ };
27180
+ return t;
27181
+ }), o === "all") return;
27182
+ let n = t.clientId || t.region ? t : {};
27183
+ E(o, {
27089
27184
  loading: !0,
27090
27185
  error: ""
27091
- }), Be("jobs", t).then((e) => E("jobs", {
27186
+ }), Be(o, n).then((e) => E(o, {
27092
27187
  groups: e,
27093
- loading: !1
27094
- })).catch((e) => E("jobs", {
27188
+ loading: !1,
27189
+ loaded: !0,
27190
+ scopeKey: t.clientId || t.region ? `${t.clientId}|${t.region}` : ""
27191
+ })).catch((e) => E(o, {
27095
27192
  error: e.message || "Could not load scoped groups",
27096
27193
  loading: !1
27097
- })));
27194
+ }));
27098
27195
  }
27099
- function ie(e = o) {
27100
- return e === "jobs" ? v : {};
27196
+ function se() {
27197
+ return O(o);
27101
27198
  }
27102
- function ae(e) {
27199
+ function P(e) {
27103
27200
  C(JSON.parse(JSON.stringify(e))), J.success(`Copied settings from ${e.label || e.name}`);
27104
27201
  }
27105
- async function oe(e) {
27202
+ async function ce(e) {
27106
27203
  if (S) try {
27107
27204
  let t = {
27108
27205
  ...e,
@@ -27110,15 +27207,15 @@ function HC() {
27110
27207
  payloadKey: S.payloadKey ?? e.payloadKey,
27111
27208
  fields: JSON.parse(JSON.stringify(S.fields ?? []))
27112
27209
  };
27113
- await Ie(e.id, t, ie(e.module || o)), J.success(`Pasted settings into ${e.label || e.name}`), O(o), o !== "all" && O("all");
27210
+ await Ie(e.id, t, se(e.module || o)), J.success(`Pasted settings into ${e.label || e.name}`), j(o), o !== "all" && j("all");
27114
27211
  } catch (e) {
27115
27212
  J.error(e.message || "Could not paste settings");
27116
27213
  }
27117
27214
  }
27118
- function se() {
27119
- p(null), a(OC(w)), O(o), o !== "all" && O("all");
27215
+ function le() {
27216
+ p(null), a(OC(w)), j(o), o !== "all" && j("all");
27120
27217
  }
27121
- let P = w.map(({ key: e, label: t, color: n }) => {
27218
+ let ue = w.map(({ key: e, label: t, color: n }) => {
27122
27219
  let r = i[e] ?? {
27123
27220
  groups: [],
27124
27221
  loading: !1,
@@ -27160,7 +27257,7 @@ function HC() {
27160
27257
  icon: /* @__PURE__ */ X(Ji, {}),
27161
27258
  disabled: e === "all",
27162
27259
  onClick: () => {
27163
- s(e), A();
27260
+ s(e), ee();
27164
27261
  },
27165
27262
  children: "Add Group"
27166
27263
  })
@@ -27169,29 +27266,39 @@ function HC() {
27169
27266
  spinning: r.loading,
27170
27267
  children: /* @__PURE__ */ X(zC, {
27171
27268
  groups: a,
27172
- onEdit: j,
27173
- onDelete: N,
27174
- onCopy: ae,
27175
- onPaste: oe,
27269
+ onEdit: N,
27270
+ onDelete: re,
27271
+ onCopy: P,
27272
+ onPaste: ce,
27176
27273
  canPaste: !!S,
27177
- onReorder: e === "all" ? void 0 : te
27274
+ onReorder: e === "all" ? void 0 : ie
27178
27275
  })
27179
27276
  })
27180
27277
  ]
27181
27278
  })
27182
27279
  };
27183
- }), ce = [
27280
+ }), de = o === "all" ? T[0]?.value ?? "jobs" : o, fe = w.find((e) => e.key === de)?.label ?? de, pe = [
27184
27281
  {
27185
27282
  key: "module",
27186
27283
  label: "Module Form",
27187
27284
  children: /* @__PURE__ */ Z(Y, { children: [
27188
27285
  /* @__PURE__ */ X(MS, { children: /* @__PURE__ */ Z("div", {
27189
27286
  className: "fg-scope-toolbar",
27190
- children: [/* @__PURE__ */ X("div", { children: /* @__PURE__ */ X("div", { children: /* @__PURE__ */ X(mC, {
27287
+ children: [/* @__PURE__ */ Z("div", { children: [/* @__PURE__ */ X("div", { children: /* @__PURE__ */ Z(mC, {
27191
27288
  type: "secondary",
27192
27289
  style: { fontSize: 12 },
27193
- children: "Select a client to edit a client-scoped field list for this module (Jobs, Submissions, …). Leave blank for the default module config. A Submission rendered against a job automatically uses that job's client here, falling back to the default when the client has no scoped config."
27194
- }) }) }), /* @__PURE__ */ Z(W, {
27290
+ children: [
27291
+ "Select a client to edit that client's field list for the module tab you are on — any module, not just Jobs. Leave blank for the default module config. Until the client has a config of its own you are shown the default; the first save copies it into a client-scoped config. A record rendered against a client — a Job, or a Submission through its job — uses that client's list here and falls back to the default when the client has none. The ",
27292
+ /* @__PURE__ */ X("b", { children: "All" }),
27293
+ " tab always shows the defaults."
27294
+ ]
27295
+ }) }), D(o) && /* @__PURE__ */ X("div", {
27296
+ style: { marginTop: 6 },
27297
+ children: /* @__PURE__ */ X(K, {
27298
+ color: "processing",
27299
+ children: `Editing ${g.find((e) => (e._id ?? e.id) === v.clientId)?.clientName ?? "client"} config for ${o}`
27300
+ })
27301
+ })] }), /* @__PURE__ */ Z(W, {
27195
27302
  wrap: !0,
27196
27303
  size: 8,
27197
27304
  children: [
@@ -27207,18 +27314,18 @@ function HC() {
27207
27314
  value: e._id ?? e.id,
27208
27315
  label: e.clientName ?? e.name ?? e.clientRefrenceId ?? e._id
27209
27316
  })).filter((e) => e.value),
27210
- onChange: (e) => re({ clientId: e ?? "" })
27317
+ onChange: (e) => oe({ clientId: e ?? "" })
27211
27318
  }),
27212
27319
  /* @__PURE__ */ X(z, {
27213
27320
  size: "small",
27214
27321
  icon: /* @__PURE__ */ X(Qi, {}),
27215
- onClick: () => O(o),
27322
+ onClick: () => j(o),
27216
27323
  children: "Reload"
27217
27324
  }),
27218
27325
  /* @__PURE__ */ X(z, {
27219
27326
  size: "small",
27220
27327
  icon: /* @__PURE__ */ X(gi, {}),
27221
- disabled: o !== "jobs",
27328
+ disabled: o === "all",
27222
27329
  onClick: () => x(!0),
27223
27330
  children: "Preview"
27224
27331
  })
@@ -27229,8 +27336,8 @@ function HC() {
27229
27336
  spinning: n,
27230
27337
  children: /* @__PURE__ */ X(Er, {
27231
27338
  activeKey: o,
27232
- onChange: k,
27233
- items: P,
27339
+ onChange: M,
27340
+ items: ue,
27234
27341
  size: "middle",
27235
27342
  className: "fg-tabs"
27236
27343
  })
@@ -27241,9 +27348,9 @@ function HC() {
27241
27348
  defaultModule: o === "all" ? T[0]?.value ?? "" : o,
27242
27349
  moduleOptions: T,
27243
27350
  allGroupsByModule: Object.fromEntries(Object.entries(i).filter(([e]) => e !== "all").map(([e, t]) => [e, t.groups ?? []])),
27244
- onClose: M,
27245
- onSaved: ee,
27246
- onSaveGroup: (e, t) => t ? Ie(t.id, e, ie(e.module)) : Vt(e, ie(e.module))
27351
+ onClose: te,
27352
+ onSaved: ne,
27353
+ onSaveGroup: (e, t) => t ? Ie(t.id, e, se(e.module)) : Vt(e, se(e.module))
27247
27354
  }),
27248
27355
  /* @__PURE__ */ X(or, {
27249
27356
  open: b,
@@ -27251,21 +27358,27 @@ function HC() {
27251
27358
  width: "92vw",
27252
27359
  title: /* @__PURE__ */ Z("span", {
27253
27360
  className: "fg-drawer-title",
27254
- children: [/* @__PURE__ */ X(gi, {}), " Jobs Add Form Preview"]
27361
+ children: [
27362
+ /* @__PURE__ */ X(gi, {}),
27363
+ " ",
27364
+ fe,
27365
+ " Add Form Preview"
27366
+ ]
27255
27367
  }),
27256
27368
  classNames: { body: "fg-preview-body" },
27369
+ destroyOnClose: !0,
27257
27370
  children: /* @__PURE__ */ X(Pp, {
27258
- moduleName: "jobs",
27371
+ moduleName: de,
27259
27372
  clientId: v.clientId,
27260
27373
  region: v.region,
27261
- cancelPath: "/jobs",
27374
+ cancelPath: `/${de}`,
27262
27375
  onSubmit: async () => J.info("Preview only. No record was created."),
27263
27376
  breadcrumbItems: [
27264
27377
  { label: "Admin" },
27265
27378
  { label: "Form Groups" },
27266
- { label: "Jobs Preview" }
27379
+ { label: `${fe} Preview` }
27267
27380
  ]
27268
- })
27381
+ }, `${de}-${v.clientId}-${v.region}`)
27269
27382
  })
27270
27383
  ] })
27271
27384
  },
@@ -27296,13 +27409,13 @@ function HC() {
27296
27409
  key: "save",
27297
27410
  label: "Save current as default",
27298
27411
  icon: /* @__PURE__ */ X(ia, {}),
27299
- onClick: () => ne("save")
27412
+ onClick: () => ae("save")
27300
27413
  },
27301
27414
  {
27302
27415
  key: "restore",
27303
27416
  label: "Restore saved default",
27304
27417
  icon: /* @__PURE__ */ X(ei, {}),
27305
- onClick: () => ne("restore")
27418
+ onClick: () => ae("restore")
27306
27419
  },
27307
27420
  { type: "divider" },
27308
27421
  {
@@ -27310,7 +27423,7 @@ function HC() {
27310
27423
  label: "Reset all form groups",
27311
27424
  icon: /* @__PURE__ */ X(Qi, {}),
27312
27425
  danger: !0,
27313
- onClick: () => ne("reset")
27426
+ onClick: () => ae("reset")
27314
27427
  }
27315
27428
  ] },
27316
27429
  children: /* @__PURE__ */ X(z, {
@@ -27322,7 +27435,7 @@ function HC() {
27322
27435
  type: "primary",
27323
27436
  size: "small",
27324
27437
  icon: /* @__PURE__ */ X(Pr, {}),
27325
- onClick: A,
27438
+ onClick: ee,
27326
27439
  children: "New Group"
27327
27440
  })]
27328
27441
  }) : null,
@@ -27343,7 +27456,7 @@ function HC() {
27343
27456
  children: /* @__PURE__ */ X(Er, {
27344
27457
  activeKey: m,
27345
27458
  onChange: h,
27346
- items: ce,
27459
+ items: pe,
27347
27460
  size: "middle",
27348
27461
  className: "fg-top-tabs",
27349
27462
  tabBarStyle: {
@@ -27362,7 +27475,7 @@ function HC() {
27362
27475
  confirmLabel: f?.confirmLabel,
27363
27476
  danger: f?.danger,
27364
27477
  onCancel: () => p(null),
27365
- onVerified: se
27478
+ onVerified: le
27366
27479
  })
27367
27480
  ]
27368
27481
  });