From 763d5b79d34f97bd14a549fce6e329213a6cdc00 Mon Sep 17 00:00:00 2001 From: wixarm Date: Tue, 10 Feb 2026 16:49:48 +0330 Subject: [PATCH] add: quaternaryKey --- .../FormItems/FormApiBasedAutoComplete.tsx | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/components/FormItems/FormApiBasedAutoComplete.tsx b/src/components/FormItems/FormApiBasedAutoComplete.tsx index b0ac885..8ec645c 100644 --- a/src/components/FormItems/FormApiBasedAutoComplete.tsx +++ b/src/components/FormItems/FormApiBasedAutoComplete.tsx @@ -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 {