@charlesgomes/leafcode-shared-lib-react 1.0.66 → 1.0.68
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 +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +137 -103
- package/dist/index.mjs +136 -103
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -190,8 +190,17 @@ interface IItemProps {
|
|
|
190
190
|
label: string;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
type FilterMatchModeSelectProps = {
|
|
194
|
+
options: any;
|
|
195
|
+
items: {
|
|
196
|
+
label: string;
|
|
197
|
+
value: string;
|
|
198
|
+
}[];
|
|
199
|
+
placeholder?: string;
|
|
200
|
+
};
|
|
201
|
+
declare const FilterMatchModeSelect: ({ options, items, placeholder, }: FilterMatchModeSelectProps) => react_jsx_runtime.JSX.Element;
|
|
202
|
+
declare const DateFilterTemplate: (options: any, isLanguagePtBr?: boolean, isNullable?: boolean, items?: any[], mask?: (value: Date) => string) => react_jsx_runtime.JSX.Element;
|
|
203
|
+
declare const DateTimeFilterTemplate: (options: any, isLanguagePtBr?: boolean, isNullable?: boolean, mask?: (date: Date) => string) => react_jsx_runtime.JSX.Element;
|
|
195
204
|
declare const ValueFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
|
|
196
205
|
declare const SelectFilterTemplate: (options: any, isLanguagePtBr?: boolean, items?: IItemProps[]) => react_jsx_runtime.JSX.Element;
|
|
197
206
|
declare const CustomFilterElement: (options: any, isLanguagePtBr?: boolean, items?: any[]) => react_jsx_runtime.JSX.Element;
|
|
@@ -331,4 +340,4 @@ declare const LeafcodeThemeProvider: ({ children, theme, }: LeafcodeThemeProvide
|
|
|
331
340
|
|
|
332
341
|
declare const defaultTheme: LeafcodeTheme;
|
|
333
342
|
|
|
334
|
-
export { Button, type ColumnCustom, CustomFilterElement, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, Input, InputAutoComplete, InputSelect, LeafcodeThemeProvider, ModalBase, SelectFilterTemplate, TextArea, ValueFilterTemplate, buildDynamicCampoFilters, buildSortingWithFilters, customMatchModes, defaultTheme, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsEnum, getDefaultFilterMatchOptionsString, getDefaultFilterMatchOptionsStringArray, getNullable, getUrlParams, mapPrimeToBackendFilters };
|
|
343
|
+
export { Button, type ColumnCustom, CustomFilterElement, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, FilterMatchModeSelect, type IDataTableProps, type IItemProps, Input, InputAutoComplete, InputSelect, LeafcodeThemeProvider, ModalBase, SelectFilterTemplate, TextArea, ValueFilterTemplate, buildDynamicCampoFilters, buildSortingWithFilters, customMatchModes, defaultTheme, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsEnum, getDefaultFilterMatchOptionsString, getDefaultFilterMatchOptionsStringArray, getNullable, getUrlParams, mapPrimeToBackendFilters };
|
package/dist/index.d.ts
CHANGED
|
@@ -190,8 +190,17 @@ interface IItemProps {
|
|
|
190
190
|
label: string;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
type FilterMatchModeSelectProps = {
|
|
194
|
+
options: any;
|
|
195
|
+
items: {
|
|
196
|
+
label: string;
|
|
197
|
+
value: string;
|
|
198
|
+
}[];
|
|
199
|
+
placeholder?: string;
|
|
200
|
+
};
|
|
201
|
+
declare const FilterMatchModeSelect: ({ options, items, placeholder, }: FilterMatchModeSelectProps) => react_jsx_runtime.JSX.Element;
|
|
202
|
+
declare const DateFilterTemplate: (options: any, isLanguagePtBr?: boolean, isNullable?: boolean, items?: any[], mask?: (value: Date) => string) => react_jsx_runtime.JSX.Element;
|
|
203
|
+
declare const DateTimeFilterTemplate: (options: any, isLanguagePtBr?: boolean, isNullable?: boolean, mask?: (date: Date) => string) => react_jsx_runtime.JSX.Element;
|
|
195
204
|
declare const ValueFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
|
|
196
205
|
declare const SelectFilterTemplate: (options: any, isLanguagePtBr?: boolean, items?: IItemProps[]) => react_jsx_runtime.JSX.Element;
|
|
197
206
|
declare const CustomFilterElement: (options: any, isLanguagePtBr?: boolean, items?: any[]) => react_jsx_runtime.JSX.Element;
|
|
@@ -331,4 +340,4 @@ declare const LeafcodeThemeProvider: ({ children, theme, }: LeafcodeThemeProvide
|
|
|
331
340
|
|
|
332
341
|
declare const defaultTheme: LeafcodeTheme;
|
|
333
342
|
|
|
334
|
-
export { Button, type ColumnCustom, CustomFilterElement, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, type IDataTableProps, type IItemProps, Input, InputAutoComplete, InputSelect, LeafcodeThemeProvider, ModalBase, SelectFilterTemplate, TextArea, ValueFilterTemplate, buildDynamicCampoFilters, buildSortingWithFilters, customMatchModes, defaultTheme, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsEnum, getDefaultFilterMatchOptionsString, getDefaultFilterMatchOptionsStringArray, getNullable, getUrlParams, mapPrimeToBackendFilters };
|
|
343
|
+
export { Button, type ColumnCustom, CustomFilterElement, DataTableAdvancedFilter, DateFilterTemplate, DateTimeFilterTemplate, FilterMatchModeSelect, type IDataTableProps, type IItemProps, Input, InputAutoComplete, InputSelect, LeafcodeThemeProvider, ModalBase, SelectFilterTemplate, TextArea, ValueFilterTemplate, buildDynamicCampoFilters, buildSortingWithFilters, customMatchModes, defaultTheme, getDefaultFilterMatchOptionsDate, getDefaultFilterMatchOptionsEnum, getDefaultFilterMatchOptionsString, getDefaultFilterMatchOptionsStringArray, getNullable, getUrlParams, mapPrimeToBackendFilters };
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ __export(index_exports, {
|
|
|
36
36
|
DateFilterTemplate: () => DateFilterTemplate,
|
|
37
37
|
DateTimeFilterTemplate: () => DateTimeFilterTemplate,
|
|
38
38
|
FilterMatchMode: () => import_api5.FilterMatchMode,
|
|
39
|
+
FilterMatchModeSelect: () => FilterMatchModeSelect,
|
|
39
40
|
FilterOperator: () => import_api5.FilterOperator,
|
|
40
41
|
Input: () => Input,
|
|
41
42
|
InputAutoComplete: () => InputAutoComplete,
|
|
@@ -1730,55 +1731,126 @@ var import_react_select2 = __toESM(require("react-select"));
|
|
|
1730
1731
|
var import_dropdown = require("primereact/dropdown");
|
|
1731
1732
|
var import_moment2 = __toESM(require("moment"));
|
|
1732
1733
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1733
|
-
var
|
|
1734
|
-
|
|
1734
|
+
var FilterMatchModeSelect = ({
|
|
1735
|
+
options,
|
|
1736
|
+
items,
|
|
1737
|
+
placeholder = "Tipo de filtro"
|
|
1738
|
+
}) => {
|
|
1739
|
+
const rawFilter = options.value ?? {};
|
|
1740
|
+
const currentMatchMode = rawFilter.matchMode ?? items[0]?.value;
|
|
1741
|
+
const isSpecial = (mode) => mode === customMatchModes.empty || mode === customMatchModes.notEmpty;
|
|
1735
1742
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1736
|
-
|
|
1743
|
+
import_dropdown.Dropdown,
|
|
1737
1744
|
{
|
|
1738
|
-
value:
|
|
1745
|
+
value: currentMatchMode,
|
|
1746
|
+
options: items,
|
|
1747
|
+
optionLabel: "label",
|
|
1748
|
+
optionValue: "value",
|
|
1749
|
+
placeholder,
|
|
1750
|
+
style: { width: "100%" },
|
|
1739
1751
|
onChange: (e) => {
|
|
1740
|
-
|
|
1741
|
-
|
|
1752
|
+
const newMatchMode = e.value;
|
|
1753
|
+
if (isSpecial(newMatchMode)) {
|
|
1754
|
+
options.filterCallback({
|
|
1755
|
+
text: null,
|
|
1756
|
+
matchMode: newMatchMode
|
|
1757
|
+
});
|
|
1742
1758
|
return;
|
|
1743
1759
|
}
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
options.filterCallback(valueToFilter, options.index);
|
|
1750
|
-
},
|
|
1751
|
-
dateFormat: "dd/mm/yy",
|
|
1752
|
-
placeholder: "dd/mm/yyyy",
|
|
1753
|
-
mask: "99/99/9999",
|
|
1754
|
-
inputClassName: "p-column-filter"
|
|
1760
|
+
options.filterCallback({
|
|
1761
|
+
text: null,
|
|
1762
|
+
matchMode: newMatchMode
|
|
1763
|
+
});
|
|
1764
|
+
}
|
|
1755
1765
|
}
|
|
1756
1766
|
);
|
|
1757
1767
|
};
|
|
1758
|
-
var
|
|
1759
|
-
const
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1768
|
+
var DateFilterTemplate = (options, isLanguagePtBr = true, isNullable = true, items, mask) => {
|
|
1769
|
+
const resolvedItems = items ?? getDefaultFilterMatchOptionsDate(isLanguagePtBr, isNullable);
|
|
1770
|
+
const rawFilter = options.value ?? {};
|
|
1771
|
+
const currentMatchMode = rawFilter.matchMode;
|
|
1772
|
+
const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
|
|
1773
|
+
const parsedValue = options.value?.text && typeof options.value.text === "string" ? /* @__PURE__ */ new Date(options.value.text + "T00:00:00") : null;
|
|
1774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
1775
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1776
|
+
FilterMatchModeSelect,
|
|
1777
|
+
{
|
|
1778
|
+
options,
|
|
1779
|
+
items: resolvedItems
|
|
1780
|
+
}
|
|
1781
|
+
),
|
|
1782
|
+
!isSpecial && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1783
|
+
import_calendar.Calendar,
|
|
1784
|
+
{
|
|
1785
|
+
value: parsedValue,
|
|
1786
|
+
onChange: (e) => {
|
|
1787
|
+
if (!e.value) {
|
|
1788
|
+
options.filterCallback({
|
|
1789
|
+
text: null,
|
|
1790
|
+
matchMode: currentMatchMode
|
|
1791
|
+
});
|
|
1792
|
+
return;
|
|
1793
|
+
}
|
|
1794
|
+
const date = e.value;
|
|
1795
|
+
const valueToFilter = mask ? mask(date) : `${date.getFullYear()}-${String(
|
|
1796
|
+
date.getMonth() + 1
|
|
1797
|
+
).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
1798
|
+
options.filterCallback({
|
|
1799
|
+
text: valueToFilter,
|
|
1800
|
+
matchMode: currentMatchMode
|
|
1801
|
+
});
|
|
1802
|
+
},
|
|
1803
|
+
dateFormat: "dd/mm/yy",
|
|
1804
|
+
placeholder: "dd/mm/yyyy",
|
|
1805
|
+
mask: "99/99/9999",
|
|
1806
|
+
inputClassName: "p-column-filter"
|
|
1807
|
+
}
|
|
1808
|
+
)
|
|
1809
|
+
] });
|
|
1810
|
+
};
|
|
1811
|
+
var DateTimeFilterTemplate = (options, isLanguagePtBr = true, isNullable = true, mask) => {
|
|
1812
|
+
const items = getDefaultFilterMatchOptionsDate(isLanguagePtBr, isNullable);
|
|
1813
|
+
const rawFilter = options.value ?? {};
|
|
1814
|
+
const currentMatchMode = rawFilter.matchMode;
|
|
1815
|
+
const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
|
|
1816
|
+
const value = typeof rawFilter.text === "string" ? (0, import_moment2.default)(rawFilter.text).toDate() : null;
|
|
1817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
1818
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1819
|
+
FilterMatchModeSelect,
|
|
1820
|
+
{
|
|
1821
|
+
options,
|
|
1822
|
+
items
|
|
1823
|
+
}
|
|
1824
|
+
),
|
|
1825
|
+
!isSpecial && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1826
|
+
import_calendar.Calendar,
|
|
1827
|
+
{
|
|
1828
|
+
value,
|
|
1829
|
+
showTime: true,
|
|
1830
|
+
showSeconds: true,
|
|
1831
|
+
hourFormat: "24",
|
|
1832
|
+
dateFormat: "dd/mm/yy",
|
|
1833
|
+
placeholder: "dd/mm/yyyy 00:00:00",
|
|
1834
|
+
readOnlyInput: true,
|
|
1835
|
+
inputClassName: "p-column-filter",
|
|
1836
|
+
onChange: (e) => {
|
|
1837
|
+
const selectedDate = e.value;
|
|
1838
|
+
if (!selectedDate) {
|
|
1839
|
+
options.filterCallback({
|
|
1840
|
+
text: null,
|
|
1841
|
+
matchMode: currentMatchMode
|
|
1842
|
+
});
|
|
1843
|
+
return;
|
|
1844
|
+
}
|
|
1845
|
+
const formatted = mask ? mask(selectedDate) : (0, import_moment2.default)(selectedDate).utc().format("YYYY-MM-DDTHH:mm:ss.SSS[Z]");
|
|
1846
|
+
options.filterCallback({
|
|
1847
|
+
text: formatted,
|
|
1848
|
+
matchMode: currentMatchMode
|
|
1849
|
+
});
|
|
1776
1850
|
}
|
|
1777
|
-
const formatted = mask ? mask(selectedDate) : (0, import_moment2.default)(selectedDate).utc().format("YYYY-MM-DDTHH:mm:ss.SSS[Z]");
|
|
1778
|
-
options.filterCallback(formatted, options.index);
|
|
1779
1851
|
}
|
|
1780
|
-
|
|
1781
|
-
);
|
|
1852
|
+
)
|
|
1853
|
+
] });
|
|
1782
1854
|
};
|
|
1783
1855
|
var ValueFilterTemplate = (options, mask) => {
|
|
1784
1856
|
const parsedValue = options.value !== null && options.value !== void 0 ? centsToReal(options.value) : null;
|
|
@@ -1815,7 +1887,7 @@ var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
|
|
|
1815
1887
|
options: selectOptions,
|
|
1816
1888
|
value: currentValue,
|
|
1817
1889
|
onChange: (selected) => options.filterCallback(selected?.value),
|
|
1818
|
-
placeholder: "
|
|
1890
|
+
placeholder: "Selecione...",
|
|
1819
1891
|
isClearable: false,
|
|
1820
1892
|
isSearchable: false,
|
|
1821
1893
|
className: "custom-select-filtro",
|
|
@@ -1868,69 +1940,30 @@ var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
|
|
|
1868
1940
|
const currentMatchMode = rawFilter.matchMode ?? "contains";
|
|
1869
1941
|
const currentValue = typeof rawFilter.text === "string" ? rawFilter.text : "";
|
|
1870
1942
|
const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
|
|
1871
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
options.filterCallback({
|
|
1896
|
-
text: null,
|
|
1897
|
-
matchMode: newMatchMode
|
|
1898
|
-
});
|
|
1899
|
-
return;
|
|
1900
|
-
}
|
|
1901
|
-
options.filterCallback({
|
|
1902
|
-
text: null,
|
|
1903
|
-
matchMode: newMatchMode
|
|
1904
|
-
});
|
|
1905
|
-
}
|
|
1906
|
-
}
|
|
1907
|
-
),
|
|
1908
|
-
!isSpecial && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1909
|
-
import_inputtext.InputText,
|
|
1910
|
-
{
|
|
1911
|
-
value: currentValue,
|
|
1912
|
-
placeholder: isLanguagePtBr ? "Pesquisar" : "Search",
|
|
1913
|
-
style: { width: "100%" },
|
|
1914
|
-
className: "p-column-filter",
|
|
1915
|
-
onChange: (e) => {
|
|
1916
|
-
const value = e.target.value;
|
|
1917
|
-
if (value.trim()) {
|
|
1918
|
-
options.filterCallback({
|
|
1919
|
-
text: value,
|
|
1920
|
-
matchMode: currentMatchMode
|
|
1921
|
-
});
|
|
1922
|
-
} else {
|
|
1923
|
-
options.filterCallback({
|
|
1924
|
-
text: null,
|
|
1925
|
-
matchMode: currentMatchMode
|
|
1926
|
-
});
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
|
-
)
|
|
1931
|
-
]
|
|
1932
|
-
}
|
|
1933
|
-
);
|
|
1943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "filter-wrapper", style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
1944
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1945
|
+
FilterMatchModeSelect,
|
|
1946
|
+
{
|
|
1947
|
+
options,
|
|
1948
|
+
items: resolvedItems
|
|
1949
|
+
}
|
|
1950
|
+
),
|
|
1951
|
+
!isSpecial && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1952
|
+
import_inputtext.InputText,
|
|
1953
|
+
{
|
|
1954
|
+
value: currentValue,
|
|
1955
|
+
placeholder: isLanguagePtBr ? "Pesquisar" : "Search",
|
|
1956
|
+
className: "p-column-filter",
|
|
1957
|
+
onChange: (e) => {
|
|
1958
|
+
const value = e.target.value;
|
|
1959
|
+
options.filterCallback({
|
|
1960
|
+
text: value.trim() ? value : null,
|
|
1961
|
+
matchMode: currentMatchMode
|
|
1962
|
+
});
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
)
|
|
1966
|
+
] });
|
|
1934
1967
|
};
|
|
1935
1968
|
|
|
1936
1969
|
// src/components/DataTableAdvancedFilter/filterModes.ts
|
|
@@ -2359,6 +2392,7 @@ var import_api5 = require("primereact/api");
|
|
|
2359
2392
|
DateFilterTemplate,
|
|
2360
2393
|
DateTimeFilterTemplate,
|
|
2361
2394
|
FilterMatchMode,
|
|
2395
|
+
FilterMatchModeSelect,
|
|
2362
2396
|
FilterOperator,
|
|
2363
2397
|
Input,
|
|
2364
2398
|
InputAutoComplete,
|
package/dist/index.mjs
CHANGED
|
@@ -1681,55 +1681,126 @@ import Select2 from "react-select";
|
|
|
1681
1681
|
import { Dropdown } from "primereact/dropdown";
|
|
1682
1682
|
import moment2 from "moment";
|
|
1683
1683
|
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1684
|
-
var
|
|
1685
|
-
|
|
1684
|
+
var FilterMatchModeSelect = ({
|
|
1685
|
+
options,
|
|
1686
|
+
items,
|
|
1687
|
+
placeholder = "Tipo de filtro"
|
|
1688
|
+
}) => {
|
|
1689
|
+
const rawFilter = options.value ?? {};
|
|
1690
|
+
const currentMatchMode = rawFilter.matchMode ?? items[0]?.value;
|
|
1691
|
+
const isSpecial = (mode) => mode === customMatchModes.empty || mode === customMatchModes.notEmpty;
|
|
1686
1692
|
return /* @__PURE__ */ jsx18(
|
|
1687
|
-
|
|
1693
|
+
Dropdown,
|
|
1688
1694
|
{
|
|
1689
|
-
value:
|
|
1695
|
+
value: currentMatchMode,
|
|
1696
|
+
options: items,
|
|
1697
|
+
optionLabel: "label",
|
|
1698
|
+
optionValue: "value",
|
|
1699
|
+
placeholder,
|
|
1700
|
+
style: { width: "100%" },
|
|
1690
1701
|
onChange: (e) => {
|
|
1691
|
-
|
|
1692
|
-
|
|
1702
|
+
const newMatchMode = e.value;
|
|
1703
|
+
if (isSpecial(newMatchMode)) {
|
|
1704
|
+
options.filterCallback({
|
|
1705
|
+
text: null,
|
|
1706
|
+
matchMode: newMatchMode
|
|
1707
|
+
});
|
|
1693
1708
|
return;
|
|
1694
1709
|
}
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
options.filterCallback(valueToFilter, options.index);
|
|
1701
|
-
},
|
|
1702
|
-
dateFormat: "dd/mm/yy",
|
|
1703
|
-
placeholder: "dd/mm/yyyy",
|
|
1704
|
-
mask: "99/99/9999",
|
|
1705
|
-
inputClassName: "p-column-filter"
|
|
1710
|
+
options.filterCallback({
|
|
1711
|
+
text: null,
|
|
1712
|
+
matchMode: newMatchMode
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1706
1715
|
}
|
|
1707
1716
|
);
|
|
1708
1717
|
};
|
|
1709
|
-
var
|
|
1710
|
-
const
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1718
|
+
var DateFilterTemplate = (options, isLanguagePtBr = true, isNullable = true, items, mask) => {
|
|
1719
|
+
const resolvedItems = items ?? getDefaultFilterMatchOptionsDate(isLanguagePtBr, isNullable);
|
|
1720
|
+
const rawFilter = options.value ?? {};
|
|
1721
|
+
const currentMatchMode = rawFilter.matchMode;
|
|
1722
|
+
const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
|
|
1723
|
+
const parsedValue = options.value?.text && typeof options.value.text === "string" ? /* @__PURE__ */ new Date(options.value.text + "T00:00:00") : null;
|
|
1724
|
+
return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
1725
|
+
/* @__PURE__ */ jsx18(
|
|
1726
|
+
FilterMatchModeSelect,
|
|
1727
|
+
{
|
|
1728
|
+
options,
|
|
1729
|
+
items: resolvedItems
|
|
1730
|
+
}
|
|
1731
|
+
),
|
|
1732
|
+
!isSpecial && /* @__PURE__ */ jsx18(
|
|
1733
|
+
Calendar,
|
|
1734
|
+
{
|
|
1735
|
+
value: parsedValue,
|
|
1736
|
+
onChange: (e) => {
|
|
1737
|
+
if (!e.value) {
|
|
1738
|
+
options.filterCallback({
|
|
1739
|
+
text: null,
|
|
1740
|
+
matchMode: currentMatchMode
|
|
1741
|
+
});
|
|
1742
|
+
return;
|
|
1743
|
+
}
|
|
1744
|
+
const date = e.value;
|
|
1745
|
+
const valueToFilter = mask ? mask(date) : `${date.getFullYear()}-${String(
|
|
1746
|
+
date.getMonth() + 1
|
|
1747
|
+
).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
1748
|
+
options.filterCallback({
|
|
1749
|
+
text: valueToFilter,
|
|
1750
|
+
matchMode: currentMatchMode
|
|
1751
|
+
});
|
|
1752
|
+
},
|
|
1753
|
+
dateFormat: "dd/mm/yy",
|
|
1754
|
+
placeholder: "dd/mm/yyyy",
|
|
1755
|
+
mask: "99/99/9999",
|
|
1756
|
+
inputClassName: "p-column-filter"
|
|
1757
|
+
}
|
|
1758
|
+
)
|
|
1759
|
+
] });
|
|
1760
|
+
};
|
|
1761
|
+
var DateTimeFilterTemplate = (options, isLanguagePtBr = true, isNullable = true, mask) => {
|
|
1762
|
+
const items = getDefaultFilterMatchOptionsDate(isLanguagePtBr, isNullable);
|
|
1763
|
+
const rawFilter = options.value ?? {};
|
|
1764
|
+
const currentMatchMode = rawFilter.matchMode;
|
|
1765
|
+
const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
|
|
1766
|
+
const value = typeof rawFilter.text === "string" ? moment2(rawFilter.text).toDate() : null;
|
|
1767
|
+
return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
1768
|
+
/* @__PURE__ */ jsx18(
|
|
1769
|
+
FilterMatchModeSelect,
|
|
1770
|
+
{
|
|
1771
|
+
options,
|
|
1772
|
+
items
|
|
1773
|
+
}
|
|
1774
|
+
),
|
|
1775
|
+
!isSpecial && /* @__PURE__ */ jsx18(
|
|
1776
|
+
Calendar,
|
|
1777
|
+
{
|
|
1778
|
+
value,
|
|
1779
|
+
showTime: true,
|
|
1780
|
+
showSeconds: true,
|
|
1781
|
+
hourFormat: "24",
|
|
1782
|
+
dateFormat: "dd/mm/yy",
|
|
1783
|
+
placeholder: "dd/mm/yyyy 00:00:00",
|
|
1784
|
+
readOnlyInput: true,
|
|
1785
|
+
inputClassName: "p-column-filter",
|
|
1786
|
+
onChange: (e) => {
|
|
1787
|
+
const selectedDate = e.value;
|
|
1788
|
+
if (!selectedDate) {
|
|
1789
|
+
options.filterCallback({
|
|
1790
|
+
text: null,
|
|
1791
|
+
matchMode: currentMatchMode
|
|
1792
|
+
});
|
|
1793
|
+
return;
|
|
1794
|
+
}
|
|
1795
|
+
const formatted = mask ? mask(selectedDate) : moment2(selectedDate).utc().format("YYYY-MM-DDTHH:mm:ss.SSS[Z]");
|
|
1796
|
+
options.filterCallback({
|
|
1797
|
+
text: formatted,
|
|
1798
|
+
matchMode: currentMatchMode
|
|
1799
|
+
});
|
|
1727
1800
|
}
|
|
1728
|
-
const formatted = mask ? mask(selectedDate) : moment2(selectedDate).utc().format("YYYY-MM-DDTHH:mm:ss.SSS[Z]");
|
|
1729
|
-
options.filterCallback(formatted, options.index);
|
|
1730
1801
|
}
|
|
1731
|
-
|
|
1732
|
-
);
|
|
1802
|
+
)
|
|
1803
|
+
] });
|
|
1733
1804
|
};
|
|
1734
1805
|
var ValueFilterTemplate = (options, mask) => {
|
|
1735
1806
|
const parsedValue = options.value !== null && options.value !== void 0 ? centsToReal(options.value) : null;
|
|
@@ -1766,7 +1837,7 @@ var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
|
|
|
1766
1837
|
options: selectOptions,
|
|
1767
1838
|
value: currentValue,
|
|
1768
1839
|
onChange: (selected) => options.filterCallback(selected?.value),
|
|
1769
|
-
placeholder: "
|
|
1840
|
+
placeholder: "Selecione...",
|
|
1770
1841
|
isClearable: false,
|
|
1771
1842
|
isSearchable: false,
|
|
1772
1843
|
className: "custom-select-filtro",
|
|
@@ -1819,69 +1890,30 @@ var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
|
|
|
1819
1890
|
const currentMatchMode = rawFilter.matchMode ?? "contains";
|
|
1820
1891
|
const currentValue = typeof rawFilter.text === "string" ? rawFilter.text : "";
|
|
1821
1892
|
const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
|
|
1822
|
-
return /* @__PURE__ */ jsxs12(
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
options.filterCallback({
|
|
1847
|
-
text: null,
|
|
1848
|
-
matchMode: newMatchMode
|
|
1849
|
-
});
|
|
1850
|
-
return;
|
|
1851
|
-
}
|
|
1852
|
-
options.filterCallback({
|
|
1853
|
-
text: null,
|
|
1854
|
-
matchMode: newMatchMode
|
|
1855
|
-
});
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
),
|
|
1859
|
-
!isSpecial && /* @__PURE__ */ jsx18(
|
|
1860
|
-
InputText,
|
|
1861
|
-
{
|
|
1862
|
-
value: currentValue,
|
|
1863
|
-
placeholder: isLanguagePtBr ? "Pesquisar" : "Search",
|
|
1864
|
-
style: { width: "100%" },
|
|
1865
|
-
className: "p-column-filter",
|
|
1866
|
-
onChange: (e) => {
|
|
1867
|
-
const value = e.target.value;
|
|
1868
|
-
if (value.trim()) {
|
|
1869
|
-
options.filterCallback({
|
|
1870
|
-
text: value,
|
|
1871
|
-
matchMode: currentMatchMode
|
|
1872
|
-
});
|
|
1873
|
-
} else {
|
|
1874
|
-
options.filterCallback({
|
|
1875
|
-
text: null,
|
|
1876
|
-
matchMode: currentMatchMode
|
|
1877
|
-
});
|
|
1878
|
-
}
|
|
1879
|
-
}
|
|
1880
|
-
}
|
|
1881
|
-
)
|
|
1882
|
-
]
|
|
1883
|
-
}
|
|
1884
|
-
);
|
|
1893
|
+
return /* @__PURE__ */ jsxs12("div", { className: "filter-wrapper", style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
1894
|
+
/* @__PURE__ */ jsx18(
|
|
1895
|
+
FilterMatchModeSelect,
|
|
1896
|
+
{
|
|
1897
|
+
options,
|
|
1898
|
+
items: resolvedItems
|
|
1899
|
+
}
|
|
1900
|
+
),
|
|
1901
|
+
!isSpecial && /* @__PURE__ */ jsx18(
|
|
1902
|
+
InputText,
|
|
1903
|
+
{
|
|
1904
|
+
value: currentValue,
|
|
1905
|
+
placeholder: isLanguagePtBr ? "Pesquisar" : "Search",
|
|
1906
|
+
className: "p-column-filter",
|
|
1907
|
+
onChange: (e) => {
|
|
1908
|
+
const value = e.target.value;
|
|
1909
|
+
options.filterCallback({
|
|
1910
|
+
text: value.trim() ? value : null,
|
|
1911
|
+
matchMode: currentMatchMode
|
|
1912
|
+
});
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
)
|
|
1916
|
+
] });
|
|
1885
1917
|
};
|
|
1886
1918
|
|
|
1887
1919
|
// src/components/DataTableAdvancedFilter/filterModes.ts
|
|
@@ -2309,6 +2341,7 @@ export {
|
|
|
2309
2341
|
DateFilterTemplate,
|
|
2310
2342
|
DateTimeFilterTemplate,
|
|
2311
2343
|
FilterMatchMode5 as FilterMatchMode,
|
|
2344
|
+
FilterMatchModeSelect,
|
|
2312
2345
|
FilterOperator2 as FilterOperator,
|
|
2313
2346
|
Input,
|
|
2314
2347
|
InputAutoComplete,
|