From c3223b51de87ef57e36a4e21f69cb5500219d336 Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Mon, 18 Mar 2024 03:18:08 +0530 Subject: [PATCH 1/4] feat: add v-model to remaining input components This facilitates migration from Vue 2 to Vue Next (3) easier. Also comes with the v-model advantages like the number modifier (v-model.number) which is not possible with .sync prop modifier. Signed-off-by: Anupam Kumar --- src/components/NcActionCheckbox/NcActionCheckbox.vue | 5 +++++ src/components/NcActionInput/NcActionInput.vue | 5 +++++ src/components/NcActionRadio/NcActionRadio.vue | 5 +++++ .../NcActionTextEditable/NcActionTextEditable.vue | 5 +++++ .../NcCheckboxRadioSwitch/NcCheckboxRadioSwitch.vue | 9 +++++++-- src/components/NcInputField/NcInputField.vue | 5 +++++ src/components/NcPasswordField/NcPasswordField.vue | 5 +++++ .../NcRichContenteditable/NcRichContenteditable.vue | 5 +++++ .../NcSettingsInputText/NcSettingsInputText.vue | 6 ++++++ src/components/NcTextArea/NcTextArea.vue | 5 +++++ src/components/NcTextField/NcTextField.vue | 5 +++++ 11 files changed, 58 insertions(+), 2 deletions(-) diff --git a/src/components/NcActionCheckbox/NcActionCheckbox.vue b/src/components/NcActionCheckbox/NcActionCheckbox.vue index 54d30dba5a..d45e132eb8 100644 --- a/src/components/NcActionCheckbox/NcActionCheckbox.vue +++ b/src/components/NcActionCheckbox/NcActionCheckbox.vue @@ -53,6 +53,11 @@ export default { }, }, + model: { + prop: 'checked', + event: 'update:checked', + }, + props: { /** * id attribute of the checkbox element diff --git a/src/components/NcActionInput/NcActionInput.vue b/src/components/NcActionInput/NcActionInput.vue index 8397bdcfd8..0a9d895f06 100644 --- a/src/components/NcActionInput/NcActionInput.vue +++ b/src/components/NcActionInput/NcActionInput.vue @@ -268,6 +268,11 @@ export default { mixins: [ActionGlobalMixin], + model: { + prop: 'value', + event: 'update:value', + }, + props: { /** * id attribute of the checkbox element diff --git a/src/components/NcActionRadio/NcActionRadio.vue b/src/components/NcActionRadio/NcActionRadio.vue index ae3a46593b..6ecbfa0057 100644 --- a/src/components/NcActionRadio/NcActionRadio.vue +++ b/src/components/NcActionRadio/NcActionRadio.vue @@ -56,6 +56,11 @@ export default { }, }, + model: { + prop: 'checked', + event: 'update:checked', + }, + props: { /** * id attribute of the radio element diff --git a/src/components/NcActionTextEditable/NcActionTextEditable.vue b/src/components/NcActionTextEditable/NcActionTextEditable.vue index 29d91bb237..28c5e6cfce 100644 --- a/src/components/NcActionTextEditable/NcActionTextEditable.vue +++ b/src/components/NcActionTextEditable/NcActionTextEditable.vue @@ -96,6 +96,11 @@ export default { mixins: [ActionTextMixin], + model: { + prop: 'value', + event: 'update:value', + }, + props: { /** * id attribute of the checkbox element diff --git a/src/components/NcCheckboxRadioSwitch/NcCheckboxRadioSwitch.vue b/src/components/NcCheckboxRadioSwitch/NcCheckboxRadioSwitch.vue index 5bcbc9a115..00dcc2ef04 100644 --- a/src/components/NcCheckboxRadioSwitch/NcCheckboxRadioSwitch.vue +++ b/src/components/NcCheckboxRadioSwitch/NcCheckboxRadioSwitch.vue @@ -297,9 +297,9 @@ export default { ``` diff --git a/src/components/NcActionRadio/NcActionRadio.vue b/src/components/NcActionRadio/NcActionRadio.vue index 6ecbfa0057..9b58d5d773 100644 --- a/src/components/NcActionRadio/NcActionRadio.vue +++ b/src/components/NcActionRadio/NcActionRadio.vue @@ -9,12 +9,30 @@ Usually, you will provide a name prop to bind the radio together. So that only one of each name set can be selected at the same time. ```vue + + + ``` diff --git a/src/components/NcCheckboxRadioSwitch/NcCheckboxRadioSwitch.vue b/src/components/NcCheckboxRadioSwitch/NcCheckboxRadioSwitch.vue index 00dcc2ef04..818fb3ce1e 100644 --- a/src/components/NcCheckboxRadioSwitch/NcCheckboxRadioSwitch.vue +++ b/src/components/NcCheckboxRadioSwitch/NcCheckboxRadioSwitch.vue @@ -18,6 +18,7 @@ Note: All attributes on the element are passed to the inner input element - exce
Enable sharing Enable sharing (disabled) + Enable sharing (v-model) Enable sharing (with request loading)
sharingEnabled: {{ sharingEnabled }} @@ -51,6 +52,7 @@ export default {
Default permission read Default permission read+write + Default permission read+write+execute
sharingPermission: {{ sharingPermission }}
@@ -203,6 +205,7 @@ export default { Permission read Permission write Permission delete + Permission execute
sharingPermission: {{ sharingPermission }}
@@ -223,6 +226,7 @@ export default { - + diff --git a/src/components/NcActionTextEditable/NcActionTextEditable.vue b/src/components/NcActionTextEditable/NcActionTextEditable.vue index 28c5e6cfce..fce2056700 100644 --- a/src/components/NcActionTextEditable/NcActionTextEditable.vue +++ b/src/components/NcActionTextEditable/NcActionTextEditable.vue @@ -20,7 +20,7 @@ All undocumented attributes will be bound to the textarea. e.g. `maxlength` - + @@ -34,6 +34,11 @@ export default { components: { Pencil, }, + data () { + return { + value: 'This is a textarea with name', + } + }, } ``` diff --git a/src/components/NcPasswordField/NcPasswordField.vue b/src/components/NcPasswordField/NcPasswordField.vue index d2faeb45bb..81592b1588 100644 --- a/src/components/NcPasswordField/NcPasswordField.vue +++ b/src/components/NcPasswordField/NcPasswordField.vue @@ -17,7 +17,7 @@ General purpose password field component.
diff --git a/src/components/NcRichContenteditable/NcRichContenteditable.vue b/src/components/NcRichContenteditable/NcRichContenteditable.vue index 16e015ac9a..1ef89d83c3 100644 --- a/src/components/NcRichContenteditable/NcRichContenteditable.vue +++ b/src/components/NcRichContenteditable/NcRichContenteditable.vue @@ -26,7 +26,7 @@ Try mentioning user @Test01 or inserting emoji :smile
```vue - - + + + ``` diff --git a/src/components/NcTextArea/NcTextArea.vue b/src/components/NcTextArea/NcTextArea.vue index b8741c1d89..388d2a72e9 100644 --- a/src/components/NcTextArea/NcTextArea.vue +++ b/src/components/NcTextArea/NcTextArea.vue @@ -13,35 +13,58 @@ It extends and styles an HTMLTextAreaElement. + +