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