xianniu-ui 0.9.0 → 0.9.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/lib/style/index.css +1 -1
- package/lib/style/tag.css +1 -1
- package/lib/style/upload.css +1 -1
- package/lib/xianniu-ui.common.js +81 -72
- package/lib/xianniu-ui.css +1 -1
- package/lib/xianniu-ui.umd.js +81 -72
- package/lib/xianniu-ui.umd.min.js +3 -3
- package/package.json +1 -1
- package/packages/amount/main.vue +5 -1
- package/packages/style/package.json +2 -1
- package/public/index.html +18 -18
- package/src/utils/node_modules/.package-lock.json +28 -28
- package/src/utils/package.json +14 -14
- package/src/utils/utils.js +25 -20
package/package.json
CHANGED
package/packages/amount/main.vue
CHANGED
|
@@ -65,6 +65,7 @@ export default {
|
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
filters: {
|
|
68
|
+
// 处理精度
|
|
68
69
|
doPrecision(value, precision, isRoundUp) {
|
|
69
70
|
const exponentialForm = Number(`${value}e${precision}`);
|
|
70
71
|
const rounded = isRoundUp
|
|
@@ -72,6 +73,7 @@ export default {
|
|
|
72
73
|
: Math.floor(exponentialForm);
|
|
73
74
|
return Number(`${rounded}e-${precision}`).toFixed(precision);
|
|
74
75
|
},
|
|
76
|
+
// 处理格式
|
|
75
77
|
doFormat(value, hasSeparator, separator) {
|
|
76
78
|
if (!hasSeparator) {
|
|
77
79
|
return value;
|
|
@@ -99,6 +101,7 @@ export default {
|
|
|
99
101
|
? `${sign}${formateValue.value}.${decimalValue}`
|
|
100
102
|
: `${sign}${formateValue.value}`;
|
|
101
103
|
},
|
|
104
|
+
// 转换为大写
|
|
102
105
|
doCapital(value) {
|
|
103
106
|
return numberCapital(value);
|
|
104
107
|
},
|
|
@@ -121,6 +124,7 @@ export default {
|
|
|
121
124
|
},
|
|
122
125
|
},
|
|
123
126
|
computed: {
|
|
127
|
+
// 计算合法精度
|
|
124
128
|
legalPrecision() {
|
|
125
129
|
return this.precision > 0 ? this.precision : 0;
|
|
126
130
|
},
|
|
@@ -135,7 +139,7 @@ export default {
|
|
|
135
139
|
this.isMounted = true;
|
|
136
140
|
},
|
|
137
141
|
methods: {
|
|
138
|
-
//
|
|
142
|
+
// 动画显示数值变化
|
|
139
143
|
$_doAnimateDisplay(fromValue = 0, toValue = 0) {
|
|
140
144
|
/* istanbul ignore next */
|
|
141
145
|
const step = (percent) => {
|
package/public/index.html
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
-
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
7
|
-
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
|
8
|
-
<title><%= htmlWebpackPlugin.options.title %></title>
|
|
9
|
-
<link rel="stylesheet" href="//shadow.elemecdn.com/npm/highlight.js@9.3.0/styles/color-brewer.css">
|
|
10
|
-
</head>
|
|
11
|
-
<body>
|
|
12
|
-
<noscript>
|
|
13
|
-
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
|
14
|
-
</noscript>
|
|
15
|
-
<div id="appDoc"></div>
|
|
16
|
-
<!-- built files will be auto injected -->
|
|
17
|
-
</body>
|
|
18
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
7
|
+
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
|
8
|
+
<title><%= htmlWebpackPlugin.options.title %></title>
|
|
9
|
+
<link rel="stylesheet" href="//shadow.elemecdn.com/npm/highlight.js@9.3.0/styles/color-brewer.css">
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<noscript>
|
|
13
|
+
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
|
14
|
+
</noscript>
|
|
15
|
+
<div id="appDoc"></div>
|
|
16
|
+
<!-- built files will be auto injected -->
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "xianniu-utils",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"lockfileVersion": 2,
|
|
5
|
-
"requires": true,
|
|
6
|
-
"packages": {
|
|
7
|
-
"node_modules/dayjs": {
|
|
8
|
-
"version": "1.11.7",
|
|
9
|
-
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.7.tgz",
|
|
10
|
-
"integrity": "sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ=="
|
|
11
|
-
},
|
|
12
|
-
"node_modules/decimal.js": {
|
|
13
|
-
"version": "10.4.3",
|
|
14
|
-
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz",
|
|
15
|
-
"integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA=="
|
|
16
|
-
},
|
|
17
|
-
"node_modules/good-storage": {
|
|
18
|
-
"version": "1.1.1",
|
|
19
|
-
"resolved": "https://registry.npmjs.org/good-storage/-/good-storage-1.1.1.tgz",
|
|
20
|
-
"integrity": "sha512-+0UEpRT03fJgEJoeTVVz41ISC5+jaQrDIWatQ4BoDQfOiBBsjNanymi9sAtLFdEAADQN0FYR8mGpeqxSCe8oXQ=="
|
|
21
|
-
},
|
|
22
|
-
"node_modules/lodash": {
|
|
23
|
-
"version": "4.17.21",
|
|
24
|
-
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
|
25
|
-
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "xianniu-utils",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"lockfileVersion": 2,
|
|
5
|
+
"requires": true,
|
|
6
|
+
"packages": {
|
|
7
|
+
"node_modules/dayjs": {
|
|
8
|
+
"version": "1.11.7",
|
|
9
|
+
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.7.tgz",
|
|
10
|
+
"integrity": "sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ=="
|
|
11
|
+
},
|
|
12
|
+
"node_modules/decimal.js": {
|
|
13
|
+
"version": "10.4.3",
|
|
14
|
+
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.4.3.tgz",
|
|
15
|
+
"integrity": "sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA=="
|
|
16
|
+
},
|
|
17
|
+
"node_modules/good-storage": {
|
|
18
|
+
"version": "1.1.1",
|
|
19
|
+
"resolved": "https://registry.npmjs.org/good-storage/-/good-storage-1.1.1.tgz",
|
|
20
|
+
"integrity": "sha512-+0UEpRT03fJgEJoeTVVz41ISC5+jaQrDIWatQ4BoDQfOiBBsjNanymi9sAtLFdEAADQN0FYR8mGpeqxSCe8oXQ=="
|
|
21
|
+
},
|
|
22
|
+
"node_modules/lodash": {
|
|
23
|
+
"version": "4.17.21",
|
|
24
|
+
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
|
25
|
+
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
package/src/utils/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "xianniu-utils",
|
|
3
|
-
"version": "0.1.3",
|
|
4
|
-
"description": "一些工具",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"author": "liuzengwei",
|
|
7
|
-
"license": "MIT",
|
|
8
|
-
"dependencies": {
|
|
9
|
-
"dayjs": "^1.10.7",
|
|
10
|
-
"decimal.js": "^10.4.2",
|
|
11
|
-
"good-storage": "^1.1.1",
|
|
12
|
-
"lodash": "^4.17.21"
|
|
13
|
-
}
|
|
14
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "xianniu-utils",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "一些工具",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"author": "liuzengwei",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"dayjs": "^1.10.7",
|
|
10
|
+
"decimal.js": "^10.4.2",
|
|
11
|
+
"good-storage": "^1.1.1",
|
|
12
|
+
"lodash": "^4.17.21"
|
|
13
|
+
}
|
|
14
|
+
}
|
package/src/utils/utils.js
CHANGED
|
@@ -133,34 +133,39 @@ const getFileNameFromUrl = function(url){
|
|
|
133
133
|
/**
|
|
134
134
|
* 根据某个key 对数组去重合并
|
|
135
135
|
* @param {array} arr 需要合并的数组
|
|
136
|
-
* @param {string} key 传入要合并的key
|
|
136
|
+
* @param {string} key 传入要合并的key ,如果是多个key,传入数组
|
|
137
137
|
* @return {array} result
|
|
138
138
|
*/
|
|
139
139
|
const arrMerge = (arr = [], key = '') => {
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
// 处理单个字符串的key,转换为数组形式
|
|
141
|
+
const keys = Array.isArray(key) ? key : [key]
|
|
142
|
+
|
|
143
|
+
if (!keys.length || (keys.length === 1 && keys[0] === '')) {
|
|
144
|
+
throw new Error('错误参数: key是必需的')
|
|
142
145
|
}
|
|
143
|
-
if (!arr.length) return
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
146
|
+
if (!arr.length) return []
|
|
147
|
+
|
|
148
|
+
// 生成复合键的工具函数
|
|
149
|
+
const getKey = (item) => keys.map(k => item[k]).join('|')
|
|
150
|
+
const result = []
|
|
151
|
+
const map = {}
|
|
152
|
+
|
|
153
|
+
for (const item of arr) {
|
|
154
|
+
const compositeKey = getKey(item)
|
|
155
|
+
|
|
156
|
+
if (!map[compositeKey]) {
|
|
157
|
+
const resultItem = { children: [item] }
|
|
158
|
+
keys.forEach(k => {
|
|
159
|
+
resultItem[k] = item[k]
|
|
152
160
|
})
|
|
153
|
-
|
|
161
|
+
|
|
162
|
+
result.push(resultItem)
|
|
163
|
+
map[compositeKey] = resultItem
|
|
154
164
|
} else {
|
|
155
|
-
|
|
156
|
-
var dj = result[j]
|
|
157
|
-
if (dj[key] === ai[key]) {
|
|
158
|
-
dj.children.push(ai)
|
|
159
|
-
break
|
|
160
|
-
}
|
|
161
|
-
}
|
|
165
|
+
map[compositeKey].children.push(item)
|
|
162
166
|
}
|
|
163
167
|
}
|
|
168
|
+
|
|
164
169
|
return result
|
|
165
170
|
}
|
|
166
171
|
// 判空
|