vxe-table 4.16.0-beta.3 → 4.16.0-beta.5

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 (45) hide show
  1. package/es/style.css +1 -1
  2. package/es/table/module/custom/hook.js +10 -3
  3. package/es/table/module/custom/panel.js +139 -126
  4. package/es/table/module/keyboard/hook.js +2 -2
  5. package/es/table/src/cell.js +4 -0
  6. package/es/table/src/table.js +49 -12
  7. package/es/table/src/util.js +1 -0
  8. package/es/toolbar/src/toolbar.js +26 -24
  9. package/es/ui/index.js +1 -1
  10. package/es/ui/src/log.js +1 -1
  11. package/lib/index.umd.js +90 -47
  12. package/lib/index.umd.min.js +1 -1
  13. package/lib/style.css +1 -1
  14. package/lib/table/module/custom/hook.js +12 -3
  15. package/lib/table/module/custom/hook.min.js +1 -1
  16. package/lib/table/module/custom/panel.js +23 -9
  17. package/lib/table/module/custom/panel.min.js +1 -1
  18. package/lib/table/module/keyboard/hook.js +2 -2
  19. package/lib/table/module/keyboard/hook.min.js +1 -1
  20. package/lib/table/src/cell.js +8 -0
  21. package/lib/table/src/cell.min.js +1 -1
  22. package/lib/table/src/table.js +16 -14
  23. package/lib/table/src/table.min.js +1 -1
  24. package/lib/table/src/util.js +1 -0
  25. package/lib/table/src/util.min.js +1 -1
  26. package/lib/toolbar/src/toolbar.js +27 -17
  27. package/lib/toolbar/src/toolbar.min.js +1 -1
  28. package/lib/ui/index.js +1 -1
  29. package/lib/ui/index.min.js +1 -1
  30. package/lib/ui/src/log.js +1 -1
  31. package/lib/ui/src/log.min.js +1 -1
  32. package/package.json +1 -1
  33. package/packages/table/module/custom/hook.ts +10 -3
  34. package/packages/table/module/custom/panel.ts +150 -135
  35. package/packages/table/module/keyboard/hook.ts +2 -2
  36. package/packages/table/src/cell.ts +4 -0
  37. package/packages/table/src/table.ts +49 -12
  38. package/packages/table/src/util.ts +2 -0
  39. package/packages/toolbar/src/toolbar.ts +27 -25
  40. /package/es/{iconfont.1755253968888.ttf → iconfont.1755588973979.ttf} +0 -0
  41. /package/es/{iconfont.1755253968888.woff → iconfont.1755588973979.woff} +0 -0
  42. /package/es/{iconfont.1755253968888.woff2 → iconfont.1755588973979.woff2} +0 -0
  43. /package/lib/{iconfont.1755253968888.ttf → iconfont.1755588973979.ttf} +0 -0
  44. /package/lib/{iconfont.1755253968888.woff → iconfont.1755588973979.woff} +0 -0
  45. /package/lib/{iconfont.1755253968888.woff2 → iconfont.1755588973979.woff2} +0 -0
