@me-framework/me-ui-antdv-next 0.0.33 → 0.0.35
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/index.d.ts +7 -1
- package/dist/input-json/index.css +1 -0
- package/dist/input-json/index.d.ts +4 -0
- package/dist/input-json/index.js +208 -0
- package/dist/input-json/index.vue.d.ts +50 -0
- package/dist/input-json/types.d.ts +69 -0
- package/dist/input-number/index.css +1 -0
- package/dist/input-number/index.d.ts +4 -0
- package/dist/input-number/index.js +170 -0
- package/dist/input-number/index.vue.d.ts +44 -0
- package/dist/input-number/types.d.ts +66 -0
- package/dist/input-property/index.css +1 -1
- package/dist/input-property/index.js +547 -468
- package/dist/input-property/index.vue.d.ts +12 -0
- package/dist/input-property/types.d.ts +22 -0
- package/dist/input-radio/index.css +1 -1
- package/dist/input-radio/index.js +70 -33
- package/dist/input-radio/index.vue.d.ts +39 -10
- package/dist/input-radio/types.d.ts +26 -4
- package/dist/me-ui-antdv-next.js +2203 -1632
- package/dist/me-ui-antdv-next.umd.cjs +11 -11
- package/dist/nav/index.vue.d.ts +2 -2
- package/dist/resolver/index.js +4 -1
- package/dist/style.css +1 -1
- package/dist/text/index.css +1 -0
- package/dist/text/index.d.ts +4 -0
- package/dist/text/index.js +98 -0
- package/dist/text/index.vue.d.ts +25 -0
- package/dist/text/types.d.ts +63 -0
- package/dist/tree-menu/index.vue.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import e from "../icon/index.js";
|
|
2
2
|
import t from "../modal/index.js";
|
|
3
|
-
import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as ee, createVNode as c, defineComponent as l, nextTick as u, normalizeClass as d, onMounted as f, openBlock as p, reactive as m, ref as h, resolveComponent as g, unref as _, watch as v, withCtx as y } from "vue";
|
|
4
|
-
import {
|
|
5
|
-
import x from "
|
|
3
|
+
import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as ee, createVNode as c, defineComponent as l, guardReactiveProps as te, nextTick as u, normalizeClass as d, normalizeProps as ne, onMounted as f, openBlock as p, reactive as m, ref as h, resolveComponent as g, resolveDynamicComponent as re, unref as _, watch as v, withCtx as y } from "vue";
|
|
4
|
+
import { message as b } from "antdv-next";
|
|
5
|
+
import { useDraggable as x } from "vue-draggable-plus";
|
|
6
|
+
import S from "dayjs";
|
|
6
7
|
//#region src/components/input-property/types.ts
|
|
7
|
-
var
|
|
8
|
+
var C = [
|
|
8
9
|
{
|
|
9
10
|
label: "字符串",
|
|
10
11
|
value: "string"
|
|
@@ -29,7 +30,7 @@ var S = [
|
|
|
29
30
|
label: "时间",
|
|
30
31
|
value: "time"
|
|
31
32
|
}
|
|
32
|
-
],
|
|
33
|
+
], w = 2, T = "YYYY-MM-DD", E = "HH:mm:ss", ie = [{
|
|
33
34
|
label: "是",
|
|
34
35
|
value: !0
|
|
35
36
|
}, {
|
|
@@ -38,28 +39,28 @@ var S = [
|
|
|
38
39
|
}];
|
|
39
40
|
//#endregion
|
|
40
41
|
//#region src/components/input-property/validate.ts
|
|
41
|
-
function
|
|
42
|
+
function D() {
|
|
42
43
|
return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
43
44
|
}
|
|
44
|
-
var
|
|
45
|
-
function
|
|
45
|
+
var O = /^\d{4}-\d{2}-\d{2}$/, k = /^(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)?$/;
|
|
46
|
+
function A(e) {
|
|
46
47
|
return Math.round((e + 2 ** -52) * 100) / 100;
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
+
function j(e) {
|
|
49
50
|
if (typeof e == "number") return Number.isInteger(e) ? "int" : "float";
|
|
50
51
|
if (typeof e == "boolean") return "boolean";
|
|
51
52
|
if (typeof e == "string") {
|
|
52
|
-
if (
|
|
53
|
-
if (
|
|
53
|
+
if (O.test(e)) return "date";
|
|
54
|
+
if (k.test(e)) return "time";
|
|
54
55
|
}
|
|
55
56
|
return "string";
|
|
56
57
|
}
|
|
57
|
-
function
|
|
58
|
-
return t === "string" ? e == null ? "" : String(e) : t === "boolean" ?
|
|
58
|
+
function ae(e, t) {
|
|
59
|
+
return t === "string" ? e == null ? "" : String(e) : t === "boolean" ? oe(e) : t === "int" || t === "float" ? M(e, t === "float") : F(e, t === "date" ? T : E);
|
|
59
60
|
}
|
|
60
61
|
function M(e, t) {
|
|
61
62
|
if (e == null) return "";
|
|
62
|
-
let n = (e) => t ?
|
|
63
|
+
let n = (e) => t ? A(e) : e;
|
|
63
64
|
if (typeof e == "number") return n(e);
|
|
64
65
|
let r = String(e).trim();
|
|
65
66
|
if (r === "") return "";
|
|
@@ -68,40 +69,40 @@ function M(e, t) {
|
|
|
68
69
|
}
|
|
69
70
|
function N(e, t) {
|
|
70
71
|
if (t === "string") return e;
|
|
71
|
-
if (t === "boolean") return
|
|
72
|
+
if (t === "boolean") return oe(e);
|
|
72
73
|
if (t === "int" || t === "float") return P(e, t === "float");
|
|
73
|
-
let n = t === "date" ?
|
|
74
|
-
return e == null || e === "" ? "" :
|
|
74
|
+
let n = t === "date" ? T : E;
|
|
75
|
+
return e == null || e === "" ? "" : S.isDayjs(e) ? e.format(n) : typeof e == "string" ? e : "";
|
|
75
76
|
}
|
|
76
77
|
function P(e, t) {
|
|
77
78
|
if (e == null) return e;
|
|
78
|
-
let n = (e) => t ?
|
|
79
|
+
let n = (e) => t ? A(e) : e;
|
|
79
80
|
if (typeof e == "number") return n(e);
|
|
80
81
|
let r = String(e).trim();
|
|
81
82
|
if (r === "") return "";
|
|
82
83
|
let i = Number(r);
|
|
83
84
|
return Number.isNaN(i) ? e : n(i);
|
|
84
85
|
}
|
|
85
|
-
function
|
|
86
|
+
function oe(e) {
|
|
86
87
|
if (typeof e == "boolean") return e;
|
|
87
88
|
if (e == null || e === "") return !1;
|
|
88
89
|
if (typeof e == "number") return e !== 0;
|
|
89
90
|
let t = String(e).trim().toLowerCase();
|
|
90
91
|
return t === "true" || t === "1" || t === "yes" || t === "on";
|
|
91
92
|
}
|
|
92
|
-
function
|
|
93
|
+
function F(e, t) {
|
|
93
94
|
if (e == null || e === "") return "";
|
|
94
|
-
if (
|
|
95
|
-
let n =
|
|
95
|
+
if (S.isDayjs(e)) return e.format(t);
|
|
96
|
+
let n = S(e);
|
|
96
97
|
return n.isValid() ? n.format(t) : e;
|
|
97
98
|
}
|
|
98
|
-
function
|
|
99
|
+
function I(e) {
|
|
99
100
|
return e.trim().toLowerCase();
|
|
100
101
|
}
|
|
101
|
-
function
|
|
102
|
+
function se(e) {
|
|
102
103
|
let t = /* @__PURE__ */ new Map(), n = [];
|
|
103
104
|
for (let r of e) {
|
|
104
|
-
let e =
|
|
105
|
+
let e = I(r.key);
|
|
105
106
|
if (e) {
|
|
106
107
|
if (t.has(e)) {
|
|
107
108
|
let i = t.get(e);
|
|
@@ -113,12 +114,12 @@ function ne(e) {
|
|
|
113
114
|
}
|
|
114
115
|
return n;
|
|
115
116
|
}
|
|
116
|
-
function
|
|
117
|
+
function ce(e, t) {
|
|
117
118
|
if (!e) return !1;
|
|
118
|
-
let n =
|
|
119
|
-
return t.some((e) =>
|
|
119
|
+
let n = I(e);
|
|
120
|
+
return t.some((e) => I(e) === n);
|
|
120
121
|
}
|
|
121
|
-
var
|
|
122
|
+
var le = {
|
|
122
123
|
minLength: ["string"],
|
|
123
124
|
maxLength: ["string"],
|
|
124
125
|
pattern: ["string"],
|
|
@@ -134,74 +135,74 @@ var ie = {
|
|
|
134
135
|
"date",
|
|
135
136
|
"time"
|
|
136
137
|
]
|
|
137
|
-
},
|
|
138
|
-
function
|
|
139
|
-
if (
|
|
140
|
-
let n =
|
|
138
|
+
}, ue = ["required", "message"];
|
|
139
|
+
function L(e, t) {
|
|
140
|
+
if (ue.includes(e)) return !0;
|
|
141
|
+
let n = le[e];
|
|
141
142
|
return n ? n.includes(t) : !1;
|
|
142
143
|
}
|
|
143
|
-
function
|
|
144
|
+
function R(e) {
|
|
144
145
|
return typeof e == "number" && Number.isFinite(e);
|
|
145
146
|
}
|
|
146
|
-
function
|
|
147
|
+
function z(e) {
|
|
147
148
|
if (!e) return;
|
|
148
149
|
let t = {};
|
|
149
|
-
return e.required === !0 && (t.required = !0),
|
|
150
|
+
return e.required === !0 && (t.required = !0), R(e.minLength) && (t.minLength = e.minLength), R(e.maxLength) && (t.maxLength = e.maxLength), typeof e.pattern == "string" && e.pattern.trim() !== "" && (t.pattern = e.pattern), (R(e.min) || typeof e.min == "string" && e.min.trim() !== "") && (t.min = e.min), (R(e.max) || typeof e.max == "string" && e.max.trim() !== "") && (t.max = e.max), typeof e.message == "string" && e.message.trim() !== "" && (t.message = e.message), Object.keys(t).length > 0 ? t : void 0;
|
|
150
151
|
}
|
|
151
|
-
function
|
|
152
|
+
function de(e, t) {
|
|
152
153
|
if (!e) return;
|
|
153
154
|
let n = {};
|
|
154
|
-
return e.required === !0 && (n.required = !0), typeof e.message == "string" && e.message.trim() !== "" && (n.message = e.message), t === "string" ? (
|
|
155
|
+
return e.required === !0 && (n.required = !0), typeof e.message == "string" && e.message.trim() !== "" && (n.message = e.message), t === "string" ? (R(e.minLength) && (n.minLength = e.minLength), R(e.maxLength) && (n.maxLength = e.maxLength), typeof e.pattern == "string" && e.pattern.trim() !== "" && (n.pattern = e.pattern)) : (t === "int" || t === "float" || t === "date" || t === "time") && ((R(e.min) || typeof e.min == "string" && e.min.trim() !== "") && (n.min = e.min), (R(e.max) || typeof e.max == "string" && e.max.trim() !== "") && (n.max = e.max)), z(n);
|
|
155
156
|
}
|
|
156
|
-
function
|
|
157
|
+
function B(e, t) {
|
|
157
158
|
return typeof e.message == "string" && e.message.trim() !== "" ? e.message : t;
|
|
158
159
|
}
|
|
159
|
-
function
|
|
160
|
-
let r =
|
|
160
|
+
function V(e, t, n) {
|
|
161
|
+
let r = z(n);
|
|
161
162
|
if (!r) return null;
|
|
162
163
|
let i = e === "" || e == null;
|
|
163
|
-
if (r.required && i) return
|
|
164
|
+
if (r.required && i) return B(r, "不能为空");
|
|
164
165
|
if (t === "string") {
|
|
165
166
|
if (typeof e != "string" || i) return null;
|
|
166
|
-
if (r.minLength != null && e.length < r.minLength) return
|
|
167
|
-
if (r.maxLength != null && e.length > r.maxLength) return
|
|
167
|
+
if (r.minLength != null && e.length < r.minLength) return B(r, `最短长度不能小于 ${r.minLength}`);
|
|
168
|
+
if (r.maxLength != null && e.length > r.maxLength) return B(r, `最大长度不能大于 ${r.maxLength}`);
|
|
168
169
|
if (r.pattern) {
|
|
169
170
|
let t = null;
|
|
170
171
|
try {
|
|
171
172
|
t = new RegExp(r.pattern);
|
|
172
173
|
} catch {}
|
|
173
|
-
if (t && !t.test(e)) return
|
|
174
|
+
if (t && !t.test(e)) return B(r, "格式不正确");
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
177
|
if (t === "int" || t === "float") {
|
|
177
178
|
if (i) return null;
|
|
178
179
|
let t = Number(e);
|
|
179
180
|
if (Number.isNaN(t)) return null;
|
|
180
|
-
if (r.min != null && t < Number(r.min)) return
|
|
181
|
-
if (r.max != null && t > Number(r.max)) return
|
|
181
|
+
if (r.min != null && t < Number(r.min)) return B(r, `不能小于 ${r.min}`);
|
|
182
|
+
if (r.max != null && t > Number(r.max)) return B(r, `不能大于 ${r.max}`);
|
|
182
183
|
}
|
|
183
184
|
if (t === "date" || t === "time") {
|
|
184
185
|
if (i) return null;
|
|
185
186
|
let t = String(e);
|
|
186
|
-
if (r.min != null && t < String(r.min)) return
|
|
187
|
-
if (r.max != null && t > String(r.max)) return
|
|
187
|
+
if (r.min != null && t < String(r.min)) return B(r, `不能早于 ${r.min}`);
|
|
188
|
+
if (r.max != null && t > String(r.max)) return B(r, `不能晚于 ${r.max}`);
|
|
188
189
|
}
|
|
189
190
|
return null;
|
|
190
191
|
}
|
|
191
|
-
function
|
|
192
|
+
function H(e) {
|
|
192
193
|
let t = {};
|
|
193
194
|
for (let n of e) {
|
|
194
195
|
let e = n.key.trim();
|
|
195
196
|
if (!e) continue;
|
|
196
|
-
let r =
|
|
197
|
+
let r = z(n.rules);
|
|
197
198
|
r && (t[e] = r);
|
|
198
199
|
}
|
|
199
200
|
return t;
|
|
200
201
|
}
|
|
201
202
|
function U(e, t, n) {
|
|
202
|
-
return
|
|
203
|
+
return V(e, t, n);
|
|
203
204
|
}
|
|
204
|
-
function
|
|
205
|
+
function fe(e) {
|
|
205
206
|
let t = {};
|
|
206
207
|
for (let n of e) {
|
|
207
208
|
let e = n.key.trim();
|
|
@@ -213,10 +214,10 @@ function ce(e) {
|
|
|
213
214
|
}
|
|
214
215
|
//#endregion
|
|
215
216
|
//#region src/components/input-property/index.vue?vue&type=script&setup=true&lang.ts
|
|
216
|
-
var
|
|
217
|
+
var pe = {
|
|
217
218
|
key: 0,
|
|
218
219
|
class: "me-input-property__actions"
|
|
219
|
-
},
|
|
220
|
+
}, me = {
|
|
220
221
|
key: 0,
|
|
221
222
|
class: "me-input-property__drag",
|
|
222
223
|
title: "拖拽排序"
|
|
@@ -250,25 +251,43 @@ var le = { class: "me-input-property__toolbar" }, ue = {
|
|
|
250
251
|
},
|
|
251
252
|
keyPlaceholder: { default: "请输入 key" },
|
|
252
253
|
valuePlaceholder: { default: "请输入 value" },
|
|
253
|
-
emptyText: { default: "
|
|
254
|
+
emptyText: { default: "暂无属性,点击 + 添加" },
|
|
254
255
|
keyColumnTitle: { default: "属性" },
|
|
255
256
|
valueColumnTitle: { default: "值" },
|
|
256
|
-
rules: {}
|
|
257
|
+
rules: {},
|
|
258
|
+
modalMode: {
|
|
259
|
+
type: Boolean,
|
|
260
|
+
default: !1
|
|
261
|
+
},
|
|
262
|
+
open: {
|
|
263
|
+
type: Boolean,
|
|
264
|
+
default: !1
|
|
265
|
+
},
|
|
266
|
+
title: { default: "属性编辑" },
|
|
267
|
+
modalWidth: { default: 720 },
|
|
268
|
+
okText: { default: "确定" },
|
|
269
|
+
cancelText: { default: "取消" }
|
|
257
270
|
},
|
|
258
|
-
emits: [
|
|
259
|
-
|
|
260
|
-
|
|
271
|
+
emits: [
|
|
272
|
+
"update:modelValue",
|
|
273
|
+
"change",
|
|
274
|
+
"update:open",
|
|
275
|
+
"ok",
|
|
276
|
+
"cancel"
|
|
277
|
+
],
|
|
278
|
+
setup(l, { emit: S }) {
|
|
279
|
+
let w = l, O = S, k = h([]), A = h([]), M = h("object"), P = !1, oe = r(() => {
|
|
261
280
|
let e = [{
|
|
262
|
-
title:
|
|
281
|
+
title: w.keyColumnTitle,
|
|
263
282
|
key: "key",
|
|
264
283
|
dataIndex: "key",
|
|
265
284
|
width: 180
|
|
266
285
|
}, {
|
|
267
|
-
title:
|
|
286
|
+
title: w.valueColumnTitle,
|
|
268
287
|
key: "value",
|
|
269
288
|
dataIndex: "value"
|
|
270
289
|
}];
|
|
271
|
-
return
|
|
290
|
+
return w.showRules && w.validate && e.push({
|
|
272
291
|
title: "校验",
|
|
273
292
|
key: "rules",
|
|
274
293
|
dataIndex: "rules",
|
|
@@ -281,141 +300,185 @@ var le = { class: "me-input-property__toolbar" }, ue = {
|
|
|
281
300
|
width: 72,
|
|
282
301
|
align: "center"
|
|
283
302
|
}), e;
|
|
284
|
-
}),
|
|
285
|
-
function
|
|
303
|
+
}), F = r(() => w.draggable && !w.disabled);
|
|
304
|
+
function I(e) {
|
|
286
305
|
M.value = Array.isArray(e) ? "array" : "object";
|
|
287
306
|
let t = /* @__PURE__ */ new Map();
|
|
288
|
-
for (let e of
|
|
307
|
+
for (let e of k.value) {
|
|
289
308
|
let n = e.key.trim();
|
|
290
309
|
n && t.set(n, e);
|
|
291
310
|
}
|
|
292
|
-
let n = (e) => t.get(e.trim())?.rules ??
|
|
293
|
-
M.value === "array" ?
|
|
294
|
-
let t = String(e[
|
|
311
|
+
let n = (e) => t.get(e.trim())?.rules ?? w.rules?.[e.trim()];
|
|
312
|
+
M.value === "array" ? k.value = e.map((e) => {
|
|
313
|
+
let t = String(e[w.keyField] ?? ""), r = e[w.valueField];
|
|
295
314
|
return {
|
|
296
|
-
id:
|
|
315
|
+
id: D(),
|
|
297
316
|
key: t,
|
|
298
|
-
type:
|
|
317
|
+
type: j(r),
|
|
299
318
|
value: r,
|
|
300
319
|
raw: { ...e },
|
|
301
320
|
rules: n(t)
|
|
302
321
|
};
|
|
303
|
-
}) :
|
|
304
|
-
id:
|
|
322
|
+
}) : k.value = Object.entries(e).map(([e, t]) => ({
|
|
323
|
+
id: D(),
|
|
305
324
|
key: e,
|
|
306
|
-
type:
|
|
325
|
+
type: j(t),
|
|
307
326
|
value: t,
|
|
308
327
|
rules: n(e)
|
|
309
|
-
})),
|
|
328
|
+
})), K();
|
|
310
329
|
}
|
|
311
|
-
function
|
|
330
|
+
function le() {
|
|
312
331
|
let e = {};
|
|
313
|
-
for (let t of
|
|
332
|
+
for (let t of k.value) {
|
|
314
333
|
let n = t.key.trim();
|
|
315
334
|
n && (e[n] = N(t.value, t.type));
|
|
316
335
|
}
|
|
317
336
|
return e;
|
|
318
337
|
}
|
|
319
|
-
function
|
|
338
|
+
function ue() {
|
|
320
339
|
let e = [];
|
|
321
|
-
for (let t of
|
|
340
|
+
for (let t of k.value) {
|
|
322
341
|
let n = t.key.trim();
|
|
323
342
|
if (!n) continue;
|
|
324
343
|
let r = { ...t.raw };
|
|
325
|
-
r[
|
|
344
|
+
r[w.keyField] = n, r[w.valueField] = N(t.value, t.type), e.push(r);
|
|
326
345
|
}
|
|
327
346
|
return e;
|
|
328
347
|
}
|
|
329
|
-
function
|
|
330
|
-
let e = M.value === "array" ?
|
|
331
|
-
P = !0,
|
|
332
|
-
let t =
|
|
333
|
-
duplicatedKeys:
|
|
334
|
-
hasEmptyKey:
|
|
335
|
-
rowRules:
|
|
336
|
-
valueErrors:
|
|
348
|
+
function L() {
|
|
349
|
+
let e = M.value === "array" ? ue() : le();
|
|
350
|
+
P = !0, O("update:modelValue", e);
|
|
351
|
+
let t = w.validate ? {
|
|
352
|
+
duplicatedKeys: A.value,
|
|
353
|
+
hasEmptyKey: k.value.some((e) => !e.key.trim()),
|
|
354
|
+
rowRules: H(k.value),
|
|
355
|
+
valueErrors: fe(k.value)
|
|
337
356
|
} : {
|
|
338
357
|
duplicatedKeys: [],
|
|
339
358
|
hasEmptyKey: !1,
|
|
340
359
|
rowRules: {},
|
|
341
360
|
valueErrors: {}
|
|
342
361
|
};
|
|
343
|
-
|
|
362
|
+
O("change", e, t);
|
|
344
363
|
}
|
|
345
|
-
v(() =>
|
|
364
|
+
v(() => w.modelValue, (e) => {
|
|
346
365
|
if (e) {
|
|
347
366
|
if (P) {
|
|
348
367
|
P = !1;
|
|
349
368
|
return;
|
|
350
369
|
}
|
|
351
|
-
|
|
370
|
+
I(e);
|
|
352
371
|
}
|
|
353
372
|
}, { immediate: !0 });
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
373
|
+
let R = h(!!w.open);
|
|
374
|
+
v(() => w.open, (e) => {
|
|
375
|
+
R.value = !!e;
|
|
376
|
+
});
|
|
377
|
+
let B = r(() => w.modalMode ? {
|
|
378
|
+
open: R.value,
|
|
379
|
+
title: w.title,
|
|
380
|
+
width: w.modalWidth,
|
|
381
|
+
position: "center",
|
|
382
|
+
okText: w.okText,
|
|
383
|
+
cancelText: w.cancelText,
|
|
384
|
+
"onUpdate:open": V,
|
|
385
|
+
onOk: ge,
|
|
386
|
+
onCancel: W
|
|
387
|
+
} : {});
|
|
357
388
|
function V(e) {
|
|
358
|
-
|
|
389
|
+
R.value = e, O("update:open", e);
|
|
359
390
|
}
|
|
360
|
-
function
|
|
361
|
-
|
|
391
|
+
function W() {
|
|
392
|
+
O("cancel");
|
|
362
393
|
}
|
|
363
|
-
function
|
|
364
|
-
|
|
394
|
+
function he() {
|
|
395
|
+
return w.validate ? {
|
|
396
|
+
duplicatedKeys: se(k.value),
|
|
397
|
+
hasEmptyKey: k.value.some((e) => !e.key.trim()),
|
|
398
|
+
rowRules: H(k.value),
|
|
399
|
+
valueErrors: fe(k.value)
|
|
400
|
+
} : {
|
|
401
|
+
duplicatedKeys: [],
|
|
402
|
+
hasEmptyKey: !1,
|
|
403
|
+
rowRules: {},
|
|
404
|
+
valueErrors: {}
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
function ge() {
|
|
408
|
+
let e = he(), t = [];
|
|
409
|
+
e.hasEmptyKey && t.push("存在为空的 key,请补充或删除该属性"), e.duplicatedKeys.length && t.push(`key 重复(忽略大小写):${e.duplicatedKeys.join("、")}`);
|
|
410
|
+
for (let [n, r] of Object.entries(e.valueErrors)) t.push(`${n}:${r}`);
|
|
411
|
+
if (t.length) {
|
|
412
|
+
b.error(`校验未通过:${t.join(";")}`);
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
R.value = !1, O("update:open", !1), O("ok", M.value === "array" ? ue() : le());
|
|
365
416
|
}
|
|
366
|
-
function
|
|
367
|
-
|
|
368
|
-
|
|
417
|
+
function _e(e) {
|
|
418
|
+
K(), L();
|
|
419
|
+
}
|
|
420
|
+
function G(e) {
|
|
421
|
+
K(), L();
|
|
422
|
+
}
|
|
423
|
+
function ve(e, t) {
|
|
424
|
+
e.type !== t && (e.type = t, e.value = ae(e.value, t), e.rules = de(e.rules, t), K(), L());
|
|
425
|
+
}
|
|
426
|
+
function ye(e, t) {
|
|
427
|
+
e.value = t, K(), L();
|
|
428
|
+
}
|
|
429
|
+
function be() {
|
|
430
|
+
k.value = [...k.value, {
|
|
431
|
+
id: D(),
|
|
369
432
|
key: "",
|
|
370
433
|
type: "string",
|
|
371
434
|
value: "",
|
|
372
435
|
raw: {}
|
|
373
|
-
}],
|
|
436
|
+
}], K(), L();
|
|
374
437
|
}
|
|
375
|
-
function
|
|
376
|
-
let t =
|
|
377
|
-
t !== -1 && (
|
|
438
|
+
function xe(e) {
|
|
439
|
+
let t = k.value.indexOf(e);
|
|
440
|
+
t !== -1 && (k.value.splice(t, 1), K(), L());
|
|
378
441
|
}
|
|
379
|
-
function
|
|
380
|
-
|
|
442
|
+
function K() {
|
|
443
|
+
A.value = se(k.value);
|
|
381
444
|
}
|
|
382
|
-
function
|
|
383
|
-
return
|
|
445
|
+
function Se(e) {
|
|
446
|
+
return ce(e, A.value);
|
|
384
447
|
}
|
|
385
|
-
function
|
|
386
|
-
return
|
|
448
|
+
function Ce(e) {
|
|
449
|
+
return w.validate ? e.trim() ? Se(e) ? "Key 不能重复(忽略大小写)" : "" : "Key 不能为空" : "";
|
|
387
450
|
}
|
|
388
|
-
function
|
|
389
|
-
return
|
|
451
|
+
function we(e) {
|
|
452
|
+
return w.validate ? !e.key.trim() || Se(e.key) : !1;
|
|
390
453
|
}
|
|
391
|
-
function
|
|
392
|
-
return
|
|
454
|
+
function Te(e) {
|
|
455
|
+
return w.disabled || !w.validate ? "" : U(e.value, e.type, e.rules) ?? "";
|
|
393
456
|
}
|
|
394
|
-
function
|
|
395
|
-
return !!
|
|
457
|
+
function Ee(e) {
|
|
458
|
+
return !!z(e.rules);
|
|
396
459
|
}
|
|
397
|
-
let q = h(!1), J = h(null),
|
|
460
|
+
let q = h(!1), J = h(null), De = h(), Y = m({}), X = r(() => J.value?.type ?? "string"), Oe = Object.fromEntries(C.map((e) => [e.value, e.label])), ke = r(() => {
|
|
398
461
|
let e = J.value;
|
|
399
|
-
return e ? `校验规则${e.key.trim() ? ` · ${e.key.trim()}` : ""}(${
|
|
462
|
+
return e ? `校验规则${e.key.trim() ? ` · ${e.key.trim()}` : ""}(${Oe[e.type] ?? e.type})` : "校验规则";
|
|
400
463
|
});
|
|
401
|
-
function
|
|
464
|
+
function Ae(e) {
|
|
402
465
|
return e === "int" || e === "float";
|
|
403
466
|
}
|
|
404
|
-
function
|
|
405
|
-
J.value = e, Object.keys(Y).forEach((e) => delete Y[e]), Object.assign(Y,
|
|
467
|
+
function je(e) {
|
|
468
|
+
J.value = e, Object.keys(Y).forEach((e) => delete Y[e]), Object.assign(Y, z(e.rules) ?? {}), q.value = !0;
|
|
406
469
|
}
|
|
407
|
-
function
|
|
408
|
-
J.value &&
|
|
409
|
-
J.value && (J.value.rules =
|
|
470
|
+
function Me() {
|
|
471
|
+
J.value && De.value?.validate().then(() => {
|
|
472
|
+
J.value && (J.value.rules = z(Y), q.value = !1, J.value = null, K(), L());
|
|
410
473
|
}).catch(() => {});
|
|
411
474
|
}
|
|
412
|
-
function
|
|
475
|
+
function Ne() {
|
|
413
476
|
q.value = !1, J.value = null;
|
|
414
477
|
}
|
|
415
|
-
function
|
|
478
|
+
function Pe(e, t) {
|
|
416
479
|
return typeof e == "string" && typeof t == "string" ? e < t ? -1 : +(e > t) : Number(e) - Number(t);
|
|
417
480
|
}
|
|
418
|
-
let
|
|
481
|
+
let Fe = r(() => {
|
|
419
482
|
let e = Y.minLength ?? null, t = Y.maxLength ?? null, n = Y.min ?? null, r = Y.max ?? null;
|
|
420
483
|
return {
|
|
421
484
|
minLength: [{ validator: (e, n) => n != null && t != null && n > t ? Promise.reject(/* @__PURE__ */ Error("最短长度不能大于最大长度")) : Promise.resolve() }],
|
|
@@ -428,30 +491,36 @@ var le = { class: "me-input-property__toolbar" }, ue = {
|
|
|
428
491
|
}
|
|
429
492
|
return Promise.resolve();
|
|
430
493
|
} }],
|
|
431
|
-
min: [{ validator: (e, t) => t != null && r != null &&
|
|
432
|
-
max: [{ validator: (e, t) => t != null && n != null &&
|
|
494
|
+
min: [{ validator: (e, t) => t != null && r != null && Pe(t, r) > 0 ? Promise.reject(/* @__PURE__ */ Error("最小值不能大于最大值")) : Promise.resolve() }],
|
|
495
|
+
max: [{ validator: (e, t) => t != null && n != null && Pe(t, n) < 0 ? Promise.reject(/* @__PURE__ */ Error("最大值不能小于最小值")) : Promise.resolve() }]
|
|
433
496
|
};
|
|
434
497
|
}), Z = h(null), Q = h(null);
|
|
435
|
-
function
|
|
436
|
-
Q.value
|
|
498
|
+
function Ie() {
|
|
499
|
+
Z.value && (Q.value = Z.value.querySelector("tbody"));
|
|
437
500
|
}
|
|
501
|
+
function Le() {
|
|
502
|
+
Q.value && (Re && Ue.destroy(), Ue.start(Q.value), Re = !0);
|
|
503
|
+
}
|
|
504
|
+
let Re = !1;
|
|
438
505
|
f(async () => {
|
|
439
|
-
await u(),
|
|
506
|
+
await u(), Ie(), Le();
|
|
507
|
+
}), v(R, async (e) => {
|
|
508
|
+
!e || !w.modalMode || (await u(), Ie(), Le());
|
|
440
509
|
});
|
|
441
510
|
let $ = h(null);
|
|
442
|
-
function
|
|
511
|
+
function ze() {
|
|
443
512
|
$.value && ($.value.style.display = "none");
|
|
444
513
|
}
|
|
445
|
-
function
|
|
514
|
+
function Be(e) {
|
|
446
515
|
let t = Q.value, n = Z.value, r = $.value, i = e?.related, a = i instanceof Element ? i.closest("tr") : null;
|
|
447
516
|
if (!t || !n || !r || !a || !t.contains(a)) {
|
|
448
|
-
|
|
517
|
+
ze();
|
|
449
518
|
return;
|
|
450
519
|
}
|
|
451
520
|
let o = a.getBoundingClientRect(), s = n.getBoundingClientRect(), ee = e.willInsertAfter ? o.bottom : o.top;
|
|
452
521
|
r.style.top = `${ee - s.top - 1}px`, r.style.left = "0px", r.style.width = `${n.clientWidth}px`, r.style.display = "block";
|
|
453
522
|
}
|
|
454
|
-
function
|
|
523
|
+
function Ve(e) {
|
|
455
524
|
if (!e) return;
|
|
456
525
|
let t = document.querySelector(".me-input-property__drag-fallback");
|
|
457
526
|
if (!t) return;
|
|
@@ -462,380 +531,390 @@ var le = { class: "me-input-property__toolbar" }, ue = {
|
|
|
462
531
|
r[t].style.width = `${e.getBoundingClientRect().width}px`;
|
|
463
532
|
});
|
|
464
533
|
}
|
|
465
|
-
let
|
|
534
|
+
let He = m({
|
|
466
535
|
handle: ".me-input-property__drag",
|
|
467
536
|
animation: 150,
|
|
468
537
|
forceFallback: !0,
|
|
469
538
|
fallbackOnBody: !0,
|
|
470
539
|
fallbackClass: "me-input-property__drag-fallback",
|
|
471
540
|
ghostClass: "me-input-property__row--ghost",
|
|
472
|
-
disabled: r(() => !
|
|
541
|
+
disabled: r(() => !F.value),
|
|
473
542
|
onStart: (e) => {
|
|
474
|
-
|
|
543
|
+
ze(), Ve(e.item);
|
|
475
544
|
},
|
|
476
|
-
onMove: ((e) => (
|
|
545
|
+
onMove: ((e) => (Be(e), !0)),
|
|
477
546
|
onEnd: () => {
|
|
478
|
-
|
|
547
|
+
ze(), K(), L();
|
|
479
548
|
}
|
|
480
|
-
}),
|
|
481
|
-
...
|
|
549
|
+
}), Ue = x(Q, k, {
|
|
550
|
+
...He,
|
|
482
551
|
immediate: !1
|
|
483
552
|
});
|
|
484
|
-
return v(
|
|
485
|
-
|
|
553
|
+
return v(F, (e) => {
|
|
554
|
+
Ue.option("disabled", !e);
|
|
486
555
|
}), (r, u) => {
|
|
487
|
-
let f = g("a-button"), m = g("a-
|
|
488
|
-
return p(),
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
})]),
|
|
503
|
-
default: y(() => [u[12] ||= ee(" 新增 ", -1)]),
|
|
504
|
-
_: 1
|
|
505
|
-
}, 8, ["disabled"])]),
|
|
506
|
-
c(D, {
|
|
507
|
-
columns: F.value,
|
|
508
|
-
"data-source": O.value,
|
|
509
|
-
"row-key": (e) => e.id,
|
|
510
|
-
pagination: !1,
|
|
511
|
-
size: l.size,
|
|
512
|
-
locale: { emptyText: l.emptyText },
|
|
513
|
-
class: "me-input-property__table"
|
|
514
|
-
}, {
|
|
515
|
-
bodyCell: y(({ column: t, record: n }) => [t.key === "action" ? (p(), o("div", ue, [I.value ? (p(), o("span", de, [c(_(e), {
|
|
516
|
-
name: "GripVertical",
|
|
517
|
-
size: 14
|
|
518
|
-
})])) : a("", !0), c(f, {
|
|
519
|
-
type: "text",
|
|
520
|
-
size: "small",
|
|
521
|
-
class: "me-input-property__del",
|
|
522
|
-
disabled: l.disabled,
|
|
523
|
-
title: "删除该属性",
|
|
524
|
-
onClick: (e) => pe(n)
|
|
556
|
+
let f = g("a-button"), m = g("a-tooltip"), h = g("a-input"), v = g("a-select"), b = g("a-input-number"), x = g("a-date-picker"), S = g("a-time-picker"), w = g("a-space-compact"), D = g("a-table"), O = g("a-checkbox"), A = g("a-form-item"), j = g("a-form");
|
|
557
|
+
return p(), i(re(l.modalMode ? _(t) : "div"), ne(te(B.value)), {
|
|
558
|
+
default: y(() => [s("div", {
|
|
559
|
+
ref_key: "rootEl",
|
|
560
|
+
ref: Z,
|
|
561
|
+
class: "me-input-property"
|
|
562
|
+
}, [
|
|
563
|
+
c(D, {
|
|
564
|
+
columns: oe.value,
|
|
565
|
+
"data-source": k.value,
|
|
566
|
+
"row-key": (e) => e.id,
|
|
567
|
+
pagination: !1,
|
|
568
|
+
size: l.size,
|
|
569
|
+
locale: { emptyText: l.emptyText },
|
|
570
|
+
class: "me-input-property__table"
|
|
525
571
|
}, {
|
|
526
|
-
|
|
527
|
-
|
|
572
|
+
headerCell: y(({ column: t }) => [t.key === "action" ? (p(), i(m, {
|
|
573
|
+
key: 0,
|
|
574
|
+
title: "新增"
|
|
575
|
+
}, {
|
|
576
|
+
default: y(() => [c(f, {
|
|
577
|
+
type: "primary",
|
|
578
|
+
size: "small",
|
|
579
|
+
shape: "circle",
|
|
580
|
+
class: "me-input-property__add-btn",
|
|
581
|
+
disabled: l.disabled,
|
|
582
|
+
onClick: be
|
|
583
|
+
}, {
|
|
584
|
+
default: y(() => [c(_(e), {
|
|
585
|
+
name: "Plus",
|
|
586
|
+
size: 14
|
|
587
|
+
})]),
|
|
588
|
+
_: 1
|
|
589
|
+
}, 8, ["disabled"])]),
|
|
590
|
+
_: 1
|
|
591
|
+
})) : a("", !0)]),
|
|
592
|
+
bodyCell: y(({ column: t, record: n }) => [t.key === "action" ? (p(), o("div", pe, [F.value ? (p(), o("span", me, [c(_(e), {
|
|
593
|
+
name: "GripVertical",
|
|
528
594
|
size: 14
|
|
529
|
-
})]),
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
title: l.disabled ? "" : he(n.key),
|
|
534
|
-
visible: !l.disabled && ge(n)
|
|
535
|
-
}, {
|
|
536
|
-
default: y(() => [c(m, {
|
|
537
|
-
value: n.key,
|
|
538
|
-
"onUpdate:value": [(e) => n.key = e, (e) => z(n)],
|
|
539
|
-
class: d(["me-input-property__key-input", { "me-input-property__field--error": !l.disabled && ge(n) }]),
|
|
595
|
+
})])) : a("", !0), c(f, {
|
|
596
|
+
type: "text",
|
|
597
|
+
size: "small",
|
|
598
|
+
class: "me-input-property__del",
|
|
540
599
|
disabled: l.disabled,
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
"value",
|
|
544
|
-
"onUpdate:value",
|
|
545
|
-
"class",
|
|
546
|
-
"disabled",
|
|
547
|
-
"placeholder"
|
|
548
|
-
])]),
|
|
549
|
-
_: 2
|
|
550
|
-
}, 1032, ["title", "visible"])) : t.key === "value" ? (p(), i(h, {
|
|
551
|
-
key: 2,
|
|
552
|
-
title: K(n),
|
|
553
|
-
visible: !!K(n)
|
|
554
|
-
}, {
|
|
555
|
-
default: y(() => [c(E, {
|
|
556
|
-
block: !0,
|
|
557
|
-
class: d(["me-input-property__value", { "me-input-property__field--error": !!K(n) }])
|
|
600
|
+
title: "删除该属性",
|
|
601
|
+
onClick: (e) => xe(n)
|
|
558
602
|
}, {
|
|
559
|
-
default: y(() => [
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
value: n.value,
|
|
574
|
-
"onUpdate:value": [(e) => n.value = e, (e) => V(n)],
|
|
575
|
-
class: "me-input-property__value-editor",
|
|
576
|
-
disabled: l.disabled,
|
|
577
|
-
placeholder: l.valuePlaceholder
|
|
578
|
-
}, null, 8, [
|
|
579
|
-
"value",
|
|
580
|
-
"onUpdate:value",
|
|
581
|
-
"disabled",
|
|
582
|
-
"placeholder"
|
|
583
|
-
])) : n.type === "int" ? (p(), i(b, {
|
|
584
|
-
key: 2,
|
|
585
|
-
value: n.value,
|
|
586
|
-
"onUpdate:value": [(e) => n.value = e, (e) => V(n)],
|
|
587
|
-
class: "me-input-property__value-editor",
|
|
603
|
+
default: y(() => [c(_(e), {
|
|
604
|
+
name: "Trash2",
|
|
605
|
+
size: 14
|
|
606
|
+
})]),
|
|
607
|
+
_: 1
|
|
608
|
+
}, 8, ["disabled", "onClick"])])) : t.key === "key" ? (p(), i(m, {
|
|
609
|
+
key: 1,
|
|
610
|
+
title: l.disabled ? "" : Ce(n.key),
|
|
611
|
+
visible: !l.disabled && we(n)
|
|
612
|
+
}, {
|
|
613
|
+
default: y(() => [c(h, {
|
|
614
|
+
value: n.key,
|
|
615
|
+
"onUpdate:value": [(e) => n.key = e, (e) => _e(n)],
|
|
616
|
+
class: d(["me-input-property__key-input", { "me-input-property__field--error": !l.disabled && we(n) }]),
|
|
588
617
|
disabled: l.disabled,
|
|
589
|
-
placeholder: l.
|
|
618
|
+
placeholder: l.keyPlaceholder
|
|
590
619
|
}, null, 8, [
|
|
591
620
|
"value",
|
|
592
621
|
"onUpdate:value",
|
|
622
|
+
"class",
|
|
593
623
|
"disabled",
|
|
594
624
|
"placeholder"
|
|
595
|
-
]))
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
"
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
625
|
+
])]),
|
|
626
|
+
_: 2
|
|
627
|
+
}, 1032, ["title", "visible"])) : t.key === "value" ? (p(), i(m, {
|
|
628
|
+
key: 2,
|
|
629
|
+
title: Te(n),
|
|
630
|
+
visible: !!Te(n)
|
|
631
|
+
}, {
|
|
632
|
+
default: y(() => [c(w, {
|
|
633
|
+
block: !0,
|
|
634
|
+
class: d(["me-input-property__value", { "me-input-property__field--error": !!Te(n) }])
|
|
635
|
+
}, {
|
|
636
|
+
default: y(() => [l.showType ? (p(), i(v, {
|
|
637
|
+
key: 0,
|
|
638
|
+
value: n.type,
|
|
639
|
+
disabled: l.disabled,
|
|
640
|
+
options: _(C),
|
|
641
|
+
class: "me-input-property__value-type",
|
|
642
|
+
onChange: (e) => ve(n, e)
|
|
643
|
+
}, null, 8, [
|
|
644
|
+
"value",
|
|
645
|
+
"disabled",
|
|
646
|
+
"options",
|
|
647
|
+
"onChange"
|
|
648
|
+
])) : a("", !0), n.type === "string" ? (p(), i(h, {
|
|
649
|
+
key: 1,
|
|
650
|
+
value: n.value,
|
|
651
|
+
"onUpdate:value": [(e) => n.value = e, (e) => G(n)],
|
|
652
|
+
class: "me-input-property__value-editor",
|
|
653
|
+
disabled: l.disabled,
|
|
654
|
+
placeholder: l.valuePlaceholder
|
|
655
|
+
}, null, 8, [
|
|
656
|
+
"value",
|
|
657
|
+
"onUpdate:value",
|
|
658
|
+
"disabled",
|
|
659
|
+
"placeholder"
|
|
660
|
+
])) : n.type === "int" ? (p(), i(b, {
|
|
661
|
+
key: 2,
|
|
662
|
+
value: n.value,
|
|
663
|
+
"onUpdate:value": [(e) => n.value = e, (e) => G(n)],
|
|
664
|
+
class: "me-input-property__value-editor",
|
|
665
|
+
disabled: l.disabled,
|
|
666
|
+
placeholder: l.valuePlaceholder
|
|
667
|
+
}, null, 8, [
|
|
668
|
+
"value",
|
|
669
|
+
"onUpdate:value",
|
|
670
|
+
"disabled",
|
|
671
|
+
"placeholder"
|
|
672
|
+
])) : n.type === "float" ? (p(), i(b, {
|
|
673
|
+
key: 3,
|
|
674
|
+
value: n.value,
|
|
675
|
+
"onUpdate:value": [(e) => n.value = e, (e) => G(n)],
|
|
676
|
+
class: "me-input-property__value-editor",
|
|
677
|
+
disabled: l.disabled,
|
|
678
|
+
placeholder: l.valuePlaceholder,
|
|
679
|
+
precision: _(2)
|
|
680
|
+
}, null, 8, [
|
|
681
|
+
"value",
|
|
682
|
+
"onUpdate:value",
|
|
683
|
+
"disabled",
|
|
684
|
+
"placeholder",
|
|
685
|
+
"precision"
|
|
686
|
+
])) : n.type === "date" ? (p(), i(x, {
|
|
687
|
+
key: 4,
|
|
688
|
+
value: n.value,
|
|
689
|
+
"onUpdate:value": [(e) => n.value = e, (e) => G(n)],
|
|
690
|
+
class: "me-input-property__value-editor",
|
|
691
|
+
"value-format": _(T),
|
|
692
|
+
disabled: l.disabled
|
|
693
|
+
}, null, 8, [
|
|
694
|
+
"value",
|
|
695
|
+
"onUpdate:value",
|
|
696
|
+
"value-format",
|
|
697
|
+
"disabled"
|
|
698
|
+
])) : n.type === "time" ? (p(), i(S, {
|
|
699
|
+
key: 5,
|
|
700
|
+
value: n.value,
|
|
701
|
+
"onUpdate:value": [(e) => n.value = e, (e) => G(n)],
|
|
702
|
+
class: "me-input-property__value-editor",
|
|
703
|
+
"value-format": _(E),
|
|
704
|
+
disabled: l.disabled
|
|
705
|
+
}, null, 8, [
|
|
706
|
+
"value",
|
|
707
|
+
"onUpdate:value",
|
|
708
|
+
"value-format",
|
|
709
|
+
"disabled"
|
|
710
|
+
])) : n.type === "boolean" ? (p(), i(v, {
|
|
711
|
+
key: 6,
|
|
712
|
+
value: n.value,
|
|
713
|
+
class: "me-input-property__value-editor",
|
|
714
|
+
disabled: l.disabled,
|
|
715
|
+
options: _(ie),
|
|
716
|
+
onChange: (e) => ye(n, e)
|
|
717
|
+
}, null, 8, [
|
|
718
|
+
"value",
|
|
719
|
+
"disabled",
|
|
720
|
+
"options",
|
|
721
|
+
"onChange"
|
|
722
|
+
])) : a("", !0)]),
|
|
723
|
+
_: 2
|
|
724
|
+
}, 1032, ["class"])]),
|
|
725
|
+
_: 2
|
|
726
|
+
}, 1032, ["title", "visible"])) : t.key === "rules" ? (p(), i(m, {
|
|
727
|
+
key: 3,
|
|
728
|
+
title: "配置校验规则"
|
|
729
|
+
}, {
|
|
730
|
+
default: y(() => [c(f, {
|
|
731
|
+
type: "text",
|
|
732
|
+
size: "small",
|
|
733
|
+
class: d(["me-input-property__rules-btn", { "is-active": Ee(n) }]),
|
|
637
734
|
disabled: l.disabled,
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
735
|
+
onClick: (e) => je(n)
|
|
736
|
+
}, {
|
|
737
|
+
default: y(() => [c(_(e), {
|
|
738
|
+
name: "WandSparkles",
|
|
739
|
+
size: 14
|
|
740
|
+
})]),
|
|
741
|
+
_: 1
|
|
742
|
+
}, 8, [
|
|
743
|
+
"class",
|
|
642
744
|
"disabled",
|
|
643
|
-
"
|
|
644
|
-
|
|
645
|
-
])) : a("", !0)]),
|
|
745
|
+
"onClick"
|
|
746
|
+
])]),
|
|
646
747
|
_: 2
|
|
647
|
-
},
|
|
648
|
-
_:
|
|
649
|
-
},
|
|
650
|
-
|
|
651
|
-
|
|
748
|
+
}, 1024)) : a("", !0)]),
|
|
749
|
+
_: 1
|
|
750
|
+
}, 8, [
|
|
751
|
+
"columns",
|
|
752
|
+
"data-source",
|
|
753
|
+
"row-key",
|
|
754
|
+
"size",
|
|
755
|
+
"locale"
|
|
756
|
+
]),
|
|
757
|
+
c(_(t), {
|
|
758
|
+
open: q.value,
|
|
759
|
+
"onUpdate:open": u[11] ||= (e) => q.value = e,
|
|
760
|
+
width: 480,
|
|
761
|
+
fullscreen: !1,
|
|
762
|
+
title: ke.value,
|
|
763
|
+
"ok-text": "保存",
|
|
764
|
+
"cancel-text": "取消",
|
|
765
|
+
onOk: Me,
|
|
766
|
+
onCancel: Ne
|
|
652
767
|
}, {
|
|
653
|
-
default: y(() => [c(
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
768
|
+
default: y(() => [c(j, {
|
|
769
|
+
ref_key: "ruleFormRef",
|
|
770
|
+
ref: De,
|
|
771
|
+
model: Y,
|
|
772
|
+
rules: Fe.value,
|
|
773
|
+
layout: "vertical",
|
|
774
|
+
class: "me-input-property__rule-form"
|
|
659
775
|
}, {
|
|
660
|
-
default: y(() => [
|
|
661
|
-
name: "
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
])]),
|
|
670
|
-
_: 2
|
|
671
|
-
}, 1024)) : a("", !0)]),
|
|
672
|
-
_: 1
|
|
673
|
-
}, 8, [
|
|
674
|
-
"columns",
|
|
675
|
-
"data-source",
|
|
676
|
-
"row-key",
|
|
677
|
-
"size",
|
|
678
|
-
"locale"
|
|
679
|
-
]),
|
|
680
|
-
c(_(t), {
|
|
681
|
-
open: q.value,
|
|
682
|
-
"onUpdate:open": u[11] ||= (e) => q.value = e,
|
|
683
|
-
width: 480,
|
|
684
|
-
fullscreen: !1,
|
|
685
|
-
title: be.value,
|
|
686
|
-
"ok-text": "保存",
|
|
687
|
-
"cancel-text": "取消",
|
|
688
|
-
onOk: Ce,
|
|
689
|
-
onCancel: we
|
|
690
|
-
}, {
|
|
691
|
-
default: y(() => [c(j, {
|
|
692
|
-
ref_key: "ruleFormRef",
|
|
693
|
-
ref: ve,
|
|
694
|
-
model: Y,
|
|
695
|
-
rules: Ee.value,
|
|
696
|
-
layout: "vertical",
|
|
697
|
-
class: "me-input-property__rule-form"
|
|
698
|
-
}, {
|
|
699
|
-
default: y(() => [
|
|
700
|
-
c(A, { name: "required" }, {
|
|
701
|
-
default: y(() => [c(k, {
|
|
702
|
-
checked: Y.required,
|
|
703
|
-
"onUpdate:checked": u[0] ||= (e) => Y.required = e
|
|
704
|
-
}, {
|
|
705
|
-
default: y(() => [...u[13] ||= [ee("必填(值不能为空)", -1)]]),
|
|
776
|
+
default: y(() => [
|
|
777
|
+
c(A, { name: "required" }, {
|
|
778
|
+
default: y(() => [c(O, {
|
|
779
|
+
checked: Y.required,
|
|
780
|
+
"onUpdate:checked": u[0] ||= (e) => Y.required = e
|
|
781
|
+
}, {
|
|
782
|
+
default: y(() => [...u[12] ||= [ee("必填(值不能为空)", -1)]]),
|
|
783
|
+
_: 1
|
|
784
|
+
}, 8, ["checked"])]),
|
|
706
785
|
_: 1
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
786
|
+
}),
|
|
787
|
+
X.value === "string" ? (p(), o(n, { key: 0 }, [
|
|
788
|
+
c(A, {
|
|
789
|
+
name: "minLength",
|
|
790
|
+
label: "最短长度"
|
|
791
|
+
}, {
|
|
792
|
+
default: y(() => [c(b, {
|
|
793
|
+
value: Y.minLength,
|
|
794
|
+
"onUpdate:value": u[1] ||= (e) => Y.minLength = e,
|
|
795
|
+
min: 0,
|
|
796
|
+
precision: 0,
|
|
797
|
+
placeholder: "不限",
|
|
798
|
+
class: "me-input-property__rule-input"
|
|
799
|
+
}, null, 8, ["value"])]),
|
|
800
|
+
_: 1
|
|
801
|
+
}),
|
|
802
|
+
c(A, {
|
|
803
|
+
name: "maxLength",
|
|
804
|
+
label: "最大长度"
|
|
805
|
+
}, {
|
|
806
|
+
default: y(() => [c(b, {
|
|
807
|
+
value: Y.maxLength,
|
|
808
|
+
"onUpdate:value": u[2] ||= (e) => Y.maxLength = e,
|
|
809
|
+
min: 0,
|
|
810
|
+
precision: 0,
|
|
811
|
+
placeholder: "不限",
|
|
812
|
+
class: "me-input-property__rule-input"
|
|
813
|
+
}, null, 8, ["value"])]),
|
|
814
|
+
_: 1
|
|
815
|
+
}),
|
|
816
|
+
c(A, {
|
|
817
|
+
name: "pattern",
|
|
818
|
+
label: "正则模式",
|
|
819
|
+
extra: "校验值格式,如 ^[a-zA-Z0-9]+$"
|
|
820
|
+
}, {
|
|
821
|
+
default: y(() => [c(h, {
|
|
822
|
+
value: Y.pattern,
|
|
823
|
+
"onUpdate:value": u[3] ||= (e) => Y.pattern = e,
|
|
824
|
+
placeholder: "如 ^[a-zA-Z0-9]+$",
|
|
825
|
+
"allow-clear": ""
|
|
826
|
+
}, null, 8, ["value"])]),
|
|
827
|
+
_: 1
|
|
828
|
+
})
|
|
829
|
+
], 64)) : a("", !0),
|
|
830
|
+
Ae(X.value) ? (p(), o(n, { key: 1 }, [c(A, {
|
|
831
|
+
name: "min",
|
|
832
|
+
label: "最小值"
|
|
714
833
|
}, {
|
|
715
834
|
default: y(() => [c(b, {
|
|
716
|
-
value: Y.
|
|
717
|
-
"onUpdate:value": u[
|
|
718
|
-
|
|
719
|
-
precision: 0,
|
|
835
|
+
value: Y.min,
|
|
836
|
+
"onUpdate:value": u[4] ||= (e) => Y.min = e,
|
|
837
|
+
precision: X.value === "float" ? _(2) : 0,
|
|
720
838
|
placeholder: "不限",
|
|
721
839
|
class: "me-input-property__rule-input"
|
|
722
|
-
}, null, 8, ["value"])]),
|
|
840
|
+
}, null, 8, ["value", "precision"])]),
|
|
723
841
|
_: 1
|
|
724
|
-
}),
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
label: "最大长度"
|
|
842
|
+
}), c(A, {
|
|
843
|
+
name: "max",
|
|
844
|
+
label: "最大值"
|
|
728
845
|
}, {
|
|
729
846
|
default: y(() => [c(b, {
|
|
730
|
-
value: Y.
|
|
731
|
-
"onUpdate:value": u[
|
|
732
|
-
|
|
733
|
-
precision: 0,
|
|
847
|
+
value: Y.max,
|
|
848
|
+
"onUpdate:value": u[5] ||= (e) => Y.max = e,
|
|
849
|
+
precision: X.value === "float" ? _(2) : 0,
|
|
734
850
|
placeholder: "不限",
|
|
735
851
|
class: "me-input-property__rule-input"
|
|
736
|
-
}, null, 8, ["value"])]),
|
|
852
|
+
}, null, 8, ["value", "precision"])]),
|
|
737
853
|
_: 1
|
|
738
|
-
}),
|
|
854
|
+
})], 64)) : a("", !0),
|
|
855
|
+
X.value === "date" || X.value === "time" ? (p(), o(n, { key: 2 }, [c(A, {
|
|
856
|
+
name: "min",
|
|
857
|
+
label: "最早边界"
|
|
858
|
+
}, {
|
|
859
|
+
default: y(() => [X.value === "date" ? (p(), i(x, {
|
|
860
|
+
key: 0,
|
|
861
|
+
value: Y.min,
|
|
862
|
+
"onUpdate:value": u[6] ||= (e) => Y.min = e,
|
|
863
|
+
"value-format": _(T),
|
|
864
|
+
style: { width: "100%" }
|
|
865
|
+
}, null, 8, ["value", "value-format"])) : (p(), i(S, {
|
|
866
|
+
key: 1,
|
|
867
|
+
value: Y.min,
|
|
868
|
+
"onUpdate:value": u[7] ||= (e) => Y.min = e,
|
|
869
|
+
"value-format": _(E),
|
|
870
|
+
style: { width: "100%" }
|
|
871
|
+
}, null, 8, ["value", "value-format"]))]),
|
|
872
|
+
_: 1
|
|
873
|
+
}), c(A, {
|
|
874
|
+
name: "max",
|
|
875
|
+
label: "最晚边界"
|
|
876
|
+
}, {
|
|
877
|
+
default: y(() => [X.value === "date" ? (p(), i(x, {
|
|
878
|
+
key: 0,
|
|
879
|
+
value: Y.max,
|
|
880
|
+
"onUpdate:value": u[8] ||= (e) => Y.max = e,
|
|
881
|
+
"value-format": _(T),
|
|
882
|
+
style: { width: "100%" }
|
|
883
|
+
}, null, 8, ["value", "value-format"])) : (p(), i(S, {
|
|
884
|
+
key: 1,
|
|
885
|
+
value: Y.max,
|
|
886
|
+
"onUpdate:value": u[9] ||= (e) => Y.max = e,
|
|
887
|
+
"value-format": _(E),
|
|
888
|
+
style: { width: "100%" }
|
|
889
|
+
}, null, 8, ["value", "value-format"]))]),
|
|
890
|
+
_: 1
|
|
891
|
+
})], 64)) : a("", !0),
|
|
739
892
|
c(A, {
|
|
740
|
-
name: "
|
|
741
|
-
label: "
|
|
742
|
-
extra: "
|
|
893
|
+
name: "message",
|
|
894
|
+
label: "自定义错误提示",
|
|
895
|
+
extra: "可选,覆盖所有校验规则的默认提示文案"
|
|
743
896
|
}, {
|
|
744
|
-
default: y(() => [c(
|
|
745
|
-
value: Y.
|
|
746
|
-
"onUpdate:value": u[
|
|
747
|
-
placeholder: "
|
|
897
|
+
default: y(() => [c(h, {
|
|
898
|
+
value: Y.message,
|
|
899
|
+
"onUpdate:value": u[10] ||= (e) => Y.message = e,
|
|
900
|
+
placeholder: "如:该属性不合法",
|
|
748
901
|
"allow-clear": ""
|
|
749
902
|
}, null, 8, ["value"])]),
|
|
750
903
|
_: 1
|
|
751
904
|
})
|
|
752
|
-
]
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
label: "最小值"
|
|
756
|
-
}, {
|
|
757
|
-
default: y(() => [c(b, {
|
|
758
|
-
value: Y.min,
|
|
759
|
-
"onUpdate:value": u[4] ||= (e) => Y.min = e,
|
|
760
|
-
precision: X.value === "float" ? _(2) : 0,
|
|
761
|
-
placeholder: "不限",
|
|
762
|
-
class: "me-input-property__rule-input"
|
|
763
|
-
}, null, 8, ["value", "precision"])]),
|
|
764
|
-
_: 1
|
|
765
|
-
}), c(A, {
|
|
766
|
-
name: "max",
|
|
767
|
-
label: "最大值"
|
|
768
|
-
}, {
|
|
769
|
-
default: y(() => [c(b, {
|
|
770
|
-
value: Y.max,
|
|
771
|
-
"onUpdate:value": u[5] ||= (e) => Y.max = e,
|
|
772
|
-
precision: X.value === "float" ? _(2) : 0,
|
|
773
|
-
placeholder: "不限",
|
|
774
|
-
class: "me-input-property__rule-input"
|
|
775
|
-
}, null, 8, ["value", "precision"])]),
|
|
776
|
-
_: 1
|
|
777
|
-
})], 64)) : a("", !0),
|
|
778
|
-
X.value === "date" || X.value === "time" ? (p(), o(n, { key: 2 }, [c(A, {
|
|
779
|
-
name: "min",
|
|
780
|
-
label: "最早边界"
|
|
781
|
-
}, {
|
|
782
|
-
default: y(() => [X.value === "date" ? (p(), i(x, {
|
|
783
|
-
key: 0,
|
|
784
|
-
value: Y.min,
|
|
785
|
-
"onUpdate:value": u[6] ||= (e) => Y.min = e,
|
|
786
|
-
"value-format": _(w),
|
|
787
|
-
style: { width: "100%" }
|
|
788
|
-
}, null, 8, ["value", "value-format"])) : (p(), i(C, {
|
|
789
|
-
key: 1,
|
|
790
|
-
value: Y.min,
|
|
791
|
-
"onUpdate:value": u[7] ||= (e) => Y.min = e,
|
|
792
|
-
"value-format": _(T),
|
|
793
|
-
style: { width: "100%" }
|
|
794
|
-
}, null, 8, ["value", "value-format"]))]),
|
|
795
|
-
_: 1
|
|
796
|
-
}), c(A, {
|
|
797
|
-
name: "max",
|
|
798
|
-
label: "最晚边界"
|
|
799
|
-
}, {
|
|
800
|
-
default: y(() => [X.value === "date" ? (p(), i(x, {
|
|
801
|
-
key: 0,
|
|
802
|
-
value: Y.max,
|
|
803
|
-
"onUpdate:value": u[8] ||= (e) => Y.max = e,
|
|
804
|
-
"value-format": _(w),
|
|
805
|
-
style: { width: "100%" }
|
|
806
|
-
}, null, 8, ["value", "value-format"])) : (p(), i(C, {
|
|
807
|
-
key: 1,
|
|
808
|
-
value: Y.max,
|
|
809
|
-
"onUpdate:value": u[9] ||= (e) => Y.max = e,
|
|
810
|
-
"value-format": _(T),
|
|
811
|
-
style: { width: "100%" }
|
|
812
|
-
}, null, 8, ["value", "value-format"]))]),
|
|
813
|
-
_: 1
|
|
814
|
-
})], 64)) : a("", !0),
|
|
815
|
-
c(A, {
|
|
816
|
-
name: "message",
|
|
817
|
-
label: "自定义错误提示",
|
|
818
|
-
extra: "可选,覆盖所有校验规则的默认提示文案"
|
|
819
|
-
}, {
|
|
820
|
-
default: y(() => [c(m, {
|
|
821
|
-
value: Y.message,
|
|
822
|
-
"onUpdate:value": u[10] ||= (e) => Y.message = e,
|
|
823
|
-
placeholder: "如:该属性不合法",
|
|
824
|
-
"allow-clear": ""
|
|
825
|
-
}, null, 8, ["value"])]),
|
|
826
|
-
_: 1
|
|
827
|
-
})
|
|
828
|
-
]),
|
|
905
|
+
]),
|
|
906
|
+
_: 1
|
|
907
|
+
}, 8, ["model", "rules"])]),
|
|
829
908
|
_: 1
|
|
830
|
-
}, 8, ["
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
909
|
+
}, 8, ["open", "title"]),
|
|
910
|
+
s("div", {
|
|
911
|
+
ref_key: "dropLineEl",
|
|
912
|
+
ref: $,
|
|
913
|
+
class: "me-input-property__drop-line"
|
|
914
|
+
}, null, 512)
|
|
915
|
+
], 512)]),
|
|
916
|
+
_: 1
|
|
917
|
+
}, 16);
|
|
839
918
|
};
|
|
840
919
|
}
|
|
841
920
|
});
|
|
@@ -844,6 +923,6 @@ var le = { class: "me-input-property__toolbar" }, ue = {
|
|
|
844
923
|
W.install = (e) => {
|
|
845
924
|
e.component("MeInputProperty", W);
|
|
846
925
|
};
|
|
847
|
-
var
|
|
926
|
+
var he = W;
|
|
848
927
|
//#endregion
|
|
849
|
-
export {
|
|
928
|
+
export { ie as BOOLEAN_OPTIONS, T as DATE_FORMAT, w as FLOAT_PRECISION, W as MeInputProperty, E as TIME_FORMAT, C as VALUE_TYPE_OPTIONS, se as checkDuplicateKeys, he as default, N as exportValue, D as genId, j as inferValueType, ce as isDuplicateKey, L as isRuleApplicable, I as normalizeKey, z as normalizeRuleSet, ae as normalizeValue, de as sanitizeRulesForType, H as toRuleMap, fe as toValueErrorMap, V as validateValue, U as valueError };
|