This commit is contained in:
yumoqing 2024-03-03 13:59:17 +08:00
parent 817b170e82
commit a93a350e74
7 changed files with 17 additions and 22 deletions

View File

@ -96,7 +96,7 @@ bricks.widgetBuild = async function(desc, widget){
if (desc.id){
w.set_id(desc.id);
}
if (desc.subwidgets){
if (w.hasSubwidgets && desc.subwidgets){
for (let i=0; i<desc.subwidgets.length; i++){
let sdesc = desc.subwidgets[i];
let sw = await (bricks.widgetBuild(sdesc, w));
@ -373,7 +373,7 @@ bricks.getWidgetById = function(id, from_widget){
return el;
}
bricks.App = class {
bricks.App = class extends bricks.Layout {
constructor(opts){
/*
opts = {
@ -391,8 +391,9 @@ bricks.App = class {
}
}
*/
this.opts = opts;
super(opts);
bricks.app = this;
bricks.Body = this;
this.login_url = opts.login_url;
this.charsize = this.opts.charsize || 20;
if (this.opts.language){
@ -406,6 +407,10 @@ bricks.App = class {
this.session_id = null;
bricks.createTooltip();
}
create(){
this.dom_element = document.getElementsByTagName('body')[0];
this.set_baseURI(this.dom_element.baseURI);
}
save_session(session){
this.session_id = session;
}

View File

@ -1,6 +1,6 @@
SOURCES=" factory.js uitypesdef.js utils.js i18n.js widget.js \
bricks.js image.js \
jsoncall.js myoperator.js layout.js scroll.js menu.js modal.js \
layout.js bricks.js image.js \
jsoncall.js myoperator.js scroll.js menu.js modal.js \
markdown_viewer.js video.js audio.js toolbar.js tab.js \
input.js registerfunction.js button.js accordion.js \
tree.js multiple_state_image.js form.js message.js \

View File

@ -1,6 +1,6 @@
var bricks = window.bricks || {};
bricks.FormBody = class extends bricks.VBox {
bricks.FormBody = class extends bricks.VScrollPanel {
/*
{
title:

View File

@ -290,8 +290,8 @@ bricks.UiCheck =class extends bricks.UiType {
static uitype = 'check';
constructor(opts){
super(opts);
bricks.extend(UiCheck.prototype, Layout.prototype);
this.add_widget = Layout.prototype.add_widget.bind(this);
bricks.extend(bricks.UiCheck.prototype, bricks.Layout.prototype);
this.add_widget = bricks.Layout.prototype.add_widget.bind(this);
this.dom_element.style.width = 'auto';
this.dom_element.style.height = 'auto';
var state = 'unchecked';
@ -654,7 +654,7 @@ bricks.UiAudio =class extends bricks.UiStr {
url: bricks_resource('imgs/right_arrow.png')});
this.add_widget(this.icon);
this.icon.bind('click', this.play_audio.bind(this));
this.player = new bricks.Audio({
this.player = new bricks.AudioPlayer({
url:this.value
});
if (this.autoplay){

View File

@ -2,6 +2,7 @@ var bricks = window.bricks || {};
bricks.Layout = class extends bricks.JsWidget {
constructor(options){
super(options);
this.hasSubwidgets = true;
this._container = true;
this.children = [];
}
@ -54,18 +55,6 @@ bricks.Layout = class extends bricks.JsWidget {
}
}
bricks._Body = class extends bricks.Layout {
constructor(options){
super(options);
}
create(){
this.dom_element = document.getElementsByTagName('body')[0];
this.set_baseURI(this.dom_element.baseURI);
}
}
bricks.Body = new bricks._Body();
bricks.VBox = class extends bricks.Layout {
constructor(options){
super(options);

View File

@ -5,6 +5,7 @@ bricks.JsWidget = class {
if (!options){
options = {}
}
this.hasSubwidgets = false;
this.baseURI = options.baseURI;
this.opts = options;
this.create();

View File

@ -1,7 +1,7 @@
{
"widgettype":"VBox",
"options":{"height":"100%"},
"options":{"height":"100%", "width":"100%"},
"subwidgets":[
{
"widgettype":"HBox",