vxe-table 3.8.8 → 3.8.9-beta.1

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 (46) hide show
  1. package/lib/button/src/button.js +87 -41
  2. package/lib/button/src/button.min.js +1 -1
  3. package/lib/custom/src/panel.js +2 -16
  4. package/lib/custom/src/panel.min.js +1 -1
  5. package/lib/icon/style/style.css +1 -1
  6. package/lib/icon/style/style.min.css +1 -1
  7. package/lib/index.css +1 -1
  8. package/lib/index.umd.js +605 -710
  9. package/lib/index.umd.min.js +1 -1
  10. package/lib/input/style/style.css +6 -1
  11. package/lib/input/style/style.min.css +1 -1
  12. package/lib/style.css +1 -1
  13. package/lib/style.min.css +1 -1
  14. package/lib/table/src/columnInfo.js +2 -0
  15. package/lib/table/src/header.js +1 -1
  16. package/lib/table/src/header.min.js +1 -1
  17. package/lib/table/src/methods.js +455 -600
  18. package/lib/table/src/methods.min.js +1 -1
  19. package/lib/table/src/table.js +5 -3
  20. package/lib/table/src/table.min.js +1 -1
  21. package/lib/tools/log.js +1 -1
  22. package/lib/tools/log.min.js +1 -1
  23. package/lib/v-x-e-table/index.js +1 -1
  24. package/lib/v-x-e-table/index.min.js +1 -1
  25. package/lib/v-x-e-table/src/conf.js +1 -0
  26. package/lib/v-x-e-table/src/conf.min.js +1 -1
  27. package/lib/v-x-e-table/src/renderer.js +1 -0
  28. package/lib/v-x-e-table/src/renderer.min.js +1 -1
  29. package/lib/vxe-input/style/style.css +6 -1
  30. package/lib/vxe-input/style/style.min.css +1 -1
  31. package/package.json +1 -1
  32. package/packages/button/src/button.js +71 -31
  33. package/packages/custom/src/panel.js +2 -14
  34. package/packages/table/src/columnInfo.js +1 -1
  35. package/packages/table/src/header.js +1 -1
  36. package/packages/table/src/methods.js +141 -251
  37. package/packages/table/src/table.js +6 -4
  38. package/packages/v-x-e-table/src/conf.js +1 -0
  39. package/packages/v-x-e-table/src/renderer.js +1 -0
  40. package/styles/input.scss +6 -1
  41. /package/lib/icon/style/{iconfont.1719197379838.ttf → iconfont.1719366342405.ttf} +0 -0
  42. /package/lib/icon/style/{iconfont.1719197379838.woff → iconfont.1719366342405.woff} +0 -0
  43. /package/lib/icon/style/{iconfont.1719197379838.woff2 → iconfont.1719366342405.woff2} +0 -0
  44. /package/lib/{iconfont.1719197379838.ttf → iconfont.1719366342405.ttf} +0 -0
  45. /package/lib/{iconfont.1719197379838.woff → iconfont.1719366342405.woff} +0 -0
  46. /package/lib/{iconfont.1719197379838.woff2 → iconfont.1719366342405.woff2} +0 -0
