wave-ui 1.47.0 → 1.49.2

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.
@@ -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), [_vm._v(_vm._s(notif.message))]) : _vm._e()];
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
  },
@@ -2531,7 +2537,6 @@ var wImage = /* @__PURE__ */ function() {
2531
2537
  return __component__$v.exports;
2532
2538
  }();
2533
2539
  var render$u = function() {
2534
- var _obj, _obj$1;
2535
2540
  var _vm = this;
2536
2541
  var _h = _vm.$createElement;
2537
2542
  var _c = _vm._self._c || _h;
@@ -2545,7 +2550,7 @@ var render$u = function() {
2545
2550
  return;
2546
2551
  }
2547
2552
  _vm.inputValue = $event.target.value;
2548
- } } }) : [_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) {
2549
2554
  return _vm.$emit("click:inner-icon-left", $event);
2550
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) {
2551
2556
  var $$a = _vm.inputValue, $$el = $event.target, $$c = $$el.checked ? true : false;
@@ -2566,15 +2571,15 @@ var render$u = function() {
2566
2571
  return;
2567
2572
  }
2568
2573
  _vm.inputValue = $event.target.value;
2569
- }, _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() {
2570
2575
  return [_vm.$slots["no-file"] === void 0 ? [_vm._v("No file")] : _vm._e()];
2571
2576
  })], 2) : _vm._e(), _vm._l(_vm.inputFiles, function(file, i) {
2572
- 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))]);
2573
- })], 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.isFocused && (_obj = {}, _obj[_vm.valid === false ? "error" : _vm.color] = _vm.color || _vm.valid === false, _obj), 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.isFocused && (_obj$1 = {}, _obj$1[_vm.valid === false ? "error" : _vm.color] = _vm.color || _vm.valid === false, _obj$1), 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) {
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) {
2574
2579
  return _vm.$emit("click:inner-icon-right", $event);
2575
- } } }, [_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) {
2576
- 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 wi-file w-input__file-preview primary" })];
2577
- })], 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(), _vm.loading ? _c("w-progress", { staticClass: "fill-width", attrs: { "size": "2", "color": _vm.progressColor || _vm.color } }) : _vm._e()]], 2);
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);
2578
2583
  };
2579
2584
  var staticRenderFns$u = [];
2580
2585
  var wInput_vue_vue_type_style_index_0_lang = "";
@@ -2604,10 +2609,12 @@ const __vue2_script$u = {
2604
2609
  shadow: { type: Boolean },
2605
2610
  tile: { type: Boolean },
2606
2611
  multiple: { type: Boolean },
2607
- preview: { type: Boolean },
2608
- 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 }
2609
2616
  },
