@charlesgomes/leafcode-shared-lib-react 1.0.39 → 1.0.40
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 +41 -12
- package/dist/index.mjs +41 -12
- package/package.json +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -94,7 +94,7 @@ interface IItemProps {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
declare const DateFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
|
|
97
|
-
declare const DateTimeFilterTemplate: (options: any, mask?: (value:
|
|
97
|
+
declare const DateTimeFilterTemplate: (options: any, mask?: (value: Date) => string | number) => react_jsx_runtime.JSX.Element;
|
|
98
98
|
declare const ValueFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
|
|
99
99
|
declare const SelectFilterTemplate: (options: any, isLanguagePtBr?: boolean, items?: IItemProps[]) => react_jsx_runtime.JSX.Element;
|
|
100
100
|
declare const CustomFilterElement: (options: any, isLanguagePtBr?: boolean, items?: any[]) => react_jsx_runtime.JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -94,7 +94,7 @@ interface IItemProps {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
declare const DateFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
|
|
97
|
-
declare const DateTimeFilterTemplate: (options: any, mask?: (value:
|
|
97
|
+
declare const DateTimeFilterTemplate: (options: any, mask?: (value: Date) => string | number) => react_jsx_runtime.JSX.Element;
|
|
98
98
|
declare const ValueFilterTemplate: (options: any, mask?: (value: any) => string | number) => react_jsx_runtime.JSX.Element;
|
|
99
99
|
declare const SelectFilterTemplate: (options: any, isLanguagePtBr?: boolean, items?: IItemProps[]) => react_jsx_runtime.JSX.Element;
|
|
100
100
|
declare const CustomFilterElement: (options: any, isLanguagePtBr?: boolean, items?: any[]) => react_jsx_runtime.JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -218,6 +218,7 @@ var import_react3 = require("@phosphor-icons/react");
|
|
|
218
218
|
|
|
219
219
|
// src/utils/utils.ts
|
|
220
220
|
var import_clsx = require("clsx");
|
|
221
|
+
var import_moment = __toESM(require("moment"));
|
|
221
222
|
var import_tailwind_merge = require("tailwind-merge");
|
|
222
223
|
function cn(...inputs) {
|
|
223
224
|
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
@@ -1014,6 +1015,7 @@ function DataTableAdvancedFilter({
|
|
|
1014
1015
|
// src/components/DataTableAdvancedFilter/FilterTemplates.tsx
|
|
1015
1016
|
var import_react_select = __toESM(require("react-select"));
|
|
1016
1017
|
var import_dropdown = require("primereact/dropdown");
|
|
1018
|
+
var import_moment2 = __toESM(require("moment"));
|
|
1017
1019
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1018
1020
|
var DateFilterTemplate = (options, mask) => {
|
|
1019
1021
|
const parsedValue = options.value && typeof options.value === "string" ? /* @__PURE__ */ new Date(options.value + "T00:00:00") : options.value;
|
|
@@ -1041,23 +1043,50 @@ var DateFilterTemplate = (options, mask) => {
|
|
|
1041
1043
|
);
|
|
1042
1044
|
};
|
|
1043
1045
|
var DateTimeFilterTemplate = (options, mask) => {
|
|
1044
|
-
const parsedValue =
|
|
1046
|
+
const parsedValue = (() => {
|
|
1047
|
+
if (!options.value) {
|
|
1048
|
+
return (0, import_moment2.default)().set({
|
|
1049
|
+
hour: 0,
|
|
1050
|
+
minute: 0,
|
|
1051
|
+
second: 0,
|
|
1052
|
+
millisecond: 0
|
|
1053
|
+
}).toDate();
|
|
1054
|
+
}
|
|
1055
|
+
if (typeof options.value === "string") {
|
|
1056
|
+
return (0, import_moment2.default)(options.value, [
|
|
1057
|
+
"YYYY-MM-DD",
|
|
1058
|
+
"YYYY-MM-DDTHH:mm:ss.SSS"
|
|
1059
|
+
]).toDate();
|
|
1060
|
+
}
|
|
1061
|
+
return options.value;
|
|
1062
|
+
})();
|
|
1063
|
+
const handleChange = (e) => {
|
|
1064
|
+
if (!e.value) {
|
|
1065
|
+
options.filterCallback(null, options.index);
|
|
1066
|
+
return;
|
|
1067
|
+
}
|
|
1068
|
+
const date = e.value;
|
|
1069
|
+
const normalizedDate = (0, import_moment2.default)(date).set({
|
|
1070
|
+
hour: 0,
|
|
1071
|
+
minute: 0,
|
|
1072
|
+
second: 0,
|
|
1073
|
+
millisecond: 0
|
|
1074
|
+
}).toDate();
|
|
1075
|
+
const valueToFilter = mask ? mask(normalizedDate) : (0, import_moment2.default)(normalizedDate).format("YYYY-MM-DDTHH:mm:ss.SSS");
|
|
1076
|
+
options.filterCallback(valueToFilter, options.index);
|
|
1077
|
+
};
|
|
1045
1078
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1046
1079
|
import_calendar.Calendar,
|
|
1047
1080
|
{
|
|
1048
1081
|
value: parsedValue,
|
|
1049
|
-
onChange:
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
}
|
|
1054
|
-
const valueToFilter = mask ? mask(e.value) : e.value;
|
|
1055
|
-
options.filterCallback(valueToFilter, options.index);
|
|
1056
|
-
},
|
|
1082
|
+
onChange: handleChange,
|
|
1083
|
+
showTime: true,
|
|
1084
|
+
showSeconds: true,
|
|
1085
|
+
hourFormat: "24",
|
|
1057
1086
|
dateFormat: "dd/mm/yy",
|
|
1058
|
-
placeholder: "dd/mm/yyyy",
|
|
1059
|
-
|
|
1060
|
-
|
|
1087
|
+
placeholder: "dd/mm/yyyy 00:00:00.000",
|
|
1088
|
+
inputClassName: "custom-input",
|
|
1089
|
+
mask: "99/99/9999 99:99:99.999"
|
|
1061
1090
|
}
|
|
1062
1091
|
);
|
|
1063
1092
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -167,6 +167,7 @@ import { Trash, Plus, PencilSimple } from "@phosphor-icons/react";
|
|
|
167
167
|
|
|
168
168
|
// src/utils/utils.ts
|
|
169
169
|
import { clsx } from "clsx";
|
|
170
|
+
import moment from "moment";
|
|
170
171
|
import { twMerge } from "tailwind-merge";
|
|
171
172
|
function cn(...inputs) {
|
|
172
173
|
return twMerge(clsx(inputs));
|
|
@@ -963,6 +964,7 @@ function DataTableAdvancedFilter({
|
|
|
963
964
|
// src/components/DataTableAdvancedFilter/FilterTemplates.tsx
|
|
964
965
|
import Select from "react-select";
|
|
965
966
|
import { Dropdown } from "primereact/dropdown";
|
|
967
|
+
import moment2 from "moment";
|
|
966
968
|
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
967
969
|
var DateFilterTemplate = (options, mask) => {
|
|
968
970
|
const parsedValue = options.value && typeof options.value === "string" ? /* @__PURE__ */ new Date(options.value + "T00:00:00") : options.value;
|
|
@@ -990,23 +992,50 @@ var DateFilterTemplate = (options, mask) => {
|
|
|
990
992
|
);
|
|
991
993
|
};
|
|
992
994
|
var DateTimeFilterTemplate = (options, mask) => {
|
|
993
|
-
const parsedValue =
|
|
995
|
+
const parsedValue = (() => {
|
|
996
|
+
if (!options.value) {
|
|
997
|
+
return moment2().set({
|
|
998
|
+
hour: 0,
|
|
999
|
+
minute: 0,
|
|
1000
|
+
second: 0,
|
|
1001
|
+
millisecond: 0
|
|
1002
|
+
}).toDate();
|
|
1003
|
+
}
|
|
1004
|
+
if (typeof options.value === "string") {
|
|
1005
|
+
return moment2(options.value, [
|
|
1006
|
+
"YYYY-MM-DD",
|
|
1007
|
+
"YYYY-MM-DDTHH:mm:ss.SSS"
|
|
1008
|
+
]).toDate();
|
|
1009
|
+
}
|
|
1010
|
+
return options.value;
|
|
1011
|
+
})();
|
|
1012
|
+
const handleChange = (e) => {
|
|
1013
|
+
if (!e.value) {
|
|
1014
|
+
options.filterCallback(null, options.index);
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
const date = e.value;
|
|
1018
|
+
const normalizedDate = moment2(date).set({
|
|
1019
|
+
hour: 0,
|
|
1020
|
+
minute: 0,
|
|
1021
|
+
second: 0,
|
|
1022
|
+
millisecond: 0
|
|
1023
|
+
}).toDate();
|
|
1024
|
+
const valueToFilter = mask ? mask(normalizedDate) : moment2(normalizedDate).format("YYYY-MM-DDTHH:mm:ss.SSS");
|
|
1025
|
+
options.filterCallback(valueToFilter, options.index);
|
|
1026
|
+
};
|
|
994
1027
|
return /* @__PURE__ */ jsx11(
|
|
995
1028
|
Calendar,
|
|
996
1029
|
{
|
|
997
1030
|
value: parsedValue,
|
|
998
|
-
onChange:
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
}
|
|
1003
|
-
const valueToFilter = mask ? mask(e.value) : e.value;
|
|
1004
|
-
options.filterCallback(valueToFilter, options.index);
|
|
1005
|
-
},
|
|
1031
|
+
onChange: handleChange,
|
|
1032
|
+
showTime: true,
|
|
1033
|
+
showSeconds: true,
|
|
1034
|
+
hourFormat: "24",
|
|
1006
1035
|
dateFormat: "dd/mm/yy",
|
|
1007
|
-
placeholder: "dd/mm/yyyy",
|
|
1008
|
-
|
|
1009
|
-
|
|
1036
|
+
placeholder: "dd/mm/yyyy 00:00:00.000",
|
|
1037
|
+
inputClassName: "custom-input",
|
|
1038
|
+
mask: "99/99/9999 99:99:99.999"
|
|
1010
1039
|
}
|
|
1011
1040
|
);
|
|
1012
1041
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@charlesgomes/leafcode-shared-lib-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.40",
|
|
4
4
|
"description": "Lib de componentes react",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@phosphor-icons/react": "^2.1.10",
|
|
56
56
|
"clsx": "^2.1.1",
|
|
57
|
+
"moment": "^2.30.1",
|
|
57
58
|
"primereact": "^10.9.7",
|
|
58
59
|
"react-select": "^5.10.2",
|
|
59
60
|
"react-tooltip": "^5.29.1",
|