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
@@ -11,64 +11,51 @@ exports.isPptType = isPptType;
11
11
  exports.isExcelType = isExcelType;
12
12
  exports.getFileUniqueCode = getFileUniqueCode;
13
13
  exports.getUniqueFileName = getUniqueFileName;
14
-
15
14
  function isImageType(file) {
16
15
  return file.type.indexOf('image/') >= 0;
17
16
  }
18
-
19
17
  function isAudioType(file) {
20
18
  return file.type.indexOf('audio/') >= 0;
21
19
  }
22
-
23
20
  function isVideoType(file) {
24
21
  return file.type.indexOf('video/') >= 0;
25
22
  }
26
-
27
23
  function isPdfType(file) {
28
24
  return file.type.indexOf('/pdf') >= 0;
29
25
  }
30
-
31
26
  function isDocType(file) {
32
27
  return file.type.indexOf('.document') >= 0;
33
28
  }
34
-
35
29
  function isTextType(file) {
36
30
  return file.type.indexOf('text/') >= 0;
37
31
  }
38
-
39
32
  function isPptType(file) {
40
33
  return file.type.indexOf('.presentation') >= 0;
41
34
  }
42
-
43
35
  function isExcelType(file) {
44
36
  return file.type.indexOf('.sheet') >= 0;
45
37
  }
38
+
46
39
  /**
47
40
  * 文件唯一标识
48
41
  */
49
-
50
-
51
42
  function getFileUniqueCode(file) {
52
43
  return file.name + "_" + file.type + "_" + file.size + "_" + file.lastModified;
53
44
  }
45
+
54
46
  /**
55
47
  * 生成不重复的文件名
56
48
  * @param {File} file 原始文件
57
49
  * @param {string} suffix 指定文件名后缀
58
50
  */
