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

Allow to override showTrailingButton from an NcAction #4010

Merged
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
22 changes: 20 additions & 2 deletions src/components/NcActionInput/NcActionInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ For the multiselect component, all events will be passed through. Please see the
<Pencil :size="20" />
</template>
</NcActionInput>
<NcActionInput :value.sync="text" :show-trailing-button="false">
<template #icon>
<Pencil :size="20" />
</template>
</NcActionInput>
<NcActionInput :value.sync="text">
<template #icon>
<Pencil :size="20" />
Expand All @@ -45,6 +50,12 @@ For the multiselect component, all events will be passed through. Please see the
</template>
Password placeholder
</NcActionInput>
<NcActionInput type="password" :value.sync="text" :show-trailing-button="false">
<template #icon>
<Key :size="20" />
</template>
Password placeholder
</NcActionInput>
<NcActionInput type="color" :value.sync="color">
<template #icon>
<Eyedropper :size="20" />
Expand Down Expand Up @@ -191,7 +202,7 @@ For the multiselect component, all events will be passed through. Please see the
:disabled="disabled"
:input-class="{ focusable: isFocusable }"
trailing-button-icon="arrowRight"
:show-trailing-button="value !== '' && !disabled"
:show-trailing-button="showTrailingButton && value !== '' && !disabled"
v-bind="$attrs"
v-on="$listeners"
@trailing-button-click="$refs.form.requestSubmit()"
Expand Down Expand Up @@ -219,7 +230,7 @@ For the multiselect component, all events will be passed through. Please see the
:input-class="{ focusable: isFocusable }"
:type="type"
trailing-button-icon="arrowRight"
:show-trailing-button="value !== '' && !disabled"
:show-trailing-button="showTrailingButton && value !== '' && !disabled"
v-bind="$attrs"
v-on="$listeners"
@trailing-button-click="$refs.form.requestSubmit()"
Expand Down Expand Up @@ -349,6 +360,13 @@ export default {
type: Boolean,
default: null,
},
/**
* Attribute forwarded to the underlining NcPasswordField and NcTextField
*/
showTrailingButton: {
type: Boolean,
default: true,
},
},

emits: [
Expand Down
10 changes: 9 additions & 1 deletion src/components/NcPasswordField/NcPasswordField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default {
<NcInputField v-bind="{...$attrs, ...$props }"
ref="inputField"
:type="isPasswordHidden ? 'password' : 'text'"
:show-trailing-button="true"
:show-trailing-button="showTrailingButton && true"
:trailing-button-label="trailingButtonLabelPassword"
:helper-text="computedHelperText"
:error="computedError"
Expand Down Expand Up @@ -181,6 +181,14 @@ export default {
type: Number,
default: null,
},

/**
* Controls whether to display the trailing button.
*/
showTrailingButton: {
type: Boolean,
default: true,
},
},

emits: [
Expand Down