@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.
@@ -1 +1 @@
1
- "use strict";const d=require("react/jsx-runtime"),s=require("antd"),t=require("dayjs"),E=require("../../../_virtual/advancedFormat.cjs"),F=require("../../../_virtual/customParseFormat.cjs"),I=require("../../../_virtual/localeData.cjs"),v=require("../../../_virtual/weekday.cjs"),S=require("../../../_virtual/weekOfYear.cjs"),T=require("../../../_virtual/weekYear.cjs"),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
+ "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 "../../../_virtual/advancedFormat.js";
5
- import R from "../../../_virtual/customParseFormat.js";
6
- import S from "../../../_virtual/localeData.js";
7
- import T from "../../../_virtual/weekday.js";
8
- import Y from "../../../_virtual/weekOfYear.js";
9
- import $ from "../../../_virtual/weekYear.js";
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 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
  };
@@ -1 +1 @@
1
- "use strict";const c=require("../node_modules/browser-image-compression/dist/browser-image-compression.cjs");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 r=await new Promise(n=>{a.onload=function(){n({height:a.height,width:a.width})}});return Object.assign(e,r),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((r,n)=>{const s=new FileReader;s.onloadend=function(){const o=s.result,i=o.match(/^data:image\/(png|jpeg|jpg);base64,/);i?r({data:o,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;
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;
@@ -1,4 +1,4 @@
1
- import c from "../node_modules/browser-image-compression/dist/browser-image-compression.js";
1
+ import c from "browser-image-compression";
2
2
  class g {
3
3
  async resizeImage(t) {
4
4
  const e = await c(t, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.0.15",
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
  }