@kingteza/crud-component 1.3.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/CrudComponent.cjs.js +1 -1
- package/dist/crud/CrudComponent.d.ts +1 -0
- package/dist/crud/CrudComponent.es.js +44 -45
- package/dist/crud/CrudField.cjs.js +1 -1
- package/dist/crud/CrudField.es.js +186 -182
- 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/dist/crud/view/CrudViewerUtil.cjs.js +1 -1
- package/dist/crud/view/CrudViewerUtil.es.js +22 -22
- 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";const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),x=require("antd"),t=require("react"),H=require("./modal/index.cjs.js"),J=require("./import/CrudImportButton.cjs.js"),K=require("./view/CrudViewer.cjs.js"),L=require("../common/button/NewButton.cjs.js"),M=require("../common/button/PrintButton.cjs.js");function O({idField:l="id",onCreate:C,onDelete:j,onHide:f,onUpdate:n,fields:r,data:m,grid:k,isHiding:q,isCreating:h,isDeleting:p,isUpdating:B,paginateProps:w,onPrint:a,printing:N,viewable:v,loadingData:R,formBuilder:g,extraAction:y,minusHeight:b,cloneable:P,fullWidthModal:S=!0,wizard:I,extraView:V,importable:i,onClickNew:u,size:z,...A}){const c=t.useRef(null),D=t.useCallback(()=>{var s;(s=c.current)==null||s.create()},[]),o=t.useCallback(async(s,F=!0,G=!1)=>{var d;await((d=c.current)==null?void 0:d.update(s,F,G))},[]),E=t.useCallback(async s=>{o(s,!1,!0)},[o]);return e.jsxs(e.Fragment,{children:[e.jsxs(x.Space,{direction:"vertical",className:"w-100",children:[e.jsxs("div",{className:"w-100 d-flex",children:[e.jsx("div",{style:{flex:1},children:e.jsx(L.NewButton,{onClick:()=>{u?u():D()},className:"flex-1"})}),e.jsxs(x.Space,{children:[!!a&&e.jsx(M.PrintButton,{className:"float-right",loading:N,onClick:a}),!!i&&e.jsx(J,{fields:r,importProps:i})]})]}),e.jsx(K,{...A,minusHeight:b,data:m,size:z,fields:r,extraAction:y,idField:l,isDeleting:p,loadingData:R,onClickUpdate:n?o:void 0,onHide:f,isHiding:q,onDelete:j,onUpdate:n,onClickClone:P?E:void 0,paginateProps:w,viewable:v,extraView:V})]}),e.jsx(H,{ref:c,fields:r,wizard:I,grid:k,fullWidthModal:S,isCreating:h,isUpdating:B,onCreate:C,onUpdate:n,idField:l,formBuilder:g})]})}module.exports=O;
|
|
@@ -140,6 +140,7 @@ export interface ColorPickerFieldProps<T> extends Omit<InitialCrudField<T>, "pla
|
|
|
140
140
|
export interface CheckboxBasedFieldProps<T> extends InitialCrudField<T> {
|
|
141
141
|
type: "checkbox";
|
|
142
142
|
onChange?: (value: boolean, form: FormInstance<T>) => void;
|
|
143
|
+
switch?: boolean;
|
|
143
144
|
}
|
|
144
145
|
export interface NumberBasedFieldProps<T> extends InitialCrudField<T>, AddonFieldProps {
|
|
145
146
|
type: "number";
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { jsxs as e, Fragment as H, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { Space as f
|
|
3
|
-
import { useRef as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { NewButton as
|
|
8
|
-
import { PrintButton as
|
|
9
|
-
|
|
10
|
-
function to({
|
|
2
|
+
import { Space as f } from "antd";
|
|
3
|
+
import { useRef as J, useCallback as c } from "react";
|
|
4
|
+
import K from "./modal/index.es.js";
|
|
5
|
+
import L from "./import/CrudImportButton.es.js";
|
|
6
|
+
import O from "./view/CrudViewer.es.js";
|
|
7
|
+
import { NewButton as Q } from "../common/button/NewButton.es.js";
|
|
8
|
+
import { PrintButton as T } from "../common/button/PrintButton.es.js";
|
|
9
|
+
function ro({
|
|
11
10
|
idField: i = "id",
|
|
12
11
|
onCreate: p,
|
|
13
12
|
onDelete: C,
|
|
14
13
|
onHide: h,
|
|
15
14
|
onUpdate: t,
|
|
16
|
-
fields:
|
|
15
|
+
fields: l,
|
|
17
16
|
data: k,
|
|
18
17
|
grid: x,
|
|
19
18
|
isHiding: v,
|
|
@@ -24,29 +23,29 @@ function to({
|
|
|
24
23
|
onPrint: m,
|
|
25
24
|
printing: y,
|
|
26
25
|
viewable: j,
|
|
27
|
-
loadingData:
|
|
28
|
-
formBuilder:
|
|
29
|
-
extraAction:
|
|
30
|
-
minusHeight:
|
|
31
|
-
cloneable:
|
|
32
|
-
fullWidthModal:
|
|
33
|
-
wizard:
|
|
34
|
-
extraView:
|
|
26
|
+
loadingData: R,
|
|
27
|
+
formBuilder: I,
|
|
28
|
+
extraAction: M,
|
|
29
|
+
minusHeight: P,
|
|
30
|
+
cloneable: S,
|
|
31
|
+
fullWidthModal: V = !0,
|
|
32
|
+
wizard: b,
|
|
33
|
+
extraView: q,
|
|
35
34
|
importable: s,
|
|
36
35
|
onClickNew: u,
|
|
37
|
-
size:
|
|
38
|
-
...
|
|
36
|
+
size: z,
|
|
37
|
+
...A
|
|
39
38
|
}) {
|
|
40
|
-
const
|
|
39
|
+
const n = J(null), D = c(() => {
|
|
41
40
|
var o;
|
|
42
|
-
(o =
|
|
41
|
+
(o = n.current) == null || o.create();
|
|
43
42
|
}, []), a = c(
|
|
44
|
-
async (o,
|
|
43
|
+
async (o, F = !0, G = !1) => {
|
|
45
44
|
var d;
|
|
46
|
-
await ((d =
|
|
45
|
+
await ((d = n.current) == null ? void 0 : d.update(o, F, G));
|
|
47
46
|
},
|
|
48
47
|
[]
|
|
49
|
-
),
|
|
48
|
+
), E = c(
|
|
50
49
|
async (o) => {
|
|
51
50
|
a(o, !1, !0);
|
|
52
51
|
},
|
|
@@ -56,68 +55,68 @@ function to({
|
|
|
56
55
|
/* @__PURE__ */ e(f, { direction: "vertical", className: "w-100", children: [
|
|
57
56
|
/* @__PURE__ */ e("div", { className: "w-100 d-flex", children: [
|
|
58
57
|
/* @__PURE__ */ r("div", { style: { flex: 1 }, children: /* @__PURE__ */ r(
|
|
59
|
-
|
|
58
|
+
Q,
|
|
60
59
|
{
|
|
61
60
|
onClick: () => {
|
|
62
|
-
u ? u() :
|
|
61
|
+
u ? u() : D();
|
|
63
62
|
},
|
|
64
63
|
className: "flex-1"
|
|
65
64
|
}
|
|
66
65
|
) }),
|
|
67
66
|
/* @__PURE__ */ e(f, { children: [
|
|
68
67
|
!!m && /* @__PURE__ */ r(
|
|
69
|
-
|
|
68
|
+
T,
|
|
70
69
|
{
|
|
71
70
|
className: "float-right",
|
|
72
71
|
loading: y,
|
|
73
72
|
onClick: m
|
|
74
73
|
}
|
|
75
74
|
),
|
|
76
|
-
!!s && /* @__PURE__ */ r(
|
|
75
|
+
!!s && /* @__PURE__ */ r(L, { fields: l, importProps: s })
|
|
77
76
|
] })
|
|
78
77
|
] }),
|
|
79
78
|
/* @__PURE__ */ r(
|
|
80
|
-
|
|
79
|
+
O,
|
|
81
80
|
{
|
|
82
|
-
...
|
|
83
|
-
minusHeight:
|
|
81
|
+
...A,
|
|
82
|
+
minusHeight: P,
|
|
84
83
|
data: k,
|
|
85
|
-
size:
|
|
86
|
-
fields:
|
|
87
|
-
extraAction:
|
|
84
|
+
size: z,
|
|
85
|
+
fields: l,
|
|
86
|
+
extraAction: M,
|
|
88
87
|
idField: i,
|
|
89
88
|
isDeleting: B,
|
|
90
|
-
loadingData:
|
|
89
|
+
loadingData: R,
|
|
91
90
|
onClickUpdate: t ? a : void 0,
|
|
92
91
|
onHide: h,
|
|
93
92
|
isHiding: v,
|
|
94
93
|
onDelete: C,
|
|
95
94
|
onUpdate: t,
|
|
96
|
-
onClickClone:
|
|
95
|
+
onClickClone: S ? E : void 0,
|
|
97
96
|
paginateProps: g,
|
|
98
97
|
viewable: j,
|
|
99
|
-
extraView:
|
|
98
|
+
extraView: q
|
|
100
99
|
}
|
|
101
100
|
)
|
|
102
101
|
] }),
|
|
103
102
|
/* @__PURE__ */ r(
|
|
104
|
-
|
|
103
|
+
K,
|
|
105
104
|
{
|
|
106
|
-
ref:
|
|
107
|
-
fields:
|
|
108
|
-
wizard:
|
|
105
|
+
ref: n,
|
|
106
|
+
fields: l,
|
|
107
|
+
wizard: b,
|
|
109
108
|
grid: x,
|
|
110
|
-
fullWidthModal:
|
|
109
|
+
fullWidthModal: V,
|
|
111
110
|
isCreating: w,
|
|
112
111
|
isUpdating: N,
|
|
113
112
|
onCreate: p,
|
|
114
113
|
onUpdate: t,
|
|
115
114
|
idField: i,
|
|
116
|
-
formBuilder:
|
|
115
|
+
formBuilder: I
|
|
117
116
|
}
|
|
118
117
|
)
|
|
119
118
|
] });
|
|
120
119
|
}
|
|
121
120
|
export {
|
|
122
|
-
|
|
121
|
+
ro as default
|
|
123
122
|
};
|
|
@@ -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;
|