@covalent/core 10.2.1 → 10.3.1
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/common/directives/web-components/form-control.directive.d.ts +7 -3
- package/fesm2022/covalent-core-common.mjs +34 -4
- package/fesm2022/covalent-core-common.mjs.map +1 -1
- package/package.json +2 -2
- package/theming/_teradata-theme.scss +56 -56
- package/theming/prebuilt/all-theme-dark.css +1 -1
- package/theming/prebuilt/all-theme-dark.css.map +1 -1
- package/theming/prebuilt/all-theme-light.css +1 -1
- package/theming/prebuilt/all-theme-light.css.map +1 -1
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
import { ElementRef } from '@angular/core';
|
|
1
|
+
import { DestroyRef, ElementRef, OnInit } from '@angular/core';
|
|
2
2
|
import { ControlValueAccessor, NgControl } from '@angular/forms';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class CovalentTextfieldValueAccessorDirective implements ControlValueAccessor {
|
|
4
|
+
export declare class CovalentTextfieldValueAccessorDirective implements ControlValueAccessor, OnInit {
|
|
5
5
|
private _elementRef;
|
|
6
6
|
_ngControl: NgControl;
|
|
7
|
+
private _destroyRef;
|
|
7
8
|
private _onChange;
|
|
8
9
|
private _onTouched;
|
|
9
|
-
constructor(_elementRef: ElementRef<any>, _ngControl: NgControl);
|
|
10
|
+
constructor(_elementRef: ElementRef<any>, _ngControl: NgControl, _destroyRef: DestroyRef);
|
|
11
|
+
ngOnInit(): void;
|
|
10
12
|
writeValue(value: string): void;
|
|
11
13
|
registerOnChange(fn: any): void;
|
|
12
14
|
registerOnTouched(fn: any): void;
|
|
15
|
+
handleInput(): void;
|
|
13
16
|
handleChange(event: Event): void;
|
|
14
17
|
handleBlur(): void;
|
|
15
18
|
setDisabledState(isDisabled: boolean): void;
|
|
16
19
|
private _isCheckBox;
|
|
17
20
|
private _isRadio;
|
|
21
|
+
private _isTextAreaOrField;
|
|
18
22
|
private _updateValidity;
|
|
19
23
|
static ɵfac: i0.ɵɵFactoryDeclaration<CovalentTextfieldValueAccessorDirective, never>;
|
|
20
24
|
static ɵdir: i0.ɵɵDirectiveDeclaration<CovalentTextfieldValueAccessorDirective, "cv-textfield[formControl], cv-textarea[formControl], cv-select[formControl], cv-checkbox[formControl], cv-checkbox-icon[formControl], cv-radio[formControl], cv-radio-icon[formControl], cv-textfield[formControlName], cv-textarea[formControlName], cv-select[formControlName], cv-checkbox[formControlName], cv-checkbox-icon[formControlName], cv-radio[formControlName], cv-radio-icon[formControlName],", never, {}, {}, never, never, true, never>;
|
|
@@ -11,6 +11,7 @@ import { filter, pairwise } from 'rxjs/operators';
|
|
|
11
11
|
import { trigger, state, style, transition, group, query, animateChild, animate, AUTO_STYLE, keyframes } from '@angular/animations';
|
|
12
12
|
import { Subject } from 'rxjs';
|
|
13
13
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
14
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
14
15
|
|
|
15
16
|
class TdAutoTrimDirective {
|
|
16
17
|
_model;
|
|
@@ -2079,17 +2080,30 @@ function mixinDisableRipple(base) {
|
|
|
2079
2080
|
class CovalentTextfieldValueAccessorDirective {
|
|
2080
2081
|
_elementRef;
|
|
2081
2082
|
_ngControl;
|
|
2083
|
+
_destroyRef;
|
|
2082
2084
|
_onChange = () => {
|
|
2083
2085
|
/* noop */
|
|
2084
2086
|
};
|
|
2085
2087
|
_onTouched = () => {
|
|
2086
2088
|
/* noop */
|
|
2087
2089
|
};
|
|
2088
|
-
constructor(_elementRef, _ngControl) {
|
|
2090
|
+
constructor(_elementRef, _ngControl, _destroyRef) {
|
|
2089
2091
|
this._elementRef = _elementRef;
|
|
2090
2092
|
this._ngControl = _ngControl;
|
|
2093
|
+
this._destroyRef = _destroyRef;
|
|
2091
2094
|
_ngControl.valueAccessor = this;
|
|
2092
2095
|
}
|
|
2096
|
+
ngOnInit() {
|
|
2097
|
+
// Set up a subscription to monitor status changes
|
|
2098
|
+
if (this._ngControl.control) {
|
|
2099
|
+
this._ngControl.control.statusChanges
|
|
2100
|
+
.pipe(takeUntilDestroyed(this._destroyRef))
|
|
2101
|
+
.subscribe(() => {
|
|
2102
|
+
this._onTouched();
|
|
2103
|
+
this._updateValidity();
|
|
2104
|
+
});
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2093
2107
|
writeValue(value) {
|
|
2094
2108
|
if (this._isCheckBox()) {
|
|
2095
2109
|
this._elementRef.nativeElement.value = value || '';
|
|
@@ -2110,6 +2124,15 @@ class CovalentTextfieldValueAccessorDirective {
|
|
|
2110
2124
|
registerOnTouched(fn) {
|
|
2111
2125
|
this._onTouched = fn;
|
|
2112
2126
|
}
|
|
2127
|
+
handleInput() {
|
|
2128
|
+
if (!this._isTextAreaOrField()) {
|
|
2129
|
+
return;
|
|
2130
|
+
}
|
|
2131
|
+
const value = this._elementRef.nativeElement.value;
|
|
2132
|
+
this._onChange(value);
|
|
2133
|
+
this._onTouched();
|
|
2134
|
+
this._updateValidity();
|
|
2135
|
+
}
|
|
2113
2136
|
handleChange(event) {
|
|
2114
2137
|
const value = this._isCheckBox()
|
|
2115
2138
|
? this._elementRef.nativeElement.checked
|
|
@@ -2133,6 +2156,10 @@ class CovalentTextfieldValueAccessorDirective {
|
|
|
2133
2156
|
const tagName = this._elementRef.nativeElement.tagName.toLowerCase();
|
|
2134
2157
|
return tagName === 'cv-radio' || tagName === 'cv-radio-icon';
|
|
2135
2158
|
}
|
|
2159
|
+
_isTextAreaOrField() {
|
|
2160
|
+
const tagName = this._elementRef.nativeElement.tagName.toLowerCase();
|
|
2161
|
+
return tagName === 'cv-textarea' || tagName === 'cv-textfield';
|
|
2162
|
+
}
|
|
2136
2163
|
_updateValidity() {
|
|
2137
2164
|
const element = this._elementRef.nativeElement;
|
|
2138
2165
|
const control = this._ngControl.control;
|
|
@@ -2150,9 +2177,9 @@ class CovalentTextfieldValueAccessorDirective {
|
|
|
2150
2177
|
// Set the web component's custom validity message
|
|
2151
2178
|
element.reportValidity();
|
|
2152
2179
|
}
|
|
2153
|
-
static ɵfac = function CovalentTextfieldValueAccessorDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CovalentTextfieldValueAccessorDirective)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i1.NgControl)); };
|
|
2180
|
+
static ɵfac = function CovalentTextfieldValueAccessorDirective_Factory(__ngFactoryType__) { return new (__ngFactoryType__ || CovalentTextfieldValueAccessorDirective)(i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i1.NgControl), i0.ɵɵdirectiveInject(i0.DestroyRef)); };
|
|
2154
2181
|
static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: CovalentTextfieldValueAccessorDirective, selectors: [["cv-textfield", "formControl", ""], ["cv-textarea", "formControl", ""], ["cv-select", "formControl", ""], ["cv-checkbox", "formControl", ""], ["cv-checkbox-icon", "formControl", ""], ["cv-radio", "formControl", ""], ["cv-radio-icon", "formControl", ""], ["cv-textfield", "formControlName", ""], ["cv-textarea", "formControlName", ""], ["cv-select", "formControlName", ""], ["cv-checkbox", "formControlName", ""], ["cv-checkbox-icon", "formControlName", ""], ["cv-radio", "formControlName", ""], ["cv-radio-icon", "formControlName", ""], [""]], hostBindings: function CovalentTextfieldValueAccessorDirective_HostBindings(rf, ctx) { if (rf & 1) {
|
|
2155
|
-
i0.ɵɵlistener("change", function CovalentTextfieldValueAccessorDirective_change_HostBindingHandler($event) { return ctx.handleChange($event); })("blur", function CovalentTextfieldValueAccessorDirective_blur_HostBindingHandler() { return ctx.handleBlur(); });
|
|
2182
|
+
i0.ɵɵlistener("input", function CovalentTextfieldValueAccessorDirective_input_HostBindingHandler() { return ctx.handleInput(); })("change", function CovalentTextfieldValueAccessorDirective_change_HostBindingHandler($event) { return ctx.handleChange($event); })("blur", function CovalentTextfieldValueAccessorDirective_blur_HostBindingHandler() { return ctx.handleBlur(); });
|
|
2156
2183
|
} } });
|
|
2157
2184
|
}
|
|
2158
2185
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(CovalentTextfieldValueAccessorDirective, [{
|
|
@@ -2173,7 +2200,10 @@ class CovalentTextfieldValueAccessorDirective {
|
|
|
2173
2200
|
cv-radio[formControlName],
|
|
2174
2201
|
cv-radio-icon[formControlName],`,
|
|
2175
2202
|
}]
|
|
2176
|
-
}], () => [{ type: i0.ElementRef }, { type: i1.NgControl }], {
|
|
2203
|
+
}], () => [{ type: i0.ElementRef }, { type: i1.NgControl }, { type: i0.DestroyRef }], { handleInput: [{
|
|
2204
|
+
type: HostListener,
|
|
2205
|
+
args: ['input']
|
|
2206
|
+
}], handleChange: [{
|
|
2177
2207
|
type: HostListener,
|
|
2178
2208
|
args: ['change', ['$event']]
|
|
2179
2209
|
}], handleBlur: [{
|