@antelopejs/agent-skills 0.3.3-next.76.gc7cfa44 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -8
- package/skills/dms-best-practices/SKILL.md +29 -2
- package/skills/dms-builder-mcp/SKILL.md +3 -2
- package/skills/dms-external-database/REFERENCE.md +40 -1
- package/skills/dms-external-database/SKILL.md +76 -25
- package/skills/dms-mockup/SKILL.md +20 -13
- package/skills/dms-mockup/SPEC.md +514 -7
- package/skills/dms-mockup-build/SKILL.md +23 -11
- package/skills/dms-page-design/SKILL.md +96 -3
- package/skills/dms-pages/SKILL.md +1 -1
|
@@ -24,32 +24,44 @@ Read `mockups/<name>/spec.json` and its open annotations ([SPEC.md](../dms-mocku
|
|
|
24
24
|
Map every spec page and node, and present the plan before you write:
|
|
25
25
|
|
|
26
26
|
- **Converted page:** a spec page with `livePage: { ref, version }` was converted from the live page at `livePage.ref` (a route). Read that page with `builder_page_structure` (without the builder MCP, its page class) and plan the changes that turn it into the spec page (blocks to configure, move, remove or add), not a new `PageController`; its fixtures whose key is in the spec page's `liveRoutes` keep reading those live routes (_Live route_ below). A **live sketch**, a Custom sketch whose `id` names a block of the live page, stands for code the conversion could not express: keep that block as it is, with no component to write and no Safe mode question. Check its version first, as _Pages converted from a live page_ says: a stale page goes in the plan as stopped, with no changes. With `mockup_apply_to_page` among your tools, the plan still lists every change and says that the tool writes the page first, and that you build only the changes its `wiring` answer lists.
|
|
27
|
-
- **Page** → a `PageController` (with `RegisterPage`, from `@antelopejs/interface-dms/page`): `id` and
|
|
27
|
+
- **Page** → a `PageController` (with `RegisterPage`, from `@antelopejs/interface-dms/page`): `id`, title, `icon` and `description` from the spec page (pass `icon` and `description` to `builder_create_page`; when the spec page has none, choose them as **dms-page-design** _Name every page_ says), and the category its `category` names.
|
|
28
|
+
- **Sub-page** (`parent`) → a page registered under its parent's route, its `route` as the parameter (`urlSlug: "orders/:id"`), with `parent` naming the parent's page class, in the parent's category; `menu: false` → `hidden: true`, left out of the menu. The builder writes neither a route parameter nor a `parent`: write the page class with **dms-pages**, then build its blocks as any page's. A `fixture:<key>` on it that reads an ancestor's rows reads the one record its parameter names (`{{params.id}}`).
|
|
29
|
+
- **Sections** (`categories`) → one category per section, in the spec's order, its `name` the section's `id`, its `displayName`, `icon` and `order` from the spec: `builder_create_category` with the pages' `module`, or `Category(id, options)` with **dms-pages**. A section whose `title` is an existing category's (`builder_list_pages`), case and spaces aside, is that category: its pages go there and no category is created. A page with no `category` goes in the category the project's pages use already. A spec of 6 or more pages with no `categories` gets the sections **dms-page-design** _Group pages into sections_ gives it, listed in the plan.
|
|
30
|
+
- **Dashboard:** a build over a database always builds the dashboard **dms-page-design** _The analytics dashboard_ requires, from the spec's dashboard page, each KPI card and chart bound to a query over a mapped relation. A spec over a database with no dashboard gets one in the plan, laid out as that skill says.
|
|
31
|
+
- **Header buttons** (`headerActions` of the spec page) → `DefaultLayout({ headerActions: [...] })` in the page TypeScript, each button's `label`, `icon`, `color` and `variant` from the spec plus a real `target` (a page link, a quick action, a drawer or an API call): the builder cannot write a page's layout. A target the spec and the conversation do not settle is a question for the user; never invent one. On a converted page, `mockup_apply_to_page` writes `title`, `icon` and `description` itself and lists the header buttons as a `wiring` entry (`reason: "header-actions"`); keep the live page's `hideHeader` as it is.
|
|
28
32
|
- **Block** → the same `type` and options. Keep each child's `id` as the block's name; a child whose `id` names a block option (a `ChartCard`'s `chart`) becomes that option.
|
|
33
|
+
- **Page link** (`page:<id>` in any option) → the real route of the page built from that spec page; a row's link to a page with a route fills the parameter from the row's `rowIdKey` (`/orders/{{row._id}}`). `rowClick` and `isDefault` stay as written.
|
|
29
34
|
- **Live route:** on a converted page, a `fixture:<key>` whose key is in the page's `liveRoutes` reads that route: the block's fetch option (such as `fetchUrl`) takes it in place of the fixture's `static*` option, and a live `TableView` or `ResourceForm` keeps its `controller`; a block the spec adds follows the _Fixture_ rules. This comes before the _Fixture_, `TableView` and `ResourceForm` rules.
|
|
30
35
|
- **Fixture**, or a `static*` option → the real data it stands for, by the first that holds:
|
|
31
36
|
1. an existing resource or route serves it (`builder_list_resources`, the project's controllers): bind to it;
|
|
32
|
-
2. rows of one entity: a new resource (`builder_create_resource`), its fields and types read from the fixture's rows
|
|
37
|
+
2. rows of one entity (a `$generate` fixture is one: its `fields` are the entity's fields): a new resource (`builder_create_resource`), its fields and types read from the fixture's rows or its `fields`, seeded with those rows only when the user wants sample data;
|
|
33
38
|
3. a figure, a series or a ranking: a query on that resource (`builder_add_query`) whose `response` matches the block, as **dms-builder-mcp** _Data resources and queries_ says.
|
|
34
39
|
A fixture none of these can serve goes in the plan as a question.
|
|
35
|
-
- **`TableView` over a fixture** → a `TableView` bound to the resource (`controller` = its ref), its columns from the spec's `columns`.
|
|
36
|
-
-
|
|
37
|
-
- **
|
|
40
|
+
- **`TableView` over a fixture** → a `TableView` bound to the resource (`controller` = its ref), its columns from the spec's `columns`, with every badge, price, tab, board, card and view the mockup shows. A table over a relation of a connected database is mapped with `builder_map_resources`, as **dms-external-database** _Apply_ says: leave out each badge the Builder proposes (it writes the real values and tones, where the spec's items are fixture values), send a price with its `currency`, and turn `tabsFrom` into the resource's `tabs` and the board, groups, cards, `defaultDisplay` and `views` into `tableOptions`, renamed as [SPEC.md](../dms-mockup/SPEC.md) _Tables_ says, with its section's ref as `category` and the spec page's `title`. Another table takes the spec's displays as they are, its board and views through `builder_configure_table_view`. A colour or display the builder cannot write (a badge the Builder does not propose over a column with no native enum, a cell display, a `mobileDisplay`) is a question in the plan, never dropped.
|
|
41
|
+
- **Table forms** (`rowActions`, `formContainer`) → the same actions on the real table, and `false` for each of `add`, `edit` and `details` the spec leaves out: the real `TableView` turns an absent one on. A table with no `formContainer` showed a modal: write `{ "type": "modal" }`, as **dms-page-design** _Records, forms and links_ says. `modal` and `drawer` stay as written, `size` and `direction` included, `details: true` in them being the table's own read-only details view, with no page to build. With `page`, each `urlSlug: "page:<id>"` becomes that page's slug relative to the table's page (`new`, `:id/edit`, `:id`), `customPage: true` kept, and the form page is a _Sub-page_ registered at that slug (`orders/new`). The add and edit forms save through the table's data controller. Write them with `builder_configure_block` on the table, or in the page class.
|
|
42
|
+
- **Archive mode** (`archiveMode`, `archivedCountLabel`) → the same options on the real table, its resource's archive field `isArchived` (`@ArchiveField`).
|
|
43
|
+
- **Connection** (`data`) → the spec's `access` checked against the one `builder_mapping` answers for its `connection`. A spec at `read-write` over a `read` connection goes in the plan as a question, as **dms-external-database** _Connection access_ says; build no write action before it is settled.
|
|
44
|
+
- **`ResourceForm` over a fixture** → a `ResourceForm` on the resource, with the spec's fields and `mode` (`view` on a details page, read-only).
|
|
45
|
+
- **Sketch** → a `CustomComponent` (from `@antelopejs/interface-dms/base/custom`) with `.meta({ name, description, icon })`, its Vue drawn from the sketch's HTML and CSS with the DMS UI components and theme variables, its data from a route. It draws every one of the sketch's `states` where the page meets it (no rows, a failed request, loading) and the default `html` where the data is there; each `<a href="page:<id>">` is a link to that page's real route (_Page link_). In Safe mode this is out of reach: ask whether to turn Safe mode off for these components, or to leave each one as a `Placeholder` named after its caption.
|
|
46
|
+
- **Custom page** (`custom: true`) → a _Page_ built as **dms-best-practices** _Custom pages are blocks_ says: split the page's `html` into its parts, each a block, and only a part no block draws a `CustomComponent`, built from its markup, `css` and `states` as a _Sketch_ is. Its title, icon, description and header buttons are the page's own. Safe mode as for a _Sketch_, each such part a `Placeholder` named after it.
|
|
47
|
+
- **Sidebar widget** (`sidebar.widgets`) → a Vue component of the module's frontend layer, drawn from the widget's `html` and `css` as a _Sketch_ is, registered with `sdk.registerComponent`, and a plugin (`sdk.registerPlugin`) whose `defineDmsPlugin` calls `useSidebarWidgets().register({ id, component, position: SidebarWidgetPosition.BELOW_SEARCH_BAR })`, in the spec's order (`order`). It receives `collapsed` and draws nothing on the folded rail. The docs are `https://dms.antelopejs.com/docs/extending-the-dashboard/widgets-and-overlays`. In Safe mode this is out of reach: ask whether to turn Safe mode off for it or to leave it out, and report it left out.
|
|
38
48
|
|
|
39
49
|
The plan lists per page:
|
|
40
50
|
|
|
41
51
|
- **Build (`builder_compose_page`):** for a new page, `builder_create_page`, then one `builder_compose_page` call with the whole tree; for a converted page, the block changes on `livePage.ref`, through `mockup_apply_to_page` first when you have it; without the builder MCP, the page class.
|
|
42
|
-
- **
|
|
52
|
+
- **Sections (`categories`):** the categories to create, and each page's.
|
|
53
|
+
- **Blocks:** in the spec's order, with their options; each table with its displays, tabs, board, views and forms; each link with its real route.
|
|
54
|
+
- **Sub-pages:** each with its parent, its slug and whether the menu lists it.
|
|
43
55
|
- **Data (`liveRoutes`):** per fixture, its route from `liveRoutes` on a converted page, else the resource or query it binds to; the resources and queries to create.
|
|
44
|
-
- **Components (`CustomComponent`):** a `CustomComponent` for each sketch other than a live sketch, or its `Placeholder` in Safe mode.
|
|
56
|
+
- **Components (`CustomComponent`):** a `CustomComponent` for each sketch other than a live sketch and each part of a custom page no block draws, or its `Placeholder` in Safe mode, with the states each one draws; the sidebar widgets, once for the app.
|
|
45
57
|
|
|
46
58
|
Write nothing before the user approves it.
|
|
47
59
|
|
|
48
60
|
## 3. Build
|
|
49
61
|
|
|
50
|
-
|
|
62
|
+
Create the sections first, then each page, in the spec's order:
|
|
51
63
|
|
|
52
|
-
- **Builder MCP:** for a new page, `builder_create_page`, then one `builder_compose_page` call with the page's whole tree, previewed first (`"preview": true`) as **dms-page-design** _Build a page in one call_ says. Create the resources and queries the page reads before the page.
|
|
64
|
+
- **Builder MCP:** for a new page, `builder_create_page`, then one `builder_compose_page` call with the page's whole tree, previewed first (`"preview": true`) as **dms-page-design** _Build a page in one call_ says. Create the resources and queries the page reads before the page. A page whose table maps a database relation is written by `builder_map_resources` instead: add its other blocks with `builder_compose_page` on that page's `pageRef` and a `placement`.
|
|
53
65
|
- **Code:** write the page class, its routes and DataControllers with **dms-pages**, then run the typecheck. Page code imports from `@antelopejs/interface-dms` and the other interface packages **dms-pages** names, never from `@antelopejs/dms`, which exports no page API.
|
|
54
66
|
- **Custom components:** with **dms-pages**, after the builder's write; then `builder_refresh` on the page when the builder MCP answers.
|
|
55
67
|
|
|
@@ -57,7 +69,7 @@ A page is built when it typechecks and, checked as **dms-builder-mcp** _Verify_
|
|
|
57
69
|
|
|
58
70
|
### Pages converted from a live page
|
|
59
71
|
|
|
60
|
-
`livePage.version` is the `version` (a hash of the page's source file) that `builder_page_structure` answered at conversion. Compare it with the `version` of `builder_page_structure` on `livePage.ref` for every converted page, when you plan and again before the first write of the build, resources and queries included. A different `version` means the page changed in code since
|
|
72
|
+
`livePage.version` is the `version` (a hash of the page's source file) that `builder_page_structure` answered at conversion. Compare it with the `version` of `builder_page_structure` on `livePage.ref` for every converted page, when you plan and again before the first write of the build, resources and queries included. A different `version` means the page changed in code since its conversion: the page is **stale**. Write nothing to it, and ask the user one question that says so and offers to convert it again (`mockup_from_page` with `{ pageRef: livePage.ref, replace: true }`, which discards the mockup's edits) or to build anyway. After a new conversion, start again at step 1. Build anyway only on the user's explicit go: read the structure again and apply the mockup's edits by block name only. The spec's other pages build as planned. Without the builder MCP there is no `version` to compare: build through the code and tell the user the page could not be checked.
|
|
61
73
|
|
|
62
74
|
**With `mockup_apply_to_page`** among your tools, call it for each converted page before any other write for that page, its resources and queries included: `mockup_apply_to_page({ mockup: "<name>", page: "<spec page id>" })`. It checks the version again itself; your compare before the first write of the build stays.
|
|
63
75
|
|
|
@@ -87,7 +99,7 @@ After the last round of step 4, stamp each converted page you wrote yourself (a
|
|
|
87
99
|
|
|
88
100
|
## 4. Verify and fix
|
|
89
101
|
|
|
90
|
-
A **round** verifies pages, then fixes what failed. Keep going while a page fails, up to **three rounds**: round 1 verifies every page of the plan, each later round the pages that failed before and every page a fix changed, and after the third verify you fix nothing more. A page passes when its last verify, leaving out the lines of its live sketches, finds no failure (with `page_verify`, `ok` or failing only on those lines) and no difference from the mockup, or only differences the user accepted. A page of the plan that was never built, or does not typecheck, fails with that error. A **difference** is a block missing, extra or out of order, another type, another option (title, format, variant, span, columns), a sketch whose component looks otherwise, or a block empty on the real page. Values that differ because real data replaced a fixture are no difference; a block empty where its fixture had data is one. A live sketch's lines are never differences nor fix targets: its sketch with no counterpart, its live block in `extraPageBlocks` or in a failure line. Report them under the live sketches kept, outside `<n>`.
|
|
102
|
+
A **round** verifies pages, then fixes what failed. Keep going while a page fails, up to **three rounds**: round 1 verifies every page of the plan, each later round the pages that failed before and every page a fix changed, and after the third verify you fix nothing more. A page passes when its last verify, leaving out the lines of its live sketches, finds no failure (with `page_verify`, `ok` or failing only on those lines) and no difference from the mockup, or only differences the user accepted. A page of the plan that was never built, or does not typecheck, fails with that error. Over a database, the dashboard fails when it is missing or when a KPI card or chart on it reads no query over a mapped relation (a `static*` value or a fixture left). A **difference** is a block missing, extra or out of order, another type, another option (title, format, variant, span, columns, a column's display, the tabs, a display mode, a view), a link, a sub-page or a form the mockup has and the real page lacks, a sketch or a custom page whose component looks otherwise, lacks one of its states or links elsewhere, a custom page built as one full-page `CustomComponent`, a sidebar widget missing or drawn otherwise, or a block empty on the real page. Values that differ because real data replaced a fixture are no difference; a block empty where its fixture had data is one. A live sketch's lines are never differences nor fix targets: its sketch with no counterpart, its live block in `extraPageBlocks` or in a failure line. Report them under the live sketches kept, outside `<n>`.
|
|
91
103
|
|
|
92
104
|
**With `page_verify`**, per page:
|
|
93
105
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dms-page-design
|
|
3
|
-
description: Designs AntelopeJS DMS pages that show data. Use when building or changing an analytics, stats or dashboard page or a table page, choosing a chart or a KPI for some data, picking a page's period, naming a page and its icon, or deciding how a table displays (badges, prices, relation labels, status tabs, saved views, kanban, cards, footer totals, KPI cards above the table).
|
|
3
|
+
description: Designs AntelopeJS DMS pages that show data. Use when building or changing an analytics, stats or dashboard page or a table page, choosing a chart or a KPI for some data, picking a page's period, naming a page and its icon, grouping an app's pages into menu sections, giving a list its details view and forms, linking pages together, or deciding how a table displays (badges, prices, relation labels, status tabs, saved views, kanban, cards, footer totals, KPI cards above the table).
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Designing data pages
|
|
@@ -53,6 +53,23 @@ arguments are in `dms-builder-mcp`, the code in `dms-pages`.
|
|
|
53
53
|
- Grouping by a foreign key shows ids. Group by the relation's own columns only; a breakdown by
|
|
54
54
|
a related entity's name goes under _Not possible yet_ in your report.
|
|
55
55
|
|
|
56
|
+
## The analytics dashboard
|
|
57
|
+
|
|
58
|
+
An app over an external database always has an analytics dashboard, asked for or not: every
|
|
59
|
+
plan, mockup and build over that data proposes and builds it.
|
|
60
|
+
|
|
61
|
+
- It holds `KpiCard`s and charts over real aggregates of the relations: sums of their measures
|
|
62
|
+
and row counts, over their time axis and their category columns. A build reads each one
|
|
63
|
+
through a query on a mapped relation, never a `static*` value; a mockup's fixtures stand for
|
|
64
|
+
those queries.
|
|
65
|
+
- It is laid out as _Lay out an analytics page_ says and sits first in the menu (`order: 0`),
|
|
66
|
+
outside every section.
|
|
67
|
+
- An app of 3 or more sections may also give each section a dashboard of its own, first in
|
|
68
|
+
that section.
|
|
69
|
+
|
|
70
|
+
An app over a database is not done without that dashboard, or with one whose figures are not
|
|
71
|
+
aggregates of the data.
|
|
72
|
+
|
|
56
73
|
## Lay out an analytics page
|
|
57
74
|
|
|
58
75
|
Add the blocks in this order. Every analytics page has items 1 to 4.
|
|
@@ -115,6 +132,22 @@ never a title.
|
|
|
115
132
|
Set them with `builder_create_page` on new pages, per resource in `builder_map_resources`
|
|
116
133
|
(`title`, `icon`, `description`, `order`), or with `builder_configure_page` afterwards.
|
|
117
134
|
|
|
135
|
+
## Group pages into sections
|
|
136
|
+
|
|
137
|
+
An app of 6 or more pages is grouped into 2 to 5 **sections** by job, each titled in the
|
|
138
|
+
owner's words with an icon of its own: Sales (Orders, Payments, Coupons), Catalog (Products,
|
|
139
|
+
Categories), Customers (Customers, Reviews, Support tickets). Each section holds 2 to 6 pages;
|
|
140
|
+
a page with no partner joins the nearest section. The main dashboard sits on top, outside every
|
|
141
|
+
section: it stays in the category it is created in. A section's own dashboard (_The analytics
|
|
142
|
+
dashboard_) sits first in its section. An app of fewer pages has no sections. You decide the sections; the user edits them.
|
|
143
|
+
A page that belongs in a section the project has already goes there: in a mockup, a section of
|
|
144
|
+
that exact title, which the viewer draws as the app's own.
|
|
145
|
+
|
|
146
|
+
A section is a menu category: `builder_create_category` (`name`, `displayName`, `icon`,
|
|
147
|
+
`order`, `module`) answers its `ref`, which `builder_create_page` takes as `category`,
|
|
148
|
+
`builder_map_resources` per resource as `category` (create the section first, in the tables'
|
|
149
|
+
`module`), and `builder_configure_page` in `{ "category": "<ref>" }` to move a page there.
|
|
150
|
+
|
|
118
151
|
## Tables
|
|
119
152
|
|
|
120
153
|
A table page is a working tool: the reader finds a row, sees its state, and acts. Read the
|
|
@@ -124,6 +157,9 @@ rule below names the shape that earns the feature; decide from the columns' type
|
|
|
124
157
|
distinct counts, never from the relation's name. You never read a row's values: a value you
|
|
125
158
|
name comes from the schema, as a native enum's label.
|
|
126
159
|
|
|
160
|
+
**Caption.** Every table has a caption, the title above its rows: its page's title for the
|
|
161
|
+
page's main table, the question it answers otherwise ("Orders awaiting shipment").
|
|
162
|
+
|
|
127
163
|
**Columns.** A primary key gets no display and is never a row's label. A boolean keeps its
|
|
128
164
|
default display (no badge). A column that a view filters on, a tab splits on, or a footer
|
|
129
165
|
`where` reads must be `filterable` in the mapping; one that a view sorts on, `sortable`.
|
|
@@ -159,8 +195,9 @@ first, the highest amount first). Each view has a short label that states the qu
|
|
|
159
195
|
top, and `count: true` when the number itself matters. Keep views and tabs from repeating each
|
|
160
196
|
other: views for questions that cross columns or dates, tabs for the plain split by state.
|
|
161
197
|
|
|
162
|
-
**Display modes.** Offer another display when the data reads better that way
|
|
163
|
-
|
|
198
|
+
**Display modes.** Offer another display when the data reads better that way. The default
|
|
199
|
+
display (`defaultDisplay`) is the kanban for a status workflow, the cards for a catalogue whose
|
|
200
|
+
rows carry an image, and the table otherwise:
|
|
164
201
|
|
|
165
202
|
- **Kanban** (`kanban.groupBy`) when a single-choice status or stage column drawn as a badge
|
|
166
203
|
(by the Builder or over a native enum) describes a flow
|
|
@@ -189,6 +226,62 @@ an existing page with `builder_configure_table_view`. Through `builder_configure
|
|
|
189
226
|
a refused choice comes back as `invalid_config` with the setting it names: fix that one and
|
|
190
227
|
send again. Through `builder_map_resources` it comes back as a `page_not_written` warning.
|
|
191
228
|
|
|
229
|
+
## Records, forms and links
|
|
230
|
+
|
|
231
|
+
An app clicks through: from a figure to its rows, from a row to its record, and back.
|
|
232
|
+
|
|
233
|
+
- **A record needs a details view.** A list whose records the reader acts on (opens, edits,
|
|
234
|
+
approves, follows up) gets one; a lookup list (tags, settings, reference data) gets none.
|
|
235
|
+
- **Pick each table's details view and its add and edit forms.** When the user named none,
|
|
236
|
+
pick the most usable one per table from the tables below, and state each choice in your plan
|
|
237
|
+
or summary ("Customers: details, add and edit in a right drawer"). A mockup shows
|
|
238
|
+
it, so the user can change it. The real `TableView` with no `formContainer` opens a page per
|
|
239
|
+
form: write the chosen container explicitly, with `builder_configure_block` on the table or
|
|
240
|
+
in the page class.
|
|
241
|
+
|
|
242
|
+
| Details view | When |
|
|
243
|
+
| ----------------------------------------------------------- | ----------------------------------------------- |
|
|
244
|
+
| `{ "type": "modal" }`, `size` `sm` to `full` (default `xl`) | about 8 fields or fewer, a quick look |
|
|
245
|
+
| `{ "type": "drawer", "direction": "right" }` | reading a row while the list stays in view |
|
|
246
|
+
| `{ "type": "drawer" }` (`direction: "bottom"`, the default) | wide content, such as line items or a sub-table |
|
|
247
|
+
| `{ "type": "page" }`, a generated page | a long record, or one people share by link |
|
|
248
|
+
|
|
249
|
+
| Add and edit forms | When |
|
|
250
|
+
| -------------------------------------------- | ----------------------- |
|
|
251
|
+
| `{ "type": "modal" }` | up to about 6 fields |
|
|
252
|
+
| `{ "type": "drawer", "direction": "right" }` | 7 to 15 fields |
|
|
253
|
+
| `{ "type": "page" }`, a generated page | long or sectioned forms |
|
|
254
|
+
|
|
255
|
+
One table has one `formContainer`: when its details view and its forms point at different
|
|
256
|
+
containers, take the one for the forms when people edit rows, else the one for the details.
|
|
257
|
+
|
|
258
|
+
- **Group the fields.** Related fields (contact, address, billing) share a group. A generated
|
|
259
|
+
form groups the columns `@ColumnGroup(id, config)` and `@Column({ group })` declare; a mockup
|
|
260
|
+
writes a column's `group` and the table's `columnGroups`. A `ResourceForm` or a `Form` takes
|
|
261
|
+
`sections` (`{ id, label, description?, icon?, fields }`) with `sectionNav` `side`, `jump` or
|
|
262
|
+
`none`, and field groups `{ id, label?, fields }` inside them.
|
|
263
|
+
- **A custom details page is the user's call.** A details page of blocks, such as a `StatGroup`
|
|
264
|
+
or `KpiCard`s above a `ResourceForm` in `mode: "view"`, or the record's related lists, is
|
|
265
|
+
never chosen unasked. When it would clearly help, suggest it in one sentence ("a details page
|
|
266
|
+
could show the order's KPIs above the record, want it?") and build it only on a yes: a
|
|
267
|
+
sub-page of the list, left out of the menu, that opens on a click on its row, built as
|
|
268
|
+
**dms-best-practices** _Custom pages are blocks_ says.
|
|
269
|
+
- **Turn on only the actions the reader takes.** A connected database's table writes only on a
|
|
270
|
+
`read-write` connection, as **dms-external-database** _Connection access_ says.
|
|
271
|
+
- **Archive in place of delete** when records must not be erased (invoices, orders, people):
|
|
272
|
+
`archiveMode: true` on the `TableView` gives Archive and Restore: archive, edit and duplicate
|
|
273
|
+
on active rows, restore and delete on archived ones, behind a _Show archived_ toggle. The
|
|
274
|
+
archive field is `isArchived` (`@ArchiveField` in code). Only on a table that writes rows, so
|
|
275
|
+
over a connected database only with `read-write` access.
|
|
276
|
+
- **Link pages together.** Every summary links to what it summarises: a KPI or a card to the
|
|
277
|
+
table it counts, a dashboard tile to its page, a detail page back to its list, a toolbar
|
|
278
|
+
button to the page it opens. `KpiCard` takes no link: a figure that links is a `StatGroup`
|
|
279
|
+
cell (`to`), or sits in a `Card` whose head action (`actions: [{ label, to }]`) opens the
|
|
280
|
+
table.
|
|
281
|
+
|
|
282
|
+
A mockup writes these as [SPEC.md](../dms-mockup/SPEC.md) _Links and sub-pages_, _Table
|
|
283
|
+
forms_ and _Archive mode_ say.
|
|
284
|
+
|
|
192
285
|
## Build a page in one call, and check it first
|
|
193
286
|
|
|
194
287
|
Build every page, or every set of blocks added to a page, with one `builder_compose_page` call:
|
|
@@ -73,7 +73,7 @@ export class SubmitRecipePage extends PageController("submit-recipe", {
|
|
|
73
73
|
|
|
74
74
|
Blocks pull data from URLs. Declare routes with the `@antelopejs/interface-api` decorators (`Controller`, `Get`, `Post`, `@Parameter`, `@JSONBody`); return a plain object for 200 or throw `new HTTPResult(status, body)`. `GetModel(Model)` (from `@antelopejs/interface-database-decorators`) gives `get`, `getAll`, `insert`, `update` and `delete`. Routes under a controller that a page or DataController wraps **inherit** its auth (see **dms-auth**). A route declared on a page class is served under `/dms/pages`, not at the page's own path: name it with `pageRoutePath(slug, "/route")` from `@antelopejs/interface-dms/page` in a `fetchUrl` or `submitUrl`. A plain `Controller` the frontend calls sits under `/api/<module>/`.
|
|
75
75
|
|
|
76
|
-
A **`TableView` is normally backed by a `DataController`**: a class `extends DataController(TableClass, TableViewRoutes.All, Controller("/path"))` registered with `@RegisterDataController()` (both from `@antelopejs/interface-data-api`). `TableClass` is a `Table` declared with `@RegisterTable(name, schema)` from `@antelopejs/interface-database-decorators`. `TableViewRoutes` (from `@antelopejs/interface-dms/base/table-view`) has the presets `Get`, `List`, `Select`, `Count`, `New`, `Edit`, `Delete`, `Archive`, `Restore` and `All`. Field decorators: `@Column`, `@Select`, `@Exported`, `@ArchiveField`, `@Searchable` from `@antelopejs/interface-dms/base` (plus class-level `@ColumnGroup(id, config)`), `@Listable` and `@Sortable` from `@antelopejs/interface-data-api/metadata`. Read a real one first: `@antelopejs/interface-dms/data-controllers` (`members`); guide in `docs/components/data-controller`. Database rows carry **`_id`** as the primary key: return and type it as `_id`.
|
|
76
|
+
A **`TableView` is normally backed by a `DataController`**: a class `extends DataController(TableClass, TableViewRoutes.All, Controller("/path"))` registered with `@RegisterDataController()` (both from `@antelopejs/interface-data-api`). `TableClass` is a `Table` declared with `@RegisterTable(name, schema)` from `@antelopejs/interface-database-decorators`. `TableViewRoutes` (from `@antelopejs/interface-dms/base/table-view`) has the presets `Get`, `List`, `Select`, `Count`, `New`, `Edit`, `Delete`, `Archive`, `Restore` and `All`. Field decorators: `@Column`, `@Select`, `@Exported`, `@ArchiveField`, `@Searchable` from `@antelopejs/interface-dms/base` (plus class-level `@ColumnGroup(id, config)`), `@Listable` and `@Sortable` from `@antelopejs/interface-data-api/metadata`. Read a real one first: `@antelopejs/interface-dms/data-controllers` (`members`); guide in `docs/components/data-controller`. Database rows carry **`_id`** as the primary key: return and type it as `_id`. A table's details view and forms open where **dms-page-design** _Records, forms and links_ decides (`formContainer`), and a table over a connected database writes only as **dms-external-database** _Connection access_ allows.
|
|
77
77
|
|
|
78
78
|
## DataTypes
|
|
79
79
|
|