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,15 +1,15 @@
|
|
|
1
1
|
import { defineComponent, h, ref, computed, Teleport, resolveComponent, VNode, onUnmounted, reactive, nextTick, PropType, onMounted, inject, createCommentVNode } from 'vue'
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
|
-
import { getConfig, globalEvents, getIcon, createEvent, useSize, usePermission } from '../../ui'
|
|
4
|
-
import {
|
|
3
|
+
import { getConfig, globalEvents, getIcon, createEvent, useSize, usePermission, permission } from '../../ui'
|
|
4
|
+
import { getEventTargetNode, updatePanelPlacement } from '../../ui/src/dom'
|
|
5
5
|
import { getFuncText, getLastZIndex, nextZIndex } from '../../ui/src/utils'
|
|
6
6
|
import { warnLog } from '../../ui/src/log'
|
|
7
7
|
import VxeTooltipComponent from '../../tooltip/src/tooltip'
|
|
8
8
|
|
|
9
|
-
import type { VxeButtonConstructor, VxeButtonPropTypes, VxeButtonEmits, ButtonReactData, ButtonMethods, ButtonPrivateRef, ButtonInternalData, VxeButtonGroupConstructor, VxeButtonGroupPrivateMethods, VxeDrawerConstructor, VxeDrawerMethods, VxeFormConstructor, VxeFormPrivateMethods, VxeModalConstructor, VxeModalMethods, ValueOf } from '../../../types'
|
|
9
|
+
import type { VxeButtonConstructor, VxeButtonPropTypes, VxeButtonEmits, ButtonReactData, ButtonMethods, VxeButtonDefines, ButtonPrivateRef, ButtonInternalData, VxeButtonGroupConstructor, VxeButtonGroupPrivateMethods, VxeDrawerConstructor, VxeDrawerMethods, VxeFormConstructor, VxeFormPrivateMethods, VxeModalConstructor, VxeModalMethods, ValueOf } from '../../../types'
|
|
10
10
|
import type { VxeTableConstructor, VxeTablePrivateMethods } from '../../../types/components/table'
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
const VxeButtonComponent = defineComponent({
|
|
13
13
|
name: 'VxeButton',
|
|
14
14
|
props: {
|
|
15
15
|
/**
|
|
@@ -78,6 +78,7 @@ export default defineComponent({
|
|
|
78
78
|
align: String as PropType<VxeButtonPropTypes.Align>,
|
|
79
79
|
prefixTooltip: Object as PropType<VxeButtonPropTypes.PrefixTooltip>,
|
|
80
80
|
suffixTooltip: Object as PropType<VxeButtonPropTypes.SuffixTooltip>,
|
|
81
|
+
options: Array as PropType<VxeButtonPropTypes.Options>,
|
|
81
82
|
/**
|
|
82
83
|
* 在下拉面板关闭时销毁内容
|
|
83
84
|
*/
|
|
@@ -228,6 +229,17 @@ export default defineComponent({
|
|
|
228
229
|
return false
|
|
229
230
|
})
|
|
230
231
|
|
|
232
|
+
const computeDownBtnList = computed(() => {
|
|
233
|
+
const { options } = props
|
|
234
|
+
if (options) {
|
|
235
|
+
return options.filter(item => {
|
|
236
|
+
const { permissionCode } = item
|
|
237
|
+
return !permissionCode || permission.checkVisible(permissionCode)
|
|
238
|
+
})
|
|
239
|
+
}
|
|
240
|
+
return []
|
|
241
|
+
})
|
|
242
|
+
|
|
231
243
|
const computePrefixTipOpts = computed(() => {
|
|
232
244
|
return Object.assign({}, props.prefixTooltip)
|
|
233
245
|
})
|
|
@@ -243,75 +255,24 @@ export default defineComponent({
|
|
|
243
255
|
}
|
|
244
256
|
|
|
245
257
|
const updatePlacement = () => {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
let btnLeft = left + targetWidth - panelWidth
|
|
265
|
-
let btnTop = top + targetHeight
|
|
266
|
-
if (placement === 'top') {
|
|
267
|
-
panelPlacement = 'top'
|
|
268
|
-
btnTop = top - panelHeight
|
|
269
|
-
} else if (!placement) {
|
|
270
|
-
// 如果下面不够放,则向上
|
|
271
|
-
if (boundingTop + targetHeight + panelHeight + marginSize > visibleHeight) {
|
|
272
|
-
panelPlacement = 'top'
|
|
273
|
-
btnTop = top - panelHeight
|
|
274
|
-
}
|
|
275
|
-
// 如果上面不够放,则向下(优先)
|
|
276
|
-
if (btnTop < marginSize) {
|
|
277
|
-
panelPlacement = 'bottom'
|
|
278
|
-
btnTop = top + targetHeight
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
// 如果溢出右边
|
|
282
|
-
if (btnLeft + panelWidth + marginSize > visibleWidth) {
|
|
283
|
-
btnLeft -= btnLeft + panelWidth + marginSize - visibleWidth
|
|
284
|
-
}
|
|
285
|
-
// 如果溢出左边
|
|
286
|
-
if (btnLeft < marginSize) {
|
|
287
|
-
btnLeft = marginSize
|
|
288
|
-
}
|
|
289
|
-
Object.assign(panelStyle, {
|
|
290
|
-
left: `${btnLeft}px`,
|
|
291
|
-
right: 'auto',
|
|
292
|
-
top: `${btnTop}px`,
|
|
293
|
-
minWidth: `${targetWidth}px`
|
|
294
|
-
})
|
|
295
|
-
} else {
|
|
296
|
-
if (placement === 'top') {
|
|
297
|
-
panelPlacement = 'top'
|
|
298
|
-
panelStyle.bottom = `${targetHeight}px`
|
|
299
|
-
} else if (!placement) {
|
|
300
|
-
// 如果下面不够放,则向上
|
|
301
|
-
if (boundingTop + targetHeight + panelHeight > visibleHeight) {
|
|
302
|
-
// 如果上面不够放,则向下(优先)
|
|
303
|
-
if (boundingTop - targetHeight - panelHeight > marginSize) {
|
|
304
|
-
panelPlacement = 'top'
|
|
305
|
-
panelStyle.bottom = `${targetHeight}px`
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
reactData.panelStyle = panelStyle
|
|
311
|
-
reactData.panelPlacement = panelPlacement
|
|
312
|
-
return nextTick()
|
|
313
|
-
}
|
|
314
|
-
})
|
|
258
|
+
const { placement } = props
|
|
259
|
+
const { panelIndex } = reactData
|
|
260
|
+
const targetElem = refButton.value
|
|
261
|
+
const panelElem = refBtnPanel.value
|
|
262
|
+
const btnTransfer = computeBtnTransfer.value
|
|
263
|
+
const handleStyle = () => {
|
|
264
|
+
const ppObj = updatePanelPlacement(targetElem, panelElem, {
|
|
265
|
+
placement,
|
|
266
|
+
teleportTo: btnTransfer
|
|
267
|
+
})
|
|
268
|
+
const panelStyle: { [key: string]: string | number } = Object.assign(ppObj.style, {
|
|
269
|
+
zIndex: panelIndex
|
|
270
|
+
})
|
|
271
|
+
reactData.panelStyle = panelStyle
|
|
272
|
+
reactData.panelPlacement = ppObj.placement
|
|
273
|
+
}
|
|
274
|
+
handleStyle()
|
|
275
|
+
return nextTick().then(handleStyle)
|
|
315
276
|
}
|
|
316
277
|
|
|
317
278
|
const clickEvent = (evnt: Event) => {
|
|
@@ -321,6 +282,12 @@ export default defineComponent({
|
|
|
321
282
|
dispatchEvent('click', { $event: evnt }, evnt)
|
|
322
283
|
}
|
|
323
284
|
|
|
285
|
+
const downBtnClickEvent = (params: VxeButtonDefines.ClickEventParams, option: VxeButtonDefines.DownButtonOption) => {
|
|
286
|
+
const { $event } = params
|
|
287
|
+
hidePanel()
|
|
288
|
+
dispatchEvent('dropdown-click', { name: option.name, option }, $event)
|
|
289
|
+
}
|
|
290
|
+
|
|
324
291
|
const mousedownDropdownEvent = (evnt: MouseEvent) => {
|
|
325
292
|
const isLeftBtn = evnt.button === 0
|
|
326
293
|
if (isLeftBtn) {
|
|
@@ -342,7 +309,7 @@ export default defineComponent({
|
|
|
342
309
|
reactData.isAniVisible = false
|
|
343
310
|
}
|
|
344
311
|
}, 350)
|
|
345
|
-
dispatchEvent('dropdown-click', { name: targetElem.getAttribute('name'),
|
|
312
|
+
dispatchEvent('dropdown-click', { name: targetElem.getAttribute('name'), option: null }, evnt)
|
|
346
313
|
}
|
|
347
314
|
}
|
|
348
315
|
|
|
@@ -376,7 +343,7 @@ export default defineComponent({
|
|
|
376
343
|
}
|
|
377
344
|
|
|
378
345
|
const mouseleaveTargetEvent = (evnt: MouseEvent) => {
|
|
379
|
-
|
|
346
|
+
hidePanel()
|
|
380
347
|
mouseleaveEvent(evnt)
|
|
381
348
|
}
|
|
382
349
|
|
|
@@ -394,7 +361,7 @@ export default defineComponent({
|
|
|
394
361
|
if (!(btnDisabled || loading)) {
|
|
395
362
|
if (trigger === 'click') {
|
|
396
363
|
if (reactData.visiblePanel) {
|
|
397
|
-
|
|
364
|
+
hidePanel()
|
|
398
365
|
} else {
|
|
399
366
|
openPanel()
|
|
400
367
|
}
|
|
@@ -422,7 +389,7 @@ export default defineComponent({
|
|
|
422
389
|
return nextTick()
|
|
423
390
|
}
|
|
424
391
|
|
|
425
|
-
const
|
|
392
|
+
const hidePanel = () => {
|
|
426
393
|
const panelElem = refBtnPanel.value
|
|
427
394
|
clearTimeout(internalData.showTime)
|
|
428
395
|
if (panelElem) {
|
|
@@ -445,7 +412,7 @@ export default defineComponent({
|
|
|
445
412
|
}
|
|
446
413
|
|
|
447
414
|
const mouseleaveDropdownEvent = () => {
|
|
448
|
-
|
|
415
|
+
hidePanel()
|
|
449
416
|
}
|
|
450
417
|
|
|
451
418
|
const renderTooltipIcon = (tipOpts: VxeButtonPropTypes.PrefixTooltip | VxeButtonPropTypes.SuffixTooltip, type: 'prefix' | 'suffix') => {
|
|
@@ -522,7 +489,7 @@ export default defineComponent({
|
|
|
522
489
|
buttonMethods = {
|
|
523
490
|
dispatchEvent,
|
|
524
491
|
openPanel,
|
|
525
|
-
closePanel,
|
|
492
|
+
closePanel: hidePanel,
|
|
526
493
|
focus () {
|
|
527
494
|
const btnElem = refButton.value
|
|
528
495
|
if (btnElem) {
|
|
@@ -542,7 +509,7 @@ export default defineComponent({
|
|
|
542
509
|
const handleGlobalMousewheelEvent = (evnt: Event) => {
|
|
543
510
|
const panelElem = refBtnPanel.value
|
|
544
511
|
if (reactData.visiblePanel && !getEventTargetNode(evnt, panelElem).flag) {
|
|
545
|
-
|
|
512
|
+
hidePanel()
|
|
546
513
|
}
|
|
547
514
|
}
|
|
548
515
|
|
|
@@ -554,7 +521,7 @@ export default defineComponent({
|
|
|
554
521
|
const panelElem = refBtnPanel.value
|
|
555
522
|
reactData.isActivated = getEventTargetNode(evnt, el).flag || getEventTargetNode(evnt, panelElem).flag
|
|
556
523
|
if (visiblePanel && !reactData.isActivated) {
|
|
557
|
-
|
|
524
|
+
hidePanel()
|
|
558
525
|
}
|
|
559
526
|
}
|
|
560
527
|
}
|
|
@@ -573,13 +540,14 @@ export default defineComponent({
|
|
|
573
540
|
const btnTransfer = computeBtnTransfer.value
|
|
574
541
|
const btnDisabled = computeBtnDisabled.value
|
|
575
542
|
const permissionInfo = computePermissionInfo.value
|
|
543
|
+
const downBtnList = computeDownBtnList.value
|
|
576
544
|
const vSize = computeSize.value
|
|
577
|
-
const
|
|
545
|
+
const dropdownsSlot = slots.dropdowns
|
|
578
546
|
|
|
579
547
|
if (!permissionInfo.visible) {
|
|
580
548
|
return createCommentVNode()
|
|
581
549
|
}
|
|
582
|
-
if (
|
|
550
|
+
if (dropdownsSlot || downBtnList.length) {
|
|
583
551
|
const btnOns: Record<string, any> = {}
|
|
584
552
|
const panelOns: Record<string, any> = {}
|
|
585
553
|
if (trigger === 'hover') {
|
|
@@ -653,6 +621,7 @@ export default defineComponent({
|
|
|
653
621
|
ref: refBtnPanel,
|
|
654
622
|
class: ['vxe-button--dropdown-panel', popupClassName ? (XEUtils.isFunction(popupClassName) ? popupClassName({ $button: $xeButton }) : popupClassName) : '', {
|
|
655
623
|
[`size--${vSize}`]: vSize,
|
|
624
|
+
'is--transfer': btnTransfer,
|
|
656
625
|
'ani--leave': isAniVisible,
|
|
657
626
|
'ani--enter': visiblePanel
|
|
658
627
|
}],
|
|
@@ -661,11 +630,39 @@ export default defineComponent({
|
|
|
661
630
|
...panelOns
|
|
662
631
|
}, initialized && (visiblePanel || isAniVisible)
|
|
663
632
|
? [
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
633
|
+
dropdownsSlot
|
|
634
|
+
? h('div', {
|
|
635
|
+
class: 'vxe-button--dropdown-wrapper',
|
|
636
|
+
onMousedown: mousedownDropdownEvent,
|
|
637
|
+
onClick: clickDropdownEvent
|
|
638
|
+
}, initialized && (destroyOnClose ? (visiblePanel || isAniVisible) : true) ? dropdownsSlot({}) : [])
|
|
639
|
+
: h('div', {
|
|
640
|
+
class: 'vxe-button--dropdown-wrapper'
|
|
641
|
+
}, initialized && (destroyOnClose ? (visiblePanel || isAniVisible) : true)
|
|
642
|
+
? downBtnList.map((option, i) => {
|
|
643
|
+
return h(VxeButtonComponent, {
|
|
644
|
+
key: i,
|
|
645
|
+
type: option.type,
|
|
646
|
+
mode: option.mode || btnMode,
|
|
647
|
+
className: option.className,
|
|
648
|
+
name: option.name,
|
|
649
|
+
routerLink: option.routerLink,
|
|
650
|
+
permissionCode: option.permissionCode,
|
|
651
|
+
title: option.title,
|
|
652
|
+
content: option.content,
|
|
653
|
+
status: option.status,
|
|
654
|
+
icon: option.icon,
|
|
655
|
+
round: XEUtils.isBoolean(option.round) ? option.round : (btnMode === 'text' ? false : btnRound),
|
|
656
|
+
circle: XEUtils.isBoolean(option.circle) ? option.circle : (btnMode === 'text' ? false : btnCircle),
|
|
657
|
+
disabled: option.disabled,
|
|
658
|
+
loading: option.loading,
|
|
659
|
+
align: option.align,
|
|
660
|
+
onClick (params: VxeButtonDefines.ClickEventParams) {
|
|
661
|
+
downBtnClickEvent(params, option)
|
|
662
|
+
}
|
|
663
|
+
})
|
|
664
|
+
})
|
|
665
|
+
: [])
|
|
669
666
|
]
|
|
670
667
|
: [])
|
|
671
668
|
])
|
|
@@ -740,3 +737,5 @@ export default defineComponent({
|
|
|
740
737
|
return this.renderVN()
|
|
741
738
|
}
|
|
742
739
|
})
|
|
740
|
+
|
|
741
|
+
export default VxeButtonComponent
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineComponent, watch, computed, provide, ref, inject, Teleport, h, nextTick, PropType, reactive, onMounted, onUnmounted } from 'vue'
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { VxeUI, getIcon, getConfig, getI18n, globalEvents, createEvent, useSize, renderEmptyElement } from '../../ui'
|
|
4
|
-
import { getEventTargetNode,
|
|
4
|
+
import { getEventTargetNode, toCssUnit, updatePanelPlacement } from '../../ui/src/dom'
|
|
5
5
|
import { getLastZIndex, nextZIndex } from '../../ui/src/utils'
|
|
6
6
|
import { parseColor, updateColorAlpha, hexToHsv, rgbToHsv, rgbToHex, hexToRgb, hsvToRgb, toRgb } from './util'
|
|
7
7
|
import VxeButtonComponent from '../../button/src/button'
|
|
@@ -268,74 +268,24 @@ export default defineComponent({
|
|
|
268
268
|
}
|
|
269
269
|
|
|
270
270
|
const updatePlacement = () => {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
let left = boundingLeft
|
|
290
|
-
let top = boundingTop + targetHeight
|
|
291
|
-
if (placement === 'top') {
|
|
292
|
-
panelPlacement = 'top'
|
|
293
|
-
top = boundingTop - panelHeight
|
|
294
|
-
} else if (!placement) {
|
|
295
|
-
// 如果下面不够放,则向上
|
|
296
|
-
if (top + panelHeight + marginSize > visibleHeight) {
|
|
297
|
-
panelPlacement = 'top'
|
|
298
|
-
top = boundingTop - panelHeight
|
|
299
|
-
}
|
|
300
|
-
// 如果上面不够放,则向下(优先)
|
|
301
|
-
if (top < marginSize) {
|
|
302
|
-
panelPlacement = 'bottom'
|
|
303
|
-
top = boundingTop + targetHeight
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
// 如果溢出右边
|
|
307
|
-
if (left + panelWidth + marginSize > visibleWidth) {
|
|
308
|
-
left -= left + panelWidth + marginSize - visibleWidth
|
|
309
|
-
}
|
|
310
|
-
// 如果溢出左边
|
|
311
|
-
if (left < marginSize) {
|
|
312
|
-
left = marginSize
|
|
313
|
-
}
|
|
314
|
-
Object.assign(panelStyle, {
|
|
315
|
-
left: `${left}px`,
|
|
316
|
-
top: `${top}px`,
|
|
317
|
-
minWidth: `${targetWidth}px`
|
|
318
|
-
})
|
|
319
|
-
} else {
|
|
320
|
-
if (placement === 'top') {
|
|
321
|
-
panelPlacement = 'top'
|
|
322
|
-
panelStyle.bottom = `${targetHeight}px`
|
|
323
|
-
} else if (!placement) {
|
|
324
|
-
// 如果下面不够放,则向上
|
|
325
|
-
if (boundingTop + targetHeight + panelHeight > visibleHeight) {
|
|
326
|
-
// 如果上面不够放,则向下(优先)
|
|
327
|
-
if (boundingTop - targetHeight - panelHeight > marginSize) {
|
|
328
|
-
panelPlacement = 'top'
|
|
329
|
-
panelStyle.bottom = `${targetHeight}px`
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
reactData.panelStyle = panelStyle
|
|
335
|
-
reactData.panelPlacement = panelPlacement
|
|
336
|
-
return nextTick()
|
|
337
|
-
}
|
|
338
|
-
})
|
|
271
|
+
const { placement } = props
|
|
272
|
+
const { panelIndex } = reactData
|
|
273
|
+
const targetElem = refElem.value
|
|
274
|
+
const panelElem = refOptionPanel.value
|
|
275
|
+
const btnTransfer = computeBtnTransfer.value
|
|
276
|
+
const handleStyle = () => {
|
|
277
|
+
const ppObj = updatePanelPlacement(targetElem, panelElem, {
|
|
278
|
+
placement,
|
|
279
|
+
teleportTo: btnTransfer
|
|
280
|
+
})
|
|
281
|
+
const panelStyle: { [key: string]: string | number } = Object.assign(ppObj.style, {
|
|
282
|
+
zIndex: panelIndex
|
|
283
|
+
})
|
|
284
|
+
reactData.panelStyle = panelStyle
|
|
285
|
+
reactData.panelPlacement = ppObj.placement
|
|
286
|
+
}
|
|
287
|
+
handleStyle()
|
|
288
|
+
return nextTick().then(handleStyle)
|
|
339
289
|
}
|
|
340
290
|
|
|
341
291
|
const showOptionPanel = () => {
|
|
@@ -2,7 +2,7 @@ import { defineComponent, h, Teleport, ref, Ref, computed, provide, reactive, in
|
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { getConfig, getIcon, getI18n, commands, createEvent, globalEvents, useSize, renderEmptyElement } from '../../ui'
|
|
4
4
|
import { getFuncText, getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils'
|
|
5
|
-
import {
|
|
5
|
+
import { updatePanelPlacement, getEventTargetNode } from '../../ui/src/dom'
|
|
6
6
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
7
7
|
import { parseDateObj, getDateByCode } from '../../date-panel/src/util'
|
|
8
8
|
import { errLog } from '../../ui/src/log'
|
|
@@ -10,7 +10,7 @@ import VxeDatePanelComponent from '../../date-panel/src/date-panel'
|
|
|
10
10
|
import VxeButtonComponent from '../../button/src/button'
|
|
11
11
|
import VxeButtonGroupComponent from '../../button/src/button-group'
|
|
12
12
|
|
|
13
|
-
import type { VxeDatePickerConstructor, VxeDatePickerEmits, DatePickerInternalData, DatePickerReactData,
|
|
13
|
+
import type { VxeDatePickerConstructor, VxeDatePickerEmits, DatePickerInternalData, DatePickerReactData, DatePickerMethods, VxeDatePickerPropTypes, DatePickerPrivateRef, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines, ValueOf, VxeModalConstructor, VxeDrawerConstructor, VxeModalMethods, VxeDrawerMethods, VxeDatePickerDefines, VxeButtonGroupEvents, VxeDatePanelConstructor } from '../../../types'
|
|
14
14
|
import type { VxeTableConstructor, VxeTablePrivateMethods } from '../../../types/components/table'
|
|
15
15
|
|
|
16
16
|
export default defineComponent({
|
|
@@ -511,76 +511,24 @@ export default defineComponent({
|
|
|
511
511
|
}
|
|
512
512
|
|
|
513
513
|
const updatePlacement = () => {
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
let left = boundingLeft
|
|
533
|
-
let top = boundingTop + targetHeight
|
|
534
|
-
if (placement === 'top') {
|
|
535
|
-
panelPlacement = 'top'
|
|
536
|
-
top = boundingTop - panelHeight
|
|
537
|
-
} else if (!placement) {
|
|
538
|
-
// 如果下面不够放,则向上
|
|
539
|
-
if (top + panelHeight + marginSize > visibleHeight) {
|
|
540
|
-
panelPlacement = 'top'
|
|
541
|
-
top = boundingTop - panelHeight
|
|
542
|
-
}
|
|
543
|
-
// 如果上面不够放,则向下(优先)
|
|
544
|
-
if (top < marginSize) {
|
|
545
|
-
panelPlacement = 'bottom'
|
|
546
|
-
top = boundingTop + targetHeight
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
// 如果溢出右边
|
|
550
|
-
if (left + panelWidth + marginSize > visibleWidth) {
|
|
551
|
-
left -= left + panelWidth + marginSize - visibleWidth
|
|
552
|
-
}
|
|
553
|
-
// 如果溢出左边
|
|
554
|
-
if (left < marginSize) {
|
|
555
|
-
left = marginSize
|
|
556
|
-
}
|
|
557
|
-
Object.assign(panelStyle, {
|
|
558
|
-
left: `${left}px`,
|
|
559
|
-
top: `${top}px`,
|
|
560
|
-
minWidth: `${targetWidth}px`
|
|
561
|
-
})
|
|
562
|
-
} else {
|
|
563
|
-
if (placement === 'top') {
|
|
564
|
-
panelPlacement = 'top'
|
|
565
|
-
panelStyle.bottom = `${targetHeight}px`
|
|
566
|
-
} else if (!placement) {
|
|
567
|
-
// 如果下面不够放,则向上
|
|
568
|
-
panelStyle.top = `${targetHeight}px`
|
|
569
|
-
if (boundingTop + targetHeight + panelHeight > visibleHeight) {
|
|
570
|
-
// 如果上面不够放,则向下(优先)
|
|
571
|
-
if (boundingTop - targetHeight - panelHeight > marginSize) {
|
|
572
|
-
panelPlacement = 'top'
|
|
573
|
-
panelStyle.top = ''
|
|
574
|
-
panelStyle.bottom = `${targetHeight}px`
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
reactData.panelStyle = panelStyle
|
|
580
|
-
reactData.panelPlacement = panelPlacement
|
|
581
|
-
return nextTick()
|
|
582
|
-
}
|
|
583
|
-
})
|
|
514
|
+
const { placement } = props
|
|
515
|
+
const { panelIndex } = reactData
|
|
516
|
+
const targetElem = refInputTarget.value
|
|
517
|
+
const panelElem = refInputPanel.value
|
|
518
|
+
const btnTransfer = computeBtnTransfer.value
|
|
519
|
+
const handleStyle = () => {
|
|
520
|
+
const ppObj = updatePanelPlacement(targetElem, panelElem, {
|
|
521
|
+
placement,
|
|
522
|
+
teleportTo: btnTransfer
|
|
523
|
+
})
|
|
524
|
+
const panelStyle: { [key: string]: string | number } = Object.assign(ppObj.style, {
|
|
525
|
+
zIndex: panelIndex
|
|
526
|
+
})
|
|
527
|
+
reactData.panelStyle = panelStyle
|
|
528
|
+
reactData.panelPlacement = ppObj.placement
|
|
529
|
+
}
|
|
530
|
+
handleStyle()
|
|
531
|
+
return nextTick().then(handleStyle)
|
|
584
532
|
}
|
|
585
533
|
|
|
586
534
|
const showPanel = () => {
|
|
@@ -2,7 +2,7 @@ import { defineComponent, h, Teleport, ref, Ref, computed, provide, reactive, in
|
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { getConfig, getIcon, getI18n, commands, globalEvents, createEvent, useSize, renderEmptyElement } from '../../ui'
|
|
4
4
|
import { getFuncText, getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils'
|
|
5
|
-
import {
|
|
5
|
+
import { updatePanelPlacement, getEventTargetNode } from '../../ui/src/dom'
|
|
6
6
|
import { parseDateString, parseDateObj, getRangeDateByCode } from '../../date-panel/src/util'
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
8
8
|
import { errLog } from '../../ui/src/log'
|
|
@@ -10,7 +10,7 @@ import VxeDatePanelComponent from '../../date-panel/src/date-panel'
|
|
|
10
10
|
import VxeButtonComponent from '../../button/src/button'
|
|
11
11
|
import VxeButtonGroupComponent from '../../button/src/button-group'
|
|
12
12
|
|
|
13
|
-
import type { VxeDateRangePickerConstructor, VxeDateRangePickerEmits, DateRangePickerInternalData, DateRangePickerReactData,
|
|
13
|
+
import type { VxeDateRangePickerConstructor, VxeDateRangePickerEmits, DateRangePickerInternalData, DateRangePickerReactData, DateRangePickerMethods, VxeDateRangePickerPropTypes, DateRangePickerPrivateRef, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines, ValueOf, VxeModalConstructor, VxeDrawerConstructor, VxeModalMethods, VxeDrawerMethods, VxeDateRangePickerDefines, VxeButtonGroupEvents, VxeDatePanelConstructor } from '../../../types'
|
|
14
14
|
import type { VxeTableConstructor, VxeTablePrivateMethods } from '../../../types/components/table'
|
|
15
15
|
|
|
16
16
|
export default defineComponent({
|
|
@@ -242,7 +242,7 @@ export default defineComponent({
|
|
|
242
242
|
if (globalPlaceholder) {
|
|
243
243
|
return getFuncText(globalPlaceholder)
|
|
244
244
|
}
|
|
245
|
-
return getI18n('vxe.
|
|
245
|
+
return getI18n('vxe.dateRangePicker.pleaseRange')
|
|
246
246
|
})
|
|
247
247
|
|
|
248
248
|
const computeInpImmediate = computed(() => {
|
|
@@ -541,11 +541,11 @@ export default defineComponent({
|
|
|
541
541
|
if ($startDatePanel && $endDatePanel) {
|
|
542
542
|
const startValue = $startDatePanel.getModelValue()
|
|
543
543
|
const endValue = $endDatePanel.getModelValue()
|
|
544
|
-
if (startValue && endValue) {
|
|
544
|
+
if ((startValue && !endValue) || (!startValue && endValue)) {
|
|
545
|
+
handleChange('', '', evnt)
|
|
546
|
+
} else {
|
|
545
547
|
$startDatePanel.confirmByEvent(evnt)
|
|
546
548
|
$endDatePanel.confirmByEvent(evnt)
|
|
547
|
-
} else {
|
|
548
|
-
handleChange('', '', evnt)
|
|
549
549
|
}
|
|
550
550
|
}
|
|
551
551
|
hidePanel()
|
|
@@ -640,76 +640,24 @@ export default defineComponent({
|
|
|
640
640
|
}
|
|
641
641
|
|
|
642
642
|
const updatePlacement = () => {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
let left = boundingLeft
|
|
662
|
-
let top = boundingTop + targetHeight
|
|
663
|
-
if (placement === 'top') {
|
|
664
|
-
panelPlacement = 'top'
|
|
665
|
-
top = boundingTop - panelHeight
|
|
666
|
-
} else if (!placement) {
|
|
667
|
-
// 如果下面不够放,则向上
|
|
668
|
-
if (top + panelHeight + marginSize > visibleHeight) {
|
|
669
|
-
panelPlacement = 'top'
|
|
670
|
-
top = boundingTop - panelHeight
|
|
671
|
-
}
|
|
672
|
-
// 如果上面不够放,则向下(优先)
|
|
673
|
-
if (top < marginSize) {
|
|
674
|
-
panelPlacement = 'bottom'
|
|
675
|
-
top = boundingTop + targetHeight
|
|
676
|
-
}
|
|
677
|
-
}
|
|
678
|
-
// 如果溢出右边
|
|
679
|
-
if (left + panelWidth + marginSize > visibleWidth) {
|
|
680
|
-
left -= left + panelWidth + marginSize - visibleWidth
|
|
681
|
-
}
|
|
682
|
-
// 如果溢出左边
|
|
683
|
-
if (left < marginSize) {
|
|
684
|
-
left = marginSize
|
|
685
|
-
}
|
|
686
|
-
Object.assign(panelStyle, {
|
|
687
|
-
left: `${left}px`,
|
|
688
|
-
top: `${top}px`,
|
|
689
|
-
minWidth: `${targetWidth}px`
|
|
690
|
-
})
|
|
691
|
-
} else {
|
|
692
|
-
if (placement === 'top') {
|
|
693
|
-
panelPlacement = 'top'
|
|
694
|
-
panelStyle.bottom = `${targetHeight}px`
|
|
695
|
-
} else if (!placement) {
|
|
696
|
-
// 如果下面不够放,则向上
|
|
697
|
-
panelStyle.top = `${targetHeight}px`
|
|
698
|
-
if (boundingTop + targetHeight + panelHeight > visibleHeight) {
|
|
699
|
-
// 如果上面不够放,则向下(优先)
|
|
700
|
-
if (boundingTop - targetHeight - panelHeight > marginSize) {
|
|
701
|
-
panelPlacement = 'top'
|
|
702
|
-
panelStyle.top = ''
|
|
703
|
-
panelStyle.bottom = `${targetHeight}px`
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
reactData.panelStyle = panelStyle
|
|
709
|
-
reactData.panelPlacement = panelPlacement
|
|
710
|
-
return nextTick()
|
|
711
|
-
}
|
|
712
|
-
})
|
|
643
|
+
const { placement } = props
|
|
644
|
+
const { panelIndex } = reactData
|
|
645
|
+
const targetElem = refInputTarget.value
|
|
646
|
+
const panelElem = refInputPanel.value
|
|
647
|
+
const btnTransfer = computeBtnTransfer.value
|
|
648
|
+
const handleStyle = () => {
|
|
649
|
+
const ppObj = updatePanelPlacement(targetElem, panelElem, {
|
|
650
|
+
placement,
|
|
651
|
+
teleportTo: btnTransfer
|
|
652
|
+
})
|
|
653
|
+
const panelStyle: { [key: string]: string | number } = Object.assign(ppObj.style, {
|
|
654
|
+
zIndex: panelIndex
|
|
655
|
+
})
|
|
656
|
+
reactData.panelStyle = panelStyle
|
|
657
|
+
reactData.panelPlacement = ppObj.placement
|
|
658
|
+
}
|
|
659
|
+
handleStyle()
|
|
660
|
+
return nextTick().then(handleStyle)
|
|
713
661
|
}
|
|
714
662
|
|
|
715
663
|
const showPanel = () => {
|