rapida-partner 1.2.0 → 1.3.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 (43) hide show
  1. package/package.json +1 -1
  2. package/rapidaObject.json +1 -1
  3. package/src/examples/components/forms/customer.form.ts +108 -0
  4. package/src/examples/components/lists/customer.list.ts +50 -0
  5. package/src/examples/modules/customer.ts +13 -0
  6. package/src/examples/projects/movieBackoffice.ts +2 -0
  7. package/src/interfaces/{form-condition.interface.ts → condition.interface.ts} +1 -1
  8. package/src/interfaces/form-array.interface.ts +1 -1
  9. package/src/interfaces/form-autocomplete.interface.ts +1 -1
  10. package/src/interfaces/form-button.interface.ts +1 -1
  11. package/src/interfaces/form-datepicker.interface.ts +1 -1
  12. package/src/interfaces/form-fieldset.interface.ts +1 -1
  13. package/src/interfaces/form-file.interface.ts +1 -1
  14. package/src/interfaces/form-inheritance.interface.ts +1 -1
  15. package/src/interfaces/form-input.interface.ts +1 -1
  16. package/src/interfaces/form-numeric.interface.ts +1 -1
  17. package/src/interfaces/form-pattern.interface.ts +1 -1
  18. package/src/interfaces/form-radiogroup.interface.ts +1 -1
  19. package/src/interfaces/form-select.interface.ts +1 -1
  20. package/src/interfaces/form-switch.interface.ts +1 -1
  21. package/src/interfaces/form-tab.interface.ts +1 -1
  22. package/src/interfaces/form.interface.ts +1 -1
  23. package/src/interfaces/list.interface.ts +2 -0
  24. package/src/schemas/{form-condition.ref.json → condition.ref.json} +2 -2
  25. package/src/schemas/form-array.ref.json +1 -1
  26. package/src/schemas/form-autocomplete.ref.json +3 -3
  27. package/src/schemas/form-button.ref.json +1 -1
  28. package/src/schemas/form-common-api-request.ref.json +1 -1
  29. package/src/schemas/form-common-filters-from-other-form-fields.ref.json +1 -1
  30. package/src/schemas/form-datepicker.ref.json +1 -1
  31. package/src/schemas/form-fieldset.ref.json +1 -1
  32. package/src/schemas/form-file.ref.json +1 -1
  33. package/src/schemas/form-inheritance.ref.json +1 -1
  34. package/src/schemas/form-input.ref.json +1 -1
  35. package/src/schemas/form-numeric.ref.json +1 -1
  36. package/src/schemas/form-one-of.ref.json +3 -2
  37. package/src/schemas/form-pattern.ref.json +1 -1
  38. package/src/schemas/form-radiogroup.ref.json +1 -1
  39. package/src/schemas/form-select.ref.json +1 -1
  40. package/src/schemas/form-switch.ref.json +1 -1
  41. package/src/schemas/form-tab.ref.json +2 -2
  42. package/src/schemas/form.ref.json +1 -1
  43. package/src/schemas/list.ref.json +3 -0
