@mw-kit/mw-ui 1.7.35 → 1.7.37

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.
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { AbsoluteContainerProps } from '../../../AbsoluteContainer/interfaces';
3
+ import { ButtonProps } from '../../../Button/interfaces';
3
4
  import { TimeProps } from '../../../Input/components/Time/interfaces';
4
5
  import { BasicCalendarProps } from '../Basic/interfaces';
5
6
  export declare type Value = [Date | null, Date | null];
@@ -10,9 +11,8 @@ export interface Common extends Pick<BasicCalendarProps, 'initialMonth' | 'max'
10
11
  initialValue?: Value;
11
12
  value?: [Value, (value: Value) => void];
12
13
  time?: true | [GetInputTimeProps | InputTimeProps | undefined, GetInputTimeProps | InputTimeProps | undefined];
13
- onSubmit?: {
14
+ onSubmit?: Omit<ButtonProps, 'type' | 'onClick'> & {
14
15
  onClick: (value: Value) => void;
15
- disabled?: boolean;
16
16
  };
17
17
  invalid?: [[boolean, boolean], (invalid: [boolean, boolean]) => void];
18
18
  onChangeMonth?: (calendar: Parameters<OnChangeMonth>[0], side: 'left' | 'right') => ReturnType<OnChangeMonth>;
package/dist/index.js CHANGED
@@ -12435,7 +12435,6 @@ var Input$1 = React__default.forwardRef(function (props, ref) {
12435
12435
  }),
12436
12436
  width: '14px'
12437
12437
  };
12438
- inputProps.disabled = true;
12439
12438
  } else if (clearable) {
12440
12439
  position = position || 'right';
12441
12440
  iconOnClick = typeof clearable === 'function' ? clearable : function () {
@@ -13954,33 +13953,22 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
13954
13953
  }) ? [false, false] : time.map(function (t) {
13955
13954
  return t.length === 0;
13956
13955
  });
13957
- var onSubmit = {
13958
- disabled: value.some(function (v) {
13956
+ var submitProps = !props.onSubmit ? undefined : function () {
13957
+ var disabled = props.onSubmit.disabled || value.some(function (v) {
13959
13958
  return v === null;
13960
13959
  }) || invalid.some(function (v) {
13961
13960
  return v;
13962
13961
  }) || timeInvalid.some(function (v) {
13963
13962
  return v;
13964
- }),
13965
- onClick: function onClick() {}
13966
- };
13967
-
13968
- if (props.onSubmit) {
13969
- var _props$onSubmit = props.onSubmit,
13970
- disabled = _props$onSubmit.disabled,
13971
- onClick = _props$onSubmit.onClick;
13972
-
13973
- if (disabled) {
13974
- onSubmit.disabled = true;
13975
- }
13976
-
13977
- if (!onSubmit.disabled) {
13978
- onSubmit.onClick = function () {
13963
+ });
13964
+ var onClick = props.onSubmit.onClick;
13965
+ return _extends({}, props.onSubmit, {
13966
+ disabled: disabled,
13967
+ onClick: disabled ? undefined : function () {
13979
13968
  onClick([value[0] ? getFullDate(value[0], time[0]) : null, value[1] ? getFullDate(value[1], time[1], true) : null]);
13980
- };
13981
- }
13982
- }
13983
-
13969
+ }
13970
+ });
13971
+ }();
13984
13972
  var middle = new Date();
13985
13973
  middle.setFullYear(calendar1.year);
13986
13974
  middle.setMonth(calendar1.month + 1);
@@ -14048,9 +14036,10 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
14048
14036
  calendar: [calendar2, setCalendar2],
14049
14037
  min: min && dateCompare(min, middle, 'gt') ? min : middle,
14050
14038
  max: max
14051
- }), inputs[1], props.onSubmit && React__default.createElement(SubmitButton, Object.assign({}, onSubmit, {
14052
- type: 'button',
14039
+ }), inputs[1], submitProps && React__default.createElement(SubmitButton, Object.assign({
14053
14040
  content: 'Aplicar'
14041
+ }, submitProps, {
14042
+ type: 'button'
14054
14043
  }))));
14055
14044
  });
14056
14045
  Main$1.displayName = 'Main';