@kingteza/crud-component 1.0.44 → 1.0.46
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/common/button/Button.cjs.js +1 -1
- package/common/button/Button.es.js +27 -27
- package/crud/CrudField.cjs.js +1 -1
- package/crud/CrudField.es.js +123 -124
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const f=require("react/jsx-runtime"),h=require("antd"),l=require("react"),q=require("../../locale/index.cjs.js");;/* empty css */const d=require("react-router-dom"),y=({className:i,to:e,onClick:t,tooltip:o,ref:g,...r})=>{var u;const{t:n}=q.useTranslationLib();let s;try{s=(u=d.useNavigate)==null?void 0:u.call(d)}catch(a){console.error(a)}const c=l.useMemo(()=>f.jsx(h.Button,{onClick:t||(e&&s?()=>s(e):void 0),className:i,...r,children:r.children}),[i,s,t,r,n,e]);return o?f.jsx(h.Tooltip,{title:o,children:c}):c},j=({className:i,to:e,onClick:t,tooltip:o,ref:g,...r})=>{let n;try{n=d.useNavigate()}catch(x){console.error(x)}const[s,c]=l.useState(!1),u=l.useCallback(async x=>{try{return c(!0),await t(x)}finally{c(!1)}},[t]),a=l.useMemo(()=>f.jsx(h.Button,{loading:s||r.loading,onClick:t?u:e?()=>{n?n==null||n(e):window.location.href=e}:void 0,className:i,...r}),[u,i,s,n,t,r,e]);return o?f.jsx(h.Tooltip,{title:o,children:a}):a};y.Async=j;module.exports=y;
|
|
@@ -1,74 +1,74 @@
|
|
|
1
1
|
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
-
import { Button as
|
|
3
|
-
import { useMemo as
|
|
2
|
+
import { Button as u, Tooltip as m } from "antd";
|
|
3
|
+
import { useMemo as h, useState as b, useCallback as v } from "react";
|
|
4
4
|
import { useTranslationLib as w } from "../../locale/index.es.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import { useNavigate as
|
|
6
|
+
import { useNavigate as y } from "react-router-dom";
|
|
7
7
|
const x = ({
|
|
8
8
|
className: i,
|
|
9
9
|
to: r,
|
|
10
|
-
onClick:
|
|
10
|
+
onClick: t,
|
|
11
11
|
tooltip: a,
|
|
12
|
-
ref:
|
|
12
|
+
ref: g,
|
|
13
13
|
...n
|
|
14
14
|
}) => {
|
|
15
15
|
var l;
|
|
16
|
-
const { t } = w();
|
|
16
|
+
const { t: e } = w();
|
|
17
17
|
let o;
|
|
18
18
|
try {
|
|
19
|
-
o = (l =
|
|
19
|
+
o = (l = y) == null ? void 0 : l();
|
|
20
20
|
} catch (s) {
|
|
21
21
|
console.error(s);
|
|
22
22
|
}
|
|
23
|
-
const c =
|
|
23
|
+
const c = h(
|
|
24
24
|
() => /* @__PURE__ */ f(
|
|
25
|
-
|
|
25
|
+
u,
|
|
26
26
|
{
|
|
27
|
-
onClick:
|
|
27
|
+
onClick: t || (r && o ? () => o(r) : void 0),
|
|
28
28
|
className: i,
|
|
29
29
|
...n,
|
|
30
|
-
children: n.children
|
|
30
|
+
children: n.children
|
|
31
31
|
}
|
|
32
32
|
),
|
|
33
|
-
[i, o,
|
|
33
|
+
[i, o, t, n, e, r]
|
|
34
34
|
);
|
|
35
35
|
return a ? /* @__PURE__ */ f(m, { title: a, children: c }) : c;
|
|
36
36
|
}, A = ({
|
|
37
37
|
className: i,
|
|
38
38
|
to: r,
|
|
39
|
-
onClick:
|
|
39
|
+
onClick: t,
|
|
40
40
|
tooltip: a,
|
|
41
|
-
ref:
|
|
41
|
+
ref: g,
|
|
42
42
|
...n
|
|
43
43
|
}) => {
|
|
44
|
-
let
|
|
44
|
+
let e;
|
|
45
45
|
try {
|
|
46
|
-
|
|
47
|
-
} catch (
|
|
48
|
-
console.error(
|
|
46
|
+
e = y();
|
|
47
|
+
} catch (d) {
|
|
48
|
+
console.error(d);
|
|
49
49
|
}
|
|
50
|
-
const [o, c] =
|
|
51
|
-
async (
|
|
50
|
+
const [o, c] = b(!1), l = v(
|
|
51
|
+
async (d) => {
|
|
52
52
|
try {
|
|
53
|
-
return c(!0), await
|
|
53
|
+
return c(!0), await t(d);
|
|
54
54
|
} finally {
|
|
55
55
|
c(!1);
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
|
-
[
|
|
59
|
-
), s =
|
|
58
|
+
[t]
|
|
59
|
+
), s = h(
|
|
60
60
|
() => /* @__PURE__ */ f(
|
|
61
|
-
|
|
61
|
+
u,
|
|
62
62
|
{
|
|
63
63
|
loading: o || n.loading,
|
|
64
|
-
onClick:
|
|
65
|
-
|
|
64
|
+
onClick: t ? l : r ? () => {
|
|
65
|
+
e ? e == null || e(r) : window.location.href = r;
|
|
66
66
|
} : void 0,
|
|
67
67
|
className: i,
|
|
68
68
|
...n
|
|
69
69
|
}
|
|
70
70
|
),
|
|
71
|
-
[l, i, o,
|
|
71
|
+
[l, i, o, e, t, n, r]
|
|
72
72
|
);
|
|
73
73
|
return a ? /* @__PURE__ */ f(m, { title: a, children: s }) : s;
|
|
74
74
|
};
|
package/crud/CrudField.cjs.js
CHANGED
|
@@ -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"),N=require("react"),_=require("react-highlight-words"),W=require("../locale/index.cjs.js"),G=require("./FileCrudField.cjs.js"),$=require("./ImageCrudField.cjs.js"),z=require("../common/check-box/CheckBox.cjs.js"),J=require("../common/date-picker/DatePicker.cjs.js"),K=require("../common/date-picker/TimePicker.cjs.js"),E=require("../common/select/SelectComponent.cjs.js"),Q=require("../common/text-field/NumberField.cjs.js"),X=require("../common/text-field/TextField.cjs.js"),Y=require("../common/text-field/TextArea.cjs.js"),Z=require("../common/tooltip/TooltipComponent.cjs.js");function V(F){const{label:o,name:c,type:p,required:i,hidden:w,rules:m=[],updatable:h=!0,readonly:S=!1,fieldClassName:f,customFormFieldRender:R,fieldTooltip:b,...t}=F,g=j.Form.useFormInstance();N.useEffect(()=>{if(p==="select"){const{items:l=[],onSearch:s,searchOnType:n}=t;!(l!=null&&l.length)&&!n&&(s==null||s(void 0,g,t==null?void 0:t.updatingValue))}},[g,t,p,t==null?void 0:t.updatingValue]);const{t:q}=W.useTranslationLib();if(S||w)return e.jsx(e.Fragment,{});if(R)return R(g,F);switch(p){case"text":case"email":case"password":{const{onChange:l,placeholder:s}=t;return e.jsx(X.default,{placeholder:s,disabled:!h,rules:m,required:i,onChange:l?n=>l(n,g):void 0,type:p,name:c,tooltip:b,label:o,className:f,autoComplete:"new-password"})}case"number":{const{onChange:l,placeholder:s,allowMinus:n}=t;return e.jsx(Q,{placeholder:s,disabled:!h,moneyField:!!t.formatted,type:p,onChange:l?x=>l(x,g):void 0,rules:m,autoComplete:"false",required:i,tooltip:b,className:f,min:n?null:void 0,name:c,label:o})}case"date":{const{range:l,disableToday:s,disabledFutureDays:n,disabledPastDays:x,onChange:C,placeholder:u,format:v}=t;return e.jsx(J,{placeholder:u,required:i,disabled:!h,type:p,format:v,tooltip:b,range:l,name:c,label:o,onChange:C?y=>C(y,g):void 0,className:f,disableToday:s,disabledFutureDays:n,disabledPastDays:x})}case"time":{const{range:l=!1,disableCurrent:s,disabledFuture:n,disabledPast:x,onChange:C,use12Hours:u,format:v,placeholder:y}=t;return e.jsx(K,{placeholder:y,required:i,format:v,disabled:!h,type:p,tooltip:b,range:l,use12Hours:u,name:c,label:o,onChange:C?r=>C(r,g):void 0,className:f,disableCurrent:s,disabledFuture:n,disabledPast:x})}case"textarea":{const{onChange:l,placeholder:s,rows:n,cols:x}=t;return e.jsx(Y.default,{rules:m,placeholder:s,onChange:l?C=>{var u;return l((u=C==null?void 0:C.target)==null?void 0:u.value,g)}:void 0,tooltip:b,required:i,disabled:!h,name:c,label:o,className:f,rows:n,cols:x})}case"image":return e.jsx($.default,{...t,required:i,name:c,label:o,rules:m,fieldClassName:f,onRemoved:t.onRemoved,onUploading:t.onUploading,provider:t.provider});case"file":return e.jsx(G.default,{...t,required:i,name:c,label:o,rules:m,fieldClassName:f,onRemoved:t.onRemoved,onUploading:t.onUploading,provider:t.provider});case"select":return e.jsx(H,{...t,required:i,name:c,label:o,rules:m,fieldClassName:f,form:g,updatable:h,readonly:S,fieldTooltip:b});case"enum":{const{enum:l,radio:s=!1,translation:n,onChange:x,onSearch:C,multiple:u,tagRender:v}=t,y=Array.isArray(l)?l:Object.keys(l);return s?e.jsx(j.Form.Item,{...t,name:c,required:i,tooltip:b,rules:m,label:o,className:["w-100",f].join(" "),children:e.jsx(j.Radio.Group,{...t,onChange:x?r=>{var T;return x((T=r==null?void 0:r.target)==null?void 0:T.value,g)}:void 0,children:y.map(r=>e.jsx(j.Radio,{disabled:!h,value:r,children:n?q(n[r]):r},r))})}):e.jsx(E,{...t,tagRender:typeof v=="function"?v:v?r=>{const{value:T,label:k}=r,O=v[T];return O?e.jsx(j.Tag,{color:O.color,children:k}):e.jsx(j.Tag,{children:k})}:void 0,onChange:x?r=>x(r,g):void 0,className:["w-100",f].join(" "),name:c,items:y,required:i,tooltip:b,rules:m,label:o,disabled:!h,onSearch:C?r=>C(r,g):void 0,allowClear:!0,mode:u?"multiple":void 0,itemBuilder:r=>e.jsx(j.Select.Option,{value:r,children:n?q(n[r]):r},r)})}case"checkbox":{const{onChange:l}=t;return e.jsx(z,{className:f,rules:m,onChange:l?s=>l(s,g):void 0,label:o,tooltip:b,disabled:!h,name:c})}case"color":return e.jsx(U,{...t,type:"color",required:i,name:c,label:o,rules:m,fieldClassName:f,updatable:h,readonly:S,fieldTooltip:b});default:return e.jsx(e.Fragment,{children:`${p} Not Implemented`})}}function H(F){const{items:o=[],loading:c,searchOnType:p,onSearch:i,multiple:w,onChange:m,highlightSearch:h,required:S,fieldClassName:f,rules:R,fieldTooltip:b,updatable:t,label:g,name:q,tagRender:l,updatingValue:s,onSet:n,placeholder:x,allowClear:C=!0}=F,u=F.form,[v,y]=N.useState(""),r=j.Form.useWatch(q,u),[T,k]=N.useState(!0);N.useEffect(()=>{n&&T&&r&&(n==null||n(r,o,u),k(!1))},[T,u,o,q,n,r]),N.useEffect(()=>{r&&k(!0)},[r]);const O=N.useCallback(async a=>{y(a),p&&(i==null||i(a,u,s))},[u,i,p,s]);return e.jsx(E,{...F,maxTagCount:"responsive",maxTagPlaceholder:a=>e.jsxs(Z,{title:e.jsx(e.Fragment,{children:a.map(d=>e.jsxs(e.Fragment,{children:[d.label," ",e.jsx("br",{})]}))}),children:["+",a==null?void 0:a.length]}),placeholder:x,onSelect:a=>{n==null||n(a==null?void 0:a.key,o,u)},onChange:m?a=>{y(""),m(a,u)}:void 0,mode:w?"multiple":void 0,className:["w-100",f].join(" "),name:q,items:o,required:S,tooltip:b,tagRender:l,rules:R,disabled:!t,label:g,allowClear:C,onSearch:O,loading:c,filterOption:h?(a,d)=>{var P,I,L;try{const A=a.toLowerCase().split(/\s+/),D=((typeof(d==null?void 0:d.children)=="string"?d==null?void 0:d.children:(I=(P=d==null?void 0:d.children)==null?void 0:P.props)==null?void 0:I.textToHighlight)??"").toLowerCase(),M=(((L=d==null?void 0:d.value)==null?void 0:L.toString())??"").toLowerCase();return A.every(B=>D.indexOf(B)>=0||M.indexOf(B)>=0)}catch{return!0}}:void 0,itemBuilder:h?a=>{const d=a.value?String(a.value):void 0;return e.jsx(j.Select.Option,{value:a.key,title:d,disabled:a.disabled,children:e.jsx(_,{highlightClassName:"highlight-text",searchWords:(v??"").split(" "),autoEscape:!0,textToHighlight:d??""})},a.key)}:a=>e.jsx(j.Select.Option,{value:a.key,title:a.value,disabled:a.disabled,children:a.value},a.key)})}function U(F){const{required:o,fieldClassName:c,rules:p,fieldTooltip:i,updatable:w,label:m,name:h}=F;return e.jsx(j.Form.Item,{label:m,name:h,required:o,rules:p,tooltip:i,children:e.jsx(j.ColorPicker,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",showText:!0,trigger:"click",className:c,disabled:!w,...F.innerProps})})}exports.ColorCrudFieldComponent=U;exports.SelectCrudFieldComponent=H;exports.default=V;
|
package/crud/CrudField.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Form as
|
|
1
|
+
import { jsx as o, Fragment as S, jsxs as D } from "react/jsx-runtime";
|
|
2
|
+
import { Form as j, Radio as E, Tag as W, Select as I, ColorPicker as z } from "antd";
|
|
3
3
|
import { useEffect as L, useState as G, useCallback as J } from "react";
|
|
4
4
|
import K from "react-highlight-words";
|
|
5
5
|
import { useTranslationLib as Q } from "../locale/index.es.js";
|
|
@@ -9,25 +9,25 @@ import Z from "../common/check-box/CheckBox.es.js";
|
|
|
9
9
|
import V from "../common/date-picker/DatePicker.es.js";
|
|
10
10
|
import ee from "../common/date-picker/TimePicker.es.js";
|
|
11
11
|
import M from "../common/select/SelectComponent.es.js";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
12
|
+
import re from "../common/text-field/NumberField.es.js";
|
|
13
|
+
import te from "../common/text-field/TextField.es.js";
|
|
14
|
+
import oe from "../common/text-field/TextArea.es.js";
|
|
15
15
|
import ae from "../common/tooltip/TooltipComponent.es.js";
|
|
16
16
|
function Te(x) {
|
|
17
17
|
const {
|
|
18
18
|
label: i,
|
|
19
|
-
name:
|
|
19
|
+
name: c,
|
|
20
20
|
type: b,
|
|
21
21
|
required: s,
|
|
22
22
|
hidden: w,
|
|
23
23
|
rules: u = [],
|
|
24
24
|
updatable: h = !0,
|
|
25
25
|
readonly: k = !1,
|
|
26
|
-
fieldClassName:
|
|
26
|
+
fieldClassName: g,
|
|
27
27
|
customFormFieldRender: R,
|
|
28
28
|
fieldTooltip: v,
|
|
29
29
|
...e
|
|
30
|
-
} = x, p =
|
|
30
|
+
} = x, p = j.useFormInstance();
|
|
31
31
|
L(() => {
|
|
32
32
|
if (b === "select") {
|
|
33
33
|
const {
|
|
@@ -39,7 +39,7 @@ function Te(x) {
|
|
|
39
39
|
}
|
|
40
40
|
}, [p, e, b, e == null ? void 0 : e.updatingValue]);
|
|
41
41
|
const { t: N } = Q();
|
|
42
|
-
if (k || w) return /* @__PURE__ */
|
|
42
|
+
if (k || w) return /* @__PURE__ */ o(S, {});
|
|
43
43
|
if (R)
|
|
44
44
|
return R(p, x);
|
|
45
45
|
switch (b) {
|
|
@@ -47,8 +47,8 @@ function Te(x) {
|
|
|
47
47
|
case "email":
|
|
48
48
|
case "password": {
|
|
49
49
|
const { onChange: a, placeholder: n } = e;
|
|
50
|
-
return /* @__PURE__ */
|
|
51
|
-
|
|
50
|
+
return /* @__PURE__ */ o(
|
|
51
|
+
te,
|
|
52
52
|
{
|
|
53
53
|
placeholder: n,
|
|
54
54
|
disabled: !h,
|
|
@@ -56,31 +56,31 @@ function Te(x) {
|
|
|
56
56
|
required: s,
|
|
57
57
|
onChange: a ? (l) => a(l, p) : void 0,
|
|
58
58
|
type: b,
|
|
59
|
-
name:
|
|
59
|
+
name: c,
|
|
60
60
|
tooltip: v,
|
|
61
61
|
label: i,
|
|
62
|
-
className:
|
|
62
|
+
className: g,
|
|
63
63
|
autoComplete: "new-password"
|
|
64
64
|
}
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
case "number": {
|
|
68
68
|
const { onChange: a, placeholder: n, allowMinus: l } = e;
|
|
69
|
-
return /* @__PURE__ */
|
|
70
|
-
|
|
69
|
+
return /* @__PURE__ */ o(
|
|
70
|
+
re,
|
|
71
71
|
{
|
|
72
72
|
placeholder: n,
|
|
73
73
|
disabled: !h,
|
|
74
74
|
moneyField: !!e.formatted,
|
|
75
75
|
type: b,
|
|
76
|
-
onChange: a ? (
|
|
76
|
+
onChange: a ? (f) => a(f, p) : void 0,
|
|
77
77
|
rules: u,
|
|
78
78
|
autoComplete: "false",
|
|
79
79
|
required: s,
|
|
80
80
|
tooltip: v,
|
|
81
|
-
className:
|
|
81
|
+
className: g,
|
|
82
82
|
min: l ? null : void 0,
|
|
83
|
-
name:
|
|
83
|
+
name: c,
|
|
84
84
|
label: i
|
|
85
85
|
}
|
|
86
86
|
);
|
|
@@ -90,28 +90,28 @@ function Te(x) {
|
|
|
90
90
|
range: a,
|
|
91
91
|
disableToday: n,
|
|
92
92
|
disabledFutureDays: l,
|
|
93
|
-
disabledPastDays:
|
|
93
|
+
disabledPastDays: f,
|
|
94
94
|
onChange: C,
|
|
95
|
-
placeholder:
|
|
95
|
+
placeholder: m,
|
|
96
96
|
format: y
|
|
97
97
|
} = e;
|
|
98
|
-
return /* @__PURE__ */
|
|
98
|
+
return /* @__PURE__ */ o(
|
|
99
99
|
V,
|
|
100
100
|
{
|
|
101
|
-
placeholder:
|
|
101
|
+
placeholder: m,
|
|
102
102
|
required: s,
|
|
103
103
|
disabled: !h,
|
|
104
104
|
type: b,
|
|
105
105
|
format: y,
|
|
106
106
|
tooltip: v,
|
|
107
107
|
range: a,
|
|
108
|
-
name:
|
|
108
|
+
name: c,
|
|
109
109
|
label: i,
|
|
110
110
|
onChange: C ? (T) => C(T, p) : void 0,
|
|
111
|
-
className:
|
|
111
|
+
className: g,
|
|
112
112
|
disableToday: n,
|
|
113
113
|
disabledFutureDays: l,
|
|
114
|
-
disabledPastDays:
|
|
114
|
+
disabledPastDays: f
|
|
115
115
|
}
|
|
116
116
|
);
|
|
117
117
|
}
|
|
@@ -120,13 +120,13 @@ function Te(x) {
|
|
|
120
120
|
range: a = !1,
|
|
121
121
|
disableCurrent: n,
|
|
122
122
|
disabledFuture: l,
|
|
123
|
-
disabledPast:
|
|
123
|
+
disabledPast: f,
|
|
124
124
|
onChange: C,
|
|
125
|
-
use12Hours:
|
|
125
|
+
use12Hours: m,
|
|
126
126
|
format: y,
|
|
127
127
|
placeholder: T
|
|
128
128
|
} = e;
|
|
129
|
-
return /* @__PURE__ */
|
|
129
|
+
return /* @__PURE__ */ o(
|
|
130
130
|
ee,
|
|
131
131
|
{
|
|
132
132
|
placeholder: T,
|
|
@@ -136,79 +136,79 @@ function Te(x) {
|
|
|
136
136
|
type: b,
|
|
137
137
|
tooltip: v,
|
|
138
138
|
range: a,
|
|
139
|
-
use12Hours:
|
|
140
|
-
name:
|
|
139
|
+
use12Hours: m,
|
|
140
|
+
name: c,
|
|
141
141
|
label: i,
|
|
142
|
-
onChange: C ? (
|
|
143
|
-
className:
|
|
142
|
+
onChange: C ? (r) => C(r, p) : void 0,
|
|
143
|
+
className: g,
|
|
144
144
|
disableCurrent: n,
|
|
145
145
|
disabledFuture: l,
|
|
146
|
-
disabledPast:
|
|
146
|
+
disabledPast: f
|
|
147
147
|
}
|
|
148
148
|
);
|
|
149
149
|
}
|
|
150
150
|
case "textarea": {
|
|
151
|
-
const { onChange: a, placeholder: n, rows: l, cols:
|
|
152
|
-
return /* @__PURE__ */
|
|
153
|
-
|
|
151
|
+
const { onChange: a, placeholder: n, rows: l, cols: f } = e;
|
|
152
|
+
return /* @__PURE__ */ o(
|
|
153
|
+
oe,
|
|
154
154
|
{
|
|
155
155
|
rules: u,
|
|
156
156
|
placeholder: n,
|
|
157
157
|
onChange: a ? (C) => {
|
|
158
|
-
var
|
|
159
|
-
return a((
|
|
158
|
+
var m;
|
|
159
|
+
return a((m = C == null ? void 0 : C.target) == null ? void 0 : m.value, p);
|
|
160
160
|
} : void 0,
|
|
161
161
|
tooltip: v,
|
|
162
162
|
required: s,
|
|
163
163
|
disabled: !h,
|
|
164
|
-
name:
|
|
164
|
+
name: c,
|
|
165
165
|
label: i,
|
|
166
|
-
className:
|
|
166
|
+
className: g,
|
|
167
167
|
rows: l,
|
|
168
|
-
cols:
|
|
168
|
+
cols: f
|
|
169
169
|
}
|
|
170
170
|
);
|
|
171
171
|
}
|
|
172
172
|
case "image":
|
|
173
|
-
return /* @__PURE__ */
|
|
173
|
+
return /* @__PURE__ */ o(
|
|
174
174
|
Y,
|
|
175
175
|
{
|
|
176
176
|
...e,
|
|
177
177
|
required: s,
|
|
178
|
-
name:
|
|
178
|
+
name: c,
|
|
179
179
|
label: i,
|
|
180
180
|
rules: u,
|
|
181
|
-
fieldClassName:
|
|
181
|
+
fieldClassName: g,
|
|
182
182
|
onRemoved: e.onRemoved,
|
|
183
183
|
onUploading: e.onUploading,
|
|
184
184
|
provider: e.provider
|
|
185
185
|
}
|
|
186
186
|
);
|
|
187
187
|
case "file":
|
|
188
|
-
return /* @__PURE__ */
|
|
188
|
+
return /* @__PURE__ */ o(
|
|
189
189
|
X,
|
|
190
190
|
{
|
|
191
191
|
...e,
|
|
192
192
|
required: s,
|
|
193
|
-
name:
|
|
193
|
+
name: c,
|
|
194
194
|
label: i,
|
|
195
195
|
rules: u,
|
|
196
|
-
fieldClassName:
|
|
196
|
+
fieldClassName: g,
|
|
197
197
|
onRemoved: e.onRemoved,
|
|
198
198
|
onUploading: e.onUploading,
|
|
199
199
|
provider: e.provider
|
|
200
200
|
}
|
|
201
201
|
);
|
|
202
202
|
case "select":
|
|
203
|
-
return /* @__PURE__ */
|
|
203
|
+
return /* @__PURE__ */ o(
|
|
204
204
|
le,
|
|
205
205
|
{
|
|
206
206
|
...e,
|
|
207
207
|
required: s,
|
|
208
|
-
name:
|
|
208
|
+
name: c,
|
|
209
209
|
label: i,
|
|
210
210
|
rules: u,
|
|
211
|
-
fieldClassName:
|
|
211
|
+
fieldClassName: g,
|
|
212
212
|
form: p,
|
|
213
213
|
updatable: h,
|
|
214
214
|
readonly: k,
|
|
@@ -220,104 +220,103 @@ function Te(x) {
|
|
|
220
220
|
enum: a,
|
|
221
221
|
radio: n = !1,
|
|
222
222
|
translation: l,
|
|
223
|
-
onChange:
|
|
223
|
+
onChange: f,
|
|
224
224
|
onSearch: C,
|
|
225
|
-
multiple:
|
|
225
|
+
multiple: m,
|
|
226
226
|
tagRender: y
|
|
227
227
|
} = e, T = Array.isArray(a) ? a : Object.keys(a);
|
|
228
|
-
return n ? /* @__PURE__ */
|
|
229
|
-
|
|
228
|
+
return n ? /* @__PURE__ */ o(
|
|
229
|
+
j.Item,
|
|
230
230
|
{
|
|
231
231
|
...e,
|
|
232
|
-
name:
|
|
232
|
+
name: c,
|
|
233
233
|
required: s,
|
|
234
234
|
tooltip: v,
|
|
235
235
|
rules: u,
|
|
236
236
|
label: i,
|
|
237
|
-
className: ["w-100",
|
|
238
|
-
children: /* @__PURE__ */
|
|
237
|
+
className: ["w-100", g].join(" "),
|
|
238
|
+
children: /* @__PURE__ */ o(
|
|
239
239
|
E.Group,
|
|
240
240
|
{
|
|
241
241
|
...e,
|
|
242
|
-
onChange:
|
|
242
|
+
onChange: f ? (r) => {
|
|
243
243
|
var F;
|
|
244
|
-
return
|
|
244
|
+
return f((F = r == null ? void 0 : r.target) == null ? void 0 : F.value, p);
|
|
245
245
|
} : void 0,
|
|
246
|
-
children: T.map((
|
|
246
|
+
children: T.map((r) => /* @__PURE__ */ o(E, { disabled: !h, value: r, children: l ? N(l[r]) : r }, r))
|
|
247
247
|
}
|
|
248
248
|
)
|
|
249
249
|
}
|
|
250
|
-
) : /* @__PURE__ */
|
|
250
|
+
) : /* @__PURE__ */ o(
|
|
251
251
|
M,
|
|
252
252
|
{
|
|
253
253
|
...e,
|
|
254
|
-
tagRender: typeof y == "function" ? y : y ? (
|
|
255
|
-
const { value: F, label: O } =
|
|
256
|
-
return P ? /* @__PURE__ */
|
|
254
|
+
tagRender: typeof y == "function" ? y : y ? (r) => {
|
|
255
|
+
const { value: F, label: O } = r, P = y[F];
|
|
256
|
+
return P ? /* @__PURE__ */ o(W, { color: P.color, children: O }) : /* @__PURE__ */ o(W, { children: O });
|
|
257
257
|
} : void 0,
|
|
258
|
-
onChange:
|
|
259
|
-
className: ["w-100",
|
|
260
|
-
name:
|
|
258
|
+
onChange: f ? (r) => f(r, p) : void 0,
|
|
259
|
+
className: ["w-100", g].join(" "),
|
|
260
|
+
name: c,
|
|
261
261
|
items: T,
|
|
262
262
|
required: s,
|
|
263
263
|
tooltip: v,
|
|
264
264
|
rules: u,
|
|
265
265
|
label: i,
|
|
266
266
|
disabled: !h,
|
|
267
|
-
onSearch: C ? (
|
|
267
|
+
onSearch: C ? (r) => C(r, p) : void 0,
|
|
268
268
|
allowClear: !0,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
itemBuilder: (t) => /* @__PURE__ */ r(I.Option, { value: t, children: l ? N(l[t]) : t }, t)
|
|
269
|
+
mode: m ? "multiple" : void 0,
|
|
270
|
+
itemBuilder: (r) => /* @__PURE__ */ o(I.Option, { value: r, children: l ? N(l[r]) : r }, r)
|
|
272
271
|
}
|
|
273
272
|
);
|
|
274
273
|
}
|
|
275
274
|
case "checkbox": {
|
|
276
275
|
const { onChange: a } = e;
|
|
277
|
-
return /* @__PURE__ */
|
|
276
|
+
return /* @__PURE__ */ o(
|
|
278
277
|
Z,
|
|
279
278
|
{
|
|
280
|
-
className:
|
|
279
|
+
className: g,
|
|
281
280
|
rules: u,
|
|
282
281
|
onChange: a ? (n) => a(n, p) : void 0,
|
|
283
282
|
label: i,
|
|
284
283
|
tooltip: v,
|
|
285
284
|
disabled: !h,
|
|
286
|
-
name:
|
|
285
|
+
name: c
|
|
287
286
|
}
|
|
288
287
|
);
|
|
289
288
|
}
|
|
290
289
|
case "color":
|
|
291
|
-
return /* @__PURE__ */
|
|
290
|
+
return /* @__PURE__ */ o(
|
|
292
291
|
ne,
|
|
293
292
|
{
|
|
294
293
|
...e,
|
|
295
294
|
type: "color",
|
|
296
295
|
required: s,
|
|
297
|
-
name:
|
|
296
|
+
name: c,
|
|
298
297
|
label: i,
|
|
299
298
|
rules: u,
|
|
300
|
-
fieldClassName:
|
|
299
|
+
fieldClassName: g,
|
|
301
300
|
updatable: h,
|
|
302
301
|
readonly: k,
|
|
303
302
|
fieldTooltip: v
|
|
304
303
|
}
|
|
305
304
|
);
|
|
306
305
|
default:
|
|
307
|
-
return /* @__PURE__ */
|
|
306
|
+
return /* @__PURE__ */ o(S, { children: `${b} Not Implemented` });
|
|
308
307
|
}
|
|
309
308
|
}
|
|
310
309
|
function le(x) {
|
|
311
310
|
const {
|
|
312
311
|
items: i = [],
|
|
313
|
-
loading:
|
|
312
|
+
loading: c,
|
|
314
313
|
searchOnType: b,
|
|
315
314
|
onSearch: s,
|
|
316
315
|
multiple: w,
|
|
317
316
|
onChange: u,
|
|
318
317
|
highlightSearch: h,
|
|
319
318
|
required: k,
|
|
320
|
-
fieldClassName:
|
|
319
|
+
fieldClassName: g,
|
|
321
320
|
rules: R,
|
|
322
321
|
fieldTooltip: v,
|
|
323
322
|
updatable: e,
|
|
@@ -326,48 +325,48 @@ function le(x) {
|
|
|
326
325
|
tagRender: a,
|
|
327
326
|
updatingValue: n,
|
|
328
327
|
onSet: l,
|
|
329
|
-
placeholder:
|
|
328
|
+
placeholder: f,
|
|
330
329
|
allowClear: C = !0
|
|
331
|
-
} = x,
|
|
330
|
+
} = x, m = x.form, [y, T] = G(""), r = j.useWatch(N, m), [F, O] = G(!0);
|
|
332
331
|
L(() => {
|
|
333
|
-
l && F &&
|
|
334
|
-
}, [F,
|
|
335
|
-
|
|
336
|
-
}, [
|
|
332
|
+
l && F && r && (l == null || l(r, i, m), O(!1));
|
|
333
|
+
}, [F, m, i, N, l, r]), L(() => {
|
|
334
|
+
r && O(!0);
|
|
335
|
+
}, [r]);
|
|
337
336
|
const P = J(
|
|
338
|
-
async (
|
|
339
|
-
T(
|
|
337
|
+
async (t) => {
|
|
338
|
+
T(t), b && (s == null || s(t, m, n));
|
|
340
339
|
},
|
|
341
|
-
[
|
|
340
|
+
[m, s, b, n]
|
|
342
341
|
);
|
|
343
|
-
return /* @__PURE__ */
|
|
342
|
+
return /* @__PURE__ */ o(
|
|
344
343
|
M,
|
|
345
344
|
{
|
|
346
345
|
...x,
|
|
347
346
|
maxTagCount: "responsive",
|
|
348
|
-
maxTagPlaceholder: (
|
|
347
|
+
maxTagPlaceholder: (t) => /* @__PURE__ */ D(
|
|
349
348
|
ae,
|
|
350
349
|
{
|
|
351
|
-
title: /* @__PURE__ */
|
|
352
|
-
|
|
350
|
+
title: /* @__PURE__ */ o(S, { children: t.map((d) => /* @__PURE__ */ D(S, { children: [
|
|
351
|
+
d.label,
|
|
353
352
|
" ",
|
|
354
|
-
/* @__PURE__ */
|
|
353
|
+
/* @__PURE__ */ o("br", {})
|
|
355
354
|
] })) }),
|
|
356
355
|
children: [
|
|
357
356
|
"+",
|
|
358
|
-
|
|
357
|
+
t == null ? void 0 : t.length
|
|
359
358
|
]
|
|
360
359
|
}
|
|
361
360
|
),
|
|
362
|
-
placeholder:
|
|
363
|
-
onSelect: (
|
|
364
|
-
l == null || l(
|
|
361
|
+
placeholder: f,
|
|
362
|
+
onSelect: (t) => {
|
|
363
|
+
l == null || l(t == null ? void 0 : t.key, i, m);
|
|
365
364
|
},
|
|
366
|
-
onChange: u ? (
|
|
367
|
-
T(""), u(
|
|
365
|
+
onChange: u ? (t) => {
|
|
366
|
+
T(""), u(t, m);
|
|
368
367
|
} : void 0,
|
|
369
368
|
mode: w ? "multiple" : void 0,
|
|
370
|
-
className: ["w-100",
|
|
369
|
+
className: ["w-100", g].join(" "),
|
|
371
370
|
name: N,
|
|
372
371
|
items: i,
|
|
373
372
|
required: k,
|
|
@@ -378,11 +377,11 @@ function le(x) {
|
|
|
378
377
|
label: p,
|
|
379
378
|
allowClear: C,
|
|
380
379
|
onSearch: P,
|
|
381
|
-
loading:
|
|
382
|
-
filterOption: h ? (
|
|
380
|
+
loading: c,
|
|
381
|
+
filterOption: h ? (t, d) => {
|
|
383
382
|
var A, B, H;
|
|
384
383
|
try {
|
|
385
|
-
const U =
|
|
384
|
+
const U = t.toLowerCase().split(/\s+/), _ = ((typeof (d == null ? void 0 : d.children) == "string" ? d == null ? void 0 : d.children : (B = (A = d == null ? void 0 : d.children) == null ? void 0 : A.props) == null ? void 0 : B.textToHighlight) ?? "").toLowerCase(), $ = (((H = d == null ? void 0 : d.value) == null ? void 0 : H.toString()) ?? "").toLowerCase();
|
|
386
385
|
return U.every(
|
|
387
386
|
(q) => _.indexOf(q) >= 0 || $.indexOf(q) >= 0
|
|
388
387
|
);
|
|
@@ -390,35 +389,35 @@ function le(x) {
|
|
|
390
389
|
return !0;
|
|
391
390
|
}
|
|
392
391
|
} : void 0,
|
|
393
|
-
itemBuilder: h ? (
|
|
394
|
-
const
|
|
395
|
-
return /* @__PURE__ */
|
|
392
|
+
itemBuilder: h ? (t) => {
|
|
393
|
+
const d = t.value ? String(t.value) : void 0;
|
|
394
|
+
return /* @__PURE__ */ o(
|
|
396
395
|
I.Option,
|
|
397
396
|
{
|
|
398
|
-
value:
|
|
399
|
-
title:
|
|
400
|
-
disabled:
|
|
401
|
-
children: /* @__PURE__ */
|
|
397
|
+
value: t.key,
|
|
398
|
+
title: d,
|
|
399
|
+
disabled: t.disabled,
|
|
400
|
+
children: /* @__PURE__ */ o(
|
|
402
401
|
K,
|
|
403
402
|
{
|
|
404
403
|
highlightClassName: "highlight-text",
|
|
405
404
|
searchWords: (y ?? "").split(" "),
|
|
406
405
|
autoEscape: !0,
|
|
407
|
-
textToHighlight:
|
|
406
|
+
textToHighlight: d ?? ""
|
|
408
407
|
}
|
|
409
408
|
)
|
|
410
409
|
},
|
|
411
|
-
|
|
410
|
+
t.key
|
|
412
411
|
);
|
|
413
|
-
} : (
|
|
412
|
+
} : (t) => /* @__PURE__ */ o(
|
|
414
413
|
I.Option,
|
|
415
414
|
{
|
|
416
|
-
value:
|
|
417
|
-
title:
|
|
418
|
-
disabled:
|
|
419
|
-
children:
|
|
415
|
+
value: t.key,
|
|
416
|
+
title: t.value,
|
|
417
|
+
disabled: t.disabled,
|
|
418
|
+
children: t.value
|
|
420
419
|
},
|
|
421
|
-
|
|
420
|
+
t.key
|
|
422
421
|
)
|
|
423
422
|
}
|
|
424
423
|
);
|
|
@@ -426,22 +425,22 @@ function le(x) {
|
|
|
426
425
|
function ne(x) {
|
|
427
426
|
const {
|
|
428
427
|
required: i,
|
|
429
|
-
fieldClassName:
|
|
428
|
+
fieldClassName: c,
|
|
430
429
|
rules: b,
|
|
431
430
|
fieldTooltip: s,
|
|
432
431
|
updatable: w,
|
|
433
432
|
label: u,
|
|
434
433
|
name: h
|
|
435
434
|
} = x;
|
|
436
|
-
return /* @__PURE__ */
|
|
437
|
-
|
|
435
|
+
return /* @__PURE__ */ o(
|
|
436
|
+
j.Item,
|
|
438
437
|
{
|
|
439
438
|
label: u,
|
|
440
439
|
name: h,
|
|
441
440
|
required: i,
|
|
442
441
|
rules: b,
|
|
443
442
|
tooltip: s,
|
|
444
|
-
children: /* @__PURE__ */
|
|
443
|
+
children: /* @__PURE__ */ o(
|
|
445
444
|
z,
|
|
446
445
|
{
|
|
447
446
|
disabledAlpha: !0,
|
|
@@ -449,7 +448,7 @@ function ne(x) {
|
|
|
449
448
|
defaultFormat: "hex",
|
|
450
449
|
showText: !0,
|
|
451
450
|
trigger: "click",
|
|
452
|
-
className:
|
|
451
|
+
className: c,
|
|
453
452
|
disabled: !w,
|
|
454
453
|
...x.innerProps
|
|
455
454
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kingteza/crud-component",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.46",
|
|
5
5
|
"description": "React CRUD component library with Ant Design",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"react",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@types/react-show-more-text": "^1.4.5",
|
|
87
87
|
"@types/uuid": "^10.0.0",
|
|
88
88
|
"@vitejs/plugin-react": "^4.3.4",
|
|
89
|
-
"antd": "^5.22.
|
|
89
|
+
"antd": "^5.22.7",
|
|
90
90
|
"eslint": "^9.17.0",
|
|
91
91
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
92
92
|
"eslint-plugin-react-refresh": "^0.4.16",
|