@kingteza/crud-component 1.6.1 → 1.6.3

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 a=require("react/jsx-runtime"),n=require("antd"),E=require("dayjs"),f=require("react"),H=require("../../locale/index.cjs.js"),I=({type:L,required:l,label:i,rules:q=[],placeholder:s,disabledPast:r=!1,disableCurrent:m=!1,onEnter:M,disabled:x,use12Hours:k,nextFocus:N,onChange:o,range:c,disabledFuture:u,defaultValue:T,value:j,format:p,autoComplete:S="off",renderExtraFooter:d,...y})=>{const{t:P}=H.useTranslationLib(),R=f.useMemo(()=>s||(c?["From","To"]:"Select time"),[s,c]),F=c?n.TimePicker.RangePicker:n.TimePicker,$=f.useCallback(e=>{if(!e)return!1;const t=E(),v=r&&e<t,w=u&&e>t,D=m&&e<t&&t<e;return v||w||D},[m,u,r]);return a.jsx(n.Form.Item,{...y,label:i,rules:[{required:l,message:`${i??s??""} ${P("err.validation.required")}`},...q],children:a.jsx(F,{use12Hours:k,renderExtraFooter:d,value:j,defaultValue:T,format:p,onChange:e=>o==null?void 0:o(e),disabledDate:$,disabled:x,className:"w-100",placeholder:R})})};module.exports=I;
1
+ "use strict";const a=require("react/jsx-runtime"),i=require("antd"),E=require("dayjs"),f=require("react"),H=require("../../locale/index.cjs.js"),I=({type:L,required:q,label:o,rules:x=[],placeholder:s,disabledPast:r=!1,disableCurrent:m=!1,onEnter:M,disabled:k,use12Hours:T,nextFocus:N,onChange:c,range:n,disabledFuture:u,defaultValue:j,value:p,format:y,autoComplete:S="off",renderExtraFooter:P,...R})=>{const{t:d}=H.useTranslationLib(),l=f.useMemo(()=>s||(n?["From","To"]:"Select time"),[s,n]),F=n?i.TimePicker.RangePicker:i.TimePicker,$=f.useCallback(e=>{if(!e)return!1;const t=E(),v=r&&e<t,w=u&&e>t,D=m&&e<t&&t<e;return v||w||D},[m,u,r]);return a.jsx(i.Form.Item,{...R,label:o,rules:[{required:q,message:`${o||s||""} ${d("err.validation.required")}`},...x],children:a.jsx(F,{use12Hours:T,renderExtraFooter:P,value:p,defaultValue:j,format:y,onChange:e=>c==null?void 0:c(e),disabledDate:$,disabled:k,className:"w-100",placeholder:l})})};module.exports=I;
@@ -1,38 +1,38 @@
1
1
  import { jsx as f } from "react/jsx-runtime";
2
- import { TimePicker as a, Form as E } from "antd";
2
+ import { TimePicker as p, Form as E } from "antd";
3
3
  import H from "dayjs";
4
4
  import { useMemo as I, useCallback as L } from "react";
5
5
  import { useTranslationLib as M } from "../../locale/index.es.js";
