@web-utils/component 2.7.4 → 2.7.5

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.
@@ -1,4 +1,4 @@
1
- import MonacoEditor from "../form-design/utils/monaco-editor";
1
+ import { M as MonacoEditor } from "./monaco.1dbdc960.js";
2
2
  import { s as staticRenderFns$1, r as render$1 } from "./ConfigCustom.vue_vue_type_template_lang.6e03d7fd.js";
3
3
  import { n as normalizeComponent } from "./vueComponentNormalizer.71e2aa87.js";
4
4
  import { s as staticRenderFns$2, r as render$2 } from "./ConfigInput.vue_vue_type_template_lang.cc1eb052.js";
@@ -870,7 +870,7 @@ var __component__$9 = /* @__PURE__ */ normalizeComponent(
870
870
  staticRenderFns$b,
871
871
  !1,
872
872
  __vue2_injectStyles$9,
873
- "9953620c",
873
+ "8a482952",
874
874
  null,
875
875
  null
876
876
  );
@@ -0,0 +1,283 @@
1
+ import * as h from "monaco-editor/esm/vs/editor/editor.api";
2
+ import "monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution";
3
+ let y = /[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, j = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/, u, g, O = {
4
+ // table of character substitutions
5
+ "\b": "\\b",
6
+ " ": "\\t",
7
+ "\n": "\\n",
8
+ "\f": "\\f",
9
+ "\r": "\\r",
10
+ '"': '\\"',
11
+ "'": "\\'",
12
+ "\\": "\\\\"
13
+ }, c;
14
+ function b(t, e = {}) {
15
+ var i = e.space || 2, n = e.dropQuotesOnKeys != !1, r = e.dropQuotesOnNumbers || !1, s = e.inlineShortArrays || !1, a = e.inlineShortArraysDepth || 1, f = e.quoteType || "single", d = e.minify || !1;
16
+ r && x(t);
17
+ var l = $(t, null, d ? void 0 : i, n, f);
18
+ if (s && !d) {
19
+ var o = S(l);
20
+ if (a > 1)
21
+ for (var v = 1; v < a && (l = o, o = S(l), o != l); v++)
22
+ ;
23
+ l = o;
24
+ }
25
+ return l;
26
+ }
27
+ function x(t) {
28
+ if (M(t)) {
29
+ var e = Object.keys(t);
30
+ e && e.forEach(function(i) {
31
+ var n = t[i];
32
+ if (typeof n == "string") {
33
+ var r = n - 0;
34
+ t[i] = isNaN(r) ? n : r;
35
+ } else
36
+ (M(n) || Array.isArray(n)) && x(n);
37
+ });
38
+ }
39
+ }
40
+ function M(t) {
41
+ return t && typeof t == "object";
42
+ }
43
+ function S(t, e) {
44
+ if (e || (e = 80), typeof e != "number" || e < 20)
45
+ throw "Invalid width '" + e + "'. Expecting number equal or larger than 20.";
46
+ for (var i = t.split(`
47
+ `), n = 0, r = null, s = []; n < i.length; ) {
48
+ var a = !!i[n].match(/\[/), f = !!i[n].match(/\],?/);
49
+ if (a && !f)
50
+ s = [i[n]], r = n;
51
+ else if (f && !a && r) {
52
+ s.push((i[n] || "").trim());
53
+ var d = s.join(" ");
54
+ d.length < e && (i.splice(r, n - r + 1, d), n = r), r = null, s = [];
55
+ } else
56
+ r && s.push((i[n] || "").trim());
57
+ n += 1;
58
+ }
59
+ return i.join(`
60
+ `);
61
+ }
62
+ function $(t, e, i, n, r) {
63
+ var s;
64
+ if (u = "", g = "", typeof i == "number")
65
+ for (s = 0; s < i; s += 1)
66
+ g += " ";
67
+ else
68
+ typeof i == "string" && (g = i);
69
+ if (c = e, e && typeof e != "function" && (typeof e != "object" || typeof e.length != "number"))
70
+ throw new Error("JSON.stringify");
71
+ return m("", { "": t }, n, r);
72
+ }
73
+ function m(t, e, i, n) {
74
+ var r, s, a, f, d = u, l, o = e[t];
75
+ switch (o && typeof o == "object" && typeof o.toJSON == "function" && (o = o.toJSON(t)), typeof c == "function" && (o = c.call(e, t, o)), typeof o) {
76
+ case "function":
77
+ return o;
78
+ case "string":
79
+ return p(o, n);
80
+ case "number":
81
+ return isFinite(o) ? String(o) : "null";
82
+ case "boolean":
83
+ case "null":
84
+ return String(o);
85
+ case "object":
86
+ if (!o)
87
+ return "null";
88
+ if (u += g, l = [], Object.prototype.toString.apply(o) === "[object Array]") {
89
+ for (f = o.length, r = 0; r < f; r += 1)
90
+ l[r] = m(r, o, i, n) || "null";
91
+ return a = l.length === 0 ? "[]" : u ? `[
92
+ ` + u + l.join(`,
93
+ ` + u) + `
94
+ ` + d + "]" : "[" + l.join(",") + "]", u = d, a;
95
+ }
96
+ if (c && typeof c == "object")
97
+ for (f = c.length, r = 0; r < f; r += 1)
98
+ typeof c[r] == "string" && (s = c[r], a = m(s, o, i, n), a && l.push((i ? _(s, n) : p(s, n)) + (u ? ": " : ":") + a));
99
+ else
100
+ for (s in o)
101
+ Object.prototype.hasOwnProperty.call(o, s) && (a = m(s, o, i, n), a && l.push((i ? _(s, n) : p(s, n)) + (u ? ": " : ":") + a));
102
+ return a = l.length === 0 ? "{}" : u ? `{
103
+ ` + u + l.join(`,
104
+ ` + u) + `
105
+ ` + d + "}" : "{" + l.join(",") + "}", u = d, a;
106
+ }
107
+ }
108
+ function p(t, e) {
109
+ y.lastIndex = 0;
110
+ var i = '"';
111
+ return e === "single" && (i = "'"), y.test(t) ? i + t.replace(y, function(n) {
112
+ var r = O[n];
113
+ return typeof r == "string" ? r : "\\u" + ("0000" + n.charCodeAt(0).toString(16)).slice(-4);
114
+ }) + i : i + t + i;
115
+ }
116
+ function _(t, e) {
117
+ return j.test(t) ? t : p(t, e);
118
+ }
119
+ function E() {
120
+ }
121
+ const w = {
122
+ name: "MonacoEditor",
123
+ props: {
124
+ diffEditor: { type: Boolean, default: !1 },
125
+ //是否使用diff模式
126
+ width: { type: [String, Number], default: "100%" },
127
+ height: { type: [String, Number], default: "100%" },
128
+ original: String,
129
+ //只有在diff模式下有效
130
+ value: [String, Object],
131
+ language: { type: String, default: "javascript" },
132
+ theme: { type: String, default: "vs" },
133
+ readOnly: { type: Boolean, default: !1 },
134
+ options: {
135
+ type: Object,
136
+ default() {
137
+ return {};
138
+ }
139
+ },
140
+ editorMounted: { type: Function, default: E },
141
+ editorBeforeMount: { type: Function, default: E },
142
+ keyIndex: { type: String }
143
+ },
144
+ watch: {
145
+ options: {
146
+ deep: !0,
147
+ handler(t) {
148
+ this.editor && this.editor.updateOptions(t);
149
+ }
150
+ },
151
+ keyIndex() {
152
+ let t = this.value;
153
+ typeof t == "object" && (t = b(t)), this.editor && t !== this._getValue() && this._setValue(t);
154
+ },
155
+ language() {
156
+ if (this.editor)
157
+ if (this.diffEditor) {
158
+ const { original: t, modified: e } = this.editor.getModel();
159
+ h.editor.setModelLanguage(t, this.language), h.editor.setModelLanguage(e, this.language);
160
+ } else
161
+ h.editor.setModelLanguage(this.editor.getModel(), this.language);
162
+ },
163
+ theme() {
164
+ this.editor && h.editor.setTheme(this.theme);
165
+ },
166
+ style() {
167
+ this.editor && this.$nextTick(() => {
168
+ this.editor.layout();
169
+ });
170
+ },
171
+ value(t) {
172
+ this.editor && t !== this._getValue() && this._setValue(t);
173
+ }
174
+ },
175
+ computed: {
176
+ style() {
177
+ return {
178
+ width: /^\d+$/.test(this.width) ? `${this.width}px` : this.width,
179
+ height: /^\d+$/.test(this.height) ? `${this.height}px` : this.height,
180
+ position: "relative"
181
+ };
182
+ }
183
+ },
184
+ mounted() {
185
+ this.initMonaco();
186
+ },
187
+ beforeDestroy() {
188
+ this.editor && this.editor.dispose();
189
+ },
190
+ render(t) {
191
+ const e = this.options.fullScreen;
192
+ return t("div", { class: "monaco_editor_container", style: this.style }, [
193
+ e ? t("i", {
194
+ class: "el-icon-full-screen",
195
+ style: {
196
+ width: "1.2em",
197
+ height: "1.2em",
198
+ position: "absolute",
199
+ left: "0px",
200
+ top: "0px",
201
+ zIndex: "1",
202
+ cursor: "pointer"
203
+ },
204
+ on: { click: this._handleFullScreen }
205
+ }) : ""
206
+ ]);
207
+ },
208
+ methods: {
209
+ initMonaco() {
210
+ const { value: t, language: e, theme: i, readOnly: n, options: r } = this;
211
+ Object.assign(r, this._editorBeforeMount()), this.editor = h.editor[this.diffEditor ? "createDiffEditor" : "create"](this.$el, {
212
+ value: typeof t == "string" ? t : b(t),
213
+ language: e,
214
+ theme: i,
215
+ readOnly: n,
216
+ ...r
217
+ }), this.diffEditor && this._setModel(this.value, this.original), this._editorMounted(this.editor);
218
+ },
219
+ _handleFullScreen() {
220
+ this.isMaximum ? this.minEditor() : this.maxEditor();
221
+ },
222
+ // 放大
223
+ maxEditor() {
224
+ this.isMaximum = !0;
225
+ let t = this.$el;
226
+ this.originSize = {
227
+ width: t.clientWidth,
228
+ height: t.clientHeight
229
+ }, t.classList.add("editor-fullscreen"), this.editor.layout({
230
+ height: document.body.clientHeight,
231
+ width: document.body.clientWidth
232
+ }), document.addEventListener("keyup", (e) => {
233
+ e.keyCode == 27 && this.minEditor();
234
+ });
235
+ },
236
+ // 缩小
237
+ minEditor() {
238
+ this.isMaximum = !1, this.$el.classList.remove("editor-fullscreen"), this.editor.layout({
239
+ height: this.originSize.height,
240
+ width: this.originSize.width
241
+ }), document.removeEventListener("keyup", () => {
242
+ });
243
+ },
244
+ _getEditor() {
245
+ return this.editor ? this.diffEditor ? this.editor.modifiedEditor : this.editor : null;
246
+ },
247
+ _setModel(t, e) {
248
+ const { language: i } = this, n = h.editor.createModel(e, i), r = h.editor.createModel(t, i);
249
+ this.editor.setModel({
250
+ original: n,
251
+ modified: r
252
+ });
253
+ },
254
+ _setValue(t) {
255
+ let e = this._getEditor();
256
+ if (e)
257
+ return e.setValue(t);
258
+ },
259
+ _getValue() {
260
+ let t = this._getEditor();
261
+ return t ? t.getValue() : "";
262
+ },
263
+ _editorBeforeMount() {
264
+ return this.editorBeforeMount(h) || {};
265
+ },
266
+ _editorMounted(t) {
267
+ this.editorMounted(t, h), this.diffEditor ? t.onDidUpdateDiff((e) => {
268
+ const i = this._getValue();
269
+ this._emitChange(i, e);
270
+ }) : t.onDidChangeModelContent((e) => {
271
+ const i = this._getValue();
272
+ this._emitChange(i, e);
273
+ });
274
+ },
275
+ _emitChange(t, e) {
276
+ this.$emit("change", t, e), this.$emit("input", t);
277
+ }
278
+ }
279
+ };
280
+ export {
281
+ w as M,
282
+ b as c
283
+ };
@@ -1,4 +1,4 @@
1
- import MonacoEditor from "../../form-design/utils/monaco-editor";
1
+ import { M as MonacoEditor } from "../../chunks/monaco.1dbdc960.js";
2
2
  import { s as staticRenderFns, r as render } from "../../chunks/ConfigCustom.vue_vue_type_template_lang.6e03d7fd.js";
3
3
  import { n as normalizeComponent } from "../../chunks/vueComponentNormalizer.71e2aa87.js";
4
4
  const __vue2_script = {
@@ -1,4 +1,4 @@
1
- import MonacoEditor from "../../form-design/utils/monaco-editor";
1
+ import { M as MonacoEditor } from "../../chunks/monaco.1dbdc960.js";
2
2
  import { s as staticRenderFns, r as render } from "../../chunks/ConfigEvent.vue_vue_type_template_lang.5e8ed6cc.js";
3
3
  import { n as normalizeComponent } from "../../chunks/vueComponentNormalizer.71e2aa87.js";
4
4
  const __vue2_script = {
@@ -1,5 +1,5 @@
1
1
  import Draggable from "vuedraggable";
2
- import MonacoEditor from "../../form-design/utils/monaco-editor";
2
+ import { M as MonacoEditor } from "../../chunks/monaco.1dbdc960.js";
3
3
  import { s as staticRenderFns, r as render } from "../../chunks/ConfigSelect.vue_vue_type_template_lang.7db7e57f.js";
4
4
  import { n as normalizeComponent } from "../../chunks/vueComponentNormalizer.71e2aa87.js";
5
5
  const __vue2_script = {
@@ -1,4 +1,4 @@
1
- import MonacoEditor from "../../form-design/utils/monaco-editor";
1
+ import { M as MonacoEditor } from "../../chunks/monaco.1dbdc960.js";
2
2
  import { s as staticRenderFns, r as render, A as AfdColumn } from "../../chunks/ConfigTable.vue_vue_type_template_lang.3e8136d9.js";
3
3
  import { n as normalizeComponent } from "../../chunks/vueComponentNormalizer.71e2aa87.js";
4
4
  const __vue2_script = {
@@ -1,4 +1,4 @@
1
- import MonacoEditor from "../../form-design/utils/monaco-editor";
1
+ import { M as MonacoEditor } from "../../chunks/monaco.1dbdc960.js";
2
2
  import Draggable from "vuedraggable";
3
3
  import { s as staticRenderFns, r as render } from "../../chunks/ConfigTree.vue_vue_type_style_index_0_scoped_true_lang.3770c37e.js";
4
4
  import { n as normalizeComponent } from "../../chunks/vueComponentNormalizer.71e2aa87.js";
@@ -74,8 +74,8 @@ const __vue2_script = {
74
74
  this.selectData = e, this.dialogStatus = "add", this.dialogVisible = !0;
75
75
  },
76
76
  handleNodeRemove(e, t) {
77
- const a = e.parent, d = a.data.children || a.data, i = d.findIndex((s) => s.id === t.id);
78
- d.splice(i, 1);
77
+ const a = e.parent, d = a.data.children || a.data, s = d.findIndex((i) => i.id === t.id);
78
+ d.splice(s, 1);
79
79
  },
80
80
  handleDialogAdd() {
81
81
  this.$refs.dialogForm.validate((e) => {
@@ -84,11 +84,11 @@ const __vue2_script = {
84
84
  if (this.$refs.tree.getNode(a))
85
85
  this.$message.error("value重复");
86
86
  else {
87
- const i = this.selectData, s = {
87
+ const s = this.selectData, i = {
88
88
  label: t,
89
89
  value: this.dialogInputType == "number" ? new Number(a) : a
90
90
  };
91
- i ? (i.children || this.$set(i, "children", []), i.children.push(s)) : this.$set(this.data.dicData, this.data.dicData.length, s), this.beforeClose();
91
+ s ? (s.children || this.$set(s, "children", []), s.children.push(i)) : this.$set(this.data.dicData, this.data.dicData.length, i), this.beforeClose();
92
92
  }
93
93
  }
94
94
  });
@@ -104,7 +104,7 @@ var __component__ = /* @__PURE__ */ normalizeComponent(
104
104
  staticRenderFns,
105
105
  !1,
106
106
  __vue2_injectStyles,
107
- "9953620c",
107
+ "8a482952",
108
108
  null,
109
109
  null
110
110
  );
@@ -1 +1 @@
1
- .custom-tree-node[data-v-9953620c]{flex:1;display:flex;align-items:center;justify-content:space-between;font-size:14px;padding-right:8px}
1
+ .custom-tree-node[data-v-8a482952]{flex:1;display:flex;align-items:center;justify-content:space-between;font-size:14px;padding-right:8px}