@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
|
|
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
|
|
2
|
-
import { Button as
|
|
3
|
-
import { TRANSLATION_NAMESPACE as
|
|
4
|
-
import {
|
|
5
|
-
import { useTranslation as
|
|
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
|
-
|
|
9
|
-
|
|
7
|
+
import { useNavigate as g } from "react-router";
|
|
8
|
+
const S = ({
|
|
9
|
+
className: o,
|
|
10
10
|
to: e,
|
|
11
11
|
onClick: t,
|
|
12
|
-
tooltip:
|
|
13
|
-
ref:
|
|
12
|
+
tooltip: i,
|
|
13
|
+
ref: y,
|
|
14
14
|
...n
|
|
15
15
|
}) => {
|
|
16
|
-
var
|
|
17
|
-
const { t:
|
|
18
|
-
|
|
19
|
-
|
|
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 &&
|
|
22
|
-
className:
|
|
28
|
+
onClick: t || (e && r ? () => r(e) : void 0),
|
|
29
|
+
className: o,
|
|
23
30
|
...n,
|
|
24
|
-
children: n.children ||
|
|
31
|
+
children: n.children || a(`button.${n.type}`)
|
|
25
32
|
}
|
|
26
33
|
),
|
|
27
|
-
[
|
|
34
|
+
[o, r, t, n, a, e]
|
|
28
35
|
);
|
|
29
|
-
return
|
|
30
|
-
},
|
|
31
|
-
className:
|
|
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:
|
|
35
|
-
ref:
|
|
41
|
+
tooltip: i,
|
|
42
|
+
ref: y,
|
|
36
43
|
...n
|
|
37
44
|
}) => {
|
|
38
|
-
const
|
|
45
|
+
const a = g(), [r, c] = v(!1), l = b(
|
|
39
46
|
async (A) => {
|
|
40
47
|
try {
|
|
41
|
-
return
|
|
48
|
+
return c(!0), await t(A);
|
|
42
49
|
} finally {
|
|
43
|
-
|
|
50
|
+
c(!1);
|
|
44
51
|
}
|
|
45
52
|
},
|
|
46
53
|
[t]
|
|
47
|
-
),
|
|
48
|
-
() => /* @__PURE__ */
|
|
49
|
-
|
|
54
|
+
), s = d(
|
|
55
|
+
() => /* @__PURE__ */ m(
|
|
56
|
+
u,
|
|
50
57
|
{
|
|
51
|
-
loading:
|
|
52
|
-
onClick: t ?
|
|
53
|
-
className:
|
|
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
|
-
[
|
|
64
|
+
[l, o, r, a, t, n, e]
|
|
58
65
|
);
|
|
59
|
-
return
|
|
66
|
+
return i ? /* @__PURE__ */ m(f, { title: i, children: s }) : s;
|
|
60
67
|
};
|
|
61
|
-
|
|
68
|
+
S.Async = x;
|
|
62
69
|
export {
|
|
63
|
-
|
|
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.
|
|
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
|
}
|