This commit is contained in:
anatawa12 2025-09-12 15:33:59 +09:00 committed by GitHub
commit ee68176331
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 9 additions and 8 deletions

View File

@ -77,7 +77,7 @@ type Select = {
sectionTitle: string; sectionTitle: string;
items: SelectItem[]; items: SelectItem[];
})[]; })[];
default: string | null; default: any | null;
}; };
type Result = string | number | true | null; type Result = string | number | true | null;

View File

@ -511,7 +511,7 @@ type SelectItem<C> = {
export function select<C = unknown>(props: { export function select<C = unknown>(props: {
title?: string; title?: string;
text?: string; text?: string;
default: string; default: C;
items: (SelectItem<C> | { items: (SelectItem<C> | {
sectionTitle: string; sectionTitle: string;
items: SelectItem<C>[]; items: SelectItem<C>[];
@ -524,7 +524,7 @@ export function select<C = unknown>(props: {
export function select<C = unknown>(props: { export function select<C = unknown>(props: {
title?: string; title?: string;
text?: string; text?: string;
default?: string | null; default?: C | null;
items: (SelectItem<C> | { items: (SelectItem<C> | {
sectionTitle: string; sectionTitle: string;
items: SelectItem<C>[]; items: SelectItem<C>[];
@ -537,7 +537,7 @@ export function select<C = unknown>(props: {
export function select<C = unknown>(props: { export function select<C = unknown>(props: {
title?: string; title?: string;
text?: string; text?: string;
default?: string | null; default?: C | null;
items: (SelectItem<C> | { items: (SelectItem<C> | {
sectionTitle: string; sectionTitle: string;
items: SelectItem<C>[]; items: SelectItem<C>[];

View File

@ -62,7 +62,7 @@ async function setAntenna() {
})), })),
} : undefined), } : undefined),
], ],
default: props.column.antennaId, default: antennas.find(x => x.id === props.column.antennaId),
}); });
if (canceled || antenna == null) return; if (canceled || antenna == null) return;

View File

@ -63,7 +63,7 @@ async function setChannel() {
items: channels.map(x => ({ items: channels.map(x => ({
value: x, text: x.name, value: x, text: x.name,
})), })),
default: props.column.channelId, default: channels.find(x => x.id === props.column.channelId),
}); });
if (canceled || chosenChannel == null) return; if (canceled || chosenChannel == null) return;
updateColumn(props.column.id, { updateColumn(props.column.id, {

View File

@ -69,7 +69,7 @@ async function setList() {
})), })),
} : undefined), } : undefined),
], ],
default: props.column.listId, default: lists.find(x => x.id === props.column.listId),
}); });
if (canceled || list == null) return; if (canceled || list == null) return;

View File

@ -54,7 +54,7 @@ async function setRole() {
items: roles.map(x => ({ items: roles.map(x => ({
value: x, text: x.name, value: x, text: x.name,
})), })),
default: props.column.roleId, default: roles.find(x => x.id === props.column.roleId),
}); });
if (canceled || role == null) return; if (canceled || role == null) return;
updateColumn(props.column.id, { updateColumn(props.column.id, {

View File

@ -104,6 +104,7 @@ async function setType() {
}, { }, {
value: 'global' as const, text: i18n.ts._timelines.global, value: 'global' as const, text: i18n.ts._timelines.global,
}], }],
default: props.column.tl,
}); });
if (canceled) { if (canceled) {
if (props.column.tl == null) { if (props.column.tl == null) {