Skip to content

Commit ac8eb57

Browse files
committed
Implement content alignment
1 parent 8ff5ea4 commit ac8eb57

File tree

6 files changed

+49
-2
lines changed

6 files changed

+49
-2
lines changed

dist/lib/vue-gridlayout.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/lib/vue-gridlayout.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.vue

+13
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@
3939
Centered
4040
</v-grid-item>
4141
</v-grid>
42+
<!-- Align content -->
43+
<v-grid class="grid grid-d"
44+
:template-columns="[{ repeat: { count: 3, value: '100px' } }]"
45+
:template-rows="[{ repeat: { count: 3, value: '100px' } }]"
46+
:template-areas="['a a b', 'a a b', 'c d d']"
47+
gap="10px"
48+
align-content="space-between"
49+
justify-content="space-around">
50+
<v-grid-item area="a"></v-grid-item>
51+
<v-grid-item area="b"></v-grid-item>
52+
<v-grid-item area="c"></v-grid-item>
53+
<v-grid-item area="d"></v-grid-item>
54+
</v-grid>
4255
</div>
4356
</template>
4457

src/components/VGrid/VGrid.js

+15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { isObject } from '../../util';
22
import alignmentItemValues from '../../validation/alignmentItemValues';
3+
import alignmentContentValues from '../../validation/alignmentContentValues';
34

45
const resolveAreas = (input) => {
56
let output;
@@ -60,6 +61,12 @@ const resolveSize = (input, isRepeatable, isNameable) => {
6061
export default {
6162
name: 'v-grid',
6263
props: {
64+
alignContent: {
65+
type: String,
66+
validator(value) {
67+
return alignmentContentValues.indexOf(value) > -1;
68+
},
69+
},
6370
alignItems: {
6471
type: String,
6572
validator(value) {
@@ -78,6 +85,12 @@ export default {
7885
gap: {
7986
type: [String, Array],
8087
},
88+
justifyContent: {
89+
type: String,
90+
validator(value) {
91+
return alignmentContentValues.indexOf(value) > -1;
92+
},
93+
},
8194
justifyItems: {
8295
type: String,
8396
validator(value) {
@@ -130,6 +143,8 @@ export default {
130143
render(h) {
131144
return h('div', {
132145
style: {
146+
alignContent: this.alignContent,
147+
justifyContent: this.justifyContent,
133148
alignItems: this.alignItems,
134149
justifyItems: this.justifyItems,
135150
display: 'grid',

src/styles/app.styl

+6
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,9 @@ html
1212
&-c div
1313
background: yellow
1414
padding: 1em
15+
&-d
16+
height: 500px
17+
width: 500px
18+
div
19+
background: blue
20+
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export default [
2+
'normal',
3+
'start',
4+
'end',
5+
'center',
6+
'stretch',
7+
'space-around',
8+
'space-between',
9+
'space-evenly',
10+
'baseline',
11+
'first baseline',
12+
'last baseline',
13+
];

0 commit comments

Comments
 (0)