@realtek/core-theme 0.0.35 → 0.0.37

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
@@ -3352,12 +3352,12 @@ function Zo({ group: e }) {
3352
3352
  });
3353
3353
  }
3354
3354
  function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientScope: c = !1, formGroups: l, loading: u = !1, error: d = "", breadcrumbItems: m = [], formType: g = "add", submitText: _, cancelPath: v = "/candidates", onSubmit: y, initialRecord: b = null, prefillFromUrl: x = !1, extraPayload: S = null }) {
3355
- let w = g === "search", T = _ ?? (w ? "Search" : "Create"), E = Ut(), D = Wt(), [O] = Gt(), [k] = C.useForm(), [A, j] = o({}), [M, ee] = o([]), [N, P] = o(!!e), [L, te] = o(""), [ne, re] = o(!1), [ie, V] = o([]), [H, U] = o(n ?? ""), [W, ae] = o(a ?? ""), [oe, se] = o(null), [ce, le] = o(!1), ue = e ? M : l ?? Co, de = e ? N : u, fe = e ? L : d, pe = n || H, me = a || W, he = c && !pe, ge = i(() => Ao(ue), [ue]);
3355
+ let w = g === "search", T = _ ?? (w ? "Search" : "Create"), E = Ut(), D = Wt(), [O] = Gt(), [k] = C.useForm(), [A, j] = o({}), [M, ee] = o([]), [N, P] = o(!!e), [L, te] = o(""), [ne, re] = o(""), [ie, V] = o(!1), [H, U] = o([]), [W, ae] = o(n ?? ""), [oe, se] = o(a ?? ""), [ce, le] = o(null), [ue, de] = o(!1), fe = e ? M : l ?? Co, pe = e ? N : u, me = e ? L : d, he = n || W, ge = a || oe, _e = c && !he, ve = i(() => Ao(fe), [fe]);
3356
3356
  r(() => {
3357
- c && ui({ limit: 200 }).then(V).catch(() => V([]));
3357
+ c && ui({ limit: 200 }).then(U).catch(() => U([]));
3358
3358
  }, [c]), r(() => {
3359
3359
  if (!e) return;
3360
- if (he) {
3360
+ if (_e) {
3361
3361
  ee([]), P(!1), te("");
3362
3362
  return;
3363
3363
  }
@@ -3365,13 +3365,13 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3365
3365
  async function r() {
3366
3366
  try {
3367
3367
  P(!0), te("");
3368
- let r = w ? await sa(e, "search") : await Zr({
3368
+ let r = w ? await sa(e, "search", t) : await Zr({
3369
3369
  module: e,
3370
3370
  action: t,
3371
- clientId: pe,
3372
- region: me
3371
+ clientId: he,
3372
+ region: ge
3373
3373
  });
3374
- n || ee(ko(r));
3374
+ n || (ee(ko(w ? r?.[0] : r)), w && re(r?.[0]?.label || ""));
3375
3375
  } catch (t) {
3376
3376
  console.error(`Failed to fetch ${e} form groups:`, t), n || te(t?.message || "Failed to fetch form groups");
3377
3377
  } finally {
@@ -3385,11 +3385,11 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3385
3385
  e,
3386
3386
  t,
3387
3387
  w,
3388
- pe,
3389
- me,
3390
- he
3388
+ he,
3389
+ ge,
3390
+ _e
3391
3391
  ]);
3392
- let _e = i(() => {
3392
+ let ye = i(() => {
3393
3393
  if (!x) return null;
3394
3394
  let e = O.get("candidateId") || "", t = O.get("submissionId") || "", n = String(O.get("isFromSubmission")) === "true", r = D.jobId && D.jobId !== "_" ? D.jobId : O.get("jobId") || "", i = n && t ? {
3395
3395
  module: "submissions",
@@ -3408,41 +3408,41 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3408
3408
  D
3409
3409
  ]);
3410
3410
  r(() => {
3411
- let e = _e?.source;
3411
+ let e = ye?.source;
3412
3412
  if (!e) return;
3413
3413
  let t = !1;
3414
3414
  async function n() {
3415
3415
  try {
3416
- le(!0);
3416
+ de(!0);
3417
3417
  let n = await Zr({
3418
3418
  module: e.module,
3419
3419
  id: e.id
3420
3420
  });
3421
- t || se(ko(n));
3421
+ t || le(ko(n));
3422
3422
  } catch (e) {
3423
- console.error("Failed to fetch prefill data:", e), t || se([]);
3423
+ console.error("Failed to fetch prefill data:", e), t || le([]);
3424
3424
  } finally {
3425
- t || le(!1);
3425
+ t || de(!1);
3426
3426
  }
3427
3427
  }
3428
3428
  return n(), () => {
3429
3429
  t = !0;
3430
3430
  };
3431
- }, [_e]);
3432
- let ve = i(() => oe ? Object.fromEntries(oe.filter((e) => e.addRow && Array.isArray(e.rows) && e.rows.length > 0).map((e) => [e.payloadKey || e.name, e.rows])) : {}, [oe]), ye = i(() => {
3433
- if (!oe) return null;
3431
+ }, [ye]);
3432
+ let be = i(() => ce ? Object.fromEntries(ce.filter((e) => e.addRow && Array.isArray(e.rows) && e.rows.length > 0).map((e) => [e.payloadKey || e.name, e.rows])) : {}, [ce]), xe = i(() => {
3433
+ if (!ce) return null;
3434
3434
  let e = {};
3435
- return oe.forEach((t) => {
3435
+ return ce.forEach((t) => {
3436
3436
  t.addRow || (t.fields ?? []).forEach((t) => {
3437
3437
  !t.field || t.value === void 0 || t.value === null || (e[t.field] = t.value, t.payloadKey && t.payloadKey !== t.field && (e[t.payloadKey] = t.value));
3438
3438
  });
3439
3439
  }), Object.keys(e).length > 0 ? e : null;
3440
- }, [oe]);
3440
+ }, [ce]);
3441
3441
  r(() => {
3442
- let e = b ?? ye;
3443
- if (!e || de || ge.length === 0) return;
3442
+ let e = b ?? xe;
3443
+ if (!e || pe || ve.length === 0) return;
3444
3444
  let t = {};
3445
- ge.forEach((n) => {
3445
+ ve.forEach((n) => {
3446
3446
  n.addRow || (n.fields ?? []).forEach((n) => {
3447
3447
  if (!n.field) return;
3448
3448
  let r = jo(e, n);
@@ -3454,16 +3454,16 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3454
3454
  }), Object.keys(t).length > 0 && k.setFieldsValue(t);
3455
3455
  }, [
3456
3456
  b,
3457
- ye,
3458
- de,
3459
- ge,
3457
+ xe,
3458
+ pe,
3459
+ ve,
3460
3460
  k
3461
3461
  ]);
3462
- let be = c && pe ? { clientId: pe } : {}, xe = _e?.linkage ?? {
3463
- ...be,
3462
+ let Se = c && he ? { clientId: he } : {}, Ce = ye?.linkage ?? {
3463
+ ...Se,
3464
3464
  ...S ?? {}
3465
- }, Se = !he && !de && (!_e?.source || oe !== null && !ce), Ce = (e) => {
3466
- let t = ve[e.payloadKey || e.name];
3465
+ }, we = !_e && !pe && (!ye?.source || ce !== null && !ue), Te = (e) => {
3466
+ let t = be[e.payloadKey || e.name];
3467
3467
  return !t || t.length === 0 ? [{}] : t.map((t) => {
3468
3468
  let n = {};
3469
3469
  return (e.fields ?? []).forEach((e) => {
@@ -3472,12 +3472,12 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3472
3472
  r != null && (n[e.field] = ro(e, r));
3473
3473
  }), Object.keys(n).length > 0 ? n : {};
3474
3474
  });
3475
- }, we = (e) => j((t) => ({
3475
+ }, Ee = (e) => j((t) => ({
3476
3476
  ...t,
3477
3477
  [e]: !t[e]
3478
- })), Te = () => {
3478
+ })), De = () => {
3479
3479
  k.resetFields(), j({});
3480
- }, Ee = async (t) => {
3480
+ }, ke = async (t) => {
3481
3481
  if (y) {
3482
3482
  await y(t);
3483
3483
  return;
@@ -3487,20 +3487,20 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3487
3487
  return;
3488
3488
  }
3489
3489
  try {
3490
- re(!0);
3491
- let n = await Qr(e, qo(t, ge, xe ?? {}));
3490
+ V(!0);
3491
+ let n = await Qr(e, qo(t, ve, Ce ?? {}));
3492
3492
  if (n?.status === !1) {
3493
3493
  G.error(n?.error || n?.message || n?.data || "Something went wrong");
3494
3494
  return;
3495
3495
  }
3496
- let r = $a(t, ge, {
3496
+ let r = $a(t, ve, {
3497
3497
  scope: "addRow",
3498
3498
  indexed: !0
3499
3499
  }), i = n?.id ?? n?.data?.id ?? n?.data?._id ?? n?._id;
3500
3500
  if (r.length > 0 && i) try {
3501
3501
  await wa(e, i, {
3502
- ...xe ?? {},
3503
- ...eo(t, ge)
3502
+ ...Ce ?? {},
3503
+ ...eo(t, ve)
3504
3504
  }, r);
3505
3505
  } catch (e) {
3506
3506
  console.error("Document file attach (post-create update) failed:", e), G.warning("Record created, but attaching document files failed. Edit the record to re-upload.");
@@ -3511,15 +3511,15 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3511
3511
  } catch (t) {
3512
3512
  console.error(`Failed to create ${e}:`, t), G.error(t?.data?.error || t?.data?.message || t?.message || "Failed to create record");
3513
3513
  } finally {
3514
- re(!1);
3514
+ V(!1);
3515
3515
  }
3516
- }, De = (e, t) => (e.validations ?? e.validation ?? e.rules ?? []).filter((e) => {
3516
+ }, je = (e, t) => (e.validations ?? e.validation ?? e.rules ?? []).filter((e) => {
3517
3517
  let t = typeof e == "string" ? e : e?.type;
3518
3518
  return t === "dateAfterField" || t === "greaterThanField";
3519
3519
  }).map((e) => {
3520
3520
  let n = e.value ?? e.compareField ?? e.field;
3521
3521
  return n ? Lo(t, n) : null;
3522
- }).filter(Boolean), ke = (e, t, n) => {
3522
+ }).filter(Boolean), Me = (e, t, n) => {
3523
3523
  if (!e?.field) return !0;
3524
3524
  let r = t(n == null ? [e.field] : [...Array.isArray(n) ? n : [n], e.field]);
3525
3525
  switch (e.operator) {
@@ -3529,11 +3529,11 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3529
3529
  case "falsy": return r == null || r === "" || r === !1;
3530
3530
  default: return !0;
3531
3531
  }
3532
- }, [je, Me] = o({}), Ne = (e) => String(e?.field ?? ""), Pe = (t, n, r, i = {}) => {
3532
+ }, [Ne, Pe] = o({}), Fe = (e) => String(e?.field ?? ""), Ie = (t, n, r, i = {}) => {
3533
3533
  let a = typeof t.field == "string" && t.field.includes(".") ? t.field.split(".") : null, o = a ?? t.field, s = n === void 0 ? o : [n, ...a ?? [t.field]], c = r !== void 0 && n !== void 0 ? [r, ...Array.isArray(s) ? s : [s]] : s, l = t.type === "checkbox" && (t.options && t.options.length > 0 || t.dataSource && t.dataSource !== "static"), u = !l && t.type === "checkbox" ? "checked" : "value", d = i.inline || !l && t.type === "checkbox" ? "" : /* @__PURE__ */ q(Xo, {
3534
3534
  field: t,
3535
3535
  label: t.label
3536
- }), f = De(t, c), p = i.inline || t.type === "file" && Eo(t.multiple) || t.type === "text-editor" ? 24 : t.col ?? 12, m = r !== void 0 && n !== void 0 ? [r, n] : null, g = n === void 0 && t.type !== "file" && t.defaultValue !== void 0 && t.defaultValue !== "" ? t.defaultValue : void 0, _ = /* @__PURE__ */ q(C.Item, {
3536
+ }), f = je(t, c), p = i.inline || t.type === "file" && Eo(t.multiple) || t.type === "text-editor" ? 24 : t.col ?? 12, m = r !== void 0 && n !== void 0 ? [r, n] : null, g = n === void 0 && t.type !== "file" && t.defaultValue !== void 0 && t.defaultValue !== "" ? t.defaultValue : void 0, _ = /* @__PURE__ */ q(C.Item, {
3537
3537
  label: d,
3538
3538
  name: s,
3539
3539
  required: Eo(t.req),
@@ -3556,7 +3556,7 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3556
3556
  return t.showIf?.field ? /* @__PURE__ */ q(C.Item, {
3557
3557
  shouldUpdate: !0,
3558
3558
  noStyle: !0,
3559
- children: ({ getFieldValue: e }) => ke(t.showIf, e, m) ? /* @__PURE__ */ q(h, {
3559
+ children: ({ getFieldValue: e }) => Me(t.showIf, e, m) ? /* @__PURE__ */ q(h, {
3560
3560
  xs: 24,
3561
3561
  md: p,
3562
3562
  style: v,
@@ -3570,19 +3570,19 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3570
3570
  className: i.inline ? "v1-combine-cell" : void 0,
3571
3571
  children: _
3572
3572
  }, t.field);
3573
- }, Fe = (e, t, n) => {
3573
+ }, Le = (e, t, n) => {
3574
3574
  let r = /* @__PURE__ */ new Set(), i = [];
3575
3575
  return e.forEach((a) => {
3576
3576
  let o = a.combineKey?.trim?.();
3577
3577
  if (!o) {
3578
- i.push(Pe(a, t, n));
3578
+ i.push(Ie(a, t, n));
3579
3579
  return;
3580
3580
  }
3581
3581
  let s = `${n ?? "root"}:${t ?? "root"}:${o}`;
3582
3582
  if (r.has(s)) return;
3583
3583
  let c = e.filter((e) => e.combineKey === o);
3584
3584
  c.forEach((e) => r.add(`${n ?? "root"}:${t ?? "root"}:${e.combineKey}`));
3585
- let l = c.find((e) => e.combineLabel)?.combineLabel ?? a.combineLabel ?? a.label, u = c.find((e) => e.combineToggleTarget)?.combineToggleTarget, d = c.find((e) => e.combineToggleLabel)?.combineToggleLabel ?? "Show range", f = s, p = u ? c.find((e) => Ne(e) === u) : null, m = p?.field?.includes?.(".") ? p.field.split(".") : [p?.field].filter(Boolean), g = p ? n !== void 0 && t !== void 0 ? [
3585
+ let l = c.find((e) => e.combineLabel)?.combineLabel ?? a.combineLabel ?? a.label, u = c.find((e) => e.combineToggleTarget)?.combineToggleTarget, d = c.find((e) => e.combineToggleLabel)?.combineToggleLabel ?? "Show range", f = s, p = u ? c.find((e) => Fe(e) === u) : null, m = p?.field?.includes?.(".") ? p.field.split(".") : [p?.field].filter(Boolean), g = p ? n !== void 0 && t !== void 0 ? [
3586
3586
  n,
3587
3587
  t,
3588
3588
  ...m
@@ -3599,19 +3599,19 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3599
3599
  noStyle: !0,
3600
3600
  shouldUpdate: !0,
3601
3601
  children: ({ getFieldValue: e }) => {
3602
- let r = g ? !No(e(g)) : !1, i = je[f] ?? r;
3602
+ let r = g ? !No(e(g)) : !1, i = Ne[f] ?? r;
3603
3603
  return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(F, {
3604
3604
  gutter: [8, 0],
3605
3605
  align: "top",
3606
3606
  wrap: !1,
3607
3607
  className: "v1-combine-row",
3608
- children: (u && !i ? c.filter((e) => Ne(e) !== u) : c).map((e) => Pe(e, t, n, { inline: !0 }))
3608
+ children: (u && !i ? c.filter((e) => Fe(e) !== u) : c).map((e) => Ie(e, t, n, { inline: !0 }))
3609
3609
  }), u && /* @__PURE__ */ J("div", {
3610
3610
  className: "v1-combine-range",
3611
3611
  children: [/* @__PURE__ */ q(B, {
3612
3612
  size: "small",
3613
3613
  checked: i,
3614
- onChange: (e) => Me((t) => ({
3614
+ onChange: (e) => Pe((t) => ({
3615
3615
  ...t,
3616
3616
  [f]: e
3617
3617
  }))
@@ -3655,13 +3655,13 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3655
3655
  allowClear: !0,
3656
3656
  placeholder: "Select client",
3657
3657
  style: { width: "100%" },
3658
- value: pe || void 0,
3658
+ value: he || void 0,
3659
3659
  optionFilterProp: "label",
3660
- options: ie.map((e) => ({
3660
+ options: H.map((e) => ({
3661
3661
  value: e._id ?? e.id,
3662
3662
  label: e.clientName ?? e.name ?? e.clientRefrenceId ?? e._id
3663
3663
  })).filter((e) => e.value),
3664
- onChange: (e) => U(e ?? "")
3664
+ onChange: (e) => ae(e ?? "")
3665
3665
  })
3666
3666
  })
3667
3667
  })
@@ -3671,7 +3671,7 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3671
3671
  /* @__PURE__ */ q("div", {
3672
3672
  className: "v1-page-inner",
3673
3673
  children: /* @__PURE__ */ q(z, {
3674
- spinning: !Se && !he,
3674
+ spinning: !we && !_e,
3675
3675
  description: "Loading form fields...",
3676
3676
  children: /* @__PURE__ */ J(C, {
3677
3677
  form: k,
@@ -3682,12 +3682,12 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3682
3682
  className: "v1-required-mark",
3683
3683
  children: " *"
3684
3684
  })] }),
3685
- onFinish: Ee,
3685
+ onFinish: ke,
3686
3686
  children: [
3687
- Se && ge.map((e, t) => {
3687
+ we && ve.map((e, t) => {
3688
3688
  let n = e.name ?? e.id ?? String(t), r = e.addRow ? /* @__PURE__ */ q(C.List, {
3689
3689
  name: e.name ?? n,
3690
- initialValue: Ce(e),
3690
+ initialValue: Te(e),
3691
3691
  children: (t, { add: r, remove: i }) => /* @__PURE__ */ J("div", {
3692
3692
  className: "v1-addrow-wrapper",
3693
3693
  children: [/* @__PURE__ */ q("div", {
@@ -3711,19 +3711,19 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3711
3711
  }), /* @__PURE__ */ q(F, {
3712
3712
  gutter: [24, 0],
3713
3713
  align: "top",
3714
- children: Fe(e.fields, a, e.name ?? n)
3714
+ children: Le(e.fields, a, e.name ?? n)
3715
3715
  })]
3716
3716
  }, r))]
3717
3717
  })
3718
3718
  }) : /* @__PURE__ */ q(F, {
3719
3719
  gutter: [24, 0],
3720
- children: Fe(e.fields)
3720
+ children: Le(e.fields)
3721
3721
  });
3722
3722
  return /* @__PURE__ */ q(p, {
3723
3723
  className: "v1-card v1-edit-card",
3724
3724
  title: /* @__PURE__ */ q(Yo, {
3725
3725
  icon: wo[t % wo.length],
3726
- title: e.label ?? e.name ?? "Details"
3726
+ title: w ? ne || e.label : e.label ?? e.name ?? "Details"
3727
3727
  }),
3728
3728
  extra: /* @__PURE__ */ J(R, {
3729
3729
  size: 8,
@@ -3734,7 +3734,7 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3734
3734
  size: "small",
3735
3735
  icon: A[n] ? /* @__PURE__ */ q(Ae, {}) : /* @__PURE__ */ q(Ft, {}),
3736
3736
  onClick: (e) => {
3737
- e.stopPropagation(), we(n);
3737
+ e.stopPropagation(), Ee(n);
3738
3738
  }
3739
3739
  })]
3740
3740
  }),
@@ -3744,19 +3744,19 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3744
3744
  })
3745
3745
  }, n);
3746
3746
  }),
3747
- Se && !fe && ge.length === 0 && /* @__PURE__ */ q(s, {
3747
+ we && !me && ve.length === 0 && /* @__PURE__ */ q(s, {
3748
3748
  type: "info",
3749
3749
  showIcon: !0,
3750
3750
  message: w ? "No search configuration found." : "No form fields are configured."
3751
3751
  }),
3752
- Se && w && /* @__PURE__ */ q("div", {
3752
+ we && w && /* @__PURE__ */ q("div", {
3753
3753
  className: "v1-search-form-actions",
3754
3754
  children: /* @__PURE__ */ J(R, {
3755
3755
  size: 12,
3756
3756
  children: [
3757
3757
  /* @__PURE__ */ q(f, {
3758
- onClick: Te,
3759
- disabled: !ge.length,
3758
+ onClick: De,
3759
+ disabled: !ve.length,
3760
3760
  children: "Reset"
3761
3761
  }),
3762
3762
  /* @__PURE__ */ q(f, {
@@ -3766,8 +3766,8 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3766
3766
  /* @__PURE__ */ q(f, {
3767
3767
  type: "primary",
3768
3768
  htmlType: "submit",
3769
- disabled: ne || !ge.length,
3770
- loading: ne,
3769
+ disabled: ie || !ve.length,
3770
+ loading: ie,
3771
3771
  children: T
3772
3772
  })
3773
3773
  ]
@@ -3790,8 +3790,8 @@ function Qo({ moduleName: e, action: t, clientId: n, region: a, requireClientSco
3790
3790
  }), /* @__PURE__ */ q(f, {
3791
3791
  type: "primary",
3792
3792
  onClick: () => k.submit(),
3793
- disabled: !Se || ne || !ge.length,
3794
- loading: ne,
3793
+ disabled: !we || ie || !ve.length,
3794
+ loading: ie,
3795
3795
  children: T
3796
3796
  })]
3797
3797
  })]