@vc-shell/vc-app-skill 2.0.0-alpha.23 → 2.0.0-alpha.24
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/CHANGELOG.md +8 -0
- package/bin/knowledge-stats.cjs +135 -0
- package/bin/sync-docs.cjs +62 -0
- package/package.json +5 -1
- package/runtime/VERSION +1 -1
- package/runtime/agents/details-blade-generator.md +75 -14
- package/runtime/knowledge/docs/_BUILD_HASH.md +1 -1
- package/runtime/knowledge/docs/core/api/platform.docs.md +14 -7
- package/runtime/knowledge/docs/core/blade-navigation/blade-nav-composables.docs.md +6 -0
- package/runtime/knowledge/docs/core/composables/useApiClient/useApiClient.docs.md +6 -0
- package/runtime/knowledge/docs/core/composables/useAssetsManager/useAssetsManager.docs.md +149 -0
- package/runtime/knowledge/docs/core/composables/useAsync/useAsync.docs.md +7 -0
- package/runtime/knowledge/docs/core/composables/useBlade/useBlade.docs.md +7 -0
- package/runtime/knowledge/docs/core/composables/useDashboard/useDashboard.docs.md +6 -0
- package/runtime/knowledge/docs/core/composables/useMenuService/useMenuService.docs.md +6 -0
- package/runtime/knowledge/docs/core/composables/usePermissions/usePermissions.docs.md +6 -0
- package/runtime/knowledge/docs/core/composables/useToolbar/useToolbar.docs.md +6 -0
- package/runtime/knowledge/docs/core/plugins/ai-agent/ai-agent.docs.md +6 -0
- package/runtime/knowledge/docs/core/plugins/extension-points/extension-points.docs.md +6 -0
- package/runtime/knowledge/docs/core/plugins/global-error-handler/global-error-handler.docs.md +6 -0
- package/runtime/knowledge/docs/core/plugins/i18n/i18n.docs.md +74 -0
- package/runtime/knowledge/docs/core/plugins/modularity/modularity.docs.md +6 -0
- package/runtime/knowledge/docs/core/plugins/permissions/permissions.docs.md +6 -0
- package/runtime/knowledge/docs/core/plugins/signalR/signalR.docs.md +6 -0
- package/runtime/knowledge/docs/core/plugins/validation/validation.docs.md +6 -0
- package/runtime/knowledge/docs/modules/assets-manager/assets-manager.docs.md +29 -33
- package/runtime/knowledge/docs/shell/components/logout-button/logout-button.docs.md +3 -3
- package/runtime/knowledge/docs/ui/components/atoms/vc-button/vc-button.docs.md +11 -0
- package/runtime/knowledge/docs/ui/components/atoms/vc-card/vc-card.docs.md +11 -0
- package/runtime/knowledge/docs/ui/components/organisms/vc-blade/vc-blade.docs.md +11 -0
- package/runtime/knowledge/docs/ui/components/organisms/vc-table/vc-data-table.docs.md +12 -0
- package/runtime/knowledge/index.md +60 -0
- package/runtime/knowledge/patterns/assets-management.md +213 -0
- package/runtime/knowledge/patterns/child-blade-flow.md +277 -0
- package/runtime/knowledge/patterns/details-blade-pattern.md +350 -3
- package/runtime/knowledge/patterns/extension-points-usage.md +308 -0
- package/runtime/knowledge/patterns/form-validation.md +377 -0
- package/runtime/knowledge/patterns/multilanguage-fields.md +239 -0
- package/runtime/knowledge/patterns/signalr-notifications.md +237 -0
- package/runtime/vc-app.md +44 -5
- package/runtime/knowledge/docs/shell/components/app-switcher/app-switcher.docs.md +0 -104
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Accesses the navigation menu service for adding, removing, and badging menu items in the application sidebar. The service supports a pre-registration pattern that allows modules to declare menu items before the service is initialized, and a grouping system that organizes items into collapsible sections.
|
|
4
4
|
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Register sidebar navigation items during module setup (use standalone `addMenuItem`)
|
|
8
|
+
- Add, remove, or badge menu items at runtime inside components (use `useMenuService()`)
|
|
9
|
+
- When NOT to use: for dashboard widgets -- use `useDashboard` / `registerDashboardWidget`; for settings-page entries -- use `useSettingsMenu`
|
|
10
|
+
|
|
5
11
|
## Quick Start
|
|
6
12
|
|
|
7
13
|
```typescript
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Checks whether the current user has specific platform permissions. This composable reads the authenticated user's permission list and provides a `hasAccess` function for conditional UI rendering and access control. It is client-side only -- it does not enforce server-side authorization.
|
|
4
4
|
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Conditionally show or hide UI elements (buttons, toolbar items, sections) based on the current user's permissions
|
|
8
|
+
- Guard blade access or toolbar registration with client-side permission checks
|
|
9
|
+
- When NOT to use: as the sole authorization mechanism -- always pair with server-side enforcement; for checking authentication status -- use `useUser` instead
|
|
10
|
+
|
|
5
11
|
## Quick Start
|
|
6
12
|
|
|
7
13
|
```typescript
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Manages toolbar buttons for blades. Each blade in the application has its own toolbar area at the top of the blade header. `useToolbar` provides a scoped API to register, update, and remove buttons within that toolbar. It automatically resolves the current blade context and cleans up registered items when the component unmounts.
|
|
4
4
|
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
- Add action buttons (Save, Delete, Refresh, Export) to a blade's toolbar header
|
|
8
|
+
- Dynamically update button state (disabled, visible, icon) in response to loading or form changes
|
|
9
|
+
- When NOT to use: for global app-bar actions -- use `useAppBarWidget`; for navigation links -- use `useMenuService`
|
|
10
|
+
|
|
5
11
|
## Quick Start
|
|
6
12
|
|
|
7
13
|
```typescript
|
|
@@ -6,6 +6,12 @@ Integrates an AI assistant panel (chatbot iframe) into the vc-shell application.
|
|
|
6
6
|
|
|
7
7
|
The AI agent plugin embeds an external chatbot via an iframe panel that slides in from the right side of the application. It automatically sends the current blade context (user, active blade, selected items) to the chatbot and handles incoming commands (navigate, preview changes, download files). The plugin is optional -- if no `APP_AI_AGENT_URL` environment variable or `config.url` is provided, it silently skips installation.
|
|
8
8
|
|
|
9
|
+
## When to Use
|
|
10
|
+
|
|
11
|
+
- Embed an AI assistant chatbot panel into your vc-shell application with automatic blade context passing
|
|
12
|
+
- Enable preview/apply workflows where AI suggests changes and the user confirms them
|
|
13
|
+
- When NOT to use: if you don't have an AI agent backend -- the plugin silently skips when no `APP_AI_AGENT_URL` is set
|
|
14
|
+
|
|
9
15
|
## Installation / Registration
|
|
10
16
|
|
|
11
17
|
```typescript
|
|
@@ -4,6 +4,12 @@ Extension points enable **cross-module UI composition** without direct imports.
|
|
|
4
4
|
|
|
5
5
|
This is how vc-shell achieves its modular architecture: modules can extend each other without compile-time dependencies.
|
|
6
6
|
|
|
7
|
+
## When to Use
|
|
8
|
+
|
|
9
|
+
- Module A needs to inject UI into Module B without a compile-time dependency (e.g., a "Reviews" tab inside a "Product Details" blade owned by another module)
|
|
10
|
+
- You need order-independent, runtime-resolved composition -- modules can load in any order
|
|
11
|
+
- When NOT to use: for simple parent-child communication within one module -- use props/slots/provide-inject instead; for data-only integration -- use events or a shared composable
|
|
12
|
+
|
|
7
13
|
---
|
|
8
14
|
|
|
9
15
|
## Table of Contents
|
package/runtime/knowledge/docs/core/plugins/global-error-handler/global-error-handler.docs.md
CHANGED
|
@@ -8,6 +8,12 @@ In a complex admin shell with dynamically loaded modules, errors can originate f
|
|
|
8
8
|
|
|
9
9
|
The global error handler solves this by installing three layers of error catching that cover all common error sources. Every caught error is parsed into a human-readable message and displayed as a toast notification, ensuring users always know when something goes wrong -- even if the module developer forgot to add error handling.
|
|
10
10
|
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
- This plugin is always active -- it catches unhandled errors from Vue components, async rejections, and uncaught JS errors automatically
|
|
14
|
+
- You don't need to install or configure it -- the framework does this during app setup
|
|
15
|
+
- When to be aware: if you handle errors manually in a composable (try/catch), the global handler won't fire for those -- which is the desired behavior
|
|
16
|
+
|
|
11
17
|
### Three Layers of Error Catching
|
|
12
18
|
|
|
13
19
|
1. **Vue `app.config.errorHandler`** -- catches errors thrown inside Vue components (render functions, lifecycle hooks, watchers, event handlers)
|
|
@@ -8,6 +8,12 @@ The vc-shell framework supports multiple languages through a centralized `vue-i1
|
|
|
8
8
|
|
|
9
9
|
This approach ensures consistency across the application: switching the active locale updates all modules simultaneously, fallback behavior is uniform, and there is a single source of truth for the current language.
|
|
10
10
|
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
- Add translated labels, messages, and error strings to any module (provide locale files via `defineAppModule({ locales })`)
|
|
14
|
+
- Access the current locale or switch languages at runtime via `useI18n()` or `useLanguages()`
|
|
15
|
+
- When NOT to use: this plugin is always active -- you never skip it. If you only need a single language, still use i18n keys for consistency
|
|
16
|
+
|
|
11
17
|
Modules do not install this plugin directly. Instead, they provide their locale messages via `defineAppModule({ locales })`, and the framework merges them into the global i18n instance using `i18n.global.mergeLocaleMessage()` during module installation.
|
|
12
18
|
|
|
13
19
|
## Installation / Registration
|
|
@@ -175,6 +181,74 @@ import { i18n } from "@vc-shell/framework";
|
|
|
175
181
|
const message = i18n.global.t("MY_MODULE.SOME_KEY");
|
|
176
182
|
```
|
|
177
183
|
|
|
184
|
+
## Customizing Framework Translations
|
|
185
|
+
|
|
186
|
+
The framework exports its locale files as typed ES modules. App developers can import them to create full translations or override specific keys.
|
|
187
|
+
|
|
188
|
+
### Importing Framework Locales
|
|
189
|
+
|
|
190
|
+
```typescript
|
|
191
|
+
import en from '@vc-shell/framework/locales/en'
|
|
192
|
+
import de from '@vc-shell/framework/locales/de'
|
|
193
|
+
import type { VcShellLocale, VcShellLocalePartial } from '@vc-shell/framework/locales/types'
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
The `VcShellLocale` interface provides autocomplete for all framework translation keys. Use it when creating a full translation to ensure no keys are missed.
|
|
197
|
+
|
|
198
|
+
### Creating a New Language
|
|
199
|
+
|
|
200
|
+
Spread the English locale as a base and override all sections:
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
import en from '@vc-shell/framework/locales/en'
|
|
204
|
+
import type { VcShellLocale } from '@vc-shell/framework/locales/types'
|
|
205
|
+
|
|
206
|
+
const fr: VcShellLocale = {
|
|
207
|
+
...en,
|
|
208
|
+
CORE: { THEMES: { LIGHT: "Clair", DARK: "Sombre" } },
|
|
209
|
+
SHELL: {
|
|
210
|
+
...en.SHELL,
|
|
211
|
+
ACCOUNT: {
|
|
212
|
+
SETTINGS: "Paramètres",
|
|
213
|
+
CHANGE_PASSWORD: "Changer le mot de passe",
|
|
214
|
+
PROFILE: "Profil",
|
|
215
|
+
LOGOUT: "Déconnexion",
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
COMPONENTS: {
|
|
219
|
+
...en.COMPONENTS,
|
|
220
|
+
// ... translate component strings
|
|
221
|
+
},
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Register in your app's main.ts or plugin setup:
|
|
225
|
+
app.config.globalProperties.$mergeLocaleMessage('fr', fr)
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Overriding Specific Keys
|
|
229
|
+
|
|
230
|
+
Use `VcShellLocalePartial` for partial overrides — all keys are optional:
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
import type { VcShellLocalePartial } from '@vc-shell/framework/locales/types'
|
|
234
|
+
|
|
235
|
+
const overrides: VcShellLocalePartial = {
|
|
236
|
+
SHELL: { ACCOUNT: { LOGOUT: "Sign Out" } }
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
app.config.globalProperties.$mergeLocaleMessage('en', overrides)
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Validating Your Translation
|
|
243
|
+
|
|
244
|
+
Run the CLI tool to check for missing or extra keys:
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
npx vc-check-locales ./src/locales/fr.json
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
In development mode, the framework also logs console warnings when a translation key is accessed but has no value for the current locale.
|
|
251
|
+
|
|
178
252
|
## Related
|
|
179
253
|
|
|
180
254
|
- `framework/core/plugins/modularity/index.ts` -- `defineAppModule` merges locale messages via `i18n.global.mergeLocaleMessage()`
|
|
@@ -4,6 +4,12 @@ The modularity plugin is the backbone of every vc-shell application. It defines
|
|
|
4
4
|
|
|
5
5
|
If you are building anything in vc-shell -- a new page, a CRUD flow, a dashboard widget, a notification handler -- you will start by creating a module.
|
|
6
6
|
|
|
7
|
+
## When to Use
|
|
8
|
+
|
|
9
|
+
- Package any feature as a self-contained unit with blades, menu items, locales, notifications, and permissions
|
|
10
|
+
- Every vc-shell feature starts here -- `defineAppModule()` is the entry point for all module development
|
|
11
|
+
- When NOT to use: for shared utilities or composables that have no UI -- export them as plain TypeScript modules instead
|
|
12
|
+
|
|
7
13
|
---
|
|
8
14
|
|
|
9
15
|
## Table of Contents
|
|
@@ -8,6 +8,12 @@ The VirtoCommerce platform uses a role-based permission system where each user i
|
|
|
8
8
|
|
|
9
9
|
The plugin installs the `hasAccess()` function from the `usePermissions()` composable as both a Vue global property (`$hasAccess`) and a provide/inject injectable (`"$hasAccess"`). This means permission checks are available everywhere: in templates via `$hasAccess()`, in composition API code via `usePermissions()`, and in any injecting component.
|
|
10
10
|
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
- Show/hide UI elements based on user permissions: `v-if="$hasAccess('order:create')"` in templates or `hasAccess()` in composables
|
|
14
|
+
- Guard toolbar buttons, menu items, or entire blade sections with client-side permission checks
|
|
15
|
+
- When NOT to use: as the sole authorization layer -- always enforce permissions server-side too; for authentication checks (logged in / logged out) -- use `useUser` instead
|
|
16
|
+
|
|
11
17
|
The framework installs this plugin automatically during app setup. Module developers never need to register it manually.
|
|
12
18
|
|
|
13
19
|
## Installation / Registration
|
|
@@ -4,6 +4,12 @@ Real-time push notification transport via ASP.NET SignalR. Connects to the platf
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
+
## When to Use
|
|
8
|
+
|
|
9
|
+
- Receive real-time push notifications from the platform (order updates, export progress, background job status)
|
|
10
|
+
- Display live notification toasts and badge counts without polling
|
|
11
|
+
- When NOT to use: for request-response API calls -- use `useApiClient`; for periodic data refresh -- use polling with `useAsync` instead
|
|
12
|
+
|
|
7
13
|
The VirtoCommerce platform uses ASP.NET SignalR to push real-time notifications to connected clients. These notifications cover events like order status changes, catalog exports completing, background job progress, and system alerts.
|
|
8
14
|
|
|
9
15
|
The SignalR plugin establishes a persistent WebSocket connection to the platform hub and listens for two event channels:
|
|
@@ -8,6 +8,12 @@ Form validation is a critical part of any admin interface. The vc-shell framewor
|
|
|
8
8
|
|
|
9
9
|
This plugin auto-registers every rule from `@vee-validate/rules` (required, email, min, max, etc.) via `defineRule()`, then adds custom rules specific to vc-shell use cases. Once registered, rules are available globally in any `<Field>` component, `useField()` composable, or validation schema -- no per-component imports needed.
|
|
10
10
|
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
- Validate form fields in blades using `<Field>` components or `useField()` with declarative rules (`required`, `email`, `min`, etc.)
|
|
14
|
+
- Use custom vc-shell rules: image dimensions (`validateImageMinSize`), file weight, date comparisons, BigInt safety
|
|
15
|
+
- When NOT to use: for API-level validation -- that belongs server-side; for simple presence checks on non-form data -- use plain conditionals
|
|
16
|
+
|
|
11
17
|
The framework imports this module during setup. No manual installation is needed by module developers.
|
|
12
18
|
|
|
13
19
|
## Installation / Registration
|
|
@@ -4,7 +4,7 @@ A built-in blade module for managing file assets (images, documents, archives).
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
The Assets Manager is registered as an app module via `defineAppModule` and opened as a child blade from any parent blade that needs asset management. The parent
|
|
7
|
+
The Assets Manager is registered as an app module via `defineAppModule` and opened as a child blade from any parent blade that needs asset management. The parent creates a `useAssetsManager` instance and passes it through `options.manager` -- the module handles the UI and delegates data mutations through the manager.
|
|
8
8
|
|
|
9
9
|
## Module Registration
|
|
10
10
|
|
|
@@ -17,56 +17,51 @@ import { AssetsManagerModule } from "@vc-shell/framework";
|
|
|
17
17
|
|
|
18
18
|
The module exports `AssetsManagerModule` (a Vue plugin) and the `AssetsManager` component, which is declared as a global component.
|
|
19
19
|
|
|
20
|
-
##
|
|
20
|
+
## Options (via `useBlade`)
|
|
21
21
|
|
|
22
|
-
The blade
|
|
22
|
+
The blade reads its configuration from `options` via `useBlade<AssetsManagerOptions>()` (not props):
|
|
23
23
|
|
|
24
24
|
| Option | Type | Description |
|
|
25
25
|
|---|---|---|
|
|
26
|
-
| `title` | `string
|
|
27
|
-
| `
|
|
28
|
-
| `
|
|
29
|
-
| `
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
| `disabled` | `boolean` | When true, hides upload/delete actions and disables reordering |
|
|
33
|
-
| `hiddenFields` | `string[]` | Fields to hide in the detail view |
|
|
26
|
+
| `title` | `string?` | Custom blade title (defaults to i18n `ASSETS_MANAGER.TITLE`) |
|
|
27
|
+
| `manager` | `UseAssetsManagerReturn` | The asset manager instance from `useAssetsManager()`. **Must be wrapped in `markRaw()`** |
|
|
28
|
+
| `disabled` | `boolean?` | When true, hides upload/delete actions and disables reordering |
|
|
29
|
+
| `hiddenFields` | `string[]?` | Fields to hide in the detail view |
|
|
30
|
+
|
|
31
|
+
> **Breaking change:** The old options (`assets`, `loading`, `assetsUploadHandler`, `assetsEditHandler`, `assetsRemoveHandler`) have been removed. Pass a single `manager` instance instead. See [migration guide #32](../../../migration/32-use-assets-manager.md).
|
|
34
32
|
|
|
35
33
|
## Usage
|
|
36
34
|
|
|
37
35
|
Open the Assets Manager as a child blade:
|
|
38
36
|
|
|
39
37
|
```typescript
|
|
40
|
-
import {
|
|
38
|
+
import { markRaw } from "vue";
|
|
39
|
+
import { useBlade, useAssetsManager } from "@vc-shell/framework";
|
|
40
|
+
|
|
41
|
+
const { openBlade } = useBlade();
|
|
41
42
|
|
|
42
|
-
const
|
|
43
|
+
const assetsManager = useAssetsManager(product.assets, {
|
|
44
|
+
uploadPath: () => `/catalog/${product.id}`,
|
|
45
|
+
confirmRemove: () => confirm("Delete selected assets?"),
|
|
46
|
+
});
|
|
43
47
|
|
|
44
48
|
openBlade({
|
|
45
|
-
|
|
49
|
+
name: "AssetsManager",
|
|
46
50
|
options: {
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
// IMPORTANT: markRaw prevents Vue from wrapping the manager in a
|
|
52
|
+
// deep reactive proxy. Without it, blade options (stored in
|
|
53
|
+
// ref<BladeDescriptor[]>) auto-unwrap nested Refs, breaking
|
|
54
|
+
// manager.items.value and manager.loading.value access.
|
|
55
|
+
manager: markRaw(assetsManager),
|
|
49
56
|
disabled: !canEdit.value,
|
|
50
57
|
hiddenFields: ["sortOrder"],
|
|
51
|
-
assetsUploadHandler: async (files) => {
|
|
52
|
-
const uploaded = await uploadFiles(files);
|
|
53
|
-
return [...product.assets, ...uploaded];
|
|
54
|
-
},
|
|
55
|
-
assetsEditHandler: (assets) => {
|
|
56
|
-
product.assets = assets;
|
|
57
|
-
return assets;
|
|
58
|
-
},
|
|
59
|
-
assetsRemoveHandler: async (assets) => {
|
|
60
|
-
await deleteAssets(assets);
|
|
61
|
-
return product.assets.filter(a => !assets.includes(a));
|
|
62
|
-
},
|
|
63
58
|
},
|
|
64
59
|
});
|
|
65
60
|
```
|
|
66
61
|
|
|
67
62
|
## Features
|
|
68
63
|
|
|
69
|
-
- **Table view**: Displays assets with thumbnail, name, size, sort order, and creation date columns.
|
|
64
|
+
- **Table view**: Displays assets with thumbnail, name, size, sort order, and creation date columns using `VcDataTable` with declarative `<VcColumn>` API.
|
|
70
65
|
- **Upload**: Via toolbar button or drag-and-drop onto the table. Handles duplicate filenames by appending `_1`, `_2`, etc.
|
|
71
66
|
- **Delete**: Toolbar delete button (requires selection) and per-row action button.
|
|
72
67
|
- **Reorder**: Drag-and-drop row reordering when not in readonly mode.
|
|
@@ -79,17 +74,18 @@ openBlade({
|
|
|
79
74
|
| Button | Condition | Action |
|
|
80
75
|
|---|---|---|
|
|
81
76
|
| Add | `!disabled` | Opens file picker for upload |
|
|
82
|
-
| Delete | `!disabled` and items selected | Calls `
|
|
77
|
+
| Delete | `!disabled` and items selected | Calls `manager.removeMany()` with selected items |
|
|
83
78
|
|
|
84
79
|
## Tips
|
|
85
80
|
|
|
86
|
-
-
|
|
81
|
+
- **Always use `markRaw()` when passing manager through blade options.** Blade descriptors are stored in `ref<BladeDescriptor[]>()`, which creates a deep reactive proxy. Vue auto-unwraps `Ref` values inside reactive objects, so `manager.items` would become a plain array instead of `Ref<AssetLike[]>` — breaking `.value` access. `markRaw()` prevents this by telling Vue not to make the manager reactive.
|
|
82
|
+
- The `manager` object (from `useAssetsManager()`) owns the reactive asset list and all mutation methods. The blade reads `manager.items` and calls `manager.upload()`, `manager.remove()`, `manager.removeMany()`, `manager.reorder()`, and `manager.updateItem()`.
|
|
87
83
|
- The `disabled` prop makes the entire blade readonly: no upload, no delete, no reorder.
|
|
88
84
|
- Asset thumbnails use `isImage()` from shared utilities to determine if an image preview or a file-type icon should be shown.
|
|
89
|
-
- The module uses `
|
|
85
|
+
- The module uses `useBlade()` internally to open the detail sub-blade.
|
|
90
86
|
|
|
91
87
|
## Related
|
|
92
88
|
|
|
89
|
+
- `framework/core/composables/useAssetsManager/` -- `useAssetsManager`, `AssetLike`, `UseAssetsManagerReturn`
|
|
93
90
|
- `framework/shared/utilities/assets.ts` -- `isImage`, `getFileThumbnail`, `readableSize`
|
|
94
91
|
- `framework/core/utilities/date/` -- `formatDateRelative` for creation dates
|
|
95
|
-
- `framework/core/types/` -- `ICommonAsset` interface
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# LogoutButton
|
|
2
2
|
|
|
3
|
-
Settings menu action that signs the user out, closes all open blades, and redirects to the login page. This component encapsulates the full sign-out flow: it injects `CloseSettingsMenuKey` to dismiss the parent menu before navigation, calls `useUserManagement().signOut()` to clear the authentication token, and uses `
|
|
3
|
+
Settings menu action that signs the user out, closes all open blades, and redirects to the login page. This component encapsulates the full sign-out flow: it injects `CloseSettingsMenuKey` to dismiss the parent menu before navigation, calls `useUserManagement().signOut()` to clear the authentication token, and uses `useBladeStack()` to close open child blades so the user does not return to stale blade state on next login.
|
|
4
4
|
|
|
5
5
|
## When to Use
|
|
6
6
|
|
|
@@ -37,7 +37,7 @@ settingsMenu.register({
|
|
|
37
37
|
|
|
38
38
|
## Key Props
|
|
39
39
|
|
|
40
|
-
This component has no props. It uses `useUserManagement()` for sign-out and `
|
|
40
|
+
This component has no props. It uses `useUserManagement()` for sign-out and `useBladeStack()` to close blades.
|
|
41
41
|
|
|
42
42
|
## Recipe: Module with Complete Settings Menu Registration
|
|
43
43
|
|
|
@@ -71,7 +71,7 @@ export default {
|
|
|
71
71
|
## Details
|
|
72
72
|
|
|
73
73
|
- **Menu dismissal**: Before starting the sign-out flow, the component calls the injected `CloseSettingsMenuKey` function to close the dropdown. This prevents a visual artifact where the menu stays open while the page redirects.
|
|
74
|
-
- **Blade cleanup**: All open blades are closed via `
|
|
74
|
+
- **Blade cleanup**: All open child blades are closed via `useBladeStack()` before redirecting. This avoids orphaned blade state in the navigation stack.
|
|
75
75
|
- **Redirect**: After sign-out completes, the user is redirected to the `/login` route.
|
|
76
76
|
- **External providers**: If the user signed in through an external SSO provider, the sign-out flow also triggers the provider's logout redirect via `useExternalProvider().signOut()`.
|
|
77
77
|
|
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
A versatile button component supporting 9 style variants, 5 size options, loading state, and icon integration. VcButton is the primary interactive element for triggering actions throughout the application -- from toolbar buttons and form submissions to inline table actions and navigation.
|
|
4
4
|
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
| Scenario | Component |
|
|
8
|
+
|----------|-----------|
|
|
9
|
+
| Triggering an action (save, delete, submit) | **VcButton** |
|
|
10
|
+
| Navigating to another URL or route | `<router-link>` or `<a>` tag |
|
|
11
|
+
| Action inside a blade toolbar | `IBladeToolbar` items (rendered as buttons automatically) |
|
|
12
|
+
| Inline text-style link within a paragraph | Native `<a>` or `<router-link>` |
|
|
13
|
+
|
|
14
|
+
Use VcButton for any user-initiated action that does not navigate to a URL. **Do not use** VcButton for navigation -- the `link` variant looks like a link but calls `preventDefault()`, so actual URL navigation will not work. For toolbar actions, define `IBladeToolbar` objects instead of placing VcButton manually.
|
|
15
|
+
|
|
5
16
|
## Quick Start
|
|
6
17
|
|
|
7
18
|
```vue
|
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
A bordered container with an optional header, icon, action buttons, and collapsible body. VcCard groups related content into visually distinct sections on blades and detail views. It supports three color variants for semantic meaning and smooth animated collapse/expand.
|
|
4
4
|
|
|
5
|
+
## When to Use
|
|
6
|
+
|
|
7
|
+
| Scenario | Component |
|
|
8
|
+
|----------|-----------|
|
|
9
|
+
| Grouping form fields or content with a header | **VcCard** |
|
|
10
|
+
| Scrollable content wrapper without a header | [VcContainer](../vc-container/) |
|
|
11
|
+
| Collapsible section with rich toggle behavior | [VcAccordion](../../molecules/vc-accordion/) (for multiple exclusive panels) |
|
|
12
|
+
| Alert or notification banner | [VcBanner](../vc-banner/) |
|
|
13
|
+
|
|
14
|
+
Use VcCard to visually separate content sections on a blade -- especially when you need a titled header, action buttons, or collapsible body. **Do not use** VcCard for dismissible alerts or status messages (use `VcBanner`), and avoid nesting VcCard when a simple `VcContainer` with padding would suffice.
|
|
15
|
+
|
|
5
16
|
## Quick Start
|
|
6
17
|
|
|
7
18
|
```vue
|
|
@@ -25,6 +25,17 @@ Traditional admin panels use page-based routing: click a link, the entire viewpo
|
|
|
25
25
|
| Layout | Full viewport | Side-by-side panels |
|
|
26
26
|
| Depth | Flat (1 level) | Unlimited nesting |
|
|
27
27
|
|
|
28
|
+
## When to Use
|
|
29
|
+
|
|
30
|
+
| Scenario | Component |
|
|
31
|
+
|----------|-----------|
|
|
32
|
+
| Stacked panel with toolbar, header, and lifecycle | **VcBlade** |
|
|
33
|
+
| One-off confirmation or input dialog | [VcPopup](../../molecules/vc-popup/) |
|
|
34
|
+
| Full-page route without blade stack | Vue Router view |
|
|
35
|
+
| Scrollable content section inside a blade | [VcContainer](../../molecules/vc-container/) |
|
|
36
|
+
|
|
37
|
+
Use VcBlade for every screen in a vc-shell application -- it is the standard container that integrates with the navigation system, toolbar, breadcrumbs, and unsaved-changes guards. **Do not use** VcBlade for transient dialogs (use `VcPopup` / `usePopup()`) or for content areas that do not need their own header and close button.
|
|
38
|
+
|
|
28
39
|
## Quick Start
|
|
29
40
|
|
|
30
41
|
```vue
|
|
@@ -18,6 +18,17 @@ Columns are defined as `<VcColumn>` child components -- no configuration objects
|
|
|
18
18
|
- State persistence (column widths, order, sort, filters) to localStorage/sessionStorage
|
|
19
19
|
- Full TypeScript generics -- `VcDataTable<Product>` propagates types to events and slots
|
|
20
20
|
|
|
21
|
+
## When to Use
|
|
22
|
+
|
|
23
|
+
| Scenario | Component |
|
|
24
|
+
|----------|-----------|
|
|
25
|
+
| Tabular data with sorting, selection, pagination | **VcDataTable** |
|
|
26
|
+
| Simple short list without table features | `v-for` with custom markup |
|
|
27
|
+
| Image/card grid layout | [VcGallery](../vc-gallery/) |
|
|
28
|
+
| Key-value detail display | [VcField](../../molecules/vc-field/) or [VcCard](../../atoms/vc-card/) |
|
|
29
|
+
|
|
30
|
+
Use VcDataTable whenever you need structured rows and columns with any combination of sorting, filtering, inline editing, or column management. **Do not use** VcDataTable for simple lists of 5-10 items that need no table features -- a plain `v-for` loop is lighter. For thumbnail/card grids, prefer VcGallery.
|
|
31
|
+
|
|
21
32
|
---
|
|
22
33
|
|
|
23
34
|
## Table of Contents
|
|
@@ -1329,6 +1340,7 @@ function onRowRemove(event: { data: Product; index: number; cancel: () => void }
|
|
|
1329
1340
|
|
|
1330
1341
|
| Event | Payload | Description |
|
|
1331
1342
|
|-------|---------|-------------|
|
|
1343
|
+
| `update:editingRows` | `T[]` | v-model update for currently editing rows. |
|
|
1332
1344
|
| `cell-edit-init` | `{ data: T, field: string, index: number }` | Cell entered edit mode. |
|
|
1333
1345
|
| `cell-edit-complete` | `{ data: T, field: string, newValue: unknown, index: number }` | Cell edit committed. |
|
|
1334
1346
|
| `cell-edit-cancel` | `{ data: T, field: string, index: number }` | Cell edit cancelled. |
|
|
@@ -29,9 +29,23 @@ Notable location: `useDataTableSort.docs.md` is under `ui/composables/`, not `co
|
|
|
29
29
|
- `knowledge/patterns/blade-navigation.md`
|
|
30
30
|
|
|
31
31
|
### Framework docs to read (basename glob):
|
|
32
|
+
|
|
33
|
+
**Core table components (always read):**
|
|
32
34
|
- `**/vc-blade.docs.md`
|
|
33
35
|
- `**/vc-data-table.docs.md`
|
|
34
36
|
- `**/vc-pagination.docs.md`
|
|
37
|
+
|
|
38
|
+
**Cell renderer components (read for custom #body slots in VcColumn):**
|
|
39
|
+
- `**/vc-status.docs.md` — for status/state columns (variant-colored badge)
|
|
40
|
+
- `**/vc-status-icon.docs.md` — for boolean columns (check/cross icon)
|
|
41
|
+
- `**/vc-badge.docs.md` — for count/tag columns (numeric badge, category tag)
|
|
42
|
+
- `**/vc-image.docs.md` — for image/avatar/thumbnail columns
|
|
43
|
+
- `**/vc-link.docs.md` — for clickable URL/email columns
|
|
44
|
+
- `**/vc-progress.docs.md` — for percentage/progress columns
|
|
45
|
+
- `**/vc-rating.docs.md` — for rating columns (read-only stars)
|
|
46
|
+
- `**/vc-tooltip.docs.md` — for columns with truncated text that need hover detail
|
|
47
|
+
|
|
48
|
+
**Composable docs (always read):**
|
|
35
49
|
- `**/useBlade.docs.md`
|
|
36
50
|
- `**/useAsync.docs.md`
|
|
37
51
|
- `**/useLoading.docs.md`
|
|
@@ -50,17 +64,63 @@ Notable location: `useDataTableSort.docs.md` is under `ui/composables/`, not `co
|
|
|
50
64
|
- `knowledge/patterns/blade-navigation.md`
|
|
51
65
|
|
|
52
66
|
### Framework docs to read (basename glob):
|
|
67
|
+
|
|
68
|
+
**Core form components (always read):**
|
|
53
69
|
- `**/vc-blade.docs.md`
|
|
54
70
|
- `**/vc-form.docs.md`
|
|
55
71
|
- `**/vc-input.docs.md`
|
|
56
72
|
- `**/vc-select.docs.md`
|
|
57
73
|
- `**/vc-switch.docs.md`
|
|
74
|
+
|
|
75
|
+
**Extended form components (read based on field types — see Field Type → Component Mapping in details-blade-pattern.md):**
|
|
76
|
+
- `**/vc-textarea.docs.md` — for `text` / `rich-text` fields
|
|
77
|
+
- `**/vc-editor.docs.md` — for `rich-text` fields (WYSIWYG HTML editor)
|
|
78
|
+
- `**/vc-date-picker.docs.md` — for `date-time` fields (calendar widget, preferred over VcInput type="datetime-local")
|
|
79
|
+
- `**/vc-checkbox.docs.md` — for `boolean` fields (alternative to VcSwitch for "agree/accept" semantics)
|
|
80
|
+
- `**/vc-checkbox-group.docs.md` — for `multi-select` fields with few static options
|
|
81
|
+
- `**/vc-radio-group.docs.md` — for `enum` fields with 2-5 options
|
|
82
|
+
- `**/vc-input-currency.docs.md` — for `currency` fields (formatted monetary input)
|
|
83
|
+
- `**/vc-multivalue.docs.md` — for `multi-select` / `tags` fields (tag-style multi-picker)
|
|
84
|
+
- `**/vc-rating.docs.md` — for `rating` fields (star rating)
|
|
85
|
+
- `**/vc-slider.docs.md` — for `range` fields (numeric slider)
|
|
86
|
+
- `**/vc-color-input.docs.md` — for `color` fields
|
|
87
|
+
- `**/vc-file-upload.docs.md` — for `file` fields (file attachment upload)
|
|
88
|
+
- `**/vc-input-group.docs.md` — for grouped inputs (prefix/suffix patterns like URL, phone)
|
|
89
|
+
|
|
90
|
+
**Read-only display components (read when blade has view-only fields):**
|
|
91
|
+
- `**/vc-field.docs.md` — for read-only key-value display (horizontal label:value, copyable, tooltip). Use instead of VcInput for non-editable data.
|
|
92
|
+
|
|
93
|
+
**Layout & display components (read when the form has sections or read-only data):**
|
|
94
|
+
- `**/vc-card.docs.md` — for grouping form sections visually (ALWAYS use for 3+ field groups)
|
|
95
|
+
- `**/vc-accordion.docs.md` — for collapsible form sections
|
|
96
|
+
- `**/vc-badge.docs.md` — for status indicators in form headers
|
|
97
|
+
- `**/vc-banner.docs.md` — for contextual alerts at top of form (error, info, warning states)
|
|
98
|
+
- `**/vc-hint.docs.md` — for field-level help text or secondary descriptions
|
|
99
|
+
- `**/vc-status.docs.md` — for status display in read-only areas
|
|
100
|
+
- `**/vc-button.docs.md` — for inline action buttons (e.g., inside banners)
|
|
101
|
+
|
|
102
|
+
**Media components (read when entity has images/gallery/video):**
|
|
103
|
+
- `**/vc-image-upload.docs.md` — for `image` fields (single image upload with preview)
|
|
104
|
+
- `**/vc-gallery.docs.md` — for `gallery` / `images` fields (multi-image management)
|
|
105
|
+
- `**/vc-image.docs.md` — for read-only image display
|
|
106
|
+
|
|
107
|
+
**Composable docs (always read):**
|
|
58
108
|
- `**/useBlade.docs.md`
|
|
59
109
|
- `**/useAsync.docs.md`
|
|
60
110
|
- `**/useModificationTracker.docs.md`
|
|
61
111
|
- `**/useLoading.docs.md`
|
|
62
112
|
- `**/validation.docs.md`
|
|
63
113
|
|
|
114
|
+
**Composable docs (read when entity has related sub-entities):**
|
|
115
|
+
- `**/useBladeWidgets.docs.md` — for blade sidebar widgets (icon buttons with badge counts that open child blades)
|
|
116
|
+
|
|
117
|
+
### Advanced patterns to read (based on design intent):
|
|
118
|
+
|
|
119
|
+
Read `knowledge/patterns/` files when the design requires these patterns:
|
|
120
|
+
- `knowledge/patterns/blade-widget.md` — when entity has related sub-entities that need sidebar widget navigation
|
|
121
|
+
- `knowledge/patterns/dashboard-widget.md` — when module should contribute a dashboard card
|
|
122
|
+
- `knowledge/patterns/notification-template.md` — when module needs push notification rendering
|
|
123
|
+
|
|
64
124
|
---
|
|
65
125
|
|
|
66
126
|
## Module Assembler
|