vxe-table 4.23.11 → 4.23.13

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 (278) hide show
  1. package/dist/all.esm.js +20675 -20631
  2. package/dist/all.esm.min.js +3 -0
  3. package/es/colgroup/index.d.ts +18 -18
  4. package/es/column/index.d.ts +18 -18
  5. package/es/grid/index.d.ts +174 -174
  6. package/es/grid/src/emits.d.ts +1 -1
  7. package/es/grid/src/emits.js +3 -3
  8. package/es/grid/src/grid.d.ts +27 -27
  9. package/es/grid/src/grid.js +1670 -1667
  10. package/es/grid/src/props.d.ts +2 -2
  11. package/es/grid/src/props.js +4 -4
  12. package/es/index.esm.js +1 -0
  13. package/es/index.js +1 -0
  14. package/es/table/index.d.ts +174 -174
  15. package/es/table/module/custom/panel.js +1588 -1585
  16. package/es/table/module/export/export-panel.js +587 -584
  17. package/es/table/module/export/import-panel.js +258 -255
  18. package/es/table/module/filter/hook.js +1 -15
  19. package/es/table/module/filter/panel.js +281 -278
  20. package/es/table/module/menu/panel.js +225 -222
  21. package/es/table/src/body.js +895 -892
  22. package/es/table/src/column.d.ts +3 -3
  23. package/es/table/src/column.js +39 -36
  24. package/es/table/src/emits.d.ts +1 -1
  25. package/es/table/src/emits.js +2 -2
  26. package/es/table/src/footer.d.ts +2 -2
  27. package/es/table/src/footer.js +341 -338
  28. package/es/table/src/group.d.ts +3 -3
  29. package/es/table/src/group.js +49 -46
  30. package/es/table/src/header.js +539 -536
  31. package/es/table/src/props.d.ts +2 -2
  32. package/es/table/src/props.js +2 -2
  33. package/es/table/src/table.d.ts +27 -27
  34. package/es/table/src/table.js +13744 -13724
  35. package/es/toolbar/index.d.ts +18 -18
  36. package/es/toolbar/src/toolbar.d.ts +3 -3
  37. package/es/toolbar/src/toolbar.js +595 -592
  38. package/es/ui/index.js +2 -1
  39. package/es/ui/src/dom.d.ts +1 -1
  40. package/es/ui/src/log.js +1 -1
  41. package/es/ui/src/vn.d.ts +2 -2
  42. package/lib/colgroup/index.d.ts +760 -0
  43. package/lib/column/index.d.ts +760 -0
  44. package/lib/components.d.ts +13 -0
  45. package/lib/grid/index.d.ts +2824 -0
  46. package/lib/grid/src/emits.d.ts +2 -0
  47. package/lib/grid/src/emits.js +2 -2
  48. package/lib/grid/src/grid.d.ts +556 -0
  49. package/lib/grid/src/grid.js +1666 -1663
  50. package/lib/grid/src/props.d.ts +200 -0
  51. package/lib/grid/src/props.js +3 -3
  52. package/lib/index.common.js +1 -0
  53. package/lib/index.d.ts +3 -0
  54. package/lib/index.js +1 -0
  55. package/lib/index.umd.js +20675 -20631
  56. package/lib/index.umd.min.js +3 -3
  57. package/lib/locale/ar-EG.umd.d.ts +908 -0
  58. package/lib/locale/ar-EG.umd.min.js +1 -0
  59. package/lib/locale/de-DE.umd.d.ts +908 -0
  60. package/lib/locale/de-DE.umd.min.js +1 -0
  61. package/lib/locale/en-US.umd.d.ts +908 -0
  62. package/lib/locale/en-US.umd.min.js +1 -0
  63. package/lib/locale/es-ES.umd.d.ts +908 -0
  64. package/lib/locale/es-ES.umd.min.js +1 -0
  65. package/lib/locale/fr-FR.umd.d.ts +908 -0
  66. package/lib/locale/fr-FR.umd.min.js +1 -0
  67. package/lib/locale/hu-HU.umd.d.ts +908 -0
  68. package/lib/locale/hu-HU.umd.min.js +1 -0
  69. package/lib/locale/hy-AM.umd.d.ts +908 -0
  70. package/lib/locale/hy-AM.umd.min.js +1 -0
  71. package/lib/locale/id-ID.umd.d.ts +908 -0
  72. package/lib/locale/id-ID.umd.min.js +1 -0
  73. package/lib/locale/it-IT.umd.d.ts +908 -0
  74. package/lib/locale/it-IT.umd.min.js +1 -0
  75. package/lib/locale/ja-JP.umd.d.ts +908 -0
  76. package/lib/locale/ja-JP.umd.min.js +1 -0
  77. package/lib/locale/ko-KR.umd.d.ts +908 -0
  78. package/lib/locale/ko-KR.umd.min.js +1 -0
  79. package/lib/locale/lang/ar-EG.d.ts +908 -0
  80. package/lib/locale/lang/ar-EG.umd.d.ts +908 -0
  81. package/lib/locale/lang/ar-EG.umd.min.js +1 -0
  82. package/lib/locale/lang/de-DE.d.ts +908 -0
  83. package/lib/locale/lang/de-DE.umd.d.ts +908 -0
  84. package/lib/locale/lang/de-DE.umd.min.js +1 -0
  85. package/lib/locale/lang/en-US.d.ts +908 -0
  86. package/lib/locale/lang/en-US.umd.d.ts +908 -0
  87. package/lib/locale/lang/en-US.umd.min.js +1 -0
  88. package/lib/locale/lang/es-ES.d.ts +908 -0
  89. package/lib/locale/lang/es-ES.umd.d.ts +908 -0
  90. package/lib/locale/lang/es-ES.umd.min.js +1 -0
  91. package/lib/locale/lang/fr-FR.d.ts +908 -0
  92. package/lib/locale/lang/fr-FR.umd.d.ts +908 -0
  93. package/lib/locale/lang/fr-FR.umd.min.js +1 -0
  94. package/lib/locale/lang/hu-HU.d.ts +908 -0
  95. package/lib/locale/lang/hu-HU.umd.d.ts +908 -0
  96. package/lib/locale/lang/hu-HU.umd.min.js +1 -0
  97. package/lib/locale/lang/hy-AM.d.ts +908 -0
  98. package/lib/locale/lang/hy-AM.umd.d.ts +908 -0
  99. package/lib/locale/lang/hy-AM.umd.min.js +1 -0
  100. package/lib/locale/lang/id-ID.d.ts +908 -0
  101. package/lib/locale/lang/id-ID.umd.d.ts +908 -0
  102. package/lib/locale/lang/id-ID.umd.min.js +1 -0
  103. package/lib/locale/lang/it-IT.d.ts +908 -0
  104. package/lib/locale/lang/it-IT.umd.d.ts +908 -0
  105. package/lib/locale/lang/it-IT.umd.min.js +1 -0
  106. package/lib/locale/lang/ja-JP.d.ts +908 -0
  107. package/lib/locale/lang/ja-JP.umd.d.ts +908 -0
  108. package/lib/locale/lang/ja-JP.umd.min.js +1 -0
  109. package/lib/locale/lang/ko-KR.d.ts +908 -0
  110. package/lib/locale/lang/ko-KR.umd.d.ts +908 -0
  111. package/lib/locale/lang/ko-KR.umd.min.js +1 -0
  112. package/lib/locale/lang/ms-MY.d.ts +908 -0
  113. package/lib/locale/lang/ms-MY.umd.d.ts +908 -0
  114. package/lib/locale/lang/ms-MY.umd.min.js +1 -0
  115. package/lib/locale/lang/nb-NO.d.ts +908 -0
  116. package/lib/locale/lang/nb-NO.umd.d.ts +908 -0
  117. package/lib/locale/lang/nb-NO.umd.min.js +1 -0
  118. package/lib/locale/lang/pt-BR.d.ts +908 -0
  119. package/lib/locale/lang/pt-BR.umd.d.ts +908 -0
  120. package/lib/locale/lang/pt-BR.umd.min.js +1 -0
  121. package/lib/locale/lang/ru-RU.d.ts +908 -0
  122. package/lib/locale/lang/ru-RU.umd.d.ts +908 -0
  123. package/lib/locale/lang/ru-RU.umd.min.js +1 -0
  124. package/lib/locale/lang/th-TH.d.ts +908 -0
  125. package/lib/locale/lang/th-TH.umd.d.ts +908 -0
  126. package/lib/locale/lang/th-TH.umd.min.js +1 -0
  127. package/lib/locale/lang/ug-CN.d.ts +908 -0
  128. package/lib/locale/lang/ug-CN.umd.d.ts +908 -0
  129. package/lib/locale/lang/ug-CN.umd.min.js +1 -0
  130. package/lib/locale/lang/uk-UA.d.ts +908 -0
  131. package/lib/locale/lang/uk-UA.umd.d.ts +908 -0
  132. package/lib/locale/lang/uk-UA.umd.min.js +1 -0
  133. package/lib/locale/lang/uz-UZ.d.ts +908 -0
  134. package/lib/locale/lang/uz-UZ.umd.d.ts +908 -0
  135. package/lib/locale/lang/uz-UZ.umd.min.js +1 -0
  136. package/lib/locale/lang/vi-VN.d.ts +908 -0
  137. package/lib/locale/lang/vi-VN.umd.d.ts +908 -0
  138. package/lib/locale/lang/vi-VN.umd.min.js +1 -0
  139. package/lib/locale/lang/zh-CHT.d.ts +908 -0
  140. package/lib/locale/lang/zh-CHT.umd.d.ts +908 -0
  141. package/lib/locale/lang/zh-CHT.umd.min.js +1 -0
  142. package/lib/locale/lang/zh-CN.d.ts +908 -0
  143. package/lib/locale/lang/zh-CN.umd.d.ts +908 -0
  144. package/lib/locale/lang/zh-CN.umd.min.js +1 -0
  145. package/lib/locale/lang/zh-HK.d.ts +908 -0
  146. package/lib/locale/lang/zh-HK.umd.d.ts +908 -0
  147. package/lib/locale/lang/zh-HK.umd.min.js +1 -0
  148. package/lib/locale/lang/zh-MO.d.ts +908 -0
  149. package/lib/locale/lang/zh-MO.umd.d.ts +908 -0
  150. package/lib/locale/lang/zh-MO.umd.min.js +1 -0
  151. package/lib/locale/lang/zh-TC.d.ts +908 -0
  152. package/lib/locale/lang/zh-TC.umd.d.ts +908 -0
  153. package/lib/locale/lang/zh-TC.umd.min.js +1 -0
  154. package/lib/locale/lang/zh-TW.d.ts +908 -0
  155. package/lib/locale/lang/zh-TW.umd.d.ts +908 -0
  156. package/lib/locale/lang/zh-TW.umd.min.js +1 -0
  157. package/lib/locale/ms-MY.umd.d.ts +908 -0
  158. package/lib/locale/ms-MY.umd.min.js +1 -0
  159. package/lib/locale/nb-NO.umd.d.ts +908 -0
  160. package/lib/locale/nb-NO.umd.min.js +1 -0
  161. package/lib/locale/pt-BR.umd.d.ts +908 -0
  162. package/lib/locale/pt-BR.umd.min.js +1 -0
  163. package/lib/locale/ru-RU.umd.d.ts +908 -0
  164. package/lib/locale/ru-RU.umd.min.js +1 -0
  165. package/lib/locale/th-TH.umd.d.ts +908 -0
  166. package/lib/locale/th-TH.umd.min.js +1 -0
  167. package/lib/locale/ug-CN.umd.d.ts +908 -0
  168. package/lib/locale/ug-CN.umd.min.js +1 -0
  169. package/lib/locale/uk-UA.umd.d.ts +908 -0
  170. package/lib/locale/uk-UA.umd.min.js +1 -0
  171. package/lib/locale/uz-UZ.umd.d.ts +908 -0
  172. package/lib/locale/uz-UZ.umd.min.js +1 -0
  173. package/lib/locale/vi-VN.umd.d.ts +908 -0
  174. package/lib/locale/vi-VN.umd.min.js +1 -0
  175. package/lib/locale/zh-CHT.umd.d.ts +908 -0
  176. package/lib/locale/zh-CHT.umd.min.js +1 -0
  177. package/lib/locale/zh-CN.umd.d.ts +908 -0
  178. package/lib/locale/zh-CN.umd.min.js +1 -0
  179. package/lib/locale/zh-HK.umd.d.ts +908 -0
  180. package/lib/locale/zh-HK.umd.min.js +1 -0
  181. package/lib/locale/zh-MO.umd.d.ts +908 -0
  182. package/lib/locale/zh-MO.umd.min.js +1 -0
  183. package/lib/locale/zh-TC.umd.d.ts +908 -0
  184. package/lib/locale/zh-TC.umd.min.js +1 -0
  185. package/lib/locale/zh-TW.umd.d.ts +908 -0
  186. package/lib/locale/zh-TW.umd.min.js +1 -0
  187. package/lib/table/index.d.ts +2672 -0
  188. package/lib/table/module/custom/hook.d.ts +1 -0
  189. package/lib/table/module/custom/panel.d.ts +17 -0
  190. package/lib/table/module/custom/panel.js +1588 -1585
  191. package/lib/table/module/edit/hook.d.ts +1 -0
  192. package/lib/table/module/export/export-panel.d.ts +27 -0
  193. package/lib/table/module/export/export-panel.js +587 -584
  194. package/lib/table/module/export/hook.d.ts +1 -0
  195. package/lib/table/module/export/import-panel.d.ts +27 -0
  196. package/lib/table/module/export/import-panel.js +258 -255
  197. package/lib/table/module/export/util.d.ts +5 -0
  198. package/lib/table/module/filter/hook.d.ts +1 -0
  199. package/lib/table/module/filter/hook.js +1 -15
  200. package/lib/table/module/filter/panel.d.ts +16 -0
  201. package/lib/table/module/filter/panel.js +281 -278
  202. package/lib/table/module/keyboard/hook.d.ts +1 -0
  203. package/lib/table/module/menu/hook.d.ts +1 -0
  204. package/lib/table/module/menu/panel.d.ts +2 -0
  205. package/lib/table/module/menu/panel.js +225 -222
  206. package/lib/table/module/validator/hook.d.ts +1 -0
  207. package/lib/table/render/index.d.ts +1 -0
  208. package/lib/table/src/body.d.ts +24 -0
  209. package/lib/table/src/body.js +895 -892
  210. package/lib/table/src/cell.d.ts +192 -0
  211. package/lib/table/src/column.d.ts +263 -0
  212. package/lib/table/src/column.js +39 -36
  213. package/lib/table/src/columnInfo.d.ts +13 -0
  214. package/lib/table/src/emits.d.ts +2 -0
  215. package/lib/table/src/emits.js +2 -2
  216. package/lib/table/src/footer.d.ts +45 -0
  217. package/lib/table/src/footer.js +341 -338
  218. package/lib/table/src/group.d.ts +178 -0
  219. package/lib/table/src/group.js +49 -46
  220. package/lib/table/src/header.d.ts +26 -0
  221. package/lib/table/src/header.js +539 -536
  222. package/lib/table/src/props.d.ts +238 -0
  223. package/lib/table/src/props.js +2 -2
  224. package/lib/table/src/store.d.ts +6 -0
  225. package/lib/table/src/table.d.ts +539 -0
  226. package/lib/table/src/table.js +13742 -13722
  227. package/lib/table/src/use/cell-view.d.ts +10 -0
  228. package/lib/table/src/use/index.d.ts +1 -0
  229. package/lib/table/src/util.d.ts +74 -0
  230. package/lib/toolbar/index.d.ts +340 -0
  231. package/lib/toolbar/src/toolbar.d.ts +75 -0
  232. package/lib/toolbar/src/toolbar.js +595 -592
  233. package/lib/ui/index.d.ts +85 -0
  234. package/lib/ui/index.js +2 -1
  235. package/lib/ui/src/anime.d.ts +10 -0
  236. package/lib/ui/src/comp.d.ts +2 -0
  237. package/lib/ui/src/dom.d.ts +80 -0
  238. package/lib/ui/src/log.d.ts +6 -0
  239. package/lib/ui/src/log.js +1 -1
  240. package/lib/ui/src/utils.d.ts +23 -0
  241. package/lib/ui/src/vn.d.ts +7 -0
  242. package/lib/v-x-e-table/index.d.ts +2 -0
  243. package/lib/vxe-colgroup/index.d.ts +3 -0
  244. package/lib/vxe-column/index.d.ts +3 -0
  245. package/lib/vxe-grid/index.d.ts +3 -0
  246. package/lib/vxe-table/index.d.ts +3 -0
  247. package/lib/vxe-toolbar/index.d.ts +3 -0
  248. package/lib/vxe-ui/index.d.ts +3 -0
  249. package/package.json +9 -2
  250. package/packages/grid/src/emits.ts +2 -2
  251. package/packages/grid/src/grid.ts +10 -10
  252. package/packages/grid/src/props.ts +3 -3
  253. package/packages/index.ts +2 -2
  254. package/packages/table/module/custom/panel.ts +2 -2
  255. package/packages/table/module/export/export-panel.ts +2 -2
  256. package/packages/table/module/export/import-panel.ts +2 -2
  257. package/packages/table/module/filter/hook.ts +1 -15
  258. package/packages/table/module/filter/panel.ts +2 -2
  259. package/packages/table/module/menu/panel.ts +2 -2
  260. package/packages/table/src/body.ts +2 -2
  261. package/packages/table/src/column.ts +2 -2
  262. package/packages/table/src/emits.ts +1 -1
  263. package/packages/table/src/footer.ts +2 -2
  264. package/packages/table/src/group.ts +2 -2
  265. package/packages/table/src/header.ts +2 -2
  266. package/packages/table/src/props.ts +1 -1
  267. package/packages/table/src/table.ts +74 -57
  268. package/packages/toolbar/src/toolbar.ts +2 -2
  269. package/packages/ui/index.ts +1 -0
  270. /package/dist/{iconfont.1793016957545.ttf → iconfont.1793627868721.ttf} +0 -0
  271. /package/dist/{iconfont.1793016957545.woff → iconfont.1793627868721.woff} +0 -0
  272. /package/dist/{iconfont.1793016957545.woff2 → iconfont.1793627868721.woff2} +0 -0
  273. /package/es/{iconfont.1793016957545.ttf → iconfont.1793627868721.ttf} +0 -0
  274. /package/es/{iconfont.1793016957545.woff → iconfont.1793627868721.woff} +0 -0
  275. /package/es/{iconfont.1793016957545.woff2 → iconfont.1793627868721.woff2} +0 -0
  276. /package/lib/{iconfont.1793016957545.ttf → iconfont.1793627868721.ttf} +0 -0
  277. /package/lib/{iconfont.1793016957545.woff → iconfont.1793627868721.woff} +0 -0
  278. /package/lib/{iconfont.1793016957545.woff2 → iconfont.1793627868721.woff2} +0 -0
