@rededor/cura 1.2.0-rc.0 → 1.2.0-rc.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/cjs/cura-calendar.cjs.entry.js +27 -2
- package/dist/cjs/cura-calendar.cjs.entry.js.map +1 -1
- package/dist/cjs/cura.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/cura-calendar/cura-calendar.js +37 -5
- package/dist/collection/components/cura-calendar/cura-calendar.js.map +1 -1
- package/dist/collection/components/cura-calendar/cura-calendar.stories.js +35 -22
- package/dist/collection/components/cura-calendar/cura-calendar.stories.js.map +1 -1
- package/dist/components/cura-calendar2.js +30 -4
- package/dist/components/cura-calendar2.js.map +1 -1
- package/dist/cura/cura.esm.js +1 -1
- package/dist/cura/cura.esm.js.map +1 -1
- package/dist/cura/{p-563ba0cd.entry.js → p-ef4c9427.entry.js} +2 -2
- package/dist/cura/p-ef4c9427.entry.js.map +1 -0
- package/dist/esm/cura-calendar.entry.js +27 -2
- package/dist/esm/cura-calendar.entry.js.map +1 -1
- package/dist/esm/cura.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/cura-calendar/cura-calendar.d.ts +6 -1
- package/dist/types/components/cura-calendar/cura-calendar.stories.d.ts +1 -1
- package/dist/types/components.d.ts +4 -2
- package/package.json +2 -2
- package/dist/cura/p-563ba0cd.entry.js.map +0 -1
|
@@ -3483,6 +3483,7 @@ const CuraCalendar = class {
|
|
|
3483
3483
|
}
|
|
3484
3484
|
connectedCallback() {
|
|
3485
3485
|
this.setFontProperties();
|
|
3486
|
+
this.initializeDefaultDates();
|
|
3486
3487
|
const colors = [
|
|
3487
3488
|
{ name: '--accent-base', theme: 'accent-base' },
|
|
3488
3489
|
{ name: '--accent-light', theme: 'accent-light' },
|
|
@@ -3505,6 +3506,15 @@ const CuraCalendar = class {
|
|
|
3505
3506
|
* Initialize the selected dates based on defaultDate and mode.
|
|
3506
3507
|
*/
|
|
3507
3508
|
initializeDefaultDates() {
|
|
3509
|
+
if (typeof this.defaultDate === 'string') {
|
|
3510
|
+
const parsedDefaultDate = JSON.parse(this.defaultDate || '[]');
|
|
3511
|
+
if (typeof parsedDefaultDate === 'string') {
|
|
3512
|
+
this.defaultDate = [parsedDefaultDate];
|
|
3513
|
+
}
|
|
3514
|
+
else {
|
|
3515
|
+
this.defaultDate = parsedDefaultDate;
|
|
3516
|
+
}
|
|
3517
|
+
}
|
|
3508
3518
|
this.defaultDates = this.expandDateRanges(this.defaultDate);
|
|
3509
3519
|
}
|
|
3510
3520
|
/**
|
|
@@ -3634,6 +3644,8 @@ const CuraCalendar = class {
|
|
|
3634
3644
|
* @returns {Date[]} An array of individual dates.
|
|
3635
3645
|
*/
|
|
3636
3646
|
expandDateRanges(dates) {
|
|
3647
|
+
if (!dates)
|
|
3648
|
+
return [];
|
|
3637
3649
|
return dates.flatMap(date => {
|
|
3638
3650
|
if (typeof date === 'string')
|
|
3639
3651
|
return isValid(parseISO(date)) ? [parseISO(date)] : [];
|
|
@@ -3872,14 +3884,27 @@ const CuraCalendar = class {
|
|
|
3872
3884
|
watchDefaultDatesArray() {
|
|
3873
3885
|
this.selectedDates = this.customDates;
|
|
3874
3886
|
}
|
|
3887
|
+
handleDefaultDateChange(newValue) {
|
|
3888
|
+
if (typeof newValue === 'string') {
|
|
3889
|
+
const parsedDefaultDate = JSON.parse(newValue || '[]');
|
|
3890
|
+
if (typeof parsedDefaultDate === 'string') {
|
|
3891
|
+
newValue = [parsedDefaultDate];
|
|
3892
|
+
}
|
|
3893
|
+
else {
|
|
3894
|
+
newValue = parsedDefaultDate;
|
|
3895
|
+
}
|
|
3896
|
+
}
|
|
3897
|
+
this.defaultDates = this.expandDateRanges(newValue);
|
|
3898
|
+
}
|
|
3875
3899
|
render() {
|
|
3876
3900
|
const { months } = this.fetchMonthNames();
|
|
3877
|
-
return (h(Host, { key: '
|
|
3901
|
+
return (h(Host, { key: 'a17c39e83d01fc5443be547f8eab72edb3ce66ce', style: this.getHostCSSProperties() }, h("div", { key: '1dfb1924dbebc4b650bbed7973e4a0e0d3832c80', class: `calendar ${this.floating ? 'floating' : ''} ${this.embedded ? 'embedded' : ''}`, style: this.styles }, h("header", { key: '75de60ed10c9b11a4aedf75c8859155e51e05cae', class: "header" }, h("div", { key: 'd87168554cc1f2d97572fdf5645178a2b7706a83', class: `month-year ${this.type === 'dropdown' && 'dropdown'}` }, h("cura-icon", { key: '6654b5b1d0a0651bf744cbc7e84617233d4e1f58', class: `icon ${this.type === 'dropdown' && 'dropdown'}`, name: "left", color: this.determinePrevButtonColor(), onClick: !this.collapsed ? () => this.updateCurrentMonth('prev') : () => this.updateCurrentWeek('prev') }), this.type === 'dropdown' ? (h("div", { class: "select" }, h("cura-select", { size: "small", class: "drop-month", mode: "transparent", value: months[getMonth(this.currentDate)], onSelected: e => this.onMonthDropdownChange(e) }, months.map((month, index) => (h("cura-select-option", { size: "xsmall", key: index, value: month }, month)))), h("cura-select", { size: "small", class: "drop-year", mode: "transparent", value: getYear(this.currentDate).toString(), onSelected: e => this.onYearDropdownChange(e) }, this.fetchYearList().map((year, index) => (h("cura-select-option", { key: index, value: year.toString() }, year.toString())))))) : (h("cura-label", { color: "neutral-black", size: "large" }, months[getMonth(this.currentDate)].slice(0, 3), ", ", getYear(this.currentDate))), h("cura-icon", { key: '3d2c5d35cecc7eb49f7997b84043ce947d8c6492', class: `icon ${this.type === 'dropdown' && 'dropdown'}`, name: "right", color: "primary-base", onClick: !this.collapsed ? () => this.updateCurrentMonth('next') : () => this.updateCurrentWeek('next') }))), h("span", { key: '5ff644b7c2498f0f6b021158be6c6518b5639405', class: "days-of-week" }, this.fetchWeekDays().map((day, index) => (h("cura-label", { class: "day", size: "xsmall", color: "neutral-black", weight: "bold", key: index }, day === 'sab' ? 'SÁB' : day.toLocaleUpperCase())))), h("div", { key: '3cd87dc9c5742b26eeb930d0bdfc181c7f4c2aae', class: "dates" }, !this.collapsed
|
|
3878
3902
|
? this.fetchDaysOfMonth().map((day, index) => (h("div", { key: index, class: this.getClasses(day), onClick: () => this.onDateClick(day) }, day ? format(day, 'd') : '')))
|
|
3879
3903
|
: this.fetchDaysOfWeek().map((day, index) => (h("div", { key: index, class: this.getClasses(day), onClick: () => this.onDateClick(day) }, day ? format(day, 'd') : '')))), this.collapsed !== null ? (this.collapsed ? (h("div", { class: "collapsed-container" }, h("cura-button-transparent", { onClick: () => this.showNotColapsedCalendar(), size: "small", color: "primary", fontColor: "dark", iconName: "plusCircle" }, "Veja mais datas"))) : (h("div", { class: "collapsed-container" }, h("cura-button-transparent", { onClick: () => this.showColapsedCalendar(), size: "small", color: "primary", fontColor: "dark", iconName: "minusCircle" }, "Veja menos datas")))) : null)));
|
|
3880
3904
|
}
|
|
3881
3905
|
static get watchers() { return {
|
|
3882
|
-
"customDates": ["watchDefaultDatesArray"]
|
|
3906
|
+
"customDates": ["watchDefaultDatesArray"],
|
|
3907
|
+
"defaultDate": ["handleDefaultDateChange"]
|
|
3883
3908
|
}; }
|
|
3884
3909
|
};
|
|
3885
3910
|
CuraCalendar.style = CuraCalendarStyle0;
|