6
6
  const K = ({
7
7
  type: N,
8
- required: p,
9
- label: i,
10
- rules: l = [],
8
+ required: a,
9
+ label: s,
10
+ rules: k = [],
11
11
  placeholder: t,
12
12
  disabledPast: r = !1,
13
13
  disableCurrent: c = !1,
14
14
  onEnter: R,
15
- disabled: k,
16
- use12Hours: u,
15
+ disabled: u,
16
+ use12Hours: T,
17
17
  nextFocus: S,
18
- onChange: m,
19
- range: s,
18
+ onChange: e,
19
+ range: i,
20
20
  disabledFuture: n,
21
- defaultValue: T,
21
+ defaultValue: l,
22
22
  value: x,
23
23
  format: y,
24
24
  autoComplete: z = "off",
25
- renderExtraFooter: d,
26
- ...j
25
+ renderExtraFooter: j,
26
+ ...F
27
27
  }) => {
28
- const { t: F } = M(), P = I(
29
- () => t || (s ? ["From", "To"] : "Select time"),
30
- [t, s]
31
- ), $ = s ? a.RangePicker : a, q = L(
28
+ const { t: P } = M(), $ = I(
29
+ () => t || (i ? ["From", "To"] : "Select time"),
30
+ [t, i]
31
+ ), d = i ? p.RangePicker : p, q = L(
32
32
  (o) => {
33
33
  if (!o)
34
34
  return !1;
35
- const e = H(), v = r && o < e, w = n && o > e, D = c && o < e && e < o;
35
+ const m = H(), v = r && o < m, w = n && o > m, D = c && o < m && m < o;
36
36
  return v || w || D;
37
37
  },
38
38
  [c, n, r]
@@ -41,30 +41,30 @@ const K = ({
41
41
  return /* @__PURE__ */ f(
42
42
  E.Item,
43
43
  {
44
- ...j,
45
- label: i,
44
+ ...F,
45
+ label: s,
46
46
  rules: [
47
47
  {
48
- required: p,
49
- message: `${i ?? t ?? ""} ${F(
48
+ required: a,
49
+ message: `${s || t || ""} ${P(
50
50
  "err.validation.required"
51
51
  )}`
52
52
  },
53
- ...l
53
+ ...k
54
54
  ],
55
55
  children: /* @__PURE__ */ f(
56
- $,
56
+ d,
57
57
  {
58
- use12Hours: u,
59
- renderExtraFooter: d,
58
+ use12Hours: T,
59
+ renderExtraFooter: j,
60
60
  value: x,
61
- defaultValue: T,
61
+ defaultValue: l,
62
62
  format: y,
63
- onChange: (o) => m == null ? void 0 : m(o),
63
+ onChange: (o) => e == null ? void 0 : e(o),
64
64
  disabledDate: q,
65
- disabled: k,
65
+ disabled: u,
66
66
  className: "w-100",
67
- placeholder: P
67
+ placeholder: $
68
68
  }
69
69
  )
70
70
  }
@@ -1 +1 @@
1
- "use strict";const r=require("react/jsx-runtime"),l=require("antd"),V=require("react"),B=require("../../locale/index.cjs.js"),D=require("../tooltip/TooltipComponent.cjs.js"),E=require("../../util/ValidationUtil.cjs.js");function P({label:a,rules:S=[],required:x,placeholder:h,notSearch:L,children:f,readOnly:s,items:o,dropdownRender:p,itemBuilder:q,loading:m,showLoadingInEmptyIndicator:T,nameFieldInArray:u="name",innerRef:_,tooltip:b,filterOption:N,tagRender:R,help:k,...n}){const{t:U}=B.useTranslationLib(),F=V.useCallback(e=>{const t=typeof e=="string"||typeof e=="number"?e:e==null?void 0:e.id,c=typeof e=="string"||typeof e=="number"?e:e==null?void 0:e[u];return r.jsx("option",{value:t,children:r.jsx("div",{dangerouslySetInnerHTML:{__html:c}})},t)},[u]),H=a??h??"";return r.jsx(l.ConfigProvider,{renderEmpty:T&&m?()=>r.jsx(l.Spin,{}):void 0,children:r.jsx(D,{title:b,children:r.jsx(l.Form.Item,{label:a,name:n.name,help:k,className:n.className,required:x,rules:[...S,...x?E.required(H):[]],children:r.jsx(l.Select,{ref:_,loading:m,open:s?!1:void 0,onChange:!s&&n.onChange,allowClear:!s&&n.allowClear,showSearch:!L,className:`max-width ${s?"readOnly":""}`,...n,tagRender:R,placeholder:h??a,filterOption:N??((e,t)=>{var c,g,C,j;try{const i=(C=(g=(c=t==null?void 0:t.children)==null?void 0:c.props)==null?void 0:g.dangerouslySetInnerHTML)==null?void 0:C.__html,I=e.toLowerCase().split(/\s+/),y=(t==null?void 0:t.children)??"",w=typeof y=="string"?y.toLowerCase():typeof i=="string"?i.toLowerCase():"",M=(((j=t==null?void 0:t.value)==null?void 0:j.toString())??"").toLowerCase(),O=w.replace(/\s/g,"");return I.every(d=>w.indexOf(d)>=0||M.indexOf(d)>=0||O.indexOf(d)>=0)}catch(i){return console.log(i),!0}}),popupRender:p,children:f===null?void 0:f??(o?o==null?void 0:o.map(q??F):r.jsx(r.Fragment,{}))})})})})}module.exports=P;
1
+ "use strict";const n=require("react/jsx-runtime"),x=require("antd"),V=require("react"),B=require("../../locale/index.cjs.js"),D=require("../tooltip/TooltipComponent.cjs.js"),E=require("../../util/ValidationUtil.cjs.js");function P({label:s,rules:S=[],required:f,placeholder:o,notSearch:L,children:m,readOnly:c,items:i,dropdownRender:q,itemBuilder:T,loading:h,showLoadingInEmptyIndicator:_,nameFieldInArray:u="name",innerRef:p,tooltip:N,filterOption:R,tagRender:b,help:k,...r}){const{t:U}=B.useTranslationLib(),F=V.useCallback(e=>{const t=typeof e=="string"||typeof e=="number"?e:e==null?void 0:e.id,d=typeof e=="string"||typeof e=="number"?e:e==null?void 0:e[u];return n.jsx("option",{value:t,children:n.jsx("div",{dangerouslySetInnerHTML:{__html:d}})},t)},[u]),H=s||o||"";return n.jsx(x.ConfigProvider,{renderEmpty:_&&h?()=>n.jsx(x.Spin,{}):void 0,children:n.jsx(D,{title:N,children:n.jsx(x.Form.Item,{label:s,name:r.name,help:k,className:r.className,required:f,rules:[...S,...f?E.required(H):[]],children:n.jsx(x.Select,{ref:p,loading:h,open:c?!1:void 0,onChange:!c&&r.onChange,allowClear:!c&&r.allowClear,showSearch:!L,className:`max-width ${c?"readOnly":""}`,...r,tagRender:b,placeholder:o||s,filterOption:R??((e,t)=>{var d,g,C,j;try{const a=(C=(g=(d=t==null?void 0:t.children)==null?void 0:d.props)==null?void 0:g.dangerouslySetInnerHTML)==null?void 0:C.__html,I=e.toLowerCase().split(/\s+/),y=(t==null?void 0:t.children)??"",w=typeof y=="string"?y.toLowerCase():typeof a=="string"?a.toLowerCase():"",M=(((j=t==null?void 0:t.value)==null?void 0:j.toString())??"").toLowerCase(),O=w.replace(/\s/g,"");return I.every(l=>w.indexOf(l)>=0||M.indexOf(l)>=0||O.indexOf(l)>=0)}catch(a){return console.log(a),!0}}),popupRender:q,children:m===null?void 0:m??(i?i==null?void 0:i.map(T??F):n.jsx(n.Fragment,{}))})})})})}module.exports=P;
@@ -1,79 +1,79 @@
1
- import { jsx as t, Fragment as B } from "react/jsx-runtime";
1
+ import { jsx as r, Fragment as B } from "react/jsx-runtime";
2
2
  import { ConfigProvider as D, Form as E, Select as P, Spin as R } from "antd";
3
3
  import { useCallback as U } from "react";
4
4
  import { useTranslationLib as W } from "../../locale/index.es.js";
5
5
  import $ from "../tooltip/TooltipComponent.es.js";
6
6
  import q from "../../util/ValidationUtil.es.js";
7
7
  function Z({
8
- label: m,
8
+ label: o,
9
9
  rules: S = [],
10
- required: f,
11
- placeholder: a,
10
+ required: d,
11
+ placeholder: s,
12
12
  notSearch: L,
13
- children: d,
14
- readOnly: o,
15
- items: s,
13
+ children: l,
14
+ readOnly: c,
15
+ items: i,
16
16
  dropdownRender: u,
17
17
  itemBuilder: T,
18
18
  loading: h,
19
19
  showLoadingInEmptyIndicator: _,
20
20
  nameFieldInArray: g = "name",
21
- innerRef: b,
22
- tooltip: N,
21
+ innerRef: N,
22
+ tooltip: b,
23
23
  filterOption: k,
24
24
  tagRender: F,
25
25
  help: H,
26
26
  ...n
27
27
  }) {
28
28
  const { t: z } = W(), I = U(
29
- (e) => {
30
- const r = typeof e == "string" || typeof e == "number" ? e : e == null ? void 0 : e.id, c = typeof e == "string" || typeof e == "number" ? e : e == null ? void 0 : e[g];
31
- return /* @__PURE__ */ t("option", { value: r, children: /* @__PURE__ */ t("div", { dangerouslySetInnerHTML: { __html: c } }) }, r);
29
+ (t) => {
30
+ const e = typeof t == "string" || typeof t == "number" ? t : t == null ? void 0 : t.id, m = typeof t == "string" || typeof t == "number" ? t : t == null ? void 0 : t[g];
31
+ return /* @__PURE__ */ r("option", { value: e, children: /* @__PURE__ */ r("div", { dangerouslySetInnerHTML: { __html: m } }) }, e);
32
32
  },
33
33
  [g]
34
- ), M = m ?? a ?? "";
35
- return /* @__PURE__ */ t(
34
+ ), M = o || s || "";
35
+ return /* @__PURE__ */ r(
36
36
  D,
37
37
  {
38
- renderEmpty: _ && h ? () => /* @__PURE__ */ t(R, {}) : void 0,
39
- children: /* @__PURE__ */ t($, { title: N, children: /* @__PURE__ */ t(
38
+ renderEmpty: _ && h ? () => /* @__PURE__ */ r(R, {}) : void 0,
39
+ children: /* @__PURE__ */ r($, { title: b, children: /* @__PURE__ */ r(
40
40
  E.Item,
41
41
  {
42
- label: m,
42
+ label: o,
43
43
  name: n.name,
44
44
  help: H,
45
45
  className: n.className,
46
- required: f,
46
+ required: d,
47
47
  rules: [
48
48
  ...S,
49
- ...f ? q.required(M) : []
49
+ ...d ? q.required(M) : []
50
50
  ],
51
- children: /* @__PURE__ */ t(
51
+ children: /* @__PURE__ */ r(
52
52
  P,
53
53
  {
54
- ref: b,
54
+ ref: N,
55
55
  loading: h,
56
- open: o ? !1 : void 0,
57
- onChange: !o && n.onChange,
58
- allowClear: !o && n.allowClear,
56
+ open: c ? !1 : void 0,
57
+ onChange: !c && n.onChange,
58
+ allowClear: !c && n.allowClear,
59
59
  showSearch: !L,
60
- className: `max-width ${o ? "readOnly" : ""}`,
60
+ className: `max-width ${c ? "readOnly" : ""}`,
61
61
  ...n,
62
62
  tagRender: F,
63
- placeholder: a ?? m,
64
- filterOption: k ?? ((e, r) => {
65
- var c, p, C, y;
63
+ placeholder: s || o,
64
+ filterOption: k ?? ((t, e) => {
65
+ var m, C, p, y;
66
66
  try {
67
- const i = (C = (p = (c = r == null ? void 0 : r.children) == null ? void 0 : c.props) == null ? void 0 : p.dangerouslySetInnerHTML) == null ? void 0 : C.__html, O = e.toLowerCase().split(/\s+/), w = (r == null ? void 0 : r.children) ?? "", x = typeof w == "string" ? w.toLowerCase() : typeof i == "string" ? i.toLowerCase() : "", V = (((y = r == null ? void 0 : r.value) == null ? void 0 : y.toString()) ?? "").toLowerCase(), j = x.replace(/\s/g, "");
67
+ const f = (p = (C = (m = e == null ? void 0 : e.children) == null ? void 0 : m.props) == null ? void 0 : C.dangerouslySetInnerHTML) == null ? void 0 : p.__html, O = t.toLowerCase().split(/\s+/), w = (e == null ? void 0 : e.children) ?? "", x = typeof w == "string" ? w.toLowerCase() : typeof f == "string" ? f.toLowerCase() : "", V = (((y = e == null ? void 0 : e.value) == null ? void 0 : y.toString()) ?? "").toLowerCase(), j = x.replace(/\s/g, "");
68
68
  return O.every(
69
- (l) => x.indexOf(l) >= 0 || V.indexOf(l) >= 0 || j.indexOf(l) >= 0
69
+ (a) => x.indexOf(a) >= 0 || V.indexOf(a) >= 0 || j.indexOf(a) >= 0
70
70
  );
71
- } catch (i) {
72
- return console.log(i), !0;
71
+ } catch (f) {
72
+ return console.log(f), !0;
73
73
  }
74
74
  }),
75
75
  popupRender: u,
76
- children: d === null ? void 0 : d ?? (s ? s == null ? void 0 : s.map(T ?? I) : /* @__PURE__ */ t(B, {}))
76
+ children: l === null ? void 0 : l ?? (i ? i == null ? void 0 : i.map(T ?? I) : /* @__PURE__ */ r(B, {}))
77
77
  }
78
78
  )
79
79
  }
@@ -1 +1 @@
1
- "use strict";const i=require("react/jsx-runtime"),m=require("antd"),x=require("react"),M=require("../../locale/index.cjs.js"),P=require("../tooltip/TooltipComponent.cjs.js"),b=require("./TextField.cjs.js"),k=x.forwardRef(function({type:y,required:o,label:t,rules:c=[],placeholder:r,onEnter:a,form:f,nextFocus:q,min:d,moneyField:n,addonAfter:j,minLength:T,defaultValue:$,pattern:g,disabled:I,readOnly:N,onChange:R,value:h,max:w,addonBefore:B,size:E,isInt:u=!1,tooltip:F,help:z,...l},C){const{t:p}=M.useTranslationLib(),L=x.useMemo(()=>[...c,{required:o,message:`${t||r||""} ${p("err.validation.required")}`}],[c,t,r,p,o]);return i.jsx(P,{title:F,children:i.jsx(m.Form.Item,{...l,label:t,rules:L,children:i.jsx(m.InputNumber,{ref:C,disabled:I,defaultValue:$,value:h,readOnly:N,addonBefore:B,minLength:T,addonAfter:j,step:u?1:void 0,pattern:u?"d*":g,onChange:R,onPressEnter:e=>b.onEnterInternalTextField(e,q,f,a),className:"max-width",min:d===null?void 0:d??0,max:w,type:n?void 0:"number",size:E,formatter:n?e=>{if(e.includes(".")){const s=`${e}`.split(".");return s[0]=s[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),s.join(".")}else return`${e}`.replace(/\B(?=(\d{3})+(?!\d))/g,",")}:void 0,parser:n?e=>e==null?void 0:e.replace(/\$\s?|(,*)/g,""):void 0,placeholder:r??t})})})});module.exports=k;
1
+ "use strict";const i=require("react/jsx-runtime"),m=require("antd"),x=require("react"),P=require("../../locale/index.cjs.js"),b=require("../tooltip/TooltipComponent.cjs.js"),k=require("./TextField.cjs.js"),v=x.forwardRef(function({type:z,required:o,label:e,rules:c=[],placeholder:r,onEnter:a,form:f,nextFocus:q,min:d,moneyField:n,addonAfter:j,minLength:T,defaultValue:$,pattern:g,disabled:I,readOnly:N,onChange:R,value:w,max:B,addonBefore:E,size:F,isInt:u=!1,tooltip:h,help:A,...C},L){const{t:p}=P.useTranslationLib(),M=x.useMemo(()=>[...c,{required:o,message:`${e||r||""} ${p("err.validation.required")}`}],[c,e,r,p,o]);return i.jsx(b,{title:h,children:i.jsx(m.Form.Item,{...C,label:e,rules:M,children:i.jsx(m.InputNumber,{ref:L,disabled:I,defaultValue:$,value:w,readOnly:N,addonBefore:E,minLength:T,addonAfter:j,step:u?1:void 0,pattern:u?"d*":g,onChange:R,onPressEnter:t=>k.onEnterInternalTextField(t,q,f,a),className:"max-width",min:d===null?void 0:d??0,max:B,type:n?void 0:"number",size:F,formatter:n?t=>{if(t.includes(".")){const s=`${t}`.split(".");return s[0]=s[0].replace(/\B(?=(\d{3})+(?!\d))/g,","),s.join(".")}else return`${t}`.replace(/\B(?=(\d{3})+(?!\d))/g,",")}:void 0,parser:n?t=>t==null?void 0:t.replace(/\$\s?|(,*)/g,""):void 0,placeholder:r||e})})})});module.exports=v;
@@ -1,20 +1,20 @@
1
1
  import { jsx as i } from "react/jsx-runtime";
2
- import { Form as M, InputNumber as P } from "antd";
3
- import { forwardRef as R, useMemo as b } from "react";
4
- import { useTranslationLib as k } from "../../locale/index.es.js";
5
- import q from "../tooltip/TooltipComponent.es.js";
6
- import { onEnterInternalTextField as v } from "./TextField.es.js";
7
- const Q = R(
2
+ import { Form as P, InputNumber as R } from "antd";
3
+ import { forwardRef as b, useMemo as k } from "react";
4
+ import { useTranslationLib as q } from "../../locale/index.es.js";
5
+ import v from "../tooltip/TooltipComponent.es.js";
6
+ import { onEnterInternalTextField as y } from "./TextField.es.js";
7
+ const S = b(
8
8
  function({
9
9
  // eslint-disable-next-line no-unused-vars
10
- type: z,
10
+ type: A,
11
11
  required: s,
12
12
  label: t,
13
13
  rules: m = [],
14
14
  placeholder: o,
15
15
  onEnter: c,
16
- form: a,
17
- nextFocus: u,
16
+ form: u,
17
+ nextFocus: a,
18
18
  min: p,
19
19
  moneyField: e,
20
20
  addonAfter: x,
@@ -23,17 +23,17 @@ const Q = R(
23
23
  pattern: T,
24
24
  disabled: I,
25
25
  readOnly: N,
26
- onChange: h,
27
- value: j,
28
- max: w,
29
- addonBefore: B,
30
- size: E,
26
+ onChange: j,
27
+ value: w,
28
+ max: B,
29
+ addonBefore: E,
30
+ size: h,
31
31
  isInt: d = !1,
32
- tooltip: l,
33
- help: A,
34
- ...C
35
- }, F) {
36
- const { t: f } = k(), L = b(
32
+ tooltip: C,
33
+ help: D,
34
+ ...F
35
+ }, L) {
36
+ const { t: f } = q(), M = k(
37
37
  () => [
38
38
  ...m,
39
39
  {
@@ -45,26 +45,26 @@ const Q = R(
45
45
  ],
46
46
  [m, t, o, f, s]
47
47
  );
48
- return /* @__PURE__ */ i(q, { title: l, children: /* @__PURE__ */ i(M.Item, { ...C, label: t, rules: L, children: /* @__PURE__ */ i(
49
- P,
48
+ return /* @__PURE__ */ i(v, { title: C, children: /* @__PURE__ */ i(P.Item, { ...F, label: t, rules: M, children: /* @__PURE__ */ i(
49
+ R,
50
50
  {
51
- ref: F,
51
+ ref: L,
52
52
  disabled: I,
53
53
  defaultValue: g,
54
- value: j,
54
+ value: w,
55
55
  readOnly: N,
56
- addonBefore: B,
56
+ addonBefore: E,
57
57
  minLength: $,
58
58
  addonAfter: x,
59
59
  step: d ? 1 : void 0,
60
60
  pattern: d ? "d*" : T,
61
- onChange: h,
62
- onPressEnter: (r) => v(r, u, a, c),
61
+ onChange: j,
62
+ onPressEnter: (r) => y(r, a, u, c),
63
63
  className: "max-width",
64
64
  min: p === null ? void 0 : p ?? 0,
65
- max: w,
65
+ max: B,
66
66
  type: e ? void 0 : "number",
67
- size: E,
67
+ size: h,
68
68
  formatter: e ? (r) => {
69
69
  if (r.includes(".")) {
70
70
  const n = `${r}`.split(".");
@@ -73,11 +73,11 @@ const Q = R(
73
73
  return `${r}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
74
74
  } : void 0,
75
75
  parser: e ? (r) => r == null ? void 0 : r.replace(/\$\s?|(,*)/g, "") : void 0,
76
- placeholder: o ?? t
76
+ placeholder: o || t
77
77
  }
78
78
  ) }) });
79
79
  }
80
80
  );
