Skip to content

Commit 46d394b

Browse files
authored
Merge pull request #1001 from Sysvale/fix/select-reactivity
fix/select-reactivity
2 parents fa082de + 50f8c1e commit 46d394b

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sysvale/cuida",
3-
"version": "3.138.0",
3+
"version": "3.138.1",
44
"description": "A design system built by Sysvale, using storybook and Vue components",
55
"repository": {
66
"type": "git",

src/components/Select.vue

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@
1010
>
1111
<CdsBaseInput
1212
:id="$attrs.id || id"
13-
:key="baseInputControl"
1413
ref="baseInput"
1514
v-bind="{...$attrs, ...props}"
16-
:model-value="get(localValue, optionsField)"
15+
v-model="computedModel"
1716
type="text"
1817
:onkeypress="`return ${allowSearch};`"
1918
:placeholder="placeholder"
@@ -98,7 +97,6 @@ import { get, cloneDeep } from 'lodash';
9897
import removeAccents from '../utils/methods/removeAccents';
9998
import CdsBaseInput from './BaseInput.vue';
10099
101-
102100
const model = defineModel('modelValue', {
103101
type: [Array, Object],
104102
});
@@ -296,7 +294,6 @@ const cdsSelect = useTemplateRef('cds-select');
296294
const selectOptions = useTemplateRef('select-options');
297295
const liRefs = ref({});
298296
const { emitClick, emitFocus, emitBlur, emitKeydown } = nativeEmits(emits);
299-
const baseInputControl = ref(0);
300297
const searchString = ref('');
301298
302299
/* COMPUTED */
@@ -335,6 +332,7 @@ const showAddOption = computed(() => {
335332
&& !localOptions.value.some(option => option[props.optionsField]?.toLowerCase() === searchString?.value.toLowerCase());
336333
});
337334
335+
const computedModel = computed(() => localValue.value[props.optionsField]);
338336
339337
//NOTE: Essa computada vai ser removida junto com a descontinuação da prop width na V4
340338
const computedFluid = computed(() => {
@@ -390,6 +388,7 @@ watch(localValue, (currentValue) => {
390388
391389
/* HOOKS */
392390
onMounted(() => {
391+
console.log('Select t2');
393392
id.value = `cds-select-${uniqueKey.value}`;
394393
selectElement.value = cdsSelect.value;
395394
});
@@ -441,7 +440,6 @@ function activateSelectionOnEnter() {
441440
}
442441
443442
searchString.value = '';
444-
baseInputControl.value += 1;
445443
select.value.blur();
446444
}
447445
@@ -472,7 +470,6 @@ function hide() {
472470
nextTick(() => {
473471
localOptions.value = pristineOptions.value;
474472
searchString.value = '';
475-
baseInputControl.value += 1;
476473
active.value = false;
477474
});
478475

0 commit comments

Comments
 (0)