tuain-ng-forms-lib 17.2.22 → 17.2.23

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.
Files changed (106) hide show
  1. package/esm2022/lib/classes/forms/action.mjs +106 -0
  2. package/esm2022/lib/classes/forms/element.mjs +25 -0
  3. package/esm2022/lib/classes/forms/field.mjs +474 -0
  4. package/esm2022/lib/classes/forms/form.constants.mjs +26 -0
  5. package/esm2022/lib/classes/forms/form.mjs +608 -0
  6. package/esm2022/lib/classes/forms/piece-propagate.mjs +39 -0
  7. package/esm2022/lib/classes/forms/piece.mjs +134 -0
  8. package/esm2022/lib/classes/forms/section.mjs +151 -0
  9. package/esm2022/lib/classes/forms/subsection.mjs +99 -0
  10. package/esm2022/lib/classes/forms/table/action.mjs +38 -0
  11. package/esm2022/lib/classes/forms/table/column.mjs +74 -0
  12. package/esm2022/lib/classes/forms/table/row-data.mjs +116 -0
  13. package/esm2022/lib/classes/forms/table/table.mjs +535 -0
  14. package/esm2022/lib/components/elements/action.component.mjs +70 -0
  15. package/esm2022/lib/components/elements/field.component.mjs +115 -0
  16. package/esm2022/lib/components/elements/layout/element.component.mjs +21 -0
  17. package/esm2022/lib/components/elements/layout/form-error.component.mjs +23 -0
  18. package/esm2022/lib/components/elements/layout/form-header.component.mjs +23 -0
  19. package/esm2022/lib/components/elements/layout/piece.component.mjs +64 -0
  20. package/esm2022/lib/components/elements/layout/section.component.mjs +56 -0
  21. package/esm2022/lib/components/elements/layout/sub-section.component.mjs +56 -0
  22. package/esm2022/lib/components/elements/tables/table-record-action.component.mjs +72 -0
  23. package/esm2022/lib/components/elements/tables/table-record-field.component.mjs +31 -0
  24. package/esm2022/lib/components/elements/tables/table.component.mjs +109 -0
  25. package/esm2022/lib/components/forms/basic-form.mjs +1408 -0
  26. package/esm2022/lib/services/event-manager.service.mjs +43 -0
  27. package/esm2022/lib/services/file-manager.service.mjs +7 -0
  28. package/esm2022/lib/services/form-manager.service.mjs +81 -0
  29. package/esm2022/lib/tuain-ng-forms-lib.module.mjs +71 -0
  30. package/esm2022/public-api.mjs +19 -0
  31. package/esm2022/tuain-ng-forms-lib.mjs +5 -0
  32. package/fesm2022/tuain-ng-forms-lib.mjs +4602 -0
  33. package/fesm2022/tuain-ng-forms-lib.mjs.map +1 -0
  34. package/index.d.ts +5 -0
  35. package/lib/classes/forms/action.d.ts +40 -0
  36. package/lib/classes/forms/element.d.ts +9 -0
  37. package/lib/classes/forms/field.d.ts +206 -0
  38. package/lib/classes/forms/form.constants.d.ts +25 -0
  39. package/lib/classes/forms/form.d.ts +232 -0
  40. package/lib/classes/forms/piece-propagate.d.ts +13 -0
  41. package/lib/classes/forms/piece.d.ts +51 -0
  42. package/lib/classes/forms/section.d.ts +43 -0
  43. package/lib/classes/forms/subsection.d.ts +42 -0
  44. package/lib/classes/forms/table/action.d.ts +16 -0
  45. package/lib/classes/forms/table/column.d.ts +33 -0
  46. package/lib/classes/forms/table/row-data.d.ts +14 -0
  47. package/lib/classes/forms/table/table.d.ts +145 -0
  48. package/lib/components/elements/action.component.d.ts +22 -0
  49. package/lib/components/elements/field.component.d.ts +47 -0
  50. package/lib/components/elements/layout/element.component.d.ts +8 -0
  51. package/lib/components/elements/layout/form-error.component.d.ts +8 -0
  52. package/lib/components/elements/layout/form-header.component.d.ts +9 -0
  53. package/lib/components/elements/layout/piece.component.d.ts +18 -0
  54. package/lib/components/elements/layout/section.component.d.ts +13 -0
  55. package/lib/components/elements/layout/sub-section.component.d.ts +13 -0
  56. package/lib/components/elements/tables/table-record-action.component.d.ts +18 -0
  57. package/lib/components/elements/tables/table-record-field.component.d.ts +12 -0
  58. package/lib/components/elements/tables/table.component.d.ts +44 -0
  59. package/lib/components/forms/basic-form.d.ts +257 -0
  60. package/lib/services/event-manager.service.d.ts +11 -0
  61. package/lib/services/file-manager.service.d.ts +6 -0
  62. package/lib/services/form-manager.service.d.ts +28 -0
  63. package/lib/tuain-ng-forms-lib.module.d.ts +20 -0
  64. package/package.json +16 -2
  65. package/{src/public-api.ts → public-api.d.ts} +0 -5
  66. package/.browserslistrc +0 -16
  67. package/.yarn/cache/nanoid-npm-4.0.0-924f5c6312-7d5946df5c.zip +0 -0
  68. package/.yarn/cache/tslib-npm-2.4.1-36f0ed04db-19480d6e03.zip +0 -0
  69. package/.yarn/cache/yn-npm-5.0.0-b001dab23c-f0ec7710d3.zip +0 -0
  70. package/.yarn/install-state.gz +0 -0
  71. package/karma.conf.js +0 -44
  72. package/ng-package.json +0 -11
  73. package/src/lib/classes/forms/action.ts +0 -117
  74. package/src/lib/classes/forms/element.ts +0 -26
  75. package/src/lib/classes/forms/field.ts +0 -522
  76. package/src/lib/classes/forms/form.constants.ts +0 -28
  77. package/src/lib/classes/forms/form.ts +0 -692
  78. package/src/lib/classes/forms/piece-propagate.ts +0 -47
  79. package/src/lib/classes/forms/piece.ts +0 -164
  80. package/src/lib/classes/forms/section.ts +0 -165
  81. package/src/lib/classes/forms/subsection.ts +0 -109
  82. package/src/lib/classes/forms/table/action.ts +0 -41
  83. package/src/lib/classes/forms/table/column.ts +0 -94
  84. package/src/lib/classes/forms/table/row-data.ts +0 -121
  85. package/src/lib/classes/forms/table/table.ts +0 -582
  86. package/src/lib/components/elements/action.component.ts +0 -70
  87. package/src/lib/components/elements/field.component.ts +0 -115
  88. package/src/lib/components/elements/layout/element.component.ts +0 -14
  89. package/src/lib/components/elements/layout/form-error.component.ts +0 -11
  90. package/src/lib/components/elements/layout/form-header.component.ts +0 -14
  91. package/src/lib/components/elements/layout/piece.component.ts +0 -60
  92. package/src/lib/components/elements/layout/section.component.ts +0 -52
  93. package/src/lib/components/elements/layout/sub-section.component.ts +0 -52
  94. package/src/lib/components/elements/tables/table-record-action.component.ts +0 -66
  95. package/src/lib/components/elements/tables/table-record-field.component.ts +0 -20
  96. package/src/lib/components/elements/tables/table.component.ts +0 -112
  97. package/src/lib/components/forms/basic-form.ts +0 -1464
  98. package/src/lib/services/event-manager.service.ts +0 -45
  99. package/src/lib/services/file-manager.service.ts +0 -7
  100. package/src/lib/services/form-manager.service.ts +0 -89
  101. package/src/lib/services/icon-dictionary.service.ts +0 -159
  102. package/src/lib/tuain-ng-forms-lib.module.ts +0 -40
  103. package/src/test.ts +0 -27
  104. package/tsconfig.lib.json +0 -15
  105. package/tsconfig.lib.prod.json +0 -10
  106. package/tsconfig.spec.json +0 -17
