@kingteza/crud-component 1.39.0 → 1.40.0

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"),N=require("antd"),i=require("react"),G=require("../../locale/index.cjs.js"),H=require("../tooltip/TooltipComponent.cjs.js"),U=require("./TextField.cjs.js"),R=/\D/g,_=/\B(?=(\d{3})+(?!\d))/g,V=/\$\s?|(,*)/g,z=new Set(["e","E","."]);function J(e,t,s){return`${e??t??""} ${s}`.trim()}function Q(e){if(e==null)return"";const t=String(e);if(!t.includes("."))return t.replace(_,",");const[s,...o]=t.split(".");return[s.replace(_,","),...o].join(".")}function W(e){return(e==null?void 0:e.replace(V,""))??""}function X(e,t){return e==null?"":String(e).replace(t,"")}function Z(e,t){return e==null?"":e.replace(t,"")}const ee=i.forwardRef(function({type:t,required:s,label:o,rules:p=[],placeholder:l,onEnter:m,form:g,nextFocus:E,min:T,moneyField:u,addonAfter:b,minLength:h,defaultValue:v,pattern:w,disabled:M,readOnly:P,onChange:S,value:q,max:y,addonBefore:D,size:L,isInt:n=!1,tooltip:C,help:I,step:O,...j},A){const{t:f}=G.useTranslationLib(),c=T===null,a=n&&!c,k=l??o,K=i.useMemo(()=>{const r=[...p,{required:s,message:J(o,l,f("err.validation.required"))}];return n&&r.push({type:"number",validator:async(re,x)=>{if(!(x==null||Number.isInteger(x)))throw new Error(f("err.validation.integer"))}}),r},[p,o,l,f,s,n]),$=i.useMemo(()=>{if(u)return Q;if(a)return r=>X(r,R)},[u,a]),B=i.useMemo(()=>{if(u)return W;if(a)return r=>Z(r,R)},[u,a]),Y=i.useCallback(r=>U.onEnterInternalTextField(r,E,g,m),[E,g,m]),F=i.useCallback(r=>{if(!c&&r.key==="-"){r.preventDefault();return}z.has(r.key)&&r.preventDefault()},[c]);return d.jsx(H,{title:C,children:d.jsx(N.Form.Item,{...j,label:o,rules:K,help:I,children:d.jsx(N.InputNumber,{ref:A,disabled:M,defaultValue:v,value:q,readOnly:P,addonBefore:D,minLength:h,addonAfter:b,step:n?1:O,inputMode:n?"numeric":void 0,pattern:n?c?"-?[0-9]*":"[0-9]*":w,precision:n?0:void 0,onChange:S,onPressEnter:Y,className:"max-width",min:c?void 0:T??0,max:y,type:u?void 0:"number",size:L,formatter:$,parser:B,onKeyDown:n?F:void 0,placeholder:k})})})});module.exports=ee;
1
+ "use strict";const p=require("react/jsx-runtime"),R=require("antd"),o=require("react"),H=require("../../locale/index.cjs.js"),U=require("../tooltip/TooltipComponent.cjs.js"),V=require("./TextField.cjs.js"),_=/\D/g,b=/\B(?=(\d{3})+(?!\d))/g,z=/\$\s?|(,*)/g,J=new Set(["e","E","."]);function Q(e,t,c){return`${e??t??""} ${c}`.trim()}function W(e){if(e==null)return"";const t=String(e);if(!t.includes("."))return t.replace(b,",");const[c,...s]=t.split(".");return[c.replace(b,","),...s].join(".")}function X(e){return(e==null?void 0:e.replace(z,""))??""}function Z(e,t){return e==null?"":String(e).replace(t,"")}function ee(e,t){return e==null?"":e.replace(t,"")}const re=o.forwardRef(function({changeOnWheel:t,type:c,required:s,label:a,rules:m=[],placeholder:f,onEnter:g,form:E,nextFocus:T,min:x,moneyField:i,addonAfter:h,minLength:v,defaultValue:w,pattern:M,disabled:P,readOnly:S,onChange:q,value:y,max:D,addonBefore:L,size:C,isInt:n=!1,tooltip:I,help:O,step:j,...A},k){const{t:d}=H.useTranslationLib(),u=x===null,l=n&&!u,K=f??a,$=o.useMemo(()=>{const r=[...m,{required:s,message:Q(a,f,d("err.validation.required"))}];return n&&r.push({type:"number",validator:async(te,N)=>{if(!(N==null||Number.isInteger(N)))throw new Error(d("err.validation.integer"))}}),r},[m,a,f,d,s,n]),B=o.useMemo(()=>{if(i)return W;if(l)return r=>Z(r,_)},[i,l]),Y=o.useMemo(()=>{if(i)return X;if(l)return r=>ee(r,_)},[i,l]),F=o.useCallback(r=>V.onEnterInternalTextField(r,T,E,g),[T,E,g]),G=o.useCallback(r=>{if(!u&&r.key==="-"){r.preventDefault();return}J.has(r.key)&&r.preventDefault()},[u]);return p.jsx(U,{title:I,children:p.jsx(R.Form.Item,{...A,label:a,rules:$,help:O,children:p.jsx(R.InputNumber,{ref:k,changeOnWheel:t,disabled:P,defaultValue:w,value:y,readOnly:S,addonBefore:L,minLength:v,addonAfter:h,step:n?1:j,inputMode:n?"numeric":void 0,pattern:n?u?"-?[0-9]*":"[0-9]*":M,precision:n?0:void 0,onChange:q,onPressEnter:F,className:"max-width",min:u?void 0:x??0,max:D,type:i?void 0:"number",size:C,formatter:B,parser:Y,onKeyDown:n?G:void 0,placeholder:K})})})});module.exports=re;
@@ -2,6 +2,7 @@ import { ReactNode } from 'react';
2
2
  import { TextFieldProps } from './TextField';
