zartui 2.1.6 → 2.1.8
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 +9 -15
- 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 -26
- package/es/datetime-picker/shared.js +5 -21
- 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 +13 -39
- package/es/dropdown-menu/index.js +4 -9
- package/es/empty/images/Developing.js +0 -3
- package/es/empty/images/EmptyInterface.js +0 -3
- package/es/empty/images/EmptyResult.js +0 -3
- package/es/empty/images/FindNull.js +0 -3
- package/es/empty/images/NetworkError.js +0 -3
- package/es/empty/images/NotFound.js +0 -3
- package/es/empty/images/ReportSuccess.js +0 -3
- package/es/empty/images/Restricted.js +0 -3
- package/es/empty/images/ServerError.js +0 -3
- package/es/empty/index.js +3 -11
- package/es/field/index.js +21 -86
- 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 +18 -30
- package/es/hierarchy-select/breadcrumb.js +2 -6
- package/es/hierarchy-select/index.js +4 -14
- package/es/hierarchy-select/markList.js +5 -30
- package/es/hierarchy-select/svg/SubIcon.js +0 -1
- package/es/icon/index.js +9 -13
- package/es/image/index.js +3 -19
- 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 +35 -128
- package/es/media-picker/media-util.js +2 -5
- package/es/media-picker/type.js +9 -14
- package/es/media-picker/wx-util.js +0 -1
- package/es/media-player/index.js +7 -19
- 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 +3 -20
- 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 +21 -56
- package/es/picker/index.js +12 -45
- package/es/popover/index.js +65 -90
- package/es/popup/index.js +5 -21
- package/es/pull-refresh/index.js +10 -29
- 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 +9 -15
- package/es/signature/bezier.js +13 -20
- 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 +11 -39
- 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 +10 -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 +5 -28
- package/es/table/type.js +3 -4
- package/es/tabs/Content.js +5 -9
- package/es/tabs/Title.js +11 -20
- package/es/tabs/index.js +16 -51
- package/es/tabs/utils.js +0 -8
- package/es/tag/index.js +13 -17
- package/es/text-ellipsis/index.js +25 -42
- 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 -8
- 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 +10 -15
- package/es/utils/validate/number.js +2 -2
- package/es/utils/vnodes.js +2 -8
- package/lib/action-sheet/index.js +12 -37
- package/lib/area/index.js +7 -48
- package/lib/avatar/index.js +5 -21
- package/lib/back-top/index.js +6 -28
- package/lib/badge/index.js +6 -18
- package/lib/button/index.js +20 -52
- package/lib/calendar/FastForwardImg.js +2 -3
- package/lib/calendar/SlowForwardImg.js +2 -3
- package/lib/calendar/components/Header.js +5 -21
- package/lib/calendar/components/Month.js +14 -74
- package/lib/calendar/index.js +23 -109
- package/lib/calendar/types.js +11 -22
- package/lib/calendar/utils.js +18 -46
- package/lib/cascader/index.js +6 -49
- package/lib/cell/index.js +19 -50
- package/lib/cell/shared.js +2 -3
- package/lib/cell-group/index.js +6 -17
- package/lib/checkbox/index.js +6 -17
- package/lib/checkbox-group/index.js +6 -16
- package/lib/col/index.js +8 -17
- package/lib/collapse/index.js +4 -11
- package/lib/collapse-item/index.js +20 -46
- package/lib/count-down/index.js +4 -22
- package/lib/count-down/utils.js +5 -17
- package/lib/datetime-picker/DatePicker.js +14 -84
- package/lib/datetime-picker/TimePicker.js +12 -33
- package/lib/datetime-picker/index.js +7 -41
- package/lib/datetime-picker/shared.js +9 -35
- package/lib/datetime-picker/utils.js +2 -11
- package/lib/dialog/Dialog.js +8 -31
- package/lib/dialog/index.js +1 -24
- package/lib/divider/index.js +6 -14
- package/lib/dropdown-item/index.js +14 -52
- package/lib/dropdown-menu/index.js +6 -18
- package/lib/empty/context.js +2 -3
- package/lib/empty/images/Developing.js +2 -9
- package/lib/empty/images/EmptyInterface.js +2 -9
- package/lib/empty/images/EmptyResult.js +2 -9
- package/lib/empty/images/FindNull.js +2 -9
- package/lib/empty/images/NetworkError.js +2 -9
- package/lib/empty/images/NotFound.js +2 -9
- package/lib/empty/images/ReportSuccess.js +2 -9
- package/lib/empty/images/Restricted.js +2 -9
- package/lib/empty/images/ServerError.js +2 -9
- package/lib/empty/index.js +5 -26
- package/lib/field/ClearIcon.js +2 -3
- package/lib/field/SearchIcon.js +2 -3
- package/lib/field/index.js +22 -99
- package/lib/fold-dialog/index.js +7 -25
- package/lib/form/index.js +4 -24
- package/lib/grid/index.js +4 -13
- package/lib/grid-item/index.js +19 -40
- package/lib/hierarchy-select/breadcrumb.js +5 -13
- package/lib/hierarchy-select/index.js +7 -25
- package/lib/hierarchy-select/markList.js +8 -39
- package/lib/hierarchy-select/svg/SubIcon.js +2 -4
- package/lib/icon/index.js +9 -21
- package/lib/image/index.js +4 -25
- package/lib/image-preview/ImagePreview.js +2 -19
- package/lib/image-preview/ImagePreviewItem.js +15 -39
- package/lib/image-preview/index.js +1 -18
- package/lib/image-preview/shared.js +3 -8
- package/lib/index-anchor/index.js +4 -14
- package/lib/index-bar/IndexIndicate.js +2 -4
- package/lib/index-bar/index.js +9 -40
- package/lib/index.js +5 -164
- package/lib/info/index.js +7 -16
- package/lib/lazyload/index.js +1 -5
- package/lib/list/index.js +12 -36
- package/lib/loading/index.js +8 -23
- package/lib/locale/index.js +2 -10
- package/lib/locale/lang/de-DE-formal.js +2 -3
- package/lib/locale/lang/de-DE.js +2 -3
- package/lib/locale/lang/en-US.js +2 -3
- package/lib/locale/lang/es-ES.js +2 -3
- package/lib/locale/lang/fr-FR.js +2 -3
- package/lib/locale/lang/ja-JP.js +2 -3
- package/lib/locale/lang/nb-NO.js +2 -3
- package/lib/locale/lang/ro-RO.js +2 -3
- package/lib/locale/lang/th-TH.js +2 -3
- package/lib/locale/lang/tr-TR.js +2 -3
- package/lib/locale/lang/zh-CN.js +2 -3
- package/lib/locale/lang/zh-HK.js +2 -3
- package/lib/locale/lang/zh-TW.js +2 -3
- package/lib/media-picker/image/DefaultAudioIcon.js +2 -3
- package/lib/media-picker/image/DefaultDocIcon.js +2 -3
- package/lib/media-picker/image/DefaultExcelIcon.js +2 -3
- package/lib/media-picker/image/DefaultFileIcon.js +2 -3
- package/lib/media-picker/image/DefaultPdfIcon.js +2 -3
- package/lib/media-picker/image/DefaultPptIcon.js +2 -3
- package/lib/media-picker/image/DefaultTextIcon.js +2 -3
- package/lib/media-picker/image/DefaultVideoIcon.js +2 -3
- package/lib/media-picker/image/DeleteIcon.js +2 -3
- package/lib/media-picker/image/Img64.js +4 -7
- package/lib/media-picker/image/PickFileIcon.js +2 -3
- package/lib/media-picker/image/PickPhotoIcon.js +2 -3
- package/lib/media-picker/image/ReUpload.js +2 -3
- package/lib/media-picker/image/TakeAudioIcon.js +2 -3
- package/lib/media-picker/image/TakePhotoIcon.js +2 -3
- package/lib/media-picker/image/TakeVideoIcon.js +2 -3
- package/lib/media-picker/index.js +33 -172
- package/lib/media-picker/media-util.js +9 -22
- package/lib/media-picker/type.js +10 -18
- package/lib/media-picker/wx-util.js +4 -15
- package/lib/media-player/index.js +8 -27
- package/lib/mixins/bind-event.js +1 -6
- package/lib/mixins/checkbox.js +8 -21
- package/lib/mixins/click-outside.js +3 -8
- package/lib/mixins/close-on-popstate.js +2 -7
- package/lib/mixins/field.js +2 -5
- package/lib/mixins/popup/context.js +2 -3
- package/lib/mixins/popup/index.js +12 -38
- package/lib/mixins/popup/overlay.js +3 -25
- package/lib/mixins/portal.js +2 -9
- package/lib/mixins/relation.js +0 -11
- package/lib/mixins/slots.js +3 -8
- package/lib/mixins/touch.js +6 -14
- package/lib/multiple-picker/MultiplePickerOptions.js +4 -26
- package/lib/multiple-picker/index.js +7 -29
- package/lib/multiple-picker/shared.js +3 -5
- package/lib/nav-bar/index.js +6 -19
- package/lib/notice-bar/CloseIcon.js +2 -3
- package/lib/notice-bar/MenuIcon.js +2 -3
- package/lib/notice-bar/NoticeIcon.js +2 -3
- package/lib/notice-bar/OpenIcon.js +2 -3
- package/lib/notice-bar/TipIcon.js +2 -3
- package/lib/notice-bar/WarningIcon.js +2 -3
- package/lib/notice-bar/index.js +12 -43
- package/lib/number-keyboard/CollapseIcon.js +2 -3
- package/lib/number-keyboard/DeleteIcon.js +2 -3
- package/lib/number-keyboard/Key.js +4 -20
- package/lib/number-keyboard/index.js +6 -29
- package/lib/overlay/index.js +6 -18
- package/lib/password-input/index.js +11 -25
- package/lib/picker/PickerColumn.js +24 -71
- package/lib/picker/index.js +14 -59
- package/lib/picker/shared.js +3 -5
- package/lib/popover/index.js +65 -104
- package/lib/popup/index.js +7 -30
- package/lib/pull-refresh/index.js +11 -38
- package/lib/radio/index.js +4 -10
- package/lib/radio-group/index.js +4 -11
- package/lib/rate/index.js +13 -34
- package/lib/row/index.js +5 -15
- package/lib/search/index.js +8 -23
- package/lib/signature/bezier.js +14 -25
- package/lib/signature/force-landscape.js +5 -19
- package/lib/signature/index.js +8 -34
- package/lib/signature/point.js +2 -11
- package/lib/signature/throttle.js +1 -11
- package/lib/skeleton/index.js +6 -23
- package/lib/slider/index.js +21 -66
- package/lib/step/index.js +7 -21
- package/lib/stepper/index.js +12 -49
- package/lib/steps/index.js +4 -10
- package/lib/sticky/index.js +10 -62
- package/lib/swipe/index.js +21 -73
- package/lib/swipe-cell/index.js +9 -32
- package/lib/swipe-item/index.js +12 -27
- package/lib/switch/index.js +9 -17
- package/lib/switch/shared.js +3 -4
- package/lib/switch-cell/index.js +7 -18
- package/lib/tab/index.js +6 -24
- package/lib/tabbar/index.js +6 -22
- package/lib/tabbar-item/index.js +7 -24
- package/lib/table/index.js +7 -38
- package/lib/table/type.js +3 -5
- package/lib/tabs/Content.js +7 -18
- package/lib/tabs/Title.js +13 -27
- package/lib/tabs/index.js +17 -68
- package/lib/tabs/utils.js +0 -13
- package/lib/tag/index.js +13 -25
- package/lib/text-ellipsis/index.js +27 -49
- package/lib/timeline/index.js +4 -35
- package/lib/timeline/svg/current.js +2 -3
- package/lib/timeline/svg/pass.js +2 -3
- package/lib/toast/Toast.js +12 -33
- package/lib/toast/index.js +7 -40
- package/lib/toast/lock-click.js +0 -3
- package/lib/toast/svg/SuccessIcon.js +2 -3
- package/lib/toast/svg/WarnIcon.js +2 -3
- package/lib/uploader/index.js +12 -75
- package/lib/uploader/utils.js +4 -21
- package/lib/utils/constant.js +12 -21
- package/lib/utils/create/bem.js +1 -6
- package/lib/utils/create/component.js +6 -17
- 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 +1 -3
- package/lib/utils/dom/event.js +5 -14
- package/lib/utils/dom/node.js +0 -2
- package/lib/utils/dom/raf.js +9 -13
- package/lib/utils/dom/reset-scroll.js +2 -4
- package/lib/utils/dom/scroll.js +16 -37
- package/lib/utils/dom/style.js +3 -3
- package/lib/utils/easings.js +2 -5
- package/lib/utils/format/date-util.js +88 -203
- package/lib/utils/format/number.js +4 -15
- package/lib/utils/format/string.js +0 -5
- package/lib/utils/format/unit.js +2 -16
- package/lib/utils/functional.js +7 -15
- package/lib/utils/getScroll.js +1 -8
- package/lib/utils/index.js +10 -26
- package/lib/utils/interceptor.js +2 -6
- package/lib/utils/media/image-util.js +10 -28
- package/lib/utils/raf.js +4 -13
- package/lib/utils/router.js +10 -13
- package/lib/utils/scrollTo.js +12 -24
- 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 +3 -5
- package/lib/utils/validate/system.js +0 -3
- package/lib/utils/vnodes.js +2 -9
- package/lib/zart.js +2325 -4752
- package/lib/zart.min.js +7 -1
- package/package.json +1 -1
package/lib/sticky/index.js
CHANGED
|
@@ -1,39 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
exports.__esModule = true;
|
|
6
5
|
exports.default = void 0;
|
|
7
|
-
|
|
8
6
|
var _style = require("../utils/dom/style");
|
|
9
|
-
|
|
10
7
|
var _unit = require("../utils/format/unit");
|
|
11
|
-
|
|
12
8
|
var _utils = require("../utils");
|
|
13
|
-
|
|
14
9
|
var _scroll = require("../utils/dom/scroll");
|
|
15
|
-
|
|
16
10
|
var _bindEvent = require("../mixins/bind-event");
|
|
17
|
-
|
|
18
11
|
var _touch = require("../mixins/touch");
|
|
19
|
-
|
|
20
12
|
var _loading = _interopRequireDefault(require("../loading"));
|
|
21
|
-
|
|
22
13
|
var _createNamespace = (0, _utils.createNamespace)('sticky'),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var _default = createComponent({
|
|
14
|
+
createComponent = _createNamespace[0],
|
|
15
|
+
bem = _createNamespace[1];
|
|
16
|
+
var _default = exports.default = createComponent({
|
|
27
17
|
mixins: [(0, _bindEvent.BindEventMixin)(function (bind, isBind) {
|
|
28
18
|
if (!this.scroller) {
|
|
29
19
|
this.scroller = (0, _scroll.getScroller)(this.$el);
|
|
30
20
|
}
|
|
31
|
-
|
|
32
21
|
if (this.observer) {
|
|
33
22
|
var method = isBind ? 'observe' : 'unobserve';
|
|
34
23
|
this.observer[method](this.$el);
|
|
35
24
|
}
|
|
36
|
-
|
|
37
25
|
bind(this.scroller, 'scroll', this.onScroll, true);
|
|
38
26
|
this.onScroll();
|
|
39
27
|
}), _touch.TouchMixin],
|
|
@@ -105,21 +93,16 @@ var _default = createComponent({
|
|
|
105
93
|
if (!this.fixed) {
|
|
106
94
|
return;
|
|
107
95
|
}
|
|
108
|
-
|
|
109
96
|
var style = {};
|
|
110
|
-
|
|
111
97
|
if ((0, _utils.isDef)(this.zIndex)) {
|
|
112
98
|
style.zIndex = this.zIndex;
|
|
113
99
|
}
|
|
114
|
-
|
|
115
100
|
if (this.offsetTopPx && this.fixed) {
|
|
116
101
|
style.top = this.offsetTopPx + "px";
|
|
117
102
|
}
|
|
118
|
-
|
|
119
103
|
if (this.transform) {
|
|
120
104
|
style.transform = "translate3d(0, " + this.transform + "px, 0)";
|
|
121
105
|
}
|
|
122
|
-
|
|
123
106
|
return style;
|
|
124
107
|
}
|
|
125
108
|
},
|
|
@@ -130,7 +113,6 @@ var _default = createComponent({
|
|
|
130
113
|
},
|
|
131
114
|
created: function created() {
|
|
132
115
|
var _this2 = this;
|
|
133
|
-
|
|
134
116
|
// compatibility: https://caniuse.com/#feat=intersectionobserver
|
|
135
117
|
if (!_utils.isServer && window.IntersectionObserver) {
|
|
136
118
|
this.observer = new IntersectionObserver(function (entries) {
|
|
@@ -149,31 +131,25 @@ var _default = createComponent({
|
|
|
149
131
|
methods: {
|
|
150
132
|
onScroll: function onScroll() {
|
|
151
133
|
var _this3 = this;
|
|
152
|
-
|
|
153
134
|
// if(!this.overScroll&&this.refresh){
|
|
154
135
|
// return
|
|
155
136
|
// }
|
|
156
137
|
var container = this.container,
|
|
157
|
-
|
|
158
|
-
|
|
138
|
+
offsetTopPx = this.offsetTopPx;
|
|
159
139
|
if ((0, _style.isHidden)(this.$el)) {
|
|
160
140
|
return;
|
|
161
141
|
}
|
|
162
|
-
|
|
163
142
|
setTimeout(function () {
|
|
164
143
|
if (_this3.refresh && _this3.refreshtopToPageTop === null) {
|
|
165
144
|
_this3.refreshtopToPageTop = (0, _scroll.getElementTop)(_this3.$el);
|
|
166
145
|
}
|
|
167
146
|
}, 500);
|
|
168
|
-
|
|
169
147
|
if (this.refresh && this.refreshOffsetTop === null) {
|
|
170
148
|
this.refreshOffsetTop = this.offsetTopPx;
|
|
171
149
|
}
|
|
172
|
-
|
|
173
150
|
this.height = this.$el.offsetHeight;
|
|
174
151
|
var scrollTop = (0, _scroll.getScrollTop)(window);
|
|
175
152
|
var topToPageTop = (0, _scroll.getElementTop)(this.$el);
|
|
176
|
-
|
|
177
153
|
var emitScrollEvent = function emitScrollEvent() {
|
|
178
154
|
_this3.$emit('scroll', {
|
|
179
155
|
scrollTop: scrollTop,
|
|
@@ -181,18 +157,14 @@ var _default = createComponent({
|
|
|
181
157
|
distance: overpx + scrollTop + offsetTopPx - topToPageTop
|
|
182
158
|
});
|
|
183
159
|
};
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
160
|
+
var overpx = this.refresh && this.lockfixed ? this.refreshDistance : 0;
|
|
161
|
+
// The sticky component should be kept inside the container element
|
|
187
162
|
var currentY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
188
163
|
this.pull = currentY < this.refreshtopToPageTop - this.offsetTopPx;
|
|
189
|
-
|
|
190
164
|
if (container) {
|
|
191
165
|
var bottomToPageTop = topToPageTop - overpx + container.offsetHeight;
|
|
192
|
-
|
|
193
166
|
if (scrollTop + offsetTopPx + this.height > bottomToPageTop) {
|
|
194
167
|
var distanceToBottom = this.height + scrollTop - bottomToPageTop;
|
|
195
|
-
|
|
196
168
|
if (distanceToBottom < this.height) {
|
|
197
169
|
this.fixed = true;
|
|
198
170
|
this.transform = -(distanceToBottom + offsetTopPx);
|
|
@@ -201,12 +173,10 @@ var _default = createComponent({
|
|
|
201
173
|
this.fixed = false;
|
|
202
174
|
this.lockfixed = false;
|
|
203
175
|
}
|
|
204
|
-
|
|
205
176
|
emitScrollEvent();
|
|
206
177
|
return;
|
|
207
178
|
}
|
|
208
179
|
}
|
|
209
|
-
|
|
210
180
|
if (scrollTop + offsetTopPx > topToPageTop - overpx) {
|
|
211
181
|
this.fixed = true;
|
|
212
182
|
this.lockfixed = true;
|
|
@@ -215,45 +185,33 @@ var _default = createComponent({
|
|
|
215
185
|
this.lockfixed = false;
|
|
216
186
|
this.fixed = false;
|
|
217
187
|
}
|
|
218
|
-
|
|
219
188
|
if (this.refresh && this.pc && !this.touchOn) {
|
|
220
189
|
this.t1 = (0, _scroll.getScrollTop)(window);
|
|
221
190
|
clearTimeout(this.timer);
|
|
222
|
-
|
|
223
191
|
var _this = this;
|
|
224
|
-
|
|
225
192
|
this.timer = setTimeout(function () {
|
|
226
193
|
_this.t2 = (0, _scroll.getScrollTop)(window);
|
|
227
|
-
|
|
228
194
|
if (!_this.autoScroll) {
|
|
229
195
|
return;
|
|
230
196
|
}
|
|
231
|
-
|
|
232
197
|
var currentY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
233
|
-
|
|
234
198
|
if (_this.refresh && !_this.fixed && (0, _scroll.getScrollTop)(window) > _this.refreshtopToPageTop * _this.updownPercent / 100) {
|
|
235
199
|
_this.scrollAnimation(currentY, _this.refreshtopToPageTop - _this.refreshOffsetTop, true);
|
|
236
|
-
|
|
237
200
|
_this.touchOn = false;
|
|
238
201
|
return;
|
|
239
202
|
} else if (_this.refresh && !_this.fixed && (0, _scroll.getScrollTop)(window) <= _this.refreshtopToPageTop * _this.updownPercent / 100) {
|
|
240
203
|
_this.scrollAnimation(currentY, 0, false);
|
|
241
|
-
|
|
242
204
|
_this.touchOn = false;
|
|
243
205
|
return;
|
|
244
206
|
} else if (_this.refresh && _this.fixed && currentY < _this.refreshtopToPageTop - _this.offsetTopPx) {
|
|
245
207
|
_this.$emit('refreshcallback');
|
|
246
|
-
|
|
247
208
|
_this.scrollAnimation(currentY, _this.refreshtopToPageTop - _this.refreshOffsetTop, true);
|
|
248
|
-
|
|
249
209
|
_this.touchOn = false;
|
|
250
210
|
return;
|
|
251
211
|
}
|
|
252
|
-
|
|
253
212
|
_this.touchOn = false;
|
|
254
213
|
}, _this.delayTime);
|
|
255
214
|
}
|
|
256
|
-
|
|
257
215
|
emitScrollEvent();
|
|
258
216
|
},
|
|
259
217
|
onTouchStart: function onTouchStart(event) {
|
|
@@ -262,7 +220,6 @@ var _default = createComponent({
|
|
|
262
220
|
},
|
|
263
221
|
onTouchMove: function onTouchMove(event) {
|
|
264
222
|
this.touchMove(event);
|
|
265
|
-
|
|
266
223
|
if (this.deltaY > 10) {
|
|
267
224
|
this.overScroll = true;
|
|
268
225
|
}
|
|
@@ -271,10 +228,8 @@ var _default = createComponent({
|
|
|
271
228
|
if (!this.autoScroll) {
|
|
272
229
|
return;
|
|
273
230
|
}
|
|
274
|
-
|
|
275
231
|
var that = this;
|
|
276
232
|
var currentY = document.documentElement.scrollTop || document.body.scrollTop;
|
|
277
|
-
|
|
278
233
|
if (this.refresh && !this.fixed && (0, _scroll.getScrollTop)(window) > this.refreshtopToPageTop * this.updownPercent / 100) {
|
|
279
234
|
this.scrollAnimation(currentY, this.refreshtopToPageTop - this.refreshOffsetTop, true);
|
|
280
235
|
this.touchOn = false;
|
|
@@ -289,23 +244,19 @@ var _default = createComponent({
|
|
|
289
244
|
this.touchOn = false;
|
|
290
245
|
return;
|
|
291
246
|
}
|
|
292
|
-
|
|
293
247
|
this.touchOn = false;
|
|
294
248
|
},
|
|
295
249
|
renderLoading: function renderLoading() {
|
|
296
250
|
var h = this.$createElement;
|
|
297
|
-
|
|
298
251
|
if (this.lockfixed && this.refresh && this.touchOn && this.pull && this.pulling) {
|
|
299
252
|
if (this.$slots.pull) {
|
|
300
253
|
return this.slots('pull');
|
|
301
254
|
}
|
|
302
|
-
|
|
303
255
|
return h(_loading.default);
|
|
304
256
|
}
|
|
305
257
|
},
|
|
306
258
|
scrollAnimation: function scrollAnimation(currentY, targetY, lockfixed) {
|
|
307
259
|
var _this4 = this;
|
|
308
|
-
|
|
309
260
|
// 获取当前位置方法
|
|
310
261
|
// 计算需要移动的距离
|
|
311
262
|
var needScrollTop = targetY - currentY;
|
|
@@ -314,8 +265,9 @@ var _default = createComponent({
|
|
|
314
265
|
// 一次调用滑动帧数,每次调用会不一样
|
|
315
266
|
var dist = Math.ceil(needScrollTop / _this4.scrollSpeed);
|
|
316
267
|
_currentY += dist;
|
|
317
|
-
window.scrollTo(_currentY, currentY);
|
|
268
|
+
window.scrollTo(_currentY, currentY);
|
|
318
269
|
|
|
270
|
+
// 如果移动幅度小于十个像素,直接移动,否则递归调用,实现动画效果
|
|
319
271
|
if (needScrollTop > _this4.scrollSpeed || needScrollTop < -_this4.scrollSpeed) {
|
|
320
272
|
_this4.scrollAnimation(_currentY, targetY, lockfixed);
|
|
321
273
|
} else {
|
|
@@ -328,15 +280,13 @@ var _default = createComponent({
|
|
|
328
280
|
render: function render() {
|
|
329
281
|
var h = arguments[0];
|
|
330
282
|
var fixed = this.fixed,
|
|
331
|
-
|
|
283
|
+
cover = this.cover;
|
|
332
284
|
var style = {
|
|
333
285
|
height: fixed ? this.height + "px" : null
|
|
334
286
|
};
|
|
335
|
-
|
|
336
287
|
if (cover && this.fixed) {
|
|
337
288
|
style.width = "100%";
|
|
338
289
|
}
|
|
339
|
-
|
|
340
290
|
return h("div", {
|
|
341
291
|
"style": style
|
|
342
292
|
}, [h("div", {
|
|
@@ -349,6 +299,4 @@ var _default = createComponent({
|
|
|
349
299
|
"style": this.headStyle
|
|
350
300
|
}, [this.renderLoading()])])]);
|
|
351
301
|
}
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
exports.default = _default;
|
|
302
|
+
});
|
package/lib/swipe/index.js
CHANGED
|
@@ -2,35 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.default = void 0;
|
|
5
|
-
|
|
6
5
|
var _utils = require("../utils");
|
|
7
|
-
|
|
8
6
|
var _style = require("../utils/dom/style");
|
|
9
|
-
|
|
10
7
|
var _event = require("../utils/dom/event");
|
|
11
|
-
|
|
12
8
|
var _raf = require("../utils/dom/raf");
|
|
13
|
-
|
|
14
9
|
var _number = require("../utils/format/number");
|
|
15
|
-
|
|
16
10
|
var _touch = require("../mixins/touch");
|
|
17
|
-
|
|
18
11
|
var _relation = require("../mixins/relation");
|
|
19
|
-
|
|
20
12
|
var _bindEvent = require("../mixins/bind-event");
|
|
21
|
-
|
|
22
13
|
// Utils
|
|
14
|
+
|
|
23
15
|
// Mixins
|
|
24
|
-
var _createNamespace = (0, _utils.createNamespace)('swipe'),
|
|
25
|
-
createComponent = _createNamespace[0],
|
|
26
|
-
bem = _createNamespace[1];
|
|
27
16
|
|
|
28
|
-
var
|
|
17
|
+
var _createNamespace = (0, _utils.createNamespace)('swipe'),
|
|
18
|
+
createComponent = _createNamespace[0],
|
|
19
|
+
bem = _createNamespace[1];
|
|
20
|
+
var _default = exports.default = createComponent({
|
|
29
21
|
mixins: [_touch.TouchMixin, (0, _relation.ParentMixin)('vanSwipe'), (0, _bindEvent.BindEventMixin)(function (bind, isBind) {
|
|
30
22
|
bind(window, 'resize', this.resize, true);
|
|
31
23
|
bind(window, 'orientationchange', this.resize, true);
|
|
32
24
|
bind(window, 'visibilitychange', this.onVisibilityChange);
|
|
33
|
-
|
|
34
25
|
if (isBind) {
|
|
35
26
|
this.initialize();
|
|
36
27
|
} else {
|
|
@@ -125,14 +116,12 @@ var _default = createComponent({
|
|
|
125
116
|
transitionDuration: (this.swiping ? 0 : this.duration) + "ms",
|
|
126
117
|
transform: "translate" + (this.vertical ? 'Y' : 'X') + "(" + this.offset + "px)"
|
|
127
118
|
};
|
|
128
|
-
|
|
129
119
|
if (this.size) {
|
|
130
120
|
var mainAxis = this.vertical ? 'height' : 'width';
|
|
131
121
|
var crossAxis = this.vertical ? 'width' : 'height';
|
|
132
122
|
style[mainAxis] = this.trackSize + "px";
|
|
133
123
|
style[crossAxis] = this[crossAxis] ? this[crossAxis] + "px" : '';
|
|
134
124
|
}
|
|
135
|
-
|
|
136
125
|
return style;
|
|
137
126
|
},
|
|
138
127
|
indicatorStyle: function indicatorStyle() {
|
|
@@ -153,11 +142,9 @@ var _default = createComponent({
|
|
|
153
142
|
if (active === void 0) {
|
|
154
143
|
active = +this.initialSwipe;
|
|
155
144
|
}
|
|
156
|
-
|
|
157
145
|
if (!this.$el || (0, _style.isHidden)(this.$el)) {
|
|
158
146
|
return;
|
|
159
147
|
}
|
|
160
|
-
|
|
161
148
|
clearTimeout(this.timer);
|
|
162
149
|
var rect = {
|
|
163
150
|
width: this.$el.offsetWidth,
|
|
@@ -195,7 +182,6 @@ var _default = createComponent({
|
|
|
195
182
|
onTouchMove: function onTouchMove(event) {
|
|
196
183
|
if (!this.touchable || !this.swiping) return;
|
|
197
184
|
this.touchMove(event);
|
|
198
|
-
|
|
199
185
|
if (this.isCorrectDirection) {
|
|
200
186
|
(0, _event.preventDefault)(event, this.stopPropagation);
|
|
201
187
|
this.move({
|
|
@@ -206,21 +192,18 @@ var _default = createComponent({
|
|
|
206
192
|
onTouchEnd: function onTouchEnd() {
|
|
207
193
|
if (!this.touchable || !this.swiping) return;
|
|
208
194
|
var size = this.size,
|
|
209
|
-
|
|
195
|
+
delta = this.delta;
|
|
210
196
|
var duration = Date.now() - this.touchStartTime;
|
|
211
197
|
var speed = delta / duration;
|
|
212
198
|
var shouldSwipe = Math.abs(speed) > 0.25 || Math.abs(delta) > size / 2;
|
|
213
|
-
|
|
214
199
|
if (shouldSwipe && this.isCorrectDirection) {
|
|
215
200
|
var offset = this.vertical ? this.offsetY : this.offsetX;
|
|
216
201
|
var pace = 0;
|
|
217
|
-
|
|
218
202
|
if (this.loop) {
|
|
219
203
|
pace = offset > 0 ? delta > 0 ? -1 : 1 : 0;
|
|
220
204
|
} else {
|
|
221
205
|
pace = -Math[delta > 0 ? 'ceil' : 'floor'](delta / size);
|
|
222
206
|
}
|
|
223
|
-
|
|
224
207
|
this.move({
|
|
225
208
|
pace: pace,
|
|
226
209
|
emitChange: true
|
|
@@ -230,79 +213,66 @@ var _default = createComponent({
|
|
|
230
213
|
pace: 0
|
|
231
214
|
});
|
|
232
215
|
}
|
|
233
|
-
|
|
234
216
|
this.swiping = false;
|
|
235
217
|
this.autoPlay();
|
|
236
218
|
},
|
|
237
219
|
getTargetActive: function getTargetActive(pace) {
|
|
238
220
|
var active = this.active,
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
221
|
+
count = this.count,
|
|
222
|
+
maxCount = this.maxCount;
|
|
242
223
|
if (pace) {
|
|
243
224
|
if (this.loop) {
|
|
244
225
|
return (0, _number.range)(active + pace, -1, count);
|
|
245
226
|
}
|
|
246
|
-
|
|
247
227
|
return (0, _number.range)(active + pace, 0, maxCount);
|
|
248
228
|
}
|
|
249
|
-
|
|
250
229
|
return active;
|
|
251
230
|
},
|
|
252
231
|
getTargetOffset: function getTargetOffset(targetActive, offset) {
|
|
253
232
|
if (offset === void 0) {
|
|
254
233
|
offset = 0;
|
|
255
234
|
}
|
|
256
|
-
|
|
257
235
|
var currentPosition = targetActive * this.size;
|
|
258
|
-
|
|
259
236
|
if (!this.loop) {
|
|
260
237
|
currentPosition = Math.min(currentPosition, -this.minOffset);
|
|
261
238
|
}
|
|
262
|
-
|
|
263
239
|
var targetOffset = offset - currentPosition;
|
|
264
|
-
|
|
265
240
|
if (!this.loop) {
|
|
266
241
|
targetOffset = (0, _number.range)(targetOffset, this.minOffset, 0);
|
|
267
242
|
}
|
|
268
|
-
|
|
269
243
|
return targetOffset;
|
|
270
244
|
},
|
|
271
245
|
move: function move(_ref) {
|
|
272
246
|
var _ref$pace = _ref.pace,
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
247
|
+
pace = _ref$pace === void 0 ? 0 : _ref$pace,
|
|
248
|
+
_ref$offset = _ref.offset,
|
|
249
|
+
offset = _ref$offset === void 0 ? 0 : _ref$offset,
|
|
250
|
+
emitChange = _ref.emitChange;
|
|
277
251
|
var loop = this.loop,
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
252
|
+
count = this.count,
|
|
253
|
+
active = this.active,
|
|
254
|
+
children = this.children,
|
|
255
|
+
trackSize = this.trackSize,
|
|
256
|
+
minOffset = this.minOffset;
|
|
284
257
|
if (count <= 1) {
|
|
285
258
|
return;
|
|
286
259
|
}
|
|
287
|
-
|
|
288
260
|
var targetActive = this.getTargetActive(pace);
|
|
289
|
-
var targetOffset = this.getTargetOffset(targetActive, offset);
|
|
261
|
+
var targetOffset = this.getTargetOffset(targetActive, offset);
|
|
290
262
|
|
|
263
|
+
// auto move first and last swipe in loop mode
|
|
291
264
|
if (loop) {
|
|
292
265
|
if (children[0] && targetOffset !== minOffset) {
|
|
293
266
|
var outRightBound = targetOffset < minOffset;
|
|
294
267
|
children[0].offset = outRightBound ? trackSize : 0;
|
|
295
268
|
}
|
|
296
|
-
|
|
297
269
|
if (children[count - 1] && targetOffset !== 0) {
|
|
298
270
|
var outLeftBound = targetOffset > 0;
|
|
299
271
|
children[count - 1].offset = outLeftBound ? -trackSize : 0;
|
|
300
272
|
}
|
|
301
273
|
}
|
|
302
|
-
|
|
303
274
|
this.active = targetActive;
|
|
304
275
|
this.offset = targetOffset;
|
|
305
|
-
|
|
306
276
|
if (emitChange && targetActive !== active) {
|
|
307
277
|
this.$emit('change', this.activeIndicator);
|
|
308
278
|
}
|
|
@@ -310,12 +280,10 @@ var _default = createComponent({
|
|
|
310
280
|
// @exposed-api
|
|
311
281
|
prev: function prev() {
|
|
312
282
|
var _this = this;
|
|
313
|
-
|
|
314
283
|
this.correctPosition();
|
|
315
284
|
this.resetTouchStatus();
|
|
316
285
|
(0, _raf.doubleRaf)(function () {
|
|
317
286
|
_this.swiping = false;
|
|
318
|
-
|
|
319
287
|
_this.move({
|
|
320
288
|
pace: -1,
|
|
321
289
|
emitChange: true
|
|
@@ -325,12 +293,10 @@ var _default = createComponent({
|
|
|
325
293
|
// @exposed-api
|
|
326
294
|
next: function next() {
|
|
327
295
|
var _this2 = this;
|
|
328
|
-
|
|
329
296
|
this.correctPosition();
|
|
330
297
|
this.resetTouchStatus();
|
|
331
298
|
(0, _raf.doubleRaf)(function () {
|
|
332
299
|
_this2.swiping = false;
|
|
333
|
-
|
|
334
300
|
_this2.move({
|
|
335
301
|
pace: 1,
|
|
336
302
|
emitChange: true
|
|
@@ -340,22 +306,18 @@ var _default = createComponent({
|
|
|
340
306
|
// @exposed-api
|
|
341
307
|
swipeTo: function swipeTo(index, options) {
|
|
342
308
|
var _this3 = this;
|
|
343
|
-
|
|
344
309
|
if (options === void 0) {
|
|
345
310
|
options = {};
|
|
346
311
|
}
|
|
347
|
-
|
|
348
312
|
this.correctPosition();
|
|
349
313
|
this.resetTouchStatus();
|
|
350
314
|
(0, _raf.doubleRaf)(function () {
|
|
351
315
|
var targetIndex;
|
|
352
|
-
|
|
353
316
|
if (_this3.loop && index === _this3.count) {
|
|
354
317
|
targetIndex = _this3.active === 0 ? 0 : index;
|
|
355
318
|
} else {
|
|
356
319
|
targetIndex = index % _this3.count;
|
|
357
320
|
}
|
|
358
|
-
|
|
359
321
|
if (options.immediate) {
|
|
360
322
|
(0, _raf.doubleRaf)(function () {
|
|
361
323
|
_this3.swiping = false;
|
|
@@ -363,7 +325,6 @@ var _default = createComponent({
|
|
|
363
325
|
} else {
|
|
364
326
|
_this3.swiping = false;
|
|
365
327
|
}
|
|
366
|
-
|
|
367
328
|
_this3.move({
|
|
368
329
|
pace: targetIndex - _this3.active,
|
|
369
330
|
emitChange: true
|
|
@@ -372,13 +333,11 @@ var _default = createComponent({
|
|
|
372
333
|
},
|
|
373
334
|
correctPosition: function correctPosition() {
|
|
374
335
|
this.swiping = true;
|
|
375
|
-
|
|
376
336
|
if (this.active <= -1) {
|
|
377
337
|
this.move({
|
|
378
338
|
pace: this.count
|
|
379
339
|
});
|
|
380
340
|
}
|
|
381
|
-
|
|
382
341
|
if (this.active >= this.count) {
|
|
383
342
|
this.move({
|
|
384
343
|
pace: -this.count
|
|
@@ -390,21 +349,17 @@ var _default = createComponent({
|
|
|
390
349
|
},
|
|
391
350
|
autoPlay: function autoPlay() {
|
|
392
351
|
var _this4 = this;
|
|
393
|
-
|
|
394
352
|
var autoplay = this.autoplay;
|
|
395
|
-
|
|
396
353
|
if (autoplay > 0 && this.count > 1) {
|
|
397
354
|
this.clear();
|
|
398
355
|
this.timer = setTimeout(function () {
|
|
399
356
|
_this4.next();
|
|
400
|
-
|
|
401
357
|
_this4.autoPlay();
|
|
402
358
|
}, autoplay);
|
|
403
359
|
}
|
|
404
360
|
},
|
|
405
361
|
titleDiv: function titleDiv() {
|
|
406
362
|
var h = this.$createElement;
|
|
407
|
-
|
|
408
363
|
if (this.$slots.title) {
|
|
409
364
|
return this.$slots.title;
|
|
410
365
|
} else if (this.title) {
|
|
@@ -413,7 +368,6 @@ var _default = createComponent({
|
|
|
413
368
|
"class": bem('title')
|
|
414
369
|
}, [this.title[this.active == this.count ? 0 : this.active]]);
|
|
415
370
|
}
|
|
416
|
-
|
|
417
371
|
return h("div", {
|
|
418
372
|
"class": bem('title')
|
|
419
373
|
}, [this.title]);
|
|
@@ -423,7 +377,6 @@ var _default = createComponent({
|
|
|
423
377
|
},
|
|
424
378
|
foot: function foot() {
|
|
425
379
|
var h = this.$createElement;
|
|
426
|
-
|
|
427
380
|
if (this.title) {
|
|
428
381
|
return h("div", {
|
|
429
382
|
"class": bem('foot')
|
|
@@ -434,16 +387,13 @@ var _default = createComponent({
|
|
|
434
387
|
},
|
|
435
388
|
genIndicator: function genIndicator() {
|
|
436
389
|
var _this5 = this;
|
|
437
|
-
|
|
438
390
|
var h = this.$createElement;
|
|
439
391
|
var count = this.count,
|
|
440
|
-
|
|
392
|
+
activeIndicator = this.activeIndicator;
|
|
441
393
|
var slot = this.slots('indicator');
|
|
442
|
-
|
|
443
394
|
if (slot) {
|
|
444
395
|
return slot;
|
|
445
396
|
}
|
|
446
|
-
|
|
447
397
|
if (this.showIndicators && count > 1) {
|
|
448
398
|
return h("div", {
|
|
449
399
|
"class": bem('indicators', {
|
|
@@ -472,6 +422,4 @@ var _default = createComponent({
|
|
|
472
422
|
})
|
|
473
423
|
}, [this.slots()]), this.foot()]);
|
|
474
424
|
}
|
|
475
|
-
});
|
|
476
|
-
|
|
477
|
-
exports.default = _default;
|
|
425
|
+
});
|