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