sh-view 2.1.0 → 2.2.0

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 (128) hide show
  1. package/package.json +9 -13
  2. package/packages/components/global-components/sh-alert/index.vue +175 -173
  3. package/packages/components/global-components/sh-badge/index.vue +57 -43
  4. package/packages/components/global-components/sh-card/index.vue +24 -16
  5. package/packages/components/global-components/sh-code-editor/index.vue +250 -260
  6. package/packages/components/global-components/sh-col/index.vue +44 -36
  7. package/packages/components/global-components/sh-corner/index.vue +230 -228
  8. package/packages/components/global-components/sh-count-to/index.vue +60 -51
  9. package/packages/components/global-components/sh-drawer/index.vue +209 -182
  10. package/packages/components/global-components/sh-drawer/scrollbar.js +44 -42
  11. package/packages/components/global-components/sh-empty/index.vue +0 -1
  12. package/packages/components/global-components/sh-form/form.vue +110 -0
  13. package/packages/components/global-components/sh-form/js/props.js +76 -63
  14. package/packages/components/global-components/sh-form/js/useForm.js +236 -0
  15. package/packages/components/global-components/sh-form/query.vue +70 -0
  16. package/packages/components/global-components/sh-header/index.vue +35 -50
  17. package/packages/components/global-components/sh-icon/css/index.scss +44 -0
  18. package/packages/components/global-components/sh-icon/index.vue +24 -11
  19. package/packages/components/global-components/sh-image/index.vue +47 -38
  20. package/packages/components/global-components/sh-list/index.vue +42 -37
  21. package/packages/components/global-components/sh-loading/index.vue +12 -8
  22. package/packages/components/global-components/sh-modal/index.vue +49 -40
  23. package/packages/components/global-components/sh-noticebar/index.vue +68 -54
  24. package/packages/components/global-components/sh-poptip/index.vue +247 -130
  25. package/packages/components/global-components/sh-progress/index.vue +71 -69
  26. package/packages/components/global-components/sh-pull-refresh/index.vue +156 -157
  27. package/packages/components/global-components/sh-result/index.vue +37 -28
  28. package/packages/components/global-components/sh-row/index.vue +21 -18
  29. package/packages/components/global-components/sh-split/index.vue +115 -109
  30. package/packages/components/global-components/sh-table/components/importModal.vue +95 -86
  31. package/packages/components/global-components/sh-table/components/sh-column.vue +54 -0
  32. package/packages/components/global-components/sh-table/{index.vue → grid.vue} +34 -145
  33. package/packages/components/global-components/sh-table/js/tableMethods.js +175 -0
  34. package/packages/components/global-components/sh-table/js/useTable.js +592 -0
  35. package/packages/components/global-components/sh-table/table.vue +269 -0
  36. package/packages/components/global-components/sh-tabs/index.vue +118 -93
  37. package/packages/components/global-components/sh-tag/index.vue +52 -51
  38. package/packages/components/global-components/sh-toolbar/index.vue +53 -47
  39. package/packages/components/global-components/sh-tree/components/table-tree.vue +152 -139
  40. package/packages/components/global-components/sh-tree/index.vue +218 -195
  41. package/packages/components/global-components/sh-tree/mixin/treeProps.js +118 -120
  42. package/packages/components/global-components/sh-upload/index.vue +308 -51
  43. package/packages/components/global-components/sh-water-fall/index.vue +4 -11
  44. package/packages/components/index.js +5 -3
  45. package/packages/components/other-components/sh-cron-modal/components/cron-content.vue +140 -129
  46. package/packages/components/other-components/sh-cron-modal/css/index.scss +0 -5
  47. package/packages/components/other-components/sh-cron-modal/index.vue +81 -67
  48. package/packages/components/other-components/sh-cron-modal/mixin/cron-emits.js +1 -0
  49. package/packages/components/other-components/sh-cron-modal/mixin/cron-hooks.js +179 -0
  50. package/packages/components/other-components/sh-cron-modal/mixin/cron-props.js +9 -0
  51. package/packages/components/other-components/sh-cron-modal/tabs/cron-day-box.vue +101 -92
  52. package/packages/components/other-components/sh-cron-modal/tabs/cron-hour-box.vue +68 -56
  53. package/packages/components/other-components/sh-cron-modal/tabs/cron-minute-box.vue +68 -56
  54. package/packages/components/other-components/sh-cron-modal/tabs/cron-month-box.vue +68 -56
  55. package/packages/components/other-components/sh-cron-modal/tabs/cron-second-box.vue +68 -56
  56. package/packages/components/other-components/sh-cron-modal/tabs/cron-week-box.vue +126 -115
  57. package/packages/components/other-components/sh-cron-modal/tabs/cron-year-box.vue +59 -46
  58. package/packages/components/other-components/sh-menu/index.vue +73 -60
  59. package/packages/components/other-components/sh-menu/menu-group-content.vue +71 -59
  60. package/packages/components/other-components/sh-menu/menu-item-content.vue +40 -30
  61. package/packages/components/other-components/sh-menu-card/index.vue +70 -64
  62. package/packages/components/other-components/sh-menu-card/menu-box.vue +50 -44
  63. package/packages/components/other-components/sh-preview/components/sh-excel.vue +182 -0
  64. package/packages/components/other-components/sh-preview/components/sh-word.vue +73 -0
  65. package/packages/components/other-components/sh-preview/index.vue +86 -85
  66. package/packages/components/other-components/sh-preview/js/data-hook.js +37 -0
  67. package/packages/components/other-components/sh-preview/js/data-props.js +11 -0
  68. package/packages/components/other-components/sh-system-tip/index.vue +28 -24
  69. package/packages/css/index.js +4 -4
  70. package/packages/directive/module/prevent-click.js +1 -1
  71. package/packages/directive/module/resize.js +11 -154
  72. package/packages/index.js +39 -39
  73. package/packages/mixin/index.js +86 -87
  74. package/packages/vxeTable/render/cell/vxe-render-checkbox.vue +14 -5
  75. package/packages/vxeTable/render/cell/vxe-render-checkgroup.vue +43 -36
  76. package/packages/vxeTable/render/cell/vxe-render-code.vue +14 -5
  77. package/packages/vxeTable/render/cell/vxe-render-goption.vue +34 -24
  78. package/packages/vxeTable/render/cell/vxe-render-href.vue +21 -11
  79. package/packages/vxeTable/render/cell/vxe-render-img.vue +16 -10
  80. package/packages/vxeTable/render/cell/vxe-render-input.vue +83 -79
  81. package/packages/vxeTable/render/cell/vxe-render-money.vue +14 -6
  82. package/packages/vxeTable/render/cell/vxe-render-progress.vue +28 -19
  83. package/packages/vxeTable/render/cell/vxe-render-radio.vue +14 -5
  84. package/packages/vxeTable/render/cell/vxe-render-radiogroup.vue +43 -36
  85. package/packages/vxeTable/render/cell/vxe-render-select.vue +44 -36
  86. package/packages/vxeTable/render/cell/vxe-render-switch.vue +14 -5
  87. package/packages/vxeTable/render/cell/vxe-render-table.vue +51 -78
  88. package/packages/vxeTable/render/cell/vxe-render-textarea.vue +14 -5
  89. package/packages/vxeTable/render/cell/vxe-render-time.vue +23 -13
  90. package/packages/vxeTable/render/cell/vxe-render-tree.vue +23 -27
  91. package/packages/vxeTable/render/cell/vxe-render-upload.vue +11 -7
  92. package/packages/vxeTable/render/filters/vxe-filter-input.vue +25 -43
  93. package/packages/vxeTable/render/footer/vxe-footer-input.vue +23 -13
  94. package/packages/vxeTable/render/footer/vxe-footer-money.vue +30 -20
  95. package/packages/vxeTable/render/globalRenders.jsx +1 -1
  96. package/packages/vxeTable/render/header/vxe-header-money.vue +31 -21
  97. package/packages/vxeTable/render/mixin/cell-hooks.js +162 -0
  98. package/packages/vxeTable/render/mixin/cell-props.js +23 -0
  99. package/packages/vxeTable/render/mixin/filter-hooks.js +28 -0
  100. package/packages/components/global-components/sh-form/components/form-item.vue +0 -25
  101. package/packages/components/global-components/sh-form/css/index.scss +0 -55
  102. package/packages/components/global-components/sh-form/index.vue +0 -114
  103. package/packages/components/global-components/sh-form/js/methods.js +0 -146
  104. package/packages/components/global-components/sh-form/mixin/defaultData.js +0 -32
  105. package/packages/components/global-components/sh-icon/css/default/index.scss +0 -27
  106. package/packages/components/global-components/sh-icon/css/font/index.scss +0 -16
  107. package/packages/components/global-components/sh-icon/icon-default.vue +0 -32
  108. package/packages/components/global-components/sh-icon/icon-font.vue +0 -32
  109. package/packages/components/global-components/sh-poptip/popper.js +0 -115
  110. package/packages/components/global-components/sh-query/index.vue +0 -317
  111. package/packages/components/global-components/sh-table/js/methods.js +0 -549
  112. package/packages/components/global-components/sh-table/mixin/defaultData.js +0 -94
  113. package/packages/components/global-components/sh-upload/js/mixin.js +0 -257
  114. package/packages/components/other-components/sh-cron-modal/mixin/cron-box.js +0 -169
  115. package/packages/vxeTable/render/mixin/cell-mixin.js +0 -195
  116. /package/packages/components/global-components/sh-icon/css/default/{fonts/ionicons.svg → ionicons.svg} +0 -0
  117. /package/packages/components/global-components/sh-icon/css/default/{fonts/ionicons.ttf → ionicons.ttf} +0 -0
  118. /package/packages/components/global-components/sh-icon/css/default/{fonts/ionicons.woff → ionicons.woff} +0 -0
  119. /package/packages/components/global-components/sh-icon/css/default/{fonts/ionicons.woff2 → ionicons.woff2} +0 -0
  120. /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.js → iconfont.js} +0 -0
  121. /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.json → iconfont.json} +0 -0
  122. /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.ttf → iconfont.ttf} +0 -0
  123. /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.woff → iconfont.woff} +0 -0
  124. /package/packages/components/global-components/sh-icon/css/font/{fonts/iconfont.woff2 → iconfont.woff2} +0 -0
  125. /package/packages/{assets/css → css}/animated.scss +0 -0
  126. /package/packages/{assets/css → css}/loader.scss +0 -0
  127. /package/packages/{assets/css → css}/main.scss +0 -0
  128. /package/packages/{assets/css → css}/theme.scss +0 -0
