view-ui-plus-derive 0.2.1 → 0.2.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.md CHANGED
@@ -291,7 +291,10 @@ const columns = [
291
291
  label: '年龄'
292
292
  }
293
293
  ]
294
- // keys 决定存储路径,cols 为列配置
294
+ // 传递字符串指定存储路径
295
+ const cacheCols = 'app.userA.[page.list.cols]'
296
+
297
+ // 也可传递一个对象:keys 决定存储路径,cols 为列配置
295
298
  const cacheCols = {
296
299
  // 若路径较深,建议适当扁平以简化存取的对象结构
297
300
  // 如下会以 app.userA['page.list.cols'] 的形式读写 localStorage。若去掉中括号,对象将为 app.userA.page.list.cols 的形式
package/dist/index.d.ts CHANGED
@@ -399,11 +399,11 @@ maxDisabled: BooleanConstructor;
399
399
  /**
400
400
  * 最小值组件class
401
401
  */
402
- minClass: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
402
+ minClass: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
403
403
  /**
404
404
  * 最大值组件class
405
405
  */
406
- maxClass: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
406
+ maxClass: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
407
407
  /**
408
408
  * 最小值占位文本
409
409
  */
@@ -437,7 +437,7 @@ maxAttr: ObjectConstructor;
437
437
  /**
438
438
  * 中间连接部分class
439
439
  */
440
- joinerClass: (ObjectConstructor | StringConstructor)[];
440
+ joinerClass: (StringConstructor | ObjectConstructor)[];
441
441
  /**
442
442
  * 是否隐藏连接部分
443
443
  */
@@ -492,11 +492,11 @@ maxDisabled: BooleanConstructor;
492
492
  /**
493
493
  * 最小值组件class
494
494
  */
495
- minClass: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
495
+ minClass: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
496
496
  /**
497
497
  * 最大值组件class
498
498
  */
499
- maxClass: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
499
+ maxClass: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
500
500
  /**
501
501
  * 最小值占位文本
502
502
  */
@@ -530,7 +530,7 @@ maxAttr: ObjectConstructor;
530
530
  /**
531
531
  * 中间连接部分class
532
532
  */
533
- joinerClass: (ObjectConstructor | StringConstructor)[];
533
+ joinerClass: (StringConstructor | ObjectConstructor)[];
534
534
  /**
535
535
  * 是否隐藏连接部分
536
536
  */
@@ -881,8 +881,8 @@ limitBegin: {
881
881
  type: BooleanConstructor;
882
882
  default: boolean;
883
883
  };
884
- beginClass: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
885
- endClass: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
884
+ beginClass: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
885
+ endClass: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
886
886
  /**
887
887
  * 开始时间placeholder
888
888
  */
@@ -902,7 +902,7 @@ endAttr: ObjectConstructor;
902
902
  /**
903
903
  * 中间连接符的class
904
904
  */
905
- joinerClass: (ObjectConstructor | StringConstructor)[];
905
+ joinerClass: (StringConstructor | ObjectConstructor)[];
906
906
  /**
907
907
  * 是否禁止选择今天
908
908
  */
@@ -968,8 +968,8 @@ limitBegin: {
968
968
  type: BooleanConstructor;
969
969
  default: boolean;
970
970
  };
971
- beginClass: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
972
- endClass: (ObjectConstructor | ArrayConstructor | StringConstructor)[];
971
+ beginClass: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
972
+ endClass: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
973
973
  /**
974
974
  * 开始时间placeholder
975
975
  */
@@ -989,7 +989,7 @@ endAttr: ObjectConstructor;
989
989
  /**
990
990
  * 中间连接符的class
991
991
  */
992
- joinerClass: (ObjectConstructor | StringConstructor)[];
992
+ joinerClass: (StringConstructor | ObjectConstructor)[];
993
993
  /**
994
994
  * 是否禁止选择今天
995
995
  */
@@ -1972,7 +1972,7 @@ label: any;
1972
1972
  method: FunctionConstructor;
1973
1973
  refresh: FunctionConstructor;
1974
1974
  process: FunctionConstructor;
1975
- param: (ObjectConstructor | StringConstructor | FunctionConstructor)[];
1975
+ param: (StringConstructor | ObjectConstructor | FunctionConstructor)[];
1976
1976
  chosen: (ObjectConstructor | ArrayConstructor)[];
1977
1977
  autoGet: BooleanConstructor;
1978
1978
  formatLabel: {
@@ -1993,7 +1993,7 @@ textFormat: FunctionConstructor;
1993
1993
  * <Select v-model="some" ><Option value="1">1</Option></Select>
1994
1994
  * <RemoteSelect :parentCode="some" />
1995
1995
  */
1996
- parentCode: (NumberConstructor | ArrayConstructor | StringConstructor)[];
1996
+ parentCode: (NumberConstructor | StringConstructor | ArrayConstructor)[];
1997
1997
  optionDisabled: FunctionConstructor;
1998
1998
  optionTag: FunctionConstructor;
1999
1999
  getSelected: {
@@ -2064,7 +2064,7 @@ label: any;
2064
2064
  method: FunctionConstructor;
2065
2065
  refresh: FunctionConstructor;
2066
2066
  process: FunctionConstructor;
2067
- param: (ObjectConstructor | StringConstructor | FunctionConstructor)[];
2067
+ param: (StringConstructor | ObjectConstructor | FunctionConstructor)[];
2068
2068
  chosen: (ObjectConstructor | ArrayConstructor)[];
2069
2069
  autoGet: BooleanConstructor;
2070
2070
  formatLabel: {
@@ -2085,7 +2085,7 @@ textFormat: FunctionConstructor;
2085
2085
  * <Select v-model="some" ><Option value="1">1</Option></Select>
2086
2086
  * <RemoteSelect :parentCode="some" />
2087
2087
  */
2088
- parentCode: (NumberConstructor | ArrayConstructor | StringConstructor)[];
2088
+ parentCode: (NumberConstructor | StringConstructor | ArrayConstructor)[];
2089
2089
  optionDisabled: FunctionConstructor;
2090
2090
  optionTag: FunctionConstructor;
2091
2091
  getSelected: {
@@ -1,22 +1,24 @@
1
- import { Table as e } from "view-ui-plus";
2
- import { getPathValue as u, deepMerge as p, makeObjectByPath as y } from "utils-where";
3
- e.props.cacheCols = Object;
4
- const l = function(t, a, i) {
5
- const s = this.cacheCols.keys.split(".")[0], o = this.cacheCols.keys.slice(s.length + 1), h = localStorage.getItem(s), c = h ? JSON.parse(h) : {};
6
- let n = u(c, o);
7
- n || (n = {}, p(c, y(o, n))), n[i.key] ? n[i.key].width = Math.round(t) : n[i.key] = {
1
+ import { Table as s } from "view-ui-plus";
2
+ import { getPathValue as p, deepMerge as C, makeObjectByPath as g } from "utils-where";
3
+ s.props.cacheCols = [String, Object];
4
+ const l = function(t, a, n) {
5
+ let i, e;
6
+ typeof this.cacheCols == "string" ? (i = this.cacheCols, e = this.columns) : (i = this.cacheCols.keys, e = this.cacheCols.cols);
7
+ const o = i.split(".")[0], r = i.slice(o.length + 1), d = localStorage.getItem(o), h = d ? JSON.parse(d) : {};
8
+ let c = p(h, r);
9
+ c || (c = {}, C(h, g(r, c))), c[n.key] ? c[n.key].width = Math.round(t) : c[n.key] = {
8
10
  width: Math.round(t)
9
- }, this.cacheCols.cols?.length && (this.cacheCols.cols.find((f) => f.key === i.key).width = Math.round(t)), setTimeout(() => {
10
- localStorage.setItem(s, JSON.stringify(c));
11
+ }, e?.length && (e.find((y) => y.key === n.key).width = Math.round(t)), setTimeout(() => {
12
+ localStorage.setItem(o, JSON.stringify(h));
11
13
  });
12
- }, r = function() {
13
- if (!this.cacheCols?.keys) return;
14
- const t = this.cacheCols.keys.split(".")[0], a = this.cacheCols.keys.slice(t.length + 1), i = localStorage.getItem(t), s = i && u(JSON.parse(i), a);
15
- !s || !Object.keys(s).length || this.columns.forEach((o) => {
16
- s[o.key]?.width && (o.width = s[o.key].width);
14
+ }, f = function() {
15
+ if (typeof this.cacheCols != "string" ? !this.cacheCols?.keys : !this.cacheCols) return;
16
+ const t = typeof this.cacheCols == "string" ? this.cacheCols : this.cacheCols.keys, a = t.split(".")[0], n = t.slice(a.length + 1), i = localStorage.getItem(a), e = i && p(JSON.parse(i), n);
17
+ !e || !Object.keys(e).length || this.columns.forEach((o) => {
18
+ e[o.key]?.width && (o.width = e[o.key].width);
17
19
  });
18
- }, d = function() {
19
- if (!this.cacheCols?.keys) return;
20
+ }, u = function() {
21
+ if (typeof this.cacheCols != "string" ? !this.cacheCols?.keys : !this.cacheCols) return;
20
22
  const t = this.$.vnode.props;
21
23
  if (typeof t.onOnColumnWidthResize == "function" && t.onOnColumnWidthResize.name !== "bound saveColWidth") {
22
24
  t.onOnColumnWidthResize = [l.bind(this), t.onOnColumnWidthResize];
@@ -30,19 +32,19 @@ const l = function(t, a, i) {
30
32
  }
31
33
  t.onOnColumnWidthResize = l.bind(this);
32
34
  };
33
- if (typeof e.created != "function")
34
- e.created = r;
35
+ if (typeof s.created != "function")
36
+ s.created = f;
35
37
  else {
36
- const t = e.created;
37
- e.created = function() {
38
- t.call(this), r.call(this);
38
+ const t = s.created;
39
+ s.created = function() {
40
+ t.call(this), f.call(this);
39
41
  };
40
42
  }
41
- if (typeof e.updated != "function")
42
- e.updated = d;
43
+ if (typeof s.updated != "function")
44
+ s.updated = u;
43
45
  else {
44
- const t = e.updated;
45
- e.updated = function() {
46
- t.call(this), d.call(this);
46
+ const t = s.updated;
47
+ s.updated = function() {
48
+ t.call(this), u.call(this);
47
49
  };
48
50
  }
@@ -1 +1 @@
1
- (function(n,c){typeof exports=="object"&&typeof module<"u"?c(require("view-ui-plus")):typeof define=="function"&&define.amd?define(["view-ui-plus"],c):(n=typeof globalThis<"u"?globalThis:n||self,c(n.ViewUIPlus))})(this,(function(n){"use strict";n.InputNumber.props.modelValue.default=null,n.InputNumber.props.unset={type:Number,default:null},n.InputNumber.methods.change=function(e){if(e.type==="change"&&this.activeChange||e.type==="input"&&!this.activeChange)return;let t=e.target.value.trim();if(this.parser&&(t=this.parser(t)),t.length===0){this.setValue(this.unset);return}e.type==="input"&&t.match(/^\-?\.?$|\.$/)||(t=Number(t),isNaN(t)?e.target.value=this.currentValue:(this.currentValue=t,this.setValue(t)))},n.Select.watch.visible=function(e){e&&(this.filterQueryChange=!1),this.$emit("on-open-change",e)};const c=n.Option.computed.isShow;n.Option.computed.isShow=function(){return this.SelectInstance.dropVisible||c.call(this)};const b=n.Table.watch.data.handler;n.Table.watch.data.handler=function(e){b.call(this,e),setTimeout(()=>{const t=this.$refs.body;t&&((this.$refs.header&&this.$refs.header.scrollLeft)!==t.scrollLeft||this.isRightFixed&&this.$refs.fixedRightBody.scrollTop!==t.scrollTop||this.isLeftFixed&&this.$refs.fixedBody.scrollTop!==t.scrollTop)&&t.dispatchEvent(new Event("scroll"))})};function h(e,t,s){if(!e||typeof e!="object"||!t)return e;const i=Array.from(t.matchAll(/([^.[\]]+)|\[(.*?)\]/g),r=>[r[0],r[1]||r[2]]),o=void 0;let l=e;for(const r of i){if(l==null){l=void 0;break}l=l[r[1]]}return l}function m(e,t){let s={};if(!e)return s;const i=s,o=Array.from(e.matchAll(/([^.[\]]+)|\[(.*?)\]/g),l=>l[1]||l[2]);for(let l=0,r=o.length;l<r;l++)s=s[o[l]]=l<r-1?{}:t;return s=null,i}function d(e){return e!=null&&typeof e=="object"}function f(e,t,s){if(!e||!t)return e;for(const[i,o]of Object.entries(t))Object.hasOwn(e,i)&&o===e[i]||(d(o)&&d(e[i])?f(e[i],o):e[i]=o);return e}n.Table.props.cacheCols=Object;const u=function(e,t,s){const i=this.cacheCols.keys.split(".")[0],o=this.cacheCols.keys.slice(i.length+1),l=localStorage.getItem(i),r=l?JSON.parse(l):{};let a=h(r,o);a||(a={},f(r,m(o,a))),a[s.key]?a[s.key].width=Math.round(e):a[s.key]={width:Math.round(e)},this.cacheCols.cols?.length&&(this.cacheCols.cols.find(g=>g.key===s.key).width=Math.round(e)),setTimeout(()=>{localStorage.setItem(i,JSON.stringify(r))})},p=function(){if(!this.cacheCols?.keys)return;const e=this.cacheCols.keys.split(".")[0],t=this.cacheCols.keys.slice(e.length+1),s=localStorage.getItem(e),i=s&&h(JSON.parse(s),t);!i||!Object.keys(i).length||this.columns.forEach(o=>{i[o.key]?.width&&(o.width=i[o.key].width)})},y=function(){if(!this.cacheCols?.keys)return;const e=this.$.vnode.props;if(typeof e.onOnColumnWidthResize=="function"&&e.onOnColumnWidthResize.name!=="bound saveColWidth"){e.onOnColumnWidthResize=[u.bind(this),e.onOnColumnWidthResize];return}if(Array.isArray(e.onOnColumnWidthResize)){e.onOnColumnWidthResize.every(t=>t.name!=="bound saveColWidth")&&e.onOnColumnWidthResize.unshift(u.bind(this));return}e.onOnColumnWidthResize=u.bind(this)};if(typeof n.Table.created!="function")n.Table.created=p;else{const e=n.Table.created;n.Table.created=function(){e.call(this),p.call(this)}}if(typeof n.Table.updated!="function")n.Table.updated=y;else{const e=n.Table.updated;n.Table.updated=function(){e.call(this),y.call(this)}}}));
1
+ (function(s,c){typeof exports=="object"&&typeof module<"u"?c(require("view-ui-plus")):typeof define=="function"&&define.amd?define(["view-ui-plus"],c):(s=typeof globalThis<"u"?globalThis:s||self,c(s.ViewUIPlus))})(this,(function(s){"use strict";s.InputNumber.props.modelValue.default=null,s.InputNumber.props.unset={type:Number,default:null},s.InputNumber.methods.change=function(e){if(e.type==="change"&&this.activeChange||e.type==="input"&&!this.activeChange)return;let t=e.target.value.trim();if(this.parser&&(t=this.parser(t)),t.length===0){this.setValue(this.unset);return}e.type==="input"&&t.match(/^\-?\.?$|\.$/)||(t=Number(t),isNaN(t)?e.target.value=this.currentValue:(this.currentValue=t,this.setValue(t)))},s.Select.watch.visible=function(e){e&&(this.filterQueryChange=!1),this.$emit("on-open-change",e)};const c=s.Option.computed.isShow;s.Option.computed.isShow=function(){return this.SelectInstance.dropVisible||c.call(this)};const g=s.Table.watch.data.handler;s.Table.watch.data.handler=function(e){g.call(this,e),setTimeout(()=>{const t=this.$refs.body;t&&((this.$refs.header&&this.$refs.header.scrollLeft)!==t.scrollLeft||this.isRightFixed&&this.$refs.fixedRightBody.scrollTop!==t.scrollTop||this.isLeftFixed&&this.$refs.fixedBody.scrollTop!==t.scrollTop)&&t.dispatchEvent(new Event("scroll"))})};function d(e,t,l){if(!e||typeof e!="object"||!t)return e;const o=Array.from(t.matchAll(/([^.[\]]+)|\[(.*?)\]/g),r=>[r[0],r[1]||r[2]]),n=void 0;let i=e;for(const r of o){if(i==null){i=void 0;break}i=i[r[1]]}return i}function C(e,t){let l={};if(!e)return l;const o=l,n=Array.from(e.matchAll(/([^.[\]]+)|\[(.*?)\]/g),i=>i[1]||i[2]);for(let i=0,r=n.length;i<r;i++)l=l[n[i]]=i<r-1?{}:t;return l=null,o}function p(e){return e!=null&&typeof e=="object"}function y(e,t,l){if(!e||!t)return e;for(const[o,n]of Object.entries(t))Object.hasOwn(e,o)&&n===e[o]||(p(n)&&p(e[o])?y(e[o],n):e[o]=n);return e}s.Table.props.cacheCols=[String,Object];const h=function(e,t,l){let o,n;typeof this.cacheCols=="string"?(o=this.cacheCols,n=this.columns):(o=this.cacheCols.keys,n=this.cacheCols.cols);const i=o.split(".")[0],r=o.slice(i.length+1),u=localStorage.getItem(i),f=u?JSON.parse(u):{};let a=d(f,r);a||(a={},y(f,C(r,a))),a[l.key]?a[l.key].width=Math.round(e):a[l.key]={width:Math.round(e)},n?.length&&(n.find(O=>O.key===l.key).width=Math.round(e)),setTimeout(()=>{localStorage.setItem(i,JSON.stringify(f))})},b=function(){if(typeof this.cacheCols!="string"?!this.cacheCols?.keys:!this.cacheCols)return;const e=typeof this.cacheCols=="string"?this.cacheCols:this.cacheCols.keys,t=e.split(".")[0],l=e.slice(t.length+1),o=localStorage.getItem(t),n=o&&d(JSON.parse(o),l);!n||!Object.keys(n).length||this.columns.forEach(i=>{n[i.key]?.width&&(i.width=n[i.key].width)})},m=function(){if(typeof this.cacheCols!="string"?!this.cacheCols?.keys:!this.cacheCols)return;const e=this.$.vnode.props;if(typeof e.onOnColumnWidthResize=="function"&&e.onOnColumnWidthResize.name!=="bound saveColWidth"){e.onOnColumnWidthResize=[h.bind(this),e.onOnColumnWidthResize];return}if(Array.isArray(e.onOnColumnWidthResize)){e.onOnColumnWidthResize.every(t=>t.name!=="bound saveColWidth")&&e.onOnColumnWidthResize.unshift(h.bind(this));return}e.onOnColumnWidthResize=h.bind(this)};if(typeof s.Table.created!="function")s.Table.created=b;else{const e=s.Table.created;s.Table.created=function(){e.call(this),b.call(this)}}if(typeof s.Table.updated!="function")s.Table.updated=m;else{const e=s.Table.updated;s.Table.updated=function(){e.call(this),m.call(this)}}}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "view-ui-plus-derive",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "description": "基于view-ui-plus的组件&优化扩展等,可自定义组件名前缀",
6
6
  "keywords": [