linkmore-design 1.1.27 → 1.1.28-alpha.5
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.
- package/dist/LmEditTable/DndContainer.d.ts +6 -3
- package/dist/LmEditTable/EditTable.d.ts +15 -5
- package/dist/LmEditTable/components/DraggableContainer.d.ts +10 -0
- package/dist/LmEditTable/components/QuickOpetate.d.ts +12 -0
- package/dist/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
- package/dist/LmEditTable/components/customRenderEmpty.d.ts +2 -0
- package/dist/LmEditTable/components/index.d.ts +17 -0
- package/dist/LmEditTable/hooks/useForkRef.d.ts +2 -0
- package/dist/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
- package/dist/LmEditTable/sortableItem.d.ts +3 -2
- package/dist/LmEditTable/util.d.ts +10 -0
- package/dist/LmEditTable/virtual/VirtualRow.d.ts +7 -0
- package/dist/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
- package/dist/LmEditTable/virtual/VirtualTable.d.ts +3 -0
- package/dist/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
- package/dist/LmEditTable/virtual/context.d.ts +13 -0
- package/dist/LmEditTable/virtual/index.d.ts +4 -0
- package/dist/LmTable/virTual/VirtualRow.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.umd.js +1907 -677
- package/dist/index.umd.min.js +21 -21
- package/dist/variables.css +115 -2
- package/es/CardTable/style/index.css +3 -2
- package/es/CardTable/style/variables.css +3 -2
- package/es/CustomTableOption/columnsSort.js +41 -18
- package/es/CustomTableOption/filterSort.js +14 -6
- package/es/CustomTableOption/style/index.css +3 -0
- package/es/CustomTableOption/style/variables.css +3 -0
- package/es/Form/FormItem/index.js +5 -1
- package/es/InputNumber/index.js +7 -9
- package/es/LmEditTable/DndContainer.d.ts +6 -3
- package/es/LmEditTable/DndContainer.js +70 -10
- package/es/LmEditTable/DragHandle.js +1 -1
- package/es/LmEditTable/EditTable.d.ts +15 -5
- package/es/LmEditTable/EditTable.js +696 -361
- package/es/LmEditTable/components/DraggableContainer.d.ts +10 -0
- package/es/LmEditTable/components/DraggableContainer.js +39 -0
- package/es/LmEditTable/components/QuickOpetate.d.ts +12 -0
- package/es/LmEditTable/components/QuickOpetate.js +82 -0
- package/es/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
- package/es/LmEditTable/components/bottomOpetateComponent.js +23 -0
- package/es/LmEditTable/components/customRenderEmpty.d.ts +2 -0
- package/es/LmEditTable/components/customRenderEmpty.js +20 -0
- package/es/LmEditTable/components/index.d.ts +17 -0
- package/es/LmEditTable/components/index.js +8 -0
- package/es/LmEditTable/hooks/useForkRef.d.ts +2 -0
- package/es/LmEditTable/hooks/useForkRef.js +22 -0
- package/es/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
- package/es/LmEditTable/rowSort/DndContainerRow.js +83 -0
- package/es/LmEditTable/sortableItem.d.ts +3 -2
- package/es/LmEditTable/sortableItem.js +16 -4
- package/es/LmEditTable/sortableItemCol.js +40 -10
- package/es/LmEditTable/style/index.css +109 -0
- package/es/LmEditTable/style/variables.css +109 -0
- package/es/LmEditTable/util.d.ts +10 -0
- package/es/LmEditTable/util.js +156 -7
- package/es/LmEditTable/virtual/VirtualRow.d.ts +7 -0
- package/es/LmEditTable/virtual/VirtualRow.js +148 -0
- package/es/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
- package/es/LmEditTable/virtual/VirtualRow2.js +62 -0
- package/es/LmEditTable/virtual/VirtualTable.d.ts +3 -0
- package/es/LmEditTable/virtual/VirtualTable.js +64 -0
- package/es/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
- package/es/LmEditTable/virtual/VirtualWrapper.js +60 -0
- package/es/LmEditTable/virtual/context.d.ts +13 -0
- package/es/LmEditTable/virtual/context.js +66 -0
- package/es/LmEditTable/virtual/index.d.ts +4 -0
- package/es/LmEditTable/virtual/index.js +4 -0
- package/es/LmFilter/baseFilter/index.js +3 -2
- package/es/LmFilter/filterFns/index.js +4 -2
- package/es/LmTable/virTual/VirtualRow.d.ts +1 -1
- package/es/LmTable/virTual/VirtualRow.js +82 -48
- package/es/LmTable/virTual/VirtualTable.js +17 -9
- package/es/LmTable/virTual/context.js +14 -2
- package/es/LmUpload/body/UploadCore.js +1 -1
- package/es/LmUpload/fns/index.js +1 -1
- package/es/Radio/index.js +9 -1
- package/es/Switch/index.js +7 -2
- package/es/hooks/useEvent/index.js +1 -1
- package/es/index.d.ts +1 -2
- package/es/styles/variables.css +115 -2
- package/lib/CardTable/style/index.css +3 -2
- package/lib/CardTable/style/variables.css +3 -2
- package/lib/CustomTableOption/columnsSort.js +48 -22
- package/lib/CustomTableOption/filterSort.js +19 -10
- package/lib/CustomTableOption/style/index.css +3 -0
- package/lib/CustomTableOption/style/variables.css +3 -0
- package/lib/Form/FormItem/index.js +5 -1
- package/lib/InputNumber/index.js +9 -9
- package/lib/LmEditTable/DndContainer.d.ts +6 -3
- package/lib/LmEditTable/DndContainer.js +74 -9
- package/lib/LmEditTable/DragHandle.js +1 -1
- package/lib/LmEditTable/EditTable.d.ts +15 -5
- package/lib/LmEditTable/EditTable.js +694 -358
- package/lib/LmEditTable/components/DraggableContainer.d.ts +10 -0
- package/lib/LmEditTable/components/DraggableContainer.js +52 -0
- package/lib/LmEditTable/components/QuickOpetate.d.ts +12 -0
- package/lib/LmEditTable/components/QuickOpetate.js +96 -0
- package/lib/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
- package/lib/LmEditTable/components/bottomOpetateComponent.js +34 -0
- package/lib/LmEditTable/components/customRenderEmpty.d.ts +2 -0
- package/lib/LmEditTable/components/customRenderEmpty.js +32 -0
- package/lib/LmEditTable/components/index.d.ts +17 -0
- package/lib/LmEditTable/components/index.js +45 -0
- package/lib/LmEditTable/hooks/useForkRef.d.ts +2 -0
- package/lib/LmEditTable/hooks/useForkRef.js +29 -0
- package/lib/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
- package/lib/LmEditTable/rowSort/DndContainerRow.js +100 -0
- package/lib/LmEditTable/sortableItem.d.ts +3 -2
- package/lib/LmEditTable/sortableItem.js +19 -5
- package/lib/LmEditTable/sortableItemCol.js +37 -8
- package/lib/LmEditTable/style/index.css +109 -0
- package/lib/LmEditTable/style/variables.css +109 -0
- package/lib/LmEditTable/util.d.ts +10 -0
- package/lib/LmEditTable/util.js +165 -6
- package/lib/LmEditTable/virtual/VirtualRow.d.ts +7 -0
- package/lib/LmEditTable/virtual/VirtualRow.js +164 -0
- package/lib/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
- package/lib/LmEditTable/virtual/VirtualRow2.js +78 -0
- package/lib/LmEditTable/virtual/VirtualTable.d.ts +3 -0
- package/lib/LmEditTable/virtual/VirtualTable.js +81 -0
- package/lib/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
- package/lib/LmEditTable/virtual/VirtualWrapper.js +73 -0
- package/lib/LmEditTable/virtual/context.d.ts +13 -0
- package/lib/LmEditTable/virtual/context.js +76 -0
- package/lib/LmEditTable/virtual/index.d.ts +4 -0
- package/lib/LmEditTable/virtual/index.js +31 -0
- package/lib/LmFilter/baseFilter/index.js +3 -2
- package/lib/LmFilter/filterFns/index.js +4 -2
- package/lib/LmTable/virTual/VirtualRow.d.ts +1 -1
- package/lib/LmTable/virTual/VirtualRow.js +81 -48
- package/lib/LmTable/virTual/VirtualTable.js +16 -8
- package/lib/LmTable/virTual/context.js +14 -2
- package/lib/LmUpload/body/UploadCore.js +1 -1
- package/lib/LmUpload/fns/index.js +1 -1
- package/lib/Radio/index.js +9 -1
- package/lib/Switch/index.js +9 -2
- package/lib/hooks/useEvent/index.js +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/styles/variables.css +115 -2
- package/package.json +7 -9
|
@@ -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 };
|
|
@@ -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
|
-
|
|
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:
|
|
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:
|
|
353
|
+
operator: 'in'
|
|
352
354
|
};
|
|
353
355
|
}
|
|
354
356
|
|
|
@@ -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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
28
|
-
|
|
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
|
-
|
|
31
|
-
|
|
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
|
-
|
|
44
|
+
pre.centerColumns.push(cur);
|
|
45
|
+
return pre;
|
|
46
|
+
}, {
|
|
47
|
+
leftColumns: [],
|
|
48
|
+
rightColumns: [],
|
|
49
|
+
centerColumns: []
|
|
50
|
+
});
|
|
34
51
|
}, [children]);
|
|
35
52
|
useEffect(function () {
|
|
36
|
-
|
|
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:
|
|
68
|
+
columnsLen: centerColumnsLen !== null && centerColumnsLen !== void 0 ? centerColumnsLen : 0
|
|
40
69
|
});
|
|
41
70
|
}
|
|
42
|
-
}, [
|
|
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]); //
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
return pre;
|
|
66
|
-
}
|
|
89
|
+
var leftColSpan = useMemo(function () {
|
|
90
|
+
var _a;
|
|
67
91
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
74
|
-
|
|
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
|
|
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
|
|
89
|
-
|
|
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
|
-
}),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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: (
|
|
43
|
+
current: (_d = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.current) === null || _d === void 0 ? void 0 : _d.parentNode
|
|
32
44
|
},
|
|
33
|
-
estimateSize:
|
|
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;
|
package/es/LmUpload/fns/index.js
CHANGED
|
@@ -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
|
|
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
|
};
|
package/es/Switch/index.js
CHANGED
|
@@ -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
|
-
|
|
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
|
}));
|
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 {
|
|
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';
|