goodteditor-ui 1.0.11 → 1.0.12
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/.idea/codeStyles/Project.xml +51 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/goodt-ui.iml +12 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.prettierrc +14 -14
- package/README.md +35 -35
- package/babel.config.js +5 -5
- package/index.js +51 -49
- package/jsconfig.json +13 -13
- package/package.json +57 -57
- package/src/App.vue +36 -36
- package/src/components/ui/Avatar.md +68 -0
- package/src/components/ui/Avatar.vue +177 -0
- 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 +209 -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 +52 -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 +61 -61
- package/src/components/ui/utils/WithPopover.js +81 -81
- package/src/main.js +8 -8
- package/styleguide.config.js +37 -37
- package/vue.config.js +8 -8
- package/dist/js.png +0 -0
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
```vue
|
|
2
|
-
<template>
|
|
3
|
-
<div class="pad-l5">
|
|
4
|
-
<ui-datalist class="d-block w-f2" v-bind="props" v-on="events"></ui-datalist>
|
|
5
|
-
<pre>{{ selected }}</pre>
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
<script>
|
|
9
|
-
import UiDatalist from './Datalist.vue';
|
|
10
|
-
|
|
11
|
-
let options = [
|
|
12
|
-
'angular',
|
|
13
|
-
'aurelia',
|
|
14
|
-
'backbone',
|
|
15
|
-
'ember',
|
|
16
|
-
'meteor',
|
|
17
|
-
'react',
|
|
18
|
-
'riot',
|
|
19
|
-
'stencil',
|
|
20
|
-
'svelte',
|
|
21
|
-
'vue',
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
export default {
|
|
25
|
-
components: { UiDatalist },
|
|
26
|
-
data() {
|
|
27
|
-
return {
|
|
28
|
-
selected: null,
|
|
29
|
-
props: {
|
|
30
|
-
options,
|
|
31
|
-
},
|
|
32
|
-
events: {
|
|
33
|
-
'select-option': data => {
|
|
34
|
-
this.selected = data;
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
};
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
</script>
|
|
41
|
-
```
|
|
1
|
+
```vue
|
|
2
|
+
<template>
|
|
3
|
+
<div class="pad-l5">
|
|
4
|
+
<ui-datalist class="d-block w-f2" v-bind="props" v-on="events"></ui-datalist>
|
|
5
|
+
<pre>{{ selected }}</pre>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
<script>
|
|
9
|
+
import UiDatalist from './Datalist.vue';
|
|
10
|
+
|
|
11
|
+
let options = [
|
|
12
|
+
'angular',
|
|
13
|
+
'aurelia',
|
|
14
|
+
'backbone',
|
|
15
|
+
'ember',
|
|
16
|
+
'meteor',
|
|
17
|
+
'react',
|
|
18
|
+
'riot',
|
|
19
|
+
'stencil',
|
|
20
|
+
'svelte',
|
|
21
|
+
'vue',
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
export default {
|
|
25
|
+
components: { UiDatalist },
|
|
26
|
+
data() {
|
|
27
|
+
return {
|
|
28
|
+
selected: null,
|
|
29
|
+
props: {
|
|
30
|
+
options,
|
|
31
|
+
},
|
|
32
|
+
events: {
|
|
33
|
+
'select-option': data => {
|
|
34
|
+
this.selected = data;
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
</script>
|
|
41
|
+
```
|
|
@@ -1,157 +1,157 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ui-datalist dropdown" :class="cssClass">
|
|
3
|
-
<!--
|
|
4
|
-
@slot Dropdown header slot
|
|
5
|
-
-->
|
|
6
|
-
<slot name="header"></slot>
|
|
7
|
-
<ul ref="ul">
|
|
8
|
-
<!--
|
|
9
|
-
@slot Label slot for single mode
|
|
10
|
-
@binding {Object} option option
|
|
11
|
-
@binding {Number} index option's index
|
|
12
|
-
@binding {Number} cursorIndex cursor index
|
|
13
|
-
@binding {Function} setCursorIndex sets cursor index
|
|
14
|
-
-->
|
|
15
|
-
<slot
|
|
16
|
-
name="option"
|
|
17
|
-
v-for="(option, index) in options"
|
|
18
|
-
v-bind="{
|
|
19
|
-
option,
|
|
20
|
-
index,
|
|
21
|
-
cursorIndex,
|
|
22
|
-
setCursorIndex,
|
|
23
|
-
}"
|
|
24
|
-
>
|
|
25
|
-
<li
|
|
26
|
-
:class="{ active: index == cursorIndex }"
|
|
27
|
-
:key="index"
|
|
28
|
-
@click="onOptionClick(option, index)"
|
|
29
|
-
>
|
|
30
|
-
<div class="text-truncate" style="min-height: calc(var(--line-height)*1rem)">
|
|
31
|
-
{{ option }}
|
|
32
|
-
</div>
|
|
33
|
-
</li>
|
|
34
|
-
</slot>
|
|
35
|
-
</ul>
|
|
36
|
-
<!--
|
|
37
|
-
@slot Dropdown footer slot
|
|
38
|
-
-->
|
|
39
|
-
<slot name="footer"></slot>
|
|
40
|
-
</div>
|
|
41
|
-
</template>
|
|
42
|
-
<style lang="less" scoped>
|
|
43
|
-
.dropdown {
|
|
44
|
-
outline: none;
|
|
45
|
-
ul {
|
|
46
|
-
scroll-behavior: smooth;
|
|
47
|
-
}
|
|
48
|
-
&.no-scroll-animation {
|
|
49
|
-
ul {
|
|
50
|
-
scroll-behavior: auto;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
</style>
|
|
55
|
-
<script>
|
|
56
|
-
import { scrollIntoView, Key } from './utils/Helpers';
|
|
57
|
-
|
|
58
|
-
export default {
|
|
59
|
-
props: {
|
|
60
|
-
/**
|
|
61
|
-
* Options
|
|
62
|
-
*/
|
|
63
|
-
options: {
|
|
64
|
-
type: Array,
|
|
65
|
-
default() {
|
|
66
|
-
return [];
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
/**
|
|
70
|
-
* Defines the size of the component
|
|
71
|
-
* @values '', small, large
|
|
72
|
-
*/
|
|
73
|
-
size: {
|
|
74
|
-
type: String,
|
|
75
|
-
default: '',
|
|
76
|
-
validator: function(value) {
|
|
77
|
-
return ['', 'small', 'large'].indexOf(value) >= 0;
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
/**
|
|
81
|
-
* The current cursor index position (.sync)
|
|
82
|
-
*/
|
|
83
|
-
cursorIndex: {
|
|
84
|
-
type: Number,
|
|
85
|
-
default: -1,
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
data() {
|
|
89
|
-
return { useScrollAnimation: true };
|
|
90
|
-
},
|
|
91
|
-
computed: {
|
|
92
|
-
cssClass() {
|
|
93
|
-
let { size, useScrollAnimation } = this;
|
|
94
|
-
let o = [];
|
|
95
|
-
size && o.push(`dropdown-${this.size}`);
|
|
96
|
-
!useScrollAnimation && o.push('no-scroll-animation');
|
|
97
|
-
return o;
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
watch: {
|
|
101
|
-
cursorIndex: {
|
|
102
|
-
handler(val) {
|
|
103
|
-
this.useScrollAnimation = false;
|
|
104
|
-
setTimeout(() => {
|
|
105
|
-
let c = this.$refs.ul ? this.$refs.ul.children[val] : null;
|
|
106
|
-
scrollIntoView(c);
|
|
107
|
-
this.useScrollAnimation = true;
|
|
108
|
-
});
|
|
109
|
-
},
|
|
110
|
-
immediate: true,
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
methods: {
|
|
114
|
-
onOptionClick(option, index) {
|
|
115
|
-
/**
|
|
116
|
-
* Select option event
|
|
117
|
-
* @property {Object} { option, index }
|
|
118
|
-
*/
|
|
119
|
-
this.$emit('select-option', { option, index });
|
|
120
|
-
},
|
|
121
|
-
setCursorIndex(index) {
|
|
122
|
-
if (index < 0 || index >= this.options.length) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Update cursor index event (.sync)
|
|
127
|
-
* @property {Number} index
|
|
128
|
-
*/
|
|
129
|
-
this.$emit('update:cursorIndex', index);
|
|
130
|
-
},
|
|
131
|
-
onKeyDown(e) {
|
|
132
|
-
if (e.key === Key.UP) {
|
|
133
|
-
if (this.cursorIndex > 0) {
|
|
134
|
-
e.preventDefault();
|
|
135
|
-
this.setCursorIndex(this.cursorIndex - 1);
|
|
136
|
-
}
|
|
137
|
-
} else if (e.key === Key.DOWN) {
|
|
138
|
-
if (this.cursorIndex < this.options.length - 1) {
|
|
139
|
-
e.preventDefault();
|
|
140
|
-
this.setCursorIndex(this.cursorIndex + 1);
|
|
141
|
-
}
|
|
142
|
-
} else if (e.key === Key.ENTER && this.options.length) {
|
|
143
|
-
e.preventDefault();
|
|
144
|
-
let option = this.options[this.cursorIndex];
|
|
145
|
-
if (!option) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Select option event
|
|
150
|
-
* @property {Object} { option, index }
|
|
151
|
-
*/
|
|
152
|
-
this.$emit('select-option', { option, index: this.cursorIndex });
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
};
|
|
157
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ui-datalist dropdown" :class="cssClass">
|
|
3
|
+
<!--
|
|
4
|
+
@slot Dropdown header slot
|
|
5
|
+
-->
|
|
6
|
+
<slot name="header"></slot>
|
|
7
|
+
<ul ref="ul">
|
|
8
|
+
<!--
|
|
9
|
+
@slot Label slot for single mode
|
|
10
|
+
@binding {Object} option option
|
|
11
|
+
@binding {Number} index option's index
|
|
12
|
+
@binding {Number} cursorIndex cursor index
|
|
13
|
+
@binding {Function} setCursorIndex sets cursor index
|
|
14
|
+
-->
|
|
15
|
+
<slot
|
|
16
|
+
name="option"
|
|
17
|
+
v-for="(option, index) in options"
|
|
18
|
+
v-bind="{
|
|
19
|
+
option,
|
|
20
|
+
index,
|
|
21
|
+
cursorIndex,
|
|
22
|
+
setCursorIndex,
|
|
23
|
+
}"
|
|
24
|
+
>
|
|
25
|
+
<li
|
|
26
|
+
:class="{ active: index == cursorIndex }"
|
|
27
|
+
:key="index"
|
|
28
|
+
@click="onOptionClick(option, index)"
|
|
29
|
+
>
|
|
30
|
+
<div class="text-truncate" style="min-height: calc(var(--line-height)*1rem)">
|
|
31
|
+
{{ option }}
|
|
32
|
+
</div>
|
|
33
|
+
</li>
|
|
34
|
+
</slot>
|
|
35
|
+
</ul>
|
|
36
|
+
<!--
|
|
37
|
+
@slot Dropdown footer slot
|
|
38
|
+
-->
|
|
39
|
+
<slot name="footer"></slot>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
<style lang="less" scoped>
|
|
43
|
+
.dropdown {
|
|
44
|
+
outline: none;
|
|
45
|
+
ul {
|
|
46
|
+
scroll-behavior: smooth;
|
|
47
|
+
}
|
|
48
|
+
&.no-scroll-animation {
|
|
49
|
+
ul {
|
|
50
|
+
scroll-behavior: auto;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
<script>
|
|
56
|
+
import { scrollIntoView, Key } from './utils/Helpers';
|
|
57
|
+
|
|
58
|
+
export default {
|
|
59
|
+
props: {
|
|
60
|
+
/**
|
|
61
|
+
* Options
|
|
62
|
+
*/
|
|
63
|
+
options: {
|
|
64
|
+
type: Array,
|
|
65
|
+
default() {
|
|
66
|
+
return [];
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* Defines the size of the component
|
|
71
|
+
* @values '', small, large
|
|
72
|
+
*/
|
|
73
|
+
size: {
|
|
74
|
+
type: String,
|
|
75
|
+
default: '',
|
|
76
|
+
validator: function(value) {
|
|
77
|
+
return ['', 'small', 'large'].indexOf(value) >= 0;
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* The current cursor index position (.sync)
|
|
82
|
+
*/
|
|
83
|
+
cursorIndex: {
|
|
84
|
+
type: Number,
|
|
85
|
+
default: -1,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
data() {
|
|
89
|
+
return { useScrollAnimation: true };
|
|
90
|
+
},
|
|
91
|
+
computed: {
|
|
92
|
+
cssClass() {
|
|
93
|
+
let { size, useScrollAnimation } = this;
|
|
94
|
+
let o = [];
|
|
95
|
+
size && o.push(`dropdown-${this.size}`);
|
|
96
|
+
!useScrollAnimation && o.push('no-scroll-animation');
|
|
97
|
+
return o;
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
watch: {
|
|
101
|
+
cursorIndex: {
|
|
102
|
+
handler(val) {
|
|
103
|
+
this.useScrollAnimation = false;
|
|
104
|
+
setTimeout(() => {
|
|
105
|
+
let c = this.$refs.ul ? this.$refs.ul.children[val] : null;
|
|
106
|
+
scrollIntoView(c);
|
|
107
|
+
this.useScrollAnimation = true;
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
immediate: true,
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
methods: {
|
|
114
|
+
onOptionClick(option, index) {
|
|
115
|
+
/**
|
|
116
|
+
* Select option event
|
|
117
|
+
* @property {Object} { option, index }
|
|
118
|
+
*/
|
|
119
|
+
this.$emit('select-option', { option, index });
|
|
120
|
+
},
|
|
121
|
+
setCursorIndex(index) {
|
|
122
|
+
if (index < 0 || index >= this.options.length) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Update cursor index event (.sync)
|
|
127
|
+
* @property {Number} index
|
|
128
|
+
*/
|
|
129
|
+
this.$emit('update:cursorIndex', index);
|
|
130
|
+
},
|
|
131
|
+
onKeyDown(e) {
|
|
132
|
+
if (e.key === Key.UP) {
|
|
133
|
+
if (this.cursorIndex > 0) {
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
this.setCursorIndex(this.cursorIndex - 1);
|
|
136
|
+
}
|
|
137
|
+
} else if (e.key === Key.DOWN) {
|
|
138
|
+
if (this.cursorIndex < this.options.length - 1) {
|
|
139
|
+
e.preventDefault();
|
|
140
|
+
this.setCursorIndex(this.cursorIndex + 1);
|
|
141
|
+
}
|
|
142
|
+
} else if (e.key === Key.ENTER && this.options.length) {
|
|
143
|
+
e.preventDefault();
|
|
144
|
+
let option = this.options[this.cursorIndex];
|
|
145
|
+
if (!option) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Select option event
|
|
150
|
+
* @property {Object} { option, index }
|
|
151
|
+
*/
|
|
152
|
+
this.$emit('select-option', { option, index: this.cursorIndex });
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
</script>
|