diff --git a/package.json b/package.json index 073158e..cca8867 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iview", - "version": "0.9.10-rc-3", + "version": "0.9.10-rc-4", "title": "iView", "description": "A high quality UI components Library with Vue.js", "homepage": "http://www.iviewui.com", diff --git a/src/components/layout/col.vue b/src/components/layout/col.vue index 6296eab..52d7731 100644 --- a/src/components/layout/col.vue +++ b/src/components/layout/col.vue @@ -15,7 +15,11 @@ offset: [Number, String], push: [Number, String], pull: [Number, String], - className: String + className: String, + xs: [Number, Object], + sm: [Number, Object], + md: [Number, Object], + lg: [Number, Object] }, data () { return { @@ -24,7 +28,7 @@ }, computed: { classes () { - return [ + let classList = [ `${prefixCls}`, { [`${prefixCls}-span-${this.span}`]: this.span, @@ -34,7 +38,24 @@ [`${prefixCls}-pull-${this.pull}`]: this.pull, [`${this.className}`]: !!this.className } - ] + ]; + + ['xs', 'sm', 'md', 'lg'].forEach(size => { + if (typeof this[size] === 'number') { + classList.push(`${prefixCls}-span-${size}-${this[size]}`); + } else if (typeof this[size] === 'object') { + let props = this[size]; + Object.keys(props).forEach(prop => { + classList.push( + prop !== 'span' + ? `${prefixCls}-${size}-${prop}-${props[prop]}` + : `${prefixCls}-span-${size}-${props[prop]}` + ); + }); + } + }); + + return classList; }, styles () { let style = {}; diff --git a/src/styles/common/layout.less b/src/styles/common/layout.less index d9f17ad..b57119a 100644 --- a/src/styles/common/layout.less +++ b/src/styles/common/layout.less @@ -52,3 +52,37 @@ } .make-grid(); + +// Extra small grid +// +// Columns, offsets, pushes, and pulls for extra small devices like +// smartphones. + +.make-grid(-xs); + +// Small grid +// +// Columns, offsets, pushes, and pulls for the small device range, from phones +// to tablets. + +@media (min-width: @screen-sm-min) { + .make-grid(-sm); +} + + +// Medium grid +// +// Columns, offsets, pushes, and pulls for the desktop device range. + +@media (min-width: @screen-md-min) { + .make-grid(-md); +} + + +// Large grid +// +// Columns, offsets, pushes, and pulls for the large desktop device range. + +@media (min-width: @screen-lg-min) { + .make-grid(-lg); +} diff --git a/src/styles/mixins/layout.less b/src/styles/mixins/layout.less index 7744eee..5209007 100644 --- a/src/styles/mixins/layout.less +++ b/src/styles/mixins/layout.less @@ -9,13 +9,13 @@ .clearfix; } -.float-grid-columns() { +.float-grid-columns(@class) { .col(@index) { // initial - @item: ~".@{col-prefix-cls}-span-@{index}"; + @item: ~".@{col-prefix-cls}-span@{class}-@{index}"; .col((@index + 1), @item); } .col(@index, @list) when (@index =< @grid-columns) { // general - @item: ~".@{col-prefix-cls}-span-@{index}"; + @item: ~".@{col-prefix-cls}-span@{class}-@{index}"; .col((@index + 1), ~"@{list}, @{item}"); } .col(@index, @list) when (@index > @grid-columns) { // terminal @@ -27,28 +27,28 @@ .col(1); // kickstart it } -.loop-grid-columns(@index) when (@index > 0) { - .@{col-prefix-cls}-span-@{index} { +.loop-grid-columns(@index, @class) when (@index > 0) { + .@{col-prefix-cls}-span@{class}-@{index} { display: block; width: percentage((@index / @grid-columns)); } - .@{col-prefix-cls}-push-@{index} { + .@{col-prefix-cls}@{class}-push-@{index} { left: percentage((@index / @grid-columns)); } - .@{col-prefix-cls}-pull-@{index} { + .@{col-prefix-cls}@{class}-pull-@{index} { right: percentage((@index / @grid-columns)); } - .@{col-prefix-cls}-offset-@{index} { + .@{col-prefix-cls}@{class}-offset-@{index} { margin-left: percentage((@index / @grid-columns)); } - .@{col-prefix-cls}-order-@{index} { + .@{col-prefix-cls}@{class}-order-@{index} { order: @index; } - .loop-grid-columns((@index - 1)); + .loop-grid-columns((@index - 1), @class); } -.loop-grid-columns(@index) when (@index = 0) { - .@{col-prefix-cls}-@{index} { +.loop-grid-columns(@index, @class) when (@index = 0) { + .@{col-prefix-cls}@{class}-@{index} { display: none; } .@{col-prefix-cls}-push-@{index} { @@ -59,7 +59,7 @@ } } -.make-grid() { - .float-grid-columns(); - .loop-grid-columns(@grid-columns); +.make-grid(@class: ~'') { + .float-grid-columns(@class); + .loop-grid-columns(@grid-columns, @class); } \ No newline at end of file diff --git a/src/styles/themes/default/custom.less b/src/styles/themes/default/custom.less index 40cd11b..5c5cceb 100644 --- a/src/styles/themes/default/custom.less +++ b/src/styles/themes/default/custom.less @@ -112,6 +112,27 @@ // Tag @tag-font-size : 12px; +// Media queries breakpoints +// Extra small screen / phone +@screen-xs : 480px; +@screen-xs-min : @screen-xs; +@screen-xs-max : (@screen-xs-min - 1); + +// Small screen / tablet +@screen-sm : 768px; +@screen-sm-min : @screen-sm; +@screen-sm-max : (@screen-sm-min - 1); + +// Medium screen / desktop +@screen-md : 992px; +@screen-md-min : @screen-md; +@screen-md-max : (@screen-md-min - 1); + +// Large screen / wide desktop +@screen-lg : 1200px; +@screen-lg-min : @screen-lg; +@screen-lg-max : (@screen-lg-min - 1); + // Z-index @zindex-spin : 8; @zindex-affix : 10; diff --git a/test/routers/more.vue b/test/routers/more.vue index f0cf592..5d15e79 100644 --- a/test/routers/more.vue +++ b/test/routers/more.vue @@ -1,133 +1,30 @@ - diff --git a/test/routers/table.vue b/test/routers/table.vue index 09685eb..4030493 100644 --- a/test/routers/table.vue +++ b/test/routers/table.vue @@ -1,157 +1,279 @@ -- libgit2 0.21.4