general-basic-form 1.0.29 → 1.0.30

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 CHANGED
@@ -24,7 +24,14 @@ import { VGeneralBasicForm } from "general-basic-form";
24
24
  ref="VGeneralBasicFormRef"
25
25
  labelWidth="90px"
26
26
  >
27
- ...一些传入插槽的内容
27
+ <template v-slot:default>
28
+ ...一些传入插槽的内容
29
+ </template>
30
+ <template v-slot:behind-the-button>
31
+ <el-form-item>
32
+ <div>上次同步时间:</div>
33
+ </el-form-item>
34
+ </template>
28
35
  </VGeneralBasicForm>
29
36
 
30
37
  ![image-20210903165502942](https://raw.githubusercontent.com/Alan1034/PicturesServer/main/PicGo_imgs/202109031655830.png)
@@ -142,10 +149,6 @@ getList会传出默认的参数,首次请求时会有页数和分页大小,重
142
149
  message: "请输入正确的Invoice单号"
143
150
  }
144
151
  ],
145
- verificationSetting: {
146
- defaultText: "查询",
147
- restTime: 5,
148
- },
149
152
  template: {
150
153
  suffix: () => {
151
154
  return <svg-icon icon-class="baifenbi" />;
@@ -219,6 +222,10 @@ getList会传出默认的参数,首次请求时会有页数和分页大小,重
219
222
  trigger: 'blur'
220
223
  }
221
224
  ],
225
+ verificationSetting: {
226
+ defaultText: "查询",
227
+ restTime: 5,
228
+ },
222
229
  getSmscode,// 获取验证码的回调函数,获取失败必须返回false,否则计时器不会重新计算
223
230
  },
224
231
  {
package/dist/index.js CHANGED
@@ -15,8 +15,8 @@ function f(r, e, a, t, n, o, u, d) {
15
15
  if (s.functional) {
16
16
  s._injectStyles = l;
17
17
  var h = s.render;
18
- s.render = function(m, c) {
19
- return l.call(c), h(m, c);
18
+ s.render = function(y, c) {
19
+ return l.call(c), h(y, c);
20
20
  };
21
21
  } else {
22
22
  var p = s.beforeCreate;
@@ -27,7 +27,7 @@ function f(r, e, a, t, n, o, u, d) {
27
27
  options: s
28
28
  };
29
29
  }
30
- const y = {
30
+ const m = {
31
31
  props: {
32
32
  verificationSetting: {
33
33
  type: Object,
@@ -79,7 +79,7 @@ var _ = function() {
79
79
  var e = this, a = e._self._c;
80
80
  return a("el-button", { on: { click: e.buttonClick } }, [e._v(e._s(e.buttonType ? e.defaultText : e.buttonText + "s"))]);
81
81
  }, g = [], b = /* @__PURE__ */ f(
82
- y,
82
+ m,
83
83
  _,
84
84
  g,
85
85
  !1,
@@ -315,14 +315,14 @@ var k = function() {
315
315
  }, expression: "queryParams[item.prop]" } }, "el-date-picker", e.getDatePackerSetting(t), !1)) : e._e(), t.type === "input-number" ? a("el-input-number", e._b({ attrs: { size: e.size }, model: { value: e.queryParams[t.prop], callback: function(n) {
316
316
  e.$set(e.queryParams, t.prop, n);
317
317
  }, expression: "queryParams[item.prop]" } }, "el-input-number", e.getInputSetting(t), !1)) : e._e()], 1);
318
- }), e._t("default"), e.formOnly ? e._e() : a("el-form-item", [a("el-button", { directives: [{ name: "loading", rawName: "v-loading", value: e.formLoading, expression: "formLoading" }], attrs: { type: "primary", icon: "el-icon-search", size: e.size }, on: { click: e.handleQuery } }, [e._v("查询")]), a("el-button", { attrs: { icon: "el-icon-refresh", size: e.size }, on: { click: e.resetQuery } }, [e._v("重置")])], 1)], 2);
318
+ }), e._t("default"), e.formOnly ? e._e() : a("el-form-item", [a("el-button", { attrs: { type: "primary", icon: "el-icon-search", size: e.size, loading: e.formLoading }, on: { click: e.handleQuery } }, [e._v("查询")]), a("el-button", { attrs: { icon: "el-icon-refresh", size: e.size }, on: { click: e.resetQuery } }, [e._v("重置")])], 1), e._t("behind-the-button")], 2);
319
319
  }, P = [], q = /* @__PURE__ */ f(
320
320
  S,
321
321
  k,
322
322
  P,
323
323
  !1,
324
324
  null,
325
- "a9566079",
325
+ "e1f6548e",
326
326
  null,
327
327
  null
328
328
  );
