tuain-ng-forms-lib 12.0.30 → 12.0.35
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/tuain-ng-forms-lib.umd.js +35 -50
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/classes/forms/field.js +12 -25
- package/esm2015/lib/classes/forms/form.js +2 -2
- package/esm2015/lib/components/elements/action.component.js +4 -4
- package/esm2015/lib/components/elements/field.component.js +8 -8
- package/esm2015/lib/components/elements/layout/element.component.js +4 -4
- package/esm2015/lib/components/elements/tables/table.component.js +2 -2
- package/esm2015/lib/components/forms/basic-form.js +3 -4
- package/fesm2015/tuain-ng-forms-lib.js +28 -42
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/classes/forms/field.d.ts +1 -2
- package/lib/components/elements/action.component.d.ts +1 -1
- package/lib/components/elements/field.component.d.ts +1 -1
- package/lib/components/elements/layout/element.component.d.ts +1 -1
- package/lib/components/elements/tables/table.component.d.ts +1 -1
- package/lib/components/forms/basic-form.d.ts +0 -1
- package/package.json +1 -1
- package/tuain-ng-forms-lib.metadata.json +1 -1
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('nanoid'), require('@angular/common'), require('@angular/router'), require('@angular/forms')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('tuain-ng-forms-lib', ['exports', '@angular/core', 'rxjs', 'nanoid', '@angular/common', '@angular/router', '@angular/forms'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['tuain-ng-forms-lib'] = {}, global.ng.core, global.rxjs, global.nanoid, global.ng.common, global.ng.router, global.ng.forms));
|
|
5
|
-
}(this, (function (exports, core, rxjs, nanoid, common, router, forms) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('yn'), require('nanoid'), require('@angular/common'), require('@angular/router'), require('@angular/forms')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('tuain-ng-forms-lib', ['exports', '@angular/core', 'rxjs', 'yn', 'nanoid', '@angular/common', '@angular/router', '@angular/forms'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['tuain-ng-forms-lib'] = {}, global.ng.core, global.rxjs, global.yn, global.nanoid, global.ng.common, global.ng.router, global.ng.forms));
|
|
5
|
+
}(this, (function (exports, core, rxjs, yn, nanoid, common, router, forms) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var yn__default = /*#__PURE__*/_interopDefaultLegacy(yn);
|
|
6
10
|
|
|
7
11
|
var ActionComponent = /** @class */ (function () {
|
|
8
12
|
function ActionComponent() {
|
|
@@ -36,7 +40,7 @@
|
|
|
36
40
|
Object.defineProperty(ActionComponent.prototype, "visible", {
|
|
37
41
|
get: function () {
|
|
38
42
|
var _a;
|
|
39
|
-
return ((_a = this.action) === null || _a === void 0 ? void 0 : _a.visibleOn(this.
|
|
43
|
+
return ((_a = this.action) === null || _a === void 0 ? void 0 : _a.visibleOn(this.state)) && this.visibleOnRestriction();
|
|
40
44
|
},
|
|
41
45
|
enumerable: false,
|
|
42
46
|
configurable: true
|
|
@@ -44,7 +48,7 @@
|
|
|
44
48
|
Object.defineProperty(ActionComponent.prototype, "disabled", {
|
|
45
49
|
get: function () {
|
|
46
50
|
var _a;
|
|
47
|
-
return !((_a = this.action) === null || _a === void 0 ? void 0 : _a.enabledOn(this.
|
|
51
|
+
return !((_a = this.action) === null || _a === void 0 ? void 0 : _a.enabledOn(this.state));
|
|
48
52
|
},
|
|
49
53
|
enumerable: false,
|
|
50
54
|
configurable: true
|
|
@@ -61,7 +65,7 @@
|
|
|
61
65
|
action: [{ type: core.Input }],
|
|
62
66
|
busy: [{ type: core.Input }],
|
|
63
67
|
relatedField: [{ type: core.Input }],
|
|
64
|
-
|
|
68
|
+
state: [{ type: core.Input }],
|
|
65
69
|
style: [{ type: core.Input }],
|
|
66
70
|
showLabel: [{ type: core.Input }]
|
|
67
71
|
};
|
|
@@ -422,18 +426,18 @@
|
|
|
422
426
|
FieldComponent.prototype.start = function () { };
|
|
423
427
|
FieldComponent.prototype.focus = function () { };
|
|
424
428
|
FieldComponent.prototype.updateObject = function () {
|
|
425
|
-
this.field.
|
|
429
|
+
this.field.setValue(this.value);
|
|
426
430
|
};
|
|
427
431
|
FieldComponent.prototype.inputChanged = function () {
|
|
428
|
-
this.field.
|
|
432
|
+
this.field.setValue(this.value);
|
|
429
433
|
this.onChangeContent();
|
|
430
434
|
};
|
|
431
435
|
FieldComponent.prototype.inputTyped = function () {
|
|
432
|
-
this.field.
|
|
436
|
+
this.field.setValue(this.value);
|
|
433
437
|
this.onInputChange();
|
|
434
438
|
};
|
|
435
439
|
FieldComponent.prototype.updateValue = function () {
|
|
436
|
-
this.value = this.field.
|
|
440
|
+
this.value = this.field.getValue();
|
|
437
441
|
};
|
|
438
442
|
FieldComponent.prototype.onInputChange = function () {
|
|
439
443
|
var _this = this;
|
|
@@ -454,7 +458,7 @@
|
|
|
454
458
|
Object.defineProperty(FieldComponent.prototype, "visible", {
|
|
455
459
|
get: function () {
|
|
456
460
|
var _a;
|
|
457
|
-
return (_a = this.field) === null || _a === void 0 ? void 0 : _a.visibleOn(this.
|
|
461
|
+
return (_a = this.field) === null || _a === void 0 ? void 0 : _a.visibleOn(this.state);
|
|
458
462
|
},
|
|
459
463
|
enumerable: false,
|
|
460
464
|
configurable: true
|
|
@@ -462,7 +466,7 @@
|
|
|
462
466
|
Object.defineProperty(FieldComponent.prototype, "disabled", {
|
|
463
467
|
get: function () {
|
|
464
468
|
var _a;
|
|
465
|
-
return !((_a = this.field) === null || _a === void 0 ? void 0 : _a.enabledOn(this.
|
|
469
|
+
return !((_a = this.field) === null || _a === void 0 ? void 0 : _a.enabledOn(this.state));
|
|
466
470
|
},
|
|
467
471
|
enumerable: false,
|
|
468
472
|
configurable: true
|
|
@@ -477,7 +481,7 @@
|
|
|
477
481
|
];
|
|
478
482
|
FieldComponent.propDecorators = {
|
|
479
483
|
field: [{ type: core.Input }],
|
|
480
|
-
|
|
484
|
+
state: [{ type: core.Input }]
|
|
481
485
|
};
|
|
482
486
|
|
|
483
487
|
var ElementComponent = /** @class */ (function () {
|
|
@@ -492,7 +496,7 @@
|
|
|
492
496
|
Object.defineProperty(ElementComponent.prototype, "visible", {
|
|
493
497
|
get: function () {
|
|
494
498
|
var _a;
|
|
495
|
-
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.visibleOn(this.
|
|
499
|
+
return (_a = this.element) === null || _a === void 0 ? void 0 : _a.visibleOn(this.state);
|
|
496
500
|
},
|
|
497
501
|
enumerable: false,
|
|
498
502
|
configurable: true
|
|
@@ -500,7 +504,7 @@
|
|
|
500
504
|
Object.defineProperty(ElementComponent.prototype, "disabled", {
|
|
501
505
|
get: function () {
|
|
502
506
|
var _a;
|
|
503
|
-
return !((_a = this.element) === null || _a === void 0 ? void 0 : _a.enabledOn(this.
|
|
507
|
+
return !((_a = this.element) === null || _a === void 0 ? void 0 : _a.enabledOn(this.state));
|
|
504
508
|
},
|
|
505
509
|
enumerable: false,
|
|
506
510
|
configurable: true
|
|
@@ -516,7 +520,7 @@
|
|
|
516
520
|
ElementComponent.propDecorators = {
|
|
517
521
|
element: [{ type: core.Input }],
|
|
518
522
|
form: [{ type: core.Input }],
|
|
519
|
-
|
|
523
|
+
state: [{ type: core.Input }]
|
|
520
524
|
};
|
|
521
525
|
|
|
522
526
|
var FormErrorComponent = /** @class */ (function () {
|
|
@@ -1638,7 +1642,7 @@
|
|
|
1638
1642
|
table: [{ type: core.Input }],
|
|
1639
1643
|
tableRecords: [{ type: core.Input }],
|
|
1640
1644
|
disabled: [{ type: core.Input }],
|
|
1641
|
-
|
|
1645
|
+
state: [{ type: core.Input }],
|
|
1642
1646
|
waiting: [{ type: core.Input }]
|
|
1643
1647
|
};
|
|
1644
1648
|
|
|
@@ -1691,7 +1695,7 @@
|
|
|
1691
1695
|
var BIG_MAX_LENGTH = 500;
|
|
1692
1696
|
var fldAttr = {
|
|
1693
1697
|
validateOnServer: 'validateOnServer',
|
|
1694
|
-
value: '
|
|
1698
|
+
value: '_value',
|
|
1695
1699
|
minValue: '_minValue',
|
|
1696
1700
|
maxValue: '_maxValue',
|
|
1697
1701
|
maxLength: '_maxLength',
|
|
@@ -1869,7 +1873,6 @@
|
|
|
1869
1873
|
FieldDescriptor.prototype.hideLabel = function () { this.setVisibleLabel(false); };
|
|
1870
1874
|
FieldDescriptor.prototype.setChanged = function (hasChanged) { this.setAttr(fldAttr.hasChanged, hasChanged); };
|
|
1871
1875
|
FieldDescriptor.prototype.changed = function () { this.setChanged(true); };
|
|
1872
|
-
FieldDescriptor.prototype.getRawValue = function () { return this._fieldValue; };
|
|
1873
1876
|
FieldDescriptor.prototype.setLabel = function (label) { this.setAttr(fldAttr.title, label); };
|
|
1874
1877
|
FieldDescriptor.prototype.clean = function () { this.setValue(this.defaultValue || ''); this.resetError(); };
|
|
1875
1878
|
Object.defineProperty(FieldDescriptor.prototype, "backend", {
|
|
@@ -1918,24 +1921,11 @@
|
|
|
1918
1921
|
return fieldCurrentValue === '';
|
|
1919
1922
|
};
|
|
1920
1923
|
FieldDescriptor.prototype.getValue = function () {
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
return (_a = this._fieldValue) !== null && _a !== void 0 ? _a : false;
|
|
1925
|
-
break;
|
|
1926
|
-
case this._formConfig.fieldTypes.check:
|
|
1927
|
-
return (_b = this._fieldValue) !== null && _b !== void 0 ? _b : false;
|
|
1928
|
-
break;
|
|
1929
|
-
case this._formConfig.fieldTypes.currency:
|
|
1930
|
-
return (typeof this._fieldValue === 'string')
|
|
1931
|
-
? this._fieldValue.replace(',', '') : this._fieldValue;
|
|
1932
|
-
break;
|
|
1933
|
-
default:
|
|
1934
|
-
console.log('Valor del campo...');
|
|
1935
|
-
console.log(this._fieldValue);
|
|
1936
|
-
return this._fieldValue;
|
|
1937
|
-
break;
|
|
1924
|
+
if (this.fieldType === this._formConfig.fieldTypes.boolean
|
|
1925
|
+
|| this.fieldType === this._formConfig.fieldTypes.check) {
|
|
1926
|
+
return yn__default['default'](this._value);
|
|
1938
1927
|
}
|
|
1928
|
+
return this._value;
|
|
1939
1929
|
};
|
|
1940
1930
|
FieldDescriptor.prototype.updateFromServer = function (fld) {
|
|
1941
1931
|
var _a;
|
|
@@ -2014,14 +2004,14 @@
|
|
|
2014
2004
|
if (this.fieldType === this._formConfig.fieldTypes.array && this.widget) {
|
|
2015
2005
|
return (_a = this.widget) === null || _a === void 0 ? void 0 : _a.refereshContent();
|
|
2016
2006
|
}
|
|
2017
|
-
if (this.
|
|
2018
|
-
if (this.fieldType === this._formConfig.fieldTypes.array && Array.isArray(this.
|
|
2019
|
-
var fieldValue = (_b = this.
|
|
2007
|
+
if (this._value) {
|
|
2008
|
+
if (this.fieldType === this._formConfig.fieldTypes.array && Array.isArray(this._value)) {
|
|
2009
|
+
var fieldValue = (_b = this._value) === null || _b === void 0 ? void 0 : _b.filter(function (item) { return _this.fieldOptions.find(function (opt) { return opt.fieldOptionId === item; }); });
|
|
2020
2010
|
this.setAttr(fldAttr.value, fieldValue);
|
|
2021
2011
|
}
|
|
2022
2012
|
else {
|
|
2023
2013
|
var valInOptions = this.fieldOptions
|
|
2024
|
-
.find(function (item) { return item.fieldOptionId === _this.
|
|
2014
|
+
.find(function (item) { return item.fieldOptionId === _this._value; });
|
|
2025
2015
|
if (!valInOptions) {
|
|
2026
2016
|
this.setValue('');
|
|
2027
2017
|
}
|
|
@@ -2077,7 +2067,7 @@
|
|
|
2077
2067
|
newFinalValue = newValue;
|
|
2078
2068
|
break;
|
|
2079
2069
|
}
|
|
2080
|
-
if (this.
|
|
2070
|
+
if (this._value !== newFinalValue) {
|
|
2081
2071
|
this.setChanged(true);
|
|
2082
2072
|
this.setAttr(fldAttr.value, newFinalValue);
|
|
2083
2073
|
}
|
|
@@ -2585,7 +2575,7 @@
|
|
|
2585
2575
|
FormStructureAndData.prototype.getField = function (code) { var _a; return (code && ((_a = this._fields) === null || _a === void 0 ? void 0 : _a[code])) ? this._fields[code] : null; };
|
|
2586
2576
|
FormStructureAndData.prototype.enableField = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.enable(); };
|
|
2587
2577
|
FormStructureAndData.prototype.disableField = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.disable(); };
|
|
2588
|
-
FormStructureAndData.prototype.getFieldValue = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.getValue(); };
|
|
2578
|
+
FormStructureAndData.prototype.getFieldValue = function (code) { var _a; return (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.getValue(); };
|
|
2589
2579
|
FormStructureAndData.prototype.getFieldOptions = function (code) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.getFieldOptions(); };
|
|
2590
2580
|
FormStructureAndData.prototype.setFieldValue = function (code, value) { var _a; (_a = this.getField(code)) === null || _a === void 0 ? void 0 : _a.setValue(value); };
|
|
2591
2581
|
FormStructureAndData.prototype.setFieldError = function (code, message, type) {
|
|
@@ -3408,7 +3398,7 @@
|
|
|
3408
3398
|
configurable: true
|
|
3409
3399
|
});
|
|
3410
3400
|
Object.defineProperty(BasicFormComponent.prototype, "state", {
|
|
3411
|
-
get: function () { return this.
|
|
3401
|
+
get: function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.state; },
|
|
3412
3402
|
enumerable: false,
|
|
3413
3403
|
configurable: true
|
|
3414
3404
|
});
|
|
@@ -3418,11 +3408,6 @@
|
|
|
3418
3408
|
enumerable: false,
|
|
3419
3409
|
configurable: true
|
|
3420
3410
|
});
|
|
3421
|
-
Object.defineProperty(BasicFormComponent.prototype, "currentMode", {
|
|
3422
|
-
get: function () { return this.currentState; },
|
|
3423
|
-
enumerable: false,
|
|
3424
|
-
configurable: true
|
|
3425
|
-
});
|
|
3426
3411
|
Object.defineProperty(BasicFormComponent.prototype, "immutableData", {
|
|
3427
3412
|
get: function () { var _a; return (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.immutableData; },
|
|
3428
3413
|
enumerable: false,
|
|
@@ -3507,7 +3492,7 @@
|
|
|
3507
3492
|
if (!cleanStack) {
|
|
3508
3493
|
origin = Object.assign(Object.assign({}, backData), { name: this.name, url: this._formRoute, token: this._controlToken });
|
|
3509
3494
|
origin.subject = (_a = origin === null || origin === void 0 ? void 0 : origin.subject) !== null && _a !== void 0 ? _a : this.formSubject;
|
|
3510
|
-
origin.state = (_b = origin === null || origin === void 0 ? void 0 : origin.state) !== null && _b !== void 0 ? _b : this.
|
|
3495
|
+
origin.state = (_b = origin === null || origin === void 0 ? void 0 : origin.state) !== null && _b !== void 0 ? _b : this.state;
|
|
3511
3496
|
origin.fields = (_c = origin === null || origin === void 0 ? void 0 : origin.fields) !== null && _c !== void 0 ? _c : {};
|
|
3512
3497
|
origin.extra = (_d = origin === null || origin === void 0 ? void 0 : origin.extra) !== null && _d !== void 0 ? _d : {};
|
|
3513
3498
|
}
|