@realtek/core-theme 0.0.111 → 0.0.113

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
@@ -9126,11 +9126,11 @@ function Ap({ moduleName: e, action: t, clientId: n, region: r, formGroups: i, l
9126
9126
  default: return !0;
9127
9127
  }
9128
9128
  }, [ut, dt] = k({}), ft = (e) => String(e?.field ?? ""), pt = (t, n, r, i = {}) => {
9129
- 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 = !!t.editablePermission && !bc(t.editablePermission, e), f = i.inline || i.hideLabel || !l && t.type === "checkbox" ? "" : /* @__PURE__ */ Z(Dp, {
9129
+ 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 ? [...Array.isArray(r) ? r : [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 = !!t.editablePermission && !bc(t.editablePermission, e), f = i.inline || i.hideLabel || !l && t.type === "checkbox" ? "" : /* @__PURE__ */ Z(Dp, {
9130
9130
  field: t,
9131
9131
  label: t.label,
9132
9132
  locked: d
9133
- }), p = ct(t, c), m = i.inline || t.type === "file" && Kf(t.multiple) || t.type === "text-editor" ? 24 : t.col ?? 12, h = 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, _ = (t.aiActions || []).filter((e) => e.trigger === "click"), v = (t.aiActions || []).find((e) => e.trigger === "upload"), b = /* @__PURE__ */ Z(z.Item, {
9133
+ }), p = ct(t, c), m = i.inline || t.type === "file" && Kf(t.multiple) || t.type === "text-editor" ? 24 : t.col ?? 12, h = r !== void 0 && n !== void 0 ? [...Array.isArray(r) ? r : [r], n] : null, g = n === void 0 && t.type !== "file" && t.defaultValue !== void 0 && t.defaultValue !== "" ? t.defaultValue : void 0, _ = (t.aiActions || []).filter((e) => e.trigger === "click"), v = (t.aiActions || []).find((e) => e.trigger === "upload"), b = /* @__PURE__ */ Z(z.Item, {
9134
9134
  label: f,
9135
9135
  name: s,
9136
9136
  extra: t.helpText ? /* @__PURE__ */ Z(Vf, {
@@ -9273,65 +9273,76 @@ function Ap({ moduleName: e, action: t, clientId: n, region: r, formGroups: i, l
9273
9273
  field: t,
9274
9274
  label: t.label,
9275
9275
  locked: a
9276
- }), s = us(t), c = Math.max(0, Number(t.minRows ?? 0) || 0), l = t.maxRows !== void 0 && t.maxRows !== "" && Number(t.maxRows) > 0 ? Number(t.maxRows) : 0, u = [n, ...i], d = ds(t, void 0);
9276
+ }), s = us(t), c = Array.isArray(t.subFields) && t.subFields.length > 0, l = c ? t.subFields.map((e) => ({
9277
+ ...e,
9278
+ show: 1,
9279
+ edit: 1
9280
+ })) : null, u = Math.max(0, Number(t.minRows ?? 0) || 0), d = t.maxRows !== void 0 && t.maxRows !== "" && Number(t.maxRows) > 0 ? Number(t.maxRows) : 0, f = [n, ...i], p = [
9281
+ ...Array.isArray(r) ? r : [r],
9282
+ n,
9283
+ ...i
9284
+ ], m = ds(t, void 0);
9277
9285
  return /* @__PURE__ */ Z(I, {
9278
9286
  xs: 24,
9279
- md: t.col ?? 24,
9287
+ md: c ? 24 : t.col ?? 24,
9280
9288
  children: /* @__PURE__ */ Z(z.Item, {
9281
9289
  label: o,
9282
9290
  required: pp(t),
9283
9291
  colon: !1,
9284
9292
  className: "v1-combine-field",
9285
9293
  children: /* @__PURE__ */ Z(z.List, {
9286
- name: u,
9287
- initialValue: d,
9288
- children: (a, { add: o, remove: u }, { errors: d }) => /* @__PURE__ */ Q("div", {
9294
+ name: f,
9295
+ initialValue: m,
9296
+ rules: c ? [{ validator: async (e, n = []) => {
9297
+ if (pp(t) && !n.some((e) => Zf(e))) throw Error("Mandatory Field");
9298
+ if (u > 0 && n.length < u) throw Error(`Keep at least ${u} row${u > 1 ? "s" : ""}.`);
9299
+ } }] : [],
9300
+ children: (n, { add: r, remove: i }, { errors: a }) => /* @__PURE__ */ Q("div", {
9289
9301
  className: "v1-addrow-wrapper",
9290
9302
  children: [
9291
- a.map(({ key: o, name: l }) => {
9292
- let d = [
9293
- r,
9294
- n,
9295
- ...i,
9296
- l
9297
- ];
9303
+ n.map(({ key: r, name: a }) => {
9304
+ let o = [...p, a];
9298
9305
  return /* @__PURE__ */ Q("div", {
9299
9306
  className: "v1-addrow-item",
9300
9307
  children: [/* @__PURE__ */ Z(P, {
9301
9308
  type: "text",
9302
9309
  danger: !0,
9303
9310
  icon: /* @__PURE__ */ Z(Ke, {}),
9304
- onClick: () => u(l),
9305
- disabled: a.length <= c,
9311
+ onClick: () => i(a),
9312
+ disabled: n.length <= u,
9306
9313
  className: "v1-addrow-delete-btn"
9307
9314
  }), /* @__PURE__ */ Z("div", {
9308
9315
  className: "v1-addrow-fields",
9309
- children: /* @__PURE__ */ Z(z.Item, {
9310
- name: [l],
9316
+ children: c ? /* @__PURE__ */ Z(U, {
9317
+ gutter: [24, 0],
9318
+ align: "top",
9319
+ children: gt(l, a, p, !1, t.field)
9320
+ }) : /* @__PURE__ */ Z(z.Item, {
9321
+ name: [a],
9311
9322
  noStyle: !0,
9312
9323
  valuePropName: t.type === "checkbox" && !t.options?.length ? "checked" : "value",
9313
9324
  getValueFromEvent: t.type === "file" ? (e) => Array.isArray(e) ? e : e?.fileList : void 0,
9314
- rules: mp(s, w, d, y),
9325
+ rules: mp(s, w, o, y),
9315
9326
  children: /* @__PURE__ */ Z(Tp, {
9316
9327
  field: s,
9317
9328
  form: w,
9318
- name: d,
9329
+ name: o,
9319
9330
  moduleName: e,
9320
9331
  scopeValues: { clientId: je },
9321
9332
  formDisabled: Ie.busy
9322
9333
  })
9323
9334
  })
9324
9335
  })]
9325
- }, o);
9336
+ }, r);
9326
9337
  }),
9327
- (!l || a.length < l) && /* @__PURE__ */ Z(P, {
9338
+ (!d || n.length < d) && /* @__PURE__ */ Z(P, {
9328
9339
  type: "link",
9329
9340
  icon: /* @__PURE__ */ Z(Tt, {}),
9330
- onClick: () => o(),
9341
+ onClick: () => r(),
9331
9342
  className: "v1-addrow-add-btn",
9332
9343
  children: t.addLabel ?? `Add ${t.label ?? "Value"}`
9333
9344
  }),
9334
- /* @__PURE__ */ Z(z.ErrorList, { errors: d })
9345
+ /* @__PURE__ */ Z(z.ErrorList, { errors: a })
9335
9346
  ]
9336
9347
  })
9337
9348
  })
@@ -9344,7 +9355,7 @@ function Ap({ moduleName: e, action: t, clientId: n, region: r, formGroups: i, l
9344
9355
  o.push(mt(s));
9345
9356
  return;
9346
9357
  }
9347
- if (Kf(s.addRow) && t !== void 0 && !(Array.isArray(s.subFields) && s.subFields.length > 0)) {
9358
+ if (Kf(s.addRow) && t !== void 0) {
9348
9359
  o.push(ht(s, t, n));
9349
9360
  return;
9350
9361
  }
@@ -12765,11 +12776,11 @@ function yg({ moduleName: e, recordId: t, clientId: n, region: r, breadcrumbItem
12765
12776
  default: return !0;
12766
12777
  }
12767
12778
  }, se = (t, r, i, a = {}) => {
12768
- let o = typeof t.field == "string" && t.field.includes(".") ? t.field.split(".") : null, s = o ?? t.field, c = r === void 0 ? s : [r, ...o ?? [t.field]], l = i !== void 0 && r !== void 0 ? [i, ...Array.isArray(c) ? c : [c]] : c, u = t.type === "checkbox" && (t.options && t.options.length > 0 || t.dataSource && t.dataSource !== "static"), f = !u && t.type === "checkbox" ? "checked" : "value", p = !!t.editablePermission && !bc(t.editablePermission, e), m = a.inline || a.hideLabel || !u && t.type === "checkbox" ? "" : /* @__PURE__ */ Z(Yh, {
12779
+ let o = typeof t.field == "string" && t.field.includes(".") ? t.field.split(".") : null, s = o ?? t.field, c = r === void 0 ? s : [r, ...o ?? [t.field]], l = i !== void 0 && r !== void 0 ? [...Array.isArray(i) ? i : [i], ...Array.isArray(c) ? c : [c]] : c, u = t.type === "checkbox" && (t.options && t.options.length > 0 || t.dataSource && t.dataSource !== "static"), f = !u && t.type === "checkbox" ? "checked" : "value", p = !!t.editablePermission && !bc(t.editablePermission, e), m = a.inline || a.hideLabel || !u && t.type === "checkbox" ? "" : /* @__PURE__ */ Z(Yh, {
12769
12780
  field: t,
12770
12781
  label: t.label,
12771
12782
  locked: p
12772
- }), h = a.inline || t.type === "text-editor" || t.type === "file" && Hh(t.multiple) ? 24 : t.col ?? 12, g = i !== void 0 && r !== void 0 ? [i, r] : null, _ = fg(t, l), v = a.inline ? {
12783
+ }), h = a.inline || t.type === "text-editor" || t.type === "file" && Hh(t.multiple) ? 24 : t.col ?? 12, g = i !== void 0 && r !== void 0 ? [...Array.isArray(i) ? i : [i], r] : null, _ = fg(t, l), v = a.inline ? {
12773
12784
  flex: `${Number(t.combineWidth) > 0 ? Number(t.combineWidth) : 1} 1 0`,
12774
12785
  maxWidth: "none"
12775
12786
  } : void 0, y = (t.aiActions || []).filter((e) => e.trigger === "click"), b = (t.aiActions || []).find((e) => e.trigger === "upload"), x = /* @__PURE__ */ Z(z.Item, {
@@ -12912,65 +12923,76 @@ function yg({ moduleName: e, recordId: t, clientId: n, region: r, breadcrumbItem
12912
12923
  field: t,
12913
12924
  label: t.label,
12914
12925
  locked: o
12915
- }), c = us(t), l = Math.max(0, Number(t.minRows ?? 0) || 0), u = t.maxRows !== void 0 && t.maxRows !== "" && Number(t.maxRows) > 0 ? Number(t.maxRows) : 0, f = [r, ...a], p = ds(t, void 0);
12926
+ }), c = us(t), l = Array.isArray(t.subFields) && t.subFields.length > 0, u = l ? t.subFields.map((e) => ({
12927
+ ...e,
12928
+ show: 1,
12929
+ edit: 1
12930
+ })) : null, f = Math.max(0, Number(t.minRows ?? 0) || 0), p = t.maxRows !== void 0 && t.maxRows !== "" && Number(t.maxRows) > 0 ? Number(t.maxRows) : 0, m = [r, ...a], h = [
12931
+ ...Array.isArray(i) ? i : [i],
12932
+ r,
12933
+ ...a
12934
+ ], g = ds(t, void 0);
12916
12935
  return /* @__PURE__ */ Z(I, {
12917
12936
  xs: 24,
12918
- md: t.col ?? 24,
12937
+ md: l ? 24 : t.col ?? 24,
12919
12938
  children: /* @__PURE__ */ Z(z.Item, {
12920
12939
  label: s,
12921
12940
  required: ug(t),
12922
12941
  colon: !1,
12923
12942
  className: "v1-combine-field",
12924
12943
  children: /* @__PURE__ */ Z(z.List, {
12925
- name: f,
12926
- initialValue: p,
12927
- children: (o, { add: s, remove: f }, { errors: p }) => /* @__PURE__ */ Q("div", {
12944
+ name: m,
12945
+ initialValue: g,
12946
+ rules: l ? [{ validator: async (e, n = []) => {
12947
+ if (ug(t) && !n.some((e) => Gh(e))) throw Error("Mandatory Field");
12948
+ if (f > 0 && n.length < f) throw Error(`Keep at least ${f} row${f > 1 ? "s" : ""}.`);
12949
+ } }] : [],
12950
+ children: (r, { add: i, remove: a }, { errors: o }) => /* @__PURE__ */ Q("div", {
12928
12951
  className: "v1-addrow-wrapper",
12929
12952
  children: [
12930
- o.map(({ key: s, name: u }) => {
12931
- let p = [
12932
- i,
12933
- r,
12934
- ...a,
12935
- u
12936
- ];
12953
+ r.map(({ key: i, name: o }) => {
12954
+ let s = [...h, o];
12937
12955
  return /* @__PURE__ */ Q("div", {
12938
12956
  className: "v1-addrow-item",
12939
12957
  children: [/* @__PURE__ */ Z(P, {
12940
12958
  type: "text",
12941
12959
  danger: !0,
12942
12960
  icon: /* @__PURE__ */ Z(Ke, {}),
12943
- onClick: () => f(u),
12944
- disabled: o.length <= l,
12961
+ onClick: () => a(o),
12962
+ disabled: r.length <= f,
12945
12963
  className: "v1-addrow-delete-btn"
12946
12964
  }), /* @__PURE__ */ Z("div", {
12947
12965
  className: "v1-addrow-fields",
12948
- children: /* @__PURE__ */ Z(z.Item, {
12949
- name: [u],
12966
+ children: l ? /* @__PURE__ */ Z(U, {
12967
+ gutter: [24, 0],
12968
+ align: "top",
12969
+ children: le(u, o, h, !1, t.field)
12970
+ }) : /* @__PURE__ */ Z(z.Item, {
12971
+ name: [o],
12950
12972
  noStyle: !0,
12951
12973
  valuePropName: t.type === "checkbox" && !t.options?.length ? "checked" : "value",
12952
12974
  getValueFromEvent: t.type === "file" ? (e) => Array.isArray(e) ? e : e?.fileList : void 0,
12953
- rules: dg(c, d, p, !0),
12975
+ rules: dg(c, d, s, !0),
12954
12976
  children: /* @__PURE__ */ Z(_g, {
12955
12977
  field: c,
12956
12978
  form: d,
12957
- name: p,
12979
+ name: s,
12958
12980
  moduleName: e,
12959
12981
  scopeValues: { clientId: n },
12960
12982
  formDisabled: M.busy
12961
12983
  })
12962
12984
  })
12963
12985
  })]
12964
- }, s);
12986
+ }, i);
12965
12987
  }),
12966
- (!u || o.length < u) && /* @__PURE__ */ Z(P, {
12988
+ (!p || r.length < p) && /* @__PURE__ */ Z(P, {
12967
12989
  type: "link",
12968
12990
  icon: /* @__PURE__ */ Z(Tt, {}),
12969
- onClick: () => s(),
12991
+ onClick: () => i(),
12970
12992
  className: "v1-addrow-add-btn",
12971
12993
  children: t.addLabel ?? `Add ${t.label ?? "Value"}`
12972
12994
  }),
12973
- /* @__PURE__ */ Z(z.ErrorList, { errors: p })
12995
+ /* @__PURE__ */ Z(z.ErrorList, { errors: o })
12974
12996
  ]
12975
12997
  })
12976
12998
  })
@@ -12983,7 +13005,7 @@ function yg({ moduleName: e, recordId: t, clientId: n, region: r, breadcrumbItem
12983
13005
  o.push(ce(s));
12984
13006
  return;
12985
13007
  }
12986
- if (Hh(s.addRow) && t !== void 0 && !(Array.isArray(s.subFields) && s.subFields.length > 0)) {
13008
+ if (Hh(s.addRow) && t !== void 0) {
12987
13009
  o.push(V(s, t, n));
12988
13010
  return;
12989
13011
  }
@@ -17966,7 +17988,15 @@ function Hy(e = []) {
17966
17988
  edit: 1,
17967
17989
  req: +!!e.req
17968
17990
  };
17969
- return e.col !== void 0 && e.col !== "" && Number(e.col) > 0 && (t.col = Number(e.col)), e.payloadKey && (t.payloadKey = String(e.payloadKey).trim()), t;
17991
+ if (e.col !== void 0 && e.col !== "" && Number(e.col) > 0 && (t.col = Number(e.col)), e.payloadKey && (t.payloadKey = String(e.payloadKey).trim()), [
17992
+ "select",
17993
+ "radio",
17994
+ "checkbox"
17995
+ ].includes(t.type)) {
17996
+ let n = e.dataSource ?? "static";
17997
+ t.dataSource = n, t.type === "select" && (t.multiSelect = e.multiSelect ?? !1), n === "master" && (t.masterName = e.masterName ?? ""), n === "group" && (t.groupName = e.groupName ?? ""), n === "static" && (t.options = (e.options ?? []).filter((e) => e?.label || e?.value)), n === "lookup" && (t.lookupCollection = e.lookupCollection ?? "", t.displayField = e.displayField ?? "", e.displayField2 && (t.displayField2 = e.displayField2), t.valueField = e.valueField ?? "_id", e.lookupFilterField && e.lookupFilterValueFrom && (t.lookupFilterField = e.lookupFilterField, t.lookupFilterValueFrom = e.lookupFilterValueFrom));
17998
+ }
17999
+ return t;
17970
18000
  }));
17971
18001
  }
17972
18002
  if (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), Vy(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) {
@@ -18037,7 +18067,18 @@ function Uy(e) {
18037
18067
  type: e.type ?? "text",
18038
18068
  req: e.req === 1 || e.req === !0,
18039
18069
  col: e.col ?? "",
18040
- payloadKey: e.payloadKey ?? ""
18070
+ payloadKey: e.payloadKey ?? "",
18071
+ dataSource: e.dataSource ?? "static",
18072
+ multiSelect: e.multiSelect ?? !1,
18073
+ masterName: e.masterName ?? "",
18074
+ groupName: e.groupName ?? "",
18075
+ options: Array.isArray(e.options) ? e.options : [],
18076
+ lookupCollection: e.lookupCollection ?? "",
18077
+ displayField: e.displayField ?? "",
18078
+ displayField2: e.displayField2 ?? "",
18079
+ valueField: e.valueField ?? "_id",
18080
+ lookupFilterField: e.lookupFilterField ?? "",
18081
+ lookupFilterValueFrom: e.lookupFilterValueFrom ?? ""
18041
18082
  })) : [],
18042
18083
  placeholder: e.placeholder ?? "",
18043
18084
  hidePlaceholder: e.hidePlaceholder ?? !1,
@@ -18909,102 +18950,354 @@ function Wy({ form: e, fieldItems: t, add: n, remove: r, move: i, absBase: a, mo
18909
18950
  })]
18910
18951
  }), /* @__PURE__ */ Z(z.List, {
18911
18952
  name: [n, "subFields"],
18912
- children: (e, { add: t, remove: n }) => /* @__PURE__ */ Q("div", { children: [e.map(({ key: e, name: t, ...r }) => /* @__PURE__ */ Q("div", {
18913
- className: "fg-inline-row",
18914
- style: {
18915
- flexWrap: "wrap",
18916
- alignItems: "flex-end",
18917
- marginBottom: 6
18918
- },
18919
- children: [
18920
- /* @__PURE__ */ Z(z.Item, {
18921
- ...r,
18922
- name: [t, "field"],
18923
- label: "Key",
18924
- rules: [{
18925
- required: !0,
18926
- message: "Key"
18927
- }, {
18928
- pattern: /^[a-zA-Z0-9_]+$/,
18929
- message: "a-z 0-9 _"
18930
- }],
18931
- style: { marginBottom: 0 },
18932
- children: /* @__PURE__ */ Z(B, {
18933
- size: "small",
18934
- placeholder: "e.g. question",
18935
- style: { width: 140 },
18936
- className: "fg-mono-input"
18937
- })
18938
- }),
18939
- /* @__PURE__ */ Z(z.Item, {
18940
- ...r,
18941
- name: [t, "label"],
18942
- label: "Label",
18943
- rules: [{
18944
- required: !0,
18945
- message: "Label"
18946
- }],
18947
- style: { marginBottom: 0 },
18948
- children: /* @__PURE__ */ Z(B, {
18949
- size: "small",
18950
- placeholder: "e.g. Question",
18951
- style: { width: 150 }
18952
- })
18953
- }),
18954
- /* @__PURE__ */ Z(z.Item, {
18955
- ...r,
18956
- name: [t, "type"],
18957
- label: "Type",
18958
- initialValue: "text",
18959
- style: { marginBottom: 0 },
18960
- children: /* @__PURE__ */ Z(W, {
18961
- size: "small",
18962
- options: Oy,
18963
- style: { width: 130 }
18964
- })
18965
- }),
18966
- /* @__PURE__ */ Z(z.Item, {
18967
- ...r,
18968
- name: [t, "req"],
18969
- label: "Required",
18970
- valuePropName: "checked",
18971
- initialValue: !1,
18972
- style: { marginBottom: 0 },
18973
- children: /* @__PURE__ */ Z(K, {
18974
- size: "small",
18975
- checkedChildren: "Yes",
18976
- unCheckedChildren: "No"
18977
- })
18978
- }),
18979
- /* @__PURE__ */ Z(z.Item, {
18980
- ...r,
18981
- name: [t, "col"],
18982
- label: "Width",
18983
- tooltip: "Grid span: 12 = half row, 24 = full row. Blank = 12.",
18984
- style: { marginBottom: 0 },
18985
- children: /* @__PURE__ */ Z(B, {
18986
- size: "small",
18987
- type: "number",
18988
- placeholder: "12",
18989
- style: { width: 70 }
18990
- })
18991
- }),
18992
- /* @__PURE__ */ Z(J, {
18993
- title: "Remove sub-field",
18994
- children: /* @__PURE__ */ Z("button", {
18995
- type: "button",
18996
- className: "fg-field-remove-btn",
18997
- onClick: () => n(t),
18998
- "aria-label": "Remove sub-field",
18999
- children: /* @__PURE__ */ Z(xt, {})
18953
+ children: (t, { add: n, remove: r }) => /* @__PURE__ */ Q("div", { children: [t.map(({ key: t, name: n, ...i }) => /* @__PURE__ */ Q("div", {
18954
+ className: "fg-subfield-row",
18955
+ style: { marginBottom: 10 },
18956
+ children: [/* @__PURE__ */ Q("div", {
18957
+ className: "fg-inline-row",
18958
+ style: {
18959
+ flexWrap: "wrap",
18960
+ alignItems: "flex-end"
18961
+ },
18962
+ children: [
18963
+ /* @__PURE__ */ Z(z.Item, {
18964
+ ...i,
18965
+ name: [n, "field"],
18966
+ label: "Key",
18967
+ rules: [{
18968
+ required: !0,
18969
+ message: "Key"
18970
+ }, {
18971
+ pattern: /^[a-zA-Z0-9_]+$/,
18972
+ message: "a-z 0-9 _"
18973
+ }],
18974
+ style: { marginBottom: 0 },
18975
+ children: /* @__PURE__ */ Z(B, {
18976
+ size: "small",
18977
+ placeholder: "e.g. question",
18978
+ style: { width: 140 },
18979
+ className: "fg-mono-input"
18980
+ })
18981
+ }),
18982
+ /* @__PURE__ */ Z(z.Item, {
18983
+ ...i,
18984
+ name: [n, "label"],
18985
+ label: "Label",
18986
+ rules: [{
18987
+ required: !0,
18988
+ message: "Label"
18989
+ }],
18990
+ style: { marginBottom: 0 },
18991
+ children: /* @__PURE__ */ Z(B, {
18992
+ size: "small",
18993
+ placeholder: "e.g. Question",
18994
+ style: { width: 150 }
18995
+ })
18996
+ }),
18997
+ /* @__PURE__ */ Z(z.Item, {
18998
+ ...i,
18999
+ name: [n, "type"],
19000
+ label: "Type",
19001
+ initialValue: "text",
19002
+ style: { marginBottom: 0 },
19003
+ children: /* @__PURE__ */ Z(W, {
19004
+ size: "small",
19005
+ options: Oy,
19006
+ style: { width: 130 }
19007
+ })
19008
+ }),
19009
+ /* @__PURE__ */ Z(z.Item, {
19010
+ ...i,
19011
+ name: [n, "req"],
19012
+ label: "Required",
19013
+ valuePropName: "checked",
19014
+ initialValue: !1,
19015
+ style: { marginBottom: 0 },
19016
+ children: /* @__PURE__ */ Z(K, {
19017
+ size: "small",
19018
+ checkedChildren: "Yes",
19019
+ unCheckedChildren: "No"
19020
+ })
19021
+ }),
19022
+ /* @__PURE__ */ Z(z.Item, {
19023
+ ...i,
19024
+ name: [n, "col"],
19025
+ label: "Width",
19026
+ tooltip: "Grid span: 12 = half row, 24 = full row. Blank = 12.",
19027
+ style: { marginBottom: 0 },
19028
+ children: /* @__PURE__ */ Z(B, {
19029
+ size: "small",
19030
+ type: "number",
19031
+ placeholder: "12",
19032
+ style: { width: 70 }
19033
+ })
19034
+ }),
19035
+ /* @__PURE__ */ Z(J, {
19036
+ title: "Remove sub-field",
19037
+ children: /* @__PURE__ */ Z("button", {
19038
+ type: "button",
19039
+ className: "fg-field-remove-btn",
19040
+ onClick: () => r(n),
19041
+ "aria-label": "Remove sub-field",
19042
+ children: /* @__PURE__ */ Z(xt, {})
19043
+ })
19000
19044
  })
19001
- })
19002
- ]
19003
- }, e)), /* @__PURE__ */ Z(P, {
19045
+ ]
19046
+ }), /* @__PURE__ */ Z(z.Item, {
19047
+ shouldUpdate: !0,
19048
+ style: { marginBottom: 0 },
19049
+ children: () => {
19050
+ let t = e([
19051
+ ...h,
19052
+ "subFields",
19053
+ n,
19054
+ "type"
19055
+ ]);
19056
+ if (![
19057
+ "select",
19058
+ "radio",
19059
+ "checkbox"
19060
+ ].includes(t)) return null;
19061
+ let r = e([
19062
+ ...h,
19063
+ "subFields",
19064
+ n,
19065
+ "dataSource"
19066
+ ]) ?? "static";
19067
+ return /* @__PURE__ */ Q("div", {
19068
+ className: "fg-options-block",
19069
+ style: { marginTop: 6 },
19070
+ children: [
19071
+ /* @__PURE__ */ Z("span", {
19072
+ className: "fg-options-label",
19073
+ children: "Options / Values"
19074
+ }),
19075
+ /* @__PURE__ */ Q("div", {
19076
+ className: "fg-options-controls",
19077
+ children: [
19078
+ /* @__PURE__ */ Z(z.Item, {
19079
+ name: [n, "dataSource"],
19080
+ label: "Source",
19081
+ style: { marginBottom: 0 },
19082
+ initialValue: "static",
19083
+ children: /* @__PURE__ */ Z(W, {
19084
+ size: "small",
19085
+ style: { width: 190 },
19086
+ options: ky
19087
+ })
19088
+ }),
19089
+ t === "select" && /* @__PURE__ */ Z(z.Item, {
19090
+ name: [n, "multiSelect"],
19091
+ label: "Multi Select",
19092
+ valuePropName: "checked",
19093
+ style: { marginBottom: 0 },
19094
+ initialValue: !1,
19095
+ children: /* @__PURE__ */ Z(K, {
19096
+ size: "small",
19097
+ checkedChildren: "Multi",
19098
+ unCheckedChildren: "Single"
19099
+ })
19100
+ }),
19101
+ r === "master" && /* @__PURE__ */ Z(z.Item, {
19102
+ name: [n, "masterName"],
19103
+ label: "Master Name",
19104
+ style: { marginBottom: 0 },
19105
+ rules: [{
19106
+ required: !0,
19107
+ message: "Enter master name"
19108
+ }],
19109
+ children: /* @__PURE__ */ Z(B, {
19110
+ size: "small",
19111
+ placeholder: "e.g. tracker",
19112
+ style: { width: 140 }
19113
+ })
19114
+ }),
19115
+ r === "group" && /* @__PURE__ */ Z(z.Item, {
19116
+ name: [n, "groupName"],
19117
+ label: "Group Name",
19118
+ style: { marginBottom: 0 },
19119
+ rules: [{
19120
+ required: !0,
19121
+ message: "Enter group name"
19122
+ }],
19123
+ children: /* @__PURE__ */ Z(B, {
19124
+ size: "small",
19125
+ placeholder: "e.g. users",
19126
+ style: { width: 140 }
19127
+ })
19128
+ })
19129
+ ]
19130
+ }),
19131
+ r === "static" && /* @__PURE__ */ Q("div", {
19132
+ className: "fg-static-options",
19133
+ children: [/* @__PURE__ */ Z("span", {
19134
+ className: "fg-static-options-hint",
19135
+ children: "Label / Value pairs"
19136
+ }), /* @__PURE__ */ Z(z.List, {
19137
+ name: [n, "options"],
19138
+ children: (e, { add: t, remove: n }) => /* @__PURE__ */ Q(X, { children: [e.map(({ key: e, name: t }) => /* @__PURE__ */ Q("div", {
19139
+ className: "fg-option-row",
19140
+ children: [
19141
+ /* @__PURE__ */ Z(z.Item, {
19142
+ name: [t, "label"],
19143
+ style: {
19144
+ marginBottom: 0,
19145
+ flex: 1
19146
+ },
19147
+ children: /* @__PURE__ */ Z(B, {
19148
+ size: "small",
19149
+ placeholder: "Label"
19150
+ })
19151
+ }),
19152
+ /* @__PURE__ */ Z(z.Item, {
19153
+ name: [t, "value"],
19154
+ style: {
19155
+ marginBottom: 0,
19156
+ flex: 1
19157
+ },
19158
+ children: /* @__PURE__ */ Z(B, {
19159
+ size: "small",
19160
+ placeholder: "Value",
19161
+ className: "fg-mono-input"
19162
+ })
19163
+ }),
19164
+ /* @__PURE__ */ Z(xt, {
19165
+ onClick: () => n(t),
19166
+ className: "fg-remove-icon"
19167
+ })
19168
+ ]
19169
+ }, e)), /* @__PURE__ */ Z(P, {
19170
+ size: "small",
19171
+ type: "dashed",
19172
+ icon: /* @__PURE__ */ Z(Tt, {}),
19173
+ onClick: () => t({
19174
+ label: "",
19175
+ value: ""
19176
+ }),
19177
+ className: "fg-add-option-btn",
19178
+ children: "Add Option"
19179
+ })] })
19180
+ })]
19181
+ }),
19182
+ r === "group" && /* @__PURE__ */ Z("p", {
19183
+ className: "fg-source-hint",
19184
+ children: "Use \"users\" to load all users from the MongoDB-backed user collection."
19185
+ }),
19186
+ r === "lookup" && /* @__PURE__ */ Q("div", {
19187
+ className: "fg-lookup-block",
19188
+ children: [
19189
+ /* @__PURE__ */ Z("p", {
19190
+ className: "fg-source-hint",
19191
+ style: { marginBottom: 8 },
19192
+ children: "Cross-collection lookup — shows label, stores FK value."
19193
+ }),
19194
+ /* @__PURE__ */ Q("div", {
19195
+ className: "fg-field-meta-row",
19196
+ children: [
19197
+ /* @__PURE__ */ Z(z.Item, {
19198
+ name: [n, "lookupCollection"],
19199
+ label: "Collection",
19200
+ style: {
19201
+ marginBottom: 0,
19202
+ flex: 1
19203
+ },
19204
+ rules: [{
19205
+ required: !0,
19206
+ message: "Required"
19207
+ }],
19208
+ children: /* @__PURE__ */ Z(B, {
19209
+ size: "small",
19210
+ placeholder: "e.g. vendors",
19211
+ className: "fg-mono-input"
19212
+ })
19213
+ }),
19214
+ /* @__PURE__ */ Z(z.Item, {
19215
+ name: [n, "displayField"],
19216
+ label: "Display Field",
19217
+ style: {
19218
+ marginBottom: 0,
19219
+ flex: 1
19220
+ },
19221
+ rules: [{
19222
+ required: !0,
19223
+ message: "Required"
19224
+ }],
19225
+ children: /* @__PURE__ */ Z(B, {
19226
+ size: "small",
19227
+ placeholder: "e.g. vendorContact.firstName",
19228
+ className: "fg-mono-input"
19229
+ })
19230
+ }),
19231
+ /* @__PURE__ */ Z(z.Item, {
19232
+ name: [n, "displayField2"],
19233
+ label: "Display Field 2",
19234
+ style: {
19235
+ marginBottom: 0,
19236
+ flex: 1
19237
+ },
19238
+ children: /* @__PURE__ */ Z(B, {
19239
+ size: "small",
19240
+ placeholder: "e.g. vendorContact.lastName",
19241
+ className: "fg-mono-input"
19242
+ })
19243
+ }),
19244
+ /* @__PURE__ */ Z(z.Item, {
19245
+ name: [n, "valueField"],
19246
+ label: "Value Field (FK)",
19247
+ style: {
19248
+ marginBottom: 0,
19249
+ flex: 1
19250
+ },
19251
+ children: /* @__PURE__ */ Z(B, {
19252
+ size: "small",
19253
+ placeholder: "_id",
19254
+ className: "fg-mono-input"
19255
+ })
19256
+ })
19257
+ ]
19258
+ }),
19259
+ /* @__PURE__ */ Q("div", {
19260
+ className: "fg-field-meta-row",
19261
+ style: { marginTop: 8 },
19262
+ children: [/* @__PURE__ */ Z(z.Item, {
19263
+ name: [n, "lookupFilterField"],
19264
+ label: "Filter Field",
19265
+ style: {
19266
+ marginBottom: 0,
19267
+ flex: 1
19268
+ },
19269
+ tooltip: "Optional DB field to filter lookup rows by. Example: _id or clientId.",
19270
+ children: /* @__PURE__ */ Z(B, {
19271
+ size: "small",
19272
+ placeholder: "e.g. _id",
19273
+ className: "fg-mono-input"
19274
+ })
19275
+ }), /* @__PURE__ */ Z(z.Item, {
19276
+ name: [n, "lookupFilterValueFrom"],
19277
+ label: "Filter Value From",
19278
+ style: {
19279
+ marginBottom: 0,
19280
+ flex: 1
19281
+ },
19282
+ tooltip: "Optional form/scope field that provides the filter value. Example: clientId.",
19283
+ children: /* @__PURE__ */ Z(B, {
19284
+ size: "small",
19285
+ placeholder: "e.g. clientId",
19286
+ className: "fg-mono-input"
19287
+ })
19288
+ })]
19289
+ })
19290
+ ]
19291
+ })
19292
+ ]
19293
+ });
19294
+ }
19295
+ })]
19296
+ }, t)), /* @__PURE__ */ Z(P, {
19004
19297
  type: "dashed",
19005
19298
  size: "small",
19006
19299
  icon: /* @__PURE__ */ Z(Tt, {}),
19007
- onClick: () => t({
19300
+ onClick: () => n({
19008
19301
  type: "text",
19009
19302
  req: !1
19010
19303
  }),
@@ -26889,15 +27182,23 @@ function Lx({ onLogout: e }) {
26889
27182
  async function je(e) {
26890
27183
  L(!0);
26891
27184
  try {
26892
- let t = V?.userId ?? null, n = (ne ? await Xv(ne.user_type_id, {
27185
+ let t = V?.userId ?? null, n = !!ne, r = n ? await Xv(ne.user_type_id, {
26893
27186
  ...e,
26894
27187
  updated_by: t
26895
27188
  }) : await Yv({
26896
27189
  ...e,
26897
27190
  created_by: t,
26898
27191
  visible_menu_ids: []
26899
- })).user_type_id;
26900
- Y.success(ne ? "Role updated" : "Role created"), I(!1), await ue(), S(n);
27192
+ }), i = r.user_type_id;
27193
+ Y.success(n ? "User type updated" : "User type created. Customize its menus and permissions."), I(!1), await ue(), S(i), n || (se("permissions"), R({
27194
+ kind: "role",
27195
+ record: {
27196
+ ...e,
27197
+ ...r,
27198
+ user_type_id: i,
27199
+ user_type_name: r.user_type_name ?? e.user_type_name
27200
+ }
27201
+ }));
26901
27202
  } catch (e) {
26902
27203
  Y.error(e.message || "Unable to save role");
26903
27204
  } finally {
@@ -27267,10 +27568,11 @@ function Lx({ onLogout: e }) {
27267
27568
  }),
27268
27569
  /* @__PURE__ */ Z(H, {
27269
27570
  className: "admin-role-modal",
27270
- title: ne ? "Edit Role" : "Add Role",
27571
+ title: ne ? "Edit User Type" : "Create User Type",
27271
27572
  open: te,
27272
27573
  onCancel: () => I(!1),
27273
27574
  onOk: () => n.submit(),
27575
+ okText: ne ? "Save" : "Next",
27274
27576
  confirmLoading: ie,
27275
27577
  destroyOnHidden: !0,
27276
27578
  width: 900,