@rockshin/tao-ui 0.0.37 → 0.0.38

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.
@@ -1,18 +1,26 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { createElement, useEffect, useRef, useState } from "react";
2
+ import { Fragment, createElement, isValidElement, useEffect, useRef, useState } from "react";
3
3
  import { c } from "react-compiler-runtime";
4
4
  import { useTaoConfig } from "../../provider/tao-provider.js";
5
5
  import { useBreakpoint } from "../../utils/breakpoint.js";
6
6
  import { cx } from "../../utils/semantic.js";
7
7
  import { Pagination } from "../pagination/pagination.js";
8
8
  import { TableFilterDropdown } from "./table-filter.js";
9
- import { SortIcon, TableLoadingSpinner } from "./table-icons.js";
9
+ import { ExpandIcon, SortIcon, TableLoadingSpinner } from "./table-icons.js";
10
10
  import { getCellValue, getColKey, getRowKey, resolveRowClassName, resolveRowStyle, resolveSemanticClassNames, resolveSemanticStyles } from "./table-model.js";
11
+ import { TableSummary, TableSummaryContext } from "./table-summary.js";
11
12
  import { useTableData } from "./use-table-data.js";
12
13
  import "./table.css";
14
+ function stickyStyle(pos, zIndex) {
15
+ return pos ? {
16
+ position: 'sticky',
17
+ ...pos,
18
+ zIndex
19
+ } : void 0;
20
+ }
13
21
  function Table(t0) {
14
- const $ = c(62);
15
- 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;
22
+ const $ = c(89);
23
+ const { columns: columnsProp, dataSource, rowKey, loading: t1, pagination: paginationProp, onChange, scroll, rowSelection, expandable, summary, size, variant, headerBackground: t2, emptyText: t3, bordered: t4, className, style, classNames, styles, rowClassName, rowStyle, onRow, onHeaderRow } = t0;
16
24
  const loading = void 0 === t1 ? false : t1;
17
25
  const headerBackground = void 0 === t2 ? true : t2;
18
26
  const emptyText = void 0 === t3 ? "No Data" : t3;
@@ -39,6 +47,8 @@ function Table(t0) {
39
47
  onChange,
40
48
  scroll,
41
49
  rowSelection,
50
+ expandable,
51
+ summary,
42
52
  rowClassName,
43
53
  rowStyle,
44
54
  onRow,
@@ -158,46 +168,93 @@ function Table(t0) {
158
168
  $[33] = t11;
159
169
  } else t11 = $[33];
160
170
  const handleSelectAll = t11;
171
+ const expandColWidth = expandable?.columnWidth ?? 48;
172
+ let t12;
173
+ if ($[34] !== expandable?.defaultExpandedRowKeys) {
174
+ t12 = ()=>expandable?.defaultExpandedRowKeys ?? [];
175
+ $[34] = expandable?.defaultExpandedRowKeys;
176
+ $[35] = t12;
177
+ } else t12 = $[35];
178
+ const [internalExpandedKeys, setInternalExpandedKeys] = useState(t12);
179
+ const expandedKeys = expandable?.expandedRowKeys ?? internalExpandedKeys;
180
+ let t13;
181
+ if ($[36] !== expandedKeys) {
182
+ t13 = new Set(expandedKeys);
183
+ $[36] = expandedKeys;
184
+ $[37] = t13;
185
+ } else t13 = $[37];
186
+ const expandedKeySet = t13;
187
+ let t14;
188
+ if ($[38] !== expandable || $[39] !== expandedKeySet || $[40] !== expandedKeys) {
189
+ t14 = (record_2, key_1)=>{
190
+ const expanded = !expandedKeySet.has(key_1);
191
+ const nextKeys_1 = expanded ? [
192
+ ...expandedKeys,
193
+ key_1
194
+ ] : expandedKeys.filter((k_0)=>k_0 !== key_1);
195
+ if (expandable?.expandedRowKeys === void 0) setInternalExpandedKeys(nextKeys_1);
196
+ expandable?.onExpand?.(expanded, record_2);
197
+ expandable?.onExpandedRowsChange?.(nextKeys_1);
198
+ };
199
+ $[38] = expandable;
200
+ $[39] = expandedKeySet;
201
+ $[40] = expandedKeys;
202
+ $[41] = t14;
203
+ } else t14 = $[41];
204
+ const toggleExpand = t14;
161
205
  const scrollRef = useRef(null);
206
+ const [viewportWidth, setViewportWidth] = useState();
162
207
  const [scrollState, setScrollState] = useState("left");
163
- let t12;
164
- if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
165
- t12 = ()=>{
208
+ let t15;
209
+ if ($[42] === Symbol.for("react.memo_cache_sentinel")) {
210
+ t15 = ()=>{
166
211
  const el = scrollRef.current;
167
212
  if (!el) return;
168
213
  const { scrollLeft, scrollWidth, clientWidth } = el;
169
214
  const atLeft = scrollLeft <= 1;
170
215
  const atRight = scrollLeft + clientWidth >= scrollWidth - 1;
216
+ setViewportWidth(clientWidth);
171
217
  if (atLeft && atRight) setScrollState("both");
172
218
  else if (atLeft) setScrollState("left");
173
219
  else atRight ? setScrollState("right") : setScrollState("middle");
174
220
  };
175
- $[34] = t12;
176
- } else t12 = $[34];
177
- const handleScroll = t12;
178
- let t13;
179
- if ($[35] !== scroll?.x) {
180
- t13 = ()=>{
181
- if (!scroll?.x) return;
221
+ $[42] = t15;
222
+ } else t15 = $[42];
223
+ const handleScroll = t15;
224
+ let t16;
225
+ if ($[43] !== scroll?.x) {
226
+ t16 = ()=>{
227
+ const el_0 = scrollRef.current;
228
+ if (!scroll?.x || !el_0) return;
182
229
  handleScroll();
230
+ const observer = new ResizeObserver(handleScroll);
231
+ observer.observe(el_0);
232
+ if (el_0.firstElementChild) observer.observe(el_0.firstElementChild);
233
+ return ()=>observer.disconnect();
183
234
  };
184
- $[35] = scroll?.x;
185
- $[36] = t13;
186
- } else t13 = $[36];
187
- const t14 = scroll?.x;
188
- let t15;
189
- if ($[37] !== t14) {
190
- t15 = [
191
- t14,
235
+ $[43] = scroll?.x;
236
+ $[44] = t16;
237
+ } else t16 = $[44];
238
+ const t17 = scroll?.x;
239
+ let t18;
240
+ if ($[45] !== t17) {
241
+ t18 = [
242
+ t17,
192
243
  handleScroll
193
244
  ];
194
- $[37] = t14;
195
- $[38] = t15;
196
- } else t15 = $[38];
197
- useEffect(t13, t15);
245
+ $[45] = t17;
246
+ $[46] = t18;
247
+ } else t18 = $[46];
248
+ useEffect(t16, t18);
198
249
  let cols;
199
- if ($[39] !== columns || $[40] !== rowSelection || $[41] !== selectionColWidth) {
250
+ if ($[47] !== columns || $[48] !== expandColWidth || $[49] !== expandable || $[50] !== rowSelection || $[51] !== selectionColWidth) {
200
251
  cols = [];
252
+ if (expandable) cols.push({
253
+ _key: "__expand__",
254
+ _index: -2,
255
+ width: expandColWidth,
256
+ fixed: expandable.fixed ? "left" : void 0
257
+ });
201
258
  if (rowSelection) cols.push({
202
259
  _key: "__selection__",
203
260
  _index: -1,
@@ -211,15 +268,17 @@ function Table(t0) {
211
268
  _index: i
212
269
  });
213
270
  });
214
- $[39] = columns;
215
- $[40] = rowSelection;
216
- $[41] = selectionColWidth;
217
- $[42] = cols;
218
- } else cols = $[42];
271
+ $[47] = columns;
272
+ $[48] = expandColWidth;
273
+ $[49] = expandable;
274
+ $[50] = rowSelection;
275
+ $[51] = selectionColWidth;
276
+ $[52] = cols;
277
+ } else cols = $[52];
219
278
  const allColumns = cols;
220
- let t16;
221
- if ($[43] !== allColumns || $[44] !== scroll?.x) {
222
- t16 = ()=>{
279
+ let t19;
280
+ if ($[53] !== allColumns || $[54] !== scroll?.x) {
281
+ t19 = ()=>{
223
282
  if (!scroll?.x) return {};
224
283
  const positions = {};
225
284
  let leftOffset = 0;
@@ -241,138 +300,224 @@ function Table(t0) {
241
300
  }
242
301
  return positions;
243
302
  };
244
- $[43] = allColumns;
245
- $[44] = scroll?.x;
246
- $[45] = t16;
247
- } else t16 = $[45];
303
+ $[53] = allColumns;
304
+ $[54] = scroll?.x;
305
+ $[55] = t19;
306
+ } else t19 = $[55];
248
307
  scroll?.x;
249
- let t17;
250
- if ($[46] !== t16) {
251
- t17 = t16();
252
- $[46] = t16;
253
- $[47] = t17;
254
- } else t17 = $[47];
255
- const stickyPositions = t17;
308
+ let t20;
309
+ if ($[56] !== t19) {
310
+ t20 = t19();
311
+ $[56] = t19;
312
+ $[57] = t20;
313
+ } else t20 = $[57];
314
+ const stickyPositions = t20;
315
+ let t21;
316
+ if ($[58] !== allColumns || $[59] !== stickyPositions) {
317
+ t21 = allColumns.map((col_4)=>({
318
+ fixed: col_4.fixed,
319
+ sticky: stickyPositions[col_4._key]
320
+ }));
321
+ $[58] = allColumns;
322
+ $[59] = stickyPositions;
323
+ $[60] = t21;
324
+ } else t21 = $[60];
325
+ const summaryColumns = t21;
326
+ let summaryNode;
327
+ let t22;
328
+ if ($[61] !== paginatedData || $[62] !== summary) {
329
+ summaryNode = summary?.(paginatedData);
330
+ t22 = /*#__PURE__*/ isValidElement(summaryNode) && summaryNode.type === TableSummary && !!summaryNode.props.fixed;
331
+ $[61] = paginatedData;
332
+ $[62] = summary;
333
+ $[63] = summaryNode;
334
+ $[64] = t22;
335
+ } else {
336
+ summaryNode = $[63];
337
+ t22 = $[64];
338
+ }
339
+ const summaryFixed = t22;
256
340
  const tableStyle = scroll?.x ? {
257
341
  minWidth: "number" == typeof scroll.x ? `${scroll.x}px` : scroll.x
258
342
  } : {};
259
- let t18;
260
- if ($[48] !== selectablePageKeys || $[49] !== selectedKeySet) {
261
- let t19;
262
- if ($[51] !== selectedKeySet) {
263
- t19 = (key_1)=>selectedKeySet.has(key_1);
264
- $[51] = selectedKeySet;
265
- $[52] = t19;
266
- } else t19 = $[52];
267
- t18 = selectablePageKeys.filter(t19);
268
- $[48] = selectablePageKeys;
269
- $[49] = selectedKeySet;
270
- $[50] = t18;
271
- } else t18 = $[50];
272
- const selectedPageCount = t18.length;
343
+ let t23;
344
+ if ($[65] !== selectablePageKeys || $[66] !== selectedKeySet) {
345
+ let t24;
346
+ if ($[68] !== selectedKeySet) {
347
+ t24 = (key_2)=>selectedKeySet.has(key_2);
348
+ $[68] = selectedKeySet;
349
+ $[69] = t24;
350
+ } else t24 = $[69];
351
+ t23 = selectablePageKeys.filter(t24);
352
+ $[65] = selectablePageKeys;
353
+ $[66] = selectedKeySet;
354
+ $[67] = t23;
355
+ } else t23 = $[67];
356
+ const selectedPageCount = t23.length;
273
357
  const isAllSelected = selectablePageKeys.length > 0 && selectedPageCount === selectablePageKeys.length;
274
358
  const isIndeterminate = selectedPageCount > 0 && !isAllSelected;
275
- let t19;
276
- if ($[53] !== loading) {
277
- t19 = loading && /*#__PURE__*/ jsx(TableLoadingSpinner, {});
278
- $[53] = loading;
279
- $[54] = t19;
280
- } else t19 = $[54];
359
+ let t24;
360
+ if ($[70] !== loading) {
361
+ t24 = loading && /*#__PURE__*/ jsx(TableLoadingSpinner, {});
362
+ $[70] = loading;
363
+ $[71] = t24;
364
+ } else t24 = $[71];
281
365
  const headerRowProps = onHeaderRow?.(columns, 0) ?? {};
282
- const t20 = "";
283
- const t21 = 0 === paginatedData.length ? /*#__PURE__*/ jsx("tr", {
366
+ let t25;
367
+ if ($[72] !== expandColWidth || $[73] !== expandable || $[74] !== stickyPositions) {
368
+ t25 = expandable && /*#__PURE__*/ jsx("th", {
369
+ "data-tao-table-cell": "",
370
+ "data-tao-table-expand-cell": "",
371
+ "data-tao-fixed": stickyPositions.__expand__ ? "left" : void 0,
372
+ style: {
373
+ width: expandColWidth,
374
+ ...stickyStyle(stickyPositions.__expand__, 3)
375
+ }
376
+ });
377
+ $[72] = expandColWidth;
378
+ $[73] = expandable;
379
+ $[74] = stickyPositions;
380
+ $[75] = t25;
381
+ } else t25 = $[75];
382
+ const t26 = "";
383
+ const t27 = 0 === paginatedData.length ? /*#__PURE__*/ jsx("tr", {
284
384
  children: /*#__PURE__*/ jsx("td", {
285
385
  "data-tao-table-cell": "",
286
386
  "data-tao-table-empty": "",
287
- colSpan: columns.length + (rowSelection ? 1 : 0),
387
+ colSpan: allColumns.length,
288
388
  className: resolvedClassNames.empty,
289
389
  style: resolvedStyles.empty,
290
390
  children: emptyText
291
391
  })
292
- }) : paginatedData.map((record_2, rowIdx)=>{
293
- const key_2 = getRowKey(record_2, rowKey);
294
- const isSelected = selectedKeySet.has(key_2);
295
- const checkboxProps = rowSelection?.getCheckboxProps?.(record_2);
296
- const rowProps = onRow?.(record_2, rowIdx) ?? {};
297
- return /*#__PURE__*/ createElement("tr", {
298
- ...rowProps,
299
- key: key_2,
300
- "data-tao-table-row": "",
301
- "data-tao-selected": isSelected || void 0,
302
- className: cx(resolvedClassNames["body.row"], resolveRowClassName(rowClassName, record_2, rowIdx), rowProps.className),
303
- style: {
304
- ...resolvedStyles["body.row"],
305
- ...resolveRowStyle(rowStyle, record_2, rowIdx),
306
- ...rowProps.style
307
- },
392
+ }) : paginatedData.map((record_3, rowIdx)=>{
393
+ const key_3 = getRowKey(record_3, rowKey);
394
+ const isSelected = selectedKeySet.has(key_3);
395
+ const checkboxProps = rowSelection?.getCheckboxProps?.(record_3);
396
+ const rowProps = onRow?.(record_3, rowIdx) ?? {};
397
+ const rowExpandable = !!expandable && (expandable.rowExpandable?.(record_3) ?? true);
398
+ const isExpanded = rowExpandable && expandedKeySet.has(key_3);
399
+ return /*#__PURE__*/ jsxs(Fragment, {
308
400
  children: [
309
- rowSelection && /*#__PURE__*/ jsx("td", {
310
- "data-tao-table-cell": "",
311
- "data-tao-table-selection-cell": "",
312
- "data-tao-fixed": "left",
313
- className: resolvedClassNames["selection.cell"],
401
+ /*#__PURE__*/ jsxs("tr", {
402
+ ...rowProps,
403
+ "data-tao-table-row": "",
404
+ "data-tao-selected": isSelected || void 0,
405
+ onClick: rowExpandable && expandable?.expandRowByClick ? (e_0)=>{
406
+ rowProps.onClick?.(e_0);
407
+ toggleExpand(record_3, key_3);
408
+ } : rowProps.onClick,
409
+ className: cx(resolvedClassNames["body.row"], resolveRowClassName(rowClassName, record_3, rowIdx), rowProps.className),
314
410
  style: {
315
- ...stickyPositions.__selection__ ? {
316
- position: "sticky",
317
- left: stickyPositions.__selection__.left,
318
- zIndex: 1
319
- } : {},
320
- ...resolvedStyles["selection.cell"]
411
+ ...resolvedStyles["body.row"],
412
+ ...resolveRowStyle(rowStyle, record_3, rowIdx),
413
+ ...rowProps.style
321
414
  },
322
- children: /*#__PURE__*/ jsx("input", {
323
- type: "radio" === selectionType ? "radio" : "checkbox",
324
- checked: isSelected,
325
- "aria-label": `Select row ${String(key_2)}`,
326
- disabled: checkboxProps?.disabled,
327
- onChange: ()=>handleSelectRow(key_2),
328
- "data-tao-table-checkbox": ""
329
- })
415
+ children: [
416
+ expandable && /*#__PURE__*/ jsx("td", {
417
+ "data-tao-table-cell": "",
418
+ "data-tao-table-expand-cell": "",
419
+ "data-tao-fixed": stickyPositions.__expand__ ? "left" : void 0,
420
+ style: stickyStyle(stickyPositions.__expand__, 1),
421
+ children: rowExpandable && /*#__PURE__*/ jsx(ExpandIcon, {
422
+ expanded: isExpanded,
423
+ onClick: (e_1)=>{
424
+ e_1.stopPropagation();
425
+ toggleExpand(record_3, key_3);
426
+ }
427
+ })
428
+ }),
429
+ rowSelection && /*#__PURE__*/ jsx("td", {
430
+ "data-tao-table-cell": "",
431
+ "data-tao-table-selection-cell": "",
432
+ "data-tao-fixed": stickyPositions.__selection__ ? "left" : void 0,
433
+ className: resolvedClassNames["selection.cell"],
434
+ style: {
435
+ ...stickyStyle(stickyPositions.__selection__, 1),
436
+ ...resolvedStyles["selection.cell"]
437
+ },
438
+ children: /*#__PURE__*/ jsx("input", {
439
+ type: "radio" === selectionType ? "radio" : "checkbox",
440
+ checked: isSelected,
441
+ "aria-label": `Select row ${String(key_3)}`,
442
+ disabled: checkboxProps?.disabled,
443
+ onChange: ()=>handleSelectRow(key_3),
444
+ onClick: _temp2,
445
+ "data-tao-table-checkbox": ""
446
+ })
447
+ }),
448
+ columns.map((col_6, colIdx)=>{
449
+ const colKey_0 = getColKey(col_6, colIdx);
450
+ const value = getCellValue(record_3, col_6.dataIndex);
451
+ const stickyPos_0 = stickyPositions[colKey_0];
452
+ const isFixed_0 = !!col_6.fixed && !!scroll?.x;
453
+ const cellProps = col_6.onCell?.(record_3, rowIdx) ?? {};
454
+ return /*#__PURE__*/ createElement("td", {
455
+ ...cellProps,
456
+ key: colKey_0,
457
+ "data-tao-table-cell": "",
458
+ "data-tao-align": col_6.align,
459
+ "data-tao-ellipsis": col_6.ellipsis || void 0,
460
+ "data-tao-fixed": isFixed_0 ? col_6.fixed : void 0,
461
+ className: cx(resolvedClassNames["body.cell"], cellProps.className),
462
+ style: {
463
+ ...resolvedStyles["body.cell"],
464
+ ...stickyStyle(isFixed_0 ? stickyPos_0 : void 0, 1),
465
+ ...cellProps.style
466
+ }
467
+ }, col_6.render ? col_6.render(value, record_3, rowIdx) : value);
468
+ })
469
+ ]
330
470
  }),
331
- columns.map((col_5, colIdx)=>{
332
- const colKey_0 = getColKey(col_5, colIdx);
333
- const value = getCellValue(record_2, col_5.dataIndex);
334
- const stickyPos_0 = stickyPositions[colKey_0];
335
- const isFixed_0 = !!col_5.fixed && !!scroll?.x;
336
- const cellProps = col_5.onCell?.(record_2, rowIdx) ?? {};
337
- return /*#__PURE__*/ createElement("td", {
338
- ...cellProps,
339
- key: colKey_0,
471
+ isExpanded && /*#__PURE__*/ jsx("tr", {
472
+ "data-tao-table-expanded-row": "",
473
+ className: resolvedClassNames.expandedRow,
474
+ style: resolvedStyles.expandedRow,
475
+ children: /*#__PURE__*/ jsx("td", {
340
476
  "data-tao-table-cell": "",
341
- "data-tao-align": col_5.align,
342
- "data-tao-ellipsis": col_5.ellipsis || void 0,
343
- "data-tao-fixed": isFixed_0 ? col_5.fixed : void 0,
344
- className: cx(resolvedClassNames["body.cell"], cellProps.className),
345
- style: {
346
- ...resolvedStyles["body.cell"],
347
- ...isFixed_0 && stickyPos_0 ? {
348
- position: "sticky",
349
- ...void 0 !== stickyPos_0.left ? {
350
- left: stickyPos_0.left
351
- } : {},
352
- ...void 0 !== stickyPos_0.right ? {
353
- right: stickyPos_0.right
354
- } : {},
355
- zIndex: 1
356
- } : {},
357
- ...cellProps.style
358
- }
359
- }, col_5.render ? col_5.render(value, record_2, rowIdx) : value);
477
+ colSpan: allColumns.length,
478
+ children: /*#__PURE__*/ jsx("div", {
479
+ "data-tao-table-expanded-content": "",
480
+ style: scroll?.x ? {
481
+ width: viewportWidth
482
+ } : void 0,
483
+ children: expandable.expandedRowRender(record_3, rowIdx)
484
+ })
485
+ })
360
486
  })
361
487
  ]
362
- });
488
+ }, key_3);
363
489
  });
364
- let t22;
365
- if ($[55] !== t21) {
366
- t22 = /*#__PURE__*/ jsx("tbody", {
367
- "data-tao-table-tbody": t20,
368
- children: t21
490
+ let t28;
491
+ if ($[76] !== t27) {
492
+ t28 = /*#__PURE__*/ jsx("tbody", {
493
+ "data-tao-table-tbody": t26,
494
+ children: t27
369
495
  });
370
- $[55] = t21;
371
- $[56] = t22;
372
- } else t22 = $[56];
373
- let t23;
374
- if ($[57] !== resolvedClassNames || $[58] !== resolvedSize || $[59] !== resolvedStyles || $[60] !== tableData.pagination) {
375
- t23 = tableData.pagination && tableData.pagination.total > 0 && /*#__PURE__*/ jsx("div", {
496
+ $[76] = t27;
497
+ $[77] = t28;
498
+ } else t28 = $[77];
499
+ let t29;
500
+ if ($[78] !== resolvedClassNames || $[79] !== resolvedStyles || $[80] !== summaryColumns || $[81] !== summaryFixed || $[82] !== summaryNode) {
501
+ t29 = null != summaryNode && /*#__PURE__*/ jsx("tfoot", {
502
+ "data-tao-table-summary": "",
503
+ "data-tao-summary-fixed": summaryFixed || void 0,
504
+ className: resolvedClassNames.summary,
505
+ style: resolvedStyles.summary,
506
+ children: /*#__PURE__*/ jsx(TableSummaryContext.Provider, {
507
+ value: summaryColumns,
508
+ children: summaryNode
509
+ })
510
+ });
511
+ $[78] = resolvedClassNames;
512
+ $[79] = resolvedStyles;
513
+ $[80] = summaryColumns;
514
+ $[81] = summaryFixed;
515
+ $[82] = summaryNode;
516
+ $[83] = t29;
517
+ } else t29 = $[83];
518
+ let t30;
519
+ if ($[84] !== resolvedClassNames || $[85] !== resolvedSize || $[86] !== resolvedStyles || $[87] !== tableData.pagination) {
520
+ t30 = tableData.pagination && tableData.pagination.total > 0 && /*#__PURE__*/ jsx("div", {
376
521
  "data-tao-table-pagination": "",
377
522
  className: resolvedClassNames.pagination,
378
523
  style: resolvedStyles.pagination,
@@ -381,12 +526,12 @@ function Table(t0) {
381
526
  size: resolvedSize
382
527
  })
383
528
  });
384
- $[57] = resolvedClassNames;
385
- $[58] = resolvedSize;
386
- $[59] = resolvedStyles;
387
- $[60] = tableData.pagination;
388
- $[61] = t23;
389
- } else t23 = $[61];
529
+ $[84] = resolvedClassNames;
530
+ $[85] = resolvedSize;
531
+ $[86] = resolvedStyles;
532
+ $[87] = tableData.pagination;
533
+ $[88] = t30;
534
+ } else t30 = $[88];
390
535
  return /*#__PURE__*/ jsxs("div", {
391
536
  "data-tao-table-wrapper": "",
392
537
  "data-tao-size": resolvedSize,
@@ -400,137 +545,132 @@ function Table(t0) {
400
545
  ...style
401
546
  },
402
547
  children: [
403
- /*#__PURE__*/ jsxs("div", {
548
+ t24,
549
+ /*#__PURE__*/ jsx("div", {
404
550
  "data-tao-table-scroll": "",
551
+ "data-tao-scroll-y": scroll?.y ? "" : void 0,
405
552
  ref: scrollRef,
406
553
  onScroll: scroll?.x ? handleScroll : void 0,
407
554
  className: resolvedClassNames.scroll,
408
- style: resolvedStyles.scroll,
409
- children: [
410
- t19,
411
- /*#__PURE__*/ jsxs("table", {
412
- "data-tao-table": "",
413
- className: resolvedClassNames.table,
414
- style: {
415
- ...tableStyle,
416
- ...resolvedStyles.table
417
- },
418
- children: [
419
- /*#__PURE__*/ jsx("thead", {
420
- "data-tao-table-thead": "",
421
- className: resolvedClassNames["header.wrapper"],
422
- style: resolvedStyles["header.wrapper"],
423
- children: /*#__PURE__*/ jsxs("tr", {
424
- ...headerRowProps,
425
- className: cx(resolvedClassNames["header.row"], headerRowProps.className),
426
- style: {
427
- ...resolvedStyles["header.row"],
428
- ...headerRowProps.style
429
- },
430
- children: [
431
- rowSelection && /*#__PURE__*/ jsx("th", {
432
- "data-tao-table-cell": "",
433
- "data-tao-table-selection-cell": "",
434
- "data-tao-fixed": "left",
435
- className: resolvedClassNames["selection.cell"],
436
- style: {
437
- width: selectionColWidth,
438
- ...stickyPositions.__selection__ ? {
439
- position: "sticky",
440
- left: stickyPositions.__selection__.left,
441
- zIndex: 2
442
- } : {},
443
- ...resolvedStyles["selection.cell"]
555
+ style: {
556
+ maxHeight: scroll?.y,
557
+ ...resolvedStyles.scroll
558
+ },
559
+ children: /*#__PURE__*/ jsxs("table", {
560
+ "data-tao-table": "",
561
+ className: resolvedClassNames.table,
562
+ style: {
563
+ ...tableStyle,
564
+ ...resolvedStyles.table
565
+ },
566
+ children: [
567
+ /*#__PURE__*/ jsx("thead", {
568
+ "data-tao-table-thead": "",
569
+ className: resolvedClassNames["header.wrapper"],
570
+ style: resolvedStyles["header.wrapper"],
571
+ children: /*#__PURE__*/ jsxs("tr", {
572
+ ...headerRowProps,
573
+ className: cx(resolvedClassNames["header.row"], headerRowProps.className),
574
+ style: {
575
+ ...resolvedStyles["header.row"],
576
+ ...headerRowProps.style
577
+ },
578
+ children: [
579
+ t25,
580
+ rowSelection && /*#__PURE__*/ jsx("th", {
581
+ "data-tao-table-cell": "",
582
+ "data-tao-table-selection-cell": "",
583
+ "data-tao-fixed": stickyPositions.__selection__ ? "left" : void 0,
584
+ className: resolvedClassNames["selection.cell"],
585
+ style: {
586
+ width: selectionColWidth,
587
+ ...stickyStyle(stickyPositions.__selection__, 3),
588
+ ...resolvedStyles["selection.cell"]
589
+ },
590
+ children: "checkbox" === selectionType && /*#__PURE__*/ jsx("input", {
591
+ type: "checkbox",
592
+ "aria-label": "Select all rows",
593
+ checked: isAllSelected,
594
+ disabled: 0 === selectablePageKeys.length,
595
+ ref: (el_1)=>{
596
+ if (el_1) el_1.indeterminate = isIndeterminate;
444
597
  },
445
- children: "checkbox" === selectionType && /*#__PURE__*/ jsx("input", {
446
- type: "checkbox",
447
- "aria-label": "Select all rows",
448
- checked: isAllSelected,
449
- disabled: 0 === selectablePageKeys.length,
450
- ref: (el_0)=>{
451
- if (el_0) el_0.indeterminate = isIndeterminate;
452
- },
453
- onChange: (e)=>handleSelectAll(e.target.checked),
454
- "data-tao-table-checkbox": ""
455
- })
456
- }),
457
- columns.map((col_4, i_1)=>{
458
- const colKey = getColKey(col_4, i_1);
459
- const hasSorter = !!col_4.sorter;
460
- const hasFilter = !!(col_4.filters && col_4.filters.length > 0);
461
- const { sortOrder: resolvedOrder, filteredValue: activeFilterValues, onSort, onFilter } = tableData.getColumnState(i_1);
462
- const stickyPos = stickyPositions[colKey];
463
- const isFixed = !!col_4.fixed && !!scroll?.x;
464
- const headerCellProps = col_4.onHeaderCell?.(col_4) ?? {};
465
- return /*#__PURE__*/ createElement("th", {
466
- ...headerCellProps,
467
- key: colKey,
468
- "data-tao-table-cell": "",
469
- "data-tao-table-header": "",
470
- "data-tao-align": col_4.align,
471
- "data-tao-fixed": isFixed ? col_4.fixed : void 0,
472
- "aria-sort": hasSorter ? "ascend" === resolvedOrder ? "ascending" : "descend" === resolvedOrder ? "descending" : "none" : void 0,
473
- className: cx(resolvedClassNames["header.cell"], headerCellProps.className),
474
- style: {
475
- ...resolvedStyles["header.cell"],
476
- width: col_4.width,
477
- ...isFixed && stickyPos ? {
478
- position: "sticky",
479
- ...void 0 !== stickyPos.left ? {
480
- left: stickyPos.left
481
- } : {},
482
- ...void 0 !== stickyPos.right ? {
483
- right: stickyPos.right
484
- } : {},
485
- zIndex: 2
486
- } : {},
487
- ...headerCellProps.style
488
- }
489
- }, /*#__PURE__*/ jsxs("div", {
490
- "data-tao-table-header-content": "",
491
- className: resolvedClassNames["header.content"],
492
- style: resolvedStyles["header.content"],
493
- children: [
494
- hasSorter ? /*#__PURE__*/ jsxs("button", {
495
- type: "button",
496
- "data-tao-table-header-title": "",
497
- "data-tao-sortable": "",
498
- className: resolvedClassNames["header.title"],
499
- style: resolvedStyles["header.title"],
500
- onClick: onSort,
501
- children: [
502
- col_4.title,
503
- /*#__PURE__*/ jsx(SortIcon, {
504
- order: resolvedOrder
505
- })
506
- ]
507
- }) : /*#__PURE__*/ jsx("span", {
508
- "data-tao-table-header-title": "",
509
- className: resolvedClassNames["header.title"],
510
- style: resolvedStyles["header.title"],
511
- children: col_4.title
512
- }),
513
- hasFilter && /*#__PURE__*/ jsx(TableFilterDropdown, {
514
- filters: col_4.filters,
515
- activeValues: activeFilterValues,
516
- onSelect: onFilter
517
- })
518
- ]
519
- }));
598
+ onChange: (e)=>handleSelectAll(e.target.checked),
599
+ "data-tao-table-checkbox": ""
520
600
  })
521
- ]
522
- })
523
- }),
524
- t22
525
- ]
526
- })
527
- ]
601
+ }),
602
+ columns.map((col_5, i_1)=>{
603
+ const colKey = getColKey(col_5, i_1);
604
+ const hasSorter = !!col_5.sorter;
605
+ const hasFilter = !!(col_5.filters && col_5.filters.length > 0);
606
+ const { sortOrder: resolvedOrder, filteredValue: activeFilterValues, onSort, onFilter } = tableData.getColumnState(i_1);
607
+ const stickyPos = stickyPositions[colKey];
608
+ const isFixed = !!col_5.fixed && !!scroll?.x;
609
+ const headerCellProps = col_5.onHeaderCell?.(col_5) ?? {};
610
+ return /*#__PURE__*/ createElement("th", {
611
+ ...headerCellProps,
612
+ key: colKey,
613
+ "data-tao-table-cell": "",
614
+ "data-tao-table-header": "",
615
+ "data-tao-align": col_5.align,
616
+ "data-tao-fixed": isFixed ? col_5.fixed : void 0,
617
+ "aria-sort": hasSorter ? "ascend" === resolvedOrder ? "ascending" : "descend" === resolvedOrder ? "descending" : "none" : void 0,
618
+ className: cx(resolvedClassNames["header.cell"], headerCellProps.className),
619
+ style: {
620
+ ...resolvedStyles["header.cell"],
621
+ width: col_5.width,
622
+ ...stickyStyle(isFixed ? stickyPos : void 0, 3),
623
+ ...headerCellProps.style
624
+ }
625
+ }, /*#__PURE__*/ jsxs("div", {
626
+ "data-tao-table-header-content": "",
627
+ className: resolvedClassNames["header.content"],
628
+ style: resolvedStyles["header.content"],
629
+ children: [
630
+ hasSorter ? /*#__PURE__*/ jsxs("button", {
631
+ type: "button",
632
+ "data-tao-table-header-title": "",
633
+ "data-tao-sortable": "",
634
+ className: resolvedClassNames["header.title"],
635
+ style: resolvedStyles["header.title"],
636
+ onClick: onSort,
637
+ children: [
638
+ col_5.title,
639
+ /*#__PURE__*/ jsx(SortIcon, {
640
+ order: resolvedOrder
641
+ })
642
+ ]
643
+ }) : /*#__PURE__*/ jsx("span", {
644
+ "data-tao-table-header-title": "",
645
+ className: resolvedClassNames["header.title"],
646
+ style: resolvedStyles["header.title"],
647
+ children: col_5.title
648
+ }),
649
+ hasFilter && /*#__PURE__*/ jsx(TableFilterDropdown, {
650
+ filters: col_5.filters,
651
+ activeValues: activeFilterValues,
652
+ onSelect: onFilter
653
+ })
654
+ ]
655
+ }));
656
+ })
657
+ ]
658
+ })
659
+ }),
660
+ t28,
661
+ t29
662
+ ]
663
+ })
528
664
  }),
529
- t23
665
+ t30
530
666
  ]
531
667
  });
532
668
  }
669
+ function _temp2(e_2) {
670
+ return e_2.stopPropagation();
671
+ }
533
672
  function _temp(col_0) {
534
673
  return col_0.responsive;
535
674
  }
675
+ Table.Summary = TableSummary;
536
676
  export { Table };