vxe-table 4.7.77 → 4.7.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -1
- package/README.ja-JP.md +1 -1
- package/README.md +1 -1
- package/README.zh-TW.md +1 -1
- package/es/grid/src/grid.js +45 -36
- package/es/style.css +1 -1
- package/es/table/module/custom/panel.js +5 -0
- package/es/table/src/body.js +26 -2
- package/es/table/src/cell.js +6 -6
- package/es/table/src/column.js +45 -18
- package/es/table/src/footer.js +16 -4
- package/es/table/src/group.js +18 -12
- package/es/table/src/header.js +4 -1
- package/es/table/src/props.js +96 -24
- package/es/table/src/table.js +2 -4
- package/es/table/src/util.js +1 -1
- package/es/toolbar/src/toolbar.js +89 -68
- package/es/ui/index.js +2 -2
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +45 -39
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +252 -174
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/panel.js +7 -0
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/src/cell.js +3 -3
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +16 -10
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/group.js +17 -11
- package/lib/table/src/group.min.js +1 -1
- package/lib/table/src/table.js +2 -4
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +1 -1
- package/lib/table/src/util.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +109 -76
- package/lib/toolbar/src/toolbar.min.js +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +54 -44
- package/packages/table/module/custom/panel.ts +5 -0
- package/packages/table/src/body.ts +26 -2
- package/packages/table/src/cell.ts +9 -8
- package/packages/table/src/column.ts +47 -20
- package/packages/table/src/footer.ts +16 -4
- package/packages/table/src/group.ts +19 -13
- package/packages/table/src/header.ts +4 -1
- package/packages/table/src/props.ts +97 -24
- package/packages/table/src/table.ts +2 -4
- package/packages/table/src/util.ts +2 -2
- package/packages/toolbar/src/toolbar.ts +97 -75
- /package/es/{iconfont.1725604498089.ttf → iconfont.1726051234125.ttf} +0 -0
- /package/es/{iconfont.1725604498089.woff → iconfont.1726051234125.woff} +0 -0
- /package/es/{iconfont.1725604498089.woff2 → iconfont.1726051234125.woff2} +0 -0
- /package/lib/{iconfont.1725604498089.ttf → iconfont.1726051234125.ttf} +0 -0
- /package/lib/{iconfont.1725604498089.woff → iconfont.1726051234125.woff} +0 -0
- /package/lib/{iconfont.1725604498089.woff2 → iconfont.1726051234125.woff2} +0 -0
|
@@ -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,
|
|
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: {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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(
|
|
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
|
|
94
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
287
|
-
const
|
|
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
|
|
343
|
-
const
|
|
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
|
-
|
|
561
|
-
|
|
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
|
},
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|