form-aurora-stefanini 0.1.0 → 0.1.3

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 (46) hide show
  1. package/karma.conf.js +32 -0
  2. package/ng-package.json +7 -0
  3. package/package.json +17 -28
  4. package/src/lib/Components/from-aurora/form-aurora.component.css +117 -0
  5. package/src/lib/Components/from-aurora/form-aurora.component.html +343 -0
  6. package/src/lib/Components/from-aurora/form-aurora.component.spec.ts +25 -0
  7. package/src/lib/Components/from-aurora/form-aurora.component.ts +725 -0
  8. package/src/lib/Models/company-parameters.ts +16 -0
  9. package/src/lib/Models/company.ts +25 -0
  10. package/src/lib/Models/fill.ts +6 -0
  11. package/src/lib/Models/state.ts +5 -0
  12. package/src/lib/Models/step.ts +15 -0
  13. package/src/lib/Models/stepMethod.ts +9 -0
  14. package/src/lib/form-aurora.module.ts +18 -0
  15. package/src/lib/services/TemplateService.ts +84 -0
  16. package/src/lib/services/data.service.ts +83 -0
  17. package/src/lib/utils/regex.ts +51 -0
  18. package/src/public-api.ts +9 -0
  19. package/src/test.ts +21 -0
  20. package/tsconfig.lib.json +26 -0
  21. package/tsconfig.spec.json +17 -0
  22. package/tslint.json +17 -0
  23. package/bundles/form-aurora-stefanini.umd.js +0 -975
  24. package/bundles/form-aurora-stefanini.umd.js.map +0 -1
  25. package/bundles/form-aurora-stefanini.umd.min.js +0 -16
  26. package/bundles/form-aurora-stefanini.umd.min.js.map +0 -1
  27. package/esm2015/form-aurora-stefanini.js +0 -5
  28. package/esm2015/lib/fill.js +0 -3
  29. package/esm2015/lib/form-aurora.component.js +0 -681
  30. package/esm2015/lib/form-aurora.module.js +0 -22
  31. package/esm2015/public-api.js +0 -6
  32. package/esm5/form-aurora-stefanini.js +0 -5
  33. package/esm5/lib/fill.js +0 -7
  34. package/esm5/lib/form-aurora.component.js +0 -733
  35. package/esm5/lib/form-aurora.module.js +0 -25
  36. package/esm5/public-api.js +0 -6
  37. package/fesm2015/form-aurora-stefanini.js +0 -703
  38. package/fesm2015/form-aurora-stefanini.js.map +0 -1
  39. package/fesm5/form-aurora-stefanini.js +0 -758
  40. package/fesm5/form-aurora-stefanini.js.map +0 -1
  41. package/form-aurora-stefanini.d.ts +0 -4
  42. package/form-aurora-stefanini.metadata.json +0 -1
  43. package/lib/fill.d.ts +0 -6
  44. package/lib/form-aurora.component.d.ts +0 -106
  45. package/lib/form-aurora.module.d.ts +0 -2
  46. package/public-api.d.ts +0 -2
