From 8b551128e0dfd405ad786a8fcb85840e04a2a052 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 24 Dec 2025 15:47:57 +0800 Subject: [PATCH] bugfix --- bricks/form.js | 17 ++++++++++++----- bricks/widget.js | 3 +++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/bricks/form.js b/bricks/form.js index 3da0c8c..1bf4592 100644 --- a/bricks/form.js +++ b/bricks/form.js @@ -25,7 +25,6 @@ bricks.FieldGroup = class { dc.set_id(fields[i].name+'_box'); if (fields[i].nonuse)) dc.disabled(true); - dc.nonuse = true; } } else { var box; @@ -50,7 +49,6 @@ bricks.FieldGroup = class { box.set_id(fields[i].name + '_box') if (fields[i].nonuse)) box.disabled(true); - box.nonuse = true; } var w = Input.factory(fields[i]); if (w){ @@ -252,7 +250,6 @@ bricks.FormBase = class extends bricks.Layout { var w = bricks.getWidgetById(field_name + '_box', this); if (! w) return; w.disabled(flg); - w.nonuse = flg if (flg) return; this.exclusionfields.forEach(arr =>{ if (arr.include(field_name)){ @@ -261,7 +258,6 @@ bricks.FormBase = class extends bricks.Layout { var w1 = bricks.getWidgetById(x + '_box', this); if (w1) { w1.disabled(! flg); - w1.nouse = ! flg; } } }); @@ -282,7 +278,7 @@ bricks.FormBase = class extends bricks.Layout { continue; } var w = this.name_inputs[name]; - if (w.parent.nonuse) continue; + if (w.parent.is_disabled()) continue; var d = w.getValue(); if (w.required && ( d[name] == '' || d[name] === null)){ new bricks.Error({title:'Requirement', message:'required field must input"' + w.label + '"'}) @@ -366,8 +362,19 @@ bricks.Form = class extends bricks.FormBase { toolbar: submit_url: method: + exclussionfields:[ + [a,b,c], + [x,y] + ] fields } + field { + name: + label: + uitype: + nonuse: # 不使用 + ... + } */ constructor(opts){ opts.height = "100%"; diff --git a/bricks/widget.js b/bricks/widget.js index 9cf3dbd..af37877 100644 --- a/bricks/widget.js +++ b/bricks/widget.js @@ -94,6 +94,9 @@ bricks.JsWidget = class { observable(name, value){ return new bricks.Observable(this, name, value); } + is_disabled(){ + return this.dom_element.disabled == true; + } disabled(flag){ if(flag){ this.dom_element.disabled = true;