@object-ui/plugin-detail 5.0.2 → 5.1.1

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 (26) hide show
  1. package/CHANGELOG.md +164 -0
  2. package/README.md +74 -0
  3. package/dist/index.js +1397 -984
  4. package/dist/index.umd.cjs +3 -3
  5. package/dist/packages/plugin-detail/src/ActivityTimeline.d.ts.map +1 -1
  6. package/dist/packages/plugin-detail/src/ConcurrentUpdateDialog.d.ts +43 -0
  7. package/dist/packages/plugin-detail/src/ConcurrentUpdateDialog.d.ts.map +1 -0
  8. package/dist/packages/plugin-detail/src/DetailSection.d.ts.map +1 -1
  9. package/dist/packages/plugin-detail/src/DetailView.d.ts.map +1 -1
  10. package/dist/packages/plugin-detail/src/HeaderHighlight.d.ts.map +1 -1
  11. package/dist/packages/plugin-detail/src/RecordActivityTimeline.d.ts +11 -1
  12. package/dist/packages/plugin-detail/src/RecordActivityTimeline.d.ts.map +1 -1
  13. package/dist/packages/plugin-detail/src/RecordChatterPanel.d.ts +17 -0
  14. package/dist/packages/plugin-detail/src/RecordChatterPanel.d.ts.map +1 -1
  15. package/dist/packages/plugin-detail/src/RichTextCommentInput.d.ts +7 -0
  16. package/dist/packages/plugin-detail/src/RichTextCommentInput.d.ts.map +1 -1
  17. package/dist/packages/plugin-detail/src/index.d.ts +4 -1
  18. package/dist/packages/plugin-detail/src/index.d.ts.map +1 -1
  19. package/dist/packages/plugin-detail/src/renderers/record-chatter.d.ts.map +1 -1
  20. package/dist/packages/plugin-detail/src/renderers/record-details.d.ts.map +1 -1
  21. package/dist/packages/plugin-detail/src/renderers/record-reference-rail.d.ts +25 -0
  22. package/dist/packages/plugin-detail/src/renderers/record-reference-rail.d.ts.map +1 -0
  23. package/dist/packages/plugin-detail/src/synth/buildDefaultPageSchema.d.ts +14 -1
  24. package/dist/packages/plugin-detail/src/synth/buildDefaultPageSchema.d.ts.map +1 -1
  25. package/dist/packages/plugin-detail/src/useDetailTranslation.d.ts.map +1 -1
  26. package/package.json +12 -12
package/CHANGELOG.md CHANGED
@@ -1,5 +1,169 @@
1
1
  # @object-ui/plugin-detail
2
2
 
