sf-crud 12.0.5 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/bundles/sf-crud.umd.js +2563 -1306
  2. package/bundles/sf-crud.umd.js.map +1 -1
  3. package/esm2015/lib/components/control/control.component.js +285 -73
  4. package/esm2015/lib/components/file-upload/file-upload.component.js +143 -0
  5. package/esm2015/lib/components/form/form.component.js +267 -0
  6. package/esm2015/lib/components/registro/registro.component.js +507 -407
  7. package/esm2015/lib/components/step/step.component.js +79 -0
  8. package/esm2015/lib/components/tablero/tablero.component.js +87 -27
  9. package/esm2015/lib/sf-crud.module.js +27 -15
  10. package/esm2015/lib/sf-crud.routing.module.js +23 -0
  11. package/esm2015/lib/sf-crud.service.js +486 -12
  12. package/esm2015/lib/shared/models/Conditions.model.js +81 -0
  13. package/esm2015/lib/shared/models/Empresa.model.js +2 -0
  14. package/esm2015/lib/shared/models/Reason.model.js +7 -0
  15. package/esm2015/lib/shared/models/crud-config.model.js +36 -13
  16. package/esm2015/lib/shared/models/shema.model.js +5 -1
  17. package/esm2015/lib/shared/services/general.service.js +41 -17
  18. package/esm2015/lib/shared/services/notification.service.js +83 -0
  19. package/esm2015/lib/shared/services/step.service.js +65 -0
  20. package/esm2015/public-api.js +7 -1
  21. package/fesm2015/sf-crud.js +2194 -1151
  22. package/fesm2015/sf-crud.js.map +1 -1
  23. package/lib/components/control/control.component.d.ts +39 -10
  24. package/lib/components/file-upload/file-upload.component.d.ts +34 -0
  25. package/lib/components/form/form.component.d.ts +58 -0
  26. package/lib/components/registro/registro.component.d.ts +81 -54
  27. package/lib/components/step/step.component.d.ts +27 -0
  28. package/lib/components/tablero/tablero.component.d.ts +15 -5
  29. package/lib/sf-crud.module.d.ts +80 -76
  30. package/lib/sf-crud.routing.module.d.ts +7 -0
  31. package/lib/sf-crud.service.d.ts +115 -5
  32. package/lib/shared/models/Conditions.model.d.ts +32 -0
  33. package/lib/shared/models/Empresa.model.d.ts +11 -0
  34. package/lib/shared/models/Reason.model.d.ts +5 -0
  35. package/lib/shared/models/crud-config.model.d.ts +76 -24
  36. package/lib/shared/models/shema.model.d.ts +27 -0
  37. package/lib/shared/services/general.service.d.ts +8 -1
  38. package/lib/shared/services/notification.service.d.ts +27 -0
  39. package/lib/shared/services/step.service.d.ts +27 -0
  40. package/package.json +9 -2
  41. package/public-api.d.ts +6 -0
  42. package/esm2015/lib/components/registro-child/registro-child.component.js +0 -348
  43. package/esm2015/lib/components/registro-detalle/registro-detalle.component.js +0 -232
  44. package/esm2015/lib/shared/models/data-temp-crud.model.js +0 -6
  45. package/lib/components/registro-child/registro-child.component.d.ts +0 -48
  46. package/lib/components/registro-detalle/registro-detalle.component.d.ts +0 -36
  47. package/lib/shared/models/data-temp-crud.model.d.ts +0 -4
@@ -1,10 +1,120 @@
1
+ import { Shema } from './shared/models/shema.model';
2
+ import { ConfigRegistro, Key, Operation, keyEsquema } from './shared/models/crud-config.model';
3
+ import { Empresa } from './shared/models/Empresa.model';
4
+ import { Condition } from './shared/models/Conditions.model';
5
+ import { Reason } from './shared/models/Reason.model';
1
6
  import * as i0 from "@angular/core";
