mali-applet-ui 1.0.143 → 1.0.145
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view class="ml-table" :class="className || ''">
|
|
2
|
+
<view class="ml-table" :class="[className || '', {'is-border': border, 'is-ellipsis' : showOverflow}]">
|
|
3
3
|
<view v-if="$slots.top" class="ml-table-top-warpper">
|
|
4
4
|
<slot name="top"></slot>
|
|
5
5
|
</view>
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
</view>
|
|
34
34
|
<view class="table-body-contnet">
|
|
35
35
|
<view class="table-tr" v-for="(row, rowIndex) in tableData" :key="rowIndex">
|
|
36
|
-
<view class="table-td" v-for="(column, columnIndex) in tableColumn" :key="columnIndex" :style="{width: getColWidth(column), height:
|
|
36
|
+
<view class="table-td" v-for="(column, columnIndex) in tableColumn" :key="columnIndex" :style="{width: getColWidth(column), height: getColHeight(column)}" @click="cellTdClick({ type: 'body', row, rowIndex, column, columnIndex })">
|
|
37
37
|
<view :class="['table-cell', column.align ? `align-${column.align}` : '', getCellClass({ type: 'body', row, rowIndex, column, columnIndex })]">
|
|
38
38
|
<text v-if="column.type === 'seq'">{{ rowIndex + 1 }}</text>
|
|
39
39
|
<text v-else-if="column.cellRender && column.cellRender.name === 'Underline'" class="is-underline">{{ getCellValue({ type: 'body', row, rowIndex, column, columnIndex }) }}</text>
|
|
@@ -93,6 +93,7 @@ export default {
|
|
|
93
93
|
props: {
|
|
94
94
|
loading: Boolean,
|
|
95
95
|
className: String,
|
|
96
|
+
border: Boolean,
|
|
96
97
|
height: [Number, String],
|
|
97
98
|
headerData: Array,
|
|
98
99
|
data: Array,
|
|
@@ -101,11 +102,15 @@ export default {
|
|
|
101
102
|
loadStatus: String,
|
|
102
103
|
rowConfig: {
|
|
103
104
|
type: Object,
|
|
104
|
-
|
|
105
|
+
default: () => ({})
|
|
105
106
|
},
|
|
106
107
|
sortConfig: {
|
|
107
108
|
type: Object,
|
|
108
|
-
|
|
109
|
+
default: () => ({})
|
|
110
|
+
},
|
|
111
|
+
showOverflow: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: true
|
|
109
114
|
},
|
|
110
115
|
headerCellClass: [String, Function],
|
|
111
116
|
headerCellFormat: Function,
|
|
@@ -138,9 +143,6 @@ export default {
|
|
|
138
143
|
},
|
|
139
144
|
colMinWidth () {
|
|
140
145
|
return Math.max(20, XEUtils.floor(100 / this.tableColumn.length, 2))
|
|
141
|
-
},
|
|
142
|
-
tdHeight () {
|
|
143
|
-
return this.rowOpts.height ? `${this.rowOpts.height};` : '84rpx'
|
|
144
146
|
}
|
|
145
147
|
},
|
|
146
148
|
watch: {
|
|
@@ -198,13 +200,19 @@ export default {
|
|
|
198
200
|
getCellClass (params) {
|
|
199
201
|
const { row, column } = params
|
|
200
202
|
const cellValue = row[column.field]
|
|
203
|
+
const clss = []
|
|
204
|
+
const showOverflow = XEUtils.isBoolean(column.showOverflow) ? column.showOverflow : this.showOverflow
|
|
205
|
+
if (showOverflow) {
|
|
206
|
+
clss.push('is-ellipsis')
|
|
207
|
+
}
|
|
201
208
|
if (this.cellClass) {
|
|
202
209
|
if (XEUtils.isFunction(this.cellClass)) {
|
|
203
|
-
|
|
210
|
+
clss.push(this.cellClass.call(this.currVM, { ...params, cellValue }))
|
|
211
|
+
} else {
|
|
212
|
+
clss.push(`${this.cellClass}`)
|
|
204
213
|
}
|
|
205
|
-
return `${this.cellClass}`
|
|
206
214
|
}
|
|
207
|
-
return ''
|
|
215
|
+
return clss.join(' ')
|
|
208
216
|
},
|
|
209
217
|
getCellValue (params) {
|
|
210
218
|
const { row, column } = params
|
|
@@ -214,6 +222,10 @@ export default {
|
|
|
214
222
|
}
|
|
215
223
|
return XEUtils.eqNull(cellValue) ? '' : cellValue
|
|
216
224
|
},
|
|
225
|
+
getColHeight (column) {
|
|
226
|
+
const showOverflow = XEUtils.isBoolean(column.showOverflow) ? column.showOverflow : this.showOverflow
|
|
227
|
+
return this.rowOpts.height ? `${this.rowOpts.height};` : (showOverflow ? '84rpx' : '')
|
|
228
|
+
},
|
|
217
229
|
getColWidth (column) {
|
|
218
230
|
if (column.width) {
|
|
219
231
|
if (isNaN(column.width)) {
|
|
@@ -289,6 +301,15 @@ export default {
|
|
|
289
301
|
font-size: $ml-base-font-size;
|
|
290
302
|
box-shadow: 0rpx 0rpx 10rpx -3rpx rgba(0, 0, 0, 0.2);
|
|
291
303
|
background: #fff;
|
|
304
|
+
&.is-border {
|
|
305
|
+
.table-th,
|
|
306
|
+
.table-td {
|
|
307
|
+
border-right: 1px solid rgba(126, 134, 142, 0.16);
|
|
308
|
+
&:last-child {
|
|
309
|
+
border-right: 0;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
292
313
|
.ml-table-warpper {
|
|
293
314
|
overflow: auto;
|
|
294
315
|
}
|
|
@@ -338,6 +359,7 @@ export default {
|
|
|
338
359
|
}
|
|
339
360
|
.table-th {
|
|
340
361
|
position: relative;
|
|
362
|
+
font-size: 28rpx;
|
|
341
363
|
.th-sort {
|
|
342
364
|
position: absolute;
|
|
343
365
|
top: 50%;
|
|
@@ -363,11 +385,17 @@ export default {
|
|
|
363
385
|
color: rgba(39, 42, 48, 0.65);
|
|
364
386
|
border-bottom: 1px solid rgba(126, 134, 142, 0.16);
|
|
365
387
|
box-sizing: border-box;
|
|
388
|
+
font-size: 24rpx;
|
|
389
|
+
min-height: 84rpx;
|
|
366
390
|
}
|
|
367
391
|
.table-cell {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
392
|
+
white-space: normal;
|
|
393
|
+
word-break: break-all;
|
|
394
|
+
&.is-ellipsis {
|
|
395
|
+
overflow: hidden;
|
|
396
|
+
text-overflow: ellipsis;
|
|
397
|
+
white-space: nowrap;
|
|
398
|
+
}
|
|
371
399
|
&.align-left {
|
|
372
400
|
text-align: left;
|
|
373
401
|
}
|
|
@@ -383,6 +411,7 @@ export default {
|
|
|
383
411
|
flex-direction: column;
|
|
384
412
|
min-height: 70rpx;
|
|
385
413
|
justify-content: center;
|
|
414
|
+
border-top: 1px solid rgba(126, 134, 142, 0.16);
|
|
386
415
|
}
|
|
387
416
|
}
|
|
388
417
|
</style>
|