@@ -1,14 +1,14 @@
1
1
  <template>
2
2
  <div v-clickout="handleClose" class="sh-poptip" :class="classes" @mouseenter="handleMouseenter" @mouseleave="handleMouseleave">
3
- <div ref="reference" class="sh-poptip-rel" @click="handleClick" @mousedown="handleFocus(false)" @mouseup="handleBlur(false)"><slot></slot></div>
3
+ <div ref="referenceRef" class="sh-poptip-rel" @click="handleClick" @mousedown="handleFocus(false)" @mouseup="handleBlur(false)"><slot></slot></div>
4
4
  <teleport to="body" :disabled="!transfer">
5
5
  <transition name="fade">
6
- <div v-show="visible" ref="popper" :class="popperClasses" :style="styles" @click="handleTransferClick" @mouseenter="handleMouseenter" @mouseleave="handleMouseleave">
6
+ <div v-show="visible" ref="popperRef" :class="popperClasses" :style="styles" @click="handleTransferClick" @mouseenter="handleMouseenter" @mouseleave="handleMouseleave">
7
7
  <div class="sh-poptip-content">
8
8
  <div class="sh-poptip-arrow"></div>
9
9
  <div v-if="confirm" class="sh-poptip-inner">
10
10
  <div class="sh-poptip-body">
