tp-react-elements-dev 1.5.3 → 1.5.4
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.
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { FormRenderProps } from "../FormRender";
|
|
2
|
+
declare const FormRenderFileUpload: ({ props }: {
|
|
3
|
+
props: FormRenderProps;
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
2
5
|
export default FormRenderFileUpload;
|
|
@@ -39,6 +39,7 @@ export interface FormSectionPropsItem {
|
|
|
39
39
|
onInputProps?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
40
40
|
fileType?: 'excel' | 'pdf' | 'all' | '';
|
|
41
41
|
handleFileError?: (message: string) => void;
|
|
42
|
+
doNotAllowPaste?: boolean;
|
|
42
43
|
}
|
|
43
44
|
export interface FormRenderProps {
|
|
44
45
|
item: FormSectionPropsItem;
|
package/dist/index.esm.js
CHANGED
|
@@ -52092,6 +52092,12 @@ const PasswordField = ({ props }) => {
|
|
|
52092
52092
|
onInput: (e) => {
|
|
52093
52093
|
props.item.onInputProps && props.item.onInputProps(e);
|
|
52094
52094
|
},
|
|
52095
|
+
onPaste: (e) => {
|
|
52096
|
+
var _a;
|
|
52097
|
+
if ((_a = props.item) === null || _a === void 0 ? void 0 : _a.doNotAllowPaste) {
|
|
52098
|
+
e.preventDefault();
|
|
52099
|
+
}
|
|
52100
|
+
}
|
|
52095
52101
|
}, value: field.value || null, disabled: props.item.disable })), jsxRuntimeExports.jsx(IconButton, Object.assign({ sx: {
|
|
52096
52102
|
position: "absolute",
|
|
52097
52103
|
right: "14px",
|
|
@@ -52231,7 +52237,7 @@ const FormRenderFileUpload = ({ props }) => {
|
|
|
52231
52237
|
? ".pdf,.jpg,.jpeg,.png,.xls,.xlsx,.doc,.docx"
|
|
52232
52238
|
: "",
|
|
52233
52239
|
}, onChange: (event) => {
|
|
52234
|
-
var _a, _b, _c, _d, _e
|
|
52240
|
+
var _a, _b, _c, _d, _e;
|
|
52235
52241
|
const file = event.target.files[0];
|
|
52236
52242
|
const fileName = file ? file.name : null;
|
|
52237
52243
|
const allowedExtensions = {
|
|
@@ -52257,10 +52263,10 @@ const FormRenderFileUpload = ({ props }) => {
|
|
|
52257
52263
|
// Proceed if valid
|
|
52258
52264
|
props.setValue((_d = props.item) === null || _d === void 0 ? void 0 : _d.name, file);
|
|
52259
52265
|
props.setValue(((_e = props.item) === null || _e === void 0 ? void 0 : _e.name) + "Name", fileName);
|
|
52260
|
-
|
|
52261
|
-
|
|
52262
|
-
|
|
52263
|
-
});
|
|
52266
|
+
// props?.item?.onChangeFn({
|
|
52267
|
+
// [props.item.name]: file,
|
|
52268
|
+
// [props.item.name + "Name"]: fileName,
|
|
52269
|
+
// });
|
|
52264
52270
|
// props.setValue(props.item?.name, file);
|
|
52265
52271
|
// props.setValue(props.item?.name + "Name", fileName);
|
|
52266
52272
|
// props?.item?.onChangeInput({
|
|
@@ -52385,6 +52391,11 @@ const RenderForm = (props) => {
|
|
|
52385
52391
|
}
|
|
52386
52392
|
props.item.onInputProps && props.item.onInputProps(e);
|
|
52387
52393
|
},
|
|
52394
|
+
onPaste: (e) => {
|
|
52395
|
+
if (props.item.doNotAllowPaste) {
|
|
52396
|
+
e.preventDefault();
|
|
52397
|
+
}
|
|
52398
|
+
}
|
|
52388
52399
|
} })), ((_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.helperText) && (jsxRuntimeExports.jsxs("span", Object.assign({ style: {
|
|
52389
52400
|
fontFamily: "Roboto-Reg",
|
|
52390
52401
|
fontSize: "11px",
|
|
@@ -52764,7 +52775,7 @@ const RenderForm = (props) => {
|
|
|
52764
52775
|
// textTransform:'uppercase'
|
|
52765
52776
|
maxHeight: "500px !important",
|
|
52766
52777
|
overflow: "auto",
|
|
52767
|
-
} }, props.item.sx), minRows: props.item.minRows || 1, maxRows: props.item.maxRows ||
|
|
52778
|
+
} }, props.item.sx), minRows: props.item.minRows || 1, maxRows: props.item.maxRows || 100, placeholder: props.item.placeholder || "Type Something..." }, field, { label: `${props.item.label}${props.item.required ? " *" : ""}`, value: field.value || "", disabled: props.item.disable, inputProps: {
|
|
52768
52779
|
onInput: (e) => {
|
|
52769
52780
|
var _a;
|
|
52770
52781
|
if (!((_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.allowSpecialChars)) {
|
|
@@ -55170,7 +55181,7 @@ const useFormValidatingContext = (formArray) => {
|
|
|
55170
55181
|
const renderCustomError = (field) => {
|
|
55171
55182
|
if (field.customErrorMessage) {
|
|
55172
55183
|
validationShape[field.name] = validationShape[field.name].test("custom-check", field.customErrorMessage, // Use the actual custom message
|
|
55173
|
-
(value) => field.customErrorMessage && field.customErrorMessage
|
|
55184
|
+
(value) => field.customErrorMessage && field.customErrorMessage // No additional validation logic required
|
|
55174
55185
|
);
|
|
55175
55186
|
}
|
|
55176
55187
|
};
|