-
-
Notifications
You must be signed in to change notification settings - Fork 141
Expand file tree
/
Copy pathcomponent.js
More file actions
93 lines (72 loc) · 2.12 KB
/
component.js
File metadata and controls
93 lines (72 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import { attr } from '@ember-data/model';
import { filterBy, or } from '@ember/object/computed';
import { dasherize } from '../utils/string';
import Class from './class';
import { memberUnion, hasMemberType } from '../utils/computed';
export default class Component extends Class {
isComponent = true;
@attr
yields;
@attr
arguments;
@or('yields', 'inheritedYields')
overloadedYields;
@filterBy('arguments', 'access', 'public')
publicArguments;
@filterBy('arguments', 'access', 'private')
privateArguments;
@filterBy('arguments', 'access', 'protected')
protectedArguments;
@memberUnion('parentClass.allPublicArguments', 'publicArguments')
allPublicArguments;
@memberUnion('parentClass.allPrivateArguments', 'privateArguments')
allPrivateArguments;
@memberUnion('parentClass.allProtectedArguments', 'protectedArguments')
allProtectedArguments;
@memberUnion('parentClass.allArguments', 'arguments')
allArguments;
@or(
'parentClass.overloadedYields.length',
'parentClass.allArguments.length',
'parentClass.allAccessors.length',
'parentClass.allMethods.length',
'parentClass.allFields.length',
)
hasInherited;
@or('allAccessors.length', 'allMethods.length', 'allFields.length')
hasInternal;
@or(
'allPrivateAccessors.length',
'allPrivateArguments.length',
'allPrivateMethods.length',
'allPrivateFields.length',
)
hasPrivate;
@or(
'allProtectedAccessors.length',
'allProtectedArguments.length',
'allProtectedMethods.length',
'allProtectedFields.length',
)
hasProtected;
@hasMemberType(
'allAccessors',
'allArguments',
'allMethods',
'allFields',
function (member) {
return member.tags && member.tags.find((t) => t.name === 'deprecated');
},
)
hasDeprecated;
/*
This gives us a way to link to a model, since we don't always link by the actual ID:
<LinkTo @route="item" @model={{model.routingId}}>
Go to item
</LinkTo>
Possible refactoring is to always link by actual ID, and implement redirects.
*/
get routingId() {
return `components/${dasherize(this.name)}`;
}
}