From e32469ad0a3e25ba6d726a3929093c038248b5a7 Mon Sep 17 00:00:00 2001 From: guy Date: Sun, 23 Oct 2022 13:38:16 +0800 Subject: [PATCH 1/4] ThemeProvider --- examples/ThemeProvider.html | 99 +++++++++++++++++++++++++++++++++++++ src/base/context.js | 12 +++-- 2 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 examples/ThemeProvider.html diff --git a/examples/ThemeProvider.html b/examples/ThemeProvider.html new file mode 100644 index 000000000..7848ee406 --- /dev/null +++ b/examples/ThemeProvider.html @@ -0,0 +1,99 @@ + + + + + + + + + + +
+ + + diff --git a/src/base/context.js b/src/base/context.js index 67ef704c0..f799812c8 100644 --- a/src/base/context.js +++ b/src/base/context.js @@ -15,7 +15,10 @@ BI.Context = BI.inherit(BI.Widget, { render: function () { var self = this, o = this.options; - this.context = BI.createWidget(o.items[0] || o.el, { + if (o.context) { + this.$context = BI.useContext(o.context); + } + this.context = BI.createWidget((o.items[0] || o.el)(this.$context), { element: this, }); this.context.on(BI.Controller.EVENT_CHANGE, function () { @@ -23,11 +26,10 @@ BI.Context = BI.inherit(BI.Widget, { }); }, - created: function () { + __initWatch: function () { + BI.Context.superclass.__initWatch.call(this); var o = this.options; - if (o.context) { - BI.watch(o.context, o.watch); - } + BI.watch(this.$context, o.context, o.watch); }, setValue: function (v) { From f8f0c194b6899b1dac8e956a32e99cc40301413e Mon Sep 17 00:00:00 2001 From: guy Date: Sun, 23 Oct 2022 13:54:39 +0800 Subject: [PATCH 2/4] update --- src/base/context.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/base/context.js b/src/base/context.js index f799812c8..47fdd6c64 100644 --- a/src/base/context.js +++ b/src/base/context.js @@ -16,12 +16,12 @@ BI.Context = BI.inherit(BI.Widget, { render: function () { var self = this, o = this.options; if (o.context) { - this.$context = BI.useContext(o.context); + this.context = BI.useContext(o.context); } - this.context = BI.createWidget((o.items[0] || o.el)(this.$context), { + this.widget = BI.createWidget((o.items[0] || o.el)(this.context), { element: this, }); - this.context.on(BI.Controller.EVENT_CHANGE, function () { + this.widget.on(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); }); }, @@ -29,19 +29,19 @@ BI.Context = BI.inherit(BI.Widget, { __initWatch: function () { BI.Context.superclass.__initWatch.call(this); var o = this.options; - BI.watch(this.$context, o.context, o.watch); + BI.watch(this.context, o.context, o.watch); }, setValue: function (v) { - this.context.setValue(v); + this.widget.setValue(v); }, getValue: function () { - return this.context.getValue(); + return this.widget.getValue(); }, populate: function () { - this.context.populate.apply(this, arguments); + this.widget.populate.apply(this, arguments); }, }); BI.shortcut("bi.context", BI.Context); From 01b22956bbc86a992696c5bd793a77af2e0fc229 Mon Sep 17 00:00:00 2001 From: data Date: Mon, 24 Oct 2022 10:14:01 +0800 Subject: [PATCH 3/4] auto upgrade version to 2.0.20221024101340 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ad3c79333..4f9c42e73 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221023144426", + "version": "2.0.20221024101340", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts", From fe8256f5446f5f84ea6d12b7d95bf557cb84833e Mon Sep 17 00:00:00 2001 From: data Date: Mon, 24 Oct 2022 10:54:36 +0800 Subject: [PATCH 4/4] auto upgrade version to 2.0.20221024105424 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4f9c42e73..31e494e29 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fineui", - "version": "2.0.20221024101340", + "version": "2.0.20221024105424", "description": "fineui", "main": "dist/fineui_without_conflict.min.js", "types": "dist/lib/index.d.ts",