@web-utils/component 2.10.0 → 2.10.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.
@@ -5,18 +5,18 @@ var d = (e, t, i) => new Promise((o, a) => {
5
5
  } catch (r) {
6
6
  a(r);
7
7
  }
8
- }, f = (s) => {
8
+ }, u = (s) => {
9
9
  try {
10
10
  n(i.throw(s));
11
11
  } catch (r) {
12
12
  a(r);
13
13
  }
14
- }, n = (s) => s.done ? o(s.value) : Promise.resolve(s.value).then(h, f);
14
+ }, n = (s) => s.done ? o(s.value) : Promise.resolve(s.value).then(h, u);
15
15
  n((i = i.apply(e, t)).next());
16
16
  });
17
- import { getComputedWidth as p, getComputedHeight as u } from "@web-utils/core";
17
+ import { getComputedWidth as f, getComputedHeight as p } from "@web-utils/core";
18
18
  import { n as c } from "../chunks/vueComponentNormalizer.446f5dc4.mjs";
19
- var x = function() {
19
+ var v = function() {
20
20
  var e = this, t = e.$createElement, i = e._self._c || t;
21
21
  return i("Transition", {
22
22
  attrs: {
@@ -36,10 +36,15 @@ var x = function() {
36
36
  "flex-row": e.flexRow,
37
37
  "flex-column": e.flexColumn
38
38
  }],
39
- style: e.position
39
+ style: e.position,
40
+ on: {
41
+ mouseleave: function(o) {
42
+ e.hideOnMouseLeave && e.hide();
43
+ }
44
+ }
40
45
  }, [e._t("default")], 2) : e._e()]);
41
46
  }, y = [];
42
- const _ = {
47
+ const x = {
43
48
  name: "EasyPopup",
44
49
  props: {
45
50
  // 是否开启边界检测
@@ -59,7 +64,12 @@ const _ = {
59
64
  },
60
65
  appendToBody: Boolean,
61
66
  flexRow: Boolean,
62
- flexColumn: Boolean
67
+ flexColumn: Boolean,
68
+ hideOnMouseLeave: {
69
+ type: Boolean,
70
+ default: !0
71
+ },
72
+ interactive: Boolean
63
73
  },
64
74
  data() {
65
75
  return {
@@ -83,7 +93,7 @@ const _ = {
83
93
  return d(this, null, function* () {
84
94
  if (this.border) {
85
95
  yield this.$nextTick();
86
- const e = p(this.$refs.container), t = u(this.$refs.container), i = document.body.offsetWidth, o = document.body.offsetHeight;
96
+ const e = f(this.$refs.container), t = p(this.$refs.container), i = document.body.offsetWidth, o = document.body.offsetHeight;
87
97
  this.axis.x + this.offset.x + e >= i && (this.axis.x = i - e - this.borderWidth - this.offset.x), this.axis.y + this.offset.y + t >= o && (this.axis.y = o - t - this.borderWidth - this.offset.y);
88
98
  }
89
99
  });
@@ -94,29 +104,32 @@ const _ = {
94
104
  },
95
105
  methods: {
96
106
  show({ clientX: e, clientY: t }) {
97
- this.axis = { x: e, y: t }, this.visible || (document.addEventListener("click", this.hide, !0), this.rendered = !0, this.visible = !0), this.appendToBody && document.body.appendChild(this.$el);
107
+ this.axis = { x: e, y: t }, this.visible || (document.addEventListener("click", this.doHide, !0), this.rendered = !0, this.visible = !0), this.appendToBody && document.body.appendChild(this.$el);
98
108
  },
99
109
  hide() {
100
- this.visible = !1, document.removeEventListener("click", this.hide);
110
+ this.visible = !1, document.removeEventListener("click", this.doHide);
111
+ },
112
+ doHide(e) {
113
+ this.interactive && this.$el.contains(e.target) || this.hide();
101
114
  }
102
115
  }
103
116
  }, l = {};
104
- var m = /* @__PURE__ */ c(
105
- _,
117
+ var _ = /* @__PURE__ */ c(
106
118
  x,
119
+ v,
107
120
  y,
108
121
  !1,
109
- v,
122
+ m,
110
123
  null,
111
124
  null,
112
125
  null
113
126
  );
114
- function v(e) {
127
+ function m(e) {
115
128
  for (let t in l)
116
129
  this[t] = l[t];
117
130
  }
118
131
  const g = /* @__PURE__ */ function() {
119
- return m.exports;
132
+ return _.exports;
120
133
  }();
121
134
  export {
122
135
  g as default
@@ -1 +1 @@
1
- .easy-popup{position:fixed;z-index:9999;width:300px;min-height:200px;padding:12px;background:#fff;border:1px solid #ebeef5;border-radius:4px;box-shadow:0 2px 12px #0000001a;user-select:none}@keyframes easy-popup-zoom-in{0%{transform:scale3d(0,0,0);opacity:0}to{opacity:1}}.easy-popup-enter-active,.easy-popup-enter{animation:easy-popup-zoom-in .2s}@keyframes easy-popup-zoom-out{0%{opacity:1}to{transform:scale3d(0,0,0);opacity:0}}.easy-popup-leave-active,.easy-popup-leave{animation:easy-popup-zoom-out .2s}
1
+ .easy-popup{position:fixed;z-index:9999;width:300px;min-height:200px;padding:12px;background:#fff;border:1px solid #ebeef5;border-radius:4px;box-shadow:0 2px 12px #0000001a}@keyframes easy-popup-zoom-in{0%{transform:scale3d(0,0,0);opacity:0}to{opacity:1}}.easy-popup-enter-active,.easy-popup-enter{animation:easy-popup-zoom-in .2s}@keyframes easy-popup-zoom-out{0%{opacity:1}to{transform:scale3d(0,0,0);opacity:0}}.easy-popup-leave-active,.easy-popup-leave{animation:easy-popup-zoom-out .2s}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@web-utils/component",
3
3
  "description": "Web Components",
4
- "version": "2.10.0",
4
+ "version": "2.10.1",
5
5
  "author": "Simple",
6
6
  "license": "MIT",
7
7
  "type": "module",
package/web-types.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "framework": "vue",
4
4
  "name": "@web-utils/component",
5
- "version": "2.10.0",
5
+ "version": "2.10.1",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "description-markup": "markdown",
@@ -1452,6 +1452,22 @@
1452
1452
  "type": "boolean"
1453
1453
  },
1454
1454
  "default": ""
1455
+ },
1456
+ {
1457
+ "name": "hideOnMouseLeave",
1458
+ "value": {
1459
+ "kind": "expression",
1460
+ "type": "boolean"
1461
+ },
1462
+ "default": "true"
1463
+ },
1464
+ {
1465
+ "name": "interactive",
1466
+ "value": {
1467
+ "kind": "expression",
1468
+ "type": "boolean"
1469
+ },
1470
+ "default": ""
1455
1471
  }
1456
1472
  ],
1457
1473
  "slots": [