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