tp-react-elements-dev 1.7.0 → 1.7.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.
- package/dist/index.esm.js +34 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +34 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -52348,6 +52348,8 @@ var JoditEditor = /*@__PURE__*/getDefaultExportFromCjs(joditReactExports);
|
|
|
52348
52348
|
|
|
52349
52349
|
const RichTextEditor = ({ props }) => {
|
|
52350
52350
|
const editor = useRef(null);
|
|
52351
|
+
const [content, setContent] = useState("");
|
|
52352
|
+
const value = props.getValues(props.item.name);
|
|
52351
52353
|
const config = Object.assign({ readonly: false, placeholder: "Start typing...", removeButtons: props.item.removeButtons, style: {
|
|
52352
52354
|
'font-family': 'Arial', // Default font is Arial
|
|
52353
52355
|
}, controls: {
|
|
@@ -52357,13 +52359,30 @@ const RichTextEditor = ({ props }) => {
|
|
|
52357
52359
|
'Rotis Semi Sans': 'Rotis Semi Sans', // Allow Rotis Semi Sans
|
|
52358
52360
|
},
|
|
52359
52361
|
},
|
|
52360
|
-
|
|
52362
|
+
fontsize: {
|
|
52363
|
+
list: joditReactExports.Jodit.atom([8, 9, 10, 11])
|
|
52364
|
+
}
|
|
52365
|
+
}, defaultFont: 'Arial', defaultFontSize: '11px' }, props.item.sx);
|
|
52361
52366
|
// [placeholder]
|
|
52362
52367
|
// );
|
|
52363
52368
|
const handleBlur = (newContent) => {
|
|
52364
|
-
|
|
52369
|
+
if (newContent === "<p><br></p>") {
|
|
52370
|
+
setContent(newContent);
|
|
52371
|
+
props.setValue(props.item.name, '');
|
|
52372
|
+
}
|
|
52373
|
+
else {
|
|
52374
|
+
setContent(newContent);
|
|
52375
|
+
props.setValue(props.item.name, newContent);
|
|
52376
|
+
}
|
|
52377
|
+
props.item.onBlurFn && props.item.onBlurFn(newContent);
|
|
52378
|
+
};
|
|
52379
|
+
useEffect(() => {
|
|
52380
|
+
setContent(value);
|
|
52381
|
+
}, [value]);
|
|
52382
|
+
const handleChange = (newContent) => {
|
|
52383
|
+
console.log(newContent, 'newContent Editor');
|
|
52365
52384
|
};
|
|
52366
|
-
return (jsxRuntimeExports.jsx(JoditEditor, { ref: editor, value:
|
|
52385
|
+
return (jsxRuntimeExports.jsx(JoditEditor, { ref: editor, value: content, config: config, tabIndex: 1, onBlur: handleBlur, onChange: handleChange }));
|
|
52367
52386
|
};
|
|
52368
52387
|
|
|
52369
52388
|
const renderLabel = (label, isRequired, alignRight) => {
|
|
@@ -55222,7 +55241,7 @@ create$3.prototype = ObjectSchema.prototype;
|
|
|
55222
55241
|
const useFormValidatingContext = (formArray) => {
|
|
55223
55242
|
const initialValues = {};
|
|
55224
55243
|
const validationShape = {};
|
|
55225
|
-
console.log(formArray,
|
|
55244
|
+
console.log(formArray, "formArrayformArray");
|
|
55226
55245
|
const renderCustomError = (field) => {
|
|
55227
55246
|
if (field.customErrorMessage) {
|
|
55228
55247
|
validationShape[field.name] = validationShape[field.name].test("custom-check", field.customErrorMessage, // Use the actual custom message
|
|
@@ -55294,22 +55313,25 @@ const useFormValidatingContext = (formArray) => {
|
|
|
55294
55313
|
.test("valid-email", `Please enter valid Email`, (value) => {
|
|
55295
55314
|
if (!value)
|
|
55296
55315
|
return false;
|
|
55297
|
-
const emails = value.split(
|
|
55316
|
+
const emails = value.split(";");
|
|
55298
55317
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
55299
|
-
return emails.every(email => emailRegex.test(email.trim()));
|
|
55318
|
+
return emails.every((email) => emailRegex.test(email.trim()));
|
|
55300
55319
|
});
|
|
55301
55320
|
renderCustomError(field);
|
|
55302
55321
|
}
|
|
55303
55322
|
else {
|
|
55304
55323
|
validationShape[field.name] = create$6()
|
|
55305
55324
|
.typeError(`Please enter ${field.label}`)
|
|
55306
|
-
.test("
|
|
55325
|
+
.test("custom", `Please enter valid Email`, (value) => {
|
|
55307
55326
|
// Custom validation to check for at least one period after '@'
|
|
55308
|
-
if (!value)
|
|
55309
|
-
return
|
|
55310
|
-
|
|
55311
|
-
|
|
55312
|
-
|
|
55327
|
+
if (!value || value === "") {
|
|
55328
|
+
return true;
|
|
55329
|
+
}
|
|
55330
|
+
else {
|
|
55331
|
+
const emails = value.split(";");
|
|
55332
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
55333
|
+
return emails.every((email) => emailRegex.test(email.trim()));
|
|
55334
|
+
}
|
|
55313
55335
|
});
|
|
55314
55336
|
renderCustomError(field);
|
|
55315
55337
|
}
|