@bitrix24/b24ui-nuxt 0.5.10 → 0.6.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/.nuxt/b24ui/input-menu.ts +2 -2
- package/.nuxt/b24ui/select-menu.ts +4 -4
- package/.nuxt/b24ui/select.ts +2 -2
- package/dist/meta.d.mts +148 -1
- package/dist/meta.mjs +148 -1
- package/dist/module.json +2 -2
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Advice.vue +10 -30
- package/dist/runtime/components/Alert.vue +17 -53
- package/dist/runtime/components/App.vue +9 -22
- package/dist/runtime/components/Avatar.vue +12 -38
- package/dist/runtime/components/AvatarGroup.vue +7 -20
- package/dist/runtime/components/Badge.vue +18 -61
- package/dist/runtime/components/Button.vue +55 -177
- package/dist/runtime/components/ButtonGroup.vue +6 -22
- package/dist/runtime/components/Calendar.vue +38 -151
- package/dist/runtime/components/Checkbox.vue +17 -59
- package/dist/runtime/components/Chip.vue +11 -44
- package/dist/runtime/components/Collapsible.vue +8 -30
- package/dist/runtime/components/Container.vue +3 -8
- package/dist/runtime/components/Countdown.vue +15 -60
- package/dist/runtime/components/DescriptionList.vue +10 -34
- package/dist/runtime/components/DropdownMenu.vue +16 -61
- package/dist/runtime/components/DropdownMenuContent.vue +41 -106
- package/dist/runtime/components/Form.vue +12 -45
- package/dist/runtime/components/FormField.vue +16 -56
- package/dist/runtime/components/Input.vue +29 -110
- package/dist/runtime/components/InputMenu.vue +76 -192
- package/dist/runtime/components/InputMenu.vue.d.ts +25 -6
- package/dist/runtime/components/InputNumber.vue +35 -136
- package/dist/runtime/components/Kbd.vue +6 -21
- package/dist/runtime/components/Link.vue +28 -115
- package/dist/runtime/components/LinkBase.vue +11 -42
- package/dist/runtime/components/Modal.vue +20 -77
- package/dist/runtime/components/ModalDialogClose.vue +1 -0
- package/dist/runtime/components/Navbar.vue +4 -13
- package/dist/runtime/components/NavbarDivider.vue +4 -13
- package/dist/runtime/components/NavbarSection.vue +4 -13
- package/dist/runtime/components/NavbarSpacer.vue +4 -13
- package/dist/runtime/components/NavigationMenu.vue +39 -107
- package/dist/runtime/components/OverlayProvider.vue +1 -1
- package/dist/runtime/components/Popover.vue +12 -53
- package/dist/runtime/components/Progress.vue +13 -52
- package/dist/runtime/components/RadioGroup.vue +20 -81
- package/dist/runtime/components/Range.vue +16 -64
- package/dist/runtime/components/Select.vue +39 -141
- package/dist/runtime/components/Select.vue.d.ts +1 -0
- package/dist/runtime/components/SelectMenu.vue +79 -172
- package/dist/runtime/components/SelectMenu.vue.d.ts +1 -1
- package/dist/runtime/components/Separator.vue +13 -46
- package/dist/runtime/components/Sidebar.vue +4 -13
- package/dist/runtime/components/SidebarBody.vue +5 -18
- package/dist/runtime/components/SidebarFooter.vue +4 -13
- package/dist/runtime/components/SidebarHeader.vue +4 -13
- package/dist/runtime/components/SidebarHeading.vue +4 -13
- package/dist/runtime/components/SidebarLayout.vue +12 -18
- package/dist/runtime/components/SidebarSection.vue +4 -13
- package/dist/runtime/components/SidebarSpacer.vue +4 -13
- package/dist/runtime/components/Skeleton.vue +3 -8
- package/dist/runtime/components/Slideover.vue +20 -78
- package/dist/runtime/components/StackedLayout.vue +12 -18
- package/dist/runtime/components/Switch.vue +21 -75
- package/dist/runtime/components/Tabs.vue +22 -64
- package/dist/runtime/components/Textarea.vue +30 -115
- package/dist/runtime/components/Toast.vue +20 -67
- package/dist/runtime/components/Toaster.vue +15 -38
- package/dist/runtime/components/Tooltip.vue +16 -58
- package/dist/runtime/components/content/TableWrapper.vue +12 -46
- package/dist/runtime/composables/useFormField.d.ts +1 -1
- package/dist/runtime/composables/useOverlay.d.ts +14 -7
- package/dist/runtime/composables/useOverlay.js +14 -6
- package/dist/runtime/prose/A.vue +2 -8
- package/dist/runtime/prose/Blockquote.vue +2 -8
- package/dist/runtime/prose/Code.vue +3 -12
- package/dist/runtime/prose/Em.vue +2 -8
- package/dist/runtime/prose/H1.vue +2 -8
- package/dist/runtime/prose/H2.vue +2 -8
- package/dist/runtime/prose/H3.vue +2 -8
- package/dist/runtime/prose/H4.vue +2 -8
- package/dist/runtime/prose/H5.vue +2 -8
- package/dist/runtime/prose/H6.vue +2 -8
- package/dist/runtime/prose/Hr.vue +2 -8
- package/dist/runtime/prose/Img.vue +2 -8
- package/dist/runtime/prose/Li.vue +2 -8
- package/dist/runtime/prose/Ol.vue +2 -8
- package/dist/runtime/prose/P.vue +2 -8
- package/dist/runtime/prose/Pre.vue +5 -17
- package/dist/runtime/prose/Strong.vue +2 -8
- package/dist/runtime/prose/Table.vue +8 -33
- package/dist/runtime/prose/Tbody.vue +2 -8
- package/dist/runtime/prose/Td.vue +2 -8
- package/dist/runtime/prose/Th.vue +2 -8
- package/dist/runtime/prose/Thead.vue +2 -8
- package/dist/runtime/prose/Tr.vue +2 -8
- package/dist/runtime/prose/Ul.vue +2 -8
- package/dist/runtime/utils/link.d.ts +3 -3
- package/dist/runtime/vue/components/Link.vue +29 -115
- package/dist/shared/{b24ui-nuxt.CS9Lf0os.mjs → b24ui-nuxt.BA6Y2FnC.mjs} +6 -6
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +11 -7
|
@@ -13,51 +13,18 @@ import { formOptionsInjectionKey, formInputsInjectionKey, formBusInjectionKey, f
|
|
|
13
13
|
import { validateSchema } from "../utils/form";
|
|
14
14
|
import { FormValidationException } from "../types/form";
|
|
15
15
|
const props = defineProps({
|
|
16
|
-
id: {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
validate: {
|
|
29
|
-
type: Function,
|
|
30
|
-
required: false
|
|
31
|
-
},
|
|
32
|
-
validateOn: {
|
|
33
|
-
type: Array,
|
|
34
|
-
required: false,
|
|
35
|
-
default() {
|
|
36
|
-
return ["input", "blur", "change"];
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
disabled: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
required: false
|
|
42
|
-
},
|
|
43
|
-
validateOnInputDelay: {
|
|
44
|
-
type: Number,
|
|
45
|
-
required: false,
|
|
46
|
-
default: 300
|
|
47
|
-
},
|
|
48
|
-
transform: {
|
|
49
|
-
type: Boolean,
|
|
50
|
-
required: false,
|
|
51
|
-
default: true
|
|
52
|
-
},
|
|
53
|
-
class: {
|
|
54
|
-
type: null,
|
|
55
|
-
required: false
|
|
56
|
-
},
|
|
57
|
-
onSubmit: {
|
|
58
|
-
type: Function,
|
|
59
|
-
required: false
|
|
60
|
-
}
|
|
16
|
+
id: { type: [String, Number], required: false },
|
|
17
|
+
schema: { type: null, required: false },
|
|
18
|
+
state: { type: Object, required: true },
|
|
19
|
+
validate: { type: Function, required: false },
|
|
20
|
+
validateOn: { type: Array, required: false, default() {
|
|
21
|
+
return ["input", "blur", "change"];
|
|
22
|
+
} },
|
|
23
|
+
disabled: { type: Boolean, required: false },
|
|
24
|
+
validateOnInputDelay: { type: Number, required: false, default: 300 },
|
|
25
|
+
transform: { type: Boolean, required: false, default: true },
|
|
26
|
+
class: { type: null, required: false },
|
|
27
|
+
onSubmit: { type: Function, required: false }
|
|
61
28
|
});
|
|
62
29
|
const emits = defineEmits(["submit", "error"]);
|
|
63
30
|
defineSlots();
|
|
@@ -8,64 +8,24 @@ const formField = tv({ extend: tv(theme), ...appConfigFormField.b24ui?.formField
|
|
|
8
8
|
|
|
9
9
|
<script setup>
|
|
10
10
|
import { computed, ref, inject, provide, useId } from "vue";
|
|
11
|
+
import { Primitive, Label } from "reka-ui";
|
|
11
12
|
import { formFieldInjectionKey, inputIdInjectionKey } from "../composables/useFormField";
|
|
13
|
+
import WarningIcon from "@bitrix24/b24icons-vue/main/WarningIcon";
|
|
12
14
|
const props = defineProps({
|
|
13
|
-
as: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
required: false
|
|
28
|
-
},
|
|
29
|
-
description: {
|
|
30
|
-
type: String,
|
|
31
|
-
required: false
|
|
32
|
-
},
|
|
33
|
-
help: {
|
|
34
|
-
type: String,
|
|
35
|
-
required: false
|
|
36
|
-
},
|
|
37
|
-
error: {
|
|
38
|
-
type: [String, Boolean],
|
|
39
|
-
required: false
|
|
40
|
-
},
|
|
41
|
-
hint: {
|
|
42
|
-
type: String,
|
|
43
|
-
required: false
|
|
44
|
-
},
|
|
45
|
-
size: {
|
|
46
|
-
type: null,
|
|
47
|
-
required: false
|
|
48
|
-
},
|
|
49
|
-
required: {
|
|
50
|
-
type: Boolean,
|
|
51
|
-
required: false
|
|
52
|
-
},
|
|
53
|
-
eagerValidation: {
|
|
54
|
-
type: Boolean,
|
|
55
|
-
required: false
|
|
56
|
-
},
|
|
57
|
-
validateOnInputDelay: {
|
|
58
|
-
type: Number,
|
|
59
|
-
required: false
|
|
60
|
-
},
|
|
61
|
-
class: {
|
|
62
|
-
type: null,
|
|
63
|
-
required: false
|
|
64
|
-
},
|
|
65
|
-
b24ui: {
|
|
66
|
-
type: Object,
|
|
67
|
-
required: false
|
|
68
|
-
}
|
|
15
|
+
as: { type: null, required: false },
|
|
16
|
+
name: { type: String, required: false },
|
|
17
|
+
errorPattern: { type: null, required: false },
|
|
18
|
+
label: { type: String, required: false },
|
|
19
|
+
description: { type: String, required: false },
|
|
20
|
+
help: { type: String, required: false },
|
|
21
|
+
error: { type: [String, Boolean], required: false },
|
|
22
|
+
hint: { type: String, required: false },
|
|
23
|
+
size: { type: null, required: false },
|
|
24
|
+
required: { type: Boolean, required: false },
|
|
25
|
+
eagerValidation: { type: Boolean, required: false },
|
|
26
|
+
validateOnInputDelay: { type: Number, required: false },
|
|
27
|
+
class: { type: null, required: false },
|
|
28
|
+
b24ui: { type: Object, required: false }
|
|
69
29
|
});
|
|
70
30
|
const slots = defineSlots();
|
|
71
31
|
const b24ui = computed(() => formField({
|
|
@@ -8,125 +8,44 @@ const input = tv({ extend: tv(theme), ...appConfigInput.b24ui?.input || {} });
|
|
|
8
8
|
|
|
9
9
|
<script setup>
|
|
10
10
|
import { ref, computed, onMounted } from "vue";
|
|
11
|
+
import { Primitive } from "reka-ui";
|
|
11
12
|
import { useButtonGroup } from "../composables/useButtonGroup";
|
|
12
13
|
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
13
14
|
import { useFormField } from "../composables/useFormField";
|
|
14
15
|
import { looseToNumber } from "../utils";
|
|
16
|
+
import B24Avatar from "./Avatar.vue";
|
|
15
17
|
defineOptions({ inheritAttrs: false });
|
|
16
18
|
const props = defineProps({
|
|
17
|
-
as: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
type:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
type: null,
|
|
44
|
-
required: false
|
|
45
|
-
},
|
|
46
|
-
noPadding: {
|
|
47
|
-
type: Boolean,
|
|
48
|
-
required: false
|
|
49
|
-
},
|
|
50
|
-
noBorder: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
required: false
|
|
53
|
-
},
|
|
54
|
-
underline: {
|
|
55
|
-
type: Boolean,
|
|
56
|
-
required: false
|
|
57
|
-
},
|
|
58
|
-
rounded: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
required: false
|
|
61
|
-
},
|
|
62
|
-
required: {
|
|
63
|
-
type: Boolean,
|
|
64
|
-
required: false
|
|
65
|
-
},
|
|
66
|
-
autocomplete: {
|
|
67
|
-
type: null,
|
|
68
|
-
required: false,
|
|
69
|
-
default: "off"
|
|
70
|
-
},
|
|
71
|
-
autofocus: {
|
|
72
|
-
type: Boolean,
|
|
73
|
-
required: false
|
|
74
|
-
},
|
|
75
|
-
autofocusDelay: {
|
|
76
|
-
type: Number,
|
|
77
|
-
required: false,
|
|
78
|
-
default: 0
|
|
79
|
-
},
|
|
80
|
-
disabled: {
|
|
81
|
-
type: Boolean,
|
|
82
|
-
required: false
|
|
83
|
-
},
|
|
84
|
-
tag: {
|
|
85
|
-
type: String,
|
|
86
|
-
required: false
|
|
87
|
-
},
|
|
88
|
-
tagColor: {
|
|
89
|
-
type: null,
|
|
90
|
-
required: false
|
|
91
|
-
},
|
|
92
|
-
highlight: {
|
|
93
|
-
type: Boolean,
|
|
94
|
-
required: false
|
|
95
|
-
},
|
|
96
|
-
class: {
|
|
97
|
-
type: null,
|
|
98
|
-
required: false
|
|
99
|
-
},
|
|
100
|
-
b24ui: {
|
|
101
|
-
type: null,
|
|
102
|
-
required: false
|
|
103
|
-
},
|
|
104
|
-
icon: {
|
|
105
|
-
type: [Function, Object],
|
|
106
|
-
required: false
|
|
107
|
-
},
|
|
108
|
-
avatar: {
|
|
109
|
-
type: Object,
|
|
110
|
-
required: false
|
|
111
|
-
},
|
|
112
|
-
loading: {
|
|
113
|
-
type: Boolean,
|
|
114
|
-
required: false
|
|
115
|
-
},
|
|
116
|
-
trailing: {
|
|
117
|
-
type: Boolean,
|
|
118
|
-
required: false
|
|
119
|
-
},
|
|
120
|
-
trailingIcon: {
|
|
121
|
-
type: [Function, Object],
|
|
122
|
-
required: false
|
|
123
|
-
}
|
|
19
|
+
as: { type: null, required: false },
|
|
20
|
+
id: { type: String, required: false },
|
|
21
|
+
name: { type: String, required: false },
|
|
22
|
+
type: { type: null, required: false, default: "text" },
|
|
23
|
+
placeholder: { type: String, required: false },
|
|
24
|
+
color: { type: null, required: false },
|
|
25
|
+
size: { type: null, required: false },
|
|
26
|
+
noPadding: { type: Boolean, required: false },
|
|
27
|
+
noBorder: { type: Boolean, required: false },
|
|
28
|
+
underline: { type: Boolean, required: false },
|
|
29
|
+
rounded: { type: Boolean, required: false },
|
|
30
|
+
required: { type: Boolean, required: false },
|
|
31
|
+
autocomplete: { type: null, required: false, default: "off" },
|
|
32
|
+
autofocus: { type: Boolean, required: false },
|
|
33
|
+
autofocusDelay: { type: Number, required: false, default: 0 },
|
|
34
|
+
disabled: { type: Boolean, required: false },
|
|
35
|
+
tag: { type: String, required: false },
|
|
36
|
+
tagColor: { type: null, required: false },
|
|
37
|
+
highlight: { type: Boolean, required: false },
|
|
38
|
+
class: { type: null, required: false },
|
|
39
|
+
b24ui: { type: null, required: false },
|
|
40
|
+
icon: { type: [Function, Object], required: false },
|
|
41
|
+
avatar: { type: Object, required: false },
|
|
42
|
+
loading: { type: Boolean, required: false },
|
|
43
|
+
trailing: { type: Boolean, required: false },
|
|
44
|
+
trailingIcon: { type: [Function, Object], required: false }
|
|
124
45
|
});
|
|
125
46
|
const emits = defineEmits(["update:modelValue", "blur", "change"]);
|
|
126
47
|
const slots = defineSlots();
|
|
127
|
-
const [modelValue, modelModifiers] = defineModel({
|
|
128
|
-
"type": [String, Number, null]
|
|
129
|
-
});
|
|
48
|
+
const [modelValue, modelModifiers] = defineModel({ type: [String, Number, null] });
|
|
130
49
|
const { emitFormBlur, emitFormInput, emitFormChange, size: formGroupSize, color, id, name, highlight, disabled, emitFormFocus, ariaAttrs } = useFormField(props, { deferInputValidation: true });
|
|
131
50
|
const { orientation, size: buttonGroupSize } = useButtonGroup(props);
|
|
132
51
|
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props);
|
|
@@ -7,8 +7,8 @@ const inputMenu = tv({ extend: tv(theme), ...appConfigInputMenu.b24ui?.inputMenu
|
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<script setup>
|
|
10
|
-
import { computed, ref, toRef, onMounted, toRaw
|
|
11
|
-
import { useForwardPropsEmits, useFilter } from "reka-ui";
|
|
10
|
+
import { computed, ref, toRef, onMounted, toRaw } from "vue";
|
|
11
|
+
import { ComboboxRoot, ComboboxArrow, ComboboxAnchor, ComboboxInput, ComboboxTrigger, ComboboxPortal, ComboboxContent, ComboboxViewport, ComboboxEmpty, ComboboxGroup, ComboboxLabel, ComboboxSeparator, ComboboxItem, ComboboxItemIndicator, TagsInputRoot, TagsInputItem, TagsInputItemText, TagsInputItemDelete, TagsInputInput, useForwardPropsEmits, useFilter } from "reka-ui";
|
|
12
12
|
import { defu } from "defu";
|
|
13
13
|
import { isEqual } from "ohash/utils";
|
|
14
14
|
import { reactivePick, createReusableTemplate } from "@vueuse/core";
|
|
@@ -18,196 +18,61 @@ import { useFormField } from "../composables/useFormField";
|
|
|
18
18
|
import { useLocale } from "../composables/useLocale";
|
|
19
19
|
import { compare, get, isArrayOfArray } from "../utils";
|
|
20
20
|
import icons from "../dictionary/icons";
|
|
21
|
+
import B24Avatar from "./Avatar.vue";
|
|
22
|
+
import B24Chip from "./Chip.vue";
|
|
21
23
|
defineOptions({ inheritAttrs: false });
|
|
22
24
|
const props = defineProps({
|
|
23
|
-
as: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
type:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
64
|
-
required:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
autofocus: {
|
|
69
|
-
type: Boolean,
|
|
70
|
-
required: false
|
|
71
|
-
},
|
|
72
|
-
autofocusDelay: {
|
|
73
|
-
type: Number,
|
|
74
|
-
required: false,
|
|
75
|
-
default: 0
|
|
76
|
-
},
|
|
77
|
-
trailingIcon: {
|
|
78
|
-
type: [Function, Object],
|
|
79
|
-
required: false
|
|
80
|
-
},
|
|
81
|
-
selectedIcon: {
|
|
82
|
-
type: [Function, Object],
|
|
83
|
-
required: false
|
|
84
|
-
},
|
|
85
|
-
deleteIcon: {
|
|
86
|
-
type: [Function, Object],
|
|
87
|
-
required: false
|
|
88
|
-
},
|
|
89
|
-
content: {
|
|
90
|
-
type: Object,
|
|
91
|
-
required: false
|
|
92
|
-
},
|
|
93
|
-
arrow: {
|
|
94
|
-
type: [Boolean, Object],
|
|
95
|
-
required: false
|
|
96
|
-
},
|
|
97
|
-
portal: {
|
|
98
|
-
type: Boolean,
|
|
99
|
-
required: false,
|
|
100
|
-
default: true
|
|
101
|
-
},
|
|
102
|
-
valueKey: {
|
|
103
|
-
type: null,
|
|
104
|
-
required: false
|
|
105
|
-
},
|
|
106
|
-
labelKey: {
|
|
107
|
-
type: null,
|
|
108
|
-
required: false,
|
|
109
|
-
default: "label"
|
|
110
|
-
},
|
|
111
|
-
items: {
|
|
112
|
-
type: null,
|
|
113
|
-
required: false
|
|
114
|
-
},
|
|
115
|
-
defaultValue: {
|
|
116
|
-
type: null,
|
|
117
|
-
required: false
|
|
118
|
-
},
|
|
119
|
-
modelValue: {
|
|
120
|
-
type: null,
|
|
121
|
-
required: false
|
|
122
|
-
},
|
|
123
|
-
multiple: {
|
|
124
|
-
type: Boolean,
|
|
125
|
-
required: false
|
|
126
|
-
},
|
|
127
|
-
tag: {
|
|
128
|
-
type: String,
|
|
129
|
-
required: false
|
|
130
|
-
},
|
|
131
|
-
tagColor: {
|
|
132
|
-
type: null,
|
|
133
|
-
required: false
|
|
134
|
-
},
|
|
135
|
-
highlight: {
|
|
136
|
-
type: Boolean,
|
|
137
|
-
required: false
|
|
138
|
-
},
|
|
139
|
-
createItem: {
|
|
140
|
-
type: [Boolean, String, Object],
|
|
141
|
-
required: false
|
|
142
|
-
},
|
|
143
|
-
filterFields: {
|
|
144
|
-
type: Array,
|
|
145
|
-
required: false
|
|
146
|
-
},
|
|
147
|
-
ignoreFilter: {
|
|
148
|
-
type: Boolean,
|
|
149
|
-
required: false
|
|
150
|
-
},
|
|
151
|
-
class: {
|
|
152
|
-
type: null,
|
|
153
|
-
required: false
|
|
154
|
-
},
|
|
155
|
-
b24ui: {
|
|
156
|
-
type: null,
|
|
157
|
-
required: false
|
|
158
|
-
},
|
|
159
|
-
open: {
|
|
160
|
-
type: Boolean,
|
|
161
|
-
required: false
|
|
162
|
-
},
|
|
163
|
-
defaultOpen: {
|
|
164
|
-
type: Boolean,
|
|
165
|
-
required: false
|
|
166
|
-
},
|
|
167
|
-
disabled: {
|
|
168
|
-
type: Boolean,
|
|
169
|
-
required: false
|
|
170
|
-
},
|
|
171
|
-
name: {
|
|
172
|
-
type: String,
|
|
173
|
-
required: false
|
|
174
|
-
},
|
|
175
|
-
resetSearchTermOnBlur: {
|
|
176
|
-
type: Boolean,
|
|
177
|
-
required: false
|
|
178
|
-
},
|
|
179
|
-
highlightOnHover: {
|
|
180
|
-
type: Boolean,
|
|
181
|
-
required: false
|
|
182
|
-
},
|
|
183
|
-
icon: {
|
|
184
|
-
type: [Function, Object],
|
|
185
|
-
required: false
|
|
186
|
-
},
|
|
187
|
-
avatar: {
|
|
188
|
-
type: Object,
|
|
189
|
-
required: false
|
|
190
|
-
},
|
|
191
|
-
loading: {
|
|
192
|
-
type: Boolean,
|
|
193
|
-
required: false
|
|
194
|
-
},
|
|
195
|
-
trailing: {
|
|
196
|
-
type: Boolean,
|
|
197
|
-
required: false
|
|
198
|
-
}
|
|
25
|
+
as: { type: null, required: false },
|
|
26
|
+
id: { type: String, required: false },
|
|
27
|
+
type: { type: null, required: false, default: "text" },
|
|
28
|
+
placeholder: { type: String, required: false },
|
|
29
|
+
color: { type: null, required: false },
|
|
30
|
+
size: { type: null, required: false },
|
|
31
|
+
noPadding: { type: Boolean, required: false },
|
|
32
|
+
noBorder: { type: Boolean, required: false },
|
|
33
|
+
underline: { type: Boolean, required: false },
|
|
34
|
+
rounded: { type: Boolean, required: false },
|
|
35
|
+
required: { type: Boolean, required: false },
|
|
36
|
+
autofocus: { type: Boolean, required: false },
|
|
37
|
+
autofocusDelay: { type: Number, required: false, default: 0 },
|
|
38
|
+
trailingIcon: { type: [Function, Object], required: false },
|
|
39
|
+
selectedIcon: { type: [Function, Object], required: false },
|
|
40
|
+
deleteIcon: { type: [Function, Object], required: false },
|
|
41
|
+
content: { type: Object, required: false },
|
|
42
|
+
arrow: { type: [Boolean, Object], required: false },
|
|
43
|
+
portal: { type: Boolean, required: false, default: true },
|
|
44
|
+
valueKey: { type: null, required: false },
|
|
45
|
+
labelKey: { type: null, required: false, default: "label" },
|
|
46
|
+
items: { type: null, required: false },
|
|
47
|
+
defaultValue: { type: null, required: false },
|
|
48
|
+
modelValue: { type: null, required: false },
|
|
49
|
+
multiple: { type: Boolean, required: false },
|
|
50
|
+
tag: { type: String, required: false },
|
|
51
|
+
tagColor: { type: null, required: false },
|
|
52
|
+
highlight: { type: Boolean, required: false },
|
|
53
|
+
createItem: { type: [Boolean, String, Object], required: false },
|
|
54
|
+
filterFields: { type: Array, required: false },
|
|
55
|
+
ignoreFilter: { type: Boolean, required: false },
|
|
56
|
+
class: { type: null, required: false },
|
|
57
|
+
b24ui: { type: null, required: false },
|
|
58
|
+
open: { type: Boolean, required: false },
|
|
59
|
+
defaultOpen: { type: Boolean, required: false },
|
|
60
|
+
disabled: { type: Boolean, required: false },
|
|
61
|
+
name: { type: String, required: false },
|
|
62
|
+
resetSearchTermOnBlur: { type: Boolean, required: false, default: true },
|
|
63
|
+
resetSearchTermOnSelect: { type: Boolean, required: false, default: true },
|
|
64
|
+
highlightOnHover: { type: Boolean, required: false },
|
|
65
|
+
icon: { type: [Function, Object], required: false },
|
|
66
|
+
avatar: { type: Object, required: false },
|
|
67
|
+
loading: { type: Boolean, required: false },
|
|
68
|
+
trailing: { type: Boolean, required: false }
|
|
199
69
|
});
|
|
200
70
|
const emits = defineEmits(["update:open", "change", "blur", "focus", "create", "highlight", "update:modelValue"]);
|
|
201
71
|
const slots = defineSlots();
|
|
202
|
-
const searchTerm = defineModel("searchTerm", {
|
|
203
|
-
"type": String,
|
|
204
|
-
...{
|
|
205
|
-
default: ""
|
|
206
|
-
}
|
|
207
|
-
});
|
|
72
|
+
const searchTerm = defineModel("searchTerm", { type: String, ...{ default: "" } });
|
|
208
73
|
const { t } = useLocale();
|
|
209
74
|
const { contains } = useFilter({ sensitivity: "base" });
|
|
210
|
-
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "open", "defaultOpen", "required", "multiple", "resetSearchTermOnBlur", "highlightOnHover", "ignoreFilter"), emits);
|
|
75
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "defaultValue", "open", "defaultOpen", "required", "multiple", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "highlightOnHover", "ignoreFilter"), emits);
|
|
211
76
|
const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8, position: "popper" }));
|
|
212
77
|
const arrowProps = toRef(() => props.arrow);
|
|
213
78
|
const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
|
|
@@ -292,6 +157,9 @@ function onUpdate(value) {
|
|
|
292
157
|
emits("change", event);
|
|
293
158
|
emitFormChange();
|
|
294
159
|
emitFormInput();
|
|
160
|
+
if (props.resetSearchTermOnSelect) {
|
|
161
|
+
searchTerm.value = "";
|
|
162
|
+
}
|
|
295
163
|
}
|
|
296
164
|
function onBlur(event) {
|
|
297
165
|
emits("blur", event);
|
|
@@ -302,17 +170,23 @@ function onFocus(event) {
|
|
|
302
170
|
emitFormFocus();
|
|
303
171
|
}
|
|
304
172
|
function onUpdateOpen(value) {
|
|
173
|
+
let timeoutId;
|
|
305
174
|
if (!value) {
|
|
306
175
|
const event = new FocusEvent("blur");
|
|
307
176
|
emits("blur", event);
|
|
308
177
|
emitFormBlur();
|
|
178
|
+
if (props.resetSearchTermOnBlur) {
|
|
179
|
+
const STATE_ANIMATION_DELAY_MS = 100;
|
|
180
|
+
timeoutId = setTimeout(() => {
|
|
181
|
+
searchTerm.value = "";
|
|
182
|
+
}, STATE_ANIMATION_DELAY_MS);
|
|
183
|
+
}
|
|
309
184
|
} else {
|
|
310
185
|
const event = new FocusEvent("focus");
|
|
311
186
|
emits("focus", event);
|
|
187
|
+
emitFormFocus();
|
|
188
|
+
clearTimeout(timeoutId);
|
|
312
189
|
}
|
|
313
|
-
nextTick(() => {
|
|
314
|
-
searchTerm.value = "";
|
|
315
|
-
});
|
|
316
190
|
}
|
|
317
191
|
function onRemoveTag(event) {
|
|
318
192
|
if (props.multiple) {
|
|
@@ -322,6 +196,16 @@ function onRemoveTag(event) {
|
|
|
322
196
|
onUpdate(filteredValue);
|
|
323
197
|
}
|
|
324
198
|
}
|
|
199
|
+
function onSelect(e, item) {
|
|
200
|
+
if (!isInputItem(item)) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (item.disabled) {
|
|
204
|
+
e.preventDefault();
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
item.onSelect?.(e);
|
|
208
|
+
}
|
|
325
209
|
function isInputItem(item) {
|
|
326
210
|
return typeof item === "object" && item !== null;
|
|
327
211
|
}
|
|
@@ -344,7 +228,7 @@ defineExpose({
|
|
|
344
228
|
:is="icons.plus"
|
|
345
229
|
:class="b24ui.itemLeadingIcon({ addNew: true, class: props.b24ui?.itemLeadingIcon })"
|
|
346
230
|
/>
|
|
347
|
-
{{ t(
|
|
231
|
+
{{ t('inputMenu.create', { label: searchTerm }) }}
|
|
348
232
|
</slot>
|
|
349
233
|
</span>
|
|
350
234
|
</ComboboxItem>
|
|
@@ -397,7 +281,7 @@ defineExpose({
|
|
|
397
281
|
</TagsInputItemDelete>
|
|
398
282
|
</TagsInputItem>
|
|
399
283
|
|
|
400
|
-
<ComboboxInput
|
|
284
|
+
<ComboboxInput v-model="searchTerm" as-child>
|
|
401
285
|
<TagsInputInput
|
|
402
286
|
ref="inputRef"
|
|
403
287
|
v-bind="{ ...$attrs, ...ariaAttrs }"
|
|
@@ -447,7 +331,7 @@ defineExpose({
|
|
|
447
331
|
<ComboboxContent :class="b24ui.content({ class: props.b24ui?.content })" v-bind="contentProps">
|
|
448
332
|
<ComboboxEmpty :class="b24ui.empty({ class: props.b24ui?.empty })">
|
|
449
333
|
<slot name="empty" :search-term="searchTerm">
|
|
450
|
-
{{ searchTerm ? t(
|
|
334
|
+
{{ searchTerm ? t('inputMenu.noMatch', { searchTerm }) : t('inputMenu.noData') }}
|
|
451
335
|
</slot>
|
|
452
336
|
</ComboboxEmpty>
|
|
453
337
|
|
|
@@ -467,7 +351,7 @@ defineExpose({
|
|
|
467
351
|
:class="b24ui.item({ class: props.b24ui?.item, colorItem: isInputItem(item) ? item?.color : void 0 })"
|
|
468
352
|
:disabled="isInputItem(item) && item.disabled"
|
|
469
353
|
:value="props.valueKey && isInputItem(item) ? get(item, String(props.valueKey)) : item"
|
|
470
|
-
@select="
|
|
354
|
+
@select="onSelect($event, item)"
|
|
471
355
|
>
|
|
472
356
|
<slot name="item" :item="item" :index="index">
|
|
473
357
|
<slot name="item-leading" :item="item" :index="index">
|