aloha-vue 2.74.0 → 2.75.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.
- package/CHANGELOG.md +8 -0
- package/LICENSE +22 -21
- package/dist/aloha-vue.css +13594 -13594
- package/dist/aloha-vue.css.map +1 -1
- package/dist/aloha-vue.es.js +59266 -64918
- package/dist/aloha-vue.umd.js +338 -211
- package/package.json +27 -34
- package/scss/components/ATable.scss +2 -2
- package/scss/utils/button.scss +362 -362
- package/scss/utils/funktions.scss +162 -162
- package/src/AAccordion/AAccordionItem/AAccordionItem.js +235 -230
- package/src/ACarousel/ACarousel.js +7 -2
- package/src/ADropdown/ADropdown.js +4 -1
- package/src/AFilters/AFilterCenter/AFilterCenter.js +5 -1
- package/src/AFilters/AFilterCenter/AFilterCenterItem/AFilterCenterItem.js +7 -2
- package/src/AFilters/AFiltersHorizontal/AFiltersHorizontal.js +412 -396
- package/src/AFilters/AFiltersHorizontal/AFiltersHorizontalFilter/AFiltersHorizontalFilter.js +102 -99
- package/src/AFilters/AFiltersHorizontal/compositionAPI/FiltersSavedDeleteAPI.js +108 -108
- package/src/AFilters/AFiltersMain/AFiltersMain.js +114 -111
- package/src/AFilters/AFiltersSaveModal/compositionAPI/SaveAPI.js +65 -65
- package/src/ALinkCopy/ALinkCopy.js +98 -95
- package/src/ALinkCopy/compositionAPI/CopyAPI.js +48 -48
- package/src/AList/__tests__/AList.test.js +33 -33
- package/src/AList/compositionAPI/__tests__/TagAPI.test.js +43 -43
- package/src/AMenu/AMenu.js +4 -1
- package/src/AMenu/AMenuBreadcrumbs/AMenuBreadcrumbs.js +240 -237
- package/src/AMenu/AMenuPanelLink/AMenuPanelLink.js +4 -1
- package/src/AMenu/AMenuSearchPanelBreadcrumbs/AMenuSearchPanelBreadcrumbs.js +122 -119
- package/src/AModalWizard/AModalWizard.js +58 -53
- package/src/AModalWizard/compositionAPI/__tests__/ScrollAPI.test.js +46 -46
- package/src/APagination/APaginationPages/APaginationPages.js +15 -4
- package/src/ARate/ARate.js +254 -249
- package/src/ARate/ARateIcon/ADecimalIcon/ADecimalIcon.js +53 -50
- package/src/ARate/ARateIcon/ARateIcon.js +109 -104
- package/src/AResizer/AResizer.js +167 -162
- package/src/ATable/ATableHeaderTh/compositionAPI/SortAPI.js +172 -167
- package/src/ATable/ATableHeaderThAction/ATableHeaderThAction.js +14 -4
- package/src/ATable/ATableHeaderThAction/ATableHeaderThActionItem/ATableHeaderThActionItem.js +191 -184
- package/src/ATable/ATablePreviewDown/ATablePreviewDown.js +72 -69
- package/src/ATable/ATablePreviewRight/ATablePreviewRight.js +265 -258
- package/src/ATable/ATableSortingAdditional/ATableSortingAdditional.js +224 -219
- package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.AttributesAPI.test.js +39 -39
- package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.ColumnsAPI.test.js +68 -68
- package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.DropdownAPI.test.js +45 -45
- package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.FormAPI.test.js +95 -95
- package/src/ATable/ATableSortingAdditional/__tests__/ATableSortingAdditional.ModelAPI.test.js +1 -1
- package/src/ATable/ATableTd/ATableTd.js +4 -1
- package/src/ATable/ATableTdAction/ATableTdAction.js +19 -12
- package/src/ATable/ATableTopPanel/ATableTopPanel.js +11 -3
- package/src/ATable/ATableTr/ATableTr.js +408 -405
- package/src/ATable/__tests__/ATable.HeaderSlot.test.js +102 -97
- package/src/ATable/__tests__/ATable.RowIdsAPI.test.js +66 -66
- package/src/ATableForm/ATableForm.js +88 -85
- package/src/ATableForm/ATableFormCellAction/ATableFormCellAction.js +14 -4
- package/src/ATableForm/ATableFormCellDnd/ATableFormCellDnd.js +196 -187
- package/src/ATableForm/ATableFormRow/compositionAPI/EditAPI.js +104 -104
- package/src/ATableForm/__tests__/ATableForm.DragAndDropAPI.test.js +200 -212
- package/src/ATableForm/__tests__/ATableForm.ListView.test.js +134 -174
- package/src/ATableForm/compositionAPI/IconsAPI.js +24 -21
- package/src/AVerticalScroll/AVerticalScroll.js +182 -177
- package/src/AWizard/AWizard.js +26 -21
- package/src/AWizard/AWizardStep/AWizardStep.js +275 -270
- package/src/AWizard/compositionAPI/__tests__/ChangeStepAPI.test.js +32 -32
- package/src/AWizard/compositionAPI/__tests__/LocalAPI.test.js +55 -55
- package/src/PuxDatepicker/PuxDatepickerCalendarPanel/PuxDatepickerCalendarPanel.js +646 -648
- package/src/PuxDatepicker/panel/PanelDate/PanelDate.js +300 -301
- package/src/PuxDatepicker/panel/PanelMonth/PanelMonth.js +148 -149
- package/src/PuxDatepicker/panel/PanelTime/PanelTime.js +256 -257
- package/src/PuxDatepicker/panel/PanelYear/PanelYear.js +136 -137
- package/src/PuxDatepicker/utils/index.js +100 -100
- package/src/compositionAPI/AHttpAPI.js +593 -593
- package/src/compositionAPI/__tests__/AHttpAPI.test.js +42 -42
- package/src/filters/__tests__/filterBoolean.test.js +38 -38
- package/src/filters/__tests__/filterCapitalize.test.js +38 -38
- package/src/filters/__tests__/filterCurrency.test.js +21 -21
- package/src/filters/__tests__/filterDate.test.js +42 -42
- package/src/filters/__tests__/filterDefaultForEmpty.test.js +24 -24
- package/src/filters/__tests__/filterEmail.test.js +42 -42
- package/src/filters/__tests__/filterEscapeHtml.test.js +45 -45
- package/src/filters/__tests__/filterFileSize.test.js +45 -45
- package/src/filters/__tests__/filterFloat.test.js +74 -74
- package/src/filters/__tests__/filterJson.test.js +74 -74
- package/src/filters/__tests__/filterKeyValue.test.js +50 -50
- package/src/filters/__tests__/filterLimitTo.test.js +39 -39
- package/src/filters/__tests__/filterLink.test.js +41 -41
- package/src/filters/__tests__/filterList.test.js +149 -149
- package/src/filters/__tests__/filterLowerCase.test.js +38 -38
- package/src/filters/__tests__/filterMask.test.js +80 -80
- package/src/filters/__tests__/filterPropertyByValue.test.js +27 -27
- package/src/filters/__tests__/filterSearchHighlight.test.js +129 -129
- package/src/filters/__tests__/filterUpperCase.test.js +38 -38
- package/src/filters/__tests__/filterValueByCondition.test.js +3 -3
- package/src/filters/filterJson.js +39 -39
- package/src/filters/filterValueByCondition.js +2 -2
- package/src/plugins/AAlertPlugin.js +16 -5
- package/src/plugins/AMultiselectOrderedPlugin.js +88 -81
- package/src/plugins/ASelectPlugin.js +12 -10
- package/src/ui/ACheckbox/ACheckbox.js +82 -79
- package/src/ui/ADatepicker/compositionAPI/EventsAPI.js +297 -297
- package/src/ui/ADatepicker/utils/index.js +76 -76
- package/src/ui/ADatepickerAlt/ADatepicker.js +912 -912
- package/src/ui/ADatepickerAlt/utils/index.js +98 -98
- package/src/ui/AFieldset/__tests__/AFieldset.ClassColumn.test.js +113 -114
- package/src/ui/AFormElementBtnClear/AFormElementBtnClear.js +4 -1
- package/src/ui/AInputCurrency/AInputCurrency.js +20 -15
- package/src/ui/AInputCurrency/__tests__/AInputCurrency.ModelAPI.test.js +73 -73
- package/src/ui/AInputNumber/AInputNumber.js +17 -12
- package/src/ui/AJson/AJson.js +12 -3
- package/src/ui/AJson/compositionAPI/JsonAPI.js +116 -116
- package/src/ui/ALabel/__tests__/ALabel.IdAPI.test.js +42 -42
- package/src/ui/ALabel/__tests__/ALabel.LabelAPI.test.js +33 -33
- package/src/ui/ARadio/ARadio.js +80 -77
- package/src/ui/ASelect/ASelect.js +390 -383
- package/src/ui/ASelect/ASelectElement/ASelectElement.js +179 -176
- package/src/ui/ASelect/ASelectValueCloseable/ASelectValueCloseable.js +143 -141
- package/src/ui/ASelect/__tests__/SelectedFirstAPI.test.js +101 -101
- package/src/ui/ASelect/__tests__/SelectedVisibleAPI.test.js +98 -98
- package/src/ui/ASlider/compositionAPI/SliderAPI.js +23 -23
- package/src/ui/AValidatedJson/AValidatedJson.js +4 -1
- package/src/ui/AValidatedJson/AValidatedJsonItem/AValidatedJsonItem.js +308 -298
- package/src/ui/compositionApi/UiCollapseAPI.js +68 -63
- package/src/ui/compositionApi/UiInputAutofillAPI.js +41 -41
- package/src/ui/compositionApi/__tests__/UIDataGroupAPI.test.js +106 -106
- package/src/ui/compositionApi/__tests__/UIExcludeRenderAttributesAPI.test.js +39 -39
- package/src/ui/compositionApi/__tests__/UiDataWithKeyIdAndLabelAPI.test.js +128 -128
- package/src/ui/compositionApi/__tests__/UiSearchAPI.test.js +71 -71
- package/src/utils/EventBus.js +51 -8
- package/src/utils/__tests__/EventBus.test.js +138 -0
- package/src/utils/__tests__/utils.aOrderBy.test.js +1 -1
- package/src/utils/__tests__/utils.aSortBy.test.js +1 -1
- package/src/utils/__tests__/utils.getTotalNestedCount.test.js +56 -56
- package/src/utils/__tests__/utils.isArrayOfArrays.test.js +44 -44
- package/src/utils/__tests__/utils.isArrayOfStrings.test.js +36 -36
- package/src/utils/__tests__/utilsArray.aFirst.test.js +1 -1
- package/src/utils/__tests__/utilsArray.aLast.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isArguments.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isArray.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isArrayBuffer.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isBoolean.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isBuffer.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isDate.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isElement.test.js +5 -3
- package/src/utils/__tests__/utilsLang.isError.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isFinite.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isFunction.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isInteger.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isMap.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isNaN.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isNil.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isNull.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isNumber.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isObject.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isObjectLike.test.js +5 -3
- package/src/utils/__tests__/utilsLang.isPlainObject.test.js +3 -2
- package/src/utils/__tests__/utilsLang.isPromise.test.js +5 -2
- package/src/utils/__tests__/utilsLang.isRegExp.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isSet.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isString.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isSymbol.test.js +5 -3
- package/src/utils/__tests__/utilsLang.isUndefined.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isWeakMap.test.js +1 -1
- package/src/utils/__tests__/utilsLang.isWeakSet.test.js +1 -1
- package/src/utils/__tests__/utilsMath.isEven.test.js +43 -43
- package/src/utils/__tests__/utilsMath.isOdd.test.js +43 -43
- package/src/utils/__tests__/utilsUi.isModelForFilterNotEmpty.test.js +65 -65
- package/src/utils/autosize.js +1 -1
|
@@ -1,648 +1,646 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
"
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
if (panel === "
|
|
243
|
-
this.
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
if (type === "
|
|
259
|
-
this.
|
|
260
|
-
} else if (type === "
|
|
261
|
-
this.
|
|
262
|
-
} else
|
|
263
|
-
this.
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
this.
|
|
268
|
-
|
|
269
|
-
this.
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
if (this.type === "
|
|
294
|
-
return new Date(date.getFullYear(),
|
|
295
|
-
} else if (this.type === "
|
|
296
|
-
return
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
this.
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
this.
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
this.
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
this.
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
this.value.
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
time
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
time
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
this.
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
this.
|
|
509
|
-
this.
|
|
510
|
-
this.
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
this.
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
if (this.panel === "
|
|
551
|
-
this.$refs.
|
|
552
|
-
} else if (this.panel === "
|
|
553
|
-
this.$refs.
|
|
554
|
-
} else if (this.panel === "
|
|
555
|
-
this.$refs.
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
FOCUSABLE_ELEMENTS[
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
FOCUSABLE_ELEMENTS[
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
this.
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
},
|
|
648
|
-
};
|
|
1
|
+
import PanelDate from "../panel/PanelDate/PanelDate.vue";
|
|
2
|
+
import PanelMonth from "../panel/PanelMonth/PanelMonth.vue";
|
|
3
|
+
import PanelTime from "../panel/PanelTime/PanelTime.vue";
|
|
4
|
+
import PanelYear from "../panel/PanelYear/PanelYear.vue";
|
|
5
|
+
import {
|
|
6
|
+
AButton,
|
|
7
|
+
} from "aloha-vue";
|
|
8
|
+
|
|
9
|
+
import PanelMixin from "../mixins/PanelMixin";
|
|
10
|
+
import keysCode from "../utils/keysCode";
|
|
11
|
+
import scrollIntoView from "../utils/scroll-into-view";
|
|
12
|
+
import {
|
|
13
|
+
formatDate,
|
|
14
|
+
isDateObject,
|
|
15
|
+
isValidDate,
|
|
16
|
+
} from "../utils";
|
|
17
|
+
import {
|
|
18
|
+
forEach,
|
|
19
|
+
} from "lodash-es";
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
// @vue/component
|
|
23
|
+
export default {
|
|
24
|
+
name: "CalendarPanel",
|
|
25
|
+
components: {
|
|
26
|
+
AButton,
|
|
27
|
+
PanelDate,
|
|
28
|
+
PanelMonth,
|
|
29
|
+
PanelTime,
|
|
30
|
+
PanelYear,
|
|
31
|
+
},
|
|
32
|
+
mixins: [
|
|
33
|
+
PanelMixin,
|
|
34
|
+
],
|
|
35
|
+
props: {
|
|
36
|
+
id: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
value: {
|
|
41
|
+
default: null,
|
|
42
|
+
validator: function(val) {
|
|
43
|
+
return val === null || isValidDate(val);
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
startAt: {
|
|
47
|
+
type: [String, Number, Boolean, Array, Object, Date, Function, Symbol],
|
|
48
|
+
required: false,
|
|
49
|
+
default: undefined,
|
|
50
|
+
},
|
|
51
|
+
endAt: {
|
|
52
|
+
type: [String, Number, Boolean, Array, Object, Date, Function, Symbol],
|
|
53
|
+
required: false,
|
|
54
|
+
default: undefined,
|
|
55
|
+
},
|
|
56
|
+
visible: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: false,
|
|
59
|
+
},
|
|
60
|
+
type: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: "date", // ["date", "datetime"]
|
|
63
|
+
},
|
|
64
|
+
dateFormat: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: "YYYY-MM-DD",
|
|
67
|
+
},
|
|
68
|
+
index: {
|
|
69
|
+
type: Number,
|
|
70
|
+
default: undefined,
|
|
71
|
+
},
|
|
72
|
+
defaultValue: {
|
|
73
|
+
validator: function(val) {
|
|
74
|
+
return isValidDate(val);
|
|
75
|
+
},
|
|
76
|
+
default: undefined,
|
|
77
|
+
},
|
|
78
|
+
firstDayOfWeek: {
|
|
79
|
+
default: 7,
|
|
80
|
+
type: Number,
|
|
81
|
+
validator: val => val >= 1 && val <= 7,
|
|
82
|
+
},
|
|
83
|
+
notBefore: {
|
|
84
|
+
default: null,
|
|
85
|
+
validator: function(val) {
|
|
86
|
+
return !val || isValidDate(val);
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
notAfter: {
|
|
90
|
+
default: null,
|
|
91
|
+
validator: function(val) {
|
|
92
|
+
return !val || isValidDate(val);
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
disabledDays: {
|
|
96
|
+
type: [Array, Function],
|
|
97
|
+
default: function() {
|
|
98
|
+
return [];
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
minuteStep: {
|
|
102
|
+
type: Number,
|
|
103
|
+
default: 0,
|
|
104
|
+
validator: val => val >= 0 && val <= 60,
|
|
105
|
+
},
|
|
106
|
+
currentLanguage: {
|
|
107
|
+
type: Object,
|
|
108
|
+
required: true,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
emits: [
|
|
112
|
+
"closePopup",
|
|
113
|
+
"selectDate",
|
|
114
|
+
"selectTime",
|
|
115
|
+
],
|
|
116
|
+
data() {
|
|
117
|
+
const now = this.getNow(this.value);
|
|
118
|
+
const calendarYear = now.getFullYear();
|
|
119
|
+
const calendarMonth = now.getMonth();
|
|
120
|
+
const firstYear = Math.floor(calendarYear / 10) * 10;
|
|
121
|
+
return {
|
|
122
|
+
panel: "NONE",
|
|
123
|
+
dates: [],
|
|
124
|
+
calendarMonth,
|
|
125
|
+
calendarYear,
|
|
126
|
+
firstYear,
|
|
127
|
+
isFocusPanelChild: false,
|
|
128
|
+
isWorkWithKeyboard: false,
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
computed: {
|
|
132
|
+
now: {
|
|
133
|
+
get() {
|
|
134
|
+
return new Date(this.calendarYear, this.calendarMonth).getTime();
|
|
135
|
+
},
|
|
136
|
+
set(val) {
|
|
137
|
+
const now = new Date(val);
|
|
138
|
+
this.calendarYear = now.getFullYear();
|
|
139
|
+
this.calendarMonth = now.getMonth();
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
timeType() {
|
|
144
|
+
const h = /h+/.test(this.$parent.format) ? "12" : "24";
|
|
145
|
+
const a = /A/.test(this.$parent.format) ? "A" : "a";
|
|
146
|
+
return [h, a];
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
timeHeader() {
|
|
150
|
+
if (this.type === "time") {
|
|
151
|
+
return this.$parent.format;
|
|
152
|
+
}
|
|
153
|
+
return this.value && formatDate(this.value, this.dateFormat);
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
yearHeader() {
|
|
157
|
+
const LAST_YEAR = this.firstYear + 9;
|
|
158
|
+
return this.currentLanguage.headerYears(this.firstYear, LAST_YEAR);
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
months() {
|
|
162
|
+
return this.currentLanguage.months;
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
notBeforeTime() {
|
|
166
|
+
return this.getCriticalTime(this.notBefore);
|
|
167
|
+
},
|
|
168
|
+
|
|
169
|
+
notAfterTime() {
|
|
170
|
+
return this.getCriticalTime(this.notAfter);
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
suffixForHeader() {
|
|
174
|
+
if (this.panel === "TIME") {
|
|
175
|
+
return this.currentLanguage.placeholder.regionTime;
|
|
176
|
+
}
|
|
177
|
+
return this.currentLanguage.placeholder.regionDate;
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
idForHeaderParent() {
|
|
181
|
+
return `${ this.idForHeader }_parent`;
|
|
182
|
+
},
|
|
183
|
+
|
|
184
|
+
ariaLabelForButtonLastYear() {
|
|
185
|
+
if (this.panel === "YEAR") {
|
|
186
|
+
return this.currentLanguage.buttons.lastYears;
|
|
187
|
+
}
|
|
188
|
+
return this.currentLanguage.buttons.lastYear;
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
ariaLabelForButtonLastMonth() {
|
|
192
|
+
return this.currentLanguage.buttons.lastMonth;
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
ariaLabelForButtonNextMonth() {
|
|
196
|
+
return this.currentLanguage.buttons.nextMonth;
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
ariaLabelForButtonNextYear() {
|
|
200
|
+
if (this.panel === "YEAR") {
|
|
201
|
+
return this.currentLanguage.buttons.nextYears;
|
|
202
|
+
}
|
|
203
|
+
return this.currentLanguage.buttons.nextYear;
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
ariaLabelForButtonCurrentMonth() {
|
|
207
|
+
return this.currentLanguage.buttons.toMonthsView;
|
|
208
|
+
},
|
|
209
|
+
|
|
210
|
+
ariaLabelForButtonCurrentYear() {
|
|
211
|
+
return this.currentLanguage.buttons.toYearsView;
|
|
212
|
+
},
|
|
213
|
+
|
|
214
|
+
ariaLabelForButtonToDays() {
|
|
215
|
+
return this.currentLanguage.buttons.toDaysView;
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
watch: {
|
|
219
|
+
value: {
|
|
220
|
+
immediate: true,
|
|
221
|
+
handler: "updateNow",
|
|
222
|
+
},
|
|
223
|
+
defaultValue: {
|
|
224
|
+
handler: "updateNow",
|
|
225
|
+
},
|
|
226
|
+
visible: {
|
|
227
|
+
immediate: true,
|
|
228
|
+
handler: "init",
|
|
229
|
+
},
|
|
230
|
+
panel: {
|
|
231
|
+
handler: "handelPanelChange",
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
beforeUnmount() {
|
|
235
|
+
this.destroyListenerForPressTabButton();
|
|
236
|
+
this.destroyListenerForPressEscapeButton();
|
|
237
|
+
},
|
|
238
|
+
methods: {
|
|
239
|
+
handelPanelChange(panel) {
|
|
240
|
+
if (panel === "YEAR") {
|
|
241
|
+
this.firstYear = Math.floor(this.calendarYear / 10) * 10;
|
|
242
|
+
} else if (panel === "TIME") {
|
|
243
|
+
this.$nextTick().then(() => {
|
|
244
|
+
const list = this.$el.querySelectorAll(".pux_datepicker__panel_time .pux_datepicker__time_list");
|
|
245
|
+
for (let i = 0, len = list.length; i < len; i++) {
|
|
246
|
+
const el = list[i];
|
|
247
|
+
scrollIntoView(el, el.querySelector(".actived"));
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
|
|
253
|
+
init(val) {
|
|
254
|
+
if (val) {
|
|
255
|
+
const type = this.type;
|
|
256
|
+
if (type === "month") {
|
|
257
|
+
this.showPanelMonth();
|
|
258
|
+
} else if (type === "year") {
|
|
259
|
+
this.showPanelYear();
|
|
260
|
+
} else if (type === "time") {
|
|
261
|
+
this.showPanelTime();
|
|
262
|
+
} else {
|
|
263
|
+
this.showPanelDate();
|
|
264
|
+
}
|
|
265
|
+
this.setListenerForPressEscapeButton();
|
|
266
|
+
} else {
|
|
267
|
+
this.showPanelNone();
|
|
268
|
+
this.updateNow(this.value);
|
|
269
|
+
this.destroyListenerForPressEscapeButton();
|
|
270
|
+
}
|
|
271
|
+
this.emitEventBusDestroyAllListenerForPressButtonsForPanels();
|
|
272
|
+
},
|
|
273
|
+
|
|
274
|
+
getNow(value) {
|
|
275
|
+
return value
|
|
276
|
+
? new Date(value)
|
|
277
|
+
: this.defaultValue && isValidDate(this.defaultValue)
|
|
278
|
+
? new Date(this.defaultValue)
|
|
279
|
+
: new Date();
|
|
280
|
+
},
|
|
281
|
+
|
|
282
|
+
updateNow(value) {
|
|
283
|
+
this.now = this.getNow(value);
|
|
284
|
+
},
|
|
285
|
+
|
|
286
|
+
getCriticalTime(value) {
|
|
287
|
+
if (!value) {
|
|
288
|
+
return null;
|
|
289
|
+
}
|
|
290
|
+
const date = new Date(value);
|
|
291
|
+
if (this.type === "year") {
|
|
292
|
+
return new Date(date.getFullYear(), 0).getTime();
|
|
293
|
+
} else if (this.type === "month") {
|
|
294
|
+
return new Date(date.getFullYear(), date.getMonth()).getTime();
|
|
295
|
+
} else if (this.type === "date") {
|
|
296
|
+
return date.setHours(0, 0, 0, 0);
|
|
297
|
+
}
|
|
298
|
+
return date.getTime();
|
|
299
|
+
},
|
|
300
|
+
|
|
301
|
+
inBefore(time, startAt) {
|
|
302
|
+
if (startAt === undefined) {
|
|
303
|
+
startAt = this.startAt;
|
|
304
|
+
}
|
|
305
|
+
return (
|
|
306
|
+
(this.notBeforeTime && time < this.notBeforeTime) ||
|
|
307
|
+
(startAt && time < this.getCriticalTime(startAt))
|
|
308
|
+
);
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
inAfter(time, endAt) {
|
|
312
|
+
if (endAt === undefined) {
|
|
313
|
+
endAt = this.endAt;
|
|
314
|
+
}
|
|
315
|
+
return (
|
|
316
|
+
(this.notAfterTime && time > this.notAfterTime) ||
|
|
317
|
+
(endAt && time > this.getCriticalTime(endAt))
|
|
318
|
+
);
|
|
319
|
+
},
|
|
320
|
+
|
|
321
|
+
inDisabledDays(time) {
|
|
322
|
+
if (Array.isArray(this.disabledDays)) {
|
|
323
|
+
return this.disabledDays.some(v => this.getCriticalTime(v) === time);
|
|
324
|
+
}
|
|
325
|
+
if (typeof this.disabledDays === "function") {
|
|
326
|
+
return this.disabledDays(new Date(time));
|
|
327
|
+
}
|
|
328
|
+
return false;
|
|
329
|
+
},
|
|
330
|
+
|
|
331
|
+
isDisabledYear(year) {
|
|
332
|
+
const time = new Date(year, 0).getTime();
|
|
333
|
+
const maxTime = new Date(year + 1, 0).getTime() - 1;
|
|
334
|
+
return (
|
|
335
|
+
this.inBefore(maxTime) ||
|
|
336
|
+
this.inAfter(time) ||
|
|
337
|
+
(this.type === "year" && this.inDisabledDays(time))
|
|
338
|
+
);
|
|
339
|
+
},
|
|
340
|
+
|
|
341
|
+
isDisabledMonth(month) {
|
|
342
|
+
const time = new Date(this.calendarYear, month).getTime();
|
|
343
|
+
const maxTime = new Date(this.calendarYear, month + 1).getTime() - 1;
|
|
344
|
+
return (
|
|
345
|
+
this.inBefore(maxTime) ||
|
|
346
|
+
this.inAfter(time) ||
|
|
347
|
+
(this.type === "month" && this.inDisabledDays(time))
|
|
348
|
+
);
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
isDisabledDate(date) {
|
|
352
|
+
const time = new Date(date).getTime();
|
|
353
|
+
const maxTime = new Date(date).setHours(23, 59, 59, 999);
|
|
354
|
+
return (
|
|
355
|
+
this.inBefore(maxTime) ||
|
|
356
|
+
this.inAfter(time) ||
|
|
357
|
+
this.inDisabledDays(time)
|
|
358
|
+
);
|
|
359
|
+
},
|
|
360
|
+
|
|
361
|
+
isDisabledTime(date, startAt, endAt) {
|
|
362
|
+
const time = new Date(date).getTime();
|
|
363
|
+
return (
|
|
364
|
+
this.inBefore(time, startAt) ||
|
|
365
|
+
this.inAfter(time, endAt) ||
|
|
366
|
+
this.inDisabledDays(time)
|
|
367
|
+
);
|
|
368
|
+
},
|
|
369
|
+
|
|
370
|
+
selectDate(date) {
|
|
371
|
+
if (this.type === "datetime") {
|
|
372
|
+
let time = new Date(date);
|
|
373
|
+
if (isDateObject(this.value)) {
|
|
374
|
+
time.setHours(
|
|
375
|
+
this.value.getHours(),
|
|
376
|
+
this.value.getMinutes(),
|
|
377
|
+
this.value.getSeconds(),
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
if (this.isDisabledTime(time)) {
|
|
381
|
+
time.setHours(0, 0, 0, 0);
|
|
382
|
+
if (
|
|
383
|
+
this.notBefore &&
|
|
384
|
+
time.getTime() < new Date(this.notBefore).getTime()
|
|
385
|
+
) {
|
|
386
|
+
time = new Date(this.notBefore);
|
|
387
|
+
}
|
|
388
|
+
if (
|
|
389
|
+
this.startAt &&
|
|
390
|
+
time.getTime() < new Date(this.startAt).getTime()
|
|
391
|
+
) {
|
|
392
|
+
time = new Date(this.startAt);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
this.selectTime(time);
|
|
396
|
+
this.showPanelTime();
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
this.$emit("selectDate", date);
|
|
400
|
+
},
|
|
401
|
+
|
|
402
|
+
selectYear({ year, isButtonClick }) {
|
|
403
|
+
this.changeCalendarYear(year);
|
|
404
|
+
if (this.type.toLowerCase() === "year") {
|
|
405
|
+
return this.selectDate(new Date(this.now));
|
|
406
|
+
}
|
|
407
|
+
this.showPanelMonth();
|
|
408
|
+
if (isButtonClick) {
|
|
409
|
+
this.setFocusToActivePanel();
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
|
|
413
|
+
selectMonth({ month, isButtonClick }) {
|
|
414
|
+
this.changeCalendarMonth(month);
|
|
415
|
+
if (this.type.toLowerCase() === "month") {
|
|
416
|
+
return this.selectDate(new Date(this.now));
|
|
417
|
+
}
|
|
418
|
+
this.showPanelDate();
|
|
419
|
+
if (isButtonClick) {
|
|
420
|
+
this.setFocusToActivePanel();
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
|
|
424
|
+
selectTime(time, statusClose = false) {
|
|
425
|
+
this.$emit("selectTime", time, statusClose);
|
|
426
|
+
},
|
|
427
|
+
|
|
428
|
+
changeCalendarYear(year) {
|
|
429
|
+
this.updateNow(new Date(year, this.calendarMonth));
|
|
430
|
+
},
|
|
431
|
+
|
|
432
|
+
changeCalendarMonth(month) {
|
|
433
|
+
this.updateNow(new Date(this.calendarYear, month));
|
|
434
|
+
},
|
|
435
|
+
|
|
436
|
+
getSibling() {
|
|
437
|
+
const PANELS = [
|
|
438
|
+
this.$parent.$refs.calendarPanel,
|
|
439
|
+
];
|
|
440
|
+
if (this.$parent.$refs.calendarPanel2) {
|
|
441
|
+
PANELS.push(this.$parent.$refs.calendarPanel2);
|
|
442
|
+
}
|
|
443
|
+
const calendars = PANELS.filter(
|
|
444
|
+
v => v.$options.name === this.$options.name,
|
|
445
|
+
);
|
|
446
|
+
const index = calendars.indexOf(this);
|
|
447
|
+
/* eslint-disable-next-line no-bitwise */
|
|
448
|
+
return calendars[index ^ 1];
|
|
449
|
+
},
|
|
450
|
+
|
|
451
|
+
handleIconMonth(flag) {
|
|
452
|
+
const month = this.calendarMonth;
|
|
453
|
+
this.changeCalendarMonth(month + flag);
|
|
454
|
+
this.$parent.$emit("changeCalendarMonth", {
|
|
455
|
+
month,
|
|
456
|
+
flag,
|
|
457
|
+
vm: this,
|
|
458
|
+
sibling: this.getSibling(),
|
|
459
|
+
});
|
|
460
|
+
},
|
|
461
|
+
|
|
462
|
+
handleIconYear(flag) {
|
|
463
|
+
if (this.panel === "YEAR") {
|
|
464
|
+
this.changePanelYears(flag);
|
|
465
|
+
} else {
|
|
466
|
+
const year = this.calendarYear;
|
|
467
|
+
this.changeCalendarYear(year + flag);
|
|
468
|
+
this.$parent.$emit("changeCalendarYear", {
|
|
469
|
+
year,
|
|
470
|
+
flag,
|
|
471
|
+
vm: this,
|
|
472
|
+
sibling: this.getSibling(),
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
|
|
477
|
+
handleBtnYear() {
|
|
478
|
+
this.showPanelYear();
|
|
479
|
+
if (this.isWorkWithKeyboard) {
|
|
480
|
+
this.setFocusToActivePanel();
|
|
481
|
+
}
|
|
482
|
+
},
|
|
483
|
+
|
|
484
|
+
handleBtnMonth() {
|
|
485
|
+
this.showPanelMonth();
|
|
486
|
+
if (this.isWorkWithKeyboard) {
|
|
487
|
+
this.setFocusToActivePanel();
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
|
|
491
|
+
handleTimeHeader() {
|
|
492
|
+
if (this.type === "time") {
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
this.showPanelDate();
|
|
496
|
+
if (this.isWorkWithKeyboard) {
|
|
497
|
+
this.setFocusToActivePanel();
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
|
|
501
|
+
changePanelYears(flag) {
|
|
502
|
+
this.firstYear = this.firstYear + flag * 10;
|
|
503
|
+
},
|
|
504
|
+
|
|
505
|
+
showPanelNone() {
|
|
506
|
+
this.panel = "NONE";
|
|
507
|
+
this.isFocusPanelChild = false;
|
|
508
|
+
this.destroyListenerForPressTabButton();
|
|
509
|
+
this.emitEventBusDestroyAllListenerForPressButtonsForPanels();
|
|
510
|
+
this.setWorkWithoutKeyboard();
|
|
511
|
+
},
|
|
512
|
+
|
|
513
|
+
showPanelTime() {
|
|
514
|
+
this.panel = "TIME";
|
|
515
|
+
},
|
|
516
|
+
|
|
517
|
+
showPanelDate() {
|
|
518
|
+
this.panel = "DATE";
|
|
519
|
+
},
|
|
520
|
+
|
|
521
|
+
showPanelYear() {
|
|
522
|
+
this.panel = "YEAR";
|
|
523
|
+
},
|
|
524
|
+
|
|
525
|
+
showPanelMonth() {
|
|
526
|
+
this.panel = "MONTH";
|
|
527
|
+
},
|
|
528
|
+
|
|
529
|
+
setFocusToActivePanelFromParent() {
|
|
530
|
+
this.setWorkWithKeyboard();
|
|
531
|
+
this.setFocusToActivePanel();
|
|
532
|
+
this.setListenerForPressTabButton();
|
|
533
|
+
},
|
|
534
|
+
|
|
535
|
+
setFocusToActivePanel() {
|
|
536
|
+
this.isFocusPanelChild = true;
|
|
537
|
+
this.setFocusToActiveElementInChild();
|
|
538
|
+
},
|
|
539
|
+
|
|
540
|
+
removeFocusFromActivePanel() {
|
|
541
|
+
if (this.isFocusPanelChild) {
|
|
542
|
+
this.isFocusPanelChild = false;
|
|
543
|
+
this.emitEventBusDestroyAllListenerForPressButtonsForPanels();
|
|
544
|
+
}
|
|
545
|
+
},
|
|
546
|
+
|
|
547
|
+
setFocusToActiveElementInChild() {
|
|
548
|
+
if (this.panel === "DATE") {
|
|
549
|
+
this.$refs.panelDate.setFocusToActiveDay();
|
|
550
|
+
} else if (this.panel === "TIME") {
|
|
551
|
+
this.$refs.panelTime.setFocusToActiveTime();
|
|
552
|
+
} else if (this.panel === "YEAR") {
|
|
553
|
+
this.$refs.panelYear.setFocusToActiveYear();
|
|
554
|
+
} else if (this.panel === "MONTH") {
|
|
555
|
+
this.$refs.panelMonth.setFocusToActiveMonth();
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
|
|
559
|
+
setListenerForPressTabButton() {
|
|
560
|
+
document.addEventListener("keydown", this.pressTabButton);
|
|
561
|
+
},
|
|
562
|
+
|
|
563
|
+
destroyListenerForPressTabButton() {
|
|
564
|
+
document.removeEventListener("keydown", this.pressTabButton);
|
|
565
|
+
},
|
|
566
|
+
|
|
567
|
+
pressTabButton($event) {
|
|
568
|
+
const KEY_CODE = $event.keyCode;
|
|
569
|
+
if (KEY_CODE === keysCode.tab) {
|
|
570
|
+
this.trapFocus($event);
|
|
571
|
+
this.stopCurrentEvent($event);
|
|
572
|
+
}
|
|
573
|
+
},
|
|
574
|
+
|
|
575
|
+
trapFocus(EVENT) {
|
|
576
|
+
const FOCUSABLE_ELEMENTS = this.$el.querySelectorAll(".pux_datepicker__calendar__tab");
|
|
577
|
+
if (FOCUSABLE_ELEMENTS.length <= 1) {
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
let isFocused = false;
|
|
581
|
+
let isFocusedPanel = false;
|
|
582
|
+
forEach(FOCUSABLE_ELEMENTS, (element, elementIndex) => {
|
|
583
|
+
if (document.activeElement === element) {
|
|
584
|
+
if (EVENT.shiftKey) {
|
|
585
|
+
if (elementIndex === 0) {
|
|
586
|
+
FOCUSABLE_ELEMENTS[FOCUSABLE_ELEMENTS.length - 1].focus();
|
|
587
|
+
isFocusedPanel = true;
|
|
588
|
+
} else {
|
|
589
|
+
FOCUSABLE_ELEMENTS[elementIndex - 1].focus();
|
|
590
|
+
}
|
|
591
|
+
} else {
|
|
592
|
+
if (elementIndex === FOCUSABLE_ELEMENTS.length - 1) {
|
|
593
|
+
FOCUSABLE_ELEMENTS[0].focus();
|
|
594
|
+
} else {
|
|
595
|
+
FOCUSABLE_ELEMENTS[elementIndex + 1].focus();
|
|
596
|
+
}
|
|
597
|
+
if (elementIndex === FOCUSABLE_ELEMENTS.length - 2) {
|
|
598
|
+
isFocusedPanel = true;
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
isFocused = true;
|
|
602
|
+
return false;
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
if (!isFocused) {
|
|
606
|
+
if (EVENT.shiftKey) {
|
|
607
|
+
FOCUSABLE_ELEMENTS[FOCUSABLE_ELEMENTS.length - 2].focus();
|
|
608
|
+
} else {
|
|
609
|
+
FOCUSABLE_ELEMENTS[0].focus();
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
if (isFocusedPanel) {
|
|
613
|
+
this.setFocusToActivePanel();
|
|
614
|
+
} else {
|
|
615
|
+
this.removeFocusFromActivePanel();
|
|
616
|
+
}
|
|
617
|
+
},
|
|
618
|
+
|
|
619
|
+
setWorkWithKeyboard() {
|
|
620
|
+
this.isWorkWithKeyboard = true;
|
|
621
|
+
},
|
|
622
|
+
|
|
623
|
+
setWorkWithoutKeyboard() {
|
|
624
|
+
this.isWorkWithKeyboard = false;
|
|
625
|
+
},
|
|
626
|
+
|
|
627
|
+
setListenerForPressEscapeButton() {
|
|
628
|
+
document.addEventListener("keydown", this.pressEscapeButton);
|
|
629
|
+
},
|
|
630
|
+
|
|
631
|
+
destroyListenerForPressEscapeButton() {
|
|
632
|
+
document.removeEventListener("keydown", this.pressEscapeButton);
|
|
633
|
+
},
|
|
634
|
+
|
|
635
|
+
closePopup() {
|
|
636
|
+
this.$emit("closePopup", true);
|
|
637
|
+
},
|
|
638
|
+
|
|
639
|
+
pressEscapeButton($event) {
|
|
640
|
+
const KEY_CODE = $event.keyCode;
|
|
641
|
+
if (KEY_CODE === keysCode.escape) {
|
|
642
|
+
this.closePopup();
|
|
643
|
+
}
|
|
644
|
+
},
|
|
645
|
+
},
|
|
646
|
+
};
|