59
-
60
-
61
51
  function getUniqueFileName(file, suffix) {
62
52
  if (suffix === void 0) {
63
53
  suffix = '';
64
54
  }
65
-
66
55
  var dotIndex = file.name.lastIndexOf('.');
67
-
68
56
  if (dotIndex > 0) {
69
57
  suffix = file.name.substring(dotIndex + 1);
70
58
  }
71
-
72
59
  var now = new Date();
73
60
  var name = "" + now.getFullYear() + now.getMonth() + now.getDay() + now.getHours() + now.getMinutes() + now.getSeconds() + now.getMilliseconds() + "_" + Math.ceil(Math.random() * 10000);
74
61
  return suffix ? name + '.' + suffix : name;
@@ -4,16 +4,13 @@ exports.__esModule = true;
4
4
  exports.MediaAddType = exports.MediaType = exports.MediaUploadStatus = void 0;
5
5
  var MediaUploadStatus;
6
6
  exports.MediaUploadStatus = MediaUploadStatus;
7
-
8
7
  (function (MediaUploadStatus) {
9
8
  MediaUploadStatus["UPLOADING"] = "uploading";
10
9
  MediaUploadStatus["DONE"] = "done";
11
10
  MediaUploadStatus["FAILED"] = "failed";
12
11
  })(MediaUploadStatus || (exports.MediaUploadStatus = MediaUploadStatus = {}));
13
-
14
12
  var MediaType;
15
13
  exports.MediaType = MediaType;
16
-
17
14
  (function (MediaType) {
18
15
  MediaType["PHOTO"] = "photo";
19
16
  MediaType["AUDIO"] = "audio";
@@ -25,10 +22,8 @@ exports.MediaType = MediaType;
25
22
  MediaType["PPT"] = "ppt";
26
23
  MediaType["EXCEL"] = "excel";
27
24
  })(MediaType || (exports.MediaType = MediaType = {}));
28
-
29
25
  var MediaAddType;
30
26
  exports.MediaAddType = MediaAddType;
31
-
32
27
  (function (MediaAddType) {
33
28
  MediaAddType["TAKE"] = "take";
34
29
  MediaAddType["PICK"] = "pick";
@@ -1,25 +1,18 @@
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 _utils = require("../utils");
9
-
10
7
  var _type = require("../media-picker/type");
11
-
12
8
  var _popup = _interopRequireDefault(require("../popup"));
13
-
14
9
  var _button = _interopRequireDefault(require("../button"));
15
-
16
10
  var _device = require("../utils/device");
17
-
18
11
  // import Toast from '../toast';
19
- var _createNamespace = (0, _utils.createNamespace)('media-player'),
20
- createComponent = _createNamespace[0],
21
- bem = _createNamespace[1];
22
12
 
13
+ var _createNamespace = (0, _utils.createNamespace)('media-player'),
14
+ createComponent = _createNamespace[0],
15
+ bem = _createNamespace[1];
23
16
  var _default = createComponent({
24
17
  props: {
25
18
  value: {
@@ -49,7 +42,6 @@ var _default = createComponent({
49
42
  methods: {
50
43
  getMediaElement: function getMediaElement() {
51
44
  var player;
52
-
53
45
  if (this.mediaType === _type.MediaType.AUDIO) {
54
46
  // player = document.getElementById("audio")
55
47
  player = this.$refs.audio;
@@ -57,25 +49,22 @@ var _default = createComponent({
57
49
  // player = document.getElementById("video")
58
50
  player = this.$refs.video;
59
51
  }
60
-
61
52
  return player;
62
53
  },
63
54
  onOpen: function onOpen() {
64
55
  var _this = this;
65
-
66
56
  this.$nextTick(function () {
67
57
  var player = _this.getMediaElement();
68
-
69
58
  if (!player) {
70
59
  return;
71
- } // player.addEventListener('error', (event) => {
60
+ }
61
+ // player.addEventListener('error', (event) => {
72
62
  // console.log(event)
73
63
  // Toast.fail('播放失败')
74
64
  // this.onClose()
75
65
  // }, true)
76
- //iOS中无法自动播放,必须有点击事件触发。但是微信中有办法实现
77
-
78
66
 
67
+ //iOS中无法自动播放,必须有点击事件触发。但是微信中有办法实现
79
68
  if ((0, _device.isWeixin)()) {
80
69
  if (typeof WeixinJSBridge == "object" && typeof WeixinJSBridge.invoke == "function") {
81
70
  WeixinJSBridge.invoke('getNetworkType', {}, function (res) {
@@ -90,21 +79,17 @@ var _default = createComponent({
90
79
  onClose: function onClose() {
91
80
  this.$emit('input', false);
92
81
  var player = this.getMediaElement();
93
-
94
82
  if (!player) {
95
83
  return;
96
84
  }
97
-
98
85
  player.pause();
99
86
  player.currentTime = 0;
100
-
101
87
  if (this.mediaUrl && !this.mediaUrl.startsWith('http')) {
102
88
  (URL || webkitURL).revokeObjectURL(this.mediaUrl);
103
89
  }
104
90
  },
105
91
  renderTag: function renderTag() {
106
92
  var h = this.$createElement;
107
-
108
93
  if (this.mediaUrl) {
109
94
  if (this.mediaType === _type.MediaType.VIDEO) {
110
95
  return h("video", {
@@ -161,5 +146,4 @@ var _default = createComponent({
161
146
  }, ["\u5173\u95ED"])]);
162
147
  }
163
148
  });
164
-
165
149
  exports.default = _default;
@@ -2,31 +2,26 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.BindEventMixin = BindEventMixin;
5
-
6
5
  var _event = require("../utils/dom/event");
7
-
8
6
  /**
9
7
  * Bind event when mounted or activated
10
8
  */
11
- var uid = 0;
12
9
 
10
+ var uid = 0;
13
11
  function BindEventMixin(handler) {
14
12
  var key = "binded_" + uid++;
15
-
16
13
  function bind() {
17
14
  if (!this[key]) {
18
15
  handler.call(this, _event.on, true);
19
16
  this[key] = true;
20
17
  }
21
18
  }
22
-
23
19
  function unbind() {
24
20
  if (this[key]) {
25
21
  handler.call(this, _event.off, false);
26
22
  this[key] = false;
27
23
  }
28
24
  }
29
-
30
25
  return {
31
26
  mounted: bind,
32
27
  activated: bind,
@@ -1,25 +1,20 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  exports.__esModule = true;
6
5
  exports.CheckboxMixin = void 0;
7
-
8
6
  var _icon = _interopRequireDefault(require("../icon"));
9
-
10
7
  var _field = require("./field");
11
-
12
8
  var _relation = require("./relation");
13
-
14
9
  var _utils = require("../utils");
15
-
16
10
  /**
17
11
  * Common part of Checkbox & Radio
18
12
  */
13
+
19
14
  var CheckboxMixin = function CheckboxMixin(_ref) {
20
15
  var parent = _ref.parent,
21
- bem = _ref.bem,
22
- role = _ref.role;
16
+ bem = _ref.bem,
17
+ role = _ref.role;
23
18
  return {
24
19
  mixins: [(0, _relation.ChildrenMixin)(parent), _field.FieldMixin],
25
20
  props: {
@@ -57,7 +52,6 @@ var CheckboxMixin = function CheckboxMixin(_ref) {
57
52
  var boxShadow = this.boxShadow || this.parent && this.parent.boxShadow;
58
53
  var border = this.border || this.parent && this.parent.border;
59
54
  var iconColor = this.iconColor || this.parent && this.parent.iconColor;
60
-
61
55
  if ((boxShadow || checkedColor) && this.checked && !this.isDisabled) {
62
56
  return {
63
57
  color: iconColor,
@@ -71,22 +65,20 @@ var CheckboxMixin = function CheckboxMixin(_ref) {
71
65
  if (this.isDisabled || role === 'radio' && !this.checked) {
72
66
  return -1;
73
67
  }
74
-
75
68
  return 0;
76
69
  }
77
70
  },
78
71
  methods: {
79
72
  onClick: function onClick(event) {
80
73
  var _this = this;
81
-
82
74
  var target = event.target;
83
75
  var icon = this.$refs.icon;
84
76
  var iconClicked = icon === target || icon.contains(target);
85
-
86
77
  if (!this.isDisabled && (iconClicked || !this.labelDisabled)) {
87
- this.toggle(); // wait for toggle method to complete
88
- // so we can get the changed value in the click event listener
78
+ this.toggle();
89
79
 
80
+ // wait for toggle method to complete
81
+ // so we can get the changed value in the click event listener
90
82
  setTimeout(function () {
91
83
  _this.$emit('click', event);
92
84
  });
@@ -123,7 +115,6 @@ var CheckboxMixin = function CheckboxMixin(_ref) {
123
115
  genLabel: function genLabel() {
124
116
  var h = this.$createElement;
125
117
  var slot = this.slots();
126
-
127
118
  if (slot) {
128
119
  return h("span", {
129
120
  "class": bem('label', [this.labelPosition, {
@@ -136,13 +127,11 @@ var CheckboxMixin = function CheckboxMixin(_ref) {
136
127
  render: function render() {
137
128
  var h = arguments[0];
138
129
  var Children = [this.genIcon()];
139
-
140
130
  if (this.labelPosition === 'left') {
141
131
  Children.unshift(this.genLabel());
142
132
  } else {
143
133
  Children.push(this.genLabel());
144
134
  }
145
-
146
135
  var checked = this.checked;
147
136
  return h("div", {
148
137
  "attrs": {
@@ -161,5 +150,4 @@ var CheckboxMixin = function CheckboxMixin(_ref) {
161
150
  }
162
151
  };
163
152
  };
164
-
165
153
  exports.CheckboxMixin = CheckboxMixin;
@@ -2,12 +2,11 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.ClickOutsideMixin = void 0;
5
-
6
5
  var _event = require("../utils/dom/event");
7
-
8
6
  /**
9
7
  * Listen to click outside event
10
8
  */
9
+
11
10
  var ClickOutsideMixin = function ClickOutsideMixin(config) {
12
11
  return {
13
12
  props: {
@@ -18,13 +17,11 @@ var ClickOutsideMixin = function ClickOutsideMixin(config) {
18
17
  },
19
18
  data: function data() {
20
19
  var _this = this;
21
-
22
20
  var clickOutsideHandler = function clickOutsideHandler(event) {
23
21
  if (_this.closeOnClickOutside && !_this.$el.contains(event.target)) {
24
22
  _this[config.method]();
25
23
  }
26
24
  };
27
-
28
25
  return {
29
26
  clickOutsideHandler: clickOutsideHandler
30
27
  };
@@ -37,5 +34,4 @@ var ClickOutsideMixin = function ClickOutsideMixin(config) {
37
34
  }
38
35
  };
39
36
  };
40
-
41
37
  exports.ClickOutsideMixin = ClickOutsideMixin;
@@ -2,11 +2,8 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.CloseOnPopstateMixin = void 0;
5
-
6
5
  var _event = require("../utils/dom/event");
7
-
8
6
  var _bindEvent = require("./bind-event");
9
-
10
7
  var CloseOnPopstateMixin = {
11
8
  mixins: [(0, _bindEvent.BindEventMixin)(function (bind, isBind) {
12
9
  this.handlePopstate(isBind && this.closeOnPopstate);
@@ -34,7 +31,6 @@ var CloseOnPopstateMixin = {
34
31
  if (this.$isServer) {
35
32
  return;
36
33
  }
37
-
38
34
  if (this.bindStatus !== bind) {
39
35
  this.bindStatus = bind;
40
36
  var action = bind ? _event.on : _event.off;
@@ -11,7 +11,6 @@ var FieldMixin = {
11
11
  watch: {
12
12
  value: function value() {
13
13
  var field = this.ztField;
14
-
15
14
  if (field) {
16
15
  field.resetValidation();
17
16
  field.validateWithTrigger('onChange');
@@ -20,7 +19,6 @@ var FieldMixin = {
20
19
  },
21
20
  created: function created() {
22
21
  var field = this.ztField;
23
-
24
22
  if (field && !field.children) {
25
23
  field.children = this;
26
24
  }
@@ -3,26 +3,20 @@
3
3
  exports.__esModule = true;
4
4
  exports.PopupMixin = PopupMixin;
5
5
  exports.popupMixinProps = void 0;
6
-
7
6
  var _context = require("./context");
8
-
9
7
  var _overlay = require("./overlay");
10
-
11
8
  var _event = require("../../utils/dom/event");
12
-
13
9
  var _node = require("../../utils/dom/node");
14
-
15
10
  var _scroll = require("../../utils/dom/scroll");
16
-
17
11
  var _touch = require("../touch");
18
-
19
12
  var _portal = require("../portal");
20
-
21
13
  var _closeOnPopstate = require("../close-on-popstate");
22
-
23
14
  // Context
15
+
24
16
  // Utils
17
+
25
18
  // Mixins
19
+
26
20
  var popupMixinProps = {
27
21
  // Initial rendering animation
28
22
  transitionAppear: Boolean,
@@ -50,12 +44,10 @@ var popupMixinProps = {
50
44
  }
51
45
  };
52
46
  exports.popupMixinProps = popupMixinProps;
53
-
54
47
  function PopupMixin(options) {
55
48
  if (options === void 0) {
56
49
  options = {};
57
50
  }
58
-
59
51
  return {
60
52
  mixins: [_touch.TouchMixin, _closeOnPopstate.CloseOnPopstateMixin, (0, _portal.PortalMixin)({
61
53
  afterPortal: function afterPortal() {
@@ -86,7 +78,6 @@ function PopupMixin(options) {
86
78
  var type = val ? 'open' : 'close';
87
79
  this.inited = this.inited || this.value;
88
80
  this[type]();
89
-
90
81
  if (!options.skipToggleEvent) {
91
82
  this.$emit(type);
92
83
  }
@@ -98,9 +89,7 @@ function PopupMixin(options) {
98
89
  this.open();
99
90
  }
100
91
  },
101
-
102
- /* istanbul ignore next */
103
- activated: function activated() {
92
+ /* istanbul ignore next */activated: function activated() {
104
93
  if (this.shouldReopen) {
105
94
  this.$emit('input', true);
106
95
  this.shouldReopen = false;
@@ -108,18 +97,14 @@ function PopupMixin(options) {
108
97
  },
109
98
  beforeDestroy: function beforeDestroy() {
110
99
  (0, _overlay.removeOverlay)(this);
111
-
112
100
  if (this.opened) {
113
101
  this.removeLock();
114
102
  }
115
-
116
103
  if (this.getContainer) {
117
104
  (0, _node.removeNode)(this.$el);
118
105
  }
119
106
  },
120
-
121
- /* istanbul ignore next */
122
- deactivated: function deactivated() {
107
+ /* istanbul ignore next */deactivated: function deactivated() {
123
108
  if (this.value) {
124
109
  this.close();
125
110
  this.shouldReopen = true;
@@ -130,13 +115,12 @@ function PopupMixin(options) {
130
115
  /* istanbul ignore next */
131
116
  if (this.$isServer || this.opened) {
132
117
  return;
133
- } // cover default zIndex
134
-
118
+ }
135
119
 
120
+ // cover default zIndex
136
121
  if (this.zIndex !== undefined) {
137
122
  _context.context.zIndex = this.zIndex;
138
123
  }
139
-
140
124
  this.opened = true;
141
125
  this.renderOverlay();
142
126
  this.addLock();
@@ -148,11 +132,9 @@ function PopupMixin(options) {
148
132
  if (this.lockScroll) {
149
133
  (0, _event.on)(document, 'touchstart', this.touchStart);
150
134
  (0, _event.on)(document, 'touchmove', this.onTouchMove);
151
-
152
135
  if (!_context.context.lockCount) {
153
136
  document.body.classList.add('zt2-overflow-hidden');
154
137
  }
155
-
156
138
  _context.context.lockCount++;
157
139
  }
158
140
  },
@@ -161,7 +143,6 @@ function PopupMixin(options) {
161
143
  _context.context.lockCount--;
162
144
  (0, _event.off)(document, 'touchstart', this.touchStart);
163
145
  (0, _event.off)(document, 'touchmove', this.onTouchMove);
164
-
165
146
  if (!_context.context.lockCount) {
166
147
  document.body.classList.remove('zt2-overflow-hidden');
167
148
  }
@@ -171,7 +152,6 @@ function PopupMixin(options) {
171
152
  if (!this.opened) {
172
153
  return;
173
154
  }
174
-
175
155
  (0, _overlay.closeOverlay)(this);
176
156
  this.opened = false;
177
157
  this.removeLock();
@@ -182,33 +162,29 @@ function PopupMixin(options) {
182
162
  var direction = this.deltaY > 0 ? '10' : '01';
183
163
  var el = (0, _scroll.getScroller)(event.target, this.$el);
184
164
  var scrollHeight = el.scrollHeight,
185
- offsetHeight = el.offsetHeight,
186
- scrollTop = el.scrollTop;
165
+ offsetHeight = el.offsetHeight,
166
+ scrollTop = el.scrollTop;
187
167
  var status = '11';
188
- /* istanbul ignore next */
189
168
 
169
+ /* istanbul ignore next */
190
170
  if (scrollTop === 0) {
191
171
  status = offsetHeight >= scrollHeight ? '00' : '01';
192
172
  } else if (scrollTop + offsetHeight >= scrollHeight) {
193
173
  status = '10';
194
174
  }
195
- /* istanbul ignore next */
196
-
197
175
 
176
+ /* istanbul ignore next */
198
177
  if (status !== '11' && this.direction === 'vertical' && !(parseInt(status, 2) & parseInt(direction, 2))) {
199
178
  (0, _event.preventDefault)(event, true);
200
179
  }
201
180
  },
202
181
  renderOverlay: function renderOverlay() {
203
182
  var _this = this;
204
-
205
183
  if (this.$isServer || !this.value) {
206
184
  return;
207
185
  }
208
-
209
186
  this.$nextTick(function () {
210
187
  _this.updateZIndex(_this.overlay ? 1 : 0);
211
-
212
188
  if (_this.overlay) {
213
189
  (0, _overlay.openOverlay)(_this, {
214
190
  zIndex: _context.context.zIndex++,
@@ -225,7 +201,6 @@ function PopupMixin(options) {
225
201
  if (value === void 0) {
226
202
  value = 0;
227
203
  }
228
-
229
204
  this.$el.style.zIndex = ++_context.context.zIndex + value;
230
205
  },
231
206
  onReopen: function onReopen(callback) {
@@ -1,35 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  exports.__esModule = true;
6
5
  exports.updateOverlay = updateOverlay;
7
6
  exports.openOverlay = openOverlay;
8
7
  exports.closeOverlay = closeOverlay;
9
8
  exports.removeOverlay = removeOverlay;
10
-
11
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
12
-
13
10
  var _overlay = _interopRequireDefault(require("../../overlay"));
14
-
15
11
  var _context = require("./context");
16
-
17
12
  var _functional = require("../../utils/functional");
18
-
19
13
  var _node = require("../../utils/dom/node");
20
-
21
14
  var defaultConfig = {
22
15
  className: '',
23
16
  customStyle: {}
24
17
  };
25
-
26
18
  function mountOverlay(vm) {
27
19
  return (0, _functional.mount)(_overlay.default, {
28
20
  on: {
29
21
  // close popup when overlay clicked & closeOnClickOverlay is true
30
22
  click: function click() {
31
23
  vm.$emit('click-overlay');
32
-
33
24
  if (vm.closeOnClickOverlay) {
34
25
  if (vm.onClickOverlay) {
35
26
  vm.onClickOverlay();
@@ -41,57 +32,44 @@ function mountOverlay(vm) {
41
32
  }
42
33
  });
43
34
  }
44
-
45
35
  function updateOverlay(vm) {
46
36
  var item = _context.context.find(vm);
47
-
48
37
  if (item) {
49
38
  var el = vm.$el;
50
39
  var config = item.config,
51
- overlay = item.overlay;
52
-
40
+ overlay = item.overlay;
53
41
  if (el && el.parentNode) {
54
42
  el.parentNode.insertBefore(overlay.$el, el);
55
43
  }
56
-
57
44
  (0, _extends2.default)(overlay, defaultConfig, config, {
58
45
  show: true
59
46
  });
60
47
  }
61
48
  }
62
-
63
49
  function openOverlay(vm, config) {
64
50
  var item = _context.context.find(vm);
65
-
66
51
  if (item) {
67
52
  item.config = config;
68
53
  } else {
69
54
  var overlay = mountOverlay(vm);
70
-
71
55
  _context.context.stack.push({
72
56
  vm: vm,
73
57
  config: config,
74
58
  overlay: overlay
75
59
  });
76
60
  }
77
-
78
61
  updateOverlay(vm);
79
62
  }
80
-
81
63
  function closeOverlay(vm) {
82
64
  var item = _context.context.find(vm);
83
-
84
65
  if (item) {
85
66
  item.overlay.show = false;
86
67
  }
87
68
  }
88
-
89
69
  function removeOverlay(vm) {
90
70
  var item = _context.context.find(vm);
91
-
92
71
  if (item) {
93
72
  (0, _node.removeNode)(item.overlay.$el);
94
-
95
73
  _context.context.remove(vm);
96
74
  }
97
75
  }
@@ -2,20 +2,16 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.PortalMixin = PortalMixin;
5
-
6
5
  function getElement(selector) {
7
6
  if (typeof selector === 'string') {
8
7
  return document.querySelector(selector);
9
8
  }
10
-
11
9
  return selector();
12
10
  }
13
-
14
11
  function PortalMixin(_temp) {
15
12
  var _ref = _temp === void 0 ? {} : _temp,
16
- ref = _ref.ref,
17
- afterPortal = _ref.afterPortal;
18
-
13
+ ref = _ref.ref,
14
+ afterPortal = _ref.afterPortal;
19
15
  return {
20
16
  props: {
21
17
  getContainer: [String, Function]
@@ -33,17 +29,14 @@ function PortalMixin(_temp) {
33
29
  var getContainer = this.getContainer;
34
30
  var el = ref ? this.$refs[ref] : this.$el;
35
31
  var container;
36
-
37
32
  if (getContainer) {
38
33
  container = getElement(getContainer);
39
34
  } else if (this.$parent) {
40
35
  container = this.$parent.$el;
41
36
  }
42
-
43
37
  if (container && container !== el.parentNode) {
44
38
  container.appendChild(el);
45
39
  }
46
-
47
40
  if (afterPortal) {
48
41
  afterPortal.call(this);
49
42
  }