3
+ ## 5.1.1
4
+
5
+ ## 5.1.0
6
+
7
+ ### Minor Changes
8
+
9
+ - d1ec6a2: Fold inline-edit into the page-header overflow menu (HubSpot/Lightning
10
+ pattern) and remove the orphan "Edit fields" toolbar row that previously
11
+ floated between the tab strip and the first detail section.
12
+ - `@object-ui/app-shell` `RecordDetailView`: injects a new `sys_inline_edit`
13
+ system action that appears in the ⋯ overflow menu and dispatches a
14
+ `objectui:record:inline-edit-toggle` window CustomEvent (filtered by
15
+ recordId + objectName).
16
+ - `@object-ui/plugin-detail` `DetailView`: listens for that event to
17
+ toggle inline-edit mode; the in-page toolbar now renders only during
18
+ active editing / save error / locked states, so the idle layout flows
19
+ tabs → first section card with no orphan row.
20
+ - `@object-ui/components` layout containers: extended `KNOWN_LABEL_DICT`
21
+ with zh-CN + zh-TW translations for common CRM related-list labels
22
+ (Quotes / Products / Contacts / Accounts / Leads / Opportunities /
23
+ Cases / Campaigns / Approvals / Documents / Emails / Calls / Meetings
24
+ / Open Tasks / Closed Tasks), so authored English labels auto-translate
25
+ in `page:accordion` / `page:tabs` items.
26
+
27
+ - cf30cc2: Polish Lightning record detail page layout.
28
+ - `record:details` sections now render with Card chrome by default when a `title` is present, restoring visual grouping that was missing on pages like the opportunity detail page.
29
+ - Section labels can be translated via the `{ns}.objects.{objectName}._sections.{name}.label` convention. Author each section with a stable `name` (e.g. `info`, `forecast`) and the renderer picks up the locale-specific label automatically. Falls back to the literal `label` when no translation exists.
30
+ - The `page:header` action toolbar now collapses into a `⋯` overflow menu when more than two actions are present. The first business action stays inline; secondary system actions (Edit / Share / Delete) move into the menu, with destructive styling applied to Delete.
31
+ - Header action labels resolve via the `{ns}.objects.{objectName}._actions.{name}.label` convention.
32
+ - Removed the meaningless field-count Badge from collapsible section headers (the `2` chip next to "Description"). Field-count metadata wasn't useful in the header and added visual noise.
33
+ - Synth-path `sys_delete` now carries `variant: 'destructive'` so the overflow menu can color it appropriately.
34
+
35
+ - 32306e8: feat(plugin-detail): conflict-resolution dialog for OCC
36
+
37
+ When inline record-detail edits race a concurrent writer, the bound
38
+ DataSource now raises `ConcurrentUpdateError` (HTTP 409
39
+ `CONCURRENT_UPDATE`). `RecordDetailsRenderer` catches it and opens a
40
+ new `<ConcurrentUpdateDialog>` showing the user's pending value next
41
+ to the server's current value, with three resolution paths:
42
+ - **Reload latest** — discard the pending edit and refetch.
43
+ - **Overwrite anyway** — retry against the server's freshest version
44
+ (still OCC-checked, but acknowledges "I've seen the newer version").
45
+ - **Cancel** — close the dialog and leave the form untouched.
46
+
47
+ The renderer now forwards `record.updated_at` as `{ ifMatch }` to
48
+ `dataSource.update()`, so the server can detect stale writes. The
49
+ component is re-exported as `ConcurrentUpdateDialog` /
50
+ `isConcurrentUpdateError` from `@object-ui/plugin-detail` for hosts
51
+ that need to surface the same UX from custom save paths.
52
+
53
+ End-to-end OCC requires `@objectstack/client@>=4.2.0` (now wired) and
54
+ backend support in `@objectstack/rest@>=4.2.0`.
55
+
56
+ - 49b1760: Polish the ConcurrentUpdateDialog and add i18n.
57
+ - Internationalise all dialog strings (title, body, button labels, "your edit" / "current value" headings, audit-trail line) through `useDetailTranslation`. Locale strings added to `@object-ui/i18n` for English and Chinese.
58
+ - Replace the plain dialog header with an amber warning badge + `AlertTriangle` icon to communicate that this is a conflict, not a routine confirmation.
59
+ - Visually differentiate the two value blocks: amber tint for the user's pending edit, sky tint for the server's current value. Both wrap long values cleanly.
60
+ - Surface audit provenance for the racer's write (`updated_at`, plus `updated_by_name`/`updated_by_label` when supplied). Opaque ID-looking `updated_by` tokens are suppressed.
61
+ - Re-prioritise the action buttons: **Reload latest** is now the primary/recommended action (autofocused), **Overwrite anyway** is rendered as a destructive-outline button so the dangerous path requires deliberate intent, and **Cancel** falls back to a ghost variant.
62
+
63
+ - 8fd863e: Platform highlight + list polish:
64
+ - **deriveHighlightFields**: extended the preferred-field list (close_date, due_date, account, contact, …) and now skips fields whose declared type is not "highlight-friendly" (textarea, markdown, json, boolean, rich-text, etc.). Untyped legacy fields still pass through. Prevents long-form/structural fields from ending up in the highlight strip on objects with sparse metadata.
65
+ - **ListView bulk-action labels**: bulk-action buttons now resolve their labels through `actionLabel(objectName, action, fallback)` so they pick up app-supplied translations under `_actions.<name>.label`, matching the detail-page page-header overflow menu. Falls back to the previous title-cased string when no resource is found.
66
+
67
+ ### Patch Changes
68
+
69
+ - bd8447d: Three platform-wide detail polish items.
70
+
71
+ **Tighter page rhythm**
72
+ - Outer `PageRenderer` padding `p-4 md:p-6 lg:p-8` → `p-3 md:p-4 lg:p-6`
73
+ and outer body wrap `space-y-8` → `space-y-6` so list / detail / home
74
+ pages share the same edge rhythm. Cuts ~16px of edge slack on lg.
75
+
76
+ **Highlights KPI treatment**
77
+ - `HeaderHighlight` now renders numeric / currency / percent / decimal
78
+ values as KPI numbers (`text-xl md:text-2xl font-semibold tabular-nums`)
79
+ instead of the uniform `text-sm font-semibold`, so amount / probability
80
+ / count fields read as headline stats — Salesforce-style key facts.
81
+
82
+ **Discussion footer upgrade**
83
+ - `RecordActivityTimeline` now uses `RichTextCommentInput` (bold / italic /
84
+ list / code, `@`-mention autocomplete, preview toggle, Send) instead of
85
+ a bare `<textarea>`.
86
+ - `DiscussionContext` gains an optional `mentionSuggestions` array that
87
+ hosts can wire (e.g. team member directory). Falls back to free-text
88
+ `@mention` when omitted.
89
+ - `RecordChatterPanel` threads `mentionSuggestions` through both inline
90
+ and sidebar positions.
91
+
92
+ - fbd5052: Tighten record-detail visual rhythm. Section card titles were rendering at
93
+ Shadcn's default `text-2xl` which dominated the page; the related-list
94
+ accordion in flush mode dropped all per-item borders so the collapsed
95
+ "Quotes / Products / Open Tasks" triggers stacked with zero visual
96
+ separation.
97
+ - `@object-ui/plugin-detail` `DetailSection`: override the `CardTitle`
98
+ className to `text-base font-semibold tracking-tight`, slim down
99
+ `CardHeader` padding (`py-3 px-4 sm:py-4 sm:px-6`) and `CardContent`
100
+ vertical padding so titles + content read as a single tight block
101
+ rather than a billboard. Demoted the section description from `text-sm
102
+ mt-1.5` to `text-xs mt-1` for the same reason.
103
+ - `@object-ui/components` `PageAccordionRenderer`: in the default
104
+ `flush` variant restore a subtle `border-b last:border-b-0` divider
105
+ between accordion items so collapsed siblings get a separator, and
106
+ style the trigger as `text-sm font-semibold tracking-tight
107
+ hover:no-underline` (Shadcn's hover-underline default looks busy on
108
+ CRM-style related-list lists).
109
+
110
+ - d51a577: feat(platform): Discussion attachments + @mention directory + Reference Rail aside
111
+ - **Discussion attachments** — `RichTextCommentInput` now accepts an `extraSlot`
112
+ and a `canSubmitEmpty` flag so hosts can mount the existing
113
+ `CommentAttachment` composer beneath the editor without forking the toolbar.
114
+ `RecordActivityTimeline` plumbs the attachments through
115
+ `DiscussionContext.onUploadAttachments` and submits attachment-only comments.
116
+ - **@mention directory** — `DiscussionContext` gains a `mentionSuggestions`
117
+ field; `RecordDetailView` populates it from the host `sys_user` collection so
118
+ `@` autocomplete in the composer now resolves against real users.
119
+ - **Reference Rail** — New `record:reference_rail` renderer + a dedicated
120
+ `aside` region emitted by `buildDefaultPageSchema` whenever a record has
121
+ ≥ 2 related lists. The rail surfaces a Salesforce/HubSpot-style snapshot
122
+ of related collections (count badge + top 3 records) on `xl+` viewports.
123
+ - **Layout** — `PageRenderer`'s structured-layout `<aside>` wrappers now honor
124
+ `aside.className`, letting schemas attach responsive utilities like
125
+ `hidden xl:flex` to the rail region.
126
+
127
+ - a49f300: feat(detail): per-object Reference Rail opt-out via `objectDef.detail.hideReferenceRail`
128
+
129
+ The Record-detail Reference Rail (right-hand related-list summary cards)
130
+ can now be suppressed on a per-object basis without authoring a full
131
+ custom `Page`. Catalog-style objects (Product, Task) ship with the rail
132
+ off by default; hub objects (Account, Opportunity, Contact, Case) keep it
133
+ on.
134
+ - `RecordDetailView` now reads `(objectDef as any)?.detail?.hideReferenceRail`
135
+ and `…?.hideRelatedTab` and threads them to `buildDefaultPageSchema`.
136
+ - The Reference Rail renderer also accepts entries authored as either a
137
+ flat `entries` array or nested under `properties.entries`, so explicit
138
+ `Page` authors can opt-in via the standard spec shape.
139
+ - See `packages/plugin-detail/README.md` (Reference Rail decision matrix)
140
+ for the rationale and per-object guidance.
141
+
142
+ - 1cb6e21: feat(plugin-detail): suppress Related tab when Reference Rail is auto-emitted
143
+
144
+ When `buildDefaultPageSchema` decides to emit the Reference Rail (≥ 2
145
+ related lists), the duplicate `Related` tab is now suppressed by
146
+ default. The same data appeared in both places before, which is
147
+ visually noisy and risks confusing users when one surface refreshes
148
+ out-of-step with the other.
149
+
150
+ Behavior matches HubSpot / Microsoft Dynamics: the rail is the single
151
+ source of truth for related-list snapshots, and each rail card now
152
+ exposes a `View all` link that deep-links into the child object's
153
+ filtered list view. Authors can opt back into both surfaces via the
154
+ new `hideRelatedTab: false` option.
155
+
156
+ The change is gated on the same `≥ 2` heuristic that emits the rail,
157
+ so single-related-list pages keep the inline Related tab (where the
158
+ rail wouldn't have helped anyway).
159
+
160
+ - d548d6b: Unify empty-state visuals across timeline + registered `empty` renderer.
161
+ - `RecordActivityTimeline` and `ActivityTimeline` now use `DataEmptyState`
162
+ instead of a bare `<p>` so empty timelines match list/related-list visuals
163
+ (muted icon badge + centered copy).
164
+ - The `ui:empty` schema renderer now delegates to `DataEmptyState`, giving
165
+ schema-driven empty regions the same chrome as ad-hoc consumers.
166
+
3
167
  ## 5.0.2
4
168
 
5
169
  ## 5.0.1
package/README.md CHANGED
@@ -212,6 +212,80 @@ Displays related records in list, grid, or table format.
212
212
  - 🤝 [Contributing Guide](https://github.com/objectstack-ai/objectui/blob/main/CONTRIBUTING.md)
213
213
  - 🗺️ [Roadmap](https://github.com/objectstack-ai/objectui/blob/main/ROADMAP.md)
214
214
 
215
+ ## Reference Rail decision matrix
216
+
217
+ The "Reference Rail" is the right-hand column on the record detail page
218
+ that surfaces summary cards for related collections (similar to
219
+ Salesforce's **Related** rail and HubSpot's **About this record**
220
+ sidebar). It is rendered by the `record:reference_rail` component and
221
+ emits automatically when:
222
+
223
+ 1. The page is generated by the synth (`buildDefaultPageSchema`) — i.e.
224
+ no explicit `Page` overrides the object's detail view.
225
+ 2. The objectDef declares **≥2 related collections** (lookup/master-detail
226
+ inbound fields).
227
+ 3. The viewport is **≥ xl (1280 px)** — below that the rail collapses and
228
+ the **Related** tab keeps full coverage.
229
+ 4. The objectDef does **not** opt out via `detail.hideReferenceRail`.
230
+
231
+ When the rail emits, the synth automatically suppresses the **Related**
232
+ tab so the same information isn't shown twice.
233
+
234
+ ### Per-object opt-out
235
+
236
+ Add a `detail` block to the objectDef:
237
+
238
+ ```ts
239
+ ObjectSchema.create({
240
+ name: 'product',
241
+ // …
242
+ detail: {
243
+ hideReferenceRail: true, // hide the rail; restore the Related tab
244
+ hideRelatedTab: true, // (optional) force-hide the Related tab too
245
+ },
246
+ });
247
+ ```
248
+
249
+ ### CRM business-domain guidance
250
+
251
+ | Object type | Rail | Why |
252
+ |--------------------|--------|--------------------------------------------------------------|
253
+ | Hub objects | **on** | Account / Opportunity / Contact / Case — users browse laterally to quotes, contacts, activities |
254
+ | Transactional | **on** | Quote / Contract / Order — show line-items + related parties at a glance |
255
+ | Campaign / Event | **on** | Members, responses, child campaigns |
256
+ | Catalog | **off**| Product / Price Book — users edit attributes; lateral relationships are noise |
257
+ | Atomic action | **off**| Task / Note — focused single-column edit beats a related-list rail |
258
+ | Lead (unconverted) | **off**| Pre-conversion records have no children — keep it focused on the form |
259
+
260
+ ### Adding the rail to a custom `Page`
261
+
262
+ For explicit (non-synth) Pages, add an `aside` region after the `main`
263
+ region:
264
+
265
+ ```ts
266
+ {
267
+ name: 'aside',
268
+ width: 'small',
269
+ className: 'hidden xl:flex flex-col gap-4',
270
+ components: [
271
+ {
272
+ type: 'record:reference_rail',
273
+ id: 'opp_reference_rail',
274
+ properties: {
275
+ entries: [
276
+ { objectName: 'quote', relationshipField: 'opportunity', title: 'Quotes', limit: 3 },
277
+ { objectName: 'opportunity_line_item', relationshipField: 'opportunity', title: 'Products', limit: 3 },
278
+ { objectName: 'task', relationshipField: 'related_to_opportunity', title: 'Open Tasks', limit: 3 },
279
+ ],
280
+ },
281
+ },
282
+ ],
283
+ },
284
+ ```
285
+
286
+ The renderer reads `entries` from both `schema.entries` and
287
+ `schema.properties.entries` so either spec-style or flat authoring works.
288
+
215
289
  ## License
216
290
 
217
291
  MIT — see [LICENSE](./LICENSE).