diff --git a/Gruntfile.js b/Gruntfile.js index db9878b7e2..c7f4f3e1b7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -74,7 +74,7 @@ module.exports = function (grunt) { }, demoJs: { - src: ['demo/version.js', 'demo/config.js', 'demo/app.js', 'demo/js/**/*.js'], + src: ['demo/version.js', 'demo/app.js', 'demo/js/**/*.js', 'demo/config.js'], dest: 'demo/dist/demo.js' }, demoCss: { diff --git a/demo/config.js b/demo/config.js new file mode 100644 index 0000000000..ad42d66187 --- /dev/null +++ b/demo/config.js @@ -0,0 +1 @@ +Demo.CONFIG = Demo.LAYOUT_CONFIG.concat(Demo.BASE_CONFIG).concat(Demo.CASE_CONFIG).concat(Demo.WIDGET_CONFIG); \ No newline at end of file diff --git a/demo/js/base/demo.button.js b/demo/js/base/demo.button.js new file mode 100644 index 0000000000..f5da8dd510 --- /dev/null +++ b/demo/js/base/demo.button.js @@ -0,0 +1,11 @@ +Demo.Button = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-face" + }, + render: function () { + return { + type: "bi.vertical", + } + } +}); +$.shortcut("demo.button", Demo.Button); \ No newline at end of file diff --git a/demo/js/config/base.js b/demo/js/config/base.js new file mode 100644 index 0000000000..59fe9506d2 --- /dev/null +++ b/demo/js/config/base.js @@ -0,0 +1,8 @@ +Demo.BASE_CONFIG = [{ + id: 2, + text: "基础控件" +}, { + pId: 2, + text: "bi.center_adapt", + value: "demo.center_adapt" +}]; \ No newline at end of file diff --git a/demo/js/config/case.js b/demo/js/config/case.js new file mode 100644 index 0000000000..8d026337e2 --- /dev/null +++ b/demo/js/config/case.js @@ -0,0 +1,8 @@ +Demo.CASE_CONFIG = [{ + id: 3, + text: "基础控件" +}, { + pId: 3, + text: "bi.center_adapt", + value: "demo.center_adapt" +}]; \ No newline at end of file diff --git a/demo/js/config.js b/demo/js/config/layout.js similarity index 88% rename from demo/js/config.js rename to demo/js/config/layout.js index 6ca641c57a..2fb8d3a25e 100644 --- a/demo/js/config.js +++ b/demo/js/config/layout.js @@ -1,18 +1,6 @@ -Demo.CONFIG = [{ +Demo.LAYOUT_CONFIG = [{ id: 1, text: "布局" -}, { - id: 2, - text: "基础控件" -}, { - id: 3, - text: "实例控件" -}, { - id: 4, - text: "详细控件" -}, { - id: 5, - text: "通用组件" }, { pId: 1, text: "bi.center_adapt", diff --git a/demo/js/config/widget.js b/demo/js/config/widget.js new file mode 100644 index 0000000000..4f9e86d2c0 --- /dev/null +++ b/demo/js/config/widget.js @@ -0,0 +1,8 @@ +Demo.WIDGET_CONFIG = [{ + id: 4, + text: "基础控件" +}, { + pId: 4, + text: "bi.center_adapt", + value: "demo.center_adapt" +}]; \ No newline at end of file diff --git a/demo/js/main.js b/demo/js/main.js index 293507c354..a3d121f34c 100644 --- a/demo/js/main.js +++ b/demo/js/main.js @@ -13,8 +13,8 @@ Demo.Main = BI.inherit(BI.Widget, { type: "demo.north", listeners: [{ eventName: Demo.North.EVENT_VALUE_CHANGE, - action: function () { - center.setValue(0); + action: function (v) { + center.setValue(v); } }] } diff --git a/demo/js/north.js b/demo/js/north.js index 89b07f7d8d..45e89cac69 100644 --- a/demo/js/north.js +++ b/demo/js/north.js @@ -13,7 +13,7 @@ Demo.North = BI.inherit(BI.Widget, { listeners: [{ eventName: BI.Button.EVENT_CHANGE, action: function () { - self.fireEvent(Demo.North.EVENT_VALUE_CHANGE, 0) + self.fireEvent(Demo.North.EVENT_VALUE_CHANGE, "demo.face") } }], cls: "logo", diff --git a/dist/base.js b/dist/base.js index 0cb0dd97ee..f869ce10be 100644 --- a/dist/base.js +++ b/dist/base.js @@ -21163,13 +21163,8 @@ BI.BasicButton = BI.inherit(BI.Single, { } }, - empty: function () { + destroyed: function () { $(document).unbind("mouseup." + this.getName()); - BI.BasicButton.superclass.empty.apply(this, arguments); - }, - - destroy: function () { - BI.BasicButton.superclass.destroy.apply(this, arguments); } }); BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE";/** diff --git a/dist/core.js b/dist/core.js index 386c8eeb12..b4e0b28440 100644 --- a/dist/core.js +++ b/dist/core.js @@ -14244,11 +14244,15 @@ BI.Widget = BI.inherit(BI.OB, { if (o.invisible) { this.element.hide(); } - if (o.disabled) { - this.element.addClass("base-disabled disabled"); - } - if (o.invalid) { - this.element.addClass("base-invalid invalid"); + if (o.disabled || o.invalid) { + BI.nextTick(BI.bind(function () { + if (this.options.disabled) { + this.setEnable(false); + } + if (this.options.invalid) { + this.setValid(false); + } + }, this)); } }, @@ -22746,7 +22750,7 @@ Date._DN = [BI.i18nText("BI-Sunday"), BI.i18nText("BI-Sunday")]; // short day names -Date._SDN = ['日', +Date._SDN = ['', '', '', '', diff --git a/src/base/single/button/button.basic.js b/src/base/single/button/button.basic.js index 5a1b20dd8f..1b62145361 100644 --- a/src/base/single/button/button.basic.js +++ b/src/base/single/button/button.basic.js @@ -284,13 +284,8 @@ BI.BasicButton = BI.inherit(BI.Single, { } }, - empty: function () { + destroyed: function () { $(document).unbind("mouseup." + this.getName()); - BI.BasicButton.superclass.empty.apply(this, arguments); - }, - - destroy: function () { - BI.BasicButton.superclass.destroy.apply(this, arguments); } }); BI.BasicButton.EVENT_CHANGE = "BasicButton.EVENT_CHANGE"; \ No newline at end of file diff --git a/src/core/proto/date.js b/src/core/proto/date.js index b1ed78c2e2..636fafdc70 100644 --- a/src/core/proto/date.js +++ b/src/core/proto/date.js @@ -9,7 +9,7 @@ Date._DN = [BI.i18nText("BI-Sunday"), BI.i18nText("BI-Sunday")]; // short day names -Date._SDN = ['日', +Date._SDN = ['', '', '', '', diff --git a/src/core/widget.js b/src/core/widget.js index 1326dee575..541c986998 100644 --- a/src/core/widget.js +++ b/src/core/widget.js @@ -106,11 +106,15 @@ BI.Widget = BI.inherit(BI.OB, { if (o.invisible) { this.element.hide(); } - if (o.disabled) { - this.element.addClass("base-disabled disabled"); - } - if (o.invalid) { - this.element.addClass("base-invalid invalid"); + if (o.disabled || o.invalid) { + BI.nextTick(BI.bind(function () { + if (this.options.disabled) { + this.setEnable(false); + } + if (this.options.invalid) { + this.setValid(false); + } + }, this)); } },