aloha-vue 2.74.0 → 2.75.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE +22 -21
  3. package/dist/aloha-vue.css +105 -105
  4. package/dist/aloha-vue.css.map +1 -1
  5. package/dist/aloha-vue.es.js +59267 -64918
  6. package/dist/aloha-vue.umd.js +338 -211
  7. package/package.json +27 -34
  8. package/scss/components/ATable.scss +2 -2
  9. package/scss/utils/button.scss +362 -362
  10. package/scss/utils/funktions.scss +162 -162
  11. package/src/AAccordion/AAccordionItem/AAccordionItem.js +235 -230
  12. package/src/ACarousel/ACarousel.js +7 -2
  13. package/src/ADropdown/ADropdown.js +4 -1
  14. package/src/AFilters/AFilterCenter/AFilterCenter.js +5 -1
  15. package/src/AFilters/AFilterCenter/AFilterCenterItem/AFilterCenterItem.js +7 -2
  16. package/src/AFilters/AFiltersHorizontal/AFiltersHorizontal.js +412 -396
  17. package/src/AFilters/AFiltersHorizontal/AFiltersHorizontalFilter/AFiltersHorizontalFilter.js +102 -99
  18. package/src/AFilters/AFiltersHorizontal/compositionAPI/FiltersSavedDeleteAPI.js +108 -108
  19. package/src/AFilters/AFiltersMain/AFiltersMain.js +114 -111
  20. package/src/AFilters/AFiltersSaveModal/compositionAPI/SaveAPI.js +65 -65
  21. package/src/ALinkCopy/ALinkCopy.js +98 -95
  22. package/src/ALinkCopy/compositionAPI/CopyAPI.js +48 -48
  23. package/src/AList/__tests__/AList.test.js +33 -33
  24. package/src/AList/compositionAPI/__tests__/TagAPI.test.js +43 -43
  25. package/src/AMenu/AMenu.js +4 -1
  26. package/src/AMenu/AMenuBreadcrumbs/AMenuBreadcrumbs.js +240 -237
  27. package/src/AMenu/AMenuPanelLink/AMenuPanelLink.js +4 -1
  28. package/src/AMenu/AMenuSearchPanelBreadcrumbs/AMenuSearchPanelBreadcrumbs.js +122 -119
  29. package/src/AModalWizard/AModalWizard.js +58 -53
  30. package/src/AModalWizard/compositionAPI/__tests__/ScrollAPI.test.js +46 -46
  31. package/src/APagination/APaginationPages/APaginationPages.js +15 -4
  32. package/src/ARate/ARate.js +254 -249
  33. package/src/ARate/ARateIcon/ADecimalIcon/ADecimalIcon.js +53 -50
  34. package/src/ARate/ARateIcon/ARateIcon.js +109 -104
  35. package/src/AResizer/AResizer.js +167 -162
  36. package/src/ATable/ATableHeaderTh/compositionAPI/SortAPI.js +172 -167
  37. package/src/ATable/ATableHeaderThAction/ATableHeaderThAction.js +14 -4
  38. package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/ATableHeaderThActionItem.js +191 -184
  39. package/src/ATable/ATablePreviewDown/ATablePreviewDown.js +72 -69
  40. package/src/ATable/ATablePreviewRight/ATablePreviewRight.js +265 -258
  41. package/src/ATable/ATableSortingAdditional/ATableSortingAdditional.js +224 -219
  42. package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.AttributesAPI.test.js +39 -39
  43. package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.ColumnsAPI.test.js +68 -68
  44. package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.DropdownAPI.test.js +45 -45
  45. package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.FormAPI.test.js +95 -95
  46. package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.ModelAPI.test.js +1 -1
  47. package/src/ATable/ATableTd/ATableTd.js +4 -1
  48. package/src/ATable/ATableTdAction/ATableTdAction.js +19 -12
  49. package/src/ATable/ATableTopPanel/ATableTopPanel.js +11 -3
  50. package/src/ATable/ATableTr/ATableTr.js +408 -405
  51. package/src/ATable/__tests__/ATable.HeaderSlot.test.js +102 -97
  52. package/src/ATable/__tests__/ATable.RowIdsAPI.test.js +66 -66
  53. package/src/ATableForm/ATableForm.js +88 -85
  54. package/src/ATableForm/ATableFormCellAction/ATableFormCellAction.js +14 -4
  55. package/src/ATableForm/ATableFormCellDnd/ATableFormCellDnd.js +196 -187
  56. package/src/ATableForm/ATableFormRow/compositionAPI/EditAPI.js +104 -104
  57. package/src/ATableForm/__tests__/ATableForm.DragAndDropAPI.test.js +200 -212
  58. package/src/ATableForm/__tests__/ATableForm.ListView.test.js +134 -174
  59. package/src/ATableForm/compositionAPI/IconsAPI.js +24 -21
  60. package/src/AVerticalScroll/AVerticalScroll.js +182 -177
  61. package/src/AWizard/AWizard.js +26 -21
  62. package/src/AWizard/AWizardStep/AWizardStep.js +275 -270
  63. package/src/AWizard/compositionAPI/__tests__/ChangeStepAPI.test.js +32 -32
  64. package/src/AWizard/compositionAPI/__tests__/LocalAPI.test.js +55 -55
  65. package/src/PuxDatepicker/PuxDatepickerCalendarPanel/PuxDatepickerCalendarPanel.js +646 -648
  66. package/src/PuxDatepicker/panel/PanelDate/PanelDate.js +300 -301
  67. package/src/PuxDatepicker/panel/PanelMonth/PanelMonth.js +148 -149
  68. package/src/PuxDatepicker/panel/PanelTime/PanelTime.js +256 -257
  69. package/src/PuxDatepicker/panel/PanelYear/PanelYear.js +136 -137
  70. package/src/PuxDatepicker/utils/index.js +100 -100
  71. package/src/compositionAPI/AHttpAPI.js +593 -593
  72. package/src/compositionAPI/__tests__/AHttpAPI.test.js +42 -42
  73. package/src/filters/__tests__/filterBoolean.test.js +38 -38
  74. package/src/filters/__tests__/filterCapitalize.test.js +38 -38
  75. package/src/filters/__tests__/filterCurrency.test.js +21 -21
  76. package/src/filters/__tests__/filterDate.test.js +42 -42
  77. package/src/filters/__tests__/filterDefaultForEmpty.test.js +24 -24
  78. package/src/filters/__tests__/filterEmail.test.js +42 -42
  79. package/src/filters/__tests__/filterEscapeHtml.test.js +45 -45
  80. package/src/filters/__tests__/filterFileSize.test.js +45 -45
  81. package/src/filters/__tests__/filterFloat.test.js +74 -74
  82. package/src/filters/__tests__/filterJson.test.js +74 -74
  83. package/src/filters/__tests__/filterKeyValue.test.js +50 -50
  84. package/src/filters/__tests__/filterLimitTo.test.js +39 -39
  85. package/src/filters/__tests__/filterLink.test.js +41 -41
  86. package/src/filters/__tests__/filterList.test.js +149 -149
  87. package/src/filters/__tests__/filterLowerCase.test.js +38 -38
  88. package/src/filters/__tests__/filterMask.test.js +80 -80
  89. package/src/filters/__tests__/filterPropertyByValue.test.js +27 -27
  90. package/src/filters/__tests__/filterSearchHighlight.test.js +129 -129
  91. package/src/filters/__tests__/filterUpperCase.test.js +38 -38
  92. package/src/filters/__tests__/filterValueByCondition.test.js +3 -3
  93. package/src/filters/filterJson.js +39 -39
  94. package/src/filters/filterValueByCondition.js +2 -2
  95. package/src/plugins/AAlertPlugin.js +16 -5
  96. package/src/plugins/AMultiselectOrderedPlugin.js +88 -81
  97. package/src/plugins/ASelectPlugin.js +12 -10
  98. package/src/ui/ACheckbox/ACheckbox.js +82 -79
  99. package/src/ui/ADatepicker/ADatepicker.js +6 -5
  100. package/src/ui/ADatepicker/compositionAPI/EventsAPI.js +297 -297
  101. package/src/ui/ADatepicker/utils/index.js +76 -76
  102. package/src/ui/ADatepickerAlt/ADatepicker.js +912 -912
  103. package/src/ui/ADatepickerAlt/utils/index.js +98 -98
  104. package/src/ui/AFieldset/__tests__/AFieldset.ClassColumn.test.js +113 -114
  105. package/src/ui/AFormElementBtnClear/AFormElementBtnClear.js +4 -1
  106. package/src/ui/AInputCurrency/AInputCurrency.js +20 -15
  107. package/src/ui/AInputCurrency/__tests__/AInputCurrency.ModelAPI.test.js +73 -73
  108. package/src/ui/AInputNumber/AInputNumber.js +17 -12
  109. package/src/ui/AJson/AJson.js +12 -3
  110. package/src/ui/AJson/compositionAPI/JsonAPI.js +116 -116
  111. package/src/ui/ALabel/__tests__/ALabel.IdAPI.test.js +42 -42
  112. package/src/ui/ALabel/__tests__/ALabel.LabelAPI.test.js +33 -33
  113. package/src/ui/ARadio/ARadio.js +80 -77
  114. package/src/ui/ASelect/ASelect.js +390 -383
  115. package/src/ui/ASelect/ASelectElement/ASelectElement.js +179 -176
  116. package/src/ui/ASelect/ASelectValueCloseable/ASelectValueCloseable.js +143 -141
  117. package/src/ui/ASelect/__tests__/SelectedFirstAPI.test.js +101 -101
  118. package/src/ui/ASelect/__tests__/SelectedVisibleAPI.test.js +98 -98
  119. package/src/ui/ASlider/compositionAPI/SliderAPI.js +23 -23
  120. package/src/ui/AValidatedJson/AValidatedJson.js +4 -1
  121. package/src/ui/AValidatedJson/AValidatedJsonItem/AValidatedJsonItem.js +308 -298
  122. package/src/ui/compositionApi/UiCollapseAPI.js +68 -63
  123. package/src/ui/compositionApi/UiInputAutofillAPI.js +41 -41
  124. package/src/ui/compositionApi/__tests__/UIDataGroupAPI.test.js +106 -106
  125. package/src/ui/compositionApi/__tests__/UIExcludeRenderAttributesAPI.test.js +39 -39
  126. package/src/ui/compositionApi/__tests__/UiDataWithKeyIdAndLabelAPI.test.js +128 -128
  127. package/src/ui/compositionApi/__tests__/UiSearchAPI.test.js +71 -71
  128. package/src/utils/EventBus.js +51 -8
  129. package/src/utils/__tests__/EventBus.test.js +138 -0
  130. package/src/utils/__tests__/utils.aOrderBy.test.js +1 -1
  131. package/src/utils/__tests__/utils.aSortBy.test.js +1 -1
  132. package/src/utils/__tests__/utils.getTotalNestedCount.test.js +56 -56
  133. package/src/utils/__tests__/utils.isArrayOfArrays.test.js +44 -44
  134. package/src/utils/__tests__/utils.isArrayOfStrings.test.js +36 -36
  135. package/src/utils/__tests__/utilsArray.aFirst.test.js +1 -1
  136. package/src/utils/__tests__/utilsArray.aLast.test.js +1 -1
  137. package/src/utils/__tests__/utilsLang.isArguments.test.js +1 -1
  138. package/src/utils/__tests__/utilsLang.isArray.test.js +1 -1
  139. package/src/utils/__tests__/utilsLang.isArrayBuffer.test.js +1 -1
  140. package/src/utils/__tests__/utilsLang.isBoolean.test.js +1 -1
  141. package/src/utils/__tests__/utilsLang.isBuffer.test.js +1 -1
  142. package/src/utils/__tests__/utilsLang.isDate.test.js +1 -1
  143. package/src/utils/__tests__/utilsLang.isElement.test.js +5 -3
  144. package/src/utils/__tests__/utilsLang.isError.test.js +1 -1
  145. package/src/utils/__tests__/utilsLang.isFinite.test.js +1 -1
  146. package/src/utils/__tests__/utilsLang.isFunction.test.js +1 -1
  147. package/src/utils/__tests__/utilsLang.isInteger.test.js +1 -1
  148. package/src/utils/__tests__/utilsLang.isMap.test.js +1 -1
  149. package/src/utils/__tests__/utilsLang.isNaN.test.js +1 -1
  150. package/src/utils/__tests__/utilsLang.isNil.test.js +1 -1
  151. package/src/utils/__tests__/utilsLang.isNull.test.js +1 -1
  152. package/src/utils/__tests__/utilsLang.isNumber.test.js +1 -1
  153. package/src/utils/__tests__/utilsLang.isObject.test.js +1 -1
  154. package/src/utils/__tests__/utilsLang.isObjectLike.test.js +5 -3
  155. package/src/utils/__tests__/utilsLang.isPlainObject.test.js +3 -2
  156. package/src/utils/__tests__/utilsLang.isPromise.test.js +5 -2
  157. package/src/utils/__tests__/utilsLang.isRegExp.test.js +1 -1
  158. package/src/utils/__tests__/utilsLang.isSet.test.js +1 -1
  159. package/src/utils/__tests__/utilsLang.isString.test.js +1 -1
  160. package/src/utils/__tests__/utilsLang.isSymbol.test.js +5 -3
  161. package/src/utils/__tests__/utilsLang.isUndefined.test.js +1 -1
  162. package/src/utils/__tests__/utilsLang.isWeakMap.test.js +1 -1
  163. package/src/utils/__tests__/utilsLang.isWeakSet.test.js +1 -1
  164. package/src/utils/__tests__/utilsMath.isEven.test.js +43 -43
  165. package/src/utils/__tests__/utilsMath.isOdd.test.js +43 -43
  166. package/src/utils/__tests__/utilsUi.isModelForFilterNotEmpty.test.js +65 -65
  167. package/src/utils/autosize.js +1 -1
