From 1fff5301186f0ed3cbfe4c8c002340d618ae079b Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 22 Feb 2024 00:48:58 +0800 Subject: [PATCH] bugfix --- bricks/build.sh | 4 ++-- bricks/form.js | 17 ++++++++++++++++- bricks/scroll.js | 3 ++- bricks/tree.js | 7 +++---- bricks/utils.js | 4 ++++ 5 files changed, 27 insertions(+), 8 deletions(-) diff --git a/bricks/build.sh b/bricks/build.sh index 088f2f4..1d8c9ab 100755 --- a/bricks/build.sh +++ b/bricks/build.sh @@ -1,10 +1,10 @@ SOURCES=" factory.js uitypesdef.js utils.js i18n.js widget.js \ bricks.js image.js \ - jsoncall.js myoperator.js layout.js menu.js modal.js \ + jsoncall.js myoperator.js layout.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 \ - paging.js scroll.js datagrid.js dataviewer.js \ + paging.js datagrid.js dataviewer.js \ miniform.js wterm.js " echo ${SOURCES} cat ${SOURCES} > ../dist/bricks.js diff --git a/bricks/form.js b/bricks/form.js index 505c742..e919f6d 100644 --- a/bricks/form.js +++ b/bricks/form.js @@ -21,13 +21,25 @@ bricks.FormBody = class extends bricks.VBox { opts.width = '100%'; opts.scrollY = 'scroll'; super(opts); + console.log('dxcygvuhbijnokmpl,;lmknjbhvgcfx'); this.name_inputs = {}; this.form_body = new bricks.Layout({width:'100%', overflow:'auto' }); this.add_widget(this.form_body); - this.form_body.set_css('multicolumns'); + this.max_item_height = 50; this.build_fields(); + console.log('max_item_height=', this.max_item_height); + var v = this.max_item_height + 'px'; + console.log('v=', v); + // this.set_style('columnHeight', v); + v = this.opts.input_width || 400 + 'px'; + console.log('v=', v); + this.set_style('columnWidth', v); + this.set_style('columnGap', '40px'); + this.set_style('overflowX', 'none'); + console.log('v=============================', v); + } reset_data(){ for (var name in this.name_inputs){ @@ -90,6 +102,9 @@ bricks.FormBody = class extends bricks.VBox { if (w){ box.add_widget(w); this.name_inputs[fields[i].name] = w; + if (this.max_item_height < box.height){ + this.max_item_height = box.height; + } console.log(fields[i].uitype, 'create Input ok'); } else { console.log(fields[i], 'createInput failed'); diff --git a/bricks/scroll.js b/bricks/scroll.js index ec58e11..b10901d 100644 --- a/bricks/scroll.js +++ b/bricks/scroll.js @@ -27,7 +27,7 @@ bricks.HScrollPanel = class extends bricks.HBox { opts.width = '100%'; opts.height = '100%'; super(opts); - + this.set_css('hscroll'); this.min_threshold = opts.min_threshold || 0.02; this.max_threshold = opts.max_threshold || 0.95; this.bind('scroll', this.scroll_handle.bind(this)) @@ -64,6 +64,7 @@ bricks.VScrollPanel = class extends bricks.VBox { opts.width = '100%'; opts.height = '100%'; super(opts); + this.set_css('vscroll'); this.min_threshold = opts.min_threshold || 0.02; this.max_threshold = opts.max_threshold || 0.95; this.bind('scroll', this.scroll_handle.bind(this)) diff --git a/bricks/tree.js b/bricks/tree.js index c1e5947..8f1e631 100755 --- a/bricks/tree.js +++ b/bricks/tree.js @@ -1,5 +1,5 @@ var bricks = window.bricks || {}; -bricks. TreeNode = class extends bricks.VBox { +bricks.TreeNode = class extends bricks.VBox { constructor(tree, parent, data){ var opts = { width:'100%', @@ -122,7 +122,7 @@ bricks. TreeNode = class extends bricks.VBox { } } -bricks. Tree = class extends bricks.VBox { +bricks.Tree = class extends bricks.VScrollPanel { /* { row_height: @@ -151,12 +151,11 @@ bricks. Tree = class extends bricks.VBox { */ constructor(options){ super(options); - this.set_height('100%'); this.row_height = this.opts.row_height || '35px'; this.multitype_tree = this.opts.multitype_tree||false; this.selected_node = null; this.create_toolbar(); - this.container = new bricks.VScrollPanel({}); + this.container = this; this.add_widget(this.container); this.data_id = null; if (this.opts.dataurl){ diff --git a/bricks/utils.js b/bricks/utils.js index c6ee0e4..2bc4aae 100755 --- a/bricks/utils.js +++ b/bricks/utils.js @@ -1,6 +1,10 @@ var bricks = window.bricks || {}; bricks.isMobile = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); +bricks.is_mobile = function(){ + return typeof screen.orientation !== 'undefined'; +} + class _TypeIcons { constructor(){ this.kv = {}