@webitel/ui-sdk 26.6.13 → 26.6.14
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/{contacts-BaxyRLLM.js → contacts-Bn25LSM7.js} +2 -2
- package/dist/{index-CigyElUb.js → index-CIA7dKZk.js} +1 -1
- package/dist/{index-DApIkp62.js → index-DEyszQsx.js} +1 -1
- package/dist/{install-DawOaJvS.js → install-BLruag0s.js} +14002 -12926
- package/dist/{isObject-CYCEPn3N.js → isObject-wgGRYtgO.js} +1 -1
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.js +1 -1
- package/dist/ui-sdk.umd.cjs +565 -279
- package/dist/{useVidstackSrc-DyrOa4mk.js → useVidstackSrc-BBi5oq8T.js} +1 -1
- package/dist/{vidstack-Bq6c3Bam-CAY97-jZ.js → vidstack-Bq6c3Bam-DXIHaRU6.js} +3 -3
- package/dist/{vidstack-D2pY00kU-CueRPheM.js → vidstack-D2pY00kU-BE_AqirM.js} +3 -3
- package/dist/{vidstack-DDXt6fpN-BRLi6AkS.js → vidstack-DDXt6fpN-D3xykUxG.js} +2 -2
- package/dist/{vidstack-D_-9AA6_-Dc5WN-OL.js → vidstack-D_-9AA6_-BDS42mA3.js} +2 -2
- package/dist/{vidstack-DqAw8m9J-D32aS290.js → vidstack-DqAw8m9J-DtFh5mkx.js} +1 -1
- package/dist/{vidstack-audio-BbddnRPa.js → vidstack-audio-BwtaRJRZ.js} +2 -2
- package/dist/{vidstack-dash-BNYPf-SD.js → vidstack-dash-CT0qNTAI.js} +4 -4
- package/dist/{vidstack-google-cast-f5Q76VEc.js → vidstack-google-cast-C4kSroiv.js} +4 -4
- package/dist/{vidstack-hls-hJ9GD_pP.js → vidstack-hls-CtCsnt_W.js} +4 -4
- package/dist/{vidstack-video-qY9NJ4Rl.js → vidstack-video-Bzwbx0RC.js} +3 -3
- package/dist/{vidstack-vimeo-Dcb0hTaj.js → vidstack-vimeo-CjK5ElAg.js} +4 -4
- package/dist/{vidstack-youtube-B29lleYJ.js → vidstack-youtube-C9_vpuPD.js} +3 -3
- package/dist/{wt-action-bar-ChN3mio6.js → wt-action-bar-Bc_GH6kU.js} +1 -1
- package/dist/{wt-button-select-KD0cPK4H.js → wt-button-select-Cc9o-NiI.js} +1 -1
- package/dist/{wt-call-media-action-BvM04q4r.js → wt-call-media-action-sWq9pI2N.js} +1 -1
- package/dist/wt-chat-emoji-Cl3YsoL-.js +2909 -0
- package/dist/{wt-confirm-dialog-DMquYnrJ.js → wt-confirm-dialog-yyIkkLwI.js} +1 -1
- package/dist/{wt-context-menu-ToE9-ffe.js → wt-context-menu-6WwSx8qR.js} +1 -1
- package/dist/{wt-copy-action-Bylf142B.js → wt-copy-action-Ea6x__OX.js} +1 -1
- package/dist/{wt-datepicker-BV7rf6Wk.js → wt-datepicker-Bi8iXDQC.js} +1 -1
- package/dist/{wt-display-chip-items-CXv8kX5b.js → wt-display-chip-items-CyshgAI0.js} +11 -11
- package/dist/{wt-dual-panel-Jmj4ip6N.js → wt-dual-panel-C3lUe446.js} +1 -1
- package/dist/{wt-dummy-BxEArso4.js → wt-dummy-07cnh7OP.js} +1 -1
- package/dist/{wt-error-page-rcqO8ZX0.js → wt-error-page-P4gAwDj2.js} +1 -1
- package/dist/{wt-expansion-card-By036A5Q.js → wt-expansion-card-DsLok2qe.js} +5 -5
- package/dist/{wt-expansion-panel-BFYozFsJ.js → wt-expansion-panel-BLgze326.js} +9 -9
- package/dist/{wt-filters-panel-wrapper-C49nxd6Z.js → wt-filters-panel-wrapper-BI7tOtsM.js} +1 -1
- package/dist/{wt-galleria-72LEmzfX.js → wt-galleria-DjUSBG29.js} +1 -1
- package/dist/{wt-inline-add-panel-CL0aM32a.js → wt-inline-add-panel-Bg32h70I.js} +1 -1
- package/dist/{wt-navigation-menu-B87j3Gxu.js → wt-navigation-menu-BhoGF372.js} +1 -1
- package/dist/{wt-notifications-bar-DJ7zMmH9.js → wt-notifications-bar-o6ePcWRj.js} +2 -2
- package/dist/{wt-pagination-D1kszR59.js → wt-pagination-DXVZMbtn.js} +1 -1
- package/dist/{wt-player-1VkST0ny.js → wt-player-Dv6UMcr3.js} +2 -2
- package/dist/{wt-screen-recordings-action-Boy3xJvB.js → wt-screen-recordings-action-BjIRc7t6.js} +1 -1
- package/dist/{wt-search-bar-D1qU-jDZ.js → wt-search-bar-CiyJ55hK.js} +1 -1
- package/dist/{wt-selection-popup-Bwa7CJym.js → wt-selection-popup-DLkerKfA.js} +1 -1
- package/dist/{wt-send-message-popup-1NrObXfW.js → wt-send-message-popup-CjfsCxfI.js} +18 -18
- package/dist/{wt-start-page-D3XXOoLT.js → wt-start-page-C-3-3fZc.js} +1 -1
- package/dist/{wt-status-select-BOPkG0nj.js → wt-status-select-CiKHudco.js} +1 -1
- package/dist/{wt-stepper-2TcrBla0.js → wt-stepper-CvqNjYsK.js} +1 -1
- package/dist/{wt-table-DpasMSII.js → wt-table-CBRWEe6H.js} +2 -2
- package/dist/{wt-table-actions-CQ67TwoU.js → wt-table-actions-ByAbJLsX.js} +1 -1
- package/dist/{wt-table-column-select-BZH5aqRk.js → wt-table-column-select-BsRkHmev.js} +2 -2
- package/dist/{wt-tabs-DOiZ6vld.js → wt-tabs-CtNBd15N.js} +1 -1
- package/dist/{wt-tags-input-DrP4EVai.js → wt-tags-input-DD9rSzuh.js} +2 -2
- package/dist/{wt-timepicker-CenAtHJ9.js → wt-timepicker-Cka-r9m0.js} +1 -1
- package/dist/{wt-tree-vAsblHJz.js → wt-tree-sZocE-Ui.js} +2 -2
- package/dist/{wt-tree-table-Bu35HIvM.js → wt-tree-table-D8JL2d1D.js} +2 -2
- package/dist/{wt-type-extension-value-input-B6k7nGgn.js → wt-type-extension-value-input-C1Ez10TA.js} +3 -3
- package/dist/{wt-vidstack-player-NmB4VBNR.js → wt-vidstack-player-Bv44QAeW.js} +10 -10
- package/package.json +1 -1
- package/src/components/_internals/composables/index.ts +7 -0
- package/src/components/_internals/composables/useSelect/useSelect.ts +101 -0
- package/src/components/_internals/composables/useSelect/useSelectCustomValues.ts +89 -0
- package/src/components/_internals/composables/useSelect/useSelectDropdown.ts +93 -0
- package/src/components/_internals/composables/useSelect/useSelectOptions.ts +198 -0
- package/src/components/_internals/composables/useSelect/useSelectUtils.ts +32 -0
- package/src/{composables → components/_internals/composables}/useWtTable/useWtTable.ts +1 -1
- package/src/components/index.js +6 -0
- package/src/components/wt-chip/wt-chip.vue +11 -2
- package/src/components/wt-expansion-card/wt-expansion-card.vue +1 -1
- package/src/components/wt-expansion-panel/wt-expansion-panel.vue +1 -1
- package/src/components/wt-galleria/wt-galleria.vue +4 -2
- package/src/components/wt-input-number/wt-input-number.vue +1 -2
- package/src/components/wt-input-text/wt-input-text.vue +3 -2
- package/src/components/wt-multi-select/wt-multi-select.vue +254 -0
- package/src/components/wt-password/wt-password.vue +1 -2
- package/src/components/wt-single-select/wt-single-select.vue +229 -0
- package/src/components/wt-table/wt-table.vue +1 -2
- package/src/components/wt-tree-table/wt-tree-table.vue +1 -2
- package/src/composables/index.ts +0 -6
- package/src/locale/en/en.js +3 -0
- package/src/locale/es/es.js +3 -0
- package/src/locale/kz/kz.js +3 -0
- package/src/locale/pl/pl.js +3 -0
- package/src/locale/ro/ro.js +3 -0
- package/src/locale/ru/ru.js +3 -0
- package/src/locale/uk/uk.js +3 -0
- package/src/locale/uz/uz.js +3 -0
- package/src/locale/vi/vi.js +3 -0
- package/src/plugins/primevue/primevue.plugin.js +4 -0
- package/src/plugins/primevue/theme/components/checkbox/checkbox.js +1 -1
- package/src/plugins/primevue/theme/components/components.js +4 -0
- package/src/plugins/primevue/theme/components/multi-select/multi-select.js +32 -0
- package/src/plugins/primevue/theme/components/single-select/single-select.js +24 -0
- package/types/components/_internals/composables/index.d.ts +7 -0
- package/types/components/_internals/composables/useSelect/useSelect.d.ts +29 -0
- package/types/components/_internals/composables/useSelect/useSelectCustomValues.d.ts +16 -0
- package/types/components/_internals/composables/useSelect/useSelectDropdown.d.ts +20 -0
- package/types/components/_internals/composables/useSelect/useSelectOptions.d.ts +20 -0
- package/types/components/_internals/composables/useSelect/useSelectUtils.d.ts +3 -0
- package/types/{composables → components/_internals/composables}/useWtTable/useWtTable.d.ts +0 -1
- package/types/components/wt-chip/wt-chip.vue.d.ts +5 -1
- package/types/components/wt-multi-select/wt-multi-select.vue.d.ts +82 -0
- package/types/components/wt-select/wt-select.vue.d.ts +1 -1
- package/types/components/wt-single-select/wt-single-select.vue.d.ts +83 -0
- package/types/components/wt-table/wt-table.vue.d.ts +1 -1
- package/types/components/wt-tree-table/wt-tree-table.vue.d.ts +1 -1
- package/types/composables/index.d.ts +0 -6
- package/types/locale/en/en.d.ts +3 -0
- package/types/locale/es/es.d.ts +3 -0
- package/types/locale/i18n.d.ts +27 -0
- package/types/locale/index.d.ts +27 -0
- package/types/locale/kz/kz.d.ts +3 -0
- package/types/locale/pl/pl.d.ts +3 -0
- package/types/locale/ro/ro.d.ts +3 -0
- package/types/locale/ru/ru.d.ts +3 -0
- package/types/locale/uk/uk.d.ts +3 -0
- package/types/locale/uz/uz.d.ts +3 -0
- package/types/locale/vi/vi.d.ts +3 -0
- package/types/plugins/primevue/theme/components/components.d.ts +4 -0
- package/types/plugins/primevue/theme/components/multi-select/multi-select.d.ts +151 -0
- package/types/plugins/primevue/theme/components/single-select/single-select.d.ts +157 -0
- package/dist/wt-chat-emoji-0UBEtnmy.js +0 -2429
- package/src/components/wt-select/wt-select-v2.vue +0 -244
- package/types/components/wt-select/wt-select-v2.vue.d.ts +0 -77
- /package/src/{composables → components/_internals/composables}/useExpansion/useExpansion.ts +0 -0
- /package/src/{composables → components/_internals/composables}/useGalleriaFullscreen/useGalleriaFullscreen.ts +0 -0
- /package/src/{composables → components/_internals/composables}/useGalleriaMaskClick/useGalleriaMaskClick.ts +0 -0
- /package/src/{composables → components/_internals/composables}/useInputControl/useInputControl.ts +0 -0
- /package/src/{composables → components/_internals/composables}/useTableColumnDrag/useTableColumnDrag.ts +0 -0
- /package/types/{composables → components/_internals/composables}/useExpansion/useExpansion.d.ts +0 -0
- /package/types/{composables → components/_internals/composables}/useGalleriaFullscreen/useGalleriaFullscreen.d.ts +0 -0
- /package/types/{composables → components/_internals/composables}/useGalleriaMaskClick/useGalleriaMaskClick.d.ts +0 -0
- /package/types/{composables → components/_internals/composables}/useInputControl/useInputControl.d.ts +0 -0
- /package/types/{composables → components/_internals/composables}/useTableColumnDrag/useTableColumnDrag.d.ts +0 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="wt-multi-select">
|
|
3
|
+
<wt-label
|
|
4
|
+
v-if="hasLabel"
|
|
5
|
+
:disabled="disabled"
|
|
6
|
+
:invalid="invalid"
|
|
7
|
+
class="wt-select__label"
|
|
8
|
+
v-bind="labelProps">
|
|
9
|
+
<!-- @slot Custom input label -->
|
|
10
|
+
<slot name="label" v-bind="{ label }">
|
|
11
|
+
{{ requiredLabel }}
|
|
12
|
+
</slot>
|
|
13
|
+
</wt-label>
|
|
14
|
+
<p-multi-select
|
|
15
|
+
ref="selectRef"
|
|
16
|
+
v-model="model"
|
|
17
|
+
fluid
|
|
18
|
+
input-class="typo-body-1"
|
|
19
|
+
:display="chipsView ? 'chip' : 'comma'"
|
|
20
|
+
:show-toggle-all="false"
|
|
21
|
+
:invalid="invalid"
|
|
22
|
+
:id="selectId"
|
|
23
|
+
:show-clear="showClear"
|
|
24
|
+
:disabled="disabled"
|
|
25
|
+
:placeholder="placeholder || label"
|
|
26
|
+
:option-disabled="() => disabledOptions"
|
|
27
|
+
:options="filteredOptions"
|
|
28
|
+
:option-label="(option) => getOptionLabel(option)"
|
|
29
|
+
:option-value="optionValue"
|
|
30
|
+
:loading="isLoading"
|
|
31
|
+
:max-selected-labels="MAX_SELECTED_LABELS"
|
|
32
|
+
:selectedItemsLabel="`${model.length} ${t('webitelUI.select.selectedItemsLabel')}`"
|
|
33
|
+
:data-key="dataKey"
|
|
34
|
+
v-bind="$attrs"
|
|
35
|
+
@before-show="onDropdownBeforeShow"
|
|
36
|
+
@before-hide="onDropdownBeforeHide"
|
|
37
|
+
@show="onDropdownShow"
|
|
38
|
+
@hide="onDropdownHide"
|
|
39
|
+
>
|
|
40
|
+
<template #header>
|
|
41
|
+
<wt-input-text
|
|
42
|
+
v-if="filterable"
|
|
43
|
+
ref="filterInput"
|
|
44
|
+
:model-value="filterText"
|
|
45
|
+
@update:model-value="filterOptions($event)"
|
|
46
|
+
@keydown.enter.stop="onInputKeydown"
|
|
47
|
+
>
|
|
48
|
+
<template #suffix>
|
|
49
|
+
<wt-icon v-if="allowCustomValues && filterText" icon="select-custom-value-enter" />
|
|
50
|
+
<wt-icon icon="search" />
|
|
51
|
+
</template>
|
|
52
|
+
</wt-input-text>
|
|
53
|
+
</template>
|
|
54
|
+
<template #option="{ option }">
|
|
55
|
+
<span
|
|
56
|
+
class="wt-multi-select__option-label"
|
|
57
|
+
v-tooltip="getOptionLabel(option)"
|
|
58
|
+
>
|
|
59
|
+
{{ getOptionLabel(option) }}
|
|
60
|
+
</span>
|
|
61
|
+
</template>
|
|
62
|
+
<template #itemcheckboxicon="{checked}">
|
|
63
|
+
<wt-checkbox
|
|
64
|
+
:selected="checked"
|
|
65
|
+
class="wt-multi-select__option-checkbox"
|
|
66
|
+
/>
|
|
67
|
+
</template>
|
|
68
|
+
<template #clearicon>
|
|
69
|
+
<wt-icon-btn
|
|
70
|
+
v-if="showClear && model"
|
|
71
|
+
icon="close"
|
|
72
|
+
@click="clearValue"
|
|
73
|
+
/>
|
|
74
|
+
</template>
|
|
75
|
+
<template #dropdownicon>
|
|
76
|
+
<wt-icon :icon="isDropdownOpen ? 'arrow-up' : 'arrow-down'" />
|
|
77
|
+
</template>
|
|
78
|
+
<template #loadingicon>
|
|
79
|
+
<wt-loader :size="ComponentSize.SM" />
|
|
80
|
+
</template>
|
|
81
|
+
<template #chip="{ value, removeCallback }">
|
|
82
|
+
<wt-chip
|
|
83
|
+
removable
|
|
84
|
+
:color="ChipColor.SECONDARY"
|
|
85
|
+
@remove="removeCallback($event)"
|
|
86
|
+
>
|
|
87
|
+
{{ getOptionLabel(value) }}
|
|
88
|
+
</wt-chip>
|
|
89
|
+
</template>
|
|
90
|
+
</p-multi-select>
|
|
91
|
+
<wt-message
|
|
92
|
+
v-if="isValidation && validationText"
|
|
93
|
+
:color="validationTextColor"
|
|
94
|
+
:variant="MessageVariant.SIMPLE"
|
|
95
|
+
:size="ComponentSize.SM"
|
|
96
|
+
>
|
|
97
|
+
{{ validationText }}
|
|
98
|
+
</wt-message>
|
|
99
|
+
</div>
|
|
100
|
+
</template>
|
|
101
|
+
|
|
102
|
+
<script setup lang="ts">
|
|
103
|
+
import type { SelectProps } from 'primevue';
|
|
104
|
+
import { computed, onMounted, toRefs, useSlots, useTemplateRef } from 'vue';
|
|
105
|
+
import { useI18n } from 'vue-i18n';
|
|
106
|
+
import { ChipColor, ComponentSize, MessageVariant } from '../../enums';
|
|
107
|
+
import { useValidation } from '../../mixins/validationMixin/useValidation';
|
|
108
|
+
import { useSelect } from '../_internals/composables/useSelect/useSelect';
|
|
109
|
+
import { toArray } from '../_internals/composables/useSelect/useSelectUtils';
|
|
110
|
+
|
|
111
|
+
interface Props extends SelectProps {
|
|
112
|
+
label?: string;
|
|
113
|
+
placeholder?: string;
|
|
114
|
+
required?: boolean;
|
|
115
|
+
disabled?: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* true disables all options but keeps dropdown visible
|
|
118
|
+
*/
|
|
119
|
+
disabledOptions?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* false disables options search
|
|
122
|
+
*/
|
|
123
|
+
filterable?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* true shows the clear button
|
|
126
|
+
*/
|
|
127
|
+
showClear?: boolean;
|
|
128
|
+
options?: unknown[];
|
|
129
|
+
optionLabel?: string;
|
|
130
|
+
optionValue?: string;
|
|
131
|
+
/**
|
|
132
|
+
* A property to uniquely identify an option.
|
|
133
|
+
*/
|
|
134
|
+
dataKey?: string;
|
|
135
|
+
/**
|
|
136
|
+
* Function that returns filtered options for server-side search
|
|
137
|
+
*/
|
|
138
|
+
searchMethod?: () => void;
|
|
139
|
+
/**
|
|
140
|
+
* true allows adding custom values through the filter input
|
|
141
|
+
*/
|
|
142
|
+
allowCustomValues?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* true emits custom values through the filter input instead of adding them automatically
|
|
145
|
+
*/
|
|
146
|
+
manualCustomValues?: boolean;
|
|
147
|
+
chipsView?: boolean;
|
|
148
|
+
labelProps?: object;
|
|
149
|
+
v?: Record<string, unknown>;
|
|
150
|
+
regleValidation?: RegleFieldStatus<string>;
|
|
151
|
+
customValidators?: unknown[];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
155
|
+
filterable: true,
|
|
156
|
+
showClear: true,
|
|
157
|
+
options: () => [],
|
|
158
|
+
optionLabel: 'label',
|
|
159
|
+
dataKey: 'id',
|
|
160
|
+
labelProps: () => ({}),
|
|
161
|
+
customValidators: () => [],
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
const model = defineModel({
|
|
165
|
+
default: [],
|
|
166
|
+
get(value) {
|
|
167
|
+
return toArray(value);
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
const { t } = useI18n();
|
|
172
|
+
|
|
173
|
+
const MAX_SELECTED_LABELS = 3;
|
|
174
|
+
|
|
175
|
+
const selectId = `select-${Math.random().toString(36).slice(2, 11)}`;
|
|
176
|
+
|
|
177
|
+
const filterInput = useTemplateRef('filterInput');
|
|
178
|
+
const selectRef = useTemplateRef('selectRef');
|
|
179
|
+
|
|
180
|
+
const emit = defineEmits<{
|
|
181
|
+
'add:custom-value': [
|
|
182
|
+
value: string,
|
|
183
|
+
];
|
|
184
|
+
reset: [];
|
|
185
|
+
}>();
|
|
186
|
+
|
|
187
|
+
const {
|
|
188
|
+
isLoading,
|
|
189
|
+
isDropdownOpen,
|
|
190
|
+
filterText,
|
|
191
|
+
filteredOptions,
|
|
192
|
+
getOptionLabel,
|
|
193
|
+
fetchOptions,
|
|
194
|
+
onDropdownBeforeShow,
|
|
195
|
+
onDropdownBeforeHide,
|
|
196
|
+
onDropdownShow,
|
|
197
|
+
onDropdownHide,
|
|
198
|
+
filterOptions,
|
|
199
|
+
onInputKeydown,
|
|
200
|
+
clearValue,
|
|
201
|
+
} = useSelect({
|
|
202
|
+
selected: model,
|
|
203
|
+
options: computed(() => props.options),
|
|
204
|
+
optionLabel: computed(() => props.optionLabel),
|
|
205
|
+
optionValue: computed(() => props.optionValue),
|
|
206
|
+
dataKey: computed(() => props.dataKey),
|
|
207
|
+
allowCustomValues: computed(() => props.allowCustomValues),
|
|
208
|
+
manualCustomValues: computed(() => props.manualCustomValues),
|
|
209
|
+
filterInput,
|
|
210
|
+
selectRef,
|
|
211
|
+
searchMethod: computed(() => props.searchMethod),
|
|
212
|
+
selectId: computed(() => selectId),
|
|
213
|
+
isSingle: false,
|
|
214
|
+
emit,
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
const slots = useSlots();
|
|
218
|
+
|
|
219
|
+
const { v, customValidators, regleValidation } = toRefs(props);
|
|
220
|
+
|
|
221
|
+
const { isValidation, invalid, validationText, validationTextColor } =
|
|
222
|
+
useValidation({
|
|
223
|
+
v,
|
|
224
|
+
customValidators,
|
|
225
|
+
regleValidation,
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
const hasLabel = computed(() => {
|
|
229
|
+
return props.label || slots.label;
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
const requiredLabel = computed(() => {
|
|
233
|
+
return props.required ? `${props.label}*` : props.label;
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
onMounted(() => {
|
|
237
|
+
if (props.searchMethod) fetchOptions();
|
|
238
|
+
});
|
|
239
|
+
</script>
|
|
240
|
+
|
|
241
|
+
<style scoped>
|
|
242
|
+
.wt-multi-select {
|
|
243
|
+
width: 100%;
|
|
244
|
+
min-width: 0;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.wt-multi-select__option-label {
|
|
248
|
+
user-select: none;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.wt-multi-select__option-checkbox {
|
|
252
|
+
pointer-events: none;
|
|
253
|
+
}
|
|
254
|
+
</style>
|
|
@@ -60,10 +60,9 @@ import {
|
|
|
60
60
|
useSlots,
|
|
61
61
|
useTemplateRef,
|
|
62
62
|
} from 'vue';
|
|
63
|
-
|
|
64
|
-
import { useInputControl } from '../../composables';
|
|
65
63
|
import { ComponentSize, MessageColor, MessageVariant } from '../../enums';
|
|
66
64
|
import { useValidation } from '../../mixins/validationMixin/useValidation';
|
|
65
|
+
import { useInputControl } from '../_internals/composables';
|
|
67
66
|
|
|
68
67
|
interface WtPasswordProps extends /* @vue-ignore */ PasswordProps {
|
|
69
68
|
label?: string;
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="wt-single-select">
|
|
3
|
+
<wt-label
|
|
4
|
+
v-if="hasLabel"
|
|
5
|
+
:disabled="disabled"
|
|
6
|
+
:invalid="invalid"
|
|
7
|
+
class="wt-select__label"
|
|
8
|
+
v-bind="labelProps">
|
|
9
|
+
<!-- @slot Custom input label -->
|
|
10
|
+
<slot name="label" v-bind="{ label }">
|
|
11
|
+
{{ requiredLabel }}
|
|
12
|
+
</slot>
|
|
13
|
+
</wt-label>
|
|
14
|
+
<p-select
|
|
15
|
+
ref="selectRef"
|
|
16
|
+
v-model="model"
|
|
17
|
+
fluid
|
|
18
|
+
input-class="typo-body-1"
|
|
19
|
+
:invalid="invalid"
|
|
20
|
+
:id="selectId"
|
|
21
|
+
:show-clear="showClear"
|
|
22
|
+
:disabled="disabled"
|
|
23
|
+
:placeholder="placeholder || label"
|
|
24
|
+
:option-disabled="() => disabledOptions"
|
|
25
|
+
:options="filteredOptions"
|
|
26
|
+
:option-label="(option) => getOptionLabel(option)"
|
|
27
|
+
:option-value="optionValue"
|
|
28
|
+
:loading="isLoading"
|
|
29
|
+
:data-key="dataKey"
|
|
30
|
+
v-bind="$attrs"
|
|
31
|
+
@before-show="onDropdownBeforeShow"
|
|
32
|
+
@before-hide="onDropdownBeforeHide"
|
|
33
|
+
@show="onDropdownShow"
|
|
34
|
+
@hide="onDropdownHide"
|
|
35
|
+
>
|
|
36
|
+
<template #header>
|
|
37
|
+
<wt-input-text
|
|
38
|
+
v-if="filterable"
|
|
39
|
+
ref="filterInput"
|
|
40
|
+
:model-value="filterText"
|
|
41
|
+
@update:model-value="filterOptions($event)"
|
|
42
|
+
@keydown.enter.stop="onInputKeydown"
|
|
43
|
+
>
|
|
44
|
+
<template #suffix>
|
|
45
|
+
<wt-icon v-if="allowCustomValues && filterText" icon="select-custom-value-enter" />
|
|
46
|
+
<wt-icon icon="search" />
|
|
47
|
+
</template>
|
|
48
|
+
</wt-input-text>
|
|
49
|
+
</template>
|
|
50
|
+
<template v-if="model" #value="{ value, placeholder }">
|
|
51
|
+
<slot name="value" v-bind="{ value, getOptionLabel, placeholder }">
|
|
52
|
+
<span
|
|
53
|
+
v-tooltip="getOptionLabel(value)"
|
|
54
|
+
>
|
|
55
|
+
{{ getOptionLabel(value) || placeholder }}
|
|
56
|
+
</span>
|
|
57
|
+
</slot>
|
|
58
|
+
</template>
|
|
59
|
+
<template #option="{ option }">
|
|
60
|
+
<slot name="option" v-bind="{ option, getOptionLabel }">
|
|
61
|
+
<span
|
|
62
|
+
class="wt-single-select__option-label"
|
|
63
|
+
v-tooltip="getOptionLabel(option)"
|
|
64
|
+
>
|
|
65
|
+
{{ getOptionLabel(option) }}
|
|
66
|
+
</span>
|
|
67
|
+
</slot>
|
|
68
|
+
</template>
|
|
69
|
+
<template #clearicon>
|
|
70
|
+
<wt-icon-btn
|
|
71
|
+
v-if="showClear && model"
|
|
72
|
+
icon="close"
|
|
73
|
+
@click="clearValue"
|
|
74
|
+
/>
|
|
75
|
+
</template>
|
|
76
|
+
<template #dropdownicon>
|
|
77
|
+
<wt-icon :icon="isDropdownOpen ? 'arrow-up' : 'arrow-down'" />
|
|
78
|
+
</template>
|
|
79
|
+
<template #loadingicon>
|
|
80
|
+
<wt-loader :size="ComponentSize.SM" />
|
|
81
|
+
</template>
|
|
82
|
+
</p-select>
|
|
83
|
+
<wt-message
|
|
84
|
+
v-if="isValidation && validationText"
|
|
85
|
+
:color="validationTextColor"
|
|
86
|
+
:variant="MessageVariant.SIMPLE"
|
|
87
|
+
:size="ComponentSize.SM"
|
|
88
|
+
>
|
|
89
|
+
{{ validationText }}
|
|
90
|
+
</wt-message>
|
|
91
|
+
</div>
|
|
92
|
+
</template>
|
|
93
|
+
|
|
94
|
+
<script setup lang="ts">
|
|
95
|
+
import type { SelectProps } from 'primevue';
|
|
96
|
+
import { computed, onMounted, toRefs, useSlots, useTemplateRef } from 'vue';
|
|
97
|
+
import { ComponentSize, MessageColor, MessageVariant } from '../../enums';
|
|
98
|
+
import { useValidation } from '../../mixins/validationMixin/useValidation';
|
|
99
|
+
import { useSelect } from '../_internals/composables/useSelect/useSelect';
|
|
100
|
+
|
|
101
|
+
interface Props extends SelectProps {
|
|
102
|
+
label?: string;
|
|
103
|
+
placeholder?: string;
|
|
104
|
+
required?: boolean;
|
|
105
|
+
disabled?: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* true disables all options but keeps dropdown visible
|
|
108
|
+
*/
|
|
109
|
+
disabledOptions?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* false disables options search
|
|
112
|
+
*/
|
|
113
|
+
filterable?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* true shows the clear button
|
|
116
|
+
*/
|
|
117
|
+
showClear?: boolean;
|
|
118
|
+
options?: unknown[];
|
|
119
|
+
optionLabel?: string;
|
|
120
|
+
optionValue?: string;
|
|
121
|
+
/**
|
|
122
|
+
* A property to uniquely identify an option.
|
|
123
|
+
*/
|
|
124
|
+
dataKey?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Function that returns filtered options for server-side search
|
|
127
|
+
*/
|
|
128
|
+
searchMethod?: () => void;
|
|
129
|
+
/**
|
|
130
|
+
* true allows adding custom values through the filter input
|
|
131
|
+
*/
|
|
132
|
+
allowCustomValues?: boolean;
|
|
133
|
+
labelProps?: object;
|
|
134
|
+
v?: Record<string, unknown>;
|
|
135
|
+
regleValidation?: RegleFieldStatus<string>;
|
|
136
|
+
customValidators?: unknown[];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
140
|
+
filterable: true,
|
|
141
|
+
showClear: true,
|
|
142
|
+
options: () => [],
|
|
143
|
+
optionLabel: 'label',
|
|
144
|
+
dataKey: 'id',
|
|
145
|
+
labelProps: () => ({}),
|
|
146
|
+
customValidators: () => [],
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
const model = defineModel<string>({
|
|
150
|
+
default: '',
|
|
151
|
+
get: (value) => {
|
|
152
|
+
if (value == null) return '';
|
|
153
|
+
if (typeof value !== 'object') return value;
|
|
154
|
+
return Object.keys(value).length > 0 ? value : '';
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
const emit = defineEmits<{
|
|
159
|
+
reset: [];
|
|
160
|
+
}>();
|
|
161
|
+
|
|
162
|
+
const selectId = `select-${Math.random().toString(36).slice(2, 11)}`;
|
|
163
|
+
|
|
164
|
+
const filterInput = useTemplateRef('filterInput');
|
|
165
|
+
const selectRef = useTemplateRef('selectRef');
|
|
166
|
+
|
|
167
|
+
const {
|
|
168
|
+
isLoading,
|
|
169
|
+
isDropdownOpen,
|
|
170
|
+
filterText,
|
|
171
|
+
filteredOptions,
|
|
172
|
+
getOptionLabel,
|
|
173
|
+
fetchOptions,
|
|
174
|
+
onDropdownBeforeShow,
|
|
175
|
+
onDropdownBeforeHide,
|
|
176
|
+
onDropdownShow,
|
|
177
|
+
onDropdownHide,
|
|
178
|
+
filterOptions,
|
|
179
|
+
onInputKeydown,
|
|
180
|
+
clearValue,
|
|
181
|
+
} = useSelect({
|
|
182
|
+
selected: model,
|
|
183
|
+
options: computed(() => props.options),
|
|
184
|
+
optionLabel: computed(() => props.optionLabel),
|
|
185
|
+
optionValue: computed(() => props.optionValue),
|
|
186
|
+
dataKey: computed(() => props.dataKey),
|
|
187
|
+
allowCustomValues: computed(() => props.allowCustomValues),
|
|
188
|
+
filterInput,
|
|
189
|
+
selectRef,
|
|
190
|
+
searchMethod: computed(() => props.searchMethod),
|
|
191
|
+
selectId: computed(() => selectId),
|
|
192
|
+
isSingle: true,
|
|
193
|
+
emit,
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
const slots = useSlots();
|
|
197
|
+
|
|
198
|
+
const { v, customValidators, regleValidation } = toRefs(props);
|
|
199
|
+
|
|
200
|
+
const { isValidation, invalid, validationText, validationTextColor } =
|
|
201
|
+
useValidation({
|
|
202
|
+
v,
|
|
203
|
+
customValidators,
|
|
204
|
+
regleValidation,
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
const hasLabel = computed(() => {
|
|
208
|
+
return props.label || slots.label;
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
const requiredLabel = computed(() => {
|
|
212
|
+
return props.required ? `${props.label}*` : props.label;
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
onMounted(() => {
|
|
216
|
+
if (props.searchMethod) fetchOptions();
|
|
217
|
+
});
|
|
218
|
+
</script>
|
|
219
|
+
|
|
220
|
+
<style scoped>
|
|
221
|
+
.wt-single-select {
|
|
222
|
+
width: 100%;
|
|
223
|
+
min-width: 0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.wt-single-select__option-label {
|
|
227
|
+
user-select: none;
|
|
228
|
+
}
|
|
229
|
+
</style>
|
|
@@ -228,9 +228,8 @@ import {
|
|
|
228
228
|
useTemplateRef,
|
|
229
229
|
} from 'vue';
|
|
230
230
|
import { useI18n } from 'vue-i18n';
|
|
231
|
-
|
|
232
|
-
import { useTableColumnDrag } from '../../composables';
|
|
233
231
|
import { getNextSortOrder } from '../../scripts/sortQueryAdapters.js';
|
|
232
|
+
import { useTableColumnDrag } from '../_internals/composables';
|
|
234
233
|
import type { WtTableHeader } from './types/WtTable';
|
|
235
234
|
|
|
236
235
|
/**
|
|
@@ -100,9 +100,8 @@
|
|
|
100
100
|
lang="ts"
|
|
101
101
|
>
|
|
102
102
|
import { computed, toRef } from 'vue';
|
|
103
|
-
|
|
104
|
-
import { useWtTable } from '../../composables/useWtTable/useWtTable';
|
|
105
103
|
import { getNextSortOrder } from '../../scripts/sortQueryAdapters';
|
|
104
|
+
import { useWtTable } from '../_internals/composables/useWtTable/useWtTable';
|
|
106
105
|
import WtCheckbox from '../wt-checkbox/wt-checkbox.vue';
|
|
107
106
|
import type { WtTableHeader } from '../wt-table/types/WtTable.d.ts';
|
|
108
107
|
import WtTreeTableRow from '../wt-tree-table-row/wt-tree-table-row.vue';
|
package/src/composables/index.ts
CHANGED
|
@@ -4,11 +4,5 @@ export * from './useCard/useCardComponent';
|
|
|
4
4
|
export * from './useCard/useCardTabs';
|
|
5
5
|
export * from './useClose/useClose';
|
|
6
6
|
export * from './useDestroyableSortable/useDestroyableSortable';
|
|
7
|
-
export * from './useExpansion/useExpansion';
|
|
8
|
-
export * from './useGalleriaFullscreen/useGalleriaFullscreen';
|
|
9
|
-
export * from './useGalleriaMaskClick/useGalleriaMaskClick';
|
|
10
|
-
export * from './useInputControl/useInputControl';
|
|
11
7
|
export * from './useRepresentableAgentPauseCause/useRepresentableAgentPauseCause';
|
|
12
|
-
export * from './useTableColumnDrag/useTableColumnDrag';
|
|
13
8
|
export * from './useValidate/useValidate';
|
|
14
|
-
export * from './useWtTable/useWtTable';
|
package/src/locale/en/en.js
CHANGED
package/src/locale/es/es.js
CHANGED
package/src/locale/kz/kz.js
CHANGED
package/src/locale/pl/pl.js
CHANGED
package/src/locale/ro/ro.js
CHANGED
package/src/locale/ru/ru.js
CHANGED
package/src/locale/uk/uk.js
CHANGED
package/src/locale/uz/uz.js
CHANGED
package/src/locale/vi/vi.js
CHANGED
|
@@ -17,9 +17,11 @@ import PInputNumber from 'primevue/inputnumber';
|
|
|
17
17
|
import PInputText from 'primevue/inputtext';
|
|
18
18
|
import PMenubar from 'primevue/menubar';
|
|
19
19
|
import PMessage from 'primevue/message';
|
|
20
|
+
import PMultiSelect from 'primevue/multiselect';
|
|
20
21
|
import PPassword from 'primevue/password';
|
|
21
22
|
import PPopover from 'primevue/popover';
|
|
22
23
|
import PRadio from 'primevue/radiobutton';
|
|
24
|
+
import PSelect from 'primevue/select';
|
|
23
25
|
import PSlider from 'primevue/slider';
|
|
24
26
|
import PTextarea from 'primevue/textarea';
|
|
25
27
|
import PToggleSwitch from 'primevue/toggleswitch';
|
|
@@ -80,6 +82,8 @@ const initPrimevue = (app) => {
|
|
|
80
82
|
changeComponentCompatMode(PInputGroupAddon),
|
|
81
83
|
);
|
|
82
84
|
app.component('PMessage', changeComponentCompatMode(PMessage));
|
|
85
|
+
app.component('PMultiSelect', changeComponentCompatMode(PMultiSelect));
|
|
86
|
+
app.component('PSelect', changeComponentCompatMode(PSelect));
|
|
83
87
|
|
|
84
88
|
app.directive('tooltip', Tooltip);
|
|
85
89
|
};
|
|
@@ -13,9 +13,11 @@ import inputNumber from './input-number/input-number.js';
|
|
|
13
13
|
import inputText from './input-text/input-text.js';
|
|
14
14
|
import menubar from './menubar/menubar.js';
|
|
15
15
|
import message from './message/message.js';
|
|
16
|
+
import multiSelect from './multi-select/multi-select.js';
|
|
16
17
|
import password from './password/password.js';
|
|
17
18
|
import popover from './popover/popover.js';
|
|
18
19
|
import radio from './radio/radio.js';
|
|
20
|
+
import singleSelect from './single-select/single-select.js';
|
|
19
21
|
import slider from './slider/slider.js';
|
|
20
22
|
import switcher from './switcher/switcher.js';
|
|
21
23
|
import table from './table/table.js';
|
|
@@ -48,6 +50,8 @@ const components = {
|
|
|
48
50
|
datatable: table,
|
|
49
51
|
toolbar,
|
|
50
52
|
galleria,
|
|
53
|
+
multiselect: multiSelect,
|
|
54
|
+
select: singleSelect,
|
|
51
55
|
};
|
|
52
56
|
|
|
53
57
|
export default components;
|