@ithinkdt/cloud
Version:
iThinkDT Cloud
75 lines (67 loc) • 2.11 kB
TypeScript
import { HttpInterceptor, Locale } from '@ithinkdt/common'
import { UserInfo, AuthInit, DictInit, I18nInit, PageInit, SSOInit, ThemeVars } from '@ithinkdt/core'
type AuthApi = Pick<
AuthInit,
'login' | 'logout' | 'loadAuthInfo' | 'changePwd' | 'loadMessages' | 'readMessages' | 'deleteMessages' | 'jwt'
>
type DictApi = Pick<DictInit, 'fetchDicts' | 'labelGetter' | 'valueGetter'>
declare interface AppConfig {
domain: string | undefined
logo: string
context: Record<string, string>
multiTab: boolean
accordionMenu: boolean
menuPlacement: 'sidebar' | 'topbar' | 'split'
collpaseBtnPlacement: 'sidebar' | 'topbar' | 'default'
i18n: boolean
locale: Locale | undefined
appearence: boolean
watermark: boolean
renderWatermark: (user: UserInfo) => object | undefined
footer: string | undefined
timeout: number | undefined
theme: {
[mode in 'light' | 'dark']: {
common: Partial<ThemeVars>
[type: string]: Record<string, string | boolean | number | undefined>
}
}
sso: SSOInit
appName: (appCode: string, locale: Locale) => string
}
declare function cloud(
appCode: string,
API_CTX: string,
context: {
SYS: string
DICT: string
FILE?: string
MC?: string
YIDA?: string
},
sourceApp?: string,
): {
loadConfig: (
apps?: { appCode: string; appName: string; url: string; logo: string; status: 0 | 1 }[],
) => Promise<AppConfig>
auth: AuthApi
dict: DictApi
lang: I18nInit['http']
page: Pick<
PageInit,
| 'transformListParams'
| 'fileUploader'
| 'fileInfo'
| 'fileDownload'
| 'filePreview'
| 'fileRemove'
| 'getUsers'
| 'getDepts'
>
cache: HttpInterceptor
msgi: HttpInterceptor
icon: Pick<PageInit, 'saveIcon' | 'getIcon' | 'getIconUri' | 'getIconRender'>
}
declare function getServerDate(): Promise<number>
declare function refreshAuthrization(): Promise<string>
export { cloud, getServerDate, refreshAuthrization }