@charlesgomes/leafcode-shared-lib-react 1.0.68 → 1.0.70

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 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
@@ -1867,6 +1867,7 @@ var ValueFilterTemplate = (options, mask) => {
1867
1867
  import_inputnumber.InputNumber,
1868
1868
  {
1869
1869
  value: parsedValue,
1870
+ placeholder: "R$ 0,00",
1870
1871
  onValueChange: handleChange,
1871
1872
  mode: "currency",
1872
1873
  currency: "BRL",
@@ -1876,63 +1877,83 @@ var ValueFilterTemplate = (options, mask) => {
1876
1877
  );
1877
1878
  };
1878
1879
  var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
1880
+ const matchModeItems = getDefaultFilterMatchOptionsEnum(isLanguagePtBr);
1879
1881
  const selectOptions = items.length > 0 ? items : [
1880
1882
  { label: isLanguagePtBr ? "Sim" : "Yes", value: true },
1881
1883
  { label: isLanguagePtBr ? "N\xE3o" : "No", value: false }
1882
1884
  ];
1883
- const currentValue = selectOptions.find((opt) => opt.value === options.value) || null;
1884
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1885
- import_react_select2.default,
1886
- {
1887
- options: selectOptions,
1888
- value: currentValue,
1889
- onChange: (selected) => options.filterCallback(selected?.value),
1890
- placeholder: "Selecione...",
1891
- isClearable: false,
1892
- isSearchable: false,
1893
- className: "custom-select-filtro",
1894
- classNamePrefix: "custom-select-filtro",
1895
- styles: {
1896
- control: (baseStyles, state) => ({
1897
- ...baseStyles,
1898
- "&:hover": {
1899
- borderColor: state.isFocused ? "#094394" : ""
1900
- },
1901
- borderRadius: "6px"
1902
- }),
1903
- menuList: (base) => ({
1904
- ...base,
1905
- "::-webkit-scrollbar": {
1906
- width: "6px",
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
1885
+ const rawFilter = options.value ?? {};
1886
+ const currentMatchMode = rawFilter.matchMode;
1887
+ const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
1888
+ const currentValue = selectOptions.find((opt) => opt.value === rawFilter.text) || null;
1889
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1890
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1891
+ FilterMatchModeSelect,
1892
+ {
1893
+ options,
1894
+ items: matchModeItems
1895
+ }
1896
+ ),
1897
+ !isSpecial && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1898
+ import_react_select2.default,
1899
+ {
1900
+ options: selectOptions,
1901
+ value: currentValue,
1902
+ onChange: (selected) => {
1903
+ if (!selected) {
1904
+ options.filterCallback({
1905
+ text: null,
1906
+ matchMode: currentMatchMode
1907
+ });
1908
+ return;
1931
1909
  }
1932
- })
1910
+ options.filterCallback({
1911
+ text: selected.value,
1912
+ matchMode: currentMatchMode
1913
+ });
1914
+ },
1915
+ placeholder: isLanguagePtBr ? "Selecione..." : "Select...",
1916
+ isClearable: false,
1917
+ isSearchable: false,
1918
+ className: "custom-select-filtro",
1919
+ classNamePrefix: "custom-select-filtro",
1920
+ styles: {
1921
+ control: (baseStyles, state) => ({
1922
+ ...baseStyles,
1923
+ "&:hover": {
1924
+ borderColor: state.isFocused ? "#094394" : ""
1925
+ },
1926
+ borderRadius: "6px"
1927
+ }),
1928
+ menuList: (base) => ({
1929
+ ...base,
1930
+ "::-webkit-scrollbar": {
1931
+ width: "6px"
1932
+ },
1933
+ "::-webkit-scrollbar-track": {
1934
+ background: "#fff"
1935
+ },
1936
+ "::-webkit-scrollbar-thumb": {
1937
+ background: "#888",
1938
+ borderRadius: "2rem"
1939
+ },
1940
+ "::-webkit-scrollbar-thumb:hover": {
1941
+ background: "#555"
1942
+ }
1943
+ }),
1944
+ option: (provided, state) => ({
1945
+ ...provided,
1946
+ backgroundColor: state.isFocused ? "#094394" : "#ffffff",
1947
+ color: state.isFocused ? "#ffffff" : "black",
1948
+ "&:hover": {
1949
+ backgroundColor: "#094394",
1950
+ color: "#ffffff"
1951
+ }
1952
+ })
1953
+ }
1933
1954
  }
1934
- }
1935
- );
1955
+ )
1956
+ ] });
1936
1957
  };
1937
1958
  var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
1938
1959
  const resolvedItems = items ?? getDefaultFilterMatchOptionsString(isLanguagePtBr);
