@arim-aisdc/public-components 2.3.53 → 2.3.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/components/TableMax/TableBody/OriginalRow.d.ts +1 -2
  2. package/dist/components/TableMax/TableBody/OriginalRow.js +3 -8
  3. package/dist/components/TableMax/TableBody/OriginalTableBody.d.ts +1 -1
  4. package/dist/components/TableMax/TableBody/OriginalTableBody.js +1 -8
  5. package/dist/components/TableMax/TableBody/TableBody.js +4 -4
  6. package/dist/components/TableMax/TableBody/VirtualRow.d.ts +1 -2
  7. package/dist/components/TableMax/TableBody/VirtualRow.js +141 -139
  8. package/dist/components/TableMax/TableBody/VirtualTableBody.d.ts +1 -1
  9. package/dist/components/TableMax/TableBody/VirtualTableBody.js +20 -26
  10. package/dist/components/TableMax/TableBody/components/Total.d.ts +1 -2
  11. package/dist/components/TableMax/TableBody/components/Total.js +6 -59
  12. package/dist/components/TableMax/TableBody/components/VirtualTotal.d.ts +0 -0
  13. package/dist/components/TableMax/TableBody/components/VirtualTotal.js +0 -0
  14. package/dist/components/TableMax/TableHeader/TableHeader.js +4 -4
  15. package/dist/components/TableMax/TableHeader/VirtualTableHeader/ColGroup.d.ts +0 -11
  16. package/dist/components/TableMax/TableHeader/VirtualTableHeader/ColGroup.js +47 -32
  17. package/dist/components/TableMax/TableHeader/VirtualTableHeader/index.d.ts +0 -4
  18. package/dist/components/TableMax/TableHeader/VirtualTableHeader/index.js +93 -79
  19. package/dist/components/TableMax/TableHeader/index.d.ts +0 -1
  20. package/dist/components/TableMax/TableHeader/index.js +1 -1
  21. package/dist/components/TableMax/TableMax.js +53 -59
  22. package/dist/components/TableMax/contexts/VirtualScroll/VirtualScrollProvider.d.ts +0 -3
  23. package/dist/components/TableMax/contexts/VirtualScroll/VirtualScrollProvider.js +26 -26
  24. package/dist/components/TableMax/contexts/VirtualScroll/index.d.ts +0 -1
  25. package/dist/components/TableMax/contexts/VirtualScroll/index.js +1 -1
  26. package/dist/components/TableMax/hooks/useColumnWidth.js +3 -2
  27. package/dist/components/TableMax/hooks/useTableComponents.d.ts +0 -6
  28. package/dist/components/TableMax/hooks/useTableComponents.js +25 -19
  29. package/dist/components/TableMax/hooks/useVirtualCalculations copy.d.ts +25 -0
  30. package/dist/components/TableMax/hooks/useVirtualCalculations copy.js +106 -0
  31. package/dist/components/TableMax/hooks/useVirtualCalculations.d.ts +1 -8
  32. package/dist/components/TableMax/hooks/useVirtualCalculations.js +5 -44
  33. package/dist/components/TableMax/hooks/useVirtualScroll.d.ts +0 -4
  34. package/dist/components/TableMax/hooks/useVirtualScroll.js +25 -30
  35. package/dist/components/TableMax/tableMax.less +20 -17
  36. package/dist/components/TableMax/utils.js +8 -3
  37. package/package.json +1 -1
@@ -4,41 +4,14 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- import { findHeaderByColumn, getPinningStyle } from "../../TableHeader/utils";
7
+ import { getPinningStyle } from "../../TableHeader/utils";
8
8
  import "../../TableBody/index.less";
9
- import { useVirtualConfig, useVirtualState } from "../../hooks/useVirtualScroll";
10
-
11
- // 虚拟填充组件
12
9
  import { jsx as _jsx } from "react/jsx-runtime";
13
10
  import { Fragment as _Fragment } from "react/jsx-runtime";
