@omnia/foundation
Version:
Provide omnia foundation typings and tooling work on client side for omnia extension
274 lines (273 loc) • 10.7 kB
TypeScript
import { Type, ModuleWithProviders, SchemaMetadata, NgModule, NgModuleRef, Component, Provider } from '@angular/core';
import * as Models from '../../models';
export interface OmniaAngular2Bootstrapper {
bootstrapAngular2HybridApp: (container, modules, configs) => void;
bootstrapAngular2App: (component) => void;
}
export declare module Application {
function bootstrapAngular(containerId: any, optionalCallback: Function): void;
function destroyAngularApp(container: any): void;
}
export interface IContextInfo {
masterpageScriptLoaded: boolean;
tid: string;
turl: string;
cdnUrl: string;
foundationUrl: string;
appRedirectUrl: string;
navigationSourceUrl: string;
tokenKey: string;
tokenExpireTime: number;
apiBaseUrl: string;
coreServicesUrl: string;
language: string;
featureResourceId: string;
tadminurl: string;
isOnPrem: boolean;
authorizedRoles: string;
customConfigurations: any;
defaultTextAndIconColor: string;
defaultBackgroundColor: string;
hasReadPermissionOnNavSrc: boolean;
siteCollectionRelativeUrl: string;
siteRelativeUrl: string;
siteUrl: string;
siteCollectionUrl: string;
pageUrl: string;
pageItemId: string;
userPermissions: IUserContext;
isGluePage: boolean;
defaultPageItemId?: number;
}
export interface IUserContext {
hasFullPagePermission: boolean;
}
export interface ITokenCookie {
loginName: string;
token: string;
}
export interface INavSourcesPermissionCookie {
navSourceUrl: string;
hasReadPermission: boolean;
}
export declare function isControlInGluePage(): boolean;
export declare function isGlueEditMode(): boolean;
/**
* Generic factory method for Angular directives
*/
export declare function directiveFactory(directiveClass: any, dependencies: Array<string>): any;
export declare function TemplateId(id: string): (target: Function) => void;
export declare function getNgModule(controlId: string): any;
export declare function getComponent(controlId: string): any;
export interface BootstrapQueue {
data?: any;
priority: number;
bootstrapFunction: (data) => void;
}
export interface OmniaControlSelectorInsertion {
instanceId: string;
cssClass?: string;
insertTo: any;
scope?: string;
uiControl?: boolean;
sequence?: number;
priority?: number;
controlContainer?: JQuery;
delayBootstrap?: () => Promise<void>;
}
export interface OmniaControlMetadata extends Component {
id: string;
templateId?: string;
enableSettings?: boolean;
enableSkeletonLoading?: boolean;
onBootstrapping?: () => void;
title?: string;
icon?: string;
group?: string;
showInPageDesigner?: boolean;
showInLayoutDesigner?: boolean;
insertUsingSelector?: OmniaControlSelectorInsertion | Array<OmniaControlSelectorInsertion>;
modulePath?: string;
enableAot?: boolean;
providers?: Provider[];
declarations?: Array<Type<any> | any[]>;
imports?: Array<Type<any> | ModuleWithProviders | any[]>;
schemas?: Array<SchemaMetadata | any[]>;
exports?: Array<Type<any> | any[]>;
}
export declare function OmniaControl(obj: OmniaControlMetadata): (target: any) => void;
export interface IOmniaAdminControl {
selector: string;
componentTarget?: any;
moduleTarget?: any;
}
export interface OmniaAdminControlMetadata extends Component {
templateId?: string;
navigation: Models.INavigationNode;
providers?: Provider[];
declarations?: Array<Type<any> | any[]>;
imports?: Array<Type<any> | ModuleWithProviders | any[]>;
schemas?: Array<SchemaMetadata | any[]>;
exports?: Array<Type<any> | any[]>;
}
export declare function OmniaAdminControl(obj: OmniaAdminControlMetadata): (target: any) => void;
export declare function getNG1Provider(provider: string, callBack: (provider) => void): void;
export declare function getAdminAppSubNavigationNodes(): Array<Models.INavigationNode>;
export declare function getRegisteredAdminModuleMetadata(): NgModule;
export declare module Logging {
enum LogTypes {
Info = 0,
Warning = 1,
Error = 2,
}
/**
* Logs the text to the console
*/
function Log(itemToLog: any, logType: LogTypes): void;
function LogTime(message: any, start?: number): void;
function LogTimeWithThresholds(message: string, start: number, maxTimeWarning: number, maxTimeError: number): void;
}
export declare module UI {
interface IImageOption {
srcUrl: string;
originalImage: string;
}
function toggleSearchbox(triggerButton: any): void;
function openSPModalDialog(dialogOptions: any): void;
function buildImageTag(options: IImageOption): string;
function clearUndoOnTinymce(): void;
}
export declare module Notification {
import NotificationMessage = Models.Notification.INotificationMessage;
function setNotificationFunction(showFunction: (message: NotificationMessage) => any, clearFunction: (toasterId: string, toastId: string) => any): void;
function showNotification(message: NotificationMessage): void;
function clearNotification(toasterId?: string, toastId?: string): void;
}
export declare module Bootstrapper {
import ControlViewPortSettings = Models.Control.IControlViewPortSettings;
interface IAsyncDeltaManager {
add_endRequest: (callback: () => any) => void;
}
function resolveScriptViewControlsForMDS(): void;
interface IViewPortControl {
viewPortSettings?: ControlViewPortSettings;
svc?: any;
html?: string;
bootstrapped?: boolean;
}
class ViewPortControlDictionary {
[svcId: string]: IViewPortControl;
}
function init(step: number): void;
function getSpTokenCookieName(): string;
function ensureSPTokenProxy(force?: boolean): any;
/**
* Gets the deferred spToken that will be resolved when ready
*/
function getSPToken(): any;
/**
* Gets the deferred _masterpageJsDeffered that will be resolved when ready
*/
function ensureMasterPageJsLoaded(): any;
/**
* Ensures that the token is loaded
*/
function ensureSPToken(): any;
/**
* The jsonp callback to get token onprem
*/
function setTokenKeyOnPrem(tokenKeyInfo: string): void;
function checkReadPermissionOnNavSrc(callback: () => any): void;
/**
* Register directive template
*/
function registerTemplate(templateId: string): void;
/**
* Get directive template
*/
function getTemplate(templateId: string): any;
/**
* Resolve all registered directive templates
*/
function resolveTemplates(force?: boolean): any;
/**
* Set configuration for SVControl
*/
function setOmcConfig(omcId: string, config: any): void;
/**
* Get configuration for SVControl
*/
function getOmcConfig(id: string): any;
/**
* Reload a ScripView Control
*/
function reloadScriptViewControl(container: JQuery): any;
interface IOmniaControl {
id: string;
title: string;
icon: string;
group: string;
selector: string;
viewId?: string;
enableSettings: boolean;
priority?: number;
enableSkeletonLoading: boolean;
insertUsingSelector?: OmniaControlSelectorInsertion | Array<OmniaControlSelectorInsertion>;
component?: any;
showInPageDesigner?: boolean;
showInLayoutDesigner?: boolean;
}
function blockControl(instanceId: string): void;
function isControlBlocked(instanceId: string): any;
function registerControl(control: IOmniaControl): void;
function getRegisteredControls(): {
[id: string]: IOmniaControl;
};
function getBootstrappedAngular2Modules(): {
[id: string]: NgModuleRef<any>;
};
function resolveOmniaControlsUsingSelector(): void;
function getOmniaControlSettings(omcDependecies: Array<any>): Promise<any>;
/**
* Resolves Omnia Controls
*/
function resolveOmniaControls(panelContainer?: any, handleViewPortControlEventName?: string, handleBootstrap?: Function, selectorRegisteredControls?: Array<OmniaControlSelectorInsertion>): void;
function getCachedControls(): {
controls: Array<any>;
templates?: Array<string>;
};
function cacheControlsIfNeed(controls: Array<any>, templates?: {
[id: string]: string;
}, reloadControl?: boolean): void;
function bootstrapAsyncUseQueue(queues?: Array<BootstrapQueue>): void;
function buildBootstrapQueues(controls: Array<any>, templates: any): Array<BootstrapQueue>;
function injectControlViewsAndConfigs(controls: any, templates: any): void;
function getAllTemplates(): any;
function deleteViewPort(containerId: any): void;
function addOrUpdateViewPort(containerId: any, settings: any): void;
function getViewPort(containerId: any): IViewPortControl;
function getAllViewPorts(): ViewPortControlDictionary;
function handleViewPortControlsVisibility(): void;
function showAllViewPortControls(): void;
function bootstrapViewPortControl(containerId: string, control: IViewPortControl): void;
function bootstrapControl(containerId: string, container: JQuery, svc: any): void;
function handleControlVisibilityEvent(eventName: string): void;
}
export declare function checkIfDisplayViewPort(windowWidth: number, viewPortSettings: Models.Control.IControlViewPortSettings): boolean;
export interface IViewPortComponent {
viewPortSettings: Models.Control.IControlViewPortSettings;
load: Function;
destroy: Function;
loaded: boolean;
}
export declare function registerViewPortComponent(id: string, viewPortSettings: Models.Control.IControlViewPortSettings, loaded: boolean, load: Function, destroy: Function): void;
export declare function handleViewPortComponent(): void;
export declare function LocalizePrefix(prefix?: string): Provider;
export declare module HttpRequestProxy {
interface IHttpRequestProxyResult {
then: (resolve?: (data?) => void, reject?: (err?) => void) => void;
}
function dispatcher(key: string, request: (resolve: any, reject: any) => void): IHttpRequestProxyResult;
function loadQuicker(key: string, request: (resolve: any, reject?: any) => void, callBack: (...args: any[]) => void): void;
}
export declare function calculateHeightofScreen(): void;