Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type Props = {|
objectType: string,
objectBehaviorsTypes: Array<string>,
isChildObject: boolean,
shouldCheckCapabilityBehaviors: boolean,
behaviorShortHeader: BehaviorShortHeader,
matches: ?Array<SearchMatch>,
onChoose: () => void,
Expand All @@ -48,6 +49,7 @@ export const BehaviorListItem = ({
objectType,
objectBehaviorsTypes,
isChildObject,
shouldCheckCapabilityBehaviors,
behaviorShortHeader,
matches,
onChoose,
Expand Down Expand Up @@ -75,7 +77,11 @@ export const BehaviorListItem = ({
);
return (
(!isChildObject || behaviorMetadata.isRelevantForChildObjects()) &&
(!behaviorMetadata.isHidden() ||
// Behavior parameters and properties don't need to declare all
// capabilities, they will be required by transitivity when attaching
// the behavior to the object.
(!shouldCheckCapabilityBehaviors ||
!behaviorMetadata.isHidden() ||
objectBehaviorsTypes.includes(requiredBehaviorType))
);
});
Expand Down
9 changes: 7 additions & 2 deletions newIDE/app/src/AssetStore/BehaviorStore/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type Props = {|
deprecatedBehaviorMetadataList: Array<BehaviorShortHeader>,
onInstall: (behaviorShortHeader: BehaviorShortHeader) => Promise<boolean>,
onChoose: (behaviorType: string) => void,
shouldCheckCapabilityBehaviors: boolean,
|};

const getBehaviorType = (behaviorShortHeader: BehaviorShortHeader) =>
Expand All @@ -86,6 +87,7 @@ export const BehaviorStore = ({
deprecatedBehaviorMetadataList,
onInstall,
onChoose,
shouldCheckCapabilityBehaviors,
}: Props): React.Node => {
const preferences = React.useContext(PreferencesContext);
const [
Expand Down Expand Up @@ -305,8 +307,10 @@ export const BehaviorStore = ({
filteredSearchResults.map(({ item }) => item)
}
getSearchItemUniqueId={getBehaviorType}
// $FlowFixMe[missing-local-annot]
renderSearchItem={(behaviorShortHeader, onHeightComputed) => (
renderSearchItem={(
behaviorShortHeader: BehaviorShortHeader,
onHeightComputed
): React.Node => (
<BehaviorListItem
id={
'behavior-item-' + behaviorShortHeader.type.replace(/:/g, '-')
Expand All @@ -315,6 +319,7 @@ export const BehaviorStore = ({
objectType={objectType}
objectBehaviorsTypes={objectBehaviorsTypes}
isChildObject={isChildObject}
shouldCheckCapabilityBehaviors={shouldCheckCapabilityBehaviors}
onHeightComputed={onHeightComputed}
behaviorShortHeader={behaviorShortHeader}
matches={getExtensionsMatches(behaviorShortHeader)}
Expand Down
1 change: 1 addition & 0 deletions newIDE/app/src/BehaviorsEditor/NewBehaviorDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ export default function NewBehaviorDialog({
onChoose={behaviorType => chooseBehavior(i18n, behaviorType)}
installedBehaviorMetadataList={installedBehaviorMetadataList}
deprecatedBehaviorMetadataList={deprecatedBehaviorMetadataList}
shouldCheckCapabilityBehaviors={!shouldShowCapabilityBehaviors}
/>
</Dialog>
)}
Expand Down
Loading