@idds/js 1.6.3 → 1.6.5
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 +21 -1
- package/dist/index.js +21 -1
- package/package.json +1 -1
package/dist/index.iife.js
CHANGED
|
@@ -1959,7 +1959,8 @@ var InaUI = (() => {
|
|
|
1959
1959
|
isOpen: root.getAttribute("data-state") === "open",
|
|
1960
1960
|
values: JSON.parse(root.getAttribute("data-values") || "[]"),
|
|
1961
1961
|
isMultiple: root.getAttribute("data-multiple") === "true",
|
|
1962
|
-
isSearchable: root.getAttribute("data-searchable") !== "false"
|
|
1962
|
+
isSearchable: root.getAttribute("data-searchable") !== "false",
|
|
1963
|
+
mandatorySelected: root.getAttribute("data-mandatory-selected") === "true"
|
|
1963
1964
|
};
|
|
1964
1965
|
}
|
|
1965
1966
|
function setDropdownState(root, newState) {
|
|
@@ -2090,12 +2091,19 @@ var InaUI = (() => {
|
|
|
2090
2091
|
let newValues = [...state.values];
|
|
2091
2092
|
if (state.isMultiple) {
|
|
2092
2093
|
if (newValues.includes(val)) {
|
|
2094
|
+
if (state.mandatorySelected && newValues.length <= 1) {
|
|
2095
|
+
return;
|
|
2096
|
+
}
|
|
2093
2097
|
newValues = newValues.filter((v) => v !== val);
|
|
2094
2098
|
} else {
|
|
2095
2099
|
newValues.push(val);
|
|
2096
2100
|
}
|
|
2097
2101
|
setDropdownState(root, { values: newValues });
|
|
2098
2102
|
} else {
|
|
2103
|
+
if (state.mandatorySelected && state.values.includes(val)) {
|
|
2104
|
+
setDropdownState(root, { isOpen: false });
|
|
2105
|
+
return;
|
|
2106
|
+
}
|
|
2099
2107
|
newValues = [val];
|
|
2100
2108
|
setDropdownState(root, { values: newValues, isOpen: false });
|
|
2101
2109
|
}
|
|
@@ -4262,6 +4270,12 @@ var InaUI = (() => {
|
|
|
4262
4270
|
} else {
|
|
4263
4271
|
th.textContent = col.header;
|
|
4264
4272
|
}
|
|
4273
|
+
if (col.className) {
|
|
4274
|
+
th.classList.add(col.className);
|
|
4275
|
+
}
|
|
4276
|
+
if (col.width) {
|
|
4277
|
+
th.style.width = typeof col.width === "number" ? `${col.width}px` : col.width;
|
|
4278
|
+
}
|
|
4265
4279
|
this.elements.theadTr.appendChild(th);
|
|
4266
4280
|
});
|
|
4267
4281
|
}
|
|
@@ -4368,6 +4382,12 @@ var InaUI = (() => {
|
|
|
4368
4382
|
} else {
|
|
4369
4383
|
td.textContent = row[col.accessor] !== void 0 && row[col.accessor] !== null ? row[col.accessor] : "";
|
|
4370
4384
|
}
|
|
4385
|
+
if (col.className) {
|
|
4386
|
+
td.classList.add(col.className);
|
|
4387
|
+
}
|
|
4388
|
+
if (col.width) {
|
|
4389
|
+
td.style.width = typeof col.width === "number" ? `${col.width}px` : col.width;
|
|
4390
|
+
}
|
|
4371
4391
|
tr.appendChild(td);
|
|
4372
4392
|
});
|
|
4373
4393
|
this.elements.tbody.appendChild(tr);
|
package/dist/index.js
CHANGED
|
@@ -2070,7 +2070,8 @@ function getDropdownState(root) {
|
|
|
2070
2070
|
isOpen: root.getAttribute("data-state") === "open",
|
|
2071
2071
|
values: JSON.parse(root.getAttribute("data-values") || "[]"),
|
|
2072
2072
|
isMultiple: root.getAttribute("data-multiple") === "true",
|
|
2073
|
-
isSearchable: root.getAttribute("data-searchable") !== "false"
|
|
2073
|
+
isSearchable: root.getAttribute("data-searchable") !== "false",
|
|
2074
|
+
mandatorySelected: root.getAttribute("data-mandatory-selected") === "true"
|
|
2074
2075
|
};
|
|
2075
2076
|
}
|
|
2076
2077
|
function setDropdownState(root, newState) {
|
|
@@ -2201,12 +2202,19 @@ function initSelectDropdown() {
|
|
|
2201
2202
|
let newValues = [...state.values];
|
|
2202
2203
|
if (state.isMultiple) {
|
|
2203
2204
|
if (newValues.includes(val)) {
|
|
2205
|
+
if (state.mandatorySelected && newValues.length <= 1) {
|
|
2206
|
+
return;
|
|
2207
|
+
}
|
|
2204
2208
|
newValues = newValues.filter((v) => v !== val);
|
|
2205
2209
|
} else {
|
|
2206
2210
|
newValues.push(val);
|
|
2207
2211
|
}
|
|
2208
2212
|
setDropdownState(root, { values: newValues });
|
|
2209
2213
|
} else {
|
|
2214
|
+
if (state.mandatorySelected && state.values.includes(val)) {
|
|
2215
|
+
setDropdownState(root, { isOpen: false });
|
|
2216
|
+
return;
|
|
2217
|
+
}
|
|
2210
2218
|
newValues = [val];
|
|
2211
2219
|
setDropdownState(root, { values: newValues, isOpen: false });
|
|
2212
2220
|
}
|
|
@@ -4373,6 +4381,12 @@ var Table = class {
|
|
|
4373
4381
|
} else {
|
|
4374
4382
|
th.textContent = col.header;
|
|
4375
4383
|
}
|
|
4384
|
+
if (col.className) {
|
|
4385
|
+
th.classList.add(col.className);
|
|
4386
|
+
}
|
|
4387
|
+
if (col.width) {
|
|
4388
|
+
th.style.width = typeof col.width === "number" ? `${col.width}px` : col.width;
|
|
4389
|
+
}
|
|
4376
4390
|
this.elements.theadTr.appendChild(th);
|
|
4377
4391
|
});
|
|
4378
4392
|
}
|
|
@@ -4479,6 +4493,12 @@ var Table = class {
|
|
|
4479
4493
|
} else {
|
|
4480
4494
|
td.textContent = row[col.accessor] !== void 0 && row[col.accessor] !== null ? row[col.accessor] : "";
|
|
4481
4495
|
}
|
|
4496
|
+
if (col.className) {
|
|
4497
|
+
td.classList.add(col.className);
|
|
4498
|
+
}
|
|
4499
|
+
if (col.width) {
|
|
4500
|
+
td.style.width = typeof col.width === "number" ? `${col.width}px` : col.width;
|
|
4501
|
+
}
|
|
4482
4502
|
tr.appendChild(td);
|
|
4483
4503
|
});
|
|
4484
4504
|
this.elements.tbody.appendChild(tr);
|