tp-react-elements-dev 1.10.2 → 1.10.3

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.
@@ -46,6 +46,8 @@ export interface FormSectionPropsItem {
46
46
  value2?: string | number | boolean;
47
47
  label1?: string;
48
48
  label2?: string;
49
+ minTime?: string;
50
+ maxTime?: string;
49
51
  settings?: FormSectionPropsItem[];
50
52
  }
51
53
  export interface FormRenderProps {
package/dist/index.esm.js CHANGED
@@ -58840,7 +58840,7 @@ const SingleSelect = ({ props, variant }) => {
58840
58840
  },
58841
58841
  }, getOptionLabel: (option) => option.label, renderInput: (params) => {
58842
58842
  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 ? " *" : ""}` : '' })) })));
58843
- }, isOptionEqualToValue: isOptionEqualToValue })), jsxRuntimeExports.jsx(ErrorMessageComponent, { children: jsxRuntimeExports.jsx(s, { errors: props.errors, name: props.item.name }) })] }));
58843
+ }, isOptionEqualToValue: isOptionEqualToValue }), props.item.options), jsxRuntimeExports.jsx(ErrorMessageComponent, { children: jsxRuntimeExports.jsx(s, { errors: props.errors, name: props.item.name }) })] }));
58844
58844
  } }, props.item.name));
58845
58845
  };
58846
58846
 
@@ -59227,9 +59227,21 @@ function formatDayjsToCustomTime(date) {
59227
59227
  function TimePickerFieldWrapper({ props, }) {
59228
59228
  const value = props.getValues(props.item.name);
59229
59229
  return (jsxRuntimeExports.jsxs(LocalizationProvider, Object.assign({ dateAdapter: AdapterDayjs }, { children: [jsxRuntimeExports.jsx(Controller, { name: "time", control: props.control, render: ({ field }) => (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [" ", renderLabel(props.variant, props), jsxRuntimeExports.jsx(TimePicker, Object.assign({}, field, { value: value ? parseCustomTime(value) : null, onChange: (newTime) => {
59230
- props.setValue(props.item.name, formatDayjsToCustomTime(newTime));
59231
- props.item.onChangeFn && props.item.onChangeFn(formatDayjsToCustomTime(newTime));
59232
- }, label: props.variant === "standard" ? "" : props.item.label, disabled: props.item.disable, slotProps: { textField: { readOnly: true, size: "small" } } }))] })) }), jsxRuntimeExports.jsx(ErrorMessageComponent, { children: jsxRuntimeExports.jsx(s, { errors: props.errors, name: props.item.name }) })] })));
59230
+ const parsedTime = parseCustomTime(formatDayjsToCustomTime(newTime));
59231
+ const min = props.item.minTime ? parseCustomTime(props.item.minTime) : null;
59232
+ const max = props.item.maxTime ? parseCustomTime(props.item.maxTime) : null;
59233
+ let finalTime = parsedTime;
59234
+ // Auto-correct if value is outside bounds
59235
+ if (min && parsedTime.isBefore(min)) {
59236
+ finalTime = min;
59237
+ }
59238
+ else if (max && parsedTime.isAfter(max)) {
59239
+ finalTime = max;
59240
+ }
59241
+ const formatted = formatDayjsToCustomTime(finalTime);
59242
+ props.setValue(props.item.name, formatted);
59243
+ props.item.onChangeFn && props.item.onChangeFn(formatted);
59244
+ }, minTime: props.item.minTime ? parseCustomTime(props.item.minTime) : null, maxTime: props.item.maxTime ? parseCustomTime(props.item.maxTime) : null, label: props.variant === "standard" ? "" : props.item.label, disabled: props.item.disable, slotProps: { textField: { readOnly: true, size: "small" } } }))] })) }), jsxRuntimeExports.jsx(ErrorMessageComponent, { children: jsxRuntimeExports.jsx(s, { errors: props.errors, name: props.item.name }) })] })));
59233
59245
  }
59234
59246
 
59235
59247
  const FormRenderMultiFileUpload = ({ props, variant, }) => {