@das-fed/utils 1.0.4 → 1.0.6

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 (44) hide show
  1. package/api-services/src/create-service.js +669 -667
  2. package/common-info/index.js +63 -62
  3. package/common-tools/get-url-params.js +0 -1
  4. package/dimple-canvas/index.d.ts +2 -0
  5. package/dimple-canvas/index.js +5 -0
  6. package/dimple-canvas/use-dimple-canvas/core/antv-x6/index.d.ts +28 -0
  7. package/dimple-canvas/use-dimple-canvas/core/antv-x6/index.js +19946 -0
  8. package/dimple-canvas/use-dimple-canvas/core/konva/index.d.ts +53 -0
  9. package/dimple-canvas/use-dimple-canvas/core/konva/index.js +119 -0
  10. package/dimple-canvas/use-dimple-canvas/core/konva/utils/add-event-listener.d.ts +101 -0
  11. package/dimple-canvas/use-dimple-canvas/core/konva/utils/add-event-listener.js +17 -0
  12. package/dimple-canvas/use-dimple-canvas/core/konva/utils/add-object/index.d.ts +7 -0
  13. package/dimple-canvas/use-dimple-canvas/core/konva/utils/add-object/index.js +55 -0
  14. package/dimple-canvas/use-dimple-canvas/core/konva/utils/create-canvas.d.ts +5 -0
  15. package/dimple-canvas/use-dimple-canvas/core/konva/utils/create-canvas.js +14 -0
  16. package/dimple-canvas/use-dimple-canvas/core/konva/utils/find.d.ts +4 -0
  17. package/dimple-canvas/use-dimple-canvas/core/konva/utils/find.js +5 -0
  18. package/dimple-canvas/use-dimple-canvas/core/konva/utils/guideline.d.ts +4 -0
  19. package/dimple-canvas/use-dimple-canvas/core/konva/utils/guideline.js +181 -0
  20. package/dimple-canvas/use-dimple-canvas/core/konva/utils/lib.d.ts +3 -0
  21. package/dimple-canvas/use-dimple-canvas/core/konva/utils/lib.js +7374 -0
  22. package/dimple-canvas/use-dimple-canvas/core/konva/utils/load-json.d.ts +6 -0
  23. package/dimple-canvas/use-dimple-canvas/core/konva/utils/load-json.js +13 -0
  24. package/dimple-canvas/use-dimple-canvas/core/konva/utils/remove-object.d.ts +3 -0
  25. package/dimple-canvas/use-dimple-canvas/core/konva/utils/remove-object.js +7 -0
  26. package/dimple-canvas/use-dimple-canvas/core/konva/utils/rule.d.ts +8 -0
  27. package/dimple-canvas/use-dimple-canvas/core/konva/utils/rule.js +193 -0
  28. package/dimple-canvas/use-dimple-canvas/core/konva/utils/transform-axis.d.ts +10 -0
  29. package/dimple-canvas/use-dimple-canvas/core/konva/utils/transform-axis.js +20 -0
  30. package/dimple-canvas/use-dimple-canvas/core/konva/utils/transformer.d.ts +4 -0
  31. package/dimple-canvas/use-dimple-canvas/core/konva/utils/transformer.js +52 -0
  32. package/dimple-canvas/use-dimple-canvas/core/konva/utils/wheel-zoom.d.ts +2 -0
  33. package/dimple-canvas/use-dimple-canvas/core/konva/utils/wheel-zoom.js +14 -0
  34. package/dimple-canvas/use-dimple-canvas/index.d.ts +8 -0
  35. package/dimple-canvas/use-dimple-canvas/index.js +10 -0
  36. package/micro-app/globalData.d.ts +3 -0
  37. package/micro-app/globalData.js +11 -0
  38. package/micro-app/index.d.ts +5 -0
  39. package/micro-app/index.js +3699 -0
  40. package/nextTiken/index.d.ts +13 -0
  41. package/nextTiken/index.js +62 -0
  42. package/package.json +5 -6
  43. package/panel/index.d.ts +31 -0
  44. package/panel/index.js +37 -0
