general-basic-form 1.0.26 → 1.0.28
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/README.md +356 -203
- package/dist/index.d.ts +17 -0
- package/dist/index.js +394 -0
- package/dist/index.umd.cjs +1 -0
- package/package.json +41 -11
- package/README.assets/image-20210820173738506.png +0 -0
- package/config/webpack.common.js +0 -98
- package/config/webpack.dev.js +0 -15
- package/config/webpack.prod.js +0 -16
- package/src/GeneralBasicForm.vue +0 -258
- package/src/assets/image-20210820173037871.png +0 -0
- package/src/assets/logo.png +0 -0
- package/src/index.js +0 -12
package/dist/index.js
ADDED
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import { resolveComponent as u, openBlock as a, createBlock as s, withCtx as c, createTextVNode as g, toDisplayString as D, resolveDirective as N, withDirectives as S, mergeProps as p, createElementBlock as k, Fragment as P, renderList as y, withKeys as V, createSlots as q, resolveDynamicComponent as x, createCommentVNode as f, createElementVNode as R, createVNode as z, renderSlot as O, vShow as E } from "vue";
|
|
2
|
+
const v = (e, n) => {
|
|
3
|
+
const r = e.__vccOpts || e;
|
|
4
|
+
for (const [d, o] of n)
|
|
5
|
+
r[d] = o;
|
|
6
|
+
return r;
|
|
7
|
+
}, K = {
|
|
8
|
+
props: {
|
|
9
|
+
verificationSetting: {
|
|
10
|
+
type: Object,
|
|
11
|
+
default: () => {
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
getSmscode: {
|
|
15
|
+
type: Function,
|
|
16
|
+
default: () => {
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
defaultText: this.verificationSetting.defaultText || "获取验证码",
|
|
23
|
+
buttonText: this.verificationSetting.defaultText || "获取验证码",
|
|
24
|
+
restTime: this.verificationSetting.restTime || 60,
|
|
25
|
+
timer: null
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
computed: {
|
|
29
|
+
buttonType() {
|
|
30
|
+
return this.buttonText === this.defaultText;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
destroyed() {
|
|
34
|
+
this.reset();
|
|
35
|
+
},
|
|
36
|
+
methods: {
|
|
37
|
+
reset() {
|
|
38
|
+
this.timer && (clearInterval(this.timer), this.timer = null, this.buttonText = this.defaultText);
|
|
39
|
+
},
|
|
40
|
+
async buttonClick() {
|
|
41
|
+
if (this.buttonText === this.defaultText)
|
|
42
|
+
if (this.buttonText = this.restTime, this.timer = setInterval(() => {
|
|
43
|
+
if (Number(this.buttonText) <= 0 || !this.buttonText) {
|
|
44
|
+
this.reset();
|
|
45
|
+
return;
|
|
46
|
+
} else
|
|
47
|
+
this.buttonText = Number(this.buttonText) - 1;
|
|
48
|
+
}, 1e3), this.getSmscode)
|
|
49
|
+
await this.getSmscode() === !1 && this.reset();
|
|
50
|
+
else
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
function Q(e, n, r, d, o, i) {
|
|
56
|
+
const h = u("el-button");
|
|
57
|
+
return a(), s(h, { onClick: i.buttonClick }, {
|
|
58
|
+
default: c(() => [
|
|
59
|
+
g(D(i.buttonType ? o.defaultText : o.buttonText + "s"), 1)
|
|
60
|
+
]),
|
|
61
|
+
_: 1
|
|
62
|
+
}, 8, ["onClick"]);
|
|
63
|
+
}
|
|
64
|
+
const G = /* @__PURE__ */ v(K, [["render", Q]]), j = {
|
|
65
|
+
name: "GeneralBasicForm",
|
|
66
|
+
components: {
|
|
67
|
+
InputArchive: (e) => {
|
|
68
|
+
const { templateEle: n } = e;
|
|
69
|
+
return n();
|
|
70
|
+
},
|
|
71
|
+
VerificationButton: G
|
|
72
|
+
},
|
|
73
|
+
props: {
|
|
74
|
+
showSearch: {
|
|
75
|
+
// 是否展示所有元素
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: !0
|
|
78
|
+
},
|
|
79
|
+
loading: {
|
|
80
|
+
// 加载动画
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: !1
|
|
83
|
+
},
|
|
84
|
+
formOnly: {
|
|
85
|
+
// 是否只展示表单不展示按钮
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: !1
|
|
88
|
+
},
|
|
89
|
+
getList: {
|
|
90
|
+
// 查找数据调用的函数
|
|
91
|
+
type: Function,
|
|
92
|
+
default: () => {
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
afterReset: {
|
|
96
|
+
// 在重置按钮点击完后但还没重新请求时触发的的函数
|
|
97
|
+
type: Function,
|
|
98
|
+
default: () => {
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
formItem: {
|
|
102
|
+
// 定义表单的数据
|
|
103
|
+
type: Array,
|
|
104
|
+
default: []
|
|
105
|
+
},
|
|
106
|
+
size: {
|
|
107
|
+
// 控制按钮大小
|
|
108
|
+
type: String,
|
|
109
|
+
default: "default"
|
|
110
|
+
},
|
|
111
|
+
labelWidth: {
|
|
112
|
+
// 表单文字宽度
|
|
113
|
+
type: String,
|
|
114
|
+
default: "90px"
|
|
115
|
+
},
|
|
116
|
+
noUrlParameters: {
|
|
117
|
+
// 不接受和不改变url的参数
|
|
118
|
+
type: Boolean,
|
|
119
|
+
default: () => !1
|
|
120
|
+
},
|
|
121
|
+
formData: {
|
|
122
|
+
// 外部传入的表单数据,用于回填
|
|
123
|
+
type: Object,
|
|
124
|
+
default: () => {
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
noInputBlank: {
|
|
128
|
+
// 用于判断input框是否校验仅空格
|
|
129
|
+
type: Boolean,
|
|
130
|
+
default: () => !1
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
data() {
|
|
134
|
+
var e;
|
|
135
|
+
return {
|
|
136
|
+
queryParams: {
|
|
137
|
+
...this.noUrlParameters ? {} : (e = this.$route) == null ? void 0 : e.query
|
|
138
|
+
},
|
|
139
|
+
// form表单数据
|
|
140
|
+
formLoading: this.loading || !1,
|
|
141
|
+
selectSetting: {
|
|
142
|
+
placeholder: "请选择",
|
|
143
|
+
filterable: !0,
|
|
144
|
+
clearable: !0,
|
|
145
|
+
style: "width: 200px"
|
|
146
|
+
},
|
|
147
|
+
inputSetting: {
|
|
148
|
+
placeholder: "请输入",
|
|
149
|
+
style: "width: 200px",
|
|
150
|
+
clearable: !0
|
|
151
|
+
},
|
|
152
|
+
datePackerSetting: {
|
|
153
|
+
style: "width: 227px",
|
|
154
|
+
"start-placeholder": "开始日期",
|
|
155
|
+
"end-placeholder": "结束日期",
|
|
156
|
+
type: "daterange"
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
// setup(props) {
|
|
161
|
+
//设置默认值
|
|
162
|
+
// console.log(props);
|
|
163
|
+
// // const { formItem } = toRefs(props);
|
|
164
|
+
// const { formItem } = props;
|
|
165
|
+
// console.log(formItem);
|
|
166
|
+
// const queryParams = {};
|
|
167
|
+
// formItem.forEach((item) => {
|
|
168
|
+
// queryParams[item.prop] = "";
|
|
169
|
+
// });
|
|
170
|
+
// return {
|
|
171
|
+
// queryParams,
|
|
172
|
+
// };
|
|
173
|
+
// },
|
|
174
|
+
watch: {
|
|
175
|
+
formData: {
|
|
176
|
+
handler(e, n) {
|
|
177
|
+
JSON.stringify(e) !== JSON.stringify(n) && (this.queryParams = {
|
|
178
|
+
...this.noUrlParameters ? {} : this.queryParams,
|
|
179
|
+
...e
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
// watch 默认是懒执行的:仅当数据源变化时,才会执行回调。但在某些场景中,我们希望在创建侦听器时,立即执行一遍回调。举例来说,我们想请求一些初始数据,然后在相关状态更改时重新请求数据。
|
|
183
|
+
// https://cn.vuejs.org/guide/essentials/watchers.html#deep-watchers
|
|
184
|
+
immediate: !0
|
|
185
|
+
// deep: true,
|
|
186
|
+
},
|
|
187
|
+
queryParams: {
|
|
188
|
+
handler(e) {
|
|
189
|
+
this.$emit("update:formData", e);
|
|
190
|
+
},
|
|
191
|
+
deep: !0
|
|
192
|
+
},
|
|
193
|
+
loading(e) {
|
|
194
|
+
this.formLoading !== e && (this.formLoading = e);
|
|
195
|
+
},
|
|
196
|
+
formLoading(e) {
|
|
197
|
+
this.loading !== e && this.$emit("update:loading", e);
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
methods: {
|
|
201
|
+
/** 搜索按钮操作 */
|
|
202
|
+
handleQuery() {
|
|
203
|
+
var r;
|
|
204
|
+
const e = { page: 1, limit: 10 }, n = {
|
|
205
|
+
...(r = this.$route) == null ? void 0 : r.query,
|
|
206
|
+
...this.queryParams,
|
|
207
|
+
...e
|
|
208
|
+
};
|
|
209
|
+
this.noUrlParameters || this.$router.push({
|
|
210
|
+
query: { ...n }
|
|
211
|
+
}), this.getList({
|
|
212
|
+
...n
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
/** 重置按钮操作 */
|
|
216
|
+
async resetQuery() {
|
|
217
|
+
var n;
|
|
218
|
+
this.$refs.queryFormRef.resetFields();
|
|
219
|
+
const e = { page: 1 };
|
|
220
|
+
this.noUrlParameters || await this.$router.push({
|
|
221
|
+
query: { ...e }
|
|
222
|
+
}), this.queryParams = {
|
|
223
|
+
...this.noUrlParameters ? {} : (n = this.$route) == null ? void 0 : n.query
|
|
224
|
+
}, this.afterReset(), this.handleQuery();
|
|
225
|
+
},
|
|
226
|
+
currentInputComponent() {
|
|
227
|
+
return "input-archive";
|
|
228
|
+
},
|
|
229
|
+
getItemRules(e) {
|
|
230
|
+
const { type: n, rules: r = [] } = e, d = [...r];
|
|
231
|
+
return this.noInputBlank && n === "input" && d.push({
|
|
232
|
+
pattern: this.trimRegex,
|
|
233
|
+
message: "请输入(不能仅输入空格)",
|
|
234
|
+
trigger: "blur"
|
|
235
|
+
}), d;
|
|
236
|
+
},
|
|
237
|
+
getInputSetting(e) {
|
|
238
|
+
const { inputSetting: n } = e;
|
|
239
|
+
return {
|
|
240
|
+
...this.inputSetting,
|
|
241
|
+
...n
|
|
242
|
+
};
|
|
243
|
+
},
|
|
244
|
+
getSelectSetting(e) {
|
|
245
|
+
const { selectSetting: n } = e;
|
|
246
|
+
return {
|
|
247
|
+
...this.selectSetting,
|
|
248
|
+
...n
|
|
249
|
+
};
|
|
250
|
+
},
|
|
251
|
+
getDatePackerSetting(e) {
|
|
252
|
+
const { datePackerSetting: n } = e;
|
|
253
|
+
return {
|
|
254
|
+
...this.datePackerSetting,
|
|
255
|
+
...n
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}, A = { slot: "append" };
|
|
260
|
+
function J(e, n, r, d, o, i) {
|
|
261
|
+
const h = u("el-input"), T = u("verification-button"), w = u("el-option"), U = u("el-select"), I = u("el-cascader"), C = u("el-date-picker"), B = u("el-input-number"), _ = u("el-form-item"), b = u("el-button"), F = u("el-form"), L = N("loading");
|
|
262
|
+
return S((a(), s(F, p({
|
|
263
|
+
model: o.queryParams,
|
|
264
|
+
ref: "queryFormRef",
|
|
265
|
+
inline: "",
|
|
266
|
+
"label-position": "left",
|
|
267
|
+
"label-width": r.labelWidth
|
|
268
|
+
}, e.$attrs), {
|
|
269
|
+
default: c(() => [
|
|
270
|
+
(a(!0), k(P, null, y(r.formItem, (t) => (a(), s(_, {
|
|
271
|
+
label: t.label,
|
|
272
|
+
prop: t.prop,
|
|
273
|
+
key: t.prop,
|
|
274
|
+
rules: i.getItemRules(t)
|
|
275
|
+
}, {
|
|
276
|
+
default: c(() => [
|
|
277
|
+
t.type === "input" ? (a(), s(h, p({
|
|
278
|
+
key: 0,
|
|
279
|
+
onKeydown: V(r.getList, ["enter"]),
|
|
280
|
+
modelValue: o.queryParams[t.prop],
|
|
281
|
+
"onUpdate:modelValue": (l) => o.queryParams[t.prop] = l,
|
|
282
|
+
size: r.size
|
|
283
|
+
}, i.getInputSetting(t)), q({ _: 2 }, [
|
|
284
|
+
y(t.template, (l, m) => ({
|
|
285
|
+
name: m,
|
|
286
|
+
fn: c(() => [
|
|
287
|
+
l ? (a(), s(x(i.currentInputComponent()), {
|
|
288
|
+
key: m,
|
|
289
|
+
templateEle: l
|
|
290
|
+
}, null, 8, ["templateEle"])) : f("", !0)
|
|
291
|
+
])
|
|
292
|
+
}))
|
|
293
|
+
]), 1040, ["onKeydown", "modelValue", "onUpdate:modelValue", "size"])) : t.type === "input-mobile-verification" ? (a(), s(h, p({
|
|
294
|
+
key: 1,
|
|
295
|
+
onKeydown: V(r.getList, ["enter"]),
|
|
296
|
+
modelValue: o.queryParams[t.prop],
|
|
297
|
+
"onUpdate:modelValue": (l) => o.queryParams[t.prop] = l,
|
|
298
|
+
size: r.size
|
|
299
|
+
}, i.getInputSetting(t)), q({
|
|
300
|
+
default: c(() => [
|
|
301
|
+
R("template", A, [
|
|
302
|
+
z(T, {
|
|
303
|
+
verificationSetting: t.verificationSetting,
|
|
304
|
+
getSmscode: t.getSmscode
|
|
305
|
+
}, null, 8, ["verificationSetting", "getSmscode"])
|
|
306
|
+
])
|
|
307
|
+
]),
|
|
308
|
+
_: 2
|
|
309
|
+
}, [
|
|
310
|
+
y(t.template, (l, m) => ({
|
|
311
|
+
name: m,
|
|
312
|
+
fn: c(() => [
|
|
313
|
+
l ? (a(), s(x(i.currentInputComponent()), {
|
|
314
|
+
key: m,
|
|
315
|
+
templateEle: l
|
|
316
|
+
}, null, 8, ["templateEle"])) : f("", !0)
|
|
317
|
+
])
|
|
318
|
+
}))
|
|
319
|
+
]), 1040, ["onKeydown", "modelValue", "onUpdate:modelValue", "size"])) : t.type === "select" ? (a(), s(U, p({
|
|
320
|
+
key: 2,
|
|
321
|
+
filterable: "",
|
|
322
|
+
modelValue: o.queryParams[t.prop],
|
|
323
|
+
"onUpdate:modelValue": (l) => o.queryParams[t.prop] = l,
|
|
324
|
+
size: r.size
|
|
325
|
+
}, i.getSelectSetting(t)), {
|
|
326
|
+
default: c(() => [
|
|
327
|
+
(a(!0), k(P, null, y(t.option || [], (l) => (a(), s(w, {
|
|
328
|
+
key: l.value,
|
|
329
|
+
label: l.desc,
|
|
330
|
+
value: l.value
|
|
331
|
+
}, null, 8, ["label", "value"]))), 128))
|
|
332
|
+
]),
|
|
333
|
+
_: 2
|
|
334
|
+
}, 1040, ["modelValue", "onUpdate:modelValue", "size"])) : t.type === "cascader" ? (a(), s(I, p({
|
|
335
|
+
key: 3,
|
|
336
|
+
filterable: "",
|
|
337
|
+
modelValue: o.queryParams[t.prop],
|
|
338
|
+
"onUpdate:modelValue": (l) => o.queryParams[t.prop] = l,
|
|
339
|
+
size: r.size,
|
|
340
|
+
options: t.options || []
|
|
341
|
+
}, i.getSelectSetting(t)), null, 16, ["modelValue", "onUpdate:modelValue", "size", "options"])) : t.type === "date-picker" ? (a(), s(C, p({
|
|
342
|
+
key: 4,
|
|
343
|
+
modelValue: o.queryParams[t.prop],
|
|
344
|
+
"onUpdate:modelValue": (l) => o.queryParams[t.prop] = l,
|
|
345
|
+
size: r.size
|
|
346
|
+
}, i.getDatePackerSetting(t)), null, 16, ["modelValue", "onUpdate:modelValue", "size"])) : f("", !0),
|
|
347
|
+
t.type === "input-number" ? (a(), s(B, p({
|
|
348
|
+
key: 5,
|
|
349
|
+
modelValue: o.queryParams[t.prop],
|
|
350
|
+
"onUpdate:modelValue": (l) => o.queryParams[t.prop] = l,
|
|
351
|
+
size: r.size
|
|
352
|
+
}, i.getInputSetting(t)), null, 16, ["modelValue", "onUpdate:modelValue", "size"])) : f("", !0)
|
|
353
|
+
]),
|
|
354
|
+
_: 2
|
|
355
|
+
}, 1032, ["label", "prop", "rules"]))), 128)),
|
|
356
|
+
O(e.$slots, "default"),
|
|
357
|
+
r.formOnly ? f("", !0) : (a(), s(_, { key: 0 }, {
|
|
358
|
+
default: c(() => [
|
|
359
|
+
S((a(), s(b, {
|
|
360
|
+
type: "primary",
|
|
361
|
+
icon: "el-icon-search",
|
|
362
|
+
size: r.size,
|
|
363
|
+
onClick: i.handleQuery
|
|
364
|
+
}, {
|
|
365
|
+
default: c(() => [
|
|
366
|
+
g("查询")
|
|
367
|
+
]),
|
|
368
|
+
_: 1
|
|
369
|
+
}, 8, ["size", "onClick"])), [
|
|
370
|
+
[L, o.formLoading]
|
|
371
|
+
]),
|
|
372
|
+
z(b, {
|
|
373
|
+
icon: "el-icon-refresh",
|
|
374
|
+
size: r.size,
|
|
375
|
+
onClick: i.resetQuery
|
|
376
|
+
}, {
|
|
377
|
+
default: c(() => [
|
|
378
|
+
g("重置")
|
|
379
|
+
]),
|
|
380
|
+
_: 1
|
|
381
|
+
}, 8, ["size", "onClick"])
|
|
382
|
+
]),
|
|
383
|
+
_: 1
|
|
384
|
+
}))
|
|
385
|
+
]),
|
|
386
|
+
_: 3
|
|
387
|
+
}, 16, ["model", "label-width"])), [
|
|
388
|
+
[E, r.showSearch]
|
|
389
|
+
]);
|
|
390
|
+
}
|
|
391
|
+
const W = /* @__PURE__ */ v(j, [["render", J]]), M = W;
|
|
392
|
+
export {
|
|
393
|
+
M as VGeneralBasicForm
|
|
394
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s.Index={},s.Vue))})(this,function(s,e){"use strict";const m=(t,r)=>{const n=t.__vccOpts||t;for(const[c,a]of r)n[c]=a;return n},h={props:{verificationSetting:{type:Object,default:()=>{}},getSmscode:{type:Function,default:()=>{}}},data(){return{defaultText:this.verificationSetting.defaultText||"获取验证码",buttonText:this.verificationSetting.defaultText||"获取验证码",restTime:this.verificationSetting.restTime||60,timer:null}},computed:{buttonType(){return this.buttonText===this.defaultText}},destroyed(){this.reset()},methods:{reset(){this.timer&&(clearInterval(this.timer),this.timer=null,this.buttonText=this.defaultText)},async buttonClick(){if(this.buttonText===this.defaultText)if(this.buttonText=this.restTime,this.timer=setInterval(()=>{if(Number(this.buttonText)<=0||!this.buttonText){this.reset();return}else this.buttonText=Number(this.buttonText)-1},1e3),this.getSmscode)await this.getSmscode()===!1&&this.reset();else return}}};function y(t,r,n,c,a,i){const d=e.resolveComponent("el-button");return e.openBlock(),e.createBlock(d,{onClick:i.buttonClick},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.buttonType?a.defaultText:a.buttonText+"s"),1)]),_:1},8,["onClick"])}const g={name:"GeneralBasicForm",components:{InputArchive:t=>{const{templateEle:r}=t;return r()},VerificationButton:m(h,[["render",y]])},props:{showSearch:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},formOnly:{type:Boolean,default:!1},getList:{type:Function,default:()=>{}},afterReset:{type:Function,default:()=>{}},formItem:{type:Array,default:[]},size:{type:String,default:"default"},labelWidth:{type:String,default:"90px"},noUrlParameters:{type:Boolean,default:()=>!1},formData:{type:Object,default:()=>{}},noInputBlank:{type:Boolean,default:()=>!1}},data(){var t;return{queryParams:{...this.noUrlParameters?{}:(t=this.$route)==null?void 0:t.query},formLoading:this.loading||!1,selectSetting:{placeholder:"请选择",filterable:!0,clearable:!0,style:"width: 200px"},inputSetting:{placeholder:"请输入",style:"width: 200px",clearable:!0},datePackerSetting:{style:"width: 227px","start-placeholder":"开始日期","end-placeholder":"结束日期",type:"daterange"}}},watch:{formData:{handler(t,r){JSON.stringify(t)!==JSON.stringify(r)&&(this.queryParams={...this.noUrlParameters?{}:this.queryParams,...t})},immediate:!0},queryParams:{handler(t){this.$emit("update:formData",t)},deep:!0},loading(t){this.formLoading!==t&&(this.formLoading=t)},formLoading(t){this.loading!==t&&this.$emit("update:loading",t)}},methods:{handleQuery(){var n;const t={page:1,limit:10},r={...(n=this.$route)==null?void 0:n.query,...this.queryParams,...t};this.noUrlParameters||this.$router.push({query:{...r}}),this.getList({...r})},async resetQuery(){var r;this.$refs.queryFormRef.resetFields();const t={page:1};this.noUrlParameters||await this.$router.push({query:{...t}}),this.queryParams={...this.noUrlParameters?{}:(r=this.$route)==null?void 0:r.query},this.afterReset(),this.handleQuery()},currentInputComponent(){return"input-archive"},getItemRules(t){const{type:r,rules:n=[]}=t,c=[...n];return this.noInputBlank&&r==="input"&&c.push({pattern:this.trimRegex,message:"请输入(不能仅输入空格)",trigger:"blur"}),c},getInputSetting(t){const{inputSetting:r}=t;return{...this.inputSetting,...r}},getSelectSetting(t){const{selectSetting:r}=t;return{...this.selectSetting,...r}},getDatePackerSetting(t){const{datePackerSetting:r}=t;return{...this.datePackerSetting,...r}}}},_={slot:"append"};function k(t,r,n,c,a,i){const d=e.resolveComponent("el-input"),b=e.resolveComponent("verification-button"),B=e.resolveComponent("el-option"),V=e.resolveComponent("el-select"),x=e.resolveComponent("el-cascader"),C=e.resolveComponent("el-date-picker"),P=e.resolveComponent("el-input-number"),u=e.resolveComponent("el-form-item"),f=e.resolveComponent("el-button"),w=e.resolveComponent("el-form"),T=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createBlock(w,e.mergeProps({model:a.queryParams,ref:"queryFormRef",inline:"","label-position":"left","label-width":n.labelWidth},t.$attrs),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.formItem,o=>(e.openBlock(),e.createBlock(u,{label:o.label,prop:o.prop,key:o.prop,rules:i.getItemRules(o)},{default:e.withCtx(()=>[o.type==="input"?(e.openBlock(),e.createBlock(d,e.mergeProps({key:0,onKeydown:e.withKeys(n.getList,["enter"]),modelValue:a.queryParams[o.prop],"onUpdate:modelValue":l=>a.queryParams[o.prop]=l,size:n.size},i.getInputSetting(o)),e.createSlots({_:2},[e.renderList(o.template,(l,p)=>({name:p,fn:e.withCtx(()=>[l?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i.currentInputComponent()),{key:p,templateEle:l},null,8,["templateEle"])):e.createCommentVNode("",!0)])}))]),1040,["onKeydown","modelValue","onUpdate:modelValue","size"])):o.type==="input-mobile-verification"?(e.openBlock(),e.createBlock(d,e.mergeProps({key:1,onKeydown:e.withKeys(n.getList,["enter"]),modelValue:a.queryParams[o.prop],"onUpdate:modelValue":l=>a.queryParams[o.prop]=l,size:n.size},i.getInputSetting(o)),e.createSlots({default:e.withCtx(()=>[e.createElementVNode("template",_,[e.createVNode(b,{verificationSetting:o.verificationSetting,getSmscode:o.getSmscode},null,8,["verificationSetting","getSmscode"])])]),_:2},[e.renderList(o.template,(l,p)=>({name:p,fn:e.withCtx(()=>[l?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i.currentInputComponent()),{key:p,templateEle:l},null,8,["templateEle"])):e.createCommentVNode("",!0)])}))]),1040,["onKeydown","modelValue","onUpdate:modelValue","size"])):o.type==="select"?(e.openBlock(),e.createBlock(V,e.mergeProps({key:2,filterable:"",modelValue:a.queryParams[o.prop],"onUpdate:modelValue":l=>a.queryParams[o.prop]=l,size:n.size},i.getSelectSetting(o)),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.option||[],l=>(e.openBlock(),e.createBlock(B,{key:l.value,label:l.desc,value:l.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","size"])):o.type==="cascader"?(e.openBlock(),e.createBlock(x,e.mergeProps({key:3,filterable:"",modelValue:a.queryParams[o.prop],"onUpdate:modelValue":l=>a.queryParams[o.prop]=l,size:n.size,options:o.options||[]},i.getSelectSetting(o)),null,16,["modelValue","onUpdate:modelValue","size","options"])):o.type==="date-picker"?(e.openBlock(),e.createBlock(C,e.mergeProps({key:4,modelValue:a.queryParams[o.prop],"onUpdate:modelValue":l=>a.queryParams[o.prop]=l,size:n.size},i.getDatePackerSetting(o)),null,16,["modelValue","onUpdate:modelValue","size"])):e.createCommentVNode("",!0),o.type==="input-number"?(e.openBlock(),e.createBlock(P,e.mergeProps({key:5,modelValue:a.queryParams[o.prop],"onUpdate:modelValue":l=>a.queryParams[o.prop]=l,size:n.size},i.getInputSetting(o)),null,16,["modelValue","onUpdate:modelValue","size"])):e.createCommentVNode("",!0)]),_:2},1032,["label","prop","rules"]))),128)),e.renderSlot(t.$slots,"default"),n.formOnly?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(u,{key:0},{default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createBlock(f,{type:"primary",icon:"el-icon-search",size:n.size,onClick:i.handleQuery},{default:e.withCtx(()=>[e.createTextVNode("查询")]),_:1},8,["size","onClick"])),[[T,a.formLoading]]),e.createVNode(f,{icon:"el-icon-refresh",size:n.size,onClick:i.resetQuery},{default:e.withCtx(()=>[e.createTextVNode("重置")]),_:1},8,["size","onClick"])]),_:1}))]),_:3},16,["model","label-width"])),[[e.vShow,n.showSearch]])}const S=m(g,[["render",k]]);s.VGeneralBasicForm=S,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "general-basic-form",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.28",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "./
|
|
5
|
+
"main": "./dist/index.umd.cjs",
|
|
6
|
+
"type": "module",
|
|
6
7
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
8
|
+
"build": "cross-env CURRENT_ENV=prod run-p type-check && run-p build-only",
|
|
9
|
+
"test:e2e": "playwright test",
|
|
10
|
+
"build-only": "vite build",
|
|
11
|
+
"type-check": "tsc --noEmit -p tsconfig.json --composite false",
|
|
12
|
+
"link": "tsx script/link.ts && yarn link",
|
|
13
|
+
"unlink": "tsx script/unlinkModule.ts && yarn unlink && run-p build",
|
|
14
|
+
"linkNode": "tsx script/linkNode.ts && yarn link && run-p dev",
|
|
15
|
+
"unlinkNode": "tsx script/unlinkNode.ts && yarn unlink && run-p buildts",
|
|
16
|
+
"dev": "tsc -w -p .",
|
|
17
|
+
"buildts": "rimraf dist && tsc -p ."
|
|
10
18
|
},
|
|
11
19
|
"keywords": [
|
|
12
20
|
"general-basic-form",
|
|
@@ -15,18 +23,40 @@
|
|
|
15
23
|
"vue2",
|
|
16
24
|
"vue3",
|
|
17
25
|
"element-plus",
|
|
18
|
-
"
|
|
26
|
+
"typescript"
|
|
19
27
|
],
|
|
20
28
|
"author": "chendeli419287484@qq.com",
|
|
21
29
|
"license": "ISC",
|
|
22
30
|
"repository": {
|
|
23
31
|
"type": "git",
|
|
24
|
-
"url": "https://github.com/Alan1034/GeneralBasicForm"
|
|
32
|
+
"url": "git+https://github.com/Alan1034/GeneralBasicForm.git"
|
|
25
33
|
},
|
|
26
34
|
"devDependencies": {
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
35
|
+
"@playwright/test": "^1.36.1",
|
|
36
|
+
"@types/node": "^20.8.10",
|
|
37
|
+
"@vitejs/plugin-legacy": "^4.1.1",
|
|
38
|
+
"@vitejs/plugin-vue": "^4.2.3",
|
|
39
|
+
"@vitejs/plugin-vue-jsx": "^3.0.1",
|
|
40
|
+
"cross-env": "^7.0.3",
|
|
41
|
+
"less": "^4.2.0",
|
|
42
|
+
"chalk": "^2.4.2",
|
|
43
|
+
"npm-run-all": "^4.1.5",
|
|
44
|
+
"rimraf": "^5.0.5",
|
|
45
|
+
"tsx": "^4.0.0",
|
|
46
|
+
"typescript": "^5.2.2",
|
|
47
|
+
"vite-plugin-image-optimizer": "^1.1.6"
|
|
30
48
|
},
|
|
31
|
-
"
|
|
49
|
+
"typings": "./dist/index.d.ts",
|
|
50
|
+
"module": "./dist/index.js",
|
|
51
|
+
"exports": {
|
|
52
|
+
".": {
|
|
53
|
+
"import": "./dist/index.js",
|
|
54
|
+
"require": "./dist/index.umd.cjs",
|
|
55
|
+
"types": "./dist/index.d.ts"
|
|
56
|
+
},
|
|
57
|
+
"./style": "./dist/style.css"
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"/dist"
|
|
61
|
+
]
|
|
32
62
|
}
|
|
Binary file
|
package/config/webpack.common.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
const path = require("path");
|
|
2
|
-
const webpack = require("webpack");
|
|
3
|
-
const { VueLoaderPlugin } = require('vue-loader')
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
entry: "./src/index.js",
|
|
7
|
-
module: {
|
|
8
|
-
rules: [
|
|
9
|
-
{
|
|
10
|
-
test: /\.js$/,
|
|
11
|
-
exclude: file => (
|
|
12
|
-
/node_modules/.test(file) &&
|
|
13
|
-
!/\.vue\.js/.test(file)
|
|
14
|
-
),
|
|
15
|
-
use: [
|
|
16
|
-
// "thread-loader",// 多线程编译,可能会导致报错
|
|
17
|
-
{
|
|
18
|
-
loader: 'babel-loader',
|
|
19
|
-
options: {
|
|
20
|
-
presets: ['@babel/preset-env']
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
test: /\.css$/,
|
|
28
|
-
use: ['vue-style-loader', 'css-loader']
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
test: /\.less$/,
|
|
32
|
-
use: ['vue-style-loader', 'css-loader', 'less-loader']
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
test: /\.scss$/,
|
|
36
|
-
use: [
|
|
37
|
-
'vue-style-loader',
|
|
38
|
-
'css-loader',
|
|
39
|
-
'sass-loader'
|
|
40
|
-
]
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
test: /\.(eot|svg|ttf|woff|woff2)$/,
|
|
44
|
-
use: {
|
|
45
|
-
loader: 'file-loader',
|
|
46
|
-
options: {
|
|
47
|
-
outputPath: 'fonts/',
|
|
48
|
-
esModule: false
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
test: /\.(png|jpg|gif)$/,
|
|
54
|
-
use: {
|
|
55
|
-
loader: 'file-loader',
|
|
56
|
-
options: {
|
|
57
|
-
outputPath: 'assets/',
|
|
58
|
-
esModule: false
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
test: /\.vue$/,
|
|
64
|
-
loader: 'vue-loader',
|
|
65
|
-
options: {
|
|
66
|
-
use: [
|
|
67
|
-
// "thread-loader",// 多线程编译,可能会导致报错
|
|
68
|
-
{
|
|
69
|
-
loader: 'babel-loader',
|
|
70
|
-
options: {
|
|
71
|
-
presets: ['@babel/preset-env']
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
],
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
]
|
|
78
|
-
},
|
|
79
|
-
resolve: {
|
|
80
|
-
extensions: ['\*', '.js', '.jsx', '.vue'],// 能够使用户在引入模块时不带扩展
|
|
81
|
-
alias: {
|
|
82
|
-
"@": path.resolve(__dirname, '../src'),
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
output: {
|
|
86
|
-
path: path.resolve(__dirname, "../dist/"),
|
|
87
|
-
publicPath: "/",
|
|
88
|
-
filename: "bundle.js"
|
|
89
|
-
},
|
|
90
|
-
//why:https://github.com/vuejs/vue-next/tree/master/packages/vue#bundler-build-feature-flags
|
|
91
|
-
plugins: [
|
|
92
|
-
new webpack.HotModuleReplacementPlugin(),
|
|
93
|
-
new VueLoaderPlugin(),
|
|
94
|
-
new webpack.DefinePlugin({
|
|
95
|
-
"__VUE_OPTIONS_API__": true,
|
|
96
|
-
"__VUE_PROD_DEVTOOLS__": false,
|
|
97
|
-
})]
|
|
98
|
-
};
|
package/config/webpack.dev.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const path = require("path");
|
|
2
|
-
const { merge } = require('webpack-merge');
|
|
3
|
-
const common = require('./webpack.common.js');
|
|
4
|
-
|
|
5
|
-
module.exports = merge(common, {
|
|
6
|
-
mode: 'development',
|
|
7
|
-
devtool: 'inline-source-map',
|
|
8
|
-
devServer: {
|
|
9
|
-
contentBase: path.join(__dirname, "dist"),
|
|
10
|
-
port: 3000,
|
|
11
|
-
hot: true,
|
|
12
|
-
open: true, //自动打开浏览器
|
|
13
|
-
// host: '0.0.0.0',//开启项目本地服务
|
|
14
|
-
},
|
|
15
|
-
});
|
package/config/webpack.prod.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const { merge } = require('webpack-merge');
|
|
2
|
-
const common = require('./webpack.common.js');
|
|
3
|
-
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
|
|
4
|
-
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
5
|
-
|
|
6
|
-
module.exports = merge(common, {
|
|
7
|
-
mode: 'production',
|
|
8
|
-
plugins: [
|
|
9
|
-
new UglifyJsPlugin({
|
|
10
|
-
uglifyOptions: {
|
|
11
|
-
comments: "some", //去掉部分注释
|
|
12
|
-
}
|
|
13
|
-
}),
|
|
14
|
-
new CleanWebpackPlugin(),// 构筑前清理dist文件夹
|
|
15
|
-
]
|
|
16
|
-
});
|