rapida-partner 7.1.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/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.interface.ts +19 -1
- package/src/interfaces/tone.interface.ts +2 -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
package/index.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { tsProjectToJsonProject } from "./src/controllers/ts_project_to_json_project";
|
|
4
4
|
import { validateProjectJson } from "./src/utils/json";
|
|
5
|
+
import { checkListReferences } from "./src/utils/list-references";
|
|
5
6
|
import type { IProject } from "./src/interfaces/project.interface";
|
|
6
7
|
import * as fs from "fs";
|
|
7
8
|
import * as path from "path";
|
|
@@ -77,6 +78,10 @@ async function main() {
|
|
|
77
78
|
process.exit(1);
|
|
78
79
|
}
|
|
79
80
|
|
|
81
|
+
for (const warning of checkListReferences(project)) {
|
|
82
|
+
console.warn("Aviso: " + warning);
|
|
83
|
+
}
|
|
84
|
+
|
|
80
85
|
console.info("Project JSON successfully generated and validated.");
|
|
81
86
|
} catch (error) {
|
|
82
87
|
console.error("Error processing project:", error);
|
package/package.json
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { TTranslatable } from "./translatable.interface";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Atalho de criação: abre o formulário de cadastro de `formId` (o `id` de um
|
|
5
|
+
* IForm de algum módulo, com a ação "create" no contrato). Declarado uma vez em
|
|
6
|
+
* IProject.menu.quickCreate e usado pelo botão "Criar novo" do painel e pelo
|
|
7
|
+
* card IDashboardQuickCreate. Só aparece para quem pode criar naquele módulo.
|
|
8
|
+
*
|
|
9
|
+
* `label` é declarado porque depende do gênero da palavra ("Nova conta",
|
|
10
|
+
* "Novo compromisso"), o que não dá para montar a partir do título do form.
|
|
11
|
+
*/
|
|
12
|
+
export interface IQuickCreateItem {
|
|
13
|
+
formId: string;
|
|
14
|
+
label: TTranslatable;
|
|
15
|
+
icon?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Card "Consumo de serviços" no painel: saldo e uso das integrações com
|
|
20
|
+
* monitoramento de custo (deepseekIntegration/mongodbIntegration com
|
|
21
|
+
* service "cost"). Requer ao menos uma delas no projeto. Só em IProject.dashboard.
|
|
22
|
+
*/
|
|
23
|
+
export interface IDashboardBudgetMonitor {
|
|
24
|
+
componentType: "budgetMonitor";
|
|
25
|
+
id: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Card de atalhos de criação no painel, com os itens de
|
|
30
|
+
* IProject.menu.quickCreate. Só em IProject.dashboard.
|
|
31
|
+
*/
|
|
32
|
+
export interface IDashboardQuickCreate {
|
|
33
|
+
componentType: "quickCreate";
|
|
34
|
+
id: string;
|
|
35
|
+
title?: TTranslatable;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Link de ação de um card do painel (ex.: "Abrir quadro", "Resolver agora").
|
|
40
|
+
* `route` é uma rota interna, como em `action.link.route` de IDataCard.
|
|
41
|
+
*/
|
|
42
|
+
export interface IDashboardLinkAction {
|
|
43
|
+
label: TTranslatable;
|
|
44
|
+
route: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Estado vazio de um card do painel (IDataChart/IDataStat sem dados): ícone,
|
|
49
|
+
* título, explicação e ações para o usuário sair dele (ex.: "Configurar perfil
|
|
50
|
+
* fiscal"). A primeira ação "primary" vira o botão principal. Sem emptyState,
|
|
51
|
+
* o card mostra a mensagem padrão.
|
|
52
|
+
*/
|
|
53
|
+
export interface IDashboardEmptyState {
|
|
54
|
+
icon?: string;
|
|
55
|
+
title?: TTranslatable;
|
|
56
|
+
description?: TTranslatable;
|
|
57
|
+
actions?: (IDashboardLinkAction & { variant?: "primary" | "secondary" })[];
|
|
58
|
+
}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import type { IApiRequest } from "./form-input.interface";
|
|
2
2
|
import type { IBusinessRule } from "./project.interface";
|
|
3
3
|
import type { TTranslatable } from "./translatable.interface";
|
|
4
|
+
import type {
|
|
5
|
+
IDashboardEmptyState,
|
|
6
|
+
IDashboardLinkAction,
|
|
7
|
+
} from "./dashboard-widget.interface";
|
|
4
8
|
|
|
9
|
+
// "progressList": barras horizontais em HTML (rótulo, barra e número), sem
|
|
10
|
+
// canvas. Usa a ordem das opções do select do campo agrupado, quando houver,
|
|
11
|
+
// e o primeiro dataset. Bom para contagem por etapa/status.
|
|
5
12
|
export type IChartType =
|
|
6
13
|
| "line"
|
|
7
14
|
| "bar"
|
|
@@ -11,7 +18,12 @@ export type IChartType =
|
|
|
11
18
|
| "scatter"
|
|
12
19
|
| "bubble"
|
|
13
20
|
| "area"
|
|
14
|
-
| "polarArea"
|
|
21
|
+
| "polarArea"
|
|
22
|
+
| "progressList";
|
|
23
|
+
|
|
24
|
+
// Cores do tema, para não prender o gráfico a um hex: "primary" segue
|
|
25
|
+
// IProject.styles; as demais são as de status (cinza, verde, âmbar, vermelho).
|
|
26
|
+
export type TChartColorToken = "neutral" | "primary" | "success" | "warning" | "danger";
|
|
15
27
|
|
|
16
28
|
export type IChartAggregator = "sum" | "avg" | "min" | "max" | "count";
|
|
17
29
|
|
|
@@ -67,12 +79,19 @@ export interface IDataChart {
|
|
|
67
79
|
componentType: "dataChart";
|
|
68
80
|
id: string;
|
|
69
81
|
title: TTranslatable;
|
|
82
|
+
// Texto abaixo do título. Aceita {{total}} (soma dos valores exibidos),
|
|
83
|
+
// ex.: { "pt-BR": "{{total}} tarefas no total" }.
|
|
84
|
+
subtitle?: TTranslatable;
|
|
70
85
|
userStory?: string;
|
|
71
86
|
icon?: string;
|
|
72
87
|
guards?: "isAuthenticated" | "isAuthorized";
|
|
73
88
|
businessRules?: IBusinessRule[];
|
|
74
89
|
dataSource: IApiRequest;
|
|
75
90
|
chartType: IChartType;
|
|
91
|
+
// Link no canto do card (ex.: "Abrir quadro").
|
|
92
|
+
action?: IDashboardLinkAction;
|
|
93
|
+
// Substitui a mensagem padrão quando não há dados.
|
|
94
|
+
emptyState?: IDashboardEmptyState;
|
|
76
95
|
limit?: number;
|
|
77
96
|
dimensions?: {
|
|
78
97
|
width?: string;
|
|
@@ -83,6 +102,9 @@ export interface IDataChart {
|
|
|
83
102
|
labels: {
|
|
84
103
|
property: string;
|
|
85
104
|
formatter?: IChartLabelFormatter;
|
|
105
|
+
// Cor por valor do campo agrupado (o valor cru, ex.: "blocked"), em
|
|
106
|
+
// "progressList". Valores sem cor usam "primary".
|
|
107
|
+
colors?: Record<string, TChartColorToken>;
|
|
86
108
|
};
|
|
87
109
|
datasets: IChartDataset[];
|
|
88
110
|
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { EDataType } from "../enums/form.enum";
|
|
2
|
+
import type { IConditionElement } from "./condition.interface";
|
|
3
|
+
import type { IChartAggregator } from "./data-chart.interface";
|
|
4
|
+
import type {
|
|
5
|
+
IDashboardEmptyState,
|
|
6
|
+
IDashboardLinkAction,
|
|
7
|
+
} from "./dashboard-widget.interface";
|
|
8
|
+
import type { IApiRequest } from "./form-input.interface";
|
|
9
|
+
import type { IBusinessRule } from "./project.interface";
|
|
10
|
+
import type { TTranslatable } from "./translatable.interface";
|
|
11
|
+
import type { TTone } from "./tone.interface";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Datas relativas, resolvidas no navegador no momento da consulta.
|
|
15
|
+
*
|
|
16
|
+
* - "$now": o instante atual.
|
|
17
|
+
* - "$today" / "$tomorrow": o dia de hoje / de amanhã no calendário de quem
|
|
18
|
+
* está usando, à meia-noite UTC. É assim que os campos de data sem hora
|
|
19
|
+
* (dataType "date") são gravados, então `dueDate < "$today"` significa
|
|
20
|
+
* "vence antes de hoje" sem erro de fuso.
|
|
21
|
+
* - "$startOfMonth" / "$startOfNextMonth" e "$startOfYear" / "$startOfNextYear":
|
|
22
|
+
* mesma regra, no primeiro dia do período.
|
|
23
|
+
*
|
|
24
|
+
* Use intervalos semiabertos para recortar períodos: o mês atual é
|
|
25
|
+
* `>= "$startOfMonth"` e `< "$startOfNextMonth"`.
|
|
26
|
+
*/
|
|
27
|
+
export type TDataStatRelativeDate =
|
|
28
|
+
| "$now"
|
|
29
|
+
| "$today"
|
|
30
|
+
| "$tomorrow"
|
|
31
|
+
| "$startOfMonth"
|
|
32
|
+
| "$startOfNextMonth"
|
|
33
|
+
| "$startOfYear"
|
|
34
|
+
| "$startOfNextYear";
|
|
35
|
+
|
|
36
|
+
type TDataStatScalar = string | number | boolean | null;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Filtro fixo aplicado antes de calcular o valor. Os filtros de um IDataStat
|
|
40
|
+
* são combinados com "e". Os operadores são os mesmos de IConditionElement;
|
|
41
|
+
* "in"/"nin" recebem uma lista em `value`.
|
|
42
|
+
*/
|
|
43
|
+
export interface IDataStatFilter {
|
|
44
|
+
key: string;
|
|
45
|
+
comparisonOperator: IConditionElement["comparisonOperator"];
|
|
46
|
+
value: TDataStatScalar | TDataStatScalar[] | TDataStatRelativeDate;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Tom do card: "neutral" (padrão), "success" (valor em verde), "warning"
|
|
51
|
+
* (card âmbar) e "danger" (card vermelho).
|
|
52
|
+
*/
|
|
53
|
+
export type TDataStatTone = TTone;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Regra de tom avaliada sobre o valor já calculado, no mesmo formato de
|
|
57
|
+
* IDataStatFilter sem o `key`. Ex.: `{ comparisonOperator: ">", value: 0,
|
|
58
|
+
* tone: "danger" }` deixa o card vermelho quando houver algo vencido; com
|
|
59
|
+
* valor de data, `{ comparisonOperator: "<", value: "$tomorrow", tone: "warning" }`
|
|
60
|
+
* avisa o que vence até hoje.
|
|
61
|
+
*/
|
|
62
|
+
export interface IDataStatToneRule extends Omit<IDataStatFilter, "key"> {
|
|
63
|
+
tone: TDataStatTone;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Indicador numérico (KPI) do painel: um único valor calculado sobre os
|
|
68
|
+
* registros de um endpoint, como um IDataChart sem agrupamento. Hoje o gerador
|
|
69
|
+
* só o desenha em IProject.dashboard.
|
|
70
|
+
*
|
|
71
|
+
* Exemplos:
|
|
72
|
+
* - total vencido: `sum` de "amount", filtros `status in [...]` e `dueDate < "$today"`, dataType CURRENCY;
|
|
73
|
+
* - próximo vencimento: `min` de "dueDate", filtro `dueDate >= "$today"`, dataType DATE;
|
|
74
|
+
* - quantidade de registros: `count`, sem `property`.
|
|
75
|
+
*/
|
|
76
|
+
export interface IDataStat {
|
|
77
|
+
componentType: "dataStat";
|
|
78
|
+
id: string;
|
|
79
|
+
title: TTranslatable;
|
|
80
|
+
// Texto de apoio abaixo do valor (ex.: "contas em aberto").
|
|
81
|
+
subtitle?: TTranslatable;
|
|
82
|
+
userStory?: string;
|
|
83
|
+
icon?: string;
|
|
84
|
+
guards?: "isAuthenticated" | "isAuthorized";
|
|
85
|
+
businessRules?: IBusinessRule[];
|
|
86
|
+
dataSource: IApiRequest;
|
|
87
|
+
filters?: IDataStatFilter[];
|
|
88
|
+
value: {
|
|
89
|
+
aggregator: IChartAggregator;
|
|
90
|
+
// Campo agregado. Obrigatório em todos os agregadores, exceto "count".
|
|
91
|
+
property?: string;
|
|
92
|
+
// Define a formatação: CURRENCY (moeda), DATE/DATETIME/TIMESTAMP (data),
|
|
93
|
+
// INTEGER, DECIMAL etc. Sem dataType, o valor é exibido como número.
|
|
94
|
+
dataType?: EDataType;
|
|
95
|
+
};
|
|
96
|
+
// Cor do card conforme o valor. As regras são avaliadas em ordem e a
|
|
97
|
+
// primeira que casar define o tom; sem nenhuma, vale `default` ("neutral").
|
|
98
|
+
tone?: {
|
|
99
|
+
default?: TDataStatTone;
|
|
100
|
+
rules?: IDataStatToneRule[];
|
|
101
|
+
};
|
|
102
|
+
// Máximo de registros lidos para "sum" e "avg" (padrão 1000). "count",
|
|
103
|
+
// "min" e "max" são resolvidos pelo backend e não dependem desse limite.
|
|
104
|
+
limit?: number;
|
|
105
|
+
// Rota interna aberta ao clicar no card inteiro (ex.: "/payable-receivable-accounts").
|
|
106
|
+
link?: string;
|
|
107
|
+
// Chamada de ação no rodapé do card (ex.: "Resolver agora"). Com `action`, o
|
|
108
|
+
// card deixa de ser clicável por inteiro e só a ação navega.
|
|
109
|
+
action?: IDashboardLinkAction;
|
|
110
|
+
// Substitui "Nenhum registro encontrado." quando não há valor (ex.: "min"
|
|
111
|
+
// sem nenhum registro).
|
|
112
|
+
emptyState?: IDashboardEmptyState;
|
|
113
|
+
// Largura na grade de 4 colunas do painel, como `space` dos campos de formulário.
|
|
114
|
+
space?: 1 | 2 | 3 | 4;
|
|
115
|
+
}
|
|
@@ -5,11 +5,14 @@ import type { IApiRequest } from "./form-input.interface";
|
|
|
5
5
|
import type { IFormElement } from "./form.interface";
|
|
6
6
|
import type { IBusinessRule } from "./project.interface";
|
|
7
7
|
import type { TTranslatable } from "./translatable.interface";
|
|
8
|
+
import type { ISelectOption } from "./form-select.interface";
|
|
9
|
+
import type { TTone } from "./tone.interface";
|
|
8
10
|
|
|
9
11
|
export interface IList {
|
|
10
12
|
componentType: "list";
|
|
11
13
|
id: string; // named according to component file name (<id>.<componentType>.ts)
|
|
12
14
|
title: TTranslatable;
|
|
15
|
+
description?: TTranslatable; // frase abaixo do título da lista, dizendo para que ela serve
|
|
13
16
|
userStory?: string;
|
|
14
17
|
guards?: string[];
|
|
15
18
|
dataSource: IApiRequest;
|
|
@@ -37,11 +40,16 @@ export interface IList {
|
|
|
37
40
|
dataType: EDataType;
|
|
38
41
|
isMultiple?: boolean;
|
|
39
42
|
isExpansible?: boolean;
|
|
43
|
+
tones?: Record<string, TTone>; // só em type "badge" (nos outros tipos é ignorado): tom de cada valor. e.g.: { "paid": "success", "overdue": "danger" }
|
|
44
|
+
mobilePriority?: 1 | 2 | 3; // 1 e 2 aparecem no card do celular; 3 só no desktop
|
|
45
|
+
relativeDate?: "plain" | "deadline"; // data com texto relativo abaixo ("há 3 dias"); "deadline" pinta o passado de vermelho e os próximos 7 dias de âmbar
|
|
40
46
|
conditions?: IFormCondition;
|
|
41
47
|
businessRules?: IBusinessRule[];
|
|
42
48
|
todo?: string;
|
|
43
49
|
}[]; // properties taken from dataSource
|
|
44
50
|
listFilters?: IFormElement[]; // filters to be applied on dataSource
|
|
51
|
+
quickFilters?: string[]; // 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"
|
|
52
|
+
tabs?: IListTabs; // abas com contador acima da tabela, uma por valor de `property`, mais "Todos"
|
|
45
53
|
listActions?: IFormElement[]; // actions that can be performed on the list
|
|
46
54
|
cardAsALink?: {
|
|
47
55
|
link: string; // e.g.: "/user"
|
|
@@ -90,6 +98,17 @@ export interface IList {
|
|
|
90
98
|
pagination?: IListPagination;
|
|
91
99
|
}
|
|
92
100
|
|
|
101
|
+
export interface IListTabOption extends Pick<ISelectOption, "label" | "value"> {
|
|
102
|
+
tone?: TTone; // cor do contador da aba
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface IListTabs {
|
|
106
|
+
property: string; // e.g.: "status"
|
|
107
|
+
options?: IListTabOption[]; // sem options, usa as opções do select de mesmo nome no form do módulo
|
|
108
|
+
tones?: Record<string, TTone>; // tom de cada aba pelo valor, para usar com as opções do select. e.g.: { "overdue": "danger" }
|
|
109
|
+
showCounts?: boolean; // contador em cada aba; padrão true
|
|
110
|
+
}
|
|
111
|
+
|
|
93
112
|
export interface IListPagination {
|
|
94
113
|
enabled: boolean;
|
|
95
114
|
pageSize: number;
|
|
@@ -2,6 +2,12 @@ import type { IAiAgentConfig } from "./ai-agent.interface";
|
|
|
2
2
|
import type { IDataCard } from "./data-card.interface";
|
|
3
3
|
import type { IDataChart } from "./data-chart.interface";
|
|
4
4
|
import type { IDataDetail } from "./data-detail.interface";
|
|
5
|
+
import type { IDataStat } from "./data-stat.interface";
|
|
6
|
+
import type {
|
|
7
|
+
IDashboardBudgetMonitor,
|
|
8
|
+
IDashboardQuickCreate,
|
|
9
|
+
IQuickCreateItem,
|
|
10
|
+
} from "./dashboard-widget.interface";
|
|
5
11
|
import type { IDataGrid } from "./data-grid.interface";
|
|
6
12
|
import type { IDataTable } from "./data-table.interface";
|
|
7
13
|
import type { IE2e } from "./e2e.interface";
|
|
@@ -94,10 +100,12 @@ export interface IProject {
|
|
|
94
100
|
menu?: {
|
|
95
101
|
homeGroup?: TTranslatable; // grupo do Painel (/); sem ele, fica solto no topo
|
|
96
102
|
flowsGroup?: TTranslatable; // membros, papéis, convites e notificações, como links soltos no grupo
|
|
103
|
+
// Atalhos de criação: botão "Criar novo" no painel e card IDashboardQuickCreate.
|
|
104
|
+
quickCreate?: IQuickCreateItem[];
|
|
97
105
|
};
|
|
98
106
|
styles?: IStyle[];
|
|
99
107
|
flowChart?: IFlowChart;
|
|
100
|
-
dashboard?:
|
|
108
|
+
dashboard?: TDashboardItem[];
|
|
101
109
|
// Agente de IA (Kunlatalk) do projeto. Com ele, o gerador cria o agente em
|
|
102
110
|
// qualquer skeleton (ex.: um backoffice ou uma loja com atendente), além do
|
|
103
111
|
// frontend e do backend.
|
|
@@ -261,4 +269,14 @@ export type IComponent =
|
|
|
261
269
|
| IDataGrid
|
|
262
270
|
| IDataDetail
|
|
263
271
|
| IDataChart
|
|
272
|
+
| IDataStat
|
|
264
273
|
| IPanel;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Item de IProject.dashboard: qualquer IComponent ou um widget que só existe
|
|
277
|
+
* no painel (budgetMonitor, quickCreate).
|
|
278
|
+
*/
|
|
279
|
+
export type TDashboardItem =
|
|
280
|
+
| IComponent
|
|
281
|
+
| IDashboardBudgetMonitor
|
|
282
|
+
| IDashboardQuickCreate;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "dashboard-budget-monitor.ref.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"description": "Card de consumo de serviços no painel. Requer deepseekIntegration ou mongodbIntegration com service \"cost\".",
|
|
6
|
+
"properties": {
|
|
7
|
+
"componentType": {
|
|
8
|
+
"const": "budgetMonitor"
|
|
9
|
+
},
|
|
10
|
+
"id": {
|
|
11
|
+
"type": "string"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"required": ["componentType", "id"],
|
|
15
|
+
"additionalProperties": false
|
|
16
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "dashboard-empty-state.ref.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"description": "Estado vazio de um card do painel: ícone, título, explicação e ações.",
|
|
6
|
+
"properties": {
|
|
7
|
+
"icon": {
|
|
8
|
+
"type": "string"
|
|
9
|
+
},
|
|
10
|
+
"title": {
|
|
11
|
+
"$ref": "translatable.ref.json"
|
|
12
|
+
},
|
|
13
|
+
"description": {
|
|
14
|
+
"$ref": "translatable.ref.json"
|
|
15
|
+
},
|
|
16
|
+
"actions": {
|
|
17
|
+
"type": "array",
|
|
18
|
+
"items": {
|
|
19
|
+
"allOf": [
|
|
20
|
+
{
|
|
21
|
+
"$ref": "dashboard-link-action.ref.json"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"properties": {
|
|
25
|
+
"label": true,
|
|
26
|
+
"route": true,
|
|
27
|
+
"variant": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"enum": ["primary", "secondary"]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"additionalProperties": false
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"additionalProperties": false
|
|
37
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "dashboard-item-one-of.ref.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"description": "Item de IProject.dashboard: um componente ou um widget que só existe no painel.",
|
|
5
|
+
"oneOf": [
|
|
6
|
+
{
|
|
7
|
+
"$ref": "component-one-of.ref.json"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"$ref": "dashboard-budget-monitor.ref.json"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"$ref": "dashboard-quick-create.ref.json"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "dashboard-link-action.ref.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"description": "Link de ação de um card do painel (rota interna, como action.link.route de data-card). Sem additionalProperties para poder ser estendido com allOf (ex.: variant no emptyState); quem usa fecha as propriedades.",
|
|
6
|
+
"properties": {
|
|
7
|
+
"label": {
|
|
8
|
+
"$ref": "translatable.ref.json"
|
|
9
|
+
},
|
|
10
|
+
"route": {
|
|
11
|
+
"type": "string"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"required": ["label", "route"]
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "dashboard-quick-create.ref.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"description": "Card de atalhos de criação no painel, com os itens de menu.quickCreate.",
|
|
6
|
+
"properties": {
|
|
7
|
+
"componentType": {
|
|
8
|
+
"const": "quickCreate"
|
|
9
|
+
},
|
|
10
|
+
"id": {
|
|
11
|
+
"type": "string"
|
|
12
|
+
},
|
|
13
|
+
"title": {
|
|
14
|
+
"$ref": "translatable.ref.json"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"required": ["componentType", "id"],
|
|
18
|
+
"additionalProperties": false
|
|
19
|
+
}
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
"title": {
|
|
13
13
|
"$ref": "translatable.ref.json"
|
|
14
14
|
},
|
|
15
|
+
"subtitle": {
|
|
16
|
+
"$ref": "translatable.ref.json",
|
|
17
|
+
"description": "Texto abaixo do título. Aceita {{total}} (soma dos valores exibidos)."
|
|
18
|
+
},
|
|
15
19
|
"icon": {
|
|
16
20
|
"type": "string"
|
|
17
21
|
},
|
|
@@ -42,9 +46,25 @@
|
|
|
42
46
|
"scatter",
|
|
43
47
|
"bubble",
|
|
44
48
|
"area",
|
|
45
|
-
"polarArea"
|
|
49
|
+
"polarArea",
|
|
50
|
+
"progressList"
|
|
46
51
|
]
|
|
47
52
|
},
|
|
53
|
+
"action": {
|
|
54
|
+
"allOf": [
|
|
55
|
+
{
|
|
56
|
+
"$ref": "dashboard-link-action.ref.json"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"properties": {
|
|
60
|
+
"label": true,
|
|
61
|
+
"route": true
|
|
62
|
+
},
|
|
63
|
+
"additionalProperties": false
|
|
64
|
+
},
|
|
65
|
+
"emptyState": {
|
|
66
|
+
"$ref": "dashboard-empty-state.ref.json"
|
|
67
|
+
},
|
|
48
68
|
"limit": {
|
|
49
69
|
"type": "number"
|
|
50
70
|
},
|
|
@@ -81,6 +101,20 @@
|
|
|
81
101
|
"type": "string"
|
|
82
102
|
}
|
|
83
103
|
}
|
|
104
|
+
},
|
|
105
|
+
"colors": {
|
|
106
|
+
"type": "object",
|
|
107
|
+
"description": "Cor por valor cru do campo agrupado, em progressList.",
|
|
108
|
+
"additionalProperties": {
|
|
109
|
+
"type": "string",
|
|
110
|
+
"enum": [
|
|
111
|
+
"neutral",
|
|
112
|
+
"primary",
|
|
113
|
+
"success",
|
|
114
|
+
"warning",
|
|
115
|
+
"danger"
|
|
116
|
+
]
|
|
117
|
+
}
|
|
84
118
|
}
|
|
85
119
|
},
|
|
86
120
|
"required": [
|
|
@@ -272,4 +306,4 @@
|
|
|
272
306
|
"chartType",
|
|
273
307
|
"data"
|
|
274
308
|
]
|
|
275
|
-
}
|
|
309
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "data-stat.ref.json",
|
|
3
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"componentType": {
|
|
7
|
+
"const": "dataStat"
|
|
8
|
+
},
|
|
9
|
+
"id": {
|
|
10
|
+
"type": "string"
|
|
11
|
+
},
|
|
12
|
+
"title": {
|
|
13
|
+
"$ref": "translatable.ref.json"
|
|
14
|
+
},
|
|
15
|
+
"subtitle": {
|
|
16
|
+
"$ref": "translatable.ref.json"
|
|
17
|
+
},
|
|
18
|
+
"userStory": {
|
|
19
|
+
"type": "string"
|
|
20
|
+
},
|
|
21
|
+
"icon": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"guards": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"enum": ["isAuthenticated", "isAuthorized"]
|
|
27
|
+
},
|
|
28
|
+
"businessRules": {
|
|
29
|
+
"$ref": "business-rules.ref.json"
|
|
30
|
+
},
|
|
31
|
+
"dataSource": {
|
|
32
|
+
"$ref": "form-common-api-request.ref.json"
|
|
33
|
+
},
|
|
34
|
+
"filters": {
|
|
35
|
+
"type": "array",
|
|
36
|
+
"items": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"properties": {
|
|
39
|
+
"key": {
|
|
40
|
+
"type": "string"
|
|
41
|
+
},
|
|
42
|
+
"comparisonOperator": {
|
|
43
|
+
"enum": ["===", ">", ">=", "in", "<", "<=", "!==", "nin"]
|
|
44
|
+
},
|
|
45
|
+
"value": {
|
|
46
|
+
"description": "Valor comparado. Aceita as datas relativas \"$now\", \"$today\", \"$tomorrow\", \"$startOfMonth\", \"$startOfNextMonth\", \"$startOfYear\" e \"$startOfNextYear\"; \"in\"/\"nin\" recebem uma lista."
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"required": ["key", "comparisonOperator", "value"],
|
|
50
|
+
"additionalProperties": false,
|
|
51
|
+
"if": {
|
|
52
|
+
"properties": { "comparisonOperator": { "enum": ["in", "nin"] } }
|
|
53
|
+
},
|
|
54
|
+
"then": {
|
|
55
|
+
"properties": { "value": { "type": "array" } }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"value": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"properties": {
|
|
62
|
+
"aggregator": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"enum": ["sum", "avg", "min", "max", "count"]
|
|
65
|
+
},
|
|
66
|
+
"property": {
|
|
67
|
+
"type": "string"
|
|
68
|
+
},
|
|
69
|
+
"dataType": {
|
|
70
|
+
"$ref": "types-datatype.ref.json"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
"required": ["aggregator"],
|
|
74
|
+
"additionalProperties": false,
|
|
75
|
+
"if": {
|
|
76
|
+
"properties": { "aggregator": { "not": { "const": "count" } } }
|
|
77
|
+
},
|
|
78
|
+
"then": {
|
|
79
|
+
"required": ["property"]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"tone": {
|
|
83
|
+
"type": "object",
|
|
84
|
+
"description": "Cor do card conforme o valor calculado. A primeira regra que casar define o tom; sem nenhuma, vale default (\"neutral\").",
|
|
85
|
+
"properties": {
|
|
86
|
+
"default": {
|
|
87
|
+
"$ref": "tone.ref.json"
|
|
88
|
+
},
|
|
89
|
+
"rules": {
|
|
90
|
+
"type": "array",
|
|
91
|
+
"items": {
|
|
92
|
+
"type": "object",
|
|
93
|
+
"properties": {
|
|
94
|
+
"comparisonOperator": {
|
|
95
|
+
"enum": ["===", ">", ">=", "in", "<", "<=", "!==", "nin"]
|
|
96
|
+
},
|
|
97
|
+
"value": {
|
|
98
|
+
"description": "Valor comparado com o resultado. Aceita as mesmas datas relativas dos filtros."
|
|
99
|
+
},
|
|
100
|
+
"tone": {
|
|
101
|
+
"$ref": "tone.ref.json"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"required": ["comparisonOperator", "value", "tone"],
|
|
105
|
+
"additionalProperties": false,
|
|
106
|
+
"if": {
|
|
107
|
+
"properties": { "comparisonOperator": { "enum": ["in", "nin"] } }
|
|
108
|
+
},
|
|
109
|
+
"then": {
|
|
110
|
+
"properties": { "value": { "type": "array" } }
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"additionalProperties": false
|
|
116
|
+
},
|
|
117
|
+
"limit": {
|
|
118
|
+
"type": "integer",
|
|
119
|
+
"minimum": 1
|
|
120
|
+
},
|
|
121
|
+
"link": {
|
|
122
|
+
"type": "string"
|
|
123
|
+
},
|
|
124
|
+
"action": {
|
|
125
|
+
"allOf": [
|
|
126
|
+
{
|
|
127
|
+
"$ref": "dashboard-link-action.ref.json"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"properties": {
|
|
131
|
+
"label": true,
|
|
132
|
+
"route": true
|
|
133
|
+
},
|
|
134
|
+
"additionalProperties": false
|
|
135
|
+
},
|
|
136
|
+
"emptyState": {
|
|
137
|
+
"$ref": "dashboard-empty-state.ref.json"
|
|
138
|
+
},
|
|
139
|
+
"space": {
|
|
140
|
+
"type": "integer",
|
|
141
|
+
"enum": [1, 2, 3, 4]
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"required": ["componentType", "id", "title", "dataSource", "value"],
|
|
145
|
+
"additionalProperties": false
|
|
146
|
+
}
|
|
@@ -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
|
+
});
|