@kingteza/crud-component 1.0.44 → 1.0.46

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 y=require("react/jsx-runtime"),f=require("antd"),l=require("react"),q=require("../../locale/index.cjs.js");;/* empty css */const d=require("react-router-dom"),x=({className:s,to:t,onClick:n,tooltip:o,ref:g,...r})=>{var u;const{t:e}=q.useTranslationLib();let i;try{i=(u=d.useNavigate)==null?void 0:u.call(d)}catch(a){console.error(a)}const c=l.useMemo(()=>y.jsx(f.Button,{onClick:n||(t&&i?()=>i(t):void 0),className:s,...r,children:r.children||e(`button.${r.type}`)}),[s,i,n,r,e,t]);return o?y.jsx(f.Tooltip,{title:o,children:c}):c},b=({className:s,to:t,onClick:n,tooltip:o,ref:g,...r})=>{let e;try{e=d.useNavigate()}catch(h){console.error(h)}const[i,c]=l.useState(!1),u=l.useCallback(async h=>{try{return c(!0),await n(h)}finally{c(!1)}},[n]),a=l.useMemo(()=>y.jsx(f.Button,{loading:i||r.loading,onClick:n?u:t?()=>{e?e==null||e(t):window.location.href=t}:void 0,className:s,...r}),[u,s,i,e,n,r,t]);return o?y.jsx(f.Tooltip,{title:o,children:a}):a};x.Async=b;module.exports=x;
1
+ "use strict";const f=require("react/jsx-runtime"),h=require("antd"),l=require("react"),q=require("../../locale/index.cjs.js");;/* empty css */const d=require("react-router-dom"),y=({className:i,to:e,onClick:t,tooltip:o,ref:g,...r})=>{var u;const{t:n}=q.useTranslationLib();let s;try{s=(u=d.useNavigate)==null?void 0:u.call(d)}catch(a){console.error(a)}const c=l.useMemo(()=>f.jsx(h.Button,{onClick:t||(e&&s?()=>s(e):void 0),className:i,...r,children:r.children}),[i,s,t,r,n,e]);return o?f.jsx(h.Tooltip,{title:o,children:c}):c},j=({className:i,to:e,onClick:t,tooltip:o,ref:g,...r})=>{let n;try{n=d.useNavigate()}catch(x){console.error(x)}const[s,c]=l.useState(!1),u=l.useCallback(async x=>{try{return c(!0),await t(x)}finally{c(!1)}},[t]),a=l.useMemo(()=>f.jsx(h.Button,{loading:s||r.loading,onClick:t?u:e?()=>{n?n==null||n(e):window.location.href=e}:void 0,className:i,...r}),[u,i,s,n,t,r,e]);return o?f.jsx(h.Tooltip,{title:o,children:a}):a};y.Async=j;module.exports=y;
@@ -1,74 +1,74 @@
1
1
  import { jsx as f } from "react/jsx-runtime";
2
- import { Button as d, Tooltip as m } from "antd";
3
- import { useMemo as y, useState as g, useCallback as v } from "react";
2
+ import { Button as u, Tooltip as m } from "antd";
3
+ import { useMemo as h, useState as b, useCallback as v } from "react";
4
4
  import { useTranslationLib as w } from "../../locale/index.es.js";
5
5
  /* empty css */
