zartui 2.0.88 → 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.
- package/es/index.js +1 -1
- package/es/popover/index.js +127 -13
- package/lib/index.js +1 -1
- package/lib/popover/index.js +131 -13
- package/lib/zart.js +14232 -10600
- package/lib/zart.min.js +1 -1
- package/package.json +2 -1
package/es/index.js
CHANGED
|
@@ -75,7 +75,7 @@ import TextEllipsis from './text-ellipsis';
|
|
|
75
75
|
import Timeline from './timeline';
|
|
76
76
|
import Toast from './toast';
|
|
77
77
|
import Uploader from './uploader';
|
|
78
|
-
var version = '2.0.
|
|
78
|
+
var version = '2.0.89';
|
|
79
79
|
|
|
80
80
|
function install(Vue) {
|
|
81
81
|
var components = [ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, TextEllipsis, Timeline, Toast, Uploader];
|
package/es/popover/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import _mergeJSXProps from "@vue/babel-helper-vue-jsx-merge-props";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
5
|
import { createPopper as _createPopper, offsetModifier } from '@vant/popperjs';
|
|
3
6
|
import { createNamespace } from '../utils';
|
|
4
7
|
import { BORDER_BOTTOM } from '../utils/constant'; // Mixins
|
|
@@ -7,6 +10,7 @@ import { ClickOutsideMixin } from '../mixins/click-outside'; // Components
|
|
|
7
10
|
|
|
8
11
|
import Icon from '../icon';
|
|
9
12
|
import Popup from '../popup';
|
|
13
|
+
import { arrow, autoUpdate, computePosition, flip, hide, limitShift, offset, shift } from '@floating-ui/dom';
|
|
10
14
|
|
|
11
15
|
var _createNamespace = createNamespace('popover'),
|
|
12
16
|
createComponent = _createNamespace[0],
|
|
@@ -48,10 +52,31 @@ export default createComponent({
|
|
|
48
52
|
closeOnClickAction: {
|
|
49
53
|
type: Boolean,
|
|
50
54
|
default: true
|
|
55
|
+
},
|
|
56
|
+
customClass: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: ''
|
|
59
|
+
},
|
|
60
|
+
autoAdjustOverflow: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: false
|
|
51
63
|
}
|
|
52
64
|
},
|
|
53
65
|
watch: {
|
|
54
|
-
value:
|
|
66
|
+
value: {
|
|
67
|
+
handler: function handler(val) {
|
|
68
|
+
var _this = this;
|
|
69
|
+
|
|
70
|
+
if (val) {
|
|
71
|
+
this.$nextTick(function () {
|
|
72
|
+
_this.autoUpdatePopup();
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
this.updateLocation();
|
|
77
|
+
},
|
|
78
|
+
immediate: true
|
|
79
|
+
},
|
|
55
80
|
placement: 'updateLocation'
|
|
56
81
|
},
|
|
57
82
|
mounted: function mounted() {
|
|
@@ -80,25 +105,111 @@ export default createComponent({
|
|
|
80
105
|
})]
|
|
81
106
|
});
|
|
82
107
|
},
|
|
108
|
+
autoUpdatePopup: function autoUpdatePopup() {
|
|
109
|
+
if (this.$refs.wrapper && this.$refs.popover && this.autoAdjustOverflow) {
|
|
110
|
+
autoUpdate(this.$refs.wrapper, this.$refs.popover.$el, this.updatePopup, {
|
|
111
|
+
elementResize: typeof ResizeObserver !== 'undefined'
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
updatePopup: function updatePopup() {
|
|
116
|
+
var _this2 = this;
|
|
117
|
+
|
|
118
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
119
|
+
var popoverEl, wrapperEl, _yield$computePositio, x, y, realPlacement, middlewareData, popupTop;
|
|
120
|
+
|
|
121
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
122
|
+
while (1) {
|
|
123
|
+
switch (_context.prev = _context.next) {
|
|
124
|
+
case 0:
|
|
125
|
+
if (!(_this2.$refs.wrapper && _this2.$refs.popover.$el && _this2.$refs.arrow)) {
|
|
126
|
+
_context.next = 15;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
popoverEl = _this2.$refs.popover.$el;
|
|
131
|
+
wrapperEl = _this2.$refs.wrapper;
|
|
132
|
+
_context.next = 5;
|
|
133
|
+
return computePosition(wrapperEl, popoverEl, {
|
|
134
|
+
placement: _this2.placement,
|
|
135
|
+
middleware: [offset(8), shift({
|
|
136
|
+
padding: 4,
|
|
137
|
+
crossAxis: false,
|
|
138
|
+
limiter: limitShift()
|
|
139
|
+
}), flip(), hide(), arrow({
|
|
140
|
+
element: _this2.$refs.arrow,
|
|
141
|
+
padding: 6
|
|
142
|
+
})]
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
case 5:
|
|
146
|
+
_yield$computePositio = _context.sent;
|
|
147
|
+
x = _yield$computePositio.x;
|
|
148
|
+
y = _yield$computePositio.y;
|
|
149
|
+
realPlacement = _yield$computePositio.placement;
|
|
150
|
+
middlewareData = _yield$computePositio.middlewareData;
|
|
151
|
+
popupTop = y; // 当被包裹元素超出屏幕时,对坐标进行特殊处理,先处理顶部超出,不然再处理底部超出
|
|
152
|
+
|
|
153
|
+
if (y < 0) {
|
|
154
|
+
popupTop = 0;
|
|
155
|
+
} else if (y > 0 && y + popoverEl.offsetHeight > document.body.clientHeight) {
|
|
156
|
+
popupTop = document.body.clientHeight - popoverEl.offsetHeight;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
_this2.$refs.popover.$el.setAttribute('data-popper-placement', realPlacement); // 这里手动指定popup placement位置,避免滚动时出现popup弹窗位置闪烁
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
_this2.popper.setOptions({
|
|
163
|
+
placement: realPlacement
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
_this2.$nextTick(function () {
|
|
167
|
+
var _middlewareData$arrow;
|
|
168
|
+
|
|
169
|
+
_extends(_this2.$refs.popover.$el.style, {
|
|
170
|
+
left: x + "px",
|
|
171
|
+
top: popupTop + "px"
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
var _ref = (_middlewareData$arrow = middlewareData.arrow) != null ? _middlewareData$arrow : {},
|
|
175
|
+
arrowX = _ref.x,
|
|
176
|
+
arrowY = _ref.y;
|
|
177
|
+
|
|
178
|
+
_extends(_this2.$refs.arrow.style, {
|
|
179
|
+
left: arrowX != null ? arrowX + "px" : '',
|
|
180
|
+
top: arrowY != null ? arrowY + "px" : '',
|
|
181
|
+
margin: 0
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
case 15:
|
|
186
|
+
case "end":
|
|
187
|
+
return _context.stop();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}, _callee);
|
|
191
|
+
}))();
|
|
192
|
+
},
|
|
83
193
|
updateLocation: function updateLocation() {
|
|
84
|
-
var
|
|
194
|
+
var _this3 = this;
|
|
85
195
|
|
|
86
196
|
this.$nextTick(function () {
|
|
87
|
-
if (!
|
|
197
|
+
if (!_this3.value) {
|
|
88
198
|
return;
|
|
89
199
|
}
|
|
90
200
|
|
|
91
|
-
if (!
|
|
92
|
-
|
|
93
|
-
} else {
|
|
94
|
-
|
|
95
|
-
|
|
201
|
+
if (!_this3.popper) {
|
|
202
|
+
_this3.popper = _this3.createPopper();
|
|
203
|
+
} else if (!_this3.autoAdjustOverflow) {
|
|
204
|
+
// 通过floating-ui调整popup位置时,这里需要规避,使用floating-ui来控制popup placement
|
|
205
|
+
_this3.popper.setOptions({
|
|
206
|
+
placement: _this3.placement
|
|
96
207
|
});
|
|
97
208
|
}
|
|
98
209
|
});
|
|
99
210
|
},
|
|
100
211
|
renderAction: function renderAction(action, index) {
|
|
101
|
-
var
|
|
212
|
+
var _this4 = this;
|
|
102
213
|
|
|
103
214
|
var h = this.$createElement;
|
|
104
215
|
var icon = action.icon,
|
|
@@ -115,7 +226,7 @@ export default createComponent({
|
|
|
115
226
|
}), className],
|
|
116
227
|
"on": {
|
|
117
228
|
"click": function click() {
|
|
118
|
-
return
|
|
229
|
+
return _this4.onClickAction(action, index);
|
|
119
230
|
}
|
|
120
231
|
}
|
|
121
232
|
}, [icon && h(Icon, {
|
|
@@ -178,7 +289,7 @@ export default createComponent({
|
|
|
178
289
|
"on": {
|
|
179
290
|
"click": this.onClickWrapper
|
|
180
291
|
}
|
|
181
|
-
}, [h(Popup, {
|
|
292
|
+
}, [h(Popup, _mergeJSXProps([{
|
|
182
293
|
"ref": "popover",
|
|
183
294
|
"attrs": {
|
|
184
295
|
"value": this.value,
|
|
@@ -188,7 +299,7 @@ export default createComponent({
|
|
|
188
299
|
"lockScroll": false,
|
|
189
300
|
"getContainer": this.getContainer
|
|
190
301
|
},
|
|
191
|
-
"class": bem([this.theme]),
|
|
302
|
+
"class": [bem([this.theme]), this.customClass],
|
|
192
303
|
"on": {
|
|
193
304
|
"open": this.onOpen,
|
|
194
305
|
"close": this.onClose,
|
|
@@ -199,7 +310,10 @@ export default createComponent({
|
|
|
199
310
|
"nativeOn": {
|
|
200
311
|
"touchstart": this.onTouchstart
|
|
201
312
|
}
|
|
202
|
-
},
|
|
313
|
+
}, {
|
|
314
|
+
"attrs": this.$attrs
|
|
315
|
+
}]), [h("div", {
|
|
316
|
+
"ref": "arrow",
|
|
203
317
|
"class": bem('arrow')
|
|
204
318
|
}), h("div", {
|
|
205
319
|
"class": bem('content'),
|
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.
|
|
316
|
+
var version = '2.0.89';
|
|
317
317
|
exports.version = version;
|
|
318
318
|
|
|
319
319
|
function install(Vue) {
|
package/lib/popover/index.js
CHANGED
|
@@ -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:
|
|
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
|
|
211
|
+
var _this3 = this;
|
|
98
212
|
|
|
99
213
|
this.$nextTick(function () {
|
|
100
|
-
if (!
|
|
214
|
+
if (!_this3.value) {
|
|
101
215
|
return;
|
|
102
216
|
}
|
|
103
217
|
|
|
104
|
-
if (!
|
|
105
|
-
|
|
106
|
-
} else {
|
|
107
|
-
|
|
108
|
-
|
|
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
|
|
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
|
|
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
|
-
},
|
|
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'),
|