刘光辉
3 小时以前 cf11e63b659afcc9792ab3e395f1b45d844431a8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import type { InjectionKey } from 'vue';
 
import type { UploadEditContext, UploadEditDraft } from '#/api/onlineDev/uploadEdit';
 
export interface UploadEditParticipant {
  settle?: () => Promise<void>;
  refresh?: () => Promise<void>;
  prepare: () => Promise<undefined | { contentToken?: string; metadataToken?: string; draftId: string; revision: number }>;
}
export interface UploadEditFormContext {
  context: () => Omit<UploadEditContext, 'field' | 'parentField' | 'rowId'>;
  register: (participant: UploadEditParticipant) => () => void;
  loadShared?: (context: UploadEditContext) => Promise<{ data: UploadEditDraft }>;
  sharedChanged?: () => void;
}
export const uploadEditFormKey: InjectionKey<UploadEditFormContext> = Symbol('upload-edit-form');