jclib-ui 1.0.203 → 1.0.204
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/dist/jclib-ui.es.js +102 -64
- package/dist/jclib-ui.es.js.map +1 -1
- package/dist/jclib-ui.umd.js +19 -4
- package/dist/jclib-ui.umd.js.map +1 -1
- package/dist/table/table.d.ts +1 -1
- package/dist/table/table.types.d.ts +4 -0
- package/package.json +1 -1
package/dist/jclib-ui.es.js
CHANGED
|
@@ -4220,10 +4220,16 @@ const Container$7 = styled.div`
|
|
|
4220
4220
|
const TableContainer = styled.table`
|
|
4221
4221
|
--color-tb: var(--pn-color-border);
|
|
4222
4222
|
--color-bg: var(--bs-body);
|
|
4223
|
+
--table-border: 1px solid var(--bs-border-color);
|
|
4223
4224
|
|
|
4224
4225
|
width: 100%;
|
|
4225
4226
|
margin-bottom: 8px;
|
|
4226
4227
|
|
|
4228
|
+
border-collapse: separate;
|
|
4229
|
+
border-spacing: 0;
|
|
4230
|
+
|
|
4231
|
+
border-top: ${({ hasBorder }) => hasBorder ? "var(--table-border)" : "none"};
|
|
4232
|
+
|
|
4227
4233
|
tr {
|
|
4228
4234
|
--table-line-height: 36px;
|
|
4229
4235
|
height: var(--table-line-height);
|
|
@@ -4232,7 +4238,9 @@ const TableContainer = styled.table`
|
|
|
4232
4238
|
th,
|
|
4233
4239
|
td {
|
|
4234
4240
|
font-size: var(--font-size);
|
|
4235
|
-
|
|
4241
|
+
|
|
4242
|
+
border-right: ${({ hasBorder }) => hasBorder ? "var(--table-border)" : "none"};
|
|
4243
|
+
border-bottom: ${({ hasBorder }) => hasBorder ? "var(--table-border)" : "none"};
|
|
4236
4244
|
|
|
4237
4245
|
&:first-child {
|
|
4238
4246
|
border-left: none;
|
|
@@ -4240,9 +4248,16 @@ const TableContainer = styled.table`
|
|
|
4240
4248
|
}
|
|
4241
4249
|
|
|
4242
4250
|
thead {
|
|
4243
|
-
|
|
4251
|
+
background-color: var(--bs-body-bg);
|
|
4252
|
+
|
|
4253
|
+
&.table-header--fixed {
|
|
4254
|
+
position: sticky;
|
|
4255
|
+
top: 0;
|
|
4256
|
+
z-index: 9;
|
|
4257
|
+
}
|
|
4244
4258
|
|
|
4245
4259
|
th {
|
|
4260
|
+
border-bottom: 2px solid var(--bs-border-color);
|
|
4246
4261
|
padding: 5px;
|
|
4247
4262
|
color: var(--bs-body-color);
|
|
4248
4263
|
font-weight: bold;
|
|
@@ -4529,7 +4544,9 @@ function Table({
|
|
|
4529
4544
|
border = true,
|
|
4530
4545
|
sizeBreak = 767,
|
|
4531
4546
|
msgSemDados = "Nenhum registro encontrado!",
|
|
4532
|
-
getLineColor
|
|
4547
|
+
getLineColor,
|
|
4548
|
+
onClick,
|
|
4549
|
+
fixedHeader
|
|
4533
4550
|
}) {
|
|
4534
4551
|
var _a;
|
|
4535
4552
|
if (colunas) {
|
|
@@ -4548,7 +4565,14 @@ function Table({
|
|
|
4548
4565
|
if (!dados || dados.length == 0)
|
|
4549
4566
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "alert alert-warning", children: msgSemDados });
|
|
4550
4567
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Container$7, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TableContainer, { alignTop, sizeBreak, hasBorder: border, children: [
|
|
4551
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4568
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4569
|
+
TableHead,
|
|
4570
|
+
{
|
|
4571
|
+
fixedHeader,
|
|
4572
|
+
colunas,
|
|
4573
|
+
incColActions
|
|
4574
|
+
}
|
|
4575
|
+
),
|
|
4552
4576
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4553
4577
|
TableBody,
|
|
4554
4578
|
{
|
|
@@ -4557,16 +4581,17 @@ function Table({
|
|
|
4557
4581
|
dados,
|
|
4558
4582
|
opcoes,
|
|
4559
4583
|
colorir,
|
|
4560
|
-
getLineColor
|
|
4584
|
+
getLineColor,
|
|
4585
|
+
onClick
|
|
4561
4586
|
}
|
|
4562
4587
|
)
|
|
4563
4588
|
] }) });
|
|
4564
4589
|
}
|
|
4565
|
-
function TableHead({ colunas, incColActions = true }) {
|
|
4590
|
+
function TableHead({ colunas, fixedHeader, incColActions = true }) {
|
|
4566
4591
|
if (!colunas) {
|
|
4567
4592
|
return null;
|
|
4568
4593
|
}
|
|
4569
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("thead", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { children: [
|
|
4594
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("thead", { className: fixedHeader ? "table-header--fixed" : "", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { children: [
|
|
4570
4595
|
colunas.filter((c2) => c2.campo !== "color").map((col, key) => {
|
|
4571
4596
|
if (typeof col.visible == "boolean" && !col.visible) {
|
|
4572
4597
|
return null;
|
|
@@ -4590,7 +4615,8 @@ function TableBody({
|
|
|
4590
4615
|
opcoes,
|
|
4591
4616
|
dados,
|
|
4592
4617
|
colorir,
|
|
4593
|
-
getLineColor
|
|
4618
|
+
getLineColor,
|
|
4619
|
+
onClick
|
|
4594
4620
|
}) {
|
|
4595
4621
|
var _a;
|
|
4596
4622
|
const width = ((_a = acoes == null ? void 0 : acoes.acoes) == null ? void 0 : _a.length) || "auto";
|
|
@@ -4607,65 +4633,77 @@ function TableBody({
|
|
|
4607
4633
|
if (!dados || (dados == null ? void 0 : dados.length) == 0) {
|
|
4608
4634
|
return null;
|
|
4609
4635
|
}
|
|
4636
|
+
function handleClickColActions(ev) {
|
|
4637
|
+
ev.preventDefault();
|
|
4638
|
+
ev.stopPropagation();
|
|
4639
|
+
}
|
|
4610
4640
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("tbody", { children: dados == null ? void 0 : dados.map((line, index) => {
|
|
4611
4641
|
var _a2;
|
|
4612
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4642
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4643
|
+
"tr",
|
|
4644
|
+
{
|
|
4645
|
+
role: onClick ? "button" : "",
|
|
4646
|
+
onClick: (ev) => onClick && onClick(line, ev),
|
|
4647
|
+
children: [
|
|
4648
|
+
colunas == null ? void 0 : colunas.map((col, colId) => {
|
|
4649
|
+
if (typeof col.visible == "boolean" && !col.visible) {
|
|
4650
|
+
return null;
|
|
4651
|
+
}
|
|
4652
|
+
let width2 = col.campoChave ? 65 : col.largura || "auto";
|
|
4653
|
+
if (col.campoChave && col.largura) {
|
|
4654
|
+
width2 = col.largura;
|
|
4655
|
+
}
|
|
4656
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4657
|
+
"td",
|
|
4658
|
+
{
|
|
4659
|
+
className: col.className || "",
|
|
4660
|
+
style: {
|
|
4661
|
+
textAlign: getAlign(col),
|
|
4662
|
+
fontWeight: col.campoChave || col.bold ? "bold" : "normal",
|
|
4663
|
+
color: getColor(col, line),
|
|
4664
|
+
width: width2
|
|
4665
|
+
},
|
|
4666
|
+
children: [
|
|
4667
|
+
col.titulo && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "titulo", children: [
|
|
4668
|
+
col.tituloCard || col.titulo,
|
|
4669
|
+
": "
|
|
4670
|
+
] }),
|
|
4671
|
+
getDataCol(col, line)
|
|
4672
|
+
]
|
|
4673
|
+
},
|
|
4674
|
+
colId
|
|
4675
|
+
);
|
|
4676
|
+
}),
|
|
4677
|
+
acoes && ((_a2 = acoes.acoes) == null ? void 0 : _a2.length) > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("td", { className: "acoes", style: { width }, onClick: handleClickColActions, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "acoes-layout", children: [
|
|
4678
|
+
acoes == null ? void 0 : acoes.acoes.map((acao, key) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4679
|
+
"span",
|
|
4680
|
+
{
|
|
4681
|
+
onClick: () => {
|
|
4682
|
+
var _a3, _b;
|
|
4683
|
+
if ((_b = (_a3 = acao == null ? void 0 : acao.botao) == null ? void 0 : _a3.props) == null ? void 0 : _b.disabled) {
|
|
4684
|
+
return;
|
|
4685
|
+
}
|
|
4686
|
+
acao.funcao(line[acoes.campo], line, index);
|
|
4687
|
+
},
|
|
4688
|
+
children: acao.botao
|
|
4689
|
+
},
|
|
4690
|
+
key
|
|
4691
|
+
)),
|
|
4692
|
+
opcoes && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4693
|
+
DropDownButton,
|
|
4694
|
+
{
|
|
4695
|
+
items: opcoes,
|
|
4696
|
+
size: "sm",
|
|
4697
|
+
title: "Opções",
|
|
4698
|
+
dados: line,
|
|
4699
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("i", { className: "fas fa-ellipsis-h" })
|
|
4650
4700
|
}
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
opcoes && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4658
|
-
DropDownButton,
|
|
4659
|
-
{
|
|
4660
|
-
items: opcoes,
|
|
4661
|
-
size: "sm",
|
|
4662
|
-
title: "Opções",
|
|
4663
|
-
dados: line,
|
|
4664
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx("i", { className: "fas fa-ellipsis-h" })
|
|
4665
|
-
}
|
|
4666
|
-
) })
|
|
4667
|
-
] }) })
|
|
4668
|
-
] }, index);
|
|
4701
|
+
) })
|
|
4702
|
+
] }) })
|
|
4703
|
+
]
|
|
4704
|
+
},
|
|
4705
|
+
index
|
|
4706
|
+
);
|
|
4669
4707
|
}) });
|
|
4670
4708
|
}
|
|
4671
4709
|
styled.div`
|