From 65971ea46b30426cae754e046a31cecac613d3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20G=C3=BCell=20Segarra?= Date: Tue, 12 Mar 2024 17:45:14 +0100 Subject: [PATCH] fix: every widget should be readonly if the parent container is readonly https://github.com/gisce/webclient/issues/913 --- src/Form.ts | 3 +- src/spec/Form.spec.ts | 2334 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 2335 insertions(+), 2 deletions(-) diff --git a/src/Form.ts b/src/Form.ts index 16c3a15..58ba5ed 100644 --- a/src/Form.ts +++ b/src/Form.ts @@ -10,7 +10,6 @@ import { parseOnChange } from "./helpers/onChangeParser"; import * as txml from "txml"; import Field from "./Field"; import Button from "./Button"; -import Page from "./Page"; export type FormParseOptions = { readOnly?: boolean; @@ -234,7 +233,7 @@ class Form { key: `${this._keyIdx}`, }; - if (container instanceof Page && container.readOnly) { + if (container.readOnly) { widgetProps.readonly = true; } diff --git a/src/spec/Form.spec.ts b/src/spec/Form.spec.ts index b91d3ea..90357fd 100644 --- a/src/spec/Form.spec.ts +++ b/src/spec/Form.spec.ts @@ -3411,4 +3411,2338 @@ describe("A Form", () => { expect(page).toBeInstanceOf(Page); expect(page.readOnly).toBeFalsy(); }); + it("Should be able to parse a notebook tab with readonly attrs inside few containers ", () => { + const arch = `
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +