@object-ui/fields 11.3.0 → 11.5.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +155 -0
  2. package/dist/FieldEditWidget.d.ts +8 -0
  3. package/dist/FieldEditWidget.test.d.ts +8 -0
  4. package/dist/__tests__/DateCellRenderer.test.d.ts +0 -0
  5. package/dist/__tests__/NumberCellRenderer.test.d.ts +0 -0
  6. package/dist/__tests__/lookupCellReferenceKey.test.d.ts +0 -0
  7. package/dist/index.cjs +4 -4
  8. package/dist/index.d.ts +17 -2
  9. package/dist/index.js +2015 -1346
  10. package/dist/widgets/LookupField.dependsOn.test.d.ts +8 -0
  11. package/dist/widgets/PeoplePicker.d.ts +63 -0
  12. package/dist/widgets/PeoplePicker.test.d.ts +8 -0
  13. package/dist/widgets/PeoplePickerComponents.test.d.ts +8 -0
  14. package/dist/widgets/PersonRow.d.ts +23 -0
  15. package/dist/widgets/RecordPickerDialog.d.ts +9 -1
  16. package/dist/widgets/SelectionTray.d.ts +27 -0
  17. package/dist/widgets/UserField.d.ts +0 -13
  18. package/dist/widgets/UserFieldPicker.test.d.ts +8 -0
  19. package/dist/widgets/deriveLookupColumns.d.ts +12 -4
  20. package/dist/widgets/personDisplay.d.ts +37 -0
  21. package/dist/widgets/personDisplay.test.d.ts +8 -0
  22. package/dist/widgets/useRecordQuery.d.ts +87 -0
  23. package/dist/widgets/useRecordQuery.test.d.ts +8 -0
  24. package/package.json +7 -7
  25. package/src/FieldEditWidget.test.ts +61 -0
  26. package/src/FieldEditWidget.tsx +56 -1
  27. package/src/__tests__/DateCellRenderer.test.tsx +50 -0
  28. package/src/__tests__/NumberCellRenderer.test.tsx +60 -0
  29. package/src/__tests__/lookupCellReferenceKey.test.tsx +57 -0
  30. package/src/complex-widgets.test.tsx +241 -0
  31. package/src/index.tsx +61 -18
  32. package/src/widgets/GridField.test.tsx +14 -0
  33. package/src/widgets/GridField.tsx +7 -8
  34. package/src/widgets/LookupField.dependsOn.test.tsx +233 -0
  35. package/src/widgets/LookupField.tsx +365 -190
  36. package/src/widgets/NumberField.tsx +4 -2
  37. package/src/widgets/PeoplePicker.test.tsx +334 -0
  38. package/src/widgets/PeoplePicker.tsx +552 -0
  39. package/src/widgets/PeoplePickerComponents.test.tsx +104 -0
  40. package/src/widgets/PersonRow.tsx +117 -0
  41. package/src/widgets/RecordPickerDialog.tsx +58 -129
  42. package/src/widgets/SelectionTray.tsx +110 -0
  43. package/src/widgets/UserField.tsx +20 -1
  44. package/src/widgets/UserFieldPicker.test.tsx +78 -0
  45. package/src/widgets/deriveLookupColumns.test.ts +25 -0
  46. package/src/widgets/deriveLookupColumns.ts +24 -10
  47. package/src/widgets/personDisplay.test.ts +113 -0
  48. package/src/widgets/personDisplay.ts +92 -0
  49. package/src/widgets/useRecordQuery.test.ts +174 -0
  50. package/src/widgets/useRecordQuery.ts +264 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,160 @@
1
1
  # @object-ui/fields
2
2
 