@@ -0,0 +1,6 @@
1
+ declare const loadJSON: (container: HTMLDivElement, json: any) => {
2
+ canvas: any;
3
+ layer: any;
4
+ ruleLayer: any;
5
+ };
6
+ export { loadJSON };
@@ -0,0 +1,13 @@
1
+ import { Konva as c } from "@das-fed/utils/dimple-canvas/use-dimple-canvas/core/konva/utils/lib";
2
+ const m = (t, n) => {
3
+ const a = c.Node.create(n, t), o = a.getLayers().find((e) => e.getAttr("name") === "base"), s = a.getLayers().find((e) => e.getAttr("name") === "ruleLayer");
4
+ return a.find("Image").forEach((e) => {
5
+ const r = new Image();
6
+ r.src = e.attrs.src, r.onload = () => {
7
+ e.image(r);
8
+ };
9
+ }), { canvas: a, layer: o, ruleLayer: s };
10
+ };
11
+ export {
12
+ m as loadJSON
13
+ };
@@ -0,0 +1,3 @@
1
+ import type { Canvas } from '@das-fed/utils/dimple-canvas/use-dimple-canvas/core/type';
2
+ declare const removeObject: (canvas: Canvas | null | undefined, key: string) => void;
3
+ export { removeObject };
@@ -0,0 +1,7 @@
1
+ const r = (e, t) => {
2
+ const o = e == null ? void 0 : e.findOne(`${t}`);
3
+ o && o.remove();
4
+ };
5
+ export {
6
+ r as removeObject
7
+ };
@@ -0,0 +1,8 @@
1
+ export declare function initRule(layer: any, options?: {
2
+ /** 刻度间隔 */
3
+ precision?: number;
4
+ /** 刻度文字颜色 */
5
+ textColor?: string;
6
+ /** 刻度线颜色 */
7
+ lineColor?: string;
8
+ }): any;
@@ -0,0 +1,193 @@
1
+ import { Konva as i } from "@das-fed/utils/dimple-canvas/use-dimple-canvas/core/konva/utils/lib";
2
+ function C(h, c) {
3
+ const {
4
+ precision: n = 50,
5
+ textColor: f = "#F56C6C",
6
+ lineColor: l = "#ccc",
7
+ originalPoint: e = { x: 0, y: 0 },
8
+ backgroundColor: w = "#EAEAEA",
9
+ scaleWidth: r = 30,
10
+ scalePoint: g = { x: 0, y: 0 }
11
+ } = c || {}, d = h.height() - r, a = h.width() - r;
12
+ h.offsetX(), h.offsetY();
13
+ const x = n / 10;
14
+ var p = new i.Line({
15
+ points: [
16
+ e.x - r,
17
+ e.y - r,
18
+ e.x - r,
19
+ d,
20
+ g.x,
21
+ d,
22
+ g.x,
23
+ g.y,
24
+ a,
25
+ g.y,
26
+ a,
27
+ e.y - r
28
+ ],
29
+ fill: w,
30
+ stroke: l,
31
+ strokeWidth: 1,
32
+ closed: !0,
33
+ name: "disabled"
34
+ });
35
+ let o = new i.Layer();
36
+ o.name("ruleLayer"), o.add(p), o.setDraggable(!1);
37
+ const L = new i.Line({
38
+ points: [e.x, e.y, a, e.y],
39
+ stroke: l,
40
+ strokeWidth: 1,
41
+ lineCap: "round",
42
+ lineJoin: "round",
43
+ fill: l,
44
+ listening: !1
45
+ });
46
+ for (let t = 1; t < 10; t++)
47
+ o.add(
48
+ new i.Line({
49
+ points: [
50
+ e.x + t * x,
51
+ e.y,
52
+ e.x + t * x,
53
+ t === 5 ? e.x - 15 : e.x - 10
54
+ ],
55
+ stroke: l,
56
+ strokeWidth: 1,
57
+ listening: !1
58
+ })
59
+ );
60
+ const u = new i.Text({
61
+ x: a - 20,
62
+ y: 0,
63
+ text: "",
64
+ fontSize: 20,
65
+ fill: f,
66
+ listening: !1
67
+ }), W = new i.Line({
68
+ points: [e.x, e.y, e.x, d],
69
+ stroke: l,
70
+ fill: l,
71
+ strokeWidth: 1,
72
+ lineCap: "round",
73
+ lineJoin: "round",
74
+ listening: !1
75
+ });
76
+ for (let t = 1; t < 10; t++)
77
+ o.add(
78
+ new i.Line({
79
+ points: [
80
+ e.x,
81
+ e.y + t * x,
82
+ t === 5 ? e.y - 15 : e.y - 10,
83
+ e.y + t * x
84
+ ],
85
+ stroke: l,
86
+ strokeWidth: 1,
87
+ listening: !1
88
+ })
89
+ );
90
+ const b = new i.Text({
91
+ x: 10,
92
+ y: d - 20,
93
+ text: "",
94
+ fontSize: 20,
95
+ width: 100,
96
+ fill: f,
97
+ listening: !1
98
+ });
99
+ o.add(L, W, u, b), o.add(
100
+ new i.Text({
101
+ x: e.x - 10,
102
+ y: e.y - 10,
103
+ text: "0",
104
+ fontSize: 10,
105
+ fill: f,
106
+ listening: !1
107
+ })
108
+ );
109
+ for (let t = 1; t <= Math.floor(d / n); t++) {
110
+ o.add(
111
+ new i.Line({
112
+ points: [
113
+ e.x,
114
+ t * n + e.y,
115
+ e.x - r,
116
+ t * n + e.y
117
+ ],
118
+ stroke: l,
119
+ strokeWidth: 1,
120
+ listening: !1
121
+ })
122
+ );
123
+ let y = d - t * n - e.y, k = y < n ? y / x : 10;
124
+ for (let s = 1; s < k; s++)
125
+ o.add(
126
+ new i.Line({
127
+ points: [
128
+ e.x,
129
+ t * n + e.y + s * x,
130
+ s === 5 ? e.y - 15 : e.y - 10,
131
+ t * n + e.y + s * x
132
+ ],
133
+ stroke: l,
134
+ strokeWidth: 1,
135
+ listening: !1
136
+ })
137
+ );
138
+ o.add(
139
+ new i.Text({
140
+ x: e.x - r + 2,
141
+ y: t * n + e.y - 10,
142
+ text: "" + t * n,
143
+ fontSize: 10,
144
+ fill: f,
145
+ listening: !1
146
+ })
147
+ );
148
+ }
149
+ for (let t = 1; t <= Math.floor(a / n); t++) {
150
+ o.add(
151
+ new i.Line({
152
+ points: [
153
+ t * n + e.x,
154
+ e.y,
155
+ t * n + e.x,
156
+ e.y - r
157
+ ],
158
+ stroke: l,
159
+ strokeWidth: 1,
160
+ listening: !1
161
+ })
162
+ );
163
+ let y = a - t * n - e.x, k = y < n ? y / x : 10;
164
+ for (let s = 1; s < k; s++)
165
+ o.add(
166
+ new i.Line({
167
+ points: [
168
+ e.x + t * n + s * x,
169
+ e.y,
170
+ e.x + t * n + s * x,
171
+ s === 5 ? e.x - 15 : e.x - 10
172
+ ],
173
+ stroke: l,
174
+ strokeWidth: 1,
175
+ listening: !1
176
+ })
177
+ );
178
+ o.add(
179
+ new i.Text({
180
+ x: t * n + e.x,
181
+ y: e.y - r + 2,
182
+ text: "" + t * n,
183
+ fontSize: 10,
184
+ fill: f,
185
+ listening: !1
186
+ })
187
+ );
188
+ }
189
+ return o;
190
+ }
191
+ export {
192
+ C as initRule
193
+ };
@@ -0,0 +1,10 @@
1
+ import type { Canvas } from '@das-fed/utils/dimple-canvas/use-dimple-canvas/core/type';
2
+ declare const transformAxis: (containerEl: HTMLDivElement, canvas: Canvas | null | undefined, coordinate: {
3
+ [key: string]: any;
4
+ x: number;
5
+ y: number;
6
+ }) => {
7
+ x: number;
8
+ y: number;
9
+ };
10
+ export { transformAxis };
@@ -0,0 +1,20 @@
1
+ function Y(l, t) {
2
+ const { x: i, y: r } = l;
3
+ var x = i * Math.cos(t * Math.PI / 180) - r * Math.sin(t * Math.PI / 180), h = i * Math.sin(t * Math.PI / 180) + r * Math.cos(t * Math.PI / 180);
4
+ return { x, y: h };
5
+ }
6
+ const w = (l, t, i) => {
7
+ var y, P;
8
+ const { left: r, top: x, width: h, height: M } = l.getBoundingClientRect();
9
+ let { x: o = 0, y: e = 0 } = i;
10
+ o = o - r, e = e - x, o < 0 && (o = 0), o > h && (o = h), e < 0 && (e = 0), e > M && (e = M);
11
+ let d = (t == null ? void 0 : t.x()) || 0, u = (t == null ? void 0 : t.y()) || 0;
12
+ o = o - d, e = e - u;
13
+ const I = ((y = t == null ? void 0 : t.scale()) == null ? void 0 : y.x) || 1, X = ((P = t == null ? void 0 : t.scale()) == null ? void 0 : P.y) || 1;
14
+ o = o / I, e = e / X;
15
+ const f = Y({ x: o, y: e }, 360 - ((t == null ? void 0 : t.rotation()) || 0));
16
+ return o = f.x, e = f.y, { x: o, y: e };
17
+ };
18
+ export {
19
+ w as transformAxis
20
+ };
@@ -0,0 +1,4 @@
1
+ import type { Canvas, Layer } from '@das-fed/utils/dimple-canvas/use-dimple-canvas/core/type';
2
+ declare const initTransformer: (canvas?: Canvas | null, layer?: Layer | null) => any;
3
+ declare const removeTransformer: () => void;
4
+ export { initTransformer, removeTransformer };
@@ -0,0 +1,52 @@
1
+ import { Konva as m } from "@das-fed/utils/dimple-canvas/use-dimple-canvas/core/konva/utils/lib";
2
+ let o, i;
3
+ const h = (t, f) => {
4
+ if (t && f) {
5
+ i = new m.Transformer(), f.add(i), o = new m.Rect({
6
+ fill: "rgba(0,0,255,0.5)",
7
+ visible: !1
8
+ }), f.add(o);
9
+ var g, u, l, d;
10
+ return t.on("mousedown", (e) => {
11
+ e.target === t && (e.evt.preventDefault(), g = t.getPointerPosition().x, u = t.getPointerPosition().y, l = t.getPointerPosition().x, d = t.getPointerPosition().y, o.visible(!0), o.width(0), o.height(0));
12
+ }), t.on("mousemove", (e) => {
13
+ o.visible() && (e.evt.preventDefault(), l = t.getPointerPosition().x, d = t.getPointerPosition().y, o.setAttrs({
14
+ x: Math.min(g, l),
15
+ y: Math.min(u, d),
16
+ width: Math.abs(l - g),
17
+ height: Math.abs(d - u)
18
+ }));
19
+ }), t.on("mouseup", (e) => {
20
+ if (o.visible()) {
21
+ e.evt.preventDefault(), setTimeout(() => {
22
+ o.visible(!1);
23
+ });
24
+ var n = t.find(".rect"), s = o.getClientRect(), r = n.filter((a) => m.Util.haveIntersection(s, a.getClientRect()));
25
+ i.nodes(r);
26
+ }
27
+ }), t.on("click", function(e) {
28
+ if (console.log(e), e.target.name() === "disabled" || o.visible())
29
+ return;
30
+ if (e.target === t) {
31
+ i.nodes([]);
32
+ return;
33
+ }
34
+ const n = e.evt.shiftKey || e.evt.ctrlKey || e.evt.metaKey, s = i.nodes().indexOf(e.target) >= 0;
35
+ if (!n && !s)
36
+ i.nodes([e.target]), i.rotateEnabled(e.target.name() !== "backgroundImage");
37
+ else if (n && s) {
38
+ const r = i.nodes().slice();
39
+ r.splice(r.indexOf(e.target), 1), i.nodes(r);
40
+ } else if (n && !s) {
41
+ const r = i.nodes().concat([e.target]);
42
+ i.nodes(r);
43
+ }
44
+ }), i;
45
+ }
46
+ }, P = () => {
47
+ i.nodes([]);
48
+ };
49
+ export {
50
+ h as initTransformer,
51
+ P as removeTransformer
52
+ };
@@ -0,0 +1,2 @@
1
+ declare const initWheelZoom: (canvas: Canvas) => void;
2
+ export { initWheelZoom };
@@ -0,0 +1,14 @@
1
+ const r = (e) => {
2
+ e.on("wheel", (l) => {
3
+ l.evt.preventDefault();
4
+ let t = e.scaleX(), i = e.getPointerPosition();
5
+ (i.x - e.x()) / t, (i.y - e.y()) / t;
6
+ let o = l.evt.deltaY > 0 ? 1 : -1;
7
+ l.evt.ctrlKey && (o = -o);
8
+ let y = o > 0 ? t * 1.01 : t / 1.01;
9
+ e.scale({ x: y, y });
10
+ });
11
+ };
12
+ export {
13
+ r as initWheelZoom
14
+ };
@@ -0,0 +1,8 @@
1
+ import { useKonva, Konva } from '@das-fed/utils/dimple-canvas/use-dimple-canvas/core/konva';
2
+ import { useAntvX6, Graph } from '@das-fed/utils/dimple-canvas/use-dimple-canvas/core/antv-x6';
3
+ type HookTypeMap = {
4
+ konva: ReturnType<typeof useKonva>;
5
+ 'antv-x6': ReturnType<typeof useAntvX6>;
6
+ };
7
+ declare const useDimpleCanvas: <T extends "konva" | "antv-x6" = "konva">(core?: T, initOptions?: Graph.Options) => T extends "antv-x6" ? any : any;
8
+ export { useDimpleCanvas, Konva, Graph };
@@ -0,0 +1,10 @@
1
+ import { useKonva as o } from "@das-fed/utils/dimple-canvas/use-dimple-canvas/core/konva";
2
+ import { Konva as i } from "@das-fed/utils/dimple-canvas/use-dimple-canvas/core/konva";
3
+ import { useAntvX6 as e } from "@das-fed/utils/dimple-canvas/use-dimple-canvas/core/antv-x6";
4
+ import { Graph as u } from "@das-fed/utils/dimple-canvas/use-dimple-canvas/core/antv-x6";
5
+ const p = (r, t) => (r || o(), r === "antv-x6" ? e(t || {}) : o());
6
+ export {
7
+ u as Graph,
8
+ i as Konva,
9
+ p as useDimpleCanvas
10
+ };
@@ -0,0 +1,3 @@
1
+ export declare const getGlobalData: () => any;
2
+ export declare const setGlobalData: (data: any) => void;
3
+ export declare const watchGlobalData: (cb: any) => void;
@@ -0,0 +1,11 @@
1
+ import { ref as e, computed as o, watch as l } from "vue";
2
+ const a = e({}), c = () => o(() => a.value), u = (t) => {
3
+ a.value = t;
4
+ }, m = (t) => {
5
+ l(() => a, t, { deep: !0, immediate: !0 });
6
+ };
7
+ export {
8
+ c as getGlobalData,
9
+ u as setGlobalData,
10
+ m as watchGlobalData
11
+ };
@@ -0,0 +1,5 @@
1
+ import { devicePanelShow, alarmDevicePanelShow, closeDevicePanel, closeAlarmPanel } from '@das-fed/utils/panel';
2
+ declare const shareDataWatch: (cb: any) => void;
3
+ declare const getShareData: () => any;
4
+ declare const setShareData: (data: any) => void;
5
+ export { setShareData, getShareData, shareDataWatch, devicePanelShow, alarmDevicePanelShow, closeDevicePanel, closeAlarmPanel, };