zartui 2.0.87 → 2.0.89

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.
@@ -2,9 +2,23 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.default = void 0;
5
+
6
+ var _context = require("../context");
7
+
5
8
  var _default = {
6
9
  render: function render() {
7
10
  var h = arguments[0];
11
+
12
+ var baseId = _context.context.baseId();
13
+
14
+ var getId = function getId(num) {
15
+ return baseId + "-" + num;
16
+ };
17
+
18
+ var getUrlById = function getUrlById(num) {
19
+ return "url(#" + getId(num) + ")";
20
+ };
21
+
8
22
  return h("svg", {
9
23
  "attrs": {
10
24
  "xmlns": "http://www.w3.org/2000/svg",
@@ -16,7 +30,7 @@ var _default = {
16
30
  "y1": "7.10247992%",
17
31
  "x2": "50%",
18
32
  "y2": "106.117243%",
19
- "id": "wzndu5old__oxdoqjk06b"
33
+ "id": getId(1)
20
34
  }
21
35
  }, [h("stop", {
22
36
  "attrs": {
@@ -34,7 +48,7 @@ var _default = {
34
48
  "y1": "0%",
35
49
  "x2": "50%",
36
50
  "y2": "100%",
37
- "id": "wzndu5old__c14euxc0ba"
51
+ "id": getId(2)
38
52
  }
39
53
  }, [h("stop", {
40
54
  "attrs": {
@@ -53,7 +67,7 @@ var _default = {
53
67
  "width": "164.3%",
54
68
  "height": "163.2%",
55
69
  "filterUnits": "objectBoundingBox",
56
- "id": "wzndu5old__h6dsmrn7ic"
70
+ "id": getId(3)
57
71
  }
58
72
  }, [h("feOffset", {
59
73
  "attrs": {
@@ -79,7 +93,7 @@ var _default = {
79
93
  "width": "220%",
80
94
  "height": "220%",
81
95
  "filterUnits": "objectBoundingBox",
82
- "id": "wzndu5old__eidtmi82we"
96
+ "id": getId(4)
83
97
  }
84
98
  }, [h("feOffset", {
85
99
  "attrs": {
@@ -128,14 +142,14 @@ var _default = {
128
142
  }), h("path", {
129
143
  "attrs": {
130
144
  "d": "M56,44 L96,44 C102.627417,44 108,49.372583 108,56 L108,86 C108,103.673112 93.673112,118 76,118 L56,118 C49.372583,118 44,112.627417 44,106 L44,56 C44,49.372583 49.372583,44 56,44 Z",
131
- "stroke": "url(#wzndu5old__c14euxc0ba)",
145
+ "stroke": getUrlById(2),
132
146
  "stroke-width": "8",
133
- "fill": "url(#wzndu5old__oxdoqjk06b)"
147
+ "fill": getUrlById(1)
134
148
  }
135
149
  }), h("use", {
136
150
  "attrs": {
137
151
  "fill": "#000",
138
- "filter": "url(#wzndu5old__h6dsmrn7ic)",
152
+ "filter": getUrlById(3),
139
153
  "href": "#wzndu5old__5o6h16nqxd"
140
154
  }
141
155
  }), h("use", {
@@ -150,7 +164,7 @@ var _default = {
150
164
  }, [h("use", {
151
165
  "attrs": {
152
166
  "fill": "#000",
153
- "filter": "url(#wzndu5old__eidtmi82we)",
167
+ "filter": getUrlById(4),
154
168
  "href": "#wzndu5old__x5no4qqv6f"
155
169
  }
156
170
  }), h("use", {
@@ -2,9 +2,23 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.default = void 0;
5
+
6
+ var _context = require("../context");
7
+
5
8
  var _default = {
6
9
  render: function render() {
7
10
  var h = arguments[0];
11
+
12
+ var baseId = _context.context.baseId();
13
+
14
+ var getId = function getId(num) {
15
+ return baseId + "-" + num;
16
+ };
17
+
18
+ var getUrlById = function getUrlById(num) {
19
+ return "url(#" + getId(num) + ")";
20
+ };
21
+
8
22
  return h("svg", {
9
23
  "attrs": {
10
24
  "xmlns": "http://www.w3.org/2000/svg",
@@ -16,7 +30,7 @@ var _default = {
16
30
  "y1": "7.10247992%",
17
31
  "x2": "50%",
18
32
  "y2": "106.117243%",
19
- "id": "b6br24f2e__7twq6ap7jb"
33
+ "id": getId(1)
20
34
  }
21
35
  }, [h("stop", {
22
36
  "attrs": {
@@ -34,7 +48,7 @@ var _default = {
34
48
  "y1": "0%",
35
49
  "x2": "50%",
36
50
  "y2": "100%",
37
- "id": "b6br24f2e__yx4w9z757a"
51
+ "id": getId(2)
38
52
  }
39
53
  }, [h("stop", {
40
54
  "attrs": {
@@ -53,7 +67,7 @@ var _default = {
53
67
  "width": "153.1%",
54
68
  "height": "145.9%",
55
69
  "filterUnits": "objectBoundingBox",
56
- "id": "b6br24f2e__449nw52c3c"
70
+ "id": getId(3)
57
71
  }
58
72
  }, [h("feOffset", {
59
73
  "attrs": {
@@ -97,9 +111,9 @@ var _default = {
97
111
  }), h("path", {
98
112
  "attrs": {
99
113
  "d": "M56,44 L96,44 C102.627417,44 108,49.372583 108,56 L108,86 C108,103.673112 93.673112,118 76,118 L56,118 C49.372583,118 44,112.627417 44,106 L44,56 C44,49.372583 49.372583,44 56,44 Z",
100
- "stroke": "url(#b6br24f2e__yx4w9z757a)",
114
+ "stroke": getUrlById(2),
101
115
  "stroke-width": "8",
102
- "fill": "url(#b6br24f2e__7twq6ap7jb)"
116
+ "fill": getUrlById(1)
103
117
  }
104
118
  }), h("rect", {
105
119
  "attrs": {
@@ -122,7 +136,7 @@ var _default = {
122
136
  }), h("use", {
123
137
  "attrs": {
124
138
  "fill": "#000",
125
- "filter": "url(#b6br24f2e__449nw52c3c)",
139
+ "filter": getUrlById(3),
126
140
  "href": "#b6br24f2e__32x2s61owd"
127
141
  }
128
142
  }), h("use", {
@@ -2,9 +2,23 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.default = void 0;
5
+
6
+ var _context = require("../context");
7
+
5
8
  var _default = {
6
9
  render: function render() {
7
10
  var h = arguments[0];
11
+
12
+ var baseId = _context.context.baseId();
13
+
14
+ var getId = function getId(num) {
15
+ return baseId + "-" + num;
16
+ };
17
+
18
+ var getUrlById = function getUrlById(num) {
19
+ return "url(#" + getId(num) + ")";
20
+ };
21
+
8
22
  return h("svg", {
9
23
  "attrs": {
10
24
  "xmlns": "http://www.w3.org/2000/svg",
@@ -16,7 +30,7 @@ var _default = {
16
30
  "y1": "7.10247992%",
17
31
  "x2": "50%",
18
32
  "y2": "106.117243%",
19
- "id": "2rmfwsc5q__14emiclh8b"
33
+ "id": getId(1)
20
34
  }
21
35
  }, [h("stop", {
22
36
  "attrs": {
@@ -34,7 +48,7 @@ var _default = {
34
48
  "y1": "0%",
35
49
  "x2": "50%",
36
50
  "y2": "100%",
37
- "id": "2rmfwsc5q__6oj76fxcba"
51
+ "id": getId(2)
38
52
  }
39
53
  }, [h("stop", {
40
54
  "attrs": {
@@ -53,7 +67,7 @@ var _default = {
53
67
  "width": "139.3%",
54
68
  "height": "175%",
55
69
  "filterUnits": "objectBoundingBox",
56
- "id": "2rmfwsc5q__u7lzzoc7wc"
70
+ "id": getId(3)
57
71
  }
58
72
  }, [h("feMorphology", {
59
73
  "attrs": {
@@ -93,7 +107,7 @@ var _default = {
93
107
  "width": "170.8%",
94
108
  "height": "525%",
95
109
  "filterUnits": "objectBoundingBox",
96
- "id": "2rmfwsc5q__2j24stggwe"
110
+ "id": getId(4)
97
111
  }
98
112
  }, [h("feOffset", {
99
113
  "attrs": {
@@ -147,9 +161,9 @@ var _default = {
147
161
  }), h("path", {
148
162
  "attrs": {
149
163
  "d": "M12,0 L52,0 C58.627417,-1.21743675e-15 64,5.372583 64,12 L64,76 C64,82.627417 58.627417,88 52,88 L12,88 C5.372583,88 8.11624501e-16,82.627417 0,76 L0,12 C-8.11624501e-16,5.372583 5.372583,1.21743675e-15 12,0 Z",
150
- "stroke": "url(#2rmfwsc5q__6oj76fxcba)",
164
+ "stroke": getUrlById(2),
151
165
  "stroke-width": "8",
152
- "fill": "url(#2rmfwsc5q__14emiclh8b)",
166
+ "fill": getUrlById(1),
153
167
  "transform": "translate(65 54)"
154
168
  }
155
169
  }), h("g", {
@@ -159,7 +173,7 @@ var _default = {
159
173
  }, [h("use", {
160
174
  "attrs": {
161
175
  "fill": "#000",
162
- "filter": "url(#2rmfwsc5q__u7lzzoc7wc)",
176
+ "filter": getUrlById(3),
163
177
  "href": "#2rmfwsc5q__qij95mlwxd"
164
178
  }
165
179
  }), h("use", {
@@ -175,7 +189,7 @@ var _default = {
175
189
  }, [h("use", {
176
190
  "attrs": {
177
191
  "fill": "#000",
178
- "filter": "url(#2rmfwsc5q__2j24stggwe)",
192
+ "filter": getUrlById(4),
179
193
  "href": "#2rmfwsc5q__pnuynj40wf"
180
194
  }
181
195
  }), h("use", {
package/lib/index.js CHANGED
@@ -313,7 +313,7 @@ exports.Toast = _toast.default;
313
313
  var _uploader = _interopRequireDefault(require("./uploader"));
314
314
 
315
315
  exports.Uploader = _uploader.default;
316
- var version = '2.0.87';
316
+ var version = '2.0.89';
317
317
  exports.version = version;
318
318
 
319
319
  function install(Vue) {
@@ -5,6 +5,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  exports.__esModule = true;
6
6
  exports.default = void 0;
7
7
 
8
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
+
10
+ var _babelHelperVueJsxMergeProps = _interopRequireDefault(require("@vue/babel-helper-vue-jsx-merge-props"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
+
8
14
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
15
 
10
16
  var _popperjs = require("@vant/popperjs");
@@ -19,6 +25,8 @@ var _icon = _interopRequireDefault(require("../icon"));
19
25
 
20
26
  var _popup = _interopRequireDefault(require("../popup"));
21
27
 
28
+ var _dom = require("@floating-ui/dom");
29
+
22
30
  // Mixins
23
31
  // Components
24
32
  var _createNamespace = (0, _utils.createNamespace)('popover'),
@@ -61,10 +69,31 @@ var _default2 = createComponent({
61
69
  closeOnClickAction: {
62
70
  type: Boolean,
63
71
  default: true
72
+ },
73
+ customClass: {
74
+ type: String,
75
+ default: ''
76
+ },
77
+ autoAdjustOverflow: {
78
+ type: Boolean,
79
+ default: false
64
80
  }
65
81
  },
66
82
  watch: {
67
- value: 'updateLocation',
83
+ value: {
84
+ handler: function handler(val) {
85
+ var _this = this;
86
+
87
+ if (val) {
88
+ this.$nextTick(function () {
89
+ _this.autoUpdatePopup();
90
+ });
91
+ }
92
+
93
+ this.updateLocation();
94
+ },
95
+ immediate: true
96
+ },
68
97
  placement: 'updateLocation'
69
98
  },
70
99
  mounted: function mounted() {
@@ -93,25 +122,111 @@ var _default2 = createComponent({
93
122
  })]
94
123
  });
95
124
  },
125
+ autoUpdatePopup: function autoUpdatePopup() {
126
+ if (this.$refs.wrapper && this.$refs.popover && this.autoAdjustOverflow) {
127
+ (0, _dom.autoUpdate)(this.$refs.wrapper, this.$refs.popover.$el, this.updatePopup, {
128
+ elementResize: typeof ResizeObserver !== 'undefined'
129
+ });
130
+ }
131
+ },
132
+ updatePopup: function updatePopup() {
133
+ var _this2 = this;
134
+
135
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
136
+ var popoverEl, wrapperEl, _yield$computePositio, x, y, realPlacement, middlewareData, popupTop;
137
+
138
+ return _regenerator.default.wrap(function _callee$(_context) {
139
+ while (1) {
140
+ switch (_context.prev = _context.next) {
141
+ case 0:
142
+ if (!(_this2.$refs.wrapper && _this2.$refs.popover.$el && _this2.$refs.arrow)) {
143
+ _context.next = 15;
144
+ break;
145
+ }
146
+
147
+ popoverEl = _this2.$refs.popover.$el;
148
+ wrapperEl = _this2.$refs.wrapper;
149
+ _context.next = 5;
150
+ return (0, _dom.computePosition)(wrapperEl, popoverEl, {
151
+ placement: _this2.placement,
152
+ middleware: [(0, _dom.offset)(8), (0, _dom.shift)({
153
+ padding: 4,
154
+ crossAxis: false,
155
+ limiter: (0, _dom.limitShift)()
156
+ }), (0, _dom.flip)(), (0, _dom.hide)(), (0, _dom.arrow)({
157
+ element: _this2.$refs.arrow,
158
+ padding: 6
159
+ })]
160
+ });
161
+
162
+ case 5:
163
+ _yield$computePositio = _context.sent;
164
+ x = _yield$computePositio.x;
165
+ y = _yield$computePositio.y;
166
+ realPlacement = _yield$computePositio.placement;
167
+ middlewareData = _yield$computePositio.middlewareData;
168
+ popupTop = y; // 当被包裹元素超出屏幕时,对坐标进行特殊处理,先处理顶部超出,不然再处理底部超出
169
+
170
+ if (y < 0) {
171
+ popupTop = 0;
172
+ } else if (y > 0 && y + popoverEl.offsetHeight > document.body.clientHeight) {
173
+ popupTop = document.body.clientHeight - popoverEl.offsetHeight;
174
+ }
175
+
176
+ _this2.$refs.popover.$el.setAttribute('data-popper-placement', realPlacement); // 这里手动指定popup placement位置,避免滚动时出现popup弹窗位置闪烁
177
+
178
+
179
+ _this2.popper.setOptions({
180
+ placement: realPlacement
181
+ });
182
+
183
+ _this2.$nextTick(function () {
184
+ var _middlewareData$arrow;
185
+
186
+ (0, _extends2.default)(_this2.$refs.popover.$el.style, {
187
+ left: x + "px",
188
+ top: popupTop + "px"
189
+ });
190
+
191
+ var _ref = (_middlewareData$arrow = middlewareData.arrow) != null ? _middlewareData$arrow : {},
192
+ arrowX = _ref.x,
193
+ arrowY = _ref.y;
194
+
195
+ (0, _extends2.default)(_this2.$refs.arrow.style, {
196
+ left: arrowX != null ? arrowX + "px" : '',
197
+ top: arrowY != null ? arrowY + "px" : '',
198
+ margin: 0
199
+ });
200
+ });
201
+
202
+ case 15:
203
+ case "end":
204
+ return _context.stop();
205
+ }
206
+ }
207
+ }, _callee);
208
+ }))();
209
+ },
96
210
  updateLocation: function updateLocation() {
97
- var _this = this;
211
+ var _this3 = this;
98
212
 
99
213
  this.$nextTick(function () {
100
- if (!_this.value) {
214
+ if (!_this3.value) {
101
215
  return;
102
216
  }
103
217
 
104
- if (!_this.popper) {
105
- _this.popper = _this.createPopper();
106
- } else {
107
- _this.popper.setOptions({
108
- placement: _this.placement
218
+ if (!_this3.popper) {
219
+ _this3.popper = _this3.createPopper();
220
+ } else if (!_this3.autoAdjustOverflow) {
221
+ // 通过floating-ui调整popup位置时,这里需要规避,使用floating-ui来控制popup placement
222
+ _this3.popper.setOptions({
223
+ placement: _this3.placement
109
224
  });
110
225
  }
111
226
  });
112
227
  },
113
228
  renderAction: function renderAction(action, index) {
114
- var _this2 = this;
229
+ var _this4 = this;
115
230
 
116
231
  var h = this.$createElement;
117
232
  var icon = action.icon,
@@ -128,7 +243,7 @@ var _default2 = createComponent({
128
243
  }), className],
129
244
  "on": {
130
245
  "click": function click() {
131
- return _this2.onClickAction(action, index);
246
+ return _this4.onClickAction(action, index);
132
247
  }
133
248
  }
134
249
  }, [icon && h(_icon.default, {
@@ -191,7 +306,7 @@ var _default2 = createComponent({
191
306
  "on": {
192
307
  "click": this.onClickWrapper
193
308
  }
194
- }, [h(_popup.default, {
309
+ }, [h(_popup.default, (0, _babelHelperVueJsxMergeProps.default)([{
195
310
  "ref": "popover",
196
311
  "attrs": {
197
312
  "value": this.value,
@@ -201,7 +316,7 @@ var _default2 = createComponent({
201
316
  "lockScroll": false,
202
317
  "getContainer": this.getContainer
203
318
  },
204
- "class": bem([this.theme]),
319
+ "class": [bem([this.theme]), this.customClass],
205
320
  "on": {
206
321
  "open": this.onOpen,
207
322
  "close": this.onClose,
@@ -212,7 +327,10 @@ var _default2 = createComponent({
212
327
  "nativeOn": {
213
328
  "touchstart": this.onTouchstart
214
329
  }
215
- }, [h("div", {
330
+ }, {
331
+ "attrs": this.$attrs
332
+ }]), [h("div", {
333
+ "ref": "arrow",
216
334
  "class": bem('arrow')
217
335
  }), h("div", {
218
336
  "class": bem('content'),