tp-react-elements-dev 1.8.1 → 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/components/Form/FormRender.d.ts +4 -0
- package/dist/index.esm.js +31 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +31 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -42,6 +42,10 @@ export interface FormSectionPropsItem {
|
|
|
42
42
|
removeButtons?: string;
|
|
43
43
|
Fonts?: number[];
|
|
44
44
|
FontFamily?: any;
|
|
45
|
+
value1?: string | number;
|
|
46
|
+
value2?: string | number;
|
|
47
|
+
label1?: string | number;
|
|
48
|
+
label2?: string | number;
|
|
45
49
|
}
|
|
46
50
|
export interface FormRenderProps {
|
|
47
51
|
item: FormSectionPropsItem;
|
package/dist/index.esm.js
CHANGED
|
@@ -53844,7 +53844,7 @@ const SingleSelect = ({ props, variant }) => {
|
|
|
53844
53844
|
},
|
|
53845
53845
|
},
|
|
53846
53846
|
}, getOptionLabel: (option) => option.label, renderInput: (params) => {
|
|
53847
|
-
return (jsxRuntimeExports.jsx(Tooltip, Object.assign({ title: params.inputProps.value && params.inputProps.value }, { children: jsxRuntimeExports.jsx(TextField, Object.assign({}, params, { placeholder: props.item.
|
|
53847
|
+
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 ? " *" : ""}` : '' })) })));
|
|
53848
53848
|
}, isOptionEqualToValue: isOptionEqualToValue })), jsxRuntimeExports.jsx(ErrorMessageComponent, { children: jsxRuntimeExports.jsx(s, { errors: props.errors, name: props.item.name }) })] }));
|
|
53849
53849
|
} }, props.item.name));
|
|
53850
53850
|
};
|
|
@@ -53965,9 +53965,9 @@ const DatepickerWrapperV2 = ({ props, variant }) => {
|
|
|
53965
53965
|
};
|
|
53966
53966
|
return (jsxRuntimeExports.jsx(Controller, { control: props.control, name: props.item.name, render: ({ field }) => {
|
|
53967
53967
|
var _a, _b, _c, _d, _e, _f;
|
|
53968
|
-
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 ? ' *' : ''}
|
|
53968
|
+
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"
|
|
53969
53969
|
? dayjs(field.value, "DD/MM/YYYY")
|
|
53970
|
-
: (field.value === null || field.value === undefined) && null
|
|
53970
|
+
: (field.value === null || field.value === undefined) && null, open: open, className: "read-only", format: "DD/MM/YYYY", disabled: props.item.disable || false, onChange: (date) => {
|
|
53971
53971
|
var _a, _b;
|
|
53972
53972
|
field.onChange(dayjs(date).format("DD/MM/YYYY"));
|
|
53973
53973
|
((_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());
|
|
@@ -54008,7 +54008,7 @@ const FormRenderFileUpload = ({ props, variant }) => {
|
|
|
54008
54008
|
}
|
|
54009
54009
|
}
|
|
54010
54010
|
}, [props.getValues(props.item.name)]);
|
|
54011
|
-
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: {
|
|
54011
|
+
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: {
|
|
54012
54012
|
accept: props.item.fileType === "excel"
|
|
54013
54013
|
? ".xls, .xlsx"
|
|
54014
54014
|
: props.item.fileType === "pdf"
|
|
@@ -54091,26 +54091,40 @@ const SingleSelectNonAutoComplete = ({ props, variant }) => {
|
|
|
54091
54091
|
}, value: item.value }, { children: item.label })))) })), jsxRuntimeExports.jsx(ErrorMessageComponent, { children: jsxRuntimeExports.jsx(s, { errors: props.errors, name: props.item.name }) })] }), props.item.name));
|
|
54092
54092
|
};
|
|
54093
54093
|
|
|
54094
|
+
// interface FormActiveSwitchProps {
|
|
54095
|
+
// getValues: (name: string) => string;
|
|
54096
|
+
// setValue: (name: string, value: string) => void;
|
|
54097
|
+
// item: {
|
|
54098
|
+
// name: string;
|
|
54099
|
+
// label?: string;
|
|
54100
|
+
// label1?: string;
|
|
54101
|
+
// label2?: string;
|
|
54102
|
+
// value1?: string;
|
|
54103
|
+
// value2?: string;
|
|
54104
|
+
// };
|
|
54105
|
+
// }
|
|
54094
54106
|
const FormActiveSwitch = ({ props }) => {
|
|
54095
|
-
|
|
54107
|
+
var _a, _b, _c, _d;
|
|
54096
54108
|
const [active, setActive] = useState(true);
|
|
54097
|
-
const
|
|
54109
|
+
const { getValues, setValue, item } = props;
|
|
54110
|
+
const defaultValue1 = (_a = item.value1) !== null && _a !== void 0 ? _a : "A";
|
|
54111
|
+
const defaultValue2 = (_b = item.value2) !== null && _b !== void 0 ? _b : "I";
|
|
54098
54112
|
useEffect(() => {
|
|
54099
|
-
|
|
54100
|
-
|
|
54101
|
-
|
|
54102
|
-
else {
|
|
54103
|
-
setActive(data);
|
|
54104
|
-
}
|
|
54105
|
-
}, [data]);
|
|
54113
|
+
const currentValue = getValues(item.name);
|
|
54114
|
+
setActive(currentValue === defaultValue1);
|
|
54115
|
+
}, [getValues, item.name, defaultValue1]);
|
|
54106
54116
|
const handleSwitchChange = useCallback(() => {
|
|
54107
54117
|
setActive(prevActive => {
|
|
54108
|
-
|
|
54109
|
-
setValue(item.name,
|
|
54118
|
+
const newValue = !prevActive ? defaultValue1 : defaultValue2;
|
|
54119
|
+
setValue(item.name, newValue);
|
|
54110
54120
|
return !prevActive;
|
|
54111
54121
|
});
|
|
54112
|
-
}, [setValue, item.name]);
|
|
54113
|
-
return (jsxRuntimeExports.
|
|
54122
|
+
}, [setValue, item.name, defaultValue1, defaultValue2]);
|
|
54123
|
+
return (jsxRuntimeExports.jsxs("div", Object.assign({ className: "m-form__input" }, { children: [item.label && (jsxRuntimeExports.jsx("span", Object.assign({ style: {
|
|
54124
|
+
fontSize: "12px",
|
|
54125
|
+
fontWeight: 400,
|
|
54126
|
+
paddingRight: 10
|
|
54127
|
+
} }, { 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" })] }))] })));
|
|
54114
54128
|
};
|
|
54115
54129
|
|
|
54116
54130
|
var joditReact = {exports: {}};
|