wave-ui 1.46.0 → 1.49.1

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
  },
@@ -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("Are you sure?")];
1608
- })], 2), _c("div", { staticClass: "w-flex justify-end", class: _vm.inline ? "ml2" : "mt2" }, [!_vm.noCancel ? _c("w-button", _vm._b({ staticClass: "mr2", attrs: { "bg-color": (_vm.cancelButton || {}).bgColor || "error" }, on: { "click": _vm.onCancel } }, "w-button", _vm.cancelButton, false), [_vm._t("cancel", function() {
1609
- return [_vm._v("Cancel")];
1610
- })], 2) : _vm._e(), _c("w-button", _vm._b({ attrs: { "bg-color": (_vm.confirmButton || {}).bgColor || "success" }, on: { "click": _vm.onConfirm } }, "w-button", _vm.confirmButton, false), [_vm._t("confirm", function() {
1611
- return [_vm._v("Confirm")];
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
- noCancel: { type: Boolean },
1623
- cancelButton: { type: [Boolean, Object] },
1624
- confirmButton: { type: Object },
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.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) {
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 wi-file w-input__file-preview primary" })];
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(), _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);
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
- 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.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.filePreview(original, file);
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
- filePreview(original, file) {
2751
+ readFile(original, file) {
2685
2752
  const reader = new FileReader();
2686
- 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) {
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);
@@ -3015,6 +3085,25 @@ var wList = /* @__PURE__ */ function() {
3015
3085
  return __component__$t.exports;
3016
3086
  }();
3017
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
+ }),
3018
3107
  computed: {
3019
3108
  appendToTarget() {
3020
3109
  const defaultTarget = ".w-app";
@@ -3042,6 +3131,24 @@ var DetachableMixin = {
3042
3131
  },
3043
3132
  detachableParentEl() {
3044
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" || "";
3045
3152
  }
3046
3153
  },
3047
3154
  methods: {
@@ -3122,14 +3229,72 @@ var DetachableMixin = {
3122
3229
  this.$nextTick(() => {
3123
3230
  var _a;
3124
3231
  this.detachableEl = ((_a = this.$refs.detachable) == null ? void 0 : _a.$el) || this.$refs.detachable;
3125
- this.appendToTarget.appendChild(this.detachableEl);
3232
+ if (this.detachableEl)
3233
+ this.appendToTarget.appendChild(this.detachableEl);
3126
3234
  resolve();
3127
3235
  });
3128
3236
  });
3129
3237
  },
3130
3238
  removeFromDOM() {
3131
- 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;
3132
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();
3133
3298
  }
3134
3299
  }
3135
3300
  };
@@ -3178,24 +3343,12 @@ const __vue2_script$s = {
3178
3343
  titleClass: { type: [String, Object, Array] },
3179
3344
  contentClass: { type: [String, Object, Array] },
3180
3345
  arrow: { type: Boolean },
3181
- detachTo: { type: [String, Boolean, Object], deprecated: true },
3182
- appendTo: { type: [String, Boolean, Object] },
3183
- fixed: { type: Boolean },
3184
- top: { type: Boolean },
3185
- bottom: { type: Boolean },
3186
- left: { type: Boolean },
3187
- right: { type: Boolean },
3188
- alignTop: { type: Boolean },
3189
- alignBottom: { type: Boolean },
3190
- alignLeft: { type: Boolean },
3191
- alignRight: { type: Boolean },
3192
- zIndex: { type: [Number, String, Boolean] },
3193
3346
  minWidth: { type: [Number, String] },
3194
3347
  overlay: { type: Boolean },
3195
3348
  overlayClass: { type: [String, Object, Array] },
3196
3349
  overlayProps: { type: Object },
3197
3350
  persistent: { type: Boolean },
3198
- noPosition: { type: Boolean }
3351
+ delay: { type: Number }
3199
3352
  },
3200
3353
  emits: ["input", "update:modelValue", "open", "close"],
3201
3354
  data: () => ({
@@ -3206,7 +3359,6 @@ const __vue2_script$s = {
3206
3359
  top: 0,
3207
3360
  left: 0
3208
3361
  },
3209
- activatorEl: null,
3210
3362
  activatorWidth: 0,
3211
3363
  detachableEl: null,
3212
3364
  timeoutId: null
@@ -3215,12 +3367,6 @@ const __vue2_script$s = {
3215
3367
  transitionName() {
3216
3368
  return this.transition || "scale-fade";
3217
3369
  },
3218
- position() {
3219
- return this.top && "top" || this.bottom && "bottom" || this.left && "left" || this.right && "right" || "bottom";
3220
- },
3221
- alignment() {
3222
- return ["top", "bottom"].includes(this.position) && this.alignLeft && "left" || ["top", "bottom"].includes(this.position) && this.alignRight && "right" || ["left", "right"].includes(this.position) && this.alignTop && "top" || ["left", "right"].includes(this.position) && this.alignBottom && "bottom" || "";
3223
- },
3224
3370
  menuMinWidth() {
3225
3371
  if (this.minWidth === "activator")
3226
3372
  return this.activatorWidth ? `${this.activatorWidth}px` : 0;
@@ -3267,8 +3413,8 @@ const __vue2_script$s = {
3267
3413
  let handlers = {};
3268
3414
  if (this.showOnHover) {
3269
3415
  handlers = {
3270
- focus: this.toggleMenu,
3271
- blur: this.toggleMenu,
3416
+ focus: this.toggle,
3417
+ blur: this.toggle,
3272
3418
  mouseenter: (e) => {
3273
3419
  this.hoveringActivator = true;
3274
3420
  this.open(e);
@@ -3282,15 +3428,15 @@ const __vue2_script$s = {
3282
3428
  }
3283
3429
  };
3284
3430
  if (typeof window !== "undefined" && "ontouchstart" in window) {
3285
- handlers.click = this.toggleMenu;
3431
+ handlers.click = this.toggle;
3286
3432
  }
3287
3433
  } else
3288
- handlers = { click: this.toggleMenu };
3434
+ handlers = { click: this.toggle };
3289
3435
  return handlers;
3290
3436
  }
3291
3437
  },
3292
3438
  methods: {
3293
- toggleMenu(e) {
3439
+ toggle(e) {
3294
3440
  let shouldShowMenu = this.detachableVisible;
3295
3441
  if ("ontouchstart" in window && this.showOnHover && e.type === "click") {
3296
3442
  shouldShowMenu = !shouldShowMenu;
@@ -3304,16 +3450,17 @@ const __vue2_script$s = {
3304
3450
  shouldShowMenu = false;
3305
3451
  }
3306
3452
  this.timeoutId = clearTimeout(this.timeoutId);
3307
- if (shouldShowMenu) {
3308
- this.$emit("update:modelValue", this.detachableVisible = true);
3309
- this.$emit("input", true);
3310
- this.$emit("open");
3453
+ if (shouldShowMenu)
3311
3454
  this.open(e);
3312
- } else
3455
+ else
3313
3456
  this.close();
3314
3457
  },
3315
3458
  async open(e) {
3459
+ if (this.delay)
3460
+ await new Promise((resolve) => setTimeout(resolve, this.delay));
3316
3461
  this.detachableVisible = true;
3462
+ if (this.activator)
3463
+ this.activatorEl = e.target;
3317
3464
  await this.insertInDOM();
3318
3465
  if (this.minWidth === "activator")
3319
3466
  this.activatorWidth = this.activatorEl.offsetWidth;
@@ -3343,39 +3490,6 @@ const __vue2_script$s = {
3343
3490
  document.removeEventListener("mousedown", this.onOutsideMousedown);
3344
3491
  window.removeEventListener("resize", this.onResize);
3345
3492
  }
3346
- },
3347
- mounted() {
3348
- var _a;
3349
- const wrapper = this.$el;
3350
- this.activatorEl = wrapper.firstElementChild;
3351
- wrapper.parentNode.insertBefore(this.activatorEl, wrapper);
3352
- if (this.overlay) {
3353
- this.overlayEl = (_a = this.$refs.overlay) == null ? void 0 : _a.$el;
3354
- wrapper.parentNode.insertBefore(this.overlayEl, wrapper);
3355
- }
3356
- if (this.value)
3357
- this.toggleMenu({ type: "click", target: this.activatorEl });
3358
- },
3359
- beforeDestroy() {
3360
- this.removeFromDOM();
3361
- if (this.overlay && this.overlayEl.parentNode)
3362
- this.overlayEl.remove();
3363
- if (this.activatorEl && this.activatorEl.parentNode)
3364
- this.activatorEl.remove();
3365
- },
3366
- watch: {
3367
- value(bool) {
3368
- if (!!bool !== this.detachableVisible)
3369
- this.toggleMenu({ type: "click", target: this.activatorEl });
3370
- },
3371
- detachTo() {
3372
- this.removeFromDOM();
3373
- this.insertInDOM();
3374
- },
3375
- appendTo() {
3376
- this.removeFromDOM();
3377
- this.insertInDOM();
3378
- }
3379
3493
  }
3380
3494
  };
3381
3495
  const __cssModules$s = {};
@@ -4232,8 +4346,9 @@ const __vue2_script$k = {
4232
4346
  openMenu() {
4233
4347
  this.showMenu = true;
4234
4348
  setTimeout(() => {
4349
+ var _a;
4235
4350
  const itemIndex = this.inputValue.length ? this.inputValue[0].index : 0;
4236
- 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();
4237
4352
  }, 100);
4238
4353
  },
4239
4354
  closeMenu() {
@@ -5512,7 +5627,7 @@ var render$8 = function() {
5512
5627
  var _vm = this;
5513
5628
  var _h = _vm.$createElement;
5514
5629
  var _c = _vm._self._c || _h;
5515
- return _c("div", { staticClass: "w-tooltip-wrap" }, [_vm._t("activator", null, { "on": _vm.eventHandlers }), _c("transition", { attrs: { "name": _vm.transitionName, "appear": "" } }, [_vm.detachableVisible ? _c("div", { ref: "detachable", staticClass: "w-tooltip", class: _vm.classes, style: _vm.styles }, [_vm._t("default")], 2) : _vm._e()])], 2);
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);
5516
5631
  };
5517
5632
  var staticRenderFns$8 = [];
5518
5633
  var wTooltip_vue_vue_type_style_index_0_lang = "";
@@ -5530,20 +5645,8 @@ const __vue2_script$8 = {
5530
5645
  round: { type: Boolean },
5531
5646
  transition: { type: String },
5532
5647
  tooltipClass: { type: [String, Object, Array] },
5533
- detachTo: { type: [String, Boolean, Object], deprecated: true },
5534
- appendTo: { type: [String, Boolean, Object] },
5535
- fixed: { type: Boolean },
5536
- top: { type: Boolean },
5537
- bottom: { type: Boolean },
5538
- left: { type: Boolean },
5539
- right: { type: Boolean },
5540
- alignTop: { type: Boolean },
5541
- alignBottom: { type: Boolean },
5542
- alignLeft: { type: Boolean },
5543
- alignRight: { type: Boolean },
5544
- zIndex: { type: [Number, String, Boolean] },
5545
5648
  persistent: { type: Boolean },
5546
- noPosition: { type: Boolean }
5649
+ delay: { type: Number }
5547
5650
  },
5548
5651
  emits: ["input", "update:modelValue", "open", "close"],
5549
5652
  data: () => ({
@@ -5553,7 +5656,6 @@ const __vue2_script$8 = {
5553
5656
  top: 0,
5554
5657
  left: 0
5555
5658
  },
5556
- activatorEl: null,
5557
5659
  detachableEl: null,
5558
5660
  timeoutId: null
5559
5661
  }),
@@ -5565,12 +5667,6 @@ const __vue2_script$8 = {
5565
5667
  const direction = this.position.replace(/top|bottom/, (m) => ({ top: "up", bottom: "down" })[m]);
5566
5668
  return this.transition || `w-tooltip-slide-fade-${direction}`;
5567
5669
  },
5568
- position() {
5569
- return this.top && "top" || this.bottom && "bottom" || this.left && "left" || this.right && "right" || "bottom";
5570
- },
5571
- alignment() {
5572
- return ["top", "bottom"].includes(this.position) && this.alignLeft && "left" || ["top", "bottom"].includes(this.position) && this.alignRight && "right" || ["left", "right"].includes(this.position) && this.alignTop && "top" || ["left", "right"].includes(this.position) && this.alignBottom && "bottom" || "";
5573
- },
5574
5670
  classes() {
5575
5671
  return __spreadProps(__spreadValues({
5576
5672
  [this.color]: this.color,
@@ -5594,7 +5690,7 @@ const __vue2_script$8 = {
5594
5690
  "--w-tooltip-bg-color": this.$waveui.colors[this.bgColor || "white"]
5595
5691
  };
5596
5692
  },
5597
- eventHandlers() {
5693
+ activatorEventHandlers() {
5598
5694
  let handlers = {};
5599
5695
  if (this.showOnClick)
5600
5696
  handlers = { click: this.toggle };
@@ -5630,16 +5726,17 @@ const __vue2_script$8 = {
5630
5726
  else if (["mouseleave", "blur"].includes(e.type) && !this.showOnClick)
5631
5727
  shouldShowTooltip = false;
5632
5728
  this.timeoutId = clearTimeout(this.timeoutId);
5633
- if (shouldShowTooltip) {
5634
- this.$emit("update:modelValue", this.detachableVisible = true);
5635
- this.$emit("input", true);
5636
- this.$emit("open");
5729
+ if (shouldShowTooltip)
5637
5730
  this.open(e);
5638
- } else
5731
+ else
5639
5732
  this.close();
5640
5733
  },
5641
5734
  async open(e) {
5735
+ if (this.delay)
5736
+ await new Promise((resolve) => setTimeout(resolve, this.delay));
5642
5737
  this.detachableVisible = true;
5738
+ if (this.activator)
5739
+ this.activatorEl = e.target;
5643
5740
  await this.insertInDOM();
5644
5741
  if (this.minWidth === "activator")
5645
5742
  this.activatorWidth = this.activatorEl.offsetWidth;
@@ -5669,32 +5766,6 @@ const __vue2_script$8 = {
5669
5766
  document.removeEventListener("mousedown", this.onOutsideMousedown);
5670
5767
  window.removeEventListener("resize", this.onResize);
5671
5768
  }
5672
- },
5673
- mounted() {
5674
- const wrapper = this.$el;
5675
- this.activatorEl = wrapper.firstElementChild;
5676
- wrapper.parentNode.insertBefore(this.activatorEl, wrapper);
5677
- if (this.value)
5678
- this.toggle({ type: "click", target: this.activatorEl });
5679
- },
5680
- beforeDestroy() {
5681
- this.removeFromDOM();
5682
- if (this.activatorEl && this.activatorEl.parentNode)
5683
- this.activatorEl.remove();
5684
- },
5685
- watch: {
5686
- value(bool) {
5687
- if (bool !== this.detachableVisible)
5688
- this.toggle({ type: "click", target: this.activatorEl });
5689
- },
5690
- detachTo() {
5691
- this.removeFromDOM();
5692
- this.insertInDOM();
5693
- },
5694
- appendTo() {
5695
- this.removeFromDOM();
5696
- this.insertInDOM();
5697
- }
5698
5769
  }
5699
5770
  };
5700
5771
  const __cssModules$8 = {};