@@ -0,0 +1,108 @@
1
+ import { EFormContractDataType } from "../../../enums/form-contract.enum";
2
+ import { EDataType } from "../../../enums/form.enum";
3
+ import type { IForm } from "../../../interfaces/form.interface";
4
+ import { companyForm } from "./company.form";
5
+ import { personForm } from "./person.form";
6
+
7
+ export const customerForm: IForm = {
8
+ title: "Gerenciar cliente",
9
+ id: "customerForm",
10
+ componentType: "form",
11
+ contracts: [
12
+ {
13
+ endpoint: "/customers/people",
14
+ actions: ["create", "update", "get", "getById", "delete"],
15
+ request: {
16
+ entity: "Customers",
17
+ relatedEntity: "People",
18
+ fields: [
19
+ ...(personForm.contracts[0].request?.fields || []),
20
+ { name: "entityId", dataType: EFormContractDataType.UNIQUEIDENTIFIER },
21
+ { name: "entityRelated", dataType: EFormContractDataType.NVARCHAR }
22
+ ]
23
+ },
24
+ conditions: [
25
+ {
26
+ type: "form",
27
+ elements: [
28
+ {
29
+ key: "entityRelated",
30
+ comparisonOperator: "===",
31
+ value: "People"
32
+ }
33
+ ]
34
+ }
35
+ ]
36
+ },
37
+ {
38
+ endpoint: "/customers/companies",
39
+ actions: ["create", "update", "get", "getById", "delete"],
40
+ request: {
41
+ entity: "Customers",
42
+ relatedEntity: "Companies",
43
+ fields: [
44
+ ...(companyForm.contracts[0].request?.fields || []),
45
+ { name: "entityId", dataType: EFormContractDataType.UNIQUEIDENTIFIER },
46
+ { name: "entityRelated", dataType: EFormContractDataType.NVARCHAR }
47
+ ]
48
+ },
49
+ conditions: [
50
+ {
51
+ type: "form",
52
+ elements: [
53
+ {
54
+ key: "entityRelated",
55
+ comparisonOperator: "===",
56
+ value: "Companies"
57
+ }
58
+ ]
59
+ }
60
+ ]
61
+ }
62
+ ],
63
+ elements: [
64
+ {
65
+ type: "select",
66
+ dataType: EDataType.NVARCHAR,
67
+ label: "Tipo de cliente",
68
+ name: "entityRelated",
69
+ options: [
70
+ { label: "Pessoa", value: "People" },
71
+ { label: "Empresa", value: "Companies" }
72
+ ],
73
+ isDisabledOnUpdate: true,
74
+ },
75
+ {
76
+ type: "inheritance",
77
+ form: personForm,
78
+ conditions: [
79
+ {
80
+ type: "form",
81
+ elements: [
82
+ {
83
+ key: "entityRelated",
84
+ comparisonOperator: "===",
85
+ value: "People"
86
+ }
87
+ ]
88
+ }
89
+ ]
90
+ },
91
+ {
92
+ type: "inheritance",
93
+ form: companyForm,
94
+ conditions: [
95
+ {
96
+ type: "form",
97
+ elements: [
98
+ {
99
+ key: "entityRelated",
100
+ comparisonOperator: "===",
101
+ value: "Companies"
102
+ }
103
+ ]
104
+ }
105
+ ]
106
+ }
107
+ ]
108
+ }
@@ -0,0 +1,50 @@
1
+ import type { IList } from "../../../interfaces/list.interface";
2
+
3
+ export const customerList: IList = {
4
+ title: "Lista de clientes",
5
+ id: "customerList",
6
+ componentType: "list",
7
+ dataSource: {
8
+ endpoint: "/customers",
9
+ paramType: "query",
10
+ },
11
+ properties: [
12
+ { label: "Tipo", property: "entityRelated", type: "title", },
13
+ { label: "Nome", property: "People.name", type: "subtitle", conditions: [{ type: "property", elements: [{ key: "entityRelated", comparisonOperator: "===", value: "People" }] }] },
14
+ { label: "Telefone", property: "People.phoneOne", type: "subtitle", conditions: [{ type: "property", elements: [{ key: "entityRelated", comparisonOperator: "===", value: "People" }] }] },
15
+ { label: "E-mail", property: "People.emailOne", type: "subtitle", conditions: [{ type: "property", elements: [{ key: "entityRelated", comparisonOperator: "===", value: "People" }] }] },
16
+ { label: "Nome", property: "Companies.companyName", type: "subtitle", conditions: [{ type: "property", elements: [{ key: "entityRelated", comparisonOperator: "===", value: "Companies" }] }] },
17
+ { label: "Telefone", property: "Companies.phoneOne", type: "subtitle", conditions: [{ type: "property", elements: [{ key: "entityRelated", comparisonOperator: "===", value: "Companies" }] }] },
18
+ { label: "E-mail", property: "Companies.emailOne", type: "subtitle", conditions: [{ type: "property", elements: [{ key: "entityRelated", comparisonOperator: "===", value: "Companies" }] }] },
19
+ ],
20
+ callsToActionMenu: [
21
+ {
22
+ label: "Editar",
23
+ icon: "pencil",
24
+ action: {
25
+ link: {
26
+ endpoint: "/customer-form",
27
+ propertiesAsQueryParam: ["_id"],
28
+ },
29
+ },
30
+ },
31
+ {
32
+ label: "Excluir",
33
+ icon: "delete",
34
+ action: {
35
+ link: {
36
+ endpoint: "/customer-list",
37
+ },
38
+ request: {
39
+ endpoint: "/customers",
40
+ verb: "delete",
41
+ propertiesAsPathParam: ["_id"],
42
+ dialog: {
43
+ title: "Excluir conteúdo",
44
+ message: "Deseja realmente excluir esse conteúdo?",
45
+ }
46
+ }
47
+ },
48
+ }
49
+ ]
50
+ }
@@ -0,0 +1,13 @@
1
+ import type { IModule } from "../../interfaces/project.interface";
2
+ import { customerForm } from "../components/forms/customer.form";
3
+ import { customerList } from "../components/lists/customer.list";
4
+
5
+ export const customerModule: IModule = {
6
+ title: "Cliente",
7
+ id: "customerModule",
8
+ icon: "UserIcon",
9
+ components: [
10
+ customerForm,
11
+ customerList,
12
+ ]
13
+ }
@@ -1,6 +1,7 @@
1
1
  import type { IProject } from "../../interfaces/project.interface";
