jclib-ui 1.0.119 → 1.0.121

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,6 +1,6 @@
1
1
  import * as t from "react";
2
2
  import t__default, { createContext, useState, useCallback, useEffect, useContext, useRef, useLayoutEffect, useMemo } from "react";
3
- import { isDarkMode, random, isMobile, isDesktop, getDateTimeStr, getHash, formatValor, validarCPF, validarCNPJ } from "jcinfo-utils";
3
+ import { isDarkMode, random, isMobile, formatData, formatDataHora, formatValor, isDesktop, getDateTimeStr, getHash, validarCPF, validarCNPJ } from "jcinfo-utils";
4
4
  import { useDragControls, motion } from "framer-motion";
5
5
  import styled from "styled-components";
6
6
  import { Dropdown, DropdownMenu, DropdownItem, DropdownToggle, Button, InputGroup, Input as Input$1 } from "reactstrap";
@@ -4390,67 +4390,6 @@ const CheckedArea = styled.span`
4390
4390
  color: ${(props) => props.value ? "#fff" : ""};
4391
4391
  background-color: ${(props) => props.value ? "#346fdd" : "#fff"};
4392
4392
  `;
4393
- function adjustValue(value) {
4394
- if (typeof value != "number") {
4395
- value = 0;
4396
- }
4397
- if (!value) {
4398
- value = 0;
4399
- }
4400
- if (Number.isNaN(value)) {
4401
- value = 0;
4402
- }
4403
- if (!Number.isFinite(value)) {
4404
- value = 0;
4405
- }
4406
- return value;
4407
- }
4408
- const FormatValor = ({
4409
- value = 0,
4410
- money = true,
4411
- decimalScale = 2,
4412
- ...rest
4413
- }) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...rest, children: Intl.NumberFormat("pt-br", {
4414
- maximumFractionDigits: decimalScale,
4415
- minimumFractionDigits: decimalScale,
4416
- style: money ? "currency" : "decimal",
4417
- currency: "BRL"
4418
- }).format(adjustValue(value)) });
4419
- const FormatQuant = ({ value = 0, decimalScale = 2, ...rest }) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...rest, children: Intl.NumberFormat("pt-br", {
4420
- maximumFractionDigits: decimalScale,
4421
- minimumFractionDigits: decimalScale,
4422
- style: "decimal"
4423
- }).format(adjustValue(value)) });
4424
- const FormatPercent = ({ value = 0, decimalScale = 2, ...rest }) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...rest, children: Intl.NumberFormat("pt-br", {
4425
- maximumFractionDigits: decimalScale,
4426
- minimumFractionDigits: decimalScale,
4427
- style: "decimal"
4428
- }).format(adjustValue(value)) + "%" });
4429
- const FormatData = ({ value = 0, incHour = true }) => {
4430
- let result = "";
4431
- if (value) {
4432
- let data, hora;
4433
- if (value.indexOf("T") !== -1) {
4434
- data = value.split("T");
4435
- hora = data[1];
4436
- data = data[0];
4437
- } else {
4438
- data = value.split(" ");
4439
- if (data.length > 1) {
4440
- hora = data[1];
4441
- }
4442
- data = data[0];
4443
- }
4444
- if (data.indexOf("-") !== -1) {
4445
- data = data.split("-").reverse().join("/");
4446
- }
4447
- if (hora && incHour) {
4448
- data = data + " " + hora;
4449
- }
4450
- result = data;
4451
- }
4452
- return result;
4453
- };
4454
4393
  function DropDownButton({
4455
4394
  title,
4456
4395
  items,
@@ -4521,6 +4460,39 @@ function DropDownButton({
4521
4460
  }
4522
4461
  );
4523
4462
  }
4463
+ const createTableCols = (cols) => cols;
4464
+ const createTableActions = (action) => action;
4465
+ const createTableOptions = (options) => options;
4466
+ function getDataCol(col, line) {
4467
+ if (typeof col.campo == "function") {
4468
+ return col.campo(line);
4469
+ } else if (typeof col.campo == "string") {
4470
+ const vvalue = line[col.campo];
4471
+ if (col.campo2) {
4472
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "col-campo2", children: [
4473
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fw-bold", children: vvalue }),
4474
+ /* @__PURE__ */ jsxRuntimeExports.jsx("small", { className: "text-secondary", children: line[col.campo2] })
4475
+ ] });
4476
+ }
4477
+ if (col.tipo == "date") {
4478
+ return formatData(vvalue);
4479
+ }
4480
+ if (col.tipo == "datetime") {
4481
+ return formatDataHora(vvalue);
4482
+ }
4483
+ if (col.tipo == "float" || col.tipo == "numeric") {
4484
+ return formatValor(vvalue, 2, false);
4485
+ }
4486
+ if (col.tipo == "money" || col.tipo == "currency" || col.money) {
4487
+ return formatValor(vvalue, 2, true);
4488
+ }
4489
+ if (typeof vvalue == "boolean") {
4490
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(CheckedArea, { value: vvalue, children: vvalue ? /* @__PURE__ */ jsxRuntimeExports.jsx("i", { className: "fas fa-check" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("i", { children: " " }) });
4491
+ }
4492
+ return vvalue;
4493
+ }
4494
+ return null;
4495
+ }
4524
4496
  function Table({
4525
4497
  colunas,
4526
4498
  acoes,
@@ -4534,7 +4506,7 @@ function Table({
4534
4506
  }) {
4535
4507
  if (colunas) {
4536
4508
  colunas.forEach((e) => {
4537
- if (e.tipo && (e.tipo == "float" || e.tipo == "currency")) {
4509
+ if (e.tipo && (e.tipo == "money" || e.tipo == "currency")) {
4538
4510
  e.money = true;
4539
4511
  }
4540
4512
  });
@@ -4580,7 +4552,7 @@ function TableHead({ colunas, incColActions = true }) {
4580
4552
  function TableBody({ colunas, acoes, opcoes, dados, colorir }) {
4581
4553
  var _a;
4582
4554
  const width = ((_a = acoes == null ? void 0 : acoes.acoes) == null ? void 0 : _a.length) || "auto";
4583
- if (!dados || (dados == null ? void 0 : dados.length) === 0) {
4555
+ if (!dados || (dados == null ? void 0 : dados.length) == 0) {
4584
4556
  return null;
4585
4557
  }
4586
4558
  return /* @__PURE__ */ jsxRuntimeExports.jsx("tbody", { children: dados == null ? void 0 : dados.map((line, index) => {
@@ -4601,21 +4573,15 @@ function TableBody({ colunas, acoes, opcoes, dados, colorir }) {
4601
4573
  style: {
4602
4574
  textAlign: getAlign(col),
4603
4575
  fontWeight: col.campoChave || col.bold ? "bold" : "normal",
4604
- width: width2,
4605
- color: colorir ? line.color || "var(--bs-body-color)" : "var(--bs-body-color)"
4576
+ color: colorir && line.color ? line.color : "var(--bs-body-color)",
4577
+ width: width2
4606
4578
  },
4607
4579
  children: [
4608
4580
  col.titulo && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "titulo", children: [
4609
4581
  col.titulo,
4610
4582
  ": "
4611
4583
  ] }),
4612
- /* @__PURE__ */ jsxRuntimeExports.jsxs(FieldData, { children: [
4613
- typeof col.campo === "function" && col.campo(line),
4614
- typeof col.campo === "string" && (col.campo2 ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "col-campo2", children: [
4615
- /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: line[col.campo] }),
4616
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: col.campo2 && line[col.campo2] })
4617
- ] }) : col.money ? /* @__PURE__ */ jsxRuntimeExports.jsx(FormatValor, { value: line[col.campo] }) : typeof line[col.campo] === "boolean" ? /* @__PURE__ */ jsxRuntimeExports.jsx(Checked, { value: line[col.campo] }) : line[col.campo])
4618
- ] })
4584
+ getDataCol(col, line)
4619
4585
  ]
4620
4586
  },
4621
4587
  colId
@@ -4650,12 +4616,6 @@ function TableBody({ colunas, acoes, opcoes, dados, colorir }) {
4650
4616
  ] }, index);
4651
4617
  }) });
