@nectary/components 5.6.4 → 5.6.6
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/bundle.js +55 -5
- package/date-picker/utils.js +54 -4
- package/package.json +3 -3
- package/pop/index.js +1 -1
package/bundle.js
CHANGED
|
@@ -3076,7 +3076,7 @@ class Pop extends NectaryElement {
|
|
|
3076
3076
|
this.#$contentSlot.addEventListener("slotchange", this.#onContentSlotChange);
|
|
3077
3077
|
}
|
|
3078
3078
|
});
|
|
3079
|
-
|
|
3079
|
+
this.#updatePosition();
|
|
3080
3080
|
this.#dispatchContentVisibility(true);
|
|
3081
3081
|
}
|
|
3082
3082
|
#onCollapse() {
|
|
@@ -4154,19 +4154,69 @@ const clampMaxDate = (date, max) => {
|
|
|
4154
4154
|
}
|
|
4155
4155
|
};
|
|
4156
4156
|
const incMonth = (date, max) => {
|
|
4157
|
-
date.
|
|
4157
|
+
const currentDay = date.getUTCDate();
|
|
4158
|
+
const currentMonth = date.getUTCMonth();
|
|
4159
|
+
const currentYear = date.getUTCFullYear();
|
|
4160
|
+
let nextMonth = currentMonth + 1;
|
|
4161
|
+
let nextYear = currentYear;
|
|
4162
|
+
if (nextMonth > 11) {
|
|
4163
|
+
nextMonth = 0;
|
|
4164
|
+
nextYear++;
|
|
4165
|
+
}
|
|
4166
|
+
const nextMonthLastDay = new Date(Date.UTC(nextYear, nextMonth + 1, 0));
|
|
4167
|
+
const maxDayInNextMonth = nextMonthLastDay.getUTCDate();
|
|
4168
|
+
const targetDay = Math.min(currentDay, maxDayInNextMonth);
|
|
4169
|
+
date.setUTCFullYear(nextYear, nextMonth, targetDay);
|
|
4158
4170
|
clampMaxDate(date, max);
|
|
4159
4171
|
};
|
|
4160
4172
|
const decMonth = (date, min) => {
|
|
4161
|
-
date.
|
|
4173
|
+
const currentDay = date.getUTCDate();
|
|
4174
|
+
const currentMonth = date.getUTCMonth();
|
|
4175
|
+
const currentYear = date.getUTCFullYear();
|
|
4176
|
+
let prevMonth = currentMonth - 1;
|
|
4177
|
+
let prevYear = currentYear;
|
|
4178
|
+
if (prevMonth < 0) {
|
|
4179
|
+
prevMonth = 11;
|
|
4180
|
+
prevYear--;
|
|
4181
|
+
}
|
|
4182
|
+
const prevMonthLastDay = new Date(Date.UTC(prevYear, prevMonth + 1, 0));
|
|
4183
|
+
const maxDayInPrevMonth = prevMonthLastDay.getUTCDate();
|
|
4184
|
+
const targetDay = Math.min(currentDay, maxDayInPrevMonth);
|
|
4185
|
+
date.setUTCFullYear(prevYear, prevMonth, targetDay);
|
|
4162
4186
|
clampMinDate(date, min);
|
|
4163
4187
|
};
|
|
4164
4188
|
const incYear = (date, max) => {
|
|
4165
|
-
date.
|
|
4189
|
+
const currentDay = date.getUTCDate();
|
|
4190
|
+
const currentMonth = date.getUTCMonth();
|
|
4191
|
+
const currentYear = date.getUTCFullYear();
|
|
4192
|
+
const nextYear = currentYear + 1;
|
|
4193
|
+
if (currentMonth === 1 && currentDay === 29) {
|
|
4194
|
+
const isNextYearLeap = new Date(Date.UTC(nextYear, 1, 29)).getUTCDate() === 29;
|
|
4195
|
+
if (!isNextYearLeap) {
|
|
4196
|
+
date.setUTCFullYear(nextYear, currentMonth, 28);
|
|
4197
|
+
} else {
|
|
4198
|
+
date.setUTCFullYear(nextYear, currentMonth, currentDay);
|
|
4199
|
+
}
|
|
4200
|
+
} else {
|
|
4201
|
+
date.setUTCFullYear(nextYear, currentMonth, currentDay);
|
|
4202
|
+
}
|
|
4166
4203
|
clampMaxDate(date, max);
|
|
4167
4204
|
};
|
|
4168
4205
|
const decYear = (date, min) => {
|
|
4169
|
-
date.
|
|
4206
|
+
const currentDay = date.getUTCDate();
|
|
4207
|
+
const currentMonth = date.getUTCMonth();
|
|
4208
|
+
const currentYear = date.getUTCFullYear();
|
|
4209
|
+
const prevYear = currentYear - 1;
|
|
4210
|
+
if (currentMonth === 1 && currentDay === 29) {
|
|
4211
|
+
const isPrevYearLeap = new Date(Date.UTC(prevYear, 1, 29)).getUTCDate() === 29;
|
|
4212
|
+
if (!isPrevYearLeap) {
|
|
4213
|
+
date.setUTCFullYear(prevYear, currentMonth, 28);
|
|
4214
|
+
} else {
|
|
4215
|
+
date.setUTCFullYear(prevYear, currentMonth, currentDay);
|
|
4216
|
+
}
|
|
4217
|
+
} else {
|
|
4218
|
+
date.setUTCFullYear(prevYear, currentMonth, currentDay);
|
|
4219
|
+
}
|
|
4170
4220
|
clampMinDate(date, min);
|
|
4171
4221
|
};
|
|
4172
4222
|
const canGoPrevMonth = (date, min) => {
|
package/date-picker/utils.js
CHANGED
|
@@ -72,19 +72,69 @@ const clampMaxDate = (date, max) => {
|
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
const incMonth = (date, max) => {
|
|
75
|
-
date.
|
|
75
|
+
const currentDay = date.getUTCDate();
|
|
76
|
+
const currentMonth = date.getUTCMonth();
|
|
77
|
+
const currentYear = date.getUTCFullYear();
|
|
78
|
+
let nextMonth = currentMonth + 1;
|
|
79
|
+
let nextYear = currentYear;
|
|
80
|
+
if (nextMonth > 11) {
|
|
81
|
+
nextMonth = 0;
|
|
82
|
+
nextYear++;
|
|
83
|
+
}
|
|
84
|
+
const nextMonthLastDay = new Date(Date.UTC(nextYear, nextMonth + 1, 0));
|
|
85
|
+
const maxDayInNextMonth = nextMonthLastDay.getUTCDate();
|
|
86
|
+
const targetDay = Math.min(currentDay, maxDayInNextMonth);
|
|
87
|
+
date.setUTCFullYear(nextYear, nextMonth, targetDay);
|
|
76
88
|
clampMaxDate(date, max);
|
|
77
89
|
};
|
|
78
90
|
const decMonth = (date, min) => {
|
|
79
|
-
date.
|
|
91
|
+
const currentDay = date.getUTCDate();
|
|
92
|
+
const currentMonth = date.getUTCMonth();
|
|
93
|
+
const currentYear = date.getUTCFullYear();
|
|
94
|
+
let prevMonth = currentMonth - 1;
|
|
95
|
+
let prevYear = currentYear;
|
|
96
|
+
if (prevMonth < 0) {
|
|
97
|
+
prevMonth = 11;
|
|
98
|
+
prevYear--;
|
|
99
|
+
}
|
|
100
|
+
const prevMonthLastDay = new Date(Date.UTC(prevYear, prevMonth + 1, 0));
|
|
101
|
+
const maxDayInPrevMonth = prevMonthLastDay.getUTCDate();
|
|
102
|
+
const targetDay = Math.min(currentDay, maxDayInPrevMonth);
|
|
103
|
+
date.setUTCFullYear(prevYear, prevMonth, targetDay);
|
|
80
104
|
clampMinDate(date, min);
|
|
81
105
|
};
|
|
82
106
|
const incYear = (date, max) => {
|
|
83
|
-
date.
|
|
107
|
+
const currentDay = date.getUTCDate();
|
|
108
|
+
const currentMonth = date.getUTCMonth();
|
|
109
|
+
const currentYear = date.getUTCFullYear();
|
|
110
|
+
const nextYear = currentYear + 1;
|
|
111
|
+
if (currentMonth === 1 && currentDay === 29) {
|
|
112
|
+
const isNextYearLeap = new Date(Date.UTC(nextYear, 1, 29)).getUTCDate() === 29;
|
|
113
|
+
if (!isNextYearLeap) {
|
|
114
|
+
date.setUTCFullYear(nextYear, currentMonth, 28);
|
|
115
|
+
} else {
|
|
116
|
+
date.setUTCFullYear(nextYear, currentMonth, currentDay);
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
date.setUTCFullYear(nextYear, currentMonth, currentDay);
|
|
120
|
+
}
|
|
84
121
|
clampMaxDate(date, max);
|
|
85
122
|
};
|
|
86
123
|
const decYear = (date, min) => {
|
|
87
|
-
date.
|
|
124
|
+
const currentDay = date.getUTCDate();
|
|
125
|
+
const currentMonth = date.getUTCMonth();
|
|
126
|
+
const currentYear = date.getUTCFullYear();
|
|
127
|
+
const prevYear = currentYear - 1;
|
|
128
|
+
if (currentMonth === 1 && currentDay === 29) {
|
|
129
|
+
const isPrevYearLeap = new Date(Date.UTC(prevYear, 1, 29)).getUTCDate() === 29;
|
|
130
|
+
if (!isPrevYearLeap) {
|
|
131
|
+
date.setUTCFullYear(prevYear, currentMonth, 28);
|
|
132
|
+
} else {
|
|
133
|
+
date.setUTCFullYear(prevYear, currentMonth, currentDay);
|
|
134
|
+
}
|
|
135
|
+
} else {
|
|
136
|
+
date.setUTCFullYear(prevYear, currentMonth, currentDay);
|
|
137
|
+
}
|
|
88
138
|
clampMinDate(date, min);
|
|
89
139
|
};
|
|
90
140
|
const canGoPrevMonth = (date, min) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nectary/components",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.6",
|
|
4
4
|
"files": [
|
|
5
5
|
"**/*/*.css",
|
|
6
6
|
"**/*/*.json",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.22.15",
|
|
27
|
-
"@nectary/assets": "3.3.
|
|
27
|
+
"@nectary/assets": "3.3.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@babel/cli": "^7.22.15",
|
|
@@ -40,6 +40,6 @@
|
|
|
40
40
|
"vite": "^7.0.6"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@nectary/theme-base": "1.7.
|
|
43
|
+
"@nectary/theme-base": "1.7.1"
|
|
44
44
|
}
|
|
45
45
|
}
|
package/pop/index.js
CHANGED
|
@@ -241,7 +241,7 @@ class Pop extends NectaryElement {
|
|
|
241
241
|
this.#$contentSlot.addEventListener("slotchange", this.#onContentSlotChange);
|
|
242
242
|
}
|
|
243
243
|
});
|
|
244
|
-
|
|
244
|
+
this.#updatePosition();
|
|
245
245
|
this.#dispatchContentVisibility(true);
|
|
246
246
|
}
|
|
247
247
|
#onCollapse() {
|