From 714bdddb96c24c2a187fd3e8ea3138651df15a88 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Fri, 19 Sep 2025 10:33:38 +0200 Subject: [PATCH] matrix: if `scroll` is `true`, children's values no longer feed the matrix' value and onValue script, it will be used for scrolling state, like with panels --- CHANGELOG.md | 2 +- src/client/widgets/containers/matrix.mjs | 24 ++++++++++++------------ src/client/widgets/containers/panel.mjs | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa93fdd3..314b6745 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ - input/textarea/select no longer have their appearance property reset in custom html - canvas: added `contextType` property - file: honor server's `remote-root` option (remove root path from displayed path and returned value) - + - matrix: if `scroll` is `true`, children's values no longer feed the matrix' value and onValue script, it will be used for scrolling state, like with panels - scripting - user scripts are longer protected against infinite loop and the main window object may be reached (it's not supported to break out of scripting context, but resources are no longer wasted to prevent it) diff --git a/src/client/widgets/containers/matrix.mjs b/src/client/widgets/containers/matrix.mjs index aec93888..843a10ff 100644 --- a/src/client/widgets/containers/matrix.mjs +++ b/src/client/widgets/containers/matrix.mjs @@ -45,24 +45,24 @@ class Matrix extends Panel { this.resolveLock = false - this.on('value-changed',(e)=>{ + if (!this.getProp('scroll')) { + this.on('value-changed',(e)=>{ - if (e.widget === this) return + if (e.widget === this) return - var widget = this.getProp('widgetType') === 'clone' ? e.widget.parent : e.widget + var widget = this.getProp('widgetType') === 'clone' ? e.widget.parent : e.widget - if (widget.parent !== this) return + if (widget.parent !== this) return - this.value[widget._index] = e.widget.getValue() + this.value[widget._index] = e.widget.getValue() + + this.changed({ + ...e.options, + id: widget.getProp('id') + }) - this.changed({ - ...e.options, - id: widget.getProp('id') }) - - }) - - + } if (parser.widgets[this.getProp('widgetType')]) { diff --git a/src/client/widgets/containers/panel.mjs b/src/client/widgets/containers/panel.mjs index fafed414..1d3659e2 100644 --- a/src/client/widgets/containers/panel.mjs +++ b/src/client/widgets/containers/panel.mjs @@ -274,7 +274,7 @@ class Panel extends Container() { if (options.send) this.sendValue() if (options.sync) this.changed(options) - } else if (this.childrenType === 'widget' && Array.isArray(v) && v.length === 2 && this.props.type !== 'modal') { + } else if (this.getProp('scroll') && this.childrenType !== 'tab' && Array.isArray(v) && v.length === 2 && this.props.type !== 'modal') { this.value = v clearTimeout(this.scrollTimeout)