3
3
  export interface NumberTextFieldProps extends TextFieldProps {
4
4
  moneyField?: boolean;
5
+ changeOnWheel?: boolean;
5
6
  addonAfter?: ReactNode;
6
7
  minLength?: number;
7
8
  isInt?: boolean;
@@ -1,129 +1,131 @@
1
- import { jsx as l } from "react/jsx-runtime";
2
- import { Form as H, InputNumber as U } from "antd";
3
- import { forwardRef as V, useMemo as p, useCallback as _ } from "react";
4
- import { useTranslationLib as z } from "../../locale/index.es.js";
5
- import F from "../tooltip/TooltipComponent.es.js";
6
- import { onEnterInternalTextField as J } from "./TextField.es.js";
7
- const h = /\D/g, v = /\B(?=(\d{3})+(?!\d))/g, Q = /\$\s?|(,*)/g, W = /* @__PURE__ */ new Set(["e", "E", "."]);
8
- function X(r, e, i) {
9
- return `${r ?? e ?? ""} ${i}`.trim();
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { Form as U, InputNumber as V } from "antd";
3
+ import { forwardRef as z, useMemo as m, useCallback as h } from "react";
4
+ import { useTranslationLib as F } from "../../locale/index.es.js";
5
+ import J from "../tooltip/TooltipComponent.es.js";
6
+ import { onEnterInternalTextField as Q } from "./TextField.es.js";
7
+ const v = /\D/g, w = /\B(?=(\d{3})+(?!\d))/g, W = /\$\s?|(,*)/g, X = /* @__PURE__ */ new Set(["e", "E", "."]);
8
+ function Z(r, e, u) {
9
+ return `${r ?? e ?? ""} ${u}`.trim();
10
10
  }
11
- function Z(r) {
11
+ function rr(r) {
12
12
  if (r == null) return "";
13
13
  const e = String(r);
14
14
  if (!e.includes("."))
15
- return e.replace(v, ",");
16
- const [i, ...o] = e.split(".");
17
- return [i.replace(v, ","), ...o].join(".");
15
+ return e.replace(w, ",");
16
+ const [u, ...o] = e.split(".");
17
+ return [u.replace(w, ","), ...o].join(".");
18
18
  }
19
- function rr(r) {
20
- return (r == null ? void 0 : r.replace(Q, "")) ?? "";
19
+ function tr(r) {
20
+ return (r == null ? void 0 : r.replace(W, "")) ?? "";
21
21
  }
22
- function tr(r, e) {
22
+ function er(r, e) {
23
23
  return r == null ? "" : String(r).replace(e, "");
24
24
  }
25
- function er(r, e) {
25
+ function nr(r, e) {
26
26
  return r == null ? "" : r.replace(e, "");
27
27
  }
28
- const fr = V(
28
+ const lr = z(
29
29
  function({
30
- type: e,
31
- required: i,
32
- label: o,
33
- rules: m = [],
34
- placeholder: a,
35
- onEnter: d,
36
- form: g,
37
- nextFocus: E,
38
- min: N,
39
- moneyField: s,
40
- addonAfter: w,
41
- minLength: P,
42
- defaultValue: R,
43
- pattern: S,
44
- disabled: b,
45
- readOnly: y,
46
- onChange: D,
47
- value: L,
48
- max: I,
49
- addonBefore: M,
50
- size: O,
30
+ changeOnWheel: e,
31
+ type: u,
32
+ required: o,
33
+ label: c,
34
+ rules: d = [],
35
+ placeholder: f,
36
+ onEnter: g,
37
+ form: E,
38
+ nextFocus: N,
39
+ min: T,
40
+ moneyField: i,
41
+ addonAfter: P,
42
+ minLength: R,
43
+ defaultValue: S,
44
+ pattern: b,
45
+ disabled: y,
46
+ readOnly: D,
47
+ onChange: L,
48
+ value: I,
49
+ max: M,
50
+ addonBefore: O,
51
+ size: x,
51
52
  isInt: n = !1,
52
- tooltip: x,
53
- help: A,
54
- step: C,
55
- ...K
56
- }, k) {
57
- const { t: f } = z(), u = N === null, c = n && !u, $ = a ?? o, j = p(() => {
53
+ tooltip: A,
54
+ help: C,
55
+ step: K,
56
+ ...k
57
+ }, $) {
58
+ const { t: l } = F(), s = T === null, a = n && !s, j = f ?? c, B = m(() => {
58
59
  const t = [
59
- ...m,
60
+ ...d,
60
61
  {
61
- required: i,
62
- message: X(
63
- o,
64
- a,
65
- f("err.validation.required")
62
+ required: o,
63
+ message: Z(
64
+ c,
65
+ f,
66
+ l("err.validation.required")
66
67
  )
67
68
  }
68
69
  ];
69
70
  return n && t.push({
70
71
  type: "number",
71
- validator: async (nr, T) => {
72
- if (!(T == null || Number.isInteger(T)))
73
- throw new Error(f("err.validation.integer"));
72
+ validator: async (or, _) => {
73
+ if (!(_ == null || Number.isInteger(_)))
74
+ throw new Error(l("err.validation.integer"));
74
75
  }
75
76
  }), t;
76
- }, [m, o, a, f, i, n]), B = p(() => {
77
- if (s) return Z;
78
- if (c)
79
- return (t) => tr(t, h);
80
- }, [s, c]), Y = p(() => {
81
- if (s) return rr;
82
- if (c)
83
- return (t) => er(t, h);
84
- }, [s, c]), q = _(
85
- (t) => J(t, E, g, d),
86
- [E, g, d]
87
- ), G = _(
77
+ }, [d, c, f, l, o, n]), Y = m(() => {
78
+ if (i) return rr;
79
+ if (a)
80
+ return (t) => er(t, v);
81
+ }, [i, a]), q = m(() => {
82
+ if (i) return tr;
83
+ if (a)
84
+ return (t) => nr(t, v);
85
+ }, [i, a]), G = h(
86
+ (t) => Q(t, N, E, g),
87
+ [N, E, g]
88
+ ), H = h(
88
89
  (t) => {
89
- if (!u && t.key === "-") {
90
+ if (!s && t.key === "-") {
90
91
  t.preventDefault();
91
92
  return;
92
93
  }
93
- W.has(t.key) && t.preventDefault();
94
+ X.has(t.key) && t.preventDefault();
94
95
  },
95
- [u]
96
+ [s]
96
97
  );
97
- return /* @__PURE__ */ l(F, { title: x, children: /* @__PURE__ */ l(H.Item, { ...K, label: o, rules: j, help: A, children: /* @__PURE__ */ l(
98
- U,
98
+ return /* @__PURE__ */ p(J, { title: A, children: /* @__PURE__ */ p(U.Item, { ...k, label: c, rules: B, help: C, children: /* @__PURE__ */ p(
99
+ V,
99
100
  {
100
- ref: k,
101
- disabled: b,
102
- defaultValue: R,
103
- value: L,
104
- readOnly: y,
105
- addonBefore: M,
106
- minLength: P,
107
- addonAfter: w,
108
- step: n ? 1 : C,
101
+ ref: $,
102
+ changeOnWheel: e,
103
+ disabled: y,
104
+ defaultValue: S,
105
+ value: I,
106
+ readOnly: D,
107
+ addonBefore: O,
108
+ minLength: R,
109
+ addonAfter: P,
110
+ step: n ? 1 : K,
109
111
  inputMode: n ? "numeric" : void 0,
110
- pattern: n ? u ? "-?[0-9]*" : "[0-9]*" : S,
112
+ pattern: n ? s ? "-?[0-9]*" : "[0-9]*" : b,
111
113
  precision: n ? 0 : void 0,
112
- onChange: D,
113
- onPressEnter: q,
114
+ onChange: L,
115
+ onPressEnter: G,
114
116
  className: "max-width",
115
- min: u ? void 0 : N ?? 0,
116
- max: I,
117
- type: s ? void 0 : "number",
118
- size: O,
119
- formatter: B,
120
- parser: Y,
121
- onKeyDown: n ? G : void 0,
122
- placeholder: $
117
+ min: s ? void 0 : T ?? 0,
118
+ max: M,
119
+ type: i ? void 0 : "number",
120
+ size: x,
121
+ formatter: Y,
122
+ parser: q,
123
+ onKeyDown: n ? H : void 0,
124
+ placeholder: j
123
125
  }
124
126
  ) }) });
125
127
  }
126
128
  );
127
129
  export {
128
- fr as default
130
+ lr as default
129
131
  };
@@ -171,6 +171,7 @@ export interface NumberBasedFieldProps<T> extends InitialCrudField<T>, AddonFiel
171
171
  formatted?: boolean;
172
172
  int?: boolean;
173
173
  step?: number;
174
+ changeOnWheel?: boolean;
174
175
  onChange?: (value: number, form: FormInstance<T>) => void;
175
176
  }
176
177
  export interface DateBasedFieldProps<T> extends InitialCrudField<T>, Copyable<false> {
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),p=require("antd"),T=require("react"),Y=require("react-highlight-words"),Z=require("../locale/index.cjs.js"),ee=require("./FileCrudField.cjs.js"),re=require("./ImageCrudField.cjs.js"),te=require("../common/check-box/CheckBox.cjs.js"),ne=require("../common/date-picker/DatePicker.cjs.js"),ae=require("../common/date-picker/TimePicker.cjs.js"),D=require("../common/select/SelectComponent.cjs.js"),oe=require("../common/text-field/NumberField.cjs.js"),le=require("../common/text-field/PhoneNumberField.cjs.js"),se=require("../common/text-field/TextField.cjs.js"),ie=require("../common/tooltip/TooltipComponent.cjs.js"),de=require("./CrudTextAreaComponent.cjs.js"),_=require("../util/CrudUtil.cjs.js"),E=require("../context/CrudSearchContext.cjs.js");function ce(F){const{label:s,name:d,type:c,required:h,hidden:H,rules:b=[],updatable:m=!0,readonly:y=!1,fieldClassName:f,customFormFieldRender:k,fieldTooltip:S,fieldHelper:C,formLayoutProps:q,...r}=F,l=p.Form.useFormInstance();T.useEffect(()=>{if(c==="select"){const{items:a=[],onSearch:o,searchOnType:u}=r;!(a!=null&&a.length)&&!u&&(o==null||o(void 0,l,r==null?void 0:r.updatingValue))}},[l,r,c,r==null?void 0:r.updatingValue]);const R=E.useCrudSearchContext(),x=T.useCallback((a,o)=>{R&&R.search(),!y&&o&&o(a,l)},[R,y,l]);if(y||H)return e.jsx(e.Fragment,{});if(k)return k(l,F);switch(c){case"text":case"email":case"password":{const{maxLength:a,onChange:o,placeholder:u,addonAfter:v,addonBefore:i}=r;return e.jsx(se.default,{...q,maxLength:a,placeholder:u,disabled:!m,rules:b,required:h,onChange:o?N=>o(N,l):void 0,type:c,name:d,tooltip:S,label:s,className:f,autoComplete:"new-password",addonAfter:v,addonBefore:i,help:C})}case"phone":{const{onChange:a,placeholder:o,addonAfter:u,addonBefore:v}=r;return e.jsx(le,{...r,...q,placeholder:o,disabled:!m,rules:b,required:h,onChange:a?i=>a(i,l):void 0,type:c,name:d,tooltip:S,label:s,className:f,autoComplete:"new-password",addonAfter:u,addonBefore:v,help:C})}case"number":{const{onChange:a,placeholder:o,allowMinus:u,min:v,max:i,addonAfter:N,addonBefore:w,int:P,step:n}=r;return e.jsx(oe,{...q,step:n,placeholder:o,disabled:!m,moneyField:!!r.formatted,type:c,onChange:a?j=>a(j,l):void 0,rules:b,autoComplete:"false",required:h,tooltip:S,className:f,min:u?null:v,max:i,addonAfter:N,addonBefore:w,name:d,label:s,help:C,isInt:P})}case"date":{const{range:a,disableToday:o,disabledFutureDays:u,disabledPastDays:v,onChange:i,placeholder:N,format:w}=r;return e.jsx(ne,{...q,placeholder:N,required:h,disabled:!m,type:c,format:w,tooltip:S,range:a,name:d,label:s,onChange:x,className:f,disableToday:o,disabledFutureDays:u,disabledPastDays:v,help:C})}case"time":{const{range:a=!1,disableCurrent:o,disabledFuture:u,disabledPast:v,onChange:i,use12Hours:N,format:w,placeholder:P}=r;return e.jsx(ae,{...q,placeholder:P,required:h,format:w,disabled:!m,type:c,tooltip:S,range:a,use12Hours:N,name:d,label:s,onChange:x,className:f,disableCurrent:o,disabledFuture:u,disabledPast:v,help:C})}case"textarea":return e.jsx(de,{...F});case"image":return e.jsx(re.default,{...r,required:h,name:d,label:s,rules:b,fieldHelper:C,fieldClassName:f,onRemoved:r.onRemoved,onUploading:r.onUploading,provider:r.provider});case"file":return e.jsx(ee.default,{...r,required:h,name:d,label:s,rules:b,fieldHelper:C,fieldClassName:f,onRemoved:r.onRemoved,onUploading:r.onUploading,provider:r.provider});case"select":return e.jsx($,{...r,required:h,name:d,label:s,rules:b,fieldClassName:f,form:l,help:C,updatable:m,readonly:y,fieldTooltip:S,fieldHelper:C});case"enum":return e.jsx(W,{...F});case"checkbox":{const{onChange:a,switch:o}=r;return e.jsx(te,{...q,className:f,rules:b,onChange:x,label:s,tooltip:S,disabled:!m,name:d,help:C,switch:o})}case"color":return e.jsx(z,{...r,type:"color",required:h,name:d,label:s,rules:b,fieldClassName:f,updatable:m,readonly:y,fieldTooltip:S,fieldHelper:C});default:return e.jsx(e.Fragment,{children:`${c} Not Implemented`})}}function W(F){const s=p.Form.useFormInstance(),{label:d,name:c,type:h,required:H,hidden:b,rules:m=[],updatable:y=!0,readonly:f=!1,fieldClassName:k,customFormFieldRender:S,fieldTooltip:C,fieldHelper:q,formLayoutProps:r,...l}=F,{t:R}=Z.useTranslationLibNoNS(),{enum:x,translation:a,onChange:o,onSearch:u,multiple:v,tagRender:i}=l,N=Array.isArray(x)?x:Object.keys(x),w=E.useCrudSearchContext(),P=T.useCallback(n=>{w&&w.search(),!f&&o&&o(n,s)},[w,f,o,s]);return"radio"in l&&l.radio?e.jsx(p.Form.Item,{...l,...r,name:c,required:H,tooltip:C,rules:m,label:d,className:["w-100",k].join(" "),help:q,children:e.jsx(p.Radio.Group,{...l,onChange:n=>{var j;return P((j=n==null?void 0:n.target)==null?void 0:j.value)},children:N.map(n=>e.jsx(p.Radio,{disabled:!y,value:n,children:a?R(a[n]):n},n))})}):"checkbox"in l&&l.checkbox?e.jsx(p.Form.Item,{...l,...r,name:c,required:H,tooltip:C,rules:m,label:d,className:["w-100",k].join(" "),help:q,children:e.jsx(p.Checkbox.Group,{className:"w-100",onChange:P,children:N.map(n=>{const j=e.jsx(p.Checkbox,{disabled:!y,value:n,children:a?R(a[n]):n},n);return"checkboxGrid"in l&&l.checkboxGrid?e.jsx(p.Col,{...l.checkboxGrid,children:j}):j})})}):e.jsx(D,{...l,...r,notSearch:!0,tagRender:typeof i=="function"?i:i?n=>{const{value:j,label:I}=n,L=i[j];return L?e.jsx(p.Tag,{color:L.color,children:I}):e.jsx(p.Tag,{children:I})}:void 0,onChange:P,className:["w-100",k].join(" "),name:c,items:N,required:H,tooltip:C,rules:m,label:d,help:q,disabled:!y,onSearch:u?n=>u(n,s):void 0,allowClear:!0,mode:v?"multiple":void 0,showLoadingInEmptyIndicator:!0,itemBuilder:n=>e.jsx(p.Select.Option,{value:n,children:a?R(a[n]):n},n)})}function $(F){const{items:s=[],loading:d,searchOnType:c,onSearch:h,multiple:H,onChange:b,highlightSearch:m,required:y,fieldClassName:f,rules:k,fieldTooltip:S,updatable:C,label:q,name:r,tagRender:l,updatingValue:R,onSet:x,placeholder:a,allowClear:o=!0,selectOptionRender:u,formLayoutProps:v}=F,i=F.form,[N,w]=T.useState(""),P=T.useMemo(()=>_.getRealName(r),[r]),n=T.useMemo(()=>_.getRealName(r,"upsertFieldName"),[r]),j=p.Form.useWatch(P,i),[I,L]=T.useState(!0);T.useEffect(()=>{x&&I&&j&&(x==null||x(j,s,i),L(!1))},[I,i,s,P,x,j]),T.useEffect(()=>{j&&L(!0)},[j]);const J=T.useCallback(async t=>{w(t),c&&(h==null||h(t,i,R))},[i,h,c,R]),K=T.useCallback(t=>u?u(t):t.value,[u]),O=E.useCrudSearchContext(),Q=T.useCallback(t=>{O&&O.search(),b&&(w(""),b(t,i))},[O,b,i]);return e.jsx(D,{...F,...v,showLoadingInEmptyIndicator:!0,maxTagCount:"responsive",maxTagPlaceholder:t=>e.jsxs(ie,{title:e.jsx(e.Fragment,{children:t.map(g=>e.jsxs(e.Fragment,{children:[g.label," ",e.jsx("br",{})]}))}),children:["+",t==null?void 0:t.length]}),placeholder:a,onSelect:t=>{x==null||x(t==null?void 0:t.key,s,i)},onChange:Q,mode:H?"multiple":void 0,className:["w-100",f].join(" "),name:n,items:s,required:y,tooltip:S,tagRender:l,rules:k,disabled:!C,label:q,allowClear:o,onSearch:J,loading:d,filterOption:m?(t,g)=>{var A,B,G;try{const M=t.toLowerCase().split(/\s+/),V=((typeof(g==null?void 0:g.children)=="string"?g==null?void 0:g.children:(B=(A=g==null?void 0:g.children)==null?void 0:A.props)==null?void 0:B.textToHighlight)??"").toLowerCase(),X=(((G=g==null?void 0:g.value)==null?void 0:G.toString())??"").toLowerCase();return M.every(U=>V.indexOf(U)>=0||X.indexOf(U)>=0)}catch{return!0}}:void 0,itemBuilder:m?t=>{const g=t.value?String(t.value):void 0;return e.jsx(p.Select.Option,{value:t.key,title:g,disabled:t.disabled,children:e.jsx(Y,{highlightClassName:"highlight-text",searchWords:(N??"").split(" "),autoEscape:!0,textToHighlight:g??""})},t.key)}:t=>e.jsx(p.Select.Option,{value:t.key,title:t.value,disabled:t.disabled,children:K(t)},t.key)})}function z(F){const{formLayoutProps:s,required:d,fieldClassName:c,rules:h,fieldTooltip:H,updatable:b,label:m,name:y,fieldHelper:f}=F;return e.jsx(p.Form.Item,{...s,label:m,name:y,required:d,rules:h,tooltip:H,help:f,getValueFromEvent:k=>typeof k=="object"?k.toHexString():k,children:e.jsx(p.ColorPicker,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",showText:!0,trigger:"click",className:c,disabled:!b,...F.innerProps})})}exports.ColorCrudFieldComponent=z;exports.EnumCrudFieldComponent=W;exports.SelectCrudFieldComponent=$;exports.default=ce;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),p=require("antd"),T=require("react"),Y=require("react-highlight-words"),Z=require("../locale/index.cjs.js"),ee=require("./FileCrudField.cjs.js"),re=require("./ImageCrudField.cjs.js"),te=require("../common/check-box/CheckBox.cjs.js"),ne=require("../common/date-picker/DatePicker.cjs.js"),ae=require("../common/date-picker/TimePicker.cjs.js"),D=require("../common/select/SelectComponent.cjs.js"),oe=require("../common/text-field/NumberField.cjs.js"),le=require("../common/text-field/PhoneNumberField.cjs.js"),se=require("../common/text-field/TextField.cjs.js"),ie=require("../common/tooltip/TooltipComponent.cjs.js"),de=require("./CrudTextAreaComponent.cjs.js"),_=require("../util/CrudUtil.cjs.js"),E=require("../context/CrudSearchContext.cjs.js");function ce(F){const{label:s,name:d,type:c,required:h,hidden:O,rules:b=[],updatable:m=!0,readonly:y=!1,fieldClassName:f,customFormFieldRender:k,fieldTooltip:S,fieldHelper:C,formLayoutProps:q,...r}=F,l=p.Form.useFormInstance();T.useEffect(()=>{if(c==="select"){const{items:a=[],onSearch:o,searchOnType:u}=r;!(a!=null&&a.length)&&!u&&(o==null||o(void 0,l,r==null?void 0:r.updatingValue))}},[l,r,c,r==null?void 0:r.updatingValue]);const R=E.useCrudSearchContext(),x=T.useCallback((a,o)=>{R&&R.search(),!y&&o&&o(a,l)},[R,y,l]);if(y||O)return e.jsx(e.Fragment,{});if(k)return k(l,F);switch(c){case"text":case"email":case"password":{const{maxLength:a,onChange:o,placeholder:u,addonAfter:v,addonBefore:i}=r;return e.jsx(se.default,{...q,maxLength:a,placeholder:u,disabled:!m,rules:b,required:h,onChange:o?N=>o(N,l):void 0,type:c,name:d,tooltip:S,label:s,className:f,autoComplete:"new-password",addonAfter:v,addonBefore:i,help:C})}case"phone":{const{onChange:a,placeholder:o,addonAfter:u,addonBefore:v}=r;return e.jsx(le,{...r,...q,placeholder:o,disabled:!m,rules:b,required:h,onChange:a?i=>a(i,l):void 0,type:c,name:d,tooltip:S,label:s,className:f,autoComplete:"new-password",addonAfter:u,addonBefore:v,help:C})}case"number":{const{onChange:a,placeholder:o,allowMinus:u,min:v,max:i,addonAfter:N,addonBefore:w,int:P,step:n,changeOnWheel:j=!1}=r;return e.jsx(oe,{...q,step:n,changeOnWheel:j,placeholder:o,disabled:!m,moneyField:!!r.formatted,type:c,onChange:a?H=>a(H,l):void 0,rules:b,autoComplete:"false",required:h,tooltip:S,className:f,min:u?null:v,max:i,addonAfter:N,addonBefore:w,name:d,label:s,help:C,isInt:P})}case"date":{const{range:a,disableToday:o,disabledFutureDays:u,disabledPastDays:v,onChange:i,placeholder:N,format:w}=r;return e.jsx(ne,{...q,placeholder:N,required:h,disabled:!m,type:c,format:w,tooltip:S,range:a,name:d,label:s,onChange:x,className:f,disableToday:o,disabledFutureDays:u,disabledPastDays:v,help:C})}case"time":{const{range:a=!1,disableCurrent:o,disabledFuture:u,disabledPast:v,onChange:i,use12Hours:N,format:w,placeholder:P}=r;return e.jsx(ae,{...q,placeholder:P,required:h,format:w,disabled:!m,type:c,tooltip:S,range:a,use12Hours:N,name:d,label:s,onChange:x,className:f,disableCurrent:o,disabledFuture:u,disabledPast:v,help:C})}case"textarea":return e.jsx(de,{...F});case"image":return e.jsx(re.default,{...r,required:h,name:d,label:s,rules:b,fieldHelper:C,fieldClassName:f,onRemoved:r.onRemoved,onUploading:r.onUploading,provider:r.provider});case"file":return e.jsx(ee.default,{...r,required:h,name:d,label:s,rules:b,fieldHelper:C,fieldClassName:f,onRemoved:r.onRemoved,onUploading:r.onUploading,provider:r.provider});case"select":return e.jsx($,{...r,required:h,name:d,label:s,rules:b,fieldClassName:f,form:l,help:C,updatable:m,readonly:y,fieldTooltip:S,fieldHelper:C});case"enum":return e.jsx(W,{...F});case"checkbox":{const{onChange:a,switch:o}=r;return e.jsx(te,{...q,className:f,rules:b,onChange:x,label:s,tooltip:S,disabled:!m,name:d,help:C,switch:o})}case"color":return e.jsx(z,{...r,type:"color",required:h,name:d,label:s,rules:b,fieldClassName:f,updatable:m,readonly:y,fieldTooltip:S,fieldHelper:C});default:return e.jsx(e.Fragment,{children:`${c} Not Implemented`})}}function W(F){const s=p.Form.useFormInstance(),{label:d,name:c,type:h,required:O,hidden:b,rules:m=[],updatable:y=!0,readonly:f=!1,fieldClassName:k,customFormFieldRender:S,fieldTooltip:C,fieldHelper:q,formLayoutProps:r,...l}=F,{t:R}=Z.useTranslationLibNoNS(),{enum:x,translation:a,onChange:o,onSearch:u,multiple:v,tagRender:i}=l,N=Array.isArray(x)?x:Object.keys(x),w=E.useCrudSearchContext(),P=T.useCallback(n=>{w&&w.search(),!f&&o&&o(n,s)},[w,f,o,s]);return"radio"in l&&l.radio?e.jsx(p.Form.Item,{...l,...r,name:c,required:O,tooltip:C,rules:m,label:d,className:["w-100",k].join(" "),help:q,children:e.jsx(p.Radio.Group,{...l,onChange:n=>{var j;return P((j=n==null?void 0:n.target)==null?void 0:j.value)},children:N.map(n=>e.jsx(p.Radio,{disabled:!y,value:n,children:a?R(a[n]):n},n))})}):"checkbox"in l&&l.checkbox?e.jsx(p.Form.Item,{...l,...r,name:c,required:O,tooltip:C,rules:m,label:d,className:["w-100",k].join(" "),help:q,children:e.jsx(p.Checkbox.Group,{className:"w-100",onChange:P,children:N.map(n=>{const j=e.jsx(p.Checkbox,{disabled:!y,value:n,children:a?R(a[n]):n},n);return"checkboxGrid"in l&&l.checkboxGrid?e.jsx(p.Col,{...l.checkboxGrid,children:j}):j})})}):e.jsx(D,{...l,...r,notSearch:!0,tagRender:typeof i=="function"?i:i?n=>{const{value:j,label:H}=n,I=i[j];return I?e.jsx(p.Tag,{color:I.color,children:H}):e.jsx(p.Tag,{children:H})}:void 0,onChange:P,className:["w-100",k].join(" "),name:c,items:N,required:O,tooltip:C,rules:m,label:d,help:q,disabled:!y,onSearch:u?n=>u(n,s):void 0,allowClear:!0,mode:v?"multiple":void 0,showLoadingInEmptyIndicator:!0,itemBuilder:n=>e.jsx(p.Select.Option,{value:n,children:a?R(a[n]):n},n)})}function $(F){const{items:s=[],loading:d,searchOnType:c,onSearch:h,multiple:O,onChange:b,highlightSearch:m,required:y,fieldClassName:f,rules:k,fieldTooltip:S,updatable:C,label:q,name:r,tagRender:l,updatingValue:R,onSet:x,placeholder:a,allowClear:o=!0,selectOptionRender:u,formLayoutProps:v}=F,i=F.form,[N,w]=T.useState(""),P=T.useMemo(()=>_.getRealName(r),[r]),n=T.useMemo(()=>_.getRealName(r,"upsertFieldName"),[r]),j=p.Form.useWatch(P,i),[H,I]=T.useState(!0);T.useEffect(()=>{x&&H&&j&&(x==null||x(j,s,i),I(!1))},[H,i,s,P,x,j]),T.useEffect(()=>{j&&I(!0)},[j]);const J=T.useCallback(async t=>{w(t),c&&(h==null||h(t,i,R))},[i,h,c,R]),K=T.useCallback(t=>u?u(t):t.value,[u]),L=E.useCrudSearchContext(),Q=T.useCallback(t=>{L&&L.search(),b&&(w(""),b(t,i))},[L,b,i]);return e.jsx(D,{...F,...v,showLoadingInEmptyIndicator:!0,maxTagCount:"responsive",maxTagPlaceholder:t=>e.jsxs(ie,{title:e.jsx(e.Fragment,{children:t.map(g=>e.jsxs(e.Fragment,{children:[g.label," ",e.jsx("br",{})]}))}),children:["+",t==null?void 0:t.length]}),placeholder:a,onSelect:t=>{x==null||x(t==null?void 0:t.key,s,i)},onChange:Q,mode:O?"multiple":void 0,className:["w-100",f].join(" "),name:n,items:s,required:y,tooltip:S,tagRender:l,rules:k,disabled:!C,label:q,allowClear:o,onSearch:J,loading:d,filterOption:m?(t,g)=>{var A,B,G;try{const M=t.toLowerCase().split(/\s+/),V=((typeof(g==null?void 0:g.children)=="string"?g==null?void 0:g.children:(B=(A=g==null?void 0:g.children)==null?void 0:A.props)==null?void 0:B.textToHighlight)??"").toLowerCase(),X=(((G=g==null?void 0:g.value)==null?void 0:G.toString())??"").toLowerCase();return M.every(U=>V.indexOf(U)>=0||X.indexOf(U)>=0)}catch{return!0}}:void 0,itemBuilder:m?t=>{const g=t.value?String(t.value):void 0;return e.jsx(p.Select.Option,{value:t.key,title:g,disabled:t.disabled,children:e.jsx(Y,{highlightClassName:"highlight-text",searchWords:(N??"").split(" "),autoEscape:!0,textToHighlight:g??""})},t.key)}:t=>e.jsx(p.Select.Option,{value:t.key,title:t.value,disabled:t.disabled,children:K(t)},t.key)})}function z(F){const{formLayoutProps:s,required:d,fieldClassName:c,rules:h,fieldTooltip:O,updatable:b,label:m,name:y,fieldHelper:f}=F;return e.jsx(p.Form.Item,{...s,label:m,name:y,required:d,rules:h,tooltip:O,help:f,getValueFromEvent:k=>typeof k=="object"?k.toHexString():k,children:e.jsx(p.ColorPicker,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",showText:!0,trigger:"click",className:c,disabled:!b,...F.innerProps})})}exports.ColorCrudFieldComponent=z;exports.EnumCrudFieldComponent=W;exports.SelectCrudFieldComponent=$;exports.default=ce;
@@ -1,17 +1,17 @@
1
1
  import { jsx as r, Fragment as A, jsxs as $ } from "react/jsx-runtime";
2
- import { Form as L, ColorPicker as ae, Radio as z, Checkbox as J, Col as ne, Select as E, Tag as K } from "antd";
2
+ import { Form as O, ColorPicker as ae, Radio as z, Checkbox as J, Col as ne, Select as E, Tag as K } from "antd";
3
3
  import { useEffect as G, useCallback as j, useState as Q, useMemo as V } from "react";
4
4
  import le from "react-highlight-words";
5
5
  import { useTranslationLibNoNS as ie } from "../locale/index.es.js";
6
- import de from "./FileCrudField.es.js";
7
- import se from "./ImageCrudField.es.js";
6
+ import se from "./FileCrudField.es.js";
7
+ import de from "./ImageCrudField.es.js";
8
8
  import ce from "../common/check-box/CheckBox.es.js";
9
9
  import me from "../common/date-picker/DatePicker.es.js";
10
10
  import ue from "../common/date-picker/TimePicker.es.js";
11
11
  import Y from "../common/select/SelectComponent.es.js";
12
12
  import he from "../common/text-field/NumberField.es.js";
13
- import pe from "../common/text-field/PhoneNumberField.es.js";
14
- import fe from "../common/text-field/TextField.es.js";
13
+ import fe from "../common/text-field/PhoneNumberField.es.js";
14
+ import pe from "../common/text-field/TextField.es.js";
15
15
  import ge from "../common/tooltip/TooltipComponent.es.js";
16
16
  import Ce from "./CrudTextAreaComponent.es.js";
17
17
  import X from "../util/CrudUtil.es.js";
@@ -19,20 +19,20 @@ import { useCrudSearchContext as U } from "../context/CrudSearchContext.es.js";
19
19
  function Ue(y) {
20
20
  const {
21
21
  label: i,
22
- name: s,
22
+ name: d,
23
23
  type: c,
24
24
  required: u,
25
25
  hidden: I,
26
26
  rules: b = [],
27
27
  updatable: h = !0,
28
28
  readonly: v = !1,
29
- fieldClassName: p,
29
+ fieldClassName: f,
30
30
  customFormFieldRender: w,
31
31
  fieldTooltip: R,
32
- fieldHelper: f,
32
+ fieldHelper: p,
33
33
  formLayoutProps: T,
34
34
  ...e
35
- } = y, l = L.useFormInstance();
35
+ } = y, l = O.useFormInstance();
36
36
  G(() => {
37
37
  if (c === "select") {
38
38
  const {
@@ -53,9 +53,9 @@ function Ue(y) {
53
53
  case "text":
54
54
  case "email":
55
55
  case "password": {
56
- const { maxLength: a, onChange: n, placeholder: m, addonAfter: N, addonBefore: d } = e;
56
+ const { maxLength: a, onChange: n, placeholder: m, addonAfter: N, addonBefore: s } = e;
57
57
  return /* @__PURE__ */ r(
58
- fe,
58
+ pe,
59
59
  {
60
60
  ...T,
61
61
  maxLength: a,
@@ -65,21 +65,21 @@ function Ue(y) {
65
65
  required: u,
66
66
  onChange: n ? (F) => n(F, l) : void 0,
67
67
  type: c,
68
- name: s,
68
+ name: d,
69
69
  tooltip: R,
70
70
  label: i,
71
- className: p,
71
+ className: f,
72
72
  autoComplete: "new-password",
73
73
  addonAfter: N,
74
- addonBefore: d,
75
- help: f
74
+ addonBefore: s,
75
+ help: p
76
76
  }
77
77
  );
78
78
  }
79
79
  case "phone": {
80
80
  const { onChange: a, placeholder: n, addonAfter: m, addonBefore: N } = e;
81
81
  return /* @__PURE__ */ r(
82
- pe,
82
+ fe,
83
83
  {
84
84
  ...e,
85
85
  ...T,
@@ -87,16 +87,16 @@ function Ue(y) {
87
87
  disabled: !h,
88
88
  rules: b,
89
89
  required: u,
90
- onChange: a ? (d) => a(d, l) : void 0,
90
+ onChange: a ? (s) => a(s, l) : void 0,
91
91
  type: c,
92
- name: s,
92
+ name: d,
93
93
  tooltip: R,
94
94
  label: i,
95
- className: p,
95
+ className: f,
96
96
  autoComplete: "new-password",
97
97
  addonAfter: m,
98
98
  addonBefore: N,
99
- help: f
99
+ help: p
100
100
  }
101
101
  );
102
102
  }
@@ -106,34 +106,36 @@ function Ue(y) {
106
106
  placeholder: n,
107
107
  allowMinus: m,
108
108
  min: N,
109
- max: d,
109
+ max: s,
110
110
  addonAfter: F,
111
111
  addonBefore: k,
112
112
  int: H,
113
- step: o
113
+ step: o,
114
+ changeOnWheel: x = !1
114
115
  } = e;
115
116
  return /* @__PURE__ */ r(
116
117
  he,
117
118
  {
118
119
  ...T,
119
120
  step: o,
121
+ changeOnWheel: x,
120
122
  placeholder: n,
121
123
  disabled: !h,
122
124
  moneyField: !!e.formatted,
123
125
  type: c,
124
- onChange: a ? (x) => a(x, l) : void 0,
126
+ onChange: a ? (L) => a(L, l) : void 0,
125
127
  rules: b,
126
128
  autoComplete: "false",
127
129
  required: u,
128
130
  tooltip: R,
129
- className: p,
131
+ className: f,
130
132
  min: m ? null : N,
131
- max: d,
133
+ max: s,
132
134
  addonAfter: F,
133
135
  addonBefore: k,
134
- name: s,
136
+ name: d,
135
137
  label: i,
136
- help: f,
138
+ help: p,
137
139
  isInt: H
138
140
  }
139
141
  );
@@ -144,7 +146,7 @@ function Ue(y) {
144
146
  disableToday: n,
145
147
  disabledFutureDays: m,
146
148
  disabledPastDays: N,
147
- onChange: d,
149
+ onChange: s,
148
150
  placeholder: F,
149
151
  format: k
150
152
  } = e;
@@ -159,14 +161,14 @@ function Ue(y) {
159
161
  format: k,
160
162
  tooltip: R,
161
163
  range: a,
162
- name: s,
164
+ name: d,
163
165
  label: i,
164
166
  onChange: C,
165
- className: p,
167
+ className: f,
166
168
  disableToday: n,
167
169
  disabledFutureDays: m,
168
170
  disabledPastDays: N,
169
- help: f
171
+ help: p
170
172
  }
171
173
  );
172
174
  }
@@ -176,7 +178,7 @@ function Ue(y) {
176
178
  disableCurrent: n,
177
179
  disabledFuture: m,
178
180
  disabledPast: N,
179
- onChange: d,
181
+ onChange: s,
180
182
  use12Hours: F,
181
183
  format: k,
182
184
  placeholder: H
@@ -193,14 +195,14 @@ function Ue(y) {
193
195
  tooltip: R,
194
196
  range: a,
195
197
  use12Hours: F,
196
- name: s,
198
+ name: d,
197
199
  label: i,
198
200
  onChange: C,
199
- className: p,
201
+ className: f,
200
202
  disableCurrent: n,
201
203
  disabledFuture: m,
202
204
  disabledPast: N,
203
- help: f
205
+ help: p
204
206
  }
205
207
  );
206
208
  }
@@ -208,15 +210,15 @@ function Ue(y) {
208
210
  return /* @__PURE__ */ r(Ce, { ...y });
209
211
  case "image":
210
212
  return /* @__PURE__ */ r(
211
- se,
213
+ de,
212
214
  {
213
215
  ...e,
214
216
  required: u,
215
- name: s,
217
+ name: d,
216
218
  label: i,
217
219
  rules: b,
218
- fieldHelper: f,
219
- fieldClassName: p,
220
+ fieldHelper: p,
221
+ fieldClassName: f,
220
222
  onRemoved: e.onRemoved,
221
223
  onUploading: e.onUploading,
222
224
  provider: e.provider
@@ -224,15 +226,15 @@ function Ue(y) {
224
226
  );
225
227
  case "file":
226
228
  return /* @__PURE__ */ r(
227
- de,
229
+ se,
228
230
  {
229
231
  ...e,
230
232
  required: u,
231
- name: s,
233
+ name: d,
232
234
  label: i,
233
235
  rules: b,
234
- fieldHelper: f,
235
- fieldClassName: p,
236
+ fieldHelper: p,
237
+ fieldClassName: f,
236
238
  onRemoved: e.onRemoved,
237
239
  onUploading: e.onUploading,
238
240
  provider: e.provider
@@ -244,16 +246,16 @@ function Ue(y) {
244
246
  {
245
247
  ...e,
246
248
  required: u,
247
- name: s,
249
+ name: d,
248
250
  label: i,
249
251
  rules: b,
250
- fieldClassName: p,
252
+ fieldClassName: f,
251
253
  form: l,
252
- help: f,
254
+ help: p,
253
255
  updatable: h,
254
256
  readonly: v,
255
257
  fieldTooltip: R,
256
- fieldHelper: f
258
+ fieldHelper: p
257
259
  }
258
260
  );
259
261
  case "enum":
@@ -264,14 +266,14 @@ function Ue(y) {
264
266
  ce,
265
267
  {
266
268
  ...T,
267
- className: p,
269
+ className: f,
268
270
  rules: b,
269
271
  onChange: C,
270
272
  label: i,
271
273
  tooltip: R,
272
274
  disabled: !h,
273
- name: s,
274
- help: f,
275
+ name: d,
276
+ help: p,
275
277
  switch: n
276
278
  }
277
279
  );
@@ -283,14 +285,14 @@ function Ue(y) {
283
285
  ...e,
284
286
  type: "color",
285
287
  required: u,
286
- name: s,
288
+ name: d,
287
289
  label: i,
288
290
  rules: b,
289
- fieldClassName: p,
291
+ fieldClassName: f,
290
292
  updatable: h,
291
293
  readonly: v,
292
294
  fieldTooltip: R,
293
- fieldHelper: f
295
+ fieldHelper: p
294
296
  }
295
297
  );
296
298
  default:
@@ -298,18 +300,18 @@ function Ue(y) {
298
300
  }
299
301
  }
300
302
  function be(y) {
301
- const i = L.useFormInstance(), {
302
- label: s,
303
+ const i = O.useFormInstance(), {
304
+ label: d,
303
305
  name: c,
304
306
  type: u,
305
307
  required: I,
306
308
  hidden: b,
307
309
  rules: h = [],
308
310
  updatable: v = !0,
309
- readonly: p = !1,
311
+ readonly: f = !1,
310
312
  fieldClassName: w,
311
313
  customFormFieldRender: R,
312
- fieldTooltip: f,
314
+ fieldTooltip: p,
313
315
  fieldHelper: T,
314
316
  formLayoutProps: e,
315
317
  ...l
@@ -319,23 +321,23 @@ function be(y) {
319
321
  onChange: n,
320
322
  onSearch: m,
321
323
  multiple: N,
322
- tagRender: d
324
+ tagRender: s
323
325
  } = l, F = Array.isArray(C) ? C : Object.keys(C), k = U(), H = j(
324
326
  (o) => {
325
- k && k.search(), !p && n && n(o, i);
327
+ k && k.search(), !f && n && n(o, i);
326
328
  },
327
- [k, p, n, i]
329
+ [k, f, n, i]
328
330
  );
329
331
  return "radio" in l && l.radio ? /* @__PURE__ */ r(
330
- L.Item,
332
+ O.Item,
331
333
  {
332
334
  ...l,
333
335
  ...e,
334
336
  name: c,
335
337
  required: I,
336
- tooltip: f,
338
+ tooltip: p,
337
339
  rules: h,
338
- label: s,
340
+ label: d,
339
341
  className: ["w-100", w].join(" "),
340
342
  help: T,
341
343
  children: /* @__PURE__ */ r(
@@ -351,15 +353,15 @@ function be(y) {
351
353
  )
352
354
  }
353
355
  ) : "checkbox" in l && l.checkbox ? /* @__PURE__ */ r(
354
- L.Item,
356
+ O.Item,
355
357
  {
356
358
  ...l,
357
359
  ...e,
358
360
  name: c,
359
361
  required: I,
360
- tooltip: f,
362
+ tooltip: p,
361
363
  rules: h,
362
- label: s,
364
+ label: d,
363
365
  className: ["w-100", w].join(" "),
364
366
  help: T,
365
367
  children: /* @__PURE__ */ r(J.Group, { className: "w-100", onChange: H, children: F.map((o) => {
@@ -373,18 +375,18 @@ function be(y) {
373
375
  ...l,
374
376
  ...e,
375
377
  notSearch: !0,
376
- tagRender: typeof d == "function" ? d : d ? (o) => {
377
- const { value: x, label: S } = o, O = d[x];
378
- return O ? /* @__PURE__ */ r(K, { color: O.color, children: S }) : /* @__PURE__ */ r(K, { children: S });
378
+ tagRender: typeof s == "function" ? s : s ? (o) => {
379
+ const { value: x, label: L } = o, S = s[x];
380
+ return S ? /* @__PURE__ */ r(K, { color: S.color, children: L }) : /* @__PURE__ */ r(K, { children: L });
379
381
  } : void 0,
380
382
  onChange: H,
381
383
  className: ["w-100", w].join(" "),
382
384
  name: c,
383
385
  items: F,
384
386
  required: I,
385
- tooltip: f,
387
+ tooltip: p,
386
388
  rules: h,
387
- label: s,
389
+ label: d,
388
390
  help: T,
389
391
  disabled: !v,
390
392
  onSearch: m ? (o) => m(o, i) : void 0,
@@ -398,17 +400,17 @@ function be(y) {
398
400
  function xe(y) {
399
401
  const {
400
402
  items: i = [],
401
- loading: s,
403
+ loading: d,
402
404
  searchOnType: c,
403
405
  onSearch: u,
404
406
  multiple: I,
405
407
  onChange: b,
406
408
  highlightSearch: h,
407
409
  required: v,
408
- fieldClassName: p,
410
+ fieldClassName: f,
409
411
  rules: w,
410
412
  fieldTooltip: R,
411
- updatable: f,
413
+ updatable: p,
412
414
  label: T,
413
415
  name: e,
414
416
  tagRender: l,
@@ -418,28 +420,28 @@ function xe(y) {
418
420
  allowClear: n = !0,
419
421
  selectOptionRender: m,
420
422
  formLayoutProps: N
421
- } = y, d = y.form, [F, k] = Q(""), H = V(() => X.getRealName(e), [e]), o = V(
423
+ } = y, s = y.form, [F, k] = Q(""), H = V(() => X.getRealName(e), [e]), o = V(
422
424
  () => X.getRealName(e, "upsertFieldName"),
423
425
  [e]
424
- ), x = L.useWatch(H, d), [S, O] = Q(!0);
426
+ ), x = O.useWatch(H, s), [L, S] = Q(!0);
425
427
  G(() => {
426
- C && S && x && (C == null || C(x, i, d), O(!1));
427
- }, [S, d, i, H, C, x]), G(() => {
428
- x && O(!0);
428
+ C && L && x && (C == null || C(x, i, s), S(!1));
429
+ }, [L, s, i, H, C, x]), G(() => {
430
+ x && S(!0);
429
431
  }, [x]);
430
432
  const Z = j(
431
433
  async (t) => {
432
- k(t), c && (u == null || u(t, d, P));
434
+ k(t), c && (u == null || u(t, s, P));
433
435
  },
434
- [d, u, c, P]
436
+ [s, u, c, P]
435
437
  ), ee = j(
436
438
  (t) => m ? m(t) : t.value,
437
439
  [m]
438
440
  ), B = U(), re = j(
439
441
  (t) => {
440
- B && B.search(), b && (k(""), b(t, d));
442
+ B && B.search(), b && (k(""), b(t, s));
441
443
  },
442
- [B, b, d]
444
+ [B, b, s]
443
445
  );
444
446
  return /* @__PURE__ */ r(
445
447
  Y,
@@ -464,27 +466,27 @@ function xe(y) {
464
466
  ),
465
467
  placeholder: a,
466
468
  onSelect: (t) => {
467
- C == null || C(t == null ? void 0 : t.key, i, d);
469
+ C == null || C(t == null ? void 0 : t.key, i, s);
468
470
  },
469
471
  onChange: re,
470
472
  mode: I ? "multiple" : void 0,
471
- className: ["w-100", p].join(" "),
473
+ className: ["w-100", f].join(" "),
472
474
  name: o,
473
475
  items: i,
474
476
  required: v,
475
477
  tooltip: R,
476
478
  tagRender: l,
477
479
  rules: w,
478
- disabled: !f,
480
+ disabled: !p,
479
481
  label: T,
480
482
  allowClear: n,
481
483
  onSearch: Z,
482
- loading: s,
484
+ loading: d,
483
485
  filterOption: h ? (t, g) => {
484
- var q, D, M;
486
+ var q, D, W;
485
487
  try {
486
- const W = t.toLowerCase().split(/\s+/), te = ((typeof (g == null ? void 0 : g.children) == "string" ? g == null ? void 0 : g.children : (D = (q = g == null ? void 0 : g.children) == null ? void 0 : q.props) == null ? void 0 : D.textToHighlight) ?? "").toLowerCase(), oe = (((M = g == null ? void 0 : g.value) == null ? void 0 : M.toString()) ?? "").toLowerCase();
487
- return W.every(
488
+ const M = t.toLowerCase().split(/\s+/), te = ((typeof (g == null ? void 0 : g.children) == "string" ? g == null ? void 0 : g.children : (D = (q = g == null ? void 0 : g.children) == null ? void 0 : q.props) == null ? void 0 : D.textToHighlight) ?? "").toLowerCase(), oe = (((W = g == null ? void 0 : g.value) == null ? void 0 : W.toString()) ?? "").toLowerCase();
489
+ return M.every(
488
490
  (_) => te.indexOf(_) >= 0 || oe.indexOf(_) >= 0
489
491
  );
490
492
  } catch {
@@ -527,25 +529,25 @@ function xe(y) {
527
529
  function ye(y) {
528
530
  const {
529
531
  formLayoutProps: i,
530
- required: s,
532
+ required: d,
531
533
  fieldClassName: c,
532
534
  rules: u,
533
535
  fieldTooltip: I,
534
536
  updatable: b,
535
537
  label: h,
536
538
  name: v,
537
- fieldHelper: p
539
+ fieldHelper: f
538
540
  } = y;
539
541
  return /* @__PURE__ */ r(
540
- L.Item,
542
+ O.Item,
541
543
  {
542
544
  ...i,
543
545
  label: h,
544
546
  name: v,
545
- required: s,
547
+ required: d,
546
548
  rules: u,
547
549
  tooltip: I,
548
- help: p,
550
+ help: f,
549
551
  getValueFromEvent: (w) => typeof w == "object" ? w.toHexString() : w,
550
552
  children: /* @__PURE__ */ r(
551
553
  ae,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.39.0",
4
+ "version": "1.40.0",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",