lty-protocol 1.0.32 → 1.0.33
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 +119 -112
- 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,111 +1,118 @@
|
|
|
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 y, openBlock as m, createElementBlock as d, renderSlot as I, inject as V, computed as C, createBlock as T, resolveDynamicComponent as P, unref as k, normalizeProps as A, guardReactiveProps as D, Fragment as v, renderList as R, toDisplayString as B, createCommentVNode as K, createVNode as w, normalizeStyle as L } from "vue";
|
|
2
|
+
const $ = /* @__PURE__ */ y({
|
|
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 (s, c) => (m(), d("button", {
|
|
29
11
|
class: "my-btn",
|
|
30
|
-
onClick:
|
|
31
|
-
style: B(a.value)
|
|
12
|
+
onClick: a
|
|
32
13
|
}, [
|
|
33
|
-
|
|
34
|
-
]
|
|
14
|
+
I(s.$slots, "default", {}, void 0, !0)
|
|
15
|
+
]));
|
|
35
16
|
}
|
|
36
|
-
}),
|
|
17
|
+
}), U = (n, e) => {
|
|
37
18
|
const t = n.__vccOpts || n;
|
|
38
|
-
for (const [
|
|
39
|
-
t[
|
|
19
|
+
for (const [a, s] of e)
|
|
20
|
+
t[a] = s;
|
|
40
21
|
return t;
|
|
41
|
-
},
|
|
22
|
+
}, x = /* @__PURE__ */ U($, [["__scopeId", "data-v-c654f959"]]), H = /* @__PURE__ */ y({
|
|
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 (s, c) => (m(), d("button", {
|
|
50
31
|
class: "my-btn",
|
|
51
|
-
onClick:
|
|
32
|
+
onClick: a
|
|
52
33
|
}, [
|
|
53
|
-
|
|
34
|
+
I(s.$slots, "default", {}, void 0, !0)
|
|
54
35
|
]));
|
|
55
36
|
}
|
|
56
|
-
}),
|
|
37
|
+
}), te = /* @__PURE__ */ U(H, [["__scopeId", "data-v-1477cfc3"]]), g = /* @__PURE__ */ Symbol("UI_KEY"), O = /* @__PURE__ */ y({
|
|
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, s = V(g);
|
|
45
|
+
if (!s || !s.Input)
|
|
65
46
|
throw new Error("Input not registered");
|
|
66
|
-
const c =
|
|
67
|
-
[
|
|
68
|
-
[
|
|
69
|
-
})),
|
|
70
|
-
return (_,
|
|
47
|
+
const c = s.Input, i = c.modelProp ?? "modelValue", r = c.modelEvent ?? "update:modelValue", l = "on" + r.charAt(0).toUpperCase() + r.slice(1), o = C(() => ({
|
|
48
|
+
[i]: t.modelValue,
|
|
49
|
+
[l]: (_) => a("update:modelValue", _)
|
|
50
|
+
})), f = c.component;
|
|
51
|
+
return (_, N) => (m(), T(P(k(f)), A(D(o.value)), null, 16));
|
|
71
52
|
}
|
|
72
|
-
}),
|
|
53
|
+
}), j = { style: { display: "flex", "align-items": "center" } }, z = {
|
|
54
|
+
key: 0,
|
|
55
|
+
style: { margin: "0 4px" }
|
|
56
|
+
}, G = /* @__PURE__ */ y({
|
|
73
57
|
__name: "IpInput",
|
|
74
58
|
props: {
|
|
75
59
|
modelValue: {}
|
|
76
60
|
},
|
|
77
61
|
emits: ["update:modelValue"],
|
|
78
62
|
setup(n, { emit: e }) {
|
|
79
|
-
const t = n,
|
|
80
|
-
get: () =>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
i
|
|
63
|
+
const t = n, a = e, s = C({
|
|
64
|
+
get: () => {
|
|
65
|
+
const r = (t.modelValue || "0.0.0.0").split(":"), l = r[0].split(".");
|
|
66
|
+
return r.length > 1 ? [...l, r[1]] : l;
|
|
67
|
+
},
|
|
68
|
+
set: (i) => {
|
|
69
|
+
if (i.length > 4) {
|
|
70
|
+
const r = i.slice(0, 4), l = i[4];
|
|
71
|
+
a("update:modelValue", `${r.join(".")}:${l}`);
|
|
72
|
+
} else
|
|
73
|
+
a("update:modelValue", i.join("."));
|
|
74
|
+
}
|
|
75
|
+
}), c = (i, r) => {
|
|
76
|
+
const l = [...s.value];
|
|
77
|
+
if (i < 4) {
|
|
78
|
+
let o = parseInt(r, 10);
|
|
79
|
+
isNaN(o) && (o = 0), o < 0 && (o = 0), o > 255 && (o = 255), l[i] = o.toString();
|
|
80
|
+
} else {
|
|
81
|
+
let o = parseInt(r, 10);
|
|
82
|
+
isNaN(o) && (o = 0), o < 0 && (o = 0), o > 65535 && (o = 65535), l[i] = o.toString();
|
|
83
|
+
}
|
|
84
|
+
s.value = l;
|
|
85
85
|
};
|
|
86
|
-
return (
|
|
87
|
-
(m(!0),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
return (i, r) => (m(), d("div", j, [
|
|
87
|
+
(m(!0), d(v, null, R(s.value, (l, o) => (m(), d(v, { key: o }, [
|
|
88
|
+
o > 0 ? (m(), d("span", z, B(o === 4 ? ":" : "."), 1)) : K("", !0),
|
|
89
|
+
w(O, {
|
|
90
|
+
"model-value": l,
|
|
91
|
+
"onUpdate:modelValue": (f) => c(o, f),
|
|
92
|
+
style: L({
|
|
93
|
+
borderLeft: o > 0 ? "none" : "",
|
|
94
|
+
borderRight: o < s.value.length - 1 ? "none" : "",
|
|
95
|
+
borderRadius: o === 0 ? "4px 0 0 4px" : o === s.value.length - 1 ? "0 4px 4px 0" : "0"
|
|
96
|
+
})
|
|
97
|
+
}, null, 8, ["model-value", "onUpdate:modelValue", "style"])
|
|
98
|
+
], 64))), 128))
|
|
92
99
|
]));
|
|
93
100
|
}
|
|
94
|
-
}),
|
|
101
|
+
}), Y = /* @__PURE__ */ y({
|
|
95
102
|
__name: "InputNumber",
|
|
96
103
|
props: {
|
|
97
104
|
modelValue: {}
|
|
98
105
|
},
|
|
99
106
|
emits: ["update:modelValue"],
|
|
100
107
|
setup(n, { emit: e }) {
|
|
101
|
-
const t = n,
|
|
102
|
-
if (console.log("inject result:",
|
|
108
|
+
const t = n, a = e, s = V(g);
|
|
109
|
+
if (console.log("inject result:", s), !s || !s.InputNumber)
|
|
103
110
|
throw new Error("InputNumber not registered");
|
|
104
|
-
const c =
|
|
105
|
-
[
|
|
106
|
-
[
|
|
107
|
-
})),
|
|
108
|
-
return (_,
|
|
111
|
+
const c = s.InputNumber, i = c.modelProp ?? "modelValue", r = c.modelEvent ?? "update:modelValue", l = "on" + r.charAt(0).toUpperCase() + r.slice(1), o = C(() => ({
|
|
112
|
+
[i]: t.modelValue,
|
|
113
|
+
[l]: (_) => a("update:modelValue", _)
|
|
114
|
+
})), f = c.component;
|
|
115
|
+
return (_, N) => (m(), T(P(k(f)), A(D(o.value)), null, 16));
|
|
109
116
|
}
|
|
110
117
|
});
|
|
111
118
|
class u {
|
|
@@ -125,70 +132,70 @@ class u {
|
|
|
125
132
|
return t.fromPlain(e);
|
|
126
133
|
}
|
|
127
134
|
}
|
|
128
|
-
class
|
|
135
|
+
class F {
|
|
129
136
|
static getDefaultConfig(e) {
|
|
130
137
|
console.log(1231231, e);
|
|
131
|
-
const t = e.baseInfo,
|
|
138
|
+
const t = e.baseInfo, a = e.configuration, s = e.tab;
|
|
132
139
|
return {
|
|
133
140
|
baseInfo: t,
|
|
134
|
-
config:
|
|
135
|
-
tab:
|
|
141
|
+
config: a,
|
|
142
|
+
tab: s
|
|
136
143
|
};
|
|
137
144
|
}
|
|
138
145
|
}
|
|
139
|
-
const
|
|
140
|
-
type:
|
|
141
|
-
baseInfo:
|
|
142
|
-
tab:
|
|
143
|
-
configuration:
|
|
146
|
+
const J = "Ethernet", q = [{ 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" } }], Q = [{ name: { i18nKey: "general" }, key: "general" }, { name: { i18nKey: "ioMapping" }, key: "ioMapping" }], W = { 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" }] }, X = {
|
|
147
|
+
type: J,
|
|
148
|
+
baseInfo: q,
|
|
149
|
+
tab: Q,
|
|
150
|
+
configuration: W
|
|
144
151
|
};
|
|
145
|
-
class
|
|
146
|
-
type =
|
|
147
|
-
moduleType =
|
|
152
|
+
class h extends u {
|
|
153
|
+
type = p.ETHERNET;
|
|
154
|
+
moduleType = E[p.ETHERNET];
|
|
148
155
|
baseInfo;
|
|
149
156
|
config;
|
|
150
157
|
tab;
|
|
151
158
|
constructor(e) {
|
|
152
159
|
super(e);
|
|
153
|
-
const { baseInfo: t, config:
|
|
154
|
-
this.baseInfo = t, this.config =
|
|
160
|
+
const { baseInfo: t, config: a, tab: s } = F.getDefaultConfig(X);
|
|
161
|
+
this.baseInfo = t, this.config = a, this.tab = s;
|
|
155
162
|
}
|
|
156
163
|
static fromPlain(e) {
|
|
157
|
-
return new
|
|
164
|
+
return new h(e);
|
|
158
165
|
}
|
|
159
166
|
}
|
|
160
|
-
class
|
|
161
|
-
type =
|
|
162
|
-
moduleType =
|
|
167
|
+
class S extends u {
|
|
168
|
+
type = p.MODBUS_TCP_SERVER;
|
|
169
|
+
moduleType = E[p.MODBUS_TCP_SERVER];
|
|
163
170
|
constructor(e) {
|
|
164
171
|
super(e);
|
|
165
172
|
}
|
|
166
173
|
static fromPlain(e) {
|
|
167
|
-
return new
|
|
174
|
+
return new S(e);
|
|
168
175
|
}
|
|
169
176
|
}
|
|
170
|
-
class
|
|
171
|
-
type =
|
|
172
|
-
moduleType =
|
|
177
|
+
class b extends u {
|
|
178
|
+
type = p.MODBUS_TCP_CLIENT;
|
|
179
|
+
moduleType = E[p.MODBUS_TCP_CLIENT];
|
|
173
180
|
constructor(e) {
|
|
174
181
|
super(e);
|
|
175
182
|
}
|
|
176
183
|
static fromPlain(e) {
|
|
177
|
-
return new
|
|
184
|
+
return new b(e);
|
|
178
185
|
}
|
|
179
186
|
}
|
|
180
|
-
class
|
|
181
|
-
type =
|
|
182
|
-
moduleType =
|
|
187
|
+
class M extends u {
|
|
188
|
+
type = p.MODBUS_TCP_SLAVE_DEVICE;
|
|
189
|
+
moduleType = E[p.MODBUS_TCP_SLAVE_DEVICE];
|
|
183
190
|
constructor(e) {
|
|
184
191
|
super(e);
|
|
185
192
|
}
|
|
186
193
|
static fromPlain(e) {
|
|
187
|
-
return new
|
|
194
|
+
return new M(e);
|
|
188
195
|
}
|
|
189
196
|
}
|
|
190
|
-
var
|
|
191
|
-
const
|
|
197
|
+
var p = /* @__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))(p || {});
|
|
198
|
+
const E = {
|
|
192
199
|
Pprogrammable: 4096,
|
|
193
200
|
// 根节点
|
|
194
201
|
Protgrammable_Safety: 4098,
|
|
@@ -242,22 +249,22 @@ const C = {
|
|
|
242
249
|
EtherCatModule: 16384
|
|
243
250
|
// Ethercat子模块
|
|
244
251
|
};
|
|
245
|
-
class
|
|
252
|
+
class ne {
|
|
246
253
|
map = /* @__PURE__ */ new Map();
|
|
247
254
|
constructor() {
|
|
248
|
-
u.register("Ethernet",
|
|
255
|
+
u.register("Ethernet", h), u.register("ModbusTCPServer", S), u.register("ModbusTCPClient", b), u.register("ModbusTCPSlaveDevice", M);
|
|
249
256
|
}
|
|
250
257
|
init(e) {
|
|
251
258
|
this.clear(), e.forEach((t) => {
|
|
252
|
-
const
|
|
253
|
-
this.map.set(t.id,
|
|
259
|
+
const a = u.fromPlain(t);
|
|
260
|
+
this.map.set(t.id, a);
|
|
254
261
|
});
|
|
255
262
|
}
|
|
256
263
|
build(e) {
|
|
257
264
|
return "";
|
|
258
265
|
}
|
|
259
266
|
get(e) {
|
|
260
|
-
const t = Array.isArray(e) ? e.map((
|
|
267
|
+
const t = Array.isArray(e) ? e.map((a) => this.map.get(a)).filter((a) => a !== void 0) : this.map.get(e);
|
|
261
268
|
if (Array.isArray(t) && !t.length || !t)
|
|
262
269
|
throw new Error(`Protocol ${e} is not found.`);
|
|
263
270
|
return t;
|
|
@@ -272,27 +279,27 @@ class Z {
|
|
|
272
279
|
this.map.clear();
|
|
273
280
|
}
|
|
274
281
|
}
|
|
275
|
-
const
|
|
282
|
+
const Z = [x, O, Y, G], oe = {
|
|
276
283
|
install(n, e) {
|
|
277
|
-
e && n.provide(g, e),
|
|
284
|
+
e && n.provide(g, e), Z.forEach((t) => {
|
|
278
285
|
n.component(t.name, t);
|
|
279
286
|
});
|
|
280
287
|
}
|
|
281
288
|
};
|
|
282
289
|
export {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
290
|
+
te as Button2,
|
|
291
|
+
h as EthernetProtocolItem,
|
|
292
|
+
O as Input,
|
|
293
|
+
Y as InputNumber,
|
|
294
|
+
G as IpInput,
|
|
295
|
+
b as ModbusTCPClientProtocolItem,
|
|
296
|
+
S as ModbusTCPServerProtocolItem,
|
|
297
|
+
M as ModbusTCPSlaveDeviceProtocolItem,
|
|
298
|
+
x as MyButton,
|
|
299
|
+
ne as ProtocolCollection,
|
|
293
300
|
u as ProtocolItem,
|
|
294
|
-
|
|
301
|
+
p as ProtocolType,
|
|
295
302
|
g as UI_KEY,
|
|
296
|
-
|
|
297
|
-
|
|
303
|
+
oe as default,
|
|
304
|
+
E as protocolMap
|
|
298
305
|
};
|
package/dist/lty-protocol.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(l,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(l=typeof globalThis<"u"?globalThis:l||self,t(l["lty-protocol"]={},l.Vue))})(this,(function(l,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,m)=>(t.openBlock(),t.createElementBlock("button",{class:"my-btn",onClick:s},[t.renderSlot(a.$slots,"default",{},void 0,!0)]))}}),S=(o,e)=>{const n=o.__vccOpts||o;for(const[s,a]of e)n[s]=a;return n},I=S(V,[["__scopeId","data-v-c654f959"]]),k=S(t.defineComponent({name:"MyButton",__name:"button2",emits:["click"],setup(o,{emit:e}){const n=e,s=()=>{n("click")};return(a,m)=>(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"),h=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 m=a.Input,i=m.modelProp??"modelValue",c=m.modelEvent??"update:modelValue",u="on"+c.charAt(0).toUpperCase()+c.slice(1),r=t.computed(()=>({[i]:n.modelValue,[u]:y=>s("update:modelValue",y)})),_=m.component;return(y,K)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(_)),t.normalizeProps(t.guardReactiveProps(r.value)),null,16))}}),B={style:{display:"flex","align-items":"center"}},A={key:0,style:{margin:"0 4px"}},P=t.defineComponent({__name:"IpInput",props:{modelValue:{}},emits:["update:modelValue"],setup(o,{emit:e}){const n=o,s=e,a=t.computed({get:()=>{const c=(n.modelValue||"0.0.0.0").split(":"),u=c[0].split(".");return c.length>1?[...u,c[1]]:u},set:i=>{if(i.length>4){const c=i.slice(0,4),u=i[4];s("update:modelValue",`${c.join(".")}:${u}`)}else s("update:modelValue",i.join("."))}}),m=(i,c)=>{const u=[...a.value];if(i<4){let r=parseInt(c,10);isNaN(r)&&(r=0),r<0&&(r=0),r>255&&(r=255),u[i]=r.toString()}else{let r=parseInt(c,10);isNaN(r)&&(r=0),r<0&&(r=0),r>65535&&(r=65535),u[i]=r.toString()}a.value=u};return(i,c)=>(t.openBlock(),t.createElementBlock("div",B,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,(u,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:r},[r>0?(t.openBlock(),t.createElementBlock("span",A,t.toDisplayString(r===4?":":"."),1)):t.createCommentVNode("",!0),t.createVNode(h,{"model-value":u,"onUpdate:modelValue":_=>m(r,_),style:t.normalizeStyle({borderLeft:r>0?"none":"",borderRight:r<a.value.length-1?"none":"",borderRadius:r===0?"4px 0 0 4px":r===a.value.length-1?"0 4px 4px 0":"0"})},null,8,["model-value","onUpdate:modelValue","style"])],64))),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 m=a.InputNumber,i=m.modelProp??"modelValue",c=m.modelEvent??"update:modelValue",u="on"+c.charAt(0).toUpperCase()+c.slice(1),r=t.computed(()=>({[i]:n.modelValue,[u]:y=>s("update:modelValue",y)})),_=m.component;return(y,K)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(_)),t.normalizeProps(t.guardReactiveProps(r.value)),null,16))}});class p{id;deviceId;type;static registry={};constructor(e){this.id=e.id,this.deviceId=e.deviceId}static register(e,n){p.registry[e]=n}static fromPlain(e){const n=p.registry[e.type];if(!n)throw new Error(`Unsupported protocol type: ${e.type}`);return n.fromPlain(e)}}class D{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 U={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 p{type=d.ETHERNET;moduleType=f[d.ETHERNET];baseInfo;config;tab;constructor(e){super(e);const{baseInfo:n,config:s,tab:a}=D.getDefaultConfig(U);this.baseInfo=n,this.config=s,this.tab=a}static fromPlain(e){return new C(e)}}class g extends p{type=d.MODBUS_TCP_SERVER;moduleType=f[d.MODBUS_TCP_SERVER];constructor(e){super(e)}static fromPlain(e){return new g(e)}}class b extends p{type=d.MODBUS_TCP_CLIENT;moduleType=f[d.MODBUS_TCP_CLIENT];constructor(e){super(e)}static fromPlain(e){return new b(e)}}class M extends p{type=d.MODBUS_TCP_SLAVE_DEVICE;moduleType=f[d.MODBUS_TCP_SLAVE_DEVICE];constructor(e){super(e)}static fromPlain(e){return new M(e)}}var d=(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))(d||{});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 O{map=new Map;constructor(){p.register("Ethernet",C),p.register("ModbusTCPServer",g),p.register("ModbusTCPClient",b),p.register("ModbusTCPSlaveDevice",M)}init(e){this.clear(),e.forEach(n=>{const s=p.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 R=[I,h,T,P],N={install(o,e){e&&o.provide(E,e),R.forEach(n=>{o.component(n.name,n)})}};l.Button2=k,l.EthernetProtocolItem=C,l.Input=h,l.InputNumber=T,l.IpInput=P,l.ModbusTCPClientProtocolItem=b,l.ModbusTCPServerProtocolItem=g,l.ModbusTCPSlaveDeviceProtocolItem=M,l.MyButton=I,l.ProtocolCollection=O,l.ProtocolItem=p,l.ProtocolType=d,l.UI_KEY=E,l.default=N,l.protocolMap=f,Object.defineProperties(l,{__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
|
-
};
|