blip-ds 1.145.0 → 1.147.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.
- package/dist/blip-ds/bds-datepicker-period.entry.js +42 -0
- package/dist/blip-ds/bds-datepicker-single.entry.js +30 -1
- package/dist/blip-ds/bds-datepicker-single.system.entry.js +1 -1
- package/dist/blip-ds/bds-datepicker.entry.js +52 -2
- package/dist/blip-ds/bds-datepicker.system.entry.js +1 -1
- package/dist/blip-ds/{p-4704d274.entry.js → p-0d1f5fa4.entry.js} +1 -1
- package/dist/blip-ds/{p-2553e6b7.system.entry.js → p-37640cf1.system.entry.js} +1 -1
- package/dist/blip-ds/{p-31f15449.system.entry.js → p-7e7dcf6b.system.entry.js} +1 -1
- package/dist/blip-ds/p-bad3324a.system.js +1 -1
- package/dist/blip-ds/p-e09b9dfd.entry.js +1 -0
- package/dist/cjs/bds-datepicker-period.cjs.entry.js +42 -0
- package/dist/cjs/bds-datepicker-period_2.cjs.entry.js +72 -1
- package/dist/cjs/bds-datepicker-single.cjs.entry.js +30 -1
- package/dist/cjs/bds-datepicker.cjs.entry.js +52 -2
- package/dist/collection/components/datepicker/datepicker-period/datepicker-period.js +44 -2
- package/dist/collection/components/datepicker/datepicker-single/datepicker-single.js +31 -16
- package/dist/collection/components/datepicker/datepicker.js +57 -5
- package/dist/esm/bds-datepicker-period.entry.js +42 -0
- package/dist/esm/bds-datepicker-period_2.entry.js +72 -1
- package/dist/esm/bds-datepicker-single.entry.js +30 -1
- package/dist/esm/bds-datepicker.entry.js +52 -2
- package/dist/esm-es5/bds-datepicker-period_2.entry.js +1 -1
- package/dist/esm-es5/bds-datepicker.entry.js +1 -1
- package/dist/types/components/datepicker/datepicker-period/datepicker-period.d.ts +48 -0
- package/dist/types/components/datepicker/datepicker-single/datepicker-single.d.ts +33 -1
- package/dist/types/components/datepicker/datepicker.d.ts +37 -0
- package/dist/types/components.d.ts +15 -1
- package/package.json +1 -1
- package/dist/blip-ds/p-d886f193.entry.js +0 -1
|
@@ -32,6 +32,9 @@ const BdsdatepickerPeriod = class {
|
|
|
32
32
|
* EndDateSelect. Insert a limiter to select the date period.
|
|
33
33
|
*/
|
|
34
34
|
this.endDateSelect = null;
|
|
35
|
+
/**
|
|
36
|
+
* handler of select months or yaer.
|
|
37
|
+
*/
|
|
35
38
|
this.handler = (event, ref) => {
|
|
36
39
|
const { detail: { value }, } = event;
|
|
37
40
|
if (ref == 'months') {
|
|
@@ -45,6 +48,9 @@ const BdsdatepickerPeriod = class {
|
|
|
45
48
|
this.yearActivated = value;
|
|
46
49
|
}
|
|
47
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* openDateSelect. Function to open the year or month selector.
|
|
53
|
+
*/
|
|
48
54
|
this.openDateSelect = (value, ref) => {
|
|
49
55
|
if (ref == 'months') {
|
|
50
56
|
setTimeout(() => {
|
|
@@ -65,12 +71,18 @@ const BdsdatepickerPeriod = class {
|
|
|
65
71
|
this.startDateSelect = null;
|
|
66
72
|
this.endDateSelect = null;
|
|
67
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* startDateSelect. Function to output selected start date.
|
|
76
|
+
*/
|
|
68
77
|
startDateSelectChanged() {
|
|
69
78
|
var _a;
|
|
70
79
|
this.bdsStartDate.emit({ value: this.startDateSelect });
|
|
71
80
|
this.monthActivated = this.startDateSelect ? (_a = this.startDateSelect) === null || _a === void 0 ? void 0 : _a.getMonth() : this.startDate.month;
|
|
72
81
|
this.yearActivated = this.startDateSelect ? this.startDateSelect.getFullYear() : this.startDate.year;
|
|
73
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* endDateSelect. Function to output selected end date.
|
|
85
|
+
*/
|
|
74
86
|
endDateSelectChanged() {
|
|
75
87
|
this.bdsEndDate.emit({ value: this.endDateSelect });
|
|
76
88
|
this.monthActivated = this.endDateSelect
|
|
@@ -105,6 +117,9 @@ const BdsdatepickerPeriod = class {
|
|
|
105
117
|
this.years = getYears(this.yearActivated, this.startDate.year, this.endDate.year);
|
|
106
118
|
this.months = getMonths(this.yearActivated, this.startDate, this.endDate);
|
|
107
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* prevDays. Function to create a gap between the beginning of the grid and the first day of the month.
|
|
122
|
+
*/
|
|
108
123
|
prevDays(value) {
|
|
109
124
|
const lenghtDays = [];
|
|
110
125
|
for (let i = 0; i < value; i++) {
|
|
@@ -112,6 +127,9 @@ const BdsdatepickerPeriod = class {
|
|
|
112
127
|
}
|
|
113
128
|
return lenghtDays.map((item) => h("span", { key: `id${item}`, class: `space ${item}` }));
|
|
114
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* selectDate. Function to select the desired date.
|
|
132
|
+
*/
|
|
115
133
|
selectDate(value) {
|
|
116
134
|
const changeSelected = new Date(value.year, value.month, value.date);
|
|
117
135
|
if (this.startDateSelect) {
|
|
@@ -121,6 +139,9 @@ const BdsdatepickerPeriod = class {
|
|
|
121
139
|
this.startDateSelect = changeSelected;
|
|
122
140
|
}
|
|
123
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* prevMonth. Function to rewind the date on the calendar slide.
|
|
144
|
+
*/
|
|
124
145
|
prevMonth() {
|
|
125
146
|
this.animatePrev = true;
|
|
126
147
|
if (this.loadingSlide != 'pendding') {
|
|
@@ -139,6 +160,9 @@ const BdsdatepickerPeriod = class {
|
|
|
139
160
|
return;
|
|
140
161
|
}
|
|
141
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* nextMonth. Function to advance the date on the calendar slide.
|
|
165
|
+
*/
|
|
142
166
|
nextMonth() {
|
|
143
167
|
this.animateNext = true;
|
|
144
168
|
if (this.loadingSlide != 'pendding') {
|
|
@@ -157,6 +181,9 @@ const BdsdatepickerPeriod = class {
|
|
|
157
181
|
return;
|
|
158
182
|
}
|
|
159
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* checkCurrentDay. Function to check the current day.
|
|
186
|
+
*/
|
|
160
187
|
checkCurrentDay(value) {
|
|
161
188
|
const validateDate = fillDayList(value);
|
|
162
189
|
const fullCurrDate = fillDate(THIS_DAY);
|
|
@@ -165,6 +192,9 @@ const BdsdatepickerPeriod = class {
|
|
|
165
192
|
else
|
|
166
193
|
return false;
|
|
167
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* checkDisableDay. Function to check the disable day.
|
|
197
|
+
*/
|
|
168
198
|
checkDisableDay(value) {
|
|
169
199
|
const validateDate = fillDayList(value);
|
|
170
200
|
const startDateLimit = this.startDate ? fillDayList(this.startDate) : `0`;
|
|
@@ -182,6 +212,9 @@ const BdsdatepickerPeriod = class {
|
|
|
182
212
|
return true;
|
|
183
213
|
}
|
|
184
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* checkSelectedDay. Function to check the selected day.
|
|
217
|
+
*/
|
|
185
218
|
checkSelectedDay(value) {
|
|
186
219
|
const validateDate = fillDayList(value);
|
|
187
220
|
const startSelectedDate = this.startDateSelect ? fillDate(this.startDateSelect) : `0`;
|
|
@@ -191,6 +224,9 @@ const BdsdatepickerPeriod = class {
|
|
|
191
224
|
else
|
|
192
225
|
return false;
|
|
193
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* checkPeriodDay. Function to check the period selected day.
|
|
229
|
+
*/
|
|
194
230
|
checkPeriodDay(value) {
|
|
195
231
|
const validateDate = fillDayList(value);
|
|
196
232
|
const startSelectedDate = this.startDateSelect ? fillDate(this.startDateSelect) : `0`;
|
|
@@ -201,6 +237,9 @@ const BdsdatepickerPeriod = class {
|
|
|
201
237
|
}
|
|
202
238
|
}
|
|
203
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* checkPeriodStart. Function to check the period selected start day.
|
|
242
|
+
*/
|
|
204
243
|
checkPeriodStart(value) {
|
|
205
244
|
const validateDate = value.date == 1;
|
|
206
245
|
const validateDay = value.day == 0;
|
|
@@ -211,6 +250,9 @@ const BdsdatepickerPeriod = class {
|
|
|
211
250
|
return true;
|
|
212
251
|
}
|
|
213
252
|
}
|
|
253
|
+
/**
|
|
254
|
+
* checkPeriodEnd. Function to check the period selected end day.
|
|
255
|
+
*/
|
|
214
256
|
checkPeriodEnd(value, lastItem) {
|
|
215
257
|
const validateDate = lastItem;
|
|
216
258
|
const validateDay = value.day == 6;
|
|
@@ -32,6 +32,9 @@ const BdsdatepickerPeriod = class {
|
|
|
32
32
|
* EndDateSelect. Insert a limiter to select the date period.
|
|
33
33
|
*/
|
|
34
34
|
this.endDateSelect = null;
|
|
35
|
+
/**
|
|
36
|
+
* handler of select months or yaer.
|
|
37
|
+
*/
|
|
35
38
|
this.handler = (event, ref) => {
|
|
36
39
|
const { detail: { value }, } = event;
|
|
37
40
|
if (ref == 'months') {
|
|
@@ -45,6 +48,9 @@ const BdsdatepickerPeriod = class {
|
|
|
45
48
|
this.yearActivated = value;
|
|
46
49
|
}
|
|
47
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* openDateSelect. Function to open the year or month selector.
|
|
53
|
+
*/
|
|
48
54
|
this.openDateSelect = (value, ref) => {
|
|
49
55
|
if (ref == 'months') {
|
|
50
56
|
setTimeout(() => {
|
|
@@ -65,12 +71,18 @@ const BdsdatepickerPeriod = class {
|
|
|
65
71
|
this.startDateSelect = null;
|
|
66
72
|
this.endDateSelect = null;
|
|
67
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* startDateSelect. Function to output selected start date.
|
|
76
|
+
*/
|
|
68
77
|
startDateSelectChanged() {
|
|
69
78
|
var _a;
|
|
70
79
|
this.bdsStartDate.emit({ value: this.startDateSelect });
|
|
71
80
|
this.monthActivated = this.startDateSelect ? (_a = this.startDateSelect) === null || _a === void 0 ? void 0 : _a.getMonth() : this.startDate.month;
|
|
72
81
|
this.yearActivated = this.startDateSelect ? this.startDateSelect.getFullYear() : this.startDate.year;
|
|
73
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* endDateSelect. Function to output selected end date.
|
|
85
|
+
*/
|
|
74
86
|
endDateSelectChanged() {
|
|
75
87
|
this.bdsEndDate.emit({ value: this.endDateSelect });
|
|
76
88
|
this.monthActivated = this.endDateSelect
|
|
@@ -105,6 +117,9 @@ const BdsdatepickerPeriod = class {
|
|
|
105
117
|
this.years = getYears(this.yearActivated, this.startDate.year, this.endDate.year);
|
|
106
118
|
this.months = getMonths(this.yearActivated, this.startDate, this.endDate);
|
|
107
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* prevDays. Function to create a gap between the beginning of the grid and the first day of the month.
|
|
122
|
+
*/
|
|
108
123
|
prevDays(value) {
|
|
109
124
|
const lenghtDays = [];
|
|
110
125
|
for (let i = 0; i < value; i++) {
|
|
@@ -112,6 +127,9 @@ const BdsdatepickerPeriod = class {
|
|
|
112
127
|
}
|
|
113
128
|
return lenghtDays.map((item) => h("span", { key: `id${item}`, class: `space ${item}` }));
|
|
114
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* selectDate. Function to select the desired date.
|
|
132
|
+
*/
|
|
115
133
|
selectDate(value) {
|
|
116
134
|
const changeSelected = new Date(value.year, value.month, value.date);
|
|
117
135
|
if (this.startDateSelect) {
|
|
@@ -121,6 +139,9 @@ const BdsdatepickerPeriod = class {
|
|
|
121
139
|
this.startDateSelect = changeSelected;
|
|
122
140
|
}
|
|
123
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* prevMonth. Function to rewind the date on the calendar slide.
|
|
144
|
+
*/
|
|
124
145
|
prevMonth() {
|
|
125
146
|
this.animatePrev = true;
|
|
126
147
|
if (this.loadingSlide != 'pendding') {
|
|
@@ -139,6 +160,9 @@ const BdsdatepickerPeriod = class {
|
|
|
139
160
|
return;
|
|
140
161
|
}
|
|
141
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* nextMonth. Function to advance the date on the calendar slide.
|
|
165
|
+
*/
|
|
142
166
|
nextMonth() {
|
|
143
167
|
this.animateNext = true;
|
|
144
168
|
if (this.loadingSlide != 'pendding') {
|
|
@@ -157,6 +181,9 @@ const BdsdatepickerPeriod = class {
|
|
|
157
181
|
return;
|
|
158
182
|
}
|
|
159
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* checkCurrentDay. Function to check the current day.
|
|
186
|
+
*/
|
|
160
187
|
checkCurrentDay(value) {
|
|
161
188
|
const validateDate = fillDayList(value);
|
|
162
189
|
const fullCurrDate = fillDate(THIS_DAY);
|
|
@@ -165,6 +192,9 @@ const BdsdatepickerPeriod = class {
|
|
|
165
192
|
else
|
|
166
193
|
return false;
|
|
167
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* checkDisableDay. Function to check the disable day.
|
|
197
|
+
*/
|
|
168
198
|
checkDisableDay(value) {
|
|
169
199
|
const validateDate = fillDayList(value);
|
|
170
200
|
const startDateLimit = this.startDate ? fillDayList(this.startDate) : `0`;
|
|
@@ -182,6 +212,9 @@ const BdsdatepickerPeriod = class {
|
|
|
182
212
|
return true;
|
|
183
213
|
}
|
|
184
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* checkSelectedDay. Function to check the selected day.
|
|
217
|
+
*/
|
|
185
218
|
checkSelectedDay(value) {
|
|
186
219
|
const validateDate = fillDayList(value);
|
|
187
220
|
const startSelectedDate = this.startDateSelect ? fillDate(this.startDateSelect) : `0`;
|
|
@@ -191,6 +224,9 @@ const BdsdatepickerPeriod = class {
|
|
|
191
224
|
else
|
|
192
225
|
return false;
|
|
193
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* checkPeriodDay. Function to check the period selected day.
|
|
229
|
+
*/
|
|
194
230
|
checkPeriodDay(value) {
|
|
195
231
|
const validateDate = fillDayList(value);
|
|
196
232
|
const startSelectedDate = this.startDateSelect ? fillDate(this.startDateSelect) : `0`;
|
|
@@ -201,6 +237,9 @@ const BdsdatepickerPeriod = class {
|
|
|
201
237
|
}
|
|
202
238
|
}
|
|
203
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* checkPeriodStart. Function to check the period selected start day.
|
|
242
|
+
*/
|
|
204
243
|
checkPeriodStart(value) {
|
|
205
244
|
const validateDate = value.date == 1;
|
|
206
245
|
const validateDay = value.day == 0;
|
|
@@ -211,6 +250,9 @@ const BdsdatepickerPeriod = class {
|
|
|
211
250
|
return true;
|
|
212
251
|
}
|
|
213
252
|
}
|
|
253
|
+
/**
|
|
254
|
+
* checkPeriodEnd. Function to check the period selected end day.
|
|
255
|
+
*/
|
|
214
256
|
checkPeriodEnd(value, lastItem) {
|
|
215
257
|
const validateDate = lastItem;
|
|
216
258
|
const validateDay = value.day == 6;
|
|
@@ -291,7 +333,6 @@ const BdsdatepickerSingle = class {
|
|
|
291
333
|
constructor(hostRef) {
|
|
292
334
|
registerInstance(this, hostRef);
|
|
293
335
|
this.bdsDateSelected = createEvent(this, "bdsDateSelected", 7);
|
|
294
|
-
this.bdsClearDate = createEvent(this, "bdsClearDate", 7);
|
|
295
336
|
this.monthActivated = THIS_DAY.getMonth();
|
|
296
337
|
this.yearActivated = THIS_DAY.getFullYear();
|
|
297
338
|
this.animatePrev = false;
|
|
@@ -311,6 +352,9 @@ const BdsdatepickerSingle = class {
|
|
|
311
352
|
* dateSelect. Insert a limiter to select the date period.
|
|
312
353
|
*/
|
|
313
354
|
this.dateSelect = null;
|
|
355
|
+
/**
|
|
356
|
+
* handler of select months or yaer.
|
|
357
|
+
*/
|
|
314
358
|
this.handler = (event, ref) => {
|
|
315
359
|
const { detail: { value }, } = event;
|
|
316
360
|
if (ref == 'months') {
|
|
@@ -324,6 +368,9 @@ const BdsdatepickerSingle = class {
|
|
|
324
368
|
this.yearActivated = value;
|
|
325
369
|
}
|
|
326
370
|
};
|
|
371
|
+
/**
|
|
372
|
+
* openDateSelect. Function to open the year or month selector.
|
|
373
|
+
*/
|
|
327
374
|
this.openDateSelect = (value, ref) => {
|
|
328
375
|
if (ref == 'months') {
|
|
329
376
|
setTimeout(() => {
|
|
@@ -343,6 +390,9 @@ const BdsdatepickerSingle = class {
|
|
|
343
390
|
async clear() {
|
|
344
391
|
this.dateSelect = null;
|
|
345
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* dateSelect. Function to output selected date.
|
|
395
|
+
*/
|
|
346
396
|
dateSelectChanged() {
|
|
347
397
|
var _a;
|
|
348
398
|
this.monthActivated = this.dateSelect ? (_a = this.dateSelect) === null || _a === void 0 ? void 0 : _a.getMonth() : this.startDate.month;
|
|
@@ -368,6 +418,9 @@ const BdsdatepickerSingle = class {
|
|
|
368
418
|
this.years = getYears(this.yearActivated, this.startDate.year, this.endDate.year);
|
|
369
419
|
this.months = getMonths(this.yearActivated, this.startDate, this.endDate);
|
|
370
420
|
}
|
|
421
|
+
/**
|
|
422
|
+
* prevDays. Function to create a gap between the beginning of the grid and the first day of the month.
|
|
423
|
+
*/
|
|
371
424
|
prevDays(value) {
|
|
372
425
|
const lenghtDays = [];
|
|
373
426
|
for (let i = 0; i < value; i++) {
|
|
@@ -375,10 +428,16 @@ const BdsdatepickerSingle = class {
|
|
|
375
428
|
}
|
|
376
429
|
return lenghtDays.map((item) => h("span", { key: `id${item}`, class: `space ${item}` }));
|
|
377
430
|
}
|
|
431
|
+
/**
|
|
432
|
+
* selectDate. Function to select the desired date.
|
|
433
|
+
*/
|
|
378
434
|
selectDate(value) {
|
|
379
435
|
const changeSelected = new Date(value.year, value.month, value.date);
|
|
380
436
|
this.bdsDateSelected.emit({ value: changeSelected });
|
|
381
437
|
}
|
|
438
|
+
/**
|
|
439
|
+
* prevMonth. Function to rewind the date on the calendar slide.
|
|
440
|
+
*/
|
|
382
441
|
prevMonth() {
|
|
383
442
|
this.animatePrev = true;
|
|
384
443
|
if (this.loadingSlide != 'pendding') {
|
|
@@ -397,6 +456,9 @@ const BdsdatepickerSingle = class {
|
|
|
397
456
|
return;
|
|
398
457
|
}
|
|
399
458
|
}
|
|
459
|
+
/**
|
|
460
|
+
* nextMonth. Function to advance the date on the calendar slide.
|
|
461
|
+
*/
|
|
400
462
|
nextMonth() {
|
|
401
463
|
this.animateNext = true;
|
|
402
464
|
if (this.loadingSlide != 'pendding') {
|
|
@@ -415,6 +477,9 @@ const BdsdatepickerSingle = class {
|
|
|
415
477
|
return;
|
|
416
478
|
}
|
|
417
479
|
}
|
|
480
|
+
/**
|
|
481
|
+
* checkCurrentDay. Function to check the current day.
|
|
482
|
+
*/
|
|
418
483
|
checkCurrentDay(value) {
|
|
419
484
|
const fullCurrDate = fillDate(THIS_DAY);
|
|
420
485
|
if (fillDayList(value) == fullCurrDate)
|
|
@@ -422,6 +487,9 @@ const BdsdatepickerSingle = class {
|
|
|
422
487
|
else
|
|
423
488
|
return false;
|
|
424
489
|
}
|
|
490
|
+
/**
|
|
491
|
+
* checkDisableDay. Function to check the disable day.
|
|
492
|
+
*/
|
|
425
493
|
checkDisableDay(value) {
|
|
426
494
|
const startDateLimit = this.startDate ? fillDayList(this.startDate) : `0`;
|
|
427
495
|
const endDateLimit = this.endDate ? fillDayList(this.endDate) : `9999999`;
|
|
@@ -432,6 +500,9 @@ const BdsdatepickerSingle = class {
|
|
|
432
500
|
return true;
|
|
433
501
|
}
|
|
434
502
|
}
|
|
503
|
+
/**
|
|
504
|
+
* checkSelectedDay. Function to check the selected day.
|
|
505
|
+
*/
|
|
435
506
|
checkSelectedDay(value) {
|
|
436
507
|
const selectedDate = this.dateSelect ? fillDate(this.dateSelect) : `0`;
|
|
437
508
|
if (fillDayList(value) == selectedDate)
|
|
@@ -7,7 +7,6 @@ const BdsdatepickerSingle = class {
|
|
|
7
7
|
constructor(hostRef) {
|
|
8
8
|
registerInstance(this, hostRef);
|
|
9
9
|
this.bdsDateSelected = createEvent(this, "bdsDateSelected", 7);
|
|
10
|
-
this.bdsClearDate = createEvent(this, "bdsClearDate", 7);
|
|
11
10
|
this.monthActivated = THIS_DAY.getMonth();
|
|
12
11
|
this.yearActivated = THIS_DAY.getFullYear();
|
|
13
12
|
this.animatePrev = false;
|
|
@@ -27,6 +26,9 @@ const BdsdatepickerSingle = class {
|
|
|
27
26
|
* dateSelect. Insert a limiter to select the date period.
|
|
28
27
|
*/
|
|
29
28
|
this.dateSelect = null;
|
|
29
|
+
/**
|
|
30
|
+
* handler of select months or yaer.
|
|
31
|
+
*/
|
|
30
32
|
this.handler = (event, ref) => {
|
|
31
33
|
const { detail: { value }, } = event;
|
|
32
34
|
if (ref == 'months') {
|
|
@@ -40,6 +42,9 @@ const BdsdatepickerSingle = class {
|
|
|
40
42
|
this.yearActivated = value;
|
|
41
43
|
}
|
|
42
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* openDateSelect. Function to open the year or month selector.
|
|
47
|
+
*/
|
|
43
48
|
this.openDateSelect = (value, ref) => {
|
|
44
49
|
if (ref == 'months') {
|
|
45
50
|
setTimeout(() => {
|
|
@@ -59,6 +64,9 @@ const BdsdatepickerSingle = class {
|
|
|
59
64
|
async clear() {
|
|
60
65
|
this.dateSelect = null;
|
|
61
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* dateSelect. Function to output selected date.
|
|
69
|
+
*/
|
|
62
70
|
dateSelectChanged() {
|
|
63
71
|
var _a;
|
|
64
72
|
this.monthActivated = this.dateSelect ? (_a = this.dateSelect) === null || _a === void 0 ? void 0 : _a.getMonth() : this.startDate.month;
|
|
@@ -84,6 +92,9 @@ const BdsdatepickerSingle = class {
|
|
|
84
92
|
this.years = getYears(this.yearActivated, this.startDate.year, this.endDate.year);
|
|
85
93
|
this.months = getMonths(this.yearActivated, this.startDate, this.endDate);
|
|
86
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* prevDays. Function to create a gap between the beginning of the grid and the first day of the month.
|
|
97
|
+
*/
|
|
87
98
|
prevDays(value) {
|
|
88
99
|
const lenghtDays = [];
|
|
89
100
|
for (let i = 0; i < value; i++) {
|
|
@@ -91,10 +102,16 @@ const BdsdatepickerSingle = class {
|
|
|
91
102
|
}
|
|
92
103
|
return lenghtDays.map((item) => h("span", { key: `id${item}`, class: `space ${item}` }));
|
|
93
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* selectDate. Function to select the desired date.
|
|
107
|
+
*/
|
|
94
108
|
selectDate(value) {
|
|
95
109
|
const changeSelected = new Date(value.year, value.month, value.date);
|
|
96
110
|
this.bdsDateSelected.emit({ value: changeSelected });
|
|
97
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* prevMonth. Function to rewind the date on the calendar slide.
|
|
114
|
+
*/
|
|
98
115
|
prevMonth() {
|
|
99
116
|
this.animatePrev = true;
|
|
100
117
|
if (this.loadingSlide != 'pendding') {
|
|
@@ -113,6 +130,9 @@ const BdsdatepickerSingle = class {
|
|
|
113
130
|
return;
|
|
114
131
|
}
|
|
115
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* nextMonth. Function to advance the date on the calendar slide.
|
|
135
|
+
*/
|
|
116
136
|
nextMonth() {
|
|
117
137
|
this.animateNext = true;
|
|
118
138
|
if (this.loadingSlide != 'pendding') {
|
|
@@ -131,6 +151,9 @@ const BdsdatepickerSingle = class {
|
|
|
131
151
|
return;
|
|
132
152
|
}
|
|
133
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* checkCurrentDay. Function to check the current day.
|
|
156
|
+
*/
|
|
134
157
|
checkCurrentDay(value) {
|
|
135
158
|
const fullCurrDate = fillDate(THIS_DAY);
|
|
136
159
|
if (fillDayList(value) == fullCurrDate)
|
|
@@ -138,6 +161,9 @@ const BdsdatepickerSingle = class {
|
|
|
138
161
|
else
|
|
139
162
|
return false;
|
|
140
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* checkDisableDay. Function to check the disable day.
|
|
166
|
+
*/
|
|
141
167
|
checkDisableDay(value) {
|
|
142
168
|
const startDateLimit = this.startDate ? fillDayList(this.startDate) : `0`;
|
|
143
169
|
const endDateLimit = this.endDate ? fillDayList(this.endDate) : `9999999`;
|
|
@@ -148,6 +174,9 @@ const BdsdatepickerSingle = class {
|
|
|
148
174
|
return true;
|
|
149
175
|
}
|
|
150
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* checkSelectedDay. Function to check the selected day.
|
|
179
|
+
*/
|
|
151
180
|
checkSelectedDay(value) {
|
|
152
181
|
const selectedDate = this.dateSelect ? fillDate(this.dateSelect) : `0`;
|
|
153
182
|
if (fillDayList(value) == selectedDate)
|
|
@@ -32,24 +32,42 @@ const DatePicker = class {
|
|
|
32
32
|
* Message. Select type of date.
|
|
33
33
|
*/
|
|
34
34
|
this.message = null;
|
|
35
|
+
this.refInputSetDate = (el) => {
|
|
36
|
+
this.inputSetDate = el;
|
|
37
|
+
};
|
|
38
|
+
this.refInputSetEndDate = (el) => {
|
|
39
|
+
this.inputSetEndDate = el;
|
|
40
|
+
};
|
|
35
41
|
this.refDatepickerPeriod = (el) => {
|
|
36
42
|
this.datepickerPeriod = el;
|
|
37
43
|
};
|
|
38
44
|
this.refDatepickerSingle = (el) => {
|
|
39
45
|
this.datepickerSingle = el;
|
|
40
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* clearDateSingle. Function to clear datepicker-single
|
|
49
|
+
*/
|
|
41
50
|
this.clearDateSingle = () => {
|
|
42
51
|
this.datepickerSingle.clear();
|
|
43
52
|
this.valueDateSelected = null;
|
|
44
53
|
this.bdsStartDate.emit({ value: null });
|
|
45
54
|
};
|
|
55
|
+
/**
|
|
56
|
+
* clearDatePeriod. Function to clear datepicker-period
|
|
57
|
+
*/
|
|
46
58
|
this.clearDatePeriod = () => {
|
|
47
59
|
this.datepickerPeriod.clear();
|
|
48
60
|
this.valueDateSelected = null;
|
|
49
61
|
this.valueEndDateSelected = null;
|
|
50
62
|
this.bdsStartDate.emit({ value: null });
|
|
51
63
|
this.bdsEndDate.emit({ value: null });
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
this.inputSetDate.setFocus();
|
|
66
|
+
}, 10);
|
|
52
67
|
};
|
|
68
|
+
/**
|
|
69
|
+
* maskDateSelected. Function to add mask to date field
|
|
70
|
+
*/
|
|
53
71
|
this.maskDateSelected = (ev) => {
|
|
54
72
|
const input = ev.target;
|
|
55
73
|
this.valueDateSelected = maskDate(input.value);
|
|
@@ -69,6 +87,9 @@ const DatePicker = class {
|
|
|
69
87
|
}
|
|
70
88
|
}
|
|
71
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* maskEndDateSelected. Function to add mask to the end date field
|
|
92
|
+
*/
|
|
72
93
|
this.maskEndDateSelected = (ev) => {
|
|
73
94
|
const input = ev.target;
|
|
74
95
|
this.valueEndDateSelected = maskDate(input.value);
|
|
@@ -88,12 +109,31 @@ const DatePicker = class {
|
|
|
88
109
|
}
|
|
89
110
|
}
|
|
90
111
|
};
|
|
112
|
+
this.onClickSetDate = () => {
|
|
113
|
+
this.open = true;
|
|
114
|
+
setTimeout(() => {
|
|
115
|
+
this.inputSetDate.setFocus();
|
|
116
|
+
this.inputSetEndDate.removeFocus();
|
|
117
|
+
}, 50);
|
|
118
|
+
this.datepickerPeriod.clear();
|
|
119
|
+
this.valueEndDateSelected = null;
|
|
120
|
+
};
|
|
121
|
+
this.closeDatepicker = () => {
|
|
122
|
+
this.inputSetEndDate.removeFocus();
|
|
123
|
+
this.open = false;
|
|
124
|
+
};
|
|
91
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* startDateLimit validation.
|
|
128
|
+
*/
|
|
92
129
|
startDateLimitChanged() {
|
|
93
130
|
if (!dateValidation(this.startDateLimit)) {
|
|
94
131
|
this.startDateLimit = defaultStartDate;
|
|
95
132
|
}
|
|
96
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* endDateLimit validation.
|
|
136
|
+
*/
|
|
97
137
|
endDateLimitChanged() {
|
|
98
138
|
const dlStartDate = dateToDayList(this.startDateLimit);
|
|
99
139
|
const dlEndDate = dateToDayList(this.endDateLimit);
|
|
@@ -106,10 +146,16 @@ const DatePicker = class {
|
|
|
106
146
|
.padStart(2, '0')}/${dlStartDate.year + 1}`;
|
|
107
147
|
}
|
|
108
148
|
}
|
|
149
|
+
dateSelectedChanged() {
|
|
150
|
+
this.inputSetEndDate.setFocus();
|
|
151
|
+
}
|
|
109
152
|
componentWillLoad() {
|
|
110
153
|
this.endDateLimitChanged();
|
|
111
154
|
this.startDateLimitChanged();
|
|
112
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* selectDate. Function to output selected date.
|
|
158
|
+
*/
|
|
113
159
|
selectDate(event) {
|
|
114
160
|
const { detail: { value }, } = event;
|
|
115
161
|
this.dateSelected = value;
|
|
@@ -117,6 +163,9 @@ const DatePicker = class {
|
|
|
117
163
|
this.valueDateSelected = this.dateSelected && dateToString(this.dateSelected);
|
|
118
164
|
this.errorMsgDate = null;
|
|
119
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* selectEndDate. Function to issue selected end date..
|
|
168
|
+
*/
|
|
120
169
|
selectEndDate(event) {
|
|
121
170
|
const { detail: { value }, } = event;
|
|
122
171
|
this.endDateSelected = value;
|
|
@@ -125,11 +174,12 @@ const DatePicker = class {
|
|
|
125
174
|
this.errorMsgEndDate = null;
|
|
126
175
|
}
|
|
127
176
|
render() {
|
|
128
|
-
return (h("div", { class: { datepicker: true } }, this.typeOfDate == 'single' ? (h("div", { class: { datepicker__inputs: true, [`datepicker__inputs__${this.typeOfDate}`]: true } }, h("bds-input", { label: "Definir a data", value: this.valueDateSelected, placeholder: "__/__/____", maxlength: 10, icon: "calendar", onClick: () => (this.open = true), onBdsInput: (ev) => this.maskDateSelected(ev), danger: this.errorMsgDate ? true : false, errorMessage: this.errorMsgDate }))) : (h("div", { class: { datepicker__inputs: true, [`datepicker__inputs__${this.typeOfDate}`]: true } }, h("bds-input", { label: "De", value: this.valueDateSelected, placeholder: "__/__/____", maxlength: 10, icon: "calendar", onClick: () =>
|
|
177
|
+
return (h("div", { class: { datepicker: true } }, this.typeOfDate == 'single' ? (h("div", { class: { datepicker__inputs: true, [`datepicker__inputs__${this.typeOfDate}`]: true } }, h("bds-input", { label: "Definir a data", value: this.valueDateSelected, placeholder: "__/__/____", maxlength: 10, icon: "calendar", onClick: () => (this.open = true), onBdsInput: (ev) => this.maskDateSelected(ev), danger: this.errorMsgDate ? true : false, errorMessage: this.errorMsgDate }))) : (h("div", { class: { datepicker__inputs: true, [`datepicker__inputs__${this.typeOfDate}`]: true } }, h("bds-input", { ref: this.refInputSetDate, label: "De", value: this.valueDateSelected, placeholder: "__/__/____", maxlength: 10, icon: "calendar", onClick: () => this.onClickSetDate(), onBdsInput: (ev) => this.maskDateSelected(ev), danger: this.errorMsgDate ? true : false, errorMessage: this.errorMsgDate }), h("bds-input", { ref: this.refInputSetEndDate, label: "At\u00E9", value: this.valueEndDateSelected, disabled: !this.dateSelected, placeholder: "__/__/____", maxlength: 10, icon: "calendar", onClick: () => (this.open = true), onBdsInput: (ev) => this.maskEndDateSelected(ev), danger: this.errorMsgEndDate ? true : false, errorMessage: this.errorMsgEndDate }))), h("div", { class: { datepicker__menu: true, datepicker__menu__open: this.open } }, this.message && (h("div", { class: "datepicker__menu__message" }, h("bds-icon", { name: "warning", theme: "outline", "aria-label": "\u00CDcone de aten\u00E7\u00E3o" }), h("bds-typo", { variant: "fs-16" }, this.message))), this.typeOfDate == 'single' ? (h("bds-datepicker-single", { ref: this.refDatepickerSingle, startDate: this.startDateLimit && dateToDayList(this.startDateLimit), endDate: this.endDateLimit && dateToDayList(this.endDateLimit), dateSelect: this.dateSelected, onBdsDateSelected: (event) => this.selectDate(event) })) : (h("bds-datepicker-period", { ref: this.refDatepickerPeriod, startDate: this.startDateLimit && dateToDayList(this.startDateLimit), endDate: this.endDateLimit && dateToDayList(this.endDateLimit), startDateSelect: this.dateSelected, endDateSelect: this.endDateSelected, onBdsStartDate: (event) => this.selectDate(event), onBdsEndDate: (event) => this.selectEndDate(event) })), h("div", { class: { datepicker__menu__footer: true } }, this.typeOfDate == 'single' ? (h("bds-button", { variant: "secondary", onClick: () => this.clearDateSingle() }, "Redefinir")) : (h("bds-button", { variant: "secondary", onClick: () => this.clearDatePeriod() }, "Redefinir")), h("bds-button", { onClick: this.closeDatepicker }, "Concluir")))));
|
|
129
178
|
}
|
|
130
179
|
static get watchers() { return {
|
|
131
180
|
"startDateLimit": ["startDateLimitChanged"],
|
|
132
|
-
"endDateLimit": ["endDateLimitChanged"]
|
|
181
|
+
"endDateLimit": ["endDateLimitChanged"],
|
|
182
|
+
"dateSelected": ["dateSelectedChanged"]
|
|
133
183
|
}; }
|
|
134
184
|
};
|
|
135
185
|
DatePicker.style = datepickerCss;
|