@@ -1,257 +1,256 @@
1
- import PanelMixin from "../../mixins/PanelMixin";
2
-
3
- import keysCode from "../../utils/keysCode";
4
-
5
- // @vue/component
6
- export default {
7
- name: "PanelTime",
8
- mixins: [
9
- PanelMixin,
10
- ],
11
- props: {
12
- minuteStep: {
13
- type: Number,
14
- default: 0,
15
- validator: val => val >= 0 && val <= 60,
16
- },
17
- value: {
18
- type: [String, Number, Boolean, Array, Object, Date, Function, Symbol],
19
- default: undefined,
20
- },
21
- timeType: {
22
- type: Array,
23
- default() {
24
- return ["24", "a"];
25
- },
26
- },
27
- disabledTime: {
28
- type: Function,
29
- required: false,
30
- default: undefined,
31
- },
32
- currentLanguage: {
33
- type: Object,
34
- required: true,
35
- },
36
- },
37
- emits: [
38
- "select",
39
- ],
40
- data() {
41
- return {
42
- timeIndexForFocus: undefined,
43
- columnIndexForFocus: undefined,
44
- };
45
- },
46
- computed: {
47
- currentHours() {
48
- return this.value ? new Date(this.value).getHours() : 0;
49
- },
50
-
51
- currentMinutes() {
52
- return this.value ? new Date(this.value).getMinutes() : 0;
53
- },
54
-
55
- currentSeconds() {
56
- return this.value ? new Date(this.value).getSeconds() : 0;
57
- },
58
-
59
- date() {
60
- return this.value
61
- ? new Date(this.value)
62
- : new Date().setHours(0, 0, 0, 0);
63
- },
64
-
65
- isDisabledTimeFunction() {
66
- return typeof this.disabledTime === "function";
67
- },
68
-
69
- timesFiltered() {
70
- const TIMES_FILTERED = [];
71
- let columnIndex = 0;
72
- const HOURS_COLUMN = this.setColumn({
73
- times: this.hours,
74
- timeFunctionName: "setHours",
75
- currentTime: this.currentHours,
76
- ariaLabel: this.currentLanguage.hours,
77
- columnIndex,
78
- });
79
- if (HOURS_COLUMN.length) {
80
- TIMES_FILTERED.push(HOURS_COLUMN);
81
- columnIndex++;
82
- }
83
- const MINUTES_COLUMN = this.setColumn({
84
- times: this.minutes,
85
- timeFunctionName: "setMinutes",
86
- currentTime: this.currentMinutes,
87
- ariaLabel: this.currentLanguage.minutes,
88
- columnIndex,
89
- });
90
- if (MINUTES_COLUMN.length) {
91
- TIMES_FILTERED.push(MINUTES_COLUMN);
92
- columnIndex++;
93
- }
94
- const SECONDS_COLUMN = this.setColumn({
95
- times: this.seconds,
96
- timeFunctionName: "setSeconds",
97
- currentTime: this.currentSeconds,
98
- ariaLabel: this.currentLanguage.seconds,
99
- columnIndex,
100
- });
101
- if (SECONDS_COLUMN.length) {
102
- TIMES_FILTERED.push(SECONDS_COLUMN);
103
- }
104
- return TIMES_FILTERED;
105
- },
106
-
107
- minuteStepLocal() {
108
- return this.minuteStep || 1;
109
- },
110
-
111
- minuteLength() {
112
- return parseInt(60 / this.minuteStepLocal);
113
- },
114
-
115
- hours() {
116
- return Array.apply(null, { length: 24 }).map((_, i) => i);
117
- },
118
-
119
- minutes() {
120
- return Array.apply(null, { length: this.minuteLength }).map(
121
- (_, i) => i * this.minuteStepLocal,
122
- );
123
- },
124
-
125
- seconds() {
126
- return this.minuteStep === 0
127
- ? Array.apply(null, { length: 60 }).map((_, i) => i)
128
- : [];
129
- },
130
-
131
- idForFocus() {
132
- return this.getCurrentId({
133
- columnIndex: this.columnIndexForFocus,
134
- rowIndex: this.timeIndexForFocus,
135
- });
136
- },
137
-
138
- fullIndexForFocus() {
139
- return `${ this.columnIndexForFocus }_${ this.timeIndexForFocus }`;
140
- },
141
- },
142
- methods: {
143
- stringifyText(value) {
144
- return ("00" + value).slice(String(value).length);
145
- },
146
-
147
- selectTime(time, statusClose) {
148
- if (typeof this.disabledTime === "function" && this.disabledTime(time)) {
149
- return;
150
- }
151
- this.$emit("select", new Date(time), statusClose);
152
- },
153
-
154
- setColumn({ times, timeFunctionName, currentTime, ariaLabel, columnIndex }) {
155
- const TIMES_COLUMN = [];
156
- times.forEach((time, timeIndex) => {
157
- const CURRENT_TIME = new Date(this.date)[timeFunctionName](time);
158
- const IS_ACTIVE = time === currentTime;
159
- const IS_DISABLED = this.isDisabledTimeFunction && this.disabledTime(CURRENT_TIME);
160
- const LABEL = this.stringifyText(time);
161
- TIMES_COLUMN.push({
162
- label: LABEL,
163
- time: CURRENT_TIME,
164
- isActive: IS_ACTIVE,
165
- isDisabled: IS_DISABLED,
166
- ariaLabel: `${ ariaLabel }: ${ LABEL }`,
167
- id: this.getCurrentId({
168
- columnIndex,
169
- rowIndex: timeIndex,
170
- }),
171
- });
172
- });
173
- return TIMES_COLUMN;
174
- },
175
-
176
- getCurrentId({ columnIndex, rowIndex }) {
177
- return `${ this.id }_time_${ columnIndex }_${ rowIndex }`;
178
- },
179
-
180
- setFocusToActiveTime() {
181
- setTimeout(() => {
182
- this.setDefaultTimeForFocus();
183
- document.getElementById(this.idForFocus).focus();
184
- this.setListenerForPressButtons();
185
- });
186
- },
187
-
188
- setDefaultTimeForFocus() {
189
- this.timeIndexForFocus = 0;
190
- this.columnIndexForFocus = 0;
191
- },
192
-
193
- pressButton($event) {
194
- const KEY_CODE = $event.keyCode;
195
- if (KEY_CODE === keysCode.arrowUp) {
196
- this.setFocusToLastTime();
197
- this.stopCurrentEvent($event);
198
- } else if (KEY_CODE === keysCode.arrowDown) {
199
- this.setFocusToNextTime();
200
- this.stopCurrentEvent($event);
201
- } else if (KEY_CODE === keysCode.arrowLeft) {
202
- this.setFocusToLastTimeColumn();
203
- this.stopCurrentEvent($event);
204
- } else if (KEY_CODE === keysCode.arrowRight) {
205
- this.setFocusToNextTimeColumn();
206
- this.stopCurrentEvent($event);
207
- }
208
- },
209
-
210
- setFocusToLastTime() {
211
- const CURRENT_TIMES = this.timesFiltered[this.columnIndexForFocus];
212
- if (this.timeIndexForFocus > 0) {
213
- this.timeIndexForFocus--;
214
- } else {
215
- this.timeIndexForFocus = CURRENT_TIMES.length - 1;
216
- }
217
- this.setFocusToElement(this.idForFocus);
218
- },
219
-
220
- setFocusToNextTime() {
221
- const CURRENT_TIMES = this.timesFiltered[this.columnIndexForFocus];
222
- if (this.timeIndexForFocus < CURRENT_TIMES.length - 1) {
223
- this.timeIndexForFocus++;
224
- } else {
225
- this.timeIndexForFocus = 0;
226
- }
227
- this.setFocusToElement(this.idForFocus);
228
- },
229
-
230
- setFocusToLastTimeColumn() {
231
- if (this.columnIndexForFocus > 0) {
232
- this.columnIndexForFocus--;
233
- } else {
234
- this.columnIndexForFocus = this.timesFiltered.length - 1;
235
- }
236
- this.timeIndexForFocus = 0;
237
- this.setFocusToElement(this.idForFocus);
238
- },
239
-
240
- setFocusToNextTimeColumn() {
241
- if (this.columnIndexForFocus < this.timesFiltered.length - 1) {
242
- this.columnIndexForFocus++;
243
- } else {
244
- this.columnIndexForFocus = 0;
245
- }
246
- this.timeIndexForFocus = 0;
247
- this.setFocusToElement(this.idForFocus);
248
- },
249
-
250
- setFocusToElement(idForFocusElement) {
251
- const ELEMENT = document.getElementById(idForFocusElement);
252
- if (ELEMENT) {
253
- ELEMENT.focus();
254
- }
255
- },
256
- },
257
- };
1
+ import PanelMixin from "../../mixins/PanelMixin";
2
+ import keysCode from "../../utils/keysCode";
3
+
4
+ // @vue/component
5
+ export default {
6
+ name: "PanelTime",
7
+ mixins: [
8
+ PanelMixin,
9
+ ],
10
+ props: {
11
+ minuteStep: {
12
+ type: Number,
13
+ default: 0,
14
+ validator: val => val >= 0 && val <= 60,
15
+ },
16
+ value: {
17
+ type: [String, Number, Boolean, Array, Object, Date, Function, Symbol],
18
+ default: undefined,
19
+ },
20
+ timeType: {
21
+ type: Array,
22
+ default() {
23
+ return ["24", "a"];
24
+ },
25
+ },
26
+ disabledTime: {
27
+ type: Function,
28
+ required: false,
29
+ default: undefined,
30
+ },
31
+ currentLanguage: {
32
+ type: Object,
33
+ required: true,
34
+ },
35
+ },
36
+ emits: [
37
+ "select",
38
+ ],
39
+ data() {
40
+ return {
41
+ timeIndexForFocus: undefined,
42
+ columnIndexForFocus: undefined,
43
+ };
44
+ },
45
+ computed: {
46
+ currentHours() {
47
+ return this.value ? new Date(this.value).getHours() : 0;
48
+ },
49
+
50
+ currentMinutes() {
51
+ return this.value ? new Date(this.value).getMinutes() : 0;
52
+ },
53
+
54
+ currentSeconds() {
55
+ return this.value ? new Date(this.value).getSeconds() : 0;
56
+ },
57
+
58
+ date() {
59
+ return this.value
60
+ ? new Date(this.value)
61
+ : new Date().setHours(0, 0, 0, 0);
62
+ },
63
+
64
+ isDisabledTimeFunction() {
65
+ return typeof this.disabledTime === "function";
66
+ },
67
+
68
+ timesFiltered() {
69
+ const TIMES_FILTERED = [];
70
+ let columnIndex = 0;
71
+ const HOURS_COLUMN = this.setColumn({
72
+ times: this.hours,
73
+ timeFunctionName: "setHours",
74
+ currentTime: this.currentHours,
75
+ ariaLabel: this.currentLanguage.hours,
76
+ columnIndex,
77
+ });
78
+ if (HOURS_COLUMN.length) {
79
+ TIMES_FILTERED.push(HOURS_COLUMN);
80
+ columnIndex++;
81
+ }
82
+ const MINUTES_COLUMN = this.setColumn({
83
+ times: this.minutes,
84
+ timeFunctionName: "setMinutes",
85
+ currentTime: this.currentMinutes,
86
+ ariaLabel: this.currentLanguage.minutes,
87
+ columnIndex,
88
+ });
89
+ if (MINUTES_COLUMN.length) {
90
+ TIMES_FILTERED.push(MINUTES_COLUMN);
91
+ columnIndex++;
92
+ }
93
+ const SECONDS_COLUMN = this.setColumn({
94
+ times: this.seconds,
95
+ timeFunctionName: "setSeconds",
96
+ currentTime: this.currentSeconds,
97
+ ariaLabel: this.currentLanguage.seconds,
98
+ columnIndex,
99
+ });
100
+ if (SECONDS_COLUMN.length) {
101
+ TIMES_FILTERED.push(SECONDS_COLUMN);
102
+ }
103
+ return TIMES_FILTERED;
104
+ },
105
+
106
+ minuteStepLocal() {
107
+ return this.minuteStep || 1;
108
+ },
109
+
110
+ minuteLength() {
111
+ return parseInt(60 / this.minuteStepLocal);
112
+ },
113
+
114
+ hours() {
115
+ return Array.apply(null, { length: 24 }).map((_, i) => i);
116
+ },
117
+
118
+ minutes() {
119
+ return Array.apply(null, { length: this.minuteLength }).map(
120
+ (_, i) => i * this.minuteStepLocal,
121
+ );
122
+ },
123
+
124
+ seconds() {
125
+ return this.minuteStep === 0
126
+ ? Array.apply(null, { length: 60 }).map((_, i) => i)
127
+ : [];
128
+ },
129
+
130
+ idForFocus() {
131
+ return this.getCurrentId({
132
+ columnIndex: this.columnIndexForFocus,
133
+ rowIndex: this.timeIndexForFocus,
134
+ });
135
+ },
136
+
137
+ fullIndexForFocus() {
138
+ return `${ this.columnIndexForFocus }_${ this.timeIndexForFocus }`;
139
+ },
140
+ },
141
+ methods: {
142
+ stringifyText(value) {
143
+ return ("00" + value).slice(String(value).length);
144
+ },
145
+
146
+ selectTime(time, statusClose) {
147
+ if (typeof this.disabledTime === "function" && this.disabledTime(time)) {
148
+ return;
149
+ }
150
+ this.$emit("select", new Date(time), statusClose);
151
+ },
152
+
153
+ setColumn({ times, timeFunctionName, currentTime, ariaLabel, columnIndex }) {
154
+ const TIMES_COLUMN = [];
155
+ times.forEach((time, timeIndex) => {
156
+ const CURRENT_TIME = new Date(this.date)[timeFunctionName](time);
157
+ const IS_ACTIVE = time === currentTime;
158
+ const IS_DISABLED = this.isDisabledTimeFunction && this.disabledTime(CURRENT_TIME);
159
+ const LABEL = this.stringifyText(time);
160
+ TIMES_COLUMN.push({
161
+ label: LABEL,
162
+ time: CURRENT_TIME,
163
+ isActive: IS_ACTIVE,
164
+ isDisabled: IS_DISABLED,
165
+ ariaLabel: `${ ariaLabel }: ${ LABEL }`,
166
+ id: this.getCurrentId({
167
+ columnIndex,
168
+ rowIndex: timeIndex,
169
+ }),
170
+ });
171
+ });
172
+ return TIMES_COLUMN;
173
+ },
174
+
175
+ getCurrentId({ columnIndex, rowIndex }) {
176
+ return `${ this.id }_time_${ columnIndex }_${ rowIndex }`;
177
+ },
178
+
179
+ setFocusToActiveTime() {
180
+ setTimeout(() => {
181
+ this.setDefaultTimeForFocus();
182
+ document.getElementById(this.idForFocus).focus();
183
+ this.setListenerForPressButtons();
184
+ });
185
+ },
186
+
187
+ setDefaultTimeForFocus() {
188
+ this.timeIndexForFocus = 0;
189
+ this.columnIndexForFocus = 0;
190
+ },
191
+
192
+ pressButton($event) {
193
+ const KEY_CODE = $event.keyCode;
194
+ if (KEY_CODE === keysCode.arrowUp) {
195
+ this.setFocusToLastTime();
196
+ this.stopCurrentEvent($event);
197
+ } else if (KEY_CODE === keysCode.arrowDown) {
198
+ this.setFocusToNextTime();
199
+ this.stopCurrentEvent($event);
200
+ } else if (KEY_CODE === keysCode.arrowLeft) {
201
+ this.setFocusToLastTimeColumn();
202
+ this.stopCurrentEvent($event);
203
+ } else if (KEY_CODE === keysCode.arrowRight) {
204
+ this.setFocusToNextTimeColumn();
205
+ this.stopCurrentEvent($event);
206
+ }
207
+ },
208
+
209
+ setFocusToLastTime() {
210
+ const CURRENT_TIMES = this.timesFiltered[this.columnIndexForFocus];
211
+ if (this.timeIndexForFocus > 0) {
212
+ this.timeIndexForFocus--;
213
+ } else {
214
+ this.timeIndexForFocus = CURRENT_TIMES.length - 1;
215
+ }
216
+ this.setFocusToElement(this.idForFocus);
217
+ },
218
+
219
+ setFocusToNextTime() {
220
+ const CURRENT_TIMES = this.timesFiltered[this.columnIndexForFocus];
221
+ if (this.timeIndexForFocus < CURRENT_TIMES.length - 1) {
222
+ this.timeIndexForFocus++;
223
+ } else {
224
+ this.timeIndexForFocus = 0;
225
+ }
226
+ this.setFocusToElement(this.idForFocus);
227
+ },
228
+
229
+ setFocusToLastTimeColumn() {
230
+ if (this.columnIndexForFocus > 0) {
231
+ this.columnIndexForFocus--;
232
+ } else {
233
+ this.columnIndexForFocus = this.timesFiltered.length - 1;
234
+ }
235
+ this.timeIndexForFocus = 0;
236
+ this.setFocusToElement(this.idForFocus);
237
+ },
238
+
239
+ setFocusToNextTimeColumn() {
240
+ if (this.columnIndexForFocus < this.timesFiltered.length - 1) {
241
+ this.columnIndexForFocus++;
242
+ } else {
243
+ this.columnIndexForFocus = 0;
244
+ }
245
+ this.timeIndexForFocus = 0;
246
+ this.setFocusToElement(this.idForFocus);
247
+ },
248
+
249
+ setFocusToElement(idForFocusElement) {
250
+ const ELEMENT = document.getElementById(idForFocusElement);
251
+ if (ELEMENT) {
252
+ ELEMENT.focus();
253
+ }
254
+ },
255
+ },
256
+ };