2
7
  export declare class SfCrudService {
3
- private _dataTemp;
4
- constructor();
5
- saveDataTemp(scope: string, value: any): void;
6
- getDataTemp(): any;
7
- cleanDataTemp(): void;
8
+ private _esquemas;
9
+ private _uiEsquemas;
10
+ private _registros;
11
+ private _answers;
12
+ private _dataSet;
13
+ private _ids;
14
+ private __index;
15
+ private _idKatios;
16
+ private _configEmpresa;
17
+ private _trx;
18
+ private jsonConfig;
19
+ private _changeData;
20
+ private __formLoading;
21
+ private _dataExt;
22
+ private _tfmUser;
23
+ private _crudLoaded;
24
+ get user(): any;
25
+ get currentOperation(): Operation | undefined;
26
+ set environment(val: any);
27
+ get environment(): any;
28
+ get onCrudLoaded$(): import("rxjs").Observable<boolean>;
29
+ set crudLoaded(value: boolean);
30
+ get dataExt(): any;
31
+ set dataExt(val: any);
32
+ get index(): number;
33
+ set index(value: number);
34
+ get idKatios(): string;
35
+ set idKatios(value: string);
36
+ get configEmpresa(): Empresa | undefined;
37
+ set configEmpresa(value: Empresa | undefined);
38
+ getURL(operation: Operation, index?: number | undefined, id?: any): string;
39
+ getRegistro(index: number): ConfigRegistro;
40
+ getId(index: number): string;
41
+ get dataset(): any[];
42
+ getData(index: number): any;
43
+ getTrx(index: number): string;
44
+ get totalData(): number;
45
+ get totalRegistros(): number;
46
+ get uiEsquemas(): any[];
47
+ getEsquema(index: number): Shema;
48
+ reset(): void;
49
+ getURLRedirect(initialURL: string): string;
50
+ getUIEsquema(index: number): any;
51
+ /**
52
+ * using data, apply each keyEsquema over each dataset indicated on indexData of each key
53
+ * @param data
54
+ * @param content
55
+ * @returns
56
+ */
57
+ applyObjectKeys(data: any, keysEsquema: keyEsquema[], registro: ConfigRegistro): any;
58
+ applyKey(key: Key | undefined, registro: ConfigRegistro, data: any): void;
59
+ /**
60
+ * Validate conditions on datas
61
+ * @param conditions
62
+ * @param index
63
+ */
64
+ isConditionsCompleted(iConditions: number[], conditions: Condition[], data: any): boolean;
65
+ /**
66
+ * Apply each key from register over string content
67
+ * @param indexRegistro
68
+ * @param content
69
+ * @returns
70
+ */
71
+ applyStringKeys(content: string, index?: number | undefined): string;
72
+ validateDataLocal(operation: Operation, data: any, conditions: Condition[]): string[];
73
+ set esquemas(esquemas: Shema[]);
74
+ get esquemas(): Shema[];
75
+ set ids(ids: string[]);
76
+ set uiEsquemas(uiEsquemas: any[]);
77
+ get registros(): ConfigRegistro[];
78
+ set registros(registros: ConfigRegistro[]);
79
+ setDataSet(data: any, index?: number | undefined): void;
80
+ setTrx(trx: any, index: number): void;
81
+ setAnswers(answer: any, index: number): void;
82
+ getControl(scope: string, esquema: Shema): any;
83
+ getValue(scope: any, data: any): any;
84
+ createObject(esquema: Shema, operation: Operation | undefined): any;
85
+ getValueKey(key: Key | undefined): any;
86
+ setDefaultValue(value: any, operation: Operation): any;
87
+ /**
88
+ * Validate if schema has pdfsign and it's signed, else return false
89
+ * @param index
90
+ * @returns
91
+ */
92
+ isSignedPDF(index: number): any;
93
+ get changeData$(): import("rxjs").Observable<ChangeData | undefined>;
94
+ set changeData(value: ChangeData);
95
+ get formLoading$(): import("rxjs").Observable<Loading>;
96
+ set formLoading(value: Loading);
97
+ loadSession(): boolean;
98
+ get reasons(): Reason[];
99
+ saveProgress(reasons: Reason[]): void;
100
+ redirectToInicio(): void;
101
+ applyValuesOnEvent(event: string, esquema: Shema, key: string | undefined, data: any): void;
102
+ setValueEvent(data: any, params: {
103
+ scope: string[];
104
+ op: string;
105
+ key?: any;
106
+ separator?: string;
107
+ }, esquema: Shema): void;
8
108
  static ɵfac: i0.ɵɵFactoryDeclaration<SfCrudService, never>;
9
109
  static ɵprov: i0.ɵɵInjectableDeclaration<SfCrudService>;
10
110
  }