@@ -1 +1 @@
1
- (function(u,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(u=typeof globalThis<"u"?globalThis:u||self,p(u.Index={}))})(this,function(u){"use strict";const p="";function c(r,e,a,t,n,o,f,x){var s=typeof r=="function"?r.options:r;e&&(s.render=e,s.staticRenderFns=a,s._compiled=!0),t&&(s.functional=!0),o&&(s._scopeId="data-v-"+o);var l;if(f?(l=function(i){i=i||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!i&&typeof __VUE_SSR_CONTEXT__<"u"&&(i=__VUE_SSR_CONTEXT__),n&&n.call(this,i),i&&i._registeredComponents&&i._registeredComponents.add(f)},s._ssrRegister=l):n&&(l=x?function(){n.call(this,(s.functional?this.parent:this).$root.$options.shadowRoot)}:n),l)if(s.functional){s._injectStyles=l;var T=s.render;s.render=function($,h){return l.call(h),T($,h)}}else{var d=s.beforeCreate;s.beforeCreate=d?[].concat(d,l):[l]}return{exports:r,options:s}}const m={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}}};var y=function(){var e=this,a=e._self._c;return a("el-button",{on:{click:e.buttonClick}},[e._v(e._s(e.buttonType?e.defaultText:e.buttonText+"s"))])},_=[],g=c(m,y,_,!1,null,null,null,null);const b=g.exports,w="",v={name:"GeneralBasicForm",components:{InputArchive:r=>{const{templateEle:e}=r;return e()},VerificationButton:b},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 r;return{queryParams:{...this.noUrlParameters?{}:(r=this.$route)==null?void 0:r.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(r,e){JSON.stringify(r)!==JSON.stringify(e)&&(this.queryParams={...this.noUrlParameters?{}:this.queryParams,...r})},immediate:!0},queryParams:{handler(r){this.$emit("update:formData",r)},deep:!0},loading(r){this.formLoading!==r&&(this.formLoading=r)},formLoading(r){this.loading!==r&&this.$emit("update:loading",r)}},methods:{handleQuery(){var a;const r={page:1,limit:10},e={...(a=this.$route)==null?void 0:a.query,...this.queryParams,...r};this.noUrlParameters||this.$router.push({query:{...e}}),this.getList({...e})},async resetQuery(){var e;this.$refs.queryFormRef.resetFields();const r={page:1};this.noUrlParameters||await this.$router.push({query:{...r}}),this.queryParams={...this.noUrlParameters?{}:(e=this.$route)==null?void 0:e.query},this.afterReset(),this.handleQuery()},currentInputComponent(){return"input-archive"},getItemRules(r){const{type:e,rules:a=[]}=r,t=[...a];return this.noInputBlank&&e==="input"&&t.push({pattern:this.trimRegex,message:"请输入(不能仅输入空格)",trigger:"blur"}),t},getInputSetting(r){const{inputSetting:e}=r;return{...this.inputSetting,...e}},getSelectSetting(r){const{selectSetting:e}=r;return{...this.selectSetting,...e}},getDatePackerSetting(r){const{datePackerSetting:e}=r;return{...this.datePackerSetting,...e}}}};var S=function(){var e=this,a=e._self._c;return a("el-form",e._b({directives:[{name:"show",rawName:"v-show",value:e.showSearch,expression:"showSearch"}],ref:"queryFormRef",attrs:{model:e.queryParams,inline:"","label-position":"left","label-width":e.labelWidth}},"el-form",e.$attrs,!1),[e._l(e.formItem,function(t){return a("el-form-item",{key:t.prop,attrs:{label:t.label,prop:t.prop,rules:e.getItemRules(t)}},[t.type==="input"?a("el-input",e._b({attrs:{size:e.size},on:{keydown:function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"enter",13,n.key,"Enter")?null:e.getList.apply(null,arguments)}},scopedSlots:e._u([e._l(t.template,function(n,o){return{key:o,fn:function(){return[n?a(e.currentInputComponent(),{key:o,tag:"component",attrs:{templateEle:n}}):e._e()]},proxy:!0}})],null,!0),model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(t),!1)):t.type==="input-mobile-verification"?a("el-input",e._b({attrs:{size:e.size},on:{keydown:function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"enter",13,n.key,"Enter")?null:e.getList.apply(null,arguments)}},scopedSlots:e._u([e._l(t.template,function(n,o){return{key:o,fn:function(){return[n?a(e.currentInputComponent(),{key:o,tag:"component",attrs:{templateEle:n}}):e._e()]},proxy:!0}})],null,!0),model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(t),!1),[a("template",{slot:"append"},[a("verification-button",{attrs:{verificationSetting:t.verificationSetting,getSmscode:t.getSmscode}})],1)],2):t.type==="select"?a("el-select",e._b({attrs:{filterable:"",size:e.size},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-select",e.getSelectSetting(t),!1),e._l(t.option||[],function(n){return a("el-option",{key:n.value,attrs:{label:n.desc,value:n.value}})}),1):t.type==="cascader"?a("el-cascader",e._b({attrs:{filterable:"",size:e.size,options:t.options||[]},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-cascader",e.getSelectSetting(t),!1)):t.type==="date-picker"?a("el-date-picker",e._b({attrs:{size:e.size},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-date-picker",e.getDatePackerSetting(t),!1)):e._e(),t.type==="input-number"?a("el-input-number",e._b({attrs:{size:e.size},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-input-number",e.getInputSetting(t),!1)):e._e()],1)}),e._t("default"),e.formOnly?e._e():a("el-form-item",[a("el-button",{directives:[{name:"loading",rawName:"v-loading",value:e.formLoading,expression:"formLoading"}],attrs:{type:"primary",icon:"el-icon-search",size:e.size},on:{click:e.handleQuery}},[e._v("查询")]),a("el-button",{attrs:{icon:"el-icon-refresh",size:e.size},on:{click:e.resetQuery}},[e._v("重置")])],1)],2)},k=[],P=c(v,S,k,!1,null,"a9566079",null,null);const q=P.exports;u.VGeneralBasicForm=q,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
1
+ (function(u,p){typeof exports=="object"&&typeof module<"u"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(u=typeof globalThis<"u"?globalThis:u||self,p(u.Index={}))})(this,function(u){"use strict";const p="";function c(r,e,a,t,n,o,f,x){var s=typeof r=="function"?r.options:r;e&&(s.render=e,s.staticRenderFns=a,s._compiled=!0),t&&(s.functional=!0),o&&(s._scopeId="data-v-"+o);var l;if(f?(l=function(i){i=i||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!i&&typeof __VUE_SSR_CONTEXT__<"u"&&(i=__VUE_SSR_CONTEXT__),n&&n.call(this,i),i&&i._registeredComponents&&i._registeredComponents.add(f)},s._ssrRegister=l):n&&(l=x?function(){n.call(this,(s.functional?this.parent:this).$root.$options.shadowRoot)}:n),l)if(s.functional){s._injectStyles=l;var T=s.render;s.render=function($,h){return l.call(h),T($,h)}}else{var d=s.beforeCreate;s.beforeCreate=d?[].concat(d,l):[l]}return{exports:r,options:s}}const y={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}}};var m=function(){var e=this,a=e._self._c;return a("el-button",{on:{click:e.buttonClick}},[e._v(e._s(e.buttonType?e.defaultText:e.buttonText+"s"))])},_=[],g=c(y,m,_,!1,null,null,null,null);const b=g.exports,z="",v={name:"GeneralBasicForm",components:{InputArchive:r=>{const{templateEle:e}=r;return e()},VerificationButton:b},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 r;return{queryParams:{...this.noUrlParameters?{}:(r=this.$route)==null?void 0:r.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(r,e){JSON.stringify(r)!==JSON.stringify(e)&&(this.queryParams={...this.noUrlParameters?{}:this.queryParams,...r})},immediate:!0},queryParams:{handler(r){this.$emit("update:formData",r)},deep:!0},loading(r){this.formLoading!==r&&(this.formLoading=r)},formLoading(r){this.loading!==r&&this.$emit("update:loading",r)}},methods:{handleQuery(){var a;const r={page:1,limit:10},e={...(a=this.$route)==null?void 0:a.query,...this.queryParams,...r};this.noUrlParameters||this.$router.push({query:{...e}}),this.getList({...e})},async resetQuery(){var e;this.$refs.queryFormRef.resetFields();const r={page:1};this.noUrlParameters||await this.$router.push({query:{...r}}),this.queryParams={...this.noUrlParameters?{}:(e=this.$route)==null?void 0:e.query},this.afterReset(),this.handleQuery()},currentInputComponent(){return"input-archive"},getItemRules(r){const{type:e,rules:a=[]}=r,t=[...a];return this.noInputBlank&&e==="input"&&t.push({pattern:this.trimRegex,message:"请输入(不能仅输入空格)",trigger:"blur"}),t},getInputSetting(r){const{inputSetting:e}=r;return{...this.inputSetting,...e}},getSelectSetting(r){const{selectSetting:e}=r;return{...this.selectSetting,...e}},getDatePackerSetting(r){const{datePackerSetting:e}=r;return{...this.datePackerSetting,...e}}}};var S=function(){var e=this,a=e._self._c;return a("el-form",e._b({directives:[{name:"show",rawName:"v-show",value:e.showSearch,expression:"showSearch"}],ref:"queryFormRef",attrs:{model:e.queryParams,inline:"","label-position":"left","label-width":e.labelWidth}},"el-form",e.$attrs,!1),[e._l(e.formItem,function(t){return a("el-form-item",{key:t.prop,attrs:{label:t.label,prop:t.prop,rules:e.getItemRules(t)}},[t.type==="input"?a("el-input",e._b({attrs:{size:e.size},on:{keydown:function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"enter",13,n.key,"Enter")?null:e.getList.apply(null,arguments)}},scopedSlots:e._u([e._l(t.template,function(n,o){return{key:o,fn:function(){return[n?a(e.currentInputComponent(),{key:o,tag:"component",attrs:{templateEle:n}}):e._e()]},proxy:!0}})],null,!0),model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(t),!1)):t.type==="input-mobile-verification"?a("el-input",e._b({attrs:{size:e.size},on:{keydown:function(n){return!n.type.indexOf("key")&&e._k(n.keyCode,"enter",13,n.key,"Enter")?null:e.getList.apply(null,arguments)}},scopedSlots:e._u([e._l(t.template,function(n,o){return{key:o,fn:function(){return[n?a(e.currentInputComponent(),{key:o,tag:"component",attrs:{templateEle:n}}):e._e()]},proxy:!0}})],null,!0),model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-input",e.getInputSetting(t),!1),[a("template",{slot:"append"},[a("verification-button",{attrs:{verificationSetting:t.verificationSetting,getSmscode:t.getSmscode}})],1)],2):t.type==="select"?a("el-select",e._b({attrs:{filterable:"",size:e.size},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-select",e.getSelectSetting(t),!1),e._l(t.option||[],function(n){return a("el-option",{key:n.value,attrs:{label:n.desc,value:n.value}})}),1):t.type==="cascader"?a("el-cascader",e._b({attrs:{filterable:"",size:e.size,options:t.options||[]},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-cascader",e.getSelectSetting(t),!1)):t.type==="date-picker"?a("el-date-picker",e._b({attrs:{size:e.size},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-date-picker",e.getDatePackerSetting(t),!1)):e._e(),t.type==="input-number"?a("el-input-number",e._b({attrs:{size:e.size},model:{value:e.queryParams[t.prop],callback:function(n){e.$set(e.queryParams,t.prop,n)},expression:"queryParams[item.prop]"}},"el-input-number",e.getInputSetting(t),!1)):e._e()],1)}),e._t("default"),e.formOnly?e._e():a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-search",size:e.size,loading:e.formLoading},on:{click:e.handleQuery}},[e._v("查询")]),a("el-button",{attrs:{icon:"el-icon-refresh",size:e.size},on:{click:e.resetQuery}},[e._v("重置")])],1),e._t("behind-the-button")],2)},k=[],P=c(v,S,k,!1,null,"e1f6548e",null,null);const q=P.exports;u.VGeneralBasicForm=q,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "general-basic-form",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
4
4
  "description": "",
5
5
  "main": "./dist/index.umd.cjs",
6
6
  "type": "module",
@@ -46,6 +46,9 @@
46
46
  "typescript": "^5.2.2",
47
47
  "vite-plugin-image-optimizer": "^1.1.6"
48
48
  },
49
+ "peerDependencies": {
50
+ "vue": "^2.7.0-0"
51
+ },
49
52
  "typings": "./dist/index.d.ts",
50
53
  "module": "./dist/index.js",
51
54
  "exports": {