@omnia/foundation
Version:
Provide omnia foundation typings and tooling work on client side for omnia extension
375 lines (374 loc) • 12.5 kB
TypeScript
import { Enums, GlueLayoutDisplayMode, GlueEditChromeLocation, GlueEditChromeTopbarLocation } from '../extensibility';
import { Observable } from 'rxjs/Rx';
export declare module IGlue {
interface IGluePageContext {
url: string;
pageTitle: string;
listTitle: string;
pageUrl: string;
pageId: string;
majorVersions: Array<IVersionIdentifier>;
layoutId: string;
controls: Array<IGluePageControl>;
clientsideCaching?: boolean;
checkedOutBy?: string;
isCheckOutByCurrentUser?: boolean;
}
interface IGluePageControl {
controlId: string;
instanceId: string;
scope: string;
settings: any;
controls: any;
zoneId: string;
zoneIndex: number;
isStatic?: boolean;
settingsKey?: string;
}
interface IGluePageData {
layoutId: string;
controls: Array<IGluePageControl>;
}
interface IGluePaneTabMetadata {
name: string;
icon: string;
tooltip: string;
}
interface IGluePaneContentMetadata {
name: string;
selector: string;
registerTo: Array<{
tab: string;
order: number;
}>;
module?: string;
}
interface IGluePaneTab {
iconCssClass: string;
component: any;
active?: boolean;
}
interface IGlueToolbarItemMetadata {
location: GlueEditChromeLocation;
name: string;
selector: string;
module?: string;
group?: string;
order?: number;
display?: boolean;
}
interface IGlueTopbarItemMetadata {
location: GlueEditChromeTopbarLocation;
name: string;
selector: string;
module?: string;
group?: string;
order?: number;
}
interface IEditChromeComponent {
name: string;
selector: string;
componentClass: Function;
module?: string;
display?: boolean;
}
interface ILayoutTemplate {
id: string;
title: string;
fileName?: string;
custom: boolean;
majorVersions?: Array<IVersionIdentifier>;
content: ILayoutTemplateDefinition;
isDefault?: boolean;
}
interface IGlueToolbarItemMetadataExtend extends IGlueToolbarItemMetadata, IEditChromeComponent {
}
interface IGluePaneContentMetadataExtend extends IGluePaneContentMetadata, IEditChromeComponent {
}
interface IGlueTopbarItemMetadataExtend extends IGlueTopbarItemMetadata, IEditChromeComponent {
}
interface IGluePageDesigner {
columns: Array<IGlue.IGroupZonesByColumn>;
zones: Array<IGlue.IZoneDefinition>;
template: IGlue.ILayoutTemplate;
design: IGlue.ILayoutDesign;
pageContext: IGluePageContext;
pageLayoutCannotBeFound: boolean;
pageCannotBeFound: boolean;
save: () => Observable<boolean>;
publish: () => Observable<boolean>;
undo: () => Observable<boolean>;
onGluePageContextChange: (newPageContext: IGluePageContext, renderCallback?: () => void) => void;
}
interface IGlueLayoutDesigner {
columns: Array<IGlue.IGroupZonesByColumn>;
zones: Array<IGlue.IZoneDefinition>;
currentLayout: IGlue.ILayoutTemplate;
design: IGlue.ILayoutDesign;
save: (layout: ILayoutTemplate) => Promise<void>;
publish: () => Observable<boolean>;
undo: () => Observable<boolean>;
delete: () => Observable<boolean>;
changeLayout: (layout: ILayoutTemplate, renderCallback?: () => void) => void;
onLayoutChanged: (callback: () => void) => void;
onLayoutSelected: (callback: (layout: ILayoutTemplate) => void) => void;
onLayoutUpdated: (callback: (layout: ILayoutTemplate) => void) => void;
enableEditing: (enable: boolean) => void;
onZoneAdded: (zone: IAddZoneDefinition) => Promise<void>;
onZoneSettingsChanged: (zone: IGlue.IZoneDefinition) => Promise<void>;
updateLayoutTitle: (templateId: string, title: string) => Promise<void>;
}
interface IGlueEditor {
pageDesigner: IGluePageDesigner;
layoutDesigner: IGlueLayoutDesigner;
display: (mode: GlueLayoutDisplayMode) => void;
layoutDisplayMode: GlueLayoutDisplayMode;
registerPaneContent(name: string, component: IGluePaneContent): any;
unRegisterPaneContent(name: string): any;
onPaneComponentDestroyed(name: string): {
then: (callback) => void;
};
getPaneComponent<T>(name: string): Promise<T>;
showSavingNotification: () => void;
showSuccessNotification: () => void;
onLayoutDisplayModeChanged: (callback: (mode: GlueLayoutDisplayMode) => void) => void;
}
interface IVersionHistorySettings {
resourceId: string;
majorVersions: Array<IVersionIdentifier>;
}
interface IVersionIdentifier {
versionLabel: number;
createdAt: Date;
}
interface IGlueResource {
id: string;
meta?: string;
scope?: string;
editingBy?: string;
versions?: Array<IGlueResourceVersion>;
canBeEdited?: boolean;
existed?: boolean;
}
interface IGlueResourceVersion {
glueResourceId: string;
majorVersion: number;
minorVersion: number;
meta?: string;
scope?: string;
content: string;
createdBy?: string;
createdAt?: string;
createdAtSocialTime?: string;
}
interface IGlueResourceVersionResult {
glueResourceVersion: IGlueResourceVersion;
isCheckedOutByOtherUser?: boolean;
}
interface IGlueResourceSaveOperation {
glueResourceId: string;
onSaved: (version: IGlueResourceVersion) => void;
onError: (errorMessage: string) => void;
content: any;
meta?: any;
scope?: string;
}
interface IGluePaneContent {
}
interface IVersionHistory extends IGluePaneContent {
resource: IGlueResource;
configure: (settings: IVersionHistorySettings) => void;
clearConfiguration: () => void;
saveVersion: (saveOperation: IGlueResourceSaveOperation) => void;
onVersionSelected: (callback: (version: IGlueResourceVersion) => void) => void;
onVersionRestored: (callback: (version: IGlueResourceVersion) => void) => void;
onLatestVersionChanged: (callback: (latestVersion: IGlueResourceVersion) => void) => void;
addNewMajorVersion: (majorVersion: IVersionIdentifier) => void;
}
interface IStaticGluePart {
controlId?: string;
instanceId?: string;
scope?: string;
cssClass?: string;
}
interface IGluePartItem {
controlId?: string;
component?: any;
id?: string;
title?: string;
icon?: string;
scope?: string;
isStatic?: boolean;
editable?: boolean;
zoneIndex?: number;
enableSettings?: boolean;
enableSkeletonLoading?: boolean;
cssClass?: string;
settings?: any;
controls?: any;
settingsKey?: string;
}
interface IGluePartItemPanel {
controlId?: string;
title?: string;
group?: string;
icon?: string;
}
interface ILayoutTemplateDefinition {
design: {
layout: {
zoneWidth: number;
columns?: Array<any>;
};
zone?: {
sizes: Array<any>;
};
};
zones?: Array<{
id: string;
title: string;
column: number;
row: number;
size: number;
cssClass?: string;
inlineStyle?: string;
responsive?: IZoneResponsive;
controls?: Array<IStaticGluePart>;
}>;
}
interface ILayoutDesign {
layout?: {
margins?: Array<number>;
draggable?: boolean;
resizable?: boolean;
max_cols?: number;
max_rows?: number;
visible_cols?: number;
visible_rows?: number;
min_cols?: number;
min_rows?: number;
col_width?: number;
row_height?: number;
cascade?: string;
min_width?: number;
min_height?: number;
fix_to_grid?: boolean;
auto_style?: boolean;
auto_resize?: boolean;
maintain_ratio?: boolean;
prefer_new?: boolean;
limit_to_screen?: boolean;
columns?: Array<any>;
};
zone?: {
backgroundColor?: string;
col?: number;
row?: number;
sizex?: number;
sizey?: number;
dragHandle?: string;
resizeHandle?: string;
borderSize?: number;
fixed?: boolean;
draggable?: boolean;
resizable?: boolean;
payload?: any;
maxCols?: number;
minCols?: number;
maxRows?: number;
minRows?: number;
minWidth?: number;
minHeight?: number;
sizes?: Array<IZoneSize>;
};
}
interface IAddZoneDefinition {
id?: string;
title?: string;
size: number;
}
interface IZoneDefinition {
width?: number;
left?: number;
top?: number;
id?: string;
col?: number;
row?: number;
sizex?: number;
cssClass?: string;
inlineStyle?: string;
isFullWidth?: boolean;
controls?: Array<IGluePartItem>;
design?: {
col?: number;
row?: number;
sizex?: number;
sizey?: number;
dragHandle?: string;
resizeHandle?: string;
borderSize?: number;
fixed?: boolean;
draggable?: boolean;
resizable?: boolean;
payload?: any;
maxCols?: number;
minCols?: number;
maxRows?: number;
minRows?: number;
minWidth?: number;
minHeight?: number;
};
title?: string;
responsive?: IZoneResponsive;
hide?: boolean;
}
interface IZoneSize {
title: string;
size: number;
}
interface ILayoutSetting {
templateId?: string;
zones?: Array<IZoneDefinition>;
}
interface ILayoutRow {
index: number;
zones?: Array<IZoneDefinition>;
}
interface IGroupZonesByColumn {
index: number;
width: string;
rows?: Array<ILayoutRow>;
}
interface IZoneResponsive {
type?: Enums.GlueZoneResponsiveType;
value?: any;
}
interface IPageSettings {
onPageCheckoutStatusChange: (callback: (pageCanBeEdited: boolean, pageIsBeingEditedBy: string) => void) => void;
}
interface ILayoutSettings {
onLayoutCheckoutStatusChange: (callback: (layoutCanBeEdited: boolean, layoutIsBeingEditedBy: string) => void) => void;
deleteLayout: (layout: IGlue.ILayoutTemplate) => void;
onLayoutTitleChange: (callBack: () => void) => void;
}
interface IZoneSettings {
configure(zone: IZoneDefinition): void;
onZoneSettingsConfigured: (callback: () => void) => void;
}
interface IPagePreview {
getAllPreviewModes: () => Array<{
title: string;
id: Enums.GluePreviewMode;
}>;
setPreviewMode: (previewMode: Enums.GluePreviewMode) => void;
onPreviewModeSelected: (callback: (previewMode: Enums.GluePreviewMode) => void) => void;
}
interface IGlueResourceOperationResult {
isSuccess: boolean;
isCheckedOutByOtherUser: boolean;
}
interface IGlueLayoutRestoreResult {
isCheckedOutByOtherUser: boolean;
versionContent: string;
}
}