@kingteza/crud-component 1.0.49 → 1.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/common/rich/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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;
|
package/common/rich/index.es.js
CHANGED
|
@@ -5,11 +5,11 @@ import { Form as a } from "antd";
|
|
|
5
5
|
import V, { useState as g, useEffect as u, useMemo as w, Suspense as F } from "react";
|
|
6
6
|
import x from "../../util/ValidationUtil.es.js";
|
|
7
7
|
const R = V.lazy(async () => {
|
|
8
|
-
const { default: e } = await import("
|
|
9
|
-
return { default: (
|
|
8
|
+
const { default: e } = await import("react-quill");
|
|
9
|
+
return { default: (o) => /* @__PURE__ */ l(e, { ...o }) };
|
|
10
10
|
}), S = ({
|
|
11
11
|
name: e,
|
|
12
|
-
label:
|
|
12
|
+
label: o,
|
|
13
13
|
required: d,
|
|
14
14
|
rules: c = [],
|
|
15
15
|
disabled: p
|
|
@@ -35,20 +35,20 @@ const R = V.lazy(async () => {
|
|
|
35
35
|
const t = r.getFieldValue(e);
|
|
36
36
|
t && t !== "<p></p>" && t !== "<p><br></p>" && s(t);
|
|
37
37
|
}, [r, e]);
|
|
38
|
-
const
|
|
38
|
+
const i = a.useWatch(e, r);
|
|
39
39
|
u(() => {
|
|
40
|
-
|
|
41
|
-
}, [
|
|
40
|
+
i !== n && s(!i || i === "<p></p>" || i === "<p><br></p>" ? "" : i);
|
|
41
|
+
}, [i, n]);
|
|
42
42
|
const h = (t) => {
|
|
43
43
|
s(t);
|
|
44
44
|
const k = !t || t === "<p></p>" || t.trim() === "<p><br></p>" ? void 0 : t;
|
|
45
45
|
r.setFieldValue(e, k), r.validateFields([e]).catch(() => {
|
|
46
46
|
});
|
|
47
47
|
}, b = w(
|
|
48
|
-
() => d ? [...c, ...x.required(
|
|
49
|
-
[d, c,
|
|
48
|
+
() => d ? [...c, ...x.required(o ?? "")] : c,
|
|
49
|
+
[d, c, o]
|
|
50
50
|
);
|
|
51
|
-
return /* @__PURE__ */ l(a.Item, { name: e, label:
|
|
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
52
|
R,
|
|
53
53
|
{
|
|
54
54
|
readOnly: p,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kingteza/crud-component",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.51",
|
|
5
5
|
"description": "React CRUD component library with Ant Design",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"react",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"/common/",
|
|
27
27
|
"/types/",
|
|
28
28
|
"/util/",
|
|
29
|
+
"/_virtual/",
|
|
29
30
|
"/locale/",
|
|
30
31
|
"/README.md"
|
|
31
32
|
],
|