@kingteza/crud-component 1.0.57 → 1.0.59
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.
|
@@ -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/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.59",
|
|
5
5
|
"description": "React CRUD component library with Ant Design",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"react",
|
|
@@ -114,6 +114,6 @@
|
|
|
114
114
|
"antd": ">=5.22.6",
|
|
115
115
|
"react": ">=18.3.1",
|
|
116
116
|
"react-dom": ">=18.3.1",
|
|
117
|
-
"react-router-dom": ">=
|
|
117
|
+
"react-router-dom": ">=6.3.0"
|
|
118
118
|
}
|
|
119
119
|
}
|