lty-protocol 1.0.36 → 1.0.38

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.
@@ -0,0 +1,30 @@
1
+ type __VLS_Props = {
2
+ modelValue: any;
3
+ tabs?: Array<{
4
+ name: {
5
+ i18nKey: string;
6
+ };
7
+ key: string;
8
+ }>;
9
+ };
10
+ declare function __VLS_template(): {
11
+ attrs: Partial<{}>;
12
+ slots: Partial<Record<string, (_: {}) => any>> & {
13
+ default?(_: {}): any;
14
+ };
15
+ refs: {};
16
+ rootEl: any;
17
+ };
18
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
19
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
20
+ "update:modelValue": (v: any) => any;
21
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
22
+ "onUpdate:modelValue"?: ((v: any) => any) | undefined;
23
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
24
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
25
+ export default _default;
26
+ type __VLS_WithTemplateSlots<T, S> = T & {
27
+ new (): {
28
+ $slots: S;
29
+ };
30
+ };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,13 @@
1
1
  import { Plugin } from 'vue';
2
- import { default as MyButton } from './components/MyButton.vue';
3
- import { default as Button2 } from './components/button2.vue';
4
2
  import { default as Input } from './components/Input.vue';
5
3
  import { default as IpInput } from './components/IpInput.vue';
6
4
  import { default as InputNumber } from './components/InputNumber.vue';
5
+ import { default as Ethernet } from './views/Ethernet.vue';
7
6
  declare const Protocol: Plugin;
8
7
  /**
9
8
  * 导出组件
10
9
  */
11
- export { MyButton, Button2, Input, InputNumber, IpInput };
10
+ export { Input, InputNumber, IpInput, Ethernet };
12
11
  /**
13
12
  * 导出协议模型
14
13
  */
