@charlesgomes/leafcode-shared-lib-react 1.0.39 → 1.0.41

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
@@ -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: any) => string | number) => react_jsx_runtime.JSX.Element;
97
+ declare const DateTimeFilterTemplate: (options: any) => 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: any) => string | number) => react_jsx_runtime.JSX.Element;
97
+ declare const DateTimeFilterTemplate: (options: any) => 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;
@@ -1040,23 +1042,28 @@ var DateFilterTemplate = (options, mask) => {
1040
1042
  }
1041
1043
  );
1042
1044
  };
1043
- var DateTimeFilterTemplate = (options, mask) => {
1044
- const parsedValue = options.value && typeof options.value === "string" ? new Date(options.value) : options.value;
1045
+ var DateTimeFilterTemplate = (options) => {
1046
+ const value = typeof options.value === "string" ? (0, import_moment2.default)(options.value, "YYYY-MM-DDTHH:mm:ss.SSS").toDate() : options.value ?? null;
1045
1047
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1046
1048
  import_calendar.Calendar,
1047
1049
  {
1048
- value: parsedValue,
1050
+ value,
1049
1051
  onChange: (e) => {
1050
1052
  if (!e.value) {
1051
1053
  options.filterCallback(null, options.index);
1052
1054
  return;
1053
1055
  }
1054
- const valueToFilter = mask ? mask(e.value) : e.value;
1055
- options.filterCallback(valueToFilter, options.index);
1056
+ const formatted = (0, import_moment2.default)(e.value).format(
1057
+ "YYYY-MM-DDTHH:mm:ss.SSS"
1058
+ );
1059
+ options.filterCallback(formatted, options.index);
1056
1060
  },
1061
+ showTime: true,
1062
+ showSeconds: true,
1063
+ hourFormat: "24",
1064
+ placeholder: "dd/mm/yyyy 00:00:00",
1057
1065
  dateFormat: "dd/mm/yy",
1058
- placeholder: "dd/mm/yyyy",
1059
- mask: "99/99/9999",
1066
+ readOnlyInput: true,
1060
1067
  inputClassName: "custom-input"
1061
1068
  }
1062
1069
  );
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;
@@ -989,23 +991,28 @@ var DateFilterTemplate = (options, mask) => {
989
991
  }
990
992
  );
991
993
  };
992
- var DateTimeFilterTemplate = (options, mask) => {
993
- const parsedValue = options.value && typeof options.value === "string" ? new Date(options.value) : options.value;
994
+ var DateTimeFilterTemplate = (options) => {
995
+ const value = typeof options.value === "string" ? moment2(options.value, "YYYY-MM-DDTHH:mm:ss.SSS").toDate() : options.value ?? null;
994
996
  return /* @__PURE__ */ jsx11(
995
997
  Calendar,
996
998
  {
997
- value: parsedValue,
999
+ value,
998
1000
  onChange: (e) => {
999
1001
  if (!e.value) {
1000
1002
  options.filterCallback(null, options.index);
1001
1003
  return;
1002
1004
  }
1003
- const valueToFilter = mask ? mask(e.value) : e.value;
1004
- options.filterCallback(valueToFilter, options.index);
1005
+ const formatted = moment2(e.value).format(
1006
+ "YYYY-MM-DDTHH:mm:ss.SSS"
1007
+ );
1008
+ options.filterCallback(formatted, options.index);
1005
1009
  },
1010
+ showTime: true,
1011
+ showSeconds: true,
1012
+ hourFormat: "24",
1013
+ placeholder: "dd/mm/yyyy 00:00:00",
1006
1014
  dateFormat: "dd/mm/yy",
1007
- placeholder: "dd/mm/yyyy",
1008
- mask: "99/99/9999",
1015
+ readOnlyInput: true,
1009
1016
  inputClassName: "custom-input"
1010
1017
  }
1011
1018
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charlesgomes/leafcode-shared-lib-react",
3
- "version": "1.0.39",
3
+ "version": "1.0.41",
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",