vxe-pc-ui 4.6.4 → 4.6.6
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/button/src/button.js +83 -90
- package/es/button/style.css +24 -2
- package/es/button/style.min.css +1 -1
- package/es/color-picker/src/color-picker.js +19 -72
- package/es/color-picker/style.css +15 -0
- package/es/color-picker/style.min.css +1 -1
- package/es/date-picker/src/date-picker.js +19 -74
- package/es/date-picker/style.css +3 -2
- package/es/date-picker/style.min.css +1 -1
- package/es/date-range-picker/src/date-range-picker.js +24 -79
- package/es/date-range-picker/style.css +3 -2
- package/es/date-range-picker/style.min.css +1 -1
- package/es/icon/style.css +1 -1
- package/es/pulldown/src/pulldown.js +19 -74
- package/es/pulldown/style.css +0 -4
- package/es/pulldown/style.min.css +1 -1
- package/es/select/src/select.js +19 -72
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table-select/src/table-select.js +19 -72
- package/es/table-select/style.css +0 -1
- package/es/table-select/style.min.css +1 -1
- package/es/tree-select/src/tree-select.js +19 -72
- package/es/tree-select/style.css +0 -1
- package/es/tree-select/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/dom.js +92 -0
- package/es/ui/src/log.js +1 -1
- package/es/vxe-button/style.css +24 -2
- package/es/vxe-button/style.min.css +1 -1
- package/es/vxe-color-picker/style.css +15 -0
- package/es/vxe-color-picker/style.min.css +1 -1
- package/es/vxe-date-picker/style.css +3 -2
- package/es/vxe-date-picker/style.min.css +1 -1
- package/es/vxe-date-range-picker/style.css +3 -2
- package/es/vxe-date-range-picker/style.min.css +1 -1
- package/es/vxe-pulldown/style.css +0 -4
- package/es/vxe-pulldown/style.min.css +1 -1
- package/es/vxe-table-select/style.css +0 -1
- package/es/vxe-table-select/style.min.css +1 -1
- package/es/vxe-tree-select/style.css +0 -1
- package/es/vxe-tree-select/style.min.css +1 -1
- package/lib/button/src/button.js +88 -93
- package/lib/button/src/button.min.js +1 -1
- package/lib/button/style/style.css +24 -2
- package/lib/button/style/style.min.css +1 -1
- package/lib/color-picker/src/color-picker.js +22 -77
- package/lib/color-picker/src/color-picker.min.js +1 -1
- package/lib/color-picker/style/style.css +15 -0
- package/lib/color-picker/style/style.min.css +1 -1
- package/lib/date-picker/src/date-picker.js +22 -79
- package/lib/date-picker/src/date-picker.min.js +1 -1
- package/lib/date-picker/style/style.css +3 -2
- package/lib/date-picker/style/style.min.css +1 -1
- package/lib/date-range-picker/src/date-range-picker.js +26 -83
- package/lib/date-range-picker/src/date-range-picker.min.js +1 -1
- package/lib/date-range-picker/style/style.css +3 -2
- package/lib/date-range-picker/style/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 +344 -645
- package/lib/index.umd.min.js +1 -1
- package/lib/pulldown/src/pulldown.js +22 -80
- package/lib/pulldown/src/pulldown.min.js +1 -1
- package/lib/pulldown/style/style.css +0 -4
- package/lib/pulldown/style/style.min.css +1 -1
- package/lib/select/src/select.js +22 -77
- package/lib/select/src/select.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table-select/src/table-select.js +22 -77
- package/lib/table-select/src/table-select.min.js +1 -1
- package/lib/table-select/style/style.css +0 -1
- package/lib/table-select/style/style.min.css +1 -1
- package/lib/tree-select/src/tree-select.js +22 -77
- package/lib/tree-select/src/tree-select.min.js +1 -1
- package/lib/tree-select/style/style.css +0 -1
- package/lib/tree-select/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/dom.js +97 -0
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-button/style/style.css +24 -2
- package/lib/vxe-button/style/style.min.css +1 -1
- package/lib/vxe-color-picker/style/style.css +15 -0
- package/lib/vxe-color-picker/style/style.min.css +1 -1
- package/lib/vxe-date-picker/style/style.css +3 -2
- package/lib/vxe-date-picker/style/style.min.css +1 -1
- package/lib/vxe-date-range-picker/style/style.css +3 -2
- package/lib/vxe-date-range-picker/style/style.min.css +1 -1
- package/lib/vxe-pulldown/style/style.css +0 -4
- package/lib/vxe-pulldown/style/style.min.css +1 -1
- package/lib/vxe-table-select/style/style.css +0 -1
- package/lib/vxe-table-select/style/style.min.css +1 -1
- package/lib/vxe-tree-select/style/style.css +0 -1
- package/lib/vxe-tree-select/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/button/src/button.ts +87 -88
- package/packages/color-picker/src/color-picker.ts +19 -69
- package/packages/date-picker/src/date-picker.ts +20 -72
- package/packages/date-range-picker/src/date-range-picker.ts +24 -76
- package/packages/pulldown/src/pulldown.ts +20 -72
- package/packages/select/src/select.ts +19 -69
- package/packages/table-select/src/table-select.ts +19 -69
- package/packages/tree-select/src/tree-select.ts +19 -69
- package/packages/ui/src/dom.ts +95 -0
- package/styles/components/button.scss +3 -20
- package/styles/components/color-picker.scss +2 -27
- package/styles/components/date-picker.scss +2 -34
- package/styles/components/date-range-picker.scss +2 -34
- package/styles/components/pulldown.scss +2 -41
- package/styles/components/select.scss +2 -35
- package/styles/components/table-select.scss +2 -36
- package/styles/components/tree-select.scss +2 -36
- package/styles/helpers/placement.scss +39 -0
- package/types/components/button.d.ts +12 -1
- package/types/components/table.d.ts +56 -3
- /package/es/icon/{iconfont.1747024965925.ttf → iconfont.1747109497236.ttf} +0 -0
- /package/es/icon/{iconfont.1747024965925.woff → iconfont.1747109497236.woff} +0 -0
- /package/es/icon/{iconfont.1747024965925.woff2 → iconfont.1747109497236.woff2} +0 -0
- /package/es/{iconfont.1747024965925.ttf → iconfont.1747109497236.ttf} +0 -0
- /package/es/{iconfont.1747024965925.woff → iconfont.1747109497236.woff} +0 -0
- /package/es/{iconfont.1747024965925.woff2 → iconfont.1747109497236.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1747024965925.ttf → iconfont.1747109497236.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1747024965925.woff → iconfont.1747109497236.woff} +0 -0
- /package/lib/icon/style/{iconfont.1747024965925.woff2 → iconfont.1747109497236.woff2} +0 -0
- /package/lib/{iconfont.1747024965925.ttf → iconfont.1747109497236.ttf} +0 -0
- /package/lib/{iconfont.1747024965925.woff → iconfont.1747109497236.woff} +0 -0
- /package/lib/{iconfont.1747024965925.woff2 → iconfont.1747109497236.woff2} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, h, Teleport, ref, Ref, onUnmounted, reactive, inject, computed, nextTick, PropType, watch, createCommentVNode } from 'vue'
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
|
-
import { getConfig, globalEvents, createEvent, useSize,
|
|
4
|
-
import {
|
|
3
|
+
import { getConfig, globalEvents, createEvent, useSize, ValueOf } from '../../ui'
|
|
4
|
+
import { getEventTargetNode, updatePanelPlacement } from '../../ui/src/dom'
|
|
5
5
|
import { getLastZIndex, nextZIndex } from '../../ui/src/utils'
|
|
6
6
|
|
|
7
7
|
import type { VxePulldownConstructor, VxePulldownPropTypes, PulldownInternalData, VxePulldownEmits, PulldownReactData, PulldownMethods, PulldownPrivateRef, VxePulldownMethods, VxeDrawerConstructor, VxeDrawerMethods, VxeFormConstructor, VxeFormPrivateMethods, VxeModalConstructor, VxeModalMethods } from '../../../types'
|
|
@@ -115,76 +115,24 @@ export default defineComponent({
|
|
|
115
115
|
* 手动更新位置
|
|
116
116
|
*/
|
|
117
117
|
const updatePlacement = () => {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if (btnTransfer) {
|
|
137
|
-
let left = boundingLeft
|
|
138
|
-
let top = boundingTop + targetHeight
|
|
139
|
-
if (placement === 'top') {
|
|
140
|
-
panelPlacement = 'top'
|
|
141
|
-
top = boundingTop - panelHeight
|
|
142
|
-
} else if (!placement) {
|
|
143
|
-
// 如果下面不够放,则向上
|
|
144
|
-
if (top + panelHeight + marginSize > visibleHeight) {
|
|
145
|
-
panelPlacement = 'top'
|
|
146
|
-
top = boundingTop - panelHeight
|
|
147
|
-
}
|
|
148
|
-
// 如果上面不够放,则向下(优先)
|
|
149
|
-
if (top < marginSize) {
|
|
150
|
-
panelPlacement = 'bottom'
|
|
151
|
-
top = boundingTop + targetHeight
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
// 如果溢出右边
|
|
155
|
-
if (left + panelWidth + marginSize > visibleWidth) {
|
|
156
|
-
left -= left + panelWidth + marginSize - visibleWidth
|
|
157
|
-
}
|
|
158
|
-
// 如果溢出左边
|
|
159
|
-
if (left < marginSize) {
|
|
160
|
-
left = marginSize
|
|
161
|
-
}
|
|
162
|
-
Object.assign(panelStyle, {
|
|
163
|
-
left: `${left}px`,
|
|
164
|
-
top: `${top}px`,
|
|
165
|
-
minWidth: `${targetWidth}px`
|
|
166
|
-
})
|
|
167
|
-
} else {
|
|
168
|
-
if (placement === 'top') {
|
|
169
|
-
panelPlacement = 'top'
|
|
170
|
-
panelStyle.bottom = `${targetHeight}px`
|
|
171
|
-
} else if (!placement) {
|
|
172
|
-
// 如果下面不够放,则向上
|
|
173
|
-
if (boundingTop + targetHeight + panelHeight > visibleHeight) {
|
|
174
|
-
// 如果上面不够放,则向下(优先)
|
|
175
|
-
if (boundingTop - targetHeight - panelHeight > marginSize) {
|
|
176
|
-
panelPlacement = 'top'
|
|
177
|
-
panelStyle.bottom = `${targetHeight}px`
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
reactData.panelStyle = panelStyle
|
|
183
|
-
reactData.panelPlacement = panelPlacement
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
return nextTick()
|
|
187
|
-
})
|
|
118
|
+
const { placement } = props
|
|
119
|
+
const { panelIndex } = reactData
|
|
120
|
+
const targetElem = refPulldownContent.value
|
|
121
|
+
const panelElem = refPulldownPanel.value
|
|
122
|
+
const btnTransfer = computeBtnTransfer.value
|
|
123
|
+
const handleStyle = () => {
|
|
124
|
+
const ppObj = updatePanelPlacement(targetElem, panelElem, {
|
|
125
|
+
placement,
|
|
126
|
+
teleportTo: btnTransfer
|
|
127
|
+
})
|
|
128
|
+
const panelStyle: { [key: string]: string | number } = Object.assign(ppObj.style, {
|
|
129
|
+
zIndex: panelIndex
|
|
130
|
+
})
|
|
131
|
+
reactData.panelStyle = panelStyle
|
|
132
|
+
reactData.panelPlacement = ppObj.placement
|
|
133
|
+
}
|
|
134
|
+
handleStyle()
|
|
135
|
+
return nextTick().then(handleStyle)
|
|
188
136
|
}
|
|
189
137
|
|
|
190
138
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, h, Teleport, PropType, ref, Ref, inject, computed, provide, onUnmounted, reactive, nextTick, watch, onMounted } from 'vue'
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { getConfig, getIcon, getI18n, globalEvents, GLOBAL_EVENT_KEYS, createEvent, useSize, renderEmptyElement } from '../../ui'
|
|
4
|
-
import { getEventTargetNode,
|
|
4
|
+
import { getEventTargetNode, updatePanelPlacement } from '../../ui/src/dom'
|
|
5
5
|
import { getLastZIndex, nextZIndex, getFuncText } from '../../ui/src/utils'
|
|
6
6
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
7
7
|
import VxeInputComponent from '../../input/src/input'
|
|
@@ -412,74 +412,24 @@ export default defineComponent({
|
|
|
412
412
|
}
|
|
413
413
|
|
|
414
414
|
const updatePlacement = () => {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
let left = boundingLeft
|
|
434
|
-
let top = boundingTop + targetHeight
|
|
435
|
-
if (placement === 'top') {
|
|
436
|
-
panelPlacement = 'top'
|
|
437
|
-
top = boundingTop - panelHeight
|
|
438
|
-
} else if (!placement) {
|
|
439
|
-
// 如果下面不够放,则向上
|
|
440
|
-
if (top + panelHeight + marginSize > visibleHeight) {
|
|
441
|
-
panelPlacement = 'top'
|
|
442
|
-
top = boundingTop - panelHeight
|
|
443
|
-
}
|
|
444
|
-
// 如果上面不够放,则向下(优先)
|
|
445
|
-
if (top < marginSize) {
|
|
446
|
-
panelPlacement = 'bottom'
|
|
447
|
-
top = boundingTop + targetHeight
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
// 如果溢出右边
|
|
451
|
-
if (left + panelWidth + marginSize > visibleWidth) {
|
|
452
|
-
left -= left + panelWidth + marginSize - visibleWidth
|
|
453
|
-
}
|
|
454
|
-
// 如果溢出左边
|
|
455
|
-
if (left < marginSize) {
|
|
456
|
-
left = marginSize
|
|
457
|
-
}
|
|
458
|
-
Object.assign(panelStyle, {
|
|
459
|
-
left: `${left}px`,
|
|
460
|
-
top: `${top}px`,
|
|
461
|
-
minWidth: `${targetWidth}px`
|
|
462
|
-
})
|
|
463
|
-
} else {
|
|
464
|
-
if (placement === 'top') {
|
|
465
|
-
panelPlacement = 'top'
|
|
466
|
-
panelStyle.bottom = `${targetHeight}px`
|
|
467
|
-
} else if (!placement) {
|
|
468
|
-
// 如果下面不够放,则向上
|
|
469
|
-
if (boundingTop + targetHeight + panelHeight > visibleHeight) {
|
|
470
|
-
// 如果上面不够放,则向下(优先)
|
|
471
|
-
if (boundingTop - targetHeight - panelHeight > marginSize) {
|
|
472
|
-
panelPlacement = 'top'
|
|
473
|
-
panelStyle.bottom = `${targetHeight}px`
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
reactData.panelStyle = panelStyle
|
|
479
|
-
reactData.panelPlacement = panelPlacement
|
|
480
|
-
return nextTick()
|
|
481
|
-
}
|
|
482
|
-
})
|
|
415
|
+
const { placement } = props
|
|
416
|
+
const { panelIndex } = reactData
|
|
417
|
+
const targetElem = refElem.value
|
|
418
|
+
const panelElem = refOptionPanel.value
|
|
419
|
+
const btnTransfer = computeBtnTransfer.value
|
|
420
|
+
const handleStyle = () => {
|
|
421
|
+
const ppObj = updatePanelPlacement(targetElem, panelElem, {
|
|
422
|
+
placement,
|
|
423
|
+
teleportTo: btnTransfer
|
|
424
|
+
})
|
|
425
|
+
const panelStyle: { [key: string]: string | number } = Object.assign(ppObj.style, {
|
|
426
|
+
zIndex: panelIndex
|
|
427
|
+
})
|
|
428
|
+
reactData.panelStyle = panelStyle
|
|
429
|
+
reactData.panelPlacement = ppObj.placement
|
|
430
|
+
}
|
|
431
|
+
handleStyle()
|
|
432
|
+
return nextTick().then(handleStyle)
|
|
483
433
|
}
|
|
484
434
|
|
|
485
435
|
const showOptionPanel = () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, ref, h, PropType, computed, inject, watch, provide, nextTick, Teleport, onMounted, onUnmounted, reactive } from 'vue'
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { VxeUI, getConfig, getIcon, globalEvents, getI18n, createEvent, useSize, renderEmptyElement } from '../../ui'
|
|
4
|
-
import { getEventTargetNode,
|
|
4
|
+
import { getEventTargetNode, updatePanelPlacement, toCssUnit } from '../../ui/src/dom'
|
|
5
5
|
import { getOnName } from '../../ui/src/vn'
|
|
6
6
|
import { getLastZIndex, nextZIndex } from '../../ui/src/utils'
|
|
7
7
|
import { errLog } from '../../ui/src/log'
|
|
@@ -340,74 +340,24 @@ export default defineComponent({
|
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
const updatePlacement = () => {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
let left = boundingLeft
|
|
362
|
-
let top = boundingTop + targetHeight
|
|
363
|
-
if (placement === 'top') {
|
|
364
|
-
panelPlacement = 'top'
|
|
365
|
-
top = boundingTop - panelHeight
|
|
366
|
-
} else if (!placement) {
|
|
367
|
-
// 如果下面不够放,则向上
|
|
368
|
-
if (top + panelHeight + marginSize > visibleHeight) {
|
|
369
|
-
panelPlacement = 'top'
|
|
370
|
-
top = boundingTop - panelHeight
|
|
371
|
-
}
|
|
372
|
-
// 如果上面不够放,则向下(优先)
|
|
373
|
-
if (top < marginSize) {
|
|
374
|
-
panelPlacement = 'bottom'
|
|
375
|
-
top = boundingTop + targetHeight
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
// 如果溢出右边
|
|
379
|
-
if (left + panelWidth + marginSize > visibleWidth) {
|
|
380
|
-
left -= left + panelWidth + marginSize - visibleWidth
|
|
381
|
-
}
|
|
382
|
-
// 如果溢出左边
|
|
383
|
-
if (left < marginSize) {
|
|
384
|
-
left = marginSize
|
|
385
|
-
}
|
|
386
|
-
Object.assign(panelStyle, {
|
|
387
|
-
left: `${left}px`,
|
|
388
|
-
top: `${top}px`,
|
|
389
|
-
minWidth: `${targetWidth}px`
|
|
390
|
-
})
|
|
391
|
-
} else {
|
|
392
|
-
if (placement === 'top') {
|
|
393
|
-
panelPlacement = 'top'
|
|
394
|
-
panelStyle.bottom = `${targetHeight}px`
|
|
395
|
-
} else if (!placement) {
|
|
396
|
-
// 如果下面不够放,则向上
|
|
397
|
-
if (boundingTop + targetHeight + panelHeight > visibleHeight) {
|
|
398
|
-
// 如果上面不够放,则向下(优先)
|
|
399
|
-
if (boundingTop - targetHeight - panelHeight > marginSize) {
|
|
400
|
-
panelPlacement = 'top'
|
|
401
|
-
panelStyle.bottom = `${targetHeight}px`
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
reactData.panelStyle = panelStyle
|
|
407
|
-
reactData.panelPlacement = panelPlacement
|
|
408
|
-
return nextTick()
|
|
409
|
-
}
|
|
410
|
-
})
|
|
343
|
+
const { placement } = props
|
|
344
|
+
const { panelIndex } = reactData
|
|
345
|
+
const targetElem = refElem.value
|
|
346
|
+
const panelElem = refOptionPanel.value
|
|
347
|
+
const btnTransfer = computeBtnTransfer.value
|
|
348
|
+
const handleStyle = () => {
|
|
349
|
+
const ppObj = updatePanelPlacement(targetElem, panelElem, {
|
|
350
|
+
placement,
|
|
351
|
+
teleportTo: btnTransfer
|
|
352
|
+
})
|
|
353
|
+
const panelStyle: { [key: string]: string | number } = Object.assign(ppObj.style, {
|
|
354
|
+
zIndex: panelIndex
|
|
355
|
+
})
|
|
356
|
+
reactData.panelStyle = panelStyle
|
|
357
|
+
reactData.panelPlacement = ppObj.placement
|
|
358
|
+
}
|
|
359
|
+
handleStyle()
|
|
360
|
+
return nextTick().then(handleStyle)
|
|
411
361
|
}
|
|
412
362
|
|
|
413
363
|
const showOptionPanel = () => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, h, PropType, nextTick, inject, provide, reactive, Teleport, onMounted, onUnmounted, watch } from 'vue'
|
|
2
2
|
import { getConfig, getI18n, getIcon, globalEvents, createEvent, useSize, renderEmptyElement } from '../../ui'
|
|
3
|
-
import { getEventTargetNode,
|
|
3
|
+
import { getEventTargetNode, updatePanelPlacement, toCssUnit } from '../../ui/src/dom'
|
|
4
4
|
import { getLastZIndex, nextZIndex } from '../../ui/src/utils'
|
|
5
5
|
import { errLog } from '../../ui/src/log'
|
|
6
6
|
import XEUtils from 'xe-utils'
|
|
@@ -296,74 +296,24 @@ export default defineComponent({
|
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
const updatePlacement = () => {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
let left = boundingLeft
|
|
318
|
-
let top = boundingTop + targetHeight
|
|
319
|
-
if (placement === 'top') {
|
|
320
|
-
panelPlacement = 'top'
|
|
321
|
-
top = boundingTop - panelHeight
|
|
322
|
-
} else if (!placement) {
|
|
323
|
-
// 如果下面不够放,则向上
|
|
324
|
-
if (top + panelHeight + marginSize > visibleHeight) {
|
|
325
|
-
panelPlacement = 'top'
|
|
326
|
-
top = boundingTop - panelHeight
|
|
327
|
-
}
|
|
328
|
-
// 如果上面不够放,则向下(优先)
|
|
329
|
-
if (top < marginSize) {
|
|
330
|
-
panelPlacement = 'bottom'
|
|
331
|
-
top = boundingTop + targetHeight
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
// 如果溢出右边
|
|
335
|
-
if (left + panelWidth + marginSize > visibleWidth) {
|
|
336
|
-
left -= left + panelWidth + marginSize - visibleWidth
|
|
337
|
-
}
|
|
338
|
-
// 如果溢出左边
|
|
339
|
-
if (left < marginSize) {
|
|
340
|
-
left = marginSize
|
|
341
|
-
}
|
|
342
|
-
Object.assign(panelStyle, {
|
|
343
|
-
left: `${left}px`,
|
|
344
|
-
top: `${top}px`,
|
|
345
|
-
minWidth: `${targetWidth}px`
|
|
346
|
-
})
|
|
347
|
-
} else {
|
|
348
|
-
if (placement === 'top') {
|
|
349
|
-
panelPlacement = 'top'
|
|
350
|
-
panelStyle.bottom = `${targetHeight}px`
|
|
351
|
-
} else if (!placement) {
|
|
352
|
-
// 如果下面不够放,则向上
|
|
353
|
-
if (boundingTop + targetHeight + panelHeight > visibleHeight) {
|
|
354
|
-
// 如果上面不够放,则向下(优先)
|
|
355
|
-
if (boundingTop - targetHeight - panelHeight > marginSize) {
|
|
356
|
-
panelPlacement = 'top'
|
|
357
|
-
panelStyle.bottom = `${targetHeight}px`
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
reactData.panelStyle = panelStyle
|
|
363
|
-
reactData.panelPlacement = panelPlacement
|
|
364
|
-
return nextTick()
|
|
365
|
-
}
|
|
366
|
-
})
|
|
299
|
+
const { placement } = props
|
|
300
|
+
const { panelIndex } = reactData
|
|
301
|
+
const targetElem = refElem.value
|
|
302
|
+
const panelElem = refOptionPanel.value
|
|
303
|
+
const btnTransfer = computeBtnTransfer.value
|
|
304
|
+
const handleStyle = () => {
|
|
305
|
+
const ppObj = updatePanelPlacement(targetElem, panelElem, {
|
|
306
|
+
placement,
|
|
307
|
+
teleportTo: btnTransfer
|
|
308
|
+
})
|
|
309
|
+
const panelStyle: { [key: string]: string | number } = Object.assign(ppObj.style, {
|
|
310
|
+
zIndex: panelIndex
|
|
311
|
+
})
|
|
312
|
+
reactData.panelStyle = panelStyle
|
|
313
|
+
reactData.panelPlacement = ppObj.placement
|
|
314
|
+
}
|
|
315
|
+
handleStyle()
|
|
316
|
+
return nextTick().then(handleStyle)
|
|
367
317
|
}
|
|
368
318
|
|
|
369
319
|
const showOptionPanel = () => {
|
package/packages/ui/src/dom.ts
CHANGED
|
@@ -143,3 +143,98 @@ export function triggerEvent (targetElem: Element, type: string) {
|
|
|
143
143
|
export function isNodeElement (elem: any): elem is HTMLElement {
|
|
144
144
|
return elem && elem.nodeType === 1
|
|
145
145
|
}
|
|
146
|
+
|
|
147
|
+
export function updatePanelPlacement (targetElem: HTMLElement | null | undefined, panelElem: HTMLElement | null | undefined, options: {
|
|
148
|
+
placement?: '' | 'top' | 'bottom' | null
|
|
149
|
+
teleportTo?: boolean
|
|
150
|
+
marginSize?: number
|
|
151
|
+
}) {
|
|
152
|
+
const { placement, teleportTo, marginSize } = Object.assign({ teleportTo: false, marginSize: 5 }, options)
|
|
153
|
+
let panelPlacement: 'top' | 'bottom' = 'bottom'
|
|
154
|
+
let top: number | '' = ''
|
|
155
|
+
let bottom: number | '' = ''
|
|
156
|
+
let left: number | '' = ''
|
|
157
|
+
const right: number | '' = ''
|
|
158
|
+
let minWidth: number | '' = ''
|
|
159
|
+
const stys: Record<string, string> = {}
|
|
160
|
+
if (panelElem && targetElem) {
|
|
161
|
+
const documentElement = document.documentElement
|
|
162
|
+
const bodyElem = document.body
|
|
163
|
+
const targetHeight = targetElem.offsetHeight
|
|
164
|
+
const panelHeight = panelElem.offsetHeight
|
|
165
|
+
const panelWidth = panelElem.offsetWidth
|
|
166
|
+
|
|
167
|
+
const bounding = targetElem.getBoundingClientRect()
|
|
168
|
+
const boundingTop = bounding.top
|
|
169
|
+
const boundingLeft = bounding.left
|
|
170
|
+
const visibleHeight = documentElement.clientHeight || bodyElem.clientHeight
|
|
171
|
+
const visibleWidth = documentElement.clientWidth || bodyElem.clientWidth
|
|
172
|
+
minWidth = targetElem.offsetWidth
|
|
173
|
+
if (teleportTo) {
|
|
174
|
+
left = boundingLeft
|
|
175
|
+
top = boundingTop + targetHeight
|
|
176
|
+
if (placement === 'top') {
|
|
177
|
+
panelPlacement = 'top'
|
|
178
|
+
top = boundingTop - panelHeight
|
|
179
|
+
} else if (!placement) {
|
|
180
|
+
// 如果下面不够放,则向上
|
|
181
|
+
if (top + panelHeight + marginSize > visibleHeight) {
|
|
182
|
+
panelPlacement = 'top'
|
|
183
|
+
top = boundingTop - panelHeight
|
|
184
|
+
}
|
|
185
|
+
// 如果上面不够放,则向下(优先)
|
|
186
|
+
if (top < marginSize) {
|
|
187
|
+
panelPlacement = 'bottom'
|
|
188
|
+
top = boundingTop + targetHeight
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// 如果溢出右边
|
|
192
|
+
if (left + panelWidth + marginSize > visibleWidth) {
|
|
193
|
+
left -= left + panelWidth + marginSize - visibleWidth
|
|
194
|
+
}
|
|
195
|
+
// 如果溢出左边
|
|
196
|
+
if (left < marginSize) {
|
|
197
|
+
left = marginSize
|
|
198
|
+
}
|
|
199
|
+
} else {
|
|
200
|
+
if (placement === 'top') {
|
|
201
|
+
panelPlacement = 'top'
|
|
202
|
+
bottom = targetHeight
|
|
203
|
+
} else if (!placement) {
|
|
204
|
+
// 如果下面不够放,则向上
|
|
205
|
+
top = targetHeight
|
|
206
|
+
if (boundingTop + targetHeight + panelHeight > visibleHeight) {
|
|
207
|
+
// 如果上面不够放,则向下(优先)
|
|
208
|
+
if (boundingTop - targetHeight - panelHeight > marginSize) {
|
|
209
|
+
panelPlacement = 'top'
|
|
210
|
+
top = ''
|
|
211
|
+
bottom = targetHeight
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (XEUtils.isNumber(top)) {
|
|
217
|
+
stys.top = toCssUnit(top)
|
|
218
|
+
}
|
|
219
|
+
if (XEUtils.isNumber(bottom)) {
|
|
220
|
+
stys.bottom = toCssUnit(bottom)
|
|
221
|
+
}
|
|
222
|
+
if (XEUtils.isNumber(left)) {
|
|
223
|
+
stys.left = toCssUnit(left)
|
|
224
|
+
}
|
|
225
|
+
if (XEUtils.isNumber(right)) {
|
|
226
|
+
stys.right = toCssUnit(right)
|
|
227
|
+
}
|
|
228
|
+
if (XEUtils.isNumber(minWidth)) {
|
|
229
|
+
stys.minWidth = toCssUnit(minWidth)
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
top: top || 0,
|
|
234
|
+
bottom: bottom || 0,
|
|
235
|
+
left: left || 0,
|
|
236
|
+
right: right || 0,
|
|
237
|
+
style: stys,
|
|
238
|
+
placement: panelPlacement
|
|
239
|
+
}
|
|
240
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
@use "sass:map";
|
|
2
2
|
@use "sass:list";
|
|
3
3
|
@use '../helpers/baseMixin.scss';
|
|
4
|
+
@use '../helpers/placement.scss';
|
|
4
5
|
|
|
5
6
|
$btnThemeList: (
|
|
6
7
|
(
|
|
@@ -356,27 +357,9 @@ $btnThemeList: (
|
|
|
356
357
|
}
|
|
357
358
|
|
|
358
359
|
.vxe-button--dropdown-panel {
|
|
359
|
-
|
|
360
|
-
position: absolute;
|
|
361
|
-
right: 0;
|
|
362
|
-
padding: 4px 0;
|
|
363
|
-
&.ani--leave {
|
|
364
|
-
display: block;
|
|
365
|
-
opacity: 0;
|
|
366
|
-
transform: scaleY(0.5);
|
|
367
|
-
transition: transform .3s cubic-bezier(.23,1,.32,1), opacity .3s cubic-bezier(.23,1,.32,1);
|
|
368
|
-
transform-origin: center top;
|
|
369
|
-
backface-visibility: hidden;
|
|
370
|
-
transform-style: preserve-3d;
|
|
371
|
-
&[placement="top"] {
|
|
372
|
-
transform-origin: center bottom;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
&.ani--enter {
|
|
376
|
-
opacity: 1;
|
|
377
|
-
transform: scaleY(1);
|
|
378
|
-
}
|
|
360
|
+
@include placement.createPlacementPanel();
|
|
379
361
|
}
|
|
362
|
+
|
|
380
363
|
.vxe-button--dropdown-wrapper {
|
|
381
364
|
padding: 5px;
|
|
382
365
|
background-color: var(--vxe-ui-layout-background-color);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@use '../helpers/baseMixin.scss';
|
|
2
|
+
@use '../helpers/placement.scss';
|
|
2
3
|
|
|
3
4
|
.vxe-color-picker {
|
|
4
5
|
&.is--selected {
|
|
@@ -71,33 +72,7 @@
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
.vxe-color-picker--panel {
|
|
74
|
-
|
|
75
|
-
position: absolute;
|
|
76
|
-
left: 0;
|
|
77
|
-
padding: 4px 0;
|
|
78
|
-
color: var(--vxe-ui-font-color);
|
|
79
|
-
text-align: left;
|
|
80
|
-
&:not(.is--transfer) {
|
|
81
|
-
min-width: 100%;
|
|
82
|
-
}
|
|
83
|
-
&.is--transfer {
|
|
84
|
-
position: fixed;
|
|
85
|
-
}
|
|
86
|
-
&.ani--leave {
|
|
87
|
-
display: block;
|
|
88
|
-
opacity: 0;
|
|
89
|
-
transform: scaleY(0.5);
|
|
90
|
-
transition: transform .3s cubic-bezier(.23,1,.32,1), opacity .3s cubic-bezier(.23,1,.32,1);
|
|
91
|
-
transform-origin: center top;
|
|
92
|
-
backface-visibility: hidden;
|
|
93
|
-
&[placement="top"] {
|
|
94
|
-
transform-origin: center bottom;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
&.ani--enter {
|
|
98
|
-
opacity: 1;
|
|
99
|
-
transform: scaleY(1);
|
|
100
|
-
}
|
|
75
|
+
@include placement.createPlacementPanel();
|
|
101
76
|
}
|
|
102
77
|
|
|
103
78
|
.vxe-color-picker--color-wrapper {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@use "sass:list";
|
|
2
2
|
@use '../helpers/baseMixin.scss';
|
|
3
|
+
@use '../helpers/placement.scss';
|
|
3
4
|
|
|
4
5
|
.vxe-date-picker--readonly {
|
|
5
6
|
color: var(--vxe-ui-font-color);
|
|
@@ -106,40 +107,7 @@
|
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
.vxe-date-picker--panel {
|
|
109
|
-
|
|
110
|
-
position: absolute;
|
|
111
|
-
left: 0;
|
|
112
|
-
padding: 4px 0;
|
|
113
|
-
color: var(--vxe-ui-font-color);
|
|
114
|
-
font-size: var(--vxe-ui-font-size-default);
|
|
115
|
-
text-align: left;
|
|
116
|
-
&.is--transfer {
|
|
117
|
-
position: fixed;
|
|
118
|
-
}
|
|
119
|
-
&.ani--leave {
|
|
120
|
-
display: block;
|
|
121
|
-
opacity: 0;
|
|
122
|
-
transform: scaleY(0.5);
|
|
123
|
-
transition: transform .3s cubic-bezier(.23,1,.32,1), opacity .3s cubic-bezier(.23,1,.32,1);
|
|
124
|
-
transform-origin: center top;
|
|
125
|
-
backface-visibility: hidden;
|
|
126
|
-
transform-style: preserve-3d;
|
|
127
|
-
&[placement="top"] {
|
|
128
|
-
transform-origin: center bottom;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
&.ani--enter {
|
|
132
|
-
opacity: 1;
|
|
133
|
-
transform: scaleY(1);
|
|
134
|
-
& > div {
|
|
135
|
-
&::after {
|
|
136
|
-
display: none;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
& > div {
|
|
141
|
-
@include baseMixin.createEmptyMask();
|
|
142
|
-
}
|
|
110
|
+
@include placement.createPlacementPanel();
|
|
143
111
|
}
|
|
144
112
|
|
|
145
113
|
.vxe-date-picker--panel {
|