@kingteza/crud-component 1.0.16 → 1.0.18

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.
@@ -1 +1 @@
1
- "use strict";const d=require("react/jsx-runtime"),g=require("antd"),y=require("../../../locale/hooks/translation-constants.cjs"),l=require("react"),f=require("react-i18next"),c=require("react-router-dom");;/* empty css */const x=({className:s,to:e,onClick:t,tooltip:a,ref:q,...n})=>{var u;const{t:o}=f.useTranslation(y.TRANSLATION_NAMESPACE),i=l.useContext(c.UNSAFE_NavigationContext)?(u=c.useNavigate)==null?void 0:u.call(c):void 0,r=l.useMemo(()=>d.jsx(g.Button,{onClick:t||(e&&i?()=>i(e):void 0),className:s,...n,children:n.children||o(`button.${n.type}`)}),[s,i,t,n,o,e]);return a?d.jsx(g.Tooltip,{title:a,children:r}):r},j=({className:s,to:e,onClick:t,tooltip:a,ref:q,...n})=>{const o=c.useNavigate(),[v,i]=l.useState(!1),r=l.useCallback(async A=>{try{return i(!0),await t(A)}finally{i(!1)}},[t]),u=l.useMemo(()=>d.jsx(g.Button,{loading:v||n.loading,onClick:t?r:e?()=>o(e):void 0,className:s,...n}),[r,s,v,o,t,n,e]);return a?d.jsx(g.Tooltip,{title:a,children:u}):u};x.Async=j;module.exports=x;
1
+ "use strict";const g=require("react/jsx-runtime"),q=require("antd"),A=require("../../../locale/hooks/translation-constants.cjs"),l=require("react"),f=require("react-i18next");;/* empty css */const d=require("react-router"),x=({className:s,to:n,onClick:t,tooltip:i,ref:y,...e})=>{var c;const{t:a}=f.useTranslation(A.TRANSLATION_NAMESPACE);let r;try{r=(c=d.useNavigate)==null?void 0:c.call(d)}catch(u){console.error(u)}const o=l.useMemo(()=>g.jsx(q.Button,{onClick:t||(n&&r?()=>r(n):void 0),className:s,...e,children:e.children||a(`button.${e.type}`)}),[s,r,t,e,a,n]);return i?g.jsx(q.Tooltip,{title:i,children:o}):o},h=({className:s,to:n,onClick:t,tooltip:i,ref:y,...e})=>{const a=d.useNavigate(),[r,o]=l.useState(!1),c=l.useCallback(async v=>{try{return o(!0),await t(v)}finally{o(!1)}},[t]),u=l.useMemo(()=>g.jsx(q.Button,{loading:r||e.loading,onClick:t?c:n?()=>a(n):void 0,className:s,...e}),[c,s,r,a,t,e,n]);return i?g.jsx(q.Tooltip,{title:i,children:u}):u};x.Async=h;module.exports=x;
@@ -1,64 +1,71 @@
1
- import { jsx as u } from "react/jsx-runtime";
2
- import { Button as d, Tooltip as f } from "antd";
3
- import { TRANSLATION_NAMESPACE as y } from "../../../locale/hooks/translation-constants.js";
4
- import { useContext as b, useMemo as l, useState as h, useCallback as x } from "react";
5
- import { useTranslation as N } from "react-i18next";
6
- import { UNSAFE_NavigationContext as S, useNavigate as g } from "react-router-dom";
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { Button as u, Tooltip as f } from "antd";
3
+ import { TRANSLATION_NAMESPACE as h } from "../../../locale/hooks/translation-constants.js";
4
+ import { useMemo as d, useState as v, useCallback as b } from "react";
5
+ import { useTranslation as T } from "react-i18next";
7
6
  /* empty css */
8
- const T = ({
9
- className: i,
7
+ import { useNavigate as g } from "react-router";
8
+ const S = ({
9
+ className: o,
10
10
  to: e,
11
11
  onClick: t,
12
- tooltip: a,
13
- ref: v,
12
+ tooltip: i,
13
+ ref: y,
14
14
  ...n
15
15
  }) => {
16
- var c;
17
- const { t: r } = N(y), o = b(S) ? (c = g) == null ? void 0 : c() : void 0, s = l(
18
- () => /* @__PURE__ */ u(
19
- d,
16
+ var l;
17
+ const { t: a } = T(h);
18
+ let r;
19
+ try {
20
+ r = (l = g) == null ? void 0 : l();
21
+ } catch (s) {
22
+ console.error(s);
23
+ }
24
+ const c = d(
25
+ () => /* @__PURE__ */ m(
26
+ u,
20
27
  {
21
- onClick: t || (e && o ? () => o(e) : void 0),
22
- className: i,
28
+ onClick: t || (e && r ? () => r(e) : void 0),
29
+ className: o,
23
30
  ...n,
24
- children: n.children || r(`button.${n.type}`)
31
+ children: n.children || a(`button.${n.type}`)
25
32
  }
26
33
  ),
27
- [i, o, t, n, r, e]
34
+ [o, r, t, n, a, e]
28
35
  );
29
- return a ? /* @__PURE__ */ u(f, { title: a, children: s }) : s;
30
- }, C = ({
31
- className: i,
36
+ return i ? /* @__PURE__ */ m(f, { title: i, children: c }) : c;
37
+ }, x = ({
38
+ className: o,
32
39
  to: e,
33
40
  onClick: t,
34
- tooltip: a,
35
- ref: v,
41
+ tooltip: i,
42
+ ref: y,
36
43
  ...n
37
44
  }) => {
38
- const r = g(), [m, o] = h(!1), s = x(
45
+ const a = g(), [r, c] = v(!1), l = b(
39
46
  async (A) => {
40
47
  try {
41
- return o(!0), await t(A);
48
+ return c(!0), await t(A);
42
49
  } finally {
43
- o(!1);
50
+ c(!1);
44
51
  }
45
52
  },
46
53
  [t]
47
- ), c = l(
48
- () => /* @__PURE__ */ u(
49
- d,
54
+ ), s = d(
55
+ () => /* @__PURE__ */ m(
56
+ u,
50
57
  {
51
- loading: m || n.loading,
52
- onClick: t ? s : e ? () => r(e) : void 0,
53
- className: i,
58
+ loading: r || n.loading,
59
+ onClick: t ? l : e ? () => a(e) : void 0,
60
+ className: o,
54
61
  ...n
55
62
  }
56
63
  ),
57
- [s, i, m, r, t, n, e]
64
+ [l, o, r, a, t, n, e]
58
65
  );
59
- return a ? /* @__PURE__ */ u(f, { title: a, children: c }) : c;
66
+ return i ? /* @__PURE__ */ m(f, { title: i, children: s }) : s;
60
67
  };
61
- T.Async = C;
68
+ S.Async = x;
62
69
  export {
63
- T as default
70
+ S as default
64
71
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.0.16",
4
+ "version": "1.0.18",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",
@@ -105,6 +105,8 @@
105
105
  "i18next": ">=21.0.0",
106
106
  "react": ">=16.8.0",
107
107
  "react-dom": ">=16.8.0",
108
- "react-i18next": ">=11.0.0"
108
+ "react-i18next": ">=11.0.0",
109
+ "react-router": ">=6.0.0",
110
+ "react-router-dom": ">=6.0.0"
109
111
  }
110
112
  }