wave-ui 1.48.0 → 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.
@@ -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
  },
@@ -3079,6 +3085,25 @@ var wList = /* @__PURE__ */ function() {
3079
3085
  return __component__$t.exports;
3080
3086
  }();
3081
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
+ }),
3082
3107
  computed: {
3083
3108
  appendToTarget() {
3084
3109
  const defaultTarget = ".w-app";
@@ -3106,6 +3131,24 @@ var DetachableMixin = {
3106
3131
  },
3107
3132
  detachableParentEl() {
3108
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" || "";
3109
3152
  }
3110
3153
  },
3111
3154
  methods: {
@@ -3186,14 +3229,72 @@ var DetachableMixin = {
3186
3229
  this.$nextTick(() => {
3187
3230
  var _a;
3188
3231
  this.detachableEl = ((_a = this.$refs.detachable) == null ? void 0 : _a.$el) || this.$refs.detachable;
3189
- this.appendToTarget.appendChild(this.detachableEl);
3232
+ if (this.detachableEl)
3233
+ this.appendToTarget.appendChild(this.detachableEl);
3190
3234
  resolve();
3191
3235
  });
3192
3236
  });
3193
3237
  },
3194
3238
  removeFromDOM() {
3195
- 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;
3196
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();
3197
3298
  }
3198
3299
  }
3199
3300
  };
@@ -3242,24 +3343,12 @@ const __vue2_script$s = {
3242
3343
  titleClass: { type: [String, Object, Array] },
3243
3344
  contentClass: { type: [String, Object, Array] },
3244
3345
  arrow: { type: Boolean },
3245
- detachTo: { type: [String, Boolean, Object], deprecated: true },
3246
- appendTo: { type: [String, Boolean, Object] },
3247
- fixed: { type: Boolean },
3248
- top: { type: Boolean },
3249
- bottom: { type: Boolean },
3250
- left: { type: Boolean },
3251
- right: { type: Boolean },
3252
- alignTop: { type: Boolean },
3253
- alignBottom: { type: Boolean },
3254
- alignLeft: { type: Boolean },
3255
- alignRight: { type: Boolean },
3256
- zIndex: { type: [Number, String, Boolean] },
3257
3346
  minWidth: { type: [Number, String] },
3258
3347
  overlay: { type: Boolean },
3259
3348
  overlayClass: { type: [String, Object, Array] },
3260
3349
  overlayProps: { type: Object },
3261
3350
  persistent: { type: Boolean },
3262
- noPosition: { type: Boolean }
3351
+ delay: { type: Number }
3263
3352
  },
3264
3353
  emits: ["input", "update:modelValue", "open", "close"],
