@@ -6,6 +6,7 @@ import PropertyRow from './PropertyRow';
66import Collapsible from '../Collapsible' ;
77import copy from 'clipboard-copy' ;
88import { getComponentClipboardRepresentation } from '../../lib/entity' ;
9+ import { shouldShowProperty } from '../../lib/utils' ;
910import Events from '../../lib/Events' ;
1011
1112const isSingleProperty = AFRAME . schema . isSingleProperty ;
@@ -93,30 +94,7 @@ export default class Component extends React.Component {
9394
9495 return Object . keys ( componentData . schema )
9596 . sort ( )
96- . filter ( ( propertyName ) => {
97- if ( ! componentData . schema [ propertyName ] . if ) {
98- return true ;
99- }
100- let showProperty = true ;
101- for ( const [ conditionKey , conditionValue ] of Object . entries (
102- componentData . schema [ propertyName ] . if
103- ) ) {
104- if ( Array . isArray ( conditionValue ) ) {
105- if (
106- conditionValue . indexOf ( componentData . data [ conditionKey ] ) === - 1
107- ) {
108- showProperty = false ;
109- break ;
110- }
111- } else {
112- if ( conditionValue !== componentData . data [ conditionKey ] ) {
113- showProperty = false ;
114- break ;
115- }
116- }
117- }
118- return showProperty ;
119- } )
97+ . filter ( ( propertyName ) => shouldShowProperty ( propertyName , componentData ) )
12098 . map ( ( propertyName ) => (
12199 < PropertyRow
122100 key = { propertyName }
@@ -131,21 +109,13 @@ export default class Component extends React.Component {
131109 } ;
132110
133111 render ( ) {
134- let componentName = this . props . name ;
135- let subComponentName = '' ;
136- if ( componentName . indexOf ( '__' ) !== - 1 ) {
137- subComponentName = componentName ;
138- componentName = componentName . substr ( 0 , componentName . indexOf ( '__' ) ) ;
139- }
112+ const componentName = this . props . name ;
140113
141114 return (
142115 < Collapsible collapsed = { this . props . isCollapsed } >
143116 < div className = "componentHeader collapsible-header" >
144- < span
145- className = "componentTitle"
146- title = { subComponentName || componentName }
147- >
148- < span > { subComponentName || componentName } </ span >
117+ < span className = "componentTitle" title = { componentName } >
118+ < span > { componentName } </ span >
149119 </ span >
150120 < div className = "componentHeaderActions" >
151121 < a
@@ -157,7 +127,7 @@ export default class Component extends React.Component {
157127 copy (
158128 getComponentClipboardRepresentation (
159129 this . state . entity ,
160- ( subComponentName || componentName ) . toLowerCase ( )
130+ componentName . toLowerCase ( )
161131 )
162132 ) ;
163133 } }
0 commit comments