@progress/kendo-react-diagram 16.2.0-develop.9 → 16.2.1-develop.1
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/Diagram.js +1 -1
- package/Diagram.mjs +119 -114
- package/EULA.pdf +0 -0
- package/EULA.rtf +2730 -0
- package/EULA.txt +292 -0
- package/dist/cdn/js/kendo-react-diagram.js +1 -1
- package/index.d.mts +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -1
- package/index.mjs +25 -23
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +9 -9
- package/rich-text-editing/DiagramEditor.js +1 -1
- package/rich-text-editing/DiagramEditor.mjs +49 -48
- package/rich-text-editing/MainToolbar.d.ts +1 -1
- package/rich-text-editing/MainToolbar.js +1 -1
- package/rich-text-editing/MainToolbar.mjs +55 -71
- package/rich-text-editing/types.d.ts +1 -1
- package/utils/consts.d.ts +5 -0
- package/utils/consts.js +1 -1
- package/utils/consts.mjs +8 -3
package/Diagram.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const De=require("react"),m=require("@progress/kendo-react-common"),x=require("@progress/kendo-diagram-common"),j=require("./package-metadata.js"),he=require("./DiagramConnectionTooltip.js"),ye=require("./DiagramShapeTooltip.js"),be=require("./hooks/useDiagramTooltip.js"),ze=require("./hooks/useDiagramData.js"),ve=require("./hooks/useDiagramEvents.js"),n=require("./utils/consts.js"),L=require("./utils/navigate.js");function Me(i){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const r in i)if(r!=="default"){const p=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(s,r,p.get?p:{enumerable:!0,get:()=>i[r]})}}return s.default=i,Object.freeze(s)}const o=Me(De),W=o.forwardRef((i,s)=>{const{connectionDefaults:r,connections:p=n.diagramDefaultProps.connections,connectionModelFields:A,editable:g=n.diagramDefaultProps.editable,layout:D,pannable:h=n.diagramDefaultProps.pannable,selectable:y=n.diagramDefaultProps.selectable,shapeDefaults:b,shapes:V=n.diagramDefaultProps.shapes,shapeModelFields:F,zoom:z=n.diagramDefaultProps.zoom,zoomMax:v=n.diagramDefaultProps.zoomMax,zoomMin:M=n.diagramDefaultProps.zoomMin,zoomRate:R=n.diagramDefaultProps.zoomRate,navigable:E,onChange:H,onDiagramClick:K,onDrag:Z,onDragEnd:_,onDragStart:B,onShapeBoundsChange:I,onMouseEnter:G,onMouseLeave:J,onPan:Q,onSelect:U,onZoomEnd:X,onZoomStart:Y,onTooltipShow:$,onTooltipHide:ee,style:ae,className:oe,role:S=n.diagramDefaultProps.role,ariaLabel:T,children:l}=i,c=o.useRef(null),u=o.useRef(null),[te,ne]=o.useState(null),se=!m.validatePackage(j.packageMetadata,{component:"Diagram"}),ie=m.getLicenseMessage(j.packageMetadata),k=o.useMemo(()=>L.normalizeNavigable(E),[E]),P=o.useCallback(a=>{u.current=a,typeof s=="function"?s(a):s&&(s.current=a),ne(a)},[s]),{convertedShapes:C,convertedConnections:N}=ze.useDiagramData(V,p,F,A),O=o.useMemo(()=>({role:S,ariaLabel:T,ariaRoleDescription:"Diagram"}),[S,T]),e=o.useMemo(()=>({shapes:C,connections:N,selectable:y,editable:g,zoom:z,zoomMax:v,zoomMin:M,zoomRate:R,layout:D,pannable:h,shapeDefaults:b,connectionDefaults:r,navigation:L.toNavigationOptions(k),accessibility:O}),[C,N,y,g,z,v,M,R,D,h,b,r,k,O]),re=o.useMemo(()=>{const a=o.Children.toArray(l).find(t=>o.isValidElement(t)&&t.type===ye.DiagramShapeTooltip);return a?a.props.children:null},[l]),le=o.useMemo(()=>{const a=o.Children.toArray(l).find(t=>o.isValidElement(t)&&t.type===he.DiagramConnectionTooltip);return a?a.props.children:null},[l]),q=o.Children.toArray(l).find(a=>o.isValidElement(a)&&typeof a.type=="function"&&"displayName"in a.type&&a.type.displayName==="KendoDiagramEditor"),{tooltipState:d,tooltipElRef:ce,hideTooltip:ue,handleTooltipShow:me,handleTooltipHide:pe}=be.useDiagramTooltip({shapeTooltipRender:re,connectionTooltipRender:le,diagramRef:u,wrapperRef:c,onTooltipShow:$,onTooltipHide:ee}),{bindDiagramEvents:de}=ve.useDiagramEvents({handlers:{onChange:H,onDiagramClick:K,onDrag:Z,onDragEnd:_,onDragStart:B,onShapeBoundsChange:I,onMouseEnter:G,onMouseLeave:J,onPan:Q,onSelect:U,onZoomEnd:X,onZoomStart:Y},handleTooltipShow:me,handleTooltipHide:pe}),f=o.useRef(!1),w=o.useRef(e);return o.useEffect(()=>{if(!c.current)return;const a=x.loadTheme(c.current),t=new x.Diagram(c.current,e,a);return t._createOptionElements(),t.zoom(t.options.zoom),t.canvas.draw(),u.current=t,P(t),de(t,e),f.current=!0,()=>{ue(),t.destroy(),P(null),f.current=!1}},[]),o.useEffect(()=>{if(!u.current||!f.current)return;const a=u.current,t=w.current;(t.shapes!==e.shapes||t.connections!==e.connections)&&a.load(e),(t.layout!==e.layout||t.shapes!==e.shapes||t.connections!==e.connections)&&a.layout(e.layout),t.zoom!==e.zoom&&a.zoom(e.zoom);const fe=t.connectionDefaults===e.connectionDefaults?e.connectionDefaults:{...a.options.connectionDefaults,...e.connectionDefaults},ge=t.shapeDefaults===e.shapeDefaults?e.shapeDefaults:{...a.options.shapeDefaults,...e.shapeDefaults};a.setOptions({zoom:e.zoom,zoomMax:e.zoomMax,zoomMin:e.zoomMin,zoomRate:e.zoomRate,selectable:e.selectable,pannable:e.pannable,layout:e.layout,navigation:e.navigation,connectionDefaults:fe,shapeDefaults:ge}),w.current=e},[e]),o.createElement("div",{ref:c,className:m.classNames("k-diagram",oe),style:{display:"block",position:"relative",cursor:"default",...ae}},d.visible&&o.createElement("div",{ref:ce,className:m.classNames("k-popup","k-tooltip",d.className),style:d.style},d.content),se&&o.createElement(m.WatermarkOverlay,{message:ie}),q&&o.cloneElement(q,{diagram:te}))});W.displayName="KendoDiagram";exports.Diagram=W;
|
package/Diagram.mjs
CHANGED
|
@@ -5,152 +5,154 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import { validatePackage as
|
|
10
|
-
import { loadTheme as
|
|
11
|
-
import { packageMetadata as
|
|
12
|
-
import { DiagramConnectionTooltip as
|
|
13
|
-
import { DiagramShapeTooltip as
|
|
14
|
-
import { useDiagramTooltip as
|
|
15
|
-
import { useDiagramData as
|
|
16
|
-
import { useDiagramEvents as
|
|
17
|
-
import { diagramDefaultProps as
|
|
18
|
-
import { normalizeNavigable as
|
|
19
|
-
const
|
|
8
|
+
import * as t from "react";
|
|
9
|
+
import { validatePackage as fe, getLicenseMessage as de, classNames as O, WatermarkOverlay as ge } from "@progress/kendo-react-common";
|
|
10
|
+
import { loadTheme as De, Diagram as he } from "@progress/kendo-diagram-common";
|
|
11
|
+
import { packageMetadata as w } from "./package-metadata.mjs";
|
|
12
|
+
import { DiagramConnectionTooltip as ye } from "./DiagramConnectionTooltip.mjs";
|
|
13
|
+
import { DiagramShapeTooltip as ze } from "./DiagramShapeTooltip.mjs";
|
|
14
|
+
import { useDiagramTooltip as ve } from "./hooks/useDiagramTooltip.mjs";
|
|
15
|
+
import { useDiagramData as be } from "./hooks/useDiagramData.mjs";
|
|
16
|
+
import { useDiagramEvents as Me } from "./hooks/useDiagramEvents.mjs";
|
|
17
|
+
import { diagramDefaultProps as n } from "./utils/consts.mjs";
|
|
18
|
+
import { normalizeNavigable as Re, toNavigationOptions as Ee } from "./utils/navigate.mjs";
|
|
19
|
+
const Ne = t.forwardRef((L, s) => {
|
|
20
20
|
const {
|
|
21
21
|
connectionDefaults: p,
|
|
22
|
-
connections:
|
|
23
|
-
connectionModelFields:
|
|
24
|
-
editable: u =
|
|
22
|
+
connections: W = n.connections,
|
|
23
|
+
connectionModelFields: A,
|
|
24
|
+
editable: u = n.editable,
|
|
25
25
|
layout: f,
|
|
26
|
-
pannable: d =
|
|
27
|
-
selectable: g =
|
|
28
|
-
shapeDefaults:
|
|
29
|
-
shapes:
|
|
30
|
-
shapeModelFields:
|
|
31
|
-
zoom:
|
|
32
|
-
zoomMax:
|
|
33
|
-
zoomMin:
|
|
34
|
-
zoomRate: v =
|
|
26
|
+
pannable: d = n.pannable,
|
|
27
|
+
selectable: g = n.selectable,
|
|
28
|
+
shapeDefaults: D,
|
|
29
|
+
shapes: P = n.shapes,
|
|
30
|
+
shapeModelFields: V,
|
|
31
|
+
zoom: h = n.zoom,
|
|
32
|
+
zoomMax: y = n.zoomMax,
|
|
33
|
+
zoomMin: z = n.zoomMin,
|
|
34
|
+
zoomRate: v = n.zoomRate,
|
|
35
35
|
navigable: b,
|
|
36
|
-
onChange:
|
|
37
|
-
onDiagramClick:
|
|
38
|
-
onDrag:
|
|
36
|
+
onChange: F,
|
|
37
|
+
onDiagramClick: H,
|
|
38
|
+
onDrag: K,
|
|
39
39
|
onDragEnd: Z,
|
|
40
40
|
onDragStart: B,
|
|
41
41
|
onShapeBoundsChange: I,
|
|
42
|
-
onMouseEnter:
|
|
43
|
-
onMouseLeave:
|
|
44
|
-
onPan:
|
|
45
|
-
onSelect:
|
|
46
|
-
onZoomEnd:
|
|
47
|
-
onZoomStart:
|
|
48
|
-
onTooltipShow:
|
|
49
|
-
onTooltipHide:
|
|
50
|
-
style:
|
|
51
|
-
className:
|
|
52
|
-
role: M =
|
|
42
|
+
onMouseEnter: $,
|
|
43
|
+
onMouseLeave: j,
|
|
44
|
+
onPan: q,
|
|
45
|
+
onSelect: G,
|
|
46
|
+
onZoomEnd: J,
|
|
47
|
+
onZoomStart: Q,
|
|
48
|
+
onTooltipShow: U,
|
|
49
|
+
onTooltipHide: X,
|
|
50
|
+
style: Y,
|
|
51
|
+
className: _,
|
|
52
|
+
role: M = n.role,
|
|
53
53
|
ariaLabel: R,
|
|
54
|
-
children:
|
|
55
|
-
} =
|
|
56
|
-
(
|
|
57
|
-
|
|
54
|
+
children: i
|
|
55
|
+
} = L, r = t.useRef(null), l = t.useRef(null), [ee, oe] = t.useState(null), te = !fe(w, { component: "Diagram" }), ae = de(w), E = t.useMemo(() => Re(b), [b]), N = t.useCallback(
|
|
56
|
+
(o) => {
|
|
57
|
+
l.current = o, typeof s == "function" ? s(o) : s && (s.current = o), oe(o);
|
|
58
58
|
},
|
|
59
59
|
[s]
|
|
60
|
-
), { convertedShapes:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
),
|
|
60
|
+
), { convertedShapes: S, convertedConnections: T } = be(
|
|
61
|
+
P,
|
|
62
|
+
W,
|
|
63
|
+
V,
|
|
64
|
+
A
|
|
65
|
+
), k = t.useMemo(
|
|
66
66
|
() => ({
|
|
67
67
|
role: M,
|
|
68
68
|
ariaLabel: R,
|
|
69
69
|
ariaRoleDescription: "Diagram"
|
|
70
70
|
}),
|
|
71
71
|
[M, R]
|
|
72
|
-
), e =
|
|
72
|
+
), e = t.useMemo(
|
|
73
73
|
() => ({
|
|
74
|
-
shapes:
|
|
75
|
-
connections:
|
|
74
|
+
shapes: S,
|
|
75
|
+
connections: T,
|
|
76
76
|
selectable: g,
|
|
77
77
|
editable: u,
|
|
78
|
-
zoom:
|
|
79
|
-
zoomMax:
|
|
80
|
-
zoomMin:
|
|
78
|
+
zoom: h,
|
|
79
|
+
zoomMax: y,
|
|
80
|
+
zoomMin: z,
|
|
81
81
|
zoomRate: v,
|
|
82
82
|
layout: f,
|
|
83
83
|
pannable: d,
|
|
84
|
-
shapeDefaults:
|
|
84
|
+
shapeDefaults: D,
|
|
85
85
|
connectionDefaults: p,
|
|
86
|
-
navigation:
|
|
87
|
-
accessibility:
|
|
86
|
+
navigation: Ee(E),
|
|
87
|
+
accessibility: k
|
|
88
88
|
}),
|
|
89
89
|
[
|
|
90
|
-
k,
|
|
91
90
|
S,
|
|
91
|
+
T,
|
|
92
92
|
g,
|
|
93
93
|
u,
|
|
94
|
-
|
|
95
|
-
z,
|
|
94
|
+
h,
|
|
96
95
|
y,
|
|
96
|
+
z,
|
|
97
97
|
v,
|
|
98
98
|
f,
|
|
99
99
|
d,
|
|
100
|
-
|
|
100
|
+
D,
|
|
101
101
|
p,
|
|
102
102
|
E,
|
|
103
|
-
|
|
103
|
+
k
|
|
104
104
|
]
|
|
105
|
-
),
|
|
106
|
-
const
|
|
107
|
-
(
|
|
105
|
+
), ne = t.useMemo(() => {
|
|
106
|
+
const o = t.Children.toArray(i).find(
|
|
107
|
+
(a) => t.isValidElement(a) && a.type === ze
|
|
108
108
|
);
|
|
109
|
-
return
|
|
110
|
-
}, [
|
|
111
|
-
const
|
|
112
|
-
(
|
|
109
|
+
return o ? o.props.children : null;
|
|
110
|
+
}, [i]), se = t.useMemo(() => {
|
|
111
|
+
const o = t.Children.toArray(i).find(
|
|
112
|
+
(a) => t.isValidElement(a) && a.type === ye
|
|
113
113
|
);
|
|
114
|
-
return
|
|
115
|
-
}, [
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
114
|
+
return o ? o.props.children : null;
|
|
115
|
+
}, [i]), C = t.Children.toArray(i).find(
|
|
116
|
+
(o) => t.isValidElement(o) && typeof o.type == "function" && "displayName" in o.type && o.type.displayName === "KendoDiagramEditor"
|
|
117
|
+
), { tooltipState: c, tooltipElRef: ie, hideTooltip: re, handleTooltipShow: le, handleTooltipHide: ce } = ve({
|
|
118
|
+
shapeTooltipRender: ne,
|
|
119
|
+
connectionTooltipRender: se,
|
|
120
|
+
diagramRef: l,
|
|
121
|
+
wrapperRef: r,
|
|
122
|
+
onTooltipShow: U,
|
|
123
|
+
onTooltipHide: X
|
|
124
|
+
}), { bindDiagramEvents: me } = Me({
|
|
123
125
|
handlers: {
|
|
124
|
-
onChange:
|
|
125
|
-
onDiagramClick:
|
|
126
|
-
onDrag:
|
|
126
|
+
onChange: F,
|
|
127
|
+
onDiagramClick: H,
|
|
128
|
+
onDrag: K,
|
|
127
129
|
onDragEnd: Z,
|
|
128
130
|
onDragStart: B,
|
|
129
131
|
onShapeBoundsChange: I,
|
|
130
|
-
onMouseEnter:
|
|
131
|
-
onMouseLeave:
|
|
132
|
-
onPan:
|
|
133
|
-
onSelect:
|
|
134
|
-
onZoomEnd:
|
|
135
|
-
onZoomStart:
|
|
132
|
+
onMouseEnter: $,
|
|
133
|
+
onMouseLeave: j,
|
|
134
|
+
onPan: q,
|
|
135
|
+
onSelect: G,
|
|
136
|
+
onZoomEnd: J,
|
|
137
|
+
onZoomStart: Q
|
|
136
138
|
},
|
|
137
|
-
handleTooltipShow:
|
|
138
|
-
handleTooltipHide:
|
|
139
|
-
}), m =
|
|
140
|
-
return
|
|
141
|
-
if (!
|
|
139
|
+
handleTooltipShow: le,
|
|
140
|
+
handleTooltipHide: ce
|
|
141
|
+
}), m = t.useRef(!1), x = t.useRef(e);
|
|
142
|
+
return t.useEffect(() => {
|
|
143
|
+
if (!r.current)
|
|
142
144
|
return;
|
|
143
|
-
const
|
|
144
|
-
return
|
|
145
|
-
|
|
145
|
+
const o = De(r.current), a = new he(r.current, e, o);
|
|
146
|
+
return a._createOptionElements(), a.zoom(a.options.zoom), a.canvas.draw(), l.current = a, N(a), me(a, e), m.current = !0, () => {
|
|
147
|
+
re(), a.destroy(), N(null), m.current = !1;
|
|
146
148
|
};
|
|
147
|
-
}, []),
|
|
148
|
-
if (!
|
|
149
|
+
}, []), t.useEffect(() => {
|
|
150
|
+
if (!l.current || !m.current)
|
|
149
151
|
return;
|
|
150
|
-
const
|
|
151
|
-
(
|
|
152
|
-
const
|
|
153
|
-
|
|
152
|
+
const o = l.current, a = x.current;
|
|
153
|
+
(a.shapes !== e.shapes || a.connections !== e.connections) && o.load(e), (a.layout !== e.layout || a.shapes !== e.shapes || a.connections !== e.connections) && o.layout(e.layout), a.zoom !== e.zoom && o.zoom(e.zoom);
|
|
154
|
+
const pe = a.connectionDefaults === e.connectionDefaults ? e.connectionDefaults : { ...o.options.connectionDefaults, ...e.connectionDefaults }, ue = a.shapeDefaults === e.shapeDefaults ? e.shapeDefaults : { ...o.options.shapeDefaults, ...e.shapeDefaults };
|
|
155
|
+
o.setOptions({
|
|
154
156
|
zoom: e.zoom,
|
|
155
157
|
zoomMax: e.zoomMax,
|
|
156
158
|
zoomMin: e.zoomMin,
|
|
@@ -159,29 +161,32 @@ const Me = n.forwardRef((O, s) => {
|
|
|
159
161
|
pannable: e.pannable,
|
|
160
162
|
layout: e.layout,
|
|
161
163
|
navigation: e.navigation,
|
|
162
|
-
connectionDefaults:
|
|
163
|
-
shapeDefaults:
|
|
164
|
-
}),
|
|
165
|
-
}, [e]), /* @__PURE__ */
|
|
164
|
+
connectionDefaults: pe,
|
|
165
|
+
shapeDefaults: ue
|
|
166
|
+
}), x.current = e;
|
|
167
|
+
}, [e]), /* @__PURE__ */ t.createElement(
|
|
166
168
|
"div",
|
|
167
169
|
{
|
|
168
|
-
ref:
|
|
169
|
-
className:
|
|
170
|
-
style: { display: "block", position: "relative", cursor: "default", ...
|
|
170
|
+
ref: r,
|
|
171
|
+
className: O("k-diagram", _),
|
|
172
|
+
style: { display: "block", position: "relative", cursor: "default", ...Y }
|
|
171
173
|
},
|
|
172
|
-
c.visible && /* @__PURE__ */
|
|
174
|
+
c.visible && /* @__PURE__ */ t.createElement(
|
|
173
175
|
"div",
|
|
174
176
|
{
|
|
175
|
-
ref:
|
|
176
|
-
className:
|
|
177
|
+
ref: ie,
|
|
178
|
+
className: O("k-popup", "k-tooltip", c.className),
|
|
177
179
|
style: c.style
|
|
178
180
|
},
|
|
179
181
|
c.content
|
|
180
182
|
),
|
|
181
|
-
|
|
183
|
+
te && /* @__PURE__ */ t.createElement(ge, { message: ae }),
|
|
184
|
+
C && t.cloneElement(C, {
|
|
185
|
+
diagram: ee
|
|
186
|
+
})
|
|
182
187
|
);
|
|
183
188
|
});
|
|
184
|
-
|
|
189
|
+
Ne.displayName = "KendoDiagram";
|
|
185
190
|
export {
|
|
186
|
-
|
|
191
|
+
Ne as Diagram
|
|
187
192
|
};
|
package/EULA.pdf
ADDED
|
Binary file
|