6
- import { useNavigate as h } from "react-router-dom";
6
+ import { useNavigate as y } from "react-router-dom";
7
7
  const x = ({
8
8
  className: i,
9
9
  to: r,
10
- onClick: e,
10
+ onClick: t,
11
11
  tooltip: a,
12
- ref: b,
12
+ ref: g,
13
13
  ...n
14
14
  }) => {
15
15
  var l;
16
- const { t } = w();
16
+ const { t: e } = w();
17
17
  let o;
18
18
  try {
19
- o = (l = h) == null ? void 0 : l();
19
+ o = (l = y) == null ? void 0 : l();
20
20
  } catch (s) {
21
21
  console.error(s);
22
22
  }
23
- const c = y(
23
+ const c = h(
24
24
  () => /* @__PURE__ */ f(
25
- d,
25
+ u,
26
26
  {
27
- onClick: e || (r && o ? () => o(r) : void 0),
27
+ onClick: t || (r && o ? () => o(r) : void 0),
28
28
  className: i,
29
29
  ...n,
30
- children: n.children || t(`button.${n.type}`)
30
+ children: n.children
31
31
  }
32
32
  ),
33
- [i, o, e, n, t, r]
33
+ [i, o, t, n, e, r]
34
34
  );
35
35
  return a ? /* @__PURE__ */ f(m, { title: a, children: c }) : c;
36
36
  }, A = ({
37
37
  className: i,
38
38
  to: r,
39
- onClick: e,
39
+ onClick: t,
40
40
  tooltip: a,
41
- ref: b,
41
+ ref: g,
42
42
  ...n
43
43
  }) => {
44
- let t;
44
+ let e;
45
45
  try {
46
- t = h();
47
- } catch (u) {
48
- console.error(u);
46
+ e = y();
47
+ } catch (d) {
48
+ console.error(d);
49
49
  }
50
- const [o, c] = g(!1), l = v(
51
- async (u) => {
50
+ const [o, c] = b(!1), l = v(
51
+ async (d) => {
52
52
  try {
53
- return c(!0), await e(u);
53
+ return c(!0), await t(d);
54
54
  } finally {
55
55
  c(!1);
56
56
  }
57
57
  },
58
- [e]
59
- ), s = y(
58
+ [t]
59
+ ), s = h(
60
60
  () => /* @__PURE__ */ f(
61
- d,
61
+ u,
62
62
  {
63
63
  loading: o || n.loading,
64
- onClick: e ? l : r ? () => {
65
- t ? t == null || t(r) : window.location.href = r;
64
+ onClick: t ? l : r ? () => {
65
+ e ? e == null || e(r) : window.location.href = r;
66
66
  } : void 0,
67
67
  className: i,
68
68
  ...n
69
69
  }
70
70
  ),
71
- [l, i, o, t, e, n, r]
71
+ [l, i, o, e, t, n, r]
72
72
  );
73
73
  return a ? /* @__PURE__ */ f(m, { title: a, children: s }) : s;
74
74
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),v=require("antd"),N=require("react"),_=require("react-highlight-words"),W=require("../locale/index.cjs.js"),G=require("./FileCrudField.cjs.js"),$=require("./ImageCrudField.cjs.js"),z=require("../common/check-box/CheckBox.cjs.js"),J=require("../common/date-picker/DatePicker.cjs.js"),K=require("../common/date-picker/TimePicker.cjs.js"),E=require("../common/select/SelectComponent.cjs.js"),Q=require("../common/text-field/NumberField.cjs.js"),X=require("../common/text-field/TextField.cjs.js"),Y=require("../common/text-field/TextArea.cjs.js"),Z=require("../common/tooltip/TooltipComponent.cjs.js");function V(y){const{label:s,name:u,type:p,required:i,hidden:w,rules:m=[],updatable:h=!0,readonly:S=!1,fieldClassName:f,customFormFieldRender:R,fieldTooltip:b,...t}=y,g=v.Form.useFormInstance();N.useEffect(()=>{if(p==="select"){const{items:l=[],onSearch:o,searchOnType:n}=t;!(l!=null&&l.length)&&!n&&(o==null||o(void 0,g,t==null?void 0:t.updatingValue))}},[g,t,p,t==null?void 0:t.updatingValue]);const{t:q}=W.useTranslationLib();if(S||w)return e.jsx(e.Fragment,{});if(R)return R(g,y);switch(p){case"text":case"email":case"password":{const{onChange:l,placeholder:o}=t;return e.jsx(X.default,{placeholder:o,disabled:!h,rules:m,required:i,onChange:l?n=>l(n,g):void 0,type:p,name:u,tooltip:b,label:s,className:f,autoComplete:"new-password"})}case"number":{const{onChange:l,placeholder:o,allowMinus:n}=t;return e.jsx(Q,{placeholder:o,disabled:!h,moneyField:!!t.formatted,type:p,onChange:l?x=>l(x,g):void 0,rules:m,autoComplete:"false",required:i,tooltip:b,className:f,min:n?null:void 0,name:u,label:s})}case"date":{const{range:l,disableToday:o,disabledFutureDays:n,disabledPastDays:x,onChange:C,placeholder:d,format:j}=t;return e.jsx(J,{placeholder:d,required:i,disabled:!h,type:p,format:j,tooltip:b,range:l,name:u,label:s,onChange:C?F=>C(F,g):void 0,className:f,disableToday:o,disabledFutureDays:n,disabledPastDays:x})}case"time":{const{range:l=!1,disableCurrent:o,disabledFuture:n,disabledPast:x,onChange:C,use12Hours:d,format:j,placeholder:F}=t;return e.jsx(K,{placeholder:F,required:i,format:j,disabled:!h,type:p,tooltip:b,range:l,use12Hours:d,name:u,label:s,onChange:C?r=>C(r,g):void 0,className:f,disableCurrent:o,disabledFuture:n,disabledPast:x})}case"textarea":{const{onChange:l,placeholder:o,rows:n,cols:x}=t;return e.jsx(Y.default,{rules:m,placeholder:o,onChange:l?C=>{var d;return l((d=C==null?void 0:C.target)==null?void 0:d.value,g)}:void 0,tooltip:b,required:i,disabled:!h,name:u,label:s,className:f,rows:n,cols:x})}case"image":return e.jsx($.default,{...t,required:i,name:u,label:s,rules:m,fieldClassName:f,onRemoved:t.onRemoved,onUploading:t.onUploading,provider:t.provider});case"file":return e.jsx(G.default,{...t,required:i,name:u,label:s,rules:m,fieldClassName:f,onRemoved:t.onRemoved,onUploading:t.onUploading,provider:t.provider});case"select":return e.jsx(H,{...t,required:i,name:u,label:s,rules:m,fieldClassName:f,form:g,updatable:h,readonly:S,fieldTooltip:b});case"enum":{const{enum:l,radio:o=!1,translation:n,onChange:x,onSearch:C,multiple:d,tagRender:j}=t,F=Array.isArray(l)?l:Object.keys(l);return o?e.jsx(v.Form.Item,{...t,name:u,required:i,tooltip:b,rules:m,label:s,className:["w-100",f].join(" "),children:e.jsx(v.Radio.Group,{...t,onChange:x?r=>{var T;return x((T=r==null?void 0:r.target)==null?void 0:T.value,g)}:void 0,children:F.map(r=>e.jsx(v.Radio,{disabled:!h,value:r,children:n?q(n[r]):r},r))})}):e.jsx(E,{...t,tagRender:typeof j=="function"?j:j?r=>{const{value:T,label:k}=r,O=j[T];return O?e.jsx(v.Tag,{color:O.color,children:k}):e.jsx(v.Tag,{children:k})}:void 0,onChange:x?r=>x(r,g):void 0,className:["w-100",f].join(" "),name:u,items:F,required:i,tooltip:b,rules:m,label:s,disabled:!h,onSearch:C?r=>C(r,g):void 0,allowClear:!0,maxCount:d?void 0:1,mode:d?"multiple":typeof j=="function"||typeof j=="object"?"tags":void 0,itemBuilder:r=>e.jsx(v.Select.Option,{value:r,children:n?q(n[r]):r},r)})}case"checkbox":{const{onChange:l}=t;return e.jsx(z,{className:f,rules:m,onChange:l?o=>l(o,g):void 0,label:s,tooltip:b,disabled:!h,name:u})}case"color":return e.jsx(U,{...t,type:"color",required:i,name:u,label:s,rules:m,fieldClassName:f,updatable:h,readonly:S,fieldTooltip:b});default:return e.jsx(e.Fragment,{children:`${p} Not Implemented`})}}function H(y){const{items:s=[],loading:u,searchOnType:p,onSearch:i,multiple:w,onChange:m,highlightSearch:h,required:S,fieldClassName:f,rules:R,fieldTooltip:b,updatable:t,label:g,name:q,tagRender:l,updatingValue:o,onSet:n,placeholder:x,allowClear:C=!0}=y,d=y.form,[j,F]=N.useState(""),r=v.Form.useWatch(q,d),[T,k]=N.useState(!0);N.useEffect(()=>{n&&T&&r&&(n==null||n(r,s,d),k(!1))},[T,d,s,q,n,r]),N.useEffect(()=>{r&&k(!0)},[r]);const O=N.useCallback(async a=>{F(a),p&&(i==null||i(a,d,o))},[d,i,p,o]);return e.jsx(E,{...y,maxTagCount:"responsive",maxTagPlaceholder:a=>e.jsxs(Z,{title:e.jsx(e.Fragment,{children:a.map(c=>e.jsxs(e.Fragment,{children:[c.label," ",e.jsx("br",{})]}))}),children:["+",a==null?void 0:a.length]}),placeholder:x,onSelect:a=>{n==null||n(a==null?void 0:a.key,s,d)},onChange:m?a=>{F(""),m(a,d)}:void 0,mode:w?"multiple":void 0,className:["w-100",f].join(" "),name:q,items:s,required:S,tooltip:b,tagRender:l,rules:R,disabled:!t,label:g,allowClear:C,onSearch:O,loading:u,filterOption:h?(a,c)=>{var P,I,L;try{const A=a.toLowerCase().split(/\s+/),D=((typeof(c==null?void 0:c.children)=="string"?c==null?void 0:c.children:(I=(P=c==null?void 0:c.children)==null?void 0:P.props)==null?void 0:I.textToHighlight)??"").toLowerCase(),M=(((L=c==null?void 0:c.value)==null?void 0:L.toString())??"").toLowerCase();return A.every(B=>D.indexOf(B)>=0||M.indexOf(B)>=0)}catch{return!0}}:void 0,itemBuilder:h?a=>{const c=a.value?String(a.value):void 0;return e.jsx(v.Select.Option,{value:a.key,title:c,disabled:a.disabled,children:e.jsx(_,{highlightClassName:"highlight-text",searchWords:(j??"").split(" "),autoEscape:!0,textToHighlight:c??""})},a.key)}:a=>e.jsx(v.Select.Option,{value:a.key,title:a.value,disabled:a.disabled,children:a.value},a.key)})}function U(y){const{required:s,fieldClassName:u,rules:p,fieldTooltip:i,updatable:w,label:m,name:h}=y;return e.jsx(v.Form.Item,{label:m,name:h,required:s,rules:p,tooltip:i,children:e.jsx(v.ColorPicker,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",showText:!0,trigger:"click",className:u,disabled:!w,...y.innerProps})})}exports.ColorCrudFieldComponent=U;exports.SelectCrudFieldComponent=H;exports.default=V;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),j=require("antd"),N=require("react"),_=require("react-highlight-words"),W=require("../locale/index.cjs.js"),G=require("./FileCrudField.cjs.js"),$=require("./ImageCrudField.cjs.js"),z=require("../common/check-box/CheckBox.cjs.js"),J=require("../common/date-picker/DatePicker.cjs.js"),K=require("../common/date-picker/TimePicker.cjs.js"),E=require("../common/select/SelectComponent.cjs.js"),Q=require("../common/text-field/NumberField.cjs.js"),X=require("../common/text-field/TextField.cjs.js"),Y=require("../common/text-field/TextArea.cjs.js"),Z=require("../common/tooltip/TooltipComponent.cjs.js");function V(F){const{label:o,name:c,type:p,required:i,hidden:w,rules:m=[],updatable:h=!0,readonly:S=!1,fieldClassName:f,customFormFieldRender:R,fieldTooltip:b,...t}=F,g=j.Form.useFormInstance();N.useEffect(()=>{if(p==="select"){const{items:l=[],onSearch:s,searchOnType:n}=t;!(l!=null&&l.length)&&!n&&(s==null||s(void 0,g,t==null?void 0:t.updatingValue))}},[g,t,p,t==null?void 0:t.updatingValue]);const{t:q}=W.useTranslationLib();if(S||w)return e.jsx(e.Fragment,{});if(R)return R(g,F);switch(p){case"text":case"email":case"password":{const{onChange:l,placeholder:s}=t;return e.jsx(X.default,{placeholder:s,disabled:!h,rules:m,required:i,onChange:l?n=>l(n,g):void 0,type:p,name:c,tooltip:b,label:o,className:f,autoComplete:"new-password"})}case"number":{const{onChange:l,placeholder:s,allowMinus:n}=t;return e.jsx(Q,{placeholder:s,disabled:!h,moneyField:!!t.formatted,type:p,onChange:l?x=>l(x,g):void 0,rules:m,autoComplete:"false",required:i,tooltip:b,className:f,min:n?null:void 0,name:c,label:o})}case"date":{const{range:l,disableToday:s,disabledFutureDays:n,disabledPastDays:x,onChange:C,placeholder:u,format:v}=t;return e.jsx(J,{placeholder:u,required:i,disabled:!h,type:p,format:v,tooltip:b,range:l,name:c,label:o,onChange:C?y=>C(y,g):void 0,className:f,disableToday:s,disabledFutureDays:n,disabledPastDays:x})}case"time":{const{range:l=!1,disableCurrent:s,disabledFuture:n,disabledPast:x,onChange:C,use12Hours:u,format:v,placeholder:y}=t;return e.jsx(K,{placeholder:y,required:i,format:v,disabled:!h,type:p,tooltip:b,range:l,use12Hours:u,name:c,label:o,onChange:C?r=>C(r,g):void 0,className:f,disableCurrent:s,disabledFuture:n,disabledPast:x})}case"textarea":{const{onChange:l,placeholder:s,rows:n,cols:x}=t;return e.jsx(Y.default,{rules:m,placeholder:s,onChange:l?C=>{var u;return l((u=C==null?void 0:C.target)==null?void 0:u.value,g)}:void 0,tooltip:b,required:i,disabled:!h,name:c,label:o,className:f,rows:n,cols:x})}case"image":return e.jsx($.default,{...t,required:i,name:c,label:o,rules:m,fieldClassName:f,onRemoved:t.onRemoved,onUploading:t.onUploading,provider:t.provider});case"file":return e.jsx(G.default,{...t,required:i,name:c,label:o,rules:m,fieldClassName:f,onRemoved:t.onRemoved,onUploading:t.onUploading,provider:t.provider});case"select":return e.jsx(H,{...t,required:i,name:c,label:o,rules:m,fieldClassName:f,form:g,updatable:h,readonly:S,fieldTooltip:b});case"enum":{const{enum:l,radio:s=!1,translation:n,onChange:x,onSearch:C,multiple:u,tagRender:v}=t,y=Array.isArray(l)?l:Object.keys(l);return s?e.jsx(j.Form.Item,{...t,name:c,required:i,tooltip:b,rules:m,label:o,className:["w-100",f].join(" "),children:e.jsx(j.Radio.Group,{...t,onChange:x?r=>{var T;return x((T=r==null?void 0:r.target)==null?void 0:T.value,g)}:void 0,children:y.map(r=>e.jsx(j.Radio,{disabled:!h,value:r,children:n?q(n[r]):r},r))})}):e.jsx(E,{...t,tagRender:typeof v=="function"?v:v?r=>{const{value:T,label:k}=r,O=v[T];return O?e.jsx(j.Tag,{color:O.color,children:k}):e.jsx(j.Tag,{children:k})}:void 0,onChange:x?r=>x(r,g):void 0,className:["w-100",f].join(" "),name:c,items:y,required:i,tooltip:b,rules:m,label:o,disabled:!h,onSearch:C?r=>C(r,g):void 0,allowClear:!0,mode:u?"multiple":void 0,itemBuilder:r=>e.jsx(j.Select.Option,{value:r,children:n?q(n[r]):r},r)})}case"checkbox":{const{onChange:l}=t;return e.jsx(z,{className:f,rules:m,onChange:l?s=>l(s,g):void 0,label:o,tooltip:b,disabled:!h,name:c})}case"color":return e.jsx(U,{...t,type:"color",required:i,name:c,label:o,rules:m,fieldClassName:f,updatable:h,readonly:S,fieldTooltip:b});default:return e.jsx(e.Fragment,{children:`${p} Not Implemented`})}}function H(F){const{items:o=[],loading:c,searchOnType:p,onSearch:i,multiple:w,onChange:m,highlightSearch:h,required:S,fieldClassName:f,rules:R,fieldTooltip:b,updatable:t,label:g,name:q,tagRender:l,updatingValue:s,onSet:n,placeholder:x,allowClear:C=!0}=F,u=F.form,[v,y]=N.useState(""),r=j.Form.useWatch(q,u),[T,k]=N.useState(!0);N.useEffect(()=>{n&&T&&r&&(n==null||n(r,o,u),k(!1))},[T,u,o,q,n,r]),N.useEffect(()=>{r&&k(!0)},[r]);const O=N.useCallback(async a=>{y(a),p&&(i==null||i(a,u,s))},[u,i,p,s]);return e.jsx(E,{...F,maxTagCount:"responsive",maxTagPlaceholder:a=>e.jsxs(Z,{title:e.jsx(e.Fragment,{children:a.map(d=>e.jsxs(e.Fragment,{children:[d.label," ",e.jsx("br",{})]}))}),children:["+",a==null?void 0:a.length]}),placeholder:x,onSelect:a=>{n==null||n(a==null?void 0:a.key,o,u)},onChange:m?a=>{y(""),m(a,u)}:void 0,mode:w?"multiple":void 0,className:["w-100",f].join(" "),name:q,items:o,required:S,tooltip:b,tagRender:l,rules:R,disabled:!t,label:g,allowClear:C,onSearch:O,loading:c,filterOption:h?(a,d)=>{var P,I,L;try{const A=a.toLowerCase().split(/\s+/),D=((typeof(d==null?void 0:d.children)=="string"?d==null?void 0:d.children:(I=(P=d==null?void 0:d.children)==null?void 0:P.props)==null?void 0:I.textToHighlight)??"").toLowerCase(),M=(((L=d==null?void 0:d.value)==null?void 0:L.toString())??"").toLowerCase();return A.every(B=>D.indexOf(B)>=0||M.indexOf(B)>=0)}catch{return!0}}:void 0,itemBuilder:h?a=>{const d=a.value?String(a.value):void 0;return e.jsx(j.Select.Option,{value:a.key,title:d,disabled:a.disabled,children:e.jsx(_,{highlightClassName:"highlight-text",searchWords:(v??"").split(" "),autoEscape:!0,textToHighlight:d??""})},a.key)}:a=>e.jsx(j.Select.Option,{value:a.key,title:a.value,disabled:a.disabled,children:a.value},a.key)})}function U(F){const{required:o,fieldClassName:c,rules:p,fieldTooltip:i,updatable:w,label:m,name:h}=F;return e.jsx(j.Form.Item,{label:m,name:h,required:o,rules:p,tooltip:i,children:e.jsx(j.ColorPicker,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",showText:!0,trigger:"click",className:c,disabled:!w,...F.innerProps})})}exports.ColorCrudFieldComponent=U;exports.SelectCrudFieldComponent=H;exports.default=V;
@@ -1,5 +1,5 @@
1
- import { jsx as r, Fragment as j, jsxs as D } from "react/jsx-runtime";
2
- import { Form as S, Radio as E, Tag as W, Select as I, ColorPicker as z } from "antd";
1
+ import { jsx as o, Fragment as S, jsxs as D } from "react/jsx-runtime";
2
+ import { Form as j, Radio as E, Tag as W, Select as I, ColorPicker as z } from "antd";
3
3
  import { useEffect as L, useState as G, useCallback as J } from "react";
4
4
  import K from "react-highlight-words";
5
5
  import { useTranslationLib as Q } from "../locale/index.es.js";
@@ -9,25 +9,25 @@ import Z from "../common/check-box/CheckBox.es.js";
9
9
  import V from "../common/date-picker/DatePicker.es.js";
10
10
  import ee from "../common/date-picker/TimePicker.es.js";
11
11
  import M from "../common/select/SelectComponent.es.js";
12
- import te from "../common/text-field/NumberField.es.js";
13
- import oe from "../common/text-field/TextField.es.js";
14
- import re from "../common/text-field/TextArea.es.js";
12
+ import re from "../common/text-field/NumberField.es.js";
13
+ import te from "../common/text-field/TextField.es.js";
14
+ import oe from "../common/text-field/TextArea.es.js";
15
15
  import ae from "../common/tooltip/TooltipComponent.es.js";
16
16
  function Te(x) {
17
17
  const {
18
18
  label: i,
19
- name: m,
19
+ name: c,
20
20
  type: b,
21
21
  required: s,
22
22
  hidden: w,
23
23
  rules: u = [],
24
24
  updatable: h = !0,
25
25
  readonly: k = !1,
26
- fieldClassName: f,
26
+ fieldClassName: g,
27
27
  customFormFieldRender: R,
28
28
  fieldTooltip: v,
29
29
  ...e
30
- } = x, p = S.useFormInstance();
30
+ } = x, p = j.useFormInstance();
31
31
  L(() => {
32
32
  if (b === "select") {
33
33
  const {
@@ -39,7 +39,7 @@ function Te(x) {
39
39
  }
40
40
  }, [p, e, b, e == null ? void 0 : e.updatingValue]);
41
41
  const { t: N } = Q();
42
- if (k || w) return /* @__PURE__ */ r(j, {});
42
+ if (k || w) return /* @__PURE__ */ o(S, {});
43
43
  if (R)
44
44
  return R(p, x);
45
45
  switch (b) {
@@ -47,8 +47,8 @@ function Te(x) {
47
47
  case "email":
48
48
  case "password": {
49
49
  const { onChange: a, placeholder: n } = e;
50
- return /* @__PURE__ */ r(
51
- oe,
50
+ return /* @__PURE__ */ o(
51
+ te,
52
52
  {
53
53
  placeholder: n,
54
54
  disabled: !h,
@@ -56,31 +56,31 @@ function Te(x) {
56
56
  required: s,
57
57
  onChange: a ? (l) => a(l, p) : void 0,
58
58
  type: b,
59
- name: m,
59
+ name: c,
60
60
  tooltip: v,
61
61
  label: i,
62
- className: f,
62
+ className: g,
63
63
  autoComplete: "new-password"
64
64
  }
65
65
  );
66
66
  }
67
67
  case "number": {
68
68
  const { onChange: a, placeholder: n, allowMinus: l } = e;
69
- return /* @__PURE__ */ r(
70
- te,
69
+ return /* @__PURE__ */ o(
70
+ re,
71
71
  {
72
72
  placeholder: n,
73
73
  disabled: !h,
74
74
  moneyField: !!e.formatted,
75
75
  type: b,
76
- onChange: a ? (g) => a(g, p) : void 0,
76
+ onChange: a ? (f) => a(f, p) : void 0,
77
77
  rules: u,
78
78
  autoComplete: "false",
79
79
  required: s,
80
80
  tooltip: v,
81
- className: f,
81
+ className: g,
82
82
  min: l ? null : void 0,
83
- name: m,
83
+ name: c,
84
84
  label: i
85
85
  }
86
86
  );
@@ -90,28 +90,28 @@ function Te(x) {
90
90
  range: a,
91
91
  disableToday: n,
92
92
  disabledFutureDays: l,
93
- disabledPastDays: g,
93
+ disabledPastDays: f,
94
94
  onChange: C,
95
- placeholder: d,
95
+ placeholder: m,
96
96
  format: y
97
97
  } = e;
98
- return /* @__PURE__ */ r(
98
+ return /* @__PURE__ */ o(
99
99
  V,
100
100
  {
101
- placeholder: d,
101
+ placeholder: m,
102
102
  required: s,
103
103
  disabled: !h,
104
104
  type: b,
105
105
  format: y,
106
106
  tooltip: v,
107
107
  range: a,
108
- name: m,
108
+ name: c,
109
109
  label: i,
110
110
  onChange: C ? (T) => C(T, p) : void 0,
111
- className: f,
111
+ className: g,
112
112
  disableToday: n,
113
113
  disabledFutureDays: l,
114
- disabledPastDays: g
114
+ disabledPastDays: f
115
115
  }
116
116
  );
117
117
  }
@@ -120,13 +120,13 @@ function Te(x) {
120
120
  range: a = !1,
121
121
  disableCurrent: n,
122
122
  disabledFuture: l,
123
- disabledPast: g,
123
+ disabledPast: f,
124
124
  onChange: C,
125
- use12Hours: d,
125
+ use12Hours: m,
126
126
  format: y,
127
127
  placeholder: T
128
128
  } = e;
129
- return /* @__PURE__ */ r(
129
+ return /* @__PURE__ */ o(
130
130
  ee,
131
131
  {
132
132
  placeholder: T,
@@ -136,79 +136,79 @@ function Te(x) {
136
136
  type: b,
137
137
  tooltip: v,
138
138
  range: a,
139
- use12Hours: d,
140
- name: m,
139
+ use12Hours: m,
140
+ name: c,
141
141
  label: i,
142
- onChange: C ? (t) => C(t, p) : void 0,
143
- className: f,
142
+ onChange: C ? (r) => C(r, p) : void 0,
143
+ className: g,
144
144
  disableCurrent: n,
145
145
  disabledFuture: l,
146
- disabledPast: g
146
+ disabledPast: f
147
147
  }
148
148
  );
149
149
  }
150
150
  case "textarea": {
151
- const { onChange: a, placeholder: n, rows: l, cols: g } = e;
152
- return /* @__PURE__ */ r(
153
- re,
151
+ const { onChange: a, placeholder: n, rows: l, cols: f } = e;
152
+ return /* @__PURE__ */ o(
153
+ oe,
154
154
  {
155
155
  rules: u,
156
156
  placeholder: n,
157
157
  onChange: a ? (C) => {
158
- var d;
159
- return a((d = C == null ? void 0 : C.target) == null ? void 0 : d.value, p);
158
+ var m;
159
+ return a((m = C == null ? void 0 : C.target) == null ? void 0 : m.value, p);
160
160
  } : void 0,
161
161
  tooltip: v,
162
162
  required: s,
163
163
  disabled: !h,
164
- name: m,
164
+ name: c,
165
165
  label: i,
166
- className: f,
166
+ className: g,
167
167
  rows: l,
168
- cols: g
168
+ cols: f
169
169
  }
170
170
  );
171
171
  }
172
172
  case "image":
173
- return /* @__PURE__ */ r(
173
+ return /* @__PURE__ */ o(
174
174
  Y,
175
175
  {
176
176
  ...e,
177
177
  required: s,
178
- name: m,
178
+ name: c,
179
179
  label: i,
180
180
  rules: u,
181
- fieldClassName: f,
181
+ fieldClassName: g,
182
182
  onRemoved: e.onRemoved,
183
183
  onUploading: e.onUploading,
184
184
  provider: e.provider
185
185
  }
186
186
  );
187
187
  case "file":
188
- return /* @__PURE__ */ r(
188
+ return /* @__PURE__ */ o(
189
189
  X,
190
190
  {
191
191
  ...e,
192
192
  required: s,
193
- name: m,
193
+ name: c,
194
194
  label: i,
195
195
  rules: u,
196
- fieldClassName: f,
196
+ fieldClassName: g,
197
197
  onRemoved: e.onRemoved,
198
198
  onUploading: e.onUploading,
199
199
  provider: e.provider
200
200
  }
201
201
  );
202
202
  case "select":
203
- return /* @__PURE__ */ r(
203
+ return /* @__PURE__ */ o(
204
204
  le,
205
205
  {
206
206
  ...e,
207
207
  required: s,
208
- name: m,
208
+ name: c,
209
209
  label: i,
210
210
  rules: u,
211
- fieldClassName: f,
211
+ fieldClassName: g,
212
212
  form: p,
213
213
  updatable: h,
214
214
  readonly: k,
@@ -220,104 +220,103 @@ function Te(x) {
220
220
  enum: a,
221
221
  radio: n = !1,
222
222
  translation: l,
223
- onChange: g,
223
+ onChange: f,
224
224
  onSearch: C,
225
- multiple: d,
225
+ multiple: m,
226
226
  tagRender: y
227
227
  } = e, T = Array.isArray(a) ? a : Object.keys(a);
228
- return n ? /* @__PURE__ */ r(
229
- S.Item,
228
+ return n ? /* @__PURE__ */ o(
229
+ j.Item,
230
230
  {
231
231
  ...e,
232
- name: m,
232
+ name: c,
233
233
  required: s,
234
234
  tooltip: v,
235
235
  rules: u,
236
236
  label: i,
237
- className: ["w-100", f].join(" "),
238
- children: /* @__PURE__ */ r(
237
+ className: ["w-100", g].join(" "),
238
+ children: /* @__PURE__ */ o(
239
239
  E.Group,
240
240
  {
241
241
  ...e,
242
- onChange: g ? (t) => {
242
+ onChange: f ? (r) => {
243
243
  var F;
244
- return g((F = t == null ? void 0 : t.target) == null ? void 0 : F.value, p);
244
+ return f((F = r == null ? void 0 : r.target) == null ? void 0 : F.value, p);
245
245
  } : void 0,
246
- children: T.map((t) => /* @__PURE__ */ r(E, { disabled: !h, value: t, children: l ? N(l[t]) : t }, t))
246
+ children: T.map((r) => /* @__PURE__ */ o(E, { disabled: !h, value: r, children: l ? N(l[r]) : r }, r))
247
247
  }
248
248
  )
249
249
  }
250
- ) : /* @__PURE__ */ r(
250
+ ) : /* @__PURE__ */ o(
251
251
  M,
252
252
  {
253
253
  ...e,
254
- tagRender: typeof y == "function" ? y : y ? (t) => {
255
- const { value: F, label: O } = t, P = y[F];
256
- return P ? /* @__PURE__ */ r(W, { color: P.color, children: O }) : /* @__PURE__ */ r(W, { children: O });
254
+ tagRender: typeof y == "function" ? y : y ? (r) => {
255
+ const { value: F, label: O } = r, P = y[F];
256
+ return P ? /* @__PURE__ */ o(W, { color: P.color, children: O }) : /* @__PURE__ */ o(W, { children: O });
257
257
  } : void 0,
258
- onChange: g ? (t) => g(t, p) : void 0,
259
- className: ["w-100", f].join(" "),
260
- name: m,
258
+ onChange: f ? (r) => f(r, p) : void 0,
259
+ className: ["w-100", g].join(" "),
260
+ name: c,
261
261
  items: T,
262
262
  required: s,
263
263
  tooltip: v,
264
264
  rules: u,
265
265
  label: i,
266
266
  disabled: !h,
267
- onSearch: C ? (t) => C(t, p) : void 0,
267
+ onSearch: C ? (r) => C(r, p) : void 0,
268
268
  allowClear: !0,
269
- maxCount: d ? void 0 : 1,
270
- mode: d ? "multiple" : typeof y == "function" || typeof y == "object" ? "tags" : void 0,
271
- itemBuilder: (t) => /* @__PURE__ */ r(I.Option, { value: t, children: l ? N(l[t]) : t }, t)
269
+ mode: m ? "multiple" : void 0,
270
+ itemBuilder: (r) => /* @__PURE__ */ o(I.Option, { value: r, children: l ? N(l[r]) : r }, r)
272
271
  }
273
272
  );
274
273
  }
275
274
  case "checkbox": {
276
275
  const { onChange: a } = e;
277
- return /* @__PURE__ */ r(
276
+ return /* @__PURE__ */ o(
278
277
  Z,
279
278
  {
280
- className: f,
279
+ className: g,
281
280
  rules: u,
282
281
  onChange: a ? (n) => a(n, p) : void 0,
283
282
  label: i,
284
283
  tooltip: v,
285
284
  disabled: !h,
286
- name: m
285
+ name: c
287
286
  }
288
287
  );
289
288
  }
290
289
  case "color":
291
- return /* @__PURE__ */ r(
290
+ return /* @__PURE__ */ o(
292
291
  ne,
293
292
  {
294
293
  ...e,
295
294
  type: "color",
296
295
  required: s,
297
- name: m,
296
+ name: c,
298
297
  label: i,
299
298
  rules: u,
300
- fieldClassName: f,
299
+ fieldClassName: g,
301
300
  updatable: h,
302
301
  readonly: k,
303
302
  fieldTooltip: v
304
303
  }
305
304
  );
306
305
  default:
307
- return /* @__PURE__ */ r(j, { children: `${b} Not Implemented` });
306
+ return /* @__PURE__ */ o(S, { children: `${b} Not Implemented` });
308
307
  }
309
308
  }
310
309
  function le(x) {
311
310
  const {
312
311
  items: i = [],
313
- loading: m,
312
+ loading: c,
314
313
  searchOnType: b,
315
314
  onSearch: s,
316
315
  multiple: w,
317
316
  onChange: u,
318
317
  highlightSearch: h,
319
318
  required: k,
320
- fieldClassName: f,
319
+ fieldClassName: g,
321
320
  rules: R,
322
321
  fieldTooltip: v,
323
322
  updatable: e,
@@ -326,48 +325,48 @@ function le(x) {
326
325
  tagRender: a,
327
326
  updatingValue: n,
328
327
  onSet: l,
329
- placeholder: g,
328
+ placeholder: f,
330
329
  allowClear: C = !0
331
- } = x, d = x.form, [y, T] = G(""), t = S.useWatch(N, d), [F, O] = G(!0);
330
+ } = x, m = x.form, [y, T] = G(""), r = j.useWatch(N, m), [F, O] = G(!0);
332
331
  L(() => {
333
- l && F && t && (l == null || l(t, i, d), O(!1));
334
- }, [F, d, i, N, l, t]), L(() => {
335
- t && O(!0);
336
- }, [t]);
332
+ l && F && r && (l == null || l(r, i, m), O(!1));
333
+ }, [F, m, i, N, l, r]), L(() => {
334
+ r && O(!0);
335
+ }, [r]);
337
336
  const P = J(
338
- async (o) => {
339
- T(o), b && (s == null || s(o, d, n));
337
+ async (t) => {
338
+ T(t), b && (s == null || s(t, m, n));
340
339
  },
341
- [d, s, b, n]
340
+ [m, s, b, n]
342
341
  );
343
- return /* @__PURE__ */ r(
342
+ return /* @__PURE__ */ o(
344
343
  M,
345
344
  {
346
345
  ...x,
347
346
  maxTagCount: "responsive",
348
- maxTagPlaceholder: (o) => /* @__PURE__ */ D(
347
+ maxTagPlaceholder: (t) => /* @__PURE__ */ D(
349
348
  ae,
350
349
  {
351
- title: /* @__PURE__ */ r(j, { children: o.map((c) => /* @__PURE__ */ D(j, { children: [
352
- c.label,
350
+ title: /* @__PURE__ */ o(S, { children: t.map((d) => /* @__PURE__ */ D(S, { children: [
351
+ d.label,
353
352
  " ",
354
- /* @__PURE__ */ r("br", {})
353
+ /* @__PURE__ */ o("br", {})
355
354
  ] })) }),
356
355
  children: [
357
356
  "+",
358
- o == null ? void 0 : o.length
357
+ t == null ? void 0 : t.length
359
358
  ]
360
359
  }
361
360
  ),
362
- placeholder: g,
363
- onSelect: (o) => {
364
- l == null || l(o == null ? void 0 : o.key, i, d);
361
+ placeholder: f,
362
+ onSelect: (t) => {
363
+ l == null || l(t == null ? void 0 : t.key, i, m);
365
364
  },
366
- onChange: u ? (o) => {
367
- T(""), u(o, d);
365
+ onChange: u ? (t) => {
366
+ T(""), u(t, m);
368
367
  } : void 0,
369
368
  mode: w ? "multiple" : void 0,
370
- className: ["w-100", f].join(" "),
369
+ className: ["w-100", g].join(" "),
371
370
  name: N,
372
371
  items: i,
373
372
  required: k,
@@ -378,11 +377,11 @@ function le(x) {
378
377
  label: p,
379
378
  allowClear: C,
380
379
  onSearch: P,
381
- loading: m,
382
- filterOption: h ? (o, c) => {
380
+ loading: c,
381
+ filterOption: h ? (t, d) => {
383
382
  var A, B, H;
384
383
  try {
385
- const U = o.toLowerCase().split(/\s+/), _ = ((typeof (c == null ? void 0 : c.children) == "string" ? c == null ? void 0 : c.children : (B = (A = c == null ? void 0 : c.children) == null ? void 0 : A.props) == null ? void 0 : B.textToHighlight) ?? "").toLowerCase(), $ = (((H = c == null ? void 0 : c.value) == null ? void 0 : H.toString()) ?? "").toLowerCase();
384
+ const U = t.toLowerCase().split(/\s+/), _ = ((typeof (d == null ? void 0 : d.children) == "string" ? d == null ? void 0 : d.children : (B = (A = d == null ? void 0 : d.children) == null ? void 0 : A.props) == null ? void 0 : B.textToHighlight) ?? "").toLowerCase(), $ = (((H = d == null ? void 0 : d.value) == null ? void 0 : H.toString()) ?? "").toLowerCase();
386
385
  return U.every(
387
386
  (q) => _.indexOf(q) >= 0 || $.indexOf(q) >= 0
388
387
  );
@@ -390,35 +389,35 @@ function le(x) {
390
389
  return !0;
391
390
  }
392
391
  } : void 0,
393
- itemBuilder: h ? (o) => {
394
- const c = o.value ? String(o.value) : void 0;
395
- return /* @__PURE__ */ r(
392
+ itemBuilder: h ? (t) => {
393
+ const d = t.value ? String(t.value) : void 0;
394
+ return /* @__PURE__ */ o(
396
395
  I.Option,
397
396
  {
398
- value: o.key,
399
- title: c,
400
- disabled: o.disabled,
401
- children: /* @__PURE__ */ r(
397
+ value: t.key,
398
+ title: d,
399
+ disabled: t.disabled,
400
+ children: /* @__PURE__ */ o(
402
401
  K,
403
402
  {
404
403
  highlightClassName: "highlight-text",
405
404
  searchWords: (y ?? "").split(" "),
406
405
  autoEscape: !0,
407
- textToHighlight: c ?? ""
406
+ textToHighlight: d ?? ""
408
407
  }
409
408
  )
410
409
  },
411
- o.key
410
+ t.key
412
411
  );
413
- } : (o) => /* @__PURE__ */ r(
412
+ } : (t) => /* @__PURE__ */ o(
414
413
  I.Option,
415
414
  {
416
- value: o.key,
417
- title: o.value,
418
- disabled: o.disabled,
419
- children: o.value
415
+ value: t.key,
416
+ title: t.value,
417
+ disabled: t.disabled,
418
+ children: t.value
420
419
  },
421
- o.key
420
+ t.key
422
421
  )
423
422
  }
424
423
  );
@@ -426,22 +425,22 @@ function le(x) {
426
425
  function ne(x) {
427
426
  const {
428
427
  required: i,
429
- fieldClassName: m,
428
+ fieldClassName: c,
430
429
  rules: b,
431
430
  fieldTooltip: s,
432
431
  updatable: w,
433
432
  label: u,
434
433
  name: h
435
434
  } = x;
436
- return /* @__PURE__ */ r(
437
- S.Item,
435
+ return /* @__PURE__ */ o(
436
+ j.Item,
438
437
  {
439
438
  label: u,
440
439
  name: h,
441
440
  required: i,
442
441
  rules: b,
443
442
  tooltip: s,
444
- children: /* @__PURE__ */ r(
443
+ children: /* @__PURE__ */ o(
445
444
  z,
446
445
  {
447
446
  disabledAlpha: !0,
@@ -449,7 +448,7 @@ function ne(x) {
449
448
  defaultFormat: "hex",
450
449
  showText: !0,
451
450
  trigger: "click",
452
- className: m,
451
+ className: c,
453
452
  disabled: !w,
454
453
  ...x.innerProps
455
454
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.0.44",
4
+ "version": "1.0.46",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",
@@ -86,7 +86,7 @@
86
86
  "@types/react-show-more-text": "^1.4.5",
87
87
  "@types/uuid": "^10.0.0",
88
88
  "@vitejs/plugin-react": "^4.3.4",
89
- "antd": "^5.22.6",
89
+ "antd": "^5.22.7",
90
90
  "eslint": "^9.17.0",
91
91
  "eslint-plugin-react-hooks": "^5.0.0",
92
92
  "eslint-plugin-react-refresh": "^0.4.16",