bugfix
This commit is contained in:
parent
88a34ba271
commit
e903fe9b4a
@ -244,7 +244,6 @@ body {
|
|||||||
.accordion-item {
|
.accordion-item {
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
width: auto;
|
|
||||||
}
|
}
|
||||||
.accordion-item-header {
|
.accordion-item-header {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
@ -7,11 +7,15 @@ bricks.DataRow = class extends bricks.HBox {
|
|||||||
]
|
]
|
||||||
fields:[]
|
fields:[]
|
||||||
css
|
css
|
||||||
|
browser_excloud_fields:[]
|
||||||
|
edit_excloud_fields:[],
|
||||||
|
|
||||||
header_css
|
header_css
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
|
// this.set_style('flexShrink', '0');
|
||||||
}
|
}
|
||||||
render_header(editable, checkable){
|
render_header(editable, checkable){
|
||||||
this.render(editable, checkable, true);
|
this.render(editable, checkable, true);
|
||||||
@ -78,6 +82,7 @@ bricks.DataRow = class extends bricks.HBox {
|
|||||||
toolbar.tools = tools;
|
toolbar.tools = tools;
|
||||||
var w = new bricks.IconBar(toolbar);
|
var w = new bricks.IconBar(toolbar);
|
||||||
this.add_widget(w);
|
this.add_widget(w);
|
||||||
|
this.toolbar_w = w;
|
||||||
this.event_names = []
|
this.event_names = []
|
||||||
for(var i=0;i<tools.length;i++){
|
for(var i=0;i<tools.length;i++){
|
||||||
if (tools[i].name != 'blankicon'){
|
if (tools[i].name != 'blankicon'){
|
||||||
@ -85,11 +90,9 @@ bricks.DataRow = class extends bricks.HBox {
|
|||||||
w.bind(tools[i].name, this.my_dispatch(tools[i].name));
|
w.bind(tools[i].name, this.my_dispatch(tools[i].name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log('this.event_names=', this.event_names);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my_dispatch(e){
|
my_dispatch(e){
|
||||||
console.log('DataRow(): dispatch event', e);
|
|
||||||
this.dispatch(e);
|
this.dispatch(e);
|
||||||
}
|
}
|
||||||
build_fields(header){
|
build_fields(header){
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
var bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
bricks.AccordionItem = class extends bricks.FVBox {
|
bricks.AccordionItem = class extends bricks.VBox {
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
this.set_css('accordion-item');
|
this.set_css('accordion-item');
|
||||||
|
@ -82,12 +82,16 @@ bricks.BaseModal = class extends bricks.Layout {
|
|||||||
this.dispatch('opened');
|
this.dispatch('opened');
|
||||||
}
|
}
|
||||||
dismiss(){
|
dismiss(){
|
||||||
this.dom_element.style.display = "none";
|
this.set_css('display', 'none');
|
||||||
this.target_w.remove_widget(this);
|
|
||||||
if (this.timeout_task){
|
if (this.timeout_task){
|
||||||
this.timeout_task.cancel();
|
this.timeout_task.cancel();
|
||||||
this.timeout_task = null;
|
this.timeout_task = null;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
this.target_w.remove_widget(this);
|
||||||
|
} catch(e){
|
||||||
|
console.log(e, 'remove modal error');
|
||||||
|
}
|
||||||
this.dispatch('dismissed');
|
this.dispatch('dismissed');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ var bricks = window.bricks || {};
|
|||||||
bricks.Tabular = class extends bricks.DynamicAccordion {
|
bricks.Tabular = class extends bricks.DynamicAccordion {
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
this.fields = this.record_view.fields;
|
this.fields = this.record_view.options.fields;
|
||||||
}
|
}
|
||||||
async build_info(item, record){
|
async build_info(item, record){
|
||||||
if (this.record_view.widgettype != 'DataRow'){
|
if (this.record_view.widgettype != 'DataRow'){
|
||||||
@ -12,31 +12,48 @@ bricks.Tabular = class extends bricks.DynamicAccordion {
|
|||||||
if (record){
|
if (record){
|
||||||
/* data row
|
/* data row
|
||||||
*/
|
*/
|
||||||
console.log('debug -------', this.record_view, record);
|
var options = bricks.extend({}, this.record_view.options);
|
||||||
|
var fields = [];
|
||||||
|
options.fields.forEach(f => {
|
||||||
|
var newf = bricks.extend({}, f);
|
||||||
|
newf.value = record[f.name];
|
||||||
|
fields.push(newf);
|
||||||
|
});
|
||||||
var desc = bricks.extend({}, this.record_view);
|
var desc = bricks.extend({}, this.record_view);
|
||||||
var opts = bricks.extend({}, this.record_view.options);
|
options.fields = fields;
|
||||||
opts.user_data = record;
|
options.user_data = record;
|
||||||
desc.options = opts;
|
desc.options = options
|
||||||
var dr = await bricks.widgetBuild(desc, this,record);
|
var dr = await bricks.widgetBuild(desc, this);
|
||||||
dr.render(this.editable, this.checkable, false);
|
dr.render(this.editable, this.checkable, false);
|
||||||
dr.bind('update', this.update_record.bind(this, dr, record));
|
|
||||||
dr.bind('delete', this.delete_record.bind(this, dr, record));
|
|
||||||
dr.event_names.forEach(e => {
|
dr.event_names.forEach(e => {
|
||||||
console.log('e=', e, 'record=', record);
|
dr.toolbar_w.bind(e, this.record_event_handle.bind(this, e, record, dr, item));
|
||||||
dr.bind(e, this.record_event_handle.bind(this, e, record, dr, item));
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var dr = await bricks.widgetBuild(this.record_view, this);
|
var dr = await bricks.widgetBuild(this.record_view, this);
|
||||||
dr.render(this.editable, this.checkable, true);
|
dr.render(this.editable, this.checkable, true);
|
||||||
dr.bind('add', this.add_record.bind(this, dr, record));
|
dr.event_names.forEach(e => {
|
||||||
console.log('datarow=', dr);
|
dr.toolbar_w.bind(e, this.record_event_handle.bind(this, e, record, dr, item));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
item.add_widget(dr);
|
item.add_widget(dr);
|
||||||
return dr;
|
return dr;
|
||||||
}
|
}
|
||||||
record_event_handle(event_name, record, row, item){
|
record_event_handle(event_name, record, row, item){
|
||||||
console.log('event_name=', event_name, 'record=', record);
|
console.log('event_name=', event_name, 'record=', record);
|
||||||
|
switch(event_name){
|
||||||
|
case 'add':
|
||||||
|
this.add_record(row, record);
|
||||||
|
break;
|
||||||
|
case 'update':
|
||||||
|
this.update_record(row, record);
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
this.delete_record(row, record);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
this.dispatch(event_name, record);
|
this.dispatch(event_name, record);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user