2
2
  import { characterModule } from "../modules/character";
3
3
  import { companyModule } from "../modules/company";
4
+ import { customerModule } from "../modules/customer";
4
5
  import { movieModule } from "../modules/movie";
5
6
  import { personModule } from "../modules/person";
6
7
 
@@ -60,6 +61,7 @@ export const movieBackoffice: IProject = {
60
61
  baseUrl: "http://localhost:5173",
61
62
  },
62
63
  modules: [
64
+ customerModule,
63
65
  personModule,
64
66
  companyModule,
65
67
  movieModule,
@@ -1,7 +1,7 @@
1
1
  import type { IBusinessRule } from "./project.interface";
2
2
 
3
3
  export interface IFormCondition {
4
- type: "form" | "code" | "array" | "button";
4
+ type: "property" | "enum" | "form" | "code" | "array" | "button";
5
5
  elements?: IConditionElement[];
6
6
  code?: IConditionCode;
7
7
  businessRules?: IBusinessRule[];
@@ -1,4 +1,4 @@
1
- import type { IFormCondition } from "./form-condition.interface";
1
+ import type { IFormCondition } from "./condition.interface";
2
2
  import type { IFormElement } from "./form.interface";
3
3
  import type { IBusinessRule } from "./project.interface";
4
4
 
@@ -1,5 +1,5 @@
1
1
  import type { EDataType } from "../enums/form.enum";
2
- import type { IFormCondition } from "./form-condition.interface";
2
+ import type { IFormCondition } from "./condition.interface";
3
3
  import type { IBusinessRule } from "./project.interface";
4
4
 
5
5
  export interface IFormAutocomplete {
@@ -1,4 +1,4 @@
1
- import type { IFormCondition } from "./form-condition.interface";
1
+ import type { IFormCondition } from "./condition.interface";
2
2
  import type { IApiRequest } from "./form-input.interface";
3
3
  import type { IForm } from "./form.interface";
4
4
  import type { IBusinessRule } from "./project.interface";
@@ -1,4 +1,4 @@
1
- import type { IFormCondition } from "./form-condition.interface";
1
+ import type { IFormCondition } from "./condition.interface";
2
2
  import type { IBusinessRule } from "./project.interface";
3
3
 
4
4
  export interface IFormDatePicker {
@@ -1,4 +1,4 @@
1
- import type { IFormCondition } from "./form-condition.interface";
1
+ import type { IFormCondition } from "./condition.interface";
2
2
  import type { IFormElement } from "./form.interface";
3
3
  import type { IBusinessRule } from "./project.interface";
4
4
 
@@ -1,5 +1,5 @@
1
1
  import type { EDataType } from "../enums/form.enum";
2
- import type { IFormCondition } from "./form-condition.interface";
2
+ import type { IFormCondition } from "./condition.interface";
3
3
  import type { IBusinessRule } from "./project.interface";
4
4
 
5
5
  interface IStorageConfig {
@@ -1,4 +1,4 @@
1
- import type { IFormCondition } from "./form-condition.interface";
1
+ import type { IFormCondition } from "./condition.interface";
2
2
  import type { IForm } from "./form.interface";
3
3
  import type { IBusinessRule } from "./project.interface";
4
4
 
@@ -3,7 +3,7 @@ import type {
3
3
  IApiResponseField,
4
4
  IApiResponseFieldFilter,
5
5
  } from "./form-autocomplete.interface";
6
- import type { IFormCondition } from "./form-condition.interface";
6
+ import type { IFormCondition } from "./condition.interface";
7
7
  import type { IBusinessRule } from "./project.interface";
8
8
 
9
9
  export interface IFormInput {
@@ -1,4 +1,4 @@
1
- import type { IFormCondition } from "./form-condition.interface";
1
+ import type { IFormCondition } from "./condition.interface";
2
2
  import type { IBusinessRule } from "./project.interface";
3
3
 
4
4
  export interface IFormNumericInput {
@@ -1,4 +1,4 @@
1
- import type { IFormCondition } from "./form-condition.interface";
1
+ import type { IFormCondition } from "./condition.interface";
2
2
  import type { IBusinessRule } from "./project.interface";
3
3
 
4
4
  export interface IFormPatternInput {
@@ -1,4 +1,4 @@
1
- import type { IFormCondition } from "./form-condition.interface";
1
+ import type { IFormCondition } from "./condition.interface";
2
2
  import type { IBusinessRule } from "./project.interface";
3
3
 
4
4
  interface IRadioOption {
@@ -1,4 +1,4 @@
1
- import type { IFormCondition } from "./form-condition.interface";
1
+ import type { IFormCondition } from "./condition.interface";
2
2
  import type { IOptionsApi } from "./form-autocomplete.interface";
3
3
  import type { IBusinessRule } from "./project.interface";
4
4
  import type { EDataType } from "../enums/form.enum";
@@ -1,4 +1,4 @@
1
- import type { IFormCondition } from "./form-condition.interface";
1
+ import type { IFormCondition } from "./condition.interface";
2
2
  import type { IBusinessRule } from "./project.interface";
3
3
 
4
4
  export interface IFormSwitch {
@@ -1,4 +1,4 @@
1
- import type { IFormCondition } from "./form-condition.interface";
1
+ import type { IFormCondition } from "./condition.interface";
2
2
  import type { IFormElement } from "./form.interface";
3
3
  import type { IBusinessRule } from "./project.interface";
4
4
 
@@ -3,7 +3,7 @@ import type { EDataType } from "../enums/form.enum";
3
3
  import type { IFormArray } from "./form-array.interface";
4
4
  import type { IFormAutocomplete } from "./form-autocomplete.interface";
5
5
  import type { IFormButton } from "./form-button.interface";
6
- import type { IFormCondition } from "./form-condition.interface";
6
+ import type { IFormCondition } from "./condition.interface";
7
7
  import type { IFormDatePicker } from "./form-datepicker.interface";
8
8
  import type { IFormFieldset } from "./form-fieldset.interface";
9
9
  import type { IFormFile } from "./form-file.interface";
@@ -1,3 +1,4 @@
1
+ import type { IFormCondition } from "./condition.interface";
1
2
  import type { IApiRequest } from "./form-input.interface";
2
3
  import type { IBusinessRule } from "./project.interface";
3
4
 
@@ -20,6 +21,7 @@ export interface IList {
20
21
  link: string; // e.g.: "/user"
21
22
  usePropertyAsQuery?: boolean; // if true then "/user/<email>"
22
23
  };
24
+ conditions?: IFormCondition[];
23
25
  }[]; // properties taken from dataSource
24
26
  cardAsALink?: {
25
27
  link: string; // e.g.: "/user"
@@ -1,12 +1,12 @@
1
1
  {
2
- "$id": "form-condition.ref.json",
2
+ "$id": "condition.ref.json",
3
3
  "type": "array",
4
4
  "items": {
5
5
  "type": "object",
6
6
  "properties": {
7
7
  "type": {
8
8
  "type": "string",
9
- "enum": ["form", "code", "array", "button"]
9
+ "enum": ["property", "enum", "form", "code", "array", "button"]
10
10
  },
11
11
  "elements": {
12
12
  "type": "array",
@@ -6,7 +6,7 @@
6
6
  "const": "array"
7
7
  },
8
8
  "conditions": {
9
- "$ref": "form-condition.ref.json"
9
+ "$ref": "condition.ref.json"
10
10
  },
11
11
  "todo": {
12
12
  "type": "string"
@@ -40,7 +40,7 @@
40
40
  "type": "boolean"
41
41
  },
42
42
  "conditions": {
43
- "$ref": "form-condition.ref.json"
43
+ "$ref": "condition.ref.json"
44
44
  },
45
45
  "validators": {
46
46
  "type": "array",
@@ -96,7 +96,7 @@
96
96
  "type": "boolean"
97
97
  },
98
98
  "conditions": {
99
- "$ref": "form-condition.ref.json"
99
+ "$ref": "condition.ref.json"
100
100
  },
101
101
  "rawQuery": {
102
102
  "type": "string"
@@ -157,7 +157,7 @@
157
157
  "type": "boolean"
158
158
  },
159
159
  "conditions": {
160
- "$ref": "form-condition.ref.json"
160
+ "$ref": "condition.ref.json"
161
161
  },
162
162
  "rawQuery": {
163
163
  "type": "string"
@@ -39,7 +39,7 @@
39
39
  "type": "boolean"
40
40
  },
41
41
  "conditions": {
42
- "$ref": "form-condition.ref.json"
42
+ "$ref": "condition.ref.json"
43
43
  },
44
44
  "apiRequest": {
45
45
  "$ref": "form-common-api-request.ref.json"
@@ -19,7 +19,7 @@
19
19
  "$ref": "form-common-form-fields-filled-by-api-response.ref.json"
20
20
  },
21
21
  "conditions": {
22
- "$ref": "form-condition.ref.json"
22
+ "$ref": "condition.ref.json"
23
23
  },
24
24
  "hasAuthentication": {
25
25
  "type": "boolean"
@@ -11,7 +11,7 @@
11
11
  "type": "string"
12
12
  },
13
13
  "conditions": {
14
- "$ref": "form-condition.ref.json"
14
+ "$ref": "condition.ref.json"
15
15
  }
16
16
  },
17
17
  "required": [
@@ -40,7 +40,7 @@
40
40
  "type": "boolean"
41
41
  },
42
42
  "conditions": {
43
- "$ref": "form-condition.ref.json"
43
+ "$ref": "condition.ref.json"
44
44
  },
45
45
  "todo": {
46
46
  "type": "string"
@@ -6,7 +6,7 @@
6
6
  "const": "fieldset"
7
7
  },
8
8
  "conditions": {
9
- "$ref": "form-condition.ref.json"
9
+ "$ref": "condition.ref.json"
10
10
  },
11
11
  "todo": {
12
12
  "type": "string"
@@ -50,7 +50,7 @@
50
50
  "type": "boolean"
51
51
  },
52
52
  "conditions": {
53
- "$ref": "form-condition.ref.json"
53
+ "$ref": "condition.ref.json"
54
54
  },
55
55
  "todo": {
56
56
  "type": "string"
@@ -11,7 +11,7 @@
11
11
  "$ref": "form.ref.json"
12
12
  },
13
13
  "conditions": {
14
- "$ref": "form-condition.ref.json"
14
+ "$ref": "condition.ref.json"
15
15
  },
16
16
  "todo": {
17
17
  "type": "string"
@@ -40,7 +40,7 @@
40
40
  "type": "boolean"
41
41
  },
42
42
  "conditions": {
43
- "$ref": "form-condition.ref.json"
43
+ "$ref": "condition.ref.json"
44
44
  },
45
45
  "validators": {
46
46
  "type": "array",
@@ -50,7 +50,7 @@
50
50
  "type": "boolean"
51
51
  },
52
52
  "conditions": {
53
- "$ref": "form-condition.ref.json"
53
+ "$ref": "condition.ref.json"
54
54
  },
55
55
  "todo": {
56
56
  "type": "string"
@@ -16,7 +16,8 @@
16
16
  { "$ref": "form-pattern.ref.json" },
17
17
  { "$ref": "form-datepicker.ref.json" },
18
18
  { "$ref": "form-radiogroup.ref.json" },
19
- { "$ref": "form-switch.ref.json" }
19
+ { "$ref": "form-switch.ref.json" },
20
+ { "$ref": "form-inheritance.ref.json" }
20
21
  ]
21
22
  }
22
- }
23
+ }
@@ -29,7 +29,7 @@
29
29
  "type": "boolean"
30
30
  },
31
31
  "conditions": {
32
- "$ref": "form-condition.ref.json"
32
+ "$ref": "condition.ref.json"
33
33
  },
34
34
  "todo": {
35
35
  "type": "string"
@@ -54,7 +54,7 @@
54
54
  "type": "boolean"
55
55
  },
56
56
  "conditions": {
57
- "$ref": "form-condition.ref.json"
57
+ "$ref": "condition.ref.json"
58
58
  },
59
59
  "todo": {
60
60
  "type": "string"
@@ -40,7 +40,7 @@
40
40
  "type": "boolean"
41
41
  },
42
42
  "conditions": {
43
- "$ref": "form-condition.ref.json"
43
+ "$ref": "condition.ref.json"
44
44
  },
45
45
  "validators": {
46
46
  "type": "array",
@@ -29,7 +29,7 @@
29
29
  "type": "boolean"
30
30
  },
31
31
  "conditions": {
32
- "$ref": "form-condition.ref.json"
32
+ "$ref": "condition.ref.json"
33
33
  },
34
34
  "businessRules": {
35
35
  "$ref": "business-rules.ref.json"
@@ -29,7 +29,7 @@
29
29
  "$ref": "form-one-of.ref.json"
30
30
  },
31
31
  "conditions": {
32
- "$ref": "form-condition.ref.json"
32
+ "$ref": "condition.ref.json"
33
33
  }
34
34
  },
35
35
  "required": [
@@ -40,7 +40,7 @@
40
40
  }
41
41
  },
42
42
  "conditions": {
43
- "$ref": "form-condition.ref.json"
43
+ "$ref": "condition.ref.json"
44
44
  }
45
45
  },
46
46
  "required": [
@@ -125,7 +125,7 @@
125
125
  "required": ["entity", "fields"]
126
126
  },
127
127
  "conditions": {
128
- "$ref": "form-condition.ref.json"
128
+ "$ref": "condition.ref.json"
129
129
  }
130
130
  },
131
131
  "required": ["endpoint", "actions"]
@@ -75,6 +75,9 @@
75
75
  }
76
76
  },
77
77
  "required": ["link"]
78
+ },
79
+ "conditions": {
80
+ "$ref": "condition.ref.json"
78
81
  }
79
82
  },
80
83
  "required": ["property"]