bugfix
This commit is contained in:
parent
a028ba94dc
commit
19354afc4e
@ -32,12 +32,12 @@ bricks.Accordion = class oops extends bricks.VBox {
|
|||||||
height:'auto',
|
height:'auto',
|
||||||
orientation:'horizontal'
|
orientation:'horizontal'
|
||||||
}
|
}
|
||||||
var b = new Button(opts);
|
var b = new bricks.Button(opts);
|
||||||
b.bind('click', this.change_content.bind(this));
|
b.bind('click', this.change_content.bind(this));
|
||||||
this.items.push(b);
|
this.items.push(b);
|
||||||
this.add_widget(b);
|
this.add_widget(b);
|
||||||
}
|
}
|
||||||
this.content = new VBox({});
|
this.content = new bricks.VBox({});
|
||||||
}
|
}
|
||||||
async change_content(evnet){
|
async change_content(evnet){
|
||||||
var b = event.target.bricks_widget;
|
var b = event.target.bricks_widget;
|
||||||
|
@ -59,7 +59,7 @@ bricks.AudioRecorder = class oops extends bricks.HBox {
|
|||||||
this.start_icon = opts.start_icon || bricks_resource('imgs/start_recording.png');
|
this.start_icon = opts.start_icon || bricks_resource('imgs/start_recording.png');
|
||||||
this.stop_icon = opts.stop_icon || bricks_resource('imgs/stop_recording.png');
|
this.stop_icon = opts.stop_icon || bricks_resource('imgs/stop_recording.png');
|
||||||
this.rec_btn = new bricks.Icon({url:this.start_icon });
|
this.rec_btn = new bricks.Icon({url:this.start_icon });
|
||||||
this.player = new bricks.AudioPlayer({url:"",width:'40px'});
|
this.player = new bricks.AudioPlayer({url:"",width:'80px'});
|
||||||
this.rec_time = new bricks.Text({text:"", i18n:false, width:'120px'});
|
this.rec_time = new bricks.Text({text:"", i18n:false, width:'120px'});
|
||||||
this.rec_btn.bind('click', this.rec_btn_pressed.bind(this))
|
this.rec_btn.bind('click', this.rec_btn_pressed.bind(this))
|
||||||
this.URL = window.URL||webkitURL;
|
this.URL = window.URL||webkitURL;
|
||||||
@ -88,8 +88,8 @@ bricks.AudioRecorder = class oops extends bricks.HBox {
|
|||||||
// document.querySelector(".recpowerx").style.width=powerLevel+"%";
|
// document.querySelector(".recpowerx").style.width=powerLevel+"%";
|
||||||
//可视化图形绘制
|
//可视化图形绘制
|
||||||
// wave.input(buffers[buffers.length-1],powerLevel,bufferSampleRate);
|
// wave.input(buffers[buffers.length-1],powerLevel,bufferSampleRate);
|
||||||
this.rec_time.otext = formatMs(bufferDuration,1);
|
this.rec_time.text = formatMs(bufferDuration,1);
|
||||||
console.log(this.rec_time.otext);
|
console.log(this.rec_time.text);
|
||||||
|
|
||||||
}
|
}
|
||||||
recOpen(){
|
recOpen(){
|
||||||
|
@ -80,6 +80,7 @@ bricks.widgetBuild = async function(desc, widget){
|
|||||||
base_url = url;
|
base_url = url;
|
||||||
let method = desc.options.method || 'GET';
|
let method = desc.options.method || 'GET';
|
||||||
let opts = desc.options.params || {};
|
let opts = desc.options.params || {};
|
||||||
|
var jcall = bricks.jcall;
|
||||||
desc = await jcall(url, { "method":method, "params":opts});
|
desc = await jcall(url, { "method":method, "params":opts});
|
||||||
} else {
|
} else {
|
||||||
base_url = widget.baseURI;
|
base_url = widget.baseURI;
|
||||||
@ -375,7 +376,7 @@ bricks.App = class {
|
|||||||
this.lang = navigator.language;
|
this.lang = navigator.language;
|
||||||
}
|
}
|
||||||
this.textList = [];
|
this.textList = [];
|
||||||
this.i18n = new I18n(objget(opts, 'i18n', {}));
|
this.i18n = new bricks.I18n(objget(opts, 'i18n', {}));
|
||||||
this.session_id = null;
|
this.session_id = null;
|
||||||
bricks.createTooltip();
|
bricks.createTooltip();
|
||||||
}
|
}
|
||||||
@ -412,6 +413,7 @@ bricks.App = class {
|
|||||||
}
|
}
|
||||||
async setup_i18n(){
|
async setup_i18n(){
|
||||||
let params = {'lang':this.lang};
|
let params = {'lang':this.lang};
|
||||||
|
var jcall = bricks.jcall;
|
||||||
d = await jcall(desc.url, {
|
d = await jcall(desc.url, {
|
||||||
"method":desc.method||'GET', params:params});
|
"method":desc.method||'GET', params:params});
|
||||||
this.i18n.setup_dict(d);
|
this.i18n.setup_dict(d);
|
||||||
|
@ -58,7 +58,7 @@ bricks.Button = class extends bricks.Layout {
|
|||||||
opts_setup(){
|
opts_setup(){
|
||||||
var item_size = this.opts.item_size || bricks.app.charsize;
|
var item_size = this.opts.item_size || bricks.app.charsize;
|
||||||
if (this.opts.icon){
|
if (this.opts.icon){
|
||||||
var icon = new Icon({
|
var icon = new bricks.Icon({
|
||||||
rate:this.item_rate,
|
rate:this.item_rate,
|
||||||
url:this.opts.icon
|
url:this.opts.icon
|
||||||
})
|
})
|
||||||
@ -72,7 +72,7 @@ bricks.Button = class extends bricks.Layout {
|
|||||||
bgcolor:this.opts.bgcolor,
|
bgcolor:this.opts.bgcolor,
|
||||||
otext:this.opts.label,
|
otext:this.opts.label,
|
||||||
i18n:true};
|
i18n:true};
|
||||||
var txt = new Text(opts);
|
var txt = new bricks.Text(opts);
|
||||||
this.add_widget(txt);
|
this.add_widget(txt);
|
||||||
txt.bind('click', this.target_clicked.bind(this));
|
txt.bind('click', this.target_clicked.bind(this));
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
bricks.Row = class {
|
bricks.Row = class {
|
||||||
constructor(dg, rec) {
|
constructor(dg, rec) {
|
||||||
this.dg = dg;
|
this.dg = dg;
|
||||||
@ -37,10 +37,10 @@ bricks.Row = class {
|
|||||||
opts.action = f.action;
|
opts.action = f.action;
|
||||||
opts.action.params = objcopy(this.data);
|
opts.action.params = objcopy(this.data);
|
||||||
opts.action.params.row = this;
|
opts.action.params.row = this;
|
||||||
w = new Button(opts);
|
w = new bricks.Button(opts);
|
||||||
w.bind('click', this.button_click.bind(w))
|
w.bind('click', this.button_click.bind(w))
|
||||||
} else {
|
} else {
|
||||||
w = viewFactory(opts, this.data);
|
w = bricks.viewFactory(opts, this.data);
|
||||||
w.bind('click', this.click_handler);
|
w.bind('click', this.click_handler);
|
||||||
}
|
}
|
||||||
w.desc_dic = opts;
|
w.desc_dic = opts;
|
||||||
@ -51,7 +51,7 @@ bricks.Row = class {
|
|||||||
this.name_widgets[f.name] = w;
|
this.name_widgets[f.name] = w;
|
||||||
}
|
}
|
||||||
if (cols.length > 0) {
|
if (cols.length > 0) {
|
||||||
var row = new HBox({ height: 'auto' })
|
var row = new bricks.HBox({ height: 'auto' })
|
||||||
for (var i = 0; i < cols.length; i++) {
|
for (var i = 0; i < cols.length; i++) {
|
||||||
row.add_widget(cols[i]);
|
row.add_widget(cols[i]);
|
||||||
}
|
}
|
||||||
@ -138,39 +138,39 @@ bricks.DataGrid = class extends bricks.VBox {
|
|||||||
this.header_css = opts.header_css || 'grid_header';
|
this.header_css = opts.header_css || 'grid_header';
|
||||||
this.body_css = opts.body_css || 'grid_body';
|
this.body_css = opts.body_css || 'grid_body';
|
||||||
if (this.title) {
|
if (this.title) {
|
||||||
this.title_bar = new HBox({ height: 'auto' });
|
this.title_bar = new bricks.HBox({ height: 'auto' });
|
||||||
this.add_widget(this.title_bar);
|
this.add_widget(this.title_bar);
|
||||||
var tw = new Title1({ otext: this.title, i18n: true });
|
var tw = new bricks.Title1({ otext: this.title, i18n: true });
|
||||||
this.title_bar.add_widget(tw);
|
this.title_bar.add_widget(tw);
|
||||||
}
|
}
|
||||||
if (this.description) {
|
if (this.description) {
|
||||||
this.descbar = new HBox({ height: 'auto' });
|
this.descbar = new bricks.HBox({ height: 'auto' });
|
||||||
this.add_widget(this.descbar);
|
this.add_widget(this.descbar);
|
||||||
var dw = new Text({ otext: this.description, i18n: true });
|
var dw = new bricks.Text({ otext: this.description, i18n: true });
|
||||||
this.descbar.add_widget(dw);
|
this.descbar.add_widget(dw);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.opts.miniform || this.opts.toolbar){
|
if (this.opts.miniform || this.opts.toolbar){
|
||||||
this.admin_bar = new HBox({height:'auto'});
|
this.admin_bar = new bricks.HBox({height:'auto'});
|
||||||
}
|
}
|
||||||
if (this.opts.miniform){
|
if (this.opts.miniform){
|
||||||
this.miniform = new MiniForm(this.opts.miniform);
|
this.miniform = new bricks.MiniForm(this.opts.miniform);
|
||||||
this.miniform.bind('input', this.miniform_input.bind(this));
|
this.miniform.bind('input', this.miniform_input.bind(this));
|
||||||
this.admin_bar.add_widget(this.miniform);
|
this.admin_bar.add_widget(this.miniform);
|
||||||
}
|
}
|
||||||
if (this.opts.toolbar) {
|
if (this.opts.toolbar) {
|
||||||
this.admin_bar.add_widget(new HFiller({}));
|
this.admin_bar.add_widget(new bricks.HFiller({}));
|
||||||
self.toolbar = new Toolbar(this.opts.toolbar);
|
self.toolbar = new bricks.Toolbar(this.opts.toolbar);
|
||||||
self.toolbar.bind('command', this.command_handle.bind(this));
|
self.toolbar.bind('command', this.command_handle.bind(this));
|
||||||
this.admin_bar.add_widget(this.toolbar);
|
this.admin_bar.add_widget(this.toolbar);
|
||||||
}
|
}
|
||||||
this.create_parts();
|
this.create_parts();
|
||||||
if (this.show_info) {
|
if (this.show_info) {
|
||||||
this.infow = new HBox({ height: '40px' });
|
this.infow = new bricks.HBox({ height: '40px' });
|
||||||
this.add_widget(this.infow);
|
this.add_widget(this.infow);
|
||||||
}
|
}
|
||||||
if (this.dataurl) {
|
if (this.dataurl) {
|
||||||
this.loader = new BufferedDataLoader(this, {
|
this.loader = new bricks.BufferedDataLoader(this, {
|
||||||
pagerows: 80,
|
pagerows: 80,
|
||||||
buffer_pages: 5,
|
buffer_pages: 5,
|
||||||
url: absurl(this.dataurl, this),
|
url: absurl(this.dataurl, this),
|
||||||
@ -258,7 +258,7 @@ bricks.DataGrid = class extends bricks.VBox {
|
|||||||
create_parts() {
|
create_parts() {
|
||||||
this.freeze_width = 0;
|
this.freeze_width = 0;
|
||||||
this.normal_width = 0;
|
this.normal_width = 0;
|
||||||
var hbox = new HBox({});
|
var hbox = new bricks.HBox({});
|
||||||
hbox.set_css('datagrid-grid');
|
hbox.set_css('datagrid-grid');
|
||||||
this.add_widget(hbox);
|
this.add_widget(hbox);
|
||||||
this.freeze_fields = [];
|
this.freeze_fields = [];
|
||||||
@ -285,25 +285,25 @@ bricks.DataGrid = class extends bricks.VBox {
|
|||||||
this.normal_part = null;
|
this.normal_part = null;
|
||||||
console.log('width=', this.freeze_width, '-', this.normal_width, '...');
|
console.log('width=', this.freeze_width, '-', this.normal_width, '...');
|
||||||
if (this.freeze_fields.length > 0) {
|
if (this.freeze_fields.length > 0) {
|
||||||
this.freeze_part = new VBox({});
|
this.freeze_part = new bricks.VBox({});
|
||||||
this.freeze_part.set_css('datagrid-left');
|
this.freeze_part.set_css('datagrid-left');
|
||||||
this.freeze_part.set_style('width', this.freeze_width + 'px');
|
this.freeze_part.set_style('width', this.freeze_width + 'px');
|
||||||
this.freeze_header = new HBox({ height: this.row_height + 'px', width: this.freeze_width + 'px'});
|
this.freeze_header = new bricks.HBox({ height: this.row_height + 'px', width: this.freeze_width + 'px'});
|
||||||
this.freeze_body = new VScrollPanel({ height: "100%",
|
this.freeze_body = new bricks.VScrollPanel({ height: "100%",
|
||||||
width: this.freeze_width + 'px' })
|
width: this.freeze_width + 'px' })
|
||||||
this.freeze_body.set_css('datagrid-body');
|
this.freeze_body.set_css('datagrid-body');
|
||||||
this.freeze_body.bind('scroll', this.coscroll.bind(this));
|
this.freeze_body.bind('scroll', this.coscroll.bind(this));
|
||||||
}
|
}
|
||||||
if (this.normal_fields.length > 0) {
|
if (this.normal_fields.length > 0) {
|
||||||
this.normal_part = new VBox({
|
this.normal_part = new bricks.VBox({
|
||||||
width: this.normal_width + 'px',
|
width: this.normal_width + 'px',
|
||||||
height:'100%',
|
height:'100%',
|
||||||
csses:"hscroll"
|
csses:"hscroll"
|
||||||
});
|
});
|
||||||
this.normal_part.set_css('datagrid-right');
|
this.normal_part.set_css('datagrid-right');
|
||||||
this.normal_header = new HBox({ height: this.row_height + 'px', width: this.normal_width + 'px'});
|
this.normal_header = new bricks.HBox({ height: this.row_height + 'px', width: this.normal_width + 'px'});
|
||||||
// this.normal_header.set_css('datagrid-row');
|
// this.normal_header.set_css('datagrid-row');
|
||||||
this.normal_body = new VScrollPanel({
|
this.normal_body = new bricks.VScrollPanel({
|
||||||
height:"100%",
|
height:"100%",
|
||||||
width: this.normal_width + 'px'
|
width: this.normal_width + 'px'
|
||||||
});
|
});
|
||||||
@ -344,7 +344,7 @@ bricks.DataGrid = class extends bricks.VBox {
|
|||||||
create_header() {
|
create_header() {
|
||||||
for (var i = 0; i < this.freeze_fields.length; i++) {
|
for (var i = 0; i < this.freeze_fields.length; i++) {
|
||||||
var f = this.freeze_fields[i];
|
var f = this.freeze_fields[i];
|
||||||
var t = new Text({
|
var t = new bricks.Text({
|
||||||
otext: f.label || f.name,
|
otext: f.label || f.name,
|
||||||
i18n: true,
|
i18n: true,
|
||||||
});
|
});
|
||||||
@ -358,7 +358,7 @@ bricks.DataGrid = class extends bricks.VBox {
|
|||||||
}
|
}
|
||||||
for (var i = 0; i < this.normal_fields.length; i++) {
|
for (var i = 0; i < this.normal_fields.length; i++) {
|
||||||
var f = this.normal_fields[i];
|
var f = this.normal_fields[i];
|
||||||
var t = new Text({
|
var t = new bricks.Text({
|
||||||
otext: f.label || f.name,
|
otext: f.label || f.name,
|
||||||
i18n: true,
|
i18n: true,
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
|
|
||||||
bricks.DataViewer = class extends bricks.VScrollPanel {
|
bricks.DataViewer = class extends bricks.VScrollPanel {
|
||||||
/*
|
/*
|
||||||
@ -14,7 +14,7 @@ bricks.DataViewer = class extends bricks.VScrollPanel {
|
|||||||
constructor(opts){
|
constructor(opts){
|
||||||
opts.width = '100%';
|
opts.width = '100%';
|
||||||
super(opts);
|
super(opts);
|
||||||
this.loader = new BufferedDataLoader(this, {
|
this.loader = new bricks.BufferedDataLoader(this, {
|
||||||
pagerows: opts.pagerows || 80,
|
pagerows: opts.pagerows || 80,
|
||||||
buffer_pages: opts.buffer_pages || 5,
|
buffer_pages: opts.buffer_pages || 5,
|
||||||
url: opts.dataurl,
|
url: opts.dataurl,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
class Factory_ {
|
class Factory_ {
|
||||||
constructor(){
|
constructor(){
|
||||||
this.widgets_kv = new Object();
|
this.widgets_kv = new Object();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
|
|
||||||
bricks.FormBody = class extends bricks.VBox {
|
bricks.FormBody = class extends bricks.VBox {
|
||||||
/*
|
/*
|
||||||
@ -23,20 +23,20 @@ bricks.FormBody = class extends bricks.VBox {
|
|||||||
super(opts);
|
super(opts);
|
||||||
this.name_inputs = {};
|
this.name_inputs = {};
|
||||||
if (this.opts.title){
|
if (this.opts.title){
|
||||||
var t = new Title2({
|
var t = new bricks.Title2({
|
||||||
otext:this.opts.title,
|
otext:this.opts.title,
|
||||||
height:'auto',
|
height:'auto',
|
||||||
i18n:true});
|
i18n:true});
|
||||||
this.add_widget(t);
|
this.add_widget(t);
|
||||||
}
|
}
|
||||||
if (this.opts.description){
|
if (this.opts.description){
|
||||||
var d = new Text({
|
var d = new bricks.Text({
|
||||||
otext:this.opts.description,
|
otext:this.opts.description,
|
||||||
height:'auto',
|
height:'auto',
|
||||||
i18n:true});
|
i18n:true});
|
||||||
this.add_widget(d);
|
this.add_widget(d);
|
||||||
}
|
}
|
||||||
this.form_body = new Layout({width:'100%',
|
this.form_body = new bricks.Layout({width:'100%',
|
||||||
overflow:'auto'
|
overflow:'auto'
|
||||||
});
|
});
|
||||||
this.add_widget(this.form_body);
|
this.add_widget(this.form_body);
|
||||||
@ -73,6 +73,7 @@ bricks.FormBody = class extends bricks.VBox {
|
|||||||
async validation(){
|
async validation(){
|
||||||
var data = this.getValue();
|
var data = this.getValue();
|
||||||
if (this.submit_url){
|
if (this.submit_url){
|
||||||
|
var jcall = bricks.jcall;
|
||||||
var rzt = await jcall(this.submit_url,
|
var rzt = await jcall(this.submit_url,
|
||||||
{
|
{
|
||||||
params:data
|
params:data
|
||||||
@ -84,10 +85,10 @@ bricks.FormBody = class extends bricks.VBox {
|
|||||||
build_fields(){
|
build_fields(){
|
||||||
var fields = this.opts.fields;
|
var fields = this.opts.fields;
|
||||||
for (var i=0; i<fields.length; i++){
|
for (var i=0; i<fields.length; i++){
|
||||||
var box = new VBox({height:'auto',overflow:'none'});
|
var box = new bricks.VBox({height:'auto',overflow:'none'});
|
||||||
box.set_css('inputbox');
|
box.set_css('inputbox');
|
||||||
this.form_body.add_widget(box);
|
this.form_body.add_widget(box);
|
||||||
var txt = new Text({
|
var txt = new bricks.Text({
|
||||||
otext:fields[i].label||fields[i].name,
|
otext:fields[i].label||fields[i].name,
|
||||||
height:'auto',
|
height:'auto',
|
||||||
i18n:true});
|
i18n:true});
|
||||||
@ -118,13 +119,13 @@ bricks.Form = class extends bricks.VBox {
|
|||||||
*/
|
*/
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
this.body = new FormBody(opts);
|
this.body = new bricks.FormBody(opts);
|
||||||
this.add_widget(this.body);
|
this.add_widget(this.body);
|
||||||
if (! opts.notoolbar)
|
if (! opts.notoolbar)
|
||||||
this.build_toolbar(this);
|
this.build_toolbar(this);
|
||||||
}
|
}
|
||||||
build_toolbar(widget){
|
build_toolbar(widget){
|
||||||
var box = new HBox({height:'auto', width:'100%'});
|
var box = new bricks.HBox({height:'auto', width:'100%'});
|
||||||
widget.add_widget(box);
|
widget.add_widget(box);
|
||||||
var tb_desc = this.opts.toolbar || {
|
var tb_desc = this.opts.toolbar || {
|
||||||
width:"auto",
|
width:"auto",
|
||||||
@ -141,11 +142,11 @@ bricks.Form = class extends bricks.VBox {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
var tbw = new Toolbar(tb_desc);
|
var tbw = new bricks.Toolbar(tb_desc);
|
||||||
tbw.bind('command', this.command_handle.bind(this));
|
tbw.bind('command', this.command_handle.bind(this));
|
||||||
box.add_widget(new HFiller());
|
box.add_widget(new bricks.HFiller());
|
||||||
box.add_widget(tbw);
|
box.add_widget(tbw);
|
||||||
box.add_widget(new HFiller());
|
box.add_widget(new bricks.HFiller());
|
||||||
}
|
}
|
||||||
command_handle(event){
|
command_handle(event){
|
||||||
var params = event.params;
|
var params = event.params;
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
class I18n {
|
var bricks = window.bricks || {};
|
||||||
|
|
||||||
|
bricks.I18n = class {
|
||||||
constructor(url, default_lang){
|
constructor(url, default_lang){
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
@ -40,6 +42,7 @@ class I18n {
|
|||||||
if (! this.url) return;
|
if (! this.url) return;
|
||||||
|
|
||||||
let params = {'lang':lang};
|
let params = {'lang':lang};
|
||||||
|
var jcall = bricks.jcall;
|
||||||
d = await jcall(desc.url, {
|
d = await jcall(desc.url, {
|
||||||
"method":this.method || 'GET',
|
"method":this.method || 'GET',
|
||||||
params:params
|
params:params
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
bricks.UiType =class extends bricks.Layout {
|
bricks.UiType =class extends bricks.Layout {
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
@ -285,7 +285,7 @@ bricks.UiCheck =class extends bricks.UiType {
|
|||||||
if (opts.value){
|
if (opts.value){
|
||||||
state = 'checked';
|
state = 'checked';
|
||||||
}
|
}
|
||||||
this.ms_icon = new MultipleStateIcon({
|
this.ms_icon = new bricks.MultipleStateIcon({
|
||||||
state:state,
|
state:state,
|
||||||
urls:{
|
urls:{
|
||||||
checked:bricks_resource('imgs/checkbox-checked.png'),
|
checked:bricks_resource('imgs/checkbox-checked.png'),
|
||||||
@ -369,15 +369,15 @@ bricks.UiCheckBox =class extends bricks.UiType {
|
|||||||
var data = this.data;
|
var data = this.data;
|
||||||
this.input_boxs = [];
|
this.input_boxs = [];
|
||||||
for (var i=0; i<data.length;i++){
|
for (var i=0; i<data.length;i++){
|
||||||
var hbox = new HBox({height:"auto",width:"100%"});
|
var hbox = new bricks.HBox({height:"auto",width:"100%"});
|
||||||
var opts = {}
|
var opts = {}
|
||||||
var value = data[i][this.valueField];
|
var value = data[i][this.valueField];
|
||||||
if (this.value == value){
|
if (this.value == value){
|
||||||
opts.value = true;
|
opts.value = true;
|
||||||
}
|
}
|
||||||
var check = new UiCheck(opts);
|
var check = new bricks.UiCheck(opts);
|
||||||
var otext = data[i][this.textField];
|
var otext = data[i][this.textField];
|
||||||
var txt = new Text({
|
var txt = new bricks.Text({
|
||||||
otext:otext,
|
otext:otext,
|
||||||
align:'left',
|
align:'left',
|
||||||
i18n:true});
|
i18n:true});
|
||||||
@ -390,6 +390,7 @@ bricks.UiCheckBox =class extends bricks.UiType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
async load_data_onfly(){
|
async load_data_onfly(){
|
||||||
|
var jcall = bricks.jcall;
|
||||||
var data = await jcall(this.opts.dataurl, {
|
var data = await jcall(this.opts.dataurl, {
|
||||||
"method":this.opts.method||'GET',
|
"method":this.opts.method||'GET',
|
||||||
"params":this.opts.params});
|
"params":this.opts.params});
|
||||||
@ -541,6 +542,7 @@ bricks.UiCode =class extends bricks.UiType {
|
|||||||
if(event){
|
if(event){
|
||||||
extend(params, event.params);
|
extend(params, event.params);
|
||||||
}
|
}
|
||||||
|
var jcall = bricks.jcall;
|
||||||
var d = await jcall(this.opts.dataurl,
|
var d = await jcall(this.opts.dataurl,
|
||||||
{
|
{
|
||||||
method:this.opts.method || 'GET',
|
method:this.opts.method || 'GET',
|
||||||
@ -627,11 +629,11 @@ bricks.UiAudio =class extends bricks.UiStr {
|
|||||||
super(opts);
|
super(opts);
|
||||||
this.autoplay = opts.autoplay;
|
this.autoplay = opts.autoplay;
|
||||||
this.readonly = opts.readonly;
|
this.readonly = opts.readonly;
|
||||||
this.icon = new Icon({
|
this.icon = new bricks.Icon({
|
||||||
url: bricks_resource('imgs/right_arrow.png')});
|
url: bricks_resource('imgs/right_arrow.png')});
|
||||||
this.add_widget(this.icon);
|
this.add_widget(this.icon);
|
||||||
this.icon.bind('click', this.play_audio.bind(this));
|
this.icon.bind('click', this.play_audio.bind(this));
|
||||||
this.player = new Audio({
|
this.player = new bricks.Audio({
|
||||||
url:this.value
|
url:this.value
|
||||||
});
|
});
|
||||||
if (this.autoplay){
|
if (this.autoplay){
|
||||||
@ -662,11 +664,11 @@ bricks.UiVideo =class extends bricks.UiStr {
|
|||||||
super(opts);
|
super(opts);
|
||||||
this.autoplay = opts.autoplay;
|
this.autoplay = opts.autoplay;
|
||||||
this.readonly = opts.readonly;
|
this.readonly = opts.readonly;
|
||||||
this.icon = new Icon({
|
this.icon = new bricks.Icon({
|
||||||
url: bricks_resource('imgs/right_arrow.png')});
|
url: bricks_resource('imgs/right_arrow.png')});
|
||||||
this.add_widget(this.icon);
|
this.add_widget(this.icon);
|
||||||
this.icon.bind('click', this.play_audio.bind(this));
|
this.icon.bind('click', this.play_audio.bind(this));
|
||||||
this.player = new VideoPlayer({
|
this.player = new bricks.VideoPlayer({
|
||||||
url:this.value
|
url:this.value
|
||||||
});
|
});
|
||||||
if (this.autoplay){
|
if (this.autoplay){
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
var bricks = window.bricks || {};
|
||||||
function url_params(data) {
|
function url_params(data) {
|
||||||
return Object.keys(data).map(key => `${key}=${encodeURIComponent(data[key])}`).join('&');
|
return Object.keys(data).map(key => `${key}=${encodeURIComponent(data[key])}`).join('&');
|
||||||
}
|
}
|
||||||
class HttpText {
|
bricks.HttpText = class {
|
||||||
constructor(headers){
|
constructor(headers){
|
||||||
/*
|
/*
|
||||||
var _headers = {
|
var _headers = {
|
||||||
@ -170,7 +171,7 @@ class HttpText {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class HttpJson extends HttpText {
|
bricks.HttpJson = class extends bricks.HttpText {
|
||||||
constructor(headers){
|
constructor(headers){
|
||||||
if (!headers)
|
if (!headers)
|
||||||
headers = {};
|
headers = {};
|
||||||
@ -185,11 +186,11 @@ class HttpJson extends HttpText {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var hc = new HttpText();
|
bricks.hc = new bricks.HttpText();
|
||||||
var tget = hc.get.bind(hc);
|
bricks.tget = bricks.hc.get.bind(bricks.hc);
|
||||||
var tpost = hc.post.bind(hc);
|
bricks.tpost = bricks.hc.post.bind(bricks.hc);
|
||||||
jc = new HttpJson();
|
bricks.jc = new bricks.HttpJson();
|
||||||
var jcall = jc.httpcall.bind(jc);
|
bricks.jcall = bricks.jc.httpcall.bind(bricks.jc);
|
||||||
var jget = jc.get.bind(jc);
|
bricks.jget = bricks.jc.get.bind(bricks.jc);
|
||||||
var jpost = jc.post.bind(jc);
|
bricks.jpost = bricks.jc.post.bind(bricks.jc);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
/*
|
/*
|
||||||
reply on "https://github.com/markedjs/marked"
|
reply on "https://github.com/markedjs/marked"
|
||||||
add following lines before 'bricks.js'
|
add following lines before 'bricks.js'
|
||||||
@ -29,7 +29,7 @@ bricks.MdText = class extends bricks.JsWidget {
|
|||||||
this._build(this.opts.md_url);
|
this._build(this.opts.md_url);
|
||||||
}
|
}
|
||||||
_build = async function(md_url){
|
_build = async function(md_url){
|
||||||
var md_content = await tget(md_url);
|
var md_content = await (bricks.tget(md_url));
|
||||||
this.dom_element.innerHTML = marked.parse(md_content);
|
this.dom_element.innerHTML = marked.parse(md_content);
|
||||||
|
|
||||||
/* change links in markdown to a bricks action */
|
/* change links in markdown to a bricks action */
|
||||||
@ -59,7 +59,7 @@ bricks.MarkdownViewer = class extends bricks.VBox {
|
|||||||
if (this.opts.navigator){
|
if (this.opts.navigator){
|
||||||
this.createBackButton();
|
this.createBackButton();
|
||||||
}
|
}
|
||||||
this.mdtext = new MdText({
|
this.mdtext = new bricks.MdText({
|
||||||
md_url:this.md_url
|
md_url:this.md_url
|
||||||
});
|
});
|
||||||
this.add_widget(this.mdtext);
|
this.add_widget(this.mdtext);
|
||||||
@ -112,7 +112,7 @@ bricks.MarkdownViewer = class extends bricks.VBox {
|
|||||||
this._build(this.opts.md_url);
|
this._build(this.opts.md_url);
|
||||||
}
|
}
|
||||||
_build = async function(md_url){
|
_build = async function(md_url){
|
||||||
var md_content = await tget(md_url);
|
var md_content = await (bricks.tget(md_url));
|
||||||
this.md_el.innerHTML = marked.parse(md_content);
|
this.md_el.innerHTML = marked.parse(md_content);
|
||||||
// this.md_el.baseURI = md_url;
|
// this.md_el.baseURI = md_url;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
bricks.Menu = class extends bricks.VBox {
|
bricks.Menu = class extends bricks.VBox {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
bricks.BPopup = class extends bricks.VBox {
|
bricks.BPopup = class extends bricks.VBox {
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
@ -23,11 +23,11 @@ bricks.BPopup = class extends bricks.VBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
build(){
|
build(){
|
||||||
var tb = new HBox({height:'40px'});
|
var tb = new bricks.HBox({height:'40px'});
|
||||||
tb.set_css('title');
|
tb.set_css('title');
|
||||||
VBox.prototype.add_widget.bind(this)(tb);
|
VBox.prototype.add_widget.bind(this)(tb);
|
||||||
var tit = new Text({otext:this.title, i18n:true});
|
var tit = new bricks.Text({otext:this.title, i18n:true});
|
||||||
this.content = new VBox({});
|
this.content = new bricks.VBox({});
|
||||||
VBox.prototype.add_widget.bind(this)(this.content);
|
VBox.prototype.add_widget.bind(this)(this.content);
|
||||||
tb.add_widget(tit);
|
tb.add_widget(tit);
|
||||||
this.holder = Body;
|
this.holder = Body;
|
||||||
@ -74,7 +74,7 @@ bricks.BMessage = class extends bricks.BPopup {
|
|||||||
*/
|
*/
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
super(opts);
|
super(opts);
|
||||||
var t = new Text({otext:this.opts.message,
|
var t = new bricks.Text({otext:this.opts.message,
|
||||||
i18n:true});
|
i18n:true});
|
||||||
this.add_widget(t);
|
this.add_widget(t);
|
||||||
}
|
}
|
||||||
@ -96,7 +96,7 @@ bricks.PopupForm = class extends bricks.BPopup {
|
|||||||
*/
|
*/
|
||||||
constructor(options){
|
constructor(options){
|
||||||
super(options);
|
super(options);
|
||||||
this.form = new Form(this.opts.form);
|
this.form = new bricks.Form(this.opts.form);
|
||||||
this.add_widget(this.form);
|
this.add_widget(this.form);
|
||||||
this.form.bind('submit', this.close_popup.bind(this));
|
this.form.bind('submit', this.close_popup.bind(this));
|
||||||
this.form.bind('discard', this.close_popup.bind(this));
|
this.form.bind('discard', this.close_popup.bind(this));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
bricks.MiniForm = class extends bricks.HBox {
|
bricks.MiniForm = class extends bricks.HBox {
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
bricks.Modal = class extends bricks.Layout {
|
bricks.Modal = class extends bricks.Layout {
|
||||||
constructor(options){
|
constructor(options){
|
||||||
/*
|
/*
|
||||||
@ -19,7 +19,7 @@ bricks.Modal = class extends bricks.Layout {
|
|||||||
this.set_width('100%');
|
this.set_width('100%');
|
||||||
this.set_height('100%');
|
this.set_height('100%');
|
||||||
this.ancestor_add_widget = Layout.prototype.add_widget.bind(this);
|
this.ancestor_add_widget = Layout.prototype.add_widget.bind(this);
|
||||||
this.panel = new VBox({});
|
this.panel = new bricks.VBox({});
|
||||||
this.ancestor_add_widget(this.panel);
|
this.ancestor_add_widget(this.panel);
|
||||||
this.panel.set_width(this.opts.width);
|
this.panel.set_width(this.opts.width);
|
||||||
this.panel.dom_element.style.backgroundColor = this.opts.bgcolor|| '#e8e8e8';
|
this.panel.dom_element.style.backgroundColor = this.opts.bgcolor|| '#e8e8e8';
|
||||||
@ -27,15 +27,15 @@ bricks.Modal = class extends bricks.Layout {
|
|||||||
this.panel.set_css('modal');
|
this.panel.set_css('modal');
|
||||||
archorize(this.panel.dom_element, objget(this.opts, 'archor', 'cc'));
|
archorize(this.panel.dom_element, objget(this.opts, 'archor', 'cc'));
|
||||||
this.create_title();
|
this.create_title();
|
||||||
this.content = new VBox({width:'100%'});
|
this.content = new bricks.VBox({width:'100%'});
|
||||||
this.panel.add_widget(this.content);
|
this.panel.add_widget(this.content);
|
||||||
}
|
}
|
||||||
create_title(){
|
create_title(){
|
||||||
this.title_box = new HBox({width:'100%', height:'auto'});
|
this.title_box = new bricks.HBox({width:'100%', height:'auto'});
|
||||||
this.title_box.set_css('title');
|
this.title_box.set_css('title');
|
||||||
this.panel.add_widget(this.title_box);
|
this.panel.add_widget(this.title_box);
|
||||||
this.title = new HBox({height:'100%'});
|
this.title = new bricks.HBox({height:'100%'});
|
||||||
var icon = new Icon({url:bricks_resource('imgs/delete.png')});
|
var icon = new bricks.Icon({url:bricks_resource('imgs/delete.png')});
|
||||||
icon.bind('click', this.dismiss.bind(this));
|
icon.bind('click', this.dismiss.bind(this));
|
||||||
this.title_box.add_widget(this.title);
|
this.title_box.add_widget(this.title);
|
||||||
this.title_box.add_widget(icon);
|
this.title_box.add_widget(icon);
|
||||||
@ -113,7 +113,7 @@ bricks.ModalForm = class extends bricks.Modal {
|
|||||||
submit_url:this.opts.submit_url,
|
submit_url:this.opts.submit_url,
|
||||||
fields:this.opts.fields
|
fields:this.opts.fields
|
||||||
}
|
}
|
||||||
this.form = new Form(opts);
|
this.form = new bricks.Form(opts);
|
||||||
this.form.bind('submit', this.dismiss.bind(this));
|
this.form.bind('submit', this.dismiss.bind(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
bricks.MultipleStateImage = class extends bricks.Layout {
|
bricks.MultipleStateImage = class extends bricks.Layout {
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
@ -20,7 +20,7 @@ bricks.MultipleStateImage = class extends bricks.Layout {
|
|||||||
width:this.opts.width,
|
width:this.opts.width,
|
||||||
height:this.opts.height
|
height:this.opts.height
|
||||||
}
|
}
|
||||||
this.img = new Image(desc);
|
this.img = new bricks.Image(desc);
|
||||||
this.add_widget(this.img);
|
this.add_widget(this.img);
|
||||||
this.img.bind('click', this.change_state.bind(this));
|
this.img.bind('click', this.change_state.bind(this));
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
class BufferedDataLoader {
|
var bricks = window.bricks || {};
|
||||||
|
bricks.BufferedDataLoader = class {
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
url:
|
url:
|
||||||
@ -54,6 +55,7 @@ class BufferedDataLoader {
|
|||||||
var params = objcopy(this.cur_params);
|
var params = objcopy(this.cur_params);
|
||||||
params.page = this.cur_page;
|
params.page = this.cur_page;
|
||||||
params.rows = this.pagerows;
|
params.rows = this.pagerows;
|
||||||
|
var jcall = bricks.jcall;
|
||||||
var d = await jcall(this.url, {
|
var d = await jcall(this.url, {
|
||||||
method:this.method,
|
method:this.method,
|
||||||
params:params});
|
params:params});
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
|
|
||||||
var low_handle = function(widget, dim, last_pos, cur_pos, maxlen, winsize){
|
var low_handle = function(widget, dim, last_pos, cur_pos, maxlen, winsize){
|
||||||
var dir = cur_pos - last_pos;
|
var dir = cur_pos - last_pos;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
bricks.TabPanel = class extends bricks.Layout {
|
bricks.TabPanel = class extends bricks.Layout {
|
||||||
/*
|
/*
|
||||||
options
|
options
|
||||||
@ -30,16 +30,16 @@ bricks.TabPanel = class extends bricks.Layout {
|
|||||||
super(options);
|
super(options);
|
||||||
this.content_buffer = {};
|
this.content_buffer = {};
|
||||||
this.cur_tab_name = '';
|
this.cur_tab_name = '';
|
||||||
this.content_container = new VFiller({});
|
this.content_container = new bricks.VFiller({});
|
||||||
if (this.opts.tab_pos == 'top' || this.opts.tab_pos == 'bottom'){
|
if (this.opts.tab_pos == 'top' || this.opts.tab_pos == 'bottom'){
|
||||||
this.set_css('vbox');
|
this.set_css('vbox');
|
||||||
var height = this.opts.tab_wide || 'auto';
|
var height = this.opts.tab_wide || 'auto';
|
||||||
this.tab_container = new VBox({height:height});
|
this.tab_container = new bricks.VBox({height:height});
|
||||||
this.tab_container.dom_element.style.width = this.opts.tab_long || '100%';
|
this.tab_container.dom_element.style.width = this.opts.tab_long || '100%';
|
||||||
} else {
|
} else {
|
||||||
this.set_css('hbox');
|
this.set_css('hbox');
|
||||||
var width= this.opts.tab_wide || 'auto';
|
var width= this.opts.tab_wide || 'auto';
|
||||||
this.tab_container = new VBox({width:width});
|
this.tab_container = new bricks.VBox({width:width});
|
||||||
this.tab_container.dom_element.style.height = this.opts.tab_long || '100%';
|
this.tab_container.dom_element.style.height = this.opts.tab_long || '100%';
|
||||||
}
|
}
|
||||||
if (this.opts.tab_pos == 'top' || this.opts.tab_pos == 'left'){
|
if (this.opts.tab_pos == 'top' || this.opts.tab_pos == 'left'){
|
||||||
@ -70,7 +70,7 @@ bricks.TabPanel = class extends bricks.Layout {
|
|||||||
orient = 'vertical';
|
orient = 'vertical';
|
||||||
}
|
}
|
||||||
desc.orientation = orient;
|
desc.orientation = orient;
|
||||||
this.toolbar = new Toolbar(desc);
|
this.toolbar = new bricks.Toolbar(desc);
|
||||||
this.toolbar.bind('command', this.show_tabcontent.bind(this));
|
this.toolbar.bind('command', this.show_tabcontent.bind(this));
|
||||||
this.toolbar.bind('remove', this.tab_removed.bind(this));
|
this.toolbar.bind('remove', this.tab_removed.bind(this));
|
||||||
this.toolbar.bind('ready', this.show_first_tab.bind(this));
|
this.toolbar.bind('ready', this.show_first_tab.bind(this));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
bricks.Toolbar = class extends bricks.Layout {
|
bricks.Toolbar = class extends bricks.Layout {
|
||||||
/* toolbar options
|
/* toolbar options
|
||||||
{
|
{
|
||||||
@ -26,10 +26,10 @@ bricks.Toolbar = class extends bricks.Layout {
|
|||||||
super(options);
|
super(options);
|
||||||
this.toolList = [];
|
this.toolList = [];
|
||||||
if (this.opts.orientation == 'vertical'){
|
if (this.opts.orientation == 'vertical'){
|
||||||
this.bar = new VBox(options);
|
this.bar = new bricks.VBox(options);
|
||||||
this.dom_element.classList.add('vtoolbar')
|
this.dom_element.classList.add('vtoolbar')
|
||||||
} else {
|
} else {
|
||||||
this.bar = new HBox(options);
|
this.bar = new bricks.HBox(options);
|
||||||
this.dom_element.classList.add('htoolbar')
|
this.dom_element.classList.add('htoolbar')
|
||||||
}
|
}
|
||||||
this.add_widget(this.bar);
|
this.add_widget(this.bar);
|
||||||
@ -39,11 +39,11 @@ bricks.Toolbar = class extends bricks.Layout {
|
|||||||
}
|
}
|
||||||
add_interval_box(){
|
add_interval_box(){
|
||||||
if (this.opts.orientation == 'vertical'){
|
if (this.opts.orientation == 'vertical'){
|
||||||
this.bar.add_widget(new JsWidget({
|
this.bar.add_widget(new bricks.JsWidget({
|
||||||
height:this.opts.interval || '10px'
|
height:this.opts.interval || '10px'
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
this.bar.add_widget(new JsWidget({
|
this.bar.add_widget(new bricks.JsWidget({
|
||||||
width:this.opts.interval || '10px'
|
width:this.opts.interval || '10px'
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ bricks.Toolbar = class extends bricks.Layout {
|
|||||||
add_removable(item){
|
add_removable(item){
|
||||||
if (! item.tool_opts.removable) return;
|
if (! item.tool_opts.removable) return;
|
||||||
var img_src = bricks_resource('imgs/delete.png');
|
var img_src = bricks_resource('imgs/delete.png');
|
||||||
var image = new Icon({url:img_src});
|
var image = new bricks.Icon({url:img_src});
|
||||||
if (image){
|
if (image){
|
||||||
item.add_widget(image);
|
item.add_widget(image);
|
||||||
image.bind('click',this.remove_item.bind(this, item));
|
image.bind('click',this.remove_item.bind(this, item));
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
bricks. TreeNode = class extends bricks.VBox {
|
bricks. TreeNode = class extends bricks.VBox {
|
||||||
constructor(tree, parent, data){
|
constructor(tree, parent, data){
|
||||||
var opts = {
|
var opts = {
|
||||||
@ -16,7 +16,7 @@ bricks. TreeNode = class extends bricks.VBox {
|
|||||||
if (this.tree.multitype_tree){
|
if (this.tree.multitype_tree){
|
||||||
this.params['type'] = this.data[this.tree.opts.typeField];
|
this.params['type'] = this.data[this.tree.opts.typeField];
|
||||||
}
|
}
|
||||||
var n = new HBox({
|
var n = new bricks.HBox({
|
||||||
height:'auto',
|
height:'auto',
|
||||||
overflow:'hidden',
|
overflow:'hidden',
|
||||||
width:'100%'
|
width:'100%'
|
||||||
@ -27,7 +27,7 @@ bricks. TreeNode = class extends bricks.VBox {
|
|||||||
this.node_widget = n;
|
this.node_widget = n;
|
||||||
this.create_node_content(n);
|
this.create_node_content(n);
|
||||||
if (! this.data.is_leaf) {
|
if (! this.data.is_leaf) {
|
||||||
this.container = new VBox({height:'auto', overflow:'hidden'});
|
this.container = new bricks.VBox({height:'auto', overflow:'hidden'});
|
||||||
this.add_widget(this.container);
|
this.add_widget(this.container);
|
||||||
this.container.dom_element.style.marginLeft = bricks.app.charsize + 'px';
|
this.container.dom_element.style.marginLeft = bricks.app.charsize + 'px';
|
||||||
if (this.data.children){
|
if (this.data.children){
|
||||||
@ -69,13 +69,13 @@ bricks. TreeNode = class extends bricks.VBox {
|
|||||||
create_node_content(widget){
|
create_node_content(widget){
|
||||||
var img_size = bricks.app.charsize;
|
var img_size = bricks.app.charsize;
|
||||||
if (this.is_leaf){
|
if (this.is_leaf){
|
||||||
widget.add_widget(new BlankIcon({}));
|
widget.add_widget(new bricks.BlankIcon({}));
|
||||||
} else {
|
} else {
|
||||||
var srcs = this.tree.opts.node_state_imgs || {};
|
var srcs = this.tree.opts.node_state_imgs || {};
|
||||||
var sources = {};
|
var sources = {};
|
||||||
sources['open'] = objget(srcs, 'open', bricks_resource('imgs/down_arrow.png'));
|
sources['open'] = objget(srcs, 'open', bricks_resource('imgs/down_arrow.png'));
|
||||||
sources['close'] = objget(srcs, 'close', bricks_resource('imgs/right_arrow.png'));
|
sources['close'] = objget(srcs, 'close', bricks_resource('imgs/right_arrow.png'));
|
||||||
this.trigle = new MultipleStateIcon({
|
this.trigle = new bricks.MultipleStateIcon({
|
||||||
state:'close',
|
state:'close',
|
||||||
urls:sources,
|
urls:sources,
|
||||||
height:img_size,
|
height:img_size,
|
||||||
@ -92,14 +92,14 @@ bricks. TreeNode = class extends bricks.VBox {
|
|||||||
if (!icon){
|
if (!icon){
|
||||||
icon = bricks_resource('imgs/folder.png');
|
icon = bricks_resource('imgs/folder.png');
|
||||||
}
|
}
|
||||||
var img = new Icon({
|
var img = new bricks.Icon({
|
||||||
url:icon
|
url:icon
|
||||||
});
|
});
|
||||||
widget.add_widget(img);
|
widget.add_widget(img);
|
||||||
var txt = this.data[this.tree.opts.textField];
|
var txt = this.data[this.tree.opts.textField];
|
||||||
widget.add_widget(
|
widget.add_widget(
|
||||||
this.str_w = new Text({text:txt}));
|
this.str_w = new bricks.Text({text:txt}));
|
||||||
this.input = new UiStr({name:'text', value:txt});
|
this.input = new bricks.UiStr({name:'text', value:txt});
|
||||||
this.input.bind('blur', this.edit_handle.bind(this));
|
this.input.bind('blur', this.edit_handle.bind(this));
|
||||||
widget.add_widget(this.str_w);
|
widget.add_widget(this.str_w);
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ bricks. TreeNode = class extends bricks.VBox {
|
|||||||
var v = this.input.value;
|
var v = this.input.value;
|
||||||
r = await this.syncdata('edit');
|
r = await this.syncdata('edit');
|
||||||
this.data[this.tree.opts.textField] = v;
|
this.data[this.tree.opts.textField] = v;
|
||||||
this.str_w = new Text({text:v});
|
this.str_w = new bricks.Text({text:v});
|
||||||
this.node_widget.remove_widget(this.input);
|
this.node_widget.remove_widget(this.input);
|
||||||
this.node_widget.add_widget(this.str_w);
|
this.node_widget.add_widget(this.str_w);
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ bricks. Tree = class extends bricks.VBox {
|
|||||||
this.multitype_tree = this.opts.multitype_tree||false;
|
this.multitype_tree = this.opts.multitype_tree||false;
|
||||||
this.selected_node = null;
|
this.selected_node = null;
|
||||||
this.create_toolbar();
|
this.create_toolbar();
|
||||||
this.container = new VScrollPanel({});
|
this.container = new bricks.VScrollPanel({});
|
||||||
this.add_widget(this.container);
|
this.add_widget(this.container);
|
||||||
this.data_id = null;
|
this.data_id = null;
|
||||||
if (this.opts.dataurl){
|
if (this.opts.dataurl){
|
||||||
@ -167,6 +167,7 @@ bricks. Tree = class extends bricks.VBox {
|
|||||||
create_toolbar(){
|
create_toolbar(){
|
||||||
}
|
}
|
||||||
async get_children_data(node){
|
async get_children_data(node){
|
||||||
|
var jcall = bricks.jcall;
|
||||||
var d = await jcall(this.opts.dataurl,{
|
var d = await jcall(this.opts.dataurl,{
|
||||||
method : this.opts.method || 'GET',
|
method : this.opts.method || 'GET',
|
||||||
params : node.params
|
params : node.params
|
||||||
@ -179,7 +180,7 @@ bricks. Tree = class extends bricks.VBox {
|
|||||||
}
|
}
|
||||||
create_node_children(node, data){
|
create_node_children(node, data){
|
||||||
for (var i=0; i<data.length; i++){
|
for (var i=0; i<data.length; i++){
|
||||||
var n = new TreeNode(this, node, data[i]);
|
var n = new bricks.TreeNode(this, node, data[i]);
|
||||||
node.container.add_widget(n);
|
node.container.add_widget(n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -252,7 +253,7 @@ bricks. EditableTree = class extends bricks.Tree {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
this.toolbar = new Toolbar(desc);
|
this.toolbar = new bricks.Toolbar(desc);
|
||||||
this.toolbar.bind('command', this.command_handle.bind(this));
|
this.toolbar.bind('command', this.command_handle.bind(this));
|
||||||
this.add_widget(this.toolbar, 0);
|
this.add_widget(this.toolbar, 0);
|
||||||
}
|
}
|
||||||
@ -289,7 +290,7 @@ bricks. EditableTree = class extends bricks.Tree {
|
|||||||
var data = { };
|
var data = { };
|
||||||
data[this.opts.idField] = 'undefined';
|
data[this.opts.idField] = 'undefined';
|
||||||
data[this.opts.textField] = 'new node';
|
data[this.opts.textField] = 'new node';
|
||||||
var n = new TreeNode(this, node, data);
|
var n = new bricks.TreeNode(this, node, data);
|
||||||
node.container.add_widget(n);
|
node.container.add_widget(n);
|
||||||
n.edit();
|
n.edit();
|
||||||
console.log('add_node() finished ...');
|
console.log('add_node() finished ...');
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
class UiTypesDef {
|
var bricks = window.bricks || {};
|
||||||
|
bricks.UiTypesDef = class {
|
||||||
constructor(opts){
|
constructor(opts){
|
||||||
this.opts = opts;
|
this.opts = opts;
|
||||||
this.uitypes = {
|
this.uitypes = {
|
||||||
@ -41,21 +42,21 @@ class UiTypesDef {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var uitypesdef = new UiTypesDef();
|
bricks.uitypesdef = new bricks.UiTypesDef();
|
||||||
|
|
||||||
var viewFactory = function(desc, rec){
|
bricks.viewFactory = function(desc, rec){
|
||||||
var uitype = desc.uitype;
|
var uitype = desc.uitype;
|
||||||
var builder = uitypesdef.getViewBuilder(uitype) ||
|
var builder = bricks.uitypesdef.getViewBuilder(uitype) ||
|
||||||
uitypesdef.getViewBuilder('str');
|
bricks.uitypesdef.getViewBuilder('str');
|
||||||
if (! builder) return Null;
|
if (! builder) return Null;
|
||||||
var w = builder(desc, rec);
|
var w = builder(desc, rec);
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
var intputFactory = function(desc, rec){
|
bricks.inputFactory = function(desc, rec){
|
||||||
var uitype = desc.uitype;
|
var uitype = desc.uitype;
|
||||||
var builder = uitypesdef.getInputBuilder(uitype) ||
|
var builder = bricks.uitypesdef.getInputBuilder(uitype) ||
|
||||||
uitypesdef.getInputBuilder('str');
|
bricks.uitypesdef.getInputBuilder('str');
|
||||||
if (! builder) return Null;
|
if (! builder) return Null;
|
||||||
return builder(desc, rec);
|
return builder(desc, rec);
|
||||||
}
|
}
|
||||||
@ -76,25 +77,25 @@ var strViewBuilder = function(desc, rec){
|
|||||||
var v = rec[desc.name];
|
var v = rec[desc.name];
|
||||||
return buildText(v, 'left');
|
return buildText(v, 'left');
|
||||||
}
|
}
|
||||||
uitypesdef.setViewBuilder('str', strViewBuilder);
|
bricks.uitypesdef.setViewBuilder('str', strViewBuilder);
|
||||||
|
|
||||||
var strInputBuilder = function(desc, rec) {
|
var strInputBuilder = function(desc, rec) {
|
||||||
var v = rec[desc.name];
|
var v = rec[desc.name];
|
||||||
desc[value] = v;
|
desc[value] = v;
|
||||||
return new UiStr(desc);
|
return new UiStr(desc);
|
||||||
}
|
}
|
||||||
uitypesdef.setInputBuilder('str', strInputBuilder);
|
bricks.uitypesdef.setInputBuilder('str', strInputBuilder);
|
||||||
|
|
||||||
var passwordViewBuilder = function(desc, rec){
|
var passwordViewBuilder = function(desc, rec){
|
||||||
return new buildText('******');
|
return new buildText('******');
|
||||||
}
|
}
|
||||||
uitypesdef.setViewBuilder('password', passwordViewBuilder);
|
bricks.uitypesdef.setViewBuilder('password', passwordViewBuilder);
|
||||||
|
|
||||||
var intViewBuilder = function(desc, rec){
|
var intViewBuilder = function(desc, rec){
|
||||||
var v = rec[desc.name] + '';
|
var v = rec[desc.name] + '';
|
||||||
return buildText(v, 'right');
|
return buildText(v, 'right');
|
||||||
}
|
}
|
||||||
uitypesdef.setViewBuilder('int', intViewBuilder);
|
bricks.uitypesdef.setViewBuilder('int', intViewBuilder);
|
||||||
|
|
||||||
var floatViewBuilder = function(desc, rec){
|
var floatViewBuilder = function(desc, rec){
|
||||||
var v = rec[desc.name];
|
var v = rec[desc.name];
|
||||||
@ -102,7 +103,7 @@ var floatViewBuilder = function(desc, rec){
|
|||||||
v = v + '';
|
v = v + '';
|
||||||
return buildText(v, 'right');
|
return buildText(v, 'right');
|
||||||
}
|
}
|
||||||
uitypesdef.setViewBuilder('float', floatViewBuilder);
|
bricks.uitypesdef.setViewBuilder('float', floatViewBuilder);
|
||||||
|
|
||||||
var codeViewBuilder = function(desc, rec){
|
var codeViewBuilder = function(desc, rec){
|
||||||
var opts = objcopy(desc)
|
var opts = objcopy(desc)
|
||||||
@ -115,10 +116,9 @@ var codeViewBuilder = function(desc, rec){
|
|||||||
}
|
}
|
||||||
return buildText(v, 'left')
|
return buildText(v, 'left')
|
||||||
}
|
}
|
||||||
uitypesdef.setViewBuilder('code', codeViewBuilder);
|
bricks.uitypesdef.setViewBuilder('code', codeViewBuilder);
|
||||||
|
|
||||||
|
|
||||||
var passwordInputBuilder = function(desc, rec){
|
var passwordInputBuilder = function(desc, rec){
|
||||||
return new UiPassword(desc);
|
return new UiPassword(desc);
|
||||||
}
|
}
|
||||||
uitypesdef.setInputBuilder('password', passwordInputBuilder);
|
bricks.uitypesdef.setInputBuilder('password', passwordInputBuilder);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
var bricks = window.bricks || {};
|
||||||
class _TypeIcons {
|
class _TypeIcons {
|
||||||
constructor(){
|
constructor(){
|
||||||
this.kv = {}
|
this.kv = {}
|
||||||
@ -85,7 +86,7 @@ var import_cache = new Map()
|
|||||||
|
|
||||||
var import_css = async function(url){
|
var import_css = async function(url){
|
||||||
if (objget(import_cache, url)===1) return;
|
if (objget(import_cache, url)===1) return;
|
||||||
var result = await tget(url);
|
var result = await (bricks.tget(url));
|
||||||
debug('import_css():tget() return', result);
|
debug('import_css():tget() return', result);
|
||||||
var s = document.createElement('style');
|
var s = document.createElement('style');
|
||||||
s.setAttribute('type', 'text/javascript');
|
s.setAttribute('type', 'text/javascript');
|
||||||
@ -96,7 +97,7 @@ var import_css = async function(url){
|
|||||||
|
|
||||||
var import_js = async function(url){
|
var import_js = async function(url){
|
||||||
if (objget(import_cache, url)===1) return;
|
if (objget(import_cache, url)===1) return;
|
||||||
// var result = await tget(url);
|
// var result = await (bricks.tget(url));
|
||||||
// debug('import_js():tget() return', url, result);
|
// debug('import_js():tget() return', url, result);
|
||||||
var s = document.createElement('script');
|
var s = document.createElement('script');
|
||||||
s.setAttribute('type', 'text/javascript');
|
s.setAttribute('type', 'text/javascript');
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
/*
|
/*
|
||||||
we use videojs for video play
|
we use videojs for video play
|
||||||
https://videojs.com
|
https://videojs.com
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
bricks.JsWidget = class {
|
bricks.JsWidget = class {
|
||||||
dom_element = null;
|
dom_element = null;
|
||||||
constructor(options){
|
constructor(options){
|
||||||
@ -226,7 +226,7 @@ bricks.TextBase = class extends bricks.JsWidget {
|
|||||||
if (this.opts.hasOwnProperty('i18n')){
|
if (this.opts.hasOwnProperty('i18n')){
|
||||||
this.i18n = this.opts.i18n;
|
this.i18n = this.opts.i18n;
|
||||||
}
|
}
|
||||||
this._i18n = new I18n();
|
this._i18n = new bricks.I18n();
|
||||||
if (this.i18n && this.otext) {
|
if (this.i18n && this.otext) {
|
||||||
this.text = this._i18n._(this.otext);
|
this.text = this._i18n._(this.otext);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
bricks = window.bricks || {};
|
var bricks = window.bricks || {};
|
||||||
/*
|
/*
|
||||||
dependent on xterm.js
|
dependent on xterm.js
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user