@kingteza/crud-component 1.0.58 → 1.0.60
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/select/SelectComponent.cjs.js +1 -1
- package/common/select/SelectComponent.d.ts +1 -1
- package/common/select/SelectComponent.es.js +40 -43
- package/crud/CrudField.cjs.js +1 -1
- package/crud/CrudField.es.js +23 -23
- package/locale/index.cjs.js +1 -1
- package/locale/index.d.ts +1 -0
- package/locale/index.es.js +21 -20
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),l=require("antd"),O=require("react"),V=require("../../locale/index.cjs.js"),B=require("../tooltip/TooltipComponent.cjs.js"),D=require("../../util/ValidationUtil.cjs.js");function E({label:a,rules:S=[],required:h,placeholder:x,notSearch:L,children:f,readOnly:s,items:o,dropdownRender:p,itemBuilder:q,loading:m,showLoadingInEmptyIndicator:T,nameFieldInArray:u="name",innerRef:_,tooltip:b,filterOption:N,tagRender:R,...r}){const{t:P}=V.useTranslationLib(),k=O.useCallback(e=>{const t=typeof e=="string"||typeof e=="number"?e:e==null?void 0:e.id,c=typeof e=="string"||typeof e=="number"?e:e==null?void 0:e[u];return n.jsx("option",{value:t,children:n.jsx("div",{dangerouslySetInnerHTML:{__html:c}})},t)},[u]),F=a??x??"";return n.jsx(l.ConfigProvider,{renderEmpty:T&&m?()=>n.jsx(l.Spin,{}):void 0,children:n.jsx(B,{title:b,children:n.jsx(l.Form.Item,{label:a,name:r.name,help:r.help,className:r.className,required:h,rules:[...S,...h?D.required(F):[]],children:n.jsx(l.Select,{ref:_,loading:m,open:s?!1:void 0,onChange:!s&&r.onChange,allowClear:!s&&r.allowClear,showSearch:!L,className:`max-width ${s?"readOnly":""}`,...r,tagRender:R,placeholder:x??a,filterOption:N??((e,t)=>{var c,g,C,j;try{const i=(C=(g=(c=t==null?void 0:t.children)==null?void 0:c.props)==null?void 0:g.dangerouslySetInnerHTML)==null?void 0:C.__html,H=e.toLowerCase().split(/\s+/),y=(t==null?void 0:t.children)??"",w=typeof y=="string"?y.toLowerCase():typeof i=="string"?i.toLowerCase():"",I=(((j=t==null?void 0:t.value)==null?void 0:j.toString())??"").toLowerCase(),M=w.replace(/\s/g,"");return H.every(d=>w.indexOf(d)>=0||I.indexOf(d)>=0||M.indexOf(d)>=0)}catch(i){return console.log(i),!0}}),popupRender:p,children:f===null?void 0:f??(o?o==null?void 0:o.map(q??k):n.jsx(n.Fragment,{}))})})})})}module.exports=E;
|
|
@@ -17,5 +17,5 @@ interface SelectComponentProps<T> extends SelectProps<any>, FormItemProps<any> {
|
|
|
17
17
|
filterOption?: SelectProps["filterOption"];
|
|
18
18
|
tagRender?: SelectTagRenderProps;
|
|
19
19
|
}
|
|
20
|
-
declare function SelectComponent<T = any>({ label, rules, required, placeholder, notSearch, children, readOnly, items, dropdownRender, itemBuilder, loading, showLoadingInEmptyIndicator, nameFieldInArray, innerRef, tooltip, filterOption, tagRender, ...props }: SelectComponentProps<T
|
|
20
|
+
declare function SelectComponent<T = any>({ label, rules, required, placeholder, notSearch, children, readOnly, items, dropdownRender, itemBuilder, loading, showLoadingInEmptyIndicator, nameFieldInArray, innerRef, tooltip, filterOption, tagRender, ...props }: Readonly<SelectComponentProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
21
21
|
export default SelectComponent;
|
|
@@ -1,81 +1,78 @@
|
|
|
1
|
-
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { ConfigProvider as
|
|
3
|
-
import { useCallback as
|
|
4
|
-
import { useTranslationLib as
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
import { jsx as t, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import { ConfigProvider as B, Form as D, Select as E, Spin as P } from "antd";
|
|
3
|
+
import { useCallback as R } from "react";
|
|
4
|
+
import { useTranslationLib as U } from "../../locale/index.es.js";
|
|
5
|
+
import W from "../tooltip/TooltipComponent.es.js";
|
|
6
|
+
import $ from "../../util/ValidationUtil.es.js";
|
|
7
|
+
function Y({
|
|
7
8
|
label: m,
|
|
8
|
-
rules:
|
|
9
|
-
required:
|
|
10
|
-
placeholder:
|
|
9
|
+
rules: S = [],
|
|
10
|
+
required: f,
|
|
11
|
+
placeholder: a,
|
|
11
12
|
notSearch: L,
|
|
12
|
-
children:
|
|
13
|
+
children: d,
|
|
13
14
|
readOnly: o,
|
|
14
15
|
items: s,
|
|
15
16
|
dropdownRender: u,
|
|
16
17
|
itemBuilder: T,
|
|
17
|
-
loading:
|
|
18
|
+
loading: h,
|
|
18
19
|
showLoadingInEmptyIndicator: _,
|
|
19
|
-
nameFieldInArray:
|
|
20
|
-
innerRef:
|
|
21
|
-
tooltip:
|
|
22
|
-
filterOption:
|
|
23
|
-
tagRender:
|
|
20
|
+
nameFieldInArray: g = "name",
|
|
21
|
+
innerRef: b,
|
|
22
|
+
tooltip: N,
|
|
23
|
+
filterOption: k,
|
|
24
|
+
tagRender: F,
|
|
24
25
|
...n
|
|
25
26
|
}) {
|
|
26
|
-
const { t:
|
|
27
|
+
const { t: q } = U(), H = R(
|
|
27
28
|
(e) => {
|
|
28
|
-
const r = typeof e == "string" || typeof e == "number" ? e : e == null ? void 0 : e.id, c = typeof e == "string" || typeof e == "number" ? e : e == null ? void 0 : e[
|
|
29
|
+
const r = typeof e == "string" || typeof e == "number" ? e : e == null ? void 0 : e.id, c = typeof e == "string" || typeof e == "number" ? e : e == null ? void 0 : e[g];
|
|
29
30
|
return /* @__PURE__ */ t("option", { value: r, children: /* @__PURE__ */ t("div", { dangerouslySetInnerHTML: { __html: c } }) }, r);
|
|
30
31
|
},
|
|
31
|
-
[
|
|
32
|
-
);
|
|
32
|
+
[g]
|
|
33
|
+
), I = m ?? a ?? "";
|
|
33
34
|
return /* @__PURE__ */ t(
|
|
34
|
-
|
|
35
|
+
B,
|
|
35
36
|
{
|
|
36
|
-
renderEmpty: _ &&
|
|
37
|
-
children: /* @__PURE__ */ t(
|
|
38
|
-
|
|
37
|
+
renderEmpty: _ && h ? () => /* @__PURE__ */ t(P, {}) : void 0,
|
|
38
|
+
children: /* @__PURE__ */ t(W, { title: N, children: /* @__PURE__ */ t(
|
|
39
|
+
D.Item,
|
|
39
40
|
{
|
|
40
41
|
label: m,
|
|
41
42
|
name: n.name,
|
|
42
43
|
help: n.help,
|
|
43
44
|
className: n.className,
|
|
45
|
+
required: f,
|
|
44
46
|
rules: [
|
|
45
|
-
...
|
|
46
|
-
|
|
47
|
-
required: S,
|
|
48
|
-
message: `${m ?? f ?? ""} ${H(
|
|
49
|
-
"err.validation.required"
|
|
50
|
-
)}`
|
|
51
|
-
}
|
|
47
|
+
...S,
|
|
48
|
+
...f ? $.required(I) : []
|
|
52
49
|
],
|
|
53
50
|
children: /* @__PURE__ */ t(
|
|
54
|
-
|
|
51
|
+
E,
|
|
55
52
|
{
|
|
56
|
-
ref:
|
|
57
|
-
loading:
|
|
53
|
+
ref: b,
|
|
54
|
+
loading: h,
|
|
58
55
|
open: o ? !1 : void 0,
|
|
59
56
|
onChange: !o && n.onChange,
|
|
60
57
|
allowClear: !o && n.allowClear,
|
|
61
58
|
showSearch: !L,
|
|
62
59
|
className: `max-width ${o ? "readOnly" : ""}`,
|
|
63
60
|
...n,
|
|
64
|
-
tagRender:
|
|
65
|
-
placeholder:
|
|
66
|
-
filterOption:
|
|
67
|
-
var c,
|
|
61
|
+
tagRender: F,
|
|
62
|
+
placeholder: a ?? m,
|
|
63
|
+
filterOption: k ?? ((e, r) => {
|
|
64
|
+
var c, p, C, y;
|
|
68
65
|
try {
|
|
69
|
-
const i = (C = (
|
|
66
|
+
const i = (C = (p = (c = r == null ? void 0 : r.children) == null ? void 0 : c.props) == null ? void 0 : p.dangerouslySetInnerHTML) == null ? void 0 : C.__html, M = e.toLowerCase().split(/\s+/), w = (r == null ? void 0 : r.children) ?? "", x = typeof w == "string" ? w.toLowerCase() : typeof i == "string" ? i.toLowerCase() : "", O = (((y = r == null ? void 0 : r.value) == null ? void 0 : y.toString()) ?? "").toLowerCase(), V = x.replace(/\s/g, "");
|
|
70
67
|
return M.every(
|
|
71
|
-
(l) =>
|
|
68
|
+
(l) => x.indexOf(l) >= 0 || O.indexOf(l) >= 0 || V.indexOf(l) >= 0
|
|
72
69
|
);
|
|
73
70
|
} catch (i) {
|
|
74
71
|
return console.log(i), !0;
|
|
75
72
|
}
|
|
76
73
|
}),
|
|
77
|
-
|
|
78
|
-
children:
|
|
74
|
+
popupRender: u,
|
|
75
|
+
children: d === null ? void 0 : d ?? (s ? s == null ? void 0 : s.map(T ?? H) : /* @__PURE__ */ t(j, {}))
|
|
79
76
|
}
|
|
80
77
|
)
|
|
81
78
|
}
|
|
@@ -84,5 +81,5 @@ function Q({
|
|
|
84
81
|
);
|
|
85
82
|
}
|
|
86
83
|
export {
|
|
87
|
-
|
|
84
|
+
Y as default
|
|
88
85
|
};
|
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"),p=require("antd"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),p=require("antd"),T=require("react"),$=require("react-highlight-words"),z=require("../locale/index.cjs.js"),J=require("./FileCrudField.cjs.js"),K=require("./ImageCrudField.cjs.js"),Q=require("../common/check-box/CheckBox.cjs.js"),X=require("../common/date-picker/DatePicker.cjs.js"),Y=require("../common/date-picker/TimePicker.cjs.js"),E=require("../common/select/SelectComponent.cjs.js"),Z=require("../common/text-field/NumberField.cjs.js"),V=require("../common/text-field/TextField.cjs.js"),ee=require("../common/tooltip/TooltipComponent.cjs.js"),te=require("./CrudTextAreaComponent.cjs.js"),B=require("../util/CrudUtil.cjs.js");function re(j){const{label:s,name:c,type:g,required:i,hidden:S,rules:u=[],updatable:m=!0,readonly:w=!1,fieldClassName:f,customFormFieldRender:O,fieldTooltip:b,...t}=j,h=p.Form.useFormInstance();T.useEffect(()=>{if(g==="select"){const{items:n=[],onSearch:o,searchOnType:l}=t;!(n!=null&&n.length)&&!l&&(o==null||o(void 0,h,t==null?void 0:t.updatingValue))}},[h,t,g,t==null?void 0:t.updatingValue]);const{t:q}=z.useTranslationLibNoNS();if(w||S)return e.jsx(e.Fragment,{});if(O)return O(h,j);switch(g){case"text":case"email":case"password":{const{onChange:n,placeholder:o}=t;return e.jsx(V.default,{placeholder:o,disabled:!m,rules:u,required:i,onChange:n?l=>n(l,h):void 0,type:g,name:c,tooltip:b,label:s,className:f,autoComplete:"new-password"})}case"number":{const{onChange:n,placeholder:o,allowMinus:l}=t;return e.jsx(Z,{placeholder:o,disabled:!m,moneyField:!!t.formatted,type:g,onChange:n?x=>n(x,h):void 0,rules:u,autoComplete:"false",required:i,tooltip:b,className:f,min:l?null:void 0,name:c,label:s})}case"date":{const{range:n,disableToday:o,disabledFutureDays:l,disabledPastDays:x,onChange:v,placeholder:C,format:F}=t;return e.jsx(X,{placeholder:C,required:i,disabled:!m,type:g,format:F,tooltip:b,range:n,name:c,label:s,onChange:v?y=>v(y,h):void 0,className:f,disableToday:o,disabledFutureDays:l,disabledPastDays:x})}case"time":{const{range:n=!1,disableCurrent:o,disabledFuture:l,disabledPast:x,onChange:v,use12Hours:C,format:F,placeholder:y}=t;return e.jsx(Y,{placeholder:y,required:i,format:F,disabled:!m,type:g,tooltip:b,range:n,use12Hours:C,name:c,label:s,onChange:v?a=>v(a,h):void 0,className:f,disableCurrent:o,disabledFuture:l,disabledPast:x})}case"textarea":return e.jsx(te,{...j});case"image":return e.jsx(K.default,{...t,required:i,name:c,label:s,rules:u,fieldClassName:f,onRemoved:t.onRemoved,onUploading:t.onUploading,provider:t.provider});case"file":return e.jsx(J.default,{...t,required:i,name:c,label:s,rules:u,fieldClassName:f,onRemoved:t.onRemoved,onUploading:t.onUploading,provider:t.provider});case"select":return e.jsx(H,{...t,required:i,name:c,label:s,rules:u,fieldClassName:f,form:h,updatable:m,readonly:w,fieldTooltip:b});case"enum":{const{enum:n,radio:o=!1,translation:l,onChange:x,onSearch:v,multiple:C,tagRender:F}=t,y=Array.isArray(n)?n:Object.keys(n);return o?e.jsx(p.Form.Item,{...t,name:c,required:i,tooltip:b,rules:u,label:s,className:["w-100",f].join(" "),children:e.jsx(p.Radio.Group,{...t,onChange:x?a=>{var R;return x((R=a==null?void 0:a.target)==null?void 0:R.value,h)}:void 0,children:y.map(a=>e.jsx(p.Radio,{disabled:!m,value:a,children:l?q(l[a]):a},a))})}):e.jsx(E,{...t,tagRender:typeof F=="function"?F:F?a=>{const{value:R,label:N}=a,k=F[R];return k?e.jsx(p.Tag,{color:k.color,children:N}):e.jsx(p.Tag,{children:N})}:void 0,onChange:x?a=>x(a,h):void 0,className:["w-100",f].join(" "),name:c,items:y,required:i,tooltip:b,rules:u,label:s,disabled:!m,onSearch:v?a=>v(a,h):void 0,allowClear:!0,mode:C?"multiple":void 0,itemBuilder:a=>e.jsx(p.Select.Option,{value:a,children:l?q(l[a]):a},a)})}case"checkbox":{const{onChange:n}=t;return e.jsx(Q,{className:f,rules:u,onChange:n?o=>n(o,h):void 0,label:s,tooltip:b,disabled:!m,name:c})}case"color":return e.jsx(D,{...t,type:"color",required:i,name:c,label:s,rules:u,fieldClassName:f,updatable:m,readonly:w,fieldTooltip:b});default:return e.jsx(e.Fragment,{children:`${g} Not Implemented`})}}function H(j){const{items:s=[],loading:c,searchOnType:g,onSearch:i,multiple:S,onChange:u,highlightSearch:m,required:w,fieldClassName:f,rules:O,fieldTooltip:b,updatable:t,label:h,name:q,tagRender:n,updatingValue:o,onSet:l,placeholder:x,allowClear:v=!0}=j,C=j.form,[F,y]=T.useState(""),a=T.useMemo(()=>B.getRealName(q),[q]),R=T.useMemo(()=>B.getRealName(q,"upsertFieldName"),[q]),N=p.Form.useWatch(a,C),[k,P]=T.useState(!0);T.useEffect(()=>{l&&k&&N&&(l==null||l(N,s,C),P(!1))},[k,C,s,a,l,N]),T.useEffect(()=>{N&&P(!0)},[N]);const _=T.useCallback(async r=>{y(r),g&&(i==null||i(r,C,o))},[C,i,g,o]);return e.jsx(E,{...j,maxTagCount:"responsive",maxTagPlaceholder:r=>e.jsxs(ee,{title:e.jsx(e.Fragment,{children:r.map(d=>e.jsxs(e.Fragment,{children:[d.label," ",e.jsx("br",{})]}))}),children:["+",r==null?void 0:r.length]}),placeholder:x,onSelect:r=>{l==null||l(r==null?void 0:r.key,s,C)},onChange:u?r=>{y(""),u(r,C)}:void 0,mode:S?"multiple":void 0,className:["w-100",f].join(" "),name:R,items:s,required:w,tooltip:b,tagRender:n,rules:O,disabled:!t,label:h,allowClear:v,onSearch:_,loading:c,filterOption:m?(r,d)=>{var I,L,M;try{const U=r.toLowerCase().split(/\s+/),W=((typeof(d==null?void 0:d.children)=="string"?d==null?void 0:d.children:(L=(I=d==null?void 0:d.children)==null?void 0:I.props)==null?void 0:L.textToHighlight)??"").toLowerCase(),G=(((M=d==null?void 0:d.value)==null?void 0:M.toString())??"").toLowerCase();return U.every(A=>W.indexOf(A)>=0||G.indexOf(A)>=0)}catch{return!0}}:void 0,itemBuilder:m?r=>{const d=r.value?String(r.value):void 0;return e.jsx(p.Select.Option,{value:r.key,title:d,disabled:r.disabled,children:e.jsx($,{highlightClassName:"highlight-text",searchWords:(F??"").split(" "),autoEscape:!0,textToHighlight:d??""})},r.key)}:r=>e.jsx(p.Select.Option,{value:r.key,title:r.value,disabled:r.disabled,children:r.value},r.key)})}function D(j){const{required:s,fieldClassName:c,rules:g,fieldTooltip:i,updatable:S,label:u,name:m}=j;return e.jsx(p.Form.Item,{label:u,name:m,required:s,rules:g,tooltip:i,children:e.jsx(p.ColorPicker,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",showText:!0,trigger:"click",className:c,disabled:!S,...j.innerProps})})}exports.ColorCrudFieldComponent=D;exports.SelectCrudFieldComponent=H;exports.default=re;
|
package/crud/CrudField.es.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as t, Fragment as S, jsxs as E } from "react/jsx-runtime";
|
|
|
2
2
|
import { Form as j, Radio as M, Select as I, Tag as W, ColorPicker as X } from "antd";
|
|
3
3
|
import { useEffect as L, useState as G, useMemo as _, useCallback as Y } from "react";
|
|
4
4
|
import Z from "react-highlight-words";
|
|
5
|
-
import {
|
|
5
|
+
import { useTranslationLibNoNS as V } from "../locale/index.es.js";
|
|
6
6
|
import ee from "./FileCrudField.es.js";
|
|
7
7
|
import re from "./ImageCrudField.es.js";
|
|
8
8
|
import te from "../common/check-box/CheckBox.es.js";
|
|
@@ -94,7 +94,7 @@ function Re(v) {
|
|
|
94
94
|
disabledPastDays: C,
|
|
95
95
|
onChange: y,
|
|
96
96
|
placeholder: g,
|
|
97
|
-
format:
|
|
97
|
+
format: N
|
|
98
98
|
} = e;
|
|
99
99
|
return /* @__PURE__ */ t(
|
|
100
100
|
ae,
|
|
@@ -103,12 +103,12 @@ function Re(v) {
|
|
|
103
103
|
required: d,
|
|
104
104
|
disabled: !u,
|
|
105
105
|
type: p,
|
|
106
|
-
format:
|
|
106
|
+
format: N,
|
|
107
107
|
tooltip: b,
|
|
108
108
|
range: l,
|
|
109
109
|
name: c,
|
|
110
110
|
label: n,
|
|
111
|
-
onChange: y ? (
|
|
111
|
+
onChange: y ? (x) => y(x, h) : void 0,
|
|
112
112
|
className: f,
|
|
113
113
|
disableToday: i,
|
|
114
114
|
disabledFutureDays: o,
|
|
@@ -124,15 +124,15 @@ function Re(v) {
|
|
|
124
124
|
disabledPast: C,
|
|
125
125
|
onChange: y,
|
|
126
126
|
use12Hours: g,
|
|
127
|
-
format:
|
|
128
|
-
placeholder:
|
|
127
|
+
format: N,
|
|
128
|
+
placeholder: x
|
|
129
129
|
} = e;
|
|
130
130
|
return /* @__PURE__ */ t(
|
|
131
131
|
oe,
|
|
132
132
|
{
|
|
133
|
-
placeholder:
|
|
133
|
+
placeholder: x,
|
|
134
134
|
required: d,
|
|
135
|
-
format:
|
|
135
|
+
format: N,
|
|
136
136
|
disabled: !u,
|
|
137
137
|
type: p,
|
|
138
138
|
tooltip: b,
|
|
@@ -204,8 +204,8 @@ function Re(v) {
|
|
|
204
204
|
onChange: C,
|
|
205
205
|
onSearch: y,
|
|
206
206
|
multiple: g,
|
|
207
|
-
tagRender:
|
|
208
|
-
} = e,
|
|
207
|
+
tagRender: N
|
|
208
|
+
} = e, x = Array.isArray(l) ? l : Object.keys(l);
|
|
209
209
|
return i ? /* @__PURE__ */ t(
|
|
210
210
|
j.Item,
|
|
211
211
|
{
|
|
@@ -224,7 +224,7 @@ function Re(v) {
|
|
|
224
224
|
var w;
|
|
225
225
|
return C((w = a == null ? void 0 : a.target) == null ? void 0 : w.value, h);
|
|
226
226
|
} : void 0,
|
|
227
|
-
children:
|
|
227
|
+
children: x.map((a) => /* @__PURE__ */ t(M, { disabled: !u, value: a, children: o ? T(o[a]) : a }, a))
|
|
228
228
|
}
|
|
229
229
|
)
|
|
230
230
|
}
|
|
@@ -232,14 +232,14 @@ function Re(v) {
|
|
|
232
232
|
z,
|
|
233
233
|
{
|
|
234
234
|
...e,
|
|
235
|
-
tagRender: typeof
|
|
236
|
-
const { value: w, label:
|
|
237
|
-
return O ? /* @__PURE__ */ t(W, { color: O.color, children:
|
|
235
|
+
tagRender: typeof N == "function" ? N : N ? (a) => {
|
|
236
|
+
const { value: w, label: F } = a, O = N[w];
|
|
237
|
+
return O ? /* @__PURE__ */ t(W, { color: O.color, children: F }) : /* @__PURE__ */ t(W, { children: F });
|
|
238
238
|
} : void 0,
|
|
239
239
|
onChange: C ? (a) => C(a, h) : void 0,
|
|
240
240
|
className: ["w-100", f].join(" "),
|
|
241
241
|
name: c,
|
|
242
|
-
items:
|
|
242
|
+
items: x,
|
|
243
243
|
required: d,
|
|
244
244
|
tooltip: b,
|
|
245
245
|
rules: m,
|
|
@@ -308,15 +308,15 @@ function se(v) {
|
|
|
308
308
|
onSet: o,
|
|
309
309
|
placeholder: C,
|
|
310
310
|
allowClear: y = !0
|
|
311
|
-
} = v, g = v.form, [
|
|
311
|
+
} = v, g = v.form, [N, x] = G(""), a = _(() => $.getRealName(T), [T]), w = _(() => $.getRealName(T, "upsertFieldName"), [T]), F = j.useWatch(a, g), [O, U] = G(!0);
|
|
312
312
|
L(() => {
|
|
313
|
-
o && O &&
|
|
314
|
-
}, [O, g, n, a, o,
|
|
315
|
-
|
|
316
|
-
}, [
|
|
313
|
+
o && O && F && (o == null || o(F, n, g), U(!1));
|
|
314
|
+
}, [O, g, n, a, o, F]), L(() => {
|
|
315
|
+
F && U(!0);
|
|
316
|
+
}, [F]);
|
|
317
317
|
const J = Y(
|
|
318
318
|
async (r) => {
|
|
319
|
-
|
|
319
|
+
x(r), p && (d == null || d(r, g, i));
|
|
320
320
|
},
|
|
321
321
|
[g, d, p, i]
|
|
322
322
|
);
|
|
@@ -344,7 +344,7 @@ function se(v) {
|
|
|
344
344
|
o == null || o(r == null ? void 0 : r.key, n, g);
|
|
345
345
|
},
|
|
346
346
|
onChange: m ? (r) => {
|
|
347
|
-
|
|
347
|
+
x(""), m(r, g);
|
|
348
348
|
} : void 0,
|
|
349
349
|
mode: k ? "multiple" : void 0,
|
|
350
350
|
className: ["w-100", f].join(" "),
|
|
@@ -382,7 +382,7 @@ function se(v) {
|
|
|
382
382
|
Z,
|
|
383
383
|
{
|
|
384
384
|
highlightClassName: "highlight-text",
|
|
385
|
-
searchWords: (
|
|
385
|
+
searchWords: (N ?? "").split(" "),
|
|
386
386
|
autoEscape: !0,
|
|
387
387
|
textToHighlight: s ?? ""
|
|
388
388
|
}
|
package/locale/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./hooks/translation-constants.cjs.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./hooks/translation-constants.cjs.js"),N=require("./translations/en.cjs.js"),i=require("i18next"),r=require("react-i18next"),u={en:{[s.TRANSLATION_NAMESPACE]:N}};exports.i18nInstance=i;const I=(n={})=>{const{translations:e=u,language:t="en",i18nInstance:o}=n,a=o||i;return exports.i18nInstance=a,a.isInitialized?Object.entries(e).forEach(([c,l])=>{Object.entries(l).forEach(([T,A])=>{a.addResourceBundle(c,T,A,!0,!0)})}):a.use(r.initReactI18next).init({resources:e,lng:t,fallbackLng:"en",ns:s.TRANSLATION_NAMESPACE,interpolation:{escapeValue:!1}}),i},d=(n,e,t)=>{(t||i).addResourceBundle(n,s.TRANSLATION_NAMESPACE,e,!0,!0)},S=n=>r.useTranslation(s.TRANSLATION_NAMESPACE,{...n,i18n:exports.i18nInstance}),E=n=>r.useTranslation(void 0,{...n,i18n:exports.i18nInstance}),L=(n,e)=>{var t;return(t=exports.i18nInstance)==null?void 0:t.t(n,{ns:s.TRANSLATION_NAMESPACE,...e})};exports.defaultTranslations=u;exports.setupI18n=I;exports.t=L;exports.updateTranslations=d;exports.useTranslationLib=S;exports.useTranslationLibNoNS=E;
|
package/locale/index.d.ts
CHANGED
|
@@ -80,4 +80,5 @@ export declare let i18nInstance: i18nType;
|
|
|
80
80
|
export declare const setupI18n: (options?: SetupI18nOptions) => i18nType;
|
|
81
81
|
export declare const updateTranslations: (language: string, translations: Record<string, any>, i18nInstance?: i18nType) => void;
|
|
82
82
|
export declare const useTranslationLib: (options?: Omit<UseTranslationOptions<string>, "i18n">) => import('react-i18next').UseTranslationResponse<"crud-component", string>;
|
|
83
|
+
export declare const useTranslationLibNoNS: (options?: Omit<UseTranslationOptions<string>, "i18n">) => import('react-i18next').UseTranslationResponse<"translation", string>;
|
|
83
84
|
export declare const t: (key: string, options?: any) => string | import('node_modules/i18next/typescript/helpers').$SpecialObject | import('i18next').TFunctionDetailedResult<string | import('node_modules/i18next/typescript/helpers').$SpecialObject, any>;
|
package/locale/index.es.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { TRANSLATION_NAMESPACE as s } from "./hooks/translation-constants.es.js";
|
|
2
|
-
import
|
|
2
|
+
import f from "./translations/en.es.js";
|
|
3
3
|
import r from "i18next";
|
|
4
|
-
import { initReactI18next as
|
|
4
|
+
import { initReactI18next as p, useTranslation as u } from "react-i18next";
|
|
5
5
|
const m = {
|
|
6
6
|
en: {
|
|
7
|
-
[s]:
|
|
7
|
+
[s]: f
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
10
|
let t = r;
|
|
11
|
-
const
|
|
11
|
+
const A = (n = {}) => {
|
|
12
12
|
const {
|
|
13
|
-
translations:
|
|
13
|
+
translations: e = m,
|
|
14
14
|
language: i = "en",
|
|
15
15
|
i18nInstance: a
|
|
16
|
-
} =
|
|
17
|
-
return t = o, o.isInitialized ? Object.entries(
|
|
18
|
-
Object.entries(
|
|
19
|
-
o.addResourceBundle(
|
|
16
|
+
} = n, o = a || r;
|
|
17
|
+
return t = o, o.isInitialized ? Object.entries(e).forEach(([c, l]) => {
|
|
18
|
+
Object.entries(l).forEach(([T, d]) => {
|
|
19
|
+
o.addResourceBundle(c, T, d, !0, !0);
|
|
20
20
|
});
|
|
21
|
-
}) : o.use(
|
|
22
|
-
resources:
|
|
21
|
+
}) : o.use(p).init({
|
|
22
|
+
resources: e,
|
|
23
23
|
lng: i,
|
|
24
24
|
fallbackLng: "en",
|
|
25
25
|
ns: s,
|
|
@@ -27,23 +27,24 @@ const E = (e = {}) => {
|
|
|
27
27
|
escapeValue: !1
|
|
28
28
|
}
|
|
29
29
|
}), r;
|
|
30
|
-
},
|
|
30
|
+
}, E = (n, e, i) => {
|
|
31
31
|
(i || r).addResourceBundle(
|
|
32
|
-
e,
|
|
33
|
-
s,
|
|
34
32
|
n,
|
|
33
|
+
s,
|
|
34
|
+
e,
|
|
35
35
|
!0,
|
|
36
36
|
!0
|
|
37
37
|
);
|
|
38
|
-
},
|
|
38
|
+
}, L = (n) => u(s, { ...n, i18n: t }), R = (n) => u(void 0, { ...n, i18n: t }), U = (n, e) => t == null ? void 0 : t.t(n, {
|
|
39
39
|
ns: s,
|
|
40
|
-
...
|
|
40
|
+
...e
|
|
41
41
|
});
|
|
42
42
|
export {
|
|
43
43
|
m as defaultTranslations,
|
|
44
44
|
t as i18nInstance,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
A as setupI18n,
|
|
46
|
+
U as t,
|
|
47
|
+
E as updateTranslations,
|
|
48
|
+
L as useTranslationLib,
|
|
49
|
+
R as useTranslationLibNoNS
|
|
49
50
|
};
|