From 18b97866f24239cea49816180f7daba0932f0dca Mon Sep 17 00:00:00 2001 From: Milos Holba Date: Sun, 7 Feb 2021 13:26:42 +0100 Subject: [PATCH] MultiEmailInput first email dont need to be separated by comma or space, RenameItem comment ActionButton for more options --- public/mix-manifest.json | 24 ++++++++++++- .../Others/Forms/MultiEmailInput.vue | 36 +++++++++++-------- resources/js/components/Others/RenameItem.vue | 2 +- 3 files changed, 46 insertions(+), 16 deletions(-) diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 6658cbaf..884f008a 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -79,5 +79,27 @@ "/js/main.a7dbc5836b9344e3e26d.hot-update.js": "/js/main.a7dbc5836b9344e3e26d.hot-update.js", "/chunks/app-index.a7dbc5836b9344e3e26d.hot-update.js": "/chunks/app-index.a7dbc5836b9344e3e26d.hot-update.js", "/chunks/files~chunks/shared-files~chunks/shared-page.a7dbc5836b9344e3e26d.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.a7dbc5836b9344e3e26d.hot-update.js", - "/chunks/landing-page.a7dbc5836b9344e3e26d.hot-update.js": "/chunks/landing-page.a7dbc5836b9344e3e26d.hot-update.js" + "/chunks/landing-page.a7dbc5836b9344e3e26d.hot-update.js": "/chunks/landing-page.a7dbc5836b9344e3e26d.hot-update.js", + "/js/main.58e20853c0060fabb694.hot-update.js": "/js/main.58e20853c0060fabb694.hot-update.js", + "/js/main.d36b7327b7ceaf48dc23.hot-update.js": "/js/main.d36b7327b7ceaf48dc23.hot-update.js", + "/js/main.9056b6a318b4426467c6.hot-update.js": "/js/main.9056b6a318b4426467c6.hot-update.js", + "/js/main.a5fba33e4585e691dfb5.hot-update.js": "/js/main.a5fba33e4585e691dfb5.hot-update.js", + "/js/main.3f82c127a8cdfffb8c3b.hot-update.js": "/js/main.3f82c127a8cdfffb8c3b.hot-update.js", + "/js/main.99a11c7584bb53f9658d.hot-update.js": "/js/main.99a11c7584bb53f9658d.hot-update.js", + "/js/main.e54fbdcbcaa3e8b1973d.hot-update.js": "/js/main.e54fbdcbcaa3e8b1973d.hot-update.js", + "/js/main.74fd773f486eb60eed39.hot-update.js": "/js/main.74fd773f486eb60eed39.hot-update.js", + "/js/main.f3711fed88e414972ddd.hot-update.js": "/js/main.f3711fed88e414972ddd.hot-update.js", + "/js/main.9fb564020f9aa4ea00bc.hot-update.js": "/js/main.9fb564020f9aa4ea00bc.hot-update.js", + "/js/main.6efe9661a328f278feb0.hot-update.js": "/js/main.6efe9661a328f278feb0.hot-update.js", + "/js/main.cc811fdbaeca808728a1.hot-update.js": "/js/main.cc811fdbaeca808728a1.hot-update.js", + "/js/main.7e7e628c5fedbb621b23.hot-update.js": "/js/main.7e7e628c5fedbb621b23.hot-update.js", + "/js/main.2021da8323a75241a20d.hot-update.js": "/js/main.2021da8323a75241a20d.hot-update.js", + "/js/main.07ef3eb8bf1bebbe0567.hot-update.js": "/js/main.07ef3eb8bf1bebbe0567.hot-update.js", + "/js/main.ff29433b11932e0747e8.hot-update.js": "/js/main.ff29433b11932e0747e8.hot-update.js", + "/js/main.65b0d39be7a6dc0bebb7.hot-update.js": "/js/main.65b0d39be7a6dc0bebb7.hot-update.js", + "/js/main.1860fe9ef49b805cfc53.hot-update.js": "/js/main.1860fe9ef49b805cfc53.hot-update.js", + "/js/main.faedd50fd36ecf8b5ae2.hot-update.js": "/js/main.faedd50fd36ecf8b5ae2.hot-update.js", + "/js/main.7228d3845cd3e5c790c8.hot-update.js": "/js/main.7228d3845cd3e5c790c8.hot-update.js", + "/js/main.691fbeffd45e163fe5e1.hot-update.js": "/js/main.691fbeffd45e163fe5e1.hot-update.js", + "/js/main.e804714e7fba8134c127.hot-update.js": "/js/main.e804714e7fba8134c127.hot-update.js" } diff --git a/resources/js/components/Others/Forms/MultiEmailInput.vue b/resources/js/components/Others/Forms/MultiEmailInput.vue index a0bdc647..ebbd5612 100644 --- a/resources/js/components/Others/Forms/MultiEmailInput.vue +++ b/resources/js/components/Others/Forms/MultiEmailInput.vue @@ -24,10 +24,10 @@ export default { props: ['isError', 'label'], computed: { getCharactersLength() { - return this.emails.join('').length + return this.emails.join( '' ).length }, placeHolder() { - return !this.emails.length ? this.$t('shared_form.email_placeholder') : '' + return !this.emails.length ? this.$t( 'shared_form.email_placeholder' ) : '' }, inputSize() { return this.email && this.email.length > 14 ? this.email.length : 14 @@ -40,36 +40,44 @@ export default { } }, methods: { - removeEmail(email) { - this.emails = this.emails.filter(item => item !== email) + removeEmail( email ) { + this.emails = this.emails.filter( item => item !== email ) + + // After romove email send new emails list to parent + events.$emit( 'emailsInputValues', this.emails ) }, - removeLastEmail(event) { + removeLastEmail( event ) { // If is input empty and presse backspace remove last email from array - if (event.code === 'Backspace' && this.email === '') + if ( event.code === 'Backspace' && this.email === '' ) this.emails.pop() }, handleEmail() { - if (this.email.length > 0) { + if ( this.email.length > 0 ) { // Get index of @ and last dot - let lastDot = this.email.lastIndexOf('.') - let at = this.email.indexOf('@') + let lastDot = this.email.lastIndexOf( '.' ) + let at = this.email.indexOf( '@' ) // Check if is after @ some dot, if email have @ anf if dont have more like one - if (lastDot < at || at === -1 || this.email.match(/@/g).length > 1) return + if ( lastDot < at || at === -1 || this.email.match(/@/g).length > 1 ) return + + // First email dont need to be separated by comma or space to be sended + if( this.emails.length === 0 ) + events.$emit('emailsInputValues', [this.email]) + // After come or backspace push the single email to array or emails - if (this.email.includes(',') || this.email.includes(' ')) { + if ( this.email.includes(',') || this.email.includes(' ') ) { - let email = this.email.replace(/[","," "]/, '') + let email = this.email.replace( /[","," "]/, '' ) this.email = '' // Push single email to aray of emails - this.emails.push(email) + this.emails.push( email ) - events.$emit('emailsInputValues', this.emails) + events.$emit( 'emailsInputValues', this.emails ) } } } diff --git a/resources/js/components/Others/RenameItem.vue b/resources/js/components/Others/RenameItem.vue index ab4c0493..6694f212 100644 --- a/resources/js/components/Others/RenameItem.vue +++ b/resources/js/components/Others/RenameItem.vue @@ -26,7 +26,7 @@ - {{ moreOptionsTitle }} +