@antelopejs/interface-dms 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +70 -68
  3. package/dist/auth/db/models/sessions.model.d.ts +1 -0
  4. package/dist/auth/db/models/userExternalIdentities.model.d.ts +1 -0
  5. package/dist/auth/db/models/users.model.d.ts +1 -0
  6. package/dist/base/block-types.d.ts +1 -0
  7. package/dist/base/block-types.js +1 -0
  8. package/dist/base/block-types.js.map +1 -1
  9. package/dist/base/live-toggle.d.ts +2 -2
  10. package/dist/base/period-selector.d.ts +2 -2
  11. package/dist/base/table-view/schema.d.ts +4 -4
  12. package/dist/db/internal/exportJobs.model.d.ts +1 -0
  13. package/dist/db/internal/inviteResolutions.model.d.ts +1 -0
  14. package/dist/db/internal/tenantLifecycle.model.d.ts +1 -0
  15. package/dist/db/models/roles.model.d.ts +1 -0
  16. package/dist/db/models/tenantMembers.model.d.ts +1 -0
  17. package/dist/db/models/tenants.model.d.ts +1 -0
  18. package/dist/db/models/user_invites.model.d.ts +1 -0
  19. package/docs/.navigation.yml +2 -0
  20. package/docs/1.core/.navigation.yml +2 -0
  21. package/docs/1.core/1.introduction.md +169 -0
  22. package/docs/1.core/10.layout-banners.md +133 -0
  23. package/docs/1.core/2.pages-and-modules.md +647 -0
  24. package/docs/1.core/3.components.md +287 -0
  25. package/docs/1.core/4.permissions.md +279 -0
  26. package/docs/1.core/5.tenancy.md +356 -0
  27. package/docs/1.core/6.invites.md +239 -0
  28. package/docs/1.core/7.hooks.md +354 -0
  29. package/docs/1.core/8.realtime.md +147 -0
  30. package/docs/1.core/9.quick-actions.md +115 -0
  31. package/docs/2.auth/.navigation.yml +2 -0
  32. package/docs/2.auth/1.introduction.md +75 -0
  33. package/docs/2.auth/2.authentication.md +222 -0
  34. package/docs/2.auth/3.tokens-and-sessions.md +352 -0
  35. package/docs/2.auth/4.users.md +256 -0
  36. package/docs/2.auth/5.external-identities.md +122 -0
  37. package/docs/3.base/.navigation.yml +2 -0
  38. package/docs/3.base/1.introduction.md +202 -0
  39. package/docs/3.base/10.display-blocks.md +136 -0
  40. package/docs/3.base/2.types.md +402 -0
  41. package/docs/3.base/3.forms.md +349 -0
  42. package/docs/3.base/4.tables.md +608 -0
  43. package/docs/3.base/5.charts-and-widgets.md +466 -0
  44. package/docs/3.base/6.layout.md +431 -0
  45. package/docs/3.base/8.data-types.md +361 -0
  46. package/docs/3.base/9.helpers.md +414 -0
  47. package/docs/4.notifications/.navigation.yml +2 -0
  48. package/docs/4.notifications/1.introduction.md +79 -0
  49. package/docs/4.notifications/2.categories-and-subjects.md +212 -0
  50. package/docs/4.notifications/3.sending.md +283 -0
  51. package/docs/5.html-render/.navigation.yml +2 -0
  52. package/docs/5.html-render/1.introduction.md +372 -0
  53. package/docs/5.html-render/2.built-in-emails.md +107 -0
  54. package/docs/index.md +100 -0
  55. package/docs/tsconfig.json +11 -0
  56. package/package.json +24 -18
