Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[next] fix(NcActionInput): listen to correct events #5231

Merged
merged 5 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions src/components/NcActionInput/NcActionInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ For the `NcSelect` component, all events will be passed through. Please see the
<Close :size="20" />
</template>
</NcActionInput>
<NcActionInput type="date" isNativePicker :model-value="new Date()">
<NcActionInput type="date" isNativePicker v-model="date">
<template #icon>
<Pencil :size="20" />
</template>
Please pick a date
</NcActionInput>
<NcActionInput type="date">
<NcActionInput type="date" v-model="date">
<template #icon>
<Pencil :size="20" />
</template>
Expand Down Expand Up @@ -126,6 +126,7 @@ For the `NcSelect` component, all events will be passed through. Please see the
data() {
return {
color: '#0082C9',
date: new Date(),
text: 'This is the input text',
multiSelected: [],
}
Expand Down Expand Up @@ -177,8 +178,7 @@ For the `NcSelect` component, all events will be passed through. Please see the
:input-class="['mx-input', { focusable: isFocusable }]"
class="action-input__datetimepicker"
v-bind="$attrs"
@input="onInput"
@change="onChange" />
@update:model-value="onUpdateModelValue" />

<NcDateTimePickerNative v-else-if="isNativePicker"
:id="idNativeDateTimePicker"
Expand All @@ -187,8 +187,7 @@ For the `NcSelect` component, all events will be passed through. Please see the
:input-class="{ focusable: isFocusable }"
class="action-input__datetimepicker"
v-bind="$attrs"
@input="$emit('input', $event)"
@change="$emit('change', $event)" />
@update:model-value="onUpdateModelValue" />

<NcSelect v-else-if="isMultiselectType"
:model-value="modelValue"
Expand All @@ -197,7 +196,8 @@ For the `NcSelect` component, all events will be passed through. Please see the
:append-to-body="false"
:input-class="{ focusable: isFocusable }"
class="action-input__multi"
v-bind="$attrs" />
v-bind="$attrs"
@update:model-value="onUpdateModelValue" />

<NcPasswordField v-else-if="type==='password'"
:id="inputId"
Expand All @@ -209,8 +209,7 @@ For the `NcSelect` component, all events will be passed through. Please see the
:input-class="{ focusable: isFocusable }"
:show-trailing-button="showTrailingButton && !disabled"
v-bind="$attrs"
@input="onInput"
@change="onChange" />
@update:model-value="onUpdateModelValue" />

<div v-else-if="type === 'color'" class="action-input__container">
<label v-if="label && type === 'color'"
Expand All @@ -224,7 +223,7 @@ For the `NcSelect` component, all events will be passed through. Please see the
:model-value="modelValue"
class="colorpicker__trigger"
v-bind="$attrs"
@input="onInput"
@update:model-value="onUpdateModelValue"
@submit="$refs.form.requestSubmit()">
<button :style="{'background-color': modelValue}"
class="colorpicker__preview"
Expand All @@ -247,8 +246,7 @@ For the `NcSelect` component, all events will be passed through. Please see the
:show-trailing-button="showTrailingButton && !disabled"
v-bind="$attrs"
@trailing-button-click="$refs.form.requestSubmit()"
@input="onInput"
@change="onChange" />
@update:model-value="onUpdateModelValue" />
</div>
</div>
</form>
Expand Down Expand Up @@ -484,13 +482,13 @@ export default {
return false
}
},
onChange(event) {
onUpdateModelValue(event) {
/**
* Emitted on change of the input field
* Emitted on update of the model value
*
* @type {Event}
*/
this.$emit('change', event)
this.$emit('update:modelValue', event)
},
},
}
Expand Down
6 changes: 0 additions & 6 deletions src/components/NcColorPicker/NcColorPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ export default defineComponent({
'close',
'update:open',
'update:modelValue',
'input',
],

data() {
Expand Down Expand Up @@ -387,11 +386,6 @@ export default defineComponent({
*/
this.$emit('update:modelValue', color)

/**
* Emits a hexadecimal string e.g. '#ffffff'
*/
this.$emit('input', color)

},

/**
Expand Down
Loading