From 450fc2888c226d36a31a69c6c114aa1ef798fc1e Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 18 Mar 2024 15:53:01 +0800 Subject: [PATCH] bugfix --- bricks/conform.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 bricks/conform.js diff --git a/bricks/conform.js b/bricks/conform.js new file mode 100644 index 0000000..cfb8efb --- /dev/null +++ b/bricks/conform.js @@ -0,0 +1,40 @@ +var bricks = window.bricks || {}; +bricks.Conform = class extends bricks.BMessage { + constructor(opts){ + opts.auto_dismiss = false; + super(opts); + this.create_btns(); + } + create_tooolbar(){ + desc = { + tools:[ + bricks.extend({ + "name":"conform", + "icon":bricks_resource('imgs/conform.png'), + "label":'Conform' + }, this.opts.conform||{}), + bricks.extend({ + "name":"cancel", + "icon":bricks_resource('imgs/cancel.png'), + "label":"Discard" + }, this.opts.discard||{}) + ] + } + w = new bricks.IconTextBar(desc); + w.bind('conform', this.conform_hndl.bind(this)); + w.bind('discard', this.discard_hndl.bind(this)); + if (!w) return; + this.message_w.add_widget(w); + } + conform_hndl(event){ + this.dismiss(); + this.dispatch('conform'); + } + discard_hndl(event){ + this.dismiss(); + this.dispatch('discard'); + } +} + +bricks.Factory.register('Conform', bricks.Conform); +