vxe-pc-ui 4.9.18 → 4.9.19
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/es/icon/style.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/text/src/text.js +10 -3
- package/es/tooltip/src/tooltip.js +81 -12
- package/es/tooltip/style.css +8 -5
- package/es/tooltip/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-tooltip/style.css +8 -5
- package/es/vxe-tooltip/style.min.css +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +102 -16
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/text/src/text.js +12 -3
- package/lib/text/src/text.min.js +1 -1
- package/lib/tooltip/src/tooltip.js +87 -11
- package/lib/tooltip/src/tooltip.min.js +1 -1
- package/lib/tooltip/style/style.css +8 -5
- package/lib/tooltip/style/style.min.css +1 -1
- package/lib/ui/index.js +1 -1
- 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/lib/vxe-tooltip/style/style.css +8 -5
- package/lib/vxe-tooltip/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/text/src/text.ts +11 -3
- package/packages/tooltip/src/tooltip.ts +90 -17
- package/styles/components/tooltip.scss +8 -5
- package/types/components/table.d.ts +10 -4
- package/types/components/tooltip.d.ts +12 -0
- /package/es/icon/{iconfont.1757160944209.ttf → iconfont.1757242939473.ttf} +0 -0
- /package/es/icon/{iconfont.1757160944209.woff → iconfont.1757242939473.woff} +0 -0
- /package/es/icon/{iconfont.1757160944209.woff2 → iconfont.1757242939473.woff2} +0 -0
- /package/es/{iconfont.1757160944209.ttf → iconfont.1757242939473.ttf} +0 -0
- /package/es/{iconfont.1757160944209.woff → iconfont.1757242939473.woff} +0 -0
- /package/es/{iconfont.1757160944209.woff2 → iconfont.1757242939473.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1757160944209.ttf → iconfont.1757242939473.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1757160944209.woff → iconfont.1757242939473.woff} +0 -0
- /package/lib/icon/style/{iconfont.1757160944209.woff2 → iconfont.1757242939473.woff2} +0 -0
- /package/lib/{iconfont.1757160944209.ttf → iconfont.1757242939473.ttf} +0 -0
- /package/lib/{iconfont.1757160944209.woff → iconfont.1757242939473.woff} +0 -0
- /package/lib/{iconfont.1757160944209.woff2 → iconfont.1757242939473.woff2} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { h, ref,
|
|
1
|
+
import { h, ref, nextTick, onBeforeUnmount, onMounted, computed, reactive, watch, PropType, VNode } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import XEUtils from 'xe-utils'
|
|
4
4
|
import { getConfig, createEvent, useSize } from '../../ui'
|
|
5
5
|
import { getLastZIndex, nextZIndex } from '../../ui/src/utils'
|
|
6
|
-
import { getAbsolutePos, getDomNode } from '../../ui/src/dom'
|
|
6
|
+
import { getAbsolutePos, getDomNode, toCssUnit } from '../../ui/src/dom'
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
8
8
|
|
|
9
|
-
import type { VxeTooltipPropTypes, VxeTooltipConstructor, VxeTooltipEmits, TooltipInternalData, TooltipReactData, TooltipMethods, TooltipPrivateRef } from '../../../types'
|
|
9
|
+
import type { VxeTooltipPropTypes, VxeTooltipConstructor, VxeTooltipEmits, TooltipInternalData, TooltipReactData, TooltipMethods, TooltipPrivateRef, VxeComponentStyleType } from '../../../types'
|
|
10
10
|
|
|
11
11
|
export default defineVxeComponent({
|
|
12
12
|
name: 'VxeTooltip',
|
|
@@ -32,6 +32,30 @@ export default defineVxeComponent({
|
|
|
32
32
|
useHTML: Boolean as PropType<VxeTooltipPropTypes.UseHTML>,
|
|
33
33
|
zIndex: [String, Number] as PropType<VxeTooltipPropTypes.ZIndex>,
|
|
34
34
|
popupClassName: [String, Function] as PropType<VxeTooltipPropTypes.PopupClassName>,
|
|
35
|
+
width: {
|
|
36
|
+
type: [String, Number] as PropType<VxeTooltipPropTypes.Width>,
|
|
37
|
+
default: () => getConfig().tooltip.Width
|
|
38
|
+
},
|
|
39
|
+
height: {
|
|
40
|
+
type: [String, Number] as PropType<VxeTooltipPropTypes.Height>,
|
|
41
|
+
default: () => getConfig().tooltip.height
|
|
42
|
+
},
|
|
43
|
+
minWidth: {
|
|
44
|
+
type: [String, Number] as PropType<VxeTooltipPropTypes.MinWidth>,
|
|
45
|
+
default: () => getConfig().tooltip.minWidth
|
|
46
|
+
},
|
|
47
|
+
minHeight: {
|
|
48
|
+
type: [String, Number] as PropType<VxeTooltipPropTypes.MinHeight>,
|
|
49
|
+
default: () => getConfig().tooltip.minHeight
|
|
50
|
+
},
|
|
51
|
+
maxWidth: {
|
|
52
|
+
type: [String, Number] as PropType<VxeTooltipPropTypes.MaxWidth>,
|
|
53
|
+
default: () => getConfig().tooltip.maxWidth
|
|
54
|
+
},
|
|
55
|
+
maxHeight: {
|
|
56
|
+
type: [String, Number] as PropType<VxeTooltipPropTypes.MaxHeight>,
|
|
57
|
+
default: () => getConfig().tooltip.maxHeight
|
|
58
|
+
},
|
|
35
59
|
isArrow: {
|
|
36
60
|
type: Boolean as PropType<VxeTooltipPropTypes.IsArrow>,
|
|
37
61
|
default: () => getConfig().tooltip.isArrow
|
|
@@ -77,7 +101,32 @@ export default defineVxeComponent({
|
|
|
77
101
|
const internalData: TooltipInternalData = {
|
|
78
102
|
}
|
|
79
103
|
|
|
80
|
-
const refElem = ref
|
|
104
|
+
const refElem = ref<HTMLDivElement>()
|
|
105
|
+
const contentWrapperfElem = ref<HTMLDivElement>()
|
|
106
|
+
|
|
107
|
+
const computeWrapperStyle = computed(() => {
|
|
108
|
+
const { width, height, minHeight, minWidth, maxHeight, maxWidth } = props
|
|
109
|
+
const stys: VxeComponentStyleType = {}
|
|
110
|
+
if (width) {
|
|
111
|
+
stys.width = toCssUnit(width)
|
|
112
|
+
}
|
|
113
|
+
if (height) {
|
|
114
|
+
stys.height = toCssUnit(height)
|
|
115
|
+
}
|
|
116
|
+
if (minWidth) {
|
|
117
|
+
stys.minWidth = toCssUnit(minWidth)
|
|
118
|
+
}
|
|
119
|
+
if (minHeight) {
|
|
120
|
+
stys.minHeight = toCssUnit(minHeight)
|
|
121
|
+
}
|
|
122
|
+
if (maxWidth) {
|
|
123
|
+
stys.maxWidth = toCssUnit(maxWidth)
|
|
124
|
+
}
|
|
125
|
+
if (maxHeight) {
|
|
126
|
+
stys.maxHeight = toCssUnit(maxHeight)
|
|
127
|
+
}
|
|
128
|
+
return stys
|
|
129
|
+
})
|
|
81
130
|
|
|
82
131
|
const refMaps: TooltipPrivateRef = {
|
|
83
132
|
refElem
|
|
@@ -100,6 +149,9 @@ export default defineVxeComponent({
|
|
|
100
149
|
const { scrollTop, scrollLeft, visibleWidth } = getDomNode()
|
|
101
150
|
const { top, left } = getAbsolutePos(tipTarget)
|
|
102
151
|
const el = refElem.value
|
|
152
|
+
if (!el) {
|
|
153
|
+
return
|
|
154
|
+
}
|
|
103
155
|
const marginSize = 6
|
|
104
156
|
const offsetHeight = el.offsetHeight
|
|
105
157
|
const offsetWidth = el.offsetWidth
|
|
@@ -276,29 +328,42 @@ export default defineVxeComponent({
|
|
|
276
328
|
}
|
|
277
329
|
}
|
|
278
330
|
|
|
331
|
+
const wheelEvent = (evnt: Event) => {
|
|
332
|
+
evnt.stopPropagation()
|
|
333
|
+
}
|
|
334
|
+
|
|
279
335
|
Object.assign($xeTooltip, tooltipMethods)
|
|
280
336
|
|
|
281
337
|
const renderContent = () => {
|
|
282
338
|
const { useHTML } = props
|
|
283
339
|
const { tipContent } = reactData
|
|
340
|
+
const wrapperStyle = computeWrapperStyle.value
|
|
284
341
|
const contentSlot = slots.content
|
|
342
|
+
const contVNs: VNode[] = []
|
|
285
343
|
if (contentSlot) {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
if (useHTML) {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
344
|
+
contVNs.push(
|
|
345
|
+
h('div', {
|
|
346
|
+
key: 1
|
|
347
|
+
}, getSlotVNs(contentSlot({})))
|
|
348
|
+
)
|
|
349
|
+
} else if (useHTML) {
|
|
350
|
+
contVNs.push(
|
|
351
|
+
h('div', {
|
|
352
|
+
key: 2,
|
|
353
|
+
innerHTML: tipContent
|
|
354
|
+
})
|
|
355
|
+
)
|
|
356
|
+
} else {
|
|
357
|
+
contVNs.push(h('span', {
|
|
358
|
+
key: 3
|
|
359
|
+
}, `${tipContent}`))
|
|
297
360
|
}
|
|
298
361
|
return h('div', {
|
|
299
362
|
key: 3,
|
|
300
|
-
|
|
301
|
-
|
|
363
|
+
ref: contentWrapperfElem,
|
|
364
|
+
class: 'vxe-tooltip--content',
|
|
365
|
+
style: wrapperStyle
|
|
366
|
+
}, contVNs)
|
|
302
367
|
}
|
|
303
368
|
|
|
304
369
|
const renderVN = () => {
|
|
@@ -355,6 +420,10 @@ export default defineVxeComponent({
|
|
|
355
420
|
})
|
|
356
421
|
|
|
357
422
|
onMounted(() => {
|
|
423
|
+
const contentWrapperfEl = contentWrapperfElem.value
|
|
424
|
+
if (contentWrapperfEl) {
|
|
425
|
+
contentWrapperfEl.addEventListener('wheel', wheelEvent, { passive: false })
|
|
426
|
+
}
|
|
358
427
|
nextTick(() => {
|
|
359
428
|
const { trigger, content } = props
|
|
360
429
|
const wrapperElem = refElem.value
|
|
@@ -397,6 +466,10 @@ export default defineVxeComponent({
|
|
|
397
466
|
target.onmouseleave = null
|
|
398
467
|
target.onclick = null
|
|
399
468
|
}
|
|
469
|
+
const contentWrapperfEl = contentWrapperfElem.value
|
|
470
|
+
if (contentWrapperfEl) {
|
|
471
|
+
contentWrapperfEl.removeEventListener('wheel', wheelEvent)
|
|
472
|
+
}
|
|
400
473
|
if (wrapperElem) {
|
|
401
474
|
const parentNode = wrapperElem.parentNode
|
|
402
475
|
if (parentNode) {
|
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
top: -100%;
|
|
5
5
|
left: -100%;
|
|
6
6
|
font-size: 12px;
|
|
7
|
-
max-width: 600px;
|
|
8
7
|
border-radius: var(--vxe-ui-base-border-radius);
|
|
9
|
-
padding: 8px 12px;
|
|
10
8
|
white-space: normal;
|
|
11
9
|
word-break: break-word;
|
|
12
10
|
box-shadow: 2px 2px 4px -2px rgba(0,0,0,.2);
|
|
@@ -16,7 +14,7 @@
|
|
|
16
14
|
pointer-events: none;
|
|
17
15
|
}
|
|
18
16
|
&.is--visible {
|
|
19
|
-
display: block;
|
|
17
|
+
display: inline-block;
|
|
20
18
|
}
|
|
21
19
|
&.is--arrow {
|
|
22
20
|
.vxe-tooltip--arrow {
|
|
@@ -34,7 +32,12 @@
|
|
|
34
32
|
}
|
|
35
33
|
}
|
|
36
34
|
.vxe-tooltip--content {
|
|
35
|
+
padding: 8px 12px;
|
|
36
|
+
max-width: 600px;
|
|
37
|
+
max-height: 800px;
|
|
37
38
|
white-space: pre-line;
|
|
39
|
+
border-radius: var(--vxe-ui-base-border-radius);
|
|
40
|
+
overflow: auto;
|
|
38
41
|
}
|
|
39
42
|
.vxe-tooltip--arrow {
|
|
40
43
|
display: none;
|
|
@@ -73,9 +76,9 @@
|
|
|
73
76
|
}
|
|
74
77
|
}
|
|
75
78
|
.vxe-tooltip--arrow {
|
|
76
|
-
top: -
|
|
79
|
+
top: -11px;
|
|
77
80
|
&:before {
|
|
78
|
-
top: -
|
|
81
|
+
top: -3px;
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
84
|
}
|
|
@@ -1363,10 +1363,16 @@ export namespace VxeTablePropTypes {
|
|
|
1363
1363
|
*/
|
|
1364
1364
|
export interface TooltipConfig<D = VxeTablePropTypes.Row> {
|
|
1365
1365
|
showAll?: boolean
|
|
1366
|
-
theme?:
|
|
1367
|
-
enterable?:
|
|
1368
|
-
enterDelay?:
|
|
1369
|
-
leaveDelay?:
|
|
1366
|
+
theme?: VxeTooltipPropTypes.Theme
|
|
1367
|
+
enterable?: VxeTooltipPropTypes.Enterable
|
|
1368
|
+
enterDelay?: VxeTooltipPropTypes.EnterDelay
|
|
1369
|
+
leaveDelay?: VxeTooltipPropTypes.LeaveDelay
|
|
1370
|
+
width?: VxeTooltipPropTypes.Width
|
|
1371
|
+
height?: VxeTooltipPropTypes.Height
|
|
1372
|
+
minWidth?: VxeTooltipPropTypes.MinWidth
|
|
1373
|
+
minHeight?: VxeTooltipPropTypes.MinHeight
|
|
1374
|
+
maxWidth?: VxeTooltipPropTypes.MaxWidth
|
|
1375
|
+
maxHeight?: VxeTooltipPropTypes.MaxHeight
|
|
1370
1376
|
contentMethod?(params: {
|
|
1371
1377
|
$table: VxeTableConstructor<D>
|
|
1372
1378
|
items: any[]
|
|
@@ -33,6 +33,12 @@ export namespace VxeTooltipPropTypes {
|
|
|
33
33
|
export type UseHTML = boolean
|
|
34
34
|
export type ZIndex = string | number
|
|
35
35
|
export type PopupClassName = string | ((params: { $tooltip: VxeTooltipConstructor }) => string)
|
|
36
|
+
export type Width = string | number
|
|
37
|
+
export type Height = string | number
|
|
38
|
+
export type MinWidth = string | number
|
|
39
|
+
export type MinHeight = string | number
|
|
40
|
+
export type MaxWidth = string | number
|
|
41
|
+
export type MaxHeight = string | number
|
|
36
42
|
export type IsArrow = boolean
|
|
37
43
|
export type Enterable = boolean
|
|
38
44
|
export type EnterDelay = number
|
|
@@ -49,6 +55,12 @@ export interface VxeTooltipProps {
|
|
|
49
55
|
content?: VxeTooltipPropTypes.Content
|
|
50
56
|
useHTML?: VxeTooltipPropTypes.UseHTML
|
|
51
57
|
popupClassName?: VxeTooltipPropTypes.PopupClassName
|
|
58
|
+
Width?: VxeTooltipPropTypes.Width
|
|
59
|
+
height?: VxeTooltipPropTypes.Height
|
|
60
|
+
minWidth?: VxeTooltipPropTypes.MinWidth
|
|
61
|
+
minHeight?: VxeTooltipPropTypes.MinHeight
|
|
62
|
+
maxWidth?: VxeTooltipPropTypes.MaxWidth
|
|
63
|
+
maxHeight?: VxeTooltipPropTypes.MaxHeight
|
|
52
64
|
zIndex?: VxeTooltipPropTypes.ZIndex
|
|
53
65
|
isArrow?: VxeTooltipPropTypes.IsArrow
|
|
54
66
|
enterable?: VxeTooltipPropTypes.Enterable
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|