tp-react-elements-dev 1.7.0 → 1.7.1
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 +30 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +30 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -52368,6 +52368,7 @@ var JoditEditor = /*@__PURE__*/getDefaultExportFromCjs(joditReactExports);
|
|
|
52368
52368
|
|
|
52369
52369
|
const RichTextEditor = ({ props }) => {
|
|
52370
52370
|
const editor = React$1.useRef(null);
|
|
52371
|
+
const [content, setContent] = React$1.useState("");
|
|
52371
52372
|
const config = Object.assign({ readonly: false, placeholder: "Start typing...", removeButtons: props.item.removeButtons, style: {
|
|
52372
52373
|
'font-family': 'Arial', // Default font is Arial
|
|
52373
52374
|
}, controls: {
|
|
@@ -52377,13 +52378,27 @@ const RichTextEditor = ({ props }) => {
|
|
|
52377
52378
|
'Rotis Semi Sans': 'Rotis Semi Sans', // Allow Rotis Semi Sans
|
|
52378
52379
|
},
|
|
52379
52380
|
},
|
|
52380
|
-
|
|
52381
|
+
fontsize: {
|
|
52382
|
+
list: joditReactExports.Jodit.atom([8, 9, 10, 11])
|
|
52383
|
+
}
|
|
52384
|
+
}, defaultFont: 'Arial', defaultFontSize: '11px' }, props.item.sx);
|
|
52381
52385
|
// [placeholder]
|
|
52382
52386
|
// );
|
|
52383
52387
|
const handleBlur = (newContent) => {
|
|
52384
|
-
|
|
52388
|
+
if (newContent === "<p><br></p>") {
|
|
52389
|
+
setContent(newContent);
|
|
52390
|
+
props.setValue(props.item.name, '');
|
|
52391
|
+
}
|
|
52392
|
+
else {
|
|
52393
|
+
setContent(newContent);
|
|
52394
|
+
props.setValue(props.item.name, newContent);
|
|
52395
|
+
}
|
|
52396
|
+
props.item.onBlurFn && props.item.onBlurFn(newContent);
|
|
52397
|
+
};
|
|
52398
|
+
const handleChange = (newContent) => {
|
|
52399
|
+
console.log(newContent, 'newContent Editor');
|
|
52385
52400
|
};
|
|
52386
|
-
return (jsxRuntimeExports.jsx(JoditEditor, { ref: editor, value:
|
|
52401
|
+
return (jsxRuntimeExports.jsx(JoditEditor, { ref: editor, value: content, config: config, tabIndex: 1, onBlur: handleBlur, onChange: handleChange }));
|
|
52387
52402
|
};
|
|
52388
52403
|
|
|
52389
52404
|
const renderLabel = (label, isRequired, alignRight) => {
|
|
@@ -55242,7 +55257,7 @@ create$3.prototype = ObjectSchema.prototype;
|
|
|
55242
55257
|
const useFormValidatingContext = (formArray) => {
|
|
55243
55258
|
const initialValues = {};
|
|
55244
55259
|
const validationShape = {};
|
|
55245
|
-
console.log(formArray,
|
|
55260
|
+
console.log(formArray, "formArrayformArray");
|
|
55246
55261
|
const renderCustomError = (field) => {
|
|
55247
55262
|
if (field.customErrorMessage) {
|
|
55248
55263
|
validationShape[field.name] = validationShape[field.name].test("custom-check", field.customErrorMessage, // Use the actual custom message
|
|
@@ -55314,22 +55329,25 @@ const useFormValidatingContext = (formArray) => {
|
|
|
55314
55329
|
.test("valid-email", `Please enter valid Email`, (value) => {
|
|
55315
55330
|
if (!value)
|
|
55316
55331
|
return false;
|
|
55317
|
-
const emails = value.split(
|
|
55332
|
+
const emails = value.split(";");
|
|
55318
55333
|
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
55319
|
-
return emails.every(email => emailRegex.test(email.trim()));
|
|
55334
|
+
return emails.every((email) => emailRegex.test(email.trim()));
|
|
55320
55335
|
});
|
|
55321
55336
|
renderCustomError(field);
|
|
55322
55337
|
}
|
|
55323
55338
|
else {
|
|
55324
55339
|
validationShape[field.name] = create$6()
|
|
55325
55340
|
.typeError(`Please enter ${field.label}`)
|
|
55326
|
-
.test("
|
|
55341
|
+
.test("custom", `Please enter valid Email`, (value) => {
|
|
55327
55342
|
// Custom validation to check for at least one period after '@'
|
|
55328
|
-
if (!value)
|
|
55329
|
-
return
|
|
55330
|
-
|
|
55331
|
-
|
|
55332
|
-
|
|
55343
|
+
if (!value || value === "") {
|
|
55344
|
+
return true;
|
|
55345
|
+
}
|
|
55346
|
+
else {
|
|
55347
|
+
const emails = value.split(";");
|
|
55348
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
55349
|
+
return emails.every((email) => emailRegex.test(email.trim()));
|
|
55350
|
+
}
|
|
55333
55351
|
});
|
|
55334
55352
|
renderCustomError(field);
|
|
55335
55353
|
}
|