@opentiny/vue-renderless 3.1.0-alpha.0

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 (397) hide show
  1. package/action-sheet/index.js +28 -0
  2. package/action-sheet/vue.js +29 -0
  3. package/alert/index.js +23 -0
  4. package/alert/vue.js +37 -0
  5. package/autocomplete/index.js +175 -0
  6. package/autocomplete/vue.js +171 -0
  7. package/avatar/index.js +29 -0
  8. package/avatar/vue.js +24 -0
  9. package/badge/index.js +16 -0
  10. package/badge/vue.js +30 -0
  11. package/breadcrumb/vue.js +4 -0
  12. package/breadcrumb-item/vue.js +24 -0
  13. package/bulletin-board/index.js +21 -0
  14. package/bulletin-board/vue.js +36 -0
  15. package/button/index.js +19 -0
  16. package/button/vue.js +43 -0
  17. package/button-group/index.js +25 -0
  18. package/button-group/vue.js +51 -0
  19. package/calendar/index.js +279 -0
  20. package/calendar/vue.js +124 -0
  21. package/card-template/index.js +39 -0
  22. package/card-template/vue.js +34 -0
  23. package/carousel/index.js +206 -0
  24. package/carousel/vue.js +222 -0
  25. package/carousel-item/index.js +93 -0
  26. package/carousel-item/vue.js +57 -0
  27. package/cascader/index.js +511 -0
  28. package/cascader/vue.js +342 -0
  29. package/cascader-menu/index.js +41 -0
  30. package/cascader-menu/vue.js +36 -0
  31. package/cascader-node/index.js +63 -0
  32. package/cascader-node/vue.js +62 -0
  33. package/cascader-panel/index.js +359 -0
  34. package/cascader-panel/node.js +199 -0
  35. package/cascader-panel/store.js +80 -0
  36. package/cascader-panel/vue.js +217 -0
  37. package/checkbox/index.js +145 -0
  38. package/checkbox/vue.js +139 -0
  39. package/checkbox-button/index.js +102 -0
  40. package/checkbox-button/vue.js +150 -0
  41. package/checkbox-group/index.js +12 -0
  42. package/checkbox-group/vue.js +33 -0
  43. package/col/index.js +132 -0
  44. package/col/vue.js +34 -0
  45. package/collapse/index.js +45 -0
  46. package/collapse/vue.js +35 -0
  47. package/collapse-item/index.js +38 -0
  48. package/collapse-item/vue.js +48 -0
  49. package/common/array.js +120 -0
  50. package/common/bigInt.js +352 -0
  51. package/common/browser.js +69 -0
  52. package/common/dataset/index.js +135 -0
  53. package/common/date.js +352 -0
  54. package/common/decimal.js +203 -0
  55. package/common/deps/ResizeObserver.js +474 -0
  56. package/common/deps/after-leave.js +25 -0
  57. package/common/deps/clickoutside.js +61 -0
  58. package/common/deps/date-util.js +262 -0
  59. package/common/deps/date.js +308 -0
  60. package/common/deps/debounce.js +4 -0
  61. package/common/deps/dom.js +190 -0
  62. package/common/deps/fullscreen/apis.js +157 -0
  63. package/common/deps/fullscreen/screenfull.js +106 -0
  64. package/common/deps/letter-only.js +15 -0
  65. package/common/deps/memorize.js +149 -0
  66. package/common/deps/number-only.js +16 -0
  67. package/common/deps/popper.js +713 -0
  68. package/common/deps/popup-manager.js +179 -0
  69. package/common/deps/repeat-click.js +24 -0
  70. package/common/deps/requestAnimationFrame.js +25 -0
  71. package/common/deps/resize-event.js +29 -0
  72. package/common/deps/scroll-into-view.js +29 -0
  73. package/common/deps/scrollbar-width.js +25 -0
  74. package/common/deps/throttle.js +34 -0
  75. package/common/deps/touch.js +33 -0
  76. package/common/deps/tree-model/node.js +586 -0
  77. package/common/deps/tree-model/tree-store.js +377 -0
  78. package/common/deps/tree-model/util.js +14 -0
  79. package/common/deps/upload-ajax.js +71 -0
  80. package/common/deps/vue-emitter.js +30 -0
  81. package/common/deps/vue-popper.js +291 -0
  82. package/common/deps/vue-popup.js +211 -0
  83. package/common/event.js +17 -0
  84. package/common/index.js +288 -0
  85. package/common/object.js +228 -0
  86. package/common/runtime.js +52 -0
  87. package/common/string.js +446 -0
  88. package/common/type.js +65 -0
  89. package/common/validate/index.js +6 -0
  90. package/common/validate/messages.js +68 -0
  91. package/common/validate/rules/enum.js +8 -0
  92. package/common/validate/rules/index.js +14 -0
  93. package/common/validate/rules/pattern.js +16 -0
  94. package/common/validate/rules/range.js +62 -0
  95. package/common/validate/rules/required.js +13 -0
  96. package/common/validate/rules/type.js +110 -0
  97. package/common/validate/rules/whitespace.js +6 -0
  98. package/common/validate/schema.js +323 -0
  99. package/common/validate/util.js +198 -0
  100. package/common/validate/validations/array.js +25 -0
  101. package/common/validate/validations/date.js +35 -0
  102. package/common/validate/validations/enum.js +24 -0
  103. package/common/validate/validations/float.js +24 -0
  104. package/common/validate/validations/index.js +42 -0
  105. package/common/validate/validations/integer.js +24 -0
  106. package/common/validate/validations/method.js +23 -0
  107. package/common/validate/validations/number.js +27 -0
  108. package/common/validate/validations/pattern.js +23 -0
  109. package/common/validate/validations/required.js +15 -0
  110. package/common/validate/validations/string.js +29 -0
  111. package/common/validate/validations/type.js +25 -0
  112. package/common/xss.js +325 -0
  113. package/container/index.js +110 -0
  114. package/container/vue.js +63 -0
  115. package/credit-card/index.js +107 -0
  116. package/credit-card/vue.js +117 -0
  117. package/credit-card-form/index.js +143 -0
  118. package/credit-card-form/vue.js +150 -0
  119. package/crop/index.js +297 -0
  120. package/crop/vue.js +191 -0
  121. package/date-panel/index.js +584 -0
  122. package/date-panel/vue.js +319 -0
  123. package/date-picker/index.js +301 -0
  124. package/date-picker/vue.js +169 -0
  125. package/date-range/index.js +463 -0
  126. package/date-range/vue.js +297 -0
  127. package/date-table/index.js +457 -0
  128. package/date-table/vue.js +151 -0
  129. package/detail-page/index.js +135 -0
  130. package/detail-page/vue.js +145 -0
  131. package/dialog-box/index.js +268 -0
  132. package/dialog-box/vue.js +226 -0
  133. package/drop-times/index.js +23 -0
  134. package/drop-times/vue.js +28 -0
  135. package/dropdown/index.js +259 -0
  136. package/dropdown/vue.js +107 -0
  137. package/dropdown-item/index.js +155 -0
  138. package/dropdown-item/vue.js +124 -0
  139. package/dropdown-menu/index.js +148 -0
  140. package/dropdown-menu/vue.js +44 -0
  141. package/exception/index.js +13 -0
  142. package/exception/vue.js +25 -0
  143. package/fall-menu/index.js +121 -0
  144. package/fall-menu/vue.js +90 -0
  145. package/file-upload/index.js +1940 -0
  146. package/file-upload/vue.js +458 -0
  147. package/floatbar/index.js +10 -0
  148. package/floatbar/vue.js +17 -0
  149. package/form/index.js +186 -0
  150. package/form/vue.js +69 -0
  151. package/form-item/index.js +364 -0
  152. package/form-item/vue.js +210 -0
  153. package/fullscreen/index.js +138 -0
  154. package/fullscreen/vue.js +77 -0
  155. package/grid/core/index.js +3 -0
  156. package/grid/core/interceptor.js +38 -0
  157. package/grid/core/storeMap.js +19 -0
  158. package/grid/plugins/export.js +169 -0
  159. package/grid/plugins/exportExcel.js +749 -0
  160. package/grid/plugins/header.js +58 -0
  161. package/grid/plugins/resize.js +82 -0
  162. package/grid/static/array/arrayEach.js +12 -0
  163. package/grid/static/array/arrayIndexOf.js +11 -0
  164. package/grid/static/array/eachTree.js +32 -0
  165. package/grid/static/array/every.js +2 -0
  166. package/grid/static/array/filterTree.js +16 -0
  167. package/grid/static/array/find.js +3 -0
  168. package/grid/static/array/findTree.js +46 -0
  169. package/grid/static/array/helperCreateIterateHandle.js +59 -0
  170. package/grid/static/array/helperCreateTreeFunc.js +18 -0
  171. package/grid/static/array/includes.js +5 -0
  172. package/grid/static/array/lastArrayEach.js +6 -0
  173. package/grid/static/array/map.js +23 -0
  174. package/grid/static/array/mapTree.js +33 -0
  175. package/grid/static/array/slice.js +10 -0
  176. package/grid/static/array/sortBy.js +69 -0
  177. package/grid/static/array/sum.js +28 -0
  178. package/grid/static/array/toArray.js +7 -0
  179. package/grid/static/array/toTreeArray.js +24 -0
  180. package/grid/static/base/clear.js +44 -0
  181. package/grid/static/base/clone.js +18 -0
  182. package/grid/static/base/destructuring.js +18 -0
  183. package/grid/static/base/each.js +9 -0
  184. package/grid/static/base/eqNull.js +6 -0
  185. package/grid/static/base/findIndexOf.js +10 -0
  186. package/grid/static/base/get.js +42 -0
  187. package/grid/static/base/has.js +60 -0
  188. package/grid/static/base/hasOwnProp.js +4 -0
  189. package/grid/static/base/helperCreateGetObjects.js +26 -0
  190. package/grid/static/base/helperCreateInInObjectString.js +7 -0
  191. package/grid/static/base/helperCreateInTypeof.js +6 -0
  192. package/grid/static/base/helperCreateIndexOf.js +21 -0
  193. package/grid/static/base/helperCreateiterateIndexOf.js +21 -0
  194. package/grid/static/base/helperDefaultCompare.js +4 -0
  195. package/grid/static/base/helperDeleteProperty.js +8 -0
  196. package/grid/static/base/helperEqualCompare.js +60 -0
  197. package/grid/static/base/helperGetHGSKeys.js +4 -0
  198. package/grid/static/base/indexOf.js +3 -0
  199. package/grid/static/base/isArray.js +3 -0
  200. package/grid/static/base/isBoolean.js +4 -0
  201. package/grid/static/base/isDate.js +3 -0
  202. package/grid/static/base/isEmpty.js +8 -0
  203. package/grid/static/base/isEqual.js +11 -0
  204. package/grid/static/base/isFunction.js +4 -0
  205. package/grid/static/base/isNaN.js +5 -0
  206. package/grid/static/base/isNull.js +4 -0
  207. package/grid/static/base/isNumber.js +4 -0
  208. package/grid/static/base/isObject.js +5 -0
  209. package/grid/static/base/isPlainObject.js +2 -0
  210. package/grid/static/base/isRegExp.js +3 -0
  211. package/grid/static/base/isSet.js +5 -0
  212. package/grid/static/base/isString.js +4 -0
  213. package/grid/static/base/isUndefined.js +4 -0
  214. package/grid/static/base/keys.js +3 -0
  215. package/grid/static/base/lastEach.js +9 -0
  216. package/grid/static/base/remove.js +44 -0
  217. package/grid/static/base/set.js +43 -0
  218. package/grid/static/base/toJSONString.js +4 -0
  219. package/grid/static/base/toStringJSON.js +13 -0
  220. package/grid/static/base/uniqueId.js +5 -0
  221. package/grid/static/browse/browse.js +54 -0
  222. package/grid/static/function/property.js +7 -0
  223. package/grid/static/function/throttle.js +43 -0
  224. package/grid/static/index.js +55 -0
  225. package/grid/static/number/helperCreateToNumber.js +12 -0
  226. package/grid/static/number/toNumber.js +3 -0
  227. package/grid/static/object/assign.js +41 -0
  228. package/grid/static/object/extend.js +3 -0
  229. package/grid/static/object/lastObjectEach.js +8 -0
  230. package/grid/static/object/objectEach.js +11 -0
  231. package/grid/static/object/objectMap.js +20 -0
  232. package/grid/static/object/values.js +9 -0
  233. package/grid/static/static/staticDocument.js +4 -0
  234. package/grid/static/static/staticHGKeyRE.js +2 -0
  235. package/grid/static/static/staticParseInt.js +2 -0
  236. package/grid/static/static/staticStrUndefined.js +2 -0
  237. package/grid/static/static/staticWindow.js +4 -0
  238. package/grid/static/string/template.js +12 -0
  239. package/grid/static/string/toString.js +12 -0
  240. package/grid/utils/column.js +72 -0
  241. package/grid/utils/common.js +155 -0
  242. package/grid/utils/dom.js +213 -0
  243. package/grid/utils/event.js +40 -0
  244. package/grid/utils/index.js +5 -0
  245. package/image/index.js +187 -0
  246. package/image/vue.js +142 -0
  247. package/image-viewer/index.js +469 -0
  248. package/image-viewer/vue.js +243 -0
  249. package/input/index.js +319 -0
  250. package/input/vue.js +319 -0
  251. package/ip-address/index.js +370 -0
  252. package/ip-address/vue.js +185 -0
  253. package/layout/vue.js +4 -0
  254. package/link/index.js +10 -0
  255. package/link/vue.js +26 -0
  256. package/link-menu/index.js +146 -0
  257. package/link-menu/vue.js +138 -0
  258. package/list/index.js +13 -0
  259. package/list/vue.js +17 -0
  260. package/loading/index.js +29 -0
  261. package/loading/vue.js +28 -0
  262. package/milestone/index.js +92 -0
  263. package/milestone/vue.js +31 -0
  264. package/mini-picker/index.js +227 -0
  265. package/mini-picker/vue.js +142 -0
  266. package/modal/index.js +866 -0
  267. package/modal/vue.js +130 -0
  268. package/month-range/index.js +169 -0
  269. package/month-range/vue.js +104 -0
  270. package/month-table/index.js +232 -0
  271. package/month-table/vue.js +72 -0
  272. package/nav-menu/index.js +457 -0
  273. package/nav-menu/vue.js +187 -0
  274. package/notify/index.js +91 -0
  275. package/notify/vue.js +67 -0
  276. package/numeric/index.js +419 -0
  277. package/numeric/vue.js +218 -0
  278. package/option/index.js +79 -0
  279. package/option/vue.js +219 -0
  280. package/option-group/index.js +18 -0
  281. package/option-group/vue.js +37 -0
  282. package/package.json +179 -0
  283. package/pager-item/index.js +122 -0
  284. package/pager-item/vue.js +52 -0
  285. package/panel/index.js +30 -0
  286. package/panel/vue.js +26 -0
  287. package/picker/index.js +1039 -0
  288. package/picker/timezone.js +974 -0
  289. package/picker/vue.js +415 -0
  290. package/picker-column/index.js +261 -0
  291. package/picker-column/vue.js +163 -0
  292. package/pop-upload/index.js +324 -0
  293. package/pop-upload/vue.js +292 -0
  294. package/popeditor/index.js +884 -0
  295. package/popeditor/vue.js +368 -0
  296. package/popover/index.js +203 -0
  297. package/popover/vue.js +174 -0
  298. package/popup/index.js +139 -0
  299. package/popup/vue.js +129 -0
  300. package/progress/index.js +174 -0
  301. package/progress/vue.js +118 -0
  302. package/pull-refresh/index.js +104 -0
  303. package/pull-refresh/vue.js +64 -0
  304. package/radio/index.js +83 -0
  305. package/radio/vue.js +99 -0
  306. package/radio-button/index.js +58 -0
  307. package/radio-button/vue.js +70 -0
  308. package/radio-group/index.js +51 -0
  309. package/radio-group/vue.js +34 -0
  310. package/rate/index.js +254 -0
  311. package/rate/vue.js +158 -0
  312. package/row/index.js +19 -0
  313. package/row/vue.js +24 -0
  314. package/scroll-text/index.js +24 -0
  315. package/scroll-text/vue.js +31 -0
  316. package/scrollbar/index.js +127 -0
  317. package/scrollbar/vue-bar.js +49 -0
  318. package/scrollbar/vue.js +43 -0
  319. package/search/index.js +110 -0
  320. package/search/vue.js +110 -0
  321. package/select/index.js +1766 -0
  322. package/select/vue.js +693 -0
  323. package/select-dropdown/index.js +23 -0
  324. package/select-dropdown/vue.js +122 -0
  325. package/slide-bar/index.js +94 -0
  326. package/slide-bar/vue.js +58 -0
  327. package/slider/index.js +434 -0
  328. package/slider/vue.js +172 -0
  329. package/split/index.js +122 -0
  330. package/split/vue.js +131 -0
  331. package/steps/vue.js +4 -0
  332. package/switch/index.js +45 -0
  333. package/switch/vue.js +62 -0
  334. package/tab-bar/index.js +51 -0
  335. package/tab-bar/vue.js +16 -0
  336. package/tab-dropdown/index.js +11 -0
  337. package/tab-dropdown/vue.js +17 -0
  338. package/tab-item/index.js +37 -0
  339. package/tab-item/vue.js +49 -0
  340. package/tab-nav/index.js +247 -0
  341. package/tab-nav/vue.js +106 -0
  342. package/tabbar/index.js +32 -0
  343. package/tabbar/vue.js +54 -0
  344. package/tabbar-item/index.js +55 -0
  345. package/tabbar-item/vue.js +53 -0
  346. package/table/index.js +111 -0
  347. package/table/vue.js +66 -0
  348. package/tabs/index.js +174 -0
  349. package/tabs/vue.js +141 -0
  350. package/tag/index.js +14 -0
  351. package/tag/vue.js +13 -0
  352. package/tall-storage/index.js +161 -0
  353. package/tall-storage/vue-storage-box.js +25 -0
  354. package/tall-storage/vue.js +38 -0
  355. package/text-popup/index.js +75 -0
  356. package/text-popup/vue.js +64 -0
  357. package/time/index.js +121 -0
  358. package/time/vue.js +124 -0
  359. package/time-line/index.js +60 -0
  360. package/time-line/vue.js +49 -0
  361. package/time-panel/index.js +189 -0
  362. package/time-panel/scrollIntoView.js +23 -0
  363. package/time-panel/vue.js +110 -0
  364. package/time-range/index.js +199 -0
  365. package/time-range/vue.js +129 -0
  366. package/time-spinner/index.js +175 -0
  367. package/time-spinner/vue.js +122 -0
  368. package/toggle-menu/index.js +104 -0
  369. package/toggle-menu/vue.js +74 -0
  370. package/tooltip/index.js +171 -0
  371. package/tooltip/vue.js +133 -0
  372. package/top-box/index.js +81 -0
  373. package/top-box/vue.js +77 -0
  374. package/transfer/index.js +296 -0
  375. package/transfer/vue.js +138 -0
  376. package/transfer-panel/index.js +364 -0
  377. package/transfer-panel/vue.js +258 -0
  378. package/tree/index.js +642 -0
  379. package/tree/vue.js +268 -0
  380. package/tree-menu/index.js +124 -0
  381. package/tree-menu/vue.js +60 -0
  382. package/tree-node/index.js +271 -0
  383. package/tree-node/vue.js +211 -0
  384. package/upload/index.js +324 -0
  385. package/upload/vue.js +93 -0
  386. package/upload-dragger/index.js +50 -0
  387. package/upload-dragger/vue.js +27 -0
  388. package/upload-list/index.js +55 -0
  389. package/upload-list/vue.js +48 -0
  390. package/user-contact/index.js +13 -0
  391. package/user-contact/vue.js +20 -0
  392. package/user-head/index.js +71 -0
  393. package/user-head/vue.js +47 -0
  394. package/wizard/index.js +123 -0
  395. package/wizard/vue.js +45 -0
  396. package/year-table/index.js +40 -0
  397. package/year-table/vue.js +23 -0