11
- <i class="ivu-icon ivu-icon-ios-help-circle"></i>
11
+ <sh-icon type="ios-help-circle"></sh-icon>
12
12
  <div class="sh-poptip-body-message">
13
13
  <slot name="title">{{ title }}</slot>
14
14
  </div>
@@ -18,13 +18,13 @@
18
18
  <vxe-button status="primary" size="small" @click="ok">{{ comfirmText }}</vxe-button>
19
19
  </div>
20
20
  </div>
21
- <div v-if="!confirm" class="sh-poptip-inner">
22
- <div v-if="showTitle" ref="title" class="sh-poptip-title" :style="contentPaddingStyle">
21
+ <div v-else class="sh-poptip-inner">
22
+ <div v-if="showTitle" ref="title" class="sh-poptip-title" :style="titleStyle">
23
23
  <slot name="title">
24
24
  <div class="sh-poptip-title-inner">{{ title }}</div>
25
25
  </slot>
26
26
  </div>
27
- <div class="sh-poptip-body" :style="contentPaddingStyle">
27
+ <div class="sh-poptip-body" :style="contentStyle">
28
28
  <div :class="contentClasses">
29
29
  <slot name="content">
30
30
  <div class="sh-poptip-body-content-inner">{{ content }}</div>
@@ -40,12 +40,20 @@
40
40
  </template>
