This commit is contained in:
yumoqing 2024-12-26 17:33:08 +08:00
parent 536adc7887
commit c53223235e
3 changed files with 57 additions and 1 deletions

View File

@ -8,7 +8,7 @@ SOURCES=" page_data_loader.js factory.js uitypesdef.js utils.js uitype.js \
floaticonbar.js miniform.js wterm.js dynamicaccordion.js \
binstreaming.js streaming_audio.js vadtext.js rtc.js docxviewer.js \
llm_dialog.js llm.js websocket.js datarow.js tabular.js \
line.js pie.js bar.js gobang.js period.js "
line.js pie.js bar.js gobang.js period.js iconbarpage.js "
echo ${SOURCES}
cat ${SOURCES} > ../dist/bricks.js
# uglifyjs --compress --mangle -- ../dist/bricks.js > ../dist/bricks.min.js

55
bricks/iconbarpage.js Normal file
View File

@ -0,0 +1,55 @@
var bricks = window.bricks || {};
bricks.IconbarPage = class extends bricks.VBox {
/*
opts={
bar_opts:
bar_at: top or bottom
}
bar_opts:{
margin:
rate:
tools:
}
tools = [
tool, ...
]
tool = {
name:
icon:
label: optional
tip,
dynsize
rate:
context:
}
*/
constructor(opts){
opts.height = '100%'
opts.bar_at = opts.bar_at || 'top';
super(opts);
var bar = new bricks.IconTextBar(this.bar_opts);
this.content = new bricks.Filler({});
if (this.bar_at == 'top'){
this.add_widget(bar);
this.add_widget(this.content);
} else {
this.add_widget(this.content);
this.add_widget(bar);
}
bar.bind('command', this.command_handle.bind(this))
schedule_once(this.show_content.bind(this, this.bar_opts.tools[0]), 0.1);
}
async command_handle(event){
var tool = event.params;
await this.show_content(tool);
}
async show_content(tool){
var w = await bricks.widgetBuild(tool.content, this);
if (w && ! w.parent) {
this.content.add_widget(w);
}
}
}
bricks.Factory.register('IconbarPage', bricks.IconbarPage);

View File

@ -1,6 +1,7 @@
var bricks = window.bricks || {};
bricks.Iframe = class extends bricks.Layout {
constructor(opts){
opts.height = opts.height || '100%';
super(opts);
this.dom_element.src = opts.url;
}