@dosgato/templating 1.1.10 → 1.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component.d.ts +11 -4
- package/dist/component.js +14 -5
- package/dist/uitemplate.d.ts +8 -0
- package/package.json +1 -1
package/dist/component.d.ts
CHANGED
|
@@ -211,20 +211,27 @@ export declare abstract class Component<DataType extends ComponentData = any, Fe
|
|
|
211
211
|
* render of the parent component.
|
|
212
212
|
*/
|
|
213
213
|
abstract render(): string;
|
|
214
|
+
/**
|
|
215
|
+
* If you are rendering a variation for a component that has areas and children,
|
|
216
|
+
* you can call Component.renderVariation(extension, this.renderedAreas) to help you easily
|
|
217
|
+
* render the areas and children inside whatever wrapper content you need.
|
|
218
|
+
*/
|
|
219
|
+
static renderVariation(extension: string, renderedAreas: Map<string, RenderedComponent[]>): string;
|
|
214
220
|
/**
|
|
215
221
|
* Sometimes pages are requested with an alternate extension like .rss or .ics. In these
|
|
216
222
|
* situations, each component should consider whether it should output anything. For
|
|
217
223
|
* instance, if the extension is .rss and a component represents an article, it should
|
|
218
224
|
* probably output an RSS item. If you don't recognize the extension, just return
|
|
219
|
-
*
|
|
225
|
+
* Component.renderVariation(extension, this.renderedAreas) to give your child components a chance to
|
|
220
226
|
* respond, or return empty string if you want your child components to be silent in all
|
|
221
227
|
* cases.
|
|
222
228
|
*
|
|
229
|
+
* If you implement this function to add content for a specific extension, you should also
|
|
230
|
+
* probably override `shouldFetchVariation` to return true for that extension. Also remember
|
|
231
|
+
* to use Component.renderVariation(extension, this.renderedAreas) to render your child components.
|
|
232
|
+
*
|
|
223
233
|
* The extension will NOT include the preceding dot. In the case of an extended extension like
|
|
224
234
|
* '.js.map', you will receive 'js.map'.
|
|
225
|
-
*
|
|
226
|
-
* This function will be run after the fetch phase. The context and html rendering phases
|
|
227
|
-
* will be skipped.
|
|
228
235
|
*/
|
|
229
236
|
renderVariation(extension: string): string;
|
|
230
237
|
/**
|
package/dist/component.js
CHANGED
|
@@ -85,23 +85,32 @@ export class Component extends ResourceProvider {
|
|
|
85
85
|
setContext(renderCtxFromParent, areaName) {
|
|
86
86
|
return renderCtxFromParent;
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* If you are rendering a variation for a component that has areas and children,
|
|
90
|
+
* you can call Component.renderVariation(extension, this.renderedAreas) to help you easily
|
|
91
|
+
* render the areas and children inside whatever wrapper content you need.
|
|
92
|
+
*/
|
|
93
|
+
static renderVariation(extension, renderedAreas) {
|
|
94
|
+
return Array.from(renderedAreas.values()).flatMap(ras => ras.map(ra => ra.output)).join('');
|
|
95
|
+
}
|
|
88
96
|
/**
|
|
89
97
|
* Sometimes pages are requested with an alternate extension like .rss or .ics. In these
|
|
90
98
|
* situations, each component should consider whether it should output anything. For
|
|
91
99
|
* instance, if the extension is .rss and a component represents an article, it should
|
|
92
100
|
* probably output an RSS item. If you don't recognize the extension, just return
|
|
93
|
-
*
|
|
101
|
+
* Component.renderVariation(extension, this.renderedAreas) to give your child components a chance to
|
|
94
102
|
* respond, or return empty string if you want your child components to be silent in all
|
|
95
103
|
* cases.
|
|
96
104
|
*
|
|
105
|
+
* If you implement this function to add content for a specific extension, you should also
|
|
106
|
+
* probably override `shouldFetchVariation` to return true for that extension. Also remember
|
|
107
|
+
* to use Component.renderVariation(extension, this.renderedAreas) to render your child components.
|
|
108
|
+
*
|
|
97
109
|
* The extension will NOT include the preceding dot. In the case of an extended extension like
|
|
98
110
|
* '.js.map', you will receive 'js.map'.
|
|
99
|
-
*
|
|
100
|
-
* This function will be run after the fetch phase. The context and html rendering phases
|
|
101
|
-
* will be skipped.
|
|
102
111
|
*/
|
|
103
112
|
renderVariation(extension) {
|
|
104
|
-
return
|
|
113
|
+
return Component.renderVariation(extension, this.renderedAreas);
|
|
105
114
|
}
|
|
106
115
|
/**
|
|
107
116
|
* helper function to print an area's component list, but you can also override this if you
|
package/dist/uitemplate.d.ts
CHANGED
|
@@ -350,6 +350,14 @@ export interface UIConfig {
|
|
|
350
350
|
hide?: boolean;
|
|
351
351
|
};
|
|
352
352
|
tracing?: TracingInterface;
|
|
353
|
+
/** Links that appear in the profile menu in the upper right corner of the editing environment. A logout
|
|
354
|
+
* menu is automatically added.
|
|
355
|
+
*/
|
|
356
|
+
profileMenuLinks?: {
|
|
357
|
+
label: string;
|
|
358
|
+
url: string;
|
|
359
|
+
icon?: IconOrSVG;
|
|
360
|
+
}[];
|
|
353
361
|
/** Non-Awaited async call for logging interface interactions if defined.
|
|
354
362
|
* Useful for defining how to log form submissions, interaction clicks, page edits, or state
|
|
355
363
|
* changes of different interfaces. Can be directed to separate endpoint for APM logging as
|