@object-ui/components 13.2.0 → 14.0.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,59 @@
1
1
  # @object-ui/components
2
2
 
3
+ ## 14.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 6a74160: Sharing-rule form: pick, don't type. Three new widget-hint field components make
8
+ the generic object form render pickers where an admin previously had to type
9
+ machine data (driven by the framework `widget` hints on `sys_sharing_rule`;
10
+ generalizes the `capability-multiselect` pattern). All degrade to the underlying
11
+ `type` renderer when a widget is unregistered.
12
+
13
+ - **`object-ref`** — choose a registered object by name (searchable `Combobox`),
14
+ backed by the new `DataSource.getObjects()` (`ObjectStackAdapter` lists code-
15
+ and DB-defined objects via `/api/v1/meta/object`), falling back to a
16
+ `sys_metadata` query. Stores the object's `name`.
17
+ - **`filter-condition`** — a visual criteria builder (`FilterBuilder`) scoped to
18
+ the fields of the object chosen in a sibling field (via `getObjectSchema`),
19
+ round-tripping the stored **MongoDB-style** FilterCondition JSON. Criteria the
20
+ builder can't represent (or invalid JSON) fall back to a raw-JSON editor, with
21
+ an always-available "Edit as JSON" toggle — nothing is hidden or lost.
22
+ - **`recipient-picker`** — a record picker whose target object follows a sibling
23
+ `recipient_type` (`user`→sys_user, `team`→sys_team, `business_unit`/
24
+ `unit_and_subordinates`→sys_business_unit, `position`→sys_position), storing the
25
+ value the evaluator matches on (a record id, or the position **name**). Resets
26
+ the stored id when the type changes.
27
+
28
+ Wiring: the three keys join `DATA_SOURCE_FIELD_TYPES` (form.tsx) so the form
29
+ threads `dataSource` + `dependentValues` to them, and `INLINE_EXCLUDED_FIELD_TYPES`
30
+ (they're authored in the record form, not a grid cell). `DataSource.getObjects()`
31
+ is optional on the interface; the ObjectStack adapter implements it.
32
+
33
+ ### Patch Changes
34
+
35
+ - a44e7b6: Form fields honor their object-schema `widget` render hint on the field-group /
36
+ section layout path. `ObjectForm` renders objects that declare field groups
37
+ (e.g. `sys_sharing_rule`) via an auto-derived section layout that passed each
38
+ field's metadata through without hoisting its `widget` override to the top-level
39
+ form-field config, so a field with `widget: 'object-ref'` (or `filter-condition`
40
+ / `recipient-picker`) degraded to its bare `type` input — an admin was asked to
41
+ hand-type an object name instead of picking it. The form renderer now falls back
42
+ to the field metadata's own `widget` when no top-level override is present, so
43
+ the pickers render on sectioned forms just as they do on flat ones.
44
+ - Updated dependencies [443360a]
45
+ - Updated dependencies [c70bca7]
46
+ - Updated dependencies [86c69c3]
47
+ - Updated dependencies [05e56ca]
48
+ - Updated dependencies [5971cc4]
49
+ - Updated dependencies [6a74160]
50
+ - @object-ui/core@14.0.0
51
+ - @object-ui/i18n@14.0.0
52
+ - @object-ui/react@14.0.0
53
+ - @object-ui/types@14.0.0
54
+ - @object-ui/react-runtime@14.0.0
55
+ - @object-ui/sdui-parser@14.0.0
56
+
3
57
  ## 13.2.0
4
58
 
5
59
  ### Patch Changes
package/dist/index.js CHANGED
@@ -3583,7 +3583,10 @@ var gc = tn({
3583
3583
  "lookup",
3584
3584
  "master_detail",
3585
3585
  "tree",
3586
- "capability-multiselect"
3586
+ "capability-multiselect",
3587
+ "object-ref",
3588
+ "filter-condition",
3589
+ "recipient-picker"
3587
3590
  ]);
3588
3591
  function Sc(e) {
3589
3592
  let { dataSource: t, inputType: n, options: r, field: i, schema: a, showActions: o, fieldContainerClass: s, mobileStickyActions: c, mobile_fullscreen: l, fullscreen: u, dependentValues: d, dependsOn: f, emptyHint: p, ...m } = e;
@@ -3845,7 +3848,7 @@ t.register("form", ({ schema: e, className: t, onAction: n, ...r }) => {
3845
3848
  })
3846
3849
  } : e;
3847
3850
  A.minLength &&= ne(A.minLength, (e) => ({ min: e.value })), A.maxLength &&= ne(A.maxLength, (e) => ({ max: e.value })), A.min &&= ne(A.min, (e) => ({ min: e.value })), A.max &&= ne(A.max, (e) => ({ max: e.value })), A.pattern &&= ne(A.pattern);
3848
- let j = t.id ?? n, N = v || c, oe = N === "select" || N === "radio" || N === "multiselect", P = T.options, se = oe ? l(t.dependsOn) : [], ce = se.length > 0 && s(t.dependsOn, M), L = oe ? ce ? [] : d(P, M, ie) : P, ue = ce ? `Select ${se.map((e) => ae[e] || e).join(" / ")} first` : void 0, de = e.fieldContainerClass || le, fe = (e) => {
3851
+ let j = t.id ?? n, N = v || T.field?.widget || c, oe = N === "select" || N === "radio" || N === "multiselect", P = T.options, se = oe ? l(t.dependsOn) : [], ce = se.length > 0 && s(t.dependsOn, M), L = oe ? ce ? [] : d(P, M, ie) : P, ue = ce ? `Select ${se.map((e) => ae[e] || e).join(" / ")} first` : void 0, de = e.fieldContainerClass || le, fe = (e) => {
3849
3852
  let t = Array.from(de.matchAll(/(@)?(sm|md|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl):grid-cols-(\d+)/g)).map((e) => ({
3850
3853
  at: e[1] || "",
3851
3854
  bp: e[2],
@@ -6906,7 +6909,7 @@ var Jl = ({ params: e, open: t, onSubmit: n, onCancel: r, title: i = "Action Par
6906
6909
  let [o, s] = N(() => {
6907
6910
  let t = {};
6908
6911
  return e.forEach((e) => {
6909
- e.defaultValue === void 0 ? t[e.name] = e.type === "boolean" ? !1 : "" : t[e.name] = e.defaultValue;
6912
+ e.defaultValue === void 0 ? t[e.name] = e.type !== "boolean" && "" : t[e.name] = e.defaultValue;
6910
6913
  }), t;
6911
6914
  }), [c, l] = N({}), u = M((e, t) => {
6912
6915
  s((n) => ({
@@ -11751,10 +11754,11 @@ t.register("data-table", ({ schema: e }) => {
11751
11754
  let e = {}, t = r.map((e) => ({
11752
11755
  header: e.header || e.label,
11753
11756
  accessorKey: e.accessorKey || e.name,
11754
- width: e.width
11757
+ width: e.width,
11758
+ fitContent: e.fitContent
11755
11759
  }));
11756
11760
  for (let n of t) {
11757
- if (n.width) continue;
11761
+ if (n.width || n.fitContent) continue;
11758
11762
  let t = (n.header || "").length, r = pe.slice(0, 50);
11759
11763
  for (let e of r) {
11760
11764
  let r = e[n.accessorKey], i = r == null ? 0 : String(r).length;
@@ -12059,7 +12063,7 @@ t.register("data-table", ({ schema: e }) => {
12059
12063
  })
12060
12064
  }),
12061
12065
  Le.map((e, t) => {
12062
- let n = ze[e.accessorKey] || e.width || he[e.accessorKey], r = He === t, i = We === t, a = O > 0 && t < O, o = a ? Le.slice(0, t).reduce((e, t, n) => {
12066
+ let n = e.fitContent === !0 && !ze[e.accessorKey] && !e.width, r = n ? "1%" : ze[e.accessorKey] || e.width || he[e.accessorKey], i = He === t, a = We === t, o = O > 0 && t < O, s = o ? Le.slice(0, t).reduce((e, t, n) => {
12063
12067
  if (n < O) {
12064
12068
  let n = ze[t.accessorKey] || t.width || he[t.accessorKey];
12065
12069
  return e + (typeof n == "number" ? n : n && parseInt(String(n), 10) || 150);
@@ -12067,11 +12071,11 @@ t.register("data-table", ({ schema: e }) => {
12067
12071
  return e;
12068
12072
  }, (m ? 40 : 0) + (te ? 40 : 0)) : void 0;
12069
12073
  return /* @__PURE__ */ F(Xo, {
12070
- className: K(e.className, _ && e.sortable !== !1 && "cursor-pointer select-none", r && "opacity-50", i && "border-l-2 border-primary", e.align === "right" && "text-right", e.align === "center" && "text-center", "relative group bg-background", a && "sticky z-20", a && t === O - 1 && "border-r-2 border-border shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]"),
12074
+ className: K(e.className, _ && e.sortable !== !1 && "cursor-pointer select-none", i && "opacity-50", a && "border-l-2 border-primary", e.align === "right" && "text-right", e.align === "center" && "text-center", n && "whitespace-nowrap", "relative group bg-background", o && "sticky z-20", o && t === O - 1 && "border-r-2 border-border shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]"),
12071
12075
  style: {
12072
- width: n,
12073
- minWidth: n,
12074
- ...a && { left: o }
12076
+ width: r,
12077
+ minWidth: r,
12078
+ ...o && { left: s }
12075
12079
  },
12076
12080
  draggable: le,
12077
12081
  onDragStart: (e) => jt(e, t),
@@ -12201,7 +12205,7 @@ t.register("data-table", ({ schema: e }) => {
12201
12205
  })]
12202
12206
  }),
12203
12207
  Le.map((r, i) => {
12204
- let a = ze[r.accessorKey] || r.width || he[r.accessorKey], o = t[r.accessorKey], c = s[r.accessorKey] !== void 0, l = c ? s[r.accessorKey] : o, u = Ge?.rowIndex === n && Ge?.columnKey === r.accessorKey, d = S && r.editable !== !1, f = O > 0 && i < O, p = f ? Le.slice(0, i).reduce((e, t, n) => {
12208
+ let a = r.fitContent === !0 && !ze[r.accessorKey] && !r.width, o = a ? "1%" : ze[r.accessorKey] || r.width || he[r.accessorKey], c = t[r.accessorKey], l = s[r.accessorKey] !== void 0, u = l ? s[r.accessorKey] : c, d = Ge?.rowIndex === n && Ge?.columnKey === r.accessorKey, f = S && r.editable !== !1, p = O > 0 && i < O, h = p ? Le.slice(0, i).reduce((e, t, n) => {
12205
12209
  if (n < O) {
12206
12210
  let n = ze[t.accessorKey] || t.width || he[t.accessorKey];
12207
12211
  return e + (typeof n == "number" ? n : n && parseInt(String(n), 10) || 150);
@@ -12209,22 +12213,22 @@ t.register("data-table", ({ schema: e }) => {
12209
12213
  return e;
12210
12214
  }, (m ? 40 : 0) + (te ? 40 : 0)) : void 0;
12211
12215
  return /* @__PURE__ */ F(Zo, {
12212
- className: K(r.cellClassName, r.align === "right" && "text-right", r.align === "center" && "text-center", "overflow-hidden", d && !u && "cursor-text hover:bg-muted/50", c && "font-semibold text-amber-700 dark:text-amber-400", f && "sticky z-10 bg-background", f && i === O - 1 && "border-r-2 border-border shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]"),
12216
+ className: K(r.cellClassName, r.align === "right" && "text-right", r.align === "center" && "text-center", a ? "whitespace-nowrap" : "overflow-hidden", f && !d && "cursor-text hover:bg-muted/50", l && "font-semibold text-amber-700 dark:text-amber-400", p && "sticky z-10 bg-background", p && i === O - 1 && "border-r-2 border-border shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]"),
12213
12217
  style: {
12214
- width: a,
12215
- minWidth: a,
12216
- maxWidth: a,
12217
- ...f && { left: p }
12218
+ width: o,
12219
+ minWidth: a ? void 0 : o,
12220
+ maxWidth: a ? void 0 : o,
12221
+ ...p && { left: h }
12218
12222
  },
12219
12223
  onDoubleClick: (e) => {
12220
- d && !C && (e.stopPropagation(), Ft(n, r.accessorKey));
12224
+ f && !C && (e.stopPropagation(), Ft(n, r.accessorKey));
12221
12225
  },
12222
12226
  onClick: (e) => {
12223
- d && C && (e.stopPropagation(), Ft(n, r.accessorKey));
12227
+ f && C && (e.stopPropagation(), Ft(n, r.accessorKey));
12224
12228
  },
12225
12229
  onKeyDown: (e) => Ut(e, n, r.accessorKey),
12226
12230
  tabIndex: 0,
12227
- children: u ? (() => {
12231
+ children: d ? (() => {
12228
12232
  let n = r.type, i = e.renderCellEditor;
12229
12233
  if (typeof i == "function") {
12230
12234
  let e = i({
@@ -12281,9 +12285,9 @@ t.register("data-table", ({ schema: e }) => {
12281
12285
  className: "h-8 px-2 py-1"
12282
12286
  });
12283
12287
  })() : /* @__PURE__ */ F("div", {
12284
- className: "truncate w-full",
12285
- title: l != null && typeof l != "object" ? String(l) : void 0,
12286
- children: typeof r.cell == "function" ? r.cell(l, t) : typeof l == "object" && l ? String(l) : fe(l)
12288
+ className: a ? "w-full whitespace-nowrap" : "truncate w-full",
12289
+ title: !a && u != null && typeof u != "object" ? String(u) : void 0,
12290
+ children: typeof r.cell == "function" ? r.cell(u, t) : typeof u == "object" && u ? String(u) : fe(u)
12287
12291
  })
12288
12292
  }, i);
12289
12293
  }),
@@ -12711,7 +12715,7 @@ var Ld = j(({ schema: e, className: t, context: n, ...r }, i) => {
12711
12715
  variant: v,
12712
12716
  size: y,
12713
12717
  className: K(e.className, t),
12714
- disabled: (e.disabled == null ? e.enabled == null ? !1 : !g : h) || d,
12718
+ disabled: (e.disabled == null ? e.enabled != null && !g : h) || d,
12715
12719
  onClick: b,
12716
12720
  ...l,
12717
12721
  "data-obj-id": a,