conexys-elements 1.1.26 → 1.1.28

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
@@ -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 TextField = require('@mui/material/TextField');
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');
@@ -4291,7 +4295,8 @@ function AppFormFieldsFromConfig({
4291
4295
  pattern: block.pattern || block.validate && block.validate.pattern
4292
4296
  },
4293
4297
  showPasswordToggle: block.showPasswordToggle,
4294
- items: block.items || []
4298
+ items: block.items || [],
4299
+ accept: block.accept
4295
4300
  }, nouser || 'user')));
4296
4301
  }
4297
4302
 
@@ -10701,6 +10706,7 @@ const InputFile = ({
10701
10706
  if (source === 'drop') {
10702
10707
  updateInputFile(file);
10703
10708
  }
10709
+ block.onChange?.(file);
10704
10710
  }
10705
10711
  };
10706
10712
  const handleFileChange = event => {
@@ -10750,6 +10756,7 @@ const InputFile = ({
10750
10756
  if (input) {
10751
10757
  input.value = '';
10752
10758
  }
10759
+ block.onChange?.(null);
10753
10760
  };
10754
10761
  const handleClick = e => {
10755
10762
  if (e.target.closest('.uploaded-row') || e.target.closest('img')) {
@@ -10815,6 +10822,68 @@ const InputFile = ({
10815
10822
  }, fileName))));
10816
10823
  };
10817
10824
 
10825
+ const toDayjsValue = raw => {
10826
+ if (raw == null || raw === '') return null;
10827
+ if (dayjs.isDayjs(raw)) return raw;
10828
+ if (typeof raw === 'string') {
10829
+ const parsed = dayjs(raw.trim());
10830
+ if (parsed.isValid()) return parsed;
10831
+ const fromDisplay = dayjs(raw.trim(), 'DD/MM/YYYY');
10832
+ if (fromDisplay.isValid()) return fromDisplay;
10833
+ return null;
10834
+ }
10835
+ return null;
10836
+ };
10837
+ const InputDate = /*#__PURE__*/React.memo(({
10838
+ block
10839
+ }) => {
10840
+ const configLogs = useConexysConfig();
10841
+ const [t] = reactI18next.useTranslation('global');
10842
+ const currentValue = toDayjsValue(block.value);
10843
+ const handleChange = newValue => {
10844
+ if (!block.onChange) return;
10845
+ const syntheticEvent = {
10846
+ target: {
10847
+ name: block.name,
10848
+ value: newValue ? newValue.format('YYYY-MM-DD') : ''
10849
+ }
10850
+ };
10851
+ block.onChange(syntheticEvent);
10852
+ };
10853
+ const handleError = err => {
10854
+ const error = err;
10855
+ if (error?.response?.status === 401) Uservalidationerror(configLogs);
10856
+ };
10857
+ return /*#__PURE__*/React.createElement("div", {
10858
+ className: `form-group ${block.ref ?? ''}`
10859
+ }, /*#__PURE__*/React.createElement(InputLabel, {
10860
+ htmlFor: block.id
10861
+ }, block.label, block.validate?.required && /*#__PURE__*/React.createElement("span", {
10862
+ className: "required"
10863
+ }, "*")), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(LocalizationProvider.LocalizationProvider, {
10864
+ dateAdapter: AdapterDayjs.AdapterDayjs
10865
+ }, /*#__PURE__*/React.createElement(DatePicker.DatePicker, {
10866
+ label: block.placeholder ?? block.label,
10867
+ value: currentValue,
10868
+ onChange: handleChange,
10869
+ slotProps: {
10870
+ textField: {
10871
+ id: block.id,
10872
+ name: block.name,
10873
+ size: 'small',
10874
+ fullWidth: true,
10875
+ required: block.validate?.required,
10876
+ error: Boolean(block.error),
10877
+ helperText: block.helperText
10878
+ }
10879
+ },
10880
+ format: "DD/MM/YYYY",
10881
+ onError: handleError
10882
+ }))));
10883
+ }, (prevProps, nextProps) => {
10884
+ 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;
10885
+ });
10886
+
10818
10887
  const InputPassword = ({
10819
10888
  block,
10820
10889
  inParagraph = false
@@ -11623,6 +11692,7 @@ const Components = {
11623
11692
  info: Info,
11624
11693
  inputwysiwyg: InputWYSIWYG,
11625
11694
  inputfile: InputFile,
11695
+ inputdate: InputDate,
11626
11696
  formlogin: FormLogin,
11627
11697
  inputpassword: InputPassword,
11628
11698
  text: Text,
@@ -14061,6 +14131,7 @@ exports.GenerateRandomPassword = GenerateRandomPassword;
14061
14131
  exports.Heading = Heading;
14062
14132
  exports.Image = Image;
14063
14133
  exports.Info = Info;
14134
+ exports.InputDate = InputDate;
14064
14135
  exports.InputFile = InputFile;
14065
14136
  exports.InputPassword = InputPassword;
14066
14137
  exports.InputText = InputText;