@ozdao/martyrs 0.2.541 → 0.2.542
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/dist/_virtual/index.cjs +4 -4
- package/dist/_virtual/index.js +4 -4
- package/dist/_virtual/index2.cjs +3 -6
- package/dist/_virtual/index2.cjs.map +1 -1
- package/dist/_virtual/index2.js +2 -5
- package/dist/_virtual/index2.js.map +1 -1
- package/dist/{main-BpBtIUcJ.js → main-ByKkD9qa.js} +2724 -3143
- package/dist/main-Czyu-VcC.cjs +11 -0
- package/dist/martyrs/src/components/FieldTags/BlockTags.vue.cjs +30 -21
- package/dist/martyrs/src/components/FieldTags/BlockTags.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/FieldTags/BlockTags.vue.js +32 -23
- package/dist/martyrs/src/components/FieldTags/BlockTags.vue.js.map +1 -1
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue2.cjs +235 -0
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue2.js +235 -0
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue2.js.map +1 -0
- package/dist/martyrs/src/components/Marquee/Marquee.vue.cjs +17 -8
- package/dist/martyrs/src/components/Marquee/Marquee.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/Marquee/Marquee.vue.js +17 -8
- package/dist/martyrs/src/components/Marquee/Marquee.vue.js.map +1 -1
- package/dist/martyrs/src/components/Spoiler/{Spoiler.vue.cjs → Spoiler.vue2.cjs} +2 -2
- package/dist/martyrs/src/components/Spoiler/Spoiler.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/Spoiler/{Spoiler.vue.js → Spoiler.vue2.js} +2 -2
- package/dist/martyrs/src/components/Spoiler/{Spoiler.vue.cjs.map → Spoiler.vue2.js.map} +1 -1
- package/dist/martyrs/src/components/Tab/{Tab.vue.cjs → Tab.vue2.cjs} +2 -2
- package/dist/martyrs/src/components/Tab/Tab.vue2.cjs.map +1 -0
- package/dist/martyrs/src/components/Tab/{Tab.vue.js → Tab.vue2.js} +2 -2
- package/dist/martyrs/src/components/Tab/{Tab.vue.cjs.map → Tab.vue2.js.map} +1 -1
- package/dist/martyrs/src/components/UploadImage/UploadImage.vue.cjs +161 -42
- package/dist/martyrs/src/components/UploadImage/UploadImage.vue.cjs.map +1 -1
- package/dist/martyrs/src/components/UploadImage/UploadImage.vue.js +162 -43
- package/dist/martyrs/src/components/UploadImage/UploadImage.vue.js.map +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/EnterPassword.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/Invite.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileBlogposts.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileBlogposts.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ProfileEditProfile.vue.js +4 -4
- package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/ResetPassword.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignIn.vue.js +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.cjs +1 -1
- package/dist/martyrs/src/modules/auth/views/components/pages/SignUp.vue.js +1 -1
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.cjs +0 -3
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.js +0 -3
- package/dist/martyrs/src/modules/community/components/pages/CreateBlogPost.vue.js.map +1 -1
- package/dist/martyrs/src/modules/constructor/components/elements/Card.vue.js +2 -2
- package/dist/martyrs/src/modules/events/components/pages/EditEvent.vue.js +21 -21
- package/dist/martyrs/src/modules/events/components/pages/EventsBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/events/components/pages/EventsBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/classes/globals.i18n.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/classes/globals.i18n.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/partials/Navigation.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/SectionPageTitle.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/SectionPageTitle.vue.js +1 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/Walkthrough.vue.cjs +1 -1
- package/dist/martyrs/src/modules/globals/views/components/sections/Walkthrough.vue.js +1 -1
- package/dist/martyrs/src/modules/landing/components/sections/SectionGuide.vue.cjs +1 -1
- package/dist/martyrs/src/modules/landing/components/sections/SectionGuide.vue.js +1 -1
- package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.cjs +1 -1
- package/dist/martyrs/src/modules/marketplace/views/components/layouts/Marketplace.vue.js +1 -1
- package/dist/martyrs/src/modules/music/components/forms/AlbumForm.vue.js +11 -11
- package/dist/martyrs/src/modules/music/components/forms/ArtistForm.vue.js +12 -12
- package/dist/martyrs/src/modules/music/components/forms/PlaylistForm.vue.js +16 -16
- package/dist/martyrs/src/modules/music/components/forms/TrackForm.vue.js +16 -16
- package/dist/martyrs/src/modules/notifications/components/pages/Notifications.vue.cjs +1 -1
- package/dist/martyrs/src/modules/notifications/components/pages/Notifications.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.cjs +1 -1
- package/dist/martyrs/src/modules/orders/components/pages/Orders.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.cjs +3 -4
- package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.js +3 -4
- package/dist/martyrs/src/modules/organizations/components/blocks/CardDepartment.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/forms/DepartmentForm.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/forms/DepartmentForm.vue.js +20 -20
- package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.cjs +3 -4
- package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.js +3 -4
- package/dist/martyrs/src/modules/organizations/components/pages/Department.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs +4 -5
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js +4 -5
- package/dist/martyrs/src/modules/organizations/components/pages/Members.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs +3 -4
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js +3 -4
- package/dist/martyrs/src/modules/organizations/components/pages/Organization.vue.js.map +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/OrganizationEdit.vue.js +7 -7
- package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/pages/Organizations.vue.js +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.cjs +1 -1
- package/dist/martyrs/src/modules/organizations/components/sections/Organizations.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs +46 -38
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.cjs.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js +52 -44
- package/dist/martyrs/src/modules/products/components/pages/CategoryEdit.vue.js.map +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Product.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/pages/ProductEdit.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.cjs +2 -2
- package/dist/martyrs/src/modules/products/components/pages/Products.vue.js +2 -2
- package/dist/martyrs/src/modules/products/components/sections/FilterProducts.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/sections/FilterProducts.vue.js +1 -1
- package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
- package/dist/martyrs/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/Gant/GanttToolbar.vue.cjs +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/Gant/GanttToolbar.vue.js +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/Rents.vue.cjs +1 -1
- package/dist/martyrs/src/modules/rents/views/components/pages/Rents.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/layouts/Spots.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/Spot.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/Spot.vue.js +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.cjs +1 -1
- package/dist/martyrs/src/modules/spots/components/pages/SpotEdit.vue.js +11 -11
- package/dist/martyrs.cjs.js +1 -1
- package/dist/martyrs.css +1 -1
- package/dist/martyrs.es.js +1 -1
- package/dist/node_modules/.pnpm/lodash.merge@4.6.2/node_modules/lodash.merge/index.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash.merge@4.6.2/node_modules/lodash.merge/index.js +1 -1
- package/dist/style.css +129 -129
- package/dist/{web-DsdyXC8n.js → web-BklgIiYr.js} +1 -1
- package/dist/{web-C9bVm6Nw.cjs → web-CQBm7C6L.cjs} +1 -1
- package/package.json +1 -1
- package/src/components/FieldTags/BlockTags.vue +28 -16
- package/src/components/FieldTags/FieldTags.vue +327 -508
- package/src/components/Marquee/Marquee.vue +25 -14
- package/src/components/UploadImage/UploadImage.vue +192 -18
- package/src/modules/community/components/pages/CreateBlogPost.vue +0 -1
- package/src/modules/products/components/pages/CategoryEdit.vue +53 -39
- package/dist/_virtual/index3.cjs +0 -5
- package/dist/_virtual/index3.cjs.map +0 -1
- package/dist/_virtual/index3.js +0 -5
- package/dist/_virtual/index3.js.map +0 -1
- package/dist/main-7IA3UHca.cjs +0 -11
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue.cjs +0 -480
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue.cjs.map +0 -1
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue.js +0 -480
- package/dist/martyrs/src/components/FieldTags/FieldTags.vue.js.map +0 -1
- package/dist/martyrs/src/components/FieldTags/create-tags.cjs +0 -52
- package/dist/martyrs/src/components/FieldTags/create-tags.cjs.map +0 -1
- package/dist/martyrs/src/components/FieldTags/create-tags.js +0 -52
- package/dist/martyrs/src/components/FieldTags/create-tags.js.map +0 -1
- package/dist/martyrs/src/components/FieldTags/tag-input.vue2.cjs +0 -32
- package/dist/martyrs/src/components/FieldTags/tag-input.vue2.cjs.map +0 -1
- package/dist/martyrs/src/components/FieldTags/tag-input.vue2.js +0 -32
- package/dist/martyrs/src/components/FieldTags/tag-input.vue2.js.map +0 -1
- package/dist/martyrs/src/components/FieldTags/vue-tags-input.props.cjs +0 -329
- package/dist/martyrs/src/components/FieldTags/vue-tags-input.props.cjs.map +0 -1
- package/dist/martyrs/src/components/FieldTags/vue-tags-input.props.js +0 -329
- package/dist/martyrs/src/components/FieldTags/vue-tags-input.props.js.map +0 -1
- package/dist/martyrs/src/components/Spoiler/Spoiler.vue.js.map +0 -1
- package/dist/martyrs/src/components/Tab/Tab.vue.js.map +0 -1
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.cjs +0 -39
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +0 -39
- package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js.map +0 -1
- package/src/components/FieldTags/FieldTagsNew.vue +0 -366
- package/src/components/FieldTags/README.md +0 -513
- package/src/components/FieldTags/create-tags.js +0 -97
- package/src/components/FieldTags/tag-input.vue +0 -55
- package/src/components/FieldTags/vue-tags-input.props.js +0 -342
- package/src/components/FieldTags/vue-tags-input.scss +0 -149
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="field-tags-new">
|
|
3
|
-
<!-- Tags container -->
|
|
4
|
-
<div class="tags-container">
|
|
5
|
-
<span
|
|
6
|
-
v-for="(tag, index) in tags"
|
|
7
|
-
:key="index"
|
|
8
|
-
class="tag"
|
|
9
|
-
>
|
|
10
|
-
{{ getTagText(tag) }}
|
|
11
|
-
<button
|
|
12
|
-
@click="removeTag(index)"
|
|
13
|
-
class="tag-remove"
|
|
14
|
-
type="button"
|
|
15
|
-
>
|
|
16
|
-
×
|
|
17
|
-
</button>
|
|
18
|
-
</span>
|
|
19
|
-
|
|
20
|
-
<input
|
|
21
|
-
ref="inputRef"
|
|
22
|
-
v-model="newTag"
|
|
23
|
-
@keydown="handleKeyDown"
|
|
24
|
-
@paste="handlePaste"
|
|
25
|
-
@focus="focused = true"
|
|
26
|
-
@blur="handleBlur"
|
|
27
|
-
:placeholder="placeholder || 'Add tags'"
|
|
28
|
-
:maxlength="maxlength"
|
|
29
|
-
:disabled="disabled"
|
|
30
|
-
class="tag-input"
|
|
31
|
-
/>
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<!-- Autocomplete dropdown -->
|
|
35
|
-
<div
|
|
36
|
-
v-if="showAutocomplete && filteredAutocomplete.length > 0"
|
|
37
|
-
class="autocomplete"
|
|
38
|
-
>
|
|
39
|
-
<div
|
|
40
|
-
v-for="(item, index) in filteredAutocomplete"
|
|
41
|
-
:key="getTagText(item)"
|
|
42
|
-
@click="addTag(item)"
|
|
43
|
-
@mouseenter="selectedIndex = index"
|
|
44
|
-
:class="['autocomplete-item', { selected: selectedIndex === index }]"
|
|
45
|
-
>
|
|
46
|
-
{{ getTagText(item) }}
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</template>
|
|
51
|
-
|
|
52
|
-
<script setup>
|
|
53
|
-
import { ref, computed, watch } from 'vue'
|
|
54
|
-
|
|
55
|
-
const props = defineProps({
|
|
56
|
-
modelValue: Array,
|
|
57
|
-
textField: {
|
|
58
|
-
type: String,
|
|
59
|
-
default: 'text'
|
|
60
|
-
},
|
|
61
|
-
autocompleteItems: Array,
|
|
62
|
-
separators: {
|
|
63
|
-
type: Array,
|
|
64
|
-
default: () => [',', ';']
|
|
65
|
-
},
|
|
66
|
-
addOnKey: {
|
|
67
|
-
type: Array,
|
|
68
|
-
default: () => [13] // Enter key
|
|
69
|
-
},
|
|
70
|
-
maxTags: {
|
|
71
|
-
type: Number,
|
|
72
|
-
default: 20
|
|
73
|
-
},
|
|
74
|
-
maxlength: {
|
|
75
|
-
type: Number,
|
|
76
|
-
default: 50
|
|
77
|
-
},
|
|
78
|
-
placeholder: String,
|
|
79
|
-
disabled: Boolean,
|
|
80
|
-
addOnBlur: {
|
|
81
|
-
type: Boolean,
|
|
82
|
-
default: true
|
|
83
|
-
},
|
|
84
|
-
autocompleteMinLength: {
|
|
85
|
-
type: Number,
|
|
86
|
-
default: 1
|
|
87
|
-
}
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
const emit = defineEmits(['update:modelValue', 'tags-changed'])
|
|
91
|
-
|
|
92
|
-
// State
|
|
93
|
-
const newTag = ref('')
|
|
94
|
-
const focused = ref(false)
|
|
95
|
-
const selectedIndex = ref(-1)
|
|
96
|
-
const inputRef = ref(null)
|
|
97
|
-
|
|
98
|
-
// Computed
|
|
99
|
-
const tags = computed({
|
|
100
|
-
get: () => props.modelValue || [],
|
|
101
|
-
set: (value) => {
|
|
102
|
-
emit('update:modelValue', value)
|
|
103
|
-
emit('tags-changed', value)
|
|
104
|
-
}
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
const showAutocomplete = computed(() => {
|
|
108
|
-
return focused.value &&
|
|
109
|
-
props.autocompleteItems?.length > 0 &&
|
|
110
|
-
newTag.value.length >= props.autocompleteMinLength
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
const filteredAutocomplete = computed(() => {
|
|
114
|
-
if (!props.autocompleteItems) return []
|
|
115
|
-
|
|
116
|
-
const searchText = newTag.value.toLowerCase()
|
|
117
|
-
|
|
118
|
-
return props.autocompleteItems.filter(item => {
|
|
119
|
-
const itemText = getTagText(item).toLowerCase()
|
|
120
|
-
|
|
121
|
-
// Filter by search text
|
|
122
|
-
if (!itemText.includes(searchText)) return false
|
|
123
|
-
|
|
124
|
-
// Filter out duplicates
|
|
125
|
-
return !isDuplicate(itemText)
|
|
126
|
-
})
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
// Methods
|
|
130
|
-
function getTagText(tag) {
|
|
131
|
-
if (tag === null || tag === undefined) return ''
|
|
132
|
-
if (typeof tag === 'string') return tag
|
|
133
|
-
return tag[props.textField] || ''
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function createTag(text) {
|
|
137
|
-
// Preserve format based on existing data
|
|
138
|
-
if (tags.value.length > 0) {
|
|
139
|
-
if (typeof tags.value[0] === 'string') {
|
|
140
|
-
return text
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Default to object with custom field
|
|
145
|
-
return { [props.textField]: text }
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function isDuplicate(text) {
|
|
149
|
-
const searchText = text.toLowerCase().trim()
|
|
150
|
-
return tags.value.some(tag =>
|
|
151
|
-
getTagText(tag).toLowerCase().trim() === searchText
|
|
152
|
-
)
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function addTag(input) {
|
|
156
|
-
let text = ''
|
|
157
|
-
|
|
158
|
-
if (typeof input === 'string') {
|
|
159
|
-
text = input.trim()
|
|
160
|
-
} else if (typeof input === 'object') {
|
|
161
|
-
// If it's an autocomplete item, preserve the whole object
|
|
162
|
-
if (props.autocompleteItems?.includes(input)) {
|
|
163
|
-
if (!isDuplicate(getTagText(input))) {
|
|
164
|
-
tags.value = [...tags.value, input]
|
|
165
|
-
}
|
|
166
|
-
newTag.value = ''
|
|
167
|
-
selectedIndex.value = -1
|
|
168
|
-
return
|
|
169
|
-
}
|
|
170
|
-
text = getTagText(input).trim()
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (!text || tags.value.length >= props.maxTags) return
|
|
174
|
-
|
|
175
|
-
if (isDuplicate(text)) return
|
|
176
|
-
|
|
177
|
-
const tag = createTag(text)
|
|
178
|
-
tags.value = [...tags.value, tag]
|
|
179
|
-
newTag.value = ''
|
|
180
|
-
selectedIndex.value = -1
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function removeTag(index) {
|
|
184
|
-
if (props.disabled) return
|
|
185
|
-
|
|
186
|
-
const newTags = [...tags.value]
|
|
187
|
-
newTags.splice(index, 1)
|
|
188
|
-
tags.value = newTags
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function handleKeyDown(event) {
|
|
192
|
-
// Handle arrow keys for autocomplete navigation
|
|
193
|
-
if (showAutocomplete.value) {
|
|
194
|
-
if (event.key === 'ArrowDown') {
|
|
195
|
-
event.preventDefault()
|
|
196
|
-
selectedIndex.value = Math.min(
|
|
197
|
-
selectedIndex.value + 1,
|
|
198
|
-
filteredAutocomplete.value.length - 1
|
|
199
|
-
)
|
|
200
|
-
return
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (event.key === 'ArrowUp') {
|
|
204
|
-
event.preventDefault()
|
|
205
|
-
selectedIndex.value = Math.max(selectedIndex.value - 1, -1)
|
|
206
|
-
return
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// Add selected autocomplete item on Enter
|
|
210
|
-
if (event.key === 'Enter' && selectedIndex.value >= 0) {
|
|
211
|
-
event.preventDefault()
|
|
212
|
-
addTag(filteredAutocomplete.value[selectedIndex.value])
|
|
213
|
-
return
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// Check for add triggers
|
|
218
|
-
const shouldAdd = props.addOnKey.some(key => {
|
|
219
|
-
if (typeof key === 'number') {
|
|
220
|
-
return event.keyCode === key
|
|
221
|
-
}
|
|
222
|
-
return event.key === key
|
|
223
|
-
})
|
|
224
|
-
|
|
225
|
-
if (shouldAdd) {
|
|
226
|
-
event.preventDefault()
|
|
227
|
-
addTag(newTag.value)
|
|
228
|
-
return
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// Handle backspace to delete last tag
|
|
232
|
-
if (event.key === 'Backspace' && newTag.value === '' && tags.value.length > 0) {
|
|
233
|
-
removeTag(tags.value.length - 1)
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function handlePaste(event) {
|
|
238
|
-
event.preventDefault()
|
|
239
|
-
|
|
240
|
-
const text = event.clipboardData.getData('text')
|
|
241
|
-
if (!text) return
|
|
242
|
-
|
|
243
|
-
// Create regex from separators
|
|
244
|
-
const separatorRegex = new RegExp(
|
|
245
|
-
props.separators.map(s => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|')
|
|
246
|
-
)
|
|
247
|
-
|
|
248
|
-
// Split by separators and add each tag
|
|
249
|
-
const parts = text.split(separatorRegex)
|
|
250
|
-
|
|
251
|
-
parts.forEach(part => {
|
|
252
|
-
if (tags.value.length >= props.maxTags) return
|
|
253
|
-
addTag(part)
|
|
254
|
-
})
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function handleBlur() {
|
|
258
|
-
// Small delay to allow click on autocomplete items
|
|
259
|
-
setTimeout(() => {
|
|
260
|
-
focused.value = false
|
|
261
|
-
selectedIndex.value = -1
|
|
262
|
-
|
|
263
|
-
if (props.addOnBlur && newTag.value) {
|
|
264
|
-
addTag(newTag.value)
|
|
265
|
-
}
|
|
266
|
-
}, 200)
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// Reset selected index when autocomplete items change
|
|
270
|
-
watch(filteredAutocomplete, () => {
|
|
271
|
-
selectedIndex.value = -1
|
|
272
|
-
})
|
|
273
|
-
</script>
|
|
274
|
-
|
|
275
|
-
<style scoped>
|
|
276
|
-
.field-tags-new {
|
|
277
|
-
position: relative;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
.tags-container {
|
|
281
|
-
display: flex;
|
|
282
|
-
flex-wrap: wrap;
|
|
283
|
-
align-items: center;
|
|
284
|
-
gap: 0.5rem;
|
|
285
|
-
padding: 0.5rem;
|
|
286
|
-
background: rgb(var(--gray-light, 248, 248, 248));
|
|
287
|
-
border-radius: 0.5rem;
|
|
288
|
-
min-height: 3rem;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
.tag {
|
|
292
|
-
display: inline-flex;
|
|
293
|
-
align-items: center;
|
|
294
|
-
background: rgb(var(--main, 255, 215, 0));
|
|
295
|
-
color: rgb(var(--black, 0, 0, 0));
|
|
296
|
-
padding: 0.25rem 0.5rem;
|
|
297
|
-
border-radius: 2rem;
|
|
298
|
-
font-size: 0.875rem;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
.tag-remove {
|
|
302
|
-
margin-left: 0.25rem;
|
|
303
|
-
background: none;
|
|
304
|
-
border: none;
|
|
305
|
-
color: inherit;
|
|
306
|
-
font-size: 1.25rem;
|
|
307
|
-
cursor: pointer;
|
|
308
|
-
padding: 0;
|
|
309
|
-
line-height: 1;
|
|
310
|
-
opacity: 0.7;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.tag-remove:hover {
|
|
314
|
-
opacity: 1;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
.tag-input {
|
|
318
|
-
flex: 1;
|
|
319
|
-
border: none;
|
|
320
|
-
background: none;
|
|
321
|
-
outline: none;
|
|
322
|
-
min-width: 150px;
|
|
323
|
-
padding: 0.25rem;
|
|
324
|
-
font-size: inherit;
|
|
325
|
-
font-family: inherit;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
.tag-input:disabled {
|
|
329
|
-
cursor: not-allowed;
|
|
330
|
-
opacity: 0.5;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
.autocomplete {
|
|
334
|
-
position: absolute;
|
|
335
|
-
top: 100%;
|
|
336
|
-
left: 0;
|
|
337
|
-
right: 0;
|
|
338
|
-
margin-top: 0.25rem;
|
|
339
|
-
background: white;
|
|
340
|
-
border: 1px solid rgb(var(--gray, 224, 224, 224));
|
|
341
|
-
border-radius: 0.5rem;
|
|
342
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
343
|
-
max-height: 200px;
|
|
344
|
-
overflow-y: auto;
|
|
345
|
-
z-index: 100;
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
.autocomplete-item {
|
|
349
|
-
padding: 0.5rem 0.75rem;
|
|
350
|
-
cursor: pointer;
|
|
351
|
-
transition: background-color 0.2s;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
.autocomplete-item:hover,
|
|
355
|
-
.autocomplete-item.selected {
|
|
356
|
-
background: rgb(var(--gray-light, 248, 248, 248));
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
.autocomplete-item:first-child {
|
|
360
|
-
border-radius: 0.5rem 0.5rem 0 0;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
.autocomplete-item:last-child {
|
|
364
|
-
border-radius: 0 0 0.5rem 0.5rem;
|
|
365
|
-
}
|
|
366
|
-
</style>
|