tp-react-elements-dev 1.4.16 → 1.5.0
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/components/Form/FormRender.d.ts +4 -1
- package/dist/index.esm.js +87 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +87 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -46971,6 +46971,7 @@ const extractValuesToArray = (inputString) => {
|
|
|
46971
46971
|
};
|
|
46972
46972
|
function MultiSelectV1({ props }) {
|
|
46973
46973
|
var _a;
|
|
46974
|
+
console.log(props, 'ksjh');
|
|
46974
46975
|
const [personName, setPersonName] = React__namespace.useState(props.getValues(props.item.name)
|
|
46975
46976
|
? extractValuesToArray(props.getValues(props.item.name))
|
|
46976
46977
|
: []);
|
|
@@ -52106,6 +52107,11 @@ const PasswordField = ({ props }) => {
|
|
|
52106
52107
|
"& .css-kichxs-MuiFormLabel-root-MuiInputLabel-root,.css-1holvmy": {
|
|
52107
52108
|
top: "-8px",
|
|
52108
52109
|
},
|
|
52110
|
+
}, inputProps: {
|
|
52111
|
+
maxLength: props.item.maxLength || 100,
|
|
52112
|
+
onInput: (e) => {
|
|
52113
|
+
props.item.onInputProps && props.item.onInputProps(e);
|
|
52114
|
+
},
|
|
52109
52115
|
}, value: field.value || null, disabled: props.item.disable })), jsxRuntimeExports.jsx(IconButton, Object.assign({ sx: {
|
|
52110
52116
|
position: "absolute",
|
|
52111
52117
|
right: "14px",
|
|
@@ -52294,8 +52300,8 @@ const renderLabel = (label, isRequired, alignRight) => {
|
|
|
52294
52300
|
};
|
|
52295
52301
|
function formatDateMonthAndYear(date) {
|
|
52296
52302
|
// Check if date is a string
|
|
52297
|
-
if (typeof date !==
|
|
52298
|
-
throw new TypeError(
|
|
52303
|
+
if (typeof date !== "string") {
|
|
52304
|
+
throw new TypeError("Expected a string");
|
|
52299
52305
|
}
|
|
52300
52306
|
// Split the date string into month and year
|
|
52301
52307
|
const [month, year] = date.split("/");
|
|
@@ -52306,6 +52312,7 @@ function formatDateMonthAndYear(date) {
|
|
|
52306
52312
|
}
|
|
52307
52313
|
const RenderForm = (props) => {
|
|
52308
52314
|
var _a, _b;
|
|
52315
|
+
console.log(props, "propsprops", props.item.inputType);
|
|
52309
52316
|
switch ((_a = props.item) === null || _a === void 0 ? void 0 : _a.inputType) {
|
|
52310
52317
|
case "text":
|
|
52311
52318
|
case "email":
|
|
@@ -52313,7 +52320,7 @@ const RenderForm = (props) => {
|
|
|
52313
52320
|
var _a, _b;
|
|
52314
52321
|
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(TextField, Object.assign({}, field, { fullWidth: true,
|
|
52315
52322
|
// error={props.errors}
|
|
52316
|
-
label: `${props.item.label}${props.item.required ?
|
|
52323
|
+
label: `${props.item.label}${props.item.required ? " *" : ""}`, placeholder: props.item.placeholder || "", InputProps: {
|
|
52317
52324
|
style: {
|
|
52318
52325
|
fontFamily: "Roboto-Reg",
|
|
52319
52326
|
border: "none",
|
|
@@ -52340,8 +52347,12 @@ const RenderForm = (props) => {
|
|
|
52340
52347
|
}, inputProps: {
|
|
52341
52348
|
maxLength: props.item.maxLength || 100,
|
|
52342
52349
|
onInput: (e) => {
|
|
52343
|
-
var _a;
|
|
52344
|
-
if (
|
|
52350
|
+
var _a, _b;
|
|
52351
|
+
if ((_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.donotAllowSpace) {
|
|
52352
|
+
const value = e.target.value;
|
|
52353
|
+
e.target.value = value.replace(" ", "");
|
|
52354
|
+
}
|
|
52355
|
+
if (!((_b = props === null || props === void 0 ? void 0 : props.item) === null || _b === void 0 ? void 0 : _b.allowSpecialChars)) {
|
|
52345
52356
|
const value = e.target.value;
|
|
52346
52357
|
e.target.value = value.replace(/[^a-zA-Z0-9 ]/g, "");
|
|
52347
52358
|
} // Allow only alphanumeric and space
|
|
@@ -52349,6 +52360,7 @@ const RenderForm = (props) => {
|
|
|
52349
52360
|
e.target.value === " ") {
|
|
52350
52361
|
e.target.value = "";
|
|
52351
52362
|
}
|
|
52363
|
+
props.item.onInputProps && props.item.onInputProps(e);
|
|
52352
52364
|
},
|
|
52353
52365
|
} })), ((_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.helperText) && (jsxRuntimeExports.jsxs("span", Object.assign({ style: {
|
|
52354
52366
|
fontFamily: "Roboto-Reg",
|
|
@@ -52362,7 +52374,7 @@ const RenderForm = (props) => {
|
|
|
52362
52374
|
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(TextField, Object.assign({}, field, { fullWidth: true, onBlur: (e) => {
|
|
52363
52375
|
var _a, _b;
|
|
52364
52376
|
((_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.onBlurFn) && ((_b = props === null || props === void 0 ? void 0 : props.item) === null || _b === void 0 ? void 0 : _b.onBlurFn(e));
|
|
52365
|
-
}, label: `${props.item.label}${props.item.required ?
|
|
52377
|
+
}, label: `${props.item.label}${props.item.required ? " *" : ""}`, InputProps: {
|
|
52366
52378
|
style: {
|
|
52367
52379
|
fontFamily: "Roboto-Reg",
|
|
52368
52380
|
border: "none",
|
|
@@ -52371,6 +52383,7 @@ const RenderForm = (props) => {
|
|
|
52371
52383
|
e.target.value = e.target.value
|
|
52372
52384
|
.replace(/\s/g, "")
|
|
52373
52385
|
.replace(/[^a-zA-Z0-9!@#$%^&*()_+{}\[\]:;<>,.?/~`|\\-]/g, "");
|
|
52386
|
+
props.item.onInputProps && props.item.onInputProps(e);
|
|
52374
52387
|
}, sx: Object.assign({ fontFamily: "Roboto-Reg", "& .css-1holvmy,.css-lqj8pz-MuiFormLabel-root-MuiInputLabel-root, .css-kichxs-MuiFormLabel-root-MuiInputLabel-root": {
|
|
52375
52388
|
top: "-10px",
|
|
52376
52389
|
// fontSize:'14px !important'
|
|
@@ -52409,7 +52422,7 @@ const RenderForm = (props) => {
|
|
|
52409
52422
|
case "pincode":
|
|
52410
52423
|
case "phoneNumber":
|
|
52411
52424
|
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(Controller, { control: props.control, name: props.item.name, render: ({ field }) => {
|
|
52412
|
-
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(TextField, Object.assign({}, field, { size: "small", label: `${props.item.label}${props.item.required ?
|
|
52425
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(TextField, Object.assign({}, field, { size: "small", label: `${props.item.label}${props.item.required ? " *" : ""}`, value: props.getValues(props.item.name) || "", defaultValue: props.getValues(props.item.name) || null, onInput: (e) => {
|
|
52413
52426
|
var _a, _b;
|
|
52414
52427
|
e.target.value = e.target.value.replace(/[^0-9]/g, "");
|
|
52415
52428
|
if (e.target.value === "") {
|
|
@@ -52428,10 +52441,26 @@ const RenderForm = (props) => {
|
|
|
52428
52441
|
}, inputProps: {
|
|
52429
52442
|
pattern: "[0-9]*",
|
|
52430
52443
|
maxLength: props.item.maxLength || 20,
|
|
52444
|
+
onInput: (e) => {
|
|
52445
|
+
var _a, _b;
|
|
52446
|
+
if ((_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.donotAllowSpace) {
|
|
52447
|
+
const value = e.target.value;
|
|
52448
|
+
e.target.value = value.replace(" ", "");
|
|
52449
|
+
}
|
|
52450
|
+
if (!((_b = props === null || props === void 0 ? void 0 : props.item) === null || _b === void 0 ? void 0 : _b.allowSpecialChars)) {
|
|
52451
|
+
const value = e.target.value;
|
|
52452
|
+
e.target.value = value.replace(/[^a-zA-Z0-9 ]/g, "");
|
|
52453
|
+
} // Allow only alphanumeric and space
|
|
52454
|
+
if (e.target.value.length === 1 &&
|
|
52455
|
+
e.target.value === " ") {
|
|
52456
|
+
e.target.value = "";
|
|
52457
|
+
}
|
|
52458
|
+
props.item.onInputProps && props.item.onInputProps(e);
|
|
52459
|
+
},
|
|
52431
52460
|
}, disabled: props.item.disable })), jsxRuntimeExports.jsx(ErrorMessageComponent, { children: jsxRuntimeExports.jsx(s, { errors: props.errors, name: props.item.name }) })] }));
|
|
52432
52461
|
} }) }));
|
|
52433
52462
|
case "decimal":
|
|
52434
|
-
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(Controller, { name: props.item.name, control: props.control, disabled: (_b = props.item) === null || _b === void 0 ? void 0 : _b.disable, render: ({ field }) => (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(TextField, Object.assign({ type: "text", size: "small", label: `${props.item.label}${props.item.required ?
|
|
52463
|
+
return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(Controller, { name: props.item.name, control: props.control, disabled: (_b = props.item) === null || _b === void 0 ? void 0 : _b.disable, render: ({ field }) => (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(TextField, Object.assign({ type: "text", size: "small", label: `${props.item.label}${props.item.required ? " *" : ""}` }, field, { onChange: (e) => (props === null || props === void 0 ? void 0 : props.clearErrors) && (props === null || props === void 0 ? void 0 : props.clearErrors(props.item.name)), sx: {
|
|
52435
52464
|
"& input": {
|
|
52436
52465
|
textAlign: "right",
|
|
52437
52466
|
},
|
|
@@ -52666,7 +52695,7 @@ const RenderForm = (props) => {
|
|
|
52666
52695
|
"& .css-1holvmy, .css-kichxs-MuiFormLabel-root-MuiInputLabel-root": {
|
|
52667
52696
|
top: "-10px",
|
|
52668
52697
|
},
|
|
52669
|
-
}, label: `${props.item.label}${props.item.required ?
|
|
52698
|
+
}, label: `${props.item.label}${props.item.required ? " *" : ""}`, views: ["year"], value: field.value ? dayjs(field.value) : null, onChange: (date) => field.onChange(date),
|
|
52670
52699
|
// minDate={}
|
|
52671
52700
|
slots: {
|
|
52672
52701
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -52695,6 +52724,7 @@ const RenderForm = (props) => {
|
|
|
52695
52724
|
},
|
|
52696
52725
|
"& input": {
|
|
52697
52726
|
fontSize: "11px",
|
|
52727
|
+
// textTransform:'uppercase'
|
|
52698
52728
|
},
|
|
52699
52729
|
"& .css-2rul56-MuiFormLabel-root-MuiInputLabel-root": {
|
|
52700
52730
|
top: "-10px",
|
|
@@ -52715,9 +52745,13 @@ const RenderForm = (props) => {
|
|
|
52715
52745
|
padding: "5px 5px",
|
|
52716
52746
|
fontSize: "11px",
|
|
52717
52747
|
},
|
|
52748
|
+
"& textarea": {
|
|
52749
|
+
fontSize: "11px",
|
|
52750
|
+
// textTransform:'uppercase'
|
|
52751
|
+
},
|
|
52718
52752
|
}, minRows: props.item.minRows || 1,
|
|
52719
52753
|
// maxRows={2}
|
|
52720
|
-
placeholder: props.item.placeholder || "Type Something..." }, field, { label: `${props.item.label}${props.item.required ?
|
|
52754
|
+
placeholder: props.item.placeholder || "Type Something..." }, field, { label: `${props.item.label}${props.item.required ? " *" : ""}`, value: field.value || "", disabled: props.item.disable, inputProps: {
|
|
52721
52755
|
onInput: (e) => {
|
|
52722
52756
|
var _a;
|
|
52723
52757
|
if (!((_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.allowSpecialChars)) {
|
|
@@ -55214,9 +55248,42 @@ const useFormValidatingContext = (formArray) => {
|
|
|
55214
55248
|
}
|
|
55215
55249
|
renderCustomError(field);
|
|
55216
55250
|
break;
|
|
55251
|
+
// case "phoneNumber":
|
|
55252
|
+
// initialValues[field.name] = null;
|
|
55253
|
+
// if (field.required && field.errorMessage) {
|
|
55254
|
+
// validationShape[field.name] = Yup.number()
|
|
55255
|
+
// .nullable()
|
|
55256
|
+
// .typeError(`Please enter Mobile Number`)
|
|
55257
|
+
// .required(field.errorMessage)
|
|
55258
|
+
// .test(
|
|
55259
|
+
// "is-two-digits",
|
|
55260
|
+
// `Please enter a 10-digit Mobile Number`,
|
|
55261
|
+
// (value) => {
|
|
55262
|
+
// if (value) {
|
|
55263
|
+
// const stringValue = value.toString();
|
|
55264
|
+
// return stringValue.length === 2;
|
|
55265
|
+
// }
|
|
55266
|
+
// return false;
|
|
55267
|
+
// }
|
|
55268
|
+
// );
|
|
55269
|
+
// renderCustomError(field)
|
|
55270
|
+
// } else {
|
|
55271
|
+
// validationShape[field.name] = Yup.number()
|
|
55272
|
+
// .nullable()
|
|
55273
|
+
// // .typeError(`Please enter Mobile Number`)
|
|
55274
|
+
// .test(
|
|
55275
|
+
// "is-two-digits",
|
|
55276
|
+
// `Please enter a 10-digit Mobile Number`,
|
|
55277
|
+
// (value: any) => {
|
|
55278
|
+
// return !value || value?.toString().length === 2;
|
|
55279
|
+
// }
|
|
55280
|
+
// );
|
|
55281
|
+
// renderCustomError(field)
|
|
55282
|
+
// }
|
|
55283
|
+
// break;
|
|
55217
55284
|
case "phoneNumber":
|
|
55218
55285
|
initialValues[field.name] = null;
|
|
55219
|
-
if (field.required
|
|
55286
|
+
if (field.required) {
|
|
55220
55287
|
validationShape[field.name] = create$5()
|
|
55221
55288
|
.nullable()
|
|
55222
55289
|
.typeError(`Please enter Mobile Number`)
|
|
@@ -55224,18 +55291,23 @@ const useFormValidatingContext = (formArray) => {
|
|
|
55224
55291
|
.test("is-two-digits", `Please enter a 10-digit Mobile Number`, (value) => {
|
|
55225
55292
|
if (value) {
|
|
55226
55293
|
const stringValue = value.toString();
|
|
55227
|
-
return stringValue.length ===
|
|
55294
|
+
return stringValue.length === 10;
|
|
55228
55295
|
}
|
|
55229
55296
|
return false;
|
|
55230
55297
|
});
|
|
55231
55298
|
renderCustomError(field);
|
|
55232
55299
|
}
|
|
55233
55300
|
else {
|
|
55234
|
-
validationShape[field.name] = create$
|
|
55301
|
+
validationShape[field.name] = create$6()
|
|
55235
55302
|
.nullable()
|
|
55236
|
-
|
|
55303
|
+
.typeError(``)
|
|
55237
55304
|
.test("is-two-digits", `Please enter a 10-digit Mobile Number`, (value) => {
|
|
55238
|
-
|
|
55305
|
+
if (value) {
|
|
55306
|
+
// Custom validation to check for at least one period after '@'
|
|
55307
|
+
const stringValue = value.toString();
|
|
55308
|
+
return stringValue.length === 10;
|
|
55309
|
+
}
|
|
55310
|
+
return true; // Skip validation if no value is present
|
|
55239
55311
|
});
|
|
55240
55312
|
renderCustomError(field);
|
|
55241
55313
|
}
|