@expcat/tigercat-react 1.2.37 → 1.2.41
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/dist/{chunk-2CJKAO2I.mjs → chunk-2VE2CP7E.mjs} +144 -9
- package/dist/{chunk-JNRUOQNT.js → chunk-36I5APFX.js} +2 -2
- package/dist/{chunk-C3NKZZQQ.js → chunk-AE2QE2C6.js} +2 -2
- package/dist/{chunk-4XOWNEZA.mjs → chunk-C44WSDEY.mjs} +19 -4
- package/dist/{chunk-6HELKWFN.js → chunk-JIFSUUGA.js} +19 -4
- package/dist/{chunk-AKZY7QYA.js → chunk-JLQBG5XU.js} +23 -17
- package/dist/{chunk-L2CAJUXH.js → chunk-LHBE3N3U.js} +162 -27
- package/dist/{chunk-IAONLOJN.js → chunk-LYYL2JMP.js} +2 -2
- package/dist/{chunk-UKBVJWP3.mjs → chunk-MV54EEKO.mjs} +1 -1
- package/dist/{chunk-KRFD27WA.js → chunk-OBY4FYRZ.js} +2 -2
- package/dist/{chunk-O4UDB6ZE.mjs → chunk-TANTMMR7.mjs} +1 -1
- package/dist/{chunk-WVTUGFWO.mjs → chunk-TYZNV54N.mjs} +23 -17
- package/dist/{chunk-ZGPOMSGD.mjs → chunk-WYGO6XC7.mjs} +232 -74
- package/dist/{chunk-MIINT2WV.js → chunk-XUETAIF3.js} +264 -106
- package/dist/{chunk-VE2YEFG2.mjs → chunk-ZDS5WL22.mjs} +1 -1
- package/dist/{chunk-73OAHAPC.mjs → chunk-ZL44XLSB.mjs} +1 -1
- package/dist/components/ChatWindow.js +3 -3
- package/dist/components/ChatWindow.mjs +2 -2
- package/dist/components/DataTableWithToolbar.d.mts +2 -2
- package/dist/components/DataTableWithToolbar.d.ts +2 -2
- package/dist/components/DataTableWithToolbar.js +12 -3
- package/dist/components/DataTableWithToolbar.mjs +11 -2
- package/dist/components/Dropdown.js +2 -2
- package/dist/components/Dropdown.mjs +1 -1
- package/dist/components/DropdownItem.js +3 -3
- package/dist/components/DropdownItem.mjs +2 -2
- package/dist/components/DropdownMenu.js +2 -2
- package/dist/components/DropdownMenu.mjs +1 -1
- package/dist/components/Popconfirm.js +3 -3
- package/dist/components/Popconfirm.mjs +2 -2
- package/dist/components/Popover.js +3 -3
- package/dist/components/Popover.mjs +2 -2
- package/dist/components/Table.d.mts +2 -2
- package/dist/components/Table.d.ts +2 -2
- package/dist/components/Table.js +9 -2
- package/dist/components/Table.mjs +8 -1
- package/dist/components/Tooltip.js +3 -3
- package/dist/components/Tooltip.mjs +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -20
- package/dist/index.mjs +20 -20
- package/dist/{types-mtq1tZJd.d.ts → types-CHmCMNEM.d.mts} +1 -0
- package/dist/{types-mtq1tZJd.d.mts → types-CHmCMNEM.d.ts} +1 -0
- package/package.json +2 -2
- package/dist/{chunk-7KPALCG3.js → chunk-ABTJVM3X.js} +2 -2
- package/dist/{chunk-GYFR2O27.mjs → chunk-OXDX6CH2.mjs} +3 -3
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
+
var _chunk6Z4LLPZAjs = require('./chunk-6Z4LLPZA.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkTMON4MPOjs = require('./chunk-TMON4MPO.js');
|
|
7
|
+
|
|
8
|
+
|
|
3
9
|
var _chunkTDODFBBOjs = require('./chunk-TDODFBBO.js');
|
|
4
10
|
|
|
11
|
+
|
|
12
|
+
var _chunkZRHDNGWOjs = require('./chunk-ZRHDNGWO.js');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunkF7H4ALKNjs = require('./chunk-F7H4ALKN.js');
|
|
16
|
+
|
|
5
17
|
// src/components/Table.tsx
|
|
6
18
|
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
7
19
|
|
|
@@ -21,6 +33,9 @@ var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
|
21
33
|
|
|
22
34
|
|
|
23
35
|
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
24
39
|
|
|
25
40
|
|
|
26
41
|
var _tigercatcore = require('@expcat/tigercat-core');
|
|
@@ -103,10 +118,13 @@ var LoadingSpinner = () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
|
103
118
|
|
|
104
119
|
|
|
105
120
|
|
|
121
|
+
|
|
106
122
|
function useTableState(input) {
|
|
107
123
|
const {
|
|
108
124
|
columns,
|
|
109
125
|
dataSource,
|
|
126
|
+
hiddenColumnKeys,
|
|
127
|
+
defaultHiddenColumnKeys,
|
|
110
128
|
sort,
|
|
111
129
|
defaultSort,
|
|
112
130
|
filters,
|
|
@@ -128,6 +146,7 @@ function useTableState(input) {
|
|
|
128
146
|
onSelectionChange,
|
|
129
147
|
onSortChange,
|
|
130
148
|
onFilterChange,
|
|
149
|
+
onHiddenColumnsChange,
|
|
131
150
|
onPageChange,
|
|
132
151
|
onExpandChange,
|
|
133
152
|
onCellChange,
|
|
@@ -137,6 +156,7 @@ function useTableState(input) {
|
|
|
137
156
|
} = input;
|
|
138
157
|
const isSortControlled = sort !== void 0;
|
|
139
158
|
const isFiltersControlled = filters !== void 0;
|
|
159
|
+
const isHiddenColumnsControlled = hiddenColumnKeys !== void 0;
|
|
140
160
|
const paginationConfig = pagination !== false && typeof pagination === "object" ? pagination : null;
|
|
141
161
|
const isCurrentPageControlled = _optionalChain([paginationConfig, 'optionalAccess', _ => _.current]) !== void 0;
|
|
142
162
|
const isPageSizeControlled = _optionalChain([paginationConfig, 'optionalAccess', _2 => _2.pageSize]) !== void 0;
|
|
@@ -145,6 +165,9 @@ function useTableState(input) {
|
|
|
145
165
|
const [uncontrolledSortState, setUncontrolledSortState] = _react.useState.call(void 0,
|
|
146
166
|
_nullishCoalesce(defaultSort, () => ( { key: null, direction: null }))
|
|
147
167
|
);
|
|
168
|
+
const [uncontrolledHiddenColumnKeys, setUncontrolledHiddenColumnKeys] = _react.useState.call(void 0,
|
|
169
|
+
_nullishCoalesce(_nullishCoalesce(defaultHiddenColumnKeys, () => ( hiddenColumnKeys)), () => ( []))
|
|
170
|
+
);
|
|
148
171
|
const [uncontrolledFilterState, setUncontrolledFilterState] = _react.useState.call(void 0,
|
|
149
172
|
_nullishCoalesce(defaultFilters, () => ( {}))
|
|
150
173
|
);
|
|
@@ -157,6 +180,7 @@ function useTableState(input) {
|
|
|
157
180
|
const [uncontrolledSelectedRowKeys, setUncontrolledSelectedRowKeys] = _react.useState.call(void 0, _nullishCoalesce(_nullishCoalesce(_optionalChain([rowSelection, 'optionalAccess', _9 => _9.defaultSelectedRowKeys]), () => ( _optionalChain([rowSelection, 'optionalAccess', _10 => _10.selectedRowKeys]))), () => ( [])));
|
|
158
181
|
const [uncontrolledExpandedRowKeys, setUncontrolledExpandedRowKeys] = _react.useState.call(void 0, _nullishCoalesce(_nullishCoalesce(_optionalChain([expandable, 'optionalAccess', _11 => _11.defaultExpandedRowKeys]), () => ( _optionalChain([expandable, 'optionalAccess', _12 => _12.expandedRowKeys]))), () => ( [])));
|
|
159
182
|
const sortState = isSortControlled ? sort : uncontrolledSortState;
|
|
183
|
+
const effectiveHiddenColumnKeys = isHiddenColumnsControlled ? hiddenColumnKeys : uncontrolledHiddenColumnKeys;
|
|
160
184
|
const filterState = isFiltersControlled ? filters : uncontrolledFilterState;
|
|
161
185
|
const currentPage = isCurrentPageControlled ? paginationConfig.current : uncontrolledCurrentPage;
|
|
162
186
|
const currentPageSize = isPageSizeControlled ? paginationConfig.pageSize : uncontrolledCurrentPageSize;
|
|
@@ -187,6 +211,11 @@ function useTableState(input) {
|
|
|
187
211
|
setUncontrolledSelectedRowKeys(_nullishCoalesce(_optionalChain([rowSelection, 'optionalAccess', _17 => _17.selectedRowKeys]), () => ( [])));
|
|
188
212
|
}
|
|
189
213
|
}, [isSelectionControlled, _optionalChain([rowSelection, 'optionalAccess', _18 => _18.selectedRowKeys])]);
|
|
214
|
+
_react.useEffect.call(void 0, () => {
|
|
215
|
+
if (isHiddenColumnsControlled && hiddenColumnKeys) {
|
|
216
|
+
setUncontrolledHiddenColumnKeys(hiddenColumnKeys);
|
|
217
|
+
}
|
|
218
|
+
}, [isHiddenColumnsControlled, hiddenColumnKeys]);
|
|
190
219
|
_react.useEffect.call(void 0, () => {
|
|
191
220
|
if (isExpandControlled) {
|
|
192
221
|
setUncontrolledExpandedRowKeys(_nullishCoalesce(_optionalChain([expandable, 'optionalAccess', _19 => _19.expandedRowKeys]), () => ( [])));
|
|
@@ -194,14 +223,15 @@ function useTableState(input) {
|
|
|
194
223
|
}, [isExpandControlled, _optionalChain([expandable, 'optionalAccess', _20 => _20.expandedRowKeys])]);
|
|
195
224
|
const [fixedOverrides, setFixedOverrides] = _react.useState.call(void 0, {});
|
|
196
225
|
const displayColumns = _react.useMemo.call(void 0, () => {
|
|
197
|
-
|
|
226
|
+
const mapped = columns.map((column) => {
|
|
198
227
|
const hasOverride = Object.prototype.hasOwnProperty.call(fixedOverrides, column.key);
|
|
199
228
|
return {
|
|
200
229
|
...column,
|
|
201
230
|
fixed: hasOverride ? fixedOverrides[column.key] : column.fixed
|
|
202
231
|
};
|
|
203
232
|
});
|
|
204
|
-
|
|
233
|
+
return _tigercatcore.filterHiddenColumns.call(void 0, mapped, effectiveHiddenColumnKeys);
|
|
234
|
+
}, [columns, fixedOverrides, effectiveHiddenColumnKeys]);
|
|
205
235
|
const totalColumnCount = _react.useMemo.call(void 0, () => {
|
|
206
236
|
let count = displayColumns.length;
|
|
207
237
|
if (rowSelection && rowSelection.showCheckbox !== false) count++;
|
|
@@ -219,9 +249,15 @@ function useTableState(input) {
|
|
|
219
249
|
() => _tigercatcore.getFixedColumnOffsets.call(void 0, displayColumns, measuredColumnWidths),
|
|
220
250
|
[displayColumns, measuredColumnWidths]
|
|
221
251
|
);
|
|
252
|
+
function handleSetHiddenColumns(hiddenKeys) {
|
|
253
|
+
if (!isHiddenColumnsControlled) {
|
|
254
|
+
setUncontrolledHiddenColumnKeys(hiddenKeys);
|
|
255
|
+
}
|
|
256
|
+
_optionalChain([onHiddenColumnsChange, 'optionalCall', _21 => _21(hiddenKeys)]);
|
|
257
|
+
}
|
|
222
258
|
function toggleColumnLock(columnKey) {
|
|
223
259
|
setFixedOverrides((prev) => {
|
|
224
|
-
const original = _optionalChain([columns, 'access',
|
|
260
|
+
const original = _optionalChain([columns, 'access', _22 => _22.find, 'call', _23 => _23((c) => c.key === columnKey), 'optionalAccess', _24 => _24.fixed]);
|
|
225
261
|
const current = Object.prototype.hasOwnProperty.call(prev, columnKey) ? prev[columnKey] : original;
|
|
226
262
|
const isLocked = current === "left" || current === "right";
|
|
227
263
|
return {
|
|
@@ -239,7 +275,7 @@ function useTableState(input) {
|
|
|
239
275
|
}
|
|
240
276
|
if (sortState.key && sortState.direction) {
|
|
241
277
|
const column = columnByKey[sortState.key];
|
|
242
|
-
data = _tigercatcore.sortData.call(void 0, data, sortState.key, sortState.direction, _optionalChain([column, 'optionalAccess',
|
|
278
|
+
data = _tigercatcore.sortData.call(void 0, data, sortState.key, sortState.direction, _optionalChain([column, 'optionalAccess', _25 => _25.sortFn]));
|
|
243
279
|
}
|
|
244
280
|
return data;
|
|
245
281
|
}, [dataSource, filterState, sortState, columnByKey, filterMode, advancedFilterRules]);
|
|
@@ -265,9 +301,20 @@ function useTableState(input) {
|
|
|
265
301
|
if (pagination === false) {
|
|
266
302
|
return null;
|
|
267
303
|
}
|
|
268
|
-
const total = _optionalChain([paginationConfig, 'optionalAccess',
|
|
304
|
+
const total = _optionalChain([paginationConfig, 'optionalAccess', _26 => _26.total]) !== void 0 && paginationConfig.total > 0 ? paginationConfig.total : processedData.length;
|
|
269
305
|
return _tigercatcore.calculatePagination.call(void 0, total, currentPage, currentPageSize);
|
|
270
|
-
}, [processedData.length, currentPage, currentPageSize, pagination, _optionalChain([paginationConfig, 'optionalAccess',
|
|
306
|
+
}, [processedData.length, currentPage, currentPageSize, pagination, _optionalChain([paginationConfig, 'optionalAccess', _27 => _27.total])]);
|
|
307
|
+
function handleSetSort(newSortState) {
|
|
308
|
+
if (!isSortControlled) {
|
|
309
|
+
setUncontrolledSortState(newSortState);
|
|
310
|
+
}
|
|
311
|
+
_optionalChain([onSortChange, 'optionalCall', _28 => _28(newSortState)]);
|
|
312
|
+
_optionalChain([onChange, 'optionalCall', _29 => _29({
|
|
313
|
+
sort: newSortState,
|
|
314
|
+
filters: filterState,
|
|
315
|
+
pagination: pagination !== false ? { current: currentPage, pageSize: currentPageSize } : null
|
|
316
|
+
})]);
|
|
317
|
+
}
|
|
271
318
|
function handleSort(columnKey) {
|
|
272
319
|
const column = columnByKey[columnKey];
|
|
273
320
|
if (!column || !column.sortable) return;
|
|
@@ -279,19 +326,10 @@ function useTableState(input) {
|
|
|
279
326
|
newDirection = null;
|
|
280
327
|
}
|
|
281
328
|
}
|
|
282
|
-
|
|
329
|
+
handleSetSort({
|
|
283
330
|
key: newDirection ? columnKey : null,
|
|
284
331
|
direction: newDirection
|
|
285
|
-
};
|
|
286
|
-
if (!isSortControlled) {
|
|
287
|
-
setUncontrolledSortState(newSortState);
|
|
288
|
-
}
|
|
289
|
-
_optionalChain([onSortChange, 'optionalCall', _27 => _27(newSortState)]);
|
|
290
|
-
_optionalChain([onChange, 'optionalCall', _28 => _28({
|
|
291
|
-
sort: newSortState,
|
|
292
|
-
filters: filterState,
|
|
293
|
-
pagination: pagination !== false ? { current: currentPage, pageSize: currentPageSize } : null
|
|
294
|
-
})]);
|
|
332
|
+
});
|
|
295
333
|
}
|
|
296
334
|
function handleFilter(columnKey, value) {
|
|
297
335
|
const newFilterState = { ...filterState, [columnKey]: value };
|
|
@@ -299,8 +337,8 @@ function useTableState(input) {
|
|
|
299
337
|
setUncontrolledFilterState(newFilterState);
|
|
300
338
|
}
|
|
301
339
|
setUncontrolledCurrentPage(1);
|
|
302
|
-
_optionalChain([onFilterChange, 'optionalCall',
|
|
303
|
-
_optionalChain([onChange, 'optionalCall',
|
|
340
|
+
_optionalChain([onFilterChange, 'optionalCall', _30 => _30(newFilterState)]);
|
|
341
|
+
_optionalChain([onChange, 'optionalCall', _31 => _31({
|
|
304
342
|
sort: sortState,
|
|
305
343
|
filters: newFilterState,
|
|
306
344
|
pagination: pagination !== false ? { current: 1, pageSize: currentPageSize } : null
|
|
@@ -308,8 +346,8 @@ function useTableState(input) {
|
|
|
308
346
|
}
|
|
309
347
|
function handlePageChange(page) {
|
|
310
348
|
setUncontrolledCurrentPage(page);
|
|
311
|
-
_optionalChain([onPageChange, 'optionalCall',
|
|
312
|
-
_optionalChain([onChange, 'optionalCall',
|
|
349
|
+
_optionalChain([onPageChange, 'optionalCall', _32 => _32({ current: page, pageSize: currentPageSize })]);
|
|
350
|
+
_optionalChain([onChange, 'optionalCall', _33 => _33({
|
|
313
351
|
sort: sortState,
|
|
314
352
|
filters: filterState,
|
|
315
353
|
pagination: { current: page, pageSize: currentPageSize }
|
|
@@ -318,8 +356,8 @@ function useTableState(input) {
|
|
|
318
356
|
function handlePageSizeChange(pageSize) {
|
|
319
357
|
setUncontrolledCurrentPageSize(pageSize);
|
|
320
358
|
setUncontrolledCurrentPage(1);
|
|
321
|
-
_optionalChain([onPageChange, 'optionalCall',
|
|
322
|
-
_optionalChain([onChange, 'optionalCall',
|
|
359
|
+
_optionalChain([onPageChange, 'optionalCall', _34 => _34({ current: 1, pageSize })]);
|
|
360
|
+
_optionalChain([onChange, 'optionalCall', _35 => _35({
|
|
323
361
|
sort: sortState,
|
|
324
362
|
filters: filterState,
|
|
325
363
|
pagination: { current: 1, pageSize }
|
|
@@ -331,12 +369,12 @@ function useTableState(input) {
|
|
|
331
369
|
if (!isExpandControlled) {
|
|
332
370
|
setUncontrolledExpandedRowKeys(newKeys);
|
|
333
371
|
}
|
|
334
|
-
_optionalChain([onExpandChange, 'optionalCall',
|
|
372
|
+
_optionalChain([onExpandChange, 'optionalCall', _36 => _36(newKeys, record, !isExpanded)]);
|
|
335
373
|
}
|
|
336
374
|
function handleRowClick(record, index, key) {
|
|
337
|
-
_optionalChain([onRowClick, 'optionalCall',
|
|
338
|
-
if (_optionalChain([expandable, 'optionalAccess',
|
|
339
|
-
const isExpandableRow = _optionalChain([expandable, 'optionalAccess',
|
|
375
|
+
_optionalChain([onRowClick, 'optionalCall', _37 => _37(record, index)]);
|
|
376
|
+
if (_optionalChain([expandable, 'optionalAccess', _38 => _38.expandRowByClick])) {
|
|
377
|
+
const isExpandableRow = _optionalChain([expandable, 'optionalAccess', _39 => _39.rowExpandable]) ? expandable.rowExpandable(record) : true;
|
|
340
378
|
if (isExpandableRow) {
|
|
341
379
|
handleToggleExpand(key, record);
|
|
342
380
|
}
|
|
@@ -344,7 +382,7 @@ function useTableState(input) {
|
|
|
344
382
|
}
|
|
345
383
|
function handleSelectRow(key, checked) {
|
|
346
384
|
let newKeys;
|
|
347
|
-
if (_optionalChain([rowSelection, 'optionalAccess',
|
|
385
|
+
if (_optionalChain([rowSelection, 'optionalAccess', _40 => _40.type]) === "radio") {
|
|
348
386
|
newKeys = checked ? [key] : [];
|
|
349
387
|
} else {
|
|
350
388
|
if (checked) {
|
|
@@ -356,7 +394,7 @@ function useTableState(input) {
|
|
|
356
394
|
if (!isSelectionControlled) {
|
|
357
395
|
setUncontrolledSelectedRowKeys(newKeys);
|
|
358
396
|
}
|
|
359
|
-
_optionalChain([onSelectionChange, 'optionalCall',
|
|
397
|
+
_optionalChain([onSelectionChange, 'optionalCall', _41 => _41(newKeys)]);
|
|
360
398
|
}
|
|
361
399
|
function handleSelectAll(checked) {
|
|
362
400
|
if (checked) {
|
|
@@ -364,12 +402,12 @@ function useTableState(input) {
|
|
|
364
402
|
if (!isSelectionControlled) {
|
|
365
403
|
setUncontrolledSelectedRowKeys(newKeys);
|
|
366
404
|
}
|
|
367
|
-
_optionalChain([onSelectionChange, 'optionalCall',
|
|
405
|
+
_optionalChain([onSelectionChange, 'optionalCall', _42 => _42(newKeys)]);
|
|
368
406
|
} else {
|
|
369
407
|
if (!isSelectionControlled) {
|
|
370
408
|
setUncontrolledSelectedRowKeys([]);
|
|
371
409
|
}
|
|
372
|
-
_optionalChain([onSelectionChange, 'optionalCall',
|
|
410
|
+
_optionalChain([onSelectionChange, 'optionalCall', _43 => _43([])]);
|
|
373
411
|
}
|
|
374
412
|
}
|
|
375
413
|
const allSelected = _react.useMemo.call(void 0, () => {
|
|
@@ -387,7 +425,7 @@ function useTableState(input) {
|
|
|
387
425
|
function isCellEditable(columnKey, rowIndex) {
|
|
388
426
|
if (!editable) return false;
|
|
389
427
|
if (!editableCells) return true;
|
|
390
|
-
return !!_optionalChain([editableCells, 'access',
|
|
428
|
+
return !!_optionalChain([editableCells, 'access', _44 => _44.get, 'call', _45 => _45(columnKey), 'optionalAccess', _46 => _46.has, 'call', _47 => _47(rowIndex)]);
|
|
391
429
|
}
|
|
392
430
|
function startEditing(rowIndex, columnKey, currentValue) {
|
|
393
431
|
setEditingCell({ rowIndex, columnKey });
|
|
@@ -395,7 +433,7 @@ function useTableState(input) {
|
|
|
395
433
|
}
|
|
396
434
|
function commitEdit() {
|
|
397
435
|
if (editingCell) {
|
|
398
|
-
_optionalChain([onCellChange, 'optionalCall',
|
|
436
|
+
_optionalChain([onCellChange, 'optionalCall', _48 => _48(editingCell.rowIndex, editingCell.columnKey, editingValue)]);
|
|
399
437
|
setEditingCell(null);
|
|
400
438
|
}
|
|
401
439
|
}
|
|
@@ -405,7 +443,7 @@ function useTableState(input) {
|
|
|
405
443
|
function handleExport() {
|
|
406
444
|
const content = _tigercatcore.exportTableData.call(void 0, displayColumns, processedData, exportFormat);
|
|
407
445
|
_tigercatcore.downloadTableExport.call(void 0, content, exportFilename, exportFormat);
|
|
408
|
-
_optionalChain([onExport, 'optionalCall',
|
|
446
|
+
_optionalChain([onExport, 'optionalCall', _49 => _49(content)]);
|
|
409
447
|
}
|
|
410
448
|
const [dragColumnKey, setDragColumnKey] = _react.useState.call(void 0, null);
|
|
411
449
|
function handleDragStart(columnKey) {
|
|
@@ -419,7 +457,7 @@ function useTableState(input) {
|
|
|
419
457
|
if (fromIdx >= 0 && toIdx >= 0) {
|
|
420
458
|
const [moved] = cols.splice(fromIdx, 1);
|
|
421
459
|
cols.splice(toIdx, 0, moved);
|
|
422
|
-
_optionalChain([onColumnOrderChange, 'optionalCall',
|
|
460
|
+
_optionalChain([onColumnOrderChange, 'optionalCall', _50 => _50(cols)]);
|
|
423
461
|
}
|
|
424
462
|
setDragColumnKey(null);
|
|
425
463
|
}
|
|
@@ -435,7 +473,7 @@ function useTableState(input) {
|
|
|
435
473
|
if (fromIdx >= 0 && toIdx >= 0) {
|
|
436
474
|
const [moved] = rows.splice(fromIdx, 1);
|
|
437
475
|
rows.splice(toIdx, 0, moved);
|
|
438
|
-
_optionalChain([onRowOrderChange, 'optionalCall',
|
|
476
|
+
_optionalChain([onRowOrderChange, 'optionalCall', _51 => _51(rows)]);
|
|
439
477
|
}
|
|
440
478
|
setDragRowKey(null);
|
|
441
479
|
}
|
|
@@ -460,14 +498,17 @@ function useTableState(input) {
|
|
|
460
498
|
sortState,
|
|
461
499
|
currentPage,
|
|
462
500
|
currentPageSize,
|
|
501
|
+
hiddenColumnKeys: effectiveHiddenColumnKeys,
|
|
463
502
|
editingCell,
|
|
464
503
|
editingValue,
|
|
465
504
|
setEditingValue,
|
|
466
505
|
toggleColumnLock,
|
|
506
|
+
handleSetHiddenColumns,
|
|
467
507
|
handleSort,
|
|
468
508
|
handleFilter,
|
|
469
509
|
handlePageChange,
|
|
470
510
|
handlePageSizeChange,
|
|
511
|
+
handleSetSort,
|
|
471
512
|
handleRowClick,
|
|
472
513
|
handleToggleExpand,
|
|
473
514
|
handleSelectRow,
|
|
@@ -498,7 +539,7 @@ function useTableState(input) {
|
|
|
498
539
|
function renderTableHeader(ctx, view) {
|
|
499
540
|
const { size, stickyHeader, rowSelection, expandable, columnLockable, columnDraggable } = view;
|
|
500
541
|
const expandHeaderTh = expandable ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "th", { className: _tigercatcore.getExpandIconCellClasses.call(void 0, size), "aria-label": "Expand" }) : null;
|
|
501
|
-
const expandAtStart = _optionalChain([expandable, 'optionalAccess',
|
|
542
|
+
const expandAtStart = _optionalChain([expandable, 'optionalAccess', _52 => _52.expandIconPosition]) !== "end";
|
|
502
543
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "thead", { className: _tigercatcore.getTableHeaderClasses.call(void 0, stickyHeader), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { children: [
|
|
503
544
|
expandAtStart && expandHeaderTh,
|
|
504
545
|
rowSelection && rowSelection.showCheckbox !== false && rowSelection.type !== "radio" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "th", { className: _tigercatcore.getCheckboxCellClasses.call(void 0, size), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -636,7 +677,7 @@ function renderTableBody(ctx, view) {
|
|
|
636
677
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tbody", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tr", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { colSpan: ctx.totalColumnCount, className: _tigercatcore.tableEmptyStateClasses, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { role: "status", "aria-live": "polite", children: emptyText }) }) }) });
|
|
637
678
|
}
|
|
638
679
|
function getDelegatedRow(event) {
|
|
639
|
-
const row = _optionalChain([event, 'access',
|
|
680
|
+
const row = _optionalChain([event, 'access', _53 => _53.target, 'optionalAccess', _54 => _54.closest, 'call', _55 => _55(
|
|
640
681
|
"tr[data-tiger-table-row-index]"
|
|
641
682
|
)]);
|
|
642
683
|
if (!row) return null;
|
|
@@ -688,7 +729,7 @@ function renderTableBody(ctx, view) {
|
|
|
688
729
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ExpandIcon, { expanded: isExpanded })
|
|
689
730
|
}
|
|
690
731
|
) }) : null;
|
|
691
|
-
const expandAtStart = _optionalChain([expandable, 'optionalAccess',
|
|
732
|
+
const expandAtStart = _optionalChain([expandable, 'optionalAccess', _56 => _56.expandIconPosition]) !== "end";
|
|
692
733
|
const rowNode = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
693
734
|
"tr",
|
|
694
735
|
{
|
|
@@ -703,10 +744,10 @@ function renderTableBody(ctx, view) {
|
|
|
703
744
|
rowSelection && rowSelection.showCheckbox !== false && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: _tigercatcore.getCheckboxCellClasses.call(void 0, size), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
704
745
|
"input",
|
|
705
746
|
{
|
|
706
|
-
type: _optionalChain([rowSelection, 'optionalAccess',
|
|
707
|
-
className: _optionalChain([rowSelection, 'optionalAccess',
|
|
747
|
+
type: _optionalChain([rowSelection, 'optionalAccess', _57 => _57.type]) === "radio" ? "radio" : "checkbox",
|
|
748
|
+
className: _optionalChain([rowSelection, 'optionalAccess', _58 => _58.type]) === "radio" ? "border-gray-300 text-[var(--tiger-primary,#2563eb)] focus:ring-[var(--tiger-primary,#2563eb)]" : "rounded border-gray-300 text-[var(--tiger-primary,#2563eb)] focus:ring-[var(--tiger-primary,#2563eb)]",
|
|
708
749
|
checked: isSelected,
|
|
709
|
-
disabled: _optionalChain([rowSelection, 'optionalAccess',
|
|
750
|
+
disabled: _optionalChain([rowSelection, 'optionalAccess', _59 => _59.getCheckboxProps, 'optionalCall', _60 => _60(record), 'optionalAccess', _61 => _61.disabled]),
|
|
710
751
|
onChange: (e) => ctx.handleSelectRow(key, e.target.checked),
|
|
711
752
|
onClick: (e) => e.stopPropagation()
|
|
712
753
|
}
|
|
@@ -730,7 +771,7 @@ function renderTableBody(ctx, view) {
|
|
|
730
771
|
hoverable,
|
|
731
772
|
fixedInfo: ctx.fixedColumnsInfo
|
|
732
773
|
});
|
|
733
|
-
const isEditing = _optionalChain([ctx, 'access',
|
|
774
|
+
const isEditing = _optionalChain([ctx, 'access', _62 => _62.editingCell, 'optionalAccess', _63 => _63.rowIndex]) === index && _optionalChain([ctx, 'access', _64 => _64.editingCell, 'optionalAccess', _65 => _65.columnKey]) === column.key;
|
|
734
775
|
const cellEditable = ctx.isCellEditable(column.key, index);
|
|
735
776
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
736
777
|
"td",
|
|
@@ -817,7 +858,7 @@ function renderTableBody(ctx, view) {
|
|
|
817
858
|
|
|
818
859
|
function renderSummaryRow(ctx, view) {
|
|
819
860
|
const { size, rowSelection, expandable, summaryRow } = view;
|
|
820
|
-
if (!_optionalChain([summaryRow, 'optionalAccess',
|
|
861
|
+
if (!_optionalChain([summaryRow, 'optionalAccess', _66 => _66.show])) return null;
|
|
821
862
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "tfoot", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "tr", { className: _tigercatcore.tableSummaryRowClasses, children: [
|
|
822
863
|
rowSelection && rowSelection.showCheckbox !== false && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: _tigercatcore.getTableCellClasses.call(void 0, size, "left") }),
|
|
823
864
|
expandable && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "td", { className: _tigercatcore.getTableCellClasses.call(void 0, size, "left") }),
|
|
@@ -850,7 +891,7 @@ function renderPagination(ctx, view) {
|
|
|
850
891
|
const total = paginationConfig.total !== void 0 && paginationConfig.total > 0 ? paginationConfig.total : ctx.processedData.length;
|
|
851
892
|
const locale = view.disableI18n ? void 0 : view.locale;
|
|
852
893
|
const labels = _tigercatcore.getPaginationLabels.call(void 0, locale);
|
|
853
|
-
const localeCode = _optionalChain([locale, 'optionalAccess',
|
|
894
|
+
const localeCode = _optionalChain([locale, 'optionalAccess', _67 => _67.locale]);
|
|
854
895
|
const finalTotalText = paginationConfig.totalText ? paginationConfig.totalText(total, [startIndex, endIndex]) : _tigercatcore.formatPaginationTotal.call(void 0, labels.totalText, total, [startIndex, endIndex], localeCode);
|
|
855
896
|
const finalPrevText = paginationConfig.prevText || labels.prevPageAriaLabel;
|
|
856
897
|
const finalNextText = paginationConfig.nextText || labels.nextPageAriaLabel;
|
|
@@ -920,6 +961,8 @@ function Table({
|
|
|
920
961
|
columns,
|
|
921
962
|
columnLockable = false,
|
|
922
963
|
dataSource = [],
|
|
964
|
+
hiddenColumnKeys,
|
|
965
|
+
defaultHiddenColumnKeys,
|
|
923
966
|
sort,
|
|
924
967
|
defaultSort,
|
|
925
968
|
filters,
|
|
@@ -929,7 +972,9 @@ function Table({
|
|
|
929
972
|
striped = false,
|
|
930
973
|
hoverable = true,
|
|
931
974
|
loading = false,
|
|
932
|
-
|
|
975
|
+
locale,
|
|
976
|
+
labels,
|
|
977
|
+
emptyText,
|
|
933
978
|
pagination = {
|
|
934
979
|
current: 1,
|
|
935
980
|
pageSize: 10,
|
|
@@ -947,6 +992,8 @@ function Table({
|
|
|
947
992
|
tableLayout = "auto",
|
|
948
993
|
responsiveMode = "scroll",
|
|
949
994
|
cardBreakpoint = "sm",
|
|
995
|
+
cardClassName,
|
|
996
|
+
renderCard,
|
|
950
997
|
// v0.6.0 props
|
|
951
998
|
virtual = false,
|
|
952
999
|
autoVirtual = true,
|
|
@@ -970,6 +1017,7 @@ function Table({
|
|
|
970
1017
|
onSelectionChange,
|
|
971
1018
|
onSortChange,
|
|
972
1019
|
onFilterChange,
|
|
1020
|
+
onHiddenColumnsChange,
|
|
973
1021
|
onPageChange,
|
|
974
1022
|
onExpandChange,
|
|
975
1023
|
onCellChange,
|
|
@@ -988,12 +1036,20 @@ function Table({
|
|
|
988
1036
|
const internalExpandable = expandable;
|
|
989
1037
|
const internalRowClassName = rowClassName;
|
|
990
1038
|
const paginationLocaleInput = pagination !== false && typeof pagination === "object" ? pagination.locale : void 0;
|
|
1039
|
+
const tableLocaleInput = locale;
|
|
991
1040
|
const isPaginationI18nDisabled = paginationLocaleInput === false;
|
|
992
1041
|
const immediatePaginationLocale = _react.useMemo.call(void 0,
|
|
993
1042
|
() => paginationLocaleInput && !isPaginationI18nDisabled ? _tigercatcore.getImmediateTigerLocale.call(void 0, paginationLocaleInput) : void 0,
|
|
994
1043
|
[isPaginationI18nDisabled, paginationLocaleInput]
|
|
995
1044
|
);
|
|
996
1045
|
const [resolvedPaginationLocale, setResolvedPaginationLocale] = _react.useState.call(void 0, immediatePaginationLocale);
|
|
1046
|
+
const immediateTableLocale = _react.useMemo.call(void 0,
|
|
1047
|
+
() => tableLocaleInput ? _tigercatcore.getImmediateTigerLocale.call(void 0, tableLocaleInput) : void 0,
|
|
1048
|
+
[tableLocaleInput]
|
|
1049
|
+
);
|
|
1050
|
+
const [resolvedTableLocale, setResolvedTableLocale] = _react.useState.call(void 0,
|
|
1051
|
+
immediateTableLocale
|
|
1052
|
+
);
|
|
997
1053
|
_react.useEffect.call(void 0, () => {
|
|
998
1054
|
let active = true;
|
|
999
1055
|
setResolvedPaginationLocale(immediatePaginationLocale);
|
|
@@ -1008,13 +1064,41 @@ function Table({
|
|
|
1008
1064
|
active = false;
|
|
1009
1065
|
};
|
|
1010
1066
|
}, [isPaginationI18nDisabled, paginationLocaleInput, immediatePaginationLocale]);
|
|
1067
|
+
_react.useEffect.call(void 0, () => {
|
|
1068
|
+
let active = true;
|
|
1069
|
+
setResolvedTableLocale(immediateTableLocale);
|
|
1070
|
+
if (tableLocaleInput && _tigercatcore.isLazyTigerLocale.call(void 0, tableLocaleInput)) {
|
|
1071
|
+
_tigercatcore.resolveTigerLocale.call(void 0, tableLocaleInput).then((nextLocale) => {
|
|
1072
|
+
if (active) setResolvedTableLocale(nextLocale);
|
|
1073
|
+
}).catch(() => {
|
|
1074
|
+
if (active) setResolvedTableLocale(immediateTableLocale);
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
return () => {
|
|
1078
|
+
active = false;
|
|
1079
|
+
};
|
|
1080
|
+
}, [tableLocaleInput, immediateTableLocale]);
|
|
1011
1081
|
const paginationLocale = _react.useMemo.call(void 0,
|
|
1012
1082
|
() => isPaginationI18nDisabled ? void 0 : _tigercatcore.mergeTigerLocale.call(void 0, config.locale, resolvedPaginationLocale),
|
|
1013
1083
|
[config.locale, isPaginationI18nDisabled, resolvedPaginationLocale]
|
|
1014
1084
|
);
|
|
1085
|
+
const tableLocale = _react.useMemo.call(void 0,
|
|
1086
|
+
() => _tigercatcore.mergeTigerLocale.call(void 0, config.locale, resolvedTableLocale),
|
|
1087
|
+
[config.locale, resolvedTableLocale]
|
|
1088
|
+
);
|
|
1089
|
+
const tableLabelOverrides = _react.useMemo.call(void 0,
|
|
1090
|
+
() => emptyText === void 0 ? labels : { ...labels, emptyText },
|
|
1091
|
+
[emptyText, labels]
|
|
1092
|
+
);
|
|
1093
|
+
const tableLabels = _react.useMemo.call(void 0,
|
|
1094
|
+
() => _tigercatcore.getTableLabels.call(void 0, tableLocale, tableLabelOverrides),
|
|
1095
|
+
[tableLabelOverrides, tableLocale]
|
|
1096
|
+
);
|
|
1015
1097
|
const ctx = useTableState({
|
|
1016
1098
|
columns,
|
|
1017
1099
|
dataSource,
|
|
1100
|
+
hiddenColumnKeys,
|
|
1101
|
+
defaultHiddenColumnKeys,
|
|
1018
1102
|
sort,
|
|
1019
1103
|
defaultSort,
|
|
1020
1104
|
filters,
|
|
@@ -1036,6 +1120,7 @@ function Table({
|
|
|
1036
1120
|
onSelectionChange,
|
|
1037
1121
|
onSortChange,
|
|
1038
1122
|
onFilterChange,
|
|
1123
|
+
onHiddenColumnsChange,
|
|
1039
1124
|
onPageChange,
|
|
1040
1125
|
onExpandChange,
|
|
1041
1126
|
onCellChange,
|
|
@@ -1129,7 +1214,7 @@ function Table({
|
|
|
1129
1214
|
hoverable,
|
|
1130
1215
|
striped,
|
|
1131
1216
|
loading,
|
|
1132
|
-
emptyText,
|
|
1217
|
+
emptyText: tableLabels.emptyText,
|
|
1133
1218
|
rowSelection: internalRowSelection,
|
|
1134
1219
|
expandable: internalExpandable,
|
|
1135
1220
|
rowClassName: internalRowClassName,
|
|
@@ -1144,68 +1229,141 @@ function Table({
|
|
|
1144
1229
|
]
|
|
1145
1230
|
}
|
|
1146
1231
|
),
|
|
1147
|
-
responsiveMode === "card" && /* @__PURE__ */ _jsxruntime.
|
|
1232
|
+
responsiveMode === "card" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1148
1233
|
"div",
|
|
1149
1234
|
{
|
|
1150
1235
|
className: _tigercatcore.getTableResponsiveCardListClasses.call(void 0, cardBreakpoint),
|
|
1151
1236
|
"data-tiger-table-mobile": "card",
|
|
1152
|
-
children:
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
const isRowExpandable = internalExpandable ? internalExpandable.rowExpandable ? internalExpandable.rowExpandable(record) : true : false;
|
|
1156
|
-
const expandedContent = internalExpandable && isExpanded && isRowExpandable ? _optionalChain([internalExpandable, 'access', _67 => _67.expandedRowRender, 'optionalCall', _68 => _68(record, index)]) : null;
|
|
1157
|
-
const expandedNode = expandedContent;
|
|
1158
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1159
|
-
"div",
|
|
1237
|
+
children: [
|
|
1238
|
+
_optionalChain([internalRowSelection, 'optionalAccess', _68 => _68.type]) !== "radio" && _optionalChain([internalRowSelection, 'optionalAccess', _69 => _69.showCheckbox]) !== false && internalRowSelection && ctx.paginatedData.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-between rounded-[var(--tiger-radius-md,0.5rem)] border border-[var(--tiger-border,#e5e7eb)] bg-[var(--tiger-surface,#ffffff)] px-3 py-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1239
|
+
_chunkF7H4ALKNjs.Checkbox,
|
|
1160
1240
|
{
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
{
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
(
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1241
|
+
size: "sm",
|
|
1242
|
+
checked: ctx.allSelected,
|
|
1243
|
+
indeterminate: ctx.someSelected,
|
|
1244
|
+
onChange: (checked) => ctx.handleSelectAll(checked),
|
|
1245
|
+
children: tableLabels.selectAllText
|
|
1246
|
+
}
|
|
1247
|
+
) }) : null,
|
|
1248
|
+
ctx.displayColumns.some((column) => column.sortable) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "rounded-[var(--tiger-radius-md,0.5rem)] border border-[var(--tiger-border,#e5e7eb)] bg-[var(--tiger-surface,#ffffff)] px-3 py-2", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1249
|
+
_chunk6Z4LLPZAjs.Select,
|
|
1250
|
+
{
|
|
1251
|
+
size: "sm",
|
|
1252
|
+
value: ctx.sortState.key && ctx.sortState.direction ? `${ctx.sortState.key}:${ctx.sortState.direction}` : "",
|
|
1253
|
+
options: [
|
|
1254
|
+
{ label: tableLabels.clearSortText, value: "" },
|
|
1255
|
+
...ctx.displayColumns.filter((column) => column.sortable).flatMap((column) => [
|
|
1256
|
+
{
|
|
1257
|
+
label: `${_tigercatcore.formatTableSortByText.call(void 0, tableLabels.sortByText, column.title)} \u2191`,
|
|
1258
|
+
value: `${column.key}:asc`
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
label: `${_tigercatcore.formatTableSortByText.call(void 0, tableLabels.sortByText, column.title)} \u2193`,
|
|
1262
|
+
value: `${column.key}:desc`
|
|
1263
|
+
}
|
|
1264
|
+
])
|
|
1265
|
+
],
|
|
1266
|
+
clearable: false,
|
|
1267
|
+
onChange: (value) => {
|
|
1268
|
+
const nextValue = String(_nullishCoalesce(value, () => ( "")));
|
|
1269
|
+
if (!nextValue) {
|
|
1270
|
+
ctx.handleSetSort({ key: null, direction: null });
|
|
1271
|
+
return;
|
|
1272
|
+
}
|
|
1273
|
+
const separatorIndex = nextValue.lastIndexOf(":");
|
|
1274
|
+
const key = nextValue.slice(0, separatorIndex);
|
|
1275
|
+
const direction = nextValue.slice(separatorIndex + 1);
|
|
1276
|
+
ctx.handleSetSort({ key, direction });
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
) }) : null,
|
|
1280
|
+
ctx.paginatedData.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.tableResponsiveCardClasses, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkZRHDNGWOjs.Empty, { showImage: false, description: tableLabels.emptyText }) }) : ctx.paginatedData.map((record, index) => {
|
|
1281
|
+
const key = ctx.pageRowKeys[index];
|
|
1282
|
+
const isExpanded = ctx.expandedRowKeySet.has(key);
|
|
1283
|
+
const isSelected = ctx.selectedRowKeySet.has(key);
|
|
1284
|
+
const isRowExpandable = internalExpandable ? internalExpandable.rowExpandable ? internalExpandable.rowExpandable(record) : true : false;
|
|
1285
|
+
const expandedContent = internalExpandable && isExpanded && isRowExpandable ? _optionalChain([internalExpandable, 'access', _70 => _70.expandedRowRender, 'optionalCall', _71 => _71(record, index)]) : null;
|
|
1286
|
+
const expandedNode = expandedContent;
|
|
1287
|
+
const renderContext = {
|
|
1288
|
+
record,
|
|
1289
|
+
index,
|
|
1290
|
+
columns: ctx.displayColumns,
|
|
1291
|
+
selected: isSelected,
|
|
1292
|
+
expanded: isExpanded,
|
|
1293
|
+
toggleExpand: () => ctx.handleToggleExpand(key, record),
|
|
1294
|
+
selectRow: (checked) => ctx.handleSelectRow(key, checked)
|
|
1295
|
+
};
|
|
1296
|
+
const customCard = _optionalChain([renderCard, 'optionalCall', _72 => _72(renderContext)]);
|
|
1297
|
+
const resolvedCardClassName = typeof cardClassName === "function" ? cardClassName(record, index) : cardClassName;
|
|
1298
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1299
|
+
"div",
|
|
1300
|
+
{
|
|
1301
|
+
className: _tigercatcore.classNames.call(void 0, _tigercatcore.tableResponsiveCardClasses, resolvedCardClassName),
|
|
1302
|
+
onClick: () => ctx.handleRowClick(record, index, key),
|
|
1303
|
+
children: customCard !== void 0 && customCard !== null ? customCard : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1304
|
+
_optionalChain([internalRowSelection, 'optionalAccess', _73 => _73.showCheckbox]) !== false && internalRowSelection || internalExpandable && isRowExpandable ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "mb-2 flex items-center gap-3", children: [
|
|
1305
|
+
internalRowSelection && internalRowSelection.showCheckbox !== false && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { onClick: (event) => event.stopPropagation(), children: internalRowSelection.type === "radio" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1306
|
+
_chunkTMON4MPOjs.Radio,
|
|
1307
|
+
{
|
|
1308
|
+
value: key,
|
|
1309
|
+
checked: isSelected,
|
|
1310
|
+
disabled: _optionalChain([internalRowSelection, 'access', _74 => _74.getCheckboxProps, 'optionalCall', _75 => _75(record), 'optionalAccess', _76 => _76.disabled]),
|
|
1311
|
+
"aria-label": _tigercatcore.formatTableSelectRowAriaLabel.call(void 0,
|
|
1312
|
+
tableLabels.selectRowAriaLabel,
|
|
1313
|
+
index + 1,
|
|
1314
|
+
_optionalChain([tableLocale, 'optionalAccess', _77 => _77.locale])
|
|
1315
|
+
),
|
|
1316
|
+
onChange: () => ctx.handleSelectRow(key, true)
|
|
1317
|
+
}
|
|
1318
|
+
) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1319
|
+
_chunkF7H4ALKNjs.Checkbox,
|
|
1320
|
+
{
|
|
1321
|
+
size: "sm",
|
|
1322
|
+
checked: isSelected,
|
|
1323
|
+
disabled: _optionalChain([internalRowSelection, 'access', _78 => _78.getCheckboxProps, 'optionalCall', _79 => _79(record), 'optionalAccess', _80 => _80.disabled]),
|
|
1324
|
+
"aria-label": _tigercatcore.formatTableSelectRowAriaLabel.call(void 0,
|
|
1325
|
+
tableLabels.selectRowAriaLabel,
|
|
1326
|
+
index + 1,
|
|
1327
|
+
_optionalChain([tableLocale, 'optionalAccess', _81 => _81.locale])
|
|
1328
|
+
),
|
|
1329
|
+
onChange: (checked) => ctx.handleSelectRow(key, checked)
|
|
1330
|
+
}
|
|
1331
|
+
) }),
|
|
1332
|
+
internalExpandable && isRowExpandable && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1333
|
+
"button",
|
|
1334
|
+
{
|
|
1335
|
+
type: "button",
|
|
1336
|
+
className: "text-sm text-[var(--tiger-primary,#2563eb)]",
|
|
1337
|
+
"aria-expanded": isExpanded,
|
|
1338
|
+
onClick: (event) => {
|
|
1339
|
+
event.stopPropagation();
|
|
1340
|
+
ctx.handleToggleExpand(key, record);
|
|
1341
|
+
},
|
|
1342
|
+
children: isExpanded ? tableLabels.collapseText : tableLabels.expandText
|
|
1343
|
+
}
|
|
1344
|
+
)
|
|
1345
|
+
] }) : null,
|
|
1346
|
+
(() => {
|
|
1347
|
+
const { titleColumn, bodyColumns } = _tigercatcore.getCardColumns.call(void 0, ctx.displayColumns);
|
|
1348
|
+
const renderCellContent = (column) => {
|
|
1349
|
+
const dataKey = column.dataKey || column.key;
|
|
1350
|
+
return column.render ? column.render(record, index) : record[dataKey];
|
|
1351
|
+
};
|
|
1352
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1353
|
+
titleColumn && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.tableResponsiveCardTitleClasses, children: renderCellContent(titleColumn) }),
|
|
1354
|
+
bodyColumns.map((column) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _tigercatcore.tableResponsiveCardRowClasses, children: [
|
|
1355
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.tableResponsiveCardLabelClasses, children: column.title }),
|
|
1356
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _tigercatcore.tableResponsiveCardValueClasses, children: renderCellContent(column) })
|
|
1357
|
+
] }, column.key))
|
|
1358
|
+
] });
|
|
1359
|
+
})(),
|
|
1360
|
+
expandedNode && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mt-3 border-t border-[var(--tiger-border,#e5e7eb)] pt-3", children: expandedNode })
|
|
1361
|
+
] })
|
|
1362
|
+
},
|
|
1363
|
+
key
|
|
1364
|
+
);
|
|
1365
|
+
})
|
|
1366
|
+
]
|
|
1209
1367
|
}
|
|
1210
1368
|
),
|
|
1211
1369
|
loading && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -1214,10 +1372,10 @@ function Table({
|
|
|
1214
1372
|
className: _tigercatcore.tableLoadingOverlayClasses,
|
|
1215
1373
|
role: "status",
|
|
1216
1374
|
"aria-live": "polite",
|
|
1217
|
-
"aria-label":
|
|
1375
|
+
"aria-label": tableLabels.loadingText,
|
|
1218
1376
|
children: [
|
|
1219
1377
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoadingSpinner, {}),
|
|
1220
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", children:
|
|
1378
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", children: tableLabels.loadingText })
|
|
1221
1379
|
]
|
|
1222
1380
|
}
|
|
1223
1381
|
),
|