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

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 (63) hide show
  1. package/dist/LmEditTable/EditTable.d.ts +4 -0
  2. package/dist/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  3. package/dist/LmEditTable/components/index.d.ts +2 -1
  4. package/dist/LmEditTable/util.d.ts +3 -0
  5. package/{lib/LmEditTable/virtual/VirtualRowBack.d.ts → dist/LmEditTable/virtual/VirtualRow2.d.ts} +7 -6
  6. package/dist/LmTable/virTual/VirtualRow.d.ts +1 -1
  7. package/dist/index.umd.js +398 -111
  8. package/dist/index.umd.min.js +21 -21
  9. package/dist/variables.css +41 -0
  10. package/es/LmEditTable/EditTable.d.ts +4 -0
  11. package/es/LmEditTable/EditTable.js +68 -11
  12. package/es/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  13. package/es/LmEditTable/components/customRenderEmpty.js +20 -0
  14. package/es/LmEditTable/components/index.d.ts +2 -1
  15. package/es/LmEditTable/components/index.js +2 -1
  16. package/es/LmEditTable/rowSort/DndContainerRow.js +6 -3
  17. package/es/LmEditTable/style/index.css +41 -0
  18. package/es/LmEditTable/style/variables.css +41 -0
  19. package/es/LmEditTable/util.d.ts +3 -0
  20. package/es/LmEditTable/util.js +61 -1
  21. package/es/LmEditTable/virtual/VirtualRow.js +94 -16
  22. package/{dist/LmEditTable/virtual/VirtualRowBack.d.ts → es/LmEditTable/virtual/VirtualRow2.d.ts} +7 -6
  23. package/es/LmEditTable/virtual/VirtualRow2.js +62 -0
  24. package/es/LmEditTable/virtual/VirtualTable.js +17 -9
  25. package/es/LmEditTable/virtual/context.js +14 -2
  26. package/es/LmFilter/baseFilter/index.js +3 -2
  27. package/es/LmFilter/filterFns/index.js +4 -2
  28. package/es/LmTable/virTual/VirtualRow.d.ts +1 -1
  29. package/es/LmTable/virTual/VirtualRow.js +80 -44
  30. package/es/LmTable/virTual/VirtualTable.js +17 -9
  31. package/es/LmTable/virTual/context.js +14 -2
  32. package/es/LmUpload/body/UploadCore.js +1 -1
  33. package/es/Radio/index.js +9 -1
  34. package/es/Switch/index.js +7 -2
  35. package/es/styles/variables.css +41 -0
  36. package/lib/LmEditTable/EditTable.d.ts +4 -0
  37. package/lib/LmEditTable/EditTable.js +67 -9
  38. package/lib/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  39. package/lib/LmEditTable/components/customRenderEmpty.js +32 -0
  40. package/lib/LmEditTable/components/index.d.ts +2 -1
  41. package/lib/LmEditTable/components/index.js +8 -0
  42. package/lib/LmEditTable/rowSort/DndContainerRow.js +5 -3
  43. package/lib/LmEditTable/style/index.css +41 -0
  44. package/lib/LmEditTable/style/variables.css +41 -0
  45. package/lib/LmEditTable/util.d.ts +3 -0
  46. package/lib/LmEditTable/util.js +64 -0
  47. package/lib/LmEditTable/virtual/VirtualRow.js +93 -16
  48. package/{es/LmEditTable/virtual/VirtualRowBack.d.ts → lib/LmEditTable/virtual/VirtualRow2.d.ts} +1 -0
  49. package/lib/LmEditTable/virtual/{VirtualRowBack.js → VirtualRow2.js} +13 -48
  50. package/lib/LmEditTable/virtual/VirtualTable.js +16 -8
  51. package/lib/LmEditTable/virtual/context.js +14 -2
  52. package/lib/LmFilter/baseFilter/index.js +3 -2
  53. package/lib/LmFilter/filterFns/index.js +4 -2
  54. package/lib/LmTable/virTual/VirtualRow.d.ts +1 -1
  55. package/lib/LmTable/virTual/VirtualRow.js +79 -44
  56. package/lib/LmTable/virTual/VirtualTable.js +16 -8
  57. package/lib/LmTable/virTual/context.js +14 -2
  58. package/lib/LmUpload/body/UploadCore.js +1 -1
  59. package/lib/Radio/index.js +9 -1
  60. package/lib/Switch/index.js +9 -2
  61. package/lib/styles/variables.css +41 -0
  62. package/package.json +1 -1
  63. 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
  }
