From 4b168ecfcebd3a68551de587d78e315f7268fcef Mon Sep 17 00:00:00 2001 From: Miguel Andrade Date: Mon, 6 Mar 2017 19:04:41 +0000 Subject: [PATCH] yield isTouched and isInvalidAndTouched --- addon/components/paper-form.js | 4 +++- addon/templates/components/paper-form.hbs | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/addon/components/paper-form.js b/addon/components/paper-form.js index 33257dcb9..8a4deeb7c 100644 --- a/addon/components/paper-form.js +++ b/addon/components/paper-form.js @@ -30,6 +30,8 @@ export default Component.extend(ParentMixin, { return this.get('childComponents').isAny('isTouched'); }), + isInvalidAndTouched: computed.and('isInvalid', 'isTouched'), + submit() { this.send('onSubmit'); return false; @@ -38,7 +40,7 @@ export default Component.extend(ParentMixin, { actions: { onValidityChange() { if (this.get('lastIsValid') !== this.get('isValid')) { - this.sendAction('onValidityChange', this.get('isValid'), this.get('isTouched'), this.get('isInvalid') && this.get('isTouched')); + this.sendAction('onValidityChange', this.get('isValid'), this.get('isTouched'), this.get('isInvalidAndTouched')); this.set('lastIsValid', this.get('isValid')); } }, diff --git a/addon/templates/components/paper-form.hbs b/addon/templates/components/paper-form.hbs index 5633ee31e..726b0c954 100644 --- a/addon/templates/components/paper-form.hbs +++ b/addon/templates/components/paper-form.hbs @@ -1,6 +1,8 @@ {{yield (hash isValid=isValid isInvalid=isInvalid + isTouched=isTouched + isInvalidAndTouched=isInvalidAndTouched input=(component inputComponent parentComponent=this onValidityChange=(action "onValidityChange")