@@ -0,0 +1,16 @@
1
+ export class companyParameter {
2
+ companyId: number
3
+ parameterId: number
4
+ }
5
+
6
+ export class Parameter {
7
+ dataType: string
8
+ id: number
9
+ parameter: string
10
+ type: string
11
+ }
12
+
13
+ export class CompanyParameters {
14
+ id: number
15
+ value: string
16
+ }
@@ -0,0 +1,25 @@
1
+ import { State } from './state'
2
+ import { CompanyParameters } from './company-parameters';
3
+ import { Step } from './step';
4
+
5
+ export interface Company {
6
+ id?: number
7
+ name: string
8
+ nameUrl: string
9
+ company: string
10
+ document: number
11
+ state: State
12
+ state_id: State
13
+ activity_id?: string
14
+ address?: string
15
+ phone?: number
16
+ logo?: any
17
+ contact_name?: string
18
+ contact_email?: string
19
+ contact_phone?: number
20
+ companyParameters?: CompanyParameters[]
21
+ companyStepsRequestTurn: Array<Step>
22
+ looknFeelVersion?:number
23
+
24
+
25
+ }
@@ -0,0 +1,6 @@
1
+ export class Fill {
2
+ id: number
3
+ value: string
4
+ type: number
5
+ data: string
6
+ }
@@ -0,0 +1,5 @@
1
+ export interface State {
2
+ id: number
3
+ state?: string
4
+ name?:string
5
+ }
@@ -0,0 +1,15 @@
1
+ import { StepMethod } from "./stepMethod"
2
+
3
+ export interface Step {
4
+ id: number
5
+ step: string
6
+ description: string
7
+ stepOrder?: number
8
+ visibility?: boolean
9
+ stepMethod?: StepMethod
10
+ stepData?: any
11
+ value?: number
12
+ code?: string
13
+ simpleFlowSelectType? :number
14
+ viewData?:any
15
+ }
@@ -0,0 +1,9 @@
1
+
2
+ export class StepMethod {
3
+ id?: number
4
+ mainStep?: number
5
+ nextStep?: number
6
+ mainEndpoint?: string
7
+ nextEndpoint?: string
8
+ level?: number
9
+ }
@@ -0,0 +1,18 @@
1
+ import { NgModule } from '@angular/core';
2
+
3
+ import { CommonModule } from '@angular/common';
4
+ import { FormsModule } from '@angular/forms';
5
+ import { RecaptchaModule, RecaptchaFormsModule } from 'ng-recaptcha';
6
+ import { FormAuroraComponent } from '../public-api';
7
+
8
+ @NgModule({
9
+ declarations: [FormAuroraComponent],
10
+ imports: [
11
+ CommonModule,
12
+ FormsModule,
13
+ RecaptchaModule,
14
+ RecaptchaFormsModule
15
+ ],
16
+ exports: [FormAuroraComponent]
17
+ })
18
+ export class FormAuroraModule { }
@@ -0,0 +1,84 @@
1
+ import { Injectable } from "@angular/core";
2
+ import { HttpClient } from '@angular/common/http';
3
+ import { Observable } from "rxjs";
4
+
5
+ @Injectable({
6
+ providedIn: "root",
7
+ })
8
+ export class CommonTemplateService {
9
+ constructor(private http: HttpClient) { }
10
+ getTemplate(idCompany,url): Observable<any> {
11
+ return this.http.get<any>(`${url}/template/findByCompany/` + idCompany)
12
+ }
13
+ reloadStylePage(currentDocument: Document, templateCompany) {
14
+ let objects = (<HTMLCollection>currentDocument.getElementsByClassName("template"));
15
+ // debugger
16
+ for (let index = 0; index < objects.length; index++) {
17
+ const item = objects[index];
18
+ let itemClassName = typeof (item.className) == "object" ? item.className['baseVal'] : item.className
19
+ let indexStart = itemClassName.indexOf("template")
20
+ // let keyString = itemClassName.substring(indexStart, itemClassName.length).split(' ')[1]
21
+ const keysString = itemClassName.substring(indexStart, itemClassName.length).split(' ').filter(a => a.indexOf('tmp_') !== -1);
22
+
23
+ for (let keyString of keysString) {
24
+ if (templateCompany[keyString] != undefined) {
25
+ if (keyString.includes("tmp_type_text_")) {
26
+
27
+ if (keyString.includes('tmp_type_text_6')) {
28
+ item['style'].setProperty('--' + keyString, templateCompany[keyString].color)
29
+ } else {
30
+ item["style"].color = templateCompany[keyString].color
31
+
32
+ if(itemClassName.includes("ratting-faces-v2"))
33
+ {
34
+ item["style"].backgroundColor = templateCompany[keyString].color;
35
+ item["style"].borderColor = templateCompany[keyString].color;
36
+ item["style"].color = "white"
37
+ }
38
+ }
39
+ }
40
+
41
+ if (keyString.includes("title1")) {
42
+ /*item["style"].color = templateCompany[keyString].color*/
43
+ item["style"].color = "#EE7E0E";
44
+ }
45
+
46
+ if (keyString.includes("tmp_type_svg_")) {
47
+ item["style"].fill = templateCompany[keyString].fill
48
+ }
49
+
50
+ if (keyString.includes("tmp_type_img_")) {
51
+ if (item.nodeName == "IMG") {
52
+ item["src"] = templateCompany[keyString].src;
53
+ }
54
+ else {
55
+ item["style"].background = templateCompany[keyString].background;
56
+ item["style"].backgroundSize = templateCompany[keyString].backgroundSize;
57
+ }
58
+ }
59
+
60
+ if (keyString.includes("tmp_type_head_")) {
61
+ item["style"].setProperty('--' + keyString, templateCompany[keyString].color)
62
+ }
63
+
64
+ if (keyString.includes("tmp_type_footer_")) {
65
+ // debugger
66
+ item["style"].setProperty('--' + keyString, templateCompany[keyString].color)
67
+ }
68
+
69
+ if (itemClassName.includes("tmp_type_cnt_")) {
70
+ indexStart = itemClassName.indexOf("tmp_type_cnt_")
71
+ keyString = itemClassName.substring(indexStart, itemClassName.length).split(' ')[0]
72
+ if (!!templateCompany[keyString]) {
73
+ item["style"].backgroundColor = templateCompany[keyString].backgroundColor
74
+ }
75
+ }
76
+
77
+ if (keyString.includes('tmp_type_font_')) {
78
+ item['style'].setProperty('font-family', templateCompany[keyString]['font-family'], 'important');
79
+ }
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
@@ -0,0 +1,83 @@
1
+ import { Injectable } from "@angular/core";
2
+
3
+ @Injectable({
4
+ providedIn: "root",
5
+ })
6
+ export class CommonDataService {
7
+ public static COMPANY_KEY: string = "company";
8
+ public static DOC_NUMBER_KEY: string = "docNumber";
9
+ public static DOC_TYPE_KEY: string = "docType";
10
+ public static PHONE_KEY: string = "phone";
11
+ public static TYPE_ATTENTION_KEY: string = "typeAttention";
12
+ public static OFFICE_KEY: string = "office";
13
+ public static TYPE_TURN_KEY: string = "typeTurn";
14
+ public static SERVICE_KEY: string = "service";
15
+ public static TURN_KEY: string = "turn";
16
+ public static PROGRAMED_TURN_KEY: string = "programedTurn";
17
+ public static REQUEST_CALL: string = "requestCall";
18
+ public static FORM_DATA: string = "formdata";
19
+ public static TEMPLATE: string = "template";
20
+ public static TURN_RESCHEDULE: string = "turnReschedule";
21
+ public static USER_GENDER: string = "genderUser";
22
+ public static AUTO_REDIRECT: string = "autoRedirect";
23
+ public static SCHEDULE_GENERAL: string = "scheduleGeneral"
24
+ public static AGENDAMIENTO_TTP: string = "potencialCustomer"
25
+ public static SINGLE_PAGE_ONE: string = "singlePageOne"
26
+ public static AVAILABLE_SCHEDULE_GRAL: string = "availableScheduleGral"
27
+ public static PROFILE: string = "profile"
28
+ public static PAGE_NEXT: string = "pageNext"
29
+ public static STEPS: string = "steps"
30
+ public static TYPE_TURN_ID: string = "typeTurnId"
31
+
32
+
33
+ constructor() { }
34
+
35
+ private getData(): Map<string, any> {
36
+ if (localStorage.getItem("data") != null) {
37
+ var data: Map<string, any> = new Map(JSON.parse(localStorage.getItem("data")));
38
+ return data;
39
+ } else {
40
+ /** Error get cookie */
41
+ }
42
+ }
43
+
44
+ private setData(data: Map<string, any>) {
45
+ localStorage.setItem("data", JSON.stringify(Array.from(data.entries())));
46
+ }
47
+
48
+ initData(): void {
49
+ this.setData(new Map());
50
+ }
51
+
52
+ putValue(key: string, value: any): void {
53
+ var data: Map<string, any> = this.getData();
54
+ data = data.set(key, value);
55
+ this.setData(data);
56
+ }
57
+
58
+ addValue(keyPrimary: string, keySecond: string, value): void {
59
+ var data: Map<string, any> = this.getValue(keyPrimary);
60
+ var dataReturn: Map<string, any> = this.getData();
61
+ data[keySecond] = value;
62
+ dataReturn = dataReturn.set(keyPrimary, data);
63
+ this.setData(dataReturn);
64
+ }
65
+
66
+ getValue(key: string): any {
67
+ return !this.getData() || !this.getData().has(key) ? undefined : this.getData().get(key);
68
+ }
69
+
70
+ hasValue(key: string): any {
71
+ return this.getData() != undefined ? this.getData().has(key) : null;
72
+ }
73
+
74
+ clearMap(): void {
75
+ if (this.hasValue(CommonDataService.COMPANY_KEY)) {
76
+ let company = this.getValue(CommonDataService.COMPANY_KEY);
77
+ this.initData();
78
+ this.putValue(CommonDataService.COMPANY_KEY, company);
79
+ } else {
80
+ this.initData();
81
+ }
82
+ }
83
+ }
@@ -0,0 +1,51 @@
1
+ export const regexType = {
2
+ default: {
3
+ exp: '^[a-zA-Z0-9ñÑáéíóúüÁÉÍÓÚÜ,.\\-_\\s]*$',
4
+ message: 'Formato inválido, no use caracteres especiales'
5
+ },
6
+ word: {
7
+ exp: '^[a-zA-Z0-9ñÑáéíóúüÁÉÍÓÚÜ,.\\-_]*$',
8
+ message: 'Formato inválido, no use caracteres especiales ni espacios'
9
+ },
10
+ name: {
11
+ exp: '^[a-zA-ZñÑáéíóúüÁÉÍÓÚÜ\\s]*$',
12
+ message: 'Formato inválido, no use caracteres especiales ni números'
13
+ },
14
+ alphanumberWord: {
15
+ exp: '^[a-zA-Z0-9]*$',
16
+ message: 'Formato alfanúmerico inválido'
17
+ },
18
+ charWord: {
19
+ exp: '^[a-zA-Z]*$',
20
+ message: 'Formato de caracteres inválido'
21
+ },
22
+ anyWord: {
23
+ exp: '^\\S*$',
24
+ message: 'Formato inválido'
25
+ },
26
+ percent: {
27
+ exp: '^100$|^[0-9]{1,2}$|^[0-9]{1,2}\\.[0-9]{1,2}$',
28
+ message: 'Formato de porcentaje inválido, use el punto decimal (.)'
29
+ },
30
+ email: {
31
+ exp: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
32
+ message: 'Formato de e-mail inválido'
33
+ },
34
+ number: {
35
+ exp: '^[0-9]*$',
36
+ message: 'Formato de número inválido'
37
+ },
38
+ time24: {
39
+ exp: '^([01]?[0-9]|2[0-3]):[0-5][0-9]$',
40
+ message: 'Formato de hora militar inválido, use 23:45'
41
+ },
42
+ date: {
43
+ exp: '^[0-9]{1,2}/[0-9]{1,2}/[0-9]{4}$',
44
+ message: 'Formato de fecha inválido',
45
+ internal: 'dd/mm/yyyy'
46
+ },
47
+ password: {
48
+ exp: '^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$',
49
+ message: 'La contraseña debe incluir una longitud mínima de 8 caracteres, una letra mayúscula, una letra minúscula, un número, un carácter especial (@#$%^&+=/.) y no debe tener espacios.'
50
+ }
51
+ };
@@ -0,0 +1,9 @@
1
+ /*
2
+ * Public API Surface of form-aurora
3
+ */
4
+ export * from './lib/Components/from-aurora/form-aurora.component'
5
+ export * from './lib/services/TemplateService';
6
+ export * from './lib/services/data.service';
7
+ export * from './lib/utils/regex';
8
+ export * from './lib/Models/fill';
9
+ export * from './lib/form-aurora.module';
package/src/test.ts ADDED
@@ -0,0 +1,21 @@
1
+ // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2
+
3
+ import 'zone.js/dist/zone';
4
+ import 'zone.js/dist/zone-testing';
5
+ import { getTestBed } from '@angular/core/testing';
6
+ import {
7
+ BrowserDynamicTestingModule,
8
+ platformBrowserDynamicTesting
9
+ } from '@angular/platform-browser-dynamic/testing';
10
+
11
+ declare const require: any;
12
+
13
+ // First, initialize the Angular testing environment.
14
+ getTestBed().initTestEnvironment(
15
+ BrowserDynamicTestingModule,
16
+ platformBrowserDynamicTesting()
17
+ );
18
+ // Then we find all the tests.
19
+ const context = require.context('./', true, /\.spec\.ts$/);
20
+ // And load the modules.
21
+ context.keys().map(context);
@@ -0,0 +1,26 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../out-tsc/lib",
5
+ "target": "es2015",
6
+ "declaration": true,
7
+ "inlineSources": true,
8
+ "types": [],
9
+ "lib": [
10
+ "dom",
11
+ "es2018"
12
+ ]
13
+ },
14
+ "angularCompilerOptions": {
15
+ "annotateForClosureCompiler": true,
16
+ "skipTemplateCodegen": true,
17
+ "strictMetadataEmit": true,
18
+ "fullTemplateTypeCheck": true,
19
+ "strictInjectionParameters": true,
20
+ "enableResourceInlining": true
21
+ },
22
+ "exclude": [
23
+ "src/test.ts",
24
+ "**/*.spec.ts"
25
+ ]
26
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../out-tsc/spec",
5
+ "types": [
6
+ "jasmine",
7
+ "node"
8
+ ]
9
+ },
10
+ "files": [
11
+ "src/test.ts"
12
+ ],
13
+ "include": [
14
+ "**/*.spec.ts",
15
+ "**/*.d.ts"
16
+ ]
17
+ }
package/tslint.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "../../tslint.json",
3
+ "rules": {
4
+ "directive-selector": [
5
+ true,
6
+ "attribute",
7
+ "lib",
8
+ "camelCase"
9
+ ],
10
+ "component-selector": [
11
+ true,
12
+ "element",
13
+ "lib",
14
+ "kebab-case"
15
+ ]
16
+ }
17
+ }