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
|
@@ -11,7 +11,6 @@ const BdsdatepickerSingle = class {
|
|
|
11
11
|
constructor(hostRef) {
|
|
12
12
|
index.registerInstance(this, hostRef);
|
|
13
13
|
this.bdsDateSelected = index.createEvent(this, "bdsDateSelected", 7);
|
|
14
|
-
this.bdsClearDate = index.createEvent(this, "bdsClearDate", 7);
|
|
15
14
|
this.monthActivated = calendar.THIS_DAY.getMonth();
|
|
16
15
|
this.yearActivated = calendar.THIS_DAY.getFullYear();
|
|
17
16
|
this.animatePrev = false;
|
|
@@ -31,6 +30,9 @@ const BdsdatepickerSingle = class {
|
|
|
31
30
|
* dateSelect. Insert a limiter to select the date period.
|
|
32
31
|
*/
|
|
33
32
|
this.dateSelect = null;
|
|
33
|
+
/**
|
|
34
|
+
* handler of select months or yaer.
|
|
35
|
+
*/
|
|
34
36
|
this.handler = (event, ref) => {
|
|
35
37
|
const { detail: { value }, } = event;
|
|
36
38
|
if (ref == 'months') {
|
|
@@ -44,6 +46,9 @@ const BdsdatepickerSingle = class {
|
|
|
44
46
|
this.yearActivated = value;
|
|
45
47
|
}
|
|
46
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* openDateSelect. Function to open the year or month selector.
|
|
51
|
+
*/
|
|
47
52
|
this.openDateSelect = (value, ref) => {
|
|
48
53
|
if (ref == 'months') {
|
|
49
54
|
setTimeout(() => {
|
|
@@ -63,6 +68,9 @@ const BdsdatepickerSingle = class {
|
|
|
63
68
|
async clear() {
|
|
64
69
|
this.dateSelect = null;
|
|
65
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* dateSelect. Function to output selected date.
|
|
73
|
+
*/
|
|
66
74
|
dateSelectChanged() {
|
|
67
75
|
var _a;
|
|
68
76
|
this.monthActivated = this.dateSelect ? (_a = this.dateSelect) === null || _a === void 0 ? void 0 : _a.getMonth() : this.startDate.month;
|
|
@@ -88,6 +96,9 @@ const BdsdatepickerSingle = class {
|
|
|
88
96
|
this.years = calendar.getYears(this.yearActivated, this.startDate.year, this.endDate.year);
|
|
89
97
|
this.months = calendar.getMonths(this.yearActivated, this.startDate, this.endDate);
|
|
90
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* prevDays. Function to create a gap between the beginning of the grid and the first day of the month.
|
|
101
|
+
*/
|
|
91
102
|
prevDays(value) {
|
|
92
103
|
const lenghtDays = [];
|
|
93
104
|
for (let i = 0; i < value; i++) {
|
|
@@ -95,10 +106,16 @@ const BdsdatepickerSingle = class {
|
|
|
95
106
|
}
|
|
96
107
|
return lenghtDays.map((item) => index.h("span", { key: `id${item}`, class: `space ${item}` }));
|
|
97
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* selectDate. Function to select the desired date.
|
|
111
|
+
*/
|
|
98
112
|
selectDate(value) {
|
|
99
113
|
const changeSelected = new Date(value.year, value.month, value.date);
|
|
100
114
|
this.bdsDateSelected.emit({ value: changeSelected });
|
|
101
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* prevMonth. Function to rewind the date on the calendar slide.
|
|
118
|
+
*/
|
|
102
119
|
prevMonth() {
|
|
103
120
|
this.animatePrev = true;
|
|
104
121
|
if (this.loadingSlide != 'pendding') {
|
|
@@ -117,6 +134,9 @@ const BdsdatepickerSingle = class {
|
|
|
117
134
|
return;
|
|
118
135
|
}
|
|
119
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* nextMonth. Function to advance the date on the calendar slide.
|
|
139
|
+
*/
|
|
120
140
|
nextMonth() {
|
|
121
141
|
this.animateNext = true;
|
|
122
142
|
if (this.loadingSlide != 'pendding') {
|
|
@@ -135,6 +155,9 @@ const BdsdatepickerSingle = class {
|
|
|
135
155
|
return;
|
|
136
156
|
}
|
|
137
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* checkCurrentDay. Function to check the current day.
|
|
160
|
+
*/
|
|
138
161
|
checkCurrentDay(value) {
|
|
139
162
|
const fullCurrDate = calendar.fillDate(calendar.THIS_DAY);
|
|
140
163
|
if (calendar.fillDayList(value) == fullCurrDate)
|
|
@@ -142,6 +165,9 @@ const BdsdatepickerSingle = class {
|
|
|
142
165
|
else
|
|
143
166
|
return false;
|
|
144
167
|
}
|
|
168
|
+
/**
|
|
169
|
+
* checkDisableDay. Function to check the disable day.
|
|
170
|
+
*/
|
|
145
171
|
checkDisableDay(value) {
|
|
146
172
|
const startDateLimit = this.startDate ? calendar.fillDayList(this.startDate) : `0`;
|
|
147
173
|
const endDateLimit = this.endDate ? calendar.fillDayList(this.endDate) : `9999999`;
|
|
@@ -152,6 +178,9 @@ const BdsdatepickerSingle = class {
|
|
|
152
178
|
return true;
|
|
153
179
|
}
|
|
154
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* checkSelectedDay. Function to check the selected day.
|
|
183
|
+
*/
|
|
155
184
|
checkSelectedDay(value) {
|
|
156
185
|
const selectedDate = this.dateSelect ? calendar.fillDate(this.dateSelect) : `0`;
|
|
157
186
|
if (calendar.fillDayList(value) == selectedDate)
|
|
@@ -36,24 +36,42 @@ const DatePicker = class {
|
|
|
36
36
|
* Message. Select type of date.
|
|
37
37
|
*/
|
|
38
38
|
this.message = null;
|
|
39
|
+
this.refInputSetDate = (el) => {
|
|
40
|
+
this.inputSetDate = el;
|
|
41
|
+
};
|
|
42
|
+
this.refInputSetEndDate = (el) => {
|
|
43
|
+
this.inputSetEndDate = el;
|
|
44
|
+
};
|
|
39
45
|
this.refDatepickerPeriod = (el) => {
|
|
40
46
|
this.datepickerPeriod = el;
|
|
41
47
|
};
|
|
42
48
|
this.refDatepickerSingle = (el) => {
|
|
43
49
|
this.datepickerSingle = el;
|
|
44
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* clearDateSingle. Function to clear datepicker-single
|
|
53
|
+
*/
|
|
45
54
|
this.clearDateSingle = () => {
|
|
46
55
|
this.datepickerSingle.clear();
|
|
47
56
|
this.valueDateSelected = null;
|
|
48
57
|
this.bdsStartDate.emit({ value: null });
|
|
49
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* clearDatePeriod. Function to clear datepicker-period
|
|
61
|
+
*/
|
|
50
62
|
this.clearDatePeriod = () => {
|
|
51
63
|
this.datepickerPeriod.clear();
|
|
52
64
|
this.valueDateSelected = null;
|
|
53
65
|
this.valueEndDateSelected = null;
|
|
54
66
|
this.bdsStartDate.emit({ value: null });
|
|
55
67
|
this.bdsEndDate.emit({ value: null });
|
|
68
|
+
setTimeout(() => {
|
|
69
|
+
this.inputSetDate.setFocus();
|
|
70
|
+
}, 10);
|
|
56
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* maskDateSelected. Function to add mask to date field
|
|
74
|
+
*/
|
|
57
75
|
this.maskDateSelected = (ev) => {
|
|
58
76
|
const input = ev.target;
|
|
59
77
|
this.valueDateSelected = validations.maskDate(input.value);
|
|
@@ -73,6 +91,9 @@ const DatePicker = class {
|
|
|
73
91
|
}
|
|
74
92
|
}
|
|
75
93
|
};
|
|
94
|
+
/**
|
|
95
|
+
* maskEndDateSelected. Function to add mask to the end date field
|
|
96
|
+
*/
|
|
76
97
|
this.maskEndDateSelected = (ev) => {
|
|
77
98
|
const input = ev.target;
|
|
78
99
|
this.valueEndDateSelected = validations.maskDate(input.value);
|
|
@@ -92,12 +113,31 @@ const DatePicker = class {
|
|
|
92
113
|
}
|
|
93
114
|
}
|
|
94
115
|
};
|
|
116
|
+
this.onClickSetDate = () => {
|
|
117
|
+
this.open = true;
|
|
118
|
+
setTimeout(() => {
|
|
119
|
+
this.inputSetDate.setFocus();
|
|
120
|
+
this.inputSetEndDate.removeFocus();
|
|
121
|
+
}, 50);
|
|
122
|
+
this.datepickerPeriod.clear();
|
|
123
|
+
this.valueEndDateSelected = null;
|
|
124
|
+
};
|
|
125
|
+
this.closeDatepicker = () => {
|
|
126
|
+
this.inputSetEndDate.removeFocus();
|
|
127
|
+
this.open = false;
|
|
128
|
+
};
|
|
95
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* startDateLimit validation.
|
|
132
|
+
*/
|
|
96
133
|
startDateLimitChanged() {
|
|
97
134
|
if (!validations.dateValidation(this.startDateLimit)) {
|
|
98
135
|
this.startDateLimit = calendar.defaultStartDate;
|
|
99
136
|
}
|
|
100
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* endDateLimit validation.
|
|
140
|
+
*/
|
|
101
141
|
endDateLimitChanged() {
|
|
102
142
|
const dlStartDate = calendar.dateToDayList(this.startDateLimit);
|
|
103
143
|
const dlEndDate = calendar.dateToDayList(this.endDateLimit);
|
|
@@ -110,10 +150,16 @@ const DatePicker = class {
|
|
|
110
150
|
.padStart(2, '0')}/${dlStartDate.year + 1}`;
|
|
111
151
|
}
|
|
112
152
|
}
|
|
153
|
+
dateSelectedChanged() {
|
|
154
|
+
this.inputSetEndDate.setFocus();
|
|
155
|
+
}
|
|
113
156
|
componentWillLoad() {
|
|
114
157
|
this.endDateLimitChanged();
|
|
115
158
|
this.startDateLimitChanged();
|
|
116
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* selectDate. Function to output selected date.
|
|
162
|
+
*/
|
|
117
163
|
selectDate(event) {
|
|
118
164
|
const { detail: { value }, } = event;
|
|
119
165
|
this.dateSelected = value;
|
|
@@ -121,6 +167,9 @@ const DatePicker = class {
|
|
|
121
167
|
this.valueDateSelected = this.dateSelected && calendar.dateToString(this.dateSelected);
|
|
122
168
|
this.errorMsgDate = null;
|
|
123
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* selectEndDate. Function to issue selected end date..
|
|
172
|
+
*/
|
|
124
173
|
selectEndDate(event) {
|
|
125
174
|
const { detail: { value }, } = event;
|
|
126
175
|
this.endDateSelected = value;
|
|
@@ -129,11 +178,12 @@ const DatePicker = class {
|
|
|
129
178
|
this.errorMsgEndDate = null;
|
|
130
179
|
}
|
|
131
180
|
render() {
|
|
132
|
-
return (index.h("div", { class: { datepicker: true } }, this.typeOfDate == 'single' ? (index.h("div", { class: { datepicker__inputs: true, [`datepicker__inputs__${this.typeOfDate}`]: true } }, index.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 }))) : (index.h("div", { class: { datepicker__inputs: true, [`datepicker__inputs__${this.typeOfDate}`]: true } }, index.h("bds-input", { label: "De", value: this.valueDateSelected, placeholder: "__/__/____", maxlength: 10, icon: "calendar", onClick: () =>
|
|
181
|
+
return (index.h("div", { class: { datepicker: true } }, this.typeOfDate == 'single' ? (index.h("div", { class: { datepicker__inputs: true, [`datepicker__inputs__${this.typeOfDate}`]: true } }, index.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 }))) : (index.h("div", { class: { datepicker__inputs: true, [`datepicker__inputs__${this.typeOfDate}`]: true } }, index.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 }), index.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 }))), index.h("div", { class: { datepicker__menu: true, datepicker__menu__open: this.open } }, this.message && (index.h("div", { class: "datepicker__menu__message" }, index.h("bds-icon", { name: "warning", theme: "outline", "aria-label": "\u00CDcone de aten\u00E7\u00E3o" }), index.h("bds-typo", { variant: "fs-16" }, this.message))), this.typeOfDate == 'single' ? (index.h("bds-datepicker-single", { ref: this.refDatepickerSingle, startDate: this.startDateLimit && calendar.dateToDayList(this.startDateLimit), endDate: this.endDateLimit && calendar.dateToDayList(this.endDateLimit), dateSelect: this.dateSelected, onBdsDateSelected: (event) => this.selectDate(event) })) : (index.h("bds-datepicker-period", { ref: this.refDatepickerPeriod, startDate: this.startDateLimit && calendar.dateToDayList(this.startDateLimit), endDate: this.endDateLimit && calendar.dateToDayList(this.endDateLimit), startDateSelect: this.dateSelected, endDateSelect: this.endDateSelected, onBdsStartDate: (event) => this.selectDate(event), onBdsEndDate: (event) => this.selectEndDate(event) })), index.h("div", { class: { datepicker__menu__footer: true } }, this.typeOfDate == 'single' ? (index.h("bds-button", { variant: "secondary", onClick: () => this.clearDateSingle() }, "Redefinir")) : (index.h("bds-button", { variant: "secondary", onClick: () => this.clearDatePeriod() }, "Redefinir")), index.h("bds-button", { onClick: this.closeDatepicker }, "Concluir")))));
|
|
133
182
|
}
|
|
134
183
|
static get watchers() { return {
|
|
135
184
|
"startDateLimit": ["startDateLimitChanged"],
|
|
136
|
-
"endDateLimit": ["endDateLimitChanged"]
|
|
185
|
+
"endDateLimit": ["endDateLimitChanged"],
|
|
186
|
+
"dateSelected": ["dateSelectedChanged"]
|
|
137
187
|
}; }
|
|
138
188
|
};
|
|
139
189
|
DatePicker.style = datepickerCss;
|
|
@@ -26,6 +26,9 @@ export class BdsdatepickerPeriod {
|
|
|
26
26
|
* EndDateSelect. Insert a limiter to select the date period.
|
|
27
27
|
*/
|
|
28
28
|
this.endDateSelect = null;
|
|
29
|
+
/**
|
|
30
|
+
* handler of select months or yaer.
|
|
31
|
+
*/
|
|
29
32
|
this.handler = (event, ref) => {
|
|
30
33
|
const { detail: { value }, } = event;
|
|
31
34
|
if (ref == 'months') {
|
|
@@ -39,6 +42,9 @@ export class BdsdatepickerPeriod {
|
|
|
39
42
|
this.yearActivated = value;
|
|
40
43
|
}
|
|
41
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* openDateSelect. Function to open the year or month selector.
|
|
47
|
+
*/
|
|
42
48
|
this.openDateSelect = (value, ref) => {
|
|
43
49
|
if (ref == 'months') {
|
|
44
50
|
setTimeout(() => {
|
|
@@ -59,12 +65,18 @@ export class BdsdatepickerPeriod {
|
|
|
59
65
|
this.startDateSelect = null;
|
|
60
66
|
this.endDateSelect = null;
|
|
61
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* startDateSelect. Function to output selected start date.
|
|
70
|
+
*/
|
|
62
71
|
startDateSelectChanged() {
|
|
63
72
|
var _a;
|
|
64
73
|
this.bdsStartDate.emit({ value: this.startDateSelect });
|
|
65
74
|
this.monthActivated = this.startDateSelect ? (_a = this.startDateSelect) === null || _a === void 0 ? void 0 : _a.getMonth() : this.startDate.month;
|
|
66
75
|
this.yearActivated = this.startDateSelect ? this.startDateSelect.getFullYear() : this.startDate.year;
|
|
67
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* endDateSelect. Function to output selected end date.
|
|
79
|
+
*/
|
|
68
80
|
endDateSelectChanged() {
|
|
69
81
|
this.bdsEndDate.emit({ value: this.endDateSelect });
|
|
70
82
|
this.monthActivated = this.endDateSelect
|
|
@@ -99,6 +111,9 @@ export class BdsdatepickerPeriod {
|
|
|
99
111
|
this.years = getYears(this.yearActivated, this.startDate.year, this.endDate.year);
|
|
100
112
|
this.months = getMonths(this.yearActivated, this.startDate, this.endDate);
|
|
101
113
|
}
|
|
114
|
+
/**
|
|
115
|
+
* prevDays. Function to create a gap between the beginning of the grid and the first day of the month.
|
|
116
|
+
*/
|
|
102
117
|
prevDays(value) {
|
|
103
118
|
const lenghtDays = [];
|
|
104
119
|
for (let i = 0; i < value; i++) {
|
|
@@ -106,6 +121,9 @@ export class BdsdatepickerPeriod {
|
|
|
106
121
|
}
|
|
107
122
|
return lenghtDays.map((item) => h("span", { key: `id${item}`, class: `space ${item}` }));
|
|
108
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* selectDate. Function to select the desired date.
|
|
126
|
+
*/
|
|
109
127
|
selectDate(value) {
|
|
110
128
|
const changeSelected = new Date(value.year, value.month, value.date);
|
|
111
129
|
if (this.startDateSelect) {
|
|
@@ -115,6 +133,9 @@ export class BdsdatepickerPeriod {
|
|
|
115
133
|
this.startDateSelect = changeSelected;
|
|
116
134
|
}
|
|
117
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* prevMonth. Function to rewind the date on the calendar slide.
|
|
138
|
+
*/
|
|
118
139
|
prevMonth() {
|
|
119
140
|
this.animatePrev = true;
|
|
120
141
|
if (this.loadingSlide != 'pendding') {
|
|
@@ -133,6 +154,9 @@ export class BdsdatepickerPeriod {
|
|
|
133
154
|
return;
|
|
134
155
|
}
|
|
135
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* nextMonth. Function to advance the date on the calendar slide.
|
|
159
|
+
*/
|
|
136
160
|
nextMonth() {
|
|
137
161
|
this.animateNext = true;
|
|
138
162
|
if (this.loadingSlide != 'pendding') {
|
|
@@ -151,6 +175,9 @@ export class BdsdatepickerPeriod {
|
|
|
151
175
|
return;
|
|
152
176
|
}
|
|
153
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* checkCurrentDay. Function to check the current day.
|
|
180
|
+
*/
|
|
154
181
|
checkCurrentDay(value) {
|
|
155
182
|
const validateDate = fillDayList(value);
|
|
156
183
|
const fullCurrDate = fillDate(THIS_DAY);
|
|
@@ -159,6 +186,9 @@ export class BdsdatepickerPeriod {
|
|
|
159
186
|
else
|
|
160
187
|
return false;
|
|
161
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* checkDisableDay. Function to check the disable day.
|
|
191
|
+
*/
|
|
162
192
|
checkDisableDay(value) {
|
|
163
193
|
const validateDate = fillDayList(value);
|
|
164
194
|
const startDateLimit = this.startDate ? fillDayList(this.startDate) : `0`;
|
|
@@ -176,6 +206,9 @@ export class BdsdatepickerPeriod {
|
|
|
176
206
|
return true;
|
|
177
207
|
}
|
|
178
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* checkSelectedDay. Function to check the selected day.
|
|
211
|
+
*/
|
|
179
212
|
checkSelectedDay(value) {
|
|
180
213
|
const validateDate = fillDayList(value);
|
|
181
214
|
const startSelectedDate = this.startDateSelect ? fillDate(this.startDateSelect) : `0`;
|
|
@@ -185,6 +218,9 @@ export class BdsdatepickerPeriod {
|
|
|
185
218
|
else
|
|
186
219
|
return false;
|
|
187
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* checkPeriodDay. Function to check the period selected day.
|
|
223
|
+
*/
|
|
188
224
|
checkPeriodDay(value) {
|
|
189
225
|
const validateDate = fillDayList(value);
|
|
190
226
|
const startSelectedDate = this.startDateSelect ? fillDate(this.startDateSelect) : `0`;
|
|
@@ -195,6 +231,9 @@ export class BdsdatepickerPeriod {
|
|
|
195
231
|
}
|
|
196
232
|
}
|
|
197
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* checkPeriodStart. Function to check the period selected start day.
|
|
236
|
+
*/
|
|
198
237
|
checkPeriodStart(value) {
|
|
199
238
|
const validateDate = value.date == 1;
|
|
200
239
|
const validateDay = value.day == 0;
|
|
@@ -205,6 +244,9 @@ export class BdsdatepickerPeriod {
|
|
|
205
244
|
return true;
|
|
206
245
|
}
|
|
207
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* checkPeriodEnd. Function to check the period selected end day.
|
|
249
|
+
*/
|
|
208
250
|
checkPeriodEnd(value, lastItem) {
|
|
209
251
|
const validateDate = lastItem;
|
|
210
252
|
const validateDay = value.day == 6;
|
|
@@ -403,7 +445,7 @@ export class BdsdatepickerPeriod {
|
|
|
403
445
|
"composed": true,
|
|
404
446
|
"docs": {
|
|
405
447
|
"tags": [],
|
|
406
|
-
"text": ""
|
|
448
|
+
"text": "bdsStartDate. Event to return selected date value."
|
|
407
449
|
},
|
|
408
450
|
"complexType": {
|
|
409
451
|
"original": "any",
|
|
@@ -418,7 +460,7 @@ export class BdsdatepickerPeriod {
|
|
|
418
460
|
"composed": true,
|
|
419
461
|
"docs": {
|
|
420
462
|
"tags": [],
|
|
421
|
-
"text": ""
|
|
463
|
+
"text": "bdsEndDate. Event to return selected end date value."
|
|
422
464
|
},
|
|
423
465
|
"complexType": {
|
|
424
466
|
"original": "any",
|
|
@@ -21,6 +21,9 @@ export class BdsdatepickerSingle {
|
|
|
21
21
|
* dateSelect. Insert a limiter to select the date period.
|
|
22
22
|
*/
|
|
23
23
|
this.dateSelect = null;
|
|
24
|
+
/**
|
|
25
|
+
* handler of select months or yaer.
|
|
26
|
+
*/
|
|
24
27
|
this.handler = (event, ref) => {
|
|
25
28
|
const { detail: { value }, } = event;
|
|
26
29
|
if (ref == 'months') {
|
|
@@ -34,6 +37,9 @@ export class BdsdatepickerSingle {
|
|
|
34
37
|
this.yearActivated = value;
|
|
35
38
|
}
|
|
36
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* openDateSelect. Function to open the year or month selector.
|
|
42
|
+
*/
|
|
37
43
|
this.openDateSelect = (value, ref) => {
|
|
38
44
|
if (ref == 'months') {
|
|
39
45
|
setTimeout(() => {
|
|
@@ -53,6 +59,9 @@ export class BdsdatepickerSingle {
|
|
|
53
59
|
async clear() {
|
|
54
60
|
this.dateSelect = null;
|
|
55
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* dateSelect. Function to output selected date.
|
|
64
|
+
*/
|
|
56
65
|
dateSelectChanged() {
|
|
57
66
|
var _a;
|
|
58
67
|
this.monthActivated = this.dateSelect ? (_a = this.dateSelect) === null || _a === void 0 ? void 0 : _a.getMonth() : this.startDate.month;
|
|
@@ -78,6 +87,9 @@ export class BdsdatepickerSingle {
|
|
|
78
87
|
this.years = getYears(this.yearActivated, this.startDate.year, this.endDate.year);
|
|
79
88
|
this.months = getMonths(this.yearActivated, this.startDate, this.endDate);
|
|
80
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* prevDays. Function to create a gap between the beginning of the grid and the first day of the month.
|
|
92
|
+
*/
|
|
81
93
|
prevDays(value) {
|
|
82
94
|
const lenghtDays = [];
|
|
83
95
|
for (let i = 0; i < value; i++) {
|
|
@@ -85,10 +97,16 @@ export class BdsdatepickerSingle {
|
|
|
85
97
|
}
|
|
86
98
|
return lenghtDays.map((item) => h("span", { key: `id${item}`, class: `space ${item}` }));
|
|
87
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* selectDate. Function to select the desired date.
|
|
102
|
+
*/
|
|
88
103
|
selectDate(value) {
|
|
89
104
|
const changeSelected = new Date(value.year, value.month, value.date);
|
|
90
105
|
this.bdsDateSelected.emit({ value: changeSelected });
|
|
91
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* prevMonth. Function to rewind the date on the calendar slide.
|
|
109
|
+
*/
|
|
92
110
|
prevMonth() {
|
|
93
111
|
this.animatePrev = true;
|
|
94
112
|
if (this.loadingSlide != 'pendding') {
|
|
@@ -107,6 +125,9 @@ export class BdsdatepickerSingle {
|
|
|
107
125
|
return;
|
|
108
126
|
}
|
|
109
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* nextMonth. Function to advance the date on the calendar slide.
|
|
130
|
+
*/
|
|
110
131
|
nextMonth() {
|
|
111
132
|
this.animateNext = true;
|
|
112
133
|
if (this.loadingSlide != 'pendding') {
|
|
@@ -125,6 +146,9 @@ export class BdsdatepickerSingle {
|
|
|
125
146
|
return;
|
|
126
147
|
}
|
|
127
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* checkCurrentDay. Function to check the current day.
|
|
151
|
+
*/
|
|
128
152
|
checkCurrentDay(value) {
|
|
129
153
|
const fullCurrDate = fillDate(THIS_DAY);
|
|
130
154
|
if (fillDayList(value) == fullCurrDate)
|
|
@@ -132,6 +156,9 @@ export class BdsdatepickerSingle {
|
|
|
132
156
|
else
|
|
133
157
|
return false;
|
|
134
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* checkDisableDay. Function to check the disable day.
|
|
161
|
+
*/
|
|
135
162
|
checkDisableDay(value) {
|
|
136
163
|
const startDateLimit = this.startDate ? fillDayList(this.startDate) : `0`;
|
|
137
164
|
const endDateLimit = this.endDate ? fillDayList(this.endDate) : `9999999`;
|
|
@@ -142,6 +169,9 @@ export class BdsdatepickerSingle {
|
|
|
142
169
|
return true;
|
|
143
170
|
}
|
|
144
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* checkSelectedDay. Function to check the selected day.
|
|
174
|
+
*/
|
|
145
175
|
checkSelectedDay(value) {
|
|
146
176
|
const selectedDate = this.dateSelect ? fillDate(this.dateSelect) : `0`;
|
|
147
177
|
if (fillDayList(value) == selectedDate)
|
|
@@ -308,28 +338,13 @@ export class BdsdatepickerSingle {
|
|
|
308
338
|
"composed": true,
|
|
309
339
|
"docs": {
|
|
310
340
|
"tags": [],
|
|
311
|
-
"text": ""
|
|
341
|
+
"text": "bdsDateSelected. Event to return selected date value."
|
|
312
342
|
},
|
|
313
343
|
"complexType": {
|
|
314
344
|
"original": "any",
|
|
315
345
|
"resolved": "any",
|
|
316
346
|
"references": {}
|
|
317
347
|
}
|
|
318
|
-
}, {
|
|
319
|
-
"method": "bdsClearDate",
|
|
320
|
-
"name": "bdsClearDate",
|
|
321
|
-
"bubbles": true,
|
|
322
|
-
"cancelable": true,
|
|
323
|
-
"composed": true,
|
|
324
|
-
"docs": {
|
|
325
|
-
"tags": [],
|
|
326
|
-
"text": ""
|
|
327
|
-
},
|
|
328
|
-
"complexType": {
|
|
329
|
-
"original": "boolean",
|
|
330
|
-
"resolved": "boolean",
|
|
331
|
-
"references": {}
|
|
332
|
-
}
|
|
333
348
|
}]; }
|
|
334
349
|
static get methods() { return {
|
|
335
350
|
"clear": {
|
|
@@ -26,24 +26,42 @@ export class DatePicker {
|
|
|
26
26
|
* Message. Select type of date.
|
|
27
27
|
*/
|
|
28
28
|
this.message = null;
|
|
29
|
+
this.refInputSetDate = (el) => {
|
|
30
|
+
this.inputSetDate = el;
|
|
31
|
+
};
|
|
32
|
+
this.refInputSetEndDate = (el) => {
|
|
33
|
+
this.inputSetEndDate = el;
|
|
34
|
+
};
|
|
29
35
|
this.refDatepickerPeriod = (el) => {
|
|
30
36
|
this.datepickerPeriod = el;
|
|
31
37
|
};
|
|
32
38
|
this.refDatepickerSingle = (el) => {
|
|
33
39
|
this.datepickerSingle = el;
|
|
34
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* clearDateSingle. Function to clear datepicker-single
|
|
43
|
+
*/
|
|
35
44
|
this.clearDateSingle = () => {
|
|
36
45
|
this.datepickerSingle.clear();
|
|
37
46
|
this.valueDateSelected = null;
|
|
38
47
|
this.bdsStartDate.emit({ value: null });
|
|
39
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* clearDatePeriod. Function to clear datepicker-period
|
|
51
|
+
*/
|
|
40
52
|
this.clearDatePeriod = () => {
|
|
41
53
|
this.datepickerPeriod.clear();
|
|
42
54
|
this.valueDateSelected = null;
|
|
43
55
|
this.valueEndDateSelected = null;
|
|
44
56
|
this.bdsStartDate.emit({ value: null });
|
|
45
57
|
this.bdsEndDate.emit({ value: null });
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
this.inputSetDate.setFocus();
|
|
60
|
+
}, 10);
|
|
46
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* maskDateSelected. Function to add mask to date field
|
|
64
|
+
*/
|
|
47
65
|
this.maskDateSelected = (ev) => {
|
|
48
66
|
const input = ev.target;
|
|
49
67
|
this.valueDateSelected = maskDate(input.value);
|
|
@@ -63,6 +81,9 @@ export class DatePicker {
|
|
|
63
81
|
}
|
|
64
82
|
}
|
|
65
83
|
};
|
|
84
|
+
/**
|
|
85
|
+
* maskEndDateSelected. Function to add mask to the end date field
|
|
86
|
+
*/
|
|
66
87
|
this.maskEndDateSelected = (ev) => {
|
|
67
88
|
const input = ev.target;
|
|
68
89
|
this.valueEndDateSelected = maskDate(input.value);
|
|
@@ -82,12 +103,31 @@ export class DatePicker {
|
|
|
82
103
|
}
|
|
83
104
|
}
|
|
84
105
|
};
|
|
106
|
+
this.onClickSetDate = () => {
|
|
107
|
+
this.open = true;
|
|
108
|
+
setTimeout(() => {
|
|
109
|
+
this.inputSetDate.setFocus();
|
|
110
|
+
this.inputSetEndDate.removeFocus();
|
|
111
|
+
}, 50);
|
|
112
|
+
this.datepickerPeriod.clear();
|
|
113
|
+
this.valueEndDateSelected = null;
|
|
114
|
+
};
|
|
115
|
+
this.closeDatepicker = () => {
|
|
116
|
+
this.inputSetEndDate.removeFocus();
|
|
117
|
+
this.open = false;
|
|
118
|
+
};
|
|
85
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* startDateLimit validation.
|
|
122
|
+
*/
|
|
86
123
|
startDateLimitChanged() {
|
|
87
124
|
if (!dateValidation(this.startDateLimit)) {
|
|
88
125
|
this.startDateLimit = defaultStartDate;
|
|
89
126
|
}
|
|
90
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* endDateLimit validation.
|
|
130
|
+
*/
|
|
91
131
|
endDateLimitChanged() {
|
|
92
132
|
const dlStartDate = dateToDayList(this.startDateLimit);
|
|
93
133
|
const dlEndDate = dateToDayList(this.endDateLimit);
|
|
@@ -100,10 +140,16 @@ export class DatePicker {
|
|
|
100
140
|
.padStart(2, '0')}/${dlStartDate.year + 1}`;
|
|
101
141
|
}
|
|
102
142
|
}
|
|
143
|
+
dateSelectedChanged() {
|
|
144
|
+
this.inputSetEndDate.setFocus();
|
|
145
|
+
}
|
|
103
146
|
componentWillLoad() {
|
|
104
147
|
this.endDateLimitChanged();
|
|
105
148
|
this.startDateLimitChanged();
|
|
106
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* selectDate. Function to output selected date.
|
|
152
|
+
*/
|
|
107
153
|
selectDate(event) {
|
|
108
154
|
const { detail: { value }, } = event;
|
|
109
155
|
this.dateSelected = value;
|
|
@@ -111,6 +157,9 @@ export class DatePicker {
|
|
|
111
157
|
this.valueDateSelected = this.dateSelected && dateToString(this.dateSelected);
|
|
112
158
|
this.errorMsgDate = null;
|
|
113
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* selectEndDate. Function to issue selected end date..
|
|
162
|
+
*/
|
|
114
163
|
selectEndDate(event) {
|
|
115
164
|
const { detail: { value }, } = event;
|
|
116
165
|
this.endDateSelected = value;
|
|
@@ -122,8 +171,8 @@ export class DatePicker {
|
|
|
122
171
|
return (h("div", { class: { datepicker: true } },
|
|
123
172
|
this.typeOfDate == 'single' ? (h("div", { class: { datepicker__inputs: true, [`datepicker__inputs__${this.typeOfDate}`]: true } },
|
|
124
173
|
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 } },
|
|
125
|
-
h("bds-input", { label: "De", value: this.valueDateSelected, placeholder: "__/__/____", maxlength: 10, icon: "calendar", onClick: () =>
|
|
126
|
-
h("bds-input", { 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 }))),
|
|
174
|
+
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 }),
|
|
175
|
+
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 }))),
|
|
127
176
|
h("div", { class: { datepicker__menu: true, datepicker__menu__open: this.open } },
|
|
128
177
|
this.message && (h("div", { class: "datepicker__menu__message" },
|
|
129
178
|
h("bds-icon", { name: "warning", theme: "outline", "aria-label": "\u00CDcone de aten\u00E7\u00E3o" }),
|
|
@@ -131,7 +180,7 @@ export class DatePicker {
|
|
|
131
180
|
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) })),
|
|
132
181
|
h("div", { class: { datepicker__menu__footer: true } },
|
|
133
182
|
this.typeOfDate == 'single' ? (h("bds-button", { variant: "secondary", onClick: () => this.clearDateSingle() }, "Redefinir")) : (h("bds-button", { variant: "secondary", onClick: () => this.clearDatePeriod() }, "Redefinir")),
|
|
134
|
-
h("bds-button", { onClick:
|
|
183
|
+
h("bds-button", { onClick: this.closeDatepicker }, "Concluir")))));
|
|
135
184
|
}
|
|
136
185
|
static get is() { return "bds-datepicker"; }
|
|
137
186
|
static get originalStyleUrls() { return {
|
|
@@ -236,7 +285,7 @@ export class DatePicker {
|
|
|
236
285
|
"composed": true,
|
|
237
286
|
"docs": {
|
|
238
287
|
"tags": [],
|
|
239
|
-
"text": ""
|
|
288
|
+
"text": "bdsStartDate. Event to return selected date value."
|
|
240
289
|
},
|
|
241
290
|
"complexType": {
|
|
242
291
|
"original": "any",
|
|
@@ -251,7 +300,7 @@ export class DatePicker {
|
|
|
251
300
|
"composed": true,
|
|
252
301
|
"docs": {
|
|
253
302
|
"tags": [],
|
|
254
|
-
"text": ""
|
|
303
|
+
"text": "bdsStartDate. Event to return selected end date value."
|
|
255
304
|
},
|
|
256
305
|
"complexType": {
|
|
257
306
|
"original": "any",
|
|
@@ -265,5 +314,8 @@ export class DatePicker {
|
|
|
265
314
|
}, {
|
|
266
315
|
"propName": "endDateLimit",
|
|
267
316
|
"methodName": "endDateLimitChanged"
|
|
317
|
+
}, {
|
|
318
|
+
"propName": "dateSelected",
|
|
319
|
+
"methodName": "dateSelectedChanged"
|
|
268
320
|
}]; }
|
|
269
321
|
}
|