goodteditor-ui 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +7 -7
- package/.prettierrc +14 -14
- package/README.md +35 -35
- package/babel.config.js +5 -5
- package/dist/js.png +0 -0
- package/index.js +51 -51
- package/jsconfig.json +13 -13
- package/package.json +57 -57
- package/src/App.vue +36 -36
- package/src/components/ui/Avatar.md +68 -68
- package/src/components/ui/Avatar.vue +177 -177
- package/src/components/ui/Badge.md +20 -20
- package/src/components/ui/Badge.vue +75 -75
- package/src/components/ui/Collapse.md +90 -90
- package/src/components/ui/Collapse.vue +86 -86
- package/src/components/ui/ColorPicker/Alpha.vue +114 -114
- package/src/components/ui/ColorPicker/Colors.vue +117 -117
- package/src/components/ui/ColorPicker/Hue.vue +113 -113
- package/src/components/ui/ColorPicker/Preview.vue +55 -55
- package/src/components/ui/ColorPicker/Saturation.vue +123 -123
- package/src/components/ui/ColorPicker/mixin.js +105 -105
- package/src/components/ui/ColorPicker.md +17 -17
- package/src/components/ui/ColorPicker.vue +314 -314
- package/src/components/ui/Datalist.md +41 -41
- package/src/components/ui/Datalist.vue +157 -157
- package/src/components/ui/DatePicker.md +168 -168
- package/src/components/ui/DatePicker.vue +527 -527
- package/src/components/ui/FileSelector.md +105 -105
- package/src/components/ui/FileSelector.vue +82 -82
- package/src/components/ui/Grid.md +130 -130
- package/src/components/ui/Grid.vue +92 -92
- package/src/components/ui/Image.md +59 -59
- package/src/components/ui/Image.vue +57 -57
- package/src/components/ui/InputAutocomplete.md +115 -115
- package/src/components/ui/InputAutocomplete.vue +341 -341
- package/src/components/ui/InputColorPicker.md +51 -51
- package/src/components/ui/InputColorPicker.vue +151 -151
- package/src/components/ui/InputDatePicker.md +121 -121
- package/src/components/ui/InputDatePicker.vue +310 -310
- package/src/components/ui/InputTags.md +51 -51
- package/src/components/ui/InputTags.vue +184 -184
- package/src/components/ui/InputTimePicker.md +25 -25
- package/src/components/ui/InputTimePicker.vue +253 -253
- package/src/components/ui/InputUnits.md +20 -20
- package/src/components/ui/InputUnits.vue +257 -257
- package/src/components/ui/Lazy.md +37 -37
- package/src/components/ui/Lazy.vue +92 -92
- package/src/components/ui/Pagination.md +74 -74
- package/src/components/ui/Pagination.vue +138 -138
- package/src/components/ui/Paginator.md +34 -34
- package/src/components/ui/Paginator.vue +83 -83
- package/src/components/ui/Popover.md +34 -34
- package/src/components/ui/Popover.vue +258 -209
- package/src/components/ui/Popup.md +59 -59
- package/src/components/ui/Popup.vue +150 -150
- package/src/components/ui/ResponsiveContainer.md +58 -58
- package/src/components/ui/ResponsiveContainer.vue +99 -99
- package/src/components/ui/Select.md +187 -187
- package/src/components/ui/Select.vue +420 -420
- package/src/components/ui/TimePicker.md +50 -50
- package/src/components/ui/TimePicker.vue +252 -252
- package/src/components/ui/Tooltip.md +114 -52
- package/src/components/ui/Tooltip.vue +113 -113
- package/src/components/ui/utils/FormComponent.js +107 -107
- package/src/components/ui/utils/Helpers.js +84 -61
- package/src/components/ui/utils/WithPopover.js +99 -81
- package/src/main.js +8 -8
- package/styleguide.config.js +37 -37
- package/vue.config.js +8 -8
- package/.idea/codeStyles/Project.xml +0 -51
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/goodt-ui.iml +0 -12
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/vcs.xml +0 -6
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
```vue
|
|
2
|
-
<template>
|
|
3
|
-
<div class="pad-l5">
|
|
4
|
-
<ui-file-selector v-bind="props" @change="onFileSelect">
|
|
5
|
-
<div class="btn btn-primary btn-small">select file</div>
|
|
6
|
-
</ui-file-selector>
|
|
7
|
-
<pre>{{ files }}</pre>
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
<script>
|
|
11
|
-
import UiFileSelector from './FileSelector.vue';
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
components: { UiFileSelector },
|
|
15
|
-
data() {
|
|
16
|
-
return {
|
|
17
|
-
files: [],
|
|
18
|
-
props: {
|
|
19
|
-
multiple: false,
|
|
20
|
-
accept: '',
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
},
|
|
24
|
-
methods: {
|
|
25
|
-
onFileSelect(files) {
|
|
26
|
-
this.files = files.map(({ name, type, size }) => ({ name, type, size }));
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
</script>
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Advanced demo: multiple image selection with preview
|
|
34
|
-
|
|
35
|
-
```vue
|
|
36
|
-
<template>
|
|
37
|
-
<div class="pad-l5">
|
|
38
|
-
<div class="d-flex block">
|
|
39
|
-
<ui-file-selector ref="file-selector" v-bind="props" @change="onFileSelect">
|
|
40
|
-
<div class="btn btn-primary btn-small">
|
|
41
|
-
<template v-if="files.length">images selected: ({{ files.length }})</template>
|
|
42
|
-
<template v-else>select images</template>
|
|
43
|
-
</div>
|
|
44
|
-
</ui-file-selector>
|
|
45
|
-
<div class="btn btn-outline btn-small mar-h-3" v-if="files.length" @click="resetFiles">
|
|
46
|
-
reset
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
<table class="table table-vmid w-6-12">
|
|
50
|
-
<tr v-for="meta in filesMeta" :key="meta.name">
|
|
51
|
-
<td class="table-w-auto">
|
|
52
|
-
<ui-image :src="meta.preview" style="display:block; width:2rem">
|
|
53
|
-
<div><i class="preloader"></i></div>
|
|
54
|
-
</ui-image>
|
|
55
|
-
</td>
|
|
56
|
-
<td>{{ meta.name }}</td>
|
|
57
|
-
<td>
|
|
58
|
-
<small>({{ meta.size }}kb)</small>
|
|
59
|
-
</td>
|
|
60
|
-
</tr>
|
|
61
|
-
</table>
|
|
62
|
-
</div>
|
|
63
|
-
</template>
|
|
64
|
-
<script>
|
|
65
|
-
import UiFileSelector from './FileSelector.vue';
|
|
66
|
-
import UiImage from './Image.vue';
|
|
67
|
-
|
|
68
|
-
// b -> kb util
|
|
69
|
-
const toKb = n => Math.round((n / 1024) * 10) / 10;
|
|
70
|
-
|
|
71
|
-
export default {
|
|
72
|
-
components: { UiFileSelector, UiImage },
|
|
73
|
-
data() {
|
|
74
|
-
return {
|
|
75
|
-
files: [],
|
|
76
|
-
props: {
|
|
77
|
-
multiple: true,
|
|
78
|
-
accept: 'image/png,image/jpeg,image/gif',
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
},
|
|
82
|
-
computed: {
|
|
83
|
-
filesMeta() {
|
|
84
|
-
return this.files.map(file => {
|
|
85
|
-
const { name, type, size } = file;
|
|
86
|
-
return {
|
|
87
|
-
name,
|
|
88
|
-
type,
|
|
89
|
-
size: toKb(size),
|
|
90
|
-
preview: file,
|
|
91
|
-
};
|
|
92
|
-
});
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
methods: {
|
|
96
|
-
resetFiles() {
|
|
97
|
-
this.files = [];
|
|
98
|
-
},
|
|
99
|
-
onFileSelect(files) {
|
|
100
|
-
this.files = files;
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
};
|
|
104
|
-
</script>
|
|
105
|
-
```
|
|
1
|
+
```vue
|
|
2
|
+
<template>
|
|
3
|
+
<div class="pad-l5">
|
|
4
|
+
<ui-file-selector v-bind="props" @change="onFileSelect">
|
|
5
|
+
<div class="btn btn-primary btn-small">select file</div>
|
|
6
|
+
</ui-file-selector>
|
|
7
|
+
<pre>{{ files }}</pre>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
<script>
|
|
11
|
+
import UiFileSelector from './FileSelector.vue';
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
components: { UiFileSelector },
|
|
15
|
+
data() {
|
|
16
|
+
return {
|
|
17
|
+
files: [],
|
|
18
|
+
props: {
|
|
19
|
+
multiple: false,
|
|
20
|
+
accept: '',
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
methods: {
|
|
25
|
+
onFileSelect(files) {
|
|
26
|
+
this.files = files.map(({ name, type, size }) => ({ name, type, size }));
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
</script>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Advanced demo: multiple image selection with preview
|
|
34
|
+
|
|
35
|
+
```vue
|
|
36
|
+
<template>
|
|
37
|
+
<div class="pad-l5">
|
|
38
|
+
<div class="d-flex block">
|
|
39
|
+
<ui-file-selector ref="file-selector" v-bind="props" @change="onFileSelect">
|
|
40
|
+
<div class="btn btn-primary btn-small">
|
|
41
|
+
<template v-if="files.length">images selected: ({{ files.length }})</template>
|
|
42
|
+
<template v-else>select images</template>
|
|
43
|
+
</div>
|
|
44
|
+
</ui-file-selector>
|
|
45
|
+
<div class="btn btn-outline btn-small mar-h-3" v-if="files.length" @click="resetFiles">
|
|
46
|
+
reset
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
<table class="table table-vmid w-6-12">
|
|
50
|
+
<tr v-for="meta in filesMeta" :key="meta.name">
|
|
51
|
+
<td class="table-w-auto">
|
|
52
|
+
<ui-image :src="meta.preview" style="display:block; width:2rem">
|
|
53
|
+
<div><i class="preloader"></i></div>
|
|
54
|
+
</ui-image>
|
|
55
|
+
</td>
|
|
56
|
+
<td>{{ meta.name }}</td>
|
|
57
|
+
<td>
|
|
58
|
+
<small>({{ meta.size }}kb)</small>
|
|
59
|
+
</td>
|
|
60
|
+
</tr>
|
|
61
|
+
</table>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
64
|
+
<script>
|
|
65
|
+
import UiFileSelector from './FileSelector.vue';
|
|
66
|
+
import UiImage from './Image.vue';
|
|
67
|
+
|
|
68
|
+
// b -> kb util
|
|
69
|
+
const toKb = n => Math.round((n / 1024) * 10) / 10;
|
|
70
|
+
|
|
71
|
+
export default {
|
|
72
|
+
components: { UiFileSelector, UiImage },
|
|
73
|
+
data() {
|
|
74
|
+
return {
|
|
75
|
+
files: [],
|
|
76
|
+
props: {
|
|
77
|
+
multiple: true,
|
|
78
|
+
accept: 'image/png,image/jpeg,image/gif',
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
computed: {
|
|
83
|
+
filesMeta() {
|
|
84
|
+
return this.files.map(file => {
|
|
85
|
+
const { name, type, size } = file;
|
|
86
|
+
return {
|
|
87
|
+
name,
|
|
88
|
+
type,
|
|
89
|
+
size: toKb(size),
|
|
90
|
+
preview: file,
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
methods: {
|
|
96
|
+
resetFiles() {
|
|
97
|
+
this.files = [];
|
|
98
|
+
},
|
|
99
|
+
onFileSelect(files) {
|
|
100
|
+
this.files = files;
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
</script>
|
|
105
|
+
```
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ui-file-selector">
|
|
3
|
-
<!--
|
|
4
|
-
@slot default slot
|
|
5
|
-
@binding {File[]} files selected files
|
|
6
|
-
-->
|
|
7
|
-
<slot v-bind="{ files }">select files</slot>
|
|
8
|
-
<input
|
|
9
|
-
class="ui-file-selector-input pos-abs pos-top-left w-100 h-100"
|
|
10
|
-
type="file"
|
|
11
|
-
v-bind="{ accept, multiple }"
|
|
12
|
-
@change="onFilesChanged"
|
|
13
|
-
/>
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|
|
16
|
-
<style lang="less" scoped>
|
|
17
|
-
.ui-file-selector {
|
|
18
|
-
position: relative;
|
|
19
|
-
display: inline-flex;
|
|
20
|
-
align-items: center;
|
|
21
|
-
&-input {
|
|
22
|
-
cursor: pointer;
|
|
23
|
-
overflow: hidden;
|
|
24
|
-
opacity: 0;
|
|
25
|
-
&::file-selector-button {
|
|
26
|
-
width: 100%;
|
|
27
|
-
height: 100%;
|
|
28
|
-
visibility: hidden;
|
|
29
|
-
}
|
|
30
|
-
&::file-selector-label {
|
|
31
|
-
display: none;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
</style>
|
|
36
|
-
<script>
|
|
37
|
-
export default {
|
|
38
|
-
props: {
|
|
39
|
-
/**
|
|
40
|
-
* html5 accept attr (a comma-separated list of one or more file types, or unique file type specifiers, describing which file types to allow.)
|
|
41
|
-
*/
|
|
42
|
-
accept: {
|
|
43
|
-
type: String,
|
|
44
|
-
default: '',
|
|
45
|
-
},
|
|
46
|
-
/**
|
|
47
|
-
* html5 miltiple attr (single/multiple file selection)
|
|
48
|
-
*/
|
|
49
|
-
multiple: {
|
|
50
|
-
type: Boolean,
|
|
51
|
-
default: false,
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
data() {
|
|
55
|
-
return {
|
|
56
|
-
files: [],
|
|
57
|
-
};
|
|
58
|
-
},
|
|
59
|
-
methods: {
|
|
60
|
-
/**
|
|
61
|
-
* @public
|
|
62
|
-
* Resets selected files (emits 'change' event)
|
|
63
|
-
*/
|
|
64
|
-
reset() {
|
|
65
|
-
this.files = [];
|
|
66
|
-
this.emitChange();
|
|
67
|
-
},
|
|
68
|
-
emitChange() {
|
|
69
|
-
/**
|
|
70
|
-
* Files change event (dispatched whenever files change)
|
|
71
|
-
* @property {File[]} files
|
|
72
|
-
*/
|
|
73
|
-
this.$emit('change', this.files);
|
|
74
|
-
},
|
|
75
|
-
onFilesChanged(e) {
|
|
76
|
-
const files = [...e.target.files];
|
|
77
|
-
this.files = files;
|
|
78
|
-
this.emitChange();
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ui-file-selector">
|
|
3
|
+
<!--
|
|
4
|
+
@slot default slot
|
|
5
|
+
@binding {File[]} files selected files
|
|
6
|
+
-->
|
|
7
|
+
<slot v-bind="{ files }">select files</slot>
|
|
8
|
+
<input
|
|
9
|
+
class="ui-file-selector-input pos-abs pos-top-left w-100 h-100"
|
|
10
|
+
type="file"
|
|
11
|
+
v-bind="{ accept, multiple }"
|
|
12
|
+
@change="onFilesChanged"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
<style lang="less" scoped>
|
|
17
|
+
.ui-file-selector {
|
|
18
|
+
position: relative;
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
&-input {
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
opacity: 0;
|
|
25
|
+
&::file-selector-button {
|
|
26
|
+
width: 100%;
|
|
27
|
+
height: 100%;
|
|
28
|
+
visibility: hidden;
|
|
29
|
+
}
|
|
30
|
+
&::file-selector-label {
|
|
31
|
+
display: none;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</style>
|
|
36
|
+
<script>
|
|
37
|
+
export default {
|
|
38
|
+
props: {
|
|
39
|
+
/**
|
|
40
|
+
* html5 accept attr (a comma-separated list of one or more file types, or unique file type specifiers, describing which file types to allow.)
|
|
41
|
+
*/
|
|
42
|
+
accept: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: '',
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* html5 miltiple attr (single/multiple file selection)
|
|
48
|
+
*/
|
|
49
|
+
multiple: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
data() {
|
|
55
|
+
return {
|
|
56
|
+
files: [],
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
methods: {
|
|
60
|
+
/**
|
|
61
|
+
* @public
|
|
62
|
+
* Resets selected files (emits 'change' event)
|
|
63
|
+
*/
|
|
64
|
+
reset() {
|
|
65
|
+
this.files = [];
|
|
66
|
+
this.emitChange();
|
|
67
|
+
},
|
|
68
|
+
emitChange() {
|
|
69
|
+
/**
|
|
70
|
+
* Files change event (dispatched whenever files change)
|
|
71
|
+
* @property {File[]} files
|
|
72
|
+
*/
|
|
73
|
+
this.$emit('change', this.files);
|
|
74
|
+
},
|
|
75
|
+
onFilesChanged(e) {
|
|
76
|
+
const files = [...e.target.files];
|
|
77
|
+
this.files = files;
|
|
78
|
+
this.emitChange();
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
</script>
|
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
```vue
|
|
2
|
-
<template>
|
|
3
|
-
<div class="pad-l5">
|
|
4
|
-
<div class="tile">
|
|
5
|
-
<ui-grid class="tile-body" v-bind="props">
|
|
6
|
-
<template #avatar="{ style }">
|
|
7
|
-
<img
|
|
8
|
-
class="avatar avatar-3 round"
|
|
9
|
-
src="https://picsum.photos/150/150"
|
|
10
|
-
:style="style"
|
|
11
|
-
/>
|
|
12
|
-
</template>
|
|
13
|
-
<template #info="{ style }">
|
|
14
|
-
<div :style="style">
|
|
15
|
-
<div class="text-bold">John Wick</div>
|
|
16
|
-
<div class="text-xsmall">john.wick@site.com</div>
|
|
17
|
-
</div>
|
|
18
|
-
</template>
|
|
19
|
-
<template #status="{ style }">
|
|
20
|
-
<div class="text-xsmall color-green" :style="style">online</div>
|
|
21
|
-
</template>
|
|
22
|
-
</ui-grid>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</template>
|
|
26
|
-
<script>
|
|
27
|
-
import UiGrid from './Grid.vue';
|
|
28
|
-
|
|
29
|
-
export default {
|
|
30
|
-
components: { UiGrid },
|
|
31
|
-
data() {
|
|
32
|
-
return {
|
|
33
|
-
props: {
|
|
34
|
-
areas: [['avatar', 'info', 'status']],
|
|
35
|
-
cols: ['auto', '1fr', 'auto'],
|
|
36
|
-
rows: ['1fr'],
|
|
37
|
-
gap: ['1rem'],
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
</script>
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Using wrapper element
|
|
46
|
-
|
|
47
|
-
```vue
|
|
48
|
-
<template>
|
|
49
|
-
<div class="pad-l5">
|
|
50
|
-
<div class="tile">
|
|
51
|
-
<ui-grid class="tile-body" v-bind="props">
|
|
52
|
-
<template #avatar>
|
|
53
|
-
<img class="avatar avatar-3 round" src="https://picsum.photos/150/150" />
|
|
54
|
-
</template>
|
|
55
|
-
<template #info>
|
|
56
|
-
<div class="text-bold">John Wick</div>
|
|
57
|
-
<div class="text-xsmall">john.wick@site.com</div>
|
|
58
|
-
</template>
|
|
59
|
-
<template #status>
|
|
60
|
-
<div class="text-xsmall color-green">online</div>
|
|
61
|
-
</template>
|
|
62
|
-
</ui-grid>
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
</template>
|
|
66
|
-
<script>
|
|
67
|
-
import UiGrid from './Grid.vue';
|
|
68
|
-
|
|
69
|
-
export default {
|
|
70
|
-
components: { UiGrid },
|
|
71
|
-
data() {
|
|
72
|
-
return {
|
|
73
|
-
props: {
|
|
74
|
-
areas: [['avatar', 'info', 'status']],
|
|
75
|
-
cols: ['auto', '1fr', 'auto'],
|
|
76
|
-
rows: ['1fr'],
|
|
77
|
-
gap: ['1rem'],
|
|
78
|
-
wrapTag: 'div',
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
</script>
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
```vue
|
|
87
|
-
<template>
|
|
88
|
-
<div class="pad-l5">
|
|
89
|
-
<ui-grid v-bind="props">
|
|
90
|
-
<template v-for="name in areaNames" v-slot:[name]="{ style }">
|
|
91
|
-
<div class="box" :style="style">
|
|
92
|
-
<code>{{ name }}</code>
|
|
93
|
-
</div>
|
|
94
|
-
</template>
|
|
95
|
-
</ui-grid>
|
|
96
|
-
</div>
|
|
97
|
-
</template>
|
|
98
|
-
<script>
|
|
99
|
-
import UiGrid from './Grid.vue';
|
|
100
|
-
|
|
101
|
-
export default {
|
|
102
|
-
components: { UiGrid },
|
|
103
|
-
data() {
|
|
104
|
-
return {
|
|
105
|
-
props: {
|
|
106
|
-
areas: [
|
|
107
|
-
['area1', 'area3', 'area5'],
|
|
108
|
-
['area1', 'area4', 'area5'],
|
|
109
|
-
['area1', 'area2', 'area2'],
|
|
110
|
-
],
|
|
111
|
-
cols: ['auto', '1fr', 'auto'],
|
|
112
|
-
rows: ['1fr'],
|
|
113
|
-
gap: ['1rem'],
|
|
114
|
-
},
|
|
115
|
-
};
|
|
116
|
-
},
|
|
117
|
-
computed: {
|
|
118
|
-
areaNames() {
|
|
119
|
-
return [...new Set(this.props.areas.flat())];
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
};
|
|
123
|
-
</script>
|
|
124
|
-
<style scopped>
|
|
125
|
-
.box {
|
|
126
|
-
padding: 1rem;
|
|
127
|
-
background: #eee;
|
|
128
|
-
}
|
|
129
|
-
</style>
|
|
130
|
-
```
|
|
1
|
+
```vue
|
|
2
|
+
<template>
|
|
3
|
+
<div class="pad-l5">
|
|
4
|
+
<div class="tile">
|
|
5
|
+
<ui-grid class="tile-body" v-bind="props">
|
|
6
|
+
<template #avatar="{ style }">
|
|
7
|
+
<img
|
|
8
|
+
class="avatar avatar-3 round"
|
|
9
|
+
src="https://picsum.photos/150/150"
|
|
10
|
+
:style="style"
|
|
11
|
+
/>
|
|
12
|
+
</template>
|
|
13
|
+
<template #info="{ style }">
|
|
14
|
+
<div :style="style">
|
|
15
|
+
<div class="text-bold">John Wick</div>
|
|
16
|
+
<div class="text-xsmall">john.wick@site.com</div>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
<template #status="{ style }">
|
|
20
|
+
<div class="text-xsmall color-green" :style="style">online</div>
|
|
21
|
+
</template>
|
|
22
|
+
</ui-grid>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
<script>
|
|
27
|
+
import UiGrid from './Grid.vue';
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
components: { UiGrid },
|
|
31
|
+
data() {
|
|
32
|
+
return {
|
|
33
|
+
props: {
|
|
34
|
+
areas: [['avatar', 'info', 'status']],
|
|
35
|
+
cols: ['auto', '1fr', 'auto'],
|
|
36
|
+
rows: ['1fr'],
|
|
37
|
+
gap: ['1rem'],
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Using wrapper element
|
|
46
|
+
|
|
47
|
+
```vue
|
|
48
|
+
<template>
|
|
49
|
+
<div class="pad-l5">
|
|
50
|
+
<div class="tile">
|
|
51
|
+
<ui-grid class="tile-body" v-bind="props">
|
|
52
|
+
<template #avatar>
|
|
53
|
+
<img class="avatar avatar-3 round" src="https://picsum.photos/150/150" />
|
|
54
|
+
</template>
|
|
55
|
+
<template #info>
|
|
56
|
+
<div class="text-bold">John Wick</div>
|
|
57
|
+
<div class="text-xsmall">john.wick@site.com</div>
|
|
58
|
+
</template>
|
|
59
|
+
<template #status>
|
|
60
|
+
<div class="text-xsmall color-green">online</div>
|
|
61
|
+
</template>
|
|
62
|
+
</ui-grid>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</template>
|
|
66
|
+
<script>
|
|
67
|
+
import UiGrid from './Grid.vue';
|
|
68
|
+
|
|
69
|
+
export default {
|
|
70
|
+
components: { UiGrid },
|
|
71
|
+
data() {
|
|
72
|
+
return {
|
|
73
|
+
props: {
|
|
74
|
+
areas: [['avatar', 'info', 'status']],
|
|
75
|
+
cols: ['auto', '1fr', 'auto'],
|
|
76
|
+
rows: ['1fr'],
|
|
77
|
+
gap: ['1rem'],
|
|
78
|
+
wrapTag: 'div',
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
</script>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
```vue
|
|
87
|
+
<template>
|
|
88
|
+
<div class="pad-l5">
|
|
89
|
+
<ui-grid v-bind="props">
|
|
90
|
+
<template v-for="name in areaNames" v-slot:[name]="{ style }">
|
|
91
|
+
<div class="box" :style="style">
|
|
92
|
+
<code>{{ name }}</code>
|
|
93
|
+
</div>
|
|
94
|
+
</template>
|
|
95
|
+
</ui-grid>
|
|
96
|
+
</div>
|
|
97
|
+
</template>
|
|
98
|
+
<script>
|
|
99
|
+
import UiGrid from './Grid.vue';
|
|
100
|
+
|
|
101
|
+
export default {
|
|
102
|
+
components: { UiGrid },
|
|
103
|
+
data() {
|
|
104
|
+
return {
|
|
105
|
+
props: {
|
|
106
|
+
areas: [
|
|
107
|
+
['area1', 'area3', 'area5'],
|
|
108
|
+
['area1', 'area4', 'area5'],
|
|
109
|
+
['area1', 'area2', 'area2'],
|
|
110
|
+
],
|
|
111
|
+
cols: ['auto', '1fr', 'auto'],
|
|
112
|
+
rows: ['1fr'],
|
|
113
|
+
gap: ['1rem'],
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
computed: {
|
|
118
|
+
areaNames() {
|
|
119
|
+
return [...new Set(this.props.areas.flat())];
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
</script>
|
|
124
|
+
<style scopped>
|
|
125
|
+
.box {
|
|
126
|
+
padding: 1rem;
|
|
127
|
+
background: #eee;
|
|
128
|
+
}
|
|
129
|
+
</style>
|
|
130
|
+
```
|