14
- import { jsxs as _jsxs } from "react/jsx-runtime";
15
- var VirtualPadding = function VirtualPadding(_ref) {
16
- var width = _ref.width,
17
- type = _ref.type;
18
- if (!width) return null;
19
- return /*#__PURE__*/_jsx("td", {
20
- style: {
21
- width: "".concat(width, "px"),
22
- // height: '100%',
23
- padding: 0,
24
- border: 'none'
25
- },
26
- className: "virtual-padding virtual-padding-".concat(type)
27
- });
28
- };
29
- export var Total = function Total(_ref2) {
30
- var table = _ref2.table,
31
- totalDatas = _ref2.totalDatas,
32
- rowHeight = _ref2.rowHeight;
11
+ export var Total = function Total(_ref) {
12
+ var table = _ref.table,
13
+ totalDatas = _ref.totalDatas;
33
14
  var footerGroups = table.getFooterGroups();
34
- var state = useVirtualState();
35
- var config = useVirtualConfig();
36
- var leftPinnedColumns = state.leftPinnedColumns,
37
- rightPinnedColumns = state.rightPinnedColumns,
38
- scrollableColumns = state.scrollableColumns,
39
- virtualColumns = state.virtualColumns,
40
- virtualPaddingLeft = state.virtualPaddingLeft,
41
- virtualPaddingRight = state.virtualPaddingRight;
42
15
 
43
16
  // 公共样式对象
44
17
  var rowStyle = {
@@ -50,7 +23,6 @@ export var Total = function Total(_ref2) {
50
23
  };
51
24
  var cellWrapperStyle = {
52
25
  boxSizing: 'border-box',
53
- height: "".concat(rowHeight, "px"),
54
26
  borderTop: '1px solid var(--tableColor2)',
55
27
  borderBottom: '1px solid var(--tableColor2)'
56
28
  };
@@ -61,9 +33,7 @@ export var Total = function Total(_ref2) {
61
33
  var headerId = header.id,
62
34
  colSpan = header.colSpan;
63
35
  var pinningStyle = getPinningStyle(header, table);
64
- var cellStyle = _objectSpread(_objectSpread({}, pinningStyle), {}, {
65
- height: "".concat(rowHeight - 1, "px")
66
- });
36
+ var cellStyle = _objectSpread({}, pinningStyle);
67
37
  return /*#__PURE__*/_jsx("td", {
68
38
  colSpan: colSpan,
69
39
  style: cellStyle,
@@ -82,29 +52,6 @@ export var Total = function Total(_ref2) {
82
52
  return renderCell(header);
83
53
  });
84
54
  };
85
-
86
- // 渲染虚拟滚动列
87
- var renderVirtualColumns = function renderVirtualColumns(footerGroup) {
88
- return /*#__PURE__*/_jsxs(_Fragment, {
89
- children: [leftPinnedColumns.map(function (column, index) {
90
- var header = findHeaderByColumn(footerGroup, column);
91
- return header ? renderCell(header, "-left-".concat(index)) : null;
92
- }), /*#__PURE__*/_jsx(VirtualPadding, {
93
- type: "left",
94
- width: virtualPaddingLeft
95
- }), virtualColumns.map(function (virtualColumn, index) {
96
- var column = scrollableColumns[virtualColumn.index];
97
- var header = findHeaderByColumn(footerGroup, column);
98
- return header ? renderCell(header, "-virtual-".concat(index)) : null;
99
- }), /*#__PURE__*/_jsx(VirtualPadding, {
100
- type: "right",
101
- width: virtualPaddingRight
102
- }), rightPinnedColumns.map(function (column, index) {
103
- var header = findHeaderByColumn(footerGroup, column);
104
- return header ? renderCell(header, "-right-".concat(index)) : null;
105
- })]
106
- });
107
- };
108
55
  return /*#__PURE__*/_jsx(_Fragment, {
109
56
  children: footerGroups.map(function (footerGroup) {
110
57
  var id = footerGroup.id,
@@ -112,7 +59,7 @@ export var Total = function Total(_ref2) {
112
59
  return /*#__PURE__*/_jsx("tr", {
113
60
  className: "tbody-tr",
114
61
  style: rowStyle,
115
- children: config.openVirtualColumns ? renderVirtualColumns(footerGroup) : renderNormalColumns(headers)
62
+ children: renderNormalColumns(headers)
116
63
  }, id);
117
64
  })
118
65
  });
@@ -5,10 +5,10 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  import React from 'react';
8
- import { useTableComponents } from "../hooks/useTableComponents";
8
+ import { OriginalTableHeader } from "./OriginalTableHeader";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  export var TableHeader = function TableHeader(props) {
11
- var _useTableComponents = useTableComponents(),
12
- HeaderComponent = _useTableComponents.TableHeader;
13
- return /*#__PURE__*/_jsx(HeaderComponent, _objectSpread({}, props));
11
+ // const { TableHeader: HeaderComponent } = useTableComponents();
12
+ // return <HeaderComponent {...props} />;
13
+ return /*#__PURE__*/_jsx(OriginalTableHeader, _objectSpread({}, props));
14
14
  };
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- interface ColGroupProps {
3
- leftPinnedColumns: any[];
4
- scrollableColumns: any[];
5
- rightPinnedColumns: any[];
6
- virtualColumns: any[];
7
- virtualPaddingLeft: number;
8
- virtualPaddingRight: number;
9
- }
10
- export declare const ColGroup: React.FC<ColGroupProps>;
11
- export {};
@@ -1,32 +1,47 @@
1
- import React from 'react';
2
- import { useVirtualConfig } from "../../hooks/useVirtualScroll";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- import { Fragment as _Fragment } from "react/jsx-runtime";
5
- import { jsxs as _jsxs } from "react/jsx-runtime";
6
- export var ColGroup = function ColGroup(_ref) {
7
- var leftPinnedColumns = _ref.leftPinnedColumns,
8
- scrollableColumns = _ref.scrollableColumns,
9
- rightPinnedColumns = _ref.rightPinnedColumns,
10
- virtualColumns = _ref.virtualColumns,
11
- virtualPaddingLeft = _ref.virtualPaddingLeft,
12
- virtualPaddingRight = _ref.virtualPaddingRight;
13
- var renderColumn = function renderColumn(column) {
14
- var size = column.getSize() || 120;
15
- return /*#__PURE__*/_jsx("col", {
16
- width: size
17
- }, column.id);
18
- };
19
- var _useVirtualConfig = useVirtualConfig(),
20
- openVirtualColumns = _useVirtualConfig.openVirtualColumns;
21
- return /*#__PURE__*/_jsxs("colgroup", {
22
- children: [leftPinnedColumns === null || leftPinnedColumns === void 0 ? void 0 : leftPinnedColumns.map(renderColumn), !openVirtualColumns ? scrollableColumns.map(renderColumn) : /*#__PURE__*/_jsxs(_Fragment, {
23
- children: [Number(virtualPaddingLeft) > 0 && /*#__PURE__*/_jsx("col", {
24
- width: virtualPaddingLeft
25
- }), virtualColumns.map(function (virtualColumn) {
26
- return renderColumn(scrollableColumns[virtualColumn.index]);
27
- }), Number(virtualPaddingRight) > 0 && /*#__PURE__*/_jsx("col", {
28
- width: virtualPaddingRight
29
- })]
30
- }), rightPinnedColumns === null || rightPinnedColumns === void 0 ? void 0 : rightPinnedColumns.map(renderColumn)]
31
- });
32
- };
1
+ // import React from 'react';
2
+ // import { useIsVirtualEnabled, useVirtualConfig } from '../../hooks/useVirtualScroll';
3
+
4
+ // interface ColGroupProps {
5
+ // leftPinnedColumns: any[];
6
+ // scrollableColumns: any[];
7
+ // rightPinnedColumns: any[];
8
+ // virtualColumns: any[];
9
+ // virtualPaddingLeft: number;
10
+ // virtualPaddingRight: number;
11
+ // }
12
+
13
+ // export const ColGroup: React.FC<ColGroupProps> = ({
14
+ // leftPinnedColumns,
15
+ // scrollableColumns,
16
+ // rightPinnedColumns,
17
+ // virtualColumns,
18
+ // virtualPaddingLeft,
19
+ // virtualPaddingRight,
20
+ // }) => {
21
+ // const renderColumn = (column: any) => {
22
+ // const size = column.getSize() || 120;
23
+ // return <col key={column.id} width={size} />;
24
+ // };
25
+ // const { openVirtualColumns } = useVirtualConfig();
26
+
27
+ // return (
28
+ // <colgroup>
29
+ // {/* 左侧固定列 */}
30
+ // {leftPinnedColumns?.map(renderColumn)}
31
+
32
+ // {
33
+ // !openVirtualColumns ? scrollableColumns.map(renderColumn) :
34
+ // <>
35
+ // {/* 虚拟滚动区域 */}
36
+ // {Number(virtualPaddingLeft) > 0 && <col width={virtualPaddingLeft} />}
37
+ // {virtualColumns.map(virtualColumn =>
38
+ // renderColumn(scrollableColumns[virtualColumn.index])
39
+ // )}
40
+ // {Number(virtualPaddingRight) > 0 && <col width={virtualPaddingRight} />}</>
41
+ // }
42
+
43
+ // {/* 右侧固定列 */}
44
+ // {rightPinnedColumns?.map(renderColumn)}
45
+ // </colgroup>
46
+ // );
47
+ // };
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { TableHeaderProps } from '../OriginalTableHeader';
3
- import './index.less';
4
- export declare const VirtualTableHeader: React.FC<TableHeaderProps>;
@@ -1,79 +1,93 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- import React from 'react';
8
- import { useVirtualConfig, useVirtualState } from "../../hooks/useVirtualScroll";
9
- import { ColGroup } from "./ColGroup";
10
- import { PinnedColumns } from "./PinnedColumns";
11
- import { VirtualPadding } from "./VirtualPadding";
12
- import { VirtualColumns } from "./VirtualColumns";
13
- import "./index.less";
14
- import { ScrollColumns } from "./ScrollColumns";
15
- import { jsx as _jsx } from "react/jsx-runtime";
16
- import { Fragment as _Fragment } from "react/jsx-runtime";
17
- import { jsxs as _jsxs } from "react/jsx-runtime";
18
- export var VirtualTableHeader = function VirtualTableHeader(props) {
19
- var table = props.table,
20
- hasGroup = props.hasGroup,
21
- _props$rowHeight = props.rowHeight,
22
- rowHeight = _props$rowHeight === void 0 ? 40 : _props$rowHeight;
23
- var state = useVirtualState();
24
- var config = useVirtualConfig();
25
- var headerGroups = table.getHeaderGroups();
26
- var leftPinnedColumns = state.leftPinnedColumns,
27
- rightPinnedColumns = state.rightPinnedColumns,
28
- scrollableColumns = state.scrollableColumns,
29
- virtualColumns = state.virtualColumns,
30
- virtualPaddingLeft = state.virtualPaddingLeft,
31
- virtualPaddingRight = state.virtualPaddingRight;
32
- return /*#__PURE__*/_jsxs("table", {
33
- children: [/*#__PURE__*/_jsx(ColGroup, {
34
- leftPinnedColumns: leftPinnedColumns,
35
- scrollableColumns: scrollableColumns,
36
- rightPinnedColumns: rightPinnedColumns,
37
- virtualColumns: virtualColumns,
38
- virtualPaddingLeft: virtualPaddingLeft,
39
- virtualPaddingRight: virtualPaddingRight
40
- }), /*#__PURE__*/_jsx("thead", {
41
- children: headerGroups.map(function (headerGroup) {
42
- return /*#__PURE__*/_jsxs("tr", {
43
- className: "table-thead-tr cus-table-thead-tr",
44
- style: {
45
- height: hasGroup && headerGroup.depth === 0 ? "".concat(rowHeight, "px") : 'auto',
46
- width: '100%',
47
- position: 'relative'
48
- },
49
- children: [/*#__PURE__*/_jsx(PinnedColumns, _objectSpread({
50
- columns: leftPinnedColumns,
51
- headerGroup: headerGroup,
52
- position: "left"
53
- }, props)), !config.openVirtualColumns ? /*#__PURE__*/_jsx(_Fragment, {
54
- children: /*#__PURE__*/_jsx(ScrollColumns, _objectSpread({
55
- scrollableColumns: scrollableColumns,
56
- headerGroup: headerGroup
57
- }, props))
58
- }) : /*#__PURE__*/_jsxs(_Fragment, {
59
- children: [/*#__PURE__*/_jsx(VirtualPadding, {
60
- type: "left",
61
- width: virtualPaddingLeft
62
- }), /*#__PURE__*/_jsx(VirtualColumns, _objectSpread({
63
- virtualColumns: virtualColumns,
64
- scrollableColumns: scrollableColumns,
65
- headerGroup: headerGroup
66
- }, props)), /*#__PURE__*/_jsx(VirtualPadding, {
67
- type: "right",
68
- width: virtualPaddingRight
69
- })]
70
- }), /*#__PURE__*/_jsx(PinnedColumns, _objectSpread({
71
- columns: rightPinnedColumns,
72
- headerGroup: headerGroup,
73
- position: "right"
74
- }, props))]
75
- }, headerGroup.id);
76
- })
77
- })]
78
- });
79
- };
1
+ // import React from 'react';
2
+ // import { useVirtualConfig, useVirtualState } from '../../hooks/useVirtualScroll';
3
+ // import { ColGroup } from './ColGroup';
4
+ // import { PinnedColumns } from './PinnedColumns';
5
+ // import { VirtualPadding } from './VirtualPadding';
6
+ // import { VirtualColumns } from './VirtualColumns';
7
+ // import { TableHeaderProps } from '../OriginalTableHeader';
8
+ // import './index.less';
9
+ // import { ScrollColumns } from './ScrollColumns';
10
+
11
+ // export const VirtualTableHeader: React.FC<TableHeaderProps> = (props) => {
12
+ // const { table, hasGroup, rowHeight = 40 } = props;
13
+ // const state = useVirtualState();
14
+ // const config = useVirtualConfig();
15
+
16
+ // const headerGroups = table.getHeaderGroups();
17
+
18
+ // const {
19
+ // leftPinnedColumns,
20
+ // rightPinnedColumns,
21
+ // scrollableColumns,
22
+ // virtualColumns,
23
+ // virtualPaddingLeft,
24
+ // virtualPaddingRight
25
+ // } = state;
26
+
27
+ // return (
28
+ // <table>
29
+ // <ColGroup
30
+ // leftPinnedColumns={leftPinnedColumns}
31
+ // scrollableColumns={scrollableColumns}
32
+ // rightPinnedColumns={rightPinnedColumns}
33
+ // virtualColumns={virtualColumns}
34
+ // virtualPaddingLeft={virtualPaddingLeft}
35
+ // virtualPaddingRight={virtualPaddingRight}
36
+ // />
37
+
38
+ // <thead>
39
+ // {headerGroups.map(headerGroup => (
40
+ // <tr
41
+ // key={headerGroup.id}
42
+ // className="table-thead-tr cus-table-thead-tr"
43
+ // style={{
44
+ // height: hasGroup && headerGroup.depth === 0 ? `${rowHeight}px` : 'auto',
45
+ // width: '100%',
46
+ // position: 'relative'
47
+ // }}
48
+ // >
49
+ // {/* 左侧固定列 */}
50
+ // <PinnedColumns
51
+ // columns={leftPinnedColumns}
52
+ // headerGroup={headerGroup}
53
+ // position="left"
54
+ // {...props}
55
+ // />
56
+ // {
57
+ // !config.openVirtualColumns ? <>
58
+ // <ScrollColumns
59
+ // scrollableColumns={scrollableColumns}
60
+ // headerGroup={headerGroup}
61
+ // {...props}
62
+ // />
63
+ // </> : <>
64
+ // {/* 左侧虚拟填充 */}
65
+ // <VirtualPadding type="left" width={virtualPaddingLeft} />
66
+
67
+ // {/* 虚拟滚动列 */}
68
+ // <VirtualColumns
69
+ // virtualColumns={virtualColumns}
70
+ // scrollableColumns={scrollableColumns}
71
+ // headerGroup={headerGroup}
72
+ // {...props}
73
+ // />
74
+
75
+ // {/* 右侧虚拟填充 */}
76
+ // <VirtualPadding type="right" width={virtualPaddingRight} />
77
+
78
+ // </>
79
+ // }
80
+
81
+ // {/* 右侧固定列 */}
82
+ // <PinnedColumns
83
+ // columns={rightPinnedColumns}
84
+ // headerGroup={headerGroup}
85
+ // position="right"
86
+ // {...props}
87
+ // />
88
+ // </tr>
89
+ // ))}
90
+ // </thead>
91
+ // </table>
92
+ // );
93
+ // };
@@ -1,4 +1,3 @@
1
1
  import { TableHeader } from './TableHeader';
2
- export { VirtualTableHeader } from './VirtualTableHeader';
3
2
  export { OriginalTableHeader } from './OriginalTableHeader';
4
3
  export default TableHeader;
@@ -1,4 +1,4 @@
1
1
  import { TableHeader } from "./TableHeader";
2
- export { VirtualTableHeader } from "./VirtualTableHeader";
2
+ // export { VirtualTableHeader } from './VirtualTableHeader';
3
3
  export { OriginalTableHeader } from "./OriginalTableHeader";
4
4
  export default TableHeader;
@@ -40,7 +40,6 @@ import "./tableMax.less";
40
40
  import { downloadExcel, getFormatFilters, getFormatFiltersV2, getFormatSorting, operationColumnNoTooltips } from "./utils";
41
41
  import { useTableScrollShadow } from "./hooks/useTableScrollShadow";
42
42
  import { ExportTableData } from "./components/Export";
43
- import { VirtualScrollProvider } from "./contexts";
44
43
  import { jsx as _jsx } from "react/jsx-runtime";
45
44
  import { jsxs as _jsxs } from "react/jsx-runtime";
46
45
  export var ColumnType = /*#__PURE__*/function (ColumnType) {
@@ -55,6 +54,8 @@ var getCurrentRouterName = function getCurrentRouterName() {
55
54
  return window.location.pathname.slice(1);
56
55
  };
57
56
  var compactModeRowHeight = 30;
57
+ var compactModeCellPadding = '0 2px';
58
+ var cellPadding = '0 8px';
58
59
 
59
60
  /**将空默认值提升为组件外部的常量,避免引发不必要的渲染 */
60
61
  var defaultData = [];
@@ -511,7 +512,7 @@ var TableMax = function TableMax(_ref) {
511
512
 
512
513
  /**根据缓存数据设置一些状态 */
513
514
  var setColumnInfoFromCache = function setColumnInfoFromCache(tableColumns) {
514
- var _localStorage$getItem, _tableMaxConfig$cache, _cache$columnPinning$, _cache$columnPinning, _cache$columnPinning$2, _cache$columnPinning2;
515
+ var _localStorage$getItem, _tableMaxConfig$cache, _cache$columnVisibili, _cache$columnPinning$, _cache$columnPinning, _cache$columnPinning$2, _cache$columnPinning2;
515
516
  var cache = JSON.parse((_localStorage$getItem = localStorage.getItem(tableKey)) !== null && _localStorage$getItem !== void 0 ? _localStorage$getItem : '{}');
516
517
  if (cache && cache !== null && cache !== void 0 && cache.editTime && +new Date() - cache.editTime > ((_tableMaxConfig$cache = tableMaxConfig.cacheMaxAge) !== null && _tableMaxConfig$cache !== void 0 ? _tableMaxConfig$cache : CACHE_MAX_AGE)) {
517
518
  return;
@@ -529,7 +530,7 @@ var TableMax = function TableMax(_ref) {
529
530
  }));
530
531
  };
531
532
  var _ref5 = _objectSpread(_objectSpread({}, cache), {}, {
532
- columnVisibility: cache.columnVisibility ? pickByKeys(cache.columnVisibility, columnsIdSet) : {},
533
+ columnVisibility: cache.columnVisibility ? pickByKeys((_cache$columnVisibili = cache.columnVisibility) !== null && _cache$columnVisibili !== void 0 ? _cache$columnVisibili : {}, columnsIdSet) : {},
533
534
  columnPinning: cache.columnPinning ? {
534
535
  left: (_cache$columnPinning$ = cache === null || cache === void 0 || (_cache$columnPinning = cache.columnPinning) === null || _cache$columnPinning === void 0 || (_cache$columnPinning = _cache$columnPinning.left) === null || _cache$columnPinning === void 0 ? void 0 : _cache$columnPinning.filter(function (id) {
535
536
  return columnsIdSet.has(id);
@@ -553,8 +554,10 @@ var TableMax = function TableMax(_ref) {
553
554
  if (cacheHeaderRowNum) {
554
555
  setheaderRowNum(cacheHeaderRowNum);
555
556
  }
556
- setCompactMode(cacheCompactMode === true);
557
- setRowHeight(cacheCompactMode === true ? compactModeRowHeight : propsRowHeight);
557
+
558
+ // setCompactMode(cacheCompactMode === true);
559
+ // setRowHeight(cacheCompactMode === true ? compactModeRowHeight : propsRowHeight);
560
+ changeCompactModeStyle(cacheCompactMode === true);
558
561
  var newColumnVisibleConfig = _objectSpread(_objectSpread({}, columnVisibleConfig), cacheColumnVisibility);
559
562
  setColumnVisibility(newColumnVisibleConfig);
560
563
 
@@ -1139,24 +1142,21 @@ var TableMax = function TableMax(_ref) {
1139
1142
  hasTotalRow: hasTotalRow,
1140
1143
  totalDatas: totalDatas,
1141
1144
  setRowSelection: setRowSelection,
1142
- openMemo: openMemo !== null && openMemo !== void 0 ? openMemo : tableMaxConfig === null || tableMaxConfig === void 0 ? void 0 : tableMaxConfig.openMemo
1145
+ openMemo: openMemo !== null && openMemo !== void 0 ? openMemo : tableMaxConfig === null || tableMaxConfig === void 0 ? void 0 : tableMaxConfig.openMemo,
1146
+ openVirtualRows: openVirtualRows
1143
1147
  };
1144
1148
  var changeCompactMode = function changeCompactMode() {
1145
- setCompactMode(!compactMode);
1146
- setRowHeight(!compactMode ? compactModeRowHeight : propsRowHeight);
1149
+ changeCompactModeStyle(!compactMode);
1150
+ };
1151
+ var changeCompactModeStyle = function changeCompactModeStyle(compactMode) {
1152
+ var _tableContentRef$curr2, _tableContentRef$curr3;
1153
+ var newHeight = compactMode ? compactModeRowHeight : propsRowHeight;
1154
+ var newPadding = compactMode ? compactModeCellPadding : cellPadding;
1155
+ (_tableContentRef$curr2 = tableContentRef.current) === null || _tableContentRef$curr2 === void 0 || (_tableContentRef$curr2 = _tableContentRef$curr2.style) === null || _tableContentRef$curr2 === void 0 || _tableContentRef$curr2.setProperty('--cell-height', "".concat(newHeight, "px"));
1156
+ (_tableContentRef$curr3 = tableContentRef.current) === null || _tableContentRef$curr3 === void 0 || (_tableContentRef$curr3 = _tableContentRef$curr3.style) === null || _tableContentRef$curr3 === void 0 || _tableContentRef$curr3.setProperty('--cell-padding', newPadding);
1157
+ setCompactMode(compactMode);
1158
+ setRowHeight(newHeight);
1147
1159
  };
1148
- var virtualConfig = useMemo(function () {
1149
- return {
1150
- openVirtualColumns: openVirtualColumns,
1151
- openVirtualRows: openVirtualRows,
1152
- rowHeight: rowHeight,
1153
- columnOverscan: 3,
1154
- rowOverscan: 10
1155
- };
1156
- }, [openVirtualColumns, openVirtualRows, rowHeight]);
1157
-
1158
- // const components = useTableComponents();
1159
-
1160
1160
  return /*#__PURE__*/_jsx(Form, {
1161
1161
  form: form,
1162
1162
  component: false,
@@ -1321,46 +1321,40 @@ var TableMax = function TableMax(_ref) {
1321
1321
  setColumnVisibility: setColumnVisibility
1322
1322
  })]
1323
1323
  })]
1324
- }), /*#__PURE__*/_jsx(VirtualScrollProvider, {
1325
- config: virtualConfig,
1326
- table: table,
1327
- tableHeaderRef: tableHeaderRef,
1328
- tableBodyRef: tableBodyRef,
1329
- children: /*#__PURE__*/_jsx("div", {
1330
- className: "table-max-content cus-table-max-content ".concat(compactMode ? 'table-max-content-compact' : null),
1331
- children: /*#__PURE__*/_jsxs("div", {
1332
- className: "table-center",
1333
- ref: tableContentRef
1334
- // style={{ maxHeight: !autoHeight ? defaultScrollY : 'fit-content' }}
1324
+ }), /*#__PURE__*/_jsx("div", {
1325
+ className: "table-max-content cus-table-max-content ".concat(compactMode ? 'table-max-content-compact' : null),
1326
+ children: /*#__PURE__*/_jsxs("div", {
1327
+ className: "table-center",
1328
+ ref: tableContentRef
1329
+ // style={{ maxHeight: !autoHeight ? defaultScrollY : 'fit-content' }}
1330
+ ,
1331
+ children: [/*#__PURE__*/_jsx("div", {
1332
+ className: "table-header-wrapper",
1333
+ children: /*#__PURE__*/_jsx("div", {
1334
+ ref: tableHeaderRef,
1335
+ className: "table-header",
1336
+ children: /*#__PURE__*/_jsx(TableHeader, _objectSpread({}, tableHeaderProps))
1337
+ })
1338
+ }), /*#__PURE__*/_jsx("div", {
1339
+ ref: tableBodyRef,
1340
+ className: "table-body"
1341
+ // onScroll={scrollHandler}
1335
1342
  ,
1336
- children: [/*#__PURE__*/_jsx("div", {
1337
- className: "table-header-wrapper",
1338
- children: /*#__PURE__*/_jsx("div", {
1339
- ref: tableHeaderRef,
1340
- className: "table-header",
1341
- children: /*#__PURE__*/_jsx(TableHeader, _objectSpread({}, tableHeaderProps))
1342
- })
1343
- }), /*#__PURE__*/_jsx("div", {
1344
- ref: tableBodyRef,
1345
- className: "table-body"
1346
- // onScroll={scrollHandler}
1347
- ,
1348
- style: {
1349
- width: "100%"
1350
- },
1351
- onMouseEnter: function onMouseEnter() {
1352
- var _tableBodyRef$current;
1353
- // 给当前元素添加hover类
1354
- (_tableBodyRef$current = tableBodyRef.current) === null || _tableBodyRef$current === void 0 || _tableBodyRef$current.classList.add('hover-active');
1355
- },
1356
- onMouseLeave: function onMouseLeave() {
1357
- var _tableBodyRef$current2;
1358
- // 移除当前元素的hover类
1359
- (_tableBodyRef$current2 = tableBodyRef.current) === null || _tableBodyRef$current2 === void 0 || _tableBodyRef$current2.classList.remove('hover-active');
1360
- },
1361
- children: /*#__PURE__*/_jsx(TableBody, _objectSpread({}, tableBodyProps))
1362
- })]
1363
- })
1343
+ style: {
1344
+ width: "100%"
1345
+ },
1346
+ onMouseEnter: function onMouseEnter() {
1347
+ var _tableBodyRef$current;
1348
+ // 给当前元素添加hover类
1349
+ (_tableBodyRef$current = tableBodyRef.current) === null || _tableBodyRef$current === void 0 || _tableBodyRef$current.classList.add('hover-active');
1350
+ },
1351
+ onMouseLeave: function onMouseLeave() {
1352
+ var _tableBodyRef$current2;
1353
+ // 移除当前元素的hover类
1354
+ (_tableBodyRef$current2 = tableBodyRef.current) === null || _tableBodyRef$current2 === void 0 || _tableBodyRef$current2.classList.remove('hover-active');
1355
+ },
1356
+ children: /*#__PURE__*/_jsx(TableBody, _objectSpread({}, tableBodyProps))
1357
+ })]
1364
1358
  })
1365
1359
  }), pagination && /*#__PURE__*/_jsx("div", {
1366
1360
  className: "table-max-footer",
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { VirtualScrollProviderProps } from './types';
3
- export declare const VirtualScrollProvider: React.FC<VirtualScrollProviderProps>;