aloha-vue 2.62.0 → 2.63.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 (429) hide show
  1. package/CHANGELOG.md +1070 -1061
  2. package/dist/aloha-vue.css +14 -6
  3. package/dist/aloha-vue.css.map +1 -1
  4. package/dist/aloha-vue.es.js +17124 -16970
  5. package/dist/aloha-vue.umd.js +69 -69
  6. package/package.json +99 -99
  7. package/scss/_base.scss +62 -62
  8. package/scss/aloha-vue.scss +68 -68
  9. package/scss/components/AFilters.scss +304 -304
  10. package/scss/components/AFormElement/AValidatedJson.scss +6 -6
  11. package/scss/components/AMenu.scss +627 -627
  12. package/scss/components/AModal.scss +44 -44
  13. package/scss/components/APagination.scss +167 -167
  14. package/scss/components/ARate.scss +78 -78
  15. package/scss/components/AResizer.scss +63 -63
  16. package/scss/components/ATable.scss +819 -819
  17. package/scss/components/ATableForm.scss +309 -288
  18. package/scss/components/AVerticalScroll.scss +47 -47
  19. package/scss/components/AWizard.scss +669 -669
  20. package/scss/components/ui/ADatepicker.scss +342 -342
  21. package/scss/components/ui/ADatepickerRange.scss +45 -45
  22. package/scss/components/ui/AFieldset.scss +78 -78
  23. package/scss/components/ui/AInputNumber.scss +62 -62
  24. package/scss/components/ui/AInputNumberRange.scss +30 -30
  25. package/scss/components/ui/ASelect.scss +236 -236
  26. package/scss/components/ui/ASlider.scss +186 -186
  27. package/scss/components/ui/ASwitch.scss +148 -148
  28. package/scss/components/ui/ui.scss +254 -254
  29. package/scss/text/text_alignment.scss +39 -39
  30. package/scss/text/text_transform.scss +51 -51
  31. package/scss/text/text_wrapping.scss +40 -40
  32. package/scss/utils/badge.scss +45 -45
  33. package/scss/utils/checkbox_radio.scss +134 -134
  34. package/scss/utils/color.scss +46 -46
  35. package/scss/utils/dropdown.scss +185 -185
  36. package/scss/utils/list.scss +75 -75
  37. package/scss/utils/modal.scss +173 -173
  38. package/scss/utils/sizing.scss +137 -137
  39. package/scss/utils/spacing.scss +63 -63
  40. package/scss/utils/tooltip.scss +63 -63
  41. package/src/AAccordion/AAccordion.js +206 -206
  42. package/src/AAccordion/compositionAPI/IndexesForOpenAPI.js +63 -63
  43. package/src/AAccordion/compositionAPI/ToggleAPI.js +85 -85
  44. package/src/AAlert/AAlert.js +216 -216
  45. package/src/AAlert/compositionAPI/ClassAPI.js +21 -21
  46. package/src/AAlert/i18n/AAlertI18n.js +19 -19
  47. package/src/AAlert/i18n/ar.json +2 -2
  48. package/src/AAlert/i18n/de.json +2 -2
  49. package/src/AAlert/i18n/en.json +2 -2
  50. package/src/AAlert/i18n/es.json +2 -2
  51. package/src/AAlert/i18n/fr.json +2 -2
  52. package/src/AAlert/i18n/hr.json +2 -2
  53. package/src/AAlert/i18n/it.json +2 -2
  54. package/src/AAlert/i18n/ru.json +2 -2
  55. package/src/AButton/AButton.js +275 -275
  56. package/src/ACarousel/ACarousel.js +361 -361
  57. package/src/ACarousel/ACarouselBtn/ACarouselBtn.js +75 -75
  58. package/src/ACarousel/ACarouselBtn/compositionAPI/ClassAPI.js +16 -16
  59. package/src/ACarousel/ACarouselBtn/compositionAPI/TextAPI.js +25 -25
  60. package/src/ACarousel/ACarouselControls/ACarouselControls.js +114 -114
  61. package/src/ACarousel/ACarouselControls/ACarouselControlsIndicator/ACarouselControlsIndicator.js +146 -146
  62. package/src/ACarousel/ACarouselControls/ACarouselControlsIndicator/compositionAPI/ActiveAPI.js +33 -33
  63. package/src/ACarousel/ACarouselControls/ACarouselControlsIndicator/compositionAPI/AttributesAPI.js +40 -40
  64. package/src/ACarousel/ACarouselControls/ACarouselControlsIndicator/compositionAPI/EventsAPI.js +25 -25
  65. package/src/ACarousel/ACarouselControls/ACarouselControlsIndicator/compositionAPI/IconAPI.js +20 -20
  66. package/src/ACarousel/ACarouselControls/compositionAPI/AriaLabelAPI.js +20 -20
  67. package/src/ACarousel/ACarouselItem/ACarouselItem.js +83 -83
  68. package/src/ACarousel/ACarouselItem/compositionAPI/AttributesAPI.js +39 -39
  69. package/src/ACarousel/ACarouselItem/compositionAPI/IsActiveAPI.js +21 -21
  70. package/src/ACarousel/compositionAPI/ActiveAPI.js +111 -111
  71. package/src/ACarousel/compositionAPI/AriaLabelAPI.js +25 -25
  72. package/src/ACarousel/compositionAPI/ArrowsAPI.js +17 -17
  73. package/src/ACarousel/compositionAPI/ClassAPI.js +44 -44
  74. package/src/ACarousel/compositionAPI/DataAPI.js +41 -41
  75. package/src/ACarousel/compositionAPI/IndicatorsAPI.js +148 -148
  76. package/src/ACarousel/compositionAPI/TextsAPI.js +25 -25
  77. package/src/ACarousel/i18n/ACarouselI18n.js +19 -19
  78. package/src/ACarousel/i18n/ar.json +8 -8
  79. package/src/ACarousel/i18n/de.json +8 -8
  80. package/src/ACarousel/i18n/en.json +8 -8
  81. package/src/ACarousel/i18n/es.json +8 -8
  82. package/src/ACarousel/i18n/fr.json +8 -8
  83. package/src/ACarousel/i18n/hr.json +8 -8
  84. package/src/ACarousel/i18n/it.json +8 -8
  85. package/src/ACarousel/i18n/ru.json +8 -8
  86. package/src/ACollapse/ACollapse.js +103 -103
  87. package/src/ADropdown/ADropdown.js +544 -544
  88. package/src/ADropdown/ADropdownGroup.js +85 -85
  89. package/src/ADropdown/compositionAPI/ActionsAPI.js +147 -147
  90. package/src/ADropdown/compositionAPI/AttributesAPI.js +100 -100
  91. package/src/AElement/AElement.js +518 -518
  92. package/src/AElement/compositionAPI/AttributesAPI.js +51 -51
  93. package/src/AElement/compositionAPI/ClickAPI.js +30 -30
  94. package/src/AElement/compositionAPI/ComponentLocalAPI.js +23 -23
  95. package/src/AElement/compositionAPI/DisabledAPI.js +22 -22
  96. package/src/AElement/compositionAPI/HtmlTitleAPI.js +33 -33
  97. package/src/AElement/compositionAPI/KeydownAPI.js +35 -35
  98. package/src/AElement/compositionAPI/LoadingAPI.js +22 -22
  99. package/src/AElement/compositionAPI/RouterLinkAPI.js +20 -20
  100. package/src/AElement/compositionAPI/SwitchAPI.js +33 -33
  101. package/src/AElement/compositionAPI/TagAPI.js +34 -34
  102. package/src/AElement/compositionAPI/TextAPI.js +78 -78
  103. package/src/AElement/compositionAPI/TitleAPI.js +29 -29
  104. package/src/AFilters/AFilterCenter/AFilterCenter.js +154 -154
  105. package/src/AFilters/AFilterCenter/AFilterCenterItem/AFilterCenterItem.js +207 -207
  106. package/src/AFilters/AFilters/AFilters.js +282 -282
  107. package/src/AFilters/i18n/ar.json +30 -30
  108. package/src/AFilters/i18n/en.json +30 -30
  109. package/src/AFilters/i18n/es.json +30 -30
  110. package/src/AFilters/i18n/fr.json +30 -30
  111. package/src/AFilters/i18n/hr.json +30 -30
  112. package/src/AFilters/i18n/it.json +30 -30
  113. package/src/AFilters/i18n/ru.json +30 -30
  114. package/src/AGroupButtonDropdown/compositionAPI/ActionsAPI.js +143 -143
  115. package/src/ALink/ALink.js +253 -253
  116. package/src/AMenu/AMenu.js +578 -578
  117. package/src/AMenu/AMenuBreadcrumbs/compositionAPI/RenderTruncatedAPI.js +74 -74
  118. package/src/AMenu/AMenuButtonToggle/AMenuButtonToggle.js +94 -94
  119. package/src/AMenu/AMenuButtonToggle/compositionAPI/ToggleAPI.js +95 -95
  120. package/src/AMenu/AMenuPanelLink/AMenuPanelLink.js +250 -250
  121. package/src/AMenu/compositionAPI/BackdropAPI.js +42 -42
  122. package/src/AMenu/compositionAPI/KeydownAPI.js +197 -197
  123. package/src/AMenu/compositionAPI/LinkClickAPI.js +48 -48
  124. package/src/AMenu/compositionAPI/MenuAttributesAPI.js +51 -51
  125. package/src/AMenu/compositionAPI/PanelsAPI.js +78 -78
  126. package/src/AMenu/compositionAPI/ResizeAPI.js +74 -74
  127. package/src/AModal/AModal.js +530 -530
  128. package/src/AModalForm/AModalForm.js +383 -383
  129. package/src/AModalWizard/AModalWizard.js +563 -563
  130. package/src/ANotification/ANotification.js +60 -60
  131. package/src/APagination/APagination.js +111 -111
  132. package/src/APagination/APaginationCountPerPage/APaginationCountPerPage.js +209 -209
  133. package/src/APagination/APaginationCountPerPage/compositionAPI/MainAPI.js +40 -40
  134. package/src/APagination/APaginationCountPerPage/compositionAPI/TextsAPI.js +54 -54
  135. package/src/APagination/APaginationPages/APaginationPages.js +282 -282
  136. package/src/APagination/APaginationPages/compositionAPI/PaginationItemsAPI.js +102 -102
  137. package/src/APagination/APaginationPages/compositionAPI/TextsAPI.js +74 -74
  138. package/src/APagination/compositionAPI/ComponentsAPI.js +79 -79
  139. package/src/APagination/i18n/ar.json +12 -12
  140. package/src/APagination/i18n/es.json +12 -12
  141. package/src/APagination/i18n/fr.json +12 -12
  142. package/src/APagination/i18n/hr.json +12 -12
  143. package/src/APagination/i18n/it.json +12 -12
  144. package/src/APagination/i18n/ru.json +12 -12
  145. package/src/APopup/APopup.js +115 -115
  146. package/src/ATable/ATable.js +1163 -1163
  147. package/src/ATable/ATableHeaderThAction/ATableHeaderThAction.js +241 -241
  148. package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.ModelAPI.test.js +200 -200
  149. package/src/ATable/ATableSortingAdditional/compositionAPI/ModelAPI.js +152 -152
  150. package/src/ATable/ATableTd/ATableTd.js +145 -145
  151. package/src/ATable/ATableTdAction/ATableTdAction.js +223 -223
  152. package/src/ATable/ATableTopPanel/ATableTopPanel.js +433 -433
  153. package/src/ATable/compositionAPI/ColumnActionAPI.js +105 -105
  154. package/src/ATable/compositionAPI/ColumnStylesAPI.js +50 -50
  155. package/src/ATable/compositionAPI/ColumnsGroupedAPI.js +187 -187
  156. package/src/ATable/compositionAPI/PaginationModesAPI.js +44 -44
  157. package/src/ATable/compositionAPI/PreviewAPI.js +201 -201
  158. package/src/ATable/compositionAPI/PreviewRightResizeAPI.js +135 -135
  159. package/src/ATable/compositionAPI/ScrollControlAPI.js +249 -249
  160. package/src/ATable/compositionAPI/SortAPI.js +86 -86
  161. package/src/ATable/compositionAPI/WidthAPI.js +73 -73
  162. package/src/ATableForm/ATableForm.js +610 -602
  163. package/src/ATableForm/ATableFormCell/ATableFormCell.js +183 -183
  164. package/src/ATableForm/ATableFormCell/compositionAPI/DisabledAPI.js +20 -20
  165. package/src/ATableForm/ATableFormCell/compositionAPI/ReadonlyAPI.js +28 -28
  166. package/src/ATableForm/ATableFormCellAction/ATableFormCellAction.js +282 -282
  167. package/src/ATableForm/ATableFormCellAction/compositionAPI/DeleteAPI.js +80 -80
  168. package/src/ATableForm/ATableFormCellAction/compositionAPI/DisabledAPI.js +60 -60
  169. package/src/ATableForm/ATableFormCellAction/compositionAPI/HiddenAPI.js +46 -46
  170. package/src/ATableForm/ATableFormCellAction/compositionAPI/IdsAPI.js +31 -31
  171. package/src/ATableForm/ATableFormCellAction/compositionAPI/StylesAPI.js +29 -28
  172. package/src/ATableForm/ATableFormCellAction/compositionAPI/TitleAPI.js +47 -47
  173. package/src/ATableForm/ATableFormCellDnd/ATableFormCellDnd.js +6 -1
  174. package/src/ATableForm/ATableFormCellDnd/compositionAPI/IdAPI.js +21 -21
  175. package/src/ATableForm/ATableFormCellList/compositionAPI/DataAPI.js +61 -61
  176. package/src/ATableForm/ATableFormRow/ATableFormRow.js +580 -574
  177. package/src/ATableForm/ATableFormRow/compositionAPI/ErrorsAPI.js +40 -40
  178. package/src/ATableForm/ATableFormRow/compositionAPI/FocusAPI.js +55 -55
  179. package/src/ATableForm/ATableFormRow/compositionAPI/IdAPI.js +19 -19
  180. package/src/ATableForm/__tests__/ATableForm.DragAndDropAPI.test.js +48 -0
  181. package/src/ATableForm/__tests__/ATableForm.ListView.test.js +672 -460
  182. package/src/ATableForm/compositionAPI/ClassesAPI.js +23 -23
  183. package/src/ATableForm/compositionAPI/ColumnsAPI.js +4 -2
  184. package/src/ATableForm/compositionAPI/ColumnsGrowAPI.js +191 -190
  185. package/src/ATableForm/compositionAPI/DeleteAPI.js +9 -9
  186. package/src/ATableForm/compositionAPI/DragAndDropAPI.js +6 -5
  187. package/src/ATableForm/compositionAPI/EditAPI.js +127 -128
  188. package/src/ATableForm/compositionAPI/RowsAPI.js +42 -42
  189. package/src/ATableForm/compositionAPI/StylesAPI.js +62 -62
  190. package/src/ATableForm/compositionAPI/WidthsAPI.js +21 -21
  191. package/src/ATableForm/i18n/ATableFormI18n.js +19 -19
  192. package/src/ATabs/ATabsContent/ATabsContent.js +102 -102
  193. package/src/ATabs/ATabsTab/ATabsTab.js +185 -185
  194. package/src/ATooltip/ATooltip.js +221 -221
  195. package/src/ATranslation/compositionAPI/UtilsAPI.js +187 -187
  196. package/src/AVerticalScroll/compositionAPI/ScrollAPI.js +55 -55
  197. package/src/AWizard/AWizard.js +467 -467
  198. package/src/compositionAPI/AEventOutsideAPI.js +46 -46
  199. package/src/compositionAPI/AMobileAPI.js +32 -32
  200. package/src/compositionAPI/APageTabTitleAPI.js +84 -84
  201. package/src/compositionAPI/ARemPxAPI.js +47 -47
  202. package/src/compositionAPI/FocusByDestroyAPI.js +67 -67
  203. package/src/const/AKeys.js +9 -9
  204. package/src/directives/AOnHooks.js +0 -0
  205. package/src/i18n/allLanguages.js +377 -377
  206. package/src/i18n/ar.json +4 -4
  207. package/src/i18n/de.json +4 -4
  208. package/src/i18n/en.json +4 -4
  209. package/src/i18n/es.json +4 -4
  210. package/src/i18n/fr.json +4 -4
  211. package/src/i18n/hr.json +4 -4
  212. package/src/i18n/it.json +4 -4
  213. package/src/i18n/ru.json +4 -4
  214. package/src/index.js +402 -402
  215. package/src/plugins/AAlertPlugin.js +53 -53
  216. package/src/plugins/ACarouselPlugin.js +34 -34
  217. package/src/plugins/ADatepickerPlugin.js +57 -57
  218. package/src/plugins/AFiltersPlugin.js +102 -102
  219. package/src/plugins/AInputCurrencyPlugin.js +31 -31
  220. package/src/plugins/AMobilePlugin.js +32 -32
  221. package/src/plugins/ARemPxPlugin.js +37 -37
  222. package/src/plugins/ASelectPlugin.js +54 -54
  223. package/src/plugins/ASelectStylesPlugin.js +2376 -2376
  224. package/src/temp/px_to_rem_mapping_1_to_800.md +802 -802
  225. package/src/ui/ACheckbox/ACheckbox.js +929 -929
  226. package/src/ui/ACheckbox/ACheckboxItem/ACheckboxItem.js +0 -0
  227. package/src/ui/ACheckboxRadioGroups/ACheckboxRadioGroups.js +0 -0
  228. package/src/ui/ADatepicker/ADatepicker.js +807 -807
  229. package/src/ui/ADatepicker/ADatepickerCalendarPanel/ADatepickerCalendarPanel.js +796 -796
  230. package/src/ui/ADatepicker/ADatepickerCalendarPanel/compositionAPI/CalendarAPI.js +51 -51
  231. package/src/ui/ADatepicker/compositionAPI/LanguagesAPI.js +92 -92
  232. package/src/ui/ADatepicker/compositionAPI/PlaceholderAPI.js +55 -55
  233. package/src/ui/ADatepicker/i18n/ADatepickerI18n.js +19 -19
  234. package/src/ui/ADatepicker/i18n/ar.json +47 -47
  235. package/src/ui/ADatepicker/i18n/de.json +48 -48
  236. package/src/ui/ADatepicker/i18n/en.json +48 -48
  237. package/src/ui/ADatepicker/i18n/es.json +47 -47
  238. package/src/ui/ADatepicker/i18n/fr.json +47 -47
  239. package/src/ui/ADatepicker/i18n/hr.json +47 -47
  240. package/src/ui/ADatepicker/i18n/it.json +47 -47
  241. package/src/ui/ADatepicker/i18n/ru.json +48 -48
  242. package/src/ui/ADatepicker/panel/APanelDate/APanelDate.js +196 -196
  243. package/src/ui/ADatepicker/panel/APanelDate/compositionAPI/DatesAPI.js +66 -66
  244. package/src/ui/ADatepicker/panel/APanelDate/compositionAPI/FocusAPI.js +96 -96
  245. package/src/ui/ADatepicker/panel/APanelDate/compositionAPI/FocusActiveAPI.js +27 -27
  246. package/src/ui/ADatepicker/panel/APanelDate/compositionAPI/SelectAPI.js +21 -21
  247. package/src/ui/ADatepicker/panel/APanelDate/compositionAPI/TableAPI.js +128 -128
  248. package/src/ui/ADatepicker/panel/APanelMonth/APanelMonth.js +129 -129
  249. package/src/ui/ADatepicker/panel/APanelMonth/compositionAPI/FocusAPI.js +94 -94
  250. package/src/ui/ADatepicker/panel/APanelMonth/compositionAPI/FocusActiveAPI.js +21 -21
  251. package/src/ui/ADatepicker/panel/APanelMonth/compositionAPI/MonthsAPI.js +51 -51
  252. package/src/ui/ADatepicker/panel/APanelMonth/compositionAPI/SelectAPI.js +29 -29
  253. package/src/ui/ADatepicker/panel/APanelYearItem/APanelYearItem.js +75 -75
  254. package/src/ui/ADatepicker/panel/APanelYearItem/compositionAPI/AttributesAPI.js +35 -35
  255. package/src/ui/ADatepicker/panel/APanelYearItem/compositionAPI/SelectAPI.js +35 -35
  256. package/src/ui/ADatepickerRange/ADatepickerRange.js +537 -537
  257. package/src/ui/AErrors/AErrors.js +149 -149
  258. package/src/ui/AErrors/AErrorsElement/AErrorsElement.js +0 -0
  259. package/src/ui/AErrors/i18n/AErrorsI18n.js +19 -19
  260. package/src/ui/AErrors/i18n/ar.json +3 -3
  261. package/src/ui/AErrors/i18n/de.json +2 -2
  262. package/src/ui/AErrors/i18n/en.json +3 -3
  263. package/src/ui/AErrors/i18n/es.json +3 -3
  264. package/src/ui/AErrors/i18n/fr.json +3 -3
  265. package/src/ui/AErrors/i18n/hr.json +3 -3
  266. package/src/ui/AErrors/i18n/it.json +3 -3
  267. package/src/ui/AErrors/i18n/ru.json +3 -3
  268. package/src/ui/AErrorsText/AErrorsText.js +62 -62
  269. package/src/ui/AFieldset/AFieldset.js +535 -535
  270. package/src/ui/AFieldset/compositionAPI/ModelAPI.js +54 -54
  271. package/src/ui/AForm/AForm.js +252 -252
  272. package/src/ui/AFormElement/AFormElement.js +160 -160
  273. package/src/ui/AFormElementBtnClear/AFormElementBtnClear.js +86 -86
  274. package/src/ui/AFormElementBtnClear/i18n/AFormElementBtnClearI18n.js +19 -19
  275. package/src/ui/AFormElementBtnClear/i18n/ar.json +2 -2
  276. package/src/ui/AFormElementBtnClear/i18n/de.json +2 -2
  277. package/src/ui/AFormElementBtnClear/i18n/en.json +2 -2
  278. package/src/ui/AFormElementBtnClear/i18n/es.json +2 -2
  279. package/src/ui/AFormElementBtnClear/i18n/fr.json +2 -2
  280. package/src/ui/AFormElementBtnClear/i18n/hr.json +2 -2
  281. package/src/ui/AFormElementBtnClear/i18n/it.json +2 -2
  282. package/src/ui/AFormElementBtnClear/i18n/ru.json +2 -2
  283. package/src/ui/AFormHelpText/AFormHelpText.js +37 -37
  284. package/src/ui/AFormLabelDescription/AFormLabelDescription.js +43 -43
  285. package/src/ui/AFormReadonly/AFormReadonly.js +193 -193
  286. package/src/ui/AGroup/AGroup.js +427 -427
  287. package/src/ui/AInput/AInput.js +516 -516
  288. package/src/ui/AInput/compositionAPI/ClassAPI.js +43 -43
  289. package/src/ui/AInputCurrency/AInputCurrency.js +620 -620
  290. package/src/ui/AInputCurrency/compositionAPI/IncreaseDecreaseAPI.js +76 -76
  291. package/src/ui/AInputCurrency/compositionAPI/InputEventsAPI.js +751 -751
  292. package/src/ui/AInputCurrency/compositionAPI/ModelAPI.js +88 -88
  293. package/src/ui/AInputCurrency/compositionAPI/UtilsAPI.js +54 -54
  294. package/src/ui/AInputFile/AInputFile.js +247 -247
  295. package/src/ui/AInputNumber/AInputNumber.js +497 -497
  296. package/src/ui/AInputNumber/compositionAPI/InputEventsAPI.js +196 -196
  297. package/src/ui/AInputNumber/compositionAPI/ModelAPI.js +72 -72
  298. package/src/ui/AInputNumberRange/AInputNumberRange.js +517 -517
  299. package/src/ui/AJson/AJson.js +434 -434
  300. package/src/ui/ALabel/ALabel.js +0 -0
  301. package/src/ui/AMultiselectOrdered/AMultiselectOrdered.js +935 -935
  302. package/src/ui/AOneCheckbox/AOneCheckbox.js +366 -366
  303. package/src/ui/ARadio/ARadio.js +924 -924
  304. package/src/ui/ARadio/ARadioItem/ARadioItem.js +0 -0
  305. package/src/ui/ARequired/ARequired.js +0 -0
  306. package/src/ui/ARouterLinkConfig/ARouterLinkConfig.js +391 -391
  307. package/src/ui/ARouterLinkConfig/compositionAPI/DataFormAPI.js +102 -102
  308. package/src/ui/ARouterLinkConfig/compositionAPI/ModelLocalAPI.js +96 -96
  309. package/src/ui/ARouterLinkConfig/compositionAPI/RouteAPI.js +51 -51
  310. package/src/ui/ASelect/ASelect.js +1339 -1339
  311. package/src/ui/ASelect/ASelectElement/ASelectElement.js +0 -0
  312. package/src/ui/ASelect/ASelectValueCloseable/ASelectValueCloseable.js +1 -1
  313. package/src/ui/ASelect/ASelectValueCloseable/compositionAPI/CloseAPI.js +28 -28
  314. package/src/ui/ASelect/compositionAPI/ToggleAPI.js +255 -255
  315. package/src/ui/ASelect/i18n/ar.json +6 -6
  316. package/src/ui/ASelect/i18n/de.json +7 -7
  317. package/src/ui/ASelect/i18n/en.json +6 -6
  318. package/src/ui/ASelect/i18n/es.json +6 -6
  319. package/src/ui/ASelect/i18n/fr.json +6 -6
  320. package/src/ui/ASelect/i18n/hr.json +6 -6
  321. package/src/ui/ASelect/i18n/it.json +6 -6
  322. package/src/ui/ASelect/i18n/ru.json +6 -6
  323. package/src/ui/ASelectIcon/ASelectIcon.js +386 -386
  324. package/src/ui/ASelectStyle/ASelectStyle.js +391 -391
  325. package/src/ui/ASelectStyle/compositionAPI/DataAPI.js +68 -68
  326. package/src/ui/ASelectStyle/compositionAPI/EventsAPI.js +24 -24
  327. package/src/ui/ASelectStyle/compositionAPI/KeyLabelCallbackAPI.js +15 -15
  328. package/src/ui/ASelectStyle/compositionAPI/TypeAPI.js +24 -24
  329. package/src/ui/ASelectStyle/i18n/ASelectStyleI18n.js +19 -19
  330. package/src/ui/ASelectStyle/i18n/ar.json +277 -277
  331. package/src/ui/ASelectStyle/i18n/de.json +277 -277
  332. package/src/ui/ASelectStyle/i18n/en.json +277 -277
  333. package/src/ui/ASelectStyle/i18n/es.json +277 -277
  334. package/src/ui/ASelectStyle/i18n/fr.json +277 -277
  335. package/src/ui/ASelectStyle/i18n/hr.json +277 -277
  336. package/src/ui/ASelectStyle/i18n/it.json +277 -277
  337. package/src/ui/ASelectStyle/i18n/ru.json +277 -277
  338. package/src/ui/ASlider/ASlider.js +672 -672
  339. package/src/ui/ASlider/compositionAPI/AriaAttributesAPI.js +121 -121
  340. package/src/ui/ASlider/compositionAPI/AttributesAPI.js +15 -15
  341. package/src/ui/ASlider/compositionAPI/DataAPI.js +115 -115
  342. package/src/ui/ASlider/compositionAPI/DragAndDropAPI.js +198 -198
  343. package/src/ui/ASlider/compositionAPI/LabelAPI.js +13 -13
  344. package/src/ui/ASlider/compositionAPI/MarksAPI.js +32 -32
  345. package/src/ui/ASlider/compositionAPI/SliderAPI.js +289 -289
  346. package/src/ui/ASlider/compositionAPI/StopsAPI.js +47 -47
  347. package/src/ui/ASlider/compositionAPI/StylesAPI.js +79 -79
  348. package/src/ui/ASlider/compositionAPI/TitleAPI.js +42 -42
  349. package/src/ui/ASlider/i18n/ASliderI18n.js +19 -19
  350. package/src/ui/ASlider/i18n/en.json +4 -4
  351. package/src/ui/ASwitch/ASwitch.js +442 -442
  352. package/src/ui/ATemplate/ATemplate.js +0 -0
  353. package/src/ui/ATextarea/ATextarea.js +437 -437
  354. package/src/ui/AUiComponents.js +59 -59
  355. package/src/ui/AUiContainerComponents.js +12 -12
  356. package/src/ui/AValidatedJson/AValidatedJson.js +594 -594
  357. package/src/ui/AValidatedJson/AValidatedJsonItem/compositionAPI/DeleteAPI.js +63 -63
  358. package/src/ui/AValidatedJson/AValidatedJsonItem/compositionAPI/DetailsAPI.js +59 -59
  359. package/src/ui/AValidatedJson/AValidatedJsonItem/compositionAPI/MoveAPI.js +50 -50
  360. package/src/ui/AValidatedJson/AValidatedJsonItem/compositionAPI/UpdateAPI.js +48 -48
  361. package/src/ui/AValidatedJson/AValidatedJsonModalCreateOrUpdate/composiitionAPI/DataFormAPI.js +69 -69
  362. package/src/ui/AValidatedJson/AValidatedJsonModalCreateOrUpdate/composiitionAPI/DisabledAPI.js +35 -35
  363. package/src/ui/AValidatedJson/AValidatedJsonModalCreateOrUpdate/composiitionAPI/ModelAPI.js +31 -31
  364. package/src/ui/AValidatedJson/AValidatedJsonModalCreateOrUpdate/composiitionAPI/SaveAPI.js +115 -115
  365. package/src/ui/AValidatedJson/AValidatedJsonModalCreateOrUpdate/composiitionAPI/TextAPI.js +25 -25
  366. package/src/ui/AValidatedJson/compositionAPI/AValidatedJsonErrorLabelsAPI.js +18 -18
  367. package/src/ui/AValidatedJson/compositionAPI/AttributesAPI.js +15 -15
  368. package/src/ui/AValidatedJson/compositionAPI/ChildrenAPI.js +70 -70
  369. package/src/ui/AValidatedJson/compositionAPI/EventsAPI.js +19 -19
  370. package/src/ui/AValidatedJson/compositionAPI/JsonModeAPI.js +119 -119
  371. package/src/ui/AValidatedJson/compositionAPI/ListModeAPI.js +144 -144
  372. package/src/ui/AValidatedJson/compositionAPI/ModelAPI.js +38 -38
  373. package/src/ui/AValidatedJson/compositionAPI/SingleModeAPI.js +112 -112
  374. package/src/ui/AValidatedJson/compositionAPI/TranslateAPI.js +22 -22
  375. package/src/ui/AValidatedJson/i18n/AValidatedJsonI18n.js +19 -19
  376. package/src/ui/AValidatedJson/i18n/ar.json +3 -3
  377. package/src/ui/AValidatedJson/i18n/de.json +22 -22
  378. package/src/ui/AValidatedJson/i18n/en.json +3 -3
  379. package/src/ui/AValidatedJson/i18n/es.json +3 -3
  380. package/src/ui/AValidatedJson/i18n/fr.json +3 -3
  381. package/src/ui/AValidatedJson/i18n/hr.json +3 -3
  382. package/src/ui/AValidatedJson/i18n/it.json +3 -3
  383. package/src/ui/AValidatedJson/i18n/ru.json +6 -6
  384. package/src/ui/compositionApi/UIDataGroupAPI.js +94 -94
  385. package/src/ui/compositionApi/UiAPI.js +185 -185
  386. package/src/ui/compositionApi/UiClearButtonAPI.js +19 -19
  387. package/src/ui/compositionApi/UiDataSortAPI.js +29 -29
  388. package/src/ui/compositionApi/UiDataWithKeyIdAndLabelAPI.js +155 -155
  389. package/src/ui/const/AUiTypes.js +69 -69
  390. package/src/ui/mixins/UiMixinProps.js +129 -129
  391. package/src/ui/utils/utils.js +79 -79
  392. package/src/utils/__tests__/utils.aOrderBy.test.js +237 -237
  393. package/src/utils/__tests__/utils.aSortBy.test.js +331 -331
  394. package/src/utils/__tests__/utilsArray.aFirst.test.js +54 -54
  395. package/src/utils/__tests__/utilsArray.aLast.test.js +54 -54
  396. package/src/utils/__tests__/utilsLang.isArguments.test.js +52 -52
  397. package/src/utils/__tests__/utilsLang.isArray.test.js +50 -50
  398. package/src/utils/__tests__/utilsLang.isArrayBuffer.test.js +48 -48
  399. package/src/utils/__tests__/utilsLang.isBoolean.test.js +56 -56
  400. package/src/utils/__tests__/utilsLang.isBuffer.test.js +47 -47
  401. package/src/utils/__tests__/utilsLang.isDate.test.js +54 -54
  402. package/src/utils/__tests__/utilsLang.isElement.test.js +53 -53
  403. package/src/utils/__tests__/utilsLang.isError.test.js +52 -52
  404. package/src/utils/__tests__/utilsLang.isFinite.test.js +57 -57
  405. package/src/utils/__tests__/utilsLang.isFunction.test.js +46 -46
  406. package/src/utils/__tests__/utilsLang.isInteger.test.js +58 -58
  407. package/src/utils/__tests__/utilsLang.isMap.test.js +50 -50
  408. package/src/utils/__tests__/utilsLang.isNaN.test.js +55 -55
  409. package/src/utils/__tests__/utilsLang.isNil.test.js +57 -57
  410. package/src/utils/__tests__/utilsLang.isNull.test.js +53 -53
  411. package/src/utils/__tests__/utilsLang.isNumber.test.js +54 -54
  412. package/src/utils/__tests__/utilsLang.isObject.test.js +49 -49
  413. package/src/utils/__tests__/utilsLang.isObjectLike.test.js +45 -45
  414. package/src/utils/__tests__/utilsLang.isPlainObject.test.js +60 -60
  415. package/src/utils/__tests__/utilsLang.isPromise.test.js +93 -93
  416. package/src/utils/__tests__/utilsLang.isRegExp.test.js +46 -46
  417. package/src/utils/__tests__/utilsLang.isSet.test.js +50 -50
  418. package/src/utils/__tests__/utilsLang.isString.test.js +50 -50
  419. package/src/utils/__tests__/utilsLang.isSymbol.test.js +45 -45
  420. package/src/utils/__tests__/utilsLang.isUndefined.test.js +57 -57
  421. package/src/utils/__tests__/utilsLang.isWeakMap.test.js +49 -49
  422. package/src/utils/__tests__/utilsLang.isWeakSet.test.js +49 -49
  423. package/src/utils/actions.js +67 -67
  424. package/src/utils/autosize.js +277 -277
  425. package/src/utils/isBrowser.js +12 -12
  426. package/src/utils/utils.js +253 -253
  427. package/src/utils/utilsArray.js +29 -29
  428. package/src/utils/utilsDOM.js +188 -188
  429. package/src/utils/utilsLang.js +346 -346
