From 709f0c52438c0eb31729ef1c005a3086522af1dc Mon Sep 17 00:00:00 2001 From: Douglas Calora Date: Fri, 28 Jun 2024 18:38:50 -0300 Subject: [PATCH 01/22] chore: Update QasInput to use composition API and add placeholder support --- docs/src/examples/QasInput/Basic.vue | 15 +++++++-- ui/src/components/field/QasField.vue | 15 ++++----- ui/src/components/input/QasInput.vue | 23 ++++++++++++-- ui/src/css/components/field.scss | 46 ++++++++++++++++++++++++++-- ui/src/helpers/get-placeholder.js | 19 ++++++++++++ ui/src/helpers/index.js | 1 + 6 files changed, 104 insertions(+), 15 deletions(-) create mode 100644 ui/src/helpers/get-placeholder.js diff --git a/docs/src/examples/QasInput/Basic.vue b/docs/src/examples/QasInput/Basic.vue index c6b86f848..dd745b28d 100644 --- a/docs/src/examples/QasInput/Basic.vue +++ b/docs/src/examples/QasInput/Basic.vue @@ -1,8 +1,17 @@ diff --git a/ui/src/components/field/QasField.vue b/ui/src/components/field/QasField.vue index 7405d376c..698f30801 100644 --- a/ui/src/components/field/QasField.vue +++ b/ui/src/components/field/QasField.vue @@ -61,24 +61,25 @@ export default { computed: { component () { const { + disable, entity, extensions, + filled, label, + mask, + maxFiles, maxlength, minlength, multiple, name, options, + placeholder, + places, + prefix, readonly, required, - disable, - filled = readonly, suffix, - prefix, - places, type, - mask, - maxFiles, useIso, useLazyLoading, useStrengthChecker @@ -94,7 +95,6 @@ export default { const input = { label, hideBottomSpace: !error.error, - outlined: true, ...error, readonly, required, @@ -103,6 +103,7 @@ export default { maxlength, minlength, suffix, + placeholder, prefix, useIso } diff --git a/ui/src/components/input/QasInput.vue b/ui/src/components/input/QasInput.vue index 2995707ad..4a53e6124 100644 --- a/ui/src/components/input/QasInput.vue +++ b/ui/src/components/input/QasInput.vue @@ -1,5 +1,5 @@ diff --git a/docs/src/pages/components/input.md b/docs/src/pages/components/input.md index e885d9636..d55fe2bfb 100644 --- a/docs/src/pages/components/input.md +++ b/docs/src/pages/components/input.md @@ -41,5 +41,6 @@ Caso seja passado uma mask que não seja essas acima, será usado a que foi pass ## Uso - - + + + diff --git a/ui/src/components/input/QasInput.vue b/ui/src/components/input/QasInput.vue index 4a53e6124..d14263d24 100644 --- a/ui/src/components/input/QasInput.vue +++ b/ui/src/components/input/QasInput.vue @@ -1,8 +1,16 @@ @@ -62,6 +70,16 @@ export default { useRemoveErrorOnType: { type: Boolean + }, + + icon: { + type: String, + default: '' + }, + + iconRight: { + type: String, + default: '' } }, @@ -126,6 +144,12 @@ export default { }, // redesign + classes () { + return { + 'qas-input--has-icon': this.hasAppend || this.hasPrepend + } + }, + isTextarea () { return this.$attrs.type === 'textarea' }, @@ -136,6 +160,14 @@ export default { hasCounter () { return this.$attrs.counter ?? (this.$attrs.maxlength && this.isTextarea) + }, + + hasPrepend () { + return !!this.$slots.prepend || this.iconRight + }, + + hasAppend () { + return !!this.$slots.append || this.icon } }, diff --git a/ui/src/components/select/QasSelect.vue b/ui/src/components/select/QasSelect.vue index 015158029..a2a3dbd44 100644 --- a/ui/src/components/select/QasSelect.vue +++ b/ui/src/components/select/QasSelect.vue @@ -1,5 +1,5 @@ + diff --git a/docs/src/examples/QasSelect/Basic.vue b/docs/src/examples/QasSelect/Basic.vue index 8113e5166..c94a9ef82 100644 --- a/docs/src/examples/QasSelect/Basic.vue +++ b/docs/src/examples/QasSelect/Basic.vue @@ -1,7 +1,7 @@