linkmore-design 1.1.27-alpha.0 → 1.1.27-alpha.1

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 (48) hide show
  1. package/dist/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  2. package/dist/LmEditTable/components/index.d.ts +2 -1
  3. package/dist/LmEditTable/util.d.ts +1 -0
  4. package/{lib/LmEditTable/virtual/VirtualRowBack.d.ts → dist/LmEditTable/virtual/VirtualRow2.d.ts} +7 -6
  5. package/dist/LmTable/virTual/VirtualRow.d.ts +1 -1
  6. package/dist/index.umd.js +280 -87
  7. package/dist/index.umd.min.js +21 -21
  8. package/dist/variables.css +27 -0
  9. package/es/LmEditTable/EditTable.js +19 -7
  10. package/es/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  11. package/es/LmEditTable/components/customRenderEmpty.js +20 -0
  12. package/es/LmEditTable/components/index.d.ts +2 -1
  13. package/es/LmEditTable/components/index.js +2 -1
  14. package/es/LmEditTable/style/index.css +27 -0
  15. package/es/LmEditTable/style/variables.css +27 -0
  16. package/es/LmEditTable/util.d.ts +1 -0
  17. package/es/LmEditTable/util.js +11 -0
  18. package/es/LmEditTable/virtual/VirtualRow.js +94 -16
  19. package/{dist/LmEditTable/virtual/VirtualRowBack.d.ts → es/LmEditTable/virtual/VirtualRow2.d.ts} +7 -6
  20. package/es/LmEditTable/virtual/VirtualRow2.js +62 -0
  21. package/es/LmEditTable/virtual/VirtualTable.js +17 -9
  22. package/es/LmEditTable/virtual/context.js +14 -2
  23. package/es/LmTable/virTual/VirtualRow.d.ts +1 -1
  24. package/es/LmTable/virTual/VirtualRow.js +80 -44
  25. package/es/LmTable/virTual/VirtualTable.js +17 -9
  26. package/es/LmTable/virTual/context.js +14 -2
  27. package/es/styles/variables.css +27 -0
  28. package/lib/LmEditTable/EditTable.js +18 -5
  29. package/lib/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  30. package/lib/LmEditTable/components/customRenderEmpty.js +32 -0
  31. package/lib/LmEditTable/components/index.d.ts +2 -1
  32. package/lib/LmEditTable/components/index.js +8 -0
  33. package/lib/LmEditTable/style/index.css +27 -0
  34. package/lib/LmEditTable/style/variables.css +27 -0
  35. package/lib/LmEditTable/util.d.ts +1 -0
  36. package/lib/LmEditTable/util.js +13 -0
  37. package/lib/LmEditTable/virtual/VirtualRow.js +93 -16
  38. package/{es/LmEditTable/virtual/VirtualRowBack.d.ts → lib/LmEditTable/virtual/VirtualRow2.d.ts} +1 -0
  39. package/lib/LmEditTable/virtual/{VirtualRowBack.js → VirtualRow2.js} +13 -48
  40. package/lib/LmEditTable/virtual/VirtualTable.js +16 -8
  41. package/lib/LmEditTable/virtual/context.js +14 -2
  42. package/lib/LmTable/virTual/VirtualRow.d.ts +1 -1
  43. package/lib/LmTable/virTual/VirtualRow.js +79 -44
  44. package/lib/LmTable/virTual/VirtualTable.js +16 -8
  45. package/lib/LmTable/virTual/context.js +14 -2
  46. package/lib/styles/variables.css +27 -0
  47. package/package.json +1 -1
  48. package/es/LmEditTable/virtual/VirtualRowBack.js +0 -100
@@ -28,32 +28,62 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
28
28
  return t;
29
29
  };
30
30
 
