@94ai/nf-table 8.0.1 → 8.0.8
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/index.d.ts +32 -6
- package/lib/nf-table.cjs.js +169 -80
- package/lib/nf-table.esm-bundler.js +170 -81
- package/lib/nf-table.vue.d.ts +9 -4
- package/lib/types.d.ts +2 -2
- package/package/nf-column-check-drawer.vue +92 -8
- package/package/nf-table.vue +77 -68
- package/package/types.ts +2 -2
- package/package.json +9 -9
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
<transition-group name="nf-slide-fade" tag="ul">
|
|
60
60
|
<template v-for="(dragElement, index) in fixedColumn" >
|
|
61
61
|
<li
|
|
62
|
-
v-if="!dragElement.initHidden && dragElement.prop !== operationPropKey"
|
|
62
|
+
v-if="!dragElement.initHidden && dragElement.prop !== operationPropKey && dragElement.prop !== 'selection'"
|
|
63
63
|
:key="dragElement.prop || index"
|
|
64
64
|
class="nf-drag-element"
|
|
65
65
|
>
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
>
|
|
101
101
|
<transition-group name="nf-slide-fade" tag="ul">
|
|
102
102
|
<template v-for="(dragElement, index) in unFixedColumn">
|
|
103
|
-
<li v-if="!dragElement.initHidden" :key="dragElement.prop || index" class="nf-drag-element">
|
|
103
|
+
<li v-if="!dragElement.initHidden && dragElement.prop !== operationPropKey && dragElement.prop !== 'selection'" :key="dragElement.prop || index" class="nf-drag-element">
|
|
104
104
|
<span class="nf-handle">
|
|
105
105
|
<i class="iconfont icon-ketuozhuai nf-handle" />
|
|
106
106
|
<span>{{ dragElement.addLabel || dragElement.label }}</span>
|
|
@@ -260,13 +260,40 @@ const checkedCount = ref(0) // 勾选的数量
|
|
|
260
260
|
const updateColumn = () => {
|
|
261
261
|
fixedColumn.value = []
|
|
262
262
|
unFixedColumn.value = []
|
|
263
|
-
currentTable.value.map(item => {
|
|
263
|
+
currentTable.value.filter(item => !item.initHidden).map(item => {
|
|
264
264
|
if (item.attr.fixed) {
|
|
265
265
|
fixedColumn.value.push(item)
|
|
266
266
|
} else {
|
|
267
267
|
unFixedColumn.value.push(item)
|
|
268
268
|
}
|
|
269
269
|
})
|
|
270
|
+
updateCheckStatus()
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
const pullAwayColumn = (column) => {
|
|
275
|
+
const unFixedIndex = unFixedColumn.value.findIndex(item => item.prop === column.prop)
|
|
276
|
+
const fixedIndex = fixedColumn.value.findIndex(item => item.prop === column.prop)
|
|
277
|
+
if (unFixedIndex > -1) {
|
|
278
|
+
unFixedColumn.value.splice(unFixedIndex, 1)
|
|
279
|
+
} else if (fixedIndex > -1) {
|
|
280
|
+
fixedColumn.value.splice(fixedIndex, 1)
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const insertColumn = (column, append = false) => {
|
|
285
|
+
const unFixedIndex = unFixedColumn.value.findIndex(item => item.prop === column.prop)
|
|
286
|
+
const fixedIndex = fixedColumn.value.findIndex(item => item.prop === column.prop)
|
|
287
|
+
if (unFixedIndex === -1 && fixedIndex === -1) {
|
|
288
|
+
if (append) {
|
|
289
|
+
unFixedColumn.value.push(column)
|
|
290
|
+
} else {
|
|
291
|
+
unFixedColumn.value.unshift(column)
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
const updateCheckStatus = () => {
|
|
270
297
|
// 勾选状态
|
|
271
298
|
showColumn.value = currentTable.value.filter(i => !i.initHidden).map(item => item.prop)
|
|
272
299
|
// [全选 checkbox] 展示状态
|
|
@@ -295,7 +322,7 @@ const handleSearch = (str) => {
|
|
|
295
322
|
}
|
|
296
323
|
})
|
|
297
324
|
setFields(searchValue)
|
|
298
|
-
|
|
325
|
+
updateCheckStatus()
|
|
299
326
|
}
|
|
300
327
|
|
|
301
328
|
/**
|
|
@@ -305,26 +332,70 @@ const handleSearch = (str) => {
|
|
|
305
332
|
const checkAll = ref(false)
|
|
306
333
|
const isIndeterminate = ref(false) // 来自官方解释:indeterminate 属性用以表示 checkbox 的不确定状态,一般用于实现全选的效果
|
|
307
334
|
const handleCheckAllChange = (v) => {
|
|
335
|
+
if (v) { // 全选前为空,全选还原成最原始默认的顺序
|
|
336
|
+
let flag = false
|
|
337
|
+
if (columnName.value && fields.value.length) { // 搜索时,全选
|
|
338
|
+
if (searchValue.length && currentTable.value.length && searchValue.length === currentTable.value.length) {
|
|
339
|
+
if (!unFixedColumn.value.length && !fixedColumn.value.length) {
|
|
340
|
+
flag = true
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
} else if (!unFixedColumn.value.length && !fixedColumn.value.length) {
|
|
344
|
+
flag = true
|
|
345
|
+
}
|
|
346
|
+
if (flag) {
|
|
347
|
+
fixedColumn.value = []
|
|
348
|
+
unFixedColumn.value = []
|
|
349
|
+
const newColumns: Record<string, any>[] = []
|
|
350
|
+
props.tableColumns.forEach(column => {
|
|
351
|
+
const item = currentTable.value.find(item => item.prop === column.prop)
|
|
352
|
+
if (item) {
|
|
353
|
+
item.initHidden = false
|
|
354
|
+
newColumns.push(item)
|
|
355
|
+
}
|
|
356
|
+
})
|
|
357
|
+
currentTable.value = newColumns
|
|
358
|
+
currentTable.value.map(item => {
|
|
359
|
+
if (item.attr.fixed) {
|
|
360
|
+
fixedColumn.value.push(item)
|
|
361
|
+
} else {
|
|
362
|
+
unFixedColumn.value.push(item)
|
|
363
|
+
}
|
|
364
|
+
})
|
|
365
|
+
updateCheckStatus()
|
|
366
|
+
isIndeterminate.value = false
|
|
367
|
+
return
|
|
368
|
+
}
|
|
369
|
+
}
|
|
308
370
|
// 搜索时,全选
|
|
309
371
|
if (columnName.value && fields.value.length) {
|
|
310
372
|
searchValue.map(item => {
|
|
373
|
+
if (v) { // 追加
|
|
374
|
+
insertColumn(item, true)
|
|
375
|
+
} else {
|
|
376
|
+
pullAwayColumn(item)
|
|
377
|
+
}
|
|
311
378
|
if (!unChangedColumn.value.includes(item.prop)) {
|
|
312
379
|
item.initHidden = !v
|
|
313
380
|
// 清除列目时,清除固定属性
|
|
314
381
|
v ? '' : item.attr.fixed = false
|
|
315
382
|
}
|
|
316
383
|
})
|
|
317
|
-
updateColumn()
|
|
318
384
|
} else {
|
|
319
385
|
currentTable.value.map(item => {
|
|
386
|
+
if (v) { // 追加
|
|
387
|
+
insertColumn(item, true)
|
|
388
|
+
} else {
|
|
389
|
+
pullAwayColumn(item)
|
|
390
|
+
}
|
|
320
391
|
if (!unChangedColumn.value.includes(item.prop)) {
|
|
321
392
|
item.initHidden = !v
|
|
322
393
|
// 清除列目时,清除固定属性
|
|
323
394
|
v ? '' : item.attr.fixed = false
|
|
324
395
|
}
|
|
325
396
|
})
|
|
326
|
-
updateColumn()
|
|
327
397
|
}
|
|
398
|
+
updateCheckStatus()
|
|
328
399
|
isIndeterminate.value = false
|
|
329
400
|
}
|
|
330
401
|
|
|
@@ -339,9 +410,10 @@ const handleCheckedChange = (v, prop) => {
|
|
|
339
410
|
item.initHidden = !v
|
|
340
411
|
// 清除列目时,清除固定属性
|
|
341
412
|
v ? '' : item.attr.fixed = false
|
|
413
|
+
v ? insertColumn(item, true) : pullAwayColumn(item)
|
|
342
414
|
}
|
|
343
415
|
})
|
|
344
|
-
|
|
416
|
+
updateCheckStatus()
|
|
345
417
|
}
|
|
346
418
|
|
|
347
419
|
/**
|
|
@@ -353,8 +425,20 @@ const handleFixed = (v, prop) => {
|
|
|
353
425
|
const columnInfo = currentTable.value.find(item => item.prop === prop)
|
|
354
426
|
if (columnInfo) {
|
|
355
427
|
columnInfo.attr.fixed = v ? 'left' : false
|
|
428
|
+
if (v) { // 固定
|
|
429
|
+
const unFixedColumnIndex = unFixedColumn.value.findIndex(unFixedColumnItem => unFixedColumnItem.prop === columnInfo.prop)
|
|
430
|
+
if (unFixedColumnIndex > -1) {
|
|
431
|
+
unFixedColumn.value.splice(unFixedColumnIndex, 1)
|
|
432
|
+
fixedColumn.value.push(columnInfo)
|
|
433
|
+
}
|
|
434
|
+
} else { // 取消固定
|
|
435
|
+
const fixedColumnIndex = fixedColumn.value.findIndex(fixedColumnItem => fixedColumnItem.prop === columnInfo.prop)
|
|
436
|
+
if (fixedColumnIndex > -1) {
|
|
437
|
+
fixedColumn.value.splice(fixedColumnIndex, 1)
|
|
438
|
+
unFixedColumn.value.push(columnInfo)
|
|
439
|
+
}
|
|
440
|
+
}
|
|
356
441
|
}
|
|
357
|
-
updateColumn()
|
|
358
442
|
}
|
|
359
443
|
|
|
360
444
|
/**
|
package/package/nf-table.vue
CHANGED
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
:key="column.key || column.prop || column.type"
|
|
63
63
|
:type="column.type"
|
|
64
64
|
:prop="column.prop"
|
|
65
|
-
:label="column.label"
|
|
65
|
+
:label="resolveValue(column.label)"
|
|
66
66
|
v-bind="column.attr"
|
|
67
67
|
>
|
|
68
68
|
</el-table-column>
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
:key="column.key || column.prop || column.type"
|
|
72
72
|
:type="column.type"
|
|
73
73
|
:prop="column.prop"
|
|
74
|
-
:label="column.label"
|
|
74
|
+
:label="resolveValue(column.label)"
|
|
75
75
|
v-bind="column.attr"
|
|
76
76
|
>
|
|
77
77
|
<template slot-scope="scope" v-if="column.slot">
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
:key="column.key || column.prop || column.type"
|
|
85
85
|
:type="column.type"
|
|
86
86
|
:prop="column.prop"
|
|
87
|
-
:label="column.label"
|
|
87
|
+
:label="resolveValue(column.label)"
|
|
88
88
|
v-bind="column.attr"
|
|
89
89
|
>
|
|
90
90
|
<!-- column套column -->
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
name="operationIconColumnCheck"
|
|
102
102
|
:column="column"
|
|
103
103
|
>
|
|
104
|
-
<span style="white-space:nowrap"> {{ column.label }} </span>
|
|
104
|
+
<span style="white-space:nowrap"> {{ resolveValue(column.label) }} </span>
|
|
105
105
|
<el-tooltip
|
|
106
106
|
popper-class="actionTooltipRef"
|
|
107
107
|
placement="top"
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<template v-else-if="column.labelTooltip">
|
|
117
117
|
<el-tooltip :placement="column.labelTooltipPlacement || 'right'" effect="dark">
|
|
118
118
|
<div slot="content">{{ column.labelTooltip }}</div>
|
|
119
|
-
<span class="bottom-line" style="white-space:nowrap"> {{ column.label }} </span>
|
|
119
|
+
<span class="bottom-line" style="white-space:nowrap"> {{ resolveValue(column.label) }} </span>
|
|
120
120
|
</el-tooltip>
|
|
121
121
|
</template>
|
|
122
122
|
<!-- 头部插槽 -->
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
</template>
|
|
126
126
|
<!-- 默认 -->
|
|
127
127
|
<span v-else>
|
|
128
|
-
{{ column.label }}
|
|
128
|
+
{{ resolveValue(column.label) }}
|
|
129
129
|
</span>
|
|
130
130
|
</template>
|
|
131
131
|
<!-- -------------- 内容区域 -------------- -->
|
|
@@ -151,21 +151,21 @@
|
|
|
151
151
|
>
|
|
152
152
|
<template v-for="(item, index) in getOperationListLocal(column, scope)">
|
|
153
153
|
<nf-button
|
|
154
|
-
v-if="
|
|
155
|
-
:size="item.size || 'mini'"
|
|
156
|
-
:type="item.type || 'primary'"
|
|
157
|
-
:text="
|
|
158
|
-
:disabled="item.disabled"
|
|
159
|
-
:loading="item.loading"
|
|
160
|
-
:class="item.class"
|
|
161
|
-
:plain="item.plain"
|
|
162
|
-
:icon="item.icon"
|
|
163
|
-
:round="item.round"
|
|
164
|
-
:circle="item.circle"
|
|
165
|
-
:style="item.style"
|
|
166
|
-
|
|
154
|
+
v-if="!resolveValue(item.destroy, scope.row, scope)"
|
|
155
|
+
:size="resolveValue(item.size || 'mini', scope.row, scope)"
|
|
156
|
+
:type="resolveValue(item.type || 'primary', scope.row, scope, scope.row, scope)"
|
|
157
|
+
:text="resolveValue(item.text === undefined ? true : item.text, scope.row, scope)"
|
|
158
|
+
:disabled="resolveValue(item.disabled, scope.row, scope)"
|
|
159
|
+
:loading="resolveValue(item.loading, scope.row, scope)"
|
|
160
|
+
:class="resolveValue(item.class, scope.row, scope)"
|
|
161
|
+
:plain="resolveValue(item.plain, scope.row, scope)"
|
|
162
|
+
:icon="resolveValue(item.icon, scope.row, scope)"
|
|
163
|
+
:round="resolveValue(item.round, scope.row, scope)"
|
|
164
|
+
:circle="resolveValue(item.circle, scope.row, scope)"
|
|
165
|
+
:style="resolveValue(item.style, scope.row, scope)"
|
|
166
|
+
v-on="eventsOperationListBtns(item, scope)"
|
|
167
167
|
:key="item.key || index"
|
|
168
|
-
>{{ item.name }}
|
|
168
|
+
>{{ resolveValue(item.name, scope.row, scope) }}
|
|
169
169
|
</nf-button>
|
|
170
170
|
</template>
|
|
171
171
|
</nf-action>
|
|
@@ -200,18 +200,19 @@
|
|
|
200
200
|
<nf-button
|
|
201
201
|
:key="item.key || index"
|
|
202
202
|
v-if="item.element === 'el-button'"
|
|
203
|
-
:size="item.size || 'mini'"
|
|
204
|
-
:type="item.type || 'text'"
|
|
205
|
-
:
|
|
206
|
-
:
|
|
207
|
-
:
|
|
208
|
-
:
|
|
209
|
-
:
|
|
210
|
-
:
|
|
211
|
-
:
|
|
203
|
+
:size="resolveValue(item.size || 'mini')"
|
|
204
|
+
:type="resolveValue(item.type || 'text')"
|
|
205
|
+
:text="resolveValue(item.text === undefined ? true : item.text)"
|
|
206
|
+
:disabled="resolveValue(item.disabled)"
|
|
207
|
+
:loading="resolveValue(item.loading)"
|
|
208
|
+
:class="resolveValue(item.class)"
|
|
209
|
+
:plain="resolveValue(item.plain)"
|
|
210
|
+
:icon="resolveValue(item.icon)"
|
|
211
|
+
:round="resolveValue(item.round)"
|
|
212
|
+
:circle="resolveValue(item.circle)"
|
|
212
213
|
:style="getActionBarItemStyle(item, {marginLeft: '0px'})"
|
|
213
214
|
v-on="item.events"
|
|
214
|
-
>{{ item.value }}
|
|
215
|
+
>{{ resolveValue(item.value) }}
|
|
215
216
|
</nf-button>
|
|
216
217
|
<el-checkbox
|
|
217
218
|
:key="item.key || index"
|
|
@@ -220,7 +221,7 @@
|
|
|
220
221
|
:label="item.label"
|
|
221
222
|
:true-label="item['true-label']"
|
|
222
223
|
:false-label="item['false-label']"
|
|
223
|
-
:disabled="item.disabled"
|
|
224
|
+
:disabled="resolveValue(item.disabled)"
|
|
224
225
|
:border="item.border"
|
|
225
226
|
:size="item.size"
|
|
226
227
|
:name="item.name"
|
|
@@ -229,7 +230,7 @@
|
|
|
229
230
|
:style="getActionBarItemStyle(item)"
|
|
230
231
|
v-if="item.element === 'el-checkbox'"
|
|
231
232
|
v-on="item.events"
|
|
232
|
-
>{{ item.text }}
|
|
233
|
+
>{{ resolveValue(item.text) }}
|
|
233
234
|
</el-checkbox>
|
|
234
235
|
<el-checkbox-group
|
|
235
236
|
:key="item.key || index"
|
|
@@ -238,7 +239,7 @@
|
|
|
238
239
|
:label="item.label"
|
|
239
240
|
:true-label="item['true-label']"
|
|
240
241
|
:false-label="item['false-label']"
|
|
241
|
-
:disabled="item.disabled"
|
|
242
|
+
:disabled="resolveValue(item.disabled)"
|
|
242
243
|
:border="item.border"
|
|
243
244
|
:size="item.size"
|
|
244
245
|
:name="item.name"
|
|
@@ -259,7 +260,7 @@
|
|
|
259
260
|
:label="itemChildren.label"
|
|
260
261
|
:true-label="itemChildren['true-label']"
|
|
261
262
|
:false-label="itemChildren['false-label']"
|
|
262
|
-
:disabled="itemChildren.disabled"
|
|
263
|
+
:disabled="resolveValue(itemChildren.disabled)"
|
|
263
264
|
:border="itemChildren.border"
|
|
264
265
|
:size="itemChildren.size"
|
|
265
266
|
:name="itemChildren.name"
|
|
@@ -268,7 +269,7 @@
|
|
|
268
269
|
:style="{...(itemChildren.style || {}), marginRight: j === 0 ? 0 : '16px'}"
|
|
269
270
|
v-if="itemChildren.element === 'el-checkbox'"
|
|
270
271
|
v-on="itemChildren.events"
|
|
271
|
-
>{{ item.text }}
|
|
272
|
+
>{{ resolveValue(item.text) }}
|
|
272
273
|
</el-checkbox>
|
|
273
274
|
<el-checkbox-button
|
|
274
275
|
:key="itemChildren.key || j"
|
|
@@ -277,7 +278,7 @@
|
|
|
277
278
|
:label="itemChildren.label"
|
|
278
279
|
:true-label="itemChildren['true-label']"
|
|
279
280
|
:false-label="itemChildren['false-label']"
|
|
280
|
-
:disabled="itemChildren.disabled"
|
|
281
|
+
:disabled="resolveValue(itemChildren.disabled)"
|
|
281
282
|
:border="itemChildren.border"
|
|
282
283
|
:size="itemChildren.size"
|
|
283
284
|
:name="itemChildren.name"
|
|
@@ -286,7 +287,7 @@
|
|
|
286
287
|
:style="{...(itemChildren.style || {}), marginRight: j === 0 ? 0 : '16px'}"
|
|
287
288
|
v-if="itemChildren.element === 'el-checkbox-button'"
|
|
288
289
|
v-on="itemChildren.events"
|
|
289
|
-
>{{ item.text }}
|
|
290
|
+
>{{ resolveValue(item.text) }}
|
|
290
291
|
</el-checkbox-button>
|
|
291
292
|
</template>
|
|
292
293
|
</template>
|
|
@@ -298,7 +299,7 @@
|
|
|
298
299
|
:label="item.label"
|
|
299
300
|
:true-label="item['true-label']"
|
|
300
301
|
:false-label="item['false-label']"
|
|
301
|
-
:disabled="item.disabled"
|
|
302
|
+
:disabled="resolveValue(item.disabled)"
|
|
302
303
|
:border="item.border"
|
|
303
304
|
:size="item.size"
|
|
304
305
|
:name="item.name"
|
|
@@ -307,13 +308,13 @@
|
|
|
307
308
|
:style="getActionBarItemStyle(item)"
|
|
308
309
|
v-if="item.element === 'el-checkbox-button'"
|
|
309
310
|
v-on="item.events"
|
|
310
|
-
>{{ item.text }}
|
|
311
|
+
>{{ resolveValue(item.text) }}
|
|
311
312
|
</el-checkbox-button>
|
|
312
313
|
<el-radio
|
|
313
314
|
:key="item.key || index"
|
|
314
315
|
v-model="item.value"
|
|
315
316
|
:label="item.label"
|
|
316
|
-
:disabled="item.disabled"
|
|
317
|
+
:disabled="resolveValue(item.disabled)"
|
|
317
318
|
:border="item.border"
|
|
318
319
|
:name="item.name"
|
|
319
320
|
:size="item.size"
|
|
@@ -321,12 +322,12 @@
|
|
|
321
322
|
:style="getActionBarItemStyle(item)"
|
|
322
323
|
v-if="item.element === 'el-radio'"
|
|
323
324
|
v-on="item.events"
|
|
324
|
-
>{{ item.text }}
|
|
325
|
+
>{{ resolveValue(item.text) }}
|
|
325
326
|
</el-radio>
|
|
326
327
|
<el-radio-group
|
|
327
328
|
:key="item.key || index"
|
|
328
329
|
v-model="item.value"
|
|
329
|
-
:disabled="item.disabled"
|
|
330
|
+
:disabled="resolveValue(item.disabled)"
|
|
330
331
|
:size="item.size"
|
|
331
332
|
:class="item.class"
|
|
332
333
|
:text-color="item['text-color']"
|
|
@@ -343,7 +344,7 @@
|
|
|
343
344
|
:key="itemChildren.key || j"
|
|
344
345
|
v-model="itemChildren.value"
|
|
345
346
|
:label="itemChildren.label"
|
|
346
|
-
:disabled="itemChildren.disabled"
|
|
347
|
+
:disabled="resolveValue(itemChildren.disabled)"
|
|
347
348
|
:border="itemChildren.border"
|
|
348
349
|
:name="itemChildren.name"
|
|
349
350
|
:size="itemChildren.size"
|
|
@@ -351,13 +352,13 @@
|
|
|
351
352
|
:style="{...(itemChildren.style || {}), marginRight: j === 0 ? 0 : '16px'}"
|
|
352
353
|
v-if="itemChildren.element === 'el-radio'"
|
|
353
354
|
v-on="itemChildren.events"
|
|
354
|
-
>{{ item.text }}
|
|
355
|
+
>{{ resolveValue(item.text) }}
|
|
355
356
|
</el-radio>
|
|
356
357
|
<el-radio-button
|
|
357
358
|
:key="itemChildren.key || j"
|
|
358
359
|
v-model="itemChildren.value"
|
|
359
360
|
:label="itemChildren.label"
|
|
360
|
-
:disabled="itemChildren.disabled"
|
|
361
|
+
:disabled="resolveValue(itemChildren.disabled)"
|
|
361
362
|
:border="itemChildren.border"
|
|
362
363
|
:name="itemChildren.name"
|
|
363
364
|
:size="itemChildren.size"
|
|
@@ -365,7 +366,7 @@
|
|
|
365
366
|
:style="{...(itemChildren.style || {}), marginRight: j === 0 ? 0 : '16px'}"
|
|
366
367
|
v-if="itemChildren.element === 'el-radio-button'"
|
|
367
368
|
v-on="itemChildren.events"
|
|
368
|
-
>{{ item.text }}
|
|
369
|
+
>{{ resolveValue(item.text) }}
|
|
369
370
|
</el-radio-button>
|
|
370
371
|
</template>
|
|
371
372
|
</template>
|
|
@@ -374,7 +375,7 @@
|
|
|
374
375
|
:key="item.key || index"
|
|
375
376
|
v-model="item.value"
|
|
376
377
|
:label="item.label"
|
|
377
|
-
:disabled="item.disabled"
|
|
378
|
+
:disabled="resolveValue(item.disabled)"
|
|
378
379
|
:border="item.border"
|
|
379
380
|
:name="item.name"
|
|
380
381
|
:size="item.size"
|
|
@@ -382,7 +383,7 @@
|
|
|
382
383
|
:style="getActionBarItemStyle(item)"
|
|
383
384
|
v-if="item.element === 'el-radio-button'"
|
|
384
385
|
v-on="item.events"
|
|
385
|
-
>{{ item.text }}
|
|
386
|
+
>{{ resolveValue(item.text) }}
|
|
386
387
|
</el-radio-button>
|
|
387
388
|
<el-input
|
|
388
389
|
:key="item.key || index"
|
|
@@ -395,7 +396,7 @@
|
|
|
395
396
|
:validate-event="item['validate-event']"
|
|
396
397
|
:type="item.type"
|
|
397
398
|
:placeholder="item.placeholder"
|
|
398
|
-
:disabled="item.disabled"
|
|
399
|
+
:disabled="resolveValue(item.disabled)"
|
|
399
400
|
:size="item.size"
|
|
400
401
|
:name="item.name"
|
|
401
402
|
:max="item.max"
|
|
@@ -454,7 +455,7 @@
|
|
|
454
455
|
<el-switch
|
|
455
456
|
:key="item.key || index"
|
|
456
457
|
v-model="item.value"
|
|
457
|
-
:disabled="item.disabled"
|
|
458
|
+
:disabled="resolveValue(item.disabled)"
|
|
458
459
|
:width="item.width"
|
|
459
460
|
:name="item.name"
|
|
460
461
|
:active-icon-class="item['active-icon-class']"
|
|
@@ -470,7 +471,7 @@
|
|
|
470
471
|
:style="getActionBarItemStyle(item)"
|
|
471
472
|
v-if="item.element === 'el-switch'"
|
|
472
473
|
v-on="item.events"
|
|
473
|
-
>{{ item.text }}
|
|
474
|
+
>{{ resolveValue(item.text) }}
|
|
474
475
|
</el-switch>
|
|
475
476
|
<el-input-number
|
|
476
477
|
:key="item.key || index"
|
|
@@ -482,7 +483,7 @@
|
|
|
482
483
|
:step-strictly="item['step-strictly']"
|
|
483
484
|
:precision="item.precision"
|
|
484
485
|
:size="item.size"
|
|
485
|
-
:disabled="item.disabled"
|
|
486
|
+
:disabled="resolveValue(item.disabled)"
|
|
486
487
|
:controls="item.controls"
|
|
487
488
|
:controls-position="item['controls-position']"
|
|
488
489
|
:name="item.name"
|
|
@@ -500,7 +501,7 @@
|
|
|
500
501
|
v-on="item.events"
|
|
501
502
|
v-bind="item.attr"
|
|
502
503
|
>
|
|
503
|
-
{{ item.value }}
|
|
504
|
+
{{ resolveValue(item.value) }}
|
|
504
505
|
</span>
|
|
505
506
|
</template>
|
|
506
507
|
</template>
|
|
@@ -557,7 +558,7 @@
|
|
|
557
558
|
:title="columnCheckTitle"
|
|
558
559
|
:cancel-button-text="columnCheckCancelButtonText"
|
|
559
560
|
:confirm-button-text="columnCheckConfirmButtonText"
|
|
560
|
-
|
|
561
|
+
v-bind="drawerProps"
|
|
561
562
|
ref="columnCheckNfDrawer"
|
|
562
563
|
size="680px"
|
|
563
564
|
:visible.sync="nfColumCheckDialogVisible"
|
|
@@ -628,7 +629,7 @@ import {
|
|
|
628
629
|
NfTableActionBtnAttributes
|
|
629
630
|
} from './types'
|
|
630
631
|
import { ITabItem } from '@94ai/nf-drawer/lib/types'
|
|
631
|
-
import { CachedManager } from '@94ai/common-utils'
|
|
632
|
+
import { CachedManager, resolveValue } from '@94ai/common-utils'
|
|
632
633
|
import { useRoute } from 'vue-router/composables'
|
|
633
634
|
|
|
634
635
|
const props = withDefaults(defineProps<{
|
|
@@ -745,7 +746,7 @@ const props = withDefaults(defineProps<{
|
|
|
745
746
|
* 操作列属性key
|
|
746
747
|
*/
|
|
747
748
|
operationPropKey?: string
|
|
748
|
-
|
|
749
|
+
drawerProps?: Record<string, any>
|
|
749
750
|
}>(), {
|
|
750
751
|
dragCached: true,
|
|
751
752
|
emptyImageSize: 145,
|
|
@@ -816,7 +817,8 @@ const props = withDefaults(defineProps<{
|
|
|
816
817
|
columnCheckNoFixedDesc: '不固定',
|
|
817
818
|
columnCheckBasicFieldDesc: '基础字段',
|
|
818
819
|
columnCheckGetCheckedLengthDesc: (length) => (length) => '已选(' + length + ')',
|
|
819
|
-
columnCheckGetAllCheckDesc: (length) => (length) => '全选(' + length + ')'
|
|
820
|
+
columnCheckGetAllCheckDesc: (length) => (length) => '全选(' + length + ')',
|
|
821
|
+
drawerProps: () => ({})
|
|
820
822
|
})
|
|
821
823
|
|
|
822
824
|
const emit = defineEmits<{
|
|
@@ -831,8 +833,15 @@ const getOperationListLocal = (column, scope) => {
|
|
|
831
833
|
}
|
|
832
834
|
return column.operationList || []
|
|
833
835
|
}
|
|
834
|
-
|
|
835
|
-
|
|
836
|
+
|
|
837
|
+
const eventsOperationListBtns = (item, scope) => {
|
|
838
|
+
return {
|
|
839
|
+
...(item.events || {}),
|
|
840
|
+
click: (...args) => {
|
|
841
|
+
item.events?.click(args);
|
|
842
|
+
item.onClick?.(scope.row, scope)
|
|
843
|
+
}
|
|
844
|
+
}
|
|
836
845
|
}
|
|
837
846
|
|
|
838
847
|
const routeName = computed(() => useRoute().name)
|
|
@@ -1042,19 +1051,19 @@ const initCachedData = async () => {
|
|
|
1042
1051
|
}
|
|
1043
1052
|
|
|
1044
1053
|
const getMinWidth = (column) => {
|
|
1045
|
-
|
|
1046
|
-
|
|
1054
|
+
const columnLabel = resolveValue(column.label)
|
|
1055
|
+
if (columnLabel?.indexOf('$$') === 0) {
|
|
1056
|
+
const value = Number(columnLabel.replace('$$', ''))
|
|
1047
1057
|
if (!Number.isNaN(value) && value) {
|
|
1048
1058
|
return value
|
|
1049
1059
|
}
|
|
1050
1060
|
}
|
|
1051
1061
|
const fs = 14
|
|
1052
|
-
const
|
|
1053
|
-
const char = label.match(/[\u2E80-\u9FFF]/g)
|
|
1062
|
+
const char = columnLabel.match(/[\u2E80-\u9FFF]/g)
|
|
1054
1063
|
const charLen = char ? char.length : 0
|
|
1055
|
-
const num =
|
|
1064
|
+
const num = columnLabel.match(/\d|\./g)
|
|
1056
1065
|
const numLen = num ? num.length : 0
|
|
1057
|
-
const otherLen =
|
|
1066
|
+
const otherLen = columnLabel.length - charLen - numLen
|
|
1058
1067
|
return fs * (charLen * 1 + numLen * 0.7 + otherLen * 0.58) + 20 + (column.sortable ? 24 : 0)
|
|
1059
1068
|
}
|
|
1060
1069
|
|
|
@@ -1246,11 +1255,11 @@ const pageAttrer = computed(() => {
|
|
|
1246
1255
|
return map
|
|
1247
1256
|
})
|
|
1248
1257
|
|
|
1249
|
-
const isShow = (
|
|
1250
|
-
if (
|
|
1258
|
+
const isShow = (column: Record<string, any>) => {
|
|
1259
|
+
if (column.type) {
|
|
1251
1260
|
return true
|
|
1252
1261
|
}
|
|
1253
|
-
return !
|
|
1262
|
+
return !column.initHidden && !resolveValue(column.destory, column)
|
|
1254
1263
|
}
|
|
1255
1264
|
|
|
1256
1265
|
const resetNfSearchFormModel = () => {
|
package/package/types.ts
CHANGED
|
@@ -244,9 +244,9 @@ export interface NfTableColumnAttributes {
|
|
|
244
244
|
_index?: number
|
|
245
245
|
__index?: number
|
|
246
246
|
initHidden?: boolean
|
|
247
|
-
destory?: boolean
|
|
247
|
+
destory?: boolean | ((any: any) => boolean)
|
|
248
248
|
type?: 'selection' | 'index' | 'expand'
|
|
249
|
-
label?: string
|
|
249
|
+
label?: string | ((any: any) => string)
|
|
250
250
|
addLabel?: string
|
|
251
251
|
prop?: string
|
|
252
252
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-table",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.8",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "zoujiahe <zoujiahe@94ai.com>",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@94ai/common-utils": "^8.0.
|
|
18
|
-
"@94ai/nf-button": "^8.0.
|
|
19
|
-
"@94ai/nf-drawer": "^8.0.
|
|
20
|
-
"@94ai/nf-message": "^8.0.
|
|
21
|
-
"@94ai/nf-search-form": "^8.0.
|
|
22
|
-
"@94ai/nf-tag": "^8.0.
|
|
23
|
-
"@94ai/nf-theme-chalk": "^8.0.
|
|
17
|
+
"@94ai/common-utils": "^8.0.8",
|
|
18
|
+
"@94ai/nf-button": "^8.0.8",
|
|
19
|
+
"@94ai/nf-drawer": "^8.0.8",
|
|
20
|
+
"@94ai/nf-message": "^8.0.8",
|
|
21
|
+
"@94ai/nf-search-form": "^8.0.8",
|
|
22
|
+
"@94ai/nf-tag": "^8.0.8",
|
|
23
|
+
"@94ai/nf-theme-chalk": "^8.0.8",
|
|
24
24
|
"idb-keyval": "^6.2.1",
|
|
25
25
|
"vue-demi": "^0.14.5",
|
|
26
26
|
"vue-router": "3.6.4",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"types": "lib/index.d.ts",
|
|
40
40
|
"main": "lib/nf-table.cjs.js",
|
|
41
41
|
"module": "lib/nf-table.esm-bundler.js",
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "348837ce37e1b93e62681cbd0021bc66cc94e660"
|
|
43
43
|
}
|