-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2467 from storybooks/angular-versions-support
Angular versions support
- Loading branch information
Showing
12 changed files
with
133 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* eslint-disable no-param-reassign */ | ||
/* globals window */ | ||
|
||
function getMeta(component, [name1, name2], defaultValue) { | ||
if (!name2) { | ||
name2 = name1; | ||
name1 = `__${name1}__`; | ||
} | ||
|
||
if (component[name1]) { | ||
return component[name1]; | ||
} | ||
|
||
if (component[name2]) { | ||
return component[name2]; | ||
} | ||
|
||
return window.Reflect.getMetadata(name2, component) || defaultValue; | ||
} | ||
|
||
export function getAnnotations(component) { | ||
return getMeta(component, ['annotations'], []); | ||
} | ||
|
||
export function getPropMetadata(component) { | ||
return getMeta(component, ['__prop__metadata__', 'propMetadata'], {}); | ||
} | ||
|
||
export function getParameters(component) { | ||
return getMeta(component, ['parameters'], []); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
function getMeta(component, [name1, name2]: any, defaultValue) { | ||
if (!name2) { | ||
name2 = name1; | ||
name1 = `__${name1}__`; | ||
} | ||
|
||
if (component[name1]) { | ||
return component[name1]; | ||
} | ||
|
||
if (component[name2]) { | ||
return component[name2]; | ||
} | ||
|
||
return window['Reflect'].getMetadata(name2, component) || defaultValue; | ||
} | ||
|
||
export function getAnnotations(component) { | ||
return getMeta(component, ['annotations'], []); | ||
} | ||
|
||
export function getPropMetadata(component) { | ||
return getMeta(component, ['__prop__metadata__', 'propMetadata'], {}); | ||
} | ||
|
||
export function getParameters(component) { | ||
return getMeta(component, ['parameters'], []); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.