@charlesgomes/leafcode-shared-lib-react 1.0.68 → 1.0.69
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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +71 -51
- package/dist/index.mjs +71 -51
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -186,7 +186,7 @@ type TableState = {
|
|
|
186
186
|
declare function DataTableAdvancedFilter<T extends object>({ queryKey, mutationFn, columns, initFilters, onNew, onEdit, onDelete, customActions, customActionsColums, disablePagination, sortFieldInitial, sortOrderInitial, isMultiSelectionMode, isLanguagePtBr, rowsPerPageOptions, state, onStateChange, }: IDataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
187
187
|
|
|
188
188
|
interface IItemProps {
|
|
189
|
-
value: string;
|
|
189
|
+
value: string | boolean;
|
|
190
190
|
label: string;
|
|
191
191
|
}
|
|
192
192
|
|
package/dist/index.d.ts
CHANGED
|
@@ -186,7 +186,7 @@ type TableState = {
|
|
|
186
186
|
declare function DataTableAdvancedFilter<T extends object>({ queryKey, mutationFn, columns, initFilters, onNew, onEdit, onDelete, customActions, customActionsColums, disablePagination, sortFieldInitial, sortOrderInitial, isMultiSelectionMode, isLanguagePtBr, rowsPerPageOptions, state, onStateChange, }: IDataTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
187
187
|
|
|
188
188
|
interface IItemProps {
|
|
189
|
-
value: string;
|
|
189
|
+
value: string | boolean;
|
|
190
190
|
label: string;
|
|
191
191
|
}
|
|
192
192
|
|
package/dist/index.js
CHANGED
|
@@ -1876,63 +1876,83 @@ var ValueFilterTemplate = (options, mask) => {
|
|
|
1876
1876
|
);
|
|
1877
1877
|
};
|
|
1878
1878
|
var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
|
|
1879
|
+
const matchModeItems = getDefaultFilterMatchOptionsEnum(isLanguagePtBr);
|
|
1879
1880
|
const selectOptions = items.length > 0 ? items : [
|
|
1880
1881
|
{ label: isLanguagePtBr ? "Sim" : "Yes", value: true },
|
|
1881
1882
|
{ label: isLanguagePtBr ? "N\xE3o" : "No", value: false }
|
|
1882
1883
|
];
|
|
1883
|
-
const
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
height: "auto",
|
|
1908
|
-
overflowX: "hidden",
|
|
1909
|
-
overflowY: "hidden"
|
|
1910
|
-
},
|
|
1911
|
-
"::-webkit-scrollbar-track": {
|
|
1912
|
-
background: "#fff"
|
|
1913
|
-
},
|
|
1914
|
-
"::-webkit-scrollbar-thumb": {
|
|
1915
|
-
background: "#888",
|
|
1916
|
-
borderRadius: "2rem"
|
|
1917
|
-
},
|
|
1918
|
-
"::-webkit-scrollbar-thumb:hover": {
|
|
1919
|
-
background: "#555"
|
|
1920
|
-
}
|
|
1921
|
-
}),
|
|
1922
|
-
option: (provided, state) => ({
|
|
1923
|
-
...provided,
|
|
1924
|
-
backgroundColor: state.isFocused ? "#094394" : "#ffffff",
|
|
1925
|
-
color: state.isFocused ? "#ffffff" : "black",
|
|
1926
|
-
"&:hover": {
|
|
1927
|
-
backgroundColor: "#094394",
|
|
1928
|
-
// Cor de fundo quando em hover
|
|
1929
|
-
color: "#ffffff"
|
|
1930
|
-
// Cor da palavra quando em hover
|
|
1884
|
+
const rawFilter = options.value ?? {};
|
|
1885
|
+
const currentMatchMode = rawFilter.matchMode;
|
|
1886
|
+
const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
|
|
1887
|
+
const currentValue = selectOptions.find((opt) => opt.value === rawFilter.text) || null;
|
|
1888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
1889
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1890
|
+
FilterMatchModeSelect,
|
|
1891
|
+
{
|
|
1892
|
+
options,
|
|
1893
|
+
items: matchModeItems
|
|
1894
|
+
}
|
|
1895
|
+
),
|
|
1896
|
+
!isSpecial && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1897
|
+
import_react_select2.default,
|
|
1898
|
+
{
|
|
1899
|
+
options: selectOptions,
|
|
1900
|
+
value: currentValue,
|
|
1901
|
+
onChange: (selected) => {
|
|
1902
|
+
if (!selected) {
|
|
1903
|
+
options.filterCallback({
|
|
1904
|
+
text: null,
|
|
1905
|
+
matchMode: currentMatchMode
|
|
1906
|
+
});
|
|
1907
|
+
return;
|
|
1931
1908
|
}
|
|
1932
|
-
|
|
1909
|
+
options.filterCallback({
|
|
1910
|
+
text: selected.value,
|
|
1911
|
+
matchMode: currentMatchMode
|
|
1912
|
+
});
|
|
1913
|
+
},
|
|
1914
|
+
placeholder: isLanguagePtBr ? "Selecione..." : "Select...",
|
|
1915
|
+
isClearable: false,
|
|
1916
|
+
isSearchable: false,
|
|
1917
|
+
className: "custom-select-filtro",
|
|
1918
|
+
classNamePrefix: "custom-select-filtro",
|
|
1919
|
+
styles: {
|
|
1920
|
+
control: (baseStyles, state) => ({
|
|
1921
|
+
...baseStyles,
|
|
1922
|
+
"&:hover": {
|
|
1923
|
+
borderColor: state.isFocused ? "#094394" : ""
|
|
1924
|
+
},
|
|
1925
|
+
borderRadius: "6px"
|
|
1926
|
+
}),
|
|
1927
|
+
menuList: (base) => ({
|
|
1928
|
+
...base,
|
|
1929
|
+
"::-webkit-scrollbar": {
|
|
1930
|
+
width: "6px"
|
|
1931
|
+
},
|
|
1932
|
+
"::-webkit-scrollbar-track": {
|
|
1933
|
+
background: "#fff"
|
|
1934
|
+
},
|
|
1935
|
+
"::-webkit-scrollbar-thumb": {
|
|
1936
|
+
background: "#888",
|
|
1937
|
+
borderRadius: "2rem"
|
|
1938
|
+
},
|
|
1939
|
+
"::-webkit-scrollbar-thumb:hover": {
|
|
1940
|
+
background: "#555"
|
|
1941
|
+
}
|
|
1942
|
+
}),
|
|
1943
|
+
option: (provided, state) => ({
|
|
1944
|
+
...provided,
|
|
1945
|
+
backgroundColor: state.isFocused ? "#094394" : "#ffffff",
|
|
1946
|
+
color: state.isFocused ? "#ffffff" : "black",
|
|
1947
|
+
"&:hover": {
|
|
1948
|
+
backgroundColor: "#094394",
|
|
1949
|
+
color: "#ffffff"
|
|
1950
|
+
}
|
|
1951
|
+
})
|
|
1952
|
+
}
|
|
1933
1953
|
}
|
|
1934
|
-
|
|
1935
|
-
);
|
|
1954
|
+
)
|
|
1955
|
+
] });
|
|
1936
1956
|
};
|
|
1937
1957
|
var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
|
|
1938
1958
|
const resolvedItems = items ?? getDefaultFilterMatchOptionsString(isLanguagePtBr);
|
package/dist/index.mjs
CHANGED
|
@@ -1826,63 +1826,83 @@ var ValueFilterTemplate = (options, mask) => {
|
|
|
1826
1826
|
);
|
|
1827
1827
|
};
|
|
1828
1828
|
var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
|
|
1829
|
+
const matchModeItems = getDefaultFilterMatchOptionsEnum(isLanguagePtBr);
|
|
1829
1830
|
const selectOptions = items.length > 0 ? items : [
|
|
1830
1831
|
{ label: isLanguagePtBr ? "Sim" : "Yes", value: true },
|
|
1831
1832
|
{ label: isLanguagePtBr ? "N\xE3o" : "No", value: false }
|
|
1832
1833
|
];
|
|
1833
|
-
const
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
height: "auto",
|
|
1858
|
-
overflowX: "hidden",
|
|
1859
|
-
overflowY: "hidden"
|
|
1860
|
-
},
|
|
1861
|
-
"::-webkit-scrollbar-track": {
|
|
1862
|
-
background: "#fff"
|
|
1863
|
-
},
|
|
1864
|
-
"::-webkit-scrollbar-thumb": {
|
|
1865
|
-
background: "#888",
|
|
1866
|
-
borderRadius: "2rem"
|
|
1867
|
-
},
|
|
1868
|
-
"::-webkit-scrollbar-thumb:hover": {
|
|
1869
|
-
background: "#555"
|
|
1870
|
-
}
|
|
1871
|
-
}),
|
|
1872
|
-
option: (provided, state) => ({
|
|
1873
|
-
...provided,
|
|
1874
|
-
backgroundColor: state.isFocused ? "#094394" : "#ffffff",
|
|
1875
|
-
color: state.isFocused ? "#ffffff" : "black",
|
|
1876
|
-
"&:hover": {
|
|
1877
|
-
backgroundColor: "#094394",
|
|
1878
|
-
// Cor de fundo quando em hover
|
|
1879
|
-
color: "#ffffff"
|
|
1880
|
-
// Cor da palavra quando em hover
|
|
1834
|
+
const rawFilter = options.value ?? {};
|
|
1835
|
+
const currentMatchMode = rawFilter.matchMode;
|
|
1836
|
+
const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
|
|
1837
|
+
const currentValue = selectOptions.find((opt) => opt.value === rawFilter.text) || null;
|
|
1838
|
+
return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
|
|
1839
|
+
/* @__PURE__ */ jsx18(
|
|
1840
|
+
FilterMatchModeSelect,
|
|
1841
|
+
{
|
|
1842
|
+
options,
|
|
1843
|
+
items: matchModeItems
|
|
1844
|
+
}
|
|
1845
|
+
),
|
|
1846
|
+
!isSpecial && /* @__PURE__ */ jsx18(
|
|
1847
|
+
Select2,
|
|
1848
|
+
{
|
|
1849
|
+
options: selectOptions,
|
|
1850
|
+
value: currentValue,
|
|
1851
|
+
onChange: (selected) => {
|
|
1852
|
+
if (!selected) {
|
|
1853
|
+
options.filterCallback({
|
|
1854
|
+
text: null,
|
|
1855
|
+
matchMode: currentMatchMode
|
|
1856
|
+
});
|
|
1857
|
+
return;
|
|
1881
1858
|
}
|
|
1882
|
-
|
|
1859
|
+
options.filterCallback({
|
|
1860
|
+
text: selected.value,
|
|
1861
|
+
matchMode: currentMatchMode
|
|
1862
|
+
});
|
|
1863
|
+
},
|
|
1864
|
+
placeholder: isLanguagePtBr ? "Selecione..." : "Select...",
|
|
1865
|
+
isClearable: false,
|
|
1866
|
+
isSearchable: false,
|
|
1867
|
+
className: "custom-select-filtro",
|
|
1868
|
+
classNamePrefix: "custom-select-filtro",
|
|
1869
|
+
styles: {
|
|
1870
|
+
control: (baseStyles, state) => ({
|
|
1871
|
+
...baseStyles,
|
|
1872
|
+
"&:hover": {
|
|
1873
|
+
borderColor: state.isFocused ? "#094394" : ""
|
|
1874
|
+
},
|
|
1875
|
+
borderRadius: "6px"
|
|
1876
|
+
}),
|
|
1877
|
+
menuList: (base) => ({
|
|
1878
|
+
...base,
|
|
1879
|
+
"::-webkit-scrollbar": {
|
|
1880
|
+
width: "6px"
|
|
1881
|
+
},
|
|
1882
|
+
"::-webkit-scrollbar-track": {
|
|
1883
|
+
background: "#fff"
|
|
1884
|
+
},
|
|
1885
|
+
"::-webkit-scrollbar-thumb": {
|
|
1886
|
+
background: "#888",
|
|
1887
|
+
borderRadius: "2rem"
|
|
1888
|
+
},
|
|
1889
|
+
"::-webkit-scrollbar-thumb:hover": {
|
|
1890
|
+
background: "#555"
|
|
1891
|
+
}
|
|
1892
|
+
}),
|
|
1893
|
+
option: (provided, state) => ({
|
|
1894
|
+
...provided,
|
|
1895
|
+
backgroundColor: state.isFocused ? "#094394" : "#ffffff",
|
|
1896
|
+
color: state.isFocused ? "#ffffff" : "black",
|
|
1897
|
+
"&:hover": {
|
|
1898
|
+
backgroundColor: "#094394",
|
|
1899
|
+
color: "#ffffff"
|
|
1900
|
+
}
|
|
1901
|
+
})
|
|
1902
|
+
}
|
|
1883
1903
|
}
|
|
1884
|
-
|
|
1885
|
-
);
|
|
1904
|
+
)
|
|
1905
|
+
] });
|
|
1886
1906
|
};
|
|
1887
1907
|
var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
|
|
1888
1908
|
const resolvedItems = items ?? getDefaultFilterMatchOptionsString(isLanguagePtBr);
|