@@ -0,0 +1,1039 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
+ import { toDate, getDateWithNewTimezone, getStrTimezone, getLocalTimezone } from '@opentiny/vue-renderless/common/date';
6
+ import { isNumber, isDate } from '@opentiny/vue-renderless/common/type';
7
+ import userPopper from '@opentiny/vue-renderless/common/deps/vue-popper';
8
+ import { DATEPICKER } from '@opentiny/vue-renderless/common';
9
+ import { formatDate, parseDate, isDateObject, getWeekNumber } from '@opentiny/vue-renderless/common/deps/date-util';
10
+ import { extend } from '@opentiny/vue-renderless/common/object';
11
+ import globalTimezone from '@opentiny/vue-renderless/picker/timezone';
12
+ var iso8601Reg = /^\d{4}-\d{2}-\d{2}(.)\d{2}:\d{2}:\d{2}(.+)$/;
13
+ export var getPanel = function getPanel(_ref) {
14
+ var DatePanel = _ref.DatePanel,
15
+ DateRangePanel = _ref.DateRangePanel,
16
+ MonthRangePanel = _ref.MonthRangePanel,
17
+ TimePanel = _ref.TimePanel,
18
+ TimeRangePanel = _ref.TimeRangePanel,
19
+ TimeSelect = _ref.TimeSelect;
20
+ return function (type) {
21
+ if (type === DATEPICKER.DateRange || type === DATEPICKER.DateTimeRange) {
22
+ return DateRangePanel;
23
+ } else if (type === DATEPICKER.MonthRange) {
24
+ return MonthRangePanel;
25
+ } else if (type === DATEPICKER.TimeRange) {
26
+ return TimeRangePanel;
27
+ } else if (type === DATEPICKER.Time) {
28
+ return TimePanel;
29
+ } else if (type === DATEPICKER.TimeSelect) {
30
+ return TimeSelect;
31
+ }
32
+ return DatePanel;
33
+ };
34
+ };
35
+ export var watchPickerVisible = function watchPickerVisible(_ref2) {
36
+ var api = _ref2.api,
37
+ vm = _ref2.vm,
38
+ dispatch = _ref2.dispatch,
39
+ emit = _ref2.emit,
40
+ props = _ref2.props,
41
+ state = _ref2.state;
42
+ return function (value) {
43
+ if (props.readonly || state.pickerDisabled) return;
44
+ if (value) {
45
+ api.showPicker();
46
+ state.valueOnOpen = Array.isArray(props.modelValue) ? _toConsumableArray(props.modelValue) : props.modelValue;
47
+ } else {
48
+ api.hidePicker();
49
+ api.emitChange(props.modelValue);
50
+ state.userInput = null;
51
+ if (props.validateEvent) {
52
+ dispatch('FormItem', 'form.blur');
53
+ }
54
+ emit('blur', vm);
55
+ api.blur();
56
+ }
57
+ };
58
+ };
59
+ export var getValueEmpty = function getValueEmpty(props) {
60
+ return function () {
61
+ var modelValue = props.modelValue;
62
+ if (Array.isArray(modelValue)) {
63
+ for (var i = 0, len = modelValue.length; i < len; i++) {
64
+ if (modelValue[i]) {
65
+ return false;
66
+ }
67
+ }
68
+ } else {
69
+ if (modelValue) {
70
+ return false;
71
+ }
72
+ }
73
+ return true;
74
+ };
75
+ };
76
+ export var getMode = function getMode(_ref3) {
77
+ var state = _ref3.state;
78
+ return function () {
79
+ if (state.type === DATEPICKER.Week) {
80
+ return DATEPICKER.Week;
81
+ } else if (state.type === DATEPICKER.Month) {
82
+ return DATEPICKER.Month;
83
+ } else if (state.type === DATEPICKER.Year) {
84
+ return DATEPICKER.Year;
85
+ } else if (state.type === DATEPICKER.Dates) {
86
+ return DATEPICKER.Dates;
87
+ }
88
+ return DATEPICKER.Day;
89
+ };
90
+ };
91
+ export var formatAsFormatAndType = function formatAsFormatAndType(_ref4) {
92
+ var api = _ref4.api;
93
+ return function (value, customFormat, type) {
94
+ if (!value) return null;
95
+ var formatter = (api.typeValueResolveMap()[type] || api.typeValueResolveMap()['default']).formatter;
96
+ var format = customFormat || DATEPICKER.DateFormats[type];
97
+ return formatter(value, format);
98
+ };
99
+ };
100
+ export var displayValue = function displayValue(_ref5) {
101
+ var api = _ref5.api,
102
+ props = _ref5.props,
103
+ state = _ref5.state;
104
+ return function () {
105
+ var formattedValue = api.formatAsFormatAndType(state.parsedValue, state.format, state.type, props.rangeSeparator);
106
+ if (Array.isArray(state.userInput)) {
107
+ return [state.userInput[0] || formattedValue && formattedValue[0] || '', state.userInput[1] || formattedValue && formattedValue[1] || ''];
108
+ } else if (state.userInput !== null) {
109
+ return state.userInput;
110
+ } else if (formattedValue) {
111
+ return state.type === DATEPICKER.Dates ? formattedValue.join(', ') : formattedValue;
112
+ }
113
+ return '';
114
+ };
115
+ };
116
+ export var parseAsFormatAndType = function parseAsFormatAndType(_ref6) {
117
+ var api = _ref6.api;
118
+ return function (value, customFormat, type) {
119
+ var rangeSeparator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '-';
120
+ if (!value) return null;
121
+ var parser = (api.typeValueResolveMap()[type] || api.typeValueResolveMap()['default']).parser;
122
+ var format = customFormat || DATEPICKER.DateFormats[type];
123
+ return parser(value, format, rangeSeparator);
124
+ };
125
+ };
126
+ export var parsedValue = function parsedValue(_ref7) {
127
+ var api = _ref7.api,
128
+ props = _ref7.props,
129
+ state = _ref7.state,
130
+ t = _ref7.t;
131
+ return function () {
132
+ if (!props.modelValue) return props.modelValue;
133
+ if (state.type === DATEPICKER.TimeSelect) return props.modelValue;
134
+ var valueIsDateObject = isDateObject(props.modelValue) || Array.isArray(props.modelValue) && props.modelValue.every(isDateObject);
135
+ var _state$timezone = state.timezone,
136
+ from = _state$timezone.from,
137
+ to = _state$timezone.to,
138
+ isServiceTimezone = _state$timezone.isServiceTimezone;
139
+ if (valueIsDateObject && !isServiceTimezone) {
140
+ return props.modelValue;
141
+ }
142
+ if (state.valueFormat) {
143
+ var date = props.modelValue;
144
+ if (isServiceTimezone) {
145
+ if (Array.isArray(date)) {
146
+ date = [].concat(date).map(function (item) {
147
+ return isDate(item) ? formatDate(item, state.valueFormat, t) : item;
148
+ });
149
+ } else {
150
+ date = formatDate(date, state.valueFormat, t);
151
+ }
152
+ }
153
+ var result = api.parseAsFormatAndType(date, state.valueFormat, state.type, props.rangeSeparator);
154
+ if (Array.isArray(result)) {
155
+ return result.map(function (date) {
156
+ return getDateWithNewTimezone(date, from, to);
157
+ });
158
+ }
159
+ return getDateWithNewTimezone(result || props.modelValue, from, to);
160
+ }
161
+ var trans = function trans(value) {
162
+ return typeof value === 'string' || isNumber(value) ? toDate(value) : value;
163
+ };
164
+ var values = [].concat(props.modelValue).map(function (val) {
165
+ return getDateWithNewTimezone(trans(val), from, to);
166
+ });
167
+ return values.length > 1 ? values : values[0];
168
+ };
169
+ };
170
+ export var getTimezone = function getTimezone(_ref8) {
171
+ var props = _ref8.props,
172
+ utils = _ref8.utils;
173
+ return function () {
174
+ var dbTimezone = props.dbTimezone,
175
+ timezone = props.timezone,
176
+ isutc8 = props.isutc8,
177
+ _props$type = props.type,
178
+ type = _props$type === void 0 ? 'date' : _props$type,
179
+ iso8601 = props.iso8601;
180
+ var setting = utils.getDateFormat && utils.getDateFormat();
181
+ var _ref9 = setting || {},
182
+ DbTimezone = _ref9.DbTimezone,
183
+ Timezone = _ref9.Timezone;
184
+ var cur = getLocalTimezone();
185
+ var isTzNumber = function isTzNumber(z) {
186
+ return typeof z === 'number' && z >= -12 && z <= 12;
187
+ };
188
+ if (!~type.indexOf('datetime')) {
189
+ return {
190
+ from: cur,
191
+ to: cur
192
+ };
193
+ }
194
+ var serveTimezone = isTzNumber(dbTimezone) ? dbTimezone : isTzNumber(DbTimezone) ? DbTimezone : cur;
195
+ var clientTimezone = isTzNumber(timezone) ? timezone : isTzNumber(Timezone) ? Timezone : cur;
196
+ var value = props.modelValue;
197
+ var str = (Array.isArray(value) ? value[0] : value) || '';
198
+ var match = typeof str === 'string' && str.match(/(-|\+)(\d{2}):?(\d{2})$/);
199
+ if ((iso8601 || setting) && match) {
200
+ serveTimezone = getStrTimezone(str);
201
+ }
202
+ return {
203
+ from: serveTimezone,
204
+ to: isutc8 ? 8 : clientTimezone,
205
+ isServiceTimezone: !!setting
206
+ };
207
+ };
208
+ };
209
+ var nullOrString = function nullOrString(value) {
210
+ var arr = Array.isArray(value) ? value : [value];
211
+ return arr.every(function (val) {
212
+ return !val && !isNumber(val) || typeof val === 'string';
213
+ });
214
+ };
215
+ export var getValueFormat = function getValueFormat(_ref10) {
216
+ var props = _ref10.props,
217
+ utils = _ref10.utils;
218
+ var valueFormat = props.valueFormat,
219
+ iso8601 = props.iso8601,
220
+ value = props.modelValue,
221
+ _props$type2 = props.type,
222
+ type = _props$type2 === void 0 ? 'date' : _props$type2;
223
+ var setting = utils.getDateFormat && utils.getDateFormat();
224
+ var suffix = '';
225
+ var separator = ' ';
226
+ if (!valueFormat && ~type.indexOf('datetime') && (iso8601 || setting) && nullOrString(value)) {
227
+ var str = (Array.isArray(value) ? value[0] : value) || '';
228
+ var match = str.match(iso8601Reg);
229
+ if (match && match.length === 3) {
230
+ suffix = match[2] || '';
231
+ separator = match[1];
232
+ }
233
+ return "yyyy-MM-dd".concat(separator, "HH:mm:ss").concat(suffix);
234
+ }
235
+ return valueFormat;
236
+ };
237
+ export var dateFormatter = function dateFormatter(_ref11) {
238
+ var t = _ref11.t;
239
+ return function (value, format) {
240
+ if (format === DATEPICKER.TimesTamp) return value.getTime();
241
+ return formatDate(value, format, t);
242
+ };
243
+ };
244
+ export var dateParser = function dateParser(_ref12) {
245
+ var t = _ref12.t;
246
+ return function (text, format) {
247
+ if (format === DATEPICKER.TimesTamp) return new Date(Number(text));
248
+ return parseDate(text, format, t);
249
+ };
250
+ };
251
+ export var rangeFormatter = function rangeFormatter(api) {
252
+ return function (value, format) {
253
+ if (Array.isArray(value) && value.length === 2) {
254
+ var start = value[0];
255
+ var end = value[1];
256
+ if (start && end) {
257
+ return [api.dateFormatter(start, format), api.dateFormatter(end, format)];
258
+ }
259
+ }
260
+ return '';
261
+ };
262
+ };
263
+ export var rangeParser = function rangeParser(api) {
264
+ return function (array, format, separator) {
265
+ if (!Array.isArray(array)) {
266
+ array = array.split(separator);
267
+ }
268
+ if (array.length === 2) {
269
+ var range1 = array[0];
270
+ var range2 = array[1];
271
+ return [api.dateParser(range1, format), api.dateParser(range2, format)];
272
+ }
273
+ return [];
274
+ };
275
+ };
276
+ export var getWeekData = function getWeekData(value) {
277
+ var valueday = new Date(value).getDay();
278
+ var newDate = new Date(value);
279
+ if (valueday >= 2) {
280
+ newDate.setTime(new Date(value).getTime() - (valueday - 1) * 86400000);
281
+ } else if (valueday === 0) {
282
+ newDate.setTime(new Date(value).getTime() + (valueday + 1) * 86400000);
283
+ }
284
+ return newDate;
285
+ };
286
+ var getDefaultOfTypeValueResolveMap = function getDefaultOfTypeValueResolveMap() {
287
+ return {
288
+ formatter: function formatter(value) {
289
+ return value ? '' + value : '';
290
+ },
291
+ parser: function parser(text) {
292
+ return text === undefined || text === '' ? null : text;
293
+ }
294
+ };
295
+ };
296
+ var getWeekOfTypeValueResolveMap = function getWeekOfTypeValueResolveMap(_ref13) {
297
+ var t = _ref13.t,
298
+ api = _ref13.api;
299
+ return {
300
+ formatter: function formatter(value, format) {
301
+ var weekDate = getWeekData(value);
302
+ var week = getWeekNumber(weekDate);
303
+ var month = weekDate.getMonth();
304
+ var trueDate = new Date(weekDate);
305
+ if (week === 1 && month === 11) {
306
+ trueDate.setHours(0, 0, 0, 0);
307
+ trueDate.setDate(trueDate.getDate() + 3 - (trueDate.getDay() + 6) % 7);
308
+ }
309
+ var date = formatDate(trueDate, format, t);
310
+ date = /WW/.test(date) ? date.replace(/WW/, week < 10 ? '0' + week : week) : date.replace(/W/, week);
311
+ return date;
312
+ },
313
+ parser: function parser(text, format) {
314
+ return api.typeValueResolveMap().date.parser(text, format);
315
+ }
316
+ };
317
+ };
318
+ var getNumberOfTypeValueResolveMap = function getNumberOfTypeValueResolveMap() {
319
+ return {
320
+ formatter: function formatter(value) {
321
+ return value ? '' + value : '';
322
+ },
323
+ parser: function parser(text) {
324
+ var result = Number(text);
325
+ return !isNaN(text) ? result : null;
326
+ }
327
+ };
328
+ };
329
+ var getDatesOfTypeValueResolveMap = function getDatesOfTypeValueResolveMap(api) {
330
+ return {
331
+ formatter: function formatter(value, format) {
332
+ return value.map(function (date) {
333
+ return api.dateFormatter(date, format);
334
+ });
335
+ },
336
+ parser: function parser(value, format) {
337
+ return (typeof value === 'string' ? value.split(', ') : value).map(function (date) {
338
+ return date instanceof Date ? date : api.dateParser(date, format);
339
+ });
340
+ }
341
+ };
342
+ };
343
+ export var typeValueResolveMap = function typeValueResolveMap(_ref14) {
344
+ var api = _ref14.api,
345
+ t = _ref14.t;
346
+ return function () {
347
+ return {
348
+ "default": getDefaultOfTypeValueResolveMap(),
349
+ week: getWeekOfTypeValueResolveMap({
350
+ t: t,
351
+ api: api
352
+ }),
353
+ date: {
354
+ formatter: api.dateFormatter,
355
+ parser: api.dateParser
356
+ },
357
+ datetime: {
358
+ formatter: api.dateFormatter,
359
+ parser: api.dateParser
360
+ },
361
+ daterange: {
362
+ formatter: api.rangeFormatter,
363
+ parser: api.rangeParser
364
+ },
365
+ monthrange: {
366
+ formatter: api.rangeFormatter,
367
+ parser: api.rangeParser
368
+ },
369
+ datetimerange: {
370
+ formatter: api.rangeFormatter,
371
+ parser: api.rangeParser
372
+ },
373
+ timerange: {
374
+ formatter: api.rangeFormatter,
375
+ parser: api.rangeParser
376
+ },
377
+ time: {
378
+ formatter: api.dateFormatter,
379
+ parser: api.dateParser
380
+ },
381
+ month: {
382
+ formatter: api.dateFormatter,
383
+ parser: api.dateParser
384
+ },
385
+ year: {
386
+ formatter: api.dateFormatter,
387
+ parser: api.dateParser
388
+ },
389
+ number: getNumberOfTypeValueResolveMap(),
390
+ dates: getDatesOfTypeValueResolveMap(api)
391
+ };
392
+ };
393
+ };
394
+ export var firstInputId = function firstInputId(_ref15) {
395
+ var props = _ref15.props,
396
+ state = _ref15.state;
397
+ return function () {
398
+ var obj = {};
399
+ var id;
400
+ if (state.ranged) {
401
+ id = props.id && props.id[0];
402
+ } else {
403
+ id = props.id;
404
+ }
405
+ if (id) obj.id = id;
406
+ return obj;
407
+ };
408
+ };
409
+ export var secondInputId = function secondInputId(_ref16) {
410
+ var props = _ref16.props,
411
+ state = _ref16.state;
412
+ return function () {
413
+ var obj = {};
414
+ var id;
415
+ if (state.ranged) {
416
+ id = props.id && props.id[1];
417
+ }
418
+ if (id) obj.id = id;
419
+ return obj;
420
+ };
421
+ };
422
+ export var focus = function focus(_ref17) {
423
+ var api = _ref17.api,
424
+ props = _ref17.props,
425
+ refs = _ref17.refs;
426
+ return function () {
427
+ return !props.ranged ? refs.reference.focus() : api.handleFocus();
428
+ };
429
+ };
430
+ export var blur = function blur(state) {
431
+ return function () {
432
+ return state.refInput.forEach(function (input) {
433
+ return input.blur();
434
+ });
435
+ };
436
+ };
437
+ export var parseValue = function parseValue(_ref18) {
438
+ var api = _ref18.api,
439
+ props = _ref18.props,
440
+ state = _ref18.state;
441
+ return function (value) {
442
+ var isParsed = isDateObject(value) || Array.isArray(value) && value.every(isDateObject);
443
+ if (state.valueFormat && !isParsed) {
444
+ return api.parseAsFormatAndType(value, state.valueFormat, state.type, props.rangeSeparator) || value;
445
+ }
446
+ return value;
447
+ };
448
+ };
449
+ export var formatToValue = function formatToValue(_ref19) {
450
+ var api = _ref19.api,
451
+ props = _ref19.props,
452
+ state = _ref19.state;
453
+ return function (date) {
454
+ var isFormattable = isDateObject(date) || Array.isArray(date) && date.every(isDateObject);
455
+ if (state.valueFormat && isFormattable) {
456
+ return api.formatAsFormatAndType(date, state.valueFormat, state.type, props.rangeSeparator);
457
+ }
458
+ return date;
459
+ };
460
+ };
461
+ export var parseString = function parseString(_ref20) {
462
+ var api = _ref20.api,
463
+ state = _ref20.state;
464
+ return function (value) {
465
+ var type = Array.isArray(value) ? state.type : state.type.replace(DATEPICKER.Range, '');
466
+ return api.parseAsFormatAndType(value, state.format, type);
467
+ };
468
+ };
469
+ export var formatToString = function formatToString(_ref21) {
470
+ var api = _ref21.api,
471
+ state = _ref21.state;
472
+ return function (value) {
473
+ var type = Array.isArray(value) ? state.type : state.type.replace(DATEPICKER.Range, '');
474
+ return api.formatAsFormatAndType(value, state.format, type);
475
+ };
476
+ };
477
+ export var handleMouseEnter = function handleMouseEnter(_ref22) {
478
+ var props = _ref22.props,
479
+ state = _ref22.state;
480
+ return function () {
481
+ if (props.readonly || state.pickerDisabled) return;
482
+ if (!state.valueIsEmpty && props.clearable) {
483
+ state.showClose = true;
484
+ }
485
+ };
486
+ };
487
+ export var handleChange = function handleChange(_ref23) {
488
+ var api = _ref23.api,
489
+ state = _ref23.state;
490
+ return function () {
491
+ if (state.userInput) {
492
+ var value = api.parseString(state.displayValue);
493
+ if (value) {
494
+ state.picker.state.value = value;
495
+ if (api.isValidValue(value)) {
496
+ api.emitInput(value);
497
+ state.userInput = null;
498
+ }
499
+ }
500
+ }
501
+ if (state.userInput === '') {
502
+ api.emitInput(null);
503
+ api.emitChange(null);
504
+ state.userInput = null;
505
+ }
506
+ };
507
+ };
508
+ export var handleStartInput = function handleStartInput(state) {
509
+ return function (event) {
510
+ if (state.userInput) {
511
+ state.userInput = [event.target.value, state.userInput[1]];
512
+ } else {
513
+ state.userInput = [event.target.value, null];
514
+ }
515
+ };
516
+ };
517
+ export var handleEndInput = function handleEndInput(state) {
518
+ return function (event) {
519
+ if (state.userInput) {
520
+ state.userInput = [state.userInput[0], event.target.value];
521
+ } else {
522
+ state.userInput = [null, event.target.value];
523
+ }
524
+ };
525
+ };
526
+ export var handleStartChange = function handleStartChange(_ref24) {
527
+ var api = _ref24.api,
528
+ state = _ref24.state;
529
+ return function () {
530
+ var value = api.parseString(state.userInput && state.userInput[0]);
531
+ if (value) {
532
+ var newValue;
533
+ if (state.displayValue[1]) {
534
+ state.userInput = [api.formatToString(value), state.displayValue[1]];
535
+ newValue = [value, state.picker.state.value && state.picker.state.value[1]];
536
+ } else {
537
+ var now = new Date();
538
+ if (now.getTime() < value.getTime()) {
539
+ state.userInput = [api.formatToString(value), api.formatToString(value)];
540
+ newValue = [value, value];
541
+ } else {
542
+ state.userInput = [api.formatToString(value), api.formatToString(now)];
543
+ newValue = [value, now];
544
+ }
545
+ }
546
+ state.picker.state.value = newValue;
547
+ if (api.isValidValue(newValue)) {
548
+ api.emitInput(newValue);
549
+ state.userInput = null;
550
+ }
551
+ }
552
+ };
553
+ };
554
+ export var handleEndChange = function handleEndChange(_ref25) {
555
+ var api = _ref25.api,
556
+ state = _ref25.state;
557
+ return function () {
558
+ var value = api.parseString(state.userInput && state.userInput[1]);
559
+ if (value) {
560
+ var newValue;
561
+ if (state.displayValue[0]) {
562
+ state.userInput = [state.displayValue[0], api.formatToString(value)];
563
+ newValue = [state.picker.state.value && state.picker.state.value[0], value];
564
+ } else {
565
+ var now = new Date();
566
+ if (now.getTime() < value.getTime()) {
567
+ state.userInput = [api.formatToString(now), api.formatToString(value)];
568
+ newValue = [now, value];
569
+ } else {
570
+ state.userInput = [api.formatToString(value), api.formatToString(value)];
571
+ newValue = [value, value];
572
+ }
573
+ }
574
+ state.picker.state.value = newValue;
575
+ if (api.isValidValue(newValue)) {
576
+ api.emitInput(newValue);
577
+ state.userInput = null;
578
+ }
579
+ }
580
+ };
581
+ };
582
+ export var handleClickIcon = function handleClickIcon(_ref26) {
583
+ var api = _ref26.api,
584
+ props = _ref26.props,
585
+ state = _ref26.state;
586
+ return function (event) {
587
+ if (props.readonly || state.pickerDisabled) return;
588
+ if (state.showClose) {
589
+ state.valueOnOpen = props.modelValue;
590
+ event.stopPropagation();
591
+ api.emitInput(null);
592
+ api.emitChange(null);
593
+ state.showClose = false;
594
+ if (state.picker && typeof state.picker.handleClear === 'function') {
595
+ state.picker.handleClear();
596
+ }
597
+ } else {
598
+ state.pickerVisible = !state.pickerVisible;
599
+ }
600
+ };
601
+ };
602
+ export var handleClose = function handleClose(_ref27) {
603
+ var api = _ref27.api,
604
+ props = _ref27.props,
605
+ state = _ref27.state;
606
+ return function () {
607
+ if (!state.pickerVisible) return;
608
+ state.pickerVisible = false;
609
+ if (state.type === DATEPICKER.Dates) {
610
+ var oldValue = api.parseAsFormatAndType(state.valueOnOpen, state.valueFormat, state.type, props.rangeSeparator) || state.valueOnOpen;
611
+ api.emitInput(oldValue);
612
+ }
613
+ };
614
+ };
615
+ export var handleFocus = function handleFocus(_ref28) {
616
+ var emit = _ref28.emit,
617
+ refs = _ref28.refs,
618
+ state = _ref28.state;
619
+ return function () {
620
+ var type = state.type;
621
+ if (DATEPICKER.TriggerTypes.indexOf(type) !== -1 && !state.pickerVisible) {
622
+ state.pickerVisible = true;
623
+ }
624
+ emit('focus', refs.reference);
625
+ };
626
+ };
627
+ export var handleKeydown = function handleKeydown(_ref29) {
628
+ var api = _ref29.api,
629
+ state = _ref29.state;
630
+ return function (event) {
631
+ var keyCode = event.keyCode;
632
+ if (keyCode === 27) {
633
+ state.pickerVisible = false;
634
+ event.stopPropagation();
635
+ return;
636
+ }
637
+ if (keyCode === 9) {
638
+ if (!state.ranged) {
639
+ api.handleChange();
640
+ state.pickerVisible = state.picker.state.visible = false;
641
+ api.blur();
642
+ event.stopPropagation();
643
+ } else {
644
+ setTimeout(function () {
645
+ if (state.refInput.indexOf(document.activeElement) === -1) {
646
+ state.pickerVisible = false;
647
+ api.blur();
648
+ event.stopPropagation();
649
+ }
650
+ }, 0);
651
+ }
652
+ return;
653
+ }
654
+ if (keyCode === 13) {
655
+ if (state.userInput === '' || api.isValidValue(api.parseString(state.displayValue))) {
656
+ api.handleChange();
657
+ state.pickerVisible = state.picker.state.visible = false;
658
+ api.blur();
659
+ }
660
+ event.stopPropagation();
661
+ return;
662
+ }
663
+ if (state.userInput) {
664
+ event.stopPropagation();
665
+ return;
666
+ }
667
+ if (state.picker && state.picker.handleKeydown) {
668
+ state.picker.handleKeydown(event);
669
+ }
670
+ };
671
+ };
672
+ export var hidePicker = function hidePicker(_ref30) {
673
+ var destroyPopper = _ref30.destroyPopper,
674
+ state = _ref30.state;
675
+ return function () {
676
+ if (state.picker) {
677
+ state.picker.resetView && state.picker.resetView();
678
+ state.pickerVisible = state.picker.visible = state.picker.state.visible = false;
679
+ destroyPopper();
680
+ }
681
+ };
682
+ };
683
+ export var showPicker = function showPicker(_ref31) {
684
+ var api = _ref31.api,
685
+ nextTick = _ref31.nextTick,
686
+ updatePopper = _ref31.updatePopper,
687
+ state = _ref31.state;
688
+ return function () {
689
+ if (state.$isServer) {
690
+ return;
691
+ }
692
+ if (!state.picker) {
693
+ api.mountPicker();
694
+ }
695
+ state.pickerVisible = state.picker.state.visible = true;
696
+ state.picker.state.value = state.parsedValue;
697
+ state.picker.resetView && state.picker.resetView();
698
+ nextTick(function () {
699
+ updatePopper(state.picker.$el);
700
+ state.picker.adjustSpinners && state.picker.adjustSpinners();
701
+ });
702
+ };
703
+ };
704
+ export var handlePick = function handlePick(_ref32) {
705
+ var state = _ref32.state,
706
+ api = _ref32.api;
707
+ return function () {
708
+ var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
709
+ var visible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
710
+ state.userInput = null;
711
+ state.pickerVisible = state.picker.state.visible = visible;
712
+ api.emitInput(date);
713
+ state.date = date;
714
+ state.picker.resetView && state.picker.resetView();
715
+ };
716
+ };
717
+ export var handleSelectRange = function handleSelectRange(state) {
718
+ return function (start, end, pos) {
719
+ if (state.refInput.length === 0) {
720
+ return;
721
+ }
722
+ var adjust = function adjust(value, start, end) {
723
+ if (!value) {
724
+ return {
725
+ start: start,
726
+ end: end
727
+ };
728
+ }
729
+ var valueReg = /(\d+):(\d+):(\d+)(\s+.+)?/;
730
+ if (valueReg.test(value)) {
731
+ var matched = valueReg.exec(value);
732
+ var hourLength = matched[1].length;
733
+ var minuteLength = matched[2].length;
734
+ var secondLength = matched[3].length;
735
+ if (start === 0) {
736
+ end = hourLength;
737
+ } else if (start === 3) {
738
+ start = hourLength + 1;
739
+ end = hourLength + minuteLength + 1;
740
+ } else {
741
+ start = hourLength + minuteLength + 2;
742
+ end = hourLength + minuteLength + secondLength + 2;
743
+ }
744
+ }
745
+ return {
746
+ start: start,
747
+ end: end
748
+ };
749
+ };
750
+ if (!pos || pos === 'min') {
751
+ var value = state.refInput[0].value;
752
+ var res = adjust(value, start, end);
753
+ state.refInput[0].setSelectionRange(res.start, res.end);
754
+ state.refInput[0].focus();
755
+ } else if (pos === 'max') {
756
+ var _value = state.refInput[1].value;
757
+ var _res = adjust(_value, start, end);
758
+ state.refInput[1].setSelectionRange(_res.start, _res.end);
759
+ state.refInput[1].focus();
760
+ }
761
+ };
762
+ };
763
+ export var mountPicker = function mountPicker(_ref33) {
764
+ var api = _ref33.api,
765
+ props = _ref33.props,
766
+ state = _ref33.state,
767
+ vm = _ref33.vm,
768
+ updatePopper = _ref33.updatePopper;
769
+ return function () {
770
+ state.picker = vm.$refs.picker;
771
+ state.picker.state.defaultValue = props.defaultValue;
772
+ state.picker.state.defaultTime = props.defaultTime;
773
+ state.picker.state.popperClass = props.popperClass;
774
+ state.picker.state.popperAppendToBody = props.popperAppendToBody;
775
+ state.picker.state.fnUpdatePopper = updatePopper;
776
+ state.picker.state.currentInstans = state.picker;
777
+ state.picker.state.timezone = state.timezone;
778
+ state.picker.state.timezoneData = state.timezoneData;
779
+ state.picker.state.showTimezone = props.showTimezone || state.timezone.isServiceTimezone;
780
+ state.picker.state.width = state.reference.getBoundingClientRect().width;
781
+ state.picker.state.timefmt = props.timeFormat || '';
782
+ state.picker.state.showTime = state.type === DATEPICKER.DateTime || state.type === DATEPICKER.DateTimeRange;
783
+ state.picker.state.selectionMode = state.selectionMode;
784
+ state.picker.state.defaultTimezone = props.defaultTimezone;
785
+ state.picker.state.unlinkPanels = props.unlinkPanels;
786
+ state.picker.state.emitDbTime = api.emitDbTime;
787
+ state.picker.state.arrowControl = state.arrowControl || props.timeArrowControl || props.arrowControl || false;
788
+ api.updateOptions();
789
+ state.picker.resetView && state.picker.resetView();
790
+ };
791
+ };
792
+ export var updateOptions = function updateOptions(_ref34) {
793
+ var api = _ref34.api,
794
+ props = _ref34.props,
795
+ state = _ref34.state;
796
+ return function () {
797
+ if (!state.picker) return;
798
+ var options = props.pickerOptions;
799
+ if (options && options.selectableRange) {
800
+ var ranges = options.selectableRange;
801
+ var parser = api.typeValueResolveMap().datetimerange.parser;
802
+ var format = DATEPICKER.DateFormats.timerange;
803
+ ranges = Array.isArray(ranges) ? ranges : [ranges];
804
+ state.picker.state.selectableRange = ranges.map(function (range) {
805
+ return parser(range, format, props.rangeSeparator);
806
+ });
807
+ }
808
+ for (var option in options) {
809
+ if (option in options && option !== DATEPICKER.SelectbaleRange) {
810
+ state.picker.state[option] = options[option];
811
+ }
812
+ }
813
+ if (props.format) {
814
+ state.picker.state.format = props.format;
815
+ }
816
+ };
817
+ };
818
+ export var valueEquals = function valueEquals(left, right) {
819
+ var dateEquals = function dateEquals(a, b) {
820
+ var bIsDate = b instanceof Date;
821
+ var aIsDate = a instanceof Date;
822
+ if (aIsDate && bIsDate) {
823
+ return a.getTime() === b.getTime();
824
+ }
825
+ if (!aIsDate && !bIsDate) {
826
+ return a === b;
827
+ }
828
+ return false;
829
+ };
830
+ var aIsArray = left instanceof Array;
831
+ var bIsArray = right instanceof Array;
832
+ if (aIsArray && bIsArray) {
833
+ if (left.length !== right.length) {
834
+ return false;
835
+ }
836
+ return left.every(function (item, index) {
837
+ return dateEquals(item, right[index]);
838
+ });
839
+ }
840
+ if (!aIsArray && !bIsArray) {
841
+ return dateEquals(left, right);
842
+ }
843
+ return false;
844
+ };
845
+ export var emitChange = function emitChange(_ref35) {
846
+ var api = _ref35.api,
847
+ dispatch = _ref35.dispatch,
848
+ emit = _ref35.emit,
849
+ props = _ref35.props,
850
+ state = _ref35.state;
851
+ return function (val) {
852
+ if (!valueEquals(val, state.valueOnOpen)) {
853
+ emit('change', val);
854
+ state.valueOnOpen = val;
855
+ if (props.validateEvent) {
856
+ dispatch('FormItem', 'form.change', val);
857
+ }
858
+ api.emitDbTime(props.value);
859
+ }
860
+ };
861
+ };
862
+ export var emitInput = function emitInput(_ref36) {
863
+ var api = _ref36.api,
864
+ emit = _ref36.emit,
865
+ props = _ref36.props,
866
+ state = _ref36.state;
867
+ return function (val) {
868
+ var value = val;
869
+ var _state$timezone2 = state.timezone,
870
+ from = _state$timezone2.from,
871
+ to = _state$timezone2.to;
872
+ if (props.type === 'datetime') {
873
+ value = getDateWithNewTimezone(value, to, from);
874
+ } else if (props.type === 'datetimerange' && Array.isArray(value)) {
875
+ value = value.map(function (val) {
876
+ return getDateWithNewTimezone(val, to, from);
877
+ });
878
+ }
879
+ var formatted = api.formatToValue(value) || val;
880
+ if (!valueEquals(props.modelValue, formatted)) {
881
+ emit('update:modelValue', formatted);
882
+ }
883
+ };
884
+ };
885
+ export var isValidValue = function isValidValue(_ref37) {
886
+ var api = _ref37.api,
887
+ state = _ref37.state;
888
+ return function (value) {
889
+ if (!state.picker) {
890
+ api.mountPicker();
891
+ }
892
+ if (state.picker.isValidValue) {
893
+ return value && state.picker.isValidValue(value);
894
+ }
895
+ return true;
896
+ };
897
+ };
898
+ export var watchIsRange = function watchIsRange(_ref38) {
899
+ var api = _ref38.api,
900
+ state = _ref38.state,
901
+ TimePanel = _ref38.TimePanel,
902
+ TimeRangePanel = _ref38.TimeRangePanel;
903
+ return function (value) {
904
+ state.type = value ? DATEPICKER.TimeRange : DATEPICKER.Time;
905
+ state.panel = value ? TimeRangePanel : TimePanel;
906
+ api.mountPicker();
907
+ };
908
+ };
909
+ export var getType = function getType(_ref39) {
910
+ var props = _ref39.props;
911
+ return function () {
912
+ if (props.componentName === DATEPICKER.DatePicker) {
913
+ return props.type;
914
+ } else if (props.componentName === DATEPICKER.TimePicker) {
915
+ return props.isRange ? DATEPICKER.TimeRange : DATEPICKER.Time;
916
+ }
917
+ return DATEPICKER.TimeSelect;
918
+ };
919
+ };
920
+ export var watchModelValue = function watchModelValue(_ref40) {
921
+ var api = _ref40.api,
922
+ props = _ref40.props,
923
+ state = _ref40.state,
924
+ dispatch = _ref40.dispatch;
925
+ return function (value, oldValue) {
926
+ api.emitChange(props.modelValue);
927
+ if (!valueEquals(value, oldValue) && !state.pickerVisible && props.validateEvent) {
928
+ dispatch('FormItem', 'form.change', value);
929
+ }
930
+ };
931
+ };
932
+ export var computedFormat = function computedFormat(_ref41) {
933
+ var props = _ref41.props,
934
+ utils = _ref41.utils;
935
+ return function () {
936
+ var type = props.type,
937
+ format = props.format;
938
+ if (!format && utils.getDateFormat) {
939
+ var config = utils.getDateFormat() || {};
940
+ if (~['date', 'dates', 'daterange'].indexOf(type)) {
941
+ format = config.DateFormat;
942
+ }
943
+ if (~['datetime', 'datetimerange'].indexOf(type)) {
944
+ format = config.DateTimeFormat;
945
+ }
946
+ }
947
+ return format;
948
+ };
949
+ };
950
+ export var computedTriggerClass = function computedTriggerClass(_ref42) {
951
+ var props = _ref42.props,
952
+ state = _ref42.state;
953
+ return function () {
954
+ return props.suffixIcon || props.prefixIcon || (state.type.indexOf(DATEPICKER.Time) !== -1 ? DATEPICKER.IconTime : DATEPICKER.IconDate);
955
+ };
956
+ };
957
+ export var computedHaveTrigger = function computedHaveTrigger(_ref43) {
958
+ var props = _ref43.props;
959
+ return function () {
960
+ return typeof props.showTrigger !== 'undefined' ? props.showTrigger : DATEPICKER.TriggerTypes.indexOf(props.type) !== -1;
961
+ };
962
+ };
963
+ export var intiPopper = function intiPopper(_ref44) {
964
+ var props = _ref44.props,
965
+ hooks = _ref44.hooks,
966
+ vnode = _ref44.vnode;
967
+ var reactive = hooks.reactive,
968
+ watch = hooks.watch,
969
+ toRefs = hooks.toRefs,
970
+ onBeforeUnmount = hooks.onBeforeUnmount,
971
+ onDeactivated = hooks.onDeactivated;
972
+ var emit = vnode.emit,
973
+ refs = vnode.refs,
974
+ slots = vnode.slots,
975
+ nextTick = vnode.nextTick;
976
+ var placementMap = DATEPICKER.PlacementMap;
977
+ return userPopper({
978
+ reactive: reactive,
979
+ watch: watch,
980
+ emit: emit,
981
+ props: _objectSpread(_objectSpread({}, props), {}, {
982
+ popperOptions: {
983
+ boundariesPadding: 0,
984
+ gpuAcceleration: false
985
+ },
986
+ visibleArrow: true,
987
+ offset: 0,
988
+ boundariesPadding: 5,
989
+ arrowOffset: 35,
990
+ placement: placementMap[props.align] || placementMap.left
991
+ }),
992
+ toRefs: toRefs,
993
+ refs: refs,
994
+ slots: slots,
995
+ nextTick: nextTick,
996
+ onBeforeUnmount: onBeforeUnmount,
997
+ onDeactivated: onDeactivated
998
+ });
999
+ };
1000
+ export var emitDbTime = function emitDbTime(_ref45) {
1001
+ var emit = _ref45.emit,
1002
+ state = _ref45.state,
1003
+ t = _ref45.t;
1004
+ return function (date) {
1005
+ var _state$timezone3 = state.timezone,
1006
+ isServiceTimezone = _state$timezone3.isServiceTimezone,
1007
+ from = _state$timezone3.from;
1008
+ if (isServiceTimezone && !valueEquals(date, state.dbTime)) {
1009
+ var hasDate = false;
1010
+ var dbTime = [].concat(date).map(function (item) {
1011
+ if (isDate(item)) {
1012
+ hasDate = true;
1013
+ var currentDate = getDateWithNewTimezone(item, getLocalTimezone(), from);
1014
+ if (state.valueFormat) {
1015
+ currentDate = formatDate(currentDate, state.valueFormat, t);
1016
+ }
1017
+ return currentDate;
1018
+ }
1019
+ return item;
1020
+ });
1021
+ state.dbTime = dbTime.length > 1 ? dbTime : dbTime[0];
1022
+ hasDate && emit('input', state.dbTime);
1023
+ }
1024
+ };
1025
+ };
1026
+ export var initGlobalTimezone = function initGlobalTimezone(_ref46) {
1027
+ var api = _ref46.api,
1028
+ state = _ref46.state,
1029
+ props = _ref46.props;
1030
+ return function () {
1031
+ var isServiceTimezone = state.timezone.isServiceTimezone;
1032
+ if (isServiceTimezone) {
1033
+ state.timezoneData = globalTimezone;
1034
+ } else if (props.showTimezone) {
1035
+ state.timezoneData = props.timezoneData ? extend(true, {}, props.timezoneData) : globalTimezone;
1036
+ }
1037
+ api.emitDbTime(props.value);
1038
+ };
1039
+ };