3
+ ## 11.5.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [544d8eb]
8
+ - Updated dependencies [6fffd3d]
9
+ - Updated dependencies [9255686]
10
+ - Updated dependencies [fae75e2]
11
+ - Updated dependencies [1072701]
12
+ - @object-ui/i18n@11.5.0
13
+ - @object-ui/react@11.5.0
14
+ - @object-ui/components@11.5.0
15
+ - @object-ui/types@11.5.0
16
+ - @object-ui/core@11.5.0
17
+ - @object-ui/providers@11.5.0
18
+
19
+ ## 11.4.0
20
+
21
+ ### Minor Changes
22
+
23
+ - 19f2533: Detail-page related lists: `relatedList: 'primary'` → own tab, multi-FK & self-referential related lists, unified picker columns (framework #2579).
24
+
25
+ - **plugin-detail** (`buildDefaultTabs`): the default related-list layout is now
26
+ the ADR-0085 prominence rule — lists whose FK declares `relatedList: 'primary'`
27
+ each get their OWN tab; every other related list collapses into a single
28
+ "Related" tab. With no primary lists this is byte-for-byte the previous stacked
29
+ default, so it is opt-in per relationship. `relatedLayout: 'tabs' | 'stack'`
30
+ remain app-level overrides (force all-own-tabs / all-stacked).
31
+ - **app-shell** (`deriveRelatedLists`): emits one related list per eligible FK —
32
+ a child referencing the parent through several relationships (e.g.
33
+ `primary_account` + `partner_account`) now surfaces each, disambiguated by the
34
+ FK label; includes self-referential relationships (hierarchies → a "child"
35
+ list); and carries the `isPrimary` prominence flag through. `RecordDetailView`
36
+ threads `isPrimary` into the synthesized page.
37
+ - **fields** (`deriveLookupColumns`): the lookup-picker default columns now
38
+ prefer the object's ADR-0085 `highlightFields` (then legacy `displayFields`,
39
+ then the field walk) — the same "how to list this object" source the related
40
+ list uses, so a picker and a related list of the same object agree with zero
41
+ per-surface config.
42
+
43
+ Pairs with the `@objectstack/spec` change that makes `relatedList` a tri-state
44
+ (`boolean | 'primary'`) and `record:related_list` `columns` optional.
45
+
46
+ ### Patch Changes
47
+
48
+ - bce581a: Fix dependent (cascading) lookups: unlock on parent selection and enforce the
49
+ cascade filter on every candidate surface (#2215).
50
+
51
+ Two breaks made `depends_on` unusable end to end:
52
+
53
+ - **The gate never unlocked in create mode.** `LookupField` resolved dependent
54
+ values from `ctx.formValues` — a member `SchemaRendererContext` never had —
55
+ and nothing injected the `dependentValues` prop, so with a fresh record
56
+ (`ctx.data = {}`) the child lookup stayed disabled no matter what the user
57
+ picked in the parent field. The form renderer now injects its live form
58
+ values (the same reactive snapshot that drives field rules) as
59
+ `dependentValues` for data-source fields.
60
+ - **The Level-2 table picker bypassed the cascade.** The `depends_on` chain
61
+ only reached the quick-select popover filter; `RecordPickerDialog` (and the
62
+ search-first `PeoplePicker`) received just `lookup_filters`, listing the full
63
+ unfiltered record set. Both pickers now take a `baseFilter` — a hard
64
+ `$filter` constraint merged after `lookupFilters` and user filter-bar input,
65
+ so it can never be widened back out — and `LookupField` passes the dependent
66
+ chain there, shares the same filter with the popover query, and disables the
67
+ browse-all button while dependencies are missing.
68
+
69
+ - 5160832: fix(fields): inline-edit relational fields with the standard picker (not a text box)
70
+
71
+ Inline cell editing reuses the form's field widgets, but the inline map
72
+ (`EDIT_WIDGETS`) was a hand-maintained subset of the form's (`fieldWidgetMap`)
73
+ and had drifted: **lookup / master_detail / user / owner** had perfectly good
74
+ form pickers yet fell back to a plain text box inline (you'd type a raw record
75
+ id). Wire them up — `lookup`/`master_detail` → `LookupField`, `user`/`owner` →
76
+ `UserField`, the exact widgets the form uses. They read the related-object
77
+ dataSource from `SchemaRendererContext` (which the grid provides), so the
78
+ record picker opens, fetches, and selects inline.
79
+
80
+ To stop the two lists drifting again, `index` now exports `FORM_FIELD_TYPES`
81
+ and a drift-guard test pins the contract: every form widget type must have an
82
+ explicit inline decision — an editor in `EDIT_WIDGETS` or an entry in the new
83
+ `INLINE_EXCLUDED_FIELD_TYPES` (computed/binary/heavy/container types, each with
84
+ a reason). A future form widget can no longer silently become a text box (or a
85
+ missing editor) in the grid.
86
+
87
+ - 69d6b94: feat(fields): inline-edit structured-value fields (color, address, location, geolocation, code, qrcode)
88
+
89
+ Completes the inline-editor ↔ form-widget parity from the previous fix: the six
90
+ structured types that already had lightweight form widgets — `color`,
91
+ `address`, `location`, `geolocation`, `code`, `qrcode` — now edit inline with
92
+ those same widgets instead of being deferred. All are dependency-light (no map
93
+ or code-editor libraries) and use the standard `FieldWidgetProps`. Verified
94
+ inline on the field-zoo: color → a color picker, code → a textarea, the rest
95
+ their value editors. The drift-guard's exclusion set now contains only the
96
+ genuinely-non-inline types (computed, binary, heavy editors, containers).
97
+
98
+ - 243a9ba: fix(fields): inline lookup editor shows the selected record's name (not the "Select…" placeholder)
99
+
100
+ When editing a `lookup` / `master_detail` / `user` / `owner` field inline in the
101
+ data grid, the `LookupField` picker showed the placeholder instead of the
102
+ current record's name. The grid requests `$expand` for visible reference
103
+ columns, so a lookup cell's value arrives as the related record **object**
104
+ (`{ id, name }`) rather than a bare id. The read cell (`LookupCellRenderer`)
105
+ already resolves objects via the display-name path, but the inline editor only
106
+ matched **primitive** ids (`findOption(value)` with a strict `===`), so an
107
+ object value never resolved — and the hydration effect made it worse by calling
108
+ `findOne(referenceTo, <object>)` with a bogus id.
109
+
110
+ `LookupField` now resolves an expanded-reference object directly into its
111
+ display option (mirroring the read cell), skips the pointless per-object fetch,
112
+ and normalises object values to their id for option matching / multi-select
113
+ toggle / removal. `FieldEditWidget` also renders the relational pickers
114
+ `compact` inline — the same single-line, borderless trigger the line-item grid
115
+ uses — so the record name shows **in** the trigger instead of a chip stacked
116
+ above a "Select…" button.
117
+
118
+ - 289be5b: fix(fields): align inline lookup value resolution with the read cell (external-id strings, tolerant id match)
119
+
120
+ Follow-up to #2125. `LookupField`'s inline display now resolves every value
121
+ shape the read cell (`LookupCellRenderer`) does:
122
+
123
+ - **JSON-encoded external-id references** (`'{"externalId":"Website Relaunch"}'`)
124
+ are parsed and shown by their external id, and excluded from the hydration
125
+ fetch (so we never `findOne` with a raw JSON string). `recordToOption` gained
126
+ an `externalId` fallback for both the value and the label.
127
+ - **Tolerant id matching** — a `String()`-coerced fallback (`findOptionLoose`)
128
+ resolves a numeric cell value against a string-keyed option (and vice versa),
129
+ matching the read cell's `String(a) === String(b)` comparison. Only consulted
130
+ when the strict match misses, so homogeneous option lists are unaffected.
131
+
132
+ Also adds explicit inline-editor tests for `user` / `owner` fields (they
133
+ delegate to `LookupField` via `UserField`), completing coverage for the full
134
+ relational set wired inline in #2122.
135
+
136
+ - 09e1b26: Show inline line-item (master-detail subform) row actions always, not on hover.
137
+ In grid mode the per-row remove (🗑) and duplicate buttons were `opacity-0`
138
+ until the row was hovered (`group-hover`), so they read as "delete not
139
+ supported" and were unreachable on touch / coarse-pointer devices with no hover.
140
+ They now render at full opacity (kept muted via `text-muted-foreground`); the
141
+ action column width was already reserved, so there is no layout shift. Existing
142
+ `allow_delete: false` / `readonly` / `disabled` / `min_rows` gating is unchanged.
143
+ - Updated dependencies [8bf6295]
144
+ - Updated dependencies [1948c5b]
145
+ - Updated dependencies [bce581a]
146
+ - Updated dependencies [9cd9be1]
147
+ - Updated dependencies [c38d107]
148
+ - Updated dependencies [7782698]
149
+ - Updated dependencies [790558b]
150
+ - Updated dependencies [e84d64d]
151
+ - @object-ui/types@11.4.0
152
+ - @object-ui/components@11.4.0
153
+ - @object-ui/i18n@11.4.0
154
+ - @object-ui/core@11.4.0
155
+ - @object-ui/providers@11.4.0
156
+ - @object-ui/react@11.4.0
157
+
3
158
  ## 11.3.0
4
159
 
5
160
  ### Patch Changes
@@ -1,5 +1,13 @@
1
1
  import { default as React } from 'react';
2
2
  import { FieldWidgetProps } from './widgets/types';
3
+ /**
4
+ * Form field types that are deliberately NOT given an inline editor — every
5
+ * other form widget type must be in {@link EDIT_WIDGETS}. This pairing is
6
+ * enforced by a test against the form's widget map (`FORM_FIELD_TYPES`) so the
7
+ * two can't silently drift again (which is how `lookup` was missed). To add a
8
+ * type to inline editing, move it from here into EDIT_WIDGETS.
9
+ */
10
+ export declare const INLINE_EXCLUDED_FIELD_TYPES: Set<string>;
3
11
  /** Field types whose value is chosen in one discrete gesture (no free typing). */
4
12
  export declare const DISCRETE_EDIT_TYPES: Set<string>;
5
13
  /** True when a field type has a dedicated in-place edit widget. */
@@ -0,0 +1,8 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ export {};
File without changes
File without changes