tp-react-elements-dev 1.8.0 → 1.8.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.js
CHANGED
|
@@ -53864,7 +53864,7 @@ const SingleSelect = ({ props, variant }) => {
|
|
|
53864
53864
|
},
|
|
53865
53865
|
},
|
|
53866
53866
|
}, getOptionLabel: (option) => option.label, renderInput: (params) => {
|
|
53867
|
-
return (jsxRuntimeExports.jsx(Tooltip, Object.assign({ title: params.inputProps.value && params.inputProps.value }, { children: jsxRuntimeExports.jsx(TextField, Object.assign({}, params, { placeholder: props.item.
|
|
53867
|
+
return (jsxRuntimeExports.jsx(Tooltip, Object.assign({ title: params.inputProps.value && params.inputProps.value }, { children: jsxRuntimeExports.jsx(TextField, Object.assign({}, params, { placeholder: props.item.placeholder, label: variant !== "standard" ? `${props.item.label}${props.item.required ? " *" : ""}` : '' })) })));
|
|
53868
53868
|
}, isOptionEqualToValue: isOptionEqualToValue })), jsxRuntimeExports.jsx(ErrorMessageComponent, { children: jsxRuntimeExports.jsx(s, { errors: props.errors, name: props.item.name }) })] }));
|
|
53869
53869
|
} }, props.item.name));
|
|
53870
53870
|
};
|
|
@@ -53985,9 +53985,9 @@ const DatepickerWrapperV2 = ({ props, variant }) => {
|
|
|
53985
53985
|
};
|
|
53986
53986
|
return (jsxRuntimeExports.jsx(Controller, { control: props.control, name: props.item.name, render: ({ field }) => {
|
|
53987
53987
|
var _a, _b, _c, _d, _e, _f;
|
|
53988
|
-
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs(LocalizationProvider, Object.assign({ dateAdapter: AdapterDayjs }, { children: [renderLabel(variant, props), jsxRuntimeExports.jsx(DatePicker, { label: `${props.item.label}${props.item.required ? ' *' : ''}
|
|
53988
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs(LocalizationProvider, Object.assign({ dateAdapter: AdapterDayjs }, { children: [renderLabel(variant, props), jsxRuntimeExports.jsx(DatePicker, { label: variant !== "standard" ? `${props.item.label}${props.item.required ? ' *' : ''}` : '', value: typeof field.value === "string"
|
|
53989
53989
|
? dayjs(field.value, "DD/MM/YYYY")
|
|
53990
|
-
: (field.value === null || field.value === undefined) && null
|
|
53990
|
+
: (field.value === null || field.value === undefined) && null, open: open, className: "read-only", format: "DD/MM/YYYY", disabled: props.item.disable || false, onChange: (date) => {
|
|
53991
53991
|
var _a, _b;
|
|
53992
53992
|
field.onChange(dayjs(date).format("DD/MM/YYYY"));
|
|
53993
53993
|
((_a = props === null || props === void 0 ? void 0 : props.item) === null || _a === void 0 ? void 0 : _a.onChangeFn) && ((_b = props === null || props === void 0 ? void 0 : props.item) === null || _b === void 0 ? void 0 : _b.onChangeFn());
|
|
@@ -54028,7 +54028,7 @@ const FormRenderFileUpload = ({ props, variant }) => {
|
|
|
54028
54028
|
}
|
|
54029
54029
|
}
|
|
54030
54030
|
}, [props.getValues(props.item.name)]);
|
|
54031
|
-
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs(Box, Object.assign({ paddingLeft: "4px" }, { children: [((_a = props.item) === null || _a === void 0 ? void 0 : _a.label) && (jsxRuntimeExports.jsx(Box, Object.assign({ sx: { fontSize: "10px;" } }, { children: renderLabel(variant, props) }))), jsxRuntimeExports.jsx(TextField, { type: "file", id: props.item.name, inputProps: {
|
|
54031
|
+
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs(Box, Object.assign({ paddingLeft: "4px", sx: Object.assign({}, props.item.sx) }, { children: [((_a = props.item) === null || _a === void 0 ? void 0 : _a.label) && (jsxRuntimeExports.jsx(Box, Object.assign({ sx: { fontSize: "10px;" } }, { children: renderLabel(variant, props) }))), jsxRuntimeExports.jsx(TextField, { type: "file", id: props.item.name, inputProps: {
|
|
54032
54032
|
accept: props.item.fileType === "excel"
|
|
54033
54033
|
? ".xls, .xlsx"
|
|
54034
54034
|
: props.item.fileType === "pdf"
|
|
@@ -54111,26 +54111,40 @@ const SingleSelectNonAutoComplete = ({ props, variant }) => {
|
|
|
54111
54111
|
}, value: item.value }, { children: item.label })))) })), jsxRuntimeExports.jsx(ErrorMessageComponent, { children: jsxRuntimeExports.jsx(s, { errors: props.errors, name: props.item.name }) })] }), props.item.name));
|
|
54112
54112
|
};
|
|
54113
54113
|
|
|
54114
|
+
// interface FormActiveSwitchProps {
|
|
54115
|
+
// getValues: (name: string) => string;
|
|
54116
|
+
// setValue: (name: string, value: string) => void;
|
|
54117
|
+
// item: {
|
|
54118
|
+
// name: string;
|
|
54119
|
+
// label?: string;
|
|
54120
|
+
// label1?: string;
|
|
54121
|
+
// label2?: string;
|
|
54122
|
+
// value1?: string;
|
|
54123
|
+
// value2?: string;
|
|
54124
|
+
// };
|
|
54125
|
+
// }
|
|
54114
54126
|
const FormActiveSwitch = ({ props }) => {
|
|
54115
|
-
|
|
54127
|
+
var _a, _b, _c, _d;
|
|
54116
54128
|
const [active, setActive] = React$1.useState(true);
|
|
54117
|
-
const
|
|
54129
|
+
const { getValues, setValue, item } = props;
|
|
54130
|
+
const defaultValue1 = (_a = item.value1) !== null && _a !== void 0 ? _a : "A";
|
|
54131
|
+
const defaultValue2 = (_b = item.value2) !== null && _b !== void 0 ? _b : "I";
|
|
54118
54132
|
React$1.useEffect(() => {
|
|
54119
|
-
|
|
54120
|
-
|
|
54121
|
-
|
|
54122
|
-
else {
|
|
54123
|
-
setActive(data);
|
|
54124
|
-
}
|
|
54125
|
-
}, [data]);
|
|
54133
|
+
const currentValue = getValues(item.name);
|
|
54134
|
+
setActive(currentValue === defaultValue1);
|
|
54135
|
+
}, [getValues, item.name, defaultValue1]);
|
|
54126
54136
|
const handleSwitchChange = React$1.useCallback(() => {
|
|
54127
54137
|
setActive(prevActive => {
|
|
54128
|
-
|
|
54129
|
-
setValue(item.name,
|
|
54138
|
+
const newValue = !prevActive ? defaultValue1 : defaultValue2;
|
|
54139
|
+
setValue(item.name, newValue);
|
|
54130
54140
|
return !prevActive;
|
|
54131
54141
|
});
|
|
54132
|
-
}, [setValue, item.name]);
|
|
54133
|
-
return (jsxRuntimeExports.
|
|
54142
|
+
}, [setValue, item.name, defaultValue1, defaultValue2]);
|
|
54143
|
+
return (jsxRuntimeExports.jsxs("div", Object.assign({ className: "m-form__input" }, { children: [item.label && (jsxRuntimeExports.jsx("span", Object.assign({ style: {
|
|
54144
|
+
fontSize: "12px",
|
|
54145
|
+
fontWeight: 400,
|
|
54146
|
+
paddingRight: 10
|
|
54147
|
+
} }, { children: item.label }))), jsxRuntimeExports.jsxs("span", Object.assign({ className: "switch prestashop-switch fixed-width-lg" }, { children: [jsxRuntimeExports.jsx("input", { checked: active, id: `${item.name}_on`, name: item.name, type: "radio", value: "Active", onChange: handleSwitchChange }), jsxRuntimeExports.jsx("label", Object.assign({ htmlFor: `${item.name}_on`, style: { textTransform: "none", fontFamily: 'Vietnam' } }, { children: (_c = item.label1) !== null && _c !== void 0 ? _c : "Active" })), jsxRuntimeExports.jsx("input", { checked: !active, id: `${item.name}_off`, name: item.name, type: "radio", value: "In Active", onChange: handleSwitchChange }), jsxRuntimeExports.jsx("label", Object.assign({ htmlFor: `${item.name}_off`, style: { textTransform: "none", fontFamily: 'Vietnam' } }, { children: (_d = item.label2) !== null && _d !== void 0 ? _d : "In Active" })), jsxRuntimeExports.jsx("a", { className: "slide-button btn" })] }))] })));
|
|
54134
54148
|
};
|
|
54135
54149
|
|
|
54136
54150
|
var joditReact = {exports: {}};
|
|
@@ -54815,14 +54829,14 @@ const customTheme = createTheme({
|
|
|
54815
54829
|
}
|
|
54816
54830
|
});
|
|
54817
54831
|
|
|
54818
|
-
const FormRenderWrapper = ({ formArray, name, numberOfColumns = 3, form, }) => {
|
|
54832
|
+
const FormRenderWrapper = ({ formArray, name, numberOfColumns = 3, form, variant = '' }) => {
|
|
54819
54833
|
// const formContext=useFormControl({
|
|
54820
54834
|
// })
|
|
54821
54835
|
// useEffect(() => {
|
|
54822
54836
|
// // form.reset(initialValues, { resolver: yupResolver(validationSchema) });
|
|
54823
54837
|
// }, [formArray, validationSchema, initialValues]);
|
|
54824
54838
|
return (jsxRuntimeExports.jsx(ThemeProvider$3, Object.assign({ theme: customTheme }, { children: jsxRuntimeExports.jsx(FormComponent, Object.assign({ container: true, margin: "auto" }, { children: formArray.map((item, i) => {
|
|
54825
|
-
return (jsxRuntimeExports.jsx(Formitem, Object.assign({ container: true, sx: item.CustomProps, noOfColumn: item.numberOfColumns || numberOfColumns }, { children: jsxRuntimeExports.jsx(RenderForm, { item: item, register: form.register, control: form.control, errors: form.formState.errors, getValues: form.getValues, clearErrors: form.clearErrors, setValue: form.setValue }) }), i));
|
|
54839
|
+
return (jsxRuntimeExports.jsx(Formitem, Object.assign({ container: true, sx: item.CustomProps, noOfColumn: item.numberOfColumns || numberOfColumns }, { children: jsxRuntimeExports.jsx(RenderForm, { item: item, register: form.register, control: form.control, errors: form.formState.errors, getValues: form.getValues, clearErrors: form.clearErrors, setValue: form.setValue, variant: variant }) }), i));
|
|
54826
54840
|
}) })) })));
|
|
54827
54841
|
};
|
|
54828
54842
|
|