@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.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,21 +13902,35 @@ 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);
|
|
13888
13914
|
|
|
13889
13915
|
if (value[0]) {
|
|
13890
13916
|
var c1 = getCalendar(value[0]);
|
|
13891
|
-
setCalendar1(c1);
|
|
13892
13917
|
|
|
13893
|
-
|
|
13894
|
-
var c2 =
|
|
13918
|
+
var c2 = function () {
|
|
13919
|
+
var c2 = getCalendar2(c1);
|
|
13895
13920
|
|
|
13896
|
-
if (
|
|
13897
|
-
|
|
13921
|
+
if (value[1]) {
|
|
13922
|
+
var _c = getCalendar(value[1]);
|
|
13923
|
+
|
|
13924
|
+
if (_c.year > c1.year || _c.year === c1.year && _c.month > c1.month) {
|
|
13925
|
+
return _c;
|
|
13926
|
+
}
|
|
13898
13927
|
}
|
|
13899
|
-
|
|
13928
|
+
|
|
13929
|
+
return c2;
|
|
13930
|
+
}();
|
|
13931
|
+
|
|
13932
|
+
setCalendar1(c1);
|
|
13933
|
+
setCalendar2(c2);
|
|
13900
13934
|
}
|
|
13901
13935
|
|
|
13902
13936
|
setInvalid(value.map(function (v, i) {
|
|
@@ -14000,11 +14034,16 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
|
|
|
14000
14034
|
}
|
|
14001
14035
|
});
|
|
14002
14036
|
}();
|
|
14003
|
-
var middle = new Date();
|
|
14004
|
-
middle.
|
|
14005
|
-
middle.
|
|
14006
|
-
middle.
|
|
14007
|
-
middle.
|
|
14037
|
+
var middle = [new Date(), new Date()];
|
|
14038
|
+
middle[0].setDate(1);
|
|
14039
|
+
middle[0].setFullYear(calendar2.year);
|
|
14040
|
+
middle[0].setMonth(calendar2.month);
|
|
14041
|
+
middle[0].setDate(0);
|
|
14042
|
+
middle[0].setHours(23, 59, 59, 999);
|
|
14043
|
+
middle[1].setDate(1);
|
|
14044
|
+
middle[1].setFullYear(calendar1.year);
|
|
14045
|
+
middle[1].setMonth(calendar1.month + 1);
|
|
14046
|
+
middle[1].setHours(0, 0, 0, 0);
|
|
14008
14047
|
var inputs = getTimeProps(props.time, value).map(function (timeProps, index) {
|
|
14009
14048
|
if (!timeProps) return undefined;
|
|
14010
14049
|
var width = timeProps.seconds ? 'withSeconds' : 'withoutSeconds';
|
|
@@ -14045,12 +14084,20 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
|
|
|
14045
14084
|
calendar: [calendar1, function (v) {
|
|
14046
14085
|
setCalendar1(function (prev) {
|
|
14047
14086
|
var c1 = typeof v === 'function' ? v(prev) : v;
|
|
14048
|
-
setCalendar2(
|
|
14087
|
+
setCalendar2(function (prev) {
|
|
14088
|
+
if (prev.year > c1.year) return prev;
|
|
14089
|
+
|
|
14090
|
+
if (prev.year === c1.year && prev.month > c1.month) {
|
|
14091
|
+
return prev;
|
|
14092
|
+
}
|
|
14093
|
+
|
|
14094
|
+
return getCalendar2(c1);
|
|
14095
|
+
});
|
|
14049
14096
|
return c1;
|
|
14050
14097
|
});
|
|
14051
14098
|
}],
|
|
14052
14099
|
min: min,
|
|
14053
|
-
max: max
|
|
14100
|
+
max: max && dateCompare(max, middle[0], 'lt') ? max : middle[0]
|
|
14054
14101
|
}), inputs[0]), React__default.createElement(BasicCalendar, Object.assign({}, calendarProps, {
|
|
14055
14102
|
getDay: function getDay(c) {
|
|
14056
14103
|
return _getDay2(c, 'right');
|
|
@@ -14065,7 +14112,7 @@ var Main$1 = React__default.forwardRef(function (props, ref) {
|
|
|
14065
14112
|
ref: ref,
|
|
14066
14113
|
label: React__default.createElement(LabelContainer$1, null, React__default.createElement("b", null, "Fim:"), " ", value[1] ? dateToIsoString(value[1]) : '––/––/––––'),
|
|
14067
14114
|
calendar: [calendar2, setCalendar2],
|
|
14068
|
-
min: min && dateCompare(min, middle, 'gt') ? min : middle,
|
|
14115
|
+
min: min && dateCompare(min, middle[1], 'gt') ? min : middle[1],
|
|
14069
14116
|
max: max
|
|
14070
14117
|
}), inputs[1], submitProps && React__default.createElement(SubmitButton, Object.assign({
|
|
14071
14118
|
content: 'Aplicar'
|