nuance-ui 0.1.27 → 0.1.28
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.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { RowData, TableMeta } from '@tanstack/table-core';
|
|
2
2
|
import type { CellContext, ColumnDef, ColumnFiltersOptions, ColumnPinningOptions, ColumnSizingOptions, CoreOptions, ExpandedOptions, FacetedOptions, GlobalFilterOptions, GroupingOptions, HeaderContext, PaginationOptions, Row, RowPinningOptions, RowSelectionOptions, SortingOptions, VisibilityOptions } from '@tanstack/vue-table';
|
|
3
3
|
import type { VirtualizerOptions } from '@tanstack/vue-virtual';
|
|
4
|
-
import type { TableHTMLAttributes, WatchOptions } from 'vue';
|
|
4
|
+
import type { CSSProperties, TableHTMLAttributes, WatchOptions } from 'vue';
|
|
5
5
|
import type { NuanceColor } from '../../types/index.js';
|
|
6
6
|
export type TableRow<T> = Row<T>;
|
|
7
7
|
export type TableData = RowData;
|
|
8
|
-
export type TableColumn<T extends TableData, D =
|
|
8
|
+
export type TableColumn<T extends TableData, D = any> = ColumnDef<T, D>;
|
|
9
9
|
export interface TableOptions<T extends TableData = TableData> extends Omit<CoreOptions<T>, 'data' | 'columns' | 'getCoreRowModel' | 'state' | 'onStateChange' | 'renderFallbackValue'> {
|
|
10
10
|
state?: CoreOptions<T>['state'];
|
|
11
11
|
onStateChange?: CoreOptions<T>['onStateChange'];
|
|
@@ -63,6 +63,7 @@ export interface TableProps<T extends TableData = TableData> extends TableOption
|
|
|
63
63
|
* @defaultValue 'primary'
|
|
64
64
|
*/
|
|
65
65
|
loadingColor?: NuanceColor | string;
|
|
66
|
+
verticalAlign?: CSSProperties['verticalAlign'];
|
|
66
67
|
onSelect?: (e: Event, row: TableRow<T>) => void;
|
|
67
68
|
onHover?: (e: Event, row: TableRow<T> | null) => void;
|
|
68
69
|
onContextmenu?: ((e: Event, row: TableRow<T>) => void) | Array<((e: Event, row: TableRow<T>) => void)>;
|
|
@@ -71,6 +72,7 @@ export interface TableProps<T extends TableData = TableData> extends TableOption
|
|
|
71
72
|
table?: string;
|
|
72
73
|
thead?: string;
|
|
73
74
|
th?: string;
|
|
75
|
+
td?: string;
|
|
74
76
|
tr?: string;
|
|
75
77
|
tbody?: string;
|
|
76
78
|
tfoot?: string;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
FlexRender,
|
|
4
|
+
getCoreRowModel,
|
|
5
|
+
getExpandedRowModel,
|
|
6
|
+
getFilteredRowModel,
|
|
7
|
+
getSortedRowModel,
|
|
8
|
+
useVueTable
|
|
9
|
+
} from "@tanstack/vue-table";
|
|
3
10
|
import { useVirtualizer } from "@tanstack/vue-virtual";
|
|
4
11
|
import { reactivePick, unrefElement } from "@vueuse/core";
|
|
5
12
|
import { useStyleResolver } from "#imports";
|
|
@@ -20,6 +27,7 @@ const props = defineProps({
|
|
|
20
27
|
sticky: { type: [Boolean, String], required: false },
|
|
21
28
|
loading: { type: Boolean, required: false },
|
|
22
29
|
loadingColor: { type: null, required: false },
|
|
30
|
+
verticalAlign: { type: null, required: false },
|
|
23
31
|
onSelect: { type: Function, required: false },
|
|
24
32
|
onHover: { type: Function, required: false },
|
|
25
33
|
onContextmenu: { type: [Function, Array], required: false },
|
|
@@ -220,7 +228,8 @@ const renderedSize = computed(() => {
|
|
|
220
228
|
return virtualItems.reduce((sum, item) => sum + item.size, 0);
|
|
221
229
|
});
|
|
222
230
|
const style = computed(() => useStyleResolver((theme) => ({
|
|
223
|
-
"--table-loader-color": props.loadingColor ? getThemeColor(props.loadingColor, theme) : void 0
|
|
231
|
+
"--table-loader-color": props.loadingColor ? getThemeColor(props.loadingColor, theme) : void 0,
|
|
232
|
+
"--vertical-align": props.verticalAlign
|
|
224
233
|
})));
|
|
225
234
|
defineExpose({
|
|
226
235
|
get $el() {
|
|
@@ -374,6 +383,9 @@ defineExpose({
|
|
|
374
383
|
--table-color: var(--color-primary-4);
|
|
375
384
|
--table-loader-color: var(--table-color);
|
|
376
385
|
--table-loader-animation: carousel 2s ease-in-out infinite;
|
|
386
|
+
--table-padding-x: .5rem;
|
|
387
|
+
--table-padding-y: .5rem;
|
|
388
|
+
--vertical-align: baseline;
|
|
377
389
|
|
|
378
390
|
@mixin where-light {
|
|
379
391
|
--table-active-bg: alpha(var(--color-slate-1), .5);
|
|
@@ -431,10 +443,11 @@ defineExpose({
|
|
|
431
443
|
|
|
432
444
|
.th {
|
|
433
445
|
font-weight: 600;
|
|
434
|
-
padding-block:
|
|
435
|
-
padding-inline:
|
|
446
|
+
padding-block: var(--table-padding-y);
|
|
447
|
+
padding-inline: var(--table-padding-x);
|
|
436
448
|
text-align: left;
|
|
437
449
|
color: var(--table-c);
|
|
450
|
+
vertical-align: var(--vertical-align);
|
|
438
451
|
|
|
439
452
|
&:has([role='checkbox']) {
|
|
440
453
|
padding-inline-end: 0;
|
|
@@ -482,8 +495,10 @@ defineExpose({
|
|
|
482
495
|
|
|
483
496
|
td {
|
|
484
497
|
white-space: nowrap;
|
|
485
|
-
padding:
|
|
498
|
+
padding-block: var(--table-padding-y);
|
|
499
|
+
padding-inline: var(--table-padding-x);
|
|
486
500
|
color: var(--table-c);
|
|
501
|
+
vertical-align: var(--vertical-align);
|
|
487
502
|
|
|
488
503
|
&:has([role='checkbox']) {
|
|
489
504
|
padding-inline-end: 0;
|