linkmore-design 1.1.27 → 1.1.28-alpha.6

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 (141) hide show
  1. package/dist/LmEditTable/DndContainer.d.ts +6 -3
  2. package/dist/LmEditTable/EditTable.d.ts +15 -5
  3. package/dist/LmEditTable/components/DraggableContainer.d.ts +10 -0
  4. package/dist/LmEditTable/components/QuickOpetate.d.ts +12 -0
  5. package/dist/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
  6. package/dist/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  7. package/dist/LmEditTable/components/index.d.ts +17 -0
  8. package/dist/LmEditTable/hooks/useForkRef.d.ts +2 -0
  9. package/dist/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
  10. package/dist/LmEditTable/sortableItem.d.ts +3 -2
  11. package/dist/LmEditTable/util.d.ts +10 -0
  12. package/dist/LmEditTable/virtual/VirtualRow.d.ts +7 -0
  13. package/dist/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
  14. package/dist/LmEditTable/virtual/VirtualTable.d.ts +3 -0
  15. package/dist/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
  16. package/dist/LmEditTable/virtual/context.d.ts +13 -0
  17. package/dist/LmEditTable/virtual/index.d.ts +4 -0
  18. package/dist/LmTable/virTual/VirtualRow.d.ts +1 -1
  19. package/dist/index.d.ts +1 -2
  20. package/dist/index.umd.js +1909 -679
  21. package/dist/index.umd.min.js +21 -21
  22. package/dist/variables.css +115 -2
  23. package/es/CardTable/style/index.css +3 -2
  24. package/es/CardTable/style/variables.css +3 -2
  25. package/es/CustomTableOption/columnsSort.js +41 -18
  26. package/es/CustomTableOption/filterSort.js +14 -6
  27. package/es/CustomTableOption/style/index.css +3 -0
  28. package/es/CustomTableOption/style/variables.css +3 -0
  29. package/es/Form/FormItem/index.js +5 -1
  30. package/es/InputNumber/index.js +7 -9
  31. package/es/LmEditTable/DndContainer.d.ts +6 -3
  32. package/es/LmEditTable/DndContainer.js +70 -10
  33. package/es/LmEditTable/DragHandle.js +1 -1
  34. package/es/LmEditTable/EditTable.d.ts +15 -5
  35. package/es/LmEditTable/EditTable.js +696 -361
  36. package/es/LmEditTable/components/DraggableContainer.d.ts +10 -0
  37. package/es/LmEditTable/components/DraggableContainer.js +39 -0
  38. package/es/LmEditTable/components/QuickOpetate.d.ts +12 -0
  39. package/es/LmEditTable/components/QuickOpetate.js +82 -0
  40. package/es/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
  41. package/es/LmEditTable/components/bottomOpetateComponent.js +23 -0
  42. package/es/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  43. package/es/LmEditTable/components/customRenderEmpty.js +20 -0
  44. package/es/LmEditTable/components/index.d.ts +17 -0
  45. package/es/LmEditTable/components/index.js +8 -0
  46. package/es/LmEditTable/hooks/useForkRef.d.ts +2 -0
  47. package/es/LmEditTable/hooks/useForkRef.js +22 -0
  48. package/es/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
  49. package/es/LmEditTable/rowSort/DndContainerRow.js +83 -0
  50. package/es/LmEditTable/sortableItem.d.ts +3 -2
  51. package/es/LmEditTable/sortableItem.js +16 -4
  52. package/es/LmEditTable/sortableItemCol.js +40 -10
  53. package/es/LmEditTable/style/index.css +109 -0
  54. package/es/LmEditTable/style/variables.css +109 -0
  55. package/es/LmEditTable/util.d.ts +10 -0
  56. package/es/LmEditTable/util.js +158 -9
  57. package/es/LmEditTable/virtual/VirtualRow.d.ts +7 -0
  58. package/es/LmEditTable/virtual/VirtualRow.js +148 -0
  59. package/es/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
  60. package/es/LmEditTable/virtual/VirtualRow2.js +62 -0
  61. package/es/LmEditTable/virtual/VirtualTable.d.ts +3 -0
  62. package/es/LmEditTable/virtual/VirtualTable.js +64 -0
  63. package/es/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
  64. package/es/LmEditTable/virtual/VirtualWrapper.js +60 -0
  65. package/es/LmEditTable/virtual/context.d.ts +13 -0
  66. package/es/LmEditTable/virtual/context.js +66 -0
  67. package/es/LmEditTable/virtual/index.d.ts +4 -0
  68. package/es/LmEditTable/virtual/index.js +4 -0
  69. package/es/LmFilter/baseFilter/index.js +3 -2
  70. package/es/LmFilter/filterFns/index.js +4 -2
  71. package/es/LmTable/virTual/VirtualRow.d.ts +1 -1
  72. package/es/LmTable/virTual/VirtualRow.js +82 -48
  73. package/es/LmTable/virTual/VirtualTable.js +17 -9
  74. package/es/LmTable/virTual/context.js +14 -2
  75. package/es/LmUpload/body/UploadCore.js +1 -1
  76. package/es/LmUpload/fns/index.js +1 -1
  77. package/es/Radio/index.js +9 -1
  78. package/es/Switch/index.js +7 -2
  79. package/es/hooks/useEvent/index.js +1 -1
  80. package/es/index.d.ts +1 -2
  81. package/es/styles/variables.css +115 -2
  82. package/lib/CardTable/style/index.css +3 -2
  83. package/lib/CardTable/style/variables.css +3 -2
  84. package/lib/CustomTableOption/columnsSort.js +48 -22
  85. package/lib/CustomTableOption/filterSort.js +19 -10
  86. package/lib/CustomTableOption/style/index.css +3 -0
  87. package/lib/CustomTableOption/style/variables.css +3 -0
  88. package/lib/Form/FormItem/index.js +5 -1
  89. package/lib/InputNumber/index.js +9 -9
  90. package/lib/LmEditTable/DndContainer.d.ts +6 -3
  91. package/lib/LmEditTable/DndContainer.js +74 -9
  92. package/lib/LmEditTable/DragHandle.js +1 -1
  93. package/lib/LmEditTable/EditTable.d.ts +15 -5
  94. package/lib/LmEditTable/EditTable.js +694 -358
  95. package/lib/LmEditTable/components/DraggableContainer.d.ts +10 -0
  96. package/lib/LmEditTable/components/DraggableContainer.js +52 -0
  97. package/lib/LmEditTable/components/QuickOpetate.d.ts +12 -0
  98. package/lib/LmEditTable/components/QuickOpetate.js +96 -0
  99. package/lib/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
  100. package/lib/LmEditTable/components/bottomOpetateComponent.js +34 -0
  101. package/lib/LmEditTable/components/customRenderEmpty.d.ts +2 -0
  102. package/lib/LmEditTable/components/customRenderEmpty.js +32 -0
  103. package/lib/LmEditTable/components/index.d.ts +17 -0
  104. package/lib/LmEditTable/components/index.js +45 -0
  105. package/lib/LmEditTable/hooks/useForkRef.d.ts +2 -0
  106. package/lib/LmEditTable/hooks/useForkRef.js +29 -0
  107. package/lib/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
  108. package/lib/LmEditTable/rowSort/DndContainerRow.js +100 -0
  109. package/lib/LmEditTable/sortableItem.d.ts +3 -2
  110. package/lib/LmEditTable/sortableItem.js +19 -5
  111. package/lib/LmEditTable/sortableItemCol.js +37 -8
  112. package/lib/LmEditTable/style/index.css +109 -0
  113. package/lib/LmEditTable/style/variables.css +109 -0
  114. package/lib/LmEditTable/util.d.ts +10 -0
  115. package/lib/LmEditTable/util.js +167 -8
  116. package/lib/LmEditTable/virtual/VirtualRow.d.ts +7 -0
  117. package/lib/LmEditTable/virtual/VirtualRow.js +164 -0
  118. package/lib/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
  119. package/lib/LmEditTable/virtual/VirtualRow2.js +78 -0
  120. package/lib/LmEditTable/virtual/VirtualTable.d.ts +3 -0
  121. package/lib/LmEditTable/virtual/VirtualTable.js +81 -0
  122. package/lib/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
  123. package/lib/LmEditTable/virtual/VirtualWrapper.js +73 -0
  124. package/lib/LmEditTable/virtual/context.d.ts +13 -0
  125. package/lib/LmEditTable/virtual/context.js +76 -0
  126. package/lib/LmEditTable/virtual/index.d.ts +4 -0
  127. package/lib/LmEditTable/virtual/index.js +31 -0
  128. package/lib/LmFilter/baseFilter/index.js +3 -2
  129. package/lib/LmFilter/filterFns/index.js +4 -2
  130. package/lib/LmTable/virTual/VirtualRow.d.ts +1 -1
  131. package/lib/LmTable/virTual/VirtualRow.js +81 -48
  132. package/lib/LmTable/virTual/VirtualTable.js +16 -8
  133. package/lib/LmTable/virTual/context.js +14 -2
  134. package/lib/LmUpload/body/UploadCore.js +1 -1
  135. package/lib/LmUpload/fns/index.js +1 -1
  136. package/lib/Radio/index.js +9 -1
  137. package/lib/Switch/index.js +9 -2
  138. package/lib/hooks/useEvent/index.js +1 -1
  139. package/lib/index.d.ts +1 -2
  140. package/lib/styles/variables.css +115 -2
  141. package/package.json +7 -9
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const VirtualWrapper: React.MemoExoticComponent<(wrapperProps: React.PropsWithChildren<any>) => JSX.Element>;
3
+ export default VirtualWrapper;
@@ -0,0 +1,60 @@
1
+ var __rest = this && this.__rest || function (s, e) {
2
+ var t = {};
3
+
4
+ for (var p in s) {
5
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
6
+ }
7
+
8
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
9
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+
14
+ import React, { useEffect, useMemo } from 'react';
15
+ import { useStore } from './context';
16
+ var VirtualWrapper = /*#__PURE__*/React.memo(function (wrapperProps) {
17
+ var _a, _b;
18
+
19
+ var children = wrapperProps.children,
20
+ resetProps = __rest(wrapperProps, ["children"]);
21
+
22
+ var _useStore = useStore(),
23
+ state = _useStore.state,
24
+ dispatch = _useStore.dispatch,
25
+ instance = _useStore.instance;
26
+
27
+ var _instance$rowVirtual = instance.rowVirtual,
28
+ virtualItems = _instance$rowVirtual.virtualItems,
29
+ totalSize = _instance$rowVirtual.totalSize;
30
+ var contents = useMemo(function () {
31
+ return children[1];
32
+ }, [children]);
33
+ var contentsLen = useMemo(function () {
34
+ var _a;
35
+
36
+ return (_a = contents === null || contents === void 0 ? void 0 : contents.length) !== null && _a !== void 0 ? _a : 0;
37
+ }, [contents]);
38
+ useEffect(function () {
39
+ if (state.totalLen !== contentsLen) {
40
+ dispatch({
41
+ type: 'changeTotalLen',
42
+ totalLen: contentsLen !== null && contentsLen !== void 0 ? contentsLen : 0
43
+ });
44
+ }
45
+ }, [contentsLen, dispatch, state.totalLen]);
46
+ var paddingTop = virtualItems.length > 0 ? ((_a = virtualItems === null || virtualItems === void 0 ? void 0 : virtualItems[0]) === null || _a === void 0 ? void 0 : _a.start) || 0 : 0;
47
+ var paddingBottom = virtualItems.length > 0 ? totalSize - (((_b = virtualItems === null || virtualItems === void 0 ? void 0 : virtualItems[virtualItems.length - 1]) === null || _b === void 0 ? void 0 : _b.end) || 0) : 0;
48
+ return /*#__PURE__*/React.createElement("tbody", Object.assign({}, resetProps), paddingTop > 0 && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
49
+ style: {
50
+ height: "".concat(paddingTop, "px")
51
+ }
52
+ })), children[0], virtualItems.map(function (virtualRow) {
53
+ return contents[virtualRow.index];
54
+ }), paddingBottom > 0 && /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("td", {
55
+ style: {
56
+ height: "".concat(paddingBottom, "px")
57
+ }
58
+ })));
59
+ });
60
+ export default VirtualWrapper;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ declare const TableContext: import("react").Context<{
3
+ state: any;
4
+ dispatch: any;
5
+ instance: any;
6
+ }>;
7
+ declare const useStore: () => {
8
+ state: any;
9
+ dispatch: any;
10
+ instance: any;
11
+ };
12
+ declare const useRealive: () => [any, import("react").Dispatch<any>];
13
+ export { TableContext, useStore, useRealive };
@@ -0,0 +1,66 @@
1
+ import { createContext, useContext, useReducer } from 'react'; // =============== context ============== //
2
+
3
+ var TableContext = /*#__PURE__*/createContext({
4
+ state: null,
5
+ dispatch: null,
6
+ instance: {}
7
+ });
8
+
9
+ var useStore = function useStore() {
10
+ return useContext(TableContext);
11
+ };
12
+
13
+ var initialState = {
14
+ // 行高度
15
+ rowHeight: 0,
16
+ columnsLen: 0,
17
+ // 总行数
18
+ totalLen: 0,
19
+ // 分割后的列数组
20
+ sliceColumns: {
21
+ leftColumns: [],
22
+ centerColumns: [],
23
+ rightColumns: []
24
+ }
25
+ };
26
+
27
+ var reducer = function reducer(state, action) {
28
+ var totalLen = action.totalLen,
29
+ columnsLen = action.columnsLen,
30
+ rowHeight = action.rowHeight,
31
+ sliceColumns = action.sliceColumns;
32
+
33
+ switch (action.type) {
34
+ // 数据数量
35
+ case 'changeTotalLen':
36
+ return Object.assign(Object.assign({}, state), {
37
+ totalLen: totalLen
38
+ });
39
+ // 列数量
40
+
41
+ case 'changeColumnsLen':
42
+ return Object.assign(Object.assign({}, state), {
43
+ columnsLen: columnsLen
44
+ });
45
+ // 初始化行高度
46
+
47
+ case 'initHeight':
48
+ return Object.assign(Object.assign({}, state), {
49
+ rowHeight: rowHeight
50
+ });
51
+
52
+ case 'changeSliceColumns':
53
+ return Object.assign(Object.assign({}, state), {
54
+ sliceColumns: sliceColumns
55
+ });
56
+
57
+ default:
58
+ throw new Error();
59
+ }
60
+ };
61
+
62
+ var useRealive = function useRealive() {
63
+ return useReducer(reducer, initialState);
64
+ };
65
+
66
+ export { TableContext, useStore, useRealive };
@@ -0,0 +1,4 @@
1
+ import VirtualTable from './VirtualTable';
2
+ import VirtualWrapper from './VirtualWrapper';
3
+ import VirtualRow from './VirtualRow';
4
+ export { VirtualTable, VirtualWrapper, VirtualRow };
@@ -0,0 +1,4 @@
1
+ import VirtualTable from './VirtualTable';
2
+ import VirtualWrapper from './VirtualWrapper';
3
+ import VirtualRow from './VirtualRow';
4
+ export { VirtualTable, VirtualWrapper, VirtualRow };
@@ -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';
@@ -168,6 +168,7 @@ var useCoreOptions = function useCoreOptions(_ref) {
168
168
 
169
169
  if (getIsHas(itemValue) && !!item) {
170
170
  return [].concat(_toConsumableArray(pre), [{
171
+ relation: obj[cur].mode || 'and',
171
172
  fieldName: cur,
172
173
  fieldType: (item === null || item === void 0 ? void 0 : item.valueType) || 'string',
173
174
  type: item.type,
@@ -177,7 +178,7 @@ var useCoreOptions = function useCoreOptions(_ref) {
177
178
  * and 等同于逻辑关系contains: 选中的值包含所有值
178
179
  * or 等同于逻辑关系in: 选中的值存在于所有值之中
179
180
  */
180
- operator: obj[cur].mode === 'and' ? 'contains' : 'in'
181
+ operator: 'in'
181
182
  }]);
182
183
  }
183
184
 
@@ -344,11 +345,12 @@ var useCoreOptions = function useCoreOptions(_ref) {
344
345
  if (getIsHas(itemValue) && !!item) {
345
346
  // eslint-disable-next-line no-param-reassign
346
347
  pre[cur] = {
348
+ relation: complexFilter[cur].mode || 'and',
347
349
  fieldName: cur,
348
350
  fieldType: (item === null || item === void 0 ? void 0 : item.valueType) || 'string',
349
351
  type: item.type,
350
352
  value: Array.isArray(itemValue) ? itemValue : [itemValue],
351
- operator: complexFilter[cur].mode === 'and' ? 'contains' : 'in'
353
+ operator: 'in'
352
354
  };
353
355
  }
354
356
 
@@ -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;
@@ -13,33 +13,63 @@ var __rest = this && this.__rest || function (s, e) {
13
13
 
14
14
  import React, { useRef, useMemo, useEffect } from 'react';
15
15
  import { useStore } from './context';
16
- var VirtualRow = /*#__PURE__*/React.memo(function (_a, ref) {
17
- var children = _a.children,
18
- resetProps = __rest(_a, ["children"]);
16
+
17
+ var useOptions = function useOptions(_ref) {
18
+ var children = _ref.children,
19
+ ref = _ref.ref,
20
+ trRef = _ref.trRef;
19
21
 
20
22
  var _useStore = useStore(),
21
23
  state = _useStore.state,
22
24
  dispatch = _useStore.dispatch,
23
25
  instance = _useStore.instance;
24
26
 
27
+ var virtualItems = instance.columnVirtual.virtualItems;
25
28
  var rowHeight = state.rowHeight,
26
29
  totalLen = state.totalLen;
27
- var virtualItems = instance.columnVirtual.virtualItems;
28
- var trRef = useRef(null); // 列长度
30
+ var sliceColumns = useMemo(function () {
31
+ return children === null || children === void 0 ? void 0 : children.reduce(function (pre, cur) {
32
+ var _a, _b;
29
33
 
30
- var columnsLen = useMemo(function () {
31
- var _a;
34
+ if (typeof ((_a = cur.props) === null || _a === void 0 ? void 0 : _a.fixLeft) === 'number') {
35
+ pre.leftColumns.push(cur);
36
+ return pre;
37
+ }
38
+
39
+ if (typeof ((_b = cur.props) === null || _b === void 0 ? void 0 : _b.fixRight) === 'number') {
40
+ pre.rightColumns.push(cur);
41
+ return pre;
42
+ }
32
43
 
33
- return (_a = children === null || children === void 0 ? void 0 : children.length) !== null && _a !== void 0 ? _a : 0;
44
+ pre.centerColumns.push(cur);
45
+ return pre;
46
+ }, {
47
+ leftColumns: [],
48
+ rightColumns: [],
49
+ centerColumns: []
50
+ });
34
51
  }, [children]);
35
52
  useEffect(function () {
36
- if (state.columnsLen !== columnsLen) {
53
+ dispatch({
54
+ type: 'changeSliceColumns',
55
+ sliceColumns: sliceColumns
56
+ });
57
+ }, [sliceColumns]); // 非固定列长度
58
+
59
+ var centerColumnsLen = useMemo(function () {
60
+ var _a;
61
+
62
+ return (_a = sliceColumns.centerColumns.length) !== null && _a !== void 0 ? _a : 0;
63
+ }, [sliceColumns]);
64
+ useEffect(function () {
65
+ if (state.columnsLen !== centerColumnsLen) {
37
66
  dispatch({
38
67
  type: 'changeColumnsLen',
39
- columnsLen: columnsLen !== null && columnsLen !== void 0 ? columnsLen : 0
68
+ columnsLen: centerColumnsLen !== null && centerColumnsLen !== void 0 ? centerColumnsLen : 0
40
69
  });
41
70
  }
42
- }, [columnsLen, dispatch, state.columnsLen]);
71
+ }, [centerColumnsLen, dispatch, state.columnsLen]); // 获取行的高度
72
+
43
73
  useEffect(function () {
44
74
  var initHeight = function initHeight(tempRef) {
45
75
  var _a, _b, _c;
@@ -48,55 +78,59 @@ var VirtualRow = /*#__PURE__*/React.memo(function (_a, ref) {
48
78
  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;
49
79
  dispatch({
50
80
  type: 'initHeight',
51
- rowHeight: tempRowHeight
81
+ rowHeight: tempRowHeight + 1
52
82
  });
53
83
  }
54
84
  };
55
85
 
56
86
  initHeight(Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef);
57
- }, [trRef, dispatch, rowHeight, totalLen, ref]); // return {fixedLeft: [], fixedRight: [], columns: []}
58
-
59
- var fixedColumns = useMemo(function () {
60
- return children === null || children === void 0 ? void 0 : children.reduce(function (pre, cur) {
61
- var _a, _b;
87
+ }, [trRef, dispatch, rowHeight, totalLen, ref]); // 横向单元格合并
62
88
 
63
- if (typeof ((_a = cur.props) === null || _a === void 0 ? void 0 : _a.fixLeft) === 'number') {
64
- pre.fixedLeft.push(cur);
65
- return pre;
66
- }
89
+ var leftColSpan = useMemo(function () {
90
+ var _a;
67
91
 
68
- if (typeof ((_b = cur.props) === null || _b === void 0 ? void 0 : _b.fixRight) === 'number') {
69
- pre.fixedRight.push(cur);
70
- return pre;
71
- }
92
+ return (_a = virtualItems[0]) === null || _a === void 0 ? void 0 : _a.index;
93
+ }, [virtualItems]); // 右侧隐藏数量
94
+
95
+ var rightColSpan = useMemo(function () {
96
+ return sliceColumns.centerColumns.length - virtualItems.length - leftColSpan || 0;
97
+ }, [sliceColumns.centerColumns.length, virtualItems.length, leftColSpan]);
98
+ return Object.assign(Object.assign({
99
+ virtualItems: virtualItems
100
+ }, sliceColumns), {
101
+ leftColSpan: leftColSpan,
102
+ rightColSpan: rightColSpan
103
+ });
104
+ };
72
105
 
73
- pre.columns.push(cur);
74
- return pre;
75
- }, {
76
- fixedLeft: [],
77
- fixedRight: [],
78
- columns: []
79
- });
80
- }, [children]); // 截取非固定列
106
+ var VirtualRow = /*#__PURE__*/React.memo(function (_a, ref) {
107
+ var children = _a.children,
108
+ resetProps = __rest(_a, ["children"]);
81
109
 
82
- var resetVirtualItems = useMemo(function () {
83
- var fixedLeft = fixedColumns.fixedLeft,
84
- columns = fixedColumns.columns;
85
- return virtualItems.slice(fixedLeft.length, fixedLeft.length + columns.length);
86
- }, [fixedColumns, virtualItems]); // 横线单元格合并
110
+ var trRef = useRef(null);
87
111
 
88
- var colSpan = useMemo(function () {
89
- var _a;
112
+ var _useOptions = useOptions({
113
+ children: children,
114
+ ref: ref,
115
+ trRef: trRef
116
+ }),
117
+ virtualItems = _useOptions.virtualItems,
118
+ leftColumns = _useOptions.leftColumns,
119
+ centerColumns = _useOptions.centerColumns,
120
+ rightColumns = _useOptions.rightColumns,
121
+ leftColSpan = _useOptions.leftColSpan,
122
+ rightColSpan = _useOptions.rightColSpan;
90
123
 
91
- var startIndex = ((_a = resetVirtualItems === null || resetVirtualItems === void 0 ? void 0 : resetVirtualItems[0]) === null || _a === void 0 ? void 0 : _a.index) || 0;
92
- return startIndex ? startIndex - fixedColumns.fixedLeft.length : startIndex;
93
- }, [fixedColumns, resetVirtualItems]);
94
124
  return /*#__PURE__*/React.createElement("tr", Object.assign({}, resetProps, {
95
125
  ref: Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef
96
- }), fixedColumns.fixedLeft, !!colSpan && /*#__PURE__*/React.createElement("td", {
97
- colSpan: colSpan
98
- }), resetVirtualItems.map(function (virtualCol) {
99
- return children[virtualCol.index];
100
- }), fixedColumns.fixedRight);
126
+ }), leftColumns, !!leftColSpan && /*#__PURE__*/React.createElement("td", {
127
+ key: "leftColSpan",
128
+ colSpan: leftColSpan
129
+ }), virtualItems.map(function (virtualCol) {
130
+ return centerColumns[virtualCol.index];
131
+ }), !!rightColSpan && /*#__PURE__*/React.createElement("td", {
132
+ key: "rightColSpan",
133
+ colSpan: rightColSpan
134
+ }), rightColumns);
101
135
  });
102
136
  export default VirtualRow;
@@ -1,5 +1,5 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import React, { useRef } from 'react';
2
+ import React, { useCallback, useRef } from 'react';
3
3
  import { useVirtual } from 'react-virtual';
4
4
  import { TableContext, useRealive } from './context';
5
5
  var VirtualTable = /*#__PURE__*/React.memo(function (tableProps) {
@@ -10,7 +10,7 @@ var VirtualTable = /*#__PURE__*/React.memo(function (tableProps) {
10
10
  var _useRealive = useRealive(),
11
11
  _useRealive2 = _slicedToArray(_useRealive, 2),
12
12
  state = _useRealive2[0],
13
- dispatch = _useRealive2[1]; // { totalSize, virtualItems }
13
+ dispatch = _useRealive2[1]; // 行虚拟化 { totalSize, virtualItems }
14
14
 
15
15
 
16
16
  var rowVirtual = useVirtual({
@@ -23,18 +23,26 @@ var VirtualTable = /*#__PURE__*/React.memo(function (tableProps) {
23
23
  return state.rowHeight;
24
24
  }, [state.rowHeight]),
25
25
  overscan: 5
26
- });
26
+ }); // 列动态宽度
27
+
28
+ var columnEstimateSize = useCallback(function (i) {
29
+ var _a, _b;
30
+
31
+ 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;
32
+ var leftColumnsLen = state.sliceColumns.leftColumns.length;
33
+ var centerColumnsLen = state.sliceColumns.centerColumns.length; // 获取非固定列
34
+
35
+ var virList = colWidths.slice(leftColumnsLen, leftColumnsLen + centerColumnsLen);
36
+ return virList[i] || 0;
37
+ }, [(_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]); // 列虚拟化
38
+
27
39
  var columnVirtual = useVirtual({
28
40
  horizontal: true,
29
41
  size: state.columnsLen,
30
42
  parentRef: {
31
- current: (_b = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.current) === null || _b === void 0 ? void 0 : _b.parentNode
43
+ current: (_d = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.current) === null || _d === void 0 ? void 0 : _d.parentNode
32
44
  },
33
- estimateSize: React.useCallback(function (i) {
34
- var _a, _b;
35
-
36
- 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];
37
- }, [(_d = (_c = tableProps.children[0]) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.colWidths]),
45
+ estimateSize: columnEstimateSize,
38
46
  overscan: 5
39
47
  });
40
48
  var instance = {
@@ -15,13 +15,20 @@ var initialState = {
15
15
  rowHeight: 0,
16
16
  columnsLen: 0,
17
17
  // 总行数
18
- totalLen: 0
18
+ totalLen: 0,
19
+ // 分割后的列数组
20
+ sliceColumns: {
21
+ leftColumns: [],
22
+ centerColumns: [],
23
+ rightColumns: []
24
+ }
19
25
  };
20
26
 
21
27
  var reducer = function reducer(state, action) {
22
28
  var totalLen = action.totalLen,
23
29
  columnsLen = action.columnsLen,
24
- rowHeight = action.rowHeight;
30
+ rowHeight = action.rowHeight,
31
+ sliceColumns = action.sliceColumns;
25
32
 
26
33
  switch (action.type) {
27
34
  // 数据数量
@@ -42,6 +49,11 @@ var reducer = function reducer(state, action) {
42
49
  rowHeight: rowHeight
43
50
  });
44
51
 
52
+ case 'changeSliceColumns':
53
+ return Object.assign(Object.assign({}, state), {
54
+ sliceColumns: sliceColumns
55
+ });
56
+
45
57
  default:
46
58
  throw new Error();
47
59
  }
@@ -24,7 +24,7 @@ var UploadCore = function UploadCore(_ref) {
24
24
  var isUploading = getUploadStatus().uploading;
25
25
  if (isUploading) return;
26
26
  (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
27
- }, [getUploadStatus]); // 上传触发事件
27
+ }, [disabled, getUploadStatus]); // 上传触发事件
28
28
 
29
29
  var uploadChange = useCallback(function (e) {
30
30
  var _a;
@@ -370,7 +370,7 @@ var useCoreOptions = function useCoreOptions(_ref) {
370
370
 
371
371
  var filesLoopCheck = useCallback(function (files) {
372
372
  return Promise.all(files.map(fileCheckAsync));
373
- }, []);
373
+ }, [fileCheckAsync]);
374
374
  /*
375
375
  * 上传前: 先校验 => 全部校验通过后开始上传
376
376
  * 事件执行顺序:
package/es/Radio/index.js CHANGED
@@ -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
  };
@@ -17,16 +17,21 @@ var __rest = this && this.__rest || function (s, e) {
17
17
 
18
18
  import React from 'react';
19
19
  import cls from 'classnames';
20
+ import DisabledContext from '../ConfigProvider/DisabledContext';
20
21
 
21
22
  var Switch = function Switch(props) {
22
23
  var _props$size = props.size,
23
24
  size = _props$size === void 0 ? 'default' : _props$size,
24
25
  className = props.className,
25
- restProps = __rest(props, ["size", "className"]);
26
+ customDisabled = props.disabled,
27
+ restProps = __rest(props, ["size", "className", "disabled"]);
26
28
 
29
+ var disabled = React.useContext(DisabledContext);
30
+ var mergedDisabled = customDisabled || disabled;
27
31
  var classs = cls('lm-switch', className, _defineProperty({}, "lm-switch-".concat(size), size));
28
32
  return /*#__PURE__*/React.createElement(_Switch, Object.assign({
29
- className: classs
33
+ className: classs,
34
+ disabled: mergedDisabled
30
35
  }, restProps, {
31
36
  size: size
32
37
  }));
@@ -9,7 +9,7 @@ function useEvent(handler) {
9
9
 
10
10
  return useCallback(function () {
11
11
  var fn = handlerRef.current;
12
- return fn.apply(void 0, arguments);
12
+ return fn === null || fn === void 0 ? void 0 : fn.apply(void 0, arguments);
13
13
  }, []);
14
14
  }
15
15
 
package/es/index.d.ts CHANGED
@@ -51,10 +51,9 @@ export type { TooltipProps } from './Tooltip';
51
51
  export { default as Form } from './Form';
52
52
  export { default as Spin } from './Spin';
53
53
  export { default as LmEditTable } from './LmEditTable';
54
- export type { CountdownHandle, TLmEditTable } from './LmEditTable/EditTable';
54
+ export type { TLmEditTable, CountdownHandle } from './LmEditTable/EditTable';
55
55
  export { default as List } from './List';
56
56
  export { default as LMQuickMenu } from './QuickMenu';
57
- export type { IMenuData, IQuickMenuProps } from './QuickMenu';
58
57
  export { default as DatePicker } from './DatePicker';
59
58
  export type { DatePickerProps, MonthPickerProps, WeekPickerProps, RangePickerProps } from './DatePicker';
60
59
  export { default as Popover } from './Popover';