diff --git a/src/Widget.ts b/src/Widget.ts index 3ba5c3f..1fb425d 100644 --- a/src/Widget.ts +++ b/src/Widget.ts @@ -104,6 +104,15 @@ abstract class Widget { this._parsedWidgetProps = value; } + _isFunction: boolean | undefined; + get isFunction(): boolean | undefined { + return this._isFunction; + } + + set isFunction(value: boolean | undefined) { + this._isFunction = value; + } + constructor(props?: any) { this._colspan = Widget._defaultColspan; this._invisible = false; @@ -161,6 +170,9 @@ abstract class Widget { if (props.key) { this._key = props.key; } + if (props.is_function) { + this._isFunction = props.is_function; + } } } diff --git a/src/spec/Tree.spec.ts b/src/spec/Tree.spec.ts index 9bf0183..c51e1e2 100644 --- a/src/spec/Tree.spec.ts +++ b/src/spec/Tree.spec.ts @@ -358,4 +358,23 @@ describe("A Tree", () => { expect(tree.contextForFields.lang).toBeDefined(); expect(tree.contextForFields.lang).toEqual({ active_test: false }); }); + it("Column isFunction property should be informed", () => { + const tree = new Tree({ + name: { + required: true, + select: true, + size: 128, + string: "Potència contractada (kW)", + type: "char", + is_function: true, + views: {}, + }, + }); + tree.parse( + ``, + ); + + const nameWidget = tree.findById("name") as Char; + expect(nameWidget.isFunction).toBeTruthy(); + }); });