xianniu-ui 0.9.3 → 0.9.5
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/xianniu-ui.common.js +64 -38
- package/lib/xianniu-ui.umd.js +64 -38
- package/lib/xianniu-ui.umd.min.js +2 -2
- package/package.json +68 -65
- package/packages/table/main.vue +10 -0
- package/src/utils/utils.js +19 -5
package/package.json
CHANGED
|
@@ -1,65 +1,68 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "xianniu-ui",
|
|
3
|
-
"version": "0.9.
|
|
4
|
-
"private": false,
|
|
5
|
-
"main": "lib/xianniu-ui.umd.min.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "cross-env NODE_ENV=development vue-cli-service serve",
|
|
8
|
-
"build": "cross-env NODE_ENV=production vue-cli-service build",
|
|
9
|
-
"build:lib": "npm run style && cross-env NODE_ENV=production vue-cli-service build --target lib --name xianniu-ui --dest lib src/index.js && cp-cli packages/style/lib lib/style && cp-cli packages/style/src/theme lib/style/theme",
|
|
10
|
-
"style": "gulp --gulpfile ./packages/style/gulpfile.js",
|
|
11
|
-
"play": "cross-env NODE_ENV=development PLAY_ENV=true vue-cli-service serve",
|
|
12
|
-
"deploy": "bash deploy.sh",
|
|
13
|
-
"lint": "vue-cli-service lint",
|
|
14
|
-
"release": "node ./build/release.js"
|
|
15
|
-
},
|
|
16
|
-
"license": "MIT",
|
|
17
|
-
"files": [
|
|
18
|
-
"lib",
|
|
19
|
-
"src",
|
|
20
|
-
"packages",
|
|
21
|
-
"plugins",
|
|
22
|
-
"public"
|
|
23
|
-
],
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"ali-oss": "^6.17.1",
|
|
26
|
-
"core-js": "^3.6.5",
|
|
27
|
-
"uuid": "^9.0.0",
|
|
28
|
-
"vue": "^2.7.14",
|
|
29
|
-
"vue-lottie": "^0.2.1",
|
|
30
|
-
"vue-router": "^3.2.0",
|
|
31
|
-
"vuex": "^3.6.2"
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@babel/preset-env": "^7.16.7",
|
|
35
|
-
"@vue/cli-plugin-babel": "~4.5.0",
|
|
36
|
-
"@vue/cli-plugin-eslint": "~4.5.0",
|
|
37
|
-
"@vue/cli-plugin-router": "~4.5.0",
|
|
38
|
-
"@vue/cli-service": "~4.5.0",
|
|
39
|
-
"@vue/component-compiler-utils": "^2.6.0",
|
|
40
|
-
"babel-eslint": "^10.1.0",
|
|
41
|
-
"babel-plugin-component": "^1.1.1",
|
|
42
|
-
"babel-plugin-module-resolver": "^2.7.1",
|
|
43
|
-
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
44
|
-
"copy-webpack-plugin": "^5.1.2",
|
|
45
|
-
"cp-cli": "^2.0.0",
|
|
46
|
-
"cross-env": "^7.0.3",
|
|
47
|
-
"element-ui": "^2.15.13",
|
|
48
|
-
"eslint": "^6.7.2",
|
|
49
|
-
"eslint-plugin-vue": "^6.2.2",
|
|
50
|
-
"highlight.js": "^9.3.0",
|
|
51
|
-
"html-loader": "^3.0.1",
|
|
52
|
-
"inquirer": "^8.2.6",
|
|
53
|
-
"markdown-it": "^8.4.2",
|
|
54
|
-
"markdown-it-anchor": "^5.3.0",
|
|
55
|
-
"markdown-it-chain": "^1.3.0",
|
|
56
|
-
"markdown-it-container": "^2.0.0",
|
|
57
|
-
"markdown-loader": "^6.0.0",
|
|
58
|
-
"mini-css-extract-plugin": "^0.4.1",
|
|
59
|
-
"sass": "^1.32.6",
|
|
60
|
-
"sass-loader": "^8.0.2",
|
|
61
|
-
"shelljs": "^0.8.5",
|
|
62
|
-
"transliteration": "^1.1.11",
|
|
63
|
-
"vue-template-compiler": "^2.7.14"
|
|
64
|
-
}
|
|
65
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "xianniu-ui",
|
|
3
|
+
"version": "0.9.5",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "lib/xianniu-ui.umd.min.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "cross-env NODE_ENV=development vue-cli-service serve",
|
|
8
|
+
"build": "cross-env NODE_ENV=production vue-cli-service build",
|
|
9
|
+
"build:lib": "npm run style && cross-env NODE_ENV=production vue-cli-service build --target lib --name xianniu-ui --dest lib src/index.js && cp-cli packages/style/lib lib/style && cp-cli packages/style/src/theme lib/style/theme",
|
|
10
|
+
"style": "gulp --gulpfile ./packages/style/gulpfile.js",
|
|
11
|
+
"play": "cross-env NODE_ENV=development PLAY_ENV=true vue-cli-service serve",
|
|
12
|
+
"deploy": "bash deploy.sh",
|
|
13
|
+
"lint": "vue-cli-service lint",
|
|
14
|
+
"release": "node ./build/release.js"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"files": [
|
|
18
|
+
"lib",
|
|
19
|
+
"src",
|
|
20
|
+
"packages",
|
|
21
|
+
"plugins",
|
|
22
|
+
"public"
|
|
23
|
+
],
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"ali-oss": "^6.17.1",
|
|
26
|
+
"core-js": "^3.6.5",
|
|
27
|
+
"uuid": "^9.0.0",
|
|
28
|
+
"vue": "^2.7.14",
|
|
29
|
+
"vue-lottie": "^0.2.1",
|
|
30
|
+
"vue-router": "^3.2.0",
|
|
31
|
+
"vuex": "^3.6.2"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@babel/preset-env": "^7.16.7",
|
|
35
|
+
"@vue/cli-plugin-babel": "~4.5.0",
|
|
36
|
+
"@vue/cli-plugin-eslint": "~4.5.0",
|
|
37
|
+
"@vue/cli-plugin-router": "~4.5.0",
|
|
38
|
+
"@vue/cli-service": "~4.5.0",
|
|
39
|
+
"@vue/component-compiler-utils": "^2.6.0",
|
|
40
|
+
"babel-eslint": "^10.1.0",
|
|
41
|
+
"babel-plugin-component": "^1.1.1",
|
|
42
|
+
"babel-plugin-module-resolver": "^2.7.1",
|
|
43
|
+
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
44
|
+
"copy-webpack-plugin": "^5.1.2",
|
|
45
|
+
"cp-cli": "^2.0.0",
|
|
46
|
+
"cross-env": "^7.0.3",
|
|
47
|
+
"element-ui": "^2.15.13",
|
|
48
|
+
"eslint": "^6.7.2",
|
|
49
|
+
"eslint-plugin-vue": "^6.2.2",
|
|
50
|
+
"highlight.js": "^9.3.0",
|
|
51
|
+
"html-loader": "^3.0.1",
|
|
52
|
+
"inquirer": "^8.2.6",
|
|
53
|
+
"markdown-it": "^8.4.2",
|
|
54
|
+
"markdown-it-anchor": "^5.3.0",
|
|
55
|
+
"markdown-it-chain": "^1.3.0",
|
|
56
|
+
"markdown-it-container": "^2.0.0",
|
|
57
|
+
"markdown-loader": "^6.0.0",
|
|
58
|
+
"mini-css-extract-plugin": "^0.4.1",
|
|
59
|
+
"sass": "^1.32.6",
|
|
60
|
+
"sass-loader": "^8.0.2",
|
|
61
|
+
"shelljs": "^0.8.5",
|
|
62
|
+
"transliteration": "^1.1.11",
|
|
63
|
+
"vue-template-compiler": "^2.7.14"
|
|
64
|
+
},
|
|
65
|
+
"volta": {
|
|
66
|
+
"node": "16.13.0"
|
|
67
|
+
}
|
|
68
|
+
}
|
package/packages/table/main.vue
CHANGED
|
@@ -98,6 +98,7 @@
|
|
|
98
98
|
label="序号"
|
|
99
99
|
v-if="index && data.length"
|
|
100
100
|
type="index"
|
|
101
|
+
:index="handleIndex"
|
|
101
102
|
></el-table-column>
|
|
102
103
|
<slot>
|
|
103
104
|
<column
|
|
@@ -206,6 +207,15 @@ export default {
|
|
|
206
207
|
isRadio() {
|
|
207
208
|
return this.type === "radio" || this.radio;
|
|
208
209
|
},
|
|
210
|
+
handleIndex() {
|
|
211
|
+
return (index) => {
|
|
212
|
+
if (this.page && this.page.pageNum) {
|
|
213
|
+
return (this.page.pageNum - 1) * this.page.pageSize + index + 1;
|
|
214
|
+
} else {
|
|
215
|
+
return index + 1;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
},
|
|
209
219
|
},
|
|
210
220
|
created() {},
|
|
211
221
|
updated() {
|
package/src/utils/utils.js
CHANGED
|
@@ -131,7 +131,7 @@ const getFileNameFromUrl = function(url){
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
|
-
* 根据某个key
|
|
134
|
+
* 根据某个key 对数组去重合并,忽略空值属性
|
|
135
135
|
* @param {array} arr 需要合并的数组
|
|
136
136
|
* @param {string} key 传入要合并的key ,如果是多个key,传入数组
|
|
137
137
|
* @return {array} result
|
|
@@ -145,18 +145,31 @@ const arrMerge = (arr = [], key = '') => {
|
|
|
145
145
|
}
|
|
146
146
|
if (!arr.length) return []
|
|
147
147
|
|
|
148
|
-
//
|
|
149
|
-
const getKey = (item) =>
|
|
148
|
+
// 生成复合键的工具函数,跳过空值属性
|
|
149
|
+
const getKey = (item) => {
|
|
150
|
+
return keys
|
|
151
|
+
.filter(k => item[k] !== null && item[k] !== undefined && item[k] !== '') // 过滤掉空值属性
|
|
152
|
+
.map(k => item[k])
|
|
153
|
+
.join('|')
|
|
154
|
+
}
|
|
155
|
+
|
|
150
156
|
const result = []
|
|
151
157
|
const map = {}
|
|
152
158
|
|
|
153
159
|
for (const item of arr) {
|
|
154
160
|
const compositeKey = getKey(item)
|
|
155
|
-
|
|
161
|
+
|
|
162
|
+
// 如果所有指定属性都为空,则跳过该项
|
|
163
|
+
if (!compositeKey) continue
|
|
164
|
+
|
|
156
165
|
if (!map[compositeKey]) {
|
|
157
166
|
const resultItem = { children: [item] }
|
|
167
|
+
|
|
168
|
+
// 只添加非空属性到结果对象
|
|
158
169
|
keys.forEach(k => {
|
|
159
|
-
|
|
170
|
+
if (item[k] !== undefined && item[k] !== null && item[k] !== '') {
|
|
171
|
+
resultItem[k] = item[k]
|
|
172
|
+
}
|
|
160
173
|
})
|
|
161
174
|
|
|
162
175
|
result.push(resultItem)
|
|
@@ -168,6 +181,7 @@ const arrMerge = (arr = [], key = '') => {
|
|
|
168
181
|
|
|
169
182
|
return result
|
|
170
183
|
}
|
|
184
|
+
|
|
171
185
|
// 判空
|
|
172
186
|
const isBlank = (str) => {
|
|
173
187
|
if (str === null || (!str && str !== 0)) {
|