@mw-kit/mw-ui 1.7.35 → 1.7.36
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
|
@@ -13954,33 +13954,22 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
|
|
|
13954
13954
|
}) ? [false, false] : time.map(function (t) {
|
|
13955
13955
|
return t.length === 0;
|
|
13956
13956
|
});
|
|
13957
|
-
var
|
|
13958
|
-
disabled
|
|
13957
|
+
var submitProps = !props.onSubmit ? undefined : function () {
|
|
13958
|
+
var disabled = props.onSubmit.disabled || value.some(function (v) {
|
|
13959
13959
|
return v === null;
|
|
13960
13960
|
}) || invalid.some(function (v) {
|
|
13961
13961
|
return v;
|
|
13962
13962
|
}) || timeInvalid.some(function (v) {
|
|
13963
13963
|
return v;
|
|
13964
|
-
})
|
|
13965
|
-
onClick
|
|
13966
|
-
|
|
13967
|
-
|
|
13968
|
-
|
|
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 () {
|
|
13964
|
+
});
|
|
13965
|
+
var onClick = props.onSubmit.onClick;
|
|
13966
|
+
return _extends({}, props.onSubmit, {
|
|
13967
|
+
disabled: disabled,
|
|
13968
|
+
onClick: disabled ? undefined : function () {
|
|
13979
13969
|
onClick([value[0] ? getFullDate(value[0], time[0]) : null, value[1] ? getFullDate(value[1], time[1], true) : null]);
|
|
13980
|
-
}
|
|
13981
|
-
}
|
|
13982
|
-
}
|
|
13983
|
-
|
|
13970
|
+
}
|
|
13971
|
+
});
|
|
13972
|
+
}();
|
|
13984
13973
|
var middle = new Date();
|
|
13985
13974
|
middle.setFullYear(calendar1.year);
|
|
13986
13975
|
middle.setMonth(calendar1.month + 1);
|
|
@@ -14048,9 +14037,10 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
|
|
|
14048
14037
|
calendar: [calendar2, setCalendar2],
|
|
14049
14038
|
min: min && dateCompare(min, middle, 'gt') ? min : middle,
|
|
14050
14039
|
max: max
|
|
14051
|
-
}), inputs[1],
|
|
14052
|
-
type: 'button',
|
|
14040
|
+
}), inputs[1], submitProps && React__default.createElement(SubmitButton, Object.assign({
|
|
14053
14041
|
content: 'Aplicar'
|
|
14042
|
+
}, submitProps, {
|
|
14043
|
+
type: 'button'
|
|
14054
14044
|
}))));
|
|
14055
14045
|
});
|
|
14056
14046
|
Main$1.displayName = 'Main';
|