@realtek/core-theme 0.0.116 → 0.0.117

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
@@ -24403,7 +24403,7 @@ function tx() {
24403
24403
  return `action_${Date.now()}`;
24404
24404
  }
24405
24405
  function nx({ open: e, initial: t, isChild: n, popupForms: r, templateOptions: i, permissionModules: a, permissionActions: o, onClose: s, onSave: c }) {
24406
- let [l] = z.useForm(), u = z.useWatch("actionType", l) ?? "navigate", d = z.useWatch("showInDetail", l) ?? !1, f = z.useWatch("popupKey", l) ?? "";
24406
+ let [l] = z.useForm(), [u, d] = k(!1), f = z.useWatch("actionType", l) ?? "navigate", p = z.useWatch("showInDetail", l) ?? !1, m = z.useWatch("popupKey", l) ?? "";
24407
24407
  E(() => {
24408
24408
  if (e) {
24409
24409
  let [e = "", n = ""] = (t?.permission ?? "").split(".");
@@ -24420,7 +24420,7 @@ function nx({ open: e, initial: t, isChild: n, popupForms: r, templateOptions: i
24420
24420
  t,
24421
24421
  l
24422
24422
  ]);
24423
- let p = async () => {
24423
+ let h = async () => {
24424
24424
  let e = await l.validateFields(), t;
24425
24425
  if (e.popupStateText?.trim()) try {
24426
24426
  t = JSON.parse(e.popupStateText);
@@ -24434,11 +24434,16 @@ function nx({ open: e, initial: t, isChild: n, popupForms: r, templateOptions: i
24434
24434
  let n = { ...e };
24435
24435
  delete n.popupStateText;
24436
24436
  let { permissionModule: r, permissionAction: i } = n;
24437
- delete n.permissionModule, delete n.permissionAction, n.permission = r && i ? `${r}.${i}` : "", (n.actionType !== "modal" || !["mail", "vendor-share"].includes(n.popupKey)) && delete n.defaultTemplateId, c({
24438
- ...n,
24439
- ...t ? { popupState: t } : { popupState: void 0 }
24440
- });
24441
- }, m = [...$b.map((e) => ({
24437
+ delete n.permissionModule, delete n.permissionAction, n.permission = r && i ? `${r}.${i}` : "", (n.actionType !== "modal" || !["mail", "vendor-share"].includes(n.popupKey)) && delete n.defaultTemplateId, d(!0);
24438
+ try {
24439
+ await c({
24440
+ ...n,
24441
+ ...t ? { popupState: t } : { popupState: void 0 }
24442
+ });
24443
+ } finally {
24444
+ d(!1);
24445
+ }
24446
+ }, g = [...$b.map((e) => ({
24442
24447
  value: e,
24443
24448
  label: `${e} (built-in)`
24444
24449
  })), ...r.map((e) => ({
@@ -24450,7 +24455,8 @@ function nx({ open: e, initial: t, isChild: n, popupForms: r, templateOptions: i
24450
24455
  width: 720,
24451
24456
  open: e,
24452
24457
  onCancel: s,
24453
- onOk: p,
24458
+ onOk: h,
24459
+ confirmLoading: u,
24454
24460
  okText: "Save Action",
24455
24461
  okButtonProps: { icon: /* @__PURE__ */ X(Nt, {}) },
24456
24462
  className: "fg-editor-modal action-editor-modal",
@@ -24506,18 +24512,18 @@ function nx({ open: e, initial: t, isChild: n, popupForms: r, templateOptions: i
24506
24512
  })
24507
24513
  ]
24508
24514
  }),
24509
- u === "group" && /* @__PURE__ */ X(A, {
24515
+ f === "group" && /* @__PURE__ */ X(A, {
24510
24516
  type: "info",
24511
24517
  showIcon: !0,
24512
24518
  message: "Group actions don't run anything themselves.",
24513
24519
  description: "This action renders as a submenu. Save it, then use \"Add Child Action\" on its row to configure what appears inside (e.g. Tag To Job, Send Mail, Add Notes).",
24514
24520
  style: { marginBottom: 16 }
24515
24521
  }),
24516
- u !== "group" && /* @__PURE__ */ X("div", {
24522
+ f !== "group" && /* @__PURE__ */ X("div", {
24517
24523
  className: "action-editor-section-title",
24518
24524
  children: "Behaviour"
24519
24525
  }),
24520
- u === "navigate" && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(z.Item, {
24526
+ f === "navigate" && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(z.Item, {
24521
24527
  name: "routeTemplate",
24522
24528
  label: "Route Template",
24523
24529
  rules: [{ required: !0 }],
@@ -24534,7 +24540,7 @@ function nx({ open: e, initial: t, isChild: n, popupForms: r, templateOptions: i
24534
24540
  label: "New tab"
24535
24541
  }] })
24536
24542
  })] }),
24537
- u === "modal" && /* @__PURE__ */ Z(Y, { children: [
24543
+ f === "modal" && /* @__PURE__ */ Z(Y, { children: [
24538
24544
  /* @__PURE__ */ X(z.Item, {
24539
24545
  name: "popupKey",
24540
24546
  label: "Popup",
@@ -24546,7 +24552,7 @@ function nx({ open: e, initial: t, isChild: n, popupForms: r, templateOptions: i
24546
24552
  children: /* @__PURE__ */ X(U, {
24547
24553
  showSearch: !0,
24548
24554
  optionFilterProp: "label",
24549
- options: m,
24555
+ options: g,
24550
24556
  placeholder: "Select popup form"
24551
24557
  })
24552
24558
  }),
@@ -24578,7 +24584,7 @@ function nx({ open: e, initial: t, isChild: n, popupForms: r, templateOptions: i
24578
24584
  })]
24579
24585
  })
24580
24586
  ] }),
24581
- u === "modal" && ["mail", "vendor-share"].includes(f) && /* @__PURE__ */ X(z.Item, {
24587
+ f === "modal" && ["mail", "vendor-share"].includes(m) && /* @__PURE__ */ X(z.Item, {
24582
24588
  name: "defaultTemplateId",
24583
24589
  label: "Default Email Template",
24584
24590
  tooltip: "This template is selected and loaded automatically whenever this action opens the mail composer.",
@@ -24590,7 +24596,7 @@ function nx({ open: e, initial: t, isChild: n, popupForms: r, templateOptions: i
24590
24596
  placeholder: "No default — user selects in composer"
24591
24597
  })
24592
24598
  }),
24593
- u === "api" && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(z.Item, {
24599
+ f === "api" && /* @__PURE__ */ Z(Y, { children: [/* @__PURE__ */ X(z.Item, {
24594
24600
  name: "apiMethod",
24595
24601
  label: "API Method",
24596
24602
  children: /* @__PURE__ */ X(U, { options: Qb.map((e) => ({
@@ -24602,13 +24608,13 @@ function nx({ open: e, initial: t, isChild: n, popupForms: r, templateOptions: i
24602
24608
  label: "API Path",
24603
24609
  children: /* @__PURE__ */ X(B, { placeholder: "e.g. /jobs/:_id" })
24604
24610
  })] }),
24605
- u === "copy" && /* @__PURE__ */ X(z.Item, {
24611
+ f === "copy" && /* @__PURE__ */ X(z.Item, {
24606
24612
  name: "copyField",
24607
24613
  label: "Record Field to Copy",
24608
24614
  rules: [{ required: !0 }],
24609
24615
  children: /* @__PURE__ */ X(B, { placeholder: "e.g. email or applicantRefrenceId" })
24610
24616
  }),
24611
- u === "document" && /* @__PURE__ */ X(z.Item, {
24617
+ f === "document" && /* @__PURE__ */ X(z.Item, {
24612
24618
  name: "documentField",
24613
24619
  label: "Document Field",
24614
24620
  rules: [{ required: !0 }],
@@ -24696,7 +24702,7 @@ function nx({ open: e, initial: t, isChild: n, popupForms: r, templateOptions: i
24696
24702
  })
24697
24703
  ]
24698
24704
  }),
24699
- d && /* @__PURE__ */ X(z.Item, {
24705
+ p && /* @__PURE__ */ X(z.Item, {
24700
24706
  name: "detailPlacement",
24701
24707
  label: "Detail Placement",
24702
24708
  children: /* @__PURE__ */ X(U, { options: [{
@@ -24781,8 +24787,9 @@ function rx() {
24781
24787
  le(e), O(null), C(!0);
24782
24788
  }, V = (e, t = null) => {
24783
24789
  le(t), O(e), C(!0);
24784
- }, de = (e) => {
24785
- p(ce ? (t) => t.map((t) => {
24790
+ }, de = async (e) => {
24791
+ let t;
24792
+ t = ce ? f.map((t) => {
24786
24793
  if (t.key !== ce) return t;
24787
24794
  let n = t.children ?? [], r = w ? n.map((t) => t.key === w.key ? {
24788
24795
  ...t,
@@ -24796,14 +24803,31 @@ function rx() {
24796
24803
  ...t,
24797
24804
  children: r
24798
24805
  };
24799
- }) : w ? (t) => t.map((t) => t.key === w.key ? {
24806
+ }) : w ? f.map((t) => t.key === w.key ? {
24800
24807
  ...t,
24801
24808
  ...e
24802
- } : t) : (t) => [...t, {
24809
+ } : t) : [...f, {
24803
24810
  ...ex,
24804
24811
  ...e,
24805
24812
  _localKey: tx()
24806
- }]), h(!0), C(!1);
24813
+ }];
24814
+ try {
24815
+ if (u) await Ya(u.id ?? u._id, t), l((e) => e.map((e) => (e.id ?? e._id) === (u.id ?? u._id) ? {
24816
+ ...e,
24817
+ rowActions: t
24818
+ } : e)), J.success("Config saved");
24819
+ else {
24820
+ let e = await Ja({
24821
+ module: i,
24822
+ roleId: o,
24823
+ rowActions: t
24824
+ }), n = e?.data ?? e;
24825
+ d(n), l((e) => [...e, n]), J.success("Config created");
24826
+ }
24827
+ p(t), h(!1), C(!1);
24828
+ } catch (e) {
24829
+ J.error(e.message);
24830
+ }
24807
24831
  }, pe = (e, t = null) => {
24808
24832
  p(t ? (n) => n.map((n) => n.key === t ? {
24809
24833
  ...n,