@das-fed/upf-utils 6.4.0-dev.244 → 6.4.0-dev.245

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.
Files changed (97) hide show
  1. package/api-services/es5.js +1349 -1361
  2. package/api-services/index.js +1055 -1073
  3. package/api-services/index.js.gz +0 -0
  4. package/api-services/modules/app-manage/es5.js +1088 -1079
  5. package/api-services/modules/app-manage/index.js +897 -883
  6. package/api-services/modules/app-manage/index.js.gz +0 -0
  7. package/api-services/modules/authentication/es5.js +1114 -1102
  8. package/api-services/modules/authentication/index.js +920 -902
  9. package/api-services/modules/authentication/index.js.gz +0 -0
  10. package/api-services/modules/bems/es5.js +1118 -1106
  11. package/api-services/modules/bems/index.js +923 -905
  12. package/api-services/modules/bems/index.js.gz +0 -0
  13. package/api-services/modules/contract/es5.js +1079 -1088
  14. package/api-services/modules/contract/index.js +883 -897
  15. package/api-services/modules/contract/index.js.gz +0 -0
  16. package/api-services/modules/duty-manage/es5.js +1087 -1075
  17. package/api-services/modules/duty-manage/index.js +898 -880
  18. package/api-services/modules/duty-manage/index.js.gz +0 -0
  19. package/api-services/modules/es5.js +1317 -1327
  20. package/api-services/modules/index.js +1028 -1042
  21. package/api-services/modules/index.js.gz +0 -0
  22. package/api-services/modules/iot/es5.js +1122 -1134
  23. package/api-services/modules/iot/index.js +930 -948
  24. package/api-services/modules/iot/index.js.gz +0 -0
  25. package/api-services/modules/justauth/es5.js +854 -851
  26. package/api-services/modules/justauth/index.js +666 -662
  27. package/api-services/modules/justauth/index.js.gz +0 -0
  28. package/api-services/modules/knowledge/es5.js +1114 -1102
  29. package/api-services/modules/knowledge/index.js +920 -902
  30. package/api-services/modules/knowledge/index.js.gz +0 -0
  31. package/api-services/modules/link/es5.js +1114 -1102
  32. package/api-services/modules/link/index.js +920 -902
  33. package/api-services/modules/link/index.js.gz +0 -0
  34. package/api-services/modules/portal/es5.js +1102 -1114
  35. package/api-services/modules/portal/index.js +902 -920
  36. package/api-services/modules/portal/index.js.gz +0 -0
  37. package/api-services/modules/space-manage/es5.js +1114 -1102
  38. package/api-services/modules/space-manage/index.js +920 -902
  39. package/api-services/modules/space-manage/index.js.gz +0 -0
  40. package/api-services/modules/super-admin/es5.js +1081 -1093
  41. package/api-services/modules/super-admin/index.js +883 -901
  42. package/api-services/modules/super-admin/index.js.gz +0 -0
  43. package/api-services/modules/supplier/es5.js +1093 -1081
  44. package/api-services/modules/supplier/index.js +901 -883
  45. package/api-services/modules/supplier/index.js.gz +0 -0
  46. package/api-services/modules/systemConfiguration/es5.js +1079 -1088
  47. package/api-services/modules/systemConfiguration/index.js +883 -897
  48. package/api-services/modules/systemConfiguration/index.js.gz +0 -0
  49. package/api-services/src/create-service/es5.js +1089 -1077
  50. package/api-services/src/create-service/index.js +904 -886
  51. package/api-services/src/create-service/index.js.gz +0 -0
  52. package/common-info/es5.js +1257 -1248
  53. package/common-info/getPermissionMethod/es5.js +1344 -1332
  54. package/common-info/getPermissionMethod/index.js +1122 -1104
  55. package/common-info/getPermissionMethod/index.js.gz +0 -0
  56. package/common-info/index.js +1040 -1026
  57. package/common-info/index.js.gz +0 -0
  58. package/dimple-canvas/use-dimple-canvas/core/antv-x6/index.d.ts +29 -0
  59. package/dimple-canvas/use-dimple-canvas/core/antv-x6/index.js +19868 -0
  60. package/dimple-canvas/use-dimple-canvas/core/antv-x6/index.js.gz +0 -0
  61. package/dimple-canvas/use-dimple-canvas/core/konva/index.d.ts +55 -0
  62. package/dimple-canvas/use-dimple-canvas/core/konva/index.js +116 -0
  63. package/dimple-canvas/use-dimple-canvas/core/konva/index.js.gz +0 -0
  64. package/dimple-canvas/use-dimple-canvas/core/konva/utils/add-event-listener.d.ts +104 -0
  65. package/dimple-canvas/use-dimple-canvas/core/konva/utils/add-event-listener.js +17 -0
  66. package/dimple-canvas/use-dimple-canvas/core/konva/utils/add-object/index.d.ts +8 -0
  67. package/dimple-canvas/use-dimple-canvas/core/konva/utils/add-object/index.js +51 -0
  68. package/dimple-canvas/use-dimple-canvas/core/konva/utils/add-object/index.js.gz +0 -0
  69. package/dimple-canvas/use-dimple-canvas/core/konva/utils/create-canvas.d.ts +5 -0
  70. package/dimple-canvas/use-dimple-canvas/core/konva/utils/create-canvas.js +14 -0
  71. package/dimple-canvas/use-dimple-canvas/core/konva/utils/find.d.ts +7 -0
  72. package/dimple-canvas/use-dimple-canvas/core/konva/utils/find.js +5 -0
  73. package/dimple-canvas/use-dimple-canvas/core/konva/utils/guideline.d.ts +5 -0
  74. package/dimple-canvas/use-dimple-canvas/core/konva/utils/guideline.js +180 -0
  75. package/dimple-canvas/use-dimple-canvas/core/konva/utils/guideline.js.gz +0 -0
  76. package/dimple-canvas/use-dimple-canvas/core/konva/utils/lib.d.ts +4 -0
  77. package/dimple-canvas/use-dimple-canvas/core/konva/utils/lib.js +7535 -0
  78. package/dimple-canvas/use-dimple-canvas/core/konva/utils/lib.js.gz +0 -0
  79. package/dimple-canvas/use-dimple-canvas/core/konva/utils/load-json.d.ts +6 -0
  80. package/dimple-canvas/use-dimple-canvas/core/konva/utils/load-json.js +13 -0
  81. package/dimple-canvas/use-dimple-canvas/core/konva/utils/remove-object.d.ts +6 -0
  82. package/dimple-canvas/use-dimple-canvas/core/konva/utils/remove-object.js +7 -0
  83. package/dimple-canvas/use-dimple-canvas/core/konva/utils/rule.d.ts +8 -0
  84. package/dimple-canvas/use-dimple-canvas/core/konva/utils/rule.js +193 -0
  85. package/dimple-canvas/use-dimple-canvas/core/konva/utils/rule.js.gz +0 -0
  86. package/dimple-canvas/use-dimple-canvas/core/konva/utils/transform-axis.d.ts +11 -0
  87. package/dimple-canvas/use-dimple-canvas/core/konva/utils/transform-axis.js +20 -0
  88. package/dimple-canvas/use-dimple-canvas/core/konva/utils/transformer.d.ts +5 -0
  89. package/dimple-canvas/use-dimple-canvas/core/konva/utils/transformer.js +52 -0
  90. package/dimple-canvas/use-dimple-canvas/core/konva/utils/transformer.js.gz +0 -0
  91. package/dimple-canvas/use-dimple-canvas/core/konva/utils/wheel-zoom.d.ts +4 -0
  92. package/dimple-canvas/use-dimple-canvas/core/konva/utils/wheel-zoom.js +14 -0
  93. package/dimple-canvas/use-dimple-canvas/es5.d.ts +9 -0
  94. package/dimple-canvas/use-dimple-canvas/es5.js +20 -0
  95. package/dimple-canvas/use-dimple-canvas/index.d.ts +9 -0
  96. package/dimple-canvas/use-dimple-canvas/index.js +10 -0
  97. package/package.json +3 -3
