@opentiny/vue-search-box 0.0.1
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/README.md +111 -0
- package/es/composables/use-checkbox.es.js +87 -0
- package/es/composables/use-custom.es.js +48 -0
- package/es/composables/use-datepicker.es.js +86 -0
- package/es/composables/use-dropdown.es.js +207 -0
- package/es/composables/use-edit.es.js +106 -0
- package/es/composables/use-init.es.js +64 -0
- package/es/composables/use-match.es.js +170 -0
- package/es/composables/use-num-range.es.js +77 -0
- package/es/composables/use-placeholder.es.js +41 -0
- package/es/composables/use-tag.es.js +51 -0
- package/es/index-DCPOFFNd.css +337 -0
- package/es/index.es.js +10 -0
- package/es/index.type.es.js +1 -0
- package/es/index.vue.es.js +4 -0
- package/es/index.vue.es2.js +1287 -0
- package/es/smb-theme.es.js +18 -0
- package/es/utils/clone.es.js +29 -0
- package/es/utils/date.es.js +431 -0
- package/es/utils/dropdown.es.js +20 -0
- package/es/utils/en_US.es.js +44 -0
- package/es/utils/index.es.js +13 -0
- package/es/utils/tag.es.js +46 -0
- package/es/utils/type.es.js +4 -0
- package/es/utils/validate.es.js +179 -0
- package/es/utils/zh_CN.es.js +44 -0
- package/index.css +337 -0
- package/lib/composables/use-checkbox.cjs.js +87 -0
- package/lib/composables/use-custom.cjs.js +48 -0
- package/lib/composables/use-datepicker.cjs.js +86 -0
- package/lib/composables/use-dropdown.cjs.js +207 -0
- package/lib/composables/use-edit.cjs.js +106 -0
- package/lib/composables/use-init.cjs.js +64 -0
- package/lib/composables/use-match.cjs.js +170 -0
- package/lib/composables/use-num-range.cjs.js +77 -0
- package/lib/composables/use-placeholder.cjs.js +41 -0
- package/lib/composables/use-tag.cjs.js +51 -0
- package/lib/index-DCPOFFNd.css +337 -0
- package/lib/index.cjs.js +10 -0
- package/lib/index.type.cjs.js +1 -0
- package/lib/index.vue.cjs.js +4 -0
- package/lib/index.vue.cjs2.js +1287 -0
- package/lib/smb-theme.cjs.js +18 -0
- package/lib/utils/clone.cjs.js +29 -0
- package/lib/utils/date.cjs.js +431 -0
- package/lib/utils/dropdown.cjs.js +20 -0
- package/lib/utils/en_US.cjs.js +44 -0
- package/lib/utils/index.cjs.js +13 -0
- package/lib/utils/tag.cjs.js +46 -0
- package/lib/utils/type.cjs.js +4 -0
- package/lib/utils/validate.cjs.js +179 -0
- package/lib/utils/zh_CN.cjs.js +44 -0
- package/package.json +65 -0
- package/types/composables/use-checkbox.d.ts +10 -0
- package/types/composables/use-custom.d.ts +7 -0
- package/types/composables/use-datepicker.d.ts +11 -0
- package/types/composables/use-dropdown.d.ts +13 -0
- package/types/composables/use-edit.d.ts +13 -0
- package/types/composables/use-init.d.ts +10 -0
- package/types/composables/use-match.d.ts +8 -0
- package/types/composables/use-num-range.d.ts +9 -0
- package/types/composables/use-placeholder.d.ts +8 -0
- package/types/composables/use-tag.d.ts +9 -0
- package/types/index.type.d.ts +189 -0
- package/types/smb-theme.d.ts +15 -0
- package/types/utils/clone.d.ts +12 -0
- package/types/utils/date.d.ts +234 -0
- package/types/utils/dropdown.d.ts +12 -0
- package/types/utils/en_US.d.ts +41 -0
- package/types/utils/index.d.ts +1 -0
- package/types/utils/tag.d.ts +46 -0
- package/types/utils/type.d.ts +6 -0
- package/types/utils/validate.d.ts +31 -0
- package/types/utils/zh_CN.d.ts +41 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { showDropdown, showPopover } from "../utils/dropdown.es.js";
|
|
2
|
+
function useInit({ props, state }) {
|
|
3
|
+
const { instance } = state;
|
|
4
|
+
const initItems = () => {
|
|
5
|
+
state.groupItems = {};
|
|
6
|
+
state.recordItems.forEach((item) => {
|
|
7
|
+
const { groupKey = "0" } = item;
|
|
8
|
+
if (state.groupItems[groupKey]) {
|
|
9
|
+
state.groupItems[groupKey].push({ ...item });
|
|
10
|
+
} else {
|
|
11
|
+
state.groupItems[groupKey] = [{ ...item }];
|
|
12
|
+
state.matchItems[groupKey] = { attr: [], attrValue: [] };
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
const handleClick = (e) => {
|
|
17
|
+
const { backupPrevItem, prevItem } = state;
|
|
18
|
+
e.stopPropagation();
|
|
19
|
+
state.isResetFlag = true;
|
|
20
|
+
if (props.editable) {
|
|
21
|
+
state.popoverVisible = false;
|
|
22
|
+
state.currentEditValue = [];
|
|
23
|
+
if (state.propItem.label && backupPrevItem && backupPrevItem !== prevItem) {
|
|
24
|
+
state.prevItem = backupPrevItem;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (!state.isShowPanel || props.items.length === 0) {
|
|
28
|
+
showDropdown(state, false);
|
|
29
|
+
} else {
|
|
30
|
+
showDropdown(state);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const watchOutsideClick = () => {
|
|
34
|
+
var _a, _b, _c;
|
|
35
|
+
if (!state.isMouseDown) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (props.editable) {
|
|
39
|
+
showPopover(state, false);
|
|
40
|
+
}
|
|
41
|
+
state.isMouseDown = false;
|
|
42
|
+
if ((_c = (_b = (_a = instance == null ? void 0 : instance.refs) == null ? void 0 : _a.dropdownRef) == null ? void 0 : _b.state) == null ? void 0 : _c.visible) {
|
|
43
|
+
showDropdown(state, false);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const watchMouseDown = () => {
|
|
47
|
+
state.isMouseDown = true;
|
|
48
|
+
};
|
|
49
|
+
const watchMouseMove = () => {
|
|
50
|
+
if (state.isMouseDown) {
|
|
51
|
+
state.isMouseDown = false;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
initItems,
|
|
56
|
+
watchOutsideClick,
|
|
57
|
+
watchMouseDown,
|
|
58
|
+
watchMouseMove,
|
|
59
|
+
handleClick
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
useInit
|
|
64
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { ref, watch } from "vue";
|
|
2
|
+
import Loading from "@opentiny/vue-loading";
|
|
3
|
+
import { debounce } from "../utils/index.es.js";
|
|
4
|
+
import { hasTagItem, getTagId, createNewTag, emitChangeModelEvent } from "../utils/tag.es.js";
|
|
5
|
+
import { showDropdown } from "../utils/dropdown.es.js";
|
|
6
|
+
const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7
|
+
const getHighlightMatch = (labelRegex, label, valueLength) => {
|
|
8
|
+
const match = [];
|
|
9
|
+
let lastIndex;
|
|
10
|
+
while (labelRegex.exec(label) !== null) {
|
|
11
|
+
lastIndex = labelRegex.lastIndex;
|
|
12
|
+
const startIndex = lastIndex - valueLength;
|
|
13
|
+
const prevMatch = label.slice(0, startIndex);
|
|
14
|
+
const currentMatch = [label.slice(startIndex, lastIndex)];
|
|
15
|
+
prevMatch && match.push(prevMatch);
|
|
16
|
+
match.push(currentMatch);
|
|
17
|
+
}
|
|
18
|
+
if (lastIndex < label.length) {
|
|
19
|
+
match.push(label.slice(lastIndex));
|
|
20
|
+
}
|
|
21
|
+
return match;
|
|
22
|
+
};
|
|
23
|
+
function useMatch({ props, state, emits }) {
|
|
24
|
+
const loadingInstance = ref(null);
|
|
25
|
+
watch(
|
|
26
|
+
() => state.inputValue,
|
|
27
|
+
(newInput) => {
|
|
28
|
+
if (!newInput.trim()) {
|
|
29
|
+
state.isShowDropdown = true;
|
|
30
|
+
} else {
|
|
31
|
+
state.isShowDropdown = false;
|
|
32
|
+
}
|
|
33
|
+
showDropdown(state, false);
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
const getMatchList = async (keyword) => {
|
|
37
|
+
!loadingInstance.value && (loadingInstance.value = Loading.service({
|
|
38
|
+
target: document.getElementById("potential-loading")
|
|
39
|
+
}));
|
|
40
|
+
state.potentialOptions = await props.potentialOptions.getMatchList(keyword);
|
|
41
|
+
loadingInstance.value && loadingInstance.value.close();
|
|
42
|
+
if (state.potentialOptions.length) {
|
|
43
|
+
state.isShowDropdown = true;
|
|
44
|
+
}
|
|
45
|
+
showDropdown(state, state.isShowDropdown);
|
|
46
|
+
};
|
|
47
|
+
const handleSearch = (e) => {
|
|
48
|
+
const { recordItems, propItem } = state;
|
|
49
|
+
const inputValue = e.target.value.trim();
|
|
50
|
+
const { maxlength } = props;
|
|
51
|
+
if (maxlength && maxlength < inputValue.length) {
|
|
52
|
+
emits("exceed", maxlength);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (inputValue.length === 0) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
Object.keys(state.matchItems).forEach((key) => {
|
|
59
|
+
state.matchItems[key].attr = [];
|
|
60
|
+
state.matchItems[key].attrValue = [];
|
|
61
|
+
});
|
|
62
|
+
state.isShowDropdown = false;
|
|
63
|
+
const value = escapeRegExp(inputValue);
|
|
64
|
+
const patt = new RegExp(value, "i");
|
|
65
|
+
const hasItem = propItem.label || !value ? null : recordItems.find((item) => item.type === "map" && patt.test(item.label));
|
|
66
|
+
if (hasItem) {
|
|
67
|
+
state.propItem.label = hasItem.label;
|
|
68
|
+
state.inputValue = "";
|
|
69
|
+
state.prevItem = hasItem;
|
|
70
|
+
state.backupPrevItem = hasItem;
|
|
71
|
+
state.backupList = hasItem.options || [];
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
state.filterList = state.backupList.filter((item) => {
|
|
75
|
+
if (patt.test(item.label)) {
|
|
76
|
+
delete item.isFilter;
|
|
77
|
+
if (hasTagItem(state, item.label)) {
|
|
78
|
+
state.checkboxGroup.push(`${state.prevItem.label}${item.label}`);
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
} else {
|
|
82
|
+
item.isFilter = true;
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
const labelRegex = new RegExp(value, "ig");
|
|
87
|
+
const valueLength = inputValue.length;
|
|
88
|
+
if (state.propItem.label) {
|
|
89
|
+
state.backupList.forEach((item) => {
|
|
90
|
+
const itemLabel = item.label;
|
|
91
|
+
if (patt.test(itemLabel)) {
|
|
92
|
+
item.match = getHighlightMatch(labelRegex, itemLabel, valueLength);
|
|
93
|
+
item.isFilter = false;
|
|
94
|
+
state.isShowDropdown = true;
|
|
95
|
+
} else {
|
|
96
|
+
item.isFilter = true;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
for (const item of recordItems) {
|
|
102
|
+
const { options = [], groupKey = "0", ...rest } = item;
|
|
103
|
+
const itemLabel = rest.label;
|
|
104
|
+
if (patt.test(itemLabel)) {
|
|
105
|
+
const match = getHighlightMatch(labelRegex, itemLabel, valueLength);
|
|
106
|
+
state.matchItems[groupKey].attr.push({ ...item, match });
|
|
107
|
+
state.isShowDropdown = true;
|
|
108
|
+
}
|
|
109
|
+
for (const option of options) {
|
|
110
|
+
const optionLabel = state.propItem.label ? itemLabel : `${itemLabel}:${option.label}`;
|
|
111
|
+
if (patt.test(optionLabel)) {
|
|
112
|
+
const match = getHighlightMatch(labelRegex, optionLabel, valueLength);
|
|
113
|
+
state.matchItems[groupKey].attrValue.push({
|
|
114
|
+
...option,
|
|
115
|
+
...rest,
|
|
116
|
+
value: option.label,
|
|
117
|
+
match
|
|
118
|
+
});
|
|
119
|
+
state.isShowDropdown = true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
if (value && props.potentialOptions && props.potentialOptions.getMatchList) {
|
|
124
|
+
getMatchList(value);
|
|
125
|
+
} else {
|
|
126
|
+
showDropdown(state, state.isShowDropdown);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const handleInput = debounce(handleSearch, 500);
|
|
130
|
+
const resetBackupList = () => {
|
|
131
|
+
state.backupList.forEach((item) => item.isFilter && delete item.isFilter);
|
|
132
|
+
};
|
|
133
|
+
const selectFirstMap = (item, isFirst) => {
|
|
134
|
+
const { options } = item;
|
|
135
|
+
const { prevItem, propItem } = state;
|
|
136
|
+
if (options) {
|
|
137
|
+
state.propItem.value = `${item.label}=`;
|
|
138
|
+
state.isShowTagKey = false;
|
|
139
|
+
state.inputValue = "";
|
|
140
|
+
state.backupList = item.options || [];
|
|
141
|
+
resetBackupList();
|
|
142
|
+
state.backupList.forEach((subItem) => {
|
|
143
|
+
const value = propItem.value + subItem.label;
|
|
144
|
+
subItem.isChecked = hasTagItem(state, value);
|
|
145
|
+
});
|
|
146
|
+
} else {
|
|
147
|
+
if (item.isChecked) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
state.isShowTagKey = true;
|
|
151
|
+
resetBackupList();
|
|
152
|
+
const { field, type } = prevItem;
|
|
153
|
+
const value = propItem.value + item.label;
|
|
154
|
+
const id = getTagId(props, prevItem, item);
|
|
155
|
+
const newTag = createNewTag({ type, field, label: propItem.label, value, ...id });
|
|
156
|
+
const tagList = [newTag];
|
|
157
|
+
emitChangeModelEvent({ emits, state, tagList });
|
|
158
|
+
}
|
|
159
|
+
if (isFirst) {
|
|
160
|
+
showDropdown(state);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
return {
|
|
164
|
+
handleInput,
|
|
165
|
+
selectFirstMap
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
export {
|
|
169
|
+
useMatch
|
|
170
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { showDropdown } from "../utils/dropdown.es.js";
|
|
2
|
+
import { getVerifyNumTag } from "../utils/validate.es.js";
|
|
3
|
+
import { emitChangeModelEvent } from "../utils/tag.es.js";
|
|
4
|
+
function useNumRange({ props, state, t, emits }) {
|
|
5
|
+
const { instance } = state;
|
|
6
|
+
const sizeChange = async (confirm) => {
|
|
7
|
+
if (!confirm) {
|
|
8
|
+
state.propItem.label = "";
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const newTag = await getVerifyNumTag(instance, state, props);
|
|
12
|
+
if (newTag) {
|
|
13
|
+
const newValue = props.modelValue.filter((prev) => prev.type !== newTag.type || prev.field !== newTag.field);
|
|
14
|
+
newValue.push(newTag);
|
|
15
|
+
emitChangeModelEvent({ emits, state, newValue });
|
|
16
|
+
showDropdown(state, false);
|
|
17
|
+
} else {
|
|
18
|
+
showDropdown(state);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const createDateRules = (item, startKey, endKey) => {
|
|
22
|
+
const { maxTimeLength = 0 } = item;
|
|
23
|
+
return {
|
|
24
|
+
[startKey]: {
|
|
25
|
+
validator: (rule, value, cb) => {
|
|
26
|
+
if (maxTimeLength > 0 && !value) {
|
|
27
|
+
cb(new Error(t("tvp.tvpSearchbox.notBeNull")));
|
|
28
|
+
} else if (!value && !state[endKey]) {
|
|
29
|
+
cb(new Error(t("tvp.tvpSearchbox.rangeDateTitle")));
|
|
30
|
+
} else {
|
|
31
|
+
cb();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
[endKey]: {
|
|
36
|
+
validator: (rule, value, cb) => {
|
|
37
|
+
if (maxTimeLength > 0 && !value) {
|
|
38
|
+
cb(new Error(t("tvp.tvpSearchbox.notBeNull")));
|
|
39
|
+
} else if (!value && !state[startKey]) {
|
|
40
|
+
cb(new Error(t("tvp.tvpSearchbox.rangeDateTitle")));
|
|
41
|
+
} else {
|
|
42
|
+
cb();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
const initFormRule = () => {
|
|
49
|
+
let dateRules = {}, datetimeRules = {};
|
|
50
|
+
props.items.forEach((item) => {
|
|
51
|
+
if (item.type === "dateRange") {
|
|
52
|
+
dateRules = createDateRules(item, "startDate", "endDate");
|
|
53
|
+
}
|
|
54
|
+
if (item.type === "datetimeRange") {
|
|
55
|
+
datetimeRules = createDateRules(item, "startDateTime", "endDateTime");
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
state.formRules = {
|
|
59
|
+
...dateRules,
|
|
60
|
+
...datetimeRules
|
|
61
|
+
};
|
|
62
|
+
if (props.editable) {
|
|
63
|
+
state.formRules.inputEditValue = {
|
|
64
|
+
required: true,
|
|
65
|
+
message: t("tvp.tvpSearchbox.notBeNull"),
|
|
66
|
+
trigger: ["change", "blur"]
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
initFormRule,
|
|
72
|
+
sizeChange
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
useNumRange
|
|
77
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ref, watch } from "vue";
|
|
2
|
+
function usePlaceholder({ props, state, t }) {
|
|
3
|
+
const placeholder = ref(props.emptyPlaceholder);
|
|
4
|
+
const setPlaceholder = (placeholderValue) => {
|
|
5
|
+
placeholder.value = placeholderValue;
|
|
6
|
+
};
|
|
7
|
+
if (props.modelValue.length > 0) {
|
|
8
|
+
setPlaceholder(t("tvp.tvpSearchbox.addPlaceholder"));
|
|
9
|
+
}
|
|
10
|
+
watch(
|
|
11
|
+
() => state.propItem.label,
|
|
12
|
+
(newValue) => {
|
|
13
|
+
if (newValue) {
|
|
14
|
+
const { placeholder: placeholder2, type } = state.prevItem;
|
|
15
|
+
if (placeholder2) {
|
|
16
|
+
setPlaceholder(placeholder2);
|
|
17
|
+
} else if (type === "map") {
|
|
18
|
+
setPlaceholder(t("tvp.tvpSearchbox.tagPlaceholder"));
|
|
19
|
+
} else if (state.backupList.length) {
|
|
20
|
+
setPlaceholder(t("tvp.tvpSearchbox.dynamicPlaceholder", { newValue }));
|
|
21
|
+
} else {
|
|
22
|
+
setPlaceholder(t("tvp.tvpSearchbox.addPlaceholder"));
|
|
23
|
+
}
|
|
24
|
+
} else {
|
|
25
|
+
if (props.modelValue.length > 0) {
|
|
26
|
+
setPlaceholder(t("tvp.tvpSearchbox.addPlaceholder"));
|
|
27
|
+
} else {
|
|
28
|
+
setPlaceholder(props.emptyPlaceholder);
|
|
29
|
+
}
|
|
30
|
+
!state.hiden && (state.hiden = true);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
return {
|
|
35
|
+
placeholder,
|
|
36
|
+
setPlaceholder
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
usePlaceholder
|
|
41
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import { showDropdown } from "../utils/dropdown.es.js";
|
|
3
|
+
import { emitChangeModelEvent } from "../utils/tag.es.js";
|
|
4
|
+
function useTag({ props, state, emits }) {
|
|
5
|
+
const lastInputValue = ref(state.inputValue);
|
|
6
|
+
const changeIsChecked = (tag) => {
|
|
7
|
+
if (tag) {
|
|
8
|
+
const parent = state.recordItems.find((item) => item.label === tag.label);
|
|
9
|
+
if (parent && parent.options) {
|
|
10
|
+
const child = parent.options.find((item) => item.label === tag.value);
|
|
11
|
+
child && (child.isChecked = false);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const deleteTag = (tag) => {
|
|
16
|
+
changeIsChecked(tag);
|
|
17
|
+
const newValue = props.modelValue.filter((item) => item !== tag);
|
|
18
|
+
emitChangeModelEvent({ emits, state, newValue });
|
|
19
|
+
};
|
|
20
|
+
const clearTag = () => {
|
|
21
|
+
props.modelValue.forEach((item) => changeIsChecked(item));
|
|
22
|
+
state.propItem = {};
|
|
23
|
+
state.inputValue = "";
|
|
24
|
+
emitChangeModelEvent({ emits, state, newValue: [] });
|
|
25
|
+
showDropdown(state, false);
|
|
26
|
+
};
|
|
27
|
+
const backspaceDeleteTag = () => {
|
|
28
|
+
if (state.inputValue) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (state.propItem.label) {
|
|
32
|
+
state.propItem = {};
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (lastInputValue.value === "" && state.inputValue === "") {
|
|
36
|
+
const lastIndex = props.modelValue.length - 1;
|
|
37
|
+
changeIsChecked(props.modelValue[lastIndex]);
|
|
38
|
+
const newValue = state.innerModelValue.slice(0, props.modelValue.length - 1);
|
|
39
|
+
emitChangeModelEvent({ emits, state, newValue });
|
|
40
|
+
}
|
|
41
|
+
lastInputValue.value = state.inputValue;
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
deleteTag,
|
|
45
|
+
clearTag,
|
|
46
|
+
backspaceDeleteTag
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
useTag
|
|
51
|
+
};
|