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,253 +1,253 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
class="ui-input-time-picker form-elem"
|
|
4
|
-
:class="cssClass"
|
|
5
|
-
@focus="onRootFocus"
|
|
6
|
-
tabindex="0"
|
|
7
|
-
:data-popover="popoverTargetId"
|
|
8
|
-
>
|
|
9
|
-
<div class="ui-input-time-picker-wrapper d-flex flex-v-center w-100">
|
|
10
|
-
<div style="flex: 1 0 0">
|
|
11
|
-
<!--
|
|
12
|
-
@slot Custom input slot
|
|
13
|
-
@binding {String} id input id attribute value
|
|
14
|
-
@binding {String} value input value
|
|
15
|
-
@binding {Object} inputBinds input props (use v-bind)
|
|
16
|
-
@binding {Object} inputEvents input events (use v-on)
|
|
17
|
-
-->
|
|
18
|
-
<slot name="input" v-bind="{ id: inputId, value, inputBinds, inputEvents }">
|
|
19
|
-
<input
|
|
20
|
-
:id="inputId"
|
|
21
|
-
class="ui-input-time-picker-input w-100"
|
|
22
|
-
type="text"
|
|
23
|
-
:value="value"
|
|
24
|
-
v-bind="inputBinds"
|
|
25
|
-
v-on="inputEvents"
|
|
26
|
-
/>
|
|
27
|
-
</slot>
|
|
28
|
-
</div>
|
|
29
|
-
<!--
|
|
30
|
-
@slot Custom clear icon slot
|
|
31
|
-
@binding {Function} clear function that clears the value
|
|
32
|
-
-->
|
|
33
|
-
<slot name="clear" v-bind="{ clear }" v-if="value && allowClear">
|
|
34
|
-
<div class="icon cursor-pointer w-auto h-auto mar-left-2" @click="clear">
|
|
35
|
-
<i class="mdi mdi-close"></i>
|
|
36
|
-
</div>
|
|
37
|
-
</slot>
|
|
38
|
-
<!--
|
|
39
|
-
@slot Icon slot
|
|
40
|
-
@binding {Function} toggle function that toggles the datepicker
|
|
41
|
-
-->
|
|
42
|
-
<slot name="icon" v-bind="{ toggle: togglePopover }">
|
|
43
|
-
<div class="icon cursor-pointer w-auto h-auto mar-left-2" @click="togglePopover">
|
|
44
|
-
<i class="mdi mdi-clock-outline"></i>
|
|
45
|
-
</div>
|
|
46
|
-
</slot>
|
|
47
|
-
</div>
|
|
48
|
-
<ui-popover :show.sync="popoverShow" v-bind="popoverOptions">
|
|
49
|
-
<time-picker
|
|
50
|
-
class="ui-input-time-picker-tp w-100"
|
|
51
|
-
:value="time"
|
|
52
|
-
@change="onTpChange"
|
|
53
|
-
v-bind="{ ...timepicker }"
|
|
54
|
-
>
|
|
55
|
-
<template #hour-label="scope">
|
|
56
|
-
<!--
|
|
57
|
-
@slot @see [TimePicker.slots.hour-label](#timepicker)
|
|
58
|
-
-->
|
|
59
|
-
<slot name="hour-label" v-bind="scope"></slot>
|
|
60
|
-
</template>
|
|
61
|
-
<template #min-label="scope">
|
|
62
|
-
<!--
|
|
63
|
-
@slot @see [TimePicker.slots.min-label](#timepicker)
|
|
64
|
-
-->
|
|
65
|
-
<slot name="min-label" v-bind="scope"></slot>
|
|
66
|
-
</template>
|
|
67
|
-
<template #hour-option="scope">
|
|
68
|
-
<!--
|
|
69
|
-
@slot @see [TimePicker.slots.hour-option](#timepicker)
|
|
70
|
-
-->
|
|
71
|
-
<slot name="hour-option" v-bind="scope"></slot>
|
|
72
|
-
</template>
|
|
73
|
-
<template #min-option="scope">
|
|
74
|
-
<!--
|
|
75
|
-
@slot @see [TimePicker.slots.hour-option](#timepicker)
|
|
76
|
-
-->
|
|
77
|
-
<slot name="min-option" v-bind="scope"></slot>
|
|
78
|
-
</template>
|
|
79
|
-
</time-picker>
|
|
80
|
-
</ui-popover>
|
|
81
|
-
</div>
|
|
82
|
-
</template>
|
|
83
|
-
<style lang="less" scoped>
|
|
84
|
-
.ui-input-time-picker {
|
|
85
|
-
display: inline-flex;
|
|
86
|
-
&-input {
|
|
87
|
-
border: none;
|
|
88
|
-
margin: 0;
|
|
89
|
-
padding: 0;
|
|
90
|
-
line-height: 1.5;
|
|
91
|
-
color: inherit;
|
|
92
|
-
background: transparent;
|
|
93
|
-
outline: none;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
</style>
|
|
97
|
-
<script>
|
|
98
|
-
import TimePicker from './TimePicker.vue';
|
|
99
|
-
import UiPopover from './Popover.vue';
|
|
100
|
-
import FormComponent from './utils/FormComponent';
|
|
101
|
-
import WithPopover from './utils/WithPopover';
|
|
102
|
-
|
|
103
|
-
let lz = n => (n < 10 ? `0${n}` : `${n}`);
|
|
104
|
-
export default {
|
|
105
|
-
mixins: [FormComponent, WithPopover],
|
|
106
|
-
components: { TimePicker, UiPopover },
|
|
107
|
-
props: {
|
|
108
|
-
/**
|
|
109
|
-
* Whether the input is editable
|
|
110
|
-
*/
|
|
111
|
-
editable: {
|
|
112
|
-
type: Boolean,
|
|
113
|
-
default: true,
|
|
114
|
-
},
|
|
115
|
-
/**
|
|
116
|
-
* Allow clearing the time
|
|
117
|
-
*/
|
|
118
|
-
allowClear: {
|
|
119
|
-
type: Boolean,
|
|
120
|
-
default: true,
|
|
121
|
-
},
|
|
122
|
-
/**
|
|
123
|
-
* TimePicker options
|
|
124
|
-
* @see [TimePicker.props](#timepicker)
|
|
125
|
-
*/
|
|
126
|
-
timepicker: {
|
|
127
|
-
type: Object,
|
|
128
|
-
default() {
|
|
129
|
-
return {};
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
/**
|
|
133
|
-
* Function which formats time String -> Object { h:Number, m:Number }
|
|
134
|
-
* function(str:String):Object
|
|
135
|
-
*/
|
|
136
|
-
toTime: {
|
|
137
|
-
type: Function,
|
|
138
|
-
default(val) {
|
|
139
|
-
if (!val) {
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
let mt = val.match(/^(\d{1,2}):(\d{1,2})$/);
|
|
143
|
-
if (mt && mt.length == 3) {
|
|
144
|
-
let h = parseInt(mt[1]);
|
|
145
|
-
let m = parseInt(mt[2]);
|
|
146
|
-
if (h >= 0 && h < 24 && m >= 0 && m < 60) {
|
|
147
|
-
return { h, m };
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return null;
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
/**
|
|
154
|
-
* Function which formats time { h:Number, m:Number } Object -> String
|
|
155
|
-
* function(time:Object):String
|
|
156
|
-
*/
|
|
157
|
-
toValue: {
|
|
158
|
-
type: Function,
|
|
159
|
-
default(time) {
|
|
160
|
-
if (!time) {
|
|
161
|
-
return '';
|
|
162
|
-
}
|
|
163
|
-
let { h, m } = time;
|
|
164
|
-
return h != null && m != null ? `${lz(h)}:${lz(m)}` : '';
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
autoWidth: {
|
|
168
|
-
default: true,
|
|
169
|
-
},
|
|
170
|
-
},
|
|
171
|
-
data() {
|
|
172
|
-
return {
|
|
173
|
-
time: null,
|
|
174
|
-
inputBinds: {
|
|
175
|
-
placeholder: this.placeholder,
|
|
176
|
-
readonly: this.readonly || !this.editable,
|
|
177
|
-
},
|
|
178
|
-
inputEvents: {
|
|
179
|
-
change: this.onInputChange,
|
|
180
|
-
input: this.onInputInput,
|
|
181
|
-
focus: this.onInputFocus,
|
|
182
|
-
blur: this.onInputBlur,
|
|
183
|
-
},
|
|
184
|
-
};
|
|
185
|
-
},
|
|
186
|
-
watch: {
|
|
187
|
-
value: {
|
|
188
|
-
handler(val) {
|
|
189
|
-
this.time = this.toTime(val);
|
|
190
|
-
},
|
|
191
|
-
immediate: true,
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
methods: {
|
|
195
|
-
clear() {
|
|
196
|
-
/**
|
|
197
|
-
* Input event
|
|
198
|
-
* @property {String} time
|
|
199
|
-
*/
|
|
200
|
-
this.$emit('input', '');
|
|
201
|
-
/**
|
|
202
|
-
* Clear event
|
|
203
|
-
*/
|
|
204
|
-
this.$emit('clear');
|
|
205
|
-
},
|
|
206
|
-
onRootFocus(e) {
|
|
207
|
-
let input = this.getInputRef();
|
|
208
|
-
input && input.focus();
|
|
209
|
-
},
|
|
210
|
-
onInputChange(e) {
|
|
211
|
-
let data = this.toValue(this.time);
|
|
212
|
-
/**
|
|
213
|
-
* Input event
|
|
214
|
-
* @property {String} time
|
|
215
|
-
*/
|
|
216
|
-
this.$emit('input', data);
|
|
217
|
-
/**
|
|
218
|
-
* Change event
|
|
219
|
-
* @property {String} time
|
|
220
|
-
*/
|
|
221
|
-
this.$emit('change', data);
|
|
222
|
-
},
|
|
223
|
-
onInputInput(e) {
|
|
224
|
-
let val = e.target.value;
|
|
225
|
-
/**
|
|
226
|
-
* Input event
|
|
227
|
-
* @property {String} time
|
|
228
|
-
*/
|
|
229
|
-
this.$emit('input', val);
|
|
230
|
-
},
|
|
231
|
-
onInputFocus(e) {
|
|
232
|
-
this.rootHasFocus = true;
|
|
233
|
-
},
|
|
234
|
-
onInputBlur(e) {
|
|
235
|
-
this.rootHasFocus = false;
|
|
236
|
-
},
|
|
237
|
-
onTpChange(time) {
|
|
238
|
-
this.time = time;
|
|
239
|
-
let data = this.toValue(time);
|
|
240
|
-
/**
|
|
241
|
-
* Input event
|
|
242
|
-
* @property {String} time
|
|
243
|
-
*/
|
|
244
|
-
this.$emit('input', data);
|
|
245
|
-
/**
|
|
246
|
-
* Change event
|
|
247
|
-
* @property {String} time
|
|
248
|
-
*/
|
|
249
|
-
this.$emit('change', data);
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
};
|
|
253
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="ui-input-time-picker form-elem"
|
|
4
|
+
:class="cssClass"
|
|
5
|
+
@focus="onRootFocus"
|
|
6
|
+
tabindex="0"
|
|
7
|
+
:data-popover="popoverTargetId"
|
|
8
|
+
>
|
|
9
|
+
<div class="ui-input-time-picker-wrapper d-flex flex-v-center w-100">
|
|
10
|
+
<div style="flex: 1 0 0">
|
|
11
|
+
<!--
|
|
12
|
+
@slot Custom input slot
|
|
13
|
+
@binding {String} id input id attribute value
|
|
14
|
+
@binding {String} value input value
|
|
15
|
+
@binding {Object} inputBinds input props (use v-bind)
|
|
16
|
+
@binding {Object} inputEvents input events (use v-on)
|
|
17
|
+
-->
|
|
18
|
+
<slot name="input" v-bind="{ id: inputId, value, inputBinds, inputEvents }">
|
|
19
|
+
<input
|
|
20
|
+
:id="inputId"
|
|
21
|
+
class="ui-input-time-picker-input w-100"
|
|
22
|
+
type="text"
|
|
23
|
+
:value="value"
|
|
24
|
+
v-bind="inputBinds"
|
|
25
|
+
v-on="inputEvents"
|
|
26
|
+
/>
|
|
27
|
+
</slot>
|
|
28
|
+
</div>
|
|
29
|
+
<!--
|
|
30
|
+
@slot Custom clear icon slot
|
|
31
|
+
@binding {Function} clear function that clears the value
|
|
32
|
+
-->
|
|
33
|
+
<slot name="clear" v-bind="{ clear }" v-if="value && allowClear">
|
|
34
|
+
<div class="icon cursor-pointer w-auto h-auto mar-left-2" @click="clear">
|
|
35
|
+
<i class="mdi mdi-close"></i>
|
|
36
|
+
</div>
|
|
37
|
+
</slot>
|
|
38
|
+
<!--
|
|
39
|
+
@slot Icon slot
|
|
40
|
+
@binding {Function} toggle function that toggles the datepicker
|
|
41
|
+
-->
|
|
42
|
+
<slot name="icon" v-bind="{ toggle: togglePopover }">
|
|
43
|
+
<div class="icon cursor-pointer w-auto h-auto mar-left-2" @click="togglePopover">
|
|
44
|
+
<i class="mdi mdi-clock-outline"></i>
|
|
45
|
+
</div>
|
|
46
|
+
</slot>
|
|
47
|
+
</div>
|
|
48
|
+
<ui-popover :show.sync="popoverShow" v-bind="popoverOptions">
|
|
49
|
+
<time-picker
|
|
50
|
+
class="ui-input-time-picker-tp w-100"
|
|
51
|
+
:value="time"
|
|
52
|
+
@change="onTpChange"
|
|
53
|
+
v-bind="{ ...timepicker }"
|
|
54
|
+
>
|
|
55
|
+
<template #hour-label="scope">
|
|
56
|
+
<!--
|
|
57
|
+
@slot @see [TimePicker.slots.hour-label](#timepicker)
|
|
58
|
+
-->
|
|
59
|
+
<slot name="hour-label" v-bind="scope"></slot>
|
|
60
|
+
</template>
|
|
61
|
+
<template #min-label="scope">
|
|
62
|
+
<!--
|
|
63
|
+
@slot @see [TimePicker.slots.min-label](#timepicker)
|
|
64
|
+
-->
|
|
65
|
+
<slot name="min-label" v-bind="scope"></slot>
|
|
66
|
+
</template>
|
|
67
|
+
<template #hour-option="scope">
|
|
68
|
+
<!--
|
|
69
|
+
@slot @see [TimePicker.slots.hour-option](#timepicker)
|
|
70
|
+
-->
|
|
71
|
+
<slot name="hour-option" v-bind="scope"></slot>
|
|
72
|
+
</template>
|
|
73
|
+
<template #min-option="scope">
|
|
74
|
+
<!--
|
|
75
|
+
@slot @see [TimePicker.slots.hour-option](#timepicker)
|
|
76
|
+
-->
|
|
77
|
+
<slot name="min-option" v-bind="scope"></slot>
|
|
78
|
+
</template>
|
|
79
|
+
</time-picker>
|
|
80
|
+
</ui-popover>
|
|
81
|
+
</div>
|
|
82
|
+
</template>
|
|
83
|
+
<style lang="less" scoped>
|
|
84
|
+
.ui-input-time-picker {
|
|
85
|
+
display: inline-flex;
|
|
86
|
+
&-input {
|
|
87
|
+
border: none;
|
|
88
|
+
margin: 0;
|
|
89
|
+
padding: 0;
|
|
90
|
+
line-height: 1.5;
|
|
91
|
+
color: inherit;
|
|
92
|
+
background: transparent;
|
|
93
|
+
outline: none;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
</style>
|
|
97
|
+
<script>
|
|
98
|
+
import TimePicker from './TimePicker.vue';
|
|
99
|
+
import UiPopover from './Popover.vue';
|
|
100
|
+
import FormComponent from './utils/FormComponent';
|
|
101
|
+
import WithPopover from './utils/WithPopover';
|
|
102
|
+
|
|
103
|
+
let lz = n => (n < 10 ? `0${n}` : `${n}`);
|
|
104
|
+
export default {
|
|
105
|
+
mixins: [FormComponent, WithPopover],
|
|
106
|
+
components: { TimePicker, UiPopover },
|
|
107
|
+
props: {
|
|
108
|
+
/**
|
|
109
|
+
* Whether the input is editable
|
|
110
|
+
*/
|
|
111
|
+
editable: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
default: true,
|
|
114
|
+
},
|
|
115
|
+
/**
|
|
116
|
+
* Allow clearing the time
|
|
117
|
+
*/
|
|
118
|
+
allowClear: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
default: true,
|
|
121
|
+
},
|
|
122
|
+
/**
|
|
123
|
+
* TimePicker options
|
|
124
|
+
* @see [TimePicker.props](#timepicker)
|
|
125
|
+
*/
|
|
126
|
+
timepicker: {
|
|
127
|
+
type: Object,
|
|
128
|
+
default() {
|
|
129
|
+
return {};
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
/**
|
|
133
|
+
* Function which formats time String -> Object { h:Number, m:Number }
|
|
134
|
+
* function(str:String):Object
|
|
135
|
+
*/
|
|
136
|
+
toTime: {
|
|
137
|
+
type: Function,
|
|
138
|
+
default(val) {
|
|
139
|
+
if (!val) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
let mt = val.match(/^(\d{1,2}):(\d{1,2})$/);
|
|
143
|
+
if (mt && mt.length == 3) {
|
|
144
|
+
let h = parseInt(mt[1]);
|
|
145
|
+
let m = parseInt(mt[2]);
|
|
146
|
+
if (h >= 0 && h < 24 && m >= 0 && m < 60) {
|
|
147
|
+
return { h, m };
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* Function which formats time { h:Number, m:Number } Object -> String
|
|
155
|
+
* function(time:Object):String
|
|
156
|
+
*/
|
|
157
|
+
toValue: {
|
|
158
|
+
type: Function,
|
|
159
|
+
default(time) {
|
|
160
|
+
if (!time) {
|
|
161
|
+
return '';
|
|
162
|
+
}
|
|
163
|
+
let { h, m } = time;
|
|
164
|
+
return h != null && m != null ? `${lz(h)}:${lz(m)}` : '';
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
autoWidth: {
|
|
168
|
+
default: true,
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
data() {
|
|
172
|
+
return {
|
|
173
|
+
time: null,
|
|
174
|
+
inputBinds: {
|
|
175
|
+
placeholder: this.placeholder,
|
|
176
|
+
readonly: this.readonly || !this.editable,
|
|
177
|
+
},
|
|
178
|
+
inputEvents: {
|
|
179
|
+
change: this.onInputChange,
|
|
180
|
+
input: this.onInputInput,
|
|
181
|
+
focus: this.onInputFocus,
|
|
182
|
+
blur: this.onInputBlur,
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
},
|
|
186
|
+
watch: {
|
|
187
|
+
value: {
|
|
188
|
+
handler(val) {
|
|
189
|
+
this.time = this.toTime(val);
|
|
190
|
+
},
|
|
191
|
+
immediate: true,
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
methods: {
|
|
195
|
+
clear() {
|
|
196
|
+
/**
|
|
197
|
+
* Input event
|
|
198
|
+
* @property {String} time
|
|
199
|
+
*/
|
|
200
|
+
this.$emit('input', '');
|
|
201
|
+
/**
|
|
202
|
+
* Clear event
|
|
203
|
+
*/
|
|
204
|
+
this.$emit('clear');
|
|
205
|
+
},
|
|
206
|
+
onRootFocus(e) {
|
|
207
|
+
let input = this.getInputRef();
|
|
208
|
+
input && input.focus();
|
|
209
|
+
},
|
|
210
|
+
onInputChange(e) {
|
|
211
|
+
let data = this.toValue(this.time);
|
|
212
|
+
/**
|
|
213
|
+
* Input event
|
|
214
|
+
* @property {String} time
|
|
215
|
+
*/
|
|
216
|
+
this.$emit('input', data);
|
|
217
|
+
/**
|
|
218
|
+
* Change event
|
|
219
|
+
* @property {String} time
|
|
220
|
+
*/
|
|
221
|
+
this.$emit('change', data);
|
|
222
|
+
},
|
|
223
|
+
onInputInput(e) {
|
|
224
|
+
let val = e.target.value;
|
|
225
|
+
/**
|
|
226
|
+
* Input event
|
|
227
|
+
* @property {String} time
|
|
228
|
+
*/
|
|
229
|
+
this.$emit('input', val);
|
|
230
|
+
},
|
|
231
|
+
onInputFocus(e) {
|
|
232
|
+
this.rootHasFocus = true;
|
|
233
|
+
},
|
|
234
|
+
onInputBlur(e) {
|
|
235
|
+
this.rootHasFocus = false;
|
|
236
|
+
},
|
|
237
|
+
onTpChange(time) {
|
|
238
|
+
this.time = time;
|
|
239
|
+
let data = this.toValue(time);
|
|
240
|
+
/**
|
|
241
|
+
* Input event
|
|
242
|
+
* @property {String} time
|
|
243
|
+
*/
|
|
244
|
+
this.$emit('input', data);
|
|
245
|
+
/**
|
|
246
|
+
* Change event
|
|
247
|
+
* @property {String} time
|
|
248
|
+
*/
|
|
249
|
+
this.$emit('change', data);
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
</script>
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
```vue
|
|
2
|
-
<template>
|
|
3
|
-
<div class="pad-l5">
|
|
4
|
-
<p>value: {{ model }}</p>
|
|
5
|
-
<input-units v-model="model" v-bind="props"></input-units>
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
<script>
|
|
9
|
-
export default {
|
|
10
|
-
data() {
|
|
11
|
-
return {
|
|
12
|
-
model: '100px',
|
|
13
|
-
props: {
|
|
14
|
-
units: ['%', 'px', 'rem', 'em', 'fr', '$', '€'],
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
</script>
|
|
20
|
-
```
|
|
1
|
+
```vue
|
|
2
|
+
<template>
|
|
3
|
+
<div class="pad-l5">
|
|
4
|
+
<p>value: {{ model }}</p>
|
|
5
|
+
<input-units v-model="model" v-bind="props"></input-units>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
<script>
|
|
9
|
+
export default {
|
|
10
|
+
data() {
|
|
11
|
+
return {
|
|
12
|
+
model: '100px',
|
|
13
|
+
props: {
|
|
14
|
+
units: ['%', 'px', 'rem', 'em', 'fr', '$', '€'],
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
</script>
|
|
20
|
+
```
|