From 561eb4b6ff489901f3ea3629a5156b34fe1d8e98 Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Sun, 19 Jan 2025 16:27:14 +0100 Subject: [PATCH] feat(Nc*Field): add #icon slot for forward compatibility with v9 - Old default slot for the leading icon is deprecated now Signed-off-by: Grigorii K. Shartsev --- src/components/NcInputField/NcInputField.vue | 15 +++++++-------- .../NcPasswordField/NcPasswordField.vue | 10 ++++++++-- src/components/NcTextField/NcTextField.vue | 17 +++++++++++++---- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/components/NcInputField/NcInputField.vue b/src/components/NcInputField/NcInputField.vue index a5e05cf636..70d6c86e1a 100644 --- a/src/components/NcInputField/NcInputField.vue +++ b/src/components/NcInputField/NcInputField.vue @@ -21,7 +21,7 @@ For a list of all available props and attributes, please check the [HTMLInputEle :class="{ 'input-field--disabled': disabled, 'input-field--label-outside': labelOutside || !isValidLabel, - 'input-field--leading-icon': hasLeadingIcon, + 'input-field--leading-icon': !!$scopedSlots.icon || !!$scopedSlots.default || !!$slots.default, 'input-field--trailing-icon': showTrailingButton || hasTrailingIcon, 'input-field--pill': pill, }"> @@ -51,9 +51,12 @@ For a list of all available props and attributes, please check the [HTMLInputEle -
- - +
+ + + + +
@@ -285,10 +288,6 @@ export default { return 'input' + GenRandomId() }, - hasLeadingIcon() { - return this.$slots.default - }, - hasTrailingIcon() { return this.success }, diff --git a/src/components/NcPasswordField/NcPasswordField.vue b/src/components/NcPasswordField/NcPasswordField.vue index 8fc36804e8..464dcd639c 100644 --- a/src/components/NcPasswordField/NcPasswordField.vue +++ b/src/components/NcPasswordField/NcPasswordField.vue @@ -96,8 +96,14 @@ export default { v-on="$listeners" @trailing-button-click="togglePasswordVisibility" @input="handleInput"> - - + +