goodteditor-ui 1.0.21 → 1.0.23
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/index.js +53 -53
- package/jsconfig.json +13 -13
- package/package.json +66 -70
- package/src/App.vue +36 -36
- package/src/components/ui/Avatar.md +68 -68
- package/src/components/ui/Avatar.vue +180 -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 +326 -326
- 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 +274 -274
- 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 +421 -421
- package/src/components/ui/TimePicker.md +50 -50
- package/src/components/ui/TimePicker.vue +252 -252
- package/src/components/ui/Tooltip.md +54 -114
- package/src/components/ui/Tooltip.vue +113 -113
- package/src/components/ui/WysiwygEditor/WysiwygEditor.d.ts +119 -119
- package/src/components/ui/WysiwygEditor/constants.js +264 -264
- package/src/components/ui/WysiwygEditor/extensions/blockquote.js +15 -15
- package/src/components/ui/WysiwygEditor/extensions/bold.js +15 -15
- package/src/components/ui/WysiwygEditor/extensions/bullet-list.js +15 -15
- package/src/components/ui/WysiwygEditor/extensions/code-block.js +13 -13
- package/src/components/ui/WysiwygEditor/extensions/code.js +13 -13
- package/src/components/ui/WysiwygEditor/extensions/font-size.js +34 -34
- package/src/components/ui/WysiwygEditor/extensions/formatting.js +14 -14
- package/src/components/ui/WysiwygEditor/extensions/heading.js +13 -13
- package/src/components/ui/WysiwygEditor/extensions/horizontal-rule.js +15 -15
- package/src/components/ui/WysiwygEditor/extensions/image.js +19 -19
- package/src/components/ui/WysiwygEditor/extensions/index.d.ts +32 -32
- package/src/components/ui/WysiwygEditor/extensions/index.js +32 -32
- package/src/components/ui/WysiwygEditor/extensions/italic.js +15 -15
- package/src/components/ui/WysiwygEditor/extensions/link.js +16 -16
- package/src/components/ui/WysiwygEditor/extensions/list-item.js +15 -15
- package/src/components/ui/WysiwygEditor/extensions/ordered-list.js +15 -15
- package/src/components/ui/WysiwygEditor/extensions/paragraph.js +23 -23
- package/src/components/ui/WysiwygEditor/extensions/strike.js +15 -15
- package/src/components/ui/WysiwygEditor/extensions/table-cell.js +13 -13
- package/src/components/ui/WysiwygEditor/extensions/table-header.js +15 -15
- package/src/components/ui/WysiwygEditor/extensions/table-row.js +15 -15
- package/src/components/ui/WysiwygEditor/extensions/table.js +29 -29
- package/src/components/ui/WysiwygEditor/extensions/text-align.js +6 -6
- package/src/components/ui/WysiwygEditor/extensions/text-style.js +15 -15
- package/src/components/ui/WysiwygEditor/extensions/underline.js +15 -15
- package/src/components/ui/WysiwygEditor/index.d.ts +4 -4
- package/src/components/ui/WysiwygEditor/index.js +4 -4
- package/src/components/ui/WysiwygEditor/renders/Button.vue +28 -28
- package/src/components/ui/WysiwygEditor/renders/ColorPicker.vue +41 -41
- package/src/components/ui/WysiwygEditor/renders/InputAuto.vue +34 -34
- package/src/components/ui/WysiwygEditor/renders/InputBrowse.vue +35 -35
- package/src/components/ui/WysiwygEditor/renders/InputUnits.vue +38 -38
- package/src/components/ui/WysiwygEditor/renders/Link.vue +87 -87
- package/src/components/ui/WysiwygEditor/renders/Select.vue +47 -47
- package/src/components/ui/WysiwygEditor/renders/ToolbarPopover.vue +49 -49
- package/src/components/ui/WysiwygEditor/renders/index.d.ts +8 -8
- package/src/components/ui/WysiwygEditor/renders/index.js +8 -8
- package/src/components/ui/WysiwygEditor/renders/mixins/RenderMixin.js +39 -39
- package/src/components/ui/WysiwygEditor/renders/mixins/index.js +1 -1
- package/src/components/ui/WysiwygEditor/tools-and-commands.js +704 -704
- package/src/components/ui/WysiwygEditor/utils.js +72 -72
- package/src/components/ui/WysiwygEditor.md +18 -18
- package/src/components/ui/WysiwygEditor.vue +271 -271
- package/src/components/ui/utils/FormComponent.js +107 -107
- package/src/components/ui/utils/Helpers.js +84 -84
- package/src/components/ui/utils/WithPopover.js +81 -99
- 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,51 +1,51 @@
|
|
|
1
|
-
Simple example
|
|
2
|
-
|
|
3
|
-
```vue
|
|
4
|
-
<template>
|
|
5
|
-
<div class="pad-l5">
|
|
6
|
-
<p>value: {{ model }}</p>
|
|
7
|
-
<input-tags class="w-6-12" v-model="model" v-bind="props"></input-tags>
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
<script>
|
|
11
|
-
export default {
|
|
12
|
-
data() {
|
|
13
|
-
return {
|
|
14
|
-
model: ['hello', 'world'],
|
|
15
|
-
props: {
|
|
16
|
-
placeholder: 'Add a tag...',
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
</script>
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Advanced example. Slots
|
|
25
|
-
|
|
26
|
-
```vue
|
|
27
|
-
<template>
|
|
28
|
-
<div class="pad-l5">
|
|
29
|
-
<p>value: {{ model }}</p>
|
|
30
|
-
<input-tags class="w-6-12" v-model="model" v-bind="props">
|
|
31
|
-
<template #tag="{ tag, remove }">
|
|
32
|
-
<code class="pull-left mar-1">
|
|
33
|
-
{{ tag }} <b class="cursor-pointer" @click="remove(tag)">[x]</b>
|
|
34
|
-
</code>
|
|
35
|
-
</template>
|
|
36
|
-
</input-tags>
|
|
37
|
-
</div>
|
|
38
|
-
</template>
|
|
39
|
-
<script>
|
|
40
|
-
export default {
|
|
41
|
-
data() {
|
|
42
|
-
return {
|
|
43
|
-
model: ['hello', 'world'],
|
|
44
|
-
props: {
|
|
45
|
-
placeholder: 'Add a tag...',
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
</script>
|
|
51
|
-
```
|
|
1
|
+
Simple example
|
|
2
|
+
|
|
3
|
+
```vue
|
|
4
|
+
<template>
|
|
5
|
+
<div class="pad-l5">
|
|
6
|
+
<p>value: {{ model }}</p>
|
|
7
|
+
<input-tags class="w-6-12" v-model="model" v-bind="props"></input-tags>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
<script>
|
|
11
|
+
export default {
|
|
12
|
+
data() {
|
|
13
|
+
return {
|
|
14
|
+
model: ['hello', 'world'],
|
|
15
|
+
props: {
|
|
16
|
+
placeholder: 'Add a tag...',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
</script>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Advanced example. Slots
|
|
25
|
+
|
|
26
|
+
```vue
|
|
27
|
+
<template>
|
|
28
|
+
<div class="pad-l5">
|
|
29
|
+
<p>value: {{ model }}</p>
|
|
30
|
+
<input-tags class="w-6-12" v-model="model" v-bind="props">
|
|
31
|
+
<template #tag="{ tag, remove }">
|
|
32
|
+
<code class="pull-left mar-1">
|
|
33
|
+
{{ tag }} <b class="cursor-pointer" @click="remove(tag)">[x]</b>
|
|
34
|
+
</code>
|
|
35
|
+
</template>
|
|
36
|
+
</input-tags>
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
<script>
|
|
40
|
+
export default {
|
|
41
|
+
data() {
|
|
42
|
+
return {
|
|
43
|
+
model: ['hello', 'world'],
|
|
44
|
+
props: {
|
|
45
|
+
placeholder: 'Add a tag...',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
</script>
|
|
51
|
+
```
|
|
@@ -1,184 +1,184 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="ui-input-tags form-elem" :class="cssClass" @focus="onRootFocus" tabindex="0">
|
|
3
|
-
<div class="ui-input-tags-tags" v-if="value.length">
|
|
4
|
-
<!--
|
|
5
|
-
@slot Tag slot
|
|
6
|
-
@binding {String} tag tag
|
|
7
|
-
@binding {Function} remove remove tag function(tag)
|
|
8
|
-
-->
|
|
9
|
-
<slot name="tag" v-for="tag in value" v-bind="{ tag, remove: removeTag }">
|
|
10
|
-
<ui-badge
|
|
11
|
-
class="ui-input-tags-badge mar-none mar-right-2 mar-bot-2 pull-left"
|
|
12
|
-
theme="primary"
|
|
13
|
-
size="small"
|
|
14
|
-
:key="tag"
|
|
15
|
-
removable
|
|
16
|
-
@remove="removeTag(tag)"
|
|
17
|
-
>
|
|
18
|
-
<span>{{ tag }}</span>
|
|
19
|
-
</ui-badge>
|
|
20
|
-
</slot>
|
|
21
|
-
</div>
|
|
22
|
-
<!--
|
|
23
|
-
@slot Custom input slot
|
|
24
|
-
@binding {String} id input id attribute value
|
|
25
|
-
@binding {String} value input value
|
|
26
|
-
@binding {Function} addTag function to add tag
|
|
27
|
-
@binding {Function} setValue function to set the 'value' function(value)
|
|
28
|
-
@binding {Object} inputBinds input props (use v-bind)
|
|
29
|
-
@binding {Object} inputEvents input events (use v-on)
|
|
30
|
-
-->
|
|
31
|
-
<slot
|
|
32
|
-
name="input"
|
|
33
|
-
v-bind="{
|
|
34
|
-
id: inputId,
|
|
35
|
-
value: newTag,
|
|
36
|
-
addTag,
|
|
37
|
-
setValue: setNewTag,
|
|
38
|
-
inputBinds,
|
|
39
|
-
inputEvents,
|
|
40
|
-
}"
|
|
41
|
-
>
|
|
42
|
-
<input
|
|
43
|
-
:id="inputId"
|
|
44
|
-
class="ui-input-tags-input w-100"
|
|
45
|
-
:class="{ 'mar-top-2': value.length }"
|
|
46
|
-
type="text"
|
|
47
|
-
tabindex="-1"
|
|
48
|
-
:value="newTag"
|
|
49
|
-
v-bind="inputBinds"
|
|
50
|
-
v-on="inputEvents"
|
|
51
|
-
/>
|
|
52
|
-
</slot>
|
|
53
|
-
</div>
|
|
54
|
-
</template>
|
|
55
|
-
<style lang="less" scoped>
|
|
56
|
-
.ui-input-tags {
|
|
57
|
-
display: inline-flex;
|
|
58
|
-
flex-wrap: wrap;
|
|
59
|
-
&-input {
|
|
60
|
-
line-height: 1.5;
|
|
61
|
-
border: none;
|
|
62
|
-
padding: 0;
|
|
63
|
-
color: inherit;
|
|
64
|
-
background: transparent;
|
|
65
|
-
outline: none;
|
|
66
|
-
}
|
|
67
|
-
&-tags {
|
|
68
|
-
max-width: 100%;
|
|
69
|
-
}
|
|
70
|
-
&-badge {
|
|
71
|
-
white-space: normal;
|
|
72
|
-
overflow-wrap: break-word;
|
|
73
|
-
word-break: break-word;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
</style>
|
|
77
|
-
<script>
|
|
78
|
-
import UiBadge from './Badge.vue';
|
|
79
|
-
import FormComponent from './utils/FormComponent';
|
|
80
|
-
|
|
81
|
-
export default {
|
|
82
|
-
components: {
|
|
83
|
-
UiBadge,
|
|
84
|
-
},
|
|
85
|
-
mixins: [FormComponent],
|
|
86
|
-
props: {
|
|
87
|
-
/**
|
|
88
|
-
* @model
|
|
89
|
-
*/
|
|
90
|
-
value: {
|
|
91
|
-
type: Array,
|
|
92
|
-
default() {
|
|
93
|
-
return [];
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
/**
|
|
97
|
-
* Filters new values before adding function(values:Array, valuesNew:Array):Array
|
|
98
|
-
*/
|
|
99
|
-
valueFilter: {
|
|
100
|
-
type: Function,
|
|
101
|
-
default(values, valuesNew) {
|
|
102
|
-
return valuesNew.filter((v, i, a) => a.indexOf(v) === i && !values.includes(v));
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
/**
|
|
106
|
-
* Delimiter
|
|
107
|
-
*/
|
|
108
|
-
delimiter: {
|
|
109
|
-
type: String,
|
|
110
|
-
default: ',',
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
data() {
|
|
114
|
-
return {
|
|
115
|
-
newTag: '',
|
|
116
|
-
inputBinds: {
|
|
117
|
-
placeholder: this.placeholder,
|
|
118
|
-
readonly: this.readonly,
|
|
119
|
-
},
|
|
120
|
-
inputEvents: {
|
|
121
|
-
input: this.onInputInput,
|
|
122
|
-
focus: this.onInputFocus,
|
|
123
|
-
blur: this.onInputBlur,
|
|
124
|
-
keyup: e => e.key == 'Enter' && this.onInputEnter(e),
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
},
|
|
128
|
-
methods: {
|
|
129
|
-
setNewTag(value) {
|
|
130
|
-
this.newTag = value;
|
|
131
|
-
},
|
|
132
|
-
addTag() {
|
|
133
|
-
let newTags = this.valueFilter(
|
|
134
|
-
this.value,
|
|
135
|
-
this.newTag.split(this.delimiter).map(tag => tag.trim())
|
|
136
|
-
);
|
|
137
|
-
if (!newTags.length) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
let tags = [...this.value, ...newTags];
|
|
141
|
-
/**
|
|
142
|
-
* Input event
|
|
143
|
-
* @property {Array} tags
|
|
144
|
-
*/
|
|
145
|
-
this.$emit('input', tags);
|
|
146
|
-
/**
|
|
147
|
-
* Change event
|
|
148
|
-
* @property {Array} tags
|
|
149
|
-
*/
|
|
150
|
-
this.$emit('change', tags);
|
|
151
|
-
this.newTag = '';
|
|
152
|
-
},
|
|
153
|
-
removeTag(tag) {
|
|
154
|
-
let tags = this.value.filter(t => t !== tag);
|
|
155
|
-
/**
|
|
156
|
-
* Input event
|
|
157
|
-
* @property {Array} tags
|
|
158
|
-
*/
|
|
159
|
-
this.$emit('input', tags);
|
|
160
|
-
/**
|
|
161
|
-
* Change event
|
|
162
|
-
* @property {Array} tags
|
|
163
|
-
*/
|
|
164
|
-
this.$emit('change', tags);
|
|
165
|
-
},
|
|
166
|
-
onRootFocus(e) {
|
|
167
|
-
let input = this.getInputRef();
|
|
168
|
-
input && input.focus();
|
|
169
|
-
},
|
|
170
|
-
onInputInput(e) {
|
|
171
|
-
this.newTag = e.target.value;
|
|
172
|
-
},
|
|
173
|
-
onInputFocus(e) {
|
|
174
|
-
this.rootHasFocus = true;
|
|
175
|
-
},
|
|
176
|
-
onInputBlur(e) {
|
|
177
|
-
this.rootHasFocus = false;
|
|
178
|
-
},
|
|
179
|
-
onInputEnter(e) {
|
|
180
|
-
this.addTag();
|
|
181
|
-
},
|
|
182
|
-
},
|
|
183
|
-
};
|
|
184
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ui-input-tags form-elem" :class="cssClass" @focus="onRootFocus" tabindex="0">
|
|
3
|
+
<div class="ui-input-tags-tags" v-if="value.length">
|
|
4
|
+
<!--
|
|
5
|
+
@slot Tag slot
|
|
6
|
+
@binding {String} tag tag
|
|
7
|
+
@binding {Function} remove remove tag function(tag)
|
|
8
|
+
-->
|
|
9
|
+
<slot name="tag" v-for="tag in value" v-bind="{ tag, remove: removeTag }">
|
|
10
|
+
<ui-badge
|
|
11
|
+
class="ui-input-tags-badge mar-none mar-right-2 mar-bot-2 pull-left"
|
|
12
|
+
theme="primary"
|
|
13
|
+
size="small"
|
|
14
|
+
:key="tag"
|
|
15
|
+
removable
|
|
16
|
+
@remove="removeTag(tag)"
|
|
17
|
+
>
|
|
18
|
+
<span>{{ tag }}</span>
|
|
19
|
+
</ui-badge>
|
|
20
|
+
</slot>
|
|
21
|
+
</div>
|
|
22
|
+
<!--
|
|
23
|
+
@slot Custom input slot
|
|
24
|
+
@binding {String} id input id attribute value
|
|
25
|
+
@binding {String} value input value
|
|
26
|
+
@binding {Function} addTag function to add tag
|
|
27
|
+
@binding {Function} setValue function to set the 'value' function(value)
|
|
28
|
+
@binding {Object} inputBinds input props (use v-bind)
|
|
29
|
+
@binding {Object} inputEvents input events (use v-on)
|
|
30
|
+
-->
|
|
31
|
+
<slot
|
|
32
|
+
name="input"
|
|
33
|
+
v-bind="{
|
|
34
|
+
id: inputId,
|
|
35
|
+
value: newTag,
|
|
36
|
+
addTag,
|
|
37
|
+
setValue: setNewTag,
|
|
38
|
+
inputBinds,
|
|
39
|
+
inputEvents,
|
|
40
|
+
}"
|
|
41
|
+
>
|
|
42
|
+
<input
|
|
43
|
+
:id="inputId"
|
|
44
|
+
class="ui-input-tags-input w-100"
|
|
45
|
+
:class="{ 'mar-top-2': value.length }"
|
|
46
|
+
type="text"
|
|
47
|
+
tabindex="-1"
|
|
48
|
+
:value="newTag"
|
|
49
|
+
v-bind="inputBinds"
|
|
50
|
+
v-on="inputEvents"
|
|
51
|
+
/>
|
|
52
|
+
</slot>
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
55
|
+
<style lang="less" scoped>
|
|
56
|
+
.ui-input-tags {
|
|
57
|
+
display: inline-flex;
|
|
58
|
+
flex-wrap: wrap;
|
|
59
|
+
&-input {
|
|
60
|
+
line-height: 1.5;
|
|
61
|
+
border: none;
|
|
62
|
+
padding: 0;
|
|
63
|
+
color: inherit;
|
|
64
|
+
background: transparent;
|
|
65
|
+
outline: none;
|
|
66
|
+
}
|
|
67
|
+
&-tags {
|
|
68
|
+
max-width: 100%;
|
|
69
|
+
}
|
|
70
|
+
&-badge {
|
|
71
|
+
white-space: normal;
|
|
72
|
+
overflow-wrap: break-word;
|
|
73
|
+
word-break: break-word;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
</style>
|
|
77
|
+
<script>
|
|
78
|
+
import UiBadge from './Badge.vue';
|
|
79
|
+
import FormComponent from './utils/FormComponent';
|
|
80
|
+
|
|
81
|
+
export default {
|
|
82
|
+
components: {
|
|
83
|
+
UiBadge,
|
|
84
|
+
},
|
|
85
|
+
mixins: [FormComponent],
|
|
86
|
+
props: {
|
|
87
|
+
/**
|
|
88
|
+
* @model
|
|
89
|
+
*/
|
|
90
|
+
value: {
|
|
91
|
+
type: Array,
|
|
92
|
+
default() {
|
|
93
|
+
return [];
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
/**
|
|
97
|
+
* Filters new values before adding function(values:Array, valuesNew:Array):Array
|
|
98
|
+
*/
|
|
99
|
+
valueFilter: {
|
|
100
|
+
type: Function,
|
|
101
|
+
default(values, valuesNew) {
|
|
102
|
+
return valuesNew.filter((v, i, a) => a.indexOf(v) === i && !values.includes(v));
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* Delimiter
|
|
107
|
+
*/
|
|
108
|
+
delimiter: {
|
|
109
|
+
type: String,
|
|
110
|
+
default: ',',
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
data() {
|
|
114
|
+
return {
|
|
115
|
+
newTag: '',
|
|
116
|
+
inputBinds: {
|
|
117
|
+
placeholder: this.placeholder,
|
|
118
|
+
readonly: this.readonly,
|
|
119
|
+
},
|
|
120
|
+
inputEvents: {
|
|
121
|
+
input: this.onInputInput,
|
|
122
|
+
focus: this.onInputFocus,
|
|
123
|
+
blur: this.onInputBlur,
|
|
124
|
+
keyup: e => e.key == 'Enter' && this.onInputEnter(e),
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
methods: {
|
|
129
|
+
setNewTag(value) {
|
|
130
|
+
this.newTag = value;
|
|
131
|
+
},
|
|
132
|
+
addTag() {
|
|
133
|
+
let newTags = this.valueFilter(
|
|
134
|
+
this.value,
|
|
135
|
+
this.newTag.split(this.delimiter).map(tag => tag.trim())
|
|
136
|
+
);
|
|
137
|
+
if (!newTags.length) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
let tags = [...this.value, ...newTags];
|
|
141
|
+
/**
|
|
142
|
+
* Input event
|
|
143
|
+
* @property {Array} tags
|
|
144
|
+
*/
|
|
145
|
+
this.$emit('input', tags);
|
|
146
|
+
/**
|
|
147
|
+
* Change event
|
|
148
|
+
* @property {Array} tags
|
|
149
|
+
*/
|
|
150
|
+
this.$emit('change', tags);
|
|
151
|
+
this.newTag = '';
|
|
152
|
+
},
|
|
153
|
+
removeTag(tag) {
|
|
154
|
+
let tags = this.value.filter(t => t !== tag);
|
|
155
|
+
/**
|
|
156
|
+
* Input event
|
|
157
|
+
* @property {Array} tags
|
|
158
|
+
*/
|
|
159
|
+
this.$emit('input', tags);
|
|
160
|
+
/**
|
|
161
|
+
* Change event
|
|
162
|
+
* @property {Array} tags
|
|
163
|
+
*/
|
|
164
|
+
this.$emit('change', tags);
|
|
165
|
+
},
|
|
166
|
+
onRootFocus(e) {
|
|
167
|
+
let input = this.getInputRef();
|
|
168
|
+
input && input.focus();
|
|
169
|
+
},
|
|
170
|
+
onInputInput(e) {
|
|
171
|
+
this.newTag = e.target.value;
|
|
172
|
+
},
|
|
173
|
+
onInputFocus(e) {
|
|
174
|
+
this.rootHasFocus = true;
|
|
175
|
+
},
|
|
176
|
+
onInputBlur(e) {
|
|
177
|
+
this.rootHasFocus = false;
|
|
178
|
+
},
|
|
179
|
+
onInputEnter(e) {
|
|
180
|
+
this.addTag();
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
</script>
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
Simple example
|
|
2
|
-
|
|
3
|
-
```vue
|
|
4
|
-
<template>
|
|
5
|
-
<div class="pad-l5">
|
|
6
|
-
<p>value: {{ model }}</p>
|
|
7
|
-
<input-time-picker class="w-f1" v-model="model" v-bind="props"></input-time-picker>
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
<script>
|
|
11
|
-
export default {
|
|
12
|
-
data() {
|
|
13
|
-
return {
|
|
14
|
-
model: '16:45',
|
|
15
|
-
props: {
|
|
16
|
-
placeholder: 'Pick a time',
|
|
17
|
-
timepicker: {
|
|
18
|
-
step: { h: 1, m: 5 },
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
</script>
|
|
25
|
-
```
|
|
1
|
+
Simple example
|
|
2
|
+
|
|
3
|
+
```vue
|
|
4
|
+
<template>
|
|
5
|
+
<div class="pad-l5">
|
|
6
|
+
<p>value: {{ model }}</p>
|
|
7
|
+
<input-time-picker class="w-f1" v-model="model" v-bind="props"></input-time-picker>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
<script>
|
|
11
|
+
export default {
|
|
12
|
+
data() {
|
|
13
|
+
return {
|
|
14
|
+
model: '16:45',
|
|
15
|
+
props: {
|
|
16
|
+
placeholder: 'Pick a time',
|
|
17
|
+
timepicker: {
|
|
18
|
+
step: { h: 1, m: 5 },
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
</script>
|
|
25
|
+
```
|