refactor(editor): Standardize how we use defineEmits in components using the composition API (no-changelog) (#9934)

This commit is contained in:
Ricardo Espinoza 2024-07-04 03:30:51 -04:00 committed by GitHub
parent 7a3c127b2c
commit cef177455e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
96 changed files with 212 additions and 222 deletions

View file

@ -16,12 +16,7 @@ module.exports = {
overrides: [
{
files: [
'**/*.test.ts',
'**/test/**/*.ts',
'**/__tests__/**/*.ts',
'**/*.stories.ts',
],
files: ['**/*.test.ts', '**/test/**/*.ts', '**/__tests__/**/*.ts', '**/*.stories.ts'],
rules: {
'import/no-extraneous-dependencies': 'off',
},
@ -60,6 +55,7 @@ module.exports = {
'vue/prop-name-casing': ['error', 'camelCase'],
'vue/attribute-hyphenation': ['error', 'always'],
'import/no-extraneous-dependencies': 'warn',
'vue/define-emits-declaration': ['error', 'type-literal'],
// TODO: fix these
'@typescript-eslint/no-unsafe-call': 'off',

View file

@ -102,8 +102,8 @@ const getItemClasses = (item: ActionDropdownItem): Record<string, boolean> => {
};
const $emit = defineEmits<{
(event: 'select', action: string): void;
(event: 'visibleChange', open: boolean): void;
select: [action: string];
visibleChange: [open: boolean];
}>();
const elementDropdown = ref<InstanceType<typeof ElDropdown>>();

View file

@ -69,8 +69,8 @@ withDefaults(defineProps<ActionToggleProps>(), {
});
const $emit = defineEmits<{
(event: 'action', value: string): void;
(event: 'visible-change', value: boolean): void;
action: [value: string];
'visible-change': [value: boolean];
}>();
const onCommand = (value: string) => $emit('action', value);
const onVisibleChange = (value: boolean) => $emit('visible-change', value);

View file

@ -45,10 +45,11 @@ withDefaults(defineProps<CheckboxProps>(), {
labelSize: 'medium',
});
const $emit = defineEmits<{
(event: 'update:modelValue', value: CheckboxValueType): void;
const emit = defineEmits<{
'update:modelValue': [value: CheckboxValueType];
}>();
const onUpdateModelValue = (value: CheckboxValueType) => $emit('update:modelValue', value);
const onUpdateModelValue = (value: CheckboxValueType) => emit('update:modelValue', value);
const checkbox = ref<InstanceType<typeof ElCheckbox>>();
const onLabelClick = () => {

View file

@ -36,9 +36,9 @@ const colorPickerProps = computed(() => {
});
const emit = defineEmits<{
(event: 'update:modelValue', value: string | null): void;
(event: 'change', value: string | null): void;
(event: 'active-change', value: string | null): void;
'update:modelValue': [value: string | null];
change: [value: string | null];
'active-change': [value: string | null];
}>();
const onChange = (value: string | null) => {

View file

@ -85,8 +85,8 @@ const props = withDefaults(defineProps<DatatableProps>(), {
});
const $emit = defineEmits<{
(event: 'update:currentPage', value: number): void;
(event: 'update:rowsPerPage', value: number): void;
'update:currentPage': [value: number];
'update:rowsPerPage': [value: number];
}>();
const { t } = useI18n();

View file

@ -69,9 +69,9 @@ withDefaults(defineProps<FormBoxProps>(), {
const formBus = createEventBus();
const $emit = defineEmits<{
(event: 'submit', value: { [key: string]: Value }): void;
(event: 'update', value: { name: string; value: Value }): void;
(event: 'secondaryClick', value: Event): void;
submit: [value: { [key: string]: Value }];
update: [value: { name: string; value: Value }];
secondaryClick: [value: Event];
}>();
const onUpdateModelValue = (e: { name: string; value: Value }) => $emit('update', e);

View file

@ -158,11 +158,11 @@ const props = withDefaults(defineProps<Props>(), {
});
const $emit = defineEmits<{
(event: 'validate', shouldValidate: boolean): void;
(event: 'update:modelValue', value: Validatable): void;
(event: 'focus'): void;
(event: 'blur'): void;
(event: 'enter'): void;
validate: [shouldValidate: boolean];
'update:modelValue': [value: Validatable];
focus: [];
blur: [];
enter: [];
}>();
const state = reactive({

View file

@ -27,10 +27,10 @@ const props = withDefaults(defineProps<FormInputsProps>(), {
});
const emit = defineEmits<{
(name: 'update', _: { name: string; value: Value }): boolean;
(name: 'update:modelValue', value: Record<string, Value>): boolean;
(name: 'submit', value: Record<string, Value>): boolean;
(name: 'ready', value: boolean): boolean;
update: [value: { name: string; value: Value }];
'update:modelValue': [value: Record<string, Value>];
submit: [value: Record<string, Value>];
ready: [value: boolean];
}>();
const showValidationWarnings = ref(false);

View file

@ -69,8 +69,8 @@ const props = withDefaults(defineProps<InfoAccordionProps>(), {
eventBus: () => createEventBus(),
});
const $emit = defineEmits<{
(name: 'click:body', e: MouseEvent): void;
(name: 'tooltipClick', item: string, e: MouseEvent): void;
'click:body': [e: MouseEvent];
tooltipClick: [item: string, e: MouseEvent];
}>();
const expanded = ref(false);

View file

@ -156,8 +156,8 @@ const htmlContent = computed(() => {
});
const $emit = defineEmits<{
(event: 'markdown-click', link: string, e: MouseEvent): void;
(event: 'update-content', content: string): void;
'markdown-click': [link: string, e: MouseEvent];
'update-content': [content: string];
}>();
const onClick = (event: MouseEvent) => {

View file

@ -83,8 +83,8 @@ const props = withDefaults(defineProps<MenuProps>(), {
const $route = useRoute();
const $emit = defineEmits<{
(event: 'select', itemId: string): void;
(event: 'update:modelValue', itemId: string): void;
select: [itemId: string];
'update:modelValue': [itemId: string];
}>();
const activeTab = ref(props.modelValue);

View file

@ -18,7 +18,7 @@ export interface Props {
defineProps<Props>();
defineEmits<{
(event: 'tooltipClick', $e: MouseEvent): void;
tooltipClick: [e: MouseEvent];
}>();
const { t } = useI18n();

View file

@ -36,7 +36,7 @@ const props = withDefaults(defineProps<NoticeProps>(), {
});
const $emit = defineEmits<{
(event: 'action', key: string): void;
action: [key: string];
}>();
const $style = useCssModule();

View file

@ -39,7 +39,7 @@ const props = withDefaults(defineProps<RadioButtonsProps>(), {
});
const $emit = defineEmits<{
(event: 'update:modelValue', value: string, e: MouseEvent): void;
'update:modelValue': [value: string, e: MouseEvent];
}>();
const onClick = (

View file

@ -80,9 +80,9 @@ export interface ResizeData {
}
const $emit = defineEmits<{
(event: 'resizestart'): void;
(event: 'resize', value: ResizeData): void;
(event: 'resizeend'): void;
resizestart: [];
resize: [value: ResizeData];
resizeend: [];
}>();
const enabledDirections = computed((): Direction[] => {

View file

@ -94,13 +94,13 @@ const props = withDefaults(defineProps<StickyProps>(), {
backgroundColor: 1,
});
const $emit = defineEmits<{
(event: 'edit', editing: boolean): void;
(event: 'update:modelValue', value: string): void;
(event: 'markdown-click', link: string, e: Event): void;
(event: 'resize', values: ResizeData): void;
(event: 'resizestart'): void;
(event: 'resizeend'): void;
const emit = defineEmits<{
edit: [editing: boolean];
'update:modelValue': [value: string];
'markdown-click': [link: string, e: Event];
resize: [values: ResizeData];
resizestart: [];
resizeend: [];
}>();
const { t } = useI18n();
@ -137,33 +137,33 @@ watch(
);
const onDoubleClick = () => {
if (!props.readOnly) $emit('edit', true);
if (!props.readOnly) emit('edit', true);
};
const onInputBlur = () => {
if (!isResizing.value) $emit('edit', false);
if (!isResizing.value) emit('edit', false);
};
const onUpdateModelValue = (value: string) => {
$emit('update:modelValue', value);
emit('update:modelValue', value);
};
const onMarkdownClick = (link: string, event: Event) => {
$emit('markdown-click', link, event);
emit('markdown-click', link, event);
};
const onResize = (values: ResizeData) => {
$emit('resize', values);
emit('resize', values);
};
const onResizeStart = () => {
isResizing.value = true;
$emit('resizestart');
emit('resizestart');
};
const onResizeEnd = () => {
isResizing.value = false;
$emit('resizeend');
emit('resizeend');
};
const onInputScroll = (event: WheelEvent) => {

View file

@ -111,8 +111,8 @@ onUnmounted(() => {
});
const $emit = defineEmits<{
(event: 'tooltipClick', tab: string, e: MouseEvent): void;
(event: 'update:modelValue', tab: string): void;
tooltipClick: [tab: string, e: MouseEvent];
'update:modelValue': [tab: string];
}>();
const handleTooltipClick = (tab: string, event: MouseEvent) => $emit('tooltipClick', tab, event);

View file

@ -43,8 +43,8 @@ const props = withDefaults(defineProps<TagsProp>(), {
});
const $emit = defineEmits<{
(event: 'expand', value: boolean): void;
(event: 'click:tag', tagId: string, e: MouseEvent): void;
expand: [value: boolean];
'click:tag': [tagId: string, e: MouseEvent];
}>();
const { t } = useI18n();

View file

@ -55,8 +55,8 @@ const props = withDefaults(defineProps<UserSelectProps>(), {
});
const $emit = defineEmits<{
(event: 'blur'): void;
(event: 'focus'): void;
blur: [];
focus: [];
}>();
const { t } = useI18n();

View file

@ -105,11 +105,11 @@ const getActions = (user: IUser): UserAction[] => {
return props.actions.filter((action) => (action.guard ?? defaultGuard)(user));
};
const $emit = defineEmits<{
(event: 'action', _: { action: string; userId: string }): void;
const emit = defineEmits<{
action: [value: { action: string; userId: string }];
}>();
const onUserAction = (user: IUser, action: string) =>
$emit('action', {
emit('action', {
action,
userId: user.id,
});

View file

@ -8,7 +8,7 @@ const aiStore = useAIStore();
const locale = useI18n();
const telemetry = useTelemetry();
const emit = defineEmits<{ (event: 'optionSelected', option: string): void }>();
const emit = defineEmits<{ optionSelected: [option: string] }>();
const aiAssistantChatOpen = computed(() => aiStore.assistantChatOpen);

View file

@ -10,7 +10,7 @@ type QuickReply = {
const locale = useI18n();
const emit = defineEmits<{
(event: 'replySelected', value: QuickReply): void;
replySelected: [value: QuickReply];
}>();
defineProps<{

View file

@ -26,8 +26,8 @@ const props = defineProps<Props>();
const assignment = ref<AssignmentValue>(props.modelValue);
const emit = defineEmits<{
(event: 'update:model-value', value: AssignmentValue): void;
(event: 'remove'): void;
'update:model-value': [value: AssignmentValue];
remove: [];
}>();
const ndvStore = useNDVStore();

View file

@ -27,10 +27,7 @@ interface Props {
const props = withDefaults(defineProps<Props>(), { isReadOnly: false });
const emit = defineEmits<{
(
event: 'valueChanged',
value: { name: string; node: string; value: AssignmentCollectionValue },
): void;
valueChanged: [value: { name: string; node: string; value: AssignmentCollectionValue }];
}>();
const i18n = useI18n();

View file

@ -12,7 +12,7 @@ interface Props {
const props = defineProps<Props>();
const emit = defineEmits<{
(event: 'update:model-value', type: string): void;
'update:model-value': [type: string];
}>();
const i18n = useI18n();

View file

@ -31,7 +31,7 @@ const props = defineProps<{
}>();
const emit = defineEmits<{
(event: 'close'): void;
close: [];
}>();
const nodeHelpers = useNodeHelpers();

View file

@ -28,10 +28,10 @@ import {
} from '@/constants';
const emit = defineEmits<{
(e: 'submit', code: string): void;
(e: 'replaceCode', code: string): void;
(e: 'startedLoading'): void;
(e: 'finishedLoading'): void;
submit: [code: string];
replaceCode: [code: string];
startedLoading: [];
finishedLoading: [];
}>();
const props = defineProps<{

View file

@ -94,7 +94,7 @@ const props = withDefaults(defineProps<Props>(), {
rows: 4,
});
const emit = defineEmits<{
(event: 'update:modelValue', value: string): void;
'update:modelValue': [value: string];
}>();
const message = useMessage();

View file

@ -76,8 +76,9 @@ export interface Props {
isReadOnly?: boolean;
}
const emit = defineEmits<{
(event: 'valueChanged', value: IUpdateInformation): void;
valueChanged: [value: IUpdateInformation];
}>();
const props = defineProps<Props>();
const ndvStore = useNDVStore();
const i18n = useI18n();

View file

@ -7,7 +7,7 @@ import { watch, ref } from 'vue';
const contextMenu = useContextMenu();
const { position, isOpen, actions, target } = contextMenu;
const dropdown = ref<InstanceType<typeof N8nActionDropdown>>();
const emit = defineEmits<{ (event: 'action', action: ContextMenuAction, nodes: INode[]): void }>();
const emit = defineEmits<{ action: [action: ContextMenuAction, nodes: INode[]] }>();
watch(
isOpen,

View file

@ -48,7 +48,7 @@ const props = withDefaults(defineProps<Props>(), {
toastTitle: useI18n().baseText('generic.copiedToClipboard'),
});
const emit = defineEmits<{
(event: 'copy'): void;
copy: [];
}>();
const clipboard = useClipboard();

View file

@ -22,7 +22,7 @@ export interface Props {
}
const emit = defineEmits<{
(event: 'authTypeChanged', value: string): void;
authTypeChanged: [value: string];
}>();
const nodeTypesStore = useNodeTypesStore();

View file

@ -215,11 +215,11 @@ const props = withDefaults(defineProps<Props>(), {
credentialPermissions: () => ({}) as PermissionsMap<CredentialScope>,
});
const emit = defineEmits<{
(event: 'update', value: IUpdateInformation): void;
(event: 'authTypeChanged', value: string): void;
(event: 'scrollToTop'): void;
(event: 'retest'): void;
(event: 'oauth'): void;
update: [value: IUpdateInformation];
authTypeChanged: [value: string];
scrollToTop: [];
retest: [];
oauth: [];
}>();
const credentialsStore = useCredentialsStore();

View file

@ -47,7 +47,7 @@ const credentialDataValues = computed(
);
const emit = defineEmits<{
(event: 'update', value: IUpdateInformation): void;
update: [value: IUpdateInformation];
}>();
function valueChanged(parameterData: IUpdateInformation) {

View file

@ -14,9 +14,9 @@ const props = defineProps<{
}>();
const $emit = defineEmits<{
(event: 'credentialSelected', credentialId: string): void;
(event: 'credentialDeselected'): void;
(event: 'credentialModalOpened'): void;
credentialSelected: [credentialId: string];
credentialDeselected: [];
credentialModalOpened: [];
}>();
const uiStore = useUIStore();

View file

@ -13,8 +13,8 @@ const props = defineProps<{
}>();
const $emit = defineEmits<{
(event: 'credentialSelected', credentialId: string): void;
(event: 'newCredential'): void;
credentialSelected: [credentialId: string];
newCredential: [];
}>();
const i18n = useI18n();

View file

@ -30,10 +30,11 @@ type Props = {
};
const props = withDefaults(defineProps<Props>(), { tag: 'div', disabled: false });
const emit = defineEmits<{
(event: 'drag', value: XYPosition): void;
(event: 'dragstart', value: HTMLElement): void;
(event: 'dragend', value: HTMLElement): void;
drag: [value: XYPosition];
dragstart: [value: HTMLElement];
dragend: [value: HTMLElement];
}>();
const isDragging = ref(false);

View file

@ -24,8 +24,9 @@ const props = withDefaults(defineProps<Props>(), {
stickyOffset: () => [0, 0],
stickyOrigin: 'top-left',
});
const emit = defineEmits<{
(event: 'drop', value: string): void;
drop: [value: string];
}>();
const hovering = ref(false);

View file

@ -1,7 +1,7 @@
<script setup lang="ts">
import DraggableTarget from '@/components/DraggableTarget.vue';
const emit = defineEmits<{ (event: 'drop', value: string): void }>();
const emit = defineEmits<{ drop: [value: string] }>();
const onDrop = (value: string) => {
emit('drop', value);

View file

@ -30,10 +30,10 @@ type Props = {
const props = defineProps<Props>();
const emit = defineEmits<{
(event: 'update:model-value', value: string): void;
(event: 'enter', value: string): void;
(event: 'blur', value: string): void;
(event: 'esc'): void;
'update:model-value': [value: string];
enter: [value: string];
blur: [value: string];
esc: [];
}>();
const inputRef = ref<HTMLInputElement>();

View file

@ -37,9 +37,9 @@ const props = withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
(event: 'change', value: { value: string; segments: Segment[] }): void;
(event: 'focus'): void;
(event: 'close'): void;
change: [value: { value: string; segments: Segment[] }];
focus: [];
close: [];
}>();
const root = ref<HTMLElement>();

View file

@ -39,10 +39,10 @@ const props = withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
(event: 'modal-opener-click'): void;
(event: 'update:model-value', value: string): void;
(event: 'focus'): void;
(event: 'blur'): void;
'modal-opener-click': [];
'update:model-value': [value: string];
focus: [];
blur: [];
}>();
const telemetry = useTelemetry();

View file

@ -7,7 +7,7 @@ import { computed, onMounted, ref } from 'vue';
import type { EventBus } from 'n8n-design-system/utils';
const emit = defineEmits<{
(e: 'change', value: boolean): void;
change: [value: boolean];
}>();
const props = withDefaults(

View file

@ -2,7 +2,7 @@
import { useI18n } from '@/composables/useI18n';
const emit = defineEmits<{
(e: 'update:modelValue', feedback: 'positive' | 'negative'): void;
'update:modelValue': [feedback: 'positive' | 'negative'];
}>();
defineProps<{

View file

@ -11,7 +11,7 @@ interface Props {
defineProps<Props>();
const emit = defineEmits<{
(event: 'combinatorChange', value: FilterTypeCombinator): void;
combinatorChange: [value: FilterTypeCombinator];
}>();
const i18n = useI18n();

View file

@ -43,8 +43,8 @@ const props = withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
(event: 'update', value: FilterConditionValue): void;
(event: 'remove'): void;
update: [value: FilterConditionValue];
remove: [];
}>();
const i18n = useI18n();

View file

@ -35,7 +35,7 @@ interface Props {
const props = withDefaults(defineProps<Props>(), { readOnly: false });
const emit = defineEmits<{
(event: 'valueChanged', value: { name: string; node: string; value: FilterValue }): void;
valueChanged: [value: { name: string; node: string; value: FilterValue }];
}>();
const i18n = useI18n();

View file

@ -18,7 +18,7 @@ const shouldRenderItems = ref(false);
const submenu = ref('none');
const emit = defineEmits<{
(event: 'operatorChange', value: string): void;
operatorChange: [value: string];
}>();
const i18n = useI18n();

View file

@ -59,7 +59,7 @@ const props = withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
(event: 'update:model-value', value: string): void;
'update:model-value': [value: string];
}>();
const htmlEditor = ref<HTMLElement>();

View file

@ -39,9 +39,9 @@ const props = withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
(event: 'update:model-value', value: { value: string; segments: Segment[] }): void;
(event: 'update:selection', value: { state: EditorState; selection: SelectionRange }): void;
(event: 'focus'): void;
'update:model-value': [value: { value: string; segments: Segment[] }];
'update:selection': [value: { state: EditorState; selection: SelectionRange }];
focus: [];
}>();
const ndvStore = useNDVStore();

View file

@ -44,7 +44,7 @@ interface Props {
const props = defineProps<Props>();
const emit = defineEmits<{
(event: 'update:modelValue', value: string): void;
'update:modelValue': [value: string];
}>();
const isNameEdit = ref(false);

View file

@ -46,8 +46,8 @@ const props = withDefaults(
);
const emit = defineEmits<{
(event: 'toggle'): void;
(event: 'submit', payload: { name: string; onSubmit: (updated: boolean) => void }): void;
toggle: [];
submit: [payload: { name: string; onSubmit: (updated: boolean) => void }];
}>();
const isDisabled = ref(props.disabled);

View file

@ -17,7 +17,7 @@ type Props = {
const props = defineProps<Props>();
const emit = defineEmits<{
(event: 'update:model-value', value: string): void;
'update:model-value': [value: string];
}>();
const i18n = useI18n();

View file

@ -41,7 +41,7 @@ type Props = {
const props = withDefaults(defineProps<Props>(), { fillParent: false, isReadOnly: false, rows: 4 });
const emit = defineEmits<{
(event: 'update:modelValue', value: string): void;
'update:modelValue': [value: string];
}>();
onMounted(() => {

View file

@ -41,7 +41,7 @@ type Props = {
const props = withDefaults(defineProps<Props>(), { fillParent: false, isReadOnly: false, rows: 4 });
const emit = defineEmits<{
(event: 'update:modelValue', value: string): void;
'update:modelValue': [value: string];
}>();
const jsonEditorRef = ref<HTMLDivElement>();

View file

@ -29,7 +29,7 @@ withDefaults(
);
const emit = defineEmits<{
(key: 'update:modelValue', tab: MAIN_HEADER_TABS, event: MouseEvent): void;
'update:modelValue': [tab: MAIN_HEADER_TABS, event: MouseEvent];
}>();
function onUpdateModelValue(tab: MAIN_HEADER_TABS, event: MouseEvent): void {

View file

@ -57,7 +57,7 @@ const workflowsStore = useWorkflowsStore();
const nodeTypesStore = useNodeTypesStore();
const workflow = workflowsStore.getCurrentWorkflow();
const emit = defineEmits<{
(key: 'switchSelectedNode', nodeName: string): void;
switchSelectedNode: [nodeName: string];
}>();
interface NodeConfig {

View file

@ -140,8 +140,8 @@ const nodeTypesStore = useNodeTypesStore();
const nodeHelpers = useNodeHelpers();
const { debounce } = useDebounce();
const emit = defineEmits<{
(event: 'switchSelectedNode', nodeName: string): void;
(event: 'openConnectionNodeCreator', nodeName: string, connectionType: ConnectionTypes): void;
switchSelectedNode: [nodeName: string];
openConnectionNodeCreator: [nodeName: string, connectionType: ConnectionTypes];
}>();
interface NodeConfig {

View file

@ -27,8 +27,8 @@ const props = withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
(event: 'addNodes', value: AddedNodesAndConnections): void;
(event: 'toggleNodeCreator', value: ToggleNodeCreatorOptions): void;
addNodes: [value: AddedNodesAndConnections];
toggleNodeCreator: [value: ToggleNodeCreatorOptions];
}>();
const state = reactive({

View file

@ -30,7 +30,7 @@ import type { IDataObject } from 'n8n-workflow';
import { useTelemetry } from '@/composables/useTelemetry';
const emit = defineEmits<{
(event: 'nodeTypeSelected', _: [actionKey: string, nodeName: string] | [nodeName: string]): void;
nodeTypeSelected: [value: [actionKey: string, nodeName: string] | [nodeName: string]];
}>();
const telemetry = useTelemetry();

View file

@ -32,7 +32,7 @@ export interface Props {
}
const emit = defineEmits<{
(event: 'nodeTypeSelected', nodeTypes: string[]): void;
nodeTypeSelected: [nodeTypes: string[]];
}>();
const i18n = useI18n();

View file

@ -49,8 +49,8 @@ const props = defineProps<Props>();
const { resetViewStacks } = useViewStacks();
const { registerKeyHook } = useKeyboardNavigation();
const emit = defineEmits<{
(event: 'closeNodeCreator'): void;
(event: 'nodeTypeSelected', value: string[]): void;
closeNodeCreator: [];
nodeTypeSelected: [value: string[]];
}>();
const uiStore = useUIStore();
const aiStore = useAIStore();

View file

@ -38,7 +38,7 @@ withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
(event: 'update:modelValue', value: string): void;
'update:modelValue': [value: string];
}>();
const state = reactive({

View file

@ -176,16 +176,12 @@ import { useI18n } from '@/composables/useI18n';
import { storeToRefs } from 'pinia';
const emit = defineEmits<{
(value: 'saveKeyboardShortcut', event: KeyboardEvent): void;
(value: 'valueChanged', parameterData: IUpdateInformation): void;
(value: 'switchSelectedNode', nodeTypeName: string): void;
(
value: 'openConnectionNodeCreator',
nodeTypeName: string,
connectionType: NodeConnectionType,
): void;
(value: 'redrawNode', nodeName: string): void;
(value: 'stopExecution'): void;
saveKeyboardShortcut: [event: KeyboardEvent];
valueChanged: [parameterData: IUpdateInformation];
switchSelectedNode: [nodeTypeName: string];
openConnectionNodeCreator: [nodeTypeName: string, connectionType: NodeConnectionType];
redrawNode: [nodeName: string];
stopExecution: [];
}>();
const props = withDefaults(

View file

@ -57,7 +57,7 @@ const props = withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
(event: 'click'): void;
click: [];
}>();
const rootStore = useRootStore();

View file

@ -38,7 +38,7 @@ const props = withDefaults(defineProps<Props>(), {
pushRef: '',
});
const emit = defineEmits<{
(event: 'update:model-value', tab: Tab): void;
'update:model-value': [tab: Tab];
}>();
const externalHooks = useExternalHooks();

View file

@ -58,7 +58,7 @@ const props = withDefaults(defineProps<Props>(), {
readOnly: false,
});
const emit = defineEmits<{
(event: 'update:model-value', value: string): void;
'update:model-value': [value: string];
}>();
const editName = ref(false);
const newName = ref('');

View file

@ -569,11 +569,11 @@ const props = withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
(event: 'focus'): void;
(event: 'blur'): void;
(event: 'drop', expression: string): void;
(event: 'textInput', update: IUpdateInformation): void;
(event: 'update', update: IUpdateInformation): void;
focus: [];
blur: [];
drop: [expression: string];
textInput: [update: IUpdateInformation];
update: [update: IUpdateInformation];
}>();
const externalHooks = useExternalHooks();

View file

@ -84,7 +84,7 @@ const props = withDefaults(defineProps<Props>(), {
label: () => ({ size: 'small' }),
});
const emit = defineEmits<{
(event: 'update', value: IUpdateInformation): void;
update: [value: IUpdateInformation];
}>();
const focused = ref(false);

View file

@ -121,8 +121,8 @@ const props = withDefaults(defineProps<Props>(), {
label: () => ({ size: 'small' }),
});
const emit = defineEmits<{
(event: 'blur'): void;
(event: 'update', value: IUpdateInformation): void;
blur: [];
update: [value: IUpdateInformation];
}>();
const i18n = useI18n();

View file

@ -212,9 +212,9 @@ type Props = {
const props = withDefaults(defineProps<Props>(), { path: '', hiddenIssuesInputs: () => [] });
const emit = defineEmits<{
(event: 'activate'): void;
(event: 'valueChanged', value: IUpdateInformation): void;
(event: 'parameterBlur', value: string): void;
activate: [];
valueChanged: [value: IUpdateInformation];
parameterBlur: [value: string];
}>();
const nodeTypesStore = useNodeTypesStore();

View file

@ -101,11 +101,11 @@ const props = withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
(event: 'focus'): void;
(event: 'blur'): void;
(event: 'drop', value: string): void;
(event: 'update', value: IUpdateInformation): void;
(event: 'textInput', value: IUpdateInformation): void;
focus: [];
blur: [];
drop: [value: string];
update: [value: IUpdateInformation];
textInput: [value: IUpdateInformation];
}>();
const router = useRouter();

View file

@ -12,7 +12,7 @@ type Props = {
const props = defineProps<Props>();
const visible = defineModel<boolean>();
const emit = defineEmits<{
(e: 'confirmDelete', value?: string): void;
confirmDelete: [value?: string];
}>();
const locale = useI18n();

View file

@ -22,8 +22,8 @@ const model = defineModel<(ProjectSharingData | null) | ProjectSharingData[]>({
required: true,
});
const emit = defineEmits<{
(event: 'projectAdded', value: ProjectSharingData): void;
(event: 'projectRemoved', value: ProjectSharingData): void;
projectAdded: [value: ProjectSharingData];
projectRemoved: [value: ProjectSharingData];
}>();
const selectedProject = ref(Array.isArray(model.value) ? '' : model.value?.id ?? '');

View file

@ -50,10 +50,10 @@ const {
} = useNodeSpecificationValues(props.parameter.typeOptions);
const emit = defineEmits<{
(event: 'fieldValueChanged', value: IUpdateInformation): void;
(event: 'removeField', field: string): void;
(event: 'addField', field: string): void;
(event: 'refreshFieldList'): void;
fieldValueChanged: [value: IUpdateInformation];
removeField: [field: string];
addField: [field: string];
refreshFieldList: [];
}>();
const ndvStore = useNDVStore();

View file

@ -44,8 +44,8 @@ const mappingModeOptions = [
];
const emit = defineEmits<{
(event: 'modeChanged', value: string): void;
(event: 'retryFetch'): void;
modeChanged: [value: string];
retryFetch: [];
}>();
const selected = ref(props.initialValue);

View file

@ -53,8 +53,8 @@ watch(
);
const emit = defineEmits<{
(event: 'matchingColumnsChanged', value: string[]): void;
(event: 'refreshFieldList'): void;
matchingColumnsChanged: [value: string[]];
refreshFieldList: [];
}>();
const availableMatchingFields = computed<ResourceMapperField[]>(() => {

View file

@ -41,7 +41,7 @@ const props = withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
(event: 'valueChanged', value: IUpdateInformation): void;
valueChanged: [value: IUpdateInformation];
}>();
const state = reactive({

View file

@ -18,7 +18,7 @@ type Props = {
const props = defineProps<Props>();
const emit = defineEmits<{
(event: 'togglePinData'): void;
togglePinData: [];
}>();
const visible = computed(() =>

View file

@ -67,7 +67,7 @@ const { getNodeInputData } = useNodeHelpers();
const { debounce } = useDebounce();
const emit = defineEmits<{
(event: 'clear:search'): void;
'clear:search': [];
}>();
const nodeSchema = computed(() =>

View file

@ -16,8 +16,8 @@ const OPEN_WIDTH = '204px';
const OPEN_MIN_WIDTH = '120px';
const emit = defineEmits<{
(event: 'update:modelValue', value: Props['modelValue']): void;
(event: 'focus'): void;
'update:modelValue': [value: Props['modelValue']];
focus: [];
}>();
const props = withDefaults(defineProps<Props>(), {

View file

@ -77,7 +77,7 @@ const props = withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
(event: 'update:model-value', value: string): void;
'update:model-value': [value: string];
}>();
const sqlEditor = ref<HTMLElement>();

View file

@ -18,10 +18,10 @@ const settingsStore = useSettingsStore();
const usersStore = useUsersStore();
const emit = defineEmits<{
(event: 'save', data: IResource): void;
(event: 'cancel', data: IResource): void;
(event: 'edit', data: IResource): void;
(event: 'delete', data: IResource): void;
save: [data: IResource];
cancel: [data: IResource];
edit: [data: IResource];
delete: [data: IResource];
}>();
const props = withDefaults(

View file

@ -56,8 +56,8 @@ const props = withDefaults(
);
const emit = defineEmits<{
(event: 'expand:tags'): void;
(event: 'click:tag', tagId: string, e: PointerEvent): void;
'expand:tags': [];
'click:tag': [tagId: string, e: PointerEvent];
}>();
const toast = useToast();

View file

@ -21,14 +21,13 @@ const props = defineProps<{
}>();
const emit = defineEmits<{
(
event: 'action',
action: [
value: {
action: WorkflowHistoryActionTypes[number];
id: WorkflowVersionId;
data: { formattedCreatedAt: string };
},
): void;
];
}>();
const workflowVersionPreview = computed<IWorkflowDb | undefined>(() => {

View file

@ -22,17 +22,16 @@ const props = defineProps<{
}>();
const emit = defineEmits<{
(
event: 'action',
action: [
value: {
action: WorkflowHistoryActionTypes[number];
id: WorkflowVersionId;
data: { formattedCreatedAt: string };
},
): void;
(event: 'preview', value: { event: MouseEvent; id: WorkflowVersionId }): void;
(event: 'loadMore', value: WorkflowHistoryRequestParams): void;
(event: 'upgrade'): void;
];
preview: [value: { event: MouseEvent; id: WorkflowVersionId }];
loadMore: [value: WorkflowHistoryRequestParams];
upgrade: [];
}>();
const i18n = useI18n();

View file

@ -16,16 +16,15 @@ const props = defineProps<{
isActive: boolean;
}>();
const emit = defineEmits<{
(
event: 'action',
action: [
value: {
action: WorkflowHistoryActionTypes[number];
id: WorkflowVersionId;
data: { formattedCreatedAt: string };
},
): void;
(event: 'preview', value: { event: MouseEvent; id: WorkflowVersionId }): void;
(event: 'mounted', value: { index: number; offsetTop: number; isActive: boolean }): void;
];
preview: [value: { event: MouseEvent; id: WorkflowVersionId }];
mounted: [value: { index: number; offsetTop: number; isActive: boolean }];
}>();
const i18n = useI18n();

View file

@ -53,7 +53,7 @@ const props = withDefaults(
);
const emit = defineEmits<{
(event: 'close'): void;
close: [];
}>();
const i18n = useI18n();

View file

@ -19,7 +19,7 @@ const props = withDefaults(defineProps<Props>(), {
});
const emit = defineEmits<{
(event: 'close'): void;
close: [];
}>();
const hasTrailingContent = computed(() => {

View file

@ -5,7 +5,7 @@ import { useI18n } from '@/composables/useI18n';
import { useUIStore } from '@/stores/ui.store';
defineEmits<{
(key: 'click', event: MouseEvent): void;
click: [event: MouseEvent];
}>();
const uiStore = useUIStore();

View file

@ -36,7 +36,7 @@ const props = withDefaults(defineProps<ExecutionFilterProps>(), {
teleported: true,
});
const emit = defineEmits<{
(event: 'filterChanged', value: ExecutionFilterType): void;
filterChanged: [value: ExecutionFilterType];
}>();
const debouncedEmit = debounce(emit, {
debounceTime: 500,

View file

@ -26,8 +26,8 @@ const props = withDefaults(
);
const emit = defineEmits<{
(event: 'update:filters', value: ExecutionFilterType): void;
(event: 'execution:stop'): void;
'update:filters': [value: ExecutionFilterType];
'execution:stop': [];
}>();
const i18n = useI18n();

View file

@ -12,9 +12,11 @@ import { useExecutionHelpers } from '@/composables/useExecutionHelpers';
type Command = 'retrySaved' | 'retryOriginal' | 'delete';
const emit = defineEmits<{
(event: 'stop', data: ExecutionSummary): void;
(event: 'select', data: ExecutionSummary): void;
(event: Command, data: ExecutionSummary): void;
stop: [data: ExecutionSummary];
select: [data: ExecutionSummary];
retrySaved: [data: ExecutionSummary];
retryOriginal: [data: ExecutionSummary];
delete: [data: ExecutionSummary];
}>();
const props = withDefaults(
@ -148,6 +150,7 @@ function onSelect() {
}
async function handleActionItemClick(commandData: Command) {
//@ts-ignore todo: fix this type
emit(commandData, props.execution);
}
</script>

View file

@ -116,9 +116,9 @@ const i18 = useI18n();
// ---------------------------------------------------------------------------
const emit = defineEmits<{
(event: 'onFormChanged', formField: string): void;
(event: 'onBackClick', formField: string): void;
(event: 'submit', form: { token: string; recoveryCode: string }): void;
onFormChanged: [formField: string];
onBackClick: [formField: string];
submit: [{ token: string; recoveryCode: string }];
}>();
// #endregion

View file

@ -28,11 +28,8 @@ const props = withDefaults(
);
const emit = defineEmits<{
(
e: 'credentialSelected',
event: { credentialUsageKey: TemplateCredentialKey; credentialId: string },
): void;
(e: 'credentialDeselected', event: { credentialUsageKey: TemplateCredentialKey }): void;
credentialSelected: [event: { credentialUsageKey: TemplateCredentialKey; credentialId: string }];
credentialDeselected: [event: { credentialUsageKey: TemplateCredentialKey }];
}>();
// Stores