rudeshark.net/packages/client/src/widgets/post-form.vue
syuilo 0bbde336b3
refactor: Widgetのcomposition api移行 (#8125)
* wip

* wip

* wip

* wip

* wip

* wip

* fix
2022-01-08 20:30:01 +09:00

36 lines
1.0 KiB
Vue

<template>
<XPostForm class="_panel" :fixed="true" :autofocus="false"/>
</template>
<script lang="ts" setup>
import { } from 'vue';
import { GetFormResultType } from '@/scripts/form';
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget';
import XPostForm from '@/components/post-form.vue';
const name = 'postForm';
const widgetPropsDef = {
};
type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
// 現時点ではvueの制限によりimportしたtypeをジェネリックに渡せない
//const props = defineProps<WidgetComponentProps<WidgetProps>>();
//const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
const props = defineProps<{ widget?: Widget<WidgetProps>; }>();
const emit = defineEmits<{ (e: 'updateProps', props: WidgetProps); }>();
const { widgetProps, configure } = useWidgetPropsManager(name,
widgetPropsDef,
props,
emit,
);
defineExpose<WidgetComponentExpose>({
name,
configure,
id: props.widget ? props.widget.id : null,
});
</script>