package/dist/index.mjs CHANGED
@@ -1817,6 +1817,7 @@ var ValueFilterTemplate = (options, mask) => {
1817
1817
  InputNumber,
1818
1818
  {
1819
1819
  value: parsedValue,
1820
+ placeholder: "R$ 0,00",
1820
1821
  onValueChange: handleChange,
1821
1822
  mode: "currency",
1822
1823
  currency: "BRL",
@@ -1826,63 +1827,83 @@ var ValueFilterTemplate = (options, mask) => {
1826
1827
  );
1827
1828
  };
1828
1829
  var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
1830
+ const matchModeItems = getDefaultFilterMatchOptionsEnum(isLanguagePtBr);
1829
1831
  const selectOptions = items.length > 0 ? items : [
1830
1832
  { label: isLanguagePtBr ? "Sim" : "Yes", value: true },
1831
1833
  { label: isLanguagePtBr ? "N\xE3o" : "No", value: false }
1832
1834
  ];
1833
- const currentValue = selectOptions.find((opt) => opt.value === options.value) || null;
1834
- return /* @__PURE__ */ jsx18(
1835
- Select2,
1836
- {
1837
- options: selectOptions,
1838
- value: currentValue,
1839
- onChange: (selected) => options.filterCallback(selected?.value),
1840
- placeholder: "Selecione...",
1841
- isClearable: false,
1842
- isSearchable: false,
1843
- className: "custom-select-filtro",
1844
- classNamePrefix: "custom-select-filtro",
1845
- styles: {
1846
- control: (baseStyles, state) => ({
1847
- ...baseStyles,
1848
- "&:hover": {
1849
- borderColor: state.isFocused ? "#094394" : ""
1850
- },
1851
- borderRadius: "6px"
1852
- }),
1853
- menuList: (base) => ({
1854
- ...base,
1855
- "::-webkit-scrollbar": {
1856
- width: "6px",
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
1835
+ const rawFilter = options.value ?? {};
1836
+ const currentMatchMode = rawFilter.matchMode;
1837
+ const isSpecial = currentMatchMode === customMatchModes.empty || currentMatchMode === customMatchModes.notEmpty;
1838
+ const currentValue = selectOptions.find((opt) => opt.value === rawFilter.text) || null;
1839
+ return /* @__PURE__ */ jsxs12("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
1840
+ /* @__PURE__ */ jsx18(
1841
+ FilterMatchModeSelect,
1842
+ {
1843
+ options,
1844
+ items: matchModeItems
1845
+ }
1846
+ ),
1847
+ !isSpecial && /* @__PURE__ */ jsx18(
1848
+ Select2,
1849
+ {
1850
+ options: selectOptions,
1851
+ value: currentValue,
1852
+ onChange: (selected) => {
1853
+ if (!selected) {
1854
+ options.filterCallback({
1855
+ text: null,
1856
+ matchMode: currentMatchMode
1857
+ });
1858
+ return;
1881
1859
  }
1882
- })
1860
+ options.filterCallback({
1861
+ text: selected.value,
1862
+ matchMode: currentMatchMode
1863
+ });
1864
+ },
1865
+ placeholder: isLanguagePtBr ? "Selecione..." : "Select...",
1866
+ isClearable: false,
1867
+ isSearchable: false,
1868
+ className: "custom-select-filtro",
1869
+ classNamePrefix: "custom-select-filtro",
1870
+ styles: {
1871
+ control: (baseStyles, state) => ({
1872
+ ...baseStyles,
1873
+ "&:hover": {
1874
+ borderColor: state.isFocused ? "#094394" : ""
1875
+ },
1876
+ borderRadius: "6px"
1877
+ }),
1878
+ menuList: (base) => ({
1879
+ ...base,
1880
+ "::-webkit-scrollbar": {
1881
+ width: "6px"
1882
+ },
1883
+ "::-webkit-scrollbar-track": {
1884
+ background: "#fff"
1885
+ },
1886
+ "::-webkit-scrollbar-thumb": {
1887
+ background: "#888",
1888
+ borderRadius: "2rem"
1889
+ },
1890
+ "::-webkit-scrollbar-thumb:hover": {
1891
+ background: "#555"
1892
+ }
1893
+ }),
1894
+ option: (provided, state) => ({
1895
+ ...provided,
1896
+ backgroundColor: state.isFocused ? "#094394" : "#ffffff",
1897
+ color: state.isFocused ? "#ffffff" : "black",
1898
+ "&:hover": {
1899
+ backgroundColor: "#094394",
1900
+ color: "#ffffff"
1901
+ }
1902
+ })
1903
+ }
1883
1904
  }
1884
- }
1885
- );
1905
+ )
1906
+ ] });
1886
1907
  };
1887
1908
  var CustomFilterElement = (options, isLanguagePtBr = true, items) => {
1888
1909
  const resolvedItems = items ?? getDefaultFilterMatchOptionsString(isLanguagePtBr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charlesgomes/leafcode-shared-lib-react",
3
- "version": "1.0.68",
3
+ "version": "1.0.70",
4
4
  "description": "Lib de componentes react",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",