4652
4618
  }
4653
- const Checked = ({ value }) => {
4654
- return /* @__PURE__ */ jsxRuntimeExports.jsx(CheckedArea, { value, children: value ? /* @__PURE__ */ jsxRuntimeExports.jsx("i", { className: "fas fa-check" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("i", { children: " " }) });
4655
- };
4656
- const FieldData = ({ children }) => {
4657
- return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: typeof children === "boolean" ? children === true ? "Sim" : "Não" : children });
4658
- };
4659
4619
  const getAlign = (col) => {
4660
4620
  let align = "left";
4661
4621
  if (col.tipo === "float" || col.tipo === "currency" || col.money) {
@@ -4669,9 +4629,6 @@ const getAlign = (col) => {
4669
4629
  }
4670
4630
  return align;
4671
4631
  };
4672
- const createTableCols = (cols) => cols;
4673
- const createTableActions = (action) => action;
4674
- const createTableOptions = (options) => options;
4675
4632
  styled.div`
4676
4633
  display: inline-block;
4677
4634
  width: 27px;
@@ -8281,31 +8238,6 @@ function ModalHeader({
8281
8238
  }
8282
8239
  );
8283
8240
  }
8284
- function ModalBox({
8285
- visible,
8286
- setVisible,
8287
- title,
8288
- children,
8289
- paddingBottom = 10,
8290
- fixed = true,
8291
- //TODO: o padrão deve ser falso qdo resolver problema do framer-motion
8292
- ...rest
8293
- }) {
8294
- const controls = useDragControls();
8295
- if (!visible) {
8296
- return null;
8297
- }
8298
- function startDrag(e) {
8299
- if (isMobile() || fixed) {
8300
- return;
8301
- }
8302
- controls.start(e);
8303
- }
8304
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal, { setVisible, visible, ...rest, children: [
8305
- /* @__PURE__ */ jsxRuntimeExports.jsx(ModalHeader, { onPointerDown: startDrag, setVisible, children: title }),
8306
- /* @__PURE__ */ jsxRuntimeExports.jsx(ModalContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ModalBody, { style: { paddingBottom }, children }) })
8307
- ] });
8308
- }
8309
8241
  var n, o, i = (n = function(t2, e) {
8310
8242
  return n = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t3, e2) {
8311
8243
  t3.__proto__ = e2;
@@ -18187,81 +18119,74 @@ function QRCodeReader({ onResult, setVisible, title }) {
18187
18119
  }
18188
18120
  }
18189
18121
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
18190
- /* @__PURE__ */ jsxRuntimeExports.jsx(
18191
- ModalBox,
18192
- {
18193
- title,
18194
- visible: true,
18195
- setVisible,
18196
- hideScrollBar: false,
18197
- maxWidth: 500,
18198
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "position-relative my-2", children: [
18199
- /* @__PURE__ */ jsxRuntimeExports.jsx(
18200
- jo,
18201
- {
18202
- onResult: handleResult,
18203
- constraints: { facingMode: "environment" }
18204
- }
18205
- ),
18206
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
18207
- "svg",
18208
- {
18209
- width: "50px",
18210
- viewBox: "0 0 100 100",
18211
- style: {
18212
- top: "0px",
18213
- left: "0px",
18214
- zIndex: 1,
18215
- boxSizing: "border-box",
18216
- border: "50px solid rgba(0, 0, 0, 0.25)",
18217
- borderRadius: "15px",
18218
- position: "absolute",
18219
- width: "100%",
18220
- height: "100%"
18221
- },
18222
- children: [
18223
- /* @__PURE__ */ jsxRuntimeExports.jsx(
18224
- "path",
18225
- {
18226
- fill: "none",
18227
- d: "M13,0 L0,0 L0,13",
18228
- stroke: "rgba(255, 0, 0, 0.5)",
18229
- strokeWidth: "5"
18230
- }
18231
- ),
18232
- /* @__PURE__ */ jsxRuntimeExports.jsx(
18233
- "path",
18234
- {
18235
- fill: "none",
18236
- d: "M0,87 L0,100 L13,100",
18237
- stroke: "rgba(255, 0, 0, 0.5)",
18238
- strokeWidth: "5"
18239
- }
18240
- ),
18241
- /* @__PURE__ */ jsxRuntimeExports.jsx(
18242
- "path",
18243
- {
18244
- fill: "none",
18245
- d: "M87,100 L100,100 L100,87",
18246
- stroke: "rgba(255, 0, 0, 0.5)",
18247
- strokeWidth: "5"
18248
- }
18249
- ),
18250
- /* @__PURE__ */ jsxRuntimeExports.jsx(
18251
- "path",
18252
- {
18253
- fill: "none",
18254
- d: "M100,13 L100,0 87,0",
18255
- stroke: "rgba(255, 0, 0, 0.5)",
18256
- strokeWidth: "5"
18257
- }
18258
- )
18259
- ]
18260
- }
18261
- )
18262
- ] })
18263
- }
18264
- ),
18122
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal, { visible: true, setVisible, hideScrollBar: false, maxWidth: 500, children: [
18123
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ModalHeader, { setVisible, children: title }),
18124
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ModalContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ModalBody, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "position-relative my-2", children: [
18125
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18126
+ jo,
18127
+ {
18128
+ onResult: handleResult,
18129
+ constraints: { facingMode: "environment" }
18130
+ }
18131
+ ),
18132
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
18133
+ "svg",
18134
+ {
18135
+ width: "50px",
18136
+ viewBox: "0 0 100 100",
18137
+ style: {
18138
+ top: "0px",
18139
+ left: "0px",
18140
+ zIndex: 1,
18141
+ boxSizing: "border-box",
18142
+ border: "50px solid rgba(0, 0, 0, 0.25)",
18143
+ borderRadius: "15px",
18144
+ position: "absolute",
18145
+ width: "100%",
18146
+ height: "100%"
18147
+ },
18148
+ children: [
18149
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18150
+ "path",
18151
+ {
18152
+ fill: "none",
18153
+ d: "M13,0 L0,0 L0,13",
18154
+ stroke: "rgba(255, 0, 0, 0.5)",
18155
+ strokeWidth: "5"
18156
+ }
18157
+ ),
18158
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18159
+ "path",
18160
+ {
18161
+ fill: "none",
18162
+ d: "M0,87 L0,100 L13,100",
18163
+ stroke: "rgba(255, 0, 0, 0.5)",
18164
+ strokeWidth: "5"
18165
+ }
18166
+ ),
18167
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18168
+ "path",
18169
+ {
18170
+ fill: "none",
18171
+ d: "M87,100 L100,100 L100,87",
18172
+ stroke: "rgba(255, 0, 0, 0.5)",
18173
+ strokeWidth: "5"
18174
+ }
18175
+ ),
18176
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
18177
+ "path",
18178
+ {
18179
+ fill: "none",
18180
+ d: "M100,13 L100,0 87,0",
18181
+ stroke: "rgba(255, 0, 0, 0.5)",
18182
+ strokeWidth: "5"
18183
+ }
18184
+ )
18185
+ ]
18186
+ }
18187
+ )
18188
+ ] }) }) })
18189
+ ] }),
18265
18190
  error && /* @__PURE__ */ jsxRuntimeExports.jsx(Alerta, { onConfirm: handleError, children: error })
18266
18191
  ] });
18267
18192
  }
@@ -18364,6 +18289,67 @@ function CheckBox({ enabled = true, onChange, children, ...rest }) {
18364
18289
  children
18365
18290
  ] }) });
18366
18291
  }
18292
+ function adjustValue(value) {
18293
+ if (typeof value != "number") {
18294
+ value = 0;
18295
+ }
18296
+ if (!value) {
18297
+ value = 0;
18298
+ }
18299
+ if (Number.isNaN(value)) {
18300
+ value = 0;
18301
+ }
18302
+ if (!Number.isFinite(value)) {
18303
+ value = 0;
18304
+ }
18305
+ return value;
18306
+ }
18307
+ const FormatValor = ({
18308
+ value = 0,
18309
+ money = true,
18310
+ decimalScale = 2,
18311
+ ...rest
18312
+ }) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...rest, children: Intl.NumberFormat("pt-br", {
18313
+ maximumFractionDigits: decimalScale,
18314
+ minimumFractionDigits: decimalScale,
18315
+ style: money ? "currency" : "decimal",
18316
+ currency: "BRL"
18317
+ }).format(adjustValue(value)) });
18318
+ const FormatQuant = ({ value = 0, decimalScale = 2, ...rest }) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...rest, children: Intl.NumberFormat("pt-br", {
18319
+ maximumFractionDigits: decimalScale,
18320
+ minimumFractionDigits: decimalScale,
18321
+ style: "decimal"
18322
+ }).format(adjustValue(value)) });
18323
+ const FormatPercent = ({ value = 0, decimalScale = 2, ...rest }) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { ...rest, children: Intl.NumberFormat("pt-br", {
18324
+ maximumFractionDigits: decimalScale,
18325
+ minimumFractionDigits: decimalScale,
18326
+ style: "decimal"
18327
+ }).format(adjustValue(value)) + "%" });
18328
+ const FormatData = ({ value = 0, incHour = true }) => {
18329
+ let result = "";
18330
+ if (value) {
18331
+ let data, hora;
18332
+ if (value.indexOf("T") !== -1) {
18333
+ data = value.split("T");
18334
+ hora = data[1];
18335
+ data = data[0];
18336
+ } else {
18337
+ data = value.split(" ");
18338
+ if (data.length > 1) {
18339
+ hora = data[1];
18340
+ }
18341
+ data = data[0];
18342
+ }
18343
+ if (data.indexOf("-") !== -1) {
18344
+ data = data.split("-").reverse().join("/");
18345
+ }
18346
+ if (hora && incHour) {
18347
+ data = data + " " + hora;
18348
+ }
18349
+ result = data;
18350
+ }
18351
+ return result;
18352
+ };
18367
18353
  const LoadingBarContainer = styled.div`
18368
18354
  --loading-bar-size: 2px;
18369
18355
 
@@ -18857,6 +18843,7 @@ function BoxSearch({
18857
18843
  onClick
18858
18844
  }) {
18859
18845
  var _a;
18846
+ const [inputId] = useState(`box-inp-${random(1e4)}`);
18860
18847
  const [dados, setDados] = useState(null);
18861
18848
  const [error, setError] = useState("");
18862
18849
  const [q2, setQ] = useState("");
@@ -18877,6 +18864,13 @@ function BoxSearch({
18877
18864
  }
18878
18865
  setDados(null);
18879
18866
  loadDados();
18867
+ focarNoInput();
18868
+ }
18869
+ function focarNoInput() {
18870
+ var _a2;
18871
+ if (isDesktop()) {
18872
+ (_a2 = document.querySelector(`#${inputId}`)) == null ? void 0 : _a2.focus();
18873
+ }
18880
18874
  }
18881
18875
  function handleKeyDown(e) {
18882
18876
  if (e.keyCode === 13) {
@@ -18889,40 +18883,53 @@ function BoxSearch({
18889
18883
  }
18890
18884
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
18891
18885
  /* @__PURE__ */ jsxRuntimeExports.jsx(Loading, { visible: info.loading }),
18892
- /* @__PURE__ */ jsxRuntimeExports.jsxs(ModalBox, { title, maxWidth: 800, visible: true, setVisible: setOpen, children: [
18893
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "my-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
18894
- InputPesquisa,
18895
- {
18896
- search: q2,
18897
- setSearch: setQ,
18898
- fnSearch: pesquisar,
18899
- placeHolder,
18900
- onKeyDown: handleKeyDown,
18901
- autoFocus: isDesktop()
18902
- }
18903
- ) }),
18904
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "box-search--data-container", children: [
18905
- ((_a = info.data) == null ? void 0 : _a.length) === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "alert alert-info text-center bold", children: "Nenhum registro encontrado!" }),
18906
- dados && /* @__PURE__ */ jsxRuntimeExports.jsx("table", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("tbody", { children: dados == null ? void 0 : dados.map((item, id) => /* @__PURE__ */ jsxRuntimeExports.jsx("tr", { onClick: () => onClick(item[keyField], item), children: renderLine ? renderLine(item) : fields.map((col, index) => {
18907
- let style;
18908
- if (index == 0) {
18909
- style = {
18910
- width: 60,
18911
- textAlign: "center",
18912
- fontWeight: "bold"
18913
- };
18914
- } else {
18915
- style = {
18916
- width: "auto",
18917
- textAlign: "left",
18918
- fontWeight: "normal"
18919
- };
18886
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal, { title, maxWidth: 800, visible: true, setVisible: setOpen, children: [
18887
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ModalHeader, { setVisible: setOpen, children: title }),
18888
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ModalContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ModalBody, { children: [
18889
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "my-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
18890
+ InputPesquisa,
18891
+ {
18892
+ search: q2,
18893
+ setSearch: setQ,
18894
+ fnSearch: pesquisar,
18895
+ placeHolder,
18896
+ onKeyDown: handleKeyDown,
18897
+ autoFocus: isDesktop(),
18898
+ id: inputId
18920
18899
  }
18921
- return /* @__PURE__ */ jsxRuntimeExports.jsx("td", { style, children: item[col] }, index);
18922
- }) }, id)) }) })
18923
- ] })
18900
+ ) }),
18901
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "box-search--data-container", children: [
18902
+ ((_a = info.data) == null ? void 0 : _a.length) === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "alert alert-info text-center bold", children: "Nenhum registro encontrado!" }),
18903
+ dados && /* @__PURE__ */ jsxRuntimeExports.jsx("table", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("tbody", { children: dados == null ? void 0 : dados.map((item, id) => /* @__PURE__ */ jsxRuntimeExports.jsx("tr", { onClick: () => onClick(item[keyField], item), children: renderLine ? renderLine(item) : fields.map((col, index) => {
18904
+ let style;
18905
+ if (index == 0) {
18906
+ style = {
18907
+ width: 60,
18908
+ textAlign: "center",
18909
+ fontWeight: "bold"
18910
+ };
18911
+ } else {
18912
+ style = {
18913
+ width: "auto",
18914
+ textAlign: "left",
18915
+ fontWeight: "normal"
18916
+ };
18917
+ }
18918
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("td", { style, children: item[col] }, index);
18919
+ }) }, id)) }) })
18920
+ ] })
18921
+ ] }) })
18924
18922
  ] }),
