@kingteza/crud-component 1.4.0 → 1.4.2

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";var g=Object.create;var p=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var w=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of V(t))!F.call(e,o)&&o!==r&&p(e,o,{get:()=>t[o],enumerable:!(s=q(t,o))||s.enumerable});return e};var R=(e,t,r)=>(r=e!=null?g(j(e)):{},w(t||!e||!e.__esModule?p(r,"default",{value:e,enumerable:!0}):r,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime");;/* empty css */;/* empty css */const h=require("antd"),c=require("react"),y=require("../../util/ValidationUtil.cjs.js"),E=c.lazy(async()=>{const{default:e}=await import("react-quill");return{default:t=>a.jsx(e,{...t})}}),S=({name:e,label:t,required:r,rules:s=[],disabled:o})=>{const n=h.Form.useFormInstance(),[u,d]=c.useState(""),f={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],["link"],["clean"]]},b=["bold","italic","underline","strike","blockquote","list","bullet","link"];c.useEffect(()=>{const i=n.getFieldValue(e);i&&i!=="<p></p>"&&i!=="<p><br></p>"&&d(i)},[n,e]);const l=h.Form.useWatch(e,n);c.useEffect(()=>{l!==u&&d(!l||l==="<p></p>"||l==="<p><br></p>"?"":l)},[l,u]);const k=i=>{d(i);const x=!i||i==="<p></p>"||i.trim()==="<p><br></p>"?void 0:i;n.setFieldValue(e,x),n.validateFields([e]).catch(()=>{})},m=c.useMemo(()=>r?[...s,...y.required(t??"")]:s,[r,s,t]);return a.jsx(h.Form.Item,{name:e,label:t,rules:m,children:a.jsx(c.Suspense,{fallback:a.jsx("div",{children:"Loading editor..."}),children:a.jsx(E,{readOnly:o,value:u,onChange:k,theme:"snow",className:"bg-white dark:!bg-[#141414] dark:text-white dark:!fill-white",modules:f,formats:b})})})};exports.RichTextEditor=S;
1
+ "use strict";var q=Object.create;var p=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var R=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of j(t))!w.call(e,o)&&o!==r&&p(e,o,{get:()=>t[o],enumerable:!(s=V(t,o))||s.enumerable});return e};var y=(e,t,r)=>(r=e!=null?q(F(e)):{},R(t||!e||!e.__esModule?p(r,"default",{value:e,enumerable:!0}):r,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime");;/* empty css */;/* empty css */const h=require("antd"),c=require("react"),E=require("../../util/ValidationUtil.cjs.js"),S=c.lazy(async()=>{const{default:e}=await import("react-quill");return{default:t=>a.jsx(e,{...t})}}),T=({name:e,label:t,required:r,rules:s=[],disabled:o,help:f})=>{const n=h.Form.useFormInstance(),[u,d]=c.useState(""),b={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],["link"],["clean"]]},k=["bold","italic","underline","strike","blockquote","list","bullet","link"];c.useEffect(()=>{const i=n.getFieldValue(e);i&&i!=="<p></p>"&&i!=="<p><br></p>"&&d(i)},[n,e]);const l=h.Form.useWatch(e,n);c.useEffect(()=>{l!==u&&d(!l||l==="<p></p>"||l==="<p><br></p>"?"":l)},[l,u]);const m=i=>{d(i);const g=!i||i==="<p></p>"||i.trim()==="<p><br></p>"?void 0:i;n.setFieldValue(e,g),n.validateFields([e]).catch(()=>{})},x=c.useMemo(()=>r?[...s,...E.required(t??"")]:s,[r,s,t]);return a.jsx(h.Form.Item,{help:f,name:e,label:t,rules:x,children:a.jsx(c.Suspense,{fallback:a.jsx("div",{children:"Loading editor..."}),children:a.jsx(S,{readOnly:o,value:u,onChange:m,theme:"snow",className:"bg-white dark:!bg-[#141414] dark:text-white dark:!fill-white",modules:b,formats:k})})})};exports.RichTextEditor=T;
@@ -1,6 +1,7 @@
1
1
  import { Rule } from 'antd/es/form';
2
- import { FC } from 'react';
2
+ import { FC, ReactNode } from 'react';
3
3
  export interface RichTextEditorProps {
4
+ help?: ReactNode;
4
5
  label?: string;
5
6
  name: string;
6
7
  required?: boolean;
@@ -2,26 +2,27 @@ import { jsx as l } from "react/jsx-runtime";
2
2
  /* empty css */
3
3
  /* empty css */
4
4
  import { Form as a } from "antd";
5
- import V, { useState as g, useEffect as u, useMemo as w, Suspense as F } from "react";
6
- import x from "../../util/ValidationUtil.es.js";
7
- const R = V.lazy(async () => {
5
+ import g, { useState as w, useEffect as u, useMemo as F, Suspense as x } from "react";
6
+ import R from "../../util/ValidationUtil.es.js";
7
+ const y = g.lazy(async () => {
8
8
  const { default: e } = await import("react-quill");
9
9
  return { default: (o) => /* @__PURE__ */ l(e, { ...o }) };
10
- }), S = ({
10
+ }), j = ({
11
11
  name: e,
12
12
  label: o,
13
13
  required: d,
14
14
  rules: c = [],
15
- disabled: p
15
+ disabled: p,
16
+ help: m
16
17
  }) => {
17
- const r = a.useFormInstance(), [n, s] = g(""), m = {
18
+ const r = a.useFormInstance(), [n, s] = w(""), f = {
18
19
  toolbar: [
19
20
  ["bold", "italic", "underline", "strike", "blockquote"],
20
21
  [{ list: "ordered" }, { list: "bullet" }],
21
22
  ["link"],
22
23
  ["clean"]
23
24
  ]
24
- }, f = [
25
+ }, h = [
25
26
  "bold",
26
27
  "italic",
27
28
  "underline",
@@ -39,28 +40,28 @@ const R = V.lazy(async () => {
39
40
  u(() => {
40
41
  i !== n && s(!i || i === "<p></p>" || i === "<p><br></p>" ? "" : i);
41
42
  }, [i, n]);
42
- const h = (t) => {
43
+ const b = (t) => {
43
44
  s(t);
44
- const k = !t || t === "<p></p>" || t.trim() === "<p><br></p>" ? void 0 : t;
45
- r.setFieldValue(e, k), r.validateFields([e]).catch(() => {
45
+ const V = !t || t === "<p></p>" || t.trim() === "<p><br></p>" ? void 0 : t;
46
+ r.setFieldValue(e, V), r.validateFields([e]).catch(() => {
46
47
  });
47
- }, b = w(
48
- () => d ? [...c, ...x.required(o ?? "")] : c,
48
+ }, k = F(
49
+ () => d ? [...c, ...R.required(o ?? "")] : c,
49
50
  [d, c, o]
50
51
  );
51
- return /* @__PURE__ */ l(a.Item, { name: e, label: o, rules: b, children: /* @__PURE__ */ l(F, { fallback: /* @__PURE__ */ l("div", { children: "Loading editor..." }), children: /* @__PURE__ */ l(
52
- R,
52
+ return /* @__PURE__ */ l(a.Item, { help: m, name: e, label: o, rules: k, children: /* @__PURE__ */ l(x, { fallback: /* @__PURE__ */ l("div", { children: "Loading editor..." }), children: /* @__PURE__ */ l(
53
+ y,
53
54
  {
54
55
  readOnly: p,
55
56
  value: n,
56
- onChange: h,
57
+ onChange: b,
57
58
  theme: "snow",
58
59
  className: "bg-white dark:!bg-[#141414] dark:text-white dark:!fill-white",
59
- modules: m,
60
- formats: f
60
+ modules: f,
61
+ formats: h
61
62
  }
62
63
  ) }) });
63
64
  };
64
65
  export {
65
- S as RichTextEditor
66
+ j as RichTextEditor
66
67
  };
@@ -1 +1 @@
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;
1
+ "use strict";const r=require("react/jsx-runtime"),l=require("antd"),V=require("react"),B=require("../../locale/index.cjs.js"),D=require("../tooltip/TooltipComponent.cjs.js"),E=require("../../util/ValidationUtil.cjs.js");function P({label:a,rules:S=[],required:x,placeholder:h,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,help:k,...n}){const{t:U}=B.useTranslationLib(),F=V.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 r.jsx("option",{value:t,children:r.jsx("div",{dangerouslySetInnerHTML:{__html:c}})},t)},[u]),H=a??h??"";return r.jsx(l.ConfigProvider,{renderEmpty:T&&m?()=>r.jsx(l.Spin,{}):void 0,children:r.jsx(D,{title:b,children:r.jsx(l.Form.Item,{label:a,name:n.name,help:k,className:n.className,required:x,rules:[...S,...x?E.required(H):[]],children:r.jsx(l.Select,{ref:_,loading:m,open:s?!1:void 0,onChange:!s&&n.onChange,allowClear:!s&&n.allowClear,showSearch:!L,className:`max-width ${s?"readOnly":""}`,...n,tagRender:R,placeholder:h??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,I=e.toLowerCase().split(/\s+/),y=(t==null?void 0:t.children)??"",w=typeof y=="string"?y.toLowerCase():typeof i=="string"?i.toLowerCase():"",M=(((j=t==null?void 0:t.value)==null?void 0:j.toString())??"").toLowerCase(),O=w.replace(/\s/g,"");return I.every(d=>w.indexOf(d)>=0||M.indexOf(d)>=0||O.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??F):r.jsx(r.Fragment,{}))})})})})}module.exports=P;
@@ -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 }: Readonly<SelectComponentProps<T>>): import("react/jsx-runtime").JSX.Element;
20
+ declare function SelectComponent<T = any>({ label, rules, required, placeholder, notSearch, children, readOnly, items, dropdownRender, itemBuilder, loading, showLoadingInEmptyIndicator, nameFieldInArray, innerRef, tooltip, filterOption, tagRender, help, ...props }: Readonly<SelectComponentProps<T>>): import("react/jsx-runtime").JSX.Element;
21
21
  export default SelectComponent;
@@ -1,10 +1,10 @@
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({
1
+ import { jsx as t, Fragment as B } from "react/jsx-runtime";
2
+ import { ConfigProvider as D, Form as E, Select as P, Spin as R } from "antd";
3
+ import { useCallback as U } from "react";
4
+ import { useTranslationLib as W } from "../../locale/index.es.js";
5
+ import $ from "../tooltip/TooltipComponent.es.js";
6
+ import q from "../../util/ValidationUtil.es.js";
7
+ function Z({
8
8
  label: m,
9
9
  rules: S = [],
10
10
  required: f,
@@ -22,33 +22,34 @@ function Y({
22
22
  tooltip: N,
23
23
  filterOption: k,
24
24
  tagRender: F,
25
+ help: H,
25
26
  ...n
26
27
  }) {
27
- const { t: q } = U(), H = R(
28
+ const { t: z } = W(), I = U(
28
29
  (e) => {
29
30
  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];
30
31
  return /* @__PURE__ */ t("option", { value: r, children: /* @__PURE__ */ t("div", { dangerouslySetInnerHTML: { __html: c } }) }, r);
31
32
  },
32
33
  [g]
33
- ), I = m ?? a ?? "";
34
+ ), M = m ?? a ?? "";
34
35
  return /* @__PURE__ */ t(
35
- B,
36
+ D,
36
37
  {
37
- renderEmpty: _ && h ? () => /* @__PURE__ */ t(P, {}) : void 0,
38
- children: /* @__PURE__ */ t(W, { title: N, children: /* @__PURE__ */ t(
39
- D.Item,
38
+ renderEmpty: _ && h ? () => /* @__PURE__ */ t(R, {}) : void 0,
39
+ children: /* @__PURE__ */ t($, { title: N, children: /* @__PURE__ */ t(
40
+ E.Item,
40
41
  {
41
42
  label: m,
42
43
  name: n.name,
43
- help: n.help,
44
+ help: H,
44
45
  className: n.className,
45
46
  required: f,
46
47
  rules: [
47
48
  ...S,
48
- ...f ? $.required(I) : []
49
+ ...f ? q.required(M) : []
49
50
  ],
50
51
  children: /* @__PURE__ */ t(
51
- E,
52
+ P,
52
53
  {
53
54
  ref: b,
54
55
  loading: h,
@@ -63,16 +64,16 @@ function Y({
63
64
  filterOption: k ?? ((e, r) => {
64
65
  var c, p, C, y;
65
66
  try {
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, "");
67
- return M.every(
68
- (l) => x.indexOf(l) >= 0 || O.indexOf(l) >= 0 || V.indexOf(l) >= 0
67
+ 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, O = e.toLowerCase().split(/\s+/), w = (r == null ? void 0 : r.children) ?? "", x = typeof w == "string" ? w.toLowerCase() : typeof i == "string" ? i.toLowerCase() : "", V = (((y = r == null ? void 0 : r.value) == null ? void 0 : y.toString()) ?? "").toLowerCase(), j = x.replace(/\s/g, "");
68
+ return O.every(
69
+ (l) => x.indexOf(l) >= 0 || V.indexOf(l) >= 0 || j.indexOf(l) >= 0
69
70
  );
70
71
  } catch (i) {
71
72
  return console.log(i), !0;
72
73
  }
73
74
  }),
74
75
  popupRender: u,
75
- children: d === null ? void 0 : d ?? (s ? s == null ? void 0 : s.map(T ?? H) : /* @__PURE__ */ t(j, {}))
76
+ children: d === null ? void 0 : d ?? (s ? s == null ? void 0 : s.map(T ?? I) : /* @__PURE__ */ t(B, {}))
76
77
  }
77
78
  )
78
79
  }
@@ -81,5 +82,5 @@ function Y({
81
82
  );
82
83
  }
83
84
  export {
84
- Y as default
85
+ Z as default
85
86
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),b=require("antd"),q=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"),U=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"),M=require("../util/CrudUtil.cjs.js");function re(y){const{label:o,name:m,type:x,required:d,hidden:S,rules:h=[],updatable:g=!0,readonly:w=!1,fieldClassName:C,customFormFieldRender:O,fieldTooltip:j,fieldHelper:v,...t}=y,c=b.Form.useFormInstance();q.useEffect(()=>{if(x==="select"){const{items:l=[],onSearch:a,searchOnType:i}=t;!(l!=null&&l.length)&&!i&&(a==null||a(void 0,c,t==null?void 0:t.updatingValue))}},[c,t,x,t==null?void 0:t.updatingValue]);const{t:P}=z.useTranslationLibNoNS();if(w||S)return e.jsx(e.Fragment,{});if(O)return O(c,y);switch(x){case"text":case"email":case"password":{const{onChange:l,placeholder:a,addonAfter:i,addonBefore:f}=t;return e.jsx(V.default,{placeholder:a,disabled:!g,rules:h,required:d,onChange:l?s=>l(s,c):void 0,type:x,name:m,tooltip:j,label:o,className:C,autoComplete:"new-password",addonAfter:i,addonBefore:f,help:v})}case"number":{const{onChange:l,placeholder:a,allowMinus:i,min:f,max:s,addonAfter:T,addonBefore:p}=t;return e.jsx(Z,{placeholder:a,disabled:!g,moneyField:!!t.formatted,type:x,onChange:l?F=>l(F,c):void 0,rules:h,autoComplete:"false",required:d,tooltip:j,className:C,min:i?null:f,max:s,addonAfter:T,addonBefore:p,name:m,label:o,help:v})}case"date":{const{range:l,disableToday:a,disabledFutureDays:i,disabledPastDays:f,onChange:s,placeholder:T,format:p}=t;return e.jsx(X,{placeholder:T,required:d,disabled:!g,type:x,format:p,tooltip:j,range:l,name:m,label:o,onChange:s?F=>s(F,c):void 0,className:C,disableToday:a,disabledFutureDays:i,disabledPastDays:f,help:v})}case"time":{const{range:l=!1,disableCurrent:a,disabledFuture:i,disabledPast:f,onChange:s,use12Hours:T,format:p,placeholder:F}=t;return e.jsx(Y,{placeholder:F,required:d,format:p,disabled:!g,type:x,tooltip:j,range:l,use12Hours:T,name:m,label:o,onChange:s?n=>s(n,c):void 0,className:C,disableCurrent:a,disabledFuture:i,disabledPast:f,help:v})}case"textarea":return e.jsx(te,{...y});case"image":return e.jsx(K.default,{...t,required:d,name:m,label:o,rules:h,fieldClassName:C,onRemoved:t.onRemoved,onUploading:t.onUploading,provider:t.provider});case"file":return e.jsx(J.default,{...t,required:d,name:m,label:o,rules:h,fieldClassName:C,onRemoved:t.onRemoved,onUploading:t.onUploading,provider:t.provider});case"select":return e.jsx(E,{...t,required:d,name:m,label:o,rules:h,fieldClassName:C,form:c,updatable:g,readonly:w,fieldTooltip:j,fieldHelper:v});case"enum":{const{enum:l,radio:a=!1,translation:i,onChange:f,onSearch:s,multiple:T,tagRender:p}=t,F=Array.isArray(l)?l:Object.keys(l);return a?e.jsx(b.Form.Item,{...t,name:m,required:d,tooltip:j,rules:h,label:o,className:["w-100",C].join(" "),help:v,children:e.jsx(b.Radio.Group,{...t,onChange:f?n=>{var N;return f((N=n==null?void 0:n.target)==null?void 0:N.value,c)}:void 0,children:F.map(n=>e.jsx(b.Radio,{disabled:!g,value:n,children:i?P(i[n]):n},n))})}):e.jsx(U,{...t,tagRender:typeof p=="function"?p:p?n=>{const{value:N,label:R}=n,k=p[N];return k?e.jsx(b.Tag,{color:k.color,children:R}):e.jsx(b.Tag,{children:R})}:void 0,onChange:f?n=>f(n,c):void 0,className:["w-100",C].join(" "),name:m,items:F,required:d,tooltip:j,rules:h,label:o,help:v,disabled:!g,onSearch:s?n=>s(n,c):void 0,allowClear:!0,mode:T?"multiple":void 0,itemBuilder:n=>e.jsx(b.Select.Option,{value:n,children:i?P(i[n]):n},n)})}case"checkbox":{const{onChange:l,switch:a}=t;return e.jsx(Q,{className:C,rules:h,onChange:l?i=>l(i,c):void 0,label:o,tooltip:j,disabled:!g,name:m,help:v,switch:a})}case"color":return e.jsx(D,{...t,type:"color",required:d,name:m,label:o,rules:h,fieldClassName:C,updatable:g,readonly:w,fieldTooltip:j,fieldHelper:v});default:return e.jsx(e.Fragment,{children:`${x} Not Implemented`})}}function E(y){const{items:o=[],loading:m,searchOnType:x,onSearch:d,multiple:S,onChange:h,highlightSearch:g,required:w,fieldClassName:C,rules:O,fieldTooltip:j,updatable:v,label:t,name:c,tagRender:P,updatingValue:l,onSet:a,placeholder:i,allowClear:f=!0}=y,s=y.form,[T,p]=q.useState(""),F=q.useMemo(()=>M.getRealName(c),[c]),n=q.useMemo(()=>M.getRealName(c,"upsertFieldName"),[c]),N=b.Form.useWatch(F,s),[R,k]=q.useState(!0);q.useEffect(()=>{a&&R&&N&&(a==null||a(N,o,s),k(!1))},[R,s,o,F,a,N]),q.useEffect(()=>{N&&k(!0)},[N]);const _=q.useCallback(async r=>{p(r),x&&(d==null||d(r,s,l))},[s,d,x,l]);return e.jsx(U,{...y,maxTagCount:"responsive",maxTagPlaceholder:r=>e.jsxs(ee,{title:e.jsx(e.Fragment,{children:r.map(u=>e.jsxs(e.Fragment,{children:[u.label," ",e.jsx("br",{})]}))}),children:["+",r==null?void 0:r.length]}),placeholder:i,onSelect:r=>{a==null||a(r==null?void 0:r.key,o,s)},onChange:h?r=>{p(""),h(r,s)}:void 0,mode:S?"multiple":void 0,className:["w-100",C].join(" "),name:n,items:o,required:w,tooltip:j,tagRender:P,rules:O,disabled:!v,label:t,allowClear:f,onSearch:_,loading:m,filterOption:g?(r,u)=>{var H,A,B;try{const I=r.toLowerCase().split(/\s+/),W=((typeof(u==null?void 0:u.children)=="string"?u==null?void 0:u.children:(A=(H=u==null?void 0:u.children)==null?void 0:H.props)==null?void 0:A.textToHighlight)??"").toLowerCase(),G=(((B=u==null?void 0:u.value)==null?void 0:B.toString())??"").toLowerCase();return I.every(L=>W.indexOf(L)>=0||G.indexOf(L)>=0)}catch{return!0}}:void 0,itemBuilder:g?r=>{const u=r.value?String(r.value):void 0;return e.jsx(b.Select.Option,{value:r.key,title:u,disabled:r.disabled,children:e.jsx($,{highlightClassName:"highlight-text",searchWords:(T??"").split(" "),autoEscape:!0,textToHighlight:u??""})},r.key)}:r=>e.jsx(b.Select.Option,{value:r.key,title:r.value,disabled:r.disabled,children:r.value},r.key)})}function D(y){const{required:o,fieldClassName:m,rules:x,fieldTooltip:d,updatable:S,label:h,name:g,fieldHelper:w}=y;return e.jsx(b.Form.Item,{label:h,name:g,required:o,rules:x,tooltip:d,help:w,children:e.jsx(b.ColorPicker,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",showText:!0,trigger:"click",className:m,disabled:!S,...y.innerProps})})}exports.ColorCrudFieldComponent=D;exports.SelectCrudFieldComponent=E;exports.default=re;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),j=require("antd"),q=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"),U=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"),re=require("./CrudTextAreaComponent.cjs.js"),M=require("../util/CrudUtil.cjs.js");function te(y){const{label:i,name:m,type:x,required:d,hidden:S,rules:h=[],updatable:g=!0,readonly:w=!1,fieldClassName:C,customFormFieldRender:H,fieldTooltip:v,fieldHelper:f,...r}=y,c=j.Form.useFormInstance();q.useEffect(()=>{if(x==="select"){const{items:a=[],onSearch:l,searchOnType:o}=r;!(a!=null&&a.length)&&!o&&(l==null||l(void 0,c,r==null?void 0:r.updatingValue))}},[c,r,x,r==null?void 0:r.updatingValue]);const{t:O}=z.useTranslationLibNoNS();if(w||S)return e.jsx(e.Fragment,{});if(H)return H(c,y);switch(x){case"text":case"email":case"password":{const{onChange:a,placeholder:l,addonAfter:o,addonBefore:p}=r;return e.jsx(V.default,{placeholder:l,disabled:!g,rules:h,required:d,onChange:a?s=>a(s,c):void 0,type:x,name:m,tooltip:v,label:i,className:C,autoComplete:"new-password",addonAfter:o,addonBefore:p,help:f})}case"number":{const{onChange:a,placeholder:l,allowMinus:o,min:p,max:s,addonAfter:T,addonBefore:b}=r;return e.jsx(Z,{placeholder:l,disabled:!g,moneyField:!!r.formatted,type:x,onChange:a?F=>a(F,c):void 0,rules:h,autoComplete:"false",required:d,tooltip:v,className:C,min:o?null:p,max:s,addonAfter:T,addonBefore:b,name:m,label:i,help:f})}case"date":{const{range:a,disableToday:l,disabledFutureDays:o,disabledPastDays:p,onChange:s,placeholder:T,format:b}=r;return e.jsx(X,{placeholder:T,required:d,disabled:!g,type:x,format:b,tooltip:v,range:a,name:m,label:i,onChange:s?F=>s(F,c):void 0,className:C,disableToday:l,disabledFutureDays:o,disabledPastDays:p,help:f})}case"time":{const{range:a=!1,disableCurrent:l,disabledFuture:o,disabledPast:p,onChange:s,use12Hours:T,format:b,placeholder:F}=r;return e.jsx(Y,{placeholder:F,required:d,format:b,disabled:!g,type:x,tooltip:v,range:a,use12Hours:T,name:m,label:i,onChange:s?n=>s(n,c):void 0,className:C,disableCurrent:l,disabledFuture:o,disabledPast:p,help:f})}case"textarea":return e.jsx(re,{...y});case"image":return e.jsx(K.default,{...r,required:d,name:m,label:i,rules:h,fieldHelper:f,fieldClassName:C,onRemoved:r.onRemoved,onUploading:r.onUploading,provider:r.provider});case"file":return e.jsx(J.default,{...r,required:d,name:m,label:i,rules:h,fieldHelper:f,fieldClassName:C,onRemoved:r.onRemoved,onUploading:r.onUploading,provider:r.provider});case"select":return e.jsx(E,{...r,required:d,name:m,label:i,rules:h,fieldClassName:C,form:c,help:f,updatable:g,readonly:w,fieldTooltip:v,fieldHelper:f});case"enum":{const{enum:a,radio:l=!1,translation:o,onChange:p,onSearch:s,multiple:T,tagRender:b}=r,F=Array.isArray(a)?a:Object.keys(a);return l?e.jsx(j.Form.Item,{...r,name:m,required:d,tooltip:v,rules:h,label:i,className:["w-100",C].join(" "),help:f,children:e.jsx(j.Radio.Group,{...r,onChange:p?n=>{var N;return p((N=n==null?void 0:n.target)==null?void 0:N.value,c)}:void 0,children:F.map(n=>e.jsx(j.Radio,{disabled:!g,value:n,children:o?O(o[n]):n},n))})}):e.jsx(U,{...r,tagRender:typeof b=="function"?b:b?n=>{const{value:N,label:R}=n,k=b[N];return k?e.jsx(j.Tag,{color:k.color,children:R}):e.jsx(j.Tag,{children:R})}:void 0,onChange:p?n=>p(n,c):void 0,className:["w-100",C].join(" "),name:m,items:F,required:d,tooltip:v,rules:h,label:i,help:f,disabled:!g,onSearch:s?n=>s(n,c):void 0,allowClear:!0,mode:T?"multiple":void 0,itemBuilder:n=>e.jsx(j.Select.Option,{value:n,children:o?O(o[n]):n},n)})}case"checkbox":{const{onChange:a,switch:l}=r;return e.jsx(Q,{className:C,rules:h,onChange:a?o=>a(o,c):void 0,label:i,tooltip:v,disabled:!g,name:m,help:f,switch:l})}case"color":return e.jsx(D,{...r,type:"color",required:d,name:m,label:i,rules:h,fieldClassName:C,updatable:g,readonly:w,fieldTooltip:v,fieldHelper:f});default:return e.jsx(e.Fragment,{children:`${x} Not Implemented`})}}function E(y){const{items:i=[],loading:m,searchOnType:x,onSearch:d,multiple:S,onChange:h,highlightSearch:g,required:w,fieldClassName:C,rules:H,fieldTooltip:v,updatable:f,label:r,name:c,tagRender:O,updatingValue:a,onSet:l,placeholder:o,allowClear:p=!0}=y,s=y.form,[T,b]=q.useState(""),F=q.useMemo(()=>M.getRealName(c),[c]),n=q.useMemo(()=>M.getRealName(c,"upsertFieldName"),[c]),N=j.Form.useWatch(F,s),[R,k]=q.useState(!0);q.useEffect(()=>{l&&R&&N&&(l==null||l(N,i,s),k(!1))},[R,s,i,F,l,N]),q.useEffect(()=>{N&&k(!0)},[N]);const _=q.useCallback(async t=>{b(t),x&&(d==null||d(t,s,a))},[s,d,x,a]);return e.jsx(U,{...y,maxTagCount:"responsive",maxTagPlaceholder:t=>e.jsxs(ee,{title:e.jsx(e.Fragment,{children:t.map(u=>e.jsxs(e.Fragment,{children:[u.label," ",e.jsx("br",{})]}))}),children:["+",t==null?void 0:t.length]}),placeholder:o,onSelect:t=>{l==null||l(t==null?void 0:t.key,i,s)},onChange:h?t=>{b(""),h(t,s)}:void 0,mode:S?"multiple":void 0,className:["w-100",C].join(" "),name:n,items:i,required:w,tooltip:v,tagRender:O,rules:H,disabled:!f,label:r,allowClear:p,onSearch:_,loading:m,filterOption:g?(t,u)=>{var P,A,B;try{const I=t.toLowerCase().split(/\s+/),W=((typeof(u==null?void 0:u.children)=="string"?u==null?void 0:u.children:(A=(P=u==null?void 0:u.children)==null?void 0:P.props)==null?void 0:A.textToHighlight)??"").toLowerCase(),G=(((B=u==null?void 0:u.value)==null?void 0:B.toString())??"").toLowerCase();return I.every(L=>W.indexOf(L)>=0||G.indexOf(L)>=0)}catch{return!0}}:void 0,itemBuilder:g?t=>{const u=t.value?String(t.value):void 0;return e.jsx(j.Select.Option,{value:t.key,title:u,disabled:t.disabled,children:e.jsx($,{highlightClassName:"highlight-text",searchWords:(T??"").split(" "),autoEscape:!0,textToHighlight:u??""})},t.key)}:t=>e.jsx(j.Select.Option,{value:t.key,title:t.value,disabled:t.disabled,children:t.value},t.key)})}function D(y){const{required:i,fieldClassName:m,rules:x,fieldTooltip:d,updatable:S,label:h,name:g,fieldHelper:w}=y;return e.jsx(j.Form.Item,{label:h,name:g,required:i,rules:x,tooltip:d,help:w,children:e.jsx(j.ColorPicker,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",showText:!0,trigger:"click",className:m,disabled:!S,...y.innerProps})})}exports.ColorCrudFieldComponent=D;exports.SelectCrudFieldComponent=E;exports.default=te;
@@ -6,155 +6,155 @@ 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";
9
- import ae from "../common/date-picker/DatePicker.es.js";
10
- import le from "../common/date-picker/TimePicker.es.js";
9
+ import le from "../common/date-picker/DatePicker.es.js";
10
+ import ae from "../common/date-picker/TimePicker.es.js";
11
11
  import z from "../common/select/SelectComponent.es.js";
12
12
  import oe from "../common/text-field/NumberField.es.js";
13
- import ne from "../common/text-field/TextField.es.js";
14
- import ie from "../common/tooltip/TooltipComponent.es.js";
13
+ import ie from "../common/text-field/TextField.es.js";
14
+ import ne from "../common/tooltip/TooltipComponent.es.js";
15
15
  import de from "./CrudTextAreaComponent.es.js";
16
16
  import $ from "../util/CrudUtil.es.js";
17
17
  function Re(N) {
18
18
  const {
19
- label: i,
19
+ label: n,
20
20
  name: u,
21
- type: g,
21
+ type: C,
22
22
  required: s,
23
23
  hidden: k,
24
24
  rules: h = [],
25
25
  updatable: f = !0,
26
26
  readonly: w = !1,
27
- fieldClassName: C,
28
- customFormFieldRender: S,
29
- fieldTooltip: v,
30
- fieldHelper: y,
27
+ fieldClassName: b,
28
+ customFormFieldRender: O,
29
+ fieldTooltip: y,
30
+ fieldHelper: p,
31
31
  ...e
32
32
  } = N, c = A.useFormInstance();
33
33
  B(() => {
34
- if (g === "select") {
34
+ if (C === "select") {
35
35
  const {
36
- items: l = [],
37
- onSearch: a,
36
+ items: a = [],
37
+ onSearch: l,
38
38
  searchOnType: d
39
39
  } = e;
40
- !(l != null && l.length) && !d && (a == null || a(void 0, c, e == null ? void 0 : e.updatingValue));
40
+ !(a != null && a.length) && !d && (l == null || l(void 0, c, e == null ? void 0 : e.updatingValue));
41
41
  }
42
- }, [c, e, g, e == null ? void 0 : e.updatingValue]);
43
- const { t: H } = V();
42
+ }, [c, e, C, e == null ? void 0 : e.updatingValue]);
43
+ const { t: S } = V();
44
44
  if (w || k) return /* @__PURE__ */ t(P, {});
45
- if (S)
46
- return S(c, N);
47
- switch (g) {
45
+ if (O)
46
+ return O(c, N);
47
+ switch (C) {
48
48
  case "text":
49
49
  case "email":
50
50
  case "password": {
51
- const { onChange: l, placeholder: a, addonAfter: d, addonBefore: p } = e;
51
+ const { onChange: a, placeholder: l, addonAfter: d, addonBefore: g } = e;
52
52
  return /* @__PURE__ */ t(
53
- ne,
53
+ ie,
54
54
  {
55
- placeholder: a,
55
+ placeholder: l,
56
56
  disabled: !f,
57
57
  rules: h,
58
58
  required: s,
59
- onChange: l ? (n) => l(n, c) : void 0,
60
- type: g,
59
+ onChange: a ? (i) => a(i, c) : void 0,
60
+ type: C,
61
61
  name: u,
62
- tooltip: v,
63
- label: i,
64
- className: C,
62
+ tooltip: y,
63
+ label: n,
64
+ className: b,
65
65
  autoComplete: "new-password",
66
66
  addonAfter: d,
67
- addonBefore: p,
68
- help: y
67
+ addonBefore: g,
68
+ help: p
69
69
  }
70
70
  );
71
71
  }
72
72
  case "number": {
73
- const { onChange: l, placeholder: a, allowMinus: d, min: p, max: n, addonAfter: T, addonBefore: b } = e;
73
+ const { onChange: a, placeholder: l, allowMinus: d, min: g, max: i, addonAfter: T, addonBefore: v } = e;
74
74
  return /* @__PURE__ */ t(
75
75
  oe,
76
76
  {
77
- placeholder: a,
77
+ placeholder: l,
78
78
  disabled: !f,
79
79
  moneyField: !!e.formatted,
80
- type: g,
81
- onChange: l ? (x) => l(x, c) : void 0,
80
+ type: C,
81
+ onChange: a ? (x) => a(x, c) : void 0,
82
82
  rules: h,
83
83
  autoComplete: "false",
84
84
  required: s,
85
- tooltip: v,
86
- className: C,
87
- min: d ? null : p,
88
- max: n,
85
+ tooltip: y,
86
+ className: b,
87
+ min: d ? null : g,
88
+ max: i,
89
89
  addonAfter: T,
90
- addonBefore: b,
90
+ addonBefore: v,
91
91
  name: u,
92
- label: i,
93
- help: y
92
+ label: n,
93
+ help: p
94
94
  }
95
95
  );
96
96
  }
97
97
  case "date": {
98
98
  const {
99
- range: l,
100
- disableToday: a,
99
+ range: a,
100
+ disableToday: l,
101
101
  disabledFutureDays: d,
102
- disabledPastDays: p,
103
- onChange: n,
102
+ disabledPastDays: g,
103
+ onChange: i,
104
104
  placeholder: T,
105
- format: b
105
+ format: v
106
106
  } = e;
107
107
  return /* @__PURE__ */ t(
108
- ae,
108
+ le,
109
109
  {
110
110
  placeholder: T,
111
111
  required: s,
112
112
  disabled: !f,
113
- type: g,
114
- format: b,
115
- tooltip: v,
116
- range: l,
113
+ type: C,
114
+ format: v,
115
+ tooltip: y,
116
+ range: a,
117
117
  name: u,
118
- label: i,
119
- onChange: n ? (x) => n(x, c) : void 0,
120
- className: C,
121
- disableToday: a,
118
+ label: n,
119
+ onChange: i ? (x) => i(x, c) : void 0,
120
+ className: b,
121
+ disableToday: l,
122
122
  disabledFutureDays: d,
123
- disabledPastDays: p,
124
- help: y
123
+ disabledPastDays: g,
124
+ help: p
125
125
  }
126
126
  );
127
127
  }
128
128
  case "time": {
129
129
  const {
130
- range: l = !1,
131
- disableCurrent: a,
130
+ range: a = !1,
131
+ disableCurrent: l,
132
132
  disabledFuture: d,
133
- disabledPast: p,
134
- onChange: n,
133
+ disabledPast: g,
134
+ onChange: i,
135
135
  use12Hours: T,
136
- format: b,
136
+ format: v,
137
137
  placeholder: x
138
138
  } = e;
139
139
  return /* @__PURE__ */ t(
140
- le,
140
+ ae,
141
141
  {
142
142
  placeholder: x,
143
143
  required: s,
144
- format: b,
144
+ format: v,
145
145
  disabled: !f,
146
- type: g,
147
- tooltip: v,
148
- range: l,
146
+ type: C,
147
+ tooltip: y,
148
+ range: a,
149
149
  use12Hours: T,
150
150
  name: u,
151
- label: i,
152
- onChange: n ? (o) => n(o, c) : void 0,
153
- className: C,
154
- disableCurrent: a,
151
+ label: n,
152
+ onChange: i ? (o) => i(o, c) : void 0,
153
+ className: b,
154
+ disableCurrent: l,
155
155
  disabledFuture: d,
156
- disabledPast: p,
157
- help: y
156
+ disabledPast: g,
157
+ help: p
158
158
  }
159
159
  );
160
160
  }
@@ -167,9 +167,10 @@ function Re(N) {
167
167
  ...e,
168
168
  required: s,
169
169
  name: u,
170
- label: i,
170
+ label: n,
171
171
  rules: h,
172
- fieldClassName: C,
172
+ fieldHelper: p,
173
+ fieldClassName: b,
173
174
  onRemoved: e.onRemoved,
174
175
  onUploading: e.onUploading,
175
176
  provider: e.provider
@@ -182,9 +183,10 @@ function Re(N) {
182
183
  ...e,
183
184
  required: s,
184
185
  name: u,
185
- label: i,
186
+ label: n,
186
187
  rules: h,
187
- fieldClassName: C,
188
+ fieldHelper: p,
189
+ fieldClassName: b,
188
190
  onRemoved: e.onRemoved,
189
191
  onUploading: e.onUploading,
190
192
  provider: e.provider
@@ -197,46 +199,47 @@ function Re(N) {
197
199
  ...e,
198
200
  required: s,
199
201
  name: u,
200
- label: i,
202
+ label: n,
201
203
  rules: h,
202
- fieldClassName: C,
204
+ fieldClassName: b,
203
205
  form: c,
206
+ help: p,
204
207
  updatable: f,
205
208
  readonly: w,
206
- fieldTooltip: v,
207
- fieldHelper: y
209
+ fieldTooltip: y,
210
+ fieldHelper: p
208
211
  }
209
212
  );
210
213
  case "enum": {
211
214
  const {
212
- enum: l,
213
- radio: a = !1,
215
+ enum: a,
216
+ radio: l = !1,
214
217
  translation: d,
215
- onChange: p,
216
- onSearch: n,
218
+ onChange: g,
219
+ onSearch: i,
217
220
  multiple: T,
218
- tagRender: b
219
- } = e, x = Array.isArray(l) ? l : Object.keys(l);
220
- return a ? /* @__PURE__ */ t(
221
+ tagRender: v
222
+ } = e, x = Array.isArray(a) ? a : Object.keys(a);
223
+ return l ? /* @__PURE__ */ t(
221
224
  A.Item,
222
225
  {
223
226
  ...e,
224
227
  name: u,
225
228
  required: s,
226
- tooltip: v,
229
+ tooltip: y,
227
230
  rules: h,
228
- label: i,
229
- className: ["w-100", C].join(" "),
230
- help: y,
231
+ label: n,
232
+ className: ["w-100", b].join(" "),
233
+ help: p,
231
234
  children: /* @__PURE__ */ t(
232
235
  M.Group,
233
236
  {
234
237
  ...e,
235
- onChange: p ? (o) => {
238
+ onChange: g ? (o) => {
236
239
  var F;
237
- return p((F = o == null ? void 0 : o.target) == null ? void 0 : F.value, c);
240
+ return g((F = o == null ? void 0 : o.target) == null ? void 0 : F.value, c);
238
241
  } : void 0,
239
- children: x.map((o) => /* @__PURE__ */ t(M, { disabled: !f, value: o, children: d ? H(d[o]) : o }, o))
242
+ children: x.map((o) => /* @__PURE__ */ t(M, { disabled: !f, value: o, children: d ? S(d[o]) : o }, o))
240
243
  }
241
244
  )
242
245
  }
@@ -244,41 +247,41 @@ function Re(N) {
244
247
  z,
245
248
  {
246
249
  ...e,
247
- tagRender: typeof b == "function" ? b : b ? (o) => {
248
- const { value: F, label: R } = o, O = b[F];
249
- return O ? /* @__PURE__ */ t(W, { color: O.color, children: R }) : /* @__PURE__ */ t(W, { children: R });
250
+ tagRender: typeof v == "function" ? v : v ? (o) => {
251
+ const { value: F, label: R } = o, H = v[F];
252
+ return H ? /* @__PURE__ */ t(W, { color: H.color, children: R }) : /* @__PURE__ */ t(W, { children: R });
250
253
  } : void 0,
251
- onChange: p ? (o) => p(o, c) : void 0,
252
- className: ["w-100", C].join(" "),
254
+ onChange: g ? (o) => g(o, c) : void 0,
255
+ className: ["w-100", b].join(" "),
253
256
  name: u,
254
257
  items: x,
255
258
  required: s,
256
- tooltip: v,
259
+ tooltip: y,
257
260
  rules: h,
258
- label: i,
259
- help: y,
261
+ label: n,
262
+ help: p,
260
263
  disabled: !f,
261
- onSearch: n ? (o) => n(o, c) : void 0,
264
+ onSearch: i ? (o) => i(o, c) : void 0,
262
265
  allowClear: !0,
263
266
  mode: T ? "multiple" : void 0,
264
- itemBuilder: (o) => /* @__PURE__ */ t(j.Option, { value: o, children: d ? H(d[o]) : o }, o)
267
+ itemBuilder: (o) => /* @__PURE__ */ t(j.Option, { value: o, children: d ? S(d[o]) : o }, o)
265
268
  }
266
269
  );
267
270
  }
268
271
  case "checkbox": {
269
- const { onChange: l, switch: a } = e;
272
+ const { onChange: a, switch: l } = e;
270
273
  return /* @__PURE__ */ t(
271
274
  te,
272
275
  {
273
- className: C,
276
+ className: b,
274
277
  rules: h,
275
- onChange: l ? (d) => l(d, c) : void 0,
276
- label: i,
277
- tooltip: v,
278
+ onChange: a ? (d) => a(d, c) : void 0,
279
+ label: n,
280
+ tooltip: y,
278
281
  disabled: !f,
279
282
  name: u,
280
- help: y,
281
- switch: a
283
+ help: p,
284
+ switch: l
282
285
  }
283
286
  );
284
287
  }
@@ -290,51 +293,51 @@ function Re(N) {
290
293
  type: "color",
291
294
  required: s,
292
295
  name: u,
293
- label: i,
296
+ label: n,
294
297
  rules: h,
295
- fieldClassName: C,
298
+ fieldClassName: b,
296
299
  updatable: f,
297
300
  readonly: w,
298
- fieldTooltip: v,
299
- fieldHelper: y
301
+ fieldTooltip: y,
302
+ fieldHelper: p
300
303
  }
301
304
  );
302
305
  default:
303
- return /* @__PURE__ */ t(P, { children: `${g} Not Implemented` });
306
+ return /* @__PURE__ */ t(P, { children: `${C} Not Implemented` });
304
307
  }
305
308
  }
306
309
  function se(N) {
307
310
  const {
308
- items: i = [],
311
+ items: n = [],
309
312
  loading: u,
310
- searchOnType: g,
313
+ searchOnType: C,
311
314
  onSearch: s,
312
315
  multiple: k,
313
316
  onChange: h,
314
317
  highlightSearch: f,
315
318
  required: w,
316
- fieldClassName: C,
317
- rules: S,
318
- fieldTooltip: v,
319
- updatable: y,
319
+ fieldClassName: b,
320
+ rules: O,
321
+ fieldTooltip: y,
322
+ updatable: p,
320
323
  label: e,
321
324
  name: c,
322
- tagRender: H,
323
- updatingValue: l,
324
- onSet: a,
325
+ tagRender: S,
326
+ updatingValue: a,
327
+ onSet: l,
325
328
  placeholder: d,
326
- allowClear: p = !0
327
- } = N, n = N.form, [T, b] = G(""), x = _(() => $.getRealName(c), [c]), o = _(() => $.getRealName(c, "upsertFieldName"), [c]), F = A.useWatch(x, n), [R, O] = G(!0);
329
+ allowClear: g = !0
330
+ } = N, i = N.form, [T, v] = G(""), x = _(() => $.getRealName(c), [c]), o = _(() => $.getRealName(c, "upsertFieldName"), [c]), F = A.useWatch(x, i), [R, H] = G(!0);
328
331
  B(() => {
329
- a && R && F && (a == null || a(F, i, n), O(!1));
330
- }, [R, n, i, x, a, F]), B(() => {
331
- F && O(!0);
332
+ l && R && F && (l == null || l(F, n, i), H(!1));
333
+ }, [R, i, n, x, l, F]), B(() => {
334
+ F && H(!0);
332
335
  }, [F]);
333
336
  const J = Y(
334
337
  async (r) => {
335
- b(r), g && (s == null || s(r, n, l));
338
+ v(r), C && (s == null || s(r, i, a));
336
339
  },
337
- [n, s, g, l]
340
+ [i, s, C, a]
338
341
  );
339
342
  return /* @__PURE__ */ t(
340
343
  z,
@@ -342,7 +345,7 @@ function se(N) {
342
345
  ...N,
343
346
  maxTagCount: "responsive",
344
347
  maxTagPlaceholder: (r) => /* @__PURE__ */ E(
345
- ie,
348
+ ne,
346
349
  {
347
350
  title: /* @__PURE__ */ t(P, { children: r.map((m) => /* @__PURE__ */ E(P, { children: [
348
351
  m.label,
@@ -357,22 +360,22 @@ function se(N) {
357
360
  ),
358
361
  placeholder: d,
359
362
  onSelect: (r) => {
360
- a == null || a(r == null ? void 0 : r.key, i, n);
363
+ l == null || l(r == null ? void 0 : r.key, n, i);
361
364
  },
362
365
  onChange: h ? (r) => {
363
- b(""), h(r, n);
366
+ v(""), h(r, i);
364
367
  } : void 0,
365
368
  mode: k ? "multiple" : void 0,
366
- className: ["w-100", C].join(" "),
369
+ className: ["w-100", b].join(" "),
367
370
  name: o,
368
- items: i,
371
+ items: n,
369
372
  required: w,
370
- tooltip: v,
371
- tagRender: H,
372
- rules: S,
373
- disabled: !y,
373
+ tooltip: y,
374
+ tagRender: S,
375
+ rules: O,
376
+ disabled: !p,
374
377
  label: e,
375
- allowClear: p,
378
+ allowClear: g,
376
379
  onSearch: J,
377
380
  loading: u,
378
381
  filterOption: f ? (r, m) => {
@@ -421,9 +424,9 @@ function se(N) {
421
424
  }
422
425
  function ce(N) {
423
426
  const {
424
- required: i,
427
+ required: n,
425
428
  fieldClassName: u,
426
- rules: g,
429
+ rules: C,
427
430
  fieldTooltip: s,
428
431
  updatable: k,
429
432
  label: h,
@@ -435,8 +438,8 @@ function ce(N) {
435
438
  {
436
439
  label: h,
437
440
  name: f,
438
- required: i,
439
- rules: g,
441
+ required: n,
442
+ rules: C,
440
443
  tooltip: s,
441
444
  help: w,
442
445
  children: /* @__PURE__ */ t(
@@ -1 +1 @@
1
- "use strict";const u=require("react/jsx-runtime"),C=require("../common/text-field/TextArea.cjs.js"),T=require("../common/rich/index.cjs.js"),h=require("antd"),j=require("../util/CrudUtil.cjs.js"),p=({onChange:t,label:r,required:s,rules:o,name:i,updatable:n=!0,...c})=>{const a=h.Form.useFormInstance(),l=j.getRealName(i,"upsertFieldName");if(c.rich)return u.jsx(T.RichTextEditor,{name:l,label:r,required:s,rules:o,disabled:!n});{const{placeholder:m,rows:x,cols:f,fieldClassName:N,fieldTooltip:q}=c;return u.jsx(C.default,{rules:o,placeholder:m,onChange:t?e=>{var d;return t((d=e==null?void 0:e.target)==null?void 0:d.value,a)}:void 0,tooltip:q,required:s,disabled:!n,name:i,label:r,className:N,rows:x,cols:f})}};module.exports=p;
1
+ "use strict";const d=require("react/jsx-runtime"),q=require("../common/text-field/TextArea.cjs.js"),C=require("../common/rich/index.cjs.js"),T=require("antd"),j=require("../util/CrudUtil.cjs.js"),p=({onChange:r,label:s,required:i,rules:o,name:n,updatable:c=!0,...e})=>{const u=T.Form.useFormInstance(),a=j.getRealName(n,"upsertFieldName");if(e.rich)return d.jsx(C.RichTextEditor,{name:a,label:s,required:i,rules:o,disabled:!c,help:e.fieldHelper});{const{placeholder:m,rows:x,cols:f,fieldClassName:h,fieldTooltip:N}=e;return d.jsx(q.default,{rules:o,placeholder:m,onChange:r?t=>{var l;return r((l=t==null?void 0:t.target)==null?void 0:l.value,u)}:void 0,tooltip:N,required:i,disabled:!c,name:n,label:s,className:h,rows:x,cols:f,help:e.fieldHelper})}};module.exports=p;
@@ -1,52 +1,54 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import N from "../common/text-field/TextArea.es.js";
3
- import { RichTextEditor as T } from "../common/rich/index.es.js";
4
- import { Form as h } from "antd";
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import C from "../common/text-field/TextArea.es.js";
3
+ import { RichTextEditor as N } from "../common/rich/index.es.js";
4
+ import { Form as T } from "antd";
5
5
  import F from "../util/CrudUtil.es.js";
6
- const E = ({
7
- onChange: e,
8
- label: t,
9
- required: r,
10
- rules: m,
11
- name: i,
6
+ const w = ({
7
+ onChange: t,
8
+ label: r,
9
+ required: m,
10
+ rules: i,
11
+ name: l,
12
12
  updatable: s = !0,
13
- ...a
13
+ ...e
14
14
  }) => {
15
- const c = h.useFormInstance(), f = F.getRealName(i, "upsertFieldName");
16
- if (a.rich)
17
- return /* @__PURE__ */ d(
18
- T,
15
+ const f = T.useFormInstance(), n = F.getRealName(l, "upsertFieldName");
16
+ if (e.rich)
17
+ return /* @__PURE__ */ a(
18
+ N,
19
19
  {
20
- name: f,
21
- label: t,
22
- required: r,
23
- rules: m,
24
- disabled: !s
20
+ name: n,
21
+ label: r,
22
+ required: m,
23
+ rules: i,
24
+ disabled: !s,
25
+ help: e.fieldHelper
25
26
  }
26
27
  );
27
28
  {
28
- const { placeholder: l, rows: p, cols: u, fieldClassName: x, fieldTooltip: C } = a;
29
- return /* @__PURE__ */ d(
30
- N,
29
+ const { placeholder: c, rows: p, cols: u, fieldClassName: h, fieldTooltip: x } = e;
30
+ return /* @__PURE__ */ a(
31
+ C,
31
32
  {
32
- rules: m,
33
- placeholder: l,
34
- onChange: e ? (o) => {
35
- var n;
36
- return e((n = o == null ? void 0 : o.target) == null ? void 0 : n.value, c);
33
+ rules: i,
34
+ placeholder: c,
35
+ onChange: t ? (o) => {
36
+ var d;
37
+ return t((d = o == null ? void 0 : o.target) == null ? void 0 : d.value, f);
37
38
  } : void 0,
38
- tooltip: C,
39
- required: r,
39
+ tooltip: x,
40
+ required: m,
40
41
  disabled: !s,
41
- name: i,
42
- label: t,
43
- className: x,
42
+ name: l,
43
+ label: r,
44
+ className: h,
44
45
  rows: p,
45
- cols: u
46
+ cols: u,
47
+ help: e.fieldHelper
46
48
  }
47
49
  );
48
50
  }
49
51
  };
50
52
  export {
51
- E as default
53
+ w as default
52
54
  };
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import { FC, ReactNode } from 'react';
2
2
  import { InitialCrudField } from './CrudComponent';
3
3
  import { FileDownloadProvider, FileUploadProvider } from './ImageCrudField';
4
4
  export interface FileCrudField<T> extends _FileCrudField<T> {
@@ -12,6 +12,7 @@ export interface _FileCrudField<T> extends InitialCrudField<T> {
12
12
  accept?: string;
13
13
  maxCount?: number;
14
14
  block?: boolean;
15
+ help?: ReactNode;
15
16
  }
16
17
  export default function FileCrudFieldComponent<T>({ name, label, required, provider, onUploading, onRemoved, fieldClassName, accept, rules, maxCount, block, fieldHelper: help, ...props }: Readonly<_FileCrudField<T>>): import("react/jsx-runtime").JSX.Element;
17
18
  export declare const FileCrudCellValue: FC<{
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),b=require("@ant-design/icons"),h=require("antd"),A=require("../../common/show-more/index.cjs.js"),F=require("../FileCrudField.cjs.js"),T=require("../ImageCrudField.cjs.js"),j=require("../../util/DateUtil.cjs.js"),q=require("../../util/NumberUtil.cjs.js"),g=require("../../locale/index.cjs.js"),B=require("../../util/CrudUtil.cjs.js"),m=require("../../common/error/ErrorBoundaryComponent.cjs.js");function R({type:l,render:r,...i}){try{return l==="object"?(t,e,o)=>typeof r=="function"?r(t,e,o):"":l==="select"?(t,e,o)=>{if(!t)return"-";const n=i,a=t||(n.items??[]).find(s=>s[n.innerFieldId??"key"]===e[B.getRealName(i.name,"upsertFieldName")]),c=n.multiple?Array.isArray(a)?a.map(s=>s==null?void 0:s[n.innerFieldLabel??"name"]):void 0:a==null?void 0:a[n.innerFieldLabel??"value"];return typeof r=="function"?r(c,e,o):Array.isArray(c)?c.join(", "):c}:l==="number"?(t,e,o)=>typeof r=="function"?r(t,e,o):i!=null&&i.int?q.default.toInt(t,i.formatted):q.default.toMoney(t):l==="enum"?(t,e,o)=>{var s;if(!t)return"-";const n=i;if(typeof r=="function")return r(t,e,o);if(n.multiple){const f=Array.isArray(t)?t:t?[t]:[];return typeof n.tagRender=="object"?u.jsx(m.ErrorBoundaryComponent,{children:u.jsx(h.Space,{wrap:!0,children:f.map((d,y)=>{var v,S;const x=(v=n.tagRender)==null?void 0:v[d],C=g.tWithOrWithoutNS(((S=n==null?void 0:n.translation)==null?void 0:S[d??""])??d);return x?u.jsx(h.Tag,{color:x.color,children:C},y+d):C})})}):n!=null&&n.translation?u.jsx(m.ErrorBoundaryComponent,{children:f==null?void 0:f.map(d=>{var y;return g.tWithOrWithoutNS(((y=n==null?void 0:n.translation)==null?void 0:y[d??""])??d)}).join(", ")}):f==null?void 0:f.join(", ")}const a=((s=n==null?void 0:n.translation)==null?void 0:s[t??""])??t,c=g.tWithOrWithoutNS(a);if(typeof n.tagRender=="object"){const f=n.tagRender[t];if(f)return u.jsx(h.Tag,{color:f.color,children:c})}return c}:l==="date"?(t,e,o)=>{if(!t)return"-";const n=i!=null&&i.formatTime?j.formatDateTime(t):j.formatDate(t);return u.jsx(m.ErrorBoundaryComponent,{children:typeof r=="function"?r(t,e,o):n})}:l==="checkbox"?(t,e,o)=>typeof r=="function"?r(t,e,o):t?u.jsx(b.CheckOutlined,{}):u.jsx(b.CloseOutlined,{}):l==="image"?(t,e,o)=>t?u.jsx(m.ErrorBoundaryComponent,{children:typeof r=="function"?r(t,e,o):u.jsx(T.ImageCrudCellValue,{value:t,provider:i.provider})}):"-":l==="file"?(t,e,o)=>t?u.jsx(m.ErrorBoundaryComponent,{children:typeof r=="function"?r(t,e,o):u.jsx(F.FileCrudCellValue,{value:t,provider:i.provider})}):"":l==="time"?(t,e,o)=>{if(!t)return"-";const n=i==null?void 0:i.format,a=i==null?void 0:i.use12Hours,c=j.formatTime(t,n||(a?"hh:mm:ss A":void 0));return u.jsx(m.ErrorBoundaryComponent,{children:typeof r=="function"?r(t,e,o):c})}:l==="color"?(t,e,o)=>t?typeof r=="function"?r(t,e,o):typeof t=="string"&&t.startsWith("#")?u.jsx(h.Tooltip,{title:t,children:u.jsx(h.Avatar,{style:{backgroundColor:t}})}):String(t):"-":l==="textarea"?(t,e,o)=>{if(!t)return"-";const n=i,a=n.truncated??1;return typeof r=="function"?r(t,e,o):a?u.jsx(m.ErrorBoundaryComponent,{children:u.jsx(A.ShowMore,{lines:a===!0?1:a,children:n.rich?u.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:t}}):t})}):n.rich?u.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:t}}):t}:typeof r=="function"?r:(t,e,o)=>t}catch(t){return console.warn("An error occurred while rendering the value for field: "+String(i.name),t),"-"}}exports.getRendererValueCrudViewer=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),b=require("@ant-design/icons"),h=require("antd"),A=require("../../common/show-more/index.cjs.js"),F=require("../FileCrudField.cjs.js"),T=require("../ImageCrudField.cjs.js"),j=require("../../util/DateUtil.cjs.js"),q=require("../../util/NumberUtil.cjs.js"),g=require("../../locale/index.cjs.js"),B=require("../../util/CrudUtil.cjs.js"),m=require("../../common/error/ErrorBoundaryComponent.cjs.js");function R({type:l,render:r,...i}){try{return l==="object"?(t,o,e)=>typeof r=="function"?r(t,o,e):"":l==="select"?(t,o,e)=>{if(!t)return"-";const n=i,a=t||(n.items??[]).find(d=>d[n.innerFieldId??"key"]===o[B.getRealName(i.name,"upsertFieldName")]),c=n.multiple?Array.isArray(a)?a.map(d=>d==null?void 0:d[n.innerFieldLabel??"name"]):void 0:a==null?void 0:a[n.innerFieldLabel??"value"];return typeof r=="function"?r(c,o,e):Array.isArray(c)?c.join(", "):c}:l==="number"?(t,o,e)=>typeof r=="function"?r(t,o,e):i!=null&&i.int?q.default.toInt(t,i.formatted):q.default.toMoney(t):l==="enum"?(t,o,e)=>{var d;if(!t)return"-";const n=i;if(typeof r=="function")return r(t,o,e);if(n.multiple){const f=Array.isArray(t)?t:t?[t]:[];return typeof n.tagRender=="object"?u.jsx(m.ErrorBoundaryComponent,{children:u.jsx(h.Space,{wrap:!0,children:f.map((s,y)=>{var C,S;const x=(C=n.tagRender)==null?void 0:C[s],v=g.tWithOrWithoutNS(((S=n==null?void 0:n.translation)==null?void 0:S[s??""])??s,void 0,s);return x?u.jsx(h.Tag,{color:x.color,children:v},y+s):v})})}):n!=null&&n.translation?u.jsx(m.ErrorBoundaryComponent,{children:f==null?void 0:f.map(s=>{var y;return g.tWithOrWithoutNS(((y=n==null?void 0:n.translation)==null?void 0:y[s??""])??s,void 0,s)}).join(", ")}):f==null?void 0:f.join(", ")}const a=((d=n==null?void 0:n.translation)==null?void 0:d[t??""])??t,c=g.tWithOrWithoutNS(a,void 0,t);if(typeof n.tagRender=="object"){const f=n.tagRender[t];if(f)return u.jsx(h.Tag,{color:f.color,children:c})}return c}:l==="date"?(t,o,e)=>{if(!t)return"-";const n=i!=null&&i.formatTime?j.formatDateTime(t):j.formatDate(t);return u.jsx(m.ErrorBoundaryComponent,{children:typeof r=="function"?r(t,o,e):n})}:l==="checkbox"?(t,o,e)=>typeof r=="function"?r(t,o,e):t?u.jsx(b.CheckOutlined,{}):u.jsx(b.CloseOutlined,{}):l==="image"?(t,o,e)=>t?u.jsx(m.ErrorBoundaryComponent,{children:typeof r=="function"?r(t,o,e):u.jsx(T.ImageCrudCellValue,{value:t,provider:i.provider})}):"-":l==="file"?(t,o,e)=>t?u.jsx(m.ErrorBoundaryComponent,{children:typeof r=="function"?r(t,o,e):u.jsx(F.FileCrudCellValue,{value:t,provider:i.provider})}):"":l==="time"?(t,o,e)=>{if(!t)return"-";const n=i==null?void 0:i.format,a=i==null?void 0:i.use12Hours,c=j.formatTime(t,n||(a?"hh:mm:ss A":void 0));return u.jsx(m.ErrorBoundaryComponent,{children:typeof r=="function"?r(t,o,e):c})}:l==="color"?(t,o,e)=>t?typeof r=="function"?r(t,o,e):typeof t=="string"&&t.startsWith("#")?u.jsx(h.Tooltip,{title:t,children:u.jsx(h.Avatar,{style:{backgroundColor:t}})}):String(t):"-":l==="textarea"?(t,o,e)=>{if(!t)return"-";const n=i,a=n.truncated??1;return typeof r=="function"?r(t,o,e):a?u.jsx(m.ErrorBoundaryComponent,{children:u.jsx(A.ShowMore,{lines:a===!0?1:a,children:n.rich?u.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:t}}):t})}):n.rich?u.jsx("div",{style:{all:"unset"},dangerouslySetInnerHTML:{__html:t}}):t}:typeof r=="function"?r:(t,o,e)=>t}catch(t){return console.warn("An error occurred while rendering the value for field: "+String(i.name),t),"-"}}exports.getRendererValueCrudViewer=R;
@@ -1,12 +1,12 @@
1
- import { jsx as e } from "react/jsx-runtime";
1
+ import { jsx as a } from "react/jsx-runtime";
2
2
  import { CheckOutlined as T, CloseOutlined as F } from "@ant-design/icons";
3
3
  import { Space as R, Tag as S, Tooltip as w, Avatar as I } from "antd";
4
4
  import { ShowMore as V } from "../../common/show-more/index.es.js";
5
5
  import { FileCrudCellValue as k } from "../FileCrudField.es.js";
6
6
  import { ImageCrudCellValue as x } from "../ImageCrudField.es.js";
7
- import y from "../../util/DateUtil.es.js";
7
+ import v from "../../util/DateUtil.es.js";
8
8
  import j from "../../util/NumberUtil.es.js";
9
- import { tWithOrWithoutNS as g } from "../../locale/index.es.js";
9
+ import { tWithOrWithoutNS as y } from "../../locale/index.es.js";
10
10
  import H from "../../util/CrudUtil.es.js";
11
11
  import { ErrorBoundaryComponent as h } from "../../common/error/ErrorBoundaryComponent.es.js";
12
12
  function z({
@@ -17,49 +17,55 @@ function z({
17
17
  try {
18
18
  return c === "object" ? (t, o, r) => typeof i == "function" ? i(t, o, r) : "" : c === "select" ? (t, o, r) => {
19
19
  if (!t) return "-";
20
- const n = l, a = t || (n.items ?? []).find(
21
- (m) => m[n.innerFieldId ?? "key"] === o[H.getRealName(l.name, "upsertFieldName")]
22
- ), u = n.multiple ? Array.isArray(a) ? a.map((m) => m == null ? void 0 : m[n.innerFieldLabel ?? "name"]) : void 0 : a == null ? void 0 : a[n.innerFieldLabel ?? "value"];
20
+ const n = l, e = t || (n.items ?? []).find(
21
+ (d) => d[n.innerFieldId ?? "key"] === o[H.getRealName(l.name, "upsertFieldName")]
22
+ ), u = n.multiple ? Array.isArray(e) ? e.map((d) => d == null ? void 0 : d[n.innerFieldLabel ?? "name"]) : void 0 : e == null ? void 0 : e[n.innerFieldLabel ?? "value"];
23
23
  return typeof i == "function" ? i(u, o, r) : Array.isArray(u) ? u.join(", ") : u;
24
24
  } : c === "number" ? (t, o, r) => typeof i == "function" ? i(t, o, r) : l != null && l.int ? j.toInt(t, l.formatted) : j.toMoney(t) : c === "enum" ? (t, o, r) => {
25
- var m;
25
+ var d;
26
26
  if (!t) return "-";
27
27
  const n = l;
28
28
  if (typeof i == "function")
29
29
  return i(t, o, r);
30
30
  if (n.multiple) {
31
31
  const f = Array.isArray(t) ? t : t ? [t] : [];
32
- return typeof n.tagRender == "object" ? /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(R, { wrap: !0, children: f.map((d, s) => {
32
+ return typeof n.tagRender == "object" ? /* @__PURE__ */ a(h, { children: /* @__PURE__ */ a(R, { wrap: !0, children: f.map((m, s) => {
33
33
  var b, A;
34
- const v = (b = n.tagRender) == null ? void 0 : b[d], C = g(
35
- ((A = n == null ? void 0 : n.translation) == null ? void 0 : A[d ?? ""]) ?? d
34
+ const g = (b = n.tagRender) == null ? void 0 : b[m], C = y(
35
+ ((A = n == null ? void 0 : n.translation) == null ? void 0 : A[m ?? ""]) ?? m,
36
+ void 0,
37
+ m
36
38
  );
37
- return v ? /* @__PURE__ */ e(S, { color: v.color, children: C }, s + d) : C;
38
- }) }) }) : n != null && n.translation ? /* @__PURE__ */ e(h, { children: f == null ? void 0 : f.map(
39
- (d) => {
39
+ return g ? /* @__PURE__ */ a(S, { color: g.color, children: C }, s + m) : C;
40
+ }) }) }) : n != null && n.translation ? /* @__PURE__ */ a(h, { children: f == null ? void 0 : f.map(
41
+ (m) => {
40
42
  var s;
41
- return g(((s = n == null ? void 0 : n.translation) == null ? void 0 : s[d ?? ""]) ?? d);
43
+ return y(
44
+ ((s = n == null ? void 0 : n.translation) == null ? void 0 : s[m ?? ""]) ?? m,
45
+ void 0,
46
+ m
47
+ );
42
48
  }
43
49
  ).join(", ") }) : f == null ? void 0 : f.join(", ");
44
50
  }
45
- const a = ((m = n == null ? void 0 : n.translation) == null ? void 0 : m[t ?? ""]) ?? t, u = g(a);
51
+ const e = ((d = n == null ? void 0 : n.translation) == null ? void 0 : d[t ?? ""]) ?? t, u = y(e, void 0, t);
46
52
  if (typeof n.tagRender == "object") {
47
53
  const f = n.tagRender[t];
48
54
  if (f)
49
- return /* @__PURE__ */ e(S, { color: f.color, children: u });
55
+ return /* @__PURE__ */ a(S, { color: f.color, children: u });
50
56
  }
51
57
  return u;
52
58
  } : c === "date" ? (t, o, r) => {
53
59
  if (!t) return "-";
54
- const n = l != null && l.formatTime ? y.formatDateTime(t) : y.formatDate(t);
55
- return /* @__PURE__ */ e(h, { children: typeof i == "function" ? i(t, o, r) : n });
56
- } : c === "checkbox" ? (t, o, r) => typeof i == "function" ? i(t, o, r) : t ? /* @__PURE__ */ e(T, {}) : /* @__PURE__ */ e(F, {}) : c === "image" ? (t, o, r) => t ? /* @__PURE__ */ e(h, { children: typeof i == "function" ? i(t, o, r) : /* @__PURE__ */ e(
60
+ const n = l != null && l.formatTime ? v.formatDateTime(t) : v.formatDate(t);
61
+ return /* @__PURE__ */ a(h, { children: typeof i == "function" ? i(t, o, r) : n });
62
+ } : c === "checkbox" ? (t, o, r) => typeof i == "function" ? i(t, o, r) : t ? /* @__PURE__ */ a(T, {}) : /* @__PURE__ */ a(F, {}) : c === "image" ? (t, o, r) => t ? /* @__PURE__ */ a(h, { children: typeof i == "function" ? i(t, o, r) : /* @__PURE__ */ a(
57
63
  x,
58
64
  {
59
65
  value: t,
60
66
  provider: l.provider
61
67
  }
62
- ) }) : "-" : c === "file" ? (t, o, r) => t ? /* @__PURE__ */ e(h, { children: typeof i == "function" ? i(t, o, r) : /* @__PURE__ */ e(
68
+ ) }) : "-" : c === "file" ? (t, o, r) => t ? /* @__PURE__ */ a(h, { children: typeof i == "function" ? i(t, o, r) : /* @__PURE__ */ a(
63
69
  k,
64
70
  {
65
71
  value: t,
@@ -67,21 +73,21 @@ function z({
67
73
  }
68
74
  ) }) : "" : c === "time" ? (t, o, r) => {
69
75
  if (!t) return "-";
70
- const n = l == null ? void 0 : l.format, a = l == null ? void 0 : l.use12Hours, u = y.formatTime(
76
+ const n = l == null ? void 0 : l.format, e = l == null ? void 0 : l.use12Hours, u = v.formatTime(
71
77
  t,
72
- n || (a ? "hh:mm:ss A" : void 0)
78
+ n || (e ? "hh:mm:ss A" : void 0)
73
79
  );
74
- return /* @__PURE__ */ e(h, { children: typeof i == "function" ? i(t, o, r) : u });
75
- } : c === "color" ? (t, o, r) => t ? typeof i == "function" ? i(t, o, r) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ e(w, { title: t, children: /* @__PURE__ */ e(I, { style: { backgroundColor: t } }) }) : String(t) : "-" : c === "textarea" ? (t, o, r) => {
80
+ return /* @__PURE__ */ a(h, { children: typeof i == "function" ? i(t, o, r) : u });
81
+ } : c === "color" ? (t, o, r) => t ? typeof i == "function" ? i(t, o, r) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ a(w, { title: t, children: /* @__PURE__ */ a(I, { style: { backgroundColor: t } }) }) : String(t) : "-" : c === "textarea" ? (t, o, r) => {
76
82
  if (!t) return "-";
77
- const n = l, a = n.truncated ?? 1;
78
- return typeof i == "function" ? i(t, o, r) : a ? /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(V, { lines: a === !0 ? 1 : a, children: n.rich ? /* @__PURE__ */ e(
83
+ const n = l, e = n.truncated ?? 1;
84
+ return typeof i == "function" ? i(t, o, r) : e ? /* @__PURE__ */ a(h, { children: /* @__PURE__ */ a(V, { lines: e === !0 ? 1 : e, children: n.rich ? /* @__PURE__ */ a(
79
85
  "div",
80
86
  {
81
87
  style: { all: "unset" },
82
88
  dangerouslySetInnerHTML: { __html: t }
83
89
  }
84
- ) : t }) }) : n.rich ? /* @__PURE__ */ e(
90
+ ) : t }) }) : n.rich ? /* @__PURE__ */ a(
85
91
  "div",
86
92
  {
87
93
  style: { all: "unset" },
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./hooks/translation-constants.cjs.js"),I=require("./translations/en.cjs.js"),r=require("i18next"),o=require("react-i18next"),u={en:{[i.TRANSLATION_NAMESPACE]:I}};exports.i18nInstance=r;const S=(n={})=>{const{translations:t=u,language:e="en",i18nInstance:s}=n,a=s||r;return exports.i18nInstance=a,a.isInitialized?Object.entries(t).forEach(([l,T])=>{Object.entries(T).forEach(([N,A])=>{a.addResourceBundle(l,N,A,!0,!0)})}):a.use(o.initReactI18next).init({resources:t,lng:e,fallbackLng:"en",ns:i.TRANSLATION_NAMESPACE,interpolation:{escapeValue:!1}}),r},d=(n,t,e)=>{(e||r).addResourceBundle(n,i.TRANSLATION_NAMESPACE,t,!0,!0)},E=n=>o.useTranslation(i.TRANSLATION_NAMESPACE,{...n,i18n:exports.i18nInstance}),L=n=>o.useTranslation(void 0,{...n,i18n:exports.i18nInstance}),c=(n,t)=>{var e;return(e=exports.i18nInstance)==null?void 0:e.t(n,{ns:i.TRANSLATION_NAMESPACE,...t})},O=(n,t)=>{var s;const e=c(n,t);return e||((s=exports.i18nInstance)==null?void 0:s.t(n,{ns:void 0,...t}))};exports.defaultTranslations=u;exports.setupI18n=S;exports.t=c;exports.tWithOrWithoutNS=O;exports.updateTranslations=d;exports.useTranslationLib=E;exports.useTranslationLibNoNS=L;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./hooks/translation-constants.cjs.js"),I=require("./translations/en.cjs.js"),a=require("i18next"),o=require("react-i18next"),u={en:{[r.TRANSLATION_NAMESPACE]:I}};exports.i18nInstance=a;const S=(n={})=>{const{translations:t=u,language:e="en",i18nInstance:i}=n,s=i||a;return exports.i18nInstance=s,s.isInitialized?Object.entries(t).forEach(([l,T])=>{Object.entries(T).forEach(([N,A])=>{s.addResourceBundle(l,N,A,!0,!0)})}):s.use(o.initReactI18next).init({resources:t,lng:e,fallbackLng:"en",ns:r.TRANSLATION_NAMESPACE,interpolation:{escapeValue:!1}}),a},d=(n,t,e)=>{(e||a).addResourceBundle(n,r.TRANSLATION_NAMESPACE,t,!0,!0)},E=n=>o.useTranslation(r.TRANSLATION_NAMESPACE,{...n,i18n:exports.i18nInstance}),L=n=>o.useTranslation(void 0,{...n,i18n:exports.i18nInstance}),c=(n,t)=>{var e;return(e=exports.i18nInstance)==null?void 0:e.t(n,{ns:r.TRANSLATION_NAMESPACE,...t})},O=(n,t,e)=>{var s;const i=c(n,t);return i||e||((s=exports.i18nInstance)==null?void 0:s.t(n,{ns:void 0,...t}))};exports.defaultTranslations=u;exports.setupI18n=S;exports.t=c;exports.tWithOrWithoutNS=O;exports.updateTranslations=d;exports.useTranslationLib=E;exports.useTranslationLibNoNS=L;
@@ -82,4 +82,4 @@ export declare const updateTranslations: (language: string, translations: Record
82
82
  export declare const useTranslationLib: (options?: Omit<UseTranslationOptions<string>, "i18n">) => import('react-i18next').UseTranslationResponse<"crud-component", string>;
83
83
  export declare const useTranslationLibNoNS: (options?: Omit<UseTranslationOptions<string>, "i18n">) => import('react-i18next').UseTranslationResponse<"translation", string>;
84
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>;
85
- export declare const tWithOrWithoutNS: (key: string, options?: any) => string | import('node_modules/i18next/typescript/helpers').$SpecialObject | import('i18next').TFunctionDetailedResult<string | import('node_modules/i18next/typescript/helpers').$SpecialObject, any>;
85
+ export declare const tWithOrWithoutNS: (key: string, options?: any, fallback?: string) => string | object;
@@ -1,46 +1,46 @@
1
- import { TRANSLATION_NAMESPACE as s } from "./hooks/translation-constants.es.js";
1
+ import { TRANSLATION_NAMESPACE as o } from "./hooks/translation-constants.es.js";
2
2
  import T from "./translations/en.es.js";
3
- import i from "i18next";
4
- import { initReactI18next as m, useTranslation as u } from "react-i18next";
3
+ import u from "i18next";
4
+ import { initReactI18next as m, useTranslation as a } from "react-i18next";
5
5
  const p = {
6
6
  en: {
7
- [s]: T
7
+ [o]: T
8
8
  }
9
9
  };
10
- let e = i;
10
+ let e = u;
11
11
  const E = (t = {}) => {
12
12
  const {
13
13
  translations: n = p,
14
14
  language: r = "en",
15
- i18nInstance: a
16
- } = t, o = a || i;
17
- return e = o, o.isInitialized ? Object.entries(n).forEach(([c, l]) => {
15
+ i18nInstance: s
16
+ } = t, i = s || u;
17
+ return e = i, i.isInitialized ? Object.entries(n).forEach(([c, l]) => {
18
18
  Object.entries(l).forEach(([d, f]) => {
19
- o.addResourceBundle(c, d, f, !0, !0);
19
+ i.addResourceBundle(c, d, f, !0, !0);
20
20
  });
21
- }) : o.use(m).init({
21
+ }) : i.use(m).init({
22
22
  resources: n,
23
23
  lng: r,
24
24
  fallbackLng: "en",
25
- ns: s,
25
+ ns: o,
26
26
  interpolation: {
27
27
  escapeValue: !1
28
28
  }
29
- }), i;
29
+ }), u;
30
30
  }, L = (t, n, r) => {
31
- (r || i).addResourceBundle(
31
+ (r || u).addResourceBundle(
32
32
  t,
33
- s,
33
+ o,
34
34
  n,
35
35
  !0,
36
36
  !0
37
37
  );
38
- }, O = (t) => u(s, { ...t, i18n: e }), R = (t) => u(void 0, { ...t, i18n: e }), N = (t, n) => e == null ? void 0 : e.t(t, {
39
- ns: s,
38
+ }, O = (t) => a(o, { ...t, i18n: e }), R = (t) => a(void 0, { ...t, i18n: e }), N = (t, n) => e == null ? void 0 : e.t(t, {
39
+ ns: o,
40
40
  ...n
41
- }), S = (t, n) => {
42
- const r = N(t, n);
43
- return r || (e == null ? void 0 : e.t(t, {
41
+ }), S = (t, n, r) => {
42
+ const s = N(t, n);
43
+ return s || r || (e == null ? void 0 : e.t(t, {
44
44
  ns: void 0,
45
45
  ...n
46
46
  }));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.4.0",
4
+ "version": "1.4.2",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",