@kingteza/crud-component 1.0.47 → 1.0.49

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";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime");;/* empty css */;/* empty css */const u=require("antd"),o=require("react"),q=require("../../util/ValidationUtil.cjs.js"),x=require("../../_virtual/index.cjs.js"),g=({name:t,label:c,required:a,rules:n=[],disabled:h})=>{const r=u.Form.useFormInstance(),[d,s]=o.useState(""),p={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],["link"],["clean"]]},b=["bold","italic","underline","strike","blockquote","list","bullet","link"];o.useEffect(()=>{const e=r.getFieldValue(t);e&&e!=="<p></p>"&&e!=="<p><br></p>"&&s(e)},[r,t]);const i=u.Form.useWatch(t,r);o.useEffect(()=>{i!==d&&s(!i||i==="<p></p>"||i==="<p><br></p>"?"":i)},[i,d]);const f=e=>{s(e);const m=!e||e==="<p></p>"||e.trim()==="<p><br></p>"?void 0:e;r.setFieldValue(t,m),r.validateFields([t]).catch(()=>{})},k=o.useMemo(()=>a?[...n,...q.required(c??"")]:n,[a,n,c]);return l.jsx(u.Form.Item,{name:t,label:c,rules:k,children:l.jsx(o.Suspense,{fallback:l.jsx("div",{children:"Loading editor..."}),children:l.jsx(x,{readOnly:h,value:d,onChange:f,theme:"snow",className:"bg-white dark:!bg-[#141414] dark:text-white dark:!fill-white",modules:p,formats:b})})})};exports.RichTextEditor=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime");;/* empty css */;/* empty css */const a=require("antd"),s=require("react"),x=require("../../util/ValidationUtil.cjs.js"),q=s.lazy(async()=>{const{default:t}=await Promise.resolve().then(()=>require("../../_virtual/index.cjs.js")).then(i=>i.index);return{default:i=>l.jsx(t,{...i})}}),g=({name:t,label:i,required:u,rules:c=[],disabled:h})=>{const o=a.Form.useFormInstance(),[d,n]=s.useState(""),f={toolbar:[["bold","italic","underline","strike","blockquote"],[{list:"ordered"},{list:"bullet"}],["link"],["clean"]]},p=["bold","italic","underline","strike","blockquote","list","bullet","link"];s.useEffect(()=>{const e=o.getFieldValue(t);e&&e!=="<p></p>"&&e!=="<p><br></p>"&&n(e)},[o,t]);const r=a.Form.useWatch(t,o);s.useEffect(()=>{r!==d&&n(!r||r==="<p></p>"||r==="<p><br></p>"?"":r)},[r,d]);const b=e=>{n(e);const m=!e||e==="<p></p>"||e.trim()==="<p><br></p>"?void 0:e;o.setFieldValue(t,m),o.validateFields([t]).catch(()=>{})},k=s.useMemo(()=>u?[...c,...x.required(i??"")]:c,[u,c,i]);return l.jsx(a.Form.Item,{name:t,label:i,rules:k,children:l.jsx(s.Suspense,{fallback:l.jsx("div",{children:"Loading editor..."}),children:l.jsx(q,{readOnly:h,value:d,onChange:b,theme:"snow",className:"bg-white dark:!bg-[#141414] dark:text-white dark:!fill-white",modules:f,formats:p})})})};exports.RichTextEditor=g;
@@ -1,18 +1,20 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
2
  /* empty css */
3
3
  /* empty css */
4
- import { Form as n } from "antd";
5
- import { useState as V, useEffect as p, useMemo as g, Suspense as w } from "react";
6
- import F from "../../util/ValidationUtil.es.js";
7
- import x from "../../_virtual/index.es.js";
8
- const y = ({
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 () => {
8
+ const { default: e } = await import("../../_virtual/index.es.js").then((i) => i.i);
9
+ return { default: (i) => /* @__PURE__ */ l(e, { ...i }) };
10
+ }), S = ({
9
11
  name: e,
10
- label: s,
11
- required: a,
12
+ label: i,
13
+ required: d,
12
14
  rules: c = [],
13
- disabled: u
15
+ disabled: p
14
16
  }) => {
15
- const o = n.useFormInstance(), [d, r] = V(""), m = {
17
+ const r = a.useFormInstance(), [n, s] = g(""), m = {
16
18
  toolbar: [
17
19
  ["bold", "italic", "underline", "strike", "blockquote"],
18
20
  [{ list: "ordered" }, { list: "bullet" }],
@@ -29,28 +31,28 @@ const y = ({
29
31
  "bullet",
30
32
  "link"
31
33
  ];
32
- p(() => {
33
- const t = o.getFieldValue(e);
34
- t && t !== "<p></p>" && t !== "<p><br></p>" && r(t);
35
- }, [o, e]);
36
- const i = n.useWatch(e, o);
37
- p(() => {
38
- i !== d && r(!i || i === "<p></p>" || i === "<p><br></p>" ? "" : i);
39
- }, [i, d]);
34
+ u(() => {
35
+ const t = r.getFieldValue(e);
36
+ t && t !== "<p></p>" && t !== "<p><br></p>" && s(t);
37
+ }, [r, e]);
38
+ const o = a.useWatch(e, r);
39
+ u(() => {
40
+ o !== n && s(!o || o === "<p></p>" || o === "<p><br></p>" ? "" : o);
41
+ }, [o, n]);
40
42
  const h = (t) => {
41
- r(t);
43
+ s(t);
42
44
  const k = !t || t === "<p></p>" || t.trim() === "<p><br></p>" ? void 0 : t;
43
- o.setFieldValue(e, k), o.validateFields([e]).catch(() => {
45
+ r.setFieldValue(e, k), r.validateFields([e]).catch(() => {
44
46
  });
45
- }, b = g(
46
- () => a ? [...c, ...F.required(s ?? "")] : c,
47
- [a, c, s]
47
+ }, b = w(
48
+ () => d ? [...c, ...x.required(i ?? "")] : c,
49
+ [d, c, i]
48
50
  );
49
- return /* @__PURE__ */ l(n.Item, { name: e, label: s, rules: b, children: /* @__PURE__ */ l(w, { fallback: /* @__PURE__ */ l("div", { children: "Loading editor..." }), children: /* @__PURE__ */ l(
50
- x,
51
+ return /* @__PURE__ */ l(a.Item, { name: e, label: i, rules: b, children: /* @__PURE__ */ l(F, { fallback: /* @__PURE__ */ l("div", { children: "Loading editor..." }), children: /* @__PURE__ */ l(
52
+ R,
51
53
  {
52
- readOnly: u,
53
- value: d,
54
+ readOnly: p,
55
+ value: n,
54
56
  onChange: h,
55
57
  theme: "snow",
56
58
  className: "bg-white dark:!bg-[#141414] dark:text-white dark:!fill-white",
@@ -60,5 +62,5 @@ const y = ({
60
62
  ) }) });
61
63
  };
62
64
  export {
63
- y as RichTextEditor
65
+ S as RichTextEditor
64
66
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.0.47",
4
+ "version": "1.0.49",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",