@vc-shell/vc-app-skill 2.11.0 → 2.12.0
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 +1 -1
- package/runtime/VERSION +1 -1
- package/runtime/knowledge/components.json +6396 -0
- package/runtime/knowledge/docs/_BUILD_HASH.md +1 -1
- package/runtime/knowledge/docs/core/blade-navigation/table-query-state/useTableQueryState.docs.md +1 -1
- package/runtime/knowledge/docs/core/plugins/i18n/i18n.docs.md +34 -8
- package/runtime/knowledge/docs/modules/assets/assets-details.docs.md +107 -40
- package/runtime/knowledge/docs/modules/assets-manager/assets-folder-manager.docs.md +201 -0
- package/runtime/knowledge/docs/modules/assets-manager/assets-manager.docs.md +1 -0
- package/runtime/knowledge/docs/ui/components/atoms/vc-badge/vc-badge.docs.md +16 -14
- package/runtime/knowledge/docs/ui/components/atoms/vc-button/vc-button.docs.md +24 -11
- package/runtime/knowledge/docs/ui/components/molecules/vc-accordion/vc-accordion.docs.md +18 -4
- package/runtime/knowledge/docs/ui/components/molecules/vc-dropdown/vc-dropdown.docs.md +71 -43
- package/runtime/knowledge/docs/ui/components/molecules/vc-input/vc-input.docs.md +56 -46
- package/runtime/knowledge/docs/ui/components/molecules/vc-popover/vc-popover.docs.md +2 -0
- package/runtime/knowledge/docs/ui/components/molecules/vc-switch/vc-switch.docs.md +4 -3
- package/runtime/knowledge/docs/ui/components/organisms/vc-data-table/vc-data-table.docs.md +140 -26
- package/runtime/knowledge/docs/ui/components/organisms/vc-search-bar/vc-search-bar.docs.md +284 -0
- package/runtime/knowledge/docs/ui/components/organisms/vc-sidebar/vc-sidebar.docs.md +46 -28
- package/runtime/knowledge/index.md +14 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
Synced from framework at commit
|
|
1
|
+
Synced from framework at commit c534d0013 on 2026-11-17T15:19:30.236Z
|
package/runtime/knowledge/docs/core/blade-navigation/table-query-state/useTableQueryState.docs.md
CHANGED
|
@@ -74,7 +74,7 @@ watch([sortExpression, searchValue, currentPage], debounce(load, 300));
|
|
|
74
74
|
| -------- | ----------------------- | ------------------------------------------------------------------------------------------------------ |
|
|
75
75
|
| `read` | `() => TableQueryPatch` | Reads the restored `{ sort?, search?, page? }` from the URL. Returns `{}` when no service is available |
|
|
76
76
|
|
|
77
|
-
`TableQueryPatch`: `{ sort?: string; search?: string; page?: number }` — `sort` is a `"field:ASC"` / `"field:DESC"` expression, `page` is 1-based.
|
|
77
|
+
`TableQueryPatch`: `{ sort?: string; search?: string; page?: number; filters?: string; view?: string }` — `sort` is a `"field:ASC"` / `"field:DESC"` expression, `page` is 1-based. `filters` (`<stateKey>_filters`) is written and read by the table's search bar in its own compact format; a page does not need to seed anything from it, because the table emits `@filter` with the restored filters after mount. `view` (`<stateKey>_view`) is the id of the bar's current view, also written by the bar.
|
|
78
78
|
|
|
79
79
|
## Details
|
|
80
80
|
|
|
@@ -193,6 +193,32 @@ const message = i18n.global.t("MY_MODULE.SOME_KEY");
|
|
|
193
193
|
|
|
194
194
|
The framework exports its locale files as typed ES modules. App developers can import them to create full translations or override specific keys.
|
|
195
195
|
|
|
196
|
+
### Shipped Languages
|
|
197
|
+
|
|
198
|
+
The framework's own texts come in 15 languages. All of them are merged at startup, so an app whose locale is one of these codes gets the framework's texts without supplying them. The language menu offers a language only when the app's own messages for it have a `language_name`.
|
|
199
|
+
|
|
200
|
+
| Language | Code |
|
|
201
|
+
| ---------- | ---- |
|
|
202
|
+
| Arabic | `ar` |
|
|
203
|
+
| Chinese | `zh` |
|
|
204
|
+
| English | `en` |
|
|
205
|
+
| Finnish | `fi` |
|
|
206
|
+
| French | `fr` |
|
|
207
|
+
| German | `de` |
|
|
208
|
+
| Hebrew | `he` |
|
|
209
|
+
| Italian | `it` |
|
|
210
|
+
| Japanese | `ja` |
|
|
211
|
+
| Norwegian | `no` |
|
|
212
|
+
| Polish | `pl` |
|
|
213
|
+
| Portuguese | `pt` |
|
|
214
|
+
| Russian | `ru` |
|
|
215
|
+
| Spanish | `es` |
|
|
216
|
+
| Swedish | `sv` |
|
|
217
|
+
|
|
218
|
+
Plural messages (`"{count} filter | {count} filters"`) use the forms of each language: three in Russian and Polish (one, few, many), six in Arabic (zero, one, two, few, many, other), one in Japanese and Chinese, and two everywhere else (in French the first form also covers 0). A message written with another number of forms keeps vue-i18n's default choice.
|
|
219
|
+
|
|
220
|
+
Arabic and Hebrew are right to left: `useLanguages().setLocale()` sets `<html dir="rtl">` for them.
|
|
221
|
+
|
|
196
222
|
### Importing Framework Locales
|
|
197
223
|
|
|
198
224
|
```typescript
|
|
@@ -211,16 +237,16 @@ Spread the English locale as a base and override all sections:
|
|
|
211
237
|
import en from "@vc-shell/framework/locales/en";
|
|
212
238
|
import type { VcShellLocale } from "@vc-shell/framework/locales/types";
|
|
213
239
|
|
|
214
|
-
const
|
|
240
|
+
const nl: VcShellLocale = {
|
|
215
241
|
...en,
|
|
216
|
-
CORE: { THEMES: { LIGHT: "
|
|
242
|
+
CORE: { THEMES: { LIGHT: "Licht", DARK: "Donker" } },
|
|
217
243
|
SHELL: {
|
|
218
244
|
...en.SHELL,
|
|
219
245
|
ACCOUNT: {
|
|
220
|
-
SETTINGS: "
|
|
221
|
-
CHANGE_PASSWORD: "
|
|
222
|
-
PROFILE: "
|
|
223
|
-
LOGOUT: "
|
|
246
|
+
SETTINGS: "Instellingen",
|
|
247
|
+
CHANGE_PASSWORD: "Wachtwoord wijzigen",
|
|
248
|
+
PROFILE: "Profiel",
|
|
249
|
+
LOGOUT: "Afmelden",
|
|
224
250
|
},
|
|
225
251
|
},
|
|
226
252
|
COMPONENTS: {
|
|
@@ -230,7 +256,7 @@ const fr: VcShellLocale = {
|
|
|
230
256
|
};
|
|
231
257
|
|
|
232
258
|
// Register in your app's main.ts or plugin setup:
|
|
233
|
-
app.config.globalProperties.$mergeLocaleMessage("
|
|
259
|
+
app.config.globalProperties.$mergeLocaleMessage("nl", nl);
|
|
234
260
|
```
|
|
235
261
|
|
|
236
262
|
### Overriding Specific Keys
|
|
@@ -252,7 +278,7 @@ app.config.globalProperties.$mergeLocaleMessage("en", overrides);
|
|
|
252
278
|
Run the CLI tool to check for missing or extra keys:
|
|
253
279
|
|
|
254
280
|
```bash
|
|
255
|
-
npx vc-check-locales ./src/locales/
|
|
281
|
+
npx vc-check-locales ./src/locales/nl.json
|
|
256
282
|
```
|
|
257
283
|
|
|
258
284
|
In development mode, the framework also logs console warnings when a translation key is accessed but has no value for the current locale.
|
|
@@ -7,13 +7,18 @@ slug: assets
|
|
|
7
7
|
|
|
8
8
|
# Assets Details Module
|
|
9
9
|
|
|
10
|
-
A built-in child blade
|
|
10
|
+
A built-in child blade that shows one asset. It has two modes:
|
|
11
|
+
|
|
12
|
+
- **Flat mode** (`asset`): an asset stored on an entity, such as a product image or a task attachment. The user edits the name, alt text (images only) and description, then saves or deletes.
|
|
13
|
+
- **Storage mode** (`assetSource`): a file in a storage folder. The blade is read-only and offers Download, Copy link and Delete.
|
|
14
|
+
|
|
15
|
+
`AssetsManager` opens it in flat mode when the user clicks a row, `AssetsFolderManager` in storage mode when the user clicks a file. Any parent blade can open it the same way.
|
|
11
16
|
|
|
12
17
|
## Overview
|
|
13
18
|
|
|
14
|
-
The blade
|
|
19
|
+
The blade never talks to the network. Saving and deleting go back to the caller through `assetEditHandler` and `assetRemoveHandler`; the caller decides what they mean.
|
|
15
20
|
|
|
16
|
-
The module is registered as `AssetsDetailsModule` and exposes the
|
|
21
|
+
The module is registered as `AssetsDetailsModule` and exposes the blade under the name `"AssetsDetails"`.
|
|
17
22
|
|
|
18
23
|
## Module Registration
|
|
19
24
|
|
|
@@ -26,19 +31,32 @@ import { AssetsDetailsModule } from "@vc-shell/framework";
|
|
|
26
31
|
|
|
27
32
|
## Options (via `useBlade`)
|
|
28
33
|
|
|
29
|
-
The blade reads its configuration from `options` via `useBlade<AssetsDetailsOptions>()
|
|
34
|
+
The blade reads its configuration from `options` via `useBlade<AssetsDetailsOptions>()`, not props. Every option is optional.
|
|
35
|
+
|
|
36
|
+
| Option | Type | Description |
|
|
37
|
+
| -------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
38
|
+
| `asset` | `AssetLike` | Flat mode. The asset to edit. The blade works on a copy; the source object is not touched until `assetEditHandler` gets the copy. |
|
|
39
|
+
| `assetSource` | `ComputedRef<AssetLike \| undefined>` | Storage mode. The live entry. The blade follows its changes and closes when it becomes `undefined`. Wins over `asset`. |
|
|
40
|
+
| `disabled` | `boolean` | Disables Save and Delete, and makes the form fields read-only. Download and Copy link stay available. |
|
|
41
|
+
| `hiddenFields` | `string[]` | Form fields to hide: `"name"`, `"altText"`, `"description"`. The header and the File section are always shown. |
|
|
42
|
+
| `assetEditHandler` | `(asset: AssetLike) => void` | Flat mode. Called by Save with the edited copy. The blade closes after it resolves. |
|
|
43
|
+
| `assetRemoveHandler` | `(asset: AssetLike) => Promise<void \| boolean>` | Called by Delete. The blade closes after it resolves, unless it resolves `false`. A rejection also keeps the blade open. |
|
|
44
|
+
| `extraInfo` | `(asset: AssetLike) => IAssetInfoItem[] \| Promise<IAssetInfoItem[]>` | Extra rows under the File section, in both modes. See [Extra rows](#extra-rows). |
|
|
45
|
+
|
|
46
|
+
The exported types:
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import type { AssetsDetailsOptions, IAssetInfoItem } from "@vc-shell/framework";
|
|
30
50
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
| `assetEditHandler` | `((asset: AssetLike) => void)?` | Called by the toolbar Save button with the edited copy. The blade closes itself after the handler resolves. If omitted, the Save button performs no action and the blade does not close. |
|
|
37
|
-
| `assetRemoveHandler` | `((asset: AssetLike) => Promise<void>)?` | Called by the toolbar Delete button. The blade closes itself after the handler resolves. If omitted, the Delete button performs no action and the blade does not close. |
|
|
51
|
+
interface IAssetInfoItem {
|
|
52
|
+
label: string;
|
|
53
|
+
value: string;
|
|
54
|
+
}
|
|
55
|
+
```
|
|
38
56
|
|
|
39
57
|
## Usage
|
|
40
58
|
|
|
41
|
-
###
|
|
59
|
+
### Flat mode
|
|
42
60
|
|
|
43
61
|
```typescript
|
|
44
62
|
import { useBlade } from "@vc-shell/framework";
|
|
@@ -61,9 +79,30 @@ openBlade({
|
|
|
61
79
|
});
|
|
62
80
|
```
|
|
63
81
|
|
|
64
|
-
###
|
|
82
|
+
### Storage mode
|
|
83
|
+
|
|
84
|
+
Pass the entry as a computed, so the blade shows fresh data after a reload and closes when the file is gone.
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
import { computed } from "vue";
|
|
88
|
+
import { useBlade } from "@vc-shell/framework";
|
|
89
|
+
|
|
90
|
+
const { openBlade } = useBlade();
|
|
91
|
+
|
|
92
|
+
openBlade({
|
|
93
|
+
name: "AssetsDetails",
|
|
94
|
+
options: {
|
|
95
|
+
assetSource: computed(() => entries.value.find((entry) => entry.url === openUrl.value)),
|
|
96
|
+
assetRemoveHandler: async (asset) => {
|
|
97
|
+
const confirmed = await confirmDelete(asset.name);
|
|
98
|
+
if (!confirmed) return false; // keeps the blade open
|
|
99
|
+
await api.deleteBlobs([asset.url]);
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
```
|
|
65
104
|
|
|
66
|
-
|
|
105
|
+
### Used by AssetsManager
|
|
67
106
|
|
|
68
107
|
```typescript
|
|
69
108
|
// inside AssetsManager
|
|
@@ -79,45 +118,73 @@ openBlade({
|
|
|
79
118
|
});
|
|
80
119
|
```
|
|
81
120
|
|
|
82
|
-
##
|
|
121
|
+
## Layout
|
|
83
122
|
|
|
84
|
-
|
|
123
|
+
| Part | Content |
|
|
124
|
+
| -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
125
|
+
| Header | A 96 px preview for images (click opens the file in a new tab), or a tile with the extension label (`FILE` without an extension). The name and chips: extension, size, image dimensions. |
|
|
126
|
+
| URL row | The absolute URL (a relative URL is resolved against the page origin) on one line, with a copy button. Only when the asset has a `url`. |
|
|
127
|
+
| Metadata | Flat mode only. Name, alt text, description. Hidden when `hiddenFields` hides all of them. |
|
|
128
|
+
| File | Type (`contentType` or the extension), size, dimensions (images, once loaded), created date. Storage mode adds the modified date. |
|
|
129
|
+
| Extra | Rows from `extraInfo`, under a separator. |
|
|
85
130
|
|
|
86
|
-
|
|
87
|
-
| ------------ | -------------------------------------------------------------------------------------------------- |
|
|
88
|
-
| Preview | `VcImage` thumbnail for image extensions (png/jpg/jpeg/svg/gif), colored extension badge otherwise |
|
|
89
|
-
| Size | `readableSize(asset.size)` — formatted as `KB`/`MB`/`GB` |
|
|
90
|
-
| Created date | `asset.createdDate` rendered with `type="date-ago"` |
|
|
91
|
-
| URL | `asset.url` displayed as a copyable link with `asset.name` as the visible label |
|
|
131
|
+
An image is detected by the file extension (`isImage(name)`). An image that has no `url` or fails to load shows the tile and no dimensions.
|
|
92
132
|
|
|
93
133
|
## Form fields
|
|
94
134
|
|
|
95
|
-
|
|
135
|
+
Flat mode only. The fields edit the copy of `asset`.
|
|
96
136
|
|
|
97
|
-
| Field | Visibility
|
|
98
|
-
| ------------- |
|
|
99
|
-
| `name` |
|
|
100
|
-
| `altText` |
|
|
101
|
-
| `description` |
|
|
137
|
+
| Field | Visibility | Notes |
|
|
138
|
+
| ------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------- |
|
|
139
|
+
| `name` | Hide with `"name"` | Required. Edits the base name only; the extension is shown as a suffix and reattached on save. |
|
|
140
|
+
| `altText` | Only when `asset.typeId === "Image"` | Hide with `"altText"`. |
|
|
141
|
+
| `description` | Hide with `"description"` | Multiline. |
|
|
102
142
|
|
|
103
143
|
## Toolbar
|
|
104
144
|
|
|
105
|
-
| Button | Disabled
|
|
106
|
-
|
|
|
107
|
-
| Save
|
|
108
|
-
|
|
|
145
|
+
| Button | Mode | Shown when | Disabled when | Action |
|
|
146
|
+
| --------- | ------- | ------------------------------------------ | --------------------------------------------------- | ------------------------------------------------------------------------ |
|
|
147
|
+
| Save | Flat | Always | `disabled`, the form is invalid, or nothing changed | `await assetEditHandler(copy)`, then close |
|
|
148
|
+
| Download | Both | The asset has a `url` | Never | Downloads the file under its name |
|
|
149
|
+
| Copy link | Storage | The asset has a `url` | Never | Copies the absolute URL and shows a toast |
|
|
150
|
+
| Delete | Both | Storage mode needs `platform:asset:delete` | `disabled` | `await assetRemoveHandler(asset)`, then close unless it resolved `false` |
|
|
151
|
+
|
|
152
|
+
Flat-mode Delete has no permission check; the caller decides who may delete.
|
|
153
|
+
|
|
154
|
+
## Extra rows
|
|
155
|
+
|
|
156
|
+
`extraInfo` runs each time the blade shows a file, and again when the file's `url` or `modifiedDate` changes. A skeleton shows while it loads. If it throws or rejects, one muted line says the information could not be loaded and the rest of the blade works. When several calls overlap, the last one wins.
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
openBlade({
|
|
160
|
+
name: "AssetsDetails",
|
|
161
|
+
options: {
|
|
162
|
+
assetSource,
|
|
163
|
+
extraInfo: async (asset) => {
|
|
164
|
+
const pages = await api.pagesUsing(asset.url);
|
|
165
|
+
return [{ label: "Used on", value: `${pages.length} pages` }];
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Closing
|
|
172
|
+
|
|
173
|
+
- Save closes the blade after `assetEditHandler` resolves.
|
|
174
|
+
- Delete closes it after `assetRemoveHandler` resolves, unless the result is `false`. A rejection keeps it open.
|
|
175
|
+
- In storage mode, the blade closes when `assetSource` becomes `undefined`.
|
|
176
|
+
- Options carry functions and a live ref, so a page reload or a deep link mounts the blade without `asset` or `assetSource`. It then closes itself.
|
|
109
177
|
|
|
110
178
|
## Tips
|
|
111
179
|
|
|
112
|
-
- **Extension is locked.**
|
|
113
|
-
- **
|
|
114
|
-
-
|
|
115
|
-
- **`
|
|
116
|
-
- **`hiddenFields` does not enforce required-ness.** Hiding `"name"` skips the validated `<Field>`, so the Save button only depends on form dirtiness.
|
|
180
|
+
- **Extension is locked.** Renaming `photo.png` to `cover` saves `cover.png`. A name without an extension, such as `README`, is saved as typed.
|
|
181
|
+
- **Only the last extension is locked.** `my.photo.v2.jpg` edits as `my.photo.v2` with `.jpg` locked.
|
|
182
|
+
- **The source asset is never mutated.** `assetEditHandler` gets the edited copy; treat it as the new state.
|
|
183
|
+
- **`hiddenFields` does not enforce required fields.** Hiding `"name"` drops its validation, so Save depends on dirtiness only.
|
|
117
184
|
|
|
118
185
|
## Related
|
|
119
186
|
|
|
120
|
-
-
|
|
187
|
+
- [Assets Manager](../assets-manager/assets-manager.docs.md) -- opens `AssetsDetails` in flat mode for an entity's assets
|
|
188
|
+
- [Assets Folder Manager](../assets-manager/assets-folder-manager.docs.md) -- opens `AssetsDetails` in storage mode for files in a folder
|
|
121
189
|
- `framework/core/composables/useAssetsManager/` -- `AssetLike` type definition
|
|
122
|
-
- `framework/core/utilities/assets.ts` -- `isImage`, `readableSize`, `
|
|
123
|
-
- `framework/ui/components/molecules/vc-field/` -- `VcField` used by the header for size/date/url
|
|
190
|
+
- `framework/core/utilities/assets.ts` -- `isImage`, `readableSize`, `absoluteUrl`, `downloadFile`, `getExtensionColor`
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Assets Folder Manager
|
|
3
|
+
category: reference
|
|
4
|
+
group: modules
|
|
5
|
+
slug: assets-folder-manager
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Assets Folder Manager
|
|
9
|
+
|
|
10
|
+
A built-in blade that browses a folder of platform asset storage. It lists one folder level at a time, opens subfolders, and uploads, creates and deletes against storage directly. For a flat list of files owned by an entity, see [Assets Manager](./assets-manager.docs.md).
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
`AssetsFolderManager` is registered by `AssetsManagerModule` and opened by name with `openBlade`. It is a browser only: it does not return a chosen file to the opener. Clicking a file opens `AssetsDetails`, the shared child blade of the assets module, with the file's preview and properties.
|
|
15
|
+
|
|
16
|
+
Every request goes to `/api/assets` with `fetch`. Storage is the source of truth: each upload, new folder and delete reloads the current level, there are no local edits.
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { useBlade } from "@vc-shell/framework";
|
|
20
|
+
|
|
21
|
+
const { openBlade } = useBlade();
|
|
22
|
+
|
|
23
|
+
openBlade({
|
|
24
|
+
name: "AssetsFolderManager",
|
|
25
|
+
options: { rootUrl: "/stores/1", title: "Store files" },
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Options (via `useBlade`)
|
|
30
|
+
|
|
31
|
+
| Option | Type | Description |
|
|
32
|
+
| --------------- | -------------------------------------------------- | ------------------------------------------------------------------------------- |
|
|
33
|
+
| `rootUrl` | `string` | Root folder, for example `/stores/<id>`. Required. The blade cannot leave it |
|
|
34
|
+
| `title` | `string?` | Blade title and root breadcrumb. Defaults to i18n `ASSETS_MANAGER.FOLDER.TITLE` |
|
|
35
|
+
| `folderActions` | `IAssetsFolderAction[]?` | Extra actions on folder rows and cards only |
|
|
36
|
+
| `entryInfo` | `(entry) => IAssetInfoItem[] \| Promise<...>` | Extra rows in the details blade. See [App hooks](#app-hooks) |
|
|
37
|
+
| `beforeDelete` | `(entries) => string \| undefined \| Promise<...>` | Extra warning in the delete confirmation. See [App hooks](#app-hooks) |
|
|
38
|
+
|
|
39
|
+
## Permissions
|
|
40
|
+
|
|
41
|
+
| Permission | Controls |
|
|
42
|
+
| ----------------------- | ----------------------------------------------------------------------------------------- |
|
|
43
|
+
| `platform:asset:create` | Toolbar New folder, Upload, Upload from URL, drag-and-drop, the empty-state upload button |
|
|
44
|
+
| `platform:asset:delete` | Toolbar Delete, row Delete, the selection column and card checkboxes, details Delete |
|
|
45
|
+
|
|
46
|
+
Without the permission the control is hidden. Browsing, search, Download and Copy link need no permission.
|
|
47
|
+
|
|
48
|
+
## Folder navigation and root guard
|
|
49
|
+
|
|
50
|
+
- Clicking a folder row opens it. Clicking a file opens the [details blade](#details-blade).
|
|
51
|
+
- A bar above the table holds the folder path (breadcrumbs) and the search field. The breadcrumbs lead back to every level. The root crumb shows the blade title, the last crumb is the current folder and is not a link.
|
|
52
|
+
- Navigation is limited to the root: a folder opens only if it is in the current listing, and a breadcrumb jump accepts only a crumb of the current trail. Nothing above `rootUrl` is reachable.
|
|
53
|
+
- Folders are listed first, then files, each group by name. Paging (20 per page) is client-side over the loaded level.
|
|
54
|
+
- Search filters the current folder by name through the API `keyword` parameter. Moving to another folder clears it. When nothing matches, the table says so instead of showing the empty-folder state.
|
|
55
|
+
- Copy link copies an absolute URL; a relative `url` from the API is resolved against the current origin.
|
|
56
|
+
- A root that does not exist yet (the API answers 404) shows as an empty folder. It is created by the first upload or new folder.
|
|
57
|
+
- A request that finishes after the user moved on is discarded, so a fast double click never shows the wrong folder.
|
|
58
|
+
|
|
59
|
+
## Table and grid view
|
|
60
|
+
|
|
61
|
+
The two buttons at the end of the bar switch between a table and a grid of cards. The choice is kept in `localStorage` under `VC_ASSETS_FOLDER_MANAGER_VIEW` (`"table"` or `"grid"`) and the blade opens in the table when nothing is stored or storage is blocked.
|
|
62
|
+
|
|
63
|
+
Both views show the same page of 20 entries, the same selection and the same row actions, so switching keeps the page and what is selected.
|
|
64
|
+
|
|
65
|
+
- A card shows a 4:3 preview (the image, a folder icon or the extension badge), the name and a line with the size, or "Folder", and the modified date.
|
|
66
|
+
- Clicking a card does what clicking a row does. Enter opens it, Space selects it when the user may delete.
|
|
67
|
+
- The checkbox (top left) and the actions menu (top right) show on hover and keyboard focus. While anything is selected every checkbox stays visible. On touch screens both are always visible.
|
|
68
|
+
|
|
69
|
+
## Details blade
|
|
70
|
+
|
|
71
|
+
Clicking a file opens `AssetsDetails` as a child blade. Clicking another file replaces it, the open file stays highlighted in the table or grid, and moving to another folder or searching closes it.
|
|
72
|
+
|
|
73
|
+
It opens in storage mode: no form, a header with the preview or extension tile, the file name and chips, the absolute URL with a copy button, then the File section with Type (`contentType` or the extension), Size, Dimensions (images only, measured once the image loads), Created and Modified. Rows from [`entryInfo`](#app-hooks) follow under a separator. See [Assets Details](../assets/assets-details.docs.md). The toolbar has Download, Copy link and Delete. Delete runs the folder blade's own delete, with the same confirmation and `beforeDelete` warning, and closes the details only when the file is gone.
|
|
74
|
+
|
|
75
|
+
The details follow the folder listing: after a reload they show the fresh entry, and they close when the file disappears. The blade options carry functions, so a page reload or a deep link to it opens nothing and the blade closes itself.
|
|
76
|
+
|
|
77
|
+
## App hooks
|
|
78
|
+
|
|
79
|
+
Two options let the opener add what only the app knows about a file.
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
// IAssetInfoItem is { label: string; value: string }, exported from the assets module
|
|
83
|
+
entryInfo?: (entry: BlobEntry) => IAssetInfoItem[] | Promise<IAssetInfoItem[]>;
|
|
84
|
+
beforeDelete?: (entries: BlobEntry[]) => string | undefined | Promise<string | undefined>;
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
- `entryInfo` runs each time the details blade shows a file. Its rows appear under the built-in fields. A skeleton shows while it loads; if it throws, one muted line says the information could not be loaded and the rest of the blade works.
|
|
88
|
+
- `beforeDelete` gets exactly the entries being deleted, files and folders as selected. It runs before the confirmation; a returned string is added to the confirmation as a second paragraph. Return `undefined` for no warning. If it throws, the error is shown as a toast and nothing is deleted. What a folder's contents imply is up to the app.
|
|
89
|
+
|
|
90
|
+
Both texts are shown as plain text, never as HTML.
|
|
91
|
+
|
|
92
|
+
Example: a page builder that knows which pages use each file.
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
openBlade({
|
|
96
|
+
name: "AssetsFolderManager",
|
|
97
|
+
options: {
|
|
98
|
+
rootUrl: "/stores/1",
|
|
99
|
+
entryInfo: async (entry) => {
|
|
100
|
+
const pages = await pageApi.findPagesUsing(entry.url);
|
|
101
|
+
return [{ label: "Used on", value: pages.length ? `${pages.length} pages` : "Not used" }];
|
|
102
|
+
},
|
|
103
|
+
beforeDelete: async (entries) => {
|
|
104
|
+
const used = await pageApi.countPagesUsing(entries.map((entry) => entry.url));
|
|
105
|
+
return used ? `These files are used on ${used} pages. The pages will show a broken image.` : undefined;
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Drag and drop
|
|
112
|
+
|
|
113
|
+
Files dropped anywhere on the blade upload into the current folder. Dropped on a folder row or card, they upload into that folder instead: the folder is highlighted while files are over it, the upload goes through the same collision check against that folder, and the current level reloads afterwards. Both need `platform:asset:create`. Dropping is a desktop feature; touch screens have no file drag.
|
|
114
|
+
|
|
115
|
+
## Collision behaviour
|
|
116
|
+
|
|
117
|
+
Before uploading, the blade re-reads the current level without the search filter. Each file whose name matches an existing entry (case-insensitive) opens a popup with three choices:
|
|
118
|
+
|
|
119
|
+
| Choice | Result |
|
|
120
|
+
| --------- | ------------------------------------------------------------------------- |
|
|
121
|
+
| Overwrite | Uploads with `forceFileOverwrite=true` |
|
|
122
|
+
| Rename | Asks for a new name and checks it again, so a second collision asks again |
|
|
123
|
+
| Skip | The file is not uploaded. Closing the popup also skips |
|
|
124
|
+
|
|
125
|
+
Files without a collision upload straight away. If some uploads fail, the level reloads and one toast reports how many failed.
|
|
126
|
+
|
|
127
|
+
## Delete confirmation
|
|
128
|
+
|
|
129
|
+
Toolbar Delete, the row or card action and the details blade Delete all ask for confirmation. The text names up to three selected items and shows a count past that. When a folder is selected, the text says everything inside it is deleted too. Deleting a folder removes its contents in storage. A [`beforeDelete`](#app-hooks) warning is added below the text.
|
|
130
|
+
|
|
131
|
+
## Folder actions
|
|
132
|
+
|
|
133
|
+
`folderActions` adds row actions to folder rows. The opener supplies them, there is no global registry.
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
interface IAssetsFolderAction {
|
|
137
|
+
id: string;
|
|
138
|
+
title: string;
|
|
139
|
+
icon?: string; // defaults to lucide-folder-cog
|
|
140
|
+
permission?: string | string[]; // hidden when the user lacks it
|
|
141
|
+
clickHandler: (folder: BlobEntry, ctx: { reload: () => Promise<void> }) => void | Promise<void>;
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
openBlade({
|
|
147
|
+
name: "AssetsFolderManager",
|
|
148
|
+
options: {
|
|
149
|
+
rootUrl: "/stores/1",
|
|
150
|
+
folderActions: [
|
|
151
|
+
{
|
|
152
|
+
id: "publish-folder",
|
|
153
|
+
title: "Publish folder",
|
|
154
|
+
icon: "lucide-send",
|
|
155
|
+
permission: "platform:asset:create",
|
|
156
|
+
clickHandler: async (folder, { reload }) => {
|
|
157
|
+
await publish(folder.url);
|
|
158
|
+
await reload();
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
An error thrown by `clickHandler` is shown as a toast.
|
|
167
|
+
|
|
168
|
+
## Recipe: open an entity's folder from a widget
|
|
169
|
+
|
|
170
|
+
A widget on a store blade that opens the store's folder:
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
import { computed, type Ref } from "vue";
|
|
174
|
+
import { useBlade, useBladeWidgets } from "@vc-shell/framework";
|
|
175
|
+
|
|
176
|
+
export function useStoreWidgets(store: Ref<{ id: string; name: string } | undefined>) {
|
|
177
|
+
const { openBlade } = useBlade();
|
|
178
|
+
|
|
179
|
+
useBladeWidgets([
|
|
180
|
+
{
|
|
181
|
+
id: "StoreFilesWidget",
|
|
182
|
+
icon: "lucide-folder",
|
|
183
|
+
title: "Files",
|
|
184
|
+
isVisible: computed(() => !!store.value?.id),
|
|
185
|
+
onClick() {
|
|
186
|
+
if (!store.value) return;
|
|
187
|
+
openBlade({
|
|
188
|
+
name: "AssetsFolderManager",
|
|
189
|
+
options: { rootUrl: `/stores/${store.value.id}`, title: store.value.name },
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
]);
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Related
|
|
198
|
+
|
|
199
|
+
- `framework/modules/assets-manager/components/assets-folder-manager/` -- the blade, its internal composable, grid and popups
|
|
200
|
+
- [Assets Details](../assets/assets-details.docs.md) -- the details blade opened on a file click
|
|
201
|
+
- [Assets Manager](./assets-manager.docs.md) -- the flat asset list blade for an entity's own assets
|
|
@@ -163,6 +163,7 @@ Key points:
|
|
|
163
163
|
|
|
164
164
|
## Related
|
|
165
165
|
|
|
166
|
+
- [Assets Folder Manager](./assets-folder-manager.docs.md) -- browses a storage folder tree instead of a flat asset list
|
|
166
167
|
- `framework/core/composables/useAssetsManager/` -- `useAssetsManager`, `AssetLike`, `UseAssetsManagerReturn`
|
|
167
168
|
- `framework/core/utilities/assets.ts` -- `isImage`, `readableSize`, `getExtensionColor`, `getExtensionLabel`
|
|
168
169
|
- `framework/modules/assets/components/assets-details/` -- `AssetsDetails` child blade opened on row click
|
|
@@ -30,20 +30,22 @@ A small indicator component for displaying counts, status dots, or short text la
|
|
|
30
30
|
|
|
31
31
|
## Key Props
|
|
32
32
|
|
|
33
|
-
| Prop | Type | Default | Description
|
|
34
|
-
| ---------------- | -------------------------------------------------------------------------- | ----------- |
|
|
35
|
-
| `content` | `string \| number` | -- | Text or number displayed inside the badge
|
|
36
|
-
| `variant` | `"primary" \| "success" \| "warning" \| "danger" \| "info" \| "secondary"` | `"primary"` | Color variant
|
|
37
|
-
| `size` | `"s" \| "m"` | `"m"` | Badge size
|
|
38
|
-
| `isDot` | `boolean` | `false` | Renders as a small dot without text
|
|
39
|
-
| `inline` | `boolean` | `false` | Renders as an inline element without absolute positioning
|
|
40
|
-
| `clickable` | `boolean` | `false` | Makes the badge respond to click events
|
|
41
|
-
| `disabled` | `boolean` | `false` | Disables interaction on clickable badges
|
|
42
|
-
| `active` | `boolean` | `false` | Applies the active-state color tokens to the badge
|
|
43
|
-
| `customPosition` | `boolean` | `false` | Enables custom `top`/`right` positioning
|
|
44
|
-
| `top` | `string` | -- | Custom top offset (requires `customPosition`)
|
|
45
|
-
| `right` | `string` | -- |
|
|
46
|
-
| `ariaLabel` | `string` | -- | Custom accessible label for the badge
|
|
33
|
+
| Prop | Type | Default | Description |
|
|
34
|
+
| ---------------- | -------------------------------------------------------------------------- | ----------- | --------------------------------------------------------------------------- |
|
|
35
|
+
| `content` | `string \| number` | -- | Text or number displayed inside the badge |
|
|
36
|
+
| `variant` | `"primary" \| "success" \| "warning" \| "danger" \| "info" \| "secondary"` | `"primary"` | Color variant |
|
|
37
|
+
| `size` | `"s" \| "m"` | `"m"` | Badge size |
|
|
38
|
+
| `isDot` | `boolean` | `false` | Renders as a small dot without text |
|
|
39
|
+
| `inline` | `boolean` | `false` | Renders as an inline element without absolute positioning |
|
|
40
|
+
| `clickable` | `boolean` | `false` | Makes the badge respond to click events |
|
|
41
|
+
| `disabled` | `boolean` | `false` | Disables interaction on clickable badges |
|
|
42
|
+
| `active` | `boolean` | `false` | Applies the active-state color tokens to the badge |
|
|
43
|
+
| `customPosition` | `boolean` | `false` | Enables custom `top`/`right` positioning |
|
|
44
|
+
| `top` | `string` | -- | Custom top offset (requires `customPosition`) |
|
|
45
|
+
| `right` | `string` | -- | Offset from the end edge: right, or left in RTL (requires `customPosition`) |
|
|
46
|
+
| `ariaLabel` | `string` | -- | Custom accessible label for the badge |
|
|
47
|
+
| `solid` | `boolean` | `false` | Inline mode: filled colours with white text (a count) |
|
|
48
|
+
| `label` | `boolean` | `false` | Inline mode: a word label, not truncated, rounded corners |
|
|
47
49
|
|
|
48
50
|
::storybook id="data-display-vcbadge--use-cases" height="350"
|
|
49
51
|
|
|
@@ -91,6 +91,14 @@ No border or background, used for inline or de-emphasized actions.
|
|
|
91
91
|
| `ghost` | Toolbar icons, inline actions | Light background tint |
|
|
92
92
|
| `link` | Text-like navigation, inline links | Underline on text |
|
|
93
93
|
|
|
94
|
+
### Tonal Variant
|
|
95
|
+
|
|
96
|
+
A soft primary tint with a light border, for applied state: filter chips, an active filters button, tags. `selected` takes the hover tint.
|
|
97
|
+
|
|
98
|
+
```vue
|
|
99
|
+
<VcButton variant="tonal" size="2xs">Status: New</VcButton>
|
|
100
|
+
```
|
|
101
|
+
|
|
94
102
|
## Sizes
|
|
95
103
|
|
|
96
104
|
Five size options cover all common use cases from toolbar icons to prominent CTAs.
|
|
@@ -98,6 +106,7 @@ Five size options cover all common use cases from toolbar icons to prominent CTA
|
|
|
98
106
|
::storybook id="action-vcbutton--all-sizes"
|
|
99
107
|
|
|
100
108
|
```vue
|
|
109
|
+
<VcButton size="2xs">Extra small</VcButton>
|
|
101
110
|
<VcButton size="sm">Small</VcButton>
|
|
102
111
|
<VcButton size="default">Default</VcButton>
|
|
103
112
|
<VcButton size="lg">Large</VcButton>
|
|
@@ -107,12 +116,15 @@ Five size options cover all common use cases from toolbar icons to prominent CTA
|
|
|
107
116
|
|
|
108
117
|
| Size | Height | Padding | Typical Use |
|
|
109
118
|
| --------- | ------- | ----------------------------- | ----------------------------------- |
|
|
119
|
+
| `2xs` | 28px | 8px horizontal | Filter chips, tags, dense toolbars |
|
|
110
120
|
| `sm` | 32px | 12px horizontal | Compact form actions, table footers |
|
|
111
121
|
| `default` | 36px | 16px horizontal, 8px vertical | Standard blade actions |
|
|
112
122
|
| `lg` | 40px | 24px horizontal | Prominent CTAs, dialog actions |
|
|
113
123
|
| `icon` | 36x36px | 0 (square) | Toolbar icon buttons |
|
|
114
124
|
| `icon-sm` | 24x24px | 0 (square) | Table cell actions, inline controls |
|
|
115
125
|
|
|
126
|
+
`2xs` is the 28px size; with only an icon it is a 28px square. It is not the legacy `xs`, which still renders as `sm`.
|
|
127
|
+
|
|
116
128
|
!!! note "Legacy size aliases"
|
|
117
129
|
`xs` (maps to `sm`) and `base` (maps to `default`) are supported for backward compatibility but should not be used in new code.
|
|
118
130
|
|
|
@@ -295,17 +307,18 @@ Use the `loading` prop, not `disabled`. A disabled button gives no progress feed
|
|
|
295
307
|
|
|
296
308
|
All visual properties are customizable through CSS custom properties. Each variant has three property sets (normal, hover, disabled) for background, text, and border colors.
|
|
297
309
|
|
|
298
|
-
| Pattern | Example | Description
|
|
299
|
-
| ------------------------------------------- | ----------------------------------------- |
|
|
300
|
-
| `--button-{variant}-background-color` | `--button-primary-background-color` | Normal background
|
|
301
|
-
| `--button-{variant}-background-color-hover` | `--button-primary-background-color-hover` | Hover background
|
|
302
|
-
| `--button-{variant}-text-color` | `--button-primary-text-color` | Normal text color
|
|
303
|
-
| `--button-{variant}-border-color` | `--button-primary-border-color` | Normal border color
|
|
304
|
-
| `--button-border-radius` | `6px` | Corner radius for all buttons
|
|
305
|
-
| `--button-focus-ring-color` | `var(--primary-300)` | Focus ring color
|
|
306
|
-
| `--button-focus-ring-width` | `2px` | Focus ring thickness
|
|
307
|
-
| `--button-focus-ring-offset` | `2px` | Focus ring offset
|
|
308
|
-
| `--button-{size}-height` | `--button-default-height: 36px` | Height per size
|
|
310
|
+
| Pattern | Example | Description |
|
|
311
|
+
| ------------------------------------------- | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
312
|
+
| `--button-{variant}-background-color` | `--button-primary-background-color` | Normal background |
|
|
313
|
+
| `--button-{variant}-background-color-hover` | `--button-primary-background-color-hover` | Hover background |
|
|
314
|
+
| `--button-{variant}-text-color` | `--button-primary-text-color` | Normal text color |
|
|
315
|
+
| `--button-{variant}-border-color` | `--button-primary-border-color` | Normal border color |
|
|
316
|
+
| `--button-border-radius` | `6px` | Corner radius for all buttons |
|
|
317
|
+
| `--button-focus-ring-color` | `var(--primary-300)` | Focus ring color |
|
|
318
|
+
| `--button-focus-ring-width` | `2px` | Focus ring thickness |
|
|
319
|
+
| `--button-focus-ring-offset` | `2px` | Focus ring offset |
|
|
320
|
+
| `--button-{size}-height` | `--button-default-height: 36px` | Height per size |
|
|
321
|
+
| `--button-hit-area-size` | `44px` | Minimum size of the `::after` hit area around the button. Set `0px` on a container whose buttons sit edge to edge (an attached group, stacked menu rows), so one does not take its neighbour's clicks |
|
|
309
322
|
|
|
310
323
|
## Accessibility
|
|
311
324
|
|