@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
|
@@ -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,54 +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
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
></nile-input>
|
|
256
|
-
</div>
|
|
257
|
-
|
|
258
|
-
<div class="from-time">
|
|
259
|
-
<nile-input
|
|
260
|
-
class="manual-input time-input"
|
|
261
|
-
placeholder="HH:MM:SS"
|
|
262
|
-
value="${this.formatTime(this.startDate)}"
|
|
263
|
-
@nile-change="${this.handleStartTimeInput}"
|
|
264
|
-
></nile-input>
|
|
265
|
-
</div>
|
|
266
|
-
</div>
|
|
267
|
-
|
|
155
|
+
<div class="from">
|
|
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>
|
|
268
163
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
></nile-input>
|
|
278
|
-
</div>
|
|
279
|
-
<div class="from-time">
|
|
280
|
-
<nile-input
|
|
281
|
-
class="manual-input time-input"
|
|
282
|
-
placeholder="HH:MM:SS"
|
|
283
|
-
value="${this.formatTime(this.endDate)}"
|
|
284
|
-
@nile-change="${this.handleEndTimeInput}"
|
|
285
|
-
></nile-input>
|
|
286
|
-
</div>
|
|
287
|
-
</div>
|
|
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>
|
|
288
172
|
</div>
|
|
289
173
|
` : ''}
|
|
290
174
|
`;
|
|
@@ -294,84 +178,72 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
|
294
178
|
*/
|
|
295
179
|
renderRelativeCalendar() {
|
|
296
180
|
return html `
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
<div class="duration-units">
|
|
304
|
-
${this.renderTimeValues('minutes', [1, 5, 15, 30, 45])}
|
|
305
|
-
</div>
|
|
306
|
-
</div>
|
|
307
|
-
`}
|
|
308
|
-
|
|
309
|
-
${this.hideDurationFields?.includes('hours') ? '' : html `
|
|
310
|
-
<div class="unit-group">
|
|
311
|
-
<div class="duration-name">Hours</div>
|
|
312
|
-
<div class="duration-units">
|
|
313
|
-
${this.renderTimeValues('hours', [1, 2, 3, 6, 8, 12])}
|
|
314
|
-
</div>
|
|
315
|
-
</div>
|
|
316
|
-
`}
|
|
317
|
-
|
|
318
|
-
${this.hideDurationFields?.includes('days') ? '' : html `
|
|
319
|
-
<div class="unit-group">
|
|
320
|
-
<div class="duration-name">Days</div>
|
|
321
|
-
<div class="duration-units">
|
|
322
|
-
${this.renderTimeValues('days', [1, 2, 3, 4, 5, 6])}
|
|
323
|
-
</div>
|
|
324
|
-
</div>
|
|
325
|
-
`}
|
|
326
|
-
|
|
327
|
-
${this.hideDurationFields?.includes('weeks') ? '' : html `
|
|
328
|
-
<div class="unit-group">
|
|
329
|
-
<div class="duration-name">Weeks</div>
|
|
330
|
-
<div class="duration-units">
|
|
331
|
-
${this.renderTimeValues('weeks', [1, 2, 4, 6])}
|
|
332
|
-
</div>
|
|
333
|
-
</div>
|
|
334
|
-
`}
|
|
335
|
-
|
|
336
|
-
${this.hideDurationFields?.includes('months') ? '' : html `
|
|
337
|
-
<div class="unit-group">
|
|
338
|
-
<div class="duration-name">Months</div>
|
|
339
|
-
<div class="duration-units">
|
|
340
|
-
${this.renderTimeValues('months', [3, 6, 12, 15])}
|
|
341
|
-
</div>
|
|
342
|
-
</div>
|
|
343
|
-
`}
|
|
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])}
|
|
344
187
|
</div>
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
<div class="
|
|
350
|
-
|
|
351
|
-
class="manual-input duration-input"
|
|
352
|
-
label="Duration"
|
|
353
|
-
inputmode="numeric"
|
|
354
|
-
type="number"
|
|
355
|
-
value="${this.selectedValue}"
|
|
356
|
-
@nile-change="${this.handleDurationChange}"
|
|
357
|
-
placeholder="Enter Value"
|
|
358
|
-
></nile-input>
|
|
359
|
-
|
|
360
|
-
<nile-select
|
|
361
|
-
class="manual-input time-input"
|
|
362
|
-
label="Unit of time"
|
|
363
|
-
value="${this.selectedUnit}"
|
|
364
|
-
@nile-change="${this.handleUnitChange}"
|
|
365
|
-
>
|
|
366
|
-
<nile-option value="minutes" class="${this.hideDurationFields?.includes('minutes') ? 'hidden' : ''}">Minutes</nile-option>
|
|
367
|
-
<nile-option value="hours" class="${this.hideDurationFields?.includes('hours') ? 'hidden' : ''}">Hours</nile-option>
|
|
368
|
-
<nile-option value="days" class="${this.hideDurationFields?.includes('days') ? 'hidden' : ''}">Days</nile-option>
|
|
369
|
-
<nile-option value="weeks" class="${this.hideDurationFields?.includes('weeks') ? 'hidden' : ''}">Weeks</nile-option>
|
|
370
|
-
<nile-option value="months" class="${this.hideDurationFields?.includes('months') ? 'hidden' : ''}">Months</nile-option>
|
|
371
|
-
</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])}
|
|
372
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
|
+
`}
|
|
373
217
|
</div>
|
|
374
|
-
|
|
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
|
+
` : ''}
|
|
375
247
|
`;
|
|
376
248
|
}
|
|
377
249
|
/**
|
|
@@ -385,8 +257,6 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
|
385
257
|
<div
|
|
386
258
|
class="duration__value ${this.selectedUnit === unit && this.selectedValue === value ? 'duration__value--selected' : ''}"
|
|
387
259
|
@click=${(e) => this.handleTimeValueClick(unit, value, e)}
|
|
388
|
-
@keydown="${(e) => { if (e.key === 'Enter' || e.key === ' ')
|
|
389
|
-
this.handleTimeValueClick(unit, value, e); }}"
|
|
390
260
|
>${value}
|
|
391
261
|
</div>`);
|
|
392
262
|
}
|
|
@@ -448,103 +318,32 @@ let NileCalendar = class NileCalendar extends NileElement {
|
|
|
448
318
|
name="var(--nile-icon-arrow-left, var(--ng-icon-chevron-left))"
|
|
449
319
|
method="var(--nile-svg-method-fill, var(--ng-svg-method-stroke))"
|
|
450
320
|
color="black"
|
|
451
|
-
role="button"
|
|
452
|
-
tabindex="${this.isPrevDisabled() ? '-1' : '0'}"
|
|
453
|
-
@keydown="${(e) => { if (e.key === 'Enter' || e.key === ' ')
|
|
454
|
-
this.prevMonth(); }}"
|
|
455
321
|
@click="${this.prevMonth}"
|
|
456
322
|
>
|
|
457
323
|
</nile-icon>
|
|
458
|
-
<
|
|
459
|
-
|
|
460
|
-
${this.showMonthDropdown || this.showYearDropdown ? html `
|
|
461
|
-
${this.showMonthDropdown ? html `
|
|
462
|
-
<nile-dropdown class="month-dropdown">
|
|
463
|
-
<span
|
|
464
|
-
slot="trigger"
|
|
465
|
-
class="calendar-header__trigger month-trigger"
|
|
466
|
-
role="button"
|
|
467
|
-
>
|
|
468
|
-
${new Date(year, month).toLocaleString('default', { month: 'long' })}
|
|
469
|
-
<nile-icon name="arrowdropdown" color="black" class="calendar-header__caret"></nile-icon>
|
|
470
|
-
</span>
|
|
471
|
-
<nile-menu>
|
|
472
|
-
<div class="month-scroll-wrapper">
|
|
473
|
-
${this.monthNames.map((m, idx) => html `
|
|
474
|
-
<nile-menu-item
|
|
475
|
-
class="month-menu-item"
|
|
476
|
-
?selected="${idx === month}"
|
|
477
|
-
@click="${() => this.onMonthSelected(idx)}"
|
|
478
|
-
>
|
|
479
|
-
${m}
|
|
480
|
-
</nile-menu-item>
|
|
481
|
-
`)}
|
|
482
|
-
</div>
|
|
483
|
-
</nile-menu>
|
|
484
|
-
</nile-dropdown>
|
|
485
|
-
` : html `
|
|
486
|
-
<span
|
|
487
|
-
>${new Date(year, month).toLocaleString('default', { month: 'long' })}</span
|
|
488
|
-
>
|
|
489
|
-
`}
|
|
490
|
-
${this.showYearDropdown ? html `
|
|
491
|
-
<nile-dropdown class="year-dropdown">
|
|
492
|
-
<span
|
|
493
|
-
slot="trigger"
|
|
494
|
-
class="calendar-header__trigger"
|
|
495
|
-
role="button"
|
|
496
|
-
>
|
|
497
|
-
${year}
|
|
498
|
-
<nile-icon name="arrowdropdown" color="black" class="calendar-header__caret"></nile-icon>
|
|
499
|
-
</span>
|
|
500
|
-
<nile-menu>
|
|
501
|
-
<div class="year-scroll-wrapper">
|
|
502
|
-
${this.yearOptions.map(y => html `
|
|
503
|
-
<nile-menu-item
|
|
504
|
-
class="year-menu-item"
|
|
505
|
-
?selected="${y === year}"
|
|
506
|
-
@click="${() => this.onYearSelected(y)}"
|
|
507
|
-
>
|
|
508
|
-
${y}
|
|
509
|
-
</nile-menu-item>
|
|
510
|
-
`)}
|
|
511
|
-
</div>
|
|
512
|
-
</nile-menu>
|
|
513
|
-
</nile-dropdown>
|
|
514
|
-
` : html `
|
|
515
|
-
<span>${year}</span>
|
|
516
|
-
`}
|
|
517
|
-
` : html `
|
|
518
|
-
<span
|
|
519
|
-
>${new Date(year, month).toLocaleString('default', {
|
|
324
|
+
<span
|
|
325
|
+
>${new Date(year, month).toLocaleString('default', {
|
|
520
326
|
month: 'long',
|
|
521
327
|
})}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
`}
|
|
525
|
-
</div>
|
|
526
|
-
|
|
328
|
+
${year}</span
|
|
329
|
+
>
|
|
527
330
|
<nile-icon
|
|
528
331
|
class="calendar-header__month-navigation"
|
|
529
332
|
name="var(--nile-icon-arrow-right, var(--ng-icon-chevron-right))"
|
|
530
333
|
method="var(--nile-svg-method-fill, var(--ng-svg-method-stroke))"
|
|
531
334
|
color="black"
|
|
532
|
-
role="button"
|
|
533
|
-
tabindex="${this.isNextDisabled() ? '-1' : '0'}"
|
|
534
|
-
@keydown="${(e) => { if (e.key === 'Enter' || e.key === ' ')
|
|
535
|
-
this.nextMonth(); }}"
|
|
536
335
|
@click="${this.nextMonth}"
|
|
537
336
|
>
|
|
538
337
|
</nile-icon>
|
|
539
338
|
</div>
|
|
540
339
|
<div class="days_container">
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
<div class="day_name">
|
|
544
|
-
<div class="day_name">
|
|
545
|
-
<div class="day_name">
|
|
546
|
-
<div class="day_name">
|
|
547
|
-
<div class="day_name">
|
|
340
|
+
<div class="day_name">Su</div>
|
|
341
|
+
<div class="day_name">Mo</div>
|
|
342
|
+
<div class="day_name">Tu</div>
|
|
343
|
+
<div class="day_name">We</div>
|
|
344
|
+
<div class="day_name">Th</div>
|
|
345
|
+
<div class="day_name">Fr</div>
|
|
346
|
+
<div class="day_name">Sa</div>
|
|
548
347
|
|
|
549
348
|
${allDays.map((day, index) => {
|
|
550
349
|
const isCurrentMonth = index >= fillerDaysBefore.length &&
|
|
@@ -560,17 +359,13 @@ ${this.showMonthDropdown || this.showYearDropdown ? html `
|
|
|
560
359
|
classMapObj[datePlacement] = true;
|
|
561
360
|
return html `
|
|
562
361
|
<div
|
|
563
|
-
part="calendar-day-${day}"
|
|
564
362
|
class=${classMap(classMapObj)}
|
|
565
|
-
tabindex="${isCurrentMonth && this.isAllowedDate(day, month, year) ? '0' : '-1'}"
|
|
566
|
-
@keydown="${(e) => { if (e.key === 'Enter' || e.key === ' ')
|
|
567
|
-
this.selectDate(day, month, year); }}"
|
|
568
363
|
@click="${() => { if (isCurrentMonth)
|
|
569
364
|
this.selectDate(day, month, year); }}"
|
|
570
365
|
>
|
|
571
366
|
<span style="position:relative;">
|
|
572
367
|
${day}
|
|
573
|
-
${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}
|
|
574
369
|
</span>
|
|
575
370
|
</div>`;
|
|
576
371
|
})}
|
|
@@ -601,17 +396,10 @@ ${this.showMonthDropdown || this.showYearDropdown ? html `
|
|
|
601
396
|
this.valueAttribute = '';
|
|
602
397
|
this.startDate = null;
|
|
603
398
|
this.endDate = null;
|
|
604
|
-
this.selectedUnit = undefined;
|
|
605
|
-
this.selectedValue = undefined;
|
|
606
|
-
if (this.range && this.type === 'relative') {
|
|
607
|
-
this.selectedUnit = undefined;
|
|
608
|
-
this.selectedValue = undefined;
|
|
609
|
-
}
|
|
610
399
|
}
|
|
611
400
|
else {
|
|
612
401
|
this.value = null;
|
|
613
402
|
}
|
|
614
|
-
this.requestUpdate();
|
|
615
403
|
this.emit('nile-clear');
|
|
616
404
|
}
|
|
617
405
|
/**
|
|
@@ -635,12 +423,6 @@ ${this.showMonthDropdown || this.showYearDropdown ? html `
|
|
|
635
423
|
this.isSelectingStart = false;
|
|
636
424
|
}
|
|
637
425
|
else {
|
|
638
|
-
if (this.startDate &&
|
|
639
|
-
selectedDate.getFullYear() === this.startDate.getFullYear() &&
|
|
640
|
-
selectedDate.getMonth() === this.startDate.getMonth() &&
|
|
641
|
-
selectedDate.getDate() === this.startDate.getDate()) {
|
|
642
|
-
return;
|
|
643
|
-
}
|
|
644
426
|
this.isSelectingStart = true;
|
|
645
427
|
if (this.startDate && selectedDate < this.startDate) {
|
|
646
428
|
this.startDate = selectedDate;
|
|
@@ -809,11 +591,8 @@ ${this.showMonthDropdown || this.showYearDropdown ? html `
|
|
|
809
591
|
}
|
|
810
592
|
nextMonth() {
|
|
811
593
|
if (this.currentMonth === 11) {
|
|
812
|
-
const newYear = this.currentYear + 1;
|
|
813
|
-
if (this.endYear !== undefined && newYear > this.endYear)
|
|
814
|
-
return;
|
|
815
594
|
this.currentMonth = 0;
|
|
816
|
-
this.currentYear
|
|
595
|
+
this.currentYear++;
|
|
817
596
|
}
|
|
818
597
|
else {
|
|
819
598
|
this.currentMonth++;
|
|
@@ -821,11 +600,8 @@ ${this.showMonthDropdown || this.showYearDropdown ? html `
|
|
|
821
600
|
}
|
|
822
601
|
prevMonth() {
|
|
823
602
|
if (this.currentMonth === 0) {
|
|
824
|
-
const newYear = this.currentYear - 1;
|
|
825
|
-
if (this.startYear !== undefined && newYear < this.startYear)
|
|
826
|
-
return;
|
|
827
603
|
this.currentMonth = 11;
|
|
828
|
-
this.currentYear
|
|
604
|
+
this.currentYear--;
|
|
829
605
|
}
|
|
830
606
|
else {
|
|
831
607
|
this.currentMonth--;
|
|
@@ -847,7 +623,7 @@ ${this.showMonthDropdown || this.showYearDropdown ? html `
|
|
|
847
623
|
return new Date(Date.UTC(dateStr.slice(0, 4), dateStr.slice(5, 7) - 1, dateStr.slice(8, 10)));
|
|
848
624
|
}
|
|
849
625
|
emitChangedData(data) {
|
|
850
|
-
this.emit('nile-changed', data);
|
|
626
|
+
this.emit('nile-changed', data);
|
|
851
627
|
this.emit('nile-change', data);
|
|
852
628
|
}
|
|
853
629
|
getDaysArray(year, month) {
|
|
@@ -888,21 +664,6 @@ __decorate([
|
|
|
888
664
|
__decorate([
|
|
889
665
|
property({ type: Boolean })
|
|
890
666
|
], NileCalendar.prototype, "showManualInputs", void 0);
|
|
891
|
-
__decorate([
|
|
892
|
-
property({ type: Number, attribute: true, reflect: true })
|
|
893
|
-
], NileCalendar.prototype, "startYear", void 0);
|
|
894
|
-
__decorate([
|
|
895
|
-
property({ type: Number, attribute: true, reflect: true })
|
|
896
|
-
], NileCalendar.prototype, "endYear", void 0);
|
|
897
|
-
__decorate([
|
|
898
|
-
property({ type: Boolean, attribute: true, reflect: true })
|
|
899
|
-
], NileCalendar.prototype, "showMonthDropdown", void 0);
|
|
900
|
-
__decorate([
|
|
901
|
-
property({ type: Boolean, attribute: true, reflect: true })
|
|
902
|
-
], NileCalendar.prototype, "showYearDropdown", void 0);
|
|
903
|
-
__decorate([
|
|
904
|
-
property({ type: String, reflect: true, attribute: true })
|
|
905
|
-
], NileCalendar.prototype, "dateFormat", void 0);
|
|
906
667
|
__decorate([
|
|
907
668
|
state()
|
|
908
669
|
], NileCalendar.prototype, "startDate", void 0);
|