vue2-components-plus 1.0.2 → 1.0.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.
- package/dist/ComponentDemo/DialogDemo.vue +273 -0
- package/dist/ComponentDemo/DirectivesDemo.vue +452 -0
- package/dist/ComponentDemo/FormDemo.vue +851 -0
- package/dist/ComponentDemo/NsTableDemo/index.vue +539 -0
- package/dist/ComponentDemo/NsTableDemo/mockData.js +117 -0
- package/dist/vue2-components-plus.js +2895 -0
- package/dist/vue2-components-plus.umd.cjs +1 -1
- package/package.json +47 -41
- package/dist/vue2-components-plus.es.js +0 -2181
- /package/dist/{style.css → vue2-components-plus.css} +0 -0
|
@@ -1,2181 +0,0 @@
|
|
|
1
|
-
import F, { getCurrentInstance as X, nextTick as Y } from "vue";
|
|
2
|
-
function U(e) {
|
|
3
|
-
const t = { maxLength: 50, pattern: null, min: null, max: null, int: !1 }, r = e.value;
|
|
4
|
-
return typeof r == "number" ? { ...t, maxLength: r } : r && typeof r == "object" ? {
|
|
5
|
-
maxLength: r.maxLength || t.maxLength,
|
|
6
|
-
pattern: r.pattern || null,
|
|
7
|
-
min: typeof r.min == "number" ? r.min : null,
|
|
8
|
-
max: typeof r.max == "number" ? r.max : null,
|
|
9
|
-
int: !!r.int
|
|
10
|
-
} : t;
|
|
11
|
-
}
|
|
12
|
-
function T(e, t, r = !0) {
|
|
13
|
-
let n = "", i = !1, s = !1;
|
|
14
|
-
return String(e || "").split("").forEach((a, l) => {
|
|
15
|
-
if (a === "-") {
|
|
16
|
-
r && l === 0 && !i && (n += a, i = !0);
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (a === ".") {
|
|
20
|
-
l !== 0 && !s && n[n.length - 1] !== "-" && (n += a, s = !0);
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
/^\d$/.test(a) && ((i ? n.slice(1) : n) === "0" && a !== "0" && !s && (n = i ? "-" : ""), n += a);
|
|
24
|
-
}), n.slice(0, t);
|
|
25
|
-
}
|
|
26
|
-
function J(e, t, r) {
|
|
27
|
-
let n = "", i = !1;
|
|
28
|
-
const s = r.min !== null && r.min < 0;
|
|
29
|
-
return String(e || "").split("").forEach((a, l) => {
|
|
30
|
-
if (a === "-") {
|
|
31
|
-
s && l === 0 && !i && (n += a, i = !0);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
/^\d$/.test(a) && ((i ? n.slice(1) : n) === "0" && a !== "0" && (n = i ? "-" : ""), n += a);
|
|
35
|
-
}), n.slice(0, t);
|
|
36
|
-
}
|
|
37
|
-
function G(e, t) {
|
|
38
|
-
if (t.int) {
|
|
39
|
-
const s = J(e, t.maxLength || 50, t);
|
|
40
|
-
if (s === "" || s === "-")
|
|
41
|
-
return s;
|
|
42
|
-
const a = parseInt(s, 10);
|
|
43
|
-
return Number.isNaN(a) ? "" : t.min !== null && a < t.min ? String(Math.ceil(t.min)) : t.max !== null && a > t.max ? String(Math.floor(t.max)) : s;
|
|
44
|
-
}
|
|
45
|
-
const r = t.min !== null && t.min < 0, n = T(e, t.maxLength || 50, r);
|
|
46
|
-
if (n === "" || n === "-" || n === ".")
|
|
47
|
-
return n;
|
|
48
|
-
const i = parseFloat(n);
|
|
49
|
-
return Number.isNaN(i) ? "" : t.min !== null && i < t.min ? String(t.min) : t.max !== null && i > t.max ? String(t.max) : n;
|
|
50
|
-
}
|
|
51
|
-
function Z(e, t, r) {
|
|
52
|
-
let n = "";
|
|
53
|
-
return String(e || "").split("").forEach((i) => {
|
|
54
|
-
if (n.length >= t)
|
|
55
|
-
return;
|
|
56
|
-
const s = n + i;
|
|
57
|
-
r.test(s) && (n = s);
|
|
58
|
-
}), n;
|
|
59
|
-
}
|
|
60
|
-
function L(e) {
|
|
61
|
-
return e ? e.tagName === "INPUT" || e.tagName === "TEXTAREA" ? e : e.querySelector("input, textarea") : null;
|
|
62
|
-
}
|
|
63
|
-
function $(e, t) {
|
|
64
|
-
if (!e)
|
|
65
|
-
return;
|
|
66
|
-
const r = U(t);
|
|
67
|
-
let n = e.value || "";
|
|
68
|
-
t.modifiers.range ? n = G(n, r) : t.modifiers.number ? n = T(n, r.maxLength) : t.modifiers.regex && r.pattern ? n = Z(n, r.maxLength, r.pattern) : n = String(n).slice(0, r.maxLength), n !== e.value && (e.value = n, e.dispatchEvent(new Event("input", { bubbles: !0 })));
|
|
69
|
-
}
|
|
70
|
-
function Q(e, t) {
|
|
71
|
-
const r = L(e);
|
|
72
|
-
if (!r)
|
|
73
|
-
return;
|
|
74
|
-
let n = !1;
|
|
75
|
-
const i = () => {
|
|
76
|
-
n = !0;
|
|
77
|
-
}, s = () => {
|
|
78
|
-
n = !1, $(r, t);
|
|
79
|
-
}, a = () => {
|
|
80
|
-
n || $(r, t);
|
|
81
|
-
};
|
|
82
|
-
r.addEventListener("compositionstart", i), r.addEventListener("compositionend", s), r.addEventListener("input", a), $(r, t), e.__nsLengthHandlers = {
|
|
83
|
-
inputEl: r,
|
|
84
|
-
handleCompositionStart: i,
|
|
85
|
-
handleCompositionEnd: s,
|
|
86
|
-
handleInput: a
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
function ee(e) {
|
|
90
|
-
const t = e.__nsLengthHandlers;
|
|
91
|
-
t && (t.inputEl.removeEventListener("compositionstart", t.handleCompositionStart), t.inputEl.removeEventListener("compositionend", t.handleCompositionEnd), t.inputEl.removeEventListener("input", t.handleInput), delete e.__nsLengthHandlers);
|
|
92
|
-
}
|
|
93
|
-
function O(e) {
|
|
94
|
-
e.directive("sline", {
|
|
95
|
-
inserted(t) {
|
|
96
|
-
t.style.whiteSpace = "nowrap", t.style.overflow = "hidden", t.style.textOverflow = "ellipsis", t.style.display = "inline-block", t.style.maxWidth = "100%";
|
|
97
|
-
}
|
|
98
|
-
}), e.directive("permission", {
|
|
99
|
-
inserted(t, r) {
|
|
100
|
-
let n = [];
|
|
101
|
-
try {
|
|
102
|
-
n = JSON.parse(sessionStorage.getItem("btnsPermission") || localStorage.getItem("btnsPermission") || "[]");
|
|
103
|
-
} catch {
|
|
104
|
-
n = [];
|
|
105
|
-
}
|
|
106
|
-
Array.isArray(n) || (n = []);
|
|
107
|
-
const i = r.modifiers.class ? "class" : "id", s = !!r.modifiers.display;
|
|
108
|
-
(i === "class" ? n.some((l) => t.classList.contains(l)) : n.includes(t.getAttribute("id"))) || (s ? t.style.display = "none" : (t.style.visibility = "hidden", t.style.pointerEvents = "none"));
|
|
109
|
-
}
|
|
110
|
-
}), e.directive("length", {
|
|
111
|
-
inserted(t, r) {
|
|
112
|
-
Q(t, r);
|
|
113
|
-
},
|
|
114
|
-
componentUpdated(t, r) {
|
|
115
|
-
const n = L(t);
|
|
116
|
-
$(n, r);
|
|
117
|
-
},
|
|
118
|
-
unbind(t) {
|
|
119
|
-
ee(t);
|
|
120
|
-
}
|
|
121
|
-
}), e.directive("event-unuse", {
|
|
122
|
-
inserted(t) {
|
|
123
|
-
t.style.pointerEvents = "none";
|
|
124
|
-
}
|
|
125
|
-
}), e.directive("event-use", {
|
|
126
|
-
inserted(t) {
|
|
127
|
-
t.style.pointerEvents = "auto";
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
let b = class {
|
|
132
|
-
};
|
|
133
|
-
b.VARS = {};
|
|
134
|
-
function V() {
|
|
135
|
-
if (typeof document > "u" || Object.keys(b.VARS).length > 0)
|
|
136
|
-
return b.VARS;
|
|
137
|
-
const e = {};
|
|
138
|
-
return Array.from(document.styleSheets || []).forEach((t) => {
|
|
139
|
-
let r = [];
|
|
140
|
-
try {
|
|
141
|
-
r = Array.from(t.cssRules || []);
|
|
142
|
-
} catch {
|
|
143
|
-
r = [];
|
|
144
|
-
}
|
|
145
|
-
r.forEach((n) => {
|
|
146
|
-
n.selectorText === ":root" && Array.from(n.style || []).filter((i) => i.indexOf("--matrix-") === 0).forEach((i) => {
|
|
147
|
-
e[i] = n.style.getPropertyValue(i).trim();
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
}), b.VARS = e, e;
|
|
151
|
-
}
|
|
152
|
-
function te(e) {
|
|
153
|
-
return typeof e != "string" ? e : e.indexOf("-") > -1 ? e.toLowerCase() : e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
154
|
-
}
|
|
155
|
-
function re(e) {
|
|
156
|
-
return e ? typeof e == "string" ? te(e) : e : "span";
|
|
157
|
-
}
|
|
158
|
-
function ne(e, t) {
|
|
159
|
-
if (!e || t === "default")
|
|
160
|
-
return e;
|
|
161
|
-
const r = e.data || (e.data = {});
|
|
162
|
-
return r.slot = t, e;
|
|
163
|
-
}
|
|
164
|
-
function ie(e, t) {
|
|
165
|
-
return e ? (Array.isArray(e) ? e : [e]).map((n) => ne(n, t)).filter(Boolean) : [];
|
|
166
|
-
}
|
|
167
|
-
function g(e, t) {
|
|
168
|
-
const r = String(typeof e == "string" ? e : e && e.name ? e.name : "").replace(/-/g, "").toLowerCase();
|
|
169
|
-
return t.some((n) => r === n.toLowerCase());
|
|
170
|
-
}
|
|
171
|
-
const se = {
|
|
172
|
-
name: "NsFormFieldRenderer",
|
|
173
|
-
inheritAttrs: !1,
|
|
174
|
-
props: {
|
|
175
|
-
field: {
|
|
176
|
-
type: Object,
|
|
177
|
-
required: !0
|
|
178
|
-
},
|
|
179
|
-
value: {
|
|
180
|
-
default: void 0
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
mounted() {
|
|
184
|
-
this.emitRef();
|
|
185
|
-
},
|
|
186
|
-
updated() {
|
|
187
|
-
this.emitRef();
|
|
188
|
-
},
|
|
189
|
-
methods: {
|
|
190
|
-
emitRef() {
|
|
191
|
-
this.$emit("ref", this.$refs.control || null);
|
|
192
|
-
},
|
|
193
|
-
getComponent() {
|
|
194
|
-
return re(this.field.component);
|
|
195
|
-
},
|
|
196
|
-
isUpload() {
|
|
197
|
-
return g(this.field.component, ["elupload"]);
|
|
198
|
-
},
|
|
199
|
-
rendersOptionsByChildren() {
|
|
200
|
-
return g(this.field.component, ["elselect", "elradiogroup", "elcheckboxgroup"]);
|
|
201
|
-
},
|
|
202
|
-
isFullWidthComponent() {
|
|
203
|
-
return g(this.field.component, [
|
|
204
|
-
"elinput",
|
|
205
|
-
"elselect",
|
|
206
|
-
"elcascader",
|
|
207
|
-
"eldatepicker",
|
|
208
|
-
"eltimepicker",
|
|
209
|
-
"elinputnumber",
|
|
210
|
-
"elautocomplete"
|
|
211
|
-
]);
|
|
212
|
-
},
|
|
213
|
-
buildProps() {
|
|
214
|
-
const e = this.field.params || {}, t = {};
|
|
215
|
-
return Object.keys(e).forEach((r) => {
|
|
216
|
-
r.indexOf("v-") !== 0 && (r === "rules" || r === "style" || r === "options" && this.rendersOptionsByChildren() || (t[r] = e[r]));
|
|
217
|
-
}), this.isUpload() || (t.value = this.value), t;
|
|
218
|
-
},
|
|
219
|
-
buildStyle() {
|
|
220
|
-
const e = this.field.params || {}, t = {
|
|
221
|
-
...this.field.style || {},
|
|
222
|
-
...e.style || {}
|
|
223
|
-
};
|
|
224
|
-
return this.isFullWidthComponent() && t.width === void 0 && (t.width = "100%"), t;
|
|
225
|
-
},
|
|
226
|
-
buildDirectives() {
|
|
227
|
-
const e = this.field.params || {};
|
|
228
|
-
return Object.keys(e).filter((t) => t.indexOf("v-") === 0).map((t) => {
|
|
229
|
-
const [, r] = t.split("v-"), [n, ...i] = r.split("."), s = {};
|
|
230
|
-
return i.forEach((a) => {
|
|
231
|
-
s[a] = !0;
|
|
232
|
-
}), {
|
|
233
|
-
name: n,
|
|
234
|
-
value: e[t],
|
|
235
|
-
modifiers: s
|
|
236
|
-
};
|
|
237
|
-
});
|
|
238
|
-
},
|
|
239
|
-
buildEvents() {
|
|
240
|
-
const e = this.field.events || {}, t = {};
|
|
241
|
-
if (Object.keys(e).forEach((r) => {
|
|
242
|
-
t[r] = (...n) => {
|
|
243
|
-
e[r](...n);
|
|
244
|
-
};
|
|
245
|
-
}), !this.isUpload()) {
|
|
246
|
-
const r = t.input;
|
|
247
|
-
t.input = (n, ...i) => {
|
|
248
|
-
this.$emit("input", n), r && r(n, ...i);
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
return t;
|
|
252
|
-
},
|
|
253
|
-
buildScopedSlots() {
|
|
254
|
-
const e = this.field.slots || {}, t = {};
|
|
255
|
-
return Object.keys(e).forEach((r) => {
|
|
256
|
-
typeof e[r] == "function" && (t[r] = (n) => e[r](n));
|
|
257
|
-
}), t;
|
|
258
|
-
},
|
|
259
|
-
renderOptionNodes(e) {
|
|
260
|
-
const r = (this.field.params || {}).options || [], n = this.getComponent();
|
|
261
|
-
return !Array.isArray(r) || r.length === 0 ? [] : g(n, ["elselect"]) ? r.map(
|
|
262
|
-
(i, s) => e("el-option", {
|
|
263
|
-
key: i.value !== void 0 ? i.value : s,
|
|
264
|
-
props: {
|
|
265
|
-
label: i.label,
|
|
266
|
-
value: i.value,
|
|
267
|
-
disabled: i.disabled
|
|
268
|
-
}
|
|
269
|
-
})
|
|
270
|
-
) : g(n, ["elradiogroup"]) ? r.map(
|
|
271
|
-
(i, s) => e(
|
|
272
|
-
"el-radio",
|
|
273
|
-
{
|
|
274
|
-
key: i.value !== void 0 ? i.value : s,
|
|
275
|
-
props: {
|
|
276
|
-
label: i.value,
|
|
277
|
-
disabled: i.disabled
|
|
278
|
-
}
|
|
279
|
-
},
|
|
280
|
-
[i.label]
|
|
281
|
-
)
|
|
282
|
-
) : g(n, ["elcheckboxgroup"]) ? r.map(
|
|
283
|
-
(i, s) => e(
|
|
284
|
-
"el-checkbox",
|
|
285
|
-
{
|
|
286
|
-
key: i.value !== void 0 ? i.value : s,
|
|
287
|
-
props: {
|
|
288
|
-
label: i.value,
|
|
289
|
-
disabled: i.disabled
|
|
290
|
-
}
|
|
291
|
-
},
|
|
292
|
-
[i.label]
|
|
293
|
-
)
|
|
294
|
-
) : [];
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
render(e) {
|
|
298
|
-
const t = this.getComponent(), r = [], n = this.field.slots || {};
|
|
299
|
-
return Object.keys(n).forEach((i) => {
|
|
300
|
-
typeof n[i] == "function" && r.push(...ie(n[i]({ field: this.field, value: this.value }), i));
|
|
301
|
-
}), e(
|
|
302
|
-
t,
|
|
303
|
-
{
|
|
304
|
-
ref: "control",
|
|
305
|
-
props: this.buildProps(),
|
|
306
|
-
style: this.buildStyle(),
|
|
307
|
-
on: this.buildEvents(),
|
|
308
|
-
directives: this.buildDirectives(),
|
|
309
|
-
scopedSlots: this.buildScopedSlots()
|
|
310
|
-
},
|
|
311
|
-
[...this.renderOptionNodes(e), ...r]
|
|
312
|
-
);
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
function K(e) {
|
|
316
|
-
return Array.isArray(e) || e === 0 || e === "0" ? !0 : !(e === "" || e === null || typeof e > "u" || e === "null" || e === "undefined" || String(e).trim() === "" || String(e).trim() === "undefined");
|
|
317
|
-
}
|
|
318
|
-
function y(e, t, r, n, i, s, a, l) {
|
|
319
|
-
var o = typeof e == "function" ? e.options : e;
|
|
320
|
-
t && (o.render = t, o.staticRenderFns = r, o._compiled = !0), n && (o.functional = !0), s && (o._scopeId = "data-v-" + s);
|
|
321
|
-
var c;
|
|
322
|
-
if (a ? (c = function(d) {
|
|
323
|
-
d = d || // cached call
|
|
324
|
-
this.$vnode && this.$vnode.ssrContext || // stateful
|
|
325
|
-
this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !d && typeof __VUE_SSR_CONTEXT__ < "u" && (d = __VUE_SSR_CONTEXT__), i && i.call(this, d), d && d._registeredComponents && d._registeredComponents.add(a);
|
|
326
|
-
}, o._ssrRegister = c) : i && (c = l ? function() {
|
|
327
|
-
i.call(
|
|
328
|
-
this,
|
|
329
|
-
(o.functional ? this.parent : this).$root.$options.shadowRoot
|
|
330
|
-
);
|
|
331
|
-
} : i), c)
|
|
332
|
-
if (o.functional) {
|
|
333
|
-
o._injectStyles = c;
|
|
334
|
-
var u = o.render;
|
|
335
|
-
o.render = function(x, p) {
|
|
336
|
-
return c.call(p), u(x, p);
|
|
337
|
-
};
|
|
338
|
-
} else {
|
|
339
|
-
var h = o.beforeCreate;
|
|
340
|
-
o.beforeCreate = h ? [].concat(h, c) : [c];
|
|
341
|
-
}
|
|
342
|
-
return {
|
|
343
|
-
exports: e,
|
|
344
|
-
options: o
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
|
-
function f(e) {
|
|
348
|
-
if (e === null || typeof e != "object")
|
|
349
|
-
return e;
|
|
350
|
-
if (Array.isArray(e))
|
|
351
|
-
return e.map((r) => f(r));
|
|
352
|
-
const t = {};
|
|
353
|
-
return Object.keys(e).forEach((r) => {
|
|
354
|
-
t[r] = f(e[r]);
|
|
355
|
-
}), t;
|
|
356
|
-
}
|
|
357
|
-
function v(e) {
|
|
358
|
-
return String(typeof e == "string" ? e : e && e.name ? e.name : "").replace(/-/g, "").toLowerCase();
|
|
359
|
-
}
|
|
360
|
-
const ae = {
|
|
361
|
-
name: "NsForm",
|
|
362
|
-
components: {
|
|
363
|
-
FormFieldRenderer: se
|
|
364
|
-
},
|
|
365
|
-
props: {
|
|
366
|
-
model: {
|
|
367
|
-
type: String,
|
|
368
|
-
default: ""
|
|
369
|
-
},
|
|
370
|
-
readOnly: {
|
|
371
|
-
type: Boolean,
|
|
372
|
-
default: !1
|
|
373
|
-
},
|
|
374
|
-
labelWidth: {
|
|
375
|
-
type: String,
|
|
376
|
-
default: "80px"
|
|
377
|
-
},
|
|
378
|
-
superLabelWidth: {
|
|
379
|
-
type: String,
|
|
380
|
-
default: "30px"
|
|
381
|
-
},
|
|
382
|
-
labelColor: {
|
|
383
|
-
type: String,
|
|
384
|
-
default: "#0A7BFF"
|
|
385
|
-
},
|
|
386
|
-
gapH: {
|
|
387
|
-
type: String,
|
|
388
|
-
default: "10px"
|
|
389
|
-
},
|
|
390
|
-
gapV: {
|
|
391
|
-
type: String,
|
|
392
|
-
default: "10px"
|
|
393
|
-
},
|
|
394
|
-
height: {
|
|
395
|
-
type: String,
|
|
396
|
-
default: "32px"
|
|
397
|
-
},
|
|
398
|
-
rows: {
|
|
399
|
-
type: Array,
|
|
400
|
-
default: () => []
|
|
401
|
-
},
|
|
402
|
-
backgroundColor: {
|
|
403
|
-
type: String,
|
|
404
|
-
default: ""
|
|
405
|
-
},
|
|
406
|
-
valueEmptyTag: {
|
|
407
|
-
type: String,
|
|
408
|
-
default: "--"
|
|
409
|
-
},
|
|
410
|
-
formPropKey: {
|
|
411
|
-
type: String,
|
|
412
|
-
default: "rows"
|
|
413
|
-
},
|
|
414
|
-
hasPoint: {
|
|
415
|
-
type: Boolean,
|
|
416
|
-
default: !1
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
|
-
data() {
|
|
420
|
-
return {
|
|
421
|
-
componentRefs: {}
|
|
422
|
-
};
|
|
423
|
-
},
|
|
424
|
-
computed: {
|
|
425
|
-
formClassList() {
|
|
426
|
-
return {
|
|
427
|
-
"is-vertical": this.model.indexOf("vertical") > -1,
|
|
428
|
-
"is-table": this.model.indexOf("table") > -1,
|
|
429
|
-
"is-readonly": this.readOnly
|
|
430
|
-
};
|
|
431
|
-
},
|
|
432
|
-
wrapperStyle() {
|
|
433
|
-
return {
|
|
434
|
-
"--ns-form-label-width": this.normalizeSize(this.labelWidth),
|
|
435
|
-
"--ns-form-super-label-width": this.normalizeSize(this.superLabelWidth),
|
|
436
|
-
"--ns-form-label-color": this.labelColor,
|
|
437
|
-
"--ns-form-row-gap": this.gapV,
|
|
438
|
-
"--ns-form-col-gap": this.gapH,
|
|
439
|
-
"--ns-form-item-height": this.normalizeSize(this.height),
|
|
440
|
-
"--ns-form-background-color": this.backgroundColor || "#ffffff"
|
|
441
|
-
};
|
|
442
|
-
},
|
|
443
|
-
rowStyle() {
|
|
444
|
-
return {
|
|
445
|
-
marginBottom: this.model.indexOf("table") > -1 ? "0" : this.gapV
|
|
446
|
-
};
|
|
447
|
-
},
|
|
448
|
-
labelStyle() {
|
|
449
|
-
return {
|
|
450
|
-
width: this.normalizeSize(this.labelWidth),
|
|
451
|
-
color: this.labelColor
|
|
452
|
-
};
|
|
453
|
-
},
|
|
454
|
-
groupLabelStyle() {
|
|
455
|
-
return {
|
|
456
|
-
width: this.normalizeSize(this.superLabelWidth),
|
|
457
|
-
color: this.labelColor
|
|
458
|
-
};
|
|
459
|
-
},
|
|
460
|
-
valueStyle() {
|
|
461
|
-
return {
|
|
462
|
-
minHeight: this.normalizeSize(this.height)
|
|
463
|
-
};
|
|
464
|
-
}
|
|
465
|
-
},
|
|
466
|
-
watch: {
|
|
467
|
-
rows: {
|
|
468
|
-
handler(e) {
|
|
469
|
-
this.initializeDefaultValues(e);
|
|
470
|
-
},
|
|
471
|
-
deep: !0,
|
|
472
|
-
immediate: !0
|
|
473
|
-
}
|
|
474
|
-
},
|
|
475
|
-
methods: {
|
|
476
|
-
walkFields(e) {
|
|
477
|
-
(this.rows || []).forEach((t, r) => {
|
|
478
|
-
(t || []).forEach((n, i) => {
|
|
479
|
-
e(n, r, i, null, null), (n.children || []).forEach((s, a) => {
|
|
480
|
-
e(s, r, i, a, n);
|
|
481
|
-
});
|
|
482
|
-
});
|
|
483
|
-
});
|
|
484
|
-
},
|
|
485
|
-
initializeDefaultValues(e) {
|
|
486
|
-
(e || []).forEach((t) => {
|
|
487
|
-
(t || []).forEach((r) => {
|
|
488
|
-
r && r.key && r.defaultValue === void 0 && this.$set(r, "defaultValue", f(r.value)), (r.children || []).forEach((n) => {
|
|
489
|
-
n && n.key && n.defaultValue === void 0 && this.$set(n, "defaultValue", f(n.value));
|
|
490
|
-
});
|
|
491
|
-
});
|
|
492
|
-
});
|
|
493
|
-
},
|
|
494
|
-
normalizeSize(e) {
|
|
495
|
-
return e == null || e === "" ? "" : /^\d+$/.test(String(e)) ? `${e}px` : String(e);
|
|
496
|
-
},
|
|
497
|
-
hasChildren(e) {
|
|
498
|
-
return Array.isArray(e.children) && e.children.length > 0;
|
|
499
|
-
},
|
|
500
|
-
getItemStyle(e, t) {
|
|
501
|
-
if (e.span === 0)
|
|
502
|
-
return { display: "none" };
|
|
503
|
-
if (typeof e.span == "string" && e.span.indexOf("%") > -1)
|
|
504
|
-
return {
|
|
505
|
-
flex: `0 0 ${e.span}`,
|
|
506
|
-
maxWidth: e.span
|
|
507
|
-
};
|
|
508
|
-
if (e.span !== void 0 && e.span !== null && e.span !== "") {
|
|
509
|
-
const i = Number(e.span);
|
|
510
|
-
if (!Number.isNaN(i)) {
|
|
511
|
-
const s = i > 24 ? `${i}px` : `${i / 24 * 100}%`;
|
|
512
|
-
return {
|
|
513
|
-
flex: `0 0 ${s}`,
|
|
514
|
-
maxWidth: s
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
const n = `calc(${100 / ((t || []).filter((i) => i && i.span !== 0).length || 1)}% - ${this.gapH})`;
|
|
519
|
-
return {
|
|
520
|
-
flex: `0 0 ${n}`,
|
|
521
|
-
maxWidth: n
|
|
522
|
-
};
|
|
523
|
-
},
|
|
524
|
-
getFieldRules(e) {
|
|
525
|
-
return this.readOnly ? [] : e.params && e.params.rules || [];
|
|
526
|
-
},
|
|
527
|
-
isRequiredField(e) {
|
|
528
|
-
return !e || this.readOnly ? !1 : typeof e.required == "boolean" ? e.required : this.getFieldRules(e).some((t) => t && t.required);
|
|
529
|
-
},
|
|
530
|
-
getFieldRequired(e) {
|
|
531
|
-
return !e || this.readOnly ? !1 : e && typeof e.required == "boolean" ? e.required : void 0;
|
|
532
|
-
},
|
|
533
|
-
updateFieldValue(e, t) {
|
|
534
|
-
this.$set(e, "value", t);
|
|
535
|
-
},
|
|
536
|
-
setComponentRef(e, t) {
|
|
537
|
-
!e || !e.key || (this.$set(e, "ref", t), this.$set(this.componentRefs, e.key, t));
|
|
538
|
-
},
|
|
539
|
-
showReadOnlyText(e) {
|
|
540
|
-
return this.readOnly && !(e && e.readOnlyUseComponent);
|
|
541
|
-
},
|
|
542
|
-
normalizeDisplayValue(e, t) {
|
|
543
|
-
return K(e) ? Array.isArray(e) ? e.join(",") : e : t && t.valueEmptyTag || this.valueEmptyTag;
|
|
544
|
-
},
|
|
545
|
-
getReadOnlyDisplayValue(e) {
|
|
546
|
-
var t, r, n;
|
|
547
|
-
return e ? typeof ((t = e.params) == null ? void 0 : t.formatter) == "function" ? e.params.formatter(e.value, e) || this.valueEmptyTag : K(e.value) ? this.isUploadComponent(e) ? (e.value || []).map((i) => i.fileName || i.name || i.filePath).filter(Boolean).join(",") || e.valueEmptyTag || this.valueEmptyTag : this.isSwitchComponent(e) ? e.value ? ((r = e.params) == null ? void 0 : r.activeText) || "是" : ((n = e.params) == null ? void 0 : n.inactiveText) || "否" : this.isSelectLikeComponent(e) ? this.getOptionDisplayText(e) : this.isCascaderComponent(e) ? this.getCascaderDisplayValue(e) : Array.isArray(e.value) ? e.value.join(",") : e.value : e.valueEmptyTag || this.valueEmptyTag : this.valueEmptyTag;
|
|
548
|
-
},
|
|
549
|
-
getOptionDisplayText(e) {
|
|
550
|
-
var s;
|
|
551
|
-
const t = ((s = e.params) == null ? void 0 : s.options) || [], r = e.value;
|
|
552
|
-
return (Array.isArray(r) ? r : typeof r == "string" && r.indexOf(",") > -1 ? r.split(",").filter(Boolean) : [r]).map((a) => {
|
|
553
|
-
const l = t.find((o) => o.value === a);
|
|
554
|
-
return l ? l.label : a;
|
|
555
|
-
}).filter((a) => a != null && a !== "").join(",") || e.valueEmptyTag || this.valueEmptyTag;
|
|
556
|
-
},
|
|
557
|
-
getCascaderDisplayValue(e) {
|
|
558
|
-
var a, l, o, c;
|
|
559
|
-
const t = e.params || {}, r = t.options || [], n = {
|
|
560
|
-
value: ((a = t.props) == null ? void 0 : a.value) || "value",
|
|
561
|
-
label: ((l = t.props) == null ? void 0 : l.label) || "label",
|
|
562
|
-
children: ((o = t.props) == null ? void 0 : o.children) || "children",
|
|
563
|
-
multiple: !!((c = t.props) != null && c.multiple),
|
|
564
|
-
separator: t.separator || " / "
|
|
565
|
-
}, i = (u) => Array.isArray(u) ? u : typeof u == "string" && u.indexOf(",") > -1 ? u.split(",").filter(Boolean) : [u], s = (u) => {
|
|
566
|
-
const h = [];
|
|
567
|
-
let d = r;
|
|
568
|
-
return i(u).forEach((x) => {
|
|
569
|
-
const p = (d || []).find((q) => q[n.value] === x);
|
|
570
|
-
p && (h.push(p[n.label]), d = p[n.children]);
|
|
571
|
-
}), h.join(n.separator);
|
|
572
|
-
};
|
|
573
|
-
return n.multiple && Array.isArray(e.value) && Array.isArray(e.value[0]) ? e.value.map((u) => s(u)).join(",") : s(e.value);
|
|
574
|
-
},
|
|
575
|
-
isSelectLikeComponent(e) {
|
|
576
|
-
return ["elselect", "elradiogroup", "elcheckboxgroup"].includes(v(e.component));
|
|
577
|
-
},
|
|
578
|
-
isSwitchComponent(e) {
|
|
579
|
-
return v(e.component) === "elswitch";
|
|
580
|
-
},
|
|
581
|
-
isCascaderComponent(e) {
|
|
582
|
-
return v(e.component) === "elcascader";
|
|
583
|
-
},
|
|
584
|
-
isUploadComponent(e) {
|
|
585
|
-
return v(e.component) === "elupload";
|
|
586
|
-
},
|
|
587
|
-
getFormNodeByKey(e) {
|
|
588
|
-
for (let t = 0; t < this.rows.length; t += 1) {
|
|
589
|
-
const r = this.rows[t];
|
|
590
|
-
for (let n = 0; n < r.length; n += 1) {
|
|
591
|
-
const i = r[n];
|
|
592
|
-
if (i.key === e)
|
|
593
|
-
return i;
|
|
594
|
-
for (let s = 0; s < (i.children || []).length; s += 1) {
|
|
595
|
-
const a = i.children[s];
|
|
596
|
-
if (a.key === e)
|
|
597
|
-
return a;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
return null;
|
|
602
|
-
},
|
|
603
|
-
getFormNodeRefByKey(e) {
|
|
604
|
-
return this.componentRefs[e] || null;
|
|
605
|
-
},
|
|
606
|
-
getFormKvData() {
|
|
607
|
-
const e = {};
|
|
608
|
-
return this.walkFields((t) => {
|
|
609
|
-
!t || !t.key || (e[t.key] = Array.isArray(t.value) && Array.isArray(t.delValue) ? t.value.concat(t.delValue) : t.value);
|
|
610
|
-
}), e;
|
|
611
|
-
},
|
|
612
|
-
resetForm(e = !1) {
|
|
613
|
-
this.walkFields((t) => {
|
|
614
|
-
var i, s;
|
|
615
|
-
if (!t || !t.key)
|
|
616
|
-
return;
|
|
617
|
-
const r = f(t.value), n = t.defaultValue !== void 0 ? f(t.defaultValue) : Array.isArray(t.value) ? [] : typeof t.value == "boolean" ? !1 : typeof t.value == "number" ? 0 : "";
|
|
618
|
-
this.$set(t, "value", n), t.delValue !== void 0 && this.$set(t, "delValue", []), t.params && Array.isArray(t.params.fileList) && t.params.fileList.splice(0, t.params.fileList.length), e && JSON.stringify(r) !== JSON.stringify(n) && (typeof ((i = t.events) == null ? void 0 : i.change) == "function" && this.$nextTick(() => t.events.change(n)), typeof ((s = t.events) == null ? void 0 : s.input) == "function" && this.$nextTick(() => t.events.input(n)));
|
|
619
|
-
});
|
|
620
|
-
},
|
|
621
|
-
setFormData(e) {
|
|
622
|
-
!e || typeof e != "object" || this.walkFields((t) => {
|
|
623
|
-
if (!t || !t.key || !Object.prototype.hasOwnProperty.call(e, t.key))
|
|
624
|
-
return;
|
|
625
|
-
let r = f(e[t.key]);
|
|
626
|
-
if (this.isCascaderComponent(t) && typeof r == "string" && r.indexOf(",") > -1 && (r = r.split(",").filter(Boolean)), this.$set(t, "value", r), this.isUploadComponent(t)) {
|
|
627
|
-
const n = Array.isArray(r) ? f(r) : [];
|
|
628
|
-
t.params && this.$set(t.params, "fileList", n);
|
|
629
|
-
}
|
|
630
|
-
});
|
|
631
|
-
},
|
|
632
|
-
initDefaultValues() {
|
|
633
|
-
this.initializeDefaultValues(this.rows);
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
};
|
|
637
|
-
var le = function() {
|
|
638
|
-
var t = this, r = t._self._c;
|
|
639
|
-
return t.rows && t.rows.length ? r("div", { staticClass: "ns-dynamic-form", class: t.formClassList, style: t.wrapperStyle }, t._l(t.rows, function(n, i) {
|
|
640
|
-
return r("div", { key: `row-${i}`, staticClass: "ns-dynamic-form__row", style: t.rowStyle }, t._l(n, function(s, a) {
|
|
641
|
-
return r("div", { key: s.key || `${i}-${a}`, staticClass: "ns-dynamic-form__item", class: { "has-children": t.hasChildren(s) }, style: t.getItemStyle(s, n) }, [t.hasChildren(s) ? [!s.hideLabel && s.label ? r("div", { staticClass: "ns-dynamic-form__group-label", style: t.groupLabelStyle }, [t._v(" " + t._s(s.label) + " ")]) : t._e(), r("div", { staticClass: "ns-dynamic-form__children" }, t._l(s.children, function(l, o) {
|
|
642
|
-
return r("div", { key: l.key || `${i}-${a}-${o}`, staticClass: "ns-dynamic-form__child" }, [!l.hideLabel && l.label ? r("div", { staticClass: "ns-dynamic-form__label", class: { "has-point": t.hasPoint || t.isRequiredField(l) }, style: t.labelStyle }, [t._v(" " + t._s(l.label) + " ")]) : t._e(), r("div", { staticClass: "ns-dynamic-form__value", style: t.valueStyle }, [t.showReadOnlyText(l) ? [r("span", { directives: [{ name: "sline", rawName: "v-sline" }] }, [t._v(t._s(t.getReadOnlyDisplayValue(l)))])] : l.component ? [r("el-form-item", { staticClass: "ns-dynamic-form__form-item", attrs: { "label-width": "0px", prop: `${t.formPropKey}.${i}.${a}.children.${o}.value`, rules: t.getFieldRules(l), required: t.getFieldRequired(l) } }, [r("form-field-renderer", { attrs: { field: l, value: l.value }, on: { input: function(c) {
|
|
643
|
-
return t.updateFieldValue(l, c);
|
|
644
|
-
}, ref: function(c) {
|
|
645
|
-
return t.setComponentRef(l, c);
|
|
646
|
-
} } })], 1)] : [r("span", { directives: [{ name: "sline", rawName: "v-sline" }] }, [t._v(t._s(t.normalizeDisplayValue(l.value, l)))])]], 2)]);
|
|
647
|
-
}), 0)] : [!s.hideLabel && s.label ? r("div", { staticClass: "ns-dynamic-form__label", class: { "has-point": t.hasPoint || t.isRequiredField(s) }, style: t.labelStyle }, [t._v(" " + t._s(s.label) + " ")]) : t._e(), r("div", { staticClass: "ns-dynamic-form__value", style: t.valueStyle }, [t.showReadOnlyText(s) ? [r("span", { directives: [{ name: "sline", rawName: "v-sline" }] }, [t._v(t._s(t.getReadOnlyDisplayValue(s)))])] : s.component ? [r("el-form-item", { staticClass: "ns-dynamic-form__form-item", attrs: { "label-width": "0px", prop: `${t.formPropKey}.${i}.${a}.value`, rules: t.getFieldRules(s), required: t.getFieldRequired(s) } }, [r("form-field-renderer", { attrs: { field: s, value: s.value }, on: { input: function(l) {
|
|
648
|
-
return t.updateFieldValue(s, l);
|
|
649
|
-
}, ref: function(l) {
|
|
650
|
-
return t.setComponentRef(s, l);
|
|
651
|
-
} } })], 1)] : [r("span", { directives: [{ name: "sline", rawName: "v-sline" }] }, [t._v(t._s(t.normalizeDisplayValue(s.value, s)))])]], 2)]], 2);
|
|
652
|
-
}), 0);
|
|
653
|
-
}), 0) : t._e();
|
|
654
|
-
}, oe = [], ue = /* @__PURE__ */ y(
|
|
655
|
-
ae,
|
|
656
|
-
le,
|
|
657
|
-
oe,
|
|
658
|
-
!1,
|
|
659
|
-
null,
|
|
660
|
-
"4efb4504",
|
|
661
|
-
null,
|
|
662
|
-
null
|
|
663
|
-
);
|
|
664
|
-
const _ = ue.exports;
|
|
665
|
-
class S {
|
|
666
|
-
}
|
|
667
|
-
S.VARS = {};
|
|
668
|
-
function ce() {
|
|
669
|
-
if (typeof document > "u" || Object.keys(S.VARS).length > 0)
|
|
670
|
-
return S.VARS;
|
|
671
|
-
const e = {};
|
|
672
|
-
return Array.from(document.styleSheets || []).forEach((t) => {
|
|
673
|
-
let r = [];
|
|
674
|
-
try {
|
|
675
|
-
r = Array.from(t.cssRules || []);
|
|
676
|
-
} catch {
|
|
677
|
-
r = [];
|
|
678
|
-
}
|
|
679
|
-
r.forEach((n) => {
|
|
680
|
-
n.selectorText === ":root" && Array.from(n.style || []).filter((i) => i.indexOf("--matrix-") === 0).forEach((i) => {
|
|
681
|
-
e[i] = n.style.getPropertyValue(i).trim();
|
|
682
|
-
});
|
|
683
|
-
});
|
|
684
|
-
}), S.VARS = e, e;
|
|
685
|
-
}
|
|
686
|
-
const de = {
|
|
687
|
-
name: "NsFormTitle",
|
|
688
|
-
props: {
|
|
689
|
-
title: {
|
|
690
|
-
type: String,
|
|
691
|
-
default: ""
|
|
692
|
-
}
|
|
693
|
-
},
|
|
694
|
-
mounted() {
|
|
695
|
-
ce();
|
|
696
|
-
}
|
|
697
|
-
};
|
|
698
|
-
var he = function() {
|
|
699
|
-
var t = this, r = t._self._c;
|
|
700
|
-
return r("div", { staticClass: "ns-form-title" }, [r("div", { staticClass: "ns-form-title__header" }, [t._t("title", function() {
|
|
701
|
-
return [r("span", { staticClass: "ns-form-title__icon" }), r("span", { staticClass: "ns-form-title__text" }, [t._v(t._s(t.title))])];
|
|
702
|
-
})], 2), r("div", { staticClass: "ns-form-title__content" }, [t._t("default")], 2)]);
|
|
703
|
-
}, fe = [], pe = /* @__PURE__ */ y(
|
|
704
|
-
de,
|
|
705
|
-
he,
|
|
706
|
-
fe,
|
|
707
|
-
!1,
|
|
708
|
-
null,
|
|
709
|
-
"4e159c2c",
|
|
710
|
-
null,
|
|
711
|
-
null
|
|
712
|
-
);
|
|
713
|
-
const k = pe.exports;
|
|
714
|
-
function ge(e) {
|
|
715
|
-
var t;
|
|
716
|
-
return ((t = e == null ? void 0 : e.proxy) == null ? void 0 : t.$ImageBaseUrl) || "";
|
|
717
|
-
}
|
|
718
|
-
function me(e, t, r = "rows") {
|
|
719
|
-
for (let n = 0; n < e.length; n += 1) {
|
|
720
|
-
const i = e[n];
|
|
721
|
-
for (let s = 0; s < i.length; s += 1) {
|
|
722
|
-
const a = i[s];
|
|
723
|
-
if (a.key === t)
|
|
724
|
-
return `${r}.${n}.${s}.value`;
|
|
725
|
-
if (Array.isArray(a.children)) {
|
|
726
|
-
for (let l = 0; l < a.children.length; l += 1)
|
|
727
|
-
if (a.children[l].key === t)
|
|
728
|
-
return `${r}.${n}.${s}.children.${l}.value`;
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
return null;
|
|
733
|
-
}
|
|
734
|
-
function ye(e) {
|
|
735
|
-
const t = X();
|
|
736
|
-
function r(a, l) {
|
|
737
|
-
const o = ge(t), c = Array.isArray(l) ? l : [];
|
|
738
|
-
return c.forEach((u) => {
|
|
739
|
-
u.filePath && !u.url && (u.url = `${o}${u.filePath}`), u.name || (u.name = u.fileName || u.name || u.filePath || "未命名文件");
|
|
740
|
-
}), a && a.params && (a.params.fileList = c), a && (a.value = c.slice()), c;
|
|
741
|
-
}
|
|
742
|
-
function n(a, l, o, c = e.rows) {
|
|
743
|
-
const u = m(c, o);
|
|
744
|
-
if (!u)
|
|
745
|
-
return l;
|
|
746
|
-
const h = (l || []).map((d) => ({
|
|
747
|
-
...d,
|
|
748
|
-
fileName: d.response ? d.response.data.fileName : d.fileName,
|
|
749
|
-
filePath: d.response ? d.response.data.filePath : d.filePath,
|
|
750
|
-
fileSize: d.response ? d.response.data.fileSize : d.fileSize
|
|
751
|
-
}));
|
|
752
|
-
return Array.isArray(u.delValue) || (u.delValue = []), !a.response && a.status === "success" && u.delValue.push({ ...a, isDelete: 1 }), u.value = h, u.params && (u.params.fileList = l || []), l;
|
|
753
|
-
}
|
|
754
|
-
function i(a, l, o, c, u = e.rows) {
|
|
755
|
-
const h = m(u, c);
|
|
756
|
-
return h && (Array.isArray(h.value) || (h.value = []), l && l.status === "success" && a && a.data && h.value.push({ ...a.data }), h.params && (h.params.fileList = o || [])), o;
|
|
757
|
-
}
|
|
758
|
-
function s(a, l, o, c = "rows") {
|
|
759
|
-
const u = m(a, l);
|
|
760
|
-
u && !Array.isArray(u.value) && (u.value = []);
|
|
761
|
-
const h = me(a, l, c);
|
|
762
|
-
Y(() => {
|
|
763
|
-
const d = o && (o.value || o);
|
|
764
|
-
h && d && typeof d.validateField == "function" && d.validateField(h);
|
|
765
|
-
});
|
|
766
|
-
}
|
|
767
|
-
return {
|
|
768
|
-
handleFormatFileList: r,
|
|
769
|
-
handleRemoveFile: n,
|
|
770
|
-
handleFileSuccessFile: i,
|
|
771
|
-
handleCheckFileRequire: s
|
|
772
|
-
};
|
|
773
|
-
}
|
|
774
|
-
function I(e) {
|
|
775
|
-
e.install = function(r) {
|
|
776
|
-
r.component(e.name, e);
|
|
777
|
-
};
|
|
778
|
-
}
|
|
779
|
-
I(_);
|
|
780
|
-
I(k);
|
|
781
|
-
const be = _.install;
|
|
782
|
-
_.install = function(t) {
|
|
783
|
-
O(t), be(t);
|
|
784
|
-
};
|
|
785
|
-
function B(e) {
|
|
786
|
-
const t = {};
|
|
787
|
-
return (e || []).forEach((r) => {
|
|
788
|
-
(r || []).forEach((n) => {
|
|
789
|
-
n && n.key && (t[n.key] = Array.isArray(n.value) && Array.isArray(n.delValue) ? n.value.concat(n.delValue) : n.value), (n.children || []).forEach((i) => {
|
|
790
|
-
i && i.key && (t[i.key] = Array.isArray(i.value) && Array.isArray(i.delValue) ? i.value.concat(i.delValue) : i.value);
|
|
791
|
-
});
|
|
792
|
-
});
|
|
793
|
-
}), t;
|
|
794
|
-
}
|
|
795
|
-
function m(e, t) {
|
|
796
|
-
for (let r = 0; r < (e || []).length; r += 1) {
|
|
797
|
-
const n = e[r] || [];
|
|
798
|
-
for (let i = 0; i < n.length; i += 1) {
|
|
799
|
-
const s = n[i];
|
|
800
|
-
if (s && s.key === t)
|
|
801
|
-
return s;
|
|
802
|
-
const a = s && s.children || [];
|
|
803
|
-
for (let l = 0; l < a.length; l += 1)
|
|
804
|
-
if (a[l] && a[l].key === t)
|
|
805
|
-
return a[l];
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
return null;
|
|
809
|
-
}
|
|
810
|
-
function M(e, t) {
|
|
811
|
-
const r = m(e, t);
|
|
812
|
-
return r && r.ref || null;
|
|
813
|
-
}
|
|
814
|
-
typeof globalThis < "u" && (globalThis.getAllFormKvData = B, globalThis.getAllFormNodeByKey = m, globalThis.getAllFormNodeRefByKey = M);
|
|
815
|
-
const j = {
|
|
816
|
-
name: "NsSlotRenderer",
|
|
817
|
-
functional: !0,
|
|
818
|
-
props: {
|
|
819
|
-
renderer: {
|
|
820
|
-
type: Function,
|
|
821
|
-
default: null
|
|
822
|
-
},
|
|
823
|
-
scope: {
|
|
824
|
-
type: Object,
|
|
825
|
-
default: () => ({})
|
|
826
|
-
}
|
|
827
|
-
},
|
|
828
|
-
render(e, t) {
|
|
829
|
-
const r = t.props.renderer;
|
|
830
|
-
return r ? r(t.props.scope || {}) : null;
|
|
831
|
-
}
|
|
832
|
-
};
|
|
833
|
-
function Se(e) {
|
|
834
|
-
return typeof e != "string" ? e : e.indexOf("-") > -1 ? e.toLowerCase() : e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
835
|
-
}
|
|
836
|
-
const _e = {
|
|
837
|
-
name: "NsSearch",
|
|
838
|
-
components: {
|
|
839
|
-
SlotRenderer: j
|
|
840
|
-
},
|
|
841
|
-
inheritAttrs: !1,
|
|
842
|
-
props: {
|
|
843
|
-
items: {
|
|
844
|
-
type: Array,
|
|
845
|
-
default: () => []
|
|
846
|
-
},
|
|
847
|
-
externalParams: {
|
|
848
|
-
type: Object,
|
|
849
|
-
default: () => ({})
|
|
850
|
-
},
|
|
851
|
-
defaultSpan: {
|
|
852
|
-
type: Number,
|
|
853
|
-
default: 6
|
|
854
|
-
},
|
|
855
|
-
showCollapse: {
|
|
856
|
-
type: Boolean,
|
|
857
|
-
default: !0
|
|
858
|
-
},
|
|
859
|
-
collapseLimit: {
|
|
860
|
-
type: Number,
|
|
861
|
-
default: 3
|
|
862
|
-
},
|
|
863
|
-
slotRenderers: {
|
|
864
|
-
type: Object,
|
|
865
|
-
default: () => ({})
|
|
866
|
-
}
|
|
867
|
-
},
|
|
868
|
-
data() {
|
|
869
|
-
return {
|
|
870
|
-
formData: {},
|
|
871
|
-
isCollapsed: !0
|
|
872
|
-
};
|
|
873
|
-
},
|
|
874
|
-
computed: {
|
|
875
|
-
visibleItems() {
|
|
876
|
-
return !this.showCollapse || !this.isCollapsed ? this.items : this.items.slice(0, this.collapseLimit);
|
|
877
|
-
}
|
|
878
|
-
},
|
|
879
|
-
watch: {
|
|
880
|
-
items: {
|
|
881
|
-
handler() {
|
|
882
|
-
this.initFormData();
|
|
883
|
-
},
|
|
884
|
-
deep: !0,
|
|
885
|
-
immediate: !0
|
|
886
|
-
},
|
|
887
|
-
externalParams: {
|
|
888
|
-
handler() {
|
|
889
|
-
this.formData = {
|
|
890
|
-
...this.formData,
|
|
891
|
-
...this.externalParams
|
|
892
|
-
};
|
|
893
|
-
},
|
|
894
|
-
deep: !0,
|
|
895
|
-
immediate: !0
|
|
896
|
-
}
|
|
897
|
-
},
|
|
898
|
-
methods: {
|
|
899
|
-
normalizeComponent(e) {
|
|
900
|
-
return typeof e == "string" ? Se(e) : e;
|
|
901
|
-
},
|
|
902
|
-
initFormData() {
|
|
903
|
-
const e = {};
|
|
904
|
-
(this.items || []).forEach((t) => {
|
|
905
|
-
e[t.prop] = t.defaultValue !== void 0 ? t.defaultValue : void 0;
|
|
906
|
-
}), this.formData = {
|
|
907
|
-
...e,
|
|
908
|
-
...this.externalParams
|
|
909
|
-
};
|
|
910
|
-
},
|
|
911
|
-
isSlotItem(e) {
|
|
912
|
-
return e && (e.type === "slot" || e.slot === !0 || typeof e.slot == "string");
|
|
913
|
-
},
|
|
914
|
-
getSlotRenderer(e) {
|
|
915
|
-
const t = typeof e.slot == "string" ? e.slot : e.slotName || e.prop;
|
|
916
|
-
return this.slotRenderers[t] || null;
|
|
917
|
-
},
|
|
918
|
-
isSelectComponent(e) {
|
|
919
|
-
return String(this.normalizeComponent(e.component || "") || "") === "el-select";
|
|
920
|
-
},
|
|
921
|
-
handleSearch() {
|
|
922
|
-
this.$emit("search", { ...this.formData, _resetPage: !0 });
|
|
923
|
-
},
|
|
924
|
-
handleReset() {
|
|
925
|
-
const e = {};
|
|
926
|
-
(this.items || []).forEach((t) => {
|
|
927
|
-
e[t.prop] = t.defaultValue !== void 0 ? t.defaultValue : void 0;
|
|
928
|
-
}), this.formData = {
|
|
929
|
-
...e,
|
|
930
|
-
...this.externalParams
|
|
931
|
-
}, this.$emit("search", { ...this.formData, _resetPage: !0 }), this.$emit("reset");
|
|
932
|
-
},
|
|
933
|
-
toggleCollapse() {
|
|
934
|
-
this.isCollapsed = !this.isCollapsed;
|
|
935
|
-
},
|
|
936
|
-
getFormData() {
|
|
937
|
-
return { ...this.formData };
|
|
938
|
-
},
|
|
939
|
-
setFormData(e) {
|
|
940
|
-
this.formData = {
|
|
941
|
-
...this.formData,
|
|
942
|
-
...e || {}
|
|
943
|
-
};
|
|
944
|
-
},
|
|
945
|
-
resetForm() {
|
|
946
|
-
this.handleReset();
|
|
947
|
-
},
|
|
948
|
-
validate() {
|
|
949
|
-
return this.$refs.formRef && this.$refs.formRef.validate ? this.$refs.formRef.validate() : Promise.resolve(!0);
|
|
950
|
-
},
|
|
951
|
-
clearValidate(e) {
|
|
952
|
-
this.$refs.formRef && this.$refs.formRef.clearValidate && this.$refs.formRef.clearValidate(e);
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
};
|
|
956
|
-
var ve = function() {
|
|
957
|
-
var t = this, r = t._self._c;
|
|
958
|
-
return r("div", { staticClass: "page-search" }, [r("el-form", t._b({ ref: "formRef", staticClass: "page-search__form", attrs: { inline: !0, model: t.formData } }, "el-form", t.$attrs, !1), [r("el-row", { attrs: { gutter: 16 } }, [t._l(t.visibleItems, function(n, i) {
|
|
959
|
-
return r("el-col", { key: n.prop || i, attrs: { span: n.span || t.defaultSpan } }, [r("el-form-item", t._b({ attrs: { label: n.label, prop: n.prop } }, "el-form-item", n.formItemAttrs || {}, !1), [t.isSlotItem(n) ? r("slot-renderer", { attrs: { renderer: t.getSlotRenderer(n), scope: { formData: t.formData, item: n } } }) : r(t.normalizeComponent(n.component || "el-input"), t._g(t._b({ tag: "component", model: { value: t.formData[n.prop], callback: function(s) {
|
|
960
|
-
t.$set(t.formData, n.prop, s);
|
|
961
|
-
}, expression: "formData[item.prop]" } }, "component", n.attrs || {}, !1), n.events || {}), [t.isSelectComponent(n) ? t._l(n.children || [], function(s, a) {
|
|
962
|
-
return r("el-option", { key: s.value !== void 0 ? s.value : a, attrs: { label: s.label, value: s.value, disabled: s.disabled } });
|
|
963
|
-
}) : t._e()], 2)], 1)], 1);
|
|
964
|
-
}), r("el-col", { staticClass: "page-search__actions", attrs: { span: t.defaultSpan } }, [r("el-form-item", { attrs: { "label-width": "0" } }, [r("el-button", { attrs: { type: "primary" }, on: { click: t.handleSearch } }, [t._v("查询")]), r("el-button", { on: { click: t.handleReset } }, [t._v("重置")]), t.showCollapse && t.items.length > t.collapseLimit ? r("el-button", { attrs: { type: "text" }, on: { click: t.toggleCollapse } }, [t._v(" " + t._s(t.isCollapsed ? "展开" : "收起") + " ")]) : t._e()], 1)], 1)], 2)], 1)], 1);
|
|
965
|
-
}, $e = [], Ce = /* @__PURE__ */ y(
|
|
966
|
-
_e,
|
|
967
|
-
ve,
|
|
968
|
-
$e,
|
|
969
|
-
!1,
|
|
970
|
-
null,
|
|
971
|
-
"9eea70d9",
|
|
972
|
-
null,
|
|
973
|
-
null
|
|
974
|
-
);
|
|
975
|
-
const R = Ce.exports, Re = [
|
|
976
|
-
"children",
|
|
977
|
-
"slot",
|
|
978
|
-
"headerSlot",
|
|
979
|
-
"buttons",
|
|
980
|
-
"enum",
|
|
981
|
-
"type",
|
|
982
|
-
"imageWidth",
|
|
983
|
-
"imageHeight",
|
|
984
|
-
"linkText"
|
|
985
|
-
], H = {
|
|
986
|
-
name: "NsTableColumn",
|
|
987
|
-
props: {
|
|
988
|
-
column: {
|
|
989
|
-
type: Object,
|
|
990
|
-
required: !0
|
|
991
|
-
},
|
|
992
|
-
slotRenderers: {
|
|
993
|
-
type: Object,
|
|
994
|
-
default: () => ({})
|
|
995
|
-
}
|
|
996
|
-
},
|
|
997
|
-
methods: {
|
|
998
|
-
getColumnProps(e) {
|
|
999
|
-
const t = { ...e };
|
|
1000
|
-
return Re.forEach((r) => delete t[r]), t;
|
|
1001
|
-
},
|
|
1002
|
-
getRenderer(e) {
|
|
1003
|
-
return e ? this.slotRenderers[e] : null;
|
|
1004
|
-
},
|
|
1005
|
-
getCellValue(e, t) {
|
|
1006
|
-
return t.prop ? e[t.prop] : void 0;
|
|
1007
|
-
},
|
|
1008
|
-
isVisible(e, t) {
|
|
1009
|
-
return typeof e.show == "function" ? e.show(t) !== !1 : e.show === void 0 ? !0 : !!e.show;
|
|
1010
|
-
},
|
|
1011
|
-
isDisabled(e, t) {
|
|
1012
|
-
return typeof e.disabled == "function" ? !!e.disabled(t) : !!e.disabled;
|
|
1013
|
-
},
|
|
1014
|
-
renderActionButtons(e, t, r) {
|
|
1015
|
-
return (Array.isArray(r.buttons) ? r.buttons : []).filter((i) => this.isVisible(i, t.row)).map((i, s) => {
|
|
1016
|
-
const a = this.getRenderer(i.slot);
|
|
1017
|
-
return a ? a({ ...t, row: t.row, column: r, button: i }) : e(
|
|
1018
|
-
"el-button",
|
|
1019
|
-
{
|
|
1020
|
-
key: i.label || s,
|
|
1021
|
-
props: {
|
|
1022
|
-
size: i.size || "mini",
|
|
1023
|
-
type: i.link ? "text" : i.type || "text",
|
|
1024
|
-
icon: typeof i.icon == "string" ? i.icon : void 0,
|
|
1025
|
-
disabled: this.isDisabled(i, t.row)
|
|
1026
|
-
},
|
|
1027
|
-
on: {
|
|
1028
|
-
click: () => {
|
|
1029
|
-
typeof i.handler == "function" && i.handler(t.row, t.$index), this.$emit("button-click", t.row, r, i);
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
},
|
|
1033
|
-
[i.label]
|
|
1034
|
-
);
|
|
1035
|
-
});
|
|
1036
|
-
},
|
|
1037
|
-
renderTag(e, t, r) {
|
|
1038
|
-
const n = this.getCellValue(t.row, r), i = typeof r.tagType == "function" ? r.tagType(t.row, n) : r.tagType, s = typeof r.formatter == "function" ? r.formatter(t.row, r, n) : this.resolveEnumText(r, n);
|
|
1039
|
-
return e("el-tag", { props: { type: i || "info", size: r.tagSize || "small" } }, [s]);
|
|
1040
|
-
},
|
|
1041
|
-
renderImage(e, t, r) {
|
|
1042
|
-
const n = this.getCellValue(t.row, r);
|
|
1043
|
-
return n ? e("img", {
|
|
1044
|
-
style: {
|
|
1045
|
-
width: r.imageWidth || "40px",
|
|
1046
|
-
height: r.imageHeight || "40px",
|
|
1047
|
-
objectFit: "cover",
|
|
1048
|
-
borderRadius: "4px"
|
|
1049
|
-
},
|
|
1050
|
-
attrs: {
|
|
1051
|
-
src: n,
|
|
1052
|
-
alt: r.label || "image"
|
|
1053
|
-
}
|
|
1054
|
-
}) : "-";
|
|
1055
|
-
},
|
|
1056
|
-
renderLink(e, t, r) {
|
|
1057
|
-
const n = this.getRenderer(r.slot);
|
|
1058
|
-
if (n)
|
|
1059
|
-
return n(t);
|
|
1060
|
-
const i = this.getCellValue(t.row, r);
|
|
1061
|
-
return e(
|
|
1062
|
-
"el-button",
|
|
1063
|
-
{
|
|
1064
|
-
props: {
|
|
1065
|
-
type: "text"
|
|
1066
|
-
},
|
|
1067
|
-
on: {
|
|
1068
|
-
click: () => this.$emit("link-click", t.row, r)
|
|
1069
|
-
}
|
|
1070
|
-
},
|
|
1071
|
-
[r.linkText || i || "-"]
|
|
1072
|
-
);
|
|
1073
|
-
},
|
|
1074
|
-
resolveEnumText(e, t) {
|
|
1075
|
-
const r = e.enum || e.options || [];
|
|
1076
|
-
if (!Array.isArray(r))
|
|
1077
|
-
return t;
|
|
1078
|
-
const n = r.find((i) => i.value === t);
|
|
1079
|
-
return n ? n.label : t;
|
|
1080
|
-
},
|
|
1081
|
-
renderDefaultCell(e, t, r) {
|
|
1082
|
-
const n = this.getRenderer(r.slot);
|
|
1083
|
-
if (n)
|
|
1084
|
-
return n(t);
|
|
1085
|
-
if (r.type === "action")
|
|
1086
|
-
return e("div", { class: "ns-table-column__actions" }, this.renderActionButtons(e, t, r));
|
|
1087
|
-
if (r.type === "tag")
|
|
1088
|
-
return this.renderTag(e, t, r);
|
|
1089
|
-
if (r.type === "image")
|
|
1090
|
-
return this.renderImage(e, t, r);
|
|
1091
|
-
if (r.type === "link")
|
|
1092
|
-
return this.renderLink(e, t, r);
|
|
1093
|
-
const i = this.getCellValue(t.row, r);
|
|
1094
|
-
return typeof r.formatter == "function" ? r.formatter(t.row, r, i) : r.enum ? this.resolveEnumText(r, i) : i == null || i === "" ? "-" : i;
|
|
1095
|
-
},
|
|
1096
|
-
renderColumn(e, t) {
|
|
1097
|
-
const r = Array.isArray(t.children) ? t.children.map(
|
|
1098
|
-
(i, s) => e(H, {
|
|
1099
|
-
key: i.prop || i.label || s,
|
|
1100
|
-
props: {
|
|
1101
|
-
column: i,
|
|
1102
|
-
slotRenderers: this.slotRenderers
|
|
1103
|
-
},
|
|
1104
|
-
on: {
|
|
1105
|
-
"link-click": (...a) => this.$emit("link-click", ...a),
|
|
1106
|
-
"button-click": (...a) => this.$emit("button-click", ...a)
|
|
1107
|
-
}
|
|
1108
|
-
})
|
|
1109
|
-
) : [], n = this.getRenderer(t.headerSlot);
|
|
1110
|
-
return e(
|
|
1111
|
-
"el-table-column",
|
|
1112
|
-
{
|
|
1113
|
-
props: this.getColumnProps(t),
|
|
1114
|
-
scopedSlots: r.length ? n ? { header: n } : void 0 : {
|
|
1115
|
-
default: (i) => this.renderDefaultCell(e, i, t),
|
|
1116
|
-
...n ? { header: n } : {}
|
|
1117
|
-
}
|
|
1118
|
-
},
|
|
1119
|
-
r
|
|
1120
|
-
);
|
|
1121
|
-
}
|
|
1122
|
-
},
|
|
1123
|
-
render(e) {
|
|
1124
|
-
return this.renderColumn(e, this.column);
|
|
1125
|
-
}
|
|
1126
|
-
}, we = H, xe = {
|
|
1127
|
-
total: 0,
|
|
1128
|
-
currentPage: 1,
|
|
1129
|
-
pageSize: 10
|
|
1130
|
-
}, De = {
|
|
1131
|
-
totalKey: "total",
|
|
1132
|
-
currentPageKey: "currentPage",
|
|
1133
|
-
pageSizeKey: "pageSize"
|
|
1134
|
-
};
|
|
1135
|
-
function E(e = {}) {
|
|
1136
|
-
return {
|
|
1137
|
-
...xe,
|
|
1138
|
-
...e
|
|
1139
|
-
};
|
|
1140
|
-
}
|
|
1141
|
-
function Pe(e, t = {}) {
|
|
1142
|
-
const r = {
|
|
1143
|
-
...De,
|
|
1144
|
-
...t
|
|
1145
|
-
};
|
|
1146
|
-
return {
|
|
1147
|
-
[r.totalKey]: e.total,
|
|
1148
|
-
[r.currentPageKey]: e.currentPage,
|
|
1149
|
-
[r.pageSizeKey]: e.pageSize
|
|
1150
|
-
};
|
|
1151
|
-
}
|
|
1152
|
-
function ze(e) {
|
|
1153
|
-
return e.total = 0, e.currentPage = 1, e.pageSize = 10, e;
|
|
1154
|
-
}
|
|
1155
|
-
const Ae = ["add", "selection-change", "sort-change", "row-click", "size-change", "current-change", "link-click"], ke = {
|
|
1156
|
-
name: "NsTable",
|
|
1157
|
-
components: {
|
|
1158
|
-
SlotRenderer: j,
|
|
1159
|
-
TableColumn: we
|
|
1160
|
-
},
|
|
1161
|
-
inheritAttrs: !1,
|
|
1162
|
-
props: {
|
|
1163
|
-
tableData: {
|
|
1164
|
-
type: Array,
|
|
1165
|
-
default: () => []
|
|
1166
|
-
},
|
|
1167
|
-
columns: {
|
|
1168
|
-
type: Array,
|
|
1169
|
-
default: () => []
|
|
1170
|
-
},
|
|
1171
|
-
actionButtons: {
|
|
1172
|
-
type: Array,
|
|
1173
|
-
default: () => []
|
|
1174
|
-
},
|
|
1175
|
-
showAddButton: {
|
|
1176
|
-
type: Boolean,
|
|
1177
|
-
default: !0
|
|
1178
|
-
},
|
|
1179
|
-
addButtonText: {
|
|
1180
|
-
type: String,
|
|
1181
|
-
default: "新增"
|
|
1182
|
-
},
|
|
1183
|
-
showHeaderToolbar: {
|
|
1184
|
-
type: Boolean,
|
|
1185
|
-
default: !0
|
|
1186
|
-
},
|
|
1187
|
-
showSelection: {
|
|
1188
|
-
type: Boolean,
|
|
1189
|
-
default: !1
|
|
1190
|
-
},
|
|
1191
|
-
showIndex: {
|
|
1192
|
-
type: Boolean,
|
|
1193
|
-
default: !1
|
|
1194
|
-
},
|
|
1195
|
-
border: {
|
|
1196
|
-
type: Boolean,
|
|
1197
|
-
default: !0
|
|
1198
|
-
},
|
|
1199
|
-
stripe: {
|
|
1200
|
-
type: Boolean,
|
|
1201
|
-
default: !1
|
|
1202
|
-
},
|
|
1203
|
-
height: {
|
|
1204
|
-
type: [String, Number],
|
|
1205
|
-
default: void 0
|
|
1206
|
-
},
|
|
1207
|
-
maxHeight: {
|
|
1208
|
-
type: [String, Number],
|
|
1209
|
-
default: void 0
|
|
1210
|
-
},
|
|
1211
|
-
rowKey: {
|
|
1212
|
-
type: [String, Function],
|
|
1213
|
-
default: void 0
|
|
1214
|
-
},
|
|
1215
|
-
defaultExpandAll: {
|
|
1216
|
-
type: Boolean,
|
|
1217
|
-
default: !1
|
|
1218
|
-
},
|
|
1219
|
-
highlightCurrentRow: {
|
|
1220
|
-
type: Boolean,
|
|
1221
|
-
default: !1
|
|
1222
|
-
},
|
|
1223
|
-
loading: {
|
|
1224
|
-
type: Boolean,
|
|
1225
|
-
default: !1
|
|
1226
|
-
},
|
|
1227
|
-
showPagination: {
|
|
1228
|
-
type: Boolean,
|
|
1229
|
-
default: !0
|
|
1230
|
-
},
|
|
1231
|
-
total: {
|
|
1232
|
-
type: Number,
|
|
1233
|
-
default: 0
|
|
1234
|
-
},
|
|
1235
|
-
currentPage: {
|
|
1236
|
-
type: Number,
|
|
1237
|
-
default: null
|
|
1238
|
-
},
|
|
1239
|
-
pageSize: {
|
|
1240
|
-
type: Number,
|
|
1241
|
-
default: null
|
|
1242
|
-
},
|
|
1243
|
-
pageSizes: {
|
|
1244
|
-
type: Array,
|
|
1245
|
-
default: () => [10, 20, 50, 100]
|
|
1246
|
-
},
|
|
1247
|
-
paginationLayout: {
|
|
1248
|
-
type: String,
|
|
1249
|
-
default: "total, sizes, prev, pager, next, jumper"
|
|
1250
|
-
},
|
|
1251
|
-
pageNumberKey: {
|
|
1252
|
-
type: String,
|
|
1253
|
-
default: "currentPage"
|
|
1254
|
-
},
|
|
1255
|
-
pageSizeKey: {
|
|
1256
|
-
type: String,
|
|
1257
|
-
default: "pageSize"
|
|
1258
|
-
},
|
|
1259
|
-
pageTotalKey: {
|
|
1260
|
-
type: String,
|
|
1261
|
-
default: "total"
|
|
1262
|
-
},
|
|
1263
|
-
slotRenderers: {
|
|
1264
|
-
type: Object,
|
|
1265
|
-
default: () => ({})
|
|
1266
|
-
}
|
|
1267
|
-
},
|
|
1268
|
-
data() {
|
|
1269
|
-
return {
|
|
1270
|
-
internalPagination: E()
|
|
1271
|
-
};
|
|
1272
|
-
},
|
|
1273
|
-
computed: {
|
|
1274
|
-
currentPageModel() {
|
|
1275
|
-
return this.currentPage === null ? this.internalPagination.currentPage : this.currentPage;
|
|
1276
|
-
},
|
|
1277
|
-
pageSizeModel() {
|
|
1278
|
-
return this.pageSize === null ? this.internalPagination.pageSize : this.pageSize;
|
|
1279
|
-
},
|
|
1280
|
-
mergedAttrs() {
|
|
1281
|
-
return this.$attrs || {};
|
|
1282
|
-
},
|
|
1283
|
-
mergedListeners() {
|
|
1284
|
-
const e = { ...this.$listeners || {} };
|
|
1285
|
-
return Ae.forEach((t) => delete e[t]), e;
|
|
1286
|
-
}
|
|
1287
|
-
},
|
|
1288
|
-
watch: {
|
|
1289
|
-
currentPage: {
|
|
1290
|
-
handler(e) {
|
|
1291
|
-
e !== null && (this.internalPagination.currentPage = e);
|
|
1292
|
-
},
|
|
1293
|
-
immediate: !0
|
|
1294
|
-
},
|
|
1295
|
-
pageSize: {
|
|
1296
|
-
handler(e) {
|
|
1297
|
-
e !== null && (this.internalPagination.pageSize = e);
|
|
1298
|
-
},
|
|
1299
|
-
immediate: !0
|
|
1300
|
-
}
|
|
1301
|
-
},
|
|
1302
|
-
methods: {
|
|
1303
|
-
handleAdd() {
|
|
1304
|
-
this.$emit("add");
|
|
1305
|
-
},
|
|
1306
|
-
handleSelectionChange(e) {
|
|
1307
|
-
this.$emit("selection-change", e);
|
|
1308
|
-
},
|
|
1309
|
-
handleSortChange(e) {
|
|
1310
|
-
this.$emit("sort-change", e);
|
|
1311
|
-
},
|
|
1312
|
-
handleRowClick(e, t, r) {
|
|
1313
|
-
this.$emit("row-click", e, t, r);
|
|
1314
|
-
},
|
|
1315
|
-
handleSizeChange(e) {
|
|
1316
|
-
this.internalPagination.pageSize = e, this.$emit("update:pageSize", e), this.$emit("size-change", e);
|
|
1317
|
-
},
|
|
1318
|
-
handleCurrentChange(e) {
|
|
1319
|
-
this.internalPagination.currentPage = e, this.$emit("update:currentPage", e), this.$emit("current-change", e);
|
|
1320
|
-
},
|
|
1321
|
-
handleLinkClick(e, t) {
|
|
1322
|
-
this.$emit("link-click", e, t);
|
|
1323
|
-
},
|
|
1324
|
-
getIndex(e) {
|
|
1325
|
-
if (!this.showPagination)
|
|
1326
|
-
return e + 1;
|
|
1327
|
-
const t = Number(this.currentPageModel || 1), r = Number(this.pageSizeModel || 10);
|
|
1328
|
-
return (t - 1) * r + e + 1;
|
|
1329
|
-
},
|
|
1330
|
-
getSelectionRows() {
|
|
1331
|
-
return this.$refs.tableRef && this.$refs.tableRef.selection ? this.$refs.tableRef.selection : [];
|
|
1332
|
-
},
|
|
1333
|
-
getSelectionKeys() {
|
|
1334
|
-
const e = this.getSelectionRows();
|
|
1335
|
-
return this.rowKey ? e.map((t) => typeof this.rowKey == "function" ? this.rowKey(t) : t[this.rowKey]) : e;
|
|
1336
|
-
},
|
|
1337
|
-
setSelectionRows(e) {
|
|
1338
|
-
this.$refs.tableRef && (this.$refs.tableRef.clearSelection(), (e || []).forEach((t) => {
|
|
1339
|
-
this.$refs.tableRef.toggleRowSelection(t, !0);
|
|
1340
|
-
}));
|
|
1341
|
-
},
|
|
1342
|
-
setSelectionKeys(e) {
|
|
1343
|
-
!this.$refs.tableRef || !this.rowKey || (this.$refs.tableRef.clearSelection(), (e || []).forEach((t) => {
|
|
1344
|
-
const r = (this.tableData || []).find((n) => (typeof this.rowKey == "function" ? this.rowKey(n) : n[this.rowKey]) === t);
|
|
1345
|
-
r && this.$refs.tableRef.toggleRowSelection(r, !0);
|
|
1346
|
-
}));
|
|
1347
|
-
},
|
|
1348
|
-
isRowSelected(e) {
|
|
1349
|
-
return this.getSelectionRows().includes(e);
|
|
1350
|
-
},
|
|
1351
|
-
isKeySelected(e) {
|
|
1352
|
-
return this.getSelectionKeys().includes(e);
|
|
1353
|
-
},
|
|
1354
|
-
clearSelection() {
|
|
1355
|
-
this.$refs.tableRef && this.$refs.tableRef.clearSelection();
|
|
1356
|
-
},
|
|
1357
|
-
toggleRowSelection(e, t) {
|
|
1358
|
-
this.$refs.tableRef && this.$refs.tableRef.toggleRowSelection(e, t);
|
|
1359
|
-
},
|
|
1360
|
-
toggleAllSelection() {
|
|
1361
|
-
this.$refs.tableRef && this.$refs.tableRef.toggleAllSelection();
|
|
1362
|
-
},
|
|
1363
|
-
selectAll() {
|
|
1364
|
-
this.toggleAllSelection();
|
|
1365
|
-
},
|
|
1366
|
-
clearAllSelection() {
|
|
1367
|
-
this.clearSelection();
|
|
1368
|
-
},
|
|
1369
|
-
clearSort() {
|
|
1370
|
-
this.$refs.tableRef && this.$refs.tableRef.clearSort && this.$refs.tableRef.clearSort();
|
|
1371
|
-
},
|
|
1372
|
-
clearFilter(e) {
|
|
1373
|
-
this.$refs.tableRef && this.$refs.tableRef.clearFilter && this.$refs.tableRef.clearFilter(e);
|
|
1374
|
-
},
|
|
1375
|
-
doLayout() {
|
|
1376
|
-
this.$refs.tableRef && this.$refs.tableRef.doLayout && this.$refs.tableRef.doLayout();
|
|
1377
|
-
},
|
|
1378
|
-
sort(e, t) {
|
|
1379
|
-
this.$refs.tableRef && this.$refs.tableRef.sort && this.$refs.tableRef.sort(e, t);
|
|
1380
|
-
},
|
|
1381
|
-
resetPage() {
|
|
1382
|
-
this.internalPagination.currentPage = 1, this.$emit("update:currentPage", 1);
|
|
1383
|
-
},
|
|
1384
|
-
setPage(e) {
|
|
1385
|
-
this.internalPagination.currentPage = e, this.$emit("update:currentPage", e);
|
|
1386
|
-
},
|
|
1387
|
-
setPageSize(e) {
|
|
1388
|
-
this.internalPagination.pageSize = e, this.$emit("update:pageSize", e);
|
|
1389
|
-
},
|
|
1390
|
-
getPagination() {
|
|
1391
|
-
return {
|
|
1392
|
-
[this.pageTotalKey]: this.total,
|
|
1393
|
-
[this.pageNumberKey]: this.currentPageModel,
|
|
1394
|
-
[this.pageSizeKey]: this.pageSizeModel
|
|
1395
|
-
};
|
|
1396
|
-
},
|
|
1397
|
-
setPagination(e) {
|
|
1398
|
-
e.currentPage !== void 0 && this.setPage(e.currentPage), e.pageSize !== void 0 && this.setPageSize(e.pageSize);
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
};
|
|
1402
|
-
var Ee = function() {
|
|
1403
|
-
var t = this, r = t._self._c;
|
|
1404
|
-
return r("div", { staticClass: "page-table" }, [t.showHeaderToolbar ? r("div", { staticClass: "page-table__header" }, [r("slot-renderer", { attrs: { renderer: t.slotRenderers["header-left"], scope: { tableData: t.tableData } } }), r("div", { staticClass: "page-table__actions" }, [r("slot-renderer", { attrs: { renderer: t.slotRenderers["header-actions"], scope: { tableData: t.tableData } } }), t.showAddButton && !t.slotRenderers["header-actions"] ? r("el-button", { attrs: { type: "primary", size: "small" }, on: { click: t.handleAdd } }, [t._v(" " + t._s(t.addButtonText) + " ")]) : t._e()], 1)], 1) : t._e(), r("el-table", t._g(t._b({ directives: [{ name: "loading", rawName: "v-loading", value: t.loading, expression: "loading" }], ref: "tableRef", attrs: { data: t.tableData, border: t.border, stripe: t.stripe, height: t.height, "max-height": t.maxHeight, "row-key": t.rowKey, "default-expand-all": t.defaultExpandAll, "highlight-current-row": t.highlightCurrentRow }, on: { "selection-change": t.handleSelectionChange, "sort-change": t.handleSortChange, "row-click": t.handleRowClick } }, "el-table", t.mergedAttrs, !1), t.mergedListeners), [t.showSelection ? r("el-table-column", { attrs: { type: "selection", width: "55", "reserve-selection": !!t.rowKey } }) : t._e(), t.showIndex ? r("el-table-column", { attrs: { type: "index", label: "序号", width: "60", index: t.getIndex } }) : t._e(), t._l(t.columns, function(n, i) {
|
|
1405
|
-
return r("table-column", { key: n.prop || n.label || i, attrs: { column: n, "slot-renderers": t.slotRenderers }, on: { "link-click": t.handleLinkClick } });
|
|
1406
|
-
}), r("template", { slot: "empty" }, [t.slotRenderers.empty ? r("slot-renderer", { attrs: { renderer: t.slotRenderers.empty, scope: { tableData: t.tableData } } }) : r("div", { staticClass: "page-table__empty" }, [t._v("暂无数据")])], 1)], 2), t.showPagination ? r("div", { staticClass: "page-table__pagination" }, [r("el-pagination", { attrs: { background: "", "current-page": t.currentPageModel, "page-size": t.pageSizeModel, "page-sizes": t.pageSizes, total: t.total, layout: t.paginationLayout }, on: { "size-change": t.handleSizeChange, "current-change": t.handleCurrentChange } })], 1) : t._e()], 1);
|
|
1407
|
-
}, Ne = [], Ke = /* @__PURE__ */ y(
|
|
1408
|
-
ke,
|
|
1409
|
-
Ee,
|
|
1410
|
-
Ne,
|
|
1411
|
-
!1,
|
|
1412
|
-
null,
|
|
1413
|
-
"e9b089a2",
|
|
1414
|
-
null,
|
|
1415
|
-
null
|
|
1416
|
-
);
|
|
1417
|
-
const w = Ke.exports;
|
|
1418
|
-
const Fe = {
|
|
1419
|
-
name: "NsTableContainer",
|
|
1420
|
-
components: {
|
|
1421
|
-
PageSearch: R,
|
|
1422
|
-
PageTable: w
|
|
1423
|
-
},
|
|
1424
|
-
props: {
|
|
1425
|
-
showSearch: {
|
|
1426
|
-
type: Boolean,
|
|
1427
|
-
default: !0
|
|
1428
|
-
},
|
|
1429
|
-
externalSearchParams: {
|
|
1430
|
-
type: Object,
|
|
1431
|
-
default: () => ({})
|
|
1432
|
-
},
|
|
1433
|
-
searchItems: {
|
|
1434
|
-
type: Array,
|
|
1435
|
-
default: () => []
|
|
1436
|
-
},
|
|
1437
|
-
tableData: {
|
|
1438
|
-
type: Array,
|
|
1439
|
-
default: () => []
|
|
1440
|
-
},
|
|
1441
|
-
columns: {
|
|
1442
|
-
type: Array,
|
|
1443
|
-
default: () => []
|
|
1444
|
-
},
|
|
1445
|
-
actionButtons: {
|
|
1446
|
-
type: Array,
|
|
1447
|
-
default: () => []
|
|
1448
|
-
},
|
|
1449
|
-
total: {
|
|
1450
|
-
type: Number,
|
|
1451
|
-
default: 0
|
|
1452
|
-
},
|
|
1453
|
-
currentPage: {
|
|
1454
|
-
type: Number,
|
|
1455
|
-
default: null
|
|
1456
|
-
},
|
|
1457
|
-
pageSize: {
|
|
1458
|
-
type: Number,
|
|
1459
|
-
default: null
|
|
1460
|
-
},
|
|
1461
|
-
pageNumberKey: {
|
|
1462
|
-
type: String,
|
|
1463
|
-
default: "currentPage"
|
|
1464
|
-
},
|
|
1465
|
-
pageSizeKey: {
|
|
1466
|
-
type: String,
|
|
1467
|
-
default: "pageSize"
|
|
1468
|
-
},
|
|
1469
|
-
pageTotalKey: {
|
|
1470
|
-
type: String,
|
|
1471
|
-
default: "total"
|
|
1472
|
-
},
|
|
1473
|
-
searchProps: {
|
|
1474
|
-
type: Object,
|
|
1475
|
-
default: () => ({})
|
|
1476
|
-
},
|
|
1477
|
-
tableProps: {
|
|
1478
|
-
type: Object,
|
|
1479
|
-
default: () => ({})
|
|
1480
|
-
},
|
|
1481
|
-
loadData: {
|
|
1482
|
-
type: Function,
|
|
1483
|
-
default: null
|
|
1484
|
-
}
|
|
1485
|
-
},
|
|
1486
|
-
data() {
|
|
1487
|
-
return {
|
|
1488
|
-
internalPagination: E(),
|
|
1489
|
-
pendingSelectionKeys: /* @__PURE__ */ new Set(),
|
|
1490
|
-
selectionRowMap: {},
|
|
1491
|
-
isSyncingSelection: !1
|
|
1492
|
-
};
|
|
1493
|
-
},
|
|
1494
|
-
computed: {
|
|
1495
|
-
currentPageModel() {
|
|
1496
|
-
return this.currentPage === null ? this.internalPagination.currentPage : this.currentPage;
|
|
1497
|
-
},
|
|
1498
|
-
pageSizeModel() {
|
|
1499
|
-
return this.pageSize === null ? this.internalPagination.pageSize : this.pageSize;
|
|
1500
|
-
},
|
|
1501
|
-
currentRowKey() {
|
|
1502
|
-
return this.tableProps && this.tableProps.rowKey;
|
|
1503
|
-
}
|
|
1504
|
-
},
|
|
1505
|
-
watch: {
|
|
1506
|
-
currentPage: {
|
|
1507
|
-
handler(e) {
|
|
1508
|
-
e !== null && (this.internalPagination.currentPage = e);
|
|
1509
|
-
},
|
|
1510
|
-
immediate: !0
|
|
1511
|
-
},
|
|
1512
|
-
pageSize: {
|
|
1513
|
-
handler(e) {
|
|
1514
|
-
e !== null && (this.internalPagination.pageSize = e);
|
|
1515
|
-
},
|
|
1516
|
-
immediate: !0
|
|
1517
|
-
},
|
|
1518
|
-
tableData: {
|
|
1519
|
-
handler() {
|
|
1520
|
-
this.$nextTick(() => {
|
|
1521
|
-
this.syncSelectionToCurrentPage();
|
|
1522
|
-
});
|
|
1523
|
-
},
|
|
1524
|
-
deep: !0,
|
|
1525
|
-
immediate: !0
|
|
1526
|
-
}
|
|
1527
|
-
},
|
|
1528
|
-
methods: {
|
|
1529
|
-
getRowKey(e) {
|
|
1530
|
-
return this.currentRowKey ? typeof this.currentRowKey == "function" ? this.currentRowKey(e) : e[this.currentRowKey] : e;
|
|
1531
|
-
},
|
|
1532
|
-
resetSelectionState() {
|
|
1533
|
-
this.pendingSelectionKeys = /* @__PURE__ */ new Set(), this.selectionRowMap = {}, this.$refs.tableRef && this.$refs.tableRef.clearSelection && this.$refs.tableRef.clearSelection();
|
|
1534
|
-
},
|
|
1535
|
-
syncSelectionToCurrentPage() {
|
|
1536
|
-
!this.currentRowKey || !this.$refs.tableRef || (this.isSyncingSelection = !0, this.$refs.tableRef.clearSelection(), (this.tableData || []).forEach((e) => {
|
|
1537
|
-
const t = this.getRowKey(e);
|
|
1538
|
-
this.pendingSelectionKeys.has(t) && (this.$set(this.selectionRowMap, t, e), this.$refs.tableRef.toggleRowSelection(e, !0));
|
|
1539
|
-
}), this.$nextTick(() => {
|
|
1540
|
-
this.isSyncingSelection = !1;
|
|
1541
|
-
}));
|
|
1542
|
-
},
|
|
1543
|
-
handleSearch(e) {
|
|
1544
|
-
if (this.resetSelectionState(), e && e._resetPage) {
|
|
1545
|
-
const { _resetPage: t, ...r } = e;
|
|
1546
|
-
this.internalPagination.currentPage = 1, this.$emit("update:currentPage", 1), this.$emit("search", r);
|
|
1547
|
-
return;
|
|
1548
|
-
}
|
|
1549
|
-
this.$emit("search", e);
|
|
1550
|
-
},
|
|
1551
|
-
handleReset() {
|
|
1552
|
-
this.resetSelectionState(), this.$emit("reset");
|
|
1553
|
-
},
|
|
1554
|
-
handleAdd() {
|
|
1555
|
-
this.$emit("add");
|
|
1556
|
-
},
|
|
1557
|
-
handleSizeChange(e) {
|
|
1558
|
-
this.internalPagination.pageSize = e, this.$emit("update:pageSize", e), this.$emit("size-change", e), this.$emit("page-change", {
|
|
1559
|
-
currentPage: this.currentPageModel,
|
|
1560
|
-
pageSize: e
|
|
1561
|
-
}), this.loadData && this.loadData();
|
|
1562
|
-
},
|
|
1563
|
-
handleCurrentChange(e) {
|
|
1564
|
-
this.internalPagination.currentPage = e, this.$emit("update:currentPage", e), this.$emit("current-change", e), this.$emit("page-change", {
|
|
1565
|
-
currentPage: e,
|
|
1566
|
-
pageSize: this.pageSizeModel
|
|
1567
|
-
}), this.loadData && this.loadData();
|
|
1568
|
-
},
|
|
1569
|
-
handleSelectionChange(e) {
|
|
1570
|
-
if (this.isSyncingSelection)
|
|
1571
|
-
return;
|
|
1572
|
-
if (!this.currentRowKey) {
|
|
1573
|
-
this.$emit("selection-change", e);
|
|
1574
|
-
return;
|
|
1575
|
-
}
|
|
1576
|
-
(this.tableData || []).map((r) => this.getRowKey(r)).forEach((r) => {
|
|
1577
|
-
this.pendingSelectionKeys.delete(r), this.$delete(this.selectionRowMap, r);
|
|
1578
|
-
}), (e || []).forEach((r) => {
|
|
1579
|
-
const n = this.getRowKey(r);
|
|
1580
|
-
this.pendingSelectionKeys.add(n), this.$set(this.selectionRowMap, n, r);
|
|
1581
|
-
}), this.$emit("selection-change", Object.values(this.selectionRowMap));
|
|
1582
|
-
},
|
|
1583
|
-
handleSortChange(e) {
|
|
1584
|
-
this.$emit("sort-change", e);
|
|
1585
|
-
},
|
|
1586
|
-
handleRowClick(e, t, r) {
|
|
1587
|
-
this.$emit("row-click", e, t, r);
|
|
1588
|
-
},
|
|
1589
|
-
handleLinkClick(e, t) {
|
|
1590
|
-
this.$emit("link-click", e, t);
|
|
1591
|
-
},
|
|
1592
|
-
initSearchAndLoad() {
|
|
1593
|
-
this.$nextTick(() => {
|
|
1594
|
-
if (this.showSearch && this.$refs.searchRef) {
|
|
1595
|
-
this.$emit("search", this.$refs.searchRef.getFormData());
|
|
1596
|
-
return;
|
|
1597
|
-
}
|
|
1598
|
-
this.loadData && this.loadData();
|
|
1599
|
-
});
|
|
1600
|
-
},
|
|
1601
|
-
getSearchFormData() {
|
|
1602
|
-
return this.$refs.searchRef ? this.$refs.searchRef.getFormData() : {};
|
|
1603
|
-
},
|
|
1604
|
-
setSearchFormData(e) {
|
|
1605
|
-
this.$refs.searchRef && this.$refs.searchRef.setFormData(e);
|
|
1606
|
-
},
|
|
1607
|
-
resetSearchForm() {
|
|
1608
|
-
this.$refs.searchRef && this.$refs.searchRef.resetForm();
|
|
1609
|
-
},
|
|
1610
|
-
validateSearchForm() {
|
|
1611
|
-
return this.$refs.searchRef ? this.$refs.searchRef.validate() : Promise.resolve(!0);
|
|
1612
|
-
},
|
|
1613
|
-
getPagination() {
|
|
1614
|
-
return {
|
|
1615
|
-
[this.pageTotalKey]: this.total,
|
|
1616
|
-
[this.pageNumberKey]: this.currentPageModel,
|
|
1617
|
-
[this.pageSizeKey]: this.pageSizeModel
|
|
1618
|
-
};
|
|
1619
|
-
},
|
|
1620
|
-
getSelectionRows() {
|
|
1621
|
-
var e, t;
|
|
1622
|
-
return this.currentRowKey ? Object.values(this.selectionRowMap) : ((t = (e = this.$refs.tableRef) == null ? void 0 : e.getSelectionRows) == null ? void 0 : t.call(e)) || [];
|
|
1623
|
-
},
|
|
1624
|
-
getSelectionKeys() {
|
|
1625
|
-
var e, t;
|
|
1626
|
-
return this.currentRowKey ? Array.from(this.pendingSelectionKeys) : ((t = (e = this.$refs.tableRef) == null ? void 0 : e.getSelectionKeys) == null ? void 0 : t.call(e)) || [];
|
|
1627
|
-
},
|
|
1628
|
-
setSelectionRows(e) {
|
|
1629
|
-
if (!this.currentRowKey) {
|
|
1630
|
-
this.$refs.tableRef && this.$refs.tableRef.setSelectionRows(e);
|
|
1631
|
-
return;
|
|
1632
|
-
}
|
|
1633
|
-
this.pendingSelectionKeys = /* @__PURE__ */ new Set(), this.selectionRowMap = {}, (e || []).forEach((t) => {
|
|
1634
|
-
const r = this.getRowKey(t);
|
|
1635
|
-
this.pendingSelectionKeys.add(r), this.$set(this.selectionRowMap, r, t);
|
|
1636
|
-
}), this.syncSelectionToCurrentPage();
|
|
1637
|
-
},
|
|
1638
|
-
setSelectionKeys(e) {
|
|
1639
|
-
if (!this.currentRowKey) {
|
|
1640
|
-
this.$refs.tableRef && this.$refs.tableRef.setSelectionKeys(e);
|
|
1641
|
-
return;
|
|
1642
|
-
}
|
|
1643
|
-
this.pendingSelectionKeys = new Set(e || []), (this.tableData || []).forEach((t) => {
|
|
1644
|
-
const r = this.getRowKey(t);
|
|
1645
|
-
this.pendingSelectionKeys.has(r) && this.$set(this.selectionRowMap, r, t);
|
|
1646
|
-
}), this.syncSelectionToCurrentPage();
|
|
1647
|
-
},
|
|
1648
|
-
clearAllSelection() {
|
|
1649
|
-
this.resetSelectionState();
|
|
1650
|
-
},
|
|
1651
|
-
selectAll() {
|
|
1652
|
-
if (this.$refs.tableRef) {
|
|
1653
|
-
if (!this.currentRowKey) {
|
|
1654
|
-
this.$refs.tableRef.selectAll();
|
|
1655
|
-
return;
|
|
1656
|
-
}
|
|
1657
|
-
(this.tableData || []).forEach((e) => {
|
|
1658
|
-
const t = this.getRowKey(e);
|
|
1659
|
-
this.pendingSelectionKeys.add(t), this.$set(this.selectionRowMap, t, e);
|
|
1660
|
-
}), this.$refs.tableRef.setSelectionRows(this.tableData);
|
|
1661
|
-
}
|
|
1662
|
-
},
|
|
1663
|
-
isRowSelected(e) {
|
|
1664
|
-
var t, r;
|
|
1665
|
-
return this.currentRowKey ? this.pendingSelectionKeys.has(this.getRowKey(e)) : (r = (t = this.$refs.tableRef) == null ? void 0 : t.isRowSelected) == null ? void 0 : r.call(t, e);
|
|
1666
|
-
},
|
|
1667
|
-
isKeySelected(e) {
|
|
1668
|
-
var t, r;
|
|
1669
|
-
return this.currentRowKey ? this.pendingSelectionKeys.has(e) : (r = (t = this.$refs.tableRef) == null ? void 0 : t.isKeySelected) == null ? void 0 : r.call(t, e);
|
|
1670
|
-
}
|
|
1671
|
-
}
|
|
1672
|
-
};
|
|
1673
|
-
var Te = function() {
|
|
1674
|
-
var t = this, r = t._self._c;
|
|
1675
|
-
return r("div", { staticClass: "page-container" }, [t.showSearch ? r("page-search", t._b({ ref: "searchRef", attrs: { items: t.searchItems, "external-params": t.externalSearchParams, "slot-renderers": t.$scopedSlots }, on: { search: t.handleSearch, reset: t.handleReset } }, "page-search", t.searchProps, !1)) : t._e(), r("page-table", t._b({ ref: "tableRef", attrs: { "table-data": t.tableData, columns: t.columns, "action-buttons": t.actionButtons, total: t.total, "current-page": t.currentPageModel, "page-size": t.pageSizeModel, "page-number-key": t.pageNumberKey, "page-size-key": t.pageSizeKey, "page-total-key": t.pageTotalKey, "slot-renderers": t.$scopedSlots }, on: { add: t.handleAdd, "selection-change": t.handleSelectionChange, "sort-change": t.handleSortChange, "row-click": t.handleRowClick, "size-change": t.handleSizeChange, "current-change": t.handleCurrentChange, "link-click": t.handleLinkClick } }, "page-table", t.tableProps, !1))], 1);
|
|
1676
|
-
}, Le = [], Oe = /* @__PURE__ */ y(
|
|
1677
|
-
Fe,
|
|
1678
|
-
Te,
|
|
1679
|
-
Le,
|
|
1680
|
-
!1,
|
|
1681
|
-
null,
|
|
1682
|
-
"400797f6",
|
|
1683
|
-
null,
|
|
1684
|
-
null
|
|
1685
|
-
);
|
|
1686
|
-
const N = Oe.exports;
|
|
1687
|
-
[N, R, w].forEach((e) => {
|
|
1688
|
-
e.install = function(r) {
|
|
1689
|
-
r.component(e.name, e);
|
|
1690
|
-
};
|
|
1691
|
-
});
|
|
1692
|
-
const Ve = {
|
|
1693
|
-
name: "NsDialogComponent",
|
|
1694
|
-
props: {
|
|
1695
|
-
className: {
|
|
1696
|
-
type: String,
|
|
1697
|
-
default: ""
|
|
1698
|
-
},
|
|
1699
|
-
title: {
|
|
1700
|
-
type: String,
|
|
1701
|
-
default: ""
|
|
1702
|
-
},
|
|
1703
|
-
width: {
|
|
1704
|
-
type: [Number, String],
|
|
1705
|
-
default: 500
|
|
1706
|
-
},
|
|
1707
|
-
height: {
|
|
1708
|
-
type: [Number, String],
|
|
1709
|
-
default: ""
|
|
1710
|
-
},
|
|
1711
|
-
modal: {
|
|
1712
|
-
type: Boolean,
|
|
1713
|
-
default: !0
|
|
1714
|
-
},
|
|
1715
|
-
dialogPadding: {
|
|
1716
|
-
type: [Number, String, Array],
|
|
1717
|
-
default: -1
|
|
1718
|
-
},
|
|
1719
|
-
modalColor: {
|
|
1720
|
-
type: String,
|
|
1721
|
-
default: "rgba(0, 0, 0, 0.45)"
|
|
1722
|
-
},
|
|
1723
|
-
closeOnClickModal: {
|
|
1724
|
-
type: Boolean,
|
|
1725
|
-
default: !0
|
|
1726
|
-
},
|
|
1727
|
-
dom: {
|
|
1728
|
-
type: [Object, Function],
|
|
1729
|
-
default: null
|
|
1730
|
-
},
|
|
1731
|
-
option: {
|
|
1732
|
-
type: Object,
|
|
1733
|
-
default: () => ({})
|
|
1734
|
-
},
|
|
1735
|
-
events: {
|
|
1736
|
-
type: Object,
|
|
1737
|
-
default: () => ({})
|
|
1738
|
-
},
|
|
1739
|
-
domCompleted: {
|
|
1740
|
-
type: Function,
|
|
1741
|
-
default: null
|
|
1742
|
-
},
|
|
1743
|
-
headerDom: {
|
|
1744
|
-
type: [Object, Function],
|
|
1745
|
-
default: null
|
|
1746
|
-
},
|
|
1747
|
-
headerOption: {
|
|
1748
|
-
type: Object,
|
|
1749
|
-
default: () => ({})
|
|
1750
|
-
},
|
|
1751
|
-
headerEvents: {
|
|
1752
|
-
type: Object,
|
|
1753
|
-
default: () => ({})
|
|
1754
|
-
},
|
|
1755
|
-
showFooter: {
|
|
1756
|
-
type: Boolean,
|
|
1757
|
-
default: !0
|
|
1758
|
-
},
|
|
1759
|
-
footerDom: {
|
|
1760
|
-
type: [Object, Function],
|
|
1761
|
-
default: null
|
|
1762
|
-
},
|
|
1763
|
-
footerOption: {
|
|
1764
|
-
type: Object,
|
|
1765
|
-
default: () => ({})
|
|
1766
|
-
},
|
|
1767
|
-
footerTitle: {
|
|
1768
|
-
type: Object,
|
|
1769
|
-
default: () => ({
|
|
1770
|
-
close: "取消",
|
|
1771
|
-
confirm: "确定"
|
|
1772
|
-
})
|
|
1773
|
-
},
|
|
1774
|
-
footerEvents: {
|
|
1775
|
-
type: Object,
|
|
1776
|
-
default: () => ({})
|
|
1777
|
-
},
|
|
1778
|
-
immediately: {
|
|
1779
|
-
type: Boolean,
|
|
1780
|
-
default: !1
|
|
1781
|
-
},
|
|
1782
|
-
close: {
|
|
1783
|
-
type: Function,
|
|
1784
|
-
default: null
|
|
1785
|
-
},
|
|
1786
|
-
closed: {
|
|
1787
|
-
type: Function,
|
|
1788
|
-
default: null
|
|
1789
|
-
},
|
|
1790
|
-
draggable: {
|
|
1791
|
-
type: Boolean,
|
|
1792
|
-
default: !1
|
|
1793
|
-
},
|
|
1794
|
-
confirm: {
|
|
1795
|
-
type: Function,
|
|
1796
|
-
default: null
|
|
1797
|
-
},
|
|
1798
|
-
x: {
|
|
1799
|
-
type: [Number, String],
|
|
1800
|
-
default: null
|
|
1801
|
-
},
|
|
1802
|
-
y: {
|
|
1803
|
-
type: [Number, String],
|
|
1804
|
-
default: null
|
|
1805
|
-
},
|
|
1806
|
-
maxSize: {
|
|
1807
|
-
type: Function,
|
|
1808
|
-
default: null
|
|
1809
|
-
},
|
|
1810
|
-
dialogInstance: {
|
|
1811
|
-
type: Object,
|
|
1812
|
-
default: null
|
|
1813
|
-
},
|
|
1814
|
-
containerId: {
|
|
1815
|
-
type: String,
|
|
1816
|
-
default: ""
|
|
1817
|
-
}
|
|
1818
|
-
},
|
|
1819
|
-
data() {
|
|
1820
|
-
return {
|
|
1821
|
-
visible: !1,
|
|
1822
|
-
currentTitle: this.title,
|
|
1823
|
-
currentOption: { ...this.option },
|
|
1824
|
-
currentWidth: this.width,
|
|
1825
|
-
currentHeight: this.height,
|
|
1826
|
-
currentX: this.x,
|
|
1827
|
-
currentY: this.y,
|
|
1828
|
-
footerLoading: !1,
|
|
1829
|
-
isMaximized: !1,
|
|
1830
|
-
originalSize: {
|
|
1831
|
-
width: this.width,
|
|
1832
|
-
height: this.height,
|
|
1833
|
-
x: this.x,
|
|
1834
|
-
y: this.y
|
|
1835
|
-
},
|
|
1836
|
-
dragContext: null,
|
|
1837
|
-
domCompletedCalled: !1
|
|
1838
|
-
};
|
|
1839
|
-
},
|
|
1840
|
-
computed: {
|
|
1841
|
-
normalizedWidth() {
|
|
1842
|
-
return this.normalizeSize(this.currentWidth || this.width || 500);
|
|
1843
|
-
},
|
|
1844
|
-
bodyStyle() {
|
|
1845
|
-
return {
|
|
1846
|
-
padding: this.resolvePadding(),
|
|
1847
|
-
minHeight: this.currentHeight ? this.normalizeSize(this.currentHeight) : "auto",
|
|
1848
|
-
maxHeight: this.currentHeight ? this.normalizeSize(this.currentHeight) : "none",
|
|
1849
|
-
overflow: "auto"
|
|
1850
|
-
};
|
|
1851
|
-
},
|
|
1852
|
-
dialogCustomClass() {
|
|
1853
|
-
return ["ns-dialog-plus", this.className, this.hasAbsolutePosition ? "ns-dialog-plus--absolute" : ""].filter(Boolean).join(" ");
|
|
1854
|
-
},
|
|
1855
|
-
modalClassName() {
|
|
1856
|
-
return `ns-dialog-plus-modal ns-dialog-plus-modal--${this.containerId}`;
|
|
1857
|
-
},
|
|
1858
|
-
resolvedDom() {
|
|
1859
|
-
return this.resolveComponent(this.dom);
|
|
1860
|
-
},
|
|
1861
|
-
resolvedHeaderDom() {
|
|
1862
|
-
return this.resolveComponent(this.headerDom);
|
|
1863
|
-
},
|
|
1864
|
-
resolvedFooterDom() {
|
|
1865
|
-
return this.resolveComponent(this.footerDom);
|
|
1866
|
-
},
|
|
1867
|
-
footerButtonText() {
|
|
1868
|
-
var e, t;
|
|
1869
|
-
return {
|
|
1870
|
-
close: ((e = this.footerTitle) == null ? void 0 : e.close) || "取消",
|
|
1871
|
-
confirm: ((t = this.footerTitle) == null ? void 0 : t.confirm) || "确定"
|
|
1872
|
-
};
|
|
1873
|
-
},
|
|
1874
|
-
showMaximizeButton() {
|
|
1875
|
-
return typeof this.maxSize == "function";
|
|
1876
|
-
},
|
|
1877
|
-
hasAbsolutePosition() {
|
|
1878
|
-
return this.currentX !== null || this.currentY !== null;
|
|
1879
|
-
}
|
|
1880
|
-
},
|
|
1881
|
-
watch: {
|
|
1882
|
-
option: {
|
|
1883
|
-
handler(e) {
|
|
1884
|
-
this.currentOption = { ...e };
|
|
1885
|
-
},
|
|
1886
|
-
deep: !0
|
|
1887
|
-
},
|
|
1888
|
-
title(e) {
|
|
1889
|
-
this.currentTitle = e;
|
|
1890
|
-
},
|
|
1891
|
-
width(e) {
|
|
1892
|
-
this.isMaximized || (this.currentWidth = e);
|
|
1893
|
-
},
|
|
1894
|
-
height(e) {
|
|
1895
|
-
this.isMaximized || (this.currentHeight = e);
|
|
1896
|
-
},
|
|
1897
|
-
x(e) {
|
|
1898
|
-
this.isMaximized || (this.currentX = e);
|
|
1899
|
-
},
|
|
1900
|
-
y(e) {
|
|
1901
|
-
this.isMaximized || (this.currentY = e);
|
|
1902
|
-
},
|
|
1903
|
-
visible() {
|
|
1904
|
-
this.$nextTick(() => {
|
|
1905
|
-
this.applyDialogLayout(), this.syncDialogInstance(), this.triggerDomCompleted();
|
|
1906
|
-
});
|
|
1907
|
-
}
|
|
1908
|
-
},
|
|
1909
|
-
mounted() {
|
|
1910
|
-
V(), this.visible = !0, this.updateModalStyle(), this.syncDialogInstance(), this.$nextTick(() => {
|
|
1911
|
-
this.applyDialogLayout(), this.triggerDomCompleted();
|
|
1912
|
-
}), document.addEventListener("keydown", this.handleKeydown);
|
|
1913
|
-
},
|
|
1914
|
-
updated() {
|
|
1915
|
-
this.syncDialogInstance(), this.triggerDomCompleted(), this.$nextTick(() => {
|
|
1916
|
-
this.applyDialogLayout();
|
|
1917
|
-
});
|
|
1918
|
-
},
|
|
1919
|
-
beforeDestroy() {
|
|
1920
|
-
document.removeEventListener("keydown", this.handleKeydown), this.removeDragListeners(), this.removeModalStyle();
|
|
1921
|
-
},
|
|
1922
|
-
methods: {
|
|
1923
|
-
normalizeSize(e) {
|
|
1924
|
-
return e == null || e === "" ? "" : /^\d+$/.test(String(e)) ? `${e}px` : String(e);
|
|
1925
|
-
},
|
|
1926
|
-
resolvePadding() {
|
|
1927
|
-
return Array.isArray(this.dialogPadding) ? this.dialogPadding.map((e) => this.normalizeSize(e)).join(" ") : this.dialogPadding === -1 || this.dialogPadding === "-1" ? "16px 20px" : this.normalizeSize(this.dialogPadding);
|
|
1928
|
-
},
|
|
1929
|
-
resolveComponent(e) {
|
|
1930
|
-
return e ? e.default ? e.default : typeof e.then == "function" ? () => e : e : null;
|
|
1931
|
-
},
|
|
1932
|
-
mergeEvents(e = {}) {
|
|
1933
|
-
return {
|
|
1934
|
-
...e,
|
|
1935
|
-
close: () => this.closeDialog()
|
|
1936
|
-
};
|
|
1937
|
-
},
|
|
1938
|
-
resolveDialogElement() {
|
|
1939
|
-
return this.$el && this.$el.querySelector ? this.$el.querySelector(".el-dialog") : null;
|
|
1940
|
-
},
|
|
1941
|
-
resolveWrapperElement() {
|
|
1942
|
-
return this.$el && this.$el.querySelector ? this.$el.querySelector(".el-dialog__wrapper") : null;
|
|
1943
|
-
},
|
|
1944
|
-
applyDialogLayout() {
|
|
1945
|
-
const e = this.resolveDialogElement();
|
|
1946
|
-
e && (this.currentHeight ? (e.style.height = this.normalizeSize(this.currentHeight), e.style.display = "flex", e.style.flexDirection = "column") : e.style.height = "", this.hasAbsolutePosition ? (e.style.position = "fixed", e.style.margin = "0", this.currentX !== null && (e.style.left = this.normalizeSize(this.currentX)), this.currentY !== null && (e.style.top = this.normalizeSize(this.currentY))) : (e.style.position = "", e.style.left = "", e.style.top = ""));
|
|
1947
|
-
},
|
|
1948
|
-
updateModalStyle() {
|
|
1949
|
-
if (!this.containerId)
|
|
1950
|
-
return;
|
|
1951
|
-
let e = document.getElementById(`style-${this.containerId}`);
|
|
1952
|
-
e || (e = document.createElement("style"), e.id = `style-${this.containerId}`, document.head.appendChild(e)), e.textContent = `.${this.modalClassName.replace(/ /g, ".")} { background-color: ${this.modalColor} !important; }`;
|
|
1953
|
-
},
|
|
1954
|
-
removeModalStyle() {
|
|
1955
|
-
if (!this.containerId)
|
|
1956
|
-
return;
|
|
1957
|
-
const e = document.getElementById(`style-${this.containerId}`);
|
|
1958
|
-
e && e.parentNode && e.parentNode.removeChild(e);
|
|
1959
|
-
},
|
|
1960
|
-
syncDialogInstance() {
|
|
1961
|
-
this.dialogInstance && (this.dialogInstance.domRef = this.$refs.contentRef || null, this.dialogInstance.updateOption = (e = {}) => {
|
|
1962
|
-
Object.prototype.hasOwnProperty.call(e, "title") && (this.currentTitle = e.title), Object.prototype.hasOwnProperty.call(e, "width") && (this.currentWidth = e.width), Object.prototype.hasOwnProperty.call(e, "height") && (this.currentHeight = e.height), Object.prototype.hasOwnProperty.call(e, "x") && (this.currentX = e.x), Object.prototype.hasOwnProperty.call(e, "y") && (this.currentY = e.y);
|
|
1963
|
-
const t = { ...e };
|
|
1964
|
-
delete t.title, delete t.width, delete t.height, delete t.x, delete t.y, this.currentOption = {
|
|
1965
|
-
...this.currentOption,
|
|
1966
|
-
...t
|
|
1967
|
-
};
|
|
1968
|
-
}, this.dialogInstance.callMethod = (e, ...t) => {
|
|
1969
|
-
const r = this.$refs.contentRef;
|
|
1970
|
-
if (r && typeof r[e] == "function")
|
|
1971
|
-
return r[e](...t);
|
|
1972
|
-
}, this.dialogInstance.close = () => this.closeDialog());
|
|
1973
|
-
},
|
|
1974
|
-
triggerDomCompleted() {
|
|
1975
|
-
this.domCompletedCalled || this.$refs.contentRef && (this.domCompletedCalled = !0, typeof this.domCompleted == "function" && this.domCompleted(this.$refs.contentRef));
|
|
1976
|
-
},
|
|
1977
|
-
toggleMaximize() {
|
|
1978
|
-
if (this.showMaximizeButton) {
|
|
1979
|
-
if (this.isMaximized)
|
|
1980
|
-
this.currentWidth = this.originalSize.width, this.currentHeight = this.originalSize.height, this.currentX = this.originalSize.x, this.currentY = this.originalSize.y, this.isMaximized = !1;
|
|
1981
|
-
else {
|
|
1982
|
-
this.originalSize = {
|
|
1983
|
-
width: this.currentWidth,
|
|
1984
|
-
height: this.currentHeight,
|
|
1985
|
-
x: this.currentX,
|
|
1986
|
-
y: this.currentY
|
|
1987
|
-
};
|
|
1988
|
-
const e = this.maxSize ? this.maxSize() || {} : {};
|
|
1989
|
-
this.currentWidth = e.width || "100vw", this.currentHeight = e.height || "100vh", this.currentX = e.x !== void 0 ? e.x : 0, this.currentY = e.y !== void 0 ? e.y : 0, this.isMaximized = !0;
|
|
1990
|
-
}
|
|
1991
|
-
this.$nextTick(() => this.applyDialogLayout());
|
|
1992
|
-
}
|
|
1993
|
-
},
|
|
1994
|
-
closeDialog() {
|
|
1995
|
-
this.visible = !1;
|
|
1996
|
-
},
|
|
1997
|
-
dealClose() {
|
|
1998
|
-
typeof this.close == "function" && this.close();
|
|
1999
|
-
},
|
|
2000
|
-
dealClosed() {
|
|
2001
|
-
typeof this.closed == "function" && this.closed();
|
|
2002
|
-
},
|
|
2003
|
-
dealConfirm() {
|
|
2004
|
-
if (this.footerLoading = !0, !this.confirm) {
|
|
2005
|
-
this.footerLoading = !1;
|
|
2006
|
-
return;
|
|
2007
|
-
}
|
|
2008
|
-
if (this.immediately) {
|
|
2009
|
-
this.footerLoading = !1, this.visible = !1, this.confirm(null, this.$refs.contentRef);
|
|
2010
|
-
return;
|
|
2011
|
-
}
|
|
2012
|
-
this.confirm(
|
|
2013
|
-
() => {
|
|
2014
|
-
this.footerLoading = !1, this.visible = !1, this.$message && this.$message.success && this.$message.success("操作成功");
|
|
2015
|
-
},
|
|
2016
|
-
this.$refs.contentRef,
|
|
2017
|
-
{
|
|
2018
|
-
value: this.footerLoading,
|
|
2019
|
-
set value(e) {
|
|
2020
|
-
this.footerLoading = e;
|
|
2021
|
-
}
|
|
2022
|
-
}
|
|
2023
|
-
);
|
|
2024
|
-
},
|
|
2025
|
-
handleKeydown(e) {
|
|
2026
|
-
!this.visible || !this.showFooter || e.key === "Enter" && !this.footerDom && (e.preventDefault(), this.dealConfirm());
|
|
2027
|
-
},
|
|
2028
|
-
handleDragStart(e) {
|
|
2029
|
-
if (!this.draggable || this.showMaximizeButton || e.button !== 0)
|
|
2030
|
-
return;
|
|
2031
|
-
const t = this.resolveDialogElement();
|
|
2032
|
-
if (!t)
|
|
2033
|
-
return;
|
|
2034
|
-
const r = t.getBoundingClientRect();
|
|
2035
|
-
this.currentX = r.left, this.currentY = r.top, this.dragContext = {
|
|
2036
|
-
startX: e.clientX,
|
|
2037
|
-
startY: e.clientY,
|
|
2038
|
-
originX: r.left,
|
|
2039
|
-
originY: r.top
|
|
2040
|
-
}, document.addEventListener("mousemove", this.handleDragMove), document.addEventListener("mouseup", this.handleDragEnd);
|
|
2041
|
-
},
|
|
2042
|
-
handleDragMove(e) {
|
|
2043
|
-
if (!this.dragContext)
|
|
2044
|
-
return;
|
|
2045
|
-
const t = e.clientX - this.dragContext.startX, r = e.clientY - this.dragContext.startY;
|
|
2046
|
-
this.currentX = this.dragContext.originX + t, this.currentY = this.dragContext.originY + r, this.applyDialogLayout();
|
|
2047
|
-
},
|
|
2048
|
-
handleDragEnd() {
|
|
2049
|
-
this.removeDragListeners();
|
|
2050
|
-
},
|
|
2051
|
-
removeDragListeners() {
|
|
2052
|
-
document.removeEventListener("mousemove", this.handleDragMove), document.removeEventListener("mouseup", this.handleDragEnd), this.dragContext = null;
|
|
2053
|
-
}
|
|
2054
|
-
}
|
|
2055
|
-
};
|
|
2056
|
-
var Ie = function() {
|
|
2057
|
-
var t = this, r = t._self._c;
|
|
2058
|
-
return r("el-dialog", { attrs: { visible: t.visible, width: t.normalizedWidth, modal: t.modal, "modal-class": t.modalClassName, "show-close": !1, "append-to-body": !1, "close-on-click-modal": t.closeOnClickModal, "custom-class": t.dialogCustomClass }, on: { "update:visible": function(n) {
|
|
2059
|
-
t.visible = n;
|
|
2060
|
-
}, close: t.dealClose, closed: t.dealClosed } }, [r("div", { staticClass: "ns-dialog-plus__header", attrs: { slot: "title" }, on: { mousedown: t.handleDragStart }, slot: "title" }, [r("div", { staticClass: "ns-dialog-plus__title" }, [t.resolvedHeaderDom ? r(t.resolvedHeaderDom, t._g(t._b({ tag: "component" }, "component", t.headerOption, !1), t.mergeEvents(t.headerEvents))) : [t._v(t._s(t.currentTitle))]], 2), r("div", { staticClass: "ns-dialog-plus__actions" }, [t.showMaximizeButton ? r("el-button", { staticClass: "ns-dialog-plus__action-btn", attrs: { type: "text" }, on: { click: function(n) {
|
|
2061
|
-
return n.stopPropagation(), t.toggleMaximize.apply(null, arguments);
|
|
2062
|
-
} } }, [t._v(" " + t._s(t.isMaximized ? "还原" : "最大化") + " ")]) : t._e(), r("el-button", { staticClass: "ns-dialog-plus__action-btn", attrs: { type: "text" }, on: { click: function(n) {
|
|
2063
|
-
return n.stopPropagation(), t.closeDialog.apply(null, arguments);
|
|
2064
|
-
} } }, [t._v("关闭")])], 1)]), r("div", { staticClass: "ns-dialog-plus__body", style: t.bodyStyle }, [r(t.resolvedDom, t._g(t._b({ ref: "contentRef", tag: "component" }, "component", t.currentOption, !1), t.mergeEvents(t.events)))], 1), t.showFooter ? r("div", { staticClass: "ns-dialog-plus__footer", attrs: { slot: "footer" }, slot: "footer" }, [t.resolvedFooterDom ? r(t.resolvedFooterDom, t._g(t._b({ tag: "component" }, "component", t.footerOption, !1), t.mergeEvents(t.footerEvents))) : [r("el-button", { on: { click: t.closeDialog } }, [t._v(t._s(t.footerButtonText.close))]), r("el-button", { attrs: { type: "primary", loading: t.footerLoading }, on: { click: t.dealConfirm } }, [t._v(t._s(t.footerButtonText.confirm))])]], 2) : t._e()]);
|
|
2065
|
-
}, Be = [], Me = /* @__PURE__ */ y(
|
|
2066
|
-
Ve,
|
|
2067
|
-
Ie,
|
|
2068
|
-
Be,
|
|
2069
|
-
!1,
|
|
2070
|
-
null,
|
|
2071
|
-
"4f4f8603",
|
|
2072
|
-
null,
|
|
2073
|
-
null
|
|
2074
|
-
);
|
|
2075
|
-
const je = Me.exports, C = typeof window < "u" ? window.__dialogInstances = window.__dialogInstances || [] : [];
|
|
2076
|
-
let D = F, He = 0;
|
|
2077
|
-
function W(e) {
|
|
2078
|
-
if (e) {
|
|
2079
|
-
if (e.extend) {
|
|
2080
|
-
D = e;
|
|
2081
|
-
return;
|
|
2082
|
-
}
|
|
2083
|
-
e.constructor && e.constructor.extend && (D = e.constructor);
|
|
2084
|
-
}
|
|
2085
|
-
}
|
|
2086
|
-
function We(e) {
|
|
2087
|
-
return typeof document > "u" ? null : document.querySelector(e) || document.body;
|
|
2088
|
-
}
|
|
2089
|
-
function qe(e) {
|
|
2090
|
-
const t = C.findIndex((r) => r.id === e.id);
|
|
2091
|
-
t > -1 && C.splice(t, 1);
|
|
2092
|
-
}
|
|
2093
|
-
function P() {
|
|
2094
|
-
C.slice().forEach((e) => {
|
|
2095
|
-
e && typeof e.close == "function" && e.close();
|
|
2096
|
-
});
|
|
2097
|
-
}
|
|
2098
|
-
function z(e, t = !0, r = "#app") {
|
|
2099
|
-
if (!e || !e.dom)
|
|
2100
|
-
return !1;
|
|
2101
|
-
const n = We(r);
|
|
2102
|
-
if (!n)
|
|
2103
|
-
return !1;
|
|
2104
|
-
const i = e.id || `ns-dialog-${Date.now()}-${He++}`, s = document.createElement("div");
|
|
2105
|
-
s.id = i, n.appendChild(s);
|
|
2106
|
-
const a = {
|
|
2107
|
-
id: i,
|
|
2108
|
-
class: e.class || "",
|
|
2109
|
-
element: s,
|
|
2110
|
-
vm: null,
|
|
2111
|
-
domRef: null,
|
|
2112
|
-
updateOption: () => {
|
|
2113
|
-
},
|
|
2114
|
-
callMethod: () => {
|
|
2115
|
-
},
|
|
2116
|
-
close: () => {
|
|
2117
|
-
}
|
|
2118
|
-
}, l = (D || F).extend(je), o = {
|
|
2119
|
-
...e,
|
|
2120
|
-
className: e.class || "",
|
|
2121
|
-
modal: t,
|
|
2122
|
-
containerId: i,
|
|
2123
|
-
dialogInstance: a,
|
|
2124
|
-
close: () => {
|
|
2125
|
-
typeof e.close == "function" && e.close();
|
|
2126
|
-
},
|
|
2127
|
-
closed: () => {
|
|
2128
|
-
try {
|
|
2129
|
-
typeof e.closed == "function" && e.closed();
|
|
2130
|
-
} finally {
|
|
2131
|
-
a.vm && a.vm.$destroy(), s.parentNode && s.parentNode.removeChild(s), qe(a);
|
|
2132
|
-
}
|
|
2133
|
-
}
|
|
2134
|
-
}, c = new l({ propsData: o });
|
|
2135
|
-
return a.vm = c, a.close = () => {
|
|
2136
|
-
c && typeof c.closeDialog == "function" && c.closeDialog();
|
|
2137
|
-
}, C.push(a), c.$mount(s), a;
|
|
2138
|
-
}
|
|
2139
|
-
const Xe = [_, k, N, R, w];
|
|
2140
|
-
function A(e) {
|
|
2141
|
-
A.installed || (A.installed = !0, O(e), Xe.forEach((t) => {
|
|
2142
|
-
t && t.name && e.component(t.name, t);
|
|
2143
|
-
}), W(e), V(), e && e.prototype && (e.prototype.$NsDialog = z, e.prototype.$closeAllNsDialog = P), typeof window < "u" && (window.NsDialog = z, window.closeAllNsDialog = P));
|
|
2144
|
-
}
|
|
2145
|
-
const Je = {
|
|
2146
|
-
install: A,
|
|
2147
|
-
NsForm: _,
|
|
2148
|
-
NsFormTitle: k,
|
|
2149
|
-
NsTableContainer: N,
|
|
2150
|
-
NsSearch: R,
|
|
2151
|
-
NsTable: w,
|
|
2152
|
-
NsDialog: z,
|
|
2153
|
-
closeAllNsDialog: P,
|
|
2154
|
-
setExternalApp: W,
|
|
2155
|
-
useFileUpload: ye,
|
|
2156
|
-
getAllFormNodeByKey: m,
|
|
2157
|
-
getAllFormKvData: B,
|
|
2158
|
-
getAllFormNodeRefByKey: M,
|
|
2159
|
-
createPagination: E,
|
|
2160
|
-
createPaginationWithCustomKeys: Pe,
|
|
2161
|
-
resetPagination: ze
|
|
2162
|
-
};
|
|
2163
|
-
export {
|
|
2164
|
-
z as NsDialog,
|
|
2165
|
-
_ as NsForm,
|
|
2166
|
-
k as NsFormTitle,
|
|
2167
|
-
R as NsSearch,
|
|
2168
|
-
w as NsTable,
|
|
2169
|
-
N as NsTableContainer,
|
|
2170
|
-
P as closeAllNsDialog,
|
|
2171
|
-
E as createPagination,
|
|
2172
|
-
Pe as createPaginationWithCustomKeys,
|
|
2173
|
-
Je as default,
|
|
2174
|
-
B as getAllFormKvData,
|
|
2175
|
-
m as getAllFormNodeByKey,
|
|
2176
|
-
M as getAllFormNodeRefByKey,
|
|
2177
|
-
A as install,
|
|
2178
|
-
ze as resetPagination,
|
|
2179
|
-
W as setExternalApp,
|
|
2180
|
-
ye as useFileUpload
|
|
2181
|
-
};
|