@@ -74,9 +74,9 @@ export default {
7474 itemInputWithInfo,
7575 } = props ;
7676
77- const hasInput = itemInput || self . state . hasInput ;
78- const hasInlineLabel = inlineLabel || self . state . hasInlineLabel ;
79- const hasInputInfo = itemInputWithInfo || self . state . hasInputInfo ;
77+ let hasInput = itemInput || self . state . hasInput ;
78+ let hasInlineLabel = inlineLabel || self . state . hasInlineLabel ;
79+ let hasInputInfo = itemInputWithInfo || self . state . hasInputInfo ;
8080
8181 const slotsContentStart = [ ] ;
8282 const slotsContent = [ ] ;
@@ -118,33 +118,68 @@ export default {
118118 else flattenSlots . push ( slot ) ;
119119 } ) ;
120120 }
121-
122- if ( flattenSlots . length ) {
123- for ( let i = 0 ; i < flattenSlots . length ; i += 1 ) {
124- const slotEl = flattenSlots [ i ] ;
125- let slotName ;
126- // phenome-vue-next-line
127- slotName = slotEl . data ? slotEl . data . slot : undefined ;
128- // phenome-react-next-line
129- slotName = slotEl . props ? slotEl . props . slot : undefined ;
130- if ( ! slotName || ( slotName === 'inner' ) ) slotsInner . push ( slotEl ) ;
131- if ( slotName === 'content-start' ) slotsContentStart . push ( slotEl ) ;
132- if ( slotName === 'content' ) slotsContent . push ( slotEl ) ;
133- if ( slotName === 'content-end' ) slotsContentEnd . push ( slotEl ) ;
134- if ( slotName === 'after-start' ) slotsAfterStart . push ( slotEl ) ;
135- if ( slotName === 'after' ) slotsAfter . push ( slotEl ) ;
136- if ( slotName === 'after-end' ) slotsAfterEnd . push ( slotEl ) ;
137- if ( slotName === 'media' ) slotsMedia . push ( slotEl ) ;
138- if ( slotName === 'inner-start' ) slotsInnerStart . push ( slotEl ) ;
139- if ( slotName === 'inner-end' ) slotsInnerEnd . push ( slotEl ) ;
140- if ( slotName === 'before-title' ) slotsBeforeTitle . push ( slotEl ) ;
141- if ( slotName === 'title' ) slotsTitle . push ( slotEl ) ;
142- if ( slotName === 'after-title' ) slotsAfterTitle . push ( slotEl ) ;
143- if ( slotName === 'subtitle' ) slotsSubtitle . push ( slotEl ) ;
144- if ( slotName === 'text' ) slotsText . push ( slotEl ) ;
145- if ( slotName === 'header' ) slotsHeader . push ( slotEl ) ;
146- if ( slotName === 'footer' ) slotsFooter . push ( slotEl ) ;
121+ flattenSlots . forEach ( ( child ) => {
122+ if ( typeof child === 'undefined' ) return ;
123+ if ( process . env . COMPILER === 'react' ) {
124+ const tag = child . type && child . type . name ;
125+ if ( tag === 'F7Input' ) {
126+ hasInput = true ;
127+ if ( child . props && child . props . info ) hasInputInfo = true ;
128+ }
129+ if ( tag === 'F7Label' ) {
130+ if ( child . props && child . props . inline ) hasInlineLabel = true ;
131+ }
132+ }
133+ if ( process . env . COMPILER === 'vue' ) {
134+ const tag = child . tag ;
135+ if ( tag && tag . indexOf ( 'f7-input' ) >= 0 ) {
136+ hasInput = true ;
137+ if ( child . data && child . data . info ) hasInputInfo = true ;
138+ }
139+ if ( tag && tag . indexOf ( 'f7-label' ) >= 0 ) {
140+ if ( child . data && child . data . inline ) hasInlineLabel = true ;
141+ }
147142 }
143+ let slotName ;
144+ // phenome-vue-next-line
145+ slotName = child . data ? child . data . slot : undefined ;
146+ // phenome-react-next-line
147+ slotName = child . props ? child . props . slot : undefined ;
148+ if ( ! slotName || ( slotName === 'inner' ) ) slotsInner . push ( child ) ;
149+ if ( slotName === 'content-start' ) slotsContentStart . push ( child ) ;
150+ if ( slotName === 'content' ) slotsContent . push ( child ) ;
151+ if ( slotName === 'content-end' ) slotsContentEnd . push ( child ) ;
152+ if ( slotName === 'after-start' ) slotsAfterStart . push ( child ) ;
153+ if ( slotName === 'after' ) slotsAfter . push ( child ) ;
154+ if ( slotName === 'after-end' ) slotsAfterEnd . push ( child ) ;
155+ if ( slotName === 'media' ) slotsMedia . push ( child ) ;
156+ if ( slotName === 'inner-start' ) slotsInnerStart . push ( child ) ;
157+ if ( slotName === 'inner-end' ) slotsInnerEnd . push ( child ) ;
158+ if ( slotName === 'before-title' ) slotsBeforeTitle . push ( child ) ;
159+ if ( slotName === 'title' ) slotsTitle . push ( child ) ;
160+ if ( slotName === 'after-title' ) slotsAfterTitle . push ( child ) ;
161+ if ( slotName === 'subtitle' ) slotsSubtitle . push ( child ) ;
162+ if ( slotName === 'text' ) slotsText . push ( child ) ;
163+ if ( slotName === 'header' ) slotsHeader . push ( child ) ;
164+ if ( slotName === 'footer' ) slotsFooter . push ( child ) ;
165+ } ) ;
166+ if ( hasInput && ! self . state . hasInput ) {
167+ self . hasInputSet = true ;
168+ self . setState ( { hasInput } ) ;
169+ } else if ( ! hasInput ) {
170+ self . hasInputSet = false ;
171+ }
172+ if ( hasInputInfo && ! self . state . hasInputInfo ) {
173+ self . hasInputInfoSet = true ;
174+ self . setState ( { hasInputInfo } ) ;
175+ } else if ( ! hasInputInfo ) {
176+ self . hasInputInfoSet = false ;
177+ }
178+ if ( hasInlineLabel && ! self . state . hasInlineLabel ) {
179+ self . hasInlineLabelSet = true ;
180+ self . setState ( { hasInlineLabel } ) ;
181+ } else if ( ! hasInlineLabel ) {
182+ self . hasInlineLabelSet = false ;
148183 }
149184
150185 // Input
@@ -332,13 +367,13 @@ export default {
332367 const hasInlineLabel = $labelEl . hasClass ( 'item-label-inline' ) ;
333368 const hasInput = $inputEl . length > 0 ;
334369 const hasInputInfo = $inputEl . children ( '.item-input-info' ) . length > 0 ;
335- if ( hasInlineLabel !== self . state . hasInlineLabel ) {
370+ if ( ! self . hasInlineLabelSet && hasInlineLabel !== self . state . hasInlineLabel ) {
336371 self . setState ( { hasInlineLabel } ) ;
337372 }
338- if ( hasInput !== self . state . hasInput ) {
373+ if ( ! self . hasInputSet && hasInput !== self . state . hasInput ) {
339374 self . setState ( { hasInput } ) ;
340375 }
341- if ( hasInputInfo !== self . state . hasInputInfo ) {
376+ if ( ! self . hasInputInfoSet && hasInputInfo !== self . state . hasInputInfo ) {
342377 self . setState ( { hasInputInfo } ) ;
343378 }
344379 } ,
0 commit comments