wave-ui 1.45.12 → 1.46.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.
- package/dist/wave-ui.cjs.js +1 -1
- package/dist/wave-ui.css +1 -1
- package/dist/wave-ui.es.js +246 -278
- package/dist/wave-ui.umd.js +1 -1
- package/package.json +1 -1
- package/src/wave-ui/components/w-alert.vue +0 -1
- package/src/wave-ui/components/w-input.vue +6 -3
- package/src/wave-ui/components/w-menu.vue +74 -209
- package/src/wave-ui/components/w-select.vue +1 -1
- package/src/wave-ui/components/w-tag.vue +17 -6
- package/src/wave-ui/components/w-tooltip.vue +128 -262
- package/src/wave-ui/mixins/detachable.js +189 -0
- package/src/wave-ui/scss/_mixins.scss +18 -4
- package/src/wave-ui/scss/_variables.scss +1 -1
package/dist/wave-ui.es.js
CHANGED
|
@@ -2678,6 +2678,8 @@ const __vue2_script$u = {
|
|
|
2678
2678
|
return file;
|
|
2679
2679
|
}));
|
|
2680
2680
|
this.$emit("update:modelValue", this.inputFiles);
|
|
2681
|
+
this.$emit("input", this.inputFiles);
|
|
2682
|
+
this.$emit("change", this.inputFiles);
|
|
2681
2683
|
},
|
|
2682
2684
|
filePreview(original, file) {
|
|
2683
2685
|
const reader = new FileReader();
|
|
@@ -2695,10 +2697,10 @@ const __vue2_script$u = {
|
|
|
2695
2697
|
}
|
|
2696
2698
|
},
|
|
2697
2699
|
mounted() {
|
|
2698
|
-
|
|
2699
|
-
if (this.$refs.input.matches(":-webkit-autofill"))
|
|
2700
|
+
setTimeout(() => {
|
|
2701
|
+
if (this.$refs.input && this.$refs.input.matches(":-webkit-autofill"))
|
|
2700
2702
|
this.isAutofilled = true;
|
|
2701
|
-
});
|
|
2703
|
+
}, 400);
|
|
2702
2704
|
},
|
|
2703
2705
|
watch: {
|
|
2704
2706
|
value(value) {
|
|
@@ -3012,34 +3014,154 @@ function __vue2_injectStyles$t(context) {
|
|
|
3012
3014
|
var wList = /* @__PURE__ */ function() {
|
|
3013
3015
|
return __component__$t.exports;
|
|
3014
3016
|
}();
|
|
3017
|
+
var DetachableMixin = {
|
|
3018
|
+
computed: {
|
|
3019
|
+
appendToTarget() {
|
|
3020
|
+
const defaultTarget = ".w-app";
|
|
3021
|
+
if (this.detachTo && !this.appendTo) {
|
|
3022
|
+
consoleWarn(`The ${this.$options.name} prop \`detach-to\` is deprecated. You can replace it with \`append-to\`.`);
|
|
3023
|
+
}
|
|
3024
|
+
let target = this.appendTo || this.detachTo || defaultTarget;
|
|
3025
|
+
if (target === true)
|
|
3026
|
+
target = defaultTarget;
|
|
3027
|
+
else if (this.appendTo === "activator")
|
|
3028
|
+
target = this.$el.previousElementSibling;
|
|
3029
|
+
else if (target && !["object", "string"].includes(typeof target))
|
|
3030
|
+
target = defaultTarget;
|
|
3031
|
+
else if (typeof target === "object" && !target.nodeType) {
|
|
3032
|
+
target = defaultTarget;
|
|
3033
|
+
consoleWarn(`Invalid node provided in ${this.$options.name} \`append-to\`. Falling back to .w-app.`);
|
|
3034
|
+
}
|
|
3035
|
+
if (typeof target === "string")
|
|
3036
|
+
target = document.querySelector(target);
|
|
3037
|
+
if (!target) {
|
|
3038
|
+
consoleWarn(`Unable to locate ${this.appendTo ? `target ${this.appendTo}` : defaultTarget}`);
|
|
3039
|
+
target = document.querySelector(defaultTarget);
|
|
3040
|
+
}
|
|
3041
|
+
return target;
|
|
3042
|
+
},
|
|
3043
|
+
detachableParentEl() {
|
|
3044
|
+
return this.appendToTarget;
|
|
3045
|
+
}
|
|
3046
|
+
},
|
|
3047
|
+
methods: {
|
|
3048
|
+
getActivatorCoordinates(e) {
|
|
3049
|
+
const { top, left, width, height } = (e ? e.target : this.activatorEl).getBoundingClientRect();
|
|
3050
|
+
let coords = { top, left, width, height };
|
|
3051
|
+
if (!this.fixed) {
|
|
3052
|
+
const { top: targetTop, left: targetLeft } = this.detachableParentEl.getBoundingClientRect();
|
|
3053
|
+
const computedStyles2 = window.getComputedStyle(this.detachableParentEl, null);
|
|
3054
|
+
coords = __spreadProps(__spreadValues({}, coords), {
|
|
3055
|
+
top: top - targetTop + this.detachableParentEl.scrollTop - parseInt(computedStyles2.getPropertyValue("border-top-width")),
|
|
3056
|
+
left: left - targetLeft + this.detachableParentEl.scrollLeft - parseInt(computedStyles2.getPropertyValue("border-left-width"))
|
|
3057
|
+
});
|
|
3058
|
+
}
|
|
3059
|
+
return coords;
|
|
3060
|
+
},
|
|
3061
|
+
computeDetachableCoords(e) {
|
|
3062
|
+
let { top, left, width, height } = this.getActivatorCoordinates(e);
|
|
3063
|
+
this.detachableEl.style.visibility = "hidden";
|
|
3064
|
+
this.detachableEl.style.display = "flex";
|
|
3065
|
+
const computedStyles2 = window.getComputedStyle(this.detachableEl, null);
|
|
3066
|
+
switch (this.position) {
|
|
3067
|
+
case "top": {
|
|
3068
|
+
top -= this.detachableEl.offsetHeight;
|
|
3069
|
+
if (this.alignRight) {
|
|
3070
|
+
left += width - this.detachableEl.offsetWidth + parseInt(computedStyles2.getPropertyValue("border-right-width"));
|
|
3071
|
+
} else if (!this.alignLeft)
|
|
3072
|
+
left += (width - this.detachableEl.offsetWidth) / 2;
|
|
3073
|
+
break;
|
|
3074
|
+
}
|
|
3075
|
+
case "bottom": {
|
|
3076
|
+
top += height;
|
|
3077
|
+
if (this.alignRight) {
|
|
3078
|
+
left += width - this.detachableEl.offsetWidth + parseInt(computedStyles2.getPropertyValue("border-right-width"));
|
|
3079
|
+
} else if (!this.alignLeft)
|
|
3080
|
+
left += (width - this.detachableEl.offsetWidth) / 2;
|
|
3081
|
+
break;
|
|
3082
|
+
}
|
|
3083
|
+
case "left": {
|
|
3084
|
+
left -= this.detachableEl.offsetWidth;
|
|
3085
|
+
if (this.alignBottom)
|
|
3086
|
+
top += height - this.detachableEl.offsetHeight;
|
|
3087
|
+
else if (!this.alignTop)
|
|
3088
|
+
top += (height - this.detachableEl.offsetHeight) / 2;
|
|
3089
|
+
break;
|
|
3090
|
+
}
|
|
3091
|
+
case "right": {
|
|
3092
|
+
left += width;
|
|
3093
|
+
if (this.alignBottom) {
|
|
3094
|
+
top += height - this.detachableEl.offsetHeight + parseInt(computedStyles2.getPropertyValue("margin-top"));
|
|
3095
|
+
} else if (!this.alignTop) {
|
|
3096
|
+
top += (height - this.detachableEl.offsetHeight) / 2 + parseInt(computedStyles2.getPropertyValue("margin-top"));
|
|
3097
|
+
}
|
|
3098
|
+
break;
|
|
3099
|
+
}
|
|
3100
|
+
}
|
|
3101
|
+
this.detachableEl.style.visibility = null;
|
|
3102
|
+
if (!this.detachableVisible)
|
|
3103
|
+
this.detachableEl.style.display = "none";
|
|
3104
|
+
this.detachableCoords = { top, left };
|
|
3105
|
+
},
|
|
3106
|
+
onResize() {
|
|
3107
|
+
if (this.minWidth === "activator")
|
|
3108
|
+
this.activatorWidth = this.activatorEl.offsetWidth;
|
|
3109
|
+
this.computeDetachableCoords();
|
|
3110
|
+
},
|
|
3111
|
+
onOutsideMousedown(e) {
|
|
3112
|
+
if (!this.detachableEl.contains(e.target) && !this.activatorEl.contains(e.target)) {
|
|
3113
|
+
this.$emit("update:modelValue", this.detachableVisible = false);
|
|
3114
|
+
this.$emit("input", false);
|
|
3115
|
+
this.$emit("close");
|
|
3116
|
+
document.removeEventListener("mousedown", this.onOutsideMousedown);
|
|
3117
|
+
window.removeEventListener("resize", this.onResize);
|
|
3118
|
+
}
|
|
3119
|
+
},
|
|
3120
|
+
insertInDOM() {
|
|
3121
|
+
return new Promise((resolve) => {
|
|
3122
|
+
this.$nextTick(() => {
|
|
3123
|
+
var _a;
|
|
3124
|
+
this.detachableEl = ((_a = this.$refs.detachable) == null ? void 0 : _a.$el) || this.$refs.detachable;
|
|
3125
|
+
this.appendToTarget.appendChild(this.detachableEl);
|
|
3126
|
+
resolve();
|
|
3127
|
+
});
|
|
3128
|
+
});
|
|
3129
|
+
},
|
|
3130
|
+
removeFromDOM() {
|
|
3131
|
+
if (this.detachableEl && this.detachableEl.parentNode)
|
|
3132
|
+
this.detachableEl.remove();
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
};
|
|
3015
3136
|
var render$s = function() {
|
|
3016
3137
|
var _vm = this;
|
|
3017
3138
|
var _h = _vm.$createElement;
|
|
3018
3139
|
var _c = _vm._self._c || _h;
|
|
3019
|
-
return _c("div", { staticClass: "w-menu-wrap" }, [_vm._t("activator", null, { "on": _vm.activatorEventHandlers }), _c("transition", { attrs: { "name": _vm.transitionName, "appear": "" } }, [_vm.custom && _vm.
|
|
3020
|
-
_vm.hideOnMenuClick && _vm.
|
|
3140
|
+
return _c("div", { staticClass: "w-menu-wrap" }, [_vm._t("activator", null, { "on": _vm.activatorEventHandlers }), _c("transition", { attrs: { "name": _vm.transitionName, "appear": "" } }, [_vm.custom && _vm.detachableVisible ? _c("div", { ref: "detachable", staticClass: "w-menu", class: _vm.classes, style: _vm.styles, on: { "click": function($event) {
|
|
3141
|
+
_vm.hideOnMenuClick && _vm.close(true);
|
|
3021
3142
|
}, "mouseenter": function($event) {
|
|
3022
3143
|
_vm.showOnHover && (_vm.hoveringMenu = true);
|
|
3023
3144
|
}, "mouseleave": function($event) {
|
|
3024
|
-
_vm.showOnHover && (_vm.hoveringMenu = false, _vm.
|
|
3025
|
-
} } }, [_vm._t("default")], 2) : _vm.
|
|
3026
|
-
_vm.hideOnMenuClick && _vm.
|
|
3145
|
+
_vm.showOnHover && (_vm.hoveringMenu = false, _vm.close());
|
|
3146
|
+
} } }, [_vm._t("default")], 2) : _vm.detachableVisible ? _c("w-card", { ref: "detachable", staticClass: "w-menu", class: _vm.classes, style: _vm.styles, attrs: { "tile": _vm.tile, "title-class": _vm.titleClasses, "content-class": _vm.contentClasses, "shadow": _vm.shadow, "no-border": _vm.noBorder }, nativeOn: { "click": function($event) {
|
|
3147
|
+
_vm.hideOnMenuClick && _vm.close(true);
|
|
3027
3148
|
}, "mouseenter": function($event) {
|
|
3028
3149
|
_vm.showOnHover && (_vm.hoveringMenu = true);
|
|
3029
3150
|
}, "mouseleave": function($event) {
|
|
3030
|
-
_vm.showOnHover && (_vm.hoveringMenu = false, _vm.
|
|
3151
|
+
_vm.showOnHover && (_vm.hoveringMenu = false, _vm.close());
|
|
3031
3152
|
} }, scopedSlots: _vm._u([_vm.$slots.title ? { key: "title", fn: function() {
|
|
3032
3153
|
return [_vm._t("title")];
|
|
3033
3154
|
}, proxy: true } : null, _vm.$slots.actions ? { key: "actions", fn: function() {
|
|
3034
3155
|
return [_vm._t("actions")];
|
|
3035
|
-
}, proxy: true } : null], null, true) }, [_vm._t("default")], 2) : _vm._e()], 1), _vm.overlay ? _c("w-overlay", _vm._b({ ref: "overlay", class: _vm.overlayClasses, attrs: { "value": _vm.
|
|
3036
|
-
_vm.
|
|
3156
|
+
}, proxy: true } : null], null, true) }, [_vm._t("default")], 2) : _vm._e()], 1), _vm.overlay ? _c("w-overlay", _vm._b({ ref: "overlay", class: _vm.overlayClasses, attrs: { "value": _vm.detachableVisible, "persistent": _vm.persistent, "z-index": (_vm.zIndex || 200) - 1 }, on: { "input": function($event) {
|
|
3157
|
+
_vm.detachableVisible = false;
|
|
3037
3158
|
} } }, "w-overlay", _vm.overlayProps, false)) : _vm._e()], 2);
|
|
3038
3159
|
};
|
|
3039
3160
|
var staticRenderFns$s = [];
|
|
3040
3161
|
var wMenu_vue_vue_type_style_index_0_lang = "";
|
|
3041
3162
|
const __vue2_script$s = {
|
|
3042
3163
|
name: "w-menu",
|
|
3164
|
+
mixins: [DetachableMixin],
|
|
3043
3165
|
props: {
|
|
3044
3166
|
value: {},
|
|
3045
3167
|
showOnHover: { type: Boolean },
|
|
@@ -3056,7 +3178,8 @@ const __vue2_script$s = {
|
|
|
3056
3178
|
titleClass: { type: [String, Object, Array] },
|
|
3057
3179
|
contentClass: { type: [String, Object, Array] },
|
|
3058
3180
|
arrow: { type: Boolean },
|
|
3059
|
-
detachTo: { type: [String, Boolean, Object] },
|
|
3181
|
+
detachTo: { type: [String, Boolean, Object], deprecated: true },
|
|
3182
|
+
appendTo: { type: [String, Boolean, Object] },
|
|
3060
3183
|
fixed: { type: Boolean },
|
|
3061
3184
|
top: { type: Boolean },
|
|
3062
3185
|
bottom: { type: Boolean },
|
|
@@ -3076,55 +3199,34 @@ const __vue2_script$s = {
|
|
|
3076
3199
|
},
|
|
3077
3200
|
emits: ["input", "update:modelValue", "open", "close"],
|
|
3078
3201
|
data: () => ({
|
|
3079
|
-
|
|
3202
|
+
detachableVisible: false,
|
|
3080
3203
|
hoveringActivator: false,
|
|
3081
3204
|
hoveringMenu: false,
|
|
3082
|
-
|
|
3205
|
+
detachableCoords: {
|
|
3083
3206
|
top: 0,
|
|
3084
3207
|
left: 0
|
|
3085
3208
|
},
|
|
3086
3209
|
activatorEl: null,
|
|
3087
3210
|
activatorWidth: 0,
|
|
3088
|
-
|
|
3211
|
+
detachableEl: null,
|
|
3089
3212
|
timeoutId: null
|
|
3090
3213
|
}),
|
|
3091
3214
|
computed: {
|
|
3092
3215
|
transitionName() {
|
|
3093
3216
|
return this.transition || "scale-fade";
|
|
3094
3217
|
},
|
|
3095
|
-
detachToTarget() {
|
|
3096
|
-
let target = this.detachTo || ".w-app";
|
|
3097
|
-
if (target === true)
|
|
3098
|
-
target = ".w-app";
|
|
3099
|
-
else if (target && !["object", "string"].includes(typeof target))
|
|
3100
|
-
target = ".w-app";
|
|
3101
|
-
else if (typeof target === "object" && !target.nodeType) {
|
|
3102
|
-
target = ".w-app";
|
|
3103
|
-
consoleWarn("Invalid node provided in w-menu `detach-to`. Falling back to .w-app.");
|
|
3104
|
-
}
|
|
3105
|
-
if (typeof target === "string")
|
|
3106
|
-
target = document.querySelector(target);
|
|
3107
|
-
if (!target) {
|
|
3108
|
-
consoleWarn(`Unable to locate ${this.detachTo ? `target ${this.detachTo}` : ".w-app"}`);
|
|
3109
|
-
target = document.querySelector(".w-app");
|
|
3110
|
-
}
|
|
3111
|
-
return target;
|
|
3112
|
-
},
|
|
3113
|
-
menuParentEl() {
|
|
3114
|
-
return this.detachToTarget;
|
|
3115
|
-
},
|
|
3116
3218
|
position() {
|
|
3117
3219
|
return this.top && "top" || this.bottom && "bottom" || this.left && "left" || this.right && "right" || "bottom";
|
|
3118
3220
|
},
|
|
3221
|
+
alignment() {
|
|
3222
|
+
return ["top", "bottom"].includes(this.position) && this.alignLeft && "left" || ["top", "bottom"].includes(this.position) && this.alignRight && "right" || ["left", "right"].includes(this.position) && this.alignTop && "top" || ["left", "right"].includes(this.position) && this.alignBottom && "bottom" || "";
|
|
3223
|
+
},
|
|
3119
3224
|
menuMinWidth() {
|
|
3120
3225
|
if (this.minWidth === "activator")
|
|
3121
3226
|
return this.activatorWidth ? `${this.activatorWidth}px` : 0;
|
|
3122
3227
|
else
|
|
3123
3228
|
return isNaN(this.minWidth) ? this.minWidth : this.minWidth ? `${this.minWidth}px` : 0;
|
|
3124
3229
|
},
|
|
3125
|
-
alignment() {
|
|
3126
|
-
return (this.top || this.bottom) && this.alignLeft && "left" || (this.top || this.bottom) && this.alignRight && "right" || (this.left || this.right) && this.alignTop && "top" || (this.left || this.right) && this.alignBottom && "bottom" || "";
|
|
3127
|
-
},
|
|
3128
3230
|
menuClasses() {
|
|
3129
3231
|
return objectifyClasses(this.menuClass);
|
|
3130
3232
|
},
|
|
@@ -3155,8 +3257,8 @@ const __vue2_script$s = {
|
|
|
3155
3257
|
styles() {
|
|
3156
3258
|
return {
|
|
3157
3259
|
zIndex: this.zIndex || this.zIndex === 0 || this.overlay && !this.zIndex && 200 || null,
|
|
3158
|
-
top: this.
|
|
3159
|
-
left: this.
|
|
3260
|
+
top: this.detachableCoords.top && `${~~this.detachableCoords.top}px` || null,
|
|
3261
|
+
left: this.detachableCoords.left && `${~~this.detachableCoords.left}px` || null,
|
|
3160
3262
|
minWidth: this.minWidth && this.menuMinWidth || null,
|
|
3161
3263
|
"--w-menu-bg-color": this.arrow && this.$waveui.colors[this.bgColor || "white"]
|
|
3162
3264
|
};
|
|
@@ -3169,18 +3271,19 @@ const __vue2_script$s = {
|
|
|
3169
3271
|
blur: this.toggleMenu,
|
|
3170
3272
|
mouseenter: (e) => {
|
|
3171
3273
|
this.hoveringActivator = true;
|
|
3172
|
-
this.
|
|
3274
|
+
this.open(e);
|
|
3173
3275
|
},
|
|
3174
3276
|
mouseleave: (e) => {
|
|
3175
3277
|
this.hoveringActivator = false;
|
|
3176
3278
|
setTimeout(() => {
|
|
3177
3279
|
if (!this.hoveringMenu)
|
|
3178
|
-
this.
|
|
3280
|
+
this.close();
|
|
3179
3281
|
}, 10);
|
|
3180
3282
|
}
|
|
3181
3283
|
};
|
|
3182
|
-
if ("ontouchstart" in window)
|
|
3284
|
+
if (typeof window !== "undefined" && "ontouchstart" in window) {
|
|
3183
3285
|
handlers.click = this.toggleMenu;
|
|
3286
|
+
}
|
|
3184
3287
|
} else
|
|
3185
3288
|
handlers = { click: this.toggleMenu };
|
|
3186
3289
|
return handlers;
|
|
@@ -3188,7 +3291,7 @@ const __vue2_script$s = {
|
|
|
3188
3291
|
},
|
|
3189
3292
|
methods: {
|
|
3190
3293
|
toggleMenu(e) {
|
|
3191
|
-
let shouldShowMenu = this.
|
|
3294
|
+
let shouldShowMenu = this.detachableVisible;
|
|
3192
3295
|
if ("ontouchstart" in window && this.showOnHover && e.type === "click") {
|
|
3193
3296
|
shouldShowMenu = !shouldShowMenu;
|
|
3194
3297
|
} else if (e.type === "click" && !this.showOnHover)
|
|
@@ -3202,20 +3305,20 @@ const __vue2_script$s = {
|
|
|
3202
3305
|
}
|
|
3203
3306
|
this.timeoutId = clearTimeout(this.timeoutId);
|
|
3204
3307
|
if (shouldShowMenu) {
|
|
3205
|
-
this.$emit("update:modelValue", this.
|
|
3308
|
+
this.$emit("update:modelValue", this.detachableVisible = true);
|
|
3206
3309
|
this.$emit("input", true);
|
|
3207
3310
|
this.$emit("open");
|
|
3208
|
-
this.
|
|
3311
|
+
this.open(e);
|
|
3209
3312
|
} else
|
|
3210
|
-
this.
|
|
3313
|
+
this.close();
|
|
3211
3314
|
},
|
|
3212
|
-
async
|
|
3213
|
-
this.
|
|
3214
|
-
await this.
|
|
3315
|
+
async open(e) {
|
|
3316
|
+
this.detachableVisible = true;
|
|
3317
|
+
await this.insertInDOM();
|
|
3215
3318
|
if (this.minWidth === "activator")
|
|
3216
3319
|
this.activatorWidth = this.activatorEl.offsetWidth;
|
|
3217
3320
|
if (!this.noPosition)
|
|
3218
|
-
this.
|
|
3321
|
+
this.computeDetachableCoords(e);
|
|
3219
3322
|
this.timeoutId = setTimeout(() => {
|
|
3220
3323
|
this.$emit("update:modelValue", true);
|
|
3221
3324
|
this.$emit("input", true);
|
|
@@ -3226,105 +3329,19 @@ const __vue2_script$s = {
|
|
|
3226
3329
|
if (!this.noPosition)
|
|
3227
3330
|
window.addEventListener("resize", this.onResize);
|
|
3228
3331
|
},
|
|
3229
|
-
async
|
|
3230
|
-
if (!this.
|
|
3332
|
+
async close(force = false) {
|
|
3333
|
+
if (!this.detachableVisible)
|
|
3231
3334
|
return;
|
|
3232
3335
|
if (this.showOnHover && !force) {
|
|
3233
3336
|
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
3234
3337
|
if (this.showOnHover && (this.hoveringMenu || this.hoveringActivator))
|
|
3235
3338
|
return;
|
|
3236
3339
|
}
|
|
3237
|
-
this.$emit("update:modelValue", this.
|
|
3340
|
+
this.$emit("update:modelValue", this.detachableVisible = false);
|
|
3238
3341
|
this.$emit("input", false);
|
|
3239
3342
|
this.$emit("close");
|
|
3240
3343
|
document.removeEventListener("mousedown", this.onOutsideMousedown);
|
|
3241
3344
|
window.removeEventListener("resize", this.onResize);
|
|
3242
|
-
},
|
|
3243
|
-
onOutsideMousedown(e) {
|
|
3244
|
-
if (!this.menuEl.contains(e.target) && !this.activatorEl.contains(e.target)) {
|
|
3245
|
-
this.$emit("update:modelValue", this.menuVisible = false);
|
|
3246
|
-
this.$emit("input", false);
|
|
3247
|
-
this.$emit("close");
|
|
3248
|
-
document.removeEventListener("mousedown", this.onOutsideMousedown);
|
|
3249
|
-
window.removeEventListener("resize", this.onResize);
|
|
3250
|
-
}
|
|
3251
|
-
},
|
|
3252
|
-
onResize() {
|
|
3253
|
-
if (this.minWidth === "activator")
|
|
3254
|
-
this.activatorWidth = this.activatorEl.offsetWidth;
|
|
3255
|
-
this.computeMenuPosition();
|
|
3256
|
-
},
|
|
3257
|
-
getCoordinates(e) {
|
|
3258
|
-
const { top, left, width, height } = (e ? e.target : this.activatorEl).getBoundingClientRect();
|
|
3259
|
-
let coords = { top, left, width, height };
|
|
3260
|
-
if (!this.fixed) {
|
|
3261
|
-
const { top: targetTop, left: targetLeft } = this.menuParentEl.getBoundingClientRect();
|
|
3262
|
-
const computedStyles2 = window.getComputedStyle(this.menuParentEl, null);
|
|
3263
|
-
coords = __spreadProps(__spreadValues({}, coords), {
|
|
3264
|
-
top: top - targetTop + this.menuParentEl.scrollTop - parseInt(computedStyles2.getPropertyValue("border-top-width")),
|
|
3265
|
-
left: left - targetLeft + this.menuParentEl.scrollLeft - parseInt(computedStyles2.getPropertyValue("border-left-width"))
|
|
3266
|
-
});
|
|
3267
|
-
}
|
|
3268
|
-
return coords;
|
|
3269
|
-
},
|
|
3270
|
-
computeMenuPosition(e) {
|
|
3271
|
-
let { top, left, width, height } = this.getCoordinates(e);
|
|
3272
|
-
this.menuEl.style.visibility = "hidden";
|
|
3273
|
-
this.menuEl.style.display = "flex";
|
|
3274
|
-
const computedStyles2 = window.getComputedStyle(this.menuEl, null);
|
|
3275
|
-
switch (this.position) {
|
|
3276
|
-
case "top": {
|
|
3277
|
-
top -= this.menuEl.offsetHeight;
|
|
3278
|
-
if (this.alignRight) {
|
|
3279
|
-
left += width - this.menuEl.offsetWidth + parseInt(computedStyles2.getPropertyValue("border-right-width"));
|
|
3280
|
-
} else if (!this.alignLeft)
|
|
3281
|
-
left += (width - this.menuEl.offsetWidth) / 2;
|
|
3282
|
-
break;
|
|
3283
|
-
}
|
|
3284
|
-
case "bottom": {
|
|
3285
|
-
top += height;
|
|
3286
|
-
if (this.alignRight) {
|
|
3287
|
-
left += width - this.menuEl.offsetWidth + parseInt(computedStyles2.getPropertyValue("border-right-width"));
|
|
3288
|
-
} else if (!this.alignLeft)
|
|
3289
|
-
left += (width - this.menuEl.offsetWidth) / 2;
|
|
3290
|
-
break;
|
|
3291
|
-
}
|
|
3292
|
-
case "left": {
|
|
3293
|
-
left -= this.menuEl.offsetWidth;
|
|
3294
|
-
if (this.alignBottom)
|
|
3295
|
-
top += height - this.menuEl.offsetHeight;
|
|
3296
|
-
else if (!this.alignTop)
|
|
3297
|
-
top += (height - this.menuEl.offsetHeight) / 2;
|
|
3298
|
-
break;
|
|
3299
|
-
}
|
|
3300
|
-
case "right": {
|
|
3301
|
-
left += width;
|
|
3302
|
-
if (this.alignBottom) {
|
|
3303
|
-
top += height - this.menuEl.offsetHeight + parseInt(computedStyles2.getPropertyValue("margin-top"));
|
|
3304
|
-
} else if (!this.alignTop) {
|
|
3305
|
-
top += (height - this.menuEl.offsetHeight) / 2 + parseInt(computedStyles2.getPropertyValue("margin-top"));
|
|
3306
|
-
}
|
|
3307
|
-
break;
|
|
3308
|
-
}
|
|
3309
|
-
}
|
|
3310
|
-
this.menuEl.style.visibility = null;
|
|
3311
|
-
if (!this.menuVisible)
|
|
3312
|
-
this.menuEl.style.display = "none";
|
|
3313
|
-
this.menuCoordinates = { top, left };
|
|
3314
|
-
},
|
|
3315
|
-
insertMenu() {
|
|
3316
|
-
return new Promise((resolve) => {
|
|
3317
|
-
this.$nextTick(() => {
|
|
3318
|
-
var _a;
|
|
3319
|
-
this.menuEl = ((_a = this.$refs.menu) == null ? void 0 : _a.$el) || this.$refs.menu;
|
|
3320
|
-
this.detachToTarget.appendChild(this.menuEl);
|
|
3321
|
-
resolve();
|
|
3322
|
-
});
|
|
3323
|
-
});
|
|
3324
|
-
},
|
|
3325
|
-
removeMenu() {
|
|
3326
|
-
if (this.menuEl && this.menuEl.parentNode)
|
|
3327
|
-
this.menuEl.remove();
|
|
3328
3345
|
}
|
|
3329
3346
|
},
|
|
3330
3347
|
mounted() {
|
|
@@ -3340,7 +3357,7 @@ const __vue2_script$s = {
|
|
|
3340
3357
|
this.toggleMenu({ type: "click", target: this.activatorEl });
|
|
3341
3358
|
},
|
|
3342
3359
|
beforeDestroy() {
|
|
3343
|
-
this.
|
|
3360
|
+
this.removeFromDOM();
|
|
3344
3361
|
if (this.overlay && this.overlayEl.parentNode)
|
|
3345
3362
|
this.overlayEl.remove();
|
|
3346
3363
|
if (this.activatorEl && this.activatorEl.parentNode)
|
|
@@ -3348,12 +3365,16 @@ const __vue2_script$s = {
|
|
|
3348
3365
|
},
|
|
3349
3366
|
watch: {
|
|
3350
3367
|
value(bool) {
|
|
3351
|
-
if (!!bool !== this.
|
|
3368
|
+
if (!!bool !== this.detachableVisible)
|
|
3352
3369
|
this.toggleMenu({ type: "click", target: this.activatorEl });
|
|
3353
3370
|
},
|
|
3354
3371
|
detachTo() {
|
|
3355
|
-
this.
|
|
3356
|
-
this.
|
|
3372
|
+
this.removeFromDOM();
|
|
3373
|
+
this.insertInDOM();
|
|
3374
|
+
},
|
|
3375
|
+
appendTo() {
|
|
3376
|
+
this.removeFromDOM();
|
|
3377
|
+
this.insertInDOM();
|
|
3357
3378
|
}
|
|
3358
3379
|
}
|
|
3359
3380
|
};
|
|
@@ -4018,7 +4039,7 @@ var render$k = function() {
|
|
|
4018
4039
|
var _c = _vm._self._c || _h;
|
|
4019
4040
|
return _c(_vm.formRegister ? "w-form-element" : "div", _vm._b({ ref: "formEl", tag: "component", class: _vm.classes, attrs: { "valid": _vm.valid, "wrap": _vm.hasLabel && _vm.labelPosition !== "inside" }, on: { "update:valid": function($event) {
|
|
4020
4041
|
_vm.valid = $event;
|
|
4021
|
-
}, "reset": _vm.onReset } }, "component", _vm.formRegister && { validators: _vm.validators, inputValue: _vm.selectionString, disabled: _vm.isDisabled, readonly: _vm.isReadonly }, false), [_vm.labelPosition === "left" ? [_vm.$slots.default ? _c("label", { staticClass: "w-select__label w-select__label--left w-form-el-shakable", attrs: { "for": "w-select--" + _vm._uid } }, [_vm._t("default")], 2) : _vm.label ? _c("label", { staticClass: "w-select__label w-select__label--left w-form-el-shakable", attrs: { "for": "w-select--" + _vm._uid }, domProps: { "innerHTML": _vm._s(_vm.label) } }) : _vm._e()] : _vm._e(), _c("w-menu", _vm._b({ attrs: { "menu-class": "w-select__menu " + (_vm.menuClass || ""), "transition": "slide-fade-down", "
|
|
4042
|
+
}, "reset": _vm.onReset } }, "component", _vm.formRegister && { validators: _vm.validators, inputValue: _vm.selectionString, disabled: _vm.isDisabled, readonly: _vm.isReadonly }, false), [_vm.labelPosition === "left" ? [_vm.$slots.default ? _c("label", { staticClass: "w-select__label w-select__label--left w-form-el-shakable", attrs: { "for": "w-select--" + _vm._uid } }, [_vm._t("default")], 2) : _vm.label ? _c("label", { staticClass: "w-select__label w-select__label--left w-form-el-shakable", attrs: { "for": "w-select--" + _vm._uid }, domProps: { "innerHTML": _vm._s(_vm.label) } }) : _vm._e()] : _vm._e(), _c("w-menu", _vm._b({ attrs: { "menu-class": "w-select__menu " + (_vm.menuClass || ""), "transition": "slide-fade-down", "append-to": (_vm.menuProps || {}).appendTo !== void 0 ? (_vm.menuProps || {}).appendTo : ".w-app", "align-left": "", "custom": "", "min-width": "activator" }, scopedSlots: _vm._u([{ key: "activator", fn: function(ref) {
|
|
4022
4043
|
var _obj, _obj$1;
|
|
4023
4044
|
ref.on;
|
|
4024
4045
|
return [_c("div", { ref: "selection-wrap", staticClass: "w-select__selection-wrap", class: _vm.inputWrapClasses, attrs: { "role": "button", "aria-haspopup": "listbox", "aria-expanded": _vm.showMenu ? "true" : "false", "aria-owns": "w-select-menu--" + _vm._uid, "aria-activedescendant": "w-select-menu--" + _vm._uid + "_item-1" }, on: { "click": function($event) {
|
|
@@ -5491,13 +5512,13 @@ var render$8 = function() {
|
|
|
5491
5512
|
var _vm = this;
|
|
5492
5513
|
var _h = _vm.$createElement;
|
|
5493
5514
|
var _c = _vm._self._c || _h;
|
|
5494
|
-
return _c("div", { staticClass: "w-tooltip-wrap"
|
|
5515
|
+
return _c("div", { staticClass: "w-tooltip-wrap" }, [_vm._t("activator", null, { "on": _vm.eventHandlers }), _c("transition", { attrs: { "name": _vm.transitionName, "appear": "" } }, [_vm.detachableVisible ? _c("div", { ref: "detachable", staticClass: "w-tooltip", class: _vm.classes, style: _vm.styles }, [_vm._t("default")], 2) : _vm._e()])], 2);
|
|
5495
5516
|
};
|
|
5496
5517
|
var staticRenderFns$8 = [];
|
|
5497
5518
|
var wTooltip_vue_vue_type_style_index_0_lang = "";
|
|
5498
|
-
const marginFromWindowSide = 4;
|
|
5499
5519
|
const __vue2_script$8 = {
|
|
5500
5520
|
name: "w-tooltip",
|
|
5521
|
+
mixins: [DetachableMixin],
|
|
5501
5522
|
props: {
|
|
5502
5523
|
value: {},
|
|
5503
5524
|
showOnClick: { type: Boolean },
|
|
@@ -5509,25 +5530,31 @@ const __vue2_script$8 = {
|
|
|
5509
5530
|
round: { type: Boolean },
|
|
5510
5531
|
transition: { type: String },
|
|
5511
5532
|
tooltipClass: { type: [String, Object, Array] },
|
|
5512
|
-
detachTo: {},
|
|
5533
|
+
detachTo: { type: [String, Boolean, Object], deprecated: true },
|
|
5534
|
+
appendTo: { type: [String, Boolean, Object] },
|
|
5513
5535
|
fixed: { type: Boolean },
|
|
5514
5536
|
top: { type: Boolean },
|
|
5515
5537
|
bottom: { type: Boolean },
|
|
5516
5538
|
left: { type: Boolean },
|
|
5517
5539
|
right: { type: Boolean },
|
|
5518
|
-
|
|
5540
|
+
alignTop: { type: Boolean },
|
|
5541
|
+
alignBottom: { type: Boolean },
|
|
5542
|
+
alignLeft: { type: Boolean },
|
|
5543
|
+
alignRight: { type: Boolean },
|
|
5544
|
+
zIndex: { type: [Number, String, Boolean] },
|
|
5545
|
+
persistent: { type: Boolean },
|
|
5546
|
+
noPosition: { type: Boolean }
|
|
5519
5547
|
},
|
|
5520
5548
|
emits: ["input", "update:modelValue", "open", "close"],
|
|
5521
5549
|
data: () => ({
|
|
5522
|
-
|
|
5523
|
-
|
|
5550
|
+
detachableVisible: false,
|
|
5551
|
+
hoveringActivator: false,
|
|
5552
|
+
detachableCoords: {
|
|
5524
5553
|
top: 0,
|
|
5525
|
-
left: 0
|
|
5526
|
-
width: 0,
|
|
5527
|
-
height: 0
|
|
5554
|
+
left: 0
|
|
5528
5555
|
},
|
|
5529
5556
|
activatorEl: null,
|
|
5530
|
-
|
|
5557
|
+
detachableEl: null,
|
|
5531
5558
|
timeoutId: null
|
|
5532
5559
|
}),
|
|
5533
5560
|
computed: {
|
|
@@ -5538,68 +5565,23 @@ const __vue2_script$8 = {
|
|
|
5538
5565
|
const direction = this.position.replace(/top|bottom/, (m) => ({ top: "up", bottom: "down" })[m]);
|
|
5539
5566
|
return this.transition || `w-tooltip-slide-fade-${direction}`;
|
|
5540
5567
|
},
|
|
5541
|
-
detachToTarget() {
|
|
5542
|
-
let target = this.detachTo || ".w-app";
|
|
5543
|
-
if (target === true)
|
|
5544
|
-
target = ".w-app";
|
|
5545
|
-
else if (target && !["object", "string"].includes(typeof target))
|
|
5546
|
-
target = ".w-app";
|
|
5547
|
-
else if (typeof target === "object" && !target.nodeType) {
|
|
5548
|
-
target = ".w-app";
|
|
5549
|
-
consoleWarn("Invalid node provided in w-tooltip `attach-to`. Falling back to .w-app.");
|
|
5550
|
-
}
|
|
5551
|
-
if (typeof target === "string")
|
|
5552
|
-
target = document.querySelector(target);
|
|
5553
|
-
if (!target) {
|
|
5554
|
-
consoleWarn(`Unable to locate ${this.detachTo ? `target ${this.detachTo}` : ".w-app"}`);
|
|
5555
|
-
target = document.querySelector(".w-app");
|
|
5556
|
-
}
|
|
5557
|
-
return target;
|
|
5558
|
-
},
|
|
5559
|
-
tooltipParentEl() {
|
|
5560
|
-
return this.detachTo ? this.detachToTarget : this.$el;
|
|
5561
|
-
},
|
|
5562
5568
|
position() {
|
|
5563
5569
|
return this.top && "top" || this.bottom && "bottom" || this.left && "left" || this.right && "right" || "bottom";
|
|
5564
5570
|
},
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
const { top, left, width, height } = this.coordinates;
|
|
5568
|
-
switch (this.position) {
|
|
5569
|
-
case "top": {
|
|
5570
|
-
coords.top = top;
|
|
5571
|
-
coords.left = left + width / 2;
|
|
5572
|
-
break;
|
|
5573
|
-
}
|
|
5574
|
-
case "bottom": {
|
|
5575
|
-
coords.top = top + height;
|
|
5576
|
-
coords.left = left + width / 2;
|
|
5577
|
-
break;
|
|
5578
|
-
}
|
|
5579
|
-
case "left": {
|
|
5580
|
-
coords.top = top + height / 2;
|
|
5581
|
-
coords.left = left;
|
|
5582
|
-
break;
|
|
5583
|
-
}
|
|
5584
|
-
case "right": {
|
|
5585
|
-
coords.top = top + height / 2;
|
|
5586
|
-
coords.left = left + width;
|
|
5587
|
-
break;
|
|
5588
|
-
}
|
|
5589
|
-
}
|
|
5590
|
-
return coords;
|
|
5571
|
+
alignment() {
|
|
5572
|
+
return ["top", "bottom"].includes(this.position) && this.alignLeft && "left" || ["top", "bottom"].includes(this.position) && this.alignRight && "right" || ["left", "right"].includes(this.position) && this.alignTop && "top" || ["left", "right"].includes(this.position) && this.alignBottom && "bottom" || "";
|
|
5591
5573
|
},
|
|
5592
5574
|
classes() {
|
|
5593
5575
|
return __spreadProps(__spreadValues({
|
|
5594
5576
|
[this.color]: this.color,
|
|
5595
5577
|
[`${this.bgColor}--bg`]: this.bgColor
|
|
5596
5578
|
}, this.tooltipClasses), {
|
|
5597
|
-
[`w-tooltip--${this.position}`]:
|
|
5579
|
+
[`w-tooltip--${this.position}`]: !this.noPosition,
|
|
5580
|
+
[`w-tooltip--align-${this.alignment}`]: !this.noPosition && this.alignment,
|
|
5598
5581
|
"w-tooltip--tile": this.tile,
|
|
5599
5582
|
"w-tooltip--round": this.round,
|
|
5600
5583
|
"w-tooltip--shadow": this.shadow,
|
|
5601
5584
|
"w-tooltip--fixed": this.fixed,
|
|
5602
|
-
"w-tooltip--active": this.showTooltip,
|
|
5603
5585
|
"w-tooltip--no-border": this.noBorder || this.bgColor,
|
|
5604
5586
|
"w-tooltip--custom-transition": this.transition
|
|
5605
5587
|
});
|
|
@@ -5607,8 +5589,8 @@ const __vue2_script$8 = {
|
|
|
5607
5589
|
styles() {
|
|
5608
5590
|
return {
|
|
5609
5591
|
zIndex: this.zIndex || this.zIndex === 0 || null,
|
|
5610
|
-
top: this.
|
|
5611
|
-
left: this.
|
|
5592
|
+
top: this.detachableCoords.top && `${~~this.detachableCoords.top}px` || null,
|
|
5593
|
+
left: this.detachableCoords.left && `${~~this.detachableCoords.left}px` || null,
|
|
5612
5594
|
"--w-tooltip-bg-color": this.$waveui.colors[this.bgColor || "white"]
|
|
5613
5595
|
};
|
|
5614
5596
|
},
|
|
@@ -5620,10 +5602,16 @@ const __vue2_script$8 = {
|
|
|
5620
5602
|
handlers = {
|
|
5621
5603
|
focus: this.toggle,
|
|
5622
5604
|
blur: this.toggle,
|
|
5623
|
-
mouseenter:
|
|
5624
|
-
|
|
5605
|
+
mouseenter: (e) => {
|
|
5606
|
+
this.hoveringActivator = true;
|
|
5607
|
+
this.open(e);
|
|
5608
|
+
},
|
|
5609
|
+
mouseleave: (e) => {
|
|
5610
|
+
this.hoveringActivator = false;
|
|
5611
|
+
this.close();
|
|
5612
|
+
}
|
|
5625
5613
|
};
|
|
5626
|
-
if ("ontouchstart" in window)
|
|
5614
|
+
if (typeof window !== "undefined" && "ontouchstart" in window)
|
|
5627
5615
|
handlers.click = this.toggle;
|
|
5628
5616
|
}
|
|
5629
5617
|
return handlers;
|
|
@@ -5631,8 +5619,8 @@ const __vue2_script$8 = {
|
|
|
5631
5619
|
},
|
|
5632
5620
|
methods: {
|
|
5633
5621
|
toggle(e) {
|
|
5634
|
-
let shouldShowTooltip = this.
|
|
5635
|
-
if ("ontouchstart" in window) {
|
|
5622
|
+
let shouldShowTooltip = this.detachableVisible;
|
|
5623
|
+
if (typeof window !== "undefined" && "ontouchstart" in window) {
|
|
5636
5624
|
if (e.type === "click")
|
|
5637
5625
|
shouldShowTooltip = !shouldShowTooltip;
|
|
5638
5626
|
} else if (e.type === "click" && this.showOnClick)
|
|
@@ -5643,89 +5631,69 @@ const __vue2_script$8 = {
|
|
|
5643
5631
|
shouldShowTooltip = false;
|
|
5644
5632
|
this.timeoutId = clearTimeout(this.timeoutId);
|
|
5645
5633
|
if (shouldShowTooltip) {
|
|
5646
|
-
this.
|
|
5647
|
-
this
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
}, 10);
|
|
5653
|
-
} else {
|
|
5654
|
-
this.showTooltip = false;
|
|
5655
|
-
this.$emit("update:modelValue", false);
|
|
5656
|
-
this.$emit("input", false);
|
|
5657
|
-
this.$emit("close");
|
|
5658
|
-
}
|
|
5659
|
-
},
|
|
5660
|
-
getCoordinates() {
|
|
5661
|
-
const { top, left, width, height } = this.activatorEl.getBoundingClientRect();
|
|
5662
|
-
let coords = { top, left, width, height };
|
|
5663
|
-
if (!this.fixed) {
|
|
5664
|
-
const { top: targetTop, left: targetLeft } = this.tooltipParentEl.getBoundingClientRect();
|
|
5665
|
-
coords = __spreadProps(__spreadValues({}, coords), { top: top - targetTop, left: left - targetLeft });
|
|
5666
|
-
}
|
|
5667
|
-
const tooltipEl = this.$refs.tooltip;
|
|
5668
|
-
tooltipEl.style.visibility = "hidden";
|
|
5669
|
-
tooltipEl.style.display = "table";
|
|
5670
|
-
const computedStyles2 = window.getComputedStyle(tooltipEl, null);
|
|
5671
|
-
if (this.position === "top" && top - tooltipEl.offsetHeight < 0) {
|
|
5672
|
-
const margin = -parseInt(computedStyles2.getPropertyValue("margin-top"));
|
|
5673
|
-
coords.top -= top - tooltipEl.offsetHeight - margin - marginFromWindowSide;
|
|
5674
|
-
} else if (this.position === "left" && left - tooltipEl.offsetWidth < 0) {
|
|
5675
|
-
const margin = -parseInt(computedStyles2.getPropertyValue("margin-left"));
|
|
5676
|
-
coords.left -= left - tooltipEl.offsetWidth - margin - marginFromWindowSide;
|
|
5677
|
-
} else if (this.position === "right" && left + width + tooltipEl.offsetWidth > window.innerWidth) {
|
|
5678
|
-
const margin = parseInt(computedStyles2.getPropertyValue("margin-left"));
|
|
5679
|
-
coords.left -= left + width + tooltipEl.offsetWidth - window.innerWidth + margin + marginFromWindowSide;
|
|
5680
|
-
} else if (this.position === "bottom" && top + height + tooltipEl.offsetHeight > window.innerHeight) {
|
|
5681
|
-
const margin = parseInt(computedStyles2.getPropertyValue("margin-top"));
|
|
5682
|
-
coords.top -= top + height + tooltipEl.offsetHeight - window.innerHeight + margin + marginFromWindowSide;
|
|
5683
|
-
}
|
|
5684
|
-
if (this.transition) {
|
|
5685
|
-
if (["top", "bottom"].includes(this.position))
|
|
5686
|
-
coords.left -= tooltipEl.offsetWidth / 2;
|
|
5687
|
-
if (["left", "right"].includes(this.position))
|
|
5688
|
-
coords.top -= tooltipEl.offsetHeight / 2;
|
|
5689
|
-
if (this.position === "left")
|
|
5690
|
-
coords.left -= tooltipEl.offsetWidth;
|
|
5691
|
-
if (this.position === "top")
|
|
5692
|
-
coords.top -= tooltipEl.offsetHeight;
|
|
5693
|
-
}
|
|
5694
|
-
tooltipEl.style.visibility = null;
|
|
5695
|
-
tooltipEl.style.display = "none";
|
|
5696
|
-
return coords;
|
|
5634
|
+
this.$emit("update:modelValue", this.detachableVisible = true);
|
|
5635
|
+
this.$emit("input", true);
|
|
5636
|
+
this.$emit("open");
|
|
5637
|
+
this.open(e);
|
|
5638
|
+
} else
|
|
5639
|
+
this.close();
|
|
5697
5640
|
},
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5641
|
+
async open(e) {
|
|
5642
|
+
this.detachableVisible = true;
|
|
5643
|
+
await this.insertInDOM();
|
|
5644
|
+
if (this.minWidth === "activator")
|
|
5645
|
+
this.activatorWidth = this.activatorEl.offsetWidth;
|
|
5646
|
+
if (!this.noPosition)
|
|
5647
|
+
this.computeDetachableCoords(e);
|
|
5648
|
+
this.timeoutId = setTimeout(() => {
|
|
5649
|
+
this.$emit("update:modelValue", true);
|
|
5650
|
+
this.$emit("input", true);
|
|
5651
|
+
this.$emit("open");
|
|
5652
|
+
}, 0);
|
|
5653
|
+
if (!this.persistent)
|
|
5654
|
+
document.addEventListener("mousedown", this.onOutsideMousedown);
|
|
5655
|
+
if (!this.noPosition)
|
|
5656
|
+
window.addEventListener("resize", this.onResize);
|
|
5703
5657
|
},
|
|
5704
|
-
|
|
5705
|
-
if (this.
|
|
5706
|
-
|
|
5658
|
+
async close(force = false) {
|
|
5659
|
+
if (!this.detachableVisible)
|
|
5660
|
+
return;
|
|
5661
|
+
if (this.showOnHover && !force) {
|
|
5662
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
5663
|
+
if (this.showOnHover && this.hoveringActivator)
|
|
5664
|
+
return;
|
|
5665
|
+
}
|
|
5666
|
+
this.$emit("update:modelValue", this.detachableVisible = false);
|
|
5667
|
+
this.$emit("input", false);
|
|
5668
|
+
this.$emit("close");
|
|
5669
|
+
document.removeEventListener("mousedown", this.onOutsideMousedown);
|
|
5670
|
+
window.removeEventListener("resize", this.onResize);
|
|
5707
5671
|
}
|
|
5708
5672
|
},
|
|
5709
5673
|
mounted() {
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5674
|
+
const wrapper = this.$el;
|
|
5675
|
+
this.activatorEl = wrapper.firstElementChild;
|
|
5676
|
+
wrapper.parentNode.insertBefore(this.activatorEl, wrapper);
|
|
5713
5677
|
if (this.value)
|
|
5714
5678
|
this.toggle({ type: "click", target: this.activatorEl });
|
|
5715
5679
|
},
|
|
5716
5680
|
beforeDestroy() {
|
|
5717
|
-
this.
|
|
5681
|
+
this.removeFromDOM();
|
|
5718
5682
|
if (this.activatorEl && this.activatorEl.parentNode)
|
|
5719
5683
|
this.activatorEl.remove();
|
|
5720
5684
|
},
|
|
5721
5685
|
watch: {
|
|
5722
5686
|
value(bool) {
|
|
5723
|
-
if (bool !== this.
|
|
5687
|
+
if (bool !== this.detachableVisible)
|
|
5724
5688
|
this.toggle({ type: "click", target: this.activatorEl });
|
|
5725
5689
|
},
|
|
5726
5690
|
detachTo() {
|
|
5727
|
-
this.
|
|
5728
|
-
this.
|
|
5691
|
+
this.removeFromDOM();
|
|
5692
|
+
this.insertInDOM();
|
|
5693
|
+
},
|
|
5694
|
+
appendTo() {
|
|
5695
|
+
this.removeFromDOM();
|
|
5696
|
+
this.insertInDOM();
|
|
5729
5697
|
}
|
|
5730
5698
|
}
|
|
5731
5699
|
};
|