111
+ export declare class ChangeData {
112
+ value: string;
113
+ scope: string;
114
+ index: number;
115
+ constructor(value: string, scope: string, index: number);
116
+ }
117
+ export interface Loading {
118
+ target: HTMLElement | undefined;
119
+ inProgress: boolean;
120
+ }
@@ -0,0 +1,32 @@
1
+ export declare abstract class Condition {
2
+ type: "equal" | "different" | "or" | "and";
3
+ attrs: any;
4
+ indexData: number | undefined;
5
+ constructor(type: "equal" | "different" | "or" | "and", attrs: any, indexData: number | undefined);
6
+ static instanceContidion(index: number, allConditions: Condition[]): Condition;
7
+ abstract isValid(data: any): boolean;
8
+ }
9
+ export declare class ConditionEqual extends Condition {
10
+ field: string;
11
+ value: any;
12
+ grado: number;
13
+ constructor(field: string, value: any, grado: number, indexData: number | undefined);
14
+ isValid(data: any): boolean;
15
+ }
16
+ export declare class ConditionDifferent extends Condition {
17
+ field: string;
18
+ value: any;
19
+ grado: number;
20
+ constructor(field: string, value: any, grado: number, indexData: number | undefined);
21
+ isValid(data: any): boolean;
22
+ }
23
+ export declare class ConditionOr extends Condition {
24
+ conditions: Condition[];
25
+ constructor(conditions: Condition[], indexData: number | undefined);
26
+ isValid(data: any): boolean;
27
+ }
28
+ export declare class ConditionAnd extends Condition {
29
+ conditions: Condition[];
30
+ constructor(conditions: Condition[], indexData: number | undefined);
31
+ isValid(data: any): boolean;
32
+ }
@@ -0,0 +1,11 @@
1
+ export interface Empresa {
2
+ colors: {
3
+ main: string;
4
+ secondary: string;
5
+ button: string;
6
+ } | undefined;
7
+ icons: {
8
+ banner: string;
9
+ carga: string;
10
+ } | undefined;
11
+ }
@@ -0,0 +1,5 @@
1
+ export declare class Reason {
2
+ type: "ADO";
3
+ params: any;
4
+ constructor(type: "ADO", params: any);
5
+ }
@@ -1,11 +1,12 @@
1
1
  import { Message } from "primeng/api";
2
2
  import { Shema } from "./shema.model";
3
+ import { Condition } from "./Conditions.model";
3
4
  export declare class CrudConfig {
4
5
  idEntidad: string;
5
- tablero: ConfigTablero;
6
- uiEsquema: any;
7
- esquema: Shema;
8
- registro: ConfigRegistro;
6
+ uiEsquemas: any[];
7
+ esquemas: Shema[];
8
+ registros: ConfigRegistro[];
9
+ tablero: ConfigTablero | undefined;
9
10
  }
10
11
  export declare class ConfigTablero {
11
12
  columns: any[];
@@ -19,40 +20,91 @@ export declare class ConfigTablero {
19
20
  }[];
20
21
  }
21
22
  export declare class ConfigRegistro {
22
- operations: Operations[];
23
+ operations: Operation[];
23
24
  btnBack: string;
24
25
  label?: string;
26
+ canBack: boolean;
27
+ constructionId?: ConstructionId;
28
+ keys?: Key[];
29
+ conditions?: Condition[];
25
30
  }