18925
- error && /* @__PURE__ */ jsxRuntimeExports.jsx(Alerta, { onConfirm: () => setError(), children: error })
18923
+ error && /* @__PURE__ */ jsxRuntimeExports.jsx(
18924
+ Alerta,
18925
+ {
18926
+ onConfirm: () => {
18927
+ setError();
18928
+ focarNoInput();
18929
+ },
18930
+ children: error
18931
+ }
18932
+ )
18926
18933
  ] });
18927
18934
  }
18928
18935
  function InputFinder({
@@ -19183,6 +19190,31 @@ function ModalFooter({
19183
19190
  }
19184
19191
  );
19185
19192
  }
19193
+ function ModalBox({
19194
+ visible,
19195
+ setVisible,
19196
+ title,
19197
+ children,
19198
+ paddingBottom = 10,
19199
+ fixed = true,
19200
+ //TODO: o padrão deve ser falso qdo resolver problema do framer-motion
19201
+ ...rest
19202
+ }) {
19203
+ const controls = useDragControls();
19204
+ if (!visible) {
19205
+ return null;
19206
+ }
19207
+ function startDrag(e) {
19208
+ if (isMobile() || fixed) {
19209
+ return;
19210
+ }
19211
+ controls.start(e);
19212
+ }
19213
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal, { setVisible, visible, ...rest, children: [
19214
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ModalHeader, { onPointerDown: startDrag, setVisible, children: title }),
19215
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ModalContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ModalBody, { style: { paddingBottom }, children }) })
19216
+ ] });
19217
+ }
19186
19218
  function ModalFilter({
19187
19219
  setVisible,
19188
19220
  maxWidth,
@@ -19195,19 +19227,22 @@ function ModalFilter({
19195
19227
  const handleClickCancel = () => {
19196
19228
  fnApplyFilter && fnApplyFilter(false);
19197
19229
  };
19198
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(ModalBox, { title: "Filtros", maxWidth, setVisible, visible: true, children: [
19199
- children,
19200
- /* @__PURE__ */ jsxRuntimeExports.jsx("hr", {}),
19201
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mod-filter--btn-area", children: [
19202
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { block: true, color: "primary", onClick: handleClickApply, children: [
19203
- /* @__PURE__ */ jsxRuntimeExports.jsx(IconChecked, {}),
19204
- " Aplicar filtros"
19205
- ] }),
19206
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { block: true, color: "outline-danger", onClick: handleClickCancel, children: [
19207
- /* @__PURE__ */ jsxRuntimeExports.jsx(IconeFechar, {}),
19208
- " Cancelar filtros"
19230
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal, { maxWidth, setVisible, visible: true, children: [
19231
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ModalHeader, { setVisible, children: "Filtros" }),
19232
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ModalContent, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ModalBody, { children: [
19233
+ children,
19234
+ /* @__PURE__ */ jsxRuntimeExports.jsx("hr", {}),
19235
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mod-filter--btn-area", children: [
19236
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { block: true, color: "primary", onClick: handleClickApply, children: [
19237
+ /* @__PURE__ */ jsxRuntimeExports.jsx(IconChecked, {}),
19238
+ " Aplicar filtros"
19239
+ ] }),
19240
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { block: true, color: "outline-danger", onClick: handleClickCancel, children: [
19241
+ /* @__PURE__ */ jsxRuntimeExports.jsx(IconeFechar, {}),
19242
+ " Cancelar filtros"
19243
+ ] })
19209
19244
  ] })
19210
- ] })
19245
+ ] }) })
19211
19246
  ] });
19212
19247
  }
19213
19248
  function Paginacao({ pages, page, setPage }) {
@@ -19722,7 +19757,7 @@ function useLocalForage(key, initialValue, versao = 1) {
19722
19757
  useEffect(() => {
19723
19758
  report.getItem(key).then((value) => {
19724
19759
  if (value) {
19725
- if (value.versao === versao) {
19760
+ if (value.versao == versao) {
19726
19761
  setStoredValue(value.data);
19727
19762
  } else {
19728
19763
  report.removeItem(key);
@@ -20782,6 +20817,7 @@ export {
20782
20817
  createTableActions,
20783
20818
  createTableCols,
20784
20819
  createTableOptions,
20820
+ getDataCol,
20785
20821
  setRouteMain,
20786
20822
  useApi,
20787
20823
  useLibContext,