( meta: R3DirectiveMetadata, constantPool: ConstantPool, bindingParser: BindingParser, )
| 37 | const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`; |
| 38 | |
| 39 | function baseDirectiveFields( |
| 40 | meta: R3DirectiveMetadata, |
| 41 | constantPool: ConstantPool, |
| 42 | bindingParser: BindingParser, |
| 43 | ): DefinitionMap { |
| 44 | const definitionMap = new DefinitionMap(); |
| 45 | const selectors = core.parseSelectorToR3Selector(meta.selector); |
| 46 | |
| 47 | // e.g. `type: MyDirective` |
| 48 | definitionMap.set('type', meta.type.value); |
| 49 | |
| 50 | // e.g. `selectors: [['', 'someDir', '']]` |
| 51 | if (selectors.length > 0) { |
| 52 | definitionMap.set('selectors', asLiteral(selectors)); |
| 53 | } |
| 54 | |
| 55 | if (meta.queries.length > 0) { |
| 56 | // e.g. `contentQueries: (rf, ctx, dirIndex) => { ... } |
| 57 | definitionMap.set( |
| 58 | 'contentQueries', |
| 59 | createContentQueriesFunction(meta.queries, constantPool, meta.name), |
| 60 | ); |
| 61 | } |
| 62 | |
| 63 | if (meta.viewQueries.length) { |
| 64 | definitionMap.set( |
| 65 | 'viewQuery', |
| 66 | createViewQueriesFunction(meta.viewQueries, constantPool, meta.name), |
| 67 | ); |
| 68 | } |
| 69 | |
| 70 | // e.g. `hostBindings: (rf, ctx) => { ... } |
| 71 | definitionMap.set( |
| 72 | 'hostBindings', |
| 73 | createHostBindingsFunction( |
| 74 | meta.host, |
| 75 | meta.typeSourceSpan, |
| 76 | bindingParser, |
| 77 | constantPool, |
| 78 | meta.selector || '', |
| 79 | meta.name, |
| 80 | definitionMap, |
| 81 | meta.legacyOptionalChaining, |
| 82 | ), |
| 83 | ); |
| 84 | |
| 85 | // e.g 'inputs: {a: 'a'}` |
| 86 | definitionMap.set('inputs', conditionallyCreateDirectiveBindingLiteral(meta.inputs, true)); |
| 87 | |
| 88 | // e.g 'outputs: {a: 'a'}` |
| 89 | definitionMap.set('outputs', conditionallyCreateDirectiveBindingLiteral(meta.outputs)); |
| 90 | |
| 91 | if (meta.exportAs !== null) { |
| 92 | definitionMap.set('exportAs', o.literalArr(meta.exportAs.map((e) => o.literal(e)))); |
| 93 | } |
| 94 | |
| 95 | if (meta.isStandalone === false) { |
| 96 | definitionMap.set('standalone', o.literal(false)); |
no test coverage detected