@@ -62,6 +62,10 @@ export default defineVxeComponent({
62
62
  // 使用已安装的组件,如果未安装则不渲染
63
63
  const VxeUIButtonComponent = VxeUI.getComponent('VxeButton')
64
64
 
65
+ const $xeGrid = inject<(VxeGridConstructor & GridPrivateMethods) | null>('$xeGrid', null)
66
+ const $xeGantt = inject('$xeGantt', null)
67
+ const $xeGGWrapper = $xeGrid || $xeGantt
68
+
65
69
  const { computeSize } = useFns.useSize(props)
66
70
 
67
71
  const reactData = reactive<ToolbarReactData>({
@@ -89,8 +93,6 @@ export default defineVxeComponent({
89
93
 
90
94
  let toolbarMethods = {} as ToolbarMethods
91
95
 
92
- const $xeGrid = inject<(VxeGridConstructor & GridPrivateMethods) | null>('$xeGrid', null)
93
-
94
96
  const computeRefreshOpts = computed(() => {
95
97
  return Object.assign({}, XEUtils.clone(getConfig().toolbar.refresh, true), props.refreshOptions, props.refresh) as VxeToolbarPropTypes.RefreshOptions
96
98
  })
@@ -187,9 +189,9 @@ export default defineVxeComponent({
187
189
  } catch (e) {
188
190
  reactData.isRefresh = false
189
191
  }
190
- } else if ($xeGrid) {
192
+ } else if ($xeGGWrapper) {
191
193
  reactData.isRefresh = true
192
- $xeGrid.triggerToolbarCommitEvent({ code: refreshOpts.code || 'reload' }, $event).catch((e) => e).then(() => {
194
+ $xeGGWrapper.triggerToolbarCommitEvent({ code: refreshOpts.code || 'reload' }, $event).catch(() => {}).then(() => {
193
195
  reactData.isRefresh = false
194
196
  })
195
197
  }
@@ -197,8 +199,8 @@ export default defineVxeComponent({
197
199
  }
198
200
 
199
201
  const zoomEvent: VxeButtonEvents.Click = ({ $event }) => {
200
- if ($xeGrid) {
201
- $xeGrid.triggerZoomEvent($event)
202
+ if ($xeGGWrapper) {
203
+ $xeGGWrapper.triggerZoomEvent($event)
202
204
  } else {
203
205
  warnLog('vxe.error.notProp', ['zoom'])
204
206
  }
@@ -306,11 +308,11 @@ export default defineVxeComponent({
306
308
  const { code } = item
307
309
  if (code) {
308
310
  handleDefaultCodeEvent(eventParams, item, () => {
309
- if ($xeGrid) {
310
- $xeGrid.triggerToolbarBtnEvent(item, $event)
311
+ if ($xeGGWrapper) {
312
+ $xeGGWrapper.triggerToolbarBtnEvent(item, $event)
311
313
  } else {
312
314
  const gCommandOpts = commands.get(code)
313
- const params = { code, button: item, $table: $table as VxeTableConstructor, $grid: $xeGrid, $gantt: null, $event }
315
+ const params = { code, button: item, $table: $table as VxeTableConstructor, $grid: $xeGrid, $gantt: $xeGantt, $event }
314
316
  if (gCommandOpts) {
315
317
  const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod
316
318
  if (tCommandMethod) {
@@ -332,11 +334,11 @@ export default defineVxeComponent({
332
334
  const { code } = item
333
335
  if (code) {
334
336
  handleDefaultCodeEvent(eventParams, item, () => {
335
- if ($xeGrid) {
336
- $xeGrid.triggerToolbarTolEvent(item, $event)
337
+ if ($xeGGWrapper) {
338
+ $xeGGWrapper.triggerToolbarTolEvent(item, $event)
337
339
  } else {
338
340
  const gCommandOpts = commands.get(code)
339
- const params = { code, button: null, tool: item, $table: $table as VxeTableConstructor, $grid: $xeGrid, $gantt: null, $event }
341
+ const params = { code, button: null, tool: item, $table: $table as VxeTableConstructor, $grid: $xeGrid, $gantt: $xeGantt, $event }
340
342
  if (gCommandOpts) {
341
343
  const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod
342
344
  if (tCommandMethod) {
@@ -410,7 +412,7 @@ export default defineVxeComponent({
410
412
  const buttonSuffixSlot = slots.buttonSuffix || slots['button-suffix']
411
413
  const btnVNs: VxeComponentSlotType[] = []
412
414
  if (buttonPrefixSlot) {
413
- btnVNs.push(...getSlotVNs(buttonPrefixSlot({ buttons: buttons || [], $grid: $xeGrid, $table: $table })))
415
+ btnVNs.push(...getSlotVNs(buttonPrefixSlot({ buttons: buttons || [], $grid: $xeGrid, $gantt: $xeGantt, $table: $table })))
414
416
  }
415
417
  if (buttons) {
416
418
  buttons.forEach((item, index) => {
@@ -419,7 +421,7 @@ export default defineVxeComponent({
419
421
  const compConf = buttonRender ? renderer.get(buttonRender.name) : null
420
422
  if (buttonRender && compConf && compConf.renderToolbarButton) {
421
423
  const toolbarButtonClassName = compConf.toolbarButtonClassName
422
- const params = { $grid: $xeGrid, $table: $table!, button: item }
424
+ const params = { $grid: $xeGrid, $gantt: $xeGantt, $table: $table!, button: item }
423
425
  btnVNs.push(
424
426
  h('span', {
425
427
  key: `br${item.code || index}`,
@@ -461,7 +463,7 @@ export default defineVxeComponent({
461
463
  })
462
464
  }
463
465
  if (buttonSuffixSlot) {
464
- btnVNs.push(...getSlotVNs(buttonSuffixSlot({ buttons: buttons || [], $grid: $xeGrid, $table: $table })))
466
+ btnVNs.push(...getSlotVNs(buttonSuffixSlot({ buttons: buttons || [], $grid: $xeGrid, $gantt: $xeGantt, $table: $table })))
465
467
  }
466
468
  return btnVNs
467
469
  }
@@ -477,7 +479,7 @@ export default defineVxeComponent({
477
479
  const toolSuffixSlot = slots.toolSuffix || slots['tool-suffix']
478
480
  const btnVNs: VxeComponentSlotType[] = []
479
481
  if (toolPrefixSlot) {
480
- btnVNs.push(...getSlotVNs(toolPrefixSlot({ tools: tools || [], $grid: $xeGrid, $table: $table })))
482
+ btnVNs.push(...getSlotVNs(toolPrefixSlot({ tools: tools || [], $grid: $xeGrid, $gantt: $xeGantt, $table: $table })))
481
483
  }
482
484
  if (tools) {
483
485
  tools.forEach((item, tIndex) => {
@@ -487,7 +489,7 @@ export default defineVxeComponent({
487
489
  const compConf = toolRender ? renderer.get(rdName) : null
488
490
  if (toolRender && compConf && compConf.renderToolbarTool) {
489
491
  const toolbarToolClassName = compConf.toolbarToolClassName
490
- const params = { $grid: $xeGrid, $table: $table!, tool: item }
492
+ const params = { $grid: $xeGrid, $gantt: $xeGantt, $table: $table!, tool: item }
491
493
  btnVNs.push(
492
494
  h('span', {
493
495
  key: rdName as string,
@@ -529,7 +531,7 @@ export default defineVxeComponent({
529
531
  })
530
532
  }
531
533
  if (toolSuffixSlot) {
532
- btnVNs.push(...getSlotVNs(toolSuffixSlot({ tools: tools || [], $grid: $xeGrid, $table: $table })))
534
+ btnVNs.push(...getSlotVNs(toolSuffixSlot({ tools: tools || [], $grid: $xeGrid, $gantt: $xeGantt, $table: $table })))
533
535
  }
534
536
  return btnVNs
535
537
  }
@@ -588,12 +590,12 @@ export default defineVxeComponent({
588
590
 
589
591
  const renderToolZoom = () => {
590
592
  const zoomOpts = computeZoomOpts.value
591
- return $xeGrid && VxeUIButtonComponent
593
+ return $xeGGWrapper && VxeUIButtonComponent
592
594
  ? h(VxeUIButtonComponent, {
593
595
  key: 'zoom',
594
596
  circle: true,
595
- icon: $xeGrid.isMaximized() ? (zoomOpts.iconOut || getIcon().TOOLBAR_TOOLS_MINIMIZE) : (zoomOpts.iconIn || getIcon().TOOLBAR_TOOLS_FULLSCREEN),
596
- title: getI18n(`vxe.toolbar.zoom${$xeGrid.isMaximized() ? 'Out' : 'In'}`),
597
+ icon: $xeGGWrapper.isMaximized() ? (zoomOpts.iconOut || getIcon().TOOLBAR_TOOLS_MINIMIZE) : (zoomOpts.iconIn || getIcon().TOOLBAR_TOOLS_FULLSCREEN),
598
+ title: getI18n(`vxe.toolbar.zoom${$xeGGWrapper.isMaximized() ? 'Out' : 'In'}`),
597
599
  onClick: zoomEvent
598
600
  })
599
601
  : createCommentVNode()
@@ -647,10 +649,10 @@ export default defineVxeComponent({
647
649
  }, [
648
650
  h('div', {
649
651
  class: 'vxe-buttons--wrapper'
650
- }, buttonsSlot ? buttonsSlot({ $grid: $xeGrid, $table: $table }) : renderLeftBtns()),
652
+ }, buttonsSlot ? buttonsSlot({ $grid: $xeGrid, $gantt: $xeGantt, $table: $table }) : renderLeftBtns()),
651
653
  h('div', {
652
654
  class: 'vxe-tools--wrapper'
653
- }, toolsSlot ? toolsSlot({ $grid: $xeGrid, $table: $table }) : renderRightTools()),
655
+ }, toolsSlot ? toolsSlot({ $grid: $xeGrid, $gantt: $xeGantt, $table: $table }) : renderRightTools()),
654
656
  h('div', {
655
657
  class: 'vxe-tools--operate'
656
658
  }, [
@@ -658,7 +660,7 @@ export default defineVxeComponent({
658
660
  props.export ? renderToolExport() : createCommentVNode(),
659
661
  props.print ? renderToolPrint() : createCommentVNode(),
660
662
  refresh ? renderToolRefresh() : createCommentVNode(),
661
- zoom && $xeGrid ? renderToolZoom() : createCommentVNode(),
663
+ zoom && $xeGGWrapper ? renderToolZoom() : createCommentVNode(),
662
664
  custom ? renderToolCustom() : createCommentVNode()
663
665
  ])
664
666
  ])
@@ -669,7 +671,7 @@ export default defineVxeComponent({
669
671
  nextTick(() => {
670
672
  const refreshOpts = computeRefreshOpts.value
671
673
  const queryMethod = refreshOpts.queryMethod || refreshOpts.query
672
- if (props.refresh && !$xeGrid && !queryMethod) {
674
+ if (props.refresh && !$xeGGWrapper && !queryMethod) {
673
675
  warnLog('vxe.error.notFunc', ['queryMethod'])
674
676
  }
675
677