fix(core): make subclass inherit developer-defined data (#35105)
PR Close #35105
This commit is contained in:

committed by
Alex Rickabaugh

parent
8e12707f88
commit
a756161dc2
@ -7,11 +7,10 @@
|
||||
*/
|
||||
|
||||
import {Type, Writable} from '../../interface/type';
|
||||
import {assertEqual} from '../../util/assert';
|
||||
import {fillProperties} from '../../util/property';
|
||||
import {EMPTY_ARRAY, EMPTY_OBJ} from '../empty';
|
||||
import {ComponentDef, ContentQueriesFunction, DirectiveDef, DirectiveDefFeature, HostBindingsFunction, RenderFlags, ViewQueriesFunction} from '../interfaces/definition';
|
||||
import {AttributeMarker, TAttributes} from '../interfaces/node';
|
||||
import {TAttributes} from '../interfaces/node';
|
||||
import {isComponentDef} from '../interfaces/type_checks';
|
||||
import {mergeHostAttrs} from '../util/attrs_utils';
|
||||
|
||||
@ -71,6 +70,15 @@ export function ɵɵInheritDefinitionFeature(definition: DirectiveDef<any>| Comp
|
||||
fillProperties(definition.declaredInputs, superDef.declaredInputs);
|
||||
fillProperties(definition.outputs, superDef.outputs);
|
||||
|
||||
// Merge animations metadata.
|
||||
// If `superDef` is a Component, the `data` field is present (defaults to an empty object).
|
||||
if (isComponentDef(superDef) && superDef.data.animation) {
|
||||
// If super def is a Component, the `definition` is also a Component, since Directives can
|
||||
// not inherit Components (we throw an error above and cannot reach this code).
|
||||
const defData = (definition as ComponentDef<any>).data;
|
||||
defData.animation = (defData.animation || []).concat(superDef.data.animation);
|
||||
}
|
||||
|
||||
// Inherit hooks
|
||||
// Assume super class inheritance feature has already run.
|
||||
writeableDef.afterContentChecked =
|
||||
@ -179,4 +187,4 @@ function inheritHostBindings(
|
||||
} else {
|
||||
definition.hostBindings = superHostBindings;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user