@itilite/lumina-ui 1.0.5-alpha → 1.0.7-alpha

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/index.js CHANGED
@@ -2710,7 +2710,7 @@ var import_antd10 = require("antd");
2710
2710
  var import_clsx12 = __toESM(require("clsx"));
2711
2711
 
2712
2712
  // src/atom/Table/Table.module.scss
2713
- var Table_module_default = { "tableWrapper": "Table-module__tableWrapper___3cqiD", "isAccordion": "Table-module__isAccordion___-uIs6", "isToolbar": "Table-module__isToolbar___LdS-m", "table": "Table-module__table___5d7g0", "firstRow": "Table-module__firstRow___Xq-Hi", "lastRow": "Table-module__lastRow___ahv4g", "showHoverEffect": "Table-module__showHoverEffect___IyKyO", "columnHeader": "Table-module__columnHeader___Unr6d", "columnHeaderLeft": "Table-module__columnHeaderLeft___mp7pK", "columnHeaderSortArea": "Table-module__columnHeaderSortArea___jrIYo", "columnHeaderLabel": "Table-module__columnHeaderLabel___A-mRu", "columnHeaderSortIcon": "Table-module__columnHeaderSortIcon___mWVZN", "columnHeaderSortIconActive": "Table-module__columnHeaderSortIconActive___wHAqC", "columnHeaderFilterWrapper": "Table-module__columnHeaderFilterWrapper___DnSve", "columnHeaderFilterBtn": "Table-module__columnHeaderFilterBtn___NR7DY", "columnHeaderFilterBtnActive": "Table-module__columnHeaderFilterBtnActive___JdO11", "columnHeaderFilterBadge": "Table-module__columnHeaderFilterBadge___-Q2T2", "columnHeaderFilterDropdown": "Table-module__columnHeaderFilterDropdown___M-fD4" };
2713
+ var Table_module_default = { "tableWrapper": "Table-module__tableWrapper___3cqiD", "isAccordion": "Table-module__isAccordion___-uIs6", "isToolbar": "Table-module__isToolbar___LdS-m", "hasCustomHeaderCell": "Table-module__hasCustomHeaderCell___AtCk8", "table": "Table-module__table___5d7g0", "ant-table-selection-column": "Table-module__ant-table-selection-column___H9vtu", "hasCustomBodyCell": "Table-module__hasCustomBodyCell___sf8j8", "firstRow": "Table-module__firstRow___Xq-Hi", "lastRow": "Table-module__lastRow___ahv4g", "showHoverEffect": "Table-module__showHoverEffect___IyKyO", "columnHeader": "Table-module__columnHeader___Unr6d", "columnHeaderLeft": "Table-module__columnHeaderLeft___mp7pK", "columnHeaderSortArea": "Table-module__columnHeaderSortArea___jrIYo", "columnHeaderLabel": "Table-module__columnHeaderLabel___A-mRu", "columnHeaderSortIcon": "Table-module__columnHeaderSortIcon___mWVZN", "columnHeaderSortIconActive": "Table-module__columnHeaderSortIconActive___wHAqC", "columnHeaderFilterWrapper": "Table-module__columnHeaderFilterWrapper___DnSve", "columnHeaderFilterBtn": "Table-module__columnHeaderFilterBtn___NR7DY", "columnHeaderFilterBtnActive": "Table-module__columnHeaderFilterBtnActive___JdO11", "columnHeaderFilterBadge": "Table-module__columnHeaderFilterBadge___-Q2T2", "columnHeaderFilterDropdown": "Table-module__columnHeaderFilterDropdown___M-fD4" };
2714
2714
 
2715
2715
  // src/atom/Table/Table.tsx
2716
2716
  var import_jsx_runtime19 = require("react/jsx-runtime");
@@ -2809,13 +2809,29 @@ function ColumnHeader({
2809
2809
  ] })
2810
2810
  ] });
2811
2811
  }
