@molecule/app-data-table-ui-vue 0.0.0-stage → 0.0.1-stage
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 +202 -0
- package/README.md +517 -2
- package/dist/DataTableCard.d.ts +148 -0
- package/dist/DataTableCard.d.ts.map +1 -0
- package/dist/DataTableCard.js +156 -0
- package/dist/DataTableCard.js.map +1 -0
- package/dist/RowWithActions.d.ts +78 -0
- package/dist/RowWithActions.d.ts.map +1 -0
- package/dist/RowWithActions.js +71 -0
- package/dist/RowWithActions.js.map +1 -0
- package/dist/TableEmpty.d.ts +54 -0
- package/dist/TableEmpty.d.ts.map +1 -0
- package/dist/TableEmpty.js +57 -0
- package/dist/TableEmpty.js.map +1 -0
- package/dist/TableFooter.d.ts +54 -0
- package/dist/TableFooter.d.ts.map +1 -0
- package/dist/TableFooter.js +56 -0
- package/dist/TableFooter.js.map +1 -0
- package/dist/TableToolbar.d.ts +66 -0
- package/dist/TableToolbar.d.ts.map +1 -0
- package/dist/TableToolbar.js +60 -0
- package/dist/TableToolbar.js.map +1 -0
- package/dist/index.d.ts +78 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +96 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/package.json +63 -4
package/README.md
CHANGED
|
@@ -1,3 +1,518 @@
|
|
|
1
|
-
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-11-18T20:20:28.341Z
|
|
7
|
+
-->
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
# @molecule/app-data-table-ui-vue
|
|
10
|
+
|
|
11
|
+
Vue data-table UI primitives (standalone — they render plain table elements
|
|
12
|
+
and do not require a table component from a UI package).
|
|
13
|
+
|
|
14
|
+
Exports:
|
|
15
|
+
|
|
16
|
+
- `<DataTableCard>` — full polished-pattern data table (card wrapper +
|
|
17
|
+
title + uppercase headers + divided rows + loading skeleton + empty
|
|
18
|
+
state). Drop-in for the most common dashboard CRUD use case.
|
|
19
|
+
- `<TableToolbar>` — top chrome with left/right slots + optional filter row.
|
|
20
|
+
- `<TableEmpty>` — single full-width "no rows" cell for hand-rolled tables.
|
|
21
|
+
- `<TableFooter>` — bottom bar (left summary + right pagination).
|
|
22
|
+
- `<RowWithActions>` — `<tr>` wrapper with trailing actions cell and click handler.
|
|
23
|
+
|
|
24
|
+
Use `DataTableCard` for new screens; use the row-level primitives to compose
|
|
25
|
+
richer custom tables (group-by, expandable rows, etc.).
|
|
26
|
+
|
|
27
|
+
This package is the Vue counterpart of `@molecule/app-data-table-ui-react`:
|
|
28
|
+
the same export names, the same props (React's prop names), and the same DOM
|
|
29
|
+
for the same input, so an app swaps framework by changing only the package
|
|
30
|
+
name in its imports.
|
|
31
|
+
|
|
32
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
33
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
34
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
35
|
+
|
|
36
|
+
## Quick Start
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { createApp, defineComponent, h } from 'vue'
|
|
40
|
+
import { DataTableCard } from '@molecule/app-data-table-ui-vue'
|
|
41
|
+
|
|
42
|
+
interface Row {
|
|
43
|
+
id: string
|
|
44
|
+
name: string
|
|
45
|
+
email: string
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const columns = [
|
|
49
|
+
{
|
|
50
|
+
key: 'name',
|
|
51
|
+
header: t('members.name', {}, { defaultValue: 'Name' }),
|
|
52
|
+
cell: (row: Row) => row.name,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
key: 'email',
|
|
56
|
+
header: t('members.email', {}, { defaultValue: 'Email' }),
|
|
57
|
+
cell: (row: Row) => row.email,
|
|
58
|
+
},
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
const MembersTable = defineComponent({
|
|
62
|
+
props: { members: { type: Array as () => Row[], required: true } },
|
|
63
|
+
setup(props) {
|
|
64
|
+
return () =>
|
|
65
|
+
h(DataTableCard, {
|
|
66
|
+
title: t('members.title', {}, { defaultValue: 'Team members' }),
|
|
67
|
+
columns,
|
|
68
|
+
rows: props.members,
|
|
69
|
+
rowKey: (row: Row) => row.id,
|
|
70
|
+
onRowClick: (row: Row) => navigate(`/members/${row.id}`),
|
|
71
|
+
emptyMessage: t('members.empty', {}, { defaultValue: 'No members yet.' }),
|
|
72
|
+
})
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
createApp(MembersTable).mount('#app')
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Type
|
|
80
|
+
|
|
81
|
+
`feature`
|
|
82
|
+
|
|
83
|
+
## Installation
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npm install @molecule/app-data-table-ui-vue @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## API
|
|
90
|
+
|
|
91
|
+
### Interfaces
|
|
92
|
+
|
|
93
|
+
#### `DataTableColumn`
|
|
94
|
+
|
|
95
|
+
Column definition for a {@link DataTableCard} — specifies key, header, and
|
|
96
|
+
cell renderer.
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
interface DataTableColumn<Row> {
|
|
100
|
+
/** Stable key for the column. */
|
|
101
|
+
key: string
|
|
102
|
+
/** Header label (usually a translated string). */
|
|
103
|
+
header: VNodeChild
|
|
104
|
+
/** Render the cell for this column from a row. */
|
|
105
|
+
cell: (row: Row) => VNodeChild
|
|
106
|
+
/** Optional extra `<th>` / `<td>` classes (e.g. `cm.textCenter`). */
|
|
107
|
+
cellClassName?: string
|
|
108
|
+
/** Optional extra classes on this column's `<th>`. */
|
|
109
|
+
headerClassName?: string
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
#### `DataTableCardProps`
|
|
114
|
+
|
|
115
|
+
Props for {@link DataTableCard}.
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
interface DataTableCardProps<Row> {
|
|
119
|
+
/**
|
|
120
|
+
* Optional title above the table chrome. Passed as a prop or as the
|
|
121
|
+
* same-named slot — both work.
|
|
122
|
+
*/
|
|
123
|
+
title?: VNodeChild
|
|
124
|
+
/** Right-aligned action / "View all" / link in the title row (prop or `titleAction` slot). */
|
|
125
|
+
titleAction?: VNodeChild
|
|
126
|
+
/** Column definitions. */
|
|
127
|
+
columns: ReadonlyArray<DataTableColumn<Row>>
|
|
128
|
+
/** Rows to render. Falls back to `emptyMessage` if empty and not loading. */
|
|
129
|
+
rows: ReadonlyArray<Row>
|
|
130
|
+
/** Pull a stable key from a row. */
|
|
131
|
+
rowKey: (row: Row) => string
|
|
132
|
+
/** When true, renders 5 skeleton rows instead of `rows`. */
|
|
133
|
+
loading?: boolean
|
|
134
|
+
/** Optional click handler per row. */
|
|
135
|
+
onRowClick?: (row: Row) => void
|
|
136
|
+
/**
|
|
137
|
+
* Empty-state content shown inside the tbody when not loading and `rows` is
|
|
138
|
+
* empty. Passed as a prop or as the same-named slot — both work.
|
|
139
|
+
*/
|
|
140
|
+
emptyMessage?: VNodeChild
|
|
141
|
+
/** Extra classes on the outer card. */
|
|
142
|
+
className?: string
|
|
143
|
+
/** `data-mol-id` for AI-agent selectors. */
|
|
144
|
+
dataMolId?: string
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### `RowWithActionsProps`
|
|
149
|
+
|
|
150
|
+
Props for {@link RowWithActions}.
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
interface RowWithActionsProps {
|
|
154
|
+
/** Row cells (each wrapped in `<td>`) — the default slot. */
|
|
155
|
+
children?: VNodeChild
|
|
156
|
+
/** Action buttons/menu to render in the trailing "actions" cell (prop or `actions` slot). */
|
|
157
|
+
actions?: VNodeChild
|
|
158
|
+
/** Called when the row body is clicked (not the actions cell). */
|
|
159
|
+
onClick?: () => void
|
|
160
|
+
/** Whether the row should render in a "selected" visual state. */
|
|
161
|
+
selected?: boolean
|
|
162
|
+
/** Extra classes on the `<tr>`. */
|
|
163
|
+
className?: string
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
#### `TableEmptyProps`
|
|
168
|
+
|
|
169
|
+
Props for {@link TableEmpty}.
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
interface TableEmptyProps {
|
|
173
|
+
/** Number of columns to span (for colspan on the td). */
|
|
174
|
+
colSpan: number
|
|
175
|
+
/** Empty-state content — the default slot. */
|
|
176
|
+
children?: VNodeChild
|
|
177
|
+
/** Extra classes on the cell. */
|
|
178
|
+
className?: string
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
#### `TableFooterProps`
|
|
183
|
+
|
|
184
|
+
Props for {@link TableFooter}.
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
interface TableFooterProps {
|
|
188
|
+
/** Left slot — typically a summary line ("5 rows selected"); prop or `left` slot. */
|
|
189
|
+
left?: VNodeChild
|
|
190
|
+
/** Right slot — typically a pagination bar; prop or `right` slot. */
|
|
191
|
+
right?: VNodeChild
|
|
192
|
+
/** Extra classes. */
|
|
193
|
+
className?: string
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
#### `TableToolbarProps`
|
|
198
|
+
|
|
199
|
+
Props for {@link TableToolbar}.
|
|
200
|
+
|
|
201
|
+
```typescript
|
|
202
|
+
interface TableToolbarProps {
|
|
203
|
+
/** Left-aligned content — usually a title or a results count (prop or `left` slot). */
|
|
204
|
+
left?: VNodeChild
|
|
205
|
+
/** Right-aligned actions — search input, filter button, export, etc. (prop or `right` slot). */
|
|
206
|
+
right?: VNodeChild
|
|
207
|
+
/** Optional full-width filter / chip row rendered below the main row (prop or `below` slot). */
|
|
208
|
+
below?: VNodeChild
|
|
209
|
+
/** Extra classes. */
|
|
210
|
+
className?: string
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Constants
|
|
215
|
+
|
|
216
|
+
#### `DataTableCard`
|
|
217
|
+
|
|
218
|
+
Drop-in card-shaped data table matching the polished flagship pattern.
|
|
219
|
+
|
|
220
|
+
Renders:
|
|
221
|
+
|
|
222
|
+
1. Optional title + action row
|
|
223
|
+
2. Card-wrapped table with:
|
|
224
|
+
- `bg-surface-container-lowest rounded-xl overflow-hidden shadow-sm` outer
|
|
225
|
+
- `bg-surface-container-low border-b border-outline-variant/10` thead
|
|
226
|
+
- `text-[10px] font-black text-on-surface-variant uppercase tracking-widest` th
|
|
227
|
+
- `divide-y divide-surface-container` tbody
|
|
228
|
+
- `hover:bg-surface-container-low transition-colors` rows (when `onRowClick` provided)
|
|
229
|
+
- 5-row pulsing skeleton when `loading`
|
|
230
|
+
- Single full-width cell with `emptyMessage` when empty
|
|
231
|
+
|
|
232
|
+
For complex per-column rendering, pass cells that compose a status badge, an
|
|
233
|
+
avatar, and so on.
|
|
234
|
+
|
|
235
|
+
```typescript
|
|
236
|
+
const DataTableCard: DefineComponent<
|
|
237
|
+
ExtractPropTypes<{
|
|
238
|
+
title: { type: PropType<VNodeChild>; default: undefined }
|
|
239
|
+
titleAction: { type: PropType<VNodeChild>; default: undefined }
|
|
240
|
+
columns: { type: PropType<ReadonlyArray<DataTableColumn<unknown>>>; required: true }
|
|
241
|
+
rows: { type: PropType<ReadonlyArray<unknown>>; required: true }
|
|
242
|
+
rowKey: { type: PropType<RowKey>; required: true }
|
|
243
|
+
loading: { type: BooleanConstructor; default: boolean }
|
|
244
|
+
onRowClick: { type: PropType<RowClick | undefined>; default: undefined }
|
|
245
|
+
emptyMessage: { type: PropType<VNodeChild>; default: undefined }
|
|
246
|
+
className: { type: PropType<string | undefined>; default: undefined }
|
|
247
|
+
dataMolId: { type: PropType<string | undefined>; default: undefined }
|
|
248
|
+
}>,
|
|
249
|
+
() => VNode,
|
|
250
|
+
{},
|
|
251
|
+
{},
|
|
252
|
+
{},
|
|
253
|
+
ComponentOptionsMixin,
|
|
254
|
+
ComponentOptionsMixin,
|
|
255
|
+
{},
|
|
256
|
+
string,
|
|
257
|
+
PublicProps,
|
|
258
|
+
Readonly<
|
|
259
|
+
ExtractPropTypes<{
|
|
260
|
+
title: { type: PropType<VNodeChild>; default: undefined }
|
|
261
|
+
titleAction: { type: PropType<VNodeChild>; default: undefined }
|
|
262
|
+
columns: { type: PropType<ReadonlyArray<DataTableColumn<unknown>>>; required: true }
|
|
263
|
+
rows: { type: PropType<ReadonlyArray<unknown>>; required: true }
|
|
264
|
+
rowKey: { type: PropType<RowKey>; required: true }
|
|
265
|
+
loading: { type: BooleanConstructor; default: boolean }
|
|
266
|
+
onRowClick: { type: PropType<RowClick | undefined>; default: undefined }
|
|
267
|
+
emptyMessage: { type: PropType<VNodeChild>; default: undefined }
|
|
268
|
+
className: { type: PropType<string | undefined>; default: undefined }
|
|
269
|
+
dataMolId: { type: PropType<string | undefined>; default: undefined }
|
|
270
|
+
}>
|
|
271
|
+
> &
|
|
272
|
+
Readonly<{}>,
|
|
273
|
+
{
|
|
274
|
+
title: VNodeChild
|
|
275
|
+
titleAction: VNodeChild
|
|
276
|
+
loading: boolean
|
|
277
|
+
onRowClick: RowClick | undefined
|
|
278
|
+
emptyMessage: VNodeChild
|
|
279
|
+
className: string | undefined
|
|
280
|
+
dataMolId: string | undefined
|
|
281
|
+
},
|
|
282
|
+
{},
|
|
283
|
+
{},
|
|
284
|
+
{},
|
|
285
|
+
string,
|
|
286
|
+
ComponentProvideOptions,
|
|
287
|
+
true,
|
|
288
|
+
{},
|
|
289
|
+
any
|
|
290
|
+
>
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
- `props` — Component props (see `DataTableCardProps`).
|
|
294
|
+
|
|
295
|
+
**Returns:** The data table component.
|
|
296
|
+
|
|
297
|
+
#### `RowWithActions`
|
|
298
|
+
|
|
299
|
+
`<tr>` wrapper that adds a trailing actions cell plus a click handler on the
|
|
300
|
+
body. Useful for data tables where each row has a trailing ellipsis-menu or a
|
|
301
|
+
row of action buttons.
|
|
302
|
+
|
|
303
|
+
```typescript
|
|
304
|
+
const RowWithActions: DefineComponent<
|
|
305
|
+
ExtractPropTypes<{
|
|
306
|
+
children: { type: PropType<VNodeChild>; default: undefined }
|
|
307
|
+
actions: { type: PropType<VNodeChild>; default: undefined }
|
|
308
|
+
onClick: { type: PropType<(() => void) | undefined>; default: undefined }
|
|
309
|
+
selected: { type: PropType<boolean | undefined>; default: undefined }
|
|
310
|
+
className: { type: PropType<string | undefined>; default: undefined }
|
|
311
|
+
}>,
|
|
312
|
+
() => VNode,
|
|
313
|
+
{},
|
|
314
|
+
{},
|
|
315
|
+
{},
|
|
316
|
+
ComponentOptionsMixin,
|
|
317
|
+
ComponentOptionsMixin,
|
|
318
|
+
{},
|
|
319
|
+
string,
|
|
320
|
+
PublicProps,
|
|
321
|
+
Readonly<
|
|
322
|
+
ExtractPropTypes<{
|
|
323
|
+
children: { type: PropType<VNodeChild>; default: undefined }
|
|
324
|
+
actions: { type: PropType<VNodeChild>; default: undefined }
|
|
325
|
+
onClick: { type: PropType<(() => void) | undefined>; default: undefined }
|
|
326
|
+
selected: { type: PropType<boolean | undefined>; default: undefined }
|
|
327
|
+
className: { type: PropType<string | undefined>; default: undefined }
|
|
328
|
+
}>
|
|
329
|
+
> &
|
|
330
|
+
Readonly<{}>,
|
|
331
|
+
{
|
|
332
|
+
className: string | undefined
|
|
333
|
+
children: VNodeChild
|
|
334
|
+
actions: VNodeChild
|
|
335
|
+
onClick: (() => void) | undefined
|
|
336
|
+
selected: boolean | undefined
|
|
337
|
+
},
|
|
338
|
+
{},
|
|
339
|
+
{},
|
|
340
|
+
{},
|
|
341
|
+
string,
|
|
342
|
+
ComponentProvideOptions,
|
|
343
|
+
true,
|
|
344
|
+
{},
|
|
345
|
+
any
|
|
346
|
+
>
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
- `props` — Component props (see `RowWithActionsProps`).
|
|
350
|
+
|
|
351
|
+
**Returns:** The row component.
|
|
352
|
+
|
|
353
|
+
#### `TableEmpty`
|
|
354
|
+
|
|
355
|
+
Single full-width row shown when a table has no data. Typically wraps an
|
|
356
|
+
empty-state component.
|
|
357
|
+
|
|
358
|
+
```typescript
|
|
359
|
+
const TableEmpty: DefineComponent<
|
|
360
|
+
ExtractPropTypes<{
|
|
361
|
+
colSpan: { type: NumberConstructor; required: true }
|
|
362
|
+
children: { type: PropType<VNodeChild>; default: undefined }
|
|
363
|
+
className: { type: PropType<string | undefined>; default: undefined }
|
|
364
|
+
}>,
|
|
365
|
+
() => VNode,
|
|
366
|
+
{},
|
|
367
|
+
{},
|
|
368
|
+
{},
|
|
369
|
+
ComponentOptionsMixin,
|
|
370
|
+
ComponentOptionsMixin,
|
|
371
|
+
{},
|
|
372
|
+
string,
|
|
373
|
+
PublicProps,
|
|
374
|
+
Readonly<
|
|
375
|
+
ExtractPropTypes<{
|
|
376
|
+
colSpan: { type: NumberConstructor; required: true }
|
|
377
|
+
children: { type: PropType<VNodeChild>; default: undefined }
|
|
378
|
+
className: { type: PropType<string | undefined>; default: undefined }
|
|
379
|
+
}>
|
|
380
|
+
> &
|
|
381
|
+
Readonly<{}>,
|
|
382
|
+
{ className: string | undefined; children: VNodeChild },
|
|
383
|
+
{},
|
|
384
|
+
{},
|
|
385
|
+
{},
|
|
386
|
+
string,
|
|
387
|
+
ComponentProvideOptions,
|
|
388
|
+
true,
|
|
389
|
+
{},
|
|
390
|
+
any
|
|
391
|
+
>
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
- `props` — Component props (see `TableEmptyProps`).
|
|
395
|
+
|
|
396
|
+
**Returns:** The empty row component.
|
|
397
|
+
|
|
398
|
+
#### `TableFooter`
|
|
399
|
+
|
|
400
|
+
Footer bar rendered below a table. Pass a pagination bar in `right`.
|
|
401
|
+
|
|
402
|
+
```typescript
|
|
403
|
+
const TableFooter: DefineComponent<
|
|
404
|
+
ExtractPropTypes<{
|
|
405
|
+
left: { type: PropType<VNodeChild>; default: undefined }
|
|
406
|
+
right: { type: PropType<VNodeChild>; default: undefined }
|
|
407
|
+
className: { type: PropType<string | undefined>; default: undefined }
|
|
408
|
+
}>,
|
|
409
|
+
() => VNode,
|
|
410
|
+
{},
|
|
411
|
+
{},
|
|
412
|
+
{},
|
|
413
|
+
ComponentOptionsMixin,
|
|
414
|
+
ComponentOptionsMixin,
|
|
415
|
+
{},
|
|
416
|
+
string,
|
|
417
|
+
PublicProps,
|
|
418
|
+
Readonly<
|
|
419
|
+
ExtractPropTypes<{
|
|
420
|
+
left: { type: PropType<VNodeChild>; default: undefined }
|
|
421
|
+
right: { type: PropType<VNodeChild>; default: undefined }
|
|
422
|
+
className: { type: PropType<string | undefined>; default: undefined }
|
|
423
|
+
}>
|
|
424
|
+
> &
|
|
425
|
+
Readonly<{}>,
|
|
426
|
+
{ className: string | undefined; left: VNodeChild; right: VNodeChild },
|
|
427
|
+
{},
|
|
428
|
+
{},
|
|
429
|
+
{},
|
|
430
|
+
string,
|
|
431
|
+
ComponentProvideOptions,
|
|
432
|
+
true,
|
|
433
|
+
{},
|
|
434
|
+
any
|
|
435
|
+
>
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
- `props` — Component props (see `TableFooterProps`).
|
|
439
|
+
|
|
440
|
+
**Returns:** The footer component.
|
|
441
|
+
|
|
442
|
+
#### `TableToolbar`
|
|
443
|
+
|
|
444
|
+
Table top-chrome row with left/right slots and an optional bottom sub-row for
|
|
445
|
+
active filter chips or tabs. Sits above the table.
|
|
446
|
+
|
|
447
|
+
```typescript
|
|
448
|
+
const TableToolbar: DefineComponent<
|
|
449
|
+
ExtractPropTypes<{
|
|
450
|
+
left: { type: PropType<VNodeChild>; default: undefined }
|
|
451
|
+
right: { type: PropType<VNodeChild>; default: undefined }
|
|
452
|
+
below: { type: PropType<VNodeChild>; default: undefined }
|
|
453
|
+
className: { type: PropType<string | undefined>; default: undefined }
|
|
454
|
+
}>,
|
|
455
|
+
() => VNode,
|
|
456
|
+
{},
|
|
457
|
+
{},
|
|
458
|
+
{},
|
|
459
|
+
ComponentOptionsMixin,
|
|
460
|
+
ComponentOptionsMixin,
|
|
461
|
+
{},
|
|
462
|
+
string,
|
|
463
|
+
PublicProps,
|
|
464
|
+
Readonly<
|
|
465
|
+
ExtractPropTypes<{
|
|
466
|
+
left: { type: PropType<VNodeChild>; default: undefined }
|
|
467
|
+
right: { type: PropType<VNodeChild>; default: undefined }
|
|
468
|
+
below: { type: PropType<VNodeChild>; default: undefined }
|
|
469
|
+
className: { type: PropType<string | undefined>; default: undefined }
|
|
470
|
+
}>
|
|
471
|
+
> &
|
|
472
|
+
Readonly<{}>,
|
|
473
|
+
{ className: string | undefined; left: VNodeChild; right: VNodeChild; below: VNodeChild },
|
|
474
|
+
{},
|
|
475
|
+
{},
|
|
476
|
+
{},
|
|
477
|
+
string,
|
|
478
|
+
ComponentProvideOptions,
|
|
479
|
+
true,
|
|
480
|
+
{},
|
|
481
|
+
any
|
|
482
|
+
>
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
- `props` — Component props (see `TableToolbarProps`).
|
|
486
|
+
|
|
487
|
+
**Returns:** The toolbar component.
|
|
488
|
+
|
|
489
|
+
## Injection Notes
|
|
490
|
+
|
|
491
|
+
### Requirements
|
|
492
|
+
|
|
493
|
+
Peer dependencies:
|
|
494
|
+
|
|
495
|
+
- `@molecule/app-ui` ^1.3.11
|
|
496
|
+
- `@molecule/app-ui-vue` ^1.1.0
|
|
497
|
+
- `@molecule/app-vue` ^3.5.0
|
|
498
|
+
- `vue` ^3.4.0
|
|
499
|
+
|
|
500
|
+
### Runtime Dependencies
|
|
501
|
+
|
|
502
|
+
- `@molecule/app-ui`
|
|
503
|
+
- `@molecule/app-ui-vue`
|
|
504
|
+
- `@molecule/app-vue`
|
|
505
|
+
- `vue`
|
|
506
|
+
|
|
507
|
+
All text (`title`, column `header`s, `emptyMessage`) is consumer-provided —
|
|
508
|
+
pass translated strings; there is no built-in copy and no locale bond.
|
|
509
|
+
`DataTableCard`'s chrome uses Tailwind classes with Material-3 theme tokens
|
|
510
|
+
(`bg-surface-container-lowest`, `divide-surface-container`,
|
|
511
|
+
`text-on-surface-variant`, …) — the app's Tailwind theme must define those
|
|
512
|
+
tokens (molecule's default Tailwind ClassMap bond does); with a non-Tailwind
|
|
513
|
+
ClassMap the card surface, dividers, and skeleton styling drop out.
|
|
514
|
+
`onRowClick` makes rows pointer-clickable only — add your own keyboard path
|
|
515
|
+
(e.g. a link/button in a cell) where accessibility matters.
|
|
516
|
+
|
|
517
|
+
Node-valued props (`title`, `titleAction`, `emptyMessage`, `left`, `right`,
|
|
518
|
+
`below`, `actions`) accept either a prop or a same-named slot.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue card-shaped data table.
|
|
3
|
+
*
|
|
4
|
+
* Vue counterpart of `@molecule/app-data-table-ui-react`'s `DataTableCard` —
|
|
5
|
+
* the same props (React names), the same ClassMap tokens, and the same DOM for
|
|
6
|
+
* the same input.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
import { type PropType, type VNode, type VNodeChild } from 'vue';
|
|
11
|
+
import type { DataTableColumn } from './types.js';
|
|
12
|
+
/** A row-key function, declared with a `never` parameter so any `(row: Row) => string` fits. */
|
|
13
|
+
type RowKey = (row: never) => string;
|
|
14
|
+
/** A row-click handler, declared with a `never` parameter so any `(row: Row) => void` fits. */
|
|
15
|
+
type RowClick = (row: never) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Drop-in card-shaped data table matching the polished flagship pattern.
|
|
18
|
+
*
|
|
19
|
+
* Renders:
|
|
20
|
+
* 1. Optional title + action row
|
|
21
|
+
* 2. Card-wrapped table with:
|
|
22
|
+
* - `bg-surface-container-lowest rounded-xl overflow-hidden shadow-sm` outer
|
|
23
|
+
* - `bg-surface-container-low border-b border-outline-variant/10` thead
|
|
24
|
+
* - `text-[10px] font-black text-on-surface-variant uppercase tracking-widest` th
|
|
25
|
+
* - `divide-y divide-surface-container` tbody
|
|
26
|
+
* - `hover:bg-surface-container-low transition-colors` rows (when `onRowClick` provided)
|
|
27
|
+
* - 5-row pulsing skeleton when `loading`
|
|
28
|
+
* - Single full-width cell with `emptyMessage` when empty
|
|
29
|
+
*
|
|
30
|
+
* For complex per-column rendering, pass cells that compose a status badge, an
|
|
31
|
+
* avatar, and so on.
|
|
32
|
+
*
|
|
33
|
+
* @param props - Component props (see `DataTableCardProps`).
|
|
34
|
+
* @returns The data table component.
|
|
35
|
+
*/
|
|
36
|
+
export declare const DataTableCard: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
37
|
+
/** Optional title above the table chrome (a node may arrive as the `title` slot). */
|
|
38
|
+
title: {
|
|
39
|
+
type: PropType<VNodeChild>;
|
|
40
|
+
default: undefined;
|
|
41
|
+
};
|
|
42
|
+
/** Right-aligned action in the title row (a node may arrive as the `titleAction` slot). */
|
|
43
|
+
titleAction: {
|
|
44
|
+
type: PropType<VNodeChild>;
|
|
45
|
+
default: undefined;
|
|
46
|
+
};
|
|
47
|
+
/** Column definitions. */
|
|
48
|
+
columns: {
|
|
49
|
+
type: PropType<ReadonlyArray<DataTableColumn<unknown>>>;
|
|
50
|
+
required: true;
|
|
51
|
+
};
|
|
52
|
+
/** Rows to render. */
|
|
53
|
+
rows: {
|
|
54
|
+
type: PropType<ReadonlyArray<unknown>>;
|
|
55
|
+
required: true;
|
|
56
|
+
};
|
|
57
|
+
/** Pull a stable key from a row. */
|
|
58
|
+
rowKey: {
|
|
59
|
+
type: PropType<RowKey>;
|
|
60
|
+
required: true;
|
|
61
|
+
};
|
|
62
|
+
/** When true, renders 5 skeleton rows instead of `rows`. */
|
|
63
|
+
loading: {
|
|
64
|
+
type: BooleanConstructor;
|
|
65
|
+
default: boolean;
|
|
66
|
+
};
|
|
67
|
+
/** Optional click handler per row. */
|
|
68
|
+
onRowClick: {
|
|
69
|
+
type: PropType<RowClick | undefined>;
|
|
70
|
+
default: undefined;
|
|
71
|
+
};
|
|
72
|
+
/** Empty-state content (a node may arrive as the `emptyMessage` slot). */
|
|
73
|
+
emptyMessage: {
|
|
74
|
+
type: PropType<VNodeChild>;
|
|
75
|
+
default: undefined;
|
|
76
|
+
};
|
|
77
|
+
/** Extra classes on the outer card. */
|
|
78
|
+
className: {
|
|
79
|
+
type: PropType<string | undefined>;
|
|
80
|
+
default: undefined;
|
|
81
|
+
};
|
|
82
|
+
/** `data-mol-id` for AI-agent selectors. */
|
|
83
|
+
dataMolId: {
|
|
84
|
+
type: PropType<string | undefined>;
|
|
85
|
+
default: undefined;
|
|
86
|
+
};
|
|
87
|
+
}>, () => VNode, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
88
|
+
/** Optional title above the table chrome (a node may arrive as the `title` slot). */
|
|
89
|
+
title: {
|
|
90
|
+
type: PropType<VNodeChild>;
|
|
91
|
+
default: undefined;
|
|
92
|
+
};
|
|
93
|
+
/** Right-aligned action in the title row (a node may arrive as the `titleAction` slot). */
|
|
94
|
+
titleAction: {
|
|
95
|
+
type: PropType<VNodeChild>;
|
|
96
|
+
default: undefined;
|
|
97
|
+
};
|
|
98
|
+
/** Column definitions. */
|
|
99
|
+
columns: {
|
|
100
|
+
type: PropType<ReadonlyArray<DataTableColumn<unknown>>>;
|
|
101
|
+
required: true;
|
|
102
|
+
};
|
|
103
|
+
/** Rows to render. */
|
|
104
|
+
rows: {
|
|
105
|
+
type: PropType<ReadonlyArray<unknown>>;
|
|
106
|
+
required: true;
|
|
107
|
+
};
|
|
108
|
+
/** Pull a stable key from a row. */
|
|
109
|
+
rowKey: {
|
|
110
|
+
type: PropType<RowKey>;
|
|
111
|
+
required: true;
|
|
112
|
+
};
|
|
113
|
+
/** When true, renders 5 skeleton rows instead of `rows`. */
|
|
114
|
+
loading: {
|
|
115
|
+
type: BooleanConstructor;
|
|
116
|
+
default: boolean;
|
|
117
|
+
};
|
|
118
|
+
/** Optional click handler per row. */
|
|
119
|
+
onRowClick: {
|
|
120
|
+
type: PropType<RowClick | undefined>;
|
|
121
|
+
default: undefined;
|
|
122
|
+
};
|
|
123
|
+
/** Empty-state content (a node may arrive as the `emptyMessage` slot). */
|
|
124
|
+
emptyMessage: {
|
|
125
|
+
type: PropType<VNodeChild>;
|
|
126
|
+
default: undefined;
|
|
127
|
+
};
|
|
128
|
+
/** Extra classes on the outer card. */
|
|
129
|
+
className: {
|
|
130
|
+
type: PropType<string | undefined>;
|
|
131
|
+
default: undefined;
|
|
132
|
+
};
|
|
133
|
+
/** `data-mol-id` for AI-agent selectors. */
|
|
134
|
+
dataMolId: {
|
|
135
|
+
type: PropType<string | undefined>;
|
|
136
|
+
default: undefined;
|
|
137
|
+
};
|
|
138
|
+
}>> & Readonly<{}>, {
|
|
139
|
+
title: VNodeChild;
|
|
140
|
+
titleAction: VNodeChild;
|
|
141
|
+
loading: boolean;
|
|
142
|
+
onRowClick: RowClick | undefined;
|
|
143
|
+
emptyMessage: VNodeChild;
|
|
144
|
+
className: string | undefined;
|
|
145
|
+
dataMolId: string | undefined;
|
|
146
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
147
|
+
export {};
|
|
148
|
+
//# sourceMappingURL=DataTableCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataTableCard.d.ts","sourceRoot":"","sources":["../src/DataTableCard.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAsB,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,KAAK,CAAA;AAIpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,gGAAgG;AAChG,KAAK,MAAM,GAAG,CAAC,GAAG,EAAE,KAAK,KAAK,MAAM,CAAA;AAEpC,+FAA+F;AAC/F,KAAK,QAAQ,GAAG,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAA;AAyCpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,aAAa;IAGtB,qFAAqF;;;;;IAErF,2FAA2F;;;;;IAE3F,0BAA0B;;cAET,QAAQ,CAAC,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;;;IAGlE,sBAAsB;;cACC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;;;IACvD,oCAAoC;;cACR,QAAQ,CAAC,MAAM,CAAC;;;IAC5C,4DAA4D;;;;;IAE5D,sCAAsC;;cACN,QAAQ,CAAC,QAAQ,GAAG,SAAS,CAAC;;;IAC9D,0EAA0E;;;;;IAE1E,uCAAuC;;cACV,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;IACzD,4CAA4C;;cACf,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;UAK9C,KAAK;IA3BhB,qFAAqF;;;;;IAErF,2FAA2F;;;;;IAE3F,0BAA0B;;cAET,QAAQ,CAAC,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;;;IAGlE,sBAAsB;;cACC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;;;IACvD,oCAAoC;;cACR,QAAQ,CAAC,MAAM,CAAC;;;IAC5C,4DAA4D;;;;;IAE5D,sCAAsC;;cACN,QAAQ,CAAC,QAAQ,GAAG,SAAS,CAAC;;;IAC9D,0EAA0E;;;;;IAE1E,uCAAuC;;cACV,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;IACzD,4CAA4C;;cACf,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;;;;;;;;;;;4EAwI3D,CAAA"}
|