@xleddyl/443-components-vue 0.16.91 → 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 +9 -8
- package/README.md +13 -6
- 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/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/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/layout/breadcrumbs.css +2 -0
- package/dist/styles/layout/page-header.css +23 -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`) |
|
|
@@ -236,8 +237,8 @@ Mount `OverlayHost` once for the imperative hooks (see [Composables](#composable
|
|
|
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. |
|
|
@@ -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
|
|
|
@@ -530,7 +537,7 @@ On your own elements, `paletteClass(color)` gives the class of a palette name an
|
|
|
530
537
|
|
|
531
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`.
|
|
532
539
|
- `DropdownMenu` takes `matchTriggerWidth` (the menu is at least as wide as its trigger) and `minWidth` (a CSS length).
|
|
533
|
-
- `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.
|
|
534
541
|
- `RichTextEditor` accepts `'underline'` in `toolbar` (not in the default toolbar).
|
|
535
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.
|
|
536
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`.
|
|
@@ -556,7 +563,7 @@ On your own elements, `paletteClass(color)` gives the class of a palette name an
|
|
|
556
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.
|
|
557
564
|
|
|
558
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.
|
|
559
|
-
- `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.
|
|
560
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']`.
|
|
561
568
|
|
|
562
569
|
### Grid defaults
|
|
@@ -693,7 +700,7 @@ const familyId = useRouteState('family')
|
|
|
693
700
|
```
|
|
694
701
|
|
|
695
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).
|
|
696
|
-
- 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.
|
|
697
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:
|
|
698
705
|
|
|
699
706
|
```ts
|
|
@@ -856,7 +863,7 @@ Both take the `AuthLayout` frame props and the `brand`, `corner`, `footer` and `
|
|
|
856
863
|
| Component | What it gives you |
|
|
857
864
|
| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
858
865
|
| `DashboardPage` | PageHeader (`title`, `eyebrow`, `description`, `#actions`), a Stat grid from `stats` (or `#stats`), a content grid (`columns`, default 1 then 3 columns). |
|
|
859
|
-
| `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. |
|
|
860
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. |
|
|
861
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). |
|
|
862
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. |
|
|
@@ -949,7 +956,7 @@ The account row opens the SettingsModal (`account.action: 'menu'` with `account.
|
|
|
949
956
|
|
|
950
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.
|
|
951
958
|
|
|
952
|
-
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.
|
|
953
960
|
|
|
954
961
|
### Starter
|
|
955
962
|
|
|
@@ -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";
|
|
@@ -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 };
|
|
@@ -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);
|
|
@@ -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
|
+
}
|
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",
|