2812
- function processColumns(columns) {
2812
+ function processColumns(columns, headerCellClassName, bodyCellClassName) {
2813
2813
  if (!columns) return void 0;
2814
2814
  return columns.map((col) => {
2815
- const _a = col, { headerProps, title } = _a, rest = __objRest(_a, ["headerProps", "title"]);
2816
- if (!headerProps) return __spreadValues({ title }, rest);
2815
+ const _a = col, { headerProps, title, onHeaderCell, onCell } = _a, rest = __objRest(_a, ["headerProps", "title", "onHeaderCell", "onCell"]);
2816
+ const resolvedOnHeaderCell = (column) => {
2817
+ var _a2;
2818
+ const base = (_a2 = onHeaderCell == null ? void 0 : onHeaderCell(column)) != null ? _a2 : {};
2819
+ return __spreadProps(__spreadValues({}, base), {
2820
+ className: (0, import_clsx12.default)(base.className, headerCellClassName)
2821
+ });
2822
+ };
2823
+ const resolvedOnCell = (record, rowIndex) => {
2824
+ var _a2;
2825
+ const base = (_a2 = onCell == null ? void 0 : onCell(record, rowIndex)) != null ? _a2 : {};
2826
+ return __spreadProps(__spreadValues({}, base), {
2827
+ className: (0, import_clsx12.default)(base.className, bodyCellClassName)
2828
+ });
2829
+ };
2830
+ const processedTitle = headerProps ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ColumnHeader, __spreadValues({ label: title }, headerProps)) : title;
2817
2831
  return __spreadProps(__spreadValues({}, rest), {
2818
- title: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ColumnHeader, __spreadValues({ label: title }, headerProps))
2832
+ title: processedTitle,
2833
+ onHeaderCell: resolvedOnHeaderCell,
2834
+ onCell: resolvedOnCell
2819
2835
  });
2820
2836
  });
2821
2837
  }
@@ -2841,7 +2857,10 @@ function Table(props) {
2841
2857
  emptyState,
2842
2858
  hideHeader,
2843
2859
  loadingIndicator,
2844
- style
2860
+ style,
2861
+ headerCellClassName,
2862
+ bodyCellClassName,
2863
+ rowClassName
2845
2864
  } = _a, rest = __objRest(_a, [
2846
2865
  "size",
2847
2866
  "variant",
@@ -2862,7 +2881,10 @@ function Table(props) {
2862
2881
  "emptyState",
2863
2882
  "hideHeader",
2864
2883
  "loadingIndicator",
2865
- "style"
2884
+ "style",
2885
+ "headerCellClassName",
2886
+ "bodyCellClassName",
2887
+ "rowClassName"
2866
2888
  ]);
2867
2889
  const isChildVariant = isAccordion || isToolbar;
2868
2890
  const resolvedPagination = buildPagination(pagination, {
@@ -2872,12 +2894,17 @@ function Table(props) {
2872
2894
  onChange: onPaginationChange
2873
2895
  });
2874
2896
  const processedColumns = React5.useMemo(
2875
- () => processColumns(columns),
2876
- // eslint-disable-next-line react-hooks/exhaustive-deps
2877
- [columns]
2897
+ () => processColumns(columns, headerCellClassName, bodyCellClassName),
2898
+ [columns, headerCellClassName, bodyCellClassName]
2878
2899
  );
2900
+ const resolvedRowSelection = React5.useMemo(() => {
2901
+ if (!rowSelection) return void 0;
2902
+ return __spreadValues({
2903
+ columnWidth: 48
2904
+ }, rowSelection);
2905
+ }, [rowSelection]);
2879
2906
  const resolvedOnRow = React5.useMemo(() => {
2880
- const onChange = rowSelection == null ? void 0 : rowSelection.onChange;
2907
+ const onChange = resolvedRowSelection == null ? void 0 : resolvedRowSelection.onChange;
2881
2908
  if (variant !== "selectable" || !onChange) return onRow;
2882
2909
  return (record, index) => {
2883
2910
  var _a2;
@@ -2889,7 +2916,7 @@ function Table(props) {
2889
2916
  var _a3, _b2;
2890
2917
  (_a3 = base.onClick) == null ? void 0 : _a3.call(base, e);
2891
2918
  const key = getKey(record, index);
2892
- const current2 = (_b2 = rowSelection.selectedRowKeys) != null ? _b2 : [];
2919
+ const current2 = (_b2 = resolvedRowSelection.selectedRowKeys) != null ? _b2 : [];
2893
2920
  const isSelected = current2.some((k) => k === key);
2894
2921
  const newKeys = isSelected ? current2.filter((k) => k !== key) : [...current2, key];
2895
2922
  const newRows = (dataSource != null ? dataSource : []).filter(
@@ -2899,15 +2926,19 @@ function Table(props) {
2899
2926
  }
2900
2927
  });
2901
2928
  };
2902
- }, [variant, rowSelection, rowKey, onRow, dataSource]);
2929
+ }, [variant, resolvedRowSelection, rowKey, onRow, dataSource]);
2903
2930
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2904
2931
  "div",