31
- var VirtualRow = /*#__PURE__*/_react.default.memo(function (_a, ref) {
32
- var children = _a.children,
33
- pref = _a.pref,
34
- resetProps = __rest(_a, ["children", "pref"]);
31
+ var useOptions = function useOptions(_ref) {
32
+ var children = _ref.children,
33
+ ref = _ref.ref,
34
+ trRef = _ref.trRef;
35
35
 
36
36
  var _useStore = (0, _context.useStore)(),
37
37
  state = _useStore.state,
38
- dispatch = _useStore.dispatch;
38
+ dispatch = _useStore.dispatch,
39
+ instance = _useStore.instance;
39
40
 
41
+ var virtualItems = instance.columnVirtual.virtualItems;
40
42
  var rowHeight = state.rowHeight,
41
43
  totalLen = state.totalLen;
42
- var trRef = (0, _react.useRef)(null); // 列长度
44
+ var sliceColumns = (0, _react.useMemo)(function () {
45
+ return children === null || children === void 0 ? void 0 : children.reduce(function (pre, cur) {
46
+ var _a, _b;
43
47
 
44
- var columnsLen = (0, _react.useMemo)(function () {
45
- var _a;
48
+ if (typeof ((_a = cur.props) === null || _a === void 0 ? void 0 : _a.fixLeft) === 'number') {
49
+ pre.leftColumns.push(cur);
50
+ return pre;
51
+ }
46
52
 
47
- return (_a = children === null || children === void 0 ? void 0 : children.length) !== null && _a !== void 0 ? _a : 0;
53
+ if (typeof ((_b = cur.props) === null || _b === void 0 ? void 0 : _b.fixRight) === 'number') {
54
+ pre.rightColumns.push(cur);
55
+ return pre;
56
+ }
57
+
58
+ pre.centerColumns.push(cur);
59
+ return pre;
60
+ }, {
61
+ leftColumns: [],
62
+ rightColumns: [],
63
+ centerColumns: []
64
+ });
48
65
  }, [children]);
49
66
  (0, _react.useEffect)(function () {
50
- if (state.columnsLen !== columnsLen) {
67
+ dispatch({
68
+ type: 'changeSliceColumns',
69
+ sliceColumns: sliceColumns
70
+ });
71
+ }, [sliceColumns]); // 非固定列长度
72
+
73
+ var centerColumnsLen = (0, _react.useMemo)(function () {
74
+ var _a;
75
+
76
+ return (_a = sliceColumns.centerColumns.length) !== null && _a !== void 0 ? _a : 0;
77
+ }, [sliceColumns]);
78
+ (0, _react.useEffect)(function () {
79
+ if (state.columnsLen !== centerColumnsLen) {
51
80
  dispatch({
52
81
  type: 'changeColumnsLen',
53
- columnsLen: columnsLen !== null && columnsLen !== void 0 ? columnsLen : 0
82
+ columnsLen: centerColumnsLen !== null && centerColumnsLen !== void 0 ? centerColumnsLen : 0
54
83
  });
55
84
  }
56
- }, [columnsLen, dispatch, state.columnsLen]);
85
+ }, [centerColumnsLen, dispatch, state.columnsLen]); // 获取行的高度
86
+
57
87
  (0, _react.useEffect)(function () {
58
88
  var initHeight = function initHeight(tempRef) {
59
89
  var _a, _b, _c;
@@ -62,16 +92,63 @@ var VirtualRow = /*#__PURE__*/_react.default.memo(function (_a, ref) {
62
92
  var tempRowHeight = (_c = (_b = tempRef === null || tempRef === void 0 ? void 0 : tempRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) !== null && _c !== void 0 ? _c : 0;
63
93
  dispatch({
64
94
  type: 'initHeight',
65
- rowHeight: tempRowHeight
95
+ rowHeight: tempRowHeight + 1
66
96
  });
67
97
  }
68
98
  };
69
99
 
70
- initHeight(trRef);
71
- }, [trRef, dispatch, rowHeight, totalLen, ref]);
100
+ initHeight(Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef);
101
+ }, [trRef, dispatch, rowHeight, totalLen, ref]); // 横向单元格合并
102
+
103
+ var leftColSpan = (0, _react.useMemo)(function () {
104
+ var _a;
105
+
106
+ return (_a = virtualItems[0]) === null || _a === void 0 ? void 0 : _a.index;
107
+ }, [virtualItems]); // 右侧隐藏数量
108
+
109
+ var rightColSpan = (0, _react.useMemo)(function () {
110
+ return sliceColumns.centerColumns.length - virtualItems.length - leftColSpan || 0;
111
+ }, [sliceColumns.centerColumns.length, virtualItems.length, leftColSpan]);
112
+ return Object.assign(Object.assign({
113
+ virtualItems: virtualItems
114
+ }, sliceColumns), {
115
+ leftColSpan: leftColSpan,
116
+ rightColSpan: rightColSpan
117
+ });
118
+ };
119
+
120
+ var VirtualRow = /*#__PURE__*/_react.default.memo(function (_a, ref) {
121
+ var children = _a.children,
122
+ pref = _a.pref,
123
+ resetProps = __rest(_a, ["children", "pref"]);
124
+
125
+ var trRef = (0, _react.useRef)(null);
126
+
127
+ var _useOptions = useOptions({
128
+ children: children,
129
+ ref: ref,
130
+ trRef: trRef
131
+ }),
132
+ virtualItems = _useOptions.virtualItems,
133
+ leftColumns = _useOptions.leftColumns,
134
+ centerColumns = _useOptions.centerColumns,
135
+ rightColumns = _useOptions.rightColumns,
136
+ leftColSpan = _useOptions.leftColSpan,
137
+ rightColSpan = _useOptions.rightColSpan;
138
+
72
139
  return /*#__PURE__*/_react.default.createElement("tr", Object.assign({}, resetProps, {
73
140
  ref: (0, _useForkRef.default)(pref, trRef)
74
- }), children);
141
+ }), leftColumns, !!leftColSpan && /*#__PURE__*/_react.default.createElement("td", {
142
+ key: "leftColSpan",
143
+ colSpan: leftColSpan
144
+ }), virtualItems.map(function (virtualCol) {
145
+ return /*#__PURE__*/_react.default.cloneElement(centerColumns[virtualCol.index], {
146
+ ref: virtualCol.measureRef
147
+ });
148
+ }), !!rightColSpan && /*#__PURE__*/_react.default.createElement("td", {
149
+ key: "rightColSpan",
150
+ colSpan: rightColSpan
151
+ }), rightColumns);
75
152
  });
