mali-applet-ui 1.0.151 → 1.0.152

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.
@@ -37,6 +37,7 @@
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>
40
+ <text v-else-if="column.cellRender && column.cellRender.name === 'TextEllipsis'" class="text-ellipsis">{{ getTextEllipsis({ type: 'body', row, rowIndex, column, columnIndex }) }}</text>
40
41
  <ml-amount-text v-else-if="column.cellRender && column.cellRender.name === 'MlAmountText'" :value="row[column.field]" :simplify="column.cellRender.props ? column.cellRender.props.simplify : false"></ml-amount-text>
41
42
  <ml-progress-bar
42
43
  v-else-if="column.cellRender && column.cellRender.name === 'MlProgressBar'"
@@ -133,10 +134,10 @@ export default {
133
134
  },
134
135
  computed: {
135
136
  rowOpts () {
136
- return this.rowConfig ? { ...this.rowConfig } : {}
137
+ return { ...this.rowConfig }
137
138
  },
138
139
  sortOpts () {
139
- return this.sortConfig ? { ...this.sortConfig } : {}
140
+ return { ...this.sortConfig }
140
141
  },
141
142
  tableStyle () {
142
143
  return `height:${this.height ? (isNaN(this.height) ? this.height : `${this.height}rpx`) : ''}`
@@ -222,9 +223,20 @@ export default {
222
223
  }
223
224
  return XEUtils.eqNull(cellValue) ? '' : cellValue
224
225
  },
226
+ getTextEllipsis (params) {
227
+ const { column } = params
228
+ const cellText = this.getCellValue(params)
229
+ const maxSize = (column.width ? Math.floor(column.width / 26) : 4) * 2
230
+ if (cellText && cellText.length > maxSize) {
231
+ return `${cellText.substring(0, maxSize - 1)}...`
232
+ }
233
+ return cellText
234
+ },
225
235
  getColHeight (column) {
226
- const showOverflow = XEUtils.isBoolean(column.showOverflow) ? column.showOverflow : this.showOverflow
227
- return this.rowOpts.height ? `${this.rowOpts.height};` : (showOverflow ? '84rpx' : '')
236
+ if (this.rowOpts.height) {
237
+ return `${this.rowOpts.height};`
238
+ }
239
+ return this.showOverflow ? '84rpx' : ''
228
240
  },
229
241
  getColWidth (column) {
230
242
  if (column.width) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.0.151",
3
+ "version": "1.0.152",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "lib",