@vector-business-services/cristal-ds-web 0.16.0 → 0.17.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.
- package/dist/index.cjs +759 -128
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +479 -117
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +210 -51
- package/dist/index.d.ts +210 -51
- package/dist/index.js +755 -130
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12,11 +12,12 @@ var chart = require('primereact/chart');
|
|
|
12
12
|
var tooltip = require('primereact/tooltip');
|
|
13
13
|
var checkbox = require('primereact/checkbox');
|
|
14
14
|
var chip = require('primereact/chip');
|
|
15
|
+
var contextmenu = require('primereact/contextmenu');
|
|
16
|
+
var api = require('primereact/api');
|
|
17
|
+
var menu = require('primereact/menu');
|
|
15
18
|
var divider = require('primereact/divider');
|
|
16
19
|
var sidebar = require('primereact/sidebar');
|
|
17
20
|
var inputtext = require('primereact/inputtext');
|
|
18
|
-
var api = require('primereact/api');
|
|
19
|
-
var menu = require('primereact/menu');
|
|
20
21
|
var menubar = require('primereact/menubar');
|
|
21
22
|
var tag = require('primereact/tag');
|
|
22
23
|
var message = require('primereact/message');
|
|
@@ -29,8 +30,11 @@ var panel = require('primereact/panel');
|
|
|
29
30
|
var radiobutton = require('primereact/radiobutton');
|
|
30
31
|
var scrollpanel = require('primereact/scrollpanel');
|
|
31
32
|
var selectbutton = require('primereact/selectbutton');
|
|
33
|
+
var skeleton = require('primereact/skeleton');
|
|
32
34
|
var inputswitch = require('primereact/inputswitch');
|
|
33
35
|
var tabview = require('primereact/tabview');
|
|
36
|
+
var datatable = require('primereact/datatable');
|
|
37
|
+
var column = require('primereact/column');
|
|
34
38
|
var toast = require('primereact/toast');
|
|
35
39
|
|
|
36
40
|
// src/components/Accordion/Accordion.tsx
|
|
@@ -764,6 +768,152 @@ var Chip = react.forwardRef(function Chip2({
|
|
|
764
768
|
}
|
|
765
769
|
);
|
|
766
770
|
});
|
|
771
|
+
var itensDoPrime = (model) => model.map((item) => ({
|
|
772
|
+
id: item.id,
|
|
773
|
+
label: item.label,
|
|
774
|
+
icon: item.icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-menu__icon", "aria-hidden": "true", children: item.icon }) : void 0,
|
|
775
|
+
disabled: item.disabled,
|
|
776
|
+
command: item.command,
|
|
777
|
+
url: item.url,
|
|
778
|
+
target: item.target,
|
|
779
|
+
className: [item.selected && "cr-menu__item--selected", item.className].filter(Boolean).join(" "),
|
|
780
|
+
data: { selected: item.selected }
|
|
781
|
+
}));
|
|
782
|
+
var Menu = react.forwardRef(function Menu2({
|
|
783
|
+
model,
|
|
784
|
+
density = "normal",
|
|
785
|
+
popup = false,
|
|
786
|
+
popupAlignment = "left",
|
|
787
|
+
loading = false,
|
|
788
|
+
loadingLabel = "Carregando",
|
|
789
|
+
"aria-label": ariaLabel,
|
|
790
|
+
"aria-labelledby": ariaLabelledBy,
|
|
791
|
+
onShow,
|
|
792
|
+
onHide,
|
|
793
|
+
id,
|
|
794
|
+
className,
|
|
795
|
+
...props
|
|
796
|
+
}, ref) {
|
|
797
|
+
const primeRef = react.useRef(null);
|
|
798
|
+
const alvo = react.useRef(null);
|
|
799
|
+
const context = react.useContext(api.PrimeReactContext);
|
|
800
|
+
react.useImperativeHandle(ref, () => ({
|
|
801
|
+
toggle: (event) => {
|
|
802
|
+
alvo.current = event.currentTarget;
|
|
803
|
+
primeRef.current?.toggle(event);
|
|
804
|
+
},
|
|
805
|
+
show: (event) => {
|
|
806
|
+
alvo.current = event.currentTarget;
|
|
807
|
+
primeRef.current?.show(event);
|
|
808
|
+
},
|
|
809
|
+
hide: (event) => primeRef.current?.hide(event),
|
|
810
|
+
getElement: () => primeRef.current?.getElement() ?? null
|
|
811
|
+
}));
|
|
812
|
+
const items = loading ? [
|
|
813
|
+
{
|
|
814
|
+
label: loadingLabel,
|
|
815
|
+
disabled: true,
|
|
816
|
+
template: () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cr-menu__loading", children: /* @__PURE__ */ jsxRuntime.jsx(react$1.CircleNotch, { className: "cr-menu__spinner", "aria-hidden": "true" }) })
|
|
817
|
+
}
|
|
818
|
+
] : itensDoPrime(model);
|
|
819
|
+
const classes = ["cr-lista cr-menu", `cr-menu--${density}`, popup && "cr-menu--popup", className].filter(Boolean).join(" ");
|
|
820
|
+
const pt = {
|
|
821
|
+
// O nome acessível vai na lista (role=menu); o Prime lê `ariaLabel`, mas não o declara no tipo.
|
|
822
|
+
menu: {
|
|
823
|
+
className: "cr-menu__list",
|
|
824
|
+
"aria-label": ariaLabel,
|
|
825
|
+
"aria-labelledby": ariaLabelledBy,
|
|
826
|
+
"aria-busy": loading || void 0
|
|
827
|
+
},
|
|
828
|
+
menuitem: (options) => {
|
|
829
|
+
const item = options?.context?.item;
|
|
830
|
+
return {
|
|
831
|
+
className: "cr-menu__item",
|
|
832
|
+
"aria-current": item?.data?.selected ? "true" : void 0
|
|
833
|
+
};
|
|
834
|
+
},
|
|
835
|
+
content: { className: "cr-menu__content" },
|
|
836
|
+
// Animação de entrada e saída (a do Prime) e o lado do popup, medido logo depois de o Prime
|
|
837
|
+
// posicionar.
|
|
838
|
+
// Numa microtarefa: no onEnter o Prime ainda está religando a ref (getElement vem vazio); ela
|
|
839
|
+
// roda logo depois, antes de a tela ser pintada.
|
|
840
|
+
transition: transicaoDoPopup(
|
|
841
|
+
() => queueMicrotask(() => seguirLado(primeRef.current?.getElement(), alvo.current))
|
|
842
|
+
),
|
|
843
|
+
action: { className: "cr-lista__item cr-menu__action" },
|
|
844
|
+
label: { className: "cr-menu__label" }
|
|
845
|
+
};
|
|
846
|
+
const menu$1 = /* @__PURE__ */ jsxRuntime.jsx(
|
|
847
|
+
menu.Menu,
|
|
848
|
+
{
|
|
849
|
+
...props,
|
|
850
|
+
unstyled: true,
|
|
851
|
+
ref: primeRef,
|
|
852
|
+
id,
|
|
853
|
+
className: classes,
|
|
854
|
+
model: items,
|
|
855
|
+
popup,
|
|
856
|
+
popupAlignment,
|
|
857
|
+
onShow,
|
|
858
|
+
onHide,
|
|
859
|
+
pt
|
|
860
|
+
}
|
|
861
|
+
);
|
|
862
|
+
return context ? menu$1 : /* @__PURE__ */ jsxRuntime.jsx(api.PrimeReactProvider, { children: menu$1 });
|
|
863
|
+
});
|
|
864
|
+
var ContextMenu = react.forwardRef(function ContextMenu2({
|
|
865
|
+
model,
|
|
866
|
+
density = "normal",
|
|
867
|
+
global,
|
|
868
|
+
"aria-label": ariaLabel,
|
|
869
|
+
"aria-labelledby": ariaLabelledBy,
|
|
870
|
+
onShow,
|
|
871
|
+
onHide,
|
|
872
|
+
id,
|
|
873
|
+
className,
|
|
874
|
+
...props
|
|
875
|
+
}, ref) {
|
|
876
|
+
const primeRef = react.useRef(null);
|
|
877
|
+
react.useImperativeHandle(ref, () => ({
|
|
878
|
+
show: (event) => primeRef.current?.show(event),
|
|
879
|
+
hide: (event) => primeRef.current?.hide(event),
|
|
880
|
+
getElement: () => primeRef.current?.getElement() ?? null
|
|
881
|
+
}));
|
|
882
|
+
const classes = ["cr-lista cr-menu cr-context-menu", `cr-menu--${density}`, className].filter(Boolean).join(" ");
|
|
883
|
+
const pt = {
|
|
884
|
+
root: { ...props, className: classes },
|
|
885
|
+
// O nome vai na lista (o Prime dá a ela role=menubar, vertical).
|
|
886
|
+
menu: {
|
|
887
|
+
className: "cr-menu__list",
|
|
888
|
+
"aria-label": ariaLabel,
|
|
889
|
+
"aria-labelledby": ariaLabelledBy
|
|
890
|
+
},
|
|
891
|
+
// O Prime põe aria-level nos itens, que role=menuitem não aceita (axe).
|
|
892
|
+
menuitem: { className: "cr-menu__item", "aria-level": void 0 },
|
|
893
|
+
action: { className: "cr-lista__item cr-menu__action" },
|
|
894
|
+
label: { className: "cr-menu__label" },
|
|
895
|
+
// As classes da animação do Prime (ContextMenu.css). O tipo do Prime exige o addEndListener
|
|
896
|
+
// do react-transition-group, que aqui não se usa.
|
|
897
|
+
transition: {
|
|
898
|
+
classNames: { enter: "cr-context-menu--entrar", enterActive: "cr-context-menu--entrando" }
|
|
899
|
+
},
|
|
900
|
+
// O Prime aplica o pt do content, mas não o declara no tipo.
|
|
901
|
+
...{ content: { className: "cr-menu__content" } }
|
|
902
|
+
};
|
|
903
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
904
|
+
contextmenu.ContextMenu,
|
|
905
|
+
{
|
|
906
|
+
unstyled: true,
|
|
907
|
+
ref: primeRef,
|
|
908
|
+
id,
|
|
909
|
+
model: itensDoPrime(model),
|
|
910
|
+
global,
|
|
911
|
+
onShow,
|
|
912
|
+
onHide,
|
|
913
|
+
pt
|
|
914
|
+
}
|
|
915
|
+
);
|
|
916
|
+
});
|
|
767
917
|
var Divider = react.forwardRef(function Divider2({ orientation = "horizontal", variant = "solid", className, style, ...props }, ref) {
|
|
768
918
|
const primeRef = react.useRef(null);
|
|
769
919
|
react.useImperativeHandle(ref, () => primeRef.current?.getElement());
|
|
@@ -1044,98 +1194,6 @@ var Input = react.forwardRef(function Input2({
|
|
|
1044
1194
|
] })
|
|
1045
1195
|
] });
|
|
1046
1196
|
});
|
|
1047
|
-
var Menu = react.forwardRef(function Menu2({
|
|
1048
|
-
model,
|
|
1049
|
-
density = "normal",
|
|
1050
|
-
popup = false,
|
|
1051
|
-
popupAlignment = "left",
|
|
1052
|
-
loading = false,
|
|
1053
|
-
loadingLabel = "Carregando",
|
|
1054
|
-
"aria-label": ariaLabel,
|
|
1055
|
-
"aria-labelledby": ariaLabelledBy,
|
|
1056
|
-
onShow,
|
|
1057
|
-
onHide,
|
|
1058
|
-
id,
|
|
1059
|
-
className,
|
|
1060
|
-
...props
|
|
1061
|
-
}, ref) {
|
|
1062
|
-
const primeRef = react.useRef(null);
|
|
1063
|
-
const alvo = react.useRef(null);
|
|
1064
|
-
const context = react.useContext(api.PrimeReactContext);
|
|
1065
|
-
react.useImperativeHandle(ref, () => ({
|
|
1066
|
-
toggle: (event) => {
|
|
1067
|
-
alvo.current = event.currentTarget;
|
|
1068
|
-
primeRef.current?.toggle(event);
|
|
1069
|
-
},
|
|
1070
|
-
show: (event) => {
|
|
1071
|
-
alvo.current = event.currentTarget;
|
|
1072
|
-
primeRef.current?.show(event);
|
|
1073
|
-
},
|
|
1074
|
-
hide: (event) => primeRef.current?.hide(event),
|
|
1075
|
-
getElement: () => primeRef.current?.getElement() ?? null
|
|
1076
|
-
}));
|
|
1077
|
-
const items = loading ? [
|
|
1078
|
-
{
|
|
1079
|
-
label: loadingLabel,
|
|
1080
|
-
disabled: true,
|
|
1081
|
-
template: () => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "cr-menu__loading", children: /* @__PURE__ */ jsxRuntime.jsx(react$1.CircleNotch, { className: "cr-menu__spinner", "aria-hidden": "true" }) })
|
|
1082
|
-
}
|
|
1083
|
-
] : model.map((item) => ({
|
|
1084
|
-
id: item.id,
|
|
1085
|
-
label: item.label,
|
|
1086
|
-
icon: item.icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-menu__icon", "aria-hidden": "true", children: item.icon }) : void 0,
|
|
1087
|
-
disabled: item.disabled,
|
|
1088
|
-
command: item.command,
|
|
1089
|
-
url: item.url,
|
|
1090
|
-
target: item.target,
|
|
1091
|
-
className: [item.selected && "cr-menu__item--selected", item.className].filter(Boolean).join(" "),
|
|
1092
|
-
data: { selected: item.selected }
|
|
1093
|
-
}));
|
|
1094
|
-
const classes = ["cr-lista cr-menu", `cr-menu--${density}`, popup && "cr-menu--popup", className].filter(Boolean).join(" ");
|
|
1095
|
-
const pt = {
|
|
1096
|
-
// O nome acessível vai na lista (role=menu); o Prime lê `ariaLabel`, mas não o declara no tipo.
|
|
1097
|
-
menu: {
|
|
1098
|
-
className: "cr-menu__list",
|
|
1099
|
-
"aria-label": ariaLabel,
|
|
1100
|
-
"aria-labelledby": ariaLabelledBy,
|
|
1101
|
-
"aria-busy": loading || void 0
|
|
1102
|
-
},
|
|
1103
|
-
menuitem: (options) => {
|
|
1104
|
-
const item = options?.context?.item;
|
|
1105
|
-
return {
|
|
1106
|
-
className: "cr-menu__item",
|
|
1107
|
-
"aria-current": item?.data?.selected ? "true" : void 0
|
|
1108
|
-
};
|
|
1109
|
-
},
|
|
1110
|
-
content: { className: "cr-menu__content" },
|
|
1111
|
-
// Animação de entrada e saída (a do Prime) e o lado do popup, medido logo depois de o Prime
|
|
1112
|
-
// posicionar.
|
|
1113
|
-
// Numa microtarefa: no onEnter o Prime ainda está religando a ref (getElement vem vazio); ela
|
|
1114
|
-
// roda logo depois, antes de a tela ser pintada.
|
|
1115
|
-
transition: transicaoDoPopup(
|
|
1116
|
-
() => queueMicrotask(() => seguirLado(primeRef.current?.getElement(), alvo.current))
|
|
1117
|
-
),
|
|
1118
|
-
action: { className: "cr-lista__item cr-menu__action" },
|
|
1119
|
-
label: { className: "cr-menu__label" }
|
|
1120
|
-
};
|
|
1121
|
-
const menu$1 = /* @__PURE__ */ jsxRuntime.jsx(
|
|
1122
|
-
menu.Menu,
|
|
1123
|
-
{
|
|
1124
|
-
...props,
|
|
1125
|
-
unstyled: true,
|
|
1126
|
-
ref: primeRef,
|
|
1127
|
-
id,
|
|
1128
|
-
className: classes,
|
|
1129
|
-
model: items,
|
|
1130
|
-
popup,
|
|
1131
|
-
popupAlignment,
|
|
1132
|
-
onShow,
|
|
1133
|
-
onHide,
|
|
1134
|
-
pt
|
|
1135
|
-
}
|
|
1136
|
-
);
|
|
1137
|
-
return context ? menu$1 : /* @__PURE__ */ jsxRuntime.jsx(api.PrimeReactProvider, { children: menu$1 });
|
|
1138
|
-
});
|
|
1139
1197
|
|
|
1140
1198
|
// src/components/Menubar/assets/vector-logo-simbolo.svg
|
|
1141
1199
|
var vector_logo_simbolo_default = 'data:image/svg+xml,<svg preserveAspectRatio="none" overflow="visible" style="display: block;" width="42.7061" height="20" viewBox="0 0 42.7061 20" fill="none" xmlns="http://www.w3.org/2000/svg">%0A<g id="Grupo 2380">%0A<path id="Caminho 1049" d="M26.8782 10.21C26.8393 10.1525 26.7869 10.1055 26.7255 10.0731C26.6642 10.0408 26.5958 10.024 26.5264 10.0244H4.21626C4.14666 10.024 4.07803 10.0408 4.0165 10.0733C3.95497 10.1059 3.90244 10.1531 3.8636 10.2109C3.82535 10.2676 3.80224 10.3333 3.79648 10.4015C3.79072 10.4697 3.80251 10.5383 3.8307 10.6007L7.35895 19.7545C7.39283 19.8281 7.44722 19.8905 7.51559 19.934C7.58397 19.9776 7.66345 20.0005 7.74451 20C7.82641 19.9998 7.90647 19.9758 7.97493 19.9308C8.0434 19.8859 8.09731 19.822 8.13007 19.7469L11.5604 13.47H25.3511C25.4325 13.4705 25.5123 13.4474 25.5809 13.4035C25.6494 13.3596 25.7038 13.2969 25.7375 13.2228L26.9086 10.5964C26.9365 10.5347 26.9484 10.4669 26.9431 10.3993C26.9378 10.3318 26.9154 10.2666 26.8782 10.21V10.21Z" fill="%23C1BFBF"/>%0A<g id="Grupo 2378">%0A<path id="Caminho 1050" d="M26.3926 6.06543L24.0666 19.1424C24.0588 19.2502 24.0736 19.3585 24.1103 19.4602C24.1469 19.5619 24.2045 19.6549 24.2792 19.7329C24.3554 19.813 24.447 19.8767 24.5485 19.9202C24.65 19.9637 24.7593 19.9861 24.8698 19.986H30.4229L29.2578 13.5446L26.3926 6.06543Z" fill="%231545DE"/>%0A<g id="Grupo 2377">%0A<path id="Caminho 1051" d="M42.2783 16.0921H42.0598C42.0303 11.9033 41.8911 10.7668 41.2541 10.086C40.167 9.29536 38.9793 8.65329 37.7225 8.17676C37.1378 7.91016 36.4755 7.60812 36.3684 7.52881C36.1102 7.27149 34.8768 5.05179 34.2145 3.85884C33.9378 3.36107 33.6956 2.92488 33.5311 2.63887C33.166 1.80107 32.5487 1.09795 31.7653 0.627372C30.9818 0.15679 30.0712 -0.0578392 29.16 0.0133599H21.1072C21.036 0.0134652 20.966 0.0313585 20.9036 0.0653944C20.8411 0.0994303 20.7881 0.148532 20.7494 0.208251C20.7106 0.268417 20.6872 0.337237 20.6813 0.408613C20.6754 0.479989 20.6872 0.551716 20.7157 0.617433L28.9955 19.7283C29.0285 19.8051 29.0832 19.8705 29.1529 19.9166C29.2226 19.9626 29.3043 19.9872 29.3878 19.9873H30.9849C31.0972 19.9869 31.2048 19.9425 31.2848 19.8637C31.3648 19.7848 31.4107 19.6778 31.4126 19.5655C31.4126 18.581 31.8037 17.6368 32.4999 16.9406C33.1961 16.2444 34.1403 15.8533 35.1248 15.8533C36.1093 15.8533 37.0535 16.2444 37.7497 16.9406C38.4459 17.6368 38.837 18.581 38.837 19.5655C38.839 19.6778 38.8848 19.7848 38.9648 19.8637C39.0447 19.9425 39.1524 19.9869 39.2647 19.9873H41.6396C41.6961 19.9871 41.752 19.9758 41.8041 19.9539C41.8561 19.9321 41.9034 19.9002 41.9431 19.8601C41.9828 19.82 42.0143 19.7724 42.0356 19.7201C42.0569 19.6678 42.0677 19.6119 42.0674 19.5554C42.0674 19.2179 42.0674 18.9015 42.0674 18.5911H42.2783C42.3923 18.5904 42.5013 18.5445 42.5815 18.4636C42.6617 18.3826 42.7065 18.2731 42.7061 18.1591V16.5241C42.7065 16.4101 42.6617 16.3006 42.5815 16.2196C42.5013 16.1386 42.3923 16.0928 42.2783 16.0921V16.0921ZM31.6058 8.33621H27.9359C27.7958 8.33732 27.6591 8.29246 27.547 8.20849C27.4348 8.12452 27.3533 8.00609 27.3149 7.87135L26.0545 3.91029C26.0293 3.8176 26.0262 3.72028 26.0455 3.62619C26.0649 3.5321 26.1061 3.44388 26.1658 3.36866C26.2264 3.29247 26.3034 3.23091 26.391 3.18856C26.4786 3.1462 26.5747 3.12414 26.672 3.124H28.9305C29.2861 3.13975 29.6349 3.22716 29.9558 3.38098C30.2768 3.53479 30.5634 3.75184 30.7984 4.01912C31.7475 5.02307 32.2662 6.35841 32.2437 7.73973C32.2339 7.90191 32.1624 8.05419 32.0437 8.16517C31.925 8.27615 31.7683 8.33736 31.6058 8.33621V8.33621Z" fill="%231545DE"/>%0A</g>%0A</g>%0A<path id="Caminho 1052" d="M18.318 0.208784C18.2779 0.150057 18.224 0.102045 18.1611 0.0689531C18.0981 0.0358617 18.028 0.0186933 17.9569 0.0189526H0.432107C0.361515 0.0187583 0.291932 0.0356991 0.229331 0.0683223C0.166729 0.100945 0.112985 0.148276 0.0727059 0.206248C0.0332923 0.263519 0.00898875 0.329827 0.00205642 0.399002C-0.00487591 0.468178 0.00578389 0.537987 0.0330492 0.601939L1.0404 3.29747C1.07434 3.3749 1.13023 3.44069 1.20115 3.48672C1.27206 3.53275 1.35491 3.55701 1.43945 3.55648H16.5134C16.5968 3.55702 16.6787 3.53341 16.749 3.4885C16.8194 3.44359 16.8753 3.37931 16.9099 3.30338L18.3526 0.607835C18.3813 0.543894 18.3933 0.473655 18.3872 0.403804C18.3812 0.333954 18.3573 0.266823 18.318 0.208784V0.208784Z" fill="%23C1BFBF"/>%0A<path id="Caminho 1053" d="M20.2107 5.18251C20.1706 5.12378 20.1167 5.07577 20.0538 5.04268C19.9908 5.00959 19.9207 4.99242 19.8496 4.99268H2.32482C2.25423 4.99248 2.18465 5.00943 2.12205 5.04205C2.05945 5.07467 2.0057 5.122 1.96542 5.17997C1.92601 5.23725 1.9017 5.30355 1.89477 5.37273C1.88784 5.4419 1.8985 5.51171 1.92577 5.57567L2.93311 8.2712C2.96706 8.34863 3.02294 8.41442 3.09386 8.46045C3.16478 8.50648 3.24763 8.53073 3.33217 8.53021H18.4061C18.4896 8.53075 18.5714 8.50714 18.6417 8.46224C18.7121 8.41733 18.768 8.35304 18.8026 8.27711L20.2453 5.58157C20.274 5.51761 20.2859 5.44738 20.2798 5.37754C20.2738 5.30771 20.25 5.24058 20.2107 5.18251V5.18251Z" fill="%23C1BFBF"/>%0A</g>%0A</svg>%0A';
|
|
@@ -2042,6 +2100,40 @@ var seta2 = (label, icon) => (options) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
|
2042
2100
|
children: icon
|
|
2043
2101
|
}
|
|
2044
2102
|
);
|
|
2103
|
+
var paginatorTemplate = (rowsPerPageLabel) => ({
|
|
2104
|
+
layout: "FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown",
|
|
2105
|
+
FirstPageLink: seta2("Primeira p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDoubleLeft, { "aria-hidden": "true" })),
|
|
2106
|
+
PrevPageLink: seta2("P\xE1gina anterior", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretLeft, { "aria-hidden": "true" })),
|
|
2107
|
+
NextPageLink: seta2("Pr\xF3xima p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretRight, { "aria-hidden": "true" })),
|
|
2108
|
+
LastPageLink: seta2("\xDAltima p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDoubleRight, { "aria-hidden": "true" })),
|
|
2109
|
+
PageLinks: (options) => {
|
|
2110
|
+
const ativa = options.page === options.currentPage;
|
|
2111
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2112
|
+
"button",
|
|
2113
|
+
{
|
|
2114
|
+
type: "button",
|
|
2115
|
+
className: "cr-paginator__page",
|
|
2116
|
+
"aria-label": `P\xE1gina ${options.page + 1}`,
|
|
2117
|
+
"aria-current": ativa ? "page" : void 0,
|
|
2118
|
+
onClick: options.onClick,
|
|
2119
|
+
children: options.page + 1
|
|
2120
|
+
}
|
|
2121
|
+
);
|
|
2122
|
+
},
|
|
2123
|
+
// O Prime chama o template mesmo sem rowsPerPageOptions.
|
|
2124
|
+
RowsPerPageDropdown: (options) => options.options.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2125
|
+
Select,
|
|
2126
|
+
{
|
|
2127
|
+
className: "cr-paginator__rows",
|
|
2128
|
+
size: "medium",
|
|
2129
|
+
"aria-label": rowsPerPageLabel,
|
|
2130
|
+
options: options.options,
|
|
2131
|
+
optionValue: "value",
|
|
2132
|
+
value: options.value,
|
|
2133
|
+
onChange: (value) => options.onChange({ value })
|
|
2134
|
+
}
|
|
2135
|
+
)
|
|
2136
|
+
});
|
|
2045
2137
|
var Paginator = react.forwardRef(function Paginator2({
|
|
2046
2138
|
totalRecords,
|
|
2047
2139
|
first,
|
|
@@ -2077,40 +2169,7 @@ var Paginator = react.forwardRef(function Paginator2({
|
|
|
2077
2169
|
setInterno({ first: event.first, rows: event.rows });
|
|
2078
2170
|
onPageChange?.(event);
|
|
2079
2171
|
},
|
|
2080
|
-
template:
|
|
2081
|
-
layout: "FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown",
|
|
2082
|
-
FirstPageLink: seta2("Primeira p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDoubleLeft, { "aria-hidden": "true" })),
|
|
2083
|
-
PrevPageLink: seta2("P\xE1gina anterior", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretLeft, { "aria-hidden": "true" })),
|
|
2084
|
-
NextPageLink: seta2("Pr\xF3xima p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretRight, { "aria-hidden": "true" })),
|
|
2085
|
-
LastPageLink: seta2("\xDAltima p\xE1gina", /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretDoubleRight, { "aria-hidden": "true" })),
|
|
2086
|
-
PageLinks: (options) => {
|
|
2087
|
-
const ativa = options.page === options.currentPage;
|
|
2088
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2089
|
-
"button",
|
|
2090
|
-
{
|
|
2091
|
-
type: "button",
|
|
2092
|
-
className: "cr-paginator__page",
|
|
2093
|
-
"aria-label": `P\xE1gina ${options.page + 1}`,
|
|
2094
|
-
"aria-current": ativa ? "page" : void 0,
|
|
2095
|
-
onClick: options.onClick,
|
|
2096
|
-
children: options.page + 1
|
|
2097
|
-
}
|
|
2098
|
-
);
|
|
2099
|
-
},
|
|
2100
|
-
// O Prime chama o template mesmo sem rowsPerPageOptions.
|
|
2101
|
-
RowsPerPageDropdown: (options) => options.options.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2102
|
-
Select,
|
|
2103
|
-
{
|
|
2104
|
-
className: "cr-paginator__rows",
|
|
2105
|
-
size: "medium",
|
|
2106
|
-
"aria-label": rowsPerPageLabel,
|
|
2107
|
-
options: options.options,
|
|
2108
|
-
optionValue: "value",
|
|
2109
|
-
value: options.value,
|
|
2110
|
-
onChange: (value) => options.onChange({ value })
|
|
2111
|
-
}
|
|
2112
|
-
)
|
|
2113
|
-
},
|
|
2172
|
+
template: paginatorTemplate(rowsPerPageLabel),
|
|
2114
2173
|
pt: {
|
|
2115
2174
|
root: { className: ["cr-paginator", className].filter(Boolean).join(" ") },
|
|
2116
2175
|
pages: { className: "cr-paginator__pages" }
|
|
@@ -2294,6 +2353,37 @@ var SegmentControl = react.forwardRef(
|
|
|
2294
2353
|
);
|
|
2295
2354
|
}
|
|
2296
2355
|
);
|
|
2356
|
+
var Skeleton = react.forwardRef(function Skeleton2({
|
|
2357
|
+
shape = "rectangle",
|
|
2358
|
+
width = "100%",
|
|
2359
|
+
height = "16px",
|
|
2360
|
+
size,
|
|
2361
|
+
animated = true,
|
|
2362
|
+
className,
|
|
2363
|
+
...props
|
|
2364
|
+
}, ref) {
|
|
2365
|
+
const primeRef = react.useRef(null);
|
|
2366
|
+
react.useImperativeHandle(ref, () => primeRef.current?.getElement());
|
|
2367
|
+
const classes = [
|
|
2368
|
+
"cr-skeleton",
|
|
2369
|
+
`cr-skeleton--${shape}`,
|
|
2370
|
+
animated && "cr-skeleton--animated",
|
|
2371
|
+
className
|
|
2372
|
+
].filter(Boolean).join(" ");
|
|
2373
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2374
|
+
skeleton.Skeleton,
|
|
2375
|
+
{
|
|
2376
|
+
unstyled: true,
|
|
2377
|
+
ref: primeRef,
|
|
2378
|
+
shape,
|
|
2379
|
+
width,
|
|
2380
|
+
height,
|
|
2381
|
+
size,
|
|
2382
|
+
animation: animated ? "wave" : "none",
|
|
2383
|
+
pt: { root: { ...props, className: classes } }
|
|
2384
|
+
}
|
|
2385
|
+
);
|
|
2386
|
+
});
|
|
2297
2387
|
var Switch = react.forwardRef(function Switch2({
|
|
2298
2388
|
label,
|
|
2299
2389
|
showLabel = true,
|
|
@@ -2431,6 +2521,541 @@ var Tabs = react.forwardRef(function Tabs2({ activeIndex, onTabChange, children,
|
|
|
2431
2521
|
}
|
|
2432
2522
|
);
|
|
2433
2523
|
});
|
|
2524
|
+
function Column(_props) {
|
|
2525
|
+
return null;
|
|
2526
|
+
}
|
|
2527
|
+
var caixa = (label) => ({
|
|
2528
|
+
root: (options) => ({
|
|
2529
|
+
className: `cr-checkbox cr-checkbox__control${options?.props.checked ? " cr-checkbox__control--checked" : ""}`,
|
|
2530
|
+
role: void 0,
|
|
2531
|
+
"aria-label": void 0,
|
|
2532
|
+
tabIndex: void 0
|
|
2533
|
+
}),
|
|
2534
|
+
input: { className: "cr-checkbox__input", "aria-label": label },
|
|
2535
|
+
box: { className: "cr-checkbox__box" },
|
|
2536
|
+
icon: { className: "cr-checkbox__icon", "aria-hidden": true }
|
|
2537
|
+
});
|
|
2538
|
+
function Ajuda({ content }) {
|
|
2539
|
+
const ref = react.useRef(null);
|
|
2540
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2541
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2542
|
+
"button",
|
|
2543
|
+
{
|
|
2544
|
+
ref,
|
|
2545
|
+
type: "button",
|
|
2546
|
+
className: "cr-table__help",
|
|
2547
|
+
"aria-label": "Ajuda",
|
|
2548
|
+
onClick: (event) => event.stopPropagation(),
|
|
2549
|
+
onKeyDown: (event) => event.stopPropagation(),
|
|
2550
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react$1.Question, { "aria-hidden": "true" })
|
|
2551
|
+
}
|
|
2552
|
+
),
|
|
2553
|
+
/* @__PURE__ */ jsxRuntime.jsx(Tooltip, { target: ref, content, describe: true })
|
|
2554
|
+
] });
|
|
2555
|
+
}
|
|
2556
|
+
var chaveDaColuna = (props, index) => props.columnKey ?? props.field ?? String(index);
|
|
2557
|
+
function coluna(element, index, opcoes) {
|
|
2558
|
+
const { help, header, align, selectionMode, ...props } = element.props;
|
|
2559
|
+
const { carregando, ajustada, abrirMenu } = opcoes;
|
|
2560
|
+
const frozen = opcoes.fixada ?? props.frozen;
|
|
2561
|
+
const chave = chaveDaColuna(element.props, index);
|
|
2562
|
+
const celula = [
|
|
2563
|
+
"cr-table__cell",
|
|
2564
|
+
`cr-table__cell--${align ?? "left"}`,
|
|
2565
|
+
selectionMode && "cr-table__cell--selection",
|
|
2566
|
+
// O Prime calcula a posição das colunas fixas procurando esta classe, mesmo no unstyled.
|
|
2567
|
+
frozen && "cr-table__cell--frozen p-frozen-column"
|
|
2568
|
+
].filter(Boolean).join(" ");
|
|
2569
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2570
|
+
column.Column,
|
|
2571
|
+
{
|
|
2572
|
+
...props,
|
|
2573
|
+
align,
|
|
2574
|
+
frozen,
|
|
2575
|
+
style: ajustada ? { ...props.style, width: "1px" } : props.style,
|
|
2576
|
+
...carregando ? { body: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { size: selectionMode ? "24px" : void 0 }) } : { selectionMode },
|
|
2577
|
+
header: (
|
|
2578
|
+
// Carregando, a seleção perde o checkbox do cabeçalho: o nome da coluna fica só para o
|
|
2579
|
+
// leitor de tela (um Skeleton ali sumiria, da mesma cor do fundo do cabeçalho).
|
|
2580
|
+
carregando && selectionMode ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-so-leitor", children: "Sele\xE7\xE3o" }) : help && typeof header !== "function" ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "cr-table__title", children: [
|
|
2581
|
+
/* @__PURE__ */ jsxRuntime.jsx(Ajuda, { content: help }),
|
|
2582
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-table__title-text", children: header })
|
|
2583
|
+
] }) : header
|
|
2584
|
+
),
|
|
2585
|
+
pt: {
|
|
2586
|
+
headerCell: {
|
|
2587
|
+
className: `cr-table__head ${celula}`,
|
|
2588
|
+
// Botão direito (ou a tecla de menu) no cabeçalho: o menu de contexto da coluna.
|
|
2589
|
+
...abrirMenu && !selectionMode && !carregando && {
|
|
2590
|
+
onContextMenu: (event) => abrirMenu(event, {
|
|
2591
|
+
chave,
|
|
2592
|
+
titulo: typeof header === "string" ? header : props.field ?? "",
|
|
2593
|
+
sortField: props.sortField ?? props.field,
|
|
2594
|
+
sortable: Boolean(props.sortable),
|
|
2595
|
+
fixada: Boolean(frozen)
|
|
2596
|
+
})
|
|
2597
|
+
}
|
|
2598
|
+
},
|
|
2599
|
+
headerContent: { className: "cr-table__head-content" },
|
|
2600
|
+
headerTitle: { className: "cr-table__head-title" },
|
|
2601
|
+
sort: { className: "cr-table__sort" },
|
|
2602
|
+
columnResizer: { className: "cr-table__resizer" },
|
|
2603
|
+
bodyCell: { className: celula },
|
|
2604
|
+
headerCheckbox: caixa("Selecionar todas as linhas"),
|
|
2605
|
+
rowCheckbox: caixa("Selecionar linha")
|
|
2606
|
+
}
|
|
2607
|
+
},
|
|
2608
|
+
element.key ?? chave
|
|
2609
|
+
);
|
|
2610
|
+
}
|
|
2611
|
+
function TableBase({
|
|
2612
|
+
value,
|
|
2613
|
+
children,
|
|
2614
|
+
selectionMode,
|
|
2615
|
+
paginator = true,
|
|
2616
|
+
rows,
|
|
2617
|
+
rowsPerPageOptions,
|
|
2618
|
+
report = ({ shown, totalRecords: total }) => `Mostrando ${shown} de ${total} registros`,
|
|
2619
|
+
rowsPerPageLabel = "Itens por p\xE1gina",
|
|
2620
|
+
emptyMessage = "N\xE3o h\xE1 registros para mostrar.",
|
|
2621
|
+
loading,
|
|
2622
|
+
columnMenu = true,
|
|
2623
|
+
...props
|
|
2624
|
+
}, ref) {
|
|
2625
|
+
const elementos = react.Children.toArray(children).filter(react.isValidElement);
|
|
2626
|
+
const colunaDeSelecao = elementos.some((element) => element.props.selectionMode === "multiple");
|
|
2627
|
+
const template = paginatorTemplate(rowsPerPageLabel);
|
|
2628
|
+
const carregando = Boolean(loading);
|
|
2629
|
+
const paginaPropria = !props.onPage;
|
|
2630
|
+
const ordemPropria = !props.onSort;
|
|
2631
|
+
const [pagina, setPagina] = react.useState({
|
|
2632
|
+
first: props.first ?? 0,
|
|
2633
|
+
rows: rows ?? rowsPerPageOptions?.[0] ?? 10
|
|
2634
|
+
});
|
|
2635
|
+
const [ordem, setOrdem] = react.useState({
|
|
2636
|
+
sortField: props.sortField ?? "",
|
|
2637
|
+
sortOrder: props.sortOrder
|
|
2638
|
+
});
|
|
2639
|
+
const linhas = paginaPropria ? pagina.rows : rows ?? rowsPerPageOptions?.[0] ?? 10;
|
|
2640
|
+
const menuRef = react.useRef(null);
|
|
2641
|
+
const [fixadas, setFixadas] = react.useState({});
|
|
2642
|
+
const [ajustadas, setAjustadas] = react.useState({});
|
|
2643
|
+
const [alvo, setAlvo] = react.useState(null);
|
|
2644
|
+
const ordenar = (sortField, sortOrder) => {
|
|
2645
|
+
if (props.onSort) {
|
|
2646
|
+
props.onSort({
|
|
2647
|
+
first: props.first ?? 0,
|
|
2648
|
+
rows: linhas,
|
|
2649
|
+
sortField,
|
|
2650
|
+
sortOrder,
|
|
2651
|
+
multiSortMeta: null,
|
|
2652
|
+
filters: props.filters ?? {}
|
|
2653
|
+
});
|
|
2654
|
+
return;
|
|
2655
|
+
}
|
|
2656
|
+
setOrdem({ sortField, sortOrder });
|
|
2657
|
+
if (paginaPropria) setPagina((atual) => ({ ...atual, first: 0 }));
|
|
2658
|
+
};
|
|
2659
|
+
const modeloDoMenu = alvo ? [
|
|
2660
|
+
{
|
|
2661
|
+
label: alvo.fixada ? "Desafixar coluna" : "Fixar coluna",
|
|
2662
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.Note, {}),
|
|
2663
|
+
command: () => setFixadas((atuais) => ({ ...atuais, [alvo.chave]: !alvo.fixada }))
|
|
2664
|
+
},
|
|
2665
|
+
{
|
|
2666
|
+
label: "Ajustar ao conte\xFAdo",
|
|
2667
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.ArrowsInLineHorizontal, {}),
|
|
2668
|
+
command: () => setAjustadas((atuais) => ({ ...atuais, [alvo.chave]: true }))
|
|
2669
|
+
},
|
|
2670
|
+
...alvo.sortable && alvo.sortField ? [
|
|
2671
|
+
{
|
|
2672
|
+
label: "Ordenar ascendente",
|
|
2673
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.SortAscending, {}),
|
|
2674
|
+
command: () => ordenar(alvo.sortField, 1)
|
|
2675
|
+
},
|
|
2676
|
+
{
|
|
2677
|
+
label: "Ordenar descendente",
|
|
2678
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.SortDescending, {}),
|
|
2679
|
+
command: () => ordenar(alvo.sortField, -1)
|
|
2680
|
+
}
|
|
2681
|
+
] : []
|
|
2682
|
+
] : [];
|
|
2683
|
+
const [pedido, setPedido] = react.useState(null);
|
|
2684
|
+
react.useEffect(() => {
|
|
2685
|
+
if (pedido) menuRef.current?.show(pedido);
|
|
2686
|
+
}, [pedido]);
|
|
2687
|
+
const abrirMenu = (event, coluna2) => {
|
|
2688
|
+
event.preventDefault();
|
|
2689
|
+
setAlvo(coluna2);
|
|
2690
|
+
setPedido(event);
|
|
2691
|
+
};
|
|
2692
|
+
const tableProps = {
|
|
2693
|
+
scrollable: true,
|
|
2694
|
+
columnResizeMode: "expand",
|
|
2695
|
+
paginatorTemplate: {
|
|
2696
|
+
...template,
|
|
2697
|
+
layout: `CurrentPageReport ${template.layout}`,
|
|
2698
|
+
CurrentPageReport: (options) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "cr-table__report", children: report({
|
|
2699
|
+
shown: options.totalRecords === 0 ? 0 : options.last - options.first + 1,
|
|
2700
|
+
totalRecords: options.totalRecords
|
|
2701
|
+
}) })
|
|
2702
|
+
},
|
|
2703
|
+
sortIcon: ({ sorted, sortOrder }) => sorted && sortOrder === -1 ? /* @__PURE__ */ jsxRuntime.jsx(react$1.SortDescending, { "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx(react$1.SortAscending, { "aria-hidden": "true" }),
|
|
2704
|
+
checkIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.Check, { size: 16 }),
|
|
2705
|
+
...props,
|
|
2706
|
+
...paginaPropria && {
|
|
2707
|
+
first: pagina.first,
|
|
2708
|
+
onPage: (event) => setPagina({ first: event.first, rows: event.rows })
|
|
2709
|
+
},
|
|
2710
|
+
...ordemPropria && {
|
|
2711
|
+
sortField: ordem.sortField,
|
|
2712
|
+
sortOrder: ordem.sortOrder,
|
|
2713
|
+
onSort: (event) => {
|
|
2714
|
+
setOrdem({ sortField: event.sortField, sortOrder: event.sortOrder });
|
|
2715
|
+
if (paginaPropria) setPagina((atual) => ({ ...atual, first: 0 }));
|
|
2716
|
+
}
|
|
2717
|
+
},
|
|
2718
|
+
value,
|
|
2719
|
+
selectionMode: selectionMode ?? (colunaDeSelecao ? "checkbox" : void 0),
|
|
2720
|
+
paginator,
|
|
2721
|
+
rows: linhas,
|
|
2722
|
+
rowsPerPageOptions,
|
|
2723
|
+
// Carregando: uma linha de Skeleton por linha da página, sem filtrar nem ordenar (lazy), com o
|
|
2724
|
+
// total que já se conhece no rodapé.
|
|
2725
|
+
...carregando && {
|
|
2726
|
+
value: Array.from({ length: linhas }, (_, indice) => ({ crSkeleton: indice })),
|
|
2727
|
+
dataKey: "crSkeleton",
|
|
2728
|
+
lazy: true,
|
|
2729
|
+
totalRecords: props.totalRecords ?? value.length,
|
|
2730
|
+
selectionMode: void 0
|
|
2731
|
+
},
|
|
2732
|
+
emptyMessage: typeof emptyMessage === "function" ? emptyMessage : /* @__PURE__ */ jsxRuntime.jsx(Message, { type: "info", className: "cr-table__empty", children: emptyMessage })
|
|
2733
|
+
};
|
|
2734
|
+
return (
|
|
2735
|
+
// Contêiner da consulta de largura: a variante de 360px também muda a caixa do DataTable.
|
|
2736
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-table", children: [
|
|
2737
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2738
|
+
datatable.DataTable,
|
|
2739
|
+
{
|
|
2740
|
+
...tableProps,
|
|
2741
|
+
ref,
|
|
2742
|
+
unstyled: true,
|
|
2743
|
+
pt: {
|
|
2744
|
+
root: { className: "cr-table__box", "aria-busy": carregando || void 0 },
|
|
2745
|
+
header: { className: "cr-table__header" },
|
|
2746
|
+
wrapper: { className: "cr-table__wrapper cr-rolagem-fina" },
|
|
2747
|
+
table: { className: "cr-table__table" },
|
|
2748
|
+
thead: { className: "cr-table__thead" },
|
|
2749
|
+
tbody: { className: "cr-table__tbody" },
|
|
2750
|
+
bodyRow: {
|
|
2751
|
+
className: carregando ? "cr-table__row cr-table__row--skeleton" : "cr-table__row"
|
|
2752
|
+
},
|
|
2753
|
+
emptyMessage: { className: "cr-table__empty-row" },
|
|
2754
|
+
resizeHelper: { className: "cr-table__resize-helper" },
|
|
2755
|
+
footer: { className: "cr-table__footer" },
|
|
2756
|
+
paginator: {
|
|
2757
|
+
root: { className: "cr-paginator cr-table__paginator" },
|
|
2758
|
+
pages: { className: "cr-paginator__pages" }
|
|
2759
|
+
}
|
|
2760
|
+
},
|
|
2761
|
+
children: elementos.map((element, index) => {
|
|
2762
|
+
const chave = chaveDaColuna(element.props, index);
|
|
2763
|
+
return coluna(element, index, {
|
|
2764
|
+
carregando,
|
|
2765
|
+
fixada: fixadas[chave],
|
|
2766
|
+
ajustada: Boolean(ajustadas[chave]),
|
|
2767
|
+
abrirMenu: columnMenu ? abrirMenu : void 0
|
|
2768
|
+
});
|
|
2769
|
+
})
|
|
2770
|
+
}
|
|
2771
|
+
),
|
|
2772
|
+
columnMenu && // O ContextMenu do Cristal (a Dropdown List do Figma): abre no ponto do clique.
|
|
2773
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2774
|
+
ContextMenu,
|
|
2775
|
+
{
|
|
2776
|
+
ref: menuRef,
|
|
2777
|
+
model: modeloDoMenu,
|
|
2778
|
+
"aria-label": alvo ? `Op\xE7\xF5es da coluna ${alvo.titulo}` : void 0,
|
|
2779
|
+
onHide: () => setAlvo(null)
|
|
2780
|
+
}
|
|
2781
|
+
)
|
|
2782
|
+
] })
|
|
2783
|
+
);
|
|
2784
|
+
}
|
|
2785
|
+
var Table = react.forwardRef(TableBase);
|
|
2786
|
+
function BotaoDeMenu({
|
|
2787
|
+
icon,
|
|
2788
|
+
label,
|
|
2789
|
+
model,
|
|
2790
|
+
variant,
|
|
2791
|
+
tooltip,
|
|
2792
|
+
popupAlignment = "left",
|
|
2793
|
+
disabled,
|
|
2794
|
+
className
|
|
2795
|
+
}) {
|
|
2796
|
+
const menuRef = react.useRef(null);
|
|
2797
|
+
const menuId = react.useId();
|
|
2798
|
+
const [open, setOpen] = react.useState(false);
|
|
2799
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className, children: [
|
|
2800
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2801
|
+
IconButton,
|
|
2802
|
+
{
|
|
2803
|
+
variant,
|
|
2804
|
+
size: "medium",
|
|
2805
|
+
icon,
|
|
2806
|
+
"aria-label": label,
|
|
2807
|
+
"aria-haspopup": "menu",
|
|
2808
|
+
"aria-expanded": open,
|
|
2809
|
+
"aria-controls": open ? menuId : void 0,
|
|
2810
|
+
tooltip: open ? false : tooltip,
|
|
2811
|
+
disabled,
|
|
2812
|
+
onClick: (event) => menuRef.current?.toggle(event)
|
|
2813
|
+
}
|
|
2814
|
+
),
|
|
2815
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2816
|
+
Menu,
|
|
2817
|
+
{
|
|
2818
|
+
ref: menuRef,
|
|
2819
|
+
id: menuId,
|
|
2820
|
+
popup: true,
|
|
2821
|
+
popupAlignment,
|
|
2822
|
+
model,
|
|
2823
|
+
"aria-label": label,
|
|
2824
|
+
onShow: () => setOpen(true),
|
|
2825
|
+
onHide: () => setOpen(false)
|
|
2826
|
+
}
|
|
2827
|
+
)
|
|
2828
|
+
] });
|
|
2829
|
+
}
|
|
2830
|
+
function MaisAcoes({
|
|
2831
|
+
actions,
|
|
2832
|
+
label,
|
|
2833
|
+
className
|
|
2834
|
+
}) {
|
|
2835
|
+
if (actions.length === 0) return null;
|
|
2836
|
+
const model = actions.map((action) => ({
|
|
2837
|
+
label: action.label,
|
|
2838
|
+
icon: action.icon,
|
|
2839
|
+
disabled: action.disabled,
|
|
2840
|
+
command: (event) => action.onClick?.(event.originalEvent)
|
|
2841
|
+
}));
|
|
2842
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2843
|
+
BotaoDeMenu,
|
|
2844
|
+
{
|
|
2845
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.DotsThreeVertical, {}),
|
|
2846
|
+
label,
|
|
2847
|
+
model,
|
|
2848
|
+
variant: "tertiary",
|
|
2849
|
+
popupAlignment: "right",
|
|
2850
|
+
className
|
|
2851
|
+
}
|
|
2852
|
+
);
|
|
2853
|
+
}
|
|
2854
|
+
function BarraDeFiltros({
|
|
2855
|
+
filters,
|
|
2856
|
+
onClear,
|
|
2857
|
+
clearLabel
|
|
2858
|
+
}) {
|
|
2859
|
+
const chipsRef = react.useRef(null);
|
|
2860
|
+
const [setas, setSetas] = react.useState({ esquerda: false, direita: false });
|
|
2861
|
+
const medir = react.useCallback(() => {
|
|
2862
|
+
const chips = chipsRef.current;
|
|
2863
|
+
if (!chips) return;
|
|
2864
|
+
setSetas({
|
|
2865
|
+
esquerda: chips.scrollLeft > 0,
|
|
2866
|
+
// sem token: 1px de folga para o arredondamento da rolagem.
|
|
2867
|
+
direita: chips.scrollLeft + chips.clientWidth < chips.scrollWidth - 1
|
|
2868
|
+
});
|
|
2869
|
+
}, []);
|
|
2870
|
+
react.useEffect(() => {
|
|
2871
|
+
const chips = chipsRef.current;
|
|
2872
|
+
if (!chips) return;
|
|
2873
|
+
medir();
|
|
2874
|
+
const observer = new ResizeObserver(medir);
|
|
2875
|
+
observer.observe(chips);
|
|
2876
|
+
return () => observer.disconnect();
|
|
2877
|
+
}, [medir, filters.length]);
|
|
2878
|
+
const rolar = (sentido) => chipsRef.current?.scrollBy({
|
|
2879
|
+
left: sentido * chipsRef.current.clientWidth,
|
|
2880
|
+
behavior: "smooth"
|
|
2881
|
+
});
|
|
2882
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-table-toolbar__filters", children: [
|
|
2883
|
+
setas.esquerda && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2884
|
+
IconButton,
|
|
2885
|
+
{
|
|
2886
|
+
variant: "tertiary",
|
|
2887
|
+
size: "xsmall",
|
|
2888
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretLeft, {}),
|
|
2889
|
+
"aria-label": "Filtros anteriores",
|
|
2890
|
+
onClick: () => rolar(-1)
|
|
2891
|
+
}
|
|
2892
|
+
),
|
|
2893
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: chipsRef, className: "cr-table-toolbar__chips", onScroll: medir, children: filters.map((filter) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2894
|
+
Chip,
|
|
2895
|
+
{
|
|
2896
|
+
variant: "outline",
|
|
2897
|
+
size: "large",
|
|
2898
|
+
label: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2899
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "cr-table-toolbar__chip-label", children: [
|
|
2900
|
+
filter.label,
|
|
2901
|
+
":"
|
|
2902
|
+
] }),
|
|
2903
|
+
" ",
|
|
2904
|
+
filter.value
|
|
2905
|
+
] }),
|
|
2906
|
+
removeLabel: `Remover filtro ${filter.label}: ${filter.value}`,
|
|
2907
|
+
onRemove: filter.onRemove ? () => {
|
|
2908
|
+
filter.onRemove?.();
|
|
2909
|
+
return false;
|
|
2910
|
+
} : void 0
|
|
2911
|
+
},
|
|
2912
|
+
`${filter.label}:${filter.value}`
|
|
2913
|
+
)) }),
|
|
2914
|
+
setas.direita && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2915
|
+
IconButton,
|
|
2916
|
+
{
|
|
2917
|
+
variant: "tertiary",
|
|
2918
|
+
size: "xsmall",
|
|
2919
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.CaretRight, {}),
|
|
2920
|
+
"aria-label": "Pr\xF3ximos filtros",
|
|
2921
|
+
onClick: () => rolar(1)
|
|
2922
|
+
}
|
|
2923
|
+
),
|
|
2924
|
+
onClear && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2925
|
+
/* @__PURE__ */ jsxRuntime.jsx(Divider, { orientation: "vertical", className: "cr-table-toolbar__divider" }),
|
|
2926
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2927
|
+
IconButton,
|
|
2928
|
+
{
|
|
2929
|
+
variant: "tertiary",
|
|
2930
|
+
size: "xsmall",
|
|
2931
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.Trash, {}),
|
|
2932
|
+
"aria-label": clearLabel,
|
|
2933
|
+
onClick: onClear
|
|
2934
|
+
}
|
|
2935
|
+
)
|
|
2936
|
+
] })
|
|
2937
|
+
] });
|
|
2938
|
+
}
|
|
2939
|
+
var TableToolbar = react.forwardRef(function TableToolbar2({
|
|
2940
|
+
searchValue,
|
|
2941
|
+
onSearchChange,
|
|
2942
|
+
searchPlaceholder = "Procurar por",
|
|
2943
|
+
searchLabel = "Procurar",
|
|
2944
|
+
onFilter,
|
|
2945
|
+
filterLabel = "Filtrar",
|
|
2946
|
+
filters = [],
|
|
2947
|
+
onClearFilters,
|
|
2948
|
+
clearFiltersLabel = "Limpar filtros",
|
|
2949
|
+
actions = [],
|
|
2950
|
+
moreActionsLabel = "Mais a\xE7\xF5es",
|
|
2951
|
+
className,
|
|
2952
|
+
...props
|
|
2953
|
+
}, ref) {
|
|
2954
|
+
const busca = searchValue !== void 0 || onSearchChange !== void 0;
|
|
2955
|
+
const contagem = filters.length;
|
|
2956
|
+
const filtrar = contagem > 0 ? `${filterLabel}, ${contagem} aplicados` : filterLabel;
|
|
2957
|
+
const secundarias = actions.filter((action) => action.variant !== "primary");
|
|
2958
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref, className: ["cr-table-toolbar", className].filter(Boolean).join(" "), ...props, children: [
|
|
2959
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-table-toolbar__main", children: [
|
|
2960
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-table-toolbar__start", children: [
|
|
2961
|
+
busca && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2962
|
+
Input,
|
|
2963
|
+
{
|
|
2964
|
+
className: "cr-table-toolbar__search",
|
|
2965
|
+
size: "medium",
|
|
2966
|
+
role: "searchbox",
|
|
2967
|
+
"aria-label": searchLabel,
|
|
2968
|
+
placeholder: searchPlaceholder,
|
|
2969
|
+
value: searchValue ?? "",
|
|
2970
|
+
onChange: (event) => onSearchChange?.(event.target.value),
|
|
2971
|
+
trailingIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.MagnifyingGlass, {})
|
|
2972
|
+
}
|
|
2973
|
+
),
|
|
2974
|
+
onFilter && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "cr-table-toolbar__filter", children: [
|
|
2975
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2976
|
+
Button,
|
|
2977
|
+
{
|
|
2978
|
+
className: "cr-table-toolbar__filter-button",
|
|
2979
|
+
variant: "tertiary",
|
|
2980
|
+
size: "medium",
|
|
2981
|
+
leadingIcon: /* @__PURE__ */ jsxRuntime.jsx(react$1.Funnel, {}),
|
|
2982
|
+
"aria-label": contagem > 0 ? filtrar : void 0,
|
|
2983
|
+
onClick: onFilter,
|
|
2984
|
+
children: filterLabel
|
|
2985
|
+
}
|
|
2986
|
+
),
|
|
2987
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2988
|
+
IconButton,
|
|
2989
|
+
{
|
|
2990
|
+
className: "cr-table-toolbar__filter-icon",
|
|
2991
|
+
variant: "tertiary",
|
|
2992
|
+
size: "medium",
|
|
2993
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(react$1.Funnel, {}),
|
|
2994
|
+
"aria-label": filtrar,
|
|
2995
|
+
tooltip: filterLabel,
|
|
2996
|
+
onClick: onFilter
|
|
2997
|
+
}
|
|
2998
|
+
),
|
|
2999
|
+
contagem > 0 && /* @__PURE__ */ jsxRuntime.jsx(Badge, { className: "cr-table-toolbar__badge", size: "medium", "aria-hidden": "true", children: contagem })
|
|
3000
|
+
] })
|
|
3001
|
+
] }),
|
|
3002
|
+
actions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "cr-table-toolbar__end", children: [
|
|
3003
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3004
|
+
MaisAcoes,
|
|
3005
|
+
{
|
|
3006
|
+
actions: secundarias,
|
|
3007
|
+
label: moreActionsLabel,
|
|
3008
|
+
className: "cr-table-toolbar__more cr-table-toolbar__more--tablet"
|
|
3009
|
+
}
|
|
3010
|
+
),
|
|
3011
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3012
|
+
MaisAcoes,
|
|
3013
|
+
{
|
|
3014
|
+
actions,
|
|
3015
|
+
label: moreActionsLabel,
|
|
3016
|
+
className: "cr-table-toolbar__more cr-table-toolbar__more--mobile"
|
|
3017
|
+
}
|
|
3018
|
+
),
|
|
3019
|
+
actions.map((action) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3020
|
+
Button,
|
|
3021
|
+
{
|
|
3022
|
+
className: `cr-table-toolbar__action cr-table-toolbar__action--${action.variant ?? "tertiary"}`,
|
|
3023
|
+
variant: action.variant ?? "tertiary",
|
|
3024
|
+
size: "medium",
|
|
3025
|
+
leadingIcon: action.icon,
|
|
3026
|
+
disabled: action.disabled,
|
|
3027
|
+
onClick: action.onClick,
|
|
3028
|
+
children: action.label
|
|
3029
|
+
},
|
|
3030
|
+
action.label
|
|
3031
|
+
))
|
|
3032
|
+
] })
|
|
3033
|
+
] }),
|
|
3034
|
+
contagem > 0 && /* @__PURE__ */ jsxRuntime.jsx(BarraDeFiltros, { filters, onClear: onClearFilters, clearLabel: clearFiltersLabel })
|
|
3035
|
+
] });
|
|
3036
|
+
});
|
|
3037
|
+
function TableRowActions({
|
|
3038
|
+
model,
|
|
3039
|
+
"aria-label": label,
|
|
3040
|
+
icon = /* @__PURE__ */ jsxRuntime.jsx(react$1.GearSix, {}),
|
|
3041
|
+
tooltip = "A\xE7\xF5es",
|
|
3042
|
+
popupAlignment,
|
|
3043
|
+
disabled
|
|
3044
|
+
}) {
|
|
3045
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3046
|
+
BotaoDeMenu,
|
|
3047
|
+
{
|
|
3048
|
+
icon,
|
|
3049
|
+
label,
|
|
3050
|
+
model,
|
|
3051
|
+
variant: "ghost",
|
|
3052
|
+
tooltip,
|
|
3053
|
+
popupAlignment,
|
|
3054
|
+
disabled,
|
|
3055
|
+
className: "cr-table__row-actions"
|
|
3056
|
+
}
|
|
3057
|
+
);
|
|
3058
|
+
}
|
|
2434
3059
|
var SEVERITY2 = {
|
|
2435
3060
|
warning: "warn",
|
|
2436
3061
|
danger: "error",
|
|
@@ -2507,6 +3132,8 @@ exports.Card = Card;
|
|
|
2507
3132
|
exports.Chart = Chart;
|
|
2508
3133
|
exports.Checkbox = Checkbox;
|
|
2509
3134
|
exports.Chip = Chip;
|
|
3135
|
+
exports.Column = Column;
|
|
3136
|
+
exports.ContextMenu = ContextMenu;
|
|
2510
3137
|
exports.Divider = Divider;
|
|
2511
3138
|
exports.Drawer = Drawer;
|
|
2512
3139
|
exports.IconButton = IconButton;
|
|
@@ -2524,8 +3151,12 @@ exports.Radio = Radio;
|
|
|
2524
3151
|
exports.ScrollPanel = ScrollPanel;
|
|
2525
3152
|
exports.SegmentControl = SegmentControl;
|
|
2526
3153
|
exports.Select = Select;
|
|
3154
|
+
exports.Skeleton = Skeleton;
|
|
2527
3155
|
exports.Switch = Switch;
|
|
2528
3156
|
exports.TabPanel = TabPanel;
|
|
3157
|
+
exports.Table = Table;
|
|
3158
|
+
exports.TableRowActions = TableRowActions;
|
|
3159
|
+
exports.TableToolbar = TableToolbar;
|
|
2529
3160
|
exports.Tabs = Tabs;
|
|
2530
3161
|
exports.Tag = Tag;
|
|
2531
3162
|
exports.Toast = Toast;
|