@@ -40,6 +40,7 @@ export default {
4040 hasInput : false ,
4141 hasInlineLabel : false ,
4242 hasInputInfo : false ,
43+ hasInputErrorMessage : false ,
4344 } ;
4445 } ,
4546 render ( ) {
@@ -77,6 +78,7 @@ export default {
7778 let hasInput = itemInput || self . state . hasInput ;
7879 let hasInlineLabel = inlineLabel || self . state . hasInlineLabel ;
7980 let hasInputInfo = itemInputWithInfo || self . state . hasInputInfo ;
81+ let hasInputErrorMessage = self . state . hasInputErrorMessage ;
8082
8183 const slotsContentStart = [ ] ;
8284 const slotsContent = [ ] ;
@@ -125,6 +127,7 @@ export default {
125127 if ( tag === 'F7Input' ) {
126128 hasInput = true ;
127129 if ( child . props && child . props . info ) hasInputInfo = true ;
130+ if ( child . props && child . props . errorMessage && child . props . errorMessageForce ) hasInputErrorMessage = true ;
128131 }
129132 if ( tag === 'F7Label' ) {
130133 if ( child . props && child . props . inline ) hasInlineLabel = true ;
@@ -135,6 +138,7 @@ export default {
135138 if ( tag && tag . indexOf ( 'f7-input' ) >= 0 ) {
136139 hasInput = true ;
137140 if ( child . data && child . data . info ) hasInputInfo = true ;
141+ if ( child . data && child . data . errorMessage && child . data . errorMessageForce ) hasInputErrorMessage = true ;
138142 }
139143 if ( tag && tag . indexOf ( 'f7-label' ) >= 0 ) {
140144 if ( child . data && child . data . inline ) hasInlineLabel = true ;
@@ -175,6 +179,12 @@ export default {
175179 } else if ( ! hasInputInfo ) {
176180 self . hasInputInfoSet = false ;
177181 }
182+ if ( hasInputErrorMessage && ! self . state . hasInputErrorMessage ) {
183+ self . hasInputErrorMessageSet = true ;
184+ self . setState ( { hasInputErrorMessage } ) ;
185+ } else if ( ! hasInputInfo ) {
186+ self . hasInputErrorMessageSet = false ;
187+ }
178188 if ( hasInlineLabel && ! self . state . hasInlineLabel ) {
179189 self . hasInlineLabelSet = true ;
180190 self . setState ( { hasInlineLabel } ) ;
@@ -336,6 +346,8 @@ export default {
336346 'item-input' : hasInput ,
337347 'inline-label' : hasInlineLabel ,
338348 'item-input-with-info' : hasInputInfo ,
349+ 'item-input-with-error-message' : hasInputErrorMessage ,
350+ 'item-input-invalid' : hasInputErrorMessage ,
339351 } ,
340352 Mixins . colorClasses ( props ) ,
341353 ) ;
@@ -367,6 +379,7 @@ export default {
367379 const hasInlineLabel = $labelEl . hasClass ( 'item-label-inline' ) ;
368380 const hasInput = $inputEl . length > 0 ;
369381 const hasInputInfo = $inputEl . children ( '.item-input-info' ) . length > 0 ;
382+ const hasInputErrorMessage = $inputEl . children ( '.item-input-error-message' ) . length > 0 ;
370383 if ( ! self . hasInlineLabelSet && hasInlineLabel !== self . state . hasInlineLabel ) {
371384 self . setState ( { hasInlineLabel } ) ;
372385 }
@@ -376,6 +389,9 @@ export default {
376389 if ( ! self . hasInputInfoSet && hasInputInfo !== self . state . hasInputInfo ) {
377390 self . setState ( { hasInputInfo } ) ;
378391 }
392+ if ( ! self . hasInputErrorMessageSet && hasInputErrorMessage !== self . state . hasInputErrorMessage ) {
393+ self . setState ( { hasInputErrorMessage } ) ;
394+ }
379395 } ,
380396 componentDidUpdate ( ) {
381397 const self = this ;
@@ -387,6 +403,7 @@ export default {
387403 const hasInlineLabel = $labelEl . hasClass ( 'item-label-inline' ) ;
388404 const hasInput = $inputEl . length > 0 ;
389405 const hasInputInfo = $inputEl . children ( '.item-input-info' ) . length > 0 ;
406+ const hasInputErrorMessage = $inputEl . children ( '.item-input-error-message' ) . length > 0 ;
390407 if ( hasInlineLabel !== self . state . hasInlineLabel ) {
391408 self . setState ( { hasInlineLabel } ) ;
392409 }
@@ -396,6 +413,9 @@ export default {
396413 if ( hasInputInfo !== self . state . hasInputInfo ) {
397414 self . setState ( { hasInputInfo } ) ;
398415 }
416+ if ( ! self . hasInputErrorMessageSet && hasInputErrorMessage !== self . state . hasInputErrorMessage ) {
417+ self . setState ( { hasInputErrorMessage } ) ;
418+ }
399419 } ,
400420 methods : {
401421 onClick ( event ) {
0 commit comments