zartui 0.1.44 → 0.1.48

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.
Files changed (59) hide show
  1. package/es/dialog/index.css +1 -1
  2. package/es/dialog/index.less +5 -2
  3. package/es/index.js +5 -3
  4. package/es/list/index.css +1 -0
  5. package/es/list/index.js +178 -0
  6. package/es/list/index.less +17 -0
  7. package/es/list/style/index.js +3 -0
  8. package/es/list/style/less.js +3 -0
  9. package/es/locale/index.js +5 -5
  10. package/es/pdf-viewer/index.less +68 -68
  11. package/es/pull-refresh/index.css +1 -0
  12. package/es/pull-refresh/index.js +214 -0
  13. package/es/pull-refresh/index.less +25 -0
  14. package/es/pull-refresh/style/index.js +3 -0
  15. package/es/pull-refresh/style/less.js +3 -0
  16. package/es/signature/index.js +23 -14
  17. package/es/slider/index.css +1 -1
  18. package/es/slider/index.js +2 -1
  19. package/es/slider/index.less +0 -1
  20. package/es/sticky/index.css +1 -1
  21. package/es/sticky/index.js +87 -24
  22. package/es/sticky/index.less +3 -0
  23. package/es/swipe/index.css +1 -1
  24. package/es/swipe/index.js +12 -1
  25. package/es/swipe/index.less +7 -1
  26. package/es/tabs/index.css +1 -1
  27. package/es/tabs/index.less +5 -3
  28. package/lib/dialog/index.css +1 -1
  29. package/lib/dialog/index.less +5 -2
  30. package/lib/index.css +1 -1
  31. package/lib/index.js +10 -2
  32. package/lib/index.less +2 -0
  33. package/lib/list/index.css +1 -0
  34. package/lib/list/index.js +191 -0
  35. package/lib/list/index.less +17 -0
  36. package/lib/list/style/index.js +3 -0
  37. package/lib/list/style/less.js +3 -0
  38. package/lib/locale/index.js +5 -5
  39. package/lib/pdf-viewer/index.less +68 -68
  40. package/lib/pull-refresh/index.css +1 -0
  41. package/lib/pull-refresh/index.js +228 -0
  42. package/lib/pull-refresh/index.less +25 -0
  43. package/lib/pull-refresh/style/index.js +3 -0
  44. package/lib/pull-refresh/style/less.js +3 -0
  45. package/lib/signature/index.js +23 -14
  46. package/lib/slider/index.css +1 -1
  47. package/lib/slider/index.js +2 -1
  48. package/lib/slider/index.less +0 -1
  49. package/lib/sticky/index.css +1 -1
  50. package/lib/sticky/index.js +87 -24
  51. package/lib/sticky/index.less +3 -0
  52. package/lib/swipe/index.css +1 -1
  53. package/lib/swipe/index.js +12 -1
  54. package/lib/swipe/index.less +7 -1
  55. package/lib/tabs/index.css +1 -1
  56. package/lib/tabs/index.less +5 -3
  57. package/lib/zart.js +529 -47
  58. package/lib/zart.min.js +4 -4
  59. package/package.json +1 -1
