vxe-pc-ui 3.14.20 → 3.14.22

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.
Files changed (42) hide show
  1. package/es/form/src/form.js +2 -1
  2. package/es/form/src/render.js +1 -1
  3. package/es/tabs/src/tabs.js +1 -1
  4. package/es/tree/src/tree.js +24 -19
  5. package/es/ui/index.js +1 -1
  6. package/es/ui/src/log.js +1 -1
  7. package/lib/form/src/form.js +2 -1
  8. package/lib/form/src/form.min.js +1 -1
  9. package/lib/form/src/render.js +1 -1
  10. package/lib/form/src/render.min.js +1 -1
  11. package/lib/index.umd.js +39 -29
  12. package/lib/index.umd.min.js +1 -1
  13. package/lib/tabs/src/tabs.js +1 -1
  14. package/lib/tabs/src/tabs.min.js +1 -1
  15. package/lib/tree/src/tree.js +33 -24
  16. package/lib/tree/src/tree.min.js +1 -1
  17. package/lib/ui/index.js +1 -1
  18. package/lib/ui/index.min.js +1 -1
  19. package/lib/ui/src/log.js +1 -1
  20. package/lib/ui/src/log.min.js +1 -1
  21. package/package.json +2 -2
  22. package/packages/form/src/form.ts +2 -1
  23. package/packages/form/src/render.ts +1 -1
  24. package/packages/tabs/src/tabs.ts +1 -1
  25. package/packages/tree/src/tree.ts +25 -19
  26. package/types/components/colgroup.d.ts +3 -71
  27. package/types/components/column.d.ts +6 -0
  28. package/types/components/form-item.d.ts +1 -1
  29. package/types/components/table.d.ts +1 -0
  30. package/types/components/tree.d.ts +4 -0
  31. /package/es/icon/{iconfont.1779671249035.ttf → iconfont.1779767616042.ttf} +0 -0
  32. /package/es/icon/{iconfont.1779671249035.woff → iconfont.1779767616042.woff} +0 -0
  33. /package/es/icon/{iconfont.1779671249035.woff2 → iconfont.1779767616042.woff2} +0 -0
  34. /package/es/{iconfont.1779671249035.ttf → iconfont.1779767616042.ttf} +0 -0
  35. /package/es/{iconfont.1779671249035.woff → iconfont.1779767616042.woff} +0 -0
  36. /package/es/{iconfont.1779671249035.woff2 → iconfont.1779767616042.woff2} +0 -0
  37. /package/lib/icon/style/{iconfont.1779671249035.ttf → iconfont.1779767616042.ttf} +0 -0
  38. /package/lib/icon/style/{iconfont.1779671249035.woff → iconfont.1779767616042.woff} +0 -0
  39. /package/lib/icon/style/{iconfont.1779671249035.woff2 → iconfont.1779767616042.woff2} +0 -0
  40. /package/lib/{iconfont.1779671249035.ttf → iconfont.1779767616042.ttf} +0 -0
  41. /package/lib/{iconfont.1779671249035.woff → iconfont.1779767616042.woff} +0 -0
  42. /package/lib/{iconfont.1779671249035.woff2 → iconfont.1779767616042.woff2} +0 -0
@@ -484,6 +484,18 @@ function handleNodeDragSwapEvent ($xeTree: VxeTreeConstructor & VxeTreePrivateMe
484
484
  return Promise.resolve(errRest)
485
485
  }
486
486
 
