@canvas-components/react-drag-any 1.0.0 → 1.0.2
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/index.cjs +7 -9
- package/dist/index.js +7 -9
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1159,6 +1159,7 @@ function useDragAny(props, owner, group, events) {
|
|
|
1159
1159
|
theme: current.theme,
|
|
1160
1160
|
selectedCardIds: current.selectedCardIds,
|
|
1161
1161
|
...bridge2,
|
|
1162
|
+
onMoveRequest: current.onMoveRequest ? bridge2.onMoveRequest : void 0,
|
|
1162
1163
|
canDrag: current.canDrag ? bridge2.canDrag : void 0,
|
|
1163
1164
|
canDrop: current.canDrop ? bridge2.canDrop : void 0
|
|
1164
1165
|
};
|
|
@@ -1303,7 +1304,7 @@ function useDragAny(props, owner, group, events) {
|
|
|
1303
1304
|
current.scrollbar,
|
|
1304
1305
|
bridge
|
|
1305
1306
|
);
|
|
1306
|
-
if (Object.keys(options).some(
|
|
1307
|
+
if (previous.canDrag !== props.canDrag || Object.keys(options).some(
|
|
1307
1308
|
(key) => options[key] !== current.options[key]
|
|
1308
1309
|
)) {
|
|
1309
1310
|
current.options = options;
|
|
@@ -2004,8 +2005,7 @@ function DeclarativeBoard(props, ref) {
|
|
|
2004
2005
|
...member,
|
|
2005
2006
|
ref,
|
|
2006
2007
|
layout: published.layout,
|
|
2007
|
-
render: published.render
|
|
2008
|
-
canDrag: group.allowsMove ? board.canDrag : denyDrag
|
|
2008
|
+
render: published.render
|
|
2009
2009
|
}
|
|
2010
2010
|
);
|
|
2011
2011
|
}
|
|
@@ -2013,7 +2013,6 @@ function DeclarativeBoard(props, ref) {
|
|
|
2013
2013
|
ModelBoard,
|
|
2014
2014
|
{
|
|
2015
2015
|
...board,
|
|
2016
|
-
canDrag: board.onMoveRequest ? board.canDrag : denyDrag,
|
|
2017
2016
|
ref,
|
|
2018
2017
|
model: projection.model,
|
|
2019
2018
|
layout: projection.layout,
|
|
@@ -2024,7 +2023,6 @@ function DeclarativeBoard(props, ref) {
|
|
|
2024
2023
|
var emptySubscription = () => () => {
|
|
2025
2024
|
};
|
|
2026
2025
|
var emptySnapshot = () => void 0;
|
|
2027
|
-
var denyDrag = () => false;
|
|
2028
2026
|
var StructureBoard = react.forwardRef(DeclarativeBoard);
|
|
2029
2027
|
var ReactDragAny = StructureBoard;
|
|
2030
2028
|
function Group(props, ref) {
|
|
@@ -2037,10 +2035,8 @@ function Group(props, ref) {
|
|
|
2037
2035
|
const published = react.useRef(/* @__PURE__ */ new Map());
|
|
2038
2036
|
const scheduled = react.useRef(false);
|
|
2039
2037
|
const previousAck = react.useRef();
|
|
2040
|
-
const allowsMove = props.onMoveRequest !== void 0;
|
|
2041
2038
|
const manager = react.useMemo(
|
|
2042
2039
|
() => ({
|
|
2043
|
-
allowsMove,
|
|
2044
2040
|
getProjection: (id) => published.current.get(id),
|
|
2045
2041
|
stageProjection(id, projection) {
|
|
2046
2042
|
projected.current.set(id, projection);
|
|
@@ -2055,7 +2051,9 @@ function Group(props, ref) {
|
|
|
2055
2051
|
ensureGroup() {
|
|
2056
2052
|
if (current.current) return current.current;
|
|
2057
2053
|
const group = new dragAny.DragAnyGroup({
|
|
2058
|
-
onMoveRequest
|
|
2054
|
+
get onMoveRequest() {
|
|
2055
|
+
return committed.current.onMoveRequest;
|
|
2056
|
+
},
|
|
2059
2057
|
onError: (error) => committed.current.onError?.(error)
|
|
2060
2058
|
});
|
|
2061
2059
|
current.current = group;
|
|
@@ -2069,7 +2067,7 @@ function Group(props, ref) {
|
|
|
2069
2067
|
};
|
|
2070
2068
|
}
|
|
2071
2069
|
}),
|
|
2072
|
-
[committed
|
|
2070
|
+
[committed]
|
|
2073
2071
|
);
|
|
2074
2072
|
function queuePublish() {
|
|
2075
2073
|
if (scheduled.current) return;
|
package/dist/index.js
CHANGED
|
@@ -1157,6 +1157,7 @@ function useDragAny(props, owner, group, events) {
|
|
|
1157
1157
|
theme: current.theme,
|
|
1158
1158
|
selectedCardIds: current.selectedCardIds,
|
|
1159
1159
|
...bridge2,
|
|
1160
|
+
onMoveRequest: current.onMoveRequest ? bridge2.onMoveRequest : void 0,
|
|
1160
1161
|
canDrag: current.canDrag ? bridge2.canDrag : void 0,
|
|
1161
1162
|
canDrop: current.canDrop ? bridge2.canDrop : void 0
|
|
1162
1163
|
};
|
|
@@ -1301,7 +1302,7 @@ function useDragAny(props, owner, group, events) {
|
|
|
1301
1302
|
current.scrollbar,
|
|
1302
1303
|
bridge
|
|
1303
1304
|
);
|
|
1304
|
-
if (Object.keys(options).some(
|
|
1305
|
+
if (previous.canDrag !== props.canDrag || Object.keys(options).some(
|
|
1305
1306
|
(key) => options[key] !== current.options[key]
|
|
1306
1307
|
)) {
|
|
1307
1308
|
current.options = options;
|
|
@@ -2002,8 +2003,7 @@ function DeclarativeBoard(props, ref) {
|
|
|
2002
2003
|
...member,
|
|
2003
2004
|
ref,
|
|
2004
2005
|
layout: published.layout,
|
|
2005
|
-
render: published.render
|
|
2006
|
-
canDrag: group.allowsMove ? board.canDrag : denyDrag
|
|
2006
|
+
render: published.render
|
|
2007
2007
|
}
|
|
2008
2008
|
);
|
|
2009
2009
|
}
|
|
@@ -2011,7 +2011,6 @@ function DeclarativeBoard(props, ref) {
|
|
|
2011
2011
|
ModelBoard,
|
|
2012
2012
|
{
|
|
2013
2013
|
...board,
|
|
2014
|
-
canDrag: board.onMoveRequest ? board.canDrag : denyDrag,
|
|
2015
2014
|
ref,
|
|
2016
2015
|
model: projection.model,
|
|
2017
2016
|
layout: projection.layout,
|
|
@@ -2022,7 +2021,6 @@ function DeclarativeBoard(props, ref) {
|
|
|
2022
2021
|
var emptySubscription = () => () => {
|
|
2023
2022
|
};
|
|
2024
2023
|
var emptySnapshot = () => void 0;
|
|
2025
|
-
var denyDrag = () => false;
|
|
2026
2024
|
var StructureBoard = forwardRef(DeclarativeBoard);
|
|
2027
2025
|
var ReactDragAny = StructureBoard;
|
|
2028
2026
|
function Group(props, ref) {
|
|
@@ -2035,10 +2033,8 @@ function Group(props, ref) {
|
|
|
2035
2033
|
const published = useRef(/* @__PURE__ */ new Map());
|
|
2036
2034
|
const scheduled = useRef(false);
|
|
2037
2035
|
const previousAck = useRef();
|
|
2038
|
-
const allowsMove = props.onMoveRequest !== void 0;
|
|
2039
2036
|
const manager = useMemo(
|
|
2040
2037
|
() => ({
|
|
2041
|
-
allowsMove,
|
|
2042
2038
|
getProjection: (id) => published.current.get(id),
|
|
2043
2039
|
stageProjection(id, projection) {
|
|
2044
2040
|
projected.current.set(id, projection);
|
|
@@ -2053,7 +2049,9 @@ function Group(props, ref) {
|
|
|
2053
2049
|
ensureGroup() {
|
|
2054
2050
|
if (current.current) return current.current;
|
|
2055
2051
|
const group = new DragAnyGroup({
|
|
2056
|
-
onMoveRequest
|
|
2052
|
+
get onMoveRequest() {
|
|
2053
|
+
return committed.current.onMoveRequest;
|
|
2054
|
+
},
|
|
2057
2055
|
onError: (error) => committed.current.onError?.(error)
|
|
2058
2056
|
});
|
|
2059
2057
|
current.current = group;
|
|
@@ -2067,7 +2065,7 @@ function Group(props, ref) {
|
|
|
2067
2065
|
};
|
|
2068
2066
|
}
|
|
2069
2067
|
}),
|
|
2070
|
-
[committed
|
|
2068
|
+
[committed]
|
|
2071
2069
|
);
|
|
2072
2070
|
function queuePublish() {
|
|
2073
2071
|
if (scheduled.current) return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canvas-components/react-drag-any",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "通用 Canvas 拖拽的 React 适配包。",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"react-dom": ">=18.3.1"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@canvas-components/react-canvas-ui": "1.0.
|
|
42
|
-
"@canvas-components/drag-any": "1.0.
|
|
41
|
+
"@canvas-components/react-canvas-ui": "1.0.2",
|
|
42
|
+
"@canvas-components/drag-any": "1.0.2"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "tsup --config tsup.config.ts"
|