add: quaternaryKey

This commit is contained in:
2026-02-10 16:49:48 +03:30
parent f8e8e7f1f1
commit 763d5b79d3

View File

@@ -16,6 +16,7 @@ type FormEnterLocationsProps = {
keyField?: string;
secondaryKey?: string | string[];
tertiaryKey?: string | string[];
quaternaryKey?: string | string[];
valueField?: string | string[];
valueField2?: string | string[];
valueField3?: string | string[];
@@ -40,6 +41,7 @@ export const FormApiBasedAutoComplete = ({
keyField = "id",
secondaryKey,
tertiaryKey,
quaternaryKey,
valueField = "name",
valueField2,
valueField3,
@@ -113,6 +115,11 @@ export const FormApiBasedAutoComplete = ({
? option[tertiaryKey]
: getNestedValue(option, tertiaryKey)
: undefined,
quaternaryKey: quaternaryKey
? typeof quaternaryKey === "string"
? option[quaternaryKey]
: getNestedValue(option, quaternaryKey)
: undefined,
value: valueTemplate
? valueTemplate
.replace(
@@ -239,6 +246,11 @@ export const FormApiBasedAutoComplete = ({
key3: item?.tertiaryKey,
}
: {}),
...(quaternaryKey
? {
key4: item?.quaternaryKey,
}
: {}),
};
}),
);
@@ -270,6 +282,9 @@ export const FormApiBasedAutoComplete = ({
key1: defaultItem.key,
key2: defaultItem.secondaryKey,
...(tertiaryKey ? { key3: defaultItem.tertiaryKey } : {}),
...(quaternaryKey
? { key4: defaultItem.quaternaryKey }
: {}),
});
} else {
onChange(keyToFind);
@@ -280,6 +295,7 @@ export const FormApiBasedAutoComplete = ({
key1: defaultItem.key,
key2: defaultItem.secondaryKey,
...(tertiaryKey ? { key3: defaultItem.tertiaryKey } : {}),
...(quaternaryKey ? { key4: defaultItem.quaternaryKey } : {}),
value: defaultItem.value.trim(),
});
}
@@ -331,6 +347,7 @@ export const FormApiBasedAutoComplete = ({
key1: item.key,
key2: item.secondaryKey,
...(tertiaryKey ? { key3: item.tertiaryKey } : {}),
...(quaternaryKey ? { key4: item.quaternaryKey } : {}),
})),
);
if (onChangeValue) {
@@ -368,6 +385,7 @@ export const FormApiBasedAutoComplete = ({
key1: item.key,
key2: item.secondaryKey,
...(tertiaryKey ? { key3: item.tertiaryKey } : {}),
...(quaternaryKey ? { key4: item.quaternaryKey } : {}),
})),
);
if (onChangeValue) {
@@ -397,6 +415,9 @@ export const FormApiBasedAutoComplete = ({
...(tertiaryKey
? { key3: selectedItem?.tertiaryKey ?? "" }
: {}),
...(quaternaryKey
? { key4: selectedItem?.quaternaryKey ?? "" }
: {}),
});
}
@@ -405,6 +426,9 @@ export const FormApiBasedAutoComplete = ({
key1: selectedItem.key,
key2: selectedItem.secondaryKey,
...(tertiaryKey ? { key3: selectedItem.tertiaryKey } : {}),
...(quaternaryKey
? { key4: selectedItem.quaternaryKey }
: {}),
});
}
} else {