jclib-ui 1.0.203 → 1.0.205
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/FormConsulta/FormConsulta.d.ts +15 -3
- package/dist/jclib-ui.es.js +118 -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 +5 -0
- package/package.json +1 -1
- package/dist/FormConsulta/FormConsulta.types.d.ts +0 -22
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export default function FormConsulta({ titulo, rotaApi, rotaApp, cols, acoes, ordens, ordemPadrao, campoChave, placeHolder, helpLink, Modal, maxWidth, clickCanEdit, }: {
|
|
2
|
+
titulo: any;
|
|
3
|
+
rotaApi: any;
|
|
4
|
+
rotaApp: any;
|
|
5
|
+
cols: any;
|
|
6
|
+
acoes: any;
|
|
7
|
+
ordens: any;
|
|
8
|
+
ordemPadrao?: number;
|
|
9
|
+
campoChave: any;
|
|
10
|
+
placeHolder?: string;
|
|
11
|
+
helpLink: any;
|
|
12
|
+
Modal: any;
|
|
13
|
+
maxWidth?: number;
|
|
14
|
+
clickCanEdit: any;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element;
|
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,10 @@ function Table({
|
|
|
4529
4544
|
border = true,
|
|
4530
4545
|
sizeBreak = 767,
|
|
4531
4546
|
msgSemDados = "Nenhum registro encontrado!",
|
|
4532
|
-
getLineColor
|
|
4547
|
+
getLineColor,
|
|
4548
|
+
onClick,
|
|
4549
|
+
fixedHeader,
|
|
4550
|
+
clickCanEdit
|
|
4533
4551
|
}) {
|
|
4534
4552
|
var _a;
|
|
4535
4553
|
if (colunas) {
|
|
@@ -4545,10 +4563,32 @@ function Table({
|
|
|
4545
4563
|
acoes.acoes = newAcoes;
|
|
4546
4564
|
incColActions = acoes.acoes.length > 0;
|
|
4547
4565
|
}
|
|
4566
|
+
function handleClick(line) {
|
|
4567
|
+
if (onClick) {
|
|
4568
|
+
onClick(line, null);
|
|
4569
|
+
return;
|
|
4570
|
+
}
|
|
4571
|
+
if (clickCanEdit && isDesktop()) {
|
|
4572
|
+
const id = line[(acoes == null ? void 0 : acoes.campo) || "id"];
|
|
4573
|
+
if (id) {
|
|
4574
|
+
const editAction = acoes == null ? void 0 : acoes.acoes[0];
|
|
4575
|
+
if (editAction && editAction.ativa !== false) {
|
|
4576
|
+
editAction.funcao(id, line, 0);
|
|
4577
|
+
}
|
|
4578
|
+
}
|
|
4579
|
+
}
|
|
4580
|
+
}
|
|
4548
4581
|
if (!dados || dados.length == 0)
|
|
4549
4582
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "alert alert-warning", children: msgSemDados });
|
|
4550
4583
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Container$7, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(TableContainer, { alignTop, sizeBreak, hasBorder: border, children: [
|
|
4551
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4584
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4585
|
+
TableHead,
|
|
4586
|
+
{
|
|
4587
|
+
fixedHeader,
|
|
4588
|
+
colunas,
|
|
4589
|
+
incColActions
|
|
4590
|
+
}
|
|
4591
|
+
),
|
|
4552
4592
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4553
4593
|
TableBody,
|
|
4554
4594
|
{
|
|
@@ -4557,16 +4597,17 @@ function Table({
|
|
|
4557
4597
|
dados,
|
|
4558
4598
|
opcoes,
|
|
4559
4599
|
colorir,
|
|
4560
|
-
getLineColor
|
|
4600
|
+
getLineColor,
|
|
4601
|
+
onClick: onClick || clickCanEdit ? handleClick : void 0
|
|
4561
4602
|
}
|
|
4562
4603
|
)
|
|
4563
4604
|
] }) });
|
|
4564
4605
|
}
|
|
4565
|
-
function TableHead({ colunas, incColActions = true }) {
|
|
4606
|
+
function TableHead({ colunas, fixedHeader, incColActions = true }) {
|
|
4566
4607
|
if (!colunas) {
|
|
4567
4608
|
return null;
|
|
4568
4609
|
}
|
|
4569
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("thead", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { children: [
|
|
4610
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("thead", { className: fixedHeader ? "table-header--fixed" : "", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { children: [
|
|
4570
4611
|
colunas.filter((c2) => c2.campo !== "color").map((col, key) => {
|
|
4571
4612
|
if (typeof col.visible == "boolean" && !col.visible) {
|
|
4572
4613
|
return null;
|
|
@@ -4590,7 +4631,8 @@ function TableBody({
|
|
|
4590
4631
|
opcoes,
|
|
4591
4632
|
dados,
|
|
4592
4633
|
colorir,
|
|
4593
|
-
getLineColor
|
|
4634
|
+
getLineColor,
|
|
4635
|
+
onClick
|
|
4594
4636
|
}) {
|
|
4595
4637
|
var _a;
|
|
4596
4638
|
const width = ((_a = acoes == null ? void 0 : acoes.acoes) == null ? void 0 : _a.length) || "auto";
|
|
@@ -4607,65 +4649,77 @@ function TableBody({
|
|
|
4607
4649
|
if (!dados || (dados == null ? void 0 : dados.length) == 0) {
|
|
4608
4650
|
return null;
|
|
4609
4651
|
}
|
|
4652
|
+
function handleClickColActions(ev) {
|
|
4653
|
+
ev.preventDefault();
|
|
4654
|
+
ev.stopPropagation();
|
|
4655
|
+
}
|
|
4610
4656
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("tbody", { children: dados == null ? void 0 : dados.map((line, index) => {
|
|
4611
4657
|
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
|
-
|
|
4658
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4659
|
+
"tr",
|
|
4660
|
+
{
|
|
4661
|
+
role: onClick ? "button" : "",
|
|
4662
|
+
onClick: (ev) => onClick && onClick(line, ev),
|
|
4663
|
+
children: [
|
|
4664
|
+
colunas == null ? void 0 : colunas.map((col, colId) => {
|
|
4665
|
+
if (typeof col.visible == "boolean" && !col.visible) {
|
|
4666
|
+
return null;
|
|
4667
|
+
}
|
|
4668
|
+
let width2 = col.campoChave ? 65 : col.largura || "auto";
|
|
4669
|
+
if (col.campoChave && col.largura) {
|
|
4670
|
+
width2 = col.largura;
|
|
4671
|
+
}
|
|
4672
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
4673
|
+
"td",
|
|
4674
|
+
{
|
|
4675
|
+
className: col.className || "",
|
|
4676
|
+
style: {
|
|
4677
|
+
textAlign: getAlign(col),
|
|
4678
|
+
fontWeight: col.campoChave || col.bold ? "bold" : "normal",
|
|
4679
|
+
color: getColor(col, line),
|
|
4680
|
+
width: width2
|
|
4681
|
+
},
|
|
4682
|
+
children: [
|
|
4683
|
+
col.titulo && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "titulo", children: [
|
|
4684
|
+
col.tituloCard || col.titulo,
|
|
4685
|
+
": "
|
|
4686
|
+
] }),
|
|
4687
|
+
getDataCol(col, line)
|
|
4688
|
+
]
|
|
4689
|
+
},
|
|
4690
|
+
colId
|
|
4691
|
+
);
|
|
4692
|
+
}),
|
|
4693
|
+
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: [
|
|
4694
|
+
acoes == null ? void 0 : acoes.acoes.map((acao, key) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4695
|
+
"span",
|
|
4696
|
+
{
|
|
4697
|
+
onClick: () => {
|
|
4698
|
+
var _a3, _b;
|
|
4699
|
+
if ((_b = (_a3 = acao == null ? void 0 : acao.botao) == null ? void 0 : _a3.props) == null ? void 0 : _b.disabled) {
|
|
4700
|
+
return;
|
|
4701
|
+
}
|
|
4702
|
+
acao.funcao(line[acoes.campo], line, index);
|
|
4703
|
+
},
|
|
4704
|
+
children: acao.botao
|
|
4705
|
+
},
|
|
4706
|
+
key
|
|
4707
|
+
)),
|
|
4708
|
+
opcoes && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4709
|
+
DropDownButton,
|
|
4710
|
+
{
|
|
4711
|
+
items: opcoes,
|
|
4712
|
+
size: "sm",
|
|
4713
|
+
title: "Opções",
|
|
4714
|
+
dados: line,
|
|
4715
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx("i", { className: "fas fa-ellipsis-h" })
|
|
4650
4716
|
}
|
|
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);
|
|
4717
|
+
) })
|
|
4718
|
+
] }) })
|
|
4719
|
+
]
|
|
4720
|
+
},
|
|
4721
|
+
index
|
|
4722
|
+
);
|
|
4669
4723
|
}) });
|
|
4670
4724
|
}
|
|
4671
4725
|
styled.div`
|