@nocobase/app-template-default 1.0.0-beta.74 → 1.0.0-beta.76
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/.agents/rules/build-and-deploy.md +4 -0
- package/.agents/rules/components.md +3 -1
- package/AGENTS.md +7 -1
- package/README.MD +3 -3
- package/cli/plugins.ts +2 -1
- package/client/components/data-table/data-table.tsx +2 -0
- package/client/components/data-table/pagination.tsx +6 -6
- package/client/components/flow-diagram.tsx +645 -83
- package/client/components/flow-layout.ts +117 -7
- package/client/components/lifecycle-diagram.tsx +175 -37
- package/client/components/record-link.tsx +20 -0
- package/client/components/required-role-setup.tsx +93 -0
- package/client/components/role-list.tsx +71 -31
- package/client/components/setup-readiness-state.ts +135 -0
- package/client/components/setup-readiness.tsx +91 -0
- package/client/components/ui/combobox.tsx +300 -0
- package/client/extensions/nocobase-workflow-management/README.md +3 -1
- package/client/extensions/nocobase-workflow-management/definition-list.tsx +19 -13
- package/client/extensions/nocobase-workflow-management/layout.tsx +1 -1
- package/client/hooks/use-table-url-state.ts +93 -0
- package/client/lib/navigation-transform.ts +2 -1
- package/client/lib/required-role-setup.ts +98 -0
- package/client/lib/return-to.ts +19 -0
- package/client/locales/system/en-US.ts +10 -0
- package/client/locales/system/settings-en-US.ts +38 -1
- package/client/locales/system/settings-zh-CN.ts +34 -2
- package/client/locales/system/zh-CN.ts +10 -0
- package/client/pages/settings/default-access-form.tsx +4 -1
- package/client/pages/settings/default-access.tsx +40 -8
- package/client/pages/settings/role-form.tsx +1 -1
- package/client/pages/settings/roles.tsx +47 -6
- package/client/pages/settings/shared.tsx +15 -13
- package/client/pages/settings/user-detail.tsx +15 -259
- package/client/pages/settings/user-form.tsx +299 -147
- package/client/pages/settings/users.tsx +211 -123
- package/client/plugins.ts +2 -0
- package/config.example.yml +6 -5
- package/package.json +16 -14
- package/server/plugins.ts +2 -0
- package/tests/components/default-access.test.tsx +141 -2
- package/tests/components/role-list.test.tsx +73 -8
- package/tests/components/roles.test.tsx +14 -7
- package/tests/components/settings-continuity.test.tsx +426 -0
- package/tests/components/settings-feedback.test.tsx +304 -0
- package/tests/components/settings.test.tsx +1 -1
- package/tests/components/setup-readiness.test.tsx +370 -0
- package/tests/components/table-url-state.test.tsx +95 -0
- package/tests/components/user-drawer.test.tsx +526 -0
- package/tests/logic/authorization-assignment-safety.test.ts +82 -0
- package/tests/logic/foundation-integration.test.ts +62 -0
- package/tests/logic/return-to.test.ts +19 -0
- package/tsconfig.json +1 -0
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Read this before changing the build, packing a deployment archive, building or editing the Docker image, setting `CDN_BASE_URL`, or building for another platform. The deployment process itself is in the [deployment Skill](../skills/nocobase-deployment/SKILL.md), and dependency placement and the build failure table are in [where to declare a dependency](../skills/nocobase-app-development/references/dependencies.md).
|
|
4
4
|
|
|
5
|
+
## Client typechecking
|
|
6
|
+
|
|
7
|
+
Keep `types: ["node"]` in the client `tsconfig.json`. Shared contracts from database and lifecycle packages resolve to their TypeScript sources in a workspace and require Node.js declarations during typechecking. Declare that requirement explicitly instead of relying on unrelated plugin imports to load the declarations; type-only imports still disappear from the browser bundle.
|
|
8
|
+
|
|
5
9
|
## CDN assets at build time
|
|
6
10
|
|
|
7
11
|
`CDN_BASE_URL` sets Vite's `base` only during a production build: `CDN_BASE_URL=https://cdn.example.com/my-app/v1/ pnpm build`. Use a full HTTPS URL ending in `/`; unset, empty or whitespace-only values keep the default `./`. `pnpm build` reads it from the process environment, then `.env.local`, then `.env`; development ignores it and continues using `APP_BASE_PATH`. It is a build parameter, absent from `config variables` and `dist/variables.json`, with no `config.yml` setting. Changing it requires rebuilding.
|
|
@@ -35,4 +35,6 @@ The default brand palette and density live in `client/theme/themes/*.css`; share
|
|
|
35
35
|
|
|
36
36
|
## Standard process management
|
|
37
37
|
|
|
38
|
-
The template includes `FlowDiagram`, `LifecycleDiagram` and `client/extensions/nocobase-workflow-management/` source. Reuse them when business workflows are introduced; preinstallation does not register a settings route or sample process. `LifecycleDiagram.configuration` automatically offers configuration for authorized native parameter bindings, using the application’s real parameter editor and API. Read [Lifecycle UI](../skills/nocobase-app-development/references/lifecycle-ui.md) before wiring the workflow directory, definition and execution pages.
|
|
38
|
+
The template includes `FlowDiagram`, `LifecycleDiagram` and `client/extensions/nocobase-workflow-management/` source. Reuse them when business workflows are introduced; preinstallation does not register a settings route or sample process. `LifecycleDiagram.configuration` automatically offers configuration for authorized native parameter bindings, using the application’s real parameter editor and API. Read [Lifecycle UI](../skills/nocobase-app-development/references/lifecycle-ui.md) before wiring the workflow directory, definition and execution pages. The existing `LifecycleDiagram` supports `presentation="process"` for compact approval/work cards and start/outcome pills, with `stateKind` supplied by the application; omitting it keeps the classic presentation. Preserve configuration and recorded-history behavior when selecting a presentation. UI Library names are shadcn registry items, not npm package names; an npm 404 is not evidence that a component is unavailable.
|
|
39
|
+
|
|
40
|
+
Use `RecordLink` from `#components/record-link` for clickable record names and identifiers in lists and tables. It uses foreground text with medium weight, an underline on hover, and an underline plus focus outline for keyboard navigation. Preserve the native link semantics and route query context. Do not give record fields a permanent underline, primary-blue text, or a button-shaped surface. Keep action buttons and menu items on their own components; do not globally restyle every link in the application.
|
package/AGENTS.md
CHANGED
|
@@ -53,7 +53,7 @@ A feature with a page and an API touches five places: a migration for the table,
|
|
|
53
53
|
|
|
54
54
|
## System settings are part of feature delivery
|
|
55
55
|
|
|
56
|
-
A bare create-app
|
|
56
|
+
A bare create-app shows Home to signed-in users and System settings → App foundation only to unrestricted administrators. The Foundation plugin owns this initial settings group; the navigation transform merges its entry into the application settings group when business administration is registered. As the application develops business capabilities, inspect its current state on every iteration and automatically register the prepared Users and Roles and permissions contribution from `client/pages/settings/routes.ts` once in `client/routes.ts`; preserve it and reconcile missing management surfaces on every iteration, without a first-build flag or one-time setup stage. Whenever an application adds lifecycles, workflows, approvals, notifications, files or other configurable capabilities, automatically include their real administration surfaces without requiring a second user request. Follow [system settings delivery](.agents/skills/nocobase-app-development/references/system-settings.md); in particular, every used process includes a definitions directory, standard diagram, supported parameters and authorized execution history. Do not add demo plugins or empty settings for unused capabilities. The template preinstalls `#components/lifecycle-diagram` (React Flow + ELK) and `client/extensions/nocobase-workflow-management/`: use them by default, preserve their visuals unless the user explicitly requests another style, and connect authorized parameter bindings through `LifecycleDiagram.configuration` to the real editor. These are UI Registry sources; an npm package lookup is not a component availability check.
|
|
57
57
|
|
|
58
58
|
## Rules that apply everywhere
|
|
59
59
|
|
|
@@ -123,3 +123,9 @@ When the built-in mechanism genuinely cannot express what is being asked, changi
|
|
|
123
123
|
| [.agents/rules/components.md](.agents/rules/components.md) | Adding or changing a component, a shadcn primitive, a UI Library item, or the visual design |
|
|
124
124
|
| [.agents/rules/shell.md](.agents/rules/shell.md) | Changing layouts, the header, sidebar, breadcrumbs, the account menu or loading indicators |
|
|
125
125
|
| [.agents/rules/build-and-deploy.md](.agents/rules/build-and-deploy.md) | Changing the build, packing a deployment, the Docker image, `CDN_BASE_URL`, or building for another platform |
|
|
126
|
+
|
|
127
|
+
## Visible and manageable role assignments
|
|
128
|
+
|
|
129
|
+
Assign application business roles to explicitly identified users through the prepared User management role-assignment UI. Never seed a business permission set onto `authenticated:*`, broaden the inherited platform `member` role, or write startup reconciliation that grants access to everyone merely to make a feature usable. Unchecked actions in one role do not revoke grants inherited from another. If the user explicitly requests a global default role, first deliver a permission-protected administration control that shows its recipients and allows changing or removing the assignment; show inherited roles and their source in user access details. Without that UI, use explicit user assignments and explain the limitation. Keep page access independent from business operations.
|
|
130
|
+
|
|
131
|
+
Run `pnpm exec vitest run tests/logic/authorization-assignment-safety.test.ts` after permission initialization changes and before delivery. It boots the real application on an isolated database and inspects initialized wildcard assignments and the inherited member role. Keep this test in generated applications. An intentional global default requires explicit user authorization, a working administration surface and corresponding acceptance tests before deliberately updating the expected baseline; do not delete, skip or loosen the guard to make tests pass. Test an ordinary user with only the configured role: inspect all effective grant sources and verify both hidden buttons and rejected direct API calls.
|
package/README.MD
CHANGED
|
@@ -6,7 +6,7 @@ You own everything in this directory. Add pages, API routes, database tables, an
|
|
|
6
6
|
|
|
7
7
|
## Default and Examples
|
|
8
8
|
|
|
9
|
-
Default provides the application shell and product capabilities without example plugins or business demo pages. Application-owned business API routes start empty, and new databases receive no article sample data. A bare create-app shows Home
|
|
9
|
+
Default provides the application shell and product capabilities without example plugins or business demo pages. Application-owned business API routes start empty, and new databases receive no article sample data. A bare create-app shows Home and, for unrestricted administrators only, System settings → App foundation. Foundation is installed and registered on both Client and Server; its read-only overview is available at `/foundation` under the application base path. As business capabilities are developed, the app development skill reconciles missing core administration on every iteration and registers the prepared Users and Roles and permissions contribution (`client/pages/settings/routes.ts`); each actually used configurable capability includes its administration as part of feature delivery. Its built-in Users integration lists direct Authorization Permission Sets as application roles, while access assigned to all authenticated users remains separate. Use `app-template-examples` for article management and runnable plugin demonstrations.
|
|
10
10
|
|
|
11
11
|
Existing Default installations retain their data when example plugins are unregistered. If an installation already ran the article migration, retain its original migration sources as described in the [upgrade migration rules](.agents/skills/nocobase-app-upgrade/references/edge-cases.md#migrations) before upgrading. Do not erase migration history or delete existing data to make an upgrade start.
|
|
12
12
|
|
|
@@ -403,9 +403,9 @@ Tests live in `tests/`, never beside the source they cover. Put logic and integr
|
|
|
403
403
|
|
|
404
404
|
Application tests use the `/server`, `/client` and `/cli` entries of `@nocobase/app-testing`. Start page tests from `tests/components/page-harness.test.tsx`: it uses `renderWithApp()` with real application hooks, strict translations, permission checks and a test toaster. Answer requests through `answerApi()` and replace external services through `services`, without also registering their owning plugins. The template's Vitest configuration includes client plugins in custom package scopes so their contexts and service tokens remain shared. See `.agents/skills/nocobase-app-development/references/testing.md` for fixture ownership and complete server, migration and CLI examples.
|
|
405
405
|
|
|
406
|
-
### Notification
|
|
406
|
+
### Notification verification
|
|
407
407
|
|
|
408
|
-
|
|
408
|
+
Exercise the application's business notification flow, or use a server-side command resolving `notificationServiceToken` and calling `send()` with complete messages and explicit recipients. Inspect the returned notification ID through the protected `/api/notifications/logs` API or the logs page installed by the application. Log access requires `page:notification.logs` `access`.
|
|
409
409
|
|
|
410
410
|
## API documentation
|
|
411
411
|
|
package/cli/plugins.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { defineCliPlugins, type AppCliPlugins } from '@nocobase/app-cli';
|
|
2
|
+
import foundation from '@nocobase/app-plugin-foundation/cli';
|
|
2
3
|
import scheduler from '@nocobase/app-plugin-scheduler/cli';
|
|
3
4
|
|
|
4
5
|
// Array order is command registration order. A plugin contributes its commands
|
|
5
6
|
// by appearing in this list; removing its entry and its import removes them.
|
|
6
|
-
const cliPlugins: AppCliPlugins = defineCliPlugins([scheduler]);
|
|
7
|
+
const cliPlugins: AppCliPlugins = defineCliPlugins([scheduler, foundation]);
|
|
7
8
|
|
|
8
9
|
export default cliPlugins;
|
|
@@ -107,6 +107,8 @@ export function DataTable<TData, TValue = unknown>({
|
|
|
107
107
|
data: tableData,
|
|
108
108
|
columns,
|
|
109
109
|
manualPagination,
|
|
110
|
+
// Controlled hosts own URL page resets and correction after writes.
|
|
111
|
+
autoResetPageIndex: paginationState === undefined,
|
|
110
112
|
rowCount,
|
|
111
113
|
manualSorting,
|
|
112
114
|
...(onPaginationChange ? { onPaginationChange } : {}),
|
|
@@ -69,9 +69,9 @@ export function DataTablePagination<TData>({
|
|
|
69
69
|
})
|
|
70
70
|
: null}
|
|
71
71
|
</div>
|
|
72
|
-
<div className='flex flex-wrap items-center gap-6 lg:gap-8'>
|
|
73
|
-
<div className='flex items-center gap-2'>
|
|
74
|
-
<p className='text-sm font-medium'>
|
|
72
|
+
<div className='flex min-w-0 flex-wrap items-center justify-end gap-x-6 gap-y-3 lg:gap-x-8'>
|
|
73
|
+
<div className='flex shrink-0 items-center gap-2'>
|
|
74
|
+
<p className='text-sm font-medium whitespace-nowrap'>
|
|
75
75
|
{t('dataTable.rowsPerPage', { defaultValue: 'Rows per page' })}
|
|
76
76
|
</p>
|
|
77
77
|
<Select
|
|
@@ -83,7 +83,7 @@ export function DataTablePagination<TData>({
|
|
|
83
83
|
>
|
|
84
84
|
<SelectTrigger
|
|
85
85
|
size='sm'
|
|
86
|
-
className='w-[70px]'
|
|
86
|
+
className='w-[70px] shrink-0'
|
|
87
87
|
aria-label={t('dataTable.rowsPerPage', {
|
|
88
88
|
defaultValue: 'Rows per page',
|
|
89
89
|
})}
|
|
@@ -102,14 +102,14 @@ export function DataTablePagination<TData>({
|
|
|
102
102
|
</SelectContent>
|
|
103
103
|
</Select>
|
|
104
104
|
</div>
|
|
105
|
-
<div className='
|
|
105
|
+
<div className='shrink-0 text-sm font-medium whitespace-nowrap tabular-nums'>
|
|
106
106
|
{t('dataTable.pageOf', {
|
|
107
107
|
defaultValue: 'Page {{page}} of {{pageCount}}',
|
|
108
108
|
page: pageIndex + 1,
|
|
109
109
|
pageCount,
|
|
110
110
|
})}
|
|
111
111
|
</div>
|
|
112
|
-
<div className='flex items-center gap-2'>
|
|
112
|
+
<div className='flex shrink-0 items-center gap-2'>
|
|
113
113
|
<Button
|
|
114
114
|
variant='outline'
|
|
115
115
|
size='icon-sm'
|