This commit is contained in:
JenniferW 2025-12-19 13:53:11 +08:00
parent 87b9e02019
commit f0e269145f
1 changed files with 35 additions and 2 deletions

View File

@ -1364,10 +1364,14 @@ const fetchSearchHints = async (keyword) => {
mergeFieldMetadata(hintList); mergeFieldMetadata(hintList);
// "" // ""
// // 使
const parts = currentInput.value.split(/[;]/); const parts = currentInput.value.split(/[;]/);
const currentPart = parts[parts.length - 1]?.trim() || "";
const cursorIndex = findCursorConditionIndex(); const cursorIndex = findCursorConditionIndex();
const activeIndex =
cursorIndex >= 0 && cursorIndex < parts.length
? cursorIndex
: parts.length - 1;
const currentPart = parts[activeIndex]?.trim() || "";
const isEditingExistingField = const isEditingExistingField =
cursorIndex >= 0 && cursorIndex < parts.length - 1; cursorIndex >= 0 && cursorIndex < parts.length - 1;
@ -1425,11 +1429,40 @@ const fetchSearchHints = async (keyword) => {
? currentPart.split(":").slice(1).join(":").trim() ? currentPart.split(":").slice(1).join(":").trim()
: currentPart; : currentPart;
const valueQueryLower = (valueQuery || "").toLowerCase(); const valueQueryLower = (valueQuery || "").toLowerCase();
// ":"
let activeFieldKey = "";
if (currentPart.includes(":")) {
const fieldLabel = currentPart.split(":")[0].trim();
//
const localField = allFields.value.find(
(f) => f.label === fieldLabel || f.key === fieldLabel
);
if (localField) {
activeFieldKey = localField.key;
} else {
//
const apiField = hintList.find(
(item) =>
item.fieldName === fieldLabel ||
item.fieldKey === fieldLabel ||
item.label === fieldLabel
);
if (apiField) {
activeFieldKey = apiField.fieldKey || apiField.key || "";
}
}
}
const matchedValueSuggestions = []; const matchedValueSuggestions = [];
const fallbackValueSuggestions = []; const fallbackValueSuggestions = [];
hintList.forEach((item) => { hintList.forEach((item) => {
if (!Array.isArray(item.fieldValues)) return; if (!Array.isArray(item.fieldValues)) return;
const fieldKey = item.fieldKey || item.key || ""; const fieldKey = item.fieldKey || item.key || "";
//
if (activeFieldKey && fieldKey !== activeFieldKey) return;
const fieldLabel = item.fieldName || item.label || item.fieldLabel || ""; const fieldLabel = item.fieldName || item.label || item.fieldLabel || "";
item.fieldValues.forEach((val) => { item.fieldValues.forEach((val) => {
const strVal = const strVal =