@indielayer/ui 0.0.0-dev-20240125104319 → 0.0.0-dev-20240127005325
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/lib/common/icons.d.ts +2 -1
- package/lib/common/icons.js +3 -2
- package/lib/components/icon/theme/Icon.carbon.theme.js +7 -4
- package/lib/components/index.js +1 -1
- package/lib/components/link/Link.vue.js +2 -2
- package/lib/components/link/Link.vue2.js +1 -1
- package/lib/components/link/theme/Link.base.theme.js +4 -4
- package/lib/components/link/theme/Link.carbon.theme.js +23 -3
- package/lib/components/menu/MenuItem.vue.js +2 -2
- package/lib/components/menu/MenuItem.vue2.js +1 -1
- package/lib/components/select/Select.vue.js +49 -47
- package/lib/components/skeleton/Skeleton.vue.d.ts +19 -1
- package/lib/components/skeleton/Skeleton.vue.js +25 -15
- package/lib/components/skeleton/theme/Skeleton.base.theme.js +7 -4
- package/lib/components/table/Table.vue.d.ts +115 -9
- package/lib/components/table/Table.vue.js +210 -99
- package/lib/components/table/TableCell.vue.d.ts +4 -5
- package/lib/components/table/TableCell.vue.js +21 -22
- package/lib/components/table/TableHead.vue.d.ts +16 -0
- package/lib/components/table/TableHead.vue.js +21 -0
- package/lib/components/table/TableHead.vue2.js +4 -0
- package/lib/components/table/TableHeader.vue.d.ts +4 -0
- package/lib/components/table/TableHeader.vue.js +45 -54
- package/lib/components/table/TableRow.vue.d.ts +15 -1
- package/lib/components/table/TableRow.vue.js +21 -25
- package/lib/components/table/index.d.ts +4 -2
- package/lib/components/table/theme/Table.base.theme.js +7 -6
- package/lib/components/table/theme/Table.carbon.theme.js +11 -3
- package/lib/components/table/theme/TableCell.base.theme.js +3 -3
- package/lib/components/table/theme/TableCell.carbon.theme.js +9 -3
- package/lib/components/table/theme/TableHead.base.theme.d.ts +3 -0
- package/lib/components/table/theme/TableHead.base.theme.js +9 -0
- package/lib/components/table/theme/TableHead.carbon.theme.d.ts +3 -0
- package/lib/components/table/theme/TableHead.carbon.theme.js +9 -0
- package/lib/components/table/theme/TableHeader.base.theme.d.ts +3 -0
- package/lib/components/table/theme/TableHeader.base.theme.js +12 -0
- package/lib/components/table/theme/TableHeader.carbon.theme.d.ts +3 -0
- package/lib/components/table/theme/TableHeader.carbon.theme.js +12 -0
- package/lib/components/table/theme/TableRow.base.theme.d.ts +3 -0
- package/lib/components/table/theme/TableRow.base.theme.js +11 -0
- package/lib/components/table/theme/TableRow.carbon.theme.d.ts +3 -0
- package/lib/components/table/theme/TableRow.carbon.theme.js +11 -0
- package/lib/components/tag/Tag.vue.d.ts +1 -1
- package/lib/components/tag/Tag.vue.js +17 -17
- package/lib/components/tag/theme/Tag.base.theme.js +14 -13
- package/lib/components/tag/theme/Tag.carbon.theme.js +14 -14
- package/lib/index.js +2 -2
- package/lib/index.umd.js +3 -3
- package/lib/theme.d.ts +4 -1
- package/lib/themes/base/components.d.ts +3 -0
- package/lib/themes/base/components.js +44 -38
- package/lib/themes/carbon/components.d.ts +3 -0
- package/lib/themes/carbon/components.js +44 -38
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/common/icons.ts +2 -1
- package/src/components/icon/theme/Icon.carbon.theme.ts +9 -1
- package/src/components/link/Link.vue +1 -1
- package/src/components/link/theme/Link.carbon.theme.ts +23 -2
- package/src/components/menu/MenuItem.vue +1 -1
- package/src/components/select/Select.vue +6 -4
- package/src/components/skeleton/Skeleton.vue +18 -2
- package/src/components/skeleton/theme/Skeleton.base.theme.ts +8 -1
- package/src/components/table/Table.vue +123 -27
- package/src/components/table/TableCell.vue +5 -6
- package/src/components/table/TableHead.vue +25 -0
- package/src/components/table/TableHeader.vue +35 -56
- package/src/components/table/TableRow.vue +19 -17
- package/src/components/table/index.ts +4 -2
- package/src/components/table/theme/Table.base.theme.ts +9 -7
- package/src/components/table/theme/Table.carbon.theme.ts +18 -2
- package/src/components/table/theme/TableCell.base.theme.ts +1 -1
- package/src/components/table/theme/TableCell.carbon.theme.ts +24 -2
- package/src/components/table/theme/TableHead.base.theme.ts +10 -0
- package/src/components/table/theme/TableHead.carbon.theme.ts +10 -0
- package/src/components/table/theme/TableHeader.base.theme.ts +28 -0
- package/src/components/table/theme/TableHeader.carbon.theme.ts +28 -0
- package/src/components/table/theme/TableRow.base.theme.ts +21 -0
- package/src/components/table/theme/TableRow.carbon.theme.ts +21 -0
- package/src/components/tag/Tag.vue +4 -4
- package/src/components/tag/theme/Tag.base.theme.ts +4 -4
- package/src/components/tag/theme/Tag.carbon.theme.ts +5 -6
- package/src/theme.ts +6 -0
- package/src/themes/base/components.ts +3 -0
- package/src/themes/carbon/components.ts +3 -0
- package/src/version.ts +1 -1
- package/lib/components/table/TableHead.d.ts +0 -2
- package/lib/components/table/TableHead.js +0 -19
- package/src/components/table/TableHead.tsx +0 -14
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ExtractPublicPropTypes, type PropType } from 'vue';
|
|
2
2
|
import { type ThemeComponent } from '../../composables/useTheme';
|
|
3
3
|
import { type TableHeaderAlign } from './TableHeader.vue';
|
|
4
|
+
import type { SkeletonShape } from '../skeleton/Skeleton.vue';
|
|
4
5
|
declare const tableProps: {
|
|
5
6
|
headers: {
|
|
6
7
|
type: PropType<TableHeader[]>;
|
|
@@ -15,6 +16,12 @@ declare const tableProps: {
|
|
|
15
16
|
default: () => never[];
|
|
16
17
|
};
|
|
17
18
|
loading: BooleanConstructor;
|
|
19
|
+
loadingSkeleton: BooleanConstructor;
|
|
20
|
+
loadingLines: {
|
|
21
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
22
|
+
default: number;
|
|
23
|
+
};
|
|
24
|
+
error: BooleanConstructor;
|
|
18
25
|
dense: BooleanConstructor;
|
|
19
26
|
fixed: BooleanConstructor;
|
|
20
27
|
striped: BooleanConstructor;
|
|
@@ -27,6 +34,7 @@ declare const tableProps: {
|
|
|
27
34
|
type: BooleanConstructor;
|
|
28
35
|
default: boolean;
|
|
29
36
|
};
|
|
37
|
+
expandable: BooleanConstructor;
|
|
30
38
|
};
|
|
31
39
|
export type TableHeader = {
|
|
32
40
|
sortable?: boolean;
|
|
@@ -35,33 +43,43 @@ export type TableHeader = {
|
|
|
35
43
|
value?: string;
|
|
36
44
|
text?: string;
|
|
37
45
|
width?: string | number;
|
|
46
|
+
truncate?: boolean;
|
|
47
|
+
skeletonShape?: SkeletonShape;
|
|
38
48
|
};
|
|
39
49
|
export type TableProps = ExtractPublicPropTypes<typeof tableProps>;
|
|
40
|
-
type InternalClasses = 'wrapper' | 'loadingWrapper';
|
|
50
|
+
type InternalClasses = 'wrapper' | 'table' | 'loadingWrapper';
|
|
41
51
|
export interface TableTheme extends ThemeComponent<TableProps, InternalClasses> {
|
|
42
52
|
}
|
|
43
53
|
declare const _default: <T>(__VLS_props: Partial<{
|
|
44
54
|
sort: string[];
|
|
55
|
+
error: boolean;
|
|
45
56
|
items: T[];
|
|
46
57
|
loading: boolean;
|
|
47
58
|
fixed: boolean;
|
|
48
59
|
headers: TableHeader[];
|
|
60
|
+
loadingSkeleton: boolean;
|
|
61
|
+
loadingLines: string | number;
|
|
49
62
|
dense: boolean;
|
|
50
63
|
striped: boolean;
|
|
51
64
|
pointer: boolean;
|
|
52
65
|
scrollable: boolean;
|
|
53
66
|
stickyHeader: boolean;
|
|
67
|
+
expandable: boolean;
|
|
54
68
|
}> & Omit<{
|
|
55
69
|
readonly sort: string[];
|
|
70
|
+
readonly error: boolean;
|
|
56
71
|
readonly items: T[];
|
|
57
72
|
readonly loading: boolean;
|
|
58
73
|
readonly fixed: boolean;
|
|
59
74
|
readonly headers: TableHeader[];
|
|
75
|
+
readonly loadingSkeleton: boolean;
|
|
76
|
+
readonly loadingLines: string | number;
|
|
60
77
|
readonly dense: boolean;
|
|
61
78
|
readonly striped: boolean;
|
|
62
79
|
readonly pointer: boolean;
|
|
63
80
|
readonly scrollable: boolean;
|
|
64
81
|
readonly stickyHeader: boolean;
|
|
82
|
+
readonly expandable: boolean;
|
|
65
83
|
"onUpdate:sort"?: ((...args: any[]) => any) | undefined;
|
|
66
84
|
"onClick-row"?: ((...args: any[]) => any) | undefined;
|
|
67
85
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -78,6 +96,12 @@ declare const _default: <T>(__VLS_props: Partial<{
|
|
|
78
96
|
default: () => never[];
|
|
79
97
|
};
|
|
80
98
|
loading: BooleanConstructor;
|
|
99
|
+
loadingSkeleton: BooleanConstructor;
|
|
100
|
+
loadingLines: {
|
|
101
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
102
|
+
default: number;
|
|
103
|
+
};
|
|
104
|
+
error: BooleanConstructor;
|
|
81
105
|
dense: BooleanConstructor;
|
|
82
106
|
fixed: BooleanConstructor;
|
|
83
107
|
striped: BooleanConstructor;
|
|
@@ -90,32 +114,41 @@ declare const _default: <T>(__VLS_props: Partial<{
|
|
|
90
114
|
type: BooleanConstructor;
|
|
91
115
|
default: boolean;
|
|
92
116
|
};
|
|
117
|
+
expandable: BooleanConstructor;
|
|
93
118
|
}>> & {
|
|
94
119
|
"onUpdate:sort"?: ((...args: any[]) => any) | undefined;
|
|
95
120
|
"onClick-row"?: ((...args: any[]) => any) | undefined;
|
|
96
|
-
}, "sort" | "items" | "loading" | "fixed" | "headers" | "dense" | "striped" | "pointer" | "scrollable" | "stickyHeader"> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: Pick<{
|
|
121
|
+
}, "sort" | "error" | "items" | "loading" | "fixed" | "headers" | "loadingSkeleton" | "loadingLines" | "dense" | "striped" | "pointer" | "scrollable" | "stickyHeader" | "expandable"> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: Pick<{
|
|
97
122
|
props: Partial<{
|
|
98
123
|
sort: string[];
|
|
124
|
+
error: boolean;
|
|
99
125
|
items: T[];
|
|
100
126
|
loading: boolean;
|
|
101
127
|
fixed: boolean;
|
|
102
128
|
headers: TableHeader[];
|
|
129
|
+
loadingSkeleton: boolean;
|
|
130
|
+
loadingLines: string | number;
|
|
103
131
|
dense: boolean;
|
|
104
132
|
striped: boolean;
|
|
105
133
|
pointer: boolean;
|
|
106
134
|
scrollable: boolean;
|
|
107
135
|
stickyHeader: boolean;
|
|
136
|
+
expandable: boolean;
|
|
108
137
|
}> & Omit<{
|
|
109
138
|
readonly sort: string[];
|
|
139
|
+
readonly error: boolean;
|
|
110
140
|
readonly items: T[];
|
|
111
141
|
readonly loading: boolean;
|
|
112
142
|
readonly fixed: boolean;
|
|
113
143
|
readonly headers: TableHeader[];
|
|
144
|
+
readonly loadingSkeleton: boolean;
|
|
145
|
+
readonly loadingLines: string | number;
|
|
114
146
|
readonly dense: boolean;
|
|
115
147
|
readonly striped: boolean;
|
|
116
148
|
readonly pointer: boolean;
|
|
117
149
|
readonly scrollable: boolean;
|
|
118
150
|
readonly stickyHeader: boolean;
|
|
151
|
+
readonly expandable: boolean;
|
|
119
152
|
"onUpdate:sort"?: ((...args: any[]) => any) | undefined;
|
|
120
153
|
"onClick-row"?: ((...args: any[]) => any) | undefined;
|
|
121
154
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -132,6 +165,12 @@ declare const _default: <T>(__VLS_props: Partial<{
|
|
|
132
165
|
default: () => never[];
|
|
133
166
|
};
|
|
134
167
|
loading: BooleanConstructor;
|
|
168
|
+
loadingSkeleton: BooleanConstructor;
|
|
169
|
+
loadingLines: {
|
|
170
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
171
|
+
default: number;
|
|
172
|
+
};
|
|
173
|
+
error: BooleanConstructor;
|
|
135
174
|
dense: BooleanConstructor;
|
|
136
175
|
fixed: BooleanConstructor;
|
|
137
176
|
striped: BooleanConstructor;
|
|
@@ -144,39 +183,60 @@ declare const _default: <T>(__VLS_props: Partial<{
|
|
|
144
183
|
type: BooleanConstructor;
|
|
145
184
|
default: boolean;
|
|
146
185
|
};
|
|
186
|
+
expandable: BooleanConstructor;
|
|
147
187
|
}>> & {
|
|
148
188
|
"onUpdate:sort"?: ((...args: any[]) => any) | undefined;
|
|
149
189
|
"onClick-row"?: ((...args: any[]) => any) | undefined;
|
|
150
|
-
}, "sort" | "items" | "loading" | "fixed" | "headers" | "dense" | "striped" | "pointer" | "scrollable" | "stickyHeader">;
|
|
190
|
+
}, "sort" | "error" | "items" | "loading" | "fixed" | "headers" | "loadingSkeleton" | "loadingLines" | "dense" | "striped" | "pointer" | "scrollable" | "stickyHeader" | "expandable">;
|
|
151
191
|
expose(exposed: {}): void;
|
|
152
192
|
attrs: any;
|
|
153
193
|
slots: Partial<Record<string, (_: {
|
|
194
|
+
header: TableHeader;
|
|
195
|
+
}) => any>> & Partial<Record<string, (_: {
|
|
196
|
+
item: number;
|
|
197
|
+
}) => any>> & Partial<Record<string, (_: {
|
|
154
198
|
item: T;
|
|
155
|
-
}) => any
|
|
199
|
+
}) => any>> & {
|
|
200
|
+
title?(_: {}): any;
|
|
201
|
+
actions?(_: {}): any;
|
|
202
|
+
error?(_: {}): any;
|
|
203
|
+
empty?(_: {}): any;
|
|
204
|
+
"expanded-row"?(_: {
|
|
205
|
+
item: T;
|
|
206
|
+
}): any;
|
|
207
|
+
};
|
|
156
208
|
emit: (event: "update:sort" | "click-row", ...args: any[]) => void;
|
|
157
209
|
}, "emit" | "attrs" | "slots"> | undefined, __VLS_setup?: {
|
|
158
210
|
props: Partial<{
|
|
159
211
|
sort: string[];
|
|
212
|
+
error: boolean;
|
|
160
213
|
items: T[];
|
|
161
214
|
loading: boolean;
|
|
162
215
|
fixed: boolean;
|
|
163
216
|
headers: TableHeader[];
|
|
217
|
+
loadingSkeleton: boolean;
|
|
218
|
+
loadingLines: string | number;
|
|
164
219
|
dense: boolean;
|
|
165
220
|
striped: boolean;
|
|
166
221
|
pointer: boolean;
|
|
167
222
|
scrollable: boolean;
|
|
168
223
|
stickyHeader: boolean;
|
|
224
|
+
expandable: boolean;
|
|
169
225
|
}> & Omit<{
|
|
170
226
|
readonly sort: string[];
|
|
227
|
+
readonly error: boolean;
|
|
171
228
|
readonly items: T[];
|
|
172
229
|
readonly loading: boolean;
|
|
173
230
|
readonly fixed: boolean;
|
|
174
231
|
readonly headers: TableHeader[];
|
|
232
|
+
readonly loadingSkeleton: boolean;
|
|
233
|
+
readonly loadingLines: string | number;
|
|
175
234
|
readonly dense: boolean;
|
|
176
235
|
readonly striped: boolean;
|
|
177
236
|
readonly pointer: boolean;
|
|
178
237
|
readonly scrollable: boolean;
|
|
179
238
|
readonly stickyHeader: boolean;
|
|
239
|
+
readonly expandable: boolean;
|
|
180
240
|
"onUpdate:sort"?: ((...args: any[]) => any) | undefined;
|
|
181
241
|
"onClick-row"?: ((...args: any[]) => any) | undefined;
|
|
182
242
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -193,6 +253,12 @@ declare const _default: <T>(__VLS_props: Partial<{
|
|
|
193
253
|
default: () => never[];
|
|
194
254
|
};
|
|
195
255
|
loading: BooleanConstructor;
|
|
256
|
+
loadingSkeleton: BooleanConstructor;
|
|
257
|
+
loadingLines: {
|
|
258
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
259
|
+
default: number;
|
|
260
|
+
};
|
|
261
|
+
error: BooleanConstructor;
|
|
196
262
|
dense: BooleanConstructor;
|
|
197
263
|
fixed: BooleanConstructor;
|
|
198
264
|
striped: BooleanConstructor;
|
|
@@ -205,15 +271,28 @@ declare const _default: <T>(__VLS_props: Partial<{
|
|
|
205
271
|
type: BooleanConstructor;
|
|
206
272
|
default: boolean;
|
|
207
273
|
};
|
|
274
|
+
expandable: BooleanConstructor;
|
|
208
275
|
}>> & {
|
|
209
276
|
"onUpdate:sort"?: ((...args: any[]) => any) | undefined;
|
|
210
277
|
"onClick-row"?: ((...args: any[]) => any) | undefined;
|
|
211
|
-
}, "sort" | "items" | "loading" | "fixed" | "headers" | "dense" | "striped" | "pointer" | "scrollable" | "stickyHeader">;
|
|
278
|
+
}, "sort" | "error" | "items" | "loading" | "fixed" | "headers" | "loadingSkeleton" | "loadingLines" | "dense" | "striped" | "pointer" | "scrollable" | "stickyHeader" | "expandable">;
|
|
212
279
|
expose(exposed: {}): void;
|
|
213
280
|
attrs: any;
|
|
214
281
|
slots: Partial<Record<string, (_: {
|
|
282
|
+
header: TableHeader;
|
|
283
|
+
}) => any>> & Partial<Record<string, (_: {
|
|
284
|
+
item: number;
|
|
285
|
+
}) => any>> & Partial<Record<string, (_: {
|
|
215
286
|
item: T;
|
|
216
|
-
}) => any
|
|
287
|
+
}) => any>> & {
|
|
288
|
+
title?(_: {}): any;
|
|
289
|
+
actions?(_: {}): any;
|
|
290
|
+
error?(_: {}): any;
|
|
291
|
+
empty?(_: {}): any;
|
|
292
|
+
"expanded-row"?(_: {
|
|
293
|
+
item: T;
|
|
294
|
+
}): any;
|
|
295
|
+
};
|
|
217
296
|
emit: (event: "update:sort" | "click-row", ...args: any[]) => void;
|
|
218
297
|
}) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
219
298
|
[key: string]: any;
|
|
@@ -221,26 +300,34 @@ declare const _default: <T>(__VLS_props: Partial<{
|
|
|
221
300
|
__ctx?: {
|
|
222
301
|
props: Partial<{
|
|
223
302
|
sort: string[];
|
|
303
|
+
error: boolean;
|
|
224
304
|
items: T[];
|
|
225
305
|
loading: boolean;
|
|
226
306
|
fixed: boolean;
|
|
227
307
|
headers: TableHeader[];
|
|
308
|
+
loadingSkeleton: boolean;
|
|
309
|
+
loadingLines: string | number;
|
|
228
310
|
dense: boolean;
|
|
229
311
|
striped: boolean;
|
|
230
312
|
pointer: boolean;
|
|
231
313
|
scrollable: boolean;
|
|
232
314
|
stickyHeader: boolean;
|
|
315
|
+
expandable: boolean;
|
|
233
316
|
}> & Omit<{
|
|
234
317
|
readonly sort: string[];
|
|
318
|
+
readonly error: boolean;
|
|
235
319
|
readonly items: T[];
|
|
236
320
|
readonly loading: boolean;
|
|
237
321
|
readonly fixed: boolean;
|
|
238
322
|
readonly headers: TableHeader[];
|
|
323
|
+
readonly loadingSkeleton: boolean;
|
|
324
|
+
readonly loadingLines: string | number;
|
|
239
325
|
readonly dense: boolean;
|
|
240
326
|
readonly striped: boolean;
|
|
241
327
|
readonly pointer: boolean;
|
|
242
328
|
readonly scrollable: boolean;
|
|
243
329
|
readonly stickyHeader: boolean;
|
|
330
|
+
readonly expandable: boolean;
|
|
244
331
|
"onUpdate:sort"?: ((...args: any[]) => any) | undefined;
|
|
245
332
|
"onClick-row"?: ((...args: any[]) => any) | undefined;
|
|
246
333
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -257,6 +344,12 @@ declare const _default: <T>(__VLS_props: Partial<{
|
|
|
257
344
|
default: () => never[];
|
|
258
345
|
};
|
|
259
346
|
loading: BooleanConstructor;
|
|
347
|
+
loadingSkeleton: BooleanConstructor;
|
|
348
|
+
loadingLines: {
|
|
349
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
350
|
+
default: number;
|
|
351
|
+
};
|
|
352
|
+
error: BooleanConstructor;
|
|
260
353
|
dense: BooleanConstructor;
|
|
261
354
|
fixed: BooleanConstructor;
|
|
262
355
|
striped: BooleanConstructor;
|
|
@@ -269,15 +362,28 @@ declare const _default: <T>(__VLS_props: Partial<{
|
|
|
269
362
|
type: BooleanConstructor;
|
|
270
363
|
default: boolean;
|
|
271
364
|
};
|
|
365
|
+
expandable: BooleanConstructor;
|
|
272
366
|
}>> & {
|
|
273
367
|
"onUpdate:sort"?: ((...args: any[]) => any) | undefined;
|
|
274
368
|
"onClick-row"?: ((...args: any[]) => any) | undefined;
|
|
275
|
-
}, "sort" | "items" | "loading" | "fixed" | "headers" | "dense" | "striped" | "pointer" | "scrollable" | "stickyHeader">;
|
|
369
|
+
}, "sort" | "error" | "items" | "loading" | "fixed" | "headers" | "loadingSkeleton" | "loadingLines" | "dense" | "striped" | "pointer" | "scrollable" | "stickyHeader" | "expandable">;
|
|
276
370
|
expose(exposed: {}): void;
|
|
277
371
|
attrs: any;
|
|
278
372
|
slots: Partial<Record<string, (_: {
|
|
373
|
+
header: TableHeader;
|
|
374
|
+
}) => any>> & Partial<Record<string, (_: {
|
|
375
|
+
item: number;
|
|
376
|
+
}) => any>> & Partial<Record<string, (_: {
|
|
279
377
|
item: T;
|
|
280
|
-
}) => any
|
|
378
|
+
}) => any>> & {
|
|
379
|
+
title?(_: {}): any;
|
|
380
|
+
actions?(_: {}): any;
|
|
381
|
+
error?(_: {}): any;
|
|
382
|
+
empty?(_: {}): any;
|
|
383
|
+
"expanded-row"?(_: {
|
|
384
|
+
item: T;
|
|
385
|
+
}): any;
|
|
386
|
+
};
|
|
281
387
|
emit: (event: "update:sort" | "click-row", ...args: any[]) => void;
|
|
282
388
|
} | undefined;
|
|
283
389
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useTheme as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
1
|
+
import { defineComponent as J, ref as X, watch as F, resolveComponent as O, openBlock as l, createElementBlock as i, normalizeClass as p, unref as c, renderSlot as d, createElementVNode as f, normalizeStyle as P, createVNode as m, withCtx as u, createBlock as y, createCommentVNode as b, Fragment as k, renderList as v, createTextVNode as C, toDisplayString as N } from "vue";
|
|
2
|
+
import { useTheme as W } from "../../composables/useTheme.js";
|
|
3
|
+
import q from "./TableHead.vue.js";
|
|
4
|
+
import S from "./TableHeader.vue.js";
|
|
5
|
+
import G from "./TableBody.js";
|
|
6
|
+
import z from "./TableRow.vue.js";
|
|
7
|
+
import _ from "./TableCell.vue.js";
|
|
8
|
+
import K from "../spinner/Spinner.vue.js";
|
|
9
|
+
import M from "../skeleton/Skeleton.vue.js";
|
|
10
|
+
import { chevronDownIcon as Q } from "../../common/icons.js";
|
|
11
|
+
const R = { key: 1 }, U = ["colspan"], Y = { key: 2 }, Z = ["colspan"], j = ["onClick"], x = { key: 0 }, ee = { colspan: "999" }, te = {
|
|
10
12
|
headers: {
|
|
11
13
|
type: Array,
|
|
12
14
|
default: () => []
|
|
@@ -20,6 +22,12 @@ const L = { class: "w-full overflow-x-auto" }, P = {
|
|
|
20
22
|
default: () => []
|
|
21
23
|
},
|
|
22
24
|
loading: Boolean,
|
|
25
|
+
loadingSkeleton: Boolean,
|
|
26
|
+
loadingLines: {
|
|
27
|
+
type: [Number, String],
|
|
28
|
+
default: 3
|
|
29
|
+
},
|
|
30
|
+
error: Boolean,
|
|
23
31
|
dense: Boolean,
|
|
24
32
|
fixed: Boolean,
|
|
25
33
|
striped: Boolean,
|
|
@@ -31,116 +39,219 @@ const L = { class: "w-full overflow-x-auto" }, P = {
|
|
|
31
39
|
stickyHeader: {
|
|
32
40
|
type: Boolean,
|
|
33
41
|
default: !0
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
},
|
|
43
|
+
expandable: Boolean
|
|
44
|
+
}, le = { name: "XTable" }, fe = /* @__PURE__ */ J({
|
|
45
|
+
...le,
|
|
37
46
|
props: {
|
|
38
|
-
...
|
|
47
|
+
...te,
|
|
39
48
|
items: {
|
|
40
49
|
type: Array,
|
|
41
50
|
default: () => []
|
|
42
51
|
}
|
|
43
52
|
},
|
|
44
53
|
emits: ["update:sort", "click-row"],
|
|
45
|
-
setup(
|
|
46
|
-
const
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
setup(h, { emit: A }) {
|
|
55
|
+
const $ = h;
|
|
56
|
+
function T(e) {
|
|
57
|
+
try {
|
|
58
|
+
return JSON.parse(JSON.stringify(e));
|
|
59
|
+
} catch {
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const g = X([]);
|
|
64
|
+
F(() => $.items, (e) => {
|
|
65
|
+
$.expandable && (g.value = T(e));
|
|
66
|
+
}, { immediate: !0 });
|
|
67
|
+
const H = A;
|
|
68
|
+
function V(e, n) {
|
|
69
|
+
if (e)
|
|
70
|
+
for (let r = 0; r < n.length; r++) {
|
|
71
|
+
const { 0: t, 1: s } = n[r].split(",");
|
|
72
|
+
if (e === t)
|
|
73
|
+
return parseInt(s) > 0 ? 1 : -1;
|
|
53
74
|
}
|
|
54
75
|
}
|
|
55
|
-
function
|
|
56
|
-
const
|
|
57
|
-
let
|
|
58
|
-
for (let
|
|
59
|
-
const { 0:
|
|
60
|
-
if (
|
|
61
|
-
if (
|
|
62
|
-
|
|
76
|
+
function I(e) {
|
|
77
|
+
const n = $.sort.slice(0);
|
|
78
|
+
let r = !1;
|
|
79
|
+
for (let t = 0; t < n.length; t++) {
|
|
80
|
+
const { 0: s, 1: o } = n[t].split(",");
|
|
81
|
+
if (s === e.value) {
|
|
82
|
+
if (r = !0, o === "-1") {
|
|
83
|
+
n.splice(t, 1, `${e.value},1`);
|
|
63
84
|
break;
|
|
64
|
-
} else if (
|
|
65
|
-
|
|
85
|
+
} else if (o === "1") {
|
|
86
|
+
n.splice(t, 1);
|
|
66
87
|
break;
|
|
67
88
|
}
|
|
68
89
|
}
|
|
69
90
|
}
|
|
70
|
-
|
|
91
|
+
r || n.push(`${e.value},-1`), H("update:sort", n);
|
|
71
92
|
}
|
|
72
|
-
function
|
|
73
|
-
if (!
|
|
93
|
+
function L(e, n) {
|
|
94
|
+
if (!n)
|
|
74
95
|
return "";
|
|
75
|
-
const
|
|
76
|
-
return (
|
|
96
|
+
const r = Array.isArray(n) ? n : n.match(/([^[.\]])+/g);
|
|
97
|
+
return (r == null ? void 0 : r.reduce((s, o) => s && s[o], e)) ?? "";
|
|
77
98
|
}
|
|
78
|
-
const { styles:
|
|
79
|
-
return (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
class:
|
|
83
|
-
i(A),
|
|
84
|
-
i(k).wrapper
|
|
85
|
-
])
|
|
99
|
+
const { styles: D, classes: w, className: E } = W("Table", {}, $);
|
|
100
|
+
return (e, n) => {
|
|
101
|
+
const r = O("x-icon");
|
|
102
|
+
return l(), i("div", {
|
|
103
|
+
class: p([c(E), c(w).wrapper])
|
|
86
104
|
}, [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
"text-align": e.align,
|
|
93
|
-
sort: _(e.value, t.sort),
|
|
94
|
-
sortable: e.sortable,
|
|
95
|
-
width: e.width,
|
|
96
|
-
onClick: (o) => e.sortable ? w(e) : null
|
|
97
|
-
}, {
|
|
98
|
-
default: u(() => [
|
|
99
|
-
v(b(e.text), 1)
|
|
100
|
-
]),
|
|
101
|
-
_: 2
|
|
102
|
-
}, 1032, ["sticky-header", "text-align", "sort", "sortable", "width", "onClick"]))), 128))
|
|
103
|
-
]),
|
|
104
|
-
_: 1
|
|
105
|
-
}),
|
|
106
|
-
f(i(h), null, {
|
|
107
|
-
default: u(() => [
|
|
108
|
-
(s(!0), a(d, null, c(p.items, (e, l) => (s(), m(D, {
|
|
109
|
-
key: l,
|
|
110
|
-
pointer: t.pointer,
|
|
111
|
-
striped: t.striped,
|
|
112
|
-
onClick: (o) => t.$emit("click-row", e)
|
|
113
|
-
}, {
|
|
114
|
-
default: u(() => [
|
|
115
|
-
(s(!0), a(d, null, c(t.headers, (o, n) => (s(), m(F, {
|
|
116
|
-
key: n,
|
|
117
|
-
"text-align": o.align,
|
|
118
|
-
dense: t.dense,
|
|
119
|
-
fixed: t.fixed
|
|
120
|
-
}, {
|
|
121
|
-
default: u(() => [
|
|
122
|
-
S(t.$slots, `item-${o.value}`, { item: e }, () => [
|
|
123
|
-
v(b(C(e, o.value)), 1)
|
|
124
|
-
])
|
|
125
|
-
]),
|
|
126
|
-
_: 2
|
|
127
|
-
}, 1032, ["text-align", "dense", "fixed"]))), 128))
|
|
128
|
-
]),
|
|
129
|
-
_: 2
|
|
130
|
-
}, 1032, ["pointer", "striped", "onClick"]))), 128))
|
|
131
|
-
]),
|
|
132
|
-
_: 3
|
|
133
|
-
}),
|
|
134
|
-
t.loading ? (s(), a("div", {
|
|
135
|
-
key: 0,
|
|
136
|
-
class: g(i(k).loadingWrapper)
|
|
105
|
+
d(e.$slots, "title"),
|
|
106
|
+
d(e.$slots, "actions"),
|
|
107
|
+
f("table", {
|
|
108
|
+
style: P(c(D)),
|
|
109
|
+
class: p(c(w).table)
|
|
137
110
|
}, [
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
111
|
+
m(q, null, {
|
|
112
|
+
default: u(() => [
|
|
113
|
+
e.expandable ? (l(), y(S, {
|
|
114
|
+
key: 0,
|
|
115
|
+
width: "48",
|
|
116
|
+
class: "!p-0",
|
|
117
|
+
"sticky-header": e.stickyHeader
|
|
118
|
+
}, null, 8, ["sticky-header"])) : b("", !0),
|
|
119
|
+
(l(!0), i(k, null, v(e.headers, (t, s) => (l(), y(S, {
|
|
120
|
+
key: s,
|
|
121
|
+
"sticky-header": e.stickyHeader,
|
|
122
|
+
"text-align": t.align,
|
|
123
|
+
sort: V(t.value, e.sort),
|
|
124
|
+
sortable: t.sortable,
|
|
125
|
+
width: t.width,
|
|
126
|
+
onClick: (o) => t.sortable ? I(t) : null
|
|
127
|
+
}, {
|
|
128
|
+
default: u(() => [
|
|
129
|
+
d(e.$slots, `header-${t.value}`, { header: t }, () => [
|
|
130
|
+
C(N(t.text), 1)
|
|
131
|
+
])
|
|
132
|
+
]),
|
|
133
|
+
_: 2
|
|
134
|
+
}, 1032, ["sticky-header", "text-align", "sort", "sortable", "width", "onClick"]))), 128))
|
|
135
|
+
]),
|
|
136
|
+
_: 3
|
|
137
|
+
}),
|
|
138
|
+
m(c(G), null, {
|
|
139
|
+
default: u(() => [
|
|
140
|
+
e.loading ? (l(!0), i(k, { key: 0 }, v(Number(e.loadingLines), (t, s) => (l(), y(z, {
|
|
141
|
+
key: s,
|
|
142
|
+
striped: e.striped
|
|
143
|
+
}, {
|
|
144
|
+
default: u(() => [
|
|
145
|
+
(l(!0), i(k, null, v(e.headers, (o, a) => (l(), y(_, {
|
|
146
|
+
key: a,
|
|
147
|
+
"text-align": o.align,
|
|
148
|
+
width: o.width,
|
|
149
|
+
dense: e.dense,
|
|
150
|
+
fixed: e.fixed
|
|
151
|
+
}, {
|
|
152
|
+
default: u(() => [
|
|
153
|
+
d(e.$slots, `loading-${o.value}`, { item: t }, () => [
|
|
154
|
+
m(M, {
|
|
155
|
+
class: p(["max-w-[60%]", {
|
|
156
|
+
"mx-auto": o.align === "center",
|
|
157
|
+
"ml-auto": o.align === "right"
|
|
158
|
+
}]),
|
|
159
|
+
shape: o.skeletonShape || "line"
|
|
160
|
+
}, null, 8, ["shape", "class"])
|
|
161
|
+
])
|
|
162
|
+
]),
|
|
163
|
+
_: 2
|
|
164
|
+
}, 1032, ["text-align", "width", "dense", "fixed"]))), 128))
|
|
165
|
+
]),
|
|
166
|
+
_: 2
|
|
167
|
+
}, 1032, ["striped"]))), 128)) : e.error ? (l(), i("tr", R, [
|
|
168
|
+
f("td", {
|
|
169
|
+
colspan: e.headers.length
|
|
170
|
+
}, [
|
|
171
|
+
d(e.$slots, "error")
|
|
172
|
+
], 8, U)
|
|
173
|
+
])) : !h.items || h.items.length === 0 ? (l(), i("tr", Y, [
|
|
174
|
+
f("td", {
|
|
175
|
+
colspan: e.headers.length
|
|
176
|
+
}, [
|
|
177
|
+
d(e.$slots, "empty")
|
|
178
|
+
], 8, Z)
|
|
179
|
+
])) : (l(!0), i(k, { key: 3 }, v(h.items, (t, s) => {
|
|
180
|
+
var o;
|
|
181
|
+
return l(), i(k, { key: s }, [
|
|
182
|
+
m(z, {
|
|
183
|
+
pointer: e.pointer,
|
|
184
|
+
striped: e.striped,
|
|
185
|
+
onClick: (a) => e.$emit("click-row", t)
|
|
186
|
+
}, {
|
|
187
|
+
default: u(() => [
|
|
188
|
+
e.expandable ? (l(), y(_, {
|
|
189
|
+
key: 0,
|
|
190
|
+
width: "48",
|
|
191
|
+
class: "!p-1"
|
|
192
|
+
}, {
|
|
193
|
+
default: u(() => {
|
|
194
|
+
var a;
|
|
195
|
+
return [
|
|
196
|
+
f("button", {
|
|
197
|
+
class: "p-4",
|
|
198
|
+
onClick: (B) => g.value[s].__expanded = !g.value[s].__expanded
|
|
199
|
+
}, [
|
|
200
|
+
m(r, {
|
|
201
|
+
icon: c(Q),
|
|
202
|
+
size: e.dense ? "xs" : "md",
|
|
203
|
+
class: p(["transition-transform", {
|
|
204
|
+
"rotate-180": (a = g.value[s]) == null ? void 0 : a.__expanded
|
|
205
|
+
}])
|
|
206
|
+
}, null, 8, ["icon", "size", "class"])
|
|
207
|
+
], 8, j)
|
|
208
|
+
];
|
|
209
|
+
}),
|
|
210
|
+
_: 2
|
|
211
|
+
}, 1024)) : b("", !0),
|
|
212
|
+
(l(!0), i(k, null, v(e.headers, (a, B) => (l(), y(_, {
|
|
213
|
+
key: B,
|
|
214
|
+
"text-align": a.align,
|
|
215
|
+
truncate: a.truncate,
|
|
216
|
+
width: a.width,
|
|
217
|
+
dense: e.dense,
|
|
218
|
+
fixed: e.fixed
|
|
219
|
+
}, {
|
|
220
|
+
default: u(() => [
|
|
221
|
+
d(e.$slots, `item-${a.value}`, { item: t }, () => [
|
|
222
|
+
C(N(L(t, a.value)), 1)
|
|
223
|
+
])
|
|
224
|
+
]),
|
|
225
|
+
_: 2
|
|
226
|
+
}, 1032, ["text-align", "truncate", "width", "dense", "fixed"]))), 128))
|
|
227
|
+
]),
|
|
228
|
+
_: 2
|
|
229
|
+
}, 1032, ["pointer", "striped", "onClick"]),
|
|
230
|
+
e.expandable ? (l(), i("tr", x, [
|
|
231
|
+
f("td", ee, [
|
|
232
|
+
f("div", {
|
|
233
|
+
class: p(["overflow-hidden", [(o = g.value[s]) != null && o.__expanded ? "" : "max-h-0"]])
|
|
234
|
+
}, [
|
|
235
|
+
d(e.$slots, "expanded-row", { item: t })
|
|
236
|
+
], 2)
|
|
237
|
+
])
|
|
238
|
+
])) : b("", !0)
|
|
239
|
+
], 64);
|
|
240
|
+
}), 128))
|
|
241
|
+
]),
|
|
242
|
+
_: 3
|
|
243
|
+
}),
|
|
244
|
+
e.loading ? (l(), i("div", {
|
|
245
|
+
key: 0,
|
|
246
|
+
class: p(c(w).loadingWrapper)
|
|
247
|
+
}, [
|
|
248
|
+
m(K, { size: "lg" })
|
|
249
|
+
], 2)) : b("", !0)
|
|
250
|
+
], 6)
|
|
251
|
+
], 2);
|
|
252
|
+
};
|
|
142
253
|
}
|
|
143
254
|
});
|
|
144
255
|
export {
|
|
145
|
-
|
|
256
|
+
fe as default
|
|
146
257
|
};
|