@ionic/angular 7.3.4-dev.11694530824.11fd0fb9 → 7.3.4-dev.11694532574.1e397a21
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/control-value-accessors/index.d.ts +1 -0
- package/{directives → common/directives}/control-value-accessors/value-accessor.d.ts +2 -2
- package/common/index.d.ts +2 -0
- package/directives/control-value-accessors/boolean-value-accessor.d.ts +1 -1
- package/directives/control-value-accessors/numeric-value-accessor.d.ts +1 -1
- package/directives/control-value-accessors/radio-value-accessor.d.ts +1 -1
- package/directives/control-value-accessors/select-value-accessor.d.ts +1 -1
- package/directives/control-value-accessors/text-value-accessor.d.ts +1 -1
- package/esm2020/app-initialize.mjs +2 -2
- package/esm2020/common/directives/control-value-accessors/index.mjs +2 -0
- package/esm2020/common/directives/control-value-accessors/value-accessor.mjs +141 -0
- package/esm2020/common/index.mjs +3 -1
- package/esm2020/common/utils/util.mjs +10 -0
- package/esm2020/directives/control-value-accessors/boolean-value-accessor.mjs +4 -4
- package/esm2020/directives/control-value-accessors/numeric-value-accessor.mjs +2 -2
- package/esm2020/directives/control-value-accessors/radio-value-accessor.mjs +6 -3
- package/esm2020/directives/control-value-accessors/select-value-accessor.mjs +2 -2
- package/esm2020/directives/control-value-accessors/text-value-accessor.mjs +2 -2
- package/esm2020/standalone/directives/checkbox.mjs +73 -0
- package/esm2020/standalone/directives/datetime.mjs +90 -0
- package/esm2020/standalone/directives/index.mjs +13 -0
- package/esm2020/standalone/directives/input.mjs +112 -0
- package/esm2020/standalone/directives/proxies.mjs +1 -693
- package/esm2020/standalone/directives/radio-group.mjs +58 -0
- package/esm2020/standalone/directives/radio.mjs +62 -0
- package/esm2020/standalone/directives/range.mjs +77 -0
- package/esm2020/standalone/directives/searchbar.mjs +80 -0
- package/esm2020/standalone/directives/segment.mjs +58 -0
- package/esm2020/standalone/directives/select.mjs +81 -0
- package/esm2020/standalone/directives/textarea.mjs +90 -0
- package/esm2020/standalone/directives/toggle.mjs +73 -0
- package/esm2020/standalone/index.mjs +2 -5
- package/fesm2015/ionic-angular-common.mjs +149 -1
- package/fesm2015/ionic-angular-common.mjs.map +1 -1
- package/fesm2015/ionic-angular-standalone.mjs +881 -785
- package/fesm2015/ionic-angular-standalone.mjs.map +1 -1
- package/fesm2015/ionic-angular.mjs +8 -152
- package/fesm2015/ionic-angular.mjs.map +1 -1
- package/fesm2020/ionic-angular-common.mjs +149 -1
- package/fesm2020/ionic-angular-common.mjs.map +1 -1
- package/fesm2020/ionic-angular-standalone.mjs +881 -785
- package/fesm2020/ionic-angular-standalone.mjs.map +1 -1
- package/fesm2020/ionic-angular.mjs +8 -152
- package/fesm2020/ionic-angular.mjs.map +1 -1
- package/package.json +2 -2
- package/standalone/directives/checkbox.d.ts +30 -0
- package/standalone/directives/datetime.d.ts +30 -0
- package/standalone/directives/index.d.ts +12 -0
- package/standalone/directives/input.d.ts +47 -0
- package/standalone/directives/proxies.d.ts +0 -314
- package/standalone/directives/radio-group.d.ts +18 -0
- package/standalone/directives/radio.d.ts +22 -0
- package/standalone/directives/range.d.ts +47 -0
- package/standalone/directives/searchbar.d.ts +45 -0
- package/standalone/directives/segment.d.ts +19 -0
- package/standalone/directives/select.d.ts +34 -0
- package/standalone/directives/textarea.d.ts +37 -0
- package/standalone/directives/toggle.d.ts +28 -0
- package/standalone/index.d.ts +1 -2
- package/esm2020/directives/control-value-accessors/value-accessor.mjs +0 -141
- package/esm2020/util/util.mjs +0 -10
- /package/{util → common/utils}/util.d.ts +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Directive, HostListener, Component, ChangeDetectionStrategy, ViewChild, ContentChild, ContentChildren, Optional, forwardRef, APP_INITIALIZER, NgZone, NgModule } from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, MaxValidator, MinValidator } from '@angular/forms';
|
|
4
4
|
import * as i2 from '@ionic/angular/common';
|
|
5
|
-
import { IonRouterOutlet as IonRouterOutlet$1, IonTabs as IonTabs$1, IonBackButton as IonBackButton$1, IonNav as IonNav$1, RouterLinkDelegateDirective as RouterLinkDelegateDirective$1, RouterLinkWithHrefDelegateDirective as RouterLinkWithHrefDelegateDirective$1, IonModal as IonModal$1, IonPopover as IonPopover$1, ConfigToken, provideComponentInputBinding, AngularDelegate, ModalController, PopoverController } from '@ionic/angular/common';
|
|
5
|
+
import { ValueAccessor, setIonicClasses, IonRouterOutlet as IonRouterOutlet$1, IonTabs as IonTabs$1, IonBackButton as IonBackButton$1, IonNav as IonNav$1, RouterLinkDelegateDirective as RouterLinkDelegateDirective$1, RouterLinkWithHrefDelegateDirective as RouterLinkWithHrefDelegateDirective$1, IonModal as IonModal$1, IonPopover as IonPopover$1, raf, ConfigToken, provideComponentInputBinding, AngularDelegate, ModalController, PopoverController } from '@ionic/angular/common';
|
|
6
6
|
export { ActionSheetController, AlertController, AngularDelegate, AnimationController, Config, DomController, GestureController, IonicRouteStrategy, LoadingController, MenuController, ModalController, NavController, NavParams, PickerController, Platform, PopoverController, ToastController } from '@ionic/angular/common';
|
|
7
7
|
import { __decorate } from 'tslib';
|
|
8
8
|
import { fromEvent } from 'rxjs';
|
|
@@ -12,160 +12,13 @@ import { setupConfig } from '@ionic/core';
|
|
|
12
12
|
export { IonicSafeString, IonicSlides, createAnimation, createGesture, getPlatforms, getTimeGivenProgression, iosTransitionAnimation, isPlatform, mdTransitionAnimation } from '@ionic/core';
|
|
13
13
|
import { applyPolyfills, defineCustomElements } from '@ionic/core/loader';
|
|
14
14
|
|
|
15
|
-
const raf = (h) => {
|
|
16
|
-
if (typeof __zone_symbol__requestAnimationFrame === 'function') {
|
|
17
|
-
return __zone_symbol__requestAnimationFrame(h);
|
|
18
|
-
}
|
|
19
|
-
if (typeof requestAnimationFrame === 'function') {
|
|
20
|
-
return requestAnimationFrame(h);
|
|
21
|
-
}
|
|
22
|
-
return setTimeout(h);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// TODO(FW-2827): types
|
|
26
|
-
class ValueAccessor {
|
|
27
|
-
constructor(injector, el) {
|
|
28
|
-
this.injector = injector;
|
|
29
|
-
this.el = el;
|
|
30
|
-
this.onChange = () => {
|
|
31
|
-
/**/
|
|
32
|
-
};
|
|
33
|
-
this.onTouched = () => {
|
|
34
|
-
/**/
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
writeValue(value) {
|
|
38
|
-
this.el.nativeElement.value = this.lastValue = value;
|
|
39
|
-
setIonicClasses(this.el);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Notifies the ControlValueAccessor of a change in the value of the control.
|
|
43
|
-
*
|
|
44
|
-
* This is called by each of the ValueAccessor directives when we want to update
|
|
45
|
-
* the status and validity of the form control. For example with text components this
|
|
46
|
-
* is called when the ionInput event is fired. For select components this is called
|
|
47
|
-
* when the ionChange event is fired.
|
|
48
|
-
*
|
|
49
|
-
* This also updates the Ionic form status classes on the element.
|
|
50
|
-
*
|
|
51
|
-
* @param el The component element.
|
|
52
|
-
* @param value The new value of the control.
|
|
53
|
-
*/
|
|
54
|
-
handleValueChange(el, value) {
|
|
55
|
-
if (el === this.el.nativeElement) {
|
|
56
|
-
if (value !== this.lastValue) {
|
|
57
|
-
this.lastValue = value;
|
|
58
|
-
this.onChange(value);
|
|
59
|
-
}
|
|
60
|
-
setIonicClasses(this.el);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
_handleBlurEvent(el) {
|
|
64
|
-
if (el === this.el.nativeElement) {
|
|
65
|
-
this.onTouched();
|
|
66
|
-
setIonicClasses(this.el);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
registerOnChange(fn) {
|
|
70
|
-
this.onChange = fn;
|
|
71
|
-
}
|
|
72
|
-
registerOnTouched(fn) {
|
|
73
|
-
this.onTouched = fn;
|
|
74
|
-
}
|
|
75
|
-
setDisabledState(isDisabled) {
|
|
76
|
-
this.el.nativeElement.disabled = isDisabled;
|
|
77
|
-
}
|
|
78
|
-
ngOnDestroy() {
|
|
79
|
-
if (this.statusChanges) {
|
|
80
|
-
this.statusChanges.unsubscribe();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
ngAfterViewInit() {
|
|
84
|
-
let ngControl;
|
|
85
|
-
try {
|
|
86
|
-
ngControl = this.injector.get(NgControl);
|
|
87
|
-
}
|
|
88
|
-
catch {
|
|
89
|
-
/* No FormControl or ngModel binding */
|
|
90
|
-
}
|
|
91
|
-
if (!ngControl) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
// Listen for changes in validity, disabled, or pending states
|
|
95
|
-
if (ngControl.statusChanges) {
|
|
96
|
-
this.statusChanges = ngControl.statusChanges.subscribe(() => setIonicClasses(this.el));
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* TODO FW-2787: Remove this in favor of https://github.com/angular/angular/issues/10887
|
|
100
|
-
* whenever it is implemented.
|
|
101
|
-
*/
|
|
102
|
-
const formControl = ngControl.control;
|
|
103
|
-
if (formControl) {
|
|
104
|
-
const methodsToPatch = ['markAsTouched', 'markAllAsTouched', 'markAsUntouched', 'markAsDirty', 'markAsPristine'];
|
|
105
|
-
methodsToPatch.forEach((method) => {
|
|
106
|
-
if (typeof formControl[method] !== 'undefined') {
|
|
107
|
-
const oldFn = formControl[method].bind(formControl);
|
|
108
|
-
formControl[method] = (...params) => {
|
|
109
|
-
oldFn(...params);
|
|
110
|
-
setIonicClasses(this.el);
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
/** @nocollapse */ ValueAccessor.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ValueAccessor, deps: [{ token: i0.Injector }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
118
|
-
/** @nocollapse */ ValueAccessor.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.12", type: ValueAccessor, host: { listeners: { "ionBlur": "_handleBlurEvent($event.target)" } }, ngImport: i0 });
|
|
119
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: ValueAccessor, decorators: [{
|
|
120
|
-
type: Directive
|
|
121
|
-
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.ElementRef }]; }, propDecorators: { _handleBlurEvent: [{
|
|
122
|
-
type: HostListener,
|
|
123
|
-
args: ['ionBlur', ['$event.target']]
|
|
124
|
-
}] } });
|
|
125
|
-
const setIonicClasses = (element) => {
|
|
126
|
-
raf(() => {
|
|
127
|
-
const input = element.nativeElement;
|
|
128
|
-
const hasValue = input.value != null && input.value.toString().length > 0;
|
|
129
|
-
const classes = getClasses(input);
|
|
130
|
-
setClasses(input, classes);
|
|
131
|
-
const item = input.closest('ion-item');
|
|
132
|
-
if (item) {
|
|
133
|
-
if (hasValue) {
|
|
134
|
-
setClasses(item, [...classes, 'item-has-value']);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
setClasses(item, classes);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
};
|
|
142
|
-
const getClasses = (element) => {
|
|
143
|
-
const classList = element.classList;
|
|
144
|
-
const classes = [];
|
|
145
|
-
for (let i = 0; i < classList.length; i++) {
|
|
146
|
-
const item = classList.item(i);
|
|
147
|
-
if (item !== null && startsWith(item, 'ng-')) {
|
|
148
|
-
classes.push(`ion-${item.substring(3)}`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return classes;
|
|
152
|
-
};
|
|
153
|
-
const setClasses = (element, classes) => {
|
|
154
|
-
const classList = element.classList;
|
|
155
|
-
classList.remove('ion-valid', 'ion-invalid', 'ion-touched', 'ion-untouched', 'ion-dirty', 'ion-pristine');
|
|
156
|
-
classList.add(...classes);
|
|
157
|
-
};
|
|
158
|
-
const startsWith = (input, search) => {
|
|
159
|
-
return input.substring(0, search.length) === search;
|
|
160
|
-
};
|
|
161
|
-
|
|
162
15
|
class BooleanValueAccessorDirective extends ValueAccessor {
|
|
163
16
|
constructor(injector, el) {
|
|
164
17
|
super(injector, el);
|
|
165
18
|
}
|
|
166
19
|
writeValue(value) {
|
|
167
|
-
this.
|
|
168
|
-
setIonicClasses(this.
|
|
20
|
+
this.elementRef.nativeElement.checked = this.lastValue = value;
|
|
21
|
+
setIonicClasses(this.elementRef);
|
|
169
22
|
}
|
|
170
23
|
_handleIonChange(el) {
|
|
171
24
|
this.handleValueChange(el, el.checked);
|
|
@@ -238,8 +91,11 @@ class RadioValueAccessorDirective extends ValueAccessor {
|
|
|
238
91
|
constructor(injector, el) {
|
|
239
92
|
super(injector, el);
|
|
240
93
|
}
|
|
241
|
-
// TODO(FW-2827): type (HTMLIonRadioElement and HTMLElement are both missing `checked`)
|
|
242
94
|
_handleIonSelect(el) {
|
|
95
|
+
/**
|
|
96
|
+
* The `el` type is any to access the `checked` state property
|
|
97
|
+
* that is not exposed on the type interface.
|
|
98
|
+
*/
|
|
243
99
|
this.handleValueChange(el, el.checked);
|
|
244
100
|
}
|
|
245
101
|
}
|