@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.js CHANGED
@@ -36,7 +36,6 @@ __export(index_exports, {
36
36
  DateFilterTemplate: () => DateFilterTemplate,
37
37
  DateTimeFilterTemplate: () => DateTimeFilterTemplate,
38
38
  FilterMatchMode: () => import_api5.FilterMatchMode,
39
- FilterMatchModeSelect: () => FilterMatchModeSelect,
40
39
  FilterOperator: () => import_api5.FilterOperator,
41
40
  Input: () => Input,
42
41
  InputAutoComplete: () => InputAutoComplete,
@@ -723,23 +722,24 @@ LoadingSpinner.displayName = "LoadingSpinner";
723
722
  // src/components/Input/InputAutocomplete.tsx
724
723
  var import_jsx_runtime10 = require("react/jsx-runtime");
725
724
  var PAGE_SIZE = 10;
726
- var InputBase3 = ({
727
- name,
728
- label,
729
- error,
730
- onChange,
731
- onSelect,
732
- value,
733
- defaultValue,
734
- inputAutocompleteActive,
735
- queryKey,
736
- mutationFn,
737
- renderOption,
738
- disabled,
739
- placeholder,
740
- isUppercaseLabel = true,
741
- ...rest
742
- }, ref) => {
725
+ function AutoCompleteInner(props, ref) {
726
+ const {
727
+ name,
728
+ label,
729
+ error,
730
+ value,
731
+ onChange,
732
+ onSelect,
733
+ renderOption,
734
+ getLabel = (item) => item?.label ?? item?.nome ?? String(item),
735
+ disabled,
736
+ placeholder,
737
+ isUppercaseLabel = true,
738
+ queryKey,
739
+ mutationFn,
740
+ service,
741
+ ...inputProps
742
+ } = props;
743
743
  const theme = useLeafcodeTheme();
744
744
  const styleVars = {
745
745
  "--label-line": theme.colors.light,
@@ -762,13 +762,31 @@ var InputBase3 = ({
762
762
  const [search, setSearch] = (0, import_react12.useState)("");
763
763
  const [isOpen, setIsOpen] = (0, import_react12.useState)(false);
764
764
  const listRef = (0, import_react12.useRef)(null);
765
- const { data, isLoading } = (0, import_react_query.useQuery)({
766
- queryKey: [queryKey, pageNumber, search],
767
- queryFn: () => mutationFn(pageNumber, PAGE_SIZE, search),
765
+ const fetcher = () => {
766
+ if (service) {
767
+ return service({
768
+ page: pageNumber,
769
+ size: PAGE_SIZE,
770
+ search,
771
+ ...props
772
+ });
773
+ }
774
+ return mutationFn(pageNumber, PAGE_SIZE, search);
775
+ };
776
+ const queryKeyInternal = [
777
+ "autocomplete",
778
+ queryKey ?? "service",
779
+ pageNumber,
780
+ search
781
+ ];
782
+ const query = (0, import_react_query.useQuery)({
783
+ queryKey: queryKeyInternal,
784
+ queryFn: fetcher,
768
785
  enabled: isOpen
769
786
  });
787
+ const { data, isLoading } = query;
770
788
  (0, import_react12.useEffect)(() => {
771
- if (!data?.items) return;
789
+ if (!data) return;
772
790
  setItems(
773
791
  (prev) => pageNumber === 1 ? data.items : [...prev, ...data.items]
774
792
  );
@@ -777,7 +795,7 @@ var InputBase3 = ({
777
795
  const debounced = import_lodash2.default.debounce(() => {
778
796
  setPageNumber(1);
779
797
  setSearch(value ?? "");
780
- }, 600);
798
+ }, 500);
781
799
  debounced();
782
800
  return () => debounced.cancel();
783
801
  }, [value]);
@@ -789,35 +807,18 @@ var InputBase3 = ({
789
807
  }
790
808
  };
791
809
  const handleSelect = (item) => {
792
- onChange?.(item.nome);
810
+ const label2 = getLabel(item);
811
+ onChange?.(label2);
793
812
  setIsOpen(false);
794
813
  onSelect(item);
795
814
  };
796
- const renderDropdown = () => {
797
- if (!isOpen) return null;
798
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "dropdown-container", style: styleVars, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("ul", { ref: listRef, onScroll: handleScroll, className: "dropdown-list", children: [
799
- items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
800
- "li",
801
- {
802
- onClick: () => handleSelect(item),
803
- className: "dropdown-item",
804
- children: renderOption(item)
805
- },
806
- item.id
807
- )),
808
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { className: "dropdown-loading", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LoadingSpinner, { size: 20 }) }),
809
- !isLoading && items.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { className: "dropdown-empty", children: "N\xE3o encontrado" })
810
- ] }) });
811
- };
812
815
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
813
816
  "div",
814
817
  {
815
818
  className: "input-wrapper",
816
819
  style: styleVars,
817
820
  tabIndex: -1,
818
- onBlur: (e) => {
819
- e.relatedTarget === null && setIsOpen(false);
820
- },
821
+ onBlur: (e) => e.relatedTarget === null && setIsOpen(false),
821
822
  children: [
822
823
  label && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
823
824
  "label",
@@ -840,35 +841,46 @@ var InputBase3 = ({
840
841
  className: "input",
841
842
  value: value ?? "",
842
843
  onChange: (e) => {
843
- const val = e.target.value;
844
- onChange?.(val);
844
+ onChange?.(e.target.value);
845
845
  setIsOpen(true);
846
846
  },
847
847
  onFocus: () => setIsOpen(true),
848
- ...rest
848
+ ...inputProps
849
849
  }
850
850
  ),
851
851
  value && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
852
852
  "button",
853
853
  {
854
854
  type: "button",
855
+ className: "dropdown-clear",
855
856
  onClick: () => {
856
857
  setPageNumber(1);
857
858
  onChange?.("");
858
859
  onSelect(null);
859
860
  },
860
- className: "dropdown-clear",
861
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react11.X, { size: 16, className: "icone-clear" })
861
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react11.X, { size: 16, color: "#bf1717" })
862
862
  }
863
863
  ),
864
- renderDropdown()
864
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "dropdown-container", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("ul", { ref: listRef, onScroll: handleScroll, className: "dropdown-list", children: [
865
+ items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
866
+ "li",
867
+ {
868
+ onClick: () => handleSelect(item),
869
+ className: "dropdown-item",
870
+ children: renderOption(item)
871
+ },
872
+ i
873
+ )),
874
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { className: "dropdown-loading", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(LoadingSpinner, { size: 20 }) }),
875
+ !isLoading && items.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { className: "dropdown-empty", children: "N\xE3o encontrado" })
876
+ ] }) })
865
877
  ] }),
