@idds/js 1.0.40 → 1.0.42
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/dist/index.iife.js +27 -37
- package/dist/index.js +27 -37
- package/package.json +1 -1
package/dist/index.iife.js
CHANGED
|
@@ -179,9 +179,9 @@ var InaUI = (() => {
|
|
|
179
179
|
function formatDate(date) {
|
|
180
180
|
if (!date) return "";
|
|
181
181
|
const day = date.getDate().toString().padStart(2, "0");
|
|
182
|
-
const
|
|
182
|
+
const month = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
183
183
|
const year = date.getFullYear();
|
|
184
|
-
return `${day}
|
|
184
|
+
return `${day}/${month}/${year}`;
|
|
185
185
|
}
|
|
186
186
|
function updateTrigger() {
|
|
187
187
|
if (mode === "single") {
|
|
@@ -264,7 +264,6 @@ var InaUI = (() => {
|
|
|
264
264
|
btn.classList.add("ina-month-picker__month-option--selected");
|
|
265
265
|
btn.textContent = m;
|
|
266
266
|
btn.addEventListener("click", (e) => {
|
|
267
|
-
e.stopPropagation();
|
|
268
267
|
currentMonthIdx = idx;
|
|
269
268
|
updateText();
|
|
270
269
|
togglePicker(false);
|
|
@@ -275,7 +274,6 @@ var InaUI = (() => {
|
|
|
275
274
|
pickerPanel.appendChild(grid);
|
|
276
275
|
container.append(pickerTrigger, pickerPanel);
|
|
277
276
|
pickerTrigger.addEventListener("click", (e) => {
|
|
278
|
-
e.stopPropagation();
|
|
279
277
|
togglePicker(!isPickerOpen);
|
|
280
278
|
});
|
|
281
279
|
function togglePicker(show) {
|
|
@@ -321,7 +319,6 @@ var InaUI = (() => {
|
|
|
321
319
|
prevBtn.className = "ina-year-picker__nav-button";
|
|
322
320
|
prevBtn.innerHTML = createIcon("chevron-left");
|
|
323
321
|
prevBtn.onclick = (e) => {
|
|
324
|
-
e.stopPropagation();
|
|
325
322
|
decadeStart -= 20;
|
|
326
323
|
renderGrid();
|
|
327
324
|
};
|
|
@@ -330,7 +327,6 @@ var InaUI = (() => {
|
|
|
330
327
|
nextBtn.className = "ina-year-picker__nav-button";
|
|
331
328
|
nextBtn.innerHTML = createIcon("chevron-right");
|
|
332
329
|
nextBtn.onclick = (e) => {
|
|
333
|
-
e.stopPropagation();
|
|
334
330
|
decadeStart += 20;
|
|
335
331
|
renderGrid();
|
|
336
332
|
};
|
|
@@ -350,7 +346,6 @@ var InaUI = (() => {
|
|
|
350
346
|
btn.classList.add("ina-year-picker__year-option--selected");
|
|
351
347
|
btn.textContent = y;
|
|
352
348
|
btn.addEventListener("click", (e) => {
|
|
353
|
-
e.stopPropagation();
|
|
354
349
|
currentYearVal = y;
|
|
355
350
|
updateText();
|
|
356
351
|
togglePicker(false);
|
|
@@ -362,7 +357,6 @@ var InaUI = (() => {
|
|
|
362
357
|
pickerPanel.append(header, grid);
|
|
363
358
|
container.append(pickerTrigger, pickerPanel);
|
|
364
359
|
pickerTrigger.addEventListener("click", (e) => {
|
|
365
|
-
e.stopPropagation();
|
|
366
360
|
togglePicker(!isPickerOpen);
|
|
367
361
|
});
|
|
368
362
|
function togglePicker(show) {
|
|
@@ -403,7 +397,6 @@ var InaUI = (() => {
|
|
|
403
397
|
prevBtn.className = "ina-date-picker__nav-button";
|
|
404
398
|
prevBtn.innerHTML = createIcon("chevron-left");
|
|
405
399
|
prevBtn.onclick = (e) => {
|
|
406
|
-
e.stopPropagation();
|
|
407
400
|
viewDate.setMonth(viewDate.getMonth() - 1);
|
|
408
401
|
render();
|
|
409
402
|
};
|
|
@@ -413,31 +406,33 @@ var InaUI = (() => {
|
|
|
413
406
|
spacer.style.width = "32px";
|
|
414
407
|
header.appendChild(spacer);
|
|
415
408
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
409
|
+
const controls = document.createElement("div");
|
|
410
|
+
controls.className = isNextMonth ? "ina-date-picker__next-month-controls" : "ina-date-picker__header-controls";
|
|
411
|
+
controls.className = "ina-date-picker__header-controls";
|
|
412
|
+
const monthCont = document.createElement("div");
|
|
413
|
+
monthCont.className = "ina-date-picker__dropdown-container";
|
|
414
|
+
const monthPicker = createMonthPicker(month, (m) => {
|
|
415
|
+
if (isNextMonth) {
|
|
416
|
+
viewDate = new Date(year, m - 1, 1);
|
|
417
|
+
} else {
|
|
422
418
|
viewDate.setMonth(m);
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
419
|
+
}
|
|
420
|
+
render();
|
|
421
|
+
});
|
|
422
|
+
monthCont.appendChild(monthPicker.element);
|
|
423
|
+
const yearCont = document.createElement("div");
|
|
424
|
+
yearCont.className = "ina-date-picker__dropdown-container";
|
|
425
|
+
const yearPicker = createYearPicker(year, (y) => {
|
|
426
|
+
if (isNextMonth) {
|
|
427
|
+
viewDate = new Date(y, month - 1, 1);
|
|
428
|
+
} else {
|
|
429
429
|
viewDate.setFullYear(y);
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
const title = document.createElement("div");
|
|
437
|
-
title.className = "ina-date-picker__calendar-title";
|
|
438
|
-
title.textContent = `${MONTHS_ID[month]} ${year}`;
|
|
439
|
-
header.appendChild(title);
|
|
440
|
-
}
|
|
430
|
+
}
|
|
431
|
+
render();
|
|
432
|
+
});
|
|
433
|
+
yearCont.appendChild(yearPicker.element);
|
|
434
|
+
controls.append(monthCont, yearCont);
|
|
435
|
+
header.appendChild(controls);
|
|
441
436
|
const showNextBtn = mode === "single" && !isNextMonth || isNextMonth;
|
|
442
437
|
if (showNextBtn) {
|
|
443
438
|
const nextBtn = document.createElement("button");
|
|
@@ -445,7 +440,6 @@ var InaUI = (() => {
|
|
|
445
440
|
nextBtn.className = "ina-date-picker__nav-button";
|
|
446
441
|
nextBtn.innerHTML = createIcon("chevron-right");
|
|
447
442
|
nextBtn.onclick = (e) => {
|
|
448
|
-
e.stopPropagation();
|
|
449
443
|
viewDate.setMonth(viewDate.getMonth() + 1);
|
|
450
444
|
render();
|
|
451
445
|
};
|
|
@@ -503,10 +497,8 @@ var InaUI = (() => {
|
|
|
503
497
|
if (!isSelected && !isInRange)
|
|
504
498
|
btn.classList.add("ina-date-picker__day--hover");
|
|
505
499
|
btn.onclick = (e) => {
|
|
506
|
-
e.stopPropagation();
|
|
507
500
|
if (mode === "single") {
|
|
508
501
|
selectedDate = date;
|
|
509
|
-
close();
|
|
510
502
|
} else if (mode === "multiple") {
|
|
511
503
|
const existsIdx = selectedDates.findIndex(
|
|
512
504
|
(d) => d.toDateString() === date.toDateString()
|
|
@@ -524,7 +516,6 @@ var InaUI = (() => {
|
|
|
524
516
|
} else {
|
|
525
517
|
rangeDate = [start, date];
|
|
526
518
|
}
|
|
527
|
-
close();
|
|
528
519
|
}
|
|
529
520
|
render();
|
|
530
521
|
}
|
|
@@ -581,7 +572,6 @@ var InaUI = (() => {
|
|
|
581
572
|
else open();
|
|
582
573
|
}
|
|
583
574
|
trigger.addEventListener("click", (e) => {
|
|
584
|
-
e.stopPropagation();
|
|
585
575
|
toggle();
|
|
586
576
|
});
|
|
587
577
|
document.addEventListener("click", (e) => {
|
package/dist/index.js
CHANGED
|
@@ -167,9 +167,9 @@ function initDatepicker() {
|
|
|
167
167
|
function formatDate(date) {
|
|
168
168
|
if (!date) return "";
|
|
169
169
|
const day = date.getDate().toString().padStart(2, "0");
|
|
170
|
-
const
|
|
170
|
+
const month = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
171
171
|
const year = date.getFullYear();
|
|
172
|
-
return `${day}
|
|
172
|
+
return `${day}/${month}/${year}`;
|
|
173
173
|
}
|
|
174
174
|
function updateTrigger() {
|
|
175
175
|
if (mode === "single") {
|
|
@@ -252,7 +252,6 @@ function initDatepicker() {
|
|
|
252
252
|
btn.classList.add("ina-month-picker__month-option--selected");
|
|
253
253
|
btn.textContent = m;
|
|
254
254
|
btn.addEventListener("click", (e) => {
|
|
255
|
-
e.stopPropagation();
|
|
256
255
|
currentMonthIdx = idx;
|
|
257
256
|
updateText();
|
|
258
257
|
togglePicker(false);
|
|
@@ -263,7 +262,6 @@ function initDatepicker() {
|
|
|
263
262
|
pickerPanel.appendChild(grid);
|
|
264
263
|
container.append(pickerTrigger, pickerPanel);
|
|
265
264
|
pickerTrigger.addEventListener("click", (e) => {
|
|
266
|
-
e.stopPropagation();
|
|
267
265
|
togglePicker(!isPickerOpen);
|
|
268
266
|
});
|
|
269
267
|
function togglePicker(show) {
|
|
@@ -309,7 +307,6 @@ function initDatepicker() {
|
|
|
309
307
|
prevBtn.className = "ina-year-picker__nav-button";
|
|
310
308
|
prevBtn.innerHTML = createIcon("chevron-left");
|
|
311
309
|
prevBtn.onclick = (e) => {
|
|
312
|
-
e.stopPropagation();
|
|
313
310
|
decadeStart -= 20;
|
|
314
311
|
renderGrid();
|
|
315
312
|
};
|
|
@@ -318,7 +315,6 @@ function initDatepicker() {
|
|
|
318
315
|
nextBtn.className = "ina-year-picker__nav-button";
|
|
319
316
|
nextBtn.innerHTML = createIcon("chevron-right");
|
|
320
317
|
nextBtn.onclick = (e) => {
|
|
321
|
-
e.stopPropagation();
|
|
322
318
|
decadeStart += 20;
|
|
323
319
|
renderGrid();
|
|
324
320
|
};
|
|
@@ -338,7 +334,6 @@ function initDatepicker() {
|
|
|
338
334
|
btn.classList.add("ina-year-picker__year-option--selected");
|
|
339
335
|
btn.textContent = y;
|
|
340
336
|
btn.addEventListener("click", (e) => {
|
|
341
|
-
e.stopPropagation();
|
|
342
337
|
currentYearVal = y;
|
|
343
338
|
updateText();
|
|
344
339
|
togglePicker(false);
|
|
@@ -350,7 +345,6 @@ function initDatepicker() {
|
|
|
350
345
|
pickerPanel.append(header, grid);
|
|
351
346
|
container.append(pickerTrigger, pickerPanel);
|
|
352
347
|
pickerTrigger.addEventListener("click", (e) => {
|
|
353
|
-
e.stopPropagation();
|
|
354
348
|
togglePicker(!isPickerOpen);
|
|
355
349
|
});
|
|
356
350
|
function togglePicker(show) {
|
|
@@ -391,7 +385,6 @@ function initDatepicker() {
|
|
|
391
385
|
prevBtn.className = "ina-date-picker__nav-button";
|
|
392
386
|
prevBtn.innerHTML = createIcon("chevron-left");
|
|
393
387
|
prevBtn.onclick = (e) => {
|
|
394
|
-
e.stopPropagation();
|
|
395
388
|
viewDate.setMonth(viewDate.getMonth() - 1);
|
|
396
389
|
render();
|
|
397
390
|
};
|
|
@@ -401,31 +394,33 @@ function initDatepicker() {
|
|
|
401
394
|
spacer.style.width = "32px";
|
|
402
395
|
header.appendChild(spacer);
|
|
403
396
|
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
397
|
+
const controls = document.createElement("div");
|
|
398
|
+
controls.className = isNextMonth ? "ina-date-picker__next-month-controls" : "ina-date-picker__header-controls";
|
|
399
|
+
controls.className = "ina-date-picker__header-controls";
|
|
400
|
+
const monthCont = document.createElement("div");
|
|
401
|
+
monthCont.className = "ina-date-picker__dropdown-container";
|
|
402
|
+
const monthPicker = createMonthPicker(month, (m) => {
|
|
403
|
+
if (isNextMonth) {
|
|
404
|
+
viewDate = new Date(year, m - 1, 1);
|
|
405
|
+
} else {
|
|
410
406
|
viewDate.setMonth(m);
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
407
|
+
}
|
|
408
|
+
render();
|
|
409
|
+
});
|
|
410
|
+
monthCont.appendChild(monthPicker.element);
|
|
411
|
+
const yearCont = document.createElement("div");
|
|
412
|
+
yearCont.className = "ina-date-picker__dropdown-container";
|
|
413
|
+
const yearPicker = createYearPicker(year, (y) => {
|
|
414
|
+
if (isNextMonth) {
|
|
415
|
+
viewDate = new Date(y, month - 1, 1);
|
|
416
|
+
} else {
|
|
417
417
|
viewDate.setFullYear(y);
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
const title = document.createElement("div");
|
|
425
|
-
title.className = "ina-date-picker__calendar-title";
|
|
426
|
-
title.textContent = `${MONTHS_ID[month]} ${year}`;
|
|
427
|
-
header.appendChild(title);
|
|
428
|
-
}
|
|
418
|
+
}
|
|
419
|
+
render();
|
|
420
|
+
});
|
|
421
|
+
yearCont.appendChild(yearPicker.element);
|
|
422
|
+
controls.append(monthCont, yearCont);
|
|
423
|
+
header.appendChild(controls);
|
|
429
424
|
const showNextBtn = mode === "single" && !isNextMonth || isNextMonth;
|
|
430
425
|
if (showNextBtn) {
|
|
431
426
|
const nextBtn = document.createElement("button");
|
|
@@ -433,7 +428,6 @@ function initDatepicker() {
|
|
|
433
428
|
nextBtn.className = "ina-date-picker__nav-button";
|
|
434
429
|
nextBtn.innerHTML = createIcon("chevron-right");
|
|
435
430
|
nextBtn.onclick = (e) => {
|
|
436
|
-
e.stopPropagation();
|
|
437
431
|
viewDate.setMonth(viewDate.getMonth() + 1);
|
|
438
432
|
render();
|
|
439
433
|
};
|
|
@@ -491,10 +485,8 @@ function initDatepicker() {
|
|
|
491
485
|
if (!isSelected && !isInRange)
|
|
492
486
|
btn.classList.add("ina-date-picker__day--hover");
|
|
493
487
|
btn.onclick = (e) => {
|
|
494
|
-
e.stopPropagation();
|
|
495
488
|
if (mode === "single") {
|
|
496
489
|
selectedDate = date;
|
|
497
|
-
close();
|
|
498
490
|
} else if (mode === "multiple") {
|
|
499
491
|
const existsIdx = selectedDates.findIndex(
|
|
500
492
|
(d) => d.toDateString() === date.toDateString()
|
|
@@ -512,7 +504,6 @@ function initDatepicker() {
|
|
|
512
504
|
} else {
|
|
513
505
|
rangeDate = [start, date];
|
|
514
506
|
}
|
|
515
|
-
close();
|
|
516
507
|
}
|
|
517
508
|
render();
|
|
518
509
|
}
|
|
@@ -569,7 +560,6 @@ function initDatepicker() {
|
|
|
569
560
|
else open();
|
|
570
561
|
}
|
|
571
562
|
trigger.addEventListener("click", (e) => {
|
|
572
|
-
e.stopPropagation();
|
|
573
563
|
toggle();
|
|
574
564
|
});
|
|
575
565
|
document.addEventListener("click", (e) => {
|