@dosgato/templating 0.0.65 → 0.0.66
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 -0
- package/dist/component.js +8 -6
- package/package.json +1 -1
package/dist/component.d.ts
CHANGED
|
@@ -269,6 +269,7 @@ interface BarOpts {
|
|
|
269
269
|
export interface EditBarOpts extends BarOpts {
|
|
270
270
|
inheritedFrom?: string;
|
|
271
271
|
disableDelete?: boolean;
|
|
272
|
+
disableDrop?: boolean;
|
|
272
273
|
hideEdit?: boolean;
|
|
273
274
|
}
|
|
274
275
|
export interface RenderAreaEditBarOpts extends Omit<Omit<EditBarOpts, 'label'>, 'extraClass'> {
|
package/dist/component.js
CHANGED
|
@@ -111,8 +111,9 @@ export class Component extends ResourceProvider {
|
|
|
111
111
|
renderArea(areaName, opts) {
|
|
112
112
|
const components = this.renderedAreas.get(areaName) ?? [];
|
|
113
113
|
const ownedComponentCount = components.filter(c => !c.component.inheritedFrom).length;
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
const full = !!(opts?.max && ownedComponentCount >= opts.max);
|
|
115
|
+
let output = this.renderComponents(components, { hideInheritBars: opts?.hideInheritBars, editBarOpts: { ...opts?.editBarOpts, disableDelete: ownedComponentCount <= (opts?.min ?? 0), disableDrop: full } });
|
|
116
|
+
if (full) {
|
|
116
117
|
if (!opts.hideMaxWarning)
|
|
117
118
|
output += this.newBar(areaName, { ...opts.newBarOpts, label: opts.maxWarning ?? 'Maximum Reached', disabled: true });
|
|
118
119
|
}
|
|
@@ -186,10 +187,11 @@ export class Component extends ResourceProvider {
|
|
|
186
187
|
* Generally should not be overridden - override newLabel and newClass instead
|
|
187
188
|
*/
|
|
188
189
|
newBar(areaName, opts = {}) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
const options = { ...opts };
|
|
191
|
+
options.label ?? (options.label = this.newLabel(areaName) ?? (this.areas.size > 1 ? `Add ${areaName} Content` : `Add ${this.autoLabel} Content`));
|
|
192
|
+
options.extraClass ?? (options.extraClass = this.newClass(areaName));
|
|
193
|
+
options.editMode ?? (options.editMode = this.editMode);
|
|
194
|
+
return Component.newBar([this.path, 'areas', areaName].filter(isNotBlank).join('.'), options);
|
|
193
195
|
}
|
|
194
196
|
/**
|
|
195
197
|
* For logging errors during rendering without crashing the render. If your fetch, setContext,
|