@lx-frontend/wrap-element-ui 0.4.6-beta.0 → 0.4.6-beta.1
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 +10 -10
- package/packages/LxTable/src/LxTable.vue +28 -10
package/package.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lx-frontend/wrap-element-ui",
|
|
3
|
-
"version": "0.4.6-beta.
|
|
3
|
+
"version": "0.4.6-beta.1",
|
|
4
4
|
"description": "wrap-element-ui",
|
|
5
5
|
"author": "Vic <18373209286@163.com>",
|
|
6
6
|
"main": "packages/index.js",
|
|
7
7
|
"private": false,
|
|
8
|
+
"scripts": {
|
|
9
|
+
"serve": "npm run build:style && vue-cli-service serve",
|
|
10
|
+
"build:style": "gulp build --gulpfile packages/theme-default/gulpfile.js",
|
|
11
|
+
"dist": "npm run build:style && vue-cli-service build",
|
|
12
|
+
"build:single": "webpack --config build/build-one-by-one.js",
|
|
13
|
+
"lint": "vue-cli-service lint",
|
|
14
|
+
"test:unit": "vue-cli-service test:unit"
|
|
15
|
+
},
|
|
8
16
|
"dependencies": {
|
|
9
17
|
"cheerio": "^1.0.0-rc.2",
|
|
10
18
|
"core-js": "^3.3.2",
|
|
@@ -36,13 +44,5 @@
|
|
|
36
44
|
"typescript": "~3.5.3",
|
|
37
45
|
"vue-template-compiler": "^2.7.16",
|
|
38
46
|
"webpack-cli": "^3.3.10"
|
|
39
|
-
},
|
|
40
|
-
"scripts": {
|
|
41
|
-
"serve": "npm run build:style && vue-cli-service serve",
|
|
42
|
-
"build:style": "gulp build --gulpfile packages/theme-default/gulpfile.js",
|
|
43
|
-
"dist": "npm run build:style && vue-cli-service build",
|
|
44
|
-
"build:single": "webpack --config build/build-one-by-one.js",
|
|
45
|
-
"lint": "vue-cli-service lint",
|
|
46
|
-
"test:unit": "vue-cli-service test:unit"
|
|
47
47
|
}
|
|
48
|
-
}
|
|
48
|
+
}
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
<ElTableColumn
|
|
27
27
|
v-if="
|
|
28
28
|
customConfig &&
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
customConfig.selection &&
|
|
30
|
+
customConfig.selection.isOpenSelection
|
|
31
31
|
"
|
|
32
32
|
type="selection"
|
|
33
33
|
:width="customConfig.selection.width"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
template
|
|
49
49
|
:name="`${keys[index]}_header`"
|
|
50
50
|
:keys="keys[index]"
|
|
51
|
-
:row="returnSelf
|
|
51
|
+
:row="returnSelf(scope.row)"
|
|
52
52
|
:lable="scope.column"
|
|
53
53
|
:column="scope.$index"
|
|
54
54
|
v-if="getFieldFromConfig(keys[index], 'scopeHeader')"
|
|
@@ -60,7 +60,10 @@
|
|
|
60
60
|
</template>
|
|
61
61
|
<template #default="scope">
|
|
62
62
|
<!-- 支持keys字段为'car.id'或者'id' -->
|
|
63
|
-
|
|
63
|
+
<!-- @vue-expect-error 这里判断完是数组应该不报ts错误 -->
|
|
64
|
+
<div
|
|
65
|
+
v-if="Array.isArray(keys[index]) && keys[index].indexOf('.') != -1"
|
|
66
|
+
>
|
|
64
67
|
<!-- 一个td需要展示多个字段名 -->
|
|
65
68
|
<div v-if="Array.isArray(keys[index])">
|
|
66
69
|
<div v-for="(array, i) in keys[index]" :key="i">
|
|
@@ -69,6 +72,7 @@
|
|
|
69
72
|
</div>
|
|
70
73
|
<!-- 字段formatters存在,数据过滤-->
|
|
71
74
|
<span v-else-if="getFieldFromConfig(keys[index], 'formatters')">
|
|
75
|
+
<!-- @vue-expect-error 这里判断完是数组应该不报ts错误 -->
|
|
72
76
|
{{
|
|
73
77
|
formatterMethods(
|
|
74
78
|
scope.row[keys[index].split(".")[0]][
|
|
@@ -83,7 +87,7 @@
|
|
|
83
87
|
template
|
|
84
88
|
:name="keys[index]"
|
|
85
89
|
:keys="keys[index]"
|
|
86
|
-
:row="returnSelf
|
|
90
|
+
:row="returnSelf(scope.row)"
|
|
87
91
|
:lable="scope.column"
|
|
88
92
|
:column="scope.$index"
|
|
89
93
|
v-else-if="getFieldFromConfig(keys[index], 'template')"
|
|
@@ -92,6 +96,7 @@
|
|
|
92
96
|
<div v-else>
|
|
93
97
|
<!-- 传入不需要截取的列 -->
|
|
94
98
|
<span v-if="getFieldFromConfig(keys[index], 'templateCutOut')">
|
|
99
|
+
<!-- @vue-expect-error 忽略ts错误不改动-->
|
|
95
100
|
{{
|
|
96
101
|
formateValue(
|
|
97
102
|
scope.row[keys[index].split(".")[0]][
|
|
@@ -100,6 +105,7 @@
|
|
|
100
105
|
)
|
|
101
106
|
}}
|
|
102
107
|
</span>
|
|
108
|
+
<!-- @vue-expect-error 忽略ts错误不改动-->
|
|
103
109
|
<Ellipsis
|
|
104
110
|
v-else
|
|
105
111
|
:popoverName="popoverName"
|
|
@@ -116,6 +122,7 @@
|
|
|
116
122
|
>
|
|
117
123
|
<template #popover>
|
|
118
124
|
<div>
|
|
125
|
+
<!-- @vue-expect-error 忽略ts错误不改动-->
|
|
119
126
|
{{
|
|
120
127
|
formateValue(
|
|
121
128
|
scope.row[keys[index].split(".")[0]][
|
|
@@ -137,6 +144,7 @@
|
|
|
137
144
|
</div>
|
|
138
145
|
<!-- 字段formatters存在,数据过滤-->
|
|
139
146
|
<span v-else-if="getFieldFromConfig(keys[index], 'formatters')">
|
|
147
|
+
<!-- @vue-expect-error 忽略ts错误不改动-->
|
|
140
148
|
{{
|
|
141
149
|
formatterMethods(
|
|
142
150
|
scope.row[keys[index]],
|
|
@@ -149,7 +157,7 @@
|
|
|
149
157
|
template
|
|
150
158
|
:name="keys[index]"
|
|
151
159
|
:keys="keys[index]"
|
|
152
|
-
:row="returnSelf
|
|
160
|
+
:row="returnSelf(scope.row)"
|
|
153
161
|
:lable="scope.column"
|
|
154
162
|
:column="scope.$index"
|
|
155
163
|
v-else-if="getFieldFromConfig(keys[index], 'template')"
|
|
@@ -160,6 +168,7 @@
|
|
|
160
168
|
<span v-if="getFieldFromConfig(keys[index], 'templateCutOut')">
|
|
161
169
|
{{ formateValue(scope.row[keys[index]]) }}
|
|
162
170
|
</span>
|
|
171
|
+
<!-- @vue-expect-error 忽略ts错误不改动-->
|
|
163
172
|
<Ellipsis
|
|
164
173
|
v-else
|
|
165
174
|
:popoverName="popoverName"
|
|
@@ -187,7 +196,11 @@
|
|
|
187
196
|
</ElPagination>
|
|
188
197
|
</div>
|
|
189
198
|
</template>
|
|
190
|
-
<script
|
|
199
|
+
<script
|
|
200
|
+
lang="ts"
|
|
201
|
+
setup
|
|
202
|
+
generic="K extends (string | number) | (string | number)[], TableData = Record<string, any>"
|
|
203
|
+
>
|
|
191
204
|
import Ellipsis from "../../Ellipsis";
|
|
192
205
|
|
|
193
206
|
const $emit = defineEmits([
|
|
@@ -225,8 +238,8 @@ const props = withDefaults(
|
|
|
225
238
|
tableRowClassName: () => ({}),
|
|
226
239
|
}
|
|
227
240
|
);
|
|
228
|
-
function returnSelf
|
|
229
|
-
return data
|
|
241
|
+
function returnSelf(data: TableData): TableData {
|
|
242
|
+
return data;
|
|
230
243
|
}
|
|
231
244
|
const handleCurrentChange = (val: any) => {
|
|
232
245
|
$emit("handleCurrentChange", val);
|
|
@@ -262,7 +275,12 @@ const formateValue = (val: string | number | string[]) => {
|
|
|
262
275
|
}
|
|
263
276
|
return val || val === 0 ? val : "--";
|
|
264
277
|
};
|
|
265
|
-
const getFieldFromConfig = (
|
|
278
|
+
const getFieldFromConfig = (
|
|
279
|
+
index: (string | number) | (string | number)[],
|
|
280
|
+
name: string | number
|
|
281
|
+
) => {
|
|
282
|
+
if (Array.isArray(index)) return;
|
|
283
|
+
|
|
266
284
|
return (
|
|
267
285
|
props.customConfig &&
|
|
268
286
|
props.customConfig[index] &&
|