tuain-ng-forms-lib 0.12.0 → 0.12.4
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 +442 -598
- package/bundles/tuain-ng-forms-lib.umd.js.map +1 -1
- package/esm2015/lib/components/elements/action.component.js +44 -0
- package/esm2015/lib/components/elements/field.component.js +38 -0
- package/esm2015/lib/components/elements/layout/form-header.component.js +1 -7
- package/esm2015/lib/components/elements/tables/table-record-action.component.js +3 -18
- package/esm2015/lib/components/forms/basic-form.js +52 -44
- package/esm2015/lib/services/event-manager.service.js +18 -0
- package/esm2015/lib/services/file-manager.service.js +6 -0
- package/esm2015/lib/services/form-manager.service.js +68 -0
- package/esm2015/lib/tuain-ng-forms-lib.module.js +3 -5
- package/esm2015/public-api.js +6 -7
- package/fesm2015/tuain-ng-forms-lib.js +126 -279
- package/fesm2015/tuain-ng-forms-lib.js.map +1 -1
- package/lib/components/elements/{actions/action.component.d.ts → action.component.d.ts} +0 -4
- package/lib/components/elements/{fields/field.component.d.ts → field.component.d.ts} +1 -1
- package/lib/components/elements/layout/form-header.component.d.ts +2 -5
- package/lib/components/elements/tables/table-record-action.component.d.ts +1 -4
- package/lib/components/forms/basic-form.d.ts +15 -6
- package/lib/services/event-manager.service.d.ts +9 -0
- package/lib/services/{file-manager.servicer.d.ts → file-manager.service.d.ts} +0 -0
- package/lib/services/form-manager.service.d.ts +21 -0
- package/package.json +1 -1
- package/public-api.d.ts +5 -6
- package/tuain-ng-forms-lib.metadata.json +1 -1
- package/esm2015/lib/components/elements/actions/action.component.js +0 -53
- package/esm2015/lib/components/elements/fields/field.component.js +0 -38
- package/esm2015/lib/components/elements/fields/password.component.js +0 -18
- package/esm2015/lib/services/file-manager.servicer.js +0 -6
- package/esm2015/lib/services/form-manager.servicer.js +0 -39
- package/esm2015/lib/services/icon-dictionary.service.js +0 -161
- package/lib/components/elements/fields/password.component.d.ts +0 -6
- package/lib/services/form-manager.servicer.d.ts +0 -12
- package/lib/services/icon-dictionary.service.d.ts +0 -157
|
@@ -1,175 +1,13 @@
|
|
|
1
1
|
import { Component, Input, EventEmitter, Output, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
|
2
|
-
import { Subject } from 'rxjs';
|
|
2
|
+
import { Subject, BehaviorSubject } from 'rxjs';
|
|
3
3
|
import { __awaiter } from 'tslib';
|
|
4
|
-
import {
|
|
4
|
+
import { nanoid } from 'nanoid';
|
|
5
5
|
import { CommonModule } from '@angular/common';
|
|
6
6
|
import { RouterModule } from '@angular/router';
|
|
7
7
|
import { FormsModule } from '@angular/forms';
|
|
8
8
|
|
|
9
|
-
const iconDictionary = {
|
|
10
|
-
SELECT: 'icmn-pushpin',
|
|
11
|
-
selectHolder: 'icmn-user-check',
|
|
12
|
-
validateAML: 'icmn-warning',
|
|
13
|
-
NEW: 'icmn-file-empty',
|
|
14
|
-
'FORM-CREATE': 'icmn-file-empty',
|
|
15
|
-
'FORM-EDIT': 'icmn-pencil2',
|
|
16
|
-
'FORM-VIEW': 'icmn-file-text2',
|
|
17
|
-
SHIELD: 'fa fa-shield',
|
|
18
|
-
LOGIN: 'fa fa-sign-in',
|
|
19
|
-
LOGOUT: 'fa fa-sign-out',
|
|
20
|
-
VIEW: 'icmn-eye',
|
|
21
|
-
EDIT: 'icmn-pencil',
|
|
22
|
-
DETAIL: 'icmn-binoculars',
|
|
23
|
-
DELETE: 'icmn-bin',
|
|
24
|
-
SERVERPROCESS: 'icmn-cloud-check',
|
|
25
|
-
DEFAULT: 'icmn-home',
|
|
26
|
-
HOME: 'icmn-home',
|
|
27
|
-
IMAGE: 'icmn-image',
|
|
28
|
-
PICTURE: 'icmn-camera',
|
|
29
|
-
TEXT: 'icmn-file-text',
|
|
30
|
-
MOVEUP: 'icmn-arrow-up',
|
|
31
|
-
MOVEDOWN: 'icmn-arrow-down',
|
|
32
|
-
NEWAFFILIATION: 'icmn-profile',
|
|
33
|
-
AUTONEWAFFILIATION: 'icmn-profile',
|
|
34
|
-
PROFILE: 'icmn-profile',
|
|
35
|
-
ZIPFILE: 'icmn-file-zip',
|
|
36
|
-
COPY: 'icmn-copy',
|
|
37
|
-
FOLDER: 'icmn-folder-open',
|
|
38
|
-
TAGS: 'icmn-price-tags',
|
|
39
|
-
BARCODE: 'icmn-barcode',
|
|
40
|
-
BARCODE2: 'fa fa-barcode',
|
|
41
|
-
KEYBOARD: 'fa fa-keyboard-o',
|
|
42
|
-
CART: 'icmn-cart',
|
|
43
|
-
CAMARACOMERCIO: 'icmn-book',
|
|
44
|
-
SARLAFT: 'icmn-binoculars',
|
|
45
|
-
SCREENING: 'icmn-user-check',
|
|
46
|
-
ENTITY: 'icmn-library',
|
|
47
|
-
COIN: 'icmn-coin-dollar',
|
|
48
|
-
CREDITCARD: 'icmn-credit-card',
|
|
49
|
-
CONTACTS: 'icmn-address-book',
|
|
50
|
-
LOCATION: 'icmn-location',
|
|
51
|
-
CODES: 'icmn-file-text',
|
|
52
|
-
BPMCODES: 'icmn-file-text2',
|
|
53
|
-
MAIL: 'icmn-envelop',
|
|
54
|
-
MAP: 'icmn-map',
|
|
55
|
-
WARNING: 'icmn-warning',
|
|
56
|
-
NOTIFICATION: 'icmn-notification',
|
|
57
|
-
QUESTION: 'icmn-question',
|
|
58
|
-
INFO: 'icmn-info',
|
|
59
|
-
SAVE: 'icmn-floppy-disk',
|
|
60
|
-
INBOXFULL: 'icmn-drawer',
|
|
61
|
-
INBOXEMPTY: 'icmn-drawer2',
|
|
62
|
-
DATABASE: 'icmn-database',
|
|
63
|
-
UNDO: 'icmn-undo2',
|
|
64
|
-
REDO: 'icmn-redo2',
|
|
65
|
-
CHAT: 'icmn-bubbles4',
|
|
66
|
-
BRIEFCASE: 'icmn-briefcase',
|
|
67
|
-
USER: 'icmn-user',
|
|
68
|
-
ADDUSER: 'icmn-user-plus',
|
|
69
|
-
REMOVEUSER: 'icmn-user-minus',
|
|
70
|
-
SPINNER: 'icmn-spiiner3',
|
|
71
|
-
SEARCH: 'icmn-search',
|
|
72
|
-
ZOOMIN: 'icmn-zoom-in',
|
|
73
|
-
ZOOMOUT: 'icmn-zoom-out',
|
|
74
|
-
KEY: 'icmn-key',
|
|
75
|
-
LOCK: 'icmn-lock',
|
|
76
|
-
lockDoc: 'icmn-lock',
|
|
77
|
-
UNLOCK: 'icmn-unlocked',
|
|
78
|
-
CONFIG: 'icmn-wrench',
|
|
79
|
-
TUNE: 'icmn-equalizer',
|
|
80
|
-
GEAR: 'icmn-cog',
|
|
81
|
-
ADMIN: 'fa fa-cogs',
|
|
82
|
-
LIST: 'icmn-list',
|
|
83
|
-
FORMRECORD: 'icmn-insert-template',
|
|
84
|
-
PIE: 'icmn-pie-chart',
|
|
85
|
-
GRAPH: 'icmn-stats-dots',
|
|
86
|
-
TROPHY: 'icmn-trophy',
|
|
87
|
-
GIFT: 'icmn-gift',
|
|
88
|
-
GAUGE: 'icmn-meter',
|
|
89
|
-
FIRE: 'icmn-fire',
|
|
90
|
-
LAB: 'icmn-lab',
|
|
91
|
-
DELIVER: 'icmn-truck',
|
|
92
|
-
MOBILE: 'icmn-mobile',
|
|
93
|
-
MOBILE2: 'icmn-mobile',
|
|
94
|
-
RECHARGE: 'icmn-power-cord',
|
|
95
|
-
TREE: 'icmn-tree',
|
|
96
|
-
EARTH: 'icmn-earth',
|
|
97
|
-
TARGET: 'icmn-target',
|
|
98
|
-
POWER: 'icmn-switch',
|
|
99
|
-
VERIFY: 'icmn-clipboard',
|
|
100
|
-
UPLOAD: 'icmn-cloud-upload',
|
|
101
|
-
DOWNLOAD: 'icmn-cloud-download',
|
|
102
|
-
DOWNLOADSET: 'icmn-cloud-download',
|
|
103
|
-
LINK: 'icmn-link',
|
|
104
|
-
ATACH: 'icmn-atachment',
|
|
105
|
-
EYE: 'icmn-eye',
|
|
106
|
-
NOEYE: 'icmn-eye-blocked',
|
|
107
|
-
BOOKMARK: 'icmn-bookmark',
|
|
108
|
-
STAR: 'icmn-star-full',
|
|
109
|
-
HEART: 'icmn-heart',
|
|
110
|
-
HEARTBROKEN: 'icmn-heart-broken',
|
|
111
|
-
HAPPY: 'icmn-happy',
|
|
112
|
-
SAD: 'icmn-sad',
|
|
113
|
-
ACTIVATE: 'icmn-checkmark',
|
|
114
|
-
INACTIVATE: 'icmn-cross',
|
|
115
|
-
APPROVE: 'icmn-checkmark',
|
|
116
|
-
REJECT: 'icmn-cross',
|
|
117
|
-
CANCEL: 'icmn-cross',
|
|
118
|
-
CLOSE: 'icmn-ungroup',
|
|
119
|
-
CLEAN: 'fa fa-eraser',
|
|
120
|
-
CHECK: 'icmn-checkmark',
|
|
121
|
-
UNCHECK: 'icmn-cross',
|
|
122
|
-
SELECTROW: 'icmn-checkbox-unchecked',
|
|
123
|
-
UNSELECTROW: 'icmn-checkbox-checked',
|
|
124
|
-
CHECKED: 'icmn-checkbox-checked',
|
|
125
|
-
UNCHECKED: 'icmn-checkbox-unchecked',
|
|
126
|
-
ENTER: 'icmn-enter',
|
|
127
|
-
EXIT: 'icmn-exit',
|
|
128
|
-
CUT: 'icmn-scissors',
|
|
129
|
-
FILTER: 'icmn-filter',
|
|
130
|
-
PLAY: 'icmn-play2',
|
|
131
|
-
STOP: 'icmn-stop',
|
|
132
|
-
UP: 'icmn-circle-up',
|
|
133
|
-
DOWN: 'icmn-circle-down',
|
|
134
|
-
RIGHT: 'icmn-circle-right',
|
|
135
|
-
LEFT: 'icmn-circle-left',
|
|
136
|
-
SORTASC: 'icmn-sort-alpha-asc',
|
|
137
|
-
SORTDSC: 'icmn-sort-alpha-desc',
|
|
138
|
-
TABLE: 'icmn-table',
|
|
139
|
-
OFFICE: 'icmn-office',
|
|
140
|
-
SHARE: 'icmn-share',
|
|
141
|
-
FACEBOOK: 'icmn-facebook',
|
|
142
|
-
WHATSAPP: 'icmn-whatsapp',
|
|
143
|
-
TWITTER: 'icmn-twitter',
|
|
144
|
-
YOUTUBE: 'icmn-youtube',
|
|
145
|
-
PDF: 'icmn-file-pdf',
|
|
146
|
-
EXCEL: 'icmn-file-excel',
|
|
147
|
-
HOLDER: 'icmn-profile',
|
|
148
|
-
XXX: 'fa fa-first-order',
|
|
149
|
-
BANK: 'fa fa-bank',
|
|
150
|
-
CREDITCARD2: 'fa fa-credit-card-alt',
|
|
151
|
-
BUS: 'fa fa-bus',
|
|
152
|
-
TELEVISION: 'icmn-tv',
|
|
153
|
-
BACK: 'fa fa-arrow-left',
|
|
154
|
-
SEND: 'fa fa-paper-plane-o',
|
|
155
|
-
TEXTFILE: 'fa fa-file-text-o',
|
|
156
|
-
PERSON: 'fa fa-user',
|
|
157
|
-
BATCHFILE: 'fa fa-wpforms',
|
|
158
|
-
REQUESTS: 'icmn-stack',
|
|
159
|
-
THUMBUP: 'fa fa-thumbs-o-up',
|
|
160
|
-
THUMBDOWN: 'fa fa-thumbs-o-down',
|
|
161
|
-
EXCLAMATION: 'fa fa-exclamation-circle',
|
|
162
|
-
};
|
|
163
|
-
class IconDictionaryService {
|
|
164
|
-
constructor() {
|
|
165
|
-
this.mapIcon = (iconName) => (iconName && iconDictionary[iconName])
|
|
166
|
-
? iconDictionary[iconName] : iconDictionary.DEFAULT;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
9
|
class ActionComponent {
|
|
171
|
-
constructor(
|
|
172
|
-
this._iconDictionary = _iconDictionary;
|
|
10
|
+
constructor() {
|
|
173
11
|
this.style = 'primary';
|
|
174
12
|
this.showLabel = true;
|
|
175
13
|
}
|
|
@@ -183,10 +21,6 @@ class ActionComponent {
|
|
|
183
21
|
this.actionObject.notifyActivation();
|
|
184
22
|
}
|
|
185
23
|
}
|
|
186
|
-
icon() {
|
|
187
|
-
var _a;
|
|
188
|
-
return this._iconDictionary.mapIcon((_a = this.actionObject) === null || _a === void 0 ? void 0 : _a.iconName);
|
|
189
|
-
}
|
|
190
24
|
get isVisible() {
|
|
191
25
|
var _a, _b, _c, _d, _e;
|
|
192
26
|
if (!((_a = this.actionObject) === null || _a === void 0 ? void 0 : _a.restrictedOnField)) {
|
|
@@ -206,9 +40,6 @@ ActionComponent.decorators = [
|
|
|
206
40
|
template: `<ng-content></ng-content>`
|
|
207
41
|
},] }
|
|
208
42
|
];
|
|
209
|
-
ActionComponent.ctorParameters = () => [
|
|
210
|
-
{ type: IconDictionaryService }
|
|
211
|
-
];
|
|
212
43
|
ActionComponent.propDecorators = {
|
|
213
44
|
actionObject: [{ type: Input }],
|
|
214
45
|
disabled: [{ type: Input }],
|
|
@@ -348,22 +179,6 @@ FieldComponent.propDecorators = {
|
|
|
348
179
|
disabled: [{ type: Input }]
|
|
349
180
|
};
|
|
350
181
|
|
|
351
|
-
class PasswordComponent extends FieldComponent {
|
|
352
|
-
constructor() {
|
|
353
|
-
super(...arguments);
|
|
354
|
-
this.inputType = 'password';
|
|
355
|
-
}
|
|
356
|
-
togglePwdView() {
|
|
357
|
-
this.inputType = (this.inputType === 'password') ? 'text' : 'password';
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
PasswordComponent.decorators = [
|
|
361
|
-
{ type: Component, args: [{
|
|
362
|
-
selector: 'lib-password',
|
|
363
|
-
template: `<ng-content></ng-content>`
|
|
364
|
-
},] }
|
|
365
|
-
];
|
|
366
|
-
|
|
367
182
|
class ElementComponent {
|
|
368
183
|
constructor() {
|
|
369
184
|
this.componentConstants = Object.assign({}, componentConstants);
|
|
@@ -416,11 +231,6 @@ class FormHeaderComponent {
|
|
|
416
231
|
goBackForm() {
|
|
417
232
|
this.goBackEvent.emit();
|
|
418
233
|
}
|
|
419
|
-
ngOnInit() {
|
|
420
|
-
var _a, _b;
|
|
421
|
-
this.navigation = ((_b = (_a = this.formManager) === null || _a === void 0 ? void 0 : _a.formManagerService) === null || _b === void 0 ? void 0 : _b.pageStack)
|
|
422
|
-
? Object.keys(this.formManager.formManagerService.pageStack) : null;
|
|
423
|
-
}
|
|
424
234
|
}
|
|
425
235
|
FormHeaderComponent.decorators = [
|
|
426
236
|
{ type: Component, args: [{
|
|
@@ -430,7 +240,6 @@ FormHeaderComponent.decorators = [
|
|
|
430
240
|
];
|
|
431
241
|
FormHeaderComponent.propDecorators = {
|
|
432
242
|
formManager: [{ type: Input }],
|
|
433
|
-
icon: [{ type: Input }],
|
|
434
243
|
goBackAction: [{ type: Input }],
|
|
435
244
|
showTitle: [{ type: Input }],
|
|
436
245
|
headerActions: [{ type: Input }],
|
|
@@ -1173,8 +982,7 @@ LibTableFilterComponent.propDecorators = {
|
|
|
1173
982
|
|
|
1174
983
|
const INLINE_ACTION$1 = 'INLINE';
|
|
1175
984
|
class LibTableRecordActionComponent {
|
|
1176
|
-
constructor(
|
|
1177
|
-
this._iconDictionary = _iconDictionary;
|
|
985
|
+
constructor() {
|
|
1178
986
|
this.actionSelected = new EventEmitter();
|
|
1179
987
|
}
|
|
1180
988
|
ngOnInit() {
|
|
@@ -1189,17 +997,6 @@ class LibTableRecordActionComponent {
|
|
|
1189
997
|
};
|
|
1190
998
|
this.actionSelected.emit(tableEvent);
|
|
1191
999
|
}
|
|
1192
|
-
icon() {
|
|
1193
|
-
if (this.action.actionType === 'CHECK') {
|
|
1194
|
-
return this._iconDictionary.mapIcon('SELECTROW');
|
|
1195
|
-
}
|
|
1196
|
-
else if (this.action.actionType === 'UNCHECK') {
|
|
1197
|
-
return this._iconDictionary.mapIcon('UNSELECTROW');
|
|
1198
|
-
}
|
|
1199
|
-
else {
|
|
1200
|
-
return this._iconDictionary.mapIcon(this.action.iconName);
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
1000
|
class() { }
|
|
1204
1001
|
}
|
|
1205
1002
|
LibTableRecordActionComponent.decorators = [
|
|
@@ -1209,9 +1006,7 @@ LibTableRecordActionComponent.decorators = [
|
|
|
1209
1006
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
1210
1007
|
},] }
|
|
1211
1008
|
];
|
|
1212
|
-
LibTableRecordActionComponent.ctorParameters = () => [
|
|
1213
|
-
{ type: IconDictionaryService }
|
|
1214
|
-
];
|
|
1009
|
+
LibTableRecordActionComponent.ctorParameters = () => [];
|
|
1215
1010
|
LibTableRecordActionComponent.propDecorators = {
|
|
1216
1011
|
recordId: [{ type: Input }],
|
|
1217
1012
|
recordData: [{ type: Input }],
|
|
@@ -2365,40 +2160,86 @@ class FormStructureAndData {
|
|
|
2365
2160
|
|
|
2366
2161
|
class LibFormManagerService {
|
|
2367
2162
|
constructor() {
|
|
2368
|
-
this.
|
|
2163
|
+
this.cleanStack();
|
|
2369
2164
|
}
|
|
2370
|
-
|
|
2371
|
-
|
|
2165
|
+
/**
|
|
2166
|
+
* Métodos virtuales de manejo de formularios
|
|
2167
|
+
*/
|
|
2168
|
+
getFormDefinition(formCode) { }
|
|
2169
|
+
execServerAction(actionDetail) { }
|
|
2170
|
+
goToRoute(navigationArray) { }
|
|
2171
|
+
/**
|
|
2172
|
+
* Manejo del stack de navegación con atributos estados y parámetros
|
|
2173
|
+
*/
|
|
2174
|
+
resetPageStack() { this.cleanStack(); }
|
|
2175
|
+
cleanStack() {
|
|
2176
|
+
this.pageStack = [];
|
|
2177
|
+
}
|
|
2178
|
+
stack(data) {
|
|
2179
|
+
const id = nanoid(6);
|
|
2180
|
+
this.pageStack.push({ id, data });
|
|
2181
|
+
return id;
|
|
2182
|
+
}
|
|
2183
|
+
unstack(id) {
|
|
2184
|
+
const stackIdx = this.pageStack.findIndex(item => item.id === id);
|
|
2185
|
+
if (stackIdx >= 0) {
|
|
2186
|
+
const formData = this.pageStack[stackIdx].data;
|
|
2187
|
+
// Se eliminan los formularios posteriores al solicitado
|
|
2188
|
+
this.pageStack.splice(stackIdx + 1);
|
|
2189
|
+
return formData;
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
getInputData(id) {
|
|
2193
|
+
const stackIdx = (id) ? this.pageStack.findIndex(item => item.id === id) : -1;
|
|
2194
|
+
if (stackIdx >= 0) {
|
|
2195
|
+
const { target: { predefinedFields } } = this.pageStack[stackIdx].data;
|
|
2196
|
+
return predefinedFields;
|
|
2197
|
+
}
|
|
2198
|
+
return null;
|
|
2372
2199
|
}
|
|
2373
|
-
|
|
2374
|
-
|
|
2200
|
+
getOriginInfo(id) {
|
|
2201
|
+
const stackIdx = (id) ? this.pageStack.findIndex(item => item.id === id) : -1;
|
|
2202
|
+
if (stackIdx >= 0) {
|
|
2203
|
+
const { origin } = this.pageStack[stackIdx].data;
|
|
2204
|
+
return JSON.parse(JSON.stringify(origin));
|
|
2205
|
+
}
|
|
2206
|
+
return null;
|
|
2375
2207
|
}
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2208
|
+
changeForm(origin, target) {
|
|
2209
|
+
if (!origin) {
|
|
2210
|
+
this.cleanStack();
|
|
2211
|
+
}
|
|
2212
|
+
const { url, params } = target;
|
|
2213
|
+
const newToken = this.stack({ origin, target });
|
|
2214
|
+
const navigationArray = [url, ...params, newToken];
|
|
2215
|
+
this.goToRoute(navigationArray);
|
|
2381
2216
|
}
|
|
2382
|
-
|
|
2383
|
-
const
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
delete this.pageStack[formToken];
|
|
2387
|
-
const originNavigationArray = originObject.navigation;
|
|
2388
|
-
this.goToRoute(originNavigationArray);
|
|
2217
|
+
changePreviousForm(transitionToken) {
|
|
2218
|
+
const prevForm = this.unstack(transitionToken);
|
|
2219
|
+
if (!prevForm) {
|
|
2220
|
+
return;
|
|
2389
2221
|
}
|
|
2222
|
+
const { origin: { url, params, token } } = prevForm;
|
|
2223
|
+
const navigationArray = [url, ...params, token];
|
|
2224
|
+
this.goToRoute(navigationArray);
|
|
2390
2225
|
}
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
this.
|
|
2396
|
-
|
|
2397
|
-
this.goToRoute(forwardNavigation);
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
class LibEventManagerService {
|
|
2229
|
+
constructor(eventNames) {
|
|
2230
|
+
this.eventSubjects = {};
|
|
2231
|
+
eventNames.forEach((name) => { this.addEventName(name); });
|
|
2398
2232
|
}
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2233
|
+
addEventName(name) {
|
|
2234
|
+
if (!this.eventSubjects[name]) {
|
|
2235
|
+
const newEventSubject = new BehaviorSubject(null);
|
|
2236
|
+
this.eventSubjects[name] = newEventSubject;
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
getEventNames() { return Object.keys(this.eventSubjects); }
|
|
2240
|
+
getSubject(eventClassName) { return eventClassName ? this.eventSubjects[eventClassName] : null; }
|
|
2241
|
+
subscribe(eventClassName, callback) { this.getSubject(eventClassName).subscribe(callback); }
|
|
2242
|
+
next(eventClassName, data) { this.getSubject(eventClassName).next(data); }
|
|
2402
2243
|
}
|
|
2403
2244
|
|
|
2404
2245
|
class LibFileManagementService {
|
|
@@ -2416,14 +2257,16 @@ const ORIGIN_PARAM = 'origin';
|
|
|
2416
2257
|
const STATE_PARAM = 'mode';
|
|
2417
2258
|
const REQUIRED_FIELD_MESSAGE = 'Campo requerido';
|
|
2418
2259
|
class BasicFormComponent {
|
|
2419
|
-
constructor(formManagerService, fileMgmtServices) {
|
|
2260
|
+
constructor(formManagerService, _eventManager, fileMgmtServices) {
|
|
2420
2261
|
this.formManagerService = formManagerService;
|
|
2262
|
+
this._eventManager = _eventManager;
|
|
2421
2263
|
this.fileMgmtServices = fileMgmtServices;
|
|
2422
2264
|
this.errorCode = '';
|
|
2423
2265
|
this.errorMessage = '';
|
|
2424
2266
|
this.errorDetail = '';
|
|
2425
2267
|
this.formStructure = null;
|
|
2426
|
-
this.
|
|
2268
|
+
this.transitionToken = null;
|
|
2269
|
+
this.inputDataFields = [];
|
|
2427
2270
|
this.extraData = null;
|
|
2428
2271
|
this.componentConstants = componentConstants;
|
|
2429
2272
|
this.definitionObtained = false;
|
|
@@ -2444,6 +2287,7 @@ class BasicFormComponent {
|
|
|
2444
2287
|
this.tableGetDataStart = {};
|
|
2445
2288
|
this.tableGetDataFinish = {};
|
|
2446
2289
|
this.customPreProcessing();
|
|
2290
|
+
this._eventEmiter = this._eventManager;
|
|
2447
2291
|
}
|
|
2448
2292
|
get currentState() { return this.formStructure.state; }
|
|
2449
2293
|
set currentState(state) { this.formStructure.changeState(state); }
|
|
@@ -2569,32 +2413,38 @@ class BasicFormComponent {
|
|
|
2569
2413
|
showFieldInfo(fieldCode) { }
|
|
2570
2414
|
showModalDialog(title, body, options, callback, params) { }
|
|
2571
2415
|
openUploadDialog(title, body, options, callback, params) { }
|
|
2572
|
-
|
|
2573
|
-
this.
|
|
2416
|
+
subscribeAppEvent(eventName, callback) {
|
|
2417
|
+
this._eventEmiter.subscribe(eventName, callback);
|
|
2574
2418
|
}
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2419
|
+
goToPage(navigationArray, predefinedFields, options = null) {
|
|
2420
|
+
var _a;
|
|
2421
|
+
let origin = null;
|
|
2422
|
+
const cleanStack = (_a = options === null || options === void 0 ? void 0 : options.cleanStack) !== null && _a !== void 0 ? _a : false;
|
|
2423
|
+
if (!cleanStack) {
|
|
2424
|
+
origin = {
|
|
2425
|
+
code: this.formCode,
|
|
2426
|
+
url: this._formRoute,
|
|
2427
|
+
params: [
|
|
2428
|
+
this.currentState,
|
|
2429
|
+
this.formSubject,
|
|
2430
|
+
],
|
|
2431
|
+
token: this.transitionToken,
|
|
2432
|
+
predefinedFields: this.inputDataFields
|
|
2433
|
+
};
|
|
2578
2434
|
}
|
|
2579
|
-
|
|
2580
|
-
navigationArray
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
navigationArray = navigationArray.slice(0, 3);
|
|
2584
|
-
}
|
|
2585
|
-
let goBackNavigationArray = [
|
|
2586
|
-
this._formRoute,
|
|
2587
|
-
this.formStructure.state,
|
|
2588
|
-
this.formSubject,
|
|
2589
|
-
this.originToken
|
|
2590
|
-
];
|
|
2591
|
-
goBackNavigationArray = goBackNavigationArray.filter(item => typeof item !== 'undefined' && item !== null);
|
|
2592
|
-
const originData = {
|
|
2593
|
-
goBack: goBackNavigationArray,
|
|
2594
|
-
predefinedFields: fieldValuesArray
|
|
2435
|
+
const target = {
|
|
2436
|
+
url: navigationArray === null || navigationArray === void 0 ? void 0 : navigationArray[0],
|
|
2437
|
+
params: navigationArray.splice(1),
|
|
2438
|
+
predefinedFields,
|
|
2595
2439
|
};
|
|
2596
|
-
this.formManagerService.
|
|
2597
|
-
}
|
|
2440
|
+
this.formManagerService.changeForm(origin, target);
|
|
2441
|
+
}
|
|
2442
|
+
goToNewPage(nav, flds) { return this.goToPage(nav, flds, { cleanStack: true }); }
|
|
2443
|
+
goToSubPage(nav, flds) { return this.goToPage(nav, flds, { cleanStack: false }); }
|
|
2444
|
+
canGoBack() { return this.transitionToken !== null; }
|
|
2445
|
+
goBack() { return this.formManagerService.changePreviousForm(this.transitionToken); }
|
|
2446
|
+
goBackForm() { return this.goBack(); }
|
|
2447
|
+
getOriginDetail() { return this.formManagerService.getOriginInfo(this.transitionToken); }
|
|
2598
2448
|
setError(errorType, errorMessage, errorDetail) {
|
|
2599
2449
|
this._errorType = errorType || '';
|
|
2600
2450
|
this.errorMessage = errorMessage || '';
|
|
@@ -2619,23 +2469,21 @@ class BasicFormComponent {
|
|
|
2619
2469
|
getSubject() { return this.formSubject; }
|
|
2620
2470
|
getformSubject() { return this.getSubject(); }
|
|
2621
2471
|
preocessInputParams(params) {
|
|
2622
|
-
|
|
2623
|
-
|
|
2472
|
+
var _a, _b, _c;
|
|
2473
|
+
const allParams = Object.keys(params !== null && params !== void 0 ? params : {});
|
|
2474
|
+
if (!allParams || !Array.isArray(allParams) || allParams.length === 0) {
|
|
2624
2475
|
return;
|
|
2625
2476
|
}
|
|
2626
2477
|
this.extraData = [];
|
|
2627
2478
|
for (const paramName of allParams) {
|
|
2628
2479
|
this.extraData[paramName] = params[paramName].toString();
|
|
2629
2480
|
}
|
|
2630
|
-
this.formSubject = (this.extraData
|
|
2631
|
-
? this.extraData[FORM_SUBJECT] : null;
|
|
2481
|
+
this.formSubject = (_b = (_a = this.extraData) === null || _a === void 0 ? void 0 : _a[FORM_SUBJECT]) !== null && _b !== void 0 ? _b : null;
|
|
2632
2482
|
const initialState = this.extraData[STATE_PARAM];
|
|
2633
|
-
this.
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
else {
|
|
2638
|
-
this.formManagerService.resetPageStack();
|
|
2483
|
+
this.transitionToken = (_c = this.extraData[ORIGIN_PARAM]) !== null && _c !== void 0 ? _c : null;
|
|
2484
|
+
this.inputDataFields = (this.transitionToken) ? this.formManagerService.getInputData(this.transitionToken) : [];
|
|
2485
|
+
if (!this.transitionToken) {
|
|
2486
|
+
this.formManagerService.cleanStack();
|
|
2639
2487
|
}
|
|
2640
2488
|
return initialState;
|
|
2641
2489
|
}
|
|
@@ -2698,11 +2546,10 @@ class BasicFormComponent {
|
|
|
2698
2546
|
initialState = this.formStructure.defaultState;
|
|
2699
2547
|
}
|
|
2700
2548
|
this.formStructure.changeState(initialState || this.formStructure.defaultState);
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
}
|
|
2549
|
+
for (const inputFieldData of this.inputDataFields) {
|
|
2550
|
+
const { fieldCode, fieldValue } = inputFieldData;
|
|
2551
|
+
if (fieldCode) {
|
|
2552
|
+
this.setFieldValue(inputFieldData.fieldCode, fieldValue);
|
|
2706
2553
|
}
|
|
2707
2554
|
}
|
|
2708
2555
|
const recordResponse = yield this.requestFormAction(componentConstants.FORMACTION_GETDATA);
|
|
@@ -3681,6 +3528,7 @@ BasicFormComponent.decorators = [
|
|
|
3681
3528
|
];
|
|
3682
3529
|
BasicFormComponent.ctorParameters = () => [
|
|
3683
3530
|
{ type: LibFormManagerService },
|
|
3531
|
+
{ type: LibEventManagerService },
|
|
3684
3532
|
{ type: LibFileManagementService }
|
|
3685
3533
|
];
|
|
3686
3534
|
|
|
@@ -3688,7 +3536,6 @@ const COMPONENTS = [
|
|
|
3688
3536
|
BasicFormComponent,
|
|
3689
3537
|
ActionComponent,
|
|
3690
3538
|
FieldComponent,
|
|
3691
|
-
PasswordComponent,
|
|
3692
3539
|
ElementComponent,
|
|
3693
3540
|
FormErrorComponent,
|
|
3694
3541
|
FormHeaderComponent,
|
|
@@ -3717,5 +3564,5 @@ TuainNgFormsLibModule.decorators = [
|
|
|
3717
3564
|
* Generated bundle index. Do not edit.
|
|
3718
3565
|
*/
|
|
3719
3566
|
|
|
3720
|
-
export { ActionComponent, BasicFormComponent, ElementComponent, FieldComponent, FormErrorComponent, FormHeaderComponent,
|
|
3567
|
+
export { ActionComponent, BasicFormComponent, ElementComponent, FieldComponent, FormErrorComponent, FormHeaderComponent, LibEventManagerService, LibFileManagementService, LibFormManagerService, LibTableComponent, LibTableFilterComponent, LibTableRecordActionComponent, LibTableRecordFieldComponent, SectionComponent, SubSectionComponent, TuainNgFormsLibModule };
|
|
3721
3568
|
//# sourceMappingURL=tuain-ng-forms-lib.js.map
|