feat(web): el selector de artículo de una línea admite varios (el primero completa la línea, los demás se insertan debajo)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1528f7cb96
commit
45c0ca536e
5 files changed
+37
-1
No files matched your search
@@ -55,6 +55,7 @@ export class LinesGrid {
|
||||
protected readonly lookupTarget = signal<LookupTarget | null>(null);
|
||||
protected readonly multiOpen = signal(false);
|
||||
protected readonly lookup = computed(() => this.lookupTarget()?.column.lookup?.config);
|
||||
protected readonly lookupMultiple = computed(() => !!this.lookupTarget()?.column.lookup?.multiple);
|
||||
|
||||
protected cellText(line: GridLine, column: GridColumn): string {
|
||||
if (column.format) return column.format(line);
|
||||
@@ -216,7 +217,15 @@ export class LinesGrid {
|
||||
const picked = rows[0];
|
||||
const line = target ? this.lines()[target.row] : undefined;
|
||||
if (!target || !picked || !line || !target.column.lookup) return;
|
||||
this.replace(target.row, target.column.lookup.apply(picked, line), target.column.key);
|
||||
const lookup = target.column.lookup;
|
||||
this.replace(target.row, lookup.apply(picked, line), target.column.key);
|
||||
const rest = rows.slice(1).map((r) => {
|
||||
const added = lookup.apply(r, this.newLine()());
|
||||
return this.recalc()?.(added, target.column.key) ?? added;
|
||||
});
|
||||
if (rest.length) {
|
||||
this.lines.update((ls) => [...ls.slice(0, target.row + 1), ...rest, ...ls.slice(target.row + 1)]);
|
||||
}
|
||||
}
|
||||
|
||||
protected lookupClosed(): void {
|
||||
|
||||
Reference in new issue
Block a user