UNPKG

dingtalk-docs-cool-app

Version:

钉钉文档酷应用插件扩展 开发者初始化包

65 lines (64 loc) 3 kB
import { FormItem } from './types/formItem'; import type { TextResultType, NumberResultType, LinkResultType, SingleSelectResultType, MultiSelectResultType, ObjectResultType, AttachmentResultType } from './types/resultType'; import type { ExecuteContext, TextExecuteResult, NumberExecuteResult, LinkExecuteResult, SingleSelectExecuteResult, MultiSelectExecuteResult, AttachmentExecuteResult, ObjectExecuteResult, ExecuteFailResult } from './types/execute'; import { type Authorization } from './types/auth'; interface FieldOptions { disableAutoUpdate?: boolean; } interface TextFieldDecorator { resultType: TextResultType; executeType: TextExecuteResult; } interface NumberFieldDecorator { resultType: NumberResultType; executeType: NumberExecuteResult; } interface LinkFieldDecorator { resultType: LinkResultType; executeType: LinkExecuteResult; } interface SingleSelectFieldDecorator { resultType: SingleSelectResultType; executeType: SingleSelectExecuteResult; } interface MultiSelectFieldDecorator { resultType: MultiSelectResultType; executeType: MultiSelectExecuteResult; } interface AttachmentFieldDecorator { resultType: AttachmentResultType; executeType: AttachmentExecuteResult; } interface ObjectFieldDecorator { resultType: ObjectResultType; executeType: ObjectExecuteResult; } type IDecoratorType = TextFieldDecorator | NumberFieldDecorator | LinkFieldDecorator | SingleSelectFieldDecorator | MultiSelectFieldDecorator | AttachmentFieldDecorator | ObjectFieldDecorator; interface BaseFieldDecorator<T extends IDecoratorType> { id?: string; name?: string; authorizations?: Authorization; formItems: FormItem[]; errorMessages?: Record<string, string>; options?: FieldOptions; resultType: T['resultType']; execute: (context: ExecuteContext, formData: any) => Promise<T['executeType'] | ExecuteFailResult>; i18nMap?: { [key: string]: object; }; } type FieldDecorator = BaseFieldDecorator<TextFieldDecorator> | BaseFieldDecorator<NumberFieldDecorator> | BaseFieldDecorator<SingleSelectFieldDecorator> | BaseFieldDecorator<MultiSelectFieldDecorator> | BaseFieldDecorator<AttachmentFieldDecorator> | BaseFieldDecorator<LinkFieldDecorator> | BaseFieldDecorator<ObjectFieldDecorator>; export declare class FieldDecoratorKit { private decorator?; private domainList?; setDecorator(decorator: FieldDecorator): void; getDecorator(): FieldDecorator | undefined; setDomainList(domainList: string[]): void; getDomainList(): string[] | undefined; t(key: string): string; } export declare const fieldDecoratorKit: FieldDecoratorKit; export declare const getManifestByFieldDecorator: (fieldDecorator: FieldDecoratorKit) => any; export declare const getAuthertications: (manifest: any) => Authorization | null; export declare const getAuthenticationHeader: (manifest: any, authId: string, config: string | Record<string, string>) => Record<string, string>; export {};