@@ -0,0 +1,257 @@
1
+ import { OnInit, OnDestroy } from '@angular/core';
2
+ import { FormStructureAndData } from '../../classes/forms/form';
3
+ import { LibFormManagerService } from '../../services/form-manager.service';
4
+ import { LibEventManagerService } from '../../services/event-manager.service';
5
+ import { LibFileManagementService } from '../../services/file-manager.service';
6
+ import { FieldDescriptor } from '../../classes/forms/field';
7
+ import { RecordFormSection } from '../../classes/forms/section';
8
+ import * as i0 from "@angular/core";
9
+ export declare class BasicFormComponent extends FormStructureAndData implements OnInit, OnDestroy {
10
+ protected formManagerService: LibFormManagerService;
11
+ protected _eventManager: LibEventManagerService;
12
+ protected fileMgmtServices: LibFileManagementService;
13
+ private destroy$;
14
+ private _controlToken;
15
+ private _originToken;
16
+ private _formRoute;
17
+ private _definitionObtained;
18
+ private _notifyFormActivity;
19
+ private _formChangeState;
20
+ private _formSectionsCanDeactivate;
21
+ private _formSectionsActivate;
22
+ private _formSectionsInactivate;
23
+ private _formActionsStart;
24
+ private _formActionsFinish;
25
+ private _fieldCustomeEvent;
26
+ private _fieldInputValidation;
27
+ private _fieldValidationsStart;
28
+ private _fieldValidationsFinish;
29
+ private _tableSelectionsStart;
30
+ private _tableSelectionsFinish;
31
+ private _tableActionsStart;
32
+ private _tableActionsFinish;
33
+ private _tableGetDataStart;
34
+ private _tableGetDataFinish;
35
+ private _actionServerError;
36
+ private _fieldServerError;
37
+ private _tableServerError;
38
+ private _actionsInProgress;
39
+ private _serverActionsInProgress;
40
+ protected inputDataFields: any;
41
+ protected extraData: any;
42
+ protected _eventEmiter: LibEventManagerService;
43
+ protected enabledSections: RecordFormSection[];
44
+ _errorType: string;
45
+ errorCode: string;
46
+ errorFullCode: string;
47
+ errorName: string;
48
+ errorMessage: string;
49
+ errorDetail: string;
50
+ visible: boolean;
51
+ busy: import("@angular/core").WritableSignal<boolean>;
52
+ constructor(formManagerService: LibFormManagerService, _eventManager: LibEventManagerService, fileMgmtServices: LibFileManagementService);
53
+ cleanStart(): void;
54
+ get formVisible(): boolean;
55
+ get form(): this;
56
+ ngOnInit(): void;
57
+ preStart(): void;
58
+ start(): void;
59
+ /**
60
+ * @deprecated Use preStart
61
+ */
62
+ customPreProcessing(): void;
63
+ /**
64
+ * @deprecated Overload start
65
+ */
66
+ customFormStart(): void;
67
+ displayActionServerError(): void;
68
+ displayValidationServerError(): void;
69
+ displayTableServerError(): void;
70
+ showFieldInfo(code?: string, detail?: any): void;
71
+ showModalDialog(title: any, body: any, options: any, callback?: any, params?: any): void;
72
+ openUploadDialog(title: any, body: any, options: any, callback?: any, params?: any): void;
73
+ subscribeAppEvent(eventName: string, callback: any): void;
74
+ openForm(name: string, data?: any, backData?: any, cleanStack?: boolean): void;
75
+ enableActivityNotification(): void;
76
+ disableActivityNotification(): void;
77
+ canGoBack(): boolean;
78
+ goBack(): void;
79
+ goBackForm(): void;
80
+ getOriginDetail(): any;
81
+ setError(errorType: string | null, errorMessage: string | null, errorDetail: string | null): void;
82
+ resetError(): void;
83
+ getErrorType(): string;
84
+ getErrorMessage(): string;
85
+ getErrorDetail(): string;
86
+ getErrorName(): string;
87
+ getErrorFullCode(): string;
88
+ getErrorCode(): string;
89
+ getFormParameter(name: string): string;
90
+ preocessInputParams(params: any): string | null;
91
+ subscribeSectionActivation(): void;
92
+ subscribeFieldsSubjects(): void;
93
+ subscribeActionSubjects(): void;
94
+ subscribeTableSubjects(): void;
95
+ formInit(params: any, forceReload?: boolean): Promise<void>;
96
+ changeState(state: string | undefined): boolean;
97
+ checkErrorRecordReceived(recordResponse: any): boolean;
98
+ errorOccured(): boolean;
99
+ /**
100
+ * Soporte manejo de eventos de formulario
101
+ */
102
+ requestFormAction(actionCode: string, actionSubject?: any): Promise<any>;
103
+ updateFormWithServerData(formContent: any): void;
104
+ /**
105
+ * Manejo de event handlers para errores Server del formulario
106
+ */
107
+ cleanActionServerError(): void;
108
+ cleanFieldServerError(): void;
109
+ cleanTableServerError(): void;
110
+ onActionServerError(callback: any, properties?: any): void;
111
+ onValidationServerError(callback: any, properties?: any): void;
112
+ onTableServerError(callback: any, properties?: any): void;
113
+ /**
114
+ * Manejo de event handlers para acciones sobre el formulario
115
+ */
116
+ onFormChange(callback: any): void;
117
+ onSectionCanDeactivate(codes: string[] | string | null, callback: any, properties?: any): void;
118
+ onSectionActivation(codes: string[] | string | null, callback: any, properties?: any): void;
119
+ onSectionInactivation(codes: string[] | string | null, callback: any, properties?: any): void;
120
+ onActionStart(codes: string[] | string | null, callback: any, properties?: any): void;
121
+ onActionFinish(codes: string[] | string | null, callback: any, properties?: any): void;
122
+ verifySectionActivation(code: string): Promise<boolean>;
123
+ launchSectionActivation(code: string): Promise<void>;
124
+ launchSectionInactivation(code: string): Promise<void>;
125
+ startAction(code: string): Promise<void>;
126
+ startServerAction(actionInput: any): Promise<void>;
127
+ finishAction(action: any, actionResult: any, serverError?: boolean): Promise<void>;
128
+ completeGlobalAction(action: any): Promise<void>;
129
+ /**
130
+ * Manejadores de eventos para validaciones sobre campos
131
+ */
132
+ onFieldInput(codes: string[] | string | null, callback: any, properties?: any): void;
133
+ onFieldCustomEvent(codes: string[] | string | null, callback: any, properties?: any): void;
134
+ onFieldValidationStart(codes: string[] | string | null, callback: any, properties?: any): void;
135
+ onFieldValidationFinish(codes: string[] | string | null, callback: any, properties?: any): void;
136
+ startFieldInputValidation(code: string, intrinsicValidation?: boolean): Promise<boolean>;
137
+ startFieldCustomEvent(code: string, eventName: string, eventData: any): Promise<void>;
138
+ startFieldValidation(code: string, intrinsicValidation?: boolean): Promise<void>;
139
+ startServerFieldValidation(inputField: string | FieldDescriptor): Promise<void>;
140
+ finishFieldValidation(fieldObject: any, validationResult: boolean, serverError?: boolean): Promise<void>;
141
+ continueFieldValidation(code: string): Promise<void>;
142
+ /**
143
+ * Manejadores de eventos para acciones sobre Tablas
144
+ */
145
+ onTableActionStart(code: string, actionCode: string, callback: any, properties?: any): void;
146
+ onTableActionFinish(code: string, actionCode: string, callback: any, properties?: any): void;
147
+ onTableSelectionStart(code: string, callback: any, properties?: any): void;
148
+ onTableSelectionFinish(code: string, callback: any, properties?: any): void;
149
+ onTableGetDataStart(code: string, callback: any, properties?: any): void;
150
+ onTableGetDataFinish(code: string, callback: any, properties?: any): void;
151
+ startTableGlobalAction(tableActionEvent: any): Promise<void>;
152
+ startTableServerGlobalAction(tableActionDetail: any): Promise<void>;
153
+ finishTableGlobalAction(tableActionDetail: any, actionResult: any, serverError?: boolean): Promise<void>;
154
+ startTableAction(tableActionEvent: any): Promise<void>;
155
+ startTableServerAction(tableActionDetail: any): Promise<void>;
156
+ completeInlineAction(tableAction: any): Promise<void>;
157
+ finishTableAction(tableActionDetail: any, actionResult: any, serverError?: boolean): Promise<void>;
158
+ startTableRecordSelection(tableActionEvent: any): Promise<void>;
159
+ startTableServerRecordSelection(tableSelectionDetail: any): Promise<void>;
160
+ finishTableRecordSelection(tableSelectionDetail: any, actionResult: any, serverError?: boolean): Promise<void>;
161
+ startTableSelectionAction(tableActionEvent: any): Promise<void>;
162
+ startTableServerSelectionAction(tableActionDetail: any): Promise<void>;
163
+ finishTableSelectionAction(tableActionDetail: any, actionResult: any, serverError?: boolean): Promise<void>;
164
+ startTableGetData(tableActionEvent: any): Promise<void>;
165
+ startTableServerGetData(tableActionDetail: any): Promise<void>;
166
+ finishTableGetData(tableActionDetail: any, actionResult: any, serverError?: boolean): Promise<void>;
167
+ checkSectionRequiredFields(sectionCode: string, reqFieldMessage?: string): boolean;
168
+ validateSectionConsistency(sectionCode: string, reqFieldMessage?: string): boolean;
169
+ copyTableRecordToFields(tableObj: any, mappingTable?: any): boolean;
170
+ notifyFormActivity(): void;
171
+ /**
172
+ * Métodos Legacy de compatibilidad hacia atrás
173
+ */
174
+ /**
175
+ * @deprecated Use name
176
+ */
177
+ get formCode(): string;
178
+ /**
179
+ * @deprecated Use name
180
+ */
181
+ set formCode(name: string);
182
+ /**
183
+ * @deprecated Use busy signal
184
+ */
185
+ get inServerProcess(): boolean;
186
+ /**
187
+ * @deprecated Use state
188
+ */
189
+ get currentState(): string;
190
+ /**
191
+ * @deprecated Use changeState
192
+ */
193
+ set currentState(state: string);
194
+ /**
195
+ * @deprecated Use onSectionActivation
196
+ */
197
+ get formRoute(): string;
198
+ /**
199
+ * @deprecated Use onSectionActivation
200
+ */
201
+ set formRoute(route: string);
202
+ /**
203
+ * @deprecated Use onSectionActivation
204
+ */
205
+ addSectionActivation(codes: string[] | string | null, callback: any, properties?: any): void;
206
+ /**
207
+ * @deprecated Use onSectionInactivation
208
+ */
209
+ addSectionInactivation(codes: string[] | string | null, callback: any, properties?: any): void;
210
+ /**
211
+ * @deprecated Use onActionStart
212
+ */
213
+ addActionMethodStart(codes: string[] | string | null, callback: any, properties?: any): void;
214
+ /**
215
+ * @deprecated Use onActionFinish
216
+ */
217
+ addActionMethodFinish(codes: string[] | string | null, callback: any, properties?: any): void;
218
+ /**
219
+ * @deprecated Use onFieldInput
220
+ */
221
+ addFieldInputValidation(codes: string[] | string | null, callback: any, properties?: any): void;
222
+ /**
223
+ * @deprecated Use onFieldValidationStart
224
+ */
225
+ addFieldValidationStart(codes: string[] | string | null, callback: any, properties?: any): void;
226
+ /**
227
+ * @deprecated Use onFieldValidationFinish
228
+ */
229
+ addFieldValidationFinish(codes: string[] | string | null, callback: any, properties?: any): void;
230
+ /**
231
+ * @deprecated Use onTableActionStart
232
+ */
233
+ addTableActionStart(code: string, actionCode: string, callback: any, properties?: any): void;
234
+ /**
235
+ * @deprecated Use onTableActionFinish
236
+ */
237
+ addTableActionFinish(code: string, actionCode: string, callback: any, properties?: any): void;
238
+ /**
239
+ * @deprecated Use onTableSelectionStart
240
+ */
241
+ addTableSelectionStart(code: string, callback: any, properties?: any): void;
242
+ /**
243
+ * @deprecated Use onTableSelectionFinish
244
+ */
245
+ addTableSelectionFinish(code: string, callback: any, properties?: any): void;
246
+ /**
247
+ * @deprecated Use onTableGetDataStart
248
+ */
249
+ addTableGetDataStart(code: string, callback: any, properties?: any): void;
250
+ /**
251
+ * @deprecated Use onTableGetDataFinish
252
+ */
253
+ addTableGetDataFinish(code: string, callback: any, properties?: any): void;
254
+ ngOnDestroy(): void;
255
+ static ɵfac: i0.ɵɵFactoryDeclaration<BasicFormComponent, never>;
256
+ static ɵcmp: i0.ɵɵComponentDeclaration<BasicFormComponent, "ng-component", never, {}, {}, never, ["*"], false, never>;
257
+ }
@@ -0,0 +1,11 @@
1
+ export declare class LibEventManagerService {
2
+ eventSubjects: any;
3
+ eventSubjectParams: any;
4
+ constructor(eventSet: any[]);
5
+ addEventName(event: any, rebuild?: boolean): void;
6
+ resetSubject(eventClassName: any): void;
7
+ getEventNames(): string[];
8
+ getSubject(eventClassName: any): any;
9
+ subscribe(eventClassName: any, callback: any): any;
10
+ next(eventClassName: any, data: any): void;
11
+ }
@@ -0,0 +1,6 @@
1
+ export declare class LibFileManagementService {
2
+ openFile(fileBase64Data: any, fileName: any, fileType: any): void;
3
+ saveFileFromURL(fileUrl: any, fileName?: any, fileType?: any): void;
4
+ saveFile(fileBase64Data: any, fileName: any, fileType: any): void;
5
+ printPdfFile(pdfBufferData: any): void;
6
+ }
@@ -0,0 +1,28 @@
1
+ export declare class LibFormManagerService {
2
+ pageStack: any[];
3
+ constructor();
4
+ getFormDefinition(formCode: any): void;
5
+ execServerAction(actionDetail: any): void;
6
+ goToForm(formCode: any, token: any, subject: any): void;
7
+ loadStack(): Promise<void>;
8
+ saveStack(): void;
9
+ cleanStack(): void;
10
+ resetPageStack(): void;
11
+ findFormInStack(token: any): {
12
+ index: number;
13
+ data: any;
14
+ };
15
+ replaceItem(token: any, formInfo: any): void;
16
+ stack(origin: any, target: any): string;
17
+ unstack(token?: any): any;
18
+ getFormInfo(token: string): {
19
+ token: any;
20
+ subject: any;
21
+ state: any;
22
+ originToken: any;
23
+ fields: any;
24
+ extra: any;
25
+ };
26
+ openForm(origin: any, target: any): void;
27
+ backTo(targetToken?: any): void;
28
+ }
@@ -0,0 +1,20 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./components/forms/basic-form";
3
+ import * as i2 from "./components/elements/action.component";
4
+ import * as i3 from "./components/elements/field.component";
5
+ import * as i4 from "./components/elements/layout/element.component";
6
+ import * as i5 from "./components/elements/layout/form-error.component";
7
+ import * as i6 from "./components/elements/layout/form-header.component";
8
+ import * as i7 from "./components/elements/layout/section.component";
9
+ import * as i8 from "./components/elements/layout/sub-section.component";
10
+ import * as i9 from "./components/elements/tables/table-record-action.component";
11
+ import * as i10 from "./components/elements/tables/table-record-field.component";
12
+ import * as i11 from "./components/elements/tables/table.component";
13
+ import * as i12 from "@angular/common";
14
+ import * as i13 from "@angular/router";
15
+ import * as i14 from "@angular/forms";
16
+ export declare class TuainNgFormsLibModule {
17
+ static ɵfac: i0.ɵɵFactoryDeclaration<TuainNgFormsLibModule, never>;
18
+ static ɵmod: i0.ɵɵNgModuleDeclaration<TuainNgFormsLibModule, [typeof i1.BasicFormComponent, typeof i2.ActionComponent, typeof i3.FieldComponent, typeof i4.ElementComponent, typeof i5.FormErrorComponent, typeof i6.FormHeaderComponent, typeof i7.SectionComponent, typeof i8.SubSectionComponent, typeof i9.LibTableRecordActionComponent, typeof i10.LibTableRecordFieldComponent, typeof i11.LibTableComponent], [typeof i12.CommonModule, typeof i13.RouterModule, typeof i14.FormsModule], [typeof i1.BasicFormComponent, typeof i2.ActionComponent, typeof i3.FieldComponent, typeof i4.ElementComponent, typeof i5.FormErrorComponent, typeof i6.FormHeaderComponent, typeof i7.SectionComponent, typeof i8.SubSectionComponent, typeof i9.LibTableRecordActionComponent, typeof i10.LibTableRecordFieldComponent, typeof i11.LibTableComponent]>;
19
+ static ɵinj: i0.ɵɵInjectorDeclaration<TuainNgFormsLibModule>;
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tuain-ng-forms-lib",
3
- "version": "17.2.22",
3
+ "version": "17.2.23",
4
4
  "description": "Componentes y Clases Angular para la gestión de formularios TUAIN",
5
5
  "author": "Mauricio Méndez, Imix Consulting",
6
6
  "license": "MIT",
@@ -22,5 +22,19 @@
22
22
  "nanoid": "^4.0.0",
23
23
  "tslib": "^2.4.0",
24
24
  "yn": "^5.0.0"
25
- }
25
+ },
26
+ "module": "fesm2022/tuain-ng-forms-lib.mjs",
27
+ "typings": "index.d.ts",
28
+ "exports": {
29
+ "./package.json": {
30
+ "default": "./package.json"
31
+ },
32
+ ".": {
33
+ "types": "./index.d.ts",
34
+ "esm2022": "./esm2022/tuain-ng-forms-lib.mjs",
35
+ "esm": "./esm2022/tuain-ng-forms-lib.mjs",
36
+ "default": "./fesm2022/tuain-ng-forms-lib.mjs"
37
+ }
38
+ },
39
+ "sideEffects": false
26
40
  }
