From 6999f6c1075f5bad87c7f24a73c38813517bf520 Mon Sep 17 00:00:00 2001 From: rebecca0201 Date: Mon, 19 Feb 2024 15:06:30 +0800 Subject: [PATCH] ZK-5647: Wrong groupbox layout on touch screen --- zk/src/main/resources/web/js/zk/zk.ts | 55 +++++++++++++++++-- zkdoc/release-note | 1 + zktest/src/main/webapp/test2/B100-ZK-5647.zul | 36 ++++++++++++ .../src/main/webapp/test2/config.properties | 1 + 4 files changed, 87 insertions(+), 6 deletions(-) create mode 100644 zktest/src/main/webapp/test2/B100-ZK-5647.zul diff --git a/zk/src/main/resources/web/js/zk/zk.ts b/zk/src/main/resources/web/js/zk/zk.ts index cead704c27..3f443f2b27 100644 --- a/zk/src/main/resources/web/js/zk/zk.ts +++ b/zk/src/main/resources/web/js/zk/zk.ts @@ -859,9 +859,31 @@ function override void, U> (dst: T, backup: Record, S> (dst: D, src: S & Pick & ThisType) { const backup = {} as Pick; - for (const nm in src) { - backup[nm] = dst[nm as keyof D]; - dst[nm] = src[nm as keyof S]; + if (typeof dst['$init'] == 'function') { + const props = {} as Pick; + for (var nm in src) { + backup[nm] = dst[nm as keyof D]; + dst[nm] = src[nm as keyof S]; + if (backup[nm] == undefined && typeof dst[nm as keyof D] != 'function') { + props[nm as never] = dst[nm as keyof D] as never; + } + } + if (Object.keys(props).length) { + const oldInit = dst['$init'] as unknown as CallableFunction; + dst['$init'] = function (...args: unknown[]) { + oldInit.bind(this)(...args); + // try to apply the properties again + for (var nm in props) { + this[nm] = props[nm] as never; + } + }; + } + } else { + for (const nm in src) { + backup[nm] = dst[nm as keyof D]; + dst[nm] = src[nm as keyof S]; + } } return backup; }; diff --git a/zkdoc/release-note b/zkdoc/release-note index 7c3b932f3c..af548ca420 100644 --- a/zkdoc/release-note +++ b/zkdoc/release-note @@ -42,6 +42,7 @@ ZK 10.0.0 ZK-4355: timebox' default cols is too small ZK-5611: Executions.schedule() might fail if it's called by multiple threads ZK-5639: stepbox wrong color update + ZK-5647: Wrong groupbox layout on touch screen * Upgrade Notes + Upgrade commons-fileupload to commons-fileupload2-javax 2.0.0-M2 and commons-io to 2.13.0 to support jakarta-friendly uploads diff --git a/zktest/src/main/webapp/test2/B100-ZK-5647.zul b/zktest/src/main/webapp/test2/B100-ZK-5647.zul new file mode 100644 index 0000000000..ecde74098f --- /dev/null +++ b/zktest/src/main/webapp/test2/B100-ZK-5647.zul @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + The grid will be created when the open the content of groupbox + \ No newline at end of file diff --git a/zktest/src/main/webapp/test2/config.properties b/zktest/src/main/webapp/test2/config.properties index 4bac517f34..5ca1fe8683 100644 --- a/zktest/src/main/webapp/test2/config.properties +++ b/zktest/src/main/webapp/test2/config.properties @@ -3121,6 +3121,7 @@ B90-ZK-4431.zul=A,E,Multislider ##zats##B100-ZK-5480.zul=A,E,cascader,selection,label ##zats##B100-ZK-4355.zul=A,E,timebox,col,default ##zats##B100-ZK-5639.zul=A,E,ForEach,If,Apply,MVVM,Shadow,Bindings,ZKDiffer +##manually##B100-ZK-5647.zul=A,E,groupbox,mold,touch ## # Features - 3.0.x version