vxe-table 4.7.77 → 4.7.79

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 (69) hide show
  1. package/README.en.md +1 -1
  2. package/README.ja-JP.md +1 -1
  3. package/README.md +1 -1
  4. package/README.zh-TW.md +1 -1
  5. package/es/grid/src/grid.js +45 -36
  6. package/es/style.css +1 -1
  7. package/es/table/module/custom/panel.js +5 -0
  8. package/es/table/render/index.js +4 -25
  9. package/es/table/src/body.js +26 -2
  10. package/es/table/src/cell.js +6 -6
  11. package/es/table/src/column.js +45 -18
  12. package/es/table/src/footer.js +16 -4
  13. package/es/table/src/group.js +18 -12
  14. package/es/table/src/header.js +4 -1
  15. package/es/table/src/props.js +96 -24
  16. package/es/table/src/table.js +2 -4
  17. package/es/table/src/util.js +1 -1
  18. package/es/toolbar/src/toolbar.js +89 -68
  19. package/es/ui/index.js +2 -2
  20. package/es/ui/src/log.js +1 -1
  21. package/es/ui/src/vn.js +23 -0
  22. package/lib/grid/src/grid.js +45 -39
  23. package/lib/grid/src/grid.min.js +1 -1
  24. package/lib/index.umd.js +278 -198
  25. package/lib/index.umd.min.js +1 -1
  26. package/lib/style.css +1 -1
  27. package/lib/table/module/custom/panel.js +7 -0
  28. package/lib/table/module/custom/panel.min.js +1 -1
  29. package/lib/table/render/index.js +7 -28
  30. package/lib/table/render/index.min.js +1 -1
  31. package/lib/table/src/cell.js +3 -3
  32. package/lib/table/src/cell.min.js +1 -1
  33. package/lib/table/src/column.js +16 -10
  34. package/lib/table/src/column.min.js +1 -1
  35. package/lib/table/src/group.js +17 -11
  36. package/lib/table/src/group.min.js +1 -1
  37. package/lib/table/src/table.js +2 -4
  38. package/lib/table/src/table.min.js +1 -1
  39. package/lib/table/src/util.js +1 -1
  40. package/lib/table/src/util.min.js +1 -1
  41. package/lib/toolbar/src/toolbar.js +109 -76
  42. package/lib/toolbar/src/toolbar.min.js +1 -1
  43. package/lib/ui/index.js +2 -2
  44. package/lib/ui/index.min.js +1 -1
  45. package/lib/ui/src/log.js +1 -1
  46. package/lib/ui/src/log.min.js +1 -1
  47. package/lib/ui/src/vn.js +25 -0
  48. package/lib/ui/src/vn.min.js +1 -1
  49. package/package.json +2 -2
  50. package/packages/grid/src/grid.ts +54 -44
  51. package/packages/table/module/custom/panel.ts +5 -0
  52. package/packages/table/render/index.ts +4 -27
  53. package/packages/table/src/body.ts +26 -2
  54. package/packages/table/src/cell.ts +9 -8
  55. package/packages/table/src/column.ts +47 -20
  56. package/packages/table/src/footer.ts +16 -4
  57. package/packages/table/src/group.ts +19 -13
  58. package/packages/table/src/header.ts +4 -1
  59. package/packages/table/src/props.ts +97 -24
  60. package/packages/table/src/table.ts +2 -4
  61. package/packages/table/src/util.ts +2 -2
  62. package/packages/toolbar/src/toolbar.ts +97 -75
  63. package/packages/ui/src/vn.ts +25 -0
  64. /package/es/{iconfont.1725604498089.ttf → iconfont.1726116305532.ttf} +0 -0
  65. /package/es/{iconfont.1725604498089.woff → iconfont.1726116305532.woff} +0 -0
  66. /package/es/{iconfont.1725604498089.woff2 → iconfont.1726116305532.woff2} +0 -0
  67. /package/lib/{iconfont.1725604498089.ttf → iconfont.1726116305532.ttf} +0 -0
  68. /package/lib/{iconfont.1725604498089.woff → iconfont.1726116305532.woff} +0 -0
  69. /package/lib/{iconfont.1725604498089.woff2 → iconfont.1726116305532.woff2} +0 -0
@@ -13,39 +13,85 @@ export default {
13
13
  // 表格的高度
14
14
  height: [Number, String] as PropType<VxeTablePropTypes.Height>,
15
15
  // 表格的最小高度
16
- minHeight: { type: [Number, String] as PropType<VxeTablePropTypes.MinHeight>, default: () => getConfig().table.minHeight },
16
+ minHeight: {
17
+ type: [Number, String] as PropType<VxeTablePropTypes.MinHeight>,
18
+ default: () => getConfig().table.minHeight
19
+ },
17
20
  // 表格的最大高度
18
21
  maxHeight: [Number, String] as PropType<VxeTablePropTypes.MaxHeight>,
19
22
  // 已废弃,被 column-config.resizable 替换
20
- resizable: { type: Boolean as PropType<VxeTablePropTypes.Resizable>, default: () => getConfig().table.resizable },
23
+ resizable: {
24
+ type: Boolean as PropType<VxeTablePropTypes.Resizable>,
25
+ default: () => getConfig().table.resizable
26
+ },
21
27
  // 是否带有斑马纹
22
- stripe: { type: Boolean as PropType<VxeTablePropTypes.Stripe>, default: () => getConfig().table.stripe },
28
+ stripe: {
29
+ type: Boolean as PropType<VxeTablePropTypes.Stripe>,
30
+ default: () => getConfig().table.stripe
31
+ },
23
32
  // 是否带有边框
24
- border: { type: [Boolean, String] as PropType<VxeTablePropTypes.Border>, default: () => getConfig().table.border },
33
+ border: {
34
+ type: [Boolean, String] as PropType<VxeTablePropTypes.Border>,
35
+ default: () => getConfig().table.border
36
+ },
25
37
  // 是否圆角边框
26
- round: { type: Boolean as PropType<VxeTablePropTypes.Round>, default: () => getConfig().table.round },
38
+ round: {
39
+ type: Boolean as PropType<VxeTablePropTypes.Round>,
40
+ default: () => getConfig().table.round
41
+ },
27
42
  // 表格的尺寸
28
- size: { type: String as PropType<VxeTablePropTypes.Size>, default: () => getConfig().table.size || getConfig().size },
43
+ size: {
44
+ type: String as PropType<VxeTablePropTypes.Size>,
45
+ default: () => getConfig().table.size || getConfig().size
46
+ },
29
47
  // 列的宽度是否自撑开(可能会被废弃的参数,不要使用)
30
- fit: { type: Boolean as PropType<VxeTablePropTypes.Fit>, default: () => getConfig().table.fit },
48
+ fit: {
49
+ type: Boolean as PropType<VxeTablePropTypes.Fit>,
50
+ default: () => getConfig().table.fit
51
+ },
31
52
  // 表格是否加载中
32
53
  loading: Boolean as PropType<VxeTablePropTypes.Loading>,
33
54
  // 所有的列对其方式
34
- align: { type: String as PropType<VxeTablePropTypes.Align>, default: () => getConfig().table.align },
55
+ align: {
56
+ type: String as PropType<VxeTablePropTypes.Align>,
57
+ default: () => getConfig().table.align
58
+ },
35
59
  // 所有的表头列的对齐方式
36
- headerAlign: { type: String as PropType<VxeTablePropTypes.HeaderAlign>, default: () => getConfig().table.headerAlign },
60
+ headerAlign: {
61
+ type: String as PropType<VxeTablePropTypes.HeaderAlign>,
62
+ default: () => getConfig().table.headerAlign
63
+ },
37
64
  // 所有的表尾列的对齐方式
38
- footerAlign: { type: String as PropType<VxeTablePropTypes.FooterAlign>, default: () => getConfig().table.footerAlign },
65
+ footerAlign: {
66
+ type: String as PropType<VxeTablePropTypes.FooterAlign>,
67
+ default: () => getConfig().table.footerAlign
68
+ },
39
69
  // 是否显示表头
40
- showHeader: { type: Boolean as PropType<VxeTablePropTypes.ShowHeader>, default: () => getConfig().table.showHeader },
70
+ showHeader: {
71
+ type: Boolean as PropType<VxeTablePropTypes.ShowHeader>,
72
+ default: () => getConfig().table.showHeader
73
+ },
41
74
  // (即将废弃)是否要高亮当前选中行
42
- highlightCurrentRow: { type: Boolean as PropType<VxeTablePropTypes.HighlightCurrentRow>, default: () => getConfig().table.highlightCurrentRow },
75
+ highlightCurrentRow: {
76
+ type: Boolean as PropType<VxeTablePropTypes.HighlightCurrentRow>,
77
+ default: () => getConfig().table.highlightCurrentRow
78
+ },
43
79
  // (即将废弃)鼠标移到行是否要高亮显示
44
- highlightHoverRow: { type: Boolean as PropType<VxeTablePropTypes.HighlightHoverRow>, default: () => getConfig().table.highlightHoverRow },
80
+ highlightHoverRow: {
81
+ type: Boolean as PropType<VxeTablePropTypes.HighlightHoverRow>,
82
+ default: () => getConfig().table.highlightHoverRow
83
+ },
45
84
  // (即将废弃)是否要高亮当前选中列
46
- highlightCurrentColumn: { type: Boolean as PropType<VxeTablePropTypes.HighlightCurrentColumn>, default: () => getConfig().table.highlightCurrentColumn },
85
+
86
+ highlightCurrentColumn: {
87
+ type: Boolean as PropType<VxeTablePropTypes.HighlightCurrentColumn>,
88
+ default: () => getConfig().table.highlightCurrentColumn
89
+ },
47
90
  // (即将废弃)鼠标移到列是否要高亮显示
48
- highlightHoverColumn: { type: Boolean as PropType<VxeTablePropTypes.HighlightHoverColumn>, default: () => getConfig().table.highlightHoverColumn },
91
+ highlightHoverColumn: {
92
+ type: Boolean as PropType<VxeTablePropTypes.HighlightHoverColumn>,
93
+ default: () => getConfig().table.highlightHoverColumn
94
+ },
49
95
  // (即将废弃)激活单元格编辑时是否高亮显示
50
96
  highlightCell: Boolean as PropType<VxeTablePropTypes.HighlightCell>,
51
97
  // 是否显示表尾合计
@@ -87,11 +133,20 @@ export default {
87
133
  // 表尾合并行或列
88
134
  footerSpanMethod: Function as PropType<VxeTablePropTypes.FooterSpanMethod>,
89
135
  // 设置所有内容过长时显示为省略号
90
- showOverflow: { type: [Boolean, String] as PropType<VxeTablePropTypes.ShowOverflow>, default: () => getConfig().table.showOverflow },
136
+ showOverflow: {
137
+ type: [Boolean, String] as PropType<VxeTablePropTypes.ShowOverflow>,
138
+ default: () => getConfig().table.showOverflow
139
+ },
91
140
  // 设置表头所有内容过长时显示为省略号
92
- showHeaderOverflow: { type: [Boolean, String] as PropType<VxeTablePropTypes.ShowHeaderOverflow>, default: () => getConfig().table.showHeaderOverflow },
141
+ showHeaderOverflow: {
142
+ type: [Boolean, String] as PropType<VxeTablePropTypes.ShowHeaderOverflow>,
143
+ default: () => getConfig().table.showHeaderOverflow
144
+ },
93
145
  // 设置表尾所有内容过长时显示为省略号
94
- showFooterOverflow: { type: [Boolean, String] as PropType<VxeTablePropTypes.ShowFooterOverflow>, default: () => getConfig().table.showFooterOverflow },
146
+ showFooterOverflow: {
147
+ type: [Boolean, String] as PropType<VxeTablePropTypes.ShowFooterOverflow>,
148
+ default: () => getConfig().table.showFooterOverflow
149
+ },
95
150
 
96
151
  /** 高级属性 */
97
152
  // (即将废弃)columnKey 已废弃,被 column-config.useKey 替换
@@ -99,12 +154,24 @@ export default {
99
154
  // (即将废弃)rowKey 已废弃,被 row-config.useKey 替换
100
155
  rowKey: Boolean as PropType<VxeTablePropTypes.RowKey>,
101
156
  // (即将废弃)rowId 已废弃,被 row-config.keyField 替换
102
- rowId: { type: String as PropType<VxeTablePropTypes.RowId>, default: () => getConfig().table.rowId },
157
+ rowId: {
158
+ type: String as PropType<VxeTablePropTypes.RowId>,
159
+ default: () => getConfig().table.rowId
160
+ },
103
161
  zIndex: Number as PropType<VxeTablePropTypes.ZIndex>,
104
- emptyText: { type: String as PropType<VxeTablePropTypes.EmptyText>, default: () => getConfig().table.emptyText },
105
- keepSource: { type: Boolean as PropType<VxeTablePropTypes.KeepSource>, default: () => getConfig().table.keepSource },
162
+ emptyText: {
163
+ type: String as PropType<VxeTablePropTypes.EmptyText>,
164
+ default: () => getConfig().table.emptyText
165
+ },
166
+ keepSource: {
167
+ type: Boolean as PropType<VxeTablePropTypes.KeepSource>,
168
+ default: () => getConfig().table.keepSource
169
+ },
106
170
  // 是否自动监听父容器变化去更新响应式表格宽高
107
- autoResize: { type: Boolean as PropType<VxeTablePropTypes.AutoResize>, default: () => getConfig().table.autoResize },
171
+ autoResize: {
172
+ type: Boolean as PropType<VxeTablePropTypes.AutoResize>,
173
+ default: () => getConfig().table.autoResize
174
+ },
108
175
  // 是否自动根据状态属性去更新响应式表格宽高
109
176
  syncResize: [Boolean, String, Number],
110
177
  // 响应式布局配置项
@@ -166,9 +233,15 @@ export default {
166
233
  // 纵向虚拟滚动配置项
167
234
  scrollY: Object as PropType<VxeTablePropTypes.ScrollY>,
168
235
  // (即将废弃)优化相关
169
- animat: { type: Boolean as PropType<VxeTablePropTypes.Animat>, default: () => getConfig().table.animat },
236
+ animat: {
237
+ type: Boolean as PropType<VxeTablePropTypes.Animat>,
238
+ default: () => getConfig().table.animat
239
+ },
170
240
  // (可能会被废弃的参数,不要使用)
171
- delayHover: { type: Number as PropType<VxeTablePropTypes.DelayHover>, default: () => getConfig().table.delayHover as number },
241
+ delayHover: {
242
+ type: Number as PropType<VxeTablePropTypes.DelayHover>,
243
+ default: () => getConfig().table.delayHover as number
244
+ },
172
245
  // 额外的参数
173
246
  params: Object as PropType<VxeTablePropTypes.Params>
174
247
  }
@@ -6968,9 +6968,7 @@ export default defineComponent({
6968
6968
  globalEvents.on($xeTable, 'mousewheel', handleGlobalMousewheelEvent)
6969
6969
  globalEvents.on($xeTable, 'keydown', handleGlobalKeydownEvent)
6970
6970
  globalEvents.on($xeTable, 'resize', handleGlobalResizeEvent)
6971
- if ($xeTable.handleGlobalContextmenuEvent) {
6972
- globalEvents.on($xeTable, 'contextmenu', $xeTable.handleGlobalContextmenuEvent)
6973
- }
6971
+ globalEvents.on($xeTable, 'contextmenu', $xeTable.handleGlobalContextmenuEvent)
6974
6972
  tablePrivateMethods.preventEvent(null, 'mounted', { $table: $xeTable })
6975
6973
  })
6976
6974
 
@@ -7176,7 +7174,7 @@ export default defineComponent({
7176
7174
  })
7177
7175
  : createCommentVNode(),
7178
7176
  /**
7179
- * 导出/导出
7177
+ * 导出
7180
7178
  */
7181
7179
  initStore.export && (props.exportConfig || props.printConfig)
7182
7180
  ? h(TableExportPanelComponent, {
@@ -120,7 +120,7 @@ export function getRowid ($xeTable: VxeTableConstructor, row: any) {
120
120
  }
121
121
 
122
122
  export interface XEColumnInstance {
123
- column: ColumnInfo;
123
+ columnConfig: ColumnInfo;
124
124
  }
125
125
 
126
126
  export const handleFieldOrColumn = ($xeTable: VxeTableConstructor, fieldOrColumn: string | VxeTableDefines.ColumnInfo | null) => {
@@ -294,7 +294,7 @@ export function assembleColumn ($xeTable: VxeTableConstructor & VxeTablePrivateM
294
294
  const { reactData } = $xeTable
295
295
  const { staticColumns } = reactData
296
296
  const parentElem = elem.parentNode
297
- const parentColumn = colgroup ? colgroup.column : null
297
+ const parentColumn = colgroup ? colgroup.columnConfig : null
298
298
  const parentCols = parentColumn ? parentColumn.children : staticColumns
299
299
  if (parentElem && parentCols) {
300
300
  parentCols.splice(XEUtils.arrayIndexOf(parentElem.children, elem), 0, column)
@@ -4,8 +4,8 @@ import { VxeUI } from '../../ui'
4
4
  import { getSlotVNs } from '../../ui/src/vn'
5
5
  import { warnLog, errLog } from '../../ui/src/log'
6
6
 
7
- import type { VxeButtonComponent, VxeButtonEvents } from 'vxe-pc-ui'
8
- import type { VxeGridConstructor, GridPrivateMethods, ToolbarMethods, VxeToolbarConstructor, VxeToolbarEmits, VxeToolbarPropTypes, VxeTableConstructor, ToolbarPrivateRef, VxeTableMethods, VxeTablePrivateMethods, ToolbarReactData } from '../../../types'
7
+ import type { ValueOf, VxeButtonComponent, VxeButtonEvents } from 'vxe-pc-ui'
8
+ import type { VxeGridConstructor, GridPrivateMethods, ToolbarMethods, ToolbarInternalData, VxeToolbarConstructor, VxeToolbarEmits, VxeToolbarPropTypes, ToolbarPrivateRef, ToolbarReactData } from '../../../types'
9
9
 
10
10
  const { getConfig, getIcon, getI18n, renderer, commands, createEvent, useFns } = VxeUI
11
11
 
@@ -19,10 +19,22 @@ export default defineComponent({
19
19
  print: [Boolean, Object] as PropType<VxeToolbarPropTypes.Print>,
20
20
  zoom: [Boolean, Object] as PropType< VxeToolbarPropTypes.Zoom>,
21
21
  custom: [Boolean, Object] as PropType<VxeToolbarPropTypes.Custom>,
22
- buttons: { type: Array as PropType<VxeToolbarPropTypes.Buttons>, default: () => getConfig().toolbar.buttons },
23
- tools: { type: Array as PropType<VxeToolbarPropTypes.Tools>, default: () => getConfig().toolbar.tools },
24
- perfect: { type: Boolean as PropType<VxeToolbarPropTypes.Perfect>, default: () => getConfig().toolbar.perfect },
25
- size: { type: String as PropType<VxeToolbarPropTypes.Size>, default: () => getConfig().toolbar.size || getConfig().size },
22
+ buttons: {
23
+ type: Array as PropType<VxeToolbarPropTypes.Buttons>,
24
+ default: () => getConfig().toolbar.buttons
25
+ },
26
+ tools: {
27
+ type: Array as PropType<VxeToolbarPropTypes.Tools>,
28
+ default: () => getConfig().toolbar.tools
29
+ },
30
+ perfect: {
31
+ type: Boolean as PropType<VxeToolbarPropTypes.Perfect>,
32
+ default: () => getConfig().toolbar.perfect
33
+ },
34
+ size: {
35
+ type: String as PropType<VxeToolbarPropTypes.Size>,
36
+ default: () => getConfig().toolbar.size || getConfig().size
37
+ },
26
38
  className: [String, Function] as PropType<VxeToolbarPropTypes.ClassName>
27
39
  },
28
40
  emits: [
@@ -41,9 +53,14 @@ export default defineComponent({
41
53
 
42
54
  const reactData = reactive<ToolbarReactData>({
43
55
  isRefresh: false,
56
+ connectFlag: 0,
44
57
  columns: []
45
58
  })
46
59
 
60
+ const internalData: ToolbarInternalData = {
61
+ connectTable: null
62
+ }
63
+
47
64
  const refElem = ref() as Ref<HTMLDivElement>
48
65
 
49
66
  const refMaps: ToolbarPrivateRef = {
@@ -55,15 +72,13 @@ export default defineComponent({
55
72
  props,
56
73
  context,
57
74
  reactData,
75
+ internalData,
58
76
  getRefMaps: () => refMaps
59
77
  } as unknown as VxeToolbarConstructor
60
78
 
61
79
  let toolbarMethods = {} as ToolbarMethods
62
80
 
63
- const $xeGrid = inject('$xeGrid', null as (VxeGridConstructor & GridPrivateMethods) | null)
64
- const refTable = ref<VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods>()
65
-
66
- const connectFlag = ref(0)
81
+ const $xeGrid = inject<(VxeGridConstructor & GridPrivateMethods) | null>('$xeGrid', null)
67
82
 
68
83
  const computeRefreshOpts = computed(() => {
69
84
  return Object.assign({}, getConfig().toolbar.refresh, props.refresh) as VxeToolbarPropTypes.RefreshOpts
@@ -90,8 +105,9 @@ export default defineComponent({
90
105
  })
91
106
 
92
107
  const computeTableCustomOpts = computed(() => {
93
- const $table = refTable.value
94
- if (connectFlag.value || $table) {
108
+ const { connectTable } = internalData
109
+ const $table = connectTable
110
+ if (reactData.connectFlag || $table) {
95
111
  if ($table) {
96
112
  const { computeCustomOpts } = $table.getComputeMaps()
97
113
  return computeCustomOpts.value
@@ -106,7 +122,8 @@ export default defineComponent({
106
122
  })
107
123
 
108
124
  const checkTable = () => {
109
- const $table = refTable.value
125
+ const { connectTable } = internalData
126
+ const $table = connectTable
110
127
  if ($table) {
111
128
  return true
112
129
  }
@@ -114,7 +131,8 @@ export default defineComponent({
114
131
  }
115
132
 
116
133
  const handleClickSettingEvent = ({ $event }: any) => {
117
- const $table = refTable.value
134
+ const { connectTable } = internalData
135
+ const $table = connectTable
118
136
  if ($table) {
119
137
  if ($table.triggerCustomEvent) {
120
138
  $table.triggerCustomEvent($event)
@@ -125,7 +143,8 @@ export default defineComponent({
125
143
  }
126
144
 
127
145
  const handleMouseenterSettingEvent = ({ $event }: any) => {
128
- const $table = refTable.value
146
+ const { connectTable } = internalData
147
+ const $table = connectTable
129
148
  if ($table) {
130
149
  $table.customOpenEvent($event)
131
150
  } else {
@@ -134,7 +153,8 @@ export default defineComponent({
134
153
  }
135
154
 
136
155
  const handleMouseleaveSettingEvent = ({ $event }: any) => {
137
- const $table = refTable.value
156
+ const { connectTable } = internalData
157
+ const $table = connectTable
138
158
  if ($table) {
139
159
  const { customStore } = $table.reactData
140
160
  customStore.activeBtn = false
@@ -176,7 +196,8 @@ export default defineComponent({
176
196
  }
177
197
 
178
198
  const btnEvent = (evnt: Event, item: VxeToolbarPropTypes.ButtonConfig) => {
179
- const $table = refTable.value
199
+ const { connectTable } = internalData
200
+ const $table = connectTable
180
201
  const { code } = item
181
202
  if (code) {
182
203
  if ($xeGrid) {
@@ -200,7 +221,8 @@ export default defineComponent({
200
221
  }
201
222
 
202
223
  const tolEvent = (evnt: Event, item: VxeToolbarPropTypes.ButtonConfig) => {
203
- const $table = refTable.value
224
+ const { connectTable } = internalData
225
+ const $table = connectTable
204
226
  const { code } = item
205
227
  if (code) {
206
228
  if ($xeGrid) {
@@ -225,7 +247,8 @@ export default defineComponent({
225
247
 
226
248
  const importEvent = () => {
227
249
  if (checkTable()) {
228
- const $table = refTable.value
250
+ const { connectTable } = internalData
251
+ const $table = connectTable
229
252
  if ($table) {
230
253
  $table.openImport()
231
254
  }
@@ -234,7 +257,8 @@ export default defineComponent({
234
257
 
235
258
  const exportEvent = () => {
236
259
  if (checkTable()) {
237
- const $table = refTable.value
260
+ const { connectTable } = internalData
261
+ const $table = connectTable
238
262
  if ($table) {
239
263
  $table.openExport()
240
264
  }
@@ -243,13 +267,29 @@ export default defineComponent({
243
267
 
244
268
  const printEvent = () => {
245
269
  if (checkTable()) {
246
- const $table = refTable.value
270
+ const { connectTable } = internalData
271
+ const $table = connectTable
247
272
  if ($table) {
248
273
  $table.openPrint()
249
274
  }
250
275
  }
251
276
  }
252
277
 
278
+ const dispatchEvent = (type: ValueOf<VxeToolbarEmits>, params: Record<string, any>, evnt: Event | null) => {
279
+ emit(type, createEvent(evnt, { $toolbar: $xeToolbar }, params))
280
+ }
281
+
282
+ toolbarMethods = {
283
+ dispatchEvent,
284
+ syncUpdate (params) {
285
+ internalData.connectTable = params.$table
286
+ reactData.columns = params.collectColumn
287
+ reactData.connectFlag++
288
+ }
289
+ }
290
+
291
+ Object.assign($xeToolbar, toolbarMethods)
292
+
253
293
  const renderDropdowns = (item: VxeToolbarPropTypes.ButtonConfig, isBtn: boolean) => {
254
294
  const { dropdowns } = item
255
295
  const downVNs: VNode[] = []
@@ -283,11 +323,8 @@ export default defineComponent({
283
323
  */
284
324
  const renderBtns = () => {
285
325
  const { buttons } = props
286
- const $table = refTable.value
287
- const buttonsSlot = slots.buttons
288
- if (buttonsSlot) {
289
- return getSlotVNs(buttonsSlot({ $grid: $xeGrid, $table: $table }))
290
- }
326
+ const { connectTable } = internalData
327
+ const $table = connectTable
291
328
  const btnVNs: VNode[] = []
292
329
  if (buttons) {
293
330
  buttons.forEach((item) => {
@@ -339,11 +376,8 @@ export default defineComponent({
339
376
  */
340
377
  const renderRightTools = () => {
341
378
  const { tools } = props
342
- const $table = refTable.value
343
- const toolsSlot = slots.tools
344
- if (toolsSlot) {
345
- return getSlotVNs(toolsSlot({ $grid: $xeGrid, $table: $table }))
346
- }
379
+ const { connectTable } = internalData
380
+ const $table = connectTable
347
381
  const btnVNs: VNode[] = []
348
382
  if (tools) {
349
383
  tools.forEach((item, tIndex) => {
@@ -487,47 +521,14 @@ export default defineComponent({
487
521
  : createCommentVNode()
488
522
  }
489
523
 
490
- toolbarMethods = {
491
- dispatchEvent (type, params, evnt) {
492
- emit(type, createEvent(evnt, { $toolbar: $xeToolbar }, params))
493
- },
494
- syncUpdate (params) {
495
- const { collectColumn } = params
496
- refTable.value = params.$table
497
- reactData.columns = collectColumn
498
- connectFlag.value++
499
- }
500
- }
501
-
502
- Object.assign($xeToolbar, toolbarMethods)
503
-
504
- nextTick(() => {
505
- const { refresh } = props
506
- const refreshOpts = computeRefreshOpts.value
507
- const queryMethod = refreshOpts.queryMethod || refreshOpts.query
508
- if (refresh && !$xeGrid && !queryMethod) {
509
- warnLog('vxe.error.notFunc', ['queryMethod'])
510
- }
511
- const customOpts = computeCustomOpts.value
512
- if (process.env.VUE_APP_VXE_ENV === 'development') {
513
- if (customOpts.isFooter) {
514
- warnLog('vxe.error.delProp', ['toolbar.custom.isFooter', 'table.custom-config.showFooter'])
515
- }
516
- if (customOpts.showFooter) {
517
- warnLog('vxe.error.delProp', ['toolbar.custom.showFooter', 'table.custom-config.showFooter'])
518
- }
519
- if (customOpts.immediate) {
520
- warnLog('vxe.error.delProp', ['toolbar.custom.immediate', 'table.custom-config.immediate'])
521
- }
522
- if (customOpts.trigger) {
523
- warnLog('vxe.error.delProp', ['toolbar.custom.trigger', 'table.custom-config.trigger'])
524
- }
525
- }
526
- })
527
-
528
524
  const renderVN = () => {
529
525
  const { perfect, loading, refresh, zoom, custom, className } = props
526
+ const { connectTable } = internalData
530
527
  const vSize = computeSize.value
528
+ const toolsSlot = slots.tools
529
+ const buttonsSlot = slots.buttons
530
+ const $table = connectTable
531
+
531
532
  return h('div', {
532
533
  ref: refElem,
533
534
  class: ['vxe-toolbar', className ? (XEUtils.isFunction(className) ? className({ $toolbar: $xeToolbar }) : className) : '', {
@@ -538,10 +539,10 @@ export default defineComponent({
538
539
  }, [
539
540
  h('div', {
540
541
  class: 'vxe-buttons--wrapper'
541
- }, renderBtns()),
542
+ }, buttonsSlot ? buttonsSlot({ $grid: $xeGrid, $table: $table }) : renderBtns()),
542
543
  h('div', {
543
544
  class: 'vxe-tools--wrapper'
544
- }, renderRightTools()),
545
+ }, toolsSlot ? toolsSlot({ $grid: $xeGrid, $table: $table }) : renderRightTools()),
545
546
  h('div', {
546
547
  class: 'vxe-tools--operate'
547
548
  }, [
@@ -557,15 +558,36 @@ export default defineComponent({
557
558
 
558
559
  $xeToolbar.renderVN = renderVN
559
560
 
560
- if (process.env.VUE_APP_VXE_ENV === 'development') {
561
- nextTick(() => {
561
+ nextTick(() => {
562
+ const { refresh } = props
563
+ const refreshOpts = computeRefreshOpts.value
564
+ const queryMethod = refreshOpts.queryMethod || refreshOpts.query
565
+ if (refresh && !$xeGrid && !queryMethod) {
566
+ warnLog('vxe.error.notFunc', ['queryMethod'])
567
+ }
568
+ const customOpts = computeCustomOpts.value
569
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
570
+ if (customOpts.isFooter) {
571
+ warnLog('vxe.error.delProp', ['toolbar.custom.isFooter', 'table.custom-config.showFooter'])
572
+ }
573
+ if (customOpts.showFooter) {
574
+ warnLog('vxe.error.delProp', ['toolbar.custom.showFooter', 'table.custom-config.showFooter'])
575
+ }
576
+ if (customOpts.immediate) {
577
+ warnLog('vxe.error.delProp', ['toolbar.custom.immediate', 'table.custom-config.immediate'])
578
+ }
579
+ if (customOpts.trigger) {
580
+ warnLog('vxe.error.delProp', ['toolbar.custom.trigger', 'table.custom-config.trigger'])
581
+ }
582
+ }
583
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
562
584
  if (props.refresh || props.import || props.export || props.print || props.zoom) {
563
585
  if (!VxeUIButtonComponent) {
564
586
  errLog('vxe.error.reqComp', ['vxe-button'])
565
587
  }
566
588
  }
567
- })
568
- }
589
+ }
590
+ })
569
591
 
570
592
  return $xeToolbar
571
593
  },
@@ -6,6 +6,31 @@ export function getOnName (type: string) {
6
6
  return 'on' + type.substring(0, 1).toLocaleUpperCase() + type.substring(1)
7
7
  }
8
8
 
9
+ export function getModelEvent (renderOpts: any) {
10
+ switch (renderOpts.name) {
11
+ case 'input':
12
+ case 'textarea':
13
+ return 'input'
14
+ case 'select':
15
+ return 'change'
16
+ }
17
+ return 'update:modelValue'
18
+ }
19
+
20
+ export function getChangeEvent (renderOpts: any) {
21
+ switch (renderOpts.name) {
22
+ case 'input':
23
+ case 'textarea':
24
+ case 'VxeInput':
25
+ case 'VxeNumberInput':
26
+ case 'VxeTextarea':
27
+ case '$input':
28
+ case '$textarea':
29
+ return 'input'
30
+ }
31
+ return 'change'
32
+ }
33
+
9
34
  export function getSlotVNs (vns: VxeComponentSlotType | VxeComponentSlotType[]) {
10
35
  if (XEUtils.isArray(vns)) {
11
36
  return vns