tuain-ng-forms-lib 14.2.14 → 14.3.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/esm2020/lib/components/elements/field.component.mjs +27 -40
- package/esm2020/lib/components/forms/basic-form.mjs +12 -1
- package/fesm2015/tuain-ng-forms-lib.mjs +40 -42
- package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
- package/fesm2020/tuain-ng-forms-lib.mjs +37 -39
- package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/components/elements/field.component.d.ts +6 -6
- package/lib/components/forms/basic-form.d.ts +1 -0
- package/package.json +1 -1
|
@@ -81,24 +81,25 @@ class FieldComponent {
|
|
|
81
81
|
this.field = null;
|
|
82
82
|
}
|
|
83
83
|
ngOnInit() {
|
|
84
|
-
var _a, _b;
|
|
85
|
-
if (this.field) {
|
|
86
|
-
|
|
87
|
-
// Inicialización
|
|
88
|
-
const mapping = this.formConfig.fieldPropagateAttributes;
|
|
89
|
-
for (let index = 0; index < mapping.length; index++) {
|
|
90
|
-
const attrName = mapping[index].toString();
|
|
91
|
-
const attributeValue = (_b = this.field) === null || _b === void 0 ? void 0 : _b[attrName];
|
|
92
|
-
this.dafaultProcessFieldChange(attrName, attributeValue);
|
|
93
|
-
this.processFieldChange(attrName, attributeValue);
|
|
94
|
-
}
|
|
95
|
-
// Subscripción a cambios en atributos
|
|
96
|
-
this.field.attributeChange.subscribe(event => {
|
|
97
|
-
const { name: attrName, value } = event;
|
|
98
|
-
this.dafaultProcessFieldChange(attrName, value);
|
|
99
|
-
this.processFieldChange(attrName, value);
|
|
100
|
-
});
|
|
84
|
+
var _a, _b, _c;
|
|
85
|
+
if (!this.field) {
|
|
86
|
+
return;
|
|
101
87
|
}
|
|
88
|
+
this.formConfig = (_a = this.field) === null || _a === void 0 ? void 0 : _a._formConfig;
|
|
89
|
+
// Inicialización
|
|
90
|
+
const mapping = this.formConfig.fieldPropagateAttributes;
|
|
91
|
+
for (let index = 0; index < mapping.length; index++) {
|
|
92
|
+
const attrName = mapping[index].toString();
|
|
93
|
+
const attributeValue = (_b = this.field) === null || _b === void 0 ? void 0 : _b[attrName];
|
|
94
|
+
this.dafaultProcessFieldChange(attrName, attributeValue);
|
|
95
|
+
this.processFieldChange(attrName, attributeValue);
|
|
96
|
+
}
|
|
97
|
+
// Subscripción a cambios en atributos
|
|
98
|
+
(_c = this.field) === null || _c === void 0 ? void 0 : _c.attributeChange.subscribe(event => {
|
|
99
|
+
const { name: attrName, value } = event;
|
|
100
|
+
this.dafaultProcessFieldChange(attrName, value);
|
|
101
|
+
this.processFieldChange(attrName, value);
|
|
102
|
+
});
|
|
102
103
|
this.start();
|
|
103
104
|
}
|
|
104
105
|
dafaultProcessFieldChange(attribute, value) {
|
|
@@ -112,44 +113,30 @@ class FieldComponent {
|
|
|
112
113
|
this[attribute] = value;
|
|
113
114
|
}
|
|
114
115
|
}
|
|
116
|
+
get visible() { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.visibleOn(this.state); }
|
|
117
|
+
get disabled() { var _a; return !((_a = this.field) === null || _a === void 0 ? void 0 : _a.enabledOn(this.state)); }
|
|
118
|
+
updateValue() { var _a; this.value = (_a = this.field) === null || _a === void 0 ? void 0 : _a.value; }
|
|
119
|
+
onInputChange() { setTimeout(() => { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.notifyEditionPartial(); }, 50); }
|
|
120
|
+
onChangeContent() { setTimeout(() => { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.notifyEditionFinish(); }, 50); }
|
|
121
|
+
onShowInfo(detail = null) { setTimeout(() => { var _a; return (_a = this.field) === null || _a === void 0 ? void 0 : _a.notifyEditionDetailRequest(detail); }, 50); }
|
|
115
122
|
processFieldChange(attribute, value) { }
|
|
116
123
|
start() { }
|
|
117
124
|
focus() { }
|
|
118
|
-
updateObject() {
|
|
119
|
-
this.field.setValue(this.value);
|
|
120
|
-
}
|
|
125
|
+
updateObject() { var _a; (_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value); }
|
|
121
126
|
inputChanged() {
|
|
122
|
-
|
|
127
|
+
var _a;
|
|
128
|
+
(_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value);
|
|
123
129
|
this.onChangeContent();
|
|
124
130
|
}
|
|
125
131
|
inputTyped() {
|
|
126
|
-
|
|
132
|
+
var _a;
|
|
133
|
+
(_a = this.field) === null || _a === void 0 ? void 0 : _a.setValue(this.value);
|
|
127
134
|
this.onInputChange();
|
|
128
135
|
}
|
|
129
|
-
updateValue() {
|
|
130
|
-
this.value = this.field.getValue();
|
|
131
|
-
}
|
|
132
|
-
onInputChange() {
|
|
133
|
-
setTimeout(() => this.field.notifyEditionPartial(), 50);
|
|
134
|
-
}
|
|
135
|
-
onChangeContent() {
|
|
136
|
-
setTimeout(() => this.field.notifyEditionFinish(), 50);
|
|
137
|
-
}
|
|
138
|
-
onShowInfo(detail = null) {
|
|
139
|
-
setTimeout(() => this.field.notifyEditionDetailRequest(detail), 50);
|
|
140
|
-
}
|
|
141
136
|
numberInputValidation(event) {
|
|
142
137
|
const k = event.charCode;
|
|
143
138
|
return (k > 47 && k < 58);
|
|
144
139
|
}
|
|
145
|
-
get visible() {
|
|
146
|
-
var _a;
|
|
147
|
-
return (_a = this.field) === null || _a === void 0 ? void 0 : _a.visibleOn(this.state);
|
|
148
|
-
}
|
|
149
|
-
get disabled() {
|
|
150
|
-
var _a;
|
|
151
|
-
return !((_a = this.field) === null || _a === void 0 ? void 0 : _a.enabledOn(this.state));
|
|
152
|
-
}
|
|
153
140
|
}
|
|
154
141
|
FieldComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: FieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
155
142
|
FieldComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: FieldComponent, selector: "lib-field", inputs: { field: "field", state: "state" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
@@ -3093,6 +3080,7 @@ class BasicFormComponent {
|
|
|
3093
3080
|
launchSectionActivation(code) {
|
|
3094
3081
|
var _a;
|
|
3095
3082
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3083
|
+
this.notifyFormActivity();
|
|
3096
3084
|
const sectionObject = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSection(code);
|
|
3097
3085
|
if (!sectionObject) {
|
|
3098
3086
|
return;
|
|
@@ -3109,6 +3097,7 @@ class BasicFormComponent {
|
|
|
3109
3097
|
launchSectionInactivation(code) {
|
|
3110
3098
|
var _a;
|
|
3111
3099
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3100
|
+
this.notifyFormActivity();
|
|
3112
3101
|
const sectionObject = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.getSection(code);
|
|
3113
3102
|
if (!sectionObject) {
|
|
3114
3103
|
return;
|
|
@@ -3124,6 +3113,7 @@ class BasicFormComponent {
|
|
|
3124
3113
|
}
|
|
3125
3114
|
startAction(code) {
|
|
3126
3115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3116
|
+
this.notifyFormActivity();
|
|
3127
3117
|
const actionObject = this.getAction(code);
|
|
3128
3118
|
if (!actionObject) {
|
|
3129
3119
|
return;
|
|
@@ -3223,6 +3213,7 @@ class BasicFormComponent {
|
|
|
3223
3213
|
}
|
|
3224
3214
|
startFieldInputValidation(code, intrinsicValidation = true) {
|
|
3225
3215
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3216
|
+
this.notifyFormActivity();
|
|
3226
3217
|
const fieldToValidate = this.getField(code);
|
|
3227
3218
|
if (!fieldToValidate) {
|
|
3228
3219
|
return false;
|
|
@@ -3242,6 +3233,7 @@ class BasicFormComponent {
|
|
|
3242
3233
|
}
|
|
3243
3234
|
startFieldValidation(code, intrinsicValidation = true) {
|
|
3244
3235
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3236
|
+
this.notifyFormActivity();
|
|
3245
3237
|
const fieldToValidate = this.getField(code);
|
|
3246
3238
|
if (!fieldToValidate) {
|
|
3247
3239
|
return;
|
|
@@ -3423,6 +3415,7 @@ class BasicFormComponent {
|
|
|
3423
3415
|
}
|
|
3424
3416
|
startTableGlobalAction(tableActionEvent) {
|
|
3425
3417
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3418
|
+
this.notifyFormActivity();
|
|
3426
3419
|
const { tableCode, actionCode } = tableActionEvent;
|
|
3427
3420
|
const tableObject = this.getTable(tableCode);
|
|
3428
3421
|
if (!tableObject || !actionCode) {
|
|
@@ -3510,6 +3503,7 @@ class BasicFormComponent {
|
|
|
3510
3503
|
}
|
|
3511
3504
|
startTableAction(tableActionEvent) {
|
|
3512
3505
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3506
|
+
this.notifyFormActivity();
|
|
3513
3507
|
const { tableCode, actionCode, actionDetail } = tableActionEvent;
|
|
3514
3508
|
const tableObject = this.getTable(tableCode);
|
|
3515
3509
|
if (!tableObject || !actionCode) {
|
|
@@ -3602,6 +3596,7 @@ class BasicFormComponent {
|
|
|
3602
3596
|
}
|
|
3603
3597
|
startTableRecordSelection(tableActionEvent) {
|
|
3604
3598
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3599
|
+
this.notifyFormActivity();
|
|
3605
3600
|
const { tableCode, actionDetail } = tableActionEvent;
|
|
3606
3601
|
const tableObject = this.getTable(tableCode);
|
|
3607
3602
|
if (!tableObject) {
|
|
@@ -3680,6 +3675,7 @@ class BasicFormComponent {
|
|
|
3680
3675
|
}
|
|
3681
3676
|
startTableSelectionAction(tableActionEvent) {
|
|
3682
3677
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3678
|
+
this.notifyFormActivity();
|
|
3683
3679
|
const { tableCode, actionCode, actionDetail } = tableActionEvent;
|
|
3684
3680
|
const tableObject = this.getTable(tableCode);
|
|
3685
3681
|
if (!tableObject || !actionCode) {
|
|
@@ -3767,6 +3763,7 @@ class BasicFormComponent {
|
|
|
3767
3763
|
}
|
|
3768
3764
|
startTableGetData(tableActionEvent) {
|
|
3769
3765
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3766
|
+
this.notifyFormActivity();
|
|
3770
3767
|
const { tableCode } = tableActionEvent;
|
|
3771
3768
|
const tableObject = this.getTable(tableCode);
|
|
3772
3769
|
const tableActionDetail = {
|
|
@@ -3881,6 +3878,7 @@ class BasicFormComponent {
|
|
|
3881
3878
|
}
|
|
3882
3879
|
return false;
|
|
3883
3880
|
}
|
|
3881
|
+
notifyFormActivity() { this._eventEmiter.next('formActivity', { code: this.formCode }); }
|
|
3884
3882
|
/**
|
|
3885
3883
|
* Métodos Legacy de compatibilidad hacia atrás
|
|
3886
3884
|
*/
|