feat(ags): add setup_list func for sorted list
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
7600d2f4cf
commit
9c91d8634f
1 changed files with 5 additions and 2 deletions
|
@ -14,12 +14,13 @@ type MakeChild = ReturnType<typeof makeChild>;
|
||||||
type SortedListProps<Attr = unknown, Self = SortedList<Attr>> =
|
type SortedListProps<Attr = unknown, Self = SortedList<Attr>> =
|
||||||
PopupWindowProps<MakeChild['child'], Attr, Self> & {
|
PopupWindowProps<MakeChild['child'], Attr, Self> & {
|
||||||
on_select: (row: ListBoxRow) => void;
|
on_select: (row: ListBoxRow) => void;
|
||||||
init_rows: (list: MakeChild['list']) => void;
|
init_rows?: (list: MakeChild['list']) => void;
|
||||||
set_sort: (
|
set_sort: (
|
||||||
text: string,
|
text: string,
|
||||||
list: MakeChild['list'],
|
list: MakeChild['list'],
|
||||||
placeholder: MakeChild['placeholder'],
|
placeholder: MakeChild['placeholder'],
|
||||||
) => void;
|
) => void;
|
||||||
|
setup_list?: (list: MakeChild['list']) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
|
@ -145,8 +146,9 @@ export class SortedList<
|
||||||
|
|
||||||
constructor({
|
constructor({
|
||||||
on_select,
|
on_select,
|
||||||
init_rows,
|
init_rows = () => { /**/ },
|
||||||
set_sort,
|
set_sort,
|
||||||
|
setup_list = () => { /**/ },
|
||||||
on_open = () => { /**/ },
|
on_open = () => { /**/ },
|
||||||
class_name = '',
|
class_name = '',
|
||||||
keymode = 'on-demand',
|
keymode = 'on-demand',
|
||||||
|
@ -185,6 +187,7 @@ export class SortedList<
|
||||||
};
|
};
|
||||||
// TODO: add on_accept where it just selects the first visible one
|
// TODO: add on_accept where it just selects the first visible one
|
||||||
|
|
||||||
|
setup_list(this._list);
|
||||||
this._init_rows(this._list);
|
this._init_rows(this._list);
|
||||||
this._set_sort('', this._list, this._placeholder);
|
this._set_sort('', this._list, this._placeholder);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue