@xleddyl/443-components-vue 0.16.71 → 0.16.73
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 +56 -55
- package/README.md +14 -12
- package/dist/components/forms/Combobox.vue +114 -14
- package/dist/components/forms/Combobox.vue.d.ts +4 -3
- package/dist/components/forms/PaletteSelect.vue +1 -0
- package/dist/components/forms/PaletteSelect.vue.d.ts +4 -2
- package/dist/components/overlays/types.d.ts +1 -0
- package/dist/components/templates/FormDrawer.vue +4 -1
- package/dist/components/templates/FormDrawer.vue.d.ts +3 -0
- package/dist/components/templates/FormModal.vue +4 -1
- package/dist/components/templates/FormModal.vue.d.ts +3 -0
- package/dist/grid/DataGrid.vue +51 -5
- package/dist/grid/DataGrid.vue.d.ts +1 -0
- package/dist/grid/GridToolbar.vue.d.ts +1 -1
- package/dist/internal/overlays/MenuList.vue +21 -0
- package/dist/styles/forms/combobox.css +45 -1
- package/package.json +1 -1
package/CATALOG.md
CHANGED
|
@@ -46,6 +46,7 @@ Playground paths in this file are relative to `playground/nuxt/app/pages/compone
|
|
|
46
46
|
| Money or unit prefix and suffix around an input | `InputGroup` + `InputAddon` |
|
|
47
47
|
| One choice from a short list (5 or fewer) | `RadioGroup` or `SegmentedControl` |
|
|
48
48
|
| One choice from a longer list, no search | `Select` |
|
|
49
|
+
| One choice from a short fixed list with a color dot or an icon, no search | `Combobox` with `:searchable="false"` (a button trigger with typeahead, also `multiple`) |
|
|
49
50
|
| Searchable select, async search, multi select, create option | `Combobox` |
|
|
50
51
|
| Pick one node of a hierarchy (category, folder) | `TreeSelect` (`leavesOnly` to allow only leaves) |
|
|
51
52
|
| Create new values with a format or rule (tags, codes) | `Combobox` with `creatable`, `createTransform`, `createValidate` |
|
|
@@ -162,31 +163,31 @@ Playground paths in this file are relative to `playground/nuxt/app/pages/compone
|
|
|
162
163
|
|
|
163
164
|
All field components work inside `FormField` and take `invalid`, `disabled`, `readonly`, `required` and `size`, except: `Select` has no `readonly`, `Slider` and `PaletteSelect` have no `required`, `Calendar` takes only `disabled` and `readonly`. They use `v-model`.
|
|
164
165
|
|
|
165
|
-
| Component | Purpose and when to use it
|
|
166
|
-
| ------------------ |
|
|
167
|
-
| `Checkbox` | One boolean, or one value in an array model. Use `Switch` for an instant setting.
|
|
168
|
-
| `CheckboxGroup` | Several choices as checkboxes from `options`.
|
|
169
|
-
| `Radio` | One radio option, used inside `RadioGroup`.
|
|
170
|
-
| `RadioGroup` | One choice from a short list. Use `Select` for long lists, `SegmentedControl` for a compact toggle.
|
|
171
|
-
| `SegmentedControl` | Compact toggle between 2 to 5 options (view mode, period).
|
|
172
|
-
| `Select` | Native styled select. Use `Combobox` when search or async options are needed.
|
|
173
|
-
| `Combobox` | Searchable select. Local filter, async `search`, `multiple` with tags, `creatable`.
|
|
174
|
-
| `TreeSelect` | Pick one node of a hierarchy (category, folder) with a drill-down panel, one level at a time.
|
|
175
|
-
| `Switch` | On or off setting that applies at once.
|
|
176
|
-
| `NumberInput` | Locale aware number with stepper, min, max, step.
|
|
177
|
-
| `PasswordInput` | Password with show or hide, optional generator, copy and strength meter.
|
|
178
|
-
| `PinInput` | One time code or PIN in separate cells.
|
|
179
|
-
| `InputGroup` | Join an input with addons or buttons on its sides.
|
|
180
|
-
| `Fieldset` | Group of fields that can be disabled together, outside or inside a `Form` (a read only part of a page).
|
|
181
|
-
| `InputAddon` | Static text or icon (currency, domain, unit) inside an `InputGroup`.
|
|
182
|
-
| `DateInput` | Native date, datetime-local, month or week input. Use `DatePicker` for a calendar popover or ranges.
|
|
183
|
-
| `DatePicker` | Input with a calendar popover. Single date or `range`.
|
|
184
|
-
| `Calendar` | Inline calendar. Use it for availability views, or as a building block.
|
|
185
|
-
| `TimeInput` | Time of day (HH:MM, optional seconds).
|
|
186
|
-
| `ColorInput` | Color text field with picker and swatches.
|
|
187
|
-
| `PaletteSelect` | Select of a palette color, with the dot and the localized color name.
|
|
188
|
-
| `Slider` | Number in a range with drag handle.
|
|
189
|
-
| `FileInput` | Drop zone and file picker. Validates type, size and count. Supports folders and previews.
|
|
166
|
+
| Component | Purpose and when to use it | Main props, models, slots, events | Playground |
|
|
167
|
+
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
|
|
168
|
+
| `Checkbox` | One boolean, or one value in an array model. Use `Switch` for an instant setting. | Model: boolean or array. Props: `label`, `description`, `value`, `indeterminate`. Slots: default, `description`. | `forms/checkbox.vue` |
|
|
169
|
+
| `CheckboxGroup` | Several choices as checkboxes from `options`. | Model: `T[]`. Props: `options` (`label`, `value`, `description`, `disabled`, `icon`), `legend`, `orientation`, `columns`, `variant` (default, filled), `name`. | `forms/checkbox-group.vue` |
|
|
170
|
+
| `Radio` | One radio option, used inside `RadioGroup`. | Props: `value`, `label`, `description`, `icon`. Slots: default, `description`. | `forms/radio-group.vue` |
|
|
171
|
+
| `RadioGroup` | One choice from a short list. Use `Select` for long lists, `SegmentedControl` for a compact toggle. | Model: value or null. Props: `options`, `legend`, `orientation`, `variant` (default, card), `name`. | `forms/radio-group.vue` |
|
|
172
|
+
| `SegmentedControl` | Compact toggle between 2 to 5 options (view mode, period). | Model: value (with `required` it is never null). Props: `options` (`label`, `value`, `icon`, `title`, `muted`), `iconOnly`, `block`, `label`. Slot: `option`. | `forms/segmented-control.vue` |
|
|
173
|
+
| `Select` | Native styled select. Use `Combobox` when search or async options are needed. | Model: `T or null`. Props: `options` (items or groups with `label`, `value`, `disabled`), `placeholder`, `icon`. Option values can be string, number or boolean. | `forms/select.vue` |
|
|
174
|
+
| `Combobox` | Searchable select. Local filter, async `search`, `multiple` with tags, `creatable`. `:searchable="false"` makes it a plain select with dots and icons. | Models: `v-model`, `v-model:query`. Props: `options` (`label`, `value`, `description`, `icon`, `color` (dot and tag color), `group` (divider with the group name, also the tooltip of a selected tag), `keywords`), `search(query, signal)`, `filter`, `searchable` (default `true`; `false` is a button trigger without typing, with typeahead, and ignores `creatable`, `createActions` and `search`), `multiple`, `hideTags`, `creatable`, `createActions`, `createTransform`, `createValidate` (a returned string is the inline error), `debounce`, `minQueryLength`, `maxSelected`, `clearable`, `loading`, `placeholder`, `emptyText`. Slots: `option`, `empty`, `header` (top of the panel, for example quick filter pills). Events: `create`, `open`, `close`. | `forms/combobox.vue` |
|
|
175
|
+
| `TreeSelect` | Pick one node of a hierarchy (category, folder) with a drill-down panel, one level at a time. | Model: `TreeNodeId or null`. Props: `nodes` (`TreeNode`: `id`, `label`, `description`, `icon`, `disabled`, `children`), `leavesOnly` (parents only navigate), `separator` (path in the control and in search results, default `' / '`), `clearable`, `placeholder`, `searchPlaceholder`, `emptyText`, `icon`. Search lists every match with its path. Slots: `node` (`node`, `selected`, `path`), `empty`. Events: `open`, `close`. | `forms/tree-select.vue` |
|
|
176
|
+
| `Switch` | On or off setting that applies at once. | Model: boolean. Props: `label`, `description`, `labelPosition`, `checkedIcon`, `uncheckedIcon`, `name`. Slots: default, `description`. | `forms/switch.vue` |
|
|
177
|
+
| `NumberInput` | Locale aware number with stepper, min, max, step. | Model: number or null. Props: `min`, `max`, `step`, `largeStep`, `locale`, `formatOptions` (currency, percent), `decimalSeparator` (`'.'` or `','`, default from the locale), `stepper`, `wheel`, `align` (`start`, the default, or `end`), `icon`, `placeholder`. Numbers are left aligned like every other field. Typing keeps only digits, one decimal separator (a typed `.` or `,` becomes the separator) and a leading `-` when `min` allows negatives. | `forms/number-input.vue` |
|
|
178
|
+
| `PasswordInput` | Password with show or hide, optional generator, copy and strength meter. | Model: string. Props: `generate` (true or a function), `copy`, `strength`, `minLength`, `autocomplete`. Event: `generate`. | `forms/password-input.vue` |
|
|
179
|
+
| `PinInput` | One time code or PIN in separate cells. | Model: string. Props: `length`, `mode` (numeric, alphanumeric, alphabetic), `mask`, `uppercase`, `separatorAfter`, `autocomplete`. Event: `complete(value)`. | `forms/pin-input.vue` |
|
|
180
|
+
| `InputGroup` | Join an input with addons or buttons on its sides. | Props: `label`, `size`, `block`. Slot: default (inputs, `InputAddon`, `Button`). | `forms/input-group.vue` |
|
|
181
|
+
| `Fieldset` | Group of fields that can be disabled together, outside or inside a `Form` (a read only part of a page). | Props: `disabled` (every field inside is disabled, the same as `Form` `disabled`; without it the group inherits the state of its parent, `false` enables a group inside a disabled form), `legend`. Slots: default, `legend`. A native `fieldset`: buttons inside are disabled too, links are not. When it becomes disabled with the focus inside, the focus moves to the fieldset. | `forms/fieldset.vue` |
|
|
182
|
+
| `InputAddon` | Static text or icon (currency, domain, unit) inside an `InputGroup`. | Props: `label`, `icon`, `size`. Slot: default. | `forms/input-group.vue` |
|
|
183
|
+
| `DateInput` | Native date, datetime-local, month or week input. Use `DatePicker` for a calendar popover or ranges. | Model: ISO string or null. Props: `type`, `min`, `max`, `step`, `clearable`. | `forms/date-input.vue` |
|
|
184
|
+
| `DatePicker` | Input with a calendar popover. Single date or `range`. | Model: ISO string, range object (`start`, `end`) or null. Props: `range`, `min`, `max`, `isDateDisabled`, `locale`, `weekStartsOn`, `format`, `closeOnSelect`, `clearable`. Slot: `footer`. | `forms/date-picker.vue` |
|
|
185
|
+
| `Calendar` | Inline calendar. Use it for availability views, or as a building block. | Models: `v-model` (date or range), `v-model:month`. Props: `range`, `min`, `max`, `isDateDisabled`, `locale`, `weekStartsOn`, `dayText(iso)`. Slots: `day`, `footer`. Event: `select`. | `forms/calendar.vue` |
|
|
186
|
+
| `TimeInput` | Time of day (HH:MM, optional seconds). | Model: string or null. Props: `min`, `max`, `step`, `seconds`, `clearable`. | `forms/time-input.vue` |
|
|
187
|
+
| `ColorInput` | Color text field with picker and swatches. | Model: hex string or null. Props: `swatches` (strings or `{ value, label }`), `placeholder`, `invalidText`. | `forms/color-input.vue` |
|
|
188
|
+
| `PaletteSelect` | Select of a palette color, with the dot and the localized color name. | Model: `ColorValue` (palette name or `#rrggbb`) or null. A non-searchable `Combobox` (pass `:searchable="true"` to type a filter). Props: `colors` (subset of `PALETTE_COLORS`), `clearable` (placeholder "Automatic"), `custom` (adds "Custom": choosing it shows a `ColorInput` under the select and the model becomes the hex), `customLabel` (name of the color input), `placeholder`, `size`, `disabled`, `readonly`, `invalid`. | `forms/palette-select.vue` |
|
|
189
|
+
| `Slider` | Number in a range with drag handle. | Model: number. Props: `min`, `max`, `step`, `bubble` (true, always), `marks`, `format(value)`, `label`. Event: `change` (on release). | `forms/slider.vue` |
|
|
190
|
+
| `FileInput` | Drop zone and file picker. Validates type, size and count. Supports folders and previews. | Model: `File`, `File[]` or null. Props: `accept`, `acceptMode`, `maxSize`, `maxFiles`, `multiple`, `directory`, `directoryAction`, `previews`, `list`, `loading`, `capture`, `title`, `dropText`, `hint`. Slots: `title`, `hint`, `actions`. Events: `add`, `remove`, `invalid`, `reject`. | `forms/file-input.vue` |
|
|
190
191
|
|
|
191
192
|
## Overlays
|
|
192
193
|
|
|
@@ -200,7 +201,7 @@ Mount `OverlayHost` once for the imperative hooks (see [Composables](#composable
|
|
|
200
201
|
| `ConfirmHost` | Renders the dialogs of `useConfirm`, `useAlert`, `usePrompt`. `OverlayHost` includes it. Do not mount it alone. | None. | - |
|
|
201
202
|
| `OverlayHost` | One mount point for toasts, confirm dialogs, programmatic modals and loading indicators. | Props: `toaster` (true or options), `confirm`, `modals`, `loading` (true or `{ bar, delay, label }`). | `overlays/hooks.vue` |
|
|
202
203
|
| `Toaster` | Renders toasts. `OverlayHost` includes it. Use it directly only for custom options. The stack moves out of the way of an open side Drawer (beside it, or above its footer). | Props: `position`, `max`, `duration`, `gap`, `expand`, `progress`, `hotkey`. | `overlays/toast.vue` |
|
|
203
|
-
| `DropdownMenu` | Menu opened by its trigger. Items can have icons, shortcuts, checkboxes, radios, sub menus and links. | Model: `v-model:open`. Props: `items` (`label`, `icon`, `color` (palette name or hex dot, or `muted` for a grey dot of an empty state), `to`, `href`, `tone: danger`, `shortcut`, `disabled`, `children`, `onSelect`; also `type`: checkbox, radio, label, separator), `placement`, `offset`, `matchTriggerWidth`, `minWidth`. Slot: default (the trigger). Event: `select`.
|
|
204
|
+
| `DropdownMenu` | Menu opened by its trigger. Items can have icons, shortcuts, checkboxes, radios, sub menus and links. | Model: `v-model:open`. Props: `items` (`label`, `icon`, `color` (palette name or hex dot, or `muted` for a grey dot of an empty state), `to`, `href`, `tone: danger`, `shortcut`, `disabled`, `disabledReason` (with `disabled`: a tooltip on hover and keyboard focus, linked with `aria-describedby`; the item stays reachable but not selectable), `children`, `onSelect`; also `type`: checkbox, radio, label, separator), `placement`, `offset`, `matchTriggerWidth`, `minWidth`. Slot: default (the trigger). Event: `select`. | `overlays/dropdown-menu.vue` |
|
|
204
205
|
| `ContextMenu` | Menu on right click of the wrapped area. | Model: `v-model:open`. Props: `items` (same as `DropdownMenu`), `disabled`. Slot: default (the area). Event: `select`. | `overlays/context-menu.vue` |
|
|
205
206
|
| `Popover` | Floating panel with any content (a form, filters) opened by its trigger. Use `DropdownMenu` for a list of actions. | Model: `v-model:open`. Props: `placement`, `offset`, `arrow`, `label`, `initialFocus`. Slots: default (the trigger), `content`. | `overlays/popover.vue` |
|
|
206
207
|
| `HoverCard` | Rich preview on hover or focus (user card, link preview). Use `Tooltip` for plain text. | Model: `v-model:open`. Props: `placement`, `openDelay`, `closeDelay`, `arrow`, `disabled`. Slots: default (trigger), `content`. | `overlays/hover-card.vue` |
|
|
@@ -268,29 +269,29 @@ Mount `OverlayHost` once for the imperative hooks (see [Composables](#composable
|
|
|
268
269
|
|
|
269
270
|
Templates combine core parts into whole pages and layouts. Start from them for new pages.
|
|
270
271
|
|
|
271
|
-
| Component | Purpose and when to use it | Main props, models, slots, events
|
|
272
|
-
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
273
|
-
| `DashboardLayout` | Ready app frame: brand, navigation, command search, account menu, settings modal, breadcrumbs, theme switch. Put it in `layouts/default.vue`. | Models: `v-model:collapsed`, `v-model:open`, `v-model:settingsOpen`, `v-model:settingsSection`. Props: `navigation` (`NavItem[]` or `NavSection[]`), `account` (`name`, `email`, `avatar`, `role`, `menu`), `brandName`, `brandIcon`, `brandLogo`, `breadcrumbs`, `search` (true, groups or function), `settingsSections`, `settingsRoute`, `settingsRouteLocation`, `settingsAccountSection`, `settingsResolvePage`, `settingsHideSession`, `variant`, `content` (`page`, `fill`, `centered`, `bleed`; per page with `definePageMeta({ content })` in `k-dashboard`), `fluid`, `fill`, `onSignOut`. Slots: default, `actions`, `brand`, `sidebar-top`, `sidebar`, `sidebar-footer`, `account`, `topbar`, `search-item`, `settings-account-start`, `settings-account-fields`, `settings-section-<id>`, `settings-actions-<id>`, `settings-tabs-<id>`. Event: `accountSelect`.
|
|
274
|
-
| `AuthLayout` | Frame of sign in, sign up and reset password pages: left column with brand, title (or a large breadcrumb), form and footer; aside panel on the right from 960px. | Props: `title`, `description`, `breadcrumbs`, `footer`, `brandName`, `brandIcon`, `brandLogo`, `aside`, `asideTitle`, `asideDescription`, `themeSwitch`. Slots: default, `links`, `footer`, `brand`, `aside`, `corner`.
|
|
275
|
-
| `AuthLogin` | Complete sign in page in two steps (email, then password with a breadcrumb back). Offers to sign in again after `AuthLogout`. | Props: `submit` (`{ email, password }`), `submitError`, `title`, `description`, `emailLabel`, `emailPlaceholder`, `passwordLabel`, `submitLabel`, `stepKey`, `reasonKey`, frame props of `AuthLayout`. Slots: `links` (`{ email, step }`), `footer`, `brand`, `aside`, `corner`.
|
|
276
|
-
| `AuthLogout` | Sign out page: runs `logout()`, remembers the account, reloads the sign in page. Retry on error. | Props: `logout`, `account` (`{ email, name }`), `loginTo`, `reasonKey`, frame props of `AuthLayout`. Slots: `footer`, `brand`, `aside`, `corner`. Helpers: `rememberSignedOutAccount`, `takeSignedOutAccount`, `SIGNED_OUT_REASON`.
|
|
277
|
-
| `ListPage` | Whole list page: header, search, filters, table, pagination, bulk actions, loading, empty, no results and error states. Client or server mode (`total`). | Models: `page`, `pageSize`, `search`, `filter`, `sort`, `selected`. Props: `title`, `rows`, `columns`, `rowKey`, `rowTo`, `selectable`, `loading`, `error`, `total`, `paginate`, `searchable`, `searchKeys`, `filters`, `filterKey`, `filterMultiple`, `emptyTitle`. Slots: `actions`, `toolbar`, `toolbar-end`, `bulk`, `empty`, `empty-actions`, `no-results`, `error`, `cell-<key>`, `table`. Events: `retry`, `clear`, `rowClick`.
|
|
278
|
-
| `DetailPage` | Record page: back link, title, status, actions, tabs, main column and aside with description lists. | Model: `v-model:tab`. Props: `title`, `backTo`, `backLabel`, `status` (`label`, `tone`, `dot`), `tabs`, `sections` (`title`, `items`), `loading`, `error`. Slots: default, `actions`, `badge`, `meta`, `aside`, `aside-before`, `panel-<value>`.
|
|
279
|
-
| `FormDrawer` | Drawer with a form: `Form` around the body, footer with delete (left), cancel and submit, a discard confirmation on close when the form is dirty, `SkeletonForm` while `loading`. | Models: `v-model:open`, `v-model:tab`. Props: `title`, `description`, `side`, `size`, `fill` (full height body), `tabs` (`FormDrawerTab`: `fields` gives the error dot and opens the tab on a failed submit, `fill: true` makes the drawer `fill` while the tab is active), `tabRoute` (keeps the tab in the hash under this key), `trail`, `backLabel`, `form`, `loading`, `readonly` (also disables every field of the body, your own `Form` in the slot too), `creating` (submit says Create, no dirty needed), `requireDirty`, `deletable`, `deleteDisabled`, `deleteHint`, `submitLabel`, `cancelLabel`, `deleteLabel`, `guard`, `guardTitle`, `guardMessage` (the leave guard of the drawer: close, cancel, trail navigation), `beforeClose`, `onCancel`. `deleteHint` is a tooltip of the delete button, and the reason when `deleteDisabled`. Slots: default (`{ tab }`), `actions`, `title-trailing`, `skeleton`, `footer`. Events: `delete`, `submitted`, `navigate`, `afterLeave`. Exposes `confirmDiscard()`, `close()`.
|
|
280
|
-
| `FormModal` | Modal with a form, like `FormDrawer`: `Form` around the body, footer with delete (left), cancel and submit, the leave guard on close, `SkeletonForm` while `loading`, `readonly`. | Model: `v-model:open`. Props: `title`, `description`, `label`, `size`, `sheet`, `width`, `fill`, `dismissible`, `form`, `nested` (the form is a `div`: a modal opened from a field of another form), `loading`, `readonly`, `creating`, `requireDirty`, `deletable`, `deleteDisabled`, `deleteHint`, `submitLabel`, `cancelLabel`, `deleteLabel`, `guard`, `guardTitle`, `guardMessage`, `beforeClose`, `onCancel`. Slots: default, `actions`, `title-trailing`, `skeleton`, `footer` (`{ submit, cancel }`). Events: `delete`, `submitted`, `open`, `close`, `afterLeave`. Exposes `submit()`, `confirmDiscard()`, `close()`.
|
|
281
|
-
| `FormPage` | Form page: header, cards in a `Form`, sticky submit and cancel footer, dirty guard. | Props: `title`, `backTo`, `form` (from `useForm`), `dirty`, `saving`, `guard`, `requireDirty`, `submitLabel`, `cancelLabel`, `cancelTo`, `width`, `sticky`. Slots: default, `actions`, `footer`, `status`. Events: `submit`, `submitted`, `invalid`, `reset`, `cancel`.
|
|
282
|
-
| `DashboardPage` | Overview page: header, stat grid, content grid. | Props: `title`, `eyebrow`, `description`, `stats` (`PageStat[]`), `statsColumns`, `columns`, `loading`. Slots: default, `actions`, `stats`, `sparkline`, `before`, `after`, `eyebrow`.
|
|
283
|
-
| `SettingsPage` | Settings as a page: section nav, panels, floating save bar when `dirty`. | Model: `v-model:section`. Props: `title`, `sections` (`value`, `label`, `icon`, `to`), `dirty`, `saving`, `saveBar`, `form`. Slots: `section-<value>`, `actions`, `nav-footer`. Events: `save`, `discard`.
|
|
284
|
-
| `SettingsSection` | Card of one settings section with a save footer. | Props: `title`, `description`, `icon`, `hint`, `saveable`, `saving`, `saveDisabled`, `saveLabel`, `form`. Slots: default, `actions`, `footer`, `hint`. Event: `save`.
|
|
285
|
-
| `SettingsGroup` | Block with label, description and actions inside a settings section. | Props: `label`, `description`, `level`, `row`. Slots: default, `label`, `description`, `actions`.
|
|
286
|
-
| `SettingsModal` | Settings dialog with nav, built-in account and appearance sections, your own sections and subpages. A subpage title is a one line trail. | Models: `v-model:open`, `v-model:section`, `v-model:pages`. Props: `sections` (`id`, `label`, `icon`, `group`, `badge`, `to`), `account`, `presets`, `title`, `onSignOut`, `hideSession`, `beforeClose`, `route` (sync with `?settings=<section>/<page>`), `routeLocation` (`'hash'`: `#settings/<section>/<page>`), `accountSection` (id with the built-in account content, default `account`), `resolvePage(section, id, parents)`, `guard`, `guardTitle`, `guardMessage` (back, breadcrumb, another section, close and a route change of the modal ask before discarding a dirty `Form` of the section). Slot props: `section`, `close`, `page`, `pages`, `openPage(page)`, `back()`, `goTo(depth)` (the last three resolve `false` when the user keeps editing), `confirmLeave()`. Slots: `section-<id>`, `actions-<id>` (right of the header row, also on a subpage), `tabs-<id>` (tabs at the bottom of the header, like a drawer; the strip shows only when the slot renders content), `account-start` (above the profile card), `account-fields`.
|
|
287
|
-
| `AppearanceSettings` | Theme (light, dark, system) and preset cards. Used by `SettingsModal`. Use alone in a settings page. | Props: `presets` (list or false), `themes`, `level`.
|
|
288
|
-
| `SaveBar` | Floating bar with save and discard for unsaved changes. | Props: `visible`, `saving`, `message`, `saveLabel`, `discardLabel`, `form`. Slots: default, `actions`. Events: `save`, `discard`.
|
|
289
|
-
| `EmptyPage` | First run screen with illustration, actions and onboarding steps. | Props: `title`, `description`, `icon`, `actionLabel`, `actionTo`, `onAction`, `actionIcon`, `secondaryLabel`, `secondaryTo`, `secondaryHref`, `onSecondary`, `steps` (`title`, `description`, `done`, `to`), `fill`. Slots: default, `illustration`, `title`, `description`, `actions`.
|
|
290
|
-
| `ErrorPage` | Error screen. Reads a Nuxt `error`. Use it in `app/error.vue`. | Props: `error`, `statusCode`, `title`, `message`, `homeTo`, `homeLabel`, `retryLabel`, `brandName`, `fill`, `onHome`, `onRetry`. Slots: default, `title`, `message`, `actions`, `brand`.
|
|
291
|
-
| `NotFoundPage` | 404 screen. | Props: `title`, `message`, `homeTo`, `homeLabel`, `backLabel`, `brandName`, `fill`, `onHome`. Slots: default, `actions`, `brand`.
|
|
292
|
-
| `Brand` | Logo and name block (image URL, inline SVG or component). | Props: `name`, `subtitle`, `icon`, `logo`, `to`, `size`, `accent`, `hideText`, `showName`. Slots: default, `logo`, `mark`, `subtitle`.
|
|
293
|
-
| `AccountMenu` | Account button with avatar, name and a dropdown menu. Used by `DashboardLayout`. | Props: `name`, `email`, `avatar`, `menu` (menu items), `placement`, `icon`. Event: `select`.
|
|
272
|
+
| Component | Purpose and when to use it | Main props, models, slots, events | Playground |
|
|
273
|
+
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- |
|
|
274
|
+
| `DashboardLayout` | Ready app frame: brand, navigation, command search, account menu, settings modal, breadcrumbs, theme switch. Put it in `layouts/default.vue`. | Models: `v-model:collapsed`, `v-model:open`, `v-model:settingsOpen`, `v-model:settingsSection`. Props: `navigation` (`NavItem[]` or `NavSection[]`), `account` (`name`, `email`, `avatar`, `role`, `menu`), `brandName`, `brandIcon`, `brandLogo`, `breadcrumbs`, `search` (true, groups or function), `settingsSections`, `settingsRoute`, `settingsRouteLocation`, `settingsAccountSection`, `settingsResolvePage`, `settingsHideSession`, `variant`, `content` (`page`, `fill`, `centered`, `bleed`; per page with `definePageMeta({ content })` in `k-dashboard`), `fluid`, `fill`, `onSignOut`. Slots: default, `actions`, `brand`, `sidebar-top`, `sidebar`, `sidebar-footer`, `account`, `topbar`, `search-item`, `settings-account-start`, `settings-account-fields`, `settings-section-<id>`, `settings-actions-<id>`, `settings-tabs-<id>`. Event: `accountSelect`. | `templates/dashboard-layout.vue` |
|
|
275
|
+
| `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` |
|
|
276
|
+
| `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` |
|
|
277
|
+
| `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` |
|
|
278
|
+
| `ListPage` | Whole list page: header, search, filters, table, pagination, bulk actions, loading, empty, no results and error states. Client or server mode (`total`). | Models: `page`, `pageSize`, `search`, `filter`, `sort`, `selected`. Props: `title`, `rows`, `columns`, `rowKey`, `rowTo`, `selectable`, `loading`, `error`, `total`, `paginate`, `searchable`, `searchKeys`, `filters`, `filterKey`, `filterMultiple`, `emptyTitle`. Slots: `actions`, `toolbar`, `toolbar-end`, `bulk`, `empty`, `empty-actions`, `no-results`, `error`, `cell-<key>`, `table`. Events: `retry`, `clear`, `rowClick`. | `templates/list-page.vue` |
|
|
279
|
+
| `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` |
|
|
280
|
+
| `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` |
|
|
281
|
+
| `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` |
|
|
282
|
+
| `FormPage` | Form page: header, cards in a `Form`, sticky submit and cancel footer, dirty guard. | Props: `title`, `backTo`, `form` (from `useForm`), `dirty`, `saving`, `guard`, `requireDirty`, `submitLabel`, `cancelLabel`, `cancelTo`, `width`, `sticky`. Slots: default, `actions`, `footer`, `status`. Events: `submit`, `submitted`, `invalid`, `reset`, `cancel`. | `templates/form-page.vue` |
|
|
283
|
+
| `DashboardPage` | Overview page: header, stat grid, content grid. | Props: `title`, `eyebrow`, `description`, `stats` (`PageStat[]`), `statsColumns`, `columns`, `loading`. Slots: default, `actions`, `stats`, `sparkline`, `before`, `after`, `eyebrow`. | `templates/dashboard-page.vue` |
|
|
284
|
+
| `SettingsPage` | Settings as a page: section nav, panels, floating save bar when `dirty`. | Model: `v-model:section`. Props: `title`, `sections` (`value`, `label`, `icon`, `to`), `dirty`, `saving`, `saveBar`, `form`. Slots: `section-<value>`, `actions`, `nav-footer`. Events: `save`, `discard`. | `templates/settings-page.vue` |
|
|
285
|
+
| `SettingsSection` | Card of one settings section with a save footer. | Props: `title`, `description`, `icon`, `hint`, `saveable`, `saving`, `saveDisabled`, `saveLabel`, `form`. Slots: default, `actions`, `footer`, `hint`. Event: `save`. | `templates/settings-page.vue` |
|
|
286
|
+
| `SettingsGroup` | Block with label, description and actions inside a settings section. | Props: `label`, `description`, `level`, `row`. Slots: default, `label`, `description`, `actions`. | `templates/settings-modal.vue` |
|
|
287
|
+
| `SettingsModal` | Settings dialog with nav, built-in account and appearance sections, your own sections and subpages. A subpage title is a one line trail. | Models: `v-model:open`, `v-model:section`, `v-model:pages`. Props: `sections` (`id`, `label`, `icon`, `group`, `badge`, `to`), `account`, `presets`, `title`, `onSignOut`, `hideSession`, `beforeClose`, `route` (sync with `?settings=<section>/<page>`), `routeLocation` (`'hash'`: `#settings/<section>/<page>`), `accountSection` (id with the built-in account content, default `account`), `resolvePage(section, id, parents)`, `guard`, `guardTitle`, `guardMessage` (back, breadcrumb, another section, close and a route change of the modal ask before discarding a dirty `Form` of the section). Slot props: `section`, `close`, `page`, `pages`, `openPage(page)`, `back()`, `goTo(depth)` (the last three resolve `false` when the user keeps editing), `confirmLeave()`. Slots: `section-<id>`, `actions-<id>` (right of the header row, also on a subpage), `tabs-<id>` (tabs at the bottom of the header, like a drawer; the strip shows only when the slot renders content), `account-start` (above the profile card), `account-fields`. | `templates/settings-modal.vue` |
|
|
288
|
+
| `AppearanceSettings` | Theme (light, dark, system) and preset cards. Used by `SettingsModal`. Use alone in a settings page. | Props: `presets` (list or false), `themes`, `level`. | `presets.vue` (pages root) |
|
|
289
|
+
| `SaveBar` | Floating bar with save and discard for unsaved changes. | Props: `visible`, `saving`, `message`, `saveLabel`, `discardLabel`, `form`. Slots: default, `actions`. Events: `save`, `discard`. | `templates/settings-page.vue` |
|
|
290
|
+
| `EmptyPage` | First run screen with illustration, actions and onboarding steps. | Props: `title`, `description`, `icon`, `actionLabel`, `actionTo`, `onAction`, `actionIcon`, `secondaryLabel`, `secondaryTo`, `secondaryHref`, `onSecondary`, `steps` (`title`, `description`, `done`, `to`), `fill`. Slots: default, `illustration`, `title`, `description`, `actions`. | `templates/empty-page.vue` |
|
|
291
|
+
| `ErrorPage` | Error screen. Reads a Nuxt `error`. Use it in `app/error.vue`. | Props: `error`, `statusCode`, `title`, `message`, `homeTo`, `homeLabel`, `retryLabel`, `brandName`, `fill`, `onHome`, `onRetry`. Slots: default, `title`, `message`, `actions`, `brand`. | `templates/error-page.vue` |
|
|
292
|
+
| `NotFoundPage` | 404 screen. | Props: `title`, `message`, `homeTo`, `homeLabel`, `backLabel`, `brandName`, `fill`, `onHome`. Slots: default, `actions`, `brand`. | `templates/error-page.vue` |
|
|
293
|
+
| `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` |
|
|
294
|
+
| `AccountMenu` | Account button with avatar, name and a dropdown menu. Used by `DashboardLayout`. | Props: `name`, `email`, `avatar`, `menu` (menu items), `placement`, `icon`. Event: `select`. | `templates/dashboard-layout.vue` |
|
|
294
295
|
|
|
295
296
|
Nuxt ready layouts: with `k: { layouts: true }` the module registers the layouts `k-dashboard` and `k-auth`. They read brand, navigation, account and settings from `app.config.ts` (`k` key). `useDashboard()` gives the runtime account, breadcrumbs and badges for `k-dashboard`. See README, section "Nuxt: ready layouts".
|
|
296
297
|
|
|
@@ -298,12 +299,12 @@ Nuxt ready layouts: with `k: { layouts: true }` the module registers the layouts
|
|
|
298
299
|
|
|
299
300
|
Import from `@xleddyl/443-components-vue/grid`. It wraps AG Grid Community.
|
|
300
301
|
|
|
301
|
-
| Component | Purpose and when to use it | Main props, models, slots, events
|
|
302
|
-
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
303
|
-
| `DataGrid` | Big table: virtual scroll, column menu, search, CSV export, selection, server sort and paging, inline editing. For small tables use `Table`. | Models: `v-model:query`, `v-model:page`, `v-model:pageSize`, `v-model:sort` (`{ column, direction }`), `v-model:selected` (row ids, needs `rowIdKey` or `getRowId`; the header checkbox selects all the filtered rows). Template ref methods (`DataGridMethods` type, `useTemplateRef<DataGridMethods<Row>>`): `api`, `getSelectedRows`, `getSelectedIds`, `selectRows`, `selectAllRows`, `deselectAll`, `resetColumns` plus the spreadsheet ones. Props: `rows`, `columns` (AG Grid `ColDef`), `rowIdKey` or `getRowId`, `storageKey` (columns and page size in the preferences store; without `columnMenu` the column visibility always comes from `columns`), `density` (default `normal`), `selectable`, `loading`, `height`, `fill`, `autoHeight`, `toolbar`, `searchable`, `columnMenu` (default on), `exportable` (default on), `pageSizes` (default `[10, 25, 50, 100]`; these four defaults can be set for the whole app with `provideGridConfig` or the Nuxt option `k.grid: { density, columnMenu, exportable, pageSizes }`, a prop still wins), `serverSort`, `pagination`, `serverPagination`, `total`, `filterable`, `editable`, `spreadsheet`, `gridOptions`, `messages`, `filterCount`, `activeFilters` (`{ id, label, value }[]`, removable pills next to the filter button; a click opens the filters). Slots: `actions`, `actions-end` (after the column menu and export buttons), `filters` (`{ close, count }`, hosted in a modal opened by a funnel button next to the search). Events: `filtersReset`, `filterRemove` (id), `rowClick`, `selectionChange`, `sortChange`, `filterChange`, `cellsChange`, `cellsInvalid`, `dirtyChange`, `rangeChange`, `copy`. | `grid/data-grid.vue` |
|
|
304
|
-
| `DataGrid` with `spreadsheet` | Excel-like editing: cell range selection, copy and paste (TSV), fill down and right, clear, undo and redo, dirty cell tracking. Set `rowIdKey` or `getRowId`. | Template ref methods (`GridSpreadsheetMethods`): `getRange`, `getSelectedCells`, `selectRange`, `selectAll`, `setRangeValue`, `copyRange`, `paste`, `fillDown`, `fillRight`, `clearCells`, `clearRange`, `undo`, `redo`, `clearHistory`, `getDirtyCells`, `clearDirty`. The `actions` slot gets the same methods plus `range`, `selectedCellCount`, `dirtyCount`, `canUndo`, `canRedo`. Use `cellsChange` to save edits, `cellsInvalid` for rejected input.
|
|
305
|
-
| `GridToolbar` | Toolbar of `DataGrid` (search, column menu, export). `DataGrid` already renders it. Use it alone only for a custom grid setup. | Props: `api`, `searchable`, `columnMenu`, `exportable`, `exportFileName`, `debounce`, `filterCount`, `activeFilters`. Model: `v-model` (query). Slots: default (actions), `end`, `filters`. Events: `resetColumns`, `filtersReset`, `filterRemove`.
|
|
306
|
-
| Cell renderers | Use as `cellRenderer` in a column definition, with `cellRendererParams`. | `BadgeCell` (`tones`, `colors`, `labels`, `titles` (a record or a function of the value), `defaultTone`, `variant`; array values render one badge each, `max` adds a `+N` badge, `wrap`), `BooleanCell` (`trueLabel`, `falseLabel`), `DateCell` (`locale`, `options`, `relative`), `EmptyCell` (placeholder for empty values), `ImageCell` (`alt`, `rounded`, `fit`: `cover`, `contain` or `natural` (original aspect, height `size`), `size`), `LinkCell` (`href`, `label`, `target`), `ButtonCell` (`onClick`, `label`, `ariaLabel`, `tooltip`, `disabled`, `disabledReason` (functions of value and row; a disabled button ignores clicks and shows the reason in a tooltip), `emptyLabel`, `tone`, `variant`, `icon` (as `Button`, an `xs` button; without them an inline link style button); does not trigger the row click).
|
|
302
|
+
| Component | Purpose and when to use it | Main props, models, slots, events | Playground |
|
|
303
|
+
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
|
|
304
|
+
| `DataGrid` | Big table: virtual scroll, column menu, search, CSV export, selection, server sort and paging, inline editing. For small tables use `Table`. | Models: `v-model:query`, `v-model:page`, `v-model:pageSize`, `v-model:sort` (`{ column, direction }`), `v-model:selected` (row ids, needs `rowIdKey` or `getRowId`; the header checkbox selects all the filtered rows across pages; a row hidden by the search or a filter leaves the selection, `keepHiddenSelected` keeps it; with `serverPagination` the ids of other pages stay, and leave only when `rows` holds the whole `total`). Template ref methods (`DataGridMethods` type, `useTemplateRef<DataGridMethods<Row>>`): `api`, `getSelectedRows`, `getSelectedIds`, `selectRows`, `selectAllRows`, `deselectAll`, `resetColumns` plus the spreadsheet ones. Props: `rows`, `columns` (AG Grid `ColDef`), `rowIdKey` or `getRowId`, `keepHiddenSelected`, `storageKey` (columns and page size in the preferences store; without `columnMenu` the column visibility always comes from `columns`), `density` (default `normal`), `selectable`, `loading`, `height`, `fill`, `autoHeight`, `toolbar`, `searchable`, `columnMenu` (default on), `exportable` (default on), `pageSizes` (default `[10, 25, 50, 100]`; these four defaults can be set for the whole app with `provideGridConfig` or the Nuxt option `k.grid: { density, columnMenu, exportable, pageSizes }`, a prop still wins), `serverSort`, `pagination`, `serverPagination`, `total`, `filterable`, `editable`, `spreadsheet`, `gridOptions`, `messages`, `filterCount`, `activeFilters` (`{ id, label, value }[]`, removable pills next to the filter button; a click opens the filters). Slots: `actions`, `actions-end` (after the column menu and export buttons), `filters` (`{ close, count }`, hosted in a modal opened by a funnel button next to the search). Events: `filtersReset`, `filterRemove` (id), `rowClick`, `selectionChange`, `sortChange`, `filterChange`, `cellsChange`, `cellsInvalid`, `dirtyChange`, `rangeChange`, `copy`. | `grid/data-grid.vue` |
|
|
305
|
+
| `DataGrid` with `spreadsheet` | Excel-like editing: cell range selection, copy and paste (TSV), fill down and right, clear, undo and redo, dirty cell tracking. Set `rowIdKey` or `getRowId`. | Template ref methods (`GridSpreadsheetMethods`): `getRange`, `getSelectedCells`, `selectRange`, `selectAll`, `setRangeValue`, `copyRange`, `paste`, `fillDown`, `fillRight`, `clearCells`, `clearRange`, `undo`, `redo`, `clearHistory`, `getDirtyCells`, `clearDirty`. The `actions` slot gets the same methods plus `range`, `selectedCellCount`, `dirtyCount`, `canUndo`, `canRedo`. Use `cellsChange` to save edits, `cellsInvalid` for rejected input. | `grid/spreadsheet.vue` |
|
|
306
|
+
| `GridToolbar` | Toolbar of `DataGrid` (search, column menu, export). `DataGrid` already renders it. Use it alone only for a custom grid setup. | Props: `api`, `searchable`, `columnMenu`, `exportable`, `exportFileName`, `debounce`, `filterCount`, `activeFilters`. Model: `v-model` (query). Slots: default (actions), `end`, `filters`. Events: `resetColumns`, `filtersReset`, `filterRemove`. | - |
|
|
307
|
+
| Cell renderers | Use as `cellRenderer` in a column definition, with `cellRendererParams`. | `BadgeCell` (`tones`, `colors`, `labels`, `titles` (a record or a function of the value), `defaultTone`, `variant`; array values render one badge each, `max` adds a `+N` badge, `wrap`), `BooleanCell` (`trueLabel`, `falseLabel`), `DateCell` (`locale`, `options`, `relative`), `EmptyCell` (placeholder for empty values), `ImageCell` (`alt`, `rounded`, `fit`: `cover`, `contain` or `natural` (original aspect, height `size`), `size`), `LinkCell` (`href`, `label`, `target`), `ButtonCell` (`onClick`, `label`, `ariaLabel`, `tooltip`, `disabled`, `disabledReason` (functions of value and row; a disabled button ignores clicks and shows the reason in a tooltip), `emptyLabel`, `tone`, `variant`, `icon` (as `Button`, an `xs` button; without them an inline link style button); does not trigger the row click). | `grid/data-grid.vue` |
|
|
307
308
|
|
|
308
309
|
Grid helpers: `registerGridModules`, `registerGridEditorModules`, `registerGridFilterModules`, `registerGridSpreadsheetModules` (register AG Grid modules by hand), `createGridTheme`, `parseTsv`, `formatTsv`.
|
|
309
310
|
|
package/README.md
CHANGED
|
@@ -481,6 +481,7 @@ Composables: `useTheme`, `usePreset`, `useForm`, `useField`, `useFieldControl`,
|
|
|
481
481
|
- An icon-only `Button` (no label: `square`, or only an `icon`) shows its `aria-label` (or `title`) in a `Tooltip` styled tooltip on hover and keyboard focus, after the usual delay. The native `title` stays only until mount, so there is never a double tooltip. Inside a `Tooltip` trigger the button shows none (the outer tooltip wins); `tooltip: false` turns it off.
|
|
482
482
|
- `tooltip="..."` adds a tooltip to any button, also with a label; when it differs from the accessible name it is also the button description.
|
|
483
483
|
- `disabledReason` explains a disabled button. With `disabled` and a reason the button uses `aria-disabled` instead of `disabled`: it stays in the Tab order and receives hover, clicks (and implicit form submission) are ignored, the reason shows as a tooltip and is linked with `aria-describedby`, and before mount the reason is the native `title`. Without a reason a disabled button behaves as before.
|
|
484
|
+
- Menu items of `DropdownMenu` and `ContextMenu` (and every `MenuItems` list: the account menu, `FilterPills` option menus) take `disabledReason` too: with `disabled` the item stays reachable with the arrow keys but cannot be selected, and the reason shows as a tooltip on hover and keyboard focus and is linked with `aria-describedby`. Use it instead of putting the reason in `description`.
|
|
484
485
|
- The same works for `CommandButton` (`CommandItem.disabledReason`, and `iconOnly` shows the label as a tooltip), `Tabs` (`TabItem.title`, also on a disabled tab), `FormDrawer` and `FormModal` (`deleteHint`) and the grid `ButtonCell` (`tooltip`, `disabled`, `disabledReason` params).
|
|
485
486
|
|
|
486
487
|
```vue
|
|
@@ -510,6 +511,7 @@ On your own elements, `paletteClass(color)` gives the class of a palette name an
|
|
|
510
511
|
- `CheckboxGroup` takes `columns` (a number): the options are laid out in a grid with that many equal columns. Unset keeps the `orientation` layout. `variant="filled"` (`CheckboxGroupVariant`, `'default' | 'filled'`, default `'default'`) puts the options in a subtle filled panel, styled by `--k-checkbox-group-background` (`--k-subtle`), `--k-checkbox-group-padding` (0.75rem), `--k-checkbox-group-radius` (`--k-radius-md`) and `--k-checkbox-group-border` (none).
|
|
511
512
|
- `Combobox` with `creatable` takes `createTransform` (`ComboboxCreateTransform`, `(input) => string | null | undefined`) and `createValidate` (`ComboboxCreateValidate`, `(input) => string | true | undefined`). The transform runs on the typed text first: the "Create" option shows its result, and an empty result (or `null`) shows no create option. The validator gets the transformed text when the user picks the create option: a returned string is the error, shown inline through the surrounding `FormField` (`useFieldControl().setControlError`, or a `FieldMessage` under the control and an announcement without a field) with `aria-invalid` on the input, and nothing is created; `true` or nothing accepts it. The error clears when the query changes. Both work with `multiple`, where created values become tags: `<KCombobox v-model="tags" multiple creatable :create-transform="(input) => input.toLowerCase()" :create-validate="(input) => input.length >= 3 || 'Too short'" />`.
|
|
512
513
|
- `Combobox` takes `createActions` (`ComboboxCreateActions`, `(query) => ComboboxCreateAction[]`) to show several create items instead of the single "Create" item. Each action has `id` (the item key is `__create:<id>`), `label`, `icon` (default `plus`) and `run(query)`. The actions show at the end of the list under the same conditions as the create item: a non-empty query after `createTransform`, with no option whose label or value matches it exactly. The function gets that text, and an empty array shows no action. `createValidate` runs before `run`. When `run` returns an option, the combobox remembers it, emits `create` and selects it. When it returns nothing (for example it opens a form for the full record), nothing is selected: the query clears and the list closes (with `multiple`, only the query clears). Errors from `run` are logged. `createActions` replaces `creatable`: `<KCombobox v-model="category" :options="categories" :create-actions="(query) => [{ id: 'quick', label: 'Create here', run: createCategory }, { id: 'form', label: 'Create with details', icon: 'pencil-square', run: openForm }]" />`.
|
|
514
|
+
- `Combobox` with `:searchable="false"` is a plain select that keeps the option dots, icons, descriptions and groups: the control is a `<button>` with `role="combobox"` and `aria-haspopup="listbox"` that shows the selected label (with the color dot or the `icon`), or the placeholder when empty. There is no text to type and no filter. Click, Enter, Space, ArrowDown or ArrowUp open the list, the arrows, Home and End move, Enter or Space select (with `multiple` the list stays open), Escape and Tab close, and typing letters moves to the next option whose label starts with them (typeahead, like a native select). `clearable`, `disabled`, `readonly`, `invalid`, `size`, `icon`, `multiple` and `hideTags` work as usual; `creatable`, `createActions` and the async `search` are ignored. Use it for a short fixed list that needs a color dot or an icon (`PaletteSelect` uses it): `<KCombobox v-model="status" :options="statuses" :searchable="false" />`. The exposed `el` is the input, or the trigger button when not searchable.
|
|
513
515
|
- `Combobox` with `multiple` takes `hideTags`: the selected values are not rendered as tags inside the control (the host shows them elsewhere), the placeholder stays visible and Backspace no longer removes the last value. Selection is still announced through the options. A long tag label is truncated with an ellipsis and the full label (with the option group or description) is in the tag tooltip.
|
|
514
516
|
- `RecordList` keeps each title on one line with an ellipsis; the full title is in its `title` attribute. With a `row-click` listener each row is a navigation item (padding, the hover and press background of a ghost button, no separators, the list bleeds into the inline padding so the text stays aligned). The title of a clickable row is a button: Tab reaches every row, Enter or Space emits `row-click`, the focus ring is drawn around the row and the description is the button description. A click anywhere else in the row emits it too, except on a button, link, input, menu item or tab inside the row and inside an open menu, popover or dialog that the row contains; pressing those does not tint the row. Keep the actions of a row as buttons in `#action`, never as a second clickable area. `rowClickable(item)` returns `false` for the rows that open nothing: they keep the same padding, without the button, hover and pointer.
|
|
515
517
|
- `Fieldset` is a native `fieldset`: `disabled` disables every control inside (also the buttons, not the links) and every `FormField` through the form disabled state. `:disabled="false"` enables a group inside a disabled `Form`. When it becomes disabled while a control inside has focus, the focus moves to the fieldset, never to the page. The legend comes from `legend` or the `#legend` slot.
|
|
@@ -821,17 +823,17 @@ Both take the `AuthLayout` frame props and the `brand`, `corner`, `footer` and `
|
|
|
821
823
|
|
|
822
824
|
### Page templates
|
|
823
825
|
|
|
824
|
-
| Component | What it gives you
|
|
825
|
-
| -------------------------------------------- |
|
|
826
|
-
| `DashboardPage` | PageHeader (`title`, `eyebrow`, `description`, `#actions`), a Stat grid from `stats` (or `#stats`), a content grid (`columns`, default 1 then 3 columns).
|
|
827
|
-
| `ListPage` | Header, toolbar (search with `searchable`, FilterPills from `filters`, `#toolbar`, `#bulk` when rows are selected), Table from `columns`/`rows`, Pagination. Client mode filters (`searchKeys`, `filterKey`), sorts and paginates; pass `total` for server mode. States: `loading` skeleton rows, first run `#empty`, no results with a clear button, `error` with retry. `cell-*` and `header-*` slots go to the Table.
|
|
828
|
-
| `DetailPage` | Back link (`backTo`), title, `status` badge, `#actions`, optional `tabs` (`#panel-<value>`), main column plus an aside with DescriptionList cards from `sections` (or `#aside`). `loading` and `error` states.
|
|
829
|
-
| `FormDrawer` | A `Drawer` with a `Form` (`form` from `useForm`) around the body and a footer: delete on the left (`deletable`, `@delete`, `deleteDisabled`, `deleteHint`), cancel and submit on the right. `creating` changes the submit text to Create and enables it without changes; otherwise it needs a dirty form (`requireDirty`). `readonly` keeps only a Close button and disables every field of the body (see [Forms](#forms)). Every close asks before discarding a dirty form (`guard`, the leave guard of its `Drawer`), then runs `beforeClose`. `deleteHint` is the tooltip of the delete button, and its reason when `deleteDisabled`. `onCancel` replaces the close of the cancel button (back to a parent view), after the same question. `loading` shows a `SkeletonForm` (or `#skeleton`) and keeps the header, the tabs and the footer in place. Pass another `form` to switch the body to a subpage (with `trail`). A tab with `fill: true` (`FormDrawerTab`) makes the drawer `fill` while it is active (a tab with a long table). |
|
|
830
|
-
| `FormModal` | The modal version of `FormDrawer`: a `Modal` with a `Form` around the body, footer with delete (`deletable`, `deleteDisabled`, `deleteHint`), cancel (ghost) and submit (`creating`, `requireDirty`, `submitting` state), the leave guard on close and cancel, `loading` skeleton, `readonly`. `nested` renders the form as a `div`, for a modal opened from a field of another form (its footer submit then calls `submit()`). `@submitted` fires after a successful submit.
|
|
831
|
-
| `FormPage` | Header, your cards inside `Form` (`form` from `useForm`, or a plain `form` emitting `submit`), sticky footer with cancel and submit, unsaved state, dirty guard (`guard`, on by default) through `useDirtyGuard`.
|
|
832
|
-
| `SettingsPage`, `SettingsSection`, `SaveBar` | Section nav (sticky on the left, a scrolling row on narrow screens; items with `to` become route links), `#section-<value>` panels, section cards with a save footer, and a floating save bar while `dirty`.
|
|
833
|
-
| `ErrorPage`, `NotFoundPage` | Status code, title, message (defaults per status code, reads a Nuxt `error`), home, retry (`@retry`) and back actions. `@home` replaces the home link, handy for `clearError`.
|
|
834
|
-
| `EmptyPage` | First run screen: illustration, title, description, primary and secondary actions, onboarding `steps`.
|
|
826
|
+
| Component | What it gives you |
|
|
827
|
+
| -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
828
|
+
| `DashboardPage` | PageHeader (`title`, `eyebrow`, `description`, `#actions`), a Stat grid from `stats` (or `#stats`), a content grid (`columns`, default 1 then 3 columns). |
|
|
829
|
+
| `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. |
|
|
830
|
+
| `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. |
|
|
831
|
+
| `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). |
|
|
832
|
+
| `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. |
|
|
833
|
+
| `FormPage` | Header, your cards inside `Form` (`form` from `useForm`, or a plain `form` emitting `submit`), sticky footer with cancel and submit, unsaved state, dirty guard (`guard`, on by default) through `useDirtyGuard`. |
|
|
834
|
+
| `SettingsPage`, `SettingsSection`, `SaveBar` | Section nav (sticky on the left, a scrolling row on narrow screens; items with `to` become route links), `#section-<value>` panels, section cards with a save footer, and a floating save bar while `dirty`. |
|
|
835
|
+
| `ErrorPage`, `NotFoundPage` | Status code, title, message (defaults per status code, reads a Nuxt `error`), home, retry (`@retry`) and back actions. `@home` replaces the home link, handy for `clearError`. |
|
|
836
|
+
| `EmptyPage` | First run screen: illustration, title, description, primary and secondary actions, onboarding `steps`. |
|
|
835
837
|
|
|
836
838
|
`useDirtyGuard(dirty, options?)` asks before leaving (router navigation through `ConfirmHost`, or the native confirm) and on tab close. Returns `confirmLeave()` and `allowNext()`. It is built on the leave guard, see [Unsaved changes](#unsaved-changes).
|
|
837
839
|
|
|
@@ -982,7 +984,7 @@ Accessibility related props and defaults:
|
|
|
982
984
|
- A column without a visible header (a photo column) keeps a name for the Columns menu with `headerValueGetter: ({ location }) => (location === 'header' ? '' : 'Photo')`: the menu reads the name for the `columnToolPanel` location.
|
|
983
985
|
- `DataGrid` takes `gridOptions` for any AG Grid option it does not wrap (`rowHeight`, `onCellEditingStopped`, `onFilterChanged`, ...). A prop of `DataGrid` wins only when it is set: `getRowId`, `rowSelection` (when `selectable` is off), `autoSizeStrategy` (also `undefined` to turn it off), `tooltipShowDelay`, `overlayNoRowsTemplate` and `overlayLoadingTemplate` from `gridOptions` are used otherwise; `defaultColDef` and `localeText` are merged over the component defaults, and `context` is merged under the cell context. Handlers from both run.
|
|
984
986
|
- `DataGrid` row ids: `getRowId: (params) => string` (wins), `rowIdKey` (a field of the row), or `gridOptions.getRowId`.
|
|
985
|
-
- `DataGrid` `v-model:selected` (`string[]`) is the selected row ids, two way, for `selectable` grids (also `'single'`, at most one id). It needs row ids (`rowIdKey`, `getRowId` or `gridOptions.getRowId`); a dev warning tells you when they are missing. Leave it unbound for an uncontrolled grid. The header checkbox selects all the filtered rows (`selectAll: 'filtered'`): not the rows hidden by the search or the column filters, and not only the current page. A
|
|
987
|
+
- `DataGrid` `v-model:selected` (`string[]`) is the selected row ids, two way, for `selectable` grids (also `'single'`, at most one id). It needs row ids (`rowIdKey`, `getRowId` or `gridOptions.getRowId`); a dev warning tells you when they are missing. Leave it unbound for an uncontrolled grid. The header checkbox selects all the filtered rows (`selectAll: 'filtered'`): not the rows hidden by the search or the column filters, and not only the current page. A row hidden by the toolbar search, a column filter or an external filter leaves the selection: the grid deselects it and drops its id from the model when the filter changes, and an id set in the model for a hidden row is dropped too, so a bulk action never acts on rows the user cannot see. `keepHiddenSelected` keeps the old behavior (a hidden row stays selected). Client pagination keeps the selection across pages. A row that disappears from `rows` is dropped from the model, except while `loading` is set or the rows are empty, so a preselected model survives the first load. With `serverPagination` the ids of rows that are not in the current `rows` stay in the model: the selection survives a page change and a re-fetch, the footer counts the whole model, and the header checkbox only selects the rows of the page. The grid cannot see the other pages, so it drops an id that the server filter excludes only when it knows the whole result: once `loading` is off and `rows` holds every row of `total` (or the result is empty), the ids that are not in `rows` leave the model. Rows of the page hidden by a client column filter leave it as in client mode. To drop the ids of other pages when your own filters change, set the model yourself (for example `selected = []` when the query changes). Ids of rows that are not loaded yet stay out of the grid and are selected when the rows arrive. `selectionChange` still emits the selected rows of the grid.
|
|
986
988
|
- `DataGrid` template ref methods have a type: `DataGridMethods<Row>` (`api`, `getSelectedRows`, `getSelectedIds`, `selectRows(ids)`, `selectAllRows()` for the filtered rows, `deselectAll`, `resetColumns` and the `GridSpreadsheetMethods`; `selectAll` stays the cell range one of the spreadsheet).
|
|
987
989
|
|
|
988
990
|
```ts
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
{
|
|
8
8
|
'is-open': layer.isOpen.value,
|
|
9
9
|
'is-multiple': multiple,
|
|
10
|
+
'is-select': !searchable,
|
|
10
11
|
'is-disabled': control.disabled.value,
|
|
11
12
|
'has-lead': Boolean(icon || leadColor)
|
|
12
13
|
},
|
|
@@ -57,6 +58,7 @@
|
|
|
57
58
|
</span>
|
|
58
59
|
</template>
|
|
59
60
|
<input
|
|
61
|
+
v-if="searchable"
|
|
60
62
|
ref="inputRef"
|
|
61
63
|
:id="control.id.value"
|
|
62
64
|
v-bind="$attrs"
|
|
@@ -88,6 +90,40 @@
|
|
|
88
90
|
@focus="onFocus"
|
|
89
91
|
@blur="onBlur"
|
|
90
92
|
/>
|
|
93
|
+
<button
|
|
94
|
+
v-else
|
|
95
|
+
ref="triggerRef"
|
|
96
|
+
:id="control.id.value"
|
|
97
|
+
:aria-labelledby="
|
|
98
|
+
control.labelledBy.value && !$attrs['aria-label'] ? `${control.labelledBy.value} ${valueId}` : void 0
|
|
99
|
+
"
|
|
100
|
+
v-bind="$attrs"
|
|
101
|
+
:disabled="control.disabled.value || void 0"
|
|
102
|
+
:aria-required="control.required.value ? 'true' : void 0"
|
|
103
|
+
:aria-invalid="invalid ? 'true' : void 0"
|
|
104
|
+
:aria-readonly="readonly ? 'true' : void 0"
|
|
105
|
+
:aria-describedby="joinIds($attrs['aria-describedby'], control.describedBy.value)"
|
|
106
|
+
type="button"
|
|
107
|
+
class="k-combobox-trigger"
|
|
108
|
+
role="combobox"
|
|
109
|
+
aria-haspopup="listbox"
|
|
110
|
+
:aria-expanded="layer.isOpen.value ? 'true' : 'false'"
|
|
111
|
+
:aria-controls="listId"
|
|
112
|
+
:aria-activedescendant="activeId"
|
|
113
|
+
@keydown="onTriggerKeydown"
|
|
114
|
+
@focus="onFocus"
|
|
115
|
+
@blur="onBlur"
|
|
116
|
+
>
|
|
117
|
+
<span
|
|
118
|
+
:id="valueId"
|
|
119
|
+
class="k-combobox-value"
|
|
120
|
+
:class="{ 'is-placeholder': !triggerText && !hiddenText }"
|
|
121
|
+
>
|
|
122
|
+
<template v-if="triggerText">{{ triggerText }}</template>
|
|
123
|
+
<span v-else-if="hiddenText" class="k-visually-hidden">{{ hiddenText }}</span>
|
|
124
|
+
<template v-else>{{ placeholder }}</template>
|
|
125
|
+
</span>
|
|
126
|
+
</button>
|
|
91
127
|
<span class="k-combobox-trail">
|
|
92
128
|
<Spinner v-if="busy" decorative size="xs" class="k-combobox-spinner" />
|
|
93
129
|
<button
|
|
@@ -237,7 +273,7 @@ import {
|
|
|
237
273
|
import { useFieldControl } from "../../composables/useField";
|
|
238
274
|
import { useLocale } from "../../composables/useLocale";
|
|
239
275
|
import { useFloatingLayer } from "../../internal/floating/layer";
|
|
240
|
-
import { nextEnabledIndex } from "../../internal/core/roving";
|
|
276
|
+
import { nextEnabledIndex, useTypeahead } from "../../internal/core/roving";
|
|
241
277
|
import { useAsyncSearch } from "../../internal/core/search";
|
|
242
278
|
import LiveRegion from "../../internal/core/LiveRegion.vue";
|
|
243
279
|
import { useLiveMessage } from "../../internal/core/live";
|
|
@@ -253,6 +289,7 @@ const props = defineProps({
|
|
|
253
289
|
options: { type: Array, required: false, default: () => [] },
|
|
254
290
|
name: { type: String, required: false },
|
|
255
291
|
search: { type: Function, required: false },
|
|
292
|
+
searchable: { type: Boolean, required: false, default: true },
|
|
256
293
|
filter: { type: Function, required: false },
|
|
257
294
|
multiple: { type: Boolean, required: false },
|
|
258
295
|
hideTags: { type: Boolean, required: false },
|
|
@@ -303,10 +340,15 @@ const attrs = useAttrs();
|
|
|
303
340
|
const baseId = useId();
|
|
304
341
|
const listId = `${baseId}-listbox`;
|
|
305
342
|
const panelId = `${baseId}-panel`;
|
|
343
|
+
const valueId = `${baseId}-value`;
|
|
306
344
|
const rootRef = useTemplateRef("rootRef");
|
|
307
345
|
const controlRef = useTemplateRef("controlRef");
|
|
308
346
|
const panelRef = useTemplateRef("panelRef");
|
|
309
347
|
const inputRef = useTemplateRef("inputRef");
|
|
348
|
+
const triggerRef = useTemplateRef("triggerRef");
|
|
349
|
+
const controlEl = computed(
|
|
350
|
+
() => inputRef.value ?? triggerRef.value
|
|
351
|
+
);
|
|
310
352
|
const errorId = `${baseId}-create-error`;
|
|
311
353
|
const createError = ref();
|
|
312
354
|
const editing = ref(false);
|
|
@@ -324,8 +366,9 @@ const control = useFieldControl({
|
|
|
324
366
|
disabled: () => props.disabled,
|
|
325
367
|
required: () => props.required
|
|
326
368
|
});
|
|
369
|
+
const asyncSearch = computed(() => props.searchable ? props.search : void 0);
|
|
327
370
|
const search = useAsyncSearch({
|
|
328
|
-
search: () =>
|
|
371
|
+
search: () => asyncSearch.value,
|
|
329
372
|
onResults: (found, text) => {
|
|
330
373
|
results.value = found;
|
|
331
374
|
searchedOnce.value = true;
|
|
@@ -385,13 +428,17 @@ const inputValue = computed(() => {
|
|
|
385
428
|
const inputPlaceholder = computed(
|
|
386
429
|
() => props.multiple && !props.hideTags && selectedValues.value.length ? void 0 : props.placeholder
|
|
387
430
|
);
|
|
431
|
+
const triggerText = computed(() => props.multiple ? "" : selectedLabel.value);
|
|
432
|
+
const hiddenText = computed(
|
|
433
|
+
() => props.multiple && !props.hideTags ? selectedValues.value.map(labelFor).join(", ") : ""
|
|
434
|
+
);
|
|
388
435
|
const showClear = computed(
|
|
389
436
|
() => props.clearable && interactive.value && selectedValues.value.length > 0
|
|
390
437
|
);
|
|
391
438
|
const activeQuery = computed(() => editing.value ? query.value.trim() : "");
|
|
392
|
-
const sourceOptions = computed(() =>
|
|
439
|
+
const sourceOptions = computed(() => asyncSearch.value ? results.value : props.options);
|
|
393
440
|
const filteredOptions = computed(() => {
|
|
394
|
-
if (
|
|
441
|
+
if (asyncSearch.value) return results.value;
|
|
395
442
|
const needle = normalizeSearch(activeQuery.value);
|
|
396
443
|
if (!needle) return props.options;
|
|
397
444
|
return props.options.filter(
|
|
@@ -502,7 +549,7 @@ function openList() {
|
|
|
502
549
|
if (!interactive.value || layer.isOpen.value) return;
|
|
503
550
|
layer.show();
|
|
504
551
|
initialActive();
|
|
505
|
-
if (
|
|
552
|
+
if (asyncSearch.value && !searchedOnce.value) scheduleSearch(0);
|
|
506
553
|
}
|
|
507
554
|
function closeList() {
|
|
508
555
|
layer.hide();
|
|
@@ -529,6 +576,9 @@ function onBlur(event) {
|
|
|
529
576
|
closeList();
|
|
530
577
|
resetQuery();
|
|
531
578
|
}
|
|
579
|
+
function focusControl() {
|
|
580
|
+
controlEl.value?.focus();
|
|
581
|
+
}
|
|
532
582
|
function onControlMousedown(event) {
|
|
533
583
|
if (!interactive.value) return;
|
|
534
584
|
const target = event.target;
|
|
@@ -536,21 +586,71 @@ function onControlMousedown(event) {
|
|
|
536
586
|
if (!layer.isOpen.value) openList();
|
|
537
587
|
return;
|
|
538
588
|
}
|
|
539
|
-
if (target.closest("button")) {
|
|
589
|
+
if (target.closest("button") && !triggerRef.value?.contains(target)) {
|
|
540
590
|
event.preventDefault();
|
|
541
591
|
return;
|
|
542
592
|
}
|
|
543
593
|
event.preventDefault();
|
|
544
|
-
|
|
594
|
+
focusControl();
|
|
545
595
|
if (layer.isOpen.value) closeList();
|
|
546
596
|
else openList();
|
|
547
597
|
}
|
|
548
598
|
function onToggleClick() {
|
|
549
599
|
if (!interactive.value) return;
|
|
550
|
-
|
|
600
|
+
focusControl();
|
|
551
601
|
if (layer.isOpen.value) closeList();
|
|
552
602
|
else openList();
|
|
553
603
|
}
|
|
604
|
+
const typeahead = useTypeahead();
|
|
605
|
+
function onTypeahead(event) {
|
|
606
|
+
if (event.key.length !== 1 || event.ctrlKey || event.metaKey || event.altKey) return false;
|
|
607
|
+
if (event.key === " " && !typeahead.typing()) return false;
|
|
608
|
+
const { query: text, cycle } = typeahead.type(event.key);
|
|
609
|
+
openList();
|
|
610
|
+
const needle = normalizeSearch(text);
|
|
611
|
+
const list = items.value;
|
|
612
|
+
const start = cycle ? activeIndex.value + 1 : Math.max(activeIndex.value, 0);
|
|
613
|
+
for (let offset = 0; offset < list.length; offset++) {
|
|
614
|
+
const index = (start + offset) % list.length;
|
|
615
|
+
const option = list[index].option;
|
|
616
|
+
if (!option.disabled && normalizeSearch(option.label).startsWith(needle)) {
|
|
617
|
+
activeIndex.value = index;
|
|
618
|
+
break;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
return true;
|
|
622
|
+
}
|
|
623
|
+
function openAt(index) {
|
|
624
|
+
openList();
|
|
625
|
+
if (index >= 0) activeIndex.value = index;
|
|
626
|
+
}
|
|
627
|
+
function onTriggerKeydown(event) {
|
|
628
|
+
if (!interactive.value) return;
|
|
629
|
+
if (onTypeahead(event)) {
|
|
630
|
+
event.preventDefault();
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
const open = layer.isOpen.value;
|
|
634
|
+
const last = () => firstEnabled(items.value.length - 1, -1);
|
|
635
|
+
if (!open && (event.key === "Enter" || event.key === " " || event.key === "ArrowDown")) {
|
|
636
|
+
event.preventDefault();
|
|
637
|
+
openList();
|
|
638
|
+
if (!event.altKey && activeIndex.value < 0) activeIndex.value = firstEnabled();
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
if (!open && (event.key === "Home" || event.key === "End")) {
|
|
642
|
+
event.preventDefault();
|
|
643
|
+
openAt(event.key === "Home" ? firstEnabled() : last());
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
if (open && event.key === " ") {
|
|
647
|
+
event.preventDefault();
|
|
648
|
+
const item = items.value[activeIndex.value];
|
|
649
|
+
if (item) void choose(item);
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
onKeydown(event);
|
|
653
|
+
}
|
|
554
654
|
function onKeydown(event) {
|
|
555
655
|
if (!interactive.value) return;
|
|
556
656
|
const open = layer.isOpen.value;
|
|
@@ -666,7 +766,7 @@ function select(option) {
|
|
|
666
766
|
}
|
|
667
767
|
if (editing.value && query.value) {
|
|
668
768
|
resetQuery();
|
|
669
|
-
if (
|
|
769
|
+
if (asyncSearch.value) scheduleSearch(0);
|
|
670
770
|
nextTick(() => {
|
|
671
771
|
activeIndex.value = items.value.findIndex((item) => keyOf(item.option.value) === key);
|
|
672
772
|
});
|
|
@@ -675,17 +775,17 @@ function select(option) {
|
|
|
675
775
|
function dismissQuery() {
|
|
676
776
|
resetQuery();
|
|
677
777
|
if (!props.multiple) closeList();
|
|
678
|
-
else if (
|
|
778
|
+
else if (asyncSearch.value) scheduleSearch(0);
|
|
679
779
|
}
|
|
680
780
|
function remove(value) {
|
|
681
781
|
const key = keyOf(value);
|
|
682
782
|
model.value = selectedValues.value.filter((entry) => keyOf(entry) !== key);
|
|
683
|
-
|
|
783
|
+
focusControl();
|
|
684
784
|
}
|
|
685
785
|
function clear() {
|
|
686
786
|
model.value = props.multiple ? [] : null;
|
|
687
787
|
resetQuery();
|
|
688
|
-
|
|
788
|
+
focusControl();
|
|
689
789
|
}
|
|
690
790
|
function scheduleSearch(delay) {
|
|
691
791
|
const text = activeQuery.value;
|
|
@@ -717,9 +817,9 @@ watch(
|
|
|
717
817
|
{ immediate: true }
|
|
718
818
|
);
|
|
719
819
|
defineExpose({
|
|
720
|
-
focus:
|
|
820
|
+
focus: focusControl,
|
|
721
821
|
open: openList,
|
|
722
822
|
close: closeList,
|
|
723
|
-
el:
|
|
823
|
+
el: controlEl
|
|
724
824
|
});
|
|
725
825
|
</script>
|
|
@@ -6,6 +6,7 @@ declare const __VLS_export: <T extends string | number, M extends T | T[] | null
|
|
|
6
6
|
options?: ComboboxOption<T>[];
|
|
7
7
|
name?: string;
|
|
8
8
|
search?: ComboboxSearch<T>;
|
|
9
|
+
searchable?: boolean;
|
|
9
10
|
filter?: (option: ComboboxOption<T>, query: string) => boolean;
|
|
10
11
|
multiple?: boolean;
|
|
11
12
|
hideTags?: boolean;
|
|
@@ -45,14 +46,14 @@ declare const __VLS_export: <T extends string | number, M extends T | T[] | null
|
|
|
45
46
|
onOpen?: (() => any) | undefined;
|
|
46
47
|
"onUpdate:modelValue"?: ((value: M | undefined) => any) | undefined;
|
|
47
48
|
"onUpdate:query"?: ((value: string) => any) | undefined;
|
|
48
|
-
} & Partial<import("vue").InputHTMLAttributes & import("vue").ReservedProps>> & (typeof globalThis extends {
|
|
49
|
+
} & Partial<import("vue").InputHTMLAttributes & import("vue").ReservedProps & import("vue").ButtonHTMLAttributes>> & (typeof globalThis extends {
|
|
49
50
|
__VLS_PROPS_FALLBACK: infer P;
|
|
50
51
|
} ? P : {});
|
|
51
52
|
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
52
|
-
focus: () => void
|
|
53
|
+
focus: () => void;
|
|
53
54
|
open: () => void;
|
|
54
55
|
close: () => void;
|
|
55
|
-
el:
|
|
56
|
+
el: import("vue").ComputedRef<HTMLInputElement | HTMLButtonElement | null>;
|
|
56
57
|
}>) => void;
|
|
57
58
|
attrs: any;
|
|
58
59
|
slots: {
|
|
@@ -139,7 +139,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
139
139
|
color?: string | undefined | undefined;
|
|
140
140
|
height?: (string | number) | undefined;
|
|
141
141
|
lang?: string | undefined | undefined;
|
|
142
|
-
type?:
|
|
142
|
+
type?: "submit" | "button" | "reset" | undefined;
|
|
143
143
|
width?: (string | number) | undefined;
|
|
144
144
|
tabindex?: (string | number) | undefined;
|
|
145
145
|
'aria-activedescendant'?: string | undefined | undefined;
|
|
@@ -256,6 +256,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
256
256
|
onCreate?: ((option: ComboboxOption<PaletteOptionValue>) => any) | undefined;
|
|
257
257
|
onOpen?: (() => any) | undefined;
|
|
258
258
|
"onUpdate:query"?: ((value: string) => any) | undefined;
|
|
259
|
+
searchable?: boolean | undefined;
|
|
259
260
|
hideTags?: boolean | undefined;
|
|
260
261
|
creatable?: boolean | import("./types").ComboboxCreate<PaletteOptionValue> | undefined;
|
|
261
262
|
createActions?: import("./types").ComboboxCreateActions<PaletteOptionValue> | undefined;
|
|
@@ -408,7 +409,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
408
409
|
color?: string | undefined | undefined;
|
|
409
410
|
height?: (string | number) | undefined;
|
|
410
411
|
lang?: string | undefined | undefined;
|
|
411
|
-
type?:
|
|
412
|
+
type?: "submit" | "button" | "reset" | undefined;
|
|
412
413
|
width?: (string | number) | undefined;
|
|
413
414
|
tabindex?: (string | number) | undefined;
|
|
414
415
|
'aria-activedescendant'?: string | undefined | undefined;
|
|
@@ -525,6 +526,7 @@ declare const __VLS_export: import("vue").DefineComponent<{
|
|
|
525
526
|
onCreate?: ((option: ComboboxOption<PaletteOptionValue>) => any) | undefined;
|
|
526
527
|
onOpen?: (() => any) | undefined;
|
|
527
528
|
"onUpdate:query"?: ((value: string) => any) | undefined;
|
|
529
|
+
searchable?: boolean | undefined;
|
|
528
530
|
hideTags?: boolean | undefined;
|
|
529
531
|
creatable?: boolean | import("./types").ComboboxCreate<PaletteOptionValue> | undefined;
|
|
530
532
|
createActions?: import("./types").ComboboxCreateActions<PaletteOptionValue> | undefined;
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
v-if="deletable && !readonly"
|
|
52
52
|
variant="ghost"
|
|
53
53
|
tone="danger"
|
|
54
|
-
icon="
|
|
54
|
+
:icon="deleteIcon"
|
|
55
55
|
size="sm"
|
|
56
56
|
:disabled="loading || isSaving || deleteDisabled"
|
|
57
57
|
:disabled-reason="deleteDisabled ? deleteHint : void 0"
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
type="submit"
|
|
76
76
|
:form="formId"
|
|
77
77
|
size="sm"
|
|
78
|
+
:icon="submitIcon"
|
|
78
79
|
:loading="isSaving"
|
|
79
80
|
:disabled="submitDisabled"
|
|
80
81
|
>
|
|
@@ -123,6 +124,8 @@ const props = defineProps({
|
|
|
123
124
|
submitLabel: { type: String, required: false },
|
|
124
125
|
cancelLabel: { type: String, required: false },
|
|
125
126
|
deleteLabel: { type: String, required: false },
|
|
127
|
+
submitIcon: { type: null, required: false },
|
|
128
|
+
deleteIcon: { type: null, required: false, default: "trash" },
|
|
126
129
|
guard: { type: Boolean, required: false, default: true },
|
|
127
130
|
guardTitle: { type: String, required: false },
|
|
128
131
|
guardMessage: { type: String, required: false },
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FormSchema, UseFormReturn } from '../../composables/useForm';
|
|
2
|
+
import type { IconName } from '../../composables/useIcons';
|
|
2
3
|
import type { TabItem } from '../layout/types';
|
|
3
4
|
import type { FormDrawerTab } from './types';
|
|
4
5
|
import type { DialogBeforeClose, DrawerSide, DrawerSize } from '../overlays/types';
|
|
@@ -25,6 +26,8 @@ declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props
|
|
|
25
26
|
submitLabel?: string;
|
|
26
27
|
cancelLabel?: string;
|
|
27
28
|
deleteLabel?: string;
|
|
29
|
+
submitIcon?: IconName;
|
|
30
|
+
deleteIcon?: IconName;
|
|
28
31
|
guard?: boolean;
|
|
29
32
|
guardTitle?: string;
|
|
30
33
|
guardMessage?: string;
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
v-if="deletable && !readonly"
|
|
50
50
|
variant="ghost"
|
|
51
51
|
tone="danger"
|
|
52
|
-
icon="
|
|
52
|
+
:icon="deleteIcon"
|
|
53
53
|
size="sm"
|
|
54
54
|
:disabled="loading || isSaving || deleteDisabled"
|
|
55
55
|
:disabled-reason="deleteDisabled ? deleteHint : void 0"
|
|
@@ -73,6 +73,7 @@
|
|
|
73
73
|
:type="nested ? 'button' : 'submit'"
|
|
74
74
|
:form="nested ? void 0 : formId"
|
|
75
75
|
size="sm"
|
|
76
|
+
:icon="submitIcon"
|
|
76
77
|
:loading="isSaving"
|
|
77
78
|
:disabled="submitDisabled"
|
|
78
79
|
@click="nested ? submit() : void 0"
|
|
@@ -115,6 +116,8 @@ const props = defineProps({
|
|
|
115
116
|
submitLabel: { type: String, required: false },
|
|
116
117
|
cancelLabel: { type: String, required: false },
|
|
117
118
|
deleteLabel: { type: String, required: false },
|
|
119
|
+
submitIcon: { type: null, required: false },
|
|
120
|
+
deleteIcon: { type: null, required: false, default: "trash" },
|
|
118
121
|
guard: { type: Boolean, required: false, default: true },
|
|
119
122
|
guardTitle: { type: String, required: false },
|
|
120
123
|
guardMessage: { type: String, required: false },
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { FormSchema, UseFormReturn } from '../../composables/useForm';
|
|
2
|
+
import type { IconName } from '../../composables/useIcons';
|
|
2
3
|
import type { DialogBeforeClose, ModalSize } from '../overlays/types';
|
|
3
4
|
declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
5
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
|
|
@@ -22,6 +23,8 @@ declare const __VLS_export: <S extends FormSchema, V extends object>(__VLS_props
|
|
|
22
23
|
submitLabel?: string;
|
|
23
24
|
cancelLabel?: string;
|
|
24
25
|
deleteLabel?: string;
|
|
26
|
+
submitIcon?: IconName;
|
|
27
|
+
deleteIcon?: IconName;
|
|
25
28
|
guard?: boolean;
|
|
26
29
|
guardTitle?: string;
|
|
27
30
|
guardMessage?: string;
|
package/dist/grid/DataGrid.vue
CHANGED
|
@@ -157,6 +157,7 @@ const props = defineProps({
|
|
|
157
157
|
storageKey: { type: String, required: false },
|
|
158
158
|
density: { type: String, required: false, default: void 0 },
|
|
159
159
|
selectable: { type: [Boolean, String], required: false, default: false },
|
|
160
|
+
keepHiddenSelected: { type: Boolean, required: false },
|
|
160
161
|
loading: { type: Boolean, required: false },
|
|
161
162
|
height: { type: String, required: false, default: "28rem" },
|
|
162
163
|
fill: { type: Boolean, required: false },
|
|
@@ -480,6 +481,7 @@ function onModelUpdated() {
|
|
|
480
481
|
syncPagination();
|
|
481
482
|
const current = api.value;
|
|
482
483
|
if (!current) return;
|
|
484
|
+
deselectHidden();
|
|
483
485
|
const count = props.serverPagination ? props.total : current.getDisplayedRowCount();
|
|
484
486
|
if (props.loading) return;
|
|
485
487
|
if (announcedCount !== null && announcedCount !== count)
|
|
@@ -512,6 +514,30 @@ function sameIds(a, b) {
|
|
|
512
514
|
const lookup = new Set(a);
|
|
513
515
|
return b.every((id) => lookup.has(id));
|
|
514
516
|
}
|
|
517
|
+
function hiddenNodeIds(current) {
|
|
518
|
+
const hidden = /* @__PURE__ */ new Set();
|
|
519
|
+
if (props.keepHiddenSelected || !current.isAnyFilterPresent()) return hidden;
|
|
520
|
+
const visible = /* @__PURE__ */ new Set();
|
|
521
|
+
current.forEachNodeAfterFilter((node) => {
|
|
522
|
+
if (node.id !== void 0) visible.add(node.id);
|
|
523
|
+
});
|
|
524
|
+
current.forEachNode((node) => {
|
|
525
|
+
if (node.id !== void 0 && !visible.has(node.id)) hidden.add(node.id);
|
|
526
|
+
});
|
|
527
|
+
return hidden;
|
|
528
|
+
}
|
|
529
|
+
let serverRowsReceived = false;
|
|
530
|
+
watch(
|
|
531
|
+
() => [props.rows, props.loading],
|
|
532
|
+
([, loading]) => {
|
|
533
|
+
if (!loading) serverRowsReceived = true;
|
|
534
|
+
}
|
|
535
|
+
);
|
|
536
|
+
function serverResultLoaded() {
|
|
537
|
+
if (!props.serverPagination || props.loading || props.keepHiddenSelected) return false;
|
|
538
|
+
if (props.total > 0) return props.rows.length >= props.total;
|
|
539
|
+
return serverRowsReceived && props.rows.length === 0;
|
|
540
|
+
}
|
|
515
541
|
function readNodeIds(current) {
|
|
516
542
|
const present = /* @__PURE__ */ new Set();
|
|
517
543
|
current.forEachNode((node) => {
|
|
@@ -522,7 +548,7 @@ function readNodeIds(current) {
|
|
|
522
548
|
function mergedSelection(current) {
|
|
523
549
|
const gridIds = current.getSelectedNodes().flatMap((node) => node.id ? [node.id] : []);
|
|
524
550
|
const model = selected.value ?? [];
|
|
525
|
-
const keepUnknown = props.serverPagination || props.loading;
|
|
551
|
+
const keepUnknown = (props.serverPagination || props.loading) && !serverResultLoaded();
|
|
526
552
|
if (!keepUnknown) return gridIds;
|
|
527
553
|
const present = readNodeIds(current);
|
|
528
554
|
const kept = model.filter((id) => !present.has(id));
|
|
@@ -532,13 +558,14 @@ function applyIds(ids) {
|
|
|
532
558
|
const current = api.value;
|
|
533
559
|
if (!current || !props.selectable) return;
|
|
534
560
|
const wanted = new Set(ids);
|
|
561
|
+
const hidden = hiddenNodeIds(current);
|
|
535
562
|
const single = props.selectable === "single";
|
|
536
563
|
const select = [];
|
|
537
564
|
const deselect = [];
|
|
538
565
|
let chosen = false;
|
|
539
566
|
current.forEachNode((node) => {
|
|
540
567
|
const id = node.id;
|
|
541
|
-
const should = id !== void 0 && wanted.has(id) && !(single && chosen);
|
|
568
|
+
const should = id !== void 0 && wanted.has(id) && !hidden.has(id) && !(single && chosen);
|
|
542
569
|
if (should) chosen = true;
|
|
543
570
|
if (Boolean(node.isSelected()) === should) return;
|
|
544
571
|
(should ? select : deselect).push(node);
|
|
@@ -548,20 +575,33 @@ function applyIds(ids) {
|
|
|
548
575
|
}
|
|
549
576
|
function applySelection() {
|
|
550
577
|
if (!isSelectionBound() || !selected.value) return;
|
|
551
|
-
|
|
578
|
+
const current = api.value;
|
|
579
|
+
const hidden = current ? hiddenNodeIds(current) : null;
|
|
580
|
+
const ids = hidden?.size ? selected.value.filter((id) => !hidden.has(id)) : selected.value;
|
|
581
|
+
if (ids.length !== selected.value.length) selected.value = ids;
|
|
582
|
+
applyIds(ids);
|
|
552
583
|
}
|
|
553
584
|
function reconcileSelection() {
|
|
554
585
|
const current = api.value;
|
|
555
586
|
if (!current || !isSelectionBound() || !selected.value) return;
|
|
556
|
-
|
|
587
|
+
const complete = !props.serverPagination && !props.loading || serverResultLoaded();
|
|
588
|
+
if (complete) {
|
|
557
589
|
const present = readNodeIds(current);
|
|
558
|
-
if (present.size) {
|
|
590
|
+
if (present.size || props.serverPagination) {
|
|
559
591
|
const pruned = selected.value.filter((id) => present.has(id));
|
|
560
592
|
if (pruned.length !== selected.value.length) selected.value = pruned;
|
|
561
593
|
}
|
|
562
594
|
}
|
|
563
595
|
applySelection();
|
|
564
596
|
}
|
|
597
|
+
function deselectHidden() {
|
|
598
|
+
const current = api.value;
|
|
599
|
+
if (!current || !props.selectable) return;
|
|
600
|
+
const hidden = hiddenNodeIds(current);
|
|
601
|
+
if (!hidden.size) return;
|
|
602
|
+
const nodes = current.getSelectedNodes().filter((node) => node.id !== void 0 && hidden.has(node.id));
|
|
603
|
+
if (nodes.length) current.setNodesSelected({ nodes, newValue: false });
|
|
604
|
+
}
|
|
565
605
|
function writeSelection(current) {
|
|
566
606
|
if (!isSelectionBound()) return;
|
|
567
607
|
const next = mergedSelection(current);
|
|
@@ -582,6 +622,12 @@ watch(
|
|
|
582
622
|
}
|
|
583
623
|
);
|
|
584
624
|
watch(rowIdGetter, checkSelectionRowIds);
|
|
625
|
+
watch(
|
|
626
|
+
() => props.keepHiddenSelected,
|
|
627
|
+
(keep) => {
|
|
628
|
+
if (!keep) deselectHidden();
|
|
629
|
+
}
|
|
630
|
+
);
|
|
585
631
|
function onSortChanged(event) {
|
|
586
632
|
const change = readSort(event.api);
|
|
587
633
|
if (!sameSort(change, sort.value)) sort.value = change;
|
|
@@ -428,8 +428,8 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
428
428
|
onFiltersReset?: (() => any) | undefined;
|
|
429
429
|
onFilterRemove?: ((id: string) => any) | undefined;
|
|
430
430
|
}>, {
|
|
431
|
-
debounce: number;
|
|
432
431
|
searchable: boolean;
|
|
432
|
+
debounce: number;
|
|
433
433
|
columnMenu: boolean;
|
|
434
434
|
exportable: boolean;
|
|
435
435
|
exportFileName: string;
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
:aria-expanded="expanded === keyOf(groupIndex, entryIndex) ? 'true' : 'false'"
|
|
41
41
|
:aria-controls="`${menuId}-sub-${groupIndex}-${entryIndex}`"
|
|
42
42
|
:aria-disabled="entry.disabled ? 'true' : void 0"
|
|
43
|
+
:aria-describedby="reasonId(entry, groupIndex, entryIndex)"
|
|
43
44
|
:data-label="entry.label.toLowerCase()"
|
|
44
45
|
data-k-menu-item
|
|
45
46
|
@pointermove="onItemPointerMove($event, entry, groupIndex, entryIndex)"
|
|
@@ -48,6 +49,12 @@
|
|
|
48
49
|
<Icon v-if="entry.icon" :name="entry.icon" class="k-menu-item-icon" />
|
|
49
50
|
<span class="k-menu-item-label">{{ entry.label }}</span>
|
|
50
51
|
<Icon name="chevron-right" class="k-menu-item-chevron" />
|
|
52
|
+
<HintTooltip
|
|
53
|
+
v-if="reasonOf(entry)"
|
|
54
|
+
:id="reasonId(entry, groupIndex, entryIndex)"
|
|
55
|
+
:text="reasonOf(entry)"
|
|
56
|
+
placement="right"
|
|
57
|
+
/>
|
|
51
58
|
</div>
|
|
52
59
|
<MenuList
|
|
53
60
|
:id="`${menuId}-sub-${groupIndex}-${entryIndex}`"
|
|
@@ -74,6 +81,7 @@
|
|
|
74
81
|
'k-menu-item-danger': entry.type !== 'checkbox' && entry.type !== 'radio' && entry.tone === 'danger'
|
|
75
82
|
}"
|
|
76
83
|
:aria-disabled="entry.disabled ? 'true' : void 0"
|
|
84
|
+
:aria-describedby="reasonId(entry, groupIndex, entryIndex)"
|
|
77
85
|
:aria-keyshortcuts="
|
|
78
86
|
entry.shortcut ? ariaKeyShortcuts(entry.shortcut, apple) : void 0
|
|
79
87
|
"
|
|
@@ -110,6 +118,12 @@
|
|
|
110
118
|
{{ key }}
|
|
111
119
|
</Kbd>
|
|
112
120
|
</span>
|
|
121
|
+
<HintTooltip
|
|
122
|
+
v-if="reasonOf(entry)"
|
|
123
|
+
:id="reasonId(entry, groupIndex, entryIndex)"
|
|
124
|
+
:text="reasonOf(entry)"
|
|
125
|
+
placement="right"
|
|
126
|
+
/>
|
|
113
127
|
</component>
|
|
114
128
|
</template>
|
|
115
129
|
</div>
|
|
@@ -129,6 +143,7 @@ import { MENU_ROOT_KEY } from "./menu";
|
|
|
129
143
|
import { provideFieldBoundary } from "../../composables/useFieldBoundary";
|
|
130
144
|
import { useApplePlatform } from "../core/env";
|
|
131
145
|
import { useTypeahead } from "../core/roving";
|
|
146
|
+
import HintTooltip from "./HintTooltip.vue";
|
|
132
147
|
provideFieldBoundary();
|
|
133
148
|
const props = defineProps({
|
|
134
149
|
items: { type: Array, required: true },
|
|
@@ -192,6 +207,12 @@ function groupLabelId(group, groupIndex) {
|
|
|
192
207
|
const index = group.findIndex((entry) => entry.type === "label");
|
|
193
208
|
return index === -1 ? void 0 : `${menuId.value}-label-${groupIndex}-${index}`;
|
|
194
209
|
}
|
|
210
|
+
function reasonOf(entry) {
|
|
211
|
+
return entry.disabled && entry.disabledReason ? entry.disabledReason : void 0;
|
|
212
|
+
}
|
|
213
|
+
function reasonId(entry, groupIndex, entryIndex) {
|
|
214
|
+
return reasonOf(entry) ? `${menuId.value}-reason-${groupIndex}-${entryIndex}` : void 0;
|
|
215
|
+
}
|
|
195
216
|
function hasChildren(entry) {
|
|
196
217
|
return (entry.type === void 0 || entry.type === "item") && Boolean(entry.children?.length);
|
|
197
218
|
}
|
|
@@ -55,10 +55,54 @@
|
|
|
55
55
|
padding-left: 0.25rem;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
.k-combobox-input:disabled
|
|
58
|
+
.k-combobox-input:disabled,
|
|
59
|
+
.k-combobox-trigger:disabled {
|
|
59
60
|
cursor: not-allowed;
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
.k-combobox-trigger:disabled {
|
|
64
|
+
color: var(--k-text-muted);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.k-combobox.is-select .k-combobox-control:not(.is-disabled, .is-readonly) {
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.k-combobox.is-select .k-combobox-control.is-readonly {
|
|
72
|
+
cursor: default;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.k-combobox-trigger {
|
|
76
|
+
display: flex;
|
|
77
|
+
flex: 1 1 4rem;
|
|
78
|
+
align-items: center;
|
|
79
|
+
min-width: 4rem;
|
|
80
|
+
height: var(--k-combobox-tag-height);
|
|
81
|
+
padding: 0;
|
|
82
|
+
border: 0;
|
|
83
|
+
outline: none;
|
|
84
|
+
background: transparent;
|
|
85
|
+
color: var(--k-text);
|
|
86
|
+
font: inherit;
|
|
87
|
+
text-align: left;
|
|
88
|
+
cursor: inherit;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.k-combobox.is-multiple .k-combobox-control:has(.k-combobox-tag) .k-combobox-trigger {
|
|
92
|
+
padding-left: 0.25rem;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.k-combobox-value {
|
|
96
|
+
min-width: 0;
|
|
97
|
+
overflow-x: clip;
|
|
98
|
+
text-overflow: ellipsis;
|
|
99
|
+
white-space: nowrap;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.k-combobox-value.is-placeholder {
|
|
103
|
+
color: var(--k-text-muted);
|
|
104
|
+
}
|
|
105
|
+
|
|
62
106
|
.k-combobox-lead {
|
|
63
107
|
display: flex;
|
|
64
108
|
margin-right: 0.25rem;
|
package/package.json
CHANGED