@rockshin/tao-ui 0.0.20 → 0.0.22
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 +8 -1
- package/component-manifest.json +77 -48
- package/dist/components/button/button.css +11 -11
- package/dist/components/button/button.d.ts +3 -2
- package/dist/components/button/button.js +55 -47
- package/dist/components/checkbox/checkbox.d.ts +3 -2
- package/dist/components/checkbox/checkbox.js +91 -81
- package/dist/components/date-picker/calendar/calendar-grid.d.ts +7 -1
- package/dist/components/date-picker/calendar/calendar-grid.js +158 -160
- package/dist/components/date-picker/calendar/time-panel.js +64 -70
- package/dist/components/date-picker/date-picker.css +11 -5
- package/dist/components/date-picker/date-picker.d.ts +13 -5
- package/dist/components/date-picker/date-picker.js +389 -718
- package/dist/components/date-picker/range-picker.d.ts +12 -5
- package/dist/components/date-picker/range-picker.js +68 -12
- package/dist/components/date-picker/types.d.ts +5 -0
- package/dist/components/drawer/drawer.css +3 -1
- package/dist/components/drawer/drawer.js +119 -133
- package/dist/components/form-field/form-field.d.ts +1 -1
- package/dist/components/form-field/form-field.js +106 -63
- package/dist/components/input/input.css +30 -9
- package/dist/components/input/input.d.ts +2 -1
- package/dist/components/input/input.js +76 -70
- package/dist/components/input-number/input-number.d.ts +5 -3
- package/dist/components/input-number/input-number.js +63 -47
- package/dist/components/modal/modal.css +2 -1
- package/dist/components/modal/modal.js +116 -130
- package/dist/components/radio/radio.d.ts +3 -2
- package/dist/components/radio/radio.js +43 -39
- package/dist/components/select/mobile-select.d.ts +1 -1
- package/dist/components/select/mobile-select.js +1 -1
- package/dist/components/select/select-icons.d.ts +7 -0
- package/dist/components/select/select-icons.js +141 -0
- package/dist/components/select/select-model.d.ts +4 -0
- package/dist/components/select/select-model.js +22 -0
- package/dist/components/select/select-searchable-list.d.ts +22 -0
- package/dist/components/select/select-searchable-list.js +101 -0
- package/dist/components/select/select-tags.d.ts +15 -0
- package/dist/components/select/select-tags.js +152 -0
- package/dist/components/select/select-types.d.ts +82 -0
- package/dist/components/select/select-types.js +0 -0
- package/dist/components/select/select.css +2 -1
- package/dist/components/select/select.d.ts +2 -118
- package/dist/components/select/select.js +91 -404
- package/dist/components/select/use-is-mobile.js +2 -5
- package/dist/components/sonner/sonner.js +9 -3
- package/dist/components/spinner/spinner.css +1 -1
- package/dist/components/splitter/splitter.js +181 -133
- package/dist/components/switch/switch.css +17 -8
- package/dist/components/switch/switch.d.ts +3 -2
- package/dist/components/switch/switch.js +90 -79
- package/dist/components/table/table-filter.d.ts +6 -0
- package/dist/components/table/table-filter.js +123 -0
- package/dist/components/table/table-icons.d.ts +9 -0
- package/dist/components/table/table-icons.js +157 -0
- package/dist/components/table/table-model.d.ts +11 -0
- package/dist/components/table/table-model.js +33 -0
- package/dist/components/table/table-types.d.ts +87 -0
- package/dist/components/table/table-types.js +0 -0
- package/dist/components/table/table.css +14 -15
- package/dist/components/table/table.d.ts +3 -101
- package/dist/components/table/table.js +29 -329
- package/dist/components/tabs/tabs.css +5 -2
- package/dist/components/tabs/tabs.js +71 -62
- package/dist/components/textarea/textarea.d.ts +5 -3
- package/dist/components/textarea/textarea.js +102 -85
- package/dist/docs/component-docs.d.ts +1 -0
- package/dist/docs/components/breadcrumb.doc.js +3 -1
- package/dist/docs/components/checkbox.doc.js +2 -5
- package/dist/docs/components/context-menu.doc.js +7 -2
- package/dist/docs/components/drawer.doc.js +4 -2
- package/dist/docs/components/dropdown.doc.js +7 -3
- package/dist/docs/components/form-field.doc.js +0 -1
- package/dist/docs/components/form-layout.doc.d.ts +1 -0
- package/dist/docs/components/form-layout.doc.js +3 -0
- package/dist/docs/components/form-section.doc.js +1 -1
- package/dist/docs/components/input-number.doc.js +2 -3
- package/dist/docs/components/input.doc.js +1 -2
- package/dist/docs/components/modal.doc.js +1 -1
- package/dist/docs/components/pagination.doc.js +1 -3
- package/dist/docs/components/radio.doc.js +1 -4
- package/dist/docs/components/range-picker.doc.js +2 -2
- package/dist/docs/components/select.doc.js +19 -6
- package/dist/docs/components/spinner.doc.js +4 -1
- package/dist/docs/components/splitter.doc.js +1 -1
- package/dist/docs/components/stack.doc.d.ts +1 -0
- package/dist/docs/components/stack.doc.js +3 -0
- package/dist/docs/components/switch.doc.js +1 -2
- package/dist/docs/components/table.doc.js +9 -4
- package/dist/docs/components/tabs.doc.js +2 -1
- package/dist/docs/components/tag.doc.js +1 -0
- package/dist/docs/components/tao-provider.doc.js +1 -2
- package/dist/index.d.ts +7 -9
- package/dist/index.js +4 -5
- package/dist/layouts/form-layout/form-layout.d.ts +8 -2
- package/dist/layouts/form-layout/form-layout.js +33 -9
- package/dist/layouts/stack/stack.d.ts +8 -2
- package/dist/layouts/stack/stack.js +36 -12
- package/dist/provider/tao-provider.d.ts +3 -9
- package/dist/provider/tao-provider.js +99 -33
- package/dist/theme/theme.css +24 -14
- package/dist/theme/tokens.d.ts +2 -2
- package/dist/theme/tokens.js +4 -1
- package/dist/utils/portal.d.ts +4 -0
- package/dist/utils/portal.js +4 -0
- package/dist/utils/refs.d.ts +2 -0
- package/dist/utils/refs.js +7 -0
- package/llms.txt +26 -24
- package/package.json +16 -4
|
@@ -157,11 +157,6 @@
|
|
|
157
157
|
color: var(--tao-primary);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
[data-tao-table-filter-dropdown] {
|
|
161
|
-
display: inline-flex;
|
|
162
|
-
position: relative;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
160
|
[data-tao-table-filter-trigger] {
|
|
166
161
|
cursor: pointer;
|
|
167
162
|
border-radius: var(--tao-radius-xs);
|
|
@@ -184,19 +179,17 @@
|
|
|
184
179
|
}
|
|
185
180
|
|
|
186
181
|
[data-tao-table-filter-panel] {
|
|
187
|
-
z-index:
|
|
182
|
+
z-index: var(--tao-z-index-popup);
|
|
188
183
|
min-width: 140px;
|
|
189
184
|
padding: var(--tao-padding-xxs);
|
|
190
185
|
background: var(--tao-color-bg-container);
|
|
191
186
|
border-radius: var(--tao-radius-md);
|
|
192
187
|
box-shadow: var(--tao-box-shadow-secondary);
|
|
193
188
|
border: var(--tao-line-width) solid var(--tao-color-border-secondary);
|
|
189
|
+
outline: none;
|
|
194
190
|
flex-direction: column;
|
|
195
191
|
gap: 1px;
|
|
196
192
|
display: flex;
|
|
197
|
-
position: absolute;
|
|
198
|
-
top: calc(100% + 4px);
|
|
199
|
-
right: 0;
|
|
200
193
|
}
|
|
201
194
|
|
|
202
195
|
[data-tao-table-filter-option] {
|
|
@@ -217,8 +210,9 @@
|
|
|
217
210
|
display: flex;
|
|
218
211
|
}
|
|
219
212
|
|
|
220
|
-
[data-tao-table-filter-option]:hover {
|
|
213
|
+
[data-tao-table-filter-option]:hover, [data-tao-table-filter-option][data-highlighted] {
|
|
221
214
|
background: var(--tao-color-fill-tertiary);
|
|
215
|
+
outline: none;
|
|
222
216
|
}
|
|
223
217
|
|
|
224
218
|
[data-tao-table-filter-check] {
|
|
@@ -246,15 +240,16 @@
|
|
|
246
240
|
color: var(--tao-primary);
|
|
247
241
|
font-size: var(--tao-font-size-xs);
|
|
248
242
|
cursor: pointer;
|
|
249
|
-
text-align:
|
|
243
|
+
text-align: start;
|
|
250
244
|
border: none;
|
|
251
245
|
border-top: var(--tao-line-width) solid var(--tao-color-border-secondary);
|
|
252
246
|
background: none;
|
|
253
247
|
font-family: inherit;
|
|
254
248
|
}
|
|
255
249
|
|
|
256
|
-
[data-tao-table-filter-reset]:hover {
|
|
250
|
+
[data-tao-table-filter-reset]:hover, [data-tao-table-filter-reset][data-highlighted] {
|
|
257
251
|
color: var(--tao-primary-hover);
|
|
252
|
+
outline: none;
|
|
258
253
|
}
|
|
259
254
|
|
|
260
255
|
[data-tao-table-row]:hover [data-tao-table-cell] {
|
|
@@ -291,7 +286,9 @@
|
|
|
291
286
|
|
|
292
287
|
[data-tao-table-wrapper][data-tao-scroll-state="middle"] [data-tao-fixed="left"]:after, [data-tao-table-wrapper][data-tao-scroll-state="right"] [data-tao-fixed="left"]:after {
|
|
293
288
|
content: "";
|
|
294
|
-
background: linear-gradient(to right,
|
|
289
|
+
background: linear-gradient(to right,
|
|
290
|
+
var(--tao-color-shadow-hint),
|
|
291
|
+
transparent);
|
|
295
292
|
pointer-events: none;
|
|
296
293
|
width: 6px;
|
|
297
294
|
position: absolute;
|
|
@@ -302,7 +299,9 @@
|
|
|
302
299
|
|
|
303
300
|
[data-tao-table-wrapper][data-tao-scroll-state="middle"] [data-tao-fixed="right"]:before, [data-tao-table-wrapper][data-tao-scroll-state="left"] [data-tao-fixed="right"]:before {
|
|
304
301
|
content: "";
|
|
305
|
-
background: linear-gradient(to left,
|
|
302
|
+
background: linear-gradient(to left,
|
|
303
|
+
var(--tao-color-shadow-hint),
|
|
304
|
+
transparent);
|
|
306
305
|
pointer-events: none;
|
|
307
306
|
width: 6px;
|
|
308
307
|
position: absolute;
|
|
@@ -338,8 +337,8 @@
|
|
|
338
337
|
}
|
|
339
338
|
|
|
340
339
|
[data-tao-table-spinner] {
|
|
340
|
+
animation: tao-spin calc(var(--tao-motion-unit) * 8) linear infinite;
|
|
341
341
|
color: var(--tao-primary);
|
|
342
|
-
animation: .8s linear infinite tao-spin;
|
|
343
342
|
}
|
|
344
343
|
|
|
345
344
|
[data-tao-table-wrapper][data-tao-bordered] [data-tao-table] {
|
|
@@ -1,102 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { type TaoSize, type TaoVariant } from '../../provider/tao-provider';
|
|
3
|
-
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
|
|
1
|
+
import type { TableProps, TableRecord } from './table-types';
|
|
4
2
|
import './table.css';
|
|
5
|
-
export type
|
|
6
|
-
export
|
|
7
|
-
export type SortOrder = 'ascend' | 'descend' | null;
|
|
8
|
-
export interface TableFilterItem {
|
|
9
|
-
text: ReactNode;
|
|
10
|
-
value: string;
|
|
11
|
-
}
|
|
12
|
-
export interface TableColumn<T = any> {
|
|
13
|
-
key?: string;
|
|
14
|
-
dataIndex?: string;
|
|
15
|
-
title?: ReactNode;
|
|
16
|
-
render?: (value: any, record: T, index: number) => ReactNode;
|
|
17
|
-
width?: number | string;
|
|
18
|
-
align?: 'left' | 'center' | 'right';
|
|
19
|
-
fixed?: 'left' | 'right';
|
|
20
|
-
ellipsis?: boolean;
|
|
21
|
-
onCell?: (record: T, index: number) => TdHTMLAttributes<HTMLTableCellElement>;
|
|
22
|
-
onHeaderCell?: (column: TableColumn<T>) => ThHTMLAttributes<HTMLTableCellElement>;
|
|
23
|
-
sorter?: ((a: T, b: T) => number) | boolean;
|
|
24
|
-
sortOrder?: SortOrder;
|
|
25
|
-
defaultSortOrder?: SortOrder;
|
|
26
|
-
filters?: TableFilterItem[];
|
|
27
|
-
onFilter?: (value: string, record: T) => boolean;
|
|
28
|
-
filteredValue?: string[];
|
|
29
|
-
}
|
|
30
|
-
export interface TableRowSelection<T = any> {
|
|
31
|
-
type?: 'checkbox' | 'radio';
|
|
32
|
-
selectedRowKeys?: React.Key[];
|
|
33
|
-
onChange?: (selectedKeys: React.Key[], selectedRows: T[]) => void;
|
|
34
|
-
getCheckboxProps?: (record: T) => {
|
|
35
|
-
disabled?: boolean;
|
|
36
|
-
};
|
|
37
|
-
fixed?: boolean;
|
|
38
|
-
columnWidth?: number | string;
|
|
39
|
-
}
|
|
40
|
-
export interface TablePagination {
|
|
41
|
-
current?: number;
|
|
42
|
-
pageSize?: number;
|
|
43
|
-
total?: number;
|
|
44
|
-
defaultCurrent?: number;
|
|
45
|
-
defaultPageSize?: number;
|
|
46
|
-
showSizeChanger?: boolean;
|
|
47
|
-
pageSizeOptions?: number[];
|
|
48
|
-
showTotal?: (total: number, range: [number, number]) => ReactNode;
|
|
49
|
-
}
|
|
50
|
-
export interface SorterResult<T = any> {
|
|
51
|
-
column?: TableColumn<T>;
|
|
52
|
-
order: SortOrder;
|
|
53
|
-
field?: string;
|
|
54
|
-
}
|
|
55
|
-
export type TableSemanticInfo<T = any> = {
|
|
56
|
-
props: TableProps<T>;
|
|
57
|
-
};
|
|
58
|
-
export type TableSemanticClassNames<T = any> = SemanticClassNames<TableSemanticPart> | ((info: TableSemanticInfo<T>) => SemanticClassNames<TableSemanticPart>);
|
|
59
|
-
export type TableSemanticStyles<T = any> = SemanticStyles<TableSemanticPart> | ((info: TableSemanticInfo<T>) => SemanticStyles<TableSemanticPart>);
|
|
60
|
-
export interface TableProps<T = any> {
|
|
61
|
-
columns: TableColumn<T>[];
|
|
62
|
-
dataSource: T[];
|
|
63
|
-
rowKey: string | ((record: T) => React.Key);
|
|
64
|
-
loading?: boolean;
|
|
65
|
-
pagination?: TablePagination | false;
|
|
66
|
-
onChange?: (pagination: {
|
|
67
|
-
current: number;
|
|
68
|
-
pageSize: number;
|
|
69
|
-
}, filters: Record<string, string[] | null>, sorter: SorterResult<T>) => void;
|
|
70
|
-
scroll?: {
|
|
71
|
-
x?: number | string;
|
|
72
|
-
};
|
|
73
|
-
rowSelection?: TableRowSelection<T>;
|
|
74
|
-
rowClassName?: string | ((record: T, index: number) => string);
|
|
75
|
-
rowStyle?: CSSProperties | ((record: T, index: number) => CSSProperties);
|
|
76
|
-
onRow?: (record: T, index: number) => HTMLAttributes<HTMLTableRowElement>;
|
|
77
|
-
onHeaderRow?: (columns: TableColumn<T>[], index: number) => HTMLAttributes<HTMLTableRowElement>;
|
|
78
|
-
size?: TaoSize;
|
|
79
|
-
/**
|
|
80
|
-
* 表面风格。
|
|
81
|
-
* - `borderless`(极简):无表头底色、单元格透明、仅行底分隔线。
|
|
82
|
-
* - `filled`:表头灰底。
|
|
83
|
-
* - `outlined`:filled + 整体外框 + 列分隔线。
|
|
84
|
-
* - `modern`:轻外框、圆角、克制表头,更接近 shadcn 的表格视觉。
|
|
85
|
-
*
|
|
86
|
-
* 不传时继承 TaoProvider 的 variant;当继承到框架默认 `outlined` 时,
|
|
87
|
-
* Table 回落为 `modern`,让裸用 `<Table>` 默认呈现现代轻外框风格。
|
|
88
|
-
*/
|
|
89
|
-
variant?: TableVariant;
|
|
90
|
-
/**
|
|
91
|
-
* 表头灰底开关,默认 `true`。设为 `false` 关掉表头底色(极简表头),
|
|
92
|
-
* 不影响外框 / 列分隔线等其它 variant 表现。
|
|
93
|
-
*/
|
|
94
|
-
headerBackground?: boolean;
|
|
95
|
-
emptyText?: ReactNode;
|
|
96
|
-
bordered?: boolean;
|
|
97
|
-
className?: string;
|
|
98
|
-
style?: CSSProperties;
|
|
99
|
-
classNames?: TableSemanticClassNames<T>;
|
|
100
|
-
styles?: TableSemanticStyles<T>;
|
|
101
|
-
}
|
|
102
|
-
export declare function Table<T = any>({ columns, dataSource, rowKey, loading, pagination: paginationProp, onChange, scroll, rowSelection, size, variant, headerBackground, emptyText, bordered, className, style, classNames, styles, rowClassName, rowStyle, onRow, onHeaderRow, }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export type { SorterResult, SortOrder, TableColumn, TableFilterItem, TablePagination, TableProps, TableRowSelection, TableSemanticClassNames, TableSemanticInfo, TableSemanticPart, TableSemanticStyles, TableVariant, } from './table-types';
|
|
4
|
+
export declare function Table<T extends TableRecord = Record<string, unknown>>({ columns, dataSource, rowKey, loading, pagination: paginationProp, onChange, scroll, rowSelection, size, variant, headerBackground, emptyText, bordered, className, style, classNames, styles, rowClassName, rowStyle, onRow, onHeaderRow, }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,312 +4,10 @@ import { c as compiler_runtime_c } from "react/compiler-runtime";
|
|
|
4
4
|
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
5
5
|
import { cx } from "../../utils/semantic.js";
|
|
6
6
|
import { Pagination } from "../pagination/pagination.js";
|
|
7
|
+
import { TableFilterDropdown } from "./table-filter.js";
|
|
8
|
+
import { SortIcon, TableLoadingSpinner } from "./table-icons.js";
|
|
9
|
+
import { getCellValue, getColKey, getRowKey, nextSortOrder, resolveRowClassName, resolveRowStyle, resolveSemanticClassNames, resolveSemanticStyles } from "./table-model.js";
|
|
7
10
|
import "./table.css";
|
|
8
|
-
function getRowKey(record, rowKey) {
|
|
9
|
-
if ('function' == typeof rowKey) return rowKey(record);
|
|
10
|
-
return record[rowKey];
|
|
11
|
-
}
|
|
12
|
-
function getColKey(col, index) {
|
|
13
|
-
return col.key ?? col.dataIndex ?? String(index);
|
|
14
|
-
}
|
|
15
|
-
function getCellValue(record, dataIndex) {
|
|
16
|
-
if (!dataIndex) return;
|
|
17
|
-
return record[dataIndex];
|
|
18
|
-
}
|
|
19
|
-
function resolveSemanticClassNames(classNames, props) {
|
|
20
|
-
return 'function' == typeof classNames ? classNames({
|
|
21
|
-
props
|
|
22
|
-
}) : classNames ?? {};
|
|
23
|
-
}
|
|
24
|
-
function resolveSemanticStyles(styles, props) {
|
|
25
|
-
return 'function' == typeof styles ? styles({
|
|
26
|
-
props
|
|
27
|
-
}) : styles ?? {};
|
|
28
|
-
}
|
|
29
|
-
function resolveRowClassName(rowClassName, record, index) {
|
|
30
|
-
return 'function' == typeof rowClassName ? rowClassName(record, index) : rowClassName;
|
|
31
|
-
}
|
|
32
|
-
function resolveRowStyle(rowStyle, record, index) {
|
|
33
|
-
return 'function' == typeof rowStyle ? rowStyle(record, index) : rowStyle;
|
|
34
|
-
}
|
|
35
|
-
function SortIcon(t0) {
|
|
36
|
-
const $ = compiler_runtime_c(10);
|
|
37
|
-
const { order } = t0;
|
|
38
|
-
const t1 = order ?? void 0;
|
|
39
|
-
const t2 = "ascend" === order ? 1 : 0.3;
|
|
40
|
-
let t3;
|
|
41
|
-
if ($[0] !== t2) {
|
|
42
|
-
t3 = /*#__PURE__*/ jsx("path", {
|
|
43
|
-
d: "M7 2.5L10 6H4L7 2.5Z",
|
|
44
|
-
fill: "currentColor",
|
|
45
|
-
opacity: t2
|
|
46
|
-
});
|
|
47
|
-
$[0] = t2;
|
|
48
|
-
$[1] = t3;
|
|
49
|
-
} else t3 = $[1];
|
|
50
|
-
const t4 = "descend" === order ? 1 : 0.3;
|
|
51
|
-
let t5;
|
|
52
|
-
if ($[2] !== t4) {
|
|
53
|
-
t5 = /*#__PURE__*/ jsx("path", {
|
|
54
|
-
d: "M7 11.5L4 8H10L7 11.5Z",
|
|
55
|
-
fill: "currentColor",
|
|
56
|
-
opacity: t4
|
|
57
|
-
});
|
|
58
|
-
$[2] = t4;
|
|
59
|
-
$[3] = t5;
|
|
60
|
-
} else t5 = $[3];
|
|
61
|
-
let t6;
|
|
62
|
-
if ($[4] !== t3 || $[5] !== t5) {
|
|
63
|
-
t6 = /*#__PURE__*/ jsxs("svg", {
|
|
64
|
-
width: "14",
|
|
65
|
-
height: "14",
|
|
66
|
-
viewBox: "0 0 14 14",
|
|
67
|
-
fill: "none",
|
|
68
|
-
"aria-hidden": "true",
|
|
69
|
-
focusable: "false",
|
|
70
|
-
children: [
|
|
71
|
-
t3,
|
|
72
|
-
t5
|
|
73
|
-
]
|
|
74
|
-
});
|
|
75
|
-
$[4] = t3;
|
|
76
|
-
$[5] = t5;
|
|
77
|
-
$[6] = t6;
|
|
78
|
-
} else t6 = $[6];
|
|
79
|
-
let t7;
|
|
80
|
-
if ($[7] !== t1 || $[8] !== t6) {
|
|
81
|
-
t7 = /*#__PURE__*/ jsx("span", {
|
|
82
|
-
"data-tao-table-sort-icon": "",
|
|
83
|
-
"data-tao-sort-order": t1,
|
|
84
|
-
children: t6
|
|
85
|
-
});
|
|
86
|
-
$[7] = t1;
|
|
87
|
-
$[8] = t6;
|
|
88
|
-
$[9] = t7;
|
|
89
|
-
} else t7 = $[9];
|
|
90
|
-
return t7;
|
|
91
|
-
}
|
|
92
|
-
function FilterIcon(t0) {
|
|
93
|
-
const $ = compiler_runtime_c(5);
|
|
94
|
-
const { active } = t0;
|
|
95
|
-
const t1 = active || void 0;
|
|
96
|
-
const t2 = active ? "currentColor" : "none";
|
|
97
|
-
let t3;
|
|
98
|
-
if ($[0] !== t2) {
|
|
99
|
-
t3 = /*#__PURE__*/ jsx("svg", {
|
|
100
|
-
width: "14",
|
|
101
|
-
height: "14",
|
|
102
|
-
viewBox: "0 0 14 14",
|
|
103
|
-
fill: "none",
|
|
104
|
-
"aria-hidden": "true",
|
|
105
|
-
focusable: "false",
|
|
106
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
107
|
-
d: "M2 3h10L8.5 7.5V11L5.5 12V7.5L2 3Z",
|
|
108
|
-
stroke: "currentColor",
|
|
109
|
-
fill: t2,
|
|
110
|
-
strokeWidth: "1.2",
|
|
111
|
-
strokeLinejoin: "round"
|
|
112
|
-
})
|
|
113
|
-
});
|
|
114
|
-
$[0] = t2;
|
|
115
|
-
$[1] = t3;
|
|
116
|
-
} else t3 = $[1];
|
|
117
|
-
let t4;
|
|
118
|
-
if ($[2] !== t1 || $[3] !== t3) {
|
|
119
|
-
t4 = /*#__PURE__*/ jsx("span", {
|
|
120
|
-
"data-tao-table-filter-icon": "",
|
|
121
|
-
"data-tao-active": t1,
|
|
122
|
-
children: t3
|
|
123
|
-
});
|
|
124
|
-
$[2] = t1;
|
|
125
|
-
$[3] = t3;
|
|
126
|
-
$[4] = t4;
|
|
127
|
-
} else t4 = $[4];
|
|
128
|
-
return t4;
|
|
129
|
-
}
|
|
130
|
-
function LoadingSpinner() {
|
|
131
|
-
const $ = compiler_runtime_c(1);
|
|
132
|
-
let t0;
|
|
133
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
134
|
-
t0 = /*#__PURE__*/ jsx("div", {
|
|
135
|
-
"data-tao-table-loading": "",
|
|
136
|
-
children: /*#__PURE__*/ jsxs("svg", {
|
|
137
|
-
"data-tao-table-spinner": "",
|
|
138
|
-
width: "24",
|
|
139
|
-
height: "24",
|
|
140
|
-
viewBox: "0 0 24 24",
|
|
141
|
-
fill: "none",
|
|
142
|
-
"aria-hidden": "true",
|
|
143
|
-
focusable: "false",
|
|
144
|
-
children: [
|
|
145
|
-
/*#__PURE__*/ jsx("circle", {
|
|
146
|
-
cx: "12",
|
|
147
|
-
cy: "12",
|
|
148
|
-
r: "10",
|
|
149
|
-
stroke: "currentColor",
|
|
150
|
-
strokeWidth: "2.5",
|
|
151
|
-
opacity: "0.2"
|
|
152
|
-
}),
|
|
153
|
-
/*#__PURE__*/ jsx("path", {
|
|
154
|
-
d: "M12 2a10 10 0 019.8 8",
|
|
155
|
-
stroke: "currentColor",
|
|
156
|
-
strokeWidth: "2.5",
|
|
157
|
-
strokeLinecap: "round"
|
|
158
|
-
})
|
|
159
|
-
]
|
|
160
|
-
})
|
|
161
|
-
});
|
|
162
|
-
$[0] = t0;
|
|
163
|
-
} else t0 = $[0];
|
|
164
|
-
return t0;
|
|
165
|
-
}
|
|
166
|
-
function CheckIcon() {
|
|
167
|
-
const $ = compiler_runtime_c(1);
|
|
168
|
-
let t0;
|
|
169
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
170
|
-
t0 = /*#__PURE__*/ jsx("svg", {
|
|
171
|
-
width: "12",
|
|
172
|
-
height: "12",
|
|
173
|
-
viewBox: "0 0 12 12",
|
|
174
|
-
fill: "none",
|
|
175
|
-
"aria-hidden": "true",
|
|
176
|
-
focusable: "false",
|
|
177
|
-
children: /*#__PURE__*/ jsx("path", {
|
|
178
|
-
d: "M2.5 6L5 8.5L9.5 3.5",
|
|
179
|
-
stroke: "currentColor",
|
|
180
|
-
strokeWidth: "1.5",
|
|
181
|
-
strokeLinecap: "round",
|
|
182
|
-
strokeLinejoin: "round"
|
|
183
|
-
})
|
|
184
|
-
});
|
|
185
|
-
$[0] = t0;
|
|
186
|
-
} else t0 = $[0];
|
|
187
|
-
return t0;
|
|
188
|
-
}
|
|
189
|
-
function FilterDropdown(t0) {
|
|
190
|
-
const $ = compiler_runtime_c(22);
|
|
191
|
-
const { filters, activeValues, onSelect } = t0;
|
|
192
|
-
const [open, setOpen] = useState(false);
|
|
193
|
-
const ref = useRef(null);
|
|
194
|
-
let t1;
|
|
195
|
-
let t2;
|
|
196
|
-
if ($[0] !== open) {
|
|
197
|
-
t1 = ()=>{
|
|
198
|
-
if (!open) return;
|
|
199
|
-
const handleClick = (e)=>{
|
|
200
|
-
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
201
|
-
};
|
|
202
|
-
document.addEventListener("mousedown", handleClick);
|
|
203
|
-
return ()=>document.removeEventListener("mousedown", handleClick);
|
|
204
|
-
};
|
|
205
|
-
t2 = [
|
|
206
|
-
open
|
|
207
|
-
];
|
|
208
|
-
$[0] = open;
|
|
209
|
-
$[1] = t1;
|
|
210
|
-
$[2] = t2;
|
|
211
|
-
} else {
|
|
212
|
-
t1 = $[1];
|
|
213
|
-
t2 = $[2];
|
|
214
|
-
}
|
|
215
|
-
useEffect(t1, t2);
|
|
216
|
-
let t3;
|
|
217
|
-
if ($[3] !== activeValues || $[4] !== onSelect) {
|
|
218
|
-
t3 = (val)=>{
|
|
219
|
-
const next = activeValues.includes(val) ? activeValues.filter((v)=>v !== val) : [
|
|
220
|
-
...activeValues,
|
|
221
|
-
val
|
|
222
|
-
];
|
|
223
|
-
onSelect(next);
|
|
224
|
-
};
|
|
225
|
-
$[3] = activeValues;
|
|
226
|
-
$[4] = onSelect;
|
|
227
|
-
$[5] = t3;
|
|
228
|
-
} else t3 = $[5];
|
|
229
|
-
const toggle = t3;
|
|
230
|
-
let t4;
|
|
231
|
-
if ($[6] !== open) {
|
|
232
|
-
t4 = ()=>setOpen(!open);
|
|
233
|
-
$[6] = open;
|
|
234
|
-
$[7] = t4;
|
|
235
|
-
} else t4 = $[7];
|
|
236
|
-
const t5 = activeValues.length > 0;
|
|
237
|
-
let t6;
|
|
238
|
-
if ($[8] !== t5) {
|
|
239
|
-
t6 = /*#__PURE__*/ jsx(FilterIcon, {
|
|
240
|
-
active: t5
|
|
241
|
-
});
|
|
242
|
-
$[8] = t5;
|
|
243
|
-
$[9] = t6;
|
|
244
|
-
} else t6 = $[9];
|
|
245
|
-
let t7;
|
|
246
|
-
if ($[10] !== t4 || $[11] !== t6) {
|
|
247
|
-
t7 = /*#__PURE__*/ jsx("button", {
|
|
248
|
-
type: "button",
|
|
249
|
-
"data-tao-table-filter-trigger": "",
|
|
250
|
-
onClick: t4,
|
|
251
|
-
"aria-label": "Filter",
|
|
252
|
-
children: t6
|
|
253
|
-
});
|
|
254
|
-
$[10] = t4;
|
|
255
|
-
$[11] = t6;
|
|
256
|
-
$[12] = t7;
|
|
257
|
-
} else t7 = $[12];
|
|
258
|
-
let t8;
|
|
259
|
-
if ($[13] !== activeValues || $[14] !== filters || $[15] !== onSelect || $[16] !== open || $[17] !== toggle) {
|
|
260
|
-
t8 = open && /*#__PURE__*/ jsxs("div", {
|
|
261
|
-
"data-tao-table-filter-panel": "",
|
|
262
|
-
children: [
|
|
263
|
-
filters.map((f)=>{
|
|
264
|
-
const checked = activeValues.includes(f.value);
|
|
265
|
-
return /*#__PURE__*/ jsxs("button", {
|
|
266
|
-
type: "button",
|
|
267
|
-
"data-tao-table-filter-option": "",
|
|
268
|
-
onClick: ()=>toggle(f.value),
|
|
269
|
-
"aria-pressed": checked,
|
|
270
|
-
children: [
|
|
271
|
-
/*#__PURE__*/ jsx("span", {
|
|
272
|
-
"data-tao-table-filter-check": "",
|
|
273
|
-
"data-tao-checked": checked || void 0,
|
|
274
|
-
children: checked && /*#__PURE__*/ jsx(CheckIcon, {})
|
|
275
|
-
}),
|
|
276
|
-
/*#__PURE__*/ jsx("span", {
|
|
277
|
-
children: f.text
|
|
278
|
-
})
|
|
279
|
-
]
|
|
280
|
-
}, f.value);
|
|
281
|
-
}),
|
|
282
|
-
activeValues.length > 0 && /*#__PURE__*/ jsx("button", {
|
|
283
|
-
type: "button",
|
|
284
|
-
"data-tao-table-filter-reset": "",
|
|
285
|
-
onClick: ()=>onSelect([]),
|
|
286
|
-
children: "Reset"
|
|
287
|
-
})
|
|
288
|
-
]
|
|
289
|
-
});
|
|
290
|
-
$[13] = activeValues;
|
|
291
|
-
$[14] = filters;
|
|
292
|
-
$[15] = onSelect;
|
|
293
|
-
$[16] = open;
|
|
294
|
-
$[17] = toggle;
|
|
295
|
-
$[18] = t8;
|
|
296
|
-
} else t8 = $[18];
|
|
297
|
-
let t9;
|
|
298
|
-
if ($[19] !== t7 || $[20] !== t8) {
|
|
299
|
-
t9 = /*#__PURE__*/ jsxs("div", {
|
|
300
|
-
"data-tao-table-filter-dropdown": "",
|
|
301
|
-
ref: ref,
|
|
302
|
-
children: [
|
|
303
|
-
t7,
|
|
304
|
-
t8
|
|
305
|
-
]
|
|
306
|
-
});
|
|
307
|
-
$[19] = t7;
|
|
308
|
-
$[20] = t8;
|
|
309
|
-
$[21] = t9;
|
|
310
|
-
} else t9 = $[21];
|
|
311
|
-
return t9;
|
|
312
|
-
}
|
|
313
11
|
function Table(t0) {
|
|
314
12
|
const $ = compiler_runtime_c(96);
|
|
315
13
|
const { columns, dataSource, rowKey, loading: t1, pagination: paginationProp, onChange, scroll, rowSelection, size, variant, headerBackground: t2, emptyText: t3, bordered: t4, className, style, classNames, styles, rowClassName, rowStyle, onRow, onHeaderRow } = t0;
|
|
@@ -414,7 +112,7 @@ function Table(t0) {
|
|
|
414
112
|
if (col_1.filters) {
|
|
415
113
|
const key_1 = getColKey(col_1, i_1);
|
|
416
114
|
const vals = fv[key_1];
|
|
417
|
-
result[col_1.dataIndex
|
|
115
|
+
result[null == col_1.dataIndex ? key_1 : String(col_1.dataIndex)] = vals && vals.length > 0 ? vals : null;
|
|
418
116
|
}
|
|
419
117
|
}
|
|
420
118
|
return result;
|
|
@@ -566,7 +264,7 @@ function Table(t0) {
|
|
|
566
264
|
const selectedKeys = t15;
|
|
567
265
|
let t16;
|
|
568
266
|
if ($[47] !== dataSource || $[48] !== rowKey || $[49] !== rowSelection || $[50] !== selectedKeys || $[51] !== selectionType) {
|
|
569
|
-
t16 = (key_5
|
|
267
|
+
t16 = (key_5)=>{
|
|
570
268
|
if (!rowSelection?.onChange) return;
|
|
571
269
|
let nextKeys;
|
|
572
270
|
nextKeys = "radio" === selectionType ? [
|
|
@@ -728,7 +426,7 @@ function Table(t0) {
|
|
|
728
426
|
const isIndeterminate = !isAllSelected && selectedKeys.length > 0;
|
|
729
427
|
let t26;
|
|
730
428
|
if ($[80] !== loading) {
|
|
731
|
-
t26 = loading && /*#__PURE__*/ jsx(
|
|
429
|
+
t26 = loading && /*#__PURE__*/ jsx(TableLoadingSpinner, {});
|
|
732
430
|
$[80] = loading;
|
|
733
431
|
$[81] = t26;
|
|
734
432
|
} else t26 = $[81];
|
|
@@ -743,20 +441,20 @@ function Table(t0) {
|
|
|
743
441
|
style: resolvedStyles.empty,
|
|
744
442
|
children: emptyText
|
|
745
443
|
})
|
|
746
|
-
}) : paginatedData.map((
|
|
747
|
-
const key_6 = getRowKey(
|
|
444
|
+
}) : paginatedData.map((record_0, rowIdx)=>{
|
|
445
|
+
const key_6 = getRowKey(record_0, rowKey);
|
|
748
446
|
const isSelected = selectedKeys.includes(key_6);
|
|
749
|
-
const checkboxProps = rowSelection?.getCheckboxProps?.(
|
|
750
|
-
const rowProps = onRow?.(
|
|
447
|
+
const checkboxProps = rowSelection?.getCheckboxProps?.(record_0);
|
|
448
|
+
const rowProps = onRow?.(record_0, rowIdx) ?? {};
|
|
751
449
|
return /*#__PURE__*/ createElement("tr", {
|
|
752
450
|
...rowProps,
|
|
753
451
|
key: key_6,
|
|
754
452
|
"data-tao-table-row": "",
|
|
755
453
|
"data-tao-selected": isSelected || void 0,
|
|
756
|
-
className: cx(resolvedClassNames["body.row"], resolveRowClassName(rowClassName,
|
|
454
|
+
className: cx(resolvedClassNames["body.row"], resolveRowClassName(rowClassName, record_0, rowIdx), rowProps.className),
|
|
757
455
|
style: {
|
|
758
456
|
...resolvedStyles["body.row"],
|
|
759
|
-
...resolveRowStyle(rowStyle,
|
|
457
|
+
...resolveRowStyle(rowStyle, record_0, rowIdx),
|
|
760
458
|
...rowProps.style
|
|
761
459
|
},
|
|
762
460
|
children: [
|
|
@@ -776,17 +474,18 @@ function Table(t0) {
|
|
|
776
474
|
children: /*#__PURE__*/ jsx("input", {
|
|
777
475
|
type: "radio" === selectionType ? "radio" : "checkbox",
|
|
778
476
|
checked: isSelected,
|
|
477
|
+
"aria-label": `Select row ${String(key_6)}`,
|
|
779
478
|
disabled: checkboxProps?.disabled,
|
|
780
|
-
onChange: ()=>handleSelectRow(key_6
|
|
479
|
+
onChange: ()=>handleSelectRow(key_6),
|
|
781
480
|
"data-tao-table-checkbox": ""
|
|
782
481
|
})
|
|
783
482
|
}),
|
|
784
483
|
columns.map((col_10, colIdx_1)=>{
|
|
785
484
|
const colKey_3 = getColKey(col_10, colIdx_1);
|
|
786
|
-
const value = getCellValue(
|
|
485
|
+
const value = getCellValue(record_0, col_10.dataIndex);
|
|
787
486
|
const stickyPos_0 = stickyPositions[colKey_3];
|
|
788
487
|
const isFixed_0 = !!col_10.fixed && !!scroll?.x;
|
|
789
|
-
const cellProps = col_10.onCell?.(
|
|
488
|
+
const cellProps = col_10.onCell?.(record_0, rowIdx) ?? {};
|
|
790
489
|
return /*#__PURE__*/ createElement("td", {
|
|
791
490
|
...cellProps,
|
|
792
491
|
key: colKey_3,
|
|
@@ -809,7 +508,7 @@ function Table(t0) {
|
|
|
809
508
|
} : {},
|
|
810
509
|
...cellProps.style
|
|
811
510
|
}
|
|
812
|
-
}, col_10.render ? col_10.render(value,
|
|
511
|
+
}, col_10.render ? col_10.render(value, record_0, rowIdx) : value);
|
|
813
512
|
})
|
|
814
513
|
]
|
|
815
514
|
});
|
|
@@ -910,6 +609,7 @@ function Table(t0) {
|
|
|
910
609
|
},
|
|
911
610
|
children: "checkbox" === selectionType && /*#__PURE__*/ jsx("input", {
|
|
912
611
|
type: "checkbox",
|
|
612
|
+
"aria-label": "Select all rows",
|
|
913
613
|
checked: isAllSelected,
|
|
914
614
|
ref: (el_0)=>{
|
|
915
615
|
if (el_0) el_0.indeterminate = isIndeterminate;
|
|
@@ -935,6 +635,7 @@ function Table(t0) {
|
|
|
935
635
|
"data-tao-table-header": "",
|
|
936
636
|
"data-tao-align": col_9.align,
|
|
937
637
|
"data-tao-fixed": isFixed ? col_9.fixed : void 0,
|
|
638
|
+
"aria-sort": hasSorter ? "ascend" === resolvedOrder ? "ascending" : "descend" === resolvedOrder ? "descending" : "none" : void 0,
|
|
938
639
|
className: cx(resolvedClassNames["header.cell"], headerCellProps.className),
|
|
939
640
|
style: {
|
|
940
641
|
...resolvedStyles["header.cell"],
|
|
@@ -956,22 +657,26 @@ function Table(t0) {
|
|
|
956
657
|
className: resolvedClassNames["header.content"],
|
|
957
658
|
style: resolvedStyles["header.content"],
|
|
958
659
|
children: [
|
|
959
|
-
/*#__PURE__*/ jsxs("button", {
|
|
660
|
+
hasSorter ? /*#__PURE__*/ jsxs("button", {
|
|
960
661
|
type: "button",
|
|
961
662
|
"data-tao-table-header-title": "",
|
|
962
|
-
"data-tao-sortable":
|
|
663
|
+
"data-tao-sortable": "",
|
|
963
664
|
className: resolvedClassNames["header.title"],
|
|
964
665
|
style: resolvedStyles["header.title"],
|
|
965
|
-
|
|
966
|
-
onClick: hasSorter ? ()=>handleSort(colKey_2, col_9) : void 0,
|
|
666
|
+
onClick: ()=>handleSort(colKey_2, col_9),
|
|
967
667
|
children: [
|
|
968
668
|
col_9.title,
|
|
969
|
-
|
|
669
|
+
/*#__PURE__*/ jsx(SortIcon, {
|
|
970
670
|
order: resolvedOrder
|
|
971
671
|
})
|
|
972
672
|
]
|
|
673
|
+
}) : /*#__PURE__*/ jsx("span", {
|
|
674
|
+
"data-tao-table-header-title": "",
|
|
675
|
+
className: resolvedClassNames["header.title"],
|
|
676
|
+
style: resolvedStyles["header.title"],
|
|
677
|
+
children: col_9.title
|
|
973
678
|
}),
|
|
974
|
-
hasFilter && /*#__PURE__*/ jsx(
|
|
679
|
+
hasFilter && /*#__PURE__*/ jsx(TableFilterDropdown, {
|
|
975
680
|
filters: col_9.filters,
|
|
976
681
|
activeValues: activeFilterValues,
|
|
977
682
|
onSelect: (vals_0)=>handleFilter(colKey_2, vals_0)
|
|
@@ -994,9 +699,4 @@ function Table(t0) {
|
|
|
994
699
|
function _temp(c) {
|
|
995
700
|
return c.defaultSortOrder;
|
|
996
701
|
}
|
|
997
|
-
function nextSortOrder(current) {
|
|
998
|
-
if ('ascend' === current) return 'descend';
|
|
999
|
-
if ('descend' === current) return null;
|
|
1000
|
-
return 'ascend';
|
|
1001
|
-
}
|
|
1002
702
|
export { Table };
|
|
@@ -67,11 +67,14 @@
|
|
|
67
67
|
[data-tao-tabs-ink] {
|
|
68
68
|
background: var(--tao-primary);
|
|
69
69
|
border-radius: var(--tao-radius-full);
|
|
70
|
+
transform-origin: 0;
|
|
71
|
+
width: 1px;
|
|
70
72
|
height: 2px;
|
|
71
|
-
transition:
|
|
72
|
-
|
|
73
|
+
transition: transform var(--tao-motion-duration-mid)
|
|
74
|
+
var(--tao-motion-ease-out-quint);
|
|
73
75
|
position: absolute;
|
|
74
76
|
bottom: 0;
|
|
77
|
+
left: 0;
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
[data-tao-tabs][data-tao-variant="card"] [data-tao-tabs-list] {
|