76
153
 
77
154
  var _default = VirtualRow;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  interface rowProps {
3
3
  children?: any;
4
+ pref?: any;
4
5
  }
5
6
  declare const VirtualRow: React.NamedExoticComponent<rowProps>;
6
7
  export default VirtualRow;
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
6
 
5
7
  Object.defineProperty(exports, "__esModule", {
@@ -11,6 +13,8 @@ var _react = _interopRequireWildcard(require("react"));
11
13
 
12
14
  var _context = require("./context");
13
15
 
16
+ var _useForkRef = _interopRequireDefault(require("../hooks/useForkRef"));
17
+
14
18
  var __rest = void 0 && (void 0).__rest || function (s, e) {
15
19
  var t = {};
16
20
 
@@ -26,26 +30,21 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
26
30
 
27
31
  var VirtualRow = /*#__PURE__*/_react.default.memo(function (_a, ref) {
28
32
  var children = _a.children,
29
- resetProps = __rest(_a, ["children"]);
33
+ pref = _a.pref,
34
+ resetProps = __rest(_a, ["children", "pref"]);
30
35
 
31
36
  var _useStore = (0, _context.useStore)(),
32
37
  state = _useStore.state,
33
- dispatch = _useStore.dispatch,
34
- instance = _useStore.instance;
38
+ dispatch = _useStore.dispatch;
35
39
 
36
40
  var rowHeight = state.rowHeight,
37
41
  totalLen = state.totalLen;
38
- var virtualItems = instance.columnVirtual.virtualItems;
39
- var trRef = (0, _react.useRef)(null); // 非固定列长度
42
+ var trRef = (0, _react.useRef)(null); // 列长度
40
43
 
41
44
  var columnsLen = (0, _react.useMemo)(function () {
42
45
  var _a;
43
46
 
44
- return (_a = children === null || children === void 0 ? void 0 : children.filter(function (v) {
45
- var _a, _b;
46
-
47
- return typeof ((_a = v.props) === null || _a === void 0 ? void 0 : _a.fixLeft) !== 'number' && typeof ((_b = v.props) === null || _b === void 0 ? void 0 : _b.fixRight) !== 'number';
48
- }).length) !== null && _a !== void 0 ? _a : 0;
47
+ return (_a = children === null || children === void 0 ? void 0 : children.length) !== null && _a !== void 0 ? _a : 0;
49
48
  }, [children]);
50
49
  (0, _react.useEffect)(function () {
51
50
  if (state.columnsLen !== columnsLen) {
@@ -68,45 +67,11 @@ var VirtualRow = /*#__PURE__*/_react.default.memo(function (_a, ref) {
68
67
  }
69
68
  };
70
69
 
71
- initHeight(Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef);
72
- }, [trRef, dispatch, rowHeight, totalLen, ref]); // return {fixedLeft: [], fixedRight: [], columns: []}
73
-
74
- var fixedColumns = (0, _react.useMemo)(function () {
75
- return children === null || children === void 0 ? void 0 : children.reduce(function (pre, cur) {
76
- var _a, _b;
77
-
78
- if (typeof ((_a = cur.props) === null || _a === void 0 ? void 0 : _a.fixLeft) === 'number') {
79
- pre.fixedLeft.push(cur);
80
- return pre;
81
- }
82
-
83
- if (typeof ((_b = cur.props) === null || _b === void 0 ? void 0 : _b.fixRight) === 'number') {
84
- pre.fixedRight.push(cur);
85
- return pre;
86
- }
87
-
88
- pre.columns.push(cur);
89
- return pre;
90
- }, {
91
- fixedLeft: [],
92
- fixedRight: [],
93
- columns: []
94
- });
95
- }, [children]); // 横向单元格合并
96
-
97
- var colSpan = (0, _react.useMemo)(function () {
98
- var _a;
99
-
100
- return (_a = virtualItems[0]) === null || _a === void 0 ? void 0 : _a.index;
101
- }, [virtualItems]);
102
- console.log('virtualItems', virtualItems);
70
+ initHeight(trRef);
71
+ }, [trRef, dispatch, rowHeight, totalLen, ref]);
103
72
  return /*#__PURE__*/_react.default.createElement("tr", Object.assign({}, resetProps, {
104
- ref: Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef
105
- }), fixedColumns.fixedLeft, !!colSpan && /*#__PURE__*/_react.default.createElement("td", {
106
- colSpan: colSpan
107
- }), virtualItems.map(function (virtualCol) {
108
- return fixedColumns.columns[virtualCol.index];
109
- }), fixedColumns.fixedRight);
73
+ ref: (0, _useForkRef.default)(pref, trRef)
74
+ }), children);
110
75
  });
