@dosgato/templating 0.0.72 → 0.0.73
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 +1 -1
- package/dist/component.js +3 -2
- package/package.json +1 -1
package/dist/component.d.ts
CHANGED
|
@@ -314,7 +314,7 @@ export interface RenderComponentsOpts {
|
|
|
314
314
|
*
|
|
315
315
|
* If you need it (unlikely), the full component object is provided as a second parameter.
|
|
316
316
|
*/
|
|
317
|
-
wrap?: (output: string, c
|
|
317
|
+
wrap?: (output: string, c?: Component) => string;
|
|
318
318
|
/**
|
|
319
319
|
* Options for each edit bar; also accepts functions for label and extraClass
|
|
320
320
|
*/
|
package/dist/component.js
CHANGED
|
@@ -123,14 +123,15 @@ export class Component extends ResourceProvider {
|
|
|
123
123
|
const components = this.renderedAreas.get(areaName) ?? [];
|
|
124
124
|
const ownedComponentCount = components.filter(c => !c.component.inheritedFrom).length;
|
|
125
125
|
const full = !!(opts?.max && ownedComponentCount >= opts.max);
|
|
126
|
+
const wrap = opts?.wrap ?? defaultWrap;
|
|
126
127
|
let output = this.renderComponents(components, { ...opts, editBarOpts: { ...opts?.editBarOpts, disableDelete: ownedComponentCount <= (opts?.min ?? 0), disableDrop: full } });
|
|
127
128
|
if (!opts?.skipBars) {
|
|
128
129
|
if (full) {
|
|
129
130
|
if (!opts.hideMaxWarning)
|
|
130
|
-
output += this.newBar(areaName, { ...opts.newBarOpts, label: opts.maxWarning ?? 'Maximum Reached', disabled: true });
|
|
131
|
+
output += wrap(this.newBar(areaName, { ...opts.newBarOpts, label: opts.maxWarning ?? 'Maximum Reached', disabled: true }));
|
|
131
132
|
}
|
|
132
133
|
else {
|
|
133
|
-
output += this.newBar(areaName, opts?.newBarOpts);
|
|
134
|
+
output += wrap(this.newBar(areaName, opts?.newBarOpts));
|
|
134
135
|
}
|
|
135
136
|
}
|
|
136
137
|
return output;
|