zartui 2.0.79 → 2.0.80-beta.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.
- package/es/action-sheet/index.js +15 -26
- package/es/area/index.js +5 -41
- package/es/avatar/index.js +3 -16
- package/es/back-top/index.js +4 -19
- package/es/badge/index.js +4 -12
- package/es/button/index.js +20 -40
- package/es/calendar/components/Header.js +3 -12
- package/es/calendar/components/Month.js +12 -65
- package/es/calendar/index.js +23 -94
- package/es/calendar/types.js +0 -6
- package/es/calendar/utils.js +5 -16
- package/es/cascader/index.js +4 -37
- package/es/cell/index.js +19 -37
- package/es/cell-group/index.js +5 -8
- package/es/checkbox/index.js +4 -11
- package/es/checkbox-group/index.js +4 -9
- package/es/col/index.js +6 -11
- package/es/collapse/index.js +2 -5
- package/es/collapse-item/index.js +19 -35
- package/es/count-down/index.js +2 -15
- package/es/count-down/utils.js +3 -10
- package/es/datetime-picker/DatePicker.js +12 -70
- package/es/datetime-picker/TimePicker.js +10 -23
- package/es/datetime-picker/index.js +2 -4
- package/es/datetime-picker/shared.js +5 -19
- package/es/datetime-picker/utils.js +0 -5
- package/es/dialog/Dialog.js +6 -21
- package/es/dialog/index.js +0 -16
- package/es/divider/index.js +5 -6
- package/es/dropdown-item/index.js +22 -35
- package/es/dropdown-menu/index.js +4 -9
- package/es/empty/index.js +3 -11
- package/es/field/index.js +20 -83
- package/es/fold-dialog/index.js +5 -20
- package/es/form/index.js +2 -18
- package/es/grid/index.js +2 -6
- package/es/grid-item/index.js +17 -30
- package/es/hierarchy-select/breadcrumb.js +2 -6
- package/es/hierarchy-select/index.js +3 -12
- package/es/hierarchy-select/markList.js +2 -25
- package/es/hierarchy-select/svg/SubIcon.js +0 -1
- package/es/icon/index.js +9 -13
- package/es/image/index.js +2 -17
- package/es/image-preview/ImagePreview.js +4 -8
- package/es/image-preview/ImagePreviewItem.js +14 -30
- package/es/image-preview/index.js +0 -12
- package/es/image-preview/shared.js +2 -4
- package/es/index-anchor/index.js +2 -6
- package/es/index-bar/IndexIndicate.js +0 -1
- package/es/index-bar/index.js +7 -28
- package/es/index.js +1 -4
- package/es/info/index.js +6 -8
- package/es/list/index.js +11 -27
- package/es/loading/index.js +7 -15
- package/es/locale/index.js +0 -2
- package/es/media-picker/index.js +33 -117
- package/es/media-picker/media-util.js +2 -5
- package/es/media-picker/type.js +0 -5
- package/es/media-player/index.js +7 -17
- package/es/mixins/bind-event.js +0 -3
- package/es/mixins/checkbox.js +5 -11
- package/es/mixins/click-outside.js +0 -2
- package/es/mixins/close-on-popstate.js +0 -1
- package/es/mixins/field.js +0 -2
- package/es/mixins/popup/index.js +12 -28
- package/es/mixins/popup/overlay.js +1 -11
- package/es/mixins/portal.js +2 -8
- package/es/mixins/relation.js +0 -8
- package/es/mixins/slots.js +1 -4
- package/es/mixins/touch.js +4 -9
- package/es/multiple-picker/MultiplePickerOptions.js +2 -18
- package/es/multiple-picker/index.js +5 -17
- package/es/nav-bar/index.js +4 -12
- package/es/notice-bar/index.js +10 -28
- package/es/number-keyboard/Key.js +2 -10
- package/es/number-keyboard/index.js +4 -19
- package/es/overlay/index.js +5 -8
- package/es/password-input/index.js +10 -16
- package/es/picker/PickerColumn.js +20 -54
- package/es/picker/index.js +13 -42
- package/es/popover/index.js +11 -20
- package/es/popup/index.js +5 -21
- package/es/pull-refresh/index.js +15 -32
- package/es/radio/index.js +2 -4
- package/es/radio-group/index.js +2 -4
- package/es/rate/index.js +12 -26
- package/es/row/index.js +3 -9
- package/es/search/index.js +8 -13
- package/es/signature/bezier.js +5 -12
- package/es/signature/force-landscape.js +0 -5
- package/es/signature/index.js +5 -24
- package/es/signature/point.js +1 -6
- package/es/signature/throttle.js +1 -10
- package/es/skeleton/index.js +5 -15
- package/es/slider/index.js +19 -55
- package/es/step/index.js +5 -12
- package/es/stepper/index.js +10 -37
- package/es/steps/index.js +2 -4
- package/es/sticky/index.js +8 -50
- package/es/swipe/index.js +19 -62
- package/es/swipe-cell/index.js +7 -23
- package/es/swipe-item/index.js +9 -19
- package/es/switch/index.js +8 -10
- package/es/switch/shared.js +1 -0
- package/es/switch-cell/index.js +7 -7
- package/es/tab/index.js +4 -15
- package/es/tabbar/index.js +4 -14
- package/es/tabbar-item/index.js +7 -15
- package/es/table/index.js +10 -35
- package/es/tabs/Content.js +5 -9
- package/es/tabs/Title.js +11 -19
- package/es/tabs/index.js +16 -51
- package/es/tabs/utils.js +0 -8
- package/es/tag/index.js +13 -17
- package/es/timeline/index.js +2 -25
- package/es/toast/Toast.js +11 -23
- package/es/toast/index.js +6 -33
- package/es/toast/lock-click.js +0 -2
- package/es/uploader/index.js +11 -62
- package/es/uploader/utils.js +0 -10
- package/es/utils/constant.js +2 -1
- package/es/utils/create/bem.js +1 -5
- package/es/utils/create/component.js +4 -7
- package/es/utils/create/i18n.js +0 -2
- package/es/utils/deep-assign.js +0 -4
- package/es/utils/deep-clone.js +0 -3
- package/es/utils/dom/event.js +2 -5
- package/es/utils/dom/node.js +0 -1
- package/es/utils/dom/raf.js +7 -6
- package/es/utils/dom/reset-scroll.js +2 -1
- package/es/utils/dom/scroll.js +8 -17
- package/es/utils/dom/style.js +3 -2
- package/es/utils/easings.js +2 -4
- package/es/utils/format/date-util.js +54 -122
- package/es/utils/format/number.js +2 -11
- package/es/utils/format/string.js +0 -3
- package/es/utils/format/unit.js +2 -12
- package/es/utils/functional.js +6 -9
- package/es/utils/getScroll.js +0 -5
- package/es/utils/index.js +3 -5
- package/es/utils/interceptor.js +2 -4
- package/es/utils/media/image-util.js +7 -19
- package/es/utils/raf.js +4 -12
- package/es/utils/router.js +7 -6
- package/es/utils/scrollTo.js +7 -12
- package/es/utils/validate/number.js +2 -2
- package/es/utils/vnodes.js +2 -8
- package/lib/action-sheet/index.js +11 -35
- package/lib/area/index.js +5 -45
- package/lib/avatar/index.js +3 -18
- package/lib/back-top/index.js +4 -25
- package/lib/badge/index.js +4 -15
- package/lib/button/index.js +19 -50
- package/lib/calendar/components/Header.js +3 -18
- package/lib/calendar/components/Month.js +12 -71
- package/lib/calendar/index.js +21 -106
- package/lib/calendar/types.js +0 -7
- package/lib/calendar/utils.js +5 -32
- package/lib/cascader/index.js +4 -46
- package/lib/cell/index.js +18 -48
- package/lib/cell-group/index.js +5 -15
- package/lib/checkbox/index.js +4 -14
- package/lib/checkbox-group/index.js +4 -13
- package/lib/col/index.js +6 -14
- package/lib/collapse/index.js +2 -8
- package/lib/collapse-item/index.js +18 -43
- package/lib/count-down/index.js +2 -19
- package/lib/count-down/utils.js +3 -15
- package/lib/datetime-picker/DatePicker.js +12 -81
- package/lib/datetime-picker/TimePicker.js +10 -30
- package/lib/datetime-picker/index.js +2 -10
- package/lib/datetime-picker/shared.js +5 -27
- package/lib/datetime-picker/utils.js +0 -9
- package/lib/dialog/Dialog.js +6 -28
- package/lib/dialog/index.js +0 -22
- package/lib/divider/index.js +5 -12
- package/lib/dropdown-item/index.js +21 -44
- package/lib/dropdown-menu/index.js +4 -15
- package/lib/empty/index.js +3 -23
- package/lib/field/index.js +20 -96
- package/lib/fold-dialog/index.js +5 -22
- package/lib/form/index.js +2 -21
- package/lib/grid/index.js +2 -10
- package/lib/grid-item/index.js +16 -37
- package/lib/hierarchy-select/breadcrumb.js +3 -10
- package/lib/hierarchy-select/index.js +4 -20
- package/lib/hierarchy-select/markList.js +3 -31
- package/lib/hierarchy-select/svg/SubIcon.js +0 -1
- package/lib/icon/index.js +8 -19
- package/lib/image/index.js +2 -22
- package/lib/image-preview/ImagePreview.js +0 -16
- package/lib/image-preview/ImagePreviewItem.js +13 -36
- package/lib/image-preview/index.js +0 -16
- package/lib/image-preview/shared.js +2 -5
- package/lib/index-anchor/index.js +2 -11
- package/lib/index-bar/IndexIndicate.js +0 -1
- package/lib/index-bar/index.js +7 -37
- package/lib/index.js +1 -157
- package/lib/info/index.js +6 -14
- package/lib/lazyload/index.js +0 -3
- package/lib/list/index.js +10 -33
- package/lib/loading/index.js +7 -21
- package/lib/locale/index.js +0 -7
- package/lib/media-picker/index.js +27 -153
- package/lib/media-picker/media-util.js +2 -15
- package/lib/media-picker/type.js +0 -5
- package/lib/media-player/index.js +6 -22
- package/lib/mixins/bind-event.js +1 -6
- package/lib/mixins/checkbox.js +6 -18
- package/lib/mixins/click-outside.js +1 -5
- package/lib/mixins/close-on-popstate.js +0 -4
- package/lib/mixins/field.js +0 -2
- package/lib/mixins/popup/index.js +11 -36
- package/lib/mixins/popup/overlay.js +1 -23
- package/lib/mixins/portal.js +2 -9
- package/lib/mixins/relation.js +0 -11
- package/lib/mixins/slots.js +1 -5
- package/lib/mixins/touch.js +4 -11
- package/lib/multiple-picker/MultiplePickerOptions.js +2 -23
- package/lib/multiple-picker/index.js +5 -26
- package/lib/nav-bar/index.js +4 -16
- package/lib/notice-bar/index.js +10 -40
- package/lib/number-keyboard/Key.js +2 -17
- package/lib/number-keyboard/index.js +4 -26
- package/lib/overlay/index.js +5 -16
- package/lib/password-input/index.js +10 -23
- package/lib/picker/PickerColumn.js +19 -63
- package/lib/picker/index.js +13 -53
- package/lib/popover/index.js +9 -27
- package/lib/popup/index.js +5 -27
- package/lib/pull-refresh/index.js +14 -38
- package/lib/radio/index.js +2 -7
- package/lib/radio-group/index.js +2 -8
- package/lib/rate/index.js +11 -31
- package/lib/row/index.js +3 -12
- package/lib/search/index.js +7 -21
- package/lib/signature/bezier.js +5 -15
- package/lib/signature/force-landscape.js +0 -11
- package/lib/signature/index.js +6 -31
- package/lib/signature/point.js +0 -8
- package/lib/signature/throttle.js +1 -11
- package/lib/skeleton/index.js +5 -21
- package/lib/slider/index.js +19 -63
- package/lib/step/index.js +5 -18
- package/lib/stepper/index.js +10 -46
- package/lib/steps/index.js +2 -7
- package/lib/sticky/index.js +8 -59
- package/lib/swipe/index.js +19 -70
- package/lib/swipe-cell/index.js +7 -29
- package/lib/swipe-item/index.js +9 -24
- package/lib/switch/index.js +7 -14
- package/lib/switch/shared.js +1 -1
- package/lib/switch-cell/index.js +6 -16
- package/lib/tab/index.js +4 -21
- package/lib/tabbar/index.js +4 -19
- package/lib/tabbar-item/index.js +5 -21
- package/lib/table/index.js +10 -38
- package/lib/tabs/Content.js +5 -15
- package/lib/tabs/Title.js +11 -23
- package/lib/tabs/index.js +15 -65
- package/lib/tabs/utils.js +0 -13
- package/lib/tag/index.js +12 -23
- package/lib/timeline/index.js +2 -32
- package/lib/toast/Toast.js +10 -30
- package/lib/toast/index.js +6 -38
- package/lib/toast/lock-click.js +0 -3
- package/lib/uploader/index.js +10 -72
- package/lib/uploader/utils.js +0 -17
- package/lib/utils/constant.js +2 -1
- package/lib/utils/create/bem.js +1 -6
- package/lib/utils/create/component.js +5 -14
- package/lib/utils/create/i18n.js +0 -8
- package/lib/utils/create/index.js +0 -4
- package/lib/utils/deep-assign.js +0 -6
- package/lib/utils/deep-clone.js +0 -5
- package/lib/utils/device.js +0 -2
- package/lib/utils/dom/event.js +2 -10
- package/lib/utils/dom/node.js +0 -2
- package/lib/utils/dom/raf.js +7 -11
- package/lib/utils/dom/reset-scroll.js +2 -4
- package/lib/utils/dom/scroll.js +8 -28
- package/lib/utils/dom/style.js +3 -3
- package/lib/utils/easings.js +2 -5
- package/lib/utils/format/date-util.js +54 -168
- package/lib/utils/format/number.js +2 -13
- package/lib/utils/format/string.js +0 -5
- package/lib/utils/format/unit.js +2 -16
- package/lib/utils/functional.js +6 -14
- package/lib/utils/getScroll.js +0 -7
- package/lib/utils/index.js +3 -19
- package/lib/utils/interceptor.js +2 -6
- package/lib/utils/media/image-util.js +7 -25
- package/lib/utils/raf.js +4 -13
- package/lib/utils/router.js +7 -9
- package/lib/utils/scrollTo.js +9 -21
- package/lib/utils/validate/date.js +0 -2
- package/lib/utils/validate/email.js +0 -1
- package/lib/utils/validate/mobile.js +0 -1
- package/lib/utils/validate/number.js +2 -4
- package/lib/utils/validate/system.js +0 -3
- package/lib/utils/vnodes.js +2 -9
- package/lib/zart.js +57 -18
- package/lib/zart.min.js +1 -1
- package/package.json +17 -18
package/es/media-player/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { createNamespace } from '../utils';
|
|
2
|
-
import { MediaType } from "../media-picker/type";
|
|
3
|
-
|
|
2
|
+
import { MediaType } from "../media-picker/type";
|
|
3
|
+
// import Toast from '../toast';
|
|
4
4
|
import Popup from '../popup';
|
|
5
5
|
import Button from '../button';
|
|
6
6
|
import { isIOS, isWeixin } from "../utils/device";
|
|
7
|
-
|
|
8
7
|
var _createNamespace = createNamespace('media-player'),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
createComponent = _createNamespace[0],
|
|
9
|
+
bem = _createNamespace[1];
|
|
12
10
|
export default createComponent({
|
|
13
11
|
props: {
|
|
14
12
|
value: {
|
|
@@ -38,7 +36,6 @@ export default createComponent({
|
|
|
38
36
|
methods: {
|
|
39
37
|
getMediaElement: function getMediaElement() {
|
|
40
38
|
var player;
|
|
41
|
-
|
|
42
39
|
if (this.mediaType === MediaType.AUDIO) {
|
|
43
40
|
// player = document.getElementById("audio")
|
|
44
41
|
player = this.$refs.audio;
|
|
@@ -46,25 +43,22 @@ export default createComponent({
|
|
|
46
43
|
// player = document.getElementById("video")
|
|
47
44
|
player = this.$refs.video;
|
|
48
45
|
}
|
|
49
|
-
|
|
50
46
|
return player;
|
|
51
47
|
},
|
|
52
48
|
onOpen: function onOpen() {
|
|
53
49
|
var _this = this;
|
|
54
|
-
|
|
55
50
|
this.$nextTick(function () {
|
|
56
51
|
var player = _this.getMediaElement();
|
|
57
|
-
|
|
58
52
|
if (!player) {
|
|
59
53
|
return;
|
|
60
|
-
}
|
|
54
|
+
}
|
|
55
|
+
// player.addEventListener('error', (event) => {
|
|
61
56
|
// console.log(event)
|
|
62
57
|
// Toast.fail('播放失败')
|
|
63
58
|
// this.onClose()
|
|
64
59
|
// }, true)
|
|
65
|
-
//iOS中无法自动播放,必须有点击事件触发。但是微信中有办法实现
|
|
66
|
-
|
|
67
60
|
|
|
61
|
+
//iOS中无法自动播放,必须有点击事件触发。但是微信中有办法实现
|
|
68
62
|
if (isWeixin()) {
|
|
69
63
|
if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
|
|
70
64
|
WeixinJSBridge.invoke('getNetworkType', {}, function (res) {
|
|
@@ -79,21 +73,17 @@ export default createComponent({
|
|
|
79
73
|
onClose: function onClose() {
|
|
80
74
|
this.$emit('input', false);
|
|
81
75
|
var player = this.getMediaElement();
|
|
82
|
-
|
|
83
76
|
if (!player) {
|
|
84
77
|
return;
|
|
85
78
|
}
|
|
86
|
-
|
|
87
79
|
player.pause();
|
|
88
80
|
player.currentTime = 0;
|
|
89
|
-
|
|
90
81
|
if (this.mediaUrl && !this.mediaUrl.startsWith('http')) {
|
|
91
82
|
(URL || webkitURL).revokeObjectURL(this.mediaUrl);
|
|
92
83
|
}
|
|
93
84
|
},
|
|
94
85
|
renderTag: function renderTag() {
|
|
95
86
|
var h = this.$createElement;
|
|
96
|
-
|
|
97
87
|
if (this.mediaUrl) {
|
|
98
88
|
if (this.mediaType === MediaType.VIDEO) {
|
|
99
89
|
return h("video", {
|
package/es/mixins/bind-event.js
CHANGED
|
@@ -5,21 +5,18 @@ import { on, off } from '../utils/dom/event';
|
|
|
5
5
|
var uid = 0;
|
|
6
6
|
export function BindEventMixin(handler) {
|
|
7
7
|
var key = "binded_" + uid++;
|
|
8
|
-
|
|
9
8
|
function bind() {
|
|
10
9
|
if (!this[key]) {
|
|
11
10
|
handler.call(this, on, true);
|
|
12
11
|
this[key] = true;
|
|
13
12
|
}
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
function unbind() {
|
|
17
15
|
if (this[key]) {
|
|
18
16
|
handler.call(this, off, false);
|
|
19
17
|
this[key] = false;
|
|
20
18
|
}
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
return {
|
|
24
21
|
mounted: bind,
|
|
25
22
|
activated: bind,
|
package/es/mixins/checkbox.js
CHANGED
|
@@ -7,8 +7,8 @@ import { ChildrenMixin } from './relation';
|
|
|
7
7
|
import { addUnit } from '../utils';
|
|
8
8
|
export var CheckboxMixin = function CheckboxMixin(_ref) {
|
|
9
9
|
var parent = _ref.parent,
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
bem = _ref.bem,
|
|
11
|
+
role = _ref.role;
|
|
12
12
|
return {
|
|
13
13
|
mixins: [ChildrenMixin(parent), FieldMixin],
|
|
14
14
|
props: {
|
|
@@ -46,7 +46,6 @@ export var CheckboxMixin = function CheckboxMixin(_ref) {
|
|
|
46
46
|
var boxShadow = this.boxShadow || this.parent && this.parent.boxShadow;
|
|
47
47
|
var border = this.border || this.parent && this.parent.border;
|
|
48
48
|
var iconColor = this.iconColor || this.parent && this.parent.iconColor;
|
|
49
|
-
|
|
50
49
|
if ((boxShadow || checkedColor) && this.checked && !this.isDisabled) {
|
|
51
50
|
return {
|
|
52
51
|
color: iconColor,
|
|
@@ -60,22 +59,20 @@ export var CheckboxMixin = function CheckboxMixin(_ref) {
|
|
|
60
59
|
if (this.isDisabled || role === 'radio' && !this.checked) {
|
|
61
60
|
return -1;
|
|
62
61
|
}
|
|
63
|
-
|
|
64
62
|
return 0;
|
|
65
63
|
}
|
|
66
64
|
},
|
|
67
65
|
methods: {
|
|
68
66
|
onClick: function onClick(event) {
|
|
69
67
|
var _this = this;
|
|
70
|
-
|
|
71
68
|
var target = event.target;
|
|
72
69
|
var icon = this.$refs.icon;
|
|
73
70
|
var iconClicked = icon === target || icon.contains(target);
|
|
74
|
-
|
|
75
71
|
if (!this.isDisabled && (iconClicked || !this.labelDisabled)) {
|
|
76
|
-
this.toggle();
|
|
77
|
-
// so we can get the changed value in the click event listener
|
|
72
|
+
this.toggle();
|
|
78
73
|
|
|
74
|
+
// wait for toggle method to complete
|
|
75
|
+
// so we can get the changed value in the click event listener
|
|
79
76
|
setTimeout(function () {
|
|
80
77
|
_this.$emit('click', event);
|
|
81
78
|
});
|
|
@@ -112,7 +109,6 @@ export var CheckboxMixin = function CheckboxMixin(_ref) {
|
|
|
112
109
|
genLabel: function genLabel() {
|
|
113
110
|
var h = this.$createElement;
|
|
114
111
|
var slot = this.slots();
|
|
115
|
-
|
|
116
112
|
if (slot) {
|
|
117
113
|
return h("span", {
|
|
118
114
|
"class": bem('label', [this.labelPosition, {
|
|
@@ -125,13 +121,11 @@ export var CheckboxMixin = function CheckboxMixin(_ref) {
|
|
|
125
121
|
render: function render() {
|
|
126
122
|
var h = arguments[0];
|
|
127
123
|
var Children = [this.genIcon()];
|
|
128
|
-
|
|
129
124
|
if (this.labelPosition === 'left') {
|
|
130
125
|
Children.unshift(this.genLabel());
|
|
131
126
|
} else {
|
|
132
127
|
Children.push(this.genLabel());
|
|
133
128
|
}
|
|
134
|
-
|
|
135
129
|
var checked = this.checked;
|
|
136
130
|
return h("div", {
|
|
137
131
|
"attrs": {
|
|
@@ -12,13 +12,11 @@ export var ClickOutsideMixin = function ClickOutsideMixin(config) {
|
|
|
12
12
|
},
|
|
13
13
|
data: function data() {
|
|
14
14
|
var _this = this;
|
|
15
|
-
|
|
16
15
|
var clickOutsideHandler = function clickOutsideHandler(event) {
|
|
17
16
|
if (_this.closeOnClickOutside && !_this.$el.contains(event.target)) {
|
|
18
17
|
_this[config.method]();
|
|
19
18
|
}
|
|
20
19
|
};
|
|
21
|
-
|
|
22
20
|
return {
|
|
23
21
|
clickOutsideHandler: clickOutsideHandler
|
|
24
22
|
};
|
package/es/mixins/field.js
CHANGED
|
@@ -7,7 +7,6 @@ export var FieldMixin = {
|
|
|
7
7
|
watch: {
|
|
8
8
|
value: function value() {
|
|
9
9
|
var field = this.ztField;
|
|
10
|
-
|
|
11
10
|
if (field) {
|
|
12
11
|
field.resetValidation();
|
|
13
12
|
field.validateWithTrigger('onChange');
|
|
@@ -16,7 +15,6 @@ export var FieldMixin = {
|
|
|
16
15
|
},
|
|
17
16
|
created: function created() {
|
|
18
17
|
var field = this.ztField;
|
|
19
|
-
|
|
20
18
|
if (field && !field.children) {
|
|
21
19
|
field.children = this;
|
|
22
20
|
}
|
package/es/mixins/popup/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// Context
|
|
2
2
|
import { context } from './context';
|
|
3
|
-
import { openOverlay, closeOverlay, updateOverlay, removeOverlay } from './overlay';
|
|
3
|
+
import { openOverlay, closeOverlay, updateOverlay, removeOverlay } from './overlay';
|
|
4
4
|
|
|
5
|
+
// Utils
|
|
5
6
|
import { on, off, preventDefault } from '../../utils/dom/event';
|
|
6
7
|
import { removeNode } from '../../utils/dom/node';
|
|
7
|
-
import { getScroller } from '../../utils/dom/scroll';
|
|
8
|
+
import { getScroller } from '../../utils/dom/scroll';
|
|
8
9
|
|
|
10
|
+
// Mixins
|
|
9
11
|
import { TouchMixin } from '../touch';
|
|
10
12
|
import { PortalMixin } from '../portal';
|
|
11
13
|
import { CloseOnPopstateMixin } from '../close-on-popstate';
|
|
@@ -39,7 +41,6 @@ export function PopupMixin(options) {
|
|
|
39
41
|
if (options === void 0) {
|
|
40
42
|
options = {};
|
|
41
43
|
}
|
|
42
|
-
|
|
43
44
|
return {
|
|
44
45
|
mixins: [TouchMixin, CloseOnPopstateMixin, PortalMixin({
|
|
45
46
|
afterPortal: function afterPortal() {
|
|
@@ -70,7 +71,6 @@ export function PopupMixin(options) {
|
|
|
70
71
|
var type = val ? 'open' : 'close';
|
|
71
72
|
this.inited = this.inited || this.value;
|
|
72
73
|
this[type]();
|
|
73
|
-
|
|
74
74
|
if (!options.skipToggleEvent) {
|
|
75
75
|
this.$emit(type);
|
|
76
76
|
}
|
|
@@ -82,9 +82,7 @@ export function PopupMixin(options) {
|
|
|
82
82
|
this.open();
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
|
-
|
|
86
|
-
/* istanbul ignore next */
|
|
87
|
-
activated: function activated() {
|
|
85
|
+
/* istanbul ignore next */activated: function activated() {
|
|
88
86
|
if (this.shouldReopen) {
|
|
89
87
|
this.$emit('input', true);
|
|
90
88
|
this.shouldReopen = false;
|
|
@@ -92,18 +90,14 @@ export function PopupMixin(options) {
|
|
|
92
90
|
},
|
|
93
91
|
beforeDestroy: function beforeDestroy() {
|
|
94
92
|
removeOverlay(this);
|
|
95
|
-
|
|
96
93
|
if (this.opened) {
|
|
97
94
|
this.removeLock();
|
|
98
95
|
}
|
|
99
|
-
|
|
100
96
|
if (this.getContainer) {
|
|
101
97
|
removeNode(this.$el);
|
|
102
98
|
}
|
|
103
99
|
},
|
|
104
|
-
|
|
105
|
-
/* istanbul ignore next */
|
|
106
|
-
deactivated: function deactivated() {
|
|
100
|
+
/* istanbul ignore next */deactivated: function deactivated() {
|
|
107
101
|
if (this.value) {
|
|
108
102
|
this.close();
|
|
109
103
|
this.shouldReopen = true;
|
|
@@ -114,13 +108,12 @@ export function PopupMixin(options) {
|
|
|
114
108
|
/* istanbul ignore next */
|
|
115
109
|
if (this.$isServer || this.opened) {
|
|
116
110
|
return;
|
|
117
|
-
}
|
|
118
|
-
|
|
111
|
+
}
|
|
119
112
|
|
|
113
|
+
// cover default zIndex
|
|
120
114
|
if (this.zIndex !== undefined) {
|
|
121
115
|
context.zIndex = this.zIndex;
|
|
122
116
|
}
|
|
123
|
-
|
|
124
117
|
this.opened = true;
|
|
125
118
|
this.renderOverlay();
|
|
126
119
|
this.addLock();
|
|
@@ -132,11 +125,9 @@ export function PopupMixin(options) {
|
|
|
132
125
|
if (this.lockScroll) {
|
|
133
126
|
on(document, 'touchstart', this.touchStart);
|
|
134
127
|
on(document, 'touchmove', this.onTouchMove);
|
|
135
|
-
|
|
136
128
|
if (!context.lockCount) {
|
|
137
129
|
document.body.classList.add('zt2-overflow-hidden');
|
|
138
130
|
}
|
|
139
|
-
|
|
140
131
|
context.lockCount++;
|
|
141
132
|
}
|
|
142
133
|
},
|
|
@@ -145,7 +136,6 @@ export function PopupMixin(options) {
|
|
|
145
136
|
context.lockCount--;
|
|
146
137
|
off(document, 'touchstart', this.touchStart);
|
|
147
138
|
off(document, 'touchmove', this.onTouchMove);
|
|
148
|
-
|
|
149
139
|
if (!context.lockCount) {
|
|
150
140
|
document.body.classList.remove('zt2-overflow-hidden');
|
|
151
141
|
}
|
|
@@ -155,7 +145,6 @@ export function PopupMixin(options) {
|
|
|
155
145
|
if (!this.opened) {
|
|
156
146
|
return;
|
|
157
147
|
}
|
|
158
|
-
|
|
159
148
|
closeOverlay(this);
|
|
160
149
|
this.opened = false;
|
|
161
150
|
this.removeLock();
|
|
@@ -166,33 +155,29 @@ export function PopupMixin(options) {
|
|
|
166
155
|
var direction = this.deltaY > 0 ? '10' : '01';
|
|
167
156
|
var el = getScroller(event.target, this.$el);
|
|
168
157
|
var scrollHeight = el.scrollHeight,
|
|
169
|
-
|
|
170
|
-
|
|
158
|
+
offsetHeight = el.offsetHeight,
|
|
159
|
+
scrollTop = el.scrollTop;
|
|
171
160
|
var status = '11';
|
|
172
|
-
/* istanbul ignore next */
|
|
173
161
|
|
|
162
|
+
/* istanbul ignore next */
|
|
174
163
|
if (scrollTop === 0) {
|
|
175
164
|
status = offsetHeight >= scrollHeight ? '00' : '01';
|
|
176
165
|
} else if (scrollTop + offsetHeight >= scrollHeight) {
|
|
177
166
|
status = '10';
|
|
178
167
|
}
|
|
179
|
-
/* istanbul ignore next */
|
|
180
|
-
|
|
181
168
|
|
|
169
|
+
/* istanbul ignore next */
|
|
182
170
|
if (status !== '11' && this.direction === 'vertical' && !(parseInt(status, 2) & parseInt(direction, 2))) {
|
|
183
171
|
preventDefault(event, true);
|
|
184
172
|
}
|
|
185
173
|
},
|
|
186
174
|
renderOverlay: function renderOverlay() {
|
|
187
175
|
var _this = this;
|
|
188
|
-
|
|
189
176
|
if (this.$isServer || !this.value) {
|
|
190
177
|
return;
|
|
191
178
|
}
|
|
192
|
-
|
|
193
179
|
this.$nextTick(function () {
|
|
194
180
|
_this.updateZIndex(_this.overlay ? 1 : 0);
|
|
195
|
-
|
|
196
181
|
if (_this.overlay) {
|
|
197
182
|
openOverlay(_this, {
|
|
198
183
|
zIndex: context.zIndex++,
|
|
@@ -209,7 +194,6 @@ export function PopupMixin(options) {
|
|
|
209
194
|
if (value === void 0) {
|
|
210
195
|
value = 0;
|
|
211
196
|
}
|
|
212
|
-
|
|
213
197
|
this.$el.style.zIndex = ++context.zIndex + value;
|
|
214
198
|
},
|
|
215
199
|
onReopen: function onReopen(callback) {
|
|
@@ -7,14 +7,12 @@ var defaultConfig = {
|
|
|
7
7
|
className: '',
|
|
8
8
|
customStyle: {}
|
|
9
9
|
};
|
|
10
|
-
|
|
11
10
|
function mountOverlay(vm) {
|
|
12
11
|
return mount(Overlay, {
|
|
13
12
|
on: {
|
|
14
13
|
// close popup when overlay clicked & closeOnClickOverlay is true
|
|
15
14
|
click: function click() {
|
|
16
15
|
vm.$emit('click-overlay');
|
|
17
|
-
|
|
18
16
|
if (vm.closeOnClickOverlay) {
|
|
19
17
|
if (vm.onClickOverlay) {
|
|
20
18
|
vm.onClickOverlay();
|
|
@@ -26,19 +24,15 @@ function mountOverlay(vm) {
|
|
|
26
24
|
}
|
|
27
25
|
});
|
|
28
26
|
}
|
|
29
|
-
|
|
30
27
|
export function updateOverlay(vm) {
|
|
31
28
|
var item = context.find(vm);
|
|
32
|
-
|
|
33
29
|
if (item) {
|
|
34
30
|
var el = vm.$el;
|
|
35
31
|
var config = item.config,
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
overlay = item.overlay;
|
|
38
33
|
if (el && el.parentNode) {
|
|
39
34
|
el.parentNode.insertBefore(overlay.$el, el);
|
|
40
35
|
}
|
|
41
|
-
|
|
42
36
|
_extends(overlay, defaultConfig, config, {
|
|
43
37
|
show: true
|
|
44
38
|
});
|
|
@@ -46,7 +40,6 @@ export function updateOverlay(vm) {
|
|
|
46
40
|
}
|
|
47
41
|
export function openOverlay(vm, config) {
|
|
48
42
|
var item = context.find(vm);
|
|
49
|
-
|
|
50
43
|
if (item) {
|
|
51
44
|
item.config = config;
|
|
52
45
|
} else {
|
|
@@ -57,19 +50,16 @@ export function openOverlay(vm, config) {
|
|
|
57
50
|
overlay: overlay
|
|
58
51
|
});
|
|
59
52
|
}
|
|
60
|
-
|
|
61
53
|
updateOverlay(vm);
|
|
62
54
|
}
|
|
63
55
|
export function closeOverlay(vm) {
|
|
64
56
|
var item = context.find(vm);
|
|
65
|
-
|
|
66
57
|
if (item) {
|
|
67
58
|
item.overlay.show = false;
|
|
68
59
|
}
|
|
69
60
|
}
|
|
70
61
|
export function removeOverlay(vm) {
|
|
71
62
|
var item = context.find(vm);
|
|
72
|
-
|
|
73
63
|
if (item) {
|
|
74
64
|
removeNode(item.overlay.$el);
|
|
75
65
|
context.remove(vm);
|
package/es/mixins/portal.js
CHANGED
|
@@ -2,15 +2,12 @@ function getElement(selector) {
|
|
|
2
2
|
if (typeof selector === 'string') {
|
|
3
3
|
return document.querySelector(selector);
|
|
4
4
|
}
|
|
5
|
-
|
|
6
5
|
return selector();
|
|
7
6
|
}
|
|
8
|
-
|
|
9
7
|
export function PortalMixin(_temp) {
|
|
10
8
|
var _ref = _temp === void 0 ? {} : _temp,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
ref = _ref.ref,
|
|
10
|
+
afterPortal = _ref.afterPortal;
|
|
14
11
|
return {
|
|
15
12
|
props: {
|
|
16
13
|
getContainer: [String, Function]
|
|
@@ -28,17 +25,14 @@ export function PortalMixin(_temp) {
|
|
|
28
25
|
var getContainer = this.getContainer;
|
|
29
26
|
var el = ref ? this.$refs[ref] : this.$el;
|
|
30
27
|
var container;
|
|
31
|
-
|
|
32
28
|
if (getContainer) {
|
|
33
29
|
container = getElement(getContainer);
|
|
34
30
|
} else if (this.$parent) {
|
|
35
31
|
container = this.$parent.$el;
|
|
36
32
|
}
|
|
37
|
-
|
|
38
33
|
if (container && container !== el.parentNode) {
|
|
39
34
|
container.appendChild(el);
|
|
40
35
|
}
|
|
41
|
-
|
|
42
36
|
if (afterPortal) {
|
|
43
37
|
afterPortal.call(this);
|
|
44
38
|
}
|
package/es/mixins/relation.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { sortChildren } from '../utils/vnodes';
|
|
2
2
|
export function ChildrenMixin(_parent, options) {
|
|
3
3
|
var _inject, _computed;
|
|
4
|
-
|
|
5
4
|
if (options === void 0) {
|
|
6
5
|
options = {};
|
|
7
6
|
}
|
|
8
|
-
|
|
9
7
|
var indexKey = options.indexKey || 'index';
|
|
10
8
|
return {
|
|
11
9
|
inject: (_inject = {}, _inject[_parent] = {
|
|
@@ -16,16 +14,13 @@ export function ChildrenMixin(_parent, options) {
|
|
|
16
14
|
if (this.disableBindRelation) {
|
|
17
15
|
return null;
|
|
18
16
|
}
|
|
19
|
-
|
|
20
17
|
return this[_parent];
|
|
21
18
|
}
|
|
22
19
|
}, _computed[indexKey] = function () {
|
|
23
20
|
this.bindRelation();
|
|
24
|
-
|
|
25
21
|
if (this.parent) {
|
|
26
22
|
return this.parent.children.indexOf(this);
|
|
27
23
|
}
|
|
28
|
-
|
|
29
24
|
return null;
|
|
30
25
|
}, _computed),
|
|
31
26
|
watch: {
|
|
@@ -40,7 +35,6 @@ export function ChildrenMixin(_parent, options) {
|
|
|
40
35
|
},
|
|
41
36
|
beforeDestroy: function beforeDestroy() {
|
|
42
37
|
var _this = this;
|
|
43
|
-
|
|
44
38
|
if (this.parent) {
|
|
45
39
|
this.parent.children = this.parent.children.filter(function (item) {
|
|
46
40
|
return item !== _this;
|
|
@@ -52,7 +46,6 @@ export function ChildrenMixin(_parent, options) {
|
|
|
52
46
|
if (!this.parent || this.parent.children.indexOf(this) !== -1) {
|
|
53
47
|
return;
|
|
54
48
|
}
|
|
55
|
-
|
|
56
49
|
var children = [].concat(this.parent.children, [this]);
|
|
57
50
|
sortChildren(children, this.parent);
|
|
58
51
|
this.parent.children = children;
|
|
@@ -64,7 +57,6 @@ export function ParentMixin(parent) {
|
|
|
64
57
|
return {
|
|
65
58
|
provide: function provide() {
|
|
66
59
|
var _ref;
|
|
67
|
-
|
|
68
60
|
return _ref = {}, _ref[parent] = this, _ref;
|
|
69
61
|
},
|
|
70
62
|
data: function data() {
|
package/es/mixins/slots.js
CHANGED
|
@@ -8,15 +8,12 @@ export var SlotsMixin = {
|
|
|
8
8
|
if (name === void 0) {
|
|
9
9
|
name = 'default';
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
var $slots = this.$slots,
|
|
13
|
-
|
|
12
|
+
$scopedSlots = this.$scopedSlots;
|
|
14
13
|
var scopedSlot = $scopedSlots[name];
|
|
15
|
-
|
|
16
14
|
if (scopedSlot) {
|
|
17
15
|
return scopedSlot(props);
|
|
18
16
|
}
|
|
19
|
-
|
|
20
17
|
return $slots[name];
|
|
21
18
|
}
|
|
22
19
|
}
|
package/es/mixins/touch.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { on } from '../utils/dom/event';
|
|
2
2
|
var MIN_DISTANCE = 10;
|
|
3
|
-
|
|
4
3
|
function getDirection(x, y) {
|
|
5
4
|
if (x > y && x > MIN_DISTANCE) {
|
|
6
5
|
return 'horizontal';
|
|
7
6
|
}
|
|
8
|
-
|
|
9
7
|
if (y > x && y > MIN_DISTANCE) {
|
|
10
8
|
return 'vertical';
|
|
11
9
|
}
|
|
12
|
-
|
|
13
10
|
return '';
|
|
14
11
|
}
|
|
15
|
-
|
|
16
12
|
export var TouchMixin = {
|
|
17
13
|
data: function data() {
|
|
18
14
|
return {
|
|
@@ -26,8 +22,8 @@ export var TouchMixin = {
|
|
|
26
22
|
this.startY = event.touches[0].clientY;
|
|
27
23
|
},
|
|
28
24
|
touchMove: function touchMove(event) {
|
|
29
|
-
var touch = event.touches[0];
|
|
30
|
-
|
|
25
|
+
var touch = event.touches[0];
|
|
26
|
+
// Fix: Safari back will set clientX to negative number
|
|
31
27
|
this.deltaX = touch.clientX < 0 ? 0 : touch.clientX - this.startX;
|
|
32
28
|
this.deltaY = touch.clientY - this.startY;
|
|
33
29
|
this.offsetX = Math.abs(this.deltaX);
|
|
@@ -45,11 +41,10 @@ export var TouchMixin = {
|
|
|
45
41
|
// https://github.com/youzan/vant/issues/3015
|
|
46
42
|
bindTouchEvent: function bindTouchEvent(el) {
|
|
47
43
|
var onTouchStart = this.onTouchStart,
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
onTouchMove = this.onTouchMove,
|
|
45
|
+
onTouchEnd = this.onTouchEnd;
|
|
50
46
|
on(el, 'touchstart', onTouchStart);
|
|
51
47
|
on(el, 'touchmove', onTouchMove);
|
|
52
|
-
|
|
53
48
|
if (onTouchEnd) {
|
|
54
49
|
on(el, 'touchend', onTouchEnd);
|
|
55
50
|
on(el, 'touchcancel', onTouchEnd);
|
|
@@ -2,15 +2,12 @@ import _mergeJSXProps2 from "@vue/babel-helper-vue-jsx-merge-props";
|
|
|
2
2
|
import _mergeJSXProps from "@vue/babel-helper-vue-jsx-merge-props";
|
|
3
3
|
import { deepClone } from '../utils/deep-clone';
|
|
4
4
|
import { createNamespace, isObject } from '../utils';
|
|
5
|
-
|
|
6
5
|
var _createNamespace = createNamespace('multiple-picker-options'),
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
createComponent = _createNamespace[0],
|
|
7
|
+
bem = _createNamespace[1];
|
|
10
8
|
function isOptionDisabled(option) {
|
|
11
9
|
return isObject(option) && option.disabled;
|
|
12
10
|
}
|
|
13
|
-
|
|
14
11
|
export default createComponent({
|
|
15
12
|
props: {
|
|
16
13
|
valueKey: String,
|
|
@@ -66,29 +63,23 @@ export default createComponent({
|
|
|
66
63
|
if (this.confirmed) {
|
|
67
64
|
return;
|
|
68
65
|
}
|
|
69
|
-
|
|
70
66
|
this.currentIndexs = deepClone(this.defaultIndexs);
|
|
71
67
|
},
|
|
72
68
|
onClickItem: function onClickItem(index) {
|
|
73
69
|
var _this = this;
|
|
74
|
-
|
|
75
70
|
if (this.readonly) {
|
|
76
71
|
return;
|
|
77
72
|
}
|
|
78
|
-
|
|
79
73
|
var exist = false;
|
|
80
74
|
this.currentIndexs.forEach(function (v, i) {
|
|
81
75
|
if (v === index) {
|
|
82
76
|
exist = true;
|
|
83
|
-
|
|
84
77
|
_this.currentIndexs.splice(i, 1);
|
|
85
78
|
}
|
|
86
79
|
});
|
|
87
|
-
|
|
88
80
|
if (!exist) {
|
|
89
81
|
this.currentIndexs.push(index);
|
|
90
82
|
}
|
|
91
|
-
|
|
92
83
|
var currentOptions = [];
|
|
93
84
|
this.currentIndexs.forEach(function (index) {
|
|
94
85
|
currentOptions.push(_this.options[index]);
|
|
@@ -99,32 +90,25 @@ export default createComponent({
|
|
|
99
90
|
if (isObject(option) && this.valueKey in option) {
|
|
100
91
|
return option[this.valueKey];
|
|
101
92
|
}
|
|
102
|
-
|
|
103
93
|
return option;
|
|
104
94
|
},
|
|
105
95
|
genOptions: function genOptions() {
|
|
106
96
|
var _this2 = this;
|
|
107
|
-
|
|
108
97
|
var h = this.$createElement;
|
|
109
98
|
this.columnCounts = Number(this.columnCounts);
|
|
110
|
-
|
|
111
99
|
if (this.columnCounts && this.columnCounts > 3) {
|
|
112
100
|
this.columnCounts = 3;
|
|
113
101
|
}
|
|
114
|
-
|
|
115
102
|
if (this.columnCounts && this.columnCounts < 1) {
|
|
116
103
|
this.columnCounts = 1;
|
|
117
104
|
}
|
|
118
|
-
|
|
119
105
|
var optionStyle = {
|
|
120
106
|
height: this.itemHeight + 8 + "px",
|
|
121
107
|
width: 1 / this.columnCounts * 100 + "%"
|
|
122
108
|
};
|
|
123
109
|
return this.options.map(function (option, index) {
|
|
124
110
|
var _domProps;
|
|
125
|
-
|
|
126
111
|
var text = _this2.getOptionText(option);
|
|
127
|
-
|
|
128
112
|
var disabled = isOptionDisabled(option);
|
|
129
113
|
var data = {
|
|
130
114
|
style: optionStyle,
|