@pisell/materials 6.12.104 → 6.12.105
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/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +2 -2
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +2 -2
- package/es/components/pisellDraggable/components/TreeItem/SortableTreeItem.js +44 -5
- package/es/components/pisellDraggable/components/TreeItem/TreeItem.d.ts +2 -1
- package/es/components/pisellDraggable/components/TreeItem/TreeItem.js +5 -2
- package/es/components/pisellDraggable/components/TreeItem/TreeItem.less +4 -2
- package/es/components/pisellDraggable/index.d.ts +3 -1
- package/es/components/pisellDraggable/index.js +287 -207
- package/es/components/pisellDraggable/types.d.ts +3 -1
- package/es/components/pisellDraggable/utilities.js +90 -79
- package/es/components/pisellDropSort/PisellDropSort.js +11 -4
- package/es/components/pisellDropSort/components/SortableItem/index.js +8 -5
- package/es/components/pisellDropSort/components/SortableItem/index.less +22 -0
- package/es/components/pisellDropSort/types.d.ts +1 -0
- package/es/components/pisellNavigationMenu/PisellNavigationMenu.js +44 -21
- package/es/components/pisellNavigationMenu/PisellNavigationMenu.less +7 -0
- package/es/components/pisellNavigationMenu/index.d.ts +1 -1
- package/es/components/pisellNavigationMenu/types.d.ts +15 -2
- package/lib/components/pisellDraggable/components/TreeItem/SortableTreeItem.js +43 -3
- package/lib/components/pisellDraggable/components/TreeItem/TreeItem.d.ts +2 -1
- package/lib/components/pisellDraggable/components/TreeItem/TreeItem.js +5 -2
- package/lib/components/pisellDraggable/components/TreeItem/TreeItem.less +4 -2
- package/lib/components/pisellDraggable/index.d.ts +3 -1
- package/lib/components/pisellDraggable/index.js +281 -201
- package/lib/components/pisellDraggable/types.d.ts +3 -1
- package/lib/components/pisellDraggable/utilities.js +90 -79
- package/lib/components/pisellDropSort/PisellDropSort.js +10 -3
- package/lib/components/pisellDropSort/components/SortableItem/index.js +8 -5
- package/lib/components/pisellDropSort/components/SortableItem/index.less +22 -0
- package/lib/components/pisellDropSort/types.d.ts +1 -0
- package/lib/components/pisellNavigationMenu/PisellNavigationMenu.js +44 -21
- package/lib/components/pisellNavigationMenu/PisellNavigationMenu.less +7 -0
- package/lib/components/pisellNavigationMenu/index.d.ts +1 -1
- package/lib/components/pisellNavigationMenu/types.d.ts +15 -2
- package/package.json +1 -1
|
@@ -2,14 +2,50 @@ import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122
|
|
|
2
2
|
import { _objectWithoutProperties } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
|
|
3
3
|
import { TreeItem } from "./TreeItem.js";
|
|
4
4
|
import { iOS } from "../../utilities.js";
|
|
5
|
-
import React, { memo } from "react";
|
|
5
|
+
import React, { memo, useCallback, useMemo } from "react";
|
|
6
|
+
import { useDraggable } from "@dnd-kit/core";
|
|
6
7
|
import { useSortable } from "@dnd-kit/sortable";
|
|
7
8
|
import { CSS } from "@dnd-kit/utilities";
|
|
8
9
|
//#region src/components/pisellDraggable/components/TreeItem/SortableTreeItem.tsx
|
|
9
|
-
const _excluded = [
|
|
10
|
+
const _excluded = [
|
|
11
|
+
"id",
|
|
12
|
+
"item",
|
|
13
|
+
"onCollapseItem",
|
|
14
|
+
"onRemoveItem",
|
|
15
|
+
"setRowNode"
|
|
16
|
+
], _excluded2 = [
|
|
17
|
+
"id",
|
|
18
|
+
"depth",
|
|
19
|
+
"item",
|
|
20
|
+
"onCollapseItem",
|
|
21
|
+
"onRemoveItem"
|
|
22
|
+
];
|
|
10
23
|
const animateLayoutChanges = ({ isSorting, wasDragging }) => isSorting || wasDragging ? false : true;
|
|
11
|
-
const
|
|
12
|
-
|
|
24
|
+
const NavigationTreeItem = memo(TreeItem);
|
|
25
|
+
const DropTreeItem = memo(function DropTreeItem(_ref) {
|
|
26
|
+
let { id, item, onCollapseItem, onRemoveItem, setRowNode } = _ref, props = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
+
const { attributes, isDragging, listeners, setNodeRef } = useDraggable({
|
|
28
|
+
id,
|
|
29
|
+
disabled: item.isSection,
|
|
30
|
+
attributes: { roleDescription: "sortable" }
|
|
31
|
+
});
|
|
32
|
+
const setWrapperRef = useCallback((node) => setRowNode(id, node), [id, setRowNode]);
|
|
33
|
+
const handleProps = useMemo(() => _objectSpread2(_objectSpread2({}, attributes), listeners), [attributes, listeners]);
|
|
34
|
+
const collapse = useCallback(() => onCollapseItem === null || onCollapseItem === void 0 ? void 0 : onCollapseItem(id), [id, onCollapseItem]);
|
|
35
|
+
const remove = useCallback(() => onRemoveItem === null || onRemoveItem === void 0 ? void 0 : onRemoveItem(item), [item, onRemoveItem]);
|
|
36
|
+
return /* @__PURE__ */ React.createElement(NavigationTreeItem, _objectSpread2({
|
|
37
|
+
ref: setNodeRef,
|
|
38
|
+
wrapperRef: setWrapperRef,
|
|
39
|
+
item,
|
|
40
|
+
ghost: isDragging,
|
|
41
|
+
disableSelection: iOS,
|
|
42
|
+
onCollapse: onCollapseItem ? collapse : void 0,
|
|
43
|
+
onRemove: onRemoveItem ? remove : void 0,
|
|
44
|
+
handleProps
|
|
45
|
+
}, props));
|
|
46
|
+
});
|
|
47
|
+
const SortableTreeItem = (_ref2) => {
|
|
48
|
+
let { id, depth, item, onCollapseItem, onRemoveItem } = _ref2, props = _objectWithoutProperties(_ref2, _excluded2);
|
|
13
49
|
const { attributes, isDragging, isSorting, listeners, setDraggableNodeRef, setDroppableNodeRef, transform, transition } = useSortable({
|
|
14
50
|
id,
|
|
15
51
|
animateLayoutChanges
|
|
@@ -23,6 +59,9 @@ const SortableTreeItem = (_ref) => {
|
|
|
23
59
|
wrapperRef: setDroppableNodeRef,
|
|
24
60
|
style,
|
|
25
61
|
depth,
|
|
62
|
+
item,
|
|
63
|
+
onCollapse: onCollapseItem ? () => onCollapseItem(id) : void 0,
|
|
64
|
+
onRemove: onRemoveItem ? () => onRemoveItem(item) : void 0,
|
|
26
65
|
ghost: isDragging,
|
|
27
66
|
disableSelection: iOS,
|
|
28
67
|
disableInteraction: isSorting,
|
|
@@ -31,4 +70,4 @@ const SortableTreeItem = (_ref) => {
|
|
|
31
70
|
};
|
|
32
71
|
var SortableTreeItem_default = memo(SortableTreeItem);
|
|
33
72
|
//#endregion
|
|
34
|
-
export { SortableTreeItem_default as default };
|
|
73
|
+
export { DropTreeItem, SortableTreeItem_default as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TreeItem } from "../../types.js";
|
|
1
|
+
import { DropPosition, TreeItem } from "../../types.js";
|
|
2
2
|
import React, { HTMLAttributes } from "react";
|
|
3
3
|
//#region src/components/pisellDraggable/components/TreeItem/TreeItem.d.ts
|
|
4
4
|
interface Props extends Omit<HTMLAttributes<HTMLLIElement>, 'id'> {
|
|
@@ -20,6 +20,7 @@ interface Props extends Omit<HTMLAttributes<HTMLLIElement>, 'id'> {
|
|
|
20
20
|
__designMode?: string;
|
|
21
21
|
isBlocked?: boolean;
|
|
22
22
|
isError?: boolean;
|
|
23
|
+
dropPosition?: DropPosition;
|
|
23
24
|
}
|
|
24
25
|
//#endregion
|
|
25
26
|
export { Props };
|
|
@@ -25,14 +25,17 @@ const _excluded = [
|
|
|
25
25
|
"item",
|
|
26
26
|
"renderItem",
|
|
27
27
|
"isBlocked",
|
|
28
|
+
"isError",
|
|
29
|
+
"dropPosition",
|
|
28
30
|
"__designMode"
|
|
29
31
|
];
|
|
30
32
|
const TreeItem = forwardRef((props, ref) => {
|
|
31
|
-
const { childCount, clone, depth, disableSelection, disableInteraction, ghost, handleProps, indentationWidth, indicator, collapsed, onCollapse, onRemove, style, wrapperRef, item, renderItem, isBlocked, __designMode } = props, otherProps = _objectWithoutProperties(props, _excluded);
|
|
32
|
-
if (renderItem) return renderItem(props, ref);
|
|
33
|
+
const { childCount, clone, depth, disableSelection, disableInteraction, ghost, handleProps, indentationWidth, indicator, collapsed, onCollapse, onRemove, style, wrapperRef, item, renderItem, isBlocked, isError, dropPosition, __designMode } = props, otherProps = _objectWithoutProperties(props, _excluded);
|
|
34
|
+
if (renderItem) return /* @__PURE__ */ React.createElement(React.Fragment, null, renderItem(props, ref));
|
|
33
35
|
return /* @__PURE__ */ React.createElement("li", _objectSpread2({
|
|
34
36
|
className: classNames("Wrapper", clone && "clone", ghost && "ghost", indicator && "indicator", disableSelection && "disableSelection", disableInteraction && "disableInteraction"),
|
|
35
37
|
ref: wrapperRef,
|
|
38
|
+
"data-drop-position": dropPosition,
|
|
36
39
|
style: { "--spacing": `${indentationWidth * depth}px` }
|
|
37
40
|
}, otherProps), /* @__PURE__ */ React.createElement("div", {
|
|
38
41
|
className: "TreeItem",
|
|
@@ -103,7 +103,9 @@
|
|
|
103
103
|
color: #fff;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
.disableInteraction
|
|
106
|
+
.disableInteraction,
|
|
107
|
+
[data-pisell-drop-sort-dragging] > .Wrapper,
|
|
108
|
+
[data-pisell-drop-sort-dragging] > .pisell-lowcode-drop-sort-item {
|
|
107
109
|
pointer-events: none;
|
|
108
110
|
}
|
|
109
111
|
|
|
@@ -125,4 +127,4 @@
|
|
|
125
127
|
&.collapsed svg {
|
|
126
128
|
transform: rotate(-90deg);
|
|
127
129
|
}
|
|
128
|
-
}
|
|
130
|
+
}
|
|
@@ -16,7 +16,7 @@ interface Props {
|
|
|
16
16
|
/** 是否支持删除节点功能 */
|
|
17
17
|
removable?: boolean;
|
|
18
18
|
/** 自定义渲染树节点 */
|
|
19
|
-
renderItem?:
|
|
19
|
+
renderItem?: Props$1['renderItem'];
|
|
20
20
|
/** 树形数据变化回调 */
|
|
21
21
|
onChange?: (items: TreeItems) => void;
|
|
22
22
|
/** 删除节点前 */
|
|
@@ -27,6 +27,8 @@ interface Props {
|
|
|
27
27
|
maxLevel?: number;
|
|
28
28
|
/** 自定义拖拽判断函数,返回false时阻止拖拽 */
|
|
29
29
|
canDrop?: (dragItem: FlattenedItem, dropTarget: FlattenedItem, parentId: UniqueIdentifier | null, parentNode: any) => boolean;
|
|
30
|
+
dropOnPageAsSibling?: boolean;
|
|
31
|
+
dropBoundary?: React.RefObject<HTMLElement>;
|
|
30
32
|
}
|
|
31
33
|
declare const Demo: (props: Props) => React.JSX.Element;
|
|
32
34
|
//#endregion
|