bkui-vue 0.0.1-beta.101 → 0.0.1-beta.102
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/dist/index.cjs.js +23 -23
- package/dist/index.esm.js +146 -39
- package/dist/index.umd.js +23 -23
- package/dist/style.css +1 -1
- package/lib/popover2/index.d.ts +27 -4
- package/lib/popover2/index.js +1 -1
- package/lib/popover2/popover2.css +0 -1
- package/lib/popover2/popover2.d.ts +12 -1
- package/lib/popover2/popover2.less +0 -1
- package/lib/popover2/popover2.variable.css +0 -1
- package/lib/popover2/props.d.ts +5 -0
- package/lib/popover2/use-floating.d.ts +3 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -10934,8 +10934,9 @@ const PopoverProps = __spreadValues({
|
|
10934
10934
|
offset: PropTypes.number.def(6),
|
10935
10935
|
boundary: PropTypes.string.def(void 0),
|
10936
10936
|
zIndex: PropTypes.number.def(void 0),
|
10937
|
-
disableTeleport: PropTypes.bool.def(
|
10937
|
+
disableTeleport: PropTypes.bool.def(true),
|
10938
10938
|
autoPlacement: PropTypes.bool.def(false),
|
10939
|
+
autoVisibility: PropTypes.bool.def(false),
|
10939
10940
|
disableOutsideClick: PropTypes.bool.def(false)
|
10940
10941
|
}, EventProps$1);
|
10941
10942
|
var Reference = defineComponent({
|
@@ -12197,14 +12198,27 @@ var useFloating = (props, ctx, refReference, refContent, refArrow) => {
|
|
12197
12198
|
elArrow
|
12198
12199
|
};
|
12199
12200
|
};
|
12200
|
-
const resolvePopOptions = (elArrow) =>
|
12201
|
-
|
12202
|
-
middleware: [inline(), offset(props.offset), props.autoPlacement ? autoPlacement() : flip(), shift({
|
12201
|
+
const resolvePopOptions = (elArrow) => {
|
12202
|
+
const middleware = [offset(props.offset), shift({
|
12203
12203
|
padding: props.padding
|
12204
12204
|
}), arrow({
|
12205
12205
|
element: elArrow
|
12206
|
-
})
|
12207
|
-
|
12206
|
+
})];
|
12207
|
+
const options = {
|
12208
|
+
placement: props.placement,
|
12209
|
+
middleware
|
12210
|
+
};
|
12211
|
+
if (props.autoPlacement) {
|
12212
|
+
middleware.push(autoPlacement());
|
12213
|
+
} else {
|
12214
|
+
middleware.unshift(inline());
|
12215
|
+
middleware.push(flip());
|
12216
|
+
}
|
12217
|
+
if (props.autoVisibility) {
|
12218
|
+
options.middleware.push(hide());
|
12219
|
+
}
|
12220
|
+
return options;
|
12221
|
+
};
|
12208
12222
|
const resolveTargetElement = (target) => {
|
12209
12223
|
if (target instanceof HTMLElement) {
|
12210
12224
|
return target;
|
@@ -12220,6 +12234,119 @@ var useFloating = (props, ctx, refReference, refContent, refArrow) => {
|
|
12220
12234
|
}, out), {});
|
12221
12235
|
const contentClass = `${customThemeCls}`;
|
12222
12236
|
let cleanup = null;
|
12237
|
+
const getRoundPixelVal = (val) => {
|
12238
|
+
const dpr = window.devicePixelRatio || 1;
|
12239
|
+
return Math.round(val * dpr) / dpr || 0;
|
12240
|
+
};
|
12241
|
+
const isElementFullScreen = () => document.fullscreenElement !== null;
|
12242
|
+
const updatePopContentStyle = (elContent, x2, y2, resolvedPlacement, middlewareData, elReference) => {
|
12243
|
+
const {
|
12244
|
+
left: left2,
|
12245
|
+
top: top2
|
12246
|
+
} = elReference.getBoundingClientRect();
|
12247
|
+
const resolveFullscreenOffsetX = (xValue) => {
|
12248
|
+
if (["left", "right"].includes(resolvedPlacement)) {
|
12249
|
+
return getRoundPixelVal(xValue);
|
12250
|
+
}
|
12251
|
+
return left2;
|
12252
|
+
};
|
12253
|
+
const resolveFullscreenOffsetY = (yValue) => {
|
12254
|
+
if (["top", "bottom"].includes(resolvedPlacement)) {
|
12255
|
+
return getRoundPixelVal(yValue);
|
12256
|
+
}
|
12257
|
+
return top2;
|
12258
|
+
};
|
12259
|
+
const getOffsetX = () => {
|
12260
|
+
if (isElementFullScreen()) {
|
12261
|
+
return resolveFullscreenOffsetX(x2);
|
12262
|
+
}
|
12263
|
+
return getRoundPixelVal(x2);
|
12264
|
+
};
|
12265
|
+
const getOffsetY = () => {
|
12266
|
+
if (isElementFullScreen()) {
|
12267
|
+
return resolveFullscreenOffsetY(y2);
|
12268
|
+
}
|
12269
|
+
return getRoundPixelVal(y2);
|
12270
|
+
};
|
12271
|
+
Object.assign(elContent.style, {
|
12272
|
+
left: "0",
|
12273
|
+
top: "0",
|
12274
|
+
transform: `translate3d(${getOffsetX()}px,${getOffsetY()}px,0)`
|
12275
|
+
});
|
12276
|
+
if (props.autoVisibility) {
|
12277
|
+
const {
|
12278
|
+
referenceHidden
|
12279
|
+
} = middlewareData.hide;
|
12280
|
+
Object.assign(elContent.style, {
|
12281
|
+
visibility: referenceHidden ? "hidden" : "visible"
|
12282
|
+
});
|
12283
|
+
}
|
12284
|
+
};
|
12285
|
+
const updateArrowStyle = (elArrow, resolvedPlacement, middlewareData, elReference) => {
|
12286
|
+
const {
|
12287
|
+
left: left2,
|
12288
|
+
top: top2,
|
12289
|
+
bottom: bottom2,
|
12290
|
+
right: right2
|
12291
|
+
} = elReference.getBoundingClientRect();
|
12292
|
+
if (props.arrow) {
|
12293
|
+
const {
|
12294
|
+
x: arrowX,
|
12295
|
+
y: arrowY
|
12296
|
+
} = middlewareData.arrow;
|
12297
|
+
const staticPrefix = {
|
12298
|
+
top: 1,
|
12299
|
+
right: -1,
|
12300
|
+
bottom: -1,
|
12301
|
+
left: 1
|
12302
|
+
}[resolvedPlacement];
|
12303
|
+
const getStaticSidePos = (val, pos, defaultVal) => {
|
12304
|
+
var _a, _b;
|
12305
|
+
const staticSide = (_b = (_a = {
|
12306
|
+
x: {
|
12307
|
+
left: "right",
|
12308
|
+
right: "left"
|
12309
|
+
},
|
12310
|
+
y: {
|
12311
|
+
top: "bottom",
|
12312
|
+
bottom: "top"
|
12313
|
+
}
|
12314
|
+
}[pos]) == null ? void 0 : _a[resolvedPlacement]) != null ? _b : defaultVal;
|
12315
|
+
return [val, staticSide];
|
12316
|
+
};
|
12317
|
+
const getFullScreenOffset = (arrowValue) => {
|
12318
|
+
if (isElementFullScreen()) {
|
12319
|
+
if (["left", "right"].includes(resolvedPlacement)) {
|
12320
|
+
return getRoundPixelVal((bottom2 - top2) / 2) - 2;
|
12321
|
+
}
|
12322
|
+
if (["top", "bottom"].includes(resolvedPlacement)) {
|
12323
|
+
return getRoundPixelVal((right2 - left2) / 2) - 2;
|
12324
|
+
}
|
12325
|
+
}
|
12326
|
+
return isNumber(arrowValue) ? getRoundPixelVal(arrowValue) : 0;
|
12327
|
+
};
|
12328
|
+
const getOffsetX = () => {
|
12329
|
+
if (["left", "right"].includes(resolvedPlacement)) {
|
12330
|
+
return staticPrefix * 4;
|
12331
|
+
}
|
12332
|
+
return getFullScreenOffset(arrowX);
|
12333
|
+
};
|
12334
|
+
const getOffsetY = () => {
|
12335
|
+
if (["top", "bottom"].includes(resolvedPlacement)) {
|
12336
|
+
return staticPrefix * 4;
|
12337
|
+
}
|
12338
|
+
return getFullScreenOffset(arrowY);
|
12339
|
+
};
|
12340
|
+
elArrow.setAttribute("data-arrow", resolvedPlacement);
|
12341
|
+
const [offsetX, xPos] = getStaticSidePos(getOffsetX(), "x", "left");
|
12342
|
+
const [offsetY, yPos] = getStaticSidePos(getOffsetY(), "y", "top");
|
12343
|
+
Object.assign(elArrow.style, {
|
12344
|
+
[xPos]: "0",
|
12345
|
+
[yPos]: "0",
|
12346
|
+
transform: `translate(${offsetX}px,${offsetY}px) rotate(45deg)`
|
12347
|
+
});
|
12348
|
+
}
|
12349
|
+
};
|
12223
12350
|
const updatePopover = () => {
|
12224
12351
|
const {
|
12225
12352
|
elReference,
|
@@ -12239,35 +12366,13 @@ var useFloating = (props, ctx, refReference, refContent, refArrow) => {
|
|
12239
12366
|
Object.keys(customTheme).forEach((key) => {
|
12240
12367
|
elContent.setAttribute(key, customTheme[key]);
|
12241
12368
|
});
|
12242
|
-
const
|
12243
|
-
|
12244
|
-
|
12245
|
-
|
12246
|
-
left: `${x2}px`,
|
12247
|
-
top: `${y2}px`,
|
12248
|
-
visibility: referenceHidden ? "hidden" : "visible"
|
12249
|
-
});
|
12250
|
-
if (props.arrow) {
|
12251
|
-
const {
|
12252
|
-
x: arrowX,
|
12253
|
-
y: arrowY
|
12254
|
-
} = middlewareData.arrow;
|
12255
|
-
const placementStr = placement.split("-")[0];
|
12256
|
-
const staticSide = {
|
12257
|
-
top: "bottom",
|
12258
|
-
right: "left",
|
12259
|
-
bottom: "top",
|
12260
|
-
left: "right"
|
12261
|
-
}[placementStr];
|
12262
|
-
elArrow.setAttribute("data-arrow", placementStr);
|
12263
|
-
Object.assign(elArrow.style, {
|
12264
|
-
left: isNumber(arrowX) ? `${arrowX}px` : "",
|
12265
|
-
top: isNumber(arrowY) ? `${arrowY}px` : "",
|
12266
|
-
right: "",
|
12267
|
-
bottom: "",
|
12268
|
-
[staticSide]: "-4px"
|
12269
|
-
});
|
12369
|
+
const placementStr = placement.split("-")[0];
|
12370
|
+
let resolvedPlacement = placementStr;
|
12371
|
+
if (!["left", "right", "top", "bottom"].includes(placementStr)) {
|
12372
|
+
resolvedPlacement = "top";
|
12270
12373
|
}
|
12374
|
+
updatePopContentStyle(elContent, x2, y2, resolvedPlacement, middlewareData, elReference);
|
12375
|
+
updateArrowStyle(elArrow, resolvedPlacement, middlewareData, elReference);
|
12271
12376
|
});
|
12272
12377
|
});
|
12273
12378
|
};
|
@@ -12332,6 +12437,7 @@ var useFloating = (props, ctx, refReference, refContent, refArrow) => {
|
|
12332
12437
|
updatePopover,
|
12333
12438
|
triggerPopover,
|
12334
12439
|
resolvePopElements,
|
12440
|
+
isElementFullScreen,
|
12335
12441
|
localIsShow,
|
12336
12442
|
cleanup
|
12337
12443
|
};
|
@@ -12370,9 +12476,9 @@ var Component$n = defineComponent({
|
|
12370
12476
|
const {
|
12371
12477
|
content,
|
12372
12478
|
theme,
|
12373
|
-
disableTeleport,
|
12374
12479
|
width,
|
12375
|
-
height
|
12480
|
+
height,
|
12481
|
+
disableTeleport
|
12376
12482
|
} = props;
|
12377
12483
|
const refReference = ref();
|
12378
12484
|
const refContent = ref();
|
@@ -12385,6 +12491,7 @@ var Component$n = defineComponent({
|
|
12385
12491
|
resolveTriggerEvents,
|
12386
12492
|
updatePopover,
|
12387
12493
|
resolvePopElements,
|
12494
|
+
isElementFullScreen,
|
12388
12495
|
cleanup
|
12389
12496
|
} = useFloating(props, ctx, refReference, refContent, refArrow);
|
12390
12497
|
const show = () => {
|
@@ -12461,7 +12568,6 @@ var Component$n = defineComponent({
|
|
12461
12568
|
} = usePopperId();
|
12462
12569
|
const boundary = typeof props.boundary === "string" ? props.boundary : prefixId;
|
12463
12570
|
const handleClickOutside = (_e) => {
|
12464
|
-
console.log("handleClickOutside", localIsShow.value);
|
12465
12571
|
ctx.emit(EMITEVENTS$1.CLICK_OUTSIDE, {
|
12466
12572
|
isShow: localIsShow.value
|
12467
12573
|
});
|
@@ -12472,6 +12578,7 @@ var Component$n = defineComponent({
|
|
12472
12578
|
hide2();
|
12473
12579
|
}
|
12474
12580
|
};
|
12581
|
+
const transBoundary = computed(() => !isElementFullScreen() && !disableTeleport);
|
12475
12582
|
return {
|
12476
12583
|
boundary,
|
12477
12584
|
arrow: props.arrow,
|
@@ -12480,7 +12587,7 @@ var Component$n = defineComponent({
|
|
12480
12587
|
refArrow,
|
12481
12588
|
content,
|
12482
12589
|
theme,
|
12483
|
-
|
12590
|
+
transBoundary,
|
12484
12591
|
width,
|
12485
12592
|
height,
|
12486
12593
|
handleClickOutside
|
@@ -12496,7 +12603,7 @@ var Component$n = defineComponent({
|
|
12496
12603
|
}
|
12497
12604
|
}), createVNode(Teleport, {
|
12498
12605
|
"to": this.boundary,
|
12499
|
-
"disabled": this.
|
12606
|
+
"disabled": !this.transBoundary
|
12500
12607
|
}, {
|
12501
12608
|
default: () => [withDirectives(createVNode(Content, {
|
12502
12609
|
"ref": "refContent",
|