@@ -18,657 +18,660 @@ function createInternalData() {
18
18
  connectTable: null
19
19
  };
20
20
  }
21
- var toolbar_default = defineVxeComponent({
22
- name: "VxeToolbar",
23
- props: {
24
- loading: Boolean,
25
- refresh: [Boolean, Object],
26
- refreshOptions: Object,
27
- import: [Boolean, Object],
28
- importOptions: Object,
29
- export: [Boolean, Object],
30
- exportOptions: Object,
31
- print: [Boolean, Object],
32
- printOptions: Object,
33
- zoom: [Boolean, Object],
34
- zoomOptions: Object,
35
- custom: [Boolean, Object],
36
- customOptions: Object,
37
- buttons: {
38
- type: Array,
39
- default: () => getConfig().toolbar.buttons
21
+ var toolbar_default = (
22
+ /* define-vxe-component start */
23
+ defineVxeComponent({
24
+ name: "VxeToolbar",
25
+ props: {
26
+ loading: Boolean,
27
+ refresh: [Boolean, Object],
28
+ refreshOptions: Object,
29
+ import: [Boolean, Object],
30
+ importOptions: Object,
31
+ export: [Boolean, Object],
32
+ exportOptions: Object,
33
+ print: [Boolean, Object],
34
+ printOptions: Object,
35
+ zoom: [Boolean, Object],
36
+ zoomOptions: Object,
37
+ custom: [Boolean, Object],
38
+ customOptions: Object,
39
+ buttons: {
40
+ type: Array,
41
+ default: () => getConfig().toolbar.buttons
42
+ },
43
+ tools: {
44
+ type: Array,
45
+ default: () => getConfig().toolbar.tools
46
+ },
47
+ perfect: {
48
+ type: Boolean,
49
+ default: () => getConfig().toolbar.perfect
50
+ },
51
+ size: {
52
+ type: String,
53
+ default: () => getConfig().toolbar.size || getConfig().size
54
+ },
55
+ className: [String, Function]
40
56
  },
41
- tools: {
42
- type: Array,
43
- default: () => getConfig().toolbar.tools
44
- },
45
- perfect: {
46
- type: Boolean,
47
- default: () => getConfig().toolbar.perfect
48
- },
49
- size: {
50
- type: String,
51
- default: () => getConfig().toolbar.size || getConfig().size
52
- },
53
- className: [String, Function]
54
- },
55
- emits: ["button-click", "tool-click"],
56
- setup(props, context) {
57
- const { slots, emit } = context;
58
- const xID = XEUtils.uniqueId();
59
- const VxeUIButtonComponent = VxeUI.getComponent("VxeButton");
60
- const $xeGrid = inject("$xeGrid", null);
61
- const $xeGantt = inject("$xeGantt", null);
62
- const $xeGGWrapper = $xeGrid || $xeGantt;
63
- const { computeSize } = useFns.useSize(props);
64
- const reactData = reactive(createReactData());
65
- const internalData = createInternalData();
66
- const refElem = ref();
67
- const refMaps = {
68
- refElem
69
- };
70
- const $xeToolbar = {
71
- xID,
72
- props,
73
- context,
74
- reactData,
75
- internalData,
76
- getRefMaps: () => refMaps
77
- };
78
- let toolbarMethods = {};
79
- const computeRefreshOpts = computed(() => {
80
- return Object.assign({}, XEUtils.clone(getConfig().toolbar.refresh, true), props.refreshOptions, props.refresh);
81
- });
82
- const computeImportOpts = computed(() => {
83
- return Object.assign({}, XEUtils.clone(getConfig().toolbar.import, true), props.importOptions, props.import);
84
- });
85
- const computeExportOpts = computed(() => {
86
- return Object.assign({}, XEUtils.clone(getConfig().toolbar.export, true), props.exportOptions, props.export);
87
- });
88
- const computePrintOpts = computed(() => {
89
- return Object.assign({}, XEUtils.clone(getConfig().toolbar.print, true), props.printOptions, props.print);
90
- });
91
- const computeZoomOpts = computed(() => {
92
- return Object.assign({}, XEUtils.clone(getConfig().toolbar.zoom, true), props.zoomOptions, props.zoom);
93
- });
94
- const computeCustomOpts = computed(() => {
95
- return Object.assign({}, XEUtils.clone(getConfig().toolbar.custom, true), props.customOptions, props.custom);
96
- });
97
- const computeTableCustomOpts = computed(() => {
98
- const { connectTable } = internalData;
99
- const $table = connectTable;
100
- if (reactData.connectFlag || $table) {
101
- if ($table) {
102
- const { computeCustomOpts: computeCustomOpts2 } = $table.getComputeMaps();
103
- return computeCustomOpts2.value;
104
- }
105
- }
106
- return { trigger: "" };
107
- });
108
- const computeTrigger = computed(() => {
109
- const tableCustomOpts = computeTableCustomOpts.value;
110
- return tableCustomOpts.trigger;
111
- });
112
- const checkTable = () => {
113
- const { connectTable } = internalData;
114
- const $table = connectTable;
115
- if ($table) {
116
- return true;
117
- }
118
- errLog("vxe.error.barUnableLink");
119
- };
120
- const handleClickSettingEvent = ({ $event }) => {
121
- const { connectTable } = internalData;
122
- const $table = connectTable;
123
- if ($table) {
124
- if ($table.triggerCustomEvent) {
125
- $table.triggerCustomEvent($event);
126
- }
127
- }
128
- };
129
- const handleMouseenterSettingEvent = ({ $event }) => {
130
- const { connectTable } = internalData;
131
- const $table = connectTable;
132
- if ($table) {
133
- $table.customOpenEvent($event);
134
- }
135
- };
136
- const handleMouseleaveSettingEvent = ({ $event }) => {
137
- const { connectTable } = internalData;
138
- const $table = connectTable;
139
- if ($table) {
140
- const { customStore } = $table.reactData;
141
- customStore.activeBtn = false;
142
- setTimeout(() => {
143
- if (!customStore.activeBtn && !customStore.activeWrapper) {
144
- $table.customCloseEvent($event);
145
- }
146
- }, 350);
147
- }
148
- };
149
- const refreshEvent = ({ $event }) => {
150
- const { isRefresh } = reactData;
151
- const refreshOpts = computeRefreshOpts.value;
152
- if (!isRefresh) {
153
- const queryMethod = refreshOpts.queryMethod || refreshOpts.query;
154
- if (queryMethod) {
155
- reactData.isRefresh = true;
156
- try {
157
- Promise.resolve(queryMethod({})).catch((e) => e).then(() => {
158
- reactData.isRefresh = false;
159
- });
160
- } catch (e) {
161
- reactData.isRefresh = false;
57
+ emits: ["button-click", "tool-click"],
58
+ setup(props, context) {
59
+ const { slots, emit } = context;
60
+ const xID = XEUtils.uniqueId();
61
+ const VxeUIButtonComponent = VxeUI.getComponent("VxeButton");
62
+ const $xeGrid = inject("$xeGrid", null);
63
+ const $xeGantt = inject("$xeGantt", null);
64
+ const $xeGGWrapper = $xeGrid || $xeGantt;
65
+ const { computeSize } = useFns.useSize(props);
66
+ const reactData = reactive(createReactData());
67
+ const internalData = createInternalData();
68
+ const refElem = ref();
69
+ const refMaps = {
70
+ refElem
71
+ };
72
+ const $xeToolbar = {
73
+ xID,
74
+ props,
75
+ context,
76
+ reactData,
77
+ internalData,
78
+ getRefMaps: () => refMaps
79
+ };
80
+ let toolbarMethods = {};
81
+ const computeRefreshOpts = computed(() => {
82
+ return Object.assign({}, XEUtils.clone(getConfig().toolbar.refresh, true), props.refreshOptions, props.refresh);
83
+ });
84
+ const computeImportOpts = computed(() => {
85
+ return Object.assign({}, XEUtils.clone(getConfig().toolbar.import, true), props.importOptions, props.import);
86
+ });
87
+ const computeExportOpts = computed(() => {
88
+ return Object.assign({}, XEUtils.clone(getConfig().toolbar.export, true), props.exportOptions, props.export);
89
+ });
90
+ const computePrintOpts = computed(() => {
91
+ return Object.assign({}, XEUtils.clone(getConfig().toolbar.print, true), props.printOptions, props.print);
92
+ });
93
+ const computeZoomOpts = computed(() => {
94
+ return Object.assign({}, XEUtils.clone(getConfig().toolbar.zoom, true), props.zoomOptions, props.zoom);
95
+ });
96
+ const computeCustomOpts = computed(() => {
97
+ return Object.assign({}, XEUtils.clone(getConfig().toolbar.custom, true), props.customOptions, props.custom);
98
+ });
99
+ const computeTableCustomOpts = computed(() => {
100
+ const { connectTable } = internalData;
101
+ const $table = connectTable;
102
+ if (reactData.connectFlag || $table) {
103
+ if ($table) {
104
+ const { computeCustomOpts: computeCustomOpts2 } = $table.getComputeMaps();
105
+ return computeCustomOpts2.value;
162
106
  }
163
- } else if ($xeGGWrapper) {
164
- reactData.isRefresh = true;
165
- $xeGGWrapper.triggerToolbarCommitEvent({ code: refreshOpts.code || "reload" }, $event).catch(() => {
166
- }).then(() => {
167
- reactData.isRefresh = false;
168
- });
169
107
  }
170
- }
171
- };
172
- const zoomEvent = ({ $event }) => {
173
- if ($xeGGWrapper) {
174
- $xeGGWrapper.triggerZoomEvent($event);
175
- } else {
176
- warnLog("vxe.error.notProp", ["zoom"]);
177
- }
178
- };
179
- const importEvent = () => {
180
- if (checkTable()) {
108
+ return { trigger: "" };
109
+ });
110
+ const computeTrigger = computed(() => {
111
+ const tableCustomOpts = computeTableCustomOpts.value;
112
+ return tableCustomOpts.trigger;
113
+ });
114
+ const checkTable = () => {
181
115
  const { connectTable } = internalData;
182
116
  const $table = connectTable;
183
117
  if ($table) {
184
- $table.importData();
118
+ return true;
185
119
  }
186
- }
187
- };
188
- const openImportEvent = () => {
189
- if (checkTable()) {
120
+ errLog("vxe.error.barUnableLink");
121
+ };
122
+ const handleClickSettingEvent = ({ $event }) => {
190
123
  const { connectTable } = internalData;
191
124
  const $table = connectTable;
192
125
  if ($table) {
193
- $table.openImport();
126
+ if ($table.triggerCustomEvent) {
127
+ $table.triggerCustomEvent($event);
128
+ }
194
129
  }
195
- }
196
- };
197
- const exportEvent = () => {
198
- if (checkTable()) {
130
+ };
131
+ const handleMouseenterSettingEvent = ({ $event }) => {
199
132
  const { connectTable } = internalData;
200
133
  const $table = connectTable;
201
134
  if ($table) {
202
- $table.exportData();
135
+ $table.customOpenEvent($event);
203
136
  }
204
- }
205
- };
206
- const openExportEvent = () => {
207
- if (checkTable()) {
137
+ };
138
+ const handleMouseleaveSettingEvent = ({ $event }) => {
208
139
  const { connectTable } = internalData;
209
140
  const $table = connectTable;
210
141
  if ($table) {
211
- $table.openExport();
142
+ const { customStore } = $table.reactData;
143
+ customStore.activeBtn = false;
144
+ setTimeout(() => {
145
+ if (!customStore.activeBtn && !customStore.activeWrapper) {
146
+ $table.customCloseEvent($event);
147
+ }
148
+ }, 350);
149
+ }
150
+ };
151
+ const refreshEvent = ({ $event }) => {
152
+ const { isRefresh } = reactData;
153
+ const refreshOpts = computeRefreshOpts.value;
154
+ if (!isRefresh) {
155
+ const queryMethod = refreshOpts.queryMethod || refreshOpts.query;
156
+ if (queryMethod) {
157
+ reactData.isRefresh = true;
158
+ try {
159
+ Promise.resolve(queryMethod({})).catch((e) => e).then(() => {
160
+ reactData.isRefresh = false;
161
+ });
162
+ } catch (e) {
163
+ reactData.isRefresh = false;
164
+ }
165
+ } else if ($xeGGWrapper) {
166
+ reactData.isRefresh = true;
167
+ $xeGGWrapper.triggerToolbarCommitEvent({ code: refreshOpts.code || "reload" }, $event).catch(() => {
168
+ }).then(() => {
169
+ reactData.isRefresh = false;
170
+ });
171
+ }
172
+ }
173
+ };
174
+ const zoomEvent = ({ $event }) => {
175
+ if ($xeGGWrapper) {
176
+ $xeGGWrapper.triggerZoomEvent($event);
177
+ } else {
178
+ warnLog("vxe.error.notProp", ["zoom"]);
179
+ }
180
+ };
181
+ const importEvent = () => {
182
+ if (checkTable()) {
183
+ const { connectTable } = internalData;
184
+ const $table = connectTable;
185
+ if ($table) {
186
+ $table.importData();
187
+ }
188
+ }
189
+ };
190
+ const openImportEvent = () => {
191
+ if (checkTable()) {
192
+ const { connectTable } = internalData;
193
+ const $table = connectTable;
194
+ if ($table) {
195
+ $table.openImport();
196
+ }
197
+ }
198
+ };
199
+ const exportEvent = () => {
200
+ if (checkTable()) {
201
+ const { connectTable } = internalData;
202
+ const $table = connectTable;
203
+ if ($table) {
204
+ $table.exportData();
205
+ }
206
+ }
207
+ };
208
+ const openExportEvent = () => {
209
+ if (checkTable()) {
210
+ const { connectTable } = internalData;
211
+ const $table = connectTable;
212
+ if ($table) {
213
+ $table.openExport();
214
+ }
215
+ }
216
+ };
217
+ const printEvent = () => {
218
+ if (checkTable()) {
219
+ const { connectTable } = internalData;
220
+ const $table = connectTable;
221
+ if ($table) {
222
+ $table.print();
223
+ }
224
+ }
225
+ };
226
+ const openPrintEvent = () => {
227
+ if (checkTable()) {
228
+ const { connectTable } = internalData;
229
+ const $table = connectTable;
230
+ if ($table) {
231
+ $table.openPrint();
232
+ }
233
+ }
234
+ };
235
+ const handleDefaultCodeEvent = (eventParams, item, cb) => {
236
+ switch (item.code) {
237
+ case "print":
238
+ printEvent();
239
+ break;
240
+ case "open_print":
241
+ openPrintEvent();
242
+ break;
243
+ case "custom":
244
+ handleClickSettingEvent(eventParams);
245
+ break;
246
+ case "export":
247
+ exportEvent();
248
+ break;
249
+ case "open_export":
250
+ openExportEvent();
251
+ break;
252
+ case "import":
253
+ importEvent();
254
+ break;
255
+ case "open_import":
256
+ openImportEvent();
257
+ break;
258
+ case "zoom":
259
+ zoomEvent(eventParams);
260
+ break;
261
+ case "refresh":
262
+ refreshEvent(eventParams);
263
+ break;
264
+ default:
265
+ cb();
266
+ break;
212
267
  }
213
- }
214
- };
215
- const printEvent = () => {
216
- if (checkTable()) {
268
+ };
269
+ const btnEvent = (eventParams, item) => {
270
+ const { $event } = eventParams;
217
271
  const { connectTable } = internalData;
218
272
  const $table = connectTable;
219
- if ($table) {
220
- $table.print();
273
+ const { code } = item;
274
+ if (code) {
275
+ handleDefaultCodeEvent(eventParams, item, () => {
276
+ if ($xeGGWrapper) {
277
+ $xeGGWrapper.triggerToolbarBtnEvent(item, $event);
278
+ } else {
279
+ const gCommandOpts = commands.get(code);
280
+ const params = { code, button: item, $table, $grid: $xeGrid, $gantt: $xeGantt, $event };
281
+ if (gCommandOpts) {
282
+ const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod;
283
+ if (tCommandMethod) {
284
+ tCommandMethod(params);
285
+ } else {
286
+ errLog("vxe.error.notCommands", [code]);
287
+ }
288
+ }
289
+ $xeToolbar.dispatchEvent("button-click", params, $event);
290
+ }
291
+ });
221
292
  }
222
- }
223
- };
224
- const openPrintEvent = () => {
225
- if (checkTable()) {
293
+ };
294
+ const tolEvent = (eventParams, item) => {
295
+ const { $event } = eventParams;
226
296
  const { connectTable } = internalData;
227
297
  const $table = connectTable;
228
- if ($table) {
229
- $table.openPrint();
230
- }
231
- }
232
- };
233
- const handleDefaultCodeEvent = (eventParams, item, cb) => {
234
- switch (item.code) {
235
- case "print":
236
- printEvent();
237
- break;
238
- case "open_print":
239
- openPrintEvent();
240
- break;
241
- case "custom":
242
- handleClickSettingEvent(eventParams);
243
- break;
244
- case "export":
245
- exportEvent();
246
- break;
247
- case "open_export":
248
- openExportEvent();
249
- break;
250
- case "import":
251
- importEvent();
252
- break;
253
- case "open_import":
254
- openImportEvent();
255
- break;
256
- case "zoom":
257
- zoomEvent(eventParams);
258
- break;
259
- case "refresh":
260
- refreshEvent(eventParams);
261
- break;
262
- default:
263
- cb();
264
- break;
265
- }
266
- };
267
- const btnEvent = (eventParams, item) => {
268
- const { $event } = eventParams;
269
- const { connectTable } = internalData;
270
- const $table = connectTable;
271
- const { code } = item;
272
- if (code) {
273
- handleDefaultCodeEvent(eventParams, item, () => {
274
- if ($xeGGWrapper) {
275
- $xeGGWrapper.triggerToolbarBtnEvent(item, $event);
276
- } else {
277
- const gCommandOpts = commands.get(code);
278
- const params = { code, button: item, $table, $grid: $xeGrid, $gantt: $xeGantt, $event };
279
- if (gCommandOpts) {
280
- const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod;
281
- if (tCommandMethod) {
282
- tCommandMethod(params);
283
- } else {
284
- errLog("vxe.error.notCommands", [code]);
298
+ const { code } = item;
299
+ if (code) {
300
+ handleDefaultCodeEvent(eventParams, item, () => {
301
+ if ($xeGGWrapper) {
302
+ $xeGGWrapper.triggerToolbarTolEvent(item, $event);
303
+ } else {
304
+ const gCommandOpts = commands.get(code);
305
+ const params = { code, button: null, tool: item, $table, $grid: $xeGrid, $gantt: $xeGantt, $event };
306
+ if (gCommandOpts) {
307
+ const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod;
308
+ if (tCommandMethod) {
309
+ tCommandMethod(params);
310
+ } else {
311
+ errLog("vxe.error.notCommands", [code]);
312
+ }
285
313
  }
314
+ $xeToolbar.dispatchEvent("tool-click", params, $event);
286
315
  }
287
- $xeToolbar.dispatchEvent("button-click", params, $event);
288
- }
289
- });
290
- }
291
- };
292
- const tolEvent = (eventParams, item) => {
293
- const { $event } = eventParams;
294
- const { connectTable } = internalData;
295
- const $table = connectTable;
296
- const { code } = item;
297
- if (code) {
298
- handleDefaultCodeEvent(eventParams, item, () => {
299
- if ($xeGGWrapper) {
300
- $xeGGWrapper.triggerToolbarTolEvent(item, $event);
301
- } else {
302
- const gCommandOpts = commands.get(code);
303
- const params = { code, button: null, tool: item, $table, $grid: $xeGrid, $gantt: $xeGantt, $event };
304
- if (gCommandOpts) {
305
- const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod;
306
- if (tCommandMethod) {
307
- tCommandMethod(params);
308
- } else {
309
- errLog("vxe.error.notCommands", [code]);
310
- }
316
+ });
317
+ }
318
+ };
319
+ const dispatchEvent = (type, params, evnt) => {
320
+ emit(type, createEvent(evnt, { $toolbar: $xeToolbar }, params));
321
+ };
322
+ toolbarMethods = {
323
+ dispatchEvent,
324
+ syncUpdate(params) {
325
+ internalData.connectTable = params.$table;
326
+ reactData.columns = params.collectColumn;
327
+ reactData.connectFlag++;
328
+ }
329
+ };
330
+ Object.assign($xeToolbar, toolbarMethods);
331
+ const renderDropdowns = (item, isBtn) => {
332
+ const { dropdowns } = item;
333
+ const downVNs = [];
334
+ if (dropdowns) {
335
+ return dropdowns.map((child, index) => {
336
+ if (child.visible === false) {
337
+ return createCommentVNode();
311
338
  }
312
- $xeToolbar.dispatchEvent("tool-click", params, $event);
313
- }
314
- });
315
- }
316
- };
317
- const dispatchEvent = (type, params, evnt) => {
318
- emit(type, createEvent(evnt, { $toolbar: $xeToolbar }, params));
319
- };
320
- toolbarMethods = {
321
- dispatchEvent,
322
- syncUpdate(params) {
323
- internalData.connectTable = params.$table;
324
- reactData.columns = params.collectColumn;
325
- reactData.connectFlag++;
326
- }
327
- };
328
- Object.assign($xeToolbar, toolbarMethods);
329
- const renderDropdowns = (item, isBtn) => {
330
- const { dropdowns } = item;
331
- const downVNs = [];
332
- if (dropdowns) {
333
- return dropdowns.map((child, index) => {
334
- if (child.visible === false) {
335
- return createCommentVNode();
336
- }
337
- return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
338
- key: index,
339
- ...Object.assign({}, child, {
340
- content: child.content || child.name,
341
- options: void 0
342
- }),
343
- onClick: (eventParams) => isBtn ? btnEvent(eventParams, child) : tolEvent(eventParams, child)
344
- }) : createCommentVNode();
345
- });
346
- }
347
- return downVNs;
348
- };
349
- const renderLeftBtns = () => {
350
- const { buttons } = props;
351
- const { connectTable } = internalData;
352
- const $table = connectTable;
353
- const buttonsSlot = slots.buttons;
354
- const buttonPrefixSlot = slots.buttonPrefix || slots["button-prefix"];
355
- const buttonSuffixSlot = slots.buttonSuffix || slots["button-suffix"];
356
- const btnVNs = [];
357
- if (buttons) {
358
- const { computeRendererOpts } = $table ? $table.getComputeMaps() : {};
359
- const rendererOpts = (computeRendererOpts ? computeRendererOpts.value : null) || {};
360
- buttons.forEach((item, index) => {
361
- const { dropdowns, buttonRender } = item;
362
- if (item.visible !== false) {
363
- const compConf = buttonRender && buttonRender.name ? rendererOpts[buttonRender.name] || renderer.get(buttonRender.name) : null;
364
- if (buttonRender && compConf && compConf.renderToolbarButton) {
365
- const toolbarButtonClassName = compConf.toolbarButtonClassName;
366
- const params = { $grid: $xeGrid, $gantt: $xeGantt, $table, button: item };
367
- btnVNs.push(
368
- h(
369
- "span",
370
- {
371
- key: `br${item.code || index}`,
372
- class: ["vxe-button--item", toolbarButtonClassName ? XEUtils.isFunction(toolbarButtonClassName) ? toolbarButtonClassName(params) : toolbarButtonClassName : ""]
373
- },
374
- getSlotVNs(compConf.renderToolbarButton(buttonRender, params))
375
- )
376
- );
377
- } else {
378
- if (VxeUIButtonComponent) {
339
+ return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
340
+ key: index,
341
+ ...Object.assign({}, child, {
342
+ content: child.content || child.name,
343
+ options: void 0
344
+ }),
345
+ onClick: (eventParams) => isBtn ? btnEvent(eventParams, child) : tolEvent(eventParams, child)
346
+ }) : createCommentVNode();
347
+ });
348
+ }
349
+ return downVNs;
350
+ };
351
+ const renderLeftBtns = () => {
352
+ const { buttons } = props;
353
+ const { connectTable } = internalData;
354
+ const $table = connectTable;
355
+ const buttonsSlot = slots.buttons;
356
+ const buttonPrefixSlot = slots.buttonPrefix || slots["button-prefix"];
357
+ const buttonSuffixSlot = slots.buttonSuffix || slots["button-suffix"];
358
+ const btnVNs = [];
359
+ if (buttons) {
360
+ const { computeRendererOpts } = $table ? $table.getComputeMaps() : {};
361
+ const rendererOpts = (computeRendererOpts ? computeRendererOpts.value : null) || {};
362
+ buttons.forEach((item, index) => {
363
+ const { dropdowns, buttonRender } = item;
364
+ if (item.visible !== false) {
365
+ const compConf = buttonRender && buttonRender.name ? rendererOpts[buttonRender.name] || renderer.get(buttonRender.name) : null;
366
+ if (buttonRender && compConf && compConf.renderToolbarButton) {
367
+ const toolbarButtonClassName = compConf.toolbarButtonClassName;
368
+ const params = { $grid: $xeGrid, $gantt: $xeGantt, $table, button: item };
379
369
  btnVNs.push(
380
370
  h(
381
- VxeUIButtonComponent,
371
+ "span",
382
372
  {
383
- key: `bd${item.code || index}`,
384
- ...Object.assign({}, item, {
385
- content: item.content || item.name,
386
- options: void 0
387
- }),
388
- onClick: (eventParams) => btnEvent(eventParams, item)
373
+ key: `br${item.code || index}`,
374
+ class: ["vxe-button--item", toolbarButtonClassName ? XEUtils.isFunction(toolbarButtonClassName) ? toolbarButtonClassName(params) : toolbarButtonClassName : ""]
389
375
  },
390
- dropdowns && dropdowns.length ? {
391
- dropdowns: () => renderDropdowns(item, true)
392
- } : {}
376
+ getSlotVNs(compConf.renderToolbarButton(buttonRender, params))
393
377
  )
394
378
  );
379
+ } else {
380
+ if (VxeUIButtonComponent) {
381
+ btnVNs.push(
382
+ h(
383
+ VxeUIButtonComponent,
384
+ {
385
+ key: `bd${item.code || index}`,
386
+ ...Object.assign({}, item, {
387
+ content: item.content || item.name,
388
+ options: void 0
389
+ }),
390
+ onClick: (eventParams) => btnEvent(eventParams, item)
391
+ },
392
+ dropdowns && dropdowns.length ? {
393
+ dropdowns: () => renderDropdowns(item, true)
394
+ } : {}
395
+ )
396
+ );
397
+ }
395
398
  }
396
399
  }
397
- }
398
- });
399
- }
400
- return [
401
- h(
402
- "div",
403
- {
404
- class: "vxe-button--prefix-wrapper"
405
- },
406
- buttonPrefixSlot ? getSlotVNs(buttonPrefixSlot({ buttons: buttons || [], $grid: $xeGrid, $gantt: $xeGantt, $table })) : []
407
- ),
408
- h(
409
- "div",
410
- {
411
- class: "vxe-button--item-wrapper"
412
- },
413
- buttonsSlot ? getSlotVNs(buttonsSlot({ buttons: buttons || [], $grid: $xeGrid, $gantt: $xeGantt, $table })) : btnVNs
414
- ),
415
- h(
416
- "div",
417
- {
418
- class: "vxe-button--suffix-wrapper"
419
- },
420
- buttonSuffixSlot ? getSlotVNs(buttonSuffixSlot({ buttons: buttons || [], $grid: $xeGrid, $gantt: $xeGantt, $table })) : []
421
- )
422
- ];
423
- };
424
- const renderRightTools = () => {
425
- const { tools } = props;
426
- const { connectTable } = internalData;
427
- const $table = connectTable;
428
- const toolsSlot = slots.tools;
429
- const toolPrefixSlot = slots.toolPrefix || slots["tool-prefix"];
430
- const toolSuffixSlot = slots.toolSuffix || slots["tool-suffix"];
431
- const btnVNs = [];
432
- if (tools) {
433
- const { computeRendererOpts } = $table ? $table.getComputeMaps() : {};
434
- const rendererOpts = (computeRendererOpts ? computeRendererOpts.value : null) || {};
435
- tools.forEach((item, tIndex) => {
436
- const { dropdowns, toolRender } = item;
437
- if (item.visible !== false) {
438
- const compConf = toolRender && toolRender.name ? rendererOpts[toolRender.name] || renderer.get(toolRender.name) : null;
439
- if (toolRender && compConf && compConf.renderToolbarTool) {
440
- const toolbarToolClassName = compConf.toolbarToolClassName;
441
- const params = { $grid: $xeGrid, $gantt: $xeGantt, $table, tool: item };
442
- btnVNs.push(
443
- h(
444
- "span",
445
- {
446
- key: tIndex,
447
- class: ["vxe-tool--item", toolbarToolClassName ? XEUtils.isFunction(toolbarToolClassName) ? toolbarToolClassName(params) : toolbarToolClassName : ""]
448
- },
449
- getSlotVNs(compConf.renderToolbarTool(toolRender, params))
450
- )
451
- );
452
- } else {
453
- if (VxeUIButtonComponent) {
400
+ });
401
+ }
402
+ return [
403
+ h(
404
+ "div",
405
+ {
406
+ class: "vxe-button--prefix-wrapper"
407
+ },
408
+ buttonPrefixSlot ? getSlotVNs(buttonPrefixSlot({ buttons: buttons || [], $grid: $xeGrid, $gantt: $xeGantt, $table })) : []
409
+ ),
410
+ h(
411
+ "div",
412
+ {
413
+ class: "vxe-button--item-wrapper"
414
+ },
415
+ buttonsSlot ? getSlotVNs(buttonsSlot({ buttons: buttons || [], $grid: $xeGrid, $gantt: $xeGantt, $table })) : btnVNs
416
+ ),
417
+ h(
418
+ "div",
419
+ {
420
+ class: "vxe-button--suffix-wrapper"
421
+ },
422
+ buttonSuffixSlot ? getSlotVNs(buttonSuffixSlot({ buttons: buttons || [], $grid: $xeGrid, $gantt: $xeGantt, $table })) : []
423
+ )
424
+ ];
425
+ };
426
+ const renderRightTools = () => {
427
+ const { tools } = props;
428
+ const { connectTable } = internalData;
429
+ const $table = connectTable;
430
+ const toolsSlot = slots.tools;
431
+ const toolPrefixSlot = slots.toolPrefix || slots["tool-prefix"];
432
+ const toolSuffixSlot = slots.toolSuffix || slots["tool-suffix"];
433
+ const btnVNs = [];
434
+ if (tools) {
435
+ const { computeRendererOpts } = $table ? $table.getComputeMaps() : {};
436
+ const rendererOpts = (computeRendererOpts ? computeRendererOpts.value : null) || {};
437
+ tools.forEach((item, tIndex) => {
438
+ const { dropdowns, toolRender } = item;
439
+ if (item.visible !== false) {
440
+ const compConf = toolRender && toolRender.name ? rendererOpts[toolRender.name] || renderer.get(toolRender.name) : null;
441
+ if (toolRender && compConf && compConf.renderToolbarTool) {
442
+ const toolbarToolClassName = compConf.toolbarToolClassName;
443
+ const params = { $grid: $xeGrid, $gantt: $xeGantt, $table, tool: item };
454
444
  btnVNs.push(
455
445
  h(
456
- VxeUIButtonComponent,
446
+ "span",
457
447
  {
458
448
  key: tIndex,
459
- ...Object.assign({}, item, {
460
- content: item.content || item.name,
461
- options: void 0
462
- }),
463
- onClick: (eventParams) => tolEvent(eventParams, item)
449
+ class: ["vxe-tool--item", toolbarToolClassName ? XEUtils.isFunction(toolbarToolClassName) ? toolbarToolClassName(params) : toolbarToolClassName : ""]
464
450
  },
465
- dropdowns && dropdowns.length ? {
466
- dropdowns: () => renderDropdowns(item, false)
467
- } : {}
451
+ getSlotVNs(compConf.renderToolbarTool(toolRender, params))
468
452
  )
469
453
  );
454
+ } else {
455
+ if (VxeUIButtonComponent) {
456
+ btnVNs.push(
457
+ h(
458
+ VxeUIButtonComponent,
459
+ {
460
+ key: tIndex,
461
+ ...Object.assign({}, item, {
462
+ content: item.content || item.name,
463
+ options: void 0
464
+ }),
465
+ onClick: (eventParams) => tolEvent(eventParams, item)
466
+ },
467
+ dropdowns && dropdowns.length ? {
468
+ dropdowns: () => renderDropdowns(item, false)
469
+ } : {}
470
+ )
471
+ );
472
+ }
470
473
  }
471
474
  }
472
- }
473
- });
474
- }
475
- return [
476
- h(
477
- "div",
478
- {
479
- class: "vxe-tool--prefix-wrapper"
480
- },
481
- toolPrefixSlot ? getSlotVNs(toolPrefixSlot({ tools: tools || [], $grid: $xeGrid, $gantt: $xeGantt, $table })) : []
482
- ),
483
- h(
484
- "div",
485
- {
486
- class: "vxe-tool--item-wrapper"
487
- },
488
- toolsSlot ? getSlotVNs(toolsSlot({ tools: tools || [], $grid: $xeGrid, $gantt: $xeGantt, $table })) : btnVNs
489
- ),
490
- h(
491
- "div",
492
- {
493
- class: "vxe-tool--suffix-wrapper"
494
- },
495
- toolSuffixSlot ? getSlotVNs(toolSuffixSlot({ tools: tools || [], $grid: $xeGrid, $gantt: $xeGantt, $table })) : []
496
- )
497
- ];
498
- };
499
- const renderToolImport = () => {
500
- const importOpts = computeImportOpts.value;
501
- return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
502
- key: "import",
503
- circle: true,
504
- icon: importOpts.icon || getIcon().TOOLBAR_TOOLS_IMPORT,
505
- title: getI18n("vxe.toolbar.import"),
506
- onClick: openImportEvent
507
- }) : createCommentVNode();
508
- };
509
- const renderToolExport = () => {
510
- const exportOpts = computeExportOpts.value;
511
- return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
512
- key: "export",
513
- circle: true,
514
- icon: exportOpts.icon || getIcon().TOOLBAR_TOOLS_EXPORT,
515
- title: getI18n("vxe.toolbar.export"),
516
- onClick: openExportEvent
517
- }) : createCommentVNode();
518
- };
519
- const renderToolPrint = () => {
520
- const printOpts = computePrintOpts.value;
521
- return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
522
- key: "print",
523
- circle: true,
524
- icon: printOpts.icon || getIcon().TOOLBAR_TOOLS_PRINT,
525
- title: getI18n("vxe.toolbar.print"),
526
- onClick: openPrintEvent
527
- }) : createCommentVNode();
528
- };
529
- const renderToolRefresh = () => {
530
- const refreshOpts = computeRefreshOpts.value;
531
- return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
532
- key: "refresh",
533
- circle: true,
534
- icon: reactData.isRefresh ? refreshOpts.iconLoading || getIcon().TOOLBAR_TOOLS_REFRESH_LOADING : refreshOpts.icon || getIcon().TOOLBAR_TOOLS_REFRESH,
535
- title: getI18n("vxe.toolbar.refresh"),
536
- onClick: refreshEvent
537
- }) : createCommentVNode();
538
- };
539
- const renderToolZoom = () => {
540
- const zoomOpts = computeZoomOpts.value;
541
- return $xeGGWrapper && VxeUIButtonComponent ? h(VxeUIButtonComponent, {
542
- key: "zoom",
543
- circle: true,
544
- icon: $xeGGWrapper.isMaximized() ? zoomOpts.iconOut || getIcon().TOOLBAR_TOOLS_MINIMIZE : zoomOpts.iconIn || getIcon().TOOLBAR_TOOLS_FULLSCREEN,
545
- title: getI18n(`vxe.toolbar.zoom${$xeGGWrapper.isMaximized() ? "Out" : "In"}`),
546
- onClick: zoomEvent
547
- }) : createCommentVNode();
548
- };
549
- const renderToolCustom = () => {
550
- const customOpts = computeCustomOpts.value;
551
- const btnTrigger = computeTrigger.value;
552
- const customBtnOns = {};
553
- if (btnTrigger === "manual") {
554
- } else if (btnTrigger === "hover") {
555
- customBtnOns.onMouseenter = handleMouseenterSettingEvent;
556
- customBtnOns.onMouseleave = handleMouseleaveSettingEvent;
557
- } else {
558
- customBtnOns.onClick = handleClickSettingEvent;
559
- }
560
- return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
561
- key: "custom",
562
- circle: true,
563
- icon: customOpts.icon || getIcon().TOOLBAR_TOOLS_CUSTOM,
564
- title: getI18n("vxe.toolbar.custom"),
565
- className: "vxe-toolbar-custom-target",
566
- ...customBtnOns
567
- }) : createCommentVNode();
568
- };
569
- const renderVN = () => {
570
- const { perfect, loading, refresh, zoom, custom, className } = props;
571
- const vSize = computeSize.value;
572
- return h(
573
- "div",
574
- {
575
- ref: refElem,
576
- class: [
577
- "vxe-toolbar",
578
- className ? XEUtils.isFunction(className) ? className({ $toolbar: $xeToolbar }) : className : "",
579
- {
580
- [`size--${vSize}`]: vSize,
581
- "is--perfect": perfect,
582
- "is--loading": loading
583
- }
584
- ]
585
- },
586
- [
475
+ });
476
+ }
477
+ return [
587
478
  h(
588
479
  "div",
589
480
  {
590
- class: "vxe-buttons--wrapper"
481
+ class: "vxe-tool--prefix-wrapper"
591
482
  },
592
- renderLeftBtns()
483
+ toolPrefixSlot ? getSlotVNs(toolPrefixSlot({ tools: tools || [], $grid: $xeGrid, $gantt: $xeGantt, $table })) : []
593
484
  ),
594
485
  h(
595
486
  "div",
596
487
  {
597
- class: "vxe-tools--wrapper"
488
+ class: "vxe-tool--item-wrapper"
598
489
  },
599
- renderRightTools()
490
+ toolsSlot ? getSlotVNs(toolsSlot({ tools: tools || [], $grid: $xeGrid, $gantt: $xeGantt, $table })) : btnVNs
600
491
  ),
601
492
  h(
602
493
  "div",
603
494
  {
604
- class: "vxe-tools--operate"
495
+ class: "vxe-tool--suffix-wrapper"
605
496
  },
606
- [
607
- props.import ? renderToolImport() : createCommentVNode(),
608
- props.export ? renderToolExport() : createCommentVNode(),
609
- props.print ? renderToolPrint() : createCommentVNode(),
610
- refresh ? renderToolRefresh() : createCommentVNode(),
611
- zoom && $xeGGWrapper ? renderToolZoom() : createCommentVNode(),
612
- custom ? renderToolCustom() : createCommentVNode()
613
- ]
497
+ toolSuffixSlot ? getSlotVNs(toolSuffixSlot({ tools: tools || [], $grid: $xeGrid, $gantt: $xeGantt, $table })) : []
614
498
  )
615
- ]
616
- );
617
- };
618
- $xeToolbar.renderVN = renderVN;
619
- nextTick(() => {
620
- const refreshOpts = computeRefreshOpts.value;
621
- const queryMethod = refreshOpts.queryMethod || refreshOpts.query;
622
- if (props.refresh && !$xeGGWrapper && !queryMethod) {
623
- warnLog("vxe.error.notFunc", ["queryMethod"]);
624
- }
625
- if (XEUtils.isPlainObject(props.custom)) {
626
- warnLog("vxe.error.delProp", ["custom={...}", "custom=boolean & custom-options={...}"]);
627
- }
628
- if (XEUtils.isPlainObject(props.print)) {
629
- warnLog("vxe.error.delProp", ["print={...}", "print=boolean & print-options={...}"]);
630
- }
631
- if (XEUtils.isPlainObject(props.export)) {
632
- warnLog("vxe.error.delProp", ["export={...}", "export=boolean & export-options={...}"]);
633
- }
634
- if (XEUtils.isPlainObject(props.import)) {
635
- warnLog("vxe.error.delProp", ["import={...}", "import=boolean & import-options={...}"]);
636
- }
637
- if (XEUtils.isPlainObject(props.refresh)) {
638
- warnLog("vxe.error.delProp", ["refresh={...}", "refresh=boolean & refresh-options={...}"]);
639
- }
640
- if (XEUtils.isPlainObject(props.refresh)) {
641
- warnLog("vxe.error.delProp", ["zoom={...}", "zoom=boolean & zoom-options={...}"]);
642
- }
643
- const customOpts = computeCustomOpts.value;
644
- if (customOpts.isFooter) {
645
- warnLog("vxe.error.delProp", ["toolbar.custom.isFooter", "table.custom-config.showFooter"]);
646
- }
647
- if (customOpts.showFooter) {
648
- warnLog("vxe.error.delProp", ["toolbar.custom.showFooter", "table.custom-config.showFooter"]);
649
- }
650
- if (customOpts.immediate) {
651
- warnLog("vxe.error.delProp", ["toolbar.custom.immediate", "table.custom-config.immediate"]);
652
- }
653
- if (customOpts.trigger) {
654
- warnLog("vxe.error.delProp", ["toolbar.custom.trigger", "table.custom-config.trigger"]);
655
- }
656
- if (props.refresh || props.import || props.export || props.print || props.zoom) {
657
- if (!VxeUIButtonComponent) {
658
- errLog("vxe.error.reqComp", ["vxe-button"]);
659
- }
660
- }
661
- });
662
- onBeforeUnmount(() => {
663
- XEUtils.assign(reactData, createReactData());
664
- XEUtils.assign(internalData, createInternalData());
665
- });
666
- return $xeToolbar;
667
- },
668
- render() {
669
- return this.renderVN();
670
- }
671
- });
499
+ ];
500
+ };
501
+ const renderToolImport = () => {
502
+ const importOpts = computeImportOpts.value;
503
+ return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
504
+ key: "import",
505
+ circle: true,
506
+ icon: importOpts.icon || getIcon().TOOLBAR_TOOLS_IMPORT,
507
+ title: getI18n("vxe.toolbar.import"),
508
+ onClick: openImportEvent
509
+ }) : createCommentVNode();
510
+ };
511
+ const renderToolExport = () => {
512
+ const exportOpts = computeExportOpts.value;
513
+ return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
514
+ key: "export",
515
+ circle: true,
516
+ icon: exportOpts.icon || getIcon().TOOLBAR_TOOLS_EXPORT,
517
+ title: getI18n("vxe.toolbar.export"),
518
+ onClick: openExportEvent
519
+ }) : createCommentVNode();
520
+ };
521
+ const renderToolPrint = () => {
522
+ const printOpts = computePrintOpts.value;
523
+ return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
524
+ key: "print",
525
+ circle: true,
526
+ icon: printOpts.icon || getIcon().TOOLBAR_TOOLS_PRINT,
527
+ title: getI18n("vxe.toolbar.print"),
528
+ onClick: openPrintEvent
529
+ }) : createCommentVNode();
530
+ };
531
+ const renderToolRefresh = () => {
532
+ const refreshOpts = computeRefreshOpts.value;
533
+ return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
534
+ key: "refresh",
535
+ circle: true,
536
+ icon: reactData.isRefresh ? refreshOpts.iconLoading || getIcon().TOOLBAR_TOOLS_REFRESH_LOADING : refreshOpts.icon || getIcon().TOOLBAR_TOOLS_REFRESH,
537
+ title: getI18n("vxe.toolbar.refresh"),
538
+ onClick: refreshEvent
539
+ }) : createCommentVNode();
540
+ };
541
+ const renderToolZoom = () => {
542
+ const zoomOpts = computeZoomOpts.value;
543
+ return $xeGGWrapper && VxeUIButtonComponent ? h(VxeUIButtonComponent, {
544
+ key: "zoom",
545
+ circle: true,
546
+ icon: $xeGGWrapper.isMaximized() ? zoomOpts.iconOut || getIcon().TOOLBAR_TOOLS_MINIMIZE : zoomOpts.iconIn || getIcon().TOOLBAR_TOOLS_FULLSCREEN,
547
+ title: getI18n(`vxe.toolbar.zoom${$xeGGWrapper.isMaximized() ? "Out" : "In"}`),
548
+ onClick: zoomEvent
549
+ }) : createCommentVNode();
550
+ };
551
+ const renderToolCustom = () => {
552
+ const customOpts = computeCustomOpts.value;
553
+ const btnTrigger = computeTrigger.value;
554
+ const customBtnOns = {};
555
+ if (btnTrigger === "manual") {
556
+ } else if (btnTrigger === "hover") {
557
+ customBtnOns.onMouseenter = handleMouseenterSettingEvent;
558
+ customBtnOns.onMouseleave = handleMouseleaveSettingEvent;
559
+ } else {
560
+ customBtnOns.onClick = handleClickSettingEvent;
561
+ }
562
+ return VxeUIButtonComponent ? h(VxeUIButtonComponent, {
563
+ key: "custom",
564
+ circle: true,
565
+ icon: customOpts.icon || getIcon().TOOLBAR_TOOLS_CUSTOM,
566
+ title: getI18n("vxe.toolbar.custom"),
567
+ className: "vxe-toolbar-custom-target",
568
+ ...customBtnOns
569
+ }) : createCommentVNode();
570
+ };
571
+ const renderVN = () => {
572
+ const { perfect, loading, refresh, zoom, custom, className } = props;
573
+ const vSize = computeSize.value;
574
+ return h(
575
+ "div",
576
+ {
577
+ ref: refElem,
578
+ class: [
579
+ "vxe-toolbar",
580
+ className ? XEUtils.isFunction(className) ? className({ $toolbar: $xeToolbar }) : className : "",
581
+ {
582
+ [`size--${vSize}`]: vSize,
583
+ "is--perfect": perfect,
584
+ "is--loading": loading
585
+ }
586
+ ]
587
+ },
588
+ [
589
+ h(
590
+ "div",
591
+ {
592
+ class: "vxe-buttons--wrapper"
593
+ },
594
+ renderLeftBtns()
595
+ ),
596
+ h(
597
+ "div",
598
+ {
599
+ class: "vxe-tools--wrapper"
600
+ },
601
+ renderRightTools()
602
+ ),
603
+ h(
604
+ "div",
605
+ {
606
+ class: "vxe-tools--operate"
607
+ },
608
+ [
609
+ props.import ? renderToolImport() : createCommentVNode(),
610
+ props.export ? renderToolExport() : createCommentVNode(),
611
+ props.print ? renderToolPrint() : createCommentVNode(),
612
+ refresh ? renderToolRefresh() : createCommentVNode(),
613
+ zoom && $xeGGWrapper ? renderToolZoom() : createCommentVNode(),
614
+ custom ? renderToolCustom() : createCommentVNode()
615
+ ]
616
+ )
617
+ ]
618
+ );
619
+ };
620
+ $xeToolbar.renderVN = renderVN;
621
+ nextTick(() => {
622
+ const refreshOpts = computeRefreshOpts.value;
623
+ const queryMethod = refreshOpts.queryMethod || refreshOpts.query;
624
+ if (props.refresh && !$xeGGWrapper && !queryMethod) {
625
+ warnLog("vxe.error.notFunc", ["queryMethod"]);
626
+ }
627
+ if (XEUtils.isPlainObject(props.custom)) {
628
+ warnLog("vxe.error.delProp", ["custom={...}", "custom=boolean & custom-options={...}"]);
629
+ }
630
+ if (XEUtils.isPlainObject(props.print)) {
631
+ warnLog("vxe.error.delProp", ["print={...}", "print=boolean & print-options={...}"]);
632
+ }
633
+ if (XEUtils.isPlainObject(props.export)) {
634
+ warnLog("vxe.error.delProp", ["export={...}", "export=boolean & export-options={...}"]);
635
+ }
636
+ if (XEUtils.isPlainObject(props.import)) {
637
+ warnLog("vxe.error.delProp", ["import={...}", "import=boolean & import-options={...}"]);
638
+ }
639
+ if (XEUtils.isPlainObject(props.refresh)) {
640
+ warnLog("vxe.error.delProp", ["refresh={...}", "refresh=boolean & refresh-options={...}"]);
641
+ }
642
+ if (XEUtils.isPlainObject(props.refresh)) {
643
+ warnLog("vxe.error.delProp", ["zoom={...}", "zoom=boolean & zoom-options={...}"]);
644
+ }
645
+ const customOpts = computeCustomOpts.value;
646
+ if (customOpts.isFooter) {
647
+ warnLog("vxe.error.delProp", ["toolbar.custom.isFooter", "table.custom-config.showFooter"]);
648
+ }
649
+ if (customOpts.showFooter) {
650
+ warnLog("vxe.error.delProp", ["toolbar.custom.showFooter", "table.custom-config.showFooter"]);
651
+ }
652
+ if (customOpts.immediate) {
653
+ warnLog("vxe.error.delProp", ["toolbar.custom.immediate", "table.custom-config.immediate"]);
654
+ }
655
+ if (customOpts.trigger) {
656
+ warnLog("vxe.error.delProp", ["toolbar.custom.trigger", "table.custom-config.trigger"]);
657
+ }
658
+ if (props.refresh || props.import || props.export || props.print || props.zoom) {
659
+ if (!VxeUIButtonComponent) {
660
+ errLog("vxe.error.reqComp", ["vxe-button"]);
661
+ }
662
+ }
663
+ });
664
+ onBeforeUnmount(() => {
665
+ XEUtils.assign(reactData, createReactData());
666
+ XEUtils.assign(internalData, createInternalData());
667
+ });
668
+ return $xeToolbar;
669
+ },
670
+ render() {
671
+ return this.renderVN();
672
+ }
673
+ })
674
+ );
672
675
  export {
673
676
  toolbar_default as default
674
677
  };