From 6e376175a383ebc439ac23d58bb9c4f38d0245fa Mon Sep 17 00:00:00 2001 From: angusyyl <34103213+angusyyl@users.noreply.github.com> Date: Thu, 20 Jul 2023 14:36:33 +0100 Subject: [PATCH] update typings (#55) Co-authored-by: Angus Yiu --- typings.d.ts | 60 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 21 deletions(-) diff --git a/typings.d.ts b/typings.d.ts index 4bf49cc..bac0d22 100644 --- a/typings.d.ts +++ b/typings.d.ts @@ -1,3 +1,19 @@ +declare type ToastThemes = 'default' | 'success' | 'info' | 'warning' | 'danger' | 'positive' | string; +declare type ToastIcons = 'bell' | 'check' | 'info' | 'warning' | 'remove' | 'caution' | 'times' | 'coffee' | 'danger' | string; +declare type ToastPositions = 'fixedTop' | 'fixedBottom' | 'growlTopRight' | 'growlTopLeft' | 'growlBottomRight' | 'growlBottomLeft'; + +interface ToastOptions { + title?: string; + message?: string; + action?: string; + icon?: ToastIcons; + theme?: ToastThemes; + accent?: ToastThemes; + hideDelay?: number; + position?: ToastPositions; + isCloseable?: boolean; + customClass?: string; +} interface PageInteraction { action: 'tab-modify' | 'action-modify' | 'overview-field-modify' | 'workflow-modify' | 'activity-section-modify' | 'workflow-section-modify' | 'add-edit-presave' | 'add-edit-postsave'; enabled?: boolean; @@ -52,6 +68,7 @@ interface PageInteractionAPI { currentEntityId: string; currentEntityTrack: string; pageContext: string; + subEntity: string; http: any; toastService: any; modalService: any; @@ -60,16 +77,7 @@ interface PageInteractionAPI { headerText: string; subheaderText: string }): Promise; - displayToast(toastConfig: { - message: string; - title?: string; - hideDelay?: number; - icon?: string; - theme?: string; - position?: string; - isCloseable?: boolean; - customClass?: string - }): void; + displayToast(toastConfig: ToastOptions): void; } interface FieldInteraction { @@ -84,19 +92,27 @@ interface FieldInteraction { } interface FieldInteractionAPI { + hideFieldSetHeader(key: string): void; + associations: any; form: any; readonly currentEntity: string; readonly currentEntityId: string; readonly isEdit: boolean; readonly isAdd: boolean; + http: any; globals: FieldInteractionGlobals; currentKey: string; + isInvokedOnInit: boolean; appBridge: any; isActiveControlValid(): boolean; + mutatePickerConfig(key: string, options: any): any; + getActiveControl(): any; getActiveKey(): string; getActiveValue(): any; getActiveInitialValue(): any; + getFieldSet(key: string): any; getControl(key: string): any; + getFormGroupArray(key: string): any[]; getValue(key: string): any; getRawValue(key: string): any; getInitialValue(key: string): any; @@ -114,8 +130,12 @@ interface FieldInteractionAPI { }): void; setReadOnly(key: string, isReadOnly: boolean): void; setRequired(key: string, required: boolean): void; + setDescription(key: string, description: string): void; + highlight(key: string, isHighlighted: boolean): void; hide(key: string, clearValue?: boolean): void; show(key: string): void; + hideFieldSetHeader(key: string): void; + showFieldSetHeader(key: string): void; disable(key: string, options?: { onlySelf?: boolean; emitEvent?: boolean; @@ -125,6 +145,7 @@ interface FieldInteractionAPI { emitEvent?: boolean; }): void; markAsInvalid(key: string, validationMessage?: string): void; + markAsValid(key: string): void; markAsDirty(key: string, options?: { onlySelf?: boolean; }): void; @@ -144,17 +165,10 @@ interface FieldInteractionAPI { onlySelf?: boolean; emitEvent?: boolean; }): void; - displayToast(toastConfig: { - message: string; - title?: string; - hideDelay?: number; - icon?: string; - theme?: string; - position?: string; - isCloseable?: boolean; - customClass?: string; - }): void; - displayTip(key: string, tip: string, icon?: string, allowDismiss?: boolean): void; + displayToast(toastConfig: ToastOptions): void; + displayTip(key: string, tip: string, icon?: string, allowDismiss?: boolean, sanitize?: boolean): void; + clearTip(key: string): void; + setTooltip(key: string, tooltip: string): void; confirmChanges(key: string, message?: string): Promise; promptUser(key: string, changes: string[]): Promise; setProperty(key: string, prop: string, value: any): void; @@ -164,12 +178,16 @@ interface FieldInteractionAPI { hasField(key: string): boolean; addStaticOption(key: string, newOption: any): void; removeStaticOption(key: string, optionToRemove: string): void; + addPropertiesToPickerConfig(key: string, properties: { [key: string]: unknown }, otherForm?: unknown): void; modifyPickerConfig(key: string, config: { format?: string; + minSearchLength?: number; + enableInfiniteScroll?: boolean; optionsUrl?: string; optionsUrlBuilder?: Function; optionsPromise?: any; options?: any[]; + resultsTemplateType?: 'entity-picker'; }, mapper?: Function): void; setLoading(key: string, loading: boolean): void; addControl(key: string, metaForNewField: any, position?: string, initialValue?: any): void;