@bonsae/nrg 0.25.1 → 0.26.0
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/package.json +6 -4
- package/server/index.cjs +1413 -2
- package/server/resources/nrg-client.js +10 -0
- package/test/client/component/config.js +9 -9
- package/test/client/component/index.js +230 -42
- package/test/client/component/nrg.css +1 -0
- package/test/client/component/schemas.js +37 -0
- package/test/client/component/setup.js +1473 -198
- package/test/client/e2e/index.js +33 -35
- package/test/client/unit/index.js +17 -2
- package/test/server/integration/index.js +1222 -11
- package/test/server/unit/index.js +184 -2
- package/types/client.d.ts +1 -1
- package/types/server.d.ts +8 -2
- package/types/shims/components.d.ts +8 -8
- package/types/shims/{client → core/client}/types.d.ts +2 -2
- package/types/shims/core/schema-options.d.ts +24 -0
- package/types/shims/schema-options.d.ts +17 -17
- package/types/test-client-component-schemas.d.ts +73 -0
- package/types/test-client-component.d.ts +153 -7
- package/types/test-client-unit.d.ts +105 -4
- package/types/test-server-integration.d.ts +64 -63
- package/types/test-server-unit.d.ts +2 -1
- package/vite/index.js +33 -35
- /package/types/shims/{client → core/client}/form/components/node-red-config-input.vue.d.ts +0 -0
- /package/types/shims/{client → core/client}/form/components/node-red-editor-input.vue.d.ts +0 -0
- /package/types/shims/{client → core/client}/form/components/node-red-input-label.vue.d.ts +0 -0
- /package/types/shims/{client → core/client}/form/components/node-red-input.vue.d.ts +0 -0
- /package/types/shims/{client → core/client}/form/components/node-red-json-schema-form.vue.d.ts +0 -0
- /package/types/shims/{client → core/client}/form/components/node-red-select-input.vue.d.ts +0 -0
- /package/types/shims/{client → core/client}/form/components/node-red-toggle.vue.d.ts +0 -0
- /package/types/shims/{client → core/client}/form/components/node-red-typed-input.vue.d.ts +0 -0
- /package/types/shims/{constants.d.ts → core/constants.d.ts} +0 -0
- /package/types/shims/{brands.d.ts → core/types.d.ts} +0 -0
|
@@ -1,63 +1,1338 @@
|
|
|
1
|
-
import { config as
|
|
2
|
-
import {
|
|
3
|
-
import { beforeEach as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { config as D } from "vitest-browser-vue";
|
|
2
|
+
import { defineComponent as V, openBlock as l, createElementBlock as c, normalizeClass as N, createCommentVNode as f, renderSlot as k, createTextVNode as W, toDisplayString as E, resolveComponent as g, createBlock as v, createElementVNode as m, shallowRef as q, withDirectives as H, vShow as J, Teleport as K, Fragment as _, renderList as L, createVNode as R } from "vue";
|
|
3
|
+
import { beforeEach as Q } from "vitest";
|
|
4
|
+
const Y = V({
|
|
5
|
+
name: "NodeRedInputLabel",
|
|
6
|
+
props: {
|
|
7
|
+
label: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: ""
|
|
10
|
+
},
|
|
11
|
+
icon: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: ""
|
|
14
|
+
},
|
|
15
|
+
required: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: !1
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
computed: {
|
|
21
|
+
iconClass() {
|
|
22
|
+
return this.icon ? `fa ${this.icon.startsWith("fa-") ? this.icon : `fa-${this.icon}`}` : "";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}), T = (e, t) => {
|
|
26
|
+
const n = e.__vccOpts || e;
|
|
27
|
+
for (const [r, s] of t)
|
|
28
|
+
n[r] = s;
|
|
29
|
+
return n;
|
|
30
|
+
}, Z = { class: "nrg-label" }, G = {
|
|
31
|
+
key: 1,
|
|
32
|
+
class: "nrg-required"
|
|
33
|
+
};
|
|
34
|
+
function X(e, t, n, r, s, d) {
|
|
35
|
+
return l(), c("span", Z, [
|
|
36
|
+
e.icon ? (l(), c(
|
|
37
|
+
"i",
|
|
38
|
+
{
|
|
39
|
+
key: 0,
|
|
40
|
+
class: N(e.iconClass)
|
|
41
|
+
},
|
|
42
|
+
null,
|
|
43
|
+
2
|
|
44
|
+
/* CLASS */
|
|
45
|
+
)) : f("v-if", !0),
|
|
46
|
+
k(e.$slots, "default", {}, () => [
|
|
47
|
+
W(
|
|
48
|
+
E(e.label),
|
|
49
|
+
1
|
|
50
|
+
/* TEXT */
|
|
51
|
+
)
|
|
52
|
+
], !0),
|
|
53
|
+
e.required ? (l(), c("span", G, "*")) : f("v-if", !0)
|
|
54
|
+
]);
|
|
55
|
+
}
|
|
56
|
+
const w = /* @__PURE__ */ T(Y, [["render", X], ["__scopeId", "data-v-864b02f2"]]), j = "*************", x = V({
|
|
57
|
+
components: { NodeRedInputLabel: w },
|
|
58
|
+
props: {
|
|
59
|
+
modelValue: {
|
|
60
|
+
type: [String, Number],
|
|
61
|
+
default: void 0
|
|
62
|
+
},
|
|
63
|
+
value: {
|
|
64
|
+
type: [String, Number],
|
|
65
|
+
default: ""
|
|
66
|
+
},
|
|
67
|
+
type: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: "text"
|
|
70
|
+
},
|
|
71
|
+
placeholder: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: ""
|
|
74
|
+
},
|
|
75
|
+
label: {
|
|
76
|
+
type: String,
|
|
77
|
+
default: ""
|
|
78
|
+
},
|
|
79
|
+
icon: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: ""
|
|
82
|
+
},
|
|
83
|
+
required: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: !1
|
|
86
|
+
},
|
|
87
|
+
error: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: ""
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
emits: ["update:modelValue", "update:value", "input"],
|
|
93
|
+
data() {
|
|
94
|
+
return {
|
|
95
|
+
internalValue: ""
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
computed: {
|
|
99
|
+
effectiveValue() {
|
|
100
|
+
return this.modelValue !== void 0 ? this.modelValue : this.value;
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
beforeMount() {
|
|
104
|
+
this.internalValue = this.effectiveValue, this.onBlur();
|
|
105
|
+
},
|
|
106
|
+
methods: {
|
|
107
|
+
onInput(e) {
|
|
108
|
+
this.internalValue = e.target.value, this.$emit("update:modelValue", this.internalValue), this.$emit("update:value", this.internalValue), this.$emit("input", this.internalValue);
|
|
109
|
+
},
|
|
110
|
+
onFocus() {
|
|
111
|
+
this.type === "password" && this.internalValue === j && (this.internalValue = "");
|
|
112
|
+
},
|
|
113
|
+
onBlur() {
|
|
114
|
+
this.type === "password" && this.effectiveValue === "__PWD__" && (this.internalValue = j);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}), ee = { style: { display: "flex", "flex-direction": "column", width: "100%" } }, te = ["type", "value", "placeholder"], ne = {
|
|
118
|
+
key: 0,
|
|
119
|
+
class: "node-red-vue-input-error-message"
|
|
120
|
+
};
|
|
121
|
+
function re(e, t, n, r, s, d) {
|
|
122
|
+
const a = g("NodeRedInputLabel");
|
|
123
|
+
return l(), c("div", ee, [
|
|
124
|
+
k(e.$slots, "label", {}, () => [
|
|
125
|
+
e.label ? (l(), v(a, {
|
|
126
|
+
key: 0,
|
|
127
|
+
label: e.label,
|
|
128
|
+
icon: e.icon,
|
|
129
|
+
required: e.required
|
|
130
|
+
}, null, 8, ["label", "icon", "required"])) : f("v-if", !0)
|
|
131
|
+
]),
|
|
132
|
+
m("input", {
|
|
133
|
+
ref: "inputField",
|
|
134
|
+
type: e.type,
|
|
135
|
+
value: e.internalValue,
|
|
136
|
+
placeholder: e.placeholder,
|
|
137
|
+
style: { width: "100%" },
|
|
138
|
+
onInput: t[0] || (t[0] = (...h) => e.onInput && e.onInput(...h)),
|
|
139
|
+
onFocus: t[1] || (t[1] = (...h) => e.onFocus && e.onFocus(...h)),
|
|
140
|
+
onBlur: t[2] || (t[2] = (...h) => e.onBlur && e.onBlur(...h))
|
|
141
|
+
}, null, 40, te),
|
|
142
|
+
e.error ? (l(), c(
|
|
143
|
+
"div",
|
|
144
|
+
ne,
|
|
145
|
+
E(e.error),
|
|
146
|
+
1
|
|
147
|
+
/* TEXT */
|
|
148
|
+
)) : f("v-if", !0)
|
|
149
|
+
]);
|
|
150
|
+
}
|
|
151
|
+
const B = /* @__PURE__ */ T(x, [["render", re]]), oe = [
|
|
152
|
+
"msg",
|
|
153
|
+
"flow",
|
|
154
|
+
"global",
|
|
155
|
+
"str",
|
|
156
|
+
"num",
|
|
157
|
+
"bool",
|
|
158
|
+
"json",
|
|
159
|
+
"bin",
|
|
160
|
+
"re",
|
|
161
|
+
"jsonata",
|
|
162
|
+
"date",
|
|
163
|
+
"env",
|
|
164
|
+
"node",
|
|
165
|
+
"cred"
|
|
166
|
+
], ie = ["errorPort", "completePort", "statusPort"], se = V({
|
|
167
|
+
components: { NodeRedInputLabel: w },
|
|
168
|
+
props: {
|
|
169
|
+
modelValue: {
|
|
170
|
+
type: Object,
|
|
171
|
+
default: void 0,
|
|
172
|
+
validator: function(e) {
|
|
173
|
+
if (e === void 0) return !0;
|
|
174
|
+
if (typeof e != "object" || e === null)
|
|
175
|
+
return console.warn(
|
|
176
|
+
"[WARN] Invalid modelValue for TypedInput. It must be an object."
|
|
177
|
+
), !1;
|
|
178
|
+
const t = typeof e.value == "string" && typeof e.type == "string";
|
|
179
|
+
return t || console.warn(
|
|
180
|
+
"[WARN] Invalid modelValue for TypedInput. It must be an object with 'value' and 'type' properties being strings.",
|
|
181
|
+
e
|
|
182
|
+
), t;
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
value: {
|
|
186
|
+
type: Object,
|
|
187
|
+
default: void 0,
|
|
188
|
+
validator: function(e) {
|
|
189
|
+
if (e === void 0) return !0;
|
|
190
|
+
if (typeof e != "object" || e === null)
|
|
191
|
+
return console.warn(
|
|
192
|
+
"[WARN] Invalid value for TypedInput. It must be an object."
|
|
193
|
+
), !1;
|
|
194
|
+
const t = typeof e.value == "string" && typeof e.type == "string";
|
|
195
|
+
return t || console.warn(
|
|
196
|
+
"[WARN] Invalid value for TypedInput. It must be an object with 'value' and 'type' properties being strings.",
|
|
197
|
+
e
|
|
198
|
+
), t;
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
types: {
|
|
202
|
+
type: Array,
|
|
203
|
+
default: () => oe
|
|
204
|
+
},
|
|
205
|
+
label: {
|
|
206
|
+
type: String,
|
|
207
|
+
default: ""
|
|
208
|
+
},
|
|
209
|
+
icon: {
|
|
210
|
+
type: String,
|
|
211
|
+
default: ""
|
|
212
|
+
},
|
|
213
|
+
required: {
|
|
214
|
+
type: Boolean,
|
|
215
|
+
default: !1
|
|
216
|
+
},
|
|
217
|
+
error: {
|
|
218
|
+
type: String,
|
|
219
|
+
default: ""
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
emits: ["update:modelValue", "update:value"],
|
|
223
|
+
setup() {
|
|
224
|
+
return {
|
|
225
|
+
inputWidget: q(null),
|
|
226
|
+
mutationObserver: q(null)
|
|
227
|
+
};
|
|
228
|
+
},
|
|
229
|
+
computed: {
|
|
230
|
+
effectiveValue() {
|
|
231
|
+
return this.modelValue !== void 0 ? this.modelValue : this.value;
|
|
232
|
+
},
|
|
233
|
+
isProvidedValueTypeValid() {
|
|
234
|
+
const e = this.effectiveValue.type;
|
|
235
|
+
return this.types.includes(e);
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
watch: {
|
|
239
|
+
isProvidedValueTypeValid: {
|
|
240
|
+
handler(e) {
|
|
241
|
+
e || console.warn(
|
|
242
|
+
`Validation failed: type (${this.effectiveValue.type}) must be one of the provided types (${this.types}).`
|
|
243
|
+
);
|
|
244
|
+
},
|
|
245
|
+
immediate: !0
|
|
246
|
+
},
|
|
247
|
+
error(e) {
|
|
248
|
+
this.$nextTick(() => {
|
|
249
|
+
const t = this.$el.querySelector(
|
|
250
|
+
".red-ui-typedInput-container"
|
|
251
|
+
);
|
|
252
|
+
t && (e ? t.classList.add("input-error") : t.classList.remove("input-error"));
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
mounted() {
|
|
257
|
+
const e = this.$refs.typedInput;
|
|
258
|
+
this.inputWidget = $(e), this.inputWidget.typedInput({
|
|
259
|
+
default: this.effectiveValue.type || this.types[0],
|
|
260
|
+
types: this.types
|
|
261
|
+
}), this.inputWidget.typedInput("value", this.effectiveValue.value || ""), this.inputWidget.typedInput(
|
|
262
|
+
"type",
|
|
263
|
+
this.effectiveValue.type || this.types[0]
|
|
264
|
+
), this.$nextTick(() => {
|
|
265
|
+
const t = new MutationObserver((n) => {
|
|
266
|
+
for (const r of n)
|
|
267
|
+
r.attributeName === "value" && this.onChange();
|
|
268
|
+
});
|
|
269
|
+
t.observe(e, {
|
|
270
|
+
attributes: !0,
|
|
271
|
+
attributeFilter: ["value"]
|
|
272
|
+
}), this.mutationObserver = t;
|
|
273
|
+
}), this.inputWidget.on("change", () => {
|
|
274
|
+
this.onChange();
|
|
275
|
+
});
|
|
276
|
+
},
|
|
277
|
+
beforeUnmount() {
|
|
278
|
+
this.mutationObserver && (this.mutationObserver.disconnect(), this.mutationObserver = null);
|
|
279
|
+
},
|
|
280
|
+
methods: {
|
|
281
|
+
onChange() {
|
|
282
|
+
const e = this.inputWidget.typedInput("value"), t = this.inputWidget.typedInput("type");
|
|
283
|
+
if (this.effectiveValue.value !== e || this.effectiveValue.type !== t) {
|
|
284
|
+
const n = { value: e, type: t };
|
|
285
|
+
this.$emit("update:modelValue", n), this.$emit("update:value", n);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}), ae = { style: { display: "flex", "flex-direction": "column", width: "100%" } }, le = {
|
|
290
|
+
ref: "typedInput",
|
|
291
|
+
type: "text",
|
|
292
|
+
class: "node-red-typed-input",
|
|
293
|
+
style: { flex: "1", width: "100%" }
|
|
294
|
+
}, ue = {
|
|
295
|
+
key: 0,
|
|
296
|
+
class: "node-red-vue-input-error-message"
|
|
297
|
+
};
|
|
298
|
+
function de(e, t, n, r, s, d) {
|
|
299
|
+
const a = g("NodeRedInputLabel");
|
|
300
|
+
return l(), c("div", ae, [
|
|
301
|
+
k(e.$slots, "label", {}, () => [
|
|
302
|
+
e.label ? (l(), v(a, {
|
|
303
|
+
key: 0,
|
|
304
|
+
label: e.label,
|
|
305
|
+
icon: e.icon,
|
|
306
|
+
required: e.required
|
|
307
|
+
}, null, 8, ["label", "icon", "required"])) : f("v-if", !0)
|
|
308
|
+
]),
|
|
309
|
+
m(
|
|
310
|
+
"input",
|
|
311
|
+
le,
|
|
312
|
+
null,
|
|
313
|
+
512
|
|
314
|
+
/* NEED_PATCH */
|
|
315
|
+
),
|
|
316
|
+
e.error ? (l(), c(
|
|
317
|
+
"div",
|
|
318
|
+
ue,
|
|
319
|
+
E(e.error),
|
|
320
|
+
1
|
|
321
|
+
/* TEXT */
|
|
322
|
+
)) : f("v-if", !0)
|
|
323
|
+
]);
|
|
324
|
+
}
|
|
325
|
+
const U = /* @__PURE__ */ T(se, [["render", de]]), pe = V({
|
|
326
|
+
components: { NodeRedInputLabel: w },
|
|
327
|
+
props: {
|
|
328
|
+
modelValue: {
|
|
329
|
+
type: String,
|
|
330
|
+
default: void 0
|
|
331
|
+
},
|
|
332
|
+
value: {
|
|
333
|
+
type: String,
|
|
334
|
+
default: ""
|
|
335
|
+
},
|
|
336
|
+
type: {
|
|
337
|
+
type: String,
|
|
338
|
+
required: !0
|
|
339
|
+
},
|
|
340
|
+
node: {
|
|
341
|
+
type: Object,
|
|
342
|
+
required: !0
|
|
343
|
+
},
|
|
344
|
+
propName: {
|
|
345
|
+
type: String,
|
|
346
|
+
required: !0
|
|
347
|
+
},
|
|
348
|
+
label: {
|
|
349
|
+
type: String,
|
|
350
|
+
default: ""
|
|
351
|
+
},
|
|
352
|
+
icon: {
|
|
353
|
+
type: String,
|
|
354
|
+
default: ""
|
|
355
|
+
},
|
|
356
|
+
required: {
|
|
357
|
+
type: Boolean,
|
|
358
|
+
default: !1
|
|
359
|
+
},
|
|
360
|
+
error: {
|
|
361
|
+
type: String,
|
|
362
|
+
default: ""
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
emits: ["update:modelValue", "update:value"],
|
|
366
|
+
setup() {
|
|
367
|
+
return {
|
|
368
|
+
jqInput: q(null)
|
|
369
|
+
};
|
|
370
|
+
},
|
|
371
|
+
computed: {
|
|
372
|
+
inputId() {
|
|
373
|
+
return "node-input-" + this.propName;
|
|
374
|
+
},
|
|
375
|
+
effectiveValue() {
|
|
376
|
+
return this.modelValue !== void 0 ? this.modelValue : this.value;
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
mounted() {
|
|
380
|
+
RED.editor.prepareConfigNodeSelect(
|
|
381
|
+
this.node,
|
|
382
|
+
this.propName,
|
|
383
|
+
this.type,
|
|
384
|
+
"node-input"
|
|
385
|
+
);
|
|
386
|
+
const e = $("#" + this.inputId);
|
|
387
|
+
this.jqInput = e, e.on("change", () => {
|
|
388
|
+
const t = e.val(), n = t === "_ADD_" ? "" : t;
|
|
389
|
+
this.$emit("update:modelValue", n), this.$emit("update:value", n);
|
|
390
|
+
}), e.val(this.effectiveValue || "_ADD_");
|
|
391
|
+
},
|
|
392
|
+
beforeUnmount() {
|
|
393
|
+
this.jqInput && (this.jqInput.off("change"), this.jqInput = null);
|
|
394
|
+
}
|
|
395
|
+
}), ce = { style: { display: "flex", "flex-direction": "column", width: "100%" } }, ye = ["id"], fe = {
|
|
396
|
+
key: 0,
|
|
397
|
+
class: "node-red-vue-input-error-message"
|
|
398
|
+
};
|
|
399
|
+
function me(e, t, n, r, s, d) {
|
|
400
|
+
const a = g("NodeRedInputLabel");
|
|
401
|
+
return l(), c("div", ce, [
|
|
402
|
+
k(e.$slots, "label", {}, () => [
|
|
403
|
+
e.label ? (l(), v(a, {
|
|
404
|
+
key: 0,
|
|
405
|
+
label: e.label,
|
|
406
|
+
icon: e.icon,
|
|
407
|
+
required: e.required
|
|
408
|
+
}, null, 8, ["label", "icon", "required"])) : f("v-if", !0)
|
|
409
|
+
]),
|
|
410
|
+
m("input", {
|
|
411
|
+
id: e.inputId,
|
|
412
|
+
type: "text",
|
|
413
|
+
style: { width: "100%" }
|
|
414
|
+
}, null, 8, ye),
|
|
415
|
+
e.error ? (l(), c(
|
|
416
|
+
"div",
|
|
417
|
+
fe,
|
|
418
|
+
E(e.error),
|
|
419
|
+
1
|
|
420
|
+
/* TEXT */
|
|
421
|
+
)) : f("v-if", !0)
|
|
422
|
+
]);
|
|
423
|
+
}
|
|
424
|
+
const M = /* @__PURE__ */ T(pe, [["render", me]]), he = V({
|
|
425
|
+
components: { NodeRedInputLabel: w },
|
|
426
|
+
props: {
|
|
427
|
+
modelValue: {
|
|
428
|
+
type: [String, Array],
|
|
429
|
+
default: void 0
|
|
430
|
+
},
|
|
431
|
+
value: {
|
|
432
|
+
type: [String, Array],
|
|
433
|
+
default: () => ""
|
|
434
|
+
},
|
|
435
|
+
options: {
|
|
436
|
+
type: Array,
|
|
437
|
+
required: !0,
|
|
438
|
+
validator: function(e) {
|
|
439
|
+
if (!Array.isArray(e))
|
|
440
|
+
return console.warn(
|
|
441
|
+
"[WARN] Invalid value for 'options' property. It must be an array."
|
|
442
|
+
), !1;
|
|
443
|
+
const t = e.every(
|
|
444
|
+
(n) => typeof n == "object" && n !== null && typeof n.value == "string" && typeof n.label == "string" && Object.prototype.hasOwnProperty.call(n, "value") && Object.prototype.hasOwnProperty.call(n, "label")
|
|
445
|
+
);
|
|
446
|
+
return t || console.warn(
|
|
447
|
+
"[WARN] Invalid value for 'options' property. Each item must be an object with 'value' and 'label' properties being strings.",
|
|
448
|
+
e
|
|
449
|
+
), t;
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
multiple: {
|
|
453
|
+
type: Boolean,
|
|
454
|
+
default: !1
|
|
455
|
+
},
|
|
456
|
+
label: {
|
|
457
|
+
type: String,
|
|
458
|
+
default: ""
|
|
459
|
+
},
|
|
460
|
+
icon: {
|
|
461
|
+
type: String,
|
|
462
|
+
default: ""
|
|
463
|
+
},
|
|
464
|
+
required: {
|
|
465
|
+
type: Boolean,
|
|
466
|
+
default: !1
|
|
467
|
+
},
|
|
468
|
+
error: {
|
|
469
|
+
type: String,
|
|
470
|
+
default: ""
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
emits: ["update:modelValue", "update:value"],
|
|
474
|
+
setup() {
|
|
475
|
+
return {
|
|
476
|
+
selectWidget: q(null)
|
|
477
|
+
};
|
|
478
|
+
},
|
|
479
|
+
computed: {
|
|
480
|
+
effectiveValue() {
|
|
481
|
+
return this.modelValue !== void 0 ? this.modelValue : this.value;
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
mounted() {
|
|
485
|
+
const e = this.$refs.selectInput, t = $(e);
|
|
486
|
+
this.selectWidget = t, t.typedInput({
|
|
487
|
+
types: [
|
|
488
|
+
{
|
|
489
|
+
multiple: this.multiple,
|
|
490
|
+
options: this.options
|
|
491
|
+
}
|
|
492
|
+
]
|
|
493
|
+
}), t.typedInput(
|
|
494
|
+
"value",
|
|
495
|
+
Array.isArray(this.effectiveValue) ? this.effectiveValue.join(",") : this.effectiveValue
|
|
496
|
+
), t.on("change", () => {
|
|
497
|
+
var r;
|
|
498
|
+
const n = this.multiple ? ((r = t.typedInput("value")) == null ? void 0 : r.split(",").filter(Boolean)) ?? [] : t.typedInput("value");
|
|
499
|
+
this.$emit("update:modelValue", n), this.$emit("update:value", n);
|
|
500
|
+
});
|
|
501
|
+
},
|
|
502
|
+
beforeUnmount() {
|
|
503
|
+
this.selectWidget && (this.selectWidget.off("change"), this.selectWidget = null);
|
|
504
|
+
}
|
|
505
|
+
}), ge = { style: { display: "flex", "flex-direction": "column", width: "100%" } }, ve = {
|
|
506
|
+
ref: "selectInput",
|
|
507
|
+
type: "text",
|
|
508
|
+
class: "node-input-select",
|
|
509
|
+
style: { width: "100%" }
|
|
510
|
+
}, be = {
|
|
511
|
+
key: 0,
|
|
512
|
+
class: "node-red-vue-input-error-message"
|
|
513
|
+
};
|
|
514
|
+
function $e(e, t, n, r, s, d) {
|
|
515
|
+
const a = g("NodeRedInputLabel");
|
|
516
|
+
return l(), c("div", ge, [
|
|
517
|
+
k(e.$slots, "label", {}, () => [
|
|
518
|
+
e.label ? (l(), v(a, {
|
|
519
|
+
key: 0,
|
|
520
|
+
label: e.label,
|
|
521
|
+
icon: e.icon,
|
|
522
|
+
required: e.required
|
|
523
|
+
}, null, 8, ["label", "icon", "required"])) : f("v-if", !0)
|
|
524
|
+
]),
|
|
525
|
+
m(
|
|
526
|
+
"input",
|
|
527
|
+
ve,
|
|
528
|
+
null,
|
|
529
|
+
512
|
|
530
|
+
/* NEED_PATCH */
|
|
531
|
+
),
|
|
532
|
+
e.error ? (l(), c(
|
|
533
|
+
"div",
|
|
534
|
+
be,
|
|
535
|
+
E(e.error),
|
|
536
|
+
1
|
|
537
|
+
/* TEXT */
|
|
538
|
+
)) : f("v-if", !0)
|
|
539
|
+
]);
|
|
540
|
+
}
|
|
541
|
+
const F = /* @__PURE__ */ T(he, [["render", $e]]), Ie = V({
|
|
542
|
+
components: { NodeRedInputLabel: w },
|
|
543
|
+
props: {
|
|
544
|
+
modelValue: {
|
|
545
|
+
type: String,
|
|
546
|
+
default: void 0
|
|
547
|
+
},
|
|
548
|
+
value: {
|
|
549
|
+
type: String,
|
|
550
|
+
default: ""
|
|
551
|
+
},
|
|
552
|
+
language: {
|
|
553
|
+
type: String,
|
|
554
|
+
default: "json",
|
|
555
|
+
validator: function(e) {
|
|
556
|
+
const t = [
|
|
557
|
+
"abap",
|
|
558
|
+
"apex",
|
|
559
|
+
"azcli",
|
|
560
|
+
"bat",
|
|
561
|
+
"bicep",
|
|
562
|
+
"cameligo",
|
|
563
|
+
"clojure",
|
|
564
|
+
"coffee",
|
|
565
|
+
"cpp",
|
|
566
|
+
"csharp",
|
|
567
|
+
"csp",
|
|
568
|
+
"css",
|
|
569
|
+
"cypher",
|
|
570
|
+
"dart",
|
|
571
|
+
"dockerfile",
|
|
572
|
+
"ecl",
|
|
573
|
+
"elixir",
|
|
574
|
+
"flow9",
|
|
575
|
+
"freemarker2",
|
|
576
|
+
"fsharp",
|
|
577
|
+
"go",
|
|
578
|
+
"graphql",
|
|
579
|
+
"handlebars",
|
|
580
|
+
"hcl",
|
|
581
|
+
"html",
|
|
582
|
+
"ini",
|
|
583
|
+
"java",
|
|
584
|
+
"javascript",
|
|
585
|
+
"json",
|
|
586
|
+
"julia",
|
|
587
|
+
"kotlin",
|
|
588
|
+
"less",
|
|
589
|
+
"lexon",
|
|
590
|
+
"liquid",
|
|
591
|
+
"lua",
|
|
592
|
+
"m3",
|
|
593
|
+
"markdown",
|
|
594
|
+
"mdx",
|
|
595
|
+
"mips",
|
|
596
|
+
"msdax",
|
|
597
|
+
"mysql",
|
|
598
|
+
"objective-c",
|
|
599
|
+
"pascal",
|
|
600
|
+
"pascaligo",
|
|
601
|
+
"perl",
|
|
602
|
+
"pgsql",
|
|
603
|
+
"php",
|
|
604
|
+
"pla",
|
|
605
|
+
"postiats",
|
|
606
|
+
"powerquery",
|
|
607
|
+
"powershell",
|
|
608
|
+
"protobuf",
|
|
609
|
+
"pub",
|
|
610
|
+
"python",
|
|
611
|
+
"qsharp",
|
|
612
|
+
"r",
|
|
613
|
+
"razor",
|
|
614
|
+
"redis",
|
|
615
|
+
"redshift",
|
|
616
|
+
"restructuredtext",
|
|
617
|
+
"ruby",
|
|
618
|
+
"rust",
|
|
619
|
+
"sb",
|
|
620
|
+
"scala",
|
|
621
|
+
"scheme",
|
|
622
|
+
"scss",
|
|
623
|
+
"shell",
|
|
624
|
+
"solidity",
|
|
625
|
+
"sophia",
|
|
626
|
+
"sparql",
|
|
627
|
+
"sql",
|
|
628
|
+
"st",
|
|
629
|
+
"swift",
|
|
630
|
+
"systemverilog",
|
|
631
|
+
"tcl",
|
|
632
|
+
"twig",
|
|
633
|
+
"typescript",
|
|
634
|
+
"typespec",
|
|
635
|
+
"vb",
|
|
636
|
+
"wgsl",
|
|
637
|
+
"xml",
|
|
638
|
+
"yaml"
|
|
639
|
+
], n = t.includes(e);
|
|
640
|
+
return n || console.warn(
|
|
641
|
+
`[WARN]: Invalid value for 'type' property: "${e}". Expected one of: ${t.join(", ")}`
|
|
642
|
+
), n;
|
|
643
|
+
}
|
|
644
|
+
},
|
|
645
|
+
label: {
|
|
646
|
+
type: String,
|
|
647
|
+
default: ""
|
|
648
|
+
},
|
|
649
|
+
icon: {
|
|
650
|
+
type: String,
|
|
651
|
+
default: ""
|
|
652
|
+
},
|
|
653
|
+
required: {
|
|
654
|
+
type: Boolean,
|
|
655
|
+
default: !1
|
|
656
|
+
},
|
|
657
|
+
error: {
|
|
658
|
+
type: String,
|
|
659
|
+
default: ""
|
|
660
|
+
}
|
|
661
|
+
},
|
|
662
|
+
emits: [
|
|
663
|
+
"update:modelValue",
|
|
664
|
+
"update:value",
|
|
665
|
+
"editor-ready",
|
|
666
|
+
"tray-open",
|
|
667
|
+
"tray-close"
|
|
668
|
+
],
|
|
669
|
+
setup() {
|
|
670
|
+
return {
|
|
671
|
+
// NOTE: must not be named "editor" — the template's ref="editor" would
|
|
672
|
+
// overwrite this with the DOM element on every re-render.
|
|
673
|
+
editorInstance: q(null),
|
|
674
|
+
expandedEditorTray: q(null)
|
|
675
|
+
};
|
|
676
|
+
},
|
|
677
|
+
data() {
|
|
678
|
+
const e = Math.random().toString(36).substring(2, 9);
|
|
679
|
+
return {
|
|
680
|
+
editorId: "node-red-editor-" + e,
|
|
681
|
+
stateId: e,
|
|
682
|
+
trayElement: null
|
|
683
|
+
};
|
|
684
|
+
},
|
|
685
|
+
computed: {
|
|
686
|
+
effectiveValue() {
|
|
687
|
+
return this.modelValue !== void 0 ? this.modelValue : this.value;
|
|
688
|
+
}
|
|
689
|
+
},
|
|
690
|
+
mounted() {
|
|
691
|
+
const e = $(this.$refs["expand-button"]);
|
|
692
|
+
RED.popover.tooltip(e, RED._("node-red:common.label.expand")), this.mountEditor(), this.createExpandeEditorTray();
|
|
693
|
+
},
|
|
694
|
+
beforeUnmount() {
|
|
695
|
+
if (this.editorInstance) {
|
|
696
|
+
try {
|
|
697
|
+
this.editorInstance.destroy();
|
|
698
|
+
} catch (e) {
|
|
699
|
+
console.error(`Error destroying editor for ID ${this.editorId}:`, e);
|
|
700
|
+
}
|
|
701
|
+
this.editorInstance = null;
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
methods: {
|
|
705
|
+
mountEditor() {
|
|
706
|
+
this.$nextTick(() => {
|
|
707
|
+
const e = this.$refs.container, t = this.$refs.editor;
|
|
708
|
+
if (e && t)
|
|
709
|
+
try {
|
|
710
|
+
const n = e.style.height, r = e.style.width;
|
|
711
|
+
n ? t.style.height = n : t.style.height = "200px", r ? t.style.width = r : t.style.width = "100%", this.createEditorInstance();
|
|
712
|
+
} catch (n) {
|
|
713
|
+
console.error(
|
|
714
|
+
"[NodeRedEditorInput] Error setting initial editor style:",
|
|
715
|
+
n
|
|
716
|
+
), this.createEditorInstance();
|
|
717
|
+
}
|
|
718
|
+
else
|
|
719
|
+
console.error(
|
|
720
|
+
"[NodeRedEditorInput] Container or Editor div refs not found on mount."
|
|
721
|
+
);
|
|
722
|
+
});
|
|
723
|
+
},
|
|
724
|
+
createEditorInstance() {
|
|
725
|
+
this.editorInstance = RED.editor.createEditor({
|
|
726
|
+
id: this.editorId,
|
|
727
|
+
mode: this.language,
|
|
728
|
+
value: this.effectiveValue
|
|
729
|
+
}), this.editorInstance.getSession().on("change", () => {
|
|
730
|
+
const e = this.editorInstance.getValue();
|
|
731
|
+
e !== this.effectiveValue && (this.$emit("update:modelValue", e), this.$emit("update:value", e));
|
|
732
|
+
}), this.$emit("editor-ready", this.editorInstance);
|
|
733
|
+
},
|
|
734
|
+
createExpandeEditorTray() {
|
|
735
|
+
let e;
|
|
736
|
+
const t = () => {
|
|
737
|
+
setTimeout(() => {
|
|
738
|
+
var r;
|
|
739
|
+
(r = this.editorInstance) == null || r.focus();
|
|
740
|
+
}, 250), RED.tray.close();
|
|
741
|
+
}, n = () => {
|
|
742
|
+
var r;
|
|
743
|
+
e.saveView(), (r = this.editorInstance) == null || r.setValue(e.getValue(), -1), setTimeout(() => {
|
|
744
|
+
var s, d;
|
|
745
|
+
(s = this.editorInstance) == null || s.restoreView(), (d = this.editorInstance) == null || d.focus();
|
|
746
|
+
}, 250), RED.tray.close();
|
|
747
|
+
};
|
|
748
|
+
this.expandedEditorTray = {
|
|
749
|
+
title: "Editor",
|
|
750
|
+
focusElement: !0,
|
|
751
|
+
width: "Infinity",
|
|
752
|
+
buttons: [
|
|
753
|
+
{
|
|
754
|
+
id: "node-dialog-cancel",
|
|
755
|
+
text: RED._("common.label.cancel"),
|
|
756
|
+
click: t
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
id: "node-dialog-ok",
|
|
760
|
+
text: RED._("common.label.done"),
|
|
761
|
+
class: "primary",
|
|
762
|
+
click: n
|
|
763
|
+
}
|
|
764
|
+
],
|
|
765
|
+
open: (r) => {
|
|
766
|
+
const s = $(
|
|
767
|
+
'<form id="dialog-form" class="form-horizontal" autocomplete="off"></form>'
|
|
768
|
+
).appendTo(r.find(".red-ui-tray-body"));
|
|
769
|
+
s.html(
|
|
770
|
+
'<div id="expanded-editor-input" style="height: 100%"></div>'
|
|
771
|
+
), e = RED.editor.createEditor({
|
|
772
|
+
id: "expanded-editor-input",
|
|
773
|
+
stateId: this.stateId,
|
|
774
|
+
mode: this.language,
|
|
775
|
+
focus: !0,
|
|
776
|
+
value: this.effectiveValue
|
|
777
|
+
}), s.i18n();
|
|
778
|
+
const d = r.find(".red-ui-tray-body")[0], a = document.createElement("div");
|
|
779
|
+
a.className = "red-ui-tray-footer", d.insertAdjacentElement("afterend", a), this.trayElement = a, this.$emit("tray-open", this.trayElement);
|
|
780
|
+
},
|
|
781
|
+
close: () => {
|
|
782
|
+
this.$emit("tray-close"), this.trayElement && (this.trayElement.remove(), this.trayElement = null), e.destroy();
|
|
783
|
+
}
|
|
784
|
+
};
|
|
785
|
+
},
|
|
786
|
+
onClickExpand() {
|
|
787
|
+
RED.tray.show(this.expandedEditorTray);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}), Ve = {
|
|
791
|
+
ref: "container",
|
|
792
|
+
class: "container"
|
|
793
|
+
}, Ee = { class: "editor-wrapper" }, Te = ["id"];
|
|
794
|
+
function ke(e, t, n, r, s, d) {
|
|
795
|
+
const a = g("NodeRedInputLabel");
|
|
796
|
+
return l(), c(
|
|
797
|
+
"div",
|
|
798
|
+
Ve,
|
|
799
|
+
[
|
|
800
|
+
k(e.$slots, "label", {}, () => [
|
|
801
|
+
e.label ? (l(), v(a, {
|
|
802
|
+
key: 0,
|
|
803
|
+
label: e.label,
|
|
804
|
+
icon: e.icon,
|
|
805
|
+
required: e.required
|
|
806
|
+
}, null, 8, ["label", "icon", "required"])) : f("v-if", !0)
|
|
807
|
+
], !0),
|
|
808
|
+
m("div", Ee, [
|
|
809
|
+
m(
|
|
810
|
+
"button",
|
|
811
|
+
{
|
|
812
|
+
ref: "expand-button",
|
|
813
|
+
class: "red-ui-button red-ui-button-small expand-button",
|
|
814
|
+
onClick: t[0] || (t[0] = (...h) => e.onClickExpand && e.onClickExpand(...h))
|
|
815
|
+
},
|
|
816
|
+
[...t[1] || (t[1] = [
|
|
817
|
+
m(
|
|
818
|
+
"i",
|
|
819
|
+
{ class: "fa fa-expand" },
|
|
820
|
+
null,
|
|
821
|
+
-1
|
|
822
|
+
/* CACHED */
|
|
823
|
+
)
|
|
824
|
+
])],
|
|
825
|
+
512
|
|
826
|
+
/* NEED_PATCH */
|
|
827
|
+
),
|
|
828
|
+
m("div", {
|
|
829
|
+
id: e.editorId,
|
|
830
|
+
ref: "editor"
|
|
831
|
+
}, null, 8, Te)
|
|
832
|
+
]),
|
|
833
|
+
H(m(
|
|
834
|
+
"div",
|
|
835
|
+
{ class: "node-red-vue-input-error-message" },
|
|
836
|
+
E(e.error),
|
|
837
|
+
513
|
|
838
|
+
/* TEXT, NEED_PATCH */
|
|
839
|
+
), [
|
|
840
|
+
[J, e.error]
|
|
841
|
+
]),
|
|
842
|
+
e.trayElement ? (l(), v(K, {
|
|
843
|
+
key: 0,
|
|
844
|
+
to: e.trayElement
|
|
845
|
+
}, [
|
|
846
|
+
k(e.$slots, "tray-footer", {}, void 0, !0)
|
|
847
|
+
], 8, ["to"])) : f("v-if", !0)
|
|
848
|
+
],
|
|
849
|
+
512
|
|
850
|
+
/* NEED_PATCH */
|
|
851
|
+
);
|
|
852
|
+
}
|
|
853
|
+
const P = /* @__PURE__ */ T(Ie, [["render", ke], ["__scopeId", "data-v-ea93e881"]]), we = V({
|
|
854
|
+
name: "NodeRedToggle",
|
|
855
|
+
props: {
|
|
856
|
+
modelValue: {
|
|
857
|
+
type: Boolean,
|
|
858
|
+
default: !1
|
|
859
|
+
},
|
|
860
|
+
label: {
|
|
861
|
+
type: String,
|
|
862
|
+
default: ""
|
|
863
|
+
},
|
|
864
|
+
icon: {
|
|
865
|
+
type: String,
|
|
866
|
+
default: ""
|
|
867
|
+
}
|
|
868
|
+
},
|
|
869
|
+
emits: ["update:modelValue"],
|
|
870
|
+
computed: {
|
|
871
|
+
iconClass() {
|
|
872
|
+
return this.icon ? `fa ${this.icon.startsWith("fa-") ? this.icon : `fa-${this.icon}`}` : "";
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
}), Se = { class: "nrg-toggle-wrapper" }, qe = ["checked"], Re = {
|
|
876
|
+
key: 0,
|
|
877
|
+
class: "nrg-toggle__label"
|
|
878
|
+
};
|
|
879
|
+
function Ne(e, t, n, r, s, d) {
|
|
880
|
+
return l(), c("div", Se, [
|
|
881
|
+
m(
|
|
882
|
+
"label",
|
|
883
|
+
{
|
|
884
|
+
class: N(["nrg-toggle", { "nrg-toggle--checked": e.modelValue }])
|
|
885
|
+
},
|
|
886
|
+
[
|
|
887
|
+
m("input", {
|
|
888
|
+
type: "checkbox",
|
|
889
|
+
checked: e.modelValue,
|
|
890
|
+
class: "nrg-toggle__input",
|
|
891
|
+
onChange: t[0] || (t[0] = (a) => e.$emit(
|
|
892
|
+
"update:modelValue",
|
|
893
|
+
a.target.checked
|
|
894
|
+
))
|
|
895
|
+
}, null, 40, qe),
|
|
896
|
+
e.icon || e.label ? (l(), c("span", Re, [
|
|
897
|
+
e.icon ? (l(), c(
|
|
898
|
+
"i",
|
|
899
|
+
{
|
|
900
|
+
key: 0,
|
|
901
|
+
class: N(e.iconClass)
|
|
902
|
+
},
|
|
903
|
+
null,
|
|
904
|
+
2
|
|
905
|
+
/* CLASS */
|
|
906
|
+
)) : f("v-if", !0),
|
|
907
|
+
W(
|
|
908
|
+
" " + E(e.label),
|
|
909
|
+
1
|
|
910
|
+
/* TEXT */
|
|
911
|
+
)
|
|
912
|
+
])) : f("v-if", !0),
|
|
913
|
+
t[1] || (t[1] = m(
|
|
914
|
+
"span",
|
|
915
|
+
{ class: "nrg-toggle__slider" },
|
|
916
|
+
null,
|
|
917
|
+
-1
|
|
918
|
+
/* CACHED */
|
|
919
|
+
))
|
|
920
|
+
],
|
|
921
|
+
2
|
|
922
|
+
/* CLASS */
|
|
923
|
+
)
|
|
924
|
+
]);
|
|
925
|
+
}
|
|
926
|
+
const z = /* @__PURE__ */ T(we, [["render", Ne], ["__scopeId", "data-v-724dcae4"]]), _e = /* @__PURE__ */ new Set([
|
|
927
|
+
"id",
|
|
928
|
+
"type",
|
|
929
|
+
"x",
|
|
930
|
+
"y",
|
|
931
|
+
"z",
|
|
932
|
+
"g",
|
|
933
|
+
"wires",
|
|
934
|
+
"credentials",
|
|
935
|
+
"_users",
|
|
936
|
+
"validateInput",
|
|
937
|
+
"validateOutputs",
|
|
938
|
+
"outputs",
|
|
939
|
+
"outputContextModes",
|
|
940
|
+
"outputReturnProperties",
|
|
941
|
+
...ie
|
|
942
|
+
]);
|
|
943
|
+
function Le(e) {
|
|
944
|
+
return e.replace(/([A-Z])/g, " $1").replace(/^./, (t) => t.toUpperCase()).trim();
|
|
945
|
+
}
|
|
946
|
+
function je(e) {
|
|
947
|
+
var t, n;
|
|
948
|
+
return e.type === "object" && !!((t = e.properties) != null && t.value) && !!((n = e.properties) != null && n.type);
|
|
949
|
+
}
|
|
950
|
+
function C(e, t, n, r) {
|
|
951
|
+
var b;
|
|
952
|
+
const s = r || t.title || Le(e), d = t["x-nrg-form"] ?? {}, a = d.icon || "";
|
|
953
|
+
if (t["x-nrg-node-type"])
|
|
954
|
+
return {
|
|
955
|
+
key: e,
|
|
956
|
+
label: s,
|
|
957
|
+
icon: a,
|
|
958
|
+
inputType: "config",
|
|
959
|
+
required: n,
|
|
960
|
+
configType: t["x-nrg-node-type"]
|
|
961
|
+
};
|
|
962
|
+
if (je(t))
|
|
963
|
+
return {
|
|
964
|
+
key: e,
|
|
965
|
+
label: s,
|
|
966
|
+
icon: a,
|
|
967
|
+
inputType: "typed",
|
|
968
|
+
required: n,
|
|
969
|
+
// serialized schemas carry plain strings; trust them as typed-input type names
|
|
970
|
+
types: d.typedInputTypes
|
|
971
|
+
};
|
|
972
|
+
if (t.type === "array" && ((b = t.items) != null && b.enum))
|
|
973
|
+
return {
|
|
974
|
+
key: e,
|
|
975
|
+
label: s,
|
|
976
|
+
icon: a,
|
|
977
|
+
inputType: "select",
|
|
978
|
+
required: n,
|
|
979
|
+
multiple: !0,
|
|
980
|
+
options: t.items.enum.map((i) => ({
|
|
981
|
+
value: String(i),
|
|
982
|
+
label: String(i)
|
|
983
|
+
}))
|
|
984
|
+
};
|
|
985
|
+
if (t.enum)
|
|
986
|
+
return {
|
|
987
|
+
key: e,
|
|
988
|
+
label: s,
|
|
989
|
+
icon: a,
|
|
990
|
+
inputType: "select",
|
|
991
|
+
required: n,
|
|
992
|
+
multiple: !1,
|
|
993
|
+
options: t.enum.map((i) => ({
|
|
994
|
+
value: String(i),
|
|
995
|
+
label: String(i)
|
|
996
|
+
}))
|
|
997
|
+
};
|
|
998
|
+
if (t.anyOf && t.anyOf.every((i) => i.const !== void 0))
|
|
999
|
+
return {
|
|
1000
|
+
key: e,
|
|
1001
|
+
label: s,
|
|
1002
|
+
icon: a,
|
|
1003
|
+
inputType: "select",
|
|
1004
|
+
required: n,
|
|
1005
|
+
multiple: !1,
|
|
1006
|
+
options: t.anyOf.map((i) => ({
|
|
1007
|
+
value: String(i.const),
|
|
1008
|
+
label: String(i.const)
|
|
1009
|
+
}))
|
|
1010
|
+
};
|
|
1011
|
+
switch (Array.isArray(t.type) ? t.type[0] : t.type) {
|
|
1012
|
+
case "boolean":
|
|
1013
|
+
return {
|
|
1014
|
+
key: e,
|
|
1015
|
+
label: s,
|
|
1016
|
+
icon: a,
|
|
1017
|
+
inputType: "boolean",
|
|
1018
|
+
required: n,
|
|
1019
|
+
toggle: d.toggle
|
|
1020
|
+
};
|
|
1021
|
+
case "number":
|
|
1022
|
+
case "integer":
|
|
1023
|
+
return {
|
|
1024
|
+
key: e,
|
|
1025
|
+
label: s,
|
|
1026
|
+
icon: a,
|
|
1027
|
+
inputType: "number",
|
|
1028
|
+
required: n,
|
|
1029
|
+
htmlType: "number"
|
|
1030
|
+
};
|
|
1031
|
+
case "array":
|
|
1032
|
+
return d.editorLanguage ? {
|
|
1033
|
+
key: e,
|
|
1034
|
+
label: s,
|
|
1035
|
+
icon: a,
|
|
1036
|
+
inputType: "editor",
|
|
1037
|
+
required: n,
|
|
1038
|
+
language: d.editorLanguage
|
|
1039
|
+
} : { key: e, label: s, icon: a, inputType: "array-text", required: n };
|
|
1040
|
+
case "object":
|
|
1041
|
+
return d.editorLanguage ? {
|
|
1042
|
+
key: e,
|
|
1043
|
+
label: s,
|
|
1044
|
+
icon: a,
|
|
1045
|
+
inputType: "editor",
|
|
1046
|
+
required: n,
|
|
1047
|
+
language: d.editorLanguage
|
|
1048
|
+
} : {
|
|
1049
|
+
key: e,
|
|
1050
|
+
label: s,
|
|
1051
|
+
icon: a,
|
|
1052
|
+
inputType: "text",
|
|
1053
|
+
required: n,
|
|
1054
|
+
htmlType: "text"
|
|
1055
|
+
};
|
|
1056
|
+
default:
|
|
1057
|
+
return d.editorLanguage ? {
|
|
1058
|
+
key: e,
|
|
1059
|
+
label: s,
|
|
1060
|
+
icon: a,
|
|
1061
|
+
inputType: "editor",
|
|
1062
|
+
required: n,
|
|
1063
|
+
language: d.editorLanguage
|
|
1064
|
+
} : {
|
|
1065
|
+
key: e,
|
|
1066
|
+
label: s,
|
|
1067
|
+
icon: a,
|
|
1068
|
+
inputType: "text",
|
|
1069
|
+
required: n,
|
|
1070
|
+
htmlType: t.format === "password" ? "password" : "text"
|
|
1071
|
+
};
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
const Ce = V({
|
|
1075
|
+
name: "NodeRedJsonSchemaForm",
|
|
1076
|
+
components: {
|
|
1077
|
+
NodeRedInputLabel: w,
|
|
1078
|
+
NodeRedToggle: z,
|
|
1079
|
+
NodeRedInput: B,
|
|
1080
|
+
NodeRedSelectInput: F,
|
|
1081
|
+
NodeRedTypedInput: U,
|
|
1082
|
+
NodeRedConfigInput: M,
|
|
1083
|
+
NodeRedEditorInput: P
|
|
1084
|
+
},
|
|
1085
|
+
props: {
|
|
1086
|
+
node: {
|
|
1087
|
+
type: Object,
|
|
1088
|
+
required: !0
|
|
1089
|
+
},
|
|
1090
|
+
schema: {
|
|
1091
|
+
type: Object,
|
|
1092
|
+
required: !0
|
|
1093
|
+
},
|
|
1094
|
+
errors: {
|
|
1095
|
+
type: Object,
|
|
1096
|
+
default: () => ({})
|
|
1097
|
+
}
|
|
1098
|
+
},
|
|
1099
|
+
computed: {
|
|
1100
|
+
configFields() {
|
|
1101
|
+
var t;
|
|
1102
|
+
if (!((t = this.schema) != null && t.properties)) return [];
|
|
1103
|
+
const e = new Set(this.schema.required ?? []);
|
|
1104
|
+
return Object.entries(this.schema.properties).filter(([n]) => !_e.has(n)).map(
|
|
1105
|
+
([n, r]) => C(
|
|
1106
|
+
n,
|
|
1107
|
+
r,
|
|
1108
|
+
e.has(n),
|
|
1109
|
+
this.resolveI18n("configs", n)
|
|
1110
|
+
)
|
|
1111
|
+
);
|
|
1112
|
+
},
|
|
1113
|
+
credentialFields() {
|
|
1114
|
+
var n, r;
|
|
1115
|
+
const e = (r = (n = this.schema) == null ? void 0 : n.properties) == null ? void 0 : r.credentials;
|
|
1116
|
+
if (!(e != null && e.properties)) return [];
|
|
1117
|
+
const t = new Set(e.required ?? []);
|
|
1118
|
+
return Object.entries(e.properties).map(([s, d]) => {
|
|
1119
|
+
const a = C(
|
|
1120
|
+
s,
|
|
1121
|
+
d,
|
|
1122
|
+
t.has(s),
|
|
1123
|
+
this.resolveI18n("credentials", s)
|
|
1124
|
+
);
|
|
1125
|
+
return a.inputType !== "text" ? {
|
|
1126
|
+
...a,
|
|
1127
|
+
inputType: "text",
|
|
1128
|
+
htmlType: d.format === "password" ? "password" : "text"
|
|
1129
|
+
} : a;
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
},
|
|
1133
|
+
methods: {
|
|
1134
|
+
resolveI18n(e, t) {
|
|
1135
|
+
const n = this.$i18n(`${e}.${t}`), r = `${this.node.type}.${e}.${t}`;
|
|
1136
|
+
if (n && n !== r && n !== `${e}.${t}`)
|
|
1137
|
+
return n;
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
}), Ae = { key: 1 }, Oe = { key: 2 }, De = ["checked", "onChange"], We = { key: 6 }, Be = ["value", "onInput"], Ue = {
|
|
1141
|
+
key: 0,
|
|
1142
|
+
class: "node-red-vue-input-error-message"
|
|
1143
|
+
};
|
|
1144
|
+
function Me(e, t, n, r, s, d) {
|
|
1145
|
+
const a = g("NodeRedInput"), h = g("NodeRedToggle"), b = g("NodeRedInputLabel"), i = g("NodeRedSelectInput"), u = g("NodeRedTypedInput"), y = g("NodeRedConfigInput"), I = g("NodeRedEditorInput");
|
|
1146
|
+
return l(), c("div", null, [
|
|
1147
|
+
(l(!0), c(
|
|
1148
|
+
_,
|
|
1149
|
+
null,
|
|
1150
|
+
L(e.configFields, (o) => (l(), c("div", {
|
|
1151
|
+
key: o.key,
|
|
1152
|
+
class: "form-row"
|
|
1153
|
+
}, [
|
|
1154
|
+
o.inputType === "text" || o.inputType === "number" ? (l(), v(a, {
|
|
1155
|
+
key: 0,
|
|
1156
|
+
value: e.node[o.key],
|
|
1157
|
+
"onUpdate:value": (p) => e.node[o.key] = p,
|
|
1158
|
+
type: o.htmlType,
|
|
1159
|
+
label: o.label,
|
|
1160
|
+
icon: o.icon,
|
|
1161
|
+
required: o.required,
|
|
1162
|
+
error: e.errors[`node.${o.key}`]
|
|
1163
|
+
}, null, 8, ["value", "onUpdate:value", "type", "label", "icon", "required", "error"])) : o.inputType === "boolean" && o.toggle ? (l(), c("div", Ae, [
|
|
1164
|
+
R(h, {
|
|
1165
|
+
"model-value": e.node[o.key],
|
|
1166
|
+
label: o.label,
|
|
1167
|
+
icon: o.icon,
|
|
1168
|
+
"onUpdate:modelValue": (p) => e.node[o.key] = p
|
|
1169
|
+
}, null, 8, ["model-value", "label", "icon", "onUpdate:modelValue"])
|
|
1170
|
+
])) : o.inputType === "boolean" ? (l(), c("div", Oe, [
|
|
1171
|
+
R(b, {
|
|
1172
|
+
label: o.label,
|
|
1173
|
+
icon: o.icon,
|
|
1174
|
+
required: o.required
|
|
1175
|
+
}, null, 8, ["label", "icon", "required"]),
|
|
1176
|
+
m("input", {
|
|
1177
|
+
type: "checkbox",
|
|
1178
|
+
checked: e.node[o.key],
|
|
1179
|
+
style: { width: "auto", margin: "0" },
|
|
1180
|
+
onChange: (p) => {
|
|
1181
|
+
e.node[o.key] = p.target.checked;
|
|
1182
|
+
}
|
|
1183
|
+
}, null, 40, De)
|
|
1184
|
+
])) : o.inputType === "select" ? (l(), v(i, {
|
|
1185
|
+
key: 3,
|
|
1186
|
+
value: e.node[o.key],
|
|
1187
|
+
"onUpdate:value": (p) => e.node[o.key] = p,
|
|
1188
|
+
options: o.options,
|
|
1189
|
+
multiple: o.multiple,
|
|
1190
|
+
label: o.label,
|
|
1191
|
+
icon: o.icon,
|
|
1192
|
+
required: o.required,
|
|
1193
|
+
error: e.errors[`node.${o.key}`]
|
|
1194
|
+
}, null, 8, ["value", "onUpdate:value", "options", "multiple", "label", "icon", "required", "error"])) : o.inputType === "typed" ? (l(), v(u, {
|
|
1195
|
+
key: 4,
|
|
1196
|
+
value: e.node[o.key],
|
|
1197
|
+
"onUpdate:value": (p) => e.node[o.key] = p,
|
|
1198
|
+
types: o.types,
|
|
1199
|
+
label: o.label,
|
|
1200
|
+
icon: o.icon,
|
|
1201
|
+
required: o.required,
|
|
1202
|
+
error: e.errors[`node.${o.key}`]
|
|
1203
|
+
}, null, 8, ["value", "onUpdate:value", "types", "label", "icon", "required", "error"])) : o.inputType === "config" ? (l(), v(y, {
|
|
1204
|
+
key: 5,
|
|
1205
|
+
value: e.node[o.key],
|
|
1206
|
+
"onUpdate:value": (p) => e.node[o.key] = p,
|
|
1207
|
+
type: o.configType,
|
|
1208
|
+
node: e.node,
|
|
1209
|
+
"prop-name": o.key,
|
|
1210
|
+
label: o.label,
|
|
1211
|
+
icon: o.icon,
|
|
1212
|
+
required: o.required,
|
|
1213
|
+
error: e.errors[`node.${o.key}`]
|
|
1214
|
+
}, null, 8, ["value", "onUpdate:value", "type", "node", "prop-name", "label", "icon", "required", "error"])) : o.inputType === "array-text" ? (l(), c("div", We, [
|
|
1215
|
+
R(b, {
|
|
1216
|
+
label: o.label,
|
|
1217
|
+
icon: o.icon,
|
|
1218
|
+
required: o.required
|
|
1219
|
+
}, null, 8, ["label", "icon", "required"]),
|
|
1220
|
+
t[0] || (t[0] = m(
|
|
1221
|
+
"span",
|
|
1222
|
+
{ style: { display: "block", "font-size": "11px", color: "var(--red-ui-text-color-disabled, #999)", "margin-bottom": "4px" } },
|
|
1223
|
+
" One entry per line ",
|
|
1224
|
+
-1
|
|
1225
|
+
/* CACHED */
|
|
1226
|
+
)),
|
|
1227
|
+
m("textarea", {
|
|
1228
|
+
value: Array.isArray(e.node[o.key]) ? e.node[o.key].join(`
|
|
1229
|
+
`) : e.node[o.key] ?? "",
|
|
1230
|
+
rows: "4",
|
|
1231
|
+
style: { width: "100%", resize: "vertical", "font-family": "monospace", "font-size": "13px" },
|
|
1232
|
+
onInput: (p) => e.node[o.key] = p.target.value.split(`
|
|
1233
|
+
`).filter(Boolean)
|
|
1234
|
+
}, null, 40, Be),
|
|
1235
|
+
e.errors[`node.${o.key}`] ? (l(), c(
|
|
1236
|
+
"span",
|
|
1237
|
+
Ue,
|
|
1238
|
+
E(e.errors[`node.${o.key}`]),
|
|
1239
|
+
1
|
|
1240
|
+
/* TEXT */
|
|
1241
|
+
)) : f("v-if", !0)
|
|
1242
|
+
])) : o.inputType === "editor" ? (l(), v(I, {
|
|
1243
|
+
key: 7,
|
|
1244
|
+
value: e.node[o.key],
|
|
1245
|
+
"onUpdate:value": (p) => e.node[o.key] = p,
|
|
1246
|
+
language: o.language,
|
|
1247
|
+
label: o.label,
|
|
1248
|
+
icon: o.icon,
|
|
1249
|
+
required: o.required,
|
|
1250
|
+
error: e.errors[`node.${o.key}`]
|
|
1251
|
+
}, null, 8, ["value", "onUpdate:value", "language", "label", "icon", "required", "error"])) : f("v-if", !0)
|
|
1252
|
+
]))),
|
|
1253
|
+
128
|
|
1254
|
+
/* KEYED_FRAGMENT */
|
|
1255
|
+
)),
|
|
1256
|
+
(l(!0), c(
|
|
1257
|
+
_,
|
|
1258
|
+
null,
|
|
1259
|
+
L(e.credentialFields, (o) => (l(), c("div", {
|
|
1260
|
+
key: `cred-${o.key}`,
|
|
1261
|
+
class: "form-row"
|
|
1262
|
+
}, [
|
|
1263
|
+
R(a, {
|
|
1264
|
+
value: e.node.credentials[o.key],
|
|
1265
|
+
"onUpdate:value": (p) => e.node.credentials[o.key] = p,
|
|
1266
|
+
type: o.htmlType,
|
|
1267
|
+
label: o.label,
|
|
1268
|
+
icon: o.icon,
|
|
1269
|
+
required: o.required,
|
|
1270
|
+
error: e.errors[`node.credentials.${o.key}`]
|
|
1271
|
+
}, null, 8, ["value", "onUpdate:value", "type", "label", "icon", "required", "error"])
|
|
1272
|
+
]))),
|
|
1273
|
+
128
|
|
1274
|
+
/* KEYED_FRAGMENT */
|
|
1275
|
+
))
|
|
1276
|
+
]);
|
|
1277
|
+
}
|
|
1278
|
+
const Fe = /* @__PURE__ */ T(Ce, [["render", Me]]);
|
|
1279
|
+
function A() {
|
|
1280
|
+
const e = {
|
|
1281
|
+
get(t) {
|
|
1282
|
+
return e[t];
|
|
1283
|
+
},
|
|
1284
|
+
set(t, n) {
|
|
1285
|
+
return e[t] = n, n;
|
|
1286
|
+
},
|
|
1287
|
+
remove(t) {
|
|
1288
|
+
const n = e[t];
|
|
1289
|
+
return delete e[t], n;
|
|
15
1290
|
}
|
|
16
1291
|
};
|
|
17
|
-
return
|
|
1292
|
+
return e;
|
|
18
1293
|
}
|
|
19
|
-
function
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
22
|
-
for (let
|
|
23
|
-
if (s
|
|
24
|
-
if (
|
|
1294
|
+
function Pe(e, t) {
|
|
1295
|
+
if (e === t) return !0;
|
|
1296
|
+
const n = e.split("/"), r = t.split("/");
|
|
1297
|
+
for (let s = 0; s < n.length; s++) {
|
|
1298
|
+
if (n[s] === "#") return !0;
|
|
1299
|
+
if (s >= r.length || n[s] !== "+" && n[s] !== r[s]) return !1;
|
|
25
1300
|
}
|
|
26
|
-
return
|
|
1301
|
+
return n.length === r.length;
|
|
27
1302
|
}
|
|
28
|
-
function
|
|
29
|
-
var
|
|
30
|
-
(
|
|
1303
|
+
function ze(e) {
|
|
1304
|
+
var t;
|
|
1305
|
+
(t = e.__reset) == null || t.call(e);
|
|
31
1306
|
}
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
let
|
|
35
|
-
const
|
|
36
|
-
const
|
|
1307
|
+
function He() {
|
|
1308
|
+
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], r = {}, s = [];
|
|
1309
|
+
let d = !1, a = 0;
|
|
1310
|
+
const h = () => {
|
|
1311
|
+
const i = {
|
|
37
1312
|
element: null,
|
|
38
|
-
open: () =>
|
|
39
|
-
close: () =>
|
|
40
|
-
setContent: () =>
|
|
1313
|
+
open: () => i,
|
|
1314
|
+
close: () => i,
|
|
1315
|
+
setContent: () => i,
|
|
41
1316
|
move: () => {
|
|
42
1317
|
}
|
|
43
1318
|
};
|
|
44
|
-
return
|
|
45
|
-
},
|
|
46
|
-
_: (
|
|
1319
|
+
return i;
|
|
1320
|
+
}, b = {
|
|
1321
|
+
_: (i) => i,
|
|
47
1322
|
editor: {
|
|
48
|
-
createEditor(
|
|
49
|
-
let
|
|
50
|
-
const
|
|
51
|
-
on(
|
|
52
|
-
(
|
|
1323
|
+
createEditor(i) {
|
|
1324
|
+
let u = (i == null ? void 0 : i.value) || "";
|
|
1325
|
+
const y = {}, I = {
|
|
1326
|
+
on(o, p) {
|
|
1327
|
+
(y[o] ?? (y[o] = [])).push(p);
|
|
53
1328
|
}
|
|
54
1329
|
};
|
|
55
1330
|
return {
|
|
56
|
-
getValue: () =>
|
|
57
|
-
setValue: (
|
|
58
|
-
|
|
1331
|
+
getValue: () => u,
|
|
1332
|
+
setValue: (o) => {
|
|
1333
|
+
u = o, (y.change ?? []).forEach((p) => p());
|
|
59
1334
|
},
|
|
60
|
-
getSession: () =>
|
|
1335
|
+
getSession: () => I,
|
|
61
1336
|
focus: () => {
|
|
62
1337
|
},
|
|
63
1338
|
destroy: () => {
|
|
@@ -79,13 +1354,13 @@ function N() {
|
|
|
79
1354
|
}
|
|
80
1355
|
},
|
|
81
1356
|
popover: {
|
|
82
|
-
create: () =>
|
|
1357
|
+
create: () => h(),
|
|
83
1358
|
tooltip: () => {
|
|
84
|
-
const
|
|
1359
|
+
const i = {
|
|
85
1360
|
element: null,
|
|
86
|
-
open: () =>
|
|
87
|
-
close: () =>
|
|
88
|
-
setContent: () =>
|
|
1361
|
+
open: () => i,
|
|
1362
|
+
close: () => i,
|
|
1363
|
+
setContent: () => i,
|
|
89
1364
|
move: () => {
|
|
90
1365
|
},
|
|
91
1366
|
delete: () => {
|
|
@@ -93,91 +1368,91 @@ function N() {
|
|
|
93
1368
|
setAction: () => {
|
|
94
1369
|
}
|
|
95
1370
|
};
|
|
96
|
-
return
|
|
1371
|
+
return i;
|
|
97
1372
|
}
|
|
98
1373
|
},
|
|
99
1374
|
nodes: {
|
|
100
|
-
registerType(
|
|
101
|
-
|
|
1375
|
+
registerType(i, u) {
|
|
1376
|
+
t.set(i, u);
|
|
102
1377
|
},
|
|
103
|
-
getType(
|
|
104
|
-
return
|
|
1378
|
+
getType(i) {
|
|
1379
|
+
return t.get(i) ?? null;
|
|
105
1380
|
},
|
|
106
|
-
node(
|
|
107
|
-
return
|
|
1381
|
+
node(i) {
|
|
1382
|
+
return e.get(i) ?? null;
|
|
108
1383
|
},
|
|
109
|
-
add(
|
|
110
|
-
return
|
|
1384
|
+
add(i) {
|
|
1385
|
+
return e.set(i.id, i), i;
|
|
111
1386
|
},
|
|
112
|
-
remove(
|
|
113
|
-
const
|
|
114
|
-
return
|
|
1387
|
+
remove(i) {
|
|
1388
|
+
const u = e.get(i);
|
|
1389
|
+
return e.delete(i), { links: [], nodes: u ? [u] : [] };
|
|
115
1390
|
},
|
|
116
1391
|
clear() {
|
|
117
|
-
|
|
1392
|
+
e.clear();
|
|
118
1393
|
},
|
|
119
1394
|
// The mock keeps a single registry: eachNode and eachConfig iterate the
|
|
120
1395
|
// same entries. Register whatever your component expects to find.
|
|
121
|
-
eachNode(
|
|
122
|
-
for (const
|
|
123
|
-
if (
|
|
1396
|
+
eachNode(i) {
|
|
1397
|
+
for (const u of e.values())
|
|
1398
|
+
if (i(u) === !1) break;
|
|
124
1399
|
},
|
|
125
|
-
eachConfig(
|
|
126
|
-
for (const
|
|
127
|
-
if (
|
|
1400
|
+
eachConfig(i) {
|
|
1401
|
+
for (const u of e.values())
|
|
1402
|
+
if (i(u) === !1) break;
|
|
128
1403
|
},
|
|
129
|
-
filterNodes(
|
|
130
|
-
return [...
|
|
131
|
-
(
|
|
1404
|
+
filterNodes(i) {
|
|
1405
|
+
return [...e.values()].filter(
|
|
1406
|
+
(u) => (i.type === void 0 || u.type === i.type) && (i.z === void 0 || u.z === i.z)
|
|
132
1407
|
);
|
|
133
1408
|
},
|
|
134
|
-
filterLinks(
|
|
135
|
-
return
|
|
136
|
-
(
|
|
137
|
-
var
|
|
138
|
-
return (
|
|
1409
|
+
filterLinks(i) {
|
|
1410
|
+
return n.filter(
|
|
1411
|
+
(u) => {
|
|
1412
|
+
var y, I, o, p;
|
|
1413
|
+
return (i.source === void 0 || u.source === i.source || ((y = u.source) == null ? void 0 : y.id) === ((I = i.source) == null ? void 0 : I.id)) && (i.target === void 0 || u.target === i.target || ((o = u.target) == null ? void 0 : o.id) === ((p = i.target) == null ? void 0 : p.id));
|
|
139
1414
|
}
|
|
140
1415
|
);
|
|
141
1416
|
},
|
|
142
|
-
addLink(
|
|
143
|
-
|
|
1417
|
+
addLink(i) {
|
|
1418
|
+
n.push(i);
|
|
144
1419
|
},
|
|
145
|
-
dirty(
|
|
146
|
-
if (
|
|
147
|
-
|
|
1420
|
+
dirty(i) {
|
|
1421
|
+
if (i === void 0) return d;
|
|
1422
|
+
d = i;
|
|
148
1423
|
},
|
|
149
1424
|
id() {
|
|
150
|
-
return (++
|
|
1425
|
+
return (++a).toString(16).padStart(16, "0");
|
|
151
1426
|
}
|
|
152
1427
|
},
|
|
153
1428
|
events: {
|
|
154
|
-
on(
|
|
155
|
-
(
|
|
1429
|
+
on(i, u) {
|
|
1430
|
+
(r[i] ?? (r[i] = [])).push(u);
|
|
156
1431
|
},
|
|
157
|
-
off(
|
|
158
|
-
|
|
159
|
-
(
|
|
160
|
-
) : delete
|
|
1432
|
+
off(i, u) {
|
|
1433
|
+
r[i] && (u ? r[i] = r[i].filter(
|
|
1434
|
+
(y) => y !== u
|
|
1435
|
+
) : delete r[i]);
|
|
161
1436
|
},
|
|
162
|
-
emit(
|
|
163
|
-
[...
|
|
1437
|
+
emit(i, ...u) {
|
|
1438
|
+
[...r[i] ?? []].forEach((y) => y(...u));
|
|
164
1439
|
}
|
|
165
1440
|
},
|
|
166
1441
|
comms: {
|
|
167
|
-
subscribe(
|
|
168
|
-
|
|
1442
|
+
subscribe(i, u) {
|
|
1443
|
+
s.push({ topic: i, callback: u });
|
|
169
1444
|
},
|
|
170
|
-
unsubscribe(
|
|
171
|
-
const
|
|
172
|
-
(
|
|
1445
|
+
unsubscribe(i, u) {
|
|
1446
|
+
const y = s.findIndex(
|
|
1447
|
+
(I) => I.topic === i && I.callback === u
|
|
173
1448
|
);
|
|
174
|
-
|
|
1449
|
+
y !== -1 && s.splice(y, 1);
|
|
175
1450
|
},
|
|
176
|
-
publish(
|
|
177
|
-
[...
|
|
1451
|
+
publish(i, u) {
|
|
1452
|
+
[...s].filter((y) => Pe(y.topic, i)).forEach((y) => y.callback(i, u));
|
|
178
1453
|
}
|
|
179
1454
|
},
|
|
180
|
-
settings:
|
|
1455
|
+
settings: A(),
|
|
181
1456
|
notify: () => ({
|
|
182
1457
|
update: () => {
|
|
183
1458
|
},
|
|
@@ -185,153 +1460,153 @@ function N() {
|
|
|
185
1460
|
}
|
|
186
1461
|
})
|
|
187
1462
|
};
|
|
188
|
-
return Object.defineProperty(
|
|
1463
|
+
return Object.defineProperty(b, "__reset", {
|
|
189
1464
|
enumerable: !1,
|
|
190
1465
|
value: () => {
|
|
191
|
-
|
|
192
|
-
for (const
|
|
193
|
-
delete
|
|
194
|
-
|
|
1466
|
+
e.clear(), t.clear(), n.length = 0;
|
|
1467
|
+
for (const i of Object.keys(r))
|
|
1468
|
+
delete r[i];
|
|
1469
|
+
s.length = 0, d = !1, b.settings = A();
|
|
195
1470
|
}
|
|
196
|
-
}),
|
|
1471
|
+
}), b;
|
|
197
1472
|
}
|
|
198
|
-
function
|
|
1473
|
+
function O() {
|
|
199
1474
|
return { typedInput: { value: "", type: "" }, listeners: {} };
|
|
200
1475
|
}
|
|
201
|
-
function
|
|
202
|
-
return
|
|
1476
|
+
function Je(e) {
|
|
1477
|
+
return e && !e.__jqState && (e.__jqState = O()), e ? e.__jqState : O();
|
|
203
1478
|
}
|
|
204
|
-
function
|
|
205
|
-
const
|
|
206
|
-
0:
|
|
207
|
-
length:
|
|
208
|
-
typedInput(
|
|
209
|
-
if (typeof
|
|
210
|
-
return
|
|
1479
|
+
function S(e) {
|
|
1480
|
+
const t = Je(e), n = {
|
|
1481
|
+
0: e,
|
|
1482
|
+
length: e ? 1 : 0,
|
|
1483
|
+
typedInput(r, s) {
|
|
1484
|
+
if (typeof r == "object")
|
|
1485
|
+
return t.typedInput = {
|
|
211
1486
|
value: "",
|
|
212
|
-
type:
|
|
213
|
-
types:
|
|
214
|
-
},
|
|
215
|
-
if (
|
|
216
|
-
if (
|
|
217
|
-
|
|
1487
|
+
type: r.default || "",
|
|
1488
|
+
types: r.types
|
|
1489
|
+
}, n;
|
|
1490
|
+
if (r === "value") {
|
|
1491
|
+
if (s !== void 0) {
|
|
1492
|
+
t.typedInput.value = String(s), e && e.setAttribute("value", String(s));
|
|
218
1493
|
return;
|
|
219
1494
|
}
|
|
220
|
-
return
|
|
1495
|
+
return t.typedInput.value;
|
|
221
1496
|
}
|
|
222
|
-
if (
|
|
223
|
-
if (
|
|
224
|
-
|
|
1497
|
+
if (r === "type") {
|
|
1498
|
+
if (s !== void 0) {
|
|
1499
|
+
t.typedInput.type = String(s);
|
|
225
1500
|
return;
|
|
226
1501
|
}
|
|
227
|
-
return
|
|
1502
|
+
return t.typedInput.type;
|
|
228
1503
|
}
|
|
229
|
-
if (
|
|
230
|
-
|
|
1504
|
+
if (r === "types") {
|
|
1505
|
+
t.typedInput.types = s;
|
|
231
1506
|
return;
|
|
232
1507
|
}
|
|
233
|
-
if (
|
|
1508
|
+
if (r === "validate")
|
|
234
1509
|
return !0;
|
|
235
|
-
if (
|
|
236
|
-
|
|
1510
|
+
if (r === "disable") {
|
|
1511
|
+
t.typedInput.disabled = s !== !1;
|
|
237
1512
|
return;
|
|
238
1513
|
}
|
|
239
|
-
if (
|
|
240
|
-
|
|
1514
|
+
if (r === "enable") {
|
|
1515
|
+
t.typedInput.disabled = !1;
|
|
241
1516
|
return;
|
|
242
1517
|
}
|
|
243
|
-
if (
|
|
244
|
-
|
|
1518
|
+
if (r === "hide") {
|
|
1519
|
+
t.typedInput.hidden = !0;
|
|
245
1520
|
return;
|
|
246
1521
|
}
|
|
247
|
-
if (
|
|
248
|
-
|
|
1522
|
+
if (r === "show") {
|
|
1523
|
+
t.typedInput.hidden = !1;
|
|
249
1524
|
return;
|
|
250
1525
|
}
|
|
251
|
-
if (
|
|
252
|
-
|
|
1526
|
+
if (r === "width") {
|
|
1527
|
+
t.typedInput.width = s;
|
|
253
1528
|
return;
|
|
254
1529
|
}
|
|
255
|
-
if (
|
|
256
|
-
return
|
|
1530
|
+
if (r !== "focus")
|
|
1531
|
+
return n;
|
|
257
1532
|
},
|
|
258
|
-
on(
|
|
259
|
-
return
|
|
1533
|
+
on(r, s) {
|
|
1534
|
+
return t.listeners[r] || (t.listeners[r] = []), t.listeners[r].push(s), n;
|
|
260
1535
|
},
|
|
261
|
-
off(
|
|
262
|
-
if (
|
|
263
|
-
delete
|
|
1536
|
+
off(r) {
|
|
1537
|
+
if (r)
|
|
1538
|
+
delete t.listeners[r];
|
|
264
1539
|
else
|
|
265
|
-
for (const
|
|
266
|
-
delete
|
|
267
|
-
return
|
|
1540
|
+
for (const s of Object.keys(t.listeners))
|
|
1541
|
+
delete t.listeners[s];
|
|
1542
|
+
return n;
|
|
268
1543
|
},
|
|
269
|
-
val(
|
|
270
|
-
return
|
|
1544
|
+
val(r) {
|
|
1545
|
+
return r !== void 0 ? ((e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement) && (e.value = String(r)), n) : e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement ? e.value : "";
|
|
271
1546
|
},
|
|
272
|
-
find(
|
|
273
|
-
return
|
|
1547
|
+
find(r) {
|
|
1548
|
+
return S((e == null ? void 0 : e.querySelector(r)) ?? null);
|
|
274
1549
|
},
|
|
275
|
-
append(
|
|
276
|
-
const
|
|
277
|
-
return
|
|
1550
|
+
append(r) {
|
|
1551
|
+
const s = (r == null ? void 0 : r[0]) || r;
|
|
1552
|
+
return e && s instanceof Element && e.appendChild(s), n;
|
|
278
1553
|
},
|
|
279
|
-
appendTo(
|
|
280
|
-
const
|
|
281
|
-
return
|
|
1554
|
+
appendTo(r) {
|
|
1555
|
+
const s = (r == null ? void 0 : r[0]) || r;
|
|
1556
|
+
return s instanceof Element && e && s.appendChild(e), n;
|
|
282
1557
|
},
|
|
283
|
-
html(
|
|
284
|
-
return
|
|
1558
|
+
html(r) {
|
|
1559
|
+
return e && (e.innerHTML = r), n;
|
|
285
1560
|
},
|
|
286
1561
|
empty() {
|
|
287
|
-
return
|
|
1562
|
+
return e && (e.innerHTML = ""), n;
|
|
288
1563
|
},
|
|
289
1564
|
i18n() {
|
|
290
|
-
return
|
|
1565
|
+
return n;
|
|
291
1566
|
},
|
|
292
|
-
addClass(
|
|
293
|
-
return
|
|
1567
|
+
addClass(r) {
|
|
1568
|
+
return e == null || e.classList.add(r), n;
|
|
294
1569
|
},
|
|
295
|
-
removeClass(
|
|
296
|
-
return
|
|
1570
|
+
removeClass(r) {
|
|
1571
|
+
return e == null || e.classList.remove(r), n;
|
|
297
1572
|
},
|
|
298
|
-
__trigger(
|
|
299
|
-
(
|
|
1573
|
+
__trigger(r) {
|
|
1574
|
+
(t.listeners[r] || []).forEach((s) => s());
|
|
300
1575
|
}
|
|
301
1576
|
};
|
|
302
|
-
return
|
|
1577
|
+
return n;
|
|
303
1578
|
}
|
|
304
|
-
function
|
|
305
|
-
return function(
|
|
306
|
-
if (typeof
|
|
307
|
-
if (
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
const
|
|
311
|
-
if (
|
|
312
|
-
for (const [
|
|
313
|
-
|
|
314
|
-
return
|
|
1579
|
+
function Ke() {
|
|
1580
|
+
return function(t, n) {
|
|
1581
|
+
if (typeof t == "string") {
|
|
1582
|
+
if (t.trim().startsWith("<")) {
|
|
1583
|
+
const r = document.createElement("template");
|
|
1584
|
+
r.innerHTML = t.trim();
|
|
1585
|
+
const s = r.content.firstElementChild;
|
|
1586
|
+
if (s && n)
|
|
1587
|
+
for (const [d, a] of Object.entries(n))
|
|
1588
|
+
d === "html" ? s.innerHTML = String(a) : s.setAttribute(d, String(a));
|
|
1589
|
+
return S(s);
|
|
315
1590
|
}
|
|
316
|
-
return
|
|
1591
|
+
return S(document.querySelector(t));
|
|
317
1592
|
}
|
|
318
|
-
return
|
|
1593
|
+
return t instanceof Element || t && typeof t == "object" && t.nodeType ? S(t) : S(null);
|
|
319
1594
|
};
|
|
320
1595
|
}
|
|
321
|
-
function
|
|
322
|
-
window.$ =
|
|
323
|
-
|
|
1596
|
+
function Qe() {
|
|
1597
|
+
window.$ = Ke(), window.RED = He(), Q(() => {
|
|
1598
|
+
ze(window.RED);
|
|
324
1599
|
});
|
|
325
1600
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
NodeRedInputLabel:
|
|
329
|
-
NodeRedToggle:
|
|
330
|
-
NodeRedInput:
|
|
331
|
-
NodeRedTypedInput:
|
|
332
|
-
NodeRedConfigInput:
|
|
333
|
-
NodeRedSelectInput:
|
|
334
|
-
NodeRedEditorInput:
|
|
335
|
-
NodeRedJsonSchemaForm:
|
|
1601
|
+
D.global.mocks.$i18n = (e) => e;
|
|
1602
|
+
D.global.components = {
|
|
1603
|
+
NodeRedInputLabel: w,
|
|
1604
|
+
NodeRedToggle: z,
|
|
1605
|
+
NodeRedInput: B,
|
|
1606
|
+
NodeRedTypedInput: U,
|
|
1607
|
+
NodeRedConfigInput: M,
|
|
1608
|
+
NodeRedSelectInput: F,
|
|
1609
|
+
NodeRedEditorInput: P,
|
|
1610
|
+
NodeRedJsonSchemaForm: Fe
|
|
336
1611
|
};
|
|
337
|
-
|
|
1612
|
+
Qe();
|