@@ -0,0 +1,55 @@
1
+ import { EventName } from '@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/konva/utils/add-event-listener';
2
+ import { Konva } from '@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/konva/utils/lib';
3
+ import { ObjectType, ObjectConfig } from '../type';
4
+
5
+ declare const useKonva: () => {
6
+ canvasContainerEl: any;
7
+ canvas: any;
8
+ layer: any;
9
+ onCanvasMounted: (cb: Function) => any;
10
+ createCanvas: (container?: HTMLDivElement | null) => void;
11
+ addObject: (type: ObjectType, config?: ObjectConfig) => any;
12
+ findOne: (key: string) => any;
13
+ findObject: (type: ObjectType) => any;
14
+ removeObject: (key: string) => void;
15
+ addEventListener: (eventName: EventName, cb: (e: {
16
+ currentTarget: any;
17
+ evt: Event;
18
+ pointerId: any;
19
+ target: any;
20
+ type: string;
21
+ data: {
22
+ setHoverImage?: (src?: string) => void;
23
+ setActiveImage?: (src?: string) => void;
24
+ setDisabledImage?: (src?: string) => void;
25
+ [key: string]: any;
26
+ };
27
+ }) => void) => void;
28
+ changeImageSrc: (imageKey: string, payload: string | {
29
+ src?: string;
30
+ hoverSrc?: string;
31
+ activeSrc?: string;
32
+ disabledSrc?: string;
33
+ }) => void;
34
+ zoom: (type?: "in" | "out", radio?: number) => void;
35
+ toJSON: (config?: any) => any;
36
+ loadJSON: (json?: any, config?: any) => void;
37
+ remove: () => void;
38
+ transformAxis: (coordinate: {
39
+ x: number;
40
+ y: number;
41
+ [key: string]: any;
42
+ }) => any;
43
+ setDisabled: () => void;
44
+ showRule: (options?: {
45
+ /** 刻度间隔 */
46
+ precision?: number;
47
+ /** 刻度文字颜色 */
48
+ textColor?: string;
49
+ /** 刻度线颜色 */
50
+ lineColor?: string;
51
+ }) => any;
52
+ removeRule: () => void;
53
+ tr: any;
54
+ };
55
+ export { useKonva, Konva };
@@ -0,0 +1,116 @@
1
+ import { ref as p, shallowRef as m, watch as j } from "vue";
2
+ import { createCanvas as G } from "@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/konva/utils/create-canvas";
3
+ import { addObject as M } from "@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/konva/utils/add-object";
4
+ import { findOne as S, findObject as U } from "@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/konva/utils/find";
5
+ import { removeObject as W } from "@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/konva/utils/remove-object";
6
+ import { initTransformer as X, removeTransformer as w } from "@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/konva/utils/transformer";
7
+ import { initGuideline as $ } from "@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/konva/utils/guideline";
8
+ import { loadJSON as q } from "@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/konva/utils/load-json";
9
+ import { transformAxis as P } from "@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/konva/utils/transform-axis";
10
+ import { initRule as Q } from "@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/konva/utils/rule";
11
+ import { addEventListener as Y } from "@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/konva/utils/add-event-listener";
12
+ import { Konva as H } from "@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/konva/utils/lib";
13
+ import { Konva as me } from "@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/konva/utils/lib";
14
+ const ie = () => {
15
+ const n = p(null), r = m(), c = m(), i = m(), g = m();
16
+ let b = [];
17
+ const k = (e) => b.push(e), f = p(!1), d = (e) => {
18
+ n.value || (n.value = e);
19
+ const o = G(e);
20
+ r.value = o.canvas, c.value = o.layer, h(), f.value = !0;
21
+ }, h = () => {
22
+ var e;
23
+ g.value = X(r.value, c.value), $(r.value, c.value), b.map((o) => o()), (e = r.value) == null || e.on("mouseleave", () => {
24
+ w();
25
+ });
26
+ }, y = (e, o) => M(e, {
27
+ canvas: r.value,
28
+ layer: c.value,
29
+ config: o
30
+ }), F = (e) => {
31
+ W(r.value, e), w();
32
+ }, x = (e) => S(r.value, `${e}`), C = (e) => U(r.value, e), L = (e, o) => {
33
+ Y(r, e, o);
34
+ }, R = (e, o) => {
35
+ const t = S(r.value, e);
36
+ if (!t || !t.image) return;
37
+ let a = {};
38
+ typeof o == "string" ? a = { src: o } : a = o;
39
+ const { src: s, hoverSrc: l, activeSrc: u, disabledSrc: O } = a;
40
+ if (s) {
41
+ t.attrs.src = s;
42
+ const v = new Image();
43
+ v.src = s;
44
+ const B = t.width(), z = t.height();
45
+ v.onload = () => {
46
+ t.image(v), t.width(B), t.height(z);
47
+ }, t.attrs.setDefaultImage = () => t.image(v);
48
+ }
49
+ l && (t.attrs.hoverSrc = l), u && (t.attrs.activeSrc = u), O && (t.attrs.disabledSrc = O);
50
+ }, J = (e, o) => {
51
+ var s, l;
52
+ const t = ((s = r.value) == null ? void 0 : s.scaleX()) || 1;
53
+ o === void 0 && (o = 0.1);
54
+ let a = 1;
55
+ e === "in" && (a = t - o), e === "out" && (a = t + o), (l = r.value) == null || l.scale({ x: a, y: a });
56
+ }, N = () => {
57
+ var o;
58
+ const e = (o = n.value) == null ? void 0 : o.children[0];
59
+ e == null || e.remove(), d(n.value);
60
+ }, T = (e) => {
61
+ var t;
62
+ return r.value ? (t = r.value) == null ? void 0 : t.toJSON() : {};
63
+ }, I = (e, o) => {
64
+ const t = () => {
65
+ if (!n.value) return;
66
+ const a = q(n.value, e);
67
+ r.value = a.canvas, c.value = a.layer, i.value = a.ruleLayer, h();
68
+ };
69
+ if (f.value) return t();
70
+ j(
71
+ () => f.value,
72
+ () => t()
73
+ );
74
+ }, A = (e) => n.value ? P(n.value, r.value, e) : { x: 0, y: 0 }, D = () => {
75
+ var s, l, u;
76
+ const { width: e = 0, height: o = 0 } = ((s = n.value) == null ? void 0 : s.getBoundingClientRect()) || {}, t = new H.Layer({ width: e, height: o }), a = new H.Rect({ width: e, height: o, fill: "rgba(0,0,0,0)", draggable: !1, name: "disabled" });
77
+ t.name("disabled"), (l = r.value) == null || l.add(t), t.add(a), t.moveToTop(), (u = r.value) == null || u.setDraggable(!1);
78
+ }, E = (e) => {
79
+ var o;
80
+ return i.value = Q(r.value, e), i.value.moveToBottom(), (o = r.value) == null || o.add(i.value), i;
81
+ }, K = () => {
82
+ var e;
83
+ (e = i.value) == null || e.remove();
84
+ };
85
+ return j(
86
+ () => n.value,
87
+ (e, o) => {
88
+ e && o === null && d(e);
89
+ }
90
+ ), {
91
+ canvasContainerEl: n,
92
+ canvas: r,
93
+ layer: c,
94
+ onCanvasMounted: k,
95
+ createCanvas: d,
96
+ addObject: y,
97
+ findOne: x,
98
+ findObject: C,
99
+ removeObject: F,
100
+ addEventListener: L,
101
+ changeImageSrc: R,
102
+ zoom: J,
103
+ toJSON: T,
104
+ loadJSON: I,
105
+ remove: N,
106
+ transformAxis: A,
107
+ setDisabled: D,
108
+ showRule: E,
109
+ removeRule: K,
110
+ tr: g
111
+ };
112
+ };
113
+ export {
114
+ me as Konva,
115
+ ie as useKonva
116
+ };
@@ -0,0 +1,104 @@
1
+ import { Ref } from 'vue';
2
+ import { Canvas } from '@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/type';
3
+
4
+ interface GlobalEventHandlersEventMap {
5
+ abort: UIEvent;
6
+ animationcancel: AnimationEvent;
7
+ animationend: AnimationEvent;
8
+ animationiteration: AnimationEvent;
9
+ animationstart: AnimationEvent;
10
+ auxclick: MouseEvent;
11
+ beforeinput: InputEvent;
12
+ blur: FocusEvent;
13
+ cancel: Event;
14
+ canplay: Event;
15
+ canplaythrough: Event;
16
+ change: Event;
17
+ click: MouseEvent;
18
+ close: Event;
19
+ compositionend: CompositionEvent;
20
+ compositionstart: CompositionEvent;
21
+ compositionupdate: CompositionEvent;
22
+ contextmenu: MouseEvent;
23
+ cuechange: Event;
24
+ dblclick: MouseEvent;
25
+ drag: DragEvent;
26
+ dragend: DragEvent;
27
+ dragenter: DragEvent;
28
+ dragleave: DragEvent;
29
+ dragover: DragEvent;
30
+ dragstart: DragEvent;
31
+ drop: DragEvent;
32
+ durationchange: Event;
33
+ emptied: Event;
34
+ ended: Event;
35
+ error: ErrorEvent;
36
+ focus: FocusEvent;
37
+ focusin: FocusEvent;
38
+ focusout: FocusEvent;
39
+ formdata: FormDataEvent;
40
+ gotpointercapture: PointerEvent;
41
+ input: Event;
42
+ invalid: Event;
43
+ keydown: KeyboardEvent;
44
+ keypress: KeyboardEvent;
45
+ keyup: KeyboardEvent;
46
+ load: Event;
47
+ loadeddata: Event;
48
+ loadedmetadata: Event;
49
+ loadstart: Event;
50
+ lostpointercapture: PointerEvent;
51
+ mousedown: MouseEvent;
52
+ mouseenter: MouseEvent;
53
+ mouseleave: MouseEvent;
54
+ mousemove: MouseEvent;
55
+ mouseout: MouseEvent;
56
+ mouseover: MouseEvent;
57
+ mouseup: MouseEvent;
58
+ pause: Event;
59
+ play: Event;
60
+ playing: Event;
61
+ pointercancel: PointerEvent;
62
+ pointerdown: PointerEvent;
63
+ pointerenter: PointerEvent;
64
+ pointerleave: PointerEvent;
65
+ pointermove: PointerEvent;
66
+ pointerout: PointerEvent;
67
+ pointerover: PointerEvent;
68
+ pointerup: PointerEvent;
69
+ progress: ProgressEvent;
70
+ ratechange: Event;
71
+ reset: Event;
72
+ resize: UIEvent;
73
+ scroll: Event;
74
+ securitypolicyviolation: SecurityPolicyViolationEvent;
75
+ seeked: Event;
76
+ seeking: Event;
77
+ select: Event;
78
+ selectionchange: Event;
79
+ selectstart: Event;
80
+ slotchange: Event;
81
+ stalled: Event;
82
+ submit: SubmitEvent;
83
+ suspend: Event;
84
+ timeupdate: Event;
85
+ toggle: Event;
86
+ touchcancel: TouchEvent;
87
+ touchend: TouchEvent;
88
+ touchmove: TouchEvent;
89
+ touchstart: TouchEvent;
90
+ transitioncancel: TransitionEvent;
91
+ transitionend: TransitionEvent;
92
+ transitionrun: TransitionEvent;
93
+ transitionstart: TransitionEvent;
94
+ volumechange: Event;
95
+ waiting: Event;
96
+ webkitanimationend: Event;
97
+ webkitanimationiteration: Event;
98
+ webkitanimationstart: Event;
99
+ webkittransitionend: Event;
100
+ wheel: WheelEvent;
101
+ }
102
+ export type EventName = keyof GlobalEventHandlersEventMap;
103
+ declare const addEventListener: (canvas: Ref<Canvas | null | undefined>, eventName: EventName, cb: any) => void;
104
+ export { addEventListener };
@@ -0,0 +1,17 @@
1
+ import { watch as d } from "vue";
2
+ const p = (t, r, e) => {
3
+ var o;
4
+ t.value && ((o = t.value) == null || o.on(r, e)), t.value || d(
5
+ () => t.value,
6
+ (a, l) => {
7
+ var u;
8
+ l || (u = t.value) == null || u.on(r, (i) => {
9
+ const f = i.target.attrs;
10
+ e({ ...i, data: f });
11
+ });
12
+ }
13
+ );
14
+ };
15
+ export {
16
+ p as addEventListener
17
+ };
@@ -0,0 +1,8 @@
1
+ import { Canvas, Layer, ObjectType, ObjectConfig } from '@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/type';
2
+
3
+ declare const addObject: (type: ObjectType, options: {
4
+ canvas?: Canvas | null;
5
+ layer?: Layer | null;
6
+ config?: ObjectConfig;
7
+ }) => unknown;
8
+ export { addObject };
@@ -0,0 +1,51 @@
1
+ import { Konva as d } from "@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/konva/utils/lib";
2
+ const f = async (r, n) => {
3
+ const { config: t = {}, canvas: s, layer: a } = n;
4
+ if (!s || !a) return;
5
+ let e = null;
6
+ t.type = r, t.draggable = t.draggable ?? !0;
7
+ const c = +/* @__PURE__ */ new Date();
8
+ return t.id = t.id ?? c.toString(), r === "Rect" && (e = new d.Rect(t)), r === "Circle" && (e = new d.Circle(t)), r === "Image" && (e = await l(t)), r === "BackgroundImage" && I(s, t), e && a.add(e), e;
9
+ }, l = (r) => {
10
+ const { src: n = "" } = r || {};
11
+ return new Promise((t, s) => {
12
+ if (!n) return t(null);
13
+ const a = new Image();
14
+ a.src = r.src || "", a.onload = () => {
15
+ const e = new d.Image({ image: a });
16
+ r.setDefaultImage = () => e.image(a), e.setAttrs(r);
17
+ const c = [
18
+ { getter: "hoverSrc", setter: "setHoverImage" },
19
+ { getter: "activeSrc", setter: "setActiveImage" },
20
+ { getter: "disabledSrc", setter: "setDisabledImage" }
21
+ ];
22
+ for (const g of c)
23
+ r[g.setter] = (u) => {
24
+ const i = u || e.attrs[g.getter];
25
+ if (!i) return;
26
+ const o = new Image();
27
+ o.src = i, o.onload = () => {
28
+ var m;
29
+ return (m = e.image) == null ? void 0 : m.call(e, o);
30
+ };
31
+ };
32
+ e.setAttrs(r), t(e);
33
+ };
34
+ });
35
+ }, I = (r, n) => {
36
+ const { src: t = "", scaleWidth: s = 30 } = n || {};
37
+ if (!t) return;
38
+ const a = new d.Layer();
39
+ return r.add(a), a.moveToBottom(), l({
40
+ // listening: false,
41
+ src: t,
42
+ width: a.width() - s,
43
+ height: a.height() - s,
44
+ type: "BackgroundImage",
45
+ ...n,
46
+ draggable: !1
47
+ }).then((e) => (e && a.add(e), e));
48
+ };
49
+ export {
50
+ f as addObject
51
+ };
@@ -0,0 +1,5 @@
1
+ declare const createCanvas: (container?: HTMLDivElement | null, config?: any) => {
2
+ canvas: any;
3
+ layer: any;
4
+ };
5
+ export { createCanvas };
@@ -0,0 +1,14 @@
1
+ import { Konva as n } from "@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/konva/utils/lib";
2
+ const r = (e, c) => {
3
+ e || (e = document.createElement("div"), document.body.append(e));
4
+ const { width: d, height: o } = e.getBoundingClientRect(), a = new n.Stage({
5
+ container: e,
6
+ width: d,
7
+ height: o,
8
+ draggable: !0
9
+ }), t = new n.Layer();
10
+ return t.name("base"), a.add(t), { canvas: a, layer: t };
11
+ };
12
+ export {
13
+ r as createCanvas
14
+ };
@@ -0,0 +1,7 @@
1
+ import { Canvas, ObjectType } from '@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/type';
2
+
3
+ declare const findOne: (canvas: Canvas | null | undefined,
4
+ /** 需要删除对象的id或者name:name: .name;id: #id */
5
+ key: string) => any;
6
+ declare const findObject: (canvas: Canvas | null | undefined, type: ObjectType) => any;
7
+ export { findOne, findObject };
@@ -0,0 +1,5 @@
1
+ const r = (e, t) => e == null ? void 0 : e.findOne(`${t}`), d = (e, t) => e == null ? void 0 : e.find(t);
2
+ export {
3
+ d as findObject,
4
+ r as findOne
5
+ };
@@ -0,0 +1,5 @@
1
+ import { Canvas, Layer } from '@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/type';
2
+
3
+ declare const initGuideline: (canvas?: Canvas | null, layer?: Layer | null) => void;
4
+ declare const removeGuideline: (layer?: Layer | null) => void;
5
+ export { initGuideline, removeGuideline };
@@ -0,0 +1,180 @@
1
+ import { Konva as p } from "@das-fed/upf-utils/dimple-canvas/use-dimple-canvas/core/konva/utils/lib";
2
+ const w = (r, s) => {
3
+ if (!r || !s) return;
4
+ var c = 5;
5
+ function b(o) {
6
+ var t = [0, r.width() / 2, r.width()], n = [0, r.height() / 2, r.height()];
7
+ return r.find(".object").forEach((f) => {
8
+ if (f !== o) {
9
+ var i = f.getClientRect();
10
+ t.push([i.x, i.x + i.width, i.x + i.width / 2]), n.push([i.y, i.y + i.height, i.y + i.height / 2]);
11
+ }
12
+ }), {
13
+ vertical: t.flat(),
14
+ horizontal: n.flat()
15
+ };
16
+ }
17
+ function v(o) {
18
+ var t = o.getClientRect(), n = o.absolutePosition();
19
+ return {
20
+ vertical: [
21
+ {
22
+ guide: Math.round(t.x),
23
+ offset: Math.round(n.x - t.x),
24
+ snap: "start"
25
+ },
26
+ {
27
+ guide: Math.round(t.x + t.width / 2),
28
+ offset: Math.round(n.x - t.x - t.width / 2),
29
+ snap: "center"
30
+ },
31
+ {
32
+ guide: Math.round(t.x + t.width),
33
+ offset: Math.round(n.x - t.x - t.width),
34
+ snap: "end"
35
+ }
36
+ ],
37
+ horizontal: [
38
+ {
39
+ guide: Math.round(t.y),
40
+ offset: Math.round(n.y - t.y),
41
+ snap: "start"
42
+ },
43
+ {
44
+ guide: Math.round(t.y + t.height / 2),
45
+ offset: Math.round(n.y - t.y - t.height / 2),
46
+ snap: "center"
47
+ },
48
+ {
49
+ guide: Math.round(t.y + t.height),
50
+ offset: Math.round(n.y - t.y - t.height),
51
+ snap: "end"
52
+ }
53
+ ]
54
+ };
55
+ }
56
+ function g(o, t) {
57
+ var n = [], f = [];
58
+ o.vertical.forEach((d) => {
59
+ t.vertical.forEach((a) => {
60
+ var h = Math.abs(d - a.guide);
61
+ h < c && n.push({
62
+ lineGuide: d,
63
+ diff: h,
64
+ snap: a.snap,
65
+ offset: a.offset
66
+ });
67
+ });
68
+ }), o.horizontal.forEach((d) => {
69
+ t.horizontal.forEach((a) => {
70
+ var h = Math.abs(d - a.guide);
71
+ h < c && f.push({
72
+ lineGuide: d,
73
+ diff: h,
74
+ snap: a.snap,
75
+ offset: a.offset
76
+ });
77
+ });
78
+ });
79
+ var i = [], e = n.sort((d, a) => d.diff - a.diff)[0], u = f.sort((d, a) => d.diff - a.diff)[0];
80
+ return e && i.push({
81
+ lineGuide: e.lineGuide,
82
+ offset: e.offset,
83
+ orientation: "V",
84
+ snap: e.snap
85
+ }), u && i.push({
86
+ lineGuide: u.lineGuide,
87
+ offset: u.offset,
88
+ orientation: "H",
89
+ snap: u.snap
90
+ }), i;
91
+ }
92
+ function x(o) {
93
+ o.forEach((t) => {
94
+ if (t.orientation === "H") {
95
+ var n = new p.Line({
96
+ points: [-6e3, 0, 6e3, 0],
97
+ stroke: "rgb(0, 161, 255)",
98
+ strokeWidth: 1,
99
+ name: "guid-line",
100
+ dash: [4, 6]
101
+ });
102
+ s.add(n), n.absolutePosition({
103
+ x: 0,
104
+ y: t.lineGuide
105
+ });
106
+ } else if (t.orientation === "V") {
107
+ var n = new p.Line({
108
+ points: [0, -6e3, 0, 6e3],
109
+ stroke: "rgb(0, 161, 255)",
110
+ strokeWidth: 1,
111
+ name: "guid-line",
112
+ dash: [4, 6]
113
+ });
114
+ s.add(n), n.absolutePosition({
115
+ x: t.lineGuide,
116
+ y: 0
117
+ });
118
+ }
119
+ });
120
+ }
121
+ s.on("dragmove", function(o) {
122
+ s.find(".guid-line").forEach((e) => e.destroy());
123
+ var t = b(o.target), n = v(o.target), f = g(t, n);
124
+ if (f.length) {
125
+ x(f);
126
+ var i = o.target.absolutePosition();
127
+ f.forEach((e) => {
128
+ switch (e.snap) {
129
+ case "start": {
130
+ switch (e.orientation) {
131
+ case "V": {
132
+ i.x = e.lineGuide + e.offset;
133
+ break;
134
+ }
135
+ case "H": {
136
+ i.y = e.lineGuide + e.offset;
137
+ break;
138
+ }
139
+ }
140
+ break;
141
+ }
142
+ case "center": {
143
+ switch (e.orientation) {
144
+ case "V": {
145
+ i.x = e.lineGuide + e.offset;
146
+ break;
147
+ }
148
+ case "H": {
149
+ i.y = e.lineGuide + e.offset;
150
+ break;
151
+ }
152
+ }
153
+ break;
154
+ }
155
+ case "end": {
156
+ switch (e.orientation) {
157
+ case "V": {
158
+ i.x = e.lineGuide + e.offset;
159
+ break;
160
+ }
161
+ case "H": {
162
+ i.y = e.lineGuide + e.offset;
163
+ break;
164
+ }
165
+ }
166
+ break;
167
+ }
168
+ }
169
+ }), o.target.absolutePosition(i);
170
+ }
171
+ }), s.on("dragend", function(o) {
172
+ s.find(".guid-line").forEach((t) => t.destroy());
173
+ });
174
+ }, E = (r) => {
175
+ r == null || r.find(".guid-line").forEach((s) => s.destroy());
176
+ };
177
+ export {
178
+ w as initGuideline,
179
+ E as removeGuideline
180
+ };
@@ -0,0 +1,4 @@
1
+ import { default as Konva } from 'konva';
2
+
3
+ /** 由于该库需要全局唯一命名空间,只能import一次 */
4
+ export { Konva };