@kingteza/crud-component 1.38.0 → 1.39.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.
- package/dist/common/text-field/NumberField.cjs.js +1 -1
- package/dist/common/text-field/NumberField.d.ts +1 -0
- package/dist/common/text-field/NumberField.es.js +41 -40
- package/dist/crud/CrudComponent.d.ts +1 -0
- package/dist/crud/CrudField.cjs.js +1 -1
- package/dist/crud/CrudField.es.js +105 -103
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
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,31 +1,31 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import { Form as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { useTranslationLib as
|
|
5
|
-
import
|
|
6
|
-
import { onEnterInternalTextField as
|
|
7
|
-
const
|
|
8
|
-
function
|
|
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
9
|
return `${r ?? e ?? ""} ${i}`.trim();
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function Z(r) {
|
|
12
12
|
if (r == null) return "";
|
|
13
13
|
const e = String(r);
|
|
14
14
|
if (!e.includes("."))
|
|
15
|
-
return e.replace(
|
|
15
|
+
return e.replace(v, ",");
|
|
16
16
|
const [i, ...o] = e.split(".");
|
|
17
|
-
return [i.replace(
|
|
17
|
+
return [i.replace(v, ","), ...o].join(".");
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
return (r == null ? void 0 : r.replace(
|
|
19
|
+
function rr(r) {
|
|
20
|
+
return (r == null ? void 0 : r.replace(Q, "")) ?? "";
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function tr(r, e) {
|
|
23
23
|
return r == null ? "" : String(r).replace(e, "");
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function er(r, e) {
|
|
26
26
|
return r == null ? "" : r.replace(e, "");
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const fr = V(
|
|
29
29
|
function({
|
|
30
30
|
type: e,
|
|
31
31
|
required: i,
|
|
@@ -51,14 +51,15 @@ const ar = U(
|
|
|
51
51
|
isInt: n = !1,
|
|
52
52
|
tooltip: x,
|
|
53
53
|
help: A,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
step: C,
|
|
55
|
+
...K
|
|
56
|
+
}, k) {
|
|
57
|
+
const { t: f } = z(), u = N === null, c = n && !u, $ = a ?? o, j = p(() => {
|
|
57
58
|
const t = [
|
|
58
59
|
...m,
|
|
59
60
|
{
|
|
60
61
|
required: i,
|
|
61
|
-
message:
|
|
62
|
+
message: X(
|
|
62
63
|
o,
|
|
63
64
|
a,
|
|
64
65
|
f("err.validation.required")
|
|
@@ -67,36 +68,36 @@ const ar = U(
|
|
|
67
68
|
];
|
|
68
69
|
return n && t.push({
|
|
69
70
|
type: "number",
|
|
70
|
-
validator: async (
|
|
71
|
+
validator: async (nr, T) => {
|
|
71
72
|
if (!(T == null || Number.isInteger(T)))
|
|
72
73
|
throw new Error(f("err.validation.integer"));
|
|
73
74
|
}
|
|
74
75
|
}), t;
|
|
75
|
-
}, [m, o, a, f, i, n]),
|
|
76
|
-
if (s) return X;
|
|
77
|
-
if (c)
|
|
78
|
-
return (t) => rr(t, _);
|
|
79
|
-
}, [s, c]), B = p(() => {
|
|
76
|
+
}, [m, o, a, f, i, n]), B = p(() => {
|
|
80
77
|
if (s) return Z;
|
|
81
78
|
if (c)
|
|
82
|
-
return (t) => tr(t,
|
|
83
|
-
}, [s, c]), Y =
|
|
84
|
-
(
|
|
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),
|
|
85
86
|
[E, g, d]
|
|
86
|
-
),
|
|
87
|
+
), G = _(
|
|
87
88
|
(t) => {
|
|
88
89
|
if (!u && t.key === "-") {
|
|
89
90
|
t.preventDefault();
|
|
90
91
|
return;
|
|
91
92
|
}
|
|
92
|
-
|
|
93
|
+
W.has(t.key) && t.preventDefault();
|
|
93
94
|
},
|
|
94
95
|
[u]
|
|
95
96
|
);
|
|
96
|
-
return /* @__PURE__ */ l(
|
|
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
99
|
{
|
|
99
|
-
ref:
|
|
100
|
+
ref: k,
|
|
100
101
|
disabled: b,
|
|
101
102
|
defaultValue: R,
|
|
102
103
|
value: L,
|
|
@@ -104,25 +105,25 @@ const ar = U(
|
|
|
104
105
|
addonBefore: M,
|
|
105
106
|
minLength: P,
|
|
106
107
|
addonAfter: w,
|
|
107
|
-
step: n ? 1 :
|
|
108
|
+
step: n ? 1 : C,
|
|
108
109
|
inputMode: n ? "numeric" : void 0,
|
|
109
110
|
pattern: n ? u ? "-?[0-9]*" : "[0-9]*" : S,
|
|
110
111
|
precision: n ? 0 : void 0,
|
|
111
112
|
onChange: D,
|
|
112
|
-
onPressEnter:
|
|
113
|
+
onPressEnter: q,
|
|
113
114
|
className: "max-width",
|
|
114
115
|
min: u ? void 0 : N ?? 0,
|
|
115
116
|
max: I,
|
|
116
117
|
type: s ? void 0 : "number",
|
|
117
118
|
size: O,
|
|
118
|
-
formatter:
|
|
119
|
-
parser:
|
|
120
|
-
onKeyDown: n ?
|
|
121
|
-
placeholder:
|
|
119
|
+
formatter: B,
|
|
120
|
+
parser: Y,
|
|
121
|
+
onKeyDown: n ? G : void 0,
|
|
122
|
+
placeholder: $
|
|
122
123
|
}
|
|
123
124
|
) }) });
|
|
124
125
|
}
|
|
125
126
|
);
|
|
126
127
|
export {
|
|
127
|
-
|
|
128
|
+
fr as default
|
|
128
129
|
};
|
|
@@ -170,6 +170,7 @@ export interface NumberBasedFieldProps<T> extends InitialCrudField<T>, AddonFiel
|
|
|
170
170
|
*/
|
|
171
171
|
formatted?: boolean;
|
|
172
172
|
int?: boolean;
|
|
173
|
+
step?: number;
|
|
173
174
|
onChange?: (value: number, form: FormInstance<T>) => void;
|
|
174
175
|
}
|
|
175
176
|
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(
|
|
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;
|
|
@@ -10,13 +10,13 @@ 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
|
|
14
|
-
import
|
|
13
|
+
import pe from "../common/text-field/PhoneNumberField.es.js";
|
|
14
|
+
import fe 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";
|
|
18
18
|
import { useCrudSearchContext as U } from "../context/CrudSearchContext.es.js";
|
|
19
|
-
function Ue(
|
|
19
|
+
function Ue(y) {
|
|
20
20
|
const {
|
|
21
21
|
label: i,
|
|
22
22
|
name: s,
|
|
@@ -25,14 +25,14 @@ function Ue(x) {
|
|
|
25
25
|
hidden: I,
|
|
26
26
|
rules: b = [],
|
|
27
27
|
updatable: h = !0,
|
|
28
|
-
readonly:
|
|
29
|
-
fieldClassName:
|
|
28
|
+
readonly: v = !1,
|
|
29
|
+
fieldClassName: p,
|
|
30
30
|
customFormFieldRender: w,
|
|
31
31
|
fieldTooltip: R,
|
|
32
|
-
fieldHelper:
|
|
32
|
+
fieldHelper: f,
|
|
33
33
|
formLayoutProps: T,
|
|
34
34
|
...e
|
|
35
|
-
} =
|
|
35
|
+
} = y, l = L.useFormInstance();
|
|
36
36
|
G(() => {
|
|
37
37
|
if (c === "select") {
|
|
38
38
|
const {
|
|
@@ -44,18 +44,18 @@ function Ue(x) {
|
|
|
44
44
|
}
|
|
45
45
|
}, [l, e, c, e == null ? void 0 : e.updatingValue]);
|
|
46
46
|
const P = U(), C = j((a, n) => {
|
|
47
|
-
P && P.search(), !
|
|
48
|
-
}, [P,
|
|
49
|
-
if (
|
|
47
|
+
P && P.search(), !v && n && n(a, l);
|
|
48
|
+
}, [P, v, l]);
|
|
49
|
+
if (v || I) return /* @__PURE__ */ r(A, {});
|
|
50
50
|
if (w)
|
|
51
|
-
return w(l,
|
|
51
|
+
return w(l, y);
|
|
52
52
|
switch (c) {
|
|
53
53
|
case "text":
|
|
54
54
|
case "email":
|
|
55
55
|
case "password": {
|
|
56
|
-
const { maxLength: a, onChange: n, placeholder: m, addonAfter:
|
|
56
|
+
const { maxLength: a, onChange: n, placeholder: m, addonAfter: N, addonBefore: d } = e;
|
|
57
57
|
return /* @__PURE__ */ r(
|
|
58
|
-
|
|
58
|
+
fe,
|
|
59
59
|
{
|
|
60
60
|
...T,
|
|
61
61
|
maxLength: a,
|
|
@@ -63,23 +63,23 @@ function Ue(x) {
|
|
|
63
63
|
disabled: !h,
|
|
64
64
|
rules: b,
|
|
65
65
|
required: u,
|
|
66
|
-
onChange: n ? (
|
|
66
|
+
onChange: n ? (F) => n(F, l) : void 0,
|
|
67
67
|
type: c,
|
|
68
68
|
name: s,
|
|
69
69
|
tooltip: R,
|
|
70
70
|
label: i,
|
|
71
|
-
className:
|
|
71
|
+
className: p,
|
|
72
72
|
autoComplete: "new-password",
|
|
73
|
-
addonAfter:
|
|
73
|
+
addonAfter: N,
|
|
74
74
|
addonBefore: d,
|
|
75
|
-
help:
|
|
75
|
+
help: f
|
|
76
76
|
}
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
case "phone": {
|
|
80
|
-
const { onChange: a, placeholder: n, addonAfter: m, addonBefore:
|
|
80
|
+
const { onChange: a, placeholder: n, addonAfter: m, addonBefore: N } = e;
|
|
81
81
|
return /* @__PURE__ */ r(
|
|
82
|
-
|
|
82
|
+
pe,
|
|
83
83
|
{
|
|
84
84
|
...e,
|
|
85
85
|
...T,
|
|
@@ -92,11 +92,11 @@ function Ue(x) {
|
|
|
92
92
|
name: s,
|
|
93
93
|
tooltip: R,
|
|
94
94
|
label: i,
|
|
95
|
-
className:
|
|
95
|
+
className: p,
|
|
96
96
|
autoComplete: "new-password",
|
|
97
97
|
addonAfter: m,
|
|
98
|
-
addonBefore:
|
|
99
|
-
help:
|
|
98
|
+
addonBefore: N,
|
|
99
|
+
help: f
|
|
100
100
|
}
|
|
101
101
|
);
|
|
102
102
|
}
|
|
@@ -105,33 +105,35 @@ function Ue(x) {
|
|
|
105
105
|
onChange: a,
|
|
106
106
|
placeholder: n,
|
|
107
107
|
allowMinus: m,
|
|
108
|
-
min:
|
|
108
|
+
min: N,
|
|
109
109
|
max: d,
|
|
110
|
-
addonAfter:
|
|
110
|
+
addonAfter: F,
|
|
111
111
|
addonBefore: k,
|
|
112
|
-
int: H
|
|
112
|
+
int: H,
|
|
113
|
+
step: o
|
|
113
114
|
} = e;
|
|
114
115
|
return /* @__PURE__ */ r(
|
|
115
116
|
he,
|
|
116
117
|
{
|
|
117
118
|
...T,
|
|
119
|
+
step: o,
|
|
118
120
|
placeholder: n,
|
|
119
121
|
disabled: !h,
|
|
120
122
|
moneyField: !!e.formatted,
|
|
121
123
|
type: c,
|
|
122
|
-
onChange: a ? (
|
|
124
|
+
onChange: a ? (x) => a(x, l) : void 0,
|
|
123
125
|
rules: b,
|
|
124
126
|
autoComplete: "false",
|
|
125
127
|
required: u,
|
|
126
128
|
tooltip: R,
|
|
127
|
-
className:
|
|
128
|
-
min: m ? null :
|
|
129
|
+
className: p,
|
|
130
|
+
min: m ? null : N,
|
|
129
131
|
max: d,
|
|
130
|
-
addonAfter:
|
|
132
|
+
addonAfter: F,
|
|
131
133
|
addonBefore: k,
|
|
132
134
|
name: s,
|
|
133
135
|
label: i,
|
|
134
|
-
help:
|
|
136
|
+
help: f,
|
|
135
137
|
isInt: H
|
|
136
138
|
}
|
|
137
139
|
);
|
|
@@ -141,16 +143,16 @@ function Ue(x) {
|
|
|
141
143
|
range: a,
|
|
142
144
|
disableToday: n,
|
|
143
145
|
disabledFutureDays: m,
|
|
144
|
-
disabledPastDays:
|
|
146
|
+
disabledPastDays: N,
|
|
145
147
|
onChange: d,
|
|
146
|
-
placeholder:
|
|
148
|
+
placeholder: F,
|
|
147
149
|
format: k
|
|
148
150
|
} = e;
|
|
149
151
|
return /* @__PURE__ */ r(
|
|
150
152
|
me,
|
|
151
153
|
{
|
|
152
154
|
...T,
|
|
153
|
-
placeholder:
|
|
155
|
+
placeholder: F,
|
|
154
156
|
required: u,
|
|
155
157
|
disabled: !h,
|
|
156
158
|
type: c,
|
|
@@ -160,11 +162,11 @@ function Ue(x) {
|
|
|
160
162
|
name: s,
|
|
161
163
|
label: i,
|
|
162
164
|
onChange: C,
|
|
163
|
-
className:
|
|
165
|
+
className: p,
|
|
164
166
|
disableToday: n,
|
|
165
167
|
disabledFutureDays: m,
|
|
166
|
-
disabledPastDays:
|
|
167
|
-
help:
|
|
168
|
+
disabledPastDays: N,
|
|
169
|
+
help: f
|
|
168
170
|
}
|
|
169
171
|
);
|
|
170
172
|
}
|
|
@@ -173,9 +175,9 @@ function Ue(x) {
|
|
|
173
175
|
range: a = !1,
|
|
174
176
|
disableCurrent: n,
|
|
175
177
|
disabledFuture: m,
|
|
176
|
-
disabledPast:
|
|
178
|
+
disabledPast: N,
|
|
177
179
|
onChange: d,
|
|
178
|
-
use12Hours:
|
|
180
|
+
use12Hours: F,
|
|
179
181
|
format: k,
|
|
180
182
|
placeholder: H
|
|
181
183
|
} = e;
|
|
@@ -190,20 +192,20 @@ function Ue(x) {
|
|
|
190
192
|
type: c,
|
|
191
193
|
tooltip: R,
|
|
192
194
|
range: a,
|
|
193
|
-
use12Hours:
|
|
195
|
+
use12Hours: F,
|
|
194
196
|
name: s,
|
|
195
197
|
label: i,
|
|
196
198
|
onChange: C,
|
|
197
|
-
className:
|
|
199
|
+
className: p,
|
|
198
200
|
disableCurrent: n,
|
|
199
201
|
disabledFuture: m,
|
|
200
|
-
disabledPast:
|
|
201
|
-
help:
|
|
202
|
+
disabledPast: N,
|
|
203
|
+
help: f
|
|
202
204
|
}
|
|
203
205
|
);
|
|
204
206
|
}
|
|
205
207
|
case "textarea":
|
|
206
|
-
return /* @__PURE__ */ r(Ce, { ...
|
|
208
|
+
return /* @__PURE__ */ r(Ce, { ...y });
|
|
207
209
|
case "image":
|
|
208
210
|
return /* @__PURE__ */ r(
|
|
209
211
|
se,
|
|
@@ -213,8 +215,8 @@ function Ue(x) {
|
|
|
213
215
|
name: s,
|
|
214
216
|
label: i,
|
|
215
217
|
rules: b,
|
|
216
|
-
fieldHelper:
|
|
217
|
-
fieldClassName:
|
|
218
|
+
fieldHelper: f,
|
|
219
|
+
fieldClassName: p,
|
|
218
220
|
onRemoved: e.onRemoved,
|
|
219
221
|
onUploading: e.onUploading,
|
|
220
222
|
provider: e.provider
|
|
@@ -229,8 +231,8 @@ function Ue(x) {
|
|
|
229
231
|
name: s,
|
|
230
232
|
label: i,
|
|
231
233
|
rules: b,
|
|
232
|
-
fieldHelper:
|
|
233
|
-
fieldClassName:
|
|
234
|
+
fieldHelper: f,
|
|
235
|
+
fieldClassName: p,
|
|
234
236
|
onRemoved: e.onRemoved,
|
|
235
237
|
onUploading: e.onUploading,
|
|
236
238
|
provider: e.provider
|
|
@@ -245,31 +247,31 @@ function Ue(x) {
|
|
|
245
247
|
name: s,
|
|
246
248
|
label: i,
|
|
247
249
|
rules: b,
|
|
248
|
-
fieldClassName:
|
|
250
|
+
fieldClassName: p,
|
|
249
251
|
form: l,
|
|
250
|
-
help:
|
|
252
|
+
help: f,
|
|
251
253
|
updatable: h,
|
|
252
|
-
readonly:
|
|
254
|
+
readonly: v,
|
|
253
255
|
fieldTooltip: R,
|
|
254
|
-
fieldHelper:
|
|
256
|
+
fieldHelper: f
|
|
255
257
|
}
|
|
256
258
|
);
|
|
257
259
|
case "enum":
|
|
258
|
-
return /* @__PURE__ */ r(be, { ...
|
|
260
|
+
return /* @__PURE__ */ r(be, { ...y });
|
|
259
261
|
case "checkbox": {
|
|
260
262
|
const { onChange: a, switch: n } = e;
|
|
261
263
|
return /* @__PURE__ */ r(
|
|
262
264
|
ce,
|
|
263
265
|
{
|
|
264
266
|
...T,
|
|
265
|
-
className:
|
|
267
|
+
className: p,
|
|
266
268
|
rules: b,
|
|
267
269
|
onChange: C,
|
|
268
270
|
label: i,
|
|
269
271
|
tooltip: R,
|
|
270
272
|
disabled: !h,
|
|
271
273
|
name: s,
|
|
272
|
-
help:
|
|
274
|
+
help: f,
|
|
273
275
|
switch: n
|
|
274
276
|
}
|
|
275
277
|
);
|
|
@@ -284,18 +286,18 @@ function Ue(x) {
|
|
|
284
286
|
name: s,
|
|
285
287
|
label: i,
|
|
286
288
|
rules: b,
|
|
287
|
-
fieldClassName:
|
|
289
|
+
fieldClassName: p,
|
|
288
290
|
updatable: h,
|
|
289
|
-
readonly:
|
|
291
|
+
readonly: v,
|
|
290
292
|
fieldTooltip: R,
|
|
291
|
-
fieldHelper:
|
|
293
|
+
fieldHelper: f
|
|
292
294
|
}
|
|
293
295
|
);
|
|
294
296
|
default:
|
|
295
297
|
return /* @__PURE__ */ r(A, { children: `${c} Not Implemented` });
|
|
296
298
|
}
|
|
297
299
|
}
|
|
298
|
-
function be(
|
|
300
|
+
function be(y) {
|
|
299
301
|
const i = L.useFormInstance(), {
|
|
300
302
|
label: s,
|
|
301
303
|
name: c,
|
|
@@ -303,26 +305,26 @@ function be(x) {
|
|
|
303
305
|
required: I,
|
|
304
306
|
hidden: b,
|
|
305
307
|
rules: h = [],
|
|
306
|
-
updatable:
|
|
307
|
-
readonly:
|
|
308
|
+
updatable: v = !0,
|
|
309
|
+
readonly: p = !1,
|
|
308
310
|
fieldClassName: w,
|
|
309
311
|
customFormFieldRender: R,
|
|
310
|
-
fieldTooltip:
|
|
312
|
+
fieldTooltip: f,
|
|
311
313
|
fieldHelper: T,
|
|
312
314
|
formLayoutProps: e,
|
|
313
315
|
...l
|
|
314
|
-
} =
|
|
316
|
+
} = y, { t: P } = ie(), {
|
|
315
317
|
enum: C,
|
|
316
318
|
translation: a,
|
|
317
319
|
onChange: n,
|
|
318
320
|
onSearch: m,
|
|
319
|
-
multiple:
|
|
321
|
+
multiple: N,
|
|
320
322
|
tagRender: d
|
|
321
|
-
} = l,
|
|
323
|
+
} = l, F = Array.isArray(C) ? C : Object.keys(C), k = U(), H = j(
|
|
322
324
|
(o) => {
|
|
323
|
-
k && k.search(), !
|
|
325
|
+
k && k.search(), !p && n && n(o, i);
|
|
324
326
|
},
|
|
325
|
-
[k,
|
|
327
|
+
[k, p, n, i]
|
|
326
328
|
);
|
|
327
329
|
return "radio" in l && l.radio ? /* @__PURE__ */ r(
|
|
328
330
|
L.Item,
|
|
@@ -331,7 +333,7 @@ function be(x) {
|
|
|
331
333
|
...e,
|
|
332
334
|
name: c,
|
|
333
335
|
required: I,
|
|
334
|
-
tooltip:
|
|
336
|
+
tooltip: f,
|
|
335
337
|
rules: h,
|
|
336
338
|
label: s,
|
|
337
339
|
className: ["w-100", w].join(" "),
|
|
@@ -341,10 +343,10 @@ function be(x) {
|
|
|
341
343
|
{
|
|
342
344
|
...l,
|
|
343
345
|
onChange: (o) => {
|
|
344
|
-
var
|
|
345
|
-
return H((
|
|
346
|
+
var x;
|
|
347
|
+
return H((x = o == null ? void 0 : o.target) == null ? void 0 : x.value);
|
|
346
348
|
},
|
|
347
|
-
children:
|
|
349
|
+
children: F.map((o) => /* @__PURE__ */ r(z, { disabled: !v, value: o, children: a ? P(a[o]) : o }, o))
|
|
348
350
|
}
|
|
349
351
|
)
|
|
350
352
|
}
|
|
@@ -355,14 +357,14 @@ function be(x) {
|
|
|
355
357
|
...e,
|
|
356
358
|
name: c,
|
|
357
359
|
required: I,
|
|
358
|
-
tooltip:
|
|
360
|
+
tooltip: f,
|
|
359
361
|
rules: h,
|
|
360
362
|
label: s,
|
|
361
363
|
className: ["w-100", w].join(" "),
|
|
362
364
|
help: T,
|
|
363
|
-
children: /* @__PURE__ */ r(J.Group, { className: "w-100", onChange: H, children:
|
|
364
|
-
const
|
|
365
|
-
return "checkboxGrid" in l && l.checkboxGrid ? /* @__PURE__ */ r(ne, { ...l.checkboxGrid, children:
|
|
365
|
+
children: /* @__PURE__ */ r(J.Group, { className: "w-100", onChange: H, children: F.map((o) => {
|
|
366
|
+
const x = /* @__PURE__ */ r(J, { disabled: !v, value: o, children: a ? P(a[o]) : o }, o);
|
|
367
|
+
return "checkboxGrid" in l && l.checkboxGrid ? /* @__PURE__ */ r(ne, { ...l.checkboxGrid, children: x }) : x;
|
|
366
368
|
}) })
|
|
367
369
|
}
|
|
368
370
|
) : /* @__PURE__ */ r(
|
|
@@ -372,28 +374,28 @@ function be(x) {
|
|
|
372
374
|
...e,
|
|
373
375
|
notSearch: !0,
|
|
374
376
|
tagRender: typeof d == "function" ? d : d ? (o) => {
|
|
375
|
-
const { value:
|
|
377
|
+
const { value: x, label: S } = o, O = d[x];
|
|
376
378
|
return O ? /* @__PURE__ */ r(K, { color: O.color, children: S }) : /* @__PURE__ */ r(K, { children: S });
|
|
377
379
|
} : void 0,
|
|
378
380
|
onChange: H,
|
|
379
381
|
className: ["w-100", w].join(" "),
|
|
380
382
|
name: c,
|
|
381
|
-
items:
|
|
383
|
+
items: F,
|
|
382
384
|
required: I,
|
|
383
|
-
tooltip:
|
|
385
|
+
tooltip: f,
|
|
384
386
|
rules: h,
|
|
385
387
|
label: s,
|
|
386
388
|
help: T,
|
|
387
|
-
disabled: !
|
|
389
|
+
disabled: !v,
|
|
388
390
|
onSearch: m ? (o) => m(o, i) : void 0,
|
|
389
391
|
allowClear: !0,
|
|
390
|
-
mode:
|
|
392
|
+
mode: N ? "multiple" : void 0,
|
|
391
393
|
showLoadingInEmptyIndicator: !0,
|
|
392
394
|
itemBuilder: (o) => /* @__PURE__ */ r(E.Option, { value: o, children: a ? P(a[o]) : o }, o)
|
|
393
395
|
}
|
|
394
396
|
);
|
|
395
397
|
}
|
|
396
|
-
function xe(
|
|
398
|
+
function xe(y) {
|
|
397
399
|
const {
|
|
398
400
|
items: i = [],
|
|
399
401
|
loading: s,
|
|
@@ -402,11 +404,11 @@ function xe(x) {
|
|
|
402
404
|
multiple: I,
|
|
403
405
|
onChange: b,
|
|
404
406
|
highlightSearch: h,
|
|
405
|
-
required:
|
|
406
|
-
fieldClassName:
|
|
407
|
+
required: v,
|
|
408
|
+
fieldClassName: p,
|
|
407
409
|
rules: w,
|
|
408
410
|
fieldTooltip: R,
|
|
409
|
-
updatable:
|
|
411
|
+
updatable: f,
|
|
410
412
|
label: T,
|
|
411
413
|
name: e,
|
|
412
414
|
tagRender: l,
|
|
@@ -415,16 +417,16 @@ function xe(x) {
|
|
|
415
417
|
placeholder: a,
|
|
416
418
|
allowClear: n = !0,
|
|
417
419
|
selectOptionRender: m,
|
|
418
|
-
formLayoutProps:
|
|
419
|
-
} =
|
|
420
|
+
formLayoutProps: N
|
|
421
|
+
} = y, d = y.form, [F, k] = Q(""), H = V(() => X.getRealName(e), [e]), o = V(
|
|
420
422
|
() => X.getRealName(e, "upsertFieldName"),
|
|
421
423
|
[e]
|
|
422
|
-
),
|
|
424
|
+
), x = L.useWatch(H, d), [S, O] = Q(!0);
|
|
423
425
|
G(() => {
|
|
424
|
-
C && S &&
|
|
425
|
-
}, [S, d, i, H, C,
|
|
426
|
-
|
|
427
|
-
}, [
|
|
426
|
+
C && S && x && (C == null || C(x, i, d), O(!1));
|
|
427
|
+
}, [S, d, i, H, C, x]), G(() => {
|
|
428
|
+
x && O(!0);
|
|
429
|
+
}, [x]);
|
|
428
430
|
const Z = j(
|
|
429
431
|
async (t) => {
|
|
430
432
|
k(t), c && (u == null || u(t, d, P));
|
|
@@ -442,8 +444,8 @@ function xe(x) {
|
|
|
442
444
|
return /* @__PURE__ */ r(
|
|
443
445
|
Y,
|
|
444
446
|
{
|
|
445
|
-
...
|
|
446
|
-
...
|
|
447
|
+
...y,
|
|
448
|
+
...N,
|
|
447
449
|
showLoadingInEmptyIndicator: !0,
|
|
448
450
|
maxTagCount: "responsive",
|
|
449
451
|
maxTagPlaceholder: (t) => /* @__PURE__ */ $(
|
|
@@ -466,14 +468,14 @@ function xe(x) {
|
|
|
466
468
|
},
|
|
467
469
|
onChange: re,
|
|
468
470
|
mode: I ? "multiple" : void 0,
|
|
469
|
-
className: ["w-100",
|
|
471
|
+
className: ["w-100", p].join(" "),
|
|
470
472
|
name: o,
|
|
471
473
|
items: i,
|
|
472
|
-
required:
|
|
474
|
+
required: v,
|
|
473
475
|
tooltip: R,
|
|
474
476
|
tagRender: l,
|
|
475
477
|
rules: w,
|
|
476
|
-
disabled: !
|
|
478
|
+
disabled: !f,
|
|
477
479
|
label: T,
|
|
478
480
|
allowClear: n,
|
|
479
481
|
onSearch: Z,
|
|
@@ -501,7 +503,7 @@ function xe(x) {
|
|
|
501
503
|
le,
|
|
502
504
|
{
|
|
503
505
|
highlightClassName: "highlight-text",
|
|
504
|
-
searchWords: (
|
|
506
|
+
searchWords: (F ?? "").split(" "),
|
|
505
507
|
autoEscape: !0,
|
|
506
508
|
textToHighlight: g ?? ""
|
|
507
509
|
}
|
|
@@ -522,7 +524,7 @@ function xe(x) {
|
|
|
522
524
|
}
|
|
523
525
|
);
|
|
524
526
|
}
|
|
525
|
-
function ye(
|
|
527
|
+
function ye(y) {
|
|
526
528
|
const {
|
|
527
529
|
formLayoutProps: i,
|
|
528
530
|
required: s,
|
|
@@ -531,19 +533,19 @@ function ye(x) {
|
|
|
531
533
|
fieldTooltip: I,
|
|
532
534
|
updatable: b,
|
|
533
535
|
label: h,
|
|
534
|
-
name:
|
|
535
|
-
fieldHelper:
|
|
536
|
-
} =
|
|
536
|
+
name: v,
|
|
537
|
+
fieldHelper: p
|
|
538
|
+
} = y;
|
|
537
539
|
return /* @__PURE__ */ r(
|
|
538
540
|
L.Item,
|
|
539
541
|
{
|
|
540
542
|
...i,
|
|
541
543
|
label: h,
|
|
542
|
-
name:
|
|
544
|
+
name: v,
|
|
543
545
|
required: s,
|
|
544
546
|
rules: u,
|
|
545
547
|
tooltip: I,
|
|
546
|
-
help:
|
|
548
|
+
help: p,
|
|
547
549
|
getValueFromEvent: (w) => typeof w == "object" ? w.toHexString() : w,
|
|
548
550
|
children: /* @__PURE__ */ r(
|
|
549
551
|
ae,
|
|
@@ -555,7 +557,7 @@ function ye(x) {
|
|
|
555
557
|
trigger: "click",
|
|
556
558
|
className: c,
|
|
557
559
|
disabled: !b,
|
|
558
|
-
...
|
|
560
|
+
...y.innerProps
|
|
559
561
|
}
|
|
560
562
|
)
|
|
561
563
|
}
|