@idds/js 1.0.95 → 1.0.97
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 +121 -71
- package/dist/index.js +114 -64
- package/package.json +1 -1
package/dist/index.iife.js
CHANGED
|
@@ -101,18 +101,18 @@ var InaUI = (() => {
|
|
|
101
101
|
const tabItem = tab.querySelectorAll(`.${PREFIX}-tab-item`);
|
|
102
102
|
tabItem.forEach((tabButton) => {
|
|
103
103
|
function updateState() {
|
|
104
|
-
const
|
|
104
|
+
const index2 = Array.from(tabItem).indexOf(tabButton);
|
|
105
105
|
tabItem.forEach((tabButton2, i) => {
|
|
106
106
|
tabButton2.classList.remove("active");
|
|
107
107
|
tabButton2.setAttribute("aria-selected", "false");
|
|
108
|
-
if (i ===
|
|
108
|
+
if (i === index2) {
|
|
109
109
|
tabButton2.classList.add("active");
|
|
110
110
|
tabButton2.setAttribute("aria-selected", "true");
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
tab.dispatchEvent(
|
|
114
114
|
new CustomEvent("tab:change", {
|
|
115
|
-
detail: { activeIndex:
|
|
115
|
+
detail: { activeIndex: index2 },
|
|
116
116
|
bubbles: true,
|
|
117
117
|
composed: true
|
|
118
118
|
})
|
|
@@ -207,28 +207,28 @@ var InaUI = (() => {
|
|
|
207
207
|
this.element.__inaAccordionGroup = this;
|
|
208
208
|
}
|
|
209
209
|
registerItem(item) {
|
|
210
|
-
const
|
|
211
|
-
this.items.set(item.id,
|
|
210
|
+
const index2 = this.items.size;
|
|
211
|
+
this.items.set(item.id, index2);
|
|
212
212
|
this.itemsArray.push(item);
|
|
213
213
|
if (item.defaultOpen) {
|
|
214
214
|
if (this.isMultiple) {
|
|
215
|
-
if (!this.openIndexes.includes(
|
|
216
|
-
this.openIndexes.push(
|
|
215
|
+
if (!this.openIndexes.includes(index2)) {
|
|
216
|
+
this.openIndexes.push(index2);
|
|
217
217
|
}
|
|
218
218
|
} else {
|
|
219
219
|
if (this.openIndexes.length === 0) {
|
|
220
|
-
this.openIndexes.push(
|
|
220
|
+
this.openIndexes.push(index2);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
return
|
|
224
|
+
return index2;
|
|
225
225
|
}
|
|
226
226
|
unregisterItem(item) {
|
|
227
|
-
const
|
|
228
|
-
if (
|
|
227
|
+
const index2 = this.items.get(item.id);
|
|
228
|
+
if (index2 !== void 0) {
|
|
229
229
|
this.items.delete(item.id);
|
|
230
230
|
this.itemsArray = this.itemsArray.filter((i) => i !== item);
|
|
231
|
-
this.openIndexes = this.openIndexes.filter((idx) => idx !==
|
|
231
|
+
this.openIndexes = this.openIndexes.filter((idx) => idx !== index2).map((idx) => idx > index2 ? idx - 1 : idx);
|
|
232
232
|
const newMap = /* @__PURE__ */ new Map();
|
|
233
233
|
this.itemsArray.forEach((itm, newIdx) => {
|
|
234
234
|
newMap.set(itm.id, newIdx);
|
|
@@ -236,22 +236,22 @@ var InaUI = (() => {
|
|
|
236
236
|
this.items = newMap;
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
handleItemToggle(
|
|
239
|
+
handleItemToggle(index2, isOpen) {
|
|
240
240
|
const prevIndexes = [...this.openIndexes];
|
|
241
241
|
let nextIndexes = [];
|
|
242
242
|
if (this.isMultiple) {
|
|
243
243
|
if (isOpen) {
|
|
244
|
-
if (!prevIndexes.includes(
|
|
245
|
-
nextIndexes = [...prevIndexes,
|
|
244
|
+
if (!prevIndexes.includes(index2)) {
|
|
245
|
+
nextIndexes = [...prevIndexes, index2];
|
|
246
246
|
} else {
|
|
247
247
|
nextIndexes = prevIndexes;
|
|
248
248
|
}
|
|
249
249
|
} else {
|
|
250
|
-
nextIndexes = prevIndexes.filter((idx) => idx !==
|
|
250
|
+
nextIndexes = prevIndexes.filter((idx) => idx !== index2);
|
|
251
251
|
}
|
|
252
252
|
} else {
|
|
253
253
|
if (isOpen) {
|
|
254
|
-
nextIndexes = [
|
|
254
|
+
nextIndexes = [index2];
|
|
255
255
|
} else {
|
|
256
256
|
nextIndexes = [];
|
|
257
257
|
}
|
|
@@ -259,16 +259,16 @@ var InaUI = (() => {
|
|
|
259
259
|
this.openIndexes = nextIndexes;
|
|
260
260
|
this.notifyItems();
|
|
261
261
|
}
|
|
262
|
-
isItemOpen(
|
|
263
|
-
return this.openIndexes.includes(
|
|
262
|
+
isItemOpen(index2) {
|
|
263
|
+
return this.openIndexes.includes(index2);
|
|
264
264
|
}
|
|
265
265
|
getItemIndex(itemId) {
|
|
266
266
|
return this.items.get(itemId);
|
|
267
267
|
}
|
|
268
268
|
// Notify all children to update their visual state based on new openIndexes
|
|
269
269
|
notifyItems() {
|
|
270
|
-
this.itemsArray.forEach((item,
|
|
271
|
-
const isOpen = this.openIndexes.includes(
|
|
270
|
+
this.itemsArray.forEach((item, index2) => {
|
|
271
|
+
const isOpen = this.openIndexes.includes(index2);
|
|
272
272
|
item.setOpenState(isOpen);
|
|
273
273
|
});
|
|
274
274
|
}
|
|
@@ -360,7 +360,7 @@ var InaUI = (() => {
|
|
|
360
360
|
|
|
361
361
|
// src/js/components/stateful/date-picker.js
|
|
362
362
|
var DatePicker = class {
|
|
363
|
-
constructor(selectorOrElement,
|
|
363
|
+
constructor(selectorOrElement, options2 = {}) {
|
|
364
364
|
this.container = typeof selectorOrElement === "string" ? document.querySelector(selectorOrElement) : selectorOrElement;
|
|
365
365
|
if (!this.container) {
|
|
366
366
|
console.warn("[IDDS DatePicker] Container not found:", selectorOrElement);
|
|
@@ -386,7 +386,7 @@ var InaUI = (() => {
|
|
|
386
386
|
onChange: null,
|
|
387
387
|
triggerWidth: "",
|
|
388
388
|
panelMaxHeight: "",
|
|
389
|
-
...
|
|
389
|
+
...options2
|
|
390
390
|
};
|
|
391
391
|
this.state = {
|
|
392
392
|
viewDate: /* @__PURE__ */ new Date(),
|
|
@@ -950,11 +950,11 @@ var InaUI = (() => {
|
|
|
950
950
|
return this.state.rangeDate;
|
|
951
951
|
}
|
|
952
952
|
};
|
|
953
|
-
function initDatepicker(selectorOrElement,
|
|
953
|
+
function initDatepicker(selectorOrElement, options2 = {}) {
|
|
954
954
|
const elements = typeof selectorOrElement === "string" ? document.querySelectorAll(selectorOrElement) : selectorOrElement ? typeof selectorOrElement.length !== "undefined" ? selectorOrElement : [selectorOrElement] : document.querySelectorAll(`.${PREFIX}-date-picker`);
|
|
955
955
|
const instances = [];
|
|
956
956
|
elements.forEach((container) => {
|
|
957
|
-
const instance = new DatePicker(container,
|
|
957
|
+
const instance = new DatePicker(container, options2);
|
|
958
958
|
container.__datepickerAPI = instance;
|
|
959
959
|
instances.push(instance);
|
|
960
960
|
});
|
|
@@ -964,7 +964,7 @@ var InaUI = (() => {
|
|
|
964
964
|
|
|
965
965
|
// src/js/components/stateful/time-picker.js
|
|
966
966
|
var TimePicker = class {
|
|
967
|
-
constructor(selectorOrElement,
|
|
967
|
+
constructor(selectorOrElement, options2 = {}) {
|
|
968
968
|
this.container = typeof selectorOrElement === "string" ? document.querySelector(selectorOrElement) : selectorOrElement;
|
|
969
969
|
if (!this.container) {
|
|
970
970
|
console.warn("[IDDS TimePicker] Container not found:", selectorOrElement);
|
|
@@ -997,7 +997,7 @@ var InaUI = (() => {
|
|
|
997
997
|
secondStep: 1,
|
|
998
998
|
onChange: null,
|
|
999
999
|
size: this.container.dataset.size || "md",
|
|
1000
|
-
...
|
|
1000
|
+
...options2
|
|
1001
1001
|
};
|
|
1002
1002
|
this.state = {
|
|
1003
1003
|
isOpen: false,
|
|
@@ -1214,24 +1214,24 @@ var InaUI = (() => {
|
|
|
1214
1214
|
}
|
|
1215
1215
|
}
|
|
1216
1216
|
generateOptions(type) {
|
|
1217
|
-
const
|
|
1217
|
+
const options2 = [];
|
|
1218
1218
|
const { use12Hours, hourStep, minuteStep, secondStep } = this.options;
|
|
1219
1219
|
let limit = type === "hour" ? use12Hours ? 12 : 24 : 60;
|
|
1220
1220
|
let step = type === "hour" ? hourStep : type === "minute" ? minuteStep : secondStep;
|
|
1221
1221
|
if (limit === 12) {
|
|
1222
1222
|
for (let i = type === "hour" ? 1 : 0; i <= (type === "hour" ? 12 : 59); i += step) {
|
|
1223
|
-
|
|
1223
|
+
options2.push(i);
|
|
1224
1224
|
}
|
|
1225
1225
|
} else if (limit === 24) {
|
|
1226
1226
|
for (let i = 0; i <= 23; i += step) {
|
|
1227
|
-
|
|
1227
|
+
options2.push(i);
|
|
1228
1228
|
}
|
|
1229
1229
|
} else {
|
|
1230
1230
|
for (let i = 0; i <= 59; i += step) {
|
|
1231
|
-
|
|
1231
|
+
options2.push(i);
|
|
1232
1232
|
}
|
|
1233
1233
|
}
|
|
1234
|
-
return
|
|
1234
|
+
return options2;
|
|
1235
1235
|
}
|
|
1236
1236
|
renderColumn(type, optionsArr) {
|
|
1237
1237
|
const column = document.createElement("div");
|
|
@@ -1285,10 +1285,23 @@ var InaUI = (() => {
|
|
|
1285
1285
|
option.classList.add(`${PREFIX}-time-picker__option--selected`);
|
|
1286
1286
|
if (isDisabled)
|
|
1287
1287
|
option.classList.add(`${PREFIX}-time-picker__option--disabled`);
|
|
1288
|
+
option.setAttribute("role", "option");
|
|
1289
|
+
option.setAttribute("aria-selected", isSelected.toString());
|
|
1290
|
+
const isFirstFocusable = index === 0 && !options.some((opt) => {
|
|
1291
|
+
if (type === "hour") {
|
|
1292
|
+
return use12Hours ? (currentTime.hours === 0 ? 12 : currentTime.hours) === opt : currentTime.hours === opt;
|
|
1293
|
+
} else if (type === "minute") {
|
|
1294
|
+
return currentTime.minutes === opt;
|
|
1295
|
+
} else if (type === "second") {
|
|
1296
|
+
return currentTime.seconds === opt;
|
|
1297
|
+
}
|
|
1298
|
+
return false;
|
|
1299
|
+
});
|
|
1300
|
+
option.tabIndex = isSelected || isFirstFocusable ? 0 : -1;
|
|
1288
1301
|
option.textContent = optValue.toString().padStart(2, "0");
|
|
1289
1302
|
if (!isDisabled) {
|
|
1290
|
-
|
|
1291
|
-
e
|
|
1303
|
+
const handleSelection = (e) => {
|
|
1304
|
+
e?.stopPropagation();
|
|
1292
1305
|
const val = parseInt(optValue, 10);
|
|
1293
1306
|
if (type === "hour") {
|
|
1294
1307
|
this.state.currentTime.hours = use12Hours && val === 12 ? 0 : val;
|
|
@@ -1299,6 +1312,21 @@ var InaUI = (() => {
|
|
|
1299
1312
|
}
|
|
1300
1313
|
this.updateInput();
|
|
1301
1314
|
this.buildPanel();
|
|
1315
|
+
};
|
|
1316
|
+
option.addEventListener("click", handleSelection);
|
|
1317
|
+
option.addEventListener("keydown", (e) => {
|
|
1318
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1319
|
+
e.preventDefault();
|
|
1320
|
+
handleSelection();
|
|
1321
|
+
} else if (e.key === "ArrowDown") {
|
|
1322
|
+
e.preventDefault();
|
|
1323
|
+
const nextElement = e.currentTarget.nextElementSibling;
|
|
1324
|
+
if (nextElement) nextElement.focus();
|
|
1325
|
+
} else if (e.key === "ArrowUp") {
|
|
1326
|
+
e.preventDefault();
|
|
1327
|
+
const prevElement = e.currentTarget.previousElementSibling;
|
|
1328
|
+
if (prevElement) prevElement.focus();
|
|
1329
|
+
}
|
|
1302
1330
|
});
|
|
1303
1331
|
}
|
|
1304
1332
|
colContent.appendChild(option);
|
|
@@ -1326,12 +1354,34 @@ var InaUI = (() => {
|
|
|
1326
1354
|
);
|
|
1327
1355
|
if (isDisabled)
|
|
1328
1356
|
option.classList.add(`${PREFIX}-time-picker__option--disabled`);
|
|
1357
|
+
option.setAttribute("role", "option");
|
|
1358
|
+
option.setAttribute(
|
|
1359
|
+
"aria-selected",
|
|
1360
|
+
(this.state.currentTime.period === p).toString()
|
|
1361
|
+
);
|
|
1362
|
+
const isFirstFocusable = p === "AM" && this.state.currentTime.period !== "AM" && this.state.currentTime.period !== "PM";
|
|
1363
|
+
option.tabIndex = this.state.currentTime.period === p || isFirstFocusable ? 0 : -1;
|
|
1329
1364
|
if (!isDisabled) {
|
|
1330
|
-
|
|
1331
|
-
e
|
|
1365
|
+
const handleSelection = (e) => {
|
|
1366
|
+
e?.stopPropagation();
|
|
1332
1367
|
this.state.currentTime.period = p;
|
|
1333
1368
|
this.updateInput();
|
|
1334
1369
|
this.buildPanel();
|
|
1370
|
+
};
|
|
1371
|
+
option.addEventListener("click", handleSelection);
|
|
1372
|
+
option.addEventListener("keydown", (e) => {
|
|
1373
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1374
|
+
e.preventDefault();
|
|
1375
|
+
handleSelection();
|
|
1376
|
+
} else if (e.key === "ArrowDown") {
|
|
1377
|
+
e.preventDefault();
|
|
1378
|
+
const nextElement = e.currentTarget.nextElementSibling;
|
|
1379
|
+
if (nextElement) nextElement.focus();
|
|
1380
|
+
} else if (e.key === "ArrowUp") {
|
|
1381
|
+
e.preventDefault();
|
|
1382
|
+
const prevElement = e.currentTarget.previousElementSibling;
|
|
1383
|
+
if (prevElement) prevElement.focus();
|
|
1384
|
+
}
|
|
1335
1385
|
});
|
|
1336
1386
|
}
|
|
1337
1387
|
colContent.appendChild(option);
|
|
@@ -1412,11 +1462,11 @@ var InaUI = (() => {
|
|
|
1412
1462
|
return this.state.internalValue;
|
|
1413
1463
|
}
|
|
1414
1464
|
};
|
|
1415
|
-
function initTimepicker(selectorOrElement,
|
|
1465
|
+
function initTimepicker(selectorOrElement, options2 = {}) {
|
|
1416
1466
|
const elements = typeof selectorOrElement === "string" ? document.querySelectorAll(selectorOrElement) : selectorOrElement ? typeof selectorOrElement.length !== "undefined" ? selectorOrElement : [selectorOrElement] : document.querySelectorAll(`.${PREFIX}-time-picker`);
|
|
1417
1467
|
const instances = [];
|
|
1418
1468
|
elements.forEach((container) => {
|
|
1419
|
-
const instance = new TimePicker(container,
|
|
1469
|
+
const instance = new TimePicker(container, options2);
|
|
1420
1470
|
container.__timepickerAPI = instance;
|
|
1421
1471
|
instances.push(instance);
|
|
1422
1472
|
});
|
|
@@ -1658,9 +1708,9 @@ var InaUI = (() => {
|
|
|
1658
1708
|
`.${PREFIX3}-select-dropdown__trigger-text`
|
|
1659
1709
|
);
|
|
1660
1710
|
const placeholder = input ? input.getAttribute("placeholder") : textSpan ? textSpan.getAttribute("data-placeholder") : "Select...";
|
|
1661
|
-
const
|
|
1711
|
+
const options2 = root.querySelectorAll(`.${PREFIX3}-select-dropdown__option`);
|
|
1662
1712
|
const getLabel = (val) => {
|
|
1663
|
-
const opt = Array.from(
|
|
1713
|
+
const opt = Array.from(options2).find(
|
|
1664
1714
|
(o) => o.getAttribute("data-value") === val
|
|
1665
1715
|
);
|
|
1666
1716
|
return opt ? opt.textContent.trim() : val;
|
|
@@ -1686,7 +1736,7 @@ var InaUI = (() => {
|
|
|
1686
1736
|
values.length === 0
|
|
1687
1737
|
);
|
|
1688
1738
|
}
|
|
1689
|
-
|
|
1739
|
+
options2.forEach((opt) => {
|
|
1690
1740
|
const val = opt.getAttribute("data-value");
|
|
1691
1741
|
const isSelected = values.includes(val);
|
|
1692
1742
|
if (isMultiple) {
|
|
@@ -1766,13 +1816,13 @@ var InaUI = (() => {
|
|
|
1766
1816
|
const root = e.target.closest(`.${PREFIX3}-select-dropdown`);
|
|
1767
1817
|
if (root) {
|
|
1768
1818
|
const term = e.target.value.toLowerCase();
|
|
1769
|
-
const
|
|
1819
|
+
const options2 = root.querySelectorAll(
|
|
1770
1820
|
`.${PREFIX3}-select-dropdown__option`
|
|
1771
1821
|
);
|
|
1772
1822
|
if (root.getAttribute("data-state") !== "open") {
|
|
1773
1823
|
setDropdownState(root, { isOpen: true });
|
|
1774
1824
|
}
|
|
1775
|
-
|
|
1825
|
+
options2.forEach((opt) => {
|
|
1776
1826
|
const text = opt.textContent.trim().toLowerCase();
|
|
1777
1827
|
opt.style.display = text.includes(term) ? "" : "none";
|
|
1778
1828
|
});
|
|
@@ -1846,20 +1896,20 @@ var InaUI = (() => {
|
|
|
1846
1896
|
`;
|
|
1847
1897
|
const updateUI = () => {
|
|
1848
1898
|
stepper.dataset.currentStep = currentStep;
|
|
1849
|
-
items.forEach((item,
|
|
1899
|
+
items.forEach((item, index2) => {
|
|
1850
1900
|
const iconWrapper = item.querySelector(
|
|
1851
1901
|
`.${PREFIX}-stepper__icon-wrapper`
|
|
1852
1902
|
);
|
|
1853
|
-
const itemNumber =
|
|
1903
|
+
const itemNumber = index2 + 1;
|
|
1854
1904
|
item.classList.remove(
|
|
1855
1905
|
`${PREFIX}-stepper__item--completed`,
|
|
1856
1906
|
`${PREFIX}-stepper__item--active`
|
|
1857
1907
|
);
|
|
1858
1908
|
if (iconWrapper) iconWrapper.innerHTML = "";
|
|
1859
|
-
if (
|
|
1909
|
+
if (index2 < currentStep) {
|
|
1860
1910
|
item.classList.add(`${PREFIX}-stepper__item--completed`);
|
|
1861
1911
|
if (iconWrapper) iconWrapper.innerHTML = checkIcon;
|
|
1862
|
-
} else if (
|
|
1912
|
+
} else if (index2 === currentStep) {
|
|
1863
1913
|
item.classList.add(`${PREFIX}-stepper__item--active`);
|
|
1864
1914
|
if (iconWrapper)
|
|
1865
1915
|
iconWrapper.innerHTML = `<span class="${PREFIX}-stepper__step-number">${itemNumber}</span>`;
|
|
@@ -1868,8 +1918,8 @@ var InaUI = (() => {
|
|
|
1868
1918
|
iconWrapper.innerHTML = `<span class="${PREFIX}-stepper__step-number">${itemNumber}</span>`;
|
|
1869
1919
|
}
|
|
1870
1920
|
});
|
|
1871
|
-
separators.forEach((separator,
|
|
1872
|
-
if (
|
|
1921
|
+
separators.forEach((separator, index2) => {
|
|
1922
|
+
if (index2 < currentStep) {
|
|
1873
1923
|
separator.classList.add(`${PREFIX}-stepper__separator--completed`);
|
|
1874
1924
|
} else {
|
|
1875
1925
|
separator.classList.remove(`${PREFIX}-stepper__separator--completed`);
|
|
@@ -1915,11 +1965,11 @@ var InaUI = (() => {
|
|
|
1915
1965
|
}
|
|
1916
1966
|
});
|
|
1917
1967
|
});
|
|
1918
|
-
items.forEach((item,
|
|
1968
|
+
items.forEach((item, index2) => {
|
|
1919
1969
|
if (item.classList.contains(`${PREFIX}-stepper__item--clickable`) || item.hasAttribute("data-clickable")) {
|
|
1920
1970
|
item.addEventListener("click", () => {
|
|
1921
1971
|
if (!item.classList.contains(`${PREFIX}-stepper__item--disabled`)) {
|
|
1922
|
-
currentStep =
|
|
1972
|
+
currentStep = index2;
|
|
1923
1973
|
updateUI();
|
|
1924
1974
|
}
|
|
1925
1975
|
});
|
|
@@ -1993,7 +2043,7 @@ var InaUI = (() => {
|
|
|
1993
2043
|
} else {
|
|
1994
2044
|
filesContainer.style.display = "none";
|
|
1995
2045
|
}
|
|
1996
|
-
uploadedFiles.forEach((f,
|
|
2046
|
+
uploadedFiles.forEach((f, index2) => {
|
|
1997
2047
|
const fileEl = document.createElement("div");
|
|
1998
2048
|
fileEl.className = `${PREFIX}-file-upload__file`;
|
|
1999
2049
|
let statusClass = "";
|
|
@@ -3267,7 +3317,7 @@ var InaUI = (() => {
|
|
|
3267
3317
|
|
|
3268
3318
|
// src/js/components/stateful/table.js
|
|
3269
3319
|
var Table = class {
|
|
3270
|
-
constructor(selectorOrElement,
|
|
3320
|
+
constructor(selectorOrElement, options2 = {}) {
|
|
3271
3321
|
this.container = typeof selectorOrElement === "string" ? document.querySelector(selectorOrElement) : selectorOrElement;
|
|
3272
3322
|
if (!this.container) {
|
|
3273
3323
|
console.warn("[IDDS Table] Container not found:", selectorOrElement);
|
|
@@ -3299,7 +3349,7 @@ var InaUI = (() => {
|
|
|
3299
3349
|
searchContainer: null,
|
|
3300
3350
|
searchButton: null,
|
|
3301
3351
|
onSearch: null,
|
|
3302
|
-
...
|
|
3352
|
+
...options2
|
|
3303
3353
|
};
|
|
3304
3354
|
this.state = {
|
|
3305
3355
|
currentPage: this.options.initialPage,
|
|
@@ -3504,7 +3554,7 @@ var InaUI = (() => {
|
|
|
3504
3554
|
this.updateSelectAllState();
|
|
3505
3555
|
return;
|
|
3506
3556
|
}
|
|
3507
|
-
rowData.forEach((row,
|
|
3557
|
+
rowData.forEach((row, index2) => {
|
|
3508
3558
|
const tr = document.createElement("tr");
|
|
3509
3559
|
tr.className = `${PREFIX}-table__row`;
|
|
3510
3560
|
if (this.options.rowClickable) {
|
|
@@ -3515,11 +3565,11 @@ var InaUI = (() => {
|
|
|
3515
3565
|
return;
|
|
3516
3566
|
}
|
|
3517
3567
|
if (typeof this.options.onRowClick === "function") {
|
|
3518
|
-
this.options.onRowClick(row,
|
|
3568
|
+
this.options.onRowClick(row, index2);
|
|
3519
3569
|
}
|
|
3520
3570
|
});
|
|
3521
3571
|
}
|
|
3522
|
-
const rowKeyStr = String(row[this.options.rowKey] ||
|
|
3572
|
+
const rowKeyStr = String(row[this.options.rowKey] || index2);
|
|
3523
3573
|
if (this.options.selectable) {
|
|
3524
3574
|
const td = document.createElement("td");
|
|
3525
3575
|
td.className = `${PREFIX}-table__cell`;
|
|
@@ -3545,7 +3595,7 @@ var InaUI = (() => {
|
|
|
3545
3595
|
const td = document.createElement("td");
|
|
3546
3596
|
td.className = `${PREFIX}-table__cell`;
|
|
3547
3597
|
if (typeof col.render === "function") {
|
|
3548
|
-
const content = col.render(row,
|
|
3598
|
+
const content = col.render(row, index2);
|
|
3549
3599
|
if (typeof content === "string") {
|
|
3550
3600
|
td.innerHTML = content;
|
|
3551
3601
|
} else if (content instanceof HTMLElement) {
|
|
@@ -3779,8 +3829,8 @@ var InaUI = (() => {
|
|
|
3779
3829
|
this.triggerSelectionChange();
|
|
3780
3830
|
}
|
|
3781
3831
|
toggleAllSelection(checked) {
|
|
3782
|
-
this.state.currentData.forEach((row,
|
|
3783
|
-
const keyStr = String(row[this.options.rowKey] ||
|
|
3832
|
+
this.state.currentData.forEach((row, index2) => {
|
|
3833
|
+
const keyStr = String(row[this.options.rowKey] || index2);
|
|
3784
3834
|
if (checked) {
|
|
3785
3835
|
this.state.selectedKeys.add(keyStr);
|
|
3786
3836
|
this.state.selectedRows.set(keyStr, row);
|
|
@@ -3861,11 +3911,11 @@ var InaUI = (() => {
|
|
|
3861
3911
|
};
|
|
3862
3912
|
}
|
|
3863
3913
|
};
|
|
3864
|
-
function initTable(selectorOrElement,
|
|
3914
|
+
function initTable(selectorOrElement, options2 = {}) {
|
|
3865
3915
|
const elements = typeof selectorOrElement === "string" ? document.querySelectorAll(selectorOrElement) : selectorOrElement ? typeof selectorOrElement.length !== "undefined" ? selectorOrElement : [selectorOrElement] : document.querySelectorAll(`.${PREFIX}-table`);
|
|
3866
3916
|
const instances = [];
|
|
3867
3917
|
elements.forEach((container) => {
|
|
3868
|
-
const instance = new Table(container,
|
|
3918
|
+
const instance = new Table(container, options2);
|
|
3869
3919
|
container.__tableAPI = instance;
|
|
3870
3920
|
instances.push(instance);
|
|
3871
3921
|
});
|
|
@@ -3916,7 +3966,7 @@ var InaUI = (() => {
|
|
|
3916
3966
|
return { toastItem, toast };
|
|
3917
3967
|
}
|
|
3918
3968
|
function showToast(optionsOrMessage, variant = "default", duration = 5e3) {
|
|
3919
|
-
const
|
|
3969
|
+
const options2 = typeof optionsOrMessage === "string" ? {
|
|
3920
3970
|
message: optionsOrMessage,
|
|
3921
3971
|
state: variant,
|
|
3922
3972
|
duration
|
|
@@ -3929,7 +3979,7 @@ var InaUI = (() => {
|
|
|
3929
3979
|
duration: autoCloseDuration = 5e3,
|
|
3930
3980
|
position = "top-right",
|
|
3931
3981
|
actionHtml = ""
|
|
3932
|
-
} =
|
|
3982
|
+
} = options2;
|
|
3933
3983
|
const container = getOrCreateContainer(position);
|
|
3934
3984
|
const { toastItem, toast } = createToastElement({
|
|
3935
3985
|
title,
|
|
@@ -4041,8 +4091,8 @@ var InaUI = (() => {
|
|
|
4041
4091
|
const menuItems = menu.querySelectorAll("li[role='option']");
|
|
4042
4092
|
const menuId = menu.id;
|
|
4043
4093
|
let activeIndex = -1;
|
|
4044
|
-
menuItems.forEach((item,
|
|
4045
|
-
item.id = `${menuId}-item-${
|
|
4094
|
+
menuItems.forEach((item, index2) => {
|
|
4095
|
+
item.id = `${menuId}-item-${index2}`;
|
|
4046
4096
|
});
|
|
4047
4097
|
const toggleMenu = (show) => {
|
|
4048
4098
|
const isCurrentlyShown = dropdown.classList.contains("show");
|
|
@@ -4097,15 +4147,15 @@ var InaUI = (() => {
|
|
|
4097
4147
|
}
|
|
4098
4148
|
toggleMenu(false);
|
|
4099
4149
|
};
|
|
4100
|
-
const setHighlight = (
|
|
4150
|
+
const setHighlight = (index2) => {
|
|
4101
4151
|
removeHighlight();
|
|
4102
4152
|
const visibleItems = menu.querySelectorAll(
|
|
4103
4153
|
"li[role='option']:not(.hidden)"
|
|
4104
4154
|
);
|
|
4105
4155
|
if (visibleItems.length === 0) return;
|
|
4106
|
-
if (
|
|
4107
|
-
else if (
|
|
4108
|
-
const itemToHighlight = visibleItems[
|
|
4156
|
+
if (index2 < 0) index2 = 0;
|
|
4157
|
+
else if (index2 >= visibleItems.length) index2 = visibleItems.length - 1;
|
|
4158
|
+
const itemToHighlight = visibleItems[index2];
|
|
4109
4159
|
if (itemToHighlight) {
|
|
4110
4160
|
itemToHighlight.classList.add("highlighted");
|
|
4111
4161
|
input.setAttribute("aria-activedescendant", itemToHighlight.id);
|
|
@@ -4113,7 +4163,7 @@ var InaUI = (() => {
|
|
|
4113
4163
|
behavior: "smooth",
|
|
4114
4164
|
block: "nearest"
|
|
4115
4165
|
});
|
|
4116
|
-
activeIndex =
|
|
4166
|
+
activeIndex = index2;
|
|
4117
4167
|
}
|
|
4118
4168
|
};
|
|
4119
4169
|
const removeHighlight = () => {
|
package/dist/index.js
CHANGED
|
@@ -91,18 +91,18 @@ function initTab(rootSelector = `.${PREFIX}-tab`) {
|
|
|
91
91
|
const tabItem = tab.querySelectorAll(`.${PREFIX}-tab-item`);
|
|
92
92
|
tabItem.forEach((tabButton) => {
|
|
93
93
|
function updateState() {
|
|
94
|
-
const
|
|
94
|
+
const index2 = Array.from(tabItem).indexOf(tabButton);
|
|
95
95
|
tabItem.forEach((tabButton2, i) => {
|
|
96
96
|
tabButton2.classList.remove("active");
|
|
97
97
|
tabButton2.setAttribute("aria-selected", "false");
|
|
98
|
-
if (i ===
|
|
98
|
+
if (i === index2) {
|
|
99
99
|
tabButton2.classList.add("active");
|
|
100
100
|
tabButton2.setAttribute("aria-selected", "true");
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
tab.dispatchEvent(
|
|
104
104
|
new CustomEvent("tab:change", {
|
|
105
|
-
detail: { activeIndex:
|
|
105
|
+
detail: { activeIndex: index2 },
|
|
106
106
|
bubbles: true,
|
|
107
107
|
composed: true
|
|
108
108
|
})
|
|
@@ -197,28 +197,28 @@ var AccordionGroup = class {
|
|
|
197
197
|
this.element.__inaAccordionGroup = this;
|
|
198
198
|
}
|
|
199
199
|
registerItem(item) {
|
|
200
|
-
const
|
|
201
|
-
this.items.set(item.id,
|
|
200
|
+
const index2 = this.items.size;
|
|
201
|
+
this.items.set(item.id, index2);
|
|
202
202
|
this.itemsArray.push(item);
|
|
203
203
|
if (item.defaultOpen) {
|
|
204
204
|
if (this.isMultiple) {
|
|
205
|
-
if (!this.openIndexes.includes(
|
|
206
|
-
this.openIndexes.push(
|
|
205
|
+
if (!this.openIndexes.includes(index2)) {
|
|
206
|
+
this.openIndexes.push(index2);
|
|
207
207
|
}
|
|
208
208
|
} else {
|
|
209
209
|
if (this.openIndexes.length === 0) {
|
|
210
|
-
this.openIndexes.push(
|
|
210
|
+
this.openIndexes.push(index2);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
return
|
|
214
|
+
return index2;
|
|
215
215
|
}
|
|
216
216
|
unregisterItem(item) {
|
|
217
|
-
const
|
|
218
|
-
if (
|
|
217
|
+
const index2 = this.items.get(item.id);
|
|
218
|
+
if (index2 !== void 0) {
|
|
219
219
|
this.items.delete(item.id);
|
|
220
220
|
this.itemsArray = this.itemsArray.filter((i) => i !== item);
|
|
221
|
-
this.openIndexes = this.openIndexes.filter((idx) => idx !==
|
|
221
|
+
this.openIndexes = this.openIndexes.filter((idx) => idx !== index2).map((idx) => idx > index2 ? idx - 1 : idx);
|
|
222
222
|
const newMap = /* @__PURE__ */ new Map();
|
|
223
223
|
this.itemsArray.forEach((itm, newIdx) => {
|
|
224
224
|
newMap.set(itm.id, newIdx);
|
|
@@ -226,22 +226,22 @@ var AccordionGroup = class {
|
|
|
226
226
|
this.items = newMap;
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
handleItemToggle(
|
|
229
|
+
handleItemToggle(index2, isOpen) {
|
|
230
230
|
const prevIndexes = [...this.openIndexes];
|
|
231
231
|
let nextIndexes = [];
|
|
232
232
|
if (this.isMultiple) {
|
|
233
233
|
if (isOpen) {
|
|
234
|
-
if (!prevIndexes.includes(
|
|
235
|
-
nextIndexes = [...prevIndexes,
|
|
234
|
+
if (!prevIndexes.includes(index2)) {
|
|
235
|
+
nextIndexes = [...prevIndexes, index2];
|
|
236
236
|
} else {
|
|
237
237
|
nextIndexes = prevIndexes;
|
|
238
238
|
}
|
|
239
239
|
} else {
|
|
240
|
-
nextIndexes = prevIndexes.filter((idx) => idx !==
|
|
240
|
+
nextIndexes = prevIndexes.filter((idx) => idx !== index2);
|
|
241
241
|
}
|
|
242
242
|
} else {
|
|
243
243
|
if (isOpen) {
|
|
244
|
-
nextIndexes = [
|
|
244
|
+
nextIndexes = [index2];
|
|
245
245
|
} else {
|
|
246
246
|
nextIndexes = [];
|
|
247
247
|
}
|
|
@@ -249,16 +249,16 @@ var AccordionGroup = class {
|
|
|
249
249
|
this.openIndexes = nextIndexes;
|
|
250
250
|
this.notifyItems();
|
|
251
251
|
}
|
|
252
|
-
isItemOpen(
|
|
253
|
-
return this.openIndexes.includes(
|
|
252
|
+
isItemOpen(index2) {
|
|
253
|
+
return this.openIndexes.includes(index2);
|
|
254
254
|
}
|
|
255
255
|
getItemIndex(itemId) {
|
|
256
256
|
return this.items.get(itemId);
|
|
257
257
|
}
|
|
258
258
|
// Notify all children to update their visual state based on new openIndexes
|
|
259
259
|
notifyItems() {
|
|
260
|
-
this.itemsArray.forEach((item,
|
|
261
|
-
const isOpen = this.openIndexes.includes(
|
|
260
|
+
this.itemsArray.forEach((item, index2) => {
|
|
261
|
+
const isOpen = this.openIndexes.includes(index2);
|
|
262
262
|
item.setOpenState(isOpen);
|
|
263
263
|
});
|
|
264
264
|
}
|
|
@@ -350,7 +350,7 @@ function initAccordion(rootSelector = `.${PREFIX}-accordion-group`) {
|
|
|
350
350
|
|
|
351
351
|
// src/js/components/stateful/date-picker.js
|
|
352
352
|
var DatePicker = class {
|
|
353
|
-
constructor(selectorOrElement,
|
|
353
|
+
constructor(selectorOrElement, options2 = {}) {
|
|
354
354
|
this.container = typeof selectorOrElement === "string" ? document.querySelector(selectorOrElement) : selectorOrElement;
|
|
355
355
|
if (!this.container) {
|
|
356
356
|
console.warn("[IDDS DatePicker] Container not found:", selectorOrElement);
|
|
@@ -376,7 +376,7 @@ var DatePicker = class {
|
|
|
376
376
|
onChange: null,
|
|
377
377
|
triggerWidth: "",
|
|
378
378
|
panelMaxHeight: "",
|
|
379
|
-
...
|
|
379
|
+
...options2
|
|
380
380
|
};
|
|
381
381
|
this.state = {
|
|
382
382
|
viewDate: /* @__PURE__ */ new Date(),
|
|
@@ -940,11 +940,11 @@ var DatePicker = class {
|
|
|
940
940
|
return this.state.rangeDate;
|
|
941
941
|
}
|
|
942
942
|
};
|
|
943
|
-
function initDatepicker(selectorOrElement,
|
|
943
|
+
function initDatepicker(selectorOrElement, options2 = {}) {
|
|
944
944
|
const elements = typeof selectorOrElement === "string" ? document.querySelectorAll(selectorOrElement) : selectorOrElement ? typeof selectorOrElement.length !== "undefined" ? selectorOrElement : [selectorOrElement] : document.querySelectorAll(`.${PREFIX}-date-picker`);
|
|
945
945
|
const instances = [];
|
|
946
946
|
elements.forEach((container) => {
|
|
947
|
-
const instance = new DatePicker(container,
|
|
947
|
+
const instance = new DatePicker(container, options2);
|
|
948
948
|
container.__datepickerAPI = instance;
|
|
949
949
|
instances.push(instance);
|
|
950
950
|
});
|
|
@@ -954,7 +954,7 @@ function initDatepicker(selectorOrElement, options = {}) {
|
|
|
954
954
|
|
|
955
955
|
// src/js/components/stateful/time-picker.js
|
|
956
956
|
var TimePicker = class {
|
|
957
|
-
constructor(selectorOrElement,
|
|
957
|
+
constructor(selectorOrElement, options2 = {}) {
|
|
958
958
|
this.container = typeof selectorOrElement === "string" ? document.querySelector(selectorOrElement) : selectorOrElement;
|
|
959
959
|
if (!this.container) {
|
|
960
960
|
console.warn("[IDDS TimePicker] Container not found:", selectorOrElement);
|
|
@@ -987,7 +987,7 @@ var TimePicker = class {
|
|
|
987
987
|
secondStep: 1,
|
|
988
988
|
onChange: null,
|
|
989
989
|
size: this.container.dataset.size || "md",
|
|
990
|
-
...
|
|
990
|
+
...options2
|
|
991
991
|
};
|
|
992
992
|
this.state = {
|
|
993
993
|
isOpen: false,
|
|
@@ -1204,24 +1204,24 @@ var TimePicker = class {
|
|
|
1204
1204
|
}
|
|
1205
1205
|
}
|
|
1206
1206
|
generateOptions(type) {
|
|
1207
|
-
const
|
|
1207
|
+
const options2 = [];
|
|
1208
1208
|
const { use12Hours, hourStep, minuteStep, secondStep } = this.options;
|
|
1209
1209
|
let limit = type === "hour" ? use12Hours ? 12 : 24 : 60;
|
|
1210
1210
|
let step = type === "hour" ? hourStep : type === "minute" ? minuteStep : secondStep;
|
|
1211
1211
|
if (limit === 12) {
|
|
1212
1212
|
for (let i = type === "hour" ? 1 : 0; i <= (type === "hour" ? 12 : 59); i += step) {
|
|
1213
|
-
|
|
1213
|
+
options2.push(i);
|
|
1214
1214
|
}
|
|
1215
1215
|
} else if (limit === 24) {
|
|
1216
1216
|
for (let i = 0; i <= 23; i += step) {
|
|
1217
|
-
|
|
1217
|
+
options2.push(i);
|
|
1218
1218
|
}
|
|
1219
1219
|
} else {
|
|
1220
1220
|
for (let i = 0; i <= 59; i += step) {
|
|
1221
|
-
|
|
1221
|
+
options2.push(i);
|
|
1222
1222
|
}
|
|
1223
1223
|
}
|
|
1224
|
-
return
|
|
1224
|
+
return options2;
|
|
1225
1225
|
}
|
|
1226
1226
|
renderColumn(type, optionsArr) {
|
|
1227
1227
|
const column = document.createElement("div");
|
|
@@ -1275,10 +1275,23 @@ var TimePicker = class {
|
|
|
1275
1275
|
option.classList.add(`${PREFIX}-time-picker__option--selected`);
|
|
1276
1276
|
if (isDisabled)
|
|
1277
1277
|
option.classList.add(`${PREFIX}-time-picker__option--disabled`);
|
|
1278
|
+
option.setAttribute("role", "option");
|
|
1279
|
+
option.setAttribute("aria-selected", isSelected.toString());
|
|
1280
|
+
const isFirstFocusable = index === 0 && !options.some((opt) => {
|
|
1281
|
+
if (type === "hour") {
|
|
1282
|
+
return use12Hours ? (currentTime.hours === 0 ? 12 : currentTime.hours) === opt : currentTime.hours === opt;
|
|
1283
|
+
} else if (type === "minute") {
|
|
1284
|
+
return currentTime.minutes === opt;
|
|
1285
|
+
} else if (type === "second") {
|
|
1286
|
+
return currentTime.seconds === opt;
|
|
1287
|
+
}
|
|
1288
|
+
return false;
|
|
1289
|
+
});
|
|
1290
|
+
option.tabIndex = isSelected || isFirstFocusable ? 0 : -1;
|
|
1278
1291
|
option.textContent = optValue.toString().padStart(2, "0");
|
|
1279
1292
|
if (!isDisabled) {
|
|
1280
|
-
|
|
1281
|
-
e
|
|
1293
|
+
const handleSelection = (e) => {
|
|
1294
|
+
e?.stopPropagation();
|
|
1282
1295
|
const val = parseInt(optValue, 10);
|
|
1283
1296
|
if (type === "hour") {
|
|
1284
1297
|
this.state.currentTime.hours = use12Hours && val === 12 ? 0 : val;
|
|
@@ -1289,6 +1302,21 @@ var TimePicker = class {
|
|
|
1289
1302
|
}
|
|
1290
1303
|
this.updateInput();
|
|
1291
1304
|
this.buildPanel();
|
|
1305
|
+
};
|
|
1306
|
+
option.addEventListener("click", handleSelection);
|
|
1307
|
+
option.addEventListener("keydown", (e) => {
|
|
1308
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1309
|
+
e.preventDefault();
|
|
1310
|
+
handleSelection();
|
|
1311
|
+
} else if (e.key === "ArrowDown") {
|
|
1312
|
+
e.preventDefault();
|
|
1313
|
+
const nextElement = e.currentTarget.nextElementSibling;
|
|
1314
|
+
if (nextElement) nextElement.focus();
|
|
1315
|
+
} else if (e.key === "ArrowUp") {
|
|
1316
|
+
e.preventDefault();
|
|
1317
|
+
const prevElement = e.currentTarget.previousElementSibling;
|
|
1318
|
+
if (prevElement) prevElement.focus();
|
|
1319
|
+
}
|
|
1292
1320
|
});
|
|
1293
1321
|
}
|
|
1294
1322
|
colContent.appendChild(option);
|
|
@@ -1316,12 +1344,34 @@ var TimePicker = class {
|
|
|
1316
1344
|
);
|
|
1317
1345
|
if (isDisabled)
|
|
1318
1346
|
option.classList.add(`${PREFIX}-time-picker__option--disabled`);
|
|
1347
|
+
option.setAttribute("role", "option");
|
|
1348
|
+
option.setAttribute(
|
|
1349
|
+
"aria-selected",
|
|
1350
|
+
(this.state.currentTime.period === p).toString()
|
|
1351
|
+
);
|
|
1352
|
+
const isFirstFocusable = p === "AM" && this.state.currentTime.period !== "AM" && this.state.currentTime.period !== "PM";
|
|
1353
|
+
option.tabIndex = this.state.currentTime.period === p || isFirstFocusable ? 0 : -1;
|
|
1319
1354
|
if (!isDisabled) {
|
|
1320
|
-
|
|
1321
|
-
e
|
|
1355
|
+
const handleSelection = (e) => {
|
|
1356
|
+
e?.stopPropagation();
|
|
1322
1357
|
this.state.currentTime.period = p;
|
|
1323
1358
|
this.updateInput();
|
|
1324
1359
|
this.buildPanel();
|
|
1360
|
+
};
|
|
1361
|
+
option.addEventListener("click", handleSelection);
|
|
1362
|
+
option.addEventListener("keydown", (e) => {
|
|
1363
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1364
|
+
e.preventDefault();
|
|
1365
|
+
handleSelection();
|
|
1366
|
+
} else if (e.key === "ArrowDown") {
|
|
1367
|
+
e.preventDefault();
|
|
1368
|
+
const nextElement = e.currentTarget.nextElementSibling;
|
|
1369
|
+
if (nextElement) nextElement.focus();
|
|
1370
|
+
} else if (e.key === "ArrowUp") {
|
|
1371
|
+
e.preventDefault();
|
|
1372
|
+
const prevElement = e.currentTarget.previousElementSibling;
|
|
1373
|
+
if (prevElement) prevElement.focus();
|
|
1374
|
+
}
|
|
1325
1375
|
});
|
|
1326
1376
|
}
|
|
1327
1377
|
colContent.appendChild(option);
|
|
@@ -1402,11 +1452,11 @@ var TimePicker = class {
|
|
|
1402
1452
|
return this.state.internalValue;
|
|
1403
1453
|
}
|
|
1404
1454
|
};
|
|
1405
|
-
function initTimepicker(selectorOrElement,
|
|
1455
|
+
function initTimepicker(selectorOrElement, options2 = {}) {
|
|
1406
1456
|
const elements = typeof selectorOrElement === "string" ? document.querySelectorAll(selectorOrElement) : selectorOrElement ? typeof selectorOrElement.length !== "undefined" ? selectorOrElement : [selectorOrElement] : document.querySelectorAll(`.${PREFIX}-time-picker`);
|
|
1407
1457
|
const instances = [];
|
|
1408
1458
|
elements.forEach((container) => {
|
|
1409
|
-
const instance = new TimePicker(container,
|
|
1459
|
+
const instance = new TimePicker(container, options2);
|
|
1410
1460
|
container.__timepickerAPI = instance;
|
|
1411
1461
|
instances.push(instance);
|
|
1412
1462
|
});
|
|
@@ -1740,9 +1790,9 @@ function updateTriggerUI(root, values, isMultiple) {
|
|
|
1740
1790
|
`.${PREFIX4}-select-dropdown__trigger-text`
|
|
1741
1791
|
);
|
|
1742
1792
|
const placeholder = input ? input.getAttribute("placeholder") : textSpan ? textSpan.getAttribute("data-placeholder") : "Select...";
|
|
1743
|
-
const
|
|
1793
|
+
const options2 = root.querySelectorAll(`.${PREFIX4}-select-dropdown__option`);
|
|
1744
1794
|
const getLabel = (val) => {
|
|
1745
|
-
const opt = Array.from(
|
|
1795
|
+
const opt = Array.from(options2).find(
|
|
1746
1796
|
(o) => o.getAttribute("data-value") === val
|
|
1747
1797
|
);
|
|
1748
1798
|
return opt ? opt.textContent.trim() : val;
|
|
@@ -1768,7 +1818,7 @@ function updateTriggerUI(root, values, isMultiple) {
|
|
|
1768
1818
|
values.length === 0
|
|
1769
1819
|
);
|
|
1770
1820
|
}
|
|
1771
|
-
|
|
1821
|
+
options2.forEach((opt) => {
|
|
1772
1822
|
const val = opt.getAttribute("data-value");
|
|
1773
1823
|
const isSelected = values.includes(val);
|
|
1774
1824
|
if (isMultiple) {
|
|
@@ -1848,13 +1898,13 @@ function initSelectDropdown() {
|
|
|
1848
1898
|
const root = e.target.closest(`.${PREFIX4}-select-dropdown`);
|
|
1849
1899
|
if (root) {
|
|
1850
1900
|
const term = e.target.value.toLowerCase();
|
|
1851
|
-
const
|
|
1901
|
+
const options2 = root.querySelectorAll(
|
|
1852
1902
|
`.${PREFIX4}-select-dropdown__option`
|
|
1853
1903
|
);
|
|
1854
1904
|
if (root.getAttribute("data-state") !== "open") {
|
|
1855
1905
|
setDropdownState(root, { isOpen: true });
|
|
1856
1906
|
}
|
|
1857
|
-
|
|
1907
|
+
options2.forEach((opt) => {
|
|
1858
1908
|
const text = opt.textContent.trim().toLowerCase();
|
|
1859
1909
|
opt.style.display = text.includes(term) ? "" : "none";
|
|
1860
1910
|
});
|
|
@@ -1928,20 +1978,20 @@ function initStepper() {
|
|
|
1928
1978
|
`;
|
|
1929
1979
|
const updateUI = () => {
|
|
1930
1980
|
stepper.dataset.currentStep = currentStep;
|
|
1931
|
-
items.forEach((item,
|
|
1981
|
+
items.forEach((item, index2) => {
|
|
1932
1982
|
const iconWrapper = item.querySelector(
|
|
1933
1983
|
`.${PREFIX}-stepper__icon-wrapper`
|
|
1934
1984
|
);
|
|
1935
|
-
const itemNumber =
|
|
1985
|
+
const itemNumber = index2 + 1;
|
|
1936
1986
|
item.classList.remove(
|
|
1937
1987
|
`${PREFIX}-stepper__item--completed`,
|
|
1938
1988
|
`${PREFIX}-stepper__item--active`
|
|
1939
1989
|
);
|
|
1940
1990
|
if (iconWrapper) iconWrapper.innerHTML = "";
|
|
1941
|
-
if (
|
|
1991
|
+
if (index2 < currentStep) {
|
|
1942
1992
|
item.classList.add(`${PREFIX}-stepper__item--completed`);
|
|
1943
1993
|
if (iconWrapper) iconWrapper.innerHTML = checkIcon;
|
|
1944
|
-
} else if (
|
|
1994
|
+
} else if (index2 === currentStep) {
|
|
1945
1995
|
item.classList.add(`${PREFIX}-stepper__item--active`);
|
|
1946
1996
|
if (iconWrapper)
|
|
1947
1997
|
iconWrapper.innerHTML = `<span class="${PREFIX}-stepper__step-number">${itemNumber}</span>`;
|
|
@@ -1950,8 +2000,8 @@ function initStepper() {
|
|
|
1950
2000
|
iconWrapper.innerHTML = `<span class="${PREFIX}-stepper__step-number">${itemNumber}</span>`;
|
|
1951
2001
|
}
|
|
1952
2002
|
});
|
|
1953
|
-
separators.forEach((separator,
|
|
1954
|
-
if (
|
|
2003
|
+
separators.forEach((separator, index2) => {
|
|
2004
|
+
if (index2 < currentStep) {
|
|
1955
2005
|
separator.classList.add(`${PREFIX}-stepper__separator--completed`);
|
|
1956
2006
|
} else {
|
|
1957
2007
|
separator.classList.remove(`${PREFIX}-stepper__separator--completed`);
|
|
@@ -1997,11 +2047,11 @@ function initStepper() {
|
|
|
1997
2047
|
}
|
|
1998
2048
|
});
|
|
1999
2049
|
});
|
|
2000
|
-
items.forEach((item,
|
|
2050
|
+
items.forEach((item, index2) => {
|
|
2001
2051
|
if (item.classList.contains(`${PREFIX}-stepper__item--clickable`) || item.hasAttribute("data-clickable")) {
|
|
2002
2052
|
item.addEventListener("click", () => {
|
|
2003
2053
|
if (!item.classList.contains(`${PREFIX}-stepper__item--disabled`)) {
|
|
2004
|
-
currentStep =
|
|
2054
|
+
currentStep = index2;
|
|
2005
2055
|
updateUI();
|
|
2006
2056
|
}
|
|
2007
2057
|
});
|
|
@@ -2075,7 +2125,7 @@ function initFileUpload(rootSelector = `.${PREFIX}-file-upload`) {
|
|
|
2075
2125
|
} else {
|
|
2076
2126
|
filesContainer.style.display = "none";
|
|
2077
2127
|
}
|
|
2078
|
-
uploadedFiles.forEach((f,
|
|
2128
|
+
uploadedFiles.forEach((f, index2) => {
|
|
2079
2129
|
const fileEl = document.createElement("div");
|
|
2080
2130
|
fileEl.className = `${PREFIX}-file-upload__file`;
|
|
2081
2131
|
let statusClass = "";
|
|
@@ -3349,7 +3399,7 @@ function initTabHorizontal() {
|
|
|
3349
3399
|
|
|
3350
3400
|
// src/js/components/stateful/table.js
|
|
3351
3401
|
var Table = class {
|
|
3352
|
-
constructor(selectorOrElement,
|
|
3402
|
+
constructor(selectorOrElement, options2 = {}) {
|
|
3353
3403
|
this.container = typeof selectorOrElement === "string" ? document.querySelector(selectorOrElement) : selectorOrElement;
|
|
3354
3404
|
if (!this.container) {
|
|
3355
3405
|
console.warn("[IDDS Table] Container not found:", selectorOrElement);
|
|
@@ -3381,7 +3431,7 @@ var Table = class {
|
|
|
3381
3431
|
searchContainer: null,
|
|
3382
3432
|
searchButton: null,
|
|
3383
3433
|
onSearch: null,
|
|
3384
|
-
...
|
|
3434
|
+
...options2
|
|
3385
3435
|
};
|
|
3386
3436
|
this.state = {
|
|
3387
3437
|
currentPage: this.options.initialPage,
|
|
@@ -3586,7 +3636,7 @@ var Table = class {
|
|
|
3586
3636
|
this.updateSelectAllState();
|
|
3587
3637
|
return;
|
|
3588
3638
|
}
|
|
3589
|
-
rowData.forEach((row,
|
|
3639
|
+
rowData.forEach((row, index2) => {
|
|
3590
3640
|
const tr = document.createElement("tr");
|
|
3591
3641
|
tr.className = `${PREFIX}-table__row`;
|
|
3592
3642
|
if (this.options.rowClickable) {
|
|
@@ -3597,11 +3647,11 @@ var Table = class {
|
|
|
3597
3647
|
return;
|
|
3598
3648
|
}
|
|
3599
3649
|
if (typeof this.options.onRowClick === "function") {
|
|
3600
|
-
this.options.onRowClick(row,
|
|
3650
|
+
this.options.onRowClick(row, index2);
|
|
3601
3651
|
}
|
|
3602
3652
|
});
|
|
3603
3653
|
}
|
|
3604
|
-
const rowKeyStr = String(row[this.options.rowKey] ||
|
|
3654
|
+
const rowKeyStr = String(row[this.options.rowKey] || index2);
|
|
3605
3655
|
if (this.options.selectable) {
|
|
3606
3656
|
const td = document.createElement("td");
|
|
3607
3657
|
td.className = `${PREFIX}-table__cell`;
|
|
@@ -3627,7 +3677,7 @@ var Table = class {
|
|
|
3627
3677
|
const td = document.createElement("td");
|
|
3628
3678
|
td.className = `${PREFIX}-table__cell`;
|
|
3629
3679
|
if (typeof col.render === "function") {
|
|
3630
|
-
const content = col.render(row,
|
|
3680
|
+
const content = col.render(row, index2);
|
|
3631
3681
|
if (typeof content === "string") {
|
|
3632
3682
|
td.innerHTML = content;
|
|
3633
3683
|
} else if (content instanceof HTMLElement) {
|
|
@@ -3861,8 +3911,8 @@ var Table = class {
|
|
|
3861
3911
|
this.triggerSelectionChange();
|
|
3862
3912
|
}
|
|
3863
3913
|
toggleAllSelection(checked) {
|
|
3864
|
-
this.state.currentData.forEach((row,
|
|
3865
|
-
const keyStr = String(row[this.options.rowKey] ||
|
|
3914
|
+
this.state.currentData.forEach((row, index2) => {
|
|
3915
|
+
const keyStr = String(row[this.options.rowKey] || index2);
|
|
3866
3916
|
if (checked) {
|
|
3867
3917
|
this.state.selectedKeys.add(keyStr);
|
|
3868
3918
|
this.state.selectedRows.set(keyStr, row);
|
|
@@ -3943,11 +3993,11 @@ var Table = class {
|
|
|
3943
3993
|
};
|
|
3944
3994
|
}
|
|
3945
3995
|
};
|
|
3946
|
-
function initTable(selectorOrElement,
|
|
3996
|
+
function initTable(selectorOrElement, options2 = {}) {
|
|
3947
3997
|
const elements = typeof selectorOrElement === "string" ? document.querySelectorAll(selectorOrElement) : selectorOrElement ? typeof selectorOrElement.length !== "undefined" ? selectorOrElement : [selectorOrElement] : document.querySelectorAll(`.${PREFIX}-table`);
|
|
3948
3998
|
const instances = [];
|
|
3949
3999
|
elements.forEach((container) => {
|
|
3950
|
-
const instance = new Table(container,
|
|
4000
|
+
const instance = new Table(container, options2);
|
|
3951
4001
|
container.__tableAPI = instance;
|
|
3952
4002
|
instances.push(instance);
|
|
3953
4003
|
});
|
|
@@ -3998,7 +4048,7 @@ function createToastElement({ title, message, state, style, actionHtml }) {
|
|
|
3998
4048
|
return { toastItem, toast };
|
|
3999
4049
|
}
|
|
4000
4050
|
function showToast(optionsOrMessage, variant = "default", duration = 5e3) {
|
|
4001
|
-
const
|
|
4051
|
+
const options2 = typeof optionsOrMessage === "string" ? {
|
|
4002
4052
|
message: optionsOrMessage,
|
|
4003
4053
|
state: variant,
|
|
4004
4054
|
duration
|
|
@@ -4011,7 +4061,7 @@ function showToast(optionsOrMessage, variant = "default", duration = 5e3) {
|
|
|
4011
4061
|
duration: autoCloseDuration = 5e3,
|
|
4012
4062
|
position = "top-right",
|
|
4013
4063
|
actionHtml = ""
|
|
4014
|
-
} =
|
|
4064
|
+
} = options2;
|
|
4015
4065
|
const container = getOrCreateContainer(position);
|
|
4016
4066
|
const { toastItem, toast } = createToastElement({
|
|
4017
4067
|
title,
|