@xleddyl/443-components-vue 0.16.90 → 0.16.92
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 +11 -10
- package/README.md +16 -8
- package/dist/components/data/Tree.vue +9 -17
- package/dist/components/data/Tree.vue.d.ts +1 -0
- package/dist/components/layout/Breadcrumbs.vue +6 -2
- package/dist/components/layout/Breadcrumbs.vue.d.ts +3 -1
- package/dist/components/layout/PageHeader.vue +28 -1
- package/dist/components/layout/PageHeader.vue.d.ts +12 -6
- package/dist/components/overlays/CommandList.vue +29 -3
- package/dist/components/overlays/ConfirmDialog.vue.d.ts +2 -2
- package/dist/components/overlays/ConfirmHost.vue.d.ts +2 -2
- package/dist/components/templates/ListPage.vue +7 -4
- package/dist/components/templates/ListPage.vue.d.ts +1 -0
- package/dist/components/templates/SettingsModal.vue.d.ts +2 -2
- package/dist/internal/layout/query.d.ts +1 -0
- package/dist/internal/layout/query.mjs +16 -3
- package/dist/internal/overlays/HintTooltip.vue +10 -2
- package/dist/internal/overlays/HintTooltip.vue.d.ts +2 -0
- package/dist/internal/overlays/OverlayView.vue.d.ts +2 -2
- package/dist/nuxt/composables.d.ts +1 -0
- package/dist/nuxt/composables.mjs +1 -0
- package/dist/nuxt/module.mjs +2 -2
- package/dist/nuxt/runtime/navigation.mjs +1 -1
- package/dist/nuxt/runtime/route-state.mjs +2 -0
- package/dist/styles/data/tree.css +29 -5
- package/dist/styles/layout/breadcrumbs.css +2 -0
- package/dist/styles/layout/page-header.css +23 -0
- package/dist/styles/overlays/floating.css +1 -0
- package/package.json +6 -1
package/CATALOG.md
CHANGED
|
@@ -7,7 +7,7 @@ This file is a map, not the full reference. For all props, tokens, theming and a
|
|
|
7
7
|
## How to use the names
|
|
8
8
|
|
|
9
9
|
- In Nuxt, every component has the prefix `K` (set by `k.prefix`). `Button.vue` is `<KButton>`. This catalog uses the short name (`Button`).
|
|
10
|
-
- Every `use*` composable, `toast` and `withLoading` are auto-imported in Nuxt. Without Nuxt, import them from `@xleddyl/443-components-vue`.
|
|
10
|
+
- Every `use*` composable, `toast` and `withLoading` are auto-imported in Nuxt. Without Nuxt, or in a Nuxt module or layer (it cannot rely on the auto-imports of the host), import them from `@xleddyl/443-components-vue`, and the Nuxt only `useDashboard` and `useNavigationPending` from `@xleddyl/443-components-vue/nuxt/composables`.
|
|
11
11
|
- Mount `<KOverlayHost />` once (the ready Nuxt layouts do it). It is needed for `toast`, `useConfirm`, `useAlert`, `usePrompt`, `useModal`, `useDrawer` and `useLoading`.
|
|
12
12
|
- Wrap the app in `<KRoot>` (it holds the theme, preset and scoping). The ready layouts do it.
|
|
13
13
|
- Icons are passed as names (`icon="plus"`). The type is `IconName`.
|
|
@@ -108,6 +108,7 @@ Playground paths in this file are relative to `playground/nuxt/app/pages/compone
|
|
|
108
108
|
| Collapsible sections, FAQ | `Accordion` |
|
|
109
109
|
| Container with title and actions | `Card` |
|
|
110
110
|
| Page title, description, breadcrumbs, actions | `PageHeader` (or a page template) |
|
|
111
|
+
| Breadcrumb trail as the page title (a record, a nested page) | `trail` on `PageHeader` |
|
|
111
112
|
| Breadcrumbs only | `Breadcrumbs` |
|
|
112
113
|
| Dashboard layout with sidebar, search, account and settings | `DashboardLayout` (or the Nuxt layout `k-dashboard`) |
|
|
113
114
|
| Actions in a settings section header ("Add user") | `#actions-<id>` on `SettingsModal`, `#settings-actions-<id>` on `DashboardLayout` (gets `page`, `openPage`, `back`) |
|
|
@@ -207,7 +208,7 @@ Mount `OverlayHost` once for the imperative hooks (see [Composables](#composable
|
|
|
207
208
|
| `Popover` | Floating panel with any content (a form, filters) opened by its trigger, or next to any element or point with `anchor`. Use `DropdownMenu` for a list of actions. | Model: `v-model:open`. Props: `placement`, `offset`, `arrow`, `label`, `initialFocus`, `anchor` (an element, also inside a same origin iframe, or a virtual `{ getBoundingClientRect() }`; positions against it instead of the trigger, the trigger slot becomes optional). Slots: default (the trigger), `content`. Exposed: `show`, `hide`, `toggle`. | `overlays/popover.vue` |
|
|
208
209
|
| `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` |
|
|
209
210
|
| `Tooltip` | Short text on hover or focus. Optional shortcut. `Button` already shows one for icon-only buttons, `tooltip` and `disabledReason`. | Props: `text`, `placement`, `openDelay`, `closeDelay`, `arrow`, `shortcut`, `disabled`. Slots: default (trigger), `content`. | `overlays/tooltip.vue` |
|
|
210
|
-
| `CommandPalette` | Search and command dialog (Cmd+K) with groups, recent items, async search and typed item data. Groups take `icon` (default item icon) and `more` (a last "show all" item). Matching (`matchesSearch`, exported) finds every word in any order, without case or accents. | Models: `v-model:open`, `v-model:query`. Props: `groups` (items with `id`, `label`, `description`, `icon`, `badge`, `shortcut`, `keywords`, `to`, `data`, `onSelect`), `search(query, signal)`, `pinned` (items or `(query) => items` shown first, never filtered or saved as recent), `shortcut`, `trigger`, `recentKey`, `emptyText`, `notice`. Slots: `item`, `empty`, `group-label`, `after-results`. Events: `select`, `open`, `close`.
|
|
211
|
+
| `CommandPalette` | Search and command dialog (Cmd+K) with groups, recent items, async search and typed item data. Groups take `icon` (default item icon) and `more` (a last "show all" item). Matching (`matchesSearch`, exported) finds every word in any order, without case or accents. | Models: `v-model:open`, `v-model:query`. Props: `groups` (items with `id`, `label`, `description`, `icon`, `badge`, `shortcut`, `keywords`, `to`, `data`, `disabled`, `disabledReason` (with `disabled`: reachable with the arrow keys but not selectable, a tooltip on hover and keyboard focus, linked with `aria-describedby`), `onSelect`), `search(query, signal)`, `pinned` (items or `(query) => items` shown first, never filtered or saved as recent), `shortcut`, `trigger`, `recentKey`, `emptyText`, `notice`. Slots: `item`, `empty`, `group-label`, `after-results`. Events: `select`, `open`, `close`. | `overlays/command-palette.vue` |
|
|
211
212
|
| `CommandList` | The search field and grouped list of `CommandPalette` without the dialog: place it inline in a panel or in a `Popover` (with `anchor` for a picker opened next to any element). Arrow keys, Enter and the same matching. | Model: `v-model:query`. Props: the `CommandPalette` list props (`groups`, `search`, `pinned`, `filter`, `loading`, `placeholder`, `label`, `recentKey`, `emptyText`, `notice` and the copy props), `autofocus` (default `true`), `footer` (the key hints, default `false`). Slots: `item`, `empty`, `group-label`, `after-results`. Events: `select`, `close` (Escape). Exposed: `focus`, `refresh`. | `overlays/command-palette.vue` |
|
|
212
213
|
| `CommandButton` | A `Button` made from a `CommandItem`: label, icon, `to`, `href`, `disabled`, `disabledReason` (tooltip on the disabled button) and `onSelect` come from the command. | Props: `command`, `label`, `icon`, `iconOnly` (a square button with the icon only, the label as `aria-label` and tooltip), and every `Button` prop (size, variant, tone). | `overlays/command-palette.vue` |
|
|
213
214
|
|
|
@@ -229,15 +230,15 @@ Mount `OverlayHost` once for the imperative hooks (see [Composables](#composable
|
|
|
229
230
|
| `RecordList` | Short list of records (settings, users, tokens): title, badge, description, leading and action slots, `SkeletonList` while `loading`, empty state. | Props: `items` (`RecordListItem`: `id`, `title` (truncated, full text on hover), `description`, `badge` `{ label, tone }`), `loading`, `avatar`, `action`, `label`, `skeletonRows`, `emptyText`, `emptyDescription`, `emptyIcon`, `emptyVariant` (card, the default, or plain). Event: `row-click` (`item`, `event`): each row becomes a navigation item (padding, hover and press background like a ghost button, no separators) and its title a button, so Tab reaches every row and Enter or Space opens it (focus ring on the row, the description is the button description). Clicks on buttons, links, inputs, menu items and inside an open menu, popover or dialog of the row are ignored, and pressing them does not tint the row; `rowClickable(item)` keeps some rows static in the same list (no button, no hover). Slots: `leading`, `action` (`{ item }`), `empty`, `empty-actions` (buttons in the default empty state). | `data/record-list.vue` |
|
|
230
231
|
| `DescriptionList` | Label and value pairs for a record. Use it on detail views. | Props: `items` (`key`, `label`, `value`, `hint`), `layout` (stacked, inline, grid), `columns`, `divided`, `emptyText`. Slots: `term`, `value`, `value-<key>`. | `data/description-list.vue` |
|
|
231
232
|
| `Timeline` | Vertical list of events or activity. | Props: `items` (`title`, `description`, `time`, `datetime`, `icon`, `tone`), `compact`. Slot: `item`. | `data/timeline.vue` |
|
|
232
|
-
| `Tree` | Expandable hierarchy with selection, drag to reorder and nesting. | Models: `v-model:expanded`, `v-model:selected`. Props: `nodes` (`id`, `label`, `description`, `meta`, `icon`, `children`, `disabled`, `invalid`), `selectable`, `highlighted` (id or ids tinted like hover), `invalidText`, `reorderable`, `nestable`, `moveButtons` (default `true`; `false` hides the row arrows, drag and Alt+arrow keys still work), `canDrop`, `size`, `checkmark`, `emptyText`, `emptyDescription`, `emptyIcon`, `emptyVariant` (card, the default, or plain). Slots: `label`, `meta`, `actions` (row end, on hover, focus and the selected row; `node`, `level`, `selected`, `expanded`, `highlighted`, `hovered`), `empty`, `empty-actions` (buttons in the default empty state). Events: `select`, `move`, `hover` (node or `null`).
|
|
233
|
+
| `Tree` | Expandable hierarchy with selection, drag to reorder and nesting. | Models: `v-model:expanded`, `v-model:selected`. Props: `nodes` (`id`, `label`, `description`, `meta`, `icon`, `children`, `disabled`, `invalid`), `selectable`, `highlighted` (id or ids tinted like hover), `invalidText`, `reorderable`, `nestable`, `moveButtons` (default `true`; `false` hides the row arrows, drag and Alt+arrow keys still work), `canDrop`, `size`, `checkmark`, `emptyText`, `emptyDescription`, `emptyIcon`, `emptyVariant` (card, the default, or plain). Slots: `label` (`node`, `level`, `invalid`; an invalid row tints a custom label), `meta`, `actions` (row end, on hover, focus and the selected row, and while a popup opened from them is open; always visible without hover; `node`, `level`, `selected`, `expanded`, `highlighted`, `hovered`), `empty`, `empty-actions` (buttons in the default empty state). Events: `select`, `move`, `hover` (node or `null`). | `data/tree.vue` |
|
|
233
234
|
|
|
234
235
|
## Layout
|
|
235
236
|
|
|
236
237
|
| Component | Purpose and when to use it | Main props, models, slots, events | Playground |
|
|
237
238
|
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------- |
|
|
238
239
|
| `Card` | Container with optional title, description, icon, actions and footer. Can be a link or a selectable button. | Props: `title`, `description`, `icon`, `variant` (raised, outline, subtle), `padding`, `as`, `to`, `href`, `selected`, `disabled`, `animated`. Slots: default, `header`, `title`, `description`, `icon`, `actions`, `footer`. | `layout/card.vue` |
|
|
239
|
-
| `PageHeader` | Page title with description, breadcrumbs, badge and actions. The page templates include it. | Props: `title`, `description`, `icon`, `breadcrumbs`, `level`, `bordered`, `align`, `truncate`. Slots: `actions`, `badge`, `description`, `title`, `icon`, `breadcrumbs`.
|
|
240
|
-
| `Breadcrumbs` | Path navigation. | Props: `items` (`label`, `to`, `href`, `icon`), `separator`, `linkLast`, `ancestors`, `size` (`md`, `lg` for a title sized trail). Slot: `item`.
|
|
240
|
+
| `PageHeader` | Page title with description, breadcrumbs, badge and actions. The page templates include it. | Props: `title`, `description`, `icon`, `breadcrumbs` (small trail above the title), `trail` (the earlier levels as links: the title becomes a breadcrumb trail whose last item is the heading), `trailLabel`, `level`, `bordered`, `align`, `truncate`. Slots: `actions`, `badge`, `description`, `title`, `icon`, `breadcrumbs`. | `layout/page-header.vue` |
|
|
241
|
+
| `Breadcrumbs` | Path navigation. | Props: `items` (`label`, `to`, `href`, `icon`), `separator`, `linkLast`, `ancestors`, `size` (`md`, `lg` for a title sized trail), `heading` (the current item is a heading of that level). Slot: `item`. | `layout/breadcrumbs.vue` |
|
|
241
242
|
| `Stepper` | Step indicator for wizards and multi step flows (import, checkout). Horizontal or vertical, compact on narrow widths. | Model: `v-model` (current step value). Props: `steps` (`value`, `label`, `description`, `icon`, `disabled`, `state`: `complete` or `error`), `label`, `orientation`, `size`, `linear` (only completed and current steps clickable), `readonly`, `compact` (`'auto'` by default, `true`, `false`), `summary` (false hides the compact "Step 2 of 4" line), `positionLabel`, `completeLabel`, `errorLabel`. Event: `select`. | `layout/stepper.vue` |
|
|
242
243
|
| `Tabs` | Tabs with panels, badges and dots. Segmented or underline. | Model: `v-model` (active value). Props: `items` (`value`, `label`, `icon`, `color` (a palette name or hex, a dot before the label), `badge`, `badgeTone`, `dot`, `title` (a tooltip on hover and focus, also on a disabled tab; native `title` until mount), `disabled`), `variant`, `size`, `lazy`, `fill`, `stretch`, `inset`, `controls` (id of a panel outside the component: only the tab list renders). Slots: `panel-<value>`, `panel`. | `layout/tabs.vue` |
|
|
243
244
|
| `Accordion` | Collapsible sections. | Model: `v-model` (open value or values). Props: `items` (`value`, `title`, `description`, `content`, `icon`), `multiple`, `collapsible`, `variant`. Slots: default, `title`. | `layout/accordion.vue` |
|
|
@@ -277,7 +278,7 @@ Templates combine core parts into whole pages and layouts. Start from them for n
|
|
|
277
278
|
| `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` |
|
|
278
279
|
| `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` |
|
|
279
280
|
| `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` |
|
|
280
|
-
| `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`.
|
|
281
|
+
| `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`, `filtered` (filters of your own in `#toolbar` are active: no rows show no results with the toolbar and a clear button that emits `clear`, not the first run empty state), `emptyTitle`. Slots: `actions`, `toolbar`, `toolbar-end`, `bulk`, `empty`, `empty-actions`, `no-results`, `error`, `cell-<key>`, `table`. Events: `retry`, `clear`, `rowClick`. | `templates/list-page.vue` |
|
|
281
282
|
| `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` |
|
|
282
283
|
| `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` |
|
|
283
284
|
| `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` |
|
|
@@ -295,7 +296,7 @@ Templates combine core parts into whole pages and layouts. Start from them for n
|
|
|
295
296
|
| `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` |
|
|
296
297
|
| `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` |
|
|
297
298
|
|
|
298
|
-
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`. `useNavigationPending()` is `true` from the
|
|
299
|
+
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`. `useNavigationPending()` is `true` from the moment the guards accept a navigation to another path (after the discard question of a leave guard) until the new page has rendered; the module waits two frames at the start so the skeleton paints first, and `k-dashboard` binds it to `loading`. See README, section "Nuxt: ready layouts".
|
|
299
300
|
|
|
300
301
|
## Grid (group `grid`)
|
|
301
302
|
|
|
@@ -340,7 +341,7 @@ A color value (`ColorValue`) is a palette name or a custom hex color `#rrggbb` (
|
|
|
340
341
|
|
|
341
342
|
## Composables
|
|
342
343
|
|
|
343
|
-
All are exported from `@xleddyl/443-components-vue` and auto-imported in Nuxt.
|
|
344
|
+
All are exported from `@xleddyl/443-components-vue` (the Nuxt only ones from `@xleddyl/443-components-vue/nuxt/composables`) and auto-imported in Nuxt.
|
|
344
345
|
|
|
345
346
|
| Composable | Purpose and when to use it | Signature and notes | Playground |
|
|
346
347
|
| ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ |
|
|
@@ -373,8 +374,8 @@ All are exported from `@xleddyl/443-components-vue` and auto-imported in Nuxt.
|
|
|
373
374
|
| `useLocale` | Translate component texts and read the active locale (en, it, de). | `const { locale, t } = useLocale()`. `provideLocale` and `createLocale` set it. Nuxt follows `k.locale`. | `languages.vue` (pages root) |
|
|
374
375
|
| `useIcons` helpers, `createIcons`, `provideIcons` | Register your own icons by name. | Nuxt: option `k.icons: { dir: '~/assets/icons' }`. | `components/core/icon.vue` |
|
|
375
376
|
| `useLinkComponent`, `createLinkComponent` | Use the router link (for example `NuxtLink`) for every `to` prop. | The Nuxt module does it for you. | - |
|
|
376
|
-
| `useDashboard` (Nuxt only) | Runtime account, breadcrumbs and badges for the `k-dashboard` layout. | Auto-imported by the module.
|
|
377
|
-
| `useNavigationPending` (Nuxt only) | `true` while a navigation to another path renders the new page. Bind it to `loading` of `DashboardLayout` or `AppShell`. | Auto-imported by the module.
|
|
377
|
+
| `useDashboard` (Nuxt only) | Runtime account, breadcrumbs and badges for the `k-dashboard` layout. | Auto-imported by the module, or `import { useDashboard } from '@xleddyl/443-components-vue/nuxt/composables'` (a Nuxt module or layer). | `layouts/` of the playground |
|
|
378
|
+
| `useNavigationPending` (Nuxt only) | `true` while a navigation to another path renders the new page. Bind it to `loading` of `DashboardLayout` or `AppShell`. | Auto-imported by the module, or `import { useNavigationPending } from '@xleddyl/443-components-vue/nuxt/composables'` (a Nuxt module or layer). | `layouts/` of the playground |
|
|
378
379
|
|
|
379
380
|
## Before you build your own
|
|
380
381
|
|
package/README.md
CHANGED
|
@@ -42,6 +42,13 @@ export default defineNuxtConfig({
|
|
|
42
42
|
|
|
43
43
|
Every component is registered with the prefix (`Button.vue` becomes `<KButton>`) and every `use*` composable plus `toast` and `withLoading` is auto-imported.
|
|
44
44
|
|
|
45
|
+
A Nuxt module or layer that uses the library cannot rely on the auto-imports of the host (the host may set `composables: false`). Import explicitly: every composable from `@xleddyl/443-components-vue` (`useRouteState`, `useRouteRecord`, `useLeaveGuard`, `useDirtyGuard`, `useConfirm` and the others), and the two that need Nuxt, `useDashboard` and `useNavigationPending`, from `@xleddyl/443-components-vue/nuxt/composables`:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { useLeaveGuard, useRouteState } from '@xleddyl/443-components-vue'
|
|
49
|
+
import { useNavigationPending } from '@xleddyl/443-components-vue/nuxt/composables'
|
|
50
|
+
```
|
|
51
|
+
|
|
45
52
|
| Option | Default | Effect |
|
|
46
53
|
| ------------------------- | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
47
54
|
| `prefix` | `'K'` | Component name prefix. |
|
|
@@ -287,7 +294,7 @@ The Nuxt module still writes the theme (`k-theme`), the preset (`k-preset`) and
|
|
|
287
294
|
- Everything sits in `@layer k.tokens, k.base, k.components, k.utilities`. Any unlayered host CSS wins, so overrides need no `!important`. The flip side: unlayered host element selectors (`button { ... }`) also reach library elements. Put global element styles in a layer or scope them.
|
|
288
295
|
- Tailwind 4 puts its preflight in the `base` layer. The Nuxt module declares `@layer theme, base, k, components, utilities` before any stylesheet (option `cssLayers`), so preflight never resets library components while Tailwind utilities still win on them. Without Nuxt, put the same statement at the top of your first stylesheet. A host reset of your own belongs in `base` (or any layer declared before `k`).
|
|
289
296
|
- The one exception is the dashboard frame: while an `AppShell` (`.k-shell`) is on the page, or with `k.global`, `html` and `body` get `overscroll-behavior: none` and `overflow-x: clip`, so the page never rubber bands or scrolls sideways. Only the content panel and the sidebar list scroll, with `overscroll-behavior: contain`.
|
|
290
|
-
- Overlays stay inside the root in the DOM (native top layer through `<dialog>` and `popover`), so they inherit tokens.
|
|
297
|
+
- Overlays stay inside the root in the DOM (native top layer through `<dialog>` and `popover`), so they inherit tokens. They also inherit from their trigger's parents: floating panels reset `pointer-events`, so a menu opened from a container with `pointer-events: none` (a hover reveal) stays clickable, but an `inert` or `visibility: hidden` ancestor still disables or hides it while it is open.
|
|
291
298
|
|
|
292
299
|
## Icons
|
|
293
300
|
|
|
@@ -474,7 +481,7 @@ async function switchView() {
|
|
|
474
481
|
| editor | RichTextEditor, TemplateEditor, TemplateText |
|
|
475
482
|
| chart | ChartPanel, ChartLegend, LineChart, BarChart, DoughnutChart |
|
|
476
483
|
|
|
477
|
-
Composables: `useTheme`, `usePreset`, `useForm`, `useField`, `useFieldControl`, `useToast` (and `toast`), `useConfirm`, `useAlert`, `usePrompt`, `useModal`, `useDrawer`, `useOverlay`, `useModalContext`, `useLoading` (and `withLoading`), `useLoadingState`, `useHotkey`, `useCopy`, `useFileDrop` (with `readDroppedFiles`), `useSortable`, `usePasswordStrength`, `useTableSort`, `useAppShell`, `useRouteState`, `useRouteRecord`, `usePageCommands`, `usePreference` (with `usePreferences`, `createPreferences`, `providePreferences`), `useScrollLock`, `useLeaveGuard` (with `useLeaveScope`, `provideLeaveScope`), `useDirtyGuard`, `useIcons` helpers and `useLinkComponent`, `provideFieldBoundary`, `provideAuxiliaryControls`, `provideForm`, `provideGridConfig` (with `createGridConfig`, `useGridConfig`), `useLocale`. With the Nuxt module also `useDashboard()` (runtime account, breadcrumbs and badges for the `k-dashboard` layout) and `useNavigationPending()` (`true` while a navigation to another path renders the new page)
|
|
484
|
+
Composables: `useTheme`, `usePreset`, `useForm`, `useField`, `useFieldControl`, `useToast` (and `toast`), `useConfirm`, `useAlert`, `usePrompt`, `useModal`, `useDrawer`, `useOverlay`, `useModalContext`, `useLoading` (and `withLoading`), `useLoadingState`, `useHotkey`, `useCopy`, `useFileDrop` (with `readDroppedFiles`), `useSortable`, `usePasswordStrength`, `useTableSort`, `useAppShell`, `useRouteState`, `useRouteRecord`, `usePageCommands`, `usePreference` (with `usePreferences`, `createPreferences`, `providePreferences`), `useScrollLock`, `useLeaveGuard` (with `useLeaveScope`, `provideLeaveScope`), `useDirtyGuard`, `useIcons` helpers and `useLinkComponent`, `provideFieldBoundary`, `provideAuxiliaryControls`, `provideForm`, `provideGridConfig` (with `createGridConfig`, `useGridConfig`), `useLocale`. With the Nuxt module also `useDashboard()` (runtime account, breadcrumbs and badges for the `k-dashboard` layout) and `useNavigationPending()` (`true` while a navigation to another path renders the new page), auto-imported or imported from `@xleddyl/443-components-vue/nuxt/composables`.
|
|
478
485
|
|
|
479
486
|
### Buttons and tooltips
|
|
480
487
|
|
|
@@ -482,6 +489,7 @@ Composables: `useTheme`, `usePreset`, `useForm`, `useField`, `useFieldControl`,
|
|
|
482
489
|
- `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
490
|
- `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
491
|
- 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`.
|
|
492
|
+
- Items of `CommandPalette` and `CommandList` take `disabledReason` the same way: a disabled item with a reason stays reachable with the arrow keys (one without a reason is skipped), Enter ignores it, and the reason shows as a tooltip on hover and when the arrow keys make it active, linked with `aria-describedby`.
|
|
485
493
|
- 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).
|
|
486
494
|
|
|
487
495
|
```vue
|
|
@@ -502,7 +510,7 @@ On your own elements, `paletteClass(color)` gives the class of a palette name an
|
|
|
502
510
|
|
|
503
511
|
### Lists, trees and uploads
|
|
504
512
|
|
|
505
|
-
- `Tree` takes `size="sm"` for dense rows, `checkmark`, `descriptionVariant` (`mono`, the default for paths and slugs, or `text`; a node can override it with its own `descriptionVariant`), `emptyText`, `emptyDescription`, `emptyIcon` and `emptyVariant` (`card`, the default, or `plain`) for the `EmptyState` shown without nodes (`#empty` replaces it, `#empty-actions` adds buttons inside it, like `RecordList`) and works inside a `FormField` (labelled and described by the field). With `reorderable` rows get a drag handle and Alt with the up and down arrows moves them; `nestable` also lets rows change level (drop in the middle of a row, Alt with left and right). Each row also shows move buttons; `moveButtons: false` hides them and keeps drag and the keyboard. The `move` event carries `{ node, target, position, from: { parent, index }, to: { parent, index } }`, `to.index` being the final index, and `applyTreeMove(nodes, move)` returns the updated tree. `canDrop(move)` vetoes a move. Moves are announced to screen readers. The `#actions` slot (`node`, `level`, `selected`, `expanded`, `highlighted`, `hovered`) renders row actions at the end of the row, over the label, on the hovered, focused and selected rows only; Tab from the focused row reaches them, and focus returns to a row when the focused one is removed. `highlighted` (an id or an array of ids) tints rows like hover, for a link with something outside the tree (a block hovered in a preview). The `hover` event carries the node under the pointer, then `null` when the pointer leaves the tree. A node with `invalid: true` shows a danger dot and a tinted label, and its row is described by a hidden "Contains errors" (`invalidText` overrides it).
|
|
513
|
+
- `Tree` takes `size="sm"` for dense rows, `checkmark`, `descriptionVariant` (`mono`, the default for paths and slugs, or `text`; a node can override it with its own `descriptionVariant`), `emptyText`, `emptyDescription`, `emptyIcon` and `emptyVariant` (`card`, the default, or `plain`) for the `EmptyState` shown without nodes (`#empty` replaces it, `#empty-actions` adds buttons inside it, like `RecordList`) and works inside a `FormField` (labelled and described by the field). With `reorderable` rows get a drag handle and Alt with the up and down arrows moves them; `nestable` also lets rows change level (drop in the middle of a row, Alt with left and right). Each row also shows move buttons; `moveButtons: false` hides them and keeps drag and the keyboard. The `move` event carries `{ node, target, position, from: { parent, index }, to: { parent, index } }`, `to.index` being the final index, and `applyTreeMove(nodes, move)` returns the updated tree. `canDrop(move)` vetoes a move. Moves are announced to screen readers. The `#actions` slot (`node`, `level`, `selected`, `expanded`, `highlighted`, `hovered`) renders row actions at the end of the row, over the label, on the hovered, focused and selected rows only; Tab from the focused row reaches them, and focus returns to a row when the focused one is removed. Actions stay visible and clickable while a menu, popover or select opened from them is open (any trigger inside with `aria-expanded="true"`), so the pointer can cross other rows to reach the menu items. On devices without hover (`hover: none`, touch) the slot actions are always visible and sit in the row after the label instead of over it, and the move buttons show on the focused (tapped) and selected rows. `highlighted` (an id or an array of ids) tints rows like hover, for a link with something outside the tree (a block hovered in a preview). The `hover` event carries the node under the pointer, then `null` when the pointer leaves the tree. A node with `invalid: true` shows a danger dot before the label (never covered by the actions) and a tinted label, and its row is described by a hidden "Contains errors" (`invalidText` overrides it). The `#label` slot receives `invalid` (with `node` and `level`), and a custom label inherits the danger text color unless it sets its own.
|
|
506
514
|
- `Select` takes string, number or boolean option values (`{ value: true, label: 'Yes' }`); the model gets the option value back with its type and is typed `T | null | undefined`, so `v-model` works on a narrow ref (`Ref<'a' | 'b' | null>`). An option whose value is `''` is a real option: it is selected and shown with its own label, distinct from the placeholder, which still maps to `null`.
|
|
507
515
|
- `Input` and `Textarea` take `counter`: with a `maxlength` attribute they show `length / maxlength` inside the field, describe the control with "12 of 40 characters" (`form.characterCount`) and announce "Character limit reached" when it is hit.
|
|
508
516
|
- Numbers are left aligned in every field. `Input` `numeric` sets the decimal keyboard, the number model and tabular digits; `NumberInput` takes `align="end"` to right align its value when a layout needs it (default `start`).
|
|
@@ -529,7 +537,7 @@ On your own elements, `paletteClass(color)` gives the class of a palette name an
|
|
|
529
537
|
|
|
530
538
|
- `Tabs` items take `dot: true` for a small indicator without a number (`dotTone`, default `danger`; `dotLabel` is the hidden text, default "Needs attention"). `color` (a palette name or a hex, `ColorValue`) draws a small color dot before the label, separate from the status dot. `title` shows a tooltip on hover and keyboard focus (the native `title` only until mount) and becomes the tab description; a disabled tab keeps it (it uses `aria-disabled`, cannot be selected and is skipped by Tab and the arrow keys), so it can say why it is disabled. The same items work in the `tabs` of `Modal`, `Drawer`, `FormDrawer` and `DetailPage`.
|
|
531
539
|
- `DropdownMenu` takes `matchTriggerWidth` (the menu is at least as wide as its trigger) and `minWidth` (a CSS length).
|
|
532
|
-
- `PageHeader` takes `align` (`'end'` by default, `'start'` or `'center'`) for the title block and the actions, and `truncate` to keep the title on one line with an ellipsis (the full title is in its `title` attribute).
|
|
540
|
+
- `PageHeader` takes `align` (`'end'` by default, `'start'` or `'center'`) for the title block and the actions, and `truncate` to keep the title on one line with an ellipsis (the full title is in its `title` attribute). `trail` (`BreadcrumbItem[]`, the earlier levels as links) turns the title into a breadcrumb trail that ends with `title`, at the page title size: a `nav` (named by `trailLabel`, default "Breadcrumb") around an ordered list whose last item is the heading (`h<level>`, `aria-current="page"`, only the title, `#title` fills it). With `truncate` the trail stays on one line and the title gets the ellipsis. Use it for a record or a nested page instead of `Breadcrumbs` in `#title` (a `nav` inside a heading). `breadcrumbs` stays the small trail above the title.
|
|
533
541
|
- `RichTextEditor` accepts `'underline'` in `toolbar` (not in the default toolbar).
|
|
534
542
|
- `RichTextEditor` takes `linkTypes` (`EditorLinkType[]`, `'url' | 'email' | 'phone'`, default `['url']`). With more than one type the link form shows a type select; email links get `mailto:` and phone links `tel:` (spaces and separators removed). When no text is selected the form asks for the link text too (`editor.linkText`) and inserts it as a link, falling back to the address.
|
|
535
543
|
- `BarChart` takes `colorByPoint` (every bar of a series takes the next palette color, or one from `colors: string[]`; the legend lists and toggles the categories). The palette comes from `--k-chart-1` to `--k-chart-8`.
|
|
@@ -555,7 +563,7 @@ On your own elements, `paletteClass(color)` gives the class of a palette name an
|
|
|
555
563
|
- `useSortable(container, options)` is the reorder logic of `TagList` for any list. Options: `items` (a ref or getter), `onMove(items, move)` (`SortableMove`: `{ item, from, to, items, source }`, write `items` back to your state), `orientation` (`'vertical'` by default, `'horizontal'` for wrapping rows), `disabled`, `handle` (a selector: only a pointer down on it starts a drag; without it any pointer down outside buttons, links and inputs does), `canMove(item, index)`, `label(item)` and `movedText(move)` for the announcement. Bind `itemProps(index)` on each item element (the attribute marks it, plus pointer and Alt with arrow key handlers) and render `announcement` in a polite live region. `move(from, to, { announce })` moves from your own buttons, `dragging` is the index being dragged (for a lifted style), `canMove(index)` reports locked items. Pointer drags reorder live and follow the pointer, Escape or a cancelled pointer puts the item back, and the click after a drag is swallowed.
|
|
556
564
|
|
|
557
565
|
- `useFileDrop` returns `{ over, reset }` and takes `ignore(event)`. A drop handled by a nested drop zone is skipped by the outer ones, and the state resets after any drop, even when a child stops propagation. `readDroppedFiles(dataTransfer)` walks dropped folders (call it synchronously in the drop handler) and resolves to `[{ file, path }]`; `readDroppedFiles(dataTransfer, { directories: true })` resolves to `{ files, directories }` with every folder path, empty ones included, and `skipHidden: true` leaves out dot entries.
|
|
558
|
-
- `Tabs` items take `badgeTone` and `badgeLabel` (the accessible name of the badge); the `#panel="{ item }"` slot renders a single panel for the active tab. `stretch` makes the tabs fill the remaining height of a flex column and the active panel grow with it (`flex: 1; min-height: 0`), and `inset` spaces the tab list from the container edges with the panel flush below it, for inspectors and side panes. `Breadcrumbs` items take `attrs` and `onClick` (an item without a link renders a button, handy for drop targets), `#item` customizes the content, and `ancestors` links every item and ends with a separator (`breadcrumbsAncestors` on `PageHeader`). `Accordion` takes `variant` `card` (default), `outline` (the same card without a shadow), `separated` or `plain`; items take `description`, and `contentVariant="neutral"` drops the content padding and text styling.
|
|
566
|
+
- `Tabs` items take `badgeTone` and `badgeLabel` (the accessible name of the badge); the `#panel="{ item }"` slot renders a single panel for the active tab. `stretch` makes the tabs fill the remaining height of a flex column and the active panel grow with it (`flex: 1; min-height: 0`), and `inset` spaces the tab list from the container edges with the panel flush below it, for inspectors and side panes. `Breadcrumbs` items take `attrs` and `onClick` (an item without a link renders a button, handy for drop targets), `#item` customizes the content, and `ancestors` links every item and ends with a separator (`breadcrumbsAncestors` on `PageHeader`). `heading` (a heading level) renders the current item as that heading, for a trail that is the title of the page. `Accordion` takes `variant` `card` (default), `outline` (the same card without a shadow), `separated` or `plain`; items take `description`, and `contentVariant="neutral"` drops the content padding and text styling.
|
|
559
567
|
- `RichTextEditor` labels heading buttons by their real level (`headingLabel="relative"` numbers them from 1) and `toolbar` picks and orders the buttons: `['headings', '|', 'bold', 'italic', 'link']`.
|
|
560
568
|
|
|
561
569
|
### Grid defaults
|
|
@@ -692,7 +700,7 @@ const familyId = useRouteState('family')
|
|
|
692
700
|
```
|
|
693
701
|
|
|
694
702
|
- Reading: the initial value comes from the URL (on the server too, so SSR renders the same state), and the ref follows every later route change (back, forward, links).
|
|
695
|
-
- Writing: setting the ref navigates with `router.push` (default) or `router.replace` (`history: 'replace'`, for filters or tabs that should not add history entries). The path and the other query parameters stay. `undefined`, `null` and `''` remove the parameter. Several refs changed in the same tick make one navigation. A push that returns to the previous history entry goes back instead (`router.back()`), so opening then closing a drawer leaves the history as it was, and the browser back button and the in-app close button agree.
|
|
703
|
+
- Writing: setting the ref navigates with `router.push` (default) or `router.replace` (`history: 'replace'`, for filters or tabs that should not add history entries). The path and the other query parameters stay. `undefined`, `null` and `''` remove the parameter. Several refs changed in the same tick make one navigation. A push that returns to the previous history entry goes back instead (`router.back()`), so opening then closing a drawer leaves the history as it was, and the browser back button and the in-app close button agree. An entry the router did not create (a hash edited by hand in the address bar, a plain `#` link) has no reliable previous entry, so writes from it always push.
|
|
696
704
|
- Types: `parse(value)` and `serialize(value)` convert the string (`parse` returning `undefined` means no value). `default` gives the value when the parameter is missing, and setting the default removes the parameter:
|
|
697
705
|
|
|
698
706
|
```ts
|
|
@@ -855,7 +863,7 @@ Both take the `AuthLayout` frame props and the `brand`, `corner`, `footer` and `
|
|
|
855
863
|
| Component | What it gives you |
|
|
856
864
|
| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
857
865
|
| `DashboardPage` | PageHeader (`title`, `eyebrow`, `description`, `#actions`), a Stat grid from `stats` (or `#stats`), a content grid (`columns`, default 1 then 3 columns). |
|
|
858
|
-
| `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.
|
|
866
|
+
| `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. Filters of your own in `#toolbar` (a Select, a date range) set `filtered` while they are active: no rows then show the no results state with the toolbar still visible instead of the first run `#empty`, and the clear button (or `clear` of `#no-results`) emits `clear`, where you reset them. `cell-*` and `header-*` slots go to the Table. |
|
|
859
867
|
| `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. |
|
|
860
868
|
| `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). |
|
|
861
869
|
| `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. |
|
|
@@ -948,7 +956,7 @@ The account row opens the SettingsModal (`account.action: 'menu'` with `account.
|
|
|
948
956
|
|
|
949
957
|
Pages pick them with `definePageMeta({ layout: 'k-dashboard', title: 'Items' })` or `layout: 'k-auth'` (the auth frame shows `title` and `description` from the page meta). Both layouts set the document title from `meta.title` and the brand name (`Items · Acme`; a page's own `useHead({ title })` wins) and announce route changes through a polite live region, unless the app already renders `<NuxtRouteAnnouncer />`. Breadcrumbs come from `meta.breadcrumbs`, otherwise from the matching navigation item (plus `meta.title` on deeper pages). At runtime `useDashboard().value = { account, breadcrumbs, badges: { '/items': 12 } }` overrides the account, the breadcrumbs and the badges. Set it in route middleware (`definePageMeta({ middleware })`) or a plugin, not in the page `setup`: the layout renders the sidebar and breadcrumbs before the page, so a value set during the page render would differ between the server HTML and hydration.
|
|
950
958
|
|
|
951
|
-
When a link goes to another path, the old page stays on screen until the new page has rendered (Vue renders it in one synchronous pass, or waits for its async setup). The module plugin `k:navigation` sets `useNavigationPending()`
|
|
959
|
+
When a link goes to another path, the old page stays on screen until the new page has rendered (Vue renders it in one synchronous pass, or waits for its async setup). The module plugin `k:navigation` sets `useNavigationPending()` once the navigation guards have let the navigation go on (in `beforeResolve`, so the discard question of a leave guard shows over the current page, and a cancelled navigation never shows the skeleton) and waits two animation frames, so `k-dashboard` hides the old page and paints a page skeleton (the `loading` prop of `DashboardLayout`) before the new page renders. It ends when the new page has rendered, or at `page:finish` for a page that suspends. Hash and query changes on the same path keep the page. In your own layout, bind it yourself: `<KDashboardLayout :loading="useNavigationPending().value">`, and replace the skeleton with the `loading` slot.
|
|
952
960
|
|
|
953
961
|
### Starter
|
|
954
962
|
|
|
@@ -15,8 +15,6 @@
|
|
|
15
15
|
:class="rootClass"
|
|
16
16
|
data-k-shake
|
|
17
17
|
@pointerleave="onTreeLeave"
|
|
18
|
-
@focusin="hasFocus = true"
|
|
19
|
-
@focusout="onFocusOut"
|
|
20
18
|
>
|
|
21
19
|
<li
|
|
22
20
|
v-for="(entry, index) in visible"
|
|
@@ -77,8 +75,14 @@
|
|
|
77
75
|
<span v-if="entry.node.icon" class="k-tree-icon" aria-hidden="true">
|
|
78
76
|
<Icon :name="entry.node.icon" />
|
|
79
77
|
</span>
|
|
78
|
+
<span v-if="entry.node.invalid" class="k-tree-invalid" aria-hidden="true" />
|
|
80
79
|
<span :id="textId(entry.node.id)" class="k-tree-text">
|
|
81
|
-
<slot
|
|
80
|
+
<slot
|
|
81
|
+
name="label"
|
|
82
|
+
:node="entry.node"
|
|
83
|
+
:level="entry.level"
|
|
84
|
+
:invalid="Boolean(entry.node.invalid)"
|
|
85
|
+
>
|
|
82
86
|
<span :id="labelId(entry.node.id)" class="k-tree-label">{{ entry.node.label }}</span>
|
|
83
87
|
<span
|
|
84
88
|
v-if="entry.node.description"
|
|
@@ -89,7 +93,6 @@
|
|
|
89
93
|
>
|
|
90
94
|
</slot>
|
|
91
95
|
</span>
|
|
92
|
-
<span v-if="entry.node.invalid" class="k-tree-invalid" aria-hidden="true" />
|
|
93
96
|
<span
|
|
94
97
|
v-if="entry.node.meta || $slots.meta"
|
|
95
98
|
:id="metaId(entry.node.id)"
|
|
@@ -104,11 +107,10 @@
|
|
|
104
107
|
v-if="hasMoveButtons(entry) || $slots.actions"
|
|
105
108
|
class="k-tree-actions"
|
|
106
109
|
:class="{ 'has-slot': $slots.actions }"
|
|
107
|
-
:inert="actionsInert(entry) || void 0"
|
|
108
110
|
@click.stop
|
|
109
111
|
@focusin="focusId = entry.node.id"
|
|
110
112
|
>
|
|
111
|
-
<
|
|
113
|
+
<span v-if="hasMoveButtons(entry)" class="k-tree-moves">
|
|
112
114
|
<Button
|
|
113
115
|
v-for="action in rowActions(entry)"
|
|
114
116
|
:key="action.direction"
|
|
@@ -122,7 +124,7 @@
|
|
|
122
124
|
:disabled="!action.move"
|
|
123
125
|
@click="action.move && commit(action.move)"
|
|
124
126
|
/>
|
|
125
|
-
</
|
|
127
|
+
</span>
|
|
126
128
|
<slot
|
|
127
129
|
name="actions"
|
|
128
130
|
:node="entry.node"
|
|
@@ -223,7 +225,6 @@ const dragId = ref(null);
|
|
|
223
225
|
const dropState = ref(null);
|
|
224
226
|
const live = useLiveMessage();
|
|
225
227
|
const hoverId = ref(null);
|
|
226
|
-
const hasFocus = ref(false);
|
|
227
228
|
const ariaLabel = computed(() => {
|
|
228
229
|
if (props.label) return props.label;
|
|
229
230
|
return control.labelledBy.value ? void 0 : t("tree.label");
|
|
@@ -320,10 +321,6 @@ const hasInvalid = computed(() => visible.value.some((entry) => entry.node.inval
|
|
|
320
321
|
function hasMoveButtons(entry) {
|
|
321
322
|
return canReorder.value && props.moveButtons && !entry.node.disabled;
|
|
322
323
|
}
|
|
323
|
-
function actionsInert(entry) {
|
|
324
|
-
const id = entry.node.id;
|
|
325
|
-
return hoverId.value !== id && !(hasFocus.value && rovingId.value === id);
|
|
326
|
-
}
|
|
327
324
|
function setHover(node) {
|
|
328
325
|
const id = node?.id ?? null;
|
|
329
326
|
if (hoverId.value === id) return;
|
|
@@ -336,11 +333,6 @@ function onRowEnter(entry) {
|
|
|
336
333
|
function onTreeLeave() {
|
|
337
334
|
setHover(null);
|
|
338
335
|
}
|
|
339
|
-
function onFocusOut(event) {
|
|
340
|
-
const next = event.relatedTarget;
|
|
341
|
-
if (next instanceof Node && event.currentTarget.contains(next)) return;
|
|
342
|
-
hasFocus.value = false;
|
|
343
|
-
}
|
|
344
336
|
watch(visible, (list) => {
|
|
345
337
|
if (hoverId.value !== null && !list.some((entry) => entry.node.id === hoverId.value))
|
|
346
338
|
setHover(null);
|
|
@@ -37,7 +37,8 @@ const props = defineProps({
|
|
|
37
37
|
separator: { type: null, required: false, default: "chevron-right" },
|
|
38
38
|
linkLast: { type: Boolean, required: false },
|
|
39
39
|
ancestors: { type: Boolean, required: false },
|
|
40
|
-
size: { type: String, required: false, default: "md" }
|
|
40
|
+
size: { type: String, required: false, default: "md" },
|
|
41
|
+
heading: { type: Number, required: false }
|
|
41
42
|
});
|
|
42
43
|
defineSlots();
|
|
43
44
|
const { t } = useLocale();
|
|
@@ -48,7 +49,10 @@ const parts = computed(
|
|
|
48
49
|
const last = index === props.items.length - 1;
|
|
49
50
|
const current = last && !props.linkLast && !props.ancestors;
|
|
50
51
|
const extra = { ...item.attrs, ...item.onClick ? { onClick: item.onClick } : {} };
|
|
51
|
-
if (current)
|
|
52
|
+
if (current) {
|
|
53
|
+
const is = props.heading ? `h${props.heading}` : "span";
|
|
54
|
+
return { item, is, attrs: { ...extra, "aria-current": "page" }, current };
|
|
55
|
+
}
|
|
52
56
|
const pageAttrs = last && !props.ancestors ? { "aria-current": "page" } : {};
|
|
53
57
|
const link = resolveLink(item);
|
|
54
58
|
if (link)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IconName } from '../../composables/useIcons';
|
|
2
|
-
import type { BreadcrumbItem, BreadcrumbsSize } from './types';
|
|
2
|
+
import type { BreadcrumbItem, BreadcrumbsSize, HeadingLevel } from './types';
|
|
3
3
|
type __VLS_Slots = {
|
|
4
4
|
item?: (props: {
|
|
5
5
|
item: BreadcrumbItem;
|
|
@@ -14,6 +14,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
14
14
|
linkLast?: boolean;
|
|
15
15
|
ancestors?: boolean;
|
|
16
16
|
size?: BreadcrumbsSize;
|
|
17
|
+
heading?: HeadingLevel;
|
|
17
18
|
innerHTML?: string | undefined | undefined;
|
|
18
19
|
class?: import("vue").ClassValue;
|
|
19
20
|
style?: import("vue").StyleValue;
|
|
@@ -213,6 +214,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
213
214
|
linkLast?: boolean;
|
|
214
215
|
ancestors?: boolean;
|
|
215
216
|
size?: BreadcrumbsSize;
|
|
217
|
+
heading?: HeadingLevel;
|
|
216
218
|
innerHTML?: string | undefined | undefined;
|
|
217
219
|
class?: import("vue").ClassValue;
|
|
218
220
|
style?: import("vue").StyleValue;
|
|
@@ -24,8 +24,25 @@
|
|
|
24
24
|
</span>
|
|
25
25
|
<div class="k-page-header-text">
|
|
26
26
|
<div class="k-page-header-title-line">
|
|
27
|
+
<Breadcrumbs
|
|
28
|
+
v-if="trail?.length"
|
|
29
|
+
class="k-page-header-trail"
|
|
30
|
+
:items="trailItems"
|
|
31
|
+
:label="trailLabel"
|
|
32
|
+
:heading="level"
|
|
33
|
+
size="lg"
|
|
34
|
+
>
|
|
35
|
+
<template #item="{ item, current }">
|
|
36
|
+
<slot v-if="current" name="title">{{ item.label }}</slot>
|
|
37
|
+
<template v-else>
|
|
38
|
+
<Icon v-if="item.icon" :name="item.icon" />
|
|
39
|
+
{{ item.label }}
|
|
40
|
+
</template>
|
|
41
|
+
</template>
|
|
42
|
+
</Breadcrumbs>
|
|
27
43
|
<component
|
|
28
44
|
:is="`h${level}`"
|
|
45
|
+
v-else
|
|
29
46
|
class="k-page-header-title"
|
|
30
47
|
:title="truncate ? title : void 0"
|
|
31
48
|
>
|
|
@@ -49,17 +66,27 @@
|
|
|
49
66
|
</template>
|
|
50
67
|
|
|
51
68
|
<script setup>
|
|
69
|
+
import { computed } from "vue";
|
|
52
70
|
import Icon from "../core/Icon.vue";
|
|
53
71
|
import Breadcrumbs from "./Breadcrumbs.vue";
|
|
54
|
-
defineProps({
|
|
72
|
+
const props = defineProps({
|
|
55
73
|
title: { type: String, required: false },
|
|
56
74
|
description: { type: String, required: false },
|
|
57
75
|
icon: { type: null, required: false },
|
|
58
76
|
breadcrumbs: { type: Array, required: false },
|
|
59
77
|
breadcrumbsAncestors: { type: Boolean, required: false },
|
|
78
|
+
trail: { type: Array, required: false },
|
|
79
|
+
trailLabel: { type: String, required: false },
|
|
60
80
|
level: { type: Number, required: false, default: 1 },
|
|
61
81
|
bordered: { type: Boolean, required: false },
|
|
62
82
|
align: { type: String, required: false, default: "end" },
|
|
63
83
|
truncate: { type: Boolean, required: false }
|
|
64
84
|
});
|
|
85
|
+
const trailItems = computed(() => [
|
|
86
|
+
...props.trail ?? [],
|
|
87
|
+
{
|
|
88
|
+
label: props.title ?? "",
|
|
89
|
+
attrs: props.truncate && props.title ? { title: props.title } : void 0
|
|
90
|
+
}
|
|
91
|
+
]);
|
|
65
92
|
</script>
|
|
@@ -4,7 +4,7 @@ declare var __VLS_1: {}, __VLS_10: {
|
|
|
4
4
|
item: BreadcrumbItem;
|
|
5
5
|
index: number;
|
|
6
6
|
current: boolean;
|
|
7
|
-
}, __VLS_12: {},
|
|
7
|
+
}, __VLS_12: {}, __VLS_26: {}, __VLS_39: {}, __VLS_41: {}, __VLS_43: {}, __VLS_45: {}, __VLS_47: {};
|
|
8
8
|
type __VLS_Slots = {} & {
|
|
9
9
|
breadcrumbs?: (props: typeof __VLS_1) => any;
|
|
10
10
|
} & {
|
|
@@ -12,15 +12,17 @@ type __VLS_Slots = {} & {
|
|
|
12
12
|
} & {
|
|
13
13
|
icon?: (props: typeof __VLS_12) => any;
|
|
14
14
|
} & {
|
|
15
|
-
title?: (props: typeof
|
|
15
|
+
title?: (props: typeof __VLS_26) => any;
|
|
16
16
|
} & {
|
|
17
|
-
|
|
17
|
+
title?: (props: typeof __VLS_39) => any;
|
|
18
18
|
} & {
|
|
19
|
-
|
|
19
|
+
badge?: (props: typeof __VLS_41) => any;
|
|
20
20
|
} & {
|
|
21
|
-
|
|
21
|
+
description?: (props: typeof __VLS_43) => any;
|
|
22
22
|
} & {
|
|
23
|
-
|
|
23
|
+
actions?: (props: typeof __VLS_45) => any;
|
|
24
|
+
} & {
|
|
25
|
+
default?: (props: typeof __VLS_47) => any;
|
|
24
26
|
};
|
|
25
27
|
declare const __VLS_base: import("vue").DefineComponent<{
|
|
26
28
|
title?: string | undefined;
|
|
@@ -28,6 +30,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
28
30
|
icon?: IconName;
|
|
29
31
|
breadcrumbs?: BreadcrumbItem[];
|
|
30
32
|
breadcrumbsAncestors?: boolean;
|
|
33
|
+
trail?: BreadcrumbItem[];
|
|
34
|
+
trailLabel?: string;
|
|
31
35
|
level?: HeadingLevel;
|
|
32
36
|
bordered?: boolean;
|
|
33
37
|
align?: "start" | "center" | "end";
|
|
@@ -229,6 +233,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
229
233
|
icon?: IconName;
|
|
230
234
|
breadcrumbs?: BreadcrumbItem[];
|
|
231
235
|
breadcrumbsAncestors?: boolean;
|
|
236
|
+
trail?: BreadcrumbItem[];
|
|
237
|
+
trailLabel?: string;
|
|
232
238
|
level?: HeadingLevel;
|
|
233
239
|
bordered?: boolean;
|
|
234
240
|
align?: "start" | "center" | "end";
|
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
:class="{ 'is-active': entry.index === active }"
|
|
68
68
|
:aria-selected="entry.index === active ? 'true' : 'false'"
|
|
69
69
|
:aria-disabled="entry.item.disabled ? 'true' : void 0"
|
|
70
|
-
|
|
70
|
+
:aria-describedby="reasonOf(entry.item) ? reasonId(entry.index) : void 0"
|
|
71
|
+
@pointermove="onOptionPointerMove(entry.index)"
|
|
71
72
|
@click="select(entry)"
|
|
72
73
|
>
|
|
73
74
|
<slot name="item" :item="entry.item" :active="entry.index === active">
|
|
@@ -103,6 +104,13 @@
|
|
|
103
104
|
</Kbd>
|
|
104
105
|
</span>
|
|
105
106
|
</slot>
|
|
107
|
+
<HintTooltip
|
|
108
|
+
v-if="reasonOf(entry.item)"
|
|
109
|
+
:id="reasonId(entry.index)"
|
|
110
|
+
:text="reasonOf(entry.item)"
|
|
111
|
+
:active="keyboardActive && entry.index === active"
|
|
112
|
+
placement="right"
|
|
113
|
+
/>
|
|
106
114
|
</div>
|
|
107
115
|
</div>
|
|
108
116
|
</div>
|
|
@@ -134,6 +142,7 @@ import { readStorageJson, writeStorageJson } from "../../internal/core/storage";
|
|
|
134
142
|
import { useRouterLike } from "../../internal/layout/route";
|
|
135
143
|
import { DivElement } from "../../internal/core/DivElement";
|
|
136
144
|
import LiveRegion from "../../internal/core/LiveRegion.vue";
|
|
145
|
+
import HintTooltip from "../../internal/overlays/HintTooltip.vue";
|
|
137
146
|
import Icon from "../core/Icon.vue";
|
|
138
147
|
import Badge from "../data/Badge.vue";
|
|
139
148
|
import Kbd from "../core/Kbd.vue";
|
|
@@ -193,6 +202,7 @@ const bodyRef = useTemplateRef("bodyRef");
|
|
|
193
202
|
const inputRef = useTemplateRef("inputRef");
|
|
194
203
|
const router = useRouterLike();
|
|
195
204
|
const active = ref(0);
|
|
205
|
+
const keyboardActive = ref(false);
|
|
196
206
|
const remote = shallowRef(null);
|
|
197
207
|
const recent = shallowRef([]);
|
|
198
208
|
const term = computed(() => query.value.trim());
|
|
@@ -292,6 +302,12 @@ function hasLabel(group) {
|
|
|
292
302
|
function optionId(index) {
|
|
293
303
|
return `${listId}-option-${index}`;
|
|
294
304
|
}
|
|
305
|
+
function reasonId(index) {
|
|
306
|
+
return `${optionId(index)}-reason`;
|
|
307
|
+
}
|
|
308
|
+
function reasonOf(item) {
|
|
309
|
+
return item.disabled && item.disabledReason ? item.disabledReason : void 0;
|
|
310
|
+
}
|
|
295
311
|
const search = useAsyncSearch({
|
|
296
312
|
search: () => props.search,
|
|
297
313
|
onResults: (groups) => remote.value = groups,
|
|
@@ -362,17 +378,27 @@ function select(entry) {
|
|
|
362
378
|
function isDisabled(index) {
|
|
363
379
|
return Boolean(flat.value[index]?.item.disabled);
|
|
364
380
|
}
|
|
381
|
+
function isSkipped(index) {
|
|
382
|
+
const item = flat.value[index]?.item;
|
|
383
|
+
return Boolean(item?.disabled && !reasonOf(item));
|
|
384
|
+
}
|
|
385
|
+
function onOptionPointerMove(index) {
|
|
386
|
+
keyboardActive.value = false;
|
|
387
|
+
active.value = index;
|
|
388
|
+
}
|
|
365
389
|
function onKeydown(event) {
|
|
366
390
|
const count = flat.value.length;
|
|
367
391
|
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
368
392
|
event.preventDefault();
|
|
369
393
|
if (!count) return;
|
|
370
394
|
const step = event.key === "ArrowDown" ? 1 : -1;
|
|
371
|
-
const next = nextEnabledIndex(count, active.value + step, step,
|
|
395
|
+
const next = nextEnabledIndex(count, active.value + step, step, isSkipped);
|
|
396
|
+
keyboardActive.value = true;
|
|
372
397
|
if (next !== -1) active.value = next;
|
|
373
398
|
} else if ((event.key === "Home" || event.key === "End") && event.ctrlKey && count) {
|
|
374
399
|
event.preventDefault();
|
|
375
|
-
const next = event.key === "Home" ? nextEnabledIndex(count, 0, 1,
|
|
400
|
+
const next = event.key === "Home" ? nextEnabledIndex(count, 0, 1, isSkipped) : nextEnabledIndex(count, count - 1, -1, isSkipped);
|
|
401
|
+
keyboardActive.value = true;
|
|
376
402
|
if (next !== -1) active.value = next;
|
|
377
403
|
} else if (event.key === "Enter" && !event.isComposing) {
|
|
378
404
|
event.preventDefault();
|
|
@@ -231,8 +231,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
231
231
|
onOpen?: (() => any) | undefined;
|
|
232
232
|
backLabel?: string;
|
|
233
233
|
closeLabel?: string;
|
|
234
|
-
onNavigate?: ((index: number) => any) | undefined;
|
|
235
234
|
trail?: string[];
|
|
235
|
+
onNavigate?: ((index: number) => any) | undefined;
|
|
236
236
|
rootClass?: unknown;
|
|
237
237
|
hideClose?: boolean;
|
|
238
238
|
beforeClose?: import("./types.ts").DialogBeforeClose;
|
|
@@ -472,8 +472,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
472
472
|
onOpen?: (() => any) | undefined;
|
|
473
473
|
backLabel?: string;
|
|
474
474
|
closeLabel?: string;
|
|
475
|
-
onNavigate?: ((index: number) => any) | undefined;
|
|
476
475
|
trail?: string[];
|
|
476
|
+
onNavigate?: ((index: number) => any) | undefined;
|
|
477
477
|
rootClass?: unknown;
|
|
478
478
|
hideClose?: boolean;
|
|
479
479
|
beforeClose?: import("./types.ts").DialogBeforeClose;
|
|
@@ -221,8 +221,8 @@ declare const __VLS_export: import("vue").DefineComponent<Partial<NonNullable<{
|
|
|
221
221
|
readonly onOpen?: (() => any) | undefined;
|
|
222
222
|
readonly backLabel?: string | undefined;
|
|
223
223
|
readonly closeLabel?: string | undefined;
|
|
224
|
-
readonly onNavigate?: ((index: number) => any) | undefined;
|
|
225
224
|
readonly trail?: string[] | undefined;
|
|
225
|
+
readonly onNavigate?: ((index: number) => any) | undefined;
|
|
226
226
|
readonly rootClass?: unknown;
|
|
227
227
|
readonly hideClose?: boolean | undefined;
|
|
228
228
|
readonly beforeClose?: import("./types.ts").DialogBeforeClose | undefined;
|
|
@@ -458,8 +458,8 @@ declare const __VLS_export: import("vue").DefineComponent<Partial<NonNullable<{
|
|
|
458
458
|
readonly onOpen?: (() => any) | undefined;
|
|
459
459
|
readonly backLabel?: string | undefined;
|
|
460
460
|
readonly closeLabel?: string | undefined;
|
|
461
|
-
readonly onNavigate?: ((index: number) => any) | undefined;
|
|
462
461
|
readonly trail?: string[] | undefined;
|
|
462
|
+
readonly onNavigate?: ((index: number) => any) | undefined;
|
|
463
463
|
readonly rootClass?: unknown;
|
|
464
464
|
readonly hideClose?: boolean | undefined;
|
|
465
465
|
readonly beforeClose?: import("./types.ts").DialogBeforeClose | undefined;
|
|
@@ -202,6 +202,7 @@ const props = defineProps({
|
|
|
202
202
|
filterKey: { type: String, required: false },
|
|
203
203
|
filterMultiple: { type: Boolean, required: false, default: true },
|
|
204
204
|
filterLabel: { type: String, required: false },
|
|
205
|
+
filtered: { type: Boolean, required: false },
|
|
205
206
|
toolbarLabel: { type: String, required: false },
|
|
206
207
|
emptyTitle: { type: String, required: false },
|
|
207
208
|
emptyDescription: { type: String, required: false },
|
|
@@ -251,7 +252,9 @@ const filterValues = computed(() => {
|
|
|
251
252
|
if (value === null || value === void 0) return [];
|
|
252
253
|
return Array.isArray(value) ? value : [value];
|
|
253
254
|
});
|
|
254
|
-
const isFiltered = computed(
|
|
255
|
+
const isFiltered = computed(
|
|
256
|
+
() => props.filtered || search.value.trim() !== "" || filterValues.value.length > 0
|
|
257
|
+
);
|
|
255
258
|
function clearSelection() {
|
|
256
259
|
selected.value = [];
|
|
257
260
|
}
|
|
@@ -266,7 +269,7 @@ function read(row, key) {
|
|
|
266
269
|
const searchFields = computed(
|
|
267
270
|
() => props.searchKeys ?? props.columns?.map((column) => column.key) ?? []
|
|
268
271
|
);
|
|
269
|
-
const
|
|
272
|
+
const matchingRows = computed(() => {
|
|
270
273
|
if (serverMode.value) return props.rows;
|
|
271
274
|
const query = normalizeSearch(search.value.trim());
|
|
272
275
|
const values = filterValues.value;
|
|
@@ -283,7 +286,7 @@ const filtered = computed(() => {
|
|
|
283
286
|
});
|
|
284
287
|
const collator = computed(() => createCollator(locale.value.code));
|
|
285
288
|
const sorted = computed(
|
|
286
|
-
() => serverMode.value ?
|
|
289
|
+
() => serverMode.value ? matchingRows.value : sortRows(matchingRows.value, sort.value, props.columns, collator.value)
|
|
287
290
|
);
|
|
288
291
|
const rowsPerPage = computed(
|
|
289
292
|
() => pageSize.value === "all" ? Math.max(1, resultTotal.value) : pageSize.value
|
|
@@ -304,7 +307,7 @@ function clearFilters() {
|
|
|
304
307
|
emit("clear");
|
|
305
308
|
}
|
|
306
309
|
const interacted = ref(false);
|
|
307
|
-
watch([search, filterValues], () => {
|
|
310
|
+
watch([search, filterValues, () => props.filtered], () => {
|
|
308
311
|
interacted.value = true;
|
|
309
312
|
if (page.value !== 1) page.value = 1;
|
|
310
313
|
});
|
|
@@ -262,8 +262,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
262
262
|
sheet?: boolean;
|
|
263
263
|
tab?: import("../layout/types.ts").TabItem["value"];
|
|
264
264
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
265
|
-
onNavigate?: ((index: number) => any) | undefined;
|
|
266
265
|
trail?: string[];
|
|
266
|
+
onNavigate?: ((index: number) => any) | undefined;
|
|
267
267
|
rootClass?: unknown;
|
|
268
268
|
hideClose?: boolean;
|
|
269
269
|
"onUpdate:tab"?: ((value: string | number | undefined) => any) | undefined;
|
|
@@ -518,8 +518,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
518
518
|
sheet?: boolean;
|
|
519
519
|
tab?: import("../layout/types.ts").TabItem["value"];
|
|
520
520
|
onCancel?: ((payload: Event) => void) | undefined;
|
|
521
|
-
onNavigate?: ((index: number) => any) | undefined;
|
|
522
521
|
trail?: string[];
|
|
522
|
+
onNavigate?: ((index: number) => any) | undefined;
|
|
523
523
|
rootClass?: unknown;
|
|
524
524
|
hideClose?: boolean;
|
|
525
525
|
"onUpdate:tab"?: ((value: string | number | undefined) => any) | undefined;
|
|
@@ -14,6 +14,7 @@ export declare function routeParam(route: {
|
|
|
14
14
|
} | undefined, key: string, location: RouteLocation): string | undefined;
|
|
15
15
|
export declare function useDefaultRouteLocation(): RouteLocation;
|
|
16
16
|
export declare function useRouteValue(router: RouterLike | undefined, key: MaybeRefOrGetter<string | undefined>, location?: MaybeRefOrGetter<RouteLocation>): import("vue").ComputedRef<string | undefined>;
|
|
17
|
+
export declare function trackUntrackedEntries(): void;
|
|
17
18
|
export declare function routeHash(hash: string | undefined, changes: Record<string, string | undefined>): string;
|
|
18
19
|
export declare function writeRouteValue(router: RouterLike, key: string, value: string | undefined, history: RouteHistory, location?: RouteLocation): Promise<boolean>;
|
|
19
20
|
export {};
|
|
@@ -50,6 +50,7 @@ function useHashReady() {
|
|
|
50
50
|
}
|
|
51
51
|
export function useRouteValue(router, key, location = "query") {
|
|
52
52
|
const hashReady = useHashReady();
|
|
53
|
+
if (router) trackUntrackedEntries();
|
|
53
54
|
return computed(() => {
|
|
54
55
|
const name = toValue(key);
|
|
55
56
|
if (!router || !name) return void 0;
|
|
@@ -59,11 +60,23 @@ export function useRouteValue(router, key, location = "query") {
|
|
|
59
60
|
return firstQueryValue(route?.query?.[name]);
|
|
60
61
|
});
|
|
61
62
|
}
|
|
63
|
+
const UNTRACKED_ENTRY = "kUntracked";
|
|
64
|
+
let untrackedListening = false;
|
|
65
|
+
function markUntrackedEntry(event) {
|
|
66
|
+
if (event.state !== null) return;
|
|
67
|
+
const state = window.history.state;
|
|
68
|
+
window.history.replaceState({ ...state, [UNTRACKED_ENTRY]: true }, "");
|
|
69
|
+
}
|
|
70
|
+
export function trackUntrackedEntries() {
|
|
71
|
+
if (untrackedListening || !isClient()) return;
|
|
72
|
+
untrackedListening = true;
|
|
73
|
+
window.addEventListener("popstate", markUntrackedEntry);
|
|
74
|
+
}
|
|
62
75
|
function isPreviousEntry(router, location) {
|
|
63
76
|
if (!router.back || !router.resolve) return false;
|
|
64
|
-
const
|
|
65
|
-
if (typeof back !== "string") return false;
|
|
66
|
-
return router.resolve(location).fullPath === back;
|
|
77
|
+
const state = window.history.state;
|
|
78
|
+
if (state?.[UNTRACKED_ENTRY] || typeof state?.back !== "string") return false;
|
|
79
|
+
return router.resolve(location).fullPath === state.back;
|
|
67
80
|
}
|
|
68
81
|
function applyQuery(current, changes) {
|
|
69
82
|
const query = { ...current };
|
|
@@ -20,7 +20,8 @@ const props = defineProps({
|
|
|
20
20
|
text: { type: String, required: true },
|
|
21
21
|
placement: { type: null, required: false, default: "top" },
|
|
22
22
|
openDelay: { type: Number, required: false, default: 500 },
|
|
23
|
-
closeDelay: { type: Number, required: false, default: 80 }
|
|
23
|
+
closeDelay: { type: Number, required: false, default: 80 },
|
|
24
|
+
active: { type: Boolean, required: false }
|
|
24
25
|
});
|
|
25
26
|
const floatingRef = useTemplateRef("floatingRef");
|
|
26
27
|
const trigger = shallowRef(null);
|
|
@@ -53,9 +54,16 @@ function matches(element, selector) {
|
|
|
53
54
|
onMounted(() => {
|
|
54
55
|
const element = floatingRef.value?.parentElement ?? null;
|
|
55
56
|
trigger.value = element;
|
|
56
|
-
if (element && (matches(element, ":hover") || matches(element, ":focus-visible")))
|
|
57
|
+
if (element && (props.active || matches(element, ":hover") || matches(element, ":focus-visible")))
|
|
57
58
|
hover.scheduleOpen();
|
|
58
59
|
});
|
|
60
|
+
watch(
|
|
61
|
+
() => props.active,
|
|
62
|
+
(active) => {
|
|
63
|
+
if (active) hover.scheduleOpen();
|
|
64
|
+
else hover.scheduleClose(true);
|
|
65
|
+
}
|
|
66
|
+
);
|
|
59
67
|
watch(
|
|
60
68
|
() => props.text,
|
|
61
69
|
(text) => {
|
|
@@ -5,6 +5,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
5
5
|
placement?: OverlayPlacement;
|
|
6
6
|
openDelay?: number;
|
|
7
7
|
closeDelay?: number;
|
|
8
|
+
active?: boolean;
|
|
8
9
|
innerHTML?: string | undefined | undefined;
|
|
9
10
|
class?: import("vue").ClassValue;
|
|
10
11
|
style?: import("vue").StyleValue;
|
|
@@ -202,6 +203,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
202
203
|
placement?: OverlayPlacement;
|
|
203
204
|
openDelay?: number;
|
|
204
205
|
closeDelay?: number;
|
|
206
|
+
active?: boolean;
|
|
205
207
|
innerHTML?: string | undefined | undefined;
|
|
206
208
|
class?: import("vue").ClassValue;
|
|
207
209
|
style?: import("vue").StyleValue;
|
|
@@ -219,8 +219,8 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
219
219
|
onOpen?: ((() => any) & (() => any)) | undefined;
|
|
220
220
|
backLabel?: string;
|
|
221
221
|
closeLabel?: string;
|
|
222
|
-
onNavigate?: (((index: number) => any) & ((index: number) => any)) | undefined;
|
|
223
222
|
trail?: string[];
|
|
223
|
+
onNavigate?: (((index: number) => any) & ((index: number) => any)) | undefined;
|
|
224
224
|
rootClass?: unknown;
|
|
225
225
|
hideClose?: boolean;
|
|
226
226
|
beforeClose?: import("../../index.ts").DialogBeforeClose;
|
|
@@ -453,8 +453,8 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
453
453
|
onOpen?: ((() => any) & (() => any)) | undefined;
|
|
454
454
|
backLabel?: string;
|
|
455
455
|
closeLabel?: string;
|
|
456
|
-
onNavigate?: (((index: number) => any) & ((index: number) => any)) | undefined;
|
|
457
456
|
trail?: string[];
|
|
457
|
+
onNavigate?: (((index: number) => any) & ((index: number) => any)) | undefined;
|
|
458
458
|
rootClass?: unknown;
|
|
459
459
|
hideClose?: boolean;
|
|
460
460
|
beforeClose?: import("../../index.ts").DialogBeforeClose;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useDashboard, useNavigationPending } from './runtime/dashboard';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useDashboard, useNavigationPending } from "./runtime/dashboard.mjs";
|
package/dist/nuxt/module.mjs
CHANGED
|
@@ -132,8 +132,8 @@ export default defineNuxtModule({
|
|
|
132
132
|
if (typeof options.grid === "object") addPlugin(resolver.resolve("./runtime/grid"));
|
|
133
133
|
if (options.composables) {
|
|
134
134
|
addImports([
|
|
135
|
-
{ name: "useDashboard", from: resolver.resolve("./
|
|
136
|
-
{ name: "useNavigationPending", from: resolver.resolve("./
|
|
135
|
+
{ name: "useDashboard", from: resolver.resolve("./composables") },
|
|
136
|
+
{ name: "useNavigationPending", from: resolver.resolve("./composables") }
|
|
137
137
|
]);
|
|
138
138
|
}
|
|
139
139
|
const layouts = resolveLayouts(options.layouts);
|
|
@@ -19,7 +19,7 @@ export default defineNuxtPlugin({
|
|
|
19
19
|
if (pending.value) suspended = true;
|
|
20
20
|
});
|
|
21
21
|
nuxtApp.hook("page:finish", done);
|
|
22
|
-
router.
|
|
22
|
+
router.beforeResolve(async (to, from) => {
|
|
23
23
|
if (nuxtApp.isHydrating || pending.value || to.path === from.path) return;
|
|
24
24
|
pending.value = true;
|
|
25
25
|
await nextFrame();
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { defineNuxtPlugin, useRouter, useRuntimeConfig } from "nuxt/app";
|
|
2
2
|
import { withRouteStateScroll } from "../../composables/useRouteState.mjs";
|
|
3
3
|
import { ROUTE_LOCATION_KEY } from "../../internal/keys.mjs";
|
|
4
|
+
import { trackUntrackedEntries } from "../../internal/layout/query.mjs";
|
|
4
5
|
export default defineNuxtPlugin({
|
|
5
6
|
name: "k:route-state",
|
|
6
7
|
setup(nuxtApp) {
|
|
7
8
|
const config = useRuntimeConfig().public.k ?? {};
|
|
8
9
|
nuxtApp.vueApp.provide(ROUTE_LOCATION_KEY, config.routeLocation === "hash" ? "hash" : "query");
|
|
9
10
|
if (import.meta.server) return;
|
|
11
|
+
trackUntrackedEntries();
|
|
10
12
|
const options = useRouter().options;
|
|
11
13
|
const wrap = (behavior) => behavior ? withRouteStateScroll(behavior) : void 0;
|
|
12
14
|
let scrollBehavior = wrap(options.scrollBehavior);
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
background: var(--k-danger);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
.k-tree .k-tree-row.is-invalid > .k-tree-text,
|
|
125
126
|
.k-tree .k-tree-row.is-invalid .k-tree-label {
|
|
126
127
|
color: var(--k-danger-text);
|
|
127
128
|
}
|
|
@@ -301,22 +302,45 @@
|
|
|
301
302
|
border-radius: var(--k-radius-sm);
|
|
302
303
|
background: var(--k-elevated);
|
|
303
304
|
opacity: 0;
|
|
304
|
-
|
|
305
|
+
visibility: hidden;
|
|
305
306
|
translate: 0 -50%;
|
|
306
|
-
transition:
|
|
307
|
+
transition:
|
|
308
|
+
opacity var(--k-duration) var(--k-ease),
|
|
309
|
+
visibility var(--k-duration) var(--k-ease);
|
|
307
310
|
}
|
|
308
311
|
|
|
309
312
|
.k-tree-actions:empty {
|
|
310
313
|
display: none;
|
|
311
314
|
}
|
|
312
315
|
|
|
316
|
+
.k-tree-moves {
|
|
317
|
+
display: contents;
|
|
318
|
+
}
|
|
319
|
+
|
|
313
320
|
.k-tree-row:is(:hover, :focus-within) > .k-tree-actions,
|
|
314
|
-
.k-tree-row[aria-selected='true'] > .k-tree-actions.has-slot
|
|
321
|
+
.k-tree-row[aria-selected='true'] > .k-tree-actions.has-slot,
|
|
322
|
+
.k-tree-actions:has([aria-expanded='true']) {
|
|
315
323
|
opacity: 1;
|
|
316
|
-
|
|
324
|
+
visibility: visible;
|
|
317
325
|
}
|
|
318
326
|
|
|
319
327
|
.k-tree.is-dragging .k-tree-row > .k-tree-actions {
|
|
320
328
|
opacity: 0;
|
|
321
|
-
|
|
329
|
+
visibility: hidden;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
@media (hover: none) {
|
|
333
|
+
.k-tree-actions {
|
|
334
|
+
position: static;
|
|
335
|
+
flex: none;
|
|
336
|
+
background: none;
|
|
337
|
+
opacity: 1;
|
|
338
|
+
visibility: visible;
|
|
339
|
+
translate: none;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.k-tree-row:not(:focus-within, [aria-selected='true']) > .k-tree-actions:not(.has-slot),
|
|
343
|
+
.k-tree-row:not(:focus-within, [aria-selected='true']) > .k-tree-actions > .k-tree-moves {
|
|
344
|
+
display: none;
|
|
345
|
+
}
|
|
322
346
|
}
|
|
@@ -101,3 +101,26 @@
|
|
|
101
101
|
text-overflow: ellipsis;
|
|
102
102
|
white-space: nowrap;
|
|
103
103
|
}
|
|
104
|
+
|
|
105
|
+
.k-page-header-trail {
|
|
106
|
+
min-width: 0;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.k-breadcrumbs.k-page-header-trail .k-breadcrumbs-list {
|
|
110
|
+
font-size: 1.375rem;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.k-page-header.is-truncated .k-page-header-trail .k-breadcrumbs-list {
|
|
114
|
+
flex-wrap: nowrap;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.k-page-header.is-truncated .k-page-header-trail .k-breadcrumbs-item:not(:last-child) {
|
|
118
|
+
flex: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.k-page-header.is-truncated .k-page-header-trail .k-breadcrumbs-current {
|
|
122
|
+
display: block;
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
text-overflow: ellipsis;
|
|
125
|
+
white-space: nowrap;
|
|
126
|
+
}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
border-radius: var(--k-popover-radius, var(--k-radius-lg));
|
|
22
22
|
box-shadow: var(--k-popover-shadow, var(--k-shadow-overlay));
|
|
23
23
|
opacity: 0;
|
|
24
|
+
pointer-events: auto;
|
|
24
25
|
transform: translate(var(--k-floating-shift-x), var(--k-floating-shift-y)) scale(0.97);
|
|
25
26
|
transform-origin: var(--k-floating-origin, top center);
|
|
26
27
|
transition:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xleddyl/443-components-vue",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.92",
|
|
4
4
|
"description": "Compact, scoped dashboard components for Vue and Nuxt",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Edoardo Alberti (https://github.com/xleddyl)",
|
|
@@ -28,6 +28,11 @@
|
|
|
28
28
|
"import": "./dist/nuxt/module.mjs",
|
|
29
29
|
"default": "./dist/nuxt/module.mjs"
|
|
30
30
|
},
|
|
31
|
+
"./nuxt/composables": {
|
|
32
|
+
"types": "./dist/nuxt/composables.d.ts",
|
|
33
|
+
"import": "./dist/nuxt/composables.mjs",
|
|
34
|
+
"default": "./dist/nuxt/composables.mjs"
|
|
35
|
+
},
|
|
31
36
|
"./style.css": "./dist/styles/index.css",
|
|
32
37
|
"./grid": {
|
|
33
38
|
"types": "./dist/grid/index.d.ts",
|