rapida-partner 7.0.0 → 7.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/index.ts +5 -0
- package/package.json +1 -1
- package/src/interfaces/ai-agent.interface.ts +130 -139
- package/src/interfaces/dashboard-widget.interface.ts +58 -0
- package/src/interfaces/data-chart.interface.ts +23 -1
- package/src/interfaces/data-stat.interface.ts +115 -0
- package/src/interfaces/list.interface.ts +19 -0
- package/src/interfaces/project-backend.interface.ts +8 -0
- package/src/interfaces/project.interface.ts +19 -1
- package/src/interfaces/tone.interface.ts +2 -0
- package/src/schemas/ai-agent-config.ref.json +3 -3
- package/src/schemas/backend.ref.json +11 -0
- package/src/schemas/component-one-of.ref.json +5 -2
- package/src/schemas/dashboard-budget-monitor.ref.json +16 -0
- package/src/schemas/dashboard-empty-state.ref.json +37 -0
- package/src/schemas/dashboard-item-one-of.ref.json +16 -0
- package/src/schemas/dashboard-link-action.ref.json +15 -0
- package/src/schemas/dashboard-quick-create.ref.json +19 -0
- package/src/schemas/data-chart.ref.json +36 -2
- package/src/schemas/data-stat.ref.json +146 -0
- package/src/schemas/list.ref.json +57 -0
- package/src/schemas/module.ref.json +5 -2
- package/src/schemas/project.schema.json +7 -1
- package/src/schemas/quick-create-item.ref.json +19 -0
- package/src/schemas/tone.ref.json +6 -0
- package/src/utils/list-references.ts +51 -0
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
"title": {
|
|
14
14
|
"$ref": "translatable.ref.json"
|
|
15
15
|
},
|
|
16
|
+
"description": {
|
|
17
|
+
"$ref": "translatable.ref.json",
|
|
18
|
+
"description": "Frase abaixo do título da lista, dizendo para que ela serve."
|
|
19
|
+
},
|
|
16
20
|
"guards": {
|
|
17
21
|
"type": "array",
|
|
18
22
|
"items": {
|
|
@@ -67,6 +71,21 @@
|
|
|
67
71
|
"isExpansible": {
|
|
68
72
|
"type": "boolean"
|
|
69
73
|
},
|
|
74
|
+
"tones": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"description": "Só em type 'badge' (nos outros tipos é ignorado): tom de cada valor. e.g.: { \"paid\": \"success\", \"overdue\": \"danger\" }",
|
|
77
|
+
"additionalProperties": { "$ref": "tone.ref.json" }
|
|
78
|
+
},
|
|
79
|
+
"mobilePriority": {
|
|
80
|
+
"type": "integer",
|
|
81
|
+
"enum": [1, 2, 3],
|
|
82
|
+
"description": "1 e 2 aparecem no card do celular; 3 só no desktop."
|
|
83
|
+
},
|
|
84
|
+
"relativeDate": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"enum": ["plain", "deadline"],
|
|
87
|
+
"description": "Data com texto relativo abaixo ('há 3 dias'); 'deadline' pinta o passado de vermelho e os próximos 7 dias de âmbar."
|
|
88
|
+
},
|
|
70
89
|
"isHtml": {
|
|
71
90
|
"type": "boolean"
|
|
72
91
|
},
|
|
@@ -250,6 +269,44 @@
|
|
|
250
269
|
"listFilters": {
|
|
251
270
|
"$ref": "form-one-of.ref.json"
|
|
252
271
|
},
|
|
272
|
+
"quickFilters": {
|
|
273
|
+
"type": "array",
|
|
274
|
+
"maxItems": 2,
|
|
275
|
+
"items": { "type": "string" },
|
|
276
|
+
"description": "Até 2 `name` de listFilters que ficam ao lado da busca; os demais vão para a área 'Mais filtros'. Sem isso, todos ficam na área 'Filtros'."
|
|
277
|
+
},
|
|
278
|
+
"tabs": {
|
|
279
|
+
"type": "object",
|
|
280
|
+
"description": "Abas com contador acima da tabela, uma por valor de `property`, mais 'Todos'.",
|
|
281
|
+
"properties": {
|
|
282
|
+
"property": { "type": "string" },
|
|
283
|
+
"options": {
|
|
284
|
+
"type": "array",
|
|
285
|
+
"description": "Sem options, usa as opções do select de mesmo nome no form do módulo.",
|
|
286
|
+
"items": {
|
|
287
|
+
"type": "object",
|
|
288
|
+
"properties": {
|
|
289
|
+
"value": { "type": ["string", "number", "boolean"] },
|
|
290
|
+
"label": { "$ref": "translatable.ref.json" },
|
|
291
|
+
"tone": { "$ref": "tone.ref.json" }
|
|
292
|
+
},
|
|
293
|
+
"required": ["value", "label"],
|
|
294
|
+
"additionalProperties": false
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
"tones": {
|
|
298
|
+
"type": "object",
|
|
299
|
+
"description": "Tom de cada aba pelo valor, para usar com as opções do select. e.g.: { \"overdue\": \"danger\" }",
|
|
300
|
+
"additionalProperties": { "$ref": "tone.ref.json" }
|
|
301
|
+
},
|
|
302
|
+
"showCounts": {
|
|
303
|
+
"type": "boolean",
|
|
304
|
+
"description": "Contador em cada aba; padrão true."
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
"required": ["property"],
|
|
308
|
+
"additionalProperties": false
|
|
309
|
+
},
|
|
253
310
|
"contracts": {
|
|
254
311
|
"type": "array",
|
|
255
312
|
"items": {
|
|
@@ -187,6 +187,12 @@
|
|
|
187
187
|
},
|
|
188
188
|
"flowsGroup": {
|
|
189
189
|
"$ref": "translatable.ref.json"
|
|
190
|
+
},
|
|
191
|
+
"quickCreate": {
|
|
192
|
+
"type": "array",
|
|
193
|
+
"items": {
|
|
194
|
+
"$ref": "quick-create-item.ref.json"
|
|
195
|
+
}
|
|
190
196
|
}
|
|
191
197
|
},
|
|
192
198
|
"additionalProperties": false
|
|
@@ -212,7 +218,7 @@
|
|
|
212
218
|
"dashboard": {
|
|
213
219
|
"type": "array",
|
|
214
220
|
"items": {
|
|
215
|
-
"$ref": "
|
|
221
|
+
"$ref": "dashboard-item-one-of.ref.json"
|
|
216
222
|
}
|
|
217
223
|
},
|
|
218
224
|
"repositories": {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "quick-create-item.ref.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"description": "Atalho de criação: abre o cadastro do form formId (com a ação \"create\" no contrato).",
|
|
6
|
+
"properties": {
|
|
7
|
+
"formId": {
|
|
8
|
+
"type": "string"
|
|
9
|
+
},
|
|
10
|
+
"label": {
|
|
11
|
+
"$ref": "translatable.ref.json"
|
|
12
|
+
},
|
|
13
|
+
"icon": {
|
|
14
|
+
"type": "string"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"required": ["formId", "label"],
|
|
18
|
+
"additionalProperties": false
|
|
19
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { IList } from "../interfaces/list.interface";
|
|
2
|
+
import type { IComponent, IModule, IProject } from "../interfaces/project.interface";
|
|
3
|
+
|
|
4
|
+
interface INamedNode {
|
|
5
|
+
name?: string;
|
|
6
|
+
elements?: unknown[];
|
|
7
|
+
tabs?: { elements?: unknown[] }[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const namesOf = (elements: unknown[] | undefined): string[] =>
|
|
11
|
+
(elements ?? []).flatMap((element: unknown): string[] => {
|
|
12
|
+
const node = (element ?? {}) as INamedNode;
|
|
13
|
+
return [
|
|
14
|
+
...(node.name ? [node.name] : []),
|
|
15
|
+
...namesOf(node.elements),
|
|
16
|
+
...namesOf((node.tabs ?? []).flatMap((tab) => tab.elements ?? [])),
|
|
17
|
+
];
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const isList = (component: IComponent): component is IList => component.componentType === "list";
|
|
21
|
+
|
|
22
|
+
const formNamesOf = (module: IModule): Set<string> =>
|
|
23
|
+
new Set(
|
|
24
|
+
module.components.flatMap((component: IComponent): string[] =>
|
|
25
|
+
component.componentType === "form" ? namesOf(component.elements) : [],
|
|
26
|
+
),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const listWarnings = (list: IList, formNames: Set<string>): string[] => {
|
|
30
|
+
const warnings: string[] = [];
|
|
31
|
+
const filterNames = new Set(namesOf(list.listFilters));
|
|
32
|
+
for (const name of list.quickFilters ?? []) {
|
|
33
|
+
if (!filterNames.has(name)) {
|
|
34
|
+
warnings.push(list.id + ": quickFilters cita \"" + name + "\", que não está em listFilters");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const tabs = list.tabs;
|
|
38
|
+
if (tabs && !tabs.options?.length && !formNames.has(tabs.property)) {
|
|
39
|
+
warnings.push(
|
|
40
|
+
list.id + ": tabs.property \"" + tabs.property + "\" não existe em nenhum form do módulo e tabs.options está vazio",
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
return warnings;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// Nomes citados por texto (quickFilters e tabs.property) que o schema não consegue conferir.
|
|
47
|
+
export const checkListReferences = (project: IProject): string[] =>
|
|
48
|
+
(project.modules ?? []).flatMap((module: IModule): string[] => {
|
|
49
|
+
const formNames = formNamesOf(module);
|
|
50
|
+
return module.components.filter(isList).flatMap((list: IList) => listWarnings(list, formNames));
|
|
51
|
+
});
|