From 1df25512d41e593305f7c7e7e7f7cc21cc1a74f6 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 01:52:00 +0000 Subject: [PATCH 01/13] wip(plugin-list): a list view with no exportOptions offers export by default Claude-Session: https://claude.ai/code/session_016WV4d1cnRvyiAqrarmDhZV Co-authored-by: Claude --- ui/packages/plugin-list/src/ListView.tsx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/ui/packages/plugin-list/src/ListView.tsx b/ui/packages/plugin-list/src/ListView.tsx index f963db3e559..357577f323e 100644 --- a/ui/packages/plugin-list/src/ListView.tsx +++ b/ui/packages/plugin-list/src/ListView.tsx @@ -62,7 +62,7 @@ import { useListEffectiveFilterReport, type ListEffectiveFilter } from './listEf import { SchemaRenderer, useNavigationOverlay, classifyLoadError, answeredLoadFailure, isPermissionError, usePredicateScope, useDataInvalidation, useFilterScope, useResolvedFilter, NonGridRowCeilingNote, OwnWritesContext, createOwnWrites } from '@object-ui/react'; import type { LoadErrorKind, AnsweredLoadFailure } from '@object-ui/react'; import { useDensityMode, resolveInlineAriaProps } from '@object-ui/react'; -import type { DataTableSchema, DependsOnInput, ListViewSchema, ObjectMapConfig } from '@object-ui/types'; +import type { DataTableSchema, DependsOnInput, ListViewExportOptions, ListViewSchema, ObjectMapConfig } from '@object-ui/types'; import { AUDIT_FIELD_NAMES, detectStatusField, isSystemManagedField } from '@object-ui/types'; import { usePullToRefresh } from '@object-ui/mobile'; import { type ListViewVisualization, resolveConditionalFormatting, buildExpandFields, buildExportFileName, resolveAffordance, isObjectExportOffered, type SchemaLike, partitionRowsByPredicate, normalizeListViewSchema, isListViewVisualization, rowHeightToDensityMode, mergeFilterNodes, toFilterNodeSafely, FilterOperatorError, columnIdentity, collectPredicateFieldRefs, collectGroupingFieldRefs, listViewPredicates, PLATFORM_RECORD_COLUMNS, EXPANDABLE_FIELD_TYPES, UNMATERIALIZED_FIELD_TYPES, readObjectSortability, isPlatformSortableField, leadWithNameField, filterPlatformSortableSort, applyNonGridRowCeiling, type NonGridCeilingResult, resolveNameField, declaredNameField, resolveDependsOnFields, GANTT_CONFIG_SPELLING, kanbanDeclaredLanes, csvBlob, readWithheldFieldNames, refersToWithheldField, withHeaderSortPick, shownQuantityUnitReads, fieldLockPredicates, type FieldHandLockDef } from '@object-ui/core'; @@ -2352,6 +2352,15 @@ const OUTSIDE_OPTIONS = 'outside'; */ const ROW_OPENS_RECORD_VIEW_TYPES: ReadonlySet = new Set(['object-grid', 'object-gallery', 'object-kanban']); +/** + * The export block a list view that declares none is read as (objectstack#39475): + * every member unset, so the menu offers the default formats and every other + * member keeps its own default. A list offers export unasked, as a report does; + * who may use it is the caller's export grant, read through `exportPermitted`. + * Frozen, so no reader can write into the shared default. + */ +const UNDECLARED_EXPORT_OPTIONS: Readonly = Object.freeze({}); + /** * objectui#11865 — the toolbar's "Color by field" and the record-count bar's * rows-per-page selector, drawn with the shared `Select`, the control the rest @@ -3663,9 +3672,14 @@ export const ListView = React.forwardRef(({ */ const rowsCarryConcurrencyToken = inlineEditOffered; - // Normalize exportOptions: support both ObjectUI object format and spec string[] format + // Normalize exportOptions: support both ObjectUI object format and spec string[] format. + // An undeclared block is the default block, never "no export" + // (objectstack#39475): who may export is `exportPermitted` (the caller's + // export grant, through the server's effective `export` operation), and the + // off switches are `exportOptions: { formats: [] }` on the view and + // `userActions.exportCsv: false` on the object. const resolvedExportOptions = React.useMemo(() => { - if (!schema.exportOptions) return undefined; + if (!schema.exportOptions) return UNDECLARED_EXPORT_OPTIONS; // Spec format: simple string[] like ['csv', 'xlsx'] if (Array.isArray(schema.exportOptions)) { return { formats: schema.exportOptions }; From cb0f3ff7f8a367a9275174c2b69a0d36a42ea730 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 02:15:05 +0000 Subject: [PATCH 02/13] test(plugin-list): pin the default-on export of an undeclared list view Claude-Session: https://claude.ai/code/session_016WV4d1cnRvyiAqrarmDhZV Co-authored-by: Claude --- .../src/__tests__/ListView.harness.test.tsx | 142 +++++++++++++++++- .../src/__tests__/ListView.test.tsx | 6 +- .../ListViewBlock.specInputs-13047.test.tsx | 6 +- 3 files changed, 150 insertions(+), 4 deletions(-) diff --git a/ui/packages/plugin-list/src/__tests__/ListView.harness.test.tsx b/ui/packages/plugin-list/src/__tests__/ListView.harness.test.tsx index 5061e2b6aa5..e5cc524ce78 100644 --- a/ui/packages/plugin-list/src/__tests__/ListView.harness.test.tsx +++ b/ui/packages/plugin-list/src/__tests__/ListView.harness.test.tsx @@ -2720,6 +2720,141 @@ describe('ListView.exportCsvGate-35619', () => { }); }); +// ── ListView.exportDefaultOn-39475 ────────────────────────────────────────────── + +/** + * objectstack#39475 — a list view that declares no `exportOptions` offers + * export. The undeclared block is the default block: the default formats + * (`csv` and `json`; `xlsx` only when a view names it), every other member at + * its own default. Who may export is unchanged: the caller's export grant, + * which the server folds into the object's effective `export` operation + * (`/me/permissions` `apiOperations`), so a caller whose permission sets + * withhold `allowExport` still sees no export on such a list. The off switches + * are the view's `exportOptions: { formats: [] }` and the object's + * `userActions.exportCsv: false`. + */ +describe('ListView.exportDefaultOn-39475', () => { + restoreAfterBlock(); + + const OBJECT = 'account'; + + function makeDataSource(userActions?: Record) { + return { + find: vi.fn().mockResolvedValue({ data: [{ id: '1', name: 'Acme' }], total: 1 }), + findOne: vi.fn(), + create: vi.fn(), + update: vi.fn(), + delete: vi.fn(), + // The server stream is wired, so `xlsx` would be deliverable: the + // default list leaving it out is the default formats, not the path. + exportDownload: vi.fn().mockResolvedValue(new Blob(['x'], { type: 'text/csv' })), + getObjectSchema: vi.fn().mockResolvedValue({ + name: OBJECT, + fields: { name: { type: 'text', label: 'Name' } }, + ...(userActions ? { userActions } : {}), + }), + } as any; + } + + /** + * The `/me/permissions` envelope for a reader of the object. `apiOperations` + * is the server's effective set: for a caller whose sets withhold + * `allowExport` the server annotates the entry without `export`; for one + * holding the grant on an unrestricted object it leaves the entry + * unannotated. + */ + const session = (apiOperations?: string[]): MePermissionsAuthenticatedResponse => ({ + authenticated: true, + userId: 'u1', + tenantId: null, + hasAnyQueue: false, + objectsUsingQueues: [], + positions: ['member'], + permissionSets: ['member'], + objects: { [OBJECT]: { allowRead: true, ...(apiOperations ? { apiOperations } : {}) } as never }, + fields: {}, + }); + + async function renderList(opts: { + compactToolbar: boolean; + exportOptions?: ListViewSchema['exportOptions']; + userActions?: Record; + apiOperations?: string[] | 'no-provider'; + }) { + const ds = makeDataSource(opts.userActions); + let tree = ( + + + + ); + if (opts.apiOperations !== undefined && opts.apiOperations !== 'no-provider') { + tree = {tree}; + } + render(tree); + await waitFor(() => expect(ds.getObjectSchema).toHaveBeenCalledWith(OBJECT)); + // The row read waits for the definition, so once it runs the verdict is the settled one. + await waitFor(() => expect(ds.find).toHaveBeenCalled()); + } + + const wideExport = () => screen.queryByRole('button', { name: /^export$/i }); + + function displayExportEntries() { + fireEvent.click(screen.getByTestId('toolbar-display-trigger')); + const panel = screen.getByTestId('view-settings-content'); + return within(panel).queryAllByTestId(/^display-export-(csv|xlsx|json)$/).map((el) => el.getAttribute('data-testid')); + } + + it('THE CHANGE — wide toolbar: no exportOptions declared, the Export button is drawn', async () => { + await renderList({ compactToolbar: false }); + expect(wideExport()).toBeInTheDocument(); + }); + + it('THE CHANGE — Display panel: no exportOptions declared, the default formats are offered, csv and json', async () => { + await renderList({ compactToolbar: true }); + expect(displayExportEntries()).toEqual(['display-export-csv', 'display-export-json']); + }); + + it('a caller the server serves no `export` operation (no `allowExport` grant) sees no export on an undeclared list', async () => { + await renderList({ compactToolbar: false, apiOperations: ['get', 'list', 'aggregate', 'search'] }); + expect(wideExport()).toBeNull(); + }); + + it('the same caller sees no export entry in the Display panel either', async () => { + await renderList({ compactToolbar: true, apiOperations: ['get', 'list', 'aggregate', 'search'] }); + expect(displayExportEntries()).toEqual([]); + }); + + it('CONTROL — a caller the server serves `export` sees the Export button on an undeclared list', async () => { + await renderList({ compactToolbar: false, apiOperations: ['get', 'list', 'aggregate', 'search', 'export'] }); + expect(wideExport()).toBeInTheDocument(); + }); + + it('`exportOptions: { formats: [] }` turns the export off', async () => { + await renderList({ compactToolbar: false, exportOptions: { formats: [] } }); + expect(wideExport()).toBeNull(); + }); + + it('the object\'s `userActions.exportCsv: false` turns it off on an undeclared list', async () => { + await renderList({ compactToolbar: false, userActions: { exportCsv: false } }); + expect(wideExport()).toBeNull(); + }); + + it('CONTROL — a declared block keeps its own formats', async () => { + await renderList({ compactToolbar: true, exportOptions: { formats: ['xlsx'] } }); + expect(displayExportEntries()).toEqual(['display-export-xlsx']); + }); +}); + // ── ListView.toolbarTrailingExportDoor-36113 ──────────────────────────────────── /** @@ -3996,7 +4131,11 @@ describe('ListView.groupPickerUnstored-32631', () => { describe('ListView.refreshOnlyDisplay-36002', () => { restoreAfterBlock(); - /** Every Display control off; `refresh` is left at its default, on. */ + /** + * Every Display control off; `refresh` is left at its default, on. The + * export entries the Display panel's footer carries are off too + * (`formats: []`): an undeclared block offers export (objectstack#39475). + */ const REFRESH_ONLY: ListViewSchema = { type: 'list-view', objectName: 'opportunity', @@ -4004,6 +4143,7 @@ describe('ListView.refreshOnlyDisplay-36002', () => { fields: ['name', 'stage'], kanban: { groupByField: 'stage' }, userActions: { group: false, rowHeight: false, hideFields: false }, + exportOptions: { formats: [] }, } as ListViewSchema; let previousKanban: ReturnType; diff --git a/ui/packages/plugin-list/src/__tests__/ListView.test.tsx b/ui/packages/plugin-list/src/__tests__/ListView.test.tsx index 5582099ac3f..b52859b8b2f 100644 --- a/ui/packages/plugin-list/src/__tests__/ListView.test.tsx +++ b/ui/packages/plugin-list/src/__tests__/ListView.test.tsx @@ -370,12 +370,16 @@ describe('ListView', () => { expect(exportButton).toBeInTheDocument(); }); - it('should not render export button when exportOptions not configured', () => { + it('should not render export button when exportOptions turns every format off', () => { + // An absent block offers the default formats (objectstack#39475); the + // wide toolbar draws the Export button only while some format is offered. const schema: ListViewSchema = { type: 'list-view', objectName: 'contacts', viewType: 'grid', fields: ['name', 'email'], + compactToolbar: false, + exportOptions: { formats: [] }, }; renderWithProvider(); diff --git a/ui/packages/plugin-list/src/__tests__/ListViewBlock.specInputs-13047.test.tsx b/ui/packages/plugin-list/src/__tests__/ListViewBlock.specInputs-13047.test.tsx index b8aa672af76..0a6be417f58 100644 --- a/ui/packages/plugin-list/src/__tests__/ListViewBlock.specInputs-13047.test.tsx +++ b/ui/packages/plugin-list/src/__tests__/ListViewBlock.specInputs-13047.test.tsx @@ -339,8 +339,10 @@ describe('objectui#13047 — the toolbar and chrome keys, drawn by `ListView` it expect(bar.textContent ?? '').toContain('Stage'); }); - it('`exportOptions`: `{ formats: [\'csv\'] }` offers the export, and `fileNamePrefix` names the file; absent offers none', async () => { - const control = mount({ compactToolbar: false }); + it('`exportOptions`: `{ formats: [\'csv\'] }` offers the export, and `fileNamePrefix` names the file; `formats: []` offers none', async () => { + // An absent block offers the default formats (objectstack#39475), so the + // off control is the empty format list. + const control = mount({ compactToolbar: false, exportOptions: { formats: [] } }); await loaded(control.dataSource); expect(screen.queryByRole('button', { name: /export/i })).toBeNull(); cleanup(); From fa1dcbd09c0da0e847e4f60dfa7aa30dc7439114 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 02:21:06 +0000 Subject: [PATCH 03/13] docs(spec, plugin-list): changeset, upgrade note and docs for the default-on list export Claude-Session: https://claude.ai/code/session_016WV4d1cnRvyiAqrarmDhZV Co-authored-by: Claude --- .../39475-list-view-export-on-by-default.md | 19 +++++++++++ content/docs/ui/components/plugins.mdx | 2 +- .../19.list-view-export-on-by-default.ts | 33 +++++++++++++++++++ .../spec/src/ui/list-view-export-options.ts | 11 +++++++ 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 .changeset/39475-list-view-export-on-by-default.md create mode 100644 packages/spec/src/migrations/entries/semantic/19.list-view-export-on-by-default.ts diff --git a/.changeset/39475-list-view-export-on-by-default.md b/.changeset/39475-list-view-export-on-by-default.md new file mode 100644 index 00000000000..9f684460494 --- /dev/null +++ b/.changeset/39475-list-view-export-on-by-default.md @@ -0,0 +1,19 @@ +--- +'@objectstack/spec': minor +'@object-ui/plugin-list': minor +--- + +feat(plugin-list): a list view that declares no `exportOptions` offers export + +Clause-②: no +Metadata-protocol: semantic + +A list view used to offer its Export entry only when the view declared `exportOptions`, so most lists offered Import and no Export. A list view now reads an absent `exportOptions` as the empty block: the toolbar's Export button, the Display panel's export entries and the page bar's Import / Export menu offer the default formats, `csv` and `json`. `xlsx` is offered where a view lists it in `formats` and the server stream delivers it, as before. A declared block behaves as before. + +Who may export is unchanged. The permission set's `allowExport` grant reaches the list through the object's effective `export` operation (`/me/permissions` `apiOperations`): a user whose permission sets do not grant it sees no Export entry on any list, and the server refuses the export request. + +To keep a view without export, declare `exportOptions: { formats: [] }` on it. To take export off every view of an object, set the object's `userActions.exportCsv: false`. + +An `object-grid` page component is not changed: it still offers export only when it declares `exportOptions`. + +The upgrade guide carries the change as the semantic entry `list-view-export-on-by-default`. diff --git a/content/docs/ui/components/plugins.mdx b/content/docs/ui/components/plugins.mdx index 51a6fb671be..0e0d135f8cd 100644 --- a/content/docs/ui/components/plugins.mdx +++ b/content/docs/ui/components/plugins.mdx @@ -293,7 +293,7 @@ Namespace `plugin-list`. | `addRecord` | `object` | | The Add button, the spec's `AddRecordConfig`. The spec row declares `enabled` default `true` and `position` default `"bottom"`; the renderer does not apply those defaults: it draws the button only for an explicit `enabled: true`, and places an absent `position` at the top (objectui#13099 owns that gap). `position` places it: `"top"` (the toolbar), `"bottom"` (under the list) or `"both"`. A click opens the create form for the listed object, the one the object list's New opens: the record-form overlay, or the full-page create for an object whose `editMode` is `page`. The button is withheld for a viewer who may not create, or whose create the object greys, and on a host that serves no create. `mode` and `formView` are not read. `userActions.addRecordForm: false` also takes the button off. | | `compactToolbar` | `boolean` | | Gather the grouping, row colour, density and hide-fields controls into one Display form. On by default; `false` draws one toolbar button per control. | | `appearance` | `object` | | The spec's appearance config, `{ showDescription, allowedVisualizations }`. `showDescription: false` hides the description. `allowedVisualizations` narrows the kinds a view switcher offers, and a page node draws no switcher, so on a page it changes nothing: the node's `type` is the kind drawn. | -| `exportOptions` | `object` | | The export menu, `{ formats, maxRecords, includeHeaders, fileNamePrefix, streaming }`. Declaring it offers the export on the toolbar, in the listed formats; `fileNamePrefix` names the file. | +| `exportOptions` | `object` | | The export menu, `{ formats, maxRecords, includeHeaders, fileNamePrefix, streaming }`. The toolbar offers export whether or not the view declares it: absent, the menu offers `csv` and `json`; declared, it offers the listed formats, and `fileNamePrefix` names the file. `formats: []` turns the export off for the view, and the object's `userActions.exportCsv: false` for every view of the object. Who may export is the permission set's `allowExport`: a user without it sees no export. | | `allowPrinting` | `boolean` | | Draw a Print button that opens the browser's print dialog for the list. | | `showRecordCount` | `boolean` | | The record count in the list's footer. On by default; `false` takes it off. On an ungrouped grid that declares no `pagination` (it loads as it scrolls), `false` also stops the list asking the server for the total, so no count query runs. Everywhere else the list still asks: a grid that keeps a numbered pager (the pager needs the total), a grouped grid, and a list in a page region's compact or capped form. | | `emptyState` | `object` | | What the list draws when no record comes back, the spec's `EmptyState`: `{ title, message, icon, link }`. `title`, `message` and the link's `label` each take a plain string or an inline per-locale map. | diff --git a/packages/spec/src/migrations/entries/semantic/19.list-view-export-on-by-default.ts b/packages/spec/src/migrations/entries/semantic/19.list-view-export-on-by-default.ts new file mode 100644 index 00000000000..ca5c064d041 --- /dev/null +++ b/packages/spec/src/migrations/entries/semantic/19.list-view-export-on-by-default.ts @@ -0,0 +1,33 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +import type { SemanticMigration } from '../../types.js'; + +// The upgrade-guide entry of a changed default: a list view that declares no +// `exportOptions` now offers export (the maintainer's ruling on #39409, option +// A). Notice only: no key is added or removed and no D2 conversion exists, so +// nothing in the metadata changes and no gate tells an upgrader the meaning moved. +export const entry: SemanticMigration = { + id: 'list-view-export-on-by-default', + surface: + 'view.exportOptions on a list view, wherever the view is declared (ABSENT — a view that never declared ' + + 'the block)', + replacement: + 'No action is owed to keep export: it is offered with the default formats, `csv` and `json`. To keep a view ' + + 'without export, declare `exportOptions: { formats: [] }` on it; to take export off every view of an ' + + 'object, set the object\'s `userActions.exportCsv: false`. Who may export is unchanged: the permission ' + + 'set\'s `allowExport` grant', + reason: + 'Before this release a list view offered its Export entry only when it declared `exportOptions`, so a ' + + 'view that never thought about export offered import and no export. A list now reads an absent block as ' + + 'the empty block and offers its default formats, the way a report offers its own export unasked. The ' + + 'metadata is unchanged and still parses, which is why this is registered: what an absent block means has ' + + 'changed. The permission wall is not moved. A user whose permission sets do not grant `allowExport` on ' + + 'the object is served no `export` operation and sees no Export entry, on any view; the server refuses ' + + 'the export request too. An `object-grid` page component is not changed by this entry: it still offers ' + + 'export only when it declares the block.', + acceptanceCriteria: + 'Every list view that must not offer export declares `exportOptions: { formats: [] }`, or its object sets ' + + '`userActions.exportCsv: false`. Signed in as a holder of each permission set, Export is offered on a list ' + + 'exactly where that set grants `allowExport` on the object.', + relevantWhen: { kind: 'stack-declares', keys: ['views', 'objects', 'pages'] }, +}; diff --git a/packages/spec/src/ui/list-view-export-options.ts b/packages/spec/src/ui/list-view-export-options.ts index fb7c5934947..61f806ed3dc 100644 --- a/packages/spec/src/ui/list-view-export-options.ts +++ b/packages/spec/src/ui/list-view-export-options.ts @@ -25,6 +25,17 @@ * {@link LIST_VIEW_EXPORT_OPTIONS_ARRAY_FORM}). The list view's published JSON * Schema did not move with it. * + * [#39475] What an ABSENT block means differs by carrier. A list view that + * declares none offers its export anyway, read as the empty block — the + * default formats, every other member at its default — as a report offers + * its own unasked (maintainer ruling on #39409, option A of analysis + * 7397854343). Who may export is the permission set's `allowExport`, which + * the server folds into the object's effective `export` operation; + * `formats: []` turns a view's export off and the object's + * `userActions.exportCsv: false` every view's. + * An `object-grid` page component still offers export only when it declares + * the block. + * * [#26548] A report's export block lives here too, at the end of the module: * {@link ReportExportOptionsSchema}, three of these five members under the * same key name, so a report and a list share one export vocabulary rather From 39ebdec079d57848aa7b86cc8b460ed0a108e377 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 03:20:00 +0000 Subject: [PATCH 04/13] docs(plugin-list): the list-view block's exportOptions description says export is offered unasked Claude-Session: https://claude.ai/code/session_016WV4d1cnRvyiAqrarmDhZV Co-authored-by: Claude --- ui/packages/plugin-list/src/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/packages/plugin-list/src/index.tsx b/ui/packages/plugin-list/src/index.tsx index 07a1edc952e..0e0a810cd7c 100644 --- a/ui/packages/plugin-list/src/index.tsx +++ b/ui/packages/plugin-list/src/index.tsx @@ -256,7 +256,7 @@ const LIST_VIEW_INPUTS: ComponentInput[] = [ name: 'exportOptions', type: 'object', description: - 'The export menu, `{ formats, maxRecords, includeHeaders, fileNamePrefix, streaming }`. Declaring it offers the export on the toolbar, in the listed formats; `fileNamePrefix` names the file.', + 'The export menu, `{ formats, maxRecords, includeHeaders, fileNamePrefix, streaming }`. The toolbar offers export whether or not the view declares it: absent, the menu offers `csv` and `json`; declared, it offers the listed formats, and `fileNamePrefix` names the file. `formats: []` turns the export off for the view, and the object\'s `userActions.exportCsv: false` for every view of the object. Who may export is the permission set\'s `allowExport`: a user without it sees no export.', }, { name: 'allowPrinting', type: 'boolean', description: 'Draw a Print button that opens the browser\'s print dialog for the list.' }, { From 95b795aecdaa72d4131b827da2a14969cffecd12 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 03:39:31 +0000 Subject: [PATCH 05/13] chore(sdui): regenerate the manifest for the list-view exportOptions description Claude-Session: https://claude.ai/code/session_016WV4d1cnRvyiAqrarmDhZV Co-authored-by: Claude --- scripts/sdui-manifest.record.json | 6 +++--- sdui.manifest.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/sdui-manifest.record.json b/scripts/sdui-manifest.record.json index d13987a99b6..1507e4cfe2f 100644 --- a/scripts/sdui-manifest.record.json +++ b/scripts/sdui-manifest.record.json @@ -13,11 +13,11 @@ ], "source": "built-tree", "generator": "scripts/gen-sdui-manifest-node.mjs", - "generatedAt": "2026-12-03", - "sha256": "fb32f711dcba2bd07a493557e6328407ea052a53cec63315161dced73552bb2a", + "generatedAt": "2026-12-04", + "sha256": "2763ba89195a8b4b3ef121df0f853449645595d77ee9c350490c0bbf0ba07e7e", "components": 106, "inTree": { "modulesRoot": "ui/apps/console", - "objectuiWorkspaceVersion": "19.0.0-next.3" + "objectuiWorkspaceVersion": "19.0.0-next.4" } } diff --git a/sdui.manifest.json b/sdui.manifest.json index 7f040b40c27..44f30ace476 100644 --- a/sdui.manifest.json +++ b/sdui.manifest.json @@ -303,7 +303,7 @@ { "name": "exportOptions", "type": "object", - "description": "The export menu, `{ formats, maxRecords, includeHeaders, fileNamePrefix, streaming }`. Declaring it offers the export on the toolbar, in the listed formats; `fileNamePrefix` names the file." + "description": "The export menu, `{ formats, maxRecords, includeHeaders, fileNamePrefix, streaming }`. The toolbar offers export whether or not the view declares it: absent, the menu offers `csv` and `json`; declared, it offers the listed formats, and `fileNamePrefix` names the file. `formats: []` turns the export off for the view, and the object's `userActions.exportCsv: false` for every view of the object. Who may export is the permission set's `allowExport`: a user without it sees no export." }, { "name": "allowPrinting", From c3d6d80447ea73379c59a2c04454bd8e315e4b28 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 04:54:45 +0000 Subject: [PATCH 06/13] test(spec): register the list-view-export-on-by-default entry's relevance question Claude-Session: https://claude.ai/code/session_016WV4d1cnRvyiAqrarmDhZV Co-authored-by: Claude --- .../entries/semantic/19.list-view-export-on-by-default.ts | 2 +- .../src/migrations/semantic-relevance-coverage-38929.test.ts | 5 +++-- packages/spec/src/migrations/semantic-relevance.test.ts | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/spec/src/migrations/entries/semantic/19.list-view-export-on-by-default.ts b/packages/spec/src/migrations/entries/semantic/19.list-view-export-on-by-default.ts index ca5c064d041..2e0c47c73d9 100644 --- a/packages/spec/src/migrations/entries/semantic/19.list-view-export-on-by-default.ts +++ b/packages/spec/src/migrations/entries/semantic/19.list-view-export-on-by-default.ts @@ -29,5 +29,5 @@ export const entry: SemanticMigration = { 'Every list view that must not offer export declares `exportOptions: { formats: [] }`, or its object sets ' + '`userActions.exportCsv: false`. Signed in as a holder of each permission set, Export is offered on a list ' + 'exactly where that set grants `allowExport` on the object.', - relevantWhen: { kind: 'stack-declares', keys: ['views', 'objects', 'pages'] }, + relevantWhen: { kind: 'stack-declares', keys: ['views', 'viewItems', 'objects', 'pages'] }, }; diff --git a/packages/spec/src/migrations/semantic-relevance-coverage-38929.test.ts b/packages/spec/src/migrations/semantic-relevance-coverage-38929.test.ts index 4481d5749f6..a01977c8e43 100644 --- a/packages/spec/src/migrations/semantic-relevance-coverage-38929.test.ts +++ b/packages/spec/src/migrations/semantic-relevance-coverage-38929.test.ts @@ -289,6 +289,7 @@ const LIST_VIEW = [ 'publish-refuses-list-view-grouping-the-engine-does-not-group-by', 'publish-refuses-views-and-dashboards-that-save-and-do-not-work', 'view-bulk-actions-declared-on-the-action', + 'list-view-export-on-by-default', ]; const FORM_VIEW = ['internal-record-forms-not-loaded', 'ui-form-view-modal-size-retired', 'ui-form-view-subforms-retired']; const FIELD = [ @@ -362,12 +363,12 @@ const SITES: ReadonlyArray<{ site: string; stack: Record; entri }, { site: 'actions[] (a standalone action)', stack: { actions: [{ name: 'run', type: 'script' }] }, entries: [...ACTION_BODY, ...ACTION_TYPE, 'publish-refuses-metadata-the-runtime-ignores'] }, { site: 'views[] (a list view, a form view)', stack: { views: [{ name: 'v' }] }, entries: [...LIST_VIEW, ...FORM_VIEW] }, - { site: 'viewItems[]', stack: { viewItems: [{ name: 'v' }] }, entries: [...LIST_VIEW.slice(0, 4), ...FORM_VIEW] }, + { site: 'viewItems[]', stack: { viewItems: [{ name: 'v' }] }, entries: [...LIST_VIEW.slice(0, 4), 'list-view-export-on-by-default', ...FORM_VIEW] }, { site: 'forms[]', stack: { forms: [{ name: 'site_thing.form' }] }, entries: FORM_VIEW }, { site: 'pages[] components', stack: { pages: [{ name: 'p' }] }, - entries: ['action-locations-page-parts-retired', 'object-grid-single-click-edit-retired', 'ui-action-type-ask-ai-retired', 'view-bulk-actions-declared-on-the-action', 'cel-list-equality-refused'], + entries: ['action-locations-page-parts-retired', 'object-grid-single-click-edit-retired', 'ui-action-type-ask-ai-retired', 'view-bulk-actions-declared-on-the-action', 'list-view-export-on-by-default', 'cel-list-equality-refused'], }, { site: 'dashboards[] (a header action)', stack: { dashboards: [{ name: 'd' }] }, entries: ['ui-action-type-ask-ai-retired', 'publish-refuses-views-and-dashboards-that-save-and-do-not-work'] }, { site: 'apps[]', stack: { apps: [{ name: 'a' }] }, entries: ['nav-keywords-empty-list-refused', 'publish-refuses-views-and-dashboards-that-save-and-do-not-work'] }, diff --git a/packages/spec/src/migrations/semantic-relevance.test.ts b/packages/spec/src/migrations/semantic-relevance.test.ts index 2c659a0f946..a1434e1c8ad 100644 --- a/packages/spec/src/migrations/semantic-relevance.test.ts +++ b/packages/spec/src/migrations/semantic-relevance.test.ts @@ -98,6 +98,7 @@ const EXPECTED_RELEVANCE: Readonly> = { '19:internal-record-forms-not-loaded': ['views', 'viewItems', 'forms'], '19:knowledge-service-held-without-embedder-or-store': ['knowledgeSources', 'requires'], '19:knowledge-source-publish-refuses-missing-references-and-gated-objects': ['knowledgeSources'], + '19:list-view-export-on-by-default': ['views', 'viewItems', 'objects', 'pages'], '19:lookup-depends-on-param-computed-field-refused': ['objects', 'objectExtensions'], '19:lookup-depends-on-param-computed-field-refused-on-tree': ['objects', 'objectExtensions'], '19:lookup-filter-record-path-structured-refused': ['objects', 'objectExtensions'], From de36cd7dea06a64d0ed186e86d39dc463525662a Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 06:47:30 +0000 Subject: [PATCH 07/13] feat(plugin-grid): an object grid that declares no exportOptions offers export; platform hosts declare none Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_016WV4d1cnRvyiAqrarmDhZV --- ui/apps/console/src/dev/DevRowActions.tsx | 3 + .../views/metadata-admin/metadataListGrid.ts | 3 + .../plugin-designer/src/FieldDesigner.tsx | 3 + .../plugin-designer/src/ObjectManager.tsx | 3 + ui/packages/plugin-detail/src/RelatedList.tsx | 4 + ui/packages/plugin-grid/src/ObjectGrid.tsx | 47 +++++++--- .../src/__tests__/exportGate.test.tsx | 85 +++++++++++++++++++ ui/packages/plugin-list/src/ListView.tsx | 4 + 8 files changed, 142 insertions(+), 10 deletions(-) diff --git a/ui/apps/console/src/dev/DevRowActions.tsx b/ui/apps/console/src/dev/DevRowActions.tsx index da635877304..d87901139f5 100644 --- a/ui/apps/console/src/dev/DevRowActions.tsx +++ b/ui/apps/console/src/dev/DevRowActions.tsx @@ -49,6 +49,9 @@ function EnvGrid({ maxInlineRowActions }: { maxInlineRowActions?: number }) { columns: COLUMNS, data: { provider: 'value', items: ENV_ROWS }, rowActionDefs: ROW_ACTION_DEFS, + // objectstack#39475 — a grid over an object offers export unasked; this + // dev page pins row actions only, so it declares none. + exportOptions: { formats: [] }, ...(maxInlineRowActions != null ? { maxInlineRowActions } : {}), }; return ( diff --git a/ui/packages/app-shell/src/views/metadata-admin/metadataListGrid.ts b/ui/packages/app-shell/src/views/metadata-admin/metadataListGrid.ts index d8b92c2ea2b..328ccedfb85 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/metadataListGrid.ts +++ b/ui/packages/app-shell/src/views/metadata-admin/metadataListGrid.ts @@ -127,6 +127,9 @@ export function metadataListGridSchema( resizable: false, reorderableColumns: false, pagination: { pageSize }, + // objectstack#39475 — a grid over an object offers export unasked; a + // metadata list is a platform screen, so it declares none. + exportOptions: { formats: [] }, }; } diff --git a/ui/packages/plugin-designer/src/FieldDesigner.tsx b/ui/packages/plugin-designer/src/FieldDesigner.tsx index 2b8b36c34c7..c21f6c38843 100644 --- a/ui/packages/plugin-designer/src/FieldDesigner.tsx +++ b/ui/packages/plugin-designer/src/FieldDesigner.tsx @@ -311,6 +311,9 @@ export function FieldDesigner({ searchableFields: ['name', 'label', 'description'], showSearch: true, operations: readOnly ? undefined : { create: true, update: true, delete: true }, + // objectstack#39475 — a grid over an object offers export unasked; this + // designer table is a platform screen, so it declares none. + exportOptions: { formats: [] }, }), [gridColumns, readOnly]); // Handlers diff --git a/ui/packages/plugin-designer/src/ObjectManager.tsx b/ui/packages/plugin-designer/src/ObjectManager.tsx index 7d642976689..b97eb19ece7 100644 --- a/ui/packages/plugin-designer/src/ObjectManager.tsx +++ b/ui/packages/plugin-designer/src/ObjectManager.tsx @@ -117,6 +117,9 @@ export function ObjectManager({ searchableFields: ['name', 'label', 'description'], showSearch: true, operations: readOnly ? undefined : { create: true, update: true, delete: true }, + // objectstack#39475 — a grid over an object offers export unasked; this + // designer table is a platform screen, so it declares none. + exportOptions: { formats: [] }, }), [gridColumns, readOnly]); // Handlers diff --git a/ui/packages/plugin-detail/src/RelatedList.tsx b/ui/packages/plugin-detail/src/RelatedList.tsx index 01f15f47125..6159050c932 100644 --- a/ui/packages/plugin-detail/src/RelatedList.tsx +++ b/ui/packages/plugin-detail/src/RelatedList.tsx @@ -3843,6 +3843,10 @@ export const RelatedList: React.FC = ({ ), showSearch: false, showPagination: false, + // objectstack#39475 — a grid over an object offers export unasked; + // this list's own toolbar keeps the related list's export door, so + // the grid draws none. + exportOptions: { formats: [] }, // objectstack#35892 — cell editing as on the list page // (objectstack#35683): where the reader may edit the child object. ...(tabList ? { editable: tabInlineEdit } : {}), diff --git a/ui/packages/plugin-grid/src/ObjectGrid.tsx b/ui/packages/plugin-grid/src/ObjectGrid.tsx index 0b1b3d03336..b55ee26660d 100644 --- a/ui/packages/plugin-grid/src/ObjectGrid.tsx +++ b/ui/packages/plugin-grid/src/ObjectGrid.tsx @@ -22,7 +22,7 @@ */ import React, { useEffect, useState, useCallback, useMemo } from 'react'; -import type { ObjectGridSchema, DataSource, ViewData, TableSortItem, DataTableSchema, ListViewExportFormat, RecordNavigateAction } from '@object-ui/types'; +import type { ObjectGridSchema, DataSource, ViewData, TableSortItem, DataTableSchema, ListViewExportFormat, ListViewExportOptions, RecordNavigateAction } from '@object-ui/types'; import { isSystemManagedField, detectStatusField } from '@object-ui/types'; import { SchemaRenderer, isPermissionError, useDataScope, useNavigationOverlay, useAction, useSafeFieldLabel, usePredicateScope, useCapabilityGate, useRelatedRecordActions, notifyDataChanged, useMetadata, claimAnswerWarnings, toastRecordSave, useOwnWrites, createOwnWrites } from '@object-ui/react'; // objectui#8920 — the grid reaches a cell renderer through THIS module and @@ -942,6 +942,23 @@ function cellEditorWidthClass(type: string): string { /** objectstack#35689 — no record waits in its group. */ const NO_HELD_RECORDS: ReadonlySet = new Set(); +/** + * The export block a grid over an object that declares none is read as + * (objectstack#39475, the grid half of the list ruling): every member unset, + * so the menu offers the default formats, `csv` and `json`, and every other + * member keeps its own default, exactly as `plugin-list`'s list view reads an + * absent block. Who may export is not this block: it is the object's export + * verdict, `objectExportOffered`, which carries the caller's `allowExport` + * grant through the server's effective `export` operation. + * + * Platform screens that compose a grid for their own purposes write + * `exportOptions: { formats: [] }` on the node they build, so only the + * author-placed table gains the entry. A grid that names no object keeps the + * old reading: export only where the block is declared. Frozen, so no reader + * can write into the shared default. + */ +const UNDECLARED_EXPORT_OPTIONS: Readonly = Object.freeze({}); + export const ObjectGrid: React.FC = ({ schema, dataSource, @@ -2185,23 +2202,31 @@ export const ObjectGrid: React.FC = ({ // runs. Such a value reaches here and is dropped by the same rule, with no // `'pdf'`-specific branch to keep alive (objectui#4535). // (Hoisted above the error/loading early returns to satisfy hooks rules.) + // + // [objectstack#39475] The block every export read below takes: the declared + // one, or — on a grid over an object that declares none — the default block + // (`UNDECLARED_EXPORT_OPTIONS`). A grid that names no object stays + // explicit-only. Platform hosts that must not offer export write + // `exportOptions: { formats: [] }` on the node they build. + const exportOptions: ListViewExportOptions | undefined = + schema.exportOptions ?? (objectName ? UNDECLARED_EXPORT_OPTIONS : undefined); const exportableFormats = useMemo(() => { - const declared = schema.exportOptions?.formats || ['csv', 'json']; + const declared = exportOptions?.formats || ['csv', 'json']; const serverAvailable = typeof dataSource?.exportDownload === 'function' && !!objectName && !hasInlineData - && schema.exportOptions?.streaming !== false; + && exportOptions?.streaming !== false; const supported = serverAvailable ? ['csv', 'xlsx', 'json'] : ['csv', 'json']; return declared.filter((f: string) => supported.includes(f)); - }, [schema.exportOptions, dataSource, objectName, hasInlineData]); + }, [exportOptions, dataSource, objectName, hasInlineData]); useEffect(() => { - const declared = schema.exportOptions?.formats; + const declared = exportOptions?.formats; if (!declared) return; const dropped = declared.filter((f) => !exportableFormats.includes(f)); if (dropped.length > 0) { console.warn(`[ObjectUI] ObjectGrid export: unsupported format(s) hidden from the menu: ${dropped.join(', ')}`); } - }, [schema.exportOptions, exportableFormats]); + }, [exportOptions, exportableFormats]); const handleExport = useCallback((format: ListViewExportFormat) => { // Object-level export permission gate. Default-allow: an explicit @@ -2212,7 +2237,7 @@ export const ObjectGrid: React.FC = ({ // object's own verdict alone. if (schema.operations?.export === false) return; if (!objectExportOffered) return; - const exportConfig = schema.exportOptions; + const exportConfig = exportOptions; const maxRecords = exportConfig?.maxRecords || 0; const includeHeaders = exportConfig?.includeHeaders !== false; // Download filename: `<配置前缀|对象中文标签|API名>-<视图名>-<日期时间>.`, @@ -2343,7 +2368,7 @@ export const ObjectGrid: React.FC = ({ downloadFile(new Blob([JSON.stringify(unmasked, null, 2)], { type: 'application/json' }), fileNameFor('json')); } setShowExport(false); - }, [data, schema.exportOptions, schema.operations?.export, objectExportOffered, schema.objectName, objectName, objectSchema, objectFields, objectTypesPending, generateColumns, dataSource, hasInlineData, schemaFilter, schemaSort, t]); + }, [data, exportOptions, schema.operations?.export, objectExportOffered, schema.objectName, objectName, objectSchema, objectFields, objectTypesPending, generateColumns, dataSource, hasInlineData, schemaFilter, schemaSort, t]); // objectui#9050 step 2 — a refused filter: `schema.filter` (a render-time // `useMemo`, which would otherwise have thrown out of render), or a @@ -4877,13 +4902,15 @@ export const ObjectGrid: React.FC = ({ // key the save gate refuses. Pinned by // `__tests__/gridNonAuthorKeys.test.tsx`. const showRowHeightToggle = schema.rowHeight !== undefined && !(schema as any).hideRowHeightToggle; - // Export is offered only when configured AND not blocked: by the view's + // Export is offered only when configured AND not blocked: configured is the + // declared block or, over an object, the default one (objectstack#39475, + // `exportOptions` above); blocked is by the view's // `operations.export`, or by the object's resolved export verdict // (`objectExportOffered`: `userActions.exportCsv` over the bucket default, // ANDed with the server's effective API operation set, objectstack#3391 / // objectstack#35619). Missing set → the object's own verdict alone. const exportEnabled = - !!schema.exportOptions && + !!exportOptions && exportableFormats.length > 0 && schema.operations?.export !== false && objectExportOffered; diff --git a/ui/packages/plugin-grid/src/__tests__/exportGate.test.tsx b/ui/packages/plugin-grid/src/__tests__/exportGate.test.tsx index 2a6c0b7e9d0..5a1edb4c353 100644 --- a/ui/packages/plugin-grid/src/__tests__/exportGate.test.tsx +++ b/ui/packages/plugin-grid/src/__tests__/exportGate.test.tsx @@ -12,6 +12,7 @@ import React from 'react'; import { ObjectGrid } from '../ObjectGrid'; import { registerAllFields } from '@object-ui/fields'; import { ActionProvider } from '@object-ui/react'; +import { MePermissionsProvider, type MePermissionsAuthenticatedResponse } from '@object-ui/permissions'; registerAllFields(); @@ -89,3 +90,87 @@ describe('ObjectGrid export dead formats', () => { expect(screen.queryAllByRole('button', { name: /export/i }).length).toBe(0); }); }); + +/** + * objectstack#39475 — the grid half of the list ruling (option A): a grid over + * an object that declares no `exportOptions` reads the absent block as the + * default one, as `plugin-list`'s list view does — the default formats, `csv` + * and `json`. The author-placed object table therefore offers Export unasked. + * Who may export does not move: the server folds the caller's `allowExport` + * grant into the object's effective `export` operation (`/me/permissions` + * `apiOperations`), so a caller served no `export` sees no Export entry. A + * platform screen that composes a grid turns it off with + * `exportOptions: { formats: [] }` on the node it builds; a grid that names no + * object stays explicit-only. + */ +describe('ObjectGrid.exportDefaultOn-39475', () => { + const OBJECT = 'test_object'; + + const session = (apiOperations: string[]): MePermissionsAuthenticatedResponse => ({ + authenticated: true, + userId: 'u1', + tenantId: null, + hasAnyQueue: false, + objectsUsingQueues: [], + positions: ['member'], + permissionSets: ['member'], + objects: { [OBJECT]: { allowRead: true, apiOperations } as never }, + fields: {}, + }); + + /** An author-placed table: an object, inline rows, no `exportOptions`. */ + function renderTable(opts: { schema?: Record; apiOperations?: string[] } = {}) { + const schema: any = { + type: 'object-grid', + objectName: OBJECT, + columns: [{ field: 'name', label: 'Name' }], + data: { provider: 'value', items: data }, + ...opts.schema, + }; + let tree = ( + + + + ); + if (opts.apiOperations) { + tree = {tree}; + } + return render(tree); + } + + const exportButton = () => screen.queryByRole('button', { name: /^export$/i }); + + it('THE CHANGE — an object table that declares no exportOptions draws Export and offers csv and json', async () => { + renderTable(); + fireEvent.click(screen.getByRole('button', { name: /^export$/i })); + expect(await screen.findByRole('button', { name: /export as csv/i })).toBeInTheDocument(); + expect(screen.getByRole('button', { name: /export as json/i })).toBeInTheDocument(); + expect(screen.queryByRole('button', { name: /export as xlsx/i })).toBeNull(); + }); + + it('THE CHANGE — a caller the server serves `export` (the `allowExport` grant) sees Export on the undeclared table', () => { + renderTable({ apiOperations: ['get', 'list', 'aggregate', 'search', 'export'] }); + expect(exportButton()).toBeInTheDocument(); + }); + + it('a caller the server serves no `export` (no `allowExport` grant) sees no Export on the undeclared table', () => { + renderTable({ apiOperations: ['get', 'list', 'aggregate', 'search'] }); + expect(exportButton()).toBeNull(); + }); + + it('a platform host that writes `exportOptions: { formats: [] }` shows no Export', () => { + renderTable({ schema: { exportOptions: { formats: [] } } }); + expect(exportButton()).toBeNull(); + }); + + it('a grid that names no object stays explicit-only: no block, no Export', () => { + renderTable({ schema: { objectName: undefined } }); + expect(screen.getByText('Alice')).toBeInTheDocument(); + expect(exportButton()).toBeNull(); + }); + + it('CONTROL — the same object-less grid declaring the block draws Export', () => { + renderTable({ schema: { objectName: undefined, exportOptions: { formats: ['csv'] } } }); + expect(exportButton()).toBeInTheDocument(); + }); +}); diff --git a/ui/packages/plugin-list/src/ListView.tsx b/ui/packages/plugin-list/src/ListView.tsx index 357577f323e..7795d1b3d69 100644 --- a/ui/packages/plugin-list/src/ListView.tsx +++ b/ui/packages/plugin-list/src/ListView.tsx @@ -5649,6 +5649,10 @@ export const ListView = React.forwardRef(({ // does not opt out (`inlineEditOffered`); objectstack#35684 retired // the mode that used to gate this as well. editable: inlineEditOffered, + // objectstack#39475 — a grid over an object offers export unasked; + // this list's own toolbar, Display panel and page bar are the one + // export door (`resolvedExportOptions`), so the grid draws none. + exportOptions: { formats: [] }, // objectstack#35702 — the resident footer row (the record count in // its first cell, so the list draws no count bar of its own), and, // for a reader who may change the view, each cell's calculation menu. From 6578e914958fad777dd57e5974f7eeb8758697a2 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 07:00:59 +0000 Subject: [PATCH 08/13] test: pin the default-on object grid export and each platform host's export-off grid Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_016WV4d1cnRvyiAqrarmDhZV --- .../DevRowActions.exportOff-39475.test.tsx | 22 +++++++++++++++++++ .../metadata-admin/metadataListGrid.test.ts | 14 ++++++++++++ ...ldDesigner.systemFieldDelete-8674.test.tsx | 15 +++++++++++++ ...ctManager.systemObjectDelete-9219.test.tsx | 14 ++++++++++++ ...elatedList.enlargedListGrid-28865.test.tsx | 16 ++++++++++++++ .../src/__tests__/ListView.harness.test.tsx | 12 ++++++++++ 6 files changed, 93 insertions(+) create mode 100644 ui/apps/console/src/dev/DevRowActions.exportOff-39475.test.tsx diff --git a/ui/apps/console/src/dev/DevRowActions.exportOff-39475.test.tsx b/ui/apps/console/src/dev/DevRowActions.exportOff-39475.test.tsx new file mode 100644 index 00000000000..fac185fc030 --- /dev/null +++ b/ui/apps/console/src/dev/DevRowActions.exportOff-39475.test.tsx @@ -0,0 +1,22 @@ +/** + * objectstack#39475 — a grid over an object offers Export unasked. The dev + * row-action page composes three object grids to pin row actions only, so the + * node it builds declares `exportOptions: { formats: [] }` and none of them + * draws an Export entry. The rows are read first, so the absence is of drawn + * grids. + */ +import React from 'react'; +import { describe, it, expect } from 'vitest'; +import { render, screen } from '@testing-library/react'; +import '@testing-library/jest-dom'; + +import { DevRowActions } from './DevRowActions'; + +describe('DevRowActions.exportOff-39475', () => { + it('none of the dev page grids draws an Export entry', () => { + render(); + expect(screen.getByTestId('grid-default')).toHaveTextContent('hotcrm-fix-verify'); + expect(screen.getByTestId('grid-wide')).toHaveTextContent('hotcrm-fix-verify'); + expect(screen.queryAllByRole('button', { name: /^export$/i })).toHaveLength(0); + }); +}); diff --git a/ui/packages/app-shell/src/views/metadata-admin/metadataListGrid.test.ts b/ui/packages/app-shell/src/views/metadata-admin/metadataListGrid.test.ts index 971e473bdfd..ca99271096d 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/metadataListGrid.test.ts +++ b/ui/packages/app-shell/src/views/metadata-admin/metadataListGrid.test.ts @@ -82,3 +82,17 @@ describe('metadataListGrid (objectstack#36897)', () => { expect(pageWindow([], 3, 50)).toEqual({ page: 1, rows: [] }); }); }); + +/** + * objectstack#39475 — a grid over an object offers Export unasked; a Studio + * metadata list is a platform screen, so the node it builds declares no + * export format and the grid draws no Export (`plugin-grid`'s + * `ObjectGrid.exportDefaultOn-39475` pins what `formats: []` draws). + */ +describe('metadataListGrid.exportOff-39475', () => { + it('the metadata list grid node declares exportOptions with no formats', () => { + const g = metadataListGridSchema('flow', COLUMNS, sortKeyOf, 50) as any; + expect(g.objectName).toBe('metadata_list_flow'); + expect(g.exportOptions).toEqual({ formats: [] }); + }); +}); diff --git a/ui/packages/plugin-designer/src/__tests__/FieldDesigner.systemFieldDelete-8674.test.tsx b/ui/packages/plugin-designer/src/__tests__/FieldDesigner.systemFieldDelete-8674.test.tsx index 2db3d95330d..4c39931dc25 100644 --- a/ui/packages/plugin-designer/src/__tests__/FieldDesigner.systemFieldDelete-8674.test.tsx +++ b/ui/packages/plugin-designer/src/__tests__/FieldDesigner.systemFieldDelete-8674.test.tsx @@ -149,3 +149,18 @@ describe('objectui#8674 · the system field draws no delete action', () => { expect(await rowKebab(CUSTOM.name)).toEqual({ edit: false, delete: false, trigger: false }); }); }); + +/** + * objectstack#39475 — a grid over an object offers Export unasked; the field + * designer is a platform screen, so its grid node declares + * `exportOptions: { formats: [] }` and the real grid draws no Export. The rows + * are read first, so the absence is of a drawn grid. + */ +describe('FieldDesigner.gridExportOff-39475', () => { + it('the field designer grid draws no Export entry', async () => { + renderDesigner(); + await settle(); + expect(screen.getByText(CUSTOM.name)).toBeInTheDocument(); + expect(screen.queryByRole('button', { name: /^export$/i })).toBeNull(); + }); +}); diff --git a/ui/packages/plugin-designer/src/__tests__/ObjectManager.systemObjectDelete-9219.test.tsx b/ui/packages/plugin-designer/src/__tests__/ObjectManager.systemObjectDelete-9219.test.tsx index 0cf3dbf7acc..cf8591e1dcf 100644 --- a/ui/packages/plugin-designer/src/__tests__/ObjectManager.systemObjectDelete-9219.test.tsx +++ b/ui/packages/plugin-designer/src/__tests__/ObjectManager.systemObjectDelete-9219.test.tsx @@ -181,3 +181,17 @@ describe('objectui#9219 · the system object draws no delete action', () => { expect(await rowKebab(CUSTOM.name)).toEqual({ edit: false, delete: false, trigger: false }); }); }); + +/** + * objectstack#39475 — a grid over an object offers Export unasked; the object + * manager is a platform screen, so its grid node declares + * `exportOptions: { formats: [] }` and the real grid draws no Export. The rows + * are read first, so the absence is of a drawn grid. + */ +describe('ObjectManager.gridExportOff-39475', () => { + it('the object manager grid draws no Export entry', async () => { + renderManager(); + await waitFor(() => expect(screen.getByText(CUSTOM.name)).toBeInTheDocument()); + expect(screen.queryByRole('button', { name: /^export$/i })).toBeNull(); + }); +}); diff --git a/ui/packages/plugin-detail/src/__tests__/RelatedList.enlargedListGrid-28865.test.tsx b/ui/packages/plugin-detail/src/__tests__/RelatedList.enlargedListGrid-28865.test.tsx index 98848f5bf0b..423511bd1ff 100644 --- a/ui/packages/plugin-detail/src/__tests__/RelatedList.enlargedListGrid-28865.test.tsx +++ b/ui/packages/plugin-detail/src/__tests__/RelatedList.enlargedListGrid-28865.test.tsx @@ -425,3 +425,19 @@ describe('the related table leads with the record name when no columns are decla expect(h.schema.columns).toEqual(['code', 'amount']); }); }); + +/** + * objectstack#39475 — a grid over an object offers Export unasked; the + * enlarged related tab keeps its export door in its own toolbar, so the grid + * node it builds declares no export format and the grid draws no second + * Export (`plugin-grid`'s `ObjectGrid.exportDefaultOn-39475` pins what + * `formats: []` draws). + */ +describe('RelatedList.enlargedGridExportOff-39475', () => { + it('the enlarged tab hands object-grid exportOptions with no formats', async () => { + renderList(); + await waitFor(() => expect(h.schema?.type).toBe('object-grid')); + expect(h.schema.objectName).toBe('opportunity'); + expect(h.schema.exportOptions).toEqual({ formats: [] }); + }); +}); diff --git a/ui/packages/plugin-list/src/__tests__/ListView.harness.test.tsx b/ui/packages/plugin-list/src/__tests__/ListView.harness.test.tsx index e5cc524ce78..8082d1213c4 100644 --- a/ui/packages/plugin-list/src/__tests__/ListView.harness.test.tsx +++ b/ui/packages/plugin-list/src/__tests__/ListView.harness.test.tsx @@ -2853,6 +2853,18 @@ describe('ListView.exportDefaultOn-39475', () => { await renderList({ compactToolbar: true, exportOptions: { formats: ['xlsx'] } }); expect(displayExportEntries()).toEqual(['display-export-xlsx']); }); + + // The grid half (`plugin-grid`, ObjectGrid.exportDefaultOn-39475): a grid + // over an object offers Export unasked, so the list page's grid child is + // handed `exportOptions: { formats: [] }` — the list's own toolbar, Display + // panel and page bar stay the one export door. With the compact toolbar the + // list draws no Export button of its own, so a drawn one is the grid's. + it('the grid child draws no Export of its own: the list keeps the one export door', async () => { + await renderList({ compactToolbar: true }); + await waitFor(() => expect(screen.getByText('Acme')).toBeInTheDocument()); + expect(wideExport()).toBeNull(); + expect(displayExportEntries()).toEqual(['display-export-csv', 'display-export-json']); + }); }); // ── ListView.toolbarTrailingExportDoor-36113 ──────────────────────────────────── From ea034b3fff05fe56195fdbb69b601c4dc165cdcc Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 07:23:08 +0000 Subject: [PATCH 09/13] docs(changeset): the object grid offers export unasked; platform grids declare none Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_016WV4d1cnRvyiAqrarmDhZV --- .../39475-object-grid-export-on-by-default.md | 18 ++++++++++++++++++ .../dev/DevRowActions.exportOff-39475.test.tsx | 1 - 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 .changeset/39475-object-grid-export-on-by-default.md diff --git a/.changeset/39475-object-grid-export-on-by-default.md b/.changeset/39475-object-grid-export-on-by-default.md new file mode 100644 index 00000000000..c8f3b2b17f9 --- /dev/null +++ b/.changeset/39475-object-grid-export-on-by-default.md @@ -0,0 +1,18 @@ +--- +'@object-ui/plugin-grid': minor +'@object-ui/plugin-list': patch +'@object-ui/plugin-detail': patch +'@object-ui/plugin-designer': patch +'@object-ui/console': patch +--- + +feat(plugin-grid): an object table that declares no `exportOptions` offers export + +Clause-②: no +Metadata-protocol: semantic + +An `object-grid` used to draw its Export menu only when it declared `exportOptions`. A grid over an object now reads an absent `exportOptions` the way a list view does: as the empty block, offering the default formats, `csv` and `json`. `xlsx` is offered where the grid lists it in `formats` and the server stream delivers it, as before. A declared block behaves as before, and a grid that names no object still offers export only when it declares the block. + +Who may export is unchanged. The permission set's `allowExport` grant reaches the grid through the object's effective `export` operation: a user whose permission sets do not grant it sees no Export entry, and the server refuses the export request. To keep a table without export, declare `exportOptions: { formats: [] }` on it; to take export off every surface of an object, set the object's `userActions.exportCsv: false`. + +The platform's own screens that compose a grid declare `exportOptions: { formats: [] }` on the grid they build, so none gains an Export entry: the list page's grid (whose list toolbar keeps the one export door), the enlarged related list tab, the Studio metadata lists, the object manager, the field designer and the console's row-action dev page. diff --git a/ui/apps/console/src/dev/DevRowActions.exportOff-39475.test.tsx b/ui/apps/console/src/dev/DevRowActions.exportOff-39475.test.tsx index fac185fc030..908d629d07e 100644 --- a/ui/apps/console/src/dev/DevRowActions.exportOff-39475.test.tsx +++ b/ui/apps/console/src/dev/DevRowActions.exportOff-39475.test.tsx @@ -5,7 +5,6 @@ * draws an Export entry. The rows are read first, so the absence is of drawn * grids. */ -import React from 'react'; import { describe, it, expect } from 'vitest'; import { render, screen } from '@testing-library/react'; import '@testing-library/jest-dom'; From 408528039b40a53c7511d5dd3cd17c8be2112355 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 08:26:16 +0000 Subject: [PATCH 10/13] fix(plugin-grid): read the resolved export block directly, so the exportOptions key scan still sees every read Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_016WV4d1cnRvyiAqrarmDhZV --- ui/packages/plugin-grid/src/ObjectGrid.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ui/packages/plugin-grid/src/ObjectGrid.tsx b/ui/packages/plugin-grid/src/ObjectGrid.tsx index b55ee26660d..f252519a5b1 100644 --- a/ui/packages/plugin-grid/src/ObjectGrid.tsx +++ b/ui/packages/plugin-grid/src/ObjectGrid.tsx @@ -2208,8 +2208,10 @@ export const ObjectGrid: React.FC = ({ // (`UNDECLARED_EXPORT_OPTIONS`). A grid that names no object stays // explicit-only. Platform hosts that must not offer export write // `exportOptions: { formats: [] }` on the node they build. - const exportOptions: ListViewExportOptions | undefined = - schema.exportOptions ?? (objectName ? UNDECLARED_EXPORT_OPTIONS : undefined); + // Bound WITHOUT a type annotation and read directly (no second alias): + // `ObjectGrid.exportOptionsKeys.test.ts` follows `const NAME = + // schema.exportOptions` as an alias of the block, one level deep. + const exportOptions = schema.exportOptions ?? (objectName ? UNDECLARED_EXPORT_OPTIONS : undefined); const exportableFormats = useMemo(() => { const declared = exportOptions?.formats || ['csv', 'json']; const serverAvailable = typeof dataSource?.exportDownload === 'function' @@ -2237,15 +2239,14 @@ export const ObjectGrid: React.FC = ({ // object's own verdict alone. if (schema.operations?.export === false) return; if (!objectExportOffered) return; - const exportConfig = exportOptions; - const maxRecords = exportConfig?.maxRecords || 0; - const includeHeaders = exportConfig?.includeHeaders !== false; + const maxRecords = exportOptions?.maxRecords || 0; + const includeHeaders = exportOptions?.includeHeaders !== false; // Download filename: `<配置前缀|对象中文标签|API名>-<视图名>-<日期时间>.`, // e.g. `合同-进行中-20260714-153045.xlsx`. The translated object label (when // the schema has loaded) beats the raw API name; a configured // exportOptions.fileNamePrefix beats both (and suppresses the view label). const fileNameFor = (ext: string) => buildExportFileName(ext, { - prefix: exportConfig?.fileNamePrefix, + prefix: exportOptions?.fileNamePrefix, label: objectSchema?.label, objectName: objectName || schema.objectName, // `title` is the deprecated spelling of `label` and takes the same door: @@ -2264,7 +2265,7 @@ export const ObjectGrid: React.FC = ({ && !!objectName && !hasInlineData // Honor an opt-out: schema.exportOptions.streaming === false forces client-side. - && exportConfig?.streaming !== false; + && exportOptions?.streaming !== false; if (serverEligible) { const cols = generateColumns().filter((c) => c.accessorKey !== '_actions'); From bd9276cc60be009b1c64ef6a9e89792de352487c Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 08:53:12 +0000 Subject: [PATCH 11/13] docs(changeset): the list-half note says an object grid now offers export by default too Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_016WV4d1cnRvyiAqrarmDhZV --- .changeset/39475-list-view-export-on-by-default.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/39475-list-view-export-on-by-default.md b/.changeset/39475-list-view-export-on-by-default.md index 9f684460494..75b340f119e 100644 --- a/.changeset/39475-list-view-export-on-by-default.md +++ b/.changeset/39475-list-view-export-on-by-default.md @@ -14,6 +14,6 @@ Who may export is unchanged. The permission set's `allowExport` grant reaches th To keep a view without export, declare `exportOptions: { formats: [] }` on it. To take export off every view of an object, set the object's `userActions.exportCsv: false`. -An `object-grid` page component is not changed: it still offers export only when it declares `exportOptions`. +An `object-grid` page component that names an object reads an absent `exportOptions` the same way: it offers `csv` and `json` by default, and `xlsx` only where it lists it in `formats`. Declare `exportOptions: { formats: [] }` on it to turn its export off. The upgrade guide carries the change as the semantic entry `list-view-export-on-by-default`. From 8f4c9a00bdde2f4b900c8e37fba7faa02aae153b Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 09:29:14 +0000 Subject: [PATCH 12/13] docs(plugin-grid): the object-grid exportOptions description says what an absent block offers Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_016WV4d1cnRvyiAqrarmDhZV --- ui/packages/plugin-grid/src/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/packages/plugin-grid/src/index.tsx b/ui/packages/plugin-grid/src/index.tsx index 4a815f79055..115ff6249ca 100644 --- a/ui/packages/plugin-grid/src/index.tsx +++ b/ui/packages/plugin-grid/src/index.tsx @@ -372,7 +372,7 @@ const GRID_QUERY_INPUTS: ComponentInput[] = [ { name: 'keyboardNavigation', type: 'boolean', description: 'Arrow-key cell navigation on the WAI-ARIA grid pattern: the grid\'s data cells take one place in the Tab order instead of one each (a link or button inside a cell keeps its own), and the arrow keys move focus between them (Home / End to the ends of the row, Ctrl+Home / Ctrl+End to the ends of the page). Enter still opens an editable cell, and an edit ended with Enter or Escape returns focus to its cell. Always on when the grid renders editable, because that grid selects a cell first and moves the selection with these keys; a read-only grid keeps every cell its own Tab stop unless this is `true`.' }, { name: 'navigation', type: 'object', description: 'What a row click does, `{ mode: "drawer" | "page" | "new_window" | "none", … }`; a block written without `mode` opens the drawer.' }, { name: 'operations', type: 'object', description: 'Toggles for the built-in affordances, `{ create, update, delete, export }`, e.g. `{ delete: false }`. A declared block replaces the default, so an `update` / `delete` it does not name is withheld.' }, - { name: 'exportOptions', type: 'object', description: 'Export config, `{ formats, maxRecords, includeHeaders, fileNamePrefix, streaming }`. `streaming` (default true) picks server-side streaming vs browser-side assembly for the export — a behaviour fork, not decoration; set it to `false` to force browser-side assembly. Needs `operations.export` to be reachable from the toolbar.' }, + { name: 'exportOptions', type: 'object', description: 'Export config, `{ formats, maxRecords, includeHeaders, fileNamePrefix, streaming }`. `streaming` (default true) picks server-side streaming vs browser-side assembly for the export — a behaviour fork, not decoration; set it to `false` to force browser-side assembly. On a grid that names an object, an absent block offers the default formats, `csv` and `json` (`xlsx` only where `formats` lists it); `formats: []` turns the export off, and a grid that names no object offers export only when it declares the block. Who may export is still the object\'s export verdict (the `allowExport` grant, through the effective `export` operation, and `userActions.exportCsv`). `operations.export: false` withholds every export entry; `operations.export: true` additionally draws the table\'s own CSV button.' }, ]; ComponentRegistry.register('object-grid', ObjectGridRenderer, { From 9384eec1bac93a4d17138c8509b935fa9f020505 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 09:32:23 +0000 Subject: [PATCH 13/13] chore(sdui): regenerate the manifest and reference page for the object-grid exportOptions description Co-authored-by: Claude Claude-Session: https://claude.ai/code/session_016WV4d1cnRvyiAqrarmDhZV --- content/docs/ui/components/plugins.mdx | 2 +- scripts/sdui-manifest.record.json | 2 +- sdui.manifest.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/content/docs/ui/components/plugins.mdx b/content/docs/ui/components/plugins.mdx index 0e0d135f8cd..efefceeeaa7 100644 --- a/content/docs/ui/components/plugins.mdx +++ b/content/docs/ui/components/plugins.mdx @@ -247,7 +247,7 @@ Namespace `plugin-grid`. | `keyboardNavigation` | `boolean` | | Arrow-key cell navigation on the WAI-ARIA grid pattern: the grid's data cells take one place in the Tab order instead of one each (a link or button inside a cell keeps its own), and the arrow keys move focus between them (Home / End to the ends of the row, Ctrl+Home / Ctrl+End to the ends of the page). Enter still opens an editable cell, and an edit ended with Enter or Escape returns focus to its cell. Always on when the grid renders editable, because that grid selects a cell first and moves the selection with these keys; a read-only grid keeps every cell its own Tab stop unless this is `true`. | | `navigation` | `object` | | What a row click does, `{ mode: "drawer" \| "page" \| "new_window" \| "none", … }`; a block written without `mode` opens the drawer. | | `operations` | `object` | | Toggles for the built-in affordances, `{ create, update, delete, export }`, e.g. `{ delete: false }`. A declared block replaces the default, so an `update` / `delete` it does not name is withheld. | -| `exportOptions` | `object` | | Export config, `{ formats, maxRecords, includeHeaders, fileNamePrefix, streaming }`. `streaming` (default true) picks server-side streaming vs browser-side assembly for the export — a behaviour fork, not decoration; set it to `false` to force browser-side assembly. Needs `operations.export` to be reachable from the toolbar. | +| `exportOptions` | `object` | | Export config, `{ formats, maxRecords, includeHeaders, fileNamePrefix, streaming }`. `streaming` (default true) picks server-side streaming vs browser-side assembly for the export — a behaviour fork, not decoration; set it to `false` to force browser-side assembly. On a grid that names an object, an absent block offers the default formats, `csv` and `json` (`xlsx` only where `formats` lists it); `formats: []` turns the export off, and a grid that names no object offers export only when it declares the block. Who may export is still the object's export verdict (the `allowExport` grant, through the effective `export` operation, and `userActions.exportCsv`). `operations.export: false` withholds every export entry; `operations.export: true` additionally draws the table's own CSV button. | | `dataSource` | `object` (`object` data binding) | | Per-element data binding: \{ object, view, filter, sort, limit \}. Overrides the page-level object context for this block; `view` names a saved view of `object`, and `filter` is ANDed with the view’s own rather than replacing it. | ## `object-kanban` [#object-kanban] diff --git a/scripts/sdui-manifest.record.json b/scripts/sdui-manifest.record.json index 1507e4cfe2f..34dae08414a 100644 --- a/scripts/sdui-manifest.record.json +++ b/scripts/sdui-manifest.record.json @@ -14,7 +14,7 @@ "source": "built-tree", "generator": "scripts/gen-sdui-manifest-node.mjs", "generatedAt": "2026-12-04", - "sha256": "2763ba89195a8b4b3ef121df0f853449645595d77ee9c350490c0bbf0ba07e7e", + "sha256": "5cdb212da496eef4cfc65bf4751871edbd80519986abfd039c759c77366a80e8", "components": 106, "inTree": { "modulesRoot": "ui/apps/console", diff --git a/sdui.manifest.json b/sdui.manifest.json index 44f30ace476..1bed055ac2f 100644 --- a/sdui.manifest.json +++ b/sdui.manifest.json @@ -161,7 +161,7 @@ { "name": "exportOptions", "type": "object", - "description": "Export config, `{ formats, maxRecords, includeHeaders, fileNamePrefix, streaming }`. `streaming` (default true) picks server-side streaming vs browser-side assembly for the export — a behaviour fork, not decoration; set it to `false` to force browser-side assembly. Needs `operations.export` to be reachable from the toolbar." + "description": "Export config, `{ formats, maxRecords, includeHeaders, fileNamePrefix, streaming }`. `streaming` (default true) picks server-side streaming vs browser-side assembly for the export — a behaviour fork, not decoration; set it to `false` to force browser-side assembly. On a grid that names an object, an absent block offers the default formats, `csv` and `json` (`xlsx` only where `formats` lists it); `formats: []` turns the export off, and a grid that names no object offers export only when it declares the block. Who may export is still the object's export verdict (the `allowExport` grant, through the effective `export` operation, and `userActions.exportCsv`). `operations.export: false` withholds every export entry; `operations.export: true` additionally draws the table's own CSV button." }, { "name": "dataSource",