@rockshin/tao-ui 0.0.44 → 0.0.46
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 +9 -1
- package/component-manifest.json +38 -4
- package/dist/components/alert/alert.js +20 -17
- package/dist/components/auto-complete/auto-complete.js +12 -3
- package/dist/components/avatar/avatar.js +2 -1
- package/dist/components/breadcrumb/breadcrumb.css +4 -0
- package/dist/components/breadcrumb/breadcrumb.js +82 -77
- package/dist/components/calendar/calendar.d.ts +1 -1
- package/dist/components/calendar/calendar.js +51 -33
- package/dist/components/card/card-tabs.js +204 -182
- package/dist/components/card/card.js +1 -1
- package/dist/components/carousel/carousel.js +11 -5
- package/dist/components/cascader/cascader.js +16 -4
- package/dist/components/collapse/collapse.css +8 -0
- package/dist/components/color-picker/color-picker.js +273 -269
- package/dist/components/context-menu/context-menu.d.ts +2 -1
- package/dist/components/context-menu/context-menu.js +57 -44
- package/dist/components/date-picker/calendar/calendar-grid.js +13 -6
- package/dist/components/date-picker/calendar/use-calendar.d.ts +2 -2
- package/dist/components/date-picker/calendar/use-calendar.js +2 -3
- package/dist/components/date-picker/date-localization.d.ts +3 -0
- package/dist/components/date-picker/date-localization.js +76 -0
- package/dist/components/date-picker/date-picker.css +4 -0
- package/dist/components/date-picker/date-picker.d.ts +1 -0
- package/dist/components/date-picker/date-picker.js +48 -30
- package/dist/components/date-picker/range-picker.d.ts +1 -0
- package/dist/components/date-picker/range-picker.js +41 -23
- package/dist/components/drawer/drawer.d.ts +2 -1
- package/dist/components/drawer/drawer.js +32 -20
- package/dist/components/dropdown/dropdown.d.ts +1 -0
- package/dist/components/dropdown/dropdown.js +160 -143
- package/dist/components/float-button/float-button.js +3 -2
- package/dist/components/form/form.js +88 -103
- package/dist/components/image/image.js +202 -137
- package/dist/components/list/list-pagination.js +148 -147
- package/dist/components/mentions/mentions.js +6 -2
- package/dist/components/modal/confirm-dialog.js +4 -2
- package/dist/components/modal/modal.d.ts +2 -1
- package/dist/components/modal/modal.js +387 -375
- package/dist/components/pagination/pagination.css +4 -0
- package/dist/components/pagination/pagination.js +115 -110
- package/dist/components/popconfirm/popconfirm.js +109 -107
- package/dist/components/popover/popover.d.ts +2 -1
- package/dist/components/popover/popover.js +185 -176
- package/dist/components/qr-code/qr-code.js +22 -21
- package/dist/components/rate/rate.js +114 -88
- package/dist/components/scroll-area/scroll-area.js +132 -120
- package/dist/components/segmented/segmented.js +52 -29
- package/dist/components/select/mobile-select.d.ts +3 -2
- package/dist/components/select/mobile-select.js +54 -48
- package/dist/components/select/select-types.d.ts +1 -0
- package/dist/components/select/select.js +19 -6
- package/dist/components/slider/slider.js +136 -133
- package/dist/components/sonner/sonner.js +10 -10
- package/dist/components/spinner/spinner.js +1 -1
- package/dist/components/splitter/splitter.css +4 -0
- package/dist/components/splitter/splitter.js +29 -24
- package/dist/components/statistic/statistic.d.ts +2 -0
- package/dist/components/statistic/statistic.js +203 -187
- package/dist/components/table/table-filter.js +61 -52
- package/dist/components/table/table-icons.js +3 -1
- package/dist/components/table/table.css +29 -11
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.js +384 -547
- package/dist/components/tabs/tabs.js +3 -2
- package/dist/components/tag/tag.js +22 -19
- package/dist/components/time-picker/time-picker.d.ts +0 -1
- package/dist/components/time-picker/time-picker.js +160 -103
- package/dist/components/tooltip/tooltip.d.ts +2 -1
- package/dist/components/tooltip/tooltip.js +82 -71
- package/dist/components/transfer/transfer-list.js +224 -488
- package/dist/components/transfer/transfer-parts.js +14 -4
- package/dist/components/transfer/transfer-types.d.ts +1 -0
- package/dist/components/transfer/transfer.js +23 -20
- package/dist/components/tree/tree-keyboard.d.ts +6 -0
- package/dist/components/tree/tree-keyboard.js +27 -0
- package/dist/components/tree/tree.js +14 -3
- package/dist/components/tree-select/select-engine.d.ts +2 -1
- package/dist/components/tree-select/select-engine.js +23 -15
- package/dist/components/tree-select/tree-select.js +20 -10
- package/dist/components/upload/upload.js +30 -26
- package/dist/docs/component-docs.d.ts +13 -2
- package/dist/docs/components/headless-input-number.doc.d.ts +5 -0
- package/dist/docs/components/headless-input-number.doc.js +7 -0
- package/dist/docs/components/input-number.doc.d.ts +5 -0
- package/dist/docs/components/input-number.doc.js +7 -0
- package/dist/docs/components/statistic.doc.d.ts +5 -0
- package/dist/docs/components/statistic.doc.js +7 -0
- package/dist/docs/components/tao-provider.doc.d.ts +8 -2
- package/dist/docs/components/tao-provider.doc.js +16 -3
- package/dist/docs/components/tooltip.doc.d.ts +2 -2
- package/dist/entries/provider.d.ts +2 -1
- package/dist/entries/provider.js +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/locales/ar-EG.d.ts +3 -0
- package/dist/locales/ar-EG.js +199 -0
- package/dist/locales/create-locale.d.ts +41 -0
- package/dist/locales/create-locale.js +88 -0
- package/dist/locales/de-DE.d.ts +3 -0
- package/dist/locales/de-DE.js +195 -0
- package/dist/locales/en-US.d.ts +2 -0
- package/dist/locales/en-US.js +194 -0
- package/dist/locales/es-ES.d.ts +3 -0
- package/dist/locales/es-ES.js +195 -0
- package/dist/locales/fr-FR.d.ts +3 -0
- package/dist/locales/fr-FR.js +195 -0
- package/dist/locales/hi-IN.d.ts +3 -0
- package/dist/locales/hi-IN.js +194 -0
- package/dist/locales/id-ID.d.ts +3 -0
- package/dist/locales/id-ID.js +194 -0
- package/dist/locales/index.d.ts +18 -0
- package/dist/locales/index.js +17 -0
- package/dist/locales/it-IT.d.ts +3 -0
- package/dist/locales/it-IT.js +195 -0
- package/dist/locales/ja-JP.d.ts +3 -0
- package/dist/locales/ja-JP.js +194 -0
- package/dist/locales/ko-KR.d.ts +3 -0
- package/dist/locales/ko-KR.js +194 -0
- package/dist/locales/pt-BR.d.ts +3 -0
- package/dist/locales/pt-BR.js +195 -0
- package/dist/locales/ru-RU.d.ts +3 -0
- package/dist/locales/ru-RU.js +197 -0
- package/dist/locales/th-TH.d.ts +3 -0
- package/dist/locales/th-TH.js +194 -0
- package/dist/locales/tr-TR.d.ts +3 -0
- package/dist/locales/tr-TR.js +194 -0
- package/dist/locales/types.d.ts +176 -0
- package/dist/locales/types.js +0 -0
- package/dist/locales/vi-VN.d.ts +3 -0
- package/dist/locales/vi-VN.js +194 -0
- package/dist/locales/zh-CN.d.ts +3 -0
- package/dist/locales/zh-CN.js +194 -0
- package/dist/locales/zh-TW.d.ts +3 -0
- package/dist/locales/zh-TW.js +194 -0
- package/dist/number-input/format.d.ts +4 -3
- package/dist/number-input/format.js +9 -7
- package/dist/number-input/locale.d.ts +19 -0
- package/dist/number-input/locale.js +44 -0
- package/dist/number-input/number-input.js +1 -0
- package/dist/number-input/use-number-input.d.ts +2 -0
- package/dist/number-input/use-number-input.js +180 -176
- package/dist/provider/locale.d.ts +3 -65
- package/dist/provider/locale.js +2 -146
- package/dist/provider/merge-locale.d.ts +8 -0
- package/dist/provider/merge-locale.js +53 -0
- package/dist/provider/tao-provider.d.ts +16 -5
- package/dist/provider/tao-provider.js +200 -92
- package/dist/utils/scroll-left.d.ts +3 -0
- package/dist/utils/scroll-left.js +7 -0
- package/llms.txt +3 -3
- package/package.json +5 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment, createElement, isValidElement, useEffect, useRef, useState } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
2
|
+
import { Fragment, createElement, isValidElement, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { useTaoConfig, useTaoDirection } from "../../provider/tao-provider.js";
|
|
5
4
|
import { useBreakpoint } from "../../utils/breakpoint.js";
|
|
5
|
+
import { getScrollLeft } from "../../utils/scroll-left.js";
|
|
6
6
|
import { cx } from "../../utils/semantic.js";
|
|
7
7
|
import { Checkbox } from "../checkbox/checkbox.js";
|
|
8
8
|
import { Pagination } from "../pagination/pagination.js";
|
|
@@ -20,26 +20,17 @@ function stickyStyle(pos, zIndex) {
|
|
|
20
20
|
zIndex
|
|
21
21
|
} : void 0;
|
|
22
22
|
}
|
|
23
|
-
function Table(
|
|
24
|
-
const $ = c(89);
|
|
25
|
-
const { columns: columnsProp, dataSource, rowKey, loading: t1, pagination: paginationProp, onChange, scroll, rowSelection, expandable, summary, size, variant, headerBackground: t2, emptyText: t3, bordered: t4, className, style, classNames, styles, rowClassName, rowStyle, onRow, onHeaderRow } = t0;
|
|
26
|
-
const loading = void 0 === t1 ? false : t1;
|
|
27
|
-
const headerBackground = void 0 === t2 ? true : t2;
|
|
28
|
-
const emptyText = void 0 === t3 ? "No Data" : t3;
|
|
29
|
-
const bordered = void 0 === t4 ? false : t4;
|
|
23
|
+
function Table({ columns: columnsProp, dataSource, rowKey, loading = false, pagination: paginationProp, onChange, scroll, rowSelection, expandable, summary, size, variant, headerBackground = true, emptyText: emptyTextProp, bordered = false, className, style, classNames, styles, rowClassName, rowStyle, onRow, onHeaderRow }) {
|
|
30
24
|
const ctx = useTaoConfig();
|
|
25
|
+
const emptyText = void 0 === emptyTextProp ? ctx.locale.messages.tableEmpty : emptyTextProp;
|
|
31
26
|
const resolvedSize = size ?? ctx.size;
|
|
32
27
|
const screens = useBreakpoint();
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} else t5 = $[2];
|
|
40
|
-
const columns = t5;
|
|
41
|
-
const resolvedVariant = variant ?? ("outlined" === ctx.variant ? "modern" : ctx.variant);
|
|
42
|
-
const showBorder = "outlined" === resolvedVariant || "modern" === resolvedVariant || bordered && "borderless" !== resolvedVariant;
|
|
28
|
+
const columns = useMemo(()=>columnsProp.some((col_0)=>col_0.responsive) ? columnsProp.filter((col)=>!col.responsive || col.responsive.some((bp)=>screens[bp])) : columnsProp, [
|
|
29
|
+
columnsProp,
|
|
30
|
+
screens
|
|
31
|
+
]);
|
|
32
|
+
const resolvedVariant = variant ?? ('outlined' === ctx.variant ? 'modern' : ctx.variant);
|
|
33
|
+
const showBorder = 'outlined' === resolvedVariant || 'modern' === resolvedVariant || bordered && 'borderless' !== resolvedVariant;
|
|
43
34
|
const semanticProps = {
|
|
44
35
|
columns,
|
|
45
36
|
dataSource,
|
|
@@ -67,201 +58,126 @@ function Table(t0) {
|
|
|
67
58
|
};
|
|
68
59
|
const resolvedClassNames = resolveSemanticClassNames(classNames, semanticProps);
|
|
69
60
|
const resolvedStyles = resolveSemanticStyles(styles, semanticProps);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
onChange
|
|
77
|
-
};
|
|
78
|
-
$[3] = columns;
|
|
79
|
-
$[4] = dataSource;
|
|
80
|
-
$[5] = onChange;
|
|
81
|
-
$[6] = paginationProp;
|
|
82
|
-
$[7] = t6;
|
|
83
|
-
} else t6 = $[7];
|
|
84
|
-
const tableData = useTableData(t6);
|
|
61
|
+
const tableData = useTableData({
|
|
62
|
+
columns,
|
|
63
|
+
dataSource,
|
|
64
|
+
pagination: paginationProp,
|
|
65
|
+
onChange
|
|
66
|
+
});
|
|
85
67
|
const paginatedData = tableData.rows;
|
|
86
68
|
const selectionColWidth = rowSelection?.columnWidth ?? 48;
|
|
87
|
-
const selectionType = rowSelection?.type ??
|
|
69
|
+
const selectionType = rowSelection?.type ?? 'checkbox';
|
|
88
70
|
const isSelectionControlled = rowSelection?.selectedRowKeys !== void 0;
|
|
89
|
-
|
|
90
|
-
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
91
|
-
t7 = [];
|
|
92
|
-
$[8] = t7;
|
|
93
|
-
} else t7 = $[8];
|
|
94
|
-
const [internalSelectedKeys, setInternalSelectedKeys] = useState(t7);
|
|
71
|
+
const [internalSelectedKeys, setInternalSelectedKeys] = useState([]);
|
|
95
72
|
const selectedKeys = rowSelection?.selectedRowKeys ?? internalSelectedKeys;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
let
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
$[24] = selectedKeys;
|
|
146
|
-
$[25] = selectionType;
|
|
147
|
-
$[26] = t10;
|
|
148
|
-
} else t10 = $[26];
|
|
149
|
-
const handleSelectRow = t10;
|
|
150
|
-
let t11;
|
|
151
|
-
if ($[27] !== dataSource || $[28] !== isSelectionControlled || $[29] !== rowKey || $[30] !== rowSelection || $[31] !== selectablePageKeys || $[32] !== selectedKeys) {
|
|
152
|
-
t11 = (checked)=>{
|
|
153
|
-
const nextKeySet_0 = new Set(selectedKeys);
|
|
154
|
-
for (const key_0 of selectablePageKeys)if (checked) nextKeySet_0.add(key_0);
|
|
155
|
-
else nextKeySet_0.delete(key_0);
|
|
156
|
-
const nextKeys_0 = [
|
|
157
|
-
...nextKeySet_0
|
|
158
|
-
];
|
|
159
|
-
if (!isSelectionControlled) setInternalSelectedKeys(nextKeys_0);
|
|
160
|
-
if (!rowSelection?.onChange) return;
|
|
161
|
-
const nextRows_0 = dataSource.filter((record_1)=>nextKeySet_0.has(getRowKey(record_1, rowKey)));
|
|
162
|
-
rowSelection.onChange(nextKeys_0, nextRows_0);
|
|
163
|
-
};
|
|
164
|
-
$[27] = dataSource;
|
|
165
|
-
$[28] = isSelectionControlled;
|
|
166
|
-
$[29] = rowKey;
|
|
167
|
-
$[30] = rowSelection;
|
|
168
|
-
$[31] = selectablePageKeys;
|
|
169
|
-
$[32] = selectedKeys;
|
|
170
|
-
$[33] = t11;
|
|
171
|
-
} else t11 = $[33];
|
|
172
|
-
const handleSelectAll = t11;
|
|
73
|
+
const selectedKeySet = useMemo(()=>new Set(selectedKeys), [
|
|
74
|
+
selectedKeys
|
|
75
|
+
]);
|
|
76
|
+
const selectablePageKeys = useMemo(()=>paginatedData.filter((record)=>!rowSelection?.getCheckboxProps?.(record)?.disabled).map((record_0)=>getRowKey(record_0, rowKey)), [
|
|
77
|
+
paginatedData,
|
|
78
|
+
rowSelection,
|
|
79
|
+
rowKey
|
|
80
|
+
]);
|
|
81
|
+
const handleSelectRow = useCallback((key)=>{
|
|
82
|
+
let nextKeys;
|
|
83
|
+
nextKeys = 'radio' === selectionType ? [
|
|
84
|
+
key
|
|
85
|
+
] : selectedKeySet.has(key) ? selectedKeys.filter((k)=>k !== key) : [
|
|
86
|
+
...selectedKeys,
|
|
87
|
+
key
|
|
88
|
+
];
|
|
89
|
+
if (!isSelectionControlled) setInternalSelectedKeys(nextKeys);
|
|
90
|
+
if (!rowSelection?.onChange) return;
|
|
91
|
+
const nextKeySet = new Set(nextKeys);
|
|
92
|
+
const nextRows = dataSource.filter((r)=>nextKeySet.has(getRowKey(r, rowKey)));
|
|
93
|
+
rowSelection.onChange(nextKeys, nextRows);
|
|
94
|
+
}, [
|
|
95
|
+
rowSelection,
|
|
96
|
+
selectionType,
|
|
97
|
+
isSelectionControlled,
|
|
98
|
+
selectedKeys,
|
|
99
|
+
selectedKeySet,
|
|
100
|
+
dataSource,
|
|
101
|
+
rowKey
|
|
102
|
+
]);
|
|
103
|
+
const handleSelectAll = useCallback((checked)=>{
|
|
104
|
+
const nextKeySet_0 = new Set(selectedKeys);
|
|
105
|
+
for (const key_0 of selectablePageKeys)if (checked) nextKeySet_0.add(key_0);
|
|
106
|
+
else nextKeySet_0.delete(key_0);
|
|
107
|
+
const nextKeys_0 = [
|
|
108
|
+
...nextKeySet_0
|
|
109
|
+
];
|
|
110
|
+
if (!isSelectionControlled) setInternalSelectedKeys(nextKeys_0);
|
|
111
|
+
if (!rowSelection?.onChange) return;
|
|
112
|
+
const nextRows_0 = dataSource.filter((record_1)=>nextKeySet_0.has(getRowKey(record_1, rowKey)));
|
|
113
|
+
rowSelection.onChange(nextKeys_0, nextRows_0);
|
|
114
|
+
}, [
|
|
115
|
+
rowSelection,
|
|
116
|
+
selectedKeys,
|
|
117
|
+
selectablePageKeys,
|
|
118
|
+
dataSource,
|
|
119
|
+
rowKey,
|
|
120
|
+
isSelectionControlled
|
|
121
|
+
]);
|
|
173
122
|
const expandColWidth = expandable?.columnWidth ?? 48;
|
|
174
|
-
|
|
175
|
-
if ($[34] !== expandable?.defaultExpandedRowKeys) {
|
|
176
|
-
t12 = ()=>expandable?.defaultExpandedRowKeys ?? [];
|
|
177
|
-
$[34] = expandable?.defaultExpandedRowKeys;
|
|
178
|
-
$[35] = t12;
|
|
179
|
-
} else t12 = $[35];
|
|
180
|
-
const [internalExpandedKeys, setInternalExpandedKeys] = useState(t12);
|
|
123
|
+
const [internalExpandedKeys, setInternalExpandedKeys] = useState(()=>expandable?.defaultExpandedRowKeys ?? []);
|
|
181
124
|
const expandedKeys = expandable?.expandedRowKeys ?? internalExpandedKeys;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
key_1
|
|
196
|
-
] : expandedKeys.filter((k_0)=>k_0 !== key_1);
|
|
197
|
-
if (expandable?.expandedRowKeys === void 0) setInternalExpandedKeys(nextKeys_1);
|
|
198
|
-
expandable?.onExpand?.(expanded, record_2);
|
|
199
|
-
expandable?.onExpandedRowsChange?.(nextKeys_1);
|
|
200
|
-
};
|
|
201
|
-
$[38] = expandable;
|
|
202
|
-
$[39] = expandedKeySet;
|
|
203
|
-
$[40] = expandedKeys;
|
|
204
|
-
$[41] = t14;
|
|
205
|
-
} else t14 = $[41];
|
|
206
|
-
const toggleExpand = t14;
|
|
125
|
+
const expandedKeySet = useMemo(()=>new Set(expandedKeys), [
|
|
126
|
+
expandedKeys
|
|
127
|
+
]);
|
|
128
|
+
const toggleExpand = (record_2, key_1)=>{
|
|
129
|
+
const expanded = !expandedKeySet.has(key_1);
|
|
130
|
+
const nextKeys_1 = expanded ? [
|
|
131
|
+
...expandedKeys,
|
|
132
|
+
key_1
|
|
133
|
+
] : expandedKeys.filter((k_0)=>k_0 !== key_1);
|
|
134
|
+
if (expandable?.expandedRowKeys === void 0) setInternalExpandedKeys(nextKeys_1);
|
|
135
|
+
expandable?.onExpand?.(expanded, record_2);
|
|
136
|
+
expandable?.onExpandedRowsChange?.(nextKeys_1);
|
|
137
|
+
};
|
|
207
138
|
const scrollRef = useRef(null);
|
|
139
|
+
const [direction, directionRef] = useTaoDirection(void 0, 'self');
|
|
208
140
|
const [viewportWidth, setViewportWidth] = useState();
|
|
209
|
-
const [scrollState, setScrollState] = useState(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
$[44] = t16;
|
|
239
|
-
} else t16 = $[44];
|
|
240
|
-
const t17 = scroll?.x;
|
|
241
|
-
let t18;
|
|
242
|
-
if ($[45] !== t17) {
|
|
243
|
-
t18 = [
|
|
244
|
-
t17,
|
|
245
|
-
handleScroll
|
|
246
|
-
];
|
|
247
|
-
$[45] = t17;
|
|
248
|
-
$[46] = t18;
|
|
249
|
-
} else t18 = $[46];
|
|
250
|
-
useEffect(t16, t18);
|
|
251
|
-
let cols;
|
|
252
|
-
if ($[47] !== columns || $[48] !== expandColWidth || $[49] !== expandable || $[50] !== rowSelection || $[51] !== selectionColWidth) {
|
|
253
|
-
cols = [];
|
|
141
|
+
const [scrollState, setScrollState] = useState('left');
|
|
142
|
+
const handleScroll = useCallback(()=>{
|
|
143
|
+
const el = scrollRef.current;
|
|
144
|
+
if (!el) return;
|
|
145
|
+
const { scrollWidth, clientWidth } = el;
|
|
146
|
+
const scrollLeft = getScrollLeft(el);
|
|
147
|
+
const atLeft = scrollLeft <= 1;
|
|
148
|
+
const atRight = scrollLeft + clientWidth >= scrollWidth - 1;
|
|
149
|
+
setViewportWidth(clientWidth);
|
|
150
|
+
if (atLeft && atRight) setScrollState('both');
|
|
151
|
+
else if (atLeft) setScrollState('rtl' === direction ? 'right' : 'left');
|
|
152
|
+
else atRight ? setScrollState('rtl' === direction ? 'left' : 'right') : setScrollState('middle');
|
|
153
|
+
}, [
|
|
154
|
+
direction
|
|
155
|
+
]);
|
|
156
|
+
useEffect(()=>{
|
|
157
|
+
const el_0 = scrollRef.current;
|
|
158
|
+
if (!scroll?.x || !el_0) return;
|
|
159
|
+
handleScroll();
|
|
160
|
+
const observer = new ResizeObserver(handleScroll);
|
|
161
|
+
observer.observe(el_0);
|
|
162
|
+
if (el_0.firstElementChild) observer.observe(el_0.firstElementChild);
|
|
163
|
+
return ()=>observer.disconnect();
|
|
164
|
+
}, [
|
|
165
|
+
scroll?.x,
|
|
166
|
+
handleScroll
|
|
167
|
+
]);
|
|
168
|
+
const allColumns = useMemo(()=>{
|
|
169
|
+
const cols = [];
|
|
254
170
|
if (expandable) cols.push({
|
|
255
|
-
_key:
|
|
171
|
+
_key: '__expand__',
|
|
256
172
|
_index: -2,
|
|
257
173
|
width: expandColWidth,
|
|
258
|
-
fixed: expandable.fixed ?
|
|
174
|
+
fixed: expandable.fixed ? 'left' : void 0
|
|
259
175
|
});
|
|
260
176
|
if (rowSelection) cols.push({
|
|
261
|
-
_key:
|
|
177
|
+
_key: '__selection__',
|
|
262
178
|
_index: -1,
|
|
263
179
|
width: selectionColWidth,
|
|
264
|
-
fixed: rowSelection.fixed ?
|
|
180
|
+
fixed: rowSelection.fixed ? 'left' : void 0
|
|
265
181
|
});
|
|
266
182
|
columns.forEach((col_1, i)=>{
|
|
267
183
|
cols.push({
|
|
@@ -270,279 +186,62 @@ function Table(t0) {
|
|
|
270
186
|
_index: i
|
|
271
187
|
});
|
|
272
188
|
});
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
189
|
+
return cols;
|
|
190
|
+
}, [
|
|
191
|
+
columns,
|
|
192
|
+
rowSelection,
|
|
193
|
+
selectionColWidth,
|
|
194
|
+
expandable,
|
|
195
|
+
expandColWidth
|
|
196
|
+
]);
|
|
197
|
+
const stickyPositions = useMemo(()=>{
|
|
198
|
+
if (!scroll?.x) return {};
|
|
199
|
+
const positions = {};
|
|
200
|
+
let leftOffset = 0;
|
|
201
|
+
for (const col_2 of allColumns)if ('left' === col_2.fixed) {
|
|
202
|
+
positions[col_2._key] = {
|
|
203
|
+
['rtl' === direction ? 'right' : 'left']: leftOffset
|
|
204
|
+
};
|
|
205
|
+
leftOffset += 'number' == typeof col_2.width ? col_2.width : 0;
|
|
206
|
+
}
|
|
207
|
+
let rightOffset = 0;
|
|
208
|
+
for(let i_0 = allColumns.length - 1; i_0 >= 0; i_0--){
|
|
209
|
+
const col_3 = allColumns[i_0];
|
|
210
|
+
if ('right' === col_3.fixed) {
|
|
211
|
+
positions[col_3._key] = {
|
|
212
|
+
['rtl' === direction ? 'left' : 'right']: rightOffset
|
|
290
213
|
};
|
|
291
|
-
|
|
214
|
+
rightOffset += 'number' == typeof col_3.width ? col_3.width : 0;
|
|
292
215
|
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
return positions;
|
|
304
|
-
};
|
|
305
|
-
$[53] = allColumns;
|
|
306
|
-
$[54] = scroll?.x;
|
|
307
|
-
$[55] = t19;
|
|
308
|
-
} else t19 = $[55];
|
|
309
|
-
scroll?.x;
|
|
310
|
-
let t20;
|
|
311
|
-
if ($[56] !== t19) {
|
|
312
|
-
t20 = t19();
|
|
313
|
-
$[56] = t19;
|
|
314
|
-
$[57] = t20;
|
|
315
|
-
} else t20 = $[57];
|
|
316
|
-
const stickyPositions = t20;
|
|
317
|
-
let t21;
|
|
318
|
-
if ($[58] !== allColumns || $[59] !== stickyPositions) {
|
|
319
|
-
t21 = allColumns.map((col_4)=>({
|
|
216
|
+
}
|
|
217
|
+
return positions;
|
|
218
|
+
}, [
|
|
219
|
+
allColumns,
|
|
220
|
+
scroll?.x,
|
|
221
|
+
direction
|
|
222
|
+
]);
|
|
223
|
+
const summaryColumns = useMemo(()=>allColumns.map((col_4)=>({
|
|
320
224
|
fixed: col_4.fixed,
|
|
321
225
|
sticky: stickyPositions[col_4._key]
|
|
322
|
-
}))
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
const
|
|
328
|
-
let summaryNode;
|
|
329
|
-
let t22;
|
|
330
|
-
if ($[61] !== paginatedData || $[62] !== summary) {
|
|
331
|
-
summaryNode = summary?.(paginatedData);
|
|
332
|
-
t22 = /*#__PURE__*/ isValidElement(summaryNode) && summaryNode.type === TableSummary && !!summaryNode.props.fixed;
|
|
333
|
-
$[61] = paginatedData;
|
|
334
|
-
$[62] = summary;
|
|
335
|
-
$[63] = summaryNode;
|
|
336
|
-
$[64] = t22;
|
|
337
|
-
} else {
|
|
338
|
-
summaryNode = $[63];
|
|
339
|
-
t22 = $[64];
|
|
340
|
-
}
|
|
341
|
-
const summaryFixed = t22;
|
|
226
|
+
})), [
|
|
227
|
+
allColumns,
|
|
228
|
+
stickyPositions
|
|
229
|
+
]);
|
|
230
|
+
const summaryNode = summary?.(paginatedData);
|
|
231
|
+
const summaryFixed = /*#__PURE__*/ isValidElement(summaryNode) && summaryNode.type === TableSummary && !!summaryNode.props.fixed;
|
|
342
232
|
const tableStyle = scroll?.x ? {
|
|
343
|
-
minWidth:
|
|
233
|
+
minWidth: 'number' == typeof scroll.x ? `${scroll.x}px` : scroll.x
|
|
344
234
|
} : {};
|
|
345
|
-
|
|
346
|
-
if ($[65] !== selectablePageKeys || $[66] !== selectedKeySet) {
|
|
347
|
-
let t24;
|
|
348
|
-
if ($[68] !== selectedKeySet) {
|
|
349
|
-
t24 = (key_2)=>selectedKeySet.has(key_2);
|
|
350
|
-
$[68] = selectedKeySet;
|
|
351
|
-
$[69] = t24;
|
|
352
|
-
} else t24 = $[69];
|
|
353
|
-
t23 = selectablePageKeys.filter(t24);
|
|
354
|
-
$[65] = selectablePageKeys;
|
|
355
|
-
$[66] = selectedKeySet;
|
|
356
|
-
$[67] = t23;
|
|
357
|
-
} else t23 = $[67];
|
|
358
|
-
const selectedPageCount = t23.length;
|
|
235
|
+
const selectedPageCount = selectablePageKeys.filter((key_2)=>selectedKeySet.has(key_2)).length;
|
|
359
236
|
const isAllSelected = selectablePageKeys.length > 0 && selectedPageCount === selectablePageKeys.length;
|
|
360
237
|
const isIndeterminate = selectedPageCount > 0 && !isAllSelected;
|
|
361
|
-
let t24;
|
|
362
|
-
if ($[70] !== loading) {
|
|
363
|
-
t24 = loading && /*#__PURE__*/ jsx(TableLoadingSpinner, {});
|
|
364
|
-
$[70] = loading;
|
|
365
|
-
$[71] = t24;
|
|
366
|
-
} else t24 = $[71];
|
|
367
|
-
const headerRowProps = onHeaderRow?.(columns, 0) ?? {};
|
|
368
|
-
let t25;
|
|
369
|
-
if ($[72] !== expandColWidth || $[73] !== expandable || $[74] !== stickyPositions) {
|
|
370
|
-
t25 = expandable && /*#__PURE__*/ jsx("th", {
|
|
371
|
-
"data-tao-table-cell": "",
|
|
372
|
-
"data-tao-table-expand-cell": "",
|
|
373
|
-
"data-tao-fixed": stickyPositions.__expand__ ? "left" : void 0,
|
|
374
|
-
style: {
|
|
375
|
-
width: expandColWidth,
|
|
376
|
-
...stickyStyle(stickyPositions.__expand__, 3)
|
|
377
|
-
}
|
|
378
|
-
});
|
|
379
|
-
$[72] = expandColWidth;
|
|
380
|
-
$[73] = expandable;
|
|
381
|
-
$[74] = stickyPositions;
|
|
382
|
-
$[75] = t25;
|
|
383
|
-
} else t25 = $[75];
|
|
384
|
-
const t26 = "";
|
|
385
|
-
const t27 = 0 === paginatedData.length ? /*#__PURE__*/ jsx("tr", {
|
|
386
|
-
children: /*#__PURE__*/ jsx("td", {
|
|
387
|
-
"data-tao-table-cell": "",
|
|
388
|
-
"data-tao-table-empty": "",
|
|
389
|
-
colSpan: allColumns.length,
|
|
390
|
-
className: resolvedClassNames.empty,
|
|
391
|
-
style: resolvedStyles.empty,
|
|
392
|
-
children: emptyText
|
|
393
|
-
})
|
|
394
|
-
}) : paginatedData.map((record_3, rowIdx)=>{
|
|
395
|
-
const key_3 = getRowKey(record_3, rowKey);
|
|
396
|
-
const isSelected = selectedKeySet.has(key_3);
|
|
397
|
-
const checkboxProps = rowSelection?.getCheckboxProps?.(record_3);
|
|
398
|
-
const rowProps = onRow?.(record_3, rowIdx) ?? {};
|
|
399
|
-
const rowExpandable = !!expandable && (expandable.rowExpandable?.(record_3) ?? true);
|
|
400
|
-
const isExpanded = rowExpandable && expandedKeySet.has(key_3);
|
|
401
|
-
return /*#__PURE__*/ jsxs(Fragment, {
|
|
402
|
-
children: [
|
|
403
|
-
/*#__PURE__*/ jsxs("tr", {
|
|
404
|
-
...rowProps,
|
|
405
|
-
"data-tao-table-row": "",
|
|
406
|
-
"data-tao-selected": isSelected || void 0,
|
|
407
|
-
onClick: (event)=>{
|
|
408
|
-
const selectionCell = event.target.closest("[data-tao-table-selection-cell]");
|
|
409
|
-
if (selectionCell && event.target !== selectionCell) return void event.stopPropagation();
|
|
410
|
-
rowProps.onClick?.(event);
|
|
411
|
-
if (rowExpandable && expandable?.expandRowByClick) toggleExpand(record_3, key_3);
|
|
412
|
-
},
|
|
413
|
-
className: cx(resolvedClassNames["body.row"], resolveRowClassName(rowClassName, record_3, rowIdx), rowProps.className),
|
|
414
|
-
style: {
|
|
415
|
-
...resolvedStyles["body.row"],
|
|
416
|
-
...resolveRowStyle(rowStyle, record_3, rowIdx),
|
|
417
|
-
...rowProps.style
|
|
418
|
-
},
|
|
419
|
-
children: [
|
|
420
|
-
expandable && /*#__PURE__*/ jsx("td", {
|
|
421
|
-
"data-tao-table-cell": "",
|
|
422
|
-
"data-tao-table-expand-cell": "",
|
|
423
|
-
"data-tao-fixed": stickyPositions.__expand__ ? "left" : void 0,
|
|
424
|
-
style: stickyStyle(stickyPositions.__expand__, 1),
|
|
425
|
-
children: rowExpandable && /*#__PURE__*/ jsx(ExpandIcon, {
|
|
426
|
-
expanded: isExpanded,
|
|
427
|
-
onClick: (e_0)=>{
|
|
428
|
-
e_0.stopPropagation();
|
|
429
|
-
toggleExpand(record_3, key_3);
|
|
430
|
-
}
|
|
431
|
-
})
|
|
432
|
-
}),
|
|
433
|
-
rowSelection && /*#__PURE__*/ jsx("td", {
|
|
434
|
-
"data-tao-table-cell": "",
|
|
435
|
-
"data-tao-table-selection-cell": "",
|
|
436
|
-
"data-tao-fixed": stickyPositions.__selection__ ? "left" : void 0,
|
|
437
|
-
className: resolvedClassNames["selection.cell"],
|
|
438
|
-
style: {
|
|
439
|
-
...stickyStyle(stickyPositions.__selection__, 1),
|
|
440
|
-
...resolvedStyles["selection.cell"]
|
|
441
|
-
},
|
|
442
|
-
children: "radio" === selectionType ? /*#__PURE__*/ jsx(Radio, {
|
|
443
|
-
checked: isSelected,
|
|
444
|
-
"aria-label": `Select row ${String(key_3)}`,
|
|
445
|
-
disabled: checkboxProps?.disabled ?? false,
|
|
446
|
-
onChange: ()=>handleSelectRow(key_3)
|
|
447
|
-
}) : /*#__PURE__*/ jsx(Checkbox, {
|
|
448
|
-
checked: isSelected,
|
|
449
|
-
"aria-label": `Select row ${String(key_3)}`,
|
|
450
|
-
disabled: checkboxProps?.disabled ?? false,
|
|
451
|
-
onChange: ()=>handleSelectRow(key_3)
|
|
452
|
-
})
|
|
453
|
-
}),
|
|
454
|
-
columns.map((col_6, colIdx)=>{
|
|
455
|
-
const colKey_0 = getColKey(col_6, colIdx);
|
|
456
|
-
const value = getCellValue(record_3, col_6.dataIndex);
|
|
457
|
-
const stickyPos_0 = stickyPositions[colKey_0];
|
|
458
|
-
const isFixed_0 = !!col_6.fixed && !!scroll?.x;
|
|
459
|
-
const cellProps = col_6.onCell?.(record_3, rowIdx) ?? {};
|
|
460
|
-
return /*#__PURE__*/ createElement("td", {
|
|
461
|
-
...cellProps,
|
|
462
|
-
key: colKey_0,
|
|
463
|
-
"data-tao-table-cell": "",
|
|
464
|
-
"data-tao-align": col_6.align,
|
|
465
|
-
"data-tao-ellipsis": col_6.ellipsis || void 0,
|
|
466
|
-
"data-tao-fixed": isFixed_0 ? col_6.fixed : void 0,
|
|
467
|
-
className: cx(resolvedClassNames["body.cell"], cellProps.className),
|
|
468
|
-
style: {
|
|
469
|
-
...resolvedStyles["body.cell"],
|
|
470
|
-
...stickyStyle(isFixed_0 ? stickyPos_0 : void 0, 1),
|
|
471
|
-
...cellProps.style
|
|
472
|
-
}
|
|
473
|
-
}, col_6.render ? col_6.render(value, record_3, rowIdx) : value);
|
|
474
|
-
})
|
|
475
|
-
]
|
|
476
|
-
}),
|
|
477
|
-
isExpanded && /*#__PURE__*/ jsx("tr", {
|
|
478
|
-
"data-tao-table-expanded-row": "",
|
|
479
|
-
className: resolvedClassNames.expandedRow,
|
|
480
|
-
style: resolvedStyles.expandedRow,
|
|
481
|
-
children: /*#__PURE__*/ jsx("td", {
|
|
482
|
-
"data-tao-table-cell": "",
|
|
483
|
-
colSpan: allColumns.length,
|
|
484
|
-
children: /*#__PURE__*/ jsx("div", {
|
|
485
|
-
"data-tao-table-expanded-content": "",
|
|
486
|
-
style: scroll?.x ? {
|
|
487
|
-
width: viewportWidth
|
|
488
|
-
} : void 0,
|
|
489
|
-
children: expandable.expandedRowRender(record_3, rowIdx)
|
|
490
|
-
})
|
|
491
|
-
})
|
|
492
|
-
})
|
|
493
|
-
]
|
|
494
|
-
}, key_3);
|
|
495
|
-
});
|
|
496
|
-
let t28;
|
|
497
|
-
if ($[76] !== t27) {
|
|
498
|
-
t28 = /*#__PURE__*/ jsx("tbody", {
|
|
499
|
-
"data-tao-table-tbody": t26,
|
|
500
|
-
children: t27
|
|
501
|
-
});
|
|
502
|
-
$[76] = t27;
|
|
503
|
-
$[77] = t28;
|
|
504
|
-
} else t28 = $[77];
|
|
505
|
-
let t29;
|
|
506
|
-
if ($[78] !== resolvedClassNames || $[79] !== resolvedStyles || $[80] !== summaryColumns || $[81] !== summaryFixed || $[82] !== summaryNode) {
|
|
507
|
-
t29 = null != summaryNode && /*#__PURE__*/ jsx("tfoot", {
|
|
508
|
-
"data-tao-table-summary": "",
|
|
509
|
-
"data-tao-summary-fixed": summaryFixed || void 0,
|
|
510
|
-
className: resolvedClassNames.summary,
|
|
511
|
-
style: resolvedStyles.summary,
|
|
512
|
-
children: /*#__PURE__*/ jsx(TableSummaryContext.Provider, {
|
|
513
|
-
value: summaryColumns,
|
|
514
|
-
children: summaryNode
|
|
515
|
-
})
|
|
516
|
-
});
|
|
517
|
-
$[78] = resolvedClassNames;
|
|
518
|
-
$[79] = resolvedStyles;
|
|
519
|
-
$[80] = summaryColumns;
|
|
520
|
-
$[81] = summaryFixed;
|
|
521
|
-
$[82] = summaryNode;
|
|
522
|
-
$[83] = t29;
|
|
523
|
-
} else t29 = $[83];
|
|
524
|
-
let t30;
|
|
525
|
-
if ($[84] !== resolvedClassNames || $[85] !== resolvedSize || $[86] !== resolvedStyles || $[87] !== tableData.pagination) {
|
|
526
|
-
t30 = tableData.pagination && tableData.pagination.total > 0 && /*#__PURE__*/ jsx("div", {
|
|
527
|
-
"data-tao-table-pagination": "",
|
|
528
|
-
className: resolvedClassNames.pagination,
|
|
529
|
-
style: resolvedStyles.pagination,
|
|
530
|
-
children: /*#__PURE__*/ jsx(Pagination, {
|
|
531
|
-
...tableData.pagination,
|
|
532
|
-
size: resolvedSize
|
|
533
|
-
})
|
|
534
|
-
});
|
|
535
|
-
$[84] = resolvedClassNames;
|
|
536
|
-
$[85] = resolvedSize;
|
|
537
|
-
$[86] = resolvedStyles;
|
|
538
|
-
$[87] = tableData.pagination;
|
|
539
|
-
$[88] = t30;
|
|
540
|
-
} else t30 = $[88];
|
|
541
238
|
return /*#__PURE__*/ jsxs("div", {
|
|
239
|
+
ref: directionRef,
|
|
542
240
|
"data-tao-table-wrapper": "",
|
|
241
|
+
"data-tao-direction": direction,
|
|
543
242
|
"data-tao-size": resolvedSize,
|
|
544
243
|
"data-tao-variant": resolvedVariant,
|
|
545
|
-
"data-tao-header-bg": headerBackground ? void 0 :
|
|
244
|
+
"data-tao-header-bg": headerBackground ? void 0 : 'off',
|
|
546
245
|
"data-tao-bordered": showBorder || void 0,
|
|
547
246
|
"data-tao-scroll-state": scroll?.x ? scrollState : void 0,
|
|
548
247
|
className: cx(resolvedClassNames.root, className),
|
|
@@ -551,10 +250,10 @@ function Table(t0) {
|
|
|
551
250
|
...style
|
|
552
251
|
},
|
|
553
252
|
children: [
|
|
554
|
-
|
|
253
|
+
loading && /*#__PURE__*/ jsx(TableLoadingSpinner, {}),
|
|
555
254
|
/*#__PURE__*/ jsx("div", {
|
|
556
255
|
"data-tao-table-scroll": "",
|
|
557
|
-
"data-tao-scroll-y": scroll?.y ?
|
|
256
|
+
"data-tao-scroll-y": scroll?.y ? '' : void 0,
|
|
558
257
|
ref: scrollRef,
|
|
559
258
|
onScroll: scroll?.x ? handleScroll : void 0,
|
|
560
259
|
className: resolvedClassNames.scroll,
|
|
@@ -572,104 +271,242 @@ function Table(t0) {
|
|
|
572
271
|
children: [
|
|
573
272
|
/*#__PURE__*/ jsx("thead", {
|
|
574
273
|
"data-tao-table-thead": "",
|
|
575
|
-
className: resolvedClassNames[
|
|
576
|
-
style: resolvedStyles[
|
|
577
|
-
children:
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
"data-tao-table-selection-cell": "",
|
|
589
|
-
"data-tao-fixed": stickyPositions.__selection__ ? "left" : void 0,
|
|
590
|
-
className: resolvedClassNames["selection.cell"],
|
|
591
|
-
style: {
|
|
592
|
-
width: selectionColWidth,
|
|
593
|
-
...stickyStyle(stickyPositions.__selection__, 3),
|
|
594
|
-
...resolvedStyles["selection.cell"]
|
|
595
|
-
},
|
|
596
|
-
children: "checkbox" === selectionType && /*#__PURE__*/ jsx(Checkbox, {
|
|
597
|
-
"aria-label": "Select all rows",
|
|
598
|
-
checked: isAllSelected,
|
|
599
|
-
disabled: 0 === selectablePageKeys.length,
|
|
600
|
-
indeterminate: isIndeterminate,
|
|
601
|
-
onChange: (e)=>handleSelectAll(e.target.checked)
|
|
602
|
-
})
|
|
603
|
-
}),
|
|
604
|
-
columns.map((col_5, i_1)=>{
|
|
605
|
-
const colKey = getColKey(col_5, i_1);
|
|
606
|
-
const hasSorter = !!col_5.sorter;
|
|
607
|
-
const hasFilter = !!(col_5.filters && col_5.filters.length > 0);
|
|
608
|
-
const { sortOrder: resolvedOrder, filteredValue: activeFilterValues, onSort, onFilter } = tableData.getColumnState(i_1);
|
|
609
|
-
const stickyPos = stickyPositions[colKey];
|
|
610
|
-
const isFixed = !!col_5.fixed && !!scroll?.x;
|
|
611
|
-
const headerCellProps = col_5.onHeaderCell?.(col_5) ?? {};
|
|
612
|
-
return /*#__PURE__*/ createElement("th", {
|
|
613
|
-
...headerCellProps,
|
|
614
|
-
key: colKey,
|
|
274
|
+
className: resolvedClassNames['header.wrapper'],
|
|
275
|
+
style: resolvedStyles['header.wrapper'],
|
|
276
|
+
children: (()=>{
|
|
277
|
+
const headerRowProps = onHeaderRow?.(columns, 0) ?? {};
|
|
278
|
+
return /*#__PURE__*/ jsxs("tr", {
|
|
279
|
+
...headerRowProps,
|
|
280
|
+
className: cx(resolvedClassNames['header.row'], headerRowProps.className),
|
|
281
|
+
style: {
|
|
282
|
+
...resolvedStyles['header.row'],
|
|
283
|
+
...headerRowProps.style
|
|
284
|
+
},
|
|
285
|
+
children: [
|
|
286
|
+
expandable && /*#__PURE__*/ jsx("th", {
|
|
615
287
|
"data-tao-table-cell": "",
|
|
616
|
-
"data-tao-table-
|
|
617
|
-
"data-tao-
|
|
618
|
-
"data-tao-fixed": isFixed ? col_5.fixed : void 0,
|
|
619
|
-
"aria-sort": hasSorter ? "ascend" === resolvedOrder ? "ascending" : "descend" === resolvedOrder ? "descending" : "none" : void 0,
|
|
620
|
-
className: cx(resolvedClassNames["header.cell"], headerCellProps.className),
|
|
288
|
+
"data-tao-table-expand-cell": "",
|
|
289
|
+
"data-tao-fixed": stickyPositions.__expand__ ? 'left' : void 0,
|
|
621
290
|
style: {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
...stickyStyle(isFixed ? stickyPos : void 0, 3),
|
|
625
|
-
...headerCellProps.style
|
|
291
|
+
width: expandColWidth,
|
|
292
|
+
...stickyStyle(stickyPositions.__expand__, 3)
|
|
626
293
|
}
|
|
627
|
-
},
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
294
|
+
}),
|
|
295
|
+
rowSelection && /*#__PURE__*/ jsx("th", {
|
|
296
|
+
"data-tao-table-cell": "",
|
|
297
|
+
"data-tao-table-selection-cell": "",
|
|
298
|
+
"data-tao-fixed": stickyPositions.__selection__ ? 'left' : void 0,
|
|
299
|
+
className: resolvedClassNames['selection.cell'],
|
|
300
|
+
style: {
|
|
301
|
+
width: selectionColWidth,
|
|
302
|
+
...stickyStyle(stickyPositions.__selection__, 3),
|
|
303
|
+
...resolvedStyles['selection.cell']
|
|
304
|
+
},
|
|
305
|
+
children: 'checkbox' === selectionType && /*#__PURE__*/ jsx(Checkbox, {
|
|
306
|
+
"aria-label": ctx.locale.messages.selectAllRows,
|
|
307
|
+
checked: isAllSelected,
|
|
308
|
+
disabled: 0 === selectablePageKeys.length,
|
|
309
|
+
indeterminate: isIndeterminate,
|
|
310
|
+
onChange: (e)=>handleSelectAll(e.target.checked)
|
|
311
|
+
})
|
|
312
|
+
}),
|
|
313
|
+
columns.map((col_5, i_1)=>{
|
|
314
|
+
const colKey = getColKey(col_5, i_1);
|
|
315
|
+
const hasSorter = !!col_5.sorter;
|
|
316
|
+
const hasFilter = !!(col_5.filters && col_5.filters.length > 0);
|
|
317
|
+
const { sortOrder: resolvedOrder, filteredValue: activeFilterValues, onSort, onFilter } = tableData.getColumnState(i_1);
|
|
318
|
+
const stickyPos = stickyPositions[colKey];
|
|
319
|
+
const isFixed = !!col_5.fixed && !!scroll?.x;
|
|
320
|
+
const headerCellProps = col_5.onHeaderCell?.(col_5) ?? {};
|
|
321
|
+
return /*#__PURE__*/ createElement("th", {
|
|
322
|
+
...headerCellProps,
|
|
323
|
+
key: colKey,
|
|
324
|
+
"data-tao-table-cell": "",
|
|
325
|
+
"data-tao-table-header": "",
|
|
326
|
+
"data-tao-align": col_5.align,
|
|
327
|
+
"data-tao-fixed": isFixed ? col_5.fixed : void 0,
|
|
328
|
+
"aria-sort": hasSorter ? 'ascend' === resolvedOrder ? 'ascending' : 'descend' === resolvedOrder ? 'descending' : 'none' : void 0,
|
|
329
|
+
className: cx(resolvedClassNames['header.cell'], headerCellProps.className),
|
|
330
|
+
style: {
|
|
331
|
+
...resolvedStyles['header.cell'],
|
|
332
|
+
width: col_5.width,
|
|
333
|
+
...stickyStyle(isFixed ? stickyPos : void 0, 3),
|
|
334
|
+
...headerCellProps.style
|
|
335
|
+
}
|
|
336
|
+
}, /*#__PURE__*/ jsxs("div", {
|
|
337
|
+
"data-tao-table-header-content": "",
|
|
338
|
+
className: resolvedClassNames['header.content'],
|
|
339
|
+
style: resolvedStyles['header.content'],
|
|
340
|
+
children: [
|
|
341
|
+
hasSorter ? /*#__PURE__*/ jsxs("button", {
|
|
342
|
+
type: "button",
|
|
343
|
+
"data-tao-table-header-title": "",
|
|
344
|
+
"data-tao-sortable": "",
|
|
345
|
+
className: resolvedClassNames['header.title'],
|
|
346
|
+
style: resolvedStyles['header.title'],
|
|
347
|
+
onClick: onSort,
|
|
348
|
+
children: [
|
|
349
|
+
col_5.title,
|
|
350
|
+
/*#__PURE__*/ jsx(SortIcon, {
|
|
351
|
+
order: resolvedOrder
|
|
352
|
+
})
|
|
353
|
+
]
|
|
354
|
+
}) : /*#__PURE__*/ jsx("span", {
|
|
355
|
+
"data-tao-table-header-title": "",
|
|
356
|
+
className: resolvedClassNames['header.title'],
|
|
357
|
+
style: resolvedStyles['header.title'],
|
|
358
|
+
children: col_5.title
|
|
359
|
+
}),
|
|
360
|
+
hasFilter && /*#__PURE__*/ jsx(TableFilterDropdown, {
|
|
361
|
+
filters: col_5.filters,
|
|
362
|
+
activeValues: activeFilterValues,
|
|
363
|
+
onSelect: onFilter
|
|
364
|
+
})
|
|
365
|
+
]
|
|
366
|
+
}));
|
|
367
|
+
})
|
|
368
|
+
]
|
|
369
|
+
});
|
|
370
|
+
})()
|
|
371
|
+
}),
|
|
372
|
+
/*#__PURE__*/ jsx("tbody", {
|
|
373
|
+
"data-tao-table-tbody": "",
|
|
374
|
+
children: 0 === paginatedData.length ? /*#__PURE__*/ jsx("tr", {
|
|
375
|
+
children: /*#__PURE__*/ jsx("td", {
|
|
376
|
+
"data-tao-table-cell": "",
|
|
377
|
+
"data-tao-table-empty": "",
|
|
378
|
+
colSpan: allColumns.length,
|
|
379
|
+
className: resolvedClassNames.empty,
|
|
380
|
+
style: resolvedStyles.empty,
|
|
381
|
+
children: emptyText
|
|
382
|
+
})
|
|
383
|
+
}) : paginatedData.map((record_3, rowIdx)=>{
|
|
384
|
+
const key_3 = getRowKey(record_3, rowKey);
|
|
385
|
+
const isSelected = selectedKeySet.has(key_3);
|
|
386
|
+
const checkboxProps = rowSelection?.getCheckboxProps?.(record_3);
|
|
387
|
+
const rowProps = onRow?.(record_3, rowIdx) ?? {};
|
|
388
|
+
const rowExpandable = !!expandable && (expandable.rowExpandable?.(record_3) ?? true);
|
|
389
|
+
const isExpanded = rowExpandable && expandedKeySet.has(key_3);
|
|
390
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
391
|
+
children: [
|
|
392
|
+
/*#__PURE__*/ jsxs("tr", {
|
|
393
|
+
...rowProps,
|
|
394
|
+
"data-tao-table-row": "",
|
|
395
|
+
"data-tao-selected": isSelected || void 0,
|
|
396
|
+
onClick: (event)=>{
|
|
397
|
+
const selectionCell = event.target.closest('[data-tao-table-selection-cell]');
|
|
398
|
+
if (selectionCell && event.target !== selectionCell) return void event.stopPropagation();
|
|
399
|
+
rowProps.onClick?.(event);
|
|
400
|
+
if (rowExpandable && expandable?.expandRowByClick) toggleExpand(record_3, key_3);
|
|
401
|
+
},
|
|
402
|
+
className: cx(resolvedClassNames['body.row'], resolveRowClassName(rowClassName, record_3, rowIdx), rowProps.className),
|
|
403
|
+
style: {
|
|
404
|
+
...resolvedStyles['body.row'],
|
|
405
|
+
...resolveRowStyle(rowStyle, record_3, rowIdx),
|
|
406
|
+
...rowProps.style
|
|
407
|
+
},
|
|
631
408
|
children: [
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
"data-tao-table-
|
|
635
|
-
"data-tao-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
"data-tao-table-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
409
|
+
expandable && /*#__PURE__*/ jsx("td", {
|
|
410
|
+
"data-tao-table-cell": "",
|
|
411
|
+
"data-tao-table-expand-cell": "",
|
|
412
|
+
"data-tao-fixed": stickyPositions.__expand__ ? 'left' : void 0,
|
|
413
|
+
style: stickyStyle(stickyPositions.__expand__, 1),
|
|
414
|
+
children: rowExpandable && /*#__PURE__*/ jsx(ExpandIcon, {
|
|
415
|
+
expanded: isExpanded,
|
|
416
|
+
onClick: (e_0)=>{
|
|
417
|
+
e_0.stopPropagation();
|
|
418
|
+
toggleExpand(record_3, key_3);
|
|
419
|
+
}
|
|
420
|
+
})
|
|
421
|
+
}),
|
|
422
|
+
rowSelection && /*#__PURE__*/ jsx("td", {
|
|
423
|
+
"data-tao-table-cell": "",
|
|
424
|
+
"data-tao-table-selection-cell": "",
|
|
425
|
+
"data-tao-fixed": stickyPositions.__selection__ ? 'left' : void 0,
|
|
426
|
+
className: resolvedClassNames['selection.cell'],
|
|
427
|
+
style: {
|
|
428
|
+
...stickyStyle(stickyPositions.__selection__, 1),
|
|
429
|
+
...resolvedStyles['selection.cell']
|
|
430
|
+
},
|
|
431
|
+
children: 'radio' === selectionType ? /*#__PURE__*/ jsx(Radio, {
|
|
432
|
+
checked: isSelected,
|
|
433
|
+
"aria-label": ctx.locale.messages.selectRow(String(key_3)),
|
|
434
|
+
disabled: checkboxProps?.disabled ?? false,
|
|
435
|
+
onChange: ()=>handleSelectRow(key_3)
|
|
436
|
+
}) : /*#__PURE__*/ jsx(Checkbox, {
|
|
437
|
+
checked: isSelected,
|
|
438
|
+
"aria-label": ctx.locale.messages.selectRow(String(key_3)),
|
|
439
|
+
disabled: checkboxProps?.disabled ?? false,
|
|
440
|
+
onChange: ()=>handleSelectRow(key_3)
|
|
441
|
+
})
|
|
650
442
|
}),
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
443
|
+
columns.map((col_6, colIdx)=>{
|
|
444
|
+
const colKey_0 = getColKey(col_6, colIdx);
|
|
445
|
+
const value = getCellValue(record_3, col_6.dataIndex);
|
|
446
|
+
const stickyPos_0 = stickyPositions[colKey_0];
|
|
447
|
+
const isFixed_0 = !!col_6.fixed && !!scroll?.x;
|
|
448
|
+
const cellProps = col_6.onCell?.(record_3, rowIdx) ?? {};
|
|
449
|
+
return /*#__PURE__*/ createElement("td", {
|
|
450
|
+
...cellProps,
|
|
451
|
+
key: colKey_0,
|
|
452
|
+
"data-tao-table-cell": "",
|
|
453
|
+
"data-tao-align": col_6.align,
|
|
454
|
+
"data-tao-ellipsis": col_6.ellipsis || void 0,
|
|
455
|
+
"data-tao-fixed": isFixed_0 ? col_6.fixed : void 0,
|
|
456
|
+
className: cx(resolvedClassNames['body.cell'], cellProps.className),
|
|
457
|
+
style: {
|
|
458
|
+
...resolvedStyles['body.cell'],
|
|
459
|
+
...stickyStyle(isFixed_0 ? stickyPos_0 : void 0, 1),
|
|
460
|
+
...cellProps.style
|
|
461
|
+
}
|
|
462
|
+
}, col_6.render ? col_6.render(value, record_3, rowIdx) : value);
|
|
655
463
|
})
|
|
656
464
|
]
|
|
657
|
-
})
|
|
658
|
-
|
|
659
|
-
|
|
465
|
+
}),
|
|
466
|
+
isExpanded && /*#__PURE__*/ jsx("tr", {
|
|
467
|
+
"data-tao-table-expanded-row": "",
|
|
468
|
+
className: resolvedClassNames.expandedRow,
|
|
469
|
+
style: resolvedStyles.expandedRow,
|
|
470
|
+
children: /*#__PURE__*/ jsx("td", {
|
|
471
|
+
"data-tao-table-cell": "",
|
|
472
|
+
colSpan: allColumns.length,
|
|
473
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
474
|
+
"data-tao-table-expanded-content": "",
|
|
475
|
+
style: scroll?.x ? {
|
|
476
|
+
width: viewportWidth
|
|
477
|
+
} : void 0,
|
|
478
|
+
children: expandable.expandedRowRender(record_3, rowIdx)
|
|
479
|
+
})
|
|
480
|
+
})
|
|
481
|
+
})
|
|
482
|
+
]
|
|
483
|
+
}, key_3);
|
|
660
484
|
})
|
|
661
485
|
}),
|
|
662
|
-
|
|
663
|
-
|
|
486
|
+
null != summaryNode && /*#__PURE__*/ jsx("tfoot", {
|
|
487
|
+
"data-tao-table-summary": "",
|
|
488
|
+
"data-tao-summary-fixed": summaryFixed || void 0,
|
|
489
|
+
className: resolvedClassNames.summary,
|
|
490
|
+
style: resolvedStyles.summary,
|
|
491
|
+
children: /*#__PURE__*/ jsx(TableSummaryContext.Provider, {
|
|
492
|
+
value: summaryColumns,
|
|
493
|
+
children: summaryNode
|
|
494
|
+
})
|
|
495
|
+
})
|
|
664
496
|
]
|
|
665
497
|
})
|
|
666
498
|
}),
|
|
667
|
-
|
|
499
|
+
tableData.pagination && tableData.pagination.total > 0 && /*#__PURE__*/ jsx("div", {
|
|
500
|
+
"data-tao-table-pagination": "",
|
|
501
|
+
className: resolvedClassNames.pagination,
|
|
502
|
+
style: resolvedStyles.pagination,
|
|
503
|
+
children: /*#__PURE__*/ jsx(Pagination, {
|
|
504
|
+
...tableData.pagination,
|
|
505
|
+
size: resolvedSize
|
|
506
|
+
})
|
|
507
|
+
})
|
|
668
508
|
]
|
|
669
509
|
});
|
|
670
510
|
}
|
|
671
|
-
function _temp(col_0) {
|
|
672
|
-
return col_0.responsive;
|
|
673
|
-
}
|
|
674
511
|
Table.Summary = TableSummary;
|
|
675
512
|
export { Table };
|