@rockshin/tao-ui 0.0.6 → 0.0.8

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,6 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { createElement, useEffect, useRef, useState } from "react";
2
3
  import { c as compiler_runtime_c } from "react/compiler-runtime";
3
- import { useEffect, useRef, useState } from "react";
4
4
  import { useTaoConfig } from "../../provider/tao-provider.js";
5
5
  import { cx } from "../../utils/semantic.js";
6
6
  import { Pagination } from "../pagination/pagination.js";
@@ -16,6 +16,22 @@ function getCellValue(record, dataIndex) {
16
16
  if (!dataIndex) return;
17
17
  return record[dataIndex];
18
18
  }
19
+ function resolveSemanticClassNames(classNames, props) {
20
+ return 'function' == typeof classNames ? classNames({
21
+ props
22
+ }) : classNames ?? {};
23
+ }
24
+ function resolveSemanticStyles(styles, props) {
25
+ return 'function' == typeof styles ? styles({
26
+ props
27
+ }) : styles ?? {};
28
+ }
29
+ function resolveRowClassName(rowClassName, record, index) {
30
+ return 'function' == typeof rowClassName ? rowClassName(record, index) : rowClassName;
31
+ }
32
+ function resolveRowStyle(rowStyle, record, index) {
33
+ return 'function' == typeof rowStyle ? rowStyle(record, index) : rowStyle;
34
+ }
19
35
  function SortIcon(t0) {
20
36
  const $ = compiler_runtime_c(10);
21
37
  const { order } = t0;
@@ -289,16 +305,41 @@ function FilterDropdown(t0) {
289
305
  return t9;
290
306
  }
291
307
  function Table(t0) {
292
- const $ = compiler_runtime_c(162);
293
- const { columns, dataSource, rowKey, loading: t1, pagination: paginationProp, onChange, scroll, rowSelection, size, variant, headerBackground: t2, emptyText: t3, bordered: t4, className, classNames, styles } = t0;
308
+ const $ = compiler_runtime_c(96);
309
+ const { columns, 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;
294
310
  const loading = void 0 === t1 ? false : t1;
295
311
  const headerBackground = void 0 === t2 ? true : t2;
296
312
  const emptyText = void 0 === t3 ? "No Data" : t3;
297
313
  const bordered = void 0 === t4 ? false : t4;
298
314
  const ctx = useTaoConfig();
299
315
  const resolvedSize = size ?? ctx.size;
300
- const resolvedVariant = variant ?? ("outlined" === ctx.variant ? "filled" : ctx.variant);
301
- const showBorder = "outlined" === resolvedVariant || bordered && "borderless" !== resolvedVariant;
316
+ const resolvedVariant = variant ?? ("outlined" === ctx.variant ? "modern" : ctx.variant);
317
+ const showBorder = "outlined" === resolvedVariant || "modern" === resolvedVariant || bordered && "borderless" !== resolvedVariant;
318
+ const semanticProps = {
319
+ columns,
320
+ dataSource,
321
+ rowKey,
322
+ loading,
323
+ pagination: paginationProp,
324
+ onChange,
325
+ scroll,
326
+ rowSelection,
327
+ rowClassName,
328
+ rowStyle,
329
+ onRow,
330
+ onHeaderRow,
331
+ size,
332
+ variant,
333
+ headerBackground,
334
+ emptyText,
335
+ bordered,
336
+ className,
337
+ style,
338
+ classNames,
339
+ styles
340
+ };
341
+ const resolvedClassNames = resolveSemanticClassNames(classNames, semanticProps);
342
+ const resolvedStyles = resolveSemanticStyles(styles, semanticProps);
302
343
  let defaultSortCol;
303
344
  let t5;
304
345
  let t6;
@@ -665,307 +706,123 @@ function Table(t0) {
665
706
  $[74] = t24;
666
707
  } else t24 = $[74];
667
708
  const getResolvedSortOrder = t24;
709
+ const tableStyle = scroll?.x ? {
710
+ minWidth: "number" == typeof scroll.x ? `${scroll.x}px` : scroll.x
711
+ } : {};
668
712
  let t25;
669
- if ($[75] !== scroll) {
670
- t25 = scroll?.x ? {
671
- minWidth: "number" == typeof scroll.x ? `${scroll.x}px` : scroll.x
672
- } : {};
673
- $[75] = scroll;
674
- $[76] = t25;
675
- } else t25 = $[76];
676
- const tableStyle = t25;
713
+ if ($[75] !== paginatedData || $[76] !== rowKey || $[77] !== rowSelection || $[78] !== selectedKeys) {
714
+ t25 = paginatedData.length > 0 && paginatedData.filter((r_3)=>!rowSelection?.getCheckboxProps?.(r_3)?.disabled).every((r_4)=>selectedKeys.includes(getRowKey(r_4, rowKey)));
715
+ $[75] = paginatedData;
716
+ $[76] = rowKey;
717
+ $[77] = rowSelection;
718
+ $[78] = selectedKeys;
719
+ $[79] = t25;
720
+ } else t25 = $[79];
721
+ const isAllSelected = t25;
722
+ const isIndeterminate = !isAllSelected && selectedKeys.length > 0;
677
723
  let t26;
678
- if ($[77] !== paginatedData || $[78] !== rowKey || $[79] !== rowSelection || $[80] !== selectedKeys) {
679
- t26 = paginatedData.length > 0 && paginatedData.filter((r_3)=>!rowSelection?.getCheckboxProps?.(r_3)?.disabled).every((r_4)=>selectedKeys.includes(getRowKey(r_4, rowKey)));
680
- $[77] = paginatedData;
681
- $[78] = rowKey;
682
- $[79] = rowSelection;
683
- $[80] = selectedKeys;
724
+ if ($[80] !== loading) {
725
+ t26 = loading && /*#__PURE__*/ jsx(LoadingSpinner, {});
726
+ $[80] = loading;
684
727
  $[81] = t26;
685
728
  } else t26 = $[81];
686
- const isAllSelected = t26;
687
- const isIndeterminate = !isAllSelected && selectedKeys.length > 0;
688
- const t27 = headerBackground ? void 0 : "off";
689
- const t28 = showBorder || void 0;
690
- const t29 = scroll?.x ? scrollState : void 0;
691
- const t30 = classNames?.root;
692
- let t31;
693
- if ($[82] !== className || $[83] !== t30) {
694
- t31 = cx(t30, className);
695
- $[82] = className;
696
- $[83] = t30;
697
- $[84] = t31;
698
- } else t31 = $[84];
699
- const t32 = styles?.root;
700
- const t33 = scroll?.x ? handleScroll : void 0;
701
- let t34;
702
- if ($[85] !== loading) {
703
- t34 = loading && /*#__PURE__*/ jsx(LoadingSpinner, {});
704
- $[85] = loading;
705
- $[86] = t34;
706
- } else t34 = $[86];
707
- let t35;
708
- if ($[87] !== handleSelectAll || $[88] !== isAllSelected || $[89] !== isIndeterminate || $[90] !== rowSelection || $[91] !== selectionColWidth || $[92] !== selectionType || $[93] !== stickyPositions) {
709
- t35 = rowSelection && /*#__PURE__*/ jsx("th", {
729
+ const headerRowProps = onHeaderRow?.(columns, 0) ?? {};
730
+ const t27 = "";
731
+ const t28 = 0 === paginatedData.length ? /*#__PURE__*/ jsx("tr", {
732
+ children: /*#__PURE__*/ jsx("td", {
710
733
  "data-tao-table-cell": "",
711
- "data-tao-table-selection-cell": "",
712
- "data-tao-fixed": "left",
734
+ "data-tao-table-empty": "",
735
+ colSpan: columns.length + (rowSelection ? 1 : 0),
736
+ className: resolvedClassNames.empty,
737
+ style: resolvedStyles.empty,
738
+ children: emptyText
739
+ })
740
+ }) : paginatedData.map((record_1, rowIdx)=>{
741
+ const key_6 = getRowKey(record_1, rowKey);
742
+ const isSelected = selectedKeys.includes(key_6);
743
+ const checkboxProps = rowSelection?.getCheckboxProps?.(record_1);
744
+ const rowProps = onRow?.(record_1, rowIdx) ?? {};
745
+ return /*#__PURE__*/ createElement("tr", {
746
+ ...rowProps,
747
+ key: key_6,
748
+ "data-tao-table-row": "",
749
+ "data-tao-selected": isSelected || void 0,
750
+ className: cx(resolvedClassNames["body.row"], resolveRowClassName(rowClassName, record_1, rowIdx), rowProps.className),
713
751
  style: {
714
- width: selectionColWidth,
715
- ...stickyPositions.__selection__ ? {
716
- position: "sticky",
717
- left: stickyPositions.__selection__.left,
718
- zIndex: 2
719
- } : {}
752
+ ...resolvedStyles["body.row"],
753
+ ...resolveRowStyle(rowStyle, record_1, rowIdx),
754
+ ...rowProps.style
720
755
  },
721
- children: "checkbox" === selectionType && /*#__PURE__*/ jsx("input", {
722
- type: "checkbox",
723
- checked: isAllSelected,
724
- ref: (el_0)=>{
725
- if (el_0) el_0.indeterminate = isIndeterminate;
726
- },
727
- onChange: (e)=>handleSelectAll(e.target.checked),
728
- "data-tao-table-checkbox": ""
729
- })
730
- });
731
- $[87] = handleSelectAll;
732
- $[88] = isAllSelected;
733
- $[89] = isIndeterminate;
734
- $[90] = rowSelection;
735
- $[91] = selectionColWidth;
736
- $[92] = selectionType;
737
- $[93] = stickyPositions;
738
- $[94] = t35;
739
- } else t35 = $[94];
740
- let t36;
741
- if ($[95] !== classNames || $[96] !== columns || $[97] !== filterValues || $[98] !== getResolvedSortOrder || $[99] !== handleFilter || $[100] !== handleSort || $[101] !== scroll?.x || $[102] !== stickyPositions || $[103] !== styles) {
742
- let t37;
743
- if ($[105] !== classNames || $[106] !== filterValues || $[107] !== getResolvedSortOrder || $[108] !== handleFilter || $[109] !== handleSort || $[110] !== scroll?.x || $[111] !== stickyPositions || $[112] !== styles) {
744
- t37 = (col_9, i_6)=>{
745
- const colKey_2 = getColKey(col_9, i_6);
746
- const hasSorter = !!col_9.sorter;
747
- const hasFilter = !!(col_9.filters && col_9.filters.length > 0);
748
- const resolvedOrder = getResolvedSortOrder(col_9, colKey_2);
749
- const controlledFilterValues = col_9.filteredValue;
750
- const activeFilterValues = controlledFilterValues ?? filterValues[colKey_2] ?? [];
751
- const stickyPos = stickyPositions[colKey_2];
752
- const isFixed = !!col_9.fixed && !!scroll?.x;
753
- return /*#__PURE__*/ jsx("th", {
756
+ children: [
757
+ rowSelection && /*#__PURE__*/ jsx("td", {
754
758
  "data-tao-table-cell": "",
755
- "data-tao-table-header": "",
756
- "data-tao-align": col_9.align,
757
- "data-tao-fixed": isFixed ? col_9.fixed : void 0,
758
- className: classNames?.["header.cell"],
759
+ "data-tao-table-selection-cell": "",
760
+ "data-tao-fixed": "left",
761
+ className: resolvedClassNames["selection.cell"],
759
762
  style: {
760
- width: col_9.width,
761
- ...isFixed && stickyPos ? {
763
+ ...stickyPositions.__selection__ ? {
762
764
  position: "sticky",
763
- ...void 0 !== stickyPos.left ? {
764
- left: stickyPos.left
765
- } : {},
766
- ...void 0 !== stickyPos.right ? {
767
- right: stickyPos.right
768
- } : {},
769
- zIndex: 2
765
+ left: stickyPositions.__selection__.left,
766
+ zIndex: 1
770
767
  } : {},
771
- ...styles?.["header.cell"]
768
+ ...resolvedStyles["selection.cell"]
772
769
  },
773
- children: /*#__PURE__*/ jsxs("div", {
774
- "data-tao-table-header-content": "",
775
- children: [
776
- /*#__PURE__*/ jsxs("span", {
777
- "data-tao-table-header-title": "",
778
- "data-tao-sortable": hasSorter || void 0,
779
- onClick: hasSorter ? ()=>handleSort(colKey_2, col_9) : void 0,
780
- role: hasSorter ? "button" : void 0,
781
- tabIndex: hasSorter ? 0 : void 0,
782
- onKeyDown: hasSorter ? (e_0)=>{
783
- if ("Enter" === e_0.key || " " === e_0.key) {
784
- e_0.preventDefault();
785
- handleSort(colKey_2, col_9);
786
- }
787
- } : void 0,
788
- children: [
789
- col_9.title,
790
- hasSorter && /*#__PURE__*/ jsx(SortIcon, {
791
- order: resolvedOrder
792
- })
793
- ]
794
- }),
795
- hasFilter && /*#__PURE__*/ jsx(FilterDropdown, {
796
- filters: col_9.filters,
797
- activeValues: activeFilterValues,
798
- onSelect: (vals_0)=>handleFilter(colKey_2, vals_0)
799
- })
800
- ]
770
+ children: /*#__PURE__*/ jsx("input", {
771
+ type: "radio" === selectionType ? "radio" : "checkbox",
772
+ checked: isSelected,
773
+ disabled: checkboxProps?.disabled,
774
+ onChange: ()=>handleSelectRow(key_6, record_1),
775
+ "data-tao-table-checkbox": ""
801
776
  })
802
- }, colKey_2);
803
- };
804
- $[105] = classNames;
805
- $[106] = filterValues;
806
- $[107] = getResolvedSortOrder;
807
- $[108] = handleFilter;
808
- $[109] = handleSort;
809
- $[110] = scroll?.x;
810
- $[111] = stickyPositions;
811
- $[112] = styles;
812
- $[113] = t37;
813
- } else t37 = $[113];
814
- t36 = columns.map(t37);
815
- $[95] = classNames;
816
- $[96] = columns;
817
- $[97] = filterValues;
818
- $[98] = getResolvedSortOrder;
819
- $[99] = handleFilter;
820
- $[100] = handleSort;
821
- $[101] = scroll?.x;
822
- $[102] = stickyPositions;
823
- $[103] = styles;
824
- $[104] = t36;
825
- } else t36 = $[104];
826
- let t37;
827
- if ($[114] !== t35 || $[115] !== t36) {
828
- t37 = /*#__PURE__*/ jsx("thead", {
829
- "data-tao-table-thead": "",
830
- children: /*#__PURE__*/ jsxs("tr", {
831
- children: [
832
- t35,
833
- t36
834
- ]
835
- })
836
- });
837
- $[114] = t35;
838
- $[115] = t36;
839
- $[116] = t37;
840
- } else t37 = $[116];
841
- let t38;
842
- if ($[117] !== classNames || $[118] !== columns || $[119] !== emptyText || $[120] !== handleSelectRow || $[121] !== paginatedData || $[122] !== rowKey || $[123] !== rowSelection || $[124] !== scroll?.x || $[125] !== selectedKeys || $[126] !== selectionType || $[127] !== stickyPositions || $[128] !== styles) {
843
- t38 = 0 === paginatedData.length ? /*#__PURE__*/ jsx("tr", {
844
- children: /*#__PURE__*/ jsx("td", {
845
- "data-tao-table-cell": "",
846
- "data-tao-table-empty": "",
847
- colSpan: columns.length + (rowSelection ? 1 : 0),
848
- children: emptyText
849
- })
850
- }) : paginatedData.map((record_1, rowIdx)=>{
851
- const key_6 = getRowKey(record_1, rowKey);
852
- const isSelected = selectedKeys.includes(key_6);
853
- const checkboxProps = rowSelection?.getCheckboxProps?.(record_1);
854
- return /*#__PURE__*/ jsxs("tr", {
855
- "data-tao-table-row": "",
856
- "data-tao-selected": isSelected || void 0,
857
- className: classNames?.["body.row"],
858
- style: styles?.["body.row"],
859
- children: [
860
- rowSelection && /*#__PURE__*/ jsx("td", {
777
+ }),
778
+ columns.map((col_10, colIdx_1)=>{
779
+ const colKey_3 = getColKey(col_10, colIdx_1);
780
+ const value = getCellValue(record_1, col_10.dataIndex);
781
+ const stickyPos_0 = stickyPositions[colKey_3];
782
+ const isFixed_0 = !!col_10.fixed && !!scroll?.x;
783
+ const cellProps = col_10.onCell?.(record_1, rowIdx) ?? {};
784
+ return /*#__PURE__*/ createElement("td", {
785
+ ...cellProps,
786
+ key: colKey_3,
861
787
  "data-tao-table-cell": "",
862
- "data-tao-table-selection-cell": "",
863
- "data-tao-fixed": "left",
788
+ "data-tao-align": col_10.align,
789
+ "data-tao-ellipsis": col_10.ellipsis || void 0,
790
+ "data-tao-fixed": isFixed_0 ? col_10.fixed : void 0,
791
+ className: cx(resolvedClassNames["body.cell"], cellProps.className),
864
792
  style: {
865
- ...stickyPositions.__selection__ ? {
793
+ ...resolvedStyles["body.cell"],
794
+ ...isFixed_0 && stickyPos_0 ? {
866
795
  position: "sticky",
867
- left: stickyPositions.__selection__.left,
868
- zIndex: 1
869
- } : {}
870
- },
871
- children: /*#__PURE__*/ jsx("input", {
872
- type: "radio" === selectionType ? "radio" : "checkbox",
873
- checked: isSelected,
874
- disabled: checkboxProps?.disabled,
875
- onChange: ()=>handleSelectRow(key_6, record_1),
876
- "data-tao-table-checkbox": ""
877
- })
878
- }),
879
- columns.map((col_10, colIdx_1)=>{
880
- const colKey_3 = getColKey(col_10, colIdx_1);
881
- const value = getCellValue(record_1, col_10.dataIndex);
882
- const stickyPos_0 = stickyPositions[colKey_3];
883
- const isFixed_0 = !!col_10.fixed && !!scroll?.x;
884
- return /*#__PURE__*/ jsx("td", {
885
- "data-tao-table-cell": "",
886
- "data-tao-align": col_10.align,
887
- "data-tao-ellipsis": col_10.ellipsis || void 0,
888
- "data-tao-fixed": isFixed_0 ? col_10.fixed : void 0,
889
- className: classNames?.["body.cell"],
890
- style: {
891
- ...isFixed_0 && stickyPos_0 ? {
892
- position: "sticky",
893
- ...void 0 !== stickyPos_0.left ? {
894
- left: stickyPos_0.left
895
- } : {},
896
- ...void 0 !== stickyPos_0.right ? {
897
- right: stickyPos_0.right
898
- } : {},
899
- zIndex: 1
796
+ ...void 0 !== stickyPos_0.left ? {
797
+ left: stickyPos_0.left
900
798
  } : {},
901
- ...styles?.["body.cell"]
902
- },
903
- children: col_10.render ? col_10.render(value, record_1, rowIdx) : value
904
- }, colKey_3);
905
- })
906
- ]
907
- }, key_6);
908
- });
909
- $[117] = classNames;
910
- $[118] = columns;
911
- $[119] = emptyText;
912
- $[120] = handleSelectRow;
913
- $[121] = paginatedData;
914
- $[122] = rowKey;
915
- $[123] = rowSelection;
916
- $[124] = scroll?.x;
917
- $[125] = selectedKeys;
918
- $[126] = selectionType;
919
- $[127] = stickyPositions;
920
- $[128] = styles;
921
- $[129] = t38;
922
- } else t38 = $[129];
923
- let t39;
924
- if ($[130] !== t38) {
925
- t39 = /*#__PURE__*/ jsx("tbody", {
926
- "data-tao-table-tbody": "",
927
- children: t38
928
- });
929
- $[130] = t38;
930
- $[131] = t39;
931
- } else t39 = $[131];
932
- let t40;
933
- if ($[132] !== t37 || $[133] !== t39 || $[134] !== tableStyle) {
934
- t40 = /*#__PURE__*/ jsxs("table", {
935
- "data-tao-table": "",
936
- style: tableStyle,
937
- children: [
938
- t37,
939
- t39
799
+ ...void 0 !== stickyPos_0.right ? {
800
+ right: stickyPos_0.right
801
+ } : {},
802
+ zIndex: 1
803
+ } : {},
804
+ ...cellProps.style
805
+ }
806
+ }, col_10.render ? col_10.render(value, record_1, rowIdx) : value);
807
+ })
940
808
  ]
941
809
  });
942
- $[132] = t37;
943
- $[133] = t39;
944
- $[134] = tableStyle;
945
- $[135] = t40;
946
- } else t40 = $[135];
947
- let t41;
948
- if ($[136] !== t33 || $[137] !== t34 || $[138] !== t40) {
949
- t41 = /*#__PURE__*/ jsxs("div", {
950
- "data-tao-table-scroll": "",
951
- ref: scrollRef,
952
- onScroll: t33,
953
- children: [
954
- t34,
955
- t40
956
- ]
810
+ });
811
+ let t29;
812
+ if ($[82] !== t28) {
813
+ t29 = /*#__PURE__*/ jsx("tbody", {
814
+ "data-tao-table-tbody": t27,
815
+ children: t28
957
816
  });
958
- $[136] = t33;
959
- $[137] = t34;
960
- $[138] = t40;
961
- $[139] = t41;
962
- } else t41 = $[139];
963
- let t42;
964
- if ($[140] !== classNames?.pagination || $[141] !== currentPage || $[142] !== handlePageChange || $[143] !== hasPagination || $[144] !== pageSize || $[145] !== paginationConfig?.pageSizeOptions || $[146] !== paginationConfig?.showSizeChanger || $[147] !== paginationConfig?.showTotal || $[148] !== resolvedSize || $[149] !== styles?.pagination || $[150] !== totalForPagination) {
965
- t42 = hasPagination && totalForPagination > 0 && /*#__PURE__*/ jsx("div", {
817
+ $[82] = t28;
818
+ $[83] = t29;
819
+ } else t29 = $[83];
820
+ let t30;
821
+ if ($[84] !== currentPage || $[85] !== handlePageChange || $[86] !== hasPagination || $[87] !== pageSize || $[88] !== paginationConfig?.pageSizeOptions || $[89] !== paginationConfig?.showSizeChanger || $[90] !== paginationConfig?.showTotal || $[91] !== resolvedClassNames || $[92] !== resolvedSize || $[93] !== resolvedStyles || $[94] !== totalForPagination) {
822
+ t30 = hasPagination && totalForPagination > 0 && /*#__PURE__*/ jsx("div", {
966
823
  "data-tao-table-pagination": "",
967
- className: classNames?.pagination,
968
- style: styles?.pagination,
824
+ className: resolvedClassNames.pagination,
825
+ style: resolvedStyles.pagination,
969
826
  children: /*#__PURE__*/ jsx(Pagination, {
970
827
  current: currentPage,
971
828
  pageSize: pageSize,
@@ -977,47 +834,162 @@ function Table(t0) {
977
834
  showTotal: paginationConfig?.showTotal
978
835
  })
979
836
  });
980
- $[140] = classNames?.pagination;
981
- $[141] = currentPage;
982
- $[142] = handlePageChange;
983
- $[143] = hasPagination;
984
- $[144] = pageSize;
985
- $[145] = paginationConfig?.pageSizeOptions;
986
- $[146] = paginationConfig?.showSizeChanger;
987
- $[147] = paginationConfig?.showTotal;
988
- $[148] = resolvedSize;
989
- $[149] = styles?.pagination;
990
- $[150] = totalForPagination;
991
- $[151] = t42;
992
- } else t42 = $[151];
993
- let t43;
994
- if ($[152] !== resolvedSize || $[153] !== resolvedVariant || $[154] !== t27 || $[155] !== t28 || $[156] !== t29 || $[157] !== t31 || $[158] !== t32 || $[159] !== t41 || $[160] !== t42) {
995
- t43 = /*#__PURE__*/ jsxs("div", {
996
- "data-tao-table-wrapper": "",
997
- "data-tao-size": resolvedSize,
998
- "data-tao-variant": resolvedVariant,
999
- "data-tao-header-bg": t27,
1000
- "data-tao-bordered": t28,
1001
- "data-tao-scroll-state": t29,
1002
- className: t31,
1003
- style: t32,
1004
- children: [
1005
- t41,
1006
- t42
1007
- ]
1008
- });
1009
- $[152] = resolvedSize;
1010
- $[153] = resolvedVariant;
1011
- $[154] = t27;
1012
- $[155] = t28;
1013
- $[156] = t29;
1014
- $[157] = t31;
1015
- $[158] = t32;
1016
- $[159] = t41;
1017
- $[160] = t42;
1018
- $[161] = t43;
1019
- } else t43 = $[161];
1020
- return t43;
837
+ $[84] = currentPage;
838
+ $[85] = handlePageChange;
839
+ $[86] = hasPagination;
840
+ $[87] = pageSize;
841
+ $[88] = paginationConfig?.pageSizeOptions;
842
+ $[89] = paginationConfig?.showSizeChanger;
843
+ $[90] = paginationConfig?.showTotal;
844
+ $[91] = resolvedClassNames;
845
+ $[92] = resolvedSize;
846
+ $[93] = resolvedStyles;
847
+ $[94] = totalForPagination;
848
+ $[95] = t30;
849
+ } else t30 = $[95];
850
+ return /*#__PURE__*/ jsxs("div", {
851
+ "data-tao-table-wrapper": "",
852
+ "data-tao-size": resolvedSize,
853
+ "data-tao-variant": resolvedVariant,
854
+ "data-tao-header-bg": headerBackground ? void 0 : "off",
855
+ "data-tao-bordered": showBorder || void 0,
856
+ "data-tao-scroll-state": scroll?.x ? scrollState : void 0,
857
+ className: cx(resolvedClassNames.root, className),
858
+ style: {
859
+ ...resolvedStyles.root,
860
+ ...style
861
+ },
862
+ children: [
863
+ /*#__PURE__*/ jsxs("div", {
864
+ "data-tao-table-scroll": "",
865
+ ref: scrollRef,
866
+ onScroll: scroll?.x ? handleScroll : void 0,
867
+ className: resolvedClassNames.scroll,
868
+ style: resolvedStyles.scroll,
869
+ children: [
870
+ t26,
871
+ /*#__PURE__*/ jsxs("table", {
872
+ "data-tao-table": "",
873
+ className: resolvedClassNames.table,
874
+ style: {
875
+ ...tableStyle,
876
+ ...resolvedStyles.table
877
+ },
878
+ children: [
879
+ /*#__PURE__*/ jsx("thead", {
880
+ "data-tao-table-thead": "",
881
+ className: resolvedClassNames["header.wrapper"],
882
+ style: resolvedStyles["header.wrapper"],
883
+ children: /*#__PURE__*/ jsxs("tr", {
884
+ ...headerRowProps,
885
+ className: cx(resolvedClassNames["header.row"], headerRowProps.className),
886
+ style: {
887
+ ...resolvedStyles["header.row"],
888
+ ...headerRowProps.style
889
+ },
890
+ children: [
891
+ rowSelection && /*#__PURE__*/ jsx("th", {
892
+ "data-tao-table-cell": "",
893
+ "data-tao-table-selection-cell": "",
894
+ "data-tao-fixed": "left",
895
+ className: resolvedClassNames["selection.cell"],
896
+ style: {
897
+ width: selectionColWidth,
898
+ ...stickyPositions.__selection__ ? {
899
+ position: "sticky",
900
+ left: stickyPositions.__selection__.left,
901
+ zIndex: 2
902
+ } : {},
903
+ ...resolvedStyles["selection.cell"]
904
+ },
905
+ children: "checkbox" === selectionType && /*#__PURE__*/ jsx("input", {
906
+ type: "checkbox",
907
+ checked: isAllSelected,
908
+ ref: (el_0)=>{
909
+ if (el_0) el_0.indeterminate = isIndeterminate;
910
+ },
911
+ onChange: (e)=>handleSelectAll(e.target.checked),
912
+ "data-tao-table-checkbox": ""
913
+ })
914
+ }),
915
+ columns.map((col_9, i_6)=>{
916
+ const colKey_2 = getColKey(col_9, i_6);
917
+ const hasSorter = !!col_9.sorter;
918
+ const hasFilter = !!(col_9.filters && col_9.filters.length > 0);
919
+ const resolvedOrder = getResolvedSortOrder(col_9, colKey_2);
920
+ const controlledFilterValues = col_9.filteredValue;
921
+ const activeFilterValues = controlledFilterValues ?? filterValues[colKey_2] ?? [];
922
+ const stickyPos = stickyPositions[colKey_2];
923
+ const isFixed = !!col_9.fixed && !!scroll?.x;
924
+ const headerCellProps = col_9.onHeaderCell?.(col_9) ?? {};
925
+ return /*#__PURE__*/ createElement("th", {
926
+ ...headerCellProps,
927
+ key: colKey_2,
928
+ "data-tao-table-cell": "",
929
+ "data-tao-table-header": "",
930
+ "data-tao-align": col_9.align,
931
+ "data-tao-fixed": isFixed ? col_9.fixed : void 0,
932
+ className: cx(resolvedClassNames["header.cell"], headerCellProps.className),
933
+ style: {
934
+ ...resolvedStyles["header.cell"],
935
+ width: col_9.width,
936
+ ...isFixed && stickyPos ? {
937
+ position: "sticky",
938
+ ...void 0 !== stickyPos.left ? {
939
+ left: stickyPos.left
940
+ } : {},
941
+ ...void 0 !== stickyPos.right ? {
942
+ right: stickyPos.right
943
+ } : {},
944
+ zIndex: 2
945
+ } : {},
946
+ ...headerCellProps.style
947
+ }
948
+ }, /*#__PURE__*/ jsxs("div", {
949
+ "data-tao-table-header-content": "",
950
+ className: resolvedClassNames["header.content"],
951
+ style: resolvedStyles["header.content"],
952
+ children: [
953
+ /*#__PURE__*/ jsxs("span", {
954
+ "data-tao-table-header-title": "",
955
+ "data-tao-sortable": hasSorter || void 0,
956
+ className: resolvedClassNames["header.title"],
957
+ style: resolvedStyles["header.title"],
958
+ onClick: hasSorter ? ()=>handleSort(colKey_2, col_9) : void 0,
959
+ role: hasSorter ? "button" : void 0,
960
+ tabIndex: hasSorter ? 0 : void 0,
961
+ onKeyDown: hasSorter ? (e_0)=>{
962
+ if ("Enter" === e_0.key || " " === e_0.key) {
963
+ e_0.preventDefault();
964
+ handleSort(colKey_2, col_9);
965
+ }
966
+ } : void 0,
967
+ children: [
968
+ col_9.title,
969
+ hasSorter && /*#__PURE__*/ jsx(SortIcon, {
970
+ order: resolvedOrder
971
+ })
972
+ ]
973
+ }),
974
+ hasFilter && /*#__PURE__*/ jsx(FilterDropdown, {
975
+ filters: col_9.filters,
976
+ activeValues: activeFilterValues,
977
+ onSelect: (vals_0)=>handleFilter(colKey_2, vals_0)
978
+ })
979
+ ]
980
+ }));
981
+ })
982
+ ]
983
+ })
984
+ }),
985
+ t29
986
+ ]
987
+ })
988
+ ]
989
+ }),
990
+ t30
991
+ ]
992
+ });
1021
993
  }
1022
994
  function _temp(c) {
1023
995
  return c.defaultSortOrder;