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] feat(Nc*Field): migrate from value to model-value #4647

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/components/NcEmojiPicker/NcEmojiPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ This component allows the user to pick an emoji.
@select="select">
<template #searchTemplate="slotProps">
<NcTextField ref="search"
v-model:value="search"
v-model="search"
class="search"
:label="t('Search')"
:label-visible="true"
Expand Down
8 changes: 4 additions & 4 deletions src/components/NcInputField/NcInputField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ For a list of all available props and attributes, please check the [HTMLInputEle
'input-field__input--success': success,
'input-field__input--error': error,
}]"
:value="value"
:value="modelValue"
@input="handleInput">
<!-- Label -->
<label v-if="!labelOutside && isValidLabel"
Expand Down Expand Up @@ -128,7 +128,7 @@ export default {
/**
* The value of the input field
*/
value: {
modelValue: {
type: String,
required: true,
},
Expand Down Expand Up @@ -252,7 +252,7 @@ export default {
},

emits: [
'update:value',
'update:modelValue',
'trailing-button-click',
],

Expand Down Expand Up @@ -317,7 +317,7 @@ export default {
},

handleInput(event) {
this.$emit('update:value', event.target.value)
this.$emit('update:modelValue', event.target.value)
},

handleTrailingButtonClick(event) {
Expand Down
18 changes: 9 additions & 9 deletions src/components/NcPasswordField/NcPasswordField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,26 @@ General purpose password field component.
```
<template>
<div class="wrapper">
<NcPasswordField v-model:value="text1"
<NcPasswordField v-model="text1"
label="Old password" />
<div class="external-label">
<label for="textField">New password</label>
<NcPasswordField v-model:value="text2"
<NcPasswordField v-model="text2"
id="textField"
:label-outside="true"
placeholder="Min. 12 characters" />
</div>
<div class="external-label">
<label for="textField2">New password</label>
<NcPasswordField v-model:value="text3"
<NcPasswordField v-model="text3"
id="textField2"
:error="true"
:label-outside="true"
placeholder="Min. 12 characters"
helper-text="Password is insecure" />
</div>

<NcPasswordField v-model:value="text4"
<NcPasswordField v-model="text4"
label="Good new password"
:success="true"
placeholder="Min. 12 characters"
Expand All @@ -58,7 +58,7 @@ General purpose password field component.
</template>
</NcPasswordField>

<NcPasswordField v-model:value="text5"
<NcPasswordField v-model="text5"
:disabled="true"
label="Disabled" />
</div>
Expand Down Expand Up @@ -116,7 +116,7 @@ export default {
:success="computedSuccess"
:minlength="rules.minlength"
@trailing-button-click="togglePasswordVisibility"
@input="handleInput">
@update:model-value="handleInput">
<template v-if="!!$slots.icon" #icon>
<!-- Default slot for the leading icon -->
<slot name="icon" />
Expand Down Expand Up @@ -204,7 +204,7 @@ export default {
emits: [
'valid',
'invalid',
'update:value',
'update:modelValue',
],

data() {
Expand Down Expand Up @@ -243,7 +243,7 @@ export default {
},

watch: {
value(newValue) {
modelValue(newValue) {
if (this.checkPasswordStrength) {
if (this.passwordPolicy === null) {
return
Expand Down Expand Up @@ -281,7 +281,7 @@ export default {
*
* @property {string} The new value
*/
this.$emit('update:value', event.target.value)
this.$emit('update:modelValue', event)
},
togglePasswordVisibility() {
this.isPasswordHidden = !this.isPasswordHidden
Expand Down
20 changes: 10 additions & 10 deletions src/components/NcTextField/NcTextField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ and `minlength`.
```
<template>
<div class="wrapper">
<NcTextField v-model:value="text1"
<NcTextField v-model="text1"
label="Leading icon and clear trailing button"
trailing-button-icon="close"
:show-trailing-button="text1 !== ''"
Expand All @@ -43,7 +43,7 @@ and `minlength`.
<Magnify :size="20" />
</template>
</NcTextField>
<NcTextField :value.sync="text4"
<NcTextField v-model="text4"
label="Internal label"
placeholder="That can be used together with placeholder"
trailing-button-icon="close"
Expand All @@ -53,28 +53,28 @@ and `minlength`.
<Lock :size="20" />
</template>
</NcTextField>
<NcTextField v-model:value="text2"
<NcTextField v-model="text2"
label="Success state"
placeholder="Placeholders are possible"
:success="true"
@trailing-button-click="clearText">
</NcTextField>
<NcTextField v-model:value="text3"
<NcTextField v-model="text3"
label="Error state"
placeholder="Enter something valid"
:error="true"
@trailing-button-click="clearText">
</NcTextField>
<NcTextField :value=""
<NcTextField :model-value=""
label="Disabled"
:disabled="true" />
<NcTextField :value=""
<NcTextField :model-value=""
label="Disabled + Success"
:success="true"
:disabled="true" />
<div class="external-label">
<label for="textField">External label</label>
<NcTextField v-model:value="text5"
<NcTextField v-model="text5"
id="textField"
:label-outside="true"
placeholder="Input with external label"
Expand Down Expand Up @@ -139,7 +139,7 @@ export default {
<NcInputField v-bind="$props"
ref="inputField"
:trailing-button-label="clearTextLabel"
@input="handleInput">
@update:model-value="handleInput">
<template v-if="!!$slots.icon" #icon>
<!-- Default slot for the leading icon -->
<slot name="icon" />
Expand Down Expand Up @@ -193,7 +193,7 @@ export default {
},

emits: [
'update:value',
'update:modelValue',
],

computed: {
Expand Down Expand Up @@ -222,7 +222,7 @@ export default {
},

handleInput(event) {
this.$emit('update:value', event.target.value)
this.$emit('update:modelValue', event)
},
},
}
Expand Down
Loading