@dosgato/templating 0.0.65 → 0.0.67

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.
@@ -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
- let output = this.renderComponents(components, { hideInheritBars: opts?.hideInheritBars, editBarOpts: { ...opts?.editBarOpts, disableDelete: ownedComponentCount <= (opts?.min ?? 0) } });
115
- if (opts?.max && ownedComponentCount >= opts.max) {
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
- opts.label ?? (opts.label = this.newLabel(areaName) ?? (this.areas.size > 1 ? `Add ${areaName} Content` : `Add ${this.autoLabel} Content`));
190
- opts.extraClass ?? (opts.extraClass = this.newClass(areaName));
191
- opts.editMode ?? (opts.editMode = this.editMode);
192
- return Component.newBar([this.path, 'areas', areaName].filter(isNotBlank).join('.'), opts);
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,
@@ -1,4 +1,4 @@
1
- import { ComponentData } from './component';
1
+ import { ComponentData } from './component.js';
2
2
  export interface SvelteComponent {
3
3
  $set: (props?: Record<string, any>) => void;
4
4
  $on: (event: string, callback: (event: any) => void) => () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosgato/templating",
3
- "version": "0.0.65",
3
+ "version": "0.0.67",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {