From e39214e606499930c07c340803bee0c8af14e7bf Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 14 May 2024 17:14:30 +0800 Subject: [PATCH] bugfix --- bricks/datarow.js | 2 +- bricks/message.js | 5 - bricks/tabular.js | 35 ++---- docs/cn/widgets/audioplayer.md | 33 ++++++ docs/cn/widgets/audiorecorder.md | 56 ++++++++++ docs/cn/widgets/conform.md | 34 ++++++ docs/cn/widgets/dynamicaccordion.md | 30 +++++ docs/cn/widgets/message.md | 163 +++++----------------------- docs/cn/widgets/tmpl.md | 9 ++ 9 files changed, 201 insertions(+), 166 deletions(-) create mode 100644 docs/cn/widgets/audioplayer.md create mode 100644 docs/cn/widgets/audiorecorder.md create mode 100644 docs/cn/widgets/conform.md create mode 100644 docs/cn/widgets/dynamicaccordion.md create mode 100644 docs/cn/widgets/tmpl.md diff --git a/bricks/datarow.js b/bricks/datarow.js index a1aac15..0b633b5 100644 --- a/bricks/datarow.js +++ b/bricks/datarow.js @@ -133,7 +133,7 @@ bricks.DataRow = class extends bricks.HBox { var opts = bricks.extend({ margin:'3px' }, f); - if (header){ + if (header || ! this.user_data){ opts.value = f.label || f.name; } else { opts.value = this.user_data[f.name]; diff --git a/bricks/message.js b/bricks/message.js index fc0458e..077112b 100644 --- a/bricks/message.js +++ b/bricks/message.js @@ -64,11 +64,6 @@ bricks.Message = class extends bricks.Modal { { title: message: - params: - auto_open: - auto_dismiss: - archor:cc - timeout: } */ constructor(opts){ diff --git a/bricks/tabular.js b/bricks/tabular.js index 999d961..5d69ea8 100644 --- a/bricks/tabular.js +++ b/bricks/tabular.js @@ -2,15 +2,14 @@ var bricks = window.bricks || {}; bricks.Tabular = class extends bricks.DynamicAccordion { constructor(opts){ super(opts); - // this.fields = this.record_view.options.fields; this.get_edit_fields(); } get_edit_fields(){ - var fs = this.record_view.options.fields; + var fs = this.row_options.fields; this.fields = []; var exclouded = []; - if (this.record_view.options.editexclouded){ - exclouded = this.record_view.options.editexclouded; + if (this.row_options.editexclouded){ + exclouded = this.row_options.editexclouded; } fs.forEach(f => { if (!exclouded.includes(f.name)){ @@ -20,29 +19,17 @@ bricks.Tabular = class extends bricks.DynamicAccordion { } async build_info(item, record){ - if (this.record_view.widgettype != 'DataRow'){ - console.log('record_view must be DataRow'); - return - } + var header = true; + var options = bricks.extend({cheight:this.cheight}, this.row_options); if (record){ - /* data row - */ - var options = bricks.extend({cheight:this.cheight}, this.record_view.options); - var desc = bricks.extend({}, this.record_view); options.user_data = record; - desc.options = options - var dr = await bricks.widgetBuild(desc, this); - dr.render(this.editable, this.checkable, false); - dr.event_names.forEach(e => { - dr.toolbar_w.bind(e, this.record_event_handle.bind(this, e, record, dr, item)); - }); - } else { - var dr = await bricks.widgetBuild(this.record_view, this); - dr.render(this.editable, this.checkable, true); - dr.event_names.forEach(e => { - dr.toolbar_w.bind(e, this.record_event_handle.bind(this, e, record, dr, item)); - }); + header = false; } + var dr = new bricks.DataRow(options); + dr.render(this.editable, this.checkable, header); + dr.event_names.forEach(e => { + dr.toolbar_w.bind(e, this.record_event_handle.bind(this, e, record, dr, item)); + }); item.add_widget(dr); return dr; } diff --git a/docs/cn/widgets/audioplayer.md b/docs/cn/widgets/audioplayer.md new file mode 100644 index 0000000..6ab5e1e --- /dev/null +++ b/docs/cn/widgets/audioplayer.md @@ -0,0 +1,33 @@ +# AudioPlayer +音频播放器 +## 父类 +[JsWidget](jswidget.md) +## 构建参数 +options = { + * url:音频源的url + * autoplay:自动播放,如果是true,音频在导入后自动播放 +} +## 方法 +### set_url(url) +此方法设置新的音频源,如果autoplay为真,新设置的资源会立即播放 + +### toggle_play() +如果当前资源正在播放,则停止播放,否则开始播放 + +### play() +播放资源 + +## 事件 +无 + +## 使用例子 +``` +{ + "id":"audioplayer", + "widgettype":"AudioPlayer", + "options":{ + "autoplay":true, + "url":"http://kimird.com/songs/sample-mp3-file.mp3" + } +} +``` diff --git a/docs/cn/widgets/audiorecorder.md b/docs/cn/widgets/audiorecorder.md new file mode 100644 index 0000000..c472b07 --- /dev/null +++ b/docs/cn/widgets/audiorecorder.md @@ -0,0 +1,56 @@ +# 录制音频 +音频录制器 +## widgettype值 +AudioRecorder + +## 父类 +[bricks.HBox](hbox.md) +## 构建参数 +{ + "upload_url":音频上传url + “icon_rate”:录音按钮比例,设置录音图标显示多少个字符大小。 +} +## 方法 +### start_recording() +### stop_recording() +### async upload() + +## 事件 +### uploaded +上传成功事件,事件参数是fetch返回的response +### record_started +录音开始事件,无参数 +### record_ended +录音结束事件,参数为: + + var d = { + + data:blob, + + url:localURL, + + duration:duration + + } + + +## 使用例子 +``` +{ + "id":"recorder", + "widgettype":"AudioRecorder", + "options":{ + "height":"40px", + "upload_url":"{{entire_url('stt.dspy')}}" + }, + "binds":[ + { + "wid":"self", + "event":"uploaded", + "actiontype":"script", + "script":"alert(event.params)" + } + ] +} +``` + diff --git a/docs/cn/widgets/conform.md b/docs/cn/widgets/conform.md new file mode 100644 index 0000000..0c1edc9 --- /dev/null +++ b/docs/cn/widgets/conform.md @@ -0,0 +1,34 @@ +# 确认控件 +弹出式用户确认控件,显示标题以及消息,并在下方提供确认和放弃两个按钮。点击确认后,关闭窗口,并触发“comformed”事件 + +## widgettype值 +Conform + +## 父类 +[bricks.Message](message.md) + +## 构建参数 +同bircks.Message控件的参数 + +## 方法 +无 +## 事件 +### conformed +用户点击确认按钮触发的事件 +### cancelled +用户点击discard按钮触发的事件 + +## 使用例子 +``` +{ + "id":"uuuu", + "widgettype":"Conform", + "options":{ + "width":"40%", + "height":"40%", + "archor":"cc", + "title":"Test Title", + "message":"This is a test message" + } +} +``` diff --git a/docs/cn/widgets/dynamicaccordion.md b/docs/cn/widgets/dynamicaccordion.md new file mode 100644 index 0000000..a9a82a5 --- /dev/null +++ b/docs/cn/widgets/dynamicaccordion.md @@ -0,0 +1,30 @@ +# Tabular +表格形式的数据展现控件 + +## widgettype值 +Tabular + +## 父类 +bricks.VScrollPanel + +## 构建参数 +* "data_url":数据获取url,用来获取条目数据,返回数据须符合[页数据要求](pagingdata.md) +* "data_method":数据获取的方法缺省是“GET” +* "data_params",获取数据需要带的参数 +* "cache_limit",缓存数据页数 +* "page_rows",每页数据条数 +* "row_cheight":每条目显示按字符大小为单位的高度 +* "row_options":条目数据显示控件的构建参数,参数需要符合要求 +* "content_view": 内容显示的控件描述,当用户点击条目后会在条目后面显示此控件描述生成的控件,在其中可以使用${name}的形式调用后台返回数据当前记录字段数据 +### row_options格式 +* toolbar: 格式要求参看[工具条](toolbar.md) +* fields:数组,数据字段说明,数组中每个数据要素请参看[字段规范](field_spec.md) +* browserfields:条目显示字段约束,是一个字典类型数据 +* editexclouded: 数组编辑是蓄意排除的数据字段名 + +## 方法 +无 +## 事件 +无 +## 使用例子 + diff --git a/docs/cn/widgets/message.md b/docs/cn/widgets/message.md index c94549b..3acfe5b 100644 --- a/docs/cn/widgets/message.md +++ b/docs/cn/widgets/message.md @@ -1,143 +1,34 @@ -# Message +# 消息控件 +一个Modal类型控件,用于显示提示信息 -## 用法 +## widgettype值 +Message -```html - +## 父类 +bricks.Modal - - - +## 构建参数 +* title 在标题栏上显示的内容 - - - - - - -``` - -## 示例 - -![](F:\mh\bricks\docs\images\message.png) - -## 参数说明 - -### widget.type - -控件的类型.(控件有多种类型,如:Form,Image...等等) - -### widget.options参数说明 - -| 参数 | 说明 | 类型 | 是否必填 | 可选值 | 默认值 | -| --------- | -------------------- | ------- | -------- | ---------- | ------ | -| idField | 当前节点的唯一标识 | String | 是 | --- | --- | -| textField | 当前节点的label | String | 是 | --- | --- | -| is_leaf | 是否可以展开 | Boolean | 否 | true/false | --- | -| data | 文件夹具体信息的集合 | Array | 否 | --- | --- | - -#### options.data参数说明 - -options.data参数的key必须和widget.options参数的value一致,比如widget.options.idField="id",那么options.data参数的key就是"options.data.id" .另外多了一个children参数,是对象形式,参数与options.data的参数保持一致. - -注意:**如果想下写一级目录,就添加children参数对象** +* message 在正文栏内显示的正文 +## 方法 +无 ## 事件 +无新增事件 -none +## 例子 +``` +{ + "id":"uuuu", + "widgettype":"Message", + "options":{ + "width":"40%", + "height":"40%", + "archor":"cc", + "title":"Test Title", + "timeout":2, + "message":"This is a test message" + } +} +``` diff --git a/docs/cn/widgets/tmpl.md b/docs/cn/widgets/tmpl.md new file mode 100644 index 0000000..6b87e03 --- /dev/null +++ b/docs/cn/widgets/tmpl.md @@ -0,0 +1,9 @@ +# component name +音频播放器 +## widgettype值 +## 父类 +## 构建参数 +## 方法 +## 事件 +## 使用例子 +