conexys-elements 1.1.26 → 1.1.27
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/README.md +4 -2
- package/dist/components/form/RenderForm.d.ts.map +1 -1
- package/dist/components/form/components/InputDate.d.ts +5 -0
- package/dist/components/form/components/InputDate.d.ts.map +1 -0
- package/dist/components/form/components/index.d.ts +2 -1
- package/dist/components/form/components/index.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +69 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +69 -1
- package/dist/index.js.map +1 -1
- package/dist/types/components/form.types.d.ts +17 -0
- package/dist/types/components/form.types.d.ts.map +1 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -43,8 +43,12 @@ var reactHookForm = require('react-hook-form');
|
|
|
43
43
|
var Button$3 = require('@mui/material/Button');
|
|
44
44
|
var Visibility = require('@mui/icons-material/Visibility');
|
|
45
45
|
var VisibilityOff = require('@mui/icons-material/VisibilityOff');
|
|
46
|
-
var
|
|
46
|
+
var AdapterDayjs = require('@mui/x-date-pickers/AdapterDayjs');
|
|
47
|
+
var LocalizationProvider = require('@mui/x-date-pickers/LocalizationProvider');
|
|
48
|
+
var DatePicker = require('@mui/x-date-pickers/DatePicker');
|
|
47
49
|
var InputLabel = require('@mui/material/InputLabel');
|
|
50
|
+
var dayjs = require('dayjs');
|
|
51
|
+
var TextField = require('@mui/material/TextField');
|
|
48
52
|
var InputAdornment = require('@mui/material/InputAdornment');
|
|
49
53
|
var JoditEditor = require('jodit-react');
|
|
50
54
|
var Radio = require('@mui/material/Radio');
|
|
@@ -10815,6 +10819,68 @@ const InputFile = ({
|
|
|
10815
10819
|
}, fileName))));
|
|
10816
10820
|
};
|
|
10817
10821
|
|
|
10822
|
+
const toDayjsValue = raw => {
|
|
10823
|
+
if (raw == null || raw === '') return null;
|
|
10824
|
+
if (dayjs.isDayjs(raw)) return raw;
|
|
10825
|
+
if (typeof raw === 'string') {
|
|
10826
|
+
const parsed = dayjs(raw.trim());
|
|
10827
|
+
if (parsed.isValid()) return parsed;
|
|
10828
|
+
const fromDisplay = dayjs(raw.trim(), 'DD/MM/YYYY');
|
|
10829
|
+
if (fromDisplay.isValid()) return fromDisplay;
|
|
10830
|
+
return null;
|
|
10831
|
+
}
|
|
10832
|
+
return null;
|
|
10833
|
+
};
|
|
10834
|
+
const InputDate = /*#__PURE__*/React.memo(({
|
|
10835
|
+
block
|
|
10836
|
+
}) => {
|
|
10837
|
+
const configLogs = useConexysConfig();
|
|
10838
|
+
const [t] = reactI18next.useTranslation('global');
|
|
10839
|
+
const currentValue = toDayjsValue(block.value);
|
|
10840
|
+
const handleChange = newValue => {
|
|
10841
|
+
if (!block.onChange) return;
|
|
10842
|
+
const syntheticEvent = {
|
|
10843
|
+
target: {
|
|
10844
|
+
name: block.name,
|
|
10845
|
+
value: newValue ? newValue.format('YYYY-MM-DD') : ''
|
|
10846
|
+
}
|
|
10847
|
+
};
|
|
10848
|
+
block.onChange(syntheticEvent);
|
|
10849
|
+
};
|
|
10850
|
+
const handleError = err => {
|
|
10851
|
+
const error = err;
|
|
10852
|
+
if (error?.response?.status === 401) Uservalidationerror(configLogs);
|
|
10853
|
+
};
|
|
10854
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
10855
|
+
className: `form-group ${block.ref ?? ''}`
|
|
10856
|
+
}, /*#__PURE__*/React.createElement(InputLabel, {
|
|
10857
|
+
htmlFor: block.id
|
|
10858
|
+
}, block.label, block.validate?.required && /*#__PURE__*/React.createElement("span", {
|
|
10859
|
+
className: "required"
|
|
10860
|
+
}, "*")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(LocalizationProvider.LocalizationProvider, {
|
|
10861
|
+
dateAdapter: AdapterDayjs.AdapterDayjs
|
|
10862
|
+
}, /*#__PURE__*/React.createElement(DatePicker.DatePicker, {
|
|
10863
|
+
label: block.placeholder ?? block.label,
|
|
10864
|
+
value: currentValue,
|
|
10865
|
+
onChange: handleChange,
|
|
10866
|
+
slotProps: {
|
|
10867
|
+
textField: {
|
|
10868
|
+
id: block.id,
|
|
10869
|
+
name: block.name,
|
|
10870
|
+
size: 'small',
|
|
10871
|
+
fullWidth: true,
|
|
10872
|
+
required: block.validate?.required,
|
|
10873
|
+
error: Boolean(block.error),
|
|
10874
|
+
helperText: block.helperText
|
|
10875
|
+
}
|
|
10876
|
+
},
|
|
10877
|
+
format: "DD/MM/YYYY",
|
|
10878
|
+
onError: handleError
|
|
10879
|
+
}))));
|
|
10880
|
+
}, (prevProps, nextProps) => {
|
|
10881
|
+
return prevProps.block.value === nextProps.block.value && prevProps.block.name === nextProps.block.name && prevProps.block.label === nextProps.block.label && prevProps.block.onChange === nextProps.block.onChange;
|
|
10882
|
+
});
|
|
10883
|
+
|
|
10818
10884
|
const InputPassword = ({
|
|
10819
10885
|
block,
|
|
10820
10886
|
inParagraph = false
|
|
@@ -11623,6 +11689,7 @@ const Components = {
|
|
|
11623
11689
|
info: Info,
|
|
11624
11690
|
inputwysiwyg: InputWYSIWYG,
|
|
11625
11691
|
inputfile: InputFile,
|
|
11692
|
+
inputdate: InputDate,
|
|
11626
11693
|
formlogin: FormLogin,
|
|
11627
11694
|
inputpassword: InputPassword,
|
|
11628
11695
|
text: Text,
|
|
@@ -14061,6 +14128,7 @@ exports.GenerateRandomPassword = GenerateRandomPassword;
|
|
|
14061
14128
|
exports.Heading = Heading;
|
|
14062
14129
|
exports.Image = Image;
|
|
14063
14130
|
exports.Info = Info;
|
|
14131
|
+
exports.InputDate = InputDate;
|
|
14064
14132
|
exports.InputFile = InputFile;
|
|
14065
14133
|
exports.InputPassword = InputPassword;
|
|
14066
14134
|
exports.InputText = InputText;
|