rapida-partner 1.16.6 → 1.16.8

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.
@@ -62,9 +62,9 @@ export const characterForm: IForm = {
62
62
  type: "input",
63
63
  dataType: EDataType.NVARCHAR,
64
64
  isRequired: true,
65
- conditions: [
66
- {
67
- type: "form",
65
+ conditions:
66
+ {
67
+ form: {
68
68
  elements: [
69
69
  {
70
70
  key: "characterBreed",
@@ -72,8 +72,8 @@ export const characterForm: IForm = {
72
72
  comparisonOperator: "==="
73
73
  }
74
74
  ]
75
- }
76
- ]
75
+ },
76
+ }
77
77
  },
78
78
  {
79
79
  type: "select",
@@ -1,18 +1,24 @@
1
1
  import type { IBusinessRule } from "./project.interface";
2
2
 
3
- export interface IFormCondition {
4
- type: "property" | "enum" | "form" | "code" | "array" | "button";
3
+ // Os tipos possíveis
4
+ type ConditionType = "property" | "enum" | "form" | "code" | "array" | "button";
5
+
6
+ // Conteúdo da condição (sem o type, pois a chave já diz o que é)
7
+ interface IConditionBody {
5
8
  elements?: IConditionElement[];
6
9
  code?: IConditionCode;
7
10
  businessRules?: IBusinessRule[];
8
11
  conditionResponse?: "show" | "hide" | "enable" | "disable" | "fillFields";
9
- fillFields?: {
10
- fieldKey: string;
11
- value: any;
12
- }[];
13
- buttonId?: string; // For button conditions
12
+ fillFields?:Array<{ fieldKey: string; value: any }>;
13
+ buttonId?: string;
14
14
  }
15
15
 
16
+ // A estrutura principal agora é um objeto onde as chaves são opcionais,
17
+ // mas se existirem, são únicas por definição.
18
+ export type IFormCondition = {
19
+ [K in ConditionType]?: IConditionBody;
20
+ };
21
+
16
22
  interface IConditionElement {
17
23
  key: string;
18
24
  value?: any;
@@ -7,7 +7,7 @@ export interface IFormArray {
7
7
  name: string;
8
8
  label: string;
9
9
  elements: IFormElement[];
10
- conditions?: IFormCondition[];
10
+ conditions?: IFormCondition;
11
11
  todo?: string;
12
12
  businessRules?: IBusinessRule[];
13
13
  elementDescription?: string;
@@ -15,7 +15,7 @@ export interface IFormAutocomplete {
15
15
  isHidden?: boolean;
16
16
  isRequired?: boolean;
17
17
  isUnique?: boolean;
18
- conditions?: IFormCondition[];
18
+ conditions?: IFormCondition;
19
19
  validators?: ("cpf" | "cnpj")[];
20
20
  todo?: string;
21
21
  optionsApi?: IOptionsApi;
@@ -37,7 +37,7 @@ export interface IOptionsApi {
37
37
  filtersFromOtherFormFields?: IApiResponseFieldFilter[];
38
38
  isNotKunlatekResponse?: boolean;
39
39
  rawQuery?: string;
40
- conditions?: IFormCondition[];
40
+ conditions?: IFormCondition;
41
41
  }
42
42
 
43
43
  export interface IApiResponseField {
@@ -49,5 +49,5 @@ export interface IApiResponseField {
49
49
  export interface IApiResponseFieldFilter {
50
50
  formFieldName: string;
51
51
  filterPropertyName: string;
52
- conditions?: IFormCondition[];
52
+ conditions?: IFormCondition;
53
53
  }
@@ -1,7 +1,6 @@
1
1
  import type { IFormCondition } from "./condition.interface";
2
2
  import type { IApiRequest } from "./form-input.interface";
3
- import type { IForm } from "./form.interface";
4
- import type { IBusinessRule } from "./project.interface";
3
+ import type { IBusinessRule, IComponent } from "./project.interface";
5
4
 
6
5
  export interface IFormButton {
7
6
  type: "button";
@@ -14,7 +13,7 @@ export interface IFormButton {
14
13
  isDisabled?: boolean;
15
14
  isDisabledOnUpdate?: boolean;
16
15
  isHidden?: boolean;
17
- conditions?: IFormCondition[];
16
+ conditions?: IFormCondition;
18
17
  apiRequest?: IApiRequest;
19
18
  onSuccessRedirect?: {
20
19
  url: string;
@@ -27,14 +26,14 @@ export interface IFormButton {
27
26
  modal?: {
28
27
  id: string;
29
28
  title: string;
30
- modal: IForm;
29
+ modal: IComponent;
31
30
  size?: "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl";
32
31
  closeButtonLabel?: string;
33
32
  actionButtonLabel?: string;
34
33
  actionButtonType?: "submit" | "reset" | "link" | "apiRequest" | "modal";
35
34
  actionButtonApiRequest?: IApiRequest;
36
35
  actionButtonBusinessRules?: IBusinessRule[];
37
- conditions: IFormCondition[];
36
+ conditions?: IFormCondition;
38
37
  },
39
38
  toast?: {
40
39
  id: string;
@@ -44,7 +43,7 @@ export interface IFormButton {
44
43
  size?: "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl";
45
44
  type: "success" | "error" | "warning" | "info";
46
45
  businessRules?: IBusinessRule[];
47
- conditions: IFormCondition[];
46
+ conditions: IFormCondition;
48
47
  },
49
48
  link?: {
50
49
  url: string;
@@ -13,7 +13,7 @@ export interface IFormDatePicker {
13
13
  isDisabledOnUpdate?: boolean;
14
14
  isHidden?: boolean;
15
15
  isRequired?: boolean;
16
- conditions?: IFormCondition[];
16
+ conditions?: IFormCondition;
17
17
  todo?: string;
18
18
  businessRules?: IBusinessRule[];
19
19
  elementDescription?: string;
@@ -4,7 +4,7 @@ import type { IBusinessRule } from "./project.interface";
4
4
 
5
5
  export interface IFormFieldset {
6
6
  type: "fieldset";
7
- conditions?: IFormCondition[];
7
+ conditions?: IFormCondition;
8
8
  todo?: string;
9
9
  id: string;
10
10
  title: string;
@@ -22,7 +22,7 @@ export interface IFormFile {
22
22
  isDisabledOnUpdate?: boolean;
23
23
  isHidden?: boolean;
24
24
  isRequired?: boolean;
25
- conditions?: IFormCondition[];
25
+ conditions?: IFormCondition;
26
26
  todo?: string;
27
27
  validators?: ("onlyImages" | "png" | "jpg" | "pdf")[];
28
28
  storageConfig: IStorageConfig;
@@ -6,7 +6,7 @@ export interface IFormInheritance {
6
6
  type: "inheritance";
7
7
  name?: string;
8
8
  form: IForm;
9
- conditions?: IFormCondition[];
9
+ conditions?: IFormCondition;
10
10
  todo?: string;
11
11
  businessRules?: IBusinessRule[];
12
12
  elementDescription?: string;
@@ -1,9 +1,9 @@
1
1
  import type { EDataType } from "../enums/form.enum";
2
+ import type { IFormCondition } from "./condition.interface";
2
3
  import type {
3
4
  IApiResponseField,
4
5
  IApiResponseFieldFilter,
5
6
  } from "./form-autocomplete.interface";
6
- import type { IFormCondition } from "./condition.interface";
7
7
  import type { IBusinessRule } from "./project.interface";
8
8
 
9
9
  export interface IFormInput {
@@ -19,7 +19,7 @@ export interface IFormInput {
19
19
  isHidden?: boolean;
20
20
  isRequired?: boolean;
21
21
  isUnique?: boolean;
22
- conditions?: IFormCondition[];
22
+ conditions?: IFormCondition;
23
23
  validators?: ("cep" | "cpf" | "cnpj" | "onlyNumbers" | "phone" | "email")[];
24
24
  todo?: string;
25
25
  maxLength?: number;
@@ -40,5 +40,5 @@ export interface IApiRequest {
40
40
  filtersFromOtherFormFields?: IApiResponseFieldFilter[];
41
41
  formFieldsFilledByApiResponse?: IApiResponseField[];
42
42
  hasAuthentication?: boolean;
43
- conditions?: IFormCondition[];
43
+ conditions?: IFormCondition;
44
44
  }
@@ -17,7 +17,7 @@ export interface IFormNumericInput {
17
17
  isHidden?: boolean;
18
18
  isRequired?: boolean;
19
19
  isUnique?: boolean;
20
- conditions?: IFormCondition[];
20
+ conditions?: IFormCondition;
21
21
  todo?: string;
22
22
  businessRules?: IBusinessRule[];
23
23
  }
@@ -10,7 +10,7 @@ export interface IFormPatternInput {
10
10
  tooltip?: string;
11
11
  isDisabled?: boolean;
12
12
  isRequired?: boolean;
13
- conditions?: IFormCondition[];
13
+ conditions?: IFormCondition;
14
14
  todo?: string;
15
15
  businessRules?: IBusinessRule[];
16
16
  }
@@ -16,7 +16,7 @@ export interface IFormRadioGroup {
16
16
  isDisabledOnUpdate?: boolean;
17
17
  isHidden?: boolean;
18
18
  isRequired?: boolean;
19
- conditions?: IFormCondition[];
19
+ conditions?: IFormCondition;
20
20
  todo?: string;
21
21
  businessRules?: IBusinessRule[];
22
22
  }
@@ -16,7 +16,7 @@ export interface IFormSelect {
16
16
  isHidden?: boolean;
17
17
  isRequired?: boolean;
18
18
  isUnique?: boolean;
19
- conditions?: IFormCondition[];
19
+ conditions?: IFormCondition;
20
20
  validators?: ("cpf" | "cnpj")[];
21
21
  todo?: string;
22
22
  isMultiple?: boolean;
@@ -10,7 +10,7 @@ export interface IFormSwitch {
10
10
  isDisabledOnUpdate?: boolean;
11
11
  isHidden?: boolean;
12
12
  isRequired?: boolean;
13
- conditions?: IFormCondition[];
13
+ conditions?: IFormCondition;
14
14
  todo?: string;
15
15
  businessRules?: IBusinessRule[];
16
16
  }
@@ -10,9 +10,9 @@ export interface IFormTab {
10
10
  id: string;
11
11
  title: string;
12
12
  elements: IFormElement[];
13
- conditions?: IFormCondition[];
13
+ conditions?: IFormCondition;
14
14
  }[];
15
- conditions?: IFormCondition[];
15
+ conditions?: IFormCondition;
16
16
  businessRules?: IBusinessRule[];
17
17
  elementDescription?: string;
18
18
  }
@@ -27,7 +27,7 @@ export interface IForm {
27
27
  endpoint: string;
28
28
  actions: ("create" | "get" | "getById" | "update" | "softDelete" | "hardDelete" | "clone" | "sendEmail")[];
29
29
  request?: IContractRequest;
30
- conditions?: IFormCondition[];
30
+ conditions?: IFormCondition;
31
31
  businessRules?: IBusinessRule[];
32
32
  userStory?: string;
33
33
  }[];
@@ -17,14 +17,14 @@ export interface IList {
17
17
  property?: string; // property taken from dataSource response. e.g.: "email"
18
18
  label?: string; // label to property. e.g.: "E-mail"
19
19
  type?:
20
- | "title"
21
- | "subtitle"
22
- | "description"
23
- | "video"
24
- | "image"
25
- | "images"
26
- | "icon"
27
- | "badge";
20
+ | "title"
21
+ | "subtitle"
22
+ | "description"
23
+ | "video"
24
+ | "image"
25
+ | "images"
26
+ | "icon"
27
+ | "badge";
28
28
  isHtml?: boolean;
29
29
  isLink?: boolean;
30
30
  isTimestamp?: boolean;
@@ -35,7 +35,7 @@ export interface IList {
35
35
  dataType: EDataType;
36
36
  isMultiple?: boolean;
37
37
  isExpansible?: boolean;
38
- conditions?: IFormCondition[];
38
+ conditions?: IFormCondition;
39
39
  businessRules?: IBusinessRule[];
40
40
  todo?: string;
41
41
  }[]; // properties taken from dataSource
@@ -69,7 +69,7 @@ export interface IList {
69
69
  };
70
70
  };
71
71
  businessRules?: IBusinessRule[];
72
- conditions?: IFormCondition[];
72
+ conditions?: IFormCondition;
73
73
  todo?: string;
74
74
  }[];
75
75
  contracts: {
@@ -86,7 +86,7 @@ export interface IList {
86
86
  | "sendEmail"
87
87
  )[];
88
88
  request?: IContractRequest;
89
- conditions?: IFormCondition[];
89
+ conditions?: IFormCondition;
90
90
  businessRules?: IBusinessRule[];
91
91
  userStory?: string;
92
92
  }[];
@@ -0,0 +1,72 @@
1
+ {
2
+ "$id": "condition-body.ref.json",
3
+ "type": "object",
4
+ "properties": {
5
+ "elements": {
6
+ "type": "array",
7
+ "items": {
8
+ "type": "object",
9
+ "properties": {
10
+ "key": {
11
+ "type": "string"
12
+ },
13
+ "value": {},
14
+ "comparisonOperator": {
15
+ "enum": [
16
+ "===",
17
+ ">",
18
+ ">=",
19
+ "in",
20
+ "<",
21
+ "<=",
22
+ "!==",
23
+ "nin"
24
+ ]
25
+ },
26
+ "logicalOperator": {
27
+ "enum": [
28
+ "&&",
29
+ "!",
30
+ "nor",
31
+ "||"
32
+ ]
33
+ }
34
+ },
35
+ "required": [
36
+ "key",
37
+ "comparisonOperator"
38
+ ]
39
+ }
40
+ },
41
+ "code": {
42
+ "type": "object",
43
+ "required": [
44
+ "triggerField",
45
+ "code"
46
+ ],
47
+ "properties": {
48
+ "triggerField": {
49
+ "type": "string"
50
+ },
51
+ "code": {
52
+ "type": "string"
53
+ }
54
+ }
55
+ },
56
+ "conditionResponse": {
57
+ "enum": [
58
+ "show",
59
+ "hide",
60
+ "enable",
61
+ "disable",
62
+ "fillFields"
63
+ ]
64
+ },
65
+ "fillFields": {
66
+ "type": "array"
67
+ },
68
+ "buttonId": {
69
+ "type": "string"
70
+ }
71
+ }
72
+ }
@@ -1,73 +1,25 @@
1
1
  {
2
2
  "$id": "condition.ref.json",
3
- "type": "array",
4
- "items": {
5
- "type": "object",
6
- "properties": {
7
- "type": {
8
- "type": "string",
9
- "enum": ["property", "enum", "form", "code", "array", "button"]
10
- },
11
- "elements": {
12
- "type": "array",
13
- "items": {
14
- "type": "object",
15
- "properties": {
16
- "key": {
17
- "type": "string"
18
- },
19
- "value": {},
20
- "array": {
21
- "type": "string"
22
- },
23
- "comparisonOperator": {
24
- "type": "string",
25
- "enum": ["===", ">", ">=", "in", "<", "<=", "!==", "nin"]
26
- },
27
- "logicalOperator": {
28
- "type": "string",
29
- "enum": ["&&", "!", "nor", "||"]
30
- }
31
- },
32
- "required": ["key", "comparisonOperator"]
33
- }
34
- },
35
- "code": {
36
- "type": "object",
37
- "properties": {
38
- "triggerField": {
39
- "type": "string"
40
- },
41
- "code": {
42
- "type": "string"
43
- }
44
- },
45
- "required": ["triggerField", "code"]
46
- },
47
- "businessRules": {
48
- "$ref": "business-rules.ref.json"
49
- },
50
- "conditionResponse": {
51
- "type": "string",
52
- "enum": ["show", "hide", "enable", "disable", "fillFields"]
53
- },
54
- "fillFields": {
55
- "type": "array",
56
- "items": {
57
- "type": "object",
58
- "properties": {
59
- "fieldKey": {
60
- "type": "string"
61
- },
62
- "value": {}
63
- },
64
- "required": ["fieldKey", "value"]
65
- }
66
- },
67
- "buttonId": {
68
- "type": "string"
69
- }
3
+ "type": "object",
4
+ "properties": {
5
+ "property": {
6
+ "$ref": "condition-body.ref.json"
70
7
  },
71
- "required": ["type"]
72
- }
73
- }
8
+ "enum": {
9
+ "$ref": "condition-body.ref.json"
10
+ },
11
+ "form": {
12
+ "$ref": "condition-body.ref.json"
13
+ },
14
+ "code": {
15
+ "$ref": "condition-body.ref.json"
16
+ },
17
+ "array": {
18
+ "$ref": "condition-body.ref.json"
19
+ },
20
+ "button": {
21
+ "$ref": "condition-body.ref.json"
22
+ }
23
+ },
24
+ "additionalProperties": false
25
+ }
@@ -491,7 +491,7 @@ rule: Regra 3</pre
491
491
  </div>
492
492
  </div>
493
493
  <div class="element-card">
494
- <h3>Condições (IFormCondition[])</h3>
494
+ <h3>Condições (IFormCondition)</h3>
495
495
  <div class="box-meta box-conditions">
496
496
  <pre>
497
497
  conditionType: form