UNPKG

@itrocks/framework

Version:

RAD framework for intuitive web application development, blending data and domain-driven design with modular architecture

33 lines 1.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ReflectProperty = void 0; const core_transformers_1 = require("@itrocks/core-transformers"); const reflect_1 = require("@itrocks/reflect"); const transformer_1 = require("@itrocks/transformer"); const transformer_2 = require("@itrocks/transformer"); const reflect_class_1 = require("./reflect-class"); class ReflectProperty extends reflect_1.ReflectProperty { get class() { const value = super.class; Object.defineProperty(this, 'class', { configurable: true, enumerable: false, value, writable: true }); return value ? new reflect_class_1.ReflectClass(value.object ?? value.type) : value; } async edit(format = transformer_2.HTML) { const object = this.object ?? this.class.type; const value = this.object ? this.object[this.name] : undefined; return (0, transformer_1.applyTransformer)(await value, object, this.name, format, transformer_2.EDIT); } async output(format = transformer_2.HTML, askFor) { const object = this.object ?? this.class.type; const value = this.object ? await this.object[this.name] : undefined; return (0, transformer_1.applyTransformer)(value, object, this.name, format, transformer_2.OUTPUT, askFor); } async outputMandatoryContainer(format = transformer_2.HTML) { return this.output(format, new core_transformers_1.HtmlContainer(true)); } async outputOptionalContainer(format = transformer_2.HTML) { return this.output(format, new core_transformers_1.HtmlContainer(false)); } } exports.ReflectProperty = ReflectProperty; //# sourceMappingURL=reflect-property.js.map