@fkui/vue 6.32.1 → 6.33.0
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/cjs/index.cjs.js +26 -33
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/esm/index.esm.js +26 -33
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/types/index.d.ts +13 -2
- package/package.json +5 -5
package/dist/esm/index.esm.js
CHANGED
|
@@ -6883,49 +6883,42 @@ function setInternalKey(item, value) {
|
|
|
6883
6883
|
Object.defineProperty(item, internalKey, {
|
|
6884
6884
|
value: value !== null && value !== void 0 ? value : String(internalIndex++),
|
|
6885
6885
|
enumerable: false,
|
|
6886
|
-
writable:
|
|
6886
|
+
writable: false
|
|
6887
6887
|
});
|
|
6888
6888
|
}
|
|
6889
|
-
function setInternalKeys(items,
|
|
6890
|
-
if (key === void 0) {
|
|
6891
|
-
return items.map((item) => {
|
|
6892
|
-
setInternalKey(item);
|
|
6893
|
-
if (nestedKey !== void 0) {
|
|
6894
|
-
const nestedItem = item[nestedKey];
|
|
6895
|
-
if (Array.isArray(nestedItem)) {
|
|
6896
|
-
setInternalKeys(nestedItem);
|
|
6897
|
-
}
|
|
6898
|
-
}
|
|
6899
|
-
return item;
|
|
6900
|
-
});
|
|
6901
|
-
}
|
|
6889
|
+
function setInternalKeys(items, keyAttribute, expandableAttribute, seenValues = /* @__PURE__ */ new Set()) {
|
|
6902
6890
|
return items.map((item, index) => {
|
|
6903
|
-
const value = item[
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
/* eslint-disable-next-line @typescript-eslint/no-base-to-string -- ok since we only test if the string is empty */
|
|
6907
|
-
value === void 0 || value === null || String(value).length === 0
|
|
6908
|
-
);
|
|
6909
|
-
if (invalidValue) {
|
|
6910
|
-
throw new Error(`Key [${keyString}] is missing or has invalid value in item index ${String(index)}`);
|
|
6891
|
+
const value = keyAttribute ? item[keyAttribute] : void 0;
|
|
6892
|
+
if (keyAttribute) {
|
|
6893
|
+
ensureUniqueKey(keyAttribute, value, index, seenValues);
|
|
6911
6894
|
}
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
`Expected each item to have key [${keyString}] with unique value but encountered duplicate of "${String(value)}" in item index ${String(index)}.`
|
|
6916
|
-
);
|
|
6917
|
-
}
|
|
6918
|
-
setInternalKey(item, String(value));
|
|
6919
|
-
seenValues.add(value);
|
|
6920
|
-
if (nestedKey !== void 0) {
|
|
6921
|
-
const nestedItem = item[nestedKey];
|
|
6895
|
+
setInternalKey(item, value);
|
|
6896
|
+
if (expandableAttribute !== void 0) {
|
|
6897
|
+
const nestedItem = item[expandableAttribute];
|
|
6922
6898
|
if (Array.isArray(nestedItem)) {
|
|
6923
|
-
setInternalKeys(nestedItem,
|
|
6899
|
+
setInternalKeys(nestedItem, keyAttribute, expandableAttribute, seenValues);
|
|
6924
6900
|
}
|
|
6925
6901
|
}
|
|
6926
6902
|
return item;
|
|
6927
6903
|
});
|
|
6928
6904
|
}
|
|
6905
|
+
function ensureUniqueKey(keyAttribute, value, index, seenValues) {
|
|
6906
|
+
const keyString = String(keyAttribute);
|
|
6907
|
+
const invalidValue = (
|
|
6908
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string -- technical debt
|
|
6909
|
+
value === void 0 || value === null || String(value).length === 0
|
|
6910
|
+
);
|
|
6911
|
+
if (invalidValue) {
|
|
6912
|
+
throw new Error(`Key [${keyString}] is missing or has invalid value in item index ${String(index)}`);
|
|
6913
|
+
}
|
|
6914
|
+
if (seenValues.has(value)) {
|
|
6915
|
+
throw new Error(
|
|
6916
|
+
/* eslint-disable-next-line @typescript-eslint/no-base-to-string -- technical debt */
|
|
6917
|
+
`Expected each item to have key [${keyString}] with unique value but encountered duplicate of "${String(value)}" in item index ${String(index)}.`
|
|
6918
|
+
);
|
|
6919
|
+
}
|
|
6920
|
+
seenValues.add(value);
|
|
6921
|
+
}
|
|
6929
6922
|
function getValidatableElement(element) {
|
|
6930
6923
|
if (isValidatableHTMLElement(element)) {
|
|
6931
6924
|
return element;
|