@@ -16,8 +16,9 @@ var _components = _interopRequireDefault(require("../components"));
16
16
  // 二级过滤 => 基础过滤组件
17
17
  var LmFilterBase = /*#__PURE__*/_react.default.memo(function (_ref) {
18
18
  var instance = _ref.instance;
19
- var dataSource = instance.dataSource;
20
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_fuzzySearch.default, {
19
+ var dataSource = instance.dataSource,
20
+ enableSearch = instance.enableSearch;
21
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, enableSearch && /*#__PURE__*/_react.default.createElement(_fuzzySearch.default, {
21
22
  instance: instance
22
23
  }), dataSource.map(function (v, index) {
23
24
  var isHidden = !v.show && typeof v.show === 'boolean';
@@ -184,6 +184,7 @@ var useCoreOptions = function useCoreOptions(_ref) {
184
184
 
185
185
  if ((0, _utils.getIsHas)(itemValue) && !!item) {
186
186
  return [].concat((0, _toConsumableArray2.default)(pre), [{
187
+ relation: obj[cur].mode || 'and',
187
188
  fieldName: cur,
188
189
  fieldType: (item === null || item === void 0 ? void 0 : item.valueType) || 'string',
189
190
  type: item.type,
@@ -193,7 +194,7 @@ var useCoreOptions = function useCoreOptions(_ref) {
193
194
  * and 等同于逻辑关系contains: 选中的值包含所有值
194
195
  * or 等同于逻辑关系in: 选中的值存在于所有值之中
195
196
  */
196
- operator: obj[cur].mode === 'and' ? 'contains' : 'in'
197
+ operator: 'in'
197
198
  }]);
198
199
  }
199
200
 
@@ -360,11 +361,12 @@ var useCoreOptions = function useCoreOptions(_ref) {
360
361
  if ((0, _utils.getIsHas)(itemValue) && !!item) {
361
362
  // eslint-disable-next-line no-param-reassign
362
363
  pre[cur] = {
364
+ relation: complexFilter[cur].mode || 'and',
363
365
  fieldName: cur,
364
366
  fieldType: (item === null || item === void 0 ? void 0 : item.valueType) || 'string',
365
367
  type: item.type,
366
368
  value: Array.isArray(itemValue) ? itemValue : [itemValue],
367
- operator: complexFilter[cur].mode === 'and' ? 'contains' : 'in'
369
+ operator: 'in'
368
370
  };
369
371
  }
370
372
 
@@ -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
  }
@@ -39,7 +39,7 @@ var UploadCore = function UploadCore(_ref) {
39
39
  var isUploading = getUploadStatus().uploading;
40
40
  if (isUploading) return;
41
41
  (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
42
- }, [getUploadStatus]); // 上传触发事件
42
+ }, [disabled, getUploadStatus]); // 上传触发事件
43
43
 
44
44
  var uploadChange = (0, _react.useCallback)(function (e) {
45
45
  var _a;
@@ -19,13 +19,21 @@ var _classnames = _interopRequireDefault(require("classnames"));
19
19
 
20
20
  var _react = _interopRequireDefault(require("react"));
21
21
 
22
- var _excluded = ["children"],
22
+ var _DisabledContext = _interopRequireDefault(require("../ConfigProvider/DisabledContext"));
23
+
24
+ var _excluded = ["children", "disabled"],
23
25
  _excluded2 = ["children", "size", "buttonStyle", "direction", "className"];
24
26
 
25
27
  var LMRadio = function LMRadio(props) {
26
28
  var children = props.children,
29
+ customDisabled = props.disabled,
27
30
  restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
31
+
32
+ var disabled = _react.default.useContext(_DisabledContext.default);
33
+
34
+ var mergedDisabled = customDisabled || disabled;
28
35
  return /*#__PURE__*/_react.default.createElement(_radio.default, (0, _extends2.default)({
36
+ disabled: mergedDisabled,
29
37
  className: "lm-radio"
30
38
  }, restProps), children);
31
39
  };