mood-ui 0.1.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/LICENSE +21 -0
- package/README.OLD.md +5 -0
- package/README.md +84 -0
- package/dist/components/ModoProvider.vue.d.ts +61 -0
- package/dist/components/data-display/Card.vue.d.ts +26 -0
- package/dist/components/data-display/Typography.vue.d.ts +21 -0
- package/dist/components/data-display/avatar/Avatar.vue.d.ts +9 -0
- package/dist/components/data-display/avatar/AvatarGroup.vue.d.ts +7 -0
- package/dist/components/data-display/calendar/AgendaView.vue.d.ts +76 -0
- package/dist/components/data-display/calendar/Calendar.vue.d.ts +25 -0
- package/dist/components/data-display/calendar/CalendarEventTooltip.vue.d.ts +34 -0
- package/dist/components/data-display/calendar/CalendarHeader.vue.d.ts +67 -0
- package/dist/components/data-display/calendar/DayView.vue.d.ts +91 -0
- package/dist/components/data-display/calendar/MonthView.vue.d.ts +71 -0
- package/dist/components/data-display/calendar/Scheduler.vue.d.ts +102 -0
- package/dist/components/data-display/calendar/WeekView.vue.d.ts +101 -0
- package/dist/components/data-display/date-picker/DateRangePicker.vue.d.ts +18 -0
- package/dist/components/data-display/date-picker/DateTimePicker.vue.d.ts +17 -0
- package/dist/components/data-display/table/Table.vue.d.ts +75 -0
- package/dist/components/data-display/table/TableColumn.vue.d.ts +26 -0
- package/dist/components/data-display/table/TablePagination.vue.d.ts +14 -0
- package/dist/components/feedback/Badge.vue.d.ts +24 -0
- package/dist/components/feedback/Banner.vue.d.ts +28 -0
- package/dist/components/feedback/Chip.vue.d.ts +22 -0
- package/dist/components/feedback/ConfirmDialog.vue.d.ts +4 -0
- package/dist/components/feedback/Drawer.vue.d.ts +43 -0
- package/dist/components/feedback/EmptyState.vue.d.ts +19 -0
- package/dist/components/feedback/Loader.vue.d.ts +7 -0
- package/dist/components/feedback/Modal.vue.d.ts +44 -0
- package/dist/components/feedback/ProgressBar.vue.d.ts +10 -0
- package/dist/components/feedback/Skeleton.vue.d.ts +10 -0
- package/dist/components/feedback/Toast.vue.d.ts +19 -0
- package/dist/components/feedback/ToastContainer.vue.d.ts +11 -0
- package/dist/components/feedback/Tooltip.vue.d.ts +35 -0
- package/dist/components/forms/Button.vue.d.ts +24 -0
- package/dist/components/forms/ButtonGroup.vue.d.ts +16 -0
- package/dist/components/forms/Checkbox.vue.d.ts +22 -0
- package/dist/components/forms/Combobox.vue.d.ts +48 -0
- package/dist/components/forms/DateField.vue.d.ts +30 -0
- package/dist/components/forms/DateRangeField.vue.d.ts +32 -0
- package/dist/components/forms/DateTimeField.vue.d.ts +34 -0
- package/dist/components/forms/FileInput.vue.d.ts +33 -0
- package/dist/components/forms/FormField.vue.d.ts +30 -0
- package/dist/components/forms/Input.vue.d.ts +33 -0
- package/dist/components/forms/MultiSelect.vue.d.ts +51 -0
- package/dist/components/forms/NumberInput.vue.d.ts +35 -0
- package/dist/components/forms/PasswordInput.vue.d.ts +40 -0
- package/dist/components/forms/Radio.vue.d.ts +16 -0
- package/dist/components/forms/RadioGroup.vue.d.ts +27 -0
- package/dist/components/forms/RangeSlider.vue.d.ts +27 -0
- package/dist/components/forms/SearchInput.vue.d.ts +37 -0
- package/dist/components/forms/Select.vue.d.ts +46 -0
- package/dist/components/forms/Slider.vue.d.ts +26 -0
- package/dist/components/forms/Switch.vue.d.ts +22 -0
- package/dist/components/forms/Textarea.vue.d.ts +36 -0
- package/dist/components/layout/AppShell.vue.d.ts +124 -0
- package/dist/components/layout/Canvas.vue.d.ts +21 -0
- package/dist/components/layout/Container.vue.d.ts +21 -0
- package/dist/components/layout/Divider.vue.d.ts +21 -0
- package/dist/components/layout/HStack.vue.d.ts +14 -0
- package/dist/components/layout/PageHeader.vue.d.ts +34 -0
- package/dist/components/layout/PopoverPanel.vue.d.ts +29 -0
- package/dist/components/layout/Sidebar.vue.d.ts +39 -0
- package/dist/components/layout/SidebarRow.vue.d.ts +31 -0
- package/dist/components/layout/SidebarRowContent.vue.d.ts +27 -0
- package/dist/components/layout/Stack.vue.d.ts +24 -0
- package/dist/components/layout/Topbar.vue.d.ts +36 -0
- package/dist/components/layout/VStack.vue.d.ts +14 -0
- package/dist/components/navigation/Breadcrumbs.vue.d.ts +13 -0
- package/dist/components/navigation/DropdownMenu.vue.d.ts +36 -0
- package/dist/components/navigation/Pagination.vue.d.ts +18 -0
- package/dist/components/navigation/Tabs.vue.d.ts +37 -0
- package/dist/composables/eventColors.d.ts +13 -0
- package/dist/composables/useAutoScroll.d.ts +11 -0
- package/dist/composables/useCalendar.d.ts +44 -0
- package/dist/composables/useCalendarKeyboard.d.ts +17 -0
- package/dist/composables/useCalendarTheme.d.ts +22 -0
- package/dist/composables/useColorMode.d.ts +28 -0
- package/dist/composables/useConfirm.d.ts +146 -0
- package/dist/composables/useCurrentTimeLine.d.ts +5 -0
- package/dist/composables/useEventHover.d.ts +29 -0
- package/dist/composables/useField.d.ts +89 -0
- package/dist/composables/useModoConfig.d.ts +29 -0
- package/dist/composables/usePopover.d.ts +59 -0
- package/dist/composables/useTable.d.ts +29 -0
- package/dist/composables/useTableColumnsState.d.ts +52 -0
- package/dist/composables/useTableFilter.d.ts +39 -0
- package/dist/composables/useTableKeyboard.d.ts +38 -0
- package/dist/composables/useTablePagination.d.ts +44 -0
- package/dist/composables/useTableQuery.d.ts +90 -0
- package/dist/composables/useTableSelection.d.ts +40 -0
- package/dist/composables/useTableSort.d.ts +41 -0
- package/dist/composables/useTableTree.d.ts +55 -0
- package/dist/composables/useTableUrlSync.d.ts +66 -0
- package/dist/composables/useTableVirtual.d.ts +43 -0
- package/dist/composables/useTimeGrid.d.ts +22 -0
- package/dist/composables/useToast.d.ts +176 -0
- package/dist/config/ModoConfig.d.ts +32 -0
- package/dist/config/ModoLocale.d.ts +212 -0
- package/dist/config/colorPrimitives.d.ts +13 -0
- package/dist/config/createModoUI.d.ts +85 -0
- package/dist/config/palettes.d.ts +30 -0
- package/dist/index.d.ts +130 -0
- package/dist/interfaces/data-display/Card.interface.d.ts +8 -0
- package/dist/interfaces/data-display/Typography.interface.d.ts +12 -0
- package/dist/interfaces/data-display/avatar/Avatar.interface.d.ts +24 -0
- package/dist/interfaces/data-display/avatar/AvatarGroup.interface.d.ts +8 -0
- package/dist/interfaces/data-display/calendar/AgendaView.interface.d.ts +29 -0
- package/dist/interfaces/data-display/calendar/Calendar.interface.d.ts +16 -0
- package/dist/interfaces/data-display/calendar/DayView.interface.d.ts +43 -0
- package/dist/interfaces/data-display/calendar/MonthView.interface.d.ts +41 -0
- package/dist/interfaces/data-display/calendar/Scheduler.interface.d.ts +63 -0
- package/dist/interfaces/data-display/calendar/WeekView.interface.d.ts +65 -0
- package/dist/interfaces/data-display/date-picker/DateRangePicker.interface.d.ts +20 -0
- package/dist/interfaces/data-display/date-picker/DateTimePicker.interface.d.ts +16 -0
- package/dist/interfaces/data-display/table/Table.interface.d.ts +615 -0
- package/dist/interfaces/data-display/table/TableColumn.interface.d.ts +10 -0
- package/dist/interfaces/data-display/table/TablePagination.interface.d.ts +33 -0
- package/dist/interfaces/feedback/Badge.interface.d.ts +14 -0
- package/dist/interfaces/feedback/Banner.interface.d.ts +14 -0
- package/dist/interfaces/feedback/Chip.interface.d.ts +35 -0
- package/dist/interfaces/feedback/ConfirmDialog.interface.d.ts +49 -0
- package/dist/interfaces/feedback/Drawer.interface.d.ts +49 -0
- package/dist/interfaces/feedback/EmptyState.interface.d.ts +31 -0
- package/dist/interfaces/feedback/Loader.interface.d.ts +7 -0
- package/dist/interfaces/feedback/Modal.interface.d.ts +50 -0
- package/dist/interfaces/feedback/ProgressBar.interface.d.ts +31 -0
- package/dist/interfaces/feedback/Skeleton.interface.d.ts +123 -0
- package/dist/interfaces/feedback/Toast.interface.d.ts +86 -0
- package/dist/interfaces/feedback/Tooltip.interface.d.ts +38 -0
- package/dist/interfaces/forms/Button.interface.d.ts +26 -0
- package/dist/interfaces/forms/ButtonGroup.interface.d.ts +9 -0
- package/dist/interfaces/forms/Checkbox.interface.d.ts +32 -0
- package/dist/interfaces/forms/Combobox.interface.d.ts +57 -0
- package/dist/interfaces/forms/DateField.interface.d.ts +39 -0
- package/dist/interfaces/forms/DateRangeField.interface.d.ts +41 -0
- package/dist/interfaces/forms/DateTimeField.interface.d.ts +44 -0
- package/dist/interfaces/forms/FileInput.interface.d.ts +105 -0
- package/dist/interfaces/forms/FormField.interface.d.ts +55 -0
- package/dist/interfaces/forms/Input.interface.d.ts +68 -0
- package/dist/interfaces/forms/NumberInput.interface.d.ts +77 -0
- package/dist/interfaces/forms/PasswordInput.interface.d.ts +84 -0
- package/dist/interfaces/forms/Radio.interface.d.ts +54 -0
- package/dist/interfaces/forms/RadioGroup.context.d.ts +13 -0
- package/dist/interfaces/forms/RangeSlider.interface.d.ts +30 -0
- package/dist/interfaces/forms/SearchInput.interface.d.ts +59 -0
- package/dist/interfaces/forms/Select.interface.d.ts +145 -0
- package/dist/interfaces/forms/Slider.interface.d.ts +36 -0
- package/dist/interfaces/forms/Switch.interface.d.ts +30 -0
- package/dist/interfaces/forms/Textarea.interface.d.ts +64 -0
- package/dist/interfaces/layout/AppShell.interface.d.ts +56 -0
- package/dist/interfaces/layout/Canvas.interface.d.ts +39 -0
- package/dist/interfaces/layout/Container.interface.d.ts +8 -0
- package/dist/interfaces/layout/Divider.interface.d.ts +53 -0
- package/dist/interfaces/layout/PageHeader.interface.d.ts +23 -0
- package/dist/interfaces/layout/Sidebar.interface.d.ts +88 -0
- package/dist/interfaces/layout/Stack.interface.d.ts +42 -0
- package/dist/interfaces/layout/Topbar.interface.d.ts +28 -0
- package/dist/interfaces/navigation/Breadcrumbs.interface.d.ts +38 -0
- package/dist/interfaces/navigation/DropdownMenu.interface.d.ts +72 -0
- package/dist/interfaces/navigation/Pagination.interface.d.ts +37 -0
- package/dist/interfaces/navigation/Tabs.interface.d.ts +74 -0
- package/dist/mood-ui.cjs +4 -0
- package/dist/mood-ui.cjs.map +1 -0
- package/dist/mood-ui.css +2 -0
- package/dist/mood-ui.mjs +19832 -0
- package/dist/mood-ui.mjs.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
import { VNode } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Logical type of a column. Used for two purposes only:
|
|
4
|
+
* 1. Default cell formatting (right-align numbers, em-dash for null, etc.).
|
|
5
|
+
* 2. Default `skeletonShape` when `loading` is true.
|
|
6
|
+
*
|
|
7
|
+
* Consumers can always override via the `cell` slot or `skeletonShape`.
|
|
8
|
+
*/
|
|
9
|
+
export type TableColumnType = 'text' | 'number' | 'date' | 'boolean' | 'chip' | 'avatar' | 'custom';
|
|
10
|
+
export type TableColumnAlign = 'left' | 'center' | 'right';
|
|
11
|
+
/**
|
|
12
|
+
* One column declaration (used by the array API and as the normalized form
|
|
13
|
+
* after collecting `<TableColumn>` children).
|
|
14
|
+
*
|
|
15
|
+
* `key` is the column id and the lookup path into each row by default. For
|
|
16
|
+
* nested fields use `accessor` (a function) instead.
|
|
17
|
+
*/
|
|
18
|
+
export interface TableColumn<TRow = any> {
|
|
19
|
+
/** Stable identifier. Also the default field path into the row. */
|
|
20
|
+
key: string;
|
|
21
|
+
/** Header text. Use `headerSlot` or `<TableColumn>` children for rich content. */
|
|
22
|
+
header?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Optional descriptive text shown in a tooltip on the column header.
|
|
25
|
+
* Useful for explaining abbreviations, units, or business rules.
|
|
26
|
+
* Wraps the header label in a `<Tooltip>` (Phase 5e).
|
|
27
|
+
*/
|
|
28
|
+
description?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Custom value extractor. When omitted, the value is `row[key]` (with
|
|
31
|
+
* a single level of dot-path support, e.g. `'profile.name'`).
|
|
32
|
+
*/
|
|
33
|
+
accessor?: (row: TRow, index: number) => unknown;
|
|
34
|
+
/**
|
|
35
|
+
* Logical type. Drives:
|
|
36
|
+
* - default `align` (numbers → right, others → left).
|
|
37
|
+
* - default `skeletonShape` when loading.
|
|
38
|
+
* - default cell formatting (date → locale string, boolean → ✓/—).
|
|
39
|
+
* @default 'text'
|
|
40
|
+
*/
|
|
41
|
+
type?: TableColumnType;
|
|
42
|
+
/** Horizontal alignment override. */
|
|
43
|
+
align?: TableColumnAlign;
|
|
44
|
+
/**
|
|
45
|
+
* Fixed width. Accepts any CSS length (`'12rem'`, `120`, `'10%'`).
|
|
46
|
+
* Omit for auto-sizing.
|
|
47
|
+
*/
|
|
48
|
+
width?: string | number;
|
|
49
|
+
/** Minimum width — useful with `overflow="truncate"` to avoid collapse. */
|
|
50
|
+
minWidth?: string | number;
|
|
51
|
+
/**
|
|
52
|
+
* Reserved for Fase 2: enables sort UI and `aria-sort` on the header.
|
|
53
|
+
* Already part of the contract so consumers can declare it now.
|
|
54
|
+
*/
|
|
55
|
+
sortable?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Pins the column to the start (`'left'`) or end (`'right'`) of the
|
|
58
|
+
* scroll viewport. Pinned columns stay visible while the rest scroll
|
|
59
|
+
* horizontally. Order within a pin group follows declaration order
|
|
60
|
+
* (or `columnsState.order` if provided). Reordering is allowed but
|
|
61
|
+
* does not move columns across pin groups.
|
|
62
|
+
*/
|
|
63
|
+
pinned?: 'left' | 'right';
|
|
64
|
+
/** Extra classes applied to every body `<td>` of this column. */
|
|
65
|
+
cellClass?: string;
|
|
66
|
+
/** Extra classes applied to the column's `<th>` header. */
|
|
67
|
+
headerClass?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Controls the auto-tooltip applied to truncated cells (when the
|
|
70
|
+
* parent `<Table overflow="truncate">`).
|
|
71
|
+
*
|
|
72
|
+
* - `undefined` (default): use a native `title` with the formatted
|
|
73
|
+
* value, but only when there is no custom `renderCell` or
|
|
74
|
+
* `#cell-{key}` slot (the host owns those).
|
|
75
|
+
* - `false`: never set a title for this column.
|
|
76
|
+
* - `(row, value, index) => string`: custom title (useful for
|
|
77
|
+
* formatted slots — e.g. show full ISO date when slot prints
|
|
78
|
+
* short locale date).
|
|
79
|
+
*/
|
|
80
|
+
truncateTooltip?: false | ((row: TRow, value: unknown, index: number) => string | null | undefined);
|
|
81
|
+
/**
|
|
82
|
+
* Override the skeleton shape when `loading=true`. If omitted, the
|
|
83
|
+
* shape is inferred from `type` (text → `text`, chip → `chip`, …).
|
|
84
|
+
*/
|
|
85
|
+
skeletonShape?: 'text' | 'title' | 'rect' | 'circle' | 'avatar' | 'button' | 'chip' | 'badge';
|
|
86
|
+
/**
|
|
87
|
+
* Enables a per-column filter input rendered below the header. When
|
|
88
|
+
* `true`, a basic text "contains" filter is used; for richer UX use
|
|
89
|
+
* the `#filter-{key}` slot or the `filter` shape below.
|
|
90
|
+
*/
|
|
91
|
+
filterable?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Filter behavior when `filterable=true`. Defaults to `'contains'`
|
|
94
|
+
* with case-insensitive `String(value).includes(input)`.
|
|
95
|
+
* - `'contains' | 'startsWith' | 'equals'` — string ops on the value.
|
|
96
|
+
* - `(value, input, row) => boolean` — fully custom predicate.
|
|
97
|
+
*/
|
|
98
|
+
filter?: 'contains' | 'startsWith' | 'equals' | ((value: unknown, input: string, row: TRow) => boolean);
|
|
99
|
+
/**
|
|
100
|
+
* Opt this column out of user column resizing even when the parent
|
|
101
|
+
* `<Table>` has `resizable` enabled. The column keeps its declared
|
|
102
|
+
* `width` / `minWidth`. @default true (resizable when parent is)
|
|
103
|
+
*/
|
|
104
|
+
resizable?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Opt this column out of user column reordering. Useful for sticky
|
|
107
|
+
* identity columns (checkboxes, avatars). @default true when parent
|
|
108
|
+
* `reorderable` is on.
|
|
109
|
+
*/
|
|
110
|
+
reorderable?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Enables inline cell editing for this column. When `true`, double-click
|
|
113
|
+
* (or `F2` / `Enter` on a focused cell) switches the cell to an
|
|
114
|
+
* `<input>` editor. Pass a predicate to allow editing only on certain
|
|
115
|
+
* rows (e.g. status-dependent). @default false
|
|
116
|
+
*/
|
|
117
|
+
editable?: boolean | ((row: TRow, index: number) => boolean);
|
|
118
|
+
/**
|
|
119
|
+
* Input type used by the inline editor. When omitted, it's inferred
|
|
120
|
+
* from `type` (`number` → `'number'`, otherwise `'text'`).
|
|
121
|
+
*/
|
|
122
|
+
editType?: 'text' | 'number';
|
|
123
|
+
/**
|
|
124
|
+
* Validates the draft value before commit. Return `null`/`undefined`
|
|
125
|
+
* when valid, or a non-empty string with an error message to keep the
|
|
126
|
+
* editor open and announce the error. Receives the parsed value
|
|
127
|
+
* (string or number depending on `editType`).
|
|
128
|
+
*/
|
|
129
|
+
editValidator?: (value: string | number, row: TRow, index: number) => string | null | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Reducer that produces a summary value for this column. Used by
|
|
132
|
+
* group headers (when `<Table groupBy>` is set) and may also be
|
|
133
|
+
* surfaced via the `#footer` slot.
|
|
134
|
+
*
|
|
135
|
+
* - `'sum' | 'avg' | 'min' | 'max'` — numeric reducers, ignore non-numbers.
|
|
136
|
+
* - `'count'` — number of rows in the group.
|
|
137
|
+
* - `(rows, key) => unknown` — fully custom reducer.
|
|
138
|
+
*
|
|
139
|
+
* The result is rendered through `defaultFormat` (numbers → locale
|
|
140
|
+
* string, dates → date string, etc.) unless a `#group-header` or
|
|
141
|
+
* `#cell-{key}` slot intercepts the rendering.
|
|
142
|
+
*/
|
|
143
|
+
aggregate?: 'sum' | 'avg' | 'min' | 'max' | 'count' | ((rows: TRow[], key: string) => unknown);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Internal: a fully-resolved column. Always has `align` + `type` set.
|
|
147
|
+
* Components only ever consume this shape.
|
|
148
|
+
*/
|
|
149
|
+
export interface NormalizedTableColumn<TRow = any> extends TableColumn<TRow> {
|
|
150
|
+
align: TableColumnAlign;
|
|
151
|
+
type: TableColumnType;
|
|
152
|
+
/**
|
|
153
|
+
* When the column was declared via `<TableColumn>` children, this holds
|
|
154
|
+
* its render functions (cell + header) so the parent `<Table>` can
|
|
155
|
+
* project them into the right `<td>`/`<th>`.
|
|
156
|
+
*/
|
|
157
|
+
renderCell?: (ctx: {
|
|
158
|
+
row: TRow;
|
|
159
|
+
value: unknown;
|
|
160
|
+
index: number;
|
|
161
|
+
}) => VNode | VNode[] | string | number | null | undefined;
|
|
162
|
+
renderHeader?: () => VNode | VNode[] | string | number | null | undefined;
|
|
163
|
+
}
|
|
164
|
+
export type TableSortDirection = 'asc' | 'desc';
|
|
165
|
+
/** One sort criterion (column key + direction). */
|
|
166
|
+
export interface TableSortCriterion {
|
|
167
|
+
key: string;
|
|
168
|
+
direction: TableSortDirection;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Sort state. An array enables multi-column sorting (priority = order).
|
|
172
|
+
* `null` means no sort. Use a single-element array for single-column sort.
|
|
173
|
+
*/
|
|
174
|
+
export type TableSortState = TableSortCriterion[];
|
|
175
|
+
export type TableSelectionMode = 'none' | 'single' | 'multi';
|
|
176
|
+
/**
|
|
177
|
+
* Selected row keys. For `single` it's a 0/1-element array (kept as array
|
|
178
|
+
* for API uniformity so consumers don't need to branch on the mode).
|
|
179
|
+
*/
|
|
180
|
+
export type TableSelection = (string | number)[];
|
|
181
|
+
/**
|
|
182
|
+
* Per-column runtime state: width (after user resize), order position,
|
|
183
|
+
* and hidden flag. Bound to `<Table>` via `v-model:columnsState` so the
|
|
184
|
+
* host can persist user preferences (localStorage, URL, backend).
|
|
185
|
+
*
|
|
186
|
+
* Entries not present in the state default to the declared column's
|
|
187
|
+
* width + natural order + visible.
|
|
188
|
+
*/
|
|
189
|
+
export interface TableColumnState {
|
|
190
|
+
/** Column identifier — must match `column.key`. */
|
|
191
|
+
key: string;
|
|
192
|
+
/** User-resized width in CSS pixels. Omit to use the declared width. */
|
|
193
|
+
width?: number;
|
|
194
|
+
/**
|
|
195
|
+
* Logical position, 0-based. Columns without an `order` render after
|
|
196
|
+
* ones with an order (in declaration sequence). Duplicates are
|
|
197
|
+
* stable-sorted by original index.
|
|
198
|
+
*/
|
|
199
|
+
order?: number;
|
|
200
|
+
/** When true the column is not rendered (toolbar / column chooser). */
|
|
201
|
+
hidden?: boolean;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Single serializable snapshot of every user-controlled bit of state in
|
|
205
|
+
* a `<Table>`. Useful to persist UI preferences in one go (localStorage,
|
|
206
|
+
* URL hash, backend user-settings) instead of wiring each v-model
|
|
207
|
+
* separately. Each field is optional so callers can opt-in piecemeal.
|
|
208
|
+
*
|
|
209
|
+
* The shape is plain JSON — no Date / Map / Set — so `JSON.stringify`
|
|
210
|
+
* round-trips without custom replacers.
|
|
211
|
+
*/
|
|
212
|
+
export interface TableStateSnapshot {
|
|
213
|
+
sort?: TableSortState;
|
|
214
|
+
filter?: TableFilterState;
|
|
215
|
+
/** 1-based page + page size + (optional) total. */
|
|
216
|
+
pagination?: {
|
|
217
|
+
page: number;
|
|
218
|
+
pageSize: number;
|
|
219
|
+
total?: number;
|
|
220
|
+
};
|
|
221
|
+
/** Per-column user state (resize / reorder / visibility). */
|
|
222
|
+
columnsState?: TableColumnState[];
|
|
223
|
+
/** Global search box value. */
|
|
224
|
+
globalSearchTerm?: string;
|
|
225
|
+
/** Selected row keys. */
|
|
226
|
+
selected?: TableSelection;
|
|
227
|
+
/** Schema version. Bump this in your app when shape changes so old
|
|
228
|
+
* persisted snapshots can be migrated/dropped. @default 1 */
|
|
229
|
+
version?: number;
|
|
230
|
+
}
|
|
231
|
+
/** Map of `{ [columnKey]: filterValue }`. Empty/undefined entries are ignored. */
|
|
232
|
+
export type TableFilterState = Record<string, string>;
|
|
233
|
+
/** Set of expanded row keys (resolved via `rowKey`). */
|
|
234
|
+
export type TableExpansionState = (string | number)[];
|
|
235
|
+
/**
|
|
236
|
+
* Pagination state. Bind with `v-model:pagination` for controlled mode,
|
|
237
|
+
* or pass an initial object and let the table mutate it.
|
|
238
|
+
*
|
|
239
|
+
* `total` is optional in client-side mode (the table derives it from
|
|
240
|
+
* the filtered row count). For server-side pagination set `total`
|
|
241
|
+
* yourself when each page arrives.
|
|
242
|
+
*/
|
|
243
|
+
export interface TablePaginationState {
|
|
244
|
+
/** 1-based page index. @default 1 */
|
|
245
|
+
page: number;
|
|
246
|
+
/** Rows per page. @default 10 */
|
|
247
|
+
pageSize: number;
|
|
248
|
+
/** Total rows across every page (server mode). Optional in client mode. */
|
|
249
|
+
total?: number;
|
|
250
|
+
}
|
|
251
|
+
export interface Table<TRow = any> {
|
|
252
|
+
/** Row data. Keyed by `rowKey` for v-model:selected and Vue keying. */
|
|
253
|
+
data: TRow[];
|
|
254
|
+
/**
|
|
255
|
+
* Column definitions. Optional — you can also declare columns
|
|
256
|
+
* inline as `<TableColumn>` children of `<Table>`. When both are
|
|
257
|
+
* provided, `columns` wins (children are ignored).
|
|
258
|
+
*/
|
|
259
|
+
columns?: TableColumn<TRow>[];
|
|
260
|
+
/**
|
|
261
|
+
* Row identity. Either a property key on the row or a function. Used
|
|
262
|
+
* for Vue's `:key` and for `v-model:selected`.
|
|
263
|
+
* @default 'id'
|
|
264
|
+
*/
|
|
265
|
+
rowKey?: string | ((row: TRow, index: number) => string | number);
|
|
266
|
+
/**
|
|
267
|
+
* Sizing scale. Drives row height + cell padding + font size.
|
|
268
|
+
* @default 'medium'
|
|
269
|
+
*/
|
|
270
|
+
size?: 'small' | 'medium' | 'large';
|
|
271
|
+
/** Alternating row background. @default false */
|
|
272
|
+
striped?: boolean;
|
|
273
|
+
/**
|
|
274
|
+
* Border layout. `'rows'` only horizontal separators between rows;
|
|
275
|
+
* `'cols'` only vertical between columns; `'all'` both; `'none'` clean.
|
|
276
|
+
* @default 'rows'
|
|
277
|
+
*/
|
|
278
|
+
bordered?: 'none' | 'rows' | 'cols' | 'all';
|
|
279
|
+
/** Highlight the row under the cursor. @default true */
|
|
280
|
+
hover?: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Density mirrors a real component prop and supersedes `dense`.
|
|
283
|
+
* - `comfortable` (default) — full padding per `size`.
|
|
284
|
+
* - `compact` — half padding, ~32 px row.
|
|
285
|
+
* - `spacious` — extra padding, suited to avatar+two-line rows.
|
|
286
|
+
* @default 'comfortable'
|
|
287
|
+
*/
|
|
288
|
+
density?: 'comfortable' | 'compact' | 'spacious';
|
|
289
|
+
/**
|
|
290
|
+
* @deprecated Use `density="compact"` instead. Kept for backward
|
|
291
|
+
* compatibility with Phase 1 callers; ignored when `density` is set.
|
|
292
|
+
*/
|
|
293
|
+
dense?: boolean;
|
|
294
|
+
/** Sticky `<thead>` that stays visible while the body scrolls. @default false */
|
|
295
|
+
stickyHeader?: boolean;
|
|
296
|
+
/** Outer wrapper radius (provider cascade applies). */
|
|
297
|
+
radius?: 'none' | 'small' | 'medium' | 'large' | 'full';
|
|
298
|
+
/**
|
|
299
|
+
* Horizontal overflow strategy:
|
|
300
|
+
* - `'scroll'` — the wrapper scrolls; columns keep their natural width.
|
|
301
|
+
* - `'truncate'` — cells clip with ellipsis (use `minWidth` per column).
|
|
302
|
+
* @default 'scroll'
|
|
303
|
+
*/
|
|
304
|
+
overflow?: 'scroll' | 'truncate';
|
|
305
|
+
/**
|
|
306
|
+
* Replaces every body row with a `<Skeleton>` placeholder. Header stays
|
|
307
|
+
* real so the layout doesn't shift.
|
|
308
|
+
*/
|
|
309
|
+
loading?: boolean;
|
|
310
|
+
/** Number of skeleton rows to render while loading. @default 5 */
|
|
311
|
+
loadingRows?: number;
|
|
312
|
+
/**
|
|
313
|
+
* How to visually represent the `loading` state.
|
|
314
|
+
* - `'skeleton'` (default): replaces body rows with `<Skeleton>` —
|
|
315
|
+
* best for the *first* load when there is no data to show.
|
|
316
|
+
* - `'overlay'`: keeps the previous data visible behind a translucent
|
|
317
|
+
* backdrop with a centered loader — best for *refetches* (server
|
|
318
|
+
* pagination, filter changes) so the layout doesn't flash.
|
|
319
|
+
*/
|
|
320
|
+
loadingMode?: 'skeleton' | 'overlay';
|
|
321
|
+
/** Override the default empty-state copy. */
|
|
322
|
+
emptyText?: string;
|
|
323
|
+
/**
|
|
324
|
+
* Override the default no-results copy (Fase 4 behavior, included now
|
|
325
|
+
* for forward-compat). Falls back to `emptyText` if not provided.
|
|
326
|
+
*/
|
|
327
|
+
noResultsText?: string;
|
|
328
|
+
/** Forwarded to the `<table>` element for screen readers. */
|
|
329
|
+
ariaLabel?: string;
|
|
330
|
+
/**
|
|
331
|
+
* Sort state. Bind with `v-model:sort` to control externally; omit
|
|
332
|
+
* for an uncontrolled table that manages its own state internally.
|
|
333
|
+
* Pass an empty array to clear the sort.
|
|
334
|
+
*/
|
|
335
|
+
sort?: TableSortState;
|
|
336
|
+
/**
|
|
337
|
+
* Allow multi-column sort (shift+click adds a criterion). Requires at
|
|
338
|
+
* least one sortable column. @default false
|
|
339
|
+
*/
|
|
340
|
+
multiSort?: boolean;
|
|
341
|
+
/**
|
|
342
|
+
* When true the sort cycle is `asc → desc → none`. When false the
|
|
343
|
+
* cycle is `asc → desc → asc` (no clearable state). @default true
|
|
344
|
+
*/
|
|
345
|
+
sortClearable?: boolean;
|
|
346
|
+
/** Row selection mode. @default 'none' */
|
|
347
|
+
selectable?: TableSelectionMode;
|
|
348
|
+
/**
|
|
349
|
+
* Selected row keys. Bind with `v-model:selected`. For `selectable='single'`
|
|
350
|
+
* it's an empty or 1-element array.
|
|
351
|
+
*/
|
|
352
|
+
selected?: TableSelection;
|
|
353
|
+
/**
|
|
354
|
+
* Disables selection for individual rows. Receives the row + index and
|
|
355
|
+
* returns `true` to disable. The header "select-all" checkbox skips
|
|
356
|
+
* disabled rows automatically.
|
|
357
|
+
*/
|
|
358
|
+
isRowSelectable?: (row: TRow, index: number) => boolean;
|
|
359
|
+
/**
|
|
360
|
+
* Per-column filter values. Bind with `v-model:filter`. Keys match
|
|
361
|
+
* `column.key`; values are the raw user input (string).
|
|
362
|
+
*/
|
|
363
|
+
filter?: TableFilterState;
|
|
364
|
+
/**
|
|
365
|
+
* When true, every column's filter input is rendered as a sub-row
|
|
366
|
+
* below the header. Individual columns can opt out by setting
|
|
367
|
+
* `filterable: false` on the column.
|
|
368
|
+
*/
|
|
369
|
+
filterRow?: boolean;
|
|
370
|
+
/**
|
|
371
|
+
* When set, an expand/collapse chevron column is auto-injected. The
|
|
372
|
+
* `#row-expanded` slot renders the panel below the row when
|
|
373
|
+
* expanded. Use `v-model:expanded` to control externally.
|
|
374
|
+
*/
|
|
375
|
+
expandable?: boolean;
|
|
376
|
+
/** Expanded row keys. Bind with `v-model:expanded`. */
|
|
377
|
+
expanded?: TableExpansionState;
|
|
378
|
+
/**
|
|
379
|
+
* When `expandable`, this predicate determines whether a given row
|
|
380
|
+
* even has expansion content. Returning `false` hides the chevron
|
|
381
|
+
* for that row. @default () => true
|
|
382
|
+
*/
|
|
383
|
+
isRowExpandable?: (row: TRow, index: number) => boolean;
|
|
384
|
+
/**
|
|
385
|
+
* Pagination state. When set, the table renders a `<TablePagination>`
|
|
386
|
+
* footer and slices `data` accordingly in client mode. Bind with
|
|
387
|
+
* `v-model:pagination` to control externally.
|
|
388
|
+
*/
|
|
389
|
+
pagination?: TablePaginationState;
|
|
390
|
+
/**
|
|
391
|
+
* Available page-size options shown in the pagination footer.
|
|
392
|
+
* @default [10, 25, 50, 100]
|
|
393
|
+
*/
|
|
394
|
+
pageSizeOptions?: number[];
|
|
395
|
+
/**
|
|
396
|
+
* Server-side mode. When `true`, the table does NOT slice `data`,
|
|
397
|
+
* filter, or sort — it just emits state changes for the host to
|
|
398
|
+
* refetch. Use together with the explicit `total` on the
|
|
399
|
+
* pagination object so the footer can show the correct range.
|
|
400
|
+
* @default false
|
|
401
|
+
*/
|
|
402
|
+
serverSide?: boolean;
|
|
403
|
+
/**
|
|
404
|
+
* Enables user column resizing. A drag handle appears on the right
|
|
405
|
+
* edge of every resizable `<th>`. Columns can opt out via
|
|
406
|
+
* `column.resizable = false`. @default false
|
|
407
|
+
*/
|
|
408
|
+
resizable?: boolean;
|
|
409
|
+
/**
|
|
410
|
+
* Enables user column reordering via HTML5 drag-and-drop on the
|
|
411
|
+
* header. A drop indicator line shows the insertion target.
|
|
412
|
+
* Keyboard: Alt+Left/Right on a focused header moves the column.
|
|
413
|
+
* @default false
|
|
414
|
+
*/
|
|
415
|
+
reorderable?: boolean;
|
|
416
|
+
/**
|
|
417
|
+
* Columns state (widths / order / hidden). Bind with
|
|
418
|
+
* `v-model:columnsState` to persist user preferences.
|
|
419
|
+
*/
|
|
420
|
+
columnsState?: TableColumnState[];
|
|
421
|
+
/**
|
|
422
|
+
* Aggregate state snapshot — every user-controlled bit (sort,
|
|
423
|
+
* filter, pagination, columnsState, globalSearchTerm, selected) in
|
|
424
|
+
* one serializable object. Bind with `v-model:state` to persist
|
|
425
|
+
* everything to localStorage / URL / backend in a single line.
|
|
426
|
+
*
|
|
427
|
+
* When `state` is provided, it acts as a *one-way* hydrator: the
|
|
428
|
+
* snapshot is applied to the underlying refs once on mount and
|
|
429
|
+
* whenever the snapshot reference changes. Subsequent user
|
|
430
|
+
* interactions emit `update:state` so the host can save it.
|
|
431
|
+
*
|
|
432
|
+
* `state` is independent from the per-feature v-models — you can
|
|
433
|
+
* use both (the per-feature ones win on conflicts since they are
|
|
434
|
+
* applied last).
|
|
435
|
+
*/
|
|
436
|
+
state?: TableStateSnapshot;
|
|
437
|
+
/**
|
|
438
|
+
* Minimum column width in pixels when resizing. Prevents users from
|
|
439
|
+
* collapsing a column to nothing. @default 48
|
|
440
|
+
*/
|
|
441
|
+
minColumnWidth?: number;
|
|
442
|
+
/**
|
|
443
|
+
* Enables row virtualization. Only the rows visible in the viewport
|
|
444
|
+
* (plus an `overscan` band) are mounted, which keeps render time
|
|
445
|
+
* constant for thousands of rows.
|
|
446
|
+
*
|
|
447
|
+
* Caveats:
|
|
448
|
+
* - Requires a fixed `rowHeight` (auto-derived from `size`/`density`
|
|
449
|
+
* if you don't pass one). Variable-height rows are not supported.
|
|
450
|
+
* - Not compatible with `expandable` (the panel changes the row
|
|
451
|
+
* height). Setting both is a no-op for expansion.
|
|
452
|
+
* - The host must allow vertical space — set `virtualHeight` or use
|
|
453
|
+
* `stickyHeader` so the scroll viewport has a bounded height.
|
|
454
|
+
*
|
|
455
|
+
* @default false
|
|
456
|
+
*/
|
|
457
|
+
virtual?: boolean;
|
|
458
|
+
/**
|
|
459
|
+
* Pixel height of a single row in virtual mode. When omitted, the
|
|
460
|
+
* value is derived from the active `size` + `density` combination
|
|
461
|
+
* (matches what the unscrolled table would render).
|
|
462
|
+
*/
|
|
463
|
+
rowHeight?: number;
|
|
464
|
+
/**
|
|
465
|
+
* Number of extra rows rendered outside the viewport on each side
|
|
466
|
+
* during virtualization. Bigger overscan = smoother scroll, more DOM.
|
|
467
|
+
* @default 5
|
|
468
|
+
*/
|
|
469
|
+
overscan?: number;
|
|
470
|
+
/**
|
|
471
|
+
* CSS height of the virtualization viewport. Defaults to `'60vh'`
|
|
472
|
+
* — same as `stickyHeader` — so the scroll container has bounds.
|
|
473
|
+
*/
|
|
474
|
+
virtualHeight?: string | number;
|
|
475
|
+
/**
|
|
476
|
+
* Renders rows hierarchically. Each row may have a children array
|
|
477
|
+
* under `childrenKey` (default `'children'`). A chevron toggle is
|
|
478
|
+
* auto-injected before the first data column and indents the cell
|
|
479
|
+
* content per `depth`.
|
|
480
|
+
*
|
|
481
|
+
* Mutually exclusive with `expandable` (use one expansion model)
|
|
482
|
+
* and with `pagination` (paging a flattened tree is undefined).
|
|
483
|
+
* Both are silently ignored when `tree=true`.
|
|
484
|
+
* @default false
|
|
485
|
+
*/
|
|
486
|
+
tree?: boolean;
|
|
487
|
+
/** Field name on each row holding the children array. @default 'children' */
|
|
488
|
+
childrenKey?: string;
|
|
489
|
+
/**
|
|
490
|
+
* Currently-expanded row keys (controlled). Bind with
|
|
491
|
+
* `v-model:treeExpanded`. Same key resolution as `selected`.
|
|
492
|
+
*/
|
|
493
|
+
treeExpanded?: (string | number)[];
|
|
494
|
+
/**
|
|
495
|
+
* Lazy children loader. When set, the chevron is rendered for any
|
|
496
|
+
* row where `hasChildrenHint` returns true, and expansion calls
|
|
497
|
+
* this function. While the promise pends, the row is marked
|
|
498
|
+
* `isLoading` (a small spinner is shown next to the chevron).
|
|
499
|
+
*/
|
|
500
|
+
loadChildren?: (row: TRow, index: number) => Promise<TRow[]>;
|
|
501
|
+
/**
|
|
502
|
+
* Predicate used together with `loadChildren` to decide whether a
|
|
503
|
+
* row that has no preloaded children should still show the
|
|
504
|
+
* expansion chevron. @default () => false
|
|
505
|
+
*/
|
|
506
|
+
hasChildrenHint?: (row: TRow, index: number) => boolean;
|
|
507
|
+
/**
|
|
508
|
+
* Groups rows by the result of this accessor. Either a column key
|
|
509
|
+
* (the value at `row[key]`) or a function returning the group
|
|
510
|
+
* value. A collapsible group header row is rendered before each
|
|
511
|
+
* group; aggregation results from `column.aggregate` are shown
|
|
512
|
+
* inline.
|
|
513
|
+
*
|
|
514
|
+
* Mutually exclusive with `tree` and `pagination`. Both are
|
|
515
|
+
* silently ignored when `groupBy` is set.
|
|
516
|
+
*/
|
|
517
|
+
groupBy?: string | ((row: TRow) => string | number);
|
|
518
|
+
/**
|
|
519
|
+
* Currently-expanded group keys (controlled). Bind with
|
|
520
|
+
* `v-model:groupExpanded`. When omitted, every group starts
|
|
521
|
+
* expanded.
|
|
522
|
+
*/
|
|
523
|
+
groupExpanded?: (string | number)[];
|
|
524
|
+
/**
|
|
525
|
+
* Pins the first data column to the left edge of the scroll viewport.
|
|
526
|
+
* Useful on narrow viewports where horizontal scroll is required —
|
|
527
|
+
* the identity column (name, id, etc.) stays visible while the rest
|
|
528
|
+
* scrolls. Composes with `pinned` columns: a left-pinned column
|
|
529
|
+
* already at the start absorbs this behavior.
|
|
530
|
+
*
|
|
531
|
+
* - `true` — always sticky.
|
|
532
|
+
* - `'mobile'` — only sticky below the `md` breakpoint (≤ 768px).
|
|
533
|
+
* - `false` (default) — never sticky.
|
|
534
|
+
*
|
|
535
|
+
* Has no effect when `overflow="truncate"` (no horizontal scroll
|
|
536
|
+
* occurs) or when virtualization disables horizontal layout.
|
|
537
|
+
* @default false
|
|
538
|
+
*/
|
|
539
|
+
stickyFirstColumn?: boolean | 'mobile';
|
|
540
|
+
/**
|
|
541
|
+
* Renders a toolbar above the table. The default toolbar contains
|
|
542
|
+
* a global search input bound to `globalSearchTerm`. Override the
|
|
543
|
+
* full toolbar via the `#toolbar` slot — it receives the current
|
|
544
|
+
* search term + setter so consumers can compose freely.
|
|
545
|
+
*
|
|
546
|
+
* Setting `globalSearch=true` is equivalent to `toolbar=true` plus
|
|
547
|
+
* the default search input. Use `toolbar=true` alone to render the
|
|
548
|
+
* toolbar surface without the built-in search.
|
|
549
|
+
* @default false
|
|
550
|
+
*/
|
|
551
|
+
toolbar?: boolean;
|
|
552
|
+
/**
|
|
553
|
+
* Enables a global search input in the toolbar. Filters rows by a
|
|
554
|
+
* case-insensitive `contains` match on the stringified value of
|
|
555
|
+
* every column (or only `filterable`-flagged columns when
|
|
556
|
+
* `globalSearchScope='filterable'`). Runs before column filters
|
|
557
|
+
* and sort, so paginated counts reflect the searched set.
|
|
558
|
+
* @default false
|
|
559
|
+
*/
|
|
560
|
+
globalSearch?: boolean;
|
|
561
|
+
/**
|
|
562
|
+
* Restrict global search to columns that opted into `filterable`,
|
|
563
|
+
* or scan every column. @default 'all'
|
|
564
|
+
*/
|
|
565
|
+
globalSearchScope?: 'all' | 'filterable';
|
|
566
|
+
/**
|
|
567
|
+
* Current global search term (controlled). Bind with
|
|
568
|
+
* `v-model:globalSearchTerm` to persist or sync with a URL.
|
|
569
|
+
*/
|
|
570
|
+
globalSearchTerm?: string;
|
|
571
|
+
/**
|
|
572
|
+
* Renders a column-visibility menu in the toolbar. Each column gets
|
|
573
|
+
* a checkbox; toggling commits to `columnsState`. Implies `toolbar`.
|
|
574
|
+
* @default false
|
|
575
|
+
*/
|
|
576
|
+
columnVisibility?: boolean;
|
|
577
|
+
/**
|
|
578
|
+
* Renders an Export menu in the toolbar with CSV / JSON / Copy
|
|
579
|
+
* (TSV → clipboard) actions. Pass `true` to enable all three or
|
|
580
|
+
* an object to opt-in per format. Exports the post-filter +
|
|
581
|
+
* post-sort dataset (pre-pagination) using only visible columns.
|
|
582
|
+
* Implies `toolbar`.
|
|
583
|
+
* @default false
|
|
584
|
+
*/
|
|
585
|
+
exportable?: boolean | {
|
|
586
|
+
csv?: boolean;
|
|
587
|
+
json?: boolean;
|
|
588
|
+
clipboard?: boolean;
|
|
589
|
+
};
|
|
590
|
+
/**
|
|
591
|
+
* Base filename (without extension) for downloaded exports.
|
|
592
|
+
* @default 'table'
|
|
593
|
+
*/
|
|
594
|
+
exportFileName?: string;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Payload of the `@cell-edit` event. Emitted when the user commits a
|
|
598
|
+
* change in an inline editor (Enter / blur on a valid value).
|
|
599
|
+
*
|
|
600
|
+
* The table never mutates `row` itself — the host is responsible for
|
|
601
|
+
* updating its data source on this event. This keeps editing
|
|
602
|
+
* controlled / undo-friendly and works in server-mode the same way.
|
|
603
|
+
*/
|
|
604
|
+
export interface TableCellEditEvent<TRow = any> {
|
|
605
|
+
/** Column key whose cell was edited. */
|
|
606
|
+
key: string;
|
|
607
|
+
/** The row object before the change. */
|
|
608
|
+
row: TRow;
|
|
609
|
+
/** Row index inside the (filtered/sorted) `visibleData` array. */
|
|
610
|
+
index: number;
|
|
611
|
+
/** Previous value (as resolved by the column's `accessor`/`key`). */
|
|
612
|
+
oldValue: unknown;
|
|
613
|
+
/** New value, parsed by `editType` (string for text, number for number). */
|
|
614
|
+
newValue: string | number;
|
|
615
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TableColumn } from './Table.interface';
|
|
2
|
+
/**
|
|
3
|
+
* Props for `<TableColumn>`, the declarative companion to `<Table>`.
|
|
4
|
+
*
|
|
5
|
+
* Every prop maps 1:1 to {@link TableColumn} so column metadata can be
|
|
6
|
+
* declared inline next to the slot template. The component itself renders
|
|
7
|
+
* nothing — the parent `<Table>` collects its children, reads their props
|
|
8
|
+
* and slots, and builds a `NormalizedTableColumn[]` from them.
|
|
9
|
+
*/
|
|
10
|
+
export type TableColumnProps<TRow = any> = TableColumn<TRow>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TablePaginationState } from './Table.interface';
|
|
2
|
+
/**
|
|
3
|
+
* `<TablePagination>` props. The component renders a self-contained
|
|
4
|
+
* footer (range readout + page-size select + first/prev/next/last
|
|
5
|
+
* buttons) that can be embedded anywhere — typically wired via
|
|
6
|
+
* `v-model:pagination` on `<Table>`, but exported as a standalone
|
|
7
|
+
* primitive so consumers can build custom pagers.
|
|
8
|
+
*/
|
|
9
|
+
export interface TablePagination {
|
|
10
|
+
/**
|
|
11
|
+
* Pagination state. Bind with `v-model:pagination` (parent emits the
|
|
12
|
+
* same object back with `page`/`pageSize` updated).
|
|
13
|
+
*/
|
|
14
|
+
pagination: TablePaginationState;
|
|
15
|
+
/** Page-size options. @default [10, 25, 50, 100] */
|
|
16
|
+
pageSizeOptions?: number[];
|
|
17
|
+
/**
|
|
18
|
+
* When `true`, hide the page-size select (some hosts only need
|
|
19
|
+
* page navigation). @default false
|
|
20
|
+
*/
|
|
21
|
+
hidePageSize?: boolean;
|
|
22
|
+
/** Hide first/last buttons (only show prev/next). @default false */
|
|
23
|
+
hideEdgeButtons?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Disables every control. Useful while the host is fetching a new
|
|
26
|
+
* page. @default false
|
|
27
|
+
*/
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/** Sizing scale, mirrors `<Table>`. @default 'medium' */
|
|
30
|
+
size?: 'small' | 'medium' | 'large';
|
|
31
|
+
/** Forwarded to the wrapping `<nav>` for screen readers. */
|
|
32
|
+
ariaLabel?: string;
|
|
33
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
export interface Badge {
|
|
3
|
+
label?: string;
|
|
4
|
+
variant?: 'solid' | 'outline' | 'subtle';
|
|
5
|
+
color?: 'default' | 'primary' | 'danger' | 'success' | 'warning';
|
|
6
|
+
gradient?: boolean;
|
|
7
|
+
size?: 'small' | 'medium' | 'large';
|
|
8
|
+
radius?: 'none' | 'small' | 'medium' | 'large' | 'full';
|
|
9
|
+
icon?: Component;
|
|
10
|
+
removable?: boolean;
|
|
11
|
+
dot?: boolean;
|
|
12
|
+
/** When `removable`, overrides the default `loc.badge.remove` accessible name on the close button. */
|
|
13
|
+
removeAriaLabel?: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
export interface Banner {
|
|
3
|
+
color?: 'info' | 'warning' | 'danger' | 'success';
|
|
4
|
+
variant?: 'filled' | 'subtle' | 'outline';
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
dismissable?: boolean;
|
|
8
|
+
dismissAnimation?: 'collapse' | 'shrink';
|
|
9
|
+
icon?: Component;
|
|
10
|
+
showIcon?: boolean;
|
|
11
|
+
position?: 'inline' | 'sticky-top' | 'sticky-bottom';
|
|
12
|
+
fullWidth?: boolean;
|
|
13
|
+
radius?: 'none' | 'small' | 'medium' | 'large' | 'full';
|
|
14
|
+
}
|