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..2e0c47c73d9 --- /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', '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'], 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 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", 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 }; 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(); 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.' }, {