@kingteza/crud-component 1.0.15 → 1.0.17
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/components/common/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/common/DatePicker/DatePicker.js +6 -6
- package/dist/components/common/button/Button.cjs +1 -1
- package/dist/components/common/button/Button.js +43 -36
- package/dist/util/ImageUtil.cjs +1 -1
- package/dist/util/ImageUtil.js +1 -1
- package/package.json +4 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const d=require("react/jsx-runtime"),s=require("antd"),t=require("dayjs"),E=require("
|
|
1
|
+
"use strict";const d=require("react/jsx-runtime"),s=require("antd"),t=require("dayjs"),E=require("dayjs/plugin/advancedFormat"),F=require("dayjs/plugin/customParseFormat"),I=require("dayjs/plugin/localeData"),v=require("dayjs/plugin/weekday"),S=require("dayjs/plugin/weekOfYear"),T=require("dayjs/plugin/weekYear"),Y=require("../../../locale/hooks/translation-constants.cjs"),$=require("react"),L=require("react-i18next");t.extend(F);t.extend(E);t.extend(v);t.extend(I);t.extend(S);t.extend(T);const M=({type:_,required:q,label:o,rules:x=[],placeholder:a,disabledPastDays:c=!1,disableToday:i=!1,onEnter:z,disabled:f,nextFocus:B,onChange:r,range:m,showTime:l,disabledFutureDays:u,picker:k,defaultValue:O,value:y,format:P,autoComplete:G="off",enabledDates:H=[],renderExtraFooter:j,...p})=>{const{t:w}=L.useTranslation(Y.TRANSLATION_NAMESPACE),A=m?s.DatePicker.RangePicker:s.DatePicker,D=$.useCallback(e=>{if(!e)return!1;const n=t(),N=c&&e<n.startOf("day"),R=u&&e>n.endOf("day"),C=i&&e<n.endOf("day")&&n.startOf("day")<e;return N||R||C},[c,u,i]);return d.jsx(s.Form.Item,{...p,label:o,rules:[{required:q,message:`${o??a??""} ${w("err.validation.required")}`},...x],children:d.jsx(A,{renderExtraFooter:j,value:y,picker:k,defaultValue:O,format:P,onChange:e=>r==null?void 0:r(e),disabledDate:D,disabled:f,className:"w-100",placeholder:a,showTime:l})})};module.exports=M;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { DatePicker as d, Form as C } from "antd";
|
|
3
3
|
import e from "dayjs";
|
|
4
|
-
import I from "
|
|
5
|
-
import R from "
|
|
6
|
-
import S from "
|
|
7
|
-
import T from "
|
|
8
|
-
import Y from "
|
|
9
|
-
import $ from "
|
|
4
|
+
import I from "dayjs/plugin/advancedFormat";
|
|
5
|
+
import R from "dayjs/plugin/customParseFormat";
|
|
6
|
+
import S from "dayjs/plugin/localeData";
|
|
7
|
+
import T from "dayjs/plugin/weekday";
|
|
8
|
+
import Y from "dayjs/plugin/weekOfYear";
|
|
9
|
+
import $ from "dayjs/plugin/weekYear";
|
|
10
10
|
import { TRANSLATION_NAMESPACE as q } from "../../../locale/hooks/translation-constants.js";
|
|
11
11
|
import { useCallback as L } from "react";
|
|
12
12
|
import { useTranslation as M } from "react-i18next";
|
|
@@ -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/dist/util/ImageUtil.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const c=require("
|
|
1
|
+
"use strict";const c=require("browser-image-compression");class g{async resizeImage(t){const e=await c(t,{maxSizeMB:1,maxWidthOrHeight:1920,useWebWorker:!0}),a=t.uid;return Object.assign(e,{uid:a,lastModifiedDate:new Date})}async getImageData(t){const e=await this.getImageData0(t);if(e){const a=new Image;a.src=e.data;const o=await new Promise(n=>{a.onload=function(){n({height:a.height,width:a.width})}});return Object.assign(e,o),e}else return null}async getImageData0(t){try{if(t.startsWith("data:image/")){const e=t.match(/^data:image\/(png|jpeg|jpg);base64,(.*)$/);if(!e)throw new Error("Invalid base64 image data");return{data:t,type:e[1]}}else{const e=await fetch(t);if(!e.ok)throw new Error("Network response was not ok");const a=await e.blob();return new Promise((o,n)=>{const s=new FileReader;s.onloadend=function(){const r=s.result,i=r.match(/^data:image\/(png|jpeg|jpg);base64,/);i?o({data:r,type:i[1]}):n(new Error("Could not determine image type"))},s.onerror=n,s.readAsDataURL(a)})}}catch(e){return console.warn(e),null}}}const d=new g;module.exports=d;
|
package/dist/util/ImageUtil.js
CHANGED
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.17",
|
|
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
|
}
|