xianniu-ui 0.1.10-beta → 0.1.12-beta
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 +17393 -110
- package/lib/xianniu-ui.umd.js +17393 -110
- package/lib/xianniu-ui.umd.min.js +9 -1
- package/package.json +2 -1
- package/packages/dialog/main.vue +9 -16
- package/packages/import/main.vue +68 -59
- package/packages/style/package.json +22 -22
- package/packages/table/main.vue +9 -141
- package/public/index.html +1 -1
- package/src/index.js +7 -2
- package/src/utils/index.js +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xianniu-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12-beta",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "lib/xianniu-ui.umd.min.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"core-js": "^3.6.5",
|
|
26
26
|
"dayjs": "^1.10.7",
|
|
27
27
|
"good-storage": "^1.1.1",
|
|
28
|
+
"lodash": "^4.17.21",
|
|
28
29
|
"vue": "^2.6.11",
|
|
29
30
|
"vue-lottie": "^0.2.1",
|
|
30
31
|
"vue-router": "^3.2.0",
|
package/packages/dialog/main.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<el-dialog
|
|
3
3
|
:title="title"
|
|
4
|
-
:visible="show"
|
|
4
|
+
:visible.sync="show"
|
|
5
5
|
:width="width ? width : _width"
|
|
6
6
|
:before-close="beforeClose"
|
|
7
7
|
:top="top"
|
|
@@ -10,19 +10,6 @@
|
|
|
10
10
|
@open="$emit('on-open')"
|
|
11
11
|
@opened="$emit('on-opened')"
|
|
12
12
|
>
|
|
13
|
-
<!-- <template #title>
|
|
14
|
-
<div class="flex align-items-center justify-content-between">
|
|
15
|
-
<div>
|
|
16
|
-
<span class="el-dialog__title">{{ title }}</span>
|
|
17
|
-
</div>
|
|
18
|
-
<div>
|
|
19
|
-
<slot name="tools" />
|
|
20
|
-
<div class="el-dialog__headerbtn" @click="onClose">
|
|
21
|
-
<span class="el-dialog__close el-icon el-icon-close close" />
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</template> -->
|
|
26
13
|
<slot />
|
|
27
14
|
<span slot="footer">
|
|
28
15
|
<slot name="footer">
|
|
@@ -46,7 +33,7 @@ export default {
|
|
|
46
33
|
props: {
|
|
47
34
|
beforeClose: {
|
|
48
35
|
type: Function,
|
|
49
|
-
default:
|
|
36
|
+
default: null,
|
|
50
37
|
},
|
|
51
38
|
top: {
|
|
52
39
|
type: String,
|
|
@@ -90,11 +77,17 @@ export default {
|
|
|
90
77
|
|
|
91
78
|
methods: {
|
|
92
79
|
onClose() {
|
|
93
|
-
this.beforeClose()
|
|
80
|
+
this.beforeClose()
|
|
94
81
|
},
|
|
95
82
|
onConfirm() {
|
|
96
83
|
this.$emit("on-confirm");
|
|
97
84
|
},
|
|
85
|
+
// handleBeforeClose() {
|
|
86
|
+
// if (this.beforeClose && typeof this.beforeClose === "function") {
|
|
87
|
+
// return this.beforeClose();
|
|
88
|
+
// }
|
|
89
|
+
// this.onClose();
|
|
90
|
+
// },
|
|
98
91
|
},
|
|
99
92
|
};
|
|
100
93
|
</script>
|
package/packages/import/main.vue
CHANGED
|
@@ -1,61 +1,63 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
</
|
|
46
|
-
<div slot="
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
2
|
+
<xn-dialog
|
|
3
|
+
title="批量导入"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
v-on="$listeners"
|
|
6
|
+
:show.sync="show"
|
|
7
|
+
:before-close="onClose"
|
|
8
|
+
@on-confirm="handleConfirm"
|
|
9
|
+
size="small"
|
|
10
|
+
>
|
|
11
|
+
<div class="xn-import">
|
|
12
|
+
<el-link
|
|
13
|
+
class="mb-20"
|
|
14
|
+
type="success"
|
|
15
|
+
icon="el-icon-download"
|
|
16
|
+
:underline="false"
|
|
17
|
+
@click="handleDownload"
|
|
18
|
+
>下载模板</el-link
|
|
19
|
+
>
|
|
20
|
+
<el-upload
|
|
21
|
+
ref="import"
|
|
22
|
+
action="###"
|
|
23
|
+
class="xn-import-upload"
|
|
24
|
+
v-bind="$attrs"
|
|
25
|
+
drag
|
|
26
|
+
:limit="limit"
|
|
27
|
+
:file-list="fileList"
|
|
28
|
+
:auto-upload="autoUpload"
|
|
29
|
+
:http-request="onSubmitUpload"
|
|
30
|
+
:before-upload="handleUploadBefore"
|
|
31
|
+
:on-exceed="onExceed"
|
|
32
|
+
:on-change="onChange"
|
|
33
|
+
:on-remove="onRemove"
|
|
34
|
+
:accept="accept"
|
|
35
|
+
v-on="$listeners"
|
|
36
|
+
>
|
|
37
|
+
<template slot="trigger">
|
|
38
|
+
<div class="xn-import-trigger">
|
|
39
|
+
<i class="xn-import-trigger__icon el-icon-upload" />
|
|
40
|
+
<span class="xn-import-trigger__text">
|
|
41
|
+
<span>将文件拖到此处,或</span>
|
|
42
|
+
<em>点击上传</em>
|
|
43
|
+
</span>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
<div v-if="tip" slot="tip" class="el-upload__tip">{{ tip }}</div>
|
|
47
|
+
</el-upload>
|
|
48
|
+
<slot name="desc" class="xn-import-desc mt-10 fz-12">
|
|
49
|
+
<el-alert title="注:" type="warning">
|
|
50
|
+
<div>
|
|
51
|
+
<p>
|
|
52
|
+
1、非系统模板的文件会导入失败,请务必使用系统模板,点击上方按钮进行下载
|
|
53
|
+
</p>
|
|
54
|
+
<p>2、导入期间请勿进行其他操作</p>
|
|
55
|
+
<p>3、导入为替换操作,请谨慎操作</p>
|
|
56
|
+
</div>
|
|
57
|
+
</el-alert>
|
|
58
|
+
</slot>
|
|
59
|
+
</div>
|
|
60
|
+
</xn-dialog>
|
|
59
61
|
</template>
|
|
60
62
|
<script>
|
|
61
63
|
export default {
|
|
@@ -66,6 +68,14 @@ export default {
|
|
|
66
68
|
type: Boolean,
|
|
67
69
|
default: false,
|
|
68
70
|
},
|
|
71
|
+
limit: {
|
|
72
|
+
type: Number,
|
|
73
|
+
default: 1,
|
|
74
|
+
},
|
|
75
|
+
autoUpload: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: false,
|
|
78
|
+
},
|
|
69
79
|
tip: {
|
|
70
80
|
type: String,
|
|
71
81
|
default: "仅支持上传excel文件",
|
|
@@ -84,8 +94,7 @@ export default {
|
|
|
84
94
|
fileList: [],
|
|
85
95
|
};
|
|
86
96
|
},
|
|
87
|
-
created() {
|
|
88
|
-
},
|
|
97
|
+
created() {},
|
|
89
98
|
methods: {
|
|
90
99
|
onClose() {
|
|
91
100
|
this.$emit("update:show", false);
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "xn-ui-style",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "lib/index.css",
|
|
6
|
-
"style": "lib/index.css",
|
|
7
|
-
"files": [
|
|
8
|
-
"lib",
|
|
9
|
-
"src"
|
|
10
|
-
],
|
|
11
|
-
"scripts": {
|
|
12
|
-
"style": "gulp"
|
|
13
|
-
},
|
|
14
|
-
"author": "",
|
|
15
|
-
"license": "ISC",
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"gulp": "^4.0.2",
|
|
18
|
-
"gulp-autoprefixer": "^8.0.0",
|
|
19
|
-
"gulp-cssmin": "^0.2.0",
|
|
20
|
-
"gulp-sass": "^5.1.0"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "xn-ui-style",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "lib/index.css",
|
|
6
|
+
"style": "lib/index.css",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib",
|
|
9
|
+
"src"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"style": "gulp"
|
|
13
|
+
},
|
|
14
|
+
"author": "",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"gulp": "^4.0.2",
|
|
18
|
+
"gulp-autoprefixer": "^8.0.0",
|
|
19
|
+
"gulp-cssmin": "^0.2.0",
|
|
20
|
+
"gulp-sass": "^5.1.0"
|
|
21
|
+
}
|
|
22
|
+
}
|
package/packages/table/main.vue
CHANGED
|
@@ -113,101 +113,14 @@
|
|
|
113
113
|
</el-table-column>
|
|
114
114
|
<el-table-column
|
|
115
115
|
width="50px"
|
|
116
|
-
label="
|
|
116
|
+
label="No."
|
|
117
117
|
v-if="index && data.length"
|
|
118
118
|
type="index"
|
|
119
119
|
></el-table-column>
|
|
120
120
|
|
|
121
|
-
<
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
v-bind="item"
|
|
125
|
-
v-on="$listeners"
|
|
126
|
-
:key="idx"
|
|
127
|
-
v-if="isShowColumn(item)"
|
|
128
|
-
>
|
|
129
|
-
<template v-if="item.labelMsg">
|
|
130
|
-
<template slot="header">
|
|
131
|
-
<el-tooltip
|
|
132
|
-
class="item"
|
|
133
|
-
effect="dark"
|
|
134
|
-
:content="item.labelMsg"
|
|
135
|
-
placement="right"
|
|
136
|
-
>
|
|
137
|
-
<span>{{ item.label }} <i class="el-icon-question"></i></span>
|
|
138
|
-
</el-tooltip>
|
|
139
|
-
</template>
|
|
140
|
-
</template>
|
|
141
|
-
<template slot-scope="{ row, $index }">
|
|
142
|
-
<expandDom
|
|
143
|
-
v-if="item.render"
|
|
144
|
-
:column="row"
|
|
145
|
-
:row="row"
|
|
146
|
-
:render="item.render"
|
|
147
|
-
:index="$index"
|
|
148
|
-
></expandDom>
|
|
149
|
-
<template v-else>
|
|
150
|
-
{{ row[item.prop] }}
|
|
151
|
-
</template>
|
|
152
|
-
<!-- 更多操作 -->
|
|
153
|
-
<template v-if="item.more && item.more.options.length">
|
|
154
|
-
<template v-for="(itemBtn, idxBtn) in item.more.options">
|
|
155
|
-
<expand-dom
|
|
156
|
-
v-if="itemBtn.render && itemBtn.show && itemBtn.show(row)"
|
|
157
|
-
:key="idxBtn"
|
|
158
|
-
:column="itemBtn"
|
|
159
|
-
:row="row"
|
|
160
|
-
:render="itemBtn.render"
|
|
161
|
-
:index="idxBtn"
|
|
162
|
-
/>
|
|
163
|
-
<template v-else>
|
|
164
|
-
<el-popconfirm
|
|
165
|
-
v-if="itemBtn.isPopConfirm"
|
|
166
|
-
:title="
|
|
167
|
-
itemBtn.options.title ||
|
|
168
|
-
`确定${label(itemBtn, row)}吗?`
|
|
169
|
-
"
|
|
170
|
-
:key="idxBtn"
|
|
171
|
-
:confirm-button-text="itemBtn.options.confirmButtonText"
|
|
172
|
-
class="ml-10"
|
|
173
|
-
@confirm="handleClick(itemBtn.method, row, $index)"
|
|
174
|
-
>
|
|
175
|
-
<el-button
|
|
176
|
-
:type="itemBtn.type || 'text'"
|
|
177
|
-
:size="itemBtn.size || 'mini'"
|
|
178
|
-
:icon="itemBtn.icon"
|
|
179
|
-
:plain="itemBtn.plain"
|
|
180
|
-
slot="reference"
|
|
181
|
-
>{{ label(itemBtn, row) }}</el-button
|
|
182
|
-
>
|
|
183
|
-
</el-popconfirm>
|
|
184
|
-
<template v-else>
|
|
185
|
-
<el-button
|
|
186
|
-
v-if="itemBtn.show ? itemBtn.show(row) : true"
|
|
187
|
-
:key="idxBtn"
|
|
188
|
-
:disabled="
|
|
189
|
-
itemBtn.disabled ? itemBtn.disabled(row) : false
|
|
190
|
-
"
|
|
191
|
-
:type="itemBtn.type || 'text'"
|
|
192
|
-
:size="itemBtn.size || 'mini'"
|
|
193
|
-
:icon="itemBtn.icon"
|
|
194
|
-
:plain="itemBtn.plain"
|
|
195
|
-
@click="handleClick(itemBtn.method, row, $index)"
|
|
196
|
-
>{{ label(itemBtn, row) }}</el-button
|
|
197
|
-
>
|
|
198
|
-
</template>
|
|
199
|
-
</template>
|
|
200
|
-
</template>
|
|
201
|
-
</template>
|
|
202
|
-
</template>
|
|
203
|
-
</el-table-column>
|
|
204
|
-
<!-- <column
|
|
205
|
-
:key="idx"
|
|
206
|
-
v-if="item.checked === true"
|
|
207
|
-
v-bind="item"
|
|
208
|
-
></column> -->
|
|
209
|
-
</template>
|
|
210
|
-
</slot>
|
|
121
|
+
<template v-for="(item, idx) in columns">
|
|
122
|
+
<column :key="idx" v-if="item.checked === true" v-bind="item"></column>
|
|
123
|
+
</template>
|
|
211
124
|
</el-table>
|
|
212
125
|
|
|
213
126
|
<template v-if="!$utils.isEmpty(page)">
|
|
@@ -223,30 +136,10 @@
|
|
|
223
136
|
</template>
|
|
224
137
|
|
|
225
138
|
<script>
|
|
139
|
+
import column from "./column.vue";
|
|
226
140
|
export default {
|
|
227
141
|
name: "XnTable",
|
|
228
|
-
components: {
|
|
229
|
-
expandDom: {
|
|
230
|
-
functional: true,
|
|
231
|
-
props: {
|
|
232
|
-
row: Object,
|
|
233
|
-
render: Function,
|
|
234
|
-
index: Number,
|
|
235
|
-
column: {
|
|
236
|
-
type: Object,
|
|
237
|
-
default: null,
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
render: (h, ctx) => {
|
|
241
|
-
const params = {
|
|
242
|
-
row: ctx.props.row,
|
|
243
|
-
index: ctx.props.index,
|
|
244
|
-
};
|
|
245
|
-
if (ctx.props.column) params.column = ctx.props.column;
|
|
246
|
-
return ctx.props.render(h, params);
|
|
247
|
-
},
|
|
248
|
-
},
|
|
249
|
-
},
|
|
142
|
+
components: { column },
|
|
250
143
|
props: {
|
|
251
144
|
tools: {
|
|
252
145
|
type: Array,
|
|
@@ -288,23 +181,7 @@ export default {
|
|
|
288
181
|
selectedData: [],
|
|
289
182
|
};
|
|
290
183
|
},
|
|
291
|
-
computed: {
|
|
292
|
-
label() {
|
|
293
|
-
return (itemBtn, row) => {
|
|
294
|
-
return typeof itemBtn.label === "function"
|
|
295
|
-
? itemBtn.label(row)
|
|
296
|
-
: itemBtn.label;
|
|
297
|
-
};
|
|
298
|
-
},
|
|
299
|
-
isShowColumn() {
|
|
300
|
-
return (row) => {
|
|
301
|
-
if (row.show != undefined) {
|
|
302
|
-
return typeof row.show === "function" ? row.show() : row.show;
|
|
303
|
-
}
|
|
304
|
-
return true;
|
|
305
|
-
};
|
|
306
|
-
},
|
|
307
|
-
},
|
|
184
|
+
computed: {},
|
|
308
185
|
created() {
|
|
309
186
|
this.columns.length &&
|
|
310
187
|
this.columns.forEach((item) => {
|
|
@@ -321,8 +198,8 @@ export default {
|
|
|
321
198
|
const res = this.data.filter((item) => item.id === val.id);
|
|
322
199
|
this.$emit("on-single", res);
|
|
323
200
|
},
|
|
324
|
-
handleToolsItem(row,
|
|
325
|
-
|
|
201
|
+
handleToolsItem(row, index) {
|
|
202
|
+
this.$emit("on-tools", { row, index });
|
|
326
203
|
},
|
|
327
204
|
handleChangeToolshow(item) {
|
|
328
205
|
item.checked = item.checked === true ? false : true;
|
|
@@ -342,15 +219,6 @@ export default {
|
|
|
342
219
|
doLayout() {
|
|
343
220
|
this.$refs.table.doLayout();
|
|
344
221
|
},
|
|
345
|
-
handleClick(method, row, index) {
|
|
346
|
-
if (this.$parent) {
|
|
347
|
-
this.$parent.$emit("handle-buttons", {
|
|
348
|
-
method,
|
|
349
|
-
row,
|
|
350
|
-
index,
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
222
|
},
|
|
355
223
|
};
|
|
356
224
|
</script>
|
package/public/index.html
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<noscript>
|
|
13
13
|
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
|
14
14
|
</noscript>
|
|
15
|
-
<div id="
|
|
15
|
+
<div id="appDoc"></div>
|
|
16
16
|
<!-- built files will be auto injected -->
|
|
17
17
|
</body>
|
|
18
18
|
</html>
|
package/src/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import XnImport from '../packages/import/index'
|
|
|
13
13
|
import XnExport from '../packages/export/index'
|
|
14
14
|
|
|
15
15
|
import Utils from 'xn-ui/src/utils/index'
|
|
16
|
+
const doc = 'http://lzwr.gitee.io/xn-ui/#/'
|
|
16
17
|
const components = [
|
|
17
18
|
XnDialog,
|
|
18
19
|
XnTable,
|
|
@@ -28,7 +29,9 @@ const components = [
|
|
|
28
29
|
XnExport
|
|
29
30
|
]
|
|
30
31
|
const version = require('../package.json').version
|
|
31
|
-
|
|
32
|
+
if (process.env.NODE_ENV && process.env.NODE_ENV === 'development') {
|
|
33
|
+
console.log(`doc:${doc}`);
|
|
34
|
+
}
|
|
32
35
|
const install = function (Vue) {
|
|
33
36
|
if (install.installed) return
|
|
34
37
|
if (!Vue.prototype.$ELEMENT) throw new Error('缺失 element-ui,请进行安装')
|
|
@@ -38,13 +41,14 @@ const install = function (Vue) {
|
|
|
38
41
|
})
|
|
39
42
|
|
|
40
43
|
Vue.prototype.$XN = {
|
|
41
|
-
uploadUrl: '
|
|
44
|
+
uploadUrl: ''
|
|
42
45
|
}
|
|
43
46
|
Vue.prototype.$utils = Utils.$utils
|
|
44
47
|
Vue.prototype.$reg = Utils.$reg
|
|
45
48
|
Vue.prototype.$format = Utils.$format
|
|
46
49
|
Vue.prototype.$dayjs = Utils.$dayjs
|
|
47
50
|
Vue.prototype.$storage = Utils.$storage
|
|
51
|
+
Vue.prototype.$lodash = Utils.$lodash
|
|
48
52
|
|
|
49
53
|
}
|
|
50
54
|
if (typeof window !== 'undefined' && window.Vue) {
|
|
@@ -53,6 +57,7 @@ if (typeof window !== 'undefined' && window.Vue) {
|
|
|
53
57
|
|
|
54
58
|
export default {
|
|
55
59
|
version,
|
|
60
|
+
doc,
|
|
56
61
|
install,
|
|
57
62
|
XnDialog,
|
|
58
63
|
XnTable,
|
package/src/utils/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import format from './format'
|
|
|
4
4
|
import dayjs from './dayjs'
|
|
5
5
|
import storage from './storage'
|
|
6
6
|
import utils from './utils'
|
|
7
|
-
|
|
7
|
+
import lodash from 'lodash'
|
|
8
8
|
const version = () => {
|
|
9
9
|
return `xianniu-tools@${require('./package.json').version}`
|
|
10
10
|
}
|
|
@@ -14,6 +14,7 @@ export default {
|
|
|
14
14
|
$reg: reg,
|
|
15
15
|
$format: format,
|
|
16
16
|
$dayjs: dayjs,
|
|
17
|
+
$lodash: lodash,
|
|
17
18
|
$storage: storage,
|
|
18
19
|
$utils: utils
|
|
19
20
|
}
|