@aquera/nile-elements 1.2.1-beta-1.5 → 1.2.1-beta-1.7
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/demo/index.html +83 -100
- package/demo/variables.css +2 -3
- package/dist/index.js +369 -657
- package/dist/nile-calendar/nile-calendar.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.cjs.js.map +1 -1
- package/dist/nile-calendar/nile-calendar.css.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.css.cjs.js.map +1 -1
- package/dist/nile-calendar/nile-calendar.css.esm.js +38 -221
- package/dist/nile-calendar/nile-calendar.esm.js +98 -204
- package/dist/nile-select/nile-select.cjs.js +1 -1
- package/dist/nile-select/nile-select.cjs.js.map +1 -1
- package/dist/nile-select/nile-select.esm.js +4 -4
- package/dist/nile-select/virtual-scroll-helper.cjs.js +1 -1
- package/dist/nile-select/virtual-scroll-helper.cjs.js.map +1 -1
- package/dist/nile-select/virtual-scroll-helper.esm.js +1 -0
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js.map +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.esm.js +1 -1
- package/dist/src/nile-calendar/nile-calendar.css.js +36 -219
- package/dist/src/nile-calendar/nile-calendar.css.js.map +1 -1
- package/dist/src/nile-calendar/nile-calendar.d.ts +0 -15
- package/dist/src/nile-calendar/nile-calendar.js +93 -318
- package/dist/src/nile-calendar/nile-calendar.js.map +1 -1
- package/dist/src/nile-rich-text-editor/utils.d.ts +0 -13
- package/dist/src/nile-rich-text-editor/utils.js +1 -537
- package/dist/src/nile-rich-text-editor/utils.js.map +1 -1
- package/dist/src/nile-select/nile-select.d.ts +1 -0
- package/dist/src/nile-select/nile-select.js +30 -9
- package/dist/src/nile-select/nile-select.js.map +1 -1
- package/dist/src/nile-select/virtual-scroll-helper.js +1 -0
- package/dist/src/nile-select/virtual-scroll-helper.js.map +1 -1
- package/dist/src/nile-virtual-select/nile-virtual-select.js +1 -0
- package/dist/src/nile-virtual-select/nile-virtual-select.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-calendar/nile-calendar.css.ts +36 -219
- package/src/nile-calendar/nile-calendar.ts +106 -343
- package/src/nile-select/nile-select.ts +25 -15
- package/src/nile-select/virtual-scroll-helper.ts +2 -0
- package/src/nile-virtual-select/nile-virtual-select.ts +1 -0
- package/vscode-html-custom-data.json +17 -41
|
@@ -29,9 +29,6 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
|
29
29
|
this.type = 'absolute';
|
|
30
30
|
this.hideDurationFields = [];
|
|
31
31
|
this.showManualInputs = false;
|
|
32
|
-
this.showMonthDropdown = false;
|
|
33
|
-
this.showYearDropdown = false;
|
|
34
|
-
this.dateFormat = 'MM/DD/YYYY';
|
|
35
32
|
this.startDate = null;
|
|
36
33
|
this.endDate = null;
|
|
37
34
|
this.isSelectingStart = true;
|
|
@@ -75,26 +72,6 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
|
75
72
|
this.initializeValue();
|
|
76
73
|
}
|
|
77
74
|
}
|
|
78
|
-
get monthNames() {
|
|
79
|
-
return Array.from({ length: 12 }, (_, i) => new Date(0, i).toLocaleString('default', { month: 'long' }));
|
|
80
|
-
}
|
|
81
|
-
get yearOptions() {
|
|
82
|
-
const fallbackStart = 2000;
|
|
83
|
-
const fallbackEnd = 2050;
|
|
84
|
-
const start = this.startYear ?? fallbackStart;
|
|
85
|
-
const end = this.endYear ?? fallbackEnd;
|
|
86
|
-
if (start > end)
|
|
87
|
-
return [];
|
|
88
|
-
return Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
89
|
-
}
|
|
90
|
-
onMonthSelected(monthIndex) {
|
|
91
|
-
this.currentMonth = monthIndex;
|
|
92
|
-
this.emit('nile-month-change', { month: monthIndex });
|
|
93
|
-
}
|
|
94
|
-
onYearSelected(year) {
|
|
95
|
-
this.currentYear = year;
|
|
96
|
-
this.emit('nile-year-change', { year });
|
|
97
|
-
}
|
|
98
75
|
checkValidAllowedDate() {
|
|
99
76
|
let newDateRange;
|
|
100
77
|
try {
|
|
@@ -117,68 +94,6 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
|
117
94
|
this.allowedDatesLocal = newDateRange;
|
|
118
95
|
}
|
|
119
96
|
}
|
|
120
|
-
isPrevDisabled() {
|
|
121
|
-
return (this.currentMonth === 0 &&
|
|
122
|
-
this.startYear !== undefined &&
|
|
123
|
-
this.currentYear <= this.startYear);
|
|
124
|
-
}
|
|
125
|
-
isNextDisabled() {
|
|
126
|
-
return (this.currentMonth === 11 &&
|
|
127
|
-
this.endYear !== undefined &&
|
|
128
|
-
this.currentYear >= this.endYear);
|
|
129
|
-
}
|
|
130
|
-
formatDate(date) {
|
|
131
|
-
if (!date)
|
|
132
|
-
return '';
|
|
133
|
-
const yyyy = date.getFullYear();
|
|
134
|
-
const mm = String(date.getMonth() + 1).padStart(2, '0');
|
|
135
|
-
const dd = String(date.getDate()).padStart(2, '0');
|
|
136
|
-
let formatted = this.dateFormat;
|
|
137
|
-
formatted = formatted.replace(/YYYY/g, String(yyyy));
|
|
138
|
-
formatted = formatted.replace(/MM/g, mm);
|
|
139
|
-
formatted = formatted.replace(/DD/g, dd);
|
|
140
|
-
formatted = formatted.replace(/YY/g, String(yyyy).slice(-2));
|
|
141
|
-
return formatted;
|
|
142
|
-
}
|
|
143
|
-
parseDate(input, existingDate) {
|
|
144
|
-
if (!input || !this.dateFormat)
|
|
145
|
-
return null;
|
|
146
|
-
const formatPattern = this.dateFormat
|
|
147
|
-
.replace(/YYYY/, '(?<year>\\d{4})')
|
|
148
|
-
.replace(/YY/, '(?<year>\\d{2})')
|
|
149
|
-
.replace(/MM/, '(?<month>\\d{1,2})')
|
|
150
|
-
.replace(/DD/, '(?<day>\\d{1,2})');
|
|
151
|
-
const regex = new RegExp(`^${formatPattern}$`);
|
|
152
|
-
const match = input.match(regex);
|
|
153
|
-
if (!match || !match.groups)
|
|
154
|
-
return null;
|
|
155
|
-
const year = match.groups.year.length === 2 ? Number(`20${match.groups.year}`) : Number(match.groups.year);
|
|
156
|
-
const month = Number(match.groups.month) - 1;
|
|
157
|
-
const day = Number(match.groups.day);
|
|
158
|
-
const date = new Date(existingDate || new Date());
|
|
159
|
-
date.setFullYear(year, month, day);
|
|
160
|
-
return isNaN(date.getTime()) ? null : date;
|
|
161
|
-
}
|
|
162
|
-
handleStartDateInput(event) {
|
|
163
|
-
event.stopPropagation();
|
|
164
|
-
const newDate = this.parseDate(event.detail.value, this.startDate);
|
|
165
|
-
if (newDate) {
|
|
166
|
-
this.startDate = newDate;
|
|
167
|
-
this.currentMonth = newDate.getMonth();
|
|
168
|
-
this.currentYear = newDate.getFullYear();
|
|
169
|
-
this.requestUpdate();
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
handleEndDateInput(event) {
|
|
173
|
-
event.stopPropagation();
|
|
174
|
-
const newDate = this.parseDate(event.detail.value, this.endDate);
|
|
175
|
-
if (newDate) {
|
|
176
|
-
this.endDate = newDate;
|
|
177
|
-
this.currentMonth = newDate.getMonth();
|
|
178
|
-
this.currentYear = newDate.getFullYear();
|
|
179
|
-
this.requestUpdate();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
97
|
/**
|
|
183
98
|
* Render method
|
|
184
99
|
*/
|
|
@@ -189,16 +104,15 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
|
189
104
|
base: true,
|
|
190
105
|
base__range: this.range,
|
|
191
106
|
})}
|
|
192
|
-
part="calendar-container"
|
|
193
107
|
>
|
|
194
108
|
<div class=${classMap({
|
|
195
109
|
"calendar-config": true,
|
|
196
110
|
"hidden": !this.range || (this.range && this.hideTypes)
|
|
197
111
|
})}>
|
|
198
|
-
<div class="calendar-switcher"
|
|
112
|
+
<div class="calendar-switcher">
|
|
199
113
|
<nile-tab-group centered @nile-tab-show="${this.onTypeChange}" value="${this.type}">
|
|
200
|
-
<nile-tab slot="nav" panel="absolute"
|
|
201
|
-
<nile-tab slot="nav" panel="relative"
|
|
114
|
+
<nile-tab slot="nav" panel="absolute">Absolute</nile-tab>
|
|
115
|
+
<nile-tab slot="nav" panel="relative">Relative</nile-tab>
|
|
202
116
|
</nile-tab-group>
|
|
203
117
|
</div>
|
|
204
118
|
</div>
|
|
@@ -207,25 +121,19 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
|
207
121
|
${this.type == 'absolute' ? this.renderAbsoluteCalendar() : ''}
|
|
208
122
|
|
|
209
123
|
${!this.range ? '' : html `
|
|
210
|
-
<div class="button-container"
|
|
124
|
+
<div class="button-container">
|
|
211
125
|
${this.allowClear ?
|
|
212
126
|
html `
|
|
213
127
|
<nile-button
|
|
214
128
|
class="clear-button"
|
|
215
129
|
variant="secondary"
|
|
216
|
-
role="button"
|
|
217
130
|
?disabled="${!this.startDate || !this.endDate}"
|
|
218
|
-
@keydown="${(e) => { if (e.key === 'Enter' || e.key === ' ')
|
|
219
|
-
this.clearDate(); }}"
|
|
220
131
|
@click="${this.clearDate}"
|
|
221
|
-
|
|
222
|
-
> Reset</nile-button>` : nothing}
|
|
132
|
+
> Clear</nile-button>` : nothing}
|
|
223
133
|
<nile-button
|
|
224
134
|
class="apply-button"
|
|
225
135
|
?disabled="${!this.startDate || !this.endDate}"
|
|
226
136
|
@click="${this.confimRange}"
|
|
227
|
-
@keydown="${(e) => { if (e.key === 'Enter' || e.key === ' ')
|
|
228
|
-
this.confimRange(); }}"
|
|
229
137
|
> Apply</nile-button>
|
|
230
138
|
</div>
|
|
231
139
|
`}
|
|
@@ -237,46 +145,30 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
|
237
145
|
*/
|
|
238
146
|
renderAbsoluteCalendar() {
|
|
239
147
|
return html `
|
|
240
|
-
<div class="calendar-wrapper"
|
|
241
|
-
<div class="calendar-container"
|
|
148
|
+
<div class="calendar-wrapper">
|
|
149
|
+
<div class="calendar-container">
|
|
242
150
|
${this.renderMonth(this.currentYear, this.currentMonth, this.getDaysArray(this.currentYear, this.currentMonth))}
|
|
243
151
|
</div>
|
|
244
152
|
</div>
|
|
245
153
|
${this.range ? html `
|
|
246
154
|
<div class="calender-input ${this.showManualInputs ? '' : 'hidden'}" >
|
|
247
155
|
<div class="from">
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
<nile-input
|
|
257
|
-
class="manual-input time-input"
|
|
258
|
-
placeholder="HH:MM:SS"
|
|
259
|
-
value="${this.formatTime(this.startDate)}"
|
|
260
|
-
@nile-change="${this.handleStartTimeInput}"
|
|
261
|
-
></nile-input>
|
|
262
|
-
</div>
|
|
263
|
-
|
|
264
|
-
<div class="from">
|
|
265
|
-
<nile-input
|
|
266
|
-
label="To"
|
|
267
|
-
class="manual-input date-input"
|
|
268
|
-
placeholder="${this.dateFormat}"
|
|
269
|
-
value="${this.formatDate(this.endDate)}"
|
|
270
|
-
@nile-change="${this.handleEndDateInput}"
|
|
271
|
-
></nile-input>
|
|
156
|
+
<nile-input
|
|
157
|
+
label="From"
|
|
158
|
+
class="manual-input"
|
|
159
|
+
value="${this.formatTime(this.startDate)}"
|
|
160
|
+
placeholder="HH:MM:SS" @nile-change="${this.handleStartTimeInput}"
|
|
161
|
+
> </nile-input>
|
|
162
|
+
</div>
|
|
272
163
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
164
|
+
<div class="from">
|
|
165
|
+
<nile-input
|
|
166
|
+
label="To"
|
|
167
|
+
class="manual-input"
|
|
168
|
+
value="${this.formatTime(this.endDate)}"
|
|
169
|
+
placeholder="HH:MM:SS" @nile-change="${this.handleEndTimeInput}"
|
|
170
|
+
> </nile-input>
|
|
171
|
+
</div>
|
|
280
172
|
</div>
|
|
281
173
|
` : ''}
|
|
282
174
|
`;
|
|
@@ -286,84 +178,72 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
|
286
178
|
*/
|
|
287
179
|
renderRelativeCalendar() {
|
|
288
180
|
return html `
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
<div class="duration-units">
|
|
296
|
-
${this.renderTimeValues('minutes', [1, 5, 15, 30, 45])}
|
|
297
|
-
</div>
|
|
298
|
-
</div>
|
|
299
|
-
`}
|
|
300
|
-
|
|
301
|
-
${this.hideDurationFields?.includes('hours') ? '' : html `
|
|
302
|
-
<div class="unit-group">
|
|
303
|
-
<div class="duration-name">Hours</div>
|
|
304
|
-
<div class="duration-units">
|
|
305
|
-
${this.renderTimeValues('hours', [1, 2, 3, 6, 8, 12])}
|
|
306
|
-
</div>
|
|
307
|
-
</div>
|
|
308
|
-
`}
|
|
309
|
-
|
|
310
|
-
${this.hideDurationFields?.includes('days') ? '' : html `
|
|
311
|
-
<div class="unit-group">
|
|
312
|
-
<div class="duration-name">Days</div>
|
|
313
|
-
<div class="duration-units">
|
|
314
|
-
${this.renderTimeValues('days', [1, 2, 3, 4, 5, 6])}
|
|
315
|
-
</div>
|
|
316
|
-
</div>
|
|
317
|
-
`}
|
|
318
|
-
|
|
319
|
-
${this.hideDurationFields?.includes('weeks') ? '' : html `
|
|
320
|
-
<div class="unit-group">
|
|
321
|
-
<div class="duration-name">Weeks</div>
|
|
322
|
-
<div class="duration-units">
|
|
323
|
-
${this.renderTimeValues('weeks', [1, 2, 4, 6])}
|
|
324
|
-
</div>
|
|
325
|
-
</div>
|
|
326
|
-
`}
|
|
327
|
-
|
|
328
|
-
${this.hideDurationFields?.includes('months') ? '' : html `
|
|
329
|
-
<div class="unit-group">
|
|
330
|
-
<div class="duration-name">Months</div>
|
|
331
|
-
<div class="duration-units">
|
|
332
|
-
${this.renderTimeValues('months', [3, 6, 12, 15])}
|
|
333
|
-
</div>
|
|
334
|
-
</div>
|
|
335
|
-
`}
|
|
181
|
+
<div class="units-wrapper">
|
|
182
|
+
<div class="unit-container">
|
|
183
|
+
${this.hideDurationFields?.includes('minutes') ? '' : html `
|
|
184
|
+
<div class="duration-name">Minutes</div>
|
|
185
|
+
<div class="duration-units">
|
|
186
|
+
${this.renderTimeValues('minutes', [1, 5, 15, 30, 45])}
|
|
336
187
|
</div>
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
<div class="
|
|
342
|
-
|
|
343
|
-
class="manual-input duration-input"
|
|
344
|
-
label="Duration"
|
|
345
|
-
inputmode="numeric"
|
|
346
|
-
type="number"
|
|
347
|
-
value="${this.selectedValue}"
|
|
348
|
-
@nile-change="${this.handleDurationChange}"
|
|
349
|
-
placeholder="Enter Value"
|
|
350
|
-
></nile-input>
|
|
351
|
-
|
|
352
|
-
<nile-select
|
|
353
|
-
class="manual-input time-input"
|
|
354
|
-
label="Unit of time"
|
|
355
|
-
value="${this.selectedUnit}"
|
|
356
|
-
@nile-change="${this.handleUnitChange}"
|
|
357
|
-
>
|
|
358
|
-
<nile-option value="minutes" class="${this.hideDurationFields?.includes('minutes') ? 'hidden' : ''}">Minutes</nile-option>
|
|
359
|
-
<nile-option value="hours" class="${this.hideDurationFields?.includes('hours') ? 'hidden' : ''}">Hours</nile-option>
|
|
360
|
-
<nile-option value="days" class="${this.hideDurationFields?.includes('days') ? 'hidden' : ''}">Days</nile-option>
|
|
361
|
-
<nile-option value="weeks" class="${this.hideDurationFields?.includes('weeks') ? 'hidden' : ''}">Weeks</nile-option>
|
|
362
|
-
<nile-option value="months" class="${this.hideDurationFields?.includes('months') ? 'hidden' : ''}">Months</nile-option>
|
|
363
|
-
</nile-select>
|
|
188
|
+
`}
|
|
189
|
+
|
|
190
|
+
${this.hideDurationFields?.includes('hours') ? '' : html `
|
|
191
|
+
<div class="duration-name">Hours</div>
|
|
192
|
+
<div class="duration-units">
|
|
193
|
+
${this.renderTimeValues('hours', [1, 2, 3, 6, 8, 12])}
|
|
364
194
|
</div>
|
|
195
|
+
`}
|
|
196
|
+
|
|
197
|
+
${this.hideDurationFields?.includes('days') ? '' : html `
|
|
198
|
+
<div class="duration-name">Days</div>
|
|
199
|
+
<div class="duration-units">
|
|
200
|
+
${this.renderTimeValues('days', [1, 2, 3, 4, 5, 6])}
|
|
201
|
+
</div>
|
|
202
|
+
`}
|
|
203
|
+
|
|
204
|
+
${this.hideDurationFields?.includes('weeks') ? '' : html `
|
|
205
|
+
<div class="duration-name">Weeks</div>
|
|
206
|
+
<div class="duration-units">
|
|
207
|
+
${this.renderTimeValues('weeks', [1, 2, 4, 6])}
|
|
208
|
+
</div>
|
|
209
|
+
`}
|
|
210
|
+
|
|
211
|
+
${this.hideDurationFields?.includes('months') ? '' : html `
|
|
212
|
+
<div class="duration-name">Months</div>
|
|
213
|
+
<div class="duration-units">
|
|
214
|
+
${this.renderTimeValues('months', [3, 6, 12, 15])}
|
|
215
|
+
</div>
|
|
216
|
+
`}
|
|
365
217
|
</div>
|
|
366
|
-
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
${this.range ? html `
|
|
221
|
+
<div>
|
|
222
|
+
<div class="unit-input-container">
|
|
223
|
+
<nile-input
|
|
224
|
+
class="manual-input duration-input"
|
|
225
|
+
label="Duration"
|
|
226
|
+
inputmode="numeric"
|
|
227
|
+
type="number"
|
|
228
|
+
value="${this.selectedValue}"
|
|
229
|
+
@nile-change="${this.handleDurationChange}"
|
|
230
|
+
placeholder="Enter Value"
|
|
231
|
+
></nile-input>
|
|
232
|
+
|
|
233
|
+
<nile-select class="manual-input time-input"
|
|
234
|
+
label="Unit of time"
|
|
235
|
+
value="${this.selectedUnit}"
|
|
236
|
+
@nile-change="${this.handleUnitChange}"
|
|
237
|
+
>
|
|
238
|
+
<nile-option value="minutes" class="${this.hideDurationFields?.includes('minutes') ? 'hidden' : ''}">Minutes</nile-option>
|
|
239
|
+
<nile-option value="hours" class="${this.hideDurationFields?.includes('hours') ? 'hidden' : ''}"> Hours </nile-option>
|
|
240
|
+
<nile-option value="days" class="${this.hideDurationFields?.includes('days') ? 'hidden' : ''}">Days</nile-option>
|
|
241
|
+
<nile-option value="weeks" class="${this.hideDurationFields?.includes('weeks') ? 'hidden' : ''}">Weeks</nile-option>
|
|
242
|
+
<nile-option value="months" class="${this.hideDurationFields?.includes('months') ? 'hidden' : ''}"> Months </nile-option>
|
|
243
|
+
</nile-select>
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
246
|
+
` : ''}
|
|
367
247
|
`;
|
|
368
248
|
}
|
|
369
249
|
/**
|
|
@@ -377,8 +257,6 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
|
377
257
|
<div
|
|
378
258
|
class="duration__value ${this.selectedUnit === unit && this.selectedValue === value ? 'duration__value--selected' : ''}"
|
|
379
259
|
@click=${(e) => this.handleTimeValueClick(unit, value, e)}
|
|
380
|
-
@keydown="${(e) => { if (e.key === 'Enter' || e.key === ' ')
|
|
381
|
-
this.handleTimeValueClick(unit, value, e); }}"
|
|
382
260
|
>${value}
|
|
383
261
|
</div>`);
|
|
384
262
|
}
|
|
@@ -440,91 +318,20 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
|
440
318
|
name="var(--nile-icon-arrow-left, var(--ng-icon-chevron-left))"
|
|
441
319
|
method="var(--nile-svg-method-fill, var(--ng-svg-method-stroke))"
|
|
442
320
|
color="black"
|
|
443
|
-
role="button"
|
|
444
|
-
tabindex="${this.isPrevDisabled() ? '-1' : '0'}"
|
|
445
|
-
@keydown="${(e) => { if (e.key === 'Enter' || e.key === ' ')
|
|
446
|
-
this.prevMonth(); }}"
|
|
447
321
|
@click="${this.prevMonth}"
|
|
448
322
|
>
|
|
449
323
|
</nile-icon>
|
|
450
|
-
<
|
|
451
|
-
|
|
452
|
-
${this.showMonthDropdown || this.showYearDropdown ? html `
|
|
453
|
-
${this.showMonthDropdown ? html `
|
|
454
|
-
<nile-dropdown class="month-dropdown">
|
|
455
|
-
<span
|
|
456
|
-
slot="trigger"
|
|
457
|
-
class="calendar-header__trigger month-trigger"
|
|
458
|
-
role="button"
|
|
459
|
-
>
|
|
460
|
-
${new Date(year, month).toLocaleString('default', { month: 'long' })}
|
|
461
|
-
<nile-icon name="arrowdropdown" color="black" class="calendar-header__caret"></nile-icon>
|
|
462
|
-
</span>
|
|
463
|
-
<nile-menu>
|
|
464
|
-
<div class="month-scroll-wrapper">
|
|
465
|
-
${this.monthNames.map((m, idx) => html `
|
|
466
|
-
<nile-menu-item
|
|
467
|
-
class="month-menu-item"
|
|
468
|
-
?selected="${idx === month}"
|
|
469
|
-
@click="${() => this.onMonthSelected(idx)}"
|
|
470
|
-
>
|
|
471
|
-
${m}
|
|
472
|
-
</nile-menu-item>
|
|
473
|
-
`)}
|
|
474
|
-
</div>
|
|
475
|
-
</nile-menu>
|
|
476
|
-
</nile-dropdown>
|
|
477
|
-
` : html `
|
|
478
|
-
<span
|
|
479
|
-
>${new Date(year, month).toLocaleString('default', { month: 'long' })}</span
|
|
480
|
-
>
|
|
481
|
-
`}
|
|
482
|
-
${this.showYearDropdown ? html `
|
|
483
|
-
<nile-dropdown class="year-dropdown">
|
|
484
|
-
<span
|
|
485
|
-
slot="trigger"
|
|
486
|
-
class="calendar-header__trigger"
|
|
487
|
-
role="button"
|
|
488
|
-
>
|
|
489
|
-
${year}
|
|
490
|
-
<nile-icon name="arrowdropdown" color="black" class="calendar-header__caret"></nile-icon>
|
|
491
|
-
</span>
|
|
492
|
-
<nile-menu>
|
|
493
|
-
<div class="year-scroll-wrapper">
|
|
494
|
-
${this.yearOptions.map(y => html `
|
|
495
|
-
<nile-menu-item
|
|
496
|
-
class="year-menu-item"
|
|
497
|
-
?selected="${y === year}"
|
|
498
|
-
@click="${() => this.onYearSelected(y)}"
|
|
499
|
-
>
|
|
500
|
-
${y}
|
|
501
|
-
</nile-menu-item>
|
|
502
|
-
`)}
|
|
503
|
-
</div>
|
|
504
|
-
</nile-menu>
|
|
505
|
-
</nile-dropdown>
|
|
506
|
-
` : html `
|
|
507
|
-
<span>${year}</span>
|
|
508
|
-
`}
|
|
509
|
-
` : html `
|
|
510
|
-
<span
|
|
511
|
-
>${new Date(year, month).toLocaleString('default', {
|
|
324
|
+
<span
|
|
325
|
+
>${new Date(year, month).toLocaleString('default', {
|
|
512
326
|
month: 'long',
|
|
513
327
|
})}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
`}
|
|
517
|
-
</div>
|
|
518
|
-
|
|
328
|
+
${year}</span
|
|
329
|
+
>
|
|
519
330
|
<nile-icon
|
|
520
331
|
class="calendar-header__month-navigation"
|
|
521
332
|
name="var(--nile-icon-arrow-right, var(--ng-icon-chevron-right))"
|
|
522
333
|
method="var(--nile-svg-method-fill, var(--ng-svg-method-stroke))"
|
|
523
334
|
color="black"
|
|
524
|
-
role="button"
|
|
525
|
-
tabindex="${this.isNextDisabled() ? '-1' : '0'}"
|
|
526
|
-
@keydown="${(e) => { if (e.key === 'Enter' || e.key === ' ')
|
|
527
|
-
this.nextMonth(); }}"
|
|
528
335
|
@click="${this.nextMonth}"
|
|
529
336
|
>
|
|
530
337
|
</nile-icon>
|
|
@@ -552,17 +359,13 @@ ${this.showMonthDropdown || this.showYearDropdown ? html `
|
|
|
552
359
|
classMapObj[datePlacement] = true;
|
|
553
360
|
return html `
|
|
554
361
|
<div
|
|
555
|
-
part="calendar-day-${day}"
|
|
556
362
|
class=${classMap(classMapObj)}
|
|
557
|
-
tabindex="${isCurrentMonth && this.isAllowedDate(day, month, year) ? '0' : '-1'}"
|
|
558
|
-
@keydown="${(e) => { if (e.key === 'Enter' || e.key === ' ')
|
|
559
|
-
this.selectDate(day, month, year); }}"
|
|
560
363
|
@click="${() => { if (isCurrentMonth)
|
|
561
364
|
this.selectDate(day, month, year); }}"
|
|
562
365
|
>
|
|
563
366
|
<span style="position:relative;">
|
|
564
367
|
${day}
|
|
565
|
-
${isCurrentDate(day, month, year) && isCurrentMonth ? html `<div class="current__date__dot"
|
|
368
|
+
${isCurrentDate(day, month, year) && isCurrentMonth ? html `<div class="current__date__dot"></div>` : nothing}
|
|
566
369
|
</span>
|
|
567
370
|
</div>`;
|
|
568
371
|
})}
|
|
@@ -593,17 +396,10 @@ ${this.showMonthDropdown || this.showYearDropdown ? html `
|
|
|
593
396
|
this.valueAttribute = '';
|
|
594
397
|
this.startDate = null;
|
|
595
398
|
this.endDate = null;
|
|
596
|
-
this.selectedUnit = undefined;
|
|
597
|
-
this.selectedValue = undefined;
|
|
598
|
-
if (this.range && this.type === 'relative') {
|
|
599
|
-
this.selectedUnit = undefined;
|
|
600
|
-
this.selectedValue = undefined;
|
|
601
|
-
}
|
|
602
399
|
}
|
|
603
400
|
else {
|
|
604
401
|
this.value = null;
|
|
605
402
|
}
|
|
606
|
-
this.requestUpdate();
|
|
607
403
|
this.emit('nile-clear');
|
|
608
404
|
}
|
|
609
405
|
/**
|
|
@@ -795,11 +591,8 @@ ${this.showMonthDropdown || this.showYearDropdown ? html `
|
|
|
795
591
|
}
|
|
796
592
|
nextMonth() {
|
|
797
593
|
if (this.currentMonth === 11) {
|
|
798
|
-
const newYear = this.currentYear + 1;
|
|
799
|
-
if (this.endYear !== undefined && newYear > this.endYear)
|
|
800
|
-
return;
|
|
801
594
|
this.currentMonth = 0;
|
|
802
|
-
this.currentYear
|
|
595
|
+
this.currentYear++;
|
|
803
596
|
}
|
|
804
597
|
else {
|
|
805
598
|
this.currentMonth++;
|
|
@@ -807,11 +600,8 @@ ${this.showMonthDropdown || this.showYearDropdown ? html `
|
|
|
807
600
|
}
|
|
808
601
|
prevMonth() {
|
|
809
602
|
if (this.currentMonth === 0) {
|
|
810
|
-
const newYear = this.currentYear - 1;
|
|
811
|
-
if (this.startYear !== undefined && newYear < this.startYear)
|
|
812
|
-
return;
|
|
813
603
|
this.currentMonth = 11;
|
|
814
|
-
this.currentYear
|
|
604
|
+
this.currentYear--;
|
|
815
605
|
}
|
|
816
606
|
else {
|
|
817
607
|
this.currentMonth--;
|
|
@@ -833,7 +623,7 @@ ${this.showMonthDropdown || this.showYearDropdown ? html `
|
|
|
833
623
|
return new Date(Date.UTC(dateStr.slice(0, 4), dateStr.slice(5, 7) - 1, dateStr.slice(8, 10)));
|
|
834
624
|
}
|
|
835
625
|
emitChangedData(data) {
|
|
836
|
-
this.emit('nile-changed', data);
|
|
626
|
+
this.emit('nile-changed', data);
|
|
837
627
|
this.emit('nile-change', data);
|
|
838
628
|
}
|
|
839
629
|
getDaysArray(year, month) {
|
|
@@ -874,21 +664,6 @@ __decorate([
|
|
|
874
664
|
__decorate([
|
|
875
665
|
property({ type: Boolean })
|
|
876
666
|
], NileCalendar.prototype, "showManualInputs", void 0);
|
|
877
|
-
__decorate([
|
|
878
|
-
property({ type: Number, attribute: true, reflect: true })
|
|
879
|
-
], NileCalendar.prototype, "startYear", void 0);
|
|
880
|
-
__decorate([
|
|
881
|
-
property({ type: Number, attribute: true, reflect: true })
|
|
882
|
-
], NileCalendar.prototype, "endYear", void 0);
|
|
883
|
-
__decorate([
|
|
884
|
-
property({ type: Boolean, attribute: true, reflect: true })
|
|
885
|
-
], NileCalendar.prototype, "showMonthDropdown", void 0);
|
|
886
|
-
__decorate([
|
|
887
|
-
property({ type: Boolean, attribute: true, reflect: true })
|
|
888
|
-
], NileCalendar.prototype, "showYearDropdown", void 0);
|
|
889
|
-
__decorate([
|
|
890
|
-
property({ type: String, reflect: true, attribute: true })
|
|
891
|
-
], NileCalendar.prototype, "dateFormat", void 0);
|
|
892
667
|
__decorate([
|
|
893
668
|
state()
|
|
894
669
|
], NileCalendar.prototype, "startDate", void 0);
|