@ngx-formly/core 5.10.31 → 5.11.0
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/ngx-formly-core.umd.js +39 -16
- package/bundles/ngx-formly-core.umd.js.map +1 -1
- package/bundles/ngx-formly-core.umd.min.js +1 -1
- package/bundles/ngx-formly-core.umd.min.js.map +1 -1
- package/esm2015/lib/components/formly.attributes.js +15 -1
- package/esm2015/lib/core.js +1 -1
- package/esm2015/lib/extensions/field-form/field-form.js +9 -6
- package/esm2015/lib/templates/field-array.type.js +11 -7
- package/esm2015/lib/templates/field.type.js +18 -2
- package/esm2015/lib/utils.js +6 -2
- package/esm5/lib/components/formly.attributes.js +22 -1
- package/esm5/lib/core.js +1 -1
- package/esm5/lib/extensions/field-form/field-form.js +11 -6
- package/esm5/lib/templates/field-array.type.js +11 -11
- package/esm5/lib/templates/field.type.js +18 -2
- package/esm5/lib/utils.js +6 -2
- package/fesm2015/ngx-formly-core.js +29 -14
- package/fesm2015/ngx-formly-core.js.map +1 -1
- package/fesm5/ngx-formly-core.js +37 -17
- package/fesm5/ngx-formly-core.js.map +1 -1
- package/lib/components/formly.attributes.d.ts +1 -0
- package/lib/core.d.ts +2 -2
- package/lib/templates/field-array.type.d.ts +5 -2
- package/lib/templates/field.type.d.ts +8 -2
- package/ngx-formly-core.metadata.json +1 -1
- package/package.json +1 -1
package/fesm5/ngx-formly-core.js
CHANGED
|
@@ -36,8 +36,12 @@ function getFieldId(formId, field, index) {
|
|
|
36
36
|
return field.id;
|
|
37
37
|
/** @type {?} */
|
|
38
38
|
var type = field.type;
|
|
39
|
-
if (!type && field.template)
|
|
39
|
+
if (!type && field.template) {
|
|
40
40
|
type = 'template';
|
|
41
|
+
}
|
|
42
|
+
if (isFunction(type)) {
|
|
43
|
+
type = ((/** @type {?} */ (type))).prototype.constructor.name;
|
|
44
|
+
}
|
|
41
45
|
return [formId, type, field.key, index].join('_');
|
|
42
46
|
}
|
|
43
47
|
/**
|
|
@@ -2116,6 +2120,24 @@ var FormlyAttributes = /** @class */ (function () {
|
|
|
2116
2120
|
this.to.blur(this.field, $event);
|
|
2117
2121
|
}
|
|
2118
2122
|
};
|
|
2123
|
+
// handle custom `change` event, for regular ones rely on DOM listener
|
|
2124
|
+
// handle custom `change` event, for regular ones rely on DOM listener
|
|
2125
|
+
/**
|
|
2126
|
+
* @param {?} $event
|
|
2127
|
+
* @return {?}
|
|
2128
|
+
*/
|
|
2129
|
+
FormlyAttributes.prototype.onHostChange =
|
|
2130
|
+
// handle custom `change` event, for regular ones rely on DOM listener
|
|
2131
|
+
/**
|
|
2132
|
+
* @param {?} $event
|
|
2133
|
+
* @return {?}
|
|
2134
|
+
*/
|
|
2135
|
+
function ($event) {
|
|
2136
|
+
if ($event instanceof Event) {
|
|
2137
|
+
return;
|
|
2138
|
+
}
|
|
2139
|
+
this.onChange($event);
|
|
2140
|
+
};
|
|
2119
2141
|
/**
|
|
2120
2142
|
* @param {?} $event
|
|
2121
2143
|
* @return {?}
|
|
@@ -2201,6 +2223,9 @@ var FormlyAttributes = /** @class */ (function () {
|
|
|
2201
2223
|
FormlyAttributes.decorators = [
|
|
2202
2224
|
{ type: Directive, args: [{
|
|
2203
2225
|
selector: '[formlyAttributes]',
|
|
2226
|
+
host: {
|
|
2227
|
+
'(change)': 'onHostChange($event)',
|
|
2228
|
+
},
|
|
2204
2229
|
},] }
|
|
2205
2230
|
];
|
|
2206
2231
|
/** @nocollapse */
|
|
@@ -2278,7 +2303,7 @@ var FieldType = /** @class */ (function () {
|
|
|
2278
2303
|
get: /**
|
|
2279
2304
|
* @return {?}
|
|
2280
2305
|
*/
|
|
2281
|
-
function () { return this.field.formControl; },
|
|
2306
|
+
function () { return (/** @type {?} */ (this.field.formControl)); },
|
|
2282
2307
|
enumerable: true,
|
|
2283
2308
|
configurable: true
|
|
2284
2309
|
});
|
|
@@ -2362,16 +2387,6 @@ var FieldArrayType = /** @class */ (function (_super) {
|
|
|
2362
2387
|
}
|
|
2363
2388
|
return _this;
|
|
2364
2389
|
}
|
|
2365
|
-
Object.defineProperty(FieldArrayType.prototype, "formControl", {
|
|
2366
|
-
get: /**
|
|
2367
|
-
* @return {?}
|
|
2368
|
-
*/
|
|
2369
|
-
function () {
|
|
2370
|
-
return (/** @type {?} */ (this.field.formControl));
|
|
2371
|
-
},
|
|
2372
|
-
enumerable: true,
|
|
2373
|
-
configurable: true
|
|
2374
|
-
});
|
|
2375
2390
|
/**
|
|
2376
2391
|
* @param {?} field
|
|
2377
2392
|
* @return {?}
|
|
@@ -3547,27 +3562,32 @@ FieldFormExtension = /** @class */ (function () {
|
|
|
3547
3562
|
/**
|
|
3548
3563
|
* @private
|
|
3549
3564
|
* @param {?} field
|
|
3565
|
+
* @param {?=} disabled
|
|
3550
3566
|
* @return {?}
|
|
3551
3567
|
*/
|
|
3552
3568
|
FieldFormExtension.prototype.setValidators = /**
|
|
3553
3569
|
* @private
|
|
3554
3570
|
* @param {?} field
|
|
3571
|
+
* @param {?=} disabled
|
|
3555
3572
|
* @return {?}
|
|
3556
3573
|
*/
|
|
3557
|
-
function (field) {
|
|
3574
|
+
function (field, disabled) {
|
|
3558
3575
|
var _this = this;
|
|
3576
|
+
if (disabled === void 0) { disabled = false; }
|
|
3559
3577
|
/** @type {?} */
|
|
3560
3578
|
var markForCheck = false;
|
|
3579
|
+
if (disabled === false && field.key && field.templateOptions && field.templateOptions.disabled) {
|
|
3580
|
+
disabled = true;
|
|
3581
|
+
}
|
|
3561
3582
|
(field.fieldGroup || []).forEach((/**
|
|
3562
3583
|
* @param {?} f
|
|
3563
3584
|
* @return {?}
|
|
3564
3585
|
*/
|
|
3565
|
-
function (f) { return _this.setValidators(f) && (markForCheck = true); }));
|
|
3586
|
+
function (f) { return _this.setValidators(f, disabled) && (markForCheck = true); }));
|
|
3566
3587
|
if (field.key || !field.parent || (!field.key && !field.fieldGroup)) {
|
|
3567
3588
|
var c_1 = field.formControl;
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
if (field.key && c_1) {
|
|
3589
|
+
field.templateOptions = field.templateOptions || {};
|
|
3590
|
+
if (field.key && c_1 && c_1 instanceof FormControl) {
|
|
3571
3591
|
if (disabled && c_1.enabled) {
|
|
3572
3592
|
c_1.disable({ emitEvent: false, onlySelf: true });
|
|
3573
3593
|
markForCheck = true;
|