@vincisys/eyeson 0.6.0 → 0.7.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ColumnDef, type TableMeta } from '@tanstack/react-table';
|
|
2
|
+
import { type TableDividers } from '../Table/Table';
|
|
2
3
|
/** Estado de paginação server-side controlado pelo consumidor do `DataTable`. */
|
|
3
4
|
export interface DataTablePagination {
|
|
4
5
|
/** Página atual (1-indexed). */
|
|
@@ -39,6 +40,12 @@ export interface DataTableProps<TData, TValue> {
|
|
|
39
40
|
'aria-label'?: string;
|
|
40
41
|
/** Classe extra aplicada ao container raiz. */
|
|
41
42
|
className?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Controla as linhas divisórias entre linhas e/ou colunas, repassado
|
|
45
|
+
* para o `Table` interno.
|
|
46
|
+
* @default "row"
|
|
47
|
+
*/
|
|
48
|
+
dividers?: TableDividers;
|
|
42
49
|
}
|
|
43
50
|
/**
|
|
44
51
|
* Tabela genérica construída sobre o `Table` (compound component) e
|
|
@@ -59,6 +66,6 @@ export interface DataTableProps<TData, TValue> {
|
|
|
59
66
|
* />
|
|
60
67
|
* ```
|
|
61
68
|
*/
|
|
62
|
-
export declare function DataTable<TData, TValue>({ columns, data, isLoading, error, pagination, onPageChange, search, emptyStateTitle, emptyStateDescription, meta, 'aria-label': ariaLabel, className, }: DataTableProps<TData, TValue>): import("react").JSX.Element;
|
|
69
|
+
export declare function DataTable<TData, TValue>({ columns, data, isLoading, error, pagination, onPageChange, search, emptyStateTitle, emptyStateDescription, meta, 'aria-label': ariaLabel, className, dividers, }: DataTableProps<TData, TValue>): import("react").JSX.Element;
|
|
63
70
|
export default DataTable;
|
|
64
71
|
//# sourceMappingURL=DataTable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,SAAS,EACd,KAAK,SAAS,EAId,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"DataTable.d.ts","sourceRoot":"","sources":["../../../src/components/DataTable/DataTable.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,SAAS,EACd,KAAK,SAAS,EAId,MAAM,uBAAuB,CAAC;AAM/B,OAAO,EAAS,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE3D,iFAAiF;AACjF,MAAM,WAAW,mBAAmB;IACnC,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,KAAK,EAAE,MAAM,CAAC;CACd;AAED,uEAAuE;AACvE,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc,CAAC,KAAK,EAAE,MAAM;IAC5C,uDAAuD;IACvD,OAAO,EAAE,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;IACpC,mCAAmC;IACnC,IAAI,EAAE,KAAK,EAAE,CAAC;IACd,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uEAAuE;IACvE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,mEAAmE;IACnE,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,mEAAmE;IACnE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iEAAiE;IACjE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,8EAA8E;IAC9E,IAAI,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IACxB,sCAAsC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;CACzB;AAuCD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,EACxC,OAAO,EACP,IAAI,EACJ,SAAiB,EACjB,KAAK,EACL,UAAU,EACV,YAAY,EACZ,MAAM,EACN,eAA+C,EAC/C,qBAAqB,EACrB,IAAI,EACJ,YAAY,EAAE,SAAS,EACvB,SAAS,EACT,QAAQ,GACR,EAAE,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,+BA2I/B;AAED,eAAe,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4990,16 +4990,19 @@ function ia(e) {
|
|
|
4990
4990
|
}
|
|
4991
4991
|
//#endregion
|
|
4992
4992
|
//#region src/components/DataTable/DataTable.tsx
|
|
4993
|
-
function aa({ columns: e, rows: t = 5 }) {
|
|
4994
|
-
return /* @__PURE__ */ h(Y, {
|
|
4993
|
+
function aa({ columns: e, rows: t = 5, dividers: n }) {
|
|
4994
|
+
return /* @__PURE__ */ h(Y, {
|
|
4995
|
+
dividers: n,
|
|
4996
|
+
children: [/* @__PURE__ */ m(Y.Header, { children: /* @__PURE__ */ m(Y.Row, { children: e.map((e, t) => /* @__PURE__ */ m(Y.Head, { children: typeof e.header == "string" ? e.header : null }, e.id ?? t)) }) }), /* @__PURE__ */ m(Y.Body, { children: Array.from({ length: t }).map((t, n) => /* @__PURE__ */ m(Y.Row, { children: e.map((e, t) => /* @__PURE__ */ m(Y.Cell, { children: /* @__PURE__ */ m("div", { className: "h-4 w-full max-w-40 animate-pulse rounded bg-eds-neutral-background" }) }, t)) }, n)) })]
|
|
4997
|
+
});
|
|
4995
4998
|
}
|
|
4996
|
-
function oa({ columns: e, data: t, isLoading: n = !1, error: r, pagination: i, onPageChange: s, search: l, emptyStateTitle: d = "Nenhum resultado encontrado", emptyStateDescription: f, meta: p, "aria-label": g, className: _ }) {
|
|
4997
|
-
let
|
|
4999
|
+
function oa({ columns: e, data: t, isLoading: n = !1, error: r, pagination: i, onPageChange: s, search: l, emptyStateTitle: d = "Nenhum resultado encontrado", emptyStateDescription: f, meta: p, "aria-label": g, className: _, dividers: v }) {
|
|
5000
|
+
let y = ia({
|
|
4998
5001
|
data: t,
|
|
4999
5002
|
columns: e,
|
|
5000
5003
|
getCoreRowModel: $i(),
|
|
5001
5004
|
meta: p
|
|
5002
|
-
}),
|
|
5005
|
+
}), b = y.getRowModel().rows, ee = i ? Math.max(1, Math.ceil(i.total / Math.max(1, i.limit))) : 1, x = !!i && !!s && ee > 1;
|
|
5003
5006
|
return /* @__PURE__ */ h("div", {
|
|
5004
5007
|
"data-eds-component": "DataTable",
|
|
5005
5008
|
className: P("flex w-full flex-col gap-4", _),
|
|
@@ -5026,17 +5029,21 @@ function oa({ columns: e, data: t, isLoading: n = !1, error: r, pagination: i, o
|
|
|
5026
5029
|
"aria-hidden": !0
|
|
5027
5030
|
}), "Carregando..."]
|
|
5028
5031
|
}),
|
|
5029
|
-
n ? /* @__PURE__ */ m(aa, {
|
|
5032
|
+
n ? /* @__PURE__ */ m(aa, {
|
|
5033
|
+
columns: e,
|
|
5034
|
+
dividers: v
|
|
5035
|
+
}) : r ? /* @__PURE__ */ m(ar, {
|
|
5030
5036
|
title: d,
|
|
5031
5037
|
description: f ?? "Houve um erro ao buscar os dados. Tente novamente."
|
|
5032
|
-
}) :
|
|
5038
|
+
}) : b.length === 0 ? /* @__PURE__ */ m(ar, {
|
|
5033
5039
|
title: d,
|
|
5034
5040
|
description: f
|
|
5035
5041
|
}) : /* @__PURE__ */ h(Y, {
|
|
5036
5042
|
"aria-label": g,
|
|
5037
|
-
|
|
5043
|
+
dividers: v,
|
|
5044
|
+
children: [/* @__PURE__ */ m(Y.Header, { children: y.getHeaderGroups().map((e) => /* @__PURE__ */ m(Y.Row, { children: e.headers.map((e) => /* @__PURE__ */ m(Y.Head, { children: e.isPlaceholder ? null : ea(e.column.columnDef.header, e.getContext()) }, e.id)) }, e.id)) }), /* @__PURE__ */ m(Y.Body, { children: b.map((e) => /* @__PURE__ */ m(Y.Row, { children: e.getVisibleCells().map((e) => /* @__PURE__ */ m(Y.Cell, { children: ea(e.column.columnDef.cell, e.getContext()) }, e.id)) }, e.id)) })]
|
|
5038
5045
|
}),
|
|
5039
|
-
|
|
5046
|
+
x && /* @__PURE__ */ h("div", {
|
|
5040
5047
|
className: "flex items-center justify-center gap-2",
|
|
5041
5048
|
children: [
|
|
5042
5049
|
/* @__PURE__ */ m(Dt, {
|
|
@@ -5053,7 +5060,7 @@ function oa({ columns: e, data: t, isLoading: n = !1, error: r, pagination: i, o
|
|
|
5053
5060
|
children: [
|
|
5054
5061
|
i.page,
|
|
5055
5062
|
" / ",
|
|
5056
|
-
|
|
5063
|
+
ee
|
|
5057
5064
|
]
|
|
5058
5065
|
}),
|
|
5059
5066
|
/* @__PURE__ */ m(Dt, {
|
|
@@ -5062,7 +5069,7 @@ function oa({ columns: e, data: t, isLoading: n = !1, error: r, pagination: i, o
|
|
|
5062
5069
|
size: "sm",
|
|
5063
5070
|
icon: o,
|
|
5064
5071
|
label: "Próxima página",
|
|
5065
|
-
disabled: i.page >=
|
|
5072
|
+
disabled: i.page >= ee,
|
|
5066
5073
|
onClick: () => s?.(i.page + 1)
|
|
5067
5074
|
})
|
|
5068
5075
|
]
|