diff --git a/dist-import/pilao-de-dados/index.d.ts b/dist-import/pilao-de-dados/index.d.ts index e0fd117..eba47db 100644 --- a/dist-import/pilao-de-dados/index.d.ts +++ b/dist-import/pilao-de-dados/index.d.ts @@ -104,6 +104,52 @@ export declare const pPilao: { } | undefined; }; }; + z_tabela: { + visao: "z_tabela"; + rotulo: string; + tabela: (_: { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; + }) => string; + descricao: (_: { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; + }) => string; + campos: { + tabela: { + rotulo: string; + tipo_campo: import("zod").TypeOf>; + order: number; + }; + colunas?: { + rotulo: string; + tipo_campo: import("zod").TypeOf>; + order: number; + } | undefined; + filtros?: { + rotulo: string; + tipo_campo: import("zod").TypeOf>; + order: number; + } | undefined; + descricao_pelo_usuario?: { + rotulo: string; + tipo_campo: import("zod").TypeOf>; + order: number; + } | undefined; + }; + }; }; z_contagem_em_barra_vertical: import("zod").ZodObject<{ tabela: import("zod").ZodString; @@ -180,6 +226,42 @@ export declare const pPilao: { }[] | undefined; descricao_pelo_usuario?: string | undefined; }>; + z_tabela: import("zod").ZodObject<{ + tabela: import("zod").ZodString; + colunas: import("zod").ZodOptional>; + filtros: import("zod").ZodOptional", "<", ">=", "<=", "∩"]>; + }, "strip", import("zod").ZodTypeAny, { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }, { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }>, "many">>; + descricao_pelo_usuario: import("zod").ZodOptional; + }, "strip", import("zod").ZodTypeAny, { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; + }, { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; + }>; zp_registrar_base_dados: import("zod").ZodObject<{ tabela: import("zod").ZodString; colunas: import("zod").ZodArray; + z_tabela: import("zod").ZodObject<{ + tabela: import("zod").ZodString; + colunas: import("zod").ZodOptional>; + filtros: import("zod").ZodOptional", "<", ">=", "<=", "∩"]>; + }, "strip", import("zod").ZodTypeAny, { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }, { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }>, "many">>; + descricao_pelo_usuario: import("zod").ZodOptional; + }, "strip", import("zod").ZodTypeAny, { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; + }, { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; + }>; }; }; diff --git a/dist-import/pilao-de-dados/visoes/index.d.ts b/dist-import/pilao-de-dados/visoes/index.d.ts index 03c9cd5..07b7c2a 100644 --- a/dist-import/pilao-de-dados/visoes/index.d.ts +++ b/dist-import/pilao-de-dados/visoes/index.d.ts @@ -75,6 +75,42 @@ export declare const z_contagem_em_pizza: z.ZodObject<{ }[] | undefined; descricao_pelo_usuario?: string | undefined; }>; +export declare const z_tabela: z.ZodObject<{ + tabela: z.ZodString; + colunas: z.ZodOptional>; + filtros: z.ZodOptional", "<", ">=", "<=", "∩"]>; + }, "strip", z.ZodTypeAny, { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }, { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }>, "many">>; + descricao_pelo_usuario: z.ZodOptional; +}, "strip", z.ZodTypeAny, { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; +}, { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; +}>; export declare const visoes: { z_contagem_em_barra_vertical: z.ZodObject<{ tabela: z.ZodString; @@ -151,6 +187,42 @@ export declare const visoes: { }[] | undefined; descricao_pelo_usuario?: string | undefined; }>; + z_tabela: z.ZodObject<{ + tabela: z.ZodString; + colunas: z.ZodOptional>; + filtros: z.ZodOptional", "<", ">=", "<=", "∩"]>; + }, "strip", z.ZodTypeAny, { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }, { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }>, "many">>; + descricao_pelo_usuario: z.ZodOptional; + }, "strip", z.ZodTypeAny, { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; + }, { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; + }>; }; /** Cria a estrutura de campos para insersão de dados */ export declare const extruturas_de_campos: { diff --git a/dist-import/pilao-de-dados/visoes/index.js b/dist-import/pilao-de-dados/visoes/index.js index 53aa76e..73fdaff 100644 --- a/dist-import/pilao-de-dados/visoes/index.js +++ b/dist-import/pilao-de-dados/visoes/index.js @@ -21,9 +21,16 @@ export const z_contagem_em_pizza = z.object({ filtros: z_filtro.array().optional(), descricao_pelo_usuario: z.string().optional(), }); +export const z_tabela = z.object({ + tabela: z.string(), + colunas: z.string().array().optional(), + filtros: z_filtro.array().optional(), + descricao_pelo_usuario: z.string().optional(), +}); export const visoes = { z_contagem_em_barra_vertical, z_contagem_em_pizza, + z_tabela, }; /** Cria a estrutura de campos para insersão de dados */ export const extruturas_de_campos = { @@ -86,4 +93,28 @@ export const extruturas_de_campos = { filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 4 }, }, }, + z_tabela: { + visao: "z_tabela", + rotulo: "Tabela", + tabela: ({ tabela }) => tabela, + descricao: ({ tabela, descricao_pelo_usuario, filtros }) => { + if (String(descricao_pelo_usuario || "").trim()) + return String(descricao_pelo_usuario || "").trim(); + return `Consulta na ${tabela} ${!filtros?.length + ? "" + : `, quando ${filtros + .map(({ coluna, operador, valor }) => `${coluna} ${operador} ${valor}`) + .join(", ")}`}.`; + }, + campos: { + tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 }, + colunas: { rotulo: "Colunas", tipo_campo: "lista_colunas", order: 2 }, + descricao_pelo_usuario: { + rotulo: "Descrição (opcional)", + tipo_campo: "texto", + order: 3, + }, + filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 4 }, + }, + }, }; diff --git a/dist-require/pilao-de-dados/index.d.ts b/dist-require/pilao-de-dados/index.d.ts index e0fd117..eba47db 100644 --- a/dist-require/pilao-de-dados/index.d.ts +++ b/dist-require/pilao-de-dados/index.d.ts @@ -104,6 +104,52 @@ export declare const pPilao: { } | undefined; }; }; + z_tabela: { + visao: "z_tabela"; + rotulo: string; + tabela: (_: { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; + }) => string; + descricao: (_: { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; + }) => string; + campos: { + tabela: { + rotulo: string; + tipo_campo: import("zod").TypeOf>; + order: number; + }; + colunas?: { + rotulo: string; + tipo_campo: import("zod").TypeOf>; + order: number; + } | undefined; + filtros?: { + rotulo: string; + tipo_campo: import("zod").TypeOf>; + order: number; + } | undefined; + descricao_pelo_usuario?: { + rotulo: string; + tipo_campo: import("zod").TypeOf>; + order: number; + } | undefined; + }; + }; }; z_contagem_em_barra_vertical: import("zod").ZodObject<{ tabela: import("zod").ZodString; @@ -180,6 +226,42 @@ export declare const pPilao: { }[] | undefined; descricao_pelo_usuario?: string | undefined; }>; + z_tabela: import("zod").ZodObject<{ + tabela: import("zod").ZodString; + colunas: import("zod").ZodOptional>; + filtros: import("zod").ZodOptional", "<", ">=", "<=", "∩"]>; + }, "strip", import("zod").ZodTypeAny, { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }, { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }>, "many">>; + descricao_pelo_usuario: import("zod").ZodOptional; + }, "strip", import("zod").ZodTypeAny, { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; + }, { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; + }>; zp_registrar_base_dados: import("zod").ZodObject<{ tabela: import("zod").ZodString; colunas: import("zod").ZodArray; + z_tabela: import("zod").ZodObject<{ + tabela: import("zod").ZodString; + colunas: import("zod").ZodOptional>; + filtros: import("zod").ZodOptional", "<", ">=", "<=", "∩"]>; + }, "strip", import("zod").ZodTypeAny, { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }, { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }>, "many">>; + descricao_pelo_usuario: import("zod").ZodOptional; + }, "strip", import("zod").ZodTypeAny, { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; + }, { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; + }>; }; }; diff --git a/dist-require/pilao-de-dados/visoes/index.d.ts b/dist-require/pilao-de-dados/visoes/index.d.ts index 03c9cd5..07b7c2a 100644 --- a/dist-require/pilao-de-dados/visoes/index.d.ts +++ b/dist-require/pilao-de-dados/visoes/index.d.ts @@ -75,6 +75,42 @@ export declare const z_contagem_em_pizza: z.ZodObject<{ }[] | undefined; descricao_pelo_usuario?: string | undefined; }>; +export declare const z_tabela: z.ZodObject<{ + tabela: z.ZodString; + colunas: z.ZodOptional>; + filtros: z.ZodOptional", "<", ">=", "<=", "∩"]>; + }, "strip", z.ZodTypeAny, { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }, { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }>, "many">>; + descricao_pelo_usuario: z.ZodOptional; +}, "strip", z.ZodTypeAny, { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; +}, { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; +}>; export declare const visoes: { z_contagem_em_barra_vertical: z.ZodObject<{ tabela: z.ZodString; @@ -151,6 +187,42 @@ export declare const visoes: { }[] | undefined; descricao_pelo_usuario?: string | undefined; }>; + z_tabela: z.ZodObject<{ + tabela: z.ZodString; + colunas: z.ZodOptional>; + filtros: z.ZodOptional", "<", ">=", "<=", "∩"]>; + }, "strip", z.ZodTypeAny, { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }, { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }>, "many">>; + descricao_pelo_usuario: z.ZodOptional; + }, "strip", z.ZodTypeAny, { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; + }, { + tabela: string; + colunas?: string[] | undefined; + filtros?: { + coluna: string; + operador: "=" | "!=" | ">" | "<" | ">=" | "<=" | "∩"; + valor?: any; + }[] | undefined; + descricao_pelo_usuario?: string | undefined; + }>; }; /** Cria a estrutura de campos para insersão de dados */ export declare const extruturas_de_campos: { diff --git a/dist-require/pilao-de-dados/visoes/index.js b/dist-require/pilao-de-dados/visoes/index.js index 6bd6c6d..11c7b83 100644 --- a/dist-require/pilao-de-dados/visoes/index.js +++ b/dist-require/pilao-de-dados/visoes/index.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.extruturas_de_campos = exports.visoes = exports.z_contagem_em_pizza = exports.z_contagem_em_barra_vertical = void 0; +exports.extruturas_de_campos = exports.visoes = exports.z_tabela = exports.z_contagem_em_pizza = exports.z_contagem_em_barra_vertical = void 0; const zod_1 = require("zod"); const _serie_consultar_1 = require("../_serie_consultar"); // usar describe para definir o tipo de campo para render do componente @@ -24,9 +24,16 @@ exports.z_contagem_em_pizza = zod_1.z.object({ filtros: _serie_consultar_1.z_filtro.array().optional(), descricao_pelo_usuario: zod_1.z.string().optional(), }); +exports.z_tabela = zod_1.z.object({ + tabela: zod_1.z.string(), + colunas: zod_1.z.string().array().optional(), + filtros: _serie_consultar_1.z_filtro.array().optional(), + descricao_pelo_usuario: zod_1.z.string().optional(), +}); exports.visoes = { z_contagem_em_barra_vertical: exports.z_contagem_em_barra_vertical, z_contagem_em_pizza: exports.z_contagem_em_pizza, + z_tabela: exports.z_tabela, }; /** Cria a estrutura de campos para insersão de dados */ exports.extruturas_de_campos = { @@ -89,4 +96,28 @@ exports.extruturas_de_campos = { filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 4 }, }, }, + z_tabela: { + visao: "z_tabela", + rotulo: "Tabela", + tabela: ({ tabela }) => tabela, + descricao: ({ tabela, descricao_pelo_usuario, filtros }) => { + if (String(descricao_pelo_usuario || "").trim()) + return String(descricao_pelo_usuario || "").trim(); + return `Consulta na ${tabela} ${!filtros?.length + ? "" + : `, quando ${filtros + .map(({ coluna, operador, valor }) => `${coluna} ${operador} ${valor}`) + .join(", ")}`}.`; + }, + campos: { + tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 }, + colunas: { rotulo: "Colunas", tipo_campo: "lista_colunas", order: 2 }, + descricao_pelo_usuario: { + rotulo: "Descrição (opcional)", + tipo_campo: "texto", + order: 3, + }, + filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 4 }, + }, + }, }; diff --git a/package.json b/package.json index 42d3614..eeb8dad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "p-drives", - "version": "0.127.0", + "version": "0.129.0", "description": "", "main": "src/index.ts", "exports": { diff --git a/src/pilao-de-dados/visoes/index.ts b/src/pilao-de-dados/visoes/index.ts index 0c25d2e..52dfc1c 100644 --- a/src/pilao-de-dados/visoes/index.ts +++ b/src/pilao-de-dados/visoes/index.ts @@ -25,9 +25,17 @@ export const z_contagem_em_pizza = z.object({ descricao_pelo_usuario: z.string().optional(), }) +export const z_tabela = z.object({ + tabela: z.string(), + colunas: z.string().array().optional(), + filtros: z_filtro.array().optional(), + descricao_pelo_usuario: z.string().optional(), +}) + export const visoes = { z_contagem_em_barra_vertical, z_contagem_em_pizza, + z_tabela, } /** Cria a estrutura de campos para insersão de dados */ @@ -131,4 +139,35 @@ export const extruturas_de_campos: { filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 4 }, }, }, + + z_tabela: { + visao: "z_tabela", + rotulo: "Tabela", + tabela: ({ tabela }) => tabela, + descricao: ({ tabela, descricao_pelo_usuario, filtros }) => { + if (String(descricao_pelo_usuario || "").trim()) + return String(descricao_pelo_usuario || "").trim() + + return `Consulta na ${tabela} ${ + !filtros?.length + ? "" + : `, quando ${filtros + .map( + ({ coluna, operador, valor }) => + `${coluna} ${operador} ${valor}`, + ) + .join(", ")}` + }.` + }, + campos: { + tabela: { rotulo: "Tabela", tipo_campo: "tabela", order: 1 }, + colunas: { rotulo: "Colunas", tipo_campo: "lista_colunas", order: 2 }, + descricao_pelo_usuario: { + rotulo: "Descrição (opcional)", + tipo_campo: "texto", + order: 3, + }, + filtros: { rotulo: "Filtros", tipo_campo: "lista_filtros", order: 4 }, + }, + }, }