UNPKG

13.2 kBTypeScriptView Raw
1import { Enums, GlueLayoutDisplayMode, GlueEditChromeLocation, GlueEditChromeTopbarLocation } from '../extensibility';
2import { Observable } from 'rxjs/Rx';
3export declare module IGlue {
4 interface IGluePageContext {
5 url: string;
6 pageTitle: string;
7 listTitle: string;
8 pageUrl: string;
9 pageId: string;
10 majorVersions: Array<IVersionIdentifier>;
11 layoutId: string;
12 controls: Array<IGluePageControl>;
13 clientsideCaching?: boolean;
14 checkedOutBy?: string;
15 isCheckOutByCurrentUser?: boolean;
16 }
17 interface IGluePageControl {
18 controlId: string;
19 instanceId: string;
20 scope: string;
21 settings: any;
22 controls: any;
23 zoneId: string;
24 zoneIndex: number;
25 isStatic?: boolean;
26 settingsKey?: string;
27 }
28 interface IGluePageData {
29 layoutId: string;
30 controls: Array<IGluePageControl>;
31 }
32 interface IGluePaneTabMetadata {
33 name: string;
34 icon: string;
35 tooltip: string;
36 }
37 interface IGluePaneContentMetadata {
38 name: string;
39 registerTo: Array<{
40 tab: string;
41 order: number;
42 }>;
43 modulePath?: string;
44 ngfactoryModulePath?: string;
45 }
46 interface IGluePaneTab {
47 iconCssClass: string;
48 component: any;
49 active?: boolean;
50 }
51 interface IGlueToolbarItemMetadata {
52 location: GlueEditChromeLocation;
53 name: string;
54 modulePath?: string;
55 ngfactoryModulePath?: string;
56 group?: string;
57 order?: number;
58 display?: boolean;
59 }
60 interface IGlueTopbarItemMetadata {
61 location: GlueEditChromeTopbarLocation;
62 name: string;
63 modulePath?: string;
64 ngfactoryModulePath?: string;
65 group?: string;
66 order?: number;
67 }
68 interface IEditChromeComponent {
69 name: string;
70 componentType: any;
71 modulePath?: string;
72 ngsummaryModulePath?: string;
73 display?: boolean;
74 }
75 interface ILayoutTemplate {
76 id: string;
77 title: string;
78 fileName?: string;
79 custom: boolean;
80 majorVersions?: Array<IVersionIdentifier>;
81 content: ILayoutTemplateDefinition;
82 isDefault?: boolean;
83 }
84 interface IGlueToolbarItemMetadataExtend extends IGlueToolbarItemMetadata, IEditChromeComponent {
85 }
86 interface IGluePaneContentMetadataExtend extends IGluePaneContentMetadata, IEditChromeComponent {
87 }
88 interface IGlueTopbarItemMetadataExtend extends IGlueTopbarItemMetadata, IEditChromeComponent {
89 }
90 interface IGluePageDesigner {
91 columns: Array<IGlue.IGroupZonesByColumn>;
92 zones: Array<IGlue.IZoneDefinition>;
93 template: IGlue.ILayoutTemplate;
94 design: IGlue.ILayoutDesign;
95 pageContext: IGluePageContext;
96 pageLayoutCannotBeFound: boolean;
97 pageCannotBeFound: boolean;
98 getGluePageData: () => Observable<IGlue.IGluePageData>;
99 save: () => Observable<boolean>;
100 publish: () => Observable<boolean>;
101 undo: () => Observable<boolean>;
102 onGluePageContextChange: (newPageContext: IGluePageContext, renderCallback?: () => void) => void;
103 }
104 interface IGlueLayoutDesigner {
105 columns: Array<IGlue.IGroupZonesByColumn>;
106 zones: Array<IGlue.IZoneDefinition>;
107 selectedLayoutId: string;
108 currentLayout: IGlue.ILayoutTemplate;
109 design: IGlue.ILayoutDesign;
110 save: (layout: ILayoutTemplate) => Promise<void>;
111 publish: () => Observable<boolean>;
112 undo: () => Observable<boolean>;
113 delete: () => Observable<boolean>;
114 changeLayout: (layout: ILayoutTemplate, renderCallback?: () => void) => void;
115 onLayoutChanged: (callback: () => void) => void;
116 onLayoutSelected: (callback: (layout: ILayoutTemplate) => void) => void;
117 onLayoutUpdated: (callback: (layout: ILayoutTemplate) => void) => void;
118 enableEditing: (enable: boolean) => void;
119 onZoneAdded: (zone: IAddZoneDefinition) => Promise<void>;
120 onZoneSettingsChanged: (zone: IGlue.IZoneDefinition) => Promise<void>;
121 updateLayoutTitle: (templateId: string, title: string) => Promise<void>;
122 cascadeToLeft: (allow: boolean) => void;
123 display: (mode: Enums.GlueLayoutDesignerDisplayMode) => void;
124 exportLayout: () => any;
125 status: {
126 [index: string]: any;
127 };
128 }
129 interface IGlueEditor {
130 pageDesigner: IGluePageDesigner;
131 layoutDesigner: IGlueLayoutDesigner;
132 display: (mode: GlueLayoutDisplayMode) => void;
133 layoutDisplayMode: GlueLayoutDisplayMode;
134 registerPaneContent(name: string, component: IGluePaneContent): any;
135 unRegisterPaneContent(name: string): any;
136 onPaneComponentDestroyed(name: string): {
137 then: (callback) => void;
138 };
139 getPaneComponent<T>(name: string): Promise<T>;
140 showSavingNotification: () => void;
141 showSuccessNotification: () => void;
142 onLayoutDisplayModeChanged: (callback: (mode: GlueLayoutDisplayMode) => void) => void;
143 }
144 interface IVersionHistorySettings {
145 resourceId: string;
146 majorVersions: Array<IVersionIdentifier>;
147 }
148 interface IVersionIdentifier {
149 versionLabel: number;
150 createdAt: Date;
151 }
152 interface IGlueResource {
153 id: string;
154 meta?: string;
155 scope?: string;
156 editingBy?: string;
157 modifiedAt?: Date;
158 versions?: Array<IGlueResourceVersion>;
159 canBeEdited?: boolean;
160 existed?: boolean;
161 }
162 interface IGlueResourceVersion {
163 glueResourceId: string;
164 majorVersion: number;
165 minorVersion: number;
166 meta?: string;
167 scope?: string;
168 content: string;
169 createdBy?: string;
170 createdAt?: string;
171 createdAtSocialTime?: string;
172 }
173 interface IGlueResourceVersionResult {
174 glueResourceVersion: IGlueResourceVersion;
175 isCheckedOutByOtherUser?: boolean;
176 }
177 interface IGlueResourceSaveOperation {
178 glueResourceId: string;
179 onSaved: (version: IGlueResourceVersion) => void;
180 onError: (errorMessage: string) => void;
181 content: any;
182 meta?: any;
183 scope?: string;
184 }
185 interface IGluePaneContent {
186 }
187 interface IVersionHistory extends IGluePaneContent {
188 resource: IGlueResource;
189 configure: (settings: IVersionHistorySettings) => Promise<void>;
190 clearConfiguration: () => void;
191 saveVersion: (saveOperation: IGlueResourceSaveOperation) => void;
192 onVersionSelected: (callback: (version: IGlueResourceVersion) => void) => void;
193 onVersionRestored: (callback: (version: IGlueResourceVersion) => void) => void;
194 onLatestVersionChanged: (callback: (latestVersion: IGlueResourceVersion) => void) => void;
195 addNewMajorVersion: (majorVersion: IVersionIdentifier) => void;
196 }
197 interface IStaticGluePart {
198 controlId?: string;
199 instanceId?: string;
200 scope?: string;
201 cssClass?: string;
202 }
203 interface IGluePartItem {
204 controlId?: string;
205 component?: any;
206 id?: string;
207 title?: string;
208 icon?: string;
209 scope?: string;
210 isStatic?: boolean;
211 editable?: boolean;
212 zoneIndex?: number;
213 enableSettings?: boolean;
214 enableSkeletonLoading?: boolean;
215 cssClass?: string;
216 settings?: any;
217 controls?: any;
218 settingsKey?: string;
219 visibleViewPort?: boolean;
220 gluePartSkeleton?: string;
221 notExistOmniaControlDecorator?: boolean;
222 }
223 interface IGluePartItemPanel {
224 controlId?: string;
225 title?: string;
226 group?: string;
227 icon?: string;
228 }
229 interface ILayoutTemplateDefinition {
230 design: {
231 layout: {
232 zoneWidth: number;
233 columns?: Array<any>;
234 };
235 zone?: {
236 sizes: Array<any>;
237 };
238 };
239 zones?: Array<{
240 id: string;
241 title: string;
242 editable?: boolean;
243 column: number;
244 row: number;
245 size: number;
246 width?: number;
247 cssClass?: string;
248 inlineStyle?: string;
249 responsive?: IZoneResponsive;
250 controls?: Array<IStaticGluePart>;
251 }>;
252 }
253 interface ILayoutDesign {
254 layout?: {
255 makeChange?: boolean;
256 margins?: Array<number>;
257 draggable?: boolean;
258 resizable?: boolean;
259 max_cols?: number;
260 max_rows?: number;
261 visible_cols?: number;
262 visible_rows?: number;
263 min_cols?: number;
264 min_rows?: number;
265 col_width?: number;
266 row_height?: number;
267 cascade?: string;
268 min_width?: number;
269 min_height?: number;
270 fix_to_grid?: boolean;
271 auto_style?: boolean;
272 auto_resize?: boolean;
273 maintain_ratio?: boolean;
274 prefer_new?: boolean;
275 limit_to_screen?: boolean;
276 columns?: Array<any>;
277 };
278 zone?: {
279 backgroundColor?: string;
280 col?: number;
281 row?: number;
282 sizex?: number;
283 sizey?: number;
284 dragHandle?: string;
285 resizeHandle?: string;
286 borderSize?: number;
287 fixed?: boolean;
288 draggable?: boolean;
289 resizable?: boolean;
290 payload?: any;
291 maxCols?: number;
292 minCols?: number;
293 maxRows?: number;
294 minRows?: number;
295 minWidth?: number;
296 minHeight?: number;
297 sizes?: Array<IZoneSize>;
298 };
299 }
300 interface IAddZoneDefinition {
301 id?: string;
302 title?: string;
303 size: number;
304 }
305 interface IZoneDefinition {
306 width?: number;
307 left?: number;
308 top?: number;
309 id?: string;
310 col?: number;
311 row?: number;
312 sizex?: number;
313 cssClass?: string;
314 inlineStyle?: string;
315 isFullWidth?: boolean;
316 controls?: Array<IGluePartItem>;
317 design?: {
318 col?: number;
319 row?: number;
320 sizex?: number;
321 sizey?: number;
322 dragHandle?: string;
323 resizeHandle?: string;
324 borderSize?: number;
325 fixed?: boolean;
326 draggable?: boolean;
327 resizable?: boolean;
328 payload?: any;
329 maxCols?: number;
330 minCols?: number;
331 maxRows?: number;
332 minRows?: number;
333 minWidth?: number;
334 minHeight?: number;
335 };
336 title?: string;
337 responsive?: IZoneResponsive;
338 hide?: boolean;
339 editable?: boolean;
340 }
341 interface IZoneSize {
342 title: string;
343 size: number;
344 }
345 interface ILayoutSetting {
346 templateId?: string;
347 zones?: Array<IZoneDefinition>;
348 }
349 interface ILayoutRow {
350 index: number;
351 width: number;
352 zones?: Array<IZoneDefinition>;
353 }
354 interface IGroupZonesByColumn {
355 index: number;
356 width: string;
357 rows?: Array<ILayoutRow>;
358 }
359 interface IZoneResponsive {
360 type?: Enums.GlueZoneResponsiveType;
361 value?: any;
362 }
363 interface IPageSettings {
364 onPageCheckoutStatusChange: (callback: (pageCanBeEdited: boolean, pageIsBeingEditedBy: string) => void) => void;
365 }
366 interface ILayoutSettings {
367 onLayoutCheckoutStatusChange: (callback: (layoutCanBeEdited: boolean, layoutIsBeingEditedBy: string) => void) => void;
368 deleteLayout: (layout: IGlue.ILayoutTemplate) => void;
369 onLayoutTitleChange: (callBack: () => void) => void;
370 }
371 interface IZoneSettings {
372 configure(zone: IZoneDefinition): void;
373 onZoneSettingsConfigured: (callback: () => void) => void;
374 }
375 interface IPagePreview {
376 getAllPreviewModes: () => Array<{
377 title: string;
378 id: Enums.GluePreviewMode;
379 }>;
380 setPreviewMode: (previewMode: Enums.GluePreviewMode) => void;
381 onPreviewModeSelected: (callback: (previewMode: Enums.GluePreviewMode) => void) => void;
382 }
383 interface IGlueResourceOperationResult {
384 isSuccess: boolean;
385 isCheckedOutByOtherUser: boolean;
386 }
387 interface IGlueLayoutRestoreResult {
388 isCheckedOutByOtherUser: boolean;
389 versionContent: string;
390 }
391 interface ITakeControlResult {
392 isResourceFound: boolean;
393 }
394}