tuain-ng-forms-lib 14.4.96 → 14.5.10
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/classes/forms/action.mjs +23 -4
- package/esm2020/lib/classes/forms/element.mjs +1 -9
- package/esm2020/lib/classes/forms/field.mjs +19 -28
- package/esm2020/lib/classes/forms/form.mjs +2 -2
- package/esm2020/lib/classes/forms/piece.mjs +6 -4
- package/esm2020/lib/classes/forms/section.mjs +3 -3
- package/esm2020/lib/classes/forms/table/action.mjs +28 -4
- package/esm2020/lib/classes/forms/table/table.mjs +4 -4
- package/esm2020/lib/components/elements/action.component.mjs +2 -24
- package/esm2020/lib/components/elements/layout/element.component.mjs +5 -5
- package/esm2020/lib/components/elements/layout/form-header.component.mjs +2 -9
- package/esm2020/lib/components/elements/layout/piece.component.mjs +2 -1
- package/esm2020/lib/components/elements/layout/section.component.mjs +5 -5
- package/esm2020/lib/components/elements/layout/sub-section.component.mjs +5 -5
- package/esm2020/lib/components/elements/tables/table-record-action.component.mjs +4 -2
- package/esm2020/lib/components/forms/basic-form.mjs +12 -8
- package/fesm2015/tuain-ng-forms-lib.mjs +115 -104
- package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
- package/fesm2020/tuain-ng-forms-lib.mjs +107 -101
- package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/classes/forms/action.d.ts +7 -6
- package/lib/classes/forms/element.d.ts +0 -8
- package/lib/classes/forms/field.d.ts +2 -11
- package/lib/classes/forms/piece.d.ts +3 -2
- package/lib/classes/forms/section.d.ts +1 -1
- package/lib/classes/forms/table/action.d.ts +7 -4
- package/lib/classes/forms/table/table.d.ts +1 -1
- package/lib/components/elements/action.component.d.ts +1 -6
- package/lib/components/elements/layout/element.component.d.ts +1 -2
- package/lib/components/elements/layout/form-header.component.d.ts +1 -4
- package/lib/components/elements/layout/piece.component.d.ts +2 -0
- package/lib/components/elements/layout/section.component.d.ts +1 -2
- package/lib/components/elements/layout/sub-section.component.d.ts +1 -2
- package/lib/components/forms/basic-form.d.ts +2 -2
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@ class PieceComponent {
|
|
|
15
15
|
this.disabled = false;
|
|
16
16
|
this.customAttributes = {};
|
|
17
17
|
}
|
|
18
|
+
setForm(form) { this.form = form; }
|
|
18
19
|
defaultProcessAttributeChange(attribute, value) {
|
|
19
20
|
if (!attribute || attribute.trim() === '') {
|
|
20
21
|
return false;
|
|
@@ -46,10 +47,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
46
47
|
}] });
|
|
47
48
|
|
|
48
49
|
class ElementComponent extends PieceComponent {
|
|
49
|
-
start() {
|
|
50
|
+
start() {
|
|
51
|
+
var _a;
|
|
52
|
+
this.setForm((_a = this.element) === null || _a === void 0 ? void 0 : _a._form);
|
|
53
|
+
}
|
|
50
54
|
}
|
|
51
55
|
ElementComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: ElementComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
52
|
-
ElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: ElementComponent, selector: "lib-element", inputs: { element: "element"
|
|
56
|
+
ElementComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: ElementComponent, selector: "lib-element", inputs: { element: "element" }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
53
57
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: ElementComponent, decorators: [{
|
|
54
58
|
type: Component,
|
|
55
59
|
args: [{
|
|
@@ -58,8 +62,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
58
62
|
}]
|
|
59
63
|
}], propDecorators: { element: [{
|
|
60
64
|
type: Input
|
|
61
|
-
}], form: [{
|
|
62
|
-
type: Input
|
|
63
65
|
}] } });
|
|
64
66
|
|
|
65
67
|
class ActionComponent extends ElementComponent {
|
|
@@ -67,8 +69,6 @@ class ActionComponent extends ElementComponent {
|
|
|
67
69
|
super(...arguments);
|
|
68
70
|
this.inProgress = false;
|
|
69
71
|
this.action = null;
|
|
70
|
-
this.style = 'primary';
|
|
71
|
-
this.showLabel = true;
|
|
72
72
|
}
|
|
73
73
|
ngOnInit() {
|
|
74
74
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
@@ -99,22 +99,9 @@ class ActionComponent extends ElementComponent {
|
|
|
99
99
|
this.action.notifyActivation();
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
visibleOnRestriction() {
|
|
103
|
-
var _a, _b, _c, _d, _e;
|
|
104
|
-
if (!((_a = this.action) === null || _a === void 0 ? void 0 : _a.restrictedOnField)) {
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
if ((((_b = this.action) === null || _b === void 0 ? void 0 : _b.restrictedOnOperator) === '=='
|
|
108
|
-
&& this.relatedField === ((_c = this.action) === null || _c === void 0 ? void 0 : _c.restrictedOnValue))
|
|
109
|
-
|| (((_d = this.action) === null || _d === void 0 ? void 0 : _d.restrictedOnOperator) === '!='
|
|
110
|
-
&& this.relatedField !== ((_e = this.action) === null || _e === void 0 ? void 0 : _e.restrictedOnValue))) {
|
|
111
|
-
return true;
|
|
112
|
-
}
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
102
|
}
|
|
116
103
|
ActionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: ActionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
117
|
-
ActionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: ActionComponent, selector: "lib-action", inputs: { action: "action"
|
|
104
|
+
ActionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: ActionComponent, selector: "lib-action", inputs: { action: "action" }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
118
105
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: ActionComponent, decorators: [{
|
|
119
106
|
type: Component,
|
|
120
107
|
args: [{
|
|
@@ -123,14 +110,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
123
110
|
}]
|
|
124
111
|
}], propDecorators: { action: [{
|
|
125
112
|
type: Input
|
|
126
|
-
}], busy: [{
|
|
127
|
-
type: Input
|
|
128
|
-
}], relatedField: [{
|
|
129
|
-
type: Input
|
|
130
|
-
}], style: [{
|
|
131
|
-
type: Input
|
|
132
|
-
}], showLabel: [{
|
|
133
|
-
type: Input
|
|
134
113
|
}] } });
|
|
135
114
|
|
|
136
115
|
const VALUE = 'value';
|
|
@@ -233,7 +212,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
233
212
|
|
|
234
213
|
class FormHeaderComponent {
|
|
235
214
|
constructor() {
|
|
236
|
-
this.canGoBack = false;
|
|
237
215
|
this.goBackEvent = new EventEmitter();
|
|
238
216
|
}
|
|
239
217
|
goBackForm() {
|
|
@@ -241,7 +219,7 @@ class FormHeaderComponent {
|
|
|
241
219
|
}
|
|
242
220
|
}
|
|
243
221
|
FormHeaderComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: FormHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
244
|
-
FormHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: FormHeaderComponent, selector: "lib-form-header", inputs: { form: "form"
|
|
222
|
+
FormHeaderComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: FormHeaderComponent, selector: "lib-form-header", inputs: { form: "form" }, outputs: { goBackEvent: "goBackEvent" }, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
245
223
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: FormHeaderComponent, decorators: [{
|
|
246
224
|
type: Component,
|
|
247
225
|
args: [{
|
|
@@ -250,12 +228,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
250
228
|
}]
|
|
251
229
|
}], propDecorators: { form: [{
|
|
252
230
|
type: Input
|
|
253
|
-
}], canGoBack: [{
|
|
254
|
-
type: Input
|
|
255
|
-
}], showTitle: [{
|
|
256
|
-
type: Input
|
|
257
|
-
}], headerActions: [{
|
|
258
|
-
type: Input
|
|
259
231
|
}], goBackEvent: [{
|
|
260
232
|
type: Output
|
|
261
233
|
}] } });
|
|
@@ -279,10 +251,13 @@ class SectionComponent extends PieceComponent {
|
|
|
279
251
|
});
|
|
280
252
|
this.start();
|
|
281
253
|
}
|
|
282
|
-
start() {
|
|
254
|
+
start() {
|
|
255
|
+
var _a;
|
|
256
|
+
this.setForm((_a = this.section) === null || _a === void 0 ? void 0 : _a._form);
|
|
257
|
+
}
|
|
283
258
|
}
|
|
284
259
|
SectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SectionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
285
|
-
SectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: SectionComponent, selector: "lib-section", inputs: { section: "section"
|
|
260
|
+
SectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: SectionComponent, selector: "lib-section", inputs: { section: "section" }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
286
261
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SectionComponent, decorators: [{
|
|
287
262
|
type: Component,
|
|
288
263
|
args: [{
|
|
@@ -291,8 +266,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
291
266
|
}]
|
|
292
267
|
}], propDecorators: { section: [{
|
|
293
268
|
type: Input
|
|
294
|
-
}], form: [{
|
|
295
|
-
type: Input
|
|
296
269
|
}] } });
|
|
297
270
|
|
|
298
271
|
class SubSectionComponent extends PieceComponent {
|
|
@@ -314,10 +287,13 @@ class SubSectionComponent extends PieceComponent {
|
|
|
314
287
|
});
|
|
315
288
|
this.start();
|
|
316
289
|
}
|
|
317
|
-
start() {
|
|
290
|
+
start() {
|
|
291
|
+
var _a;
|
|
292
|
+
this.setForm((_a = this.subSection) === null || _a === void 0 ? void 0 : _a._form);
|
|
293
|
+
}
|
|
318
294
|
}
|
|
319
295
|
SubSectionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SubSectionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
320
|
-
SubSectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: SubSectionComponent, selector: "lib-subsection", inputs: { subSection: "subSection"
|
|
296
|
+
SubSectionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.6", type: SubSectionComponent, selector: "lib-subsection", inputs: { subSection: "subSection" }, usesInheritance: true, ngImport: i0, template: `<ng-content></ng-content>`, isInline: true });
|
|
321
297
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImport: i0, type: SubSectionComponent, decorators: [{
|
|
322
298
|
type: Component,
|
|
323
299
|
args: [{
|
|
@@ -326,8 +302,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.6", ngImpor
|
|
|
326
302
|
}]
|
|
327
303
|
}], propDecorators: { subSection: [{
|
|
328
304
|
type: Input
|
|
329
|
-
}], form: [{
|
|
330
|
-
type: Input
|
|
331
305
|
}] } });
|
|
332
306
|
|
|
333
307
|
const INLINE_ACTION$1 = 'INLINE';
|
|
@@ -354,7 +328,10 @@ class LibTableRecordActionComponent extends PieceComponent {
|
|
|
354
328
|
});
|
|
355
329
|
this.start();
|
|
356
330
|
}
|
|
357
|
-
start() {
|
|
331
|
+
start() {
|
|
332
|
+
var _a;
|
|
333
|
+
(_a = this.action) === null || _a === void 0 ? void 0 : _a.setRecodData(this.recordData);
|
|
334
|
+
}
|
|
358
335
|
onActivate() {
|
|
359
336
|
const tableEvent = {
|
|
360
337
|
actionCode: this.action.actionCode,
|
|
@@ -534,6 +511,7 @@ class FormPiece {
|
|
|
534
511
|
this._absoluteDisabled = false;
|
|
535
512
|
this.visibleStates = null;
|
|
536
513
|
this.enabledStates = null;
|
|
514
|
+
this._form = null;
|
|
537
515
|
this._visible = true;
|
|
538
516
|
this._disabled = false;
|
|
539
517
|
this.customAttributes = {};
|
|
@@ -609,7 +587,7 @@ class FormPiece {
|
|
|
609
587
|
set disabled(disabled) { this.enabled = !disabled; }
|
|
610
588
|
enable() { this.enabled = true; }
|
|
611
589
|
disable() { this.enabled = false; }
|
|
612
|
-
formStateChangeCustomSubscribe(formChangeSubject) { }
|
|
590
|
+
formStateChangeCustomSubscribe(form, formChangeSubject) { }
|
|
613
591
|
formStateChange(state) {
|
|
614
592
|
if (state) {
|
|
615
593
|
this._formState = state;
|
|
@@ -617,8 +595,9 @@ class FormPiece {
|
|
|
617
595
|
this._disabled = this._absoluteDisabled || !this.enabledOnState(state);
|
|
618
596
|
}
|
|
619
597
|
}
|
|
620
|
-
|
|
621
|
-
this.
|
|
598
|
+
connectWithParentForm(form, formChangeSubject) {
|
|
599
|
+
this._form = form;
|
|
600
|
+
this.formStateChangeCustomSubscribe(form, formChangeSubject);
|
|
622
601
|
formChangeSubject.subscribe(event => this.formStateChange(event === null || event === void 0 ? void 0 : event.state));
|
|
623
602
|
}
|
|
624
603
|
}
|
|
@@ -674,23 +653,18 @@ class FormElement extends FormPiecePropagate {
|
|
|
674
653
|
isField() { return this.elementType === elementTypes.field; }
|
|
675
654
|
isAction() { return this.elementType === elementTypes.action; }
|
|
676
655
|
isTable() { return this.elementType === elementTypes.table; }
|
|
677
|
-
/**
|
|
678
|
-
* @deprecated Utilizar viewOnState
|
|
679
|
-
*/
|
|
680
|
-
supportState(state) { return this.viewOnState(state); }
|
|
681
|
-
/**
|
|
682
|
-
* @deprecated Utilizar viewOnState
|
|
683
|
-
*/
|
|
684
|
-
supportMode(state) { return this.viewOnState(state); }
|
|
685
656
|
}
|
|
686
657
|
|
|
687
658
|
const HEADER = 'HEADER';
|
|
688
659
|
class FormAction extends FormElement {
|
|
689
660
|
constructor(actionDefinition, formConfig) {
|
|
690
|
-
var _a, _b, _c, _d, _e;
|
|
661
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
691
662
|
super(actionDefinition, formConfig);
|
|
692
663
|
this._actionActivated = new Subject();
|
|
693
664
|
this.inProgress = false;
|
|
665
|
+
this.restrictedOnField = null;
|
|
666
|
+
this.restrictedOnOperator = null;
|
|
667
|
+
this.restrictedOnValue = null;
|
|
694
668
|
this.propagationCustomAttributes = (_c = (_b = (_a = this._formConfig) === null || _a === void 0 ? void 0 : _a.propagationCustomAttributes) === null || _b === void 0 ? void 0 : _b.actions) !== null && _c !== void 0 ? _c : [];
|
|
695
669
|
this.elementType = elementTypes.action;
|
|
696
670
|
this.actionCode = actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '';
|
|
@@ -699,11 +673,28 @@ class FormAction extends FormElement {
|
|
|
699
673
|
this.setCustomAttribute('location', actionDefinition.position || HEADER);
|
|
700
674
|
this.backend = (_d = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.serverAction) !== null && _d !== void 0 ? _d : false;
|
|
701
675
|
this.newState = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.newState;
|
|
702
|
-
this.restrictedOnField = actionDefinition.fieldRestrictedCode ?
|
|
703
|
-
this.
|
|
704
|
-
|
|
676
|
+
this.restrictedOnField = (_f = (_e = actionDefinition.fieldRestrictedCode) === null || _e === void 0 ? void 0 : _e.toString()) !== null && _f !== void 0 ? _f : null;
|
|
677
|
+
if (this.restrictedOnField) {
|
|
678
|
+
this.restrictedOnOperator = actionDefinition.operatorRestricted || '';
|
|
679
|
+
this.restrictedOnValue = (_g = actionDefinition.valueRestricted) !== null && _g !== void 0 ? _g : '';
|
|
680
|
+
}
|
|
705
681
|
this.customValidation = () => true;
|
|
706
682
|
}
|
|
683
|
+
viewOnState(state) {
|
|
684
|
+
var _a;
|
|
685
|
+
const actionVisible = (this.visibleStates && state) ? this.visibleStates.includes(state) : false;
|
|
686
|
+
if (actionVisible && this._form && this.restrictedOnField) {
|
|
687
|
+
const relatedField = (_a = this._form.fields) === null || _a === void 0 ? void 0 : _a[this.restrictedOnField];
|
|
688
|
+
if (relatedField) {
|
|
689
|
+
const fieldValue = relatedField.value;
|
|
690
|
+
if ((this.restrictedOnOperator === '==' && fieldValue !== this.restrictedOnValue)
|
|
691
|
+
|| (this.restrictedOnOperator === '!=' && fieldValue === this.restrictedOnValue)) {
|
|
692
|
+
return false;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
return actionVisible;
|
|
697
|
+
}
|
|
707
698
|
get actionActivated() { return this._actionActivated; }
|
|
708
699
|
start() { this.inProgress = true; }
|
|
709
700
|
stop() { this.inProgress = false; }
|
|
@@ -738,13 +729,13 @@ const attrs$1 = {
|
|
|
738
729
|
_defaultValue: { name: '_defaultValue', propagate: 'defaultValue' },
|
|
739
730
|
_defaultEditable: { name: '_defaultEditable', propagate: 'defaultEditable' },
|
|
740
731
|
_fieldAlignment: { name: '_fieldAlignment', propagate: 'alignment' },
|
|
741
|
-
|
|
732
|
+
fieldCode: { name: 'fieldCode', propagate: 'code' },
|
|
742
733
|
_fieldInfo: { name: '_fieldInfo', propagate: 'info' },
|
|
743
734
|
_fieldRequired: { name: '_fieldRequired', propagate: 'required' },
|
|
744
735
|
_fieldTitle: { name: '_fieldTitle', propagate: 'title' },
|
|
745
736
|
_fieldType: { name: '_fieldType', propagate: 'type' },
|
|
746
737
|
_fieldFormat: { name: '_fieldFormat', propagate: 'format' },
|
|
747
|
-
|
|
738
|
+
fieldOptions: { name: 'fieldOptions', propagate: 'options' },
|
|
748
739
|
_focus: { name: '_focus', propagate: 'focus' },
|
|
749
740
|
_hasChanged: { name: '_hasChanged', propagate: 'hasChanged' },
|
|
750
741
|
_intrinsicErrorMessage: { name: '_intrinsicErrorMessage', propagate: null },
|
|
@@ -769,7 +760,6 @@ class FieldDescriptor extends FormElement {
|
|
|
769
760
|
this._errorType = '';
|
|
770
761
|
this._errorCode = '';
|
|
771
762
|
this._errorMessage = '';
|
|
772
|
-
this._fieldCode = '';
|
|
773
763
|
this._intrinsicErrorMessage = '';
|
|
774
764
|
this._maxLength = 0;
|
|
775
765
|
this._minLength = 0;
|
|
@@ -786,15 +776,16 @@ class FieldDescriptor extends FormElement {
|
|
|
786
776
|
this._fieldTitle = '';
|
|
787
777
|
this._fieldType = '';
|
|
788
778
|
this._fieldFormat = null;
|
|
789
|
-
this._fieldOptions = null;
|
|
790
779
|
this._hasChanged = false;
|
|
791
780
|
this._outputOnly = false;
|
|
792
781
|
this._tooltipText = '';
|
|
782
|
+
this.fieldCode = '';
|
|
783
|
+
this.fieldOptions = null;
|
|
793
784
|
this.propagationCustomAttributes = (_c = (_b = (_a = this._formConfig) === null || _a === void 0 ? void 0 : _a.propagationCustomAttributes) === null || _b === void 0 ? void 0 : _b.fields) !== null && _c !== void 0 ? _c : [];
|
|
794
785
|
this.elementType = elementTypes.field;
|
|
795
786
|
const fld = (inputFieldReceived) ? inputFieldReceived : {};
|
|
796
|
-
this.setAttr(attrs$1.
|
|
797
|
-
this.title = (_d = fld.fieldTitle) !== null && _d !== void 0 ? _d : this.
|
|
787
|
+
this.setAttr(attrs$1.fieldCode, fld.fieldCode);
|
|
788
|
+
this.title = (_d = fld.fieldTitle) !== null && _d !== void 0 ? _d : this.fieldCode;
|
|
798
789
|
this.type = fld.fieldTypeCode;
|
|
799
790
|
this.captureType = (_e = fld.captureType) !== null && _e !== void 0 ? _e : DEFAULT_CAPTURE_TYPE;
|
|
800
791
|
const defaultValue = (_f = fld.defaultValue) !== null && _f !== void 0 ? _f : null;
|
|
@@ -836,8 +827,7 @@ class FieldDescriptor extends FormElement {
|
|
|
836
827
|
get backend() { return this._validateOnServer; }
|
|
837
828
|
get captureType() { return this._captureType; }
|
|
838
829
|
set captureType(captureType) { this.setAttr(attrs$1._captureType, captureType); }
|
|
839
|
-
get code() { return this.
|
|
840
|
-
get fieldCode() { return this._fieldCode; }
|
|
830
|
+
get code() { return this.fieldCode; }
|
|
841
831
|
get defaultValue() { return this._defaultValue; }
|
|
842
832
|
set defaultValue(defaultValue) { this.setAttr(attrs$1._defaultValue, defaultValue); }
|
|
843
833
|
get defaultEditable() { return this._defaultEditable; }
|
|
@@ -902,10 +892,10 @@ class FieldDescriptor extends FormElement {
|
|
|
902
892
|
}
|
|
903
893
|
this.setAttr(attrs$1._minValue, minValue);
|
|
904
894
|
}
|
|
905
|
-
get name() { return this.
|
|
895
|
+
get name() { return this.fieldCode; }
|
|
906
896
|
get options() {
|
|
907
897
|
var _a, _b;
|
|
908
|
-
return (_b = (_a = this.
|
|
898
|
+
return (_b = (_a = this.fieldOptions) === null || _a === void 0 ? void 0 : _a.map(option => {
|
|
909
899
|
const optionCopy = Object.assign({}, option);
|
|
910
900
|
return optionCopy;
|
|
911
901
|
})) !== null && _b !== void 0 ? _b : null;
|
|
@@ -926,25 +916,25 @@ class FieldDescriptor extends FormElement {
|
|
|
926
916
|
});
|
|
927
917
|
fieldOptions = (fieldOptions && Array.isArray(fieldOptions)
|
|
928
918
|
&& fieldOptions.length > 0) ? fieldOptions : [];
|
|
929
|
-
this.setAttr(attrs$1.
|
|
919
|
+
this.setAttr(attrs$1.fieldOptions, fieldOptions);
|
|
930
920
|
if (this._value) {
|
|
931
921
|
if (this._fieldType === this._formConfig.fieldTypes.array && Array.isArray(this._value)) {
|
|
932
|
-
const fieldValue = (_a = this._value) === null || _a === void 0 ? void 0 : _a.filter(item => { var _a; return (_a = this.
|
|
922
|
+
const fieldValue = (_a = this._value) === null || _a === void 0 ? void 0 : _a.filter(item => { var _a; return (_a = this.fieldOptions) === null || _a === void 0 ? void 0 : _a.find(opt => opt.fieldOptionId === item); });
|
|
933
923
|
this.setAttr(attrs$1._value, fieldValue);
|
|
934
924
|
}
|
|
935
925
|
else {
|
|
936
|
-
const valInOptions = (_b = this.
|
|
926
|
+
const valInOptions = (_b = this.fieldOptions) === null || _b === void 0 ? void 0 : _b.find(item => item.fieldOptionId === this._value);
|
|
937
927
|
if (!valInOptions) {
|
|
938
928
|
this._setValue('');
|
|
939
929
|
}
|
|
940
930
|
}
|
|
941
931
|
}
|
|
942
|
-
if (this._fieldRequired && ((_c = this.
|
|
943
|
-
this._setValue((_e = this.
|
|
932
|
+
if (this._fieldRequired && ((_c = this.fieldOptions) === null || _c === void 0 ? void 0 : _c.length) === 1 && this._value !== ((_d = this.fieldOptions) === null || _d === void 0 ? void 0 : _d[0].fieldOptionId)) {
|
|
933
|
+
this._setValue((_e = this.fieldOptions) === null || _e === void 0 ? void 0 : _e[0].fieldOptionId);
|
|
944
934
|
this.notifyEditionFinish();
|
|
945
935
|
}
|
|
946
936
|
}
|
|
947
|
-
get optionText() { var _a, _b, _c; return (_c = (_b = (_a = this.
|
|
937
|
+
get optionText() { var _a, _b, _c; return (_c = (_b = (_a = this.fieldOptions) === null || _a === void 0 ? void 0 : _a.find(item => item.fieldOptionId === this._value)) === null || _b === void 0 ? void 0 : _b.fieldOptionValue) !== null && _c !== void 0 ? _c : null; }
|
|
948
938
|
get outputOnly() { return this._outputOnly; }
|
|
949
939
|
set outputOnly(outputOnly) { this.setAttr(attrs$1._outputOnly, outputOnly); }
|
|
950
940
|
get required() { return this._fieldRequired; }
|
|
@@ -968,14 +958,6 @@ class FieldDescriptor extends FormElement {
|
|
|
968
958
|
set value(newValue) { this._setValue(newValue); }
|
|
969
959
|
get visibleLabel() { return this._visibleLabel; }
|
|
970
960
|
set visibleLabel(visibleLabel) { this.setAttr(attrs$1._visibleLabel, visibleLabel); }
|
|
971
|
-
/**
|
|
972
|
-
* @deprecated Use options
|
|
973
|
-
*/
|
|
974
|
-
get fieldOptions() { return this._fieldOptions; }
|
|
975
|
-
/**
|
|
976
|
-
* @deprecated Use options
|
|
977
|
-
*/
|
|
978
|
-
set fieldOptions(options) { this.options = options; }
|
|
979
961
|
/**
|
|
980
962
|
* @deprecated Use value
|
|
981
963
|
*/
|
|
@@ -1051,7 +1033,7 @@ class FieldDescriptor extends FormElement {
|
|
|
1051
1033
|
setVisibleLabel(visibleLabel) { this.visibleLabel = visibleLabel; }
|
|
1052
1034
|
notifyEditionPartial() {
|
|
1053
1035
|
this.resetError();
|
|
1054
|
-
this._editionPartial.next({ code: this.
|
|
1036
|
+
this._editionPartial.next({ code: this.fieldCode, intrinsicValidation: true });
|
|
1055
1037
|
}
|
|
1056
1038
|
notifyEditionFinish() {
|
|
1057
1039
|
var _a, _b, _c, _d, _e;
|
|
@@ -1088,10 +1070,10 @@ class FieldDescriptor extends FormElement {
|
|
|
1088
1070
|
intrinsicValidation = false;
|
|
1089
1071
|
this.setError('99', `Longitud de ${this._fieldTitle} debe ser de al menos ${this._minLength}`);
|
|
1090
1072
|
}
|
|
1091
|
-
this._editionFinish.next({ code: this.
|
|
1073
|
+
this._editionFinish.next({ code: this.fieldCode, intrinsicValidation });
|
|
1092
1074
|
}
|
|
1093
1075
|
notifyEditionDetailRequest(detail) {
|
|
1094
|
-
const detailEvent = { code: this.
|
|
1076
|
+
const detailEvent = { code: this.fieldCode, detail };
|
|
1095
1077
|
this._detailRequest.next(detailEvent);
|
|
1096
1078
|
}
|
|
1097
1079
|
setError(code, message, type = DEFAULT_ERROR_TYPE) {
|
|
@@ -1242,8 +1224,11 @@ class RecordTableColumn extends FormPiece {
|
|
|
1242
1224
|
|
|
1243
1225
|
class TableAction extends FormPiece {
|
|
1244
1226
|
constructor(actionDefinition, formConfig) {
|
|
1245
|
-
var _a, _b;
|
|
1227
|
+
var _a, _b, _c;
|
|
1246
1228
|
super(actionDefinition, formConfig);
|
|
1229
|
+
this.restrictedOnField = null;
|
|
1230
|
+
this.restrictedOnValue = null;
|
|
1231
|
+
this.restrictedOnOperator = null;
|
|
1247
1232
|
this.actionCode = actionDefinition.actionCode;
|
|
1248
1233
|
this.actionTitle = actionDefinition.actionTitle;
|
|
1249
1234
|
this.iconName = actionDefinition.iconName || this.actionCode;
|
|
@@ -1252,9 +1237,31 @@ class TableAction extends FormPiece {
|
|
|
1252
1237
|
this.newState = actionDefinition.newState;
|
|
1253
1238
|
this.stateField = actionDefinition.stateField || '';
|
|
1254
1239
|
this.backend = (_a = actionDefinition === null || actionDefinition === void 0 ? void 0 : actionDefinition.serverAction) !== null && _a !== void 0 ? _a : false;
|
|
1255
|
-
this.restrictedOnField = actionDefinition.fieldRestrictedCode
|
|
1256
|
-
|
|
1257
|
-
|
|
1240
|
+
this.restrictedOnField = (_b = actionDefinition.fieldRestrictedCode) !== null && _b !== void 0 ? _b : null;
|
|
1241
|
+
if (this.restrictedOnField) {
|
|
1242
|
+
this.restrictedOnValue = (_c = actionDefinition.valueRestricted) !== null && _c !== void 0 ? _c : null;
|
|
1243
|
+
this.restrictedOnOperator = actionDefinition.operatorRestricted || null;
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
viewOnState(state) {
|
|
1247
|
+
var _a;
|
|
1248
|
+
const actionVisible = (this.visibleStates && state) ? this.visibleStates.includes(state) : false;
|
|
1249
|
+
if (actionVisible && this._form && this.restrictedOnField) {
|
|
1250
|
+
// Aqui se debe cambiar el campo por la columna del registro!!!!!
|
|
1251
|
+
// const relatedField = this._form.fields?.[this.restrictedOnField];
|
|
1252
|
+
const relatedField = (_a = this.recordData) === null || _a === void 0 ? void 0 : _a[this.restrictedOnField];
|
|
1253
|
+
if (relatedField) {
|
|
1254
|
+
const fieldValue = relatedField.value;
|
|
1255
|
+
if ((this.restrictedOnOperator === '==' && fieldValue !== this.restrictedOnValue)
|
|
1256
|
+
|| (this.restrictedOnOperator === '!=' && fieldValue === this.restrictedOnValue)) {
|
|
1257
|
+
return false;
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
return actionVisible;
|
|
1262
|
+
}
|
|
1263
|
+
setRecodData(recordData) {
|
|
1264
|
+
this.recordData = recordData;
|
|
1258
1265
|
}
|
|
1259
1266
|
}
|
|
1260
1267
|
|
|
@@ -1774,13 +1781,13 @@ class RecordTable extends FormElement {
|
|
|
1774
1781
|
}
|
|
1775
1782
|
return direction === TABLE_SORT_ASCENDING ? result : -result;
|
|
1776
1783
|
}
|
|
1777
|
-
formStateChangeCustomSubscribe(formChangeSubject) {
|
|
1784
|
+
formStateChangeCustomSubscribe(form, formChangeSubject) {
|
|
1778
1785
|
var _a, _b;
|
|
1779
1786
|
(_a = this.columns) === null || _a === void 0 ? void 0 : _a.forEach(column => {
|
|
1780
|
-
column === null || column === void 0 ? void 0 : column.
|
|
1787
|
+
column === null || column === void 0 ? void 0 : column.connectWithParentForm(form, formChangeSubject);
|
|
1781
1788
|
});
|
|
1782
1789
|
(_b = this._actions) === null || _b === void 0 ? void 0 : _b.forEach(action => {
|
|
1783
|
-
action === null || action === void 0 ? void 0 : action.
|
|
1790
|
+
action === null || action === void 0 ? void 0 : action.connectWithParentForm(form, formChangeSubject);
|
|
1784
1791
|
});
|
|
1785
1792
|
}
|
|
1786
1793
|
}
|
|
@@ -1997,10 +2004,10 @@ class RecordFormSection extends FormPiecePropagate {
|
|
|
1997
2004
|
}
|
|
1998
2005
|
return null;
|
|
1999
2006
|
}
|
|
2000
|
-
formStateChangeCustomSubscribe(formChangeSubject) {
|
|
2007
|
+
formStateChangeCustomSubscribe(form, formChangeSubject) {
|
|
2001
2008
|
var _a;
|
|
2002
2009
|
(_a = this.subSections) === null || _a === void 0 ? void 0 : _a.forEach(subsection => {
|
|
2003
|
-
subsection === null || subsection === void 0 ? void 0 : subsection.
|
|
2010
|
+
subsection === null || subsection === void 0 ? void 0 : subsection.connectWithParentForm(form, formChangeSubject);
|
|
2004
2011
|
});
|
|
2005
2012
|
}
|
|
2006
2013
|
}
|
|
@@ -2291,7 +2298,7 @@ class FormStructureAndData {
|
|
|
2291
2298
|
return this.getFieldSet(fld => (fld === null || fld === void 0 ? void 0 : fld.required) && (fld === null || fld === void 0 ? void 0 : fld.empty), codes !== null && codes !== void 0 ? codes : null, secCode, subCode);
|
|
2292
2299
|
}
|
|
2293
2300
|
getChangedFields(codes, secCode, subCode) {
|
|
2294
|
-
return this.getFieldSet(fld => !(fld === null || fld === void 0 ? void 0 : fld.outputOnly) && (fld === null || fld === void 0 ? void 0 : fld.hasChanged
|
|
2301
|
+
return this.getFieldSet(fld => !(fld === null || fld === void 0 ? void 0 : fld.outputOnly) && (fld === null || fld === void 0 ? void 0 : fld.hasChanged), codes !== null && codes !== void 0 ? codes : null, secCode, subCode);
|
|
2295
2302
|
}
|
|
2296
2303
|
getFieldsWithValidationIssues(codes, secCode, subCode) {
|
|
2297
2304
|
return this.getFieldSet(fld => fld === null || fld === void 0 ? void 0 : fld.hasError(), codes !== null && codes !== void 0 ? codes : null, secCode, subCode);
|
|
@@ -2891,11 +2898,11 @@ class BasicFormComponent {
|
|
|
2891
2898
|
this.onTableServerError(() => this.displayTableServerError());
|
|
2892
2899
|
}
|
|
2893
2900
|
get formVisible() { return this.visible; }
|
|
2894
|
-
get
|
|
2901
|
+
get form() { return this; }
|
|
2895
2902
|
get formCode() { var _a; return (_a = this.name) !== null && _a !== void 0 ? _a : ''; }
|
|
2896
2903
|
set formCode(name) { this.name = name; }
|
|
2897
2904
|
get inServerProcess() { return this.busy; }
|
|
2898
|
-
get
|
|
2905
|
+
get formStructure() { return this._formStructure; }
|
|
2899
2906
|
get state() { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.state) !== null && _b !== void 0 ? _b : null; }
|
|
2900
2907
|
get currentState() { var _a, _b; return (_b = (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.state) !== null && _b !== void 0 ? _b : ''; }
|
|
2901
2908
|
set currentState(state) { this === null || this === void 0 ? void 0 : this.changeState(state); }
|
|
@@ -3023,7 +3030,7 @@ class BasicFormComponent {
|
|
|
3023
3030
|
section.activation.subscribe((code) => this.launchSectionActivation(code));
|
|
3024
3031
|
section.inactivation.subscribe((code) => this.launchSectionInactivation(code));
|
|
3025
3032
|
// Adicionalmente se le pide a la sección se subscriba al cambio de estado del formulario
|
|
3026
|
-
section.
|
|
3033
|
+
section.connectWithParentForm(this, (_b = this._formStructure) === null || _b === void 0 ? void 0 : _b.stateChange);
|
|
3027
3034
|
}
|
|
3028
3035
|
}
|
|
3029
3036
|
subscribeFieldsSubjects() {
|
|
@@ -3042,7 +3049,7 @@ class BasicFormComponent {
|
|
|
3042
3049
|
});
|
|
3043
3050
|
field.detailRequest.subscribe(event => this.showFieldInfo(event.code, event.detail));
|
|
3044
3051
|
// Adicionalmente se le pide al campo se subscriba al cambio de estado del formulario
|
|
3045
|
-
field.
|
|
3052
|
+
field.connectWithParentForm(this, (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.stateChange);
|
|
3046
3053
|
});
|
|
3047
3054
|
}
|
|
3048
3055
|
}
|
|
@@ -3054,7 +3061,7 @@ class BasicFormComponent {
|
|
|
3054
3061
|
var _a;
|
|
3055
3062
|
action.actionActivated.subscribe(code => this.startAction(code));
|
|
3056
3063
|
// Adicionalmente se le pide a la acción se subscriba al cambio de estado del formulario
|
|
3057
|
-
action.
|
|
3064
|
+
action.connectWithParentForm(this, (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.stateChange);
|
|
3058
3065
|
});
|
|
3059
3066
|
}
|
|
3060
3067
|
}
|
|
@@ -3070,7 +3077,7 @@ class BasicFormComponent {
|
|
|
3070
3077
|
table.selectionActionTrigger.subscribe(event => this.startTableSelectionAction(event));
|
|
3071
3078
|
table.getDataTrigger.subscribe(event => this.startTableGetData(event));
|
|
3072
3079
|
// Adicionalmente se le pide a la tabla se subscriba al cambio de estado del formulario
|
|
3073
|
-
table.
|
|
3080
|
+
table.connectWithParentForm(this, (_a = this._formStructure) === null || _a === void 0 ? void 0 : _a.stateChange);
|
|
3074
3081
|
});
|
|
3075
3082
|
}
|
|
3076
3083
|
}
|
|
@@ -4111,7 +4118,11 @@ class BasicFormComponent {
|
|
|
4111
4118
|
for (const columnName of columnNames) {
|
|
4112
4119
|
const columnValue = (_a = tableRecord.getFieldValue(columnName)) !== null && _a !== void 0 ? _a : '';
|
|
4113
4120
|
const code = (_b = mappingTable === null || mappingTable === void 0 ? void 0 : mappingTable[columnName]) !== null && _b !== void 0 ? _b : columnName;
|
|
4114
|
-
this.
|
|
4121
|
+
const field = code ? this.getField(code) : null;
|
|
4122
|
+
if (field) {
|
|
4123
|
+
field.setValue(columnValue);
|
|
4124
|
+
field.hasChanged = false;
|
|
4125
|
+
}
|
|
4115
4126
|
}
|
|
4116
4127
|
return true;
|
|
4117
4128
|
}
|