@@ -1 +1 @@
1
- .zt-dialog{position:fixed;top:45%;left:50%;width:327px;overflow:hidden;font-size:16px;background-color:#fff;border-radius:4px;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0);-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transition:.3s;transition:.3s;-webkit-transition-property:opacity,-webkit-transform;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform}@media (max-width:328px){.zt-dialog{width:90%}}.zt-dialog__header{padding-top:24px;font-weight:700;line-height:24px;height:24px;text-align:center;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;word-break:break-all;padding-left:16px;padding-right:16px}.zt-dialog__header--isolated{padding:24px 0}.zt-dialog__header--custom-title{height:44px;padding-left:0;padding-right:0;padding-top:0}.zt-dialog__content--isolated{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;min-height:100px}.zt-dialog__message{-webkit-box-flex:1;-webkit-flex:1;flex:1;max-height:60vh;padding:24px 16px;overflow-y:auto;font-size:16px;line-height:20px;color:rgba(0,0,0,.6);white-space:pre-wrap;word-wrap:break-word;-webkit-overflow-scrolling:touch}.zt-dialog__message--has-title{padding-top:8px;font-size:14px}.zt-dialog__message--left{text-align:left}.zt-dialog__message--right{text-align:right}.zt-dialog__footer{display:-webkit-box;display:-webkit-flex;display:flex;overflow:hidden;-webkit-user-select:none;user-select:none}.zt-dialog__footer .zt-hairline--left::after{top:calc(-50% + 20px);bottom:calc(-50% + 20px)}.zt-dialog__cancel,.zt-dialog__confirm{-webkit-box-flex:1;-webkit-flex:1;flex:1;height:44px;margin:0;border:0}.zt-dialog__confirm,.zt-dialog__confirm:active{color:#0091fa}.zt-dialog__cancel{color:#000;font-weight:400}.zt-dialog-bounce-enter{-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.zt-dialog-bounce-leave-active{-webkit-transform:translate3d(-50%,-50%,0) scale(.9);transform:translate3d(-50%,-50%,0) scale(.9);opacity:0}
1
+ .zt-dialog{position:fixed;top:45%;left:50%;width:327px;overflow:hidden;font-size:16px;background-color:#fff;border-radius:4px;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0);-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transition:.3s;transition:.3s;-webkit-transition-property:opacity,-webkit-transform;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform}@media (max-width:328px){.zt-dialog{width:90%}}.zt-dialog__header{padding-top:24px;font-weight:700;line-height:24px;text-align:center;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;word-break:break-all;padding-left:16px;padding-right:16px}.zt-dialog__header--isolated{padding:24px 0}.zt-dialog__header--custom-title{height:44px;padding-left:0;padding-right:0;padding-top:0}.zt-dialog__content{text-align:center}.zt-dialog__content--isolated{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;min-height:100px}.zt-dialog__message{max-height:60vh;padding:24px 16px;overflow-y:auto;font-size:16px;line-height:20px;color:rgba(0,0,0,.6);display:inline-block;text-align:left;white-space:pre-wrap;word-wrap:break-word;-webkit-overflow-scrolling:touch}.zt-dialog__message--has-title{padding-top:8px;font-size:14px}.zt-dialog__message--left{text-align:left}.zt-dialog__message--right{text-align:right}.zt-dialog__footer{display:-webkit-box;display:-webkit-flex;display:flex;overflow:hidden;-webkit-user-select:none;user-select:none}.zt-dialog__footer .zt-hairline--left::after{top:calc(-50% + 20px);bottom:calc(-50% + 20px)}.zt-dialog__cancel,.zt-dialog__confirm{-webkit-box-flex:1;-webkit-flex:1;flex:1;height:44px;margin:0;border:0}.zt-dialog__confirm,.zt-dialog__confirm:active{color:#0091fa}.zt-dialog__cancel{color:#000;font-weight:400}.zt-dialog-bounce-enter{-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.zt-dialog-bounce-leave-active{-webkit-transform:translate3d(-50%,-50%,0) scale(.9);transform:translate3d(-50%,-50%,0) scale(.9);opacity:0}
@@ -22,7 +22,6 @@
22
22
  padding-top: @dialog-header-padding-top;
23
23
  font-weight: @dialog-header-font-weight;
24
24
  line-height: @dialog-header-line-height;
25
- height: @dialog-header-line-height;
26
25
  text-align: center;
27
26
  white-space: nowrap;
28
27
  text-overflow: ellipsis;
@@ -44,21 +43,25 @@
44
43
  }
45
44
 
46
45
  &__content {
46
+ text-align: center;
47
47
  &--isolated {
48
48
  display: flex;
49
49
  align-items: center;
50
+ justify-content: center;
50
51
  min-height: 100px;
51
52
  }
52
53
  }
53
54
 
54
55
  &__message {
55
- flex: 1;
56
+ // flex: 1;
56
57
  max-height: @dialog-message-max-height;
57
58
  padding: 24px @dialog-message-padding;
58
59
  overflow-y: auto;
59
60
  font-size: @dialog-message-font-size;
60
61
  line-height: @dialog-message-line-height;
61
62
  color: @dialog-has-title-message-text-color;
63
+ display: inline-block;
64
+ text-align: left;
62
65
 
63
66
  // allow newline charactor
64
67
  white-space: pre-wrap;
package/es/index.js CHANGED
@@ -25,6 +25,7 @@ import Image from './image';
25
25
  import ImagePreview from './image-preview';
26
26
  import Info from './info';
27
27
  import Lazyload from './lazyload';
28
+ import List from './list';
28
29
  import Loading from './loading';
29
30
  import Locale from './locale';
30
31
  import NavBar from './nav-bar';
@@ -35,6 +36,7 @@ import PasswordInput from './password-input';
35
36
  import PdfViewer from './pdf-viewer';
36
37
  import Picker from './picker';
37
38
  import Popup from './popup';
39
+ import PullRefresh from './pull-refresh';
38
40
  import Radio from './radio';
39
41
  import RadioGroup from './radio-group';
40
42
  import Rate from './rate';
@@ -59,10 +61,10 @@ import Tabs from './tabs';
59
61
  import Tag from './tag';
60
62
  import Toast from './toast';
61
63
  import Uploader from './uploader';
62
- var version = '0.1.44';
64
+ var version = '0.1.48';
63
65
 
64
66
  function install(Vue) {
65
- var components = [ActionSheet, Area, Avatar, Badge, Button, Calendar, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, Form, Icon, Image, ImagePreview, Info, Lazyload, Loading, Locale, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, Picker, Popup, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Tabs, Tag, Toast, Uploader];
67
+ var components = [ActionSheet, Area, Avatar, Badge, Button, Calendar, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, Form, Icon, Image, ImagePreview, Info, Lazyload, List, Loading, Locale, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, Picker, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Tabs, Tag, Toast, Uploader];
66
68
  components.forEach(function (item) {
67
69
  if (item.install) {
68
70
  Vue.use(item);
@@ -76,7 +78,7 @@ if (typeof window !== 'undefined' && window.Vue) {
76
78
  install(window.Vue);
77
79
  }
78
80
 
79
- export { install, version, ActionSheet, Area, Avatar, Badge, Button, Calendar, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, Form, Icon, Image, ImagePreview, Info, Lazyload, Loading, Locale, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, Picker, Popup, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Tabs, Tag, Toast, Uploader };
81
+ export { install, version, ActionSheet, Area, Avatar, Badge, Button, Calendar, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, Form, Icon, Image, ImagePreview, Info, Lazyload, List, Loading, Locale, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, Picker, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Tabs, Tag, Toast, Uploader };
80
82
  export default {
81
83
  install: install,
82
84
  version: version
@@ -0,0 +1 @@
1
+ .zt-list__error-text,.zt-list__finished-text,.zt-list__loading{color:#969799;font-size:14px;line-height:50px;text-align:center}.zt-list__placeholder{height:0;pointer-events:none}
@@ -0,0 +1,178 @@
1
+ // Utils
2
+ import { createNamespace } from '../utils';
3
+ import { isHidden } from '../utils/dom/style';
4
+ import { getScroller } from '../utils/dom/scroll'; // Mixins
5
+
6
+ import { BindEventMixin } from '../mixins/bind-event'; // Components
7
+
8
+ import Loading from '../loading';
9
+
10
+ var _createNamespace = createNamespace('list'),
11
+ createComponent = _createNamespace[0],
12
+ bem = _createNamespace[1],
13
+ t = _createNamespace[2];
14
+
15
+ export default createComponent({
16
+ mixins: [BindEventMixin(function (bind) {
17
+ if (!this.scroller) {
18
+ this.scroller = getScroller(this.$el);
19
+ }
20
+
21
+ bind(this.scroller, 'scroll', this.check);
22
+ })],
23
+ model: {
24
+ prop: 'loading'
25
+ },
26
+ props: {
27
+ error: Boolean,
28
+ loading: Boolean,
29
+ finished: Boolean,
30
+ errorText: String,
31
+ loadingText: String,
32
+ finishedText: String,
33
+ immediateCheck: {
34
+ type: Boolean,
35
+ default: true
36
+ },
37
+ offset: {
38
+ type: [Number, String],
39
+ default: 300
40
+ },
41
+ direction: {
42
+ type: String,
43
+ default: 'down'
44
+ }
45
+ },
46
+ data: function data() {
47
+ return {
48
+ // use sync innerLoading state to avoid repeated loading in some edge cases
49
+ innerLoading: this.loading
50
+ };
51
+ },
52
+ updated: function updated() {
53
+ this.innerLoading = this.loading;
54
+ },
55
+ mounted: function mounted() {
56
+ if (this.immediateCheck) {
57
+ this.check();
58
+ }
59
+ },
60
+ watch: {
61
+ loading: 'check',
62
+ finished: 'check'
63
+ },
64
+ methods: {
65
+ // @exposed-api
66
+ check: function check() {
67
+ var _this = this;
68
+
69
+ this.$nextTick(function () {
70
+ if (_this.innerLoading || _this.finished || _this.error) {
71
+ return;
72
+ }
73
+
74
+ var el = _this.$el,
75
+ scroller = _this.scroller,
76
+ offset = _this.offset,
77
+ direction = _this.direction;
78
+ var scrollerRect;
79
+
80
+ if (scroller.getBoundingClientRect) {
81
+ scrollerRect = scroller.getBoundingClientRect();
82
+ } else {
83
+ scrollerRect = {
84
+ top: 0,
85
+ bottom: scroller.innerHeight
86
+ };
87
+ }
88
+
89
+ var scrollerHeight = scrollerRect.bottom - scrollerRect.top;
90
+ /* istanbul ignore next */
91
+
92
+ if (!scrollerHeight || isHidden(el)) {
93
+ return false;
94
+ }
95
+
96
+ var isReachEdge = false;
97
+
98
+ var placeholderRect = _this.$refs.placeholder.getBoundingClientRect();
99
+
100
+ if (direction === 'up') {
101
+ isReachEdge = scrollerRect.top - placeholderRect.top <= offset;
102
+ } else {
103
+ isReachEdge = placeholderRect.bottom - scrollerRect.bottom <= offset;
104
+ }
105
+
106
+ if (isReachEdge) {
107
+ _this.innerLoading = true;
108
+
109
+ _this.$emit('input', true);
110
+
111
+ _this.$emit('load');
112
+ }
113
+ });
114
+ },
115
+ clickErrorText: function clickErrorText() {
116
+ this.$emit('update:error', false);
117
+ this.check();
118
+ },
119
+ genLoading: function genLoading() {
120
+ var h = this.$createElement;
121
+
122
+ if (this.innerLoading && !this.finished) {
123
+ return h("div", {
124
+ "key": "loading",
125
+ "class": bem('loading')
126
+ }, [this.slots('loading') || h(Loading, {
127
+ "attrs": {
128
+ "size": "16"
129
+ }
130
+ }, [this.loadingText || t('loading')])]);
131
+ }
132
+ },
133
+ genFinishedText: function genFinishedText() {
134
+ var h = this.$createElement;
135
+
136
+ if (this.finished) {
137
+ var text = this.slots('finished') || this.finishedText;
138
+
139
+ if (text) {
140
+ return h("div", {
141
+ "class": bem('finished-text')
142
+ }, [text]);
143
+ }
144
+ }
145
+ },
146
+ genErrorText: function genErrorText() {
147
+ var h = this.$createElement;
148
+
149
+ if (this.error) {
150
+ var text = this.slots('error') || this.errorText;
151
+
152
+ if (text) {
153
+ return h("div", {
154
+ "on": {
155
+ "click": this.clickErrorText
156
+ },
157
+ "class": bem('error-text')
158
+ }, [text]);
159
+ }
160
+ }
161
+ }
162
+ },
163
+ render: function render() {
164
+ var h = arguments[0];
165
+ var Placeholder = h("div", {
166
+ "ref": "placeholder",
167
+ "key": "placeholder",
168
+ "class": bem('placeholder')
169
+ });
170
+ return h("div", {
171
+ "class": bem(),
172
+ "attrs": {
173
+ "role": "feed",
174
+ "aria-busy": this.innerLoading
175
+ }
176
+ }, [this.direction === 'down' ? this.slots() : Placeholder, this.genLoading(), this.genFinishedText(), this.genErrorText(), this.direction === 'up' ? this.slots() : Placeholder]);
177
+ }
178
+ });
@@ -0,0 +1,17 @@
1
+ @import '../style/var';
2
+
3
+ .zt-list {
4
+ &__loading,
5
+ &__finished-text,
6
+ &__error-text {
7
+ color: @list-text-color;
8
+ font-size: @list-text-font-size;
9
+ line-height: @list-text-line-height;
10
+ text-align: center;
11
+ }
12
+
13
+ &__placeholder {
14
+ height: 0;
15
+ pointer-events: none;
16
+ }
17
+ }
@@ -0,0 +1,3 @@
1
+ import '../../style/base.css';
2
+ import '../../loading/index.css';
3
+ import '../index.css';
@@ -0,0 +1,3 @@
1
+ import '../../style/base.less';
2
+ import '../../loading/index.less';
3
+ import '../index.less';
@@ -3,18 +3,18 @@ import { deepAssign } from '../utils/deep-assign';
3
3
  import defaultMessages from './lang/zh-CN';
4
4
  var proto = Vue.prototype;
5
5
  var defineReactive = Vue.util.defineReactive;
6
- defineReactive(proto, '$vantLang', 'zh-CN');
7
- defineReactive(proto, '$vantMessages', {
6
+ defineReactive(proto, '$zartLang', 'zh-CN');
7
+ defineReactive(proto, '$zartMessages', {
8
8
  'zh-CN': defaultMessages
9
9
  });
10
10
  export default {
11
11
  messages: function messages() {
12
- return proto.$vantMessages[proto.$vantLang];
12
+ return proto.$zartMessages[proto.$zartLang];
13
13
  },
14
14
  use: function use(lang, messages) {
15
15
  var _this$add;
16
16
 
17
- proto.$vantLang = lang;
17
+ proto.$zartLang = lang;
18
18
  this.add((_this$add = {}, _this$add[lang] = messages, _this$add));
19
19
  },
20
20
  add: function add(messages) {
@@ -22,6 +22,6 @@ export default {
22
22
  messages = {};
23
23
  }
24
24
 
25
- deepAssign(proto.$vantMessages, messages);
25
+ deepAssign(proto.$zartMessages, messages);
26
26
  }
27
27
  };
@@ -1,69 +1,69 @@
1
- @import '../style/var';
2
- .zt-pdf-viewer {
3
- background-color: #fff !important;
4
- display: flex;
5
- flex-direction: column;
6
- .zt-pdf-viewer__loading {
7
- position: fixed;
8
- top: 50%;
9
- left: 50%;
10
- margin-left: -15px;
11
- margin-top: -15px;
12
- }
13
- .zt-pdf-viewer__pdf-top {
14
- font-size: 16px;
15
- display: flex;
16
- align-items: center;
17
- height: 44px;
18
- background-color: #FFF;
19
- flex-wrap: wrap;
20
- padding: 0 10px;
21
- position: fixed;
22
- bottom: 0;
23
- padding-bottom: constant(safe-area-inset-bottom);
24
- padding-bottom: env(safe-area-inset-bottom);
25
- left: 0;
26
- width: calc(100% - 20px);
27
- z-index: 9;
28
- .zt-pdf-viewer__page-btn {
29
- display: flex;
30
- align-items: center;
31
- flex: 1;
32
- justify-content: center;
33
- }
34
- .zt-pdf-viewer__rotate-btn {
35
- flex: 1;
36
- .zt-pdf-viewer__rotate-btn__icon {
37
- display: block;
38
- margin: auto;
39
- }
40
- }
41
- .zt-pdf-viewer__handle-btn {
42
- background-color: transparent;
43
- border: none;
44
- outline: none;
45
- color: #0091fa;
46
- }
47
- .zt-pdf-viewer__page-count {
48
- margin: 0 10px;
49
- }
50
- }
51
- .zt-pdf-viewer__page-margin {
52
- height: 16px;
53
- background: rgba(0,0,0,.1);
54
- }
55
- .zt-pdf-viewer__popup {
56
- padding: 10px 0;
57
- max-height: 70%;
58
- .zt-pdf-viewer__page-item {
59
- height: 30px;
60
- line-height: 30px;
61
- font-size: 16px;
62
- text-align: center;
63
- border-bottom: 1px solid rgba(0,0,0,.1);
64
- &:last-child {
65
- border: none;
66
- }
67
- }
68
- }
1
+ @import '../style/var';
2
+ .zt-pdf-viewer {
3
+ background-color: #fff !important;
4
+ display: flex;
5
+ flex-direction: column;
6
+ .zt-pdf-viewer__loading {
7
+ position: fixed;
8
+ top: 50%;
9
+ left: 50%;
10
+ margin-left: -15px;
11
+ margin-top: -15px;
12
+ }
13
+ .zt-pdf-viewer__pdf-top {
14
+ font-size: 16px;
15
+ display: flex;
16
+ align-items: center;
17
+ height: 44px;
18
+ background-color: #FFF;
19
+ flex-wrap: wrap;
20
+ padding: 0 10px;
21
+ position: fixed;
22
+ bottom: 0;
23
+ padding-bottom: constant(safe-area-inset-bottom);
24
+ padding-bottom: env(safe-area-inset-bottom);
25
+ left: 0;
26
+ width: calc(100% - 20px);
27
+ z-index: 9;
28
+ .zt-pdf-viewer__page-btn {
29
+ display: flex;
30
+ align-items: center;
31
+ flex: 1;
32
+ justify-content: center;
33
+ }
34
+ .zt-pdf-viewer__rotate-btn {
35
+ flex: 1;
36
+ .zt-pdf-viewer__rotate-btn__icon {
37
+ display: block;
38
+ margin: auto;
39
+ }
40
+ }
41
+ .zt-pdf-viewer__handle-btn {
42
+ background-color: transparent;
43
+ border: none;
44
+ outline: none;
45
+ color: #0091fa;
46
+ }
47
+ .zt-pdf-viewer__page-count {
48
+ margin: 0 10px;
49
+ }
50
+ }
51
+ .zt-pdf-viewer__page-margin {
52
+ height: 16px;
53
+ background: rgba(0,0,0,.1);
54
+ }
55
+ .zt-pdf-viewer__popup {
56
+ padding: 10px 0;
57
+ max-height: 70%;
58
+ .zt-pdf-viewer__page-item {
59
+ height: 30px;
60
+ line-height: 30px;
61
+ font-size: 16px;
62
+ text-align: center;
63
+ border-bottom: 1px solid rgba(0,0,0,.1);
64
+ &:last-child {
65
+ border: none;
66
+ }
67
+ }
68
+ }
69
69
  }
@@ -0,0 +1 @@
1
+ .zt-pull-refresh{overflow:hidden;-webkit-user-select:none;user-select:none}.zt-pull-refresh__track{position:relative;height:100%;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.zt-pull-refresh__head{position:absolute;left:0;width:100%;height:50px;overflow:hidden;color:#969799;font-size:14px;line-height:50px;text-align:center;-webkit-transform:translateY(-100%);transform:translateY(-100%)}
@@ -0,0 +1,214 @@
1
+ // Utils
2
+ import { createNamespace } from '../utils';
3
+ import { preventDefault } from '../utils/dom/event';
4
+ import { getScrollTop, getScroller } from '../utils/dom/scroll'; // Mixins
5
+
6
+ import { TouchMixin } from '../mixins/touch'; // Components
7
+
8
+ import Loading from '../loading';
9
+
10
+ var _createNamespace = createNamespace('pull-refresh'),
11
+ createComponent = _createNamespace[0],
12
+ bem = _createNamespace[1],
13
+ t = _createNamespace[2];
14
+
15
+ var DEFAULT_HEAD_HEIGHT = 50;
16
+ var TEXT_STATUS = ['pulling', 'loosing', 'success'];
17
+ export default createComponent({
18
+ mixins: [TouchMixin],
19
+ props: {
20
+ disabled: Boolean,
21
+ successText: String,
22
+ pullingText: String,
23
+ loosingText: String,
24
+ loadingText: String,
25
+ pullDistance: [Number, String],
26
+ value: {
27
+ type: Boolean,
28
+ required: true
29
+ },
30
+ successDuration: {
31
+ type: [Number, String],
32
+ default: 500
33
+ },
34
+ animationDuration: {
35
+ type: [Number, String],
36
+ default: 300
37
+ },
38
+ headHeight: {
39
+ type: [Number, String],
40
+ default: DEFAULT_HEAD_HEIGHT
41
+ }
42
+ },
43
+ data: function data() {
44
+ return {
45
+ status: 'normal',
46
+ distance: 0,
47
+ duration: 0
48
+ };
49
+ },
50
+ computed: {
51
+ touchable: function touchable() {
52
+ return this.status !== 'loading' && this.status !== 'success' && !this.disabled;
53
+ },
54
+ headStyle: function headStyle() {
55
+ if (this.headHeight !== DEFAULT_HEAD_HEIGHT) {
56
+ return {
57
+ height: this.headHeight + "px"
58
+ };
59
+ }
60
+ }
61
+ },
62
+ watch: {
63
+ value: function value(loading) {
64
+ this.duration = this.animationDuration;
65
+
66
+ if (loading) {
67
+ this.setStatus(+this.headHeight, true);
68
+ } else if (this.slots('success') || this.successText) {
69
+ this.showSuccessTip();
70
+ } else {
71
+ this.setStatus(0, false);
72
+ }
73
+ }
74
+ },
75
+ mounted: function mounted() {
76
+ this.bindTouchEvent(this.$refs.track);
77
+ this.scrollEl = getScroller(this.$el);
78
+ },
79
+ methods: {
80
+ checkPullStart: function checkPullStart(event) {
81
+ this.ceiling = getScrollTop(this.scrollEl) === 0;
82
+
83
+ if (this.ceiling) {
84
+ this.duration = 0;
85
+ this.touchStart(event);
86
+ }
87
+ },
88
+ onTouchStart: function onTouchStart(event) {
89
+ if (this.touchable) {
90
+ this.checkPullStart(event);
91
+ }
92
+ },
93
+ onTouchMove: function onTouchMove(event) {
94
+ if (!this.touchable) {
95
+ return;
96
+ }
97
+
98
+ if (!this.ceiling) {
99
+ this.checkPullStart(event);
100
+ }
101
+
102
+ this.touchMove(event);
103
+
104
+ if (this.ceiling && this.deltaY >= 0 && this.direction === 'vertical') {
105
+ preventDefault(event);
106
+ this.setStatus(this.ease(this.deltaY));
107
+ }
108
+ },
109
+ onTouchEnd: function onTouchEnd() {
110
+ var _this = this;
111
+
112
+ if (this.touchable && this.ceiling && this.deltaY) {
113
+ this.duration = this.animationDuration;
114
+
115
+ if (this.status === 'loosing') {
116
+ this.setStatus(+this.headHeight, true);
117
+ this.$emit('input', true); // ensure value change can be watched
118
+
119
+ this.$nextTick(function () {
120
+ _this.$emit('refresh');
121
+ });
122
+ } else {
123
+ this.setStatus(0);
124
+ }
125
+ }
126
+ },
127
+ ease: function ease(distance) {
128
+ var pullDistance = +(this.pullDistance || this.headHeight);
129
+
130
+ if (distance > pullDistance) {
131
+ if (distance < pullDistance * 2) {
132
+ distance = pullDistance + (distance - pullDistance) / 2;
133
+ } else {
134
+ distance = pullDistance * 1.5 + (distance - pullDistance * 2) / 4;
135
+ }
136
+ }
137
+
138
+ return Math.round(distance);
139
+ },
140
+ setStatus: function setStatus(distance, isLoading) {
141
+ var status;
142
+
143
+ if (isLoading) {
144
+ status = 'loading';
145
+ } else if (distance === 0) {
146
+ status = 'normal';
147
+ } else {
148
+ status = distance < (this.pullDistance || this.headHeight) ? 'pulling' : 'loosing';
149
+ }
150
+
151
+ this.distance = distance;
152
+
153
+ if (status !== this.status) {
154
+ this.status = status;
155
+ }
156
+ },
157
+ genStatus: function genStatus() {
158
+ var h = this.$createElement;
159
+ var status = this.status,
160
+ distance = this.distance;
161
+ var slot = this.slots(status, {
162
+ distance: distance
163
+ });
164
+
165
+ if (slot) {
166
+ return slot;
167
+ }
168
+
169
+ var nodes = [];
170
+ var text = this[status + "Text"] || t(status);
171
+
172
+ if (TEXT_STATUS.indexOf(status) !== -1) {
173
+ nodes.push(h("div", {
174
+ "class": bem('text')
175
+ }, [text]));
176
+ }
177
+
178
+ if (status === 'loading') {
179
+ nodes.push(h(Loading, {
180
+ "attrs": {
181
+ "size": "16"
182
+ }
183
+ }, [text]));
184
+ }
185
+
186
+ return nodes;
187
+ },
188
+ showSuccessTip: function showSuccessTip() {
189
+ var _this2 = this;
190
+
191
+ this.status = 'success';
192
+ setTimeout(function () {
193
+ _this2.setStatus(0);
194
+ }, this.successDuration);
195
+ }
196
+ },
197
+ render: function render() {
198
+ var h = arguments[0];
199
+ var trackStyle = {
200
+ transitionDuration: this.duration + "ms",
201
+ transform: this.distance ? "translate3d(0," + this.distance + "px, 0)" : ''
202
+ };
203
+ return h("div", {
204
+ "class": bem()
205
+ }, [h("div", {
206
+ "ref": "track",
207
+ "class": bem('track'),
208
+ "style": trackStyle
209
+ }, [h("div", {
210
+ "class": bem('head'),
211
+ "style": this.headStyle
212
+ }, [this.genStatus()]), this.slots()])]);
213
+ }
214
+ });