linkmore-design 1.1.27-alpha.0 → 1.1.27
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 +3 -6
- package/dist/LmEditTable/EditTable.d.ts +5 -10
- package/dist/LmEditTable/sortableItem.d.ts +2 -3
- package/dist/LmEditTable/util.d.ts +0 -7
- package/dist/index.d.ts +2 -1
- package/dist/index.umd.js +527 -1133
- package/dist/index.umd.min.js +8 -8
- package/dist/variables.css +0 -65
- package/es/InputNumber/index.js +9 -7
- package/es/LmEditTable/DndContainer.d.ts +3 -6
- package/es/LmEditTable/DndContainer.js +10 -70
- package/es/LmEditTable/DragHandle.js +1 -1
- package/es/LmEditTable/EditTable.d.ts +5 -10
- package/es/LmEditTable/EditTable.js +360 -352
- package/es/LmEditTable/sortableItem.d.ts +2 -3
- package/es/LmEditTable/sortableItem.js +4 -16
- package/es/LmEditTable/sortableItemCol.js +10 -40
- package/es/LmEditTable/style/index.css +0 -65
- package/es/LmEditTable/style/variables.css +0 -65
- package/es/LmEditTable/util.d.ts +0 -7
- package/es/LmEditTable/util.js +7 -92
- package/es/LmTable/virTual/VirtualRow.js +14 -12
- package/es/hooks/useEvent/index.js +1 -1
- package/es/index.d.ts +2 -1
- package/es/styles/variables.css +0 -65
- package/lib/InputNumber/index.js +9 -9
- package/lib/LmEditTable/DndContainer.d.ts +3 -6
- package/lib/LmEditTable/DndContainer.js +9 -74
- package/lib/LmEditTable/DragHandle.js +1 -1
- package/lib/LmEditTable/EditTable.d.ts +5 -10
- package/lib/LmEditTable/EditTable.js +357 -349
- package/lib/LmEditTable/sortableItem.d.ts +2 -3
- package/lib/LmEditTable/sortableItem.js +5 -19
- package/lib/LmEditTable/sortableItemCol.js +8 -37
- package/lib/LmEditTable/style/index.css +0 -65
- package/lib/LmEditTable/style/variables.css +0 -65
- package/lib/LmEditTable/util.d.ts +0 -7
- package/lib/LmEditTable/util.js +6 -97
- package/lib/LmTable/virTual/VirtualRow.js +14 -12
- package/lib/hooks/useEvent/index.js +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/styles/variables.css +0 -65
- package/package.json +9 -7
- package/dist/LmEditTable/components/DraggableContainer.d.ts +0 -10
- package/dist/LmEditTable/components/QuickOpetate.d.ts +0 -12
- package/dist/LmEditTable/components/bottomOpetateComponent.d.ts +0 -13
- package/dist/LmEditTable/components/index.d.ts +0 -16
- package/dist/LmEditTable/hooks/useForkRef.d.ts +0 -2
- package/dist/LmEditTable/rowSort/DndContainerRow.d.ts +0 -10
- package/dist/LmEditTable/virtual/VirtualRow.d.ts +0 -7
- package/dist/LmEditTable/virtual/VirtualRowBack.d.ts +0 -6
- package/dist/LmEditTable/virtual/VirtualTable.d.ts +0 -3
- package/dist/LmEditTable/virtual/VirtualWrapper.d.ts +0 -3
- package/dist/LmEditTable/virtual/context.d.ts +0 -13
- package/dist/LmEditTable/virtual/index.d.ts +0 -4
- package/es/LmEditTable/components/DraggableContainer.d.ts +0 -10
- package/es/LmEditTable/components/DraggableContainer.js +0 -39
- package/es/LmEditTable/components/QuickOpetate.d.ts +0 -12
- package/es/LmEditTable/components/QuickOpetate.js +0 -82
- package/es/LmEditTable/components/bottomOpetateComponent.d.ts +0 -13
- package/es/LmEditTable/components/bottomOpetateComponent.js +0 -23
- package/es/LmEditTable/components/index.d.ts +0 -16
- package/es/LmEditTable/components/index.js +0 -7
- package/es/LmEditTable/hooks/useForkRef.d.ts +0 -2
- package/es/LmEditTable/hooks/useForkRef.js +0 -22
- package/es/LmEditTable/rowSort/DndContainerRow.d.ts +0 -10
- package/es/LmEditTable/rowSort/DndContainerRow.js +0 -81
- package/es/LmEditTable/virtual/VirtualRow.d.ts +0 -7
- package/es/LmEditTable/virtual/VirtualRow.js +0 -62
- package/es/LmEditTable/virtual/VirtualRowBack.d.ts +0 -6
- package/es/LmEditTable/virtual/VirtualRowBack.js +0 -100
- package/es/LmEditTable/virtual/VirtualTable.d.ts +0 -3
- package/es/LmEditTable/virtual/VirtualTable.js +0 -54
- package/es/LmEditTable/virtual/VirtualWrapper.d.ts +0 -3
- package/es/LmEditTable/virtual/VirtualWrapper.js +0 -60
- package/es/LmEditTable/virtual/context.d.ts +0 -13
- package/es/LmEditTable/virtual/context.js +0 -54
- package/es/LmEditTable/virtual/index.d.ts +0 -4
- package/es/LmEditTable/virtual/index.js +0 -4
- package/lib/LmEditTable/components/DraggableContainer.d.ts +0 -10
- package/lib/LmEditTable/components/DraggableContainer.js +0 -52
- package/lib/LmEditTable/components/QuickOpetate.d.ts +0 -12
- package/lib/LmEditTable/components/QuickOpetate.js +0 -96
- package/lib/LmEditTable/components/bottomOpetateComponent.d.ts +0 -13
- package/lib/LmEditTable/components/bottomOpetateComponent.js +0 -34
- package/lib/LmEditTable/components/index.d.ts +0 -16
- package/lib/LmEditTable/components/index.js +0 -37
- package/lib/LmEditTable/hooks/useForkRef.d.ts +0 -2
- package/lib/LmEditTable/hooks/useForkRef.js +0 -29
- package/lib/LmEditTable/rowSort/DndContainerRow.d.ts +0 -10
- package/lib/LmEditTable/rowSort/DndContainerRow.js +0 -99
- package/lib/LmEditTable/virtual/VirtualRow.d.ts +0 -7
- package/lib/LmEditTable/virtual/VirtualRow.js +0 -78
- package/lib/LmEditTable/virtual/VirtualRowBack.d.ts +0 -6
- package/lib/LmEditTable/virtual/VirtualRowBack.js +0 -113
- package/lib/LmEditTable/virtual/VirtualTable.d.ts +0 -3
- package/lib/LmEditTable/virtual/VirtualTable.js +0 -71
- package/lib/LmEditTable/virtual/VirtualWrapper.d.ts +0 -3
- package/lib/LmEditTable/virtual/VirtualWrapper.js +0 -73
- package/lib/LmEditTable/virtual/context.d.ts +0 -13
- package/lib/LmEditTable/virtual/context.js +0 -64
- package/lib/LmEditTable/virtual/index.d.ts +0 -4
- package/lib/LmEditTable/virtual/index.js +0 -31
|
@@ -1,100 +0,0 @@
|
|
|
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, { useRef, useMemo, useEffect } from 'react';
|
|
15
|
-
import { useStore } from './context';
|
|
16
|
-
var VirtualRow = /*#__PURE__*/React.memo(function (_a, ref) {
|
|
17
|
-
var children = _a.children,
|
|
18
|
-
resetProps = __rest(_a, ["children"]);
|
|
19
|
-
|
|
20
|
-
var _useStore = useStore(),
|
|
21
|
-
state = _useStore.state,
|
|
22
|
-
dispatch = _useStore.dispatch,
|
|
23
|
-
instance = _useStore.instance;
|
|
24
|
-
|
|
25
|
-
var rowHeight = state.rowHeight,
|
|
26
|
-
totalLen = state.totalLen;
|
|
27
|
-
var virtualItems = instance.columnVirtual.virtualItems;
|
|
28
|
-
var trRef = useRef(null); // 非固定列长度
|
|
29
|
-
|
|
30
|
-
var columnsLen = useMemo(function () {
|
|
31
|
-
var _a;
|
|
32
|
-
|
|
33
|
-
return (_a = children === null || children === void 0 ? void 0 : children.filter(function (v) {
|
|
34
|
-
var _a, _b;
|
|
35
|
-
|
|
36
|
-
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';
|
|
37
|
-
}).length) !== null && _a !== void 0 ? _a : 0;
|
|
38
|
-
}, [children]);
|
|
39
|
-
useEffect(function () {
|
|
40
|
-
if (state.columnsLen !== columnsLen) {
|
|
41
|
-
dispatch({
|
|
42
|
-
type: 'changeColumnsLen',
|
|
43
|
-
columnsLen: columnsLen !== null && columnsLen !== void 0 ? columnsLen : 0
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}, [columnsLen, dispatch, state.columnsLen]);
|
|
47
|
-
useEffect(function () {
|
|
48
|
-
var initHeight = function initHeight(tempRef) {
|
|
49
|
-
var _a, _b, _c;
|
|
50
|
-
|
|
51
|
-
if (((_a = tempRef === null || tempRef === void 0 ? void 0 : tempRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) && !rowHeight && totalLen) {
|
|
52
|
-
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;
|
|
53
|
-
dispatch({
|
|
54
|
-
type: 'initHeight',
|
|
55
|
-
rowHeight: tempRowHeight
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
initHeight(Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef);
|
|
61
|
-
}, [trRef, dispatch, rowHeight, totalLen, ref]); // return {fixedLeft: [], fixedRight: [], columns: []}
|
|
62
|
-
|
|
63
|
-
var fixedColumns = useMemo(function () {
|
|
64
|
-
return children === null || children === void 0 ? void 0 : children.reduce(function (pre, cur) {
|
|
65
|
-
var _a, _b;
|
|
66
|
-
|
|
67
|
-
if (typeof ((_a = cur.props) === null || _a === void 0 ? void 0 : _a.fixLeft) === 'number') {
|
|
68
|
-
pre.fixedLeft.push(cur);
|
|
69
|
-
return pre;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (typeof ((_b = cur.props) === null || _b === void 0 ? void 0 : _b.fixRight) === 'number') {
|
|
73
|
-
pre.fixedRight.push(cur);
|
|
74
|
-
return pre;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
pre.columns.push(cur);
|
|
78
|
-
return pre;
|
|
79
|
-
}, {
|
|
80
|
-
fixedLeft: [],
|
|
81
|
-
fixedRight: [],
|
|
82
|
-
columns: []
|
|
83
|
-
});
|
|
84
|
-
}, [children]); // 横向单元格合并
|
|
85
|
-
|
|
86
|
-
var colSpan = useMemo(function () {
|
|
87
|
-
var _a;
|
|
88
|
-
|
|
89
|
-
return (_a = virtualItems[0]) === null || _a === void 0 ? void 0 : _a.index;
|
|
90
|
-
}, [virtualItems]);
|
|
91
|
-
console.log('virtualItems', virtualItems);
|
|
92
|
-
return /*#__PURE__*/React.createElement("tr", Object.assign({}, resetProps, {
|
|
93
|
-
ref: Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef
|
|
94
|
-
}), fixedColumns.fixedLeft, !!colSpan && /*#__PURE__*/React.createElement("td", {
|
|
95
|
-
colSpan: colSpan
|
|
96
|
-
}), virtualItems.map(function (virtualCol) {
|
|
97
|
-
return fixedColumns.columns[virtualCol.index];
|
|
98
|
-
}), fixedColumns.fixedRight);
|
|
99
|
-
});
|
|
100
|
-
export default VirtualRow;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import React, { useRef } from 'react';
|
|
3
|
-
import { useVirtual } from 'react-virtual';
|
|
4
|
-
import { TableContext, useRealive } from './context';
|
|
5
|
-
var VirtualTable = /*#__PURE__*/React.memo(function (tableProps) {
|
|
6
|
-
var _a, _b, _c, _d;
|
|
7
|
-
|
|
8
|
-
var bodyRef = useRef(null);
|
|
9
|
-
|
|
10
|
-
var _useRealive = useRealive(),
|
|
11
|
-
_useRealive2 = _slicedToArray(_useRealive, 2),
|
|
12
|
-
state = _useRealive2[0],
|
|
13
|
-
dispatch = _useRealive2[1]; // { totalSize, virtualItems }
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var rowVirtual = useVirtual({
|
|
17
|
-
size: state.totalLen,
|
|
18
|
-
// 绑定父节点
|
|
19
|
-
parentRef: {
|
|
20
|
-
current: (_a = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.current) === null || _a === void 0 ? void 0 : _a.parentNode
|
|
21
|
-
},
|
|
22
|
-
estimateSize: React.useCallback(function () {
|
|
23
|
-
return state.rowHeight;
|
|
24
|
-
}, [state.rowHeight]),
|
|
25
|
-
overscan: 5
|
|
26
|
-
});
|
|
27
|
-
var columnVirtual = useVirtual({
|
|
28
|
-
horizontal: true,
|
|
29
|
-
size: state.columnsLen,
|
|
30
|
-
parentRef: {
|
|
31
|
-
current: (_b = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.current) === null || _b === void 0 ? void 0 : _b.parentNode
|
|
32
|
-
},
|
|
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]),
|
|
38
|
-
overscan: 5
|
|
39
|
-
});
|
|
40
|
-
var instance = {
|
|
41
|
-
rowVirtual: rowVirtual,
|
|
42
|
-
columnVirtual: columnVirtual
|
|
43
|
-
};
|
|
44
|
-
return /*#__PURE__*/React.createElement(TableContext.Provider, {
|
|
45
|
-
value: {
|
|
46
|
-
state: state,
|
|
47
|
-
dispatch: dispatch,
|
|
48
|
-
instance: instance
|
|
49
|
-
}
|
|
50
|
-
}, /*#__PURE__*/React.createElement("table", Object.assign({
|
|
51
|
-
ref: bodyRef
|
|
52
|
-
}, tableProps)));
|
|
53
|
-
});
|
|
54
|
-
export default VirtualTable;
|
|
@@ -1,60 +0,0 @@
|
|
|
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;
|
|
@@ -1,13 +0,0 @@
|
|
|
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 };
|
|
@@ -1,54 +0,0 @@
|
|
|
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
|
-
|
|
21
|
-
var reducer = function reducer(state, action) {
|
|
22
|
-
var totalLen = action.totalLen,
|
|
23
|
-
columnsLen = action.columnsLen,
|
|
24
|
-
rowHeight = action.rowHeight;
|
|
25
|
-
|
|
26
|
-
switch (action.type) {
|
|
27
|
-
// 数据数量
|
|
28
|
-
case 'changeTotalLen':
|
|
29
|
-
return Object.assign(Object.assign({}, state), {
|
|
30
|
-
totalLen: totalLen
|
|
31
|
-
});
|
|
32
|
-
// 列数量
|
|
33
|
-
|
|
34
|
-
case 'changeColumnsLen':
|
|
35
|
-
return Object.assign(Object.assign({}, state), {
|
|
36
|
-
columnsLen: columnsLen
|
|
37
|
-
});
|
|
38
|
-
// 初始化行高度
|
|
39
|
-
|
|
40
|
-
case 'initHeight':
|
|
41
|
-
return Object.assign(Object.assign({}, state), {
|
|
42
|
-
rowHeight: rowHeight
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
default:
|
|
46
|
-
throw new Error();
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
var useRealive = function useRealive() {
|
|
51
|
-
return useReducer(reducer, initialState);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export { TableContext, useStore, useRealive };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
declare const DraggableContainer: ({ keys, onSortEnd, virtual, rowKey, options, tableWidth, ...props }: {
|
|
2
|
-
[x: string]: any;
|
|
3
|
-
keys: any;
|
|
4
|
-
onSortEnd: any;
|
|
5
|
-
virtual: any;
|
|
6
|
-
rowKey: any;
|
|
7
|
-
options: any;
|
|
8
|
-
tableWidth: any;
|
|
9
|
-
}) => JSX.Element;
|
|
10
|
-
export default DraggableContainer;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _DndContainerRow = _interopRequireDefault(require("../rowSort/DndContainerRow"));
|
|
13
|
-
|
|
14
|
-
var _sortableBox = _interopRequireDefault(require("../sortableBox"));
|
|
15
|
-
|
|
16
|
-
var _virtual = require("../virtual");
|
|
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 DraggableContainer = function DraggableContainer(_a) {
|
|
32
|
-
var keys = _a.keys,
|
|
33
|
-
onSortEnd = _a.onSortEnd,
|
|
34
|
-
virtual = _a.virtual,
|
|
35
|
-
rowKey = _a.rowKey,
|
|
36
|
-
options = _a.options,
|
|
37
|
-
tableWidth = _a.tableWidth,
|
|
38
|
-
props = __rest(_a, ["keys", "onSortEnd", "virtual", "rowKey", "options", "tableWidth"]);
|
|
39
|
-
|
|
40
|
-
return /*#__PURE__*/_react.default.createElement(_DndContainerRow.default, {
|
|
41
|
-
move: onSortEnd,
|
|
42
|
-
items: keys,
|
|
43
|
-
rowKey: rowKey,
|
|
44
|
-
options: options,
|
|
45
|
-
tableWidth: tableWidth
|
|
46
|
-
}, /*#__PURE__*/_react.default.createElement(_sortableBox.default, {
|
|
47
|
-
items: keys
|
|
48
|
-
}, virtual ? /*#__PURE__*/_react.default.createElement(_virtual.VirtualWrapper, Object.assign({}, props)) : /*#__PURE__*/_react.default.createElement("tbody", Object.assign({}, props))));
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
var _default = DraggableContainer;
|
|
52
|
-
exports.default = _default;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
interface IOpetateProps {
|
|
3
|
-
record: Record<string, any>;
|
|
4
|
-
rowKey?: string;
|
|
5
|
-
handleAdd?: (row?: any, addInChildren?: boolean) => void;
|
|
6
|
-
handleDelete?: (rowKey?: string) => void;
|
|
7
|
-
options?: string[];
|
|
8
|
-
getLength?: number;
|
|
9
|
-
quickOpetateClearAll?: boolean;
|
|
10
|
-
}
|
|
11
|
-
declare const QuickOpetate: FC<IOpetateProps>;
|
|
12
|
-
export default QuickOpetate;
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _Button = _interopRequireDefault(require("../../Button"));
|
|
13
|
-
|
|
14
|
-
var _IconFont = _interopRequireDefault(require("../../IconFont"));
|
|
15
|
-
|
|
16
|
-
var _Popover = _interopRequireDefault(require("../../Popover"));
|
|
17
|
-
|
|
18
|
-
var _DisabledContext = _interopRequireDefault(require("../../ConfigProvider/DisabledContext"));
|
|
19
|
-
|
|
20
|
-
var QuickOpetate = function QuickOpetate(_ref) {
|
|
21
|
-
var record = _ref.record,
|
|
22
|
-
rowKey = _ref.rowKey,
|
|
23
|
-
handleAdd = _ref.handleAdd,
|
|
24
|
-
handleDelete = _ref.handleDelete,
|
|
25
|
-
_ref$options = _ref.options,
|
|
26
|
-
options = _ref$options === void 0 ? ['add', 'delete'] : _ref$options,
|
|
27
|
-
getLength = _ref.getLength,
|
|
28
|
-
quickOpetateClearAll = _ref.quickOpetateClearAll;
|
|
29
|
-
var disabled = _react.default.useContext(_DisabledContext.default) || false;
|
|
30
|
-
|
|
31
|
-
var appendChildren = function appendChildren() {
|
|
32
|
-
handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record, true);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
var appendAdd = function appendAdd() {
|
|
36
|
-
handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
40
|
-
style: {
|
|
41
|
-
display: 'flex',
|
|
42
|
-
alignItems: 'center',
|
|
43
|
-
justifyContent: 'flex-start',
|
|
44
|
-
marginLeft: '-4px'
|
|
45
|
-
}
|
|
46
|
-
}, options.includes('delete') && /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
47
|
-
type: "link",
|
|
48
|
-
size: "small",
|
|
49
|
-
disabled: !quickOpetateClearAll && getLength < 2 || disabled,
|
|
50
|
-
icon: /*#__PURE__*/_react.default.createElement(_IconFont.default, {
|
|
51
|
-
type: "lmweb-minus-circle",
|
|
52
|
-
style: {
|
|
53
|
-
fontSize: 16
|
|
54
|
-
}
|
|
55
|
-
}),
|
|
56
|
-
onClick: function onClick() {
|
|
57
|
-
return handleDelete(record[rowKey]);
|
|
58
|
-
}
|
|
59
|
-
}), (options === null || options === void 0 ? void 0 : options.includes('add')) && (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? /*#__PURE__*/_react.default.createElement(_Popover.default, {
|
|
60
|
-
placement: "bottom",
|
|
61
|
-
overlayClassName: "lm_table_append_add_popover",
|
|
62
|
-
open: open,
|
|
63
|
-
title: null,
|
|
64
|
-
content: /*#__PURE__*/_react.default.createElement("ul", null, /*#__PURE__*/_react.default.createElement("li", {
|
|
65
|
-
onClick: appendAdd
|
|
66
|
-
}, "\u6DFB\u52A0\u5E73\u7EA7"), /*#__PURE__*/_react.default.createElement("li", {
|
|
67
|
-
onClick: appendChildren
|
|
68
|
-
}, "\u6DFB\u52A0\u5B50\u7EA7")),
|
|
69
|
-
trigger: "hover"
|
|
70
|
-
}, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
71
|
-
type: "link",
|
|
72
|
-
size: "small",
|
|
73
|
-
icon: /*#__PURE__*/_react.default.createElement(_IconFont.default, {
|
|
74
|
-
type: "lmweb-plus-circle-fill",
|
|
75
|
-
style: {
|
|
76
|
-
fontSize: 16
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
})) : (options === null || options === void 0 ? void 0 : options.includes('add')) || (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
80
|
-
type: "link",
|
|
81
|
-
size: "small",
|
|
82
|
-
disabled: disabled,
|
|
83
|
-
icon: /*#__PURE__*/_react.default.createElement(_IconFont.default, {
|
|
84
|
-
type: "lmweb-plus-circle-fill",
|
|
85
|
-
style: {
|
|
86
|
-
fontSize: 16
|
|
87
|
-
}
|
|
88
|
-
}),
|
|
89
|
-
onClick: function onClick() {
|
|
90
|
-
return handleAdd(record, !!(options === null || options === void 0 ? void 0 : options.includes('addInChildren')));
|
|
91
|
-
}
|
|
92
|
-
}) : null);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
var _default = QuickOpetate;
|
|
96
|
-
exports.default = _default;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
interface IBottomOpetateCompoentProps {
|
|
2
|
-
isShowAddAction?: boolean;
|
|
3
|
-
handleAdd?: () => void;
|
|
4
|
-
recordCreatorProps?: {
|
|
5
|
-
creatorButtonText?: string;
|
|
6
|
-
style?: Record<string, any>;
|
|
7
|
-
initData?: Record<string, any> | (() => Record<string, any>);
|
|
8
|
-
customAddClick?: () => void;
|
|
9
|
-
};
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
}
|
|
12
|
-
declare const BottomOpetateComponent: (props: IBottomOpetateCompoentProps) => JSX.Element;
|
|
13
|
-
export default BottomOpetateComponent;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _index = require("../../index");
|
|
13
|
-
|
|
14
|
-
var BottomOpetateComponent = function BottomOpetateComponent(props) {
|
|
15
|
-
var isShowAddAction = props.isShowAddAction,
|
|
16
|
-
recordCreatorProps = props.recordCreatorProps,
|
|
17
|
-
handleAdd = props.handleAdd,
|
|
18
|
-
_props$disabled = props.disabled,
|
|
19
|
-
disabled = _props$disabled === void 0 ? false : _props$disabled;
|
|
20
|
-
return isShowAddAction ? /*#__PURE__*/_react.default.createElement(_index.Button, {
|
|
21
|
-
className: "lm_editTable_add_bar",
|
|
22
|
-
type: "dashed",
|
|
23
|
-
disabled: disabled,
|
|
24
|
-
onClick: (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.customAddClick) || handleAdd,
|
|
25
|
-
style: Object.assign({
|
|
26
|
-
marginTop: 8
|
|
27
|
-
}, (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.style) || {})
|
|
28
|
-
}, /*#__PURE__*/_react.default.createElement(_index.IconFont, {
|
|
29
|
-
type: "lmweb-plus"
|
|
30
|
-
}), (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.creatorButtonText) || '新增') : null;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
var _default = BottomOpetateComponent;
|
|
34
|
-
exports.default = _default;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import DraggableContainer from './DraggableContainer';
|
|
2
|
-
import BottomOpetateComponent from './bottomOpetateComponent';
|
|
3
|
-
import QuickOpetate from './QuickOpetate';
|
|
4
|
-
export { DraggableContainer, BottomOpetateComponent, QuickOpetate };
|
|
5
|
-
declare const _default: {
|
|
6
|
-
DraggableContainer: ({ keys, onSortEnd, virtual, rowKey, options, tableWidth, ...props }: {
|
|
7
|
-
[x: string]: any;
|
|
8
|
-
keys: any;
|
|
9
|
-
onSortEnd: any;
|
|
10
|
-
virtual: any;
|
|
11
|
-
rowKey: any;
|
|
12
|
-
options: any;
|
|
13
|
-
tableWidth: any;
|
|
14
|
-
}) => JSX.Element;
|
|
15
|
-
};
|
|
16
|
-
export default _default;
|
|
@@ -1,37 +0,0 @@
|
|
|
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, "BottomOpetateComponent", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function get() {
|
|
11
|
-
return _bottomOpetateComponent.default;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
Object.defineProperty(exports, "DraggableContainer", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function get() {
|
|
17
|
-
return _DraggableContainer.default;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(exports, "QuickOpetate", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function get() {
|
|
23
|
-
return _QuickOpetate.default;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
exports.default = void 0;
|
|
27
|
-
|
|
28
|
-
var _DraggableContainer = _interopRequireDefault(require("./DraggableContainer"));
|
|
29
|
-
|
|
30
|
-
var _bottomOpetateComponent = _interopRequireDefault(require("./bottomOpetateComponent"));
|
|
31
|
-
|
|
32
|
-
var _QuickOpetate = _interopRequireDefault(require("./QuickOpetate"));
|
|
33
|
-
|
|
34
|
-
var _default = {
|
|
35
|
-
DraggableContainer: _DraggableContainer.default
|
|
36
|
-
};
|
|
37
|
-
exports.default = _default;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = useForkRef;
|
|
7
|
-
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
|
|
10
|
-
function setRef(ref, value) {
|
|
11
|
-
if (typeof ref === 'function') {
|
|
12
|
-
ref(value);
|
|
13
|
-
} else if (ref) {
|
|
14
|
-
ref.current = value;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function useForkRef(refA, refB) {
|
|
19
|
-
return (0, _react.useMemo)(function () {
|
|
20
|
-
if (refA == null && refB == null) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return function (refValue) {
|
|
25
|
-
setRef(refA, refValue);
|
|
26
|
-
setRef(refB, refValue);
|
|
27
|
-
};
|
|
28
|
-
}, [refA, refB]);
|
|
29
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
declare const _default: React.MemoExoticComponent<({ children, options, move, rowKey, items, tableWidth }: {
|
|
3
|
-
children: any;
|
|
4
|
-
options: any;
|
|
5
|
-
move: any;
|
|
6
|
-
rowKey: any;
|
|
7
|
-
items: any;
|
|
8
|
-
tableWidth: any;
|
|
9
|
-
}) => JSX.Element>;
|
|
10
|
-
export default _default;
|