@mw-kit/mw-ui 1.7.48 → 1.7.50
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 +65 -18
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +65 -18
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -13415,9 +13415,11 @@ var Main = React__default.forwardRef(function (props, ref) {
|
|
|
13415
13415
|
});
|
|
13416
13416
|
};
|
|
13417
13417
|
|
|
13418
|
+
var isControlled = props.calendar !== undefined;
|
|
13418
13419
|
useEffect(function () {
|
|
13420
|
+
if (isControlled) return;
|
|
13419
13421
|
setCalendar(getInitialCalendar(initialMonth, min, max));
|
|
13420
|
-
}, [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()]);
|
|
13422
|
+
}, [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()]);
|
|
13421
13423
|
useEffect(function () {
|
|
13422
13424
|
var _ref2 = [calendar.weeks[0], calendar.weeks[calendar.weeks.length - 1]],
|
|
13423
13425
|
first = _ref2[0],
|
|
@@ -13552,7 +13554,19 @@ var Main = React__default.forwardRef(function (props, ref) {
|
|
|
13552
13554
|
type: details.indicator
|
|
13553
13555
|
}));
|
|
13554
13556
|
}));
|
|
13555
|
-
})),
|
|
13557
|
+
})), function () {
|
|
13558
|
+
if (!props.children) {
|
|
13559
|
+
return null;
|
|
13560
|
+
}
|
|
13561
|
+
|
|
13562
|
+
if (Array.isArray(props.children) && !props.children.some(function (e) {
|
|
13563
|
+
return e;
|
|
13564
|
+
})) {
|
|
13565
|
+
return null;
|
|
13566
|
+
}
|
|
13567
|
+
|
|
13568
|
+
return React__default.createElement(Footer, null, props.children);
|
|
13569
|
+
}(), loading && React__default.createElement(Loader, {
|
|
13556
13570
|
filled: theme$2.getColor('white', 95)
|
|
13557
13571
|
}));
|
|
13558
13572
|
});
|
|
@@ -13853,7 +13867,10 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
|
|
|
13853
13867
|
time = _useState[0],
|
|
13854
13868
|
setTime = _useState[1];
|
|
13855
13869
|
|
|
13856
|
-
var _useState2 = useState(
|
|
13870
|
+
var _useState2 = useState(function () {
|
|
13871
|
+
var calendar1 = getInitialCalendar(value[0] || initialMonth, min, max);
|
|
13872
|
+
return calendar1;
|
|
13873
|
+
}),
|
|
13857
13874
|
calendar1 = _useState2[0],
|
|
13858
13875
|
_setCalendar1 = _useState2[1];
|
|
13859
13876
|
|
|
@@ -13864,7 +13881,10 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
|
|
|
13864
13881
|
});
|
|
13865
13882
|
};
|
|
13866
13883
|
|
|
13867
|
-
var _useState3 = useState(
|
|
13884
|
+
var _useState3 = useState(function () {
|
|
13885
|
+
var calendar2 = getCalendar2(calendar1);
|
|
13886
|
+
return calendar2;
|
|
13887
|
+
}),
|
|
13868
13888
|
calendar2 = _useState3[0],
|
|
13869
13889
|
_setCalendar2 = _useState3[1];
|
|
13870
13890
|
|
|
@@ -13879,21 +13899,35 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
|
|
|
13879
13899
|
hoverDay = _useState4[0],
|
|
13880
13900
|
setHoverDay = _useState4[1];
|
|
13881
13901
|
|
|
13902
|
+
useEffect(function () {
|
|
13903
|
+
var calendar1 = getInitialCalendar(value[0] || initialMonth, min, max);
|
|
13904
|
+
var calendar2 = getCalendar2(calendar1);
|
|
13905
|
+
setCalendar1(calendar1);
|
|
13906
|
+
setCalendar2(calendar2);
|
|
13907
|
+
}, [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()]);
|
|
13882
13908
|
useEffect(function () {
|
|
13883
13909
|
var timeProps = getTimeProps(props.time, value);
|
|
13884
13910
|
setHoverDay(null);
|
|
13885
13911
|
|
|
13886
13912
|
if (value[0]) {
|
|
13887
13913
|
var c1 = getCalendar(value[0]);
|
|
13888
|
-
setCalendar1(c1);
|
|
13889
13914
|
|
|
13890
|
-
|
|
13891
|
-
var c2 =
|
|
13915
|
+
var c2 = function () {
|
|
13916
|
+
var c2 = getCalendar2(c1);
|
|
13892
13917
|
|
|
13893
|
-
if (
|
|
13894
|
-
|
|
13918
|
+
if (value[1]) {
|
|
13919
|
+
var _c = getCalendar(value[1]);
|
|
13920
|
+
|
|
13921
|
+
if (_c.year > c1.year || _c.year === c1.year && _c.month > c1.month) {
|
|
13922
|
+
return _c;
|
|
13923
|
+
}
|
|
13895
13924
|
}
|
|
13896
|
-
|
|
13925
|
+
|
|
13926
|
+
return c2;
|
|
13927
|
+
}();
|
|
13928
|
+
|
|
13929
|
+
setCalendar1(c1);
|
|
13930
|
+
setCalendar2(c2);
|
|
13897
13931
|
}
|
|
13898
13932
|
|
|
13899
13933
|
setInvalid(value.map(function (v, i) {
|
|
@@ -13997,11 +14031,16 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
|
|
|
13997
14031
|
}
|
|
13998
14032
|
});
|
|
13999
14033
|
}();
|
|
14000
|
-
var middle = new Date();
|
|
14001
|
-
middle.
|
|
14002
|
-
middle.
|
|
14003
|
-
middle.
|
|
14004
|
-
middle.
|
|
14034
|
+
var middle = [new Date(), new Date()];
|
|
14035
|
+
middle[0].setDate(1);
|
|
14036
|
+
middle[0].setFullYear(calendar2.year);
|
|
14037
|
+
middle[0].setMonth(calendar2.month);
|
|
14038
|
+
middle[0].setDate(0);
|
|
14039
|
+
middle[0].setHours(23, 59, 59, 999);
|
|
14040
|
+
middle[1].setDate(1);
|
|
14041
|
+
middle[1].setFullYear(calendar1.year);
|
|
14042
|
+
middle[1].setMonth(calendar1.month + 1);
|
|
14043
|
+
middle[1].setHours(0, 0, 0, 0);
|
|
14005
14044
|
var inputs = getTimeProps(props.time, value).map(function (timeProps, index) {
|
|
14006
14045
|
if (!timeProps) return undefined;
|
|
14007
14046
|
var width = timeProps.seconds ? 'withSeconds' : 'withoutSeconds';
|
|
@@ -14042,12 +14081,20 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
|
|
|
14042
14081
|
calendar: [calendar1, function (v) {
|
|
14043
14082
|
setCalendar1(function (prev) {
|
|
14044
14083
|
var c1 = typeof v === 'function' ? v(prev) : v;
|
|
14045
|
-
setCalendar2(
|
|
14084
|
+
setCalendar2(function (prev) {
|
|
14085
|
+
if (prev.year > c1.year) return prev;
|
|
14086
|
+
|
|
14087
|
+
if (prev.year === c1.year && prev.month > c1.month) {
|
|
14088
|
+
return prev;
|
|
14089
|
+
}
|
|
14090
|
+
|
|
14091
|
+
return getCalendar2(c1);
|
|
14092
|
+
});
|
|
14046
14093
|
return c1;
|
|
14047
14094
|
});
|
|
14048
14095
|
}],
|
|
14049
14096
|
min: min,
|
|
14050
|
-
max: max
|
|
14097
|
+
max: max && dateCompare(max, middle[0], 'lt') ? max : middle[0]
|
|
14051
14098
|
}), inputs[0]), React__default.createElement(BasicCalendar, Object.assign({}, calendarProps, {
|
|
14052
14099
|
getDay: function getDay(c) {
|
|
14053
14100
|
return _getDay2(c, 'right');
|
|
@@ -14062,7 +14109,7 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
|
|
|
14062
14109
|
ref: ref,
|
|
14063
14110
|
label: React__default.createElement(LabelContainer$1, null, React__default.createElement("b", null, "Fim:"), " ", value[1] ? dateToIsoString(value[1]) : '––/––/––––'),
|
|
14064
14111
|
calendar: [calendar2, setCalendar2],
|
|
14065
|
-
min: min && dateCompare(min, middle, 'gt') ? min : middle,
|
|
14112
|
+
min: min && dateCompare(min, middle[1], 'gt') ? min : middle[1],
|
|
14066
14113
|
max: max
|
|
14067
14114
|
}), inputs[1], submitProps && React__default.createElement(SubmitButton, Object.assign({
|
|
14068
14115
|
content: 'Aplicar'
|