react-table-edit 1.2.50 → 1.2.52

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 CHANGED
@@ -2882,22 +2882,29 @@ var sidebar_setting_column_default = SidebarSetColumn;
2882
2882
  var import_react16 = require("react");
2883
2883
  var import_react_datepicker = __toESM(require("react-datepicker"));
2884
2884
  var import_react_input_mask = __toESM(require("react-input-mask"));
2885
+ var import_react_datepicker2 = require("react-datepicker/dist/react-datepicker.css");
2885
2886
  var import_jsx_runtime17 = require("react/jsx-runtime");
2886
- var DateInput = (0, import_react16.forwardRef)((props, ref) => {
2887
+ var CustomInput = ({ value, onChange }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2888
+ import_react_input_mask.default,
2889
+ {
2890
+ mask: "99/99/9999",
2891
+ placeholder: "dd/MM/yyyy",
2892
+ value,
2893
+ onChange
2894
+ }
2895
+ );
2896
+ var DateInput = (props) => {
2887
2897
  const { id, onKeyDown, dateFormat, className, onChange, value } = props;
2888
2898
  const [open, setOpen] = (0, import_react16.useState)(false);
2889
2899
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2890
2900
  import_react_datepicker.default,
2891
2901
  {
2892
2902
  id,
2893
- ref,
2894
2903
  open,
2895
2904
  className,
2896
- selected: value,
2905
+ selected: value instanceof Date ? value : null,
2897
2906
  onChange: (date) => {
2898
- if (onChange) {
2899
- onChange(date);
2900
- }
2907
+ if (onChange) onChange(date);
2901
2908
  },
2902
2909
  dateFormat,
2903
2910
  locale: "vi",
@@ -2906,28 +2913,22 @@ var DateInput = (0, import_react16.forwardRef)((props, ref) => {
2906
2913
  dropdownMode: "select",
2907
2914
  onCalendarClose: () => setOpen(false),
2908
2915
  onCalendarOpen: () => setOpen(true),
2909
- customInput: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_input_mask.default, { mask: "99/99/9999", placeholder: dateFormat }),
2916
+ customInput: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CustomInput, {}),
2910
2917
  onKeyDown: (e) => {
2911
2918
  if (e.code === "Space") {
2912
2919
  setOpen(!open);
2913
2920
  setTimeout(() => {
2914
2921
  const element = document.getElementById(id ?? "");
2915
- if (element) {
2916
- element.focus();
2917
- }
2922
+ if (element) element.focus();
2918
2923
  }, 100);
2919
- } else {
2920
- if (onKeyDown && !open) {
2921
- const rs = onKeyDown(e);
2922
- if (rs) {
2923
- setOpen(false);
2924
- }
2925
- }
2924
+ } else if (onKeyDown && !open) {
2925
+ const result = onKeyDown(e);
2926
+ if (result) setOpen(false);
2926
2927
  }
2927
2928
  }
2928
2929
  }
2929
2930
  );
2930
- });
2931
+ };
2931
2932
  var input_date_default = DateInput;
2932
2933
 
2933
2934
  // src/component/table/index.tsx
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/component/table/index.tsx
2
- import { Fragment as Fragment21, forwardRef as forwardRef5, useEffect as useEffect9, useImperativeHandle, useRef as useRef4, useState as useState9 } from "react";
2
+ import { Fragment as Fragment21, forwardRef as forwardRef4, useEffect as useEffect9, useImperativeHandle, useRef as useRef4, useState as useState9 } from "react";
3
3
  import { Button as Button6, DropdownMenu as DropdownMenu4, DropdownToggle as DropdownToggle4, Input as Input8, UncontrolledDropdown, UncontrolledTooltip as UncontrolledTooltip5 } from "reactstrap";
4
4
  import classnames9 from "classnames";
5
5
  import { useTranslation as useTranslation12 } from "react-i18next";
