@rockshin/tao-ui 0.0.31 → 0.0.32

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.
Files changed (158) hide show
  1. package/README.md +14 -3
  2. package/dist/components/alert/alert.js +1 -1
  3. package/dist/components/breadcrumb/breadcrumb.js +1 -1
  4. package/dist/components/button/button.d.ts +2 -2
  5. package/dist/components/button/button.js +48 -50
  6. package/dist/components/checkbox/checkbox.css +5 -1
  7. package/dist/components/checkbox/checkbox.d.ts +2 -2
  8. package/dist/components/checkbox/checkbox.js +135 -120
  9. package/dist/components/collapsible/collapsible.js +1 -1
  10. package/dist/components/context-menu/context-menu.js +1 -1
  11. package/dist/components/date-picker/calendar/calendar-header.js +1 -1
  12. package/dist/components/date-picker/calendar/month-grid.d.ts +3 -1
  13. package/dist/components/date-picker/calendar/month-grid.js +19 -17
  14. package/dist/components/date-picker/calendar/time-panel.js +1 -1
  15. package/dist/components/date-picker/calendar/year-grid.d.ts +3 -1
  16. package/dist/components/date-picker/calendar/year-grid.js +28 -24
  17. package/dist/components/date-picker/date-picker.d.ts +1 -1
  18. package/dist/components/date-picker/date-picker.js +37 -24
  19. package/dist/components/date-picker/presets.js +1 -1
  20. package/dist/components/date-picker/range-picker.d.ts +1 -1
  21. package/dist/components/date-picker/range-picker.js +104 -56
  22. package/dist/components/drawer/drawer.d.ts +1 -1
  23. package/dist/components/drawer/drawer.js +98 -91
  24. package/dist/components/dropdown/dropdown.js +84 -84
  25. package/dist/components/form/form-item.js +8 -4
  26. package/dist/components/form/form.js +1 -1
  27. package/dist/components/form-actions/form-actions.js +1 -1
  28. package/dist/components/form-field/form-field-view.js +58 -51
  29. package/dist/components/form-field/form-field.js +1 -1
  30. package/dist/components/form-section/form-section.js +1 -1
  31. package/dist/components/input/input.js +42 -39
  32. package/dist/components/input-number/input-number.d.ts +2 -2
  33. package/dist/components/input-number/input-number.js +57 -59
  34. package/dist/components/menu/menu-render.js +1 -1
  35. package/dist/components/modal/confirm-dialog.d.ts +2 -1
  36. package/dist/components/modal/confirm-dialog.js +25 -5
  37. package/dist/components/modal/confirm.js +15 -3
  38. package/dist/components/modal/modal.d.ts +1 -1
  39. package/dist/components/modal/modal.js +131 -132
  40. package/dist/components/modal/use-modal.js +48 -35
  41. package/dist/components/pagination/pagination.js +3 -1
  42. package/dist/components/popconfirm/popconfirm.js +1 -1
  43. package/dist/components/popover/popover.js +253 -228
  44. package/dist/components/radio/radio.css +2 -2
  45. package/dist/components/radio/radio.d.ts +1 -1
  46. package/dist/components/radio/radio.js +7 -7
  47. package/dist/components/scroll-area/scroll-area.css +2 -2
  48. package/dist/components/scroll-area/scroll-area.js +187 -165
  49. package/dist/components/select/mobile-select.d.ts +2 -1
  50. package/dist/components/select/mobile-select.js +12 -6
  51. package/dist/components/select/select-icons.js +1 -1
  52. package/dist/components/select/select-searchable-list.d.ts +1 -1
  53. package/dist/components/select/select-searchable-list.js +35 -21
  54. package/dist/components/select/select-tags.js +1 -1
  55. package/dist/components/select/select-types.d.ts +2 -2
  56. package/dist/components/select/select.css +4 -0
  57. package/dist/components/select/select.d.ts +2 -2
  58. package/dist/components/select/select.js +124 -72
  59. package/dist/components/sonner/sonner.js +6 -5
  60. package/dist/components/spinner/spinner.js +1 -1
  61. package/dist/components/splitter/splitter.js +187 -194
  62. package/dist/components/status-icon/status-icon.js +1 -1
  63. package/dist/components/switch/switch.d.ts +1 -1
  64. package/dist/components/switch/switch.js +6 -6
  65. package/dist/components/table/table-filter.js +1 -1
  66. package/dist/components/table/table-icons.js +1 -1
  67. package/dist/components/table/table.js +483 -599
  68. package/dist/components/tabs/tabs.js +179 -161
  69. package/dist/components/tag/tag.js +1 -1
  70. package/dist/components/textarea/textarea.d.ts +1 -1
  71. package/dist/components/textarea/textarea.js +142 -108
  72. package/dist/components/tooltip/tooltip.js +88 -72
  73. package/dist/entries/alert.d.ts +3 -0
  74. package/dist/entries/alert.js +4 -0
  75. package/dist/entries/breadcrumb.d.ts +3 -0
  76. package/dist/entries/breadcrumb.js +4 -0
  77. package/dist/entries/button.d.ts +3 -0
  78. package/dist/entries/button.js +4 -0
  79. package/dist/entries/checkbox.d.ts +3 -0
  80. package/dist/entries/checkbox.js +4 -0
  81. package/dist/entries/collapsible.d.ts +3 -0
  82. package/dist/entries/collapsible.js +4 -0
  83. package/dist/entries/context-menu.d.ts +3 -0
  84. package/dist/entries/context-menu.js +4 -0
  85. package/dist/entries/date-picker.d.ts +3 -0
  86. package/dist/entries/date-picker.js +4 -0
  87. package/dist/entries/drawer.d.ts +3 -0
  88. package/dist/entries/drawer.js +4 -0
  89. package/dist/entries/dropdown.d.ts +3 -0
  90. package/dist/entries/dropdown.js +4 -0
  91. package/dist/entries/form-actions.d.ts +3 -0
  92. package/dist/entries/form-actions.js +4 -0
  93. package/dist/entries/form-field.d.ts +3 -0
  94. package/dist/entries/form-field.js +4 -0
  95. package/dist/entries/form-layout.d.ts +3 -0
  96. package/dist/entries/form-layout.js +4 -0
  97. package/dist/entries/form-section.d.ts +3 -0
  98. package/dist/entries/form-section.js +4 -0
  99. package/dist/entries/form.d.ts +4 -0
  100. package/dist/entries/form.js +4 -0
  101. package/dist/entries/input-number.d.ts +3 -0
  102. package/dist/entries/input-number.js +4 -0
  103. package/dist/entries/input.d.ts +3 -0
  104. package/dist/entries/input.js +4 -0
  105. package/dist/entries/modal.d.ts +3 -0
  106. package/dist/entries/modal.js +4 -0
  107. package/dist/entries/number-input.d.ts +3 -0
  108. package/dist/entries/number-input.js +4 -0
  109. package/dist/entries/pagination.d.ts +3 -0
  110. package/dist/entries/pagination.js +4 -0
  111. package/dist/entries/popconfirm.d.ts +3 -0
  112. package/dist/entries/popconfirm.js +4 -0
  113. package/dist/entries/popover.d.ts +3 -0
  114. package/dist/entries/popover.js +4 -0
  115. package/dist/entries/provider.d.ts +3 -0
  116. package/dist/entries/provider.js +4 -0
  117. package/dist/entries/radio.d.ts +3 -0
  118. package/dist/entries/radio.js +4 -0
  119. package/dist/entries/range-picker.d.ts +3 -0
  120. package/dist/entries/range-picker.js +4 -0
  121. package/dist/entries/scroll-area.d.ts +3 -0
  122. package/dist/entries/scroll-area.js +4 -0
  123. package/dist/entries/select.d.ts +3 -0
  124. package/dist/entries/select.js +4 -0
  125. package/dist/entries/sonner.d.ts +3 -0
  126. package/dist/entries/sonner.js +4 -0
  127. package/dist/entries/spinner.d.ts +3 -0
  128. package/dist/entries/spinner.js +4 -0
  129. package/dist/entries/splitter.d.ts +3 -0
  130. package/dist/entries/splitter.js +4 -0
  131. package/dist/entries/stack.d.ts +3 -0
  132. package/dist/entries/stack.js +4 -0
  133. package/dist/entries/switch.d.ts +3 -0
  134. package/dist/entries/switch.js +4 -0
  135. package/dist/entries/table.d.ts +3 -0
  136. package/dist/entries/table.js +4 -0
  137. package/dist/entries/tabs.d.ts +3 -0
  138. package/dist/entries/tabs.js +4 -0
  139. package/dist/entries/tag.d.ts +3 -0
  140. package/dist/entries/tag.js +4 -0
  141. package/dist/entries/textarea.d.ts +3 -0
  142. package/dist/entries/textarea.js +4 -0
  143. package/dist/entries/tooltip.d.ts +3 -0
  144. package/dist/entries/tooltip.js +4 -0
  145. package/dist/layouts/form-layout/form-layout.js +1 -1
  146. package/dist/layouts/stack/stack.js +1 -1
  147. package/dist/number-input/number-input.js +1 -1
  148. package/dist/number-input/use-number-input.d.ts +2 -2
  149. package/dist/number-input/use-number-input.js +224 -131
  150. package/dist/number-input/validate.js +7 -2
  151. package/dist/provider/tao-provider.js +1 -1
  152. package/dist/utils/dialog-content.d.ts +10 -0
  153. package/dist/utils/dialog-content.js +222 -0
  154. package/dist/utils/overlay.d.ts +2 -2
  155. package/dist/utils/overlay.js +8 -3
  156. package/dist/utils/refs.js +17 -2
  157. package/llms.txt +5 -3
  158. 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(t0) {
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
- let t5;
23
- if ($[0] !== columnsProp || $[1] !== screens) {
24
- t5 = columnsProp.some(_temp) ? columnsProp.filter((col)=>!col.responsive || col.responsive.some((bp)=>screens[bp])) : columnsProp;
25
- $[0] = columnsProp;
26
- $[1] = screens;
27
- $[2] = t5;
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
- let defaultSortCol;
58
- let t6;
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
- let t8;
76
- if ($[7] !== columns) {
77
- t8 = ()=>{
78
- const init = {};
79
- for(let i = 0; i < columns.length; i++){
80
- const col_1 = columns[i];
81
- if (col_1.filters) {
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
- return init;
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
- $[7] = columns;
89
- $[8] = t8;
90
- } else t8 = $[8];
91
- const [filterValues, setFilterValues] = useState(t8);
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
- let t9;
99
- if ($[9] !== columns) {
100
- t9 = (key_0, order)=>{
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
- $[11] = columns;
131
- $[12] = t10;
132
- } else t10 = $[12];
133
- const buildFiltersRecord = t10;
134
- let t11;
135
- if ($[13] !== buildFiltersRecord || $[14] !== buildSorterResult || $[15] !== onChange) {
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
- $[13] = buildFiltersRecord;
143
- $[14] = buildSorterResult;
144
- $[15] = onChange;
145
- $[16] = t11;
146
- } else t11 = $[16];
147
- const triggerChange = t11;
148
- let t12;
149
- if ($[17] !== currentPage || $[18] !== filterValues || $[19] !== pageSize || $[20] !== sortKey || $[21] !== sortOrder || $[22] !== triggerChange) {
150
- t12 = (colKey, col_4)=>{
151
- if (void 0 !== col_4.sortOrder) return void triggerChange(currentPage, pageSize, colKey, nextSortOrder(col_4.sortOrder), filterValues);
152
- const next = sortKey === colKey ? nextSortOrder(sortOrder) : "ascend";
153
- const newKey = null === next ? null : colKey;
154
- setSortKey(newKey);
155
- setSortOrder(next);
156
- triggerChange(currentPage, pageSize, newKey, next, filterValues);
157
- };
158
- $[17] = currentPage;
159
- $[18] = filterValues;
160
- $[19] = pageSize;
161
- $[20] = sortKey;
162
- $[21] = sortOrder;
163
- $[22] = triggerChange;
164
- $[23] = t12;
165
- } else t12 = $[23];
166
- const handleSort = t12;
167
- let t13;
168
- if ($[24] !== filterValues || $[25] !== pageSize || $[26] !== sortKey || $[27] !== sortOrder || $[28] !== triggerChange) {
169
- t13 = (colKey_0, values)=>{
170
- const next_0 = {
171
- ...filterValues,
172
- [colKey_0]: values
173
- };
174
- setFilterValues(next_0);
175
- setInternalPage(1);
176
- triggerChange(1, pageSize, sortKey, sortOrder, next_0);
177
- };
178
- $[24] = filterValues;
179
- $[25] = pageSize;
180
- $[26] = sortKey;
181
- $[27] = sortOrder;
182
- $[28] = triggerChange;
183
- $[29] = t13;
184
- } else t13 = $[29];
185
- const handleFilter = t13;
186
- let t14;
187
- if ($[30] !== filterValues || $[31] !== sortKey || $[32] !== sortOrder || $[33] !== triggerChange) {
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
- $[30] = filterValues;
194
- $[31] = sortKey;
195
- $[32] = sortOrder;
196
- $[33] = triggerChange;
197
- $[34] = t14;
198
- } else t14 = $[34];
199
- const handlePageChange = t14;
200
- let data;
201
- if ($[35] !== columns || $[36] !== dataSource || $[37] !== filterValues || $[38] !== sortKey || $[39] !== sortOrder) {
202
- data = [
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 i_2 = 0; i_2 < columns.length; i_2++){
206
- const col_5 = columns[i_2];
207
- if (!col_5.filters || !col_5.onFilter) continue;
208
- const key_2 = getColKey(col_5, i_2);
209
- const controlledValues = col_5.filteredValue;
210
- const activeVals = controlledValues ?? filterValues[key_2];
211
- if (activeVals && activeVals.length > 0) data = data.filter((record)=>activeVals.some((v)=>col_5.onFilter(v, record)));
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
- let t15;
214
- if ($[41] !== sortKey || $[42] !== sortOrder) {
215
- t15 = (col_6, i_3)=>{
216
- const key_3 = getColKey(col_6, i_3);
217
- const order_0 = void 0 !== col_6.sortOrder ? col_6.sortOrder : sortKey === key_3 ? sortOrder : null;
218
- return null !== order_0 && "function" == typeof col_6.sorter;
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 key_4 = getColKey(activeSortCol, colIdx_0);
228
- const order_1 = void 0 !== activeSortCol.sortOrder ? activeSortCol.sortOrder : sortKey === key_4 ? sortOrder : null;
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 "descend" === order_1 ? -result_0 : result_0;
198
+ return 'descend' === order_2 ? -result_0 : result_0;
233
199
  });
234
200
  }
235
- $[35] = columns;
236
- $[36] = dataSource;
237
- $[37] = filterValues;
238
- $[38] = sortKey;
239
- $[39] = sortOrder;
240
- $[40] = data;
241
- } else data = $[40];
242
- const processedData = data;
201
+ return data;
202
+ }, [
203
+ dataSource,
204
+ columns,
205
+ filterValues,
206
+ sortKey,
207
+ sortOrder
208
+ ]);
243
209
  const totalForPagination = paginationConfig?.total ?? processedData.length;
244
- let t15;
245
- bb0: {
246
- if (!hasPagination) {
247
- t15 = processedData;
248
- break bb0;
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
- let t16;
256
- if ($[44] !== pageSize || $[45] !== processedData || $[46] !== start) {
257
- t16 = processedData.slice(start, start + pageSize);
258
- $[44] = pageSize;
259
- $[45] = processedData;
260
- $[46] = start;
261
- $[47] = t16;
262
- } else t16 = $[47];
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 ?? "checkbox";
268
- let t16;
269
- if ($[48] !== rowSelection?.selectedRowKeys) {
270
- t16 = rowSelection?.selectedRowKeys ?? [];
271
- $[48] = rowSelection?.selectedRowKeys;
272
- $[49] = t16;
273
- } else t16 = $[49];
274
- const selectedKeys = t16;
275
- let t17;
276
- if ($[50] !== dataSource || $[51] !== rowKey || $[52] !== rowSelection || $[53] !== selectedKeys || $[54] !== selectionType) {
277
- t17 = (key_5)=>{
278
- if (!rowSelection?.onChange) return;
279
- let nextKeys;
280
- nextKeys = "radio" === selectionType ? [
281
- key_5
282
- ] : selectedKeys.includes(key_5) ? selectedKeys.filter((k)=>k !== key_5) : [
283
- ...selectedKeys,
284
- key_5
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
- $[64] = t21;
351
- $[65] = t22;
352
- } else t22 = $[65];
353
- useEffect(t20, t22);
354
- let cols;
355
- if ($[66] !== columns || $[67] !== rowSelection || $[68] !== selectionColWidth) {
356
- cols = [];
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: "__selection__",
301
+ _key: '__selection__',
359
302
  _index: -1,
360
303
  width: selectionColWidth,
361
- fixed: rowSelection.fixed ? "left" : void 0
304
+ fixed: rowSelection.fixed ? 'left' : void 0
362
305
  });
363
- columns.forEach((col_7, i_4)=>{
306
+ columns.forEach((col_9, i_6)=>{
364
307
  cols.push({
365
- ...col_7,
366
- _key: getColKey(col_7, i_4),
367
- _index: i_4
308
+ ...col_9,
309
+ _key: getColKey(col_9, i_6),
310
+ _index: i_6
368
311
  });
369
312
  });
370
- $[66] = columns;
371
- $[67] = rowSelection;
372
- $[68] = selectionColWidth;
373
- $[69] = cols;
374
- } else cols = $[69];
375
- const allColumns = cols;
376
- let t23;
377
- if ($[70] !== allColumns || $[71] !== scroll?.x) {
378
- t23 = ()=>{
379
- if (!scroll?.x) return {};
380
- const positions = {};
381
- let leftOffset = 0;
382
- for (const col_8 of allColumns)if ("left" === col_8.fixed) {
383
- positions[col_8._key] = {
384
- left: leftOffset
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
- leftOffset += "number" == typeof col_8.width ? col_8.width : 0;
336
+ rightOffset += 'number' == typeof col_11.width ? col_11.width : 0;
387
337
  }
388
- let rightOffset = 0;
389
- for(let i_5 = allColumns.length - 1; i_5 >= 0; i_5--){
390
- const col_9 = allColumns[i_5];
391
- if ("right" === col_9.fixed) {
392
- positions[col_9._key] = {
393
- right: rightOffset
394
- };
395
- rightOffset += "number" == typeof col_9.width ? col_9.width : 0;
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: "number" == typeof scroll.x ? `${scroll.x}px` : scroll.x
349
+ minWidth: 'number' == typeof scroll.x ? `${scroll.x}px` : scroll.x
425
350
  } : {};
426
- let t26;
427
- if ($[78] !== paginatedData || $[79] !== rowKey || $[80] !== rowSelection || $[81] !== selectedKeys) {
428
- t26 = paginatedData.length > 0 && paginatedData.filter((r_3)=>!rowSelection?.getCheckboxProps?.(r_3)?.disabled).every((r_4)=>selectedKeys.includes(getRowKey(r_4, rowKey)));
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 : "off",
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
- t27,
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["header.wrapper"],
597
- style: resolvedStyles["header.wrapper"],
598
- children: /*#__PURE__*/ jsxs("tr", {
599
- ...headerRowProps,
600
- className: cx(resolvedClassNames["header.row"], headerRowProps.className),
601
- style: {
602
- ...resolvedStyles["header.row"],
603
- ...headerRowProps.style
604
- },
605
- children: [
606
- rowSelection && /*#__PURE__*/ jsx("th", {
607
- "data-tao-table-cell": "",
608
- "data-tao-table-selection-cell": "",
609
- "data-tao-fixed": "left",
610
- className: resolvedClassNames["selection.cell"],
611
- style: {
612
- width: selectionColWidth,
613
- ...stickyPositions.__selection__ ? {
614
- position: "sticky",
615
- left: stickyPositions.__selection__.left,
616
- zIndex: 2
617
- } : {},
618
- ...resolvedStyles["selection.cell"]
619
- },
620
- children: "checkbox" === selectionType && /*#__PURE__*/ jsx("input", {
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
- onChange: (e)=>handleSelectAll(e.target.checked),
628
- "data-tao-table-checkbox": ""
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
- columns.map((col_11, i_6)=>{
632
- const colKey_2 = getColKey(col_11, i_6);
633
- const hasSorter = !!col_11.sorter;
634
- const hasFilter = !!(col_11.filters && col_11.filters.length > 0);
635
- const resolvedOrder = getResolvedSortOrder(col_11, colKey_2);
636
- const controlledFilterValues = col_11.filteredValue;
637
- const activeFilterValues = controlledFilterValues ?? filterValues[colKey_2] ?? [];
638
- const stickyPos = stickyPositions[colKey_2];
639
- const isFixed = !!col_11.fixed && !!scroll?.x;
640
- const headerCellProps = col_11.onHeaderCell?.(col_11) ?? {};
641
- return /*#__PURE__*/ createElement("th", {
642
- ...headerCellProps,
643
- key: colKey_2,
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-header": "",
646
- "data-tao-align": col_11.align,
647
- "data-tao-fixed": isFixed ? col_11.fixed : void 0,
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
- ...resolvedStyles["header.cell"],
652
- width: col_11.width,
653
- ...isFixed && stickyPos ? {
654
- position: "sticky",
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
- ...headerCellProps.style
664
- }
665
- }, /*#__PURE__*/ jsxs("div", {
666
- "data-tao-table-header-content": "",
667
- className: resolvedClassNames["header.content"],
668
- style: resolvedStyles["header.content"],
669
- children: [
670
- hasSorter ? /*#__PURE__*/ jsxs("button", {
671
- type: "button",
672
- "data-tao-table-header-title": "",
673
- "data-tao-sortable": "",
674
- className: resolvedClassNames["header.title"],
675
- style: resolvedStyles["header.title"],
676
- onClick: ()=>handleSort(colKey_2, col_11),
677
- children: [
678
- col_11.title,
679
- /*#__PURE__*/ jsx(SortIcon, {
680
- order: resolvedOrder
681
- })
682
- ]
683
- }) : /*#__PURE__*/ jsx("span", {
684
- "data-tao-table-header-title": "",
685
- className: resolvedClassNames["header.title"],
686
- style: resolvedStyles["header.title"],
687
- children: col_11.title
688
- }),
689
- hasFilter && /*#__PURE__*/ jsx(TableFilterDropdown, {
690
- filters: col_11.filters,
691
- activeValues: activeFilterValues,
692
- onSelect: (vals_0)=>handleFilter(colKey_2, vals_0)
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
- t31
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 };