@pisell/materials 1.0.606 → 1.0.608
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-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 +3 -3
- package/build/lowcode/preview.js +154 -146
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +37 -23
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +38 -24
- package/es/components/Pagination/index.d.ts +1 -1
- package/es/components/appVersionControl/index.less +3 -0
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.d.ts +6 -2
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +15 -1
- package/es/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +4 -4
- package/es/components/dataSourceComponents/fields/Select/index.js +2 -1
- package/es/components/dataSourceComponents/fields/index.d.ts +1 -1
- package/es/components/dataSourceComponents/provider/variables/VariablesProvider.js +3 -0
- package/es/components/pisellDraggable/components/Action/Action.d.ts +10 -0
- package/es/components/pisellDraggable/components/Action/Action.js +31 -0
- package/es/components/pisellDraggable/components/Action/Action.less +50 -0
- package/es/components/pisellDraggable/components/Action/index.d.ts +2 -0
- package/es/components/pisellDraggable/components/Action/index.js +1 -0
- package/es/components/pisellDraggable/components/Handle/Handle.d.ts +3 -0
- package/es/components/pisellDraggable/components/Handle/Handle.js +15 -0
- package/es/components/pisellDraggable/components/Handle/index.d.ts +1 -0
- package/es/components/pisellDraggable/components/Handle/index.js +1 -0
- package/es/components/pisellDraggable/components/Remove/Remove.d.ts +3 -0
- package/es/components/pisellDraggable/components/Remove/Remove.js +17 -0
- package/es/components/pisellDraggable/components/Remove/index.d.ts +1 -0
- package/es/components/pisellDraggable/components/Remove/index.js +1 -0
- package/es/components/pisellDraggable/components/TreeItem/SortableTreeItem.d.ts +8 -0
- package/es/components/pisellDraggable/components/TreeItem/SortableTreeItem.js +51 -0
- package/es/components/pisellDraggable/components/TreeItem/TreeItem.d.ts +21 -0
- package/es/components/pisellDraggable/components/TreeItem/TreeItem.js +57 -0
- package/es/components/pisellDraggable/components/TreeItem/TreeItem.less +128 -0
- package/es/components/pisellDraggable/components/TreeItem/index.d.ts +2 -0
- package/es/components/pisellDraggable/components/TreeItem/index.js +2 -0
- package/es/components/pisellDraggable/components/index.d.ts +4 -0
- package/es/components/pisellDraggable/components/index.js +4 -0
- package/es/components/pisellDraggable/index.d.ts +28 -3
- package/es/components/pisellDraggable/index.js +380 -2
- package/es/components/pisellDraggable/types.d.ts +15 -99
- package/es/components/pisellDraggable/utilities.d.ts +17 -0
- package/es/components/pisellDraggable/utilities.js +230 -0
- package/es/components/pisellDropSort/PisellDropSort.d.ts +5 -0
- package/es/components/pisellDropSort/PisellDropSort.js +102 -0
- package/es/components/pisellDropSort/PisellDropSort.less +92 -0
- package/es/components/pisellDropSort/components/SortableItem/index.d.ts +19 -0
- package/es/components/pisellDropSort/components/SortableItem/index.js +93 -0
- package/es/components/pisellDropSort/components/SortableItem/index.less +155 -0
- package/es/components/pisellDropSort/index.d.ts +3 -0
- package/es/components/pisellDropSort/index.js +2 -0
- package/es/components/pisellDropSort/types.d.ts +42 -0
- package/es/components/pisellDropSort/types.js +1 -0
- package/es/components/pisellModal/components/Information/index.js +0 -1
- package/es/components/versionModal/index.js +3 -1
- package/es/components/versionModal/index.less +9 -2
- package/es/index.d.ts +1 -0
- package/es/index.js +2 -1
- package/es/locales/en-US.d.ts +7 -6
- package/es/locales/en-US.js +16 -22
- package/es/locales/zh-CN.d.ts +7 -6
- package/es/locales/zh-CN.js +15 -21
- package/es/locales/zh-TW.d.ts +7 -6
- package/es/locales/zh-TW.js +17 -23
- package/lib/components/Pagination/index.d.ts +1 -1
- package/lib/components/appVersionControl/index.less +3 -0
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.d.ts +6 -2
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useFormat.js +16 -1
- package/lib/components/dataSourceComponents/dataSourceTable/hooks/useTableProps.d.ts +4 -4
- package/lib/components/dataSourceComponents/fields/Select/index.js +2 -1
- package/lib/components/dataSourceComponents/fields/index.d.ts +1 -1
- package/lib/components/dataSourceComponents/provider/variables/VariablesProvider.js +3 -0
- package/lib/components/pisellDraggable/components/Action/Action.d.ts +10 -0
- package/lib/components/pisellDraggable/components/Action/Action.js +60 -0
- package/lib/components/pisellDraggable/components/Action/Action.less +50 -0
- package/lib/components/pisellDraggable/components/Action/index.d.ts +2 -0
- package/lib/components/pisellDraggable/components/Action/index.js +29 -0
- package/lib/components/pisellDraggable/components/Handle/Handle.d.ts +3 -0
- package/lib/components/pisellDraggable/components/Handle/Handle.js +54 -0
- package/lib/components/pisellDraggable/components/Handle/index.d.ts +1 -0
- package/lib/components/pisellDraggable/components/Handle/index.js +29 -0
- package/lib/components/pisellDraggable/components/Remove/Remove.d.ts +3 -0
- package/lib/components/pisellDraggable/components/Remove/Remove.js +53 -0
- package/lib/components/pisellDraggable/components/Remove/index.d.ts +1 -0
- package/lib/components/pisellDraggable/components/Remove/index.js +29 -0
- package/lib/components/pisellDraggable/components/TreeItem/SortableTreeItem.d.ts +8 -0
- package/lib/components/pisellDraggable/components/TreeItem/SortableTreeItem.js +83 -0
- package/lib/components/pisellDraggable/components/TreeItem/TreeItem.d.ts +21 -0
- package/lib/components/pisellDraggable/components/TreeItem/TreeItem.js +93 -0
- package/lib/components/pisellDraggable/components/TreeItem/TreeItem.less +128 -0
- package/lib/components/pisellDraggable/components/TreeItem/index.d.ts +2 -0
- package/lib/components/pisellDraggable/components/TreeItem/index.js +32 -0
- package/lib/components/pisellDraggable/components/index.d.ts +4 -0
- package/lib/components/pisellDraggable/components/index.js +40 -0
- package/lib/components/pisellDraggable/index.d.ts +28 -3
- package/lib/components/pisellDraggable/index.js +237 -2
- package/lib/components/pisellDraggable/types.d.ts +15 -99
- package/lib/components/pisellDraggable/utilities.d.ts +17 -0
- package/lib/components/pisellDraggable/utilities.js +190 -0
- package/lib/components/pisellDropSort/PisellDropSort.d.ts +5 -0
- package/lib/components/pisellDropSort/PisellDropSort.js +147 -0
- package/lib/components/pisellDropSort/PisellDropSort.less +92 -0
- package/lib/components/pisellDropSort/components/SortableItem/index.d.ts +19 -0
- package/lib/components/pisellDropSort/components/SortableItem/index.js +164 -0
- package/lib/components/pisellDropSort/components/SortableItem/index.less +155 -0
- package/lib/components/pisellDropSort/index.d.ts +3 -0
- package/lib/components/pisellDropSort/index.js +36 -0
- package/lib/components/pisellDropSort/types.d.ts +42 -0
- package/lib/components/pisellDropSort/types.js +17 -0
- package/lib/components/pisellModal/components/Information/index.js +0 -1
- package/lib/components/versionModal/index.js +1 -1
- package/lib/components/versionModal/index.less +9 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/locales/en-US.d.ts +7 -6
- package/lib/locales/en-US.js +11 -1
- package/lib/locales/zh-CN.d.ts +7 -6
- package/lib/locales/zh-CN.js +10 -1
- package/lib/locales/zh-TW.d.ts +7 -6
- package/lib/locales/zh-TW.js +10 -1
- package/lowcode/custom-select/meta.ts +11 -15
- package/lowcode/form-item-translation/meta.ts +59 -1
- package/lowcode/pisell-drop-sort/meta.ts +343 -0
- package/package.json +2 -2
- package/es/components/pisellDraggable/PisellDraggable.d.ts +0 -18
- package/es/components/pisellDraggable/PisellDraggable.js +0 -190
- package/es/components/pisellDraggable/PisellDraggable.less +0 -154
- package/es/components/pisellDraggable/SortableItem.d.ts +0 -41
- package/es/components/pisellDraggable/SortableItem.js +0 -115
- package/lib/components/pisellDraggable/PisellDraggable.d.ts +0 -18
- package/lib/components/pisellDraggable/PisellDraggable.js +0 -175
- package/lib/components/pisellDraggable/PisellDraggable.less +0 -154
- package/lib/components/pisellDraggable/SortableItem.d.ts +0 -41
- package/lib/components/pisellDraggable/SortableItem.js +0 -127
|
@@ -1,175 +0,0 @@
|
|
|
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/pisellDraggable/PisellDraggable.tsx
|
|
30
|
-
var PisellDraggable_exports = {};
|
|
31
|
-
__export(PisellDraggable_exports, {
|
|
32
|
-
default: () => PisellDraggable_default
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(PisellDraggable_exports);
|
|
35
|
-
var import_core = require("@dnd-kit/core");
|
|
36
|
-
var import_sortable = require("@dnd-kit/sortable");
|
|
37
|
-
var import_react = __toESM(require("react"));
|
|
38
|
-
var import_PisellDraggable = require("./PisellDraggable.less");
|
|
39
|
-
var import_SortableItem = require("./SortableItem");
|
|
40
|
-
var PisellDraggable = ({
|
|
41
|
-
items,
|
|
42
|
-
direction = "vertical",
|
|
43
|
-
columns = 3,
|
|
44
|
-
allowCrossContainer = false,
|
|
45
|
-
onDragStart,
|
|
46
|
-
onDragEnd,
|
|
47
|
-
onChange,
|
|
48
|
-
renderItem,
|
|
49
|
-
className,
|
|
50
|
-
style,
|
|
51
|
-
handleClassName,
|
|
52
|
-
containerStyle,
|
|
53
|
-
disabled = false,
|
|
54
|
-
animationDuration = 250,
|
|
55
|
-
dragMode = "handle",
|
|
56
|
-
indentDistance = 24,
|
|
57
|
-
maxDepth = 0,
|
|
58
|
-
levelStyles = {},
|
|
59
|
-
handleIcon = "⋮",
|
|
60
|
-
animationTiming = "ease",
|
|
61
|
-
dragScale = 1.02,
|
|
62
|
-
currentLevel = 0
|
|
63
|
-
}) => {
|
|
64
|
-
const sensors = (0, import_core.useSensors)(
|
|
65
|
-
(0, import_core.useSensor)(import_core.PointerSensor),
|
|
66
|
-
(0, import_core.useSensor)(import_core.KeyboardSensor, {
|
|
67
|
-
coordinateGetter: import_sortable.sortableKeyboardCoordinates
|
|
68
|
-
})
|
|
69
|
-
);
|
|
70
|
-
const sortingStrategy = (0, import_react.useMemo)(() => {
|
|
71
|
-
switch (direction) {
|
|
72
|
-
case "horizontal":
|
|
73
|
-
return import_sortable.horizontalListSortingStrategy;
|
|
74
|
-
case "grid":
|
|
75
|
-
return import_sortable.rectSortingStrategy;
|
|
76
|
-
default:
|
|
77
|
-
return import_sortable.verticalListSortingStrategy;
|
|
78
|
-
}
|
|
79
|
-
}, [direction]);
|
|
80
|
-
const containerClassName = (0, import_react.useMemo)(() => {
|
|
81
|
-
const baseClass = "pisellDraggable-container";
|
|
82
|
-
return `${baseClass} ${direction} ${className || ""} ${disabled ? "disabled" : ""}`.trim();
|
|
83
|
-
}, [direction, className, disabled]);
|
|
84
|
-
const gridStyle = (0, import_react.useMemo)(() => {
|
|
85
|
-
return direction === "grid" ? {
|
|
86
|
-
...containerStyle,
|
|
87
|
-
gridTemplateColumns: `repeat(${columns}, 1fr)`
|
|
88
|
-
} : containerStyle;
|
|
89
|
-
}, [direction, columns, containerStyle]);
|
|
90
|
-
const handleDragStart = (0, import_react.useCallback)(
|
|
91
|
-
(event) => {
|
|
92
|
-
onDragStart == null ? void 0 : onDragStart(event.active.id);
|
|
93
|
-
},
|
|
94
|
-
[onDragStart]
|
|
95
|
-
);
|
|
96
|
-
const handleNestedChange = (0, import_react.useCallback)(
|
|
97
|
-
(parentId, nestedItems) => {
|
|
98
|
-
const updateNestedItems = (items2) => {
|
|
99
|
-
return items2.map((item) => {
|
|
100
|
-
var _a;
|
|
101
|
-
if (item.id === parentId) {
|
|
102
|
-
return { ...item, children: nestedItems };
|
|
103
|
-
}
|
|
104
|
-
if ((_a = item.children) == null ? void 0 : _a.length) {
|
|
105
|
-
return { ...item, children: updateNestedItems(item.children) };
|
|
106
|
-
}
|
|
107
|
-
return item;
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
const newItems = updateNestedItems(items);
|
|
111
|
-
onChange == null ? void 0 : onChange(newItems);
|
|
112
|
-
},
|
|
113
|
-
[items, onChange]
|
|
114
|
-
);
|
|
115
|
-
const handleDragEnd = (0, import_react.useCallback)(
|
|
116
|
-
(event) => {
|
|
117
|
-
const { active, over } = event;
|
|
118
|
-
if (over && active.id !== over.id) {
|
|
119
|
-
const oldIndex = items.findIndex((item) => item.id === active.id);
|
|
120
|
-
const newIndex = items.findIndex((item) => item.id === over.id);
|
|
121
|
-
const newItems = (0, import_sortable.arrayMove)(items, oldIndex, newIndex);
|
|
122
|
-
onChange == null ? void 0 : onChange(newItems);
|
|
123
|
-
onDragEnd == null ? void 0 : onDragEnd({
|
|
124
|
-
active: items[oldIndex],
|
|
125
|
-
over: items[newIndex]
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
[items, onChange, onDragEnd]
|
|
130
|
-
);
|
|
131
|
-
(0, import_react.useEffect)(() => {
|
|
132
|
-
document.body.id = "body";
|
|
133
|
-
}, []);
|
|
134
|
-
if (disabled || !(items == null ? void 0 : items.length)) {
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { className: containerClassName, style: { ...style, ...gridStyle } }, /* @__PURE__ */ import_react.default.createElement(
|
|
138
|
-
import_core.DndContext,
|
|
139
|
-
{
|
|
140
|
-
sensors,
|
|
141
|
-
collisionDetection: import_core.closestCenter,
|
|
142
|
-
onDragStart: handleDragStart,
|
|
143
|
-
onDragEnd: handleDragEnd
|
|
144
|
-
},
|
|
145
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
146
|
-
import_sortable.SortableContext,
|
|
147
|
-
{
|
|
148
|
-
items: items.map((item) => item.id),
|
|
149
|
-
strategy: sortingStrategy
|
|
150
|
-
},
|
|
151
|
-
items.map((item) => /* @__PURE__ */ import_react.default.createElement(
|
|
152
|
-
import_SortableItem.SortableItem,
|
|
153
|
-
{
|
|
154
|
-
key: item.id,
|
|
155
|
-
id: item.id,
|
|
156
|
-
item,
|
|
157
|
-
renderItem,
|
|
158
|
-
handleClassName,
|
|
159
|
-
animationDuration,
|
|
160
|
-
dragMode,
|
|
161
|
-
onNestedChange: handleNestedChange,
|
|
162
|
-
indentDistance,
|
|
163
|
-
maxDepth,
|
|
164
|
-
levelStyles,
|
|
165
|
-
handleIcon,
|
|
166
|
-
animationTiming,
|
|
167
|
-
dragScale,
|
|
168
|
-
currentLevel
|
|
169
|
-
}
|
|
170
|
-
))
|
|
171
|
-
),
|
|
172
|
-
/* @__PURE__ */ import_react.default.createElement(import_core.DragOverlay, null)
|
|
173
|
-
));
|
|
174
|
-
};
|
|
175
|
-
var PisellDraggable_default = PisellDraggable;
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
/* PisellDraggable 组件样式 */
|
|
2
|
-
.pisellDraggable {
|
|
3
|
-
|
|
4
|
-
/* 容器样式 */
|
|
5
|
-
&-container {
|
|
6
|
-
position: relative;
|
|
7
|
-
|
|
8
|
-
/* 水平布局 */
|
|
9
|
-
&.horizontal {
|
|
10
|
-
display: flex;
|
|
11
|
-
flex-direction: row;
|
|
12
|
-
gap: 8px;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/* 垂直布局 */
|
|
16
|
-
&.vertical {
|
|
17
|
-
display: flex;
|
|
18
|
-
flex-direction: column;
|
|
19
|
-
gap: 8px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/* 网格布局 */
|
|
23
|
-
&.grid {
|
|
24
|
-
display: grid;
|
|
25
|
-
gap: 8px;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/* 拖拽项样式 */
|
|
30
|
-
&-item {
|
|
31
|
-
position: relative;
|
|
32
|
-
touch-action: none;
|
|
33
|
-
user-select: none;
|
|
34
|
-
background: #fff;
|
|
35
|
-
border: 1px solid #e8e8e8;
|
|
36
|
-
border-radius: 4px;
|
|
37
|
-
padding: 12px;
|
|
38
|
-
transition: all var(--animation-duration, 250ms) var(--animation-timing, ease);
|
|
39
|
-
|
|
40
|
-
/* 拖拽时的样式 */
|
|
41
|
-
&.dragging {
|
|
42
|
-
opacity: 0.5;
|
|
43
|
-
cursor: grabbing;
|
|
44
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
45
|
-
transform: scale(var(--drag-scale, 1.02)) !important;
|
|
46
|
-
z-index: 1;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/* 非拖拽状态的变换 */
|
|
50
|
-
&:not(.dragging) {
|
|
51
|
-
transform: translate3d(var(--translate-x, 0), var(--translate-y, 0), 0);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/* 不同层级的背景色 */
|
|
55
|
-
&[data-level="0"] {
|
|
56
|
-
background: #fff;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&[data-level="1"] {
|
|
60
|
-
background: #fafafa;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&[data-level="2"] {
|
|
64
|
-
background: #f5f5f5;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
&[data-level="3"] {
|
|
68
|
-
background: #f0f0f0;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/* 拖拽手柄样式 */
|
|
73
|
-
&-handle {
|
|
74
|
-
cursor: grab;
|
|
75
|
-
display: inline-flex;
|
|
76
|
-
align-items: center;
|
|
77
|
-
justify-content: center;
|
|
78
|
-
width: 24px;
|
|
79
|
-
height: 24px;
|
|
80
|
-
margin-right: 8px;
|
|
81
|
-
color: #999;
|
|
82
|
-
border-radius: 4px;
|
|
83
|
-
transition: all 0.2s;
|
|
84
|
-
|
|
85
|
-
/* 悬停效果 */
|
|
86
|
-
&:hover {
|
|
87
|
-
background: rgba(0, 0, 0, 0.04);
|
|
88
|
-
color: #666;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/* 激活状态 */
|
|
92
|
-
&:active {
|
|
93
|
-
cursor: grabbing;
|
|
94
|
-
background: rgba(0, 0, 0, 0.08);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/* 手柄图标 */
|
|
98
|
-
&-icon {
|
|
99
|
-
font-size: 16px;
|
|
100
|
-
line-height: 1;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/* 内容区域样式 */
|
|
105
|
-
&-content {
|
|
106
|
-
display: inline-flex;
|
|
107
|
-
align-items: center;
|
|
108
|
-
flex: 1;
|
|
109
|
-
min-height: 24px;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/* 嵌套容器样式 */
|
|
113
|
-
&-nested {
|
|
114
|
-
margin-top: 12px;
|
|
115
|
-
margin-left: var(--indent-distance, 24px);
|
|
116
|
-
border-left: 2px solid #f0f0f0;
|
|
117
|
-
padding-left: 12px;
|
|
118
|
-
transition: all 0.3s;
|
|
119
|
-
|
|
120
|
-
/* 嵌套容器的最小高度 */
|
|
121
|
-
.pisellDraggable-container {
|
|
122
|
-
min-height: 32px;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/* 悬停时的边线效果 */
|
|
126
|
-
&:hover {
|
|
127
|
-
border-left-color: #1890ff;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/* 拖拽覆盖层样式 */
|
|
132
|
-
&-overlay {
|
|
133
|
-
position: fixed;
|
|
134
|
-
pointer-events: none;
|
|
135
|
-
z-index: 1000;
|
|
136
|
-
transition: transform 0.15s ease;
|
|
137
|
-
opacity: 0.8;
|
|
138
|
-
transform: scale(1.05);
|
|
139
|
-
|
|
140
|
-
&.dragging {
|
|
141
|
-
cursor: grabbing;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/* 禁用状态样式 */
|
|
146
|
-
&.disabled {
|
|
147
|
-
opacity: 0.5;
|
|
148
|
-
cursor: not-allowed;
|
|
149
|
-
|
|
150
|
-
.pisellDraggable-handle {
|
|
151
|
-
cursor: not-allowed;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DraggableItem } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* 可排序项组件的属性定义
|
|
5
|
-
*/
|
|
6
|
-
interface SortableItemProps {
|
|
7
|
-
/** 项目的唯一标识符 */
|
|
8
|
-
id: string | number;
|
|
9
|
-
/** 项目数据 */
|
|
10
|
-
item: DraggableItem;
|
|
11
|
-
/** 自定义渲染函数 */
|
|
12
|
-
renderItem?: (item: DraggableItem) => React.ReactNode;
|
|
13
|
-
/** 拖拽手柄的自定义类名 */
|
|
14
|
-
handleClassName?: string;
|
|
15
|
-
/** 动画持续时间(毫秒) */
|
|
16
|
-
animationDuration?: number;
|
|
17
|
-
/** 拖动方式 */
|
|
18
|
-
dragMode?: 'handle' | 'item';
|
|
19
|
-
/** 嵌套数据变化的回调函数 */
|
|
20
|
-
onNestedChange?: (parentId: string | number, items: DraggableItem[]) => void;
|
|
21
|
-
/** 缩进距离(像素) */
|
|
22
|
-
indentDistance?: number;
|
|
23
|
-
/** 最大嵌套深度 */
|
|
24
|
-
maxDepth?: number;
|
|
25
|
-
/** 层级样式配置 */
|
|
26
|
-
levelStyles?: Record<number, React.CSSProperties>;
|
|
27
|
-
/** 拖拽手柄图标 */
|
|
28
|
-
handleIcon?: React.ReactNode;
|
|
29
|
-
/** 动画曲线 */
|
|
30
|
-
animationTiming?: 'ease' | 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out';
|
|
31
|
-
/** 拖拽时的缩放比例 */
|
|
32
|
-
dragScale?: number;
|
|
33
|
-
/** 当前嵌套层级 */
|
|
34
|
-
currentLevel?: number;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* 可排序项组件
|
|
38
|
-
* 用于渲染单个可拖拽项,支持嵌套结构和自定义渲染
|
|
39
|
-
*/
|
|
40
|
-
export declare const SortableItem: React.FC<SortableItemProps>;
|
|
41
|
-
export {};
|
|
@@ -1,127 +0,0 @@
|
|
|
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/pisellDraggable/SortableItem.tsx
|
|
30
|
-
var SortableItem_exports = {};
|
|
31
|
-
__export(SortableItem_exports, {
|
|
32
|
-
SortableItem: () => SortableItem
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(SortableItem_exports);
|
|
35
|
-
var import_sortable = require("@dnd-kit/sortable");
|
|
36
|
-
var import_utilities = require("@dnd-kit/utilities");
|
|
37
|
-
var import_react = __toESM(require("react"));
|
|
38
|
-
var import_PisellDraggable = __toESM(require("./PisellDraggable"));
|
|
39
|
-
var SortableItem = ({
|
|
40
|
-
id,
|
|
41
|
-
item,
|
|
42
|
-
renderItem,
|
|
43
|
-
handleClassName,
|
|
44
|
-
animationDuration = 250,
|
|
45
|
-
dragMode = "handle",
|
|
46
|
-
onNestedChange,
|
|
47
|
-
indentDistance = 24,
|
|
48
|
-
maxDepth = 0,
|
|
49
|
-
levelStyles = {},
|
|
50
|
-
handleIcon = "⋮",
|
|
51
|
-
animationTiming = "ease",
|
|
52
|
-
dragScale = 1.02,
|
|
53
|
-
currentLevel = 0
|
|
54
|
-
}) => {
|
|
55
|
-
const {
|
|
56
|
-
attributes,
|
|
57
|
-
listeners,
|
|
58
|
-
setNodeRef,
|
|
59
|
-
transform,
|
|
60
|
-
transition,
|
|
61
|
-
isDragging
|
|
62
|
-
} = (0, import_sortable.useSortable)({ id });
|
|
63
|
-
const style = {
|
|
64
|
-
transform: import_utilities.CSS.Transform.toString(transform),
|
|
65
|
-
transition,
|
|
66
|
-
"--animation-duration": `${animationDuration}ms`,
|
|
67
|
-
"--animation-timing": animationTiming,
|
|
68
|
-
"--drag-scale": dragScale,
|
|
69
|
-
"--indent-distance": `${indentDistance}px`,
|
|
70
|
-
...levelStyles[currentLevel]
|
|
71
|
-
};
|
|
72
|
-
const itemClassName = `pisellDraggable-item ${isDragging ? "dragging" : ""}`;
|
|
73
|
-
const handleNestedChange = (items) => {
|
|
74
|
-
if (maxDepth > 0 && currentLevel >= maxDepth - 1) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
onNestedChange == null ? void 0 : onNestedChange(id, items);
|
|
78
|
-
};
|
|
79
|
-
const renderContent = () => {
|
|
80
|
-
if (renderItem) {
|
|
81
|
-
return renderItem(item);
|
|
82
|
-
}
|
|
83
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, dragMode === "handle" && /* @__PURE__ */ import_react.default.createElement(
|
|
84
|
-
"div",
|
|
85
|
-
{
|
|
86
|
-
className: `pisellDraggable-handle ${handleClassName || ""}`,
|
|
87
|
-
...listeners
|
|
88
|
-
},
|
|
89
|
-
/* @__PURE__ */ import_react.default.createElement("span", { className: "pisellDraggable-handle-icon" }, handleIcon)
|
|
90
|
-
), /* @__PURE__ */ import_react.default.createElement("div", { className: "pisellDraggable-content" }, item.content));
|
|
91
|
-
};
|
|
92
|
-
const hasChildren = Array.isArray(item.children) && item.children.length > 0;
|
|
93
|
-
const canNest = maxDepth === 0 || currentLevel < maxDepth - 1;
|
|
94
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
95
|
-
"div",
|
|
96
|
-
{
|
|
97
|
-
ref: setNodeRef,
|
|
98
|
-
style,
|
|
99
|
-
className: itemClassName,
|
|
100
|
-
"data-level": currentLevel,
|
|
101
|
-
...attributes,
|
|
102
|
-
...dragMode === "item" ? listeners : {}
|
|
103
|
-
},
|
|
104
|
-
renderContent(),
|
|
105
|
-
hasChildren && canNest && /* @__PURE__ */ import_react.default.createElement("div", { className: "pisellDraggable-nested" }, /* @__PURE__ */ import_react.default.createElement(
|
|
106
|
-
import_PisellDraggable.default,
|
|
107
|
-
{
|
|
108
|
-
items: item.children,
|
|
109
|
-
onChange: handleNestedChange,
|
|
110
|
-
dragMode,
|
|
111
|
-
handleClassName,
|
|
112
|
-
animationDuration,
|
|
113
|
-
indentDistance,
|
|
114
|
-
maxDepth,
|
|
115
|
-
levelStyles,
|
|
116
|
-
handleIcon,
|
|
117
|
-
animationTiming,
|
|
118
|
-
dragScale,
|
|
119
|
-
currentLevel: currentLevel + 1
|
|
120
|
-
}
|
|
121
|
-
))
|
|
122
|
-
);
|
|
123
|
-
};
|
|
124
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
125
|
-
0 && (module.exports = {
|
|
126
|
-
SortableItem
|
|
127
|
-
});
|