@kingteza/crud-component 1.32.1 → 1.34.0

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.
Files changed (38) hide show
  1. package/dist/common/rich/index.cjs.js +2 -2
  2. package/dist/common/rich/index.d.ts +1 -1
  3. package/dist/common/rich/index.es.js +119 -75
  4. package/dist/context/CrudComponentProvider.cjs.js +1 -1
  5. package/dist/context/CrudComponentProvider.d.ts +14 -0
  6. package/dist/context/CrudComponentProvider.es.js +22 -14
  7. package/dist/context/CrudNavigateContext.cjs.js +1 -0
  8. package/dist/context/CrudNavigateContext.d.ts +14 -0
  9. package/dist/context/CrudNavigateContext.es.js +29 -0
  10. package/dist/context/index.d.ts +1 -0
  11. package/dist/crud/CrudComponent.d.ts +1 -0
  12. package/dist/crud/CrudField.cjs.js +1 -1
  13. package/dist/crud/CrudField.es.js +92 -91
  14. package/dist/crud/CrudReportComponent.cjs.js +1 -1
  15. package/dist/crud/CrudReportComponent.d.ts +10 -1
  16. package/dist/crud/CrudReportComponent.es.js +193 -134
  17. package/dist/crud/CrudTextAreaComponent.cjs.js +1 -1
  18. package/dist/crud/CrudTextAreaComponent.d.ts +2 -1
  19. package/dist/crud/CrudTextAreaComponent.es.js +19 -17
  20. package/dist/crud/index.d.ts +1 -1
  21. package/dist/hooks/NavigatorHooks.cjs.js +1 -1
  22. package/dist/hooks/NavigatorHooks.d.ts +6 -1
  23. package/dist/hooks/NavigatorHooks.es.js +13 -6
  24. package/dist/index.d.ts +1 -1
  25. package/dist/navigator/CrudNextNavigateSync.cjs.js +1 -0
  26. package/dist/navigator/CrudNextNavigateSync.d.ts +20 -0
  27. package/dist/navigator/CrudNextNavigateSync.es.js +20 -0
  28. package/dist/navigator/CrudReactRouterNavigateSync.cjs.js +1 -0
  29. package/dist/navigator/CrudReactRouterNavigateSync.d.ts +18 -0
  30. package/dist/navigator/CrudReactRouterNavigateSync.es.js +10 -0
  31. package/dist/next.cjs.js +1 -0
  32. package/dist/next.d.ts +1 -0
  33. package/dist/next.es.js +4 -0
  34. package/dist/react-router.cjs.js +1 -0
  35. package/dist/react-router.d.ts +1 -0
  36. package/dist/react-router.es.js +4 -0
  37. package/dist/style.css +4 -3
  38. package/package.json +20 -3
