@lambo-design/shared 1.0.0-beta.60 → 1.0.0-beta.61
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/package.json +22 -22
- package/utils/assist.js +110 -88
- package/config/themes/gold/var.css +0 -0
- package/config/themes/gold/var.css.map +0 -0
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@lambo-design/shared",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"axios": "^0.
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@lambo-design/shared",
|
|
3
|
+
"version": "1.0.0-beta.61",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"author": "lambo",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public",
|
|
10
|
+
"registry": "https://registry.npmjs.org/"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"axios": "^0.24.0",
|
|
14
|
+
"axios-cache-plugin": "^0.1.0",
|
|
15
|
+
"qs": "^6.11.0",
|
|
16
|
+
"xlsx": "http://cicd.lambo.top/package/cdn/xlsx-0.19.1.tgz",
|
|
17
|
+
"classnames": "^2.3.1",
|
|
18
|
+
"xlsx-style": "^0.8.13",
|
|
19
|
+
"moment": "2.29.4"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {}
|
|
22
|
+
}
|
package/utils/assist.js
CHANGED
|
@@ -1,88 +1,110 @@
|
|
|
1
|
-
// deepCopy
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export function deepCopy(data) {
|
|
5
|
-
let i;
|
|
6
|
-
const t = typeOf(data);
|
|
7
|
-
let o;
|
|
8
|
-
|
|
9
|
-
if (t === 'array') {
|
|
10
|
-
o = [];
|
|
11
|
-
} else if (t === 'object') {
|
|
12
|
-
o = {};
|
|
13
|
-
} else {
|
|
14
|
-
return data;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (t === 'array') {
|
|
18
|
-
for (i = 0; i < data.length; i++) {
|
|
19
|
-
o.push(deepCopy(data[i]));
|
|
20
|
-
}
|
|
21
|
-
} else if (t === 'object') {
|
|
22
|
-
for (i in data) {
|
|
23
|
-
o[i] = deepCopy(data[i]);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return o;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export function
|
|
87
|
-
|
|
88
|
-
|
|
1
|
+
// deepCopy
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export function deepCopy(data) {
|
|
5
|
+
let i;
|
|
6
|
+
const t = typeOf(data);
|
|
7
|
+
let o;
|
|
8
|
+
|
|
9
|
+
if (t === 'array') {
|
|
10
|
+
o = [];
|
|
11
|
+
} else if (t === 'object') {
|
|
12
|
+
o = {};
|
|
13
|
+
} else {
|
|
14
|
+
return data;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (t === 'array') {
|
|
18
|
+
for (i = 0; i < data.length; i++) {
|
|
19
|
+
o.push(deepCopy(data[i]));
|
|
20
|
+
}
|
|
21
|
+
} else if (t === 'object') {
|
|
22
|
+
for (i in data) {
|
|
23
|
+
o[i] = deepCopy(data[i]);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return o;
|
|
27
|
+
}
|
|
28
|
+
export function deepMerge(target, ...sources) {
|
|
29
|
+
if (!sources.length) return target;
|
|
30
|
+
const source = sources.shift();
|
|
31
|
+
|
|
32
|
+
if (isObject(target) && isObject(source)) {
|
|
33
|
+
for (const key in source) {
|
|
34
|
+
if (isObject(source[key])) {
|
|
35
|
+
if (!target[key]) Object.assign(target, { [key]: {} });
|
|
36
|
+
deepMerge(target[key], source[key]);
|
|
37
|
+
} else {
|
|
38
|
+
Object.assign(target, { [key]: source[key] });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return deepMerge(target, ...sources);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function typeOf(obj) {
|
|
47
|
+
const toString = Object.prototype.toString;
|
|
48
|
+
const map = {
|
|
49
|
+
'[object Boolean]': 'boolean',
|
|
50
|
+
'[object Number]': 'number',
|
|
51
|
+
'[object String]': 'string',
|
|
52
|
+
'[object Function]': 'function',
|
|
53
|
+
'[object Array]': 'array',
|
|
54
|
+
'[object Date]': 'date',
|
|
55
|
+
'[object RegExp]': 'regExp',
|
|
56
|
+
'[object Undefined]': 'undefined',
|
|
57
|
+
'[object Null]': 'null',
|
|
58
|
+
'[object Object]': 'object'
|
|
59
|
+
};
|
|
60
|
+
return map[toString.call(obj)];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function operateBtn(vm, h, currentRow, operationName, operation, type, permission) {
|
|
64
|
+
return h('Button', {
|
|
65
|
+
props: {
|
|
66
|
+
type: type,
|
|
67
|
+
size: "small",
|
|
68
|
+
ghost: true,
|
|
69
|
+
},
|
|
70
|
+
directives: [(permission === '' || permission === null) ? '' : {
|
|
71
|
+
name: "permission",
|
|
72
|
+
value: permission
|
|
73
|
+
}],
|
|
74
|
+
style: {
|
|
75
|
+
margin: '0 2px'
|
|
76
|
+
},
|
|
77
|
+
on: {
|
|
78
|
+
'click': () => {
|
|
79
|
+
operation(vm, currentRow);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}, operationName);
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function operateHref(vm, h, currentRow, operationName, operation, type, permission) {
|
|
87
|
+
return h('a', {
|
|
88
|
+
style: {
|
|
89
|
+
margin: '0 4px'
|
|
90
|
+
},
|
|
91
|
+
directives: [(permission === '' || permission === null) ? '' : {
|
|
92
|
+
name: "permission",
|
|
93
|
+
value: permission
|
|
94
|
+
}],
|
|
95
|
+
on: {
|
|
96
|
+
'click': () => {
|
|
97
|
+
operation(vm, currentRow);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}, operationName);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function isJson(arg) {
|
|
104
|
+
return typeof (arg) == "object" && Object.prototype.toString.call(arg).toLowerCase() == "[object object]" && !arg.length
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
export function isObject(item) {
|
|
109
|
+
return (item && typeof item === 'object' && !Array.isArray(item));
|
|
110
|
+
}
|
|
File without changes
|
|
File without changes
|