@@ -23,6 +23,7 @@ export default {
23
23
  title: String,
24
24
  disabled: Boolean,
25
25
  loading: Boolean,
26
+ trigger: { type: String, default: () => GlobalConfig.button.trigger },
26
27
  destroyOnClose: Boolean,
27
28
  className: [String, Function],
28
29
  popupClassName: [String, Function],
@@ -36,8 +37,9 @@ export default {
36
37
  data () {
37
38
  return {
38
39
  inited: false,
39
- showPanel: false,
40
+ visiblePanel: false,
40
41
  animatVisible: false,
42
+ isActivated: false,
41
43
  panelIndex: 0,
42
44
  panelStyle: null,
43
45
  panelPlacement: null
@@ -97,6 +99,7 @@ export default {
97
99
  // }
98
100
 
99
101
  GlobalEvent.on(this, 'mousewheel', this.handleGlobalMousewheelEvent)
102
+ GlobalEvent.on(this, 'mousedown', this.handleGlobalMousedownEvent)
100
103
  },
101
104
  beforeDestroy () {
102
105
  const panelElem = this.$refs.panel
@@ -106,14 +109,25 @@ export default {
106
109
  },
107
110
  destroyed () {
108
111
  GlobalEvent.off(this, 'mousewheel')
112
+ GlobalEvent.off(this, 'mousedown')
109
113
  },
110
114
  render (h) {
111
- const { $scopedSlots, className, popupClassName, title, inited, type, destroyOnClose, isFormBtn, btnMode, btnStatus, btnRound, btnCircle, vSize, name, disabled, loading, showPanel, animatVisible, panelPlacement } = this
115
+ const { $scopedSlots, className, popupClassName, trigger, title, inited, type, destroyOnClose, isFormBtn, btnMode, btnStatus, btnRound, btnCircle, vSize, name, disabled, loading, visiblePanel, animatVisible, panelPlacement } = this
112
116
  const downsSlot = $scopedSlots.dropdowns
117
+ const btnOns = {}
118
+ const panelOns = {}
119
+ if (downsSlot && trigger === 'hover') {
120
+ // hover 触发
121
+ btnOns.mouseenter = this.mouseenterTargetEvent
122
+ btnOns.mouseleave = this.mouseleaveTargetEvent
123
+
124
+ panelOns.onMouseenter = this.mouseenterDropdownEvent
125
+ panelOns.onMouseleave = this.mouseleaveDropdownEvent
126
+ }
113
127
  return downsSlot ? h('div', {
114
128
  class: ['vxe-button--dropdown', className ? (XEUtils.isFunction(className) ? className({ $button: this }) : className) : '', {
115
129
  [`size--${vSize}`]: vSize,
116
- 'is--active': showPanel
130
+ 'is--active': visiblePanel
117
131
  }]
118
132
  }, [
119
133
  h('button', {
@@ -133,9 +147,8 @@ export default {
133
147
  disabled: disabled || loading
134
148
  },
135
149
  on: {
136
- mouseenter: this.mouseenterTargetEvent,
137
- mouseleave: this.mouseleaveTargetEvent,
138
- click: this.clickEvent
150
+ click: this.clickTargetEvent,
151
+ ...btnOns
139
152
  }
140
153
  }, this.renderContent(h).concat([
141
154
  h('i', {
@@ -147,7 +160,7 @@ export default {
147
160
  class: ['vxe-button--dropdown-panel', popupClassName ? (XEUtils.isFunction(popupClassName) ? popupClassName({ $button: this }) : popupClassName) : '', {
148
161
  [`size--${vSize}`]: vSize,
149
162
  'animat--leave': animatVisible,
150
- 'animat--enter': showPanel
163
+ 'animat--enter': visiblePanel
151
164
  }],
152
165
  attrs: {
153
166
  placement: panelPlacement
@@ -159,10 +172,9 @@ export default {
159
172
  on: {
160
173
  mousedown: this.mousedownDropdownEvent,
161
174
  click: this.clickDropdownEvent,
162
- mouseenter: this.mouseenterDropdownEvent,
163
- mouseleave: this.mouseleaveDropdownEvent
175
+ ...panelOns
164
176
  }
165
- }, destroyOnClose && !showPanel ? [] : downsSlot.call(this, {}, h))
177
+ }, destroyOnClose && !visiblePanel ? [] : downsSlot.call(this, {}, h))
166
178
  ] : null)
167
179
  ]) : h('button', {
168
180
  ref: 'xBtn',
@@ -226,10 +238,21 @@ export default {
226
238
  return contents
227
239
  },
228
240
  handleGlobalMousewheelEvent (evnt) {
229
- if (this.showPanel && !DomTools.getEventTargetNode(evnt, this.$refs.panel).flag) {
241
+ if (this.visiblePanel && !DomTools.getEventTargetNode(evnt, this.$refs.panel).flag) {
230
242
  this.closePanel()
231
243
  }
232
244
  },
245
+ handleGlobalMousedownEvent (evnt) {
246
+ const { disabled, visiblePanel } = this
247
+ if (!disabled) {
248
+ const el = this.$refs.$el
249
+ const panelElem = this.$refs.panel
250
+ this.isActivated = DomTools.getEventTargetNode(evnt, el).flag || DomTools.getEventTargetNode(evnt, panelElem).flag
251
+ if (visiblePanel && !this.isActivated) {
252
+ this.closePanel()
253
+ }
254
+ }
255
+ },
233
256
  updateZindex () {
234
257
  if (this.panelIndex < UtilTools.getLastZIndex()) {
235
258
  this.panelIndex = UtilTools.nextZIndex()
@@ -257,7 +280,7 @@ export default {
257
280
  if (panelElem) {
258
281
  panelElem.dataset.active = 'N'
259
282
  }
260
- this.showPanel = false
283
+ this.visiblePanel = false
261
284
  setTimeout(() => {
262
285
  if (!panelElem || panelElem.dataset.active !== 'Y') {
263
286
  this.animatVisible = false
@@ -277,21 +300,7 @@ export default {
277
300
  this.$emit('mouseleave', { $event: evnt })
278
301
  },
279
302
  mouseenterTargetEvent (evnt) {
280
- const panelElem = this.$refs.panel
281
- panelElem.dataset.active = 'Y'
282
- if (!this.inited) {
283
- this.inited = true
284
- if (this.transfer) {
285
- document.body.appendChild(panelElem)
286
- }
287
- }
288
- this.showTime = setTimeout(() => {
289
- if (panelElem.dataset.active === 'Y') {
290
- this.mouseenterDropdownEvent()
291
- } else {
292
- this.animatVisible = false
293
- }
294
- }, 250)
303
+ this.openPanel()
295
304
  this.$emit('mouseenter', { $event: evnt })
296
305
  },
297
306
  mouseenterDropdownEvent () {
@@ -300,11 +309,11 @@ export default {
300
309
  this.animatVisible = true
301
310
  setTimeout(() => {
302
311
  if (panelElem.dataset.active === 'Y') {
303
- this.showPanel = true
312
+ this.visiblePanel = true
304
313
  this.updateZindex()
305
314
  this.updatePlacement()
306
315
  setTimeout(() => {
307
- if (this.showPanel) {
316
+ if (this.visiblePanel) {
308
317
  this.updatePlacement()
309
318
  }
310
319
  }, 50)
@@ -314,6 +323,36 @@ export default {
314
323
  mouseleaveDropdownEvent () {
315
324
  this.closePanel()
316
325
  },
326
+ clickTargetEvent (evnt) {
327
+ const { trigger } = this
328
+ if (trigger === 'click') {
329
+ if (this.visiblePanel) {
330
+ this.closePanel()
331
+ } else {
332
+ this.openPanel()
333
+ }
334
+ }
335
+ this.clickEvent(evnt)
336
+ },
337
+ openPanel () {
338
+ const { trigger } = this
339
+ const panelElem = this.$refs.panel
340
+ panelElem.dataset.active = 'Y'
341
+ if (!this.inited) {
342
+ this.inited = true
343
+ if (this.transfer) {
344
+ document.body.appendChild(panelElem)
345
+ }
346
+ }
347
+ this.showTime = setTimeout(() => {
348
+ if (panelElem.dataset.active === 'Y') {
349
+ this.mouseenterDropdownEvent()
350
+ } else {
351
+ this.animatVisible = false
352
+ }
353
+ }, trigger === 'click' ? 50 : 250)
354
+ return this.$nextTick()
355
+ },
317
356
  closePanel () {
318
357
  const panelElem = this.$refs.panel
319
358
  clearTimeout(this.showTime)
@@ -321,7 +360,7 @@ export default {
321
360
  panelElem.dataset.active = 'N'
322
361
  setTimeout(() => {
323
362
  if (panelElem.dataset.active !== 'Y') {
324
- this.showPanel = false
363
+ this.visiblePanel = false
325
364
  setTimeout(() => {
326
365
  if (panelElem.dataset.active !== 'Y') {
327
366
  this.animatVisible = false
@@ -331,8 +370,9 @@ export default {
331
370
  }, 100)
332
371
  } else {
333
372
  this.animatVisible = false
334
- this.showPanel = false
373
+ this.visiblePanel = false
335
374
  }
375
+ return this.$nextTick()
336
376
  },
337
377
  updatePlacement () {
338
378
  return this.$nextTick().then(() => {
@@ -589,18 +589,6 @@ export default {
589
589
  getStoreData () {
590
590
  return {}
591
591
  },
592
- handleSaveStore (type) {
593
- const { $xetable } = this
594
- const { id, customOpts } = $xetable
595
- const { storage, updateStore } = customOpts
596
- if (storage && id && updateStore) {
597
- updateStore({
598
- id,
599
- type,
600
- storeData: $xetable.getCustomStoreData()
601
- })
602
- }
603
- },
604
592
  confirmCustomEvent (evnt) {
605
593
  const { $xetable } = this
606
594
  const { customOpts, customColumnList } = $xetable
@@ -629,7 +617,7 @@ export default {
629
617
  })
630
618
  $xetable.closeCustom()
631
619
  $xetable.emitCustomEvent('confirm', evnt)
632
- this.handleSaveStore('confirm')
620
+ $xetable.saveCustomStore('confirm')
633
621
  },
634
622
  cancelCustomEvent (evnt) {
635
623
  const { $xetable } = this
@@ -663,7 +651,6 @@ export default {
663
651
  $xetable.resetColumn(true)
664
652
  $xetable.closeCustom()
665
653
  $xetable.emitCustomEvent('reset', evnt)
666
- this.handleSaveStore('reset')
667
654
  },
668
655
  resetCustomEvent (evnt) {
669
656
  if (VXETable.modal) {
@@ -719,6 +706,7 @@ export default {
719
706
  this.handleOptionCheck(column)
720
707
  if (customOpts.immediate) {
721
708
  $xetable.handleCustom()
709
+ $xetable.saveCustomStore('update:visible')
722
710
  }
723
711
  $xetable.checkCustomStatus()
724
712
  },
@@ -127,7 +127,7 @@ export class ColumnInfo {
127
127
  renderWidth: 0,
128
128
  renderHeight: 0,
129
129
  renderResizeWidth: 0,
130
- resizeWidth: 0,
130
+ resizeWidth: 0, // 手动调整
131
131
 
132
132
  renderLeft: 0,
133
133
  renderArgs: [], // 渲染参数可用于扩展
@@ -280,7 +280,7 @@ export default {
280
280
  $xetable._lastResizeTime = Date.now()
281
281
  $xetable.analyColumnWidth()
282
282
  $xetable.recalculate(true).then(() => {
283
- $xetable.saveCustomResizable()
283
+ $xetable.saveCustomStore('update:visible')
284
284
  $xetable.updateCellAreas()
285
285
  $xetable.emitEvent('resizable-change', { ...params, resizeWidth }, evnt)
286
286
  })