@@ -1,807 +1,807 @@
1
- /* eslint vue/component-api-style: off */
2
- import {
3
- computed,
4
- h,
5
- ref,
6
- Teleport,
7
- toRef,
8
- watch,
9
- withDirectives,
10
- } from "vue";
11
- import {
12
- AErrorsText,
13
- AFormHelpText,
14
- AFormLabelDescription,
15
- AFormReadonly,
16
- AIcon,
17
- ALabel,
18
- APlacements,
19
- UiAPI,
20
- UIExcludeRenderAttributesAPI,
21
- UiInputAutofillAPI,
22
- UiStyleHideAPI,
23
- } from "../../index";
24
-
25
- import ADatepickerCalendarPanel from "./ADatepickerCalendarPanel/ADatepickerCalendarPanel";
26
- import ADatepickerIcon from "./ADatepickerIcon/ADatepickerIcon";
27
-
28
- import AttributesAPI from "./compositionAPI/AttributesAPI";
29
- import EventsAPI from "./compositionAPI/EventsAPI";
30
- import LanguagesAPI from "./compositionAPI/LanguagesAPI";
31
- import PlaceholderAPI from "./compositionAPI/PlaceholderAPI";
32
- import PopoverAPI from "./compositionAPI/PopoverAPI";
33
- import RefsAPI from "./compositionAPI/RefsAPI";
34
- import TypeAPI from "./compositionAPI/TypeAPI";
35
-
36
- import AOnHooks from "../../directives/AOnHooks";
37
- import UiMixinProps from "../mixins/UiMixinProps";
38
- import {
39
- ADatepickerPluginOptions,
40
- } from "../../plugins/ADatepickerPlugin";
41
- import {
42
- isPlainObject,
43
- isValidDate,
44
- } from "./utils";
45
- import {
46
- transformDate,
47
- } from "./utils/transform";
48
-
49
- // @vue/component
50
- export default {
51
- name: "ADatepicker",
52
- mixins: [
53
- UiMixinProps,
54
- ],
55
- inheritAttrs: false,
56
- props: {
57
- alwaysTranslate: {
58
- type: Boolean,
59
- required: false,
60
- },
61
- appendToBody: {
62
- type: Boolean,
63
- default: () => ADatepickerPluginOptions.propsDefault.appendToBody,
64
- },
65
- class: {
66
- type: [String, Object],
67
- required: false,
68
- default: () => ADatepickerPluginOptions.propsDefault.class,
69
- },
70
- clearable: {
71
- type: Boolean,
72
- default: () => ADatepickerPluginOptions.propsDefault.clearable,
73
- },
74
- confirm: {
75
- type: Boolean,
76
- default: () => ADatepickerPluginOptions.propsDefault.confirm,
77
- },
78
- confirmText: {
79
- type: String,
80
- default: () => ADatepickerPluginOptions.propsDefault.confirmText,
81
- },
82
- dateFormat: {
83
- type: String, // format the time header and date tooltip
84
- default: () => ADatepickerPluginOptions.propsDefault.dateFormat,
85
- },
86
- disabled: {
87
- type: Boolean,
88
- default: false,
89
- },
90
- editable: {
91
- type: Boolean,
92
- default: () => ADatepickerPluginOptions.propsDefault.editable,
93
- },
94
- errorIcon: {
95
- type: [String, Object],
96
- required: false,
97
- default: undefined,
98
- },
99
- excludeRenderAttributes: {
100
- type: Array,
101
- required: false,
102
- default: () => [],
103
- },
104
- firstDayOfWeek: {
105
- type: Number,
106
- required: false,
107
- default: () => ADatepickerPluginOptions.propsDefault.firstDayOfWeek,
108
- validator: val => val >= 1 && val <= 7,
109
- },
110
- focusStartDate: {
111
- type: Boolean,
112
- default: () => ADatepickerPluginOptions.propsDefault.focusStartDate,
113
- },
114
- format: {
115
- type: [String, Object],
116
- required: false,
117
- default: () => ADatepickerPluginOptions.propsDefault.format,
118
- },
119
- formatSave: {
120
- type: String,
121
- required: false,
122
- default: () => ADatepickerPluginOptions.propsDefault.formatSave,
123
- },
124
- iconDay: {
125
- type: [Number, String],
126
- default: () => ADatepickerPluginOptions.propsDefault.iconDay,
127
- },
128
- inputAttr: {
129
- type: Object,
130
- required: false,
131
- default: () => ADatepickerPluginOptions.propsDefault.inputAttr,
132
- },
133
- inputClass: {
134
- type: [String, Number, Boolean, Array, Object, Date, Function, Symbol],
135
- default: () => ADatepickerPluginOptions.propsDefault.inputClass,
136
- },
137
- inputName: {
138
- type: String,
139
- default: () => ADatepickerPluginOptions.propsDefault.inputName,
140
- },
141
- isLabelFloat: {
142
- type: Boolean,
143
- required: false,
144
- default: () => ADatepickerPluginOptions.propsDefault.isLabelFloat,
145
- },
146
- labelScreenReader: {
147
- type: String,
148
- required: false,
149
- default: undefined,
150
- },
151
- maxDate: {
152
- type: [String, Date],
153
- required: false,
154
- default: () => ADatepickerPluginOptions.propsDefault.maxDate,
155
- },
156
- minDate: {
157
- type: [String, Date],
158
- required: false,
159
- default: () => ADatepickerPluginOptions.propsDefault.minDate,
160
- },
161
- minuteStep: {
162
- type: Number,
163
- required: false,
164
- default: () => ADatepickerPluginOptions.propsDefault.minuteStep,
165
- validator: val => val >= 0 && val <= 60,
166
- },
167
- timePrecision: {
168
- type: String,
169
- required: false,
170
- default: () => ADatepickerPluginOptions.propsDefault.timePrecision,
171
- validator: value => ["hour", "minute", "second"].indexOf(value) !== -1,
172
- },
173
- modelValue: {
174
- type: [String, Number, Boolean, Array, Object, Date, Function, Symbol],
175
- default: undefined,
176
- },
177
- placeholder: {
178
- type: String,
179
- default: () => ADatepickerPluginOptions.propsDefault.placeholder,
180
- },
181
- placeholdersDefault: {
182
- type: Object,
183
- required: false,
184
- default: () => ADatepickerPluginOptions.propsDefault.placeholdersDefault,
185
- },
186
- placement: {
187
- type: String,
188
- required: false,
189
- default: () => ADatepickerPluginOptions.propsDefault.placement,
190
- validator: placement => APlacements.indexOf(placement) !== -1,
191
- },
192
- popupStyle: {
193
- type: Object,
194
- required: false,
195
- default: () => ADatepickerPluginOptions.propsDefault.popupStyle,
196
- },
197
- range: {
198
- type: Boolean,
199
- default: () => ADatepickerPluginOptions.propsDefault.range,
200
- },
201
- rangeSeparator: {
202
- type: String,
203
- default: () => ADatepickerPluginOptions.propsDefault.rangeSeparator,
204
- },
205
- readonly: {
206
- type: Boolean,
207
- required: false,
208
- },
209
- readonlyDefault: {
210
- type: String,
211
- required: false,
212
- default: () => ADatepickerPluginOptions.propsDefault.readonlyDefault,
213
- },
214
- shortcuts: {
215
- type: [Boolean, Array],
216
- default: () => ADatepickerPluginOptions.propsDefault.shortcuts,
217
- },
218
- startDate: {
219
- type: [String, Date],
220
- required: false,
221
- default: () => ADatepickerPluginOptions.propsDefault.startDate,
222
- },
223
- type: {
224
- type: String,
225
- default: () => ADatepickerPluginOptions.propsDefault.type, // ["date", "datetime"] zendy added "month", "year", mxie added "time"
226
- validator: value => ["date", "datetime", "month", "year", "time"].indexOf(value) !== -1,
227
- },
228
- valueType: {
229
- default: () => ADatepickerPluginOptions.propsDefault.valueType,
230
- validator: function(value) {
231
- return ["timestamp", "format", "date"].indexOf(value) !== -1 || isPlainObject(value);
232
- },
233
- },
234
- width: {
235
- type: [String, Number],
236
- default: () => ADatepickerPluginOptions.propsDefault.width,
237
- },
238
- },
239
- emits: [
240
- "blur",
241
- "change",
242
- "clear",
243
- "confirm",
244
- "focus",
245
- "input",
246
- "inputError",
247
- "changeCalendarMonth",
248
- "changeCalendarYear",
249
- ],
250
- setup(props, context) {
251
- const modelValue = toRef(props, "modelValue");
252
- const isInputFocused = ref(false);
253
-
254
- const {
255
- formatLocal,
256
- formatSaveLocal,
257
- } = TypeAPI(props);
258
-
259
- const {
260
- attributesToExcludeFromRender,
261
- } = UIExcludeRenderAttributesAPI(props);
262
-
263
- const {
264
- calendarRef,
265
- calendarPanelRef,
266
- calendarPanel2Ref,
267
- focusByCloseRef,
268
- inputRef,
269
- } = RefsAPI();
270
-
271
- const {
272
- componentStyleHide,
273
- } = UiStyleHideAPI(props);
274
-
275
- const {
276
- ariaDescribedbyLocal,
277
- changeModel,
278
- clearModel,
279
- errorsId,
280
- helpTextId,
281
- htmlIdLocal,
282
- isErrors,
283
- isModel,
284
- labelDescriptionId,
285
- onBlur,
286
- onFocus,
287
- } = UiAPI(props, context);
288
-
289
- const {
290
- isAutofill,
291
- } = UiInputAutofillAPI({ inputRef });
292
-
293
- const hasErrorIcon = computed(() => !!(isErrors.value && props.errorIcon));
294
-
295
- const {
296
- currentLanguage,
297
- } = LanguagesAPI();
298
-
299
- const {
300
- closePopover,
301
- destroyPopover,
302
- initCalendar,
303
- openPopoverWithFloatingUi,
304
- popupVisible,
305
- setCloseFocus,
306
- } = PopoverAPI(props, {
307
- calendarRef,
308
- focusByCloseRef,
309
- inputRef,
310
- });
311
-
312
- const {
313
- ariaExpandedForCalendar,
314
- ariaHiddenForCalendar,
315
- idForCalendar,
316
- idForPanel,
317
- idsForPanelRange,
318
- innerType,
319
- widthLocal,
320
- } = AttributesAPI(props, {
321
- currentLanguage,
322
- popupVisible,
323
- });
324
-
325
- const {
326
- clearDate,
327
- confirmDate,
328
- currentValue,
329
- emitDate,
330
- handleChange,
331
- handleInput,
332
- handleKeydown,
333
- initCurrentValue,
334
- onModelValueChange,
335
- parse,
336
- selectDate,
337
- selectEndDate,
338
- selectEndTime,
339
- selectStartDate,
340
- selectStartTime,
341
- selectTime,
342
- stringify,
343
- text,
344
- updateDate,
345
- userInput,
346
- } = EventsAPI(props, context, {
347
- calendarPanelRef,
348
- changeModel,
349
- closePopover,
350
- formatLocal,
351
- formatSaveLocal,
352
- setCloseFocus,
353
- });
354
-
355
- const {
356
- innerPlaceholder,
357
- } = PlaceholderAPI(props, {
358
- isInputFocused,
359
- text,
360
- });
361
-
362
- const blur = () => {
363
- inputRef.value && inputRef.value.blur();
364
- };
365
-
366
- initCurrentValue();
367
-
368
- watch(modelValue, onModelValueChange, {
369
- immediate: true,
370
- });
371
-
372
- return {
373
- ariaDescribedbyLocal,
374
- ariaExpandedForCalendar,
375
- ariaHiddenForCalendar,
376
- attributesToExcludeFromRender,
377
- blur,
378
- calendarPanel2Ref,
379
- calendarPanelRef,
380
- calendarRef,
381
- changeModel,
382
- clearDate,
383
- clearModel,
384
- parse,
385
- closePopover,
386
- componentStyleHide,
387
- confirmDate,
388
- stringify,
389
- currentLanguage,
390
- currentValue,
391
- destroyPopover,
392
- emitDate,
393
- errorsId,
394
- hasErrorIcon,
395
- text,
396
- focusByCloseRef,
397
- formatLocal,
398
- handleChange,
399
- handleInput,
400
- handleKeydown,
401
- helpTextId,
402
- htmlIdLocal,
403
- idForCalendar,
404
- idForPanel,
405
- idsForPanelRange,
406
- initCalendar,
407
- isInputFocused,
408
- innerPlaceholder,
409
- innerType,
410
- inputRef,
411
- isAutofill,
412
- isErrors,
413
- isModel,
414
- labelDescriptionId,
415
- onBlur,
416
- onFocus,
417
- openPopoverWithFloatingUi,
418
- popupVisible,
419
- selectDate,
420
- selectEndDate,
421
- selectEndTime,
422
- selectStartDate,
423
- selectStartTime,
424
- selectTime,
425
- setCloseFocus,
426
- updateDate,
427
- userInput,
428
- widthLocal,
429
- };
430
- },
431
- computed: {
432
- transform() {
433
- const type = this.valueType;
434
- if (isPlainObject(type)) {
435
- return { ...transformDate.date, ...type };
436
- }
437
- if (type === "format") {
438
- return {
439
- value2date: this.parse.bind(this),
440
- date2value: this.stringify.bind(this),
441
- };
442
- }
443
- return transformDate[type] || transformDate.date;
444
- },
445
-
446
- showClearIcon() {
447
- return !this.disabled && this.clearable && this.text;
448
- },
449
-
450
- innerShortcuts() {
451
- if (Array.isArray(this.shortcuts)) {
452
- return this.shortcuts;
453
- }
454
- if (this.shortcuts === false) {
455
- return [];
456
- }
457
- const pickers = this.currentLanguage.pickers;
458
- const arr = [
459
- {
460
- text: pickers[0],
461
- onClick(self) {
462
- self.currentValue = [new Date(), new Date(Date.now() + 3600 * 1000 * 24 * 7)];
463
- self.updateDate(true);
464
- },
465
- },
466
- {
467
- text: pickers[1],
468
- onClick(self) {
469
- self.currentValue = [new Date(), new Date(Date.now() + 3600 * 1000 * 24 * 30)];
470
- self.updateDate(true);
471
- },
472
- },
473
- {
474
- text: pickers[2],
475
- onClick(self) {
476
- self.currentValue = [new Date(Date.now() - 3600 * 1000 * 24 * 7), new Date()];
477
- self.updateDate(true);
478
- },
479
- },
480
- {
481
- text: pickers[3],
482
- onClick(self) {
483
- self.currentValue = [new Date(Date.now() - 3600 * 1000 * 24 * 30), new Date()];
484
- self.updateDate(true);
485
- },
486
- },
487
- ];
488
- return arr;
489
- },
490
-
491
- innerDateFormat() {
492
- if (this.dateFormat) {
493
- return this.dateFormat;
494
- }
495
- if (typeof this.formatLocal !== "string") {
496
- return "YYYY-MM-DD";
497
- }
498
- if (this.innerType === "date") {
499
- return this.formatLocal;
500
- }
501
- return this.formatLocal.replace(/[Hh]+.*[msSaAZ]|\[.*?\]/g, "").trim() || "YYYY-MM-DD";
502
- },
503
- },
504
- watch: {
505
- popupVisible(val) {
506
- if (val) {
507
- this.initCalendar();
508
- } else {
509
- this.userInput = null;
510
- this.blur();
511
- }
512
- },
513
- },
514
- methods: {
515
- isValidValue(value) {
516
- const { value2date } = this.transform;
517
- return isValidDate(value2date(value));
518
- },
519
-
520
- isValidRangeValue(value) {
521
- const { value2date } = this.transform;
522
- return Array.isArray(value) && value.length === 2 && this.isValidValue(value[0]) &&
523
- this.isValidValue(value[1]) && (value2date(value[1]).getTime() >= value2date(value[0]).getTime());
524
- },
525
-
526
- selectRange(range) {
527
- if (typeof range.onClick === "function") {
528
- const close = range.onClick(this);
529
- if (close !== false) {
530
- this.closePopover();
531
- }
532
- } else {
533
- this.currentValue = [new Date(range.start), new Date(range.end)];
534
- this.updateDate(true);
535
- this.closePopover();
536
- }
537
- },
538
-
539
- handleBlur(event) {
540
- this.isInputFocused = false;
541
- this.$emit("blur", event);
542
- },
543
-
544
- handleFocus(event) {
545
- this.isInputFocused = true;
546
- this.initCalendar();
547
- this.$emit("focus", event);
548
- },
549
- },
550
- render() {
551
- if (!this.isRender) {
552
- return null;
553
- }
554
-
555
- if (this.readonly) {
556
- return h(AFormReadonly, {
557
- ...this.$attrs,
558
- id: this.htmlIdLocal,
559
- alwaysTranslate: this.alwaysTranslate,
560
- excludeRenderAttributes: this.excludeRenderAttributes,
561
- extra: this.extra,
562
- helpText: this.helpText,
563
- label: this.label,
564
- labelClass: this.labelClass,
565
- labelScreenReader: this.labelScreenReader,
566
- modelValue: this.text,
567
- readonlyDefault: this.readonlyDefault,
568
- required: this.required,
569
- style: this.componentStyleHide,
570
- type: this.type,
571
- });
572
- }
573
-
574
- return h("div", {
575
- ...this.$attrs,
576
- class: [
577
- this.class,
578
- "a_form_element__container",
579
- ],
580
- style: this.componentStyleHide,
581
- ...this.attributesToExcludeFromRender,
582
- }, [
583
- h("div", {
584
- class: ["a_form_element__parent", {
585
- a_form_element__parent_float: this.isLabelFloat,
586
- a_form_element__parent_float_has_error_icon: this.hasErrorIcon,
587
- a_form_element__parent_not_empty: this.isModel || this.isAutofill,
588
- }],
589
- }, [
590
- this.label && h(ALabel, {
591
- id: this.htmlIdLocal,
592
- alwaysTranslate: this.alwaysTranslate,
593
- label: this.label,
594
- labelClass: this.labelClass,
595
- labelScreenReader: this.labelScreenReader,
596
- required: this.required,
597
- type: this.type,
598
- isLabelFloat: this.isLabelFloat,
599
- isError: this.isErrors,
600
- }),
601
- h(AFormLabelDescription, {
602
- id: this.labelDescriptionId,
603
- alwaysTranslate: this.alwaysTranslate,
604
- html: this.labelDescription,
605
- extra: this.extra,
606
- isLabelFloat: this.isLabelFloat,
607
- }),
608
- h("div", {
609
- class: "a_form_element",
610
- }, [
611
- this.hasErrorIcon ?
612
- h(AIcon, {
613
- icon: this.errorIcon,
614
- class: "a_input__icon_error pux_datepicker__error_icon",
615
- }) :
616
- "",
617
- h("div", {
618
- class: ["pux_datepicker", {
619
- pux_datepicker_range: this.range,
620
- pux_datepicker_has_error_icon: this.hasErrorIcon,
621
- disabled: this.disabled,
622
- }],
623
- style: { width: this.widthLocal },
624
- onMousedown: this.initCalendar,
625
- onTouchstart: this.initCalendar,
626
- }, [
627
- h("div", {
628
- class: "pux_datepicker__input_wrapper",
629
- role: "application",
630
- }, [
631
- h("input", {
632
- ref: "inputRef",
633
- id: this.htmlIdLocal,
634
- class: [
635
- "a_form_control pux_datepicker__input",
636
- this.inputClass,
637
- {
638
- a_form_control_invalid: this.isErrors,
639
- },
640
- ],
641
- name: this.inputName,
642
- type: "text",
643
- autocomplete: "off",
644
- disabled: this.disabled,
645
- readonly: !this.editable,
646
- value: this.text,
647
- placeholder: this.innerPlaceholder,
648
- ariaHaspopup: true,
649
- "aria-owns": this.idForCalendar,
650
- ...this.inputAttr,
651
- onKeydown: this.handleKeydown,
652
- onFocus: this.handleFocus,
653
- onBlur: this.handleBlur,
654
- onInput: this.handleInput,
655
- onChange: this.handleChange,
656
- }),
657
- this.showClearIcon && h("span", {
658
- class: "pux_datepicker__input_wrapper__append pux_datepicker__input_wrapper__clear_wrapper",
659
- ariaHidden: true,
660
- onMousedown: this.clearDate,
661
- }, [
662
- h("i", {
663
- class: "pux_datepicker__input__icon pux_datepicker__input__clear_icon",
664
- }),
665
- ]),
666
- h("span", {
667
- class: "pux_datepicker__input_wrapper__append",
668
- }, [
669
- h(ADatepickerIcon),
670
- ]),
671
- ]),
672
- h(Teleport, {
673
- to: "body",
674
- }, [
675
- this.popupVisible && withDirectives(h("div", {
676
- ref: "calendarRef",
677
- id: this.idForCalendar,
678
- class: "pux_datepicker__popup",
679
- ariaHidden: this.ariaHiddenForCalendar,
680
- ariaExpanded: this.ariaExpandedForCalendar,
681
- style: this.popupStyle,
682
- }, [
683
- !!(this.range && this.innerShortcuts.length) && h("div", {
684
- class: "pux_datepicker__shortcuts_wrapper",
685
- }, [
686
- this.innerShortcuts.map((range, index) => {
687
- return h("button", {
688
- key: index,
689
- class: "pux_datepicker__shortcuts_wrapper__shortcuts",
690
- type: "button",
691
- onClick: () => this.selectRange(range),
692
- }, range.text);
693
- }),
694
- ]),
695
- !this.range ?
696
- h(ADatepickerCalendarPanel, {
697
- ref: "calendarPanelRef",
698
- id: this.idForPanel,
699
- currentLanguage: this.currentLanguage,
700
- dateFormat: this.innerDateFormat,
701
- firstDayOfWeek: this.firstDayOfWeek,
702
- focusStartDate: this.focusStartDate,
703
- index: -1,
704
- maxDate: this.maxDate,
705
- minDate: this.minDate,
706
- minuteStep: this.minuteStep,
707
- startDate: this.startDate,
708
- timePrecision: this.timePrecision,
709
- type: this.innerType,
710
- value: this.currentValue,
711
- visible: this.popupVisible,
712
- onSelectDate: this.selectDate,
713
- onSelectTime: this.selectTime,
714
- onClosePopup: this.closePopover,
715
- }) :
716
- h("div", {
717
- class: "pux_datepicker__range_wrapper",
718
- }, [
719
- h(ADatepickerCalendarPanel, {
720
- ref: "calendarPanelRef",
721
- id: this.idsForPanelRange[0],
722
- currentLanguage: this.currentLanguage,
723
- dateFormat: this.innerDateFormat,
724
- endAt: this.currentValue[1],
725
- firstDayOfWeek: this.firstDayOfWeek,
726
- focusStartDate: this.focusStartDate,
727
- index: 0,
728
- maxDate: this.maxDate,
729
- minDate: this.minDate,
730
- minuteStep: this.minuteStep,
731
- startAt: null,
732
- startDate: this.startDate,
733
- timePrecision: this.timePrecision,
734
- style: "box-shadow: 1px 0 rgba(0, 0, 0, .1);",
735
- type: this.innerType,
736
- value: this.currentValue[0],
737
- visible: this.popupVisible,
738
- onSelectDate: this.selectStartDate,
739
- onSelectTime: this.selectStartTime,
740
- onClosePopup: this.closePopover,
741
- }),
742
- h(ADatepickerCalendarPanel, {
743
- ref: "calendarPanel2Ref",
744
- id: this.idsForPanelRange[1],
745
- currentLanguage: this.currentLanguage,
746
- dateFormat: this.innerDateFormat,
747
- endAt: null,
748
- firstDayOfWeek: this.firstDayOfWeek,
749
- index: 1,
750
- minuteStep: this.minuteStep,
751
- startAt: this.currentValue[0],
752
- startDate: this.currentValue[0],
753
- timePrecision: this.timePrecision,
754
- type: this.innerType,
755
- value: this.currentValue[1],
756
- visible: this.popupVisible,
757
- onSelectDate: this.selectEndDate,
758
- onSelectTime: this.selectEndTime,
759
- onClosePopup: this.closePopover,
760
- }),
761
- ]),
762
- this.confirm && h("div", {
763
- class: "pux_datepicker__footer",
764
- }, [
765
- h("button", {
766
- class: "pux_datepicker__footer__btn pux_datepicker__footer__btn_confirm",
767
- type: "button",
768
- onClick: this.confirmDate,
769
- }, this.confirmText),
770
- ]),
771
- ]), [
772
- [AOnHooks, {
773
- mounted: this.openPopoverWithFloatingUi,
774
- }],
775
- ]),
776
- ]),
777
- h("div", {
778
- ref: "focusByCloseRef",
779
- ariaHidden: true,
780
- tabindex: -1,
781
- }),
782
- ]),
783
-
784
- /*
785
- * this.isClearButtonLocal && h(AFormElementBtnClear, {
786
- * disabled: this.disabled,
787
- * clearButtonClass: this.clearButtonClass,
788
- * onClear: this.clearModel,
789
- * }),
790
- */
791
- ]),
792
- h(AFormHelpText, {
793
- id: this.helpTextId,
794
- alwaysTranslate: this.alwaysTranslate,
795
- html: this.helpText,
796
- extra: this.extra,
797
- }),
798
- this.isErrors && h(AErrorsText, {
799
- id: this.errorsId,
800
- alwaysTranslate: this.alwaysTranslate,
801
- errors: this.errors,
802
- errorsClass: this.errorsClass,
803
- }),
804
- ]),
805
- ]);
806
- },
807
- };
1
+ /* eslint vue/component-api-style: off */
2
+ import {
3
+ computed,
4
+ h,
5
+ ref,
6
+ Teleport,
7
+ toRef,
8
+ watch,
9
+ withDirectives,
10
+ } from "vue";
11
+ import {
12
+ AErrorsText,
13
+ AFormHelpText,
14
+ AFormLabelDescription,
15
+ AFormReadonly,
16
+ AIcon,
17
+ ALabel,
18
+ APlacements,
19
+ UiAPI,
20
+ UIExcludeRenderAttributesAPI,
21
+ UiInputAutofillAPI,
22
+ UiStyleHideAPI,
23
+ } from "../../index";
24
+
25
+ import ADatepickerCalendarPanel from "./ADatepickerCalendarPanel/ADatepickerCalendarPanel";
26
+ import ADatepickerIcon from "./ADatepickerIcon/ADatepickerIcon";
27
+
28
+ import AttributesAPI from "./compositionAPI/AttributesAPI";
29
+ import EventsAPI from "./compositionAPI/EventsAPI";
30
+ import LanguagesAPI from "./compositionAPI/LanguagesAPI";
31
+ import PlaceholderAPI from "./compositionAPI/PlaceholderAPI";
32
+ import PopoverAPI from "./compositionAPI/PopoverAPI";
33
+ import RefsAPI from "./compositionAPI/RefsAPI";
34
+ import TypeAPI from "./compositionAPI/TypeAPI";
35
+
36
+ import AOnHooks from "../../directives/AOnHooks";
37
+ import UiMixinProps from "../mixins/UiMixinProps";
38
+ import {
39
+ ADatepickerPluginOptions,
40
+ } from "../../plugins/ADatepickerPlugin";
41
+ import {
42
+ isPlainObject,
43
+ isValidDate,
44
+ } from "./utils";
45
+ import {
46
+ transformDate,
47
+ } from "./utils/transform";
48
+
49
+ // @vue/component
50
+ export default {
51
+ name: "ADatepicker",
52
+ mixins: [
53
+ UiMixinProps,
54
+ ],
55
+ inheritAttrs: false,
56
+ props: {
57
+ alwaysTranslate: {
58
+ type: Boolean,
59
+ required: false,
60
+ },
61
+ appendToBody: {
62
+ type: Boolean,
63
+ default: () => ADatepickerPluginOptions.propsDefault.appendToBody,
64
+ },
65
+ class: {
66
+ type: [String, Object],
67
+ required: false,
68
+ default: () => ADatepickerPluginOptions.propsDefault.class,
69
+ },
70
+ clearable: {
71
+ type: Boolean,
72
+ default: () => ADatepickerPluginOptions.propsDefault.clearable,
73
+ },
74
+ confirm: {
75
+ type: Boolean,
76
+ default: () => ADatepickerPluginOptions.propsDefault.confirm,
77
+ },
78
+ confirmText: {
79
+ type: String,
80
+ default: () => ADatepickerPluginOptions.propsDefault.confirmText,
81
+ },
82
+ dateFormat: {
83
+ type: String, // format the time header and date tooltip
84
+ default: () => ADatepickerPluginOptions.propsDefault.dateFormat,
85
+ },
86
+ disabled: {
87
+ type: Boolean,
88
+ default: false,
89
+ },
90
+ editable: {
91
+ type: Boolean,
92
+ default: () => ADatepickerPluginOptions.propsDefault.editable,
93
+ },
94
+ errorIcon: {
95
+ type: [String, Object],
96
+ required: false,
97
+ default: undefined,
98
+ },
99
+ excludeRenderAttributes: {
100
+ type: Array,
101
+ required: false,
102
+ default: () => [],
103
+ },
104
+ firstDayOfWeek: {
105
+ type: Number,
106
+ required: false,
107
+ default: () => ADatepickerPluginOptions.propsDefault.firstDayOfWeek,
108
+ validator: val => val >= 1 && val <= 7,
109
+ },
110
+ focusStartDate: {
111
+ type: Boolean,
112
+ default: () => ADatepickerPluginOptions.propsDefault.focusStartDate,
113
+ },
114
+ format: {
115
+ type: [String, Object],
116
+ required: false,
117
+ default: () => ADatepickerPluginOptions.propsDefault.format,
118
+ },
119
+ formatSave: {
120
+ type: String,
121
+ required: false,
122
+ default: () => ADatepickerPluginOptions.propsDefault.formatSave,
123
+ },
124
+ iconDay: {
125
+ type: [Number, String],
126
+ default: () => ADatepickerPluginOptions.propsDefault.iconDay,
127
+ },
128
+ inputAttr: {
129
+ type: Object,
130
+ required: false,
131
+ default: () => ADatepickerPluginOptions.propsDefault.inputAttr,
132
+ },
133
+ inputClass: {
134
+ type: [String, Number, Boolean, Array, Object, Date, Function, Symbol],
135
+ default: () => ADatepickerPluginOptions.propsDefault.inputClass,
136
+ },
137
+ inputName: {
138
+ type: String,
139
+ default: () => ADatepickerPluginOptions.propsDefault.inputName,
140
+ },
141
+ isLabelFloat: {
142
+ type: Boolean,
143
+ required: false,
144
+ default: () => ADatepickerPluginOptions.propsDefault.isLabelFloat,
145
+ },
146
+ labelScreenReader: {
147
+ type: String,
148
+ required: false,
149
+ default: undefined,
150
+ },
151
+ maxDate: {
152
+ type: [String, Date],
153
+ required: false,
154
+ default: () => ADatepickerPluginOptions.propsDefault.maxDate,
155
+ },
156
+ minDate: {
157
+ type: [String, Date],
158
+ required: false,
159
+ default: () => ADatepickerPluginOptions.propsDefault.minDate,
160
+ },
161
+ minuteStep: {
162
+ type: Number,
163
+ required: false,
164
+ default: () => ADatepickerPluginOptions.propsDefault.minuteStep,
165
+ validator: val => val >= 0 && val <= 60,
166
+ },
167
+ timePrecision: {
168
+ type: String,
169
+ required: false,
170
+ default: () => ADatepickerPluginOptions.propsDefault.timePrecision,
171
+ validator: value => ["hour", "minute", "second"].indexOf(value) !== -1,
172
+ },
173
+ modelValue: {
174
+ type: [String, Number, Boolean, Array, Object, Date, Function, Symbol],
175
+ default: undefined,
176
+ },
177
+ placeholder: {
178
+ type: String,
179
+ default: () => ADatepickerPluginOptions.propsDefault.placeholder,
180
+ },
181
+ placeholdersDefault: {
182
+ type: Object,
183
+ required: false,
184
+ default: () => ADatepickerPluginOptions.propsDefault.placeholdersDefault,
185
+ },
186
+ placement: {
187
+ type: String,
188
+ required: false,
189
+ default: () => ADatepickerPluginOptions.propsDefault.placement,
190
+ validator: placement => APlacements.indexOf(placement) !== -1,
191
+ },
192
+ popupStyle: {
193
+ type: Object,
194
+ required: false,
195
+ default: () => ADatepickerPluginOptions.propsDefault.popupStyle,
196
+ },
197
+ range: {
198
+ type: Boolean,
199
+ default: () => ADatepickerPluginOptions.propsDefault.range,
200
+ },
201
+ rangeSeparator: {
202
+ type: String,
203
+ default: () => ADatepickerPluginOptions.propsDefault.rangeSeparator,
204
+ },
205
+ readonly: {
206
+ type: Boolean,
207
+ required: false,
208
+ },
209
+ readonlyDefault: {
210
+ type: String,
211
+ required: false,
212
+ default: () => ADatepickerPluginOptions.propsDefault.readonlyDefault,
213
+ },
214
+ shortcuts: {
215
+ type: [Boolean, Array],
216
+ default: () => ADatepickerPluginOptions.propsDefault.shortcuts,
217
+ },
218
+ startDate: {
219
+ type: [String, Date],
220
+ required: false,
221
+ default: () => ADatepickerPluginOptions.propsDefault.startDate,
222
+ },
223
+ type: {
224
+ type: String,
225
+ default: () => ADatepickerPluginOptions.propsDefault.type, // ["date", "datetime"] zendy added "month", "year", mxie added "time"
226
+ validator: value => ["date", "datetime", "month", "year", "time"].indexOf(value) !== -1,
227
+ },
228
+ valueType: {
229
+ default: () => ADatepickerPluginOptions.propsDefault.valueType,
230
+ validator: function(value) {
231
+ return ["timestamp", "format", "date"].indexOf(value) !== -1 || isPlainObject(value);
232
+ },
233
+ },
234
+ width: {
235
+ type: [String, Number],
236
+ default: () => ADatepickerPluginOptions.propsDefault.width,
237
+ },
238
+ },
239
+ emits: [
240
+ "blur",
241
+ "change",
242
+ "clear",
243
+ "confirm",
244
+ "focus",
245
+ "input",
246
+ "inputError",
247
+ "changeCalendarMonth",
248
+ "changeCalendarYear",
249
+ ],
250
+ setup(props, context) {
251
+ const modelValue = toRef(props, "modelValue");
252
+ const isInputFocused = ref(false);
253
+
254
+ const {
255
+ formatLocal,
256
+ formatSaveLocal,
257
+ } = TypeAPI(props);
258
+
259
+ const {
260
+ attributesToExcludeFromRender,
261
+ } = UIExcludeRenderAttributesAPI(props);
262
+
263
+ const {
264
+ calendarRef,
265
+ calendarPanelRef,
266
+ calendarPanel2Ref,
267
+ focusByCloseRef,
268
+ inputRef,
269
+ } = RefsAPI();
270
+
271
+ const {
272
+ componentStyleHide,
273
+ } = UiStyleHideAPI(props);
274
+
275
+ const {
276
+ ariaDescribedbyLocal,
277
+ changeModel,
278
+ clearModel,
279
+ errorsId,
280
+ helpTextId,
281
+ htmlIdLocal,
282
+ isErrors,
283
+ isModel,
284
+ labelDescriptionId,
285
+ onBlur,
286
+ onFocus,
287
+ } = UiAPI(props, context);
288
+
289
+ const {
290
+ isAutofill,
291
+ } = UiInputAutofillAPI({ inputRef });
292
+
293
+ const hasErrorIcon = computed(() => !!(isErrors.value && props.errorIcon));
294
+
295
+ const {
296
+ currentLanguage,
297
+ } = LanguagesAPI();
298
+
299
+ const {
300
+ closePopover,
301
+ destroyPopover,
302
+ initCalendar,
303
+ openPopoverWithFloatingUi,
304
+ popupVisible,
305
+ setCloseFocus,
306
+ } = PopoverAPI(props, {
307
+ calendarRef,
308
+ focusByCloseRef,
309
+ inputRef,
310
+ });
311
+
312
+ const {
313
+ ariaExpandedForCalendar,
314
+ ariaHiddenForCalendar,
315
+ idForCalendar,
316
+ idForPanel,
317
+ idsForPanelRange,
318
+ innerType,
319
+ widthLocal,
320
+ } = AttributesAPI(props, {
321
+ currentLanguage,
322
+ popupVisible,
323
+ });
324
+
325
+ const {
326
+ clearDate,
327
+ confirmDate,
328
+ currentValue,
329
+ emitDate,
330
+ handleChange,
331
+ handleInput,
332
+ handleKeydown,
333
+ initCurrentValue,
334
+ onModelValueChange,
335
+ parse,
336
+ selectDate,
337
+ selectEndDate,
338
+ selectEndTime,
339
+ selectStartDate,
340
+ selectStartTime,
341
+ selectTime,
342
+ stringify,
343
+ text,
344
+ updateDate,
345
+ userInput,
346
+ } = EventsAPI(props, context, {
347
+ calendarPanelRef,
348
+ changeModel,
349
+ closePopover,
350
+ formatLocal,
351
+ formatSaveLocal,
352
+ setCloseFocus,
353
+ });
354
+
355
+ const {
356
+ innerPlaceholder,
357
+ } = PlaceholderAPI(props, {
358
+ isInputFocused,
359
+ text,
360
+ });
361
+
362
+ const blur = () => {
363
+ inputRef.value && inputRef.value.blur();
364
+ };
365
+
366
+ initCurrentValue();
367
+
368
+ watch(modelValue, onModelValueChange, {
369
+ immediate: true,
370
+ });
371
+
372
+ return {
373
+ ariaDescribedbyLocal,
374
+ ariaExpandedForCalendar,
375
+ ariaHiddenForCalendar,
376
+ attributesToExcludeFromRender,
377
+ blur,
378
+ calendarPanel2Ref,
379
+ calendarPanelRef,
380
+ calendarRef,
381
+ changeModel,
382
+ clearDate,
383
+ clearModel,
384
+ parse,
385
+ closePopover,
386
+ componentStyleHide,
387
+ confirmDate,
388
+ stringify,
389
+ currentLanguage,
390
+ currentValue,
391
+ destroyPopover,
392
+ emitDate,
393
+ errorsId,
394
+ hasErrorIcon,
395
+ text,
396
+ focusByCloseRef,
397
+ formatLocal,
398
+ handleChange,
399
+ handleInput,
400
+ handleKeydown,
401
+ helpTextId,
402
+ htmlIdLocal,
403
+ idForCalendar,
404
+ idForPanel,
405
+ idsForPanelRange,
406
+ initCalendar,
407
+ isInputFocused,
408
+ innerPlaceholder,
409
+ innerType,
410
+ inputRef,
411
+ isAutofill,
412
+ isErrors,
413
+ isModel,
414
+ labelDescriptionId,
415
+ onBlur,
416
+ onFocus,
417
+ openPopoverWithFloatingUi,
418
+ popupVisible,
419
+ selectDate,
420
+ selectEndDate,
421
+ selectEndTime,
422
+ selectStartDate,
423
+ selectStartTime,
424
+ selectTime,
425
+ setCloseFocus,
426
+ updateDate,
427
+ userInput,
428
+ widthLocal,
429
+ };
430
+ },
431
+ computed: {
432
+ transform() {
433
+ const type = this.valueType;
434
+ if (isPlainObject(type)) {
435
+ return { ...transformDate.date, ...type };
436
+ }
437
+ if (type === "format") {
438
+ return {
439
+ value2date: this.parse.bind(this),
440
+ date2value: this.stringify.bind(this),
441
+ };
442
+ }
443
+ return transformDate[type] || transformDate.date;
444
+ },
445
+
446
+ showClearIcon() {
447
+ return !this.disabled && this.clearable && this.text;
448
+ },
449
+
450
+ innerShortcuts() {
451
+ if (Array.isArray(this.shortcuts)) {
452
+ return this.shortcuts;
453
+ }
454
+ if (this.shortcuts === false) {
455
+ return [];
456
+ }
457
+ const pickers = this.currentLanguage.pickers;
458
+ const arr = [
459
+ {
460
+ text: pickers[0],
461
+ onClick(self) {
462
+ self.currentValue = [new Date(), new Date(Date.now() + 3600 * 1000 * 24 * 7)];
463
+ self.updateDate(true);
464
+ },
465
+ },
466
+ {
467
+ text: pickers[1],
468
+ onClick(self) {
469
+ self.currentValue = [new Date(), new Date(Date.now() + 3600 * 1000 * 24 * 30)];
470
+ self.updateDate(true);
471
+ },
472
+ },
473
+ {
474
+ text: pickers[2],
475
+ onClick(self) {
476
+ self.currentValue = [new Date(Date.now() - 3600 * 1000 * 24 * 7), new Date()];
477
+ self.updateDate(true);
478
+ },
479
+ },
480
+ {
481
+ text: pickers[3],
482
+ onClick(self) {
483
+ self.currentValue = [new Date(Date.now() - 3600 * 1000 * 24 * 30), new Date()];
484
+ self.updateDate(true);
485
+ },
486
+ },
487
+ ];
488
+ return arr;
489
+ },
490
+
491
+ innerDateFormat() {
492
+ if (this.dateFormat) {
493
+ return this.dateFormat;
494
+ }
495
+ if (typeof this.formatLocal !== "string") {
496
+ return "YYYY-MM-DD";
497
+ }
498
+ if (this.innerType === "date") {
499
+ return this.formatLocal;
500
+ }
501
+ return this.formatLocal.replace(/[Hh]+.*[msSaAZ]|\[.*?\]/g, "").trim() || "YYYY-MM-DD";
502
+ },
503
+ },
504
+ watch: {
505
+ popupVisible(val) {
506
+ if (val) {
507
+ this.initCalendar();
508
+ } else {
509
+ this.userInput = null;
510
+ this.blur();
511
+ }
512
+ },
513
+ },
514
+ methods: {
515
+ isValidValue(value) {
516
+ const { value2date } = this.transform;
517
+ return isValidDate(value2date(value));
518
+ },
519
+
520
+ isValidRangeValue(value) {
521
+ const { value2date } = this.transform;
522
+ return Array.isArray(value) && value.length === 2 && this.isValidValue(value[0]) &&
523
+ this.isValidValue(value[1]) && (value2date(value[1]).getTime() >= value2date(value[0]).getTime());
524
+ },
525
+
526
+ selectRange(range) {
527
+ if (typeof range.onClick === "function") {
528
+ const close = range.onClick(this);
529
+ if (close !== false) {
530
+ this.closePopover();
531
+ }
532
+ } else {
533
+ this.currentValue = [new Date(range.start), new Date(range.end)];
534
+ this.updateDate(true);
535
+ this.closePopover();
536
+ }
537
+ },
538
+
539
+ handleBlur(event) {
540
+ this.isInputFocused = false;
541
+ this.$emit("blur", event);
542
+ },
543
+
544
+ handleFocus(event) {
545
+ this.isInputFocused = true;
546
+ this.initCalendar();
547
+ this.$emit("focus", event);
548
+ },
549
+ },
550
+ render() {
551
+ if (!this.isRender) {
552
+ return null;
553
+ }
554
+
555
+ if (this.readonly) {
556
+ return h(AFormReadonly, {
557
+ ...this.$attrs,
558
+ id: this.htmlIdLocal,
559
+ alwaysTranslate: this.alwaysTranslate,
560
+ excludeRenderAttributes: this.excludeRenderAttributes,
561
+ extra: this.extra,
562
+ helpText: this.helpText,
563
+ label: this.label,
564
+ labelClass: this.labelClass,
565
+ labelScreenReader: this.labelScreenReader,
566
+ modelValue: this.text,
567
+ readonlyDefault: this.readonlyDefault,
568
+ required: this.required,
569
+ style: this.componentStyleHide,
570
+ type: this.type,
571
+ });
572
+ }
573
+
574
+ return h("div", {
575
+ ...this.$attrs,
576
+ class: [
577
+ this.class,
578
+ "a_form_element__container",
579
+ ],
580
+ style: this.componentStyleHide,
581
+ ...this.attributesToExcludeFromRender,
582
+ }, [
583
+ h("div", {
584
+ class: ["a_form_element__parent", {
585
+ a_form_element__parent_float: this.isLabelFloat,
586
+ a_form_element__parent_float_has_error_icon: this.hasErrorIcon,
587
+ a_form_element__parent_not_empty: this.isModel || this.isAutofill,
588
+ }],
589
+ }, [
590
+ this.label && h(ALabel, {
591
+ id: this.htmlIdLocal,
592
+ alwaysTranslate: this.alwaysTranslate,
593
+ label: this.label,
594
+ labelClass: this.labelClass,
595
+ labelScreenReader: this.labelScreenReader,
596
+ required: this.required,
597
+ type: this.type,
598
+ isLabelFloat: this.isLabelFloat,
599
+ isError: this.isErrors,
600
+ }),
601
+ h(AFormLabelDescription, {
602
+ id: this.labelDescriptionId,
603
+ alwaysTranslate: this.alwaysTranslate,
604
+ html: this.labelDescription,
605
+ extra: this.extra,
606
+ isLabelFloat: this.isLabelFloat,
607
+ }),
608
+ h("div", {
609
+ class: "a_form_element",
610
+ }, [
611
+ this.hasErrorIcon ?
612
+ h(AIcon, {
613
+ icon: this.errorIcon,
614
+ class: "a_input__icon_error pux_datepicker__error_icon",
615
+ }) :
616
+ "",
617
+ h("div", {
618
+ class: ["pux_datepicker", {
619
+ pux_datepicker_range: this.range,
620
+ pux_datepicker_has_error_icon: this.hasErrorIcon,
621
+ disabled: this.disabled,
622
+ }],
623
+ style: { width: this.widthLocal },
624
+ onMousedown: this.initCalendar,
625
+ onTouchstart: this.initCalendar,
626
+ }, [
627
+ h("div", {
628
+ class: "pux_datepicker__input_wrapper",
629
+ role: "application",
630
+ }, [
631
+ h("input", {
632
+ ref: "inputRef",
633
+ id: this.htmlIdLocal,
634
+ class: [
635
+ "a_form_control pux_datepicker__input",
636
+ this.inputClass,
637
+ {
638
+ a_form_control_invalid: this.isErrors,
639
+ },
640
+ ],
641
+ name: this.inputName,
642
+ type: "text",
643
+ autocomplete: "off",
644
+ disabled: this.disabled,
645
+ readonly: !this.editable,
646
+ value: this.text,
647
+ placeholder: this.innerPlaceholder,
648
+ ariaHaspopup: true,
649
+ "aria-owns": this.idForCalendar,
650
+ ...this.inputAttr,
651
+ onKeydown: this.handleKeydown,
652
+ onFocus: this.handleFocus,
653
+ onBlur: this.handleBlur,
654
+ onInput: this.handleInput,
655
+ onChange: this.handleChange,
656
+ }),
657
+ this.showClearIcon && h("span", {
658
+ class: "pux_datepicker__input_wrapper__append pux_datepicker__input_wrapper__clear_wrapper",
659
+ ariaHidden: true,
660
+ onMousedown: this.clearDate,
661
+ }, [
662
+ h("i", {
663
+ class: "pux_datepicker__input__icon pux_datepicker__input__clear_icon",
664
+ }),
665
+ ]),
666
+ h("span", {
667
+ class: "pux_datepicker__input_wrapper__append",
668
+ }, [
669
+ h(ADatepickerIcon),
670
+ ]),
671
+ ]),
672
+ h(Teleport, {
673
+ to: "body",
674
+ }, [
675
+ this.popupVisible && withDirectives(h("div", {
676
+ ref: "calendarRef",
677
+ id: this.idForCalendar,
678
+ class: "pux_datepicker__popup",
679
+ ariaHidden: this.ariaHiddenForCalendar,
680
+ ariaExpanded: this.ariaExpandedForCalendar,
681
+ style: this.popupStyle,
682
+ }, [
683
+ !!(this.range && this.innerShortcuts.length) && h("div", {
684
+ class: "pux_datepicker__shortcuts_wrapper",
685
+ }, [
686
+ this.innerShortcuts.map((range, index) => {
687
+ return h("button", {
688
+ key: index,
689
+ class: "pux_datepicker__shortcuts_wrapper__shortcuts",
690
+ type: "button",
691
+ onClick: () => this.selectRange(range),
692
+ }, range.text);
693
+ }),
694
+ ]),
695
+ !this.range ?
696
+ h(ADatepickerCalendarPanel, {
697
+ ref: "calendarPanelRef",
698
+ id: this.idForPanel,
699
+ currentLanguage: this.currentLanguage,
700
+ dateFormat: this.innerDateFormat,
701
+ firstDayOfWeek: this.firstDayOfWeek,
702
+ focusStartDate: this.focusStartDate,
703
+ index: -1,
704
+ maxDate: this.maxDate,
705
+ minDate: this.minDate,
706
+ minuteStep: this.minuteStep,
707
+ startDate: this.startDate,
708
+ timePrecision: this.timePrecision,
709
+ type: this.innerType,
710
+ value: this.currentValue,
711
+ visible: this.popupVisible,
712
+ onSelectDate: this.selectDate,
713
+ onSelectTime: this.selectTime,
714
+ onClosePopup: this.closePopover,
715
+ }) :
716
+ h("div", {
717
+ class: "pux_datepicker__range_wrapper",
718
+ }, [
719
+ h(ADatepickerCalendarPanel, {
720
+ ref: "calendarPanelRef",
721
+ id: this.idsForPanelRange[0],
722
+ currentLanguage: this.currentLanguage,
723
+ dateFormat: this.innerDateFormat,
724
+ endAt: this.currentValue[1],
725
+ firstDayOfWeek: this.firstDayOfWeek,
726
+ focusStartDate: this.focusStartDate,
727
+ index: 0,
728
+ maxDate: this.maxDate,
729
+ minDate: this.minDate,
730
+ minuteStep: this.minuteStep,
731
+ startAt: null,
732
+ startDate: this.startDate,
733
+ timePrecision: this.timePrecision,
734
+ style: "box-shadow: 1px 0 rgba(0, 0, 0, .1);",
735
+ type: this.innerType,
736
+ value: this.currentValue[0],
737
+ visible: this.popupVisible,
738
+ onSelectDate: this.selectStartDate,
739
+ onSelectTime: this.selectStartTime,
740
+ onClosePopup: this.closePopover,
741
+ }),
742
+ h(ADatepickerCalendarPanel, {
743
+ ref: "calendarPanel2Ref",
744
+ id: this.idsForPanelRange[1],
745
+ currentLanguage: this.currentLanguage,
746
+ dateFormat: this.innerDateFormat,
747
+ endAt: null,
748
+ firstDayOfWeek: this.firstDayOfWeek,
749
+ index: 1,
750
+ minuteStep: this.minuteStep,
751
+ startAt: this.currentValue[0],
752
+ startDate: this.currentValue[0],
753
+ timePrecision: this.timePrecision,
754
+ type: this.innerType,
755
+ value: this.currentValue[1],
756
+ visible: this.popupVisible,
757
+ onSelectDate: this.selectEndDate,
758
+ onSelectTime: this.selectEndTime,
759
+ onClosePopup: this.closePopover,
760
+ }),
761
+ ]),
762
+ this.confirm && h("div", {
763
+ class: "pux_datepicker__footer",
764
+ }, [
765
+ h("button", {
766
+ class: "pux_datepicker__footer__btn pux_datepicker__footer__btn_confirm",
767
+ type: "button",
768
+ onClick: this.confirmDate,
769
+ }, this.confirmText),
770
+ ]),
771
+ ]), [
772
+ [AOnHooks, {
773
+ mounted: this.openPopoverWithFloatingUi,
774
+ }],
775
+ ]),
776
+ ]),
777
+ h("div", {
778
+ ref: "focusByCloseRef",
779
+ ariaHidden: true,
780
+ tabindex: -1,
781
+ }),
782
+ ]),
783
+
784
+ /*
785
+ * this.isClearButtonLocal && h(AFormElementBtnClear, {
786
+ * disabled: this.disabled,
787
+ * clearButtonClass: this.clearButtonClass,
788
+ * onClear: this.clearModel,
789
+ * }),
790
+ */
791
+ ]),
792
+ h(AFormHelpText, {
793
+ id: this.helpTextId,
794
+ alwaysTranslate: this.alwaysTranslate,
795
+ html: this.helpText,
796
+ extra: this.extra,
797
+ }),
798
+ this.isErrors && h(AErrorsText, {
799
+ id: this.errorsId,
800
+ alwaysTranslate: this.alwaysTranslate,
801
+ errors: this.errors,
802
+ errorsClass: this.errorsClass,
803
+ }),
804
+ ]),
805
+ ]);
806
+ },
807
+ };