@kingteza/crud-component 1.4.0 → 1.4.1
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/rich/index.cjs.js +1 -1
- package/dist/common/rich/index.d.ts +2 -1
- package/dist/common/rich/index.es.js +19 -18
- package/dist/common/select/SelectComponent.cjs.js +1 -1
- package/dist/common/select/SelectComponent.d.ts +1 -1
- package/dist/common/select/SelectComponent.es.js +22 -21
- package/dist/crud/CrudField.cjs.js +1 -1
- package/dist/crud/CrudField.es.js +149 -146
- package/dist/crud/CrudTextAreaComponent.cjs.js +1 -1
- package/dist/crud/CrudTextAreaComponent.es.js +37 -35
- package/dist/crud/FileCrudField.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var q=Object.create;var p=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var R=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of j(t))!w.call(e,o)&&o!==r&&p(e,o,{get:()=>t[o],enumerable:!(s=V(t,o))||s.enumerable});return e};var y=(e,t,r)=>(r=e!=null?q(F(e)):{},R(t||!e||!e.__esModule?p(r,"default",{value:e,enumerable:!0}):r,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime");;/* empty css */;/* empty css */const h=require("antd"),c=require("react"),E=require("../../util/ValidationUtil.cjs.js"),S=c.lazy(async()=>{const{default:e}=await import("react-quill");return{default:t=>a.jsx(e,{...t})}}),T=({name:e,label:t,required:r,rules:s=[],disabled:o,help:f})=>{const n=h.Form.useFormInstance(),[u,d]=c.useState(""),b={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],["link"],["clean"]]},k=["bold","italic","underline","strike","blockquote","list","bullet","link"];c.useEffect(()=>{const i=n.getFieldValue(e);i&&i!=="<p></p>"&&i!=="<p><br></p>"&&d(i)},[n,e]);const l=h.Form.useWatch(e,n);c.useEffect(()=>{l!==u&&d(!l||l==="<p></p>"||l==="<p><br></p>"?"":l)},[l,u]);const m=i=>{d(i);const g=!i||i==="<p></p>"||i.trim()==="<p><br></p>"?void 0:i;n.setFieldValue(e,g),n.validateFields([e]).catch(()=>{})},x=c.useMemo(()=>r?[...s,...E.required(t??"")]:s,[r,s,t]);return a.jsx(h.Form.Item,{help:f,name:e,label:t,rules:x,children:a.jsx(c.Suspense,{fallback:a.jsx("div",{children:"Loading editor..."}),children:a.jsx(S,{readOnly:o,value:u,onChange:m,theme:"snow",className:"bg-white dark:!bg-[#141414] dark:text-white dark:!fill-white",modules:b,formats:k})})})};exports.RichTextEditor=T;
|
|
@@ -2,26 +2,27 @@ import { jsx as l } from "react/jsx-runtime";
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
/* empty css */
|
|
4
4
|
import { Form as a } from "antd";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const
|
|
5
|
+
import g, { useState as w, useEffect as u, useMemo as F, Suspense as x } from "react";
|
|
6
|
+
import R from "../../util/ValidationUtil.es.js";
|
|
7
|
+
const y = g.lazy(async () => {
|
|
8
8
|
const { default: e } = await import("react-quill");
|
|
9
9
|
return { default: (o) => /* @__PURE__ */ l(e, { ...o }) };
|
|
10
|
-
}),
|
|
10
|
+
}), j = ({
|
|
11
11
|
name: e,
|
|
12
12
|
label: o,
|
|
13
13
|
required: d,
|
|
14
14
|
rules: c = [],
|
|
15
|
-
disabled: p
|
|
15
|
+
disabled: p,
|
|
16
|
+
help: m
|
|
16
17
|
}) => {
|
|
17
|
-
const r = a.useFormInstance(), [n, s] =
|
|
18
|
+
const r = a.useFormInstance(), [n, s] = w(""), f = {
|
|
18
19
|
toolbar: [
|
|
19
20
|
["bold", "italic", "underline", "strike", "blockquote"],
|
|
20
21
|
[{ list: "ordered" }, { list: "bullet" }],
|
|
21
22
|
["link"],
|
|
22
23
|
["clean"]
|
|
23
24
|
]
|
|
24
|
-
},
|
|
25
|
+
}, h = [
|
|
25
26
|
"bold",
|
|
26
27
|
"italic",
|
|
27
28
|
"underline",
|
|
@@ -39,28 +40,28 @@ const R = V.lazy(async () => {
|
|
|
39
40
|
u(() => {
|
|
40
41
|
i !== n && s(!i || i === "<p></p>" || i === "<p><br></p>" ? "" : i);
|
|
41
42
|
}, [i, n]);
|
|
42
|
-
const
|
|
43
|
+
const b = (t) => {
|
|
43
44
|
s(t);
|
|
44
|
-
const
|
|
45
|
-
r.setFieldValue(e,
|
|
45
|
+
const V = !t || t === "<p></p>" || t.trim() === "<p><br></p>" ? void 0 : t;
|
|
46
|
+
r.setFieldValue(e, V), r.validateFields([e]).catch(() => {
|
|
46
47
|
});
|
|
47
|
-
},
|
|
48
|
-
() => d ? [...c, ...
|
|
48
|
+
}, k = F(
|
|
49
|
+
() => d ? [...c, ...R.required(o ?? "")] : c,
|
|
49
50
|
[d, c, o]
|
|
50
51
|
);
|
|
51
|
-
return /* @__PURE__ */ l(a.Item, { name: e, label: o, rules:
|
|
52
|
-
|
|
52
|
+
return /* @__PURE__ */ l(a.Item, { help: m, name: e, label: o, rules: k, children: /* @__PURE__ */ l(x, { fallback: /* @__PURE__ */ l("div", { children: "Loading editor..." }), children: /* @__PURE__ */ l(
|
|
53
|
+
y,
|
|
53
54
|
{
|
|
54
55
|
readOnly: p,
|
|
55
56
|
value: n,
|
|
56
|
-
onChange:
|
|
57
|
+
onChange: b,
|
|
57
58
|
theme: "snow",
|
|
58
59
|
className: "bg-white dark:!bg-[#141414] dark:text-white dark:!fill-white",
|
|
59
|
-
modules:
|
|
60
|
-
formats:
|
|
60
|
+
modules: f,
|
|
61
|
+
formats: h
|
|
61
62
|
}
|
|
62
63
|
) }) });
|
|
63
64
|
};
|
|
64
65
|
export {
|
|
65
|
-
|
|
66
|
+
j as RichTextEditor
|
|
66
67
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
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;
|
|
@@ -17,5 +17,5 @@ interface SelectComponentProps<T> extends SelectProps<any>, FormItemProps<any> {
|
|
|
17
17
|
filterOption?: SelectProps["filterOption"];
|
|
18
18
|
tagRender?: SelectTagRenderProps;
|
|
19
19
|
}
|
|
20
|
-
declare function SelectComponent<T = any>({ label, rules, required, placeholder, notSearch, children, readOnly, items, dropdownRender, itemBuilder, loading, showLoadingInEmptyIndicator, nameFieldInArray, innerRef, tooltip, filterOption, tagRender, ...props }: Readonly<SelectComponentProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare function SelectComponent<T = any>({ label, rules, required, placeholder, notSearch, children, readOnly, items, dropdownRender, itemBuilder, loading, showLoadingInEmptyIndicator, nameFieldInArray, innerRef, tooltip, filterOption, tagRender, help, ...props }: Readonly<SelectComponentProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
21
21
|
export default SelectComponent;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as t, Fragment as
|
|
2
|
-
import { ConfigProvider as
|
|
3
|
-
import { useCallback as
|
|
4
|
-
import { useTranslationLib as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
function
|
|
1
|
+
import { jsx as t, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import { ConfigProvider as D, Form as E, Select as P, Spin as R } from "antd";
|
|
3
|
+
import { useCallback as U } from "react";
|
|
4
|
+
import { useTranslationLib as W } from "../../locale/index.es.js";
|
|
5
|
+
import $ from "../tooltip/TooltipComponent.es.js";
|
|
6
|
+
import q from "../../util/ValidationUtil.es.js";
|
|
7
|
+
function Z({
|
|
8
8
|
label: m,
|
|
9
9
|
rules: S = [],
|
|
10
10
|
required: f,
|
|
@@ -22,33 +22,34 @@ function Y({
|
|
|
22
22
|
tooltip: N,
|
|
23
23
|
filterOption: k,
|
|
24
24
|
tagRender: F,
|
|
25
|
+
help: H,
|
|
25
26
|
...n
|
|
26
27
|
}) {
|
|
27
|
-
const { t:
|
|
28
|
+
const { t: z } = W(), I = U(
|
|
28
29
|
(e) => {
|
|
29
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];
|
|
30
31
|
return /* @__PURE__ */ t("option", { value: r, children: /* @__PURE__ */ t("div", { dangerouslySetInnerHTML: { __html: c } }) }, r);
|
|
31
32
|
},
|
|
32
33
|
[g]
|
|
33
|
-
),
|
|
34
|
+
), M = m ?? a ?? "";
|
|
34
35
|
return /* @__PURE__ */ t(
|
|
35
|
-
|
|
36
|
+
D,
|
|
36
37
|
{
|
|
37
|
-
renderEmpty: _ && h ? () => /* @__PURE__ */ t(
|
|
38
|
-
children: /* @__PURE__ */ t(
|
|
39
|
-
|
|
38
|
+
renderEmpty: _ && h ? () => /* @__PURE__ */ t(R, {}) : void 0,
|
|
39
|
+
children: /* @__PURE__ */ t($, { title: N, children: /* @__PURE__ */ t(
|
|
40
|
+
E.Item,
|
|
40
41
|
{
|
|
41
42
|
label: m,
|
|
42
43
|
name: n.name,
|
|
43
|
-
help:
|
|
44
|
+
help: H,
|
|
44
45
|
className: n.className,
|
|
45
46
|
required: f,
|
|
46
47
|
rules: [
|
|
47
48
|
...S,
|
|
48
|
-
...f ?
|
|
49
|
+
...f ? q.required(M) : []
|
|
49
50
|
],
|
|
50
51
|
children: /* @__PURE__ */ t(
|
|
51
|
-
|
|
52
|
+
P,
|
|
52
53
|
{
|
|
53
54
|
ref: b,
|
|
54
55
|
loading: h,
|
|
@@ -63,16 +64,16 @@ function Y({
|
|
|
63
64
|
filterOption: k ?? ((e, r) => {
|
|
64
65
|
var c, p, C, y;
|
|
65
66
|
try {
|
|
66
|
-
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,
|
|
67
|
-
return
|
|
68
|
-
(l) => x.indexOf(l) >= 0 ||
|
|
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, "");
|
|
68
|
+
return O.every(
|
|
69
|
+
(l) => x.indexOf(l) >= 0 || V.indexOf(l) >= 0 || j.indexOf(l) >= 0
|
|
69
70
|
);
|
|
70
71
|
} catch (i) {
|
|
71
72
|
return console.log(i), !0;
|
|
72
73
|
}
|
|
73
74
|
}),
|
|
74
75
|
popupRender: u,
|
|
75
|
-
children: d === null ? void 0 : d ?? (s ? s == null ? void 0 : s.map(T ??
|
|
76
|
+
children: d === null ? void 0 : d ?? (s ? s == null ? void 0 : s.map(T ?? I) : /* @__PURE__ */ t(B, {}))
|
|
76
77
|
}
|
|
77
78
|
)
|
|
78
79
|
}
|
|
@@ -81,5 +82,5 @@ function Y({
|
|
|
81
82
|
);
|
|
82
83
|
}
|
|
83
84
|
export {
|
|
84
|
-
|
|
85
|
+
Z as default
|
|
85
86
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),j=require("antd"),q=require("react"),$=require("react-highlight-words"),z=require("../locale/index.cjs.js"),J=require("./FileCrudField.cjs.js"),K=require("./ImageCrudField.cjs.js"),Q=require("../common/check-box/CheckBox.cjs.js"),X=require("../common/date-picker/DatePicker.cjs.js"),Y=require("../common/date-picker/TimePicker.cjs.js"),U=require("../common/select/SelectComponent.cjs.js"),Z=require("../common/text-field/NumberField.cjs.js"),V=require("../common/text-field/TextField.cjs.js"),ee=require("../common/tooltip/TooltipComponent.cjs.js"),re=require("./CrudTextAreaComponent.cjs.js"),M=require("../util/CrudUtil.cjs.js");function te(y){const{label:i,name:m,type:x,required:d,hidden:S,rules:h=[],updatable:g=!0,readonly:w=!1,fieldClassName:C,customFormFieldRender:H,fieldTooltip:v,fieldHelper:f,...r}=y,c=j.Form.useFormInstance();q.useEffect(()=>{if(x==="select"){const{items:a=[],onSearch:l,searchOnType:o}=r;!(a!=null&&a.length)&&!o&&(l==null||l(void 0,c,r==null?void 0:r.updatingValue))}},[c,r,x,r==null?void 0:r.updatingValue]);const{t:O}=z.useTranslationLibNoNS();if(w||S)return e.jsx(e.Fragment,{});if(H)return H(c,y);switch(x){case"text":case"email":case"password":{const{onChange:a,placeholder:l,addonAfter:o,addonBefore:p}=r;return e.jsx(V.default,{placeholder:l,disabled:!g,rules:h,required:d,onChange:a?s=>a(s,c):void 0,type:x,name:m,tooltip:v,label:i,className:C,autoComplete:"new-password",addonAfter:o,addonBefore:p,help:f})}case"number":{const{onChange:a,placeholder:l,allowMinus:o,min:p,max:s,addonAfter:T,addonBefore:b}=r;return e.jsx(Z,{placeholder:l,disabled:!g,moneyField:!!r.formatted,type:x,onChange:a?F=>a(F,c):void 0,rules:h,autoComplete:"false",required:d,tooltip:v,className:C,min:o?null:p,max:s,addonAfter:T,addonBefore:b,name:m,label:i,help:f})}case"date":{const{range:a,disableToday:l,disabledFutureDays:o,disabledPastDays:p,onChange:s,placeholder:T,format:b}=r;return e.jsx(X,{placeholder:T,required:d,disabled:!g,type:x,format:b,tooltip:v,range:a,name:m,label:i,onChange:s?F=>s(F,c):void 0,className:C,disableToday:l,disabledFutureDays:o,disabledPastDays:p,help:f})}case"time":{const{range:a=!1,disableCurrent:l,disabledFuture:o,disabledPast:p,onChange:s,use12Hours:T,format:b,placeholder:F}=r;return e.jsx(Y,{placeholder:F,required:d,format:b,disabled:!g,type:x,tooltip:v,range:a,use12Hours:T,name:m,label:i,onChange:s?n=>s(n,c):void 0,className:C,disableCurrent:l,disabledFuture:o,disabledPast:p,help:f})}case"textarea":return e.jsx(re,{...y});case"image":return e.jsx(K.default,{...r,required:d,name:m,label:i,rules:h,fieldHelper:f,fieldClassName:C,onRemoved:r.onRemoved,onUploading:r.onUploading,provider:r.provider});case"file":return e.jsx(J.default,{...r,required:d,name:m,label:i,rules:h,fieldHelper:f,fieldClassName:C,onRemoved:r.onRemoved,onUploading:r.onUploading,provider:r.provider});case"select":return e.jsx(E,{...r,required:d,name:m,label:i,rules:h,fieldClassName:C,form:c,help:f,updatable:g,readonly:w,fieldTooltip:v,fieldHelper:f});case"enum":{const{enum:a,radio:l=!1,translation:o,onChange:p,onSearch:s,multiple:T,tagRender:b}=r,F=Array.isArray(a)?a:Object.keys(a);return l?e.jsx(j.Form.Item,{...r,name:m,required:d,tooltip:v,rules:h,label:i,className:["w-100",C].join(" "),help:f,children:e.jsx(j.Radio.Group,{...r,onChange:p?n=>{var N;return p((N=n==null?void 0:n.target)==null?void 0:N.value,c)}:void 0,children:F.map(n=>e.jsx(j.Radio,{disabled:!g,value:n,children:o?O(o[n]):n},n))})}):e.jsx(U,{...r,tagRender:typeof b=="function"?b:b?n=>{const{value:N,label:R}=n,k=b[N];return k?e.jsx(j.Tag,{color:k.color,children:R}):e.jsx(j.Tag,{children:R})}:void 0,onChange:p?n=>p(n,c):void 0,className:["w-100",C].join(" "),name:m,items:F,required:d,tooltip:v,rules:h,label:i,help:f,disabled:!g,onSearch:s?n=>s(n,c):void 0,allowClear:!0,mode:T?"multiple":void 0,itemBuilder:n=>e.jsx(j.Select.Option,{value:n,children:o?O(o[n]):n},n)})}case"checkbox":{const{onChange:a,switch:l}=r;return e.jsx(Q,{className:C,rules:h,onChange:a?o=>a(o,c):void 0,label:i,tooltip:v,disabled:!g,name:m,help:f,switch:l})}case"color":return e.jsx(D,{...r,type:"color",required:d,name:m,label:i,rules:h,fieldClassName:C,updatable:g,readonly:w,fieldTooltip:v,fieldHelper:f});default:return e.jsx(e.Fragment,{children:`${x} Not Implemented`})}}function E(y){const{items:i=[],loading:m,searchOnType:x,onSearch:d,multiple:S,onChange:h,highlightSearch:g,required:w,fieldClassName:C,rules:H,fieldTooltip:v,updatable:f,label:r,name:c,tagRender:O,updatingValue:a,onSet:l,placeholder:o,allowClear:p=!0}=y,s=y.form,[T,b]=q.useState(""),F=q.useMemo(()=>M.getRealName(c),[c]),n=q.useMemo(()=>M.getRealName(c,"upsertFieldName"),[c]),N=j.Form.useWatch(F,s),[R,k]=q.useState(!0);q.useEffect(()=>{l&&R&&N&&(l==null||l(N,i,s),k(!1))},[R,s,i,F,l,N]),q.useEffect(()=>{N&&k(!0)},[N]);const _=q.useCallback(async t=>{b(t),x&&(d==null||d(t,s,a))},[s,d,x,a]);return e.jsx(U,{...y,maxTagCount:"responsive",maxTagPlaceholder:t=>e.jsxs(ee,{title:e.jsx(e.Fragment,{children:t.map(u=>e.jsxs(e.Fragment,{children:[u.label," ",e.jsx("br",{})]}))}),children:["+",t==null?void 0:t.length]}),placeholder:o,onSelect:t=>{l==null||l(t==null?void 0:t.key,i,s)},onChange:h?t=>{b(""),h(t,s)}:void 0,mode:S?"multiple":void 0,className:["w-100",C].join(" "),name:n,items:i,required:w,tooltip:v,tagRender:O,rules:H,disabled:!f,label:r,allowClear:p,onSearch:_,loading:m,filterOption:g?(t,u)=>{var P,A,B;try{const I=t.toLowerCase().split(/\s+/),W=((typeof(u==null?void 0:u.children)=="string"?u==null?void 0:u.children:(A=(P=u==null?void 0:u.children)==null?void 0:P.props)==null?void 0:A.textToHighlight)??"").toLowerCase(),G=(((B=u==null?void 0:u.value)==null?void 0:B.toString())??"").toLowerCase();return I.every(L=>W.indexOf(L)>=0||G.indexOf(L)>=0)}catch{return!0}}:void 0,itemBuilder:g?t=>{const u=t.value?String(t.value):void 0;return e.jsx(j.Select.Option,{value:t.key,title:u,disabled:t.disabled,children:e.jsx($,{highlightClassName:"highlight-text",searchWords:(T??"").split(" "),autoEscape:!0,textToHighlight:u??""})},t.key)}:t=>e.jsx(j.Select.Option,{value:t.key,title:t.value,disabled:t.disabled,children:t.value},t.key)})}function D(y){const{required:i,fieldClassName:m,rules:x,fieldTooltip:d,updatable:S,label:h,name:g,fieldHelper:w}=y;return e.jsx(j.Form.Item,{label:h,name:g,required:i,rules:x,tooltip:d,help:w,children:e.jsx(j.ColorPicker,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",showText:!0,trigger:"click",className:m,disabled:!S,...y.innerProps})})}exports.ColorCrudFieldComponent=D;exports.SelectCrudFieldComponent=E;exports.default=te;
|
|
@@ -6,155 +6,155 @@ import { useTranslationLibNoNS as V } from "../locale/index.es.js";
|
|
|
6
6
|
import ee from "./FileCrudField.es.js";
|
|
7
7
|
import re from "./ImageCrudField.es.js";
|
|
8
8
|
import te from "../common/check-box/CheckBox.es.js";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
9
|
+
import le from "../common/date-picker/DatePicker.es.js";
|
|
10
|
+
import ae from "../common/date-picker/TimePicker.es.js";
|
|
11
11
|
import z from "../common/select/SelectComponent.es.js";
|
|
12
12
|
import oe from "../common/text-field/NumberField.es.js";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
13
|
+
import ie from "../common/text-field/TextField.es.js";
|
|
14
|
+
import ne from "../common/tooltip/TooltipComponent.es.js";
|
|
15
15
|
import de from "./CrudTextAreaComponent.es.js";
|
|
16
16
|
import $ from "../util/CrudUtil.es.js";
|
|
17
17
|
function Re(N) {
|
|
18
18
|
const {
|
|
19
|
-
label:
|
|
19
|
+
label: n,
|
|
20
20
|
name: u,
|
|
21
|
-
type:
|
|
21
|
+
type: C,
|
|
22
22
|
required: s,
|
|
23
23
|
hidden: k,
|
|
24
24
|
rules: h = [],
|
|
25
25
|
updatable: f = !0,
|
|
26
26
|
readonly: w = !1,
|
|
27
|
-
fieldClassName:
|
|
28
|
-
customFormFieldRender:
|
|
29
|
-
fieldTooltip:
|
|
30
|
-
fieldHelper:
|
|
27
|
+
fieldClassName: b,
|
|
28
|
+
customFormFieldRender: O,
|
|
29
|
+
fieldTooltip: y,
|
|
30
|
+
fieldHelper: p,
|
|
31
31
|
...e
|
|
32
32
|
} = N, c = A.useFormInstance();
|
|
33
33
|
B(() => {
|
|
34
|
-
if (
|
|
34
|
+
if (C === "select") {
|
|
35
35
|
const {
|
|
36
|
-
items:
|
|
37
|
-
onSearch:
|
|
36
|
+
items: a = [],
|
|
37
|
+
onSearch: l,
|
|
38
38
|
searchOnType: d
|
|
39
39
|
} = e;
|
|
40
|
-
!(
|
|
40
|
+
!(a != null && a.length) && !d && (l == null || l(void 0, c, e == null ? void 0 : e.updatingValue));
|
|
41
41
|
}
|
|
42
|
-
}, [c, e,
|
|
43
|
-
const { t:
|
|
42
|
+
}, [c, e, C, e == null ? void 0 : e.updatingValue]);
|
|
43
|
+
const { t: S } = V();
|
|
44
44
|
if (w || k) return /* @__PURE__ */ t(P, {});
|
|
45
|
-
if (
|
|
46
|
-
return
|
|
47
|
-
switch (
|
|
45
|
+
if (O)
|
|
46
|
+
return O(c, N);
|
|
47
|
+
switch (C) {
|
|
48
48
|
case "text":
|
|
49
49
|
case "email":
|
|
50
50
|
case "password": {
|
|
51
|
-
const { onChange:
|
|
51
|
+
const { onChange: a, placeholder: l, addonAfter: d, addonBefore: g } = e;
|
|
52
52
|
return /* @__PURE__ */ t(
|
|
53
|
-
|
|
53
|
+
ie,
|
|
54
54
|
{
|
|
55
|
-
placeholder:
|
|
55
|
+
placeholder: l,
|
|
56
56
|
disabled: !f,
|
|
57
57
|
rules: h,
|
|
58
58
|
required: s,
|
|
59
|
-
onChange:
|
|
60
|
-
type:
|
|
59
|
+
onChange: a ? (i) => a(i, c) : void 0,
|
|
60
|
+
type: C,
|
|
61
61
|
name: u,
|
|
62
|
-
tooltip:
|
|
63
|
-
label:
|
|
64
|
-
className:
|
|
62
|
+
tooltip: y,
|
|
63
|
+
label: n,
|
|
64
|
+
className: b,
|
|
65
65
|
autoComplete: "new-password",
|
|
66
66
|
addonAfter: d,
|
|
67
|
-
addonBefore:
|
|
68
|
-
help:
|
|
67
|
+
addonBefore: g,
|
|
68
|
+
help: p
|
|
69
69
|
}
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
72
|
case "number": {
|
|
73
|
-
const { onChange:
|
|
73
|
+
const { onChange: a, placeholder: l, allowMinus: d, min: g, max: i, addonAfter: T, addonBefore: v } = e;
|
|
74
74
|
return /* @__PURE__ */ t(
|
|
75
75
|
oe,
|
|
76
76
|
{
|
|
77
|
-
placeholder:
|
|
77
|
+
placeholder: l,
|
|
78
78
|
disabled: !f,
|
|
79
79
|
moneyField: !!e.formatted,
|
|
80
|
-
type:
|
|
81
|
-
onChange:
|
|
80
|
+
type: C,
|
|
81
|
+
onChange: a ? (x) => a(x, c) : void 0,
|
|
82
82
|
rules: h,
|
|
83
83
|
autoComplete: "false",
|
|
84
84
|
required: s,
|
|
85
|
-
tooltip:
|
|
86
|
-
className:
|
|
87
|
-
min: d ? null :
|
|
88
|
-
max:
|
|
85
|
+
tooltip: y,
|
|
86
|
+
className: b,
|
|
87
|
+
min: d ? null : g,
|
|
88
|
+
max: i,
|
|
89
89
|
addonAfter: T,
|
|
90
|
-
addonBefore:
|
|
90
|
+
addonBefore: v,
|
|
91
91
|
name: u,
|
|
92
|
-
label:
|
|
93
|
-
help:
|
|
92
|
+
label: n,
|
|
93
|
+
help: p
|
|
94
94
|
}
|
|
95
95
|
);
|
|
96
96
|
}
|
|
97
97
|
case "date": {
|
|
98
98
|
const {
|
|
99
|
-
range:
|
|
100
|
-
disableToday:
|
|
99
|
+
range: a,
|
|
100
|
+
disableToday: l,
|
|
101
101
|
disabledFutureDays: d,
|
|
102
|
-
disabledPastDays:
|
|
103
|
-
onChange:
|
|
102
|
+
disabledPastDays: g,
|
|
103
|
+
onChange: i,
|
|
104
104
|
placeholder: T,
|
|
105
|
-
format:
|
|
105
|
+
format: v
|
|
106
106
|
} = e;
|
|
107
107
|
return /* @__PURE__ */ t(
|
|
108
|
-
|
|
108
|
+
le,
|
|
109
109
|
{
|
|
110
110
|
placeholder: T,
|
|
111
111
|
required: s,
|
|
112
112
|
disabled: !f,
|
|
113
|
-
type:
|
|
114
|
-
format:
|
|
115
|
-
tooltip:
|
|
116
|
-
range:
|
|
113
|
+
type: C,
|
|
114
|
+
format: v,
|
|
115
|
+
tooltip: y,
|
|
116
|
+
range: a,
|
|
117
117
|
name: u,
|
|
118
|
-
label:
|
|
119
|
-
onChange:
|
|
120
|
-
className:
|
|
121
|
-
disableToday:
|
|
118
|
+
label: n,
|
|
119
|
+
onChange: i ? (x) => i(x, c) : void 0,
|
|
120
|
+
className: b,
|
|
121
|
+
disableToday: l,
|
|
122
122
|
disabledFutureDays: d,
|
|
123
|
-
disabledPastDays:
|
|
124
|
-
help:
|
|
123
|
+
disabledPastDays: g,
|
|
124
|
+
help: p
|
|
125
125
|
}
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
128
|
case "time": {
|
|
129
129
|
const {
|
|
130
|
-
range:
|
|
131
|
-
disableCurrent:
|
|
130
|
+
range: a = !1,
|
|
131
|
+
disableCurrent: l,
|
|
132
132
|
disabledFuture: d,
|
|
133
|
-
disabledPast:
|
|
134
|
-
onChange:
|
|
133
|
+
disabledPast: g,
|
|
134
|
+
onChange: i,
|
|
135
135
|
use12Hours: T,
|
|
136
|
-
format:
|
|
136
|
+
format: v,
|
|
137
137
|
placeholder: x
|
|
138
138
|
} = e;
|
|
139
139
|
return /* @__PURE__ */ t(
|
|
140
|
-
|
|
140
|
+
ae,
|
|
141
141
|
{
|
|
142
142
|
placeholder: x,
|
|
143
143
|
required: s,
|
|
144
|
-
format:
|
|
144
|
+
format: v,
|
|
145
145
|
disabled: !f,
|
|
146
|
-
type:
|
|
147
|
-
tooltip:
|
|
148
|
-
range:
|
|
146
|
+
type: C,
|
|
147
|
+
tooltip: y,
|
|
148
|
+
range: a,
|
|
149
149
|
use12Hours: T,
|
|
150
150
|
name: u,
|
|
151
|
-
label:
|
|
152
|
-
onChange:
|
|
153
|
-
className:
|
|
154
|
-
disableCurrent:
|
|
151
|
+
label: n,
|
|
152
|
+
onChange: i ? (o) => i(o, c) : void 0,
|
|
153
|
+
className: b,
|
|
154
|
+
disableCurrent: l,
|
|
155
155
|
disabledFuture: d,
|
|
156
|
-
disabledPast:
|
|
157
|
-
help:
|
|
156
|
+
disabledPast: g,
|
|
157
|
+
help: p
|
|
158
158
|
}
|
|
159
159
|
);
|
|
160
160
|
}
|
|
@@ -167,9 +167,10 @@ function Re(N) {
|
|
|
167
167
|
...e,
|
|
168
168
|
required: s,
|
|
169
169
|
name: u,
|
|
170
|
-
label:
|
|
170
|
+
label: n,
|
|
171
171
|
rules: h,
|
|
172
|
-
|
|
172
|
+
fieldHelper: p,
|
|
173
|
+
fieldClassName: b,
|
|
173
174
|
onRemoved: e.onRemoved,
|
|
174
175
|
onUploading: e.onUploading,
|
|
175
176
|
provider: e.provider
|
|
@@ -182,9 +183,10 @@ function Re(N) {
|
|
|
182
183
|
...e,
|
|
183
184
|
required: s,
|
|
184
185
|
name: u,
|
|
185
|
-
label:
|
|
186
|
+
label: n,
|
|
186
187
|
rules: h,
|
|
187
|
-
|
|
188
|
+
fieldHelper: p,
|
|
189
|
+
fieldClassName: b,
|
|
188
190
|
onRemoved: e.onRemoved,
|
|
189
191
|
onUploading: e.onUploading,
|
|
190
192
|
provider: e.provider
|
|
@@ -197,46 +199,47 @@ function Re(N) {
|
|
|
197
199
|
...e,
|
|
198
200
|
required: s,
|
|
199
201
|
name: u,
|
|
200
|
-
label:
|
|
202
|
+
label: n,
|
|
201
203
|
rules: h,
|
|
202
|
-
fieldClassName:
|
|
204
|
+
fieldClassName: b,
|
|
203
205
|
form: c,
|
|
206
|
+
help: p,
|
|
204
207
|
updatable: f,
|
|
205
208
|
readonly: w,
|
|
206
|
-
fieldTooltip:
|
|
207
|
-
fieldHelper:
|
|
209
|
+
fieldTooltip: y,
|
|
210
|
+
fieldHelper: p
|
|
208
211
|
}
|
|
209
212
|
);
|
|
210
213
|
case "enum": {
|
|
211
214
|
const {
|
|
212
|
-
enum:
|
|
213
|
-
radio:
|
|
215
|
+
enum: a,
|
|
216
|
+
radio: l = !1,
|
|
214
217
|
translation: d,
|
|
215
|
-
onChange:
|
|
216
|
-
onSearch:
|
|
218
|
+
onChange: g,
|
|
219
|
+
onSearch: i,
|
|
217
220
|
multiple: T,
|
|
218
|
-
tagRender:
|
|
219
|
-
} = e, x = Array.isArray(
|
|
220
|
-
return
|
|
221
|
+
tagRender: v
|
|
222
|
+
} = e, x = Array.isArray(a) ? a : Object.keys(a);
|
|
223
|
+
return l ? /* @__PURE__ */ t(
|
|
221
224
|
A.Item,
|
|
222
225
|
{
|
|
223
226
|
...e,
|
|
224
227
|
name: u,
|
|
225
228
|
required: s,
|
|
226
|
-
tooltip:
|
|
229
|
+
tooltip: y,
|
|
227
230
|
rules: h,
|
|
228
|
-
label:
|
|
229
|
-
className: ["w-100",
|
|
230
|
-
help:
|
|
231
|
+
label: n,
|
|
232
|
+
className: ["w-100", b].join(" "),
|
|
233
|
+
help: p,
|
|
231
234
|
children: /* @__PURE__ */ t(
|
|
232
235
|
M.Group,
|
|
233
236
|
{
|
|
234
237
|
...e,
|
|
235
|
-
onChange:
|
|
238
|
+
onChange: g ? (o) => {
|
|
236
239
|
var F;
|
|
237
|
-
return
|
|
240
|
+
return g((F = o == null ? void 0 : o.target) == null ? void 0 : F.value, c);
|
|
238
241
|
} : void 0,
|
|
239
|
-
children: x.map((o) => /* @__PURE__ */ t(M, { disabled: !f, value: o, children: d ?
|
|
242
|
+
children: x.map((o) => /* @__PURE__ */ t(M, { disabled: !f, value: o, children: d ? S(d[o]) : o }, o))
|
|
240
243
|
}
|
|
241
244
|
)
|
|
242
245
|
}
|
|
@@ -244,41 +247,41 @@ function Re(N) {
|
|
|
244
247
|
z,
|
|
245
248
|
{
|
|
246
249
|
...e,
|
|
247
|
-
tagRender: typeof
|
|
248
|
-
const { value: F, label: R } = o,
|
|
249
|
-
return
|
|
250
|
+
tagRender: typeof v == "function" ? v : v ? (o) => {
|
|
251
|
+
const { value: F, label: R } = o, H = v[F];
|
|
252
|
+
return H ? /* @__PURE__ */ t(W, { color: H.color, children: R }) : /* @__PURE__ */ t(W, { children: R });
|
|
250
253
|
} : void 0,
|
|
251
|
-
onChange:
|
|
252
|
-
className: ["w-100",
|
|
254
|
+
onChange: g ? (o) => g(o, c) : void 0,
|
|
255
|
+
className: ["w-100", b].join(" "),
|
|
253
256
|
name: u,
|
|
254
257
|
items: x,
|
|
255
258
|
required: s,
|
|
256
|
-
tooltip:
|
|
259
|
+
tooltip: y,
|
|
257
260
|
rules: h,
|
|
258
|
-
label:
|
|
259
|
-
help:
|
|
261
|
+
label: n,
|
|
262
|
+
help: p,
|
|
260
263
|
disabled: !f,
|
|
261
|
-
onSearch:
|
|
264
|
+
onSearch: i ? (o) => i(o, c) : void 0,
|
|
262
265
|
allowClear: !0,
|
|
263
266
|
mode: T ? "multiple" : void 0,
|
|
264
|
-
itemBuilder: (o) => /* @__PURE__ */ t(j.Option, { value: o, children: d ?
|
|
267
|
+
itemBuilder: (o) => /* @__PURE__ */ t(j.Option, { value: o, children: d ? S(d[o]) : o }, o)
|
|
265
268
|
}
|
|
266
269
|
);
|
|
267
270
|
}
|
|
268
271
|
case "checkbox": {
|
|
269
|
-
const { onChange:
|
|
272
|
+
const { onChange: a, switch: l } = e;
|
|
270
273
|
return /* @__PURE__ */ t(
|
|
271
274
|
te,
|
|
272
275
|
{
|
|
273
|
-
className:
|
|
276
|
+
className: b,
|
|
274
277
|
rules: h,
|
|
275
|
-
onChange:
|
|
276
|
-
label:
|
|
277
|
-
tooltip:
|
|
278
|
+
onChange: a ? (d) => a(d, c) : void 0,
|
|
279
|
+
label: n,
|
|
280
|
+
tooltip: y,
|
|
278
281
|
disabled: !f,
|
|
279
282
|
name: u,
|
|
280
|
-
help:
|
|
281
|
-
switch:
|
|
283
|
+
help: p,
|
|
284
|
+
switch: l
|
|
282
285
|
}
|
|
283
286
|
);
|
|
284
287
|
}
|
|
@@ -290,51 +293,51 @@ function Re(N) {
|
|
|
290
293
|
type: "color",
|
|
291
294
|
required: s,
|
|
292
295
|
name: u,
|
|
293
|
-
label:
|
|
296
|
+
label: n,
|
|
294
297
|
rules: h,
|
|
295
|
-
fieldClassName:
|
|
298
|
+
fieldClassName: b,
|
|
296
299
|
updatable: f,
|
|
297
300
|
readonly: w,
|
|
298
|
-
fieldTooltip:
|
|
299
|
-
fieldHelper:
|
|
301
|
+
fieldTooltip: y,
|
|
302
|
+
fieldHelper: p
|
|
300
303
|
}
|
|
301
304
|
);
|
|
302
305
|
default:
|
|
303
|
-
return /* @__PURE__ */ t(P, { children: `${
|
|
306
|
+
return /* @__PURE__ */ t(P, { children: `${C} Not Implemented` });
|
|
304
307
|
}
|
|
305
308
|
}
|
|
306
309
|
function se(N) {
|
|
307
310
|
const {
|
|
308
|
-
items:
|
|
311
|
+
items: n = [],
|
|
309
312
|
loading: u,
|
|
310
|
-
searchOnType:
|
|
313
|
+
searchOnType: C,
|
|
311
314
|
onSearch: s,
|
|
312
315
|
multiple: k,
|
|
313
316
|
onChange: h,
|
|
314
317
|
highlightSearch: f,
|
|
315
318
|
required: w,
|
|
316
|
-
fieldClassName:
|
|
317
|
-
rules:
|
|
318
|
-
fieldTooltip:
|
|
319
|
-
updatable:
|
|
319
|
+
fieldClassName: b,
|
|
320
|
+
rules: O,
|
|
321
|
+
fieldTooltip: y,
|
|
322
|
+
updatable: p,
|
|
320
323
|
label: e,
|
|
321
324
|
name: c,
|
|
322
|
-
tagRender:
|
|
323
|
-
updatingValue:
|
|
324
|
-
onSet:
|
|
325
|
+
tagRender: S,
|
|
326
|
+
updatingValue: a,
|
|
327
|
+
onSet: l,
|
|
325
328
|
placeholder: d,
|
|
326
|
-
allowClear:
|
|
327
|
-
} = N,
|
|
329
|
+
allowClear: g = !0
|
|
330
|
+
} = N, i = N.form, [T, v] = G(""), x = _(() => $.getRealName(c), [c]), o = _(() => $.getRealName(c, "upsertFieldName"), [c]), F = A.useWatch(x, i), [R, H] = G(!0);
|
|
328
331
|
B(() => {
|
|
329
|
-
|
|
330
|
-
}, [R,
|
|
331
|
-
F &&
|
|
332
|
+
l && R && F && (l == null || l(F, n, i), H(!1));
|
|
333
|
+
}, [R, i, n, x, l, F]), B(() => {
|
|
334
|
+
F && H(!0);
|
|
332
335
|
}, [F]);
|
|
333
336
|
const J = Y(
|
|
334
337
|
async (r) => {
|
|
335
|
-
|
|
338
|
+
v(r), C && (s == null || s(r, i, a));
|
|
336
339
|
},
|
|
337
|
-
[
|
|
340
|
+
[i, s, C, a]
|
|
338
341
|
);
|
|
339
342
|
return /* @__PURE__ */ t(
|
|
340
343
|
z,
|
|
@@ -342,7 +345,7 @@ function se(N) {
|
|
|
342
345
|
...N,
|
|
343
346
|
maxTagCount: "responsive",
|
|
344
347
|
maxTagPlaceholder: (r) => /* @__PURE__ */ E(
|
|
345
|
-
|
|
348
|
+
ne,
|
|
346
349
|
{
|
|
347
350
|
title: /* @__PURE__ */ t(P, { children: r.map((m) => /* @__PURE__ */ E(P, { children: [
|
|
348
351
|
m.label,
|
|
@@ -357,22 +360,22 @@ function se(N) {
|
|
|
357
360
|
),
|
|
358
361
|
placeholder: d,
|
|
359
362
|
onSelect: (r) => {
|
|
360
|
-
|
|
363
|
+
l == null || l(r == null ? void 0 : r.key, n, i);
|
|
361
364
|
},
|
|
362
365
|
onChange: h ? (r) => {
|
|
363
|
-
|
|
366
|
+
v(""), h(r, i);
|
|
364
367
|
} : void 0,
|
|
365
368
|
mode: k ? "multiple" : void 0,
|
|
366
|
-
className: ["w-100",
|
|
369
|
+
className: ["w-100", b].join(" "),
|
|
367
370
|
name: o,
|
|
368
|
-
items:
|
|
371
|
+
items: n,
|
|
369
372
|
required: w,
|
|
370
|
-
tooltip:
|
|
371
|
-
tagRender:
|
|
372
|
-
rules:
|
|
373
|
-
disabled: !
|
|
373
|
+
tooltip: y,
|
|
374
|
+
tagRender: S,
|
|
375
|
+
rules: O,
|
|
376
|
+
disabled: !p,
|
|
374
377
|
label: e,
|
|
375
|
-
allowClear:
|
|
378
|
+
allowClear: g,
|
|
376
379
|
onSearch: J,
|
|
377
380
|
loading: u,
|
|
378
381
|
filterOption: f ? (r, m) => {
|
|
@@ -421,9 +424,9 @@ function se(N) {
|
|
|
421
424
|
}
|
|
422
425
|
function ce(N) {
|
|
423
426
|
const {
|
|
424
|
-
required:
|
|
427
|
+
required: n,
|
|
425
428
|
fieldClassName: u,
|
|
426
|
-
rules:
|
|
429
|
+
rules: C,
|
|
427
430
|
fieldTooltip: s,
|
|
428
431
|
updatable: k,
|
|
429
432
|
label: h,
|
|
@@ -435,8 +438,8 @@ function ce(N) {
|
|
|
435
438
|
{
|
|
436
439
|
label: h,
|
|
437
440
|
name: f,
|
|
438
|
-
required:
|
|
439
|
-
rules:
|
|
441
|
+
required: n,
|
|
442
|
+
rules: C,
|
|
440
443
|
tooltip: s,
|
|
441
444
|
help: w,
|
|
442
445
|
children: /* @__PURE__ */ t(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const d=require("react/jsx-runtime"),q=require("../common/text-field/TextArea.cjs.js"),C=require("../common/rich/index.cjs.js"),T=require("antd"),j=require("../util/CrudUtil.cjs.js"),p=({onChange:r,label:s,required:i,rules:o,name:n,updatable:c=!0,...e})=>{const u=T.Form.useFormInstance(),a=j.getRealName(n,"upsertFieldName");if(e.rich)return d.jsx(C.RichTextEditor,{name:a,label:s,required:i,rules:o,disabled:!c,help:e.fieldHelper});{const{placeholder:m,rows:x,cols:f,fieldClassName:h,fieldTooltip:N}=e;return d.jsx(q.default,{rules:o,placeholder:m,onChange:r?t=>{var l;return r((l=t==null?void 0:t.target)==null?void 0:l.value,u)}:void 0,tooltip:N,required:i,disabled:!c,name:n,label:s,className:h,rows:x,cols:f,help:e.fieldHelper})}};module.exports=p;
|
|
@@ -1,52 +1,54 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { RichTextEditor as
|
|
4
|
-
import { Form as
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import C from "../common/text-field/TextArea.es.js";
|
|
3
|
+
import { RichTextEditor as N } from "../common/rich/index.es.js";
|
|
4
|
+
import { Form as T } from "antd";
|
|
5
5
|
import F from "../util/CrudUtil.es.js";
|
|
6
|
-
const
|
|
7
|
-
onChange:
|
|
8
|
-
label:
|
|
9
|
-
required:
|
|
10
|
-
rules:
|
|
11
|
-
name:
|
|
6
|
+
const w = ({
|
|
7
|
+
onChange: t,
|
|
8
|
+
label: r,
|
|
9
|
+
required: m,
|
|
10
|
+
rules: i,
|
|
11
|
+
name: l,
|
|
12
12
|
updatable: s = !0,
|
|
13
|
-
...
|
|
13
|
+
...e
|
|
14
14
|
}) => {
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
|
|
15
|
+
const f = T.useFormInstance(), n = F.getRealName(l, "upsertFieldName");
|
|
16
|
+
if (e.rich)
|
|
17
|
+
return /* @__PURE__ */ a(
|
|
18
|
+
N,
|
|
19
19
|
{
|
|
20
|
-
name:
|
|
21
|
-
label:
|
|
22
|
-
required:
|
|
23
|
-
rules:
|
|
24
|
-
disabled: !s
|
|
20
|
+
name: n,
|
|
21
|
+
label: r,
|
|
22
|
+
required: m,
|
|
23
|
+
rules: i,
|
|
24
|
+
disabled: !s,
|
|
25
|
+
help: e.fieldHelper
|
|
25
26
|
}
|
|
26
27
|
);
|
|
27
28
|
{
|
|
28
|
-
const { placeholder:
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
|
|
29
|
+
const { placeholder: c, rows: p, cols: u, fieldClassName: h, fieldTooltip: x } = e;
|
|
30
|
+
return /* @__PURE__ */ a(
|
|
31
|
+
C,
|
|
31
32
|
{
|
|
32
|
-
rules:
|
|
33
|
-
placeholder:
|
|
34
|
-
onChange:
|
|
35
|
-
var
|
|
36
|
-
return
|
|
33
|
+
rules: i,
|
|
34
|
+
placeholder: c,
|
|
35
|
+
onChange: t ? (o) => {
|
|
36
|
+
var d;
|
|
37
|
+
return t((d = o == null ? void 0 : o.target) == null ? void 0 : d.value, f);
|
|
37
38
|
} : void 0,
|
|
38
|
-
tooltip:
|
|
39
|
-
required:
|
|
39
|
+
tooltip: x,
|
|
40
|
+
required: m,
|
|
40
41
|
disabled: !s,
|
|
41
|
-
name:
|
|
42
|
-
label:
|
|
43
|
-
className:
|
|
42
|
+
name: l,
|
|
43
|
+
label: r,
|
|
44
|
+
className: h,
|
|
44
45
|
rows: p,
|
|
45
|
-
cols: u
|
|
46
|
+
cols: u,
|
|
47
|
+
help: e.fieldHelper
|
|
46
48
|
}
|
|
47
49
|
);
|
|
48
50
|
}
|
|
49
51
|
};
|
|
50
52
|
export {
|
|
51
|
-
|
|
53
|
+
w as default
|
|
52
54
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
2
|
import { InitialCrudField } from './CrudComponent';
|
|
3
3
|
import { FileDownloadProvider, FileUploadProvider } from './ImageCrudField';
|
|
4
4
|
export interface FileCrudField<T> extends _FileCrudField<T> {
|
|
@@ -12,6 +12,7 @@ export interface _FileCrudField<T> extends InitialCrudField<T> {
|
|
|
12
12
|
accept?: string;
|
|
13
13
|
maxCount?: number;
|
|
14
14
|
block?: boolean;
|
|
15
|
+
help?: ReactNode;
|
|
15
16
|
}
|
|
16
17
|
export default function FileCrudFieldComponent<T>({ name, label, required, provider, onUploading, onRemoved, fieldClassName, accept, rules, maxCount, block, fieldHelper: help, ...props }: Readonly<_FileCrudField<T>>): import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
export declare const FileCrudCellValue: FC<{
|