linkmore-design 1.1.13-alpha.4 → 1.1.13-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Button/demos/ghost.d.ts +2 -0
- package/dist/Descriptions/Cell.d.ts +1 -0
- package/dist/Descriptions/Item.d.ts +1 -0
- package/dist/LmDrag/LmDrag.d.ts +4 -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/LmEditTable/EditTable.d.ts +15 -3
- package/dist/LmUpload/UploadList/ItemPictureCard.d.ts +2 -1
- package/dist/LmUpload/fns/index.d.ts +1 -0
- package/dist/QuickMenu/index.d.ts +2 -1
- package/dist/Select/index.d.ts +3 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.umd.js +804 -119
- package/dist/index.umd.min.js +9 -9
- package/dist/variables.css +67 -25
- package/es/Button/index.js +4 -3
- package/es/Button/style/index.css +28 -25
- package/es/Button/style/variables.css +28 -25
- 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/InputNumber/index.js +7 -9
- package/es/LmDrag/LmDrag.d.ts +4 -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/LmEditTable/EditTable.d.ts +15 -3
- package/es/LmEditTable/EditTable.js +147 -67
- package/es/LmEditTable/sortableItemCol.js +38 -11
- package/es/LmEditTable/util.js +16 -5
- package/es/LmFilter/components/DropdownFIlter.js +27 -6
- package/es/LmFilter/style/index.css +12 -0
- package/es/LmFilter/style/variables.css +12 -0
- package/es/LmUpload/LmUpload.js +2 -1
- package/es/LmUpload/UploadList/ItemPictureCard.d.ts +2 -1
- package/es/LmUpload/UploadList/ItemPictureCard.js +4 -3
- package/es/LmUpload/UploadList/index.js +52 -2
- package/es/LmUpload/fns/index.d.ts +1 -0
- package/es/LmUpload/fns/index.js +19 -3
- package/es/QuickMenu/index.d.ts +2 -1
- package/es/QuickMenu/index.js +11 -12
- package/es/Select/index.d.ts +3 -0
- package/es/Select/index.js +28 -1
- package/es/Select/style/index.css +27 -0
- package/es/Select/style/variables.css +27 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -1
- package/es/styles/variables.css +67 -25
- package/lib/Button/index.js +4 -3
- package/lib/Button/style/index.css +28 -25
- package/lib/Button/style/variables.css +28 -25
- 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/InputNumber/index.js +9 -9
- package/lib/LmDrag/LmDrag.d.ts +4 -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/LmEditTable/EditTable.d.ts +15 -3
- package/lib/LmEditTable/EditTable.js +146 -66
- package/lib/LmEditTable/sortableItemCol.js +34 -8
- package/lib/LmEditTable/util.js +15 -4
- package/lib/LmFilter/components/DropdownFIlter.js +27 -6
- package/lib/LmFilter/style/index.css +12 -0
- package/lib/LmFilter/style/variables.css +12 -0
- package/lib/LmUpload/LmUpload.js +2 -1
- package/lib/LmUpload/UploadList/ItemPictureCard.d.ts +2 -1
- package/lib/LmUpload/UploadList/ItemPictureCard.js +4 -3
- package/lib/LmUpload/UploadList/index.js +53 -2
- package/lib/LmUpload/fns/index.d.ts +1 -0
- package/lib/LmUpload/fns/index.js +19 -3
- package/lib/QuickMenu/index.d.ts +2 -1
- package/lib/QuickMenu/index.js +11 -12
- package/lib/Select/index.d.ts +3 -0
- package/lib/Select/index.js +29 -1
- package/lib/Select/style/index.css +27 -0
- package/lib/Select/style/variables.css +27 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +15 -1
- package/lib/styles/variables.css +67 -25
- package/package.json +1 -1
|
@@ -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);
|
|
@@ -23,6 +23,18 @@ interface ILmEditTable extends TableProps<any> {
|
|
|
23
23
|
};
|
|
24
24
|
/** 是否为强制更新 */
|
|
25
25
|
shouldUpdate?: boolean;
|
|
26
|
+
rowSelection?: TableProps<any>['rowSelection'] & {
|
|
27
|
+
selectedRows?: Record<string, any>;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface CountdownHandle {
|
|
31
|
+
setRow: (data: any) => void;
|
|
32
|
+
getCheckboxRecords: () => any[];
|
|
33
|
+
clearSelect: () => void;
|
|
34
|
+
customSetCheckboxRecords: (data: any[]) => void;
|
|
35
|
+
deleteRowData: (record: string | Record<string, any>) => void;
|
|
36
|
+
addRowData: (record: string | Record<string, any>, defaultValue?: Record<string, any> | Record<string, any>[], addInChild?: boolean) => void;
|
|
37
|
+
valid: () => void;
|
|
26
38
|
}
|
|
27
39
|
interface ILmColumns extends TableColumnType<any> {
|
|
28
40
|
editable?: 'input' | 'number' | 'inputRange' | 'date' | 'select' | 'multiple' | 'checkbox' | 'radio' | 'switch' | 'upload' | 'operate' | 'lm_edit_opetate' | 'render';
|
|
@@ -37,11 +49,11 @@ interface ILmColumns extends TableColumnType<any> {
|
|
|
37
49
|
export declare type TLmEditTable = {
|
|
38
50
|
onChange?: (data: any[]) => void;
|
|
39
51
|
columns: ILmColumns[];
|
|
40
|
-
virtual
|
|
52
|
+
virtual?: boolean;
|
|
41
53
|
} & ILmEditTable;
|
|
42
54
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<{
|
|
43
55
|
onChange?: (data: any[]) => void;
|
|
44
56
|
columns: ILmColumns[];
|
|
45
|
-
virtual
|
|
46
|
-
} & ILmEditTable & React.RefAttributes<
|
|
57
|
+
virtual?: boolean;
|
|
58
|
+
} & ILmEditTable & React.RefAttributes<CountdownHandle>>>;
|
|
47
59
|
export default _default;
|