41
41
 
42
42
  <script>
43
- import Popper from './popper'
43
+ import { defineComponent, computed, onMounted, onUpdated, onBeforeUnmount, getCurrentInstance, ref, watch, nextTick } from 'vue'
44
44
  import { transferIndex, transferIncrease } from '../../../utils/transfer-queue'
45
- export default {
45
+ import Popper from 'popper.js'
46
+ const handleGetIndex = () => {
47
+ transferIncrease()
48
+ return transferIndex
49
+ }
50
+ export default defineComponent({
46
51
  name: 'ShPoptip',
47
- mixins: [Popper],
48
52
  props: {
53
+ modelValue: {
54
+ type: Boolean,
55
+ default: false
56
+ },
49
57
  trigger: {
50
58
  type: String,
51
59
  default: 'click' // 'click', 'focus', 'hover'
@@ -64,6 +72,9 @@ export default {
64
72
  width: {
65
73
  type: [String, Number]
66
74
  },
75
+ height: {
76
+ type: [String, Number]
77
+ },
67
78
  confirm: {
68
79
  type: Boolean,
69
80
  default: false
@@ -99,149 +110,163 @@ export default {
99
110
  },
100
111
  transferClassName: {
101
112
  type: String
113
+ },
114
+ eventsEnabled: {
115
+ type: Boolean,
116
+ default: false
117
+ },
118
+ boundariesPadding: {
119
+ type: Number,
120
+ default: 5
121
+ },
122
+ reference: Object,
123
+ popper: Object,
124
+ offset: {
125
+ type: Number,
126
+ default: 0
127
+ },
128
+ transition: String,
129
+ options: {
130
+ type: Object,
131
+ default() {
132
+ return {
133
+ modifiers: {
134
+ computeStyle: {
135
+ gpuAcceleration: false
136
+ },
137
+ preventOverflow: {
138
+ boundariesElement: 'window'
139
+ }
140
+ }
141
+ }
142
+ }
102
143
  }
103
144
  },
104
- emits: ['confirm', 'cancel'],
105
- data() {
106
- return {
107
- showTitle: true,
108
- isInput: false,
109
- disableCloseUnderTransfer: false, // transfer 模式下,点击 slot 也会触发关闭
110
- tIndex: this.handleGetIndex()
111
- }
112
- },
113
- computed: {
114
- classes() {
145
+ emits: ['update:modelValue', 'popper-show', 'popper-hide', 'created', 'confirm', 'cancel'],
146
+ setup(props, context) {
147
+ const { emit, slots } = context
148
+ const popperRef = ref()
149
+ const referenceRef = ref()
150
+ const visible = ref(props.modelValue)
151
+ const showTitle = ref(true)
152
+ const isInput = ref(false)
153
+ const disableCloseUnderTransfer = ref(false)
154
+ const tIndex = ref(handleGetIndex())
155
+ let enterTimer = null
156
+ let popperJS = null
157
+
158
+ const classes = computed(() => {
115
159
  return {
116
- 'sh-poptip-confirm': this.confirm
160
+ 'sh-poptip-confirm': props.confirm
117
161
  }
118
- },
119
- popperClasses() {
162
+ })
163
+ const popperClasses = computed(() => {
120
164
  return {
121
165
  'sh-poptip-popper': true,
122
- 'sh-poptip-confirm': this.transfer && this.confirm,
123
- 'sh-poptip-transfer': this.transfer,
124
- [`${this.popperClass}`]: this.popperClass,
125
- [`${this.transferClassName}`]: this.transferClassName
166
+ 'sh-poptip-confirm': props.transfer && props.confirm,
167
+ 'sh-poptip-transfer': props.transfer,
168
+ [`${props.popperClass}`]: props.popperClass,
169
+ [`${props.transferClassName}`]: props.transferClassName
126
170
  }
127
- },
128
- styles() {
129
- let style = {}
130
- if (this.width) {
131
- style.width = `${this.width}px`
171
+ })
172
+ const styles = computed(() => {
173
+ let style = {
174
+ width: `${props.width}px`
132
175
  }
133
- if (this.transfer) style['z-index'] = 1060 + this.tIndex
176
+ if (props.transfer) style['z-index'] = 1060 + tIndex.value
134
177
  return style
135
- },
136
- contentClasses() {
178
+ })
179
+ const contentClasses = computed(() => {
137
180
  return {
138
181
  'sh-poptip-body-content': true,
139
- 'sh-poptip-body-content-word-wrap': this.wordWrap
182
+ 'sh-poptip-body-content-word-wrap': props.wordWrap
140
183
  }
141
- },
142
- contentPaddingStyle() {
143
- const styles = {}
144
- if (this.padding !== '') styles.padding = this.padding
145
- return styles
146
- }
147
- },
148
- mounted() {
149
- if (!this.confirm) {
150
- this.showTitle = this.$slots.title !== undefined || this.title
151
- }
152
- if (this.trigger === 'focus') {
153
- this.$nextTick(() => {
154
- const $children = this.getInputChildren()
155
- if ($children) {
156
- this.isInput = true
157
- $children.addEventListener('focus', this.handleFocus, false)
158
- $children.addEventListener('blur', this.handleBlur, false)
159
- }
160
- })
161
- }
162
- },
163
- beforeUnmount() {
164
- const $children = this.getInputChildren()
165
- if ($children) {
166
- $children.removeEventListener('focus', this.handleFocus, false)
167
- $children.removeEventListener('blur', this.handleBlur, false)
168
- }
169
- },
170
- methods: {
171
- handleClick() {
172
- if (this.disabled) return
173
- if (this.confirm) {
174
- this.visible = !this.visible
184
+ })
185
+ const titleStyle = computed(() => {
186
+ return {
187
+ padding: props.padding
188
+ }
189
+ })
190
+ const contentStyle = computed(() => {
191
+ return {
192
+ height: `${props.height}px`,
193
+ padding: props.padding
194
+ }
195
+ })
196
+
197
+ const handleClick = () => {
198
+ if (props.disabled) return
199
+ if (props.confirm) {
200
+ visible.value = !visible.value
175
201
  return true
176
202
  }
177
- if (this.trigger !== 'click') {
203
+ if (props.trigger !== 'click') {
178
204
  return false
179
205
  }
180
- this.visible = !this.visible
181
- },
182
- handleTransferClick() {
183
- if (this.transfer) this.disableCloseUnderTransfer = true
184
- },
185
- handleClose() {
186
- if (this.disableCloseUnderTransfer) {
187
- this.disableCloseUnderTransfer = false
206
+ visible.value = !visible.value
207
+ }
208
+ const handleTransferClick = () => {
209
+ if (props.transfer) disableCloseUnderTransfer.value = true
210
+ }
211
+ const handleClose = () => {
212
+ if (disableCloseUnderTransfer.value) {
213
+ disableCloseUnderTransfer.value = false
188
214
  return false
189
215
  }
190
- if (this.confirm) {
191
- this.visible = false
216
+ if (props.confirm) {
217
+ visible.value = false
192
218
  return true
193
219
  }
194
- if (this.trigger !== 'click') {
220
+ if (props.trigger !== 'click') {
195
221
  return false
196
222
  }
197
- this.visible = false
198
- },
199
- handleFocus(fromInput = true) {
200
- if (this.disabled) return
201
-
202
- if (this.trigger !== 'focus' || this.confirm || (this.isInput && !fromInput)) {
223
+ visible.value = false
224
+ }
225
+ const handleFocus = (fromInput = true) => {
226
+ if (props.disabled) return
227
+ if (props.trigger !== 'focus' || props.confirm || (isInput.value && !fromInput)) {
203
228
  return false
204
229
  }
205
- this.visible = true
206
- },
207
- handleBlur(fromInput = true) {
208
- if (this.trigger !== 'focus' || this.confirm || (this.isInput && !fromInput)) {
230
+ visible.value = true
231
+ }
232
+ const handleBlur = (fromInput = true) => {
233
+ if (props.trigger !== 'focus' || props.confirm || (isInput.value && !fromInput)) {
209
234
  return false
210
235
  }
211
- this.visible = false
212
- },
213
- handleMouseenter() {
214
- if (this.disabled) return
215
- if (this.trigger !== 'hover' || this.confirm) {
236
+ visible.value = false
237
+ }
238
+ const handleMouseenter = () => {
239
+ if (props.disabled) return
240
+ if (props.trigger !== 'hover' || props.confirm) {
216
241
  return false
217
242
  }
218
- if (this.enterTimer) clearTimeout(this.enterTimer)
219
- this.enterTimer = setTimeout(() => {
220
- this.visible = true
243
+ if (enterTimer) clearTimeout(enterTimer)
244
+ enterTimer = setTimeout(() => {
245
+ visible.value = true
221
246
  }, 100)
222
- },
223
- handleMouseleave() {
224
- if (this.trigger !== 'hover' || this.confirm) {
247
+ }
248
+ const handleMouseleave = () => {
249
+ if (props.trigger !== 'hover' || props.confirm) {
225
250
  return false
226
251
  }
227
- if (this.enterTimer) {
228
- clearTimeout(this.enterTimer)
229
- this.enterTimer = setTimeout(() => {
230
- this.visible = false
252
+ if (enterTimer) {
253
+ clearTimeout(enterTimer)
254
+ enterTimer = setTimeout(() => {
255
+ visible.value = false
231
256
  }, 100)
232
257
  }
233
- },
234
- cancel() {
235
- this.visible = false
236
- this.$emit('cancel')
237
- },
238
- ok() {
239
- this.visible = false
240
- this.$emit('confirm')
241
- },
242
- getInputChildren() {
243
- const $input = this.$refs.reference.querySelectorAll('input')
244
- const $textarea = this.$refs.reference.querySelectorAll('textarea')
258
+ }
259
+ const cancel = () => {
260
+ visible.value = false
261
+ emit('cancel')
262
+ }
263
+ const ok = () => {
264
+ visible.value = false
265
+ emit('confirm')
266
+ }
267
+ const getInputChildren = () => {
268
+ const $input = referenceRef.value.querySelectorAll('input')
269
+ const $textarea = referenceRef.value.querySelectorAll('textarea')
245
270
  let $children = null
246
271
  if ($input.length) {
247
272
  $children = $input[0]
@@ -249,16 +274,108 @@ export default {
249
274
  $children = $textarea[0]
250
275
  }
251
276
  return $children
252
- },
253
- handleGetIndex() {
254
- transferIncrease()
255
- return transferIndex
256
- },
257
- handleIndexIncrease() {
258
- this.tIndex = this.handleGetIndex()
277
+ }
278
+ const handleIndexIncrease = () => {
279
+ tIndex.value = handleGetIndex()
280
+ }
281
+ const createPopper = () => {
282
+ if (!/^(top|bottom|left|right)(-start|-end)?$/g.test(props.placement)) {
283
+ return
284
+ }
285
+ const options = props.options
286
+ const popper = props.popper || popperRef.value
287
+ const reference = referenceRef.value
288
+ if (!popper || !reference) return
289
+ if (popperJS && popperJS.hasOwnProperty('destroy')) {
290
+ popperJS.destroy()
291
+ }
292
+ options.eventsEnabled = props.eventsEnabled
293
+ options.placement = props.placement
294
+ if (!options.modifiers.offset) {
295
+ options.modifiers.offset = {}
296
+ }
297
+ options.modifiers.offset.offset = props.offset
298
+ options.onCreate = () => {
299
+ nextTick(updatePopper)
300
+ emit('created')
301
+ }
302
+ popperJS = new Popper(reference, popper, options)
303
+ }
304
+ const updatePopper = () => {
305
+ popperJS ? popperJS.update() : createPopper()
306
+ }
307
+ watch(
308
+ () => props.modelValue,
309
+ val => {
310
+ visible.value = val
311
+ emit('update:modelValue', val)
312
+ }
313
+ )
314
+ watch(
315
+ () => visible.value,
316
+ val => {
317
+ if (val) {
318
+ if (handleIndexIncrease) handleIndexIncrease() // just use for Poptip
319
+ updatePopper()
320
+ emit('popper-show')
321
+ } else {
322
+ emit('popper-hide')
323
+ }
324
+ emit('update:modelValue', val)
325
+ }
326
+ )
327
+ onMounted(() => {
328
+ if (!props.confirm) {
329
+ showTitle.value = slots.title !== undefined || props.title
330
+ }
331
+ if (props.trigger === 'focus') {
332
+ nextTick(() => {
333
+ const $children = getInputChildren()
334
+ if ($children) {
335
+ isInput.value = true
336
+ $children.addEventListener('focus', handleFocus, false)
337
+ $children.addEventListener('blur', handleBlur, false)
338
+ }
339
+ })
340
+ }
341
+ })
342
+ onUpdated(() => {
343
+ nextTick(() => updatePopper())
344
+ })
345
+ onBeforeUnmount(() => {
346
+ if (popperJS) {
347
+ popperJS.destroy()
348
+ }
349
+ const $children = getInputChildren()
350
+ if ($children) {
351
+ $children.removeEventListener('focus', handleFocus, false)
352
+ $children.removeEventListener('blur', handleBlur, false)
353
+ }
354
+ })
355
+
356
+ return {
357
+ referenceRef,
358
+ popperRef,
359
+ classes,
360
+ visible,
361
+ popperClasses,
362
+ styles,
363
+ titleStyle,
364
+ contentStyle,
365
+ contentClasses,
366
+ showTitle,
367
+ handleClose,
368
+ handleMouseenter,
369
+ handleMouseleave,
370
+ handleClick,
371
+ handleFocus,
372
+ handleBlur,
373
+ handleTransferClick,
374
+ cancel,
375
+ ok
259
376
  }
260
377
  }
261
- }
378
+ })
262
379
  </script>
263
380
 
264
381
  <style scoped lang="scss">
@@ -374,8 +491,8 @@ $poptip-arrow-color: hsla(0, 0%, 85%, 0.5);
374
491
  }
375
492
  &-body {
376
493
  padding: 8px 16px;
494
+ overflow: auto;
377
495
  &-content {
378
- overflow: auto;
379
496
  &-word-wrap {
380
497
  white-space: pre-wrap;
381
498
  text-align: justify;
@@ -458,10 +575,10 @@ $poptip-arrow-color: hsla(0, 0%, 85%, 0.5);
458
575
  }
459
576
  &-confirm &-body {
460
577
  padding: 12px 12px 8px;
461
- .ivu-icon {
578
+ .sh-icon {
462
579
  font-size: 16px;
463
580
  color: var(--vxe-warning-color);
464
- line-height: 18px;
581
+ line-height: 20px;
465
582
  position: absolute;
466
583
  }
467
584
 
@@ -18,9 +18,9 @@
18
18
  </span>
19
19
  </div>
20
20
  </template>
21
-
22
21
  <script>
23
- export default {
22
+ import { defineComponent, computed, onBeforeMount, getCurrentInstance, ref, watch } from 'vue'
23
+ export default defineComponent({
24
24
  name: 'ShProgress',
25
25
  props: {
26
26
  percent: {
@@ -56,94 +56,96 @@ export default {
56
56
  }
57
57
  },
58
58
  emits: ['status-change'],
59
- data() {
60
- return {
61
- currentStatus: this.status
62
- }
63
- },
64
- computed: {
65
- isStatus() {
66
- return this.currentStatus === 'wrong' || this.currentStatus === 'success'
67
- },
68
- statusIcon() {
69
- let type = ''
70
- switch (this.currentStatus) {
71
- case 'wrong':
72
- type = 'ios-close-circle'
73
- break
74
- case 'success':
75
- type = 'ios-checkmark-circle'
76
- break
59
+ setup(props, context) {
60
+ const { emit, slots } = context
61
+ const currentStatus = ref(props.status)
62
+
63
+ const isStatus = computed(() => {
64
+ return ['wrong', 'success'].includes(currentStatus.value)
65
+ })
66
+ const statusIcon = computed(() => {
67
+ if (currentStatus.value === 'wrong') {
68
+ return 'ios-close-circle'
69
+ } else if (currentStatus.value === 'ios-checkmark-circle') {
70
+ return 'ios-close-circle'
77
71
  }
78
- return type
79
- },
80
- bgStyle() {
81
- const style = this.vertical
72
+ return ''
73
+ })
74
+ const bgStyle = computed(() => {
75
+ const style = props.vertical
82
76
  ? {
83
- height: `${this.percent}%`,
84
- width: `${this.strokeWidth}px`
77
+ height: `${props.percent}%`,
78
+ width: `${props.strokeWidth}px`
85
79
  }
86
80
  : {
87
- width: `${this.percent}%`,
88
- height: `${this.strokeWidth}px`
81
+ width: `${props.percent}%`,
82
+ height: `${props.strokeWidth}px`
89
83
  }
90
- if (this.strokeColor) {
91
- if (typeof this.strokeColor === 'string') {
92
- style['background-color'] = this.strokeColor
84
+ if (props.strokeColor) {
85
+ if (typeof props.strokeColor === 'string') {
86
+ style['background-color'] = props.strokeColor
93
87
  } else {
94
- style['background-image'] = `linear-gradient(to right, ${this.strokeColor[0]} 0%, ${this.strokeColor[1]} 100%)`
88
+ style['background-image'] = `linear-gradient(to right, ${props.strokeColor[0]} 0%, ${props.strokeColor[1]} 100%)`
95
89
  }
96
90
  }
97
91
  return style
98
- },
99
- successBgStyle() {
100
- return this.vertical
92
+ })
93
+ const successBgStyle = computed(() => {
94
+ return props.vertical
101
95
  ? {
102
- height: `${this.successPercent}%`,
103
- width: `${this.strokeWidth}px`
96
+ height: `${props.successPercent}%`,
97
+ width: `${props.strokeWidth}px`
104
98
  }
105
99
  : {
106
- width: `${this.successPercent}%`,
107
- height: `${this.strokeWidth}px`
100
+ width: `${props.successPercent}%`,
101
+ height: `${props.strokeWidth}px`
108
102
  }
109
- },
110
- wrapClasses() {
103
+ })
104
+ const wrapClasses = computed(() => {
111
105
  return {
112
- [`${this.currentStatus}`]: true,
113
- [`show-info`]: !this.hideInfo && !this.textInside,
114
- [`vertical`]: this.vertical
115
- }
116
- }
117
- },
118
- watch: {
119
- percent(val, oldVal) {
120
- if (val < oldVal) {
121
- this.handleStatus(true)
122
- } else {
123
- this.handleStatus()
106
+ [`${currentStatus.value}`]: true,
107
+ [`show-info`]: !props.hideInfo && !props.textInside,
108
+ [`vertical`]: props.vertical
124
109
  }
125
- },
126
- status(val) {
127
- this.currentStatus = val
128
- }
129
- },
130
- created() {
131
- this.handleStatus()
132
- },
133
- methods: {
134
- handleStatus(isDown) {
110
+ })
111
+
112
+ const handleStatus = isDown => {
135
113
  if (isDown) {
136
- this.currentStatus = 'normal'
137
- this.$emit('status-change', 'normal')
114
+ currentStatus.value = 'normal'
115
+ emit('status-change', 'normal')
138
116
  } else {
139
- if (parseInt(this.percent, 10) === 100) {
140
- this.currentStatus = 'success'
141
- this.$emit('status-change', 'success')
117
+ if (parseInt(props.percent, 10) === 100) {
118
+ currentStatus.value = 'success'
119
+ emit('status-change', 'success')
142
120
  }
143
121
  }
144
122
  }
123
+
124
+ onBeforeMount(() => {
125
+ handleStatus()
126
+ })
127
+ watch(
128
+ () => props.percent,
129
+ (val, oldVal) => {
130
+ handleStatus(val < oldVal)
131
+ }
132
+ )
133
+ watch(
134
+ () => props.status,
135
+ val => {
136
+ currentStatus.value = val
137
+ }
138
+ )
139
+
140
+ return {
141
+ wrapClasses,
142
+ bgStyle,
143
+ successBgStyle,
144
+ isStatus,
145
+ statusIcon
146
+ }
145
147
  }
146
- }
148
+ })
147
149
  </script>
148
150
 
149
151
  <style scoped lang="scss">