lty-protocol 1.0.32 → 1.0.34
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/keys.d.ts +2 -31
- package/dist/lty-protocol.css +1 -1
- package/dist/lty-protocol.mjs +90 -109
- package/dist/lty-protocol.umd.js +1 -1
- package/package.json +1 -1
- package/dist/utils/theme.d.ts +0 -7
package/dist/keys.d.ts
CHANGED
|
@@ -4,34 +4,5 @@ export interface ComponentModelConfig {
|
|
|
4
4
|
modelProp?: string;
|
|
5
5
|
modelEvent?: string;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
primary?: string;
|
|
10
|
-
secondary?: string;
|
|
11
|
-
success?: string;
|
|
12
|
-
warning?: string;
|
|
13
|
-
error?: string;
|
|
14
|
-
info?: string;
|
|
15
|
-
};
|
|
16
|
-
spacing?: {
|
|
17
|
-
small?: string;
|
|
18
|
-
medium?: string;
|
|
19
|
-
large?: string;
|
|
20
|
-
};
|
|
21
|
-
borderRadius?: {
|
|
22
|
-
small?: string;
|
|
23
|
-
medium?: string;
|
|
24
|
-
large?: string;
|
|
25
|
-
};
|
|
26
|
-
fontSize?: {
|
|
27
|
-
small?: string;
|
|
28
|
-
medium?: string;
|
|
29
|
-
large?: string;
|
|
30
|
-
};
|
|
31
|
-
[key: string]: any;
|
|
32
|
-
}
|
|
33
|
-
export interface UIConfig {
|
|
34
|
-
components?: Partial<Record<string, ComponentModelConfig>>;
|
|
35
|
-
theme?: ThemeConfig;
|
|
36
|
-
}
|
|
37
|
-
export declare const UI_KEY: InjectionKey<UIConfig>;
|
|
7
|
+
export type UIComponentsMap = Partial<Record<string, ComponentModelConfig>>;
|
|
8
|
+
export declare const UI_KEY: InjectionKey<UIComponentsMap>;
|
package/dist/lty-protocol.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.my-btn[data-v-
|
|
1
|
+
.my-btn[data-v-c654f959],.my-btn[data-v-1477cfc3]{padding:6px 12px;border:1px solid #ccc}
|
package/dist/lty-protocol.mjs
CHANGED
|
@@ -1,114 +1,95 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
const n = h(g, {}), e = () => n.theme || {}, t = (s, a) => e().colors?.[s] || a, o = (s, a) => e().spacing?.[s] || a, r = (s, a) => e().borderRadius?.[s] || a, c = (s, a) => e().fontSize?.[s] || a;
|
|
4
|
-
return {
|
|
5
|
-
theme: e(),
|
|
6
|
-
getColor: t,
|
|
7
|
-
getSpacing: o,
|
|
8
|
-
getBorderRadius: r,
|
|
9
|
-
getFontSize: c
|
|
10
|
-
};
|
|
11
|
-
}, x = /* @__PURE__ */ f({
|
|
1
|
+
import { defineComponent as f, openBlock as p, createElementBlock as y, renderSlot as I, inject as T, computed as C, createBlock as M, resolveDynamicComponent as V, unref as P, normalizeProps as k, guardReactiveProps as A, Fragment as B, renderList as R } from "vue";
|
|
2
|
+
const K = /* @__PURE__ */ f({
|
|
12
3
|
name: "MyButton",
|
|
13
4
|
__name: "MyButton",
|
|
14
5
|
emits: ["click"],
|
|
15
6
|
setup(n, { emit: e }) {
|
|
16
|
-
const t = e,
|
|
17
|
-
padding: r("medium", "6px 12px"),
|
|
18
|
-
border: `1px solid ${o("secondary", "#ccc")}`,
|
|
19
|
-
borderRadius: c("medium", "4px"),
|
|
20
|
-
fontSize: s("medium", "14px"),
|
|
21
|
-
backgroundColor: o("primary", "#fff"),
|
|
22
|
-
color: o("text", "#333"),
|
|
23
|
-
cursor: "pointer",
|
|
24
|
-
transition: "all 0.3s ease"
|
|
25
|
-
})), i = () => {
|
|
7
|
+
const t = e, a = () => {
|
|
26
8
|
t("click");
|
|
27
9
|
};
|
|
28
|
-
return (
|
|
10
|
+
return (o, r) => (p(), y("button", {
|
|
29
11
|
class: "my-btn",
|
|
30
|
-
onClick:
|
|
31
|
-
style: B(a.value)
|
|
12
|
+
onClick: a
|
|
32
13
|
}, [
|
|
33
|
-
|
|
34
|
-
]
|
|
14
|
+
I(o.$slots, "default", {}, void 0, !0)
|
|
15
|
+
]));
|
|
35
16
|
}
|
|
36
17
|
}), D = (n, e) => {
|
|
37
18
|
const t = n.__vccOpts || n;
|
|
38
|
-
for (const [
|
|
39
|
-
t[
|
|
19
|
+
for (const [a, o] of e)
|
|
20
|
+
t[a] = o;
|
|
40
21
|
return t;
|
|
41
|
-
},
|
|
22
|
+
}, w = /* @__PURE__ */ D(K, [["__scopeId", "data-v-c654f959"]]), N = /* @__PURE__ */ f({
|
|
42
23
|
name: "MyButton",
|
|
43
24
|
__name: "button2",
|
|
44
25
|
emits: ["click"],
|
|
45
26
|
setup(n, { emit: e }) {
|
|
46
|
-
const t = e,
|
|
27
|
+
const t = e, a = () => {
|
|
47
28
|
t("click");
|
|
48
29
|
};
|
|
49
|
-
return (
|
|
30
|
+
return (o, r) => (p(), y("button", {
|
|
50
31
|
class: "my-btn",
|
|
51
|
-
onClick:
|
|
32
|
+
onClick: a
|
|
52
33
|
}, [
|
|
53
|
-
|
|
34
|
+
I(o.$slots, "default", {}, void 0, !0)
|
|
54
35
|
]));
|
|
55
36
|
}
|
|
56
|
-
}),
|
|
37
|
+
}), Q = /* @__PURE__ */ D(N, [["__scopeId", "data-v-1477cfc3"]]), g = /* @__PURE__ */ Symbol("UI_KEY"), U = /* @__PURE__ */ f({
|
|
57
38
|
__name: "Input",
|
|
58
39
|
props: {
|
|
59
40
|
modelValue: {}
|
|
60
41
|
},
|
|
61
42
|
emits: ["update:modelValue"],
|
|
62
43
|
setup(n, { emit: e }) {
|
|
63
|
-
const t = n,
|
|
64
|
-
if (
|
|
44
|
+
const t = n, a = e, o = T(g);
|
|
45
|
+
if (!o || !o.Input)
|
|
65
46
|
throw new Error("Input not registered");
|
|
66
|
-
const
|
|
67
|
-
[
|
|
68
|
-
[
|
|
69
|
-
})),
|
|
70
|
-
return (_,
|
|
47
|
+
const r = o.Input, l = r.modelProp ?? "modelValue", c = r.modelEvent ?? "update:modelValue", u = "on" + c.charAt(0).toUpperCase() + c.slice(1), d = C(() => ({
|
|
48
|
+
[l]: t.modelValue,
|
|
49
|
+
[u]: (_) => a("update:modelValue", _)
|
|
50
|
+
})), m = r.component;
|
|
51
|
+
return (_, O) => (p(), M(V(P(m)), k(A(d.value)), null, 16));
|
|
71
52
|
}
|
|
72
|
-
}),
|
|
53
|
+
}), L = { style: { display: "flex", gap: "6px" } }, x = /* @__PURE__ */ f({
|
|
73
54
|
__name: "IpInput",
|
|
74
55
|
props: {
|
|
75
56
|
modelValue: {}
|
|
76
57
|
},
|
|
77
58
|
emits: ["update:modelValue"],
|
|
78
59
|
setup(n, { emit: e }) {
|
|
79
|
-
const t = n,
|
|
60
|
+
const t = n, a = e, o = C({
|
|
80
61
|
get: () => (t.modelValue || "0.0.0.0").split("."),
|
|
81
|
-
set: (
|
|
82
|
-
}),
|
|
83
|
-
const
|
|
84
|
-
|
|
62
|
+
set: (l) => a("update:modelValue", l.join("."))
|
|
63
|
+
}), r = (l, c) => {
|
|
64
|
+
const u = [...o.value];
|
|
65
|
+
u[l] = c, o.value = u;
|
|
85
66
|
};
|
|
86
|
-
return (
|
|
87
|
-
(
|
|
88
|
-
key:
|
|
89
|
-
"model-value":
|
|
90
|
-
"onUpdate:modelValue": (
|
|
67
|
+
return (l, c) => (p(), y("div", L, [
|
|
68
|
+
(p(!0), y(B, null, R(o.value, (u, d) => (p(), M(U, {
|
|
69
|
+
key: d,
|
|
70
|
+
"model-value": u,
|
|
71
|
+
"onUpdate:modelValue": (m) => r(d, m)
|
|
91
72
|
}, null, 8, ["model-value", "onUpdate:modelValue"]))), 128))
|
|
92
73
|
]));
|
|
93
74
|
}
|
|
94
|
-
}),
|
|
75
|
+
}), $ = /* @__PURE__ */ f({
|
|
95
76
|
__name: "InputNumber",
|
|
96
77
|
props: {
|
|
97
78
|
modelValue: {}
|
|
98
79
|
},
|
|
99
80
|
emits: ["update:modelValue"],
|
|
100
81
|
setup(n, { emit: e }) {
|
|
101
|
-
const t = n,
|
|
102
|
-
if (console.log("inject result:",
|
|
82
|
+
const t = n, a = e, o = T(g);
|
|
83
|
+
if (console.log("inject result:", o), !o || !o.InputNumber)
|
|
103
84
|
throw new Error("InputNumber not registered");
|
|
104
|
-
const
|
|
105
|
-
[
|
|
106
|
-
[
|
|
107
|
-
})),
|
|
108
|
-
return (_,
|
|
85
|
+
const r = o.InputNumber, l = r.modelProp ?? "modelValue", c = r.modelEvent ?? "update:modelValue", u = "on" + c.charAt(0).toUpperCase() + c.slice(1), d = C(() => ({
|
|
86
|
+
[l]: t.modelValue,
|
|
87
|
+
[u]: (_) => a("update:modelValue", _)
|
|
88
|
+
})), m = r.component;
|
|
89
|
+
return (_, O) => (p(), M(V(P(m)), k(A(d.value)), null, 16));
|
|
109
90
|
}
|
|
110
91
|
});
|
|
111
|
-
class
|
|
92
|
+
class s {
|
|
112
93
|
id;
|
|
113
94
|
deviceId;
|
|
114
95
|
type;
|
|
@@ -117,78 +98,78 @@ class u {
|
|
|
117
98
|
this.id = e.id, this.deviceId = e.deviceId;
|
|
118
99
|
}
|
|
119
100
|
static register(e, t) {
|
|
120
|
-
|
|
101
|
+
s.registry[e] = t;
|
|
121
102
|
}
|
|
122
103
|
static fromPlain(e) {
|
|
123
|
-
const t =
|
|
104
|
+
const t = s.registry[e.type];
|
|
124
105
|
if (!t) throw new Error(`Unsupported protocol type: ${e.type}`);
|
|
125
106
|
return t.fromPlain(e);
|
|
126
107
|
}
|
|
127
108
|
}
|
|
128
|
-
class
|
|
109
|
+
class H {
|
|
129
110
|
static getDefaultConfig(e) {
|
|
130
111
|
console.log(1231231, e);
|
|
131
|
-
const t = e.baseInfo,
|
|
112
|
+
const t = e.baseInfo, a = e.configuration, o = e.tab;
|
|
132
113
|
return {
|
|
133
114
|
baseInfo: t,
|
|
134
|
-
config:
|
|
135
|
-
tab:
|
|
115
|
+
config: a,
|
|
116
|
+
tab: o
|
|
136
117
|
};
|
|
137
118
|
}
|
|
138
119
|
}
|
|
139
|
-
const
|
|
140
|
-
type:
|
|
120
|
+
const j = "Ethernet", G = [{ key: "name", name: { i18nKey: "name" }, defaultValue: "Ethernet" }, { key: "supplier", name: { i18nKey: "supplier" }, defaultValue: { i18nKey: "company" } }, { key: "version", name: { i18nKey: "verison" }, defaultValue: "1.0.0.0" }, { key: "description", name: { i18nKey: "description" }, defaultValue: { i18nKey: "descriptionMap.ethernet" } }, { key: "category", name: { i18nKey: "category" }, defaultValue: { i18nKey: "ethernet" } }], Y = [{ name: { i18nKey: "general" }, key: "general" }, { name: { i18nKey: "ioMapping" }, key: "ioMapping" }], z = { general: [{ key: "netInterface", name: { i18nKey: "netInterface" }, dataType: "string", componentType: "strInput", defaultValue: "" }, { key: "ipAddress", name: { i18nKey: "ipAddress" }, dataType: "string", componentType: "ipInput", defaultValue: "192.168.1.1" }, { key: "subnetMask", name: { i18nKey: "subnetMask" }, dataType: "string", componentType: "ipInput", defaultValue: "255.255.255.0" }, { key: "defaultGateway", name: { i18nKey: "defaultGateway" }, dataType: "string", componentType: "ipInput", defaultValue: "0.0.0.0" }, { key: "adaptedOSConfiguration", name: { i18nKey: "adaptedOSConfiguration" }, dataType: "boolean", componentType: "switch", defaultValue: !1 }], ioMapping: [{ key: "busCycleTask", name: { i18nKey: "busCycleTask" }, dataType: "string", componentType: "select", defaultValue: "-1" }] }, F = {
|
|
121
|
+
type: j,
|
|
141
122
|
baseInfo: G,
|
|
142
123
|
tab: Y,
|
|
143
|
-
configuration:
|
|
124
|
+
configuration: z
|
|
144
125
|
};
|
|
145
|
-
class b extends
|
|
146
|
-
type =
|
|
147
|
-
moduleType =
|
|
126
|
+
class b extends s {
|
|
127
|
+
type = i.ETHERNET;
|
|
128
|
+
moduleType = E[i.ETHERNET];
|
|
148
129
|
baseInfo;
|
|
149
130
|
config;
|
|
150
131
|
tab;
|
|
151
132
|
constructor(e) {
|
|
152
133
|
super(e);
|
|
153
|
-
const { baseInfo: t, config:
|
|
154
|
-
this.baseInfo = t, this.config =
|
|
134
|
+
const { baseInfo: t, config: a, tab: o } = H.getDefaultConfig(F);
|
|
135
|
+
this.baseInfo = t, this.config = a, this.tab = o;
|
|
155
136
|
}
|
|
156
137
|
static fromPlain(e) {
|
|
157
138
|
return new b(e);
|
|
158
139
|
}
|
|
159
140
|
}
|
|
160
|
-
class
|
|
161
|
-
type =
|
|
162
|
-
moduleType =
|
|
141
|
+
class S extends s {
|
|
142
|
+
type = i.MODBUS_TCP_SERVER;
|
|
143
|
+
moduleType = E[i.MODBUS_TCP_SERVER];
|
|
163
144
|
constructor(e) {
|
|
164
145
|
super(e);
|
|
165
146
|
}
|
|
166
147
|
static fromPlain(e) {
|
|
167
|
-
return new
|
|
148
|
+
return new S(e);
|
|
168
149
|
}
|
|
169
150
|
}
|
|
170
|
-
class
|
|
171
|
-
type =
|
|
172
|
-
moduleType =
|
|
151
|
+
class h extends s {
|
|
152
|
+
type = i.MODBUS_TCP_CLIENT;
|
|
153
|
+
moduleType = E[i.MODBUS_TCP_CLIENT];
|
|
173
154
|
constructor(e) {
|
|
174
155
|
super(e);
|
|
175
156
|
}
|
|
176
157
|
static fromPlain(e) {
|
|
177
|
-
return new
|
|
158
|
+
return new h(e);
|
|
178
159
|
}
|
|
179
160
|
}
|
|
180
|
-
class
|
|
181
|
-
type =
|
|
182
|
-
moduleType =
|
|
161
|
+
class v extends s {
|
|
162
|
+
type = i.MODBUS_TCP_SLAVE_DEVICE;
|
|
163
|
+
moduleType = E[i.MODBUS_TCP_SLAVE_DEVICE];
|
|
183
164
|
constructor(e) {
|
|
184
165
|
super(e);
|
|
185
166
|
}
|
|
186
167
|
static fromPlain(e) {
|
|
187
|
-
return new
|
|
168
|
+
return new v(e);
|
|
188
169
|
}
|
|
189
170
|
}
|
|
190
|
-
var
|
|
191
|
-
const
|
|
171
|
+
var i = /* @__PURE__ */ ((n) => (n.ETHERNET = "Ethernet", n.MODBUS_TCP_SERVER = "ModbusTCPServer", n.MODBUS_TCP_CLIENT = "ModbusTCPClient", n.MODBUS_TCP_SLAVE_DEVICE = "ModbusTCPSlaveDevice", n.MODBUS_SERIAL_PORT = "ModbusSerialPort", n.MODBUS_MASTER = "ModbusMaster", n.MODBUS_SLAVE = "ModbusSlave", n.MODBUS_SERIAL = "ModbusSerial", n.OPCUA_SERVER = "OPCUAServer", n.ETHER_CAT_MASTER = "EtherCatMaster", n.ETHER_CAT_SLAVE = "EtherCatSlave", n.ETHER_CAT_MODULE = "EtherCatModule", n))(i || {});
|
|
172
|
+
const E = {
|
|
192
173
|
Pprogrammable: 4096,
|
|
193
174
|
// 根节点
|
|
194
175
|
Protgrammable_Safety: 4098,
|
|
@@ -242,22 +223,22 @@ const C = {
|
|
|
242
223
|
EtherCatModule: 16384
|
|
243
224
|
// Ethercat子模块
|
|
244
225
|
};
|
|
245
|
-
class
|
|
226
|
+
class W {
|
|
246
227
|
map = /* @__PURE__ */ new Map();
|
|
247
228
|
constructor() {
|
|
248
|
-
|
|
229
|
+
s.register("Ethernet", b), s.register("ModbusTCPServer", S), s.register("ModbusTCPClient", h), s.register("ModbusTCPSlaveDevice", v);
|
|
249
230
|
}
|
|
250
231
|
init(e) {
|
|
251
232
|
this.clear(), e.forEach((t) => {
|
|
252
|
-
const
|
|
253
|
-
this.map.set(t.id,
|
|
233
|
+
const a = s.fromPlain(t);
|
|
234
|
+
this.map.set(t.id, a);
|
|
254
235
|
});
|
|
255
236
|
}
|
|
256
237
|
build(e) {
|
|
257
238
|
return "";
|
|
258
239
|
}
|
|
259
240
|
get(e) {
|
|
260
|
-
const t = Array.isArray(e) ? e.map((
|
|
241
|
+
const t = Array.isArray(e) ? e.map((a) => this.map.get(a)).filter((a) => a !== void 0) : this.map.get(e);
|
|
261
242
|
if (Array.isArray(t) && !t.length || !t)
|
|
262
243
|
throw new Error(`Protocol ${e} is not found.`);
|
|
263
244
|
return t;
|
|
@@ -272,27 +253,27 @@ class Z {
|
|
|
272
253
|
this.map.clear();
|
|
273
254
|
}
|
|
274
255
|
}
|
|
275
|
-
const
|
|
256
|
+
const J = [w, U, $, x], X = {
|
|
276
257
|
install(n, e) {
|
|
277
|
-
e && n.provide(g, e),
|
|
258
|
+
e && n.provide(g, e), J.forEach((t) => {
|
|
278
259
|
n.component(t.name, t);
|
|
279
260
|
});
|
|
280
261
|
}
|
|
281
262
|
};
|
|
282
263
|
export {
|
|
283
|
-
|
|
264
|
+
Q as Button2,
|
|
284
265
|
b as EthernetProtocolItem,
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
266
|
+
U as Input,
|
|
267
|
+
$ as InputNumber,
|
|
268
|
+
x as IpInput,
|
|
269
|
+
h as ModbusTCPClientProtocolItem,
|
|
270
|
+
S as ModbusTCPServerProtocolItem,
|
|
271
|
+
v as ModbusTCPSlaveDeviceProtocolItem,
|
|
272
|
+
w as MyButton,
|
|
273
|
+
W as ProtocolCollection,
|
|
274
|
+
s as ProtocolItem,
|
|
275
|
+
i as ProtocolType,
|
|
295
276
|
g as UI_KEY,
|
|
296
|
-
|
|
297
|
-
|
|
277
|
+
X as default,
|
|
278
|
+
E as protocolMap
|
|
298
279
|
};
|
package/dist/lty-protocol.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(r,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(r=typeof globalThis<"u"?globalThis:r||self,t(r["lty-protocol"]={},r.Vue))})(this,(function(r,t){"use strict";const V=t.defineComponent({name:"MyButton",__name:"MyButton",emits:["click"],setup(o,{emit:e}){const n=e,s=()=>{n("click")};return(a,l)=>(t.openBlock(),t.createElementBlock("button",{class:"my-btn",onClick:s},[t.renderSlot(a.$slots,"default",{},void 0,!0)]))}}),h=(o,e)=>{const n=o.__vccOpts||o;for(const[s,a]of e)n[s]=a;return n},I=h(V,[["__scopeId","data-v-c654f959"]]),k=h(t.defineComponent({name:"MyButton",__name:"button2",emits:["click"],setup(o,{emit:e}){const n=e,s=()=>{n("click")};return(a,l)=>(t.openBlock(),t.createElementBlock("button",{class:"my-btn",onClick:s},[t.renderSlot(a.$slots,"default",{},void 0,!0)]))}}),[["__scopeId","data-v-1477cfc3"]]),E=Symbol("UI_KEY"),g=t.defineComponent({__name:"Input",props:{modelValue:{}},emits:["update:modelValue"],setup(o,{emit:e}){const n=o,s=e,a=t.inject(E);if(!a||!a.Input)throw new Error("Input not registered");const l=a.Input,u=l.modelProp??"modelValue",p=l.modelEvent??"update:modelValue",d="on"+p.charAt(0).toUpperCase()+p.slice(1),m=t.computed(()=>({[u]:n.modelValue,[d]:y=>s("update:modelValue",y)})),_=l.component;return(y,R)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(_)),t.normalizeProps(t.guardReactiveProps(m.value)),null,16))}}),B={style:{display:"flex",gap:"6px"}},P=t.defineComponent({__name:"IpInput",props:{modelValue:{}},emits:["update:modelValue"],setup(o,{emit:e}){const n=o,s=e,a=t.computed({get:()=>(n.modelValue||"0.0.0.0").split("."),set:u=>s("update:modelValue",u.join("."))}),l=(u,p)=>{const d=[...a.value];d[u]=p,a.value=d};return(u,p)=>(t.openBlock(),t.createElementBlock("div",B,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,(d,m)=>(t.openBlock(),t.createBlock(g,{key:m,"model-value":d,"onUpdate:modelValue":_=>l(m,_)},null,8,["model-value","onUpdate:modelValue"]))),128))]))}}),T=t.defineComponent({__name:"InputNumber",props:{modelValue:{}},emits:["update:modelValue"],setup(o,{emit:e}){const n=o,s=e,a=t.inject(E);if(console.log("inject result:",a),!a||!a.InputNumber)throw new Error("InputNumber not registered");const l=a.InputNumber,u=l.modelProp??"modelValue",p=l.modelEvent??"update:modelValue",d="on"+p.charAt(0).toUpperCase()+p.slice(1),m=t.computed(()=>({[u]:n.modelValue,[d]:y=>s("update:modelValue",y)})),_=l.component;return(y,R)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(_)),t.normalizeProps(t.guardReactiveProps(m.value)),null,16))}});class c{id;deviceId;type;static registry={};constructor(e){this.id=e.id,this.deviceId=e.deviceId}static register(e,n){c.registry[e]=n}static fromPlain(e){const n=c.registry[e.type];if(!n)throw new Error(`Unsupported protocol type: ${e.type}`);return n.fromPlain(e)}}class A{static getDefaultConfig(e){console.log(1231231,e);const n=e.baseInfo,s=e.configuration,a=e.tab;return{baseInfo:n,config:s,tab:a}}}const D={type:"Ethernet",baseInfo:[{key:"name",name:{i18nKey:"name"},defaultValue:"Ethernet"},{key:"supplier",name:{i18nKey:"supplier"},defaultValue:{i18nKey:"company"}},{key:"version",name:{i18nKey:"verison"},defaultValue:"1.0.0.0"},{key:"description",name:{i18nKey:"description"},defaultValue:{i18nKey:"descriptionMap.ethernet"}},{key:"category",name:{i18nKey:"category"},defaultValue:{i18nKey:"ethernet"}}],tab:[{name:{i18nKey:"general"},key:"general"},{name:{i18nKey:"ioMapping"},key:"ioMapping"}],configuration:{general:[{key:"netInterface",name:{i18nKey:"netInterface"},dataType:"string",componentType:"strInput",defaultValue:""},{key:"ipAddress",name:{i18nKey:"ipAddress"},dataType:"string",componentType:"ipInput",defaultValue:"192.168.1.1"},{key:"subnetMask",name:{i18nKey:"subnetMask"},dataType:"string",componentType:"ipInput",defaultValue:"255.255.255.0"},{key:"defaultGateway",name:{i18nKey:"defaultGateway"},dataType:"string",componentType:"ipInput",defaultValue:"0.0.0.0"},{key:"adaptedOSConfiguration",name:{i18nKey:"adaptedOSConfiguration"},dataType:"boolean",componentType:"switch",defaultValue:!1}],ioMapping:[{key:"busCycleTask",name:{i18nKey:"busCycleTask"},dataType:"string",componentType:"select",defaultValue:"-1"}]}};class C extends c{type=i.ETHERNET;moduleType=f[i.ETHERNET];baseInfo;config;tab;constructor(e){super(e);const{baseInfo:n,config:s,tab:a}=A.getDefaultConfig(D);this.baseInfo=n,this.config=s,this.tab=a}static fromPlain(e){return new C(e)}}class M extends c{type=i.MODBUS_TCP_SERVER;moduleType=f[i.MODBUS_TCP_SERVER];constructor(e){super(e)}static fromPlain(e){return new M(e)}}class b extends c{type=i.MODBUS_TCP_CLIENT;moduleType=f[i.MODBUS_TCP_CLIENT];constructor(e){super(e)}static fromPlain(e){return new b(e)}}class S extends c{type=i.MODBUS_TCP_SLAVE_DEVICE;moduleType=f[i.MODBUS_TCP_SLAVE_DEVICE];constructor(e){super(e)}static fromPlain(e){return new S(e)}}var i=(o=>(o.ETHERNET="Ethernet",o.MODBUS_TCP_SERVER="ModbusTCPServer",o.MODBUS_TCP_CLIENT="ModbusTCPClient",o.MODBUS_TCP_SLAVE_DEVICE="ModbusTCPSlaveDevice",o.MODBUS_SERIAL_PORT="ModbusSerialPort",o.MODBUS_MASTER="ModbusMaster",o.MODBUS_SLAVE="ModbusSlave",o.MODBUS_SERIAL="ModbusSerial",o.OPCUA_SERVER="OPCUAServer",o.ETHER_CAT_MASTER="EtherCatMaster",o.ETHER_CAT_SLAVE="EtherCatSlave",o.ETHER_CAT_MODULE="EtherCatModule",o))(i||{});const f={Pprogrammable:4096,Protgrammable_Safety:4098,CAN_Master:16,CAN_Slave:17,CAN_Device:18,EtherCat_Master:64,EtherCat_Slave:65,ProfinetIO_Master:80,ProfinetIO_Device:81,EthernetIP_Scanner:100,EthernetIP_Adapter:101,Ethernet:110,ModbusTCPServer:88,ModbusTCPClient:89,ModbusTCPSlaveDevice:115,ModbusSerialPort:92,ModbusMaster:90,ModbusSlave:91,ModbusSerial:94,OPCUAServer:128,EtherCatMaster:64,EtherCatSlave:16384,EtherCatModule:16384};class U{map=new Map;constructor(){c.register("Ethernet",C),c.register("ModbusTCPServer",M),c.register("ModbusTCPClient",b),c.register("ModbusTCPSlaveDevice",S)}init(e){this.clear(),e.forEach(n=>{const s=c.fromPlain(n);this.map.set(n.id,s)})}build(e){return""}get(e){const n=Array.isArray(e)?e.map(s=>this.map.get(s)).filter(s=>s!==void 0):this.map.get(e);if(Array.isArray(n)&&!n.length||!n)throw new Error(`Protocol ${e} is not found.`);return n}add(e){this.map.set(e.id,e)}delete(e){Array.isArray(e)?e.forEach(n=>this.map.delete(n)):this.map.delete(e)}clear(){this.map.clear()}}const v=[I,g,T,P],O={install(o,e){e&&o.provide(E,e),v.forEach(n=>{o.component(n.name,n)})}};r.Button2=k,r.EthernetProtocolItem=C,r.Input=g,r.InputNumber=T,r.IpInput=P,r.ModbusTCPClientProtocolItem=b,r.ModbusTCPServerProtocolItem=M,r.ModbusTCPSlaveDeviceProtocolItem=S,r.MyButton=I,r.ProtocolCollection=U,r.ProtocolItem=c,r.ProtocolType=i,r.UI_KEY=E,r.default=O,r.protocolMap=f,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
package/package.json
CHANGED
package/dist/utils/theme.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const useTheme: () => {
|
|
2
|
-
theme: import('..').ThemeConfig;
|
|
3
|
-
getColor: (key: string, defaultValue?: string) => any;
|
|
4
|
-
getSpacing: (key: string, defaultValue?: string) => any;
|
|
5
|
-
getBorderRadius: (key: string, defaultValue?: string) => any;
|
|
6
|
-
getFontSize: (key: string, defaultValue?: string) => any;
|
|
7
|
-
};
|