@onereach/ui-components 4.7.3 → 4.7.4-beta.2863.0
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/bundled/v2/components/OrInlineInputV3/styles.js +1 -1
- package/dist/bundled/v2/components/OrInlineTextareaV3/styles.js +1 -1
- package/dist/bundled/v2/components/OrInputBoxV3/styles.js +2 -0
- package/dist/bundled/v2/components/OrInputV3/styles.js +2 -2
- package/dist/bundled/v2/components/OrTagInputV3/OrTagInput.js +352 -0
- package/dist/bundled/v2/components/OrTagInputV3/OrTagInput.vue.d.ts +179 -0
- package/dist/bundled/v2/components/OrTagInputV3/index.d.ts +2 -0
- package/dist/bundled/v2/components/OrTagInputV3/index.js +55 -0
- package/dist/bundled/v2/components/OrTagInputV3/props.d.ts +1 -0
- package/dist/bundled/v2/components/OrTagInputV3/props.js +1 -0
- package/dist/bundled/v2/components/OrTagInputV3/styles.d.ts +3 -0
- package/dist/bundled/v2/components/OrTagInputV3/styles.js +17 -0
- package/dist/bundled/v2/components/OrTagsV3/OrTags.js +8 -1
- package/dist/bundled/v2/components/OrTagsV3/OrTags.vue.d.ts +7 -3
- package/dist/bundled/v2/components/OrTagsV3/styles.js +2 -0
- package/dist/bundled/v2/components/OrTextareaV3/styles.js +1 -1
- package/dist/bundled/v2/components/index.d.ts +2 -1
- package/dist/bundled/v2/components/index.js +6 -4
- package/dist/bundled/v2/hooks/useTheme.js +6 -0
- package/dist/bundled/v2/index.js +8 -6
- package/dist/bundled/v3/{OrCardCollection.vue_vue_type_script_lang-48bbd13c.js → OrCardCollection.vue_vue_type_script_lang-748fb337.js} +1 -1
- package/dist/bundled/v3/{OrConfirm.vue_vue_type_script_lang-0f1a6320.js → OrConfirm.vue_vue_type_script_lang-93458f1f.js} +1 -1
- package/dist/bundled/v3/{OrDatePicker.vue_vue_type_script_lang-3f8700f9.js → OrDatePicker.vue_vue_type_script_lang-8ec017e2.js} +1 -1
- package/dist/bundled/v3/{OrDateTimePicker.vue_vue_type_script_lang-ecd7cbd1.js → OrDateTimePicker.vue_vue_type_script_lang-fec947db.js} +1 -1
- package/dist/bundled/v3/{OrInput.vue_vue_type_script_lang-a9fe34c8.js → OrInput.vue_vue_type_script_lang-66363c62.js} +1 -1
- package/dist/bundled/v3/{OrSearch.vue_vue_type_script_lang-8a82fdc6.js → OrSearch.vue_vue_type_script_lang-18dc2df8.js} +1 -1
- package/dist/bundled/v3/{OrSelect.vue_vue_type_script_lang-ba73f458.js → OrSelect.vue_vue_type_script_lang-359bac94.js} +2 -2
- package/dist/bundled/v3/OrTagInput.vue_vue_type_script_lang-679e7b9d.js +145 -0
- package/dist/bundled/v3/{OrTags.vue_vue_type_script_lang-c14463c4.js → OrTags.vue_vue_type_script_lang-45bbc68e.js} +2 -0
- package/dist/bundled/v3/{OrTextarea.vue_vue_type_script_lang-af284089.js → OrTextarea.vue_vue_type_script_lang-0d1a7a48.js} +1 -1
- package/dist/bundled/v3/{OrTimePicker.vue_vue_type_script_lang-845ec78b.js → OrTimePicker.vue_vue_type_script_lang-c737eaa8.js} +1 -1
- package/dist/bundled/v3/components/OrCardCollectionV3/OrCardCollection.js +5 -5
- package/dist/bundled/v3/components/OrCardCollectionV3/index.js +4 -4
- package/dist/bundled/v3/components/OrConfirmV3/OrConfirm.js +4 -4
- package/dist/bundled/v3/components/OrConfirmV3/index.js +3 -3
- package/dist/bundled/v3/components/OrDatePickerV3/OrDatePicker.js +3 -3
- package/dist/bundled/v3/components/OrDatePickerV3/index.js +2 -2
- package/dist/bundled/v3/components/OrDateTimePickerV3/OrDateTimePicker.js +3 -3
- package/dist/bundled/v3/components/OrDateTimePickerV3/index.js +2 -2
- package/dist/bundled/v3/components/OrInlineInputV3/OrInlineInput.js +2 -2
- package/dist/bundled/v3/components/OrInlineInputV3/index.js +1 -1
- package/dist/bundled/v3/components/OrInlineInputV3/styles.js +1 -1
- package/dist/bundled/v3/components/OrInlineTextareaV3/OrInlineTextarea.js +2 -2
- package/dist/bundled/v3/components/OrInlineTextareaV3/index.js +1 -1
- package/dist/bundled/v3/components/OrInlineTextareaV3/styles.js +1 -1
- package/dist/bundled/v3/components/OrInputBoxV3/OrInputBox.js +2 -2
- package/dist/bundled/v3/components/OrInputBoxV3/index.js +1 -1
- package/dist/bundled/v3/components/OrInputBoxV3/styles.js +2 -0
- package/dist/bundled/v3/components/OrInputV3/OrInput.js +3 -3
- package/dist/bundled/v3/components/OrInputV3/index.js +2 -2
- package/dist/bundled/v3/components/OrInputV3/styles.js +2 -2
- package/dist/bundled/v3/components/OrSearchV3/OrSearch.js +4 -4
- package/dist/bundled/v3/components/OrSearchV3/index.js +3 -3
- package/dist/bundled/v3/components/OrSelectV3/OrSelect.js +4 -4
- package/dist/bundled/v3/components/OrSelectV3/index.js +3 -3
- package/dist/bundled/v3/components/OrTagInputV3/OrTagInput.js +167 -0
- package/dist/bundled/v3/components/OrTagInputV3/OrTagInput.vue.d.ts +131 -0
- package/dist/bundled/v3/components/OrTagInputV3/index.d.ts +2 -0
- package/dist/bundled/v3/components/OrTagInputV3/index.js +68 -0
- package/dist/bundled/v3/components/OrTagInputV3/props.d.ts +1 -0
- package/dist/bundled/v3/components/OrTagInputV3/props.js +1 -0
- package/dist/bundled/v3/components/OrTagInputV3/styles.d.ts +3 -0
- package/dist/bundled/v3/components/OrTagInputV3/styles.js +17 -0
- package/dist/bundled/v3/components/OrTagsV3/OrTags.js +5 -4
- package/dist/bundled/v3/components/OrTagsV3/OrTags.vue.d.ts +7 -2
- package/dist/bundled/v3/components/OrTagsV3/index.js +1 -1
- package/dist/bundled/v3/components/OrTagsV3/styles.js +2 -0
- package/dist/bundled/v3/components/OrTextareaV3/OrTextarea.js +3 -3
- package/dist/bundled/v3/components/OrTextareaV3/index.js +2 -2
- package/dist/bundled/v3/components/OrTextareaV3/styles.js +1 -1
- package/dist/bundled/v3/components/OrTimePickerV3/OrTimePicker.js +3 -3
- package/dist/bundled/v3/components/OrTimePickerV3/index.js +2 -2
- package/dist/bundled/v3/components/index.d.ts +2 -1
- package/dist/bundled/v3/components/index.js +20 -17
- package/dist/bundled/v3/hooks/useTheme.js +6 -0
- package/dist/bundled/v3/index.js +22 -19
- package/dist/esm/v2/{OrCardCollection-2c9a3534.js → OrCardCollection-bd173449.js} +2 -2
- package/dist/esm/v2/{OrCombinedInput-9c2b15fe.js → OrCombinedInput-ed20e33b.js} +1 -1
- package/dist/esm/v2/{OrConfirm-fc656b7e.js → OrConfirm-0b56c11f.js} +1 -1
- package/dist/esm/v2/{OrDatePicker-73c19c1c.js → OrDatePicker-0989a40c.js} +2 -2
- package/dist/esm/v2/{OrDateTimePicker-aff87aaa.js → OrDateTimePicker-ac766f04.js} +2 -2
- package/dist/esm/v2/{OrInlineInput-252510d7.js → OrInlineInput-84a8398c.js} +1 -1
- package/dist/esm/v2/{OrInlineTextarea-8df56c4d.js → OrInlineTextarea-f2ecbd39.js} +1 -1
- package/dist/esm/v2/{OrInput-39feafce.js → OrInput-2eeff16a.js} +4 -4
- package/dist/esm/v2/{OrInputBox-7f3c0ee9.js → OrInputBox-11227ecd.js} +1 -1
- package/dist/esm/v2/{OrInputBox.vue_rollup-plugin-vue_script-906b3ef8.js → OrInputBox.vue_rollup-plugin-vue_script-1715021a.js} +2 -0
- package/dist/esm/v2/{OrSearch-cbd7fd0b.js → OrSearch-33e3b0e4.js} +2 -2
- package/dist/esm/v2/{OrSelect-1132c7dc.js → OrSelect-340ae8d0.js} +3 -3
- package/dist/esm/v2/OrTagInput-582e7f3a.js +329 -0
- package/dist/esm/v2/{OrTags-e80cd854.js → OrTags-5220304c.js} +10 -1
- package/dist/esm/v2/{OrTextarea-01df0715.js → OrTextarea-978fb518.js} +3 -3
- package/dist/esm/v2/{OrTimePicker-00b7319c.js → OrTimePicker-5fd08ad2.js} +2 -2
- package/dist/esm/v2/components/index.d.ts +2 -1
- package/dist/esm/v2/components/index.js +17 -16
- package/dist/esm/v2/components/or-card-collection-v3/index.js +5 -5
- package/dist/esm/v2/components/or-combined-input-v3/index.js +2 -2
- package/dist/esm/v2/components/or-confirm-v3/index.js +4 -4
- package/dist/esm/v2/components/or-date-picker-v3/index.js +3 -3
- package/dist/esm/v2/components/or-date-time-picker-v3/index.js +3 -3
- package/dist/esm/v2/components/or-inline-input-v3/index.js +1 -1
- package/dist/esm/v2/components/or-inline-textarea-v3/index.js +1 -1
- package/dist/esm/v2/components/or-input-box-v3/index.js +2 -2
- package/dist/esm/v2/components/or-input-v3/index.js +3 -3
- package/dist/esm/v2/components/or-search-v3/index.js +4 -4
- package/dist/esm/v2/components/or-select-v3/index.js +4 -4
- package/dist/esm/v2/components/or-tag-input-v3/OrTagInput.vue.d.ts +179 -0
- package/dist/esm/v2/components/or-tag-input-v3/index.d.ts +2 -0
- package/dist/esm/v2/components/or-tag-input-v3/index.js +31 -0
- package/dist/esm/v2/components/or-tag-input-v3/props.d.ts +1 -0
- package/dist/esm/v2/components/or-tag-input-v3/styles.d.ts +3 -0
- package/dist/esm/v2/components/or-tags-v3/OrTags.vue.d.ts +9 -5
- package/dist/esm/v2/components/or-tags-v3/index.js +1 -1
- package/dist/esm/v2/components/or-textarea-v3/index.js +3 -3
- package/dist/esm/v2/components/or-time-picker-v3/index.js +3 -3
- package/dist/esm/v2/index.js +17 -16
- package/dist/esm/v3/{OrCardCollection-dcfaa692.js → OrCardCollection-c5d5506c.js} +2 -2
- package/dist/esm/v3/{OrCombinedInput-b5ba46a1.js → OrCombinedInput-e3891038.js} +1 -1
- package/dist/esm/v3/{OrConfirm-e8ee0b8f.js → OrConfirm-5509c440.js} +1 -1
- package/dist/esm/v3/{OrDatePicker-19a07bb4.js → OrDatePicker-6ac8578a.js} +1 -1
- package/dist/esm/v3/{OrDateTimePicker-219fa71d.js → OrDateTimePicker-b15d4198.js} +1 -1
- package/dist/esm/v3/{OrInlineInput-5d452b98.js → OrInlineInput-a6c33dc0.js} +1 -1
- package/dist/esm/v3/{OrInlineTextarea-1a769972.js → OrInlineTextarea-f060dab5.js} +1 -1
- package/dist/esm/v3/{OrInput-a303f924.js → OrInput-c653aedb.js} +3 -3
- package/dist/esm/v3/{OrInputBox-32814878.js → OrInputBox-32b37b17.js} +2 -0
- package/dist/esm/v3/{OrSearch-c5ecb005.js → OrSearch-b945651d.js} +2 -2
- package/dist/esm/v3/{OrSelect-9432ac4d.js → OrSelect-a9be2490.js} +2 -2
- package/dist/esm/v3/OrTagInput-ea932f50.js +254 -0
- package/dist/esm/v3/{OrTags-3f0ab56f.js → OrTags-00bb5463.js} +7 -2
- package/dist/esm/v3/{OrTextarea-0f9a2a27.js → OrTextarea-1e19417a.js} +2 -2
- package/dist/esm/v3/{OrTimePicker-5cb9eb34.js → OrTimePicker-d66edf77.js} +1 -1
- package/dist/esm/v3/components/index.d.ts +2 -1
- package/dist/esm/v3/components/index.js +16 -15
- package/dist/esm/v3/components/or-card-collection-v3/index.js +4 -4
- package/dist/esm/v3/components/or-combined-input-v3/index.js +2 -2
- package/dist/esm/v3/components/or-confirm-v3/index.js +3 -3
- package/dist/esm/v3/components/or-date-picker-v3/index.js +2 -2
- package/dist/esm/v3/components/or-date-time-picker-v3/index.js +2 -2
- package/dist/esm/v3/components/or-inline-input-v3/index.js +1 -1
- package/dist/esm/v3/components/or-inline-textarea-v3/index.js +1 -1
- package/dist/esm/v3/components/or-input-box-v3/index.js +1 -1
- package/dist/esm/v3/components/or-input-v3/index.js +2 -2
- package/dist/esm/v3/components/or-search-v3/index.js +3 -3
- package/dist/esm/v3/components/or-select-v3/index.js +3 -3
- package/dist/esm/v3/components/or-tag-input-v3/OrTagInput.vue.d.ts +131 -0
- package/dist/esm/v3/components/or-tag-input-v3/index.d.ts +2 -0
- package/dist/esm/v3/components/or-tag-input-v3/index.js +29 -0
- package/dist/esm/v3/components/or-tag-input-v3/props.d.ts +1 -0
- package/dist/esm/v3/components/or-tag-input-v3/styles.d.ts +3 -0
- package/dist/esm/v3/components/or-tags-v3/OrTags.vue.d.ts +7 -2
- package/dist/esm/v3/components/or-tags-v3/index.js +1 -1
- package/dist/esm/v3/components/or-textarea-v3/index.js +2 -2
- package/dist/esm/v3/components/or-time-picker-v3/index.js +2 -2
- package/dist/esm/v3/index.js +16 -15
- package/package.json +3 -4
- package/src/components/index.ts +2 -1
- package/src/components/or-inline-input-v3/styles.ts +1 -1
- package/src/components/or-inline-textarea-v3/styles.ts +1 -1
- package/src/components/or-input-box-v3/styles.ts +3 -0
- package/src/components/or-input-v3/styles.ts +2 -2
- package/src/components/or-tag-input-v3/OrTagInput.vue +297 -0
- package/src/components/or-tag-input-v3/index.ts +2 -0
- package/src/components/or-tag-input-v3/props.ts +1 -0
- package/src/components/or-tag-input-v3/styles.ts +24 -0
- package/src/components/or-tags-v3/OrTags.vue +13 -0
- package/src/components/or-tags-v3/styles.ts +3 -0
- package/src/components/or-textarea-v3/styles.ts +1 -1
- /package/dist/bundled/v3/{OrInlineInput.vue_vue_type_script_lang-c4fb7c0e.js → OrInlineInput.vue_vue_type_script_lang-820cc7e9.js} +0 -0
- /package/dist/bundled/v3/{OrInlineTextarea.vue_vue_type_script_lang-4569f111.js → OrInlineTextarea.vue_vue_type_script_lang-8e639991.js} +0 -0
- /package/dist/bundled/v3/{OrInputBox.vue_vue_type_script_lang-ede24b04.js → OrInputBox.vue_vue_type_script_lang-49fb179a.js} +0 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="root"
|
|
4
|
+
:class="rootStyles"
|
|
5
|
+
>
|
|
6
|
+
<template v-if="label">
|
|
7
|
+
<OrLabel
|
|
8
|
+
:control-id="controlAttributes.id"
|
|
9
|
+
:variant="'input'"
|
|
10
|
+
:required="required"
|
|
11
|
+
:disabled="disabled"
|
|
12
|
+
>
|
|
13
|
+
{{ label }}
|
|
14
|
+
|
|
15
|
+
<template v-slot:addon>
|
|
16
|
+
<slot name="addon" />
|
|
17
|
+
</template>
|
|
18
|
+
</OrLabel>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<OrInputBox
|
|
22
|
+
:variant="disableDefaultStyles ? 'unstyled' : 'styled'"
|
|
23
|
+
:size="size"
|
|
24
|
+
:invalid="!!error"
|
|
25
|
+
:readonly="readonly"
|
|
26
|
+
:disabled="disabled"
|
|
27
|
+
>
|
|
28
|
+
<OrTags
|
|
29
|
+
:items="proxyModelValue"
|
|
30
|
+
:tag-props="{
|
|
31
|
+
variant: 'reset',
|
|
32
|
+
disabled: disabled
|
|
33
|
+
}"
|
|
34
|
+
@reset="remove($event)"
|
|
35
|
+
/>
|
|
36
|
+
<!-- <OrTag
|
|
37
|
+
v-for="token in proxyModelValue"
|
|
38
|
+
:key="token"
|
|
39
|
+
:class="itemStyles"
|
|
40
|
+
:variant="'reset'"
|
|
41
|
+
:disabled="disabled"
|
|
42
|
+
>
|
|
43
|
+
{{ token }}
|
|
44
|
+
</OrTag> -->
|
|
45
|
+
|
|
46
|
+
<input
|
|
47
|
+
ref="control"
|
|
48
|
+
v-model="draftModelValue"
|
|
49
|
+
v-bind="controlAttributes"
|
|
50
|
+
:class="controlStyles"
|
|
51
|
+
:type="'text'"
|
|
52
|
+
:placeholder="!proxyModelValue.length ? placeholder : undefined"
|
|
53
|
+
:readonly="readonly"
|
|
54
|
+
:disabled="disabled"
|
|
55
|
+
@keydown.enter="add()"
|
|
56
|
+
@keydown="$emit('keydown', $event)"
|
|
57
|
+
@keyup="$emit('keyup', $event)"
|
|
58
|
+
@focus="$emit('focus', $event)"
|
|
59
|
+
@blur="$emit('blur', $event)"
|
|
60
|
+
>
|
|
61
|
+
|
|
62
|
+
<template v-slot:addon>
|
|
63
|
+
<template v-if="draftModelValue">
|
|
64
|
+
<OrIconButton
|
|
65
|
+
:icon="'close'"
|
|
66
|
+
:color="'inherit'"
|
|
67
|
+
:disabled="readonly || disabled"
|
|
68
|
+
@click.stop="reset()"
|
|
69
|
+
/>
|
|
70
|
+
</template>
|
|
71
|
+
</template>
|
|
72
|
+
</OrInputBox>
|
|
73
|
+
|
|
74
|
+
<div
|
|
75
|
+
v-show="!error"
|
|
76
|
+
:class="['contents']"
|
|
77
|
+
>
|
|
78
|
+
<template v-if="hint || maxLength">
|
|
79
|
+
<OrHint :disabled="disabled">
|
|
80
|
+
{{ hint }}
|
|
81
|
+
|
|
82
|
+
<template
|
|
83
|
+
v-if="maxLength"
|
|
84
|
+
v-slot:addon
|
|
85
|
+
>
|
|
86
|
+
{{ currentLength }} / {{ maxLength }}
|
|
87
|
+
</template>
|
|
88
|
+
</OrHint>
|
|
89
|
+
</template>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<div
|
|
93
|
+
v-show="typeof error === 'string'"
|
|
94
|
+
:class="['contents']"
|
|
95
|
+
>
|
|
96
|
+
<OrError :disabled="disabled">
|
|
97
|
+
{{ error }}
|
|
98
|
+
|
|
99
|
+
<template
|
|
100
|
+
v-if="maxLength"
|
|
101
|
+
v-slot:addon
|
|
102
|
+
>
|
|
103
|
+
{{ currentLength }} / {{ maxLength }}
|
|
104
|
+
</template>
|
|
105
|
+
</OrError>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
</template>
|
|
109
|
+
|
|
110
|
+
<script lang="ts">
|
|
111
|
+
import { PropType, computed, defineComponent, reactive, ref } from 'vue-demi';
|
|
112
|
+
import { useControlAttributes, useIdAttribute, useValidationAttributes } from '../../hooks';
|
|
113
|
+
import { OrErrorV3 as OrError } from '../or-error-v3';
|
|
114
|
+
import { OrHintV3 as OrHint } from '../or-hint-v3';
|
|
115
|
+
import { OrIconButtonV3 as OrIconButton } from '../or-icon-button-v3';
|
|
116
|
+
import { OrInputBoxV3 as OrInputBox } from '../or-input-box-v3';
|
|
117
|
+
import { OrLabelV3 as OrLabel } from '../or-label-v3';
|
|
118
|
+
import { OrTagsV3 as OrTags } from '../or-tags-v3';
|
|
119
|
+
import { TagInputSize } from './props';
|
|
120
|
+
import { TagInput, TagInputControl, TagInputItem } from './styles';
|
|
121
|
+
|
|
122
|
+
export default defineComponent({
|
|
123
|
+
name: 'OrTagInput',
|
|
124
|
+
|
|
125
|
+
components: {
|
|
126
|
+
OrError,
|
|
127
|
+
OrHint,
|
|
128
|
+
OrIconButton,
|
|
129
|
+
OrInputBox,
|
|
130
|
+
OrLabel,
|
|
131
|
+
OrTags,
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
model: {
|
|
135
|
+
prop: 'modelValue',
|
|
136
|
+
event: 'update:modelValue',
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
props: {
|
|
140
|
+
modelValue: {
|
|
141
|
+
type: Array as PropType<string[]>,
|
|
142
|
+
default: () => [],
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
size: {
|
|
146
|
+
type: String as PropType<`${TagInputSize}`>,
|
|
147
|
+
default: TagInputSize.M,
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
label: {
|
|
151
|
+
type: String,
|
|
152
|
+
default: undefined,
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
placeholder: {
|
|
156
|
+
type: String,
|
|
157
|
+
default: undefined,
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
hint: {
|
|
161
|
+
type: String,
|
|
162
|
+
default: undefined,
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
error: {
|
|
166
|
+
type: [String, Boolean],
|
|
167
|
+
default: undefined,
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
required: {
|
|
171
|
+
type: Boolean,
|
|
172
|
+
default: false,
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
readonly: {
|
|
176
|
+
type: Boolean,
|
|
177
|
+
default: false,
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
disabled: {
|
|
181
|
+
type: Boolean,
|
|
182
|
+
default: false,
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
disableDefaultStyles: {
|
|
186
|
+
type: Boolean,
|
|
187
|
+
default: false,
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
emits: [
|
|
192
|
+
'update:modelValue',
|
|
193
|
+
|
|
194
|
+
'keydown',
|
|
195
|
+
'keyup',
|
|
196
|
+
'focus',
|
|
197
|
+
'blur',
|
|
198
|
+
],
|
|
199
|
+
|
|
200
|
+
expose: [
|
|
201
|
+
'root',
|
|
202
|
+
|
|
203
|
+
'focus',
|
|
204
|
+
'blur',
|
|
205
|
+
],
|
|
206
|
+
|
|
207
|
+
setup(props, context) {
|
|
208
|
+
// Refs
|
|
209
|
+
const root = ref<HTMLElement>();
|
|
210
|
+
const control = ref<HTMLInputElement>();
|
|
211
|
+
|
|
212
|
+
// Styles
|
|
213
|
+
const rootStyles = computed(() => [
|
|
214
|
+
'or-tag-input-v3',
|
|
215
|
+
...TagInput,
|
|
216
|
+
]);
|
|
217
|
+
|
|
218
|
+
const controlStyles = computed(() => [
|
|
219
|
+
...TagInputControl,
|
|
220
|
+
]);
|
|
221
|
+
|
|
222
|
+
const itemStyles = computed(() => [
|
|
223
|
+
...TagInputItem,
|
|
224
|
+
]);
|
|
225
|
+
|
|
226
|
+
// State
|
|
227
|
+
const controlAttributes = reactive({
|
|
228
|
+
id: useIdAttribute(),
|
|
229
|
+
...useControlAttributes(),
|
|
230
|
+
...useValidationAttributes(),
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
const proxyModelValue = computed({
|
|
234
|
+
get: () => props.modelValue,
|
|
235
|
+
|
|
236
|
+
set: (value) => {
|
|
237
|
+
context.emit('update:modelValue', value);
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
const draftModelValue = ref<string>();
|
|
242
|
+
|
|
243
|
+
const currentLength = computed(() => proxyModelValue.value?.length ?? 0);
|
|
244
|
+
const maxLength = computed(() => controlAttributes.maxlength);
|
|
245
|
+
|
|
246
|
+
// Methods
|
|
247
|
+
function focus(): void {
|
|
248
|
+
control.value?.focus();
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function blur(): void {
|
|
252
|
+
control.value?.blur();
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
function add(): void {
|
|
256
|
+
if (draftModelValue.value) {
|
|
257
|
+
proxyModelValue.value = [...proxyModelValue.value, draftModelValue.value];
|
|
258
|
+
draftModelValue.value = undefined;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function remove(value: string): void {
|
|
263
|
+
proxyModelValue.value = proxyModelValue.value.filter((item) => item !== value);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function reset(): void {
|
|
267
|
+
draftModelValue.value = undefined;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return {
|
|
271
|
+
root,
|
|
272
|
+
control,
|
|
273
|
+
rootStyles,
|
|
274
|
+
controlStyles,
|
|
275
|
+
itemStyles,
|
|
276
|
+
controlAttributes,
|
|
277
|
+
proxyModelValue,
|
|
278
|
+
draftModelValue,
|
|
279
|
+
currentLength,
|
|
280
|
+
maxLength,
|
|
281
|
+
focus,
|
|
282
|
+
blur,
|
|
283
|
+
add,
|
|
284
|
+
remove,
|
|
285
|
+
reset,
|
|
286
|
+
};
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
</script>
|
|
290
|
+
|
|
291
|
+
<style scoped>
|
|
292
|
+
input {
|
|
293
|
+
min-width: 0;
|
|
294
|
+
background: none;
|
|
295
|
+
outline: none;
|
|
296
|
+
}
|
|
297
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { InputBoxSize as TagInputSize } from '../or-input-box-v3';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const TagInput: string[] = [
|
|
2
|
+
// Layout
|
|
3
|
+
'layout-column',
|
|
4
|
+
|
|
5
|
+
// Spacing
|
|
6
|
+
'gap-xs',
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
export const TagInputControl: string[] = [
|
|
10
|
+
// Layout
|
|
11
|
+
'flex-auto',
|
|
12
|
+
|
|
13
|
+
// Typography
|
|
14
|
+
'typography-inherit',
|
|
15
|
+
|
|
16
|
+
// Theme (placeholder)
|
|
17
|
+
'placeholder:theme-foreground-outline',
|
|
18
|
+
'dark:placeholder:theme-foreground-outline-dark',
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
export const TagInputItem: string[] = [
|
|
22
|
+
// Box
|
|
23
|
+
'!min-h-0',
|
|
24
|
+
];
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
v-for="item in items"
|
|
12
12
|
v-bind="tagProps"
|
|
13
13
|
:key="item"
|
|
14
|
+
@reset="$emit('reset', item)"
|
|
14
15
|
>
|
|
15
16
|
{{ item }}
|
|
16
17
|
</OrTag>
|
|
@@ -75,6 +76,18 @@ export default defineComponent({
|
|
|
75
76
|
},
|
|
76
77
|
},
|
|
77
78
|
|
|
79
|
+
emits: [
|
|
80
|
+
'click',
|
|
81
|
+
'focus',
|
|
82
|
+
'blur',
|
|
83
|
+
|
|
84
|
+
'reset',
|
|
85
|
+
],
|
|
86
|
+
|
|
87
|
+
expose: [
|
|
88
|
+
'root',
|
|
89
|
+
],
|
|
90
|
+
|
|
78
91
|
setup(props) {
|
|
79
92
|
// Refs
|
|
80
93
|
const root = ref<HTMLElement>();
|
|
File without changes
|
|
File without changes
|