@ni/nimble-angular 12.1.1 → 12.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/ni-nimble-angular.umd.js +423 -36
- package/bundles/ni-nimble-angular.umd.js.map +1 -1
- package/directives/radio/nimble-radio-control-value-accessor.directive.d.ts +2 -2
- package/directives/radio/nimble-radio.module.d.ts +2 -1
- package/esm2015/directives/radio/nimble-radio-control-value-accessor.directive.js +7 -7
- package/esm2015/directives/radio/nimble-radio.module.js +5 -4
- package/esm2015/thirdparty/directives/control_value_accessor.js +215 -0
- package/esm2015/thirdparty/directives/radio_control_value_accessor.js +197 -0
- package/fesm2015/ni-nimble-angular.js +400 -10
- package/fesm2015/ni-nimble-angular.js.map +1 -1
- package/package.json +1 -1
- package/thirdparty/directives/control_value_accessor.d.ts +87 -0
- package/thirdparty/directives/radio_control_value_accessor.d.ts +134 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Directive, Input, NgModule, forwardRef, HostListener, Inject, Optional, Host, EventEmitter, Output } from '@angular/core';
|
|
2
|
+
import { Directive, Input, NgModule, forwardRef, HostListener, Inject, Optional, Host, EventEmitter, Output, Injectable } from '@angular/core';
|
|
3
3
|
export { BreadcrumbAppearance } from '@ni/nimble-components/dist/esm/breadcrumb/types';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import '@ni/nimble-components/dist/esm/breadcrumb';
|
|
@@ -8,8 +8,7 @@ import '@ni/nimble-components/dist/esm/breadcrumb-item';
|
|
|
8
8
|
export { ButtonAppearanceVariant } from '@ni/nimble-components/dist/esm/button/types';
|
|
9
9
|
import '@ni/nimble-components/dist/esm/button';
|
|
10
10
|
import '@ni/nimble-components/dist/esm/card-button';
|
|
11
|
-
import
|
|
12
|
-
import { CheckboxControlValueAccessor, NG_VALUE_ACCESSOR, SelectControlValueAccessor, NgSelectOption, NumberValueAccessor, RadioControlValueAccessor, DefaultValueAccessor } from '@angular/forms';
|
|
11
|
+
import { CheckboxControlValueAccessor, NG_VALUE_ACCESSOR, SelectControlValueAccessor, NgSelectOption, NumberValueAccessor, NgControl, DefaultValueAccessor } from '@angular/forms';
|
|
13
12
|
import '@ni/nimble-components/dist/esm/checkbox';
|
|
14
13
|
export { ComboboxAutocomplete } from '@ni/nimble-components/dist/esm/combobox/types';
|
|
15
14
|
import '@ni/nimble-components/dist/esm/combobox';
|
|
@@ -5860,12 +5859,402 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImpor
|
|
|
5860
5859
|
}]
|
|
5861
5860
|
}] });
|
|
5862
5861
|
|
|
5862
|
+
/**
|
|
5863
|
+
* [Nimble]
|
|
5864
|
+
* Copied from https://github.com/angular/angular/blob/14.2.6/packages/forms/src/directives/control_value_accessor.ts
|
|
5865
|
+
* with the following modifications:
|
|
5866
|
+
* - Commented out ControlValueAccessor which is exported from @angular/forms
|
|
5867
|
+
* - Commented out NG_VALUE_ACCESSOR which is exported from @angular/forms
|
|
5868
|
+
*/
|
|
5869
|
+
/**
|
|
5870
|
+
* @description
|
|
5871
|
+
* Defines an interface that acts as a bridge between the Angular forms API and a
|
|
5872
|
+
* native element in the DOM.
|
|
5873
|
+
*
|
|
5874
|
+
* Implement this interface to create a custom form control directive
|
|
5875
|
+
* that integrates with Angular forms.
|
|
5876
|
+
*
|
|
5877
|
+
* @see DefaultValueAccessor
|
|
5878
|
+
*
|
|
5879
|
+
* @publicApi
|
|
5880
|
+
*/
|
|
5881
|
+
/* [Nimble] Commenting out public interface
|
|
5882
|
+
export interface ControlValueAccessor {
|
|
5883
|
+
/**
|
|
5884
|
+
* @description
|
|
5885
|
+
* Writes a new value to the element.
|
|
5886
|
+
*
|
|
5887
|
+
* This method is called by the forms API to write to the view when programmatic
|
|
5888
|
+
* changes from model to view are requested.
|
|
5889
|
+
*
|
|
5890
|
+
* @usageNotes
|
|
5891
|
+
* ### Write a value to the element
|
|
5892
|
+
*
|
|
5893
|
+
* The following example writes a value to the native DOM element.
|
|
5894
|
+
*
|
|
5895
|
+
* ```ts
|
|
5896
|
+
* writeValue(value: any): void {
|
|
5897
|
+
* this._renderer.setProperty(this._elementRef.nativeElement, 'value', value);
|
|
5898
|
+
* }
|
|
5899
|
+
* ```
|
|
5900
|
+
*
|
|
5901
|
+
* @param obj The new value for the element
|
|
5902
|
+
*
|
|
5903
|
+
writeValue(obj: any): void;
|
|
5904
|
+
|
|
5905
|
+
/**
|
|
5906
|
+
* @description
|
|
5907
|
+
* Registers a callback function that is called when the control's value
|
|
5908
|
+
* changes in the UI.
|
|
5909
|
+
*
|
|
5910
|
+
* This method is called by the forms API on initialization to update the form
|
|
5911
|
+
* model when values propagate from the view to the model.
|
|
5912
|
+
*
|
|
5913
|
+
* When implementing the `registerOnChange` method in your own value accessor,
|
|
5914
|
+
* save the given function so your class calls it at the appropriate time.
|
|
5915
|
+
*
|
|
5916
|
+
* @usageNotes
|
|
5917
|
+
* ### Store the change function
|
|
5918
|
+
*
|
|
5919
|
+
* The following example stores the provided function as an internal method.
|
|
5920
|
+
*
|
|
5921
|
+
* ```ts
|
|
5922
|
+
* registerOnChange(fn: (_: any) => void): void {
|
|
5923
|
+
* this._onChange = fn;
|
|
5924
|
+
* }
|
|
5925
|
+
* ```
|
|
5926
|
+
*
|
|
5927
|
+
* When the value changes in the UI, call the registered
|
|
5928
|
+
* function to allow the forms API to update itself:
|
|
5929
|
+
*
|
|
5930
|
+
* ```ts
|
|
5931
|
+
* host: {
|
|
5932
|
+
* '(change)': '_onChange($event.target.value)'
|
|
5933
|
+
* }
|
|
5934
|
+
* ```
|
|
5935
|
+
*
|
|
5936
|
+
* @param fn The callback function to register
|
|
5937
|
+
*
|
|
5938
|
+
registerOnChange(fn: any): void;
|
|
5939
|
+
|
|
5940
|
+
/**
|
|
5941
|
+
* @description
|
|
5942
|
+
* Registers a callback function that is called by the forms API on initialization
|
|
5943
|
+
* to update the form model on blur.
|
|
5944
|
+
*
|
|
5945
|
+
* When implementing `registerOnTouched` in your own value accessor, save the given
|
|
5946
|
+
* function so your class calls it when the control should be considered
|
|
5947
|
+
* blurred or "touched".
|
|
5948
|
+
*
|
|
5949
|
+
* @usageNotes
|
|
5950
|
+
* ### Store the callback function
|
|
5951
|
+
*
|
|
5952
|
+
* The following example stores the provided function as an internal method.
|
|
5953
|
+
*
|
|
5954
|
+
* ```ts
|
|
5955
|
+
* registerOnTouched(fn: any): void {
|
|
5956
|
+
* this._onTouched = fn;
|
|
5957
|
+
* }
|
|
5958
|
+
* ```
|
|
5959
|
+
*
|
|
5960
|
+
* On blur (or equivalent), your class should call the registered function to allow
|
|
5961
|
+
* the forms API to update itself:
|
|
5962
|
+
*
|
|
5963
|
+
* ```ts
|
|
5964
|
+
* host: {
|
|
5965
|
+
* '(blur)': '_onTouched()'
|
|
5966
|
+
* }
|
|
5967
|
+
* ```
|
|
5968
|
+
*
|
|
5969
|
+
* @param fn The callback function to register
|
|
5970
|
+
*
|
|
5971
|
+
registerOnTouched(fn: any): void;
|
|
5972
|
+
|
|
5973
|
+
/**
|
|
5974
|
+
* @description
|
|
5975
|
+
* Function that is called by the forms API when the control status changes to
|
|
5976
|
+
* or from 'DISABLED'. Depending on the status, it enables or disables the
|
|
5977
|
+
* appropriate DOM element.
|
|
5978
|
+
*
|
|
5979
|
+
* @usageNotes
|
|
5980
|
+
* The following is an example of writing the disabled property to a native DOM element:
|
|
5981
|
+
*
|
|
5982
|
+
* ```ts
|
|
5983
|
+
* setDisabledState(isDisabled: boolean): void {
|
|
5984
|
+
* this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
|
|
5985
|
+
* }
|
|
5986
|
+
* ```
|
|
5987
|
+
*
|
|
5988
|
+
* @param isDisabled The disabled status to set on the element
|
|
5989
|
+
*
|
|
5990
|
+
setDisabledState?(isDisabled: boolean): void;
|
|
5991
|
+
}
|
|
5992
|
+
*/
|
|
5993
|
+
/**
|
|
5994
|
+
* Base class for all ControlValueAccessor classes defined in Forms package.
|
|
5995
|
+
* Contains common logic and utility functions.
|
|
5996
|
+
*
|
|
5997
|
+
* Note: this is an *internal-only* class and should not be extended or used directly in
|
|
5998
|
+
* applications code.
|
|
5999
|
+
*/
|
|
6000
|
+
class BaseControlValueAccessor {
|
|
6001
|
+
constructor(_renderer, _elementRef) {
|
|
6002
|
+
this._renderer = _renderer;
|
|
6003
|
+
this._elementRef = _elementRef;
|
|
6004
|
+
/**
|
|
6005
|
+
* The registered callback function called when a change or input event occurs on the input
|
|
6006
|
+
* element.
|
|
6007
|
+
* @nodoc
|
|
6008
|
+
*/
|
|
6009
|
+
this.onChange = (_) => { };
|
|
6010
|
+
/**
|
|
6011
|
+
* The registered callback function called when a blur event occurs on the input element.
|
|
6012
|
+
* @nodoc
|
|
6013
|
+
*/
|
|
6014
|
+
this.onTouched = () => { };
|
|
6015
|
+
}
|
|
6016
|
+
/**
|
|
6017
|
+
* Helper method that sets a property on a target element using the current Renderer
|
|
6018
|
+
* implementation.
|
|
6019
|
+
* @nodoc
|
|
6020
|
+
*/
|
|
6021
|
+
setProperty(key, value) {
|
|
6022
|
+
this._renderer.setProperty(this._elementRef.nativeElement, key, value);
|
|
6023
|
+
}
|
|
6024
|
+
/**
|
|
6025
|
+
* Registers a function called when the control is touched.
|
|
6026
|
+
* @nodoc
|
|
6027
|
+
*/
|
|
6028
|
+
registerOnTouched(fn) {
|
|
6029
|
+
this.onTouched = fn;
|
|
6030
|
+
}
|
|
6031
|
+
/**
|
|
6032
|
+
* Registers a function called when the control value changes.
|
|
6033
|
+
* @nodoc
|
|
6034
|
+
*/
|
|
6035
|
+
registerOnChange(fn) {
|
|
6036
|
+
this.onChange = fn;
|
|
6037
|
+
}
|
|
6038
|
+
/**
|
|
6039
|
+
* Sets the "disabled" property on the range input element.
|
|
6040
|
+
* @nodoc
|
|
6041
|
+
*/
|
|
6042
|
+
setDisabledState(isDisabled) {
|
|
6043
|
+
this.setProperty('disabled', isDisabled);
|
|
6044
|
+
}
|
|
6045
|
+
}
|
|
6046
|
+
BaseControlValueAccessor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: BaseControlValueAccessor, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
6047
|
+
BaseControlValueAccessor.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.5", type: BaseControlValueAccessor, ngImport: i0 });
|
|
6048
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: BaseControlValueAccessor, decorators: [{
|
|
6049
|
+
type: Directive
|
|
6050
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }]; } });
|
|
6051
|
+
/**
|
|
6052
|
+
* Base class for all built-in ControlValueAccessor classes (except DefaultValueAccessor, which is
|
|
6053
|
+
* used in case no other CVAs can be found). We use this class to distinguish between default CVA,
|
|
6054
|
+
* built-in CVAs and custom CVAs, so that Forms logic can recognize built-in CVAs and treat custom
|
|
6055
|
+
* ones with higher priority (when both built-in and custom CVAs are present).
|
|
6056
|
+
*
|
|
6057
|
+
* Note: this is an *internal-only* class and should not be extended or used directly in
|
|
6058
|
+
* applications code.
|
|
6059
|
+
*/
|
|
6060
|
+
class BuiltInControlValueAccessor extends BaseControlValueAccessor {
|
|
6061
|
+
}
|
|
6062
|
+
BuiltInControlValueAccessor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: BuiltInControlValueAccessor, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
6063
|
+
BuiltInControlValueAccessor.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.5", type: BuiltInControlValueAccessor, usesInheritance: true, ngImport: i0 });
|
|
6064
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: BuiltInControlValueAccessor, decorators: [{
|
|
6065
|
+
type: Directive
|
|
6066
|
+
}] });
|
|
6067
|
+
|
|
6068
|
+
/**
|
|
6069
|
+
* [Nimble]
|
|
6070
|
+
* Copied from https://github.com/angular/angular/blob/14.2.6/packages/forms/src/directives/radio_control_value_accessor.ts
|
|
6071
|
+
* with the following modifications:
|
|
6072
|
+
* - Changed throwNameError() to throw Error instead of RuntimeError. This makes the file compile with Angular version 12.
|
|
6073
|
+
* - Removed now-unused import for RuntimeErrorCode and RuntimeError
|
|
6074
|
+
* - Updated import of ControlValueAccessor, NgControl, and NG_VALUE_ACCESSOR to pull from package export
|
|
6075
|
+
*/
|
|
6076
|
+
const RADIO_VALUE_ACCESSOR = {
|
|
6077
|
+
provide: NG_VALUE_ACCESSOR,
|
|
6078
|
+
useExisting: forwardRef(() => RadioControlValueAccessor),
|
|
6079
|
+
multi: true
|
|
6080
|
+
};
|
|
6081
|
+
function throwNameError() {
|
|
6082
|
+
/* [Nimble] RuntimeErrorCode is not exported from @angular/forms in version 12; falling back to version 12 behavior
|
|
6083
|
+
throw new RuntimeError(RuntimeErrorCode.NAME_AND_FORM_CONTROL_NAME_MUST_MATCH, `
|
|
6084
|
+
*/
|
|
6085
|
+
throw new Error(`
|
|
6086
|
+
If you define both a name and a formControlName attribute on your radio button, their values
|
|
6087
|
+
must match. Ex: <input type="radio" formControlName="food" name="food">
|
|
6088
|
+
`);
|
|
6089
|
+
}
|
|
6090
|
+
/**
|
|
6091
|
+
* Internal-only NgModule that works as a host for the `RadioControlRegistry` tree-shakable
|
|
6092
|
+
* provider. Note: the `InternalFormsSharedModule` can not be used here directly, since it's
|
|
6093
|
+
* declared *after* the `RadioControlRegistry` class and the `providedIn` doesn't support
|
|
6094
|
+
* `forwardRef` logic.
|
|
6095
|
+
*/
|
|
6096
|
+
class RadioControlRegistryModule {
|
|
6097
|
+
}
|
|
6098
|
+
RadioControlRegistryModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: RadioControlRegistryModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
6099
|
+
RadioControlRegistryModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: RadioControlRegistryModule });
|
|
6100
|
+
RadioControlRegistryModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: RadioControlRegistryModule });
|
|
6101
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: RadioControlRegistryModule, decorators: [{
|
|
6102
|
+
type: NgModule
|
|
6103
|
+
}] });
|
|
6104
|
+
/**
|
|
6105
|
+
* @description
|
|
6106
|
+
* Class used by Angular to track radio buttons. For internal use only.
|
|
6107
|
+
*/
|
|
6108
|
+
class RadioControlRegistry {
|
|
6109
|
+
constructor() {
|
|
6110
|
+
this._accessors = [];
|
|
6111
|
+
}
|
|
6112
|
+
/**
|
|
6113
|
+
* @description
|
|
6114
|
+
* Adds a control to the internal registry. For internal use only.
|
|
6115
|
+
*/
|
|
6116
|
+
add(control, accessor) {
|
|
6117
|
+
this._accessors.push([control, accessor]);
|
|
6118
|
+
}
|
|
6119
|
+
/**
|
|
6120
|
+
* @description
|
|
6121
|
+
* Removes a control from the internal registry. For internal use only.
|
|
6122
|
+
*/
|
|
6123
|
+
remove(accessor) {
|
|
6124
|
+
for (let i = this._accessors.length - 1; i >= 0; --i) {
|
|
6125
|
+
if (this._accessors[i][1] === accessor) {
|
|
6126
|
+
this._accessors.splice(i, 1);
|
|
6127
|
+
return;
|
|
6128
|
+
}
|
|
6129
|
+
}
|
|
6130
|
+
}
|
|
6131
|
+
/**
|
|
6132
|
+
* @description
|
|
6133
|
+
* Selects a radio button. For internal use only.
|
|
6134
|
+
*/
|
|
6135
|
+
select(accessor) {
|
|
6136
|
+
this._accessors.forEach((c) => {
|
|
6137
|
+
if (this._isSameGroup(c, accessor) && c[1] !== accessor) {
|
|
6138
|
+
c[1].fireUncheck(accessor.value);
|
|
6139
|
+
}
|
|
6140
|
+
});
|
|
6141
|
+
}
|
|
6142
|
+
_isSameGroup(controlPair, accessor) {
|
|
6143
|
+
if (!controlPair[0].control)
|
|
6144
|
+
return false;
|
|
6145
|
+
// @ts-expect-error: [Nimble] Use of internal NgControl member _parent
|
|
6146
|
+
return controlPair[0]._parent === accessor._control._parent &&
|
|
6147
|
+
controlPair[1].name === accessor.name;
|
|
6148
|
+
}
|
|
6149
|
+
}
|
|
6150
|
+
RadioControlRegistry.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: RadioControlRegistry, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6151
|
+
RadioControlRegistry.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: RadioControlRegistry, providedIn: RadioControlRegistryModule });
|
|
6152
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: RadioControlRegistry, decorators: [{
|
|
6153
|
+
type: Injectable,
|
|
6154
|
+
args: [{ providedIn: RadioControlRegistryModule }]
|
|
6155
|
+
}] });
|
|
6156
|
+
/**
|
|
6157
|
+
* @description
|
|
6158
|
+
* The `ControlValueAccessor` for writing radio control values and listening to radio control
|
|
6159
|
+
* changes. The value accessor is used by the `FormControlDirective`, `FormControlName`, and
|
|
6160
|
+
* `NgModel` directives.
|
|
6161
|
+
*
|
|
6162
|
+
* @usageNotes
|
|
6163
|
+
*
|
|
6164
|
+
* ### Using radio buttons with reactive form directives
|
|
6165
|
+
*
|
|
6166
|
+
* The follow example shows how to use radio buttons in a reactive form. When using radio buttons in
|
|
6167
|
+
* a reactive form, radio buttons in the same group should have the same `formControlName`.
|
|
6168
|
+
* Providing a `name` attribute is optional.
|
|
6169
|
+
*
|
|
6170
|
+
* {@example forms/ts/reactiveRadioButtons/reactive_radio_button_example.ts region='Reactive'}
|
|
6171
|
+
*
|
|
6172
|
+
* @ngModule ReactiveFormsModule
|
|
6173
|
+
* @ngModule FormsModule
|
|
6174
|
+
* @publicApi
|
|
6175
|
+
*/
|
|
6176
|
+
class RadioControlValueAccessor extends BuiltInControlValueAccessor {
|
|
6177
|
+
constructor(renderer, elementRef, _registry, _injector) {
|
|
6178
|
+
super(renderer, elementRef);
|
|
6179
|
+
this._registry = _registry;
|
|
6180
|
+
this._injector = _injector;
|
|
6181
|
+
/**
|
|
6182
|
+
* The registered callback function called when a change event occurs on the input element.
|
|
6183
|
+
* Note: we declare `onChange` here (also used as host listener) as a function with no arguments
|
|
6184
|
+
* to override the `onChange` function (which expects 1 argument) in the parent
|
|
6185
|
+
* `BaseControlValueAccessor` class.
|
|
6186
|
+
* @nodoc
|
|
6187
|
+
*/
|
|
6188
|
+
this.onChange = () => { };
|
|
6189
|
+
}
|
|
6190
|
+
/** @nodoc */
|
|
6191
|
+
ngOnInit() {
|
|
6192
|
+
this._control = this._injector.get(NgControl);
|
|
6193
|
+
this._checkName();
|
|
6194
|
+
this._registry.add(this._control, this);
|
|
6195
|
+
}
|
|
6196
|
+
/** @nodoc */
|
|
6197
|
+
ngOnDestroy() {
|
|
6198
|
+
this._registry.remove(this);
|
|
6199
|
+
}
|
|
6200
|
+
/**
|
|
6201
|
+
* Sets the "checked" property value on the radio input element.
|
|
6202
|
+
* @nodoc
|
|
6203
|
+
*/
|
|
6204
|
+
writeValue(value) {
|
|
6205
|
+
this._state = value === this.value;
|
|
6206
|
+
this.setProperty('checked', this._state);
|
|
6207
|
+
}
|
|
6208
|
+
/**
|
|
6209
|
+
* Registers a function called when the control value changes.
|
|
6210
|
+
* @nodoc
|
|
6211
|
+
*/
|
|
6212
|
+
registerOnChange(fn) {
|
|
6213
|
+
this._fn = fn;
|
|
6214
|
+
this.onChange = () => {
|
|
6215
|
+
fn(this.value);
|
|
6216
|
+
this._registry.select(this);
|
|
6217
|
+
};
|
|
6218
|
+
}
|
|
6219
|
+
/**
|
|
6220
|
+
* Sets the "value" on the radio input element and unchecks it.
|
|
6221
|
+
*
|
|
6222
|
+
* @param value
|
|
6223
|
+
*/
|
|
6224
|
+
fireUncheck(value) {
|
|
6225
|
+
this.writeValue(value);
|
|
6226
|
+
}
|
|
6227
|
+
_checkName() {
|
|
6228
|
+
if (this.name && this.formControlName && this.name !== this.formControlName &&
|
|
6229
|
+
// @ts-expect-error: [Nimble] ngDevMode is not defined
|
|
6230
|
+
(typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
6231
|
+
throwNameError();
|
|
6232
|
+
}
|
|
6233
|
+
if (!this.name && this.formControlName)
|
|
6234
|
+
this.name = this.formControlName;
|
|
6235
|
+
}
|
|
6236
|
+
}
|
|
6237
|
+
RadioControlValueAccessor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: RadioControlValueAccessor, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: RadioControlRegistry }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Directive });
|
|
6238
|
+
RadioControlValueAccessor.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.5", type: RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: { name: "name", formControlName: "formControlName", value: "value" }, host: { listeners: { "change": "onChange()", "blur": "onTouched()" } }, providers: [RADIO_VALUE_ACCESSOR], usesInheritance: true, ngImport: i0 });
|
|
6239
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: RadioControlValueAccessor, decorators: [{
|
|
6240
|
+
type: Directive,
|
|
6241
|
+
args: [{
|
|
6242
|
+
selector: 'input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]',
|
|
6243
|
+
host: { '(change)': 'onChange()', '(blur)': 'onTouched()' },
|
|
6244
|
+
providers: [RADIO_VALUE_ACCESSOR]
|
|
6245
|
+
}]
|
|
6246
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: RadioControlRegistry }, { type: i0.Injector }]; }, propDecorators: { name: [{
|
|
6247
|
+
type: Input
|
|
6248
|
+
}], formControlName: [{
|
|
6249
|
+
type: Input
|
|
6250
|
+
}], value: [{
|
|
6251
|
+
type: Input
|
|
6252
|
+
}] } });
|
|
6253
|
+
|
|
5863
6254
|
/**
|
|
5864
6255
|
* Control Value Accessor implementation for the radio group.
|
|
5865
6256
|
*/
|
|
5866
6257
|
class NimbleRadioControlValueAccessorDirective extends RadioControlValueAccessor {
|
|
5867
|
-
// Type ɵangular_packages_forms_forms_r from base class isn't in camelcase
|
|
5868
|
-
// eslint-disable-next-line camelcase
|
|
5869
6258
|
constructor(renderer, elementRef, _registry, _injector) {
|
|
5870
6259
|
super(renderer, elementRef, _registry, _injector);
|
|
5871
6260
|
this.elementRef = elementRef;
|
|
@@ -5876,6 +6265,7 @@ class NimbleRadioControlValueAccessorDirective extends RadioControlValueAccessor
|
|
|
5876
6265
|
return id;
|
|
5877
6266
|
}
|
|
5878
6267
|
ngOnInit() {
|
|
6268
|
+
super.ngOnInit();
|
|
5879
6269
|
// We need each button element to have a unique string value, because the FAST radio group looks at
|
|
5880
6270
|
// these values when trying to manage the checked state.
|
|
5881
6271
|
this.elementRef.nativeElement.value = NimbleRadioControlValueAccessorDirective.allocateId();
|
|
@@ -5919,7 +6309,7 @@ class NimbleRadioControlValueAccessorDirective extends RadioControlValueAccessor
|
|
|
5919
6309
|
}
|
|
5920
6310
|
}
|
|
5921
6311
|
NimbleRadioControlValueAccessorDirective._nextOpenId = 0;
|
|
5922
|
-
NimbleRadioControlValueAccessorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: NimbleRadioControlValueAccessorDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token:
|
|
6312
|
+
NimbleRadioControlValueAccessorDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: NimbleRadioControlValueAccessorDirective, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: RadioControlRegistry }, { token: i0.Injector }], target: i0.ɵɵFactoryTarget.Directive });
|
|
5923
6313
|
NimbleRadioControlValueAccessorDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.5", type: NimbleRadioControlValueAccessorDirective, selector: "nimble-radio[formControlName],nimble-radio[formControl],nimble-radio[ngModel]", host: { listeners: { "change": "nimbleOnChange($event.target.checked)", "blur": "onTouched()" } }, providers: [{
|
|
5924
6314
|
provide: NG_VALUE_ACCESSOR,
|
|
5925
6315
|
useExisting: forwardRef(() => NimbleRadioControlValueAccessorDirective),
|
|
@@ -5938,7 +6328,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImpor
|
|
|
5938
6328
|
multi: true
|
|
5939
6329
|
}]
|
|
5940
6330
|
}]
|
|
5941
|
-
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type:
|
|
6331
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: RadioControlRegistry }, { type: i0.Injector }]; } });
|
|
5942
6332
|
|
|
5943
6333
|
/**
|
|
5944
6334
|
* Directive to provide Angular integration for the radio button.
|
|
@@ -5969,13 +6359,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImpor
|
|
|
5969
6359
|
class NimbleRadioModule {
|
|
5970
6360
|
}
|
|
5971
6361
|
NimbleRadioModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: NimbleRadioModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
5972
|
-
NimbleRadioModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: NimbleRadioModule, declarations: [NimbleRadioControlValueAccessorDirective, NimbleRadioDirective], imports: [CommonModule], exports: [NimbleRadioControlValueAccessorDirective, NimbleRadioDirective] });
|
|
5973
|
-
NimbleRadioModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: NimbleRadioModule, imports: [[CommonModule]] });
|
|
6362
|
+
NimbleRadioModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: NimbleRadioModule, declarations: [NimbleRadioControlValueAccessorDirective, NimbleRadioDirective], imports: [CommonModule, RadioControlRegistryModule], exports: [NimbleRadioControlValueAccessorDirective, NimbleRadioDirective] });
|
|
6363
|
+
NimbleRadioModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: NimbleRadioModule, imports: [[CommonModule, RadioControlRegistryModule]] });
|
|
5974
6364
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.5", ngImport: i0, type: NimbleRadioModule, decorators: [{
|
|
5975
6365
|
type: NgModule,
|
|
5976
6366
|
args: [{
|
|
5977
6367
|
declarations: [NimbleRadioControlValueAccessorDirective, NimbleRadioDirective],
|
|
5978
|
-
imports: [CommonModule],
|
|
6368
|
+
imports: [CommonModule, RadioControlRegistryModule],
|
|
5979
6369
|
exports: [NimbleRadioControlValueAccessorDirective, NimbleRadioDirective]
|
|
5980
6370
|
}]
|
|
5981
6371
|
}] });
|