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