bugfix
This commit is contained in:
parent
76a6511fbd
commit
e2ddd8c775
@ -41,6 +41,7 @@ bricks.Accordion = class extends bricks.VBox {
|
|||||||
this.content.set_css('filler');
|
this.content.set_css('filler');
|
||||||
}
|
}
|
||||||
async change_content(event){
|
async change_content(event){
|
||||||
|
var refresh = false;
|
||||||
var b = event.target.bricks_widget;
|
var b = event.target.bricks_widget;
|
||||||
var name = b.opts.name;
|
var name = b.opts.name;
|
||||||
bricks.debug('accordion: button=', b, 'name=', name);
|
bricks.debug('accordion: button=', b, 'name=', name);
|
||||||
@ -48,6 +49,7 @@ bricks.Accordion = class extends bricks.VBox {
|
|||||||
for (var i=0; i< this.opts.items.length; i++){
|
for (var i=0; i< this.opts.items.length; i++){
|
||||||
if (name == this.opts.items[i].name){
|
if (name == this.opts.items[i].name){
|
||||||
pos = i;
|
pos = i;
|
||||||
|
if (this.opts.items[i].refresh) refresh = true;
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,7 +57,7 @@ bricks.Accordion = class extends bricks.VBox {
|
|||||||
debug('Accordion():name=',name, 'not found in items',this.opts.items);
|
debug('Accordion():name=',name, 'not found in items',this.opts.items);
|
||||||
}
|
}
|
||||||
var c = objget(this.subcontents,name);
|
var c = objget(this.subcontents,name);
|
||||||
if (! c){
|
if (refresh || ! c ){
|
||||||
c = await bricks.widgetBuild(this.opts.items[pos].content);
|
c = await bricks.widgetBuild(this.opts.items[pos].content);
|
||||||
this.subcontents[name] = c;
|
this.subcontents[name] = c;
|
||||||
}
|
}
|
||||||
|
@ -708,7 +708,9 @@ bricks.UiCode =class extends bricks.UiType {
|
|||||||
}
|
}
|
||||||
build_options(data){
|
build_options(data){
|
||||||
var e = this.dom_element;
|
var e = this.dom_element;
|
||||||
e.replaceChildren();
|
while(e.firstChild){
|
||||||
|
e.removeChild(e.firstChild);
|
||||||
|
}
|
||||||
var v = this.opts.value || this.opts.defaultvalue || null;
|
var v = this.opts.value || this.opts.defaultvalue || null;
|
||||||
if (!v && ! this.opts.nullable){
|
if (!v && ! this.opts.nullable){
|
||||||
v = data[0][this.opts.valueField]
|
v = data[0][this.opts.valueField]
|
||||||
|
@ -75,12 +75,9 @@ bricks.LlmModel = class extends bricks.JsWidget {
|
|||||||
var d = data;
|
var d = data;
|
||||||
if (this.messages){
|
if (this.messages){
|
||||||
this.messages.push(umsg);
|
this.messages.push(umsg);
|
||||||
d = {
|
d = bricks.extend({}, data);
|
||||||
messages:this.messages,
|
d.messages = this.messages;
|
||||||
mapi:this.mapi,
|
d.model = this.opts.model;
|
||||||
prompt:prompt,
|
|
||||||
model:this.opts.model
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
d = bricks.extend({}, data);
|
d = bricks.extend({}, data);
|
||||||
d.model = this.opts.model;
|
d.model = this.opts.model;
|
||||||
@ -132,6 +129,7 @@ bricks.LlmModel = class extends bricks.JsWidget {
|
|||||||
if (! d.content || d.content == ''){
|
if (! d.content || d.content == ''){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
d.content = bricks.escapeSpecialChars(d.content);
|
||||||
this.set_stream_data(d);
|
this.set_stream_data(d);
|
||||||
mout.update_data(this.stream_data);
|
mout.update_data(this.stream_data);
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ bricks.BaseModal = class extends bricks.Layout {
|
|||||||
this.timeout_task = null;
|
this.timeout_task = null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.target_w.remove_widget(this);
|
this.parent.remove_widget(this);
|
||||||
} catch(e){
|
} catch(e){
|
||||||
console.log(e, 'remove modal error');
|
console.log(e, 'remove modal error');
|
||||||
}
|
}
|
||||||
|
@ -123,12 +123,28 @@ bricks.Tabular = class extends bricks.DynamicAccordion {
|
|||||||
console.log('event_name=', event_name, 'record=', record);
|
console.log('event_name=', event_name, 'record=', record);
|
||||||
this.dispatch(event_name, record);
|
this.dispatch(event_name, record);
|
||||||
}
|
}
|
||||||
|
get_hidefields(){
|
||||||
|
var fs = [];
|
||||||
|
var params = this.data_params || {};
|
||||||
|
for (var k in params){
|
||||||
|
fs.push({name:k, value:params[k], uitype:'hide'});
|
||||||
|
}
|
||||||
|
return fs;
|
||||||
|
}
|
||||||
add_record(info){
|
add_record(info){
|
||||||
|
var hidefields = [];
|
||||||
|
if (!this.data_params){
|
||||||
|
this.data_params = {}
|
||||||
|
}
|
||||||
|
var fs = this.get_hidefields();
|
||||||
|
for (var i=0;i<this.fields.length;i++){
|
||||||
|
fs.push(this.fields[i]);
|
||||||
|
}
|
||||||
var f = new bricks.ModalForm({
|
var f = new bricks.ModalForm({
|
||||||
"width":"90%",
|
"width":"90%",
|
||||||
"height":"70%",
|
"height":"70%",
|
||||||
"submit_url":this.editable.new_data_url,
|
"submit_url":this.editable.new_data_url,
|
||||||
"fields":this.fields
|
"fields":fs
|
||||||
});
|
});
|
||||||
f.open();
|
f.open();
|
||||||
f.bind('submited', this.add_record_finish.bind(this, f));
|
f.bind('submited', this.add_record_finish.bind(this, f));
|
||||||
@ -142,7 +158,7 @@ bricks.Tabular = class extends bricks.DynamicAccordion {
|
|||||||
}
|
}
|
||||||
update_record(){
|
update_record(){
|
||||||
var record = this.select_row.user_data;
|
var record = this.select_row.user_data;
|
||||||
var fields = [];
|
var fields = this.get_hidefields();
|
||||||
for (var i=0; i< this.fields.length; i++){
|
for (var i=0; i< this.fields.length; i++){
|
||||||
var f = bricks.extend({}, this.fields[i]);
|
var f = bricks.extend({}, this.fields[i]);
|
||||||
f.value = record[f.name];
|
f.value = record[f.name];
|
||||||
|
Loading…
Reference in New Issue
Block a user