81
81
  export {
82
- Q as default
82
+ S as default
83
83
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),i=require("antd"),T=require("../../locale/index.cjs.js"),d=(n,e,t,r)=>{var s;e&&t&&(n.preventDefault(),(s=t==null?void 0:t.getFieldInstance(e))==null||s.focus()),r&&r(n)},F=({required:n,label:e,rules:t=[],placeholder:r,onEnter:s,nextFocus:l,className:u,...o})=>{const{t:c}=T.useTranslationLib(),x=i.Form.useFormInstance();return a.jsx(i.Form.Item,{...o,className:u,label:e,rules:[...t,{required:n,message:`${e} ${c("err.validation.required")}`}],children:a.jsx(i.Input.TextArea,{...o,className:u,onPressEnter:I=>d(I,l,x,s),placeholder:r??e})})};exports.default=F;exports.onEnterInternalTextField=d;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),i=require("antd"),T=require("../../locale/index.cjs.js"),d=(r,e,t,n)=>{var s;e&&t&&(r.preventDefault(),(s=t==null?void 0:t.getFieldInstance(e))==null||s.focus()),n&&n(r)},F=({required:r,label:e,rules:t=[],placeholder:n,onEnter:s,nextFocus:c,className:u,...o})=>{const{t:l}=T.useTranslationLib(),x=i.Form.useFormInstance();return a.jsx(i.Form.Item,{...o,className:u,label:e,rules:[...t,{required:r,message:`${e} ${l("err.validation.required")}`}],children:a.jsx(i.Input.TextArea,{...o,className:u,onPressEnter:I=>d(I,c,x,s),placeholder:n||e})})};exports.default=F;exports.onEnterInternalTextField=d;
@@ -1,40 +1,40 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
- import { Form as u, Input as p } from "antd";
3
- import { useTranslationLib as I } from "../../locale/index.es.js";
4
- const f = (n, e, t, r) => {
5
- var o;
6
- e && t && (n.preventDefault(), (o = t == null ? void 0 : t.getFieldInstance(e)) == null || o.focus()), r && r(n);
2
+ import { Form as u, Input as I } from "antd";
3
+ import { useTranslationLib as f } from "../../locale/index.es.js";
4
+ const l = (r, e, t, n) => {
5
+ var i;
6
+ e && t && (r.preventDefault(), (i = t == null ? void 0 : t.getFieldInstance(e)) == null || i.focus()), n && n(r);
7
7
  }, g = ({
8
- required: n,
8
+ required: r,
9
9
  label: e,
10
10
  rules: t = [],
11
- placeholder: r,
12
- onEnter: o,
11
+ placeholder: n,
12
+ onEnter: i,
13
13
  nextFocus: c,
14
- className: i,
14
+ className: o,
15
15
  ...s
16
16
  }) => {
17
- const { t: d } = I(), l = u.useFormInstance();
17
+ const { t: d } = f(), m = u.useFormInstance();
18
18
  return /* @__PURE__ */ a(
19
19
  u.Item,
20
20
  {
21
21
  ...s,
22
- className: i,
22
+ className: o,
23
23
  label: e,
24
24
  rules: [
25
25
  ...t,
26
26
  {
27
- required: n,
27
+ required: r,
28
28
  message: `${e} ${d("err.validation.required")}`
29
29
  }
30
30
  ],
31
31
  children: /* @__PURE__ */ a(
32
- p.TextArea,
32
+ I.TextArea,
33
33
  {
34
34
  ...s,
35
- className: i,
36
- onPressEnter: (m) => f(m, c, l, o),
37
- placeholder: r ?? e
35
+ className: o,
36
+ onPressEnter: (p) => l(p, c, m, i),
37
+ placeholder: n || e
38
38
  }
39
39
  )
40
40
  }
@@ -42,5 +42,5 @@ const f = (n, e, t, r) => {
42
42
  };
43
43
  export {
44
44
  g as default,
45
- f as onEnterInternalTextField
45
+ l as onEnterInternalTextField
46
46
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),R=require("@ant-design/icons"),d=require("antd"),S=require("react"),_=require("../../locale/index.cjs.js"),$=require("../tooltip/TooltipComponent.cjs.js"),c=(n,t,e,i)=>{var s;t&&e&&(n.preventDefault(),(s=e==null?void 0:e.getFieldInstance(t))==null||s.focus()),i&&i(n)},A=({type:n,required:t,label:e,disabled:i,rules:s=[],placeholder:u,onEnter:l,size:p,form:x,addonAfter:g,addonBefore:m,nextFocus:I,autoComplete:f="off",defaultValue:j,readOnly:q,value:v,loading:T,onBlur:F,inputRef:P,status:h,autoFocus:C,onChange:D,tooltip:E,...M})=>{const{t:a}=_.useTranslationLib(),w=S.useMemo(()=>{const r=[...s,{required:t,message:`${e??u??""} ${a("err.validation.required")}`}];return n==="email"&&r.push({type:"email",message:a("err.validation.invalidEmail")}),r},[s,t,e,u,a,n]),L={disabled:i,value:v,readOnly:q,defaultValue:j,autoFocus:C,addonBefore:m,ref:P,onBlur:F,addonAfter:T?o.jsx(R.LoadingOutlined,{}):g,status:h,size:p,autoComplete:f,onPressEnter:r=>c(r,I,x,l),type:n,placeholder:u??e},O=n=="password"?d.Input.Password:d.Input;return o.jsx($,{title:E,children:o.jsx(d.Form.Item,{...M,label:e,rules:w,children:o.jsx(O,{...L})})})};exports.default=A;exports.onEnterInternalTextField=c;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react/jsx-runtime"),S=require("@ant-design/icons"),d=require("antd"),_=require("react"),$=require("../../locale/index.cjs.js"),h=require("../tooltip/TooltipComponent.cjs.js"),c=(n,t,e,r)=>{var s;t&&e&&(n.preventDefault(),(s=e==null?void 0:e.getFieldInstance(t))==null||s.focus()),r&&r(n)},A=({type:n,required:t,label:e,disabled:r,rules:s=[],placeholder:i,onEnter:l,size:x,form:g,addonAfter:m,addonBefore:I,nextFocus:f,autoComplete:j="off",defaultValue:p,readOnly:q,value:v,loading:T,onBlur:F,inputRef:P,status:C,autoFocus:E,onChange:D,tooltip:M,...w})=>{const{t:a}=$.useTranslationLib(),L=_.useMemo(()=>{const o=[...s,{required:t,message:`${e||i||""} ${a("err.validation.required")}`}];return n==="email"&&o.push({type:"email",message:a("err.validation.invalidEmail")}),o},[s,t,e,i,a,n]),O={disabled:r,value:v,readOnly:q,defaultValue:p,autoFocus:E,addonBefore:I,ref:P,onBlur:F,addonAfter:T?u.jsx(S.LoadingOutlined,{}):m,status:C,size:x,autoComplete:j,onPressEnter:o=>c(o,f,g,l),type:n,placeholder:i||e},R=n=="password"?d.Input.Password:d.Input;return u.jsx(h,{title:M,children:u.jsx(d.Form.Item,{...w,label:e,rules:L,children:u.jsx(R,{...O})})})};exports.default=A;exports.onEnterInternalTextField=c;
@@ -1,70 +1,70 @@
1
- import { jsx as s } from "react/jsx-runtime";
1
+ import { jsx as m } from "react/jsx-runtime";
2
2
  import { LoadingOutlined as D } from "@ant-design/icons";
3
3
  import { Input as d, Form as M } from "antd";
4
4
  import { useMemo as O } from "react";
5
5
  import { useTranslationLib as k } from "../../locale/index.es.js";
6
6
  import q from "../tooltip/TooltipComponent.es.js";
7
- const z = (n, o, t, e) => {
8
- var i;
9
- o && t && (n.preventDefault(), (i = t == null ? void 0 : t.getFieldInstance(o)) == null || i.focus()), e && e(n);
7
+ const z = (n, i, t, s) => {
8
+ var o;
9
+ i && t && (n.preventDefault(), (o = t == null ? void 0 : t.getFieldInstance(i)) == null || o.focus()), s && s(n);
10
10
  }, R = ({
11
11
  type: n,
12
- required: o,
12
+ required: i,
13
13
  label: t,
14
- disabled: e,
15
- rules: i = [],
16
- placeholder: a,
17
- onEnter: p,
18
- size: f,
19
- form: l,
20
- addonAfter: u,
21
- addonBefore: c,
22
- nextFocus: g,
14
+ disabled: s,
15
+ rules: o = [],
16
+ placeholder: r,
17
+ onEnter: f,
18
+ size: p,
19
+ form: u,
20
+ addonAfter: c,
21
+ addonBefore: g,
22
+ nextFocus: l,
23
23
  autoComplete: v = "off",
24
24
  defaultValue: I,
25
25
  readOnly: T,
26
- value: h,
27
- loading: x,
28
- onBlur: C,
29
- inputRef: F,
30
- status: P,
31
- autoFocus: w,
26
+ value: x,
27
+ loading: C,
28
+ onBlur: F,
29
+ inputRef: P,
30
+ status: w,
31
+ autoFocus: E,
32
32
  onChange: B,
33
- tooltip: E,
34
- ...L
33
+ tooltip: L,
34
+ ...$
35
35
  }) => {
36
- const { t: m } = k(), $ = O(() => {
37
- const r = [
38
- ...i,
36
+ const { t: a } = k(), h = O(() => {
37
+ const e = [
38
+ ...o,
39
39
  {
40
- required: o,
41
- message: `${t ?? a ?? ""} ${m(
40
+ required: i,
41
+ message: `${t || r || ""} ${a(
42
42
  "err.validation.required"
43
43
  )}`
44
44
  }
45
45
  ];
46
- return n === "email" && r.push({
46
+ return n === "email" && e.push({
47
47
  type: "email",
48
- message: m("err.validation.invalidEmail")
49
- }), r;
50
- }, [i, o, t, a, m, n]), j = {
51
- disabled: e,
52
- value: h,
48
+ message: a("err.validation.invalidEmail")
49
+ }), e;
50
+ }, [o, i, t, r, a, n]), j = {
51
+ disabled: s,
52
+ value: x,
53
53
  readOnly: T,
54
54
  defaultValue: I,
55
- autoFocus: w,
56
- addonBefore: c,
57
- ref: F,
58
- onBlur: C,
59
- addonAfter: x ? /* @__PURE__ */ s(D, {}) : u,
60
- status: P,
61
- size: f,
55
+ autoFocus: E,
56
+ addonBefore: g,
57
+ ref: P,
58
+ onBlur: F,
59
+ addonAfter: C ? /* @__PURE__ */ m(D, {}) : c,
60
+ status: w,
61
+ size: p,
62
62
  autoComplete: v,
63
- onPressEnter: (r) => z(r, g, l, p),
63
+ onPressEnter: (e) => z(e, l, u, f),
64
64
  type: n,
65
- placeholder: a ?? t
65
+ placeholder: r || t
66
66
  }, A = n == "password" ? d.Password : d;
67
- return /* @__PURE__ */ s(q, { title: E, children: /* @__PURE__ */ s(M.Item, { ...L, label: t, rules: $, children: /* @__PURE__ */ s(A, { ...j }) }) });
67
+ return /* @__PURE__ */ m(q, { title: L, children: /* @__PURE__ */ m(M.Item, { ...$, label: t, rules: h, children: /* @__PURE__ */ m(A, { ...j }) }) });
68
68
  };
69
69
  export {
70
70
  R as default,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.6.1",
4
+ "version": "1.6.3",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",