hamzus-ui 0.0.92 → 0.0.93
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/package.json
CHANGED
|
@@ -27,6 +27,13 @@
|
|
|
27
27
|
};
|
|
28
28
|
const yearList = getYearList();
|
|
29
29
|
|
|
30
|
+
const now = new Date();
|
|
31
|
+
|
|
32
|
+
const day = String(now.getDate());
|
|
33
|
+
const month = String(now.getMonth() + 1);
|
|
34
|
+
const year = now.getFullYear();
|
|
35
|
+
|
|
36
|
+
|
|
30
37
|
let toggleDisplay;
|
|
31
38
|
|
|
32
39
|
$: labelMonth = formatValue(value);
|
|
@@ -34,6 +41,10 @@
|
|
|
34
41
|
let currentYear = new Date().getFullYear();
|
|
35
42
|
let currentMonth = new Date().getMonth() + 1;
|
|
36
43
|
|
|
44
|
+
let selectedYear = new Date().getFullYear();
|
|
45
|
+
let selectedMonth = new Date().getMonth() + 1;
|
|
46
|
+
let selectedDay = null;
|
|
47
|
+
|
|
37
48
|
let weeks = generateCalendarMatrix(currentYear, currentMonth - 1);
|
|
38
49
|
|
|
39
50
|
let mode = "day"
|
|
@@ -128,8 +139,13 @@
|
|
|
128
139
|
}
|
|
129
140
|
|
|
130
141
|
function handleUpdateValue(day) {
|
|
142
|
+
selectedDay = day
|
|
143
|
+
|
|
131
144
|
const formatNumber = (num) => num.toString().padStart(2, '0');
|
|
132
145
|
|
|
146
|
+
selectedYear = currentYear
|
|
147
|
+
selectedMonth = currentMonth
|
|
148
|
+
|
|
133
149
|
value = `${currentYear}-${formatNumber(currentMonth)}-${formatNumber(day)}`
|
|
134
150
|
|
|
135
151
|
if (onChange !== undefined) {
|
|
@@ -221,10 +237,10 @@
|
|
|
221
237
|
<tbody>
|
|
222
238
|
{#each weeks as week}
|
|
223
239
|
<tr>
|
|
224
|
-
{#each week as
|
|
240
|
+
{#each week as dayData}
|
|
225
241
|
<td>
|
|
226
242
|
<div>
|
|
227
|
-
<IconButton onClick={!
|
|
243
|
+
<IconButton style={selectedDay != dayData.day && (currentYear == year && currentMonth == month && dayData.day == day) ? "background-color:var(--bg-3)" : ""} onClick={!dayData.currentMonth ? undefined : ()=>{handleUpdateValue(dayData.day)}} desabled={!dayData.currentMonth} variant={selectedDay == dayData.day && (selectedYear == currentYear && selectedMonth == currentMonth) ? "primary" : "ghost"}>{dayData.day}</IconButton>
|
|
228
244
|
</div>
|
|
229
245
|
</td>
|
|
230
246
|
{/each}
|