vxe-table 3.4.1 → 3.4.2
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.umd.js +96 -872
- package/lib/index.umd.min.js +1 -1
- package/lib/table/src/cell.js +92 -35
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/methods.js +6 -6
- package/lib/table/src/methods.min.js +1 -1
- package/lib/v-x-e-table/src/conf.js +2 -2
- package/lib/v-x-e-table/src/conf.min.js +1 -1
- package/package.json +1 -1
- package/packages/table/src/cell.js +74 -41
- package/packages/table/src/methods.js +5 -5
- package/packages/v-x-e-table/src/conf.js +2 -2
|
@@ -291,17 +291,18 @@ export const Cell = {
|
|
|
291
291
|
const { $table, column, isHidden } = params
|
|
292
292
|
const { radioOpts, selectRow } = $table
|
|
293
293
|
const { slots } = column
|
|
294
|
-
const { labelField, checkMethod } = radioOpts
|
|
294
|
+
const { labelField, checkMethod, visibleMethod } = radioOpts
|
|
295
295
|
const { row } = params
|
|
296
296
|
const defaultSlot = slots ? slots.default : null
|
|
297
297
|
const radioSlot = slots ? slots.radio : null
|
|
298
298
|
const isChecked = row === selectRow
|
|
299
|
+
const isVisible = !visibleMethod || visibleMethod({ row })
|
|
299
300
|
let isDisabled = !!checkMethod
|
|
300
301
|
let on
|
|
301
302
|
if (!isHidden) {
|
|
302
303
|
on = {
|
|
303
304
|
click (evnt) {
|
|
304
|
-
if (!isDisabled) {
|
|
305
|
+
if (!isDisabled && isVisible) {
|
|
305
306
|
$table.triggerRadioRowEvent(evnt, params)
|
|
306
307
|
}
|
|
307
308
|
}
|
|
@@ -310,26 +311,36 @@ export const Cell = {
|
|
|
310
311
|
isDisabled = !checkMethod({ row })
|
|
311
312
|
}
|
|
312
313
|
}
|
|
313
|
-
const radioParams = { ...params, checked: isChecked, disabled: isDisabled }
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
on
|
|
321
|
-
}, [
|
|
314
|
+
const radioParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible }
|
|
315
|
+
if (radioSlot) {
|
|
316
|
+
return $table.callSlot(radioSlot, radioParams, h)
|
|
317
|
+
}
|
|
318
|
+
const radioVNs = []
|
|
319
|
+
if (isVisible) {
|
|
320
|
+
radioVNs.push(
|
|
322
321
|
h('span', {
|
|
323
322
|
class: 'vxe-radio--icon vxe-radio--checked-icon'
|
|
324
323
|
}),
|
|
325
324
|
h('span', {
|
|
326
325
|
class: 'vxe-radio--icon vxe-radio--unchecked-icon'
|
|
327
326
|
})
|
|
328
|
-
|
|
327
|
+
)
|
|
328
|
+
}
|
|
329
|
+
if (defaultSlot || labelField) {
|
|
330
|
+
radioVNs.push(
|
|
329
331
|
h('span', {
|
|
330
332
|
class: 'vxe-radio--label'
|
|
331
333
|
}, defaultSlot ? $table.callSlot(defaultSlot, radioParams, h) : XEUtils.get(row, labelField))
|
|
332
|
-
|
|
334
|
+
)
|
|
335
|
+
}
|
|
336
|
+
return [
|
|
337
|
+
h('span', {
|
|
338
|
+
class: ['vxe-cell--radio', {
|
|
339
|
+
'is--checked': isChecked,
|
|
340
|
+
'is--disabled': isDisabled
|
|
341
|
+
}],
|
|
342
|
+
on
|
|
343
|
+
}, radioVNs)
|
|
333
344
|
]
|
|
334
345
|
},
|
|
335
346
|
renderTreeRadioCell (h, params) {
|
|
@@ -401,19 +412,20 @@ export const Cell = {
|
|
|
401
412
|
renderSelectionCell (h, params) {
|
|
402
413
|
const { $table, row, column, isHidden } = params
|
|
403
414
|
const { treeConfig, treeIndeterminates } = $table
|
|
404
|
-
const { labelField, checkMethod } = $table.checkboxOpts
|
|
415
|
+
const { labelField, checkMethod, visibleMethod } = $table.checkboxOpts
|
|
405
416
|
const { slots } = column
|
|
406
417
|
const defaultSlot = slots ? slots.default : null
|
|
407
418
|
const checkboxSlot = slots ? slots.checkbox : null
|
|
408
419
|
let indeterminate = false
|
|
409
420
|
let isChecked = false
|
|
421
|
+
const isVisible = !visibleMethod || visibleMethod({ row })
|
|
410
422
|
let isDisabled = !!checkMethod
|
|
411
423
|
let on
|
|
412
424
|
if (!isHidden) {
|
|
413
425
|
isChecked = $table.selection.indexOf(row) > -1
|
|
414
426
|
on = {
|
|
415
427
|
click (evnt) {
|
|
416
|
-
if (!isDisabled) {
|
|
428
|
+
if (!isDisabled && isVisible) {
|
|
417
429
|
$table.triggerCheckRowEvent(evnt, params, !isChecked)
|
|
418
430
|
}
|
|
419
431
|
}
|
|
@@ -425,16 +437,13 @@ export const Cell = {
|
|
|
425
437
|
indeterminate = treeIndeterminates.indexOf(row) > -1
|
|
426
438
|
}
|
|
427
439
|
}
|
|
428
|
-
const checkboxParams = { ...params, checked: isChecked, disabled: isDisabled, indeterminate }
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
}],
|
|
436
|
-
on
|
|
437
|
-
}, [
|
|
440
|
+
const checkboxParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate }
|
|
441
|
+
if (checkboxSlot) {
|
|
442
|
+
return $table.callSlot(checkboxSlot, checkboxParams, h)
|
|
443
|
+
}
|
|
444
|
+
const checkVNs = []
|
|
445
|
+
if (isVisible) {
|
|
446
|
+
checkVNs.push(
|
|
438
447
|
h('span', {
|
|
439
448
|
class: 'vxe-checkbox--icon vxe-checkbox--checked-icon'
|
|
440
449
|
}),
|
|
@@ -444,11 +453,24 @@ export const Cell = {
|
|
|
444
453
|
h('span', {
|
|
445
454
|
class: 'vxe-checkbox--icon vxe-checkbox--indeterminate-icon'
|
|
446
455
|
})
|
|
447
|
-
|
|
456
|
+
)
|
|
457
|
+
}
|
|
458
|
+
if (defaultSlot || labelField) {
|
|
459
|
+
checkVNs.push(
|
|
448
460
|
h('span', {
|
|
449
461
|
class: 'vxe-checkbox--label'
|
|
450
462
|
}, defaultSlot ? $table.callSlot(defaultSlot, checkboxParams, h) : XEUtils.get(row, labelField))
|
|
451
|
-
|
|
463
|
+
)
|
|
464
|
+
}
|
|
465
|
+
return [
|
|
466
|
+
h('span', {
|
|
467
|
+
class: ['vxe-cell--checkbox', {
|
|
468
|
+
'is--checked': isChecked,
|
|
469
|
+
'is--disabled': isDisabled,
|
|
470
|
+
'is--indeterminate': indeterminate
|
|
471
|
+
}],
|
|
472
|
+
on
|
|
473
|
+
}, checkVNs)
|
|
452
474
|
]
|
|
453
475
|
},
|
|
454
476
|
renderTreeSelectionCell (h, params) {
|
|
@@ -457,19 +479,20 @@ export const Cell = {
|
|
|
457
479
|
renderSelectionCellByProp (h, params) {
|
|
458
480
|
const { $table, row, column, isHidden } = params
|
|
459
481
|
const { treeConfig, treeIndeterminates } = $table
|
|
460
|
-
const { labelField, checkField: property, halfField, checkMethod } = $table.checkboxOpts
|
|
482
|
+
const { labelField, checkField: property, halfField, checkMethod, visibleMethod } = $table.checkboxOpts
|
|
461
483
|
const { slots } = column
|
|
462
484
|
const defaultSlot = slots ? slots.default : null
|
|
463
485
|
const checkboxSlot = slots ? slots.checkbox : null
|
|
464
486
|
let indeterminate = false
|
|
465
487
|
let isChecked = false
|
|
488
|
+
const isVisible = !visibleMethod || visibleMethod({ row })
|
|
466
489
|
let isDisabled = !!checkMethod
|
|
467
490
|
let on
|
|
468
491
|
if (!isHidden) {
|
|
469
492
|
isChecked = XEUtils.get(row, property)
|
|
470
493
|
on = {
|
|
471
494
|
click (evnt) {
|
|
472
|
-
if (!isDisabled) {
|
|
495
|
+
if (!isDisabled && isVisible) {
|
|
473
496
|
$table.triggerCheckRowEvent(evnt, params, !isChecked)
|
|
474
497
|
}
|
|
475
498
|
}
|
|
@@ -481,16 +504,13 @@ export const Cell = {
|
|
|
481
504
|
indeterminate = treeIndeterminates.indexOf(row) > -1
|
|
482
505
|
}
|
|
483
506
|
}
|
|
484
|
-
const checkboxParams = { ...params, checked: isChecked, disabled: isDisabled, indeterminate }
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
}],
|
|
492
|
-
on
|
|
493
|
-
}, [
|
|
507
|
+
const checkboxParams = { ...params, checked: isChecked, disabled: isDisabled, visible: isVisible, indeterminate }
|
|
508
|
+
if (checkboxSlot) {
|
|
509
|
+
return $table.callSlot(checkboxSlot, checkboxParams, h)
|
|
510
|
+
}
|
|
511
|
+
const checkVNs = []
|
|
512
|
+
if (isVisible) {
|
|
513
|
+
checkVNs.push(
|
|
494
514
|
h('span', {
|
|
495
515
|
class: 'vxe-checkbox--icon vxe-checkbox--checked-icon'
|
|
496
516
|
}),
|
|
@@ -500,11 +520,24 @@ export const Cell = {
|
|
|
500
520
|
h('span', {
|
|
501
521
|
class: 'vxe-checkbox--icon vxe-checkbox--indeterminate-icon'
|
|
502
522
|
})
|
|
503
|
-
|
|
523
|
+
)
|
|
524
|
+
}
|
|
525
|
+
if (defaultSlot || labelField) {
|
|
526
|
+
checkVNs.push(
|
|
504
527
|
h('span', {
|
|
505
528
|
class: 'vxe-checkbox--label'
|
|
506
529
|
}, defaultSlot ? $table.callSlot(defaultSlot, checkboxParams, h) : XEUtils.get(row, labelField))
|
|
507
|
-
|
|
530
|
+
)
|
|
531
|
+
}
|
|
532
|
+
return [
|
|
533
|
+
h('span', {
|
|
534
|
+
class: ['vxe-cell--checkbox', {
|
|
535
|
+
'is--checked': isChecked,
|
|
536
|
+
'is--disabled': isDisabled,
|
|
537
|
+
'is--indeterminate': halfField && !isChecked ? row[halfField] : indeterminate
|
|
538
|
+
}],
|
|
539
|
+
on
|
|
540
|
+
}, checkVNs)
|
|
508
541
|
]
|
|
509
542
|
},
|
|
510
543
|
renderTreeSelectionCellByProp (h, params) {
|
|
@@ -325,11 +325,11 @@ const Methods = {
|
|
|
325
325
|
// 树结构自动转换
|
|
326
326
|
if (treeOpts.transform) {
|
|
327
327
|
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
328
|
-
if (!treeOpts.
|
|
329
|
-
UtilTools.error('vxe.error.reqProp', ['table.tree-config.
|
|
328
|
+
if (!treeOpts.rowField) {
|
|
329
|
+
UtilTools.error('vxe.error.reqProp', ['table.tree-config.rowField'])
|
|
330
330
|
}
|
|
331
|
-
if (!treeOpts.
|
|
332
|
-
UtilTools.error('vxe.error.reqProp', ['table.tree-config.
|
|
331
|
+
if (!treeOpts.parentField) {
|
|
332
|
+
UtilTools.error('vxe.error.reqProp', ['table.tree-config.parentField'])
|
|
333
333
|
}
|
|
334
334
|
if (!treeOpts.children) {
|
|
335
335
|
UtilTools.error('vxe.error.reqProp', ['tree-config.children'])
|
|
@@ -340,7 +340,7 @@ const Methods = {
|
|
|
340
340
|
}
|
|
341
341
|
})
|
|
342
342
|
}
|
|
343
|
-
treeData = XEUtils.toArrayTree(fullData, { key: treeOpts.
|
|
343
|
+
treeData = XEUtils.toArrayTree(fullData, { key: treeOpts.rowField, parentKey: treeOpts.parentField, children: treeOpts.children })
|
|
344
344
|
fullData = treeData.slice(0)
|
|
345
345
|
} else {
|
|
346
346
|
treeData = fullData.slice(0)
|