@charlesgomes/leafcode-shared-lib-react 1.0.65 → 1.0.66
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 +52 -22
- package/dist/index.mjs +52 -22
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -693,25 +693,24 @@ var import_react_query = require("@tanstack/react-query");
|
|
|
693
693
|
// src/components/Loading/Loading.tsx
|
|
694
694
|
var import_react10 = require("react");
|
|
695
695
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
696
|
-
var LoadingSpinner = (0, import_react10.memo)(
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
);
|
|
696
|
+
var LoadingSpinner = (0, import_react10.memo)(({ size = 20 }) => {
|
|
697
|
+
const theme = useLeafcodeTheme();
|
|
698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
699
|
+
"span",
|
|
700
|
+
{
|
|
701
|
+
style: {
|
|
702
|
+
width: size,
|
|
703
|
+
height: size,
|
|
704
|
+
border: `3px solid ${theme.components.input.colors.focusBorder}33`,
|
|
705
|
+
borderTopColor: theme.components.input.colors.focusBorder,
|
|
706
|
+
borderRadius: "50%",
|
|
707
|
+
display: "inline-block",
|
|
708
|
+
animation: "leafcode-spin 0.8s linear infinite"
|
|
709
|
+
},
|
|
710
|
+
"aria-label": "Carregando"
|
|
711
|
+
}
|
|
712
|
+
);
|
|
713
|
+
});
|
|
715
714
|
LoadingSpinner.displayName = "LoadingSpinner";
|
|
716
715
|
|
|
717
716
|
// src/components/Input/InputAutocomplete.tsx
|
|
@@ -1806,7 +1805,6 @@ var ValueFilterTemplate = (options, mask) => {
|
|
|
1806
1805
|
};
|
|
1807
1806
|
var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
|
|
1808
1807
|
const selectOptions = items.length > 0 ? items : [
|
|
1809
|
-
{ label: isLanguagePtBr ? "Todos" : "All", value: null },
|
|
1810
1808
|
{ label: isLanguagePtBr ? "Sim" : "Yes", value: true },
|
|
1811
1809
|
{ label: isLanguagePtBr ? "N\xE3o" : "No", value: false }
|
|
1812
1810
|
];
|
|
@@ -2085,6 +2083,40 @@ var buildFilterPayload = (fieldName, matchMode, rawValue) => {
|
|
|
2085
2083
|
}
|
|
2086
2084
|
};
|
|
2087
2085
|
}
|
|
2086
|
+
if (matchMode === "dateBeforeAndEquals") {
|
|
2087
|
+
if (normalized === null) return null;
|
|
2088
|
+
return {
|
|
2089
|
+
or: [
|
|
2090
|
+
{
|
|
2091
|
+
field: fieldName,
|
|
2092
|
+
operator: "LessThan",
|
|
2093
|
+
value: normalized
|
|
2094
|
+
},
|
|
2095
|
+
{
|
|
2096
|
+
field: fieldName,
|
|
2097
|
+
operator: "Equals",
|
|
2098
|
+
value: normalized
|
|
2099
|
+
}
|
|
2100
|
+
]
|
|
2101
|
+
};
|
|
2102
|
+
}
|
|
2103
|
+
if (matchMode === "dateAfterAndEquals") {
|
|
2104
|
+
if (normalized === null) return null;
|
|
2105
|
+
return {
|
|
2106
|
+
or: [
|
|
2107
|
+
{
|
|
2108
|
+
field: fieldName,
|
|
2109
|
+
operator: "GreaterThan",
|
|
2110
|
+
value: normalized
|
|
2111
|
+
},
|
|
2112
|
+
{
|
|
2113
|
+
field: fieldName,
|
|
2114
|
+
operator: "Equals",
|
|
2115
|
+
value: normalized
|
|
2116
|
+
}
|
|
2117
|
+
]
|
|
2118
|
+
};
|
|
2119
|
+
}
|
|
2088
2120
|
if (normalized === null) return null;
|
|
2089
2121
|
if (matchMode === "notStartsWith" || matchMode === "notEndsWith" || matchMode === "notEquals" || // <- notEquals
|
|
2090
2122
|
matchMode === "dateIsNot" || matchMode === "notContains") {
|
|
@@ -2120,11 +2152,9 @@ var buildFilterPayload = (fieldName, matchMode, rawValue) => {
|
|
|
2120
2152
|
};
|
|
2121
2153
|
var mapPrimeToBackendFilters = (filters, globalFilterFields) => {
|
|
2122
2154
|
const finalAnd = [];
|
|
2123
|
-
const globalOr = [];
|
|
2124
2155
|
const camposMap = {};
|
|
2125
2156
|
Object.entries(filters).forEach(([field, config]) => {
|
|
2126
2157
|
if (!config) return;
|
|
2127
|
-
const value = config?.value?.text ?? config?.value;
|
|
2128
2158
|
if (field === "global" && typeof config.value === "string" && config.value.trim() !== "") {
|
|
2129
2159
|
const globalOrNodes = [];
|
|
2130
2160
|
globalFilterFields.forEach((globalField) => {
|
package/dist/index.mjs
CHANGED
|
@@ -644,25 +644,24 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
644
644
|
// src/components/Loading/Loading.tsx
|
|
645
645
|
import { memo } from "react";
|
|
646
646
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
647
|
-
var LoadingSpinner = memo(
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
);
|
|
647
|
+
var LoadingSpinner = memo(({ size = 20 }) => {
|
|
648
|
+
const theme = useLeafcodeTheme();
|
|
649
|
+
return /* @__PURE__ */ jsx9(
|
|
650
|
+
"span",
|
|
651
|
+
{
|
|
652
|
+
style: {
|
|
653
|
+
width: size,
|
|
654
|
+
height: size,
|
|
655
|
+
border: `3px solid ${theme.components.input.colors.focusBorder}33`,
|
|
656
|
+
borderTopColor: theme.components.input.colors.focusBorder,
|
|
657
|
+
borderRadius: "50%",
|
|
658
|
+
display: "inline-block",
|
|
659
|
+
animation: "leafcode-spin 0.8s linear infinite"
|
|
660
|
+
},
|
|
661
|
+
"aria-label": "Carregando"
|
|
662
|
+
}
|
|
663
|
+
);
|
|
664
|
+
});
|
|
666
665
|
LoadingSpinner.displayName = "LoadingSpinner";
|
|
667
666
|
|
|
668
667
|
// src/components/Input/InputAutocomplete.tsx
|
|
@@ -1757,7 +1756,6 @@ var ValueFilterTemplate = (options, mask) => {
|
|
|
1757
1756
|
};
|
|
1758
1757
|
var SelectFilterTemplate = (options, isLanguagePtBr = true, items = []) => {
|
|
1759
1758
|
const selectOptions = items.length > 0 ? items : [
|
|
1760
|
-
{ label: isLanguagePtBr ? "Todos" : "All", value: null },
|
|
1761
1759
|
{ label: isLanguagePtBr ? "Sim" : "Yes", value: true },
|
|
1762
1760
|
{ label: isLanguagePtBr ? "N\xE3o" : "No", value: false }
|
|
1763
1761
|
];
|
|
@@ -2036,6 +2034,40 @@ var buildFilterPayload = (fieldName, matchMode, rawValue) => {
|
|
|
2036
2034
|
}
|
|
2037
2035
|
};
|
|
2038
2036
|
}
|
|
2037
|
+
if (matchMode === "dateBeforeAndEquals") {
|
|
2038
|
+
if (normalized === null) return null;
|
|
2039
|
+
return {
|
|
2040
|
+
or: [
|
|
2041
|
+
{
|
|
2042
|
+
field: fieldName,
|
|
2043
|
+
operator: "LessThan",
|
|
2044
|
+
value: normalized
|
|
2045
|
+
},
|
|
2046
|
+
{
|
|
2047
|
+
field: fieldName,
|
|
2048
|
+
operator: "Equals",
|
|
2049
|
+
value: normalized
|
|
2050
|
+
}
|
|
2051
|
+
]
|
|
2052
|
+
};
|
|
2053
|
+
}
|
|
2054
|
+
if (matchMode === "dateAfterAndEquals") {
|
|
2055
|
+
if (normalized === null) return null;
|
|
2056
|
+
return {
|
|
2057
|
+
or: [
|
|
2058
|
+
{
|
|
2059
|
+
field: fieldName,
|
|
2060
|
+
operator: "GreaterThan",
|
|
2061
|
+
value: normalized
|
|
2062
|
+
},
|
|
2063
|
+
{
|
|
2064
|
+
field: fieldName,
|
|
2065
|
+
operator: "Equals",
|
|
2066
|
+
value: normalized
|
|
2067
|
+
}
|
|
2068
|
+
]
|
|
2069
|
+
};
|
|
2070
|
+
}
|
|
2039
2071
|
if (normalized === null) return null;
|
|
2040
2072
|
if (matchMode === "notStartsWith" || matchMode === "notEndsWith" || matchMode === "notEquals" || // <- notEquals
|
|
2041
2073
|
matchMode === "dateIsNot" || matchMode === "notContains") {
|
|
@@ -2071,11 +2103,9 @@ var buildFilterPayload = (fieldName, matchMode, rawValue) => {
|
|
|
2071
2103
|
};
|
|
2072
2104
|
var mapPrimeToBackendFilters = (filters, globalFilterFields) => {
|
|
2073
2105
|
const finalAnd = [];
|
|
2074
|
-
const globalOr = [];
|
|
2075
2106
|
const camposMap = {};
|
|
2076
2107
|
Object.entries(filters).forEach(([field, config]) => {
|
|
2077
2108
|
if (!config) return;
|
|
2078
|
-
const value = config?.value?.text ?? config?.value;
|
|
2079
2109
|
if (field === "global" && typeof config.value === "string" && config.value.trim() !== "") {
|
|
2080
2110
|
const globalOrNodes = [];
|
|
2081
2111
|
globalFilterFields.forEach((globalField) => {
|