UNPKG

@umbraco/json-models-builders

Version:
80 lines 2.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DocumentBlueprintsValueBuilder = void 0; const blockGridValueBuilder_1 = require("../document/blockGridValueBuilder"); const blockListValueBuilder_1 = require("../document/blockListValueBuilder"); class DocumentBlueprintsValueBuilder { parentBuilder; culture; segment; alias; value; editorAlias; entityType; blockGridValueBuilder; blockListValueBuilder; constructor(parentBuilder) { this.parentBuilder = parentBuilder; } withCulture(culture) { this.culture = culture; return this; } withSegment(segment) { this.segment = segment; return this; } withAlias(alias) { this.alias = alias; return this; } withValue(value) { this.value = value; return this; } withEditorAlias(editorAlias) { this.editorAlias = editorAlias; return this; } withEntityType(entityType) { this.entityType = entityType; return this; } addBlockGridValue() { const builder = new blockGridValueBuilder_1.BlockGridValueBuilder(this); this.blockGridValueBuilder = builder; return builder; } addBlockListValue() { const builder = new blockListValueBuilder_1.BlockListValueBuilder(this); this.blockListValueBuilder = builder; return builder; } done() { return this.parentBuilder; } build() { let value = null; if (this.value != null) { value = this.value; } else { if (this.blockGridValueBuilder !== undefined) { value = this.blockGridValueBuilder.getValue(); } if (this.blockListValueBuilder !== undefined) { value = this.blockListValueBuilder.getValue(); } } return { culture: this.culture || null, segment: this.segment || null, alias: this.alias || null, value: value || null, editorAlias: this.editorAlias || null, entityType: this.editorAlias !== undefined ? 'document-blueprint-property-value' : null }; } } exports.DocumentBlueprintsValueBuilder = DocumentBlueprintsValueBuilder; //# sourceMappingURL=documentBlueprintsValueBuilder.js.map