fix(structure): 允许清除已删除字段的索引引用
Co-authored-by: zipg <4047349+zipg@users.noreply.github.com>
This commit is contained in:
1 parent
e1822cb704
commit
51dedaa5b7
3 files changed
+23
-7
No files matched your search
@@ -777,6 +777,15 @@ export function sameStructureIndexType(left: string | null | undefined, right: s
|
||||
return normalizeStructureIndexType(left) === normalizeStructureIndexType(right);
|
||||
}
|
||||
|
||||
/** Keep selected fields removable even after they are no longer available on the table. */
|
||||
export function filterStructureIndexColumnOptions(availableColumns: readonly string[], selectedColumns: readonly string[], search = ""): string[] {
|
||||
const availableSet = new Set(availableColumns);
|
||||
const unavailableSelected = selectedColumns.filter((column) => column.trim() && !availableSet.has(column));
|
||||
const options = [...new Set([...unavailableSelected, ...availableColumns])];
|
||||
const query = search.trim().toLowerCase();
|
||||
return query ? options.filter((column) => column.toLowerCase().includes(query)) : options;
|
||||
}
|
||||
|
||||
export function createIndexDrafts(indexes: IndexInfo[]): EditableStructureIndex[] {
|
||||
return indexes.map((index) => ({
|
||||
id: `existing:${index.name}`,
|
||||
|
||||
Reference in new issue
Block a user