@@ -1,7 +1,3 @@
1
- /*
2
- * Public API Surface of tuain-ng-forms-lib
3
- */
4
-
5
1
  export * from './lib/components/elements/action.component';
6
2
  export * from './lib/components/elements/field.component';
7
3
  export * from './lib/components/elements/layout/element.component';
@@ -17,4 +13,3 @@ export * from './lib/services/event-manager.service';
17
13
  export * from './lib/services/form-manager.service';
18
14
  export * from './lib/services/file-manager.service';
19
15
  export * from './lib/tuain-ng-forms-lib.module';
20
-
package/.browserslistrc DELETED
@@ -1,16 +0,0 @@
1
- # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2
- # For additional information regarding the format and rule options, please see:
3
- # https://github.com/browserslist/browserslist#queries
4
-
5
- # For the full list of supported browsers by the Angular framework, please see:
6
- # https://angular.io/guide/browser-support
7
-
8
- # You can see what browsers were selected by your queries by running:
9
- # npx browserslist
10
-
11
- last 1 Chrome version
12
- last 1 Firefox version
13
- last 2 Edge major versions
14
- # last 2 Safari major versions
15
- last 2 iOS major versions
16
- Firefox ESR
Binary file
package/karma.conf.js DELETED
@@ -1,44 +0,0 @@
1
- // Karma configuration file, see link for more information
2
- // https://karma-runner.github.io/1.0/config/configuration-file.html
3
-
4
- module.exports = function (config) {
5
- config.set({
6
- basePath: '',
7
- frameworks: ['jasmine', '@angular-devkit/build-angular'],
8
- plugins: [
9
- require('karma-jasmine'),
10
- require('karma-chrome-launcher'),
11
- require('karma-jasmine-html-reporter'),
12
- require('karma-coverage'),
13
- require('@angular-devkit/build-angular/plugins/karma')
14
- ],
15
- client: {
16
- jasmine: {
17
- // you can add configuration options for Jasmine here
18
- // the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19
- // for example, you can disable the random execution with `random: false`
20
- // or set a specific seed with `seed: 4321`
21
- },
22
- clearContext: false // leave Jasmine Spec Runner output visible in browser
23
- },
24
- jasmineHtmlReporter: {
25
- suppressAll: true // removes the duplicated traces
26
- },
27
- coverageReporter: {
28
- dir: require('path').join(__dirname, '../../coverage/tuain-ng-forms-lib'),
29
- subdir: '.',
30
- reporters: [
31
- { type: 'html' },
32
- { type: 'text-summary' }
33
- ]
34
- },
35
- reporters: ['progress', 'kjhtml'],
36
- port: 9876,
37
- colors: true,
38
- logLevel: config.LOG_INFO,
39
- autoWatch: true,
40
- browsers: ['Chrome'],
41
- singleRun: false,
42
- restartOnFileChange: true
43
- });
44
- };
package/ng-package.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
- "dest": "../../dist/tuain-ng-forms-lib",
4
- "lib": {
5
- "entryFile": "src/public-api.ts"
6
- },
7
- "allowedNonPeerDependencies": [
8
- "nanoid",
9
- "yn"
10
- ]
11
- }
@@ -1,117 +0,0 @@
1
- import { Subject } from 'rxjs';
2
- import { elementTypes } from './form.constants';
3
- import { FormElement } from './element';
4
-
5
- const HEADER = 'HEADER';
6
-
7
- const attrs = {
8
- actionCode: { name: '_actionCode', propagate: 'actionCode' },
9
- actionName: { name: '_actionName', propagate: 'actionName' },
10
- iconName: { name: '_iconName', propagate: 'iconName' },
11
- inProgress: { name: '_inProgress', propagate: 'inProgress' },
12
- restrictedOnField: { name: '_restrictedOnField', propagate: 'restrictedOnField' },
13
- restrictedOnOperator: { name: '_restrictedOnOperator', propagate: 'restrictedOnOperator' },
14
- restrictedOnValue: { name: '_restrictedOnValue', propagate: 'restrictedOnValue' },
15
- }
16
-
17
- export class FormAction extends FormElement {
18
- private readonly _actionActivated = new Subject<string>();
19
- private _actionCode: string = '';
20
- private _actionName: string = '';
21
- private _iconName: string = '';
22
- private _inProgress = false;
23
- private _newState: string;
24
- private _backend: boolean;
25
- private _restrictedOnField: string | null = null;
26
- private _restrictedOnOperator: string | null = null;
27
- private _restrictedOnValue: string | null = null;
28
-
29
- constructor(actionDefinition, formConfig) {
30
- super(actionDefinition, formConfig);
31
- this.propagationCustomAttributes = this._formConfig?.propagationCustomAttributes?.actions ?? [];
32
- this.elementType = elementTypes.action;
33
- this.setAttr(attrs.actionCode, actionDefinition.actionCode ? actionDefinition.actionCode.toString() : '');
34
- this.setAttr(attrs.actionName, actionDefinition.actionTitle);
35
- this.setAttr(attrs.iconName, actionDefinition.iconName || this._actionCode);
36
- this.setAttr(attrs.restrictedOnField, actionDefinition.fieldRestrictedCode?.toString() ?? null);
37
- if (this._restrictedOnField) {
38
- this.setAttr(attrs.restrictedOnOperator, actionDefinition.operatorRestricted || '');
39
- this.setAttr(attrs.restrictedOnValue, actionDefinition.valueRestricted ?? '');
40
- }
41
- this._backend = actionDefinition?.serverAction ?? false;
42
- this._newState = actionDefinition?.newState;
43
- this.setCustomAttribute('location', actionDefinition.position || HEADER);
44
- }
45
-
46
- get actionCode() { return this._actionCode; }
47
- get actionName() { return this._actionName; }
48
- get iconName() { return this._iconName; }
49
- get inProgress() { return this._inProgress; }
50
- get newState() { return this._newState; }
51
- get backend() { return this._backend; }
52
- get restrictedOnField() { return this._restrictedOnField; }
53
- get restrictedOnOperator() { return this._restrictedOnOperator; }
54
- get restrictedOnValue() { return this._restrictedOnValue; }
55
-
56
- set actionCode(actionCode) { this.setAttr(attrs.actionCode, actionCode); }
57
- set actionName(actionName) { this.setAttr(attrs.actionName, actionName); }
58
- set iconName(iconName) { this.setAttr(attrs.iconName, iconName); }
59
- set inProgress(inProgress) { this.setAttr(attrs.inProgress, inProgress); }
60
- set newState(newState) { this._newState, newState; }
61
- set backend(backend) { this._backend, backend; }
62
- set restrictedOnField(restrictedOnField) { this.setAttr(attrs.restrictedOnField, restrictedOnField); }
63
- set restrictedOnOperator(restrictedOnOperator) { this.setAttr(attrs.restrictedOnOperator, restrictedOnOperator); }
64
- set restrictedOnValue(restrictedOnValue) { this.setAttr(attrs.restrictedOnValue, restrictedOnValue); }
65
-
66
- start() { this.inProgress = true; }
67
- stop() { this.inProgress = false; }
68
-
69
- override connectWithParentForm(form, formChangeSubject) {
70
- super.connectWithParentForm(form, formChangeSubject);
71
- if (this._restrictedOnField) {
72
- const relatedField = this._form.fields?.[this._restrictedOnField];
73
- if (relatedField) {
74
- relatedField.editionFinish
75
- .subscribe(event => this.updateRestrictedVisibility(event));
76
- relatedField.editionPartial
77
- .subscribe(event => this.updateRestrictedVisibility(event));
78
- }
79
- }
80
- }
81
-
82
- updateRestrictedVisibility(event) {
83
- const newVisible = this._absoluteVisible && this.viewOnState(this._formState);
84
- (this._visible !== newVisible) && this.setVisibility(newVisible);
85
- }
86
-
87
- override viewOnState(state: string): boolean {
88
- const actionVisible = (this.visibleStates && state) ? this.visibleStates.includes(state) : false;
89
- if (actionVisible && this._form && this._restrictedOnField) {
90
- const relatedField = this._form.fields?.[this._restrictedOnField];
91
- if (relatedField) {
92
- const fieldValue = relatedField.value;
93
- if ((this._restrictedOnOperator === '==' && fieldValue !== this._restrictedOnValue)
94
- || (this._restrictedOnOperator === '!=' && fieldValue === this._restrictedOnValue)) {
95
- return false;
96
- }
97
- }
98
- }
99
- return actionVisible;
100
- }
101
-
102
- get actionActivated() { return this._actionActivated.asObservable(); }
103
-
104
- notifyActivation() { this._actionActivated.next(this._actionCode); }
105
-
106
- updateFromServer(receivedAction) {
107
- for (const propertyName in receivedAction) {
108
- if (propertyName !== 'actionCode' && propertyName !== 'actionId') {
109
- try {
110
- this[propertyName] = receivedAction[propertyName];
111
- } catch (e) {
112
- console.log(`Error actualizando la propiedad ${propertyName} de la acción ${this.actionCode}. ${e}`);
113
- }
114
- }
115
- }
116
- }
117
- }
@@ -1,26 +0,0 @@
1
- import { FormPiecePropagate } from './piece-propagate';
2
- import { elementTypes } from './form.constants';
3
- export class FormElement extends FormPiecePropagate {
4
- elementType: string | null = null;
5
-
6
- constructor(elementDefinition: any, formConfig: any) {
7
- super(elementDefinition, formConfig);
8
- }
9
-
10
- setAttr(attr: any, value: any) {
11
- const { name: attrName, propagate: name } = attr;
12
- try {
13
- const currentValue = this[attrName];
14
- if (currentValue !== value) {
15
- this[attrName] = value;
16
- name && this.propagateAttribute(name, value);
17
- }
18
- } catch (e) {
19
- console.log(`Atributo ${attrName} no presente o valor ${value} inconsistente. ${e}`);
20
- }
21
- }
22
-
23
- isField(): boolean { return this.elementType === elementTypes.field; }
24
- isAction(): boolean { return this.elementType === elementTypes.action; }
25
- isTable(): boolean { return this.elementType === elementTypes.table; }
26
- }