26
- export declare class Operations {
27
- type: string;
28
- server: string;
29
- endpoint: string;
31
+ export declare class Operation {
32
+ type: "update" | "create" | "read" | "ado";
33
+ server?: string;
34
+ endpoint?: string;
30
35
  method: string;
31
- validations: Validations;
32
- redirect?: string;
36
+ validations?: Validations;
37
+ url?: string;
38
+ changeTrx: {
39
+ index: number;
40
+ trx: string;
41
+ }[];
33
42
  errorChecking?: RequestChecking;
34
43
  answerChecking?: RequestChecking;
44
+ keysEsquema?: keyEsquema[];
35
45
  keys?: Key[];
36
46
  }
37
- export declare class Key {
38
- key: string;
39
- scope: string;
40
- data?: string;
47
+ export declare class ConstructionId {
48
+ indexStep: number;
49
+ path: string;
50
+ keys?: Key[];
41
51
  }
42
52
  export declare class Validations {
43
53
  type: string;
44
- required: {
45
- field: string;
46
- message: string;
47
- }[];
54
+ required?: ValidationRequired[];
55
+ equals?: ValidationEqual[];
56
+ different?: ValidationDifferent[];
48
57
  server: string;
49
58
  endpoint: string;
50
59
  operations: any;
51
60
  }
61
+ declare class ValidationRequired {
62
+ field: string;
63
+ message: string;
64
+ conditions?: number[];
65
+ }
66
+ declare class ValidationEqual extends ValidationRequired {
67
+ value: any;
68
+ constructor(value: any);
69
+ }
70
+ declare class ValidationDifferent extends ValidationRequired {
71
+ value: any;
72
+ constructor(value: any);
73
+ }
52
74
  export declare class RequestChecking {
53
- dynamics: Message;
54
- statics: Message;
55
- swal: boolean;
56
- redirect: string;
57
- constructor(dynamics: Message, statics: Message, swal: boolean, redirect: string);
75
+ dynamics: Message | undefined;
76
+ statics: Message | undefined;
77
+ useSwal: boolean;
78
+ redirect: string | undefined;
79
+ cancelRedirect: string | undefined;
80
+ allowContinue: boolean;
81
+ parse: string | undefined;
82
+ constructor(dynamics: Message | undefined, statics: Message | undefined, useSwal: boolean, redirect: string | undefined, cancelRedirect: string | undefined, allowContinue: boolean, parse: string | undefined);
83
+ }
84
+ export declare class Key {
85
+ key: string;
86
+ scope: string;
87
+ indexAnswer?: number;
88
+ indexData?: number;
89
+ indexId?: number;
90
+ data?: string;
91
+ overrideControl?: OverrideConfig;
92
+ }
93
+ export declare class OverrideConfig {
94
+ property: string;
95
+ value: any;
96
+ elseValue?: any;
97
+ conditions?: number[];
98
+ newPropertyValue?: any;
99
+ elseNewPropertyValue?: any;
100
+ }
101
+ export declare class keyEsquema {
102
+ key?: string;
103
+ scope: string;
104
+ indexData?: number;
105
+ indexId?: number;
106
+ isArray?: boolean;
107
+ indexKey?: number;
108
+ canBeValueUndefined?: boolean;
58
109
  }
110
+ export {};
@@ -1,9 +1,36 @@
1
+ import { Calendar } from "primeng/calendar";
1
2
  export declare class Shema {
2
3
  type: string;
3
4
  subtype: string;
4
5
  config?: any;
6
+ tooltip?: string;
7
+ tooltipPosition?: string;
5
8
  properties?: any;
6
9
  enum?: any[];
7
10
  default?: any;
8
11
  validations?: any;
12
+ disabled?: boolean;
13
+ field?: any;
14
+ placeholder?: any;
15
+ unmask?: boolean;
16
+ autocomplete?: string;
17
+ showIcon?: boolean;
18
+ hide?: any;
19
+ locale?: string;
20
+ configuration: ShemaConfig;
21
+ touchUI: any;
22
+ format: any;
23
+ formatMoment?: string;
24
+ useGrouping?: boolean;
25
+ max: any;
26
+ min: any;
27
+ currency: any;
28
+ minFractionDigits: any;
29
+ trueValue: any;
30
+ falseValue: any;
31
+ allowCustomOption: boolean;
9
32
  }
33
+ declare class ShemaConfig {
34
+ calendar?: Calendar;
35
+ }
36
+ export {};
@@ -5,9 +5,16 @@ export declare class GeneralService {
5
5
  private http;
6
6
  generales: string;
7
7
  jsonConfig: any;
8
+ private _idKatios;
8
9
  constructor(http: HttpClient);
10
+ set environment(val: any);
11
+ get environment(): any;
12
+ get idKatios(): string;
13
+ set idKatios(value: string);
9
14
  getCrudByEntidad(idKatios: string, idEntidad: string): Promise<CrudConfig>;
10
- genericRequest(method: string, servidor: string, endpoint: string, data?: any): Promise<Object | undefined>;
15
+ getFiles(urls: string[], names: string[]): Promise<File[]>;
16
+ getExt(name: string): string | undefined;
17
+ genericRequest(method: string, url: string, data?: any): Promise<Object>;
11
18
  static ɵfac: i0.ɵɵFactoryDeclaration<GeneralService, never>;
12
19
  static ɵprov: i0.ɵɵInjectableDeclaration<GeneralService>;
13
20
  }
@@ -0,0 +1,27 @@
1
+ import { Message } from 'primeng/api';
2
+ import { SweetAlertOptions } from 'sweetalert2';
3
+ import { RequestChecking } from '../models/crud-config.model';
4
+ import { SfCrudService } from '../../sf-crud.service';
5
+ import * as i0 from "@angular/core";
6
+ export declare class NotificationService {
7
+ private sfCrudService;
8
+ private _notificationAdded;
9
+ constructor(sfCrudService: SfCrudService);
10
+ addNotification(msg: Message | SweetAlertOptions, requestChecking?: RequestChecking): void;
11
+ notificationAdded$(): import("rxjs").Observable<Notification | undefined>;
12
+ /**
13
+ * Generates message using answerchecking
14
+ * @param currentMsg Default message: Message | SweetAlertOptions
15
+ * @param rta Resquest's response
16
+ * @param answerChecking
17
+ */
18
+ generateMessage(currentMsg: Message | SweetAlertOptions | any, rta: any, requestChecking?: RequestChecking): any;
19
+ genDefaultMessage(severity: "success" | "error", title: string | undefined, detail: string, requestChecking: RequestChecking | undefined): Message | SweetAlertOptions;
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<NotificationService, never>;
21
+ static ɵprov: i0.ɵɵInjectableDeclaration<NotificationService>;
22
+ }
23
+ export declare class Notification {
24
+ msg: Message | SweetAlertOptions;
25
+ requestChecking: RequestChecking | undefined;
26
+ constructor(msg: Message | SweetAlertOptions, requestChecking: RequestChecking | undefined);
27
+ }
@@ -0,0 +1,27 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class StepService {
3
+ private _requestApproval;
4
+ private _desiredIndex;
5
+ private _customChildrenEvents;
6
+ private _currentPosition;
7
+ private _requestApproved;
8
+ get currentIndex(): number;
9
+ set currentIndex(value: number);
10
+ get currentIndex$(): import("rxjs").Observable<number>;
11
+ set requestApproval(newPos: number);
12
+ get requestApproval$(): import("rxjs").Observable<{
13
+ current: number;
14
+ desired: any;
15
+ }>;
16
+ get requestApproved$(): import("rxjs").Observable<boolean>;
17
+ /**
18
+ * Useful to deny or approve request made by requestAprroval
19
+ */
20
+ set requestApproved(approved: boolean);
21
+ set desiredIndex(index: number | undefined);
22
+ addCustomChildrenEvent(name: string, data: any): void;
23
+ reset(): void;
24
+ get customChildrenEvents$(): import("rxjs").Observable<any>;
25
+ static ɵfac: i0.ɵɵFactoryDeclaration<StepService, never>;
26
+ static ɵprov: i0.ɵɵInjectableDeclaration<StepService>;
27
+ }
package/package.json CHANGED
@@ -1,9 +1,16 @@
1
1
  {
2
2
  "name": "sf-crud",
3
- "version": "12.0.5",
3
+ "version": "12.1.0",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^14.2.0",
6
- "@angular/core": "^14.2.0"
6
+ "@angular/core": "^14.2.0",
7
+ "moment": "^2.21.0",
8
+ "jsonpath": "^1.1.1",
9
+ "sf-pdfsign": "^12.0.9",
10
+ "sf-ado": "^12.1.0",
11
+ "sf-simulador": "^12.0.9",
12
+ "sf-loading": "^12.0.0",
13
+ "primeflex": "2.0.0"
7
14
  },
8
15
  "dependencies": {
9
16
  "tslib": "^2.3.0"
package/public-api.d.ts CHANGED
@@ -2,5 +2,11 @@ export * from './lib/components/tablero/tablero.component';
2
2
  export * from './lib/components/registro/registro.component';
3
3
  export * from './lib/components/control/control.component';
4
4
  export * from './lib/sf-crud.component';
5
+ export * from './lib/components/form/form.component';
5
6
  export * from './lib/sf-crud.module';
6
7
  export * from './lib/sf-crud.service';
8
+ export * from './lib/shared/services/step.service';
9
+ export * from './lib/shared/services/notification.service';
10
+ export * from './lib/shared/models/crud-config.model';
11
+ export * from './lib/shared/models/Empresa.model';
12
+ export * from './lib/shared/models/shema.model';