111
76
 
112
77
  var _default = VirtualRow;
@@ -25,7 +25,7 @@ var VirtualTable = /*#__PURE__*/_react.default.memo(function (tableProps) {
25
25
  var _useRealive = (0, _context.useRealive)(),
26
26
  _useRealive2 = (0, _slicedToArray2.default)(_useRealive, 2),
27
27
  state = _useRealive2[0],
28
- dispatch = _useRealive2[1]; // { totalSize, virtualItems }
28
+ dispatch = _useRealive2[1]; // 行虚拟化 { totalSize, virtualItems }
29
29
 
30
30
 
31
31
  var rowVirtual = (0, _reactVirtual.useVirtual)({
@@ -38,18 +38,26 @@ var VirtualTable = /*#__PURE__*/_react.default.memo(function (tableProps) {
38
38
  return state.rowHeight;
39
39
  }, [state.rowHeight]),
40
40
  overscan: 5
41
- });
41
+ }); // 列动态宽度
42
+
43
+ var columnEstimateSize = (0, _react.useCallback)(function (i) {
44
+ var _a, _b;
45
+
46
+ var colWidths = (_b = (_a = tableProps === null || tableProps === void 0 ? void 0 : tableProps.children[0]) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.colWidths;
47
+ var leftColumnsLen = state.sliceColumns.leftColumns.length;
48
+ var centerColumnsLen = state.sliceColumns.centerColumns.length; // 获取非固定列
49
+
50
+ var virList = colWidths.slice(leftColumnsLen, leftColumnsLen + centerColumnsLen);
51
+ return virList[i] || 0;
52
+ }, [(_c = (_b = tableProps.children[0]) === null || _b === void 0 ? void 0 : _b.props) === null || _c === void 0 ? void 0 : _c.colWidths, state.sliceColumns.leftColumns.length, state.sliceColumns.centerColumns.length]); // 列虚拟化
53
+
42
54
  var columnVirtual = (0, _reactVirtual.useVirtual)({
43
55
  horizontal: true,
44
56
  size: state.columnsLen,
45
57
  parentRef: {
46
- current: (_b = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.current) === null || _b === void 0 ? void 0 : _b.parentNode
58
+ current: (_d = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.current) === null || _d === void 0 ? void 0 : _d.parentNode
47
59
  },
48
- estimateSize: _react.default.useCallback(function (i) {
49
- var _a, _b;
50
-
51
- return (_b = (_a = tableProps === null || tableProps === void 0 ? void 0 : tableProps.children[0]) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.colWidths[i];
52
- }, [(_d = (_c = tableProps.children[0]) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.colWidths]),
60
+ estimateSize: columnEstimateSize,
53
61
  overscan: 5
54
62
  });
55
63
  var instance = {
@@ -25,13 +25,20 @@ var initialState = {
25
25
  rowHeight: 0,
26
26
  columnsLen: 0,
27
27
  // 总行数
28
- totalLen: 0
28
+ totalLen: 0,
29
+ // 分割后的列数组
30
+ sliceColumns: {
31
+ leftColumns: [],
32
+ centerColumns: [],
33
+ rightColumns: []
34
+ }
29
35
  };
30
36
 
31
37
  var reducer = function reducer(state, action) {
32
38
  var totalLen = action.totalLen,
33
39
  columnsLen = action.columnsLen,
34
- rowHeight = action.rowHeight;
40
+ rowHeight = action.rowHeight,
41
+ sliceColumns = action.sliceColumns;
35
42
 
36
43
  switch (action.type) {
37
44
  // 数据数量
@@ -52,6 +59,11 @@ var reducer = function reducer(state, action) {
52
59
  rowHeight: rowHeight
53
60
  });
54
61
 
62
+ case 'changeSliceColumns':
63
+ return Object.assign(Object.assign({}, state), {
64
+ sliceColumns: sliceColumns
65
+ });
66
+
55
67
  default:
56
68
  throw new Error();
57
69
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  interface rowProps {
3
- children: any;
3
+ children?: any;
4
4
  }
5
5
  declare const VirtualRow: React.NamedExoticComponent<rowProps>;
6
6
  export default VirtualRow;
@@ -24,37 +24,62 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
24
24
  return t;
25
25
  };
26
26
 
27
- var VirtualRow = /*#__PURE__*/_react.default.memo(function (_a, ref) {
28
- var children = _a.children,
29
- resetProps = __rest(_a, ["children"]);
27
+ var useOptions = function useOptions(_ref) {
28
+ var children = _ref.children,
29
+ ref = _ref.ref,
30
+ trRef = _ref.trRef;
30
31
 
31
32
  var _useStore = (0, _context.useStore)(),
32
33
  state = _useStore.state,
33
34
  dispatch = _useStore.dispatch,
34
35
  instance = _useStore.instance;
35
36
 
37
+ var virtualItems = instance.columnVirtual.virtualItems;
36
38
  var rowHeight = state.rowHeight,
37
39
  totalLen = state.totalLen;
38
- var virtualItems = instance.columnVirtual.virtualItems;
39
- var trRef = (0, _react.useRef)(null); // 非固定列长度
40
+ var sliceColumns = (0, _react.useMemo)(function () {
41
+ return children === null || children === void 0 ? void 0 : children.reduce(function (pre, cur) {
42
+ var _a, _b;
40
43
 
41
- var columnsLen = (0, _react.useMemo)(function () {
42
- var _a;
44
+ if (typeof ((_a = cur.props) === null || _a === void 0 ? void 0 : _a.fixLeft) === 'number') {
45
+ pre.leftColumns.push(cur);
46
+ return pre;
47
+ }
43
48
 
44
- return (_a = children === null || children === void 0 ? void 0 : children.filter(function (v) {
45
- var _a, _b;
49
+ if (typeof ((_b = cur.props) === null || _b === void 0 ? void 0 : _b.fixRight) === 'number') {
50
+ pre.rightColumns.push(cur);
51
+ return pre;
52
+ }
46
53
 
47
- return typeof ((_a = v.props) === null || _a === void 0 ? void 0 : _a.fixLeft) !== 'number' && typeof ((_b = v.props) === null || _b === void 0 ? void 0 : _b.fixRight) !== 'number';
48
- }).length) !== null && _a !== void 0 ? _a : 0; // return children?.length ?? 0
54
+ pre.centerColumns.push(cur);
55
+ return pre;
56
+ }, {
57
+ leftColumns: [],
58
+ rightColumns: [],
59
+ centerColumns: []
60
+ });
49
61
  }, [children]);
50
62
  (0, _react.useEffect)(function () {
51
- if (state.columnsLen !== columnsLen) {
63
+ dispatch({
64
+ type: 'changeSliceColumns',
65
+ sliceColumns: sliceColumns
66
+ });
67
+ }, [sliceColumns]); // 非固定列长度
68
+
69
+ var centerColumnsLen = (0, _react.useMemo)(function () {
70
+ var _a;
71
+
72
+ return (_a = sliceColumns.centerColumns.length) !== null && _a !== void 0 ? _a : 0;
73
+ }, [sliceColumns]);
74
+ (0, _react.useEffect)(function () {
75
+ if (state.columnsLen !== centerColumnsLen) {
52
76
  dispatch({
53
77
  type: 'changeColumnsLen',
54
- columnsLen: columnsLen !== null && columnsLen !== void 0 ? columnsLen : 0
78
+ columnsLen: centerColumnsLen !== null && centerColumnsLen !== void 0 ? centerColumnsLen : 0
55
79
  });
56
80
  }
57
- }, [columnsLen, dispatch, state.columnsLen]);
81
+ }, [centerColumnsLen, dispatch, state.columnsLen]); // 获取行的高度
82
+
58
83
  (0, _react.useEffect)(function () {
59
84
  var initHeight = function initHeight(tempRef) {
60
85
  var _a, _b, _c;
@@ -63,50 +88,60 @@ var VirtualRow = /*#__PURE__*/_react.default.memo(function (_a, ref) {
63
88
  var tempRowHeight = (_c = (_b = tempRef === null || tempRef === void 0 ? void 0 : tempRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) !== null && _c !== void 0 ? _c : 0;
64
89
  dispatch({
65
90
  type: 'initHeight',
66
- rowHeight: tempRowHeight
91
+ rowHeight: tempRowHeight + 1
67
92
  });
68
93
  }
69
94
  };
70
95
 
71
96
  initHeight(Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef);
72
- }, [trRef, dispatch, rowHeight, totalLen, ref]); // return {fixedLeft: [], fixedRight: [], columns: []}
97
+ }, [trRef, dispatch, rowHeight, totalLen, ref]); // 横向单元格合并
73
98
 
74
- var fixedColumns = (0, _react.useMemo)(function () {
75
- return children === null || children === void 0 ? void 0 : children.reduce(function (pre, cur) {
76
- var _a, _b;
99
+ var leftColSpan = (0, _react.useMemo)(function () {
100
+ var _a;
77
101
 
78
- if (typeof ((_a = cur.props) === null || _a === void 0 ? void 0 : _a.fixLeft) === 'number') {
79
- pre.fixedLeft.push(cur);
80
- return pre;
81
- }
102
+ return (_a = virtualItems[0]) === null || _a === void 0 ? void 0 : _a.index;
103
+ }, [virtualItems]); // 右侧隐藏数量
104
+
105
+ var rightColSpan = (0, _react.useMemo)(function () {
106
+ return sliceColumns.centerColumns.length - virtualItems.length - leftColSpan || 0;
107
+ }, [sliceColumns.centerColumns.length, virtualItems.length, leftColSpan]);
108
+ return Object.assign(Object.assign({
109
+ virtualItems: virtualItems
110
+ }, sliceColumns), {
111
+ leftColSpan: leftColSpan,
112
+ rightColSpan: rightColSpan
113
+ });
114
+ };
82
115
 
83
- if (typeof ((_b = cur.props) === null || _b === void 0 ? void 0 : _b.fixRight) === 'number') {
84
- pre.fixedRight.push(cur);
85
- return pre;
86
- }
116
+ var VirtualRow = /*#__PURE__*/_react.default.memo(function (_a, ref) {
117
+ var children = _a.children,
118
+ resetProps = __rest(_a, ["children"]);
87
119
 
88
- pre.columns.push(cur);
89
- return pre;
90
- }, {
91
- fixedLeft: [],
92
- fixedRight: [],
93
- columns: []
94
- });
95
- }, [children]); // 横线单元格合并
120
+ var trRef = (0, _react.useRef)(null);
96
121
 
97
- var colSpan = (0, _react.useMemo)(function () {
98
- var _a;
122
+ var _useOptions = useOptions({
123
+ children: children,
124
+ ref: ref,
125
+ trRef: trRef
126
+ }),
127
+ virtualItems = _useOptions.virtualItems,
128
+ leftColumns = _useOptions.leftColumns,
129
+ centerColumns = _useOptions.centerColumns,
130
+ rightColumns = _useOptions.rightColumns,
131
+ leftColSpan = _useOptions.leftColSpan,
132
+ rightColSpan = _useOptions.rightColSpan;
99
133
 
100
- return (_a = virtualItems[0]) === null || _a === void 0 ? void 0 : _a.index;
101
- }, [virtualItems]);
102
- console.log('virtualItems', virtualItems);
103
134
  return /*#__PURE__*/_react.default.createElement("tr", Object.assign({}, resetProps, {
104
135
  ref: Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef
105
- }), fixedColumns.fixedLeft, !!colSpan && /*#__PURE__*/_react.default.createElement("td", {
106
- colSpan: colSpan
136
+ }), leftColumns, !!leftColSpan && /*#__PURE__*/_react.default.createElement("td", {
137
+ key: "leftColSpan",
138
+ colSpan: leftColSpan
107
139
  }), virtualItems.map(function (virtualCol) {
108
- return fixedColumns.columns[virtualCol.index];
109
- }), fixedColumns.fixedRight);
140
+ return centerColumns[virtualCol.index];
141
+ }), !!rightColSpan && /*#__PURE__*/_react.default.createElement("td", {
142
+ key: "rightColSpan",
143
+ colSpan: rightColSpan
144
+ }), rightColumns);
110
145
  });
111
146
 
112
147
  var _default = VirtualRow;
@@ -25,7 +25,7 @@ var VirtualTable = /*#__PURE__*/_react.default.memo(function (tableProps) {
25
25
  var _useRealive = (0, _context.useRealive)(),
26
26
  _useRealive2 = (0, _slicedToArray2.default)(_useRealive, 2),
27
27
  state = _useRealive2[0],
28
- dispatch = _useRealive2[1]; // { totalSize, virtualItems }
28
+ dispatch = _useRealive2[1]; // 行虚拟化 { totalSize, virtualItems }
29
29
 
30
30
 
31
31
  var rowVirtual = (0, _reactVirtual.useVirtual)({
@@ -38,18 +38,26 @@ var VirtualTable = /*#__PURE__*/_react.default.memo(function (tableProps) {
38
38
  return state.rowHeight;
39
39
  }, [state.rowHeight]),
40
40
  overscan: 5
41
- });
41
+ }); // 列动态宽度
42
+
43
+ var columnEstimateSize = (0, _react.useCallback)(function (i) {
44
+ var _a, _b;
45
+
46
+ var colWidths = (_b = (_a = tableProps === null || tableProps === void 0 ? void 0 : tableProps.children[0]) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.colWidths;
47
+ var leftColumnsLen = state.sliceColumns.leftColumns.length;
48
+ var centerColumnsLen = state.sliceColumns.centerColumns.length; // 获取非固定列
49
+
50
+ var virList = colWidths.slice(leftColumnsLen, leftColumnsLen + centerColumnsLen);
51
+ return virList[i] || 0;
52
+ }, [(_c = (_b = tableProps.children[0]) === null || _b === void 0 ? void 0 : _b.props) === null || _c === void 0 ? void 0 : _c.colWidths, state.sliceColumns.leftColumns.length, state.sliceColumns.centerColumns.length]); // 列虚拟化
53
+
42
54
  var columnVirtual = (0, _reactVirtual.useVirtual)({
43
55
  horizontal: true,
44
56
  size: state.columnsLen,
45
57
  parentRef: {
46
- current: (_b = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.current) === null || _b === void 0 ? void 0 : _b.parentNode
58
+ current: (_d = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.current) === null || _d === void 0 ? void 0 : _d.parentNode
47
59
  },
48
- estimateSize: _react.default.useCallback(function (i) {
49
- var _a, _b;
50
-
51
- return (_b = (_a = tableProps === null || tableProps === void 0 ? void 0 : tableProps.children[0]) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.colWidths[i];
52
- }, [(_d = (_c = tableProps.children[0]) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.colWidths]),
60
+ estimateSize: columnEstimateSize,
53
61
  overscan: 5
54
62
  });
55
63
  var instance = {
@@ -25,13 +25,20 @@ var initialState = {
25
25
  rowHeight: 0,
26
26
  columnsLen: 0,
27
27
  // 总行数
28
- totalLen: 0
28
+ totalLen: 0,
29
+ // 分割后的列数组
30
+ sliceColumns: {
31
+ leftColumns: [],
32
+ centerColumns: [],
33
+ rightColumns: []
34
+ }
29
35
  };
30
36
 
31
37
  var reducer = function reducer(state, action) {
32
38
  var totalLen = action.totalLen,
33
39
  columnsLen = action.columnsLen,
34
- rowHeight = action.rowHeight;
40
+ rowHeight = action.rowHeight,
41
+ sliceColumns = action.sliceColumns;
35
42
 
36
43
  switch (action.type) {
37
44
  // 数据数量
@@ -52,6 +59,11 @@ var reducer = function reducer(state, action) {
52
59
  rowHeight: rowHeight
53
60
  });
54
61
 
62
+ case 'changeSliceColumns':
63
+ return Object.assign(Object.assign({}, state), {
64
+ sliceColumns: sliceColumns
65
+ });
66
+
55
67
  default:
56
68
  throw new Error();
57
69
  }
@@ -9710,6 +9710,10 @@ p {
9710
9710
  .lm_tree_warp .ant-tree-list-holder-inner .ant-tree-treenode > .ant-tree-node-content-wrapper.ant-tree-node-selected {
9711
9711
  background-color: var(--primary-select-color);
9712
9712
  }
9713
+ .lm_editTable_warpper {
9714
+ height: 100%;
9715
+ width: 100%;
9716
+ }
9713
9717
  .lm_editTable_warpper .ant-picker {
9714
9718
  width: 100%;
9715
9719
  }
@@ -9837,6 +9841,29 @@ p {
9837
9841
  .lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
9838
9842
  background-color: rgba(0, 0, 0, 0.06) !important;
9839
9843
  }
9844
+ .lm_editTable_warpper .lm_table_empty {
9845
+ display: flex;
9846
+ flex-direction: column;
9847
+ align-items: center;
9848
+ padding: 12px 0;
9849
+ font-size: 12px;
9850
+ }
9851
+ .lm_editTable_warpper .lm_table_empty > img {
9852
+ width: 130px;
9853
+ height: 80px;
9854
+ margin-bottom: 8px;
9855
+ }
9856
+ .lm_editTable_warpper .lm_table_empty .empty_img {
9857
+ margin-bottom: 8px;
9858
+ background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQQAAACgCAYAAADq8hJGAAAABHNCSVQICAgIfAhkiAAADh9JREFUeJzt3U1sG2d+x/HvMy98EUlblivHbmPXrrN14KCbLBrEhwViC0jjxusgiz3oViC5NLdstkCBHraoChRFT6mL9uJLHBQoUCiHtnBgBHBQ+VAECGDD6SHZYOvYRrqxEzu2JVMWxZeZpwdyJpJqSRQ15PDl97mMHHGGfzLUPD8+8zzPGKQrZmdnMwD5fN4DePXVV5fa3G8CoFAolACWl5cBCILgNsD09HStC+X2rZ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Gyga62WtTY69tqTjllnO+zWvh9rt+u9X8MmasnCTbZaCWljaxNBImtNDvuHT0S2oG9a5xWJYr3kMGqJYj3tvv7NHrf29+22yEk/TtqzKkFFsxOTpoQgIrGBb21XJIvIeq9pqy2mSBpW9aF0KwmsRwlBRGJqFdv0mCQS6TSRyGhZ29KnkgA2o4QgIjG1YkNug2Qjbei3FrzblBBERERERGQD/wcbRqz954lTWQAAAABJRU5ErkJggg==');
9859
+ background-size: cover;
9860
+ }
9861
+ .lm_editTable_warpper .lm_table_empty > span {
9862
+ color: var(--font-color);
9863
+ }
9864
+ .lm_editTable_warpper .ant-table-empty table {
9865
+ height: 100%;
9866
+ }
9840
9867
  .lm_editTable_warpper .ant-picker {
9841
9868
  height: 24px !important;
9842
9869
  padding: 2px 8px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkmore-design",
3
- "version": "1.1.27-alpha.0",
3
+ "version": "1.1.27-alpha.1",
4
4
  "author": {
5
5
  "name": "nowthen",
6
6
  "email": "rnlvwyx@gmail.com"