vxe-table 3.3.14-beta.0 → 3.3.14-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.
@@ -0,0 +1,79 @@
1
+ import GlobalConfig from '../../v-x-e-table/src/conf'
2
+ import VXETable from '../../v-x-e-table'
3
+ import { UtilTools, isEnableConf } from '../../tools'
4
+
5
+ function renderPrefixIcon (h, titlePrefix) {
6
+ return h('span', {
7
+ class: 'vxe-form--item-title-prefix'
8
+ }, [
9
+ h('i', {
10
+ class: titlePrefix.icon || GlobalConfig.icon.FORM_PREFIX
11
+ })
12
+ ])
13
+ }
14
+
15
+ function renderSuffixIcon (h, titleSuffix) {
16
+ return h('span', {
17
+ class: 'vxe-form--item-title-suffix'
18
+ }, [
19
+ h('i', {
20
+ class: titleSuffix.icon || GlobalConfig.icon.FORM_SUFFIX
21
+ })
22
+ ])
23
+ }
24
+
25
+ export function renderTitle (h, _vm, item) {
26
+ const { data } = _vm
27
+ const { slots, field, itemRender, titlePrefix, titleSuffix } = item
28
+ const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
29
+ const params = { data, property: field, item, $form: _vm }
30
+ const contVNs = []
31
+ const titVNs = []
32
+ if (titlePrefix) {
33
+ titVNs.push(
34
+ titlePrefix.message
35
+ ? h('vxe-tooltip', {
36
+ props: {
37
+ content: UtilTools.getFuncText(titlePrefix.message),
38
+ enterable: titlePrefix.enterable,
39
+ theme: titlePrefix.theme
40
+ }
41
+ }, [
42
+ renderPrefixIcon(h, titlePrefix)
43
+ ])
44
+ : renderPrefixIcon(h, titlePrefix)
45
+ )
46
+ }
47
+ titVNs.push(
48
+ h('span', {
49
+ class: 'vxe-form--item-title-label'
50
+ }, compConf && compConf.renderItemTitle ? compConf.renderItemTitle(itemRender, params) : (slots && slots.title ? _vm.callSlot(slots.title, params, h) : UtilTools.getFuncText(item.title)))
51
+ )
52
+ contVNs.push(
53
+ h('div', {
54
+ class: 'vxe-form--item-title-content'
55
+ }, titVNs)
56
+ )
57
+ const fixVNs = []
58
+ if (titleSuffix) {
59
+ fixVNs.push(
60
+ titleSuffix.message
61
+ ? h('vxe-tooltip', {
62
+ props: {
63
+ content: UtilTools.getFuncText(titleSuffix.message),
64
+ enterable: titleSuffix.enterable,
65
+ theme: titleSuffix.theme
66
+ }
67
+ }, [
68
+ renderSuffixIcon(h, titleSuffix)
69
+ ])
70
+ : renderSuffixIcon(h, titleSuffix)
71
+ )
72
+ }
73
+ contVNs.push(
74
+ h('div', {
75
+ class: 'vxe-form--item-title-postfix'
76
+ }, fixVNs)
77
+ )
78
+ return contVNs
79
+ }
@@ -40,8 +40,8 @@ function renderDefaultForm (h, _vm) {
40
40
  on: {
41
41
  submit: _vm.submitEvent,
42
42
  reset: _vm.resetEvent,
43
- 'submit-invalid': _vm.submitInvalidEvent,
44
- 'toggle-collapse': _vm.togglCollapseEvent
43
+ collapse: _vm.collapseEvent,
44
+ 'submit-invalid': _vm.submitInvalidEvent
45
45
  },
46
46
  scopedSlots: formSlots
47
47
  })
