@rockshin/tao-ui 0.0.31 → 0.0.33
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 +14 -3
- package/dist/components/alert/alert.js +1 -1
- package/dist/components/breadcrumb/breadcrumb.js +1 -1
- package/dist/components/button/button.d.ts +2 -2
- package/dist/components/button/button.js +48 -50
- package/dist/components/checkbox/checkbox.css +5 -1
- package/dist/components/checkbox/checkbox.d.ts +2 -2
- package/dist/components/checkbox/checkbox.js +135 -120
- package/dist/components/collapsible/collapsible.js +1 -1
- package/dist/components/context-menu/context-menu.js +1 -1
- package/dist/components/date-picker/calendar/calendar-header.js +1 -1
- package/dist/components/date-picker/calendar/month-grid.d.ts +3 -1
- package/dist/components/date-picker/calendar/month-grid.js +19 -17
- package/dist/components/date-picker/calendar/time-panel.js +1 -1
- package/dist/components/date-picker/calendar/year-grid.d.ts +3 -1
- package/dist/components/date-picker/calendar/year-grid.js +28 -24
- package/dist/components/date-picker/date-picker.d.ts +1 -1
- package/dist/components/date-picker/date-picker.js +37 -24
- package/dist/components/date-picker/presets.js +1 -1
- package/dist/components/date-picker/range-picker.d.ts +1 -1
- package/dist/components/date-picker/range-picker.js +104 -56
- package/dist/components/drawer/drawer.d.ts +1 -1
- package/dist/components/drawer/drawer.js +98 -91
- package/dist/components/dropdown/dropdown.js +84 -84
- package/dist/components/form/form-item.js +8 -4
- package/dist/components/form/form.js +1 -1
- package/dist/components/form-actions/form-actions.js +1 -1
- package/dist/components/form-field/form-field-view.js +58 -51
- package/dist/components/form-field/form-field.js +1 -1
- package/dist/components/form-section/form-section.js +1 -1
- package/dist/components/input/input.js +42 -39
- package/dist/components/input-number/input-number.d.ts +2 -2
- package/dist/components/input-number/input-number.js +57 -59
- package/dist/components/menu/menu-render.js +1 -1
- package/dist/components/modal/confirm-dialog.d.ts +2 -1
- package/dist/components/modal/confirm-dialog.js +25 -5
- package/dist/components/modal/confirm.js +15 -3
- package/dist/components/modal/modal.d.ts +1 -1
- package/dist/components/modal/modal.js +131 -132
- package/dist/components/modal/use-modal.js +48 -35
- package/dist/components/pagination/pagination.js +3 -1
- package/dist/components/popconfirm/popconfirm.js +1 -1
- package/dist/components/popover/popover.js +253 -228
- package/dist/components/radio/radio.css +2 -2
- package/dist/components/radio/radio.d.ts +1 -1
- package/dist/components/radio/radio.js +7 -7
- package/dist/components/scroll-area/scroll-area.css +2 -2
- package/dist/components/scroll-area/scroll-area.js +187 -165
- package/dist/components/select/mobile-select.d.ts +2 -1
- package/dist/components/select/mobile-select.js +12 -6
- package/dist/components/select/select-icons.js +1 -1
- package/dist/components/select/select-searchable-list.d.ts +1 -1
- package/dist/components/select/select-searchable-list.js +35 -21
- package/dist/components/select/select-tags.js +1 -1
- package/dist/components/select/select-types.d.ts +2 -2
- package/dist/components/select/select.css +4 -0
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/select.js +127 -73
- package/dist/components/sonner/sonner.js +6 -5
- package/dist/components/spinner/spinner.js +1 -1
- package/dist/components/splitter/splitter.js +187 -194
- package/dist/components/status-icon/status-icon.js +1 -1
- package/dist/components/switch/switch.d.ts +1 -1
- package/dist/components/switch/switch.js +6 -6
- package/dist/components/table/table-filter.js +1 -1
- package/dist/components/table/table-icons.js +1 -1
- package/dist/components/table/table.js +483 -599
- package/dist/components/tabs/tabs.js +179 -161
- package/dist/components/tag/tag.js +1 -1
- package/dist/components/textarea/textarea.d.ts +1 -1
- package/dist/components/textarea/textarea.js +142 -108
- package/dist/components/tooltip/tooltip.js +88 -72
- package/dist/entries/alert.d.ts +3 -0
- package/dist/entries/alert.js +4 -0
- package/dist/entries/breadcrumb.d.ts +3 -0
- package/dist/entries/breadcrumb.js +4 -0
- package/dist/entries/button.d.ts +3 -0
- package/dist/entries/button.js +4 -0
- package/dist/entries/checkbox.d.ts +3 -0
- package/dist/entries/checkbox.js +4 -0
- package/dist/entries/collapsible.d.ts +3 -0
- package/dist/entries/collapsible.js +4 -0
- package/dist/entries/context-menu.d.ts +3 -0
- package/dist/entries/context-menu.js +4 -0
- package/dist/entries/date-picker.d.ts +3 -0
- package/dist/entries/date-picker.js +4 -0
- package/dist/entries/drawer.d.ts +3 -0
- package/dist/entries/drawer.js +4 -0
- package/dist/entries/dropdown.d.ts +3 -0
- package/dist/entries/dropdown.js +4 -0
- package/dist/entries/form-actions.d.ts +3 -0
- package/dist/entries/form-actions.js +4 -0
- package/dist/entries/form-field.d.ts +3 -0
- package/dist/entries/form-field.js +4 -0
- package/dist/entries/form-layout.d.ts +3 -0
- package/dist/entries/form-layout.js +4 -0
- package/dist/entries/form-section.d.ts +3 -0
- package/dist/entries/form-section.js +4 -0
- package/dist/entries/form.d.ts +4 -0
- package/dist/entries/form.js +4 -0
- package/dist/entries/input-number.d.ts +3 -0
- package/dist/entries/input-number.js +4 -0
- package/dist/entries/input.d.ts +3 -0
- package/dist/entries/input.js +4 -0
- package/dist/entries/modal.d.ts +3 -0
- package/dist/entries/modal.js +4 -0
- package/dist/entries/number-input.d.ts +3 -0
- package/dist/entries/number-input.js +4 -0
- package/dist/entries/pagination.d.ts +3 -0
- package/dist/entries/pagination.js +4 -0
- package/dist/entries/popconfirm.d.ts +3 -0
- package/dist/entries/popconfirm.js +4 -0
- package/dist/entries/popover.d.ts +3 -0
- package/dist/entries/popover.js +4 -0
- package/dist/entries/provider.d.ts +3 -0
- package/dist/entries/provider.js +4 -0
- package/dist/entries/radio.d.ts +3 -0
- package/dist/entries/radio.js +4 -0
- package/dist/entries/range-picker.d.ts +3 -0
- package/dist/entries/range-picker.js +4 -0
- package/dist/entries/scroll-area.d.ts +3 -0
- package/dist/entries/scroll-area.js +4 -0
- package/dist/entries/select.d.ts +3 -0
- package/dist/entries/select.js +4 -0
- package/dist/entries/sonner.d.ts +3 -0
- package/dist/entries/sonner.js +4 -0
- package/dist/entries/spinner.d.ts +3 -0
- package/dist/entries/spinner.js +4 -0
- package/dist/entries/splitter.d.ts +3 -0
- package/dist/entries/splitter.js +4 -0
- package/dist/entries/stack.d.ts +3 -0
- package/dist/entries/stack.js +4 -0
- package/dist/entries/switch.d.ts +3 -0
- package/dist/entries/switch.js +4 -0
- package/dist/entries/table.d.ts +3 -0
- package/dist/entries/table.js +4 -0
- package/dist/entries/tabs.d.ts +3 -0
- package/dist/entries/tabs.js +4 -0
- package/dist/entries/tag.d.ts +3 -0
- package/dist/entries/tag.js +4 -0
- package/dist/entries/textarea.d.ts +3 -0
- package/dist/entries/textarea.js +4 -0
- package/dist/entries/tooltip.d.ts +3 -0
- package/dist/entries/tooltip.js +4 -0
- package/dist/layouts/form-layout/form-layout.js +1 -1
- package/dist/layouts/stack/stack.js +1 -1
- package/dist/number-input/number-input.js +1 -1
- package/dist/number-input/use-number-input.d.ts +2 -2
- package/dist/number-input/use-number-input.js +224 -131
- package/dist/number-input/validate.js +7 -2
- package/dist/provider/tao-provider.js +1 -1
- package/dist/utils/dialog-content.d.ts +10 -0
- package/dist/utils/dialog-content.js +222 -0
- package/dist/utils/overlay.d.ts +2 -2
- package/dist/utils/overlay.js +8 -3
- package/dist/utils/refs.js +17 -2
- package/llms.txt +5 -3
- package/package.json +21 -8
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createElement, useEffect, useRef, useState } from "react";
|
|
3
|
-
import { c as compiler_runtime_c } from "react/compiler-runtime";
|
|
2
|
+
import { createElement, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
3
|
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
5
4
|
import { useBreakpoint } from "../../utils/breakpoint.js";
|
|
6
5
|
import { cx } from "../../utils/semantic.js";
|
|
@@ -9,26 +8,16 @@ import { TableFilterDropdown } from "./table-filter.js";
|
|
|
9
8
|
import { SortIcon, TableLoadingSpinner } from "./table-icons.js";
|
|
10
9
|
import { getCellValue, getColKey, getRowKey, nextSortOrder, resolveRowClassName, resolveRowStyle, resolveSemanticClassNames, resolveSemanticStyles } from "./table-model.js";
|
|
11
10
|
import "./table.css";
|
|
12
|
-
function Table(
|
|
13
|
-
const $ = compiler_runtime_c(99);
|
|
14
|
-
const { columns: columnsProp, 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;
|
|
15
|
-
const loading = void 0 === t1 ? false : t1;
|
|
16
|
-
const headerBackground = void 0 === t2 ? true : t2;
|
|
17
|
-
const emptyText = void 0 === t3 ? "No Data" : t3;
|
|
18
|
-
const bordered = void 0 === t4 ? false : t4;
|
|
11
|
+
function Table({ columns: columnsProp, dataSource, rowKey, loading = false, pagination: paginationProp, onChange, scroll, rowSelection, size, variant, headerBackground = true, emptyText = 'No Data', bordered = false, className, style, classNames, styles, rowClassName, rowStyle, onRow, onHeaderRow }) {
|
|
19
12
|
const ctx = useTaoConfig();
|
|
20
13
|
const resolvedSize = size ?? ctx.size;
|
|
21
14
|
const screens = useBreakpoint();
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} else t5 = $[2];
|
|
29
|
-
const columns = t5;
|
|
30
|
-
const resolvedVariant = variant ?? ("outlined" === ctx.variant ? "modern" : ctx.variant);
|
|
31
|
-
const showBorder = "outlined" === resolvedVariant || "modern" === resolvedVariant || bordered && "borderless" !== resolvedVariant;
|
|
15
|
+
const columns = useMemo(()=>columnsProp.some((col_0)=>col_0.responsive) ? columnsProp.filter((col)=>!col.responsive || col.responsive.some((bp)=>screens[bp])) : columnsProp, [
|
|
16
|
+
columnsProp,
|
|
17
|
+
screens
|
|
18
|
+
]);
|
|
19
|
+
const resolvedVariant = variant ?? ('outlined' === ctx.variant ? 'modern' : ctx.variant);
|
|
20
|
+
const showBorder = 'outlined' === resolvedVariant || 'modern' === resolvedVariant || bordered && 'borderless' !== resolvedVariant;
|
|
32
21
|
const semanticProps = {
|
|
33
22
|
columns,
|
|
34
23
|
dataSource,
|
|
@@ -54,519 +43,319 @@ function Table(t0) {
|
|
|
54
43
|
};
|
|
55
44
|
const resolvedClassNames = resolveSemanticClassNames(classNames, semanticProps);
|
|
56
45
|
const resolvedStyles = resolveSemanticStyles(styles, semanticProps);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
let t7;
|
|
60
|
-
if ($[3] !== columns) {
|
|
61
|
-
defaultSortCol = columns.find(_temp2);
|
|
62
|
-
t6 = useState;
|
|
63
|
-
t7 = defaultSortCol ? getColKey(defaultSortCol, columns.indexOf(defaultSortCol)) : null;
|
|
64
|
-
$[3] = columns;
|
|
65
|
-
$[4] = defaultSortCol;
|
|
66
|
-
$[5] = t6;
|
|
67
|
-
$[6] = t7;
|
|
68
|
-
} else {
|
|
69
|
-
defaultSortCol = $[4];
|
|
70
|
-
t6 = $[5];
|
|
71
|
-
t7 = $[6];
|
|
72
|
-
}
|
|
73
|
-
const [sortKey, setSortKey] = t6(t7);
|
|
46
|
+
const defaultSortCol = columns.find((c)=>c.defaultSortOrder);
|
|
47
|
+
const [sortKey, setSortKey] = useState(defaultSortCol ? getColKey(defaultSortCol, columns.indexOf(defaultSortCol)) : null);
|
|
74
48
|
const [sortOrder, setSortOrder] = useState(defaultSortCol?.defaultSortOrder ?? null);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
const key = getColKey(col_1, i);
|
|
83
|
-
init[key] = col_1.filteredValue ?? [];
|
|
84
|
-
}
|
|
49
|
+
const [filterValues, setFilterValues] = useState(()=>{
|
|
50
|
+
const init = {};
|
|
51
|
+
for(let i = 0; i < columns.length; i++){
|
|
52
|
+
const col_1 = columns[i];
|
|
53
|
+
if (col_1.filters) {
|
|
54
|
+
const key = getColKey(col_1, i);
|
|
55
|
+
init[key] = col_1.filteredValue ?? [];
|
|
85
56
|
}
|
|
86
|
-
|
|
57
|
+
}
|
|
58
|
+
return init;
|
|
59
|
+
});
|
|
60
|
+
const resolvedSort = useMemo(()=>{
|
|
61
|
+
for(let i_0 = 0; i_0 < columns.length; i_0++){
|
|
62
|
+
const col_2 = columns[i_0];
|
|
63
|
+
const key_0 = getColKey(col_2, i_0);
|
|
64
|
+
const order = void 0 !== col_2.sortOrder ? col_2.sortOrder : sortKey === key_0 ? sortOrder : null;
|
|
65
|
+
if (order) return {
|
|
66
|
+
key: key_0,
|
|
67
|
+
order
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
key: null,
|
|
72
|
+
order: null
|
|
87
73
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
74
|
+
}, [
|
|
75
|
+
columns,
|
|
76
|
+
sortKey,
|
|
77
|
+
sortOrder
|
|
78
|
+
]);
|
|
79
|
+
const resolvedFilterValues = useMemo(()=>{
|
|
80
|
+
const values = {
|
|
81
|
+
...filterValues
|
|
82
|
+
};
|
|
83
|
+
for(let i_1 = 0; i_1 < columns.length; i_1++){
|
|
84
|
+
const col_3 = columns[i_1];
|
|
85
|
+
if (void 0 !== col_3.filteredValue) values[getColKey(col_3, i_1)] = col_3.filteredValue;
|
|
86
|
+
}
|
|
87
|
+
return values;
|
|
88
|
+
}, [
|
|
89
|
+
columns,
|
|
90
|
+
filterValues
|
|
91
|
+
]);
|
|
92
92
|
const hasPagination = false !== paginationProp;
|
|
93
93
|
const paginationConfig = false === paginationProp ? void 0 : paginationProp;
|
|
94
94
|
const [internalPage, setInternalPage] = useState(paginationConfig?.defaultCurrent ?? 1);
|
|
95
95
|
const [internalPageSize, setInternalPageSize] = useState(paginationConfig?.defaultPageSize ?? paginationConfig?.pageSize ?? 10);
|
|
96
96
|
const currentPage = paginationConfig?.current ?? internalPage;
|
|
97
97
|
const pageSize = paginationConfig?.pageSize ?? internalPageSize;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (!key_0 || !order) return {
|
|
102
|
-
order: null
|
|
103
|
-
};
|
|
104
|
-
const colIdx = columns.findIndex((c_0, i_0)=>getColKey(c_0, i_0) === key_0);
|
|
105
|
-
const col_2 = columns[colIdx];
|
|
106
|
-
return {
|
|
107
|
-
column: col_2,
|
|
108
|
-
order,
|
|
109
|
-
field: col_2?.dataIndex
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
$[9] = columns;
|
|
113
|
-
$[10] = t9;
|
|
114
|
-
} else t9 = $[10];
|
|
115
|
-
const buildSorterResult = t9;
|
|
116
|
-
let t10;
|
|
117
|
-
if ($[11] !== columns) {
|
|
118
|
-
t10 = (fv)=>{
|
|
119
|
-
const result = {};
|
|
120
|
-
for(let i_1 = 0; i_1 < columns.length; i_1++){
|
|
121
|
-
const col_3 = columns[i_1];
|
|
122
|
-
if (col_3.filters) {
|
|
123
|
-
const key_1 = getColKey(col_3, i_1);
|
|
124
|
-
const vals = fv[key_1];
|
|
125
|
-
result[null == col_3.dataIndex ? key_1 : String(col_3.dataIndex)] = vals && vals.length > 0 ? vals : null;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return result;
|
|
98
|
+
const buildSorterResult = useCallback((key_1, order_0)=>{
|
|
99
|
+
if (!key_1 || !order_0) return {
|
|
100
|
+
order: null
|
|
129
101
|
};
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
t11 = (page, ps, sk, so, fv_0)=>{
|
|
137
|
-
onChange?.({
|
|
138
|
-
current: page,
|
|
139
|
-
pageSize: ps
|
|
140
|
-
}, buildFiltersRecord(fv_0), buildSorterResult(sk, so));
|
|
102
|
+
const colIdx = columns.findIndex((c_0, i_2)=>getColKey(c_0, i_2) === key_1);
|
|
103
|
+
const col_4 = columns[colIdx];
|
|
104
|
+
return {
|
|
105
|
+
column: col_4,
|
|
106
|
+
order: order_0,
|
|
107
|
+
field: col_4?.dataIndex
|
|
141
108
|
};
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
t14 = (page_0, ps_0)=>{
|
|
189
|
-
setInternalPage(page_0);
|
|
190
|
-
setInternalPageSize(ps_0);
|
|
191
|
-
triggerChange(page_0, ps_0, sortKey, sortOrder, filterValues);
|
|
109
|
+
}, [
|
|
110
|
+
columns
|
|
111
|
+
]);
|
|
112
|
+
const buildFiltersRecord = useCallback((fv)=>{
|
|
113
|
+
const result = {};
|
|
114
|
+
for(let i_3 = 0; i_3 < columns.length; i_3++){
|
|
115
|
+
const col_5 = columns[i_3];
|
|
116
|
+
if (col_5.filters) {
|
|
117
|
+
const key_2 = getColKey(col_5, i_3);
|
|
118
|
+
const vals = fv[key_2];
|
|
119
|
+
result[null == col_5.dataIndex ? key_2 : String(col_5.dataIndex)] = vals && vals.length > 0 ? vals : null;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return result;
|
|
123
|
+
}, [
|
|
124
|
+
columns
|
|
125
|
+
]);
|
|
126
|
+
const triggerChange = useCallback((page, ps, sk, so, fv_0)=>{
|
|
127
|
+
onChange?.({
|
|
128
|
+
current: page,
|
|
129
|
+
pageSize: ps
|
|
130
|
+
}, buildFiltersRecord(fv_0), buildSorterResult(sk, so));
|
|
131
|
+
}, [
|
|
132
|
+
onChange,
|
|
133
|
+
buildFiltersRecord,
|
|
134
|
+
buildSorterResult
|
|
135
|
+
]);
|
|
136
|
+
const handleSort = useCallback((colKey, col_6)=>{
|
|
137
|
+
if (void 0 !== col_6.sortOrder) return void triggerChange(currentPage, pageSize, colKey, nextSortOrder(col_6.sortOrder), resolvedFilterValues);
|
|
138
|
+
const next = sortKey === colKey ? nextSortOrder(sortOrder) : 'ascend';
|
|
139
|
+
const newKey = null === next ? null : colKey;
|
|
140
|
+
setSortKey(newKey);
|
|
141
|
+
setSortOrder(next);
|
|
142
|
+
triggerChange(currentPage, pageSize, newKey, next, resolvedFilterValues);
|
|
143
|
+
}, [
|
|
144
|
+
sortKey,
|
|
145
|
+
sortOrder,
|
|
146
|
+
currentPage,
|
|
147
|
+
pageSize,
|
|
148
|
+
resolvedFilterValues,
|
|
149
|
+
triggerChange
|
|
150
|
+
]);
|
|
151
|
+
const handleFilter = useCallback((colKey_0, values_0)=>{
|
|
152
|
+
const next_0 = {
|
|
153
|
+
...resolvedFilterValues,
|
|
154
|
+
[colKey_0]: values_0
|
|
192
155
|
};
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
156
|
+
setFilterValues(next_0);
|
|
157
|
+
setInternalPage(1);
|
|
158
|
+
triggerChange(1, pageSize, resolvedSort.key, resolvedSort.order, next_0);
|
|
159
|
+
}, [
|
|
160
|
+
resolvedFilterValues,
|
|
161
|
+
pageSize,
|
|
162
|
+
resolvedSort,
|
|
163
|
+
triggerChange
|
|
164
|
+
]);
|
|
165
|
+
const handlePageChange = useCallback((page_0, ps_0)=>{
|
|
166
|
+
setInternalPage(page_0);
|
|
167
|
+
setInternalPageSize(ps_0);
|
|
168
|
+
triggerChange(page_0, ps_0, resolvedSort.key, resolvedSort.order, resolvedFilterValues);
|
|
169
|
+
}, [
|
|
170
|
+
resolvedSort,
|
|
171
|
+
resolvedFilterValues,
|
|
172
|
+
triggerChange
|
|
173
|
+
]);
|
|
174
|
+
const processedData = useMemo(()=>{
|
|
175
|
+
let data = [
|
|
203
176
|
...dataSource
|
|
204
177
|
];
|
|
205
|
-
for(let
|
|
206
|
-
const
|
|
207
|
-
if (!
|
|
208
|
-
const
|
|
209
|
-
const controlledValues =
|
|
210
|
-
const activeVals = controlledValues ?? filterValues[
|
|
211
|
-
if (activeVals && activeVals.length > 0) data = data.filter((record)=>activeVals.some((v)=>
|
|
178
|
+
for(let i_4 = 0; i_4 < columns.length; i_4++){
|
|
179
|
+
const col_7 = columns[i_4];
|
|
180
|
+
if (!col_7.filters || !col_7.onFilter) continue;
|
|
181
|
+
const key_3 = getColKey(col_7, i_4);
|
|
182
|
+
const controlledValues = col_7.filteredValue;
|
|
183
|
+
const activeVals = controlledValues ?? filterValues[key_3];
|
|
184
|
+
if (activeVals && activeVals.length > 0) data = data.filter((record)=>activeVals.some((v)=>col_7.onFilter(v, record)));
|
|
212
185
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
};
|
|
220
|
-
$[41] = sortKey;
|
|
221
|
-
$[42] = sortOrder;
|
|
222
|
-
$[43] = t15;
|
|
223
|
-
} else t15 = $[43];
|
|
224
|
-
const activeSortCol = columns.find(t15);
|
|
225
|
-
if (activeSortCol && "function" == typeof activeSortCol.sorter) {
|
|
186
|
+
const activeSortCol = columns.find((col_8, i_5)=>{
|
|
187
|
+
const key_4 = getColKey(col_8, i_5);
|
|
188
|
+
const order_1 = void 0 !== col_8.sortOrder ? col_8.sortOrder : sortKey === key_4 ? sortOrder : null;
|
|
189
|
+
return null !== order_1 && 'function' == typeof col_8.sorter;
|
|
190
|
+
});
|
|
191
|
+
if (activeSortCol && 'function' == typeof activeSortCol.sorter) {
|
|
226
192
|
const colIdx_0 = columns.indexOf(activeSortCol);
|
|
227
|
-
const
|
|
228
|
-
const
|
|
193
|
+
const key_5 = getColKey(activeSortCol, colIdx_0);
|
|
194
|
+
const order_2 = void 0 !== activeSortCol.sortOrder ? activeSortCol.sortOrder : sortKey === key_5 ? sortOrder : null;
|
|
229
195
|
const sorterFn = activeSortCol.sorter;
|
|
230
196
|
data.sort((a, b)=>{
|
|
231
197
|
const result_0 = sorterFn(a, b);
|
|
232
|
-
return
|
|
198
|
+
return 'descend' === order_2 ? -result_0 : result_0;
|
|
233
199
|
});
|
|
234
200
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
201
|
+
return data;
|
|
202
|
+
}, [
|
|
203
|
+
dataSource,
|
|
204
|
+
columns,
|
|
205
|
+
filterValues,
|
|
206
|
+
sortKey,
|
|
207
|
+
sortOrder
|
|
208
|
+
]);
|
|
243
209
|
const totalForPagination = paginationConfig?.total ?? processedData.length;
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
if (paginationConfig?.total !== void 0) {
|
|
251
|
-
t15 = processedData;
|
|
252
|
-
break bb0;
|
|
253
|
-
}
|
|
210
|
+
const lastPage = Math.max(1, Math.ceil(totalForPagination / pageSize));
|
|
211
|
+
const boundedPage = Math.min(Math.max(1, internalPage), lastPage);
|
|
212
|
+
if (hasPagination && paginationConfig?.current === void 0 && boundedPage !== internalPage) setInternalPage(boundedPage);
|
|
213
|
+
const paginatedData = useMemo(()=>{
|
|
214
|
+
if (!hasPagination) return processedData;
|
|
215
|
+
if (paginationConfig?.total !== void 0) return processedData;
|
|
254
216
|
const start = (currentPage - 1) * pageSize;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
t15 = t16;
|
|
264
|
-
}
|
|
265
|
-
const paginatedData = t15;
|
|
217
|
+
return processedData.slice(start, start + pageSize);
|
|
218
|
+
}, [
|
|
219
|
+
processedData,
|
|
220
|
+
hasPagination,
|
|
221
|
+
paginationConfig,
|
|
222
|
+
currentPage,
|
|
223
|
+
pageSize
|
|
224
|
+
]);
|
|
266
225
|
const selectionColWidth = rowSelection?.columnWidth ?? 48;
|
|
267
|
-
const selectionType = rowSelection?.type ??
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
const nextRows = dataSource.filter((r)=>nextKeys.includes(getRowKey(r, rowKey)));
|
|
287
|
-
rowSelection.onChange(nextKeys, nextRows);
|
|
288
|
-
};
|
|
289
|
-
$[50] = dataSource;
|
|
290
|
-
$[51] = rowKey;
|
|
291
|
-
$[52] = rowSelection;
|
|
292
|
-
$[53] = selectedKeys;
|
|
293
|
-
$[54] = selectionType;
|
|
294
|
-
$[55] = t17;
|
|
295
|
-
} else t17 = $[55];
|
|
296
|
-
const handleSelectRow = t17;
|
|
297
|
-
let t18;
|
|
298
|
-
if ($[56] !== dataSource || $[57] !== paginatedData || $[58] !== rowKey || $[59] !== rowSelection) {
|
|
299
|
-
t18 = (checked)=>{
|
|
300
|
-
if (!rowSelection?.onChange) return;
|
|
301
|
-
if (checked) {
|
|
302
|
-
const allKeys = paginatedData.filter((r_0)=>{
|
|
303
|
-
const props = rowSelection.getCheckboxProps?.(r_0);
|
|
304
|
-
return !props?.disabled;
|
|
305
|
-
}).map((r_1)=>getRowKey(r_1, rowKey));
|
|
306
|
-
const nextRows_0 = dataSource.filter((r_2)=>allKeys.includes(getRowKey(r_2, rowKey)));
|
|
307
|
-
rowSelection.onChange(allKeys, nextRows_0);
|
|
308
|
-
} else rowSelection.onChange([], []);
|
|
309
|
-
};
|
|
310
|
-
$[56] = dataSource;
|
|
311
|
-
$[57] = paginatedData;
|
|
312
|
-
$[58] = rowKey;
|
|
313
|
-
$[59] = rowSelection;
|
|
314
|
-
$[60] = t18;
|
|
315
|
-
} else t18 = $[60];
|
|
316
|
-
const handleSelectAll = t18;
|
|
317
|
-
const scrollRef = useRef(null);
|
|
318
|
-
const [scrollState, setScrollState] = useState("left");
|
|
319
|
-
let t19;
|
|
320
|
-
if ($[61] === Symbol.for("react.memo_cache_sentinel")) {
|
|
321
|
-
t19 = ()=>{
|
|
322
|
-
const el = scrollRef.current;
|
|
323
|
-
if (!el) return;
|
|
324
|
-
const { scrollLeft, scrollWidth, clientWidth } = el;
|
|
325
|
-
const atLeft = scrollLeft <= 1;
|
|
326
|
-
const atRight = scrollLeft + clientWidth >= scrollWidth - 1;
|
|
327
|
-
if (atLeft && atRight) setScrollState("both");
|
|
328
|
-
else if (atLeft) setScrollState("left");
|
|
329
|
-
else atRight ? setScrollState("right") : setScrollState("middle");
|
|
330
|
-
};
|
|
331
|
-
$[61] = t19;
|
|
332
|
-
} else t19 = $[61];
|
|
333
|
-
const handleScroll = t19;
|
|
334
|
-
let t20;
|
|
335
|
-
if ($[62] !== scroll?.x) {
|
|
336
|
-
t20 = ()=>{
|
|
337
|
-
if (!scroll?.x) return;
|
|
338
|
-
handleScroll();
|
|
339
|
-
};
|
|
340
|
-
$[62] = scroll?.x;
|
|
341
|
-
$[63] = t20;
|
|
342
|
-
} else t20 = $[63];
|
|
343
|
-
const t21 = scroll?.x;
|
|
344
|
-
let t22;
|
|
345
|
-
if ($[64] !== t21) {
|
|
346
|
-
t22 = [
|
|
347
|
-
t21,
|
|
348
|
-
handleScroll
|
|
226
|
+
const selectionType = rowSelection?.type ?? 'checkbox';
|
|
227
|
+
const isSelectionControlled = rowSelection?.selectedRowKeys !== void 0;
|
|
228
|
+
const [internalSelectedKeys, setInternalSelectedKeys] = useState([]);
|
|
229
|
+
const selectedKeys = rowSelection?.selectedRowKeys ?? internalSelectedKeys;
|
|
230
|
+
const selectedKeySet = useMemo(()=>new Set(selectedKeys), [
|
|
231
|
+
selectedKeys
|
|
232
|
+
]);
|
|
233
|
+
const selectablePageKeys = useMemo(()=>paginatedData.filter((record_0)=>!rowSelection?.getCheckboxProps?.(record_0)?.disabled).map((record_1)=>getRowKey(record_1, rowKey)), [
|
|
234
|
+
paginatedData,
|
|
235
|
+
rowSelection,
|
|
236
|
+
rowKey
|
|
237
|
+
]);
|
|
238
|
+
const handleSelectRow = useCallback((key_6)=>{
|
|
239
|
+
let nextKeys;
|
|
240
|
+
nextKeys = 'radio' === selectionType ? [
|
|
241
|
+
key_6
|
|
242
|
+
] : selectedKeySet.has(key_6) ? selectedKeys.filter((k)=>k !== key_6) : [
|
|
243
|
+
...selectedKeys,
|
|
244
|
+
key_6
|
|
349
245
|
];
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
246
|
+
if (!isSelectionControlled) setInternalSelectedKeys(nextKeys);
|
|
247
|
+
if (!rowSelection?.onChange) return;
|
|
248
|
+
const nextKeySet = new Set(nextKeys);
|
|
249
|
+
const nextRows = dataSource.filter((r)=>nextKeySet.has(getRowKey(r, rowKey)));
|
|
250
|
+
rowSelection.onChange(nextKeys, nextRows);
|
|
251
|
+
}, [
|
|
252
|
+
rowSelection,
|
|
253
|
+
selectionType,
|
|
254
|
+
isSelectionControlled,
|
|
255
|
+
selectedKeys,
|
|
256
|
+
selectedKeySet,
|
|
257
|
+
dataSource,
|
|
258
|
+
rowKey
|
|
259
|
+
]);
|
|
260
|
+
const handleSelectAll = useCallback((checked)=>{
|
|
261
|
+
const nextKeySet_0 = new Set(selectedKeys);
|
|
262
|
+
for (const key_7 of selectablePageKeys)if (checked) nextKeySet_0.add(key_7);
|
|
263
|
+
else nextKeySet_0.delete(key_7);
|
|
264
|
+
const nextKeys_0 = [
|
|
265
|
+
...nextKeySet_0
|
|
266
|
+
];
|
|
267
|
+
if (!isSelectionControlled) setInternalSelectedKeys(nextKeys_0);
|
|
268
|
+
if (!rowSelection?.onChange) return;
|
|
269
|
+
const nextRows_0 = dataSource.filter((record_2)=>nextKeySet_0.has(getRowKey(record_2, rowKey)));
|
|
270
|
+
rowSelection.onChange(nextKeys_0, nextRows_0);
|
|
271
|
+
}, [
|
|
272
|
+
rowSelection,
|
|
273
|
+
selectedKeys,
|
|
274
|
+
selectablePageKeys,
|
|
275
|
+
dataSource,
|
|
276
|
+
rowKey,
|
|
277
|
+
isSelectionControlled
|
|
278
|
+
]);
|
|
279
|
+
const scrollRef = useRef(null);
|
|
280
|
+
const [scrollState, setScrollState] = useState('left');
|
|
281
|
+
const handleScroll = useCallback(()=>{
|
|
282
|
+
const el = scrollRef.current;
|
|
283
|
+
if (!el) return;
|
|
284
|
+
const { scrollLeft, scrollWidth, clientWidth } = el;
|
|
285
|
+
const atLeft = scrollLeft <= 1;
|
|
286
|
+
const atRight = scrollLeft + clientWidth >= scrollWidth - 1;
|
|
287
|
+
if (atLeft && atRight) setScrollState('both');
|
|
288
|
+
else if (atLeft) setScrollState('left');
|
|
289
|
+
else atRight ? setScrollState('right') : setScrollState('middle');
|
|
290
|
+
}, []);
|
|
291
|
+
useEffect(()=>{
|
|
292
|
+
if (!scroll?.x) return;
|
|
293
|
+
handleScroll();
|
|
294
|
+
}, [
|
|
295
|
+
scroll?.x,
|
|
296
|
+
handleScroll
|
|
297
|
+
]);
|
|
298
|
+
const allColumns = useMemo(()=>{
|
|
299
|
+
const cols = [];
|
|
357
300
|
if (rowSelection) cols.push({
|
|
358
|
-
_key:
|
|
301
|
+
_key: '__selection__',
|
|
359
302
|
_index: -1,
|
|
360
303
|
width: selectionColWidth,
|
|
361
|
-
fixed: rowSelection.fixed ?
|
|
304
|
+
fixed: rowSelection.fixed ? 'left' : void 0
|
|
362
305
|
});
|
|
363
|
-
columns.forEach((
|
|
306
|
+
columns.forEach((col_9, i_6)=>{
|
|
364
307
|
cols.push({
|
|
365
|
-
...
|
|
366
|
-
_key: getColKey(
|
|
367
|
-
_index:
|
|
308
|
+
...col_9,
|
|
309
|
+
_key: getColKey(col_9, i_6),
|
|
310
|
+
_index: i_6
|
|
368
311
|
});
|
|
369
312
|
});
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
313
|
+
return cols;
|
|
314
|
+
}, [
|
|
315
|
+
columns,
|
|
316
|
+
rowSelection,
|
|
317
|
+
selectionColWidth
|
|
318
|
+
]);
|
|
319
|
+
const stickyPositions = useMemo(()=>{
|
|
320
|
+
if (!scroll?.x) return {};
|
|
321
|
+
const positions = {};
|
|
322
|
+
let leftOffset = 0;
|
|
323
|
+
for (const col_10 of allColumns)if ('left' === col_10.fixed) {
|
|
324
|
+
positions[col_10._key] = {
|
|
325
|
+
left: leftOffset
|
|
326
|
+
};
|
|
327
|
+
leftOffset += 'number' == typeof col_10.width ? col_10.width : 0;
|
|
328
|
+
}
|
|
329
|
+
let rightOffset = 0;
|
|
330
|
+
for(let i_7 = allColumns.length - 1; i_7 >= 0; i_7--){
|
|
331
|
+
const col_11 = allColumns[i_7];
|
|
332
|
+
if ('right' === col_11.fixed) {
|
|
333
|
+
positions[col_11._key] = {
|
|
334
|
+
right: rightOffset
|
|
385
335
|
};
|
|
386
|
-
|
|
336
|
+
rightOffset += 'number' == typeof col_11.width ? col_11.width : 0;
|
|
387
337
|
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
return positions;
|
|
399
|
-
};
|
|
400
|
-
$[70] = allColumns;
|
|
401
|
-
$[71] = scroll?.x;
|
|
402
|
-
$[72] = t23;
|
|
403
|
-
} else t23 = $[72];
|
|
404
|
-
scroll?.x;
|
|
405
|
-
let t24;
|
|
406
|
-
if ($[73] !== t23) {
|
|
407
|
-
t24 = t23();
|
|
408
|
-
$[73] = t23;
|
|
409
|
-
$[74] = t24;
|
|
410
|
-
} else t24 = $[74];
|
|
411
|
-
const stickyPositions = t24;
|
|
412
|
-
let t25;
|
|
413
|
-
if ($[75] !== sortKey || $[76] !== sortOrder) {
|
|
414
|
-
t25 = (col_10, colKey_1)=>{
|
|
415
|
-
if (void 0 !== col_10.sortOrder) return col_10.sortOrder;
|
|
416
|
-
return sortKey === colKey_1 ? sortOrder : null;
|
|
417
|
-
};
|
|
418
|
-
$[75] = sortKey;
|
|
419
|
-
$[76] = sortOrder;
|
|
420
|
-
$[77] = t25;
|
|
421
|
-
} else t25 = $[77];
|
|
422
|
-
const getResolvedSortOrder = t25;
|
|
338
|
+
}
|
|
339
|
+
return positions;
|
|
340
|
+
}, [
|
|
341
|
+
allColumns,
|
|
342
|
+
scroll?.x
|
|
343
|
+
]);
|
|
344
|
+
const getResolvedSortOrder = (col_12, colKey_1)=>{
|
|
345
|
+
if (void 0 !== col_12.sortOrder) return col_12.sortOrder;
|
|
346
|
+
return sortKey === colKey_1 ? sortOrder : null;
|
|
347
|
+
};
|
|
423
348
|
const tableStyle = scroll?.x ? {
|
|
424
|
-
minWidth:
|
|
349
|
+
minWidth: 'number' == typeof scroll.x ? `${scroll.x}px` : scroll.x
|
|
425
350
|
} : {};
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
$[78] = paginatedData;
|
|
430
|
-
$[79] = rowKey;
|
|
431
|
-
$[80] = rowSelection;
|
|
432
|
-
$[81] = selectedKeys;
|
|
433
|
-
$[82] = t26;
|
|
434
|
-
} else t26 = $[82];
|
|
435
|
-
const isAllSelected = t26;
|
|
436
|
-
const isIndeterminate = !isAllSelected && selectedKeys.length > 0;
|
|
437
|
-
let t27;
|
|
438
|
-
if ($[83] !== loading) {
|
|
439
|
-
t27 = loading && /*#__PURE__*/ jsx(TableLoadingSpinner, {});
|
|
440
|
-
$[83] = loading;
|
|
441
|
-
$[84] = t27;
|
|
442
|
-
} else t27 = $[84];
|
|
443
|
-
const headerRowProps = onHeaderRow?.(columns, 0) ?? {};
|
|
444
|
-
const t28 = "";
|
|
445
|
-
const t29 = 0 === paginatedData.length ? /*#__PURE__*/ jsx("tr", {
|
|
446
|
-
children: /*#__PURE__*/ jsx("td", {
|
|
447
|
-
"data-tao-table-cell": "",
|
|
448
|
-
"data-tao-table-empty": "",
|
|
449
|
-
colSpan: columns.length + (rowSelection ? 1 : 0),
|
|
450
|
-
className: resolvedClassNames.empty,
|
|
451
|
-
style: resolvedStyles.empty,
|
|
452
|
-
children: emptyText
|
|
453
|
-
})
|
|
454
|
-
}) : paginatedData.map((record_0, rowIdx)=>{
|
|
455
|
-
const key_6 = getRowKey(record_0, rowKey);
|
|
456
|
-
const isSelected = selectedKeys.includes(key_6);
|
|
457
|
-
const checkboxProps = rowSelection?.getCheckboxProps?.(record_0);
|
|
458
|
-
const rowProps = onRow?.(record_0, rowIdx) ?? {};
|
|
459
|
-
return /*#__PURE__*/ createElement("tr", {
|
|
460
|
-
...rowProps,
|
|
461
|
-
key: key_6,
|
|
462
|
-
"data-tao-table-row": "",
|
|
463
|
-
"data-tao-selected": isSelected || void 0,
|
|
464
|
-
className: cx(resolvedClassNames["body.row"], resolveRowClassName(rowClassName, record_0, rowIdx), rowProps.className),
|
|
465
|
-
style: {
|
|
466
|
-
...resolvedStyles["body.row"],
|
|
467
|
-
...resolveRowStyle(rowStyle, record_0, rowIdx),
|
|
468
|
-
...rowProps.style
|
|
469
|
-
},
|
|
470
|
-
children: [
|
|
471
|
-
rowSelection && /*#__PURE__*/ jsx("td", {
|
|
472
|
-
"data-tao-table-cell": "",
|
|
473
|
-
"data-tao-table-selection-cell": "",
|
|
474
|
-
"data-tao-fixed": "left",
|
|
475
|
-
className: resolvedClassNames["selection.cell"],
|
|
476
|
-
style: {
|
|
477
|
-
...stickyPositions.__selection__ ? {
|
|
478
|
-
position: "sticky",
|
|
479
|
-
left: stickyPositions.__selection__.left,
|
|
480
|
-
zIndex: 1
|
|
481
|
-
} : {},
|
|
482
|
-
...resolvedStyles["selection.cell"]
|
|
483
|
-
},
|
|
484
|
-
children: /*#__PURE__*/ jsx("input", {
|
|
485
|
-
type: "radio" === selectionType ? "radio" : "checkbox",
|
|
486
|
-
checked: isSelected,
|
|
487
|
-
"aria-label": `Select row ${String(key_6)}`,
|
|
488
|
-
disabled: checkboxProps?.disabled,
|
|
489
|
-
onChange: ()=>handleSelectRow(key_6),
|
|
490
|
-
"data-tao-table-checkbox": ""
|
|
491
|
-
})
|
|
492
|
-
}),
|
|
493
|
-
columns.map((col_12, colIdx_1)=>{
|
|
494
|
-
const colKey_3 = getColKey(col_12, colIdx_1);
|
|
495
|
-
const value = getCellValue(record_0, col_12.dataIndex);
|
|
496
|
-
const stickyPos_0 = stickyPositions[colKey_3];
|
|
497
|
-
const isFixed_0 = !!col_12.fixed && !!scroll?.x;
|
|
498
|
-
const cellProps = col_12.onCell?.(record_0, rowIdx) ?? {};
|
|
499
|
-
return /*#__PURE__*/ createElement("td", {
|
|
500
|
-
...cellProps,
|
|
501
|
-
key: colKey_3,
|
|
502
|
-
"data-tao-table-cell": "",
|
|
503
|
-
"data-tao-align": col_12.align,
|
|
504
|
-
"data-tao-ellipsis": col_12.ellipsis || void 0,
|
|
505
|
-
"data-tao-fixed": isFixed_0 ? col_12.fixed : void 0,
|
|
506
|
-
className: cx(resolvedClassNames["body.cell"], cellProps.className),
|
|
507
|
-
style: {
|
|
508
|
-
...resolvedStyles["body.cell"],
|
|
509
|
-
...isFixed_0 && stickyPos_0 ? {
|
|
510
|
-
position: "sticky",
|
|
511
|
-
...void 0 !== stickyPos_0.left ? {
|
|
512
|
-
left: stickyPos_0.left
|
|
513
|
-
} : {},
|
|
514
|
-
...void 0 !== stickyPos_0.right ? {
|
|
515
|
-
right: stickyPos_0.right
|
|
516
|
-
} : {},
|
|
517
|
-
zIndex: 1
|
|
518
|
-
} : {},
|
|
519
|
-
...cellProps.style
|
|
520
|
-
}
|
|
521
|
-
}, col_12.render ? col_12.render(value, record_0, rowIdx) : value);
|
|
522
|
-
})
|
|
523
|
-
]
|
|
524
|
-
});
|
|
525
|
-
});
|
|
526
|
-
let t30;
|
|
527
|
-
if ($[85] !== t29) {
|
|
528
|
-
t30 = /*#__PURE__*/ jsx("tbody", {
|
|
529
|
-
"data-tao-table-tbody": t28,
|
|
530
|
-
children: t29
|
|
531
|
-
});
|
|
532
|
-
$[85] = t29;
|
|
533
|
-
$[86] = t30;
|
|
534
|
-
} else t30 = $[86];
|
|
535
|
-
let t31;
|
|
536
|
-
if ($[87] !== currentPage || $[88] !== handlePageChange || $[89] !== hasPagination || $[90] !== pageSize || $[91] !== paginationConfig?.pageSizeOptions || $[92] !== paginationConfig?.showSizeChanger || $[93] !== paginationConfig?.showTotal || $[94] !== resolvedClassNames || $[95] !== resolvedSize || $[96] !== resolvedStyles || $[97] !== totalForPagination) {
|
|
537
|
-
t31 = hasPagination && totalForPagination > 0 && /*#__PURE__*/ jsx("div", {
|
|
538
|
-
"data-tao-table-pagination": "",
|
|
539
|
-
className: resolvedClassNames.pagination,
|
|
540
|
-
style: resolvedStyles.pagination,
|
|
541
|
-
children: /*#__PURE__*/ jsx(Pagination, {
|
|
542
|
-
current: currentPage,
|
|
543
|
-
pageSize: pageSize,
|
|
544
|
-
total: totalForPagination,
|
|
545
|
-
onChange: handlePageChange,
|
|
546
|
-
size: resolvedSize,
|
|
547
|
-
showSizeChanger: paginationConfig?.showSizeChanger,
|
|
548
|
-
pageSizeOptions: paginationConfig?.pageSizeOptions,
|
|
549
|
-
showTotal: paginationConfig?.showTotal
|
|
550
|
-
})
|
|
551
|
-
});
|
|
552
|
-
$[87] = currentPage;
|
|
553
|
-
$[88] = handlePageChange;
|
|
554
|
-
$[89] = hasPagination;
|
|
555
|
-
$[90] = pageSize;
|
|
556
|
-
$[91] = paginationConfig?.pageSizeOptions;
|
|
557
|
-
$[92] = paginationConfig?.showSizeChanger;
|
|
558
|
-
$[93] = paginationConfig?.showTotal;
|
|
559
|
-
$[94] = resolvedClassNames;
|
|
560
|
-
$[95] = resolvedSize;
|
|
561
|
-
$[96] = resolvedStyles;
|
|
562
|
-
$[97] = totalForPagination;
|
|
563
|
-
$[98] = t31;
|
|
564
|
-
} else t31 = $[98];
|
|
351
|
+
const selectedPageCount = selectablePageKeys.filter((key_8)=>selectedKeySet.has(key_8)).length;
|
|
352
|
+
const isAllSelected = selectablePageKeys.length > 0 && selectedPageCount === selectablePageKeys.length;
|
|
353
|
+
const isIndeterminate = selectedPageCount > 0 && !isAllSelected;
|
|
565
354
|
return /*#__PURE__*/ jsxs("div", {
|
|
566
355
|
"data-tao-table-wrapper": "",
|
|
567
356
|
"data-tao-size": resolvedSize,
|
|
568
357
|
"data-tao-variant": resolvedVariant,
|
|
569
|
-
"data-tao-header-bg": headerBackground ? void 0 :
|
|
358
|
+
"data-tao-header-bg": headerBackground ? void 0 : 'off',
|
|
570
359
|
"data-tao-bordered": showBorder || void 0,
|
|
571
360
|
"data-tao-scroll-state": scroll?.x ? scrollState : void 0,
|
|
572
361
|
className: cx(resolvedClassNames.root, className),
|
|
@@ -582,7 +371,7 @@ function Table(t0) {
|
|
|
582
371
|
className: resolvedClassNames.scroll,
|
|
583
372
|
style: resolvedStyles.scroll,
|
|
584
373
|
children: [
|
|
585
|
-
|
|
374
|
+
loading && /*#__PURE__*/ jsx(TableLoadingSpinner, {}),
|
|
586
375
|
/*#__PURE__*/ jsxs("table", {
|
|
587
376
|
"data-tao-table": "",
|
|
588
377
|
className: resolvedClassNames.table,
|
|
@@ -593,123 +382,218 @@ function Table(t0) {
|
|
|
593
382
|
children: [
|
|
594
383
|
/*#__PURE__*/ jsx("thead", {
|
|
595
384
|
"data-tao-table-thead": "",
|
|
596
|
-
className: resolvedClassNames[
|
|
597
|
-
style: resolvedStyles[
|
|
598
|
-
children:
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
type: "checkbox",
|
|
622
|
-
"aria-label": "Select all rows",
|
|
623
|
-
checked: isAllSelected,
|
|
624
|
-
ref: (el_0)=>{
|
|
625
|
-
if (el_0) el_0.indeterminate = isIndeterminate;
|
|
385
|
+
className: resolvedClassNames['header.wrapper'],
|
|
386
|
+
style: resolvedStyles['header.wrapper'],
|
|
387
|
+
children: (()=>{
|
|
388
|
+
const headerRowProps = onHeaderRow?.(columns, 0) ?? {};
|
|
389
|
+
return /*#__PURE__*/ jsxs("tr", {
|
|
390
|
+
...headerRowProps,
|
|
391
|
+
className: cx(resolvedClassNames['header.row'], headerRowProps.className),
|
|
392
|
+
style: {
|
|
393
|
+
...resolvedStyles['header.row'],
|
|
394
|
+
...headerRowProps.style
|
|
395
|
+
},
|
|
396
|
+
children: [
|
|
397
|
+
rowSelection && /*#__PURE__*/ jsx("th", {
|
|
398
|
+
"data-tao-table-cell": "",
|
|
399
|
+
"data-tao-table-selection-cell": "",
|
|
400
|
+
"data-tao-fixed": "left",
|
|
401
|
+
className: resolvedClassNames['selection.cell'],
|
|
402
|
+
style: {
|
|
403
|
+
width: selectionColWidth,
|
|
404
|
+
...stickyPositions.__selection__ ? {
|
|
405
|
+
position: 'sticky',
|
|
406
|
+
left: stickyPositions.__selection__.left,
|
|
407
|
+
zIndex: 2
|
|
408
|
+
} : {},
|
|
409
|
+
...resolvedStyles['selection.cell']
|
|
626
410
|
},
|
|
627
|
-
|
|
628
|
-
|
|
411
|
+
children: 'checkbox' === selectionType && /*#__PURE__*/ jsx("input", {
|
|
412
|
+
type: "checkbox",
|
|
413
|
+
"aria-label": "Select all rows",
|
|
414
|
+
checked: isAllSelected,
|
|
415
|
+
disabled: 0 === selectablePageKeys.length,
|
|
416
|
+
ref: (el_0)=>{
|
|
417
|
+
if (el_0) el_0.indeterminate = isIndeterminate;
|
|
418
|
+
},
|
|
419
|
+
onChange: (e)=>handleSelectAll(e.target.checked),
|
|
420
|
+
"data-tao-table-checkbox": ""
|
|
421
|
+
})
|
|
422
|
+
}),
|
|
423
|
+
columns.map((col_13, i_8)=>{
|
|
424
|
+
const colKey_2 = getColKey(col_13, i_8);
|
|
425
|
+
const hasSorter = !!col_13.sorter;
|
|
426
|
+
const hasFilter = !!(col_13.filters && col_13.filters.length > 0);
|
|
427
|
+
const resolvedOrder = getResolvedSortOrder(col_13, colKey_2);
|
|
428
|
+
const controlledFilterValues = col_13.filteredValue;
|
|
429
|
+
const activeFilterValues = controlledFilterValues ?? filterValues[colKey_2] ?? [];
|
|
430
|
+
const stickyPos = stickyPositions[colKey_2];
|
|
431
|
+
const isFixed = !!col_13.fixed && !!scroll?.x;
|
|
432
|
+
const headerCellProps = col_13.onHeaderCell?.(col_13) ?? {};
|
|
433
|
+
return /*#__PURE__*/ createElement("th", {
|
|
434
|
+
...headerCellProps,
|
|
435
|
+
key: colKey_2,
|
|
436
|
+
"data-tao-table-cell": "",
|
|
437
|
+
"data-tao-table-header": "",
|
|
438
|
+
"data-tao-align": col_13.align,
|
|
439
|
+
"data-tao-fixed": isFixed ? col_13.fixed : void 0,
|
|
440
|
+
"aria-sort": hasSorter ? 'ascend' === resolvedOrder ? 'ascending' : 'descend' === resolvedOrder ? 'descending' : 'none' : void 0,
|
|
441
|
+
className: cx(resolvedClassNames['header.cell'], headerCellProps.className),
|
|
442
|
+
style: {
|
|
443
|
+
...resolvedStyles['header.cell'],
|
|
444
|
+
width: col_13.width,
|
|
445
|
+
...isFixed && stickyPos ? {
|
|
446
|
+
position: 'sticky',
|
|
447
|
+
...void 0 !== stickyPos.left ? {
|
|
448
|
+
left: stickyPos.left
|
|
449
|
+
} : {},
|
|
450
|
+
...void 0 !== stickyPos.right ? {
|
|
451
|
+
right: stickyPos.right
|
|
452
|
+
} : {},
|
|
453
|
+
zIndex: 2
|
|
454
|
+
} : {},
|
|
455
|
+
...headerCellProps.style
|
|
456
|
+
}
|
|
457
|
+
}, /*#__PURE__*/ jsxs("div", {
|
|
458
|
+
"data-tao-table-header-content": "",
|
|
459
|
+
className: resolvedClassNames['header.content'],
|
|
460
|
+
style: resolvedStyles['header.content'],
|
|
461
|
+
children: [
|
|
462
|
+
hasSorter ? /*#__PURE__*/ jsxs("button", {
|
|
463
|
+
type: "button",
|
|
464
|
+
"data-tao-table-header-title": "",
|
|
465
|
+
"data-tao-sortable": "",
|
|
466
|
+
className: resolvedClassNames['header.title'],
|
|
467
|
+
style: resolvedStyles['header.title'],
|
|
468
|
+
onClick: ()=>handleSort(colKey_2, col_13),
|
|
469
|
+
children: [
|
|
470
|
+
col_13.title,
|
|
471
|
+
/*#__PURE__*/ jsx(SortIcon, {
|
|
472
|
+
order: resolvedOrder
|
|
473
|
+
})
|
|
474
|
+
]
|
|
475
|
+
}) : /*#__PURE__*/ jsx("span", {
|
|
476
|
+
"data-tao-table-header-title": "",
|
|
477
|
+
className: resolvedClassNames['header.title'],
|
|
478
|
+
style: resolvedStyles['header.title'],
|
|
479
|
+
children: col_13.title
|
|
480
|
+
}),
|
|
481
|
+
hasFilter && /*#__PURE__*/ jsx(TableFilterDropdown, {
|
|
482
|
+
filters: col_13.filters,
|
|
483
|
+
activeValues: activeFilterValues,
|
|
484
|
+
onSelect: (vals_0)=>handleFilter(colKey_2, vals_0)
|
|
485
|
+
})
|
|
486
|
+
]
|
|
487
|
+
}));
|
|
629
488
|
})
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
489
|
+
]
|
|
490
|
+
});
|
|
491
|
+
})()
|
|
492
|
+
}),
|
|
493
|
+
/*#__PURE__*/ jsx("tbody", {
|
|
494
|
+
"data-tao-table-tbody": "",
|
|
495
|
+
children: 0 === paginatedData.length ? /*#__PURE__*/ jsx("tr", {
|
|
496
|
+
children: /*#__PURE__*/ jsx("td", {
|
|
497
|
+
"data-tao-table-cell": "",
|
|
498
|
+
"data-tao-table-empty": "",
|
|
499
|
+
colSpan: columns.length + (rowSelection ? 1 : 0),
|
|
500
|
+
className: resolvedClassNames.empty,
|
|
501
|
+
style: resolvedStyles.empty,
|
|
502
|
+
children: emptyText
|
|
503
|
+
})
|
|
504
|
+
}) : paginatedData.map((record_3, rowIdx)=>{
|
|
505
|
+
const key_9 = getRowKey(record_3, rowKey);
|
|
506
|
+
const isSelected = selectedKeySet.has(key_9);
|
|
507
|
+
const checkboxProps = rowSelection?.getCheckboxProps?.(record_3);
|
|
508
|
+
const rowProps = onRow?.(record_3, rowIdx) ?? {};
|
|
509
|
+
return /*#__PURE__*/ createElement("tr", {
|
|
510
|
+
...rowProps,
|
|
511
|
+
key: key_9,
|
|
512
|
+
"data-tao-table-row": "",
|
|
513
|
+
"data-tao-selected": isSelected || void 0,
|
|
514
|
+
className: cx(resolvedClassNames['body.row'], resolveRowClassName(rowClassName, record_3, rowIdx), rowProps.className),
|
|
515
|
+
style: {
|
|
516
|
+
...resolvedStyles['body.row'],
|
|
517
|
+
...resolveRowStyle(rowStyle, record_3, rowIdx),
|
|
518
|
+
...rowProps.style
|
|
519
|
+
},
|
|
520
|
+
children: [
|
|
521
|
+
rowSelection && /*#__PURE__*/ jsx("td", {
|
|
644
522
|
"data-tao-table-cell": "",
|
|
645
|
-
"data-tao-table-
|
|
646
|
-
"data-tao-
|
|
647
|
-
|
|
648
|
-
"aria-sort": hasSorter ? "ascend" === resolvedOrder ? "ascending" : "descend" === resolvedOrder ? "descending" : "none" : void 0,
|
|
649
|
-
className: cx(resolvedClassNames["header.cell"], headerCellProps.className),
|
|
523
|
+
"data-tao-table-selection-cell": "",
|
|
524
|
+
"data-tao-fixed": "left",
|
|
525
|
+
className: resolvedClassNames['selection.cell'],
|
|
650
526
|
style: {
|
|
651
|
-
...
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
...void 0 !== stickyPos.left ? {
|
|
656
|
-
left: stickyPos.left
|
|
657
|
-
} : {},
|
|
658
|
-
...void 0 !== stickyPos.right ? {
|
|
659
|
-
right: stickyPos.right
|
|
660
|
-
} : {},
|
|
661
|
-
zIndex: 2
|
|
527
|
+
...stickyPositions.__selection__ ? {
|
|
528
|
+
position: 'sticky',
|
|
529
|
+
left: stickyPositions.__selection__.left,
|
|
530
|
+
zIndex: 1
|
|
662
531
|
} : {},
|
|
663
|
-
...
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
532
|
+
...resolvedStyles['selection.cell']
|
|
533
|
+
},
|
|
534
|
+
children: /*#__PURE__*/ jsx("input", {
|
|
535
|
+
type: 'radio' === selectionType ? 'radio' : 'checkbox',
|
|
536
|
+
checked: isSelected,
|
|
537
|
+
"aria-label": `Select row ${String(key_9)}`,
|
|
538
|
+
disabled: checkboxProps?.disabled,
|
|
539
|
+
onChange: ()=>handleSelectRow(key_9),
|
|
540
|
+
"data-tao-table-checkbox": ""
|
|
541
|
+
})
|
|
542
|
+
}),
|
|
543
|
+
columns.map((col_14, colIdx_1)=>{
|
|
544
|
+
const colKey_3 = getColKey(col_14, colIdx_1);
|
|
545
|
+
const value = getCellValue(record_3, col_14.dataIndex);
|
|
546
|
+
const stickyPos_0 = stickyPositions[colKey_3];
|
|
547
|
+
const isFixed_0 = !!col_14.fixed && !!scroll?.x;
|
|
548
|
+
const cellProps = col_14.onCell?.(record_3, rowIdx) ?? {};
|
|
549
|
+
return /*#__PURE__*/ createElement("td", {
|
|
550
|
+
...cellProps,
|
|
551
|
+
key: colKey_3,
|
|
552
|
+
"data-tao-table-cell": "",
|
|
553
|
+
"data-tao-align": col_14.align,
|
|
554
|
+
"data-tao-ellipsis": col_14.ellipsis || void 0,
|
|
555
|
+
"data-tao-fixed": isFixed_0 ? col_14.fixed : void 0,
|
|
556
|
+
className: cx(resolvedClassNames['body.cell'], cellProps.className),
|
|
557
|
+
style: {
|
|
558
|
+
...resolvedStyles['body.cell'],
|
|
559
|
+
...isFixed_0 && stickyPos_0 ? {
|
|
560
|
+
position: 'sticky',
|
|
561
|
+
...void 0 !== stickyPos_0.left ? {
|
|
562
|
+
left: stickyPos_0.left
|
|
563
|
+
} : {},
|
|
564
|
+
...void 0 !== stickyPos_0.right ? {
|
|
565
|
+
right: stickyPos_0.right
|
|
566
|
+
} : {},
|
|
567
|
+
zIndex: 1
|
|
568
|
+
} : {},
|
|
569
|
+
...cellProps.style
|
|
570
|
+
}
|
|
571
|
+
}, col_14.render ? col_14.render(value, record_3, rowIdx) : value);
|
|
572
|
+
})
|
|
573
|
+
]
|
|
574
|
+
});
|
|
698
575
|
})
|
|
699
|
-
})
|
|
700
|
-
t30
|
|
576
|
+
})
|
|
701
577
|
]
|
|
702
578
|
})
|
|
703
579
|
]
|
|
704
580
|
}),
|
|
705
|
-
|
|
581
|
+
hasPagination && totalForPagination > 0 && /*#__PURE__*/ jsx("div", {
|
|
582
|
+
"data-tao-table-pagination": "",
|
|
583
|
+
className: resolvedClassNames.pagination,
|
|
584
|
+
style: resolvedStyles.pagination,
|
|
585
|
+
children: /*#__PURE__*/ jsx(Pagination, {
|
|
586
|
+
current: currentPage,
|
|
587
|
+
pageSize: pageSize,
|
|
588
|
+
total: totalForPagination,
|
|
589
|
+
onChange: handlePageChange,
|
|
590
|
+
size: resolvedSize,
|
|
591
|
+
showSizeChanger: paginationConfig?.showSizeChanger,
|
|
592
|
+
pageSizeOptions: paginationConfig?.pageSizeOptions,
|
|
593
|
+
showTotal: paginationConfig?.showTotal
|
|
594
|
+
})
|
|
595
|
+
})
|
|
706
596
|
]
|
|
707
597
|
});
|
|
708
598
|
}
|
|
709
|
-
function _temp2(c) {
|
|
710
|
-
return c.defaultSortOrder;
|
|
711
|
-
}
|
|
712
|
-
function _temp(col_0) {
|
|
713
|
-
return col_0.responsive;
|
|
714
|
-
}
|
|
715
599
|
export { Table };
|