From 274aef46136354ec7c081876f53754c860505544 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 20 Mar 2017 18:37:40 +0800 Subject: [PATCH] init --- Gruntfile.js | 23 +++++++++++++++--- demo.css | 24 +++++++++++++++++++ demo.js | 56 +++++++++++++++++++++++++++++++++++-------- demo/css/center.css | 0 demo/css/north.css | 3 +++ demo/css/west.css | 3 +++ demo/js/center.js | 9 +++++++ demo/js/main.js | 28 +++++++++++++++------- demo/js/north.js | 9 +++++++ demo/js/west.js | 9 +++++++ demo/less/center.less | 3 +++ demo/less/north.less | 3 +++ demo/less/west.less | 3 +++ package.json | 1 + 14 files changed, 153 insertions(+), 21 deletions(-) create mode 100644 demo/css/center.css create mode 100644 demo/css/north.css create mode 100644 demo/css/west.css create mode 100644 demo/js/center.js create mode 100644 demo/js/north.js create mode 100644 demo/js/west.js create mode 100644 demo/less/center.less create mode 100644 demo/less/north.less create mode 100644 demo/less/west.less diff --git a/Gruntfile.js b/Gruntfile.js index 633cf6ad4..88839a612 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -70,6 +70,22 @@ module.exports = function (grunt) { } }, + less: { + main: { + expand: true, + cwd: 'demo/less', + src: ['**/*.less'], + dest: 'demo/css/', + ext: '.css' + }, + dev: { + options: { + compress: true, + yuicompress: false + } + } + }, + uglify: { options: { banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n' @@ -115,8 +131,8 @@ module.exports = function (grunt) { }, watch: { scripts: { - files: ['src/**/*.js', 'demo/**/*.js'], - tasks: ['concat'], + files: ['src/**/*.js', 'demo/**/*.js', 'demo/**/*.less'], + tasks: ['less', 'concat'], options: { spanw: true, interrupt: true @@ -127,9 +143,10 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-cssmin'); - grunt.registerTask('default', ['concat', 'watch']); + grunt.registerTask('default', ['less', 'concat', 'watch']); }; \ No newline at end of file diff --git a/demo.css b/demo.css index beaf06ad6..b601e3e33 100644 --- a/demo.css +++ b/demo.css @@ -1,3 +1,27 @@ .demo-main .bg1 { background-color: #178cdf; } +.demo-north { + background-color: #3c8dbc; +} +.demo-west { + background-color: #222d32; +} +.demo-main .bg1 { + background-color: #178cdf; +} +.demo-north { + background-color: #3c8dbc; +} +.demo-west { + background-color: #222d32; +} +.demo-main .bg1 { + background-color: #178cdf; +} +.demo-north { + background-color: #3c8dbc; +} +.demo-west { + background-color: #222d32; +} diff --git a/demo.js b/demo.js index ad2f0cf34..6b26e7b8f 100644 --- a/demo.js +++ b/demo.js @@ -11,21 +11,57 @@ Demo = { element: '#wrapper' }); // ref.destroy(); -});Demo.Main = BI.inherit(BI.Widget, { +});Demo.Center = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-center" + }, + render: function () { + + } +}); +$.shortcut("demo.center", Demo.Center);Demo.Main = BI.inherit(BI.Widget, { props: { baseCls: "demo-main" }, render: function () { return { - type: "bi.button_group", - layouts: [{ - type: "bi.vertical" - }], - items: [{ - type: "bi.button", - text: 1 - }] + type: "bi.border", + items: { + north: { + height: 50, + el: { + type: "demo.north" + } + }, + west: { + width: 230, + el: { + type: "demo.west" + } + }, + center: { + el: { + type: "demo.center", + } + } + } } } }); -$.shortcut("demo.main", Demo.Main); \ No newline at end of file +$.shortcut("demo.main", Demo.Main);Demo.North = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-north" + }, + render: function () { + + } +}); +$.shortcut("demo.north", Demo.North);Demo.West = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-west" + }, + render: function () { + + } +}); +$.shortcut("demo.west", Demo.West); \ No newline at end of file diff --git a/demo/css/center.css b/demo/css/center.css new file mode 100644 index 000000000..e69de29bb diff --git a/demo/css/north.css b/demo/css/north.css new file mode 100644 index 000000000..eeb774681 --- /dev/null +++ b/demo/css/north.css @@ -0,0 +1,3 @@ +.demo-north { + background-color: #3c8dbc; +} diff --git a/demo/css/west.css b/demo/css/west.css new file mode 100644 index 000000000..4601cc494 --- /dev/null +++ b/demo/css/west.css @@ -0,0 +1,3 @@ +.demo-west { + background-color: #222d32; +} diff --git a/demo/js/center.js b/demo/js/center.js new file mode 100644 index 000000000..6a71ea741 --- /dev/null +++ b/demo/js/center.js @@ -0,0 +1,9 @@ +Demo.Center = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-center" + }, + render: function () { + + } +}); +$.shortcut("demo.center", Demo.Center); \ No newline at end of file diff --git a/demo/js/main.js b/demo/js/main.js index 12b2a50b6..da1c12221 100644 --- a/demo/js/main.js +++ b/demo/js/main.js @@ -4,14 +4,26 @@ Demo.Main = BI.inherit(BI.Widget, { }, render: function () { return { - type: "bi.button_group", - layouts: [{ - type: "bi.vertical" - }], - items: [{ - type: "bi.button", - text: 1 - }] + type: "bi.border", + items: { + north: { + height: 50, + el: { + type: "demo.north" + } + }, + west: { + width: 230, + el: { + type: "demo.west" + } + }, + center: { + el: { + type: "demo.center", + } + } + } } } }); diff --git a/demo/js/north.js b/demo/js/north.js new file mode 100644 index 000000000..d341767e6 --- /dev/null +++ b/demo/js/north.js @@ -0,0 +1,9 @@ +Demo.North = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-north" + }, + render: function () { + + } +}); +$.shortcut("demo.north", Demo.North); \ No newline at end of file diff --git a/demo/js/west.js b/demo/js/west.js new file mode 100644 index 000000000..aaa8740d0 --- /dev/null +++ b/demo/js/west.js @@ -0,0 +1,9 @@ +Demo.West = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-west" + }, + render: function () { + + } +}); +$.shortcut("demo.west", Demo.West); \ No newline at end of file diff --git a/demo/less/center.less b/demo/less/center.less new file mode 100644 index 000000000..b15dc85a3 --- /dev/null +++ b/demo/less/center.less @@ -0,0 +1,3 @@ +.demo-center { + +} \ No newline at end of file diff --git a/demo/less/north.less b/demo/less/north.less new file mode 100644 index 000000000..e07dfda88 --- /dev/null +++ b/demo/less/north.less @@ -0,0 +1,3 @@ +.demo-north{ + background-color: #3c8dbc; +} \ No newline at end of file diff --git a/demo/less/west.less b/demo/less/west.less new file mode 100644 index 000000000..c3aabe177 --- /dev/null +++ b/demo/less/west.less @@ -0,0 +1,3 @@ +.demo-west { + background-color: #222d32; +} \ No newline at end of file diff --git a/package.json b/package.json index 04d5cb78e..e0fa4ab68 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "grunt-contrib-concat": "^1.0.1", "grunt-contrib-cssmin": "^1.0.1", "grunt-contrib-jshint": "^1.0.0", + "grunt-contrib-less": "^1.4.1", "grunt-contrib-uglify": "^1.0.1", "grunt-contrib-watch": "^1.0.0", "open": "0.0.5"