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