@pisell/materials 1.0.337 → 1.0.339
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/build/lowcode/assets/c052fb4b37973c8e0885712a7e26bb99.png +0 -0
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +2 -2
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +12 -12
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +11 -11
- package/es/components/Pagination/index.d.ts +1 -1
- package/es/components/drag-sort-tree/TreeItem/index.d.ts +16 -0
- package/es/components/drag-sort-tree/TreeItem/index.js +192 -0
- package/es/components/drag-sort-tree/TreeItem/index.less +37 -0
- package/es/components/drag-sort-tree/index.d.ts +4 -0
- package/es/components/drag-sort-tree/index.js +82 -0
- package/es/components/drag-sort-tree/types.d.ts +19 -0
- package/es/components/drag-sort-tree/types.js +1 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/lib/components/Pagination/index.d.ts +1 -1
- package/lib/components/drag-sort-tree/TreeItem/index.d.ts +16 -0
- package/lib/components/drag-sort-tree/TreeItem/index.js +179 -0
- package/lib/components/drag-sort-tree/TreeItem/index.less +37 -0
- package/lib/components/drag-sort-tree/index.d.ts +4 -0
- package/lib/components/drag-sort-tree/index.js +111 -0
- package/lib/components/drag-sort-tree/types.d.ts +19 -0
- package/lib/components/drag-sort-tree/types.js +17 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lowcode/drag-sort-tree/__screenshots__/drag-sort-tree.png +0 -0
- package/lowcode/drag-sort-tree/meta.ts +103 -0
- package/lowcode/drag-sort-tree/snippets.ts +57 -0
- package/package.json +1 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/drag-sort-tree/index.tsx
|
|
30
|
+
var drag_sort_tree_exports = {};
|
|
31
|
+
__export(drag_sort_tree_exports, {
|
|
32
|
+
default: () => drag_sort_tree_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(drag_sort_tree_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_core = require("@dnd-kit/core");
|
|
37
|
+
var import_sortable = require("@dnd-kit/sortable");
|
|
38
|
+
var import_TreeItem = __toESM(require("./TreeItem"));
|
|
39
|
+
var import_modifiers = require("@dnd-kit/modifiers");
|
|
40
|
+
var DragSortTree = (props) => {
|
|
41
|
+
const { value, rowKey, onChange } = props;
|
|
42
|
+
const [items, setItems] = (0, import_react.useState)(value || []);
|
|
43
|
+
const [activeId, setActiveId] = (0, import_react.useState)(null);
|
|
44
|
+
const sensors = (0, import_core.useSensors)(
|
|
45
|
+
(0, import_core.useSensor)(import_core.PointerSensor, {
|
|
46
|
+
activationConstraint: {
|
|
47
|
+
distance: 5
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
const handleDragStart = (event) => {
|
|
52
|
+
const { active } = event;
|
|
53
|
+
setActiveId(active[rowKey]);
|
|
54
|
+
};
|
|
55
|
+
const handleDragEnd = (event) => {
|
|
56
|
+
const { active, over } = event;
|
|
57
|
+
setActiveId(null);
|
|
58
|
+
if (!over || !active)
|
|
59
|
+
return;
|
|
60
|
+
try {
|
|
61
|
+
const activeId2 = active[rowKey];
|
|
62
|
+
const overId = over[rowKey];
|
|
63
|
+
if (activeId2 !== overId) {
|
|
64
|
+
const activeIndex = items.findIndex(
|
|
65
|
+
(item) => item[rowKey] === activeId2
|
|
66
|
+
);
|
|
67
|
+
const overIndex = items.findIndex(
|
|
68
|
+
(item) => item[rowKey] === overId
|
|
69
|
+
);
|
|
70
|
+
const _lists = (0, import_sortable.arrayMove)(items, activeIndex, overIndex);
|
|
71
|
+
handleChange(_lists);
|
|
72
|
+
}
|
|
73
|
+
} catch (error) {
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const handleChange = (value2) => {
|
|
77
|
+
setItems(value2);
|
|
78
|
+
onChange && onChange(value2);
|
|
79
|
+
};
|
|
80
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
81
|
+
import_core.DndContext,
|
|
82
|
+
{
|
|
83
|
+
sensors,
|
|
84
|
+
onDragEnd: handleDragEnd,
|
|
85
|
+
onDragStart: handleDragStart,
|
|
86
|
+
modifiers: [import_modifiers.restrictToVerticalAxis, import_modifiers.restrictToParentElement]
|
|
87
|
+
},
|
|
88
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
89
|
+
import_sortable.SortableContext,
|
|
90
|
+
{
|
|
91
|
+
items: items.map((item) => item[rowKey]),
|
|
92
|
+
strategy: import_sortable.verticalListSortingStrategy
|
|
93
|
+
},
|
|
94
|
+
items.map((item) => /* @__PURE__ */ import_react.default.createElement(
|
|
95
|
+
import_TreeItem.default,
|
|
96
|
+
{
|
|
97
|
+
key: item[rowKey],
|
|
98
|
+
id: item[rowKey],
|
|
99
|
+
item,
|
|
100
|
+
depth: 0,
|
|
101
|
+
sensors,
|
|
102
|
+
activeId,
|
|
103
|
+
childrenProps: props,
|
|
104
|
+
lists: items,
|
|
105
|
+
onChange: handleChange
|
|
106
|
+
}
|
|
107
|
+
))
|
|
108
|
+
)
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
var drag_sort_tree_default = DragSortTree;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type ValueProps = {
|
|
3
|
+
id: number | string;
|
|
4
|
+
title: string;
|
|
5
|
+
show?: boolean;
|
|
6
|
+
is_available?: boolean;
|
|
7
|
+
type_id?: number;
|
|
8
|
+
children?: ValueProps[];
|
|
9
|
+
};
|
|
10
|
+
export declare type SortType = {
|
|
11
|
+
value: ValueProps[];
|
|
12
|
+
rowKey: string;
|
|
13
|
+
className?: string | Function;
|
|
14
|
+
titleRender?: string | React.ReactElement;
|
|
15
|
+
hiddenDraggableIcon?: boolean;
|
|
16
|
+
hiddenRightIcon?: boolean;
|
|
17
|
+
hiddenWarningIcon?: boolean;
|
|
18
|
+
onChange?: (value: ValueProps[]) => void;
|
|
19
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/components/drag-sort-tree/types.ts
|
|
16
|
+
var types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
package/lib/index.d.ts
CHANGED
|
@@ -79,3 +79,4 @@ export { default as VirtualKeyboardTime } from './components/virtual-keyboard/Ti
|
|
|
79
79
|
export { default as SelectTime } from './components/select-time';
|
|
80
80
|
export { default as AutoCompleteNumber } from './components/auto-complete-number';
|
|
81
81
|
export { default as BatchEditor } from './components/batch-editor';
|
|
82
|
+
export { default as DragSortTree } from './components/drag-sort-tree';
|
package/lib/index.js
CHANGED
|
@@ -53,6 +53,7 @@ __export(src_exports, {
|
|
|
53
53
|
Descriptions: () => import_antd11.Descriptions,
|
|
54
54
|
Div: () => import_div.default,
|
|
55
55
|
Divider: () => import_antd12.Divider,
|
|
56
|
+
DragSortTree: () => import_drag_sort_tree.default,
|
|
56
57
|
Drawer: () => import_drawer.default,
|
|
57
58
|
Dropdown: () => import_dropdown.default,
|
|
58
59
|
Empty: () => import_antd13.Empty,
|
|
@@ -193,6 +194,7 @@ var import_Time = __toESM(require("./components/virtual-keyboard/Time"));
|
|
|
193
194
|
var import_select_time = __toESM(require("./components/select-time"));
|
|
194
195
|
var import_auto_complete_number = __toESM(require("./components/auto-complete-number"));
|
|
195
196
|
var import_batch_editor = __toESM(require("./components/batch-editor"));
|
|
197
|
+
var import_drag_sort_tree = __toESM(require("./components/drag-sort-tree"));
|
|
196
198
|
// Annotate the CommonJS export names for ESM import in node:
|
|
197
199
|
0 && (module.exports = {
|
|
198
200
|
Affix,
|
|
@@ -219,6 +221,7 @@ var import_batch_editor = __toESM(require("./components/batch-editor"));
|
|
|
219
221
|
Descriptions,
|
|
220
222
|
Div,
|
|
221
223
|
Divider,
|
|
224
|
+
DragSortTree,
|
|
222
225
|
Drawer,
|
|
223
226
|
Dropdown,
|
|
224
227
|
Empty,
|
|
Binary file
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import snippets from './snippets';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
snippets,
|
|
5
|
+
componentName: "DragSortTree",
|
|
6
|
+
title: "拖拽排序",
|
|
7
|
+
category: "数据展示",
|
|
8
|
+
docUrl: "",
|
|
9
|
+
screenshot: "",
|
|
10
|
+
devMode: "proCode",
|
|
11
|
+
npm: {
|
|
12
|
+
package: "@pisell/materials",
|
|
13
|
+
version: "1.0.1",
|
|
14
|
+
exportName: "DragSortTree",
|
|
15
|
+
main: "src/index.tsx",
|
|
16
|
+
destructuring: true,
|
|
17
|
+
subName: "",
|
|
18
|
+
},
|
|
19
|
+
props: [
|
|
20
|
+
{
|
|
21
|
+
title: '数据源',
|
|
22
|
+
display: 'block',
|
|
23
|
+
type: 'group',
|
|
24
|
+
items: [
|
|
25
|
+
{
|
|
26
|
+
name: 'value',
|
|
27
|
+
title: '列表数据源',
|
|
28
|
+
propType: { type: 'arrayOf', value: 'any' },
|
|
29
|
+
setter: ['JsonSetter', 'VariableSetter'],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'rowKey',
|
|
33
|
+
title: {
|
|
34
|
+
label: '行Key',
|
|
35
|
+
tip: 'rowKey | 当 renderItem 自定义渲染列表项有效时,自定义每一行的 key 的获取方式',
|
|
36
|
+
},
|
|
37
|
+
propType: {
|
|
38
|
+
type: 'oneOfType',
|
|
39
|
+
value: ['string', 'function'],
|
|
40
|
+
},
|
|
41
|
+
defaultValue: 'id',
|
|
42
|
+
setter: [
|
|
43
|
+
'StringSetter',
|
|
44
|
+
{
|
|
45
|
+
componentName: 'FunctionSetter',
|
|
46
|
+
props: {
|
|
47
|
+
template:
|
|
48
|
+
'rowKey(item,${extParams}){\n// 自定义每一行的 key\nreturn `${item.id}`;\n}',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
'VariableSetter',
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'className',
|
|
56
|
+
title: {
|
|
57
|
+
label: '样式类名',
|
|
58
|
+
tip: 'className | 样式类名',
|
|
59
|
+
},
|
|
60
|
+
propType: 'string',
|
|
61
|
+
setter: 'StringSetter',
|
|
62
|
+
},
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "titleRender",
|
|
67
|
+
title: { label: '标题', tip: '是否自定义标题内容 | node/func' },
|
|
68
|
+
propType: { type: 'oneOfType', value: ['node', 'func'] },
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "hiddenDraggableIcon",
|
|
72
|
+
title: { label: "隐藏拖拽图标", tip: "是否隐藏拖拽图标" },
|
|
73
|
+
propType: "bool",
|
|
74
|
+
defaultValue: false,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "hiddenRightIcon",
|
|
78
|
+
title: { label: "右侧图标", tip: "是否隐藏右侧图标" },
|
|
79
|
+
propType: "bool",
|
|
80
|
+
defaultValue: false,
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "hiddenWarningIcon",
|
|
84
|
+
title: { label: "警告图标", tip: "子元素是否隐藏警告图标" },
|
|
85
|
+
propType: "bool",
|
|
86
|
+
defaultValue: false,
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
configure: {
|
|
90
|
+
component: {
|
|
91
|
+
isContainer: true,
|
|
92
|
+
},
|
|
93
|
+
supports: {
|
|
94
|
+
style: true,
|
|
95
|
+
events: [
|
|
96
|
+
{
|
|
97
|
+
name: 'onChange',
|
|
98
|
+
template: 'onChange(value,${extParams}){\n// 排序 改变的回调\n}',
|
|
99
|
+
},
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export default [
|
|
2
|
+
{
|
|
3
|
+
title: '拖拽排序',
|
|
4
|
+
screenshot: require('./__screenshots__/drag-sort-tree.png'),
|
|
5
|
+
schema: {
|
|
6
|
+
componentName: 'DragSortTree',
|
|
7
|
+
props: {
|
|
8
|
+
value: [{
|
|
9
|
+
"id": 1,
|
|
10
|
+
"title": "资源1",
|
|
11
|
+
"show": true,
|
|
12
|
+
"children": [{
|
|
13
|
+
"id": 11,
|
|
14
|
+
"title": "资源1-1",
|
|
15
|
+
"is_available": 1,
|
|
16
|
+
"type_id": 1
|
|
17
|
+
}, {
|
|
18
|
+
"id": 12,
|
|
19
|
+
"title": "资源1-2",
|
|
20
|
+
"is_available": 1,
|
|
21
|
+
"type_id": 1
|
|
22
|
+
}]
|
|
23
|
+
}, {
|
|
24
|
+
"id": 2,
|
|
25
|
+
"title": "资源2",
|
|
26
|
+
"show": false,
|
|
27
|
+
"children": [{
|
|
28
|
+
"id": 21,
|
|
29
|
+
"title": "资源2-1",
|
|
30
|
+
"is_available": 0,
|
|
31
|
+
"type_id": 2
|
|
32
|
+
}, {
|
|
33
|
+
"id": 22,
|
|
34
|
+
"title": "资源2-2",
|
|
35
|
+
"is_available": 1,
|
|
36
|
+
"type_id": 2
|
|
37
|
+
}]
|
|
38
|
+
}, {
|
|
39
|
+
"id": 3,
|
|
40
|
+
"title": "资源3",
|
|
41
|
+
"show": true,
|
|
42
|
+
"children": [{
|
|
43
|
+
"id": 31,
|
|
44
|
+
"title": "资源3-1",
|
|
45
|
+
"is_available": 1,
|
|
46
|
+
"type_id": 3
|
|
47
|
+
}, {
|
|
48
|
+
"id": 32,
|
|
49
|
+
"title": "资源3-2",
|
|
50
|
+
"is_available": 0,
|
|
51
|
+
"type_id": 3
|
|
52
|
+
}]
|
|
53
|
+
}]
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
];
|