├── ANGULAR_PACKAGE ├── BUILD_INFO ├── LICENSE ├── README.md ├── fesm2022 ├── forms.mjs └── forms.mjs.map ├── index.d.ts └── package.json /ANGULAR_PACKAGE: -------------------------------------------------------------------------------- 1 | This file is used by the npm/yarn_install rule to detect APF. See https://github.com/bazelbuild/rules_nodejs/issues/927 2 | -------------------------------------------------------------------------------- /BUILD_INFO: -------------------------------------------------------------------------------- 1 | Fri Jun 6 22:27:02 UTC 2025 2 | 21fc93bf4b2183114d7703dbea4e57c30b54c66e 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2010-2025 Google LLC. https://angular.dev/license 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Angular 2 | ======= 3 | 4 | The sources for this package are in the main [Angular](https://github.com/angular/angular) repo. Please file issues and pull requests against that repo. 5 | 6 | Usage information and reference details can be found in [Angular documentation](https://angular.dev/overview). 7 | 8 | License: MIT 9 | -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @license Angular v20.1.0-next.0+sha-21fc93b 3 | * (c) 2010-2025 Google LLC. https://angular.io/ 4 | * License: MIT 5 | */ 6 | 7 | import * as i0 from '@angular/core'; 8 | import { InjectionToken, Renderer2, ElementRef, OnDestroy, OnChanges, SimpleChanges, OnInit, Injector, EventEmitter, ChangeDetectorRef, AfterViewInit, Version, ModuleWithProviders } from '@angular/core'; 9 | import { Observable } from 'rxjs'; 10 | 11 | /** 12 | * @description 13 | * 14 | * Adds `novalidate` attribute to all forms by default. 15 | * 16 | * `novalidate` is used to disable browser's native form validation. 17 | * 18 | * If you want to use native validation with Angular forms, just add `ngNativeValidate` attribute: 19 | * 20 | * ```html 21 | *
22 | * ``` 23 | * 24 | * @publicApi 25 | * @ngModule ReactiveFormsModule 26 | * @ngModule FormsModule 27 | */ 28 | declare class ɵNgNoValidate { 29 | static ɵfac: i0.ɵɵFactoryDeclaration<ɵNgNoValidate, never>; 30 | static ɵdir: i0.ɵɵDirectiveDeclaration<ɵNgNoValidate, "form:not([ngNoForm]):not([ngNativeValidate])", never, {}, {}, never, never, false, never>; 31 | } 32 | 33 | /** 34 | * @description 35 | * Defines an interface that acts as a bridge between the Angular forms API and a 36 | * native element in the DOM. 37 | * 38 | * Implement this interface to create a custom form control directive 39 | * that integrates with Angular forms. 40 | * 41 | * @see {@link DefaultValueAccessor} 42 | * 43 | * @publicApi 44 | */ 45 | interface ControlValueAccessor { 46 | /** 47 | * @description 48 | * Writes a new value to the element. 49 | * 50 | * This method is called by the forms API to write to the view when programmatic 51 | * changes from model to view are requested. 52 | * 53 | * @usageNotes 54 | * ### Write a value to the element 55 | * 56 | * The following example writes a value to the native DOM element. 57 | * 58 | * ```ts 59 | * writeValue(value: any): void { 60 | * this._renderer.setProperty(this._elementRef.nativeElement, 'value', value); 61 | * } 62 | * ``` 63 | * 64 | * @param obj The new value for the element 65 | */ 66 | writeValue(obj: any): void; 67 | /** 68 | * @description 69 | * Registers a callback function that is called when the control's value 70 | * changes in the UI. 71 | * 72 | * This method is called by the forms API on initialization to update the form 73 | * model when values propagate from the view to the model. 74 | * 75 | * When implementing the `registerOnChange` method in your own value accessor, 76 | * save the given function so your class calls it at the appropriate time. 77 | * 78 | * @usageNotes 79 | * ### Store the change function 80 | * 81 | * The following example stores the provided function as an internal method. 82 | * 83 | * ```ts 84 | * registerOnChange(fn: (_: any) => void): void { 85 | * this._onChange = fn; 86 | * } 87 | * ``` 88 | * 89 | * When the value changes in the UI, call the registered 90 | * function to allow the forms API to update itself: 91 | * 92 | * ```ts 93 | * host: { 94 | * '(change)': '_onChange($event.target.value)' 95 | * } 96 | * ``` 97 | * 98 | * @param fn The callback function to register 99 | */ 100 | registerOnChange(fn: any): void; 101 | /** 102 | * @description 103 | * Registers a callback function that is called by the forms API on initialization 104 | * to update the form model on blur. 105 | * 106 | * When implementing `registerOnTouched` in your own value accessor, save the given 107 | * function so your class calls it when the control should be considered 108 | * blurred or "touched". 109 | * 110 | * @usageNotes 111 | * ### Store the callback function 112 | * 113 | * The following example stores the provided function as an internal method. 114 | * 115 | * ```ts 116 | * registerOnTouched(fn: any): void { 117 | * this._onTouched = fn; 118 | * } 119 | * ``` 120 | * 121 | * On blur (or equivalent), your class should call the registered function to allow 122 | * the forms API to update itself: 123 | * 124 | * ```ts 125 | * host: { 126 | * '(blur)': '_onTouched()' 127 | * } 128 | * ``` 129 | * 130 | * @param fn The callback function to register 131 | */ 132 | registerOnTouched(fn: any): void; 133 | /** 134 | * @description 135 | * Function that is called by the forms API when the control status changes to 136 | * or from 'DISABLED'. Depending on the status, it enables or disables the 137 | * appropriate DOM element. 138 | * 139 | * @usageNotes 140 | * The following is an example of writing the disabled property to a native DOM element: 141 | * 142 | * ```ts 143 | * setDisabledState(isDisabled: boolean): void { 144 | * this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled); 145 | * } 146 | * ``` 147 | * 148 | * @param isDisabled The disabled status to set on the element 149 | */ 150 | setDisabledState?(isDisabled: boolean): void; 151 | } 152 | /** 153 | * Base class for all ControlValueAccessor classes defined in Forms package. 154 | * Contains common logic and utility functions. 155 | * 156 | * Note: this is an *internal-only* class and should not be extended or used directly in 157 | * applications code. 158 | */ 159 | declare class BaseControlValueAccessor { 160 | private _renderer; 161 | private _elementRef; 162 | /** 163 | * The registered callback function called when a change or input event occurs on the input 164 | * element. 165 | * @docs-private 166 | */ 167 | onChange: (_: any) => void; 168 | /** 169 | * The registered callback function called when a blur event occurs on the input element. 170 | * @docs-private 171 | */ 172 | onTouched: () => void; 173 | constructor(_renderer: Renderer2, _elementRef: ElementRef); 174 | /** 175 | * Helper method that sets a property on a target element using the current Renderer 176 | * implementation. 177 | * @docs-private 178 | */ 179 | protected setProperty(key: string, value: any): void; 180 | /** 181 | * Registers a function called when the control is touched. 182 | * @docs-private 183 | */ 184 | registerOnTouched(fn: () => void): void; 185 | /** 186 | * Registers a function called when the control value changes. 187 | * @docs-private 188 | */ 189 | registerOnChange(fn: (_: any) => {}): void; 190 | /** 191 | * Sets the "disabled" property on the range input element. 192 | * @docs-private 193 | */ 194 | setDisabledState(isDisabled: boolean): void; 195 | static ɵfac: i0.ɵɵFactoryDeclaration; 196 | static ɵdir: i0.ɵɵDirectiveDeclaration; 197 | } 198 | /** 199 | * Base class for all built-in ControlValueAccessor classes (except DefaultValueAccessor, which is 200 | * used in case no other CVAs can be found). We use this class to distinguish between default CVA, 201 | * built-in CVAs and custom CVAs, so that Forms logic can recognize built-in CVAs and treat custom 202 | * ones with higher priority (when both built-in and custom CVAs are present). 203 | * 204 | * Note: this is an *internal-only* class and should not be extended or used directly in 205 | * applications code. 206 | */ 207 | declare class BuiltInControlValueAccessor extends BaseControlValueAccessor { 208 | static ɵfac: i0.ɵɵFactoryDeclaration; 209 | static ɵdir: i0.ɵɵDirectiveDeclaration; 210 | } 211 | /** 212 | * Used to provide a `ControlValueAccessor` for form controls. 213 | * 214 | * See `DefaultValueAccessor` for how to implement one. 215 | * 216 | * @publicApi 217 | */ 218 | declare const NG_VALUE_ACCESSOR: InjectionToken; 219 | 220 | /** 221 | * @description 222 | * The `ControlValueAccessor` for writing select control values and listening to select control 223 | * changes. The value accessor is used by the `FormControlDirective`, `FormControlName`, and 224 | * `NgModel` directives. 225 | * 226 | * @usageNotes 227 | * 228 | * ### Using select controls in a reactive form 229 | * 230 | * The following examples show how to use a select control in a reactive form. 231 | * 232 | * {@example forms/ts/reactiveSelectControl/reactive_select_control_example.ts region='Component'} 233 | * 234 | * ### Using select controls in a template-driven form 235 | * 236 | * To use a select in a template-driven form, simply add an `ngModel` and a `name` 237 | * attribute to the main `` supports `compareWith` input. 249 | * `compareWith` takes a **function** which has two arguments: `option1` and `option2`. 250 | * If `compareWith` is given, Angular selects option by the return value of the function. 251 | * 252 | * ```ts 253 | * const selectedCountriesControl = new FormControl(); 254 | * ``` 255 | * 256 | * ```html 257 | * 262 | * 263 | * compareFn(c1: Country, c2: Country): boolean { 264 | * return c1 && c2 ? c1.id === c2.id : c1 === c2; 265 | * } 266 | * ``` 267 | * 268 | * **Note:** We listen to the 'change' event because 'input' events aren't fired 269 | * for selects in IE, see: 270 | * https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event#browser_compatibility 271 | * 272 | * @ngModule ReactiveFormsModule 273 | * @ngModule FormsModule 274 | * @publicApi 275 | */ 276 | declare class SelectControlValueAccessor extends BuiltInControlValueAccessor implements ControlValueAccessor { 277 | /** @docs-private */ 278 | value: any; 279 | /** 280 | * @description 281 | * Tracks the option comparison algorithm for tracking identities when 282 | * checking for changes. 283 | */ 284 | set compareWith(fn: (o1: any, o2: any) => boolean); 285 | private _compareWith; 286 | /** 287 | * Sets the "value" property on the select element. 288 | * @docs-private 289 | */ 290 | writeValue(value: any): void; 291 | /** 292 | * Registers a function called when the control value changes. 293 | * @docs-private 294 | */ 295 | registerOnChange(fn: (value: any) => any): void; 296 | static ɵfac: i0.ɵɵFactoryDeclaration; 297 | static ɵdir: i0.ɵɵDirectiveDeclaration; 298 | } 299 | /** 300 | * @description 301 | * Marks `