You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(docs): Enhance documentation with detailed descriptions for various tutorials and plugins
- Added descriptions to the "Getting Started", "Hello World", "Glossary", and various customization tutorials to improve clarity and guidance.
- Updated plugin documentation with comprehensive descriptions for each plugin, including setup instructions and usage scenarios.
- Improved the overall structure and readability of the documentation by ensuring consistent formatting and adding necessary metadata.
- Introduced a new Docusaurus plugin for better markdown handling and enhanced CLI command references.
- Deprecated the bulk action request in the Common types, advising against its use in favor of custom actions.
Co-authored-by: Copilot <copilot@github.com>
description: "Use when implementing AdminForth custom Vue UI: field components, page injections, login or global injections, meta-driven component declarations, and frontend packages inside custom/."
4
+
user-invocable: true
5
+
---
6
+
7
+
# AdminForth Custom Vue Workflow
8
+
9
+
## When to Use
10
+
11
+
- Editing files under `custom/`.
12
+
- Adding custom field renderers or editors via `column.components`.
13
+
- Adding resource page injections, login injections, or global layout injections.
14
+
- Passing `meta` into reusable Vue components.
15
+
- Installing frontend packages used only by custom AdminForth Vue code.
16
+
17
+
## `custom/` Directory and `@@/`
18
+
19
+
- `custom/` is the frontend workspace for AdminForth custom Vue code.
20
+
- By default, `@@/Something.vue` means “resolve this path from `customComponentsDir` on the backend”, and `customComponentsDir` defaults to `./custom`.
21
+
- Example: `@@/reports/OrdersHeader.vue` maps to `./custom/reports/OrdersHeader.vue`.
22
+
- The same `@@/` prefix also works for assets and helper files that are bundled into the SPA.
23
+
24
+
## Frontend Packages in `custom/`
25
+
26
+
- Install frontend-only dependencies inside `custom/`, not in the app root.
- Use full declaration when the same component should behave differently in different places.
101
+
- `meta` is passed into the Vue component as a prop.
102
+
- Common `meta` use cases are reusable display options, plugin settings, `thinEnoughToShrinkTable`, `afOrder`, or custom page layout flags.
103
+
104
+
## Field Component Spots
105
+
106
+
- `components.show`: custom value renderer on show page.
107
+
- `components.showRow`: replaces the full show-table row.
108
+
- `components.create`: custom editor on create page.
109
+
- `components.edit`: custom editor on edit page.
110
+
- `components.list`: custom value renderer in list cells.
111
+
- `components.filter`: custom filter input.
112
+
113
+
## Field Component Props and Emits
114
+
115
+
- `show` and `list` components should expect `column`, `record`, `resource`, `adminUser`, and optional `meta`.
116
+
- In practice, custom `edit` and `create` components receive `column`, `value`, `record`, `resource`, `adminUser`, `readonly`, and optional `meta`.
117
+
- Custom `edit` and `create` components can emit:
118
+
- `update:value` to change the current field value.
119
+
- `update:recordFieldValue` to change another field in the same record.
120
+
- `update:inValidity` to report custom validation state.
121
+
- `update:emptiness` to report custom emptiness rules.
122
+
- If you update hidden technical fields through `update:recordFieldValue`, the target column may need `allowModifyWhenNotShowInCreate` or `allowModifyWhenNotShowInEdit`.
- On list pages, AdminForth tries to keep the table itself scrollable when there are no large top or bottom injections.
308
+
- That shrink behavior is affected by four list injection spots: `beforeBreadcrumbs`, `afterBreadcrumbs`, `beforeActionButtons`, and `bottom`.
309
+
- If none of those four spots are used, the table tries to shrink into the viewport and vertical scrolling happens inside the table area.
310
+
- If any of those spots are used, AdminForth assumes the page may now need extra vertical space, so the table stops shrinking and page scrolling moves to the document body instead.
311
+
- If your injected panel is actually compact, set `meta.thinEnoughToShrinkTable:true` on that injection.
312
+
- Important: every injection in those four spots must set `thinEnoughToShrinkTable:true`, otherwise the table will still stay in non-shrinking mode.
313
+
314
+
```ts
315
+
options: {
316
+
pageInjections: {
317
+
list: {
318
+
bottom: {
319
+
file:'@@/reports/OrdersSummary.vue',
320
+
meta: {
321
+
thinEnoughToShrinkTable:true,
322
+
},
323
+
},
324
+
},
325
+
},
326
+
}
327
+
```
328
+
329
+
## Row-Level List Injection Notes
330
+
331
+
- `tableBodyStart` renders extra `<tr>` rows near the start of the table body and receives `resource`, `adminUser`, and `meta`.
332
+
- `tableRowReplace` replaces the default `<tr>` for each record and receives `record`, `resource`, `adminUser`, and `meta`.
333
+
- `customActionIcons` and `customActionIconsThreeDotsMenuItems` are per-record spots and receive `record`, `resource`, `adminUser`, `meta`, and `updateRecords`.
334
+
335
+
## Practical Rules
336
+
337
+
- Prefer simple string declarations until you actually need `meta`.
338
+
- Reuse one component with multiple full declarations instead of cloning similar files.
339
+
- Keep page injections small unless the layout intentionally becomes page-scrolling.
340
+
- Keep custom edit and create components explicit about validity and emptiness if the default input heuristics are not enough.
0 commit comments