@@ -1 +1 @@
1
- .my-btn[data-v-c654f959],.my-btn[data-v-1477cfc3]{padding:6px 12px;border:1px solid #ccc}
1
+ .tab-content[data-v-163637c2]{padding:20px}.config-item[data-v-163637c2]{margin-bottom:16px;display:flex;align-items:center}.config-item label[data-v-163637c2]{width:120px;margin-right:16px}.config-item input[data-v-163637c2]{flex:1;padding:8px;border:1px solid #ddd;border-radius:4px}
@@ -1,121 +1,167 @@
1
- import { defineComponent as y, openBlock as m, createElementBlock as d, renderSlot as I, inject as V, computed as g, 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({
3
- name: "MyButton",
4
- __name: "MyButton",
5
- emits: ["click"],
6
- setup(n, { emit: e }) {
7
- const t = e, a = () => {
8
- t("click");
9
- };
10
- return (r, u) => (m(), d("button", {
11
- class: "my-btn",
12
- onClick: a
13
- }, [
14
- I(r.$slots, "default", {}, void 0, !0)
15
- ]));
16
- }
17
- }), U = (n, e) => {
18
- const t = n.__vccOpts || n;
19
- for (const [a, r] of e)
20
- t[a] = r;
21
- return t;
22
- }, x = /* @__PURE__ */ U($, [["__scopeId", "data-v-c654f959"]]), H = /* @__PURE__ */ y({
23
- name: "MyButton",
24
- __name: "button2",
25
- emits: ["click"],
26
- setup(n, { emit: e }) {
27
- const t = e, a = () => {
28
- t("click");
29
- };
30
- return (r, u) => (m(), d("button", {
31
- class: "my-btn",
32
- onClick: a
33
- }, [
34
- I(r.$slots, "default", {}, void 0, !0)
35
- ]));
36
- }
37
- }), te = /* @__PURE__ */ U(H, [["__scopeId", "data-v-1477cfc3"]]), C = /* @__PURE__ */ Symbol("UI_KEY"), O = /* @__PURE__ */ y({
1
+ import { defineComponent as b, inject as k, computed as S, openBlock as p, createBlock as E, resolveDynamicComponent as g, unref as v, normalizeProps as A, guardReactiveProps as D, createElementBlock as m, Fragment as _, renderList as V, toDisplayString as B, createCommentVNode as H, createVNode as L, normalizeStyle as j, withCtx as P, renderSlot as R, ref as K, createElementVNode as F } from "vue";
2
+ const T = /* @__PURE__ */ Symbol("UI_KEY"), $ = /* @__PURE__ */ b({
38
3
  __name: "Input",
39
4
  props: {
40
5
  modelValue: {}
41
6
  },
42
7
  emits: ["update:modelValue"],
43
- setup(n, { emit: e }) {
44
- const t = n, a = e, r = V(C);
45
- if (!r || !r.Input)
8
+ setup(a, { emit: e }) {
9
+ const n = a, s = e, o = k(T);
10
+ if (!o || !o.Input)
46
11
  throw new Error("Input not registered");
47
- const u = r.Input, i = u.modelProp ?? "modelValue", s = u.modelEvent ?? "update:modelValue", l = "on" + s.charAt(0).toUpperCase() + s.slice(1), o = g(() => ({
48
- [i]: t.modelValue,
49
- [l]: (_) => a("update:modelValue", _)
50
- })), f = u.component;
51
- return (_, N) => (m(), T(P(k(f)), A(D(o.value)), null, 16));
12
+ const c = o.Input, u = c.modelProp ?? "modelValue", r = c.modelEvent ?? "update:modelValue", l = "on" + r.charAt(0).toUpperCase() + r.slice(1), t = S(() => ({
13
+ [u]: n.modelValue,
14
+ [l]: (f) => s("update:modelValue", f)
15
+ })), i = c.component;
16
+ return (f, M) => (p(), E(g(v(i)), A(D(t.value)), null, 16));
52
17
  }
53
- }), j = { style: { display: "flex", "align-items": "center" } }, z = {
18
+ }), z = { style: { display: "flex", "align-items": "center" } }, G = {
54
19
  key: 0,
55
20
  style: { margin: "0 4px", "background-color": "inherit" }
56
- }, G = /* @__PURE__ */ y({
21
+ }, x = /* @__PURE__ */ b({
57
22
  __name: "IpInput",
58
23
  props: {
59
24
  modelValue: {}
60
25
  },
61
26
  emits: ["update:modelValue"],
62
- setup(n, { emit: e }) {
63
- const t = n, a = e, r = g({
27
+ setup(a, { emit: e }) {
28
+ const n = a, s = e, o = S({
64
29
  get: () => {
65
- const s = (t.modelValue || "0.0.0.0").split(":"), l = s[0].split(".");
66
- return s.length > 1 ? [...l, s[1]] : l;
30
+ const r = (n.modelValue || "0.0.0.0").split(":"), l = r[0].split(".");
31
+ return r.length > 1 ? [...l, r[1]] : l;
67
32
  },
68
- set: (i) => {
69
- if (i.length > 4) {
70
- const s = i.slice(0, 4), l = i[4];
71
- a("update:modelValue", `${s.join(".")}:${l}`);
33
+ set: (u) => {
34
+ if (u.length > 4) {
35
+ const r = u.slice(0, 4), l = u[4];
36
+ s("update:modelValue", `${r.join(".")}:${l}`);
72
37
  } else
73
- a("update:modelValue", i.join("."));
38
+ s("update:modelValue", u.join("."));
74
39
  }
75
- }), u = (i, s) => {
76
- const l = [...r.value];
77
- if (i < 4) {
78
- let o = parseInt(s, 10);
79
- isNaN(o) && (o = 0), o < 0 && (o = 0), o > 255 && (o = 255), l[i] = o.toString();
40
+ }), c = (u, r) => {
41
+ const l = [...o.value];
42
+ if (u < 4) {
43
+ let t = parseInt(r, 10);
44
+ isNaN(t) && (t = 0), t < 0 && (t = 0), t > 255 && (t = 255), l[u] = t.toString();
80
45
  } else {
81
- let o = parseInt(s, 10);
82
- isNaN(o) && (o = 0), o < 0 && (o = 0), o > 65535 && (o = 65535), l[i] = o.toString();
46
+ let t = parseInt(r, 10);
47
+ isNaN(t) && (t = 0), t < 0 && (t = 0), t > 65535 && (t = 65535), l[u] = t.toString();
83
48
  }
84
- r.value = l;
49
+ o.value = l;
85
50
  };
86
- return (i, s) => (m(), d("div", j, [
87
- (m(!0), d(v, null, R(r.value, (l, o) => (m(), d(v, { key: o }, [
88
- o > 0 ? (m(), d("span", z, B(o === 4 ? ":" : "."), 1)) : K("", !0),
89
- w(O, {
51
+ return (u, r) => (p(), m("div", z, [
52
+ (p(!0), m(_, null, V(o.value, (l, t) => (p(), m(_, { key: t }, [
53
+ t > 0 ? (p(), m("span", G, B(t === 4 ? ":" : "."), 1)) : H("", !0),
54
+ L($, {
90
55
  "model-value": l,
91
- "onUpdate:modelValue": (f) => u(o, f),
92
- style: L({
93
- borderLeft: o > 0 ? "none" : "",
94
- borderRight: o < r.value.length - 1 ? "none" : "",
95
- borderRadius: o === 0 ? "4px 0 0 4px" : o === r.value.length - 1 ? "0 4px 4px 0" : "0"
56
+ "onUpdate:modelValue": (i) => c(t, i),
57
+ style: j({
58
+ borderLeft: t > 0 ? "none" : "",
59
+ borderRight: t < o.value.length - 1 ? "none" : "",
60
+ borderRadius: t === 0 ? "4px 0 0 4px" : t === o.value.length - 1 ? "0 4px 4px 0" : "0"
96
61
  })
97
62
  }, null, 8, ["model-value", "onUpdate:modelValue", "style"])
98
63
  ], 64))), 128))
99
64
  ]));
100
65
  }
101
- }), Y = /* @__PURE__ */ y({
66
+ }), Y = /* @__PURE__ */ b({
102
67
  __name: "InputNumber",
103
68
  props: {
104
69
  modelValue: {}
105
70
  },
106
71
  emits: ["update:modelValue"],
107
- setup(n, { emit: e }) {
108
- const t = n, a = e, r = V(C);
109
- if (console.log("inject result:", r), !r || !r.InputNumber)
72
+ setup(a, { emit: e }) {
73
+ const n = a, s = e, o = k(T);
74
+ if (console.log("inject result:", o), !o || !o.InputNumber)
110
75
  throw new Error("InputNumber not registered");
111
- const u = r.InputNumber, i = u.modelProp ?? "modelValue", s = u.modelEvent ?? "update:modelValue", l = "on" + s.charAt(0).toUpperCase() + s.slice(1), o = g(() => ({
112
- [i]: t.modelValue,
113
- [l]: (_) => a("update:modelValue", _)
114
- })), f = u.component;
115
- return (_, N) => (m(), T(P(k(f)), A(D(o.value)), null, 16));
76
+ const c = o.InputNumber, u = c.modelProp ?? "modelValue", r = c.modelEvent ?? "update:modelValue", l = "on" + r.charAt(0).toUpperCase() + r.slice(1), t = S(() => ({
77
+ [u]: n.modelValue,
78
+ [l]: (f) => s("update:modelValue", f)
79
+ })), i = c.component;
80
+ return (f, M) => (p(), E(g(v(i)), A(D(t.value)), null, 16));
81
+ }
82
+ }), J = /* @__PURE__ */ b({
83
+ __name: "Tab",
84
+ props: {
85
+ modelValue: {},
86
+ tabs: {}
87
+ },
88
+ emits: ["update:modelValue"],
89
+ setup(a, { emit: e }) {
90
+ const n = a, s = e, o = k(T);
91
+ if (!o || !o.Tab)
92
+ throw new Error("Tab not registered");
93
+ if (!o || !o.TabItem)
94
+ throw new Error("TabItem not registered");
95
+ const c = o.Tab, u = o.TabItem, r = c.modelProp ?? "modelValue", l = c.modelEvent ?? "update:modelValue", t = "on" + l.charAt(0).toUpperCase() + l.slice(1), i = S(() => ({
96
+ [r]: n.modelValue,
97
+ [t]: (C) => s("update:modelValue", C)
98
+ })), f = c.component, M = u.component;
99
+ return (C, re) => (p(), E(g(v(f)), A(D(i.value)), {
100
+ default: P(() => [
101
+ (p(!0), m(_, null, V(a.tabs, (h) => (p(), E(g(v(M)), {
102
+ key: h.key,
103
+ label: h.name.i18nKey,
104
+ name: h.key
105
+ }, {
106
+ default: P(() => [
107
+ R(C.$slots, h.key)
108
+ ]),
109
+ _: 2
110
+ }, 1032, ["label", "name"]))), 128)),
111
+ R(C.$slots, "default")
112
+ ]),
113
+ _: 3
114
+ }, 16));
115
+ }
116
+ }), q = /* @__PURE__ */ b({
117
+ __name: "Ethernet",
118
+ props: {
119
+ data: {}
120
+ },
121
+ setup(a) {
122
+ const e = a, n = K(e.data.tab[0]?.key || ""), s = K({});
123
+ (() => {
124
+ const r = e.data.config;
125
+ for (const l in r)
126
+ r[l].forEach((i) => {
127
+ s.value[i.key] = i.defaultValue;
128
+ });
129
+ })();
130
+ const c = (r) => e.data.config[r] || [], u = (r) => r === "ipInput" ? x : "input";
131
+ return (r, l) => (p(), m("div", null, [
132
+ L(J, {
133
+ modelValue: n.value,
134
+ "onUpdate:modelValue": l[0] || (l[0] = (t) => n.value = t),
135
+ tabs: a.data.tab
136
+ }, {
137
+ default: P(() => [
138
+ (p(!0), m(_, null, V(a.data.tab, (t) => (p(), m("div", {
139
+ key: t.key,
140
+ class: "tab-content"
141
+ }, [
142
+ (p(!0), m(_, null, V(c(t.key), (i) => (p(), m("div", {
143
+ key: i.key,
144
+ class: "config-item"
145
+ }, [
146
+ F("label", null, B(i.name.i18nKey), 1),
147
+ (p(), E(g(u(i.componentType)), {
148
+ modelValue: s.value[i.key],
149
+ "onUpdate:modelValue": (f) => s.value[i.key] = f
150
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]))
151
+ ]))), 128))
152
+ ]))), 128))
153
+ ]),
154
+ _: 1
155
+ }, 8, ["modelValue", "tabs"])
156
+ ]));
116
157
  }
117
- });
118
- class c {
158
+ }), Q = (a, e) => {
159
+ const n = a.__vccOpts || a;
160
+ for (const [s, o] of e)
161
+ n[s] = o;
162
+ return n;
163
+ }, W = /* @__PURE__ */ Q(q, [["__scopeId", "data-v-163637c2"]]);
164
+ class d {
119
165
  id;
120
166
  deviceId;
121
167
  type;
@@ -123,79 +169,79 @@ class c {
123
169
  constructor(e) {
124
170
  this.id = e.id, this.deviceId = e.deviceId;
125
171
  }
126
- static register(e, t) {
127
- c.registry[e] = t;
172
+ static register(e, n) {
173
+ d.registry[e] = n;
128
174
  }
129
175
  static fromPlain(e) {
130
- const t = c.registry[e.type];
131
- if (!t) throw new Error(`Unsupported protocol type: ${e.type}`);
132
- return t.fromPlain(e);
176
+ const n = d.registry[e.type];
177
+ if (!n) throw new Error(`Unsupported protocol type: ${e.type}`);
178
+ return n.fromPlain(e);
133
179
  }
134
180
  }
135
- class F {
181
+ class X {
136
182
  static getDefaultConfig(e) {
137
183
  console.log(1231231, e);
138
- const t = e.baseInfo, a = e.configuration, r = e.tab;
184
+ const n = e.baseInfo, s = e.configuration, o = e.tab;
139
185
  return {
140
- baseInfo: t,
141
- config: a,
142
- tab: r
186
+ baseInfo: n,
187
+ config: s,
188
+ tab: o
143
189
  };
144
190
  }
145
191
  }
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
192
+ const Z = "Ethernet", ee = [{ 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" } }], te = [{ name: { i18nKey: "general" }, key: "general" }, { name: { i18nKey: "ioMapping" }, key: "ioMapping" }], ne = { 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" }] }, ae = {
193
+ type: Z,
194
+ baseInfo: ee,
195
+ tab: te,
196
+ configuration: ne
151
197
  };
152
- class h extends c {
153
- type = p.ETHERNET;
154
- moduleType = E[p.ETHERNET];
198
+ class U extends d {
199
+ type = y.ETHERNET;
200
+ moduleType = I[y.ETHERNET];
155
201
  baseInfo;
156
202
  config;
157
203
  tab;
158
204
  constructor(e) {
159
205
  super(e);
160
- const { baseInfo: t, config: a, tab: r } = F.getDefaultConfig(X);
161
- this.baseInfo = t, this.config = a, this.tab = r;
206
+ const { baseInfo: n, config: s, tab: o } = X.getDefaultConfig(ae);
207
+ this.baseInfo = n, this.config = s, this.tab = o;
162
208
  }
163
209
  static fromPlain(e) {
164
- return new h(e);
210
+ return new U(e);
165
211
  }
166
212
  }
167
- class b extends c {
168
- type = p.MODBUS_TCP_SERVER;
169
- moduleType = E[p.MODBUS_TCP_SERVER];
213
+ class N extends d {
214
+ type = y.MODBUS_TCP_SERVER;
215
+ moduleType = I[y.MODBUS_TCP_SERVER];
170
216
  constructor(e) {
171
217
  super(e);
172
218
  }
173
219
  static fromPlain(e) {
174
- return new b(e);
220
+ return new N(e);
175
221
  }
176
222
  }
177
- class S extends c {
178
- type = p.MODBUS_TCP_CLIENT;
179
- moduleType = E[p.MODBUS_TCP_CLIENT];
223
+ class O extends d {
224
+ type = y.MODBUS_TCP_CLIENT;
225
+ moduleType = I[y.MODBUS_TCP_CLIENT];
180
226
  constructor(e) {
181
227
  super(e);
182
228
  }
183
229
  static fromPlain(e) {
184
- return new S(e);
230
+ return new O(e);
185
231
  }
186
232
  }
187
- class M extends c {
188
- type = p.MODBUS_TCP_SLAVE_DEVICE;
189
- moduleType = E[p.MODBUS_TCP_SLAVE_DEVICE];
233
+ class w extends d {
234
+ type = y.MODBUS_TCP_SLAVE_DEVICE;
235
+ moduleType = I[y.MODBUS_TCP_SLAVE_DEVICE];
190
236
  constructor(e) {
191
237
  super(e);
192
238
  }
193
239
  static fromPlain(e) {
194
- return new M(e);
240
+ return new w(e);
195
241
  }
196
242
  }
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 = {
243
+ var y = /* @__PURE__ */ ((a) => (a.ETHERNET = "Ethernet", a.MODBUS_TCP_SERVER = "ModbusTCPServer", a.MODBUS_TCP_CLIENT = "ModbusTCPClient", a.MODBUS_TCP_SLAVE_DEVICE = "ModbusTCPSlaveDevice", a.MODBUS_SERIAL_PORT = "ModbusSerialPort", a.MODBUS_MASTER = "ModbusMaster", a.MODBUS_SLAVE = "ModbusSlave", a.MODBUS_SERIAL = "ModbusSerial", a.OPCUA_SERVER = "OPCUAServer", a.ETHER_CAT_MASTER = "EtherCatMaster", a.ETHER_CAT_SLAVE = "EtherCatSlave", a.ETHER_CAT_MODULE = "EtherCatModule", a))(y || {});
244
+ const I = {
199
245
  Pprogrammable: 4096,
200
246
  // 根节点
201
247
  Protgrammable_Safety: 4098,
@@ -249,57 +295,56 @@ const E = {
249
295
  EtherCatModule: 16384
250
296
  // Ethercat子模块
251
297
  };
252
- class ne {
298
+ class le {
253
299
  map = /* @__PURE__ */ new Map();
254
300
  constructor() {
255
- c.register("Ethernet", h), c.register("ModbusTCPServer", b), c.register("ModbusTCPClient", S), c.register("ModbusTCPSlaveDevice", M);
301
+ d.register("Ethernet", U), d.register("ModbusTCPServer", N), d.register("ModbusTCPClient", O), d.register("ModbusTCPSlaveDevice", w);
256
302
  }
257
303
  init(e) {
258
- this.clear(), e.forEach((t) => {
259
- const a = c.fromPlain(t);
260
- this.map.set(t.id, a);
304
+ this.clear(), e.forEach((n) => {
305
+ const s = d.fromPlain(n);
306
+ this.map.set(n.id, s);
261
307
  });
262
308
  }
263
309
  build(e) {
264
310
  return "";
265
311
  }
266
312
  get(e) {
267
- const t = Array.isArray(e) ? e.map((a) => this.map.get(a)).filter((a) => a !== void 0) : this.map.get(e);
268
- if (Array.isArray(t) && !t.length || !t)
313
+ const n = Array.isArray(e) ? e.map((s) => this.map.get(s)).filter((s) => s !== void 0) : this.map.get(e);
314
+ if (Array.isArray(n) && !n.length || !n)
269
315
  throw new Error(`Protocol ${e} is not found.`);
270
- return t;
316
+ return n;
271
317
  }
272
318
  add(e) {
273
319
  this.map.set(e.id, e);
274
320
  }
275
321
  delete(e) {
276
- Array.isArray(e) ? e.forEach((t) => this.map.delete(t)) : this.map.delete(e);
322
+ Array.isArray(e) ? e.forEach((n) => this.map.delete(n)) : this.map.delete(e);
277
323
  }
278
324
  clear() {
279
325
  this.map.clear();
280
326
  }
281
327
  }
282
- const Z = [x, O, Y, G], oe = {
283
- install(n, e) {
284
- e && n.provide(C, e), Z.forEach((t) => {
285
- n.component(t.name, t);
328
+ const oe = [$, Y, x, W], ue = {
329
+ install(a, e) {
330
+ e && a.provide(T, e), oe.forEach((n) => {
331
+ a.component(n.name, n);
286
332
  });
287
333
  }
288
334
  };
289
335
  export {
290
- te as Button2,
291
- h as EthernetProtocolItem,
292
- O as Input,
336
+ W as Ethernet,
337
+ U as EthernetProtocolItem,
338
+ $ as Input,
293
339
  Y as InputNumber,
294
- G as IpInput,
295
- S as ModbusTCPClientProtocolItem,
296
- b as ModbusTCPServerProtocolItem,
297
- M as ModbusTCPSlaveDeviceProtocolItem,
298
- x as MyButton,
299
- ne as ProtocolCollection,
300
- c as ProtocolItem,
301
- p as ProtocolType,
302
- C as UI_KEY,
303
- oe as default,
304
- E as protocolMap
340
+ x as IpInput,
341
+ O as ModbusTCPClientProtocolItem,
342
+ N as ModbusTCPServerProtocolItem,
343
+ w as ModbusTCPSlaveDeviceProtocolItem,
344
+ le as ProtocolCollection,
345
+ d as ProtocolItem,
346
+ y as ProtocolType,
347
+ T as UI_KEY,
348
+ ue as default,
349
+ I as protocolMap
305
350
  };
@@ -1 +1 @@
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 k=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(k,[["__scopeId","data-v-c654f959"]]),V=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"),M=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","background-color":"inherit"}},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(M,{"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 h extends p{type=d.MODBUS_TCP_SLAVE_DEVICE;moduleType=f[d.MODBUS_TCP_SLAVE_DEVICE];constructor(e){super(e)}static fromPlain(e){return new h(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",h)}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,M,T,P],N={install(o,e){e&&o.provide(E,e),R.forEach(n=>{o.component(n.name,n)})}};l.Button2=V,l.EthernetProtocolItem=C,l.Input=M,l.InputNumber=T,l.IpInput=P,l.ModbusTCPClientProtocolItem=b,l.ModbusTCPServerProtocolItem=g,l.ModbusTCPSlaveDeviceProtocolItem=h,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"}})}));
1
+ (function(i,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(i=typeof globalThis<"u"?globalThis:i||self,e(i["lty-protocol"]={},i.Vue))})(this,(function(i,e){"use strict";const E=Symbol("UI_KEY"),S=e.defineComponent({__name:"Input",props:{modelValue:{}},emits:["update:modelValue"],setup(a,{emit:t}){const o=a,s=t,r=e.inject(E);if(!r||!r.Input)throw new Error("Input not registered");const d=r.Input,p=d.modelProp??"modelValue",l=d.modelEvent??"update:modelValue",c="on"+l.charAt(0).toUpperCase()+l.slice(1),n=e.computed(()=>({[p]:o.modelValue,[c]:y=>s("update:modelValue",y)})),m=d.component;return(y,I)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(m)),e.normalizeProps(e.guardReactiveProps(n.value)),null,16))}}),B={style:{display:"flex","align-items":"center"}},D={key:0,style:{margin:"0 4px","background-color":"inherit"}},V=e.defineComponent({__name:"IpInput",props:{modelValue:{}},emits:["update:modelValue"],setup(a,{emit:t}){const o=a,s=t,r=e.computed({get:()=>{const l=(o.modelValue||"0.0.0.0").split(":"),c=l[0].split(".");return l.length>1?[...c,l[1]]:c},set:p=>{if(p.length>4){const l=p.slice(0,4),c=p[4];s("update:modelValue",`${l.join(".")}:${c}`)}else s("update:modelValue",p.join("."))}}),d=(p,l)=>{const c=[...r.value];if(p<4){let n=parseInt(l,10);isNaN(n)&&(n=0),n<0&&(n=0),n>255&&(n=255),c[p]=n.toString()}else{let n=parseInt(l,10);isNaN(n)&&(n=0),n<0&&(n=0),n>65535&&(n=65535),c[p]=n.toString()}r.value=c};return(p,l)=>(e.openBlock(),e.createElementBlock("div",B,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(c,n)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n},[n>0?(e.openBlock(),e.createElementBlock("span",D,e.toDisplayString(n===4?":":"."),1)):e.createCommentVNode("",!0),e.createVNode(S,{"model-value":c,"onUpdate:modelValue":m=>d(n,m),style:e.normalizeStyle({borderLeft:n>0?"none":"",borderRight:n<r.value.length-1?"none":"",borderRadius:n===0?"4px 0 0 4px":n===r.value.length-1?"0 4px 4px 0":"0"})},null,8,["model-value","onUpdate:modelValue","style"])],64))),128))]))}}),P=e.defineComponent({__name:"InputNumber",props:{modelValue:{}},emits:["update:modelValue"],setup(a,{emit:t}){const o=a,s=t,r=e.inject(E);if(console.log("inject result:",r),!r||!r.InputNumber)throw new Error("InputNumber not registered");const d=r.InputNumber,p=d.modelProp??"modelValue",l=d.modelEvent??"update:modelValue",c="on"+l.charAt(0).toUpperCase()+l.slice(1),n=e.computed(()=>({[p]:o.modelValue,[c]:y=>s("update:modelValue",y)})),m=d.component;return(y,I)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(m)),e.normalizeProps(e.guardReactiveProps(n.value)),null,16))}}),A=e.defineComponent({__name:"Tab",props:{modelValue:{},tabs:{}},emits:["update:modelValue"],setup(a,{emit:t}){const o=a,s=t,r=e.inject(E);if(!r||!r.Tab)throw new Error("Tab not registered");if(!r||!r.TabItem)throw new Error("TabItem not registered");const d=r.Tab,p=r.TabItem,l=d.modelProp??"modelValue",c=d.modelEvent??"update:modelValue",n="on"+c.charAt(0).toUpperCase()+c.slice(1),m=e.computed(()=>({[l]:o.modelValue,[n]:k=>s("update:modelValue",k)})),y=d.component,I=p.component;return(k,z)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(y)),e.normalizeProps(e.guardReactiveProps(m.value)),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.tabs,T=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(I)),{key:T.key,label:T.name.i18nKey,name:T.key},{default:e.withCtx(()=>[e.renderSlot(k.$slots,T.key)]),_:2},1032,["label","name"]))),128)),e.renderSlot(k.$slots,"default")]),_:3},16))}}),M=((a,t)=>{const o=a.__vccOpts||a;for(const[s,r]of t)o[s]=r;return o})(e.defineComponent({__name:"Ethernet",props:{data:{}},setup(a){const t=a,o=e.ref(t.data.tab[0]?.key||""),s=e.ref({});(()=>{const l=t.data.config;for(const c in l)l[c].forEach(m=>{s.value[m.key]=m.defaultValue})})();const d=l=>t.data.config[l]||[],p=l=>l==="ipInput"?V:"input";return(l,c)=>(e.openBlock(),e.createElementBlock("div",null,[e.createVNode(A,{modelValue:o.value,"onUpdate:modelValue":c[0]||(c[0]=n=>o.value=n),tabs:a.data.tab},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.data.tab,n=>(e.openBlock(),e.createElementBlock("div",{key:n.key,class:"tab-content"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d(n.key),m=>(e.openBlock(),e.createElementBlock("div",{key:m.key,class:"config-item"},[e.createElementVNode("label",null,e.toDisplayString(m.name.i18nKey),1),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p(m.componentType)),{modelValue:s.value[m.key],"onUpdate:modelValue":y=>s.value[m.key]=y},null,8,["modelValue","onUpdate:modelValue"]))]))),128))]))),128))]),_:1},8,["modelValue","tabs"])]))}}),[["__scopeId","data-v-163637c2"]]);class u{id;deviceId;type;static registry={};constructor(t){this.id=t.id,this.deviceId=t.deviceId}static register(t,o){u.registry[t]=o}static fromPlain(t){const o=u.registry[t.type];if(!o)throw new Error(`Unsupported protocol type: ${t.type}`);return o.fromPlain(t)}}class U{static getDefaultConfig(t){console.log(1231231,t);const o=t.baseInfo,s=t.configuration,r=t.tab;return{baseInfo:o,config:s,tab:r}}}const N={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 u{type=f.ETHERNET;moduleType=g[f.ETHERNET];baseInfo;config;tab;constructor(t){super(t);const{baseInfo:o,config:s,tab:r}=U.getDefaultConfig(N);this.baseInfo=o,this.config=s,this.tab=r}static fromPlain(t){return new C(t)}}class _ extends u{type=f.MODBUS_TCP_SERVER;moduleType=g[f.MODBUS_TCP_SERVER];constructor(t){super(t)}static fromPlain(t){return new _(t)}}class b extends u{type=f.MODBUS_TCP_CLIENT;moduleType=g[f.MODBUS_TCP_CLIENT];constructor(t){super(t)}static fromPlain(t){return new b(t)}}class h extends u{type=f.MODBUS_TCP_SLAVE_DEVICE;moduleType=g[f.MODBUS_TCP_SLAVE_DEVICE];constructor(t){super(t)}static fromPlain(t){return new h(t)}}var f=(a=>(a.ETHERNET="Ethernet",a.MODBUS_TCP_SERVER="ModbusTCPServer",a.MODBUS_TCP_CLIENT="ModbusTCPClient",a.MODBUS_TCP_SLAVE_DEVICE="ModbusTCPSlaveDevice",a.MODBUS_SERIAL_PORT="ModbusSerialPort",a.MODBUS_MASTER="ModbusMaster",a.MODBUS_SLAVE="ModbusSlave",a.MODBUS_SERIAL="ModbusSerial",a.OPCUA_SERVER="OPCUAServer",a.ETHER_CAT_MASTER="EtherCatMaster",a.ETHER_CAT_SLAVE="EtherCatSlave",a.ETHER_CAT_MODULE="EtherCatModule",a))(f||{});const g={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 w{map=new Map;constructor(){u.register("Ethernet",C),u.register("ModbusTCPServer",_),u.register("ModbusTCPClient",b),u.register("ModbusTCPSlaveDevice",h)}init(t){this.clear(),t.forEach(o=>{const s=u.fromPlain(o);this.map.set(o.id,s)})}build(t){return""}get(t){const o=Array.isArray(t)?t.map(s=>this.map.get(s)).filter(s=>s!==void 0):this.map.get(t);if(Array.isArray(o)&&!o.length||!o)throw new Error(`Protocol ${t} is not found.`);return o}add(t){this.map.set(t.id,t)}delete(t){Array.isArray(t)?t.forEach(o=>this.map.delete(o)):this.map.delete(t)}clear(){this.map.clear()}}const O=[S,P,V,M],R={install(a,t){t&&a.provide(E,t),O.forEach(o=>{a.component(o.name,o)})}};i.Ethernet=M,i.EthernetProtocolItem=C,i.Input=S,i.InputNumber=P,i.IpInput=V,i.ModbusTCPClientProtocolItem=b,i.ModbusTCPServerProtocolItem=_,i.ModbusTCPSlaveDeviceProtocolItem=h,i.ProtocolCollection=w,i.ProtocolItem=u,i.ProtocolType=f,i.UI_KEY=E,i.default=R,i.protocolMap=g,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
@@ -0,0 +1,6 @@
1
+ import { EthernetProtocolItem } from '../models/modbus';
2
+ type __VLS_Props = {
3
+ data: EthernetProtocolItem;
4
+ };
5
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
6
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lty-protocol",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "main": "dist/lty-protocol.umd.js",
5
5
  "module": "dist/lty-protocol.mjs",
6
6
  "style": "dist/lty-protocol.css",
@@ -1,21 +0,0 @@
1
- declare function __VLS_template(): {
2
- attrs: Partial<{}>;
3
- slots: {
4
- default?(_: {}): any;
5
- };
6
- refs: {};
7
- rootEl: HTMLButtonElement;
8
- };
9
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
10
- declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
11
- click: () => any;
12
- }, string, import('vue').PublicProps, Readonly<{}> & Readonly<{
13
- onClick?: (() => any) | undefined;
14
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLButtonElement>;
15
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
16
- export default _default;
17
- type __VLS_WithTemplateSlots<T, S> = T & {
18
- new (): {
19
- $slots: S;
20
- };
21
- };
@@ -1,21 +0,0 @@
1
- declare function __VLS_template(): {
2
- attrs: Partial<{}>;
3
- slots: {
4
- default?(_: {}): any;
5
- };
6
- refs: {};
7
- rootEl: HTMLButtonElement;
8
- };
9
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
10
- declare const __VLS_component: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
11
- click: () => any;
12
- }, string, import('vue').PublicProps, Readonly<{}> & Readonly<{
13
- onClick?: (() => any) | undefined;
14
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLButtonElement>;
15
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
16
- export default _default;
17
- type __VLS_WithTemplateSlots<T, S> = T & {
18
- new (): {
19
- $slots: S;
20
- };
21
- };