rapida-partner 1.1.8 → 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.
- package/package.json +1 -1
- package/rapidaObject.json +1 -1
- package/src/enums/form.enum.ts +1 -0
- package/src/examples/components/forms/customer.form.ts +108 -0
- package/src/examples/components/lists/customer.list.ts +50 -0
- package/src/examples/modules/customer.ts +13 -0
- package/src/examples/projects/movieBackoffice.ts +2 -0
- package/src/interfaces/{form-condition.interface.ts → condition.interface.ts} +1 -1
- package/src/interfaces/form-array.interface.ts +1 -1
- package/src/interfaces/form-autocomplete.interface.ts +1 -1
- package/src/interfaces/form-button.interface.ts +1 -1
- package/src/interfaces/form-datepicker.interface.ts +1 -1
- package/src/interfaces/form-fieldset.interface.ts +1 -1
- package/src/interfaces/form-file.interface.ts +1 -1
- package/src/interfaces/form-inheritance.interface.ts +11 -0
- package/src/interfaces/form-input.interface.ts +1 -1
- package/src/interfaces/form-numeric.interface.ts +1 -1
- package/src/interfaces/form-pattern.interface.ts +1 -1
- package/src/interfaces/form-radiogroup.interface.ts +1 -1
- package/src/interfaces/form-select.interface.ts +1 -1
- package/src/interfaces/form-switch.interface.ts +1 -1
- package/src/interfaces/form-tab.interface.ts +1 -1
- package/src/interfaces/form.interface.ts +6 -1
- package/src/interfaces/list.interface.ts +2 -0
- package/src/schemas/{form-condition.ref.json → condition.ref.json} +2 -2
- package/src/schemas/form-array.ref.json +1 -1
- package/src/schemas/form-autocomplete.ref.json +3 -3
- package/src/schemas/form-button.ref.json +1 -1
- package/src/schemas/form-common-api-request.ref.json +1 -1
- package/src/schemas/form-common-filters-from-other-form-fields.ref.json +1 -1
- package/src/schemas/form-datepicker.ref.json +1 -1
- package/src/schemas/form-fieldset.ref.json +1 -1
- package/src/schemas/form-file.ref.json +1 -1
- package/src/schemas/form-inheritance.ref.json +24 -0
- package/src/schemas/form-input.ref.json +1 -1
- package/src/schemas/form-numeric.ref.json +1 -1
- package/src/schemas/form-one-of.ref.json +3 -2
- package/src/schemas/form-pattern.ref.json +1 -1
- package/src/schemas/form-radiogroup.ref.json +1 -1
- package/src/schemas/form-select.ref.json +1 -1
- package/src/schemas/form-switch.ref.json +1 -1
- package/src/schemas/form-tab.ref.json +2 -2
- package/src/schemas/form.ref.json +3 -0
- package/src/schemas/list.ref.json +3 -0
- package/src/schemas/types-datatype.ref.json +1 -0
package/src/enums/form.enum.ts
CHANGED
|
@@ -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,5 +1,5 @@
|
|
|
1
1
|
import type { EDataType } from "../enums/form.enum";
|
|
2
|
-
import type { IFormCondition } from "./
|
|
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 "./
|
|
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,5 +1,5 @@
|
|
|
1
1
|
import type { EDataType } from "../enums/form.enum";
|
|
2
|
-
import type { IFormCondition } from "./
|
|
2
|
+
import type { IFormCondition } from "./condition.interface";
|
|
3
3
|
import type { IBusinessRule } from "./project.interface";
|
|
4
4
|
|
|
5
5
|
interface IStorageConfig {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IFormCondition } from "./condition.interface";
|
|
2
|
+
import type { IForm } from "./form.interface";
|
|
3
|
+
import type { IBusinessRule } from "./project.interface";
|
|
4
|
+
|
|
5
|
+
export interface IFormInheritance {
|
|
6
|
+
type: "inheritance";
|
|
7
|
+
form: IForm;
|
|
8
|
+
conditions?: IFormCondition[];
|
|
9
|
+
todo?: string;
|
|
10
|
+
businessRules?: IBusinessRule[];
|
|
11
|
+
}
|
|
@@ -3,7 +3,7 @@ import type {
|
|
|
3
3
|
IApiResponseField,
|
|
4
4
|
IApiResponseFieldFilter,
|
|
5
5
|
} from "./form-autocomplete.interface";
|
|
6
|
-
import type { IFormCondition } from "./
|
|
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 "./
|
|
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";
|
|
@@ -3,9 +3,11 @@ 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 "./condition.interface";
|
|
6
7
|
import type { IFormDatePicker } from "./form-datepicker.interface";
|
|
7
8
|
import type { IFormFieldset } from "./form-fieldset.interface";
|
|
8
9
|
import type { IFormFile } from "./form-file.interface";
|
|
10
|
+
import type { IFormInheritance } from "./form-inheritance.interface";
|
|
9
11
|
import type { IFormInput } from "./form-input.interface";
|
|
10
12
|
import type { IFormSelect } from "./form-select.interface";
|
|
11
13
|
import type { IFormTab } from "./form-tab.interface";
|
|
@@ -24,6 +26,7 @@ export interface IForm {
|
|
|
24
26
|
endpoint: string;
|
|
25
27
|
actions: ("create" | "get" | "getById" | "update" | "delete" | "clone")[];
|
|
26
28
|
request?: IContractRequest;
|
|
29
|
+
conditions?: IFormCondition[];
|
|
27
30
|
}[];
|
|
28
31
|
kanban?: {
|
|
29
32
|
status: "toDo" | "inProgress" | "done";
|
|
@@ -43,6 +46,7 @@ interface IFormContractGeneral {
|
|
|
43
46
|
|
|
44
47
|
interface IContractRequest {
|
|
45
48
|
entity: string,
|
|
49
|
+
relatedEntity?: string,
|
|
46
50
|
description?: string,
|
|
47
51
|
fields: IContractRequestField[]
|
|
48
52
|
}
|
|
@@ -86,4 +90,5 @@ export type IFormElement =
|
|
|
86
90
|
| IFormFieldset
|
|
87
91
|
| IFormButton
|
|
88
92
|
| IFormFile
|
|
89
|
-
| IFormDatePicker
|
|
93
|
+
| IFormDatePicker
|
|
94
|
+
| IFormInheritance;
|
|
@@ -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": "
|
|
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",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"type": "boolean"
|
|
41
41
|
},
|
|
42
42
|
"conditions": {
|
|
43
|
-
"$ref": "
|
|
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": "
|
|
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": "
|
|
160
|
+
"$ref": "condition.ref.json"
|
|
161
161
|
},
|
|
162
162
|
"rawQuery": {
|
|
163
163
|
"type": "string"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "form-inheritance.ref.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"type": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"const": "inheritance"
|
|
9
|
+
},
|
|
10
|
+
"form": {
|
|
11
|
+
"$ref": "form.ref.json"
|
|
12
|
+
},
|
|
13
|
+
"conditions": {
|
|
14
|
+
"$ref": "condition.ref.json"
|
|
15
|
+
},
|
|
16
|
+
"todo": {
|
|
17
|
+
"type": "string"
|
|
18
|
+
},
|
|
19
|
+
"businessRules": {
|
|
20
|
+
"$ref": "business-rules.ref.json"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"required": ["type", "form"]
|
|
24
|
+
}
|
|
@@ -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
|
"$ref": "form-one-of.ref.json"
|
|
30
30
|
},
|
|
31
31
|
"conditions": {
|
|
32
|
-
"$ref": "
|
|
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": "
|
|
43
|
+
"$ref": "condition.ref.json"
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"required": [
|