2905
2932
  {
2906
2933
  className: (0, import_clsx12.default)(
2907
2934
  Table_module_default.tableWrapper,
2908
2935
  Table_module_default.showHoverEffect,
2909
- { [Table_module_default.isAccordion]: isAccordion },
2910
- { [Table_module_default.isToolbar]: isToolbar },
2936
+ {
2937
+ [Table_module_default.isAccordion]: isAccordion,
2938
+ [Table_module_default.isToolbar]: isToolbar,
2939
+ [Table_module_default.hasCustomHeaderCell]: !!headerCellClassName,
2940
+ [Table_module_default.hasCustomBodyCell]: !!bodyCellClassName
2941
+ },
2911
2942
  className
2912
2943
  ),
2913
2944
  style,
@@ -2919,7 +2950,7 @@ function Table(props) {
2919
2950
  size,
2920
2951
  pagination: resolvedPagination,
2921
2952
  columns: processedColumns,
2922
- rowSelection,
2953
+ rowSelection: resolvedRowSelection,
2923
2954
  rowKey,
2924
2955
  onRow: resolvedOnRow,
2925
2956
  dataSource,
@@ -2929,12 +2960,15 @@ function Table(props) {
2929
2960
  }
2930
2961
  }, rest), {
2931
2962
  loading: loadingIndicator ? { spinning: !!loading && ((_b = dataSource == null ? void 0 : dataSource.length) != null ? _b : 0) > 0, indicator: loadingIndicator } : loading,
2932
- rowClassName: (_, index) => {
2963
+ rowClassName: (record, index) => {
2933
2964
  var _a2;
2934
- return (0, import_clsx12.default)({
2935
- [Table_module_default.firstRow]: index === 0,
2936
- [Table_module_default.lastRow]: index === ((_a2 = dataSource == null ? void 0 : dataSource.length) != null ? _a2 : 0) - 1
2937
- });
2965
+ return (0, import_clsx12.default)(
2966
+ {
2967
+ [Table_module_default.firstRow]: index === 0,
2968
+ [Table_module_default.lastRow]: index === ((_a2 = dataSource == null ? void 0 : dataSource.length) != null ? _a2 : 0) - 1
2969
+ },
2970
+ typeof rowClassName === "function" ? rowClassName(record, index) : rowClassName
2971
+ );
2938
2972
  }
2939
2973
  })
2940
2974
  )
package/dist/index.mjs CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  } from "./chunk-MNARBWAJ.mjs";
19
19
  import {
20
20
  Table
21
- } from "./chunk-BFFLWW7N.mjs";
21
+ } from "./chunk-X3NDICAU.mjs";
22
22
  import {
23
23
  AdvancedDateRangePicker
24
24
  } from "./chunk-UC4NTBDH.mjs";