linkmore-design 1.1.19 → 1.1.21
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/Descriptions/Cell.d.ts +1 -0
- package/dist/Descriptions/Item.d.ts +1 -0
- package/dist/LmDrag/LmDrag.d.ts +5 -0
- package/dist/LmDrag/components/DndContainer.d.ts +3 -0
- package/dist/LmDrag/components/sortableBox.d.ts +5 -0
- package/dist/LmDrag/components/sortableItem.d.ts +7 -0
- package/dist/LmDrag/demos/basic.d.ts +2 -0
- package/dist/LmDrag/index.d.ts +10 -0
- package/dist/LmDrag/style/index.d.ts +1 -0
- package/dist/LmDrag/style/variables.d.ts +1 -0
- package/dist/LmDrag/wrapper/Root.d.ts +3 -0
- package/dist/LmUpload/UploadList/ItemPictureCard.d.ts +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.umd.js +524 -9
- package/dist/index.umd.min.js +8 -8
- package/es/Descriptions/Cell.d.ts +1 -0
- package/es/Descriptions/Cell.js +5 -2
- package/es/Descriptions/Item.d.ts +1 -0
- package/es/Descriptions/Row.js +6 -1
- package/es/LmDrag/LmDrag.d.ts +5 -0
- package/es/LmDrag/LmDrag.js +30 -0
- package/es/LmDrag/components/DndContainer.d.ts +3 -0
- package/es/LmDrag/components/DndContainer.js +121 -0
- package/es/LmDrag/components/sortableBox.d.ts +5 -0
- package/es/LmDrag/components/sortableBox.js +23 -0
- package/es/LmDrag/components/sortableItem.d.ts +7 -0
- package/es/LmDrag/components/sortableItem.js +41 -0
- package/es/LmDrag/index.d.ts +10 -0
- package/es/LmDrag/index.js +3 -0
- package/es/LmDrag/style/index.css +0 -0
- package/es/LmDrag/style/index.d.ts +1 -0
- package/es/LmDrag/style/index.js +1 -0
- package/es/LmDrag/style/variables.css +0 -0
- package/es/LmDrag/style/variables.d.ts +1 -0
- package/es/LmDrag/style/variables.js +1 -0
- package/es/LmDrag/wrapper/Root.d.ts +3 -0
- package/es/LmDrag/wrapper/Root.js +12 -0
- package/es/LmUpload/LmUpload.js +2 -1
- package/es/LmUpload/UploadList/ItemPictureCard.d.ts +2 -1
- package/es/LmUpload/UploadList/ItemPictureCard.js +9 -1
- package/es/LmUpload/UploadList/index.js +55 -2
- package/es/LmUpload/fns/index.js +2 -1
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/lib/Descriptions/Cell.d.ts +1 -0
- package/lib/Descriptions/Cell.js +5 -2
- package/lib/Descriptions/Item.d.ts +1 -0
- package/lib/Descriptions/Row.js +6 -1
- package/lib/LmDrag/LmDrag.d.ts +5 -0
- package/lib/LmDrag/LmDrag.js +44 -0
- package/lib/LmDrag/components/DndContainer.d.ts +3 -0
- package/lib/LmDrag/components/DndContainer.js +138 -0
- package/lib/LmDrag/components/sortableBox.d.ts +5 -0
- package/lib/LmDrag/components/sortableBox.js +37 -0
- package/lib/LmDrag/components/sortableItem.d.ts +7 -0
- package/lib/LmDrag/components/sortableItem.js +54 -0
- package/lib/LmDrag/index.d.ts +10 -0
- package/lib/LmDrag/index.js +19 -0
- package/lib/LmDrag/style/index.css +0 -0
- package/lib/LmDrag/style/index.d.ts +1 -0
- package/lib/LmDrag/style/index.js +3 -0
- package/lib/LmDrag/style/variables.css +0 -0
- package/lib/LmDrag/style/variables.d.ts +1 -0
- package/lib/LmDrag/style/variables.js +3 -0
- package/lib/LmDrag/wrapper/Root.d.ts +3 -0
- package/lib/LmDrag/wrapper/Root.js +26 -0
- package/lib/LmUpload/LmUpload.js +2 -1
- package/lib/LmUpload/UploadList/ItemPictureCard.d.ts +2 -1
- package/lib/LmUpload/UploadList/ItemPictureCard.js +9 -1
- package/lib/LmUpload/UploadList/index.js +56 -2
- package/lib/LmUpload/fns/index.js +2 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +15 -1
- package/package.json +1 -1
package/es/Descriptions/Cell.js
CHANGED
|
@@ -10,6 +10,7 @@ var Cell = function Cell(_ref) {
|
|
|
10
10
|
var itemPrefixCls = _ref.itemPrefixCls,
|
|
11
11
|
component = _ref.component,
|
|
12
12
|
span = _ref.span,
|
|
13
|
+
rowSpan = _ref.rowSpan,
|
|
13
14
|
className = _ref.className,
|
|
14
15
|
style = _ref.style,
|
|
15
16
|
labelStyle = _ref.labelStyle,
|
|
@@ -26,7 +27,8 @@ var Cell = function Cell(_ref) {
|
|
|
26
27
|
return /*#__PURE__*/React.createElement(Component, {
|
|
27
28
|
className: classNames((_classNames = {}, _defineProperty(_classNames, "".concat(itemPrefixCls, "-item-label"), notEmpty(label)), _defineProperty(_classNames, "".concat(itemPrefixCls, "-item-content"), notEmpty(content)), _classNames), className),
|
|
28
29
|
style: style,
|
|
29
|
-
colSpan: span
|
|
30
|
+
colSpan: span,
|
|
31
|
+
rowSpan: rowSpan
|
|
30
32
|
}, notEmpty(label) && /*#__PURE__*/React.createElement("span", {
|
|
31
33
|
style: labelStyle
|
|
32
34
|
}, label), notEmpty(content) && /*#__PURE__*/React.createElement("span", {
|
|
@@ -37,7 +39,8 @@ var Cell = function Cell(_ref) {
|
|
|
37
39
|
return /*#__PURE__*/React.createElement(Component, {
|
|
38
40
|
className: classNames("".concat(itemPrefixCls, "-item"), className),
|
|
39
41
|
style: style,
|
|
40
|
-
colSpan: span
|
|
42
|
+
colSpan: span,
|
|
43
|
+
rowSpan: rowSpan
|
|
41
44
|
}, /*#__PURE__*/React.createElement("div", {
|
|
42
45
|
className: "".concat(itemPrefixCls, "-item-container")
|
|
43
46
|
}, (label || label === 0) && /*#__PURE__*/React.createElement("span", {
|
package/es/Descriptions/Row.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { DescriptionsContext } from
|
|
2
|
+
import { DescriptionsContext } from ".";
|
|
3
3
|
import Cell from './Cell';
|
|
4
4
|
|
|
5
5
|
function renderCells(items, _ref, _ref2) {
|
|
@@ -24,6 +24,8 @@ function renderCells(items, _ref, _ref2) {
|
|
|
24
24
|
contentStyle = _ref3$props.contentStyle,
|
|
25
25
|
_ref3$props$span = _ref3$props.span,
|
|
26
26
|
span = _ref3$props$span === void 0 ? 1 : _ref3$props$span,
|
|
27
|
+
_ref3$props$rowSpan = _ref3$props.rowSpan,
|
|
28
|
+
rowSpan = _ref3$props$rowSpan === void 0 ? 1 : _ref3$props$rowSpan,
|
|
27
29
|
key = _ref3.key;
|
|
28
30
|
|
|
29
31
|
if (typeof component === 'string') {
|
|
@@ -34,6 +36,7 @@ function renderCells(items, _ref, _ref2) {
|
|
|
34
36
|
labelStyle: Object.assign(Object.assign({}, rootLabelStyle), labelStyle),
|
|
35
37
|
contentStyle: Object.assign(Object.assign({}, rootContentStyle), contentStyle),
|
|
36
38
|
span: span,
|
|
39
|
+
rowSpan: rowSpan,
|
|
37
40
|
colon: colon,
|
|
38
41
|
component: component,
|
|
39
42
|
itemPrefixCls: itemPrefixCls,
|
|
@@ -48,6 +51,7 @@ function renderCells(items, _ref, _ref2) {
|
|
|
48
51
|
className: className,
|
|
49
52
|
style: Object.assign(Object.assign(Object.assign({}, rootLabelStyle), style), labelStyle),
|
|
50
53
|
span: 1,
|
|
54
|
+
rowSpan: rowSpan,
|
|
51
55
|
colon: colon,
|
|
52
56
|
component: component[0],
|
|
53
57
|
itemPrefixCls: itemPrefixCls,
|
|
@@ -58,6 +62,7 @@ function renderCells(items, _ref, _ref2) {
|
|
|
58
62
|
className: className,
|
|
59
63
|
style: Object.assign(Object.assign(Object.assign({}, rootContentStyle), style), contentStyle),
|
|
60
64
|
span: span * 2 - 1,
|
|
65
|
+
rowSpan: rowSpan,
|
|
61
66
|
component: component[1],
|
|
62
67
|
itemPrefixCls: itemPrefixCls,
|
|
63
68
|
bordered: bordered,
|
|
@@ -0,0 +1,30 @@
|
|
|
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, forwardRef } from 'react';
|
|
15
|
+
import Root from './wrapper/Root';
|
|
16
|
+
|
|
17
|
+
var LmDrag = function LmDrag(_a, ref) {
|
|
18
|
+
var resetProps = __rest(_a, []);
|
|
19
|
+
|
|
20
|
+
var defaultRef = useRef(null);
|
|
21
|
+
var defaultProps = Object.assign({
|
|
22
|
+
options: [],
|
|
23
|
+
rowKey: 'id'
|
|
24
|
+
}, resetProps);
|
|
25
|
+
return /*#__PURE__*/React.createElement(Root, Object.assign({
|
|
26
|
+
ref: ref || defaultRef
|
|
27
|
+
}, defaultProps));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default /*#__PURE__*/forwardRef(LmDrag);
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { DragOverlay, DndContext, closestCenter, KeyboardSensor, PointerSensor, useSensor, useSensors } from '@dnd-kit/core';
|
|
4
|
+
import { restrictToParentElement } from '@dnd-kit/modifiers';
|
|
5
|
+
import { sortableKeyboardCoordinates } from '@dnd-kit/sortable';
|
|
6
|
+
import SortableBox from './sortableBox';
|
|
7
|
+
var DragOver = /*#__PURE__*/React.memo(function (_ref) {
|
|
8
|
+
var instance = _ref.instance;
|
|
9
|
+
var isDragging = instance.isDragging,
|
|
10
|
+
activeId = instance.activeId,
|
|
11
|
+
rowKey = instance.rowKey,
|
|
12
|
+
children = instance.children,
|
|
13
|
+
options = instance.options;
|
|
14
|
+
var item = activeId && options.find(function (v) {
|
|
15
|
+
return v[rowKey] === activeId;
|
|
16
|
+
});
|
|
17
|
+
return /*#__PURE__*/React.createElement(DragOverlay, {
|
|
18
|
+
adjustScale: false
|
|
19
|
+
}, isDragging ? children({
|
|
20
|
+
item: item,
|
|
21
|
+
listeners: {}
|
|
22
|
+
}) : null);
|
|
23
|
+
});
|
|
24
|
+
/*
|
|
25
|
+
* restrictToParentElement 拖拽限制在父元素内
|
|
26
|
+
*/
|
|
27
|
+
// 可拖拽容器
|
|
28
|
+
|
|
29
|
+
var DndContainer = function DndContainer(_ref2) {
|
|
30
|
+
var options = _ref2.options,
|
|
31
|
+
rowKey = _ref2.rowKey,
|
|
32
|
+
children = _ref2.children,
|
|
33
|
+
move = _ref2.move;
|
|
34
|
+
|
|
35
|
+
var _React$useState = React.useState(false),
|
|
36
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
37
|
+
isDragging = _React$useState2[0],
|
|
38
|
+
setIsDragging = _React$useState2[1]; // 是否拖拽中
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
var _React$useState3 = React.useState(null),
|
|
42
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
43
|
+
activeId = _React$useState4[0],
|
|
44
|
+
setActiveId = _React$useState4[1]; // 是否拖拽中
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
var sensors = useSensors(useSensor(PointerSensor), useSensor(KeyboardSensor, {
|
|
48
|
+
coordinateGetter: sortableKeyboardCoordinates
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
var handleMove = function handleMove(activeItem, overItem) {
|
|
52
|
+
var fileMap = options.map(function (v) {
|
|
53
|
+
if (v[rowKey] === activeItem[rowKey]) {
|
|
54
|
+
return Object.assign({}, overItem);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (v[rowKey] === overItem[rowKey]) {
|
|
58
|
+
return Object.assign({}, activeItem);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return v;
|
|
62
|
+
});
|
|
63
|
+
move === null || move === void 0 ? void 0 : move(activeItem, overItem, fileMap);
|
|
64
|
+
}; // 开始拖拽
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
var handleDragStart = function handleDragStart(_ref3) {
|
|
68
|
+
var active = _ref3.active;
|
|
69
|
+
setIsDragging(true);
|
|
70
|
+
|
|
71
|
+
if (!active) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
setActiveId(active.id);
|
|
76
|
+
}; // 拖拽结束
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
var handleDragEnd = function handleDragEnd(event) {
|
|
80
|
+
var active = event.active,
|
|
81
|
+
over = event.over;
|
|
82
|
+
setActiveId(null); // 未移入时触发
|
|
83
|
+
|
|
84
|
+
if (!(over === null || over === void 0 ? void 0 : over.id)) {
|
|
85
|
+
return;
|
|
86
|
+
} // 移入时触发更新数据
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
if (active.id !== over.id) {
|
|
90
|
+
handleMove(active.data.current.item, over.data.current.item);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
var instance = {
|
|
95
|
+
isDragging: isDragging,
|
|
96
|
+
activeId: activeId,
|
|
97
|
+
options: options,
|
|
98
|
+
rowKey: rowKey,
|
|
99
|
+
children: children,
|
|
100
|
+
move: move,
|
|
101
|
+
items: options === null || options === void 0 ? void 0 : options.map(function (v) {
|
|
102
|
+
return v[rowKey];
|
|
103
|
+
})
|
|
104
|
+
};
|
|
105
|
+
return /*#__PURE__*/React.createElement(DndContext, {
|
|
106
|
+
sensors: sensors,
|
|
107
|
+
onDragStart: handleDragStart,
|
|
108
|
+
onDragEnd: handleDragEnd,
|
|
109
|
+
onDragCancel: function onDragCancel() {
|
|
110
|
+
return setActiveId(null);
|
|
111
|
+
},
|
|
112
|
+
modifiers: [restrictToParentElement],
|
|
113
|
+
collisionDetection: closestCenter
|
|
114
|
+
}, /*#__PURE__*/React.createElement(SortableBox, {
|
|
115
|
+
instance: instance
|
|
116
|
+
}), /*#__PURE__*/React.createElement(DragOver, {
|
|
117
|
+
instance: instance
|
|
118
|
+
}));
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export default DndContainer;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SortableContext, rectSortingStrategy } from '@dnd-kit/sortable';
|
|
3
|
+
import SortableItem from './sortableItem'; // rectSortingStrategy 可交换策略
|
|
4
|
+
|
|
5
|
+
var SortableBox = function SortableBox(_ref) {
|
|
6
|
+
var instance = _ref.instance;
|
|
7
|
+
var items = instance.items,
|
|
8
|
+
rowKey = instance.rowKey,
|
|
9
|
+
options = instance.options;
|
|
10
|
+
return /*#__PURE__*/React.createElement(SortableContext, {
|
|
11
|
+
items: items,
|
|
12
|
+
strategy: rectSortingStrategy
|
|
13
|
+
}, options === null || options === void 0 ? void 0 : options.map(function (item, idx) {
|
|
14
|
+
return /*#__PURE__*/React.createElement(SortableItem, {
|
|
15
|
+
instance: instance,
|
|
16
|
+
index: idx,
|
|
17
|
+
key: item[rowKey] || idx,
|
|
18
|
+
item: item
|
|
19
|
+
});
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default /*#__PURE__*/React.memo(SortableBox);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { useSortable } from '@dnd-kit/sortable';
|
|
3
|
+
import { CSS } from '@dnd-kit/utilities';
|
|
4
|
+
|
|
5
|
+
var SortableItem = function SortableItem(_ref) {
|
|
6
|
+
var index = _ref.index,
|
|
7
|
+
item = _ref.item,
|
|
8
|
+
instance = _ref.instance;
|
|
9
|
+
var children = instance.children,
|
|
10
|
+
rowKey = instance.rowKey;
|
|
11
|
+
|
|
12
|
+
var _useSortable = useSortable({
|
|
13
|
+
id: item[rowKey] || index,
|
|
14
|
+
data: {
|
|
15
|
+
item: item
|
|
16
|
+
}
|
|
17
|
+
}),
|
|
18
|
+
attributes = _useSortable.attributes,
|
|
19
|
+
listeners = _useSortable.listeners,
|
|
20
|
+
setNodeRef = _useSortable.setNodeRef,
|
|
21
|
+
transform = _useSortable.transform,
|
|
22
|
+
transition = _useSortable.transition;
|
|
23
|
+
|
|
24
|
+
var resetStyle = useMemo(function () {
|
|
25
|
+
return {
|
|
26
|
+
transform: CSS.Transform.toString(transform),
|
|
27
|
+
transition: transition
|
|
28
|
+
};
|
|
29
|
+
}, [transform, transition]);
|
|
30
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", Object.assign({
|
|
31
|
+
className: "lm_drag_item",
|
|
32
|
+
ref: setNodeRef,
|
|
33
|
+
style: resetStyle
|
|
34
|
+
}, attributes), children === null || children === void 0 ? void 0 : children({
|
|
35
|
+
item: item,
|
|
36
|
+
listeners: listeners,
|
|
37
|
+
index: index
|
|
38
|
+
})));
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default /*#__PURE__*/React.memo(SortableItem);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import LmDrag from './LmDrag';
|
|
3
|
+
export default LmDrag;
|
|
4
|
+
export { LmDrag };
|
|
5
|
+
export interface LmDragProps {
|
|
6
|
+
options?: Array<any>;
|
|
7
|
+
rowKey: string;
|
|
8
|
+
move?: (activeId: string, overId: string, fileList: Array<any>) => void;
|
|
9
|
+
children?: ReactNode | React.FC | null;
|
|
10
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './index.less';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index.css";
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './variables.less';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./variables.css";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { forwardRef, useImperativeHandle } from 'react';
|
|
2
|
+
import Drag from '../components/DndContainer';
|
|
3
|
+
|
|
4
|
+
var Root = function Root(props, ref) {
|
|
5
|
+
// 向外暴露出的方法
|
|
6
|
+
useImperativeHandle(ref, function () {
|
|
7
|
+
return {};
|
|
8
|
+
});
|
|
9
|
+
return /*#__PURE__*/React.createElement(Drag, Object.assign({}, props));
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default /*#__PURE__*/forwardRef(Root);
|
package/es/LmUpload/LmUpload.js
CHANGED
|
@@ -73,7 +73,7 @@ var LmUpload = function LmUpload(_a, ref) {
|
|
|
73
73
|
size: 100,
|
|
74
74
|
fileSize: 10,
|
|
75
75
|
fileSizeType: 'M',
|
|
76
|
-
uid: '
|
|
76
|
+
uid: 'fileName',
|
|
77
77
|
accept: '',
|
|
78
78
|
type: ['jpg', 'jpeg', 'png'],
|
|
79
79
|
listType: 'card',
|
|
@@ -88,6 +88,7 @@ var LmUpload = function LmUpload(_a, ref) {
|
|
|
88
88
|
itemRender: null,
|
|
89
89
|
enabledPreview: true,
|
|
90
90
|
enabledCrop: false,
|
|
91
|
+
enableDrag: false,
|
|
91
92
|
enabledOss: false,
|
|
92
93
|
// oss配置
|
|
93
94
|
ossConfig: function ossConfig() {
|
|
@@ -64,7 +64,8 @@ var renderThumb = function renderThumb(file) {
|
|
|
64
64
|
var PictureItem = function PictureItem(_ref) {
|
|
65
65
|
var file = _ref.file,
|
|
66
66
|
index = _ref.index,
|
|
67
|
-
instance = _ref.instance
|
|
67
|
+
instance = _ref.instance,
|
|
68
|
+
listeners = _ref.listeners;
|
|
68
69
|
var dispatch = instance.dispatch,
|
|
69
70
|
readOnly = instance.readOnly,
|
|
70
71
|
size = instance.size,
|
|
@@ -148,6 +149,13 @@ var PictureItem = function PictureItem(_ref) {
|
|
|
148
149
|
style: {
|
|
149
150
|
fontSize: resetSize.fontSize
|
|
150
151
|
}
|
|
152
|
+
})), /*#__PURE__*/React.createElement("div", Object.assign({
|
|
153
|
+
className: "action_preview"
|
|
154
|
+
}, listeners), /*#__PURE__*/React.createElement(IconFont, {
|
|
155
|
+
type: "lmweb-drag",
|
|
156
|
+
style: {
|
|
157
|
+
fontSize: resetSize.fontSize
|
|
158
|
+
}
|
|
151
159
|
})), !readOnly && /*#__PURE__*/React.createElement("div", {
|
|
152
160
|
className: "action_delete",
|
|
153
161
|
onClick: function onClick() {
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
|
+
import { LmDrag } from 'linkmore-design';
|
|
2
3
|
import { render } from '../utils';
|
|
3
4
|
import RenderItem from './RenderItem';
|
|
4
5
|
|
|
5
6
|
var LmUploadList = function LmUploadList(_ref) {
|
|
6
7
|
var instance = _ref.instance;
|
|
7
|
-
var
|
|
8
|
+
var uid = instance.uid,
|
|
9
|
+
dispatch = instance.dispatch,
|
|
10
|
+
getFileHasValue = instance.getFileHasValue,
|
|
8
11
|
getFileList = instance.getFileList,
|
|
9
12
|
itemRender = instance.itemRender,
|
|
10
13
|
listType = instance.listType,
|
|
11
|
-
showUploadList = instance.showUploadList
|
|
14
|
+
showUploadList = instance.showUploadList,
|
|
15
|
+
enableDrag = instance.enableDrag,
|
|
16
|
+
fileNames = instance.fileNames;
|
|
12
17
|
if (!showUploadList) return null;
|
|
13
18
|
var fileList = useMemo(function () {
|
|
14
19
|
var _a;
|
|
@@ -17,6 +22,54 @@ var LmUploadList = function LmUploadList(_ref) {
|
|
|
17
22
|
return a.seq - b.seq;
|
|
18
23
|
});
|
|
19
24
|
}, [getFileList]);
|
|
25
|
+
|
|
26
|
+
var handleMove = function handleMove(active, over, fileList) {
|
|
27
|
+
try {
|
|
28
|
+
var fileMap = fileList.map(function (v) {
|
|
29
|
+
if (getFileHasValue(v) === getFileHasValue(active)) {
|
|
30
|
+
return Object.assign(Object.assign({}, v), {
|
|
31
|
+
seq: over[fileNames.seq]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (getFileHasValue(v) === getFileHasValue(over)) {
|
|
36
|
+
return Object.assign(Object.assign({}, v), {
|
|
37
|
+
seq: active[fileNames.seq]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return v;
|
|
42
|
+
});
|
|
43
|
+
dispatch({
|
|
44
|
+
type: 'changeFileList',
|
|
45
|
+
fileList: fileMap
|
|
46
|
+
});
|
|
47
|
+
} catch (error) {
|
|
48
|
+
console.log('移动出现了错误', error);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
if (enableDrag) {
|
|
53
|
+
return /*#__PURE__*/React.createElement(LmDrag, {
|
|
54
|
+
options: fileList,
|
|
55
|
+
rowKey: uid,
|
|
56
|
+
move: handleMove
|
|
57
|
+
}, function (_ref2) {
|
|
58
|
+
var item = _ref2.item,
|
|
59
|
+
listeners = _ref2.listeners,
|
|
60
|
+
index = _ref2.index;
|
|
61
|
+
return render(itemRender || RenderItem, {
|
|
62
|
+
type: listType,
|
|
63
|
+
key: getFileHasValue(item) || index,
|
|
64
|
+
index: index,
|
|
65
|
+
file: item,
|
|
66
|
+
fileList: fileList,
|
|
67
|
+
instance: instance,
|
|
68
|
+
listeners: listeners
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
20
73
|
return /*#__PURE__*/React.createElement(React.Fragment, null, fileList === null || fileList === void 0 ? void 0 : fileList.map(function (file, idx) {
|
|
21
74
|
return render(itemRender || RenderItem, {
|
|
22
75
|
type: listType,
|
package/es/LmUpload/fns/index.js
CHANGED
|
@@ -66,10 +66,11 @@ var useCoreOptions = function useCoreOptions(_ref) {
|
|
|
66
66
|
}, [uid]); // 从对象中读取存在的指定属性
|
|
67
67
|
|
|
68
68
|
var getFileHasValue = useCallback(function (obj) {
|
|
69
|
+
if (!obj) return '';
|
|
69
70
|
var extend = [uid, 'fileName'];
|
|
70
71
|
var val = '';
|
|
71
72
|
extend.forEach(function (v) {
|
|
72
|
-
if (!val) val = obj[v];
|
|
73
|
+
if (!val && obj[v]) val = obj[v];
|
|
73
74
|
});
|
|
74
75
|
return val;
|
|
75
76
|
}, [uid]); // 获取当前的文件列表
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
|
@@ -82,4 +82,5 @@ export { default as FullScreen } from './FullScreen';
|
|
|
82
82
|
export * from './LmImgList';
|
|
83
83
|
export { default as LmImgList } from './LmImgList';
|
|
84
84
|
export { default as CropImg } from './CropImg';
|
|
85
|
-
export { default as ImageViewer } from './ImageViewer';
|
|
85
|
+
export { default as ImageViewer } from './ImageViewer';
|
|
86
|
+
export * from './LmDrag';
|
package/lib/Descriptions/Cell.js
CHANGED
|
@@ -23,6 +23,7 @@ var Cell = function Cell(_ref) {
|
|
|
23
23
|
var itemPrefixCls = _ref.itemPrefixCls,
|
|
24
24
|
component = _ref.component,
|
|
25
25
|
span = _ref.span,
|
|
26
|
+
rowSpan = _ref.rowSpan,
|
|
26
27
|
className = _ref.className,
|
|
27
28
|
style = _ref.style,
|
|
28
29
|
labelStyle = _ref.labelStyle,
|
|
@@ -39,7 +40,8 @@ var Cell = function Cell(_ref) {
|
|
|
39
40
|
return /*#__PURE__*/React.createElement(Component, {
|
|
40
41
|
className: (0, _classnames.default)((_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(itemPrefixCls, "-item-label"), notEmpty(label)), (0, _defineProperty2.default)(_classNames, "".concat(itemPrefixCls, "-item-content"), notEmpty(content)), _classNames), className),
|
|
41
42
|
style: style,
|
|
42
|
-
colSpan: span
|
|
43
|
+
colSpan: span,
|
|
44
|
+
rowSpan: rowSpan
|
|
43
45
|
}, notEmpty(label) && /*#__PURE__*/React.createElement("span", {
|
|
44
46
|
style: labelStyle
|
|
45
47
|
}, label), notEmpty(content) && /*#__PURE__*/React.createElement("span", {
|
|
@@ -50,7 +52,8 @@ var Cell = function Cell(_ref) {
|
|
|
50
52
|
return /*#__PURE__*/React.createElement(Component, {
|
|
51
53
|
className: (0, _classnames.default)("".concat(itemPrefixCls, "-item"), className),
|
|
52
54
|
style: style,
|
|
53
|
-
colSpan: span
|
|
55
|
+
colSpan: span,
|
|
56
|
+
rowSpan: rowSpan
|
|
54
57
|
}, /*#__PURE__*/React.createElement("div", {
|
|
55
58
|
className: "".concat(itemPrefixCls, "-item-container")
|
|
56
59
|
}, (label || label === 0) && /*#__PURE__*/React.createElement("span", {
|
package/lib/Descriptions/Row.js
CHANGED
|
@@ -11,7 +11,7 @@ exports.default = void 0;
|
|
|
11
11
|
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
|
|
14
|
-
var _ = require("
|
|
14
|
+
var _ = require(".");
|
|
15
15
|
|
|
16
16
|
var _Cell = _interopRequireDefault(require("./Cell"));
|
|
17
17
|
|
|
@@ -37,6 +37,8 @@ function renderCells(items, _ref, _ref2) {
|
|
|
37
37
|
contentStyle = _ref3$props.contentStyle,
|
|
38
38
|
_ref3$props$span = _ref3$props.span,
|
|
39
39
|
span = _ref3$props$span === void 0 ? 1 : _ref3$props$span,
|
|
40
|
+
_ref3$props$rowSpan = _ref3$props.rowSpan,
|
|
41
|
+
rowSpan = _ref3$props$rowSpan === void 0 ? 1 : _ref3$props$rowSpan,
|
|
40
42
|
key = _ref3.key;
|
|
41
43
|
|
|
42
44
|
if (typeof component === 'string') {
|
|
@@ -47,6 +49,7 @@ function renderCells(items, _ref, _ref2) {
|
|
|
47
49
|
labelStyle: Object.assign(Object.assign({}, rootLabelStyle), labelStyle),
|
|
48
50
|
contentStyle: Object.assign(Object.assign({}, rootContentStyle), contentStyle),
|
|
49
51
|
span: span,
|
|
52
|
+
rowSpan: rowSpan,
|
|
50
53
|
colon: colon,
|
|
51
54
|
component: component,
|
|
52
55
|
itemPrefixCls: itemPrefixCls,
|
|
@@ -61,6 +64,7 @@ function renderCells(items, _ref, _ref2) {
|
|
|
61
64
|
className: className,
|
|
62
65
|
style: Object.assign(Object.assign(Object.assign({}, rootLabelStyle), style), labelStyle),
|
|
63
66
|
span: 1,
|
|
67
|
+
rowSpan: rowSpan,
|
|
64
68
|
colon: colon,
|
|
65
69
|
component: component[0],
|
|
66
70
|
itemPrefixCls: itemPrefixCls,
|
|
@@ -71,6 +75,7 @@ function renderCells(items, _ref, _ref2) {
|
|
|
71
75
|
className: className,
|
|
72
76
|
style: Object.assign(Object.assign(Object.assign({}, rootContentStyle), style), contentStyle),
|
|
73
77
|
span: span * 2 - 1,
|
|
78
|
+
rowSpan: rowSpan,
|
|
74
79
|
component: component[1],
|
|
75
80
|
itemPrefixCls: itemPrefixCls,
|
|
76
81
|
bordered: bordered,
|