3265
3354
  data: () => ({
@@ -3270,7 +3359,6 @@ const __vue2_script$s = {
3270
3359
  top: 0,
3271
3360
  left: 0
3272
3361
  },
3273
- activatorEl: null,
3274
3362
  activatorWidth: 0,
3275
3363
  detachableEl: null,
3276
3364
  timeoutId: null
@@ -3279,12 +3367,6 @@ const __vue2_script$s = {
3279
3367
  transitionName() {
3280
3368
  return this.transition || "scale-fade";
3281
3369
  },
3282
- position() {
3283
- return this.top && "top" || this.bottom && "bottom" || this.left && "left" || this.right && "right" || "bottom";
3284
- },
3285
- alignment() {
3286
- 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" || "";
3287
- },
3288
3370
  menuMinWidth() {
3289
3371
  if (this.minWidth === "activator")
3290
3372
  return this.activatorWidth ? `${this.activatorWidth}px` : 0;
@@ -3331,8 +3413,8 @@ const __vue2_script$s = {
3331
3413
  let handlers = {};
3332
3414
  if (this.showOnHover) {
3333
3415
  handlers = {
3334
- focus: this.toggleMenu,
3335
- blur: this.toggleMenu,
3416
+ focus: this.toggle,
3417
+ blur: this.toggle,
3336
3418
  mouseenter: (e) => {
3337
3419
  this.hoveringActivator = true;
3338
3420
  this.open(e);
@@ -3346,15 +3428,15 @@ const __vue2_script$s = {
3346
3428
  }
3347
3429
  };
3348
3430
  if (typeof window !== "undefined" && "ontouchstart" in window) {
3349
- handlers.click = this.toggleMenu;
3431
+ handlers.click = this.toggle;
3350
3432
  }
3351
3433
  } else
3352
- handlers = { click: this.toggleMenu };
3434
+ handlers = { click: this.toggle };
3353
3435
  return handlers;
3354
3436
  }
3355
3437
  },
3356
3438
  methods: {
3357
- toggleMenu(e) {
3439
+ toggle(e) {
3358
3440
  let shouldShowMenu = this.detachableVisible;
3359
3441
  if ("ontouchstart" in window && this.showOnHover && e.type === "click") {
3360
3442
  shouldShowMenu = !shouldShowMenu;
@@ -3368,16 +3450,17 @@ const __vue2_script$s = {
3368
3450
  shouldShowMenu = false;
3369
3451
  }
3370
3452
  this.timeoutId = clearTimeout(this.timeoutId);
3371
- if (shouldShowMenu) {
3372
- this.$emit("update:modelValue", this.detachableVisible = true);
3373
- this.$emit("input", true);
3374
- this.$emit("open");
3453
+ if (shouldShowMenu)
3375
3454
  this.open(e);
3376
- } else
3455
+ else
3377
3456
  this.close();
3378
3457
  },
3379
3458
  async open(e) {
3459
+ if (this.delay)
3460
+ await new Promise((resolve) => setTimeout(resolve, this.delay));
3380
3461
  this.detachableVisible = true;
3462
+ if (this.activator)
3463
+ this.activatorEl = e.target;
3381
3464
  await this.insertInDOM();
3382
3465
  if (this.minWidth === "activator")
3383
3466
  this.activatorWidth = this.activatorEl.offsetWidth;
@@ -3407,39 +3490,6 @@ const __vue2_script$s = {
3407
3490
  document.removeEventListener("mousedown", this.onOutsideMousedown);
3408
3491
  window.removeEventListener("resize", this.onResize);
3409
3492
  }
3410
- },
3411
- mounted() {
3412
- var _a;
3413
- const wrapper = this.$el;
3414
- this.activatorEl = wrapper.firstElementChild;
3415
- wrapper.parentNode.insertBefore(this.activatorEl, wrapper);
3416
- if (this.overlay) {
3417
- this.overlayEl = (_a = this.$refs.overlay) == null ? void 0 : _a.$el;
3418
- wrapper.parentNode.insertBefore(this.overlayEl, wrapper);
3419
- }
3420
- if (this.value)
3421
- this.toggleMenu({ type: "click", target: this.activatorEl });
3422
- },
3423
- beforeDestroy() {
3424
- this.removeFromDOM();
3425
- if (this.overlay && this.overlayEl.parentNode)
3426
- this.overlayEl.remove();
3427
- if (this.activatorEl && this.activatorEl.parentNode)
3428
- this.activatorEl.remove();
3429
- },
3430
- watch: {
3431
- value(bool) {
3432
- if (!!bool !== this.detachableVisible)
3433
- this.toggleMenu({ type: "click", target: this.activatorEl });
3434
- },
3435
- detachTo() {
3436
- this.removeFromDOM();
3437
- this.insertInDOM();
3438
- },
3439
- appendTo() {
3440
- this.removeFromDOM();
3441
- this.insertInDOM();
3442
- }
3443
3493
  }
3444
3494
  };
3445
3495
  const __cssModules$s = {};
@@ -5576,7 +5626,7 @@ var render$8 = function() {
5576
5626
  var _vm = this;
5577
5627
  var _h = _vm.$createElement;
5578
5628
  var _c = _vm._self._c || _h;
5579
- 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);
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);
5580
5630
  };
5581
5631
  var staticRenderFns$8 = [];
5582
5632
  var wTooltip_vue_vue_type_style_index_0_lang = "";
@@ -5594,20 +5644,8 @@ const __vue2_script$8 = {
5594
5644
  round: { type: Boolean },
5595
5645
  transition: { type: String },
5596
5646
  tooltipClass: { type: [String, Object, Array] },
5597
- detachTo: { type: [String, Boolean, Object], deprecated: true },
5598
- appendTo: { type: [String, Boolean, Object] },
5599
- fixed: { type: Boolean },
5600
- top: { type: Boolean },
5601
- bottom: { type: Boolean },
5602
- left: { type: Boolean },
5603
- right: { type: Boolean },
5604
- alignTop: { type: Boolean },
5605
- alignBottom: { type: Boolean },
5606
- alignLeft: { type: Boolean },
5607
- alignRight: { type: Boolean },
5608
- zIndex: { type: [Number, String, Boolean] },
5609
5647
  persistent: { type: Boolean },
5610
- noPosition: { type: Boolean }
5648
+ delay: { type: Number }
5611
5649
  },
5612
5650
  emits: ["input", "update:modelValue", "open", "close"],
5613
5651
  data: () => ({
@@ -5617,7 +5655,6 @@ const __vue2_script$8 = {
5617
5655
  top: 0,
5618
5656
  left: 0
5619
5657
  },
5620
- activatorEl: null,
5621
5658
  detachableEl: null,
5622
5659
  timeoutId: null
5623
5660
  }),
@@ -5629,12 +5666,6 @@ const __vue2_script$8 = {
5629
5666
  const direction = this.position.replace(/top|bottom/, (m) => ({ top: "up", bottom: "down" })[m]);
5630
5667
  return this.transition || `w-tooltip-slide-fade-${direction}`;
5631
5668
  },
5632
- position() {
5633
- return this.top && "top" || this.bottom && "bottom" || this.left && "left" || this.right && "right" || "bottom";
5634
- },
5635
- alignment() {
5636
- 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" || "";
5637
- },
5638
5669
  classes() {
5639
5670
  return __spreadProps(__spreadValues({
5640
5671
  [this.color]: this.color,
@@ -5658,7 +5689,7 @@ const __vue2_script$8 = {
5658
5689
  "--w-tooltip-bg-color": this.$waveui.colors[this.bgColor || "white"]
5659
5690
  };
5660
5691
  },
5661
- eventHandlers() {
5692
+ activatorEventHandlers() {
5662
5693
  let handlers = {};
5663
5694
  if (this.showOnClick)
5664
5695
  handlers = { click: this.toggle };
@@ -5694,16 +5725,17 @@ const __vue2_script$8 = {
5694
5725
  else if (["mouseleave", "blur"].includes(e.type) && !this.showOnClick)
5695
5726
  shouldShowTooltip = false;
5696
5727
  this.timeoutId = clearTimeout(this.timeoutId);
5697
- if (shouldShowTooltip) {
5698
- this.$emit("update:modelValue", this.detachableVisible = true);
5699
- this.$emit("input", true);
5700
- this.$emit("open");
5728
+ if (shouldShowTooltip)
5701
5729
  this.open(e);
5702
- } else
5730
+ else
5703
5731
  this.close();
5704
5732
  },
5705
5733
  async open(e) {
5734
+ if (this.delay)
5735
+ await new Promise((resolve) => setTimeout(resolve, this.delay));
5706
5736
  this.detachableVisible = true;
5737
+ if (this.activator)
5738
+ this.activatorEl = e.target;
5707
5739
  await this.insertInDOM();
5708
5740
  if (this.minWidth === "activator")
5709
5741
  this.activatorWidth = this.activatorEl.offsetWidth;
@@ -5733,32 +5765,6 @@ const __vue2_script$8 = {
5733
5765
  document.removeEventListener("mousedown", this.onOutsideMousedown);
5734
5766
  window.removeEventListener("resize", this.onResize);
5735
5767
  }
5736
- },
5737
- mounted() {
5738
- const wrapper = this.$el;
5739
- this.activatorEl = wrapper.firstElementChild;
5740
- wrapper.parentNode.insertBefore(this.activatorEl, wrapper);
5741
- if (this.value)
5742
- this.toggle({ type: "click", target: this.activatorEl });
5743
- },
5744
- beforeDestroy() {
5745
- this.removeFromDOM();
5746
- if (this.activatorEl && this.activatorEl.parentNode)
5747
- this.activatorEl.remove();
5748
- },
5749
- watch: {
5750
- value(bool) {
5751
- if (bool !== this.detachableVisible)
5752
- this.toggle({ type: "click", target: this.activatorEl });
5753
- },
5754
- detachTo() {
5755
- this.removeFromDOM();
5756
- this.insertInDOM();
5757
- },
5758
- appendTo() {
5759
- this.removeFromDOM();
5760
- this.insertInDOM();
5761
- }
5762
5768
  }
5763
5769
  };
5764
5770
  const __cssModules$8 = {};