@aquera/nile-elements 1.2.8-beta-1.1 → 1.2.8-beta-1.3
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/README.md +5 -0
- package/demo/index.html +33 -93
- package/demo/nxtgen.css +0 -6
- package/demo/variables.css +0 -4
- package/dist/index.js +411 -699
- 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 +46 -234
- package/dist/nile-calendar/nile-calendar.esm.js +106 -220
- package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js.map +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js.map +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.esm.js +32 -18
- package/dist/nile-rich-text-editor/nile-rich-text-editor.esm.js +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js +2 -2
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js.map +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.esm.js +3 -3
- package/dist/src/nile-calendar/nile-calendar.css.js +44 -232
- 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 +101 -340
- package/dist/src/nile-calendar/nile-calendar.js.map +1 -1
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js +30 -16
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js.map +1 -1
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.d.ts +1 -0
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js +12 -0
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js.map +1 -1
- package/dist/src/nile-virtual-select/nile-virtual-select.js +19 -1
- package/dist/src/nile-virtual-select/nile-virtual-select.js.map +1 -1
- package/dist/src/version.js +2 -2
- 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 +44 -232
- package/src/nile-calendar/nile-calendar.ts +115 -369
- package/src/nile-rich-text-editor/nile-rich-text-editor.css.ts +30 -16
- package/src/nile-rich-text-editor/nile-rich-text-editor.ts +12 -0
- package/src/nile-virtual-select/nile-virtual-select.ts +26 -2
- package/vscode-html-custom-data.json +27 -47
|
@@ -60,16 +60,6 @@ export class NileCalendar extends NileElement {
|
|
|
60
60
|
|
|
61
61
|
@property({ type: Boolean}) showManualInputs :boolean=false;
|
|
62
62
|
|
|
63
|
-
@property({ type: Number , attribute: true, reflect: true }) startYear?: number;
|
|
64
|
-
|
|
65
|
-
@property({ type: Number , attribute: true, reflect: true }) endYear?: number;
|
|
66
|
-
|
|
67
|
-
@property({ type: Boolean, attribute:true, reflect: true}) showMonthDropdown = false;
|
|
68
|
-
@property({ type: Boolean, attribute:true, reflect: true}) showYearDropdown = false;
|
|
69
|
-
|
|
70
|
-
@property({ type: String, reflect: true, attribute: true}) dateFormat: string = 'MM/DD/YYYY';
|
|
71
|
-
|
|
72
|
-
|
|
73
63
|
@state() startDate: Date | null = null;
|
|
74
64
|
|
|
75
65
|
@state() endDate: Date | null = null;
|
|
@@ -117,34 +107,6 @@ export class NileCalendar extends NileElement {
|
|
|
117
107
|
}
|
|
118
108
|
}
|
|
119
109
|
|
|
120
|
-
private get monthNames() {
|
|
121
|
-
return Array.from({ length: 12 }, (_, i) =>
|
|
122
|
-
new Date(0, i).toLocaleString('default', { month: 'long' })
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
private get yearOptions(): number[] {
|
|
127
|
-
const fallbackStart = 2000;
|
|
128
|
-
const fallbackEnd = 2050;
|
|
129
|
-
|
|
130
|
-
const start = this.startYear ?? fallbackStart;
|
|
131
|
-
const end = this.endYear ?? fallbackEnd;
|
|
132
|
-
|
|
133
|
-
if (start > end) return [];
|
|
134
|
-
|
|
135
|
-
return Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
private onMonthSelected(monthIndex: number) {
|
|
139
|
-
this.currentMonth = monthIndex;
|
|
140
|
-
this.emit('nile-month-change', { month: monthIndex });
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
private onYearSelected(year: number) {
|
|
144
|
-
this.currentYear = year;
|
|
145
|
-
this.emit('nile-year-change', { year });
|
|
146
|
-
}
|
|
147
|
-
|
|
148
110
|
@watch('allowedDates')
|
|
149
111
|
checkValidAllowedDate() {
|
|
150
112
|
let newDateRange: NileCalendarDateRange | null;
|
|
@@ -169,84 +131,6 @@ export class NileCalendar extends NileElement {
|
|
|
169
131
|
this.allowedDatesLocal=newDateRange;
|
|
170
132
|
}
|
|
171
133
|
}
|
|
172
|
-
|
|
173
|
-
private isPrevDisabled(): boolean {
|
|
174
|
-
return (
|
|
175
|
-
this.currentMonth === 0 &&
|
|
176
|
-
this.startYear !== undefined &&
|
|
177
|
-
this.currentYear <= this.startYear
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
private isNextDisabled(): boolean {
|
|
182
|
-
return (
|
|
183
|
-
this.currentMonth === 11 &&
|
|
184
|
-
this.endYear !== undefined &&
|
|
185
|
-
this.currentYear >= this.endYear
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
private formatDate(date: Date | null): string {
|
|
190
|
-
if (!date) return '';
|
|
191
|
-
|
|
192
|
-
const yyyy = date.getFullYear();
|
|
193
|
-
const mm = String(date.getMonth() + 1).padStart(2, '0');
|
|
194
|
-
const dd = String(date.getDate()).padStart(2, '0');
|
|
195
|
-
|
|
196
|
-
let formatted = this.dateFormat;
|
|
197
|
-
formatted = formatted.replace(/YYYY/g, String(yyyy));
|
|
198
|
-
formatted = formatted.replace(/MM/g, mm);
|
|
199
|
-
formatted = formatted.replace(/DD/g, dd);
|
|
200
|
-
formatted = formatted.replace(/YY/g, String(yyyy).slice(-2));
|
|
201
|
-
|
|
202
|
-
return formatted;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
private parseDate(input: string, existingDate?: Date | null): Date | null {
|
|
207
|
-
if (!input || !this.dateFormat) return null;
|
|
208
|
-
const formatPattern = this.dateFormat
|
|
209
|
-
.replace(/YYYY/, '(?<year>\\d{4})')
|
|
210
|
-
.replace(/YY/, '(?<year>\\d{2})')
|
|
211
|
-
.replace(/MM/, '(?<month>\\d{1,2})')
|
|
212
|
-
.replace(/DD/, '(?<day>\\d{1,2})');
|
|
213
|
-
|
|
214
|
-
const regex = new RegExp(`^${formatPattern}$`);
|
|
215
|
-
const match = input.match(regex);
|
|
216
|
-
if (!match || !match.groups) return null;
|
|
217
|
-
|
|
218
|
-
const year = match.groups.year.length === 2 ? Number(`20${match.groups.year}`) : Number(match.groups.year);
|
|
219
|
-
const month = Number(match.groups.month) - 1;
|
|
220
|
-
const day = Number(match.groups.day);
|
|
221
|
-
|
|
222
|
-
const date = new Date(existingDate || new Date());
|
|
223
|
-
date.setFullYear(year, month, day);
|
|
224
|
-
return isNaN(date.getTime()) ? null : date;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
private handleStartDateInput(event: CustomEvent): void {
|
|
229
|
-
event.stopPropagation();
|
|
230
|
-
const newDate = this.parseDate(event.detail.value, this.startDate);
|
|
231
|
-
if (newDate) {
|
|
232
|
-
this.startDate = newDate;
|
|
233
|
-
this.currentMonth = newDate.getMonth();
|
|
234
|
-
this.currentYear = newDate.getFullYear();
|
|
235
|
-
this.requestUpdate();
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
private handleEndDateInput(event: CustomEvent): void {
|
|
240
|
-
event.stopPropagation();
|
|
241
|
-
const newDate = this.parseDate(event.detail.value, this.endDate);
|
|
242
|
-
if (newDate) {
|
|
243
|
-
this.endDate = newDate;
|
|
244
|
-
this.currentMonth = newDate.getMonth();
|
|
245
|
-
this.currentYear = newDate.getFullYear();
|
|
246
|
-
this.requestUpdate();
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
134
|
|
|
251
135
|
|
|
252
136
|
/**
|
|
@@ -259,16 +143,15 @@ private handleEndDateInput(event: CustomEvent): void {
|
|
|
259
143
|
base:true,
|
|
260
144
|
base__range:this.range,
|
|
261
145
|
})}
|
|
262
|
-
part="calendar-container"
|
|
263
146
|
>
|
|
264
147
|
<div class=${classMap({
|
|
265
148
|
"calendar-config":true,
|
|
266
149
|
"hidden": !this.range || (this.range && this.hideTypes)
|
|
267
150
|
})}>
|
|
268
|
-
<div class="calendar-switcher"
|
|
151
|
+
<div class="calendar-switcher">
|
|
269
152
|
<nile-tab-group centered @nile-tab-show="${this.onTypeChange}" value="${this.type}">
|
|
270
|
-
<nile-tab slot="nav" panel="absolute"
|
|
271
|
-
<nile-tab slot="nav" panel="relative"
|
|
153
|
+
<nile-tab slot="nav" panel="absolute">Absolute</nile-tab>
|
|
154
|
+
<nile-tab slot="nav" panel="relative">Relative</nile-tab>
|
|
272
155
|
</nile-tab-group>
|
|
273
156
|
</div>
|
|
274
157
|
</div>
|
|
@@ -277,24 +160,20 @@ private handleEndDateInput(event: CustomEvent): void {
|
|
|
277
160
|
${this.type == 'absolute' ? this.renderAbsoluteCalendar():''}
|
|
278
161
|
|
|
279
162
|
${!this.range?'':html`
|
|
280
|
-
<div class="button-container"
|
|
163
|
+
<div class="button-container">
|
|
281
164
|
${this.allowClear?
|
|
282
165
|
html`
|
|
283
166
|
<nile-button
|
|
284
167
|
class="clear-button"
|
|
285
168
|
variant="secondary"
|
|
286
|
-
role="button"
|
|
287
169
|
?disabled="${ !this.startDate || !this.endDate }"
|
|
288
|
-
@keydown="${(e: KeyboardEvent) => {if (e.key === 'Enter' || e.key === ' ') this.clearDate();}}"
|
|
289
170
|
@click="${this.clearDate}"
|
|
290
|
-
|
|
291
|
-
> Reset</nile-button>`:nothing
|
|
171
|
+
> Clear</nile-button>`:nothing
|
|
292
172
|
}
|
|
293
173
|
<nile-button
|
|
294
174
|
class="apply-button"
|
|
295
175
|
?disabled="${ !this.startDate || !this.endDate }"
|
|
296
176
|
@click="${this.confimRange}"
|
|
297
|
-
@keydown="${(e: KeyboardEvent) => {if (e.key === 'Enter' || e.key === ' ') this.confimRange();}}"
|
|
298
177
|
> Apply</nile-button>
|
|
299
178
|
</div>
|
|
300
179
|
`}
|
|
@@ -307,8 +186,8 @@ private handleEndDateInput(event: CustomEvent): void {
|
|
|
307
186
|
*/
|
|
308
187
|
renderAbsoluteCalendar(){
|
|
309
188
|
return html`
|
|
310
|
-
<div class="calendar-wrapper"
|
|
311
|
-
<div class="calendar-container"
|
|
189
|
+
<div class="calendar-wrapper">
|
|
190
|
+
<div class="calendar-container">
|
|
312
191
|
${this.renderMonth(
|
|
313
192
|
this.currentYear,
|
|
314
193
|
this.currentMonth,
|
|
@@ -318,47 +197,23 @@ private handleEndDateInput(event: CustomEvent): void {
|
|
|
318
197
|
</div>
|
|
319
198
|
${this.range ? html`
|
|
320
199
|
<div class="calender-input ${this.showManualInputs ? '' : 'hidden'}" >
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
></nile-input>
|
|
339
|
-
</div>
|
|
340
|
-
</div>
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
<div class="from">
|
|
344
|
-
<div class="from-date">
|
|
345
|
-
<nile-input
|
|
346
|
-
label="To"
|
|
347
|
-
class="manual-input date-input"
|
|
348
|
-
placeholder="${this.dateFormat}"
|
|
349
|
-
value="${this.formatDate(this.endDate)}"
|
|
350
|
-
@nile-change="${this.handleEndDateInput}"
|
|
351
|
-
></nile-input>
|
|
352
|
-
</div>
|
|
353
|
-
<div class="from-time">
|
|
354
|
-
<nile-input
|
|
355
|
-
class="manual-input time-input"
|
|
356
|
-
placeholder="HH:MM:SS"
|
|
357
|
-
value="${this.formatTime(this.endDate)}"
|
|
358
|
-
@nile-change="${this.handleEndTimeInput}"
|
|
359
|
-
></nile-input>
|
|
360
|
-
</div>
|
|
361
|
-
</div>
|
|
200
|
+
<div class="from">
|
|
201
|
+
<nile-input
|
|
202
|
+
label="From"
|
|
203
|
+
class="manual-input"
|
|
204
|
+
value="${this.formatTime(this.startDate)}"
|
|
205
|
+
placeholder="HH:MM:SS" @nile-change="${this.handleStartTimeInput}"
|
|
206
|
+
> </nile-input>
|
|
207
|
+
</div>
|
|
208
|
+
|
|
209
|
+
<div class="from">
|
|
210
|
+
<nile-input
|
|
211
|
+
label="To"
|
|
212
|
+
class="manual-input"
|
|
213
|
+
value="${this.formatTime(this.endDate)}"
|
|
214
|
+
placeholder="HH:MM:SS" @nile-change="${this.handleEndTimeInput}"
|
|
215
|
+
> </nile-input>
|
|
216
|
+
</div>
|
|
362
217
|
</div>
|
|
363
218
|
`:''}
|
|
364
219
|
`
|
|
@@ -367,90 +222,77 @@ private handleEndDateInput(event: CustomEvent): void {
|
|
|
367
222
|
/**
|
|
368
223
|
* @returns HTML content for relative calendar
|
|
369
224
|
*/
|
|
370
|
-
renderRelativeCalendar()
|
|
225
|
+
renderRelativeCalendar(){
|
|
371
226
|
return html`
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
<div class="duration-units">
|
|
379
|
-
${this.renderTimeValues('minutes', [1, 5, 15, 30, 45])}
|
|
380
|
-
</div>
|
|
381
|
-
</div>
|
|
382
|
-
`}
|
|
383
|
-
|
|
384
|
-
${this.hideDurationFields?.includes('hours') ? '' : html`
|
|
385
|
-
<div class="unit-group">
|
|
386
|
-
<div class="duration-name">Hours</div>
|
|
387
|
-
<div class="duration-units">
|
|
388
|
-
${this.renderTimeValues('hours', [1, 2, 3, 6, 8, 12])}
|
|
389
|
-
</div>
|
|
390
|
-
</div>
|
|
391
|
-
`}
|
|
392
|
-
|
|
393
|
-
${this.hideDurationFields?.includes('days') ? '' : html`
|
|
394
|
-
<div class="unit-group">
|
|
395
|
-
<div class="duration-name">Days</div>
|
|
396
|
-
<div class="duration-units">
|
|
397
|
-
${this.renderTimeValues('days', [1, 2, 3, 4, 5, 6])}
|
|
398
|
-
</div>
|
|
399
|
-
</div>
|
|
400
|
-
`}
|
|
401
|
-
|
|
402
|
-
${this.hideDurationFields?.includes('weeks') ? '' : html`
|
|
403
|
-
<div class="unit-group">
|
|
404
|
-
<div class="duration-name">Weeks</div>
|
|
405
|
-
<div class="duration-units">
|
|
406
|
-
${this.renderTimeValues('weeks', [1, 2, 4, 6])}
|
|
407
|
-
</div>
|
|
408
|
-
</div>
|
|
409
|
-
`}
|
|
410
|
-
|
|
411
|
-
${this.hideDurationFields?.includes('months') ? '' : html`
|
|
412
|
-
<div class="unit-group">
|
|
413
|
-
<div class="duration-name">Months</div>
|
|
414
|
-
<div class="duration-units">
|
|
415
|
-
${this.renderTimeValues('months', [3, 6, 12, 15])}
|
|
416
|
-
</div>
|
|
417
|
-
</div>
|
|
418
|
-
`}
|
|
227
|
+
<div class="units-wrapper">
|
|
228
|
+
<div class="unit-container">
|
|
229
|
+
${this.hideDurationFields?.includes('minutes')?'':html`
|
|
230
|
+
<div class="duration-name">Minutes</div>
|
|
231
|
+
<div class="duration-units">
|
|
232
|
+
${this.renderTimeValues('minutes', [1, 5, 15, 30, 45])}
|
|
419
233
|
</div>
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
<div class="
|
|
425
|
-
|
|
426
|
-
class="manual-input duration-input"
|
|
427
|
-
label="Duration"
|
|
428
|
-
inputmode="numeric"
|
|
429
|
-
type="number"
|
|
430
|
-
value="${this.selectedValue}"
|
|
431
|
-
@nile-change="${this.handleDurationChange}"
|
|
432
|
-
placeholder="Enter Value"
|
|
433
|
-
></nile-input>
|
|
434
|
-
|
|
435
|
-
<nile-select
|
|
436
|
-
class="manual-input time-input"
|
|
437
|
-
label="Unit of time"
|
|
438
|
-
value="${this.selectedUnit}"
|
|
439
|
-
@nile-change="${this.handleUnitChange}"
|
|
440
|
-
>
|
|
441
|
-
<nile-option value="minutes" class="${this.hideDurationFields?.includes('minutes') ? 'hidden' : ''}">Minutes</nile-option>
|
|
442
|
-
<nile-option value="hours" class="${this.hideDurationFields?.includes('hours') ? 'hidden' : ''}">Hours</nile-option>
|
|
443
|
-
<nile-option value="days" class="${this.hideDurationFields?.includes('days') ? 'hidden' : ''}">Days</nile-option>
|
|
444
|
-
<nile-option value="weeks" class="${this.hideDurationFields?.includes('weeks') ? 'hidden' : ''}">Weeks</nile-option>
|
|
445
|
-
<nile-option value="months" class="${this.hideDurationFields?.includes('months') ? 'hidden' : ''}">Months</nile-option>
|
|
446
|
-
</nile-select>
|
|
234
|
+
`}
|
|
235
|
+
|
|
236
|
+
${this.hideDurationFields?.includes('hours')?'':html`
|
|
237
|
+
<div class="duration-name">Hours</div>
|
|
238
|
+
<div class="duration-units">
|
|
239
|
+
${this.renderTimeValues('hours', [1, 2, 3, 6, 8, 12])}
|
|
447
240
|
</div>
|
|
241
|
+
`}
|
|
242
|
+
|
|
243
|
+
${this.hideDurationFields?.includes('days')?'':html`
|
|
244
|
+
<div class="duration-name">Days</div>
|
|
245
|
+
<div class="duration-units">
|
|
246
|
+
${this.renderTimeValues('days', [1, 2, 3, 4, 5, 6])}
|
|
247
|
+
</div>
|
|
248
|
+
`}
|
|
249
|
+
|
|
250
|
+
${this.hideDurationFields?.includes('weeks')?'':html`
|
|
251
|
+
<div class="duration-name">Weeks</div>
|
|
252
|
+
<div class="duration-units">
|
|
253
|
+
${this.renderTimeValues('weeks', [1, 2, 4, 6])}
|
|
254
|
+
</div>
|
|
255
|
+
`}
|
|
256
|
+
|
|
257
|
+
${this.hideDurationFields?.includes('months')?'':html`
|
|
258
|
+
<div class="duration-name">Months</div>
|
|
259
|
+
<div class="duration-units">
|
|
260
|
+
${this.renderTimeValues('months', [3, 6, 12, 15])}
|
|
261
|
+
</div>
|
|
262
|
+
`}
|
|
448
263
|
</div>
|
|
449
|
-
|
|
450
|
-
|
|
264
|
+
</div>
|
|
265
|
+
|
|
266
|
+
${this.range ? html`
|
|
267
|
+
<div>
|
|
268
|
+
<div class="unit-input-container">
|
|
269
|
+
<nile-input
|
|
270
|
+
class="manual-input duration-input"
|
|
271
|
+
label="Duration"
|
|
272
|
+
inputmode="numeric"
|
|
273
|
+
type="number"
|
|
274
|
+
value="${this.selectedValue}"
|
|
275
|
+
@nile-change="${this.handleDurationChange}"
|
|
276
|
+
placeholder="Enter Value"
|
|
277
|
+
></nile-input>
|
|
278
|
+
|
|
279
|
+
<nile-select class="manual-input time-input"
|
|
280
|
+
label="Unit of time"
|
|
281
|
+
value="${ this.selectedUnit }"
|
|
282
|
+
@nile-change="${this.handleUnitChange}"
|
|
283
|
+
>
|
|
284
|
+
<nile-option value="minutes" class="${this.hideDurationFields?.includes('minutes')?'hidden':''}">Minutes</nile-option>
|
|
285
|
+
<nile-option value="hours" class="${this.hideDurationFields?.includes('hours')?'hidden':''}"> Hours </nile-option>
|
|
286
|
+
<nile-option value="days" class="${this.hideDurationFields?.includes('days')?'hidden':''}">Days</nile-option>
|
|
287
|
+
<nile-option value="weeks" class="${this.hideDurationFields?.includes('weeks')?'hidden':''}">Weeks</nile-option>
|
|
288
|
+
<nile-option value="months" class="${this.hideDurationFields?.includes('months')?'hidden':''}"> Months </nile-option>
|
|
289
|
+
</nile-select>
|
|
290
|
+
</div>
|
|
291
|
+
</div>
|
|
292
|
+
`:''}
|
|
293
|
+
`
|
|
451
294
|
}
|
|
452
295
|
|
|
453
|
-
|
|
454
296
|
/**
|
|
455
297
|
*
|
|
456
298
|
* @param unit
|
|
@@ -464,7 +306,6 @@ private handleEndDateInput(event: CustomEvent): void {
|
|
|
464
306
|
<div
|
|
465
307
|
class="duration__value ${this.selectedUnit === unit && this.selectedValue === value ? 'duration__value--selected':''}"
|
|
466
308
|
@click=${(e: any) => this.handleTimeValueClick(unit, value, e)}
|
|
467
|
-
@keydown="${(e: KeyboardEvent) => {if (e.key === 'Enter' || e.key === ' ') this.handleTimeValueClick(unit, value, e);}}"
|
|
468
309
|
>${value}
|
|
469
310
|
</div>`
|
|
470
311
|
);
|
|
@@ -559,103 +400,32 @@ private handleEndDateInput(event: CustomEvent): void {
|
|
|
559
400
|
name="var(--nile-icon-arrow-left, var(--ng-icon-chevron-left))"
|
|
560
401
|
method="var(--nile-svg-method-fill, var(--ng-svg-method-stroke))"
|
|
561
402
|
color="black"
|
|
562
|
-
role="button"
|
|
563
|
-
tabindex="${this.isPrevDisabled() ? '-1' : '0'}"
|
|
564
|
-
@keydown="${(e: KeyboardEvent) => {if (e.key === 'Enter' || e.key === ' ') this.prevMonth();}}"
|
|
565
403
|
@click="${this.prevMonth}"
|
|
566
404
|
>
|
|
567
405
|
</nile-icon>
|
|
568
|
-
<
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
slot="trigger"
|
|
575
|
-
class="calendar-header__trigger month-trigger"
|
|
576
|
-
role="button"
|
|
577
|
-
>
|
|
578
|
-
${new Date(year, month).toLocaleString('default', { month: 'long' })}
|
|
579
|
-
<nile-icon name="arrowdropdown" color="black" class="calendar-header__caret"></nile-icon>
|
|
580
|
-
</span>
|
|
581
|
-
<nile-menu>
|
|
582
|
-
<div class="month-scroll-wrapper">
|
|
583
|
-
${this.monthNames.map((m, idx) => html`
|
|
584
|
-
<nile-menu-item
|
|
585
|
-
class="month-menu-item"
|
|
586
|
-
?selected="${idx === month}"
|
|
587
|
-
@click="${() => this.onMonthSelected(idx)}"
|
|
588
|
-
>
|
|
589
|
-
${m}
|
|
590
|
-
</nile-menu-item>
|
|
591
|
-
`)}
|
|
592
|
-
</div>
|
|
593
|
-
</nile-menu>
|
|
594
|
-
</nile-dropdown>
|
|
595
|
-
` : html`
|
|
596
|
-
<span
|
|
597
|
-
>${new Date(year, month).toLocaleString('default', { month: 'long' })}</span
|
|
598
|
-
>
|
|
599
|
-
`}
|
|
600
|
-
${this.showYearDropdown ? html`
|
|
601
|
-
<nile-dropdown class="year-dropdown">
|
|
602
|
-
<span
|
|
603
|
-
slot="trigger"
|
|
604
|
-
class="calendar-header__trigger"
|
|
605
|
-
role="button"
|
|
606
|
-
>
|
|
607
|
-
${year}
|
|
608
|
-
<nile-icon name="arrowdropdown" color="black" class="calendar-header__caret"></nile-icon>
|
|
609
|
-
</span>
|
|
610
|
-
<nile-menu>
|
|
611
|
-
<div class="year-scroll-wrapper">
|
|
612
|
-
${this.yearOptions.map(
|
|
613
|
-
y => html`
|
|
614
|
-
<nile-menu-item
|
|
615
|
-
class="year-menu-item"
|
|
616
|
-
?selected="${y === year}"
|
|
617
|
-
@click="${() => this.onYearSelected(y)}"
|
|
618
|
-
>
|
|
619
|
-
${y}
|
|
620
|
-
</nile-menu-item>
|
|
621
|
-
`
|
|
622
|
-
)}
|
|
623
|
-
</div>
|
|
624
|
-
</nile-menu>
|
|
625
|
-
</nile-dropdown>
|
|
626
|
-
` : html`
|
|
627
|
-
<span>${year}</span>
|
|
628
|
-
`}
|
|
629
|
-
` : html`
|
|
630
|
-
<span
|
|
631
|
-
>${new Date(year, month).toLocaleString('default', {
|
|
632
|
-
month: 'long',
|
|
633
|
-
})}
|
|
634
|
-
${year}</span
|
|
635
|
-
>
|
|
636
|
-
`}
|
|
637
|
-
</div>
|
|
638
|
-
|
|
406
|
+
<span
|
|
407
|
+
>${new Date(year, month).toLocaleString('default', {
|
|
408
|
+
month: 'long',
|
|
409
|
+
})}
|
|
410
|
+
${year}</span
|
|
411
|
+
>
|
|
639
412
|
<nile-icon
|
|
640
413
|
class="calendar-header__month-navigation"
|
|
641
414
|
name="var(--nile-icon-arrow-right, var(--ng-icon-chevron-right))"
|
|
642
415
|
method="var(--nile-svg-method-fill, var(--ng-svg-method-stroke))"
|
|
643
416
|
color="black"
|
|
644
|
-
role="button"
|
|
645
|
-
tabindex="${this.isNextDisabled() ? '-1' : '0'}"
|
|
646
|
-
@keydown="${(e: KeyboardEvent) => {if (e.key === 'Enter' || e.key === ' ') this.nextMonth();}}"
|
|
647
417
|
@click="${this.nextMonth}"
|
|
648
418
|
>
|
|
649
419
|
</nile-icon>
|
|
650
420
|
</div>
|
|
651
421
|
<div class="days_container">
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
<div class="day_name">
|
|
655
|
-
<div class="day_name">
|
|
656
|
-
<div class="day_name">
|
|
657
|
-
<div class="day_name">
|
|
658
|
-
<div class="day_name">
|
|
422
|
+
<div class="day_name">Su</div>
|
|
423
|
+
<div class="day_name">Mo</div>
|
|
424
|
+
<div class="day_name">Tu</div>
|
|
425
|
+
<div class="day_name">We</div>
|
|
426
|
+
<div class="day_name">Th</div>
|
|
427
|
+
<div class="day_name">Fr</div>
|
|
428
|
+
<div class="day_name">Sa</div>
|
|
659
429
|
|
|
660
430
|
${allDays.map((day, index) => {
|
|
661
431
|
const isCurrentMonth =
|
|
@@ -672,15 +442,12 @@ ${this.showMonthDropdown || this.showYearDropdown ? html`
|
|
|
672
442
|
|
|
673
443
|
return html`
|
|
674
444
|
<div
|
|
675
|
-
part="calendar-day-${day}"
|
|
676
445
|
class=${classMap(classMapObj)}
|
|
677
|
-
tabindex="${isCurrentMonth && this.isAllowedDate(day, month, year) ? '0' : '-1'}"
|
|
678
|
-
@keydown="${(e: KeyboardEvent) => {if (e.key === 'Enter' || e.key === ' ') this.selectDate(day, month, year);}}"
|
|
679
446
|
@click="${() => { if (isCurrentMonth) this.selectDate(day, month, year)}}"
|
|
680
447
|
>
|
|
681
448
|
<span style="position:relative;">
|
|
682
449
|
${day}
|
|
683
|
-
${isCurrentDate(day, month, year) && isCurrentMonth?html`<div class="current__date__dot"
|
|
450
|
+
${isCurrentDate(day, month, year) && isCurrentMonth?html`<div class="current__date__dot"></div>`:nothing}
|
|
684
451
|
</span>
|
|
685
452
|
</div>`;
|
|
686
453
|
})}
|
|
@@ -708,25 +475,17 @@ ${this.showMonthDropdown || this.showYearDropdown ? html`
|
|
|
708
475
|
return isWithinRange;
|
|
709
476
|
}
|
|
710
477
|
|
|
711
|
-
clearDate()
|
|
712
|
-
if
|
|
713
|
-
this.valueAttribute
|
|
714
|
-
this.startDate
|
|
715
|
-
this.endDate
|
|
716
|
-
this.selectedUnit = undefined!;
|
|
717
|
-
this.selectedValue = undefined!;
|
|
718
|
-
if (this.range && this.type === 'relative') {
|
|
719
|
-
this.selectedUnit = undefined!;
|
|
720
|
-
this.selectedValue = undefined!;
|
|
721
|
-
}
|
|
722
|
-
} else {
|
|
723
|
-
this.value = null;
|
|
478
|
+
clearDate(){
|
|
479
|
+
if(this.range){
|
|
480
|
+
this.valueAttribute='';
|
|
481
|
+
this.startDate=null;
|
|
482
|
+
this.endDate=null;
|
|
724
483
|
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
484
|
+
else{
|
|
485
|
+
this.value=null;
|
|
486
|
+
}
|
|
487
|
+
this.emit('nile-clear')
|
|
728
488
|
}
|
|
729
|
-
|
|
730
489
|
|
|
731
490
|
/**
|
|
732
491
|
* @function handle_date-click/select
|
|
@@ -750,15 +509,6 @@ ${this.showMonthDropdown || this.showYearDropdown ? html`
|
|
|
750
509
|
}
|
|
751
510
|
this.isSelectingStart = false;
|
|
752
511
|
} else {
|
|
753
|
-
if (
|
|
754
|
-
this.startDate &&
|
|
755
|
-
selectedDate.getFullYear() === this.startDate.getFullYear() &&
|
|
756
|
-
selectedDate.getMonth() === this.startDate.getMonth() &&
|
|
757
|
-
selectedDate.getDate() === this.startDate.getDate()
|
|
758
|
-
) {
|
|
759
|
-
return;
|
|
760
|
-
}
|
|
761
|
-
|
|
762
512
|
this.isSelectingStart = true;
|
|
763
513
|
|
|
764
514
|
if (this.startDate && selectedDate < this.startDate) {
|
|
@@ -938,10 +688,8 @@ ${this.showMonthDropdown || this.showYearDropdown ? html`
|
|
|
938
688
|
|
|
939
689
|
private nextMonth(): void {
|
|
940
690
|
if (this.currentMonth === 11) {
|
|
941
|
-
const newYear = this.currentYear + 1;
|
|
942
|
-
if(this.endYear !== undefined && newYear > this.endYear) return;
|
|
943
691
|
this.currentMonth = 0;
|
|
944
|
-
this.currentYear
|
|
692
|
+
this.currentYear++;
|
|
945
693
|
} else {
|
|
946
694
|
this.currentMonth++;
|
|
947
695
|
}
|
|
@@ -949,10 +697,8 @@ ${this.showMonthDropdown || this.showYearDropdown ? html`
|
|
|
949
697
|
|
|
950
698
|
private prevMonth(): void {
|
|
951
699
|
if (this.currentMonth === 0) {
|
|
952
|
-
const newYear = this.currentYear - 1;
|
|
953
|
-
if(this.startYear !== undefined && newYear < this.startYear) return;
|
|
954
700
|
this.currentMonth = 11;
|
|
955
|
-
this.currentYear
|
|
701
|
+
this.currentYear--;
|
|
956
702
|
} else {
|
|
957
703
|
this.currentMonth--;
|
|
958
704
|
}
|
|
@@ -981,7 +727,7 @@ ${this.showMonthDropdown || this.showYearDropdown ? html`
|
|
|
981
727
|
}
|
|
982
728
|
|
|
983
729
|
emitChangedData(data:{startDate:Date,endDate:Date}|{value:any}|null){
|
|
984
|
-
this.emit('nile-changed',data);
|
|
730
|
+
this.emit('nile-changed',data);
|
|
985
731
|
this.emit('nile-change',data)
|
|
986
732
|
}
|
|
987
733
|
|