2610
- 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"],
2611
2618
  data() {
2612
2619
  return {
2613
2620
  inputValue: this.value,
@@ -2628,14 +2635,48 @@ const __vue2_script$u = {
2628
2635
  return listeners;
2629
2636
  },
2630
2637
  hasValue() {
2631
- return this.inputValue || this.inputValue === 0 || ["date", "time"].includes(this.type) || this.type === "number" && this.inputNumberError || this.type === "file" && this.inputFiles.length;
2638
+ switch (this.type) {
2639
+ case "file":
2640
+ return !!this.inputFiles.length;
2641
+ case "number":
2642
+ return this.inputValue || this.inputValue === 0 || this.inputNumberError;
2643
+ case "date":
2644
+ case "time":
2645
+ return true;
2646
+ default:
2647
+ return this.inputValue || this.inputValue === 0;
2648
+ }
2632
2649
  },
2633
2650
  hasLabel() {
2634
2651
  return this.label || this.$slots.default;
2635
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
+ },
2636
2665
  showLabelInside() {
2637
2666
  return !this.staticLabel || !this.hasValue && !this.placeholder;
2638
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
+ },
2639
2680
  classes() {
2640
2681
  return {
2641
2682
  "w-input": true,
@@ -2652,6 +2693,11 @@ const __vue2_script$u = {
2652
2693
  "w-input--inner-icon-right": this.innerIconRight
2653
2694
  };
2654
2695
  },
2696
+ validationClasses() {
2697
+ return this.isFocused && {
2698
+ [this.valid === false ? "error" : this.color]: this.color || this.valid === false
2699
+ };
2700
+ },
2655
2701
  inputWrapClasses() {
2656
2702
  return {
2657
2703
  [this.valid === false ? "error" : this.color]: this.color || this.valid === false,
@@ -2663,7 +2709,8 @@ const __vue2_script$u = {
2663
2709
  "w-input__input-wrap--underline": !this.outline,
2664
2710
  "w-input__input-wrap--shadow": this.shadow,
2665
2711
  "w-input__input-wrap--no-padding": !this.outline && !this.bgColor && !this.shadow && !this.round,
2666
- "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
2667
2714
  };
2668
2715
  }
2669
2716
  },
@@ -2683,31 +2730,34 @@ const __vue2_script$u = {
2683
2730
  },
2684
2731
  onFileChange(e) {
2685
2732
  this.$set(this, "inputFiles", [...e.target.files].map((original) => {
2686
- const [, base, extension] = original.name.match(/^(.*)(\..*?)$/);
2733
+ const [, base = "", extension = "", full = ""] = original.name.match(/^(.*?)\.([^.]*)$|(.*)/);
2687
2734
  const file = Object.assign({}, {
2688
2735
  name: original.name,
2689
- base,
2736
+ base: base || full,
2690
2737
  extension,
2691
2738
  type: original.type,
2692
2739
  size: original.size,
2693
2740
  lastModified: original.lastModified,
2694
2741
  preview: null,
2695
- progress: 0
2742
+ progress: 0,
2743
+ file: original
2696
2744
  });
2697
- this.filePreview(original, file);
2745
+ this.readFile(original, file);
2698
2746
  return file;
2699
2747
  }));
2700
2748
  this.$emit("update:modelValue", this.inputFiles);
2701
2749
  this.$emit("input", this.inputFiles);
2702
- this.$emit("change", this.inputFiles);
2703
2750
  },
2704
- filePreview(original, file) {
2751
+ readFile(original, file) {
2705
2752
  const reader = new FileReader();
2706
- if (original.type && original.type.startsWith("image/")) {
2753
+ const isPreviewAnIcon = typeof this.preview === "string";
2754
+ const isFileAnImage = original.type && original.type.startsWith("image/");
2755
+ if (this.preview && !isPreviewAnIcon && isFileAnImage) {
2707
2756
  reader.addEventListener("load", (e) => {
2708
2757
  this.$set(file, "preview", e.target.result);
2709
2758
  });
2710
- }
2759
+ } else
2760
+ delete file.preview;
2711
2761
  reader.addEventListener("progress", (event) => {
2712
2762
  if (event.loaded && event.total) {
2713
2763
  this.$set(file, "progress", event.loaded * 100 / event.total);
@@ -3035,6 +3085,25 @@ var wList = /* @__PURE__ */ function() {
3035
3085
  return __component__$t.exports;
3036
3086
  }();
3037
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
+ }),
3038
3107
  computed: {
3039
3108
  appendToTarget() {
3040
3109
  const defaultTarget = ".w-app";
@@ -3062,6 +3131,24 @@ var DetachableMixin = {
3062
3131
  },
3063
3132
  detachableParentEl() {
3064
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" || "";
3065
3152
  }
3066
3153
  },
3067
3154
  methods: {
@@ -3142,14 +3229,72 @@ var DetachableMixin = {
3142
3229
  this.$nextTick(() => {
3143
3230
  var _a;
3144
3231
  this.detachableEl = ((_a = this.$refs.detachable) == null ? void 0 : _a.$el) || this.$refs.detachable;
3145
- this.appendToTarget.appendChild(this.detachableEl);
3232
+ if (this.detachableEl)
3233
+ this.appendToTarget.appendChild(this.detachableEl);
3146
3234
  resolve();
3147
3235
  });
3148
3236
  });
3149
3237
  },
3150
3238
  removeFromDOM() {
3151
- if (this.detachableEl && this.detachableEl.parentNode)
3239
+ document.removeEventListener("mousedown", this.onOutsideMousedown);
3240
+ window.removeEventListener("resize", this.onResize);
3241
+ if (this.detachableEl && this.detachableEl.parentNode) {
3242
+ this.detachableVisible = false;
3152
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();
3153
3298
  }
3154
3299
  }
3155
3300
  };
@@ -3198,24 +3343,12 @@ const __vue2_script$s = {
3198
3343
  titleClass: { type: [String, Object, Array] },
3199
3344
  contentClass: { type: [String, Object, Array] },
3200
3345
  arrow: { type: Boolean },
3201
- detachTo: { type: [String, Boolean, Object], deprecated: true },
3202
- appendTo: { type: [String, Boolean, Object] },
3203
- fixed: { type: Boolean },
3204
- top: { type: Boolean },
3205
- bottom: { type: Boolean },
3206
- left: { type: Boolean },
3207
- right: { type: Boolean },
3208
- alignTop: { type: Boolean },
3209
- alignBottom: { type: Boolean },
3210
- alignLeft: { type: Boolean },
3211
- alignRight: { type: Boolean },
3212
- zIndex: { type: [Number, String, Boolean] },
3213
3346
  minWidth: { type: [Number, String] },
3214
3347
  overlay: { type: Boolean },
3215
3348
  overlayClass: { type: [String, Object, Array] },
3216
3349
  overlayProps: { type: Object },
3217
3350
  persistent: { type: Boolean },
3218
- noPosition: { type: Boolean }
3351
+ delay: { type: Number }
3219
3352
  },
3220
3353
  emits: ["input", "update:modelValue", "open", "close"],
3221
3354
  data: () => ({
@@ -3226,7 +3359,6 @@ const __vue2_script$s = {
3226
3359
  top: 0,
3227
3360
  left: 0
3228
3361
  },
3229
- activatorEl: null,
3230
3362
  activatorWidth: 0,
3231
3363
  detachableEl: null,
3232
3364
  timeoutId: null
@@ -3235,12 +3367,6 @@ const __vue2_script$s = {
3235
3367
  transitionName() {
3236
3368
  return this.transition || "scale-fade";
3237
3369
  },
3238
- position() {
3239
- return this.top && "top" || this.bottom && "bottom" || this.left && "left" || this.right && "right" || "bottom";
3240
- },
3241
- alignment() {
3242
- 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" || "";
3243
- },
3244
3370
  menuMinWidth() {
3245
3371
  if (this.minWidth === "activator")
3246
3372
  return this.activatorWidth ? `${this.activatorWidth}px` : 0;
@@ -3287,8 +3413,8 @@ const __vue2_script$s = {
3287
3413
  let handlers = {};
3288
3414
  if (this.showOnHover) {
3289
3415
  handlers = {
3290
- focus: this.toggleMenu,
3291
- blur: this.toggleMenu,
3416
+ focus: this.toggle,
3417
+ blur: this.toggle,
3292
3418
  mouseenter: (e) => {
3293
3419
  this.hoveringActivator = true;
3294
3420
  this.open(e);
@@ -3302,15 +3428,15 @@ const __vue2_script$s = {
3302
3428
  }
3303
3429
  };
3304
3430
  if (typeof window !== "undefined" && "ontouchstart" in window) {
3305
- handlers.click = this.toggleMenu;
3431
+ handlers.click = this.toggle;
3306
3432
  }
3307
3433
  } else
3308
- handlers = { click: this.toggleMenu };
3434
+ handlers = { click: this.toggle };
3309
3435
  return handlers;
3310
3436
  }
3311
3437
  },
3312
3438
  methods: {
3313
- toggleMenu(e) {
3439
+ toggle(e) {
3314
3440
  let shouldShowMenu = this.detachableVisible;
3315
3441
  if ("ontouchstart" in window && this.showOnHover && e.type === "click") {
3316
3442
  shouldShowMenu = !shouldShowMenu;
@@ -3324,16 +3450,17 @@ const __vue2_script$s = {
3324
3450
  shouldShowMenu = false;
3325
3451
  }
3326
3452
  this.timeoutId = clearTimeout(this.timeoutId);
3327
- if (shouldShowMenu) {
3328
- this.$emit("update:modelValue", this.detachableVisible = true);
3329
- this.$emit("input", true);
3330
- this.$emit("open");
3453
+ if (shouldShowMenu)
3331
3454
  this.open(e);
3332
- } else
3455
+ else
3333
3456
  this.close();
3334
3457
  },
3335
3458
  async open(e) {
3459
+ if (this.delay)
3460
+ await new Promise((resolve) => setTimeout(resolve, this.delay));
3336
3461
  this.detachableVisible = true;
3462
+ if (this.activator)
3463
+ this.activatorEl = e.target;
3337
3464
  await this.insertInDOM();
3338
3465
  if (this.minWidth === "activator")
3339
3466
  this.activatorWidth = this.activatorEl.offsetWidth;
@@ -3363,39 +3490,6 @@ const __vue2_script$s = {
3363
3490
  document.removeEventListener("mousedown", this.onOutsideMousedown);
3364
3491
  window.removeEventListener("resize", this.onResize);
3365
3492
  }
3366
- },
3367
- mounted() {
3368
- var _a;
3369
- const wrapper = this.$el;
3370
- this.activatorEl = wrapper.firstElementChild;
3371
- wrapper.parentNode.insertBefore(this.activatorEl, wrapper);
3372
- if (this.overlay) {
3373
- this.overlayEl = (_a = this.$refs.overlay) == null ? void 0 : _a.$el;
3374
- wrapper.parentNode.insertBefore(this.overlayEl, wrapper);
3375
- }
3376
- if (this.value)
3377
- this.toggleMenu({ type: "click", target: this.activatorEl });
3378
- },
3379
- beforeDestroy() {
3380
- this.removeFromDOM();
3381
- if (this.overlay && this.overlayEl.parentNode)
3382
- this.overlayEl.remove();
3383
- if (this.activatorEl && this.activatorEl.parentNode)
3384
- this.activatorEl.remove();
3385
- },
3386
- watch: {
3387
- value(bool) {
3388
- if (!!bool !== this.detachableVisible)
3389
- this.toggleMenu({ type: "click", target: this.activatorEl });
3390
- },
3391
- detachTo() {
3392
- this.removeFromDOM();
3393
- this.insertInDOM();
3394
- },
3395
- appendTo() {
3396
- this.removeFromDOM();
3397
- this.insertInDOM();
3398
- }
3399
3493
  }
3400
3494
  };
3401
3495
  const __cssModules$s = {};
@@ -4252,8 +4346,9 @@ const __vue2_script$k = {
4252
4346
  openMenu() {
4253
4347
  this.showMenu = true;
4254
4348
  setTimeout(() => {
4349
+ var _a;
4255
4350
  const itemIndex = this.inputValue.length ? this.inputValue[0].index : 0;
4256
- this.$refs["w-list"].$el.querySelector(`#w-select-menu--${this._uid}_item-${itemIndex + 1}`).focus();
4351
+ (_a = this.$refs["w-list"].$el.querySelector(`#w-select-menu--${this._uid}_item-${itemIndex + 1}`)) == null ? void 0 : _a.focus();
4257
4352
  }, 100);
4258
4353
  },
4259
4354
  closeMenu() {
@@ -5532,7 +5627,7 @@ var render$8 = function() {
5532
5627
  var _vm = this;
5533
5628
  var _h = _vm.$createElement;
5534
5629
  var _c = _vm._self._c || _h;
5535
- 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);
5630
+ 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);
5536
5631
  };
5537
5632
  var staticRenderFns$8 = [];
5538
5633
  var wTooltip_vue_vue_type_style_index_0_lang = "";
@@ -5550,20 +5645,8 @@ const __vue2_script$8 = {
5550
5645
  round: { type: Boolean },
5551
5646
  transition: { type: String },
5552
5647
  tooltipClass: { type: [String, Object, Array] },
5553
- detachTo: { type: [String, Boolean, Object], deprecated: true },
5554
- appendTo: { type: [String, Boolean, Object] },
5555
- fixed: { type: Boolean },
5556
- top: { type: Boolean },
5557
- bottom: { type: Boolean },
5558
- left: { type: Boolean },
5559
- right: { type: Boolean },
5560
- alignTop: { type: Boolean },
5561
- alignBottom: { type: Boolean },
5562
- alignLeft: { type: Boolean },
5563
- alignRight: { type: Boolean },
5564
- zIndex: { type: [Number, String, Boolean] },
5565
5648
  persistent: { type: Boolean },
5566
- noPosition: { type: Boolean }
5649
+ delay: { type: Number }
5567
5650
  },
5568
5651
  emits: ["input", "update:modelValue", "open", "close"],
5569
5652
  data: () => ({
@@ -5573,7 +5656,6 @@ const __vue2_script$8 = {
5573
5656
  top: 0,
5574
5657
  left: 0
5575
5658
  },
5576
- activatorEl: null,
5577
5659
  detachableEl: null,
5578
5660
  timeoutId: null
5579
5661
  }),
@@ -5585,12 +5667,6 @@ const __vue2_script$8 = {
5585
5667
  const direction = this.position.replace(/top|bottom/, (m) => ({ top: "up", bottom: "down" })[m]);
5586
5668
  return this.transition || `w-tooltip-slide-fade-${direction}`;
5587
5669
  },
5588
- position() {
5589
- return this.top && "top" || this.bottom && "bottom" || this.left && "left" || this.right && "right" || "bottom";
5590
- },
5591
- alignment() {
5592
- 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" || "";
5593
- },
5594
5670
  classes() {
5595
5671
  return __spreadProps(__spreadValues({
5596
5672
  [this.color]: this.color,
@@ -5614,7 +5690,7 @@ const __vue2_script$8 = {
5614
5690
  "--w-tooltip-bg-color": this.$waveui.colors[this.bgColor || "white"]
5615
5691
  };
5616
5692
  },
5617
- eventHandlers() {
5693
+ activatorEventHandlers() {
5618
5694
  let handlers = {};
5619
5695
  if (this.showOnClick)
5620
5696
  handlers = { click: this.toggle };
@@ -5650,16 +5726,17 @@ const __vue2_script$8 = {
5650
5726
  else if (["mouseleave", "blur"].includes(e.type) && !this.showOnClick)
5651
5727
  shouldShowTooltip = false;
5652
5728
  this.timeoutId = clearTimeout(this.timeoutId);
5653
- if (shouldShowTooltip) {
5654
- this.$emit("update:modelValue", this.detachableVisible = true);
5655
- this.$emit("input", true);
5656
- this.$emit("open");
5729
+ if (shouldShowTooltip)
5657
5730
  this.open(e);
5658
- } else
5731
+ else
5659
5732
  this.close();
5660
5733
  },
5661
5734
  async open(e) {
5735
+ if (this.delay)
5736
+ await new Promise((resolve) => setTimeout(resolve, this.delay));
5662
5737
  this.detachableVisible = true;
5738
+ if (this.activator)
5739
+ this.activatorEl = e.target;
5663
5740
  await this.insertInDOM();
5664
5741
  if (this.minWidth === "activator")
5665
5742
  this.activatorWidth = this.activatorEl.offsetWidth;
@@ -5689,32 +5766,6 @@ const __vue2_script$8 = {
5689
5766
  document.removeEventListener("mousedown", this.onOutsideMousedown);
5690
5767
  window.removeEventListener("resize", this.onResize);
5691
5768
  }
5692
- },
5693
- mounted() {
5694
- const wrapper = this.$el;
5695
- this.activatorEl = wrapper.firstElementChild;
5696
- wrapper.parentNode.insertBefore(this.activatorEl, wrapper);
5697
- if (this.value)
5698
- this.toggle({ type: "click", target: this.activatorEl });
5699
- },
5700
- beforeDestroy() {
5701
- this.removeFromDOM();
5702
- if (this.activatorEl && this.activatorEl.parentNode)
5703
- this.activatorEl.remove();
5704
- },
5705
- watch: {
5706
- value(bool) {
5707
- if (bool !== this.detachableVisible)
5708
- this.toggle({ type: "click", target: this.activatorEl });
5709
- },
5710
- detachTo() {
5711
- this.removeFromDOM();
5712
- this.insertInDOM();
5713
- },
5714
- appendTo() {
5715
- this.removeFromDOM();
5716
- this.insertInDOM();
5717
- }
5718
5769
  }
5719
5770
  };
5720
5771
  const __cssModules$8 = {};