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,164 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.default = void 0;
11
+
12
+ var _react = _interopRequireWildcard(require("react"));
13
+
14
+ var _context = require("./context");
15
+
16
+ var _useForkRef = _interopRequireDefault(require("../hooks/useForkRef"));
17
+
18
+ var _lodash = require("lodash");
19
+
20
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
21
+ var t = {};
22
+
23
+ for (var p in s) {
24
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
25
+ }
26
+
27
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
28
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
29
+ }
30
+ return t;
31
+ };
32
+
33
+ var useOptions = function useOptions(_ref) {
34
+ var children = _ref.children,
35
+ ref = _ref.ref,
36
+ trRef = _ref.trRef;
37
+
38
+ var _a;
39
+
40
+ var _useStore = (0, _context.useStore)(),
41
+ state = _useStore.state,
42
+ dispatch = _useStore.dispatch,
43
+ instance = _useStore.instance;
44
+
45
+ var virtualItems = instance.columnVirtual.virtualItems;
46
+ var rowHeight = state.rowHeight,
47
+ totalLen = state.totalLen;
48
+ var sliceColumns = (0, _react.useMemo)(function () {
49
+ var _a;
50
+
51
+ return (_a = children === null || children === void 0 ? void 0 : children.reduce) === null || _a === void 0 ? void 0 : _a.call(children, function (pre, cur) {
52
+ var _a, _b;
53
+
54
+ if (typeof ((_a = cur.props) === null || _a === void 0 ? void 0 : _a.fixLeft) === 'number') {
55
+ pre.leftColumns.push(cur);
56
+ return pre;
57
+ }
58
+
59
+ if (typeof ((_b = cur.props) === null || _b === void 0 ? void 0 : _b.fixRight) === 'number') {
60
+ pre.rightColumns.push(cur);
61
+ return pre;
62
+ }
63
+
64
+ pre.centerColumns.push(cur);
65
+ return pre;
66
+ }, {
67
+ leftColumns: [],
68
+ rightColumns: [],
69
+ centerColumns: []
70
+ });
71
+ }, [children]);
72
+ (0, _react.useEffect)(function () {
73
+ dispatch({
74
+ type: 'changeSliceColumns',
75
+ sliceColumns: sliceColumns
76
+ });
77
+ }, [sliceColumns]); // 非固定列长度
78
+
79
+ var centerColumnsLen = (0, _react.useMemo)(function () {
80
+ var _a, _b;
81
+
82
+ return (_b = (_a = sliceColumns === null || sliceColumns === void 0 ? void 0 : sliceColumns.centerColumns) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
83
+ }, [sliceColumns]);
84
+ (0, _react.useEffect)(function () {
85
+ if (state.columnsLen !== centerColumnsLen) {
86
+ dispatch({
87
+ type: 'changeColumnsLen',
88
+ columnsLen: centerColumnsLen !== null && centerColumnsLen !== void 0 ? centerColumnsLen : 0
89
+ });
90
+ }
91
+ }, [centerColumnsLen, dispatch, state.columnsLen]); // 获取行的高度
92
+
93
+ (0, _react.useEffect)(function () {
94
+ var initHeight = function initHeight(tempRef) {
95
+ var _a, _b, _c;
96
+
97
+ if (((_a = tempRef === null || tempRef === void 0 ? void 0 : tempRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) && !rowHeight && totalLen) {
98
+ 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;
99
+ dispatch({
100
+ type: 'initHeight',
101
+ rowHeight: tempRowHeight + 1
102
+ });
103
+ }
104
+ };
105
+
106
+ initHeight(Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef);
107
+ }, [trRef, dispatch, rowHeight, totalLen, ref]); // 横向单元格合并
108
+
109
+ var leftColSpan = (0, _react.useMemo)(function () {
110
+ var _a;
111
+
112
+ return (_a = virtualItems[0]) === null || _a === void 0 ? void 0 : _a.index;
113
+ }, [virtualItems]); // 右侧隐藏数量
114
+
115
+ var rightColSpan = (0, _react.useMemo)(function () {
116
+ var _a;
117
+
118
+ return ((_a = sliceColumns === null || sliceColumns === void 0 ? void 0 : sliceColumns.centerColumns) === null || _a === void 0 ? void 0 : _a.length) - (virtualItems === null || virtualItems === void 0 ? void 0 : virtualItems.length) - leftColSpan || 0;
119
+ }, [(_a = sliceColumns === null || sliceColumns === void 0 ? void 0 : sliceColumns.centerColumns) === null || _a === void 0 ? void 0 : _a.length, virtualItems.length, leftColSpan]);
120
+ return Object.assign(Object.assign({
121
+ virtualItems: virtualItems
122
+ }, sliceColumns), {
123
+ leftColSpan: leftColSpan,
124
+ rightColSpan: rightColSpan
125
+ });
126
+ };
127
+
128
+ var VirtualRow = /*#__PURE__*/_react.default.memo(function (_a, ref) {
129
+ var children = _a.children,
130
+ pref = _a.pref,
131
+ resetProps = __rest(_a, ["children", "pref"]);
132
+
133
+ var trRef = (0, _react.useRef)(null);
134
+ var clearProps = (0, _lodash.omit)(resetProps, ['dataKey', 'pushAllForm']);
135
+
136
+ var _useOptions = useOptions({
137
+ children: children,
138
+ ref: ref,
139
+ trRef: trRef
140
+ }),
141
+ virtualItems = _useOptions.virtualItems,
142
+ leftColumns = _useOptions.leftColumns,
143
+ centerColumns = _useOptions.centerColumns,
144
+ rightColumns = _useOptions.rightColumns,
145
+ leftColSpan = _useOptions.leftColSpan,
146
+ rightColSpan = _useOptions.rightColSpan;
147
+
148
+ return /*#__PURE__*/_react.default.createElement("tr", Object.assign({}, clearProps, {
149
+ ref: (0, _useForkRef.default)(pref, trRef)
150
+ }), leftColumns, !!leftColSpan && /*#__PURE__*/_react.default.createElement("td", {
151
+ key: "leftColSpan",
152
+ colSpan: leftColSpan
153
+ }), virtualItems.map(function (virtualCol) {
154
+ return /*#__PURE__*/_react.default.cloneElement(centerColumns[virtualCol.index], {
155
+ ref: virtualCol.measureRef
156
+ });
157
+ }), !!rightColSpan && /*#__PURE__*/_react.default.createElement("td", {
158
+ key: "rightColSpan",
159
+ colSpan: rightColSpan
160
+ }), rightColumns);
161
+ });
162
+
163
+ var _default = VirtualRow;
164
+ exports.default = _default;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface rowProps {
3
+ children?: any;
4
+ pref?: any;
5
+ }
6
+ declare const VirtualRow: React.NamedExoticComponent<rowProps>;
7
+ export default VirtualRow;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.default = void 0;
11
+
12
+ var _react = _interopRequireWildcard(require("react"));
13
+
14
+ var _context = require("./context");
15
+
16
+ var _useForkRef = _interopRequireDefault(require("../hooks/useForkRef"));
17
+
18
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
19
+ var t = {};
20
+
21
+ for (var p in s) {
22
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
23
+ }
24
+
25
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
26
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
27
+ }
28
+ return t;
29
+ };
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"]);
35
+
36
+ var _useStore = (0, _context.useStore)(),
37
+ state = _useStore.state,
38
+ dispatch = _useStore.dispatch;
39
+
40
+ var rowHeight = state.rowHeight,
41
+ totalLen = state.totalLen;
42
+ var trRef = (0, _react.useRef)(null); // 列长度
43
+
44
+ var columnsLen = (0, _react.useMemo)(function () {
45
+ var _a;
46
+
47
+ return (_a = children === null || children === void 0 ? void 0 : children.length) !== null && _a !== void 0 ? _a : 0;
48
+ }, [children]);
49
+ (0, _react.useEffect)(function () {
50
+ if (state.columnsLen !== columnsLen) {
51
+ dispatch({
52
+ type: 'changeColumnsLen',
53
+ columnsLen: columnsLen !== null && columnsLen !== void 0 ? columnsLen : 0
54
+ });
55
+ }
56
+ }, [columnsLen, dispatch, state.columnsLen]);
57
+ (0, _react.useEffect)(function () {
58
+ var initHeight = function initHeight(tempRef) {
59
+ var _a, _b, _c;
60
+
61
+ if (((_a = tempRef === null || tempRef === void 0 ? void 0 : tempRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) && !rowHeight && totalLen) {
62
+ 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
+ dispatch({
64
+ type: 'initHeight',
65
+ rowHeight: tempRowHeight
66
+ });
67
+ }
68
+ };
69
+
70
+ initHeight(trRef);
71
+ }, [trRef, dispatch, rowHeight, totalLen, ref]);
72
+ return /*#__PURE__*/_react.default.createElement("tr", Object.assign({}, resetProps, {
73
+ ref: (0, _useForkRef.default)(pref, trRef)
74
+ }), children);
75
+ });
76
+
77
+ var _default = VirtualRow;
78
+ exports.default = _default;
@@ -0,0 +1,3 @@
1
+ import React, { PropsWithChildren } from 'react';
2
+ declare const VirtualTable: React.MemoExoticComponent<(tableProps: PropsWithChildren<any>) => JSX.Element>;
3
+ export default VirtualTable;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
+
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.default = void 0;
11
+
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+
14
+ var _react = _interopRequireWildcard(require("react"));
15
+
16
+ var _reactVirtual = require("react-virtual");
17
+
18
+ var _context = require("./context");
19
+
20
+ var VirtualTable = /*#__PURE__*/_react.default.memo(function (tableProps) {
21
+ var _a, _b, _c, _d;
22
+
23
+ var fn = tableProps.fn;
24
+ var bodyRef = (0, _react.useRef)(null);
25
+
26
+ var _useRealive = (0, _context.useRealive)(),
27
+ _useRealive2 = (0, _slicedToArray2.default)(_useRealive, 2),
28
+ state = _useRealive2[0],
29
+ dispatch = _useRealive2[1]; // 行虚拟化 { totalSize, virtualItems }
30
+
31
+
32
+ var rowVirtual = (0, _reactVirtual.useVirtual)({
33
+ size: state.totalLen,
34
+ // 绑定父节点
35
+ parentRef: {
36
+ current: (_a = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.current) === null || _a === void 0 ? void 0 : _a.parentNode
37
+ },
38
+ estimateSize: _react.default.useCallback(function () {
39
+ return state.rowHeight;
40
+ }, [state.rowHeight]),
41
+ overscan: 5
42
+ });
43
+ fn.current = rowVirtual.scrollToIndex; // 列动态宽度
44
+
45
+ var columnEstimateSize = (0, _react.useCallback)(function (i) {
46
+ var _a, _b;
47
+
48
+ 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;
49
+ var leftColumnsLen = state.sliceColumns.leftColumns.length;
50
+ var centerColumnsLen = state.sliceColumns.centerColumns.length; // 获取非固定列
51
+
52
+ var virList = colWidths.slice(leftColumnsLen, leftColumnsLen + centerColumnsLen);
53
+ return virList[i] || 0;
54
+ }, [(_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]); // 列虚拟化
55
+
56
+ var columnVirtual = (0, _reactVirtual.useVirtual)({
57
+ horizontal: true,
58
+ size: state.columnsLen,
59
+ parentRef: {
60
+ current: (_d = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.current) === null || _d === void 0 ? void 0 : _d.parentNode
61
+ },
62
+ estimateSize: columnEstimateSize,
63
+ overscan: 5
64
+ });
65
+ var instance = {
66
+ rowVirtual: rowVirtual,
67
+ columnVirtual: columnVirtual
68
+ };
69
+ return /*#__PURE__*/_react.default.createElement(_context.TableContext.Provider, {
70
+ value: {
71
+ state: state,
72
+ dispatch: dispatch,
73
+ instance: instance
74
+ }
75
+ }, /*#__PURE__*/_react.default.createElement("table", Object.assign({
76
+ ref: bodyRef
77
+ }, tableProps)));
78
+ });
79
+
80
+ var _default = VirtualTable;
81
+ exports.default = _default;
@@ -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,73 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _context = require("./context");
13
+
14
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
15
+ var t = {};
16
+
17
+ for (var p in s) {
18
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
19
+ }
20
+
21
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
22
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
23
+ }
24
+ return t;
25
+ };
26
+
27
+ var VirtualWrapper = /*#__PURE__*/_react.default.memo(function (wrapperProps) {
28
+ var _a, _b;
29
+
30
+ var children = wrapperProps.children,
31
+ resetProps = __rest(wrapperProps, ["children"]);
32
+
33
+ var _useStore = (0, _context.useStore)(),
34
+ state = _useStore.state,
35
+ dispatch = _useStore.dispatch,
36
+ instance = _useStore.instance;
37
+
38
+ var _instance$rowVirtual = instance.rowVirtual,
39
+ virtualItems = _instance$rowVirtual.virtualItems,
40
+ totalSize = _instance$rowVirtual.totalSize;
41
+ var contents = (0, _react.useMemo)(function () {
42
+ return children[1];
43
+ }, [children]);
44
+ var contentsLen = (0, _react.useMemo)(function () {
45
+ var _a;
46
+
47
+ return (_a = contents === null || contents === void 0 ? void 0 : contents.length) !== null && _a !== void 0 ? _a : 0;
48
+ }, [contents]);
49
+ (0, _react.useEffect)(function () {
50
+ if (state.totalLen !== contentsLen) {
51
+ dispatch({
52
+ type: 'changeTotalLen',
53
+ totalLen: contentsLen !== null && contentsLen !== void 0 ? contentsLen : 0
54
+ });
55
+ }
56
+ }, [contentsLen, dispatch, state.totalLen]);
57
+ 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;
58
+ 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;
59
+ return /*#__PURE__*/_react.default.createElement("tbody", Object.assign({}, resetProps), paddingTop > 0 && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", {
60
+ style: {
61
+ height: "".concat(paddingTop, "px")
62
+ }
63
+ })), children[0], virtualItems.map(function (virtualRow) {
64
+ return contents[virtualRow.index];
65
+ }), paddingBottom > 0 && /*#__PURE__*/_react.default.createElement("tr", null, /*#__PURE__*/_react.default.createElement("td", {
66
+ style: {
67
+ height: "".concat(paddingBottom, "px")
68
+ }
69
+ })));
70
+ });
71
+
72
+ var _default = VirtualWrapper;
73
+ exports.default = _default;
@@ -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,76 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useStore = exports.useRealive = exports.TableContext = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ // =============== context ============== //
11
+ var TableContext = /*#__PURE__*/(0, _react.createContext)({
12
+ state: null,
13
+ dispatch: null,
14
+ instance: {}
15
+ });
16
+ exports.TableContext = TableContext;
17
+
18
+ var useStore = function useStore() {
19
+ return (0, _react.useContext)(TableContext);
20
+ };
21
+
22
+ exports.useStore = useStore;
23
+ var initialState = {
24
+ // 行高度
25
+ rowHeight: 0,
26
+ columnsLen: 0,
27
+ // 总行数
28
+ totalLen: 0,
29
+ // 分割后的列数组
30
+ sliceColumns: {
31
+ leftColumns: [],
32
+ centerColumns: [],
33
+ rightColumns: []
34
+ }
35
+ };
36
+
37
+ var reducer = function reducer(state, action) {
38
+ var totalLen = action.totalLen,
39
+ columnsLen = action.columnsLen,
40
+ rowHeight = action.rowHeight,
41
+ sliceColumns = action.sliceColumns;
42
+
43
+ switch (action.type) {
44
+ // 数据数量
45
+ case 'changeTotalLen':
46
+ return Object.assign(Object.assign({}, state), {
47
+ totalLen: totalLen
48
+ });
49
+ // 列数量
50
+
51
+ case 'changeColumnsLen':
52
+ return Object.assign(Object.assign({}, state), {
53
+ columnsLen: columnsLen
54
+ });
55
+ // 初始化行高度
56
+
57
+ case 'initHeight':
58
+ return Object.assign(Object.assign({}, state), {
59
+ rowHeight: rowHeight
60
+ });
61
+
62
+ case 'changeSliceColumns':
63
+ return Object.assign(Object.assign({}, state), {
64
+ sliceColumns: sliceColumns
65
+ });
66
+
67
+ default:
68
+ throw new Error();
69
+ }
70
+ };
71
+
72
+ var useRealive = function useRealive() {
73
+ return (0, _react.useReducer)(reducer, initialState);
74
+ };
75
+
76
+ exports.useRealive = 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,31 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ Object.defineProperty(exports, "VirtualRow", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _VirtualRow.default;
12
+ }
13
+ });
14
+ Object.defineProperty(exports, "VirtualTable", {
15
+ enumerable: true,
16
+ get: function get() {
17
+ return _VirtualTable.default;
18
+ }
19
+ });
20
+ Object.defineProperty(exports, "VirtualWrapper", {
21
+ enumerable: true,
22
+ get: function get() {
23
+ return _VirtualWrapper.default;
24
+ }
25
+ });
26
+
27
+ var _VirtualTable = _interopRequireDefault(require("./VirtualTable"));
28
+
29
+ var _VirtualWrapper = _interopRequireDefault(require("./VirtualWrapper"));
30
+
31
+ var _VirtualRow = _interopRequireDefault(require("./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';
@@ -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;