@@ -2849,25 +2849,32 @@ var SidebarSetColumn = (props) => {
2849
2849
  var sidebar_setting_column_default = SidebarSetColumn;
2850
2850
 
2851
2851
  // src/component/input-date/index.tsx
2852
- import { forwardRef as forwardRef4, useState as useState8 } from "react";
2852
+ import { useState as useState8 } from "react";
2853
2853
  import DatePicker from "react-datepicker";
2854
2854
  import InputMask from "react-input-mask";
2855
+ import "react-datepicker/dist/react-datepicker.css";
2855
2856
  import { jsx as jsx17 } from "react/jsx-runtime";
2856
- var DateInput = forwardRef4((props, ref) => {
2857
+ var CustomInput = ({ value, onChange }) => /* @__PURE__ */ jsx17(
2858
+ InputMask,
2859
+ {
2860
+ mask: "99/99/9999",
2861
+ placeholder: "dd/MM/yyyy",
2862
+ value,
2863
+ onChange
2864
+ }
2865
+ );
2866
+ var DateInput = (props) => {
2857
2867
  const { id, onKeyDown, dateFormat, className, onChange, value } = props;
2858
2868
  const [open, setOpen] = useState8(false);
2859
2869
  return /* @__PURE__ */ jsx17(
2860
2870
  DatePicker,
2861
2871
  {
2862
2872
  id,
2863
- ref,
2864
2873
  open,
2865
2874
  className,
2866
- selected: value,
2875
+ selected: value instanceof Date ? value : null,
2867
2876
  onChange: (date) => {
2868
- if (onChange) {
2869
- onChange(date);
2870
- }
2877
+ if (onChange) onChange(date);
2871
2878
  },
2872
2879
  dateFormat,
2873
2880
  locale: "vi",
@@ -2876,33 +2883,27 @@ var DateInput = forwardRef4((props, ref) => {
2876
2883
  dropdownMode: "select",
2877
2884
  onCalendarClose: () => setOpen(false),
2878
2885
  onCalendarOpen: () => setOpen(true),
2879
- customInput: /* @__PURE__ */ jsx17(InputMask, { mask: "99/99/9999", placeholder: dateFormat }),
2886
+ customInput: /* @__PURE__ */ jsx17(CustomInput, {}),
2880
2887
  onKeyDown: (e) => {
2881
2888
  if (e.code === "Space") {
2882
2889
  setOpen(!open);
2883
2890
  setTimeout(() => {
2884
2891
  const element = document.getElementById(id ?? "");
2885
- if (element) {
2886
- element.focus();
2887
- }
2892
+ if (element) element.focus();
2888
2893
  }, 100);
2889
- } else {
2890
- if (onKeyDown && !open) {
2891
- const rs = onKeyDown(e);
2892
- if (rs) {
2893
- setOpen(false);
2894
- }
2895
- }
2894
+ } else if (onKeyDown && !open) {
2895
+ const result = onKeyDown(e);
2896
+ if (result) setOpen(false);
2896
2897
  }
2897
2898
  }
2898
2899
  }
2899
2900
  );
2900
- });
2901
+ };
2901
2902
  var input_date_default = DateInput;
2902
2903
 
2903
2904
  // src/component/table/index.tsx
2904
2905
  import { Fragment as Fragment22, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
2905
- var TableEdit = forwardRef5((props, ref) => {
2906
+ var TableEdit = forwardRef4((props, ref) => {
2906
2907
  const { t } = useTranslation12();
2907
2908
  const {
2908
2909
  idTable,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-table-edit",
3
- "version": "1.2.50",
3
+ "version": "1.2.52",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -9,7 +9,9 @@
9
9
  ],
10
10
  "scripts": {
11
11
  "build": "tsup src/index.ts --format cjs,esm --dts",
12
- "start": "node dist/index.js"
12
+ "start": "node dist/index.js",
13
+ "test": "jest",
14
+ "lint": "eslint . --ext .ts,.tsx"
13
15
  },
14
16
  "keywords": [
15
17
  "react",
@@ -19,12 +21,19 @@
19
21
  "table-edit",
20
22
  "datagrid"
21
23
  ],
24
+ "description": "A React table editing solution with customizable features",
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "https://github.com/<your-username>/react-table-edit"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/<your-username>/react-table-edit/issues"
31
+ },
32
+ "homepage": "https://github.com/<your-username>/react-table-edit#readme",
22
33
  "license": "ISC",
23
34
  "author": "hungnv",
24
35
  "dependencies": {
25
36
  "@hookform/resolvers": "^2.8.10",
26
- "@types/react-datepicker": "^7.0.0",
27
- "@types/react-input-mask": "^3.0.6",
28
37
  "@types/react-resizable": "^3.0.7",
29
38
  "becoxy-icons": "1.8.1",
30
39
  "classnames": "2.3.1",
@@ -43,11 +52,15 @@
43
52
  "yup": "^0.32.11"
44
53
  },
45
54
  "peerDependencies": {
46
- "react": ">=16.8.6",
47
- "react-dom": ">=16.8.6"
55
+ "react": ">=16.8.6 <19.0.0",
56
+ "react-dom": ">=16.8.6 <19.0.0"
48
57
  },
49
58
  "devDependencies": {
50
59
  "tsup": "^8.0.2",
51
60
  "typescript": "^5.6.3"
61
+ },
62
+ "engines": {
63
+ "node": ">=14.0.0",
64
+ "npm": ">=6.0.0"
52
65
  }
53
66
  }