@@ -819,9 +819,10 @@ export default {
819
819
  submitInvalidEvent (params) {
820
820
  this.$emit('form-submit-invalid', Object.assign({ $grid: this }, params))
821
821
  },
822
- togglCollapseEvent (params) {
822
+ collapseEvent (params) {
823
823
  this.$nextTick(() => this.recalculate(true))
824
824
  this.$emit('form-toggle-collapse', Object.assign({ $grid: this }, params))
825
+ this.$emit('form-collapse', Object.assign({ $grid: this }, params))
825
826
  },
826
827
  triggerZoomEvent (evnt) {
827
828
  this.zoom()
@@ -574,13 +574,17 @@ export default {
574
574
  */
575
575
  scrollEvent (evnt) {
576
576
  const { $el: scrollBodyElem, $parent: $xetable, fixedType } = this
577
- const { $refs, highlightHoverRow, scrollXLoad, scrollYLoad, lastScrollTop, lastScrollLeft } = $xetable
577
+ const { $refs, elemStore, highlightHoverRow, scrollXLoad, scrollYLoad, lastScrollTop, lastScrollLeft } = $xetable
578
578
  const { tableHeader, tableBody, leftBody, rightBody, tableFooter, validTip } = $refs
579
579
  const headerElem = tableHeader ? tableHeader.$el : null
580
580
  const footerElem = tableFooter ? tableFooter.$el : null
581
581
  const bodyElem = tableBody.$el
582
582
  const leftElem = leftBody ? leftBody.$el : null
583
583
  const rightElem = rightBody ? rightBody.$el : null
584
+ const bodyYElem = elemStore['main-body-ySpace']
585
+ const bodyXElem = elemStore['main-body-xSpace']
586
+ const bodyHeight = bodyYElem ? bodyYElem.clientHeight : 0
587
+ const bodyWidth = bodyXElem ? bodyXElem.clientWidth : 0
584
588
  let scrollTop = scrollBodyElem.scrollTop
585
589
  const scrollLeft = bodyElem.scrollLeft
586
590
  const isRollX = scrollLeft !== lastScrollLeft
@@ -622,16 +626,20 @@ export default {
622
626
  if (isRollX && validTip && validTip.visible) {
623
627
  validTip.updatePlacement()
624
628
  }
625
- $xetable.emitEvent('scroll', { type: renderType, fixed: fixedType, scrollTop, scrollLeft, isX: isRollX, isY: isRollY }, evnt)
629
+ $xetable.emitEvent('scroll', { type: renderType, fixed: fixedType, scrollTop, scrollLeft, bodyHeight, bodyWidth, isX: isRollX, isY: isRollY }, evnt)
626
630
  },
627
631
  handleWheel (evnt, isTopWheel, deltaTop, isRollX, isRollY) {
628
632
  const { $parent: $xetable } = this
629
- const { $refs } = $xetable
633
+ const { $refs, elemStore } = $xetable
630
634
  const { tableBody, leftBody, rightBody } = $refs
631
635
  const bodyElem = tableBody.$el
632
636
  const leftElem = leftBody ? leftBody.$el : null
633
637
  const rightElem = rightBody ? rightBody.$el : null
634
638
  const remainSize = this.isPrevWheelTop === isTopWheel ? Math.max(0, this.wheelYSize - this.wheelYTotal) : 0
639
+ const bodyYElem = elemStore['main-body-ySpace']
640
+ const bodyXElem = elemStore['main-body-xSpace']
641
+ const bodyHeight = bodyYElem ? bodyYElem.clientHeight : 0
642
+ const bodyWidth = bodyXElem ? bodyXElem.clientWidth : 0
635
643
  this.isPrevWheelTop = isTopWheel
636
644
  this.wheelYSize = Math.abs(isTopWheel ? deltaTop - remainSize : deltaTop + remainSize)
637
645
  this.wheelYInterval = 0
@@ -659,7 +667,7 @@ export default {
659
667
  }
660
668
  this.wheelYTotal = wheelYTotal
661
669
  this.wheelYInterval = wheelYInterval
662
- $xetable.emitEvent('scroll', { type: renderType, fixed: fixedType, scrollTop: bodyElem.scrollTop, scrollLeft: bodyElem.scrollLeft, isX: isRollX, isY: isRollY }, evnt)
670
+ $xetable.emitEvent('scroll', { type: renderType, fixed: fixedType, scrollTop: bodyElem.scrollTop, scrollLeft: bodyElem.scrollLeft, bodyHeight, bodyWidth, isX: isRollX, isY: isRollY }, evnt)
663
671
  }
664
672
  }
665
673
  handleSmooth()
@@ -21,6 +21,7 @@ export default {
21
21
  placeholder: String,
22
22
  maxlength: [String, Number],
23
23
  rows: { type: [String, Number], default: 2 },
24
+ cols: { type: [String, Number], default: null },
24
25
  showWordCount: Boolean,
25
26
  countMethod: Function,
26
27
  autosize: [Boolean, Object],
@@ -71,14 +72,16 @@ export default {
71
72
  }
72
73
  },
73
74
  render (h) {
74
- const { className, defaultEvents, inputValue, vSize, name, form, resize, placeholder, readonly, disabled, maxlength, autosize, showWordCount, countMethod } = this
75
+ const { className, defaultEvents, inputValue, vSize, name, form, resize, placeholder, readonly, disabled, maxlength, autosize, showWordCount, countMethod, rows, cols } = this
75
76
  const attrs = {
76
77
  name,
77
78
  form,
78
79
  placeholder,
79
80
  maxlength,
80
81
  readonly,
81
- disabled
82
+ disabled,
83
+ rows,
84
+ cols
82
85
  }
83
86
  if (placeholder) {
84
87
  attrs.placeholder = UtilTools.getFuncText(placeholder)
@@ -87,7 +90,9 @@ export default {
87
90
  class: ['vxe-textarea', className, {
88
91
  [`size--${vSize}`]: vSize,
89
92
  'is--autosize': autosize,
90
- 'is--disabled': disabled
93
+ 'is--disabled': disabled,
94
+ 'def--rows': !XEUtils.eqNull(rows),
95
+ 'def--cols': !XEUtils.eqNull(cols)
91
96
  }]
92
97
  }, [
93
98
  h('textarea', {
@@ -3,7 +3,12 @@
3
3
  .vxe-textarea {
4
4
  position: relative;
5
5
  display: inline-block;
6
- width: 100%;
6
+ &:not(.def--cols) {
7
+ width: 100%;
8
+ .vxe-textarea--inner {
9
+ width: 100%;
10
+ }
11
+ }
7
12
  }
8
13
 
9
14
  .vxe-textarea--inner {
@@ -15,6 +20,11 @@
15
20
  line-height: inherit;
16
21
  border: 1px solid $vxe-input-border-color;
17
22
  background-color: $vxe-textarea-background-color;
23
+ display: block;
24
+ padding: 0.3em 0.6em;
25
+ &::placeholder {
26
+ color: $vxe-input-placeholder-color;
27
+ }
18
28
  &:focus {
19
29
  border: 1px solid $vxe-primary-color;
20
30
  }
@@ -24,16 +34,6 @@
24
34
  }
25
35
  }
26
36
 
27
- .vxe-textarea--inner {
28
- width: 100%;
29
- height: 100%;
30
- display: block;
31
- padding: 0.3em 0.6em;
32
- &::placeholder {
33
- color: $vxe-input-placeholder-color;
34
- }
35
- }
36
-
37
37
  .vxe-textarea--inner,
38
38
  .vxe-textarea--autosize {
39
39
  line-height: $vxe-textarea-line-height;