@xleddyl/443-components-vue 0.16.71 → 0.16.72
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/CATALOG.md +30 -30
- package/README.md +13 -12
- package/dist/components/overlays/types.d.ts +1 -0
- package/dist/components/templates/FormDrawer.vue +4 -1
- package/dist/components/templates/FormDrawer.vue.d.ts +3 -0
- package/dist/components/templates/FormModal.vue +4 -1
- package/dist/components/templates/FormModal.vue.d.ts +3 -0
- package/dist/grid/DataGrid.vue +51 -5
- package/dist/grid/DataGrid.vue.d.ts +1 -0
- package/dist/internal/overlays/MenuList.vue +21 -0
- package/package.json +1 -1
package/CATALOG.md
CHANGED
|
@@ -200,7 +200,7 @@ Mount `OverlayHost` once for the imperative hooks (see [Composables](#composable
|
|
|
200
200
|
| `ConfirmHost` | Renders the dialogs of `useConfirm`, `useAlert`, `usePrompt`. `OverlayHost` includes it. Do not mount it alone. | None. | - |
|
|
201
201
|
| `OverlayHost` | One mount point for toasts, confirm dialogs, programmatic modals and loading indicators. | Props: `toaster` (true or options), `confirm`, `modals`, `loading` (true or `{ bar, delay, label }`). | `overlays/hooks.vue` |
|
|
202
202
|
| `Toaster` | Renders toasts. `OverlayHost` includes it. Use it directly only for custom options. The stack moves out of the way of an open side Drawer (beside it, or above its footer). | Props: `position`, `max`, `duration`, `gap`, `expand`, `progress`, `hotkey`. | `overlays/toast.vue` |
|
|
203
|
-
| `DropdownMenu` | Menu opened by its trigger. Items can have icons, shortcuts, checkboxes, radios, sub menus and links. | Model: `v-model:open`. Props: `items` (`label`, `icon`, `color` (palette name or hex dot, or `muted` for a grey dot of an empty state), `to`, `href`, `tone: danger`, `shortcut`, `disabled`, `children`, `onSelect`; also `type`: checkbox, radio, label, separator), `placement`, `offset`, `matchTriggerWidth`, `minWidth`. Slot: default (the trigger). Event: `select`.
|
|
203
|
+
| `DropdownMenu` | Menu opened by its trigger. Items can have icons, shortcuts, checkboxes, radios, sub menus and links. | Model: `v-model:open`. Props: `items` (`label`, `icon`, `color` (palette name or hex dot, or `muted` for a grey dot of an empty state), `to`, `href`, `tone: danger`, `shortcut`, `disabled`, `disabledReason` (with `disabled`: a tooltip on hover and keyboard focus, linked with `aria-describedby`; the item stays reachable but not selectable), `children`, `onSelect`; also `type`: checkbox, radio, label, separator), `placement`, `offset`, `matchTriggerWidth`, `minWidth`. Slot: default (the trigger). Event: `select`. | `overlays/dropdown-menu.vue` |
|
|
204
204
|
| `ContextMenu` | Menu on right click of the wrapped area. | Model: `v-model:open`. Props: `items` (same as `DropdownMenu`), `disabled`. Slot: default (the area). Event: `select`. | `overlays/context-menu.vue` |
|
|
205
205
|
| `Popover` | Floating panel with any content (a form, filters) opened by its trigger. Use `DropdownMenu` for a list of actions. | Model: `v-model:open`. Props: `placement`, `offset`, `arrow`, `label`, `initialFocus`. Slots: default (the trigger), `content`. | `overlays/popover.vue` |
|
|
206
206
|
| `HoverCard` | Rich preview on hover or focus (user card, link preview). Use `Tooltip` for plain text. | Model: `v-model:open`. Props: `placement`, `openDelay`, `closeDelay`, `arrow`, `disabled`. Slots: default (trigger), `content`. | `overlays/hover-card.vue` |
|
|
@@ -268,29 +268,29 @@ Mount `OverlayHost` once for the imperative hooks (see [Composables](#composable
|
|
|
268
268
|
|
|
269
269
|
Templates combine core parts into whole pages and layouts. Start from them for new pages.
|
|
270
270
|
|
|
271
|
-
| Component | Purpose and when to use it | Main props, models, slots, events
|
|
272
|
-
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
273
|
-
| `DashboardLayout` | Ready app frame: brand, navigation, command search, account menu, settings modal, breadcrumbs, theme switch. Put it in `layouts/default.vue`. | Models: `v-model:collapsed`, `v-model:open`, `v-model:settingsOpen`, `v-model:settingsSection`. Props: `navigation` (`NavItem[]` or `NavSection[]`), `account` (`name`, `email`, `avatar`, `role`, `menu`), `brandName`, `brandIcon`, `brandLogo`, `breadcrumbs`, `search` (true, groups or function), `settingsSections`, `settingsRoute`, `settingsRouteLocation`, `settingsAccountSection`, `settingsResolvePage`, `settingsHideSession`, `variant`, `content` (`page`, `fill`, `centered`, `bleed`; per page with `definePageMeta({ content })` in `k-dashboard`), `fluid`, `fill`, `onSignOut`. Slots: default, `actions`, `brand`, `sidebar-top`, `sidebar`, `sidebar-footer`, `account`, `topbar`, `search-item`, `settings-account-start`, `settings-account-fields`, `settings-section-<id>`, `settings-actions-<id>`, `settings-tabs-<id>`. Event: `accountSelect`.
|
|
274
|
-
| `AuthLayout` | Frame of sign in, sign up and reset password pages: left column with brand, title (or a large breadcrumb), form and footer; aside panel on the right from 960px. | Props: `title`, `description`, `breadcrumbs`, `footer`, `brandName`, `brandIcon`, `brandLogo`, `aside`, `asideTitle`, `asideDescription`, `themeSwitch`. Slots: default, `links`, `footer`, `brand`, `aside`, `corner`.
|
|
275
|
-
| `AuthLogin` | Complete sign in page in two steps (email, then password with a breadcrumb back). Offers to sign in again after `AuthLogout`. | Props: `submit` (`{ email, password }`), `submitError`, `title`, `description`, `emailLabel`, `emailPlaceholder`, `passwordLabel`, `submitLabel`, `stepKey`, `reasonKey`, frame props of `AuthLayout`. Slots: `links` (`{ email, step }`), `footer`, `brand`, `aside`, `corner`.
|
|
276
|
-
| `AuthLogout` | Sign out page: runs `logout()`, remembers the account, reloads the sign in page. Retry on error. | Props: `logout`, `account` (`{ email, name }`), `loginTo`, `reasonKey`, frame props of `AuthLayout`. Slots: `footer`, `brand`, `aside`, `corner`. Helpers: `rememberSignedOutAccount`, `takeSignedOutAccount`, `SIGNED_OUT_REASON`.
|
|
277
|
-
| `ListPage` | Whole list page: header, search, filters, table, pagination, bulk actions, loading, empty, no results and error states. Client or server mode (`total`). | Models: `page`, `pageSize`, `search`, `filter`, `sort`, `selected`. Props: `title`, `rows`, `columns`, `rowKey`, `rowTo`, `selectable`, `loading`, `error`, `total`, `paginate`, `searchable`, `searchKeys`, `filters`, `filterKey`, `filterMultiple`, `emptyTitle`. Slots: `actions`, `toolbar`, `toolbar-end`, `bulk`, `empty`, `empty-actions`, `no-results`, `error`, `cell-<key>`, `table`. Events: `retry`, `clear`, `rowClick`.
|
|
278
|
-
| `DetailPage` | Record page: back link, title, status, actions, tabs, main column and aside with description lists. | Model: `v-model:tab`. Props: `title`, `backTo`, `backLabel`, `status` (`label`, `tone`, `dot`), `tabs`, `sections` (`title`, `items`), `loading`, `error`. Slots: default, `actions`, `badge`, `meta`, `aside`, `aside-before`, `panel-<value>`.
|
|
279
|
-
| `FormDrawer` | Drawer with a form: `Form` around the body, footer with delete (left), cancel and submit, a discard confirmation on close when the form is dirty, `SkeletonForm` while `loading`. | Models: `v-model:open`, `v-model:tab`. Props: `title`, `description`, `side`, `size`, `fill` (full height body), `tabs` (`FormDrawerTab`: `fields` gives the error dot and opens the tab on a failed submit, `fill: true` makes the drawer `fill` while the tab is active), `tabRoute` (keeps the tab in the hash under this key), `trail`, `backLabel`, `form`, `loading`, `readonly` (also disables every field of the body, your own `Form` in the slot too), `creating` (submit says Create, no dirty needed), `requireDirty`, `deletable`, `deleteDisabled`, `deleteHint`, `submitLabel`, `cancelLabel`, `deleteLabel`, `guard`, `guardTitle`, `guardMessage` (the leave guard of the drawer: close, cancel, trail navigation), `beforeClose`, `onCancel`. `deleteHint` is a tooltip of the delete button, and the reason when `deleteDisabled`. Slots: default (`{ tab }`), `actions`, `title-trailing`, `skeleton`, `footer`. Events: `delete`, `submitted`, `navigate`, `afterLeave`. Exposes `confirmDiscard()`, `close()`.
|
|
280
|
-
| `FormModal` | Modal with a form, like `FormDrawer`: `Form` around the body, footer with delete (left), cancel and submit, the leave guard on close, `SkeletonForm` while `loading`, `readonly`. | Model: `v-model:open`. Props: `title`, `description`, `label`, `size`, `sheet`, `width`, `fill`, `dismissible`, `form`, `nested` (the form is a `div`: a modal opened from a field of another form), `loading`, `readonly`, `creating`, `requireDirty`, `deletable`, `deleteDisabled`, `deleteHint`, `submitLabel`, `cancelLabel`, `deleteLabel`, `guard`, `guardTitle`, `guardMessage`, `beforeClose`, `onCancel`. Slots: default, `actions`, `title-trailing`, `skeleton`, `footer` (`{ submit, cancel }`). Events: `delete`, `submitted`, `open`, `close`, `afterLeave`. Exposes `submit()`, `confirmDiscard()`, `close()`.
|
|
281
|
-
| `FormPage` | Form page: header, cards in a `Form`, sticky submit and cancel footer, dirty guard. | Props: `title`, `backTo`, `form` (from `useForm`), `dirty`, `saving`, `guard`, `requireDirty`, `submitLabel`, `cancelLabel`, `cancelTo`, `width`, `sticky`. Slots: default, `actions`, `footer`, `status`. Events: `submit`, `submitted`, `invalid`, `reset`, `cancel`.
|
|
282
|
-
| `DashboardPage` | Overview page: header, stat grid, content grid. | Props: `title`, `eyebrow`, `description`, `stats` (`PageStat[]`), `statsColumns`, `columns`, `loading`. Slots: default, `actions`, `stats`, `sparkline`, `before`, `after`, `eyebrow`.
|
|
283
|
-
| `SettingsPage` | Settings as a page: section nav, panels, floating save bar when `dirty`. | Model: `v-model:section`. Props: `title`, `sections` (`value`, `label`, `icon`, `to`), `dirty`, `saving`, `saveBar`, `form`. Slots: `section-<value>`, `actions`, `nav-footer`. Events: `save`, `discard`.
|
|
284
|
-
| `SettingsSection` | Card of one settings section with a save footer. | Props: `title`, `description`, `icon`, `hint`, `saveable`, `saving`, `saveDisabled`, `saveLabel`, `form`. Slots: default, `actions`, `footer`, `hint`. Event: `save`.
|
|
285
|
-
| `SettingsGroup` | Block with label, description and actions inside a settings section. | Props: `label`, `description`, `level`, `row`. Slots: default, `label`, `description`, `actions`.
|
|
286
|
-
| `SettingsModal` | Settings dialog with nav, built-in account and appearance sections, your own sections and subpages. A subpage title is a one line trail. | Models: `v-model:open`, `v-model:section`, `v-model:pages`. Props: `sections` (`id`, `label`, `icon`, `group`, `badge`, `to`), `account`, `presets`, `title`, `onSignOut`, `hideSession`, `beforeClose`, `route` (sync with `?settings=<section>/<page>`), `routeLocation` (`'hash'`: `#settings/<section>/<page>`), `accountSection` (id with the built-in account content, default `account`), `resolvePage(section, id, parents)`, `guard`, `guardTitle`, `guardMessage` (back, breadcrumb, another section, close and a route change of the modal ask before discarding a dirty `Form` of the section). Slot props: `section`, `close`, `page`, `pages`, `openPage(page)`, `back()`, `goTo(depth)` (the last three resolve `false` when the user keeps editing), `confirmLeave()`. Slots: `section-<id>`, `actions-<id>` (right of the header row, also on a subpage), `tabs-<id>` (tabs at the bottom of the header, like a drawer; the strip shows only when the slot renders content), `account-start` (above the profile card), `account-fields`.
|
|
287
|
-
| `AppearanceSettings` | Theme (light, dark, system) and preset cards. Used by `SettingsModal`. Use alone in a settings page. | Props: `presets` (list or false), `themes`, `level`.
|
|
288
|
-
| `SaveBar` | Floating bar with save and discard for unsaved changes. | Props: `visible`, `saving`, `message`, `saveLabel`, `discardLabel`, `form`. Slots: default, `actions`. Events: `save`, `discard`.
|
|
289
|
-
| `EmptyPage` | First run screen with illustration, actions and onboarding steps. | Props: `title`, `description`, `icon`, `actionLabel`, `actionTo`, `onAction`, `actionIcon`, `secondaryLabel`, `secondaryTo`, `secondaryHref`, `onSecondary`, `steps` (`title`, `description`, `done`, `to`), `fill`. Slots: default, `illustration`, `title`, `description`, `actions`.
|
|
290
|
-
| `ErrorPage` | Error screen. Reads a Nuxt `error`. Use it in `app/error.vue`. | Props: `error`, `statusCode`, `title`, `message`, `homeTo`, `homeLabel`, `retryLabel`, `brandName`, `fill`, `onHome`, `onRetry`. Slots: default, `title`, `message`, `actions`, `brand`.
|
|
291
|
-
| `NotFoundPage` | 404 screen. | Props: `title`, `message`, `homeTo`, `homeLabel`, `backLabel`, `brandName`, `fill`, `onHome`. Slots: default, `actions`, `brand`.
|
|
292
|
-
| `Brand` | Logo and name block (image URL, inline SVG or component). | Props: `name`, `subtitle`, `icon`, `logo`, `to`, `size`, `accent`, `hideText`, `showName`. Slots: default, `logo`, `mark`, `subtitle`.
|
|
293
|
-
| `AccountMenu` | Account button with avatar, name and a dropdown menu. Used by `DashboardLayout`. | Props: `name`, `email`, `avatar`, `menu` (menu items), `placement`, `icon`. Event: `select`.
|
|
271
|
+
| Component | Purpose and when to use it | Main props, models, slots, events | Playground |
|
|
272
|
+
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
|
|
273
|
+
| `DashboardLayout` | Ready app frame: brand, navigation, command search, account menu, settings modal, breadcrumbs, theme switch. Put it in `layouts/default.vue`. | Models: `v-model:collapsed`, `v-model:open`, `v-model:settingsOpen`, `v-model:settingsSection`. Props: `navigation` (`NavItem[]` or `NavSection[]`), `account` (`name`, `email`, `avatar`, `role`, `menu`), `brandName`, `brandIcon`, `brandLogo`, `breadcrumbs`, `search` (true, groups or function), `settingsSections`, `settingsRoute`, `settingsRouteLocation`, `settingsAccountSection`, `settingsResolvePage`, `settingsHideSession`, `variant`, `content` (`page`, `fill`, `centered`, `bleed`; per page with `definePageMeta({ content })` in `k-dashboard`), `fluid`, `fill`, `onSignOut`. Slots: default, `actions`, `brand`, `sidebar-top`, `sidebar`, `sidebar-footer`, `account`, `topbar`, `search-item`, `settings-account-start`, `settings-account-fields`, `settings-section-<id>`, `settings-actions-<id>`, `settings-tabs-<id>`. Event: `accountSelect`. | `templates/dashboard-layout.vue` |
|
|
274
|
+
| `AuthLayout` | Frame of sign in, sign up and reset password pages: left column with brand, title (or a large breadcrumb), form and footer; aside panel on the right from 960px. | Props: `title`, `description`, `breadcrumbs`, `footer`, `brandName`, `brandIcon`, `brandLogo`, `aside`, `asideTitle`, `asideDescription`, `themeSwitch`. Slots: default, `links`, `footer`, `brand`, `aside`, `corner`. | `templates/auth-layout.vue` |
|
|
275
|
+
| `AuthLogin` | Complete sign in page in two steps (email, then password with a breadcrumb back). Offers to sign in again after `AuthLogout`. | Props: `submit` (`{ email, password }`), `submitError`, `title`, `description`, `emailLabel`, `emailPlaceholder`, `passwordLabel`, `submitLabel`, `stepKey`, `reasonKey`, frame props of `AuthLayout`. Slots: `links` (`{ email, step }`), `footer`, `brand`, `aside`, `corner`. | `templates/auth-login.vue` |
|
|
276
|
+
| `AuthLogout` | Sign out page: runs `logout()`, remembers the account, reloads the sign in page. Retry on error. | Props: `logout`, `account` (`{ email, name }`), `loginTo`, `reasonKey`, frame props of `AuthLayout`. Slots: `footer`, `brand`, `aside`, `corner`. Helpers: `rememberSignedOutAccount`, `takeSignedOutAccount`, `SIGNED_OUT_REASON`. | `templates/auth-login.vue` |
|
|
277
|
+
| `ListPage` | Whole list page: header, search, filters, table, pagination, bulk actions, loading, empty, no results and error states. Client or server mode (`total`). | Models: `page`, `pageSize`, `search`, `filter`, `sort`, `selected`. Props: `title`, `rows`, `columns`, `rowKey`, `rowTo`, `selectable`, `loading`, `error`, `total`, `paginate`, `searchable`, `searchKeys`, `filters`, `filterKey`, `filterMultiple`, `emptyTitle`. Slots: `actions`, `toolbar`, `toolbar-end`, `bulk`, `empty`, `empty-actions`, `no-results`, `error`, `cell-<key>`, `table`. Events: `retry`, `clear`, `rowClick`. | `templates/list-page.vue` |
|
|
278
|
+
| `DetailPage` | Record page: back link, title, status, actions, tabs, main column and aside with description lists. | Model: `v-model:tab`. Props: `title`, `backTo`, `backLabel`, `status` (`label`, `tone`, `dot`), `tabs`, `sections` (`title`, `items`), `loading`, `error`. Slots: default, `actions`, `badge`, `meta`, `aside`, `aside-before`, `panel-<value>`. | `templates/detail-page.vue` |
|
|
279
|
+
| `FormDrawer` | Drawer with a form: `Form` around the body, footer with delete (left), cancel and submit, a discard confirmation on close when the form is dirty, `SkeletonForm` while `loading`. | Models: `v-model:open`, `v-model:tab`. Props: `title`, `description`, `side`, `size`, `fill` (full height body), `tabs` (`FormDrawerTab`: `fields` gives the error dot and opens the tab on a failed submit, `fill: true` makes the drawer `fill` while the tab is active), `tabRoute` (keeps the tab in the hash under this key), `trail`, `backLabel`, `form`, `loading`, `readonly` (also disables every field of the body, your own `Form` in the slot too), `creating` (submit says Create, no dirty needed), `requireDirty`, `deletable`, `deleteDisabled`, `deleteHint`, `submitLabel`, `cancelLabel`, `deleteLabel`, `submitIcon` (icon of the submit button), `deleteIcon` (default `trash`), `guard`, `guardTitle`, `guardMessage` (the leave guard of the drawer: close, cancel, trail navigation), `beforeClose`, `onCancel`. `deleteHint` is a tooltip of the delete button, and the reason when `deleteDisabled`. Slots: default (`{ tab }`), `actions`, `title-trailing`, `skeleton`, `footer`. Events: `delete`, `submitted`, `navigate`, `afterLeave`. Exposes `confirmDiscard()`, `close()`. | `templates/form-drawer.vue` |
|
|
280
|
+
| `FormModal` | Modal with a form, like `FormDrawer`: `Form` around the body, footer with delete (left), cancel and submit, the leave guard on close, `SkeletonForm` while `loading`, `readonly`. | Model: `v-model:open`. Props: `title`, `description`, `label`, `size`, `sheet`, `width`, `fill`, `dismissible`, `form`, `nested` (the form is a `div`: a modal opened from a field of another form), `loading`, `readonly`, `creating`, `requireDirty`, `deletable`, `deleteDisabled`, `deleteHint`, `submitLabel`, `cancelLabel`, `deleteLabel`, `submitIcon` (icon of the submit button), `deleteIcon` (default `trash`), `guard`, `guardTitle`, `guardMessage`, `beforeClose`, `onCancel`. Slots: default, `actions`, `title-trailing`, `skeleton`, `footer` (`{ submit, cancel }`). Events: `delete`, `submitted`, `open`, `close`, `afterLeave`. Exposes `submit()`, `confirmDiscard()`, `close()`. | `templates/form-modal.vue` |
|
|
281
|
+
| `FormPage` | Form page: header, cards in a `Form`, sticky submit and cancel footer, dirty guard. | Props: `title`, `backTo`, `form` (from `useForm`), `dirty`, `saving`, `guard`, `requireDirty`, `submitLabel`, `cancelLabel`, `cancelTo`, `width`, `sticky`. Slots: default, `actions`, `footer`, `status`. Events: `submit`, `submitted`, `invalid`, `reset`, `cancel`. | `templates/form-page.vue` |
|
|
282
|
+
| `DashboardPage` | Overview page: header, stat grid, content grid. | Props: `title`, `eyebrow`, `description`, `stats` (`PageStat[]`), `statsColumns`, `columns`, `loading`. Slots: default, `actions`, `stats`, `sparkline`, `before`, `after`, `eyebrow`. | `templates/dashboard-page.vue` |
|
|
283
|
+
| `SettingsPage` | Settings as a page: section nav, panels, floating save bar when `dirty`. | Model: `v-model:section`. Props: `title`, `sections` (`value`, `label`, `icon`, `to`), `dirty`, `saving`, `saveBar`, `form`. Slots: `section-<value>`, `actions`, `nav-footer`. Events: `save`, `discard`. | `templates/settings-page.vue` |
|
|
284
|
+
| `SettingsSection` | Card of one settings section with a save footer. | Props: `title`, `description`, `icon`, `hint`, `saveable`, `saving`, `saveDisabled`, `saveLabel`, `form`. Slots: default, `actions`, `footer`, `hint`. Event: `save`. | `templates/settings-page.vue` |
|
|
285
|
+
| `SettingsGroup` | Block with label, description and actions inside a settings section. | Props: `label`, `description`, `level`, `row`. Slots: default, `label`, `description`, `actions`. | `templates/settings-modal.vue` |
|
|
286
|
+
| `SettingsModal` | Settings dialog with nav, built-in account and appearance sections, your own sections and subpages. A subpage title is a one line trail. | Models: `v-model:open`, `v-model:section`, `v-model:pages`. Props: `sections` (`id`, `label`, `icon`, `group`, `badge`, `to`), `account`, `presets`, `title`, `onSignOut`, `hideSession`, `beforeClose`, `route` (sync with `?settings=<section>/<page>`), `routeLocation` (`'hash'`: `#settings/<section>/<page>`), `accountSection` (id with the built-in account content, default `account`), `resolvePage(section, id, parents)`, `guard`, `guardTitle`, `guardMessage` (back, breadcrumb, another section, close and a route change of the modal ask before discarding a dirty `Form` of the section). Slot props: `section`, `close`, `page`, `pages`, `openPage(page)`, `back()`, `goTo(depth)` (the last three resolve `false` when the user keeps editing), `confirmLeave()`. Slots: `section-<id>`, `actions-<id>` (right of the header row, also on a subpage), `tabs-<id>` (tabs at the bottom of the header, like a drawer; the strip shows only when the slot renders content), `account-start` (above the profile card), `account-fields`. | `templates/settings-modal.vue` |
|
|
287
|
+
| `AppearanceSettings` | Theme (light, dark, system) and preset cards. Used by `SettingsModal`. Use alone in a settings page. | Props: `presets` (list or false), `themes`, `level`. | `presets.vue` (pages root) |
|
|
288
|
+
| `SaveBar` | Floating bar with save and discard for unsaved changes. | Props: `visible`, `saving`, `message`, `saveLabel`, `discardLabel`, `form`. Slots: default, `actions`. Events: `save`, `discard`. | `templates/settings-page.vue` |
|
|
289
|
+
| `EmptyPage` | First run screen with illustration, actions and onboarding steps. | Props: `title`, `description`, `icon`, `actionLabel`, `actionTo`, `onAction`, `actionIcon`, `secondaryLabel`, `secondaryTo`, `secondaryHref`, `onSecondary`, `steps` (`title`, `description`, `done`, `to`), `fill`. Slots: default, `illustration`, `title`, `description`, `actions`. | `templates/empty-page.vue` |
|
|
290
|
+
| `ErrorPage` | Error screen. Reads a Nuxt `error`. Use it in `app/error.vue`. | Props: `error`, `statusCode`, `title`, `message`, `homeTo`, `homeLabel`, `retryLabel`, `brandName`, `fill`, `onHome`, `onRetry`. Slots: default, `title`, `message`, `actions`, `brand`. | `templates/error-page.vue` |
|
|
291
|
+
| `NotFoundPage` | 404 screen. | Props: `title`, `message`, `homeTo`, `homeLabel`, `backLabel`, `brandName`, `fill`, `onHome`. Slots: default, `actions`, `brand`. | `templates/error-page.vue` |
|
|
292
|
+
| `Brand` | Logo and name block (image URL, inline SVG or component). | Props: `name`, `subtitle`, `icon`, `logo`, `to`, `size`, `accent`, `hideText`, `showName`. Slots: default, `logo`, `mark`, `subtitle`. | `templates/dashboard-layout.vue` |
|
|
293
|
+
| `AccountMenu` | Account button with avatar, name and a dropdown menu. Used by `DashboardLayout`. | Props: `name`, `email`, `avatar`, `menu` (menu items), `placement`, `icon`. Event: `select`. | `templates/dashboard-layout.vue` |
|
|
294
294
|
|
|
295
295
|
Nuxt ready layouts: with `k: { layouts: true }` the module registers the layouts `k-dashboard` and `k-auth`. They read brand, navigation, account and settings from `app.config.ts` (`k` key). `useDashboard()` gives the runtime account, breadcrumbs and badges for `k-dashboard`. See README, section "Nuxt: ready layouts".
|
|
296
296
|
|
|
@@ -298,12 +298,12 @@ Nuxt ready layouts: with `k: { layouts: true }` the module registers the layouts
|
|
|
298
298
|
|
|
299
299
|
Import from `@xleddyl/443-components-vue/grid`. It wraps AG Grid Community.
|
|
300
300
|
|
|
301
|
-
| Component | Purpose and when to use it | Main props, models, slots, events
|
|
302
|
-
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
303
|
-
| `DataGrid` | Big table: virtual scroll, column menu, search, CSV export, selection, server sort and paging, inline editing. For small tables use `Table`. | Models: `v-model:query`, `v-model:page`, `v-model:pageSize`, `v-model:sort` (`{ column, direction }`), `v-model:selected` (row ids, needs `rowIdKey` or `getRowId`; the header checkbox selects all the filtered rows). Template ref methods (`DataGridMethods` type, `useTemplateRef<DataGridMethods<Row>>`): `api`, `getSelectedRows`, `getSelectedIds`, `selectRows`, `selectAllRows`, `deselectAll`, `resetColumns` plus the spreadsheet ones. Props: `rows`, `columns` (AG Grid `ColDef`), `rowIdKey` or `getRowId`, `storageKey` (columns and page size in the preferences store; without `columnMenu` the column visibility always comes from `columns`), `density` (default `normal`), `selectable`, `loading`, `height`, `fill`, `autoHeight`, `toolbar`, `searchable`, `columnMenu` (default on), `exportable` (default on), `pageSizes` (default `[10, 25, 50, 100]`; these four defaults can be set for the whole app with `provideGridConfig` or the Nuxt option `k.grid: { density, columnMenu, exportable, pageSizes }`, a prop still wins), `serverSort`, `pagination`, `serverPagination`, `total`, `filterable`, `editable`, `spreadsheet`, `gridOptions`, `messages`, `filterCount`, `activeFilters` (`{ id, label, value }[]`, removable pills next to the filter button; a click opens the filters). Slots: `actions`, `actions-end` (after the column menu and export buttons), `filters` (`{ close, count }`, hosted in a modal opened by a funnel button next to the search). Events: `filtersReset`, `filterRemove` (id), `rowClick`, `selectionChange`, `sortChange`, `filterChange`, `cellsChange`, `cellsInvalid`, `dirtyChange`, `rangeChange`, `copy`. | `grid/data-grid.vue` |
|
|
304
|
-
| `DataGrid` with `spreadsheet` | Excel-like editing: cell range selection, copy and paste (TSV), fill down and right, clear, undo and redo, dirty cell tracking. Set `rowIdKey` or `getRowId`. | Template ref methods (`GridSpreadsheetMethods`): `getRange`, `getSelectedCells`, `selectRange`, `selectAll`, `setRangeValue`, `copyRange`, `paste`, `fillDown`, `fillRight`, `clearCells`, `clearRange`, `undo`, `redo`, `clearHistory`, `getDirtyCells`, `clearDirty`. The `actions` slot gets the same methods plus `range`, `selectedCellCount`, `dirtyCount`, `canUndo`, `canRedo`. Use `cellsChange` to save edits, `cellsInvalid` for rejected input.
|
|
305
|
-
| `GridToolbar` | Toolbar of `DataGrid` (search, column menu, export). `DataGrid` already renders it. Use it alone only for a custom grid setup. | Props: `api`, `searchable`, `columnMenu`, `exportable`, `exportFileName`, `debounce`, `filterCount`, `activeFilters`. Model: `v-model` (query). Slots: default (actions), `end`, `filters`. Events: `resetColumns`, `filtersReset`, `filterRemove`.
|
|
306
|
-
| Cell renderers | Use as `cellRenderer` in a column definition, with `cellRendererParams`. | `BadgeCell` (`tones`, `colors`, `labels`, `titles` (a record or a function of the value), `defaultTone`, `variant`; array values render one badge each, `max` adds a `+N` badge, `wrap`), `BooleanCell` (`trueLabel`, `falseLabel`), `DateCell` (`locale`, `options`, `relative`), `EmptyCell` (placeholder for empty values), `ImageCell` (`alt`, `rounded`, `fit`: `cover`, `contain` or `natural` (original aspect, height `size`), `size`), `LinkCell` (`href`, `label`, `target`), `ButtonCell` (`onClick`, `label`, `ariaLabel`, `tooltip`, `disabled`, `disabledReason` (functions of value and row; a disabled button ignores clicks and shows the reason in a tooltip), `emptyLabel`, `tone`, `variant`, `icon` (as `Button`, an `xs` button; without them an inline link style button); does not trigger the row click).
|
|
301
|
+
| Component | Purpose and when to use it | Main props, models, slots, events | Playground |
|
|
302
|
+
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
|
|
303
|
+
| `DataGrid` | Big table: virtual scroll, column menu, search, CSV export, selection, server sort and paging, inline editing. For small tables use `Table`. | Models: `v-model:query`, `v-model:page`, `v-model:pageSize`, `v-model:sort` (`{ column, direction }`), `v-model:selected` (row ids, needs `rowIdKey` or `getRowId`; the header checkbox selects all the filtered rows across pages; a row hidden by the search or a filter leaves the selection, `keepHiddenSelected` keeps it; with `serverPagination` the ids of other pages stay, and leave only when `rows` holds the whole `total`). Template ref methods (`DataGridMethods` type, `useTemplateRef<DataGridMethods<Row>>`): `api`, `getSelectedRows`, `getSelectedIds`, `selectRows`, `selectAllRows`, `deselectAll`, `resetColumns` plus the spreadsheet ones. Props: `rows`, `columns` (AG Grid `ColDef`), `rowIdKey` or `getRowId`, `keepHiddenSelected`, `storageKey` (columns and page size in the preferences store; without `columnMenu` the column visibility always comes from `columns`), `density` (default `normal`), `selectable`, `loading`, `height`, `fill`, `autoHeight`, `toolbar`, `searchable`, `columnMenu` (default on), `exportable` (default on), `pageSizes` (default `[10, 25, 50, 100]`; these four defaults can be set for the whole app with `provideGridConfig` or the Nuxt option `k.grid: { density, columnMenu, exportable, pageSizes }`, a prop still wins), `serverSort`, `pagination`, `serverPagination`, `total`, `filterable`, `editable`, `spreadsheet`, `gridOptions`, `messages`, `filterCount`, `activeFilters` (`{ id, label, value }[]`, removable pills next to the filter button; a click opens the filters). Slots: `actions`, `actions-end` (after the column menu and export buttons), `filters` (`{ close, count }`, hosted in a modal opened by a funnel button next to the search). Events: `filtersReset`, `filterRemove` (id), `rowClick`, `selectionChange`, `sortChange`, `filterChange`, `cellsChange`, `cellsInvalid`, `dirtyChange`, `rangeChange`, `copy`. | `grid/data-grid.vue` |
|
|
304
|
+
| `DataGrid` with `spreadsheet` | Excel-like editing: cell range selection, copy and paste (TSV), fill down and right, clear, undo and redo, dirty cell tracking. Set `rowIdKey` or `getRowId`. | Template ref methods (`GridSpreadsheetMethods`): `getRange`, `getSelectedCells`, `selectRange`, `selectAll`, `setRangeValue`, `copyRange`, `paste`, `fillDown`, `fillRight`, `clearCells`, `clearRange`, `undo`, `redo`, `clearHistory`, `getDirtyCells`, `clearDirty`. The `actions` slot gets the same methods plus `range`, `selectedCellCount`, `dirtyCount`, `canUndo`, `canRedo`. Use `cellsChange` to save edits, `cellsInvalid` for rejected input. | `grid/spreadsheet.vue` |
|
|
305
|
+
| `GridToolbar` | Toolbar of `DataGrid` (search, column menu, export). `DataGrid` already renders it. Use it alone only for a custom grid setup. | Props: `api`, `searchable`, `columnMenu`, `exportable`, `exportFileName`, `debounce`, `filterCount`, `activeFilters`. Model: `v-model` (query). Slots: default (actions), `end`, `filters`. Events: `resetColumns`, `filtersReset`, `filterRemove`. | - |
|
|
306
|
+
| Cell renderers | Use as `cellRenderer` in a column definition, with `cellRendererParams`. | `BadgeCell` (`tones`, `colors`, `labels`, `titles` (a record or a function of the value), `defaultTone`, `variant`; array values render one badge each, `max` adds a `+N` badge, `wrap`), `BooleanCell` (`trueLabel`, `falseLabel`), `DateCell` (`locale`, `options`, `relative`), `EmptyCell` (placeholder for empty values), `ImageCell` (`alt`, `rounded`, `fit`: `cover`, `contain` or `natural` (original aspect, height `size`), `size`), `LinkCell` (`href`, `label`, `target`), `ButtonCell` (`onClick`, `label`, `ariaLabel`, `tooltip`, `disabled`, `disabledReason` (functions of value and row; a disabled button ignores clicks and shows the reason in a tooltip), `emptyLabel`, `tone`, `variant`, `icon` (as `Button`, an `xs` button; without them an inline link style button); does not trigger the row click). | `grid/data-grid.vue` |
|
|
307
307
|
|
|
308
308
|
Grid helpers: `registerGridModules`, `registerGridEditorModules`, `registerGridFilterModules`, `registerGridSpreadsheetModules` (register AG Grid modules by hand), `createGridTheme`, `parseTsv`, `formatTsv`.
|
|
309
309
|
|
package/README.md
CHANGED
|
@@ -481,6 +481,7 @@ Composables: `useTheme`, `usePreset`, `useForm`, `useField`, `useFieldControl`,
|
|
|
481
481
|
- An icon-only `Button` (no label: `square`, or only an `icon`) shows its `aria-label` (or `title`) in a `Tooltip` styled tooltip on hover and keyboard focus, after the usual delay. The native `title` stays only until mount, so there is never a double tooltip. Inside a `Tooltip` trigger the button shows none (the outer tooltip wins); `tooltip: false` turns it off.
|
|
482
482
|
- `tooltip="..."` adds a tooltip to any button, also with a label; when it differs from the accessible name it is also the button description.
|
|
483
483
|
- `disabledReason` explains a disabled button. With `disabled` and a reason the button uses `aria-disabled` instead of `disabled`: it stays in the Tab order and receives hover, clicks (and implicit form submission) are ignored, the reason shows as a tooltip and is linked with `aria-describedby`, and before mount the reason is the native `title`. Without a reason a disabled button behaves as before.
|
|
484
|
+
- Menu items of `DropdownMenu` and `ContextMenu` (and every `MenuItems` list: the account menu, `FilterPills` option menus) take `disabledReason` too: with `disabled` the item stays reachable with the arrow keys but cannot be selected, and the reason shows as a tooltip on hover and keyboard focus and is linked with `aria-describedby`. Use it instead of putting the reason in `description`.
|
|
484
485
|
- The same works for `CommandButton` (`CommandItem.disabledReason`, and `iconOnly` shows the label as a tooltip), `Tabs` (`TabItem.title`, also on a disabled tab), `FormDrawer` and `FormModal` (`deleteHint`) and the grid `ButtonCell` (`tooltip`, `disabled`, `disabledReason` params).
|
|
485
486
|
|
|
486
487
|
```vue
|
|
@@ -821,17 +822,17 @@ Both take the `AuthLayout` frame props and the `brand`, `corner`, `footer` and `
|
|
|
821
822
|
|
|
822
823
|
### Page templates
|
|
823
824
|
|
|
824
|
-
| Component | What it gives you
|
|
825
|
-
| -------------------------------------------- |
|
|
826
|
-
| `DashboardPage` | PageHeader (`title`, `eyebrow`, `description`, `#actions`), a Stat grid from `stats` (or `#stats`), a content grid (`columns`, default 1 then 3 columns).
|
|
827
|
-
| `ListPage` | Header, toolbar (search with `searchable`, FilterPills from `filters`, `#toolbar`, `#bulk` when rows are selected), Table from `columns`/`rows`, Pagination. Client mode filters (`searchKeys`, `filterKey`), sorts and paginates; pass `total` for server mode. States: `loading` skeleton rows, first run `#empty`, no results with a clear button, `error` with retry. `cell-*` and `header-*` slots go to the Table.
|
|
828
|
-
| `DetailPage` | Back link (`backTo`), title, `status` badge, `#actions`, optional `tabs` (`#panel-<value>`), main column plus an aside with DescriptionList cards from `sections` (or `#aside`). `loading` and `error` states.
|
|
829
|
-
| `FormDrawer` | A `Drawer` with a `Form` (`form` from `useForm`) around the body and a footer: delete on the left (`deletable`, `@delete`, `deleteDisabled`, `deleteHint`), cancel and submit on the right. `creating` changes the submit text to Create and enables it without changes; otherwise it needs a dirty form (`requireDirty`). `readonly` keeps only a Close button and disables every field of the body (see [Forms](#forms)). Every close asks before discarding a dirty form (`guard`, the leave guard of its `Drawer`), then runs `beforeClose`. `deleteHint` is the tooltip of the delete button, and its reason when `deleteDisabled`. `onCancel` replaces the close of the cancel button (back to a parent view), after the same question. `loading` shows a `SkeletonForm` (or `#skeleton`) and keeps the header, the tabs and the footer in place. Pass another `form` to switch the body to a subpage (with `trail`). A tab with `fill: true` (`FormDrawerTab`) makes the drawer `fill` while it is active (a tab with a long table). |
|
|
830
|
-
| `FormModal` | The modal version of `FormDrawer`: a `Modal` with a `Form` around the body, footer with delete (`deletable`, `deleteDisabled`, `deleteHint`), cancel (ghost) and submit (`creating`, `requireDirty`, `submitting` state), the leave guard on close and cancel, `loading` skeleton, `readonly`. `nested` renders the form as a `div`, for a modal opened from a field of another form (its footer submit then calls `submit()`). `@submitted` fires after a successful submit.
|
|
831
|
-
| `FormPage` | Header, your cards inside `Form` (`form` from `useForm`, or a plain `form` emitting `submit`), sticky footer with cancel and submit, unsaved state, dirty guard (`guard`, on by default) through `useDirtyGuard`.
|
|
832
|
-
| `SettingsPage`, `SettingsSection`, `SaveBar` | Section nav (sticky on the left, a scrolling row on narrow screens; items with `to` become route links), `#section-<value>` panels, section cards with a save footer, and a floating save bar while `dirty`.
|
|
833
|
-
| `ErrorPage`, `NotFoundPage` | Status code, title, message (defaults per status code, reads a Nuxt `error`), home, retry (`@retry`) and back actions. `@home` replaces the home link, handy for `clearError`.
|
|
834
|
-
| `EmptyPage` | First run screen: illustration, title, description, primary and secondary actions, onboarding `steps`.
|
|
825
|
+
| Component | What it gives you |
|
|
826
|
+
| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
827
|
+
| `DashboardPage` | PageHeader (`title`, `eyebrow`, `description`, `#actions`), a Stat grid from `stats` (or `#stats`), a content grid (`columns`, default 1 then 3 columns). |
|
|
828
|
+
| `ListPage` | Header, toolbar (search with `searchable`, FilterPills from `filters`, `#toolbar`, `#bulk` when rows are selected), Table from `columns`/`rows`, Pagination. Client mode filters (`searchKeys`, `filterKey`), sorts and paginates; pass `total` for server mode. States: `loading` skeleton rows, first run `#empty`, no results with a clear button, `error` with retry. `cell-*` and `header-*` slots go to the Table. |
|
|
829
|
+
| `DetailPage` | Back link (`backTo`), title, `status` badge, `#actions`, optional `tabs` (`#panel-<value>`), main column plus an aside with DescriptionList cards from `sections` (or `#aside`). `loading` and `error` states. |
|
|
830
|
+
| `FormDrawer` | A `Drawer` with a `Form` (`form` from `useForm`) around the body and a footer: delete on the left (`deletable`, `@delete`, `deleteDisabled`, `deleteHint`), cancel and submit on the right. `creating` changes the submit text to Create and enables it without changes; otherwise it needs a dirty form (`requireDirty`). `readonly` keeps only a Close button and disables every field of the body (see [Forms](#forms)). Every close asks before discarding a dirty form (`guard`, the leave guard of its `Drawer`), then runs `beforeClose`. `deleteHint` is the tooltip of the delete button, and its reason when `deleteDisabled`. `submitIcon` adds an icon to the submit button (`check`, `plus`, `printer`), `deleteIcon` changes the delete icon (default `trash`). `onCancel` replaces the close of the cancel button (back to a parent view), after the same question. `loading` shows a `SkeletonForm` (or `#skeleton`) and keeps the header, the tabs and the footer in place. Pass another `form` to switch the body to a subpage (with `trail`). A tab with `fill: true` (`FormDrawerTab`) makes the drawer `fill` while it is active (a tab with a long table). |
|
|
831
|
+
| `FormModal` | The modal version of `FormDrawer`: a `Modal` with a `Form` around the body, footer with delete (`deletable`, `deleteDisabled`, `deleteHint`, `deleteIcon`), cancel (ghost) and submit (`creating`, `requireDirty`, `submitting` state, `submitIcon`), the leave guard on close and cancel, `loading` skeleton, `readonly`. `nested` renders the form as a `div`, for a modal opened from a field of another form (its footer submit then calls `submit()`). `@submitted` fires after a successful submit. |
|
|
832
|
+
| `FormPage` | Header, your cards inside `Form` (`form` from `useForm`, or a plain `form` emitting `submit`), sticky footer with cancel and submit, unsaved state, dirty guard (`guard`, on by default) through `useDirtyGuard`. |
|
|
833
|
+
| `SettingsPage`, `SettingsSection`, `SaveBar` | Section nav (sticky on the left, a scrolling row on narrow screens; items with `to` become route links), `#section-<value>` panels, section cards with a save footer, and a floating save bar while `dirty`. |
|
|
834
|
+
| `ErrorPage`, `NotFoundPage` | Status code, title, message (defaults per status code, reads a Nuxt `error`), home, retry (`@retry`) and back actions. `@home` replaces the home link, handy for `clearError`. |
|
|
835
|
+
| `EmptyPage` | First run screen: illustration, title, description, primary and secondary actions, onboarding `steps`. |
|
|
835
836
|
|
|
836
837
|
`useDirtyGuard(dirty, options?)` asks before leaving (router navigation through `ConfirmHost`, or the native confirm) and on tab close. Returns `confirmLeave()` and `allowNext()`. It is built on the leave guard, see [Unsaved changes](#unsaved-changes).
|
|
837
838
|
|
|
@@ -982,7 +983,7 @@ Accessibility related props and defaults:
|
|
|
982
983
|
- A column without a visible header (a photo column) keeps a name for the Columns menu with `headerValueGetter: ({ location }) => (location === 'header' ? '' : 'Photo')`: the menu reads the name for the `columnToolPanel` location.
|
|
983
984
|
- `DataGrid` takes `gridOptions` for any AG Grid option it does not wrap (`rowHeight`, `onCellEditingStopped`, `onFilterChanged`, ...). A prop of `DataGrid` wins only when it is set: `getRowId`, `rowSelection` (when `selectable` is off), `autoSizeStrategy` (also `undefined` to turn it off), `tooltipShowDelay`, `overlayNoRowsTemplate` and `overlayLoadingTemplate` from `gridOptions` are used otherwise; `defaultColDef` and `localeText` are merged over the component defaults, and `context` is merged under the cell context. Handlers from both run.
|
|
984
985
|
- `DataGrid` row ids: `getRowId: (params) => string` (wins), `rowIdKey` (a field of the row), or `gridOptions.getRowId`.
|
|
985
|
-
- `DataGrid` `v-model:selected` (`string[]`) is the selected row ids, two way, for `selectable` grids (also `'single'`, at most one id). It needs row ids (`rowIdKey`, `getRowId` or `gridOptions.getRowId`); a dev warning tells you when they are missing. Leave it unbound for an uncontrolled grid. The header checkbox selects all the filtered rows (`selectAll: 'filtered'`): not the rows hidden by the search or the column filters, and not only the current page. A
|
|
986
|
+
- `DataGrid` `v-model:selected` (`string[]`) is the selected row ids, two way, for `selectable` grids (also `'single'`, at most one id). It needs row ids (`rowIdKey`, `getRowId` or `gridOptions.getRowId`); a dev warning tells you when they are missing. Leave it unbound for an uncontrolled grid. The header checkbox selects all the filtered rows (`selectAll: 'filtered'`): not the rows hidden by the search or the column filters, and not only the current page. A row hidden by the toolbar search, a column filter or an external filter leaves the selection: the grid deselects it and drops its id from the model when the filter changes, and an id set in the model for a hidden row is dropped too, so a bulk action never acts on rows the user cannot see. `keepHiddenSelected` keeps the old behavior (a hidden row stays selected). Client pagination keeps the selection across pages. A row that disappears from `rows` is dropped from the model, except while `loading` is set or the rows are empty, so a preselected model survives the first load. With `serverPagination` the ids of rows that are not in the current `rows` stay in the model: the selection survives a page change and a re-fetch, the footer counts the whole model, and the header checkbox only selects the rows of the page. The grid cannot see the other pages, so it drops an id that the server filter excludes only when it knows the whole result: once `loading` is off and `rows` holds every row of `total` (or the result is empty), the ids that are not in `rows` leave the model. Rows of the page hidden by a client column filter leave it as in client mode. To drop the ids of other pages when your own filters change, set the model yourself (for example `selected = []` when the query changes). Ids of rows that are not loaded yet stay out of the grid and are selected when the rows arrive. `selectionChange` still emits the selected rows of the grid.
|
|
986
987
|
- `DataGrid` template ref methods have a type: `DataGridMethods<Row>` (`api`, `getSelectedRows`, `getSelectedIds`, `selectRows(ids)`, `selectAllRows()` for the filtered rows, `deselectAll`, `resetColumns` and the `GridSpreadsheetMethods`; `selectAll` stays the cell range one of the spreadsheet).
|
|
987
988
|
|
|
988
989
|
```ts
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
v-if="deletable && !readonly"
|
|
52
52
|
variant="ghost"
|
|
53
53
|
tone="danger"
|
|
54
|
-
icon="
|
|
54
|
+
:icon="deleteIcon"
|
|
55
55
|
size="sm"
|
|
56
56
|
:disabled="loading || isSaving || deleteDisabled"
|
|
57
57
|
:disabled-reason="deleteDisabled ? deleteHint : void 0"
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
type="submit"
|
|
76
76
|
:form="formId"
|
|
77
77
|
size="sm"
|
|
78
|
+
:icon="submitIcon"
|
|
78
79
|
:loading="isSaving"
|
|
79
80
|
:disabled="submitDisabled"
|
|
80
81
|
>
|
|
@@ -123,6 +124,8 @@ const props = defineProps({
|
|
|
123
124
|
submitLabel: { type: String, required: false },
|
|
124
125
|
cancelLabel: { type: String, required: false },
|
|
125
126
|
deleteLabel: { type: String, required: false },
|
|
127
|
+
submitIcon: { type: null, required: false },
|
|
128
|
+
deleteIcon: { type: null, required: false, default: "trash" },
|
|
126
129
|
guard: { type: Boolean, required: false, default: true },
|
|
127
130
|
guardTitle: { type: String, required: false },
|
|
128
131
|
guardMessage: { type: String, required: false },
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FormSchema, UseFormReturn } from '../../composables/useForm';
|
|
2
|
+
import type { IconName } from '../../composables/useIcons';
|
|
2
3
|
import type { TabItem } from '../layout/types';
|
|
3
4
|
import type { FormDrawerTab } from './types';
|
|
4
5
|
import type { DialogBeforeClose, DrawerSide, DrawerSize } from '../overlays/types';
|
|
@@ -25,6 +26,8 @@ declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props
|
|
|
25
26
|
submitLabel?: string;
|
|
26
27
|
cancelLabel?: string;
|
|
27
28
|
deleteLabel?: string;
|
|
29
|
+
submitIcon?: IconName;
|
|
30
|
+
deleteIcon?: IconName;
|
|
28
31
|
guard?: boolean;
|
|
29
32
|
guardTitle?: string;
|
|
30
33
|
guardMessage?: string;
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
v-if="deletable && !readonly"
|
|
50
50
|
variant="ghost"
|
|
51
51
|
tone="danger"
|
|
52
|
-
icon="
|
|
52
|
+
:icon="deleteIcon"
|
|
53
53
|
size="sm"
|
|
54
54
|
:disabled="loading || isSaving || deleteDisabled"
|
|
55
55
|
:disabled-reason="deleteDisabled ? deleteHint : void 0"
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
:type="nested ? 'button' : 'submit'"
|
|
74
74
|
:form="nested ? void 0 : formId"
|
|
75
75
|
size="sm"
|
|
76
|
+
:icon="submitIcon"
|
|
76
77
|
:loading="isSaving"
|
|
77
78
|
:disabled="submitDisabled"
|
|
78
79
|
@click="nested ? submit() : void 0"
|
|
@@ -115,6 +116,8 @@ const props = defineProps({
|
|
|
115
116
|
submitLabel: { type: String, required: false },
|
|
116
117
|
cancelLabel: { type: String, required: false },
|
|
117
118
|
deleteLabel: { type: String, required: false },
|
|
119
|
+
submitIcon: { type: null, required: false },
|
|
120
|
+
deleteIcon: { type: null, required: false, default: "trash" },
|
|
118
121
|
guard: { type: Boolean, required: false, default: true },
|
|
119
122
|
guardTitle: { type: String, required: false },
|
|
120
123
|
guardMessage: { type: String, required: false },
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FormSchema, UseFormReturn } from '../../composables/useForm';
|
|
2
|
+
import type { IconName } from '../../composables/useIcons';
|
|
2
3
|
import type { DialogBeforeClose, ModalSize } from '../overlays/types';
|
|
3
4
|
declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
5
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
|
|
@@ -22,6 +23,8 @@ declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props
|
|
|
22
23
|
submitLabel?: string;
|
|
23
24
|
cancelLabel?: string;
|
|
24
25
|
deleteLabel?: string;
|
|
26
|
+
submitIcon?: IconName;
|
|
27
|
+
deleteIcon?: IconName;
|
|
25
28
|
guard?: boolean;
|
|
26
29
|
guardTitle?: string;
|
|
27
30
|
guardMessage?: string;
|
package/dist/grid/DataGrid.vue
CHANGED
|
@@ -157,6 +157,7 @@ const props = defineProps({
|
|
|
157
157
|
storageKey: { type: String, required: false },
|
|
158
158
|
density: { type: String, required: false, default: void 0 },
|
|
159
159
|
selectable: { type: [Boolean, String], required: false, default: false },
|
|
160
|
+
keepHiddenSelected: { type: Boolean, required: false },
|
|
160
161
|
loading: { type: Boolean, required: false },
|
|
161
162
|
height: { type: String, required: false, default: "28rem" },
|
|
162
163
|
fill: { type: Boolean, required: false },
|
|
@@ -480,6 +481,7 @@ function onModelUpdated() {
|
|
|
480
481
|
syncPagination();
|
|
481
482
|
const current = api.value;
|
|
482
483
|
if (!current) return;
|
|
484
|
+
deselectHidden();
|
|
483
485
|
const count = props.serverPagination ? props.total : current.getDisplayedRowCount();
|
|
484
486
|
if (props.loading) return;
|
|
485
487
|
if (announcedCount !== null && announcedCount !== count)
|
|
@@ -512,6 +514,30 @@ function sameIds(a, b) {
|
|
|
512
514
|
const lookup = new Set(a);
|
|
513
515
|
return b.every((id) => lookup.has(id));
|
|
514
516
|
}
|
|
517
|
+
function hiddenNodeIds(current) {
|
|
518
|
+
const hidden = /* @__PURE__ */ new Set();
|
|
519
|
+
if (props.keepHiddenSelected || !current.isAnyFilterPresent()) return hidden;
|
|
520
|
+
const visible = /* @__PURE__ */ new Set();
|
|
521
|
+
current.forEachNodeAfterFilter((node) => {
|
|
522
|
+
if (node.id !== void 0) visible.add(node.id);
|
|
523
|
+
});
|
|
524
|
+
current.forEachNode((node) => {
|
|
525
|
+
if (node.id !== void 0 && !visible.has(node.id)) hidden.add(node.id);
|
|
526
|
+
});
|
|
527
|
+
return hidden;
|
|
528
|
+
}
|
|
529
|
+
let serverRowsReceived = false;
|
|
530
|
+
watch(
|
|
531
|
+
() => [props.rows, props.loading],
|
|
532
|
+
([, loading]) => {
|
|
533
|
+
if (!loading) serverRowsReceived = true;
|
|
534
|
+
}
|
|
535
|
+
);
|
|
536
|
+
function serverResultLoaded() {
|
|
537
|
+
if (!props.serverPagination || props.loading || props.keepHiddenSelected) return false;
|
|
538
|
+
if (props.total > 0) return props.rows.length >= props.total;
|
|
539
|
+
return serverRowsReceived && props.rows.length === 0;
|
|
540
|
+
}
|
|
515
541
|
function readNodeIds(current) {
|
|
516
542
|
const present = /* @__PURE__ */ new Set();
|
|
517
543
|
current.forEachNode((node) => {
|
|
@@ -522,7 +548,7 @@ function readNodeIds(current) {
|
|
|
522
548
|
function mergedSelection(current) {
|
|
523
549
|
const gridIds = current.getSelectedNodes().flatMap((node) => node.id ? [node.id] : []);
|
|
524
550
|
const model = selected.value ?? [];
|
|
525
|
-
const keepUnknown = props.serverPagination || props.loading;
|
|
551
|
+
const keepUnknown = (props.serverPagination || props.loading) && !serverResultLoaded();
|
|
526
552
|
if (!keepUnknown) return gridIds;
|
|
527
553
|
const present = readNodeIds(current);
|
|
528
554
|
const kept = model.filter((id) => !present.has(id));
|
|
@@ -532,13 +558,14 @@ function applyIds(ids) {
|
|
|
532
558
|
const current = api.value;
|
|
533
559
|
if (!current || !props.selectable) return;
|
|
534
560
|
const wanted = new Set(ids);
|
|
561
|
+
const hidden = hiddenNodeIds(current);
|
|
535
562
|
const single = props.selectable === "single";
|
|
536
563
|
const select = [];
|
|
537
564
|
const deselect = [];
|
|
538
565
|
let chosen = false;
|
|
539
566
|
current.forEachNode((node) => {
|
|
540
567
|
const id = node.id;
|
|
541
|
-
const should = id !== void 0 && wanted.has(id) && !(single && chosen);
|
|
568
|
+
const should = id !== void 0 && wanted.has(id) && !hidden.has(id) && !(single && chosen);
|
|
542
569
|
if (should) chosen = true;
|
|
543
570
|
if (Boolean(node.isSelected()) === should) return;
|
|
544
571
|
(should ? select : deselect).push(node);
|
|
@@ -548,20 +575,33 @@ function applyIds(ids) {
|
|
|
548
575
|
}
|
|
549
576
|
function applySelection() {
|
|
550
577
|
if (!isSelectionBound() || !selected.value) return;
|
|
551
|
-
|
|
578
|
+
const current = api.value;
|
|
579
|
+
const hidden = current ? hiddenNodeIds(current) : null;
|
|
580
|
+
const ids = hidden?.size ? selected.value.filter((id) => !hidden.has(id)) : selected.value;
|
|
581
|
+
if (ids.length !== selected.value.length) selected.value = ids;
|
|
582
|
+
applyIds(ids);
|
|
552
583
|
}
|
|
553
584
|
function reconcileSelection() {
|
|
554
585
|
const current = api.value;
|
|
555
586
|
if (!current || !isSelectionBound() || !selected.value) return;
|
|
556
|
-
|
|
587
|
+
const complete = !props.serverPagination && !props.loading || serverResultLoaded();
|
|
588
|
+
if (complete) {
|
|
557
589
|
const present = readNodeIds(current);
|
|
558
|
-
if (present.size) {
|
|
590
|
+
if (present.size || props.serverPagination) {
|
|
559
591
|
const pruned = selected.value.filter((id) => present.has(id));
|
|
560
592
|
if (pruned.length !== selected.value.length) selected.value = pruned;
|
|
561
593
|
}
|
|
562
594
|
}
|
|
563
595
|
applySelection();
|
|
564
596
|
}
|
|
597
|
+
function deselectHidden() {
|
|
598
|
+
const current = api.value;
|
|
599
|
+
if (!current || !props.selectable) return;
|
|
600
|
+
const hidden = hiddenNodeIds(current);
|
|
601
|
+
if (!hidden.size) return;
|
|
602
|
+
const nodes = current.getSelectedNodes().filter((node) => node.id !== void 0 && hidden.has(node.id));
|
|
603
|
+
if (nodes.length) current.setNodesSelected({ nodes, newValue: false });
|
|
604
|
+
}
|
|
565
605
|
function writeSelection(current) {
|
|
566
606
|
if (!isSelectionBound()) return;
|
|
567
607
|
const next = mergedSelection(current);
|
|
@@ -582,6 +622,12 @@ watch(
|
|
|
582
622
|
}
|
|
583
623
|
);
|
|
584
624
|
watch(rowIdGetter, checkSelectionRowIds);
|
|
625
|
+
watch(
|
|
626
|
+
() => props.keepHiddenSelected,
|
|
627
|
+
(keep) => {
|
|
628
|
+
if (!keep) deselectHidden();
|
|
629
|
+
}
|
|
630
|
+
);
|
|
585
631
|
function onSortChanged(event) {
|
|
586
632
|
const change = readSort(event.api);
|
|
587
633
|
if (!sameSort(change, sort.value)) sort.value = change;
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
:aria-expanded="expanded === keyOf(groupIndex, entryIndex) ? 'true' : 'false'"
|
|
41
41
|
:aria-controls="`${menuId}-sub-${groupIndex}-${entryIndex}`"
|
|
42
42
|
:aria-disabled="entry.disabled ? 'true' : void 0"
|
|
43
|
+
:aria-describedby="reasonId(entry, groupIndex, entryIndex)"
|
|
43
44
|
:data-label="entry.label.toLowerCase()"
|
|
44
45
|
data-k-menu-item
|
|
45
46
|
@pointermove="onItemPointerMove($event, entry, groupIndex, entryIndex)"
|
|
@@ -48,6 +49,12 @@
|
|
|
48
49
|
<Icon v-if="entry.icon" :name="entry.icon" class="k-menu-item-icon" />
|
|
49
50
|
<span class="k-menu-item-label">{{ entry.label }}</span>
|
|
50
51
|
<Icon name="chevron-right" class="k-menu-item-chevron" />
|
|
52
|
+
<HintTooltip
|
|
53
|
+
v-if="reasonOf(entry)"
|
|
54
|
+
:id="reasonId(entry, groupIndex, entryIndex)"
|
|
55
|
+
:text="reasonOf(entry)"
|
|
56
|
+
placement="right"
|
|
57
|
+
/>
|
|
51
58
|
</div>
|
|
52
59
|
<MenuList
|
|
53
60
|
:id="`${menuId}-sub-${groupIndex}-${entryIndex}`"
|
|
@@ -74,6 +81,7 @@
|
|
|
74
81
|
'k-menu-item-danger': entry.type !== 'checkbox' && entry.type !== 'radio' && entry.tone === 'danger'
|
|
75
82
|
}"
|
|
76
83
|
:aria-disabled="entry.disabled ? 'true' : void 0"
|
|
84
|
+
:aria-describedby="reasonId(entry, groupIndex, entryIndex)"
|
|
77
85
|
:aria-keyshortcuts="
|
|
78
86
|
entry.shortcut ? ariaKeyShortcuts(entry.shortcut, apple) : void 0
|
|
79
87
|
"
|
|
@@ -110,6 +118,12 @@
|
|
|
110
118
|
{{ key }}
|
|
111
119
|
</Kbd>
|
|
112
120
|
</span>
|
|
121
|
+
<HintTooltip
|
|
122
|
+
v-if="reasonOf(entry)"
|
|
123
|
+
:id="reasonId(entry, groupIndex, entryIndex)"
|
|
124
|
+
:text="reasonOf(entry)"
|
|
125
|
+
placement="right"
|
|
126
|
+
/>
|
|
113
127
|
</component>
|
|
114
128
|
</template>
|
|
115
129
|
</div>
|
|
@@ -129,6 +143,7 @@ import { MENU_ROOT_KEY } from "./menu";
|
|
|
129
143
|
import { provideFieldBoundary } from "../../composables/useFieldBoundary";
|
|
130
144
|
import { useApplePlatform } from "../core/env";
|
|
131
145
|
import { useTypeahead } from "../core/roving";
|
|
146
|
+
import HintTooltip from "./HintTooltip.vue";
|
|
132
147
|
provideFieldBoundary();
|
|
133
148
|
const props = defineProps({
|
|
134
149
|
items: { type: Array, required: true },
|
|
@@ -192,6 +207,12 @@ function groupLabelId(group, groupIndex) {
|
|
|
192
207
|
const index = group.findIndex((entry) => entry.type === "label");
|
|
193
208
|
return index === -1 ? void 0 : `${menuId.value}-label-${groupIndex}-${index}`;
|
|
194
209
|
}
|
|
210
|
+
function reasonOf(entry) {
|
|
211
|
+
return entry.disabled && entry.disabledReason ? entry.disabledReason : void 0;
|
|
212
|
+
}
|
|
213
|
+
function reasonId(entry, groupIndex, entryIndex) {
|
|
214
|
+
return reasonOf(entry) ? `${menuId.value}-reason-${groupIndex}-${entryIndex}` : void 0;
|
|
215
|
+
}
|
|
195
216
|
function hasChildren(entry) {
|
|
196
217
|
return (entry.type === void 0 || entry.type === "item") && Boolean(entry.children?.length);
|
|
197
218
|
}
|
package/package.json
CHANGED