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 +4 -1
- package/dist/index.d.ts +16 -16
- package/dist/iview-mods/table-cache-cols.js +28 -26
- package/dist/umd/iview-mod.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -291,7 +291,10 @@ const columns = [
|
|
|
291
291
|
label: '年龄'
|
|
292
292
|
}
|
|
293
293
|
]
|
|
294
|
-
//
|
|
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: (
|
|
402
|
+
minClass: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
|
|
403
403
|
/**
|
|
404
404
|
* 最大值组件class
|
|
405
405
|
*/
|
|
406
|
-
maxClass: (
|
|
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: (
|
|
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: (
|
|
495
|
+
minClass: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
|
|
496
496
|
/**
|
|
497
497
|
* 最大值组件class
|
|
498
498
|
*/
|
|
499
|
-
maxClass: (
|
|
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: (
|
|
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: (
|
|
885
|
-
endClass: (
|
|
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: (
|
|
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: (
|
|
972
|
-
endClass: (
|
|
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: (
|
|
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: (
|
|
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 |
|
|
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: (
|
|
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 |
|
|
2088
|
+
parentCode: (NumberConstructor | StringConstructor | ArrayConstructor)[];
|
|
2089
2089
|
optionDisabled: FunctionConstructor;
|
|
2090
2090
|
optionTag: FunctionConstructor;
|
|
2091
2091
|
getSelected: {
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { Table as
|
|
2
|
-
import { getPathValue as
|
|
3
|
-
|
|
4
|
-
const l = function(t, a,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
},
|
|
10
|
-
localStorage.setItem(
|
|
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
|
-
},
|
|
13
|
-
if (!this.cacheCols?.keys) return;
|
|
14
|
-
const t = this.cacheCols.keys.split(".")[0],
|
|
15
|
-
!
|
|
16
|
-
|
|
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
|
-
},
|
|
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
|
|
34
|
-
|
|
35
|
+
if (typeof s.created != "function")
|
|
36
|
+
s.created = f;
|
|
35
37
|
else {
|
|
36
|
-
const t =
|
|
37
|
-
|
|
38
|
-
t.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
|
|
42
|
-
|
|
43
|
+
if (typeof s.updated != "function")
|
|
44
|
+
s.updated = u;
|
|
43
45
|
else {
|
|
44
|
-
const t =
|
|
45
|
-
|
|
46
|
-
t.call(this),
|
|
46
|
+
const t = s.updated;
|
|
47
|
+
s.updated = function() {
|
|
48
|
+
t.call(this), u.call(this);
|
|
47
49
|
};
|
|
48
50
|
}
|
package/dist/umd/iview-mod.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
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)}}}));
|