Compare commits
2 Commits
7a97e94192
...
8b551128e0
| Author | SHA1 | Date | |
|---|---|---|---|
| 8b551128e0 | |||
| f5874a0d0c |
@ -23,7 +23,7 @@ bricks.FieldGroup = class {
|
||||
parent.add_widget(dc);
|
||||
dc = new bricks.DynamicColumn({mobile_cols:2});
|
||||
dc.set_id(fields[i].name+'_box');
|
||||
if (fields[i].disabled))
|
||||
if (fields[i].nonuse))
|
||||
dc.disabled(true);
|
||||
}
|
||||
} else {
|
||||
@ -47,7 +47,7 @@ bricks.FieldGroup = class {
|
||||
i18n:true});
|
||||
box.add_widget(txt);
|
||||
box.set_id(fields[i].name + '_box')
|
||||
if (fields[i].disabled))
|
||||
if (fields[i].nonuse))
|
||||
box.disabled(true);
|
||||
}
|
||||
var w = Input.factory(fields[i]);
|
||||
@ -252,13 +252,15 @@ bricks.FormBase = class extends bricks.Layout {
|
||||
w.disabled(flg);
|
||||
if (flg) return;
|
||||
this.exclusionfields.forEach(arr =>{
|
||||
if (arr.include(field_name)){
|
||||
if (arr.include(field_name)){
|
||||
arr.forEach(x => {
|
||||
if (x!=field_name){
|
||||
var w1 = bricks.getWidgetById(x + '_box', this);
|
||||
if (w1) w1.disabled(! flg);
|
||||
if (w1) {
|
||||
w1.disabled(! flg);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -276,6 +278,7 @@ bricks.FormBase = class extends bricks.Layout {
|
||||
continue;
|
||||
}
|
||||
var w = this.name_inputs[name];
|
||||
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 + '"'})
|
||||
@ -359,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%";
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user