build: enable bundle_dts for forms package (#28854)

This PR also changes the name of NgNoValidate` to `ɵNgNoValidate`. This is because `ngcc` requires the node to retain the original name while dts bundler will rename the node is it's only exported using the aliases.

Example typings files:
```ts
declare class NgNoValidate{
}
export {NgNoValidateas ɵNgNoValidate}
```

will be emitted as
```ts
export declare class ɵNgNoValidate {
}
```

PR Close #28854
This commit is contained in:
Alan 2019-02-20 08:10:25 +01:00 committed by Andrew Kushnir
parent 4486dabf01
commit e8bb8f4912
5 changed files with 16 additions and 9 deletions

View File

@ -10,6 +10,7 @@ ng_module(
"src/**/*.ts", "src/**/*.ts",
], ],
), ),
bundle_dts = True,
deps = [ deps = [
"//packages/core", "//packages/core",
"//packages/platform-browser", "//packages/platform-browser",

View File

@ -80,5 +80,7 @@ export const REACTIVE_DRIVEN_DIRECTIVES: Type<any>[] =
declarations: SHARED_FORM_DIRECTIVES, declarations: SHARED_FORM_DIRECTIVES,
exports: SHARED_FORM_DIRECTIVES, exports: SHARED_FORM_DIRECTIVES,
}) })
export class InternalFormsSharedModule { export class ɵInternalFormsSharedModule {
} }
export {ɵInternalFormsSharedModule as InternalFormsSharedModule};

View File

@ -29,5 +29,7 @@ import {Directive} from '@angular/core';
selector: 'form:not([ngNoForm]):not([ngNativeValidate])', selector: 'form:not([ngNoForm]):not([ngNativeValidate])',
host: {'novalidate': ''}, host: {'novalidate': ''},
}) })
export class NgNoValidate { export class ɵNgNoValidate {
} }
export {ɵNgNoValidate as NgNoValidate};

View File

@ -89,7 +89,7 @@ export class SelectMultipleControlValueAccessor implements ControlValueAccessor
value: any; value: any;
/** @internal */ /** @internal */
_optionMap: Map<string, NgSelectMultipleOption> = new Map<string, NgSelectMultipleOption>(); _optionMap: Map<string, ɵNgSelectMultipleOption> = new Map<string, ɵNgSelectMultipleOption>();
/** @internal */ /** @internal */
_idCounter: number = 0; _idCounter: number = 0;
@ -131,7 +131,7 @@ export class SelectMultipleControlValueAccessor implements ControlValueAccessor
*/ */
writeValue(value: any): void { writeValue(value: any): void {
this.value = value; this.value = value;
let optionSelectedStateSetter: (opt: NgSelectMultipleOption, o: any) => void; let optionSelectedStateSetter: (opt: ɵNgSelectMultipleOption, o: any) => void;
if (Array.isArray(value)) { if (Array.isArray(value)) {
// convert values to ids // convert values to ids
const ids = value.map((v) => this._getOptionId(v)); const ids = value.map((v) => this._getOptionId(v));
@ -194,7 +194,7 @@ export class SelectMultipleControlValueAccessor implements ControlValueAccessor
} }
/** @internal */ /** @internal */
_registerOption(value: NgSelectMultipleOption): string { _registerOption(value: ɵNgSelectMultipleOption): string {
const id: string = (this._idCounter++).toString(); const id: string = (this._idCounter++).toString();
this._optionMap.set(id, value); this._optionMap.set(id, value);
return id; return id;
@ -226,7 +226,7 @@ export class SelectMultipleControlValueAccessor implements ControlValueAccessor
* @publicApi * @publicApi
*/ */
@Directive({selector: 'option'}) @Directive({selector: 'option'})
export class NgSelectMultipleOption implements OnDestroy { export class ɵNgSelectMultipleOption implements OnDestroy {
// TODO(issue/24571): remove '!'. // TODO(issue/24571): remove '!'.
id !: string; id !: string;
/** @internal */ /** @internal */
@ -290,3 +290,5 @@ export class NgSelectMultipleOption implements OnDestroy {
} }
} }
} }
export {ɵNgSelectMultipleOption as NgSelectMultipleOption};

View File

@ -18,7 +18,7 @@
*/ */
export {InternalFormsSharedModule as ɵInternalFormsSharedModule} from './directives'; export {ɵInternalFormsSharedModule} from './directives';
export {AbstractControlDirective} from './directives/abstract_control_directive'; export {AbstractControlDirective} from './directives/abstract_control_directive';
export {AbstractFormGroupDirective} from './directives/abstract_form_group_directive'; export {AbstractFormGroupDirective} from './directives/abstract_form_group_directive';
export {CheckboxControlValueAccessor} from './directives/checkbox_value_accessor'; export {CheckboxControlValueAccessor} from './directives/checkbox_value_accessor';
@ -32,7 +32,7 @@ export {NgForm} from './directives/ng_form';
export {NgFormSelectorWarning} from './directives/ng_form_selector_warning'; export {NgFormSelectorWarning} from './directives/ng_form_selector_warning';
export {NgModel} from './directives/ng_model'; export {NgModel} from './directives/ng_model';
export {NgModelGroup} from './directives/ng_model_group'; export {NgModelGroup} from './directives/ng_model_group';
export {NgNoValidate as ɵNgNoValidate} from './directives/ng_no_validate_directive'; export {ɵNgNoValidate} from './directives/ng_no_validate_directive';
export {NumberValueAccessor} from './directives/number_value_accessor'; export {NumberValueAccessor} from './directives/number_value_accessor';
export {RadioControlValueAccessor} from './directives/radio_control_value_accessor'; export {RadioControlValueAccessor} from './directives/radio_control_value_accessor';
export {RangeValueAccessor} from './directives/range_value_accessor'; export {RangeValueAccessor} from './directives/range_value_accessor';
@ -43,7 +43,7 @@ export {FormArrayName} from './directives/reactive_directives/form_group_name';
export {FormGroupName} from './directives/reactive_directives/form_group_name'; export {FormGroupName} from './directives/reactive_directives/form_group_name';
export {NgSelectOption, SelectControlValueAccessor} from './directives/select_control_value_accessor'; export {NgSelectOption, SelectControlValueAccessor} from './directives/select_control_value_accessor';
export {SelectMultipleControlValueAccessor} from './directives/select_multiple_control_value_accessor'; export {SelectMultipleControlValueAccessor} from './directives/select_multiple_control_value_accessor';
export {NgSelectMultipleOption as ɵNgSelectMultipleOption} from './directives/select_multiple_control_value_accessor'; export {ɵNgSelectMultipleOption} from './directives/select_multiple_control_value_accessor';
export {AsyncValidator, AsyncValidatorFn, CheckboxRequiredValidator, EmailValidator, MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator, ValidationErrors, Validator, ValidatorFn} from './directives/validators'; export {AsyncValidator, AsyncValidatorFn, CheckboxRequiredValidator, EmailValidator, MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator, ValidationErrors, Validator, ValidatorFn} from './directives/validators';
export {FormBuilder} from './form_builder'; export {FormBuilder} from './form_builder';
export {AbstractControl, AbstractControlOptions, FormArray, FormControl, FormGroup} from './model'; export {AbstractControl, AbstractControlOptions, FormArray, FormControl, FormGroup} from './model';