general-basic-form 2.0.1 → 2.0.2
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.assets/image-20210820173738506.png +0 -0
- package/README.md +149 -18
- package/package.json +46 -48
- package/script/link.ts +34 -0
- package/script/unlink.ts +42 -0
- package/src/GeneralBasicForm.vue +234 -0
- package/src/assets/image-20210820173037871.png +0 -0
- package/src/assets/logo.png +0 -0
- package/src/components/VBasic/divider/index.vue +52 -0
- package/src/components/VBasic/input/index.vue +67 -0
- package/src/components/VBasic/input-graphic-verification/index.vue +56 -0
- package/src/components/VBasic/input-mobile-verification/index.vue +31 -0
- package/src/components/VBasic/input-mobile-verification/verification-button.vue +64 -0
- package/src/components/VBasic/input-number/index.vue +30 -0
- package/src/components/setting.ts +15 -0
- package/src/index.ts +15 -0
- package/src/types/basicFrom.ts +48 -0
- package/src/types/componentsProps.ts +17 -0
- package/tsconfig.json +14 -0
- package/vite.config.js +123 -0
- package/dist/index.mjs +0 -266
- package/dist/index.umd.js +0 -1
- package/dist/style.css +0 -1
- /package/{dist → public}/index.d.ts +0 -0
package/dist/index.mjs
DELETED
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import { resolveComponent as u, withDirectives as x, openBlock as a, createBlock as s, mergeProps as c, withCtx as p, createElementBlock as g, Fragment as P, renderList as m, withKeys as B, createSlots as C, resolveDynamicComponent as F, createCommentVNode as i, renderSlot as I, createVNode as k, createTextVNode as V, vShow as Q } from "vue";
|
|
2
|
-
const D = (r, n) => {
|
|
3
|
-
const t = r.__vccOpts || r;
|
|
4
|
-
for (const [h, l] of n)
|
|
5
|
-
t[h] = l;
|
|
6
|
-
return t;
|
|
7
|
-
}, G = {
|
|
8
|
-
name: "GeneralBasicForm",
|
|
9
|
-
components: {
|
|
10
|
-
InputArchive: (r) => {
|
|
11
|
-
const { templateEle: n } = r;
|
|
12
|
-
return n();
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
props: {
|
|
16
|
-
showSearch: {
|
|
17
|
-
// 是否展示所有元素
|
|
18
|
-
type: Boolean,
|
|
19
|
-
default: !0
|
|
20
|
-
},
|
|
21
|
-
formOnly: {
|
|
22
|
-
// 是否只展示表单不展示按钮
|
|
23
|
-
type: Boolean,
|
|
24
|
-
default: !1
|
|
25
|
-
},
|
|
26
|
-
getList: {
|
|
27
|
-
// 查找数据调用的函数
|
|
28
|
-
type: Function,
|
|
29
|
-
default: () => {
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
afterReset: {
|
|
33
|
-
// 在重置按钮点击完后但还没重新请求时触发的的函数
|
|
34
|
-
type: Function,
|
|
35
|
-
default: () => {
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
formItem: {
|
|
39
|
-
// 定义表单的数据
|
|
40
|
-
type: Array,
|
|
41
|
-
default: []
|
|
42
|
-
},
|
|
43
|
-
size: {
|
|
44
|
-
// 控制按钮大小
|
|
45
|
-
type: String,
|
|
46
|
-
default: "medium"
|
|
47
|
-
},
|
|
48
|
-
labelWidth: {
|
|
49
|
-
// 表单文字宽度
|
|
50
|
-
type: String,
|
|
51
|
-
default: "90px"
|
|
52
|
-
},
|
|
53
|
-
noUrlParameters: {
|
|
54
|
-
// 不接受和不改变url的参数
|
|
55
|
-
type: Boolean,
|
|
56
|
-
default: () => !1
|
|
57
|
-
},
|
|
58
|
-
formData: {
|
|
59
|
-
// 外部传入的表单数据,用于回填
|
|
60
|
-
type: Object,
|
|
61
|
-
default: () => {
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
data() {
|
|
66
|
-
var r;
|
|
67
|
-
return {
|
|
68
|
-
queryParams: {
|
|
69
|
-
...this.noUrlParameters ? {} : (r = this.$route) == null ? void 0 : r.query
|
|
70
|
-
},
|
|
71
|
-
// form表单数据
|
|
72
|
-
selectSetting: {
|
|
73
|
-
placeholder: "请选择",
|
|
74
|
-
clearable: !0,
|
|
75
|
-
style: "width: 200px"
|
|
76
|
-
},
|
|
77
|
-
inputSetting: {
|
|
78
|
-
placeholder: "请输入",
|
|
79
|
-
style: "width: 200px",
|
|
80
|
-
clearable: !0
|
|
81
|
-
},
|
|
82
|
-
datePackerSetting: {
|
|
83
|
-
style: "width: 227px",
|
|
84
|
-
"start-placeholder": "开始日期",
|
|
85
|
-
"end-placeholder": "结束日期",
|
|
86
|
-
type: "daterange"
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
},
|
|
90
|
-
// setup(props) {
|
|
91
|
-
//设置默认值
|
|
92
|
-
// console.log(props);
|
|
93
|
-
// // const { formItem } = toRefs(props);
|
|
94
|
-
// const { formItem } = props;
|
|
95
|
-
// console.log(formItem);
|
|
96
|
-
// const queryParams = {};
|
|
97
|
-
// formItem.forEach((item) => {
|
|
98
|
-
// queryParams[item.prop] = "";
|
|
99
|
-
// });
|
|
100
|
-
// return {
|
|
101
|
-
// queryParams,
|
|
102
|
-
// };
|
|
103
|
-
// },
|
|
104
|
-
watch: {
|
|
105
|
-
formData(r) {
|
|
106
|
-
this.queryParams = {
|
|
107
|
-
...this.noUrlParameters ? {} : this.queryParams,
|
|
108
|
-
...r
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
methods: {
|
|
113
|
-
/** 搜索按钮操作 */
|
|
114
|
-
handleQuery() {
|
|
115
|
-
var t;
|
|
116
|
-
const r = { page: 1, limit: 10 }, n = {
|
|
117
|
-
...(t = this.$route) == null ? void 0 : t.query,
|
|
118
|
-
...this.queryParams,
|
|
119
|
-
...r
|
|
120
|
-
};
|
|
121
|
-
this.noUrlParameters || this.$router.push({
|
|
122
|
-
query: { ...n }
|
|
123
|
-
}), this.getList({
|
|
124
|
-
...n
|
|
125
|
-
});
|
|
126
|
-
},
|
|
127
|
-
/** 重置按钮操作 */
|
|
128
|
-
async resetQuery() {
|
|
129
|
-
var n;
|
|
130
|
-
this.$refs.queryFormRef.resetFields();
|
|
131
|
-
const r = { page: 1 };
|
|
132
|
-
this.noUrlParameters || await this.$router.push({
|
|
133
|
-
query: { ...r }
|
|
134
|
-
}), this.queryParams = {
|
|
135
|
-
...this.noUrlParameters ? {} : (n = this.$route) == null ? void 0 : n.query
|
|
136
|
-
}, this.afterReset(), this.handleQuery();
|
|
137
|
-
},
|
|
138
|
-
currentInputComponent() {
|
|
139
|
-
return "input-archive";
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
};
|
|
143
|
-
function L(r, n, t, h, l, d) {
|
|
144
|
-
const q = u("el-input"), z = u("el-option"), b = u("el-select"), S = u("el-cascader"), v = u("el-date-picker"), U = u("el-input-number"), y = u("el-form-item"), _ = u("el-button"), w = u("el-form");
|
|
145
|
-
return x((a(), s(w, c({
|
|
146
|
-
model: l.queryParams,
|
|
147
|
-
ref: "queryFormRef",
|
|
148
|
-
inline: "",
|
|
149
|
-
"label-position": "left",
|
|
150
|
-
"label-width": t.labelWidth
|
|
151
|
-
}, r.$attrs), {
|
|
152
|
-
default: p(() => [
|
|
153
|
-
(a(!0), g(P, null, m(t.formItem, (e) => (a(), s(y, {
|
|
154
|
-
label: e.label,
|
|
155
|
-
prop: e.prop,
|
|
156
|
-
key: e.prop,
|
|
157
|
-
rules: e.rules
|
|
158
|
-
}, {
|
|
159
|
-
default: p(() => [
|
|
160
|
-
e.type === "input" ? (a(), s(q, c({
|
|
161
|
-
key: 0,
|
|
162
|
-
onKeydown: B(t.getList, ["enter"]),
|
|
163
|
-
modelValue: l.queryParams[e.prop],
|
|
164
|
-
"onUpdate:modelValue": (o) => l.queryParams[e.prop] = o,
|
|
165
|
-
size: t.size
|
|
166
|
-
}, l.inputSetting, {
|
|
167
|
-
placeholder: e.placeholder || l.inputSetting.placeholder,
|
|
168
|
-
maxlength: e.maxlength
|
|
169
|
-
}), C({ _: 2 }, [
|
|
170
|
-
m(e.template, (o, f) => ({
|
|
171
|
-
name: f,
|
|
172
|
-
fn: p(() => [
|
|
173
|
-
o ? (a(), s(F(d.currentInputComponent()), {
|
|
174
|
-
key: f,
|
|
175
|
-
templateEle: o
|
|
176
|
-
}, null, 8, ["templateEle"])) : i("", !0)
|
|
177
|
-
])
|
|
178
|
-
}))
|
|
179
|
-
]), 1040, ["onKeydown", "modelValue", "onUpdate:modelValue", "size", "placeholder", "maxlength"])) : e.type === "select" ? (a(), s(b, c({
|
|
180
|
-
key: 1,
|
|
181
|
-
filterable: "",
|
|
182
|
-
modelValue: l.queryParams[e.prop],
|
|
183
|
-
"onUpdate:modelValue": (o) => l.queryParams[e.prop] = o,
|
|
184
|
-
size: t.size
|
|
185
|
-
}, l.selectSetting, {
|
|
186
|
-
multiple: e.multiple,
|
|
187
|
-
placeholder: e.placeholder || l.selectSetting.placeholder
|
|
188
|
-
}), {
|
|
189
|
-
default: p(() => [
|
|
190
|
-
(a(!0), g(P, null, m(e.option || [], (o) => (a(), s(z, {
|
|
191
|
-
key: o.value,
|
|
192
|
-
label: o.desc,
|
|
193
|
-
value: o.value
|
|
194
|
-
}, null, 8, ["label", "value"]))), 128))
|
|
195
|
-
]),
|
|
196
|
-
_: 2
|
|
197
|
-
}, 1040, ["modelValue", "onUpdate:modelValue", "size", "multiple", "placeholder"])) : e.type === "cascader" ? (a(), s(S, c({
|
|
198
|
-
key: 2,
|
|
199
|
-
filterable: "",
|
|
200
|
-
modelValue: l.queryParams[e.prop],
|
|
201
|
-
"onUpdate:modelValue": (o) => l.queryParams[e.prop] = o,
|
|
202
|
-
size: t.size
|
|
203
|
-
}, l.selectSetting, {
|
|
204
|
-
options: e.options || [],
|
|
205
|
-
placeholder: e.placeholder || l.selectSetting.placeholder
|
|
206
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "size", "options", "placeholder"])) : e.type === "date-picker" ? (a(), s(v, c({
|
|
207
|
-
key: 3,
|
|
208
|
-
modelValue: l.queryParams[e.prop],
|
|
209
|
-
"onUpdate:modelValue": (o) => l.queryParams[e.prop] = o,
|
|
210
|
-
size: t.size
|
|
211
|
-
}, l.datePackerSetting, {
|
|
212
|
-
"start-placeholder": e["start-placeholder"] || l.datePackerSetting["start-placeholder"],
|
|
213
|
-
"end-placeholder": e["end-placeholder"] || l.datePackerSetting["end-placeholder"],
|
|
214
|
-
"value-format": e["value-format"]
|
|
215
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "size", "start-placeholder", "end-placeholder", "value-format"])) : i("", !0),
|
|
216
|
-
e.type === "input-number" ? (a(), s(U, c({
|
|
217
|
-
key: 4,
|
|
218
|
-
modelValue: l.queryParams[e.prop],
|
|
219
|
-
"onUpdate:modelValue": (o) => l.queryParams[e.prop] = o,
|
|
220
|
-
size: t.size
|
|
221
|
-
}, l.inputSetting, {
|
|
222
|
-
min: e.min,
|
|
223
|
-
max: e.max,
|
|
224
|
-
"controls-position": e["controls-position"],
|
|
225
|
-
"step-strictly": e["step-strictly"]
|
|
226
|
-
}), null, 16, ["modelValue", "onUpdate:modelValue", "size", "min", "max", "controls-position", "step-strictly"])) : i("", !0)
|
|
227
|
-
]),
|
|
228
|
-
_: 2
|
|
229
|
-
}, 1032, ["label", "prop", "rules"]))), 128)),
|
|
230
|
-
I(r.$slots, "default", {}, void 0, !0),
|
|
231
|
-
t.formOnly ? i("", !0) : (a(), s(y, { key: 0 }, {
|
|
232
|
-
default: p(() => [
|
|
233
|
-
k(_, {
|
|
234
|
-
type: "primary",
|
|
235
|
-
icon: "el-icon-search",
|
|
236
|
-
size: t.size,
|
|
237
|
-
onClick: d.handleQuery
|
|
238
|
-
}, {
|
|
239
|
-
default: p(() => [
|
|
240
|
-
V("查询")
|
|
241
|
-
]),
|
|
242
|
-
_: 1
|
|
243
|
-
}, 8, ["size", "onClick"]),
|
|
244
|
-
k(_, {
|
|
245
|
-
icon: "el-icon-refresh",
|
|
246
|
-
size: t.size,
|
|
247
|
-
onClick: d.resetQuery
|
|
248
|
-
}, {
|
|
249
|
-
default: p(() => [
|
|
250
|
-
V("重置")
|
|
251
|
-
]),
|
|
252
|
-
_: 1
|
|
253
|
-
}, 8, ["size", "onClick"])
|
|
254
|
-
]),
|
|
255
|
-
_: 1
|
|
256
|
-
}))
|
|
257
|
-
]),
|
|
258
|
-
_: 3
|
|
259
|
-
}, 16, ["model", "label-width"])), [
|
|
260
|
-
[Q, t.showSearch]
|
|
261
|
-
]);
|
|
262
|
-
}
|
|
263
|
-
const O = /* @__PURE__ */ D(G, [["render", L], ["__scopeId", "data-v-279f95d9"]]), E = O;
|
|
264
|
-
export {
|
|
265
|
-
E as VGeneralBasicForm
|
|
266
|
-
};
|
package/dist/index.umd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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 q="",u=(r,a)=>{const l=r.__vccOpts||r;for(const[p,o]of a)l[p]=o;return l},h={name:"GeneralBasicForm",components:{InputArchive:r=>{const{templateEle:a}=r;return a()}},props:{showSearch:{type:Boolean,default:!0},formOnly:{type:Boolean,default:!1},getList:{type:Function,default:()=>{}},afterReset:{type:Function,default:()=>{}},formItem:{type:Array,default:[]},size:{type:String,default:"medium"},labelWidth:{type:String,default:"90px"},noUrlParameters:{type:Boolean,default:()=>!1},formData:{type:Object,default:()=>{}}},data(){var r;return{queryParams:{...this.noUrlParameters?{}:(r=this.$route)==null?void 0:r.query},selectSetting:{placeholder:"请选择",clearable:!0,style:"width: 200px"},inputSetting:{placeholder:"请输入",style:"width: 200px",clearable:!0},datePackerSetting:{style:"width: 227px","start-placeholder":"开始日期","end-placeholder":"结束日期",type:"daterange"}}},watch:{formData(r){this.queryParams={...this.noUrlParameters?{}:this.queryParams,...r}}},methods:{handleQuery(){var l;const r={page:1,limit:10},a={...(l=this.$route)==null?void 0:l.query,...this.queryParams,...r};this.noUrlParameters||this.$router.push({query:{...a}}),this.getList({...a})},async resetQuery(){var a;this.$refs.queryFormRef.resetFields();const r={page:1};this.noUrlParameters||await this.$router.push({query:{...r}}),this.queryParams={...this.noUrlParameters?{}:(a=this.$route)==null?void 0:a.query},this.afterReset(),this.handleQuery()},currentInputComponent(){return"input-archive"}}};function y(r,a,l,p,o,c){const _=e.resolveComponent("el-input"),k=e.resolveComponent("el-option"),g=e.resolveComponent("el-select"),P=e.resolveComponent("el-cascader"),B=e.resolveComponent("el-date-picker"),V=e.resolveComponent("el-input-number"),i=e.resolveComponent("el-form-item"),d=e.resolveComponent("el-button"),C=e.resolveComponent("el-form");return e.withDirectives((e.openBlock(),e.createBlock(C,e.mergeProps({model:o.queryParams,ref:"queryFormRef",inline:"","label-position":"left","label-width":l.labelWidth},r.$attrs),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.formItem,t=>(e.openBlock(),e.createBlock(i,{label:t.label,prop:t.prop,key:t.prop,rules:t.rules},{default:e.withCtx(()=>[t.type==="input"?(e.openBlock(),e.createBlock(_,e.mergeProps({key:0,onKeydown:e.withKeys(l.getList,["enter"]),modelValue:o.queryParams[t.prop],"onUpdate:modelValue":n=>o.queryParams[t.prop]=n,size:l.size},o.inputSetting,{placeholder:t.placeholder||o.inputSetting.placeholder,maxlength:t.maxlength}),e.createSlots({_:2},[e.renderList(t.template,(n,m)=>({name:m,fn:e.withCtx(()=>[n?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.currentInputComponent()),{key:m,templateEle:n},null,8,["templateEle"])):e.createCommentVNode("",!0)])}))]),1040,["onKeydown","modelValue","onUpdate:modelValue","size","placeholder","maxlength"])):t.type==="select"?(e.openBlock(),e.createBlock(g,e.mergeProps({key:1,filterable:"",modelValue:o.queryParams[t.prop],"onUpdate:modelValue":n=>o.queryParams[t.prop]=n,size:l.size},o.selectSetting,{multiple:t.multiple,placeholder:t.placeholder||o.selectSetting.placeholder}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.option||[],n=>(e.openBlock(),e.createBlock(k,{key:n.value,label:n.desc,value:n.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","size","multiple","placeholder"])):t.type==="cascader"?(e.openBlock(),e.createBlock(P,e.mergeProps({key:2,filterable:"",modelValue:o.queryParams[t.prop],"onUpdate:modelValue":n=>o.queryParams[t.prop]=n,size:l.size},o.selectSetting,{options:t.options||[],placeholder:t.placeholder||o.selectSetting.placeholder}),null,16,["modelValue","onUpdate:modelValue","size","options","placeholder"])):t.type==="date-picker"?(e.openBlock(),e.createBlock(B,e.mergeProps({key:3,modelValue:o.queryParams[t.prop],"onUpdate:modelValue":n=>o.queryParams[t.prop]=n,size:l.size},o.datePackerSetting,{"start-placeholder":t["start-placeholder"]||o.datePackerSetting["start-placeholder"],"end-placeholder":t["end-placeholder"]||o.datePackerSetting["end-placeholder"],"value-format":t["value-format"]}),null,16,["modelValue","onUpdate:modelValue","size","start-placeholder","end-placeholder","value-format"])):e.createCommentVNode("",!0),t.type==="input-number"?(e.openBlock(),e.createBlock(V,e.mergeProps({key:4,modelValue:o.queryParams[t.prop],"onUpdate:modelValue":n=>o.queryParams[t.prop]=n,size:l.size},o.inputSetting,{min:t.min,max:t.max,"controls-position":t["controls-position"],"step-strictly":t["step-strictly"]}),null,16,["modelValue","onUpdate:modelValue","size","min","max","controls-position","step-strictly"])):e.createCommentVNode("",!0)]),_:2},1032,["label","prop","rules"]))),128)),e.renderSlot(r.$slots,"default",{},void 0,!0),l.formOnly?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(i,{key:0},{default:e.withCtx(()=>[e.createVNode(d,{type:"primary",icon:"el-icon-search",size:l.size,onClick:c.handleQuery},{default:e.withCtx(()=>[e.createTextVNode("查询")]),_:1},8,["size","onClick"]),e.createVNode(d,{icon:"el-icon-refresh",size:l.size,onClick:c.resetQuery},{default:e.withCtx(()=>[e.createTextVNode("重置")]),_:1},8,["size","onClick"])]),_:1}))]),_:3},16,["model","label-width"])),[[e.vShow,l.showSearch]])}const f=u(h,[["render",y],["__scopeId","data-v-279f95d9"]]);s.VGeneralBasicForm=f,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|
package/dist/style.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.el-form-item[data-v-279f95d9]{margin-bottom:2px!important}
|
|
File without changes
|