487
+ function handleVisibleOrCheckMode (mode: '' | 'all' | 'first' | 'last' | null | undefined, isExistChild: boolean, nLevel: number) {
488
+ if (mode) {
489
+ if (mode === 'first') {
490
+ return !nLevel
491
+ }
492
+ if (mode === 'last') {
493
+ return !isExistChild
494
+ }
495
+ }
496
+ return true
497
+ }
498
+
487
499
  function createInternalData (): TreeInternalData {
488
500
  return {
489
501
  // initialized: false,
@@ -2632,19 +2644,16 @@ export default /* define-vxe-component start */ defineVxeComponent({
2632
2644
  }
2633
2645
  return renderEmptyElement($xeTree)
2634
2646
  },
2635
- renderRadio (h: CreateElement, node: any, nodeid: string, isChecked: boolean) {
2647
+ renderRadio (h: CreateElement, node: any, nodeid: string, isExistChild: boolean, nLevel: number, isChecked: boolean) {
2636
2648
  const $xeTree = this
2637
2649
  const props = $xeTree
2638
2650
 
2639
2651
  const { showRadio } = props
2640
2652
  const radioOpts = $xeTree.computeRadioOpts
2641
- const { showIcon, checkMethod, visibleMethod } = radioOpts
2642
- const isVisible = !visibleMethod || visibleMethod({ $tree: $xeTree, node })
2643
- let isDisabled = !!checkMethod
2653
+ const { showIcon, checkMode, checkMethod, visibleMode, visibleMethod } = radioOpts
2654
+ const isVisible = visibleMethod ? visibleMethod({ $tree: $xeTree, node }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel)
2644
2655
  if (showRadio && showIcon && isVisible) {
2645
- if (checkMethod) {
2646
- isDisabled = !checkMethod({ $tree: $xeTree, node })
2647
- }
2656
+ const isDisabled = checkMethod ? !checkMethod({ $tree: $xeTree, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel)
2648
2657
  return h('div', {
2649
2658
  class: ['vxe-tree--radio-option', {
2650
2659
  'is--checked': isChecked,
@@ -2665,19 +2674,16 @@ export default /* define-vxe-component start */ defineVxeComponent({
2665
2674
  }
2666
2675
  return renderEmptyElement($xeTree)
2667
2676
  },
2668
- renderCheckbox (h: CreateElement, node: any, nodeid: string, isChecked: boolean, isIndeterminate: boolean) {
2677
+ renderCheckbox (h: CreateElement, node: any, nodeid: string, isExistChild: boolean, nLevel: number, isChecked: boolean, isIndeterminate: boolean) {
2669
2678
  const $xeTree = this
2670
2679
  const props = $xeTree
2671
2680
 
2672
2681
  const { showCheckbox } = props
2673
2682
  const checkboxOpts = $xeTree.computeCheckboxOpts
2674
- const { showIcon, checkMethod, visibleMethod } = checkboxOpts
2675
- const isVisible = !visibleMethod || visibleMethod({ $tree: $xeTree, node })
2676
- let isDisabled = !!checkMethod
2683
+ const { showIcon, checkMode, checkMethod, visibleMode, visibleMethod } = checkboxOpts
2684
+ const isVisible = visibleMethod ? visibleMethod({ $tree: $xeTree, node }) : handleVisibleOrCheckMode(visibleMode, isExistChild, nLevel)
2677
2685
  if (showCheckbox && showIcon && isVisible) {
2678
- if (checkMethod) {
2679
- isDisabled = !checkMethod({ $tree: $xeTree, node })
2680
- }
2686
+ const isDisabled = checkMethod ? !checkMethod({ $tree: $xeTree, node }) : !handleVisibleOrCheckMode(checkMode, isExistChild, nLevel)
2681
2687
  return h('div', {
2682
2688
  class: ['vxe-tree--checkbox-option', {
2683
2689
  'is--checked': isChecked,
@@ -2713,12 +2719,12 @@ export default /* define-vxe-component start */ defineVxeComponent({
2713
2719
  const titleField = $xeTree.computeTitleField
2714
2720
  const hasChildField = $xeTree.computeHasChildField
2715
2721
  const childList: any[] = XEUtils.get(node, childrenField)
2716
- const hasChild = childList && childList.length
2722
+ const isExistChild = childList && childList.length > 0
2717
2723
  const iconSlot = slots.icon
2718
2724
  const titleSlot = slots.title
2719
2725
  const extraSlot = slots.extra
2720
2726
  const isExpand = updateExpandedFlag && treeExpandedMaps[nodeid]
2721
- const nodeItem = nodeMaps[nodeid]
2727
+ const nodeItem = nodeMaps[nodeid] || {}
2722
2728
  const nodeValue = XEUtils.get(node, titleField)
2723
2729
  const nLevel = nodeItem.level
2724
2730
 
@@ -2805,7 +2811,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
2805
2811
  : renderEmptyElement($xeTree),
2806
2812
  h('div', {
2807
2813
  class: 'vxe-tree--node-item-switcher'
2808
- }, showIcon && (lazy ? (isLazyLoaded ? hasChild : hasLazyChilds) : hasChild)
2814
+ }, showIcon && (lazy ? (isLazyLoaded ? isExistChild : hasLazyChilds) : isExistChild)
2809
2815
  ? [
2810
2816
  h('div', {
2811
2817
  class: 'vxe-tree--node-item-icon',
@@ -2824,8 +2830,8 @@ export default /* define-vxe-component start */ defineVxeComponent({
2824
2830
  ]
2825
2831
  : []),
2826
2832
  $xeTree.renderDragIcon(h, node, nodeid),
2827
- $xeTree.renderRadio(h, node, nodeid, isRadioChecked),
2828
- $xeTree.renderCheckbox(h, node, nodeid, isCheckboxChecked, isIndeterminate),
2833
+ $xeTree.renderRadio(h, node, nodeid, isExistChild, nLevel, isRadioChecked),
2834
+ $xeTree.renderCheckbox(h, node, nodeid, isExistChild, nLevel, isCheckboxChecked, isIndeterminate),
2829
2835
  h('div', {
2830
2836
  class: 'vxe-tree--node-item-inner'
2831
2837
  }, [
@@ -1,5 +1,5 @@
1
1
  import { DefineVxeComponentApp, DefineVxeComponentOptions, DefineVxeComponentInstance, VxeComponentEventParams, ValueOf } from '@vxe-ui/core'
2
- import { VxeColumnPropTypes, VxeColumnSlotTypes } from './column'
2
+ import { VxeColumnProps, VxeColumnSlots } from './column'
3
3
 
4
4
  /* eslint-disable @typescript-eslint/no-empty-interface,no-use-before-define,@typescript-eslint/ban-types */
5
5
 
@@ -20,67 +20,7 @@ export interface VxeColgroupPrivateRef extends ColgroupPrivateRef { }
20
20
  export namespace VxeColgroupPropTypes {
21
21
  }
22
22
 
23
- export interface VxeColgroupProps {
24
- /**
25
- * 渲染类型
26
- */
27
- type?: VxeColumnPropTypes.Type
28
- /**
29
- * 列字段名
30
- */
31
- field?: VxeColumnPropTypes.Field
32
- /**
33
- * 列标题
34
- */
35
- title?: VxeColumnPropTypes.Title
36
- /**
37
- * 列宽度
38
- */
39
- width?: VxeColumnPropTypes.Width
40
- /**
41
- * 列最小宽度,把剩余宽度按比例分配
42
- */
43
- minWidth?: VxeColumnPropTypes.MinWidth
44
- /**
45
- * 是否允许拖动列宽调整大小
46
- */
47
- resizable?: VxeColumnPropTypes.Resizable
48
- /**
49
- * 将列固定在左侧或者右侧
50
- */
51
- fixed?: VxeColumnPropTypes.Fixed
52
- /**
53
- * 列对齐方式
54
- */
55
- align?: VxeColumnPropTypes.Align
56
- /**
57
- * 表头对齐方式
58
- */
59
- headerAlign?: VxeColumnPropTypes.HeaderAlign
60
- /**
61
- * 当内容过长时显示为省略号
62
- */
63
- showOverflow?: VxeColumnPropTypes.ShowOverflow
64
- /**
65
- * 当表头内容过长时显示为省略号
66
- */
67
- showHeaderOverflow?: VxeColumnPropTypes.ShowHeaderOverflow
68
- /**
69
- * 给单元格附加 className
70
- */
71
- className?: VxeColumnPropTypes.ClassName
72
- /**
73
- * 给表头单元格附加 className
74
- */
75
- headerClassName?: VxeColumnPropTypes.HeaderClassName
76
- /**
77
- * 是否可视
78
- */
79
- visible?: VxeColumnPropTypes.Visible
80
- /**
81
- * 额外的参数
82
- */
83
- params?: VxeColumnPropTypes.Params
23
+ export interface VxeColgroupProps extends VxeColumnProps {
84
24
  }
85
25
 
86
26
  export interface ColgroupPrivateComputed {
@@ -116,15 +56,7 @@ export namespace VxeColgroupSlotTypes {
116
56
  export interface DefaultSlotParams {}
117
57
  }
118
58
 
119
- export interface VxeColgroupSlots<D = any> {
120
- /**
121
- * 自定义表头内容的模板
122
- */
123
- header?: (params: VxeColumnSlotTypes.HeaderSlotParams<D>) => any
124
- /**
125
- * 只对 type=checkbox,radio 有效,自定义标题模板
126
- */
127
- title?: (params: VxeColumnSlotTypes.HeaderSlotParams<D>) => any
59
+ export interface VxeColgroupSlots<D = any> extends VxeColumnSlots<D> {
128
60
  }
129
61
 
130
62
  export const Colgroup: typeof VxeColgroup
@@ -42,6 +42,8 @@ export namespace VxeColumnPropTypes {
42
42
  export type Padding = boolean
43
43
  export type VerticalAlign = '' | 'top' | 'center' | null
44
44
 
45
+ export type Rules<D = any> = VxeTableDefines.ValidatorRule<D>[]
46
+
45
47
  export type Formatter<D = any> = ((params: VxeColumnDefines.CellFormatterParams<D>) => string | number) | any[] | string
46
48
 
47
49
  export type HeaderFormatter = ((params: {
@@ -551,6 +553,10 @@ export interface VxeColumnProps<D = any> {
551
553
  * 是否启用浮动筛选
552
554
  */
553
555
  floatingFilters?: VxeColumnPropTypes.FloatingFilters
556
+ /**
557
+ * 列的校验规则
558
+ */
559
+ rules?: VxeColumnPropTypes.Rules<D>
554
560
  /**
555
561
  * 设置为分组节点
556
562
  */
@@ -271,7 +271,7 @@ export interface VxeFormItemProps<D = any> {
271
271
  * 项渲染配置项
272
272
  */
273
273
  itemRender?: VxeFormItemPropTypes.ItemRender
274
- Rules?: VxeFormItemPropTypes.Rules<D>
274
+ rules?: VxeFormItemPropTypes.Rules<D>
275
275
  slots?: VxeFormItemPropTypes.Slots
276
276
  children?: VxeFormItemProps<D>[]
277
277
 
@@ -6197,6 +6197,7 @@ export namespace VxeTableDefines {
6197
6197
  filterRecoverMethod: VxeColumnPropTypes.FilterRecoverMethod<D>
6198
6198
  filterRender: VxeColumnPropTypes.FilterRender
6199
6199
  floatingFilters: VxeColumnPropTypes.FloatingFilters
6200
+ rules: VxeColumnPropTypes.Rules<D>
6200
6201
  rowGroupNode: VxeColumnPropTypes.RowGroupNode
6201
6202
  treeNode: VxeColumnPropTypes.TreeNode
6202
6203
  dragSort: VxeColumnPropTypes.DragSort
@@ -64,10 +64,12 @@ export namespace VxeTreePropTypes {
64
64
  export type CheckNodeKey = string | number | null
65
65
  export interface RadioConfig<D = any> {
66
66
  strict?: boolean
67
+ visibleMode?: 'all' | 'first' | 'last' | '' | null
67
68
  visibleMethod?: (params: {
68
69
  $tree: VxeTreeConstructor
69
70
  node: D
70
71
  }) => boolean
72
+ checkMode?: 'all' | 'first' | 'last' | '' | null
71
73
  checkMethod?: (params: {
72
74
  $tree: VxeTreeConstructor
73
75
  node: D
@@ -82,10 +84,12 @@ export namespace VxeTreePropTypes {
82
84
  showHeader?: boolean
83
85
  checkStrictly?: boolean
84
86
  highlight?: boolean
87
+ visibleMode?: 'all' | 'first' | 'last' | '' | null
85
88
  visibleMethod?: (params: {
86
89
  $tree: VxeTreeConstructor
87
90
  node: D
88
91
  }) => boolean
92
+ checkMode?: 'all' | 'first' | 'last' | '' | null
89
93
  checkMethod?: (params: {
90
94
  $tree: VxeTreeConstructor
91
95
  node: D