wave-ui 1.45.15 → 1.49.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 +415 -382
- package/dist/wave-ui.umd.js +1 -1
- package/package.json +4 -2
- package/src/wave-ui/components/w-alert.vue +0 -1
- package/src/wave-ui/components/w-confirm.vue +35 -10
- package/src/wave-ui/components/w-input.vue +117 -34
- package/src/wave-ui/components/w-menu.vue +69 -275
- package/src/wave-ui/components/w-notification-manager.vue +9 -2
- 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 +106 -220
- package/src/wave-ui/mixins/detachable.js +321 -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
|
@@ -804,7 +804,7 @@ var render$M = function() {
|
|
|
804
804
|
return _vm.notifManager.dismiss(notif._uid);
|
|
805
805
|
} }, model: { value: notif._value, callback: function($$v) {
|
|
806
806
|
_vm.$set(notif, "_value", $$v);
|
|
807
|
-
}, expression: "notif._value" } }, "w-alert", notif, false), [
|
|
807
|
+
}, expression: "notif._value" } }, "w-alert", _vm.notifProps(notif), false), [_c("div", { domProps: { "innerHTML": _vm._s(notif.message) } })]) : _vm._e()];
|
|
808
808
|
})], 2);
|
|
809
809
|
};
|
|
810
810
|
var staticRenderFns$M = [];
|
|
@@ -826,6 +826,12 @@ const __vue2_script$M = {
|
|
|
826
826
|
return this.conf.transition ? this.conf.transition.replace("default", `slide-${this.conf.align === "left" ? "right" : "left"}`) : "";
|
|
827
827
|
}
|
|
828
828
|
},
|
|
829
|
+
methods: {
|
|
830
|
+
notifProps(notif) {
|
|
831
|
+
const _a = notif, { _value, _uid: _uid2, message, timeout } = _a, props = __objRest(_a, ["_value", "_uid", "message", "timeout"]);
|
|
832
|
+
return props;
|
|
833
|
+
}
|
|
834
|
+
},
|
|
829
835
|
created() {
|
|
830
836
|
this.notifManager = new NotificationManager$1();
|
|
831
837
|
},
|
|
@@ -1600,15 +1606,15 @@ var render$E = function() {
|
|
|
1600
1606
|
var _c = _vm._self._c || _h;
|
|
1601
1607
|
return _c("div", { staticClass: "w-confirm" }, [_c("w-menu", _vm._b({ scopedSlots: _vm._u([{ key: "activator", fn: function(ref) {
|
|
1602
1608
|
var on = ref.on;
|
|
1603
|
-
return [_c("w-button", _vm._g(_vm._b({ staticClass: "w-confirm__button" }, "w-button", _vm.buttonProps, false), on), [_vm._t("default")], 2)];
|
|
1609
|
+
return [_c("w-button", _vm._g(_vm._b({ staticClass: "w-confirm__button" }, "w-button", _vm.buttonProps, false), Object.assign({}, _vm.$listeners, on)), [_vm._t("default")], 2)];
|
|
1604
1610
|
} }], null, true), model: { value: _vm.showPopup, callback: function($$v) {
|
|
1605
1611
|
_vm.showPopup = $$v;
|
|
1606
1612
|
}, expression: "showPopup" } }, "w-menu", _vm.wMenuProps, false), [_c("w-flex", { attrs: { "column": !_vm.inline, "align-center": "" } }, [_c("div", [_vm._t("question", function() {
|
|
1607
|
-
return [_vm._v(
|
|
1608
|
-
})], 2), _c("div", { staticClass: "w-flex justify-end", class: _vm.inline ? "ml2" : "mt2" }, [
|
|
1609
|
-
return [_vm._v(
|
|
1610
|
-
})], 2) : _vm._e(), _c("w-button", _vm._b({ attrs: { "bg-color": (_vm.confirmButton || {}).bgColor || "success" }, on: { "click": _vm.onConfirm } }, "w-button", _vm.
|
|
1611
|
-
return [_vm._v(
|
|
1613
|
+
return [_vm._v(_vm._s(_vm.question))];
|
|
1614
|
+
})], 2), _c("div", { staticClass: "w-flex justify-end", class: _vm.inline ? "ml2" : "mt2" }, [_vm.cancel !== false ? _c("w-button", _vm._b({ staticClass: "mr2", attrs: { "bg-color": (_vm.cancelButton || {}).bgColor || "error" }, on: { "click": _vm.onCancel } }, "w-button", _vm.cancelButtonProps, false), [_vm._t("cancel", function() {
|
|
1615
|
+
return [_vm._v(_vm._s(_vm.cancelButton.label))];
|
|
1616
|
+
})], 2) : _vm._e(), _c("w-button", _vm._b({ attrs: { "bg-color": (_vm.confirmButton || {}).bgColor || "success" }, on: { "click": _vm.onConfirm } }, "w-button", _vm.confirmButtonProps, false), [_vm._t("confirm", function() {
|
|
1617
|
+
return [_vm._v(_vm._s(_vm.confirmButton.label))];
|
|
1612
1618
|
})], 2)], 1)])], 1)], 1);
|
|
1613
1619
|
};
|
|
1614
1620
|
var staticRenderFns$E = [];
|
|
@@ -1619,9 +1625,9 @@ const __vue2_script$E = {
|
|
|
1619
1625
|
color: { type: String },
|
|
1620
1626
|
icon: { type: String },
|
|
1621
1627
|
mainButton: { type: Object },
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1628
|
+
question: { type: String, default: "Are you sure?" },
|
|
1629
|
+
cancel: { type: [Boolean, Object, String], default: void 0 },
|
|
1630
|
+
confirm: { type: [Object, String] },
|
|
1625
1631
|
inline: { type: Boolean },
|
|
1626
1632
|
menu: { type: Object },
|
|
1627
1633
|
noArrow: { type: Boolean },
|
|
@@ -1642,6 +1648,26 @@ const __vue2_script$E = {
|
|
|
1642
1648
|
props: []
|
|
1643
1649
|
}),
|
|
1644
1650
|
computed: {
|
|
1651
|
+
cancelButton() {
|
|
1652
|
+
let button = { label: typeof this.cancel === "string" ? this.cancel : "Cancel" };
|
|
1653
|
+
if (typeof this.cancel === "object")
|
|
1654
|
+
button = Object.assign({}, button, this.cancel);
|
|
1655
|
+
return button;
|
|
1656
|
+
},
|
|
1657
|
+
cancelButtonProps() {
|
|
1658
|
+
const _a = this.cancelButton, { label } = _a, props = __objRest(_a, ["label"]);
|
|
1659
|
+
return props;
|
|
1660
|
+
},
|
|
1661
|
+
confirmButton() {
|
|
1662
|
+
let button = { label: typeof this.confirm === "string" ? this.confirm : "Confirm" };
|
|
1663
|
+
if (typeof this.confirm === "object")
|
|
1664
|
+
button = Object.assign({}, button, this.confirm);
|
|
1665
|
+
return button;
|
|
1666
|
+
},
|
|
1667
|
+
confirmButtonProps() {
|
|
1668
|
+
const _a = this.confirmButton, { label } = _a, props = __objRest(_a, ["label"]);
|
|
1669
|
+
return props;
|
|
1670
|
+
},
|
|
1645
1671
|
wMenuProps() {
|
|
1646
1672
|
return __spreadValues({
|
|
1647
1673
|
top: this.top,
|
|
@@ -2511,7 +2537,6 @@ var wImage = /* @__PURE__ */ function() {
|
|
|
2511
2537
|
return __component__$v.exports;
|
|
2512
2538
|
}();
|
|
2513
2539
|
var render$u = function() {
|
|
2514
|
-
var _obj, _obj$1;
|
|
2515
2540
|
var _vm = this;
|
|
2516
2541
|
var _h = _vm.$createElement;
|
|
2517
2542
|
var _c = _vm._self._c || _h;
|
|
@@ -2525,7 +2550,7 @@ var render$u = function() {
|
|
|
2525
2550
|
return;
|
|
2526
2551
|
}
|
|
2527
2552
|
_vm.inputValue = $event.target.value;
|
|
2528
|
-
} } }) : [_vm.labelPosition === "left" ? [_vm.$slots.default ? _c("label", { staticClass: "w-input__label w-input__label--left w-form-el-shakable", attrs: { "for": "w-input--" + _vm._uid } }, [_vm._t("default")], 2) : _vm.label ? _c("label", { staticClass: "w-input__label w-input__label--left w-form-el-shakable", attrs: { "for": "w-input--" + _vm._uid }, domProps: { "innerHTML": _vm._s(_vm.label) } }) : _vm._e()] : _vm._e(), _c("div", { staticClass: "w-input__input-wrap", class: _vm.inputWrapClasses }, [_vm.innerIconLeft ? _c("w-icon", { staticClass: "w-input__icon w-input__icon--inner-left", attrs: { "tag": "label", "for": "w-input--" + _vm._uid }, on: { "click": function($event) {
|
|
2553
|
+
} } }) : [_vm.labelPosition === "left" ? [_vm.$slots.default ? _c("label", { staticClass: "w-input__label w-input__label--left w-form-el-shakable", class: _vm.validationClasses, attrs: { "for": "w-input--" + _vm._uid } }, [_vm._t("default")], 2) : _vm.label ? _c("label", { staticClass: "w-input__label w-input__label--left w-form-el-shakable", class: _vm.validationClasses, attrs: { "for": "w-input--" + _vm._uid }, domProps: { "innerHTML": _vm._s(_vm.label) } }) : _vm._e()] : _vm._e(), _c("div", { staticClass: "w-input__input-wrap", class: _vm.inputWrapClasses }, [_vm.innerIconLeft ? _c("w-icon", { staticClass: "w-input__icon w-input__icon--inner-left", attrs: { "tag": "label", "for": "w-input--" + _vm._uid }, on: { "click": function($event) {
|
|
2529
2554
|
return _vm.$emit("click:inner-icon-left", $event);
|
|
2530
2555
|
} } }, [_vm._v(_vm._s(_vm.innerIconLeft))]) : _vm._e(), _vm.type === "checkbox" && _vm.type !== "file" ? _c("input", _vm._g(_vm._b({ directives: [{ name: "model", rawName: "v-model", value: _vm.inputValue, expression: "inputValue" }], ref: "input", staticClass: "w-input__input", attrs: { "id": "w-input--" + _vm._uid, "name": _vm.inputName, "placeholder": _vm.placeholder || null, "step": _vm.step || null, "min": _vm.min || null, "max": _vm.max || null, "minlength": _vm.minlength || null, "maxlength": _vm.maxlength || null, "readonly": _vm.isReadonly || null, "aria-readonly": _vm.isReadonly ? "true" : "false", "disabled": _vm.isDisabled || null, "required": _vm.required || null, "tabindex": _vm.tabindex || null, "type": "checkbox" }, domProps: { "checked": Array.isArray(_vm.inputValue) ? _vm._i(_vm.inputValue, null) > -1 : _vm.inputValue }, on: { "input": _vm.onInput, "focus": _vm.onFocus, "blur": _vm.onBlur, "change": function($event) {
|
|
2531
2556
|
var $$a = _vm.inputValue, $$el = $event.target, $$c = $$el.checked ? true : false;
|
|
@@ -2546,15 +2571,15 @@ var render$u = function() {
|
|
|
2546
2571
|
return;
|
|
2547
2572
|
}
|
|
2548
2573
|
_vm.inputValue = $event.target.value;
|
|
2549
|
-
}, _vm.onInput], "focus": _vm.onFocus, "blur": _vm.onBlur } }, "input", _vm.attrs, false), _vm.listeners)) : [_c("input", _vm._b({ ref: "input", attrs: { "id": "w-input--" + _vm._uid, "type": "file", "name": _vm.name || null, "multiple": _vm.multiple || null }, on: { "focus": _vm.onFocus, "blur": _vm.onBlur, "change": _vm.onFileChange } }, "input", _vm.attrs, false)), _c("transition-group", { staticClass: "w-input__input w-input__input--file", attrs: { "tag": "label", "name": "fade", "for": "w-input--" + _vm._uid } }, [!_vm.inputFiles.length && _vm.isFocused ? _c("span", { key: "no-file", staticClass: "w-input__no-file" }, [_vm._t("no-file", function() {
|
|
2574
|
+
}, _vm.onInput], "focus": _vm.onFocus, "blur": _vm.onBlur } }, "input", _vm.attrs, false), _vm.listeners)) : [_c("input", _vm._b({ ref: "input", attrs: { "id": "w-input--" + _vm._uid, "type": "file", "name": _vm.name || null, "multiple": _vm.multiple || null, "data-progress": _vm.overallFilesProgress }, on: { "focus": _vm.onFocus, "blur": _vm.onBlur, "change": _vm.onFileChange } }, "input", _vm.attrs, false)), _c("transition-group", { staticClass: "w-input__input w-input__input--file", attrs: { "tag": "label", "name": "fade", "for": "w-input--" + _vm._uid } }, [!_vm.inputFiles.length && _vm.isFocused ? _c("span", { key: "no-file", staticClass: "w-input__no-file" }, [_vm._t("no-file", function() {
|
|
2550
2575
|
return [_vm.$slots["no-file"] === void 0 ? [_vm._v("No file")] : _vm._e()];
|
|
2551
2576
|
})], 2) : _vm._e(), _vm._l(_vm.inputFiles, function(file, i) {
|
|
2552
|
-
return _c("span", { key: file.lastModified }, [_vm._v(_vm._s(i ? ", " : "")), _c("span", { key: i + "b", staticClass: "filename" }, [_vm._v(_vm._s(file.base))]), _vm._v(_vm._s(file.extension))]);
|
|
2553
|
-
})], 2)], _vm.labelPosition === "inside" && _vm.showLabelInside ? [_vm.$slots.default ? _c("label", { staticClass: "w-input__label w-input__label--inside w-form-el-shakable", class: _vm.
|
|
2577
|
+
return _c("span", { key: file.lastModified }, [_vm._v(_vm._s(i ? ", " : "")), _c("span", { key: i + "b", staticClass: "filename" }, [_vm._v(_vm._s(file.base))]), _vm._v(_vm._s(file.extension ? "." + file.extension : ""))]);
|
|
2578
|
+
})], 2)], _vm.labelPosition === "inside" && _vm.showLabelInside ? [_vm.$slots.default ? _c("label", { staticClass: "w-input__label w-input__label--inside w-form-el-shakable", class: _vm.validationClasses, attrs: { "for": "w-input--" + _vm._uid } }, [_vm._t("default")], 2) : _vm.label ? _c("label", { staticClass: "w-input__label w-input__label--inside w-form-el-shakable", class: _vm.validationClasses, attrs: { "for": "w-input--" + _vm._uid }, domProps: { "innerHTML": _vm._s(_vm.label) } }) : _vm._e()] : _vm._e(), _vm.innerIconRight ? _c("w-icon", { staticClass: "w-input__icon w-input__icon--inner-right", attrs: { "tag": "label", "for": "w-input--" + _vm._uid }, on: { "click": function($event) {
|
|
2554
2579
|
return _vm.$emit("click:inner-icon-right", $event);
|
|
2555
|
-
} } }, [_vm._v(_vm._s(_vm.innerIconRight))]) : _vm._e()], 2), _vm.type === "file" && _vm.inputFiles.length ? _c("label", { staticClass: "d-flex", attrs: { "for": "w-input--" + _vm._uid } }, [_vm._l(_vm.inputFiles, function(file, i) {
|
|
2556
|
-
return [file.progress < 100 ? _c("i", { key: i, staticClass: "w-icon wi-spinner w-icon--spin size--sm w-input__file-preview primary" }) : file.preview ? _c("img", { key: i, staticClass: "w-input__file-preview", attrs: { "src": file.preview, "alt": "" } }) : _c("i", { key: i, staticClass: "w-icon
|
|
2557
|
-
})], 2) : _vm._e(), _vm.labelPosition === "right" ? [_vm.$slots.default ? _c("label", { staticClass: "w-input__label w-input__label--right w-form-el-shakable", attrs: { "for": "w-input--" + _vm._uid } }, [_vm._t("default")], 2) : _vm.label ? _c("label", { staticClass: "w-input__label w-input__label--right w-form-el-shakable", attrs: { "for": "w-input--" + _vm._uid }, domProps: { "innerHTML": _vm._s(_vm.label) } }) : _vm._e()] : _vm._e()
|
|
2580
|
+
} } }, [_vm._v(_vm._s(_vm.innerIconRight))]) : _vm._e(), _vm.hasLoading || _vm.showProgress && (_vm.uploadInProgress || _vm.uploadComplete) ? _c("w-progress", { staticClass: "fill-width", attrs: { "size": "2", "color": _vm.progressColor || _vm.color, "value": _vm.showProgress ? (_vm.uploadInProgress || _vm.uploadComplete) && _vm.overallFilesProgress : _vm.loadingValue } }) : _vm._e()], 2), _vm.type === "file" && _vm.preview && _vm.inputFiles.length ? _c("label", { staticClass: "d-flex", attrs: { "for": "w-input--" + _vm._uid } }, [_vm._l(_vm.inputFiles, function(file, i) {
|
|
2581
|
+
return [file.progress < 100 ? _c("i", { key: i, staticClass: "w-icon wi-spinner w-icon--spin size--sm w-input__file-preview primary" }) : file.preview ? _c("img", { key: i, staticClass: "w-input__file-preview", attrs: { "src": file.preview, "alt": "" } }) : _c("i", { key: i, staticClass: "w-icon w-input__file-preview primary size--md", class: _vm.preview && typeof _vm.preview === "string" ? _vm.preview : "wi-file" })];
|
|
2582
|
+
})], 2) : _vm._e(), _vm.labelPosition === "right" ? [_vm.$slots.default ? _c("label", { staticClass: "w-input__label w-input__label--right w-form-el-shakable", class: _vm.validationClasses, attrs: { "for": "w-input--" + _vm._uid } }, [_vm._t("default")], 2) : _vm.label ? _c("label", { staticClass: "w-input__label w-input__label--right w-form-el-shakable", class: _vm.validationClasses, attrs: { "for": "w-input--" + _vm._uid }, domProps: { "innerHTML": _vm._s(_vm.label) } }) : _vm._e()] : _vm._e()]], 2);
|
|
2558
2583
|
};
|
|
2559
2584
|
var staticRenderFns$u = [];
|
|
2560
2585
|
var wInput_vue_vue_type_style_index_0_lang = "";
|
|
@@ -2584,10 +2609,12 @@ const __vue2_script$u = {
|
|
|
2584
2609
|
shadow: { type: Boolean },
|
|
2585
2610
|
tile: { type: Boolean },
|
|
2586
2611
|
multiple: { type: Boolean },
|
|
2587
|
-
preview: { type: Boolean },
|
|
2588
|
-
loading: { type: Boolean }
|
|
2612
|
+
preview: { type: [Boolean, String], default: true },
|
|
2613
|
+
loading: { type: [Boolean, Number], default: false },
|
|
2614
|
+
showProgress: { type: [Boolean] },
|
|
2615
|
+
files: { type: Array }
|
|
2589
2616
|
},
|
|
2590
|
-
emits: ["input", "update:modelValue", "focus", "blur", "click:inner-icon-left", "click:inner-icon-right"],
|
|
2617
|
+
emits: ["input", "update:modelValue", "focus", "blur", "click:inner-icon-left", "click:inner-icon-right", "update:overallProgress"],
|
|
2591
2618
|
data() {
|
|
2592
2619
|
return {
|
|
2593
2620
|
inputValue: this.value,
|
|
@@ -2608,14 +2635,48 @@ const __vue2_script$u = {
|
|
|
2608
2635
|
return listeners;
|
|
2609
2636
|
},
|
|
2610
2637
|
hasValue() {
|
|
2611
|
-
|
|
2638
|
+
switch (this.type) {
|
|
2639
|
+
case "file":
|
|
2640
|
+
return !!this.inputFiles.length;
|
|
2641
|
+
case "number":
|
|
2642
|
+
return this.inputNumberError;
|
|
2643
|
+
case "date":
|
|
2644
|
+
case "time":
|
|
2645
|
+
return true;
|
|
2646
|
+
default:
|
|
2647
|
+
return this.inputValue || this.inputValue === 0;
|
|
2648
|
+
}
|
|
2612
2649
|
},
|
|
2613
2650
|
hasLabel() {
|
|
2614
2651
|
return this.label || this.$slots.default;
|
|
2615
2652
|
},
|
|
2653
|
+
hasLoading() {
|
|
2654
|
+
return ![void 0, false].includes(this.loading);
|
|
2655
|
+
},
|
|
2656
|
+
loadingValue() {
|
|
2657
|
+
let value;
|
|
2658
|
+
if (typeof this.loading === "number")
|
|
2659
|
+
value = this.loading;
|
|
2660
|
+
else if (this.loading) {
|
|
2661
|
+
value = this.type === "file" && this.overallFilesProgress ? this.overallFilesProgress : void 0;
|
|
2662
|
+
}
|
|
2663
|
+
return value;
|
|
2664
|
+
},
|
|
2616
2665
|
showLabelInside() {
|
|
2617
2666
|
return !this.staticLabel || !this.hasValue && !this.placeholder;
|
|
2618
2667
|
},
|
|
2668
|
+
overallFilesProgress() {
|
|
2669
|
+
const progress = this.inputFiles.reduce((total2, file) => total2 + file.progress, 0);
|
|
2670
|
+
const total = progress / this.inputFiles.length;
|
|
2671
|
+
this.$emit("update:overallProgress", this.inputFiles.length ? total : void 0);
|
|
2672
|
+
return total;
|
|
2673
|
+
},
|
|
2674
|
+
uploadInProgress() {
|
|
2675
|
+
return this.overallFilesProgress > 0 && this.overallFilesProgress < 100;
|
|
2676
|
+
},
|
|
2677
|
+
uploadComplete() {
|
|
2678
|
+
return this.overallFilesProgress === 100;
|
|
2679
|
+
},
|
|
2619
2680
|
classes() {
|
|
2620
2681
|
return {
|
|
2621
2682
|
"w-input": true,
|
|
@@ -2632,6 +2693,11 @@ const __vue2_script$u = {
|
|
|
2632
2693
|
"w-input--inner-icon-right": this.innerIconRight
|
|
2633
2694
|
};
|
|
2634
2695
|
},
|
|
2696
|
+
validationClasses() {
|
|
2697
|
+
return this.isFocused && {
|
|
2698
|
+
[this.valid === false ? "error" : this.color]: this.color || this.valid === false
|
|
2699
|
+
};
|
|
2700
|
+
},
|
|
2635
2701
|
inputWrapClasses() {
|
|
2636
2702
|
return {
|
|
2637
2703
|
[this.valid === false ? "error" : this.color]: this.color || this.valid === false,
|
|
@@ -2643,7 +2709,8 @@ const __vue2_script$u = {
|
|
|
2643
2709
|
"w-input__input-wrap--underline": !this.outline,
|
|
2644
2710
|
"w-input__input-wrap--shadow": this.shadow,
|
|
2645
2711
|
"w-input__input-wrap--no-padding": !this.outline && !this.bgColor && !this.shadow && !this.round,
|
|
2646
|
-
"w-input__input-wrap--loading": this.loading
|
|
2712
|
+
"w-input__input-wrap--loading": this.loading || this.showProgress && this.uploadInProgress,
|
|
2713
|
+
"w-input__input-wrap--upload-complete": this.uploadComplete
|
|
2647
2714
|
};
|
|
2648
2715
|
}
|
|
2649
2716
|
},
|
|
@@ -2663,31 +2730,34 @@ const __vue2_script$u = {
|
|
|
2663
2730
|
},
|
|
2664
2731
|
onFileChange(e) {
|
|
2665
2732
|
this.$set(this, "inputFiles", [...e.target.files].map((original) => {
|
|
2666
|
-
const [, base, extension] = original.name.match(/^(
|
|
2733
|
+
const [, base = "", extension = "", full = ""] = original.name.match(/^(.*?)\.([^.]*)$|(.*)/);
|
|
2667
2734
|
const file = Object.assign({}, {
|
|
2668
2735
|
name: original.name,
|
|
2669
|
-
base,
|
|
2736
|
+
base: base || full,
|
|
2670
2737
|
extension,
|
|
2671
2738
|
type: original.type,
|
|
2672
2739
|
size: original.size,
|
|
2673
2740
|
lastModified: original.lastModified,
|
|
2674
2741
|
preview: null,
|
|
2675
|
-
progress: 0
|
|
2742
|
+
progress: 0,
|
|
2743
|
+
file: original
|
|
2676
2744
|
});
|
|
2677
|
-
this.
|
|
2745
|
+
this.readFile(original, file);
|
|
2678
2746
|
return file;
|
|
2679
2747
|
}));
|
|
2680
2748
|
this.$emit("update:modelValue", this.inputFiles);
|
|
2681
2749
|
this.$emit("input", this.inputFiles);
|
|
2682
|
-
this.$emit("change", this.inputFiles);
|
|
2683
2750
|
},
|
|
2684
|
-
|
|
2751
|
+
readFile(original, file) {
|
|
2685
2752
|
const reader = new FileReader();
|
|
2686
|
-
|
|
2753
|
+
const isPreviewAnIcon = typeof this.preview === "string";
|
|
2754
|
+
const isFileAnImage = original.type && original.type.startsWith("image/");
|
|
2755
|
+
if (this.preview && !isPreviewAnIcon && isFileAnImage) {
|
|
2687
2756
|
reader.addEventListener("load", (e) => {
|
|
2688
2757
|
this.$set(file, "preview", e.target.result);
|
|
2689
2758
|
});
|
|
2690
|
-
}
|
|
2759
|
+
} else
|
|
2760
|
+
delete file.preview;
|
|
2691
2761
|
reader.addEventListener("progress", (event) => {
|
|
2692
2762
|
if (event.loaded && event.total) {
|
|
2693
2763
|
this.$set(file, "progress", event.loaded * 100 / event.total);
|
|
@@ -3014,34 +3084,249 @@ function __vue2_injectStyles$t(context) {
|
|
|
3014
3084
|
var wList = /* @__PURE__ */ function() {
|
|
3015
3085
|
return __component__$t.exports;
|
|
3016
3086
|
}();
|
|
3087
|
+
var DetachableMixin = {
|
|
3088
|
+
props: {
|
|
3089
|
+
detachTo: { type: [String, Boolean, Object], deprecated: true },
|
|
3090
|
+
appendTo: { type: [String, Boolean, Object] },
|
|
3091
|
+
fixed: { type: Boolean },
|
|
3092
|
+
top: { type: Boolean },
|
|
3093
|
+
bottom: { type: Boolean },
|
|
3094
|
+
left: { type: Boolean },
|
|
3095
|
+
right: { type: Boolean },
|
|
3096
|
+
alignTop: { type: Boolean },
|
|
3097
|
+
alignBottom: { type: Boolean },
|
|
3098
|
+
alignLeft: { type: Boolean },
|
|
3099
|
+
alignRight: { type: Boolean },
|
|
3100
|
+
noPosition: { type: Boolean },
|
|
3101
|
+
zIndex: { type: [Number, String, Boolean] },
|
|
3102
|
+
activator: { type: String }
|
|
3103
|
+
},
|
|
3104
|
+
data: () => ({
|
|
3105
|
+
docAEventListenersHandlers: []
|
|
3106
|
+
}),
|
|
3107
|
+
computed: {
|
|
3108
|
+
appendToTarget() {
|
|
3109
|
+
const defaultTarget = ".w-app";
|
|
3110
|
+
if (this.detachTo && !this.appendTo) {
|
|
3111
|
+
consoleWarn(`The ${this.$options.name} prop \`detach-to\` is deprecated. You can replace it with \`append-to\`.`);
|
|
3112
|
+
}
|
|
3113
|
+
let target = this.appendTo || this.detachTo || defaultTarget;
|
|
3114
|
+
if (target === true)
|
|
3115
|
+
target = defaultTarget;
|
|
3116
|
+
else if (this.appendTo === "activator")
|
|
3117
|
+
target = this.$el.previousElementSibling;
|
|
3118
|
+
else if (target && !["object", "string"].includes(typeof target))
|
|
3119
|
+
target = defaultTarget;
|
|
3120
|
+
else if (typeof target === "object" && !target.nodeType) {
|
|
3121
|
+
target = defaultTarget;
|
|
3122
|
+
consoleWarn(`Invalid node provided in ${this.$options.name} \`append-to\`. Falling back to .w-app.`);
|
|
3123
|
+
}
|
|
3124
|
+
if (typeof target === "string")
|
|
3125
|
+
target = document.querySelector(target);
|
|
3126
|
+
if (!target) {
|
|
3127
|
+
consoleWarn(`Unable to locate ${this.appendTo ? `target ${this.appendTo}` : defaultTarget}`);
|
|
3128
|
+
target = document.querySelector(defaultTarget);
|
|
3129
|
+
}
|
|
3130
|
+
return target;
|
|
3131
|
+
},
|
|
3132
|
+
detachableParentEl() {
|
|
3133
|
+
return this.appendToTarget;
|
|
3134
|
+
},
|
|
3135
|
+
hasSeparateActivator() {
|
|
3136
|
+
return !this.$scopedSlots.activator && typeof this.activator === "string";
|
|
3137
|
+
},
|
|
3138
|
+
activatorEl: {
|
|
3139
|
+
get() {
|
|
3140
|
+
if (this.hasSeparateActivator)
|
|
3141
|
+
return document.querySelector(this.activator);
|
|
3142
|
+
return this.$el.firstElementChild;
|
|
3143
|
+
},
|
|
3144
|
+
set() {
|
|
3145
|
+
}
|
|
3146
|
+
},
|
|
3147
|
+
position() {
|
|
3148
|
+
return this.top && "top" || this.bottom && "bottom" || this.left && "left" || this.right && "right" || "bottom";
|
|
3149
|
+
},
|
|
3150
|
+
alignment() {
|
|
3151
|
+
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" || "";
|
|
3152
|
+
}
|
|
3153
|
+
},
|
|
3154
|
+
methods: {
|
|
3155
|
+
getActivatorCoordinates(e) {
|
|
3156
|
+
const { top, left, width, height } = (e ? e.target : this.activatorEl).getBoundingClientRect();
|
|
3157
|
+
let coords = { top, left, width, height };
|
|
3158
|
+
if (!this.fixed) {
|
|
3159
|
+
const { top: targetTop, left: targetLeft } = this.detachableParentEl.getBoundingClientRect();
|
|
3160
|
+
const computedStyles2 = window.getComputedStyle(this.detachableParentEl, null);
|
|
3161
|
+
coords = __spreadProps(__spreadValues({}, coords), {
|
|
3162
|
+
top: top - targetTop + this.detachableParentEl.scrollTop - parseInt(computedStyles2.getPropertyValue("border-top-width")),
|
|
3163
|
+
left: left - targetLeft + this.detachableParentEl.scrollLeft - parseInt(computedStyles2.getPropertyValue("border-left-width"))
|
|
3164
|
+
});
|
|
3165
|
+
}
|
|
3166
|
+
return coords;
|
|
3167
|
+
},
|
|
3168
|
+
computeDetachableCoords(e) {
|
|
3169
|
+
let { top, left, width, height } = this.getActivatorCoordinates(e);
|
|
3170
|
+
this.detachableEl.style.visibility = "hidden";
|
|
3171
|
+
this.detachableEl.style.display = "flex";
|
|
3172
|
+
const computedStyles2 = window.getComputedStyle(this.detachableEl, null);
|
|
3173
|
+
switch (this.position) {
|
|
3174
|
+
case "top": {
|
|
3175
|
+
top -= this.detachableEl.offsetHeight;
|
|
3176
|
+
if (this.alignRight) {
|
|
3177
|
+
left += width - this.detachableEl.offsetWidth + parseInt(computedStyles2.getPropertyValue("border-right-width"));
|
|
3178
|
+
} else if (!this.alignLeft)
|
|
3179
|
+
left += (width - this.detachableEl.offsetWidth) / 2;
|
|
3180
|
+
break;
|
|
3181
|
+
}
|
|
3182
|
+
case "bottom": {
|
|
3183
|
+
top += height;
|
|
3184
|
+
if (this.alignRight) {
|
|
3185
|
+
left += width - this.detachableEl.offsetWidth + parseInt(computedStyles2.getPropertyValue("border-right-width"));
|
|
3186
|
+
} else if (!this.alignLeft)
|
|
3187
|
+
left += (width - this.detachableEl.offsetWidth) / 2;
|
|
3188
|
+
break;
|
|
3189
|
+
}
|
|
3190
|
+
case "left": {
|
|
3191
|
+
left -= this.detachableEl.offsetWidth;
|
|
3192
|
+
if (this.alignBottom)
|
|
3193
|
+
top += height - this.detachableEl.offsetHeight;
|
|
3194
|
+
else if (!this.alignTop)
|
|
3195
|
+
top += (height - this.detachableEl.offsetHeight) / 2;
|
|
3196
|
+
break;
|
|
3197
|
+
}
|
|
3198
|
+
case "right": {
|
|
3199
|
+
left += width;
|
|
3200
|
+
if (this.alignBottom) {
|
|
3201
|
+
top += height - this.detachableEl.offsetHeight + parseInt(computedStyles2.getPropertyValue("margin-top"));
|
|
3202
|
+
} else if (!this.alignTop) {
|
|
3203
|
+
top += (height - this.detachableEl.offsetHeight) / 2 + parseInt(computedStyles2.getPropertyValue("margin-top"));
|
|
3204
|
+
}
|
|
3205
|
+
break;
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
this.detachableEl.style.visibility = null;
|
|
3209
|
+
if (!this.detachableVisible)
|
|
3210
|
+
this.detachableEl.style.display = "none";
|
|
3211
|
+
this.detachableCoords = { top, left };
|
|
3212
|
+
},
|
|
3213
|
+
onResize() {
|
|
3214
|
+
if (this.minWidth === "activator")
|
|
3215
|
+
this.activatorWidth = this.activatorEl.offsetWidth;
|
|
3216
|
+
this.computeDetachableCoords();
|
|
3217
|
+
},
|
|
3218
|
+
onOutsideMousedown(e) {
|
|
3219
|
+
if (!this.detachableEl.contains(e.target) && !this.activatorEl.contains(e.target)) {
|
|
3220
|
+
this.$emit("update:modelValue", this.detachableVisible = false);
|
|
3221
|
+
this.$emit("input", false);
|
|
3222
|
+
this.$emit("close");
|
|
3223
|
+
document.removeEventListener("mousedown", this.onOutsideMousedown);
|
|
3224
|
+
window.removeEventListener("resize", this.onResize);
|
|
3225
|
+
}
|
|
3226
|
+
},
|
|
3227
|
+
insertInDOM() {
|
|
3228
|
+
return new Promise((resolve) => {
|
|
3229
|
+
this.$nextTick(() => {
|
|
3230
|
+
var _a;
|
|
3231
|
+
this.detachableEl = ((_a = this.$refs.detachable) == null ? void 0 : _a.$el) || this.$refs.detachable;
|
|
3232
|
+
if (this.detachableEl)
|
|
3233
|
+
this.appendToTarget.appendChild(this.detachableEl);
|
|
3234
|
+
resolve();
|
|
3235
|
+
});
|
|
3236
|
+
});
|
|
3237
|
+
},
|
|
3238
|
+
removeFromDOM() {
|
|
3239
|
+
document.removeEventListener("mousedown", this.onOutsideMousedown);
|
|
3240
|
+
window.removeEventListener("resize", this.onResize);
|
|
3241
|
+
if (this.detachableEl && this.detachableEl.parentNode) {
|
|
3242
|
+
this.detachableVisible = false;
|
|
3243
|
+
this.detachableEl.remove();
|
|
3244
|
+
this.detachableEl = null;
|
|
3245
|
+
}
|
|
3246
|
+
}
|
|
3247
|
+
},
|
|
3248
|
+
mounted() {
|
|
3249
|
+
var _a;
|
|
3250
|
+
const wrapper = this.$el;
|
|
3251
|
+
if (this.$scopedSlots.activator)
|
|
3252
|
+
wrapper.parentNode.insertBefore(this.activatorEl, wrapper);
|
|
3253
|
+
else if (this.activator) {
|
|
3254
|
+
Object.entries(this.activatorEventHandlers).forEach(([eventName, handler]) => {
|
|
3255
|
+
eventName = eventName.replace("mouseenter", "mouseover").replace("mouseleave", "mouseout");
|
|
3256
|
+
const handlerWrap = (e) => {
|
|
3257
|
+
var _a2;
|
|
3258
|
+
if (((_a2 = e.target) == null ? void 0 : _a2.matches) && e.target.matches(this.activator))
|
|
3259
|
+
handler(e);
|
|
3260
|
+
};
|
|
3261
|
+
document.addEventListener(eventName, handlerWrap);
|
|
3262
|
+
this.docAEventListenersHandlers.push({ eventName, handler: handlerWrap });
|
|
3263
|
+
});
|
|
3264
|
+
}
|
|
3265
|
+
if (this.overlay) {
|
|
3266
|
+
this.overlayEl = (_a = this.$refs.overlay) == null ? void 0 : _a.$el;
|
|
3267
|
+
wrapper.parentNode.insertBefore(this.overlayEl, wrapper);
|
|
3268
|
+
}
|
|
3269
|
+
if (this.value)
|
|
3270
|
+
this.toggleMenu({ type: "click", target: this.activatorEl });
|
|
3271
|
+
},
|
|
3272
|
+
beforeDestroy() {
|
|
3273
|
+
var _a;
|
|
3274
|
+
this.close();
|
|
3275
|
+
this.removeFromDOM();
|
|
3276
|
+
if (this.docAEventListenersHandlers.length) {
|
|
3277
|
+
this.docAEventListenersHandlers.forEach(({ eventName, handler }) => {
|
|
3278
|
+
document.removeEventListener(eventName, handler);
|
|
3279
|
+
});
|
|
3280
|
+
}
|
|
3281
|
+
if (this.overlay && this.overlayEl.parentNode)
|
|
3282
|
+
this.overlayEl.remove();
|
|
3283
|
+
if (((_a = this.activatorEl) == null ? void 0 : _a.parentNode) && this.$scopedSlots.activator)
|
|
3284
|
+
this.activatorEl.remove();
|
|
3285
|
+
},
|
|
3286
|
+
watch: {
|
|
3287
|
+
value(bool) {
|
|
3288
|
+
if (!!bool !== this.detachableVisible)
|
|
3289
|
+
this.toggle({ type: "click", target: this.activatorEl });
|
|
3290
|
+
},
|
|
3291
|
+
detachTo() {
|
|
3292
|
+
this.removeFromDOM();
|
|
3293
|
+
this.insertInDOM();
|
|
3294
|
+
},
|
|
3295
|
+
appendTo() {
|
|
3296
|
+
this.removeFromDOM();
|
|
3297
|
+
this.insertInDOM();
|
|
3298
|
+
}
|
|
3299
|
+
}
|
|
3300
|
+
};
|
|
3017
3301
|
var render$s = function() {
|
|
3018
3302
|
var _vm = this;
|
|
3019
3303
|
var _h = _vm.$createElement;
|
|
3020
3304
|
var _c = _vm._self._c || _h;
|
|
3021
|
-
return _c("div", { staticClass: "w-menu-wrap" }, [_vm._t("activator", null, { "on": _vm.activatorEventHandlers }), _c("transition", { attrs: { "name": _vm.transitionName, "appear": "" } }, [_vm.custom && _vm.
|
|
3022
|
-
_vm.hideOnMenuClick && _vm.
|
|
3305
|
+
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) {
|
|
3306
|
+
_vm.hideOnMenuClick && _vm.close(true);
|
|
3023
3307
|
}, "mouseenter": function($event) {
|
|
3024
3308
|
_vm.showOnHover && (_vm.hoveringMenu = true);
|
|
3025
3309
|
}, "mouseleave": function($event) {
|
|
3026
|
-
_vm.showOnHover && (_vm.hoveringMenu = false, _vm.
|
|
3027
|
-
} } }, [_vm._t("default")], 2) : _vm.
|
|
3028
|
-
_vm.hideOnMenuClick && _vm.
|
|
3310
|
+
_vm.showOnHover && (_vm.hoveringMenu = false, _vm.close());
|
|
3311
|
+
} } }, [_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) {
|
|
3312
|
+
_vm.hideOnMenuClick && _vm.close(true);
|
|
3029
3313
|
}, "mouseenter": function($event) {
|
|
3030
3314
|
_vm.showOnHover && (_vm.hoveringMenu = true);
|
|
3031
3315
|
}, "mouseleave": function($event) {
|
|
3032
|
-
_vm.showOnHover && (_vm.hoveringMenu = false, _vm.
|
|
3316
|
+
_vm.showOnHover && (_vm.hoveringMenu = false, _vm.close());
|
|
3033
3317
|
} }, scopedSlots: _vm._u([_vm.$slots.title ? { key: "title", fn: function() {
|
|
3034
3318
|
return [_vm._t("title")];
|
|
3035
3319
|
}, proxy: true } : null, _vm.$slots.actions ? { key: "actions", fn: function() {
|
|
3036
3320
|
return [_vm._t("actions")];
|
|
3037
|
-
}, 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.
|
|
3038
|
-
_vm.
|
|
3321
|
+
}, 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) {
|
|
3322
|
+
_vm.detachableVisible = false;
|
|
3039
3323
|
} } }, "w-overlay", _vm.overlayProps, false)) : _vm._e()], 2);
|
|
3040
3324
|
};
|
|
3041
3325
|
var staticRenderFns$s = [];
|
|
3042
3326
|
var wMenu_vue_vue_type_style_index_0_lang = "";
|
|
3043
3327
|
const __vue2_script$s = {
|
|
3044
3328
|
name: "w-menu",
|
|
3329
|
+
mixins: [DetachableMixin],
|
|
3045
3330
|
props: {
|
|
3046
3331
|
value: {},
|
|
3047
3332
|
showOnHover: { type: Boolean },
|
|
@@ -3058,76 +3343,36 @@ const __vue2_script$s = {
|
|
|
3058
3343
|
titleClass: { type: [String, Object, Array] },
|
|
3059
3344
|
contentClass: { type: [String, Object, Array] },
|
|
3060
3345
|
arrow: { type: Boolean },
|
|
3061
|
-
detachTo: { type: [String, Boolean, Object] },
|
|
3062
|
-
fixed: { type: Boolean },
|
|
3063
|
-
top: { type: Boolean },
|
|
3064
|
-
bottom: { type: Boolean },
|
|
3065
|
-
left: { type: Boolean },
|
|
3066
|
-
right: { type: Boolean },
|
|
3067
|
-
alignTop: { type: Boolean },
|
|
3068
|
-
alignBottom: { type: Boolean },
|
|
3069
|
-
alignLeft: { type: Boolean },
|
|
3070
|
-
alignRight: { type: Boolean },
|
|
3071
|
-
zIndex: { type: [Number, String, Boolean] },
|
|
3072
3346
|
minWidth: { type: [Number, String] },
|
|
3073
3347
|
overlay: { type: Boolean },
|
|
3074
3348
|
overlayClass: { type: [String, Object, Array] },
|
|
3075
3349
|
overlayProps: { type: Object },
|
|
3076
3350
|
persistent: { type: Boolean },
|
|
3077
|
-
|
|
3351
|
+
delay: { type: Number }
|
|
3078
3352
|
},
|
|
3079
3353
|
emits: ["input", "update:modelValue", "open", "close"],
|
|
3080
3354
|
data: () => ({
|
|
3081
|
-
|
|
3355
|
+
detachableVisible: false,
|
|
3082
3356
|
hoveringActivator: false,
|
|
3083
3357
|
hoveringMenu: false,
|
|
3084
|
-
|
|
3358
|
+
detachableCoords: {
|
|
3085
3359
|
top: 0,
|
|
3086
3360
|
left: 0
|
|
3087
3361
|
},
|
|
3088
|
-
activatorEl: null,
|
|
3089
3362
|
activatorWidth: 0,
|
|
3090
|
-
|
|
3363
|
+
detachableEl: null,
|
|
3091
3364
|
timeoutId: null
|
|
3092
3365
|
}),
|
|
3093
3366
|
computed: {
|
|
3094
3367
|
transitionName() {
|
|
3095
3368
|
return this.transition || "scale-fade";
|
|
3096
3369
|
},
|
|
3097
|
-
detachToTarget() {
|
|
3098
|
-
const defaultTarget = ".w-app";
|
|
3099
|
-
let target = this.detachTo || defaultTarget;
|
|
3100
|
-
if (target === true)
|
|
3101
|
-
target = defaultTarget;
|
|
3102
|
-
else if (target && !["object", "string"].includes(typeof target))
|
|
3103
|
-
target = defaultTarget;
|
|
3104
|
-
else if (typeof target === "object" && !target.nodeType) {
|
|
3105
|
-
target = defaultTarget;
|
|
3106
|
-
consoleWarn("Invalid node provided in w-menu `detach-to`. Falling back to .w-app.");
|
|
3107
|
-
}
|
|
3108
|
-
if (typeof target === "string")
|
|
3109
|
-
target = document.querySelector(target);
|
|
3110
|
-
if (!target) {
|
|
3111
|
-
consoleWarn(`Unable to locate ${this.detachTo ? `target ${this.detachTo}` : defaultTarget}`);
|
|
3112
|
-
target = document.querySelector(defaultTarget);
|
|
3113
|
-
}
|
|
3114
|
-
return target;
|
|
3115
|
-
},
|
|
3116
|
-
menuParentEl() {
|
|
3117
|
-
return this.detachToTarget;
|
|
3118
|
-
},
|
|
3119
|
-
position() {
|
|
3120
|
-
return this.top && "top" || this.bottom && "bottom" || this.left && "left" || this.right && "right" || "bottom";
|
|
3121
|
-
},
|
|
3122
3370
|
menuMinWidth() {
|
|
3123
3371
|
if (this.minWidth === "activator")
|
|
3124
3372
|
return this.activatorWidth ? `${this.activatorWidth}px` : 0;
|
|
3125
3373
|
else
|
|
3126
3374
|
return isNaN(this.minWidth) ? this.minWidth : this.minWidth ? `${this.minWidth}px` : 0;
|
|
3127
3375
|
},
|
|
3128
|
-
alignment() {
|
|
3129
|
-
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" || "";
|
|
3130
|
-
},
|
|
3131
3376
|
menuClasses() {
|
|
3132
3377
|
return objectifyClasses(this.menuClass);
|
|
3133
3378
|
},
|
|
@@ -3158,8 +3403,8 @@ const __vue2_script$s = {
|
|
|
3158
3403
|
styles() {
|
|
3159
3404
|
return {
|
|
3160
3405
|
zIndex: this.zIndex || this.zIndex === 0 || this.overlay && !this.zIndex && 200 || null,
|
|
3161
|
-
top: this.
|
|
3162
|
-
left: this.
|
|
3406
|
+
top: this.detachableCoords.top && `${~~this.detachableCoords.top}px` || null,
|
|
3407
|
+
left: this.detachableCoords.left && `${~~this.detachableCoords.left}px` || null,
|
|
3163
3408
|
minWidth: this.minWidth && this.menuMinWidth || null,
|
|
3164
3409
|
"--w-menu-bg-color": this.arrow && this.$waveui.colors[this.bgColor || "white"]
|
|
3165
3410
|
};
|
|
@@ -3168,31 +3413,31 @@ const __vue2_script$s = {
|
|
|
3168
3413
|
let handlers = {};
|
|
3169
3414
|
if (this.showOnHover) {
|
|
3170
3415
|
handlers = {
|
|
3171
|
-
focus: this.
|
|
3172
|
-
blur: this.
|
|
3416
|
+
focus: this.toggle,
|
|
3417
|
+
blur: this.toggle,
|
|
3173
3418
|
mouseenter: (e) => {
|
|
3174
3419
|
this.hoveringActivator = true;
|
|
3175
|
-
this.
|
|
3420
|
+
this.open(e);
|
|
3176
3421
|
},
|
|
3177
3422
|
mouseleave: (e) => {
|
|
3178
3423
|
this.hoveringActivator = false;
|
|
3179
3424
|
setTimeout(() => {
|
|
3180
3425
|
if (!this.hoveringMenu)
|
|
3181
|
-
this.
|
|
3426
|
+
this.close();
|
|
3182
3427
|
}, 10);
|
|
3183
3428
|
}
|
|
3184
3429
|
};
|
|
3185
3430
|
if (typeof window !== "undefined" && "ontouchstart" in window) {
|
|
3186
|
-
handlers.click = this.
|
|
3431
|
+
handlers.click = this.toggle;
|
|
3187
3432
|
}
|
|
3188
3433
|
} else
|
|
3189
|
-
handlers = { click: this.
|
|
3434
|
+
handlers = { click: this.toggle };
|
|
3190
3435
|
return handlers;
|
|
3191
3436
|
}
|
|
3192
3437
|
},
|
|
3193
3438
|
methods: {
|
|
3194
|
-
|
|
3195
|
-
let shouldShowMenu = this.
|
|
3439
|
+
toggle(e) {
|
|
3440
|
+
let shouldShowMenu = this.detachableVisible;
|
|
3196
3441
|
if ("ontouchstart" in window && this.showOnHover && e.type === "click") {
|
|
3197
3442
|
shouldShowMenu = !shouldShowMenu;
|
|
3198
3443
|
} else if (e.type === "click" && !this.showOnHover)
|
|
@@ -3205,21 +3450,22 @@ const __vue2_script$s = {
|
|
|
3205
3450
|
shouldShowMenu = false;
|
|
3206
3451
|
}
|
|
3207
3452
|
this.timeoutId = clearTimeout(this.timeoutId);
|
|
3208
|
-
if (shouldShowMenu)
|
|
3209
|
-
this
|
|
3210
|
-
|
|
3211
|
-
this
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
this.
|
|
3218
|
-
|
|
3453
|
+
if (shouldShowMenu)
|
|
3454
|
+
this.open(e);
|
|
3455
|
+
else
|
|
3456
|
+
this.close();
|
|
3457
|
+
},
|
|
3458
|
+
async open(e) {
|
|
3459
|
+
if (this.delay)
|
|
3460
|
+
await new Promise((resolve) => setTimeout(resolve, this.delay));
|
|
3461
|
+
this.detachableVisible = true;
|
|
3462
|
+
if (this.activator)
|
|
3463
|
+
this.activatorEl = e.target;
|
|
3464
|
+
await this.insertInDOM();
|
|
3219
3465
|
if (this.minWidth === "activator")
|
|
3220
3466
|
this.activatorWidth = this.activatorEl.offsetWidth;
|
|
3221
3467
|
if (!this.noPosition)
|
|
3222
|
-
this.
|
|
3468
|
+
this.computeDetachableCoords(e);
|
|
3223
3469
|
this.timeoutId = setTimeout(() => {
|
|
3224
3470
|
this.$emit("update:modelValue", true);
|
|
3225
3471
|
this.$emit("input", true);
|
|
@@ -3230,134 +3476,19 @@ const __vue2_script$s = {
|
|
|
3230
3476
|
if (!this.noPosition)
|
|
3231
3477
|
window.addEventListener("resize", this.onResize);
|
|
3232
3478
|
},
|
|
3233
|
-
async
|
|
3234
|
-
if (!this.
|
|
3479
|
+
async close(force = false) {
|
|
3480
|
+
if (!this.detachableVisible)
|
|
3235
3481
|
return;
|
|
3236
3482
|
if (this.showOnHover && !force) {
|
|
3237
3483
|
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
3238
3484
|
if (this.showOnHover && (this.hoveringMenu || this.hoveringActivator))
|
|
3239
3485
|
return;
|
|
3240
3486
|
}
|
|
3241
|
-
this.$emit("update:modelValue", this.
|
|
3487
|
+
this.$emit("update:modelValue", this.detachableVisible = false);
|
|
3242
3488
|
this.$emit("input", false);
|
|
3243
3489
|
this.$emit("close");
|
|
3244
3490
|
document.removeEventListener("mousedown", this.onOutsideMousedown);
|
|
3245
3491
|
window.removeEventListener("resize", this.onResize);
|
|
3246
|
-
},
|
|
3247
|
-
onOutsideMousedown(e) {
|
|
3248
|
-
if (!this.menuEl.contains(e.target) && !this.activatorEl.contains(e.target)) {
|
|
3249
|
-
this.$emit("update:modelValue", this.menuVisible = false);
|
|
3250
|
-
this.$emit("input", false);
|
|
3251
|
-
this.$emit("close");
|
|
3252
|
-
document.removeEventListener("mousedown", this.onOutsideMousedown);
|
|
3253
|
-
window.removeEventListener("resize", this.onResize);
|
|
3254
|
-
}
|
|
3255
|
-
},
|
|
3256
|
-
onResize() {
|
|
3257
|
-
if (this.minWidth === "activator")
|
|
3258
|
-
this.activatorWidth = this.activatorEl.offsetWidth;
|
|
3259
|
-
this.computeMenuPosition();
|
|
3260
|
-
},
|
|
3261
|
-
getCoordinates(e) {
|
|
3262
|
-
const { top, left, width, height } = (e ? e.target : this.activatorEl).getBoundingClientRect();
|
|
3263
|
-
let coords = { top, left, width, height };
|
|
3264
|
-
if (!this.fixed) {
|
|
3265
|
-
const { top: targetTop, left: targetLeft } = this.menuParentEl.getBoundingClientRect();
|
|
3266
|
-
const computedStyles2 = window.getComputedStyle(this.menuParentEl, null);
|
|
3267
|
-
coords = __spreadProps(__spreadValues({}, coords), {
|
|
3268
|
-
top: top - targetTop + this.menuParentEl.scrollTop - parseInt(computedStyles2.getPropertyValue("border-top-width")),
|
|
3269
|
-
left: left - targetLeft + this.menuParentEl.scrollLeft - parseInt(computedStyles2.getPropertyValue("border-left-width"))
|
|
3270
|
-
});
|
|
3271
|
-
}
|
|
3272
|
-
return coords;
|
|
3273
|
-
},
|
|
3274
|
-
computeMenuPosition(e) {
|
|
3275
|
-
let { top, left, width, height } = this.getCoordinates(e);
|
|
3276
|
-
this.menuEl.style.visibility = "hidden";
|
|
3277
|
-
this.menuEl.style.display = "flex";
|
|
3278
|
-
const computedStyles2 = window.getComputedStyle(this.menuEl, null);
|
|
3279
|
-
switch (this.position) {
|
|
3280
|
-
case "top": {
|
|
3281
|
-
top -= this.menuEl.offsetHeight;
|
|
3282
|
-
if (this.alignRight) {
|
|
3283
|
-
left += width - this.menuEl.offsetWidth + parseInt(computedStyles2.getPropertyValue("border-right-width"));
|
|
3284
|
-
} else if (!this.alignLeft)
|
|
3285
|
-
left += (width - this.menuEl.offsetWidth) / 2;
|
|
3286
|
-
break;
|
|
3287
|
-
}
|
|
3288
|
-
case "bottom": {
|
|
3289
|
-
top += height;
|
|
3290
|
-
if (this.alignRight) {
|
|
3291
|
-
left += width - this.menuEl.offsetWidth + parseInt(computedStyles2.getPropertyValue("border-right-width"));
|
|
3292
|
-
} else if (!this.alignLeft)
|
|
3293
|
-
left += (width - this.menuEl.offsetWidth) / 2;
|
|
3294
|
-
break;
|
|
3295
|
-
}
|
|
3296
|
-
case "left": {
|
|
3297
|
-
left -= this.menuEl.offsetWidth;
|
|
3298
|
-
if (this.alignBottom)
|
|
3299
|
-
top += height - this.menuEl.offsetHeight;
|
|
3300
|
-
else if (!this.alignTop)
|
|
3301
|
-
top += (height - this.menuEl.offsetHeight) / 2;
|
|
3302
|
-
break;
|
|
3303
|
-
}
|
|
3304
|
-
case "right": {
|
|
3305
|
-
left += width;
|
|
3306
|
-
if (this.alignBottom) {
|
|
3307
|
-
top += height - this.menuEl.offsetHeight + parseInt(computedStyles2.getPropertyValue("margin-top"));
|
|
3308
|
-
} else if (!this.alignTop) {
|
|
3309
|
-
top += (height - this.menuEl.offsetHeight) / 2 + parseInt(computedStyles2.getPropertyValue("margin-top"));
|
|
3310
|
-
}
|
|
3311
|
-
break;
|
|
3312
|
-
}
|
|
3313
|
-
}
|
|
3314
|
-
this.menuEl.style.visibility = null;
|
|
3315
|
-
if (!this.menuVisible)
|
|
3316
|
-
this.menuEl.style.display = "none";
|
|
3317
|
-
this.menuCoordinates = { top, left };
|
|
3318
|
-
},
|
|
3319
|
-
insertMenu() {
|
|
3320
|
-
return new Promise((resolve) => {
|
|
3321
|
-
this.$nextTick(() => {
|
|
3322
|
-
var _a;
|
|
3323
|
-
this.menuEl = ((_a = this.$refs.menu) == null ? void 0 : _a.$el) || this.$refs.menu;
|
|
3324
|
-
this.detachToTarget.appendChild(this.menuEl);
|
|
3325
|
-
resolve();
|
|
3326
|
-
});
|
|
3327
|
-
});
|
|
3328
|
-
},
|
|
3329
|
-
removeMenu() {
|
|
3330
|
-
if (this.menuEl && this.menuEl.parentNode)
|
|
3331
|
-
this.menuEl.remove();
|
|
3332
|
-
}
|
|
3333
|
-
},
|
|
3334
|
-
mounted() {
|
|
3335
|
-
var _a;
|
|
3336
|
-
const wrapper = this.$el;
|
|
3337
|
-
this.activatorEl = wrapper.firstElementChild;
|
|
3338
|
-
wrapper.parentNode.insertBefore(this.activatorEl, wrapper);
|
|
3339
|
-
if (this.overlay) {
|
|
3340
|
-
this.overlayEl = (_a = this.$refs.overlay) == null ? void 0 : _a.$el;
|
|
3341
|
-
wrapper.parentNode.insertBefore(this.overlayEl, wrapper);
|
|
3342
|
-
}
|
|
3343
|
-
if (this.value)
|
|
3344
|
-
this.toggleMenu({ type: "click", target: this.activatorEl });
|
|
3345
|
-
},
|
|
3346
|
-
beforeDestroy() {
|
|
3347
|
-
this.removeMenu();
|
|
3348
|
-
if (this.overlay && this.overlayEl.parentNode)
|
|
3349
|
-
this.overlayEl.remove();
|
|
3350
|
-
if (this.activatorEl && this.activatorEl.parentNode)
|
|
3351
|
-
this.activatorEl.remove();
|
|
3352
|
-
},
|
|
3353
|
-
watch: {
|
|
3354
|
-
value(bool) {
|
|
3355
|
-
if (!!bool !== this.menuVisible)
|
|
3356
|
-
this.toggleMenu({ type: "click", target: this.activatorEl });
|
|
3357
|
-
},
|
|
3358
|
-
detachTo() {
|
|
3359
|
-
this.removeMenu();
|
|
3360
|
-
this.insertMenu();
|
|
3361
3492
|
}
|
|
3362
3493
|
}
|
|
3363
3494
|
};
|
|
@@ -4022,7 +4153,7 @@ var render$k = function() {
|
|
|
4022
4153
|
var _c = _vm._self._c || _h;
|
|
4023
4154
|
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) {
|
|
4024
4155
|
_vm.valid = $event;
|
|
4025
|
-
}, "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", "
|
|
4156
|
+
}, "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) {
|
|
4026
4157
|
var _obj, _obj$1;
|
|
4027
4158
|
ref.on;
|
|
4028
4159
|
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) {
|
|
@@ -5495,13 +5626,13 @@ var render$8 = function() {
|
|
|
5495
5626
|
var _vm = this;
|
|
5496
5627
|
var _h = _vm.$createElement;
|
|
5497
5628
|
var _c = _vm._self._c || _h;
|
|
5498
|
-
return _c("div", { staticClass: "w-tooltip-wrap"
|
|
5629
|
+
return _c("div", { staticClass: "w-tooltip-wrap" }, [_vm._t("activator", null, { "on": _vm.activatorEventHandlers }), _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);
|
|
5499
5630
|
};
|
|
5500
5631
|
var staticRenderFns$8 = [];
|
|
5501
5632
|
var wTooltip_vue_vue_type_style_index_0_lang = "";
|
|
5502
|
-
const marginFromWindowSide = 4;
|
|
5503
5633
|
const __vue2_script$8 = {
|
|
5504
5634
|
name: "w-tooltip",
|
|
5635
|
+
mixins: [DetachableMixin],
|
|
5505
5636
|
props: {
|
|
5506
5637
|
value: {},
|
|
5507
5638
|
showOnClick: { type: Boolean },
|
|
@@ -5513,25 +5644,18 @@ const __vue2_script$8 = {
|
|
|
5513
5644
|
round: { type: Boolean },
|
|
5514
5645
|
transition: { type: String },
|
|
5515
5646
|
tooltipClass: { type: [String, Object, Array] },
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
top: { type: Boolean },
|
|
5519
|
-
bottom: { type: Boolean },
|
|
5520
|
-
left: { type: Boolean },
|
|
5521
|
-
right: { type: Boolean },
|
|
5522
|
-
zIndex: { type: [Number, String, Boolean] }
|
|
5647
|
+
persistent: { type: Boolean },
|
|
5648
|
+
delay: { type: Number }
|
|
5523
5649
|
},
|
|
5524
5650
|
emits: ["input", "update:modelValue", "open", "close"],
|
|
5525
5651
|
data: () => ({
|
|
5526
|
-
|
|
5527
|
-
|
|
5652
|
+
detachableVisible: false,
|
|
5653
|
+
hoveringActivator: false,
|
|
5654
|
+
detachableCoords: {
|
|
5528
5655
|
top: 0,
|
|
5529
|
-
left: 0
|
|
5530
|
-
width: 0,
|
|
5531
|
-
height: 0
|
|
5656
|
+
left: 0
|
|
5532
5657
|
},
|
|
5533
|
-
|
|
5534
|
-
tooltipEl: null,
|
|
5658
|
+
detachableEl: null,
|
|
5535
5659
|
timeoutId: null
|
|
5536
5660
|
}),
|
|
5537
5661
|
computed: {
|
|
@@ -5542,69 +5666,17 @@ const __vue2_script$8 = {
|
|
|
5542
5666
|
const direction = this.position.replace(/top|bottom/, (m) => ({ top: "up", bottom: "down" })[m]);
|
|
5543
5667
|
return this.transition || `w-tooltip-slide-fade-${direction}`;
|
|
5544
5668
|
},
|
|
5545
|
-
detachToTarget() {
|
|
5546
|
-
const defaultTarget = ".w-app";
|
|
5547
|
-
let target = this.detachTo || defaultTarget;
|
|
5548
|
-
if (target === true)
|
|
5549
|
-
target = defaultTarget;
|
|
5550
|
-
else if (target && !["object", "string"].includes(typeof target))
|
|
5551
|
-
target = defaultTarget;
|
|
5552
|
-
else if (typeof target === "object" && !target.nodeType) {
|
|
5553
|
-
target = defaultTarget;
|
|
5554
|
-
consoleWarn("Invalid node provided in w-tooltip `attach-to`. Falling back to .w-app.");
|
|
5555
|
-
}
|
|
5556
|
-
if (typeof target === "string")
|
|
5557
|
-
target = document.querySelector(target);
|
|
5558
|
-
if (!target) {
|
|
5559
|
-
consoleWarn(`Unable to locate ${this.detachTo ? `target ${this.detachTo}` : defaultTarget}`);
|
|
5560
|
-
target = document.querySelector(defaultTarget);
|
|
5561
|
-
}
|
|
5562
|
-
return target;
|
|
5563
|
-
},
|
|
5564
|
-
tooltipParentEl() {
|
|
5565
|
-
return this.detachTo ? this.detachToTarget : this.$el;
|
|
5566
|
-
},
|
|
5567
|
-
position() {
|
|
5568
|
-
return this.top && "top" || this.bottom && "bottom" || this.left && "left" || this.right && "right" || "bottom";
|
|
5569
|
-
},
|
|
5570
|
-
tooltipCoordinates() {
|
|
5571
|
-
const coords = {};
|
|
5572
|
-
const { top, left, width, height } = this.coordinates;
|
|
5573
|
-
switch (this.position) {
|
|
5574
|
-
case "top": {
|
|
5575
|
-
coords.top = top;
|
|
5576
|
-
coords.left = left + width / 2;
|
|
5577
|
-
break;
|
|
5578
|
-
}
|
|
5579
|
-
case "bottom": {
|
|
5580
|
-
coords.top = top + height;
|
|
5581
|
-
coords.left = left + width / 2;
|
|
5582
|
-
break;
|
|
5583
|
-
}
|
|
5584
|
-
case "left": {
|
|
5585
|
-
coords.top = top + height / 2;
|
|
5586
|
-
coords.left = left;
|
|
5587
|
-
break;
|
|
5588
|
-
}
|
|
5589
|
-
case "right": {
|
|
5590
|
-
coords.top = top + height / 2;
|
|
5591
|
-
coords.left = left + width;
|
|
5592
|
-
break;
|
|
5593
|
-
}
|
|
5594
|
-
}
|
|
5595
|
-
return coords;
|
|
5596
|
-
},
|
|
5597
5669
|
classes() {
|
|
5598
5670
|
return __spreadProps(__spreadValues({
|
|
5599
5671
|
[this.color]: this.color,
|
|
5600
5672
|
[`${this.bgColor}--bg`]: this.bgColor
|
|
5601
5673
|
}, this.tooltipClasses), {
|
|
5602
|
-
[`w-tooltip--${this.position}`]:
|
|
5674
|
+
[`w-tooltip--${this.position}`]: !this.noPosition,
|
|
5675
|
+
[`w-tooltip--align-${this.alignment}`]: !this.noPosition && this.alignment,
|
|
5603
5676
|
"w-tooltip--tile": this.tile,
|
|
5604
5677
|
"w-tooltip--round": this.round,
|
|
5605
5678
|
"w-tooltip--shadow": this.shadow,
|
|
5606
5679
|
"w-tooltip--fixed": this.fixed,
|
|
5607
|
-
"w-tooltip--active": this.showTooltip,
|
|
5608
5680
|
"w-tooltip--no-border": this.noBorder || this.bgColor,
|
|
5609
5681
|
"w-tooltip--custom-transition": this.transition
|
|
5610
5682
|
});
|
|
@@ -5612,12 +5684,12 @@ const __vue2_script$8 = {
|
|
|
5612
5684
|
styles() {
|
|
5613
5685
|
return {
|
|
5614
5686
|
zIndex: this.zIndex || this.zIndex === 0 || null,
|
|
5615
|
-
top: this.
|
|
5616
|
-
left: this.
|
|
5687
|
+
top: this.detachableCoords.top && `${~~this.detachableCoords.top}px` || null,
|
|
5688
|
+
left: this.detachableCoords.left && `${~~this.detachableCoords.left}px` || null,
|
|
5617
5689
|
"--w-tooltip-bg-color": this.$waveui.colors[this.bgColor || "white"]
|
|
5618
5690
|
};
|
|
5619
5691
|
},
|
|
5620
|
-
|
|
5692
|
+
activatorEventHandlers() {
|
|
5621
5693
|
let handlers = {};
|
|
5622
5694
|
if (this.showOnClick)
|
|
5623
5695
|
handlers = { click: this.toggle };
|
|
@@ -5625,8 +5697,14 @@ const __vue2_script$8 = {
|
|
|
5625
5697
|
handlers = {
|
|
5626
5698
|
focus: this.toggle,
|
|
5627
5699
|
blur: this.toggle,
|
|
5628
|
-
mouseenter:
|
|
5629
|
-
|
|
5700
|
+
mouseenter: (e) => {
|
|
5701
|
+
this.hoveringActivator = true;
|
|
5702
|
+
this.open(e);
|
|
5703
|
+
},
|
|
5704
|
+
mouseleave: (e) => {
|
|
5705
|
+
this.hoveringActivator = false;
|
|
5706
|
+
this.close();
|
|
5707
|
+
}
|
|
5630
5708
|
};
|
|
5631
5709
|
if (typeof window !== "undefined" && "ontouchstart" in window)
|
|
5632
5710
|
handlers.click = this.toggle;
|
|
@@ -5636,7 +5714,7 @@ const __vue2_script$8 = {
|
|
|
5636
5714
|
},
|
|
5637
5715
|
methods: {
|
|
5638
5716
|
toggle(e) {
|
|
5639
|
-
let shouldShowTooltip = this.
|
|
5717
|
+
let shouldShowTooltip = this.detachableVisible;
|
|
5640
5718
|
if (typeof window !== "undefined" && "ontouchstart" in window) {
|
|
5641
5719
|
if (e.type === "click")
|
|
5642
5720
|
shouldShowTooltip = !shouldShowTooltip;
|
|
@@ -5647,90 +5725,45 @@ const __vue2_script$8 = {
|
|
|
5647
5725
|
else if (["mouseleave", "blur"].includes(e.type) && !this.showOnClick)
|
|
5648
5726
|
shouldShowTooltip = false;
|
|
5649
5727
|
this.timeoutId = clearTimeout(this.timeoutId);
|
|
5650
|
-
if (shouldShowTooltip)
|
|
5651
|
-
this.
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
this
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5728
|
+
if (shouldShowTooltip)
|
|
5729
|
+
this.open(e);
|
|
5730
|
+
else
|
|
5731
|
+
this.close();
|
|
5732
|
+
},
|
|
5733
|
+
async open(e) {
|
|
5734
|
+
if (this.delay)
|
|
5735
|
+
await new Promise((resolve) => setTimeout(resolve, this.delay));
|
|
5736
|
+
this.detachableVisible = true;
|
|
5737
|
+
if (this.activator)
|
|
5738
|
+
this.activatorEl = e.target;
|
|
5739
|
+
await this.insertInDOM();
|
|
5740
|
+
if (this.minWidth === "activator")
|
|
5741
|
+
this.activatorWidth = this.activatorEl.offsetWidth;
|
|
5742
|
+
if (!this.noPosition)
|
|
5743
|
+
this.computeDetachableCoords(e);
|
|
5744
|
+
this.timeoutId = setTimeout(() => {
|
|
5745
|
+
this.$emit("update:modelValue", true);
|
|
5746
|
+
this.$emit("input", true);
|
|
5747
|
+
this.$emit("open");
|
|
5748
|
+
}, 0);
|
|
5749
|
+
if (!this.persistent)
|
|
5750
|
+
document.addEventListener("mousedown", this.onOutsideMousedown);
|
|
5751
|
+
if (!this.noPosition)
|
|
5752
|
+
window.addEventListener("resize", this.onResize);
|
|
5664
5753
|
},
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
if (
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
const tooltipEl = this.$refs.tooltip;
|
|
5673
|
-
tooltipEl.style.visibility = "hidden";
|
|
5674
|
-
tooltipEl.style.display = "table";
|
|
5675
|
-
const computedStyles2 = window.getComputedStyle(tooltipEl, null);
|
|
5676
|
-
if (this.position === "top" && top - tooltipEl.offsetHeight < 0) {
|
|
5677
|
-
const margin = -parseInt(computedStyles2.getPropertyValue("margin-top"));
|
|
5678
|
-
coords.top -= top - tooltipEl.offsetHeight - margin - marginFromWindowSide;
|
|
5679
|
-
} else if (this.position === "left" && left - tooltipEl.offsetWidth < 0) {
|
|
5680
|
-
const margin = -parseInt(computedStyles2.getPropertyValue("margin-left"));
|
|
5681
|
-
coords.left -= left - tooltipEl.offsetWidth - margin - marginFromWindowSide;
|
|
5682
|
-
} else if (this.position === "right" && left + width + tooltipEl.offsetWidth > window.innerWidth) {
|
|
5683
|
-
const margin = parseInt(computedStyles2.getPropertyValue("margin-left"));
|
|
5684
|
-
coords.left -= left + width + tooltipEl.offsetWidth - window.innerWidth + margin + marginFromWindowSide;
|
|
5685
|
-
} else if (this.position === "bottom" && top + height + tooltipEl.offsetHeight > window.innerHeight) {
|
|
5686
|
-
const margin = parseInt(computedStyles2.getPropertyValue("margin-top"));
|
|
5687
|
-
coords.top -= top + height + tooltipEl.offsetHeight - window.innerHeight + margin + marginFromWindowSide;
|
|
5688
|
-
}
|
|
5689
|
-
if (this.transition) {
|
|
5690
|
-
if (["top", "bottom"].includes(this.position))
|
|
5691
|
-
coords.left -= tooltipEl.offsetWidth / 2;
|
|
5692
|
-
if (["left", "right"].includes(this.position))
|
|
5693
|
-
coords.top -= tooltipEl.offsetHeight / 2;
|
|
5694
|
-
if (this.position === "left")
|
|
5695
|
-
coords.left -= tooltipEl.offsetWidth;
|
|
5696
|
-
if (this.position === "top")
|
|
5697
|
-
coords.top -= tooltipEl.offsetHeight;
|
|
5754
|
+
async close(force = false) {
|
|
5755
|
+
if (!this.detachableVisible)
|
|
5756
|
+
return;
|
|
5757
|
+
if (this.showOnHover && !force) {
|
|
5758
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
5759
|
+
if (this.showOnHover && this.hoveringActivator)
|
|
5760
|
+
return;
|
|
5698
5761
|
}
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
const wrapper = this.$el;
|
|
5705
|
-
this.tooltipEl = this.$refs.tooltip.$el || this.$refs.tooltip;
|
|
5706
|
-
wrapper.parentNode.insertBefore(this.activatorEl, wrapper);
|
|
5707
|
-
this.detachToTarget.appendChild(this.$refs.tooltip);
|
|
5708
|
-
},
|
|
5709
|
-
removeTooltip() {
|
|
5710
|
-
if (this.tooltipEl && this.tooltipEl.parentNode)
|
|
5711
|
-
this.tooltipEl.remove();
|
|
5712
|
-
}
|
|
5713
|
-
},
|
|
5714
|
-
mounted() {
|
|
5715
|
-
this.activatorEl = this.$el.firstElementChild;
|
|
5716
|
-
if (this.detachTo)
|
|
5717
|
-
this.insertTooltip();
|
|
5718
|
-
if (this.value)
|
|
5719
|
-
this.toggle({ type: "click", target: this.activatorEl });
|
|
5720
|
-
},
|
|
5721
|
-
beforeDestroy() {
|
|
5722
|
-
this.removeTooltip();
|
|
5723
|
-
if (this.activatorEl && this.activatorEl.parentNode)
|
|
5724
|
-
this.activatorEl.remove();
|
|
5725
|
-
},
|
|
5726
|
-
watch: {
|
|
5727
|
-
value(bool) {
|
|
5728
|
-
if (bool !== this.showTooltip)
|
|
5729
|
-
this.toggle({ type: "click", target: this.activatorEl });
|
|
5730
|
-
},
|
|
5731
|
-
detachTo() {
|
|
5732
|
-
this.removeTooltip();
|
|
5733
|
-
this.insertTooltip();
|
|
5762
|
+
this.$emit("update:modelValue", this.detachableVisible = false);
|
|
5763
|
+
this.$emit("input", false);
|
|
5764
|
+
this.$emit("close");
|
|
5765
|
+
document.removeEventListener("mousedown", this.onOutsideMousedown);
|
|
5766
|
+
window.removeEventListener("resize", this.onResize);
|
|
5734
5767
|
}
|
|
5735
5768
|
}
|
|
5736
5769
|
};
|