@mw-kit/mw-ui 1.7.9 → 1.7.11

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.
@@ -13764,6 +13764,13 @@ var getCalendar2 = function getCalendar2(calendar1) {
13764
13764
  date.setHours(0, 0, 0, 0);
13765
13765
  return getCalendar(date);
13766
13766
  };
13767
+ var getTimeProps = function getTimeProps(time, value) {
13768
+ if (time === true) return [{}, {}];
13769
+ if (!time) return [undefined, undefined];
13770
+ return time.map(function (e, i) {
13771
+ return typeof e === 'function' ? e(value[i]) : e;
13772
+ });
13773
+ };
13767
13774
 
13768
13775
  var _templateObject$i;
13769
13776
  var SubmitButton = styled(Button$1)(_templateObject$i || (_templateObject$i = _taggedTemplateLiteralLoose(["\n width: 105px;\n"])));
@@ -13831,7 +13838,7 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
13831
13838
  setHoverDay = _useState4[1];
13832
13839
 
13833
13840
  useEffect(function () {
13834
- var timeProps = props.time === true ? [{}, {}] : props.time;
13841
+ var timeProps = getTimeProps(props.time, value);
13835
13842
  setHoverDay(null);
13836
13843
 
13837
13844
  if (value[0]) {
@@ -13848,7 +13855,7 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
13848
13855
  }
13849
13856
 
13850
13857
  setInvalid(value.map(function (v, i) {
13851
- return isInvalid(v, time[i], timeProps ? timeProps[i] : undefined, min, max);
13858
+ return isInvalid(v, time[i], timeProps[i], min, max);
13852
13859
  }));
13853
13860
  }, [value, time, props.time]);
13854
13861
 
@@ -13856,8 +13863,8 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
13856
13863
  return {};
13857
13864
  };
13858
13865
 
13859
- var getDay = function getDay(day) {
13860
- var dayProps = _getDay(day);
13866
+ var _getDay2 = function getDay(day, side) {
13867
+ var dayProps = _getDay(day, side);
13861
13868
 
13862
13869
  var _onClick2 = function onClick() {
13863
13870
  var newValue = [].concat(value);
@@ -13964,7 +13971,8 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
13964
13971
  middle.setMonth(calendar1.month + 1);
13965
13972
  middle.setDate(1);
13966
13973
  middle.setHours(0, 0, 0, 0);
13967
- var inputs = props.time ? (props.time === true ? [{}, {}] : props.time).map(function (timeProps, index) {
13974
+ var inputs = getTimeProps(props.time, value).map(function (timeProps, index) {
13975
+ if (!timeProps) return undefined;
13968
13976
  var width = timeProps.seconds ? 'withSeconds' : 'withoutSeconds';
13969
13977
  return React__default.createElement(Time, Object.assign({
13970
13978
  key: index
@@ -13981,10 +13989,23 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
13981
13989
  invalid: value[index] !== null && invalid[index] || timeInvalid[index],
13982
13990
  width: inputTimeWidth[width]
13983
13991
  }));
13984
- }) : [];
13992
+ });
13993
+
13994
+ var _onChangeMonth = props.onChangeMonth || function () {
13995
+ return Promise.resolve();
13996
+ };
13997
+
13985
13998
  return React__default.createElement(CalendarsContainer, null, React__default.createElement(BasicCalendar, Object.assign({}, calendarProps, {
13986
- getDay: getDay
13987
- }, {
13999
+ getDay: function getDay(c) {
14000
+ return _getDay2(c, 'left');
14001
+ },
14002
+ onChangeMonth: function (c) {
14003
+ try {
14004
+ return Promise.resolve(_onChangeMonth(c, 'left'));
14005
+ } catch (e) {
14006
+ return Promise.reject(e);
14007
+ }
14008
+ },
13988
14009
  ref: ref,
13989
14010
  label: React__default.createElement(LabelContainer$1, null, React__default.createElement("b", null, "Inicio:"), ' ', value[0] ? dateToIsoString(value[0]) : '––/––/––––'),
13990
14011
  calendar: [calendar1, function (v) {
@@ -13997,8 +14018,16 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
13997
14018
  min: min,
13998
14019
  max: max
13999
14020
  }), inputs[0]), React__default.createElement(BasicCalendar, Object.assign({}, calendarProps, {
14000
- getDay: getDay
14001
- }, {
14021
+ getDay: function getDay(c) {
14022
+ return _getDay2(c, 'right');
14023
+ },
14024
+ onChangeMonth: function (c) {
14025
+ try {
14026
+ return Promise.resolve(_onChangeMonth(c, 'right'));
14027
+ } catch (e) {
14028
+ return Promise.reject(e);
14029
+ }
14030
+ },
14002
14031
  ref: ref,
14003
14032
  label: React__default.createElement(LabelContainer$1, null, React__default.createElement("b", null, "Fim:"), " ", value[1] ? dateToIsoString(value[1]) : '––/––/––––'),
14004
14033
  calendar: [calendar2, setCalendar2],
@@ -14027,12 +14056,17 @@ var SingleCalendar = React__default.forwardRef(function (props, ref) {
14027
14056
  var initialValue = props.initialValue,
14028
14057
  min = props.min,
14029
14058
  max = props.max;
14030
- var timeProps = props.time === true ? {} : props.time;
14031
14059
 
14032
14060
  var _ref = props.value || useState(initialValue && !isNaN(initialValue.getTime()) && isDateBetween(initialValue, min, max) ? initialValue : null),
14033
14061
  value = _ref[0],
14034
14062
  setValue = _ref[1];
14035
14063
 
14064
+ var timeProps = function () {
14065
+ if (props.time === true) return {};
14066
+ if (typeof props.time === 'function') return props.time(value);
14067
+ return props.time;
14068
+ }();
14069
+
14036
14070
  var _ref2 = props.invalid || useState(false),
14037
14071
  invalid = _ref2[0],
14038
14072
  setInvalid = _ref2[1];
@@ -16649,7 +16683,11 @@ var DateTime = React__default.forwardRef(function (props, ref) {
16649
16683
  onKeyDown: onKeyDown,
16650
16684
  icon: icon,
16651
16685
  ref: ref
16652
- })), React__default.createElement(Calendar, Object.assign({}, typeof picker === 'object' ? picker : {}, {
16686
+ })), React__default.createElement(Calendar, Object.assign({
16687
+ time: {
16688
+ seconds: props.seconds
16689
+ }
16690
+ }, typeof picker === 'object' ? picker : {}, {
16653
16691
  type: 'single',
16654
16692
  absolute: true,
16655
16693
  open: open,
@@ -16665,9 +16703,6 @@ var DateTime = React__default.forwardRef(function (props, ref) {
16665
16703
  max: max,
16666
16704
  references: {
16667
16705
  bottom: '35px'
16668
- },
16669
- time: {
16670
- seconds: props.seconds
16671
16706
  }
16672
16707
  })));
16673
16708
  });