linkmore-design 1.1.25 → 1.1.27-alpha.0
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 +10 -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/index.d.ts +16 -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 +7 -0
- package/dist/LmEditTable/virtual/VirtualRow.d.ts +7 -0
- package/dist/LmEditTable/virtual/VirtualRowBack.d.ts +6 -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/index.d.ts +1 -2
- package/dist/index.umd.js +1173 -537
- package/dist/index.umd.min.js +8 -8
- package/dist/variables.css +65 -0
- package/es/Input/index.js +27 -2
- 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 +10 -5
- package/es/LmEditTable/EditTable.js +352 -360
- 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/index.d.ts +16 -0
- package/es/LmEditTable/components/index.js +7 -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 +81 -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 +65 -0
- package/es/LmEditTable/style/variables.css +65 -0
- package/es/LmEditTable/util.d.ts +7 -0
- package/es/LmEditTable/util.js +92 -7
- package/es/LmEditTable/virtual/VirtualRow.d.ts +7 -0
- package/es/LmEditTable/virtual/VirtualRow.js +62 -0
- package/es/LmEditTable/virtual/VirtualRowBack.d.ts +6 -0
- package/es/LmEditTable/virtual/VirtualRowBack.js +100 -0
- package/es/LmEditTable/virtual/VirtualTable.d.ts +3 -0
- package/es/LmEditTable/virtual/VirtualTable.js +54 -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 +54 -0
- package/es/LmEditTable/virtual/index.d.ts +4 -0
- package/es/LmEditTable/virtual/index.js +4 -0
- package/es/LmFilter/filterFns/index.js +7 -2
- package/es/LmTable/virTual/VirtualRow.js +12 -14
- package/es/LmUpload/LmUpload.js +4 -2
- package/es/hooks/useEvent/index.js +1 -1
- package/es/index.d.ts +1 -2
- package/es/styles/variables.css +65 -0
- package/lib/Input/index.js +29 -2
- 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 +10 -5
- package/lib/LmEditTable/EditTable.js +349 -357
- 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/index.d.ts +16 -0
- package/lib/LmEditTable/components/index.js +37 -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 +99 -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 +65 -0
- package/lib/LmEditTable/style/variables.css +65 -0
- package/lib/LmEditTable/util.d.ts +7 -0
- package/lib/LmEditTable/util.js +97 -6
- package/lib/LmEditTable/virtual/VirtualRow.d.ts +7 -0
- package/lib/LmEditTable/virtual/VirtualRow.js +78 -0
- package/lib/LmEditTable/virtual/VirtualRowBack.d.ts +6 -0
- package/lib/LmEditTable/virtual/VirtualRowBack.js +113 -0
- package/lib/LmEditTable/virtual/VirtualTable.d.ts +3 -0
- package/lib/LmEditTable/virtual/VirtualTable.js +71 -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 +64 -0
- package/lib/LmEditTable/virtual/index.d.ts +4 -0
- package/lib/LmEditTable/virtual/index.js +31 -0
- package/lib/LmFilter/filterFns/index.js +7 -2
- package/lib/LmTable/virTual/VirtualRow.js +12 -14
- package/lib/LmUpload/LmUpload.js +7 -2
- package/lib/hooks/useEvent/index.js +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/styles/variables.css +65 -0
- package/package.json +11 -9
|
@@ -0,0 +1,10 @@
|
|
|
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;
|
|
@@ -0,0 +1,39 @@
|
|
|
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 from 'react';
|
|
15
|
+
import DndContainer from '../rowSort/DndContainerRow';
|
|
16
|
+
import SortableBox from '../sortableBox';
|
|
17
|
+
import { VirtualWrapper } from '../virtual';
|
|
18
|
+
|
|
19
|
+
var DraggableContainer = function DraggableContainer(_a) {
|
|
20
|
+
var keys = _a.keys,
|
|
21
|
+
onSortEnd = _a.onSortEnd,
|
|
22
|
+
virtual = _a.virtual,
|
|
23
|
+
rowKey = _a.rowKey,
|
|
24
|
+
options = _a.options,
|
|
25
|
+
tableWidth = _a.tableWidth,
|
|
26
|
+
props = __rest(_a, ["keys", "onSortEnd", "virtual", "rowKey", "options", "tableWidth"]);
|
|
27
|
+
|
|
28
|
+
return /*#__PURE__*/React.createElement(DndContainer, {
|
|
29
|
+
move: onSortEnd,
|
|
30
|
+
items: keys,
|
|
31
|
+
rowKey: rowKey,
|
|
32
|
+
options: options,
|
|
33
|
+
tableWidth: tableWidth
|
|
34
|
+
}, /*#__PURE__*/React.createElement(SortableBox, {
|
|
35
|
+
items: keys
|
|
36
|
+
}, virtual ? /*#__PURE__*/React.createElement(VirtualWrapper, Object.assign({}, props)) : /*#__PURE__*/React.createElement("tbody", Object.assign({}, props))));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default DraggableContainer;
|
|
@@ -0,0 +1,12 @@
|
|
|
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;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Button from '../../Button';
|
|
3
|
+
import IconFont from '../../IconFont';
|
|
4
|
+
import Popover from '../../Popover';
|
|
5
|
+
import DisabledContext from '../../ConfigProvider/DisabledContext';
|
|
6
|
+
|
|
7
|
+
var QuickOpetate = function QuickOpetate(_ref) {
|
|
8
|
+
var record = _ref.record,
|
|
9
|
+
rowKey = _ref.rowKey,
|
|
10
|
+
handleAdd = _ref.handleAdd,
|
|
11
|
+
handleDelete = _ref.handleDelete,
|
|
12
|
+
_ref$options = _ref.options,
|
|
13
|
+
options = _ref$options === void 0 ? ['add', 'delete'] : _ref$options,
|
|
14
|
+
getLength = _ref.getLength,
|
|
15
|
+
quickOpetateClearAll = _ref.quickOpetateClearAll;
|
|
16
|
+
var disabled = React.useContext(DisabledContext) || false;
|
|
17
|
+
|
|
18
|
+
var appendChildren = function appendChildren() {
|
|
19
|
+
handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record, true);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var appendAdd = function appendAdd() {
|
|
23
|
+
handleAdd === null || handleAdd === void 0 ? void 0 : handleAdd(record);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
style: {
|
|
28
|
+
display: 'flex',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
justifyContent: 'flex-start',
|
|
31
|
+
marginLeft: '-4px'
|
|
32
|
+
}
|
|
33
|
+
}, options.includes('delete') && /*#__PURE__*/React.createElement(Button, {
|
|
34
|
+
type: "link",
|
|
35
|
+
size: "small",
|
|
36
|
+
disabled: !quickOpetateClearAll && getLength < 2 || disabled,
|
|
37
|
+
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
38
|
+
type: "lmweb-minus-circle",
|
|
39
|
+
style: {
|
|
40
|
+
fontSize: 16
|
|
41
|
+
}
|
|
42
|
+
}),
|
|
43
|
+
onClick: function onClick() {
|
|
44
|
+
return handleDelete(record[rowKey]);
|
|
45
|
+
}
|
|
46
|
+
}), (options === null || options === void 0 ? void 0 : options.includes('add')) && (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? /*#__PURE__*/React.createElement(Popover, {
|
|
47
|
+
placement: "bottom",
|
|
48
|
+
overlayClassName: "lm_table_append_add_popover",
|
|
49
|
+
open: open,
|
|
50
|
+
title: null,
|
|
51
|
+
content: /*#__PURE__*/React.createElement("ul", null, /*#__PURE__*/React.createElement("li", {
|
|
52
|
+
onClick: appendAdd
|
|
53
|
+
}, "\u6DFB\u52A0\u5E73\u7EA7"), /*#__PURE__*/React.createElement("li", {
|
|
54
|
+
onClick: appendChildren
|
|
55
|
+
}, "\u6DFB\u52A0\u5B50\u7EA7")),
|
|
56
|
+
trigger: "hover"
|
|
57
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
58
|
+
type: "link",
|
|
59
|
+
size: "small",
|
|
60
|
+
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
61
|
+
type: "lmweb-plus-circle-fill",
|
|
62
|
+
style: {
|
|
63
|
+
fontSize: 16
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
})) : (options === null || options === void 0 ? void 0 : options.includes('add')) || (options === null || options === void 0 ? void 0 : options.includes('addInChildren')) ? /*#__PURE__*/React.createElement(Button, {
|
|
67
|
+
type: "link",
|
|
68
|
+
size: "small",
|
|
69
|
+
disabled: disabled,
|
|
70
|
+
icon: /*#__PURE__*/React.createElement(IconFont, {
|
|
71
|
+
type: "lmweb-plus-circle-fill",
|
|
72
|
+
style: {
|
|
73
|
+
fontSize: 16
|
|
74
|
+
}
|
|
75
|
+
}),
|
|
76
|
+
onClick: function onClick() {
|
|
77
|
+
return handleAdd(record, !!(options === null || options === void 0 ? void 0 : options.includes('addInChildren')));
|
|
78
|
+
}
|
|
79
|
+
}) : null);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export default QuickOpetate;
|
|
@@ -0,0 +1,13 @@
|
|
|
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;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Button, IconFont } from '../../index';
|
|
3
|
+
|
|
4
|
+
var BottomOpetateComponent = function BottomOpetateComponent(props) {
|
|
5
|
+
var isShowAddAction = props.isShowAddAction,
|
|
6
|
+
recordCreatorProps = props.recordCreatorProps,
|
|
7
|
+
handleAdd = props.handleAdd,
|
|
8
|
+
_props$disabled = props.disabled,
|
|
9
|
+
disabled = _props$disabled === void 0 ? false : _props$disabled;
|
|
10
|
+
return isShowAddAction ? /*#__PURE__*/React.createElement(Button, {
|
|
11
|
+
className: "lm_editTable_add_bar",
|
|
12
|
+
type: "dashed",
|
|
13
|
+
disabled: disabled,
|
|
14
|
+
onClick: (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.customAddClick) || handleAdd,
|
|
15
|
+
style: Object.assign({
|
|
16
|
+
marginTop: 8
|
|
17
|
+
}, (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.style) || {})
|
|
18
|
+
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
19
|
+
type: "lmweb-plus"
|
|
20
|
+
}), (recordCreatorProps === null || recordCreatorProps === void 0 ? void 0 : recordCreatorProps.creatorButtonText) || '新增') : null;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default BottomOpetateComponent;
|
|
@@ -0,0 +1,16 @@
|
|
|
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;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import DraggableContainer from './DraggableContainer';
|
|
2
|
+
import BottomOpetateComponent from './bottomOpetateComponent';
|
|
3
|
+
import QuickOpetate from './QuickOpetate';
|
|
4
|
+
export { DraggableContainer, BottomOpetateComponent, QuickOpetate };
|
|
5
|
+
export default {
|
|
6
|
+
DraggableContainer: DraggableContainer
|
|
7
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
function setRef(ref, value) {
|
|
4
|
+
if (typeof ref === 'function') {
|
|
5
|
+
ref(value);
|
|
6
|
+
} else if (ref) {
|
|
7
|
+
ref.current = value;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function useForkRef(refA, refB) {
|
|
12
|
+
return useMemo(function () {
|
|
13
|
+
if (refA == null && refB == null) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return function (refValue) {
|
|
18
|
+
setRef(refA, refValue);
|
|
19
|
+
setRef(refB, refValue);
|
|
20
|
+
};
|
|
21
|
+
}, [refA, refB]);
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
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;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { memo } from 'react';
|
|
3
|
+
import { DndContext, closestCenter, KeyboardSensor, PointerSensor, useSensor, useSensors } from '@dnd-kit/core';
|
|
4
|
+
import { restrictToParentElement, restrictToVerticalAxis } from '@dnd-kit/modifiers';
|
|
5
|
+
import { sortableKeyboardCoordinates } from '@dnd-kit/sortable'; // 可拖拽容器
|
|
6
|
+
|
|
7
|
+
var DndContainer = function DndContainer(_ref) {
|
|
8
|
+
var children = _ref.children,
|
|
9
|
+
options = _ref.options,
|
|
10
|
+
move = _ref.move,
|
|
11
|
+
rowKey = _ref.rowKey,
|
|
12
|
+
items = _ref.items,
|
|
13
|
+
tableWidth = _ref.tableWidth;
|
|
14
|
+
|
|
15
|
+
var _React$useState = React.useState(false),
|
|
16
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
17
|
+
isDragging = _React$useState2[0],
|
|
18
|
+
setIsDragging = _React$useState2[1]; // 是否拖拽中
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _React$useState3 = React.useState(null),
|
|
22
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
23
|
+
activeId = _React$useState4[0],
|
|
24
|
+
setActiveId = _React$useState4[1]; // 是否拖拽中
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
var sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, {
|
|
28
|
+
coordinateGetter: sortableKeyboardCoordinates
|
|
29
|
+
})); // 开始拖拽
|
|
30
|
+
|
|
31
|
+
var handleDragStart = function handleDragStart(_ref2) {
|
|
32
|
+
var active = _ref2.active;
|
|
33
|
+
setIsDragging(true);
|
|
34
|
+
|
|
35
|
+
if (!active) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
setActiveId(active.id);
|
|
40
|
+
}; // 拖拽结束
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
var handleDragEnd = function handleDragEnd(event) {
|
|
44
|
+
var active = event.active,
|
|
45
|
+
over = event.over;
|
|
46
|
+
setActiveId(null); // 未移入时触发
|
|
47
|
+
|
|
48
|
+
if (!(over === null || over === void 0 ? void 0 : over.id)) {
|
|
49
|
+
return;
|
|
50
|
+
} // 移入时触发更新数据
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
if (active.id !== over.id) {
|
|
54
|
+
move(active.id, over.id);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
var instance = {
|
|
59
|
+
isDragging: isDragging,
|
|
60
|
+
activeId: activeId,
|
|
61
|
+
options: options,
|
|
62
|
+
rowKey: rowKey,
|
|
63
|
+
children: children,
|
|
64
|
+
move: move,
|
|
65
|
+
items: items,
|
|
66
|
+
tableWidth: tableWidth
|
|
67
|
+
};
|
|
68
|
+
console.log('instance', instance);
|
|
69
|
+
return /*#__PURE__*/React.createElement(DndContext, {
|
|
70
|
+
sensors: sensors,
|
|
71
|
+
onDragStart: handleDragStart,
|
|
72
|
+
onDragCancel: function onDragCancel() {
|
|
73
|
+
return setActiveId(null);
|
|
74
|
+
},
|
|
75
|
+
collisionDetection: closestCenter,
|
|
76
|
+
onDragEnd: handleDragEnd,
|
|
77
|
+
modifiers: [restrictToParentElement, restrictToVerticalAxis]
|
|
78
|
+
}, children);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export default /*#__PURE__*/memo(DndContainer);
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const _default: React.MemoExoticComponent<(props: any) => JSX.Element>;
|
|
3
|
+
export default _default;
|
|
@@ -11,15 +11,17 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
import React from 'react';
|
|
14
|
+
import React, { memo } from 'react';
|
|
15
15
|
import { useSortable } from '@dnd-kit/sortable';
|
|
16
16
|
import { CSS } from '@dnd-kit/utilities';
|
|
17
|
+
import { VirtualRow } from './virtual';
|
|
17
18
|
|
|
18
19
|
var SortableItem = function SortableItem(props) {
|
|
19
20
|
var key = props['data-row-key'],
|
|
20
21
|
children = props.children,
|
|
21
22
|
className = props.className,
|
|
22
|
-
|
|
23
|
+
virtual = props.virtual,
|
|
24
|
+
resetField = __rest(props, ['data-row-key', "children", "className", "virtual"]);
|
|
23
25
|
|
|
24
26
|
var _useSortable = useSortable({
|
|
25
27
|
id: key
|
|
@@ -33,11 +35,21 @@ var SortableItem = function SortableItem(props) {
|
|
|
33
35
|
transform: CSS.Transform.toString(transform),
|
|
34
36
|
transition: transition
|
|
35
37
|
};
|
|
36
|
-
|
|
38
|
+
|
|
39
|
+
if (!virtual) {
|
|
40
|
+
return /*#__PURE__*/React.createElement("tr", Object.assign({}, resetField, {
|
|
41
|
+
ref: setNodeRef,
|
|
42
|
+
key: key,
|
|
43
|
+
style: style
|
|
44
|
+
}, attributes), children);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return /*#__PURE__*/React.createElement(VirtualRow, Object.assign({}, resetField, {
|
|
37
48
|
ref: setNodeRef,
|
|
49
|
+
pref: setNodeRef,
|
|
38
50
|
key: key,
|
|
39
51
|
style: style
|
|
40
52
|
}, attributes), children);
|
|
41
53
|
};
|
|
42
54
|
|
|
43
|
-
export default SortableItem;
|
|
55
|
+
export default /*#__PURE__*/memo(SortableItem);
|
|
@@ -12,21 +12,49 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
import React, { forwardRef } from 'react';
|
|
15
|
-
import { useSortable } from '@dnd-kit/sortable';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
import { useSortable } from '@dnd-kit/sortable'; // import { omit } from 'lodash'
|
|
16
|
+
|
|
17
|
+
import { CSS } from '@dnd-kit/utilities'; // interface ItemType {
|
|
18
|
+
// children: React.ReactNode
|
|
19
|
+
// }
|
|
20
|
+
// interface ItemInstance {}
|
|
21
|
+
// @ts-ignore
|
|
19
22
|
|
|
23
|
+
var Item = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
20
24
|
var children = _a.children,
|
|
21
|
-
props = __rest(_a, ["children"]);
|
|
25
|
+
props = __rest(_a, ["children"]); // const rProps = omit({ ...props, ...children.props }, [
|
|
26
|
+
// 'isSticky',
|
|
27
|
+
// 'colStart',
|
|
28
|
+
// 'colEnd',
|
|
29
|
+
// 'prefixCls',
|
|
30
|
+
// 'fixLeft',
|
|
31
|
+
// 'fixRight',
|
|
32
|
+
// 'lastFixLeft',
|
|
33
|
+
// 'firstFixRight',
|
|
34
|
+
// 'lastFixRight',
|
|
35
|
+
// 'firstFixLeft',
|
|
36
|
+
// 'isSticky',
|
|
37
|
+
// 'additionalProps',
|
|
38
|
+
// 'rowType',
|
|
39
|
+
// ])
|
|
22
40
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
/*#__PURE__*/
|
|
44
|
+
// <th {...rProps} ref={ref as any} />
|
|
45
|
+
React.createElement("th", Object.assign({}, props, children.props, {
|
|
46
|
+
ref: ref
|
|
47
|
+
})) // <th {...props} ref={ref as any}>
|
|
48
|
+
// {(children as any)?.props?.children || children}
|
|
49
|
+
// </th>
|
|
50
|
+
|
|
51
|
+
);
|
|
26
52
|
});
|
|
27
53
|
export default function SortableItem(props) {
|
|
54
|
+
var id = props.id;
|
|
55
|
+
|
|
28
56
|
var _useSortable = useSortable({
|
|
29
|
-
id:
|
|
57
|
+
id: id
|
|
30
58
|
}),
|
|
31
59
|
attributes = _useSortable.attributes,
|
|
32
60
|
listeners = _useSortable.listeners,
|
|
@@ -36,7 +64,9 @@ export default function SortableItem(props) {
|
|
|
36
64
|
|
|
37
65
|
var style = {
|
|
38
66
|
position: 'relative',
|
|
39
|
-
transform: CSS.Translate.toString(transform),
|
|
67
|
+
transform: CSS.Translate.toString(transform ? Object.assign(Object.assign({}, transform), {
|
|
68
|
+
y: 0
|
|
69
|
+
}) : transform),
|
|
40
70
|
transition: transition,
|
|
41
71
|
touchAction: 'none',
|
|
42
72
|
height: '40px',
|
|
@@ -538,6 +538,9 @@ p {
|
|
|
538
538
|
width: 32px;
|
|
539
539
|
padding: 0 8px;
|
|
540
540
|
}
|
|
541
|
+
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
542
|
+
height: 100%;
|
|
543
|
+
}
|
|
541
544
|
.lm_editTable_warpper .lm_editTable_cell {
|
|
542
545
|
cursor: pointer;
|
|
543
546
|
height: 40px;
|
|
@@ -549,6 +552,21 @@ p {
|
|
|
549
552
|
letter-spacing: 0px;
|
|
550
553
|
color: var(--color-85);
|
|
551
554
|
}
|
|
555
|
+
.lm_editTable_warpper .lm_custom_cell_td {
|
|
556
|
+
position: relative;
|
|
557
|
+
}
|
|
558
|
+
.lm_editTable_warpper .lm_custom_cell_td.ant-table-cell-with-append {
|
|
559
|
+
display: flex;
|
|
560
|
+
flex-direction: row;
|
|
561
|
+
flex-wrap: nowrap;
|
|
562
|
+
}
|
|
563
|
+
.lm_editTable_warpper .lm_custom_cell_td.ant-table-cell-with-append .ant-table-row-expand-icon {
|
|
564
|
+
margin-right: 8px;
|
|
565
|
+
flex: none;
|
|
566
|
+
}
|
|
567
|
+
.lm_editTable_warpper .lm_custom_cell_td > .ant-form-item {
|
|
568
|
+
flex: 1 1 auto;
|
|
569
|
+
}
|
|
552
570
|
.lm_editTable_warpper .lm_custom_cell_td .ant-form-item-control-input-content {
|
|
553
571
|
display: flex;
|
|
554
572
|
flex-direction: row;
|
|
@@ -560,6 +578,32 @@ p {
|
|
|
560
578
|
.lm_editTable_warpper .lm_custom_cell_td .ant-table-row-expand-icon {
|
|
561
579
|
margin-top: 6px;
|
|
562
580
|
}
|
|
581
|
+
.lm_editTable_warpper .lm_custom_cell_td .quick_copy_warp {
|
|
582
|
+
font-size: 8px;
|
|
583
|
+
position: absolute;
|
|
584
|
+
left: calc(50% - 10px);
|
|
585
|
+
z-index: 100;
|
|
586
|
+
width: 20px;
|
|
587
|
+
height: 10px;
|
|
588
|
+
background-color: var(--color-6);
|
|
589
|
+
display: flex;
|
|
590
|
+
align-items: center;
|
|
591
|
+
justify-content: center;
|
|
592
|
+
color: #D8D8D8;
|
|
593
|
+
}
|
|
594
|
+
.lm_editTable_warpper .lm_custom_cell_td .quick_copy_warp:hover {
|
|
595
|
+
cursor: pointer;
|
|
596
|
+
background-color: var(--primary-color);
|
|
597
|
+
color: #fff;
|
|
598
|
+
}
|
|
599
|
+
.lm_editTable_warpper .lm_custom_cell_td .quick_copy_up {
|
|
600
|
+
top: -4px;
|
|
601
|
+
left: calc(50% - 10px);
|
|
602
|
+
}
|
|
603
|
+
.lm_editTable_warpper .lm_custom_cell_td .quick_copy_down {
|
|
604
|
+
bottom: -6px;
|
|
605
|
+
left: calc(50% - 10px);
|
|
606
|
+
}
|
|
563
607
|
.lm_editTable_warpper .lm_editTable_cell_edit {
|
|
564
608
|
height: 40px;
|
|
565
609
|
padding: 8px 8px !important;
|
|
@@ -571,6 +615,9 @@ p {
|
|
|
571
615
|
.lm_editTable_warpper .lm_table_quickcopy .anticon {
|
|
572
616
|
color: var(--text-color);
|
|
573
617
|
}
|
|
618
|
+
.lm_editTable_warpper .ant-table-body {
|
|
619
|
+
scroll-behavior: smooth;
|
|
620
|
+
}
|
|
574
621
|
.lm_editTable_warpper .icon_drag {
|
|
575
622
|
color: var(--tip-text-color);
|
|
576
623
|
}
|
|
@@ -587,6 +634,9 @@ p {
|
|
|
587
634
|
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
588
635
|
background-color: rgba(0, 0, 0, 0.06) !important;
|
|
589
636
|
}
|
|
637
|
+
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
638
|
+
background-color: rgba(0, 0, 0, 0.06) !important;
|
|
639
|
+
}
|
|
590
640
|
.lm_editTable_warpper .ant-picker {
|
|
591
641
|
height: 24px !important;
|
|
592
642
|
padding: 2px 8px;
|
|
@@ -630,3 +680,18 @@ p {
|
|
|
630
680
|
.lm_table_append_add_popover .ant-popover-inner-content ul li:hover {
|
|
631
681
|
background-color: var(--color-15);
|
|
632
682
|
}
|
|
683
|
+
.lm_edittable_col_sort_item {
|
|
684
|
+
overflow: hidden;
|
|
685
|
+
}
|
|
686
|
+
.lm_editable_col_drag {
|
|
687
|
+
background-color: #fff;
|
|
688
|
+
font-size: 12px;
|
|
689
|
+
display: flex;
|
|
690
|
+
box-sizing: border-box;
|
|
691
|
+
transform: translate3d(var(--translate-x, 0), var(--translate-y, 0), 0) scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1));
|
|
692
|
+
transform-origin: 0 0;
|
|
693
|
+
touch-action: manipulation;
|
|
694
|
+
scale: 1.05;
|
|
695
|
+
box-shadow: 0 0 0 calc(1px / var(--scale-x, 1)) rgba(63, 63, 68, 0.05), 0 1px calc(3px / var(--scale-x, 1)) 0 rgba(34, 33, 81, 0.15);
|
|
696
|
+
padding: 8px;
|
|
697
|
+
}
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
width: 32px;
|
|
27
27
|
padding: 0 8px;
|
|
28
28
|
}
|
|
29
|
+
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
30
|
+
height: 100%;
|
|
31
|
+
}
|
|
29
32
|
.lm_editTable_warpper .lm_editTable_cell {
|
|
30
33
|
cursor: pointer;
|
|
31
34
|
height: 40px;
|
|
@@ -37,6 +40,21 @@
|
|
|
37
40
|
letter-spacing: 0px;
|
|
38
41
|
color: var(--color-85);
|
|
39
42
|
}
|
|
43
|
+
.lm_editTable_warpper .lm_custom_cell_td {
|
|
44
|
+
position: relative;
|
|
45
|
+
}
|
|
46
|
+
.lm_editTable_warpper .lm_custom_cell_td.ant-table-cell-with-append {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: row;
|
|
49
|
+
flex-wrap: nowrap;
|
|
50
|
+
}
|
|
51
|
+
.lm_editTable_warpper .lm_custom_cell_td.ant-table-cell-with-append .ant-table-row-expand-icon {
|
|
52
|
+
margin-right: 8px;
|
|
53
|
+
flex: none;
|
|
54
|
+
}
|
|
55
|
+
.lm_editTable_warpper .lm_custom_cell_td > .ant-form-item {
|
|
56
|
+
flex: 1 1 auto;
|
|
57
|
+
}
|
|
40
58
|
.lm_editTable_warpper .lm_custom_cell_td .ant-form-item-control-input-content {
|
|
41
59
|
display: flex;
|
|
42
60
|
flex-direction: row;
|
|
@@ -48,6 +66,32 @@
|
|
|
48
66
|
.lm_editTable_warpper .lm_custom_cell_td .ant-table-row-expand-icon {
|
|
49
67
|
margin-top: 6px;
|
|
50
68
|
}
|
|
69
|
+
.lm_editTable_warpper .lm_custom_cell_td .quick_copy_warp {
|
|
70
|
+
font-size: 8px;
|
|
71
|
+
position: absolute;
|
|
72
|
+
left: calc(50% - 10px);
|
|
73
|
+
z-index: 100;
|
|
74
|
+
width: 20px;
|
|
75
|
+
height: 10px;
|
|
76
|
+
background-color: var(--color-6);
|
|
77
|
+
display: flex;
|
|
78
|
+
align-items: center;
|
|
79
|
+
justify-content: center;
|
|
80
|
+
color: #D8D8D8;
|
|
81
|
+
}
|
|
82
|
+
.lm_editTable_warpper .lm_custom_cell_td .quick_copy_warp:hover {
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
background-color: var(--primary-color);
|
|
85
|
+
color: #fff;
|
|
86
|
+
}
|
|
87
|
+
.lm_editTable_warpper .lm_custom_cell_td .quick_copy_up {
|
|
88
|
+
top: -4px;
|
|
89
|
+
left: calc(50% - 10px);
|
|
90
|
+
}
|
|
91
|
+
.lm_editTable_warpper .lm_custom_cell_td .quick_copy_down {
|
|
92
|
+
bottom: -6px;
|
|
93
|
+
left: calc(50% - 10px);
|
|
94
|
+
}
|
|
51
95
|
.lm_editTable_warpper .lm_editTable_cell_edit {
|
|
52
96
|
height: 40px;
|
|
53
97
|
padding: 8px 8px !important;
|
|
@@ -59,6 +103,9 @@
|
|
|
59
103
|
.lm_editTable_warpper .lm_table_quickcopy .anticon {
|
|
60
104
|
color: var(--text-color);
|
|
61
105
|
}
|
|
106
|
+
.lm_editTable_warpper .ant-table-body {
|
|
107
|
+
scroll-behavior: smooth;
|
|
108
|
+
}
|
|
62
109
|
.lm_editTable_warpper .icon_drag {
|
|
63
110
|
color: var(--tip-text-color);
|
|
64
111
|
}
|
|
@@ -75,6 +122,9 @@
|
|
|
75
122
|
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
76
123
|
background-color: rgba(0, 0, 0, 0.06) !important;
|
|
77
124
|
}
|
|
125
|
+
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
126
|
+
background-color: rgba(0, 0, 0, 0.06) !important;
|
|
127
|
+
}
|
|
78
128
|
.lm_editTable_warpper .ant-picker {
|
|
79
129
|
height: 24px !important;
|
|
80
130
|
padding: 2px 8px;
|
|
@@ -118,3 +168,18 @@
|
|
|
118
168
|
.lm_table_append_add_popover .ant-popover-inner-content ul li:hover {
|
|
119
169
|
background-color: var(--color-15);
|
|
120
170
|
}
|
|
171
|
+
.lm_edittable_col_sort_item {
|
|
172
|
+
overflow: hidden;
|
|
173
|
+
}
|
|
174
|
+
.lm_editable_col_drag {
|
|
175
|
+
background-color: #fff;
|
|
176
|
+
font-size: 12px;
|
|
177
|
+
display: flex;
|
|
178
|
+
box-sizing: border-box;
|
|
179
|
+
transform: translate3d(var(--translate-x, 0), var(--translate-y, 0), 0) scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1));
|
|
180
|
+
transform-origin: 0 0;
|
|
181
|
+
touch-action: manipulation;
|
|
182
|
+
scale: 1.05;
|
|
183
|
+
box-shadow: 0 0 0 calc(1px / var(--scale-x, 1)) rgba(63, 63, 68, 0.05), 0 1px calc(3px / var(--scale-x, 1)) 0 rgba(34, 33, 81, 0.15);
|
|
184
|
+
padding: 8px;
|
|
185
|
+
}
|
package/es/LmEditTable/util.d.ts
CHANGED
|
@@ -2,6 +2,13 @@ export declare function isObjEmpty(obj: Record<string, any>): boolean;
|
|
|
2
2
|
export declare function deepDataSourcePreKeys(dataSource: any[], rowKey: string): any;
|
|
3
3
|
export declare function isExpandRow(children: any): boolean;
|
|
4
4
|
export declare function checkRowKeyByDataSource(dataSource: any, rowKey: any): any;
|
|
5
|
+
export declare function getExpandStatus(children: any): any;
|
|
6
|
+
export declare function checkMemoShouldUploadSpecialFun(prev: any, next: any): any;
|
|
7
|
+
export declare function checkExpandIconColumnIndex({ rowSelection, sortOpen, indexCol }: {
|
|
8
|
+
rowSelection: any;
|
|
9
|
+
sortOpen: any;
|
|
10
|
+
indexCol: any;
|
|
11
|
+
}): number;
|
|
5
12
|
declare const _default: {
|
|
6
13
|
isObjEmpty: typeof isObjEmpty;
|
|
7
14
|
};
|