This commit is contained in:
kakkokari-gtyih 2025-12-30 17:25:21 +09:00
parent 14c26dad0f
commit 4987547efb
6 changed files with 16 additions and 15 deletions

View File

@ -58,7 +58,7 @@ import MkButton from '@/components/MkButton.vue';
import MkRadios from '@/components/MkRadios.vue';
import { i18n } from '@/i18n.js';
import type { MkSelectItem } from '@/components/MkSelect.vue';
import type { RadioOption } from '@/components/MkRadios.vue';
import type { MkRadiosOption } from '@/components/MkRadios.vue';
import type { Form, EnumFormItem, RadioFormItem } from '@/utility/form.js';
const props = defineProps<{
@ -78,8 +78,8 @@ function getMkSelectDef(def: EnumFormItem): MkSelectItem[] {
});
}
function getRadioOptionsDef(def: RadioFormItem): RadioOption[] {
return def.options.map<RadioOption>((v) => {
function getRadioOptionsDef(def: RadioFormItem): MkRadiosOption[] {
return def.options.map<MkRadiosOption>((v) => {
if (typeof v === 'string') {
return { value: v, label: v };
} else {

View File

@ -38,7 +38,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import type { StyleValue } from 'vue';
import type { OptionValue } from '@/types/option-value.js';
export type RadioOption<T = OptionValue, S = string> = {
export type MkRadiosOption<T = OptionValue, S = string> = {
value: T;
slotId?: S;
label?: string;
@ -50,7 +50,7 @@ export type RadioOption<T = OptionValue, S = string> = {
};
</script>
<script setup lang="ts" generic="const T extends RadioOption">
<script setup lang="ts" generic="const T extends MkRadiosOption">
import MkRadio from './MkRadio.vue';
defineProps<{

View File

@ -123,7 +123,7 @@ import MkSwitch from '@/components/MkSwitch.vue';
import MkFolder from '@/components/MkFolder.vue';
import * as os from '@/os.js';
import type { MenuItem } from '@/types/menu.js';
import type { RadioOption } from '@/components/MkRadios.vue';
import type { MkRadiosOption } from '@/components/MkRadios.vue';
import { useRouter } from '@/router.js';
const $i = ensureSignin();
@ -150,7 +150,7 @@ const gameTurnOptionsDef = [
{ value: 120, label: '120' + i18n.ts._time.second },
{ value: 180, label: '180' + i18n.ts._time.second },
{ value: 3600, label: '3600' + i18n.ts._time.second },
] as RadioOption<number>[];
] as MkRadiosOption<number>[];
const mapName = computed(() => {
if (game.value.map == null) return 'Random';

View File

@ -127,7 +127,7 @@ import MkNotesTimeline from '@/components/MkNotesTimeline.vue';
import MkRadios from '@/components/MkRadios.vue';
import MkUserCardMini from '@/components/MkUserCardMini.vue';
import { Paginator } from '@/utility/paginator.js';
import type { RadioOption } from '@/components/MkRadios.vue';
import type { MkRadiosOption } from '@/components/MkRadios.vue';
const props = withDefaults(defineProps<{
query?: string;
@ -184,8 +184,8 @@ const searchScope = ref<'all' | 'local' | 'server' | 'user'>((() => {
return 'all';
})());
const searchScopeDef = computed<RadioOption[]>(() => {
const options: RadioOption[] = [];
const searchScopeDef = computed<MkRadiosOption[]>(() => {
const options: MkRadiosOption[] = [];
if (instance.federation !== 'none' && noteSearchableScope === 'global') {
options.push({ value: 'all', label: i18n.ts._search.searchScopeAll });

View File

@ -121,7 +121,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed, ref, watch } from 'vue';
import XPalette from './emoji-palette.palette.vue';
import type { MkSelectItem } from '@/components/MkSelect.vue';
import type { RadioOption } from '@/components/MkRadios.vue';
import type { MkRadiosOption } from '@/components/MkRadios.vue';
import { genId } from '@/utility/id.js';
import MkFeatureBanner from '@/components/MkFeatureBanner.vue';
import MkRadios from '@/components/MkRadios.vue';
@ -160,7 +160,7 @@ const emojiPickerScaleDef = [
{ label: i18n.ts.large, value: 3 },
{ label: i18n.ts.large + '+', value: 4 },
{ label: i18n.ts.large + '++', value: 5 },
] as RadioOption<number>[];
] as MkRadiosOption<number>[];
const emojiPickerWidth = prefer.model('emojiPickerWidth');
const emojiPickerWidthDef = [
@ -169,7 +169,7 @@ const emojiPickerWidthDef = [
{ label: '7', value: 3 },
{ label: '8', value: 4 },
{ label: '9', value: 5 },
] as RadioOption<number>[];
] as MkRadiosOption<number>[];
const emojiPickerHeight = prefer.model('emojiPickerHeight');
const emojiPickerHeightDef = [
@ -177,7 +177,7 @@ const emojiPickerHeightDef = [
{ label: i18n.ts.medium, value: 2 },
{ label: i18n.ts.large, value: 3 },
{ label: i18n.ts.large + '+', value: 4 },
] as RadioOption<number>[];
] as MkRadiosOption<number>[];
const emojiPickerStyle = prefer.model('emojiPickerStyle');

View File

@ -6,10 +6,11 @@
import * as Misskey from 'misskey-js';
import type { Component, ComputedRef, Ref, MaybeRef } from 'vue';
import type { ComponentProps as CP } from 'vue-component-type-helpers';
import type { OptionValue } from '@/types/option-value.js';
type ComponentProps<T extends Component> = { [K in keyof CP<T>]: MaybeRef<CP<T>[K]> };
type MenuRadioOptionsDef = Record<string, any>;
type MenuRadioOptionsDef = Record<string, OptionValue>;
type Text = string | ComputedRef<string>;