Skip to content

Commit

Permalink
update typings (#55)
Browse files Browse the repository at this point in the history
Co-authored-by: Angus Yiu <[email protected]>
  • Loading branch information
angusyyl and Angus Yiu authored Jul 20, 2023
1 parent ecfb741 commit 6e37617
Showing 1 changed file with 39 additions and 21 deletions.
60 changes: 39 additions & 21 deletions typings.d.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -52,6 +68,7 @@ interface PageInteractionAPI {
currentEntityId: string;
currentEntityTrack: string;
pageContext: string;
subEntity: string;
http: any;
toastService: any;
modalService: any;
Expand All @@ -60,16 +77,7 @@ interface PageInteractionAPI {
headerText: string;
subheaderText: string
}): Promise<boolean>;
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 {
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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<boolean>;
promptUser(key: string, changes: string[]): Promise<boolean>;
setProperty(key: string, prop: string, value: any): void;
Expand All @@ -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;
Expand Down

0 comments on commit 6e37617

Please sign in to comment.