@umbraco/json-models-builders
Version:
Builders and models for Umbraco Sites
46 lines • 1.49 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EntityDataPickerDataTypeBuilder = void 0;
const dataTypeBuilder_1 = require("./dataTypeBuilder");
class EntityDataPickerDataTypeBuilder extends dataTypeBuilder_1.DataTypeBuilder {
minValue;
maxValue;
dataSource;
constructor() {
super();
this.editorAlias = 'Umbraco.EntityDataPicker';
this.editorUiAlias = 'Umb.PropertyEditorUi.EntityDataPicker';
}
withMinValue(minValue) {
this.minValue = minValue;
return this;
}
withMaxValue(maxValue) {
this.maxValue = maxValue;
return this;
}
withDataSource(dataSource) {
this.dataSource = dataSource;
return this;
}
getValues() {
let values = [];
// Add validationLimit alias and value if present
if (this.minValue !== undefined || this.maxValue !== undefined) {
values.push({
alias: 'validationLimit',
value: {
min: this.minValue !== undefined ? this.minValue : '',
max: this.maxValue !== undefined ? this.maxValue : ''
}
});
}
values.push({
alias: 'umbEditorDataSource',
value: this.dataSource
});
return values;
}
}
exports.EntityDataPickerDataTypeBuilder = EntityDataPickerDataTypeBuilder;
//# sourceMappingURL=entityDataPickerDataTypeBuilder.js.map