@@ -1,2 +1,2 @@
1
- "use strict";var O=Object.create;var j=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var L=(r,n,s,u)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of W(n))!K.call(r,c)&&c!==s&&j(r,c,{get:()=>n[c],enumerable:!(u=U(n,c))||u.enumerable});return r};var A=(r,n,s)=>(s=r!=null?O(z(r)):{},L(n||!r||!r.__esModule?j(s,"default",{value:r,enumerable:!0}):s,r));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react/jsx-runtime"),k=require("antd"),o=require("react"),D=require("../../util/ValidationUtil.cjs.js"),G=o.lazy(async()=>{const{default:r}=await import("react-quill"),{Quill:n}=r,s=n.import("blots/block");return s.tagName="div",n.register(s),{default:u=>g.jsx(r,{...u})}}),J=({formLayoutProps:r,name:n,label:s,required:u,rules:c=[],disabled:v,help:F})=>{const d=k.Form.useFormInstance(),[m,x]=o.useState(""),T=o.useRef(!1),i="    ",f=t=>{if(!t)return"";if(typeof t=="string")return t;try{return String(t)}catch{return""}},H=()=>function(t){const e=this.quill,a=e.getSelection(!0);if(a){const b=a.index,S=a.index+a.length,Q=e.getText(),h=[];for(let l=b;l<=S;l++)(l===0||Q[l-1]===`
2
- `)&&h.push(l);if(h.length===0&&h.push(b),t>0){let l=0;h.forEach(p=>{e.insertText(p+l,i),l+=i.length}),e.setSelection(b+i.length,S+h.length*i.length)}else{let l=0;h.forEach(N=>{const R=N-l;e.getText(R,i.length)===i&&(e.deleteText(R,i.length),l+=i.length)});const p=Math.max(0,b-i.length),B=Math.max(p,S-l);e.setSelection(p,B)}}},w=()=>function(){const t=this.quill,e=t.getSelection(!0);return e?(t.insertText(e.index,i),t.setSelection(e.index+i.length),!1):!0},C=()=>function(){const t=this.quill,e=t.getSelection(!0);return e&&e.index>=i.length&&t.getText(e.index-i.length,i.length)===i?(t.deleteText(e.index-i.length,i.length),t.setSelection(e.index-i.length),!1):!0},V=o.useMemo(()=>{const t=H(),e=w(),a=C();return{toolbar:{container:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],[{indent:"-1"},{indent:"+1"}],["link"],["clean"]],handlers:{indent:t}},keyboard:{bindings:{tab:{key:"Tab",handler:e},"shift-tab":{key:"Tab",shiftKey:!0,handler:a}}}}},[]),q=o.useMemo(()=>["bold","italic","underline","strike","blockquote","list","bullet","link"],[]);o.useEffect(()=>{const t=d.getFieldValue(n),e=f(t);e&&e!=="<p></p>"&&e!=="<p><br></p>"&&e!=="<div></div>"&&x(e)},[d,n]);const y=k.Form.useWatch(n,d);o.useEffect(()=>{if(T.current)return;const t=f(y),e=f(m);t!==e&&x(!t||t==="<p></p>"||t==="<p><br></p>"||t==="<div></div>"?"":t)},[y]);const E=o.useCallback(t=>{const e=f(t);T.current=!0,x(e);const a=!e||e==="<p></p>"||e.trim()==="<p><br></p>"||e==="<div></div>"||e.trim()==="<div></div>"?void 0:e;d.setFieldValue(n,a),setTimeout(()=>{T.current=!1},0),d.validateFields([n]).catch(()=>{})},[d,n]),I=o.useMemo(()=>u?[...c,...D.required(s??"")]:c,[u,c,s]),M=o.useMemo(()=>f(m)||"",[m]),P=o.useMemo(()=>({readOnly:!!v,value:String(M||""),onChange:E,theme:"snow",className:"rich-text-editor",modules:V,formats:q}),[v,M,E,V,q]);return g.jsx(k.Form.Item,{help:F,name:n,label:s,rules:I,...r,children:g.jsx(o.Suspense,{fallback:g.jsx("div",{children:"Loading editor..."}),children:g.jsx(G,{...P})})})};exports.RichTextEditor=J;
1
+ "use strict";var z=Object.create;var H=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var G=Object.getPrototypeOf,J=Object.prototype.hasOwnProperty;var X=(r,n,o,h)=>{if(n&&typeof n=="object"||typeof n=="function")for(let c of D(n))!J.call(r,c)&&c!==o&&H(r,c,{get:()=>n[c],enumerable:!(h=A(n,c))||h.enumerable});return r};var j=(r,n,o)=>(o=r!=null?z(G(r)):{},X(n||!r||!r.__esModule?H(o,"default",{value:r,enumerable:!0}):o,r));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),k=require("antd"),s=require("react"),Y=require("../../util/ValidationUtil.cjs.js"),Z=async()=>{const{Quill:r}=await import("react-quill-new"),n=r.import("blots/block");n.tagName="div",r.register(n)},_=({formLayoutProps:r,name:n,label:o,required:h,rules:c=[],disabled:V,help:C})=>{const u=k.Form.useFormInstance(),[b,g]=s.useState(""),[p,Q]=s.useState(!1),[q,B]=s.useState(null),T=s.useRef(!1),i="    ";s.useEffect(()=>{Q(!0)},[]),s.useEffect(()=>{if(!p)return;let t=!1;return(async()=>{await Z();const{default:e}=await import("react-quill-new");t||B(()=>e)})(),()=>{t=!0}},[p]);const f=t=>{if(!t)return"";if(typeof t=="string")return t;try{return String(t)}catch{return""}},I=()=>function(t){const e=this.quill,a=e.getSelection(!0);if(a){const x=a.index,S=a.index+a.length,W=e.getText(),d=[];for(let l=x;l<=S;l++)(l===0||W[l-1]===`
2
+ `)&&d.push(l);if(d.length===0&&d.push(x),t>0){let l=0;d.forEach(m=>{e.insertText(m+l,i),l+=i.length}),e.setSelection(x+i.length,S+d.length*i.length)}else{let l=0;d.forEach(L=>{const F=L-l;e.getText(F,i.length)===i&&(e.deleteText(F,i.length),l+=i.length)});const m=Math.max(0,x-i.length),K=Math.max(m,S-l);e.setSelection(m,K)}}},N=()=>function(){const t=this.quill,e=t.getSelection(!0);return e?(t.insertText(e.index,i),t.setSelection(e.index+i.length),!1):!0},P=()=>function(){const t=this.quill,e=t.getSelection(!0);return e&&e.index>=i.length&&t.getText(e.index-i.length,i.length)===i?(t.deleteText(e.index-i.length,i.length),t.setSelection(e.index-i.length),!1):!0},E=s.useMemo(()=>{const t=I(),e=N(),a=P();return{toolbar:{container:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],[{indent:"-1"},{indent:"+1"}],["link"],["clean"]],handlers:{indent:t}},keyboard:{bindings:{tab:{key:"Tab",handler:e},"shift-tab":{key:"Tab",shiftKey:!0,handler:a}}}}},[]),y=s.useMemo(()=>["bold","italic","underline","strike","blockquote","list","bullet","link"],[]);s.useEffect(()=>{const t=u.getFieldValue(n),e=f(t);e&&e!=="<p></p>"&&e!=="<p><br></p>"&&e!=="<div></div>"&&g(e)},[u,n]);const M=k.Form.useWatch(n,u);s.useEffect(()=>{if(T.current)return;const t=f(M),e=f(b);t!==e&&g(!t||t==="<p></p>"||t==="<p><br></p>"||t==="<div></div>"?"":t)},[M]);const R=s.useCallback(t=>{const e=f(t);T.current=!0,g(e);const a=!e||e==="<p></p>"||e.trim()==="<p><br></p>"||e==="<div></div>"||e.trim()==="<div></div>"?void 0:e;u.setFieldValue(n,a),setTimeout(()=>{T.current=!1},0),u.validateFields([n]).catch(()=>{})},[u,n]),O=s.useMemo(()=>h?[...c,...Y.required(o??"")]:c,[h,c,o]),w=s.useMemo(()=>f(b)||"",[b]),U=s.useMemo(()=>({readOnly:!!V,value:String(w||""),onChange:R,theme:"snow",className:"rich-text-editor",modules:E,formats:y}),[V,w,R,E,y]);return v.jsx(k.Form.Item,{help:C,name:n,label:o,rules:O,...r,children:p&&q?v.jsx(q,{...U}):v.jsx("div",{className:"rich-text-editor rich-text-editor--loading",children:"Loading editor..."})})};exports.RichTextEditor=_;
@@ -9,6 +9,6 @@ export interface RichTextEditorProps {
9
9
  required?: boolean;
10
10
  rules?: Rule[];
11
11
  disabled?: boolean;
12
- formLayoutProps?: Pick<FormItemProps, "layout" | 'labelCol' | 'wrapperCol'>;
12
+ formLayoutProps?: Pick<FormItemProps, "layout" | "labelCol" | "wrapperCol">;
13
13
  }
14
14
  export declare const RichTextEditor: FC<RichTextEditorProps>;
@@ -1,20 +1,36 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import { Form as S } from "antd";
3
- import W, { useState as j, useRef as z, useMemo as u, useEffect as w, useCallback as K, Suspense as L } from "react";
4
- import O from "../../util/ValidationUtil.es.js";
5
- const A = W.lazy(async () => {
6
- const { default: h } = await import("react-quill"), { Quill: r } = h, o = r.import("blots/block");
7
- return o.tagName = "div", r.register(o), { default: (f) => /* @__PURE__ */ d(h, { ...f }) };
8
- }), Z = ({
9
- formLayoutProps: h,
1
+ import { jsx as v } from "react/jsx-runtime";
2
+ import { Form as V } from "antd";
3
+ import { useState as S, useRef as z, useEffect as g, useMemo as a, useCallback as A } from "react";
4
+ import D from "../../util/ValidationUtil.es.js";
5
+ const G = async () => {
6
+ const { Quill: u } = await import("react-quill-new"), r = u.import("blots/block");
7
+ r.tagName = "div", u.register(r);
8
+ }, $ = ({
9
+ formLayoutProps: u,
10
10
  name: r,
11
- label: o,
12
- required: f,
13
- rules: b = [],
14
- disabled: V,
15
- help: C
11
+ label: x,
12
+ required: q,
13
+ rules: p = [],
14
+ disabled: y,
15
+ help: M
16
16
  }) => {
17
- const s = S.useFormInstance(), [m, g] = j(""), T = z(!1), n = "    ", a = (e) => {
17
+ const o = V.useFormInstance(), [m, d] = S(""), [b, B] = S(!1), [E, I] = S(
18
+ null
19
+ ), T = z(!1), n = "    ";
20
+ g(() => {
21
+ B(!0);
22
+ }, []), g(() => {
23
+ if (!b) return;
24
+ let e = !1;
25
+ return (async () => {
26
+ await G();
27
+ const { default: t } = await import("react-quill-new");
28
+ e || I(() => t);
29
+ })(), () => {
30
+ e = !0;
31
+ };
32
+ }, [b]);
33
+ const c = (e) => {
18
34
  if (!e) return "";
19
35
  if (typeof e == "string") return e;
20
36
  try {
@@ -22,36 +38,45 @@ const A = W.lazy(async () => {
22
38
  } catch {
23
39
  return "";
24
40
  }
25
- }, F = () => function(e) {
41
+ }, N = () => function(e) {
26
42
  const t = this.quill, l = t.getSelection(!0);
27
43
  if (l) {
28
- const x = l.index, k = l.index + l.length, N = t.getText(), c = [];
29
- for (let i = x; i <= k; i++)
30
- (i === 0 || N[i - 1] === `
31
- `) && c.push(i);
32
- if (c.length === 0 && c.push(x), e > 0) {
44
+ const h = l.index, k = l.index + l.length, K = t.getText(), s = [];
45
+ for (let i = h; i <= k; i++)
46
+ (i === 0 || K[i - 1] === `
47
+ `) && s.push(i);
48
+ if (s.length === 0 && s.push(h), e > 0) {
33
49
  let i = 0;
34
- c.forEach((p) => {
35
- t.insertText(p + i, n), i += n.length;
36
- }), t.setSelection(x + n.length, k + c.length * n.length);
50
+ s.forEach((f) => {
51
+ t.insertText(f + i, n), i += n.length;
52
+ }), t.setSelection(
53
+ h + n.length,
54
+ k + s.length * n.length
55
+ );
37
56
  } else {
38
57
  let i = 0;
39
- c.forEach((U) => {
40
- const R = U - i;
41
- t.getText(R, n.length) === n && (t.deleteText(R, n.length), i += n.length);
58
+ s.forEach((O) => {
59
+ const Q = O - i;
60
+ t.getText(Q, n.length) === n && (t.deleteText(Q, n.length), i += n.length);
42
61
  });
43
- const p = Math.max(0, x - n.length), P = Math.max(p, k - i);
44
- t.setSelection(p, P);
62
+ const f = Math.max(0, h - n.length), L = Math.max(f, k - i);
63
+ t.setSelection(f, L);
45
64
  }
46
65
  }
47
- }, I = () => function() {
66
+ }, P = () => function() {
48
67
  const e = this.quill, t = e.getSelection(!0);
49
68
  return t ? (e.insertText(t.index, n), e.setSelection(t.index + n.length), !1) : !0;
50
- }, M = () => function() {
69
+ }, U = () => function() {
51
70
  const e = this.quill, t = e.getSelection(!0);
52
- return t && t.index >= n.length && e.getText(t.index - n.length, n.length) === n ? (e.deleteText(t.index - n.length, n.length), e.setSelection(t.index - n.length), !1) : !0;
53
- }, v = u(() => {
54
- const e = F(), t = I(), l = M();
71
+ return t && t.index >= n.length && e.getText(
72
+ t.index - n.length,
73
+ n.length
74
+ ) === n ? (e.deleteText(
75
+ t.index - n.length,
76
+ n.length
77
+ ), e.setSelection(t.index - n.length), !1) : !0;
78
+ }, w = a(() => {
79
+ const e = N(), t = P(), l = U();
55
80
  return {
56
81
  toolbar: {
57
82
  container: [
@@ -79,49 +104,68 @@ const A = W.lazy(async () => {
79
104
  }
80
105
  }
81
106
  };
82
- }, []), q = u(() => [
83
- "bold",
84
- "italic",
85
- "underline",
86
- "strike",
87
- "blockquote",
88
- "list",
89
- "bullet",
90
- "link"
91
- ], []);
92
- w(() => {
93
- const e = s.getFieldValue(r), t = a(e);
94
- t && t !== "<p></p>" && t !== "<p><br></p>" && t !== "<div></div>" && g(t);
95
- }, [s, r]);
96
- const y = S.useWatch(r, s);
97
- w(() => {
107
+ }, []), H = a(
108
+ () => [
109
+ "bold",
110
+ "italic",
111
+ "underline",
112
+ "strike",
113
+ "blockquote",
114
+ "list",
115
+ "bullet",
116
+ "link"
117
+ ],
118
+ []
119
+ );
120
+ g(() => {
121
+ const e = o.getFieldValue(r), t = c(e);
122
+ t && t !== "<p></p>" && t !== "<p><br></p>" && t !== "<div></div>" && d(t);
123
+ }, [o, r]);
124
+ const R = V.useWatch(r, o);
125
+ g(() => {
98
126
  if (T.current)
99
127
  return;
100
- const e = a(y), t = a(m);
101
- e !== t && g(!e || e === "<p></p>" || e === "<p><br></p>" || e === "<div></div>" ? "" : e);
102
- }, [y]);
103
- const E = K((e) => {
104
- const t = a(e);
105
- T.current = !0, g(t);
106
- const l = !t || t === "<p></p>" || t.trim() === "<p><br></p>" || t === "<div></div>" || t.trim() === "<div></div>" ? void 0 : t;
107
- s.setFieldValue(r, l), setTimeout(() => {
108
- T.current = !1;
109
- }, 0), s.validateFields([r]).catch(() => {
110
- });
111
- }, [s, r]), Q = u(
112
- () => f ? [...b, ...O.required(o ?? "")] : b,
113
- [f, b, o]
114
- ), H = u(() => a(m) || "", [m]), B = u(() => ({
115
- readOnly: !!V,
116
- value: String(H || ""),
117
- onChange: E,
118
- theme: "snow",
119
- className: "rich-text-editor",
120
- modules: v,
121
- formats: q
122
- }), [V, H, E, v, q]);
123
- return /* @__PURE__ */ d(S.Item, { help: C, name: r, label: o, rules: Q, ...h, children: /* @__PURE__ */ d(L, { fallback: /* @__PURE__ */ d("div", { children: "Loading editor..." }), children: /* @__PURE__ */ d(A, { ...B }) }) });
128
+ const e = c(R), t = c(m);
129
+ e !== t && d(!e || e === "<p></p>" || e === "<p><br></p>" || e === "<div></div>" ? "" : e);
130
+ }, [R]);
131
+ const C = A(
132
+ (e) => {
133
+ const t = c(e);
134
+ T.current = !0, d(t);
135
+ const l = !t || t === "<p></p>" || t.trim() === "<p><br></p>" || t === "<div></div>" || t.trim() === "<div></div>" ? void 0 : t;
136
+ o.setFieldValue(r, l), setTimeout(() => {
137
+ T.current = !1;
138
+ }, 0), o.validateFields([r]).catch(() => {
139
+ });
140
+ },
141
+ [o, r]
142
+ ), W = a(
143
+ () => q ? [...p, ...D.required(x ?? "")] : p,
144
+ [q, p, x]
145
+ ), F = a(() => c(m) || "", [m]), j = a(
146
+ () => ({
147
+ readOnly: !!y,
148
+ value: String(F || ""),
149
+ onChange: C,
150
+ theme: "snow",
151
+ className: "rich-text-editor",
152
+ modules: w,
153
+ formats: H
154
+ }),
155
+ [y, F, C, w, H]
156
+ );
157
+ return /* @__PURE__ */ v(
158
+ V.Item,
159
+ {
160
+ help: M,
161
+ name: r,
162
+ label: x,
163
+ rules: W,
164
+ ...u,
165
+ children: b && E ? /* @__PURE__ */ v(E, { ...j }) : /* @__PURE__ */ v("div", { className: "rich-text-editor rich-text-editor--loading", children: "Loading editor..." })
166
+ }
167
+ );
124
168
  };
125
169
  export {
126
- Z as RichTextEditor
170
+ $ as RichTextEditor
127
171
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),r=require("react"),u=require("../locale/index.cjs.js"),a=r.createContext({}),c=({children:o,i18nOptions:e})=>{const t=r.useRef(!1);return r.useMemo(()=>{t.current||(u.setupI18n(e||{}),t.current=!0)},[]),r.useEffect(()=>{t.current&&e&&u.setupI18n(e)},[e==null?void 0:e.language]),s.jsx(a.Provider,{value:{},children:o})};exports.CrudComponentProvider=c;exports.default=c;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),r=require("react"),c=require("../locale/index.cjs.js"),l=require("./CrudNavigateContext.cjs.js"),C=r.createContext({}),s=({children:a,i18nOptions:e,navigatorType:u="react-router",navigate:d})=>{const t=r.useRef(!1);r.useMemo(()=>{t.current||(c.setupI18n(e||{}),t.current=!0)},[]),r.useEffect(()=>{t.current&&e&&c.setupI18n(e)},[e==null?void 0:e.language]);const n=r.useMemo(()=>({navigatorType:u}),[u]);return o.jsx(l.CrudNavigateProvider,{navigate:d,children:o.jsx(C.Provider,{value:n,children:a})})};exports.CrudComponentProvider=s;exports.default=s;
@@ -1,5 +1,6 @@
1
1
  import { default as React, ReactNode } from 'react';
2
2
  import { SetupI18nOptions } from '../locale';
3
+ import { CrudNavigateFn } from './CrudNavigateContext';
3
4
  export interface CrudComponentProviderProps {
4
5
  children: ReactNode;
5
6
  /**
@@ -7,6 +8,19 @@ export interface CrudComponentProviderProps {
7
8
  * If not provided, defaults will be used
8
9
  */
9
10
  i18nOptions?: SetupI18nOptions;
11
+ /**
12
+ * Hints which router you use (docs / future use). Wire navigation with `navigate` and/or optional sync modules:
13
+ * - `react-router`: `@kingteza/crud-component/react-router` exports `CrudReactRouterNavigateSync`, or pass `navigate` from `useNavigate()`.
14
+ * - `nextjs`: `@kingteza/crud-component/next` exports `CrudNextNavigateSync`, or pass a `navigate` wrapper around `useRouter()`.
15
+ *
16
+ * @default "react-router"
17
+ */
18
+ navigatorType?: "react-router" | "nextjs";
19
+ /**
20
+ * Imperative navigation for `useNavigateOptional` (e.g. `Button` with `to`). If omitted, use the optional
21
+ * `react-router` or `next` package entry sync components.
22
+ */
23
+ navigate?: CrudNavigateFn;
10
24
  }
11
25
  export declare const CrudComponentProvider: React.FC<CrudComponentProviderProps>;
12
26
  export default CrudComponentProvider;
@@ -1,18 +1,26 @@
1
- import { jsx as f } from "react/jsx-runtime";
2
- import o, { useRef as a, useEffect as c, createContext as m } from "react";
3
- import { setupI18n as t } from "../locale/index.es.js";
4
- const d = m({}), C = ({
5
- children: u,
6
- i18nOptions: e
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import m, { useRef as d, useEffect as l, useMemo as s, createContext as x } from "react";
3
+ import { setupI18n as o } from "../locale/index.es.js";
4
+ import { CrudNavigateProvider as C } from "./CrudNavigateContext.es.js";
5
+ const v = x({}), M = ({
6
+ children: c,
7
+ i18nOptions: e,
8
+ navigatorType: t = "react-router",
9
+ navigate: a
7
10
  }) => {
8
- const r = a(!1);
9
- return o.useMemo(() => {
10
- r.current || (t(e || {}), r.current = !0);
11
- }, []), c(() => {
12
- r.current && e && t(e);
13
- }, [e == null ? void 0 : e.language]), /* @__PURE__ */ f(d.Provider, { value: {}, children: u });
11
+ const r = d(!1);
12
+ m.useMemo(() => {
13
+ r.current || (o(e || {}), r.current = !0);
14
+ }, []), l(() => {
15
+ r.current && e && o(e);
16
+ }, [e == null ? void 0 : e.language]);
17
+ const f = s(
18
+ () => ({ navigatorType: t }),
19
+ [t]
20
+ );
21
+ return /* @__PURE__ */ u(C, { navigate: a, children: /* @__PURE__ */ u(v.Provider, { value: f, children: c }) });
14
22
  };
15
23
  export {
16
- C as CrudComponentProvider,
17
- C as default
24
+ M as CrudComponentProvider,
25
+ M as default
18
26
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),e=require("react"),a=e.createContext(void 0),o=e.createContext(()=>{});function C({children:i,navigate:t}){const[r,n]=e.useState(),s=e.useCallback(g=>{n(g)},[]),v=e.useMemo(()=>t??r,[t,r]);return u.jsx(o.Provider,{value:s,children:u.jsx(a.Provider,{value:v,children:i})})}function c(){return e.useContext(a)}function d(){return e.useContext(o)}exports.CrudNavigateProvider=C;exports.useCrudNavigateFromContext=c;exports.useCrudNavigateRegister=d;
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from 'react';
2
+ /** Matches common `useNavigate()` / App Router usage used by this library. */
3
+ export type CrudNavigateFn = (to: string | number | Record<string, unknown>, options?: {
4
+ replace?: boolean;
5
+ state?: unknown;
6
+ }) => void;
7
+ type RegisterNavigateFn = (navigate: CrudNavigateFn | undefined) => void;
8
+ export declare function CrudNavigateProvider({ children, navigate: injectedNavigate, }: {
9
+ readonly children: ReactNode;
10
+ readonly navigate?: CrudNavigateFn;
11
+ }): import("react/jsx-runtime").JSX.Element;
12
+ export declare function useCrudNavigateFromContext(): CrudNavigateFn | undefined;
13
+ export declare function useCrudNavigateRegister(): RegisterNavigateFn;
14
+ export {};
@@ -0,0 +1,29 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { useState as c, useCallback as d, useMemo as x, createContext as o, useContext as a } from "react";
3
+ const n = o(
4
+ void 0
5
+ ), u = o(() => {
6
+ });
7
+ function f({
8
+ children: i,
9
+ navigate: e
10
+ }) {
11
+ const [t, s] = c(), v = d((C) => {
12
+ s(C);
13
+ }, []), g = x(
14
+ () => e ?? t,
15
+ [e, t]
16
+ );
17
+ return /* @__PURE__ */ r(u.Provider, { value: v, children: /* @__PURE__ */ r(n.Provider, { value: g, children: i }) });
18
+ }
19
+ function l() {
20
+ return a(n);
21
+ }
22
+ function p() {
23
+ return a(u);
24
+ }
25
+ export {
26
+ f as CrudNavigateProvider,
27
+ l as useCrudNavigateFromContext,
28
+ p as useCrudNavigateRegister
29
+ };
@@ -1,2 +1,3 @@
1
1
  export { default as useWindowDimensions } from './WindowDimension';
2
2
  export { CrudComponentProvider, type CrudComponentProviderProps } from './CrudComponentProvider';
3
+ export type { CrudNavigateFn } from './CrudNavigateContext';
@@ -144,6 +144,7 @@ export interface ObjectCrudField<T> extends InitialCrudField<T>, Copyable<true>
144
144
  export interface TextBasedFieldProps<T> extends InitialCrudField<T>, AddonFieldProps, Copyable<false> {
145
145
  placeholder?: string;
146
146
  type: "text" | "time" | "email" | "password";
147
+ maxLength?: number;
147
148
  onChange?: (value: string, form: FormInstance<T>) => void;
148
149
  }
149
150
  export interface PhoneNumberFieldProps<T> extends Omit<TextBasedFieldProps<T>, "type">, PhoneNumberConfigProps {
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),x=require("antd"),k=require("react"),K=require("react-highlight-words"),Q=require("../locale/index.cjs.js"),V=require("./FileCrudField.cjs.js"),X=require("./ImageCrudField.cjs.js"),Y=require("../common/check-box/CheckBox.cjs.js"),Z=require("../common/date-picker/DatePicker.cjs.js"),ee=require("../common/date-picker/TimePicker.cjs.js"),U=require("../common/select/SelectComponent.cjs.js"),re=require("../common/text-field/NumberField.cjs.js"),te=require("../common/text-field/PhoneNumberField.cjs.js"),ae=require("../common/text-field/TextField.cjs.js"),le=require("../common/tooltip/TooltipComponent.cjs.js"),ne=require("./CrudTextAreaComponent.cjs.js"),M=require("../util/CrudUtil.cjs.js");function oe(w){const{label:o,name:c,type:j,required:i,hidden:P,rules:h=[],updatable:g=!0,readonly:R=!1,fieldClassName:u,customFormFieldRender:T,fieldTooltip:v,fieldHelper:f,formLayoutProps:y,...e}=w,C=x.Form.useFormInstance();k.useEffect(()=>{if(j==="select"){const{items:a=[],onSearch:n,searchOnType:s}=e;!(a!=null&&a.length)&&!s&&(n==null||n(void 0,C,e==null?void 0:e.updatingValue))}},[C,e,j,e==null?void 0:e.updatingValue]);const{t:S}=Q.useTranslationLibNoNS();if(R||P)return r.jsx(r.Fragment,{});if(T)return T(C,w);switch(j){case"text":case"email":case"password":{const{onChange:a,placeholder:n,addonAfter:s,addonBefore:p}=e;return r.jsx(ae.default,{...y,placeholder:n,disabled:!g,rules:h,required:i,onChange:a?b=>a(b,C):void 0,type:j,name:c,tooltip:v,label:o,className:u,autoComplete:"new-password",addonAfter:s,addonBefore:p,help:f})}case"phone":{const{onChange:a,placeholder:n,addonAfter:s,addonBefore:p}=e;return r.jsx(te,{...e,...y,placeholder:n,disabled:!g,rules:h,required:i,onChange:a?b=>a(b,C):void 0,type:j,name:c,tooltip:v,label:o,className:u,autoComplete:"new-password",addonAfter:s,addonBefore:p,help:f})}case"number":{const{onChange:a,placeholder:n,allowMinus:s,min:p,max:b,addonAfter:d,addonBefore:N}=e;return r.jsx(re,{...y,placeholder:n,disabled:!g,moneyField:!!e.formatted,type:j,onChange:a?t=>a(t,C):void 0,rules:h,autoComplete:"false",required:i,tooltip:v,className:u,min:s?null:p,max:b,addonAfter:d,addonBefore:N,name:c,label:o,help:f})}case"date":{const{range:a,disableToday:n,disabledFutureDays:s,disabledPastDays:p,onChange:b,placeholder:d,format:N}=e;return r.jsx(Z,{...y,placeholder:d,required:i,disabled:!g,type:j,format:N,tooltip:v,range:a,name:c,label:o,onChange:b?t=>b(t,C):void 0,className:u,disableToday:n,disabledFutureDays:s,disabledPastDays:p,help:f})}case"time":{const{range:a=!1,disableCurrent:n,disabledFuture:s,disabledPast:p,onChange:b,use12Hours:d,format:N,placeholder:t}=e;return r.jsx(ee,{...y,placeholder:t,required:i,format:N,disabled:!g,type:j,tooltip:v,range:a,use12Hours:d,name:c,label:o,onChange:b?F=>b(F,C):void 0,className:u,disableCurrent:n,disabledFuture:s,disabledPast:p,help:f})}case"textarea":return r.jsx(ne,{...w});case"image":return r.jsx(X.default,{...e,required:i,name:c,label:o,rules:h,fieldHelper:f,fieldClassName:u,onRemoved:e.onRemoved,onUploading:e.onUploading,provider:e.provider});case"file":return r.jsx(V.default,{...e,required:i,name:c,label:o,rules:h,fieldHelper:f,fieldClassName:u,onRemoved:e.onRemoved,onUploading:e.onUploading,provider:e.provider});case"select":return r.jsx(_,{...e,required:i,name:c,label:o,rules:h,fieldClassName:u,form:C,help:f,updatable:g,readonly:R,fieldTooltip:v,fieldHelper:f});case"enum":{const{enum:a,translation:n,onChange:s,onSearch:p,multiple:b,tagRender:d}=e,N=Array.isArray(a)?a:Object.keys(a);return"radio"in e&&e.radio?r.jsx(x.Form.Item,{...e,...y,name:c,required:i,tooltip:v,rules:h,label:o,className:["w-100",u].join(" "),help:f,children:r.jsx(x.Radio.Group,{...e,onChange:s?t=>{var F;return s((F=t==null?void 0:t.target)==null?void 0:F.value,C)}:void 0,children:N.map(t=>r.jsx(x.Radio,{disabled:!g,value:t,children:n?S(n[t]):t},t))})}):"checkbox"in e&&e.checkbox?r.jsx(x.Form.Item,{...e,...y,name:c,required:i,tooltip:v,rules:h,label:o,className:["w-100",u].join(" "),help:f,children:r.jsx(x.Checkbox.Group,{className:"w-100",children:N.map(t=>{const F=r.jsx(x.Checkbox,{disabled:!g,value:t,children:n?S(n[t]):t},t);return"checkboxGrid"in e&&e.checkboxGrid?r.jsx(x.Col,{...e.checkboxGrid,children:F}):F})})}):r.jsx(U,{...e,...y,tagRender:typeof d=="function"?d:d?t=>{const{value:F,label:O}=t,q=d[F];return q?r.jsx(x.Tag,{color:q.color,children:O}):r.jsx(x.Tag,{children:O})}:void 0,onChange:s?t=>s(t,C):void 0,className:["w-100",u].join(" "),name:c,items:N,required:i,tooltip:v,rules:h,label:o,help:f,disabled:!g,onSearch:p?t=>p(t,C):void 0,allowClear:!0,mode:b?"multiple":void 0,showLoadingInEmptyIndicator:!0,itemBuilder:t=>r.jsx(x.Select.Option,{value:t,children:n?S(n[t]):t},t)})}case"checkbox":{const{onChange:a,switch:n}=e;return r.jsx(Y,{...y,className:u,rules:h,onChange:a?s=>a(s,C):void 0,label:o,tooltip:v,disabled:!g,name:c,help:f,switch:n})}case"color":return r.jsx(D,{...e,type:"color",required:i,name:c,label:o,rules:h,fieldClassName:u,updatable:g,readonly:R,fieldTooltip:v,fieldHelper:f});default:return r.jsx(r.Fragment,{children:`${j} Not Implemented`})}}function _(w){const{items:o=[],loading:c,searchOnType:j,onSearch:i,multiple:P,onChange:h,highlightSearch:g,required:R,fieldClassName:u,rules:T,fieldTooltip:v,updatable:f,label:y,name:e,tagRender:C,updatingValue:S,onSet:a,placeholder:n,allowClear:s=!0,selectOptionRender:p,formLayoutProps:b}=w,d=w.form,[N,t]=k.useState(""),F=k.useMemo(()=>M.getRealName(e),[e]),O=k.useMemo(()=>M.getRealName(e,"upsertFieldName"),[e]),q=x.Form.useWatch(F,d),[H,I]=k.useState(!0);k.useEffect(()=>{a&&H&&q&&(a==null||a(q,o,d),I(!1))},[H,d,o,F,a,q]),k.useEffect(()=>{q&&I(!0)},[q]);const W=k.useCallback(async l=>{t(l),j&&(i==null||i(l,d,S))},[d,i,j,S]),$=k.useCallback(l=>p?p(l):l.value,[p]);return r.jsx(U,{...w,...b,showLoadingInEmptyIndicator:!0,maxTagCount:"responsive",maxTagPlaceholder:l=>r.jsxs(le,{title:r.jsx(r.Fragment,{children:l.map(m=>r.jsxs(r.Fragment,{children:[m.label," ",r.jsx("br",{})]}))}),children:["+",l==null?void 0:l.length]}),placeholder:n,onSelect:l=>{a==null||a(l==null?void 0:l.key,o,d)},onChange:h?l=>{t(""),h(l,d)}:void 0,mode:P?"multiple":void 0,className:["w-100",u].join(" "),name:O,items:o,required:R,tooltip:v,tagRender:C,rules:T,disabled:!f,label:y,allowClear:s,onSearch:W,loading:c,filterOption:g?(l,m)=>{var L,A,B;try{const E=l.toLowerCase().split(/\s+/),z=((typeof(m==null?void 0:m.children)=="string"?m==null?void 0:m.children:(A=(L=m==null?void 0:m.children)==null?void 0:L.props)==null?void 0:A.textToHighlight)??"").toLowerCase(),J=(((B=m==null?void 0:m.value)==null?void 0:B.toString())??"").toLowerCase();return E.every(G=>z.indexOf(G)>=0||J.indexOf(G)>=0)}catch{return!0}}:void 0,itemBuilder:g?l=>{const m=l.value?String(l.value):void 0;return r.jsx(x.Select.Option,{value:l.key,title:m,disabled:l.disabled,children:r.jsx(K,{highlightClassName:"highlight-text",searchWords:(N??"").split(" "),autoEscape:!0,textToHighlight:m??""})},l.key)}:l=>r.jsx(x.Select.Option,{value:l.key,title:l.value,disabled:l.disabled,children:$(l)},l.key)})}function D(w){const{formLayoutProps:o,required:c,fieldClassName:j,rules:i,fieldTooltip:P,updatable:h,label:g,name:R,fieldHelper:u}=w;return r.jsx(x.Form.Item,{...o,label:g,name:R,required:c,rules:i,tooltip:P,help:u,getValueFromEvent:T=>typeof T=="object"?T.toHexString():T,children:r.jsx(x.ColorPicker,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",showText:!0,trigger:"click",className:j,disabled:!h,...w.innerProps})})}exports.ColorCrudFieldComponent=D;exports.SelectCrudFieldComponent=_;exports.default=oe;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),x=require("antd"),k=require("react"),K=require("react-highlight-words"),Q=require("../locale/index.cjs.js"),V=require("./FileCrudField.cjs.js"),X=require("./ImageCrudField.cjs.js"),Y=require("../common/check-box/CheckBox.cjs.js"),Z=require("../common/date-picker/DatePicker.cjs.js"),ee=require("../common/date-picker/TimePicker.cjs.js"),U=require("../common/select/SelectComponent.cjs.js"),re=require("../common/text-field/NumberField.cjs.js"),te=require("../common/text-field/PhoneNumberField.cjs.js"),ae=require("../common/text-field/TextField.cjs.js"),le=require("../common/tooltip/TooltipComponent.cjs.js"),ne=require("./CrudTextAreaComponent.cjs.js"),M=require("../util/CrudUtil.cjs.js");function oe(w){const{label:o,name:c,type:j,required:d,hidden:P,rules:h=[],updatable:g=!0,readonly:R=!1,fieldClassName:u,customFormFieldRender:T,fieldTooltip:v,fieldHelper:f,formLayoutProps:y,...e}=w,C=x.Form.useFormInstance();k.useEffect(()=>{if(j==="select"){const{items:a=[],onSearch:n,searchOnType:s}=e;!(a!=null&&a.length)&&!s&&(n==null||n(void 0,C,e==null?void 0:e.updatingValue))}},[C,e,j,e==null?void 0:e.updatingValue]);const{t:S}=Q.useTranslationLibNoNS();if(R||P)return r.jsx(r.Fragment,{});if(T)return T(C,w);switch(j){case"text":case"email":case"password":{const{maxLength:a,onChange:n,placeholder:s,addonAfter:p,addonBefore:b}=e;return r.jsx(ae.default,{...y,maxLength:a,placeholder:s,disabled:!g,rules:h,required:d,onChange:n?i=>n(i,C):void 0,type:j,name:c,tooltip:v,label:o,className:u,autoComplete:"new-password",addonAfter:p,addonBefore:b,help:f})}case"phone":{const{onChange:a,placeholder:n,addonAfter:s,addonBefore:p}=e;return r.jsx(te,{...e,...y,placeholder:n,disabled:!g,rules:h,required:d,onChange:a?b=>a(b,C):void 0,type:j,name:c,tooltip:v,label:o,className:u,autoComplete:"new-password",addonAfter:s,addonBefore:p,help:f})}case"number":{const{onChange:a,placeholder:n,allowMinus:s,min:p,max:b,addonAfter:i,addonBefore:N}=e;return r.jsx(re,{...y,placeholder:n,disabled:!g,moneyField:!!e.formatted,type:j,onChange:a?t=>a(t,C):void 0,rules:h,autoComplete:"false",required:d,tooltip:v,className:u,min:s?null:p,max:b,addonAfter:i,addonBefore:N,name:c,label:o,help:f})}case"date":{const{range:a,disableToday:n,disabledFutureDays:s,disabledPastDays:p,onChange:b,placeholder:i,format:N}=e;return r.jsx(Z,{...y,placeholder:i,required:d,disabled:!g,type:j,format:N,tooltip:v,range:a,name:c,label:o,onChange:b?t=>b(t,C):void 0,className:u,disableToday:n,disabledFutureDays:s,disabledPastDays:p,help:f})}case"time":{const{range:a=!1,disableCurrent:n,disabledFuture:s,disabledPast:p,onChange:b,use12Hours:i,format:N,placeholder:t}=e;return r.jsx(ee,{...y,placeholder:t,required:d,format:N,disabled:!g,type:j,tooltip:v,range:a,use12Hours:i,name:c,label:o,onChange:b?F=>b(F,C):void 0,className:u,disableCurrent:n,disabledFuture:s,disabledPast:p,help:f})}case"textarea":return r.jsx(ne,{...w});case"image":return r.jsx(X.default,{...e,required:d,name:c,label:o,rules:h,fieldHelper:f,fieldClassName:u,onRemoved:e.onRemoved,onUploading:e.onUploading,provider:e.provider});case"file":return r.jsx(V.default,{...e,required:d,name:c,label:o,rules:h,fieldHelper:f,fieldClassName:u,onRemoved:e.onRemoved,onUploading:e.onUploading,provider:e.provider});case"select":return r.jsx(_,{...e,required:d,name:c,label:o,rules:h,fieldClassName:u,form:C,help:f,updatable:g,readonly:R,fieldTooltip:v,fieldHelper:f});case"enum":{const{enum:a,translation:n,onChange:s,onSearch:p,multiple:b,tagRender:i}=e,N=Array.isArray(a)?a:Object.keys(a);return"radio"in e&&e.radio?r.jsx(x.Form.Item,{...e,...y,name:c,required:d,tooltip:v,rules:h,label:o,className:["w-100",u].join(" "),help:f,children:r.jsx(x.Radio.Group,{...e,onChange:s?t=>{var F;return s((F=t==null?void 0:t.target)==null?void 0:F.value,C)}:void 0,children:N.map(t=>r.jsx(x.Radio,{disabled:!g,value:t,children:n?S(n[t]):t},t))})}):"checkbox"in e&&e.checkbox?r.jsx(x.Form.Item,{...e,...y,name:c,required:d,tooltip:v,rules:h,label:o,className:["w-100",u].join(" "),help:f,children:r.jsx(x.Checkbox.Group,{className:"w-100",children:N.map(t=>{const F=r.jsx(x.Checkbox,{disabled:!g,value:t,children:n?S(n[t]):t},t);return"checkboxGrid"in e&&e.checkboxGrid?r.jsx(x.Col,{...e.checkboxGrid,children:F}):F})})}):r.jsx(U,{...e,...y,tagRender:typeof i=="function"?i:i?t=>{const{value:F,label:O}=t,q=i[F];return q?r.jsx(x.Tag,{color:q.color,children:O}):r.jsx(x.Tag,{children:O})}:void 0,onChange:s?t=>s(t,C):void 0,className:["w-100",u].join(" "),name:c,items:N,required:d,tooltip:v,rules:h,label:o,help:f,disabled:!g,onSearch:p?t=>p(t,C):void 0,allowClear:!0,mode:b?"multiple":void 0,showLoadingInEmptyIndicator:!0,itemBuilder:t=>r.jsx(x.Select.Option,{value:t,children:n?S(n[t]):t},t)})}case"checkbox":{const{onChange:a,switch:n}=e;return r.jsx(Y,{...y,className:u,rules:h,onChange:a?s=>a(s,C):void 0,label:o,tooltip:v,disabled:!g,name:c,help:f,switch:n})}case"color":return r.jsx(D,{...e,type:"color",required:d,name:c,label:o,rules:h,fieldClassName:u,updatable:g,readonly:R,fieldTooltip:v,fieldHelper:f});default:return r.jsx(r.Fragment,{children:`${j} Not Implemented`})}}function _(w){const{items:o=[],loading:c,searchOnType:j,onSearch:d,multiple:P,onChange:h,highlightSearch:g,required:R,fieldClassName:u,rules:T,fieldTooltip:v,updatable:f,label:y,name:e,tagRender:C,updatingValue:S,onSet:a,placeholder:n,allowClear:s=!0,selectOptionRender:p,formLayoutProps:b}=w,i=w.form,[N,t]=k.useState(""),F=k.useMemo(()=>M.getRealName(e),[e]),O=k.useMemo(()=>M.getRealName(e,"upsertFieldName"),[e]),q=x.Form.useWatch(F,i),[H,L]=k.useState(!0);k.useEffect(()=>{a&&H&&q&&(a==null||a(q,o,i),L(!1))},[H,i,o,F,a,q]),k.useEffect(()=>{q&&L(!0)},[q]);const W=k.useCallback(async l=>{t(l),j&&(d==null||d(l,i,S))},[i,d,j,S]),$=k.useCallback(l=>p?p(l):l.value,[p]);return r.jsx(U,{...w,...b,showLoadingInEmptyIndicator:!0,maxTagCount:"responsive",maxTagPlaceholder:l=>r.jsxs(le,{title:r.jsx(r.Fragment,{children:l.map(m=>r.jsxs(r.Fragment,{children:[m.label," ",r.jsx("br",{})]}))}),children:["+",l==null?void 0:l.length]}),placeholder:n,onSelect:l=>{a==null||a(l==null?void 0:l.key,o,i)},onChange:h?l=>{t(""),h(l,i)}:void 0,mode:P?"multiple":void 0,className:["w-100",u].join(" "),name:O,items:o,required:R,tooltip:v,tagRender:C,rules:T,disabled:!f,label:y,allowClear:s,onSearch:W,loading:c,filterOption:g?(l,m)=>{var I,A,B;try{const E=l.toLowerCase().split(/\s+/),z=((typeof(m==null?void 0:m.children)=="string"?m==null?void 0:m.children:(A=(I=m==null?void 0:m.children)==null?void 0:I.props)==null?void 0:A.textToHighlight)??"").toLowerCase(),J=(((B=m==null?void 0:m.value)==null?void 0:B.toString())??"").toLowerCase();return E.every(G=>z.indexOf(G)>=0||J.indexOf(G)>=0)}catch{return!0}}:void 0,itemBuilder:g?l=>{const m=l.value?String(l.value):void 0;return r.jsx(x.Select.Option,{value:l.key,title:m,disabled:l.disabled,children:r.jsx(K,{highlightClassName:"highlight-text",searchWords:(N??"").split(" "),autoEscape:!0,textToHighlight:m??""})},l.key)}:l=>r.jsx(x.Select.Option,{value:l.key,title:l.value,disabled:l.disabled,children:$(l)},l.key)})}function D(w){const{formLayoutProps:o,required:c,fieldClassName:j,rules:d,fieldTooltip:P,updatable:h,label:g,name:R,fieldHelper:u}=w;return r.jsx(x.Form.Item,{...o,label:g,name:R,required:c,rules:d,tooltip:P,help:u,getValueFromEvent:T=>typeof T=="object"?T.toHexString():T,children:r.jsx(x.ColorPicker,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",showText:!0,trigger:"click",className:j,disabled:!h,...w.innerProps})})}exports.ColorCrudFieldComponent=D;exports.SelectCrudFieldComponent=_;exports.default=oe;