@nuxt/ui 2.18.6 → 2.19.0
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/dist/module.d.mts +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +3 -3
- package/dist/runtime/components/data/Table.vue +82 -27
- package/dist/runtime/components/data/Table.vue.d.ts +49 -41
- package/dist/runtime/components/elements/Alert.vue.d.ts +1 -1
- package/dist/runtime/components/elements/AvatarGroup.js +2 -2
- package/dist/runtime/components/elements/Carousel.vue +16 -7
- package/dist/runtime/components/elements/Carousel.vue.d.ts +9 -0
- package/dist/runtime/components/elements/Dropdown.vue +7 -3
- package/dist/runtime/components/elements/MeterGroup.d.ts +1 -1
- package/dist/runtime/components/elements/Progress.vue +1 -1
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +5 -5
- package/dist/runtime/components/forms/Form.vue +104 -43
- package/dist/runtime/components/forms/Form.vue.d.ts +5 -3
- package/dist/runtime/components/forms/Input.vue +5 -2
- package/dist/runtime/components/forms/Input.vue.d.ts +5 -2
- package/dist/runtime/components/forms/InputMenu.vue +419 -8
- package/dist/runtime/components/forms/InputMenu.vue.d.ts +22 -3
- package/dist/runtime/components/forms/Radio.vue.d.ts +5 -5
- package/dist/runtime/components/forms/RadioGroup.vue +3 -4
- package/dist/runtime/components/forms/RadioGroup.vue.d.ts +8 -8
- package/dist/runtime/components/forms/Range.vue.d.ts +2 -2
- package/dist/runtime/components/forms/Select.vue.d.ts +3 -3
- package/dist/runtime/components/forms/SelectMenu.vue +501 -11
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +33 -5
- package/dist/runtime/components/forms/Textarea.vue +7 -4
- package/dist/runtime/components/forms/Textarea.vue.d.ts +5 -2
- package/dist/runtime/components/forms/Toggle.vue.d.ts +2 -2
- package/dist/runtime/components/layout/Divider.vue +1 -1
- package/dist/runtime/components/layout/Divider.vue.d.ts +5 -2
- package/dist/runtime/components/navigation/CommandPalette.vue +1 -1
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/Pagination.vue +4 -4
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +1 -1
- package/dist/runtime/components/navigation/Tabs.vue +1 -1
- package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +6 -2
- package/dist/runtime/components/overlays/Modal.vue +1 -1
- package/dist/runtime/components/overlays/Notification.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/Notifications.vue +1 -1
- package/dist/runtime/components/overlays/Notifications.vue.d.ts +1 -1
- package/dist/runtime/components/overlays/Popover.vue +7 -3
- package/dist/runtime/components/overlays/Tooltip.vue +5 -3
- package/dist/runtime/components/overlays/Tooltip.vue.d.ts +1 -0
- package/dist/runtime/composables/defineShortcuts.js +1 -1
- package/dist/runtime/composables/useButtonGroup.d.ts +1 -1
- package/dist/runtime/composables/useUI.js +1 -1
- package/dist/runtime/plugins/modals.js +1 -1
- package/dist/runtime/plugins/slideovers.js +1 -1
- package/dist/runtime/types/accordion.d.ts +1 -1
- package/dist/runtime/types/alert.d.ts +4 -4
- package/dist/runtime/types/avatar.d.ts +3 -3
- package/dist/runtime/types/badge.d.ts +3 -3
- package/dist/runtime/types/button.d.ts +3 -5
- package/dist/runtime/types/chip.d.ts +2 -2
- package/dist/runtime/types/command-palette.d.ts +2 -2
- package/dist/runtime/types/component.d.ts +3 -3
- package/dist/runtime/types/divider.d.ts +3 -3
- package/dist/runtime/types/dropdown.d.ts +1 -1
- package/dist/runtime/types/form-group.d.ts +2 -2
- package/dist/runtime/types/form.d.ts +7 -2
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/types/input.d.ts +3 -3
- package/dist/runtime/types/kbd.d.ts +2 -2
- package/dist/runtime/types/meter.d.ts +2 -2
- package/dist/runtime/types/modal.d.ts +2 -2
- package/dist/runtime/types/notification.d.ts +1 -1
- package/dist/runtime/types/progress.d.ts +2 -2
- package/dist/runtime/types/range.d.ts +3 -3
- package/dist/runtime/types/select.d.ts +3 -3
- package/dist/runtime/types/table.d.ts +18 -0
- package/dist/runtime/types/textarea.d.ts +3 -3
- package/dist/runtime/types/toggle.d.ts +3 -3
- package/dist/runtime/types/utils.d.ts +2 -2
- package/dist/runtime/ui.config/data/table.d.ts +1 -0
- package/dist/runtime/ui.config/data/table.js +1 -0
- package/dist/runtime/ui.config/elements/avatar.js +15 -15
- package/dist/runtime/ui.config/elements/button.js +25 -25
- package/dist/runtime/ui.config/elements/buttonGroup.js +1 -1
- package/dist/runtime/ui.config/elements/carousel.js +2 -2
- package/dist/runtime/ui.config/elements/chip.js +5 -5
- package/dist/runtime/ui.config/elements/meter.js +20 -20
- package/dist/runtime/ui.config/elements/meterGroup.js +1 -1
- package/dist/runtime/ui.config/elements/progress.js +18 -18
- package/dist/runtime/ui.config/forms/formGroup.js +5 -6
- package/dist/runtime/ui.config/forms/input.js +40 -40
- package/dist/runtime/ui.config/forms/inputMenu.d.ts +6 -0
- package/dist/runtime/ui.config/forms/inputMenu.js +7 -1
- package/dist/runtime/ui.config/forms/range.js +20 -20
- package/dist/runtime/ui.config/forms/selectMenu.d.ts +9 -0
- package/dist/runtime/ui.config/forms/selectMenu.js +10 -1
- package/dist/runtime/ui.config/forms/toggle.js +20 -20
- package/dist/runtime/ui.config/layout/divider.d.ts +1 -0
- package/dist/runtime/ui.config/layout/divider.js +12 -11
- package/dist/runtime/ui.config/navigation/horizontalNavigation.js +1 -1
- package/dist/runtime/ui.config/navigation/verticalNavigation.js +1 -1
- package/dist/runtime/ui.config/popper.js +0 -1
- package/dist/runtime/utils/colors.js +7 -7
- package/dist/runtime/utils/index.js +4 -4
- package/dist/runtime/utils/link.js +1 -1
- package/dist/runtime/utils/lodash.js +1 -1
- package/package.json +23 -21
package/dist/module.d.mts
CHANGED
package/dist/module.d.ts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -14,7 +14,7 @@ const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
|
14
14
|
const __dirname = __cjs_path__.dirname(__filename);
|
|
15
15
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
16
16
|
const name = "@nuxt/ui";
|
|
17
|
-
const version = "2.
|
|
17
|
+
const version = "2.19.0";
|
|
18
18
|
|
|
19
19
|
function createTemplates(nuxt = useNuxt()) {
|
|
20
20
|
const template = addTemplate({
|
|
@@ -33,7 +33,7 @@ function createTemplates(nuxt = useNuxt()) {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
function installTailwind(moduleOptions, nuxt = useNuxt(), resolve = createResolver(import.meta.url).resolve) {
|
|
37
37
|
const runtimeDir = resolve("./runtime");
|
|
38
38
|
nuxt.hook("tailwindcss:config", function(tailwindConfig) {
|
|
39
39
|
tailwindConfig.theme = tailwindConfig.theme || {};
|
|
@@ -97,7 +97,7 @@ async function installTailwind(moduleOptions, nuxt = useNuxt(), resolve = create
|
|
|
97
97
|
} else {
|
|
98
98
|
twConfigPaths.push(...userTwConfigPath);
|
|
99
99
|
}
|
|
100
|
-
|
|
100
|
+
return installModule("@nuxtjs/tailwindcss", defu({
|
|
101
101
|
exposeConfig: true,
|
|
102
102
|
config: {
|
|
103
103
|
darkMode: "class"
|
|
@@ -9,10 +9,16 @@
|
|
|
9
9
|
<thead :class="ui.thead">
|
|
10
10
|
<tr :class="ui.tr.base">
|
|
11
11
|
<th v-if="modelValue" scope="col" :class="ui.checkbox.padding">
|
|
12
|
-
<UCheckbox
|
|
12
|
+
<UCheckbox
|
|
13
|
+
:model-value="isAllRowChecked"
|
|
14
|
+
:indeterminate="indeterminate"
|
|
15
|
+
v-bind="ui.default.checkbox"
|
|
16
|
+
aria-label="Select all"
|
|
17
|
+
@change="onChange"
|
|
18
|
+
/>
|
|
13
19
|
</th>
|
|
14
20
|
|
|
15
|
-
<th v-if="
|
|
21
|
+
<th v-if="expand" scope="col" :class="ui.tr.base">
|
|
16
22
|
<span class="sr-only">Expand</span>
|
|
17
23
|
</th>
|
|
18
24
|
|
|
@@ -44,7 +50,7 @@
|
|
|
44
50
|
</thead>
|
|
45
51
|
<tbody :class="ui.tbody">
|
|
46
52
|
<tr v-if="loadingState && loading && !rows.length">
|
|
47
|
-
<td :colspan="columns.length + (modelValue ? 1 : 0) + (
|
|
53
|
+
<td :colspan="columns.length + (modelValue ? 1 : 0) + (expand ? 1 : 0)">
|
|
48
54
|
<slot name="loading-state">
|
|
49
55
|
<div :class="ui.loadingState.wrapper">
|
|
50
56
|
<UIcon v-if="loadingState.icon" :name="loadingState.icon" :class="ui.loadingState.icon" aria-hidden="true" />
|
|
@@ -57,7 +63,7 @@
|
|
|
57
63
|
</tr>
|
|
58
64
|
|
|
59
65
|
<tr v-else-if="emptyState && !rows.length">
|
|
60
|
-
<td :colspan="columns.length + (modelValue ? 1 : 0) + (
|
|
66
|
+
<td :colspan="columns.length + (modelValue ? 1 : 0) + (expand ? 1 : 0)">
|
|
61
67
|
<slot name="empty-state">
|
|
62
68
|
<div :class="ui.emptyState.wrapper">
|
|
63
69
|
<UIcon v-if="emptyState.icon" :name="emptyState.icon" :class="ui.emptyState.icon" aria-hidden="true" />
|
|
@@ -71,29 +77,38 @@
|
|
|
71
77
|
|
|
72
78
|
<template v-else>
|
|
73
79
|
<template v-for="(row, index) in rows" :key="index">
|
|
74
|
-
<tr :class="[ui.tr.base, isSelected(row) && ui.tr.selected, $attrs.onSelect && ui.tr.active, row?.class]" @click="() => onSelect(row)">
|
|
80
|
+
<tr :class="[ui.tr.base, isSelected(row) && ui.tr.selected, isExpanded(row) && ui.tr.expanded, $attrs.onSelect && ui.tr.active, row?.class]" @click="() => onSelect(row)">
|
|
75
81
|
<td v-if="modelValue" :class="ui.checkbox.padding">
|
|
76
|
-
<UCheckbox
|
|
82
|
+
<UCheckbox
|
|
83
|
+
:model-value="isSelected(row)"
|
|
84
|
+
v-bind="ui.default.checkbox"
|
|
85
|
+
aria-label="Select row"
|
|
86
|
+
@change="onChangeCheckbox($event, row)"
|
|
87
|
+
@click.capture.stop="() => onSelect(row)"
|
|
88
|
+
/>
|
|
77
89
|
</td>
|
|
78
|
-
|
|
79
90
|
<td
|
|
80
|
-
v-if="
|
|
91
|
+
v-if="expand"
|
|
81
92
|
:class="[ui.td.base, ui.td.padding, ui.td.color, ui.td.font, ui.td.size]"
|
|
82
93
|
>
|
|
94
|
+
<template v-if="$slots['expand-action']">
|
|
95
|
+
<slot name="expand-action" :row="row" :is-expanded="isExpanded(row)" :toggle="() => toggleOpened(row)" />
|
|
96
|
+
</template>
|
|
83
97
|
<UButton
|
|
98
|
+
v-else
|
|
99
|
+
:disabled="row.disabledExpand"
|
|
84
100
|
v-bind="{ ...(ui.default.expandButton || {}), ...expandButton }"
|
|
85
|
-
:ui="{ icon: { base: [ui.expand.icon,
|
|
86
|
-
@click="toggleOpened(
|
|
101
|
+
:ui="{ icon: { base: [ui.expand.icon, isExpanded(row) && 'rotate-180'].join(' ') } }"
|
|
102
|
+
@click.capture.stop="toggleOpened(row)"
|
|
87
103
|
/>
|
|
88
104
|
</td>
|
|
89
|
-
|
|
90
105
|
<td v-for="(column, subIndex) in columns" :key="subIndex" :class="[ui.td.base, ui.td.padding, ui.td.color, ui.td.font, ui.td.size, column?.rowClass, row[column.key]?.class]">
|
|
91
106
|
<slot :name="`${column.key}-data`" :column="column" :row="row" :index="index" :get-row-data="(defaultValue) => getRowData(row, column.key, defaultValue)">
|
|
92
107
|
{{ getRowData(row, column.key) }}
|
|
93
108
|
</slot>
|
|
94
109
|
</td>
|
|
95
110
|
</tr>
|
|
96
|
-
<tr v-if="
|
|
111
|
+
<tr v-if="isExpanded(row)">
|
|
97
112
|
<td colspan="100%">
|
|
98
113
|
<slot
|
|
99
114
|
name="expand"
|
|
@@ -110,7 +125,7 @@
|
|
|
110
125
|
</template>
|
|
111
126
|
|
|
112
127
|
<script>
|
|
113
|
-
import {
|
|
128
|
+
import { computed, defineComponent, toRaw, toRef } from "vue";
|
|
114
129
|
import { upperFirst } from "scule";
|
|
115
130
|
import { defu } from "defu";
|
|
116
131
|
import { useVModel } from "@vueuse/core";
|
|
@@ -124,7 +139,7 @@ import appConfig from "#build/app.config";
|
|
|
124
139
|
import { table } from "#ui/ui.config";
|
|
125
140
|
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.table, table);
|
|
126
141
|
function defaultComparator(a, z) {
|
|
127
|
-
return a === z;
|
|
142
|
+
return JSON.stringify(a) === JSON.stringify(z);
|
|
128
143
|
}
|
|
129
144
|
function defaultSort(a, b, direction) {
|
|
130
145
|
if (a === b) {
|
|
@@ -189,6 +204,10 @@ export default defineComponent({
|
|
|
189
204
|
type: Object,
|
|
190
205
|
default: () => config.default.expandButton
|
|
191
206
|
},
|
|
207
|
+
expand: {
|
|
208
|
+
type: Object,
|
|
209
|
+
default: () => null
|
|
210
|
+
},
|
|
192
211
|
loading: {
|
|
193
212
|
type: Boolean,
|
|
194
213
|
default: false
|
|
@@ -216,14 +235,24 @@ export default defineComponent({
|
|
|
216
235
|
ui: {
|
|
217
236
|
type: Object,
|
|
218
237
|
default: () => ({})
|
|
238
|
+
},
|
|
239
|
+
multipleExpand: {
|
|
240
|
+
type: Boolean,
|
|
241
|
+
default: true
|
|
219
242
|
}
|
|
220
243
|
},
|
|
221
|
-
emits: ["update:modelValue", "update:sort"],
|
|
244
|
+
emits: ["update:modelValue", "update:sort", "update:expand"],
|
|
222
245
|
setup(props, { emit, attrs: $attrs }) {
|
|
223
246
|
const { ui, attrs } = useUI("table", toRef(props, "ui"), config, toRef(props, "class"));
|
|
224
247
|
const columns = computed(() => props.columns ?? Object.keys(props.rows[0] ?? {}).map((key) => ({ key, label: upperFirst(key), sortable: false, class: void 0, sort: defaultSort })));
|
|
225
248
|
const sort = useVModel(props, "sort", emit, { passive: true, defaultValue: defu({}, props.sort, { column: null, direction: "asc" }) });
|
|
226
|
-
const
|
|
249
|
+
const expand = useVModel(props, "expand", emit, {
|
|
250
|
+
passive: true,
|
|
251
|
+
defaultValue: defu({}, props.expand, {
|
|
252
|
+
openedRows: [],
|
|
253
|
+
row: null
|
|
254
|
+
})
|
|
255
|
+
});
|
|
227
256
|
const savedSort = { column: sort.value.column, direction: null };
|
|
228
257
|
const rows = computed(() => {
|
|
229
258
|
if (!sort.value?.column || props.sortMode === "manual") {
|
|
@@ -245,7 +274,18 @@ export default defineComponent({
|
|
|
245
274
|
emit("update:modelValue", value);
|
|
246
275
|
}
|
|
247
276
|
});
|
|
248
|
-
const
|
|
277
|
+
const getStringifiedSet = (arr) => new Set(arr.map((item) => JSON.stringify(item)));
|
|
278
|
+
const totalRows = computed(() => props.rows.length);
|
|
279
|
+
const countCheckedRow = computed(() => {
|
|
280
|
+
const selectedData = getStringifiedSet(selected.value);
|
|
281
|
+
const rowsData = getStringifiedSet(props.rows);
|
|
282
|
+
return Array.from(selectedData).filter((item) => rowsData.has(item)).length;
|
|
283
|
+
});
|
|
284
|
+
const indeterminate = computed(() => {
|
|
285
|
+
if (!selected.value || !props.rows) return false;
|
|
286
|
+
return countCheckedRow.value > 0 && countCheckedRow.value < totalRows.value;
|
|
287
|
+
});
|
|
288
|
+
const isAllRowChecked = computed(() => countCheckedRow.value === totalRows.value);
|
|
249
289
|
const emptyState = computed(() => {
|
|
250
290
|
if (props.emptyState === null) return null;
|
|
251
291
|
return { ...ui.value.default.emptyState, ...props.emptyState };
|
|
@@ -256,11 +296,14 @@ export default defineComponent({
|
|
|
256
296
|
});
|
|
257
297
|
function compare(a, z) {
|
|
258
298
|
if (typeof props.by === "string") {
|
|
259
|
-
const
|
|
260
|
-
return a
|
|
299
|
+
const accesorFn = accessor(props.by);
|
|
300
|
+
return accesorFn(a) === accesorFn(z);
|
|
261
301
|
}
|
|
262
302
|
return props.by(a, z);
|
|
263
303
|
}
|
|
304
|
+
function accessor(key) {
|
|
305
|
+
return (obj) => get(obj, key);
|
|
306
|
+
}
|
|
264
307
|
function isSelected(row) {
|
|
265
308
|
if (!props.modelValue) {
|
|
266
309
|
return false;
|
|
@@ -301,15 +344,25 @@ export default defineComponent({
|
|
|
301
344
|
selected.value = [];
|
|
302
345
|
}
|
|
303
346
|
}
|
|
347
|
+
function onChangeCheckbox(checked, row) {
|
|
348
|
+
if (checked) {
|
|
349
|
+
selected.value.push(row);
|
|
350
|
+
} else {
|
|
351
|
+
const index = selected.value.findIndex((item) => compare(item, row));
|
|
352
|
+
selected.value.splice(index, 1);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
304
355
|
function getRowData(row, rowKey, defaultValue = "") {
|
|
305
356
|
return get(row, rowKey, defaultValue);
|
|
306
357
|
}
|
|
307
|
-
function
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
358
|
+
function isExpanded(row) {
|
|
359
|
+
return expand.value?.openedRows ? expand.value.openedRows.some((openedRow) => compare(openedRow, row)) : false;
|
|
360
|
+
}
|
|
361
|
+
function toggleOpened(row) {
|
|
362
|
+
expand.value = {
|
|
363
|
+
openedRows: isExpanded(row) ? expand.value.openedRows.filter((v) => !compare(v, row)) : props.multipleExpand ? [...expand.value.openedRows, row] : [row],
|
|
364
|
+
row
|
|
365
|
+
};
|
|
313
366
|
}
|
|
314
367
|
function getAriaSort(column) {
|
|
315
368
|
if (!column.sortable) {
|
|
@@ -342,14 +395,16 @@ export default defineComponent({
|
|
|
342
395
|
emptyState,
|
|
343
396
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
344
397
|
loadingState,
|
|
345
|
-
|
|
398
|
+
isAllRowChecked,
|
|
399
|
+
onChangeCheckbox,
|
|
346
400
|
isSelected,
|
|
347
401
|
onSort,
|
|
348
402
|
onSelect,
|
|
349
403
|
onChange,
|
|
350
404
|
getRowData,
|
|
351
405
|
toggleOpened,
|
|
352
|
-
getAriaSort
|
|
406
|
+
getAriaSort,
|
|
407
|
+
isExpanded
|
|
353
408
|
};
|
|
354
409
|
}
|
|
355
410
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropType, AriaAttributes } from 'vue';
|
|
2
|
-
import type { Strategy, Button, ProgressColor, ProgressAnimation, DeepPartial } from '../../types/index.js';
|
|
2
|
+
import type { TableRow, TableColumn, Strategy, Button, ProgressColor, ProgressAnimation, DeepPartial, Expanded } from '../../types/index.js';
|
|
3
3
|
declare const config: {
|
|
4
4
|
wrapper: string;
|
|
5
5
|
base: string;
|
|
@@ -10,6 +10,7 @@ declare const config: {
|
|
|
10
10
|
tr: {
|
|
11
11
|
base: string;
|
|
12
12
|
selected: string;
|
|
13
|
+
expanded: string;
|
|
13
14
|
active: string;
|
|
14
15
|
};
|
|
15
16
|
th: {
|
|
@@ -81,15 +82,6 @@ declare const config: {
|
|
|
81
82
|
};
|
|
82
83
|
};
|
|
83
84
|
declare function defaultComparator<T>(a: T, z: T): boolean;
|
|
84
|
-
interface Column {
|
|
85
|
-
key: string;
|
|
86
|
-
sortable?: boolean;
|
|
87
|
-
sort?: (a: any, b: any, direction: 'asc' | 'desc') => number;
|
|
88
|
-
direction?: 'asc' | 'desc';
|
|
89
|
-
class?: string;
|
|
90
|
-
rowClass?: string;
|
|
91
|
-
[key: string]: any;
|
|
92
|
-
}
|
|
93
85
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
94
86
|
modelValue: {
|
|
95
87
|
type: ArrayConstructor;
|
|
@@ -100,13 +92,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
100
92
|
default: () => typeof defaultComparator;
|
|
101
93
|
};
|
|
102
94
|
rows: {
|
|
103
|
-
type: PropType<
|
|
104
|
-
[key: string]: any;
|
|
105
|
-
}[]>;
|
|
95
|
+
type: PropType<TableRow[]>;
|
|
106
96
|
default: () => any[];
|
|
107
97
|
};
|
|
108
98
|
columns: {
|
|
109
|
-
type: PropType<
|
|
99
|
+
type: PropType<TableColumn[]>;
|
|
110
100
|
default: any;
|
|
111
101
|
};
|
|
112
102
|
columnAttribute: {
|
|
@@ -140,6 +130,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
140
130
|
type: PropType<Button>;
|
|
141
131
|
default: () => Button;
|
|
142
132
|
};
|
|
133
|
+
expand: {
|
|
134
|
+
type: PropType<Expanded<TableRow>>;
|
|
135
|
+
default: () => any;
|
|
136
|
+
};
|
|
143
137
|
loading: {
|
|
144
138
|
type: BooleanConstructor;
|
|
145
139
|
default: boolean;
|
|
@@ -188,6 +182,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
188
182
|
}>;
|
|
189
183
|
default: () => {};
|
|
190
184
|
};
|
|
185
|
+
multipleExpand: {
|
|
186
|
+
type: BooleanConstructor;
|
|
187
|
+
default: boolean;
|
|
188
|
+
};
|
|
191
189
|
}>, {
|
|
192
190
|
ui: import("vue").ComputedRef<{
|
|
193
191
|
wrapper: string;
|
|
@@ -199,6 +197,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
199
197
|
tr: {
|
|
200
198
|
base: string;
|
|
201
199
|
selected: string;
|
|
200
|
+
expanded: string;
|
|
202
201
|
active: string;
|
|
203
202
|
};
|
|
204
203
|
th: {
|
|
@@ -279,10 +278,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
279
278
|
column: string;
|
|
280
279
|
direction: "asc" | "desc";
|
|
281
280
|
}>;
|
|
282
|
-
columns: import("vue").ComputedRef<
|
|
283
|
-
rows: import("vue").ComputedRef<
|
|
284
|
-
[key: string]: any;
|
|
285
|
-
}[]>;
|
|
281
|
+
columns: import("vue").ComputedRef<TableColumn[]>;
|
|
282
|
+
rows: import("vue").ComputedRef<TableRow[]>;
|
|
286
283
|
selected: import("vue").WritableComputedRef<unknown[], unknown[]>;
|
|
287
284
|
indeterminate: import("vue").ComputedRef<boolean>;
|
|
288
285
|
emptyState: import("vue").ComputedRef<{
|
|
@@ -293,18 +290,20 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
293
290
|
icon: string;
|
|
294
291
|
label: string;
|
|
295
292
|
}>;
|
|
296
|
-
|
|
297
|
-
|
|
293
|
+
isAllRowChecked: import("vue").ComputedRef<boolean>;
|
|
294
|
+
onChangeCheckbox: (checked: boolean, row: TableRow) => void;
|
|
295
|
+
isSelected: (row: TableRow) => boolean;
|
|
298
296
|
onSort: (column: {
|
|
299
297
|
key: string;
|
|
300
298
|
direction?: "asc" | "desc";
|
|
301
299
|
}) => void;
|
|
302
|
-
onSelect: (row:
|
|
300
|
+
onSelect: (row: TableRow) => void;
|
|
303
301
|
onChange: (checked: boolean) => void;
|
|
304
|
-
getRowData: (row:
|
|
305
|
-
toggleOpened: (
|
|
306
|
-
getAriaSort: (column:
|
|
307
|
-
|
|
302
|
+
getRowData: (row: TableRow, rowKey: string | string[], defaultValue?: any) => any;
|
|
303
|
+
toggleOpened: (row: TableRow) => void;
|
|
304
|
+
getAriaSort: (column: TableColumn) => AriaAttributes["aria-sort"];
|
|
305
|
+
isExpanded: (row: TableRow) => boolean;
|
|
306
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:sort" | "update:expand")[], "update:modelValue" | "update:sort" | "update:expand", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
308
307
|
modelValue: {
|
|
309
308
|
type: ArrayConstructor;
|
|
310
309
|
default: any;
|
|
@@ -314,13 +313,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
314
313
|
default: () => typeof defaultComparator;
|
|
315
314
|
};
|
|
316
315
|
rows: {
|
|
317
|
-
type: PropType<
|
|
318
|
-
[key: string]: any;
|
|
319
|
-
}[]>;
|
|
316
|
+
type: PropType<TableRow[]>;
|
|
320
317
|
default: () => any[];
|
|
321
318
|
};
|
|
322
319
|
columns: {
|
|
323
|
-
type: PropType<
|
|
320
|
+
type: PropType<TableColumn[]>;
|
|
324
321
|
default: any;
|
|
325
322
|
};
|
|
326
323
|
columnAttribute: {
|
|
@@ -354,6 +351,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
354
351
|
type: PropType<Button>;
|
|
355
352
|
default: () => Button;
|
|
356
353
|
};
|
|
354
|
+
expand: {
|
|
355
|
+
type: PropType<Expanded<TableRow>>;
|
|
356
|
+
default: () => any;
|
|
357
|
+
};
|
|
357
358
|
loading: {
|
|
358
359
|
type: BooleanConstructor;
|
|
359
360
|
default: boolean;
|
|
@@ -402,9 +403,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
402
403
|
}>;
|
|
403
404
|
default: () => {};
|
|
404
405
|
};
|
|
406
|
+
multipleExpand: {
|
|
407
|
+
type: BooleanConstructor;
|
|
408
|
+
default: boolean;
|
|
409
|
+
};
|
|
405
410
|
}>> & Readonly<{
|
|
406
411
|
"onUpdate:modelValue"?: (...args: any[]) => any;
|
|
407
412
|
"onUpdate:sort"?: (...args: any[]) => any;
|
|
413
|
+
"onUpdate:expand"?: (...args: any[]) => any;
|
|
408
414
|
}>, {
|
|
409
415
|
sort: {
|
|
410
416
|
column: string;
|
|
@@ -412,7 +418,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
412
418
|
};
|
|
413
419
|
class: any;
|
|
414
420
|
caption: string;
|
|
415
|
-
columns:
|
|
421
|
+
columns: TableColumn[];
|
|
416
422
|
progress: {
|
|
417
423
|
color: ProgressColor;
|
|
418
424
|
animation: ProgressAnimation;
|
|
@@ -427,6 +433,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
427
433
|
tr?: DeepPartial<{
|
|
428
434
|
base: string;
|
|
429
435
|
selected: string;
|
|
436
|
+
expanded: string;
|
|
430
437
|
active: string;
|
|
431
438
|
}, any>;
|
|
432
439
|
th?: DeepPartial<{
|
|
@@ -511,16 +518,16 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
511
518
|
icon: string;
|
|
512
519
|
label: string;
|
|
513
520
|
};
|
|
521
|
+
expand: Expanded<TableRow>;
|
|
514
522
|
by: string | Function;
|
|
515
|
-
rows:
|
|
516
|
-
[key: string]: any;
|
|
517
|
-
}[];
|
|
523
|
+
rows: TableRow[];
|
|
518
524
|
columnAttribute: string;
|
|
519
525
|
sortMode: "auto" | "manual";
|
|
520
526
|
sortButton: Button;
|
|
521
527
|
sortAscIcon: string;
|
|
522
528
|
sortDescIcon: string;
|
|
523
529
|
expandButton: Button;
|
|
530
|
+
multipleExpand: boolean;
|
|
524
531
|
}, {}, {
|
|
525
532
|
UIcon: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
526
533
|
name: {
|
|
@@ -1935,7 +1942,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1935
1942
|
default: any;
|
|
1936
1943
|
};
|
|
1937
1944
|
modelValue: {
|
|
1938
|
-
type:
|
|
1945
|
+
type: PropType<boolean | Array<any> | null>;
|
|
1939
1946
|
default: any;
|
|
1940
1947
|
};
|
|
1941
1948
|
name: {
|
|
@@ -2020,7 +2027,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2020
2027
|
attrs: import("vue").ComputedRef<Pick<{
|
|
2021
2028
|
[x: string]: unknown;
|
|
2022
2029
|
}, string>>;
|
|
2023
|
-
toggle: import("vue").WritableComputedRef<boolean |
|
|
2030
|
+
toggle: import("vue").WritableComputedRef<boolean | any[], boolean | any[]>;
|
|
2024
2031
|
inputId: string;
|
|
2025
2032
|
name: import("vue").ComputedRef<string>;
|
|
2026
2033
|
inputClass: import("vue").ComputedRef<string>;
|
|
@@ -2035,7 +2042,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2035
2042
|
default: any;
|
|
2036
2043
|
};
|
|
2037
2044
|
modelValue: {
|
|
2038
|
-
type:
|
|
2045
|
+
type: PropType<boolean | Array<any> | null>;
|
|
2039
2046
|
default: any;
|
|
2040
2047
|
};
|
|
2041
2048
|
name: {
|
|
@@ -2131,7 +2138,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2131
2138
|
strategy?: Strategy;
|
|
2132
2139
|
};
|
|
2133
2140
|
id: string;
|
|
2134
|
-
modelValue: boolean |
|
|
2141
|
+
modelValue: boolean | any[];
|
|
2135
2142
|
value: string | number | boolean | Record<string, any>;
|
|
2136
2143
|
help: string;
|
|
2137
2144
|
indeterminate: boolean;
|
|
@@ -2369,6 +2376,10 @@ declare global {
|
|
|
2369
2376
|
type __VLS_PrettifyGlobal<T> = {
|
|
2370
2377
|
[K in keyof T]: T[K];
|
|
2371
2378
|
} & {};
|
|
2379
|
+
type __VLS_PickFunctionalComponentCtx<T, K> = NonNullable<__VLS_PickNotAny<'__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends {
|
|
2380
|
+
__ctx?: infer Ctx;
|
|
2381
|
+
} ? Ctx : never : any, T extends (props: any, ctx: infer Ctx) => any ? Ctx : any>>;
|
|
2382
|
+
type __VLS_UseTemplateRef<T> = Readonly<import('vue').ShallowRef<T | null>>;
|
|
2372
2383
|
function __VLS_getVForSourceType(source: number): [number, number, number][];
|
|
2373
2384
|
function __VLS_getVForSourceType(source: string): [string, number, number][];
|
|
2374
2385
|
function __VLS_getVForSourceType<T extends any[]>(source: T): [
|
|
@@ -2401,7 +2412,7 @@ declare global {
|
|
|
2401
2412
|
][];
|
|
2402
2413
|
function __VLS_getSlotParams<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>;
|
|
2403
2414
|
function __VLS_getSlotParam<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>[0];
|
|
2404
|
-
function
|
|
2415
|
+
function __VLS_asFunctionalDirective<T>(dir: T): T extends import('vue').ObjectDirective ? NonNullable<T['created' | 'beforeMount' | 'mounted' | 'beforeUpdate' | 'updated' | 'beforeUnmount' | 'unmounted']> : T extends (...args: any) => any ? T : __VLS_unknownDirective;
|
|
2405
2416
|
function __VLS_withScope<T, K>(ctx: T, scope: K): ctx is T & K;
|
|
2406
2417
|
function __VLS_makeOptional<T>(t: T): {
|
|
2407
2418
|
[K in keyof T]?: T[K];
|
|
@@ -2435,9 +2446,6 @@ declare global {
|
|
|
2435
2446
|
};
|
|
2436
2447
|
function __VLS_elementAsFunction<T>(tag: T, endTag?: T): (_: T & Record<string, unknown>) => void;
|
|
2437
2448
|
function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(t: T): 2 extends Parameters<T>['length'] ? [any] : [];
|
|
2438
|
-
function __VLS_pickFunctionalComponentCtx<T, K>(comp: T, compInstance: K): NonNullable<__VLS_PickNotAny<'__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends {
|
|
2439
|
-
__ctx?: infer Ctx;
|
|
2440
|
-
} ? Ctx : never : any, T extends (props: any, ctx: infer Ctx) => any ? Ctx : any>>;
|
|
2441
2449
|
function __VLS_normalizeSlot<S>(s: S): S extends () => infer R ? (props: {}) => R : S;
|
|
2442
2450
|
function __VLS_tryAsConstant<const T>(t: T): T;
|
|
2443
2451
|
}
|
|
@@ -181,10 +181,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
181
181
|
onClose?: (...args: any[]) => any;
|
|
182
182
|
}>, {
|
|
183
183
|
class: any;
|
|
184
|
+
title: string;
|
|
184
185
|
avatar: Avatar;
|
|
185
186
|
color: AlertColor;
|
|
186
187
|
variant: AlertVariant;
|
|
187
|
-
title: string;
|
|
188
188
|
ui: {
|
|
189
189
|
wrapper?: string;
|
|
190
190
|
inner?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { h, cloneVNode, computed, toRef, defineComponent } from "vue";
|
|
2
2
|
import { twMerge, twJoin } from "tailwind-merge";
|
|
3
|
-
import UAvatar from "./Avatar.vue";
|
|
4
3
|
import { useUI } from "../../composables/useUI.js";
|
|
5
4
|
import { mergeConfig, getSlotsChildren } from "../../utils/index.js";
|
|
5
|
+
import UAvatar from "./Avatar.vue";
|
|
6
6
|
import appConfig from "#build/app.config";
|
|
7
7
|
import { avatar, avatarGroup } from "#ui/ui.config";
|
|
8
8
|
const avatarConfig = mergeConfig(appConfig.ui.strategy, appConfig.ui.avatar, avatar);
|
|
@@ -33,7 +33,7 @@ export default defineComponent({
|
|
|
33
33
|
setup(props, { slots }) {
|
|
34
34
|
const { ui, attrs } = useUI("avatarGroup", toRef(props, "ui"), avatarGroupConfig, toRef(props, "class"));
|
|
35
35
|
const children = computed(() => getSlotsChildren(slots));
|
|
36
|
-
const max = computed(() => typeof props.max === "string" ? parseInt(props.max, 10) : props.max);
|
|
36
|
+
const max = computed(() => typeof props.max === "string" ? Number.parseInt(props.max, 10) : props.max);
|
|
37
37
|
const clones = computed(() => children.value.map((node, index) => {
|
|
38
38
|
const vProps = {};
|
|
39
39
|
if (!props.max || max.value && index < max.value) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div :class="ui.wrapper" v-bind="attrs">
|
|
2
|
+
<div :class="ui.wrapper" v-bind="attrs" :dir="dir">
|
|
3
3
|
<div ref="carouselRef" :class="ui.container" class="no-scrollbar">
|
|
4
4
|
<div
|
|
5
5
|
v-for="(item, index) in items"
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
<script>
|
|
59
59
|
import { ref, toRef, computed, defineComponent } from "vue";
|
|
60
60
|
import { twMerge } from "tailwind-merge";
|
|
61
|
+
import { useScroll, useResizeObserver, useElementSize } from "@vueuse/core";
|
|
61
62
|
import { mergeConfig } from "../../utils";
|
|
62
63
|
import UButton from "../elements/Button.vue";
|
|
63
64
|
import { useUI } from "../../composables/useUI";
|
|
64
65
|
import { useCarouselScroll } from "../../composables/useCarouselScroll";
|
|
65
|
-
import { useScroll, useResizeObserver, useElementSize } from "@vueuse/core";
|
|
66
66
|
import appConfig from "#build/app.config";
|
|
67
67
|
import { carousel } from "#ui/ui.config";
|
|
68
68
|
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.carousel, carousel);
|
|
@@ -84,6 +84,10 @@ export default defineComponent({
|
|
|
84
84
|
type: Boolean,
|
|
85
85
|
default: false
|
|
86
86
|
},
|
|
87
|
+
dir: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: "ltr"
|
|
90
|
+
},
|
|
87
91
|
prevButton: {
|
|
88
92
|
type: Object,
|
|
89
93
|
default: () => config.default.prevButton
|
|
@@ -112,28 +116,33 @@ export default defineComponent({
|
|
|
112
116
|
const [entry] = entries;
|
|
113
117
|
itemWidth.value = entry?.target?.firstElementChild?.clientWidth || 0;
|
|
114
118
|
});
|
|
119
|
+
const isRtl = computed(() => props.dir === "rtl");
|
|
115
120
|
const currentPage = computed(() => {
|
|
116
121
|
if (!itemWidth.value) {
|
|
117
122
|
return 0;
|
|
118
123
|
}
|
|
119
|
-
return Math.round(x.value / itemWidth.value) + 1;
|
|
124
|
+
return isRtl.value ? Math.round(-x.value / itemWidth.value) + 1 : Math.round(x.value / itemWidth.value) + 1;
|
|
120
125
|
});
|
|
121
126
|
const pages = computed(() => {
|
|
122
127
|
if (!itemWidth.value) {
|
|
123
128
|
return 0;
|
|
124
129
|
}
|
|
125
|
-
|
|
130
|
+
const itemDivisions = Math.round(carouselWidth.value / itemWidth.value);
|
|
131
|
+
if (props.items.length <= itemDivisions) {
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
134
|
+
return props.items.length - itemDivisions + 1;
|
|
126
135
|
});
|
|
127
136
|
const isFirst = computed(() => currentPage.value <= 1);
|
|
128
137
|
const isLast = computed(() => currentPage.value === pages.value);
|
|
129
138
|
function onClickNext() {
|
|
130
|
-
x.value += itemWidth.value;
|
|
139
|
+
x.value += isRtl.value ? -itemWidth.value : itemWidth.value;
|
|
131
140
|
}
|
|
132
141
|
function onClickPrev() {
|
|
133
|
-
x.value -= itemWidth.value;
|
|
142
|
+
x.value -= isRtl.value ? -itemWidth.value : itemWidth.value;
|
|
134
143
|
}
|
|
135
144
|
function onClick(page) {
|
|
136
|
-
x.value = (page - 1) * itemWidth.value;
|
|
145
|
+
x.value = (page - 1) * itemWidth.value * (isRtl.value ? -1 : 1);
|
|
137
146
|
}
|
|
138
147
|
expose({
|
|
139
148
|
pages,
|
|
@@ -39,6 +39,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
39
39
|
type: BooleanConstructor;
|
|
40
40
|
default: boolean;
|
|
41
41
|
};
|
|
42
|
+
dir: {
|
|
43
|
+
type: PropType<"ltr" | "rtl">;
|
|
44
|
+
default: string;
|
|
45
|
+
};
|
|
42
46
|
prevButton: {
|
|
43
47
|
type: PropType<Button & {
|
|
44
48
|
class?: string;
|
|
@@ -117,6 +121,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
117
121
|
type: BooleanConstructor;
|
|
118
122
|
default: boolean;
|
|
119
123
|
};
|
|
124
|
+
dir: {
|
|
125
|
+
type: PropType<"ltr" | "rtl">;
|
|
126
|
+
default: string;
|
|
127
|
+
};
|
|
120
128
|
prevButton: {
|
|
121
129
|
type: PropType<Button & {
|
|
122
130
|
class?: string;
|
|
@@ -176,6 +184,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
176
184
|
items: any[];
|
|
177
185
|
arrows: boolean;
|
|
178
186
|
indicators: boolean;
|
|
187
|
+
dir: "ltr" | "rtl";
|
|
179
188
|
prevButton: Button & {
|
|
180
189
|
class?: string;
|
|
181
190
|
};
|