@ketvietlab/design-system 0.1.25 → 0.1.29
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/README.md +29 -0
- package/dist/atlas/island-runtime.d.mts +2 -0
- package/dist/atlas/island-runtime.d.mts.map +1 -0
- package/dist/atlas/island-runtime.mjs +2 -0
- package/dist/atlas/island-runtime.mjs.map +1 -0
- package/dist/atlas/relation-select-hydration.d.ts +2 -0
- package/dist/atlas/relation-select-hydration.d.ts.map +1 -0
- package/dist/atlas/relation-select-hydration.js +40 -0
- package/dist/atlas/relation-select-hydration.js.map +1 -0
- package/dist/atlas-cli.d.ts.map +1 -1
- package/dist/atlas-cli.js +18 -3
- package/dist/atlas-cli.js.map +1 -1
- package/dist/catalogue/index.js +1 -1
- package/dist/catalogue/inventory-policy.json +49 -0
- package/dist/catalogue/inventory.generated.js +1 -1
- package/dist/catalogue/inventory.generated.js.map +1 -1
- package/dist/catalogue/inventory.generated.json +2613 -1092
- package/dist/catalogue/registry.d.ts.map +1 -1
- package/dist/catalogue/registry.js +18 -0
- package/dist/catalogue/registry.js.map +1 -1
- package/dist/catalogue/specimens.d.ts.map +1 -1
- package/dist/catalogue/specimens.js +130 -10
- package/dist/catalogue/specimens.js.map +1 -1
- package/dist/contract/index.d.ts.map +1 -1
- package/dist/contract/index.js +10 -0
- package/dist/contract/index.js.map +1 -1
- package/dist/foundations/tokens.css +34 -26
- package/dist/index.d.ts +14 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/interactions/ket-table/demo.d.ts +4 -0
- package/dist/interactions/ket-table/demo.d.ts.map +1 -0
- package/dist/interactions/ket-table/demo.js +147 -0
- package/dist/interactions/ket-table/demo.js.map +1 -0
- package/dist/interactions/ket-table/index.d.ts +199 -0
- package/dist/interactions/ket-table/index.d.ts.map +1 -0
- package/dist/interactions/ket-table/index.js +376 -0
- package/dist/interactions/ket-table/index.js.map +1 -0
- package/dist/interactions/ket-table/styles.css +282 -0
- package/dist/interactions/lightbox/demo.d.ts +3 -0
- package/dist/interactions/lightbox/demo.d.ts.map +1 -0
- package/dist/interactions/lightbox/demo.js +21 -0
- package/dist/interactions/lightbox/demo.js.map +1 -0
- package/dist/interactions/lightbox/index.d.ts +58 -0
- package/dist/interactions/lightbox/index.d.ts.map +1 -0
- package/dist/interactions/lightbox/index.js +220 -0
- package/dist/interactions/lightbox/index.js.map +1 -0
- package/dist/interactions/lightbox/styles.css +153 -0
- package/dist/interactions/relation-select/demo.d.ts +3 -0
- package/dist/interactions/relation-select/demo.d.ts.map +1 -0
- package/dist/interactions/relation-select/demo.js +36 -0
- package/dist/interactions/relation-select/demo.js.map +1 -0
- package/dist/interactions/relation-select/index.d.ts +87 -0
- package/dist/interactions/relation-select/index.d.ts.map +1 -0
- package/dist/interactions/relation-select/index.js +307 -0
- package/dist/interactions/relation-select/index.js.map +1 -0
- package/dist/interactions/relation-select/styles.css +311 -0
- package/dist/interactions/reorder-list/index.d.ts +23 -0
- package/dist/interactions/reorder-list/index.d.ts.map +1 -0
- package/dist/interactions/reorder-list/index.js +15 -0
- package/dist/interactions/reorder-list/index.js.map +1 -0
- package/dist/interactions/reorder-list/runtime.d.ts +5 -0
- package/dist/interactions/reorder-list/runtime.d.ts.map +1 -0
- package/dist/interactions/reorder-list/runtime.js +85 -0
- package/dist/interactions/reorder-list/runtime.js.map +1 -0
- package/dist/interactions/reorder-list/styles.css +33 -0
- package/dist/interactions/search-filter/demo.d.ts +3 -0
- package/dist/interactions/search-filter/demo.d.ts.map +1 -0
- package/dist/interactions/search-filter/demo.js +74 -0
- package/dist/interactions/search-filter/demo.js.map +1 -0
- package/dist/interactions/search-filter/index.d.ts +153 -0
- package/dist/interactions/search-filter/index.d.ts.map +1 -0
- package/dist/interactions/search-filter/index.js +824 -0
- package/dist/interactions/search-filter/index.js.map +1 -0
- package/dist/interactions/search-filter/styles.css +580 -0
- package/dist/layouts/app-navigation/index.d.ts +11 -5
- package/dist/layouts/app-navigation/index.d.ts.map +1 -1
- package/dist/layouts/app-navigation/index.js +5 -3
- package/dist/layouts/app-navigation/index.js.map +1 -1
- package/dist/layouts/app-navigation/styles.css +50 -0
- package/dist/layouts/page-identity/index.d.ts +2 -0
- package/dist/layouts/page-identity/index.d.ts.map +1 -1
- package/dist/layouts/page-identity/index.js +2 -2
- package/dist/layouts/page-identity/index.js.map +1 -1
- package/dist/layouts/shell/index.d.ts +34 -1
- package/dist/layouts/shell/index.d.ts.map +1 -1
- package/dist/layouts/shell/index.js +26 -2
- package/dist/layouts/shell/index.js.map +1 -1
- package/dist/layouts/shell/styles.css +283 -0
- package/dist/patterns/data-table/styles.css +1 -1
- package/dist/patterns/list-page/index.d.ts +10 -3
- package/dist/patterns/list-page/index.d.ts.map +1 -1
- package/dist/patterns/list-page/index.js +10 -6
- package/dist/patterns/list-page/index.js.map +1 -1
- package/dist/patterns/list-page/responsive.css +1 -5
- package/dist/patterns/list-page/styles.css +25 -3
- package/dist/patterns/modal-sheet/index.d.ts +2 -0
- package/dist/patterns/modal-sheet/index.d.ts.map +1 -1
- package/dist/patterns/modal-sheet/index.js +3 -1
- package/dist/patterns/modal-sheet/index.js.map +1 -1
- package/dist/patterns/record-form/styles.css +34 -0
- package/dist/primitives/actions/index.d.ts +4 -0
- package/dist/primitives/actions/index.d.ts.map +1 -1
- package/dist/primitives/actions/index.js +2 -2
- package/dist/primitives/actions/index.js.map +1 -1
- package/dist/primitives/actions/styles.css +9 -0
- package/dist/primitives/feedback/styles.css +4 -1
- package/dist/primitives/status/index.d.ts +12 -1
- package/dist/primitives/status/index.d.ts.map +1 -1
- package/dist/primitives/status/index.js +16 -1
- package/dist/primitives/status/index.js.map +1 -1
- package/dist/primitives/status/styles.css +28 -0
- package/dist/record/formatted-values/index.d.ts +2 -1
- package/dist/record/formatted-values/index.d.ts.map +1 -1
- package/dist/record/formatted-values/index.js +2 -1
- package/dist/record/formatted-values/index.js.map +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +129 -2
- package/dist/runtime/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// Shared between the design-system's own catalogue specimen and (potentially) an
|
|
2
|
+
// atlas-style static demo, same role as `search-filter/demo.ts`. There is no
|
|
3
|
+
// live RPC, so sort/pager stay visibly present but inert — a viewer can still
|
|
4
|
+
// select rows and expand the pre-populated group, which needs no round trip.
|
|
5
|
+
export const ketTableDemoConfig = {
|
|
6
|
+
idField: 'id',
|
|
7
|
+
rowHrefTemplate: '#ket-table/{id}',
|
|
8
|
+
columns: [
|
|
9
|
+
{
|
|
10
|
+
key: 'name',
|
|
11
|
+
label: 'Name',
|
|
12
|
+
format: { kind: 'person', field: 'name' },
|
|
13
|
+
priority: 'primary',
|
|
14
|
+
width: 'wide',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
key: 'kind',
|
|
18
|
+
label: 'Kind',
|
|
19
|
+
format: {
|
|
20
|
+
kind: 'status',
|
|
21
|
+
field: 'kind',
|
|
22
|
+
tones: {
|
|
23
|
+
company: { label: 'Company', tone: 'info' },
|
|
24
|
+
person: { label: 'Person', tone: 'neutral' },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
sortable: true,
|
|
28
|
+
},
|
|
29
|
+
{ key: 'ref', label: 'Ref', format: { kind: 'identifier', field: 'ref' } },
|
|
30
|
+
{
|
|
31
|
+
key: 'total',
|
|
32
|
+
label: 'Total',
|
|
33
|
+
format: { kind: 'currency', field: 'total', currency: 'VND' },
|
|
34
|
+
align: 'end',
|
|
35
|
+
sortable: true,
|
|
36
|
+
},
|
|
37
|
+
{ key: 'createdAt', label: 'Created on', format: { kind: 'date', field: 'createdAt' }, sortable: true },
|
|
38
|
+
{
|
|
39
|
+
key: 'state',
|
|
40
|
+
label: 'State',
|
|
41
|
+
format: {
|
|
42
|
+
kind: 'status',
|
|
43
|
+
field: 'state',
|
|
44
|
+
tones: {
|
|
45
|
+
active: { label: 'Active', tone: 'positive' },
|
|
46
|
+
archived: { label: 'Archived', tone: 'neutral' },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
rows: [
|
|
52
|
+
{
|
|
53
|
+
id: 'p1',
|
|
54
|
+
name: 'Ngọc Linh Trading',
|
|
55
|
+
kind: 'company',
|
|
56
|
+
ref: 'CUS-0001',
|
|
57
|
+
total: 4_250_000,
|
|
58
|
+
createdAt: '2026-06-02',
|
|
59
|
+
state: 'active',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 'p2',
|
|
63
|
+
name: 'Trần Minh Anh',
|
|
64
|
+
kind: 'person',
|
|
65
|
+
ref: 'CUS-0002',
|
|
66
|
+
total: 890_000,
|
|
67
|
+
createdAt: '2026-06-11',
|
|
68
|
+
state: 'active',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 'p3',
|
|
72
|
+
name: 'Việt Phát Logistics',
|
|
73
|
+
kind: 'company',
|
|
74
|
+
ref: 'CUS-0003',
|
|
75
|
+
total: 12_400_000,
|
|
76
|
+
createdAt: '2026-05-28',
|
|
77
|
+
state: 'archived',
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
total: 3,
|
|
81
|
+
selection: { formId: 'demo-ket-table-bulk' },
|
|
82
|
+
manager: { listFunction: '', pageSize: 5 },
|
|
83
|
+
labels: {
|
|
84
|
+
selectAll: 'Select all rows',
|
|
85
|
+
selectRow: 'Select row',
|
|
86
|
+
sortedAscending: 'Sorted ascending',
|
|
87
|
+
sortedDescending: 'Sorted descending',
|
|
88
|
+
previousPage: 'Previous page',
|
|
89
|
+
nextPage: 'Next page',
|
|
90
|
+
loading: 'Loading…',
|
|
91
|
+
loadError: 'Could not load rows',
|
|
92
|
+
retry: 'Retry',
|
|
93
|
+
empty: 'No records',
|
|
94
|
+
emptyHint: 'There is nothing to show yet.',
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
// A second, grouped demo — the tree is pre-populated (no `manager`), so
|
|
98
|
+
// expanding either group needs no round trip, exactly like the flat demo above.
|
|
99
|
+
export const ketTableGroupedDemoConfig = {
|
|
100
|
+
...ketTableDemoConfig,
|
|
101
|
+
rows: [],
|
|
102
|
+
groupBy: ['kind'],
|
|
103
|
+
groups: [
|
|
104
|
+
{
|
|
105
|
+
id: 'company',
|
|
106
|
+
label: 'Company',
|
|
107
|
+
count: 2,
|
|
108
|
+
rows: [
|
|
109
|
+
{
|
|
110
|
+
id: 'p1',
|
|
111
|
+
name: 'Ngọc Linh Trading',
|
|
112
|
+
kind: 'company',
|
|
113
|
+
ref: 'CUS-0001',
|
|
114
|
+
total: 4_250_000,
|
|
115
|
+
createdAt: '2026-06-02',
|
|
116
|
+
state: 'active',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: 'p3',
|
|
120
|
+
name: 'Việt Phát Logistics',
|
|
121
|
+
kind: 'company',
|
|
122
|
+
ref: 'CUS-0003',
|
|
123
|
+
total: 12_400_000,
|
|
124
|
+
createdAt: '2026-05-28',
|
|
125
|
+
state: 'archived',
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: 'person',
|
|
131
|
+
label: 'Person',
|
|
132
|
+
count: 1,
|
|
133
|
+
rows: [
|
|
134
|
+
{
|
|
135
|
+
id: 'p2',
|
|
136
|
+
name: 'Trần Minh Anh',
|
|
137
|
+
kind: 'person',
|
|
138
|
+
ref: 'CUS-0002',
|
|
139
|
+
total: 890_000,
|
|
140
|
+
createdAt: '2026-06-11',
|
|
141
|
+
state: 'active',
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
};
|
|
147
|
+
//# sourceMappingURL=demo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"demo.js","sourceRoot":"","sources":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EAAE,OAAO;QACd,KAAK,EAAE,YAAY;QACnB,SAAS,EAAE,+BAA+B;KAC3C;CACF,CAAA;AAED,wEAAwE;AACxE,gFAAgF;AAChF,MAAM,CAAC,MAAM,yBAAyB,GAAmB;IACvD,GAAG,kBAAkB;IACrB,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,CAAC,MAAM,CAAC;IACjB,MAAM,EAAE;QACN;YACE,EAAE,EAAE,SAAS;YACb,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,CAAC;YACR,IAAI,EAAE;gBACJ;oBACE,EAAE,EAAE,IAAI;oBACR,IAAI,EAAE,mBAAmB;oBACzB,IAAI,EAAE,SAAS;oBACf,GAAG,EAAE,UAAU;oBACf,KAAK,EAAE,SAAS;oBAChB,SAAS,EAAE,YAAY;oBACvB,KAAK,EAAE,QAAQ;iBAChB;gBACD;oBACE,EAAE,EAAE,IAAI;oBACR,IAAI,EAAE,qBAAqB;oBAC3B,IAAI,EAAE,SAAS;oBACf,GAAG,EAAE,UAAU;oBACf,KAAK,EAAE,UAAU;oBACjB,SAAS,EAAE,YAAY;oBACvB,KAAK,EAAE,UAAU;iBAClB;aACF;SACF;QACD;YACE,EAAE,EAAE,QAAQ;YACZ,KAAK,EAAE,QAAQ;YACf,KAAK,EAAE,CAAC;YACR,IAAI,EAAE;gBACJ;oBACE,EAAE,EAAE,IAAI;oBACR,IAAI,EAAE,eAAe;oBACrB,IAAI,EAAE,QAAQ;oBACd,GAAG,EAAE,UAAU;oBACf,KAAK,EAAE,OAAO;oBACd,SAAS,EAAE,YAAY;oBACvB,KAAK,EAAE,QAAQ;iBAChB;aACF;SACF;KACF;CACF,CAAA"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import type { IslandController, IslandProps, JSXChild, TemplateResult } from '@ketvietlab/ketjs-view';
|
|
2
|
+
import type { Tone } from '../../primitives/status/index.tsx';
|
|
3
|
+
export declare const HOOKS: readonly ['ket-table', 'kt-scroll', 'kt-selection-target', 'kt-grid', 'kt-select-col', 'kt-select-all', 'kt-col', 'kt-sort-button', 'kt-sort-icon', 'kt-row', 'kt-cell', 'kt-person', 'kt-select-cell', 'kt-row-select', 'kt-row-link', 'kt-group-row', 'kt-group-cell', 'kt-group-toggle', 'kt-group-indent', 'kt-group-count', 'kt-group-pager', 'kt-pager', 'kt-pager-label', 'kt-pager-button', 'kt-select-persisted', 'kt-caption', 'kt-tools'];
|
|
4
|
+
export type KetTableRow = Record<string, unknown>;
|
|
5
|
+
/**
|
|
6
|
+
* A cell's shape as data, not code — a column's `format` has to cross the
|
|
7
|
+
* island's server/browser props boundary as JSON (see `IslandController`),
|
|
8
|
+
* so unlike a plain SSR table there is no `cell: (row) => JSX` closure here.
|
|
9
|
+
* `custom` is the escape hatch for anything the other 7 kinds can't express.
|
|
10
|
+
*/
|
|
11
|
+
export type KetTableCellFormat = {
|
|
12
|
+
kind: 'text';
|
|
13
|
+
field: string;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'number';
|
|
16
|
+
field: string;
|
|
17
|
+
minimumFractionDigits?: number;
|
|
18
|
+
maximumFractionDigits?: number;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'currency';
|
|
21
|
+
field: string;
|
|
22
|
+
currency: string;
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'date';
|
|
25
|
+
field: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'status';
|
|
28
|
+
field: string;
|
|
29
|
+
tones: Record<string, {
|
|
30
|
+
label: string;
|
|
31
|
+
tone: Tone;
|
|
32
|
+
}>;
|
|
33
|
+
} | {
|
|
34
|
+
kind: 'identifier';
|
|
35
|
+
field: string;
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'person';
|
|
38
|
+
field: string;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'link';
|
|
41
|
+
field: string;
|
|
42
|
+
hrefField: string;
|
|
43
|
+
} | {
|
|
44
|
+
kind: 'custom';
|
|
45
|
+
field: string;
|
|
46
|
+
renderer: string;
|
|
47
|
+
options?: Record<string, unknown>;
|
|
48
|
+
};
|
|
49
|
+
export type KetTableColumn = {
|
|
50
|
+
key: string;
|
|
51
|
+
label: string;
|
|
52
|
+
format: KetTableCellFormat;
|
|
53
|
+
align?: 'start' | 'end';
|
|
54
|
+
priority?: 'primary' | 'secondary' | 'tertiary';
|
|
55
|
+
width?: 'narrow' | 'medium' | 'wide';
|
|
56
|
+
sortable?: boolean;
|
|
57
|
+
/** Native URL-driven sorting; takes precedence over the RPC sort handler. */
|
|
58
|
+
sortHref?: string;
|
|
59
|
+
sortLabel?: string;
|
|
60
|
+
sortDirection?: 'asc' | 'desc' | null;
|
|
61
|
+
/** Semantic presentation hint for server-rendered custom cells. */
|
|
62
|
+
kind?: 'text' | 'number' | 'currency' | 'date' | 'status' | 'identifier' | 'person' | 'media';
|
|
63
|
+
};
|
|
64
|
+
export type KetTableSort = {
|
|
65
|
+
field: string;
|
|
66
|
+
direction: 'asc' | 'desc';
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* `listFunction` is the only RPC a sort or page change ever calls — over the
|
|
70
|
+
* same `callApi`/`/_ket/fn/` contract `relation-select`/`search-filter`
|
|
71
|
+
* already use. There is deliberately no `countFunction` here: `listInput`
|
|
72
|
+
* never changes from inside KetTable itself, so the row count it would
|
|
73
|
+
* recompute is always the one `KetTableConfig.total` already holds from the
|
|
74
|
+
* page's own initial render — the caller counts once, server-side, the same
|
|
75
|
+
* way it already builds that first page. `groupFunction` is only needed when
|
|
76
|
+
* `KetTableConfig.groupBy` is non-empty.
|
|
77
|
+
*/
|
|
78
|
+
export type KetTableManager = {
|
|
79
|
+
listFunction: string;
|
|
80
|
+
groupFunction?: string;
|
|
81
|
+
listInput?: Record<string, unknown>;
|
|
82
|
+
pageSize?: number;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Targets an *external* form by id — e.g. a screen's existing bulk-action
|
|
86
|
+
* form. Each selected row becomes a hidden `{fieldName}.{id}` input targeting
|
|
87
|
+
* that form, the same "selected.<id>" convention ketsuite's own bulk-action
|
|
88
|
+
* forms already parse — so a form built for that convention needs no change.
|
|
89
|
+
*/
|
|
90
|
+
export type KetTableSelection = {
|
|
91
|
+
formId: string;
|
|
92
|
+
fieldName?: string;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* One group level's node. Reuses the same shape design-system's SSR
|
|
96
|
+
* `TableGroup` and ketsuite's `loadListGroups` already return — `children`
|
|
97
|
+
* (subgroups) or `rows` (a leaf group's rows) are absent until that node is
|
|
98
|
+
* expanded and fetched, or until the caller pre-populates them statically
|
|
99
|
+
* (a manager-less demo can supply an already-open tree with no RPC needed).
|
|
100
|
+
*/
|
|
101
|
+
export type KetTableGroup = {
|
|
102
|
+
id: string;
|
|
103
|
+
label: string;
|
|
104
|
+
count: number;
|
|
105
|
+
children?: KetTableGroup[];
|
|
106
|
+
rows?: KetTableRow[];
|
|
107
|
+
/** Zero-based row offset for this leaf group's current page. */
|
|
108
|
+
offset?: number;
|
|
109
|
+
/** URL-driven trees explicitly carry their expansion state and next URL. */
|
|
110
|
+
open?: boolean;
|
|
111
|
+
href?: string;
|
|
112
|
+
pager?: {
|
|
113
|
+
label: string;
|
|
114
|
+
prev?: string;
|
|
115
|
+
next?: string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
export type KetTableLabels = {
|
|
119
|
+
region?: string;
|
|
120
|
+
selectAll: string;
|
|
121
|
+
selectRow: string;
|
|
122
|
+
sortedAscending: string;
|
|
123
|
+
sortedDescending: string;
|
|
124
|
+
previousPage: string;
|
|
125
|
+
nextPage: string;
|
|
126
|
+
loading: string;
|
|
127
|
+
loadError: string;
|
|
128
|
+
retry: string;
|
|
129
|
+
empty: string;
|
|
130
|
+
emptyHint: string;
|
|
131
|
+
};
|
|
132
|
+
export type KetTableConfig = {
|
|
133
|
+
columns: KetTableColumn[];
|
|
134
|
+
/** First page, server-rendered — ignored once `groupBy` is non-empty. */
|
|
135
|
+
rows: KetTableRow[];
|
|
136
|
+
total: number;
|
|
137
|
+
idField: string;
|
|
138
|
+
locale?: string;
|
|
139
|
+
/** A `{id}`-interpolated href, replacing a function-typed `rowHref` that couldn't cross the props boundary. */
|
|
140
|
+
rowHrefTemplate?: string;
|
|
141
|
+
/** The active group-by keys, in order — the array `search-filter`'s active Group By facets already produce. Empty ⇒ a flat table. */
|
|
142
|
+
groupBy?: string[];
|
|
143
|
+
/** The server-rendered top level, when `groupBy` is non-empty. */
|
|
144
|
+
groups?: KetTableGroup[];
|
|
145
|
+
selection?: KetTableSelection;
|
|
146
|
+
/** Omit for URL-driven tables whose rows are supplied by the page route. */
|
|
147
|
+
manager?: KetTableManager;
|
|
148
|
+
page?: number;
|
|
149
|
+
sort?: KetTableSort | null;
|
|
150
|
+
/** False when the containing toolbar owns pagination. */
|
|
151
|
+
pager?: false | {
|
|
152
|
+
prev?: string;
|
|
153
|
+
next?: string;
|
|
154
|
+
};
|
|
155
|
+
labels: KetTableLabels;
|
|
156
|
+
};
|
|
157
|
+
export type KetTableExtensions = Record<string, (value: unknown, row: KetTableRow, options: Record<string, unknown> | undefined) => TemplateResult>;
|
|
158
|
+
/** Server-owned collection cells keep their semantic markup and exact values.
|
|
159
|
+
* URL navigation and native external-form controls require no island props.
|
|
160
|
+
* The same KetTable renderer and CSS serve both this surface and the island.
|
|
161
|
+
*/
|
|
162
|
+
export type KetTableServerProps<Row> = {
|
|
163
|
+
columns: Array<Omit<KetTableColumn, 'format' | 'sortable'> & {
|
|
164
|
+
cell: (row: Row) => JSXChild;
|
|
165
|
+
}>;
|
|
166
|
+
rows: readonly Row[];
|
|
167
|
+
id: (row: Row) => string;
|
|
168
|
+
rowHref?: (row: Row) => string;
|
|
169
|
+
rowLink?: boolean;
|
|
170
|
+
caption?: string | null;
|
|
171
|
+
tools?: JSXChild;
|
|
172
|
+
responsive?: 'scroll' | 'stack';
|
|
173
|
+
gutter?: 'compact';
|
|
174
|
+
selection?: KetTableSelection;
|
|
175
|
+
groups?: readonly (Omit<KetTableGroup, 'rows' | 'children' | 'href'> & {
|
|
176
|
+
href: string;
|
|
177
|
+
rows?: readonly Row[];
|
|
178
|
+
children?: KetTableServerProps<Row>['groups'];
|
|
179
|
+
})[];
|
|
180
|
+
sort?: KetTableSort | null;
|
|
181
|
+
labels: KetTableLabels;
|
|
182
|
+
};
|
|
183
|
+
type ServerRendering = {
|
|
184
|
+
rowHref?: (row: KetTableRow) => string;
|
|
185
|
+
rowLink?: boolean;
|
|
186
|
+
caption?: string | null;
|
|
187
|
+
tools?: JSXChild;
|
|
188
|
+
responsive?: 'scroll' | 'stack';
|
|
189
|
+
gutter?: 'compact';
|
|
190
|
+
};
|
|
191
|
+
export declare const KetTable: <Row>(props: KetTableServerProps<Row>) => TemplateResult;
|
|
192
|
+
type KetTableIslandProps = IslandProps & {
|
|
193
|
+
id: string;
|
|
194
|
+
config: KetTableConfig;
|
|
195
|
+
};
|
|
196
|
+
export declare function createKetTableView(props: KetTableIslandProps, extensions?: KetTableExtensions, server?: ServerRendering): IslandController;
|
|
197
|
+
export declare const ketTable: (props: IslandProps) => IslandController;
|
|
198
|
+
export {};
|
|
199
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/design-system/src/interactions/ket-table/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAErG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAA;AAI7D,eAAO,MAAM,KAAK,YAChB,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,SAAS,EACT,eAAe,EACf,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,cAAc,E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