@sustaina/shared-ui 1.70.6 → 1.70.7
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 +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5699,12 +5699,9 @@ function MonthCal({
|
|
|
5699
5699
|
);
|
|
5700
5700
|
const min = React__namespace.useMemo(() => normalizeMonth(minDate), [minDate]);
|
|
5701
5701
|
const max = React__namespace.useMemo(() => normalizeMonth(maxDate), [maxDate]);
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
}
|
|
5706
|
-
const minYear = effectiveMin?.getFullYear();
|
|
5707
|
-
const minMonth = effectiveMin?.getMonth();
|
|
5702
|
+
const hasConflictingBounds = Boolean(min && max && min > max);
|
|
5703
|
+
const minYear = min?.getFullYear();
|
|
5704
|
+
const minMonth = min?.getMonth();
|
|
5708
5705
|
const maxYear = max?.getFullYear();
|
|
5709
5706
|
const maxMonth = max?.getMonth();
|
|
5710
5707
|
const selectedMonthYear = selectedMonthDate?.getFullYear();
|
|
@@ -5717,6 +5714,7 @@ function MonthCal({
|
|
|
5717
5714
|
}
|
|
5718
5715
|
}, [selectedMonthYear]);
|
|
5719
5716
|
React__namespace.useEffect(() => {
|
|
5717
|
+
if (hasConflictingBounds) return;
|
|
5720
5718
|
if (typeof minYear === "number" && menuYear < minYear) {
|
|
5721
5719
|
setMenuYear(minYear);
|
|
5722
5720
|
return;
|
|
@@ -5724,10 +5722,11 @@ function MonthCal({
|
|
|
5724
5722
|
if (typeof maxYear === "number" && menuYear > maxYear) {
|
|
5725
5723
|
setMenuYear(maxYear);
|
|
5726
5724
|
}
|
|
5727
|
-
}, [minYear, maxYear, menuYear]);
|
|
5728
|
-
const disablePrevYear = typeof minYear === "number" ? menuYear <= minYear : false;
|
|
5729
|
-
const disableNextYear = typeof maxYear === "number" ? menuYear >= maxYear : false;
|
|
5725
|
+
}, [hasConflictingBounds, minYear, maxYear, menuYear]);
|
|
5726
|
+
const disablePrevYear = hasConflictingBounds || (typeof minYear === "number" ? menuYear <= minYear : false);
|
|
5727
|
+
const disableNextYear = hasConflictingBounds || (typeof maxYear === "number" ? menuYear >= maxYear : false);
|
|
5730
5728
|
const yearOptions = React__namespace.useMemo(() => {
|
|
5729
|
+
if (hasConflictingBounds) return [menuYear];
|
|
5731
5730
|
const fallbackWindow = 50;
|
|
5732
5731
|
const start = typeof minYear === "number" ? minYear : menuYear - fallbackWindow;
|
|
5733
5732
|
const end = typeof maxYear === "number" ? maxYear : menuYear + fallbackWindow;
|
|
@@ -5740,7 +5739,7 @@ function MonthCal({
|
|
|
5740
5739
|
years.sort((a, b) => a - b);
|
|
5741
5740
|
}
|
|
5742
5741
|
return years;
|
|
5743
|
-
}, [maxYear, menuYear, minYear]);
|
|
5742
|
+
}, [hasConflictingBounds, maxYear, menuYear, minYear]);
|
|
5744
5743
|
const formatYearLabel = React__namespace.useCallback(
|
|
5745
5744
|
(year) => {
|
|
5746
5745
|
const raw = callbacks?.yearLabel?.(year);
|
|
@@ -5751,13 +5750,14 @@ function MonthCal({
|
|
|
5751
5750
|
);
|
|
5752
5751
|
const handleYearSelect = React__namespace.useCallback(
|
|
5753
5752
|
(nextValue) => {
|
|
5753
|
+
if (hasConflictingBounds) return;
|
|
5754
5754
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
5755
5755
|
if (Number.isNaN(nextYear)) return;
|
|
5756
5756
|
if (typeof minYear === "number" && nextYear < minYear) return;
|
|
5757
5757
|
if (typeof maxYear === "number" && nextYear > maxYear) return;
|
|
5758
5758
|
setMenuYear(nextYear);
|
|
5759
5759
|
},
|
|
5760
|
-
[maxYear, minYear]
|
|
5760
|
+
[hasConflictingBounds, maxYear, minYear]
|
|
5761
5761
|
);
|
|
5762
5762
|
const disabledPairs = React__namespace.useMemo(() => {
|
|
5763
5763
|
if (!disabledDates?.length) return [];
|
|
@@ -5842,7 +5842,7 @@ function MonthCal({
|
|
|
5842
5842
|
const disabledByList = disabledPairs.some(
|
|
5843
5843
|
(d) => d.year === menuYear && d.month === m.number
|
|
5844
5844
|
);
|
|
5845
|
-
const isDisabled = afterMax || beforeMin || disabledByList;
|
|
5845
|
+
const isDisabled = hasConflictingBounds || afterMax || beforeMin || disabledByList;
|
|
5846
5846
|
const cellDate = new Date(menuYear, m.number, 1);
|
|
5847
5847
|
cellDate.setHours(0, 0, 0, 0);
|
|
5848
5848
|
const isSelected = !isDisabled && !!selectedMonthDate && selectedMonthDate.getFullYear() === menuYear && selectedMonthDate.getMonth() === m.number;
|
|
@@ -8720,7 +8720,7 @@ var AdvanceSearch = ({
|
|
|
8720
8720
|
} = useAdvanceSearch({ fields: fieldsData, limitRows });
|
|
8721
8721
|
const form = reactHookForm.useForm({
|
|
8722
8722
|
mode: "onSubmit",
|
|
8723
|
-
reValidateMode: "
|
|
8723
|
+
reValidateMode: "onChange",
|
|
8724
8724
|
defaultValues: {}
|
|
8725
8725
|
});
|
|
8726
8726
|
const { handleSubmit, unregister, resetField, getValues, clearErrors, setError } = form;
|