@idds/js 1.0.39 → 1.0.41
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 +32 -33
- package/dist/index.js +32 -33
- package/package.json +1 -1
package/dist/index.iife.js
CHANGED
|
@@ -133,7 +133,14 @@ var InaUI = (() => {
|
|
|
133
133
|
if (!panelContent) {
|
|
134
134
|
panelContent = document.createElement("div");
|
|
135
135
|
panelContent.className = "ina-date-picker__panel-content";
|
|
136
|
+
if (mode === "range" || mode === "multiple") {
|
|
137
|
+
panelContent.classList.add("ina-date-picker__panel-content--dual");
|
|
138
|
+
}
|
|
136
139
|
panel.appendChild(panelContent);
|
|
140
|
+
} else {
|
|
141
|
+
if (mode === "range" || mode === "multiple") {
|
|
142
|
+
panelContent.classList.add("ina-date-picker__panel-content--dual");
|
|
143
|
+
}
|
|
137
144
|
}
|
|
138
145
|
let viewDate = /* @__PURE__ */ new Date();
|
|
139
146
|
let selectedDate = null;
|
|
@@ -257,7 +264,6 @@ var InaUI = (() => {
|
|
|
257
264
|
btn.classList.add("ina-month-picker__month-option--selected");
|
|
258
265
|
btn.textContent = m;
|
|
259
266
|
btn.addEventListener("click", (e) => {
|
|
260
|
-
e.stopPropagation();
|
|
261
267
|
currentMonthIdx = idx;
|
|
262
268
|
updateText();
|
|
263
269
|
togglePicker(false);
|
|
@@ -268,7 +274,6 @@ var InaUI = (() => {
|
|
|
268
274
|
pickerPanel.appendChild(grid);
|
|
269
275
|
container.append(pickerTrigger, pickerPanel);
|
|
270
276
|
pickerTrigger.addEventListener("click", (e) => {
|
|
271
|
-
e.stopPropagation();
|
|
272
277
|
togglePicker(!isPickerOpen);
|
|
273
278
|
});
|
|
274
279
|
function togglePicker(show) {
|
|
@@ -314,7 +319,6 @@ var InaUI = (() => {
|
|
|
314
319
|
prevBtn.className = "ina-year-picker__nav-button";
|
|
315
320
|
prevBtn.innerHTML = createIcon("chevron-left");
|
|
316
321
|
prevBtn.onclick = (e) => {
|
|
317
|
-
e.stopPropagation();
|
|
318
322
|
decadeStart -= 20;
|
|
319
323
|
renderGrid();
|
|
320
324
|
};
|
|
@@ -323,7 +327,6 @@ var InaUI = (() => {
|
|
|
323
327
|
nextBtn.className = "ina-year-picker__nav-button";
|
|
324
328
|
nextBtn.innerHTML = createIcon("chevron-right");
|
|
325
329
|
nextBtn.onclick = (e) => {
|
|
326
|
-
e.stopPropagation();
|
|
327
330
|
decadeStart += 20;
|
|
328
331
|
renderGrid();
|
|
329
332
|
};
|
|
@@ -343,7 +346,6 @@ var InaUI = (() => {
|
|
|
343
346
|
btn.classList.add("ina-year-picker__year-option--selected");
|
|
344
347
|
btn.textContent = y;
|
|
345
348
|
btn.addEventListener("click", (e) => {
|
|
346
|
-
e.stopPropagation();
|
|
347
349
|
currentYearVal = y;
|
|
348
350
|
updateText();
|
|
349
351
|
togglePicker(false);
|
|
@@ -355,7 +357,6 @@ var InaUI = (() => {
|
|
|
355
357
|
pickerPanel.append(header, grid);
|
|
356
358
|
container.append(pickerTrigger, pickerPanel);
|
|
357
359
|
pickerTrigger.addEventListener("click", (e) => {
|
|
358
|
-
e.stopPropagation();
|
|
359
360
|
togglePicker(!isPickerOpen);
|
|
360
361
|
});
|
|
361
362
|
function togglePicker(show) {
|
|
@@ -396,7 +397,6 @@ var InaUI = (() => {
|
|
|
396
397
|
prevBtn.className = "ina-date-picker__nav-button";
|
|
397
398
|
prevBtn.innerHTML = createIcon("chevron-left");
|
|
398
399
|
prevBtn.onclick = (e) => {
|
|
399
|
-
e.stopPropagation();
|
|
400
400
|
viewDate.setMonth(viewDate.getMonth() - 1);
|
|
401
401
|
render();
|
|
402
402
|
};
|
|
@@ -406,31 +406,33 @@ var InaUI = (() => {
|
|
|
406
406
|
spacer.style.width = "32px";
|
|
407
407
|
header.appendChild(spacer);
|
|
408
408
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
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 {
|
|
415
418
|
viewDate.setMonth(m);
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
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 {
|
|
422
429
|
viewDate.setFullYear(y);
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
const title = document.createElement("div");
|
|
430
|
-
title.className = "ina-date-picker__calendar-title";
|
|
431
|
-
title.textContent = `${MONTHS_ID[month]} ${year}`;
|
|
432
|
-
header.appendChild(title);
|
|
433
|
-
}
|
|
430
|
+
}
|
|
431
|
+
render();
|
|
432
|
+
});
|
|
433
|
+
yearCont.appendChild(yearPicker.element);
|
|
434
|
+
controls.append(monthCont, yearCont);
|
|
435
|
+
header.appendChild(controls);
|
|
434
436
|
const showNextBtn = mode === "single" && !isNextMonth || isNextMonth;
|
|
435
437
|
if (showNextBtn) {
|
|
436
438
|
const nextBtn = document.createElement("button");
|
|
@@ -438,7 +440,6 @@ var InaUI = (() => {
|
|
|
438
440
|
nextBtn.className = "ina-date-picker__nav-button";
|
|
439
441
|
nextBtn.innerHTML = createIcon("chevron-right");
|
|
440
442
|
nextBtn.onclick = (e) => {
|
|
441
|
-
e.stopPropagation();
|
|
442
443
|
viewDate.setMonth(viewDate.getMonth() + 1);
|
|
443
444
|
render();
|
|
444
445
|
};
|
|
@@ -496,7 +497,6 @@ var InaUI = (() => {
|
|
|
496
497
|
if (!isSelected && !isInRange)
|
|
497
498
|
btn.classList.add("ina-date-picker__day--hover");
|
|
498
499
|
btn.onclick = (e) => {
|
|
499
|
-
e.stopPropagation();
|
|
500
500
|
if (mode === "single") {
|
|
501
501
|
selectedDate = date;
|
|
502
502
|
close();
|
|
@@ -574,7 +574,6 @@ var InaUI = (() => {
|
|
|
574
574
|
else open();
|
|
575
575
|
}
|
|
576
576
|
trigger.addEventListener("click", (e) => {
|
|
577
|
-
e.stopPropagation();
|
|
578
577
|
toggle();
|
|
579
578
|
});
|
|
580
579
|
document.addEventListener("click", (e) => {
|
package/dist/index.js
CHANGED
|
@@ -121,7 +121,14 @@ function initDatepicker() {
|
|
|
121
121
|
if (!panelContent) {
|
|
122
122
|
panelContent = document.createElement("div");
|
|
123
123
|
panelContent.className = "ina-date-picker__panel-content";
|
|
124
|
+
if (mode === "range" || mode === "multiple") {
|
|
125
|
+
panelContent.classList.add("ina-date-picker__panel-content--dual");
|
|
126
|
+
}
|
|
124
127
|
panel.appendChild(panelContent);
|
|
128
|
+
} else {
|
|
129
|
+
if (mode === "range" || mode === "multiple") {
|
|
130
|
+
panelContent.classList.add("ina-date-picker__panel-content--dual");
|
|
131
|
+
}
|
|
125
132
|
}
|
|
126
133
|
let viewDate = /* @__PURE__ */ new Date();
|
|
127
134
|
let selectedDate = null;
|
|
@@ -245,7 +252,6 @@ function initDatepicker() {
|
|
|
245
252
|
btn.classList.add("ina-month-picker__month-option--selected");
|
|
246
253
|
btn.textContent = m;
|
|
247
254
|
btn.addEventListener("click", (e) => {
|
|
248
|
-
e.stopPropagation();
|
|
249
255
|
currentMonthIdx = idx;
|
|
250
256
|
updateText();
|
|
251
257
|
togglePicker(false);
|
|
@@ -256,7 +262,6 @@ function initDatepicker() {
|
|
|
256
262
|
pickerPanel.appendChild(grid);
|
|
257
263
|
container.append(pickerTrigger, pickerPanel);
|
|
258
264
|
pickerTrigger.addEventListener("click", (e) => {
|
|
259
|
-
e.stopPropagation();
|
|
260
265
|
togglePicker(!isPickerOpen);
|
|
261
266
|
});
|
|
262
267
|
function togglePicker(show) {
|
|
@@ -302,7 +307,6 @@ function initDatepicker() {
|
|
|
302
307
|
prevBtn.className = "ina-year-picker__nav-button";
|
|
303
308
|
prevBtn.innerHTML = createIcon("chevron-left");
|
|
304
309
|
prevBtn.onclick = (e) => {
|
|
305
|
-
e.stopPropagation();
|
|
306
310
|
decadeStart -= 20;
|
|
307
311
|
renderGrid();
|
|
308
312
|
};
|
|
@@ -311,7 +315,6 @@ function initDatepicker() {
|
|
|
311
315
|
nextBtn.className = "ina-year-picker__nav-button";
|
|
312
316
|
nextBtn.innerHTML = createIcon("chevron-right");
|
|
313
317
|
nextBtn.onclick = (e) => {
|
|
314
|
-
e.stopPropagation();
|
|
315
318
|
decadeStart += 20;
|
|
316
319
|
renderGrid();
|
|
317
320
|
};
|
|
@@ -331,7 +334,6 @@ function initDatepicker() {
|
|
|
331
334
|
btn.classList.add("ina-year-picker__year-option--selected");
|
|
332
335
|
btn.textContent = y;
|
|
333
336
|
btn.addEventListener("click", (e) => {
|
|
334
|
-
e.stopPropagation();
|
|
335
337
|
currentYearVal = y;
|
|
336
338
|
updateText();
|
|
337
339
|
togglePicker(false);
|
|
@@ -343,7 +345,6 @@ function initDatepicker() {
|
|
|
343
345
|
pickerPanel.append(header, grid);
|
|
344
346
|
container.append(pickerTrigger, pickerPanel);
|
|
345
347
|
pickerTrigger.addEventListener("click", (e) => {
|
|
346
|
-
e.stopPropagation();
|
|
347
348
|
togglePicker(!isPickerOpen);
|
|
348
349
|
});
|
|
349
350
|
function togglePicker(show) {
|
|
@@ -384,7 +385,6 @@ function initDatepicker() {
|
|
|
384
385
|
prevBtn.className = "ina-date-picker__nav-button";
|
|
385
386
|
prevBtn.innerHTML = createIcon("chevron-left");
|
|
386
387
|
prevBtn.onclick = (e) => {
|
|
387
|
-
e.stopPropagation();
|
|
388
388
|
viewDate.setMonth(viewDate.getMonth() - 1);
|
|
389
389
|
render();
|
|
390
390
|
};
|
|
@@ -394,31 +394,33 @@ function initDatepicker() {
|
|
|
394
394
|
spacer.style.width = "32px";
|
|
395
395
|
header.appendChild(spacer);
|
|
396
396
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
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 {
|
|
403
406
|
viewDate.setMonth(m);
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
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 {
|
|
410
417
|
viewDate.setFullYear(y);
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
const title = document.createElement("div");
|
|
418
|
-
title.className = "ina-date-picker__calendar-title";
|
|
419
|
-
title.textContent = `${MONTHS_ID[month]} ${year}`;
|
|
420
|
-
header.appendChild(title);
|
|
421
|
-
}
|
|
418
|
+
}
|
|
419
|
+
render();
|
|
420
|
+
});
|
|
421
|
+
yearCont.appendChild(yearPicker.element);
|
|
422
|
+
controls.append(monthCont, yearCont);
|
|
423
|
+
header.appendChild(controls);
|
|
422
424
|
const showNextBtn = mode === "single" && !isNextMonth || isNextMonth;
|
|
423
425
|
if (showNextBtn) {
|
|
424
426
|
const nextBtn = document.createElement("button");
|
|
@@ -426,7 +428,6 @@ function initDatepicker() {
|
|
|
426
428
|
nextBtn.className = "ina-date-picker__nav-button";
|
|
427
429
|
nextBtn.innerHTML = createIcon("chevron-right");
|
|
428
430
|
nextBtn.onclick = (e) => {
|
|
429
|
-
e.stopPropagation();
|
|
430
431
|
viewDate.setMonth(viewDate.getMonth() + 1);
|
|
431
432
|
render();
|
|
432
433
|
};
|
|
@@ -484,7 +485,6 @@ function initDatepicker() {
|
|
|
484
485
|
if (!isSelected && !isInRange)
|
|
485
486
|
btn.classList.add("ina-date-picker__day--hover");
|
|
486
487
|
btn.onclick = (e) => {
|
|
487
|
-
e.stopPropagation();
|
|
488
488
|
if (mode === "single") {
|
|
489
489
|
selectedDate = date;
|
|
490
490
|
close();
|
|
@@ -562,7 +562,6 @@ function initDatepicker() {
|
|
|
562
562
|
else open();
|
|
563
563
|
}
|
|
564
564
|
trigger.addEventListener("click", (e) => {
|
|
565
|
-
e.stopPropagation();
|
|
566
565
|
toggle();
|
|
567
566
|
});
|
|
568
567
|
document.addEventListener("click", (e) => {
|