@mw-kit/mw-ui 1.7.48 → 1.7.49
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 +51 -12
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +51 -12
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13418,9 +13418,11 @@ var Main = React__default.forwardRef(function (props, ref) {
|
|
|
13418
13418
|
});
|
|
13419
13419
|
};
|
|
13420
13420
|
|
|
13421
|
+
var isControlled = props.calendar !== undefined;
|
|
13421
13422
|
React.useEffect(function () {
|
|
13423
|
+
if (isControlled) return;
|
|
13422
13424
|
setCalendar(getInitialCalendar(initialMonth, min, max));
|
|
13423
|
-
}, [initialMonth === null || initialMonth === void 0 ? void 0 : initialMonth.toISOString(), min === null || min === void 0 ? void 0 : min.toISOString(), max === null || max === void 0 ? void 0 : max.toISOString()]);
|
|
13425
|
+
}, [isControlled, initialMonth === null || initialMonth === void 0 ? void 0 : initialMonth.toISOString(), min === null || min === void 0 ? void 0 : min.toISOString(), max === null || max === void 0 ? void 0 : max.toISOString()]);
|
|
13424
13426
|
React.useEffect(function () {
|
|
13425
13427
|
var _ref2 = [calendar.weeks[0], calendar.weeks[calendar.weeks.length - 1]],
|
|
13426
13428
|
first = _ref2[0],
|
|
@@ -13555,7 +13557,19 @@ var Main = React__default.forwardRef(function (props, ref) {
|
|
|
13555
13557
|
type: details.indicator
|
|
13556
13558
|
}));
|
|
13557
13559
|
}));
|
|
13558
|
-
})),
|
|
13560
|
+
})), function () {
|
|
13561
|
+
if (!props.children) {
|
|
13562
|
+
return null;
|
|
13563
|
+
}
|
|
13564
|
+
|
|
13565
|
+
if (Array.isArray(props.children) && !props.children.some(function (e) {
|
|
13566
|
+
return e;
|
|
13567
|
+
})) {
|
|
13568
|
+
return null;
|
|
13569
|
+
}
|
|
13570
|
+
|
|
13571
|
+
return React__default.createElement(Footer, null, props.children);
|
|
13572
|
+
}(), loading && React__default.createElement(Loader, {
|
|
13559
13573
|
filled: theme$2.getColor('white', 95)
|
|
13560
13574
|
}));
|
|
13561
13575
|
});
|
|
@@ -13856,7 +13870,10 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
|
|
|
13856
13870
|
time = _useState[0],
|
|
13857
13871
|
setTime = _useState[1];
|
|
13858
13872
|
|
|
13859
|
-
var _useState2 = React.useState(
|
|
13873
|
+
var _useState2 = React.useState(function () {
|
|
13874
|
+
var calendar1 = getInitialCalendar(value[0] || initialMonth, min, max);
|
|
13875
|
+
return calendar1;
|
|
13876
|
+
}),
|
|
13860
13877
|
calendar1 = _useState2[0],
|
|
13861
13878
|
_setCalendar1 = _useState2[1];
|
|
13862
13879
|
|
|
@@ -13867,7 +13884,10 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
|
|
|
13867
13884
|
});
|
|
13868
13885
|
};
|
|
13869
13886
|
|
|
13870
|
-
var _useState3 = React.useState(
|
|
13887
|
+
var _useState3 = React.useState(function () {
|
|
13888
|
+
var calendar2 = getCalendar2(calendar1);
|
|
13889
|
+
return calendar2;
|
|
13890
|
+
}),
|
|
13871
13891
|
calendar2 = _useState3[0],
|
|
13872
13892
|
_setCalendar2 = _useState3[1];
|
|
13873
13893
|
|
|
@@ -13882,6 +13902,12 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
|
|
|
13882
13902
|
hoverDay = _useState4[0],
|
|
13883
13903
|
setHoverDay = _useState4[1];
|
|
13884
13904
|
|
|
13905
|
+
React.useEffect(function () {
|
|
13906
|
+
var calendar1 = getInitialCalendar(value[0] || initialMonth, min, max);
|
|
13907
|
+
var calendar2 = getCalendar2(calendar1);
|
|
13908
|
+
setCalendar1(calendar1);
|
|
13909
|
+
setCalendar2(calendar2);
|
|
13910
|
+
}, [initialMonth === null || initialMonth === void 0 ? void 0 : initialMonth.toISOString(), min === null || min === void 0 ? void 0 : min.toISOString(), max === null || max === void 0 ? void 0 : max.toISOString()]);
|
|
13885
13911
|
React.useEffect(function () {
|
|
13886
13912
|
var timeProps = getTimeProps(props.time, value);
|
|
13887
13913
|
setHoverDay(null);
|
|
@@ -14000,11 +14026,16 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
|
|
|
14000
14026
|
}
|
|
14001
14027
|
});
|
|
14002
14028
|
}();
|
|
14003
|
-
var middle = new Date();
|
|
14004
|
-
middle.
|
|
14005
|
-
middle.
|
|
14006
|
-
middle.
|
|
14007
|
-
middle.
|
|
14029
|
+
var middle = [new Date(), new Date()];
|
|
14030
|
+
middle[0].setDate(1);
|
|
14031
|
+
middle[0].setFullYear(calendar2.year);
|
|
14032
|
+
middle[0].setMonth(calendar2.month);
|
|
14033
|
+
middle[0].setDate(0);
|
|
14034
|
+
middle[0].setHours(23, 59, 59, 999);
|
|
14035
|
+
middle[1].setDate(1);
|
|
14036
|
+
middle[1].setFullYear(calendar1.year);
|
|
14037
|
+
middle[1].setMonth(calendar1.month + 1);
|
|
14038
|
+
middle[1].setHours(0, 0, 0, 0);
|
|
14008
14039
|
var inputs = getTimeProps(props.time, value).map(function (timeProps, index) {
|
|
14009
14040
|
if (!timeProps) return undefined;
|
|
14010
14041
|
var width = timeProps.seconds ? 'withSeconds' : 'withoutSeconds';
|
|
@@ -14045,12 +14076,20 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
|
|
|
14045
14076
|
calendar: [calendar1, function (v) {
|
|
14046
14077
|
setCalendar1(function (prev) {
|
|
14047
14078
|
var c1 = typeof v === 'function' ? v(prev) : v;
|
|
14048
|
-
setCalendar2(
|
|
14079
|
+
setCalendar2(function (prev) {
|
|
14080
|
+
if (prev.year > c1.year) return prev;
|
|
14081
|
+
|
|
14082
|
+
if (prev.year === c1.year && prev.month > c1.month) {
|
|
14083
|
+
return prev;
|
|
14084
|
+
}
|
|
14085
|
+
|
|
14086
|
+
return getCalendar2(c1);
|
|
14087
|
+
});
|
|
14049
14088
|
return c1;
|
|
14050
14089
|
});
|
|
14051
14090
|
}],
|
|
14052
14091
|
min: min,
|
|
14053
|
-
max: max
|
|
14092
|
+
max: max && dateCompare(max, middle[0], 'lt') ? max : middle[0]
|
|
14054
14093
|
}), inputs[0]), React__default.createElement(BasicCalendar, Object.assign({}, calendarProps, {
|
|
14055
14094
|
getDay: function getDay(c) {
|
|
14056
14095
|
return _getDay2(c, 'right');
|
|
@@ -14065,7 +14104,7 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
|
|
|
14065
14104
|
ref: ref,
|
|
14066
14105
|
label: React__default.createElement(LabelContainer$1, null, React__default.createElement("b", null, "Fim:"), " ", value[1] ? dateToIsoString(value[1]) : '––/––/––––'),
|
|
14067
14106
|
calendar: [calendar2, setCalendar2],
|
|
14068
|
-
min: min && dateCompare(min, middle, 'gt') ? min : middle,
|
|
14107
|
+
min: min && dateCompare(min, middle[1], 'gt') ? min : middle[1],
|
|
14069
14108
|
max: max
|
|
14070
14109
|
}), inputs[1], submitProps && React__default.createElement(SubmitButton, Object.assign({
|
|
14071
14110
|
content: 'Aplicar'
|