866
878
  !value && !isOpen && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipErrorInput, { error, name })
867
879
  ]
868
880
  }
869
881
  );
870
- };
871
- var InputAutoComplete = (0, import_react12.forwardRef)(InputBase3);
882
+ }
883
+ var InputAutoComplete = (0, import_react12.forwardRef)(AutoCompleteInner);
872
884
 
873
885
  // src/components/DataTableAdvancedFilter/DataTableAdvancedFilter.tsx
874
886
  var import_react19 = require("react");
@@ -1134,6 +1146,7 @@ function ActionsColumn({
1134
1146
  }
1135
1147
 
1136
1148
  // src/components/DataTableAdvancedFilter/DynamicColumns.tsx
1149
+ var import_button = require("primereact/button");
1137
1150
  var import_jsx_runtime15 = require("react/jsx-runtime");
1138
1151
  function DynamicColumns({
1139
1152
  columns,
@@ -1174,6 +1187,20 @@ function DynamicColumns({
1174
1187
  showFilterMatchModes: col.showFilterMatchModes,
1175
1188
  dataType: col.dataType,
1176
1189
  hidden: col.hidden,
1190
+ filterApply: (options) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1191
+ import_button.Button,
1192
+ {
1193
+ label: isLanguagePtBr ? "Aplicar" : "Apply",
1194
+ size: "small",
1195
+ onClick: () => {
1196
+ const constraint = options.filterModel.constraints[0];
1197
+ if (constraint.matchMode === "empty" || constraint.matchMode === "notEmpty") {
1198
+ constraint.value = true;
1199
+ }
1200
+ options.filterApplyCallback(constraint.value, 0);
1201
+ }
1202
+ }
1203
+ ),
1177
1204
  filterElement: col.filterElement ? (options) => col.filterElement?.(options, col.mask) ?? void 0 : void 0,
1178
1205
  filterMatchModeOptions: col.filterMatchModeOptions,
1179
1206
  filterPlaceholder: !isActionsCol ? placeholder : void 0,
@@ -1391,6 +1418,7 @@ function DataTableAdvancedFilterWrapper({
1391
1418
  customActions
1392
1419
  ]
1393
1420
  );
1421
+ const DEFAULT_MATCH_MODE = "contains";
1394
1422
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, { children: isClient && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
1395
1423
  disablePagination && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "disablePagination", children: TableHeaderAndTableActions }),
1396
1424
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
@@ -1411,6 +1439,7 @@ function DataTableAdvancedFilterWrapper({
1411
1439
  dataKey: "id",
1412
1440
  size: "small",
1413
1441
  rowClassName: () => "box-row-table",
1442
+ filterDisplay: "menu",
1414
1443
  filters,
1415
1444
  selection: selectedRowsData,
1416
1445
  onSelectionChange: (e) => setSelectedRowsData(e.value),
@@ -1729,129 +1758,62 @@ function DataTableAdvancedFilter({
1729
1758
 
1730
1759
  // src/components/DataTableAdvancedFilter/FilterTemplates.tsx
1731
1760
  var import_react_select2 = __toESM(require("react-select"));
1732
- var import_dropdown = require("primereact/dropdown");
1733
1761
  var import_moment2 = __toESM(require("moment"));
1734
1762
  var import_jsx_runtime18 = require("react/jsx-runtime");
1735
- var FilterMatchModeSelect = ({
1736
- options,
1737
- items,
1738
- placeholder = "Tipo de filtro"
1739
- }) => {
1740
- const rawFilter = options.value ?? {};
1741
- const currentMatchMode = rawFilter.matchMode ?? items[0]?.value;
1742
- const isSpecial = (mode) => mode === customMatchModes.empty || mode === customMatchModes.notEmpty;
1743
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1744
- import_dropdown.Dropdown,
1763
+ var DateFilterTemplate = (options, mask) => {
1764
+ const matchMode = options.filterModel?.matchMode;
1765
+ const isSpecial = matchMode === "empty" || matchMode === "notEmpty";
1766
+ const parsedValue = typeof options.filterModel?.value === "string" ? /* @__PURE__ */ new Date(options.filterModel.value + "T00:00:00") : null;
1767
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: !isSpecial && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1768
+ import_calendar.Calendar,
1745
1769
  {
1746
- value: currentMatchMode,
1747
- options: items,
1748
- optionLabel: "label",
1749
- optionValue: "value",
1750
- placeholder,
1751
- style: { width: "100%" },
1770
+ value: parsedValue,
1752
1771
  onChange: (e) => {
1753
- const newMatchMode = e.value;
1754
- if (isSpecial(newMatchMode)) {
1755
- options.filterCallback({
1756
- text: null,
1757
- matchMode: newMatchMode
1758
- });
1772
+ const date = e.value;
1773
+ if (!date) {
1774
+ options.filterCallback(null, options.index);
1759
1775
  return;
1760
1776
  }
1761
- options.filterCallback({
1762
- text: null,
1763
- matchMode: newMatchMode
1764
- });
1765
- }
1777
+ const valueToFilter = mask ? mask(date) : `${date.getFullYear()}-${String(
1778
+ date.getMonth() + 1
1779
+ ).padStart(2, "0")}-${String(
1780
+ date.getDate()
1781
+ ).padStart(2, "0")}`;
1782
+ options.filterCallback(valueToFilter, options.index);
1783
+ },
1784
+ dateFormat: "dd/mm/yy",
1785
+ placeholder: "dd/mm/yyyy",
1786
+ mask: "99/99/9999",
1787
+ inputClassName: "p-column-filter"
1766
1788
  }
1767
- );
1768
- };
1769
- var DateFilterTemplate = (options, isLanguagePtBr = true, isNullable = true, items, mask) => {
1770
- const resolvedItems = items ?? getDefaultFilterMatchOptionsDate(isLanguagePtBr, isNullable);
1771
- const rawFilter = options.value ?? {};
1772
- const currentMatchMode = rawFilter.matchMode;
1773
- const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
1774
- const parsedValue = options.value?.text && typeof options.value.text === "string" ? /* @__PURE__ */ new Date(options.value.text + "T00:00:00") : null;
1775
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1776
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1777
- FilterMatchModeSelect,
1778
- {
1779
- options,
1780
- items: resolvedItems
1781
- }
1782
- ),
1783
- !isSpecial && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1784
- import_calendar.Calendar,
1785
- {
1786
- value: parsedValue,
1787
- onChange: (e) => {
1788
- if (!e.value) {
1789
- options.filterCallback({
1790
- text: null,
1791
- matchMode: currentMatchMode
1792
- });
1793
- return;
1794
- }
1795
- const date = e.value;
1796
- const valueToFilter = mask ? mask(date) : `${date.getFullYear()}-${String(
1797
- date.getMonth() + 1
1798
- ).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
1799
- options.filterCallback({
1800
- text: valueToFilter,
1801
- matchMode: currentMatchMode
1802
- });
1803
- },
1804
- dateFormat: "dd/mm/yy",
1805
- placeholder: "dd/mm/yyyy",
1806
- mask: "99/99/9999",
1807
- inputClassName: "p-column-filter"
1808
- }
1809
- )
1810
- ] });
1789
+ ) });
1811
1790
  };
1812
- var DateTimeFilterTemplate = (options, isLanguagePtBr = true, isNullable = true, mask) => {
1813
- const items = getDefaultFilterMatchOptionsDate(isLanguagePtBr, isNullable);
1814
- const rawFilter = options.value ?? {};
1815
- const currentMatchMode = rawFilter.matchMode;
1816
- const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
1817
- const value = typeof rawFilter.text === "string" ? (0, import_moment2.default)(rawFilter.text).toDate() : null;
1818
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1819
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1820
- FilterMatchModeSelect,
1821
- {
1822
- options,
1823
- items
1824
- }
1825
- ),
1826
- !isSpecial && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1827
- import_calendar.Calendar,
1828
- {
1829
- value,
1830
- showTime: true,
1831
- showSeconds: true,
1832
- hourFormat: "24",
1833
- dateFormat: "dd/mm/yy",
1834
- placeholder: "dd/mm/yyyy 00:00:00",
1835
- readOnlyInput: true,
1836
- inputClassName: "p-column-filter",
1837
- onChange: (e) => {
1838
- const selectedDate = e.value;
1839
- if (!selectedDate) {
1840
- options.filterCallback({
1841
- text: null,
1842
- matchMode: currentMatchMode
1843
- });
1844
- return;
1845
- }
1846
- const formatted = mask ? mask(selectedDate) : (0, import_moment2.default)(selectedDate).utc().format("YYYY-MM-DDTHH:mm:ss.SSS[Z]");
1847
- options.filterCallback({
1848
- text: formatted,
1849
- matchMode: currentMatchMode
1850
- });
1791
+ var DateTimeFilterTemplate = (options, mask) => {
1792
+ const matchMode = options.filterModel?.matchMode;
1793
+ const isSpecial = matchMode === "empty" || matchMode === "notEmpty";
1794
+ const value = options.filterModel?.value ? (0, import_moment2.default)(options.filterModel.value).toDate() : null;
1795
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: !isSpecial && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1796
+ import_calendar.Calendar,
1797
+ {
1798
+ value,
1799
+ showTime: true,
1800
+ showSeconds: true,
1801
+ hourFormat: "24",
1802
+ dateFormat: "dd/mm/yy",
1803
+ placeholder: "dd/mm/yyyy 00:00:00",
1804
+ readOnlyInput: true,
1805
+ inputClassName: "p-column-filter",
1806
+ onChange: (e) => {
1807
+ const selectedDate = e.value;
1808
+ if (!selectedDate) {
1809
+ options.filterCallback(null, options.index);
1810
+ return;
1851
1811
  }
1812
+ const formatted = mask ? mask(selectedDate) : (0, import_moment2.default)(selectedDate).utc().format("YYYY-MM-DDTHH:mm:ss.SSS[Z]");
1813
+ options.filterCallback(formatted, options.index);
1852
1814
  }
1853
- )
1854
- ] });
1815
+ }
1816
+ ) });
1855
1817
  };
1856
1818
  var ValueFilterTemplate = (options, mask) => {
1857
1819
  const parsedValue = options.value !== null && options.value !== void 0 ? centsToReal(options.value) : null;
@@ -1877,115 +1839,53 @@ var ValueFilterTemplate = (options, mask) => {
1877
1839
  }
1878
1840
  );
1879
1841
  };
1880
- var SelectFilterTemplate = (options, isLanguagePtBr = true, isNullable = true, items = []) => {
1881
- const matchModeItems = getDefaultFilterMatchOptionsEnum(isLanguagePtBr, isNullable);
1842
+ var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
1882
1843
  const selectOptions = items.length > 0 ? items : [
1883
1844
  { label: isLanguagePtBr ? "Sim" : "Yes", value: true },
1884
1845
  { label: isLanguagePtBr ? "N\xE3o" : "No", value: false }
1885
1846
  ];
1886
- const rawFilter = options.value ?? {};
1887
- const currentMatchMode = rawFilter.matchMode;
1888
- const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
1889
- const currentValue = selectOptions.find((opt) => opt.value === rawFilter.text) || null;
1890
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1891
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1892
- FilterMatchModeSelect,
1893
- {
1894
- options,
1895
- items: matchModeItems
1896
- }
1897
- ),
1898
- !isSpecial && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1899
- import_react_select2.default,
1900
- {
1901
- options: selectOptions,
1902
- value: currentValue,
1903
- onChange: (selected) => {
1904
- if (!selected) {
1905
- options.filterCallback({
1906
- text: null,
1907
- matchMode: currentMatchMode
1908
- });
1909
- return;
1910
- }
1911
- options.filterCallback({
1912
- text: selected.value,
1913
- matchMode: currentMatchMode
1914
- });
1915
- },
1916
- placeholder: isLanguagePtBr ? "Selecione..." : "Select...",
1917
- isClearable: false,
1918
- isSearchable: false,
1919
- className: "custom-select-filtro",
1920
- classNamePrefix: "custom-select-filtro",
1921
- styles: {
1922
- control: (baseStyles, state) => ({
1923
- ...baseStyles,
1924
- "&:hover": {
1925
- borderColor: state.isFocused ? "#094394" : ""
1926
- },
1927
- borderRadius: "6px"
1928
- }),
1929
- menuList: (base) => ({
1930
- ...base,
1931
- "::-webkit-scrollbar": {
1932
- width: "6px"
1933
- },
1934
- "::-webkit-scrollbar-track": {
1935
- background: "#fff"
1936
- },
1937
- "::-webkit-scrollbar-thumb": {
1938
- background: "#888",
1939
- borderRadius: "2rem"
1940
- },
1941
- "::-webkit-scrollbar-thumb:hover": {
1942
- background: "#555"
1943
- }
1944
- }),
1945
- option: (provided, state) => ({
1946
- ...provided,
1947
- backgroundColor: state.isFocused ? "#094394" : "#ffffff",
1948
- color: state.isFocused ? "#ffffff" : "black",
1949
- "&:hover": {
1950
- backgroundColor: "#094394",
1951
- color: "#ffffff"
1952
- }
1953
- })
1954
- }
1955
- }
1956
- )
1957
- ] });
1847
+ const matchMode = options.filterModel?.matchMode;
1848
+ const isSpecial = matchMode === "empty" || matchMode === "notEmpty";
1849
+ const currentValue = selectOptions.find(
1850
+ (opt) => opt.value === options.filterModel?.value
1851
+ ) || null;
1852
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: !isSpecial && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1853
+ import_react_select2.default,
1854
+ {
1855
+ options: selectOptions,
1856
+ value: currentValue,
1857
+ onChange: (selected) => {
1858
+ options.filterCallback(
1859
+ selected ? selected.value : null,
1860
+ options.index
1861
+ // 🔥 ESSENCIAL
1862
+ );
1863
+ },
1864
+ placeholder: isLanguagePtBr ? "Selecione..." : "Select...",
1865
+ isClearable: true,
1866
+ isSearchable: false,
1867
+ className: "custom-select-filtro",
1868
+ classNamePrefix: "custom-select-filtro"
1869
+ }
1870
+ ) });
1958
1871
  };
1959
- var CustomFilterElement = (options, isLanguagePtBr = true, isNullable = true, items) => {
1960
- const resolvedItems = items ?? getDefaultFilterMatchOptionsString(isLanguagePtBr, isNullable);
1961
- const rawFilter = options.value ?? {};
1962
- const currentMatchMode = rawFilter.matchMode ?? "contains";
1963
- const currentValue = typeof rawFilter.text === "string" ? rawFilter.text : "";
1964
- const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
1965
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "filter-wrapper", style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1966
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1967
- FilterMatchModeSelect,
1968
- {
1969
- options,
1970
- items: resolvedItems
1971
- }
1972
- ),
1973
- !isSpecial && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1974
- import_inputtext.InputText,
1975
- {
1976
- value: currentValue,
1977
- placeholder: isLanguagePtBr ? "Pesquisar" : "Search",
1978
- className: "p-column-filter",
1979
- onChange: (e) => {
1980
- const value = e.target.value;
1981
- options.filterCallback({
1982
- text: value.trim() ? value : null,
1983
- matchMode: currentMatchMode
1984
- });
1985
- }
1986
- }
1987
- )
1988
- ] });
1872
+ var CustomFilterElement = (options, isLanguagePtBr = true) => {
1873
+ const matchMode = options.filterModel?.matchMode;
1874
+ const isSpecial = matchMode === "empty" || matchMode === "notEmpty";
1875
+ return !isSpecial && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1876
+ import_inputtext.InputText,
1877
+ {
1878
+ value: options.filterModel?.value ?? "",
1879
+ placeholder: isLanguagePtBr ? "Pesquisar" : "Search",
1880
+ onChange: (e) => {
1881
+ options.filterCallback(
1882
+ e.target.value || null,
1883
+ options.index
1884
+ );
1885
+ },
1886
+ className: "p-column-filter"
1887
+ }
1888
+ );
1989
1889
  };
1990
1890
 
1991
1891
  // src/components/DataTableAdvancedFilter/filterModes.ts
@@ -2414,7 +2314,6 @@ var import_api5 = require("primereact/api");
2414
2314
  DateFilterTemplate,
2415
2315
  DateTimeFilterTemplate,
2416
2316
  FilterMatchMode,
2417
- FilterMatchModeSelect,
2418
2317
  FilterOperator,
2419
2318
  Input,
2420
2319
  InputAutoComplete,