@realtek/core-theme 0.0.102 → 0.0.103

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
@@ -3191,7 +3191,7 @@ function Vo(e, t) {
3191
3191
  }
3192
3192
  function Ho(e = {}) {
3193
3193
  if (e.dataType && e.dataType !== "auto") return e.dataType;
3194
- if (e.multiSelect || e.mode === "multiple") return "array";
3194
+ if (e.multiSelect || e.mode === "multiple" || e.addRow) return "array";
3195
3195
  switch (e.type) {
3196
3196
  case "number": return "number";
3197
3197
  case "date":
@@ -3387,53 +3387,58 @@ function ns(e, t = [], n = {}) {
3387
3387
  };
3388
3388
  return (t ?? []).forEach((t) => {
3389
3389
  let r = (t.fields ?? []).filter((e) => e.type === "file");
3390
- if (r.length) {
3391
- if (t.addRow) {
3392
- if (i === "flat") return;
3393
- let o = e[t.name];
3394
- if (!Array.isArray(o)) return;
3395
- r.forEach((e) => {
3396
- let t = e.fileKey ?? String(e.field).split(".")[0];
3397
- o.forEach((r, i) => {
3398
- a(n.indexed ? `${t}[${i}]` : t, Io(r, e.field));
3399
- });
3390
+ if (!r.length) return;
3391
+ let o = (e) => t.moduleName ? `__mw__${t.moduleName}__${e}` : e;
3392
+ if (t.addRow) {
3393
+ if (i === "flat") return;
3394
+ let s = e[t.name];
3395
+ if (!Array.isArray(s)) return;
3396
+ r.forEach((e) => {
3397
+ let t = e.fileKey ?? String(e.field).split(".")[0];
3398
+ s.forEach((r, i) => {
3399
+ a(o(n.indexed ? `${t}[${i}]` : t), Io(r, e.field));
3400
3400
  });
3401
- return;
3402
- }
3403
- i !== "addRow" && r.forEach((t) => {
3404
- a(t.fileKey ?? String(t.field).split(".")[0], Io(e, t.field));
3405
3401
  });
3402
+ return;
3406
3403
  }
3404
+ i !== "addRow" && r.forEach((t) => {
3405
+ a(o(t.fileKey ?? String(t.field).split(".")[0]), Io(e, t.field));
3406
+ });
3407
3407
  }), r;
3408
3408
  }
3409
3409
  function rs(e, t, n = {}) {
3410
3410
  let r = jo(n.base) ? structuredClone(n.base) : {};
3411
- return ts(t).forEach((e) => {
3411
+ ts(t).forEach((e) => {
3412
3412
  (e.payloadKey || e.field) && (as(r, e.payloadKey || e.field), as(r, e.field));
3413
- }), (t ?? []).forEach((t) => {
3414
- let n = t.fields ?? [], i = t.toggleEnabled && t.toggleField && Lo(e, t.toggleField) ? !!Io(e, t.toggleField) : !1;
3415
- if (t.toggleEnabled && t.toggleField && Lo(e, t.toggleField) && (Ro(r, t.toggleField, i), i && t.addRow)) {
3416
- Ro(r, t.payloadKey || t.name, []);
3413
+ });
3414
+ let i = /* @__PURE__ */ new Map(), a = (e) => e.moduleName ? (i.has(e.moduleName) || i.set(e.moduleName, {}), i.get(e.moduleName)) : r;
3415
+ return (t ?? []).forEach((t) => {
3416
+ let n = a(t), r = t.fields ?? [], i = t.toggleEnabled && t.toggleField && Lo(e, t.toggleField) ? !!Io(e, t.toggleField) : !1;
3417
+ if (t.toggleEnabled && t.toggleField && Lo(e, t.toggleField) && (Ro(n, t.toggleField, i), i && t.addRow)) {
3418
+ Ro(n, t.payloadKey || t.name, []);
3417
3419
  return;
3418
3420
  }
3419
3421
  if (t.addRow) {
3420
3422
  let i = e[t.name];
3421
3423
  if (!Array.isArray(i)) return;
3422
- Ro(r, t.payloadKey || t.name, i.map((e) => is(n, e)).filter((e) => e && Object.keys(e).length > 0));
3424
+ Ro(n, t.payloadKey || t.name, i.map((e) => is(r, e)).filter((e) => e && Object.keys(e).length > 0));
3423
3425
  return;
3424
3426
  }
3425
- n.forEach((t) => {
3427
+ r.forEach((t) => {
3426
3428
  if (t.type === "file" || !Lo(e, t.field)) return;
3427
- let n = Zo(t, Io(e, t.field));
3428
- if (n.kind !== "skip") {
3429
- if (n.kind === "spread" && jo(n.out)) {
3430
- zo(r, n.out);
3429
+ let r = Zo(t, Io(e, t.field));
3430
+ if (r.kind !== "skip") {
3431
+ if (r.kind === "spread" && jo(r.out)) {
3432
+ zo(n, r.out);
3431
3433
  return;
3432
3434
  }
3433
- Ro(r, t.payloadKey || t.field, n.out);
3435
+ Ro(n, t.payloadKey || t.field, r.out);
3434
3436
  }
3435
3437
  });
3436
- }), ko(r, t);
3438
+ }), i.size > 0 && (r.moduleWrites = Array.from(i, ([e, t]) => ({
3439
+ moduleName: e,
3440
+ data: t
3441
+ }))), ko(r, t);
3437
3442
  }
3438
3443
  function is(e, t) {
3439
3444
  let n = {};
@@ -7851,7 +7856,7 @@ function Hf(e) {
7851
7856
  return Array.isArray(e) ? e : Array.isArray(e?.groups) ? e.groups : Array.isArray(e?.data) ? e.data : Array.isArray(e?.data?.groups) ? e.data.groups : Nf;
7852
7857
  }
7853
7858
  function Uf(e = [], t) {
7854
- return [...Hf(e)].sort((e, t) => Number(e.order ?? 0) - Number(t.order ?? 0)).map((e) => ({
7859
+ return [...Hf(e)].filter((e) => !If(e.hideGroup)).sort((e, t) => Number(e.order ?? 0) - Number(t.order ?? 0)).map((e) => ({
7855
7860
  ...e,
7856
7861
  fields: [...e.fields ?? []].filter((e) => (e.show === void 0 || If(e.show)) && e.showOnAdd !== !1 && !If(e.clientScope) && (!e.visiblePermission || uc(e.visiblePermission, t))).sort((e, t) => Number(e.order ?? 0) - Number(t.order ?? 0))
7857
7862
  })).filter((e) => e.fields.length);
@@ -9109,9 +9114,75 @@ function yp({ moduleName: e, action: t, clientId: n, region: r, formGroups: i, l
9109
9114
  className: i.inline ? "v1-combine-cell" : void 0,
9110
9115
  children: x
9111
9116
  }, t.field);
9112
- }, ut = (e, t, n, r = !1, i) => {
9117
+ }, ut = (t) => {
9118
+ let n = typeof t.field == "string" && t.field.includes(".") ? t.field.split(".") : [t.field], r = !!t.editablePermission && !uc(t.editablePermission, e), i = /* @__PURE__ */ Z(gp, {
9119
+ field: t,
9120
+ label: t.label,
9121
+ locked: r
9122
+ });
9123
+ return /* @__PURE__ */ Z(I, {
9124
+ xs: 24,
9125
+ md: 24,
9126
+ children: /* @__PURE__ */ Z(B.Item, {
9127
+ label: i,
9128
+ required: If(t.req),
9129
+ colon: !1,
9130
+ className: "v1-combine-field",
9131
+ children: /* @__PURE__ */ Z(B.List, {
9132
+ name: n,
9133
+ rules: [{ validator: async (e, n = []) => {
9134
+ if (If(t.req) && !n.some((e) => e != null && e !== "" && !(Array.isArray(e) && e.length === 0))) throw Error("Mandatory Field");
9135
+ } }],
9136
+ children: (r, { add: i, remove: a }, { errors: o }) => /* @__PURE__ */ Q("div", {
9137
+ className: "v1-addrow-wrapper",
9138
+ children: [
9139
+ r.map(({ key: r, name: i }) => /* @__PURE__ */ Q("div", {
9140
+ className: "v1-addrow-item",
9141
+ children: [/* @__PURE__ */ Z(P, {
9142
+ type: "text",
9143
+ danger: !0,
9144
+ icon: /* @__PURE__ */ Z(Ge, {}),
9145
+ onClick: () => a(i),
9146
+ className: "v1-addrow-delete-btn"
9147
+ }), /* @__PURE__ */ Z("div", {
9148
+ className: "v1-addrow-fields",
9149
+ children: /* @__PURE__ */ Z(B.Item, {
9150
+ name: [i],
9151
+ noStyle: !0,
9152
+ valuePropName: t.type === "checkbox" && !t.options?.length ? "checked" : "value",
9153
+ getValueFromEvent: t.type === "file" ? (e) => Array.isArray(e) ? e : e?.fileList : void 0,
9154
+ rules: rp(t, w, [...n, i], !0),
9155
+ children: /* @__PURE__ */ Z(mp, {
9156
+ field: t,
9157
+ form: w,
9158
+ name: [...n, i],
9159
+ moduleName: e,
9160
+ scopeValues: { clientId: Ae },
9161
+ formDisabled: Ne.busy
9162
+ })
9163
+ })
9164
+ })]
9165
+ }, r)),
9166
+ /* @__PURE__ */ Z(P, {
9167
+ type: "link",
9168
+ icon: /* @__PURE__ */ Z(wt, {}),
9169
+ onClick: () => i(),
9170
+ className: "v1-addrow-add-btn",
9171
+ children: `Add ${t.label ?? "Value"}`
9172
+ }),
9173
+ /* @__PURE__ */ Z(B.ErrorList, { errors: o })
9174
+ ]
9175
+ })
9176
+ })
9177
+ })
9178
+ }, t.field);
9179
+ }, dt = (e, t, n, r = !1, i) => {
9113
9180
  let a = /* @__PURE__ */ new Set(), o = [];
9114
9181
  return e.forEach((s) => {
9182
+ if (If(s.addRow) && t === void 0) {
9183
+ o.push(ut(s));
9184
+ return;
9185
+ }
9115
9186
  let c = s.combineKey?.trim?.();
9116
9187
  if (!c) {
9117
9188
  o.push(lt(s, t, n, {
@@ -9170,7 +9241,7 @@ function yp({ moduleName: e, action: t, clientId: n, region: r, formGroups: i, l
9170
9241
  })
9171
9242
  }, l));
9172
9243
  }), o;
9173
- }, dt = D(() => {
9244
+ }, ft = D(() => {
9174
9245
  if (se.fields?.length) return se.fields;
9175
9246
  let e = se.rows[0];
9176
9247
  return e ? Object.keys(e).filter((t) => !t.startsWith("_") && typeof e[t] != "object").map((e) => ({
@@ -9179,7 +9250,7 @@ function yp({ moduleName: e, action: t, clientId: n, region: r, formGroups: i, l
9179
9250
  label: e.replace(/([A-Z])/g, " $1").replace(/^./, (e) => e.toUpperCase()),
9180
9251
  isVisible: !0
9181
9252
  })) : [];
9182
- }, [se.fields, se.rows]), ft = (e) => !Array.isArray(e) || e.length === 0 ? "card" : e.some((e) => [
9253
+ }, [se.fields, se.rows]), pt = (e) => !Array.isArray(e) || e.length === 0 ? "card" : e.some((e) => [
9183
9254
  e?.sourceType,
9184
9255
  e?.profileSource,
9185
9256
  e?.selectedSource,
@@ -9190,15 +9261,15 @@ function yp({ moduleName: e, action: t, clientId: n, region: r, formGroups: i, l
9190
9261
  let t = String(e).trim().toLowerCase();
9191
9262
  return t ? !["all", "internal"].includes(t) : !1;
9192
9263
  })) ? "list" : "card";
9193
- D(() => ft(se.rows), [se.rows]);
9194
- let pt = D(() => {
9264
+ D(() => pt(se.rows), [se.rows]);
9265
+ let mt = D(() => {
9195
9266
  let e = Df({
9196
9267
  rows: se.rows,
9197
9268
  selectedSource: fe
9198
9269
  });
9199
- if (!e.length) return dt;
9270
+ if (!e.length) return ft;
9200
9271
  let t = new Set(e.map((e) => e.field));
9201
- return [...dt.filter((e) => e.cardRole !== "action" && !t.has(e.value)), ...e.map((e) => ({
9272
+ return [...ft.filter((e) => e.cardRole !== "action" && !t.has(e.value)), ...e.map((e) => ({
9202
9273
  value: e.field,
9203
9274
  field: e.field,
9204
9275
  label: e.label ?? "Action",
@@ -9221,11 +9292,11 @@ function yp({ moduleName: e, action: t, clientId: n, region: r, formGroups: i, l
9221
9292
  }))];
9222
9293
  }, [
9223
9294
  $e,
9224
- dt,
9295
+ ft,
9225
9296
  se.rows,
9226
9297
  fe,
9227
9298
  ge
9228
- ]), mt = D(() => {
9299
+ ]), ht = D(() => {
9229
9300
  if (!v) return se.actions;
9230
9301
  let e = (t) => ({
9231
9302
  ...t,
@@ -9341,7 +9412,7 @@ function yp({ moduleName: e, action: t, clientId: n, region: r, formGroups: i, l
9341
9412
  children: /* @__PURE__ */ Z(U, {
9342
9413
  gutter: [24, 0],
9343
9414
  align: "top",
9344
- children: ut(e.fields, o, r, If(e.sharedRowLabels), r)
9415
+ children: dt(e.fields, o, r, If(e.sharedRowLabels), r)
9345
9416
  })
9346
9417
  })]
9347
9418
  }, n)),
@@ -9350,7 +9421,7 @@ function yp({ moduleName: e, action: t, clientId: n, region: r, formGroups: i, l
9350
9421
  })
9351
9422
  }) : /* @__PURE__ */ Z(U, {
9352
9423
  gutter: [24, 0],
9353
- children: ut(e.fields, void 0, void 0, !1, r)
9424
+ children: dt(e.fields, void 0, void 0, !1, r)
9354
9425
  });
9355
9426
  return /* @__PURE__ */ Z(F, {
9356
9427
  className: "v1-card v1-edit-card",
@@ -9444,7 +9515,7 @@ function yp({ moduleName: e, action: t, clientId: n, region: r, formGroups: i, l
9444
9515
  moduleName: e,
9445
9516
  breadcrumbItems: [],
9446
9517
  dataSource: se.rows,
9447
- fields: pt,
9518
+ fields: mt,
9448
9519
  total: se.total,
9449
9520
  loading: se.loading,
9450
9521
  current: le.current,
@@ -9458,7 +9529,7 @@ function yp({ moduleName: e, action: t, clientId: n, region: r, formGroups: i, l
9458
9529
  tabs: me,
9459
9530
  selectedSource: fe,
9460
9531
  onTabChange: et,
9461
- actions: mt,
9532
+ actions: ht,
9462
9533
  actionRules: se.actionRules
9463
9534
  })
9464
9535
  ]
@@ -11643,7 +11714,7 @@ function Bh({ group: e }) {
11643
11714
  });
11644
11715
  }
11645
11716
  function Vh(e = [], t) {
11646
- return [...e].sort((e, t) => Number(e.order ?? 0) - Number(t.order ?? 0)).map((e) => ({
11717
+ return [...e].filter((e) => !jh(e.hideGroup)).sort((e, t) => Number(e.order ?? 0) - Number(t.order ?? 0)).map((e) => ({
11647
11718
  ...e,
11648
11719
  fields: [...e.fields ?? []].filter((e) => (e.show === void 0 || jh(e.show)) && (!e.visiblePermission || uc(e.visiblePermission, t))).sort((e, t) => Number(e.order ?? 0) - Number(t.order ?? 0))
11649
11720
  })).filter((e) => e.fields.length);
@@ -11834,19 +11905,19 @@ function Zh(e, t, n, r) {
11834
11905
  function Qh(e, t) {
11835
11906
  return Array.isArray(e) && e.length > 1 ? [...e.slice(0, -1), t] : [t];
11836
11907
  }
11837
- function $h(e, t, n) {
11838
- let r = e.label ?? e.field ?? "Field", i = e.validations ?? e.validation ?? e.rules ?? [], a = i.some((e) => (typeof e == "string" ? e : e?.type) === "required"), o = i.some((e) => (typeof e == "string" ? e : e?.type) === "email"), s = [];
11839
- return jh(e.req) && !a && s.push(Xh.required({
11908
+ function $h(e, t, n, r = !1) {
11909
+ let i = e.label ?? e.field ?? "Field", a = e.validations ?? e.validation ?? e.rules ?? [], o = a.some((e) => (typeof e == "string" ? e : e?.type) === "required"), s = a.some((e) => (typeof e == "string" ? e : e?.type) === "email"), c = [];
11910
+ return !r && jh(e.req) && !o && c.push(Xh.required({
11840
11911
  field: e,
11841
11912
  message: "Mandatory Field",
11842
11913
  form: t,
11843
11914
  name: n
11844
- })), (e.type === "email" || e.formatter === "email") && !o && s.push(Qs(r)), e.type === "number" && s.push({
11915
+ })), (e.type === "email" || e.formatter === "email") && !s && c.push(Qs(i)), e.type === "number" && c.push({
11845
11916
  pattern: /^[0-9]+$/,
11846
- message: `${r} must be a number`
11917
+ message: `${i} must be a number`
11847
11918
  }), [
11848
- ...s,
11849
- ...i.map((r) => Zh(r, e, t, n)),
11919
+ ...c,
11920
+ ...a.map((r) => Zh(r, e, t, n)),
11850
11921
  Do(e)
11851
11922
  ];
11852
11923
  }
@@ -12581,9 +12652,75 @@ function sg({ moduleName: e, recordId: t, clientId: n, region: r, breadcrumbItem
12581
12652
  className: a.inline ? "v1-combine-cell" : void 0,
12582
12653
  children: S
12583
12654
  }, t.field);
12584
- }, ae = (e, t, n, r = !1, i) => {
12655
+ }, ae = (t) => {
12656
+ let r = typeof t.field == "string" && t.field.includes(".") ? t.field.split(".") : [t.field], i = !!t.editablePermission && !uc(t.editablePermission, e), a = /* @__PURE__ */ Z(Rh, {
12657
+ field: t,
12658
+ label: t.label,
12659
+ locked: i
12660
+ });
12661
+ return /* @__PURE__ */ Z(I, {
12662
+ xs: 24,
12663
+ md: 24,
12664
+ children: /* @__PURE__ */ Z(B.Item, {
12665
+ label: a,
12666
+ required: jh(t.req),
12667
+ colon: !1,
12668
+ className: "v1-combine-field",
12669
+ children: /* @__PURE__ */ Z(B.List, {
12670
+ name: r,
12671
+ rules: [{ validator: async (e, n = []) => {
12672
+ if (jh(t.req) && !n.some((e) => e != null && e !== "" && !(Array.isArray(e) && e.length === 0))) throw Error("Mandatory Field");
12673
+ } }],
12674
+ children: (i, { add: a, remove: o }, { errors: s }) => /* @__PURE__ */ Q("div", {
12675
+ className: "v1-addrow-wrapper",
12676
+ children: [
12677
+ i.map(({ key: i, name: a }) => /* @__PURE__ */ Q("div", {
12678
+ className: "v1-addrow-item",
12679
+ children: [/* @__PURE__ */ Z(P, {
12680
+ type: "text",
12681
+ danger: !0,
12682
+ icon: /* @__PURE__ */ Z(Ge, {}),
12683
+ onClick: () => o(a),
12684
+ className: "v1-addrow-delete-btn"
12685
+ }), /* @__PURE__ */ Z("div", {
12686
+ className: "v1-addrow-fields",
12687
+ children: /* @__PURE__ */ Z(B.Item, {
12688
+ name: [a],
12689
+ noStyle: !0,
12690
+ valuePropName: t.type === "checkbox" && !t.options?.length ? "checked" : "value",
12691
+ getValueFromEvent: t.type === "file" ? (e) => Array.isArray(e) ? e : e?.fileList : void 0,
12692
+ rules: $h(t, d, [...r, a], !0),
12693
+ children: /* @__PURE__ */ Z(ag, {
12694
+ field: t,
12695
+ form: d,
12696
+ name: [...r, a],
12697
+ moduleName: e,
12698
+ scopeValues: { clientId: n },
12699
+ formDisabled: T.busy
12700
+ })
12701
+ })
12702
+ })]
12703
+ }, i)),
12704
+ /* @__PURE__ */ Z(P, {
12705
+ type: "link",
12706
+ icon: /* @__PURE__ */ Z(wt, {}),
12707
+ onClick: () => a(),
12708
+ className: "v1-addrow-add-btn",
12709
+ children: `Add ${t.label ?? "Value"}`
12710
+ }),
12711
+ /* @__PURE__ */ Z(B.ErrorList, { errors: s })
12712
+ ]
12713
+ })
12714
+ })
12715
+ })
12716
+ }, t.field);
12717
+ }, V = (e, t, n, r = !1, i) => {
12585
12718
  let a = /* @__PURE__ */ new Set(), o = [];
12586
12719
  return e.forEach((s) => {
12720
+ if (jh(s.addRow) && t === void 0) {
12721
+ o.push(ae(s));
12722
+ return;
12723
+ }
12587
12724
  let c = s.combineKey?.trim?.();
12588
12725
  if (!c) {
12589
12726
  o.push(z(s, t, n, {
@@ -12721,7 +12858,7 @@ function sg({ moduleName: e, recordId: t, clientId: n, region: r, breadcrumbItem
12721
12858
  children: /* @__PURE__ */ Z(U, {
12722
12859
  gutter: [24, 0],
12723
12860
  align: "top",
12724
- children: ae(e.fields, o, r, jh(e.sharedRowLabels), r)
12861
+ children: V(e.fields, o, r, jh(e.sharedRowLabels), r)
12725
12862
  })
12726
12863
  })]
12727
12864
  }, n)),
@@ -12730,7 +12867,7 @@ function sg({ moduleName: e, recordId: t, clientId: n, region: r, breadcrumbItem
12730
12867
  })
12731
12868
  }) : /* @__PURE__ */ Z(U, {
12732
12869
  gutter: [24, 0],
12733
- children: ae(e.fields, void 0, void 0, !1, r)
12870
+ children: V(e.fields, void 0, void 0, !1, r)
12734
12871
  });
12735
12872
  return /* @__PURE__ */ Z(F, {
12736
12873
  className: "v1-card v1-edit-card",
@@ -18315,7 +18452,7 @@ function eb(e = []) {
18315
18452
  formatter: e.formatter ?? "",
18316
18453
  validations: t
18317
18454
  };
18318
- if (e.showOnAdd === !1 && (n.showOnAdd = !1), e.placeholder && (n.placeholder = e.placeholder), e.hidePlaceholder && (n.hidePlaceholder = !0), e.combineKey && (n.combineKey = e.combineKey), e.combineLabel && (n.combineLabel = e.combineLabel), e.combineRole && (n.combineRole = e.combineRole), e.combineToggleLabel && (n.combineToggleLabel = e.combineToggleLabel), e.combineToggleTarget && (n.combineToggleTarget = e.combineToggleTarget), e.combineWidth !== void 0 && e.combineWidth !== "" && Number(e.combineWidth) > 0 && (n.combineWidth = Number(e.combineWidth)), e.combineWrap && (n.combineWrap = !0), e.combineSpan !== void 0 && e.combineSpan !== "" && [12, 24].includes(Number(e.combineSpan)) && (n.combineSpan = Number(e.combineSpan)), e.defaultOnEdit && (n.defaultOnEdit = !0), e.emptyValues !== void 0 && e.emptyValues !== "" && (n.emptyValues = String(e.emptyValues).split(",").map((e) => e.trim()).filter((e) => e !== "")), e.valuePaths !== void 0 && e.valuePaths !== "" && (n.valuePaths = String(e.valuePaths).split(",").map((e) => e.trim()).filter((e) => e !== "")), e.clientScope && (n.clientScope = !0, e.clientGateMessage && (n.clientGateMessage = e.clientGateMessage), e.clientGateResetOnChange && (n.clientGateResetOnChange = !0)), e.visiblePermission && (n.visiblePermission = String(e.visiblePermission).trim()), e.editablePermission && (n.editablePermission = String(e.editablePermission).trim()), e.infoEnabled && e.infoText && (n.infoEnabled = !0, n.infoText = e.infoText), e.helpText && (n.helpText = e.helpText), $y(n, e), e.type === "file" && (n.multiple = e.multiple ?? !1, n.maxCount = n.multiple ? Number(e.maxCount ?? 5) : 1, e.fileKey && (n.fileKey = e.fileKey), e.fileNameKey && (n.fileNameKey = e.fileNameKey), e.fileUrlKey && (n.fileUrlKey = e.fileUrlKey), e.accept && e.accept !== "any" && (n.accept = e.accept)), e.showIf?.field) {
18455
+ if (e.showOnAdd === !1 && (n.showOnAdd = !1), e.addRow && (n.addRow = !0), e.placeholder && (n.placeholder = e.placeholder), e.hidePlaceholder && (n.hidePlaceholder = !0), e.combineKey && (n.combineKey = e.combineKey), e.combineLabel && (n.combineLabel = e.combineLabel), e.combineRole && (n.combineRole = e.combineRole), e.combineToggleLabel && (n.combineToggleLabel = e.combineToggleLabel), e.combineToggleTarget && (n.combineToggleTarget = e.combineToggleTarget), e.combineWidth !== void 0 && e.combineWidth !== "" && Number(e.combineWidth) > 0 && (n.combineWidth = Number(e.combineWidth)), e.combineWrap && (n.combineWrap = !0), e.combineSpan !== void 0 && e.combineSpan !== "" && [12, 24].includes(Number(e.combineSpan)) && (n.combineSpan = Number(e.combineSpan)), e.defaultOnEdit && (n.defaultOnEdit = !0), e.emptyValues !== void 0 && e.emptyValues !== "" && (n.emptyValues = String(e.emptyValues).split(",").map((e) => e.trim()).filter((e) => e !== "")), e.valuePaths !== void 0 && e.valuePaths !== "" && (n.valuePaths = String(e.valuePaths).split(",").map((e) => e.trim()).filter((e) => e !== "")), e.clientScope && (n.clientScope = !0, e.clientGateMessage && (n.clientGateMessage = e.clientGateMessage), e.clientGateResetOnChange && (n.clientGateResetOnChange = !0)), e.visiblePermission && (n.visiblePermission = String(e.visiblePermission).trim()), e.editablePermission && (n.editablePermission = String(e.editablePermission).trim()), e.infoEnabled && e.infoText && (n.infoEnabled = !0, n.infoText = e.infoText), e.helpText && (n.helpText = e.helpText), $y(n, e), e.type === "file" && (n.multiple = e.multiple ?? !1, n.maxCount = n.multiple ? Number(e.maxCount ?? 5) : 1, e.fileKey && (n.fileKey = e.fileKey), e.fileNameKey && (n.fileNameKey = e.fileNameKey), e.fileUrlKey && (n.fileUrlKey = e.fileUrlKey), e.accept && e.accept !== "any" && (n.accept = e.accept)), e.showIf?.field) {
18319
18456
  n.showIf = {
18320
18457
  field: e.showIf.field,
18321
18458
  operator: e.showIf.operator ?? "eq"
@@ -18372,6 +18509,7 @@ function tb(e) {
18372
18509
  req: e.req === 1,
18373
18510
  edit: e.edit === 1,
18374
18511
  showOnAdd: e.showOnAdd !== !1,
18512
+ addRow: e.addRow ?? !1,
18375
18513
  placeholder: e.placeholder ?? "",
18376
18514
  hidePlaceholder: e.hidePlaceholder ?? !1,
18377
18515
  clientScope: e.clientScope ?? !1,
@@ -19123,6 +19261,19 @@ function nb({ form: e, fieldItems: t, add: n, remove: r, move: i, absBase: a, mo
19123
19261
  unCheckedChildren: "Read"
19124
19262
  })
19125
19263
  }),
19264
+ /* @__PURE__ */ Z(B.Item, {
19265
+ ...a,
19266
+ name: [n, "addRow"],
19267
+ valuePropName: "checked",
19268
+ style: { marginBottom: 0 },
19269
+ initialValue: !1,
19270
+ tooltip: "Let users repeat this single field (add/remove multiple values). Ignored when this field's group is itself Add Row.",
19271
+ children: /* @__PURE__ */ Z(K, {
19272
+ size: "small",
19273
+ checkedChildren: "Repeat",
19274
+ unCheckedChildren: "Single"
19275
+ })
19276
+ }),
19126
19277
  /* @__PURE__ */ Z(B.Item, {
19127
19278
  ...a,
19128
19279
  name: [n, "clientScope"],
@@ -20168,7 +20319,7 @@ function nb({ form: e, fieldItems: t, add: n, remove: r, move: i, absBase: a, mo
20168
20319
  }
20169
20320
  function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allGroupsByModule: i, onClose: a, onSaved: o, onSaveGroup: s }) {
20170
20321
  let [c] = B.useForm(), [l, u] = k(!1), [d, f] = k(n), [p, m] = k({}), [h, g] = k(!1), [_, v] = k(null), [y, b] = k(() => /* @__PURE__ */ new Set()), [x, S] = k("settings"), [C, w] = k(!1), T = O({}), A = O(null);
20171
- async function j(e) {
20322
+ async function M(e) {
20172
20323
  if (!(!e || T.current[e])) {
20173
20324
  T.current[e] = "loading", g(!0);
20174
20325
  try {
@@ -20192,6 +20343,8 @@ function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allG
20192
20343
  name: t.name,
20193
20344
  label: t.label,
20194
20345
  addRow: t.addRow ?? !1,
20346
+ hideGroup: t.hideGroup ?? !1,
20347
+ moduleName: t.moduleName ?? "",
20195
20348
  minRows: t.minRows ?? "",
20196
20349
  initialRows: t.initialRows ?? "",
20197
20350
  requireOne: t.requireOne ?? !1,
@@ -20205,35 +20358,37 @@ function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allG
20205
20358
  }) : (c.resetFields(), c.setFieldsValue({
20206
20359
  module: r,
20207
20360
  addRow: !1,
20361
+ hideGroup: !1,
20362
+ moduleName: "",
20208
20363
  minRows: "",
20209
20364
  requireOne: !1,
20210
20365
  infoEnabled: !1,
20211
20366
  toggleEnabled: !1,
20212
20367
  order: 0,
20213
20368
  fields: []
20214
- })), j(r);
20369
+ })), M(r);
20215
20370
  }, [
20216
20371
  e,
20217
20372
  t,
20218
20373
  n,
20219
20374
  c
20220
20375
  ]);
20221
- function M(e) {
20222
- f(e), j(e);
20376
+ function N(e) {
20377
+ f(e), M(e);
20223
20378
  }
20224
- function N() {
20379
+ function ee() {
20225
20380
  b(/* @__PURE__ */ new Set()), S("settings"), w(!1), a();
20226
20381
  }
20227
- function ee(e) {
20382
+ function F(e) {
20228
20383
  S(e), e === "fields" && w(!0);
20229
20384
  }
20230
- function F(e, t = !1) {
20385
+ function te(e, t = !1) {
20231
20386
  b((n) => {
20232
20387
  let r = new Set(n);
20233
20388
  return t ? r.add(e) : r.has(e) ? r.delete(e) : r.add(e), r;
20234
20389
  });
20235
20390
  }
20236
- function te(e) {
20391
+ function I(e) {
20237
20392
  let n = i[e] ?? [], r = /* @__PURE__ */ new Set();
20238
20393
  return n.forEach((e) => {
20239
20394
  t && e.id === t.id || (e.fields ?? []).forEach((e) => {
@@ -20241,7 +20396,7 @@ function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allG
20241
20396
  });
20242
20397
  }), r;
20243
20398
  }
20244
- function I(e, t) {
20399
+ function ne(e, t) {
20245
20400
  let n = (p[d] ?? []).find((t) => t.value === e);
20246
20401
  if (!n) return;
20247
20402
  let r = c.getFieldValue(["fields", t]) ?? {};
@@ -20252,8 +20407,8 @@ function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allG
20252
20407
  type: n.type ?? "text"
20253
20408
  });
20254
20409
  }
20255
- function ne(e) {
20256
- let t = te(e);
20410
+ function re(e) {
20411
+ let t = I(e);
20257
20412
  return (p[e] ?? []).map((e) => ({
20258
20413
  value: e.value,
20259
20414
  disabled: t.has(e.value),
@@ -20274,7 +20429,7 @@ function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allG
20274
20429
  searchLabel: `${e.label} ${e.value}`.toLowerCase()
20275
20430
  }));
20276
20431
  }
20277
- async function re() {
20432
+ async function L() {
20278
20433
  try {
20279
20434
  let e = await c.validateFields(), n = {
20280
20435
  ...c.getFieldsValue(!0),
@@ -20290,7 +20445,7 @@ function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allG
20290
20445
  order: Number(n.order ?? 0),
20291
20446
  fields: eb(n.fields ?? [])
20292
20447
  };
20293
- n.addRow && n.minRows !== void 0 && n.minRows !== "" && (r.minRows = Number(n.minRows)), n.addRow && n.initialRows !== void 0 && n.initialRows !== "" && (r.initialRows = Number(n.initialRows)), n.addRow && n.requireOne && (r.requireOne = !0), n.infoEnabled && n.infoText && (r.infoEnabled = !0, r.infoText = n.infoText), n.toggleEnabled && n.toggleField && (r.toggleEnabled = !0, r.toggleLabel = n.toggleLabel || "Toggle", r.toggleField = n.toggleField), s ? (await s(r, t), Y.success(t ? "Group updated" : "Group created")) : t ? (await Xi(t.id, r), Y.success("Group updated")) : (await Yi(r), Y.success("Group created")), b(/* @__PURE__ */ new Set()), S("settings"), w(!1), o();
20448
+ n.hideGroup && (r.hideGroup = !0), n.moduleName && (r.moduleName = n.moduleName), n.addRow && n.minRows !== void 0 && n.minRows !== "" && (r.minRows = Number(n.minRows)), n.addRow && n.initialRows !== void 0 && n.initialRows !== "" && (r.initialRows = Number(n.initialRows)), n.addRow && n.requireOne && (r.requireOne = !0), n.infoEnabled && n.infoText && (r.infoEnabled = !0, r.infoText = n.infoText), n.toggleEnabled && n.toggleField && (r.toggleEnabled = !0, r.toggleLabel = n.toggleLabel || "Toggle", r.toggleField = n.toggleField), s ? (await s(r, t), Y.success(t ? "Group updated" : "Group created")) : t ? (await Xi(t.id, r), Y.success("Group updated")) : (await Yi(r), Y.success("Group created")), b(/* @__PURE__ */ new Set()), S("settings"), w(!1), o();
20294
20449
  } catch (e) {
20295
20450
  if (e?.errorFields) return;
20296
20451
  Y.error(e.message || "Could not save group");
@@ -20298,7 +20453,7 @@ function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allG
20298
20453
  u(!1);
20299
20454
  }
20300
20455
  }
20301
- let L = D(() => ne(d || n), [
20456
+ let R = D(() => re(d || n), [
20302
20457
  i,
20303
20458
  n,
20304
20459
  t,
@@ -20307,7 +20462,7 @@ function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allG
20307
20462
  ]);
20308
20463
  return /* @__PURE__ */ Z(H, {
20309
20464
  open: e,
20310
- onCancel: N,
20465
+ onCancel: ee,
20311
20466
  width: 1080,
20312
20467
  centered: !0,
20313
20468
  destroyOnClose: !0,
@@ -20320,12 +20475,12 @@ function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allG
20320
20475
  footer: /* @__PURE__ */ Q("div", {
20321
20476
  className: "fg-drawer-footer",
20322
20477
  children: [/* @__PURE__ */ Z(P, {
20323
- onClick: N,
20478
+ onClick: ee,
20324
20479
  children: "Cancel"
20325
20480
  }), /* @__PURE__ */ Z(P, {
20326
20481
  type: "primary",
20327
20482
  loading: l,
20328
- onClick: re,
20483
+ onClick: L,
20329
20484
  icon: Z(t ? Ye : wt, {}),
20330
20485
  children: t ? "Update Group" : "Create Group"
20331
20486
  })]
@@ -20344,7 +20499,7 @@ function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allG
20344
20499
  role: "tab",
20345
20500
  "aria-selected": x === "settings",
20346
20501
  className: x === "settings" ? "is-active" : "",
20347
- onClick: () => ee("settings"),
20502
+ onClick: () => F("settings"),
20348
20503
  children: [/* @__PURE__ */ Z("span", {
20349
20504
  className: "fg-editor-tab-number",
20350
20505
  children: "1"
@@ -20354,7 +20509,7 @@ function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allG
20354
20509
  role: "tab",
20355
20510
  "aria-selected": x === "fields",
20356
20511
  className: x === "fields" ? "is-active" : "",
20357
- onClick: () => ee("fields"),
20512
+ onClick: () => F("fields"),
20358
20513
  children: [/* @__PURE__ */ Z("span", {
20359
20514
  className: "fg-editor-tab-number",
20360
20515
  children: "2"
@@ -20380,7 +20535,7 @@ function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allG
20380
20535
  children: /* @__PURE__ */ Z(W, {
20381
20536
  options: r,
20382
20537
  placeholder: "Select module",
20383
- onChange: M
20538
+ onChange: N
20384
20539
  })
20385
20540
  }),
20386
20541
  /* @__PURE__ */ Z(B.Item, {
@@ -20407,6 +20562,21 @@ function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allG
20407
20562
  className: "fg-mono-input"
20408
20563
  })
20409
20564
  }),
20565
+ /* @__PURE__ */ Z(B.Item, {
20566
+ name: "moduleName",
20567
+ label: "Target Collection (optional)",
20568
+ tooltip: "Route THIS group's fields to a different collection instead of the default module record. Groups sharing the same target merge into one linked record. Leave blank for default behaviour.",
20569
+ children: /* @__PURE__ */ Z(j, {
20570
+ options: r.map((e) => ({
20571
+ value: e.value,
20572
+ label: e.label
20573
+ })),
20574
+ placeholder: "Default (this module's own record)",
20575
+ allowClear: !0,
20576
+ filterOption: (e, t) => (t?.value ?? "").toLowerCase().includes(e.toLowerCase()),
20577
+ className: "fg-mono-input"
20578
+ })
20579
+ }),
20410
20580
  /* @__PURE__ */ Q("div", {
20411
20581
  className: "fg-inline-row",
20412
20582
  children: [
@@ -20428,6 +20598,16 @@ function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allG
20428
20598
  unCheckedChildren: "No"
20429
20599
  })
20430
20600
  }),
20601
+ /* @__PURE__ */ Z(B.Item, {
20602
+ name: "hideGroup",
20603
+ label: "Hide Group",
20604
+ valuePropName: "checked",
20605
+ tooltip: "Hide this group entirely from Add/Edit forms — not rendered, not validated, not submitted.",
20606
+ children: /* @__PURE__ */ Z(K, {
20607
+ checkedChildren: "Hidden",
20608
+ unCheckedChildren: "Visible"
20609
+ })
20610
+ }),
20431
20611
  /* @__PURE__ */ Z(B.Item, {
20432
20612
  name: "minRows",
20433
20613
  label: "Min Rows",
@@ -20538,7 +20718,7 @@ function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allG
20538
20718
  children: "Next, review the fields included in this group."
20539
20719
  }), /* @__PURE__ */ Z(P, {
20540
20720
  type: "primary",
20541
- onClick: () => ee("fields"),
20721
+ onClick: () => F("fields"),
20542
20722
  children: "Continue to Fields"
20543
20723
  })]
20544
20724
  })]
@@ -20557,9 +20737,9 @@ function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allG
20557
20737
  children: "Open only the field you want to change"
20558
20738
  }),
20559
20739
  h && /* @__PURE__ */ Z(_e, { size: "small" }),
20560
- !h && L.length > 0 && /* @__PURE__ */ Q("span", {
20740
+ !h && R.length > 0 && /* @__PURE__ */ Q("span", {
20561
20741
  className: "fg-fields-hint",
20562
- children: [L.length, " fields available"]
20742
+ children: [R.length, " fields available"]
20563
20743
  })
20564
20744
  ]
20565
20745
  }), /* @__PURE__ */ Z(B.List, {
@@ -20571,14 +20751,14 @@ function rb({ open: e, editingGroup: t, defaultModule: n, moduleOptions: r, allG
20571
20751
  remove: n,
20572
20752
  move: r,
20573
20753
  absBase: [],
20574
- moduleFieldOptions: L,
20754
+ moduleFieldOptions: R,
20575
20755
  fieldsLoading: h,
20576
20756
  dragIndexRef: A,
20577
20757
  dragOverIndex: _,
20578
20758
  setDragOverIndex: v,
20579
- onFieldKeySelect: (e, t) => I(e, t),
20759
+ onFieldKeySelect: (e, t) => ne(e, t),
20580
20760
  expandedFieldKeys: y,
20581
- onToggleField: F
20761
+ onToggleField: te
20582
20762
  })
20583
20763
  })]
20584
20764
  })
@@ -20592,10 +20772,23 @@ function ib({ groups: e, onEdit: t, onDelete: n, onCopy: r, onPaste: i, canPaste
20592
20772
  title: "Label",
20593
20773
  dataIndex: "label",
20594
20774
  key: "label",
20595
- render: (e) => /* @__PURE__ */ Z(Ly, {
20596
- strong: !0,
20597
- style: { color: "var(--color-text-heading)" },
20598
- children: e
20775
+ render: (e, t) => /* @__PURE__ */ Q(G, {
20776
+ size: 6,
20777
+ children: [
20778
+ /* @__PURE__ */ Z(Ly, {
20779
+ strong: !0,
20780
+ style: { color: "var(--color-text-heading)" },
20781
+ children: e
20782
+ }),
20783
+ t.hideGroup && /* @__PURE__ */ Z(q, {
20784
+ color: "default",
20785
+ children: "Hidden"
20786
+ }),
20787
+ t.moduleName && /* @__PURE__ */ Q(q, {
20788
+ color: "purple",
20789
+ children: ["→ ", t.moduleName]
20790
+ })
20791
+ ]
20599
20792
  })
20600
20793
  },
20601
20794
  {
@@ -20859,6 +21052,8 @@ function ab({ open: e, editingForm: t, moduleOptions: n, onClose: r, onSaved: i
20859
21052
  label: t.label,
20860
21053
  groups: (t.groups ?? []).map((e) => ({
20861
21054
  ...e,
21055
+ hideGroup: e.hideGroup ?? !1,
21056
+ moduleName: e.moduleName ?? "",
20862
21057
  infoEnabled: e.infoEnabled ?? !1,
20863
21058
  infoText: e.infoText ?? "",
20864
21059
  minRows: e.minRows ?? "",
@@ -20905,6 +21100,8 @@ function ab({ open: e, editingForm: t, moduleOptions: n, onClose: r, onSaved: i
20905
21100
  label: e.label,
20906
21101
  name: e.name,
20907
21102
  addRow: e.addRow ?? !1,
21103
+ ...e.hideGroup ? { hideGroup: !0 } : {},
21104
+ ...e.moduleName ? { moduleName: e.moduleName } : {},
20908
21105
  ...e.addRow && e.minRows !== void 0 && e.minRows !== "" ? { minRows: Number(e.minRows) } : {},
20909
21106
  ...e.addRow && e.initialRows !== void 0 && e.initialRows !== "" ? { initialRows: Number(e.initialRows) } : {},
20910
21107
  ...e.addRow && e.requireOne ? { requireOne: !0 } : {},
@@ -21041,7 +21238,7 @@ function ab({ open: e, editingForm: t, moduleOptions: n, onClose: r, onSaved: i
21041
21238
  }),
21042
21239
  /* @__PURE__ */ Z(B.List, {
21043
21240
  name: "groups",
21044
- children: (e, { add: t, remove: n }) => /* @__PURE__ */ Q(X, { children: [e.map(({ key: e, name: t }) => /* @__PURE__ */ Q("div", {
21241
+ children: (e, { add: t, remove: r }) => /* @__PURE__ */ Q(X, { children: [e.map(({ key: e, name: t }) => /* @__PURE__ */ Q("div", {
21045
21242
  className: "fg-form-section",
21046
21243
  style: { marginBottom: 16 },
21047
21244
  children: [
@@ -21061,7 +21258,7 @@ function ab({ open: e, editingForm: t, moduleOptions: n, onClose: r, onSaved: i
21061
21258
  children: /* @__PURE__ */ Z("button", {
21062
21259
  type: "button",
21063
21260
  className: "fg-field-remove-btn",
21064
- onClick: () => n(t),
21261
+ onClick: () => r(t),
21065
21262
  "aria-label": "Remove group",
21066
21263
  children: /* @__PURE__ */ Z(bt, {})
21067
21264
  })
@@ -21118,6 +21315,39 @@ function ab({ open: e, editingForm: t, moduleOptions: n, onClose: r, onSaved: i
21118
21315
  unCheckedChildren: "No"
21119
21316
  })
21120
21317
  }),
21318
+ /* @__PURE__ */ Z(B.Item, {
21319
+ name: [t, "hideGroup"],
21320
+ label: "Hide Group",
21321
+ valuePropName: "checked",
21322
+ initialValue: !1,
21323
+ style: { marginBottom: 8 },
21324
+ tooltip: "Hide this group entirely from Add/Edit forms — not rendered, not validated, not submitted.",
21325
+ children: /* @__PURE__ */ Z(K, {
21326
+ size: "small",
21327
+ checkedChildren: "Hidden",
21328
+ unCheckedChildren: "Visible"
21329
+ })
21330
+ }),
21331
+ /* @__PURE__ */ Z(B.Item, {
21332
+ name: [t, "moduleName"],
21333
+ label: "Target Collection",
21334
+ style: {
21335
+ marginBottom: 8,
21336
+ flex: 2
21337
+ },
21338
+ tooltip: "Route THIS group's fields to a different collection instead of the default module record. Leave blank for default behaviour.",
21339
+ children: /* @__PURE__ */ Z(j, {
21340
+ size: "small",
21341
+ options: n.map((e) => ({
21342
+ value: e.value,
21343
+ label: e.label
21344
+ })),
21345
+ placeholder: "Default",
21346
+ allowClear: !0,
21347
+ filterOption: (e, t) => (t?.value ?? "").toLowerCase().includes(e.toLowerCase()),
21348
+ className: "fg-mono-input"
21349
+ })
21350
+ }),
21121
21351
  /* @__PURE__ */ Z(B.Item, {
21122
21352
  name: [t, "minRows"],
21123
21353
  label: "Min Rows",