UNPKG

@securecall/client-component

Version:

SecureCall Core Web Component

56 lines (55 loc) 1.56 kB
export class RequestField { order; value; readOnly; hidden; valid; possibleValues; mapping; externalMapping; label; component; min; max; active; placeholder; hideRelatedFields; secure; optional; _name; _owner; constructor(owner, name) { this._name = name; this._owner = owner; return new Proxy(this, { set(target, prop, value, receiver) { const propStr = prop.toString(); // Check if it's a public property (doesn't start with underscore) if (!propStr.startsWith('_') && propStr in target) { // Call propagate on the owner if it exists if (target._owner && typeof target._owner.propagate === 'function') { target._owner.propagate(target._name, propStr, value); } } return Reflect.set(target, prop, value, receiver); } }); } toJSON() { return { [this._name]: this.calculatedValue() }; } calculatedValue() { const result = {}; for (const key in this) { if (this.hasOwnProperty(key) // find properties && !key.startsWith('_') // remove private ones by naming convention && this[key] !== undefined) { // ignore undefined ones result[key] = this[key]; } } return result; } } //# sourceMappingURL=request_field.js.map