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.
Files changed (304) hide show
  1. package/es/action-sheet/index.js +15 -26
  2. package/es/area/index.js +5 -41
  3. package/es/avatar/index.js +3 -16
  4. package/es/back-top/index.js +4 -19
  5. package/es/badge/index.js +4 -12
  6. package/es/button/index.js +20 -40
  7. package/es/calendar/components/Header.js +3 -12
  8. package/es/calendar/components/Month.js +12 -65
  9. package/es/calendar/index.js +23 -94
  10. package/es/calendar/types.js +0 -6
  11. package/es/calendar/utils.js +5 -16
  12. package/es/cascader/index.js +4 -37
  13. package/es/cell/index.js +19 -37
  14. package/es/cell-group/index.js +5 -8
  15. package/es/checkbox/index.js +4 -11
  16. package/es/checkbox-group/index.js +4 -9
  17. package/es/col/index.js +6 -11
  18. package/es/collapse/index.js +2 -5
  19. package/es/collapse-item/index.js +19 -35
  20. package/es/count-down/index.js +2 -15
  21. package/es/count-down/utils.js +3 -10
  22. package/es/datetime-picker/DatePicker.js +12 -70
  23. package/es/datetime-picker/TimePicker.js +10 -23
  24. package/es/datetime-picker/index.js +2 -4
  25. package/es/datetime-picker/shared.js +5 -19
  26. package/es/datetime-picker/utils.js +0 -5
  27. package/es/dialog/Dialog.js +6 -21
  28. package/es/dialog/index.js +0 -16
  29. package/es/divider/index.js +5 -6
  30. package/es/dropdown-item/index.js +22 -35
  31. package/es/dropdown-menu/index.js +4 -9
  32. package/es/empty/index.js +3 -11
  33. package/es/field/index.js +20 -83
  34. package/es/fold-dialog/index.js +5 -20
  35. package/es/form/index.js +2 -18
  36. package/es/grid/index.js +2 -6
  37. package/es/grid-item/index.js +17 -30
  38. package/es/hierarchy-select/breadcrumb.js +2 -6
  39. package/es/hierarchy-select/index.js +3 -12
  40. package/es/hierarchy-select/markList.js +2 -25
  41. package/es/hierarchy-select/svg/SubIcon.js +0 -1
  42. package/es/icon/index.js +9 -13
  43. package/es/image/index.js +2 -17
  44. package/es/image-preview/ImagePreview.js +4 -8
  45. package/es/image-preview/ImagePreviewItem.js +14 -30
  46. package/es/image-preview/index.js +0 -12
  47. package/es/image-preview/shared.js +2 -4
  48. package/es/index-anchor/index.js +2 -6
  49. package/es/index-bar/IndexIndicate.js +0 -1
  50. package/es/index-bar/index.js +7 -28
  51. package/es/index.js +1 -4
  52. package/es/info/index.js +6 -8
  53. package/es/list/index.js +11 -27
  54. package/es/loading/index.js +7 -15
  55. package/es/locale/index.js +0 -2
  56. package/es/media-picker/index.js +33 -117
  57. package/es/media-picker/media-util.js +2 -5
  58. package/es/media-picker/type.js +0 -5
  59. package/es/media-player/index.js +7 -17
  60. package/es/mixins/bind-event.js +0 -3
  61. package/es/mixins/checkbox.js +5 -11
  62. package/es/mixins/click-outside.js +0 -2
  63. package/es/mixins/close-on-popstate.js +0 -1
  64. package/es/mixins/field.js +0 -2
  65. package/es/mixins/popup/index.js +12 -28
  66. package/es/mixins/popup/overlay.js +1 -11
  67. package/es/mixins/portal.js +2 -8
  68. package/es/mixins/relation.js +0 -8
  69. package/es/mixins/slots.js +1 -4
  70. package/es/mixins/touch.js +4 -9
  71. package/es/multiple-picker/MultiplePickerOptions.js +2 -18
  72. package/es/multiple-picker/index.js +5 -17
  73. package/es/nav-bar/index.js +4 -12
  74. package/es/notice-bar/index.js +10 -28
  75. package/es/number-keyboard/Key.js +2 -10
  76. package/es/number-keyboard/index.js +4 -19
  77. package/es/overlay/index.js +5 -8
  78. package/es/password-input/index.js +10 -16
  79. package/es/picker/PickerColumn.js +20 -54
  80. package/es/picker/index.js +13 -42
  81. package/es/popover/index.js +11 -20
  82. package/es/popup/index.js +5 -21
  83. package/es/pull-refresh/index.js +15 -32
  84. package/es/radio/index.js +2 -4
  85. package/es/radio-group/index.js +2 -4
  86. package/es/rate/index.js +12 -26
  87. package/es/row/index.js +3 -9
  88. package/es/search/index.js +8 -13
  89. package/es/signature/bezier.js +5 -12
  90. package/es/signature/force-landscape.js +0 -5
  91. package/es/signature/index.js +5 -24
  92. package/es/signature/point.js +1 -6
  93. package/es/signature/throttle.js +1 -10
  94. package/es/skeleton/index.js +5 -15
  95. package/es/slider/index.js +19 -55
  96. package/es/step/index.js +5 -12
  97. package/es/stepper/index.js +10 -37
  98. package/es/steps/index.js +2 -4
  99. package/es/sticky/index.js +8 -50
  100. package/es/swipe/index.js +19 -62
  101. package/es/swipe-cell/index.js +7 -23
  102. package/es/swipe-item/index.js +9 -19
  103. package/es/switch/index.js +8 -10
  104. package/es/switch/shared.js +1 -0
  105. package/es/switch-cell/index.js +7 -7
  106. package/es/tab/index.js +4 -15
  107. package/es/tabbar/index.js +4 -14
  108. package/es/tabbar-item/index.js +7 -15
  109. package/es/table/index.js +10 -35
  110. package/es/tabs/Content.js +5 -9
  111. package/es/tabs/Title.js +11 -19
  112. package/es/tabs/index.js +16 -51
  113. package/es/tabs/utils.js +0 -8
  114. package/es/tag/index.js +13 -17
  115. package/es/timeline/index.js +2 -25
  116. package/es/toast/Toast.js +11 -23
  117. package/es/toast/index.js +6 -33
  118. package/es/toast/lock-click.js +0 -2
  119. package/es/uploader/index.js +11 -62
  120. package/es/uploader/utils.js +0 -10
  121. package/es/utils/constant.js +2 -1
  122. package/es/utils/create/bem.js +1 -5
  123. package/es/utils/create/component.js +4 -7
  124. package/es/utils/create/i18n.js +0 -2
  125. package/es/utils/deep-assign.js +0 -4
  126. package/es/utils/deep-clone.js +0 -3
  127. package/es/utils/dom/event.js +2 -5
  128. package/es/utils/dom/node.js +0 -1
  129. package/es/utils/dom/raf.js +7 -6
  130. package/es/utils/dom/reset-scroll.js +2 -1
  131. package/es/utils/dom/scroll.js +8 -17
  132. package/es/utils/dom/style.js +3 -2
  133. package/es/utils/easings.js +2 -4
  134. package/es/utils/format/date-util.js +54 -122
  135. package/es/utils/format/number.js +2 -11
  136. package/es/utils/format/string.js +0 -3
  137. package/es/utils/format/unit.js +2 -12
  138. package/es/utils/functional.js +6 -9
  139. package/es/utils/getScroll.js +0 -5
  140. package/es/utils/index.js +3 -5
  141. package/es/utils/interceptor.js +2 -4
  142. package/es/utils/media/image-util.js +7 -19
  143. package/es/utils/raf.js +4 -12
  144. package/es/utils/router.js +7 -6
  145. package/es/utils/scrollTo.js +7 -12
  146. package/es/utils/validate/number.js +2 -2
  147. package/es/utils/vnodes.js +2 -8
  148. package/lib/action-sheet/index.js +11 -35
  149. package/lib/area/index.js +5 -45
  150. package/lib/avatar/index.js +3 -18
  151. package/lib/back-top/index.js +4 -25
  152. package/lib/badge/index.js +4 -15
  153. package/lib/button/index.js +19 -50
  154. package/lib/calendar/components/Header.js +3 -18
  155. package/lib/calendar/components/Month.js +12 -71
  156. package/lib/calendar/index.js +21 -106
  157. package/lib/calendar/types.js +0 -7
  158. package/lib/calendar/utils.js +5 -32
  159. package/lib/cascader/index.js +4 -46
  160. package/lib/cell/index.js +18 -48
  161. package/lib/cell-group/index.js +5 -15
  162. package/lib/checkbox/index.js +4 -14
  163. package/lib/checkbox-group/index.js +4 -13
  164. package/lib/col/index.js +6 -14
  165. package/lib/collapse/index.js +2 -8
  166. package/lib/collapse-item/index.js +18 -43
  167. package/lib/count-down/index.js +2 -19
  168. package/lib/count-down/utils.js +3 -15
  169. package/lib/datetime-picker/DatePicker.js +12 -81
  170. package/lib/datetime-picker/TimePicker.js +10 -30
  171. package/lib/datetime-picker/index.js +2 -10
  172. package/lib/datetime-picker/shared.js +5 -27
  173. package/lib/datetime-picker/utils.js +0 -9
  174. package/lib/dialog/Dialog.js +6 -28
  175. package/lib/dialog/index.js +0 -22
  176. package/lib/divider/index.js +5 -12
  177. package/lib/dropdown-item/index.js +21 -44
  178. package/lib/dropdown-menu/index.js +4 -15
  179. package/lib/empty/index.js +3 -23
  180. package/lib/field/index.js +20 -96
  181. package/lib/fold-dialog/index.js +5 -22
  182. package/lib/form/index.js +2 -21
  183. package/lib/grid/index.js +2 -10
  184. package/lib/grid-item/index.js +16 -37
  185. package/lib/hierarchy-select/breadcrumb.js +3 -10
  186. package/lib/hierarchy-select/index.js +4 -20
  187. package/lib/hierarchy-select/markList.js +3 -31
  188. package/lib/hierarchy-select/svg/SubIcon.js +0 -1
  189. package/lib/icon/index.js +8 -19
  190. package/lib/image/index.js +2 -22
  191. package/lib/image-preview/ImagePreview.js +0 -16
  192. package/lib/image-preview/ImagePreviewItem.js +13 -36
  193. package/lib/image-preview/index.js +0 -16
  194. package/lib/image-preview/shared.js +2 -5
  195. package/lib/index-anchor/index.js +2 -11
  196. package/lib/index-bar/IndexIndicate.js +0 -1
  197. package/lib/index-bar/index.js +7 -37
  198. package/lib/index.js +1 -157
  199. package/lib/info/index.js +6 -14
  200. package/lib/lazyload/index.js +0 -3
  201. package/lib/list/index.js +10 -33
  202. package/lib/loading/index.js +7 -21
  203. package/lib/locale/index.js +0 -7
  204. package/lib/media-picker/index.js +27 -153
  205. package/lib/media-picker/media-util.js +2 -15
  206. package/lib/media-picker/type.js +0 -5
  207. package/lib/media-player/index.js +6 -22
  208. package/lib/mixins/bind-event.js +1 -6
  209. package/lib/mixins/checkbox.js +6 -18
  210. package/lib/mixins/click-outside.js +1 -5
  211. package/lib/mixins/close-on-popstate.js +0 -4
  212. package/lib/mixins/field.js +0 -2
  213. package/lib/mixins/popup/index.js +11 -36
  214. package/lib/mixins/popup/overlay.js +1 -23
  215. package/lib/mixins/portal.js +2 -9
  216. package/lib/mixins/relation.js +0 -11
  217. package/lib/mixins/slots.js +1 -5
  218. package/lib/mixins/touch.js +4 -11
  219. package/lib/multiple-picker/MultiplePickerOptions.js +2 -23
  220. package/lib/multiple-picker/index.js +5 -26
  221. package/lib/nav-bar/index.js +4 -16
  222. package/lib/notice-bar/index.js +10 -40
  223. package/lib/number-keyboard/Key.js +2 -17
  224. package/lib/number-keyboard/index.js +4 -26
  225. package/lib/overlay/index.js +5 -16
  226. package/lib/password-input/index.js +10 -23
  227. package/lib/picker/PickerColumn.js +19 -63
  228. package/lib/picker/index.js +13 -53
  229. package/lib/popover/index.js +9 -27
  230. package/lib/popup/index.js +5 -27
  231. package/lib/pull-refresh/index.js +14 -38
  232. package/lib/radio/index.js +2 -7
  233. package/lib/radio-group/index.js +2 -8
  234. package/lib/rate/index.js +11 -31
  235. package/lib/row/index.js +3 -12
  236. package/lib/search/index.js +7 -21
  237. package/lib/signature/bezier.js +5 -15
  238. package/lib/signature/force-landscape.js +0 -11
  239. package/lib/signature/index.js +6 -31
  240. package/lib/signature/point.js +0 -8
  241. package/lib/signature/throttle.js +1 -11
  242. package/lib/skeleton/index.js +5 -21
  243. package/lib/slider/index.js +19 -63
  244. package/lib/step/index.js +5 -18
  245. package/lib/stepper/index.js +10 -46
  246. package/lib/steps/index.js +2 -7
  247. package/lib/sticky/index.js +8 -59
  248. package/lib/swipe/index.js +19 -70
  249. package/lib/swipe-cell/index.js +7 -29
  250. package/lib/swipe-item/index.js +9 -24
  251. package/lib/switch/index.js +7 -14
  252. package/lib/switch/shared.js +1 -1
  253. package/lib/switch-cell/index.js +6 -16
  254. package/lib/tab/index.js +4 -21
  255. package/lib/tabbar/index.js +4 -19
  256. package/lib/tabbar-item/index.js +5 -21
  257. package/lib/table/index.js +10 -38
  258. package/lib/tabs/Content.js +5 -15
  259. package/lib/tabs/Title.js +11 -23
  260. package/lib/tabs/index.js +15 -65
  261. package/lib/tabs/utils.js +0 -13
  262. package/lib/tag/index.js +12 -23
  263. package/lib/timeline/index.js +2 -32
  264. package/lib/toast/Toast.js +10 -30
  265. package/lib/toast/index.js +6 -38
  266. package/lib/toast/lock-click.js +0 -3
  267. package/lib/uploader/index.js +10 -72
  268. package/lib/uploader/utils.js +0 -17
  269. package/lib/utils/constant.js +2 -1
  270. package/lib/utils/create/bem.js +1 -6
  271. package/lib/utils/create/component.js +5 -14
  272. package/lib/utils/create/i18n.js +0 -8
  273. package/lib/utils/create/index.js +0 -4
  274. package/lib/utils/deep-assign.js +0 -6
  275. package/lib/utils/deep-clone.js +0 -5
  276. package/lib/utils/device.js +0 -2
  277. package/lib/utils/dom/event.js +2 -10
  278. package/lib/utils/dom/node.js +0 -2
  279. package/lib/utils/dom/raf.js +7 -11
  280. package/lib/utils/dom/reset-scroll.js +2 -4
  281. package/lib/utils/dom/scroll.js +8 -28
  282. package/lib/utils/dom/style.js +3 -3
  283. package/lib/utils/easings.js +2 -5
  284. package/lib/utils/format/date-util.js +54 -168
  285. package/lib/utils/format/number.js +2 -13
  286. package/lib/utils/format/string.js +0 -5
  287. package/lib/utils/format/unit.js +2 -16
  288. package/lib/utils/functional.js +6 -14
  289. package/lib/utils/getScroll.js +0 -7
  290. package/lib/utils/index.js +3 -19
  291. package/lib/utils/interceptor.js +2 -6
  292. package/lib/utils/media/image-util.js +7 -25
  293. package/lib/utils/raf.js +4 -13
  294. package/lib/utils/router.js +7 -9
  295. package/lib/utils/scrollTo.js +9 -21
  296. package/lib/utils/validate/date.js +0 -2
  297. package/lib/utils/validate/email.js +0 -1
  298. package/lib/utils/validate/mobile.js +0 -1
  299. package/lib/utils/validate/number.js +2 -4
  300. package/lib/utils/validate/system.js +0 -3
  301. package/lib/utils/vnodes.js +2 -9
  302. package/lib/zart.js +57 -18
  303. package/lib/zart.min.js +1 -1
  304. package/package.json +17 -18
