@realtek/core-theme 0.0.284 → 0.0.286

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
@@ -4739,56 +4739,67 @@ function pp(e, t = {}) {
4739
4739
  return n === "add" ? t.canAdd !== !1 : n === "edit" ? t.canEdit !== !1 : n === "delete" ? t.canDelete !== !1 : !0;
4740
4740
  }
4741
4741
  function mp(e, t, n) {
4742
- let r = Gf(e.routeUrl ?? e.routeURL ?? e.route ?? e.url ?? e.href, t), i = Mp(e.type ?? e.actionType), a = /* @__PURE__ */ X("img", {
4742
+ let r = Gf(e.routeUrl ?? e.routeURL ?? e.route ?? e.url ?? e.href, t), i = Mp(e.type ?? e.actionType), a = typeof e.label == "function" ? e.label(t) : e.label, o = /* @__PURE__ */ X("img", {
4743
4743
  src: e.iconUrl,
4744
- alt: e.label,
4744
+ alt: a,
4745
4745
  className: "job-field-action-icon"
4746
- }), o = "job-field-action-button", s = e.__done, c = e.__disabledReason;
4747
- return s || c ? /* @__PURE__ */ X(q, {
4748
- title: s ? s.label : c,
4746
+ }), s = "job-field-action-button", c = e.__done, l = e.__disabledReason;
4747
+ return c || l ? /* @__PURE__ */ X(q, {
4748
+ title: c ? c.label : l,
4749
4749
  children: /* @__PURE__ */ X("button", {
4750
- "aria-label": s ? s.label : `${e.label} (unavailable)`,
4751
- className: `${o} job-field-action-button--done`,
4750
+ "aria-label": c ? c.label : `${a} (unavailable)`,
4751
+ className: `${s} job-field-action-button--done`,
4752
4752
  type: "button",
4753
4753
  disabled: !0,
4754
- children: a
4754
+ children: o
4755
+ })
4756
+ }, e.key) : typeof e.onClick == "function" ? /* @__PURE__ */ X(q, {
4757
+ title: a,
4758
+ children: /* @__PURE__ */ X("button", {
4759
+ "aria-label": a,
4760
+ className: s,
4761
+ type: "button",
4762
+ onClick: (n) => {
4763
+ n.stopPropagation(), e.onClick(t);
4764
+ },
4765
+ children: o
4755
4766
  })
4756
4767
  }, e.key) : (i === "popup" || i === "modal" || e.popupKey) && r ? /* @__PURE__ */ X(q, {
4757
- title: e.label,
4768
+ title: a,
4758
4769
  children: /* @__PURE__ */ X("button", {
4759
- "aria-label": e.label,
4760
- className: o,
4770
+ "aria-label": a,
4771
+ className: s,
4761
4772
  type: "button",
4762
4773
  onClick: (i) => {
4763
4774
  i.stopPropagation(), n?.(r, t, e);
4764
4775
  },
4765
- children: a
4776
+ children: o
4766
4777
  })
4767
4778
  }, e.key) : r && (i === "page" || r.startsWith("/")) ? /* @__PURE__ */ X(q, {
4768
- title: e.label,
4779
+ title: a,
4769
4780
  children: /* @__PURE__ */ X(Uo, {
4770
- "aria-label": e.label,
4771
- className: o,
4781
+ "aria-label": a,
4782
+ className: s,
4772
4783
  to: r,
4773
- children: a
4784
+ children: o
4774
4785
  })
4775
4786
  }, e.key) : r ? /* @__PURE__ */ X(q, {
4776
- title: e.label,
4787
+ title: a,
4777
4788
  children: /* @__PURE__ */ X("a", {
4778
- "aria-label": e.label,
4779
- className: o,
4789
+ "aria-label": a,
4790
+ className: s,
4780
4791
  href: r,
4781
4792
  rel: "noreferrer",
4782
4793
  target: "_blank",
4783
- children: a
4794
+ children: o
4784
4795
  })
4785
4796
  }, e.key) : /* @__PURE__ */ X(q, {
4786
- title: e.label,
4797
+ title: a,
4787
4798
  children: /* @__PURE__ */ X("button", {
4788
- "aria-label": e.label,
4789
- className: o,
4799
+ "aria-label": a,
4800
+ className: s,
4790
4801
  type: "button",
4791
- children: a
4802
+ children: o
4792
4803
  })
4793
4804
  }, e.key);
4794
4805
  }
@@ -6339,16 +6350,23 @@ function Km({ form: e, rules: t, watchPaths: n, targetPath: r, resetOnNoMatch: i
6339
6350
  function qm({ form: e, config: t, watchPath: n }) {
6340
6351
  let r = V.useWatch(n, e), i = ci(void 0);
6341
6352
  return I(() => {
6342
- if (ah(r) || r === i.current) return;
6343
- i.current = r;
6344
- let n = new URLSearchParams({ [t.queryParam]: String(r) });
6345
- a(o, `${t.endpoint}?${n.toString()}`).then((n) => {
6353
+ ah(r) || r === i.current || (i.current = r, a(o, t.endpointTemplate ? `${t.endpointTemplate.replace("{value}", encodeURIComponent(String(r)))}` : `${t.endpoint}?${new URLSearchParams({ [t.queryParam]: String(r) }).toString()}`).then((n) => {
6346
6354
  let r = n?.data ?? n;
6355
+ if (t.substituteTokens) {
6356
+ (t.substituteInFields || []).forEach((n) => {
6357
+ let i = Bm(n), a = e.getFieldValue(i) || "";
6358
+ Object.entries(t.substituteTokens).forEach(([e, t]) => {
6359
+ let n = e.replace(/^\{\{|\}\}$/g, "").trim(), i = RegExp(`\\{\\{\\s*${n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\s*\\}\\}`, "gi");
6360
+ a = a.replace(i, r?.[t] ?? "");
6361
+ }), e.setFieldValue(i, a);
6362
+ });
6363
+ return;
6364
+ }
6347
6365
  Object.entries(t.mapResponseToFields).forEach(([n, i]) => {
6348
6366
  let a = Bm(n);
6349
6367
  t.onlyIfEmpty && !ah(e.getFieldValue(a)) || e.setFieldValue(a, r?.[i]);
6350
6368
  });
6351
- }).catch(() => {});
6369
+ }).catch(() => {}));
6352
6370
  }, [r]), null;
6353
6371
  }
6354
6372
  function Jm(e, t) {