This commit is contained in:
yumoqing 2024-02-21 23:00:49 +08:00
parent 6ff89c03a8
commit 8e1239a8e6
15 changed files with 39 additions and 32 deletions

View File

@ -227,7 +227,7 @@ bricks.buildUrlwidgetHandler = function(w, target, rtdata, desc){
target.add_widget(w);
}
var options = objcopy(desc.options);
extend(options.params, rtdata);
bricks.extend(options.params, rtdata);
var opts = {
"widgettype":"urlwidget",
"options":options
@ -248,7 +248,7 @@ bricks.buildBricksHandler = function(w, target, rtdata, desc){
target.add_widget(w);
}
var options = objcopy(desc.options);
extend(options.options, rtdata);
bricks.extend(options.options, rtdata);
return f.bind(target, target, desc.mode || 'replace', options);
}
bricks.buildRegisterFunctionHandler = function(w, target, rtdata, desc){
@ -259,10 +259,10 @@ bricks.buildRegisterFunctionHandler = function(w, target, rtdata, desc){
}
var params = {};
if (desc.params){
extend(params, desc.params);
bricks.extend(params, desc.params);
}
if (rtdata){
extend(params, rtdata);
bricks.extend(params, rtdata);
}
return f.bind(target, params);
}
@ -273,22 +273,22 @@ bricks.buildMethodHandler = function(w, target, rtdata, desc){
return null;
}
var params = {};
extend(params, desc.params)
extend(params, rtdata);
bricks.extend(params, desc.params)
bricks.extend(params, rtdata);
return f.bind(target, params);
}
bricks.buildScriptHandler = function(w, target, rtdata, desc){
var params = {};
extend(params, desc.params)
extend(params, rtdata);
bricks.extend(params, desc.params)
bricks.extend(params, rtdata);
var f = new Function('target', 'params', 'event', desc.script);
console.log('params=', params, 'buildScriptHandler() ..........');
return f.bind(target, target, params);
}
bricks.buildDispatchEventHandler = function(w, target, rtdata, desc){
var params = {};
extend(params, desc.params)
extend(params, rtdata);
bricks.extend(params, desc.params)
bricks.extend(params, rtdata);
var f = function(target, event_name, params){
target.dispatch(event_name, params);
}

View File

@ -50,7 +50,7 @@ bricks.Button = class extends bricks.Layout {
this.item_rate = opts.item_rate || 1;
this.set_id(this.opts.name);
this.opts_setup();
extend(this.dom_element.style, style);
bricks.extend(this.dom_element.style, style);
}
create(){
this.dom_element = document.createElement('button');

View File

@ -23,7 +23,7 @@ bricks.Row = class {
var f = fields[i];
var opts = f.uioptions || {};
var w;
extend(opts, {
bricks.extend(opts, {
name: f.name,
label: f.label,
uitype: f.uitype,

View File

@ -52,7 +52,7 @@ bricks.FormBody = class extends bricks.VBox {
w.focus();
return;
}
extend(data, d);
bricks.extend(data, d);
}
return data;
}

View File

@ -30,7 +30,7 @@ bricks.I18n = class {
}
setup_dict(dic, lang){
this.cur_lang = lang;
extend(this.lang_msgs, {lang:dic});
bricks.extend(this.lang_msgs, {lang:dic});
this.msgs = dic;
}
async change_lang(lang){

View File

@ -293,7 +293,7 @@ bricks.UiCheck =class extends bricks.UiType {
static uitype = 'check';
constructor(opts){
super(opts);
extend(UiCheck.prototype, Layout.prototype);
bricks.extend(UiCheck.prototype, Layout.prototype);
this.add_widget = Layout.prototype.add_widget.bind(this);
this.dom_element.style.width = 'auto';
this.dom_element.style.height = 'auto';
@ -559,7 +559,7 @@ bricks.UiCode =class extends bricks.UiType {
async get_data(event){
var params = this.opts.params;
if(event){
extend(params, event.params);
bricks.extend(params, event.params);
}
var jcall = bricks.jcall;
var d = await jcall(this.opts.dataurl,

View File

@ -17,7 +17,7 @@ bricks.HttpText = class {
this.headers = headers || {
"Accept":"text/html",
};
extend(this.headers, headers);
bricks.extend(this.headers, headers);
this.params = {
"_webbricks_":1
}
@ -53,7 +53,7 @@ bricks.HttpText = class {
}
params = Object.assign(this.params, params);
if (session){
extend(params,{session:session});
bricks.extend(params,{session:session});
}
return params;
}
@ -191,7 +191,7 @@ bricks.HttpJson = class extends bricks.HttpText {
this.headers = {
"Accept": "application/json",
}
extend(this.headers, headers);
bricks.extend(this.headers, headers);
}
async get_result_data(resp) {
return await resp.json()

View File

@ -76,7 +76,7 @@ bricks.MiniForm = class extends bricks.HBox {
getValue(){
var d = this.opts.params || {};
var v = this.input.getValue();
extend(d, v);
bricks.extend(d, v);
return d;
}
}

View File

@ -38,7 +38,7 @@ bricks.BufferedDataLoader = class {
this.buffer = {};
if (!params) params = {};
var p = objcopy(this.params);
extend(p, params);
bricks.extend(p, params);
p.rows = this.pagerows;
this.cur_params = p;
this.cur_page = 1;

View File

@ -3,7 +3,7 @@ class RegisterFunction {
this.rfs = {};
}
register(n, f){
extend(this.rfs, {n:f});
bricks.extend(this.rfs, {n:f});
}
get(n){
return objget(this.rfs, n);

View File

@ -16,7 +16,7 @@ var low_handle = function(widget, dim, last_pos, cur_pos, maxlen, winsize){
}
}
bricks.HScrollPanel = class extends bricks.HFiller {
bricks.HScrollPanel = class extends bricks.HBox {
/*
{
min_threshold:
@ -24,7 +24,10 @@ bricks.HScrollPanel = class extends bricks.HFiller {
}
*/
constructor(opts){
opts.width = '100%';
opts.height = '100%';
super(opts);
this.min_threshold = opts.min_threshold || 0.02;
this.max_threshold = opts.max_threshold || 0.95;
this.bind('scroll', this.scroll_handle.bind(this))
@ -50,7 +53,7 @@ bricks.HScrollPanel = class extends bricks.HFiller {
}
}
bricks.VScrollPanel = class extends bricks.VFiller {
bricks.VScrollPanel = class extends bricks.VBox {
/*
{
min_threshold:
@ -58,6 +61,8 @@ bricks.VScrollPanel = class extends bricks.VFiller {
}
*/
constructor(opts){
opts.width = '100%';
opts.height = '100%';
super(opts);
this.min_threshold = opts.min_threshold || 0.02;
this.max_threshold = opts.max_threshold || 0.95;

View File

@ -95,7 +95,7 @@ bricks.Toolbar = class extends bricks.Layout {
console.log('Toolbar() onclock,target=', event.target, tool);
var e = new Event('command');
var d = {};
extend(d, tool.tool_opts);
bricks.extend(d, tool.tool_opts);
if (this.opts.target){
d.target = this.opts.target;
}

View File

@ -107,7 +107,7 @@ bricks.uitypesdef.setViewBuilder('float', floatViewBuilder);
var codeViewBuilder = function(desc, rec){
var opts = objcopy(desc)
if (opts.uiparams) extend(opts, opts.uiparams);
if (opts.uiparams) bricks.extend(opts, opts.uiparams);
var name = desc.textFeild || 'text';
var v = rec[name];
if (! v) {

View File

@ -1,4 +1,6 @@
var bricks = window.bricks || {};
bricks.isMobile = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
class _TypeIcons {
constructor(){
this.kv = {}
@ -37,10 +39,10 @@ var currentScriptPath = function () {
return currentScript.replace( currentScriptFile, '' );
}
var bricks_path = currentScriptPath();
bricks.path = currentScriptPath();
var bricks_resource = function(name){
return bricks_path + name;
return bricks.path + name;
}
/**
@ -108,14 +110,14 @@ var import_js = async function(url){
}
var extend = function(d, s){
bricks.extend = function(d, s){
for (var p in s){
if (! s.hasOwnProperty(p)){
continue;
}
if (d[p] && (typeof(d[p]) == 'object')
&& (d[p].toString() == '[object Object]') && s[p]){
extend(d[p], s[p]);
bricks.extend(d[p], s[p]);
} else {
d[p] = s[p];
}

View File

@ -67,7 +67,7 @@ bricks.JsWidget = class {
}
this[okeys[k]] = this.opts[okeys[k]];
}
extend(this.dom_element.style, style);
bricks.extend(this.dom_element.style, style);
if (this.opts.css){
this.set_css(this.opts.css);
}
@ -155,7 +155,7 @@ bricks.JsWidget = class {
}
}
set_cssObject(cssobj){
extend(this.dom_element.style, cssobj);
bricks.extend(this.dom_element.style, cssobj);
}
is_container(){
return this._container;