@@ -1,47 +1,39 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  // Slightly simplified version of http://stackoverflow.com/a/27078401/815507
3
+
3
4
  export function throttle(fn, wait) {
4
5
  if (wait === void 0) {
5
6
  wait = 250;
6
7
  }
7
-
8
8
  var previous = 0;
9
9
  var timeout = null;
10
10
  var result;
11
11
  var storedContext;
12
12
  var storedArgs;
13
-
14
13
  var later = function later() {
15
14
  previous = Date.now();
16
15
  timeout = null;
17
16
  result = fn.apply(storedContext, storedArgs);
18
-
19
17
  if (!timeout) {
20
18
  storedContext = null;
21
19
  storedArgs = [];
22
20
  }
23
21
  };
24
-
25
22
  return function wrapper() {
26
23
  var now = Date.now();
27
24
  var remaining = wait - (now - previous);
28
25
  storedContext = this;
29
-
30
26
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
31
27
  args[_key] = arguments[_key];
32
28
  }
33
-
34
29
  storedArgs = args;
35
-
36
30
  if (remaining <= 0 || remaining > wait) {
37
31
  if (timeout) {
38
32
  clearTimeout(timeout);
39
33
  timeout = null;
40
34
  }
41
-
42
35
  previous = now;
43
36
  result = fn.apply(storedContext, storedArgs);
44
-
45
37
  if (!timeout) {
46
38
  storedContext = null;
47
39
  storedArgs = [];
@@ -49,7 +41,6 @@ export function throttle(fn, wait) {
49
41
  } else if (!timeout) {
50
42
  timeout = window.setTimeout(later, remaining);
51
43
  }
52
-
53
44
  return result;
54
45
  };
55
46
  }
@@ -1,20 +1,19 @@
1
1
  import _mergeJSXProps from "@vue/babel-helper-vue-jsx-merge-props";
2
2
  // Utils
3
3
  import { createNamespace, addUnit } from '../utils';
4
- import { inherit } from '../utils/functional'; // Types
4
+ import { inherit } from '../utils/functional';
5
5
 
6
- var _createNamespace = createNamespace('skeleton'),
7
- createComponent = _createNamespace[0],
8
- bem = _createNamespace[1];
6
+ // Types
9
7
 
8
+ var _createNamespace = createNamespace('skeleton'),
9
+ createComponent = _createNamespace[0],
10
+ bem = _createNamespace[1];
10
11
  var DEFAULT_ROW_WIDTH = '100%';
11
12
  var DEFAULT_LAST_ROW_WIDTH = '60%';
12
-
13
13
  function Skeleton(h, props, slots, ctx) {
14
14
  if (!props.loading) {
15
15
  return slots.default && slots.default();
16
16
  }
17
-
18
17
  function Title() {
19
18
  if (props.title && !props.field) {
20
19
  return h("h3", {
@@ -25,23 +24,18 @@ function Skeleton(h, props, slots, ctx) {
25
24
  });
26
25
  }
27
26
  }
28
-
29
27
  function Rows() {
30
28
  var Rows = [];
31
29
  var rowWidth = props.rowWidth;
32
-
33
30
  function getRowWidth(index) {
34
31
  if (rowWidth === DEFAULT_ROW_WIDTH && index === +props.row - 1) {
35
32
  return DEFAULT_LAST_ROW_WIDTH;
36
33
  }
37
-
38
34
  if (Array.isArray(rowWidth)) {
39
35
  return rowWidth[index];
40
36
  }
41
-
42
37
  return rowWidth;
43
38
  }
44
-
45
39
  for (var i = 0; i < props.row; i++) {
46
40
  if (props.field) {
47
41
  Rows.push(h("div", {
@@ -73,10 +67,8 @@ function Skeleton(h, props, slots, ctx) {
73
67
  }));
74
68
  }
75
69
  }
76
-
77
70
  return Rows;
78
71
  }
79
-
80
72
  function Avatar() {
81
73
  if (props.avatar) {
82
74
  var size = addUnit(props.avatarSize);
@@ -89,7 +81,6 @@ function Skeleton(h, props, slots, ctx) {
89
81
  });
90
82
  }
91
83
  }
92
-
93
84
  return h("div", _mergeJSXProps([{
94
85
  "class": bem({
95
86
  animate: props.animate,
@@ -99,7 +90,6 @@ function Skeleton(h, props, slots, ctx) {
99
90
  "class": bem('content')
100
91
  }, [Title(), Rows()])]);
101
92
  }
102
-
103
93
  Skeleton.props = {
104
94
  title: Boolean,
105
95
  round: Boolean,
@@ -5,15 +5,12 @@ import { range, addNumber } from '../utils/format/number';
5
5
  import { isNumeric } from '../utils/validate/number';
6
6
  import { TouchMixin } from '../mixins/touch';
7
7
  import { FieldMixin } from '../mixins/field';
8
-
9
8
  var _createNamespace = createNamespace('slider'),
10
- createComponent = _createNamespace[0],
11
- bem = _createNamespace[1];
12
-
9
+ createComponent = _createNamespace[0],
10
+ bem = _createNamespace[1];
13
11
  var isSameValue = function isSameValue(newValue, oldValue) {
14
12
  return JSON.stringify(newValue) === JSON.stringify(oldValue);
15
13
  };
16
-
17
14
  export default createComponent({
18
15
  mixins: [TouchMixin, FieldMixin],
19
16
  props: {
@@ -88,27 +85,22 @@ export default createComponent({
88
85
  if (this.disabled) {
89
86
  return;
90
87
  }
91
-
92
88
  this.touchStart(event);
93
89
  this.currentValue = this.value;
94
-
95
90
  if (this.range) {
96
91
  this.startValue = this.value.map(this.format);
97
92
  } else {
98
93
  this.startValue = this.format(this.value);
99
94
  }
100
-
101
95
  this.dragStatus = 'start';
102
96
  },
103
97
  onTouchMove: function onTouchMove(event) {
104
98
  if (this.disabled) {
105
99
  return;
106
100
  }
107
-
108
101
  if (this.dragStatus === 'start') {
109
102
  this.$emit('drag-start');
110
103
  }
111
-
112
104
  preventDefault(event, true);
113
105
  this.touchMove(event);
114
106
  this.dragStatus = 'draging';
@@ -116,54 +108,45 @@ export default createComponent({
116
108
  var delta = this.vertical ? this.deltaY : this.deltaX;
117
109
  var total = this.vertical ? rect.height : rect.width;
118
110
  var diff = delta / total * this.scope;
119
-
120
111
  if (this.range) {
121
112
  this.currentValue[this.index] = this.startValue[this.index] + diff;
122
113
  } else {
123
114
  this.currentValue = this.startValue + diff;
124
115
  }
125
-
126
116
  this.updateValue(this.currentValue);
127
117
  },
128
118
  onTouchEnd: function onTouchEnd() {
129
119
  if (this.disabled) {
130
120
  return;
131
121
  }
132
-
133
122
  if (this.dragStatus === 'draging') {
134
123
  this.updateValue(this.currentValue, true);
135
124
  this.$emit('drag-end');
136
125
  }
137
-
138
126
  this.dragStatus = '';
139
127
  },
140
128
  onClick: function onClick(event) {
141
129
  if (this.progress) {
142
130
  return;
143
131
  }
144
-
145
132
  event.stopPropagation();
146
133
  if (this.disabled) return;
147
134
  var rect = this.$el.getBoundingClientRect();
148
135
  var delta = this.vertical ? event.clientY - rect.top : event.clientX - rect.left;
149
136
  var total = this.vertical ? rect.height : rect.width;
150
137
  var value = +this.min + delta / total * this.scope;
151
-
152
138
  if (this.range) {
153
139
  var _this$value = this.value,
154
- left = _this$value[0],
155
- right = _this$value[1];
140
+ left = _this$value[0],
141
+ right = _this$value[1];
156
142
  var middle = (left + right) / 2;
157
-
158
143
  if (value <= middle) {
159
144
  left = value;
160
145
  } else {
161
146
  right = value;
162
147
  }
163
-
164
148
  value = [left, right];
165
149
  }
166
-
167
150
  this.startValue = this.value;
168
151
  this.updateValue(value, true);
169
152
  },
@@ -173,7 +156,6 @@ export default createComponent({
173
156
  value = deepClone(value);
174
157
  return value.reverse();
175
158
  }
176
-
177
159
  return value;
178
160
  },
179
161
  updateValue: function updateValue(value, end) {
@@ -182,11 +164,9 @@ export default createComponent({
182
164
  } else {
183
165
  value = this.format(value);
184
166
  }
185
-
186
167
  if (!isSameValue(value, this.value)) {
187
168
  this.$emit('input', value);
188
169
  }
189
-
190
170
  if (end && !isSameValue(value, this.startValue)) {
191
171
  this.$emit('change', value);
192
172
  }
@@ -202,77 +182,64 @@ export default createComponent({
202
182
  },
203
183
  render: function render() {
204
184
  var _wrapperStyle,
205
- _this = this,
206
- _barStyle;
207
-
185
+ _this = this,
186
+ _barStyle;
208
187
  var h = arguments[0];
209
188
  var vertical = this.vertical,
210
- buttonSize = this.buttonSize;
189
+ buttonSize = this.buttonSize;
211
190
  var mainAxis = vertical ? 'height' : 'width';
212
191
  var crossAxis = vertical ? 'width' : 'height';
213
192
  var margin = isNumeric(buttonSize) && buttonSize > 0 ? buttonSize / 2 : 24;
214
193
  var wrapperStyle = (_wrapperStyle = {
215
194
  background: this.inactiveColor
216
- }, _wrapperStyle[crossAxis] = addUnit(this.barHeight) ? addUnit(this.barHeight) : this.progress ? '8px' : '4px', _wrapperStyle.margin = "0 " + margin + "px", _wrapperStyle); // 计算选中条的长度百分比
195
+ }, _wrapperStyle[crossAxis] = addUnit(this.barHeight) ? addUnit(this.barHeight) : this.progress ? '8px' : '4px', _wrapperStyle.margin = "0 " + margin + "px", _wrapperStyle);
217
196
 
197
+ // 计算选中条的长度百分比
218
198
  var calcMainAxis = function calcMainAxis() {
219
199
  var value = _this.value,
220
- min = _this.min,
221
- range = _this.range,
222
- scope = _this.scope;
223
-
200
+ min = _this.min,
201
+ range = _this.range,
202
+ scope = _this.scope;
224
203
  if (range) {
225
204
  return (value[1] - value[0]) * 100 / scope + "%";
226
- } // return `calc(${((value - min) * 100) / scope}% + 12px - ${24 * (value - min) / scope}px)` ;
227
-
228
-
205
+ }
206
+ // return `calc(${((value - min) * 100) / scope}% + 12px - ${24 * (value - min) / scope}px)` ;
229
207
  return (value - min) * 100 / scope + "%";
230
- }; // 计算选中条的开始位置的偏移量
231
-
208
+ };
232
209
 
210
+ // 计算选中条的开始位置的偏移量
233
211
  var calcOffset = function calcOffset() {
234
212
  var value = _this.value,
235
- min = _this.min,
236
- range = _this.range,
237
- scope = _this.scope;
238
-
213
+ min = _this.min,
214
+ range = _this.range,
215
+ scope = _this.scope;
239
216
  if (range) {
240
217
  return (value[0] - min) * 100 / scope + "%";
241
218
  }
242
-
243
219
  return null;
244
220
  };
245
-
246
221
  var barStyle = (_barStyle = {}, _barStyle[mainAxis] = calcMainAxis(), _barStyle.left = this.vertical ? null : calcOffset(), _barStyle.top = this.vertical ? calcOffset() : null, _barStyle.background = Array.isArray(this.activeColor) ? "-webkit-linear-gradient(90deg, " + this.activeColor[0] + " , " + this.activeColor[1] + " )" : this.activeColor, _barStyle["background"] = Array.isArray(this.activeColor) ? "-o-linear-linear-gradient(90deg, " + this.activeColor[0] + " , " + this.activeColor[1] + ")" : this.activeColor, _barStyle["background"] = Array.isArray(this.activeColor) ? "-moz-linear-gradient(90deg, " + this.activeColor[0] + " , " + this.activeColor[1] + ")" : this.activeColor, _barStyle["background"] = Array.isArray(this.activeColor) ? "linear-gradient(90deg, " + this.activeColor[0] + " , " + this.activeColor[1] + ")" : this.activeColor, _barStyle);
247
-
248
222
  if (this.dragStatus) {
249
223
  barStyle.transition = 'none';
250
224
  }
251
-
252
225
  var renderButton = function renderButton(i) {
253
226
  if (_this.progress) {
254
227
  return;
255
228
  }
256
-
257
229
  var map = ['left', 'right'];
258
230
  var isNumber = typeof i === 'number';
259
-
260
231
  var getClassName = function getClassName() {
261
232
  if (isNumber) {
262
233
  return "button-wrapper-" + map[i];
263
234
  }
264
-
265
235
  return "button-wrapper";
266
236
  };
267
-
268
237
  var getRefName = function getRefName() {
269
238
  if (isNumber) {
270
239
  return "wrapper" + i;
271
240
  }
272
-
273
241
  return "wrapper";
274
242
  };
275
-
276
243
  return h("div", {
277
244
  "ref": getRefName(),
278
245
  "attrs": {
@@ -300,7 +267,6 @@ export default createComponent({
300
267
  "style": _this.buttonStyle
301
268
  })]);
302
269
  };
303
-
304
270
  var renderProgress = function renderProgress() {
305
271
  if (_this.slots('right')) {
306
272
  return h("div", {
@@ -314,7 +280,6 @@ export default createComponent({
314
280
  return;
315
281
  }
316
282
  };
317
-
318
283
  var renderTitle = function renderTitle() {
319
284
  if (_this.slots('left')) {
320
285
  return h("div", {
@@ -328,7 +293,6 @@ export default createComponent({
328
293
  return '';
329
294
  }
330
295
  };
331
-
332
296
  return h("div", {
333
297
  "class": bem('container')
334
298
  }, [renderTitle(), h("div", {
package/es/step/index.js CHANGED
@@ -2,11 +2,9 @@ import { createNamespace } from '../utils';
2
2
  import { BORDER } from '../utils/constant';
3
3
  import { ChildrenMixin } from '../mixins/relation';
4
4
  import Icon from '../icon';
5
-
6
5
  var _createNamespace = createNamespace('step'),
7
- createComponent = _createNamespace[0],
8
- bem = _createNamespace[1];
9
-
6
+ createComponent = _createNamespace[0],
7
+ bem = _createNamespace[1];
10
8
  export default createComponent({
11
9
  mixins: [ChildrenMixin('ztSteps')],
12
10
  props: {
@@ -49,10 +47,9 @@ export default createComponent({
49
47
  genCircle: function genCircle() {
50
48
  var h = this.$createElement;
51
49
  var _this$parent = this.parent,
52
- activeColor = _this$parent.activeColor,
53
- inactiveColor = _this$parent.inactiveColor;
50
+ activeColor = _this$parent.activeColor,
51
+ inactiveColor = _this$parent.inactiveColor;
54
52
  var activeIconSlot = this.slots('active-icon');
55
-
56
53
  if (this.active && (this.activeIcon || activeIconSlot)) {
57
54
  return h("div", {
58
55
  "class": bem('circle'),
@@ -66,9 +63,7 @@ export default createComponent({
66
63
  }
67
64
  })]);
68
65
  }
69
-
70
66
  var inactiveIconSlot = this.slots('inactive-icon');
71
-
72
67
  if (this.inactiveIcon || inactiveIconSlot) {
73
68
  return h("div", {
74
69
  "class": bem('circle'),
@@ -82,7 +77,6 @@ export default createComponent({
82
77
  }
83
78
  })]);
84
79
  }
85
-
86
80
  return h("div", {
87
81
  "class": bem('circle'),
88
82
  "style": this.circleStyle
@@ -94,10 +88,9 @@ export default createComponent({
94
88
  },
95
89
  render: function render() {
96
90
  var _ref;
97
-
98
91
  var h = arguments[0];
99
92
  var status = this.status,
100
- active = this.active;
93
+ active = this.active;
101
94
  var direction = this.parent.direction;
102
95
  return h("div", {
103
96
  "class": [BORDER, bem([direction, (_ref = {}, _ref[status] = status, _ref)])]
@@ -6,18 +6,14 @@ import { preventDefault } from '../utils/dom/event';
6
6
  import { addNumber, formatNumber as _formatNumber } from '../utils/format/number';
7
7
  import { isNaN } from '../utils/validate/number';
8
8
  import { FieldMixin } from '../mixins/field';
9
-
10
9
  var _createNamespace = createNamespace('stepper'),
11
- createComponent = _createNamespace[0],
12
- bem = _createNamespace[1];
13
-
10
+ createComponent = _createNamespace[0],
11
+ bem = _createNamespace[1];
14
12
  var LONG_PRESS_START_TIME = 600;
15
13
  var LONG_PRESS_INTERVAL = 200;
16
-
17
14
  function equal(value1, value2) {
18
15
  return String(value1) === String(value2);
19
16
  }
20
-
21
17
  export default createComponent({
22
18
  mixins: [FieldMixin],
23
19
  props: {
@@ -73,14 +69,11 @@ export default createComponent({
73
69
  },
74
70
  data: function data() {
75
71
  var _this$value;
76
-
77
72
  var defaultValue = (_this$value = this.value) != null ? _this$value : this.defaultValue;
78
73
  var value = this.format(defaultValue);
79
-
80
74
  if (!equal(value, this.value)) {
81
75
  this.$emit('input', value);
82
76
  }
83
-
84
77
  return {
85
78
  currentValue: value
86
79
  };
@@ -94,15 +87,12 @@ export default createComponent({
94
87
  },
95
88
  inputStyle: function inputStyle() {
96
89
  var style = {};
97
-
98
90
  if (this.inputWidth) {
99
91
  style.width = addUnit(this.inputWidth);
100
92
  }
101
-
102
93
  if (this.buttonSize) {
103
94
  style.height = addUnit(this.buttonSize);
104
95
  }
105
-
106
96
  return style;
107
97
  },
108
98
  buttonStyle: function buttonStyle() {
@@ -135,7 +125,6 @@ export default createComponent({
135
125
  methods: {
136
126
  check: function check() {
137
127
  var val = this.format(this.currentValue);
138
-
139
128
  if (!equal(val, this.currentValue)) {
140
129
  this.currentValue = val;
141
130
  }
@@ -148,37 +137,36 @@ export default createComponent({
148
137
  if (this.allowEmpty && value === '') {
149
138
  return value;
150
139
  }
140
+ value = this.formatNumber(value);
151
141
 
152
- value = this.formatNumber(value); // format range
153
-
142
+ // format range
154
143
  value = value === '' ? 0 : +value;
155
144
  value = isNaN(value) ? this.min : value;
156
- value = Math.max(Math.min(this.max, value), this.min); // format decimal
145
+ value = Math.max(Math.min(this.max, value), this.min);
157
146
 
147
+ // format decimal
158
148
  if (isDef(this.decimalLength)) {
159
149
  value = value.toFixed(this.decimalLength);
160
150
  }
161
-
162
151
  return value;
163
152
  },
164
153
  onInput: function onInput(event) {
165
154
  var value = event.target.value;
166
- var formatted = this.formatNumber(value); // limit max decimal length
155
+ var formatted = this.formatNumber(value);
167
156
 
157
+ // limit max decimal length
168
158
  if (isDef(this.decimalLength) && formatted.indexOf('.') !== -1) {
169
159
  var pair = formatted.split('.');
170
160
  formatted = pair[0] + "." + pair[1].slice(0, this.decimalLength);
171
161
  }
172
-
173
162
  if (!equal(value, formatted)) {
174
163
  event.target.value = formatted;
175
- } // prefer number type
176
-
164
+ }
177
165
 
166
+ // prefer number type
178
167
  if (formatted === String(+formatted)) {
179
168
  formatted = +formatted;
180
169
  }
181
-
182
170
  this.emitChange(formatted);
183
171
  },
184
172
  emitChange: function emitChange(value) {
@@ -193,12 +181,10 @@ export default createComponent({
193
181
  },
194
182
  onChange: function onChange() {
195
183
  var type = this.type;
196
-
197
184
  if (this[type + "Disabled"]) {
198
185
  this.$emit('overlimit', type);
199
186
  return;
200
187
  }
201
-
202
188
  var diff = type === 'minus' ? -this.step : +this.step;
203
189
  var value = this.format(addNumber(+this.currentValue, diff));
204
190
  this.emitChange(value);
@@ -221,27 +207,21 @@ export default createComponent({
221
207
  },
222
208
  longPressStep: function longPressStep() {
223
209
  var _this = this;
224
-
225
210
  this.longPressTimer = setTimeout(function () {
226
211
  _this.onChange();
227
-
228
212
  _this.longPressStep(_this.type);
229
213
  }, LONG_PRESS_INTERVAL);
230
214
  },
231
215
  onTouchStart: function onTouchStart() {
232
216
  var _this2 = this;
233
-
234
217
  if (!this.longPress) {
235
218
  return;
236
219
  }
237
-
238
220
  clearTimeout(this.longPressTimer);
239
221
  this.isLongPress = false;
240
222
  this.longPressTimer = setTimeout(function () {
241
223
  _this2.isLongPress = true;
242
-
243
224
  _this2.onChange();
244
-
245
225
  _this2.longPressStep();
246
226
  }, LONG_PRESS_START_TIME);
247
227
  },
@@ -249,9 +229,7 @@ export default createComponent({
249
229
  if (!this.longPress) {
250
230
  return;
251
231
  }
252
-
253
232
  clearTimeout(this.longPressTimer);
254
-
255
233
  if (this.isLongPress) {
256
234
  preventDefault(event);
257
235
  }
@@ -266,9 +244,7 @@ export default createComponent({
266
244
  },
267
245
  render: function render() {
268
246
  var _this3 = this;
269
-
270
247
  var h = arguments[0];
271
-
272
248
  var createListeners = function createListeners(type) {
273
249
  return {
274
250
  on: {
@@ -276,12 +252,10 @@ export default createComponent({
276
252
  // disable double tap scrolling on mobile safari
277
253
  e.preventDefault();
278
254
  _this3.type = type;
279
-
280
255
  _this3.onChange();
281
256
  },
282
257
  touchstart: function touchstart() {
283
258
  _this3.type = type;
284
-
285
259
  _this3.onTouchStart();
286
260
  },
287
261
  touchend: _this3.onTouchEnd,
@@ -289,7 +263,6 @@ export default createComponent({
289
263
  }
290
264
  };
291
265
  };
292
-
293
266
  return h("div", {
294
267
  "class": bem([this.theme])
295
268
  }, [h("button", _mergeJSXProps([{
package/es/steps/index.js CHANGED
@@ -1,10 +1,8 @@
1
1
  import { createNamespace } from '../utils';
2
2
  import { ParentMixin } from '../mixins/relation';
3
-
4
3
  var _createNamespace = createNamespace('steps'),
5
- createComponent = _createNamespace[0],
6
- bem = _createNamespace[1];
7
-
4
+ createComponent = _createNamespace[0],
5
+ bem = _createNamespace[1];
8
6
  export default createComponent({
9
7
  mixins: [ParentMixin('ztSteps')],
10
8
  props: {