@@ -0,0 +1,608 @@
1
+ ---
2
+ title: "Tables"
3
+ description: "TableView over a data controller: columns, routes, row actions, displays, filters and the forms it opens."
4
+ ---
5
+
6
+ # Tables
7
+
8
+ ## Overview
9
+
10
+ A table view is built from a data controller. You declare the controller's routes with `TableViewRoutes`, annotate its fields with `@Column`, and then call `TableView(controller, options)` to get the component. The builder reads the controller's data-api metadata — access modes, mandatory modes, listable flags, sortability — and combines it with the column options to produce the column list, the `new` / `edit` / `view` forms, and the set of permission-carrying actions.
11
+
12
+ Everything on this page is exported from the `table-view` module, reachable from the package root or from its own subpath:
13
+
14
+ ```typescript
15
+ import { Column, TableView, TableViewRoutes } from "@antelopejs/interface-dms/base";
16
+ ```
17
+
18
+ Or import directly from the table-view subpath:
19
+
20
+ ```typescript
21
+ import { Column, TableView } from "@antelopejs/interface-dms/base/table-view";
22
+ ```
23
+
24
+ ## Declare the Data Controller
25
+
26
+ `TableViewRoutes.All` is the route set a table view expects. Field decorators from `@antelopejs/interface-data-api/metadata` stay exactly as they are on any data controller; `@Column` is added on top of them.
27
+
28
+ ```typescript
29
+ import { Controller } from "@antelopejs/interface-api";
30
+ import {
31
+ DataController,
32
+ RegisterDataController,
33
+ } from "@antelopejs/interface-data-api";
34
+ import {
35
+ Access,
36
+ AccessMode,
37
+ Listable,
38
+ Mandatory,
39
+ ModelReference,
40
+ Sortable,
41
+ } from "@antelopejs/interface-data-api/metadata";
42
+ import { Model } from "@antelopejs/interface-database-decorators";
43
+ import {
44
+ Column,
45
+ Exported,
46
+ Searchable,
47
+ Select,
48
+ TableViewRoutes,
49
+ } from "@antelopejs/interface-dms/base";
50
+ import { DefaultDataTypes } from "@antelopejs/interface-dms/base/data-types";
51
+ import { ReadonlyBehaviorType } from "@antelopejs/interface-dms/base/types";
52
+ import { Role, RoleModel } from "./db";
53
+
54
+ @RegisterDataController()
55
+ export class roleDataAPI extends DataController(
56
+ Role,
57
+ TableViewRoutes.All,
58
+ Controller("/api/tables/roles"),
59
+ ) {
60
+ @ModelReference()
61
+ @Model(RoleModel)
62
+ declare model: RoleModel;
63
+
64
+ @Select()
65
+ @Listable()
66
+ @Exported()
67
+ @Access(AccessMode.ReadOnly)
68
+ declare _id: string;
69
+
70
+ @Select()
71
+ @Listable()
72
+ @Searchable()
73
+ @Exported()
74
+ @Column({
75
+ name: "Name",
76
+ type: new DefaultDataTypes.StringType({ placeholder: "Role name" }),
77
+ filterable: true,
78
+ })
79
+ @Mandatory("new", "edit")
80
+ @Sortable()
81
+ @Access(AccessMode.ReadWrite)
82
+ declare name: string;
83
+
84
+ @Exported()
85
+ @Column({
86
+ name: "Created at",
87
+ type: new DefaultDataTypes.DateType(),
88
+ readonlyBehavior: {
89
+ new: ReadonlyBehaviorType.hidden,
90
+ edit: ReadonlyBehaviorType.disabled,
91
+ view: ReadonlyBehaviorType.disabled,
92
+ },
93
+ })
94
+ @Access(AccessMode.ReadOnly)
95
+ declare createdAt: Date;
96
+ }
97
+ ```
98
+
99
+ ### TableViewRoutes
100
+
101
+ | Route | Endpoint role |
102
+ | --- | --- |
103
+ | `Get` | Read one row. |
104
+ | `List` | Paginated list with search, filters and sorting. |
105
+ | `Select` | List with the `select` pluck mode, used by relation pickers. |
106
+ | `Count` | Row count for the current query. |
107
+ | `CountBatch` | One count per query, in a single `POST /count/batch` (tab, view and group counters). |
108
+ | `Summary` | `GET /summary?ids=…`: the footer summaries a table view declared, over every row the request's filters list. |
109
+ | `New` | Create a row. |
110
+ | `Edit` | Update a row. |
111
+ | `Delete` | Delete rows. |
112
+ | `Archive` | Set the archive field on rows. |
113
+ | `Restore` | Clear the archive field on rows. |
114
+ | `ExportRoutes` | A record with `exportStart` (`/export/start`), `exportStatus` (`/export/status/:exportId`) and `exportDownload` (`/export/download/:exportId`). |
115
+ | `All` | Every route above, spread into one object. |
116
+
117
+ These are not the plain data-api defaults. Every route asserts tenant access and the action's permission; the mutating ones additionally run the matching guard and publish the mutation to the table's realtime topic, and `Edit`, `Delete`, `Archive` and `Restore` also validate the affected rows against the action's rule. `New` and `Edit` promote staged file uploads before writing, and `Edit` and `Delete` remove the files a row no longer references afterwards. Passing a narrower set than `All` removes the corresponding capabilities — the export action, for instance, is only offered when all three `ExportRoutes` endpoints are registered.
118
+
119
+ `@Searchable` on the example's `name` field is what makes the list route's free-text search consider that column; it is documented in [Helpers](/docs/interfaces/base/helpers).
120
+
121
+ ## The Column Decorator
122
+
123
+ `@Column` is a method-and-property decorator. It records the column, and unless `validate` is `false` it registers a data-api `Validator` built from the data type's `getValidation()` schema (wrapped for localization when the underlying table field carries the `LocalizationModifier`). When `filterable` is set it registers the data type's `filter` implementation as the field's data-api `Filter`. Finally, if the data type defines `decorateField`, that hook runs — this is how a relation type installs its `Foreign` join.
124
+
125
+ | Option | Type | Description |
126
+ | --- | --- | --- |
127
+ | `name` | `string` | Column header, and the label of the generated form field. Required. |
128
+ | `type` | `DataType` | Data type instance. Required. |
129
+ | `description` | `string` | Description carried onto the generated form field. |
130
+ | `order` | `number` | Sort key among columns; missing values sort as `0`. |
131
+ | `isVisible` | `boolean` | Whether the column is shown by default. `false` hides it until the user picks it in the column menu. |
132
+ | `defaultValue` | `DefaultValue` | Default value for the column and the generated form field. |
133
+ | `readonlyBehavior` | `ReadonlyBehavior` | Per-mode behaviour for a read-only field; see [Shared Types](/docs/interfaces/base/types). |
134
+ | `validate` | `boolean` | Set to `false` to skip registering the validator. |
135
+ | `filterable` | `boolean` | Register the type's filter and allow column filtering. |
136
+ | `inputComponent` | `Component` | Overrides the input component the data type supplies. |
137
+ | `group` | `string` | Identifier of the `ColumnGroup` this column belongs to in the generated forms. |
138
+ | `cellWrap` | `boolean` | Wrap the grid cell without a line limit. |
139
+ | `size` | `number` | Default width of the grid column in px (150 when omitted). |
140
+ | `display` | `ColumnDisplay` | A display class instance (`new DefaultDisplays.IdentityDisplay({ … })`, or a module's own `@RegisterDisplay("<module>:<id>")` class) the grid cells (and expanded-row fields) render with, its options typed by the class. `type` keeps driving forms, filters, validation and exports; the formatter also receives the row. Serialized as `{ type, options? }`. |
141
+
142
+ A read-only field whose `readonlyBehavior` resolves to `hidden` for a mode is dropped from that mode's form; a field whose data type has no input component is dropped from every form.
143
+
144
+ ### Column Groups
145
+
146
+ `ColumnGroup(id, config)` is a class decorator on the data controller. Columns join a group by naming its `id` in `ColumnOptions.group`; the generated forms then render a `FieldGroup` in the position of the group's first column.
147
+
148
+ ```typescript
149
+ import { Column, ColumnGroup } from "@antelopejs/interface-dms/base/table-view";
150
+
151
+ @ColumnGroup("contact", { label: "Contact", orientation: "horizontal", order: 2 })
152
+ export class customerDataAPI extends DataController(/* … */) {
153
+ @Column({ name: "Email", type: new DefaultDataTypes.EmailType(), group: "contact" })
154
+ declare email: string;
155
+
156
+ @Column({ name: "Phone", type: new DefaultDataTypes.PhoneType(), group: "contact" })
157
+ declare phone: string;
158
+ }
159
+ ```
160
+
161
+ `ColumnGroupConfig` has `label: string` (required), `description?`, `orientation?: "horizontal" | "vertical"` and `order?: number`.
162
+
163
+ ### Select and Exported
164
+
165
+ `@Select(requiredFields?)` and `@Exported(requiredFields?)` mark a field as listable in the `select` and `export` pluck modes respectively. Both forward to `Listable` from `@antelopejs/interface-data-api/metadata` with the corresponding mode, and both accept the same `boolean | string[]` argument that `Listable` takes for dependent fields.
166
+
167
+ ### The Archive Field
168
+
169
+ `@ArchiveField` marks the boolean field that carries the archived state. It records the field on the table view metadata and also applies `Filter()` and `Listable()` to it, because archive filtering needs both.
170
+
171
+ ```typescript
172
+ import { ArchiveField } from "@antelopejs/interface-dms/base/table-view";
173
+
174
+ @ArchiveField()
175
+ @Access(AccessMode.ReadOnly)
176
+ declare archived: boolean;
177
+ ```
178
+
179
+ `DEFAULT_ROW_ID_FIELD` is the constant `"_id"` — the row identifier used when `TableViewOptions.rowIdKey` is not set.
180
+
181
+ ## Build the Table View
182
+
183
+ `TableView` returns a `ComponentBuilder<TableViewOptionsSerialized>`, assigned to a static field of a page class.
184
+
185
+ ```typescript
186
+ import {
187
+ PageController,
188
+ pagesCategory,
189
+ RegisterPage,
190
+ } from "@antelopejs/interface-dms/page";
191
+ import { TableView } from "@antelopejs/interface-dms/base";
192
+ import { roleDataAPI } from "./role-data-api";
193
+
194
+ @RegisterPage()
195
+ export class RolesPage extends PageController("roles", {
196
+ displayName: "Roles",
197
+ icon: "i-ph-shield-check",
198
+ category: pagesCategory,
199
+ }) {
200
+ static table = TableView(roleDataAPI, {
201
+ caption: "Roles",
202
+ labelKey: "name",
203
+ rowActions: {
204
+ add: true,
205
+ edit: true,
206
+ delete: true,
207
+ details: true,
208
+ hasSelection: true,
209
+ },
210
+ });
211
+ }
212
+ ```
213
+
214
+ ### Signature
215
+
216
+ ```typescript
217
+ function TableView<T extends ControllerClass>(
218
+ controller: T,
219
+ options?: TableViewOptions<InstanceType<T>>,
220
+ ): ComponentBuilder<TableViewOptionsSerialized>;
221
+ ```
222
+
223
+ Typing `TableViewOptions` by `InstanceType<T>` is what makes row-action rules field-name-checked against the controller's own fields.
224
+
225
+ ### TableViewOptions
226
+
227
+ | Option | Type | Description |
228
+ | --- | --- | --- |
229
+ | `caption` | `string` | Table caption; also the component's display name, defaulting to `"TableView"`. |
230
+ | `layout` | `TableViewLayout` | `"full"` (default): the dashboard grid; `"compact"`: the list of a settings page (tabs, open search, quick filters, the footer's page size picker; no caption, refresh, ⋯ menu nor column menus). Either way, search shows only with `@Searchable` fields, filters only with a `filterable` column, the caption only when `caption` is set. |
231
+ | `searchPlaceholder` | `string` | Placeholder of the search field, also its accessible name. |
232
+ | `searchShortcut` | `string` | Key opening and focusing the search, in Nuxt UI `defineShortcuts` notation (`"/"`, `"shift_f"`): `"shift_f"` (⇧F) by default. It does not fire while the user types in a field. |
233
+ | `quickFilters` | `TableViewQuickFilter[]` | `{ field, label?, icon?, allLabel?, mode? }` dropdown filters over a filterable column's values, `mode` a `TableViewQuickFilterMode`. The picked value is the column's own filter: kept with the table state, counted, cleared by "Clear filters"; in the `compact` layout the button reads "Role: Admin" with a clear button. Unknown or non-filterable columns throw. |
234
+ | `pageSize` | `number` | Rows per page while the user picked none (default 10), 1 to 50: registration throws above. A size other than 10, 25 and 50 joins them in the table's page size picker. |
235
+ | `pagination` | `TableViewPaginationMode` | `"pages"` (default): a pager; `"loadMore"`: a "Load more" button; `"infinite"`: the next page loads as the footer scrolls into view. The last two ask for every page loaded so far, from the first row, so a refresh re-reads them. |
236
+ | `footer` | `TableViewFooterOptions` | `{ countLabel?, hint?, summary?, legend? }`: the footer's row count (`$` key pluralized on `{ count }`) and hint; `summary` figures (`TableViewFooterSummary`: `label`, `field?`, `op: "sum" \| "count"`, `where?` row rule, `format?` `TableViewSummaryFormat`) computed by the `Summary` route over every listed row; `legend`, a `SelectType` column. Serialized as `TableViewFooterSerialized`: each summary gets an `id`, its `where` stays server-side (`TableViewMeta.footerSummary(id)`). A sum without `field`, an unknown column or a legend that is no select column throws. |
237
+ | `emptyStates` | `TableViewEmptyStates` | `{ firstRun?, filtered?, error? }`, each a `TableViewEmptyState` (`title`, `description?`, `icon?`, `actions?: BlockLinkAction[]`, `component?`) the empty body of the grid and the `cards` display shows instead of the built-in words, texts — keys and literals alike — receiving `{ search }`. A `component` receives `state`, `search`, `refresh()`, and `clearSearch()` / `clearFilters()` while there is a search or a filter chip to clear. |
238
+ | `expandable` | `TableViewExpandableOptions` | Expandable rows, a union: `{ fields, fieldsLabel? }` (column keys or `{ key, label? }`, each rendered by its column's data type) **or** `{ component }` (receives `TableViewExpandedRowProps`: `row`, `rowId`, `columns`, `labelKey`, `actions`, `open` and `refresh`, and draws the whole band), plus `defaultExpanded` (`"none"` \| `"first"` \| `"all"`), `single` and `lazyLoad` (read the row from `get` when it opens). Fields must name declared columns; both or neither throws. Serialized as `TableViewExpandableSerialized`. |
239
+ | `rowIdKey` | `string` | Field holding the row id. Defaults to `DEFAULT_ROW_ID_FIELD`. |
240
+ | `labelKey` | `string` | Field naming a row: it follows the drawer or modal title ("Edit task · Write the docs") and ends the breadcrumb of the edit and details pages (set on their forms as `labelKey`). |
241
+ | `rowActions` | `TableViewRowActionOptions<T>` | Built-in and custom row actions. |
242
+ | `columns` | `TableViewColumnsOptions` | The controller's columns as this table view shows them: `hidden` lists the ones it opens hidden, as `isVisible: false` does on the `@Column`, for this table view only (they stay in the column menu, filterable and in the forms). A name the controller has no column for throws at registration. |
243
+ | `customButtons` | `CustomButton[]` | Toolbar buttons; see [Shared Types](/docs/interfaces/base/types). |
244
+ | `formContainer` | `FormContainer` | Where the `new` / `edit` / `view` forms open. |
245
+ | `archiveMode` | `boolean` | Replace delete with archive/restore. Requires `@ArchiveField`. |
246
+ | `defaultFilters` | `Array<{ accessorKey: string; value?: string; mode: string }>` | Filters applied when the table opens. |
247
+ | `defaultSort` | `{ field: string; desc?: boolean }` | Sort applied when the viewer has no stored preference, and the one a cleared sort goes back to. |
248
+ | `pinnedRows` | `RowActionRule<T>` | Rows listed first whatever the sort, in the sort's order among themselves: within the list the route answers (a source without `paginate` answers every row, so its pinned rows open the first page; a paging route's open their page). The `grouped` display pins nothing; registration throws beside `reorder`. |
249
+ | `queryParamFilters` | `QueryParamFilters` | Maps URL query parameters onto hidden filters. |
250
+ | `routeParamFilters` | `RouteParamFilters` | Maps DMS route parameters onto hidden filters. |
251
+ | `strictRuleValidation` | `boolean` | Reject the whole request when any row fails rule validation, instead of processing only the eligible rows. |
252
+ | `tabs` | `TableViewTab[]` | Tabs above the table, each applying a hidden filter on one column (`filter` optional). A tab may link to another page instead (`to`: page controller or path, `countFrom`: data controller or location for its counter); a tab with id `"all"` replaces the implicit one; `permission` (an action of the table) or `permissionId` (an absolute id) gates it; `navBadge` (`true`, or `{ tone }`) publishes its counter as the page's nav badge. Serialized as `TableViewTabSerialized` (`to` resolved per request, `toPage`). |
253
+ | `realtime` | `boolean` | Set to `false` to disable realtime broadcast and presence for this resource. Realtime is on by default. |
254
+ | `realtimeTopic` | `string \| string[]` | Topics the backend publishes on when rows change outside the table's routes: the table reads its rows again on each event. Registered against the page from `onCreated`; also offered by `TableView.fromSource`. |
255
+ | `liveHold` | `boolean \| TableViewLiveHoldOptions` | On a page declared with `live`, keeps the rows while the page is paused and shows a "N new · Show" strip; Show reads them once without leaving the pause. `{ whileRowOpen?, whileScrolled?, whileSearching?, whileSorted? }` (all default `false`) also holds the table alone, the page staying live, while a row is open in the side panel, its first row is scrolled out of view, the user's search narrows the rows or they are sorted otherwise than by `defaultSort`; the strip then names the reason ("Table on hold · search active"). `missedLabel` words the strip's count, given `{count}` ("12 new requests"); while the page is paused the strip adds the page's `setMissedDetail` breakdown. A `TableView.fromSource` route receives `liveHeldAt` (ISO 8601) on every request made while held. Also offered by `TableView.fromSource`. |
256
+ | `reorder` | `TableViewReorderOptions` | `{ field }`: rows ordered by hand with a drag handle, on the grid and on the `cards` display. `field` must be a `@Sortable()`, writable `NumberType` column, and the edit action on: registration throws otherwise. The rows are listed sorted on it, and a move saves only the rows whose value changed. |
257
+ | `kanban` | `KanbanOptions` | Enable the kanban display. |
258
+ | `grouped` | `GroupedOptions` | `{ groupByField, by?: "value" \| "day" \| "week", collapsible?, count? }`: offer the `grouped` display, the grid's columns under a header row per group. `groupByField` must be a `@Sortable()` column, a `DateType` one to group by day or week. |
259
+ | `views` | `TableViewViewsOptions` | `{ items: TableViewView[], layout?: "tabs" \| "strip" \| "menu", defaultView?, userViews? }`. A `TableViewView` is a `TableViewViewState` (`filters`, `search`, `sort`, `columns: { visible?, hidden?, order? }`, `display`, `density`) with `id`, `label`, `icon`, `tone`, `dot`, `count`, `permission` (an action of the table by name, or an `Action`) and `permissionId` (an absolute permission id, which wins); a view the caller fails it for is left out when the layout is served. Filter values may hold `{{user.id}}`, `{{now}}` and `{{now±Nd}}`, resolved by the server. Serialized as `TableViewViewsSerialized` (no `permission` nor `permissionId`). |
260
+ | `card` | `TableViewCardOptions` | The card the `kanban` and `cards` displays draw: `fields` it shows, or a `component` drawing it whole. |
261
+ | `displays` | `TableViewDisplayOption[]` | The displays offered, in order: a built-in id (`"table"`, `"cards"`) without a component, or a module display named `<module>:<id>`; registration throws otherwise. Left out, the built-in `table` alone; listed, exactly these, so the grid is kept by listing `{ id: "table" }`. |
262
+ | `defaultDisplay` | `string` | Display shown when the viewer has no stored preference. Defaults to `"table"`. |
263
+ | `guards` | `TableViewGuards<T>` | Server-side guards run before mutating actions. |
264
+ | `bypassTenantAccessGate` | `boolean` | Skip the tenant access gate on every data route of this table view. |
265
+
266
+ ### Tables over a module's route
267
+
268
+ ```typescript
269
+ TableView.fromSource(options: TableViewSourceOptions): ComponentBuilder<TableViewOptionsSerialized>;
270
+ ```
271
+
272
+ A read-only table view with no data controller (`tableViewFromSource`). `TableViewSourceOptions` takes `columns` (a record of `TableViewSourceColumn`, a `@Column`'s options plus `sortable`), `fetchUrl` (its `{{params.X}}` / `{{query.X}}` tokens are filled from the page URL, percent-encoded; the table and its tab counters list again when they change and request nothing while one has no value), `fetchRowUrl?` (a route answering one row by id, `{{row.id}}` its percent-encoded id, with the same tokens: a deep link to a row the table does not list opens through it; serialized on `TableViewSourceSerialized`), `rowIdKey?`, `periodScope?` (the id of a `PeriodSelector`: every request carries its `from`, `to`, `preset` and `comparison`, the table lists again when the period changes, and nothing is requested until the selector is on the page), `capabilities?` (`TableViewSourceCapabilities`: `search`, `sort`, `paginate`, `filter`), `queryParamFilters?` (URL query parameters sent to the route as hidden `filter_<field>` filters), custom row actions and buttons only, and the presentation options of a table view (`caption`, `layout`, `pagination`, `tabs`, `quickFilters`, `displays`, `card`, `emptyStates`, `footer` texts and legend…). The route answers `{ results, total }` and is sent the part of the list query its capabilities name, nothing else; the browser does the rest over the rows it answered, except that a paging route's rows are neither searched nor sorted by the browser. Registration runs the checks of `TableView()` that apply (page size, display ids, tab targets) and throws when tabs, quick filters or `queryParamFilters` lack `capabilities.filter`, or when a key they, `labelKey`, `card.fields` or `expandable` name is not a column, or when `expandable` sets `lazyLoad` (a source has no `get` route), or when `fetchRowUrl` lacks `{{row.id}}`. There is no export, realtime nor footer summary.
273
+
274
+ ### Reaching a Table Behind a Tenant Gate
275
+
276
+ `bypassTenantAccessGate` is the table-view mirror of the guard option of the same name. Reserve it for tables that must stay readable while a gate denies the tenant — the invoices on the billing page of a suspended tenant, so it can regularize its situation. Permission checks still apply.
277
+
278
+ Data routes are registered against the controller, not against a page, so the opt-out is controller-level and **latched**: once any `TableView()` call on a controller declares it, the controller's routes bypass the gate wherever they are rendered. A later registration of the same controller without the flag cannot re-gate them, and gets a warning saying so. Two consequences worth designing around:
279
+
280
+ - Declaring the flag on a controller opens its routes for every table view built on it, including one mounted on an ordinary page.
281
+ - Actions that carry no permission id — a plain list on a component that was never mounted — are then served to any member of a denied tenant. That is the escape hatch working as intended, so keep every action of a flagged controller stamped with a permission.
282
+
283
+ `TABLE_DISPLAY_ID` (`"table"`), `KANBAN_DISPLAY_ID` (`"kanban"`), `CARDS_DISPLAY_ID` (`"cards"`) and `GROUPED_DISPLAY_ID` (`"grouped"`) are exported constants for the reserved built-in display ids. `TableViewOptionsSerialized` is the transported shape: `customButtons`, `rowActions`, `displays` become their serialized counterparts, `kanban` and `grouped` are folded into `displays`, and two fields are added — `enableTableExport: boolean` and `formComponents`, a record of the serialized `new` / `edit` / `view` forms. When a page is served, each table view on it also receives `tableId` (its key in the page) and `isSoleTableView`, which decide the URL keys opening its views and tabs (`?<tableId>.view=`, or `?view=` for a page's only table view).
284
+
285
+ `tableViewLink(page, tableId, { view?, tab? })` returns the dashboard path of `page` opening one of its table views on a view or a tab (`/workspaces?content.view=past-due`); it throws for a class that is no page controller. `TABLE_VIEW_VIEW_QUERY_KEY` (`"view"`) and `TABLE_VIEW_TAB_QUERY_KEY` (`"tab"`) are the keys it uses.
286
+
287
+ `TableView` throws at declaration time when the options do not hold together: `archiveMode` without an `@ArchiveField`, a `kanban.groupByField` that is not a column or whose type is not a non-multiple `SelectType`, a `BooleanType` or a `StatusType`, a `card.fields` entry that is not a column, a `grouped.groupByField` that is not a sortable column (or not a date one, by day or week), a `defaultDisplay` that no declared display provides, `displays: []` with neither `kanban` nor `grouped` (no display at all), or views that repeat an id, filter on a column that is not filterable, sort on one that is not sortable, name an unknown column, open a display the table does not offer, or default to an undeclared view.
288
+
289
+ ## Row Actions
290
+
291
+ `TableViewRowActionOptions<T>` configures the row menu. Every built-in action takes `true`, `false`, or a `RowActionConfig<T>` carrying a rule.
292
+
293
+ | Option | Type | Description |
294
+ | --- | --- | --- |
295
+ | `add` | `boolean \| RowActionConfig<T>` | Create a row. |
296
+ | `edit` | `boolean \| RowActionConfig<T>` | Edit a row. |
297
+ | `details` | `boolean \| RowActionConfig<T>` | Open the read-only view. |
298
+ | `duplicate` | `boolean \| RowActionConfig<T>` | Open the `new` form pre-filled from the row. |
299
+ | `delete` | `boolean \| RowActionConfig<T>` | Delete a row. |
300
+ | `archive` | `boolean \| RowActionConfig<T>` | Archive a row. |
301
+ | `restore` | `boolean \| RowActionConfig<T>` | Restore an archived row. |
302
+ | `copyLink` | `boolean \| RowActionConfig<T>` | Copy a link to the row. |
303
+ | `hasSelection` | `boolean` | Enable row selection. |
304
+ | `custom` | `CustomRowAction<T>[]` | Extra actions pointing at an `ActionTarget`. |
305
+
306
+ ```typescript
307
+ static table = TableView(memberDataAPI, {
308
+ rowActions: {
309
+ add: false,
310
+ edit: { isEnabled: true, isVisible: true },
311
+ delete: { isEnabled: true, rule: { field: "isTenantOwner", notEquals: true } },
312
+ hasSelection: true,
313
+ custom: [
314
+ {
315
+ label: "Validate email",
316
+ icon: "i-ph-check-circle",
317
+ target: {
318
+ type: "api",
319
+ url: "/settings/workspace/members/{{row._id}}/validate-email",
320
+ method: "POST",
321
+ successMessage: "Email validated",
322
+ },
323
+ rule: { field: "isValidated", notEquals: true },
324
+ },
325
+ ],
326
+ },
327
+ });
328
+ ```
329
+
330
+ A double-click on a row opens `edit`, or `details` when edit is off — a single click on a table declaring `rowClick: "single"` (`TableViewRowClick`), which leaves a click on a control of the row (a button, a link, a checkbox) or one ending a text selection to them. A custom action flagged `isDefault` takes that slot instead — the first flagged action whose `rule` accepts the row wins, and the click opens its `ActionTarget` like the menu entry does. This is how a table whose detail view is a custom drawer keeps the row affordance: without a click target the row is inert and no longer lights up on hover.
331
+
332
+ ```typescript
333
+ custom: [
334
+ {
335
+ label: "Details",
336
+ icon: "i-ph-info",
337
+ isDefault: true,
338
+ target: { type: "drawer", component: CustomComponent("SendDetailDrawer"), title: "Details" },
339
+ },
340
+ ],
341
+ ```
342
+
343
+ Rules are enforced on both sides. A data controller has one **writing** table view — a `TableView` enabling at least one write action (add, duplicate, edit, delete, archive or restore) that the controller offers — and its `rowActions` (archive-mode defaults included) become the controller's `controllerRowActionRules`, along with its `rowIdKey` and `strictRuleValidation`. The `edit`, `delete`, `archive` and `restore` routes validate the affected ids against those rules before running. Rows that fail the rule are dropped from the operation; with `strictRuleValidation` the whole request is rejected instead.
344
+
345
+ A second writing table view over the same controller fails the registration of its page with a `WritingTableViewConflictError` (a `PageDeclarationConflictError`, rethrown even from a nested component) naming both table views. Read-only table views — every write action set to `false`, no `archiveMode` — may share the controller: they open no `new` / `edit` form and leave its rules and options alone. A page re-registering (a hot reload) re-claims the controller; a page that went away releases it. To give the same data a second writing screen, derive a controller (see [Show the same data in two writing screens](/docs/components/derived-controller)).
346
+
347
+ Permissions are applied on top. The table view registers `list` and `select` as component actions always, `add`, `edit` and `view` when the matching generated form exists, `delete` when the controller declares the delete endpoint, `archive`, `restore` and `viewArchived` under `archiveMode`, and `export` when the three export endpoints are registered. Each action carries a permission id of the form `<component-permission>.<action>`. When the viewer lacks the permission the corresponding row action is forced to `false` and the corresponding generated form is withheld. The rule algebra itself — leaf operators, `and` / `or` / `not`, and `RowActionConfig` — is documented in [Shared Types](/docs/interfaces/base/types).
348
+
349
+ Several pages may each mount their own `TableView` over one data controller, and they all share its data routes. A read action (`list`, `select`, `view`, `export`, `viewArchived`) accepts the permission from any table view a page mounts on that controller; a write action (`add`, `edit`, `delete`, `archive`, `restore`) accepts only the writing table view's, so a user granted `add` on a read-only table view cannot create rows. A read-only table view still declares the write actions the controller offers: while no table view writes through the controller, they keep its write routes behind permission ids nobody is granted by default. The inline add button of a relation field pointing at the controller follows the same rule (`addPermissionIds`).
350
+
351
+ A `new` or `edit` `ResourceForm` block over the controller submits to the same routes, so the native files staged from its fields are accepted on save as well, alongside those of the writing table view. It adds no permission of its own to the union: the routes still require the action's permission from a table view of the controller when one is mounted, exactly as for the block's other fields. The `new` and `edit` forms a page-mode table view mounts on its form sub-pages count the same way: each is a component of its own sub-page, so the files staged from it are accepted on save, under the same table view permissions.
352
+
353
+ `TableViewRowActionOptionsSerialized` is the transported shape: rules and flags untyped, `custom` as `CustomRowActionSerialized[]`, plus a `showArchived?: boolean` field the builder fills from the `viewArchived` permission.
354
+
355
+ ### Row action extras
356
+
357
+ `TableViewRowActionOptions` also takes `menuLabel`: the accessible name of a row's ⋯ menu button, its `{field}` braces filled from the row (a `$` key's translation receives the row's fields), "Actions for <label>" by default with `labelKey`, "Row actions" without. A `CustomRowAction`'s `label` fills its `{field}` braces from the row the same way.
358
+
359
+ `RowActionConfig` (built-in actions) also takes `label`, `icon` and `confirm` (an `ActionConfirm`: a `ConfirmDialog`, or `{ from }`, a URL answering one for the row — on delete, archive and restore, for a single row); `BulkRowActionConfig` (delete, archive, restore) adds `successMessage`. `CustomRowAction` also takes `confirm`, `permission` (`ButtonPermission`: an action of the table by name, or an `Action`), `permissionId` (an absolute permission id, which wins over `permission`), `color`, `variant`, `showLabel`, `bulk` (`true` or `{ allMatching: true }`: offered on the selection bar, see below) and `deepLink` (a drawer, modal or side panel it opens is kept in the URL as `?record=<id>` — by default for a side panel, which `false` opts out of —, `?<tableId>.record=<id>` on a page with several table views). An action the caller fails the permission for is stripped per request like a custom button; it is only hidden, so the route its target calls must check the permission itself.
360
+
361
+ A bulk custom action sends the selected ids as a repeated `ids` query parameter, or `allMatching=true` with the table's filters, search and archive view after "Select all N matching". `resolveBulkRowIds(this, ctx, user)`, called from a route of the table's data controller, answers the ids the action covers: the selected ones, or every matching row read like the list reads them, refusing more than `MAX_BULK_MATCHING_ROWS` (413). Either way the caller needs the table's `list` permission (403 otherwise). `BULK_ALL_MATCHING_KEY` is the query flag. The `api` action target also takes `body` (the confirmation's field values merged in) and `copy` (response field copied to the clipboard). `CustomButton` takes `placement` (`"toolbar"`, the default, or `"header"`: drawn in the page header, which the server adds it to); `rowActions.add` takes it too (`AddRowActionConfig`).
362
+
363
+ When several table views share a data controller, each read action of its routes is guarded by the permission ids of every mounted table view, each write action by the writing table view's (`TableViewMeta.actionPermissionIds(action)`; any one suffices). `TableViewMeta.componentBuilders` lists them, `writingComponentBuilders` the ones that write.
364
+
365
+ ## Archive Mode
366
+
367
+ With `archiveMode: true`, the archive and restore actions replace deletion. The builder calls `applyArchiveModeDefaultRules` (see [Helpers](/docs/interfaces/base/helpers)) to give every relevant action a default rule against the `@ArchiveField` column, so archived rows offer restore and delete while live rows offer edit, duplicate and archive. Actions you configured explicitly keep your settings; only actions left undefined, set to `true`, or given without a rule receive the default.
368
+
369
+ ```typescript
370
+ static table = TableView(articleDataAPI, {
371
+ archiveMode: true,
372
+ rowActions: { edit: true, delete: true, archive: true, restore: true },
373
+ });
374
+ ```
375
+
376
+ ## Guards
377
+
378
+ A guard runs before the mutating route and aborts it by throwing. Use `assert` from `@antelopejs/interface-api-util` to fail with an HTTP status and a message key. `this` inside a guard is the data controller instance.
379
+
380
+ ```typescript
381
+ import { assert } from "@antelopejs/interface-api-util";
382
+ import { getRequestTenantId } from "@antelopejs/interface-dms/request-tenant";
383
+ import { GetModel } from "@antelopejs/interface-database-decorators";
384
+ import { TenantMemberModel } from "@antelopejs/interface-dms/db";
385
+
386
+ static table = TableView(memberDataAPI, {
387
+ guards: {
388
+ edit: async (ctx, { current, body }) => {
389
+ const demoting = current.isTenantOwner && body.isTenantOwner === false;
390
+ if (!demoting) return;
391
+ const model = GetModel(TenantMemberModel, getRequestTenantId(ctx));
392
+ const remaining = await model.countOwnersExcluding([current.userId]);
393
+ assert(remaining > 0, 409, "$page.settings.members.error.last_owner");
394
+ },
395
+ delete: async (ctx, { ids }) => {
396
+ // ids is the full set of rows the request targets
397
+ },
398
+ },
399
+ });
400
+ ```
401
+
402
+ The `edit` guard receives `{ id, body, current }`, where `current` is the row as it stands in the database — the route loads it before calling the guard and answers `404` when it does not exist. The `new` guard receives `{ body }`, parsed from the request body whether it arrived as a buffer, a string or an object. The `delete`, `archive` and `restore` guards receive `{ ids, values }`: `values` is the answer of the action's confirmation `fields`, sent as the request body, and is unset when the request carried none (see [Confirmations](/docs/components/tables/confirmations#what-the-rows-take-with-them)). Like the rules, guards are stored on the controller metadata the first time a table view declares them, so they apply to every table view on that controller. The argument interfaces are documented in [Shared Types](/docs/interfaces/base/types).
403
+
404
+ ## Filters, Tabs and Displays
405
+
406
+ `defaultFilters` seeds the visible filter bar. `queryParamFilters` and `routeParamFilters` add hidden filters instead: each is a `Record<string, QueryParamFilter>` / `Record<string, RouteParamFilter>` mapping a URL parameter name onto `{ field: string; mode?: string }`, filtering the table without appearing in the UI or in the viewer's stored preferences. A `QueryParamFilter` also takes `visible?: boolean` and `label?: string`: a visible one shows as a removable chip of the filters row while the URL applies it. `queryParamFilters` reads the page's query string, `routeParamFilters` reads the parameters of the page slug (for example `:id` on a detail page). Both also seed `submitDefaults` on the generated forms, so a row created from a filtered view inherits the filter's value. An active `queryParamFilters` filter makes the table read as filtered (its empty body is the `filtered` state, without a clear action), and a change of its value in the URL lists from page 1.
407
+
408
+ ```typescript
409
+ static table = TableView(invoiceDataAPI, {
410
+ routeParamFilters: { id: { field: "customerId" } },
411
+ defaultSort: { field: "createdAt", desc: true },
412
+ tabs: [
413
+ { id: "open", label: "Open", filter: { accessorKey: "status", value: "open", mode: "is" } },
414
+ { id: "paid", label: "Paid", filter: { accessorKey: "status", value: "paid", mode: "is" } },
415
+ ],
416
+ });
417
+ ```
418
+
419
+ `TableViewTab` is `{ id, label, filter?: TableViewTabFilter, icon?, textColor?: ColorValue, iconColor?: ColorValue }` plus the link fields (`to`, `countFrom`), the gate (`permission`, `permissionId`) and `navBadge?: boolean | TableViewTabNavBadge` (`{ tone?: Tone }`), and `TableViewTabFilter` is `{ accessorKey: string; value?: string; mode: string }`. A tab gives a `filter` or a `to`, never both (registration throws). `permission` is relative to the table view's permission id (`"list"` → `<table permission id>.list`) or an `Action`; `permissionId` is absolute and wins; a link tab to a page controller follows that page's own permission without either. In the page editor, the tab's permission picker sets `permissionId`, and `permission` is the advanced "Action" text field.
420
+
421
+ `navBadge: true` publishes the tab's counter as the navigation badge of the page it stands for: this table's page for a filter tab, the linked page for a link tab — which then needs a page controller `to` and a data controller `countFrom`; a path or a location logs a warning and publishes nothing. The server counts it on each page visit (the page payload's `navBadges`, never the cached site layout), with the caller's own `list` permission on that table, for the pages the caller can open only; the badge shows in the main and the settings navigation. A count of zero shows no badge, a page's static `MenuOptions.badge` wins over it, and while the table is on screen its own counter keeps it fresh. `TableView.fromSource` tables do not support it. `navBadge: { tone }` draws the badge in that tone instead of neutral; counts landing on one page add up, in the strongest tone. Declaring at least one tab also surfaces an implicit "all" tab that applies no filter.
422
+
423
+ `displays` declares alternative renderings of the same data:
424
+
425
+ | Field | Type | Description |
426
+ | --- | --- | --- |
427
+ | `id` | `string` | Display identifier. Required. |
428
+ | `options` | `Record<string, unknown>` | Options handed to the display. |
429
+ | `component` | `Component` | Frontend component, resolved by name from the global registry. |
430
+ | `selfManagedData` | `boolean` | The display fetches its own data. |
431
+ | `capabilities` | `TableViewDisplayCapabilities` | Which toolbar features the display supports: `columnManagement`, `filters`, `search`, `sorting`, `tabs`, all optional booleans. |
432
+
433
+ `TableViewDisplayOptionSerialized` is the same with `component` serialized.
434
+
435
+ `kanban` is a shorthand for one particular display: the builder appends a `displays` entry with id `"kanban"` carrying the kanban options, unless `displays` already places `{ id: "kanban" }`, which then receives them.
436
+
437
+ | Option | Type | Description |
438
+ | --- | --- | --- |
439
+ | `groupByField` | `string` | Column the cards are grouped by. Must be a non-multiple `SelectType`, a `BooleanType` or a `StatusType` column. Required. |
440
+ | `draggable` | `boolean` | Allow dragging a card to another column to change the group field. Defaults to `true`. |
441
+ | `columnMaxHeight` | `string` | CSS max-height of a column's card list before it scrolls. Defaults to `"60vh"`. |
442
+
443
+ `KanbanOptionsSerialized` is `KanbanOptions` plus the serialized `card` (`TableViewCardOptionsSerialized`).
444
+
445
+ `card` (`TableViewCardOptions`: `{ fields?: string[]; component?: Component }`) is the card the `kanban` and `cards` displays draw for each row; it joins the options of both display entries. The component receives the same props in both: `row`, `rowId`, `columns`, `labelKey`, `actions`, `selected`, `select(value?)`, `open()`, on the kanban `groupValue`, and on the `cards` display of a table ordered by hand `reorder` (`{ enabled, dragging, handle }`, the card's move handle).
446
+
447
+ ## Generated Forms
448
+
449
+ `TableView` builds up to three forms from the columns, one per `FormMode`, using each column's data type for the input and the controller's mandatory and access metadata for required and disabled state. The `new` form fetches from `<location>/get?id={{query.duplicate}}` and submits to `<location>/new`; the `edit` form fetches from `<location>/get?id={{params.id}}&_presence=1` — the extra parameter makes the `Get` route record the viewer's presence on that row — and submits to `<location>/edit?id={{params.id}}`; the `view` form only fetches, from `<location>/get?id={{params.id}}`. A mode whose column set is empty produces no form and no matching action.
450
+
451
+ `formContainer` decides where they open:
452
+
453
+ ```typescript
454
+ type FormContainer =
455
+ | { type: "drawer"; pages?: FormContainerPages<FormContainerPageTexts> }
456
+ | { type: "modal"; size?: ModalSize; pages?: FormContainerPages<FormContainerPageTexts> }
457
+ | { type: "page"; pages?: FormContainerPages<FormContainerPageConfig> };
458
+ ```
459
+
460
+ Page mode is the default — it is what you get when `formContainer` is omitted. In page mode the builder registers a hidden sub-page per form under the table's page, each guarded by the matching action's permission.
461
+
462
+ The sub-pages are named after the **table view**, not after the page: their default slugs are `<key>/new`, `<key>/:id/edit` and `<key>/:id/view`, where `<key>` is the key the table view is mounted under — `static invoices = TableView(...)` on `/billing` gives `/billing/invoices/new`. It is the *simple* key even for a table view nested deep in a layout (`.child("invoiceTable", TableView(...))` gives `invoiceTable`, not `layout/body/main/invoiceTable`), so the URL stays readable and survives the layout being reorganised. That is what lets one page carry several table views, nested or not, each with form pages of its own. The key does not depend on the page declaring a `permission.id` of its own. A table view instance belongs to the first page that mounts it: its form routes cannot be keyed on a second page mounting the same instance in page mode, which is an error, so give each page its own `TableView(...)`.
463
+
464
+ `pages` (`{ new?, edit?, details? }`) titles the forms in every container: a `FormContainerPageTexts` entry is `{ displayName?, description? }` (`$`-prefixed: i18n keys), falling back to "New entry", "Edit entry" and "Entry details". In page mode an entry is a `FormContainerPageConfig`, which also overrides the sub-page:
465
+
466
+ | Option | Type | Description |
467
+ | --- | --- | --- |
468
+ | `urlSlug` | `string` | Slug of the sub-page, relative to the page — **no key segment is inserted**, so a declared slug is full control over the URL. The `edit` and `details` slugs must contain `:id`, otherwise `TableView` throws. A slug starting with `/` addresses a page of its own; leading `..` segments each drop one segment of the carrying page. |
469
+ | `displayName` | `string` | Form and sub-page title. |
470
+ | `description` | `string` | Form and sub-page description. |
471
+ | `customPage` | `boolean` | Do not auto-create the sub-page — you registered your own page at that URL. The slug is still used for navigation. |
472
+
473
+ Whichever slugs apply, the builder resolves them against the slug of the page
474
+ carrying the table view and serializes the three URLs as `formPages`
475
+ (`{ new, edit, view }`), `:id` placeholder included. The frontend navigates to
476
+ those URLs as they stand — substituting the row id, and the current route
477
+ params for the placeholders the carrying page contributes — rather than
478
+ rebuilding them from the browser path. A `customPage` entry registers no
479
+ sub-page and still gets its URL serialized: it is navigated to all the same.
480
+
481
+ A page below a `:id` page therefore carries two `:id` placeholders
482
+ (`/workspaces/:id/invoiceTable/:id/view`). The row id takes the **last** one
483
+ and the route params of the carrying page fill the rest, so the form reads the
484
+ row id from `params.id` — the same thing it means on a flat `/customers/:id/edit`,
485
+ which is what the generated `fetchUrl` and `submitUrl` count on.
486
+
487
+ The id of the page above is not lost to the repetition: when a route repeats a
488
+ placeholder name, every occurrence is also exposed under `<name>:<n>`, numbered
489
+ from 1 in the order they appear in the pattern. On
490
+ `/workspaces/:id/invoiceTable/:id/view` a form reads `{{params.id}}` or
491
+ `{{params.id:2}}` for the row and `{{params.id:1}}` for the workspace carrying
492
+ it. A name that occurs once gets no indexed key — `{{params.id}}` is all there
493
+ is to read on every single-placeholder route.
494
+
495
+ Two page-mode table views on one page whose form URLs resolve to the same path
496
+ — the same explicit `urlSlug`, or the same key under two different parents —
497
+ **fail the registration** of the page, naming both table views and the path.
498
+ The check covers the page's own components and the table views a page extension
499
+ contributes later. Give one of them a `urlSlug` of its own to resolve it.
500
+
501
+ ## Exports
502
+
503
+ The export action is offered only when the controller registered all three `ExportRoutes`. Pressing it starts a background export job, polls its status, and downloads the result; the job machinery itself is shared with any other long export and is documented in [Helpers](/docs/interfaces/base/helpers). Which columns land in the file is decided by `@Exported`.
504
+
505
+ ## Realtime
506
+
507
+ Unless `realtime: false` is set, a table view registers two realtime topics for its page (and for each generated sub-page), and its routes publish every create, update and delete on the first and track who has a row open on the second. Both are named after the controller's location:
508
+
509
+ ```typescript
510
+ import {
511
+ tableViewPresenceTopic,
512
+ tableViewRowTopic,
513
+ } from "@antelopejs/interface-dms/base/table-view";
514
+
515
+ tableViewRowTopic("/api/orders"); // "tableview:row:/api/orders"
516
+ tableViewPresenceTopic("/api/orders"); // "tableview:presence:/api/orders"
517
+ ```
518
+
519
+ The topics are registered with `RegisterPageTopic` from the table view's `onCreated`, so they belong to the module whose page it is, as described in [Realtime](/docs/interfaces/core/realtime). A module that publishes on a table's row topic itself — a background job updating rows, for instance — builds the name with `tableViewRowTopic` rather than spelling out the prefix.
520
+
521
+ Two functions let other modules observe those mutations:
522
+
523
+ ```typescript
524
+ import {
525
+ registerRealtimeMutationListener,
526
+ unregisterRealtimeMutationListener,
527
+ type RealtimeMutationContext,
528
+ } from "@antelopejs/interface-dms/base/table-view";
529
+
530
+ const listener = (context: RealtimeMutationContext) => {
531
+ // context.controllerLocation, context.eventType, context.ids, …
532
+ };
533
+
534
+ registerRealtimeMutationListener(listener);
535
+ ```
536
+
537
+ Listeners are additive side observers: they run after the DMS has published the mutation, and a listener that throws is logged, never propagated to the mutating request. A listener is released with the module that registered it, including when that module reloads in development; `unregisterRealtimeMutationListener` is for a module that stops listening while it stays loaded.
538
+
539
+ | Type | Shape |
540
+ | --- | --- |
541
+ | `RealtimeMutationEventType` | `"created" \| "updated" \| "deleted"` |
542
+ | `RealtimeMutationContext` | `controllerLocation`, `rowIdKey`, `eventType`, `ids: string[]`, `sessionId?`, `actor?: RealtimePresenceActor` |
543
+ | `RealtimePresenceActor` | `id`, `displayName?`, `avatarUrl?` |
544
+ | `RealtimePresenceContext` | `controllerLocation`, `rowIdKey`, `sessionId`, `rowId`, `actor` |
545
+
546
+ The routes reach the DMS through two interface functions it implements, `internal.PublishMutation` and `internal.AcquirePresence`. They are internal: nothing outside the DMS implements them, and the core binds them to each generation of the DMS module, so a mutation made while the DMS reloads waits for the next generation instead of reaching the one being torn down.
547
+
548
+ ## Metadata
549
+
550
+ `TableViewMeta` is the metadata object the decorators write to and the builder reads from. Retrieve it with `GetMetadata(controller, TableViewMeta)`.
551
+
552
+ | Member | Description |
553
+ | --- | --- |
554
+ | `columns` | `Record<string, ColumnOptions>` keyed by field name. |
555
+ | `groups` | `Record<string, ColumnGroupConfig>` keyed by group id. |
556
+ | `options` | The `TableViewOptions` of the writing `TableView`, or of the last one built while none writes. |
557
+ | `archiveField` | Field name recorded by `@ArchiveField`. |
558
+ | `controllerRowActionRules` | The rules the write routes enforce: the writing table view's `rowActions`, archive-mode defaults included. |
559
+ | `controllerGuards` | Guards promoted to controller-wide guards. |
560
+ | `componentBuilders` | Every live `TableView` builder built on the controller, in build order. |
561
+ | `writingComponentBuilders` | The live builders of `componentBuilders` that write through the data routes. |
562
+ | `actionPermissionIds(actionId)` | The permission id the action carries on each mounted table view of the controller — on the writing one only for a write action. |
563
+ | `addComponentBuilder(builder, access?)` | Writer the builder calls to record itself, with its `TableViewAccess` (`"read"` or `"write"`, the default). A custom component standing in for a table view (the roles editor) records itself the same way. |
564
+ | `resourceFormBuilders` | Every live `new` / `edit` form built over the controller, in build order: the `ResourceForm` blocks and the forms each table view opens. |
565
+ | `addResourceFormBuilder` | Writer the form builder calls to record a form that submits to the controller. |
566
+ | `writingComponents` | Every live component that submits to the controller's write routes: its writing table view and its `new` / `edit` forms, including the ones a page-mode table view mounts on its form sub-pages. A native file staged by any of them is accepted on save; one staged by any other component is refused. |
567
+ | `inherit(parent)` | Called by `GetMetadata` for a derived controller: copies the parent's `columns` (each with its own copy of its data type), `groups`, `options` and `archiveField`, never its table views or forms. |
568
+ | `config` | Getter returning `{ location, columns }`, the serialized column list plus the controller's route location. |
569
+ | `getFormFields(mode)` | Builds the `FormFieldOrGroup[]` for `"view"`, `"edit"` or `"new"`. |
570
+ | `setColumn`, `setGroup`, `setOptions`, `setArchiveField`, `setControllerRowActionRules`, `setControllerGuards` | Writers used by the decorators and the builder. |
571
+
572
+ Each entry of `config.columns` carries `id`, `header`, `isVisible`, `type` (the serialized data type), `accessorKey`, `listable`, `enableSorting`, `enableColumnFilter`, `defaultValue`, `accessMode` and `readonlyBehavior`.
573
+
574
+ ## Route Helpers
575
+
576
+ `table-view` also exports the interface functions the wrapped routes call. They are the seam between the interface and its implementation — a consumer wires them by declaring `TableViewRoutes`, and does not normally call them directly.
577
+
578
+ | Function | Role |
579
+ | --- | --- |
580
+ | `listWithSearch` | Runs the list query with search, filters, sorting and pagination; returns `{ results, total, offset, limit }`. |
581
+ | `countWithSearch` | Same query, count only; returns `{ total }`. |
582
+ | `startExport` | Queues an export job; returns `{ jobId, format, extension }`. |
583
+ | `getExportStatus` | Returns `{ status, progress, error? }` for a job. |
584
+ | `downloadExport` | Streams a completed job's file to the response. |
585
+ | `archiveRows` | Sets the archive field on the given ids; returns `{ success, archivedCount }`. |
586
+ | `restoreRows` | Clears it; returns `{ success, restoredCount }`. |
587
+ | `validateRowsAgainstRule` | Splits ids into `{ eligibleIds, rejectedIds }` against a `RowActionRule`. |
588
+ | `fetchRowForGuard` | Loads one row by id field, for the `edit` guard and the file-cleanup passes. |
589
+
590
+ ## Events and Functions
591
+
592
+ | Namespace member | Value |
593
+ | --- | --- |
594
+ | `TableViewEvents.ROW_CLICK` | `"DmsComponent.TableView.RowClick"` |
595
+ | `TableViewEvents.ROW_SELECT` | `"DmsComponent.TableView.RowSelect"` |
596
+ | `TableViewEvents.ROW_DELETE` | `"DmsComponent.TableView.RowDelete"` |
597
+ | `TableViewEvents.ROW_ADD` | `"DmsComponent.TableView.RowAdd"` |
598
+ | `TableViewEvents.ROW_EDIT` | `"DmsComponent.TableView.RowEdit"` |
599
+ | `TableViewEvents.FILTER_CHANGE` | `"DmsComponent.TableView.FilterChange"` |
600
+ | `TableViewEvents.SORT_CHANGE` | `"DmsComponent.TableView.SortChange"` |
601
+ | `TableViewEvents.EXPORT` | `"DmsComponent.TableView.Export"` |
602
+ | `TableViewFunctions.CUSTOM_PAGE_FORM_SUCCESS` | `"DmsComponent.TableView.CustomPageFormSuccess"` |
603
+
604
+ `CUSTOM_PAGE_FORM_SUCCESS` registers `{ url: string; preserveQuery?: string[] }` in `WatchFunctionParamMap`. The builder uses it itself: the generated `new` and `edit` page forms watch `FormEvents.SUBMIT_SUCCESS` and navigate back to the table, preserving the query parameters named in `queryParamFilters`. The handler resolves `{{params.X}}` / `{{query.X}}` tokens in `url` against the route being left before navigating; the generated forms rely on it to send the user back to a page whose slug carries parameters: each placeholder of the page's slug becomes the token reading it on the form route (`/workspaces/:id` becomes `/workspaces/{{params.id:1}}` from `/workspaces/:id/invoiceTable/:id/edit`, `/workspaces/{{params.id}}` from `/workspaces/:id/invoiceTable/new`). A slug without parameters is used as is. The `view` form submits nothing and carries no such watch. All three generated pages are registered with `FormPageLayout()`, the constrained-column layout ([Layout and Containers](/docs/interfaces/base/layout)).
605
+
606
+ ## Next Steps
607
+
608
+ - [Charts and Widgets](/docs/interfaces/base/charts-and-widgets) - Charts, KPI cards, top lists and the period selector.