This commit is contained in:
yumoqing 2024-06-03 19:04:30 +08:00
parent 390ca55a17
commit 1e0fbce1d5
7 changed files with 29 additions and 14 deletions

View File

@ -263,6 +263,9 @@ var _buildWidget = async function(from_widget, target, mode, options){
bricks.debug('options=', options, 'widgetBuild() failed');
return;
}
if (w.parent) return;
if (mode == 'replace'){
target.clear_widgets();
target.add_widget(w);
@ -375,7 +378,7 @@ bricks.getWidgetById = function(id, from_widget){
return from_widget;
}
if (typeof(id) != 'string') return id;
var ids = id.split('/');
var ids = id.split('.');
var el = from_widget.dom_element;
var new_el = null;
var j = 0;

View File

@ -24,8 +24,8 @@ body {
}
.menuitem {
height: 40px;
backgroud-color: #eeeeee;
align-items: center;
border: 1px solid #ccc;
cursor: pointer;
}

View File

@ -38,7 +38,7 @@ bricks.DataRow = class extends bricks.HBox {
w = new bricks.BlankIcon({});
} else {
w = new bricks.UiCheck({name:this.checkField,value:this.user_data[this.checkField]});
w.bind(changed, this.get_check_state.bind(this));
w.bind('changed', this.get_check_state.bind(this));
}
this.add_widget(w);
}
@ -50,7 +50,7 @@ bricks.DataRow = class extends bricks.HBox {
this._build_fields(false, this.record_w);
}
get_check_state(e){
d = e.target.getValue()
var d = e.target.bricks_widget.getValue()
this.user_data[this.checkField] = d[this.checkField];
this.dispatch('check_changed', this);
}
@ -100,6 +100,9 @@ bricks.DataRow = class extends bricks.HBox {
if (this.browserfields && this.browserfields.cwidths){
cwidths = this.browserfields.cwidths;
}
if (this.checkField){
exclouded.push(this.checkField);
}
for (var i=0;i<this.fields.length;i++){
var f = this.fields[i]
if (exclouded.includes(f.name)){

View File

@ -51,19 +51,22 @@ bricks.Menu = class extends bricks.VBox {
for (let i=0;i<items.length;i++){
let item = items[i];
let subw = this.create_menuitem(item);
w.add_widget(subw);
if (item.hasOwnProperty('items')){
var itw = new bricks.VBox({});
w.add_widget(itw);
let w1 = this.create_submenu_container();
subw.add_widget(w1);
itw.add_widget(subw);
itw.add_widget(w1);
this.create_children(w1, item.items);
subw.bind('click', this.toggle_hide.bind(this));
subw.bind('click', w1.toggle_hide.bind(w1));
} else {
subw.bind('click', this.menu_clicked.bind(this))
w.add_widget(subw);
}
}
}
create_menuitem(item){
var w = new bricks.HBox({});
var w = new bricks.HBox({cheight:this.item_cheight||2});
var iw, tw;
if (item.icon){
iw = new bricks.Icon({url:item.icon});

View File

@ -149,6 +149,7 @@ bricks.Modal = class extends bricks.BaseModal {
bricks.debug('modal():click_handler()');
}
}
/*
open(){
if (this.opts.auto_close){
var f = this.click_handler.bind(this);
@ -162,6 +163,7 @@ bricks.Modal = class extends bricks.BaseModal {
}
bricks.BaseModal.prototype.dismiss.bind(this)();
}
*/
}
bricks.ModalForm = class extends bricks.Modal {

View File

@ -3,6 +3,13 @@ bricks.Tabular = class extends bricks.DynamicAccordion {
constructor(opts){
super(opts);
this.get_edit_fields();
this.check_changed_row = null;
this.bind('row_check_changed', this.show_check_event_data.bind(this));
}
show_check_event_data(event){
var d = event.params;
console.log('row_check_changed event data=', d);
}
build_toolbar(){
var edit_names = [];
@ -104,12 +111,8 @@ bricks.Tabular = class extends bricks.DynamicAccordion {
return dr;
}
record_check_changed(event){
var data = {
tabular:this,
'row': event.params,
'data':event.params.user_data
};
this.dispatch('row_check_changed', data);
this.check_changed_row = event.params;
this.dispatch('row_check_changed', event.params.user_data);
}
async renew_record_view(form, info){
var d = form.getValue();

View File

@ -1,6 +1,7 @@
var bricks = window.bricks || {};
bricks.bug = false;
bricks.is_empty = function(obj){
if (obj === null) return true;
return JSON.stringify(obj) === '{}';
}
bricks.debug = function(...args){