@xleddyl/443-components-vue 0.16.64 → 0.16.65
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
CHANGED
|
@@ -221,7 +221,7 @@ Mount `OverlayHost` once for the imperative hooks (see [Composables](#composable
|
|
|
221
221
|
| `Avatar` | User picture with initials fallback and status dot. | Props: `src`, `name`, `alt`, `size` (xs to xl), `shape` (circle, square), `status` (online, away, busy, offline), `decorative`. Slot: `fallback`. | `data/avatar.vue` |
|
|
222
222
|
| `AvatarGroup` | Overlapping stack of avatars with "+N". | Props: `items` (`src`, `name`, `alt`), `max`, `size`, `shape`, `moreLabel`. | `data/avatar.vue` |
|
|
223
223
|
| `Stat` | Key figure (KPI) with unit, delta, trend, hint and optional sparkline. Can be a link. | Props: `label`, `value`, `unit`, `delta`, `trend` (up, down, flat), `invert` (down is good), `hint`, `icon`, `loading`, `to`, `href`, `plain`. Slots: `label`, `value`, `icon`, `sparkline`, `footer`. | `data/stat.vue` |
|
|
224
|
-
| `RecordList` | Short list of records (settings, users, tokens): title, badge, description, leading and action slots, `SkeletonList` while `loading`, empty state. | Props: `items` (`RecordListItem`: `id`, `title` (truncated, full text on hover), `description`, `badge` `{ label, tone }`), `loading`, `avatar`, `action`, `label`, `skeletonRows`, `emptyText`, `emptyDescription`, `emptyIcon`, `emptyVariant` (card, the default, or plain). Slots: `leading`, `action` (`{ item }`), `empty`, `empty-actions` (buttons in the default empty state). | `data/record-list.vue` |
|
|
224
|
+
| `RecordList` | Short list of records (settings, users, tokens): title, badge, description, leading and action slots, `SkeletonList` while `loading`, empty state. | Props: `items` (`RecordListItem`: `id`, `title` (truncated, full text on hover), `description`, `badge` `{ label, tone }`), `loading`, `avatar`, `action`, `label`, `skeletonRows`, `emptyText`, `emptyDescription`, `emptyIcon`, `emptyVariant` (card, the default, or plain). Event: `row-click` (`item`, `event`): the whole row is clickable, clicks on buttons, links and inputs inside the row are ignored. Slots: `leading`, `action` (`{ item }`), `empty`, `empty-actions` (buttons in the default empty state). | `data/record-list.vue` |
|
|
225
225
|
| `DescriptionList` | Label and value pairs for a record. Use it on detail views. | Props: `items` (`key`, `label`, `value`, `hint`), `layout` (stacked, inline, grid), `columns`, `divided`, `emptyText`. Slots: `term`, `value`, `value-<key>`. | `data/description-list.vue` |
|
|
226
226
|
| `Timeline` | Vertical list of events or activity. | Props: `items` (`title`, `description`, `time`, `datetime`, `icon`, `tone`), `compact`. Slot: `item`. | `data/timeline.vue` |
|
|
227
227
|
| `Tree` | Expandable hierarchy with selection, drag to reorder and nesting. | Models: `v-model:expanded`, `v-model:selected`. Props: `nodes` (`id`, `label`, `description`, `meta`, `icon`, `children`, `disabled`), `selectable`, `reorderable`, `nestable`, `moveButtons` (default `true`; `false` hides the row arrows, drag and Alt+arrow keys still work), `canDrop`, `size`, `checkmark`, `emptyText`, `emptyDescription`, `emptyIcon`, `emptyVariant` (card, the default, or plain). Slots: `label`, `meta`, `empty`, `empty-actions` (buttons in the default empty state). Events: `select`, `move`. | `data/tree.vue` |
|
package/README.md
CHANGED
|
@@ -470,7 +470,7 @@ On your own elements, `paletteClass(color)` gives the class of a palette name an
|
|
|
470
470
|
- `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'" />`.
|
|
471
471
|
- `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 }]" />`.
|
|
472
472
|
- `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.
|
|
473
|
-
- `RecordList` keeps each title on one line with an ellipsis; the full title is in its `title` attribute.
|
|
473
|
+
- `RecordList` keeps each title on one line with an ellipsis; the full title is in its `title` attribute. With a `row-click` listener the whole row is clickable (pointer cursor); a click on a button, link or input inside the row does not emit it, so keep a button in `#action` for the keyboard.
|
|
474
474
|
- `Pagination` takes `showEdges` (first and last page buttons, `firstLabel`, `lastLabel`) and `showJump` (a typed page number, `jumpLabel`). Both are off by default. `page` is clamped to the page count only when `total` is known: while `total` is `0` or `loading` is set (it also sets `aria-busy`), the page is kept, so a server reload does not reset it.
|
|
475
475
|
- Page sizes are `PageSize` values (`number | 'all'`): `pageSizes: [25, 50, 100, 'all']` adds an "All" option (`pagination.all`, override with `allLabel`). With `'all'` the page size model is `'all'`, there is one page and the summary reads `1-<total> of <total>`. `Pagination`, `ListPage` and `DataGrid` take it; with `serverPagination` the grid emits `'all'` through `v-model:page-size` and your API returns every row.
|
|
476
476
|
- `FilterPills` can list active filters: options with `removable: true` render as active pills with a remove button (`removeLabel`, a `'Remove {label}'` template). Clicking the pill emits `select(value)`, the button emits `remove(value)` (and drops the value from the model when it is selected); focus moves to the next pill when the removed one disappears.
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<SkeletonList v-if="loading" :rows="skeletonRows" :lines="2" :avatar="avatar" :action="action" />
|
|
3
3
|
|
|
4
|
-
<ul
|
|
5
|
-
|
|
4
|
+
<ul
|
|
5
|
+
v-else-if="items.length"
|
|
6
|
+
class="k-record-list"
|
|
7
|
+
:class="{ 'is-interactive': hasRowClick }"
|
|
8
|
+
:aria-label="label"
|
|
9
|
+
>
|
|
10
|
+
<li
|
|
11
|
+
v-for="item in items"
|
|
12
|
+
:key="item.id"
|
|
13
|
+
class="k-record-list-item"
|
|
14
|
+
@click="onRowClick(item, $event)"
|
|
15
|
+
>
|
|
6
16
|
<slot name="leading" :item="item" />
|
|
7
17
|
<div class="k-record-list-text">
|
|
8
18
|
<span class="k-record-list-title-row">
|
|
@@ -37,6 +47,7 @@
|
|
|
37
47
|
</template>
|
|
38
48
|
|
|
39
49
|
<script setup>
|
|
50
|
+
import { computed, getCurrentInstance } from "vue";
|
|
40
51
|
import { useLocale } from "../../composables/useLocale";
|
|
41
52
|
import EmptyState from "../feedback/EmptyState.vue";
|
|
42
53
|
import SkeletonList from "../feedback/SkeletonList.vue";
|
|
@@ -54,5 +65,19 @@ defineProps({
|
|
|
54
65
|
emptyVariant: { type: String, required: false, default: "card" }
|
|
55
66
|
});
|
|
56
67
|
defineSlots();
|
|
68
|
+
const emit = defineEmits(["rowClick"]);
|
|
57
69
|
const { t } = useLocale();
|
|
70
|
+
const instance = getCurrentInstance();
|
|
71
|
+
const interactiveSelector = 'a, button, input, select, textarea, label, summary, [role="button"]';
|
|
72
|
+
const hasRowClick = computed(
|
|
73
|
+
() => Boolean(instance?.vnode.props?.onRowClick || instance?.vnode.props?.["onRow-click"])
|
|
74
|
+
);
|
|
75
|
+
function onRowClick(item, event) {
|
|
76
|
+
if (!hasRowClick.value) return;
|
|
77
|
+
const row = event.currentTarget;
|
|
78
|
+
const origin = event.target?.closest(interactiveSelector);
|
|
79
|
+
if (origin && row.contains(origin)) return;
|
|
80
|
+
if (window.getSelection()?.toString()) return;
|
|
81
|
+
emit("rowClick", item, event);
|
|
82
|
+
}
|
|
58
83
|
</script>
|
|
@@ -12,6 +12,8 @@ declare const __VLS_export: <Item extends RecordListItem>(__VLS_props: NonNullab
|
|
|
12
12
|
emptyDescription?: string;
|
|
13
13
|
emptyIcon?: IconName;
|
|
14
14
|
emptyVariant?: "card" | "plain";
|
|
15
|
+
} & {
|
|
16
|
+
onRowClick?: ((item: Item, event: MouseEvent) => any) | undefined;
|
|
15
17
|
} & Partial<{
|
|
16
18
|
readonly rows?: number | undefined;
|
|
17
19
|
readonly lines?: 1 | 2 | undefined;
|
|
@@ -226,7 +228,7 @@ declare const __VLS_export: <Item extends RecordListItem>(__VLS_props: NonNullab
|
|
|
226
228
|
empty?(): unknown;
|
|
227
229
|
'empty-actions'?(): unknown;
|
|
228
230
|
};
|
|
229
|
-
emit:
|
|
231
|
+
emit: (evt: "rowClick", item: Item, event: MouseEvent) => void;
|
|
230
232
|
}>) => import("vue").VNode & {
|
|
231
233
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
232
234
|
};
|
package/package.json
CHANGED