@charlesgomes/leafcode-shared-lib-react 1.0.76 → 1.0.78
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.d.mts +36 -29
- package/dist/index.d.ts +36 -29
- package/dist/index.js +168 -269
- package/dist/index.mjs +169 -269
- package/dist/styles/input.css +2 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -673,23 +673,24 @@ LoadingSpinner.displayName = "LoadingSpinner";
|
|
|
673
673
|
// src/components/Input/InputAutocomplete.tsx
|
|
674
674
|
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
675
675
|
var PAGE_SIZE = 10;
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
676
|
+
function AutoCompleteInner(props, ref) {
|
|
677
|
+
const {
|
|
678
|
+
name,
|
|
679
|
+
label,
|
|
680
|
+
error,
|
|
681
|
+
value,
|
|
682
|
+
onChange,
|
|
683
|
+
onSelect,
|
|
684
|
+
renderOption,
|
|
685
|
+
getLabel = (item) => item?.label ?? item?.nome ?? String(item),
|
|
686
|
+
disabled,
|
|
687
|
+
placeholder,
|
|
688
|
+
isUppercaseLabel = true,
|
|
689
|
+
queryKey,
|
|
690
|
+
mutationFn,
|
|
691
|
+
service,
|
|
692
|
+
...inputProps
|
|
693
|
+
} = props;
|
|
693
694
|
const theme = useLeafcodeTheme();
|
|
694
695
|
const styleVars = {
|
|
695
696
|
"--label-line": theme.colors.light,
|
|
@@ -712,13 +713,31 @@ var InputBase3 = ({
|
|
|
712
713
|
const [search, setSearch] = useState4("");
|
|
713
714
|
const [isOpen, setIsOpen] = useState4(false);
|
|
714
715
|
const listRef = useRef(null);
|
|
715
|
-
const
|
|
716
|
-
|
|
717
|
-
|
|
716
|
+
const fetcher = () => {
|
|
717
|
+
if (service) {
|
|
718
|
+
return service({
|
|
719
|
+
page: pageNumber,
|
|
720
|
+
size: PAGE_SIZE,
|
|
721
|
+
search,
|
|
722
|
+
...props
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
return mutationFn(pageNumber, PAGE_SIZE, search);
|
|
726
|
+
};
|
|
727
|
+
const queryKeyInternal = [
|
|
728
|
+
"autocomplete",
|
|
729
|
+
queryKey ?? "service",
|
|
730
|
+
pageNumber,
|
|
731
|
+
search
|
|
732
|
+
];
|
|
733
|
+
const query = useQuery({
|
|
734
|
+
queryKey: queryKeyInternal,
|
|
735
|
+
queryFn: fetcher,
|
|
718
736
|
enabled: isOpen
|
|
719
737
|
});
|
|
738
|
+
const { data, isLoading } = query;
|
|
720
739
|
useEffect4(() => {
|
|
721
|
-
if (!data
|
|
740
|
+
if (!data) return;
|
|
722
741
|
setItems(
|
|
723
742
|
(prev) => pageNumber === 1 ? data.items : [...prev, ...data.items]
|
|
724
743
|
);
|
|
@@ -727,7 +746,7 @@ var InputBase3 = ({
|
|
|
727
746
|
const debounced = _.debounce(() => {
|
|
728
747
|
setPageNumber(1);
|
|
729
748
|
setSearch(value ?? "");
|
|
730
|
-
},
|
|
749
|
+
}, 500);
|
|
731
750
|
debounced();
|
|
732
751
|
return () => debounced.cancel();
|
|
733
752
|
}, [value]);
|
|
@@ -739,35 +758,18 @@ var InputBase3 = ({
|
|
|
739
758
|
}
|
|
740
759
|
};
|
|
741
760
|
const handleSelect = (item) => {
|
|
742
|
-
|
|
761
|
+
const label2 = getLabel(item);
|
|
762
|
+
onChange?.(label2);
|
|
743
763
|
setIsOpen(false);
|
|
744
764
|
onSelect(item);
|
|
745
765
|
};
|
|
746
|
-
const renderDropdown = () => {
|
|
747
|
-
if (!isOpen) return null;
|
|
748
|
-
return /* @__PURE__ */ jsx10("div", { className: "dropdown-container", style: styleVars, children: /* @__PURE__ */ jsxs7("ul", { ref: listRef, onScroll: handleScroll, className: "dropdown-list", children: [
|
|
749
|
-
items.map((item) => /* @__PURE__ */ jsx10(
|
|
750
|
-
"li",
|
|
751
|
-
{
|
|
752
|
-
onClick: () => handleSelect(item),
|
|
753
|
-
className: "dropdown-item",
|
|
754
|
-
children: renderOption(item)
|
|
755
|
-
},
|
|
756
|
-
item.id
|
|
757
|
-
)),
|
|
758
|
-
isLoading && /* @__PURE__ */ jsx10("li", { className: "dropdown-loading", children: /* @__PURE__ */ jsx10(LoadingSpinner, { size: 20 }) }),
|
|
759
|
-
!isLoading && items.length === 0 && /* @__PURE__ */ jsx10("li", { className: "dropdown-empty", children: "N\xE3o encontrado" })
|
|
760
|
-
] }) });
|
|
761
|
-
};
|
|
762
766
|
return /* @__PURE__ */ jsxs7(
|
|
763
767
|
"div",
|
|
764
768
|
{
|
|
765
769
|
className: "input-wrapper",
|
|
766
770
|
style: styleVars,
|
|
767
771
|
tabIndex: -1,
|
|
768
|
-
onBlur: (e) =>
|
|
769
|
-
e.relatedTarget === null && setIsOpen(false);
|
|
770
|
-
},
|
|
772
|
+
onBlur: (e) => e.relatedTarget === null && setIsOpen(false),
|
|
771
773
|
children: [
|
|
772
774
|
label && /* @__PURE__ */ jsx10(
|
|
773
775
|
"label",
|
|
@@ -790,35 +792,46 @@ var InputBase3 = ({
|
|
|
790
792
|
className: "input",
|
|
791
793
|
value: value ?? "",
|
|
792
794
|
onChange: (e) => {
|
|
793
|
-
|
|
794
|
-
onChange?.(val);
|
|
795
|
+
onChange?.(e.target.value);
|
|
795
796
|
setIsOpen(true);
|
|
796
797
|
},
|
|
797
798
|
onFocus: () => setIsOpen(true),
|
|
798
|
-
...
|
|
799
|
+
...inputProps
|
|
799
800
|
}
|
|
800
801
|
),
|
|
801
802
|
value && /* @__PURE__ */ jsx10(
|
|
802
803
|
"button",
|
|
803
804
|
{
|
|
804
805
|
type: "button",
|
|
806
|
+
className: "dropdown-clear",
|
|
805
807
|
onClick: () => {
|
|
806
808
|
setPageNumber(1);
|
|
807
809
|
onChange?.("");
|
|
808
810
|
onSelect(null);
|
|
809
811
|
},
|
|
810
|
-
|
|
811
|
-
children: /* @__PURE__ */ jsx10(X3, { size: 16, className: "icone-clear" })
|
|
812
|
+
children: /* @__PURE__ */ jsx10(X3, { size: 16, color: "#bf1717" })
|
|
812
813
|
}
|
|
813
814
|
),
|
|
814
|
-
|
|
815
|
+
isOpen && /* @__PURE__ */ jsx10("div", { className: "dropdown-container", children: /* @__PURE__ */ jsxs7("ul", { ref: listRef, onScroll: handleScroll, className: "dropdown-list", children: [
|
|
816
|
+
items.map((item, i) => /* @__PURE__ */ jsx10(
|
|
817
|
+
"li",
|
|
818
|
+
{
|
|
819
|
+
onClick: () => handleSelect(item),
|
|
820
|
+
className: "dropdown-item",
|
|
821
|
+
children: renderOption(item)
|
|
822
|
+
},
|
|
823
|
+
i
|
|
824
|
+
)),
|
|
825
|
+
isLoading && /* @__PURE__ */ jsx10("li", { className: "dropdown-loading", children: /* @__PURE__ */ jsx10(LoadingSpinner, { size: 20 }) }),
|
|
826
|
+
!isLoading && items.length === 0 && /* @__PURE__ */ jsx10("li", { className: "dropdown-empty", children: "N\xE3o encontrado" })
|
|
827
|
+
] }) })
|
|
815
828
|
] }),
|
|
816
829
|
!value && !isOpen && /* @__PURE__ */ jsx10(TooltipErrorInput, { error, name })
|
|
817
830
|
]
|
|
818
831
|
}
|
|
819
832
|
);
|
|
820
|
-
}
|
|
821
|
-
var InputAutoComplete = forwardRef4(
|
|
833
|
+
}
|
|
834
|
+
var InputAutoComplete = forwardRef4(AutoCompleteInner);
|
|
822
835
|
|
|
823
836
|
// src/components/DataTableAdvancedFilter/DataTableAdvancedFilter.tsx
|
|
824
837
|
import { useEffect as useEffect7, useState as useState7 } from "react";
|
|
@@ -1084,6 +1097,7 @@ function ActionsColumn({
|
|
|
1084
1097
|
}
|
|
1085
1098
|
|
|
1086
1099
|
// src/components/DataTableAdvancedFilter/DynamicColumns.tsx
|
|
1100
|
+
import { Button as Button2 } from "primereact/button";
|
|
1087
1101
|
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1088
1102
|
function DynamicColumns({
|
|
1089
1103
|
columns,
|
|
@@ -1124,6 +1138,20 @@ function DynamicColumns({
|
|
|
1124
1138
|
showFilterMatchModes: col.showFilterMatchModes,
|
|
1125
1139
|
dataType: col.dataType,
|
|
1126
1140
|
hidden: col.hidden,
|
|
1141
|
+
filterApply: (options) => /* @__PURE__ */ jsx15(
|
|
1142
|
+
Button2,
|
|
1143
|
+
{
|
|
1144
|
+
label: isLanguagePtBr ? "Aplicar" : "Apply",
|
|
1145
|
+
size: "small",
|
|
1146
|
+
onClick: () => {
|
|
1147
|
+
const constraint = options.filterModel.constraints[0];
|
|
1148
|
+
if (constraint.matchMode === "empty" || constraint.matchMode === "notEmpty") {
|
|
1149
|
+
constraint.value = true;
|
|
1150
|
+
}
|
|
1151
|
+
options.filterApplyCallback(constraint.value, 0);
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
),
|
|
1127
1155
|
filterElement: col.filterElement ? (options) => col.filterElement?.(options, col.mask) ?? void 0 : void 0,
|
|
1128
1156
|
filterMatchModeOptions: col.filterMatchModeOptions,
|
|
1129
1157
|
filterPlaceholder: !isActionsCol ? placeholder : void 0,
|
|
@@ -1341,6 +1369,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1341
1369
|
customActions
|
|
1342
1370
|
]
|
|
1343
1371
|
);
|
|
1372
|
+
const DEFAULT_MATCH_MODE = "contains";
|
|
1344
1373
|
return /* @__PURE__ */ jsx16(Fragment6, { children: isClient && /* @__PURE__ */ jsxs11("div", { children: [
|
|
1345
1374
|
disablePagination && /* @__PURE__ */ jsx16("div", { className: "disablePagination", children: TableHeaderAndTableActions }),
|
|
1346
1375
|
/* @__PURE__ */ jsxs11(
|
|
@@ -1361,6 +1390,7 @@ function DataTableAdvancedFilterWrapper({
|
|
|
1361
1390
|
dataKey: "id",
|
|
1362
1391
|
size: "small",
|
|
1363
1392
|
rowClassName: () => "box-row-table",
|
|
1393
|
+
filterDisplay: "menu",
|
|
1364
1394
|
filters,
|
|
1365
1395
|
selection: selectedRowsData,
|
|
1366
1396
|
onSelectionChange: (e) => setSelectedRowsData(e.value),
|
|
@@ -1679,129 +1709,62 @@ function DataTableAdvancedFilter({
|
|
|
1679
1709
|
|
|
1680
1710
|
// src/components/DataTableAdvancedFilter/FilterTemplates.tsx
|
|
1681
1711
|
import Select2 from "react-select";
|
|
1682
|
-
import { Dropdown } from "primereact/dropdown";
|
|
1683
1712
|
import moment2 from "moment";
|
|
1684
|
-
import { jsx as jsx18
|
|
1685
|
-
var
|
|
1686
|
-
options
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
}
|
|
1690
|
-
|
|
1691
|
-
const currentMatchMode = rawFilter.matchMode ?? items[0]?.value;
|
|
1692
|
-
const isSpecial = (mode) => mode === customMatchModes.empty || mode === customMatchModes.notEmpty;
|
|
1693
|
-
return /* @__PURE__ */ jsx18(
|
|
1694
|
-
Dropdown,
|
|
1713
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1714
|
+
var DateFilterTemplate = (options, mask) => {
|
|
1715
|
+
const matchMode = options.filterModel?.matchMode;
|
|
1716
|
+
const isSpecial = matchMode === "empty" || matchMode === "notEmpty";
|
|
1717
|
+
const parsedValue = typeof options.filterModel?.value === "string" ? /* @__PURE__ */ new Date(options.filterModel.value + "T00:00:00") : null;
|
|
1718
|
+
return /* @__PURE__ */ jsx18("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: !isSpecial && /* @__PURE__ */ jsx18(
|
|
1719
|
+
Calendar,
|
|
1695
1720
|
{
|
|
1696
|
-
value:
|
|
1697
|
-
options: items,
|
|
1698
|
-
optionLabel: "label",
|
|
1699
|
-
optionValue: "value",
|
|
1700
|
-
placeholder,
|
|
1701
|
-
style: { width: "100%" },
|
|
1721
|
+
value: parsedValue,
|
|
1702
1722
|
onChange: (e) => {
|
|
1703
|
-
const
|
|
1704
|
-
if (
|
|
1705
|
-
options.filterCallback(
|
|
1706
|
-
text: null,
|
|
1707
|
-
matchMode: newMatchMode
|
|
1708
|
-
});
|
|
1723
|
+
const date = e.value;
|
|
1724
|
+
if (!date) {
|
|
1725
|
+
options.filterCallback(null, options.index);
|
|
1709
1726
|
return;
|
|
1710
1727
|
}
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1728
|
+
const valueToFilter = mask ? mask(date) : `${date.getFullYear()}-${String(
|
|
1729
|
+
date.getMonth() + 1
|
|
1730
|
+
).padStart(2, "0")}-${String(
|
|
1731
|
+
date.getDate()
|
|
1732
|
+
).padStart(2, "0")}`;
|
|
1733
|
+
options.filterCallback(valueToFilter, options.index);
|
|
1734
|
+
},
|
|
1735
|
+
dateFormat: "dd/mm/yy",
|
|
1736
|
+
placeholder: "dd/mm/yyyy",
|
|
1737
|
+
mask: "99/99/9999",
|
|
1738
|
+
inputClassName: "p-column-filter"
|
|
1716
1739
|
}
|
|
1717
|
-
);
|
|
1718
|
-
};
|
|
1719
|
-
var DateFilterTemplate = (options, isLanguagePtBr = true, isNullable = true, items, mask) => {
|
|
1720
|
-
const resolvedItems = items ?? getDefaultFilterMatchOptionsDate(isLanguagePtBr, isNullable);
|
|
1721
|
-
const rawFilter = options.value ?? {};
|
|
1722
|
-
const currentMatchMode = rawFilter.matchMode;
|
|
1723
|
-
const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
|
|
1724
|
-
const parsedValue = options.value?.text && typeof options.value.text === "string" ? /* @__PURE__ */ new Date(options.value.text + "T00:00:00") : null;
|
|
1725
|
-
return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
1726
|
-
/* @__PURE__ */ jsx18(
|
|
1727
|
-
FilterMatchModeSelect,
|
|
1728
|
-
{
|
|
1729
|
-
options,
|
|
1730
|
-
items: resolvedItems
|
|
1731
|
-
}
|
|
1732
|
-
),
|
|
1733
|
-
!isSpecial && /* @__PURE__ */ jsx18(
|
|
1734
|
-
Calendar,
|
|
1735
|
-
{
|
|
1736
|
-
value: parsedValue,
|
|
1737
|
-
onChange: (e) => {
|
|
1738
|
-
if (!e.value) {
|
|
1739
|
-
options.filterCallback({
|
|
1740
|
-
text: null,
|
|
1741
|
-
matchMode: currentMatchMode
|
|
1742
|
-
});
|
|
1743
|
-
return;
|
|
1744
|
-
}
|
|
1745
|
-
const date = e.value;
|
|
1746
|
-
const valueToFilter = mask ? mask(date) : `${date.getFullYear()}-${String(
|
|
1747
|
-
date.getMonth() + 1
|
|
1748
|
-
).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
1749
|
-
options.filterCallback({
|
|
1750
|
-
text: valueToFilter,
|
|
1751
|
-
matchMode: currentMatchMode
|
|
1752
|
-
});
|
|
1753
|
-
},
|
|
1754
|
-
dateFormat: "dd/mm/yy",
|
|
1755
|
-
placeholder: "dd/mm/yyyy",
|
|
1756
|
-
mask: "99/99/9999",
|
|
1757
|
-
inputClassName: "p-column-filter"
|
|
1758
|
-
}
|
|
1759
|
-
)
|
|
1760
|
-
] });
|
|
1740
|
+
) });
|
|
1761
1741
|
};
|
|
1762
|
-
var DateTimeFilterTemplate = (options,
|
|
1763
|
-
const
|
|
1764
|
-
const
|
|
1765
|
-
const
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
hourFormat: "24",
|
|
1783
|
-
dateFormat: "dd/mm/yy",
|
|
1784
|
-
placeholder: "dd/mm/yyyy 00:00:00",
|
|
1785
|
-
readOnlyInput: true,
|
|
1786
|
-
inputClassName: "p-column-filter",
|
|
1787
|
-
onChange: (e) => {
|
|
1788
|
-
const selectedDate = e.value;
|
|
1789
|
-
if (!selectedDate) {
|
|
1790
|
-
options.filterCallback({
|
|
1791
|
-
text: null,
|
|
1792
|
-
matchMode: currentMatchMode
|
|
1793
|
-
});
|
|
1794
|
-
return;
|
|
1795
|
-
}
|
|
1796
|
-
const formatted = mask ? mask(selectedDate) : moment2(selectedDate).utc().format("YYYY-MM-DDTHH:mm:ss.SSS[Z]");
|
|
1797
|
-
options.filterCallback({
|
|
1798
|
-
text: formatted,
|
|
1799
|
-
matchMode: currentMatchMode
|
|
1800
|
-
});
|
|
1742
|
+
var DateTimeFilterTemplate = (options, mask) => {
|
|
1743
|
+
const matchMode = options.filterModel?.matchMode;
|
|
1744
|
+
const isSpecial = matchMode === "empty" || matchMode === "notEmpty";
|
|
1745
|
+
const value = options.filterModel?.value ? moment2(options.filterModel.value).toDate() : null;
|
|
1746
|
+
return /* @__PURE__ */ jsx18("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: !isSpecial && /* @__PURE__ */ jsx18(
|
|
1747
|
+
Calendar,
|
|
1748
|
+
{
|
|
1749
|
+
value,
|
|
1750
|
+
showTime: true,
|
|
1751
|
+
showSeconds: true,
|
|
1752
|
+
hourFormat: "24",
|
|
1753
|
+
dateFormat: "dd/mm/yy",
|
|
1754
|
+
placeholder: "dd/mm/yyyy 00:00:00",
|
|
1755
|
+
readOnlyInput: true,
|
|
1756
|
+
inputClassName: "p-column-filter",
|
|
1757
|
+
onChange: (e) => {
|
|
1758
|
+
const selectedDate = e.value;
|
|
1759
|
+
if (!selectedDate) {
|
|
1760
|
+
options.filterCallback(null, options.index);
|
|
1761
|
+
return;
|
|
1801
1762
|
}
|
|
1763
|
+
const formatted = mask ? mask(selectedDate) : moment2(selectedDate).utc().format("YYYY-MM-DDTHH:mm:ss.SSS[Z]");
|
|
1764
|
+
options.filterCallback(formatted, options.index);
|
|
1802
1765
|
}
|
|
1803
|
-
|
|
1804
|
-
|
|
1766
|
+
}
|
|
1767
|
+
) });
|
|
1805
1768
|
};
|
|
1806
1769
|
var ValueFilterTemplate = (options, mask) => {
|
|
1807
1770
|
const parsedValue = options.value !== null && options.value !== void 0 ? centsToReal(options.value) : null;
|
|
@@ -1827,115 +1790,53 @@ var ValueFilterTemplate = (options, mask) => {
|
|
|
1827
1790
|
}
|
|
1828
1791
|
);
|
|
1829
1792
|
};
|
|
1830
|
-
var SelectFilterTemplate = (options, isLanguagePtBr = true,
|
|
1831
|
-
const matchModeItems = getDefaultFilterMatchOptionsEnum(isLanguagePtBr, isNullable);
|
|
1793
|
+
var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
|
|
1832
1794
|
const selectOptions = items.length > 0 ? items : [
|
|
1833
1795
|
{ label: isLanguagePtBr ? "Sim" : "Yes", value: true },
|
|
1834
1796
|
{ label: isLanguagePtBr ? "N\xE3o" : "No", value: false }
|
|
1835
1797
|
];
|
|
1836
|
-
const
|
|
1837
|
-
const
|
|
1838
|
-
const
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
}
|
|
1861
|
-
options.filterCallback({
|
|
1862
|
-
text: selected.value,
|
|
1863
|
-
matchMode: currentMatchMode
|
|
1864
|
-
});
|
|
1865
|
-
},
|
|
1866
|
-
placeholder: isLanguagePtBr ? "Selecione..." : "Select...",
|
|
1867
|
-
isClearable: false,
|
|
1868
|
-
isSearchable: false,
|
|
1869
|
-
className: "custom-select-filtro",
|
|
1870
|
-
classNamePrefix: "custom-select-filtro",
|
|
1871
|
-
styles: {
|
|
1872
|
-
control: (baseStyles, state) => ({
|
|
1873
|
-
...baseStyles,
|
|
1874
|
-
"&:hover": {
|
|
1875
|
-
borderColor: state.isFocused ? "#094394" : ""
|
|
1876
|
-
},
|
|
1877
|
-
borderRadius: "6px"
|
|
1878
|
-
}),
|
|
1879
|
-
menuList: (base) => ({
|
|
1880
|
-
...base,
|
|
1881
|
-
"::-webkit-scrollbar": {
|
|
1882
|
-
width: "6px"
|
|
1883
|
-
},
|
|
1884
|
-
"::-webkit-scrollbar-track": {
|
|
1885
|
-
background: "#fff"
|
|
1886
|
-
},
|
|
1887
|
-
"::-webkit-scrollbar-thumb": {
|
|
1888
|
-
background: "#888",
|
|
1889
|
-
borderRadius: "2rem"
|
|
1890
|
-
},
|
|
1891
|
-
"::-webkit-scrollbar-thumb:hover": {
|
|
1892
|
-
background: "#555"
|
|
1893
|
-
}
|
|
1894
|
-
}),
|
|
1895
|
-
option: (provided, state) => ({
|
|
1896
|
-
...provided,
|
|
1897
|
-
backgroundColor: state.isFocused ? "#094394" : "#ffffff",
|
|
1898
|
-
color: state.isFocused ? "#ffffff" : "black",
|
|
1899
|
-
"&:hover": {
|
|
1900
|
-
backgroundColor: "#094394",
|
|
1901
|
-
color: "#ffffff"
|
|
1902
|
-
}
|
|
1903
|
-
})
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1906
|
-
)
|
|
1907
|
-
] });
|
|
1798
|
+
const matchMode = options.filterModel?.matchMode;
|
|
1799
|
+
const isSpecial = matchMode === "empty" || matchMode === "notEmpty";
|
|
1800
|
+
const currentValue = selectOptions.find(
|
|
1801
|
+
(opt) => opt.value === options.filterModel?.value
|
|
1802
|
+
) || null;
|
|
1803
|
+
return /* @__PURE__ */ jsx18("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: !isSpecial && /* @__PURE__ */ jsx18(
|
|
1804
|
+
Select2,
|
|
1805
|
+
{
|
|
1806
|
+
options: selectOptions,
|
|
1807
|
+
value: currentValue,
|
|
1808
|
+
onChange: (selected) => {
|
|
1809
|
+
options.filterCallback(
|
|
1810
|
+
selected ? selected.value : null,
|
|
1811
|
+
options.index
|
|
1812
|
+
// 🔥 ESSENCIAL
|
|
1813
|
+
);
|
|
1814
|
+
},
|
|
1815
|
+
placeholder: isLanguagePtBr ? "Selecione..." : "Select...",
|
|
1816
|
+
isClearable: true,
|
|
1817
|
+
isSearchable: false,
|
|
1818
|
+
className: "custom-select-filtro",
|
|
1819
|
+
classNamePrefix: "custom-select-filtro"
|
|
1820
|
+
}
|
|
1821
|
+
) });
|
|
1908
1822
|
};
|
|
1909
|
-
var CustomFilterElement = (options, isLanguagePtBr = true
|
|
1910
|
-
const
|
|
1911
|
-
const
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
value: currentValue,
|
|
1927
|
-
placeholder: isLanguagePtBr ? "Pesquisar" : "Search",
|
|
1928
|
-
className: "p-column-filter",
|
|
1929
|
-
onChange: (e) => {
|
|
1930
|
-
const value = e.target.value;
|
|
1931
|
-
options.filterCallback({
|
|
1932
|
-
text: value.trim() ? value : null,
|
|
1933
|
-
matchMode: currentMatchMode
|
|
1934
|
-
});
|
|
1935
|
-
}
|
|
1936
|
-
}
|
|
1937
|
-
)
|
|
1938
|
-
] });
|
|
1823
|
+
var CustomFilterElement = (options, isLanguagePtBr = true) => {
|
|
1824
|
+
const matchMode = options.filterModel?.matchMode;
|
|
1825
|
+
const isSpecial = matchMode === "empty" || matchMode === "notEmpty";
|
|
1826
|
+
return !isSpecial && /* @__PURE__ */ jsx18(
|
|
1827
|
+
InputText,
|
|
1828
|
+
{
|
|
1829
|
+
value: options.filterModel?.value ?? "",
|
|
1830
|
+
placeholder: isLanguagePtBr ? "Pesquisar" : "Search",
|
|
1831
|
+
onChange: (e) => {
|
|
1832
|
+
options.filterCallback(
|
|
1833
|
+
e.target.value || null,
|
|
1834
|
+
options.index
|
|
1835
|
+
);
|
|
1836
|
+
},
|
|
1837
|
+
className: "p-column-filter"
|
|
1838
|
+
}
|
|
1839
|
+
);
|
|
1939
1840
|
};
|
|
1940
1841
|
|
|
1941
1842
|
// src/components/DataTableAdvancedFilter/filterModes.ts
|
|
@@ -2363,7 +2264,6 @@ export {
|
|
|
2363
2264
|
DateFilterTemplate,
|
|
2364
2265
|
DateTimeFilterTemplate,
|
|
2365
2266
|
FilterMatchMode5 as FilterMatchMode,
|
|
2366
|
-
FilterMatchModeSelect,
|
|
2367
2267
|
FilterOperator2 as FilterOperator,
|
|
2368
2268
|
Input,
|
|
2369
2269
|
InputAutoComplete,
|
package/dist/styles/input.css
CHANGED
|
@@ -156,6 +156,7 @@ input:-webkit-autofill:focus {
|
|
|
156
156
|
font-size: var(--input-font-size, 13px);
|
|
157
157
|
box-shadow: none !important;
|
|
158
158
|
background-color: var(--input-bg, #ffffff) !important;
|
|
159
|
+
text-align: left;
|
|
159
160
|
}
|
|
160
161
|
|
|
161
162
|
.react-select__control--is-focused {
|
|
@@ -178,6 +179,7 @@ input:-webkit-autofill:focus {
|
|
|
178
179
|
font-family: var(--input-font-family, "Roboto", sans-serif);
|
|
179
180
|
font-weight: var(--input-font-weight, 400);
|
|
180
181
|
font-size: var(--input-font-size, 13px) !important;
|
|
182
|
+
text-align: left;
|
|
181
183
|
}
|
|
182
184
|
|
|
183
185
|
.react-select__option--is-focused {
|