@ncds/ui-admin 0.0.35 → 0.0.37
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.
|
@@ -77,7 +77,7 @@ var RangeDatePicker = exports.RangeDatePicker = /*#__PURE__*/(0, _react.forwardR
|
|
|
77
77
|
};
|
|
78
78
|
(0, _react.useEffect)(function () {
|
|
79
79
|
var _a;
|
|
80
|
-
var needResetDate = validateDateType(startDateOptions.currentDate) && !(0, _lodash.isNil)((_a = validationOption === null || validationOption === void 0 ? void 0 : validationOption.initDate) === null || _a === void 0 ? void 0 : _a.startDate)
|
|
80
|
+
var needResetDate = validateDateType(startDateOptions.currentDate) && !(0, _lodash.isNil)((_a = validationOption === null || validationOption === void 0 ? void 0 : validationOption.initDate) === null || _a === void 0 ? void 0 : _a.startDate);
|
|
81
81
|
if (needResetDate) {
|
|
82
82
|
resetDateAndAlert('start');
|
|
83
83
|
return;
|
|
@@ -85,6 +85,7 @@ var RangeDatePicker = exports.RangeDatePicker = /*#__PURE__*/(0, _react.forwardR
|
|
|
85
85
|
var isOverDate = (0, _moment.default)(startDateOptions.currentDate).isAfter(endDateOptions.currentDate);
|
|
86
86
|
if (isOverDate) {
|
|
87
87
|
changeSettingDateAndAlert('start');
|
|
88
|
+
return;
|
|
88
89
|
}
|
|
89
90
|
if (!(validationOption === null || validationOption === void 0 ? void 0 : validationOption.setting)) {
|
|
90
91
|
return;
|
|
@@ -94,25 +95,23 @@ var RangeDatePicker = exports.RangeDatePicker = /*#__PURE__*/(0, _react.forwardR
|
|
|
94
95
|
period = _b.period;
|
|
95
96
|
var isValidPeriod = (0, _moment.default)(startDateOptions.currentDate).isSameOrAfter((0, _moment.default)(endDateOptions.currentDate).subtract(period, unit));
|
|
96
97
|
if (!isValidPeriod) {
|
|
97
|
-
changeSettingDateAndAlert('start',
|
|
98
|
+
changeSettingDateAndAlert('start', true);
|
|
98
99
|
}
|
|
99
|
-
}, [startDateOptions.currentDate
|
|
100
|
+
}, [startDateOptions.currentDate]);
|
|
100
101
|
(0, _react.useEffect)(function () {
|
|
101
102
|
var _a;
|
|
102
|
-
var needResetDate = validateDateType(endDateOptions.currentDate) && !(0, _lodash.isNil)((_a = validationOption === null || validationOption === void 0 ? void 0 : validationOption.initDate) === null || _a === void 0 ? void 0 : _a.endDate)
|
|
103
|
+
var needResetDate = validateDateType(endDateOptions.currentDate) && !(0, _lodash.isNil)((_a = validationOption === null || validationOption === void 0 ? void 0 : validationOption.initDate) === null || _a === void 0 ? void 0 : _a.endDate);
|
|
103
104
|
if (needResetDate) {
|
|
104
105
|
resetDateAndAlert('end');
|
|
105
106
|
return;
|
|
106
107
|
}
|
|
107
108
|
var isNotTodayEndDate = !(0, _moment.default)(endDateOptions.currentDate).isSame((0, _moment.default)(), 'day');
|
|
108
|
-
if (!isNotTodayEndDate) {
|
|
109
|
+
if (!(validationOption === null || validationOption === void 0 ? void 0 : validationOption.setting) || !isNotTodayEndDate) {
|
|
109
110
|
return;
|
|
110
111
|
}
|
|
111
112
|
var isOverDate = (0, _moment.default)(endDateOptions.currentDate).isBefore(startDateOptions.currentDate);
|
|
112
113
|
if (isOverDate) {
|
|
113
114
|
changeSettingDateAndAlert('end');
|
|
114
|
-
}
|
|
115
|
-
if (!(validationOption === null || validationOption === void 0 ? void 0 : validationOption.setting)) {
|
|
116
115
|
return;
|
|
117
116
|
}
|
|
118
117
|
var _b = validationOption.setting,
|
|
@@ -120,9 +119,9 @@ var RangeDatePicker = exports.RangeDatePicker = /*#__PURE__*/(0, _react.forwardR
|
|
|
120
119
|
period = _b.period;
|
|
121
120
|
var isValidPeriod = (0, _moment.default)(endDateOptions.currentDate).isSameOrBefore((0, _moment.default)(startDateOptions.currentDate).add(period, unit));
|
|
122
121
|
if (!isValidPeriod) {
|
|
123
|
-
changeSettingDateAndAlert('end',
|
|
122
|
+
changeSettingDateAndAlert('end', true);
|
|
124
123
|
}
|
|
125
|
-
}, [endDateOptions.currentDate
|
|
124
|
+
}, [endDateOptions.currentDate]);
|
|
126
125
|
return (0, _jsxRuntime.jsxs)("div", __assign({
|
|
127
126
|
className: "ncua-range-date-picker",
|
|
128
127
|
ref: ref || undefined
|
|
@@ -70,7 +70,7 @@ export var RangeDatePicker = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
70
70
|
};
|
|
71
71
|
useEffect(function () {
|
|
72
72
|
var _a;
|
|
73
|
-
var needResetDate = validateDateType(startDateOptions.currentDate) && !isNil((_a = validationOption === null || validationOption === void 0 ? void 0 : validationOption.initDate) === null || _a === void 0 ? void 0 : _a.startDate)
|
|
73
|
+
var needResetDate = validateDateType(startDateOptions.currentDate) && !isNil((_a = validationOption === null || validationOption === void 0 ? void 0 : validationOption.initDate) === null || _a === void 0 ? void 0 : _a.startDate);
|
|
74
74
|
if (needResetDate) {
|
|
75
75
|
resetDateAndAlert('start');
|
|
76
76
|
return;
|
|
@@ -78,6 +78,7 @@ export var RangeDatePicker = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
78
78
|
var isOverDate = moment(startDateOptions.currentDate).isAfter(endDateOptions.currentDate);
|
|
79
79
|
if (isOverDate) {
|
|
80
80
|
changeSettingDateAndAlert('start');
|
|
81
|
+
return;
|
|
81
82
|
}
|
|
82
83
|
if (!(validationOption === null || validationOption === void 0 ? void 0 : validationOption.setting)) {
|
|
83
84
|
return;
|
|
@@ -87,25 +88,23 @@ export var RangeDatePicker = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
87
88
|
period = _b.period;
|
|
88
89
|
var isValidPeriod = moment(startDateOptions.currentDate).isSameOrAfter(moment(endDateOptions.currentDate).subtract(period, unit));
|
|
89
90
|
if (!isValidPeriod) {
|
|
90
|
-
changeSettingDateAndAlert('start',
|
|
91
|
+
changeSettingDateAndAlert('start', true);
|
|
91
92
|
}
|
|
92
|
-
}, [startDateOptions.currentDate
|
|
93
|
+
}, [startDateOptions.currentDate]);
|
|
93
94
|
useEffect(function () {
|
|
94
95
|
var _a;
|
|
95
|
-
var needResetDate = validateDateType(endDateOptions.currentDate) && !isNil((_a = validationOption === null || validationOption === void 0 ? void 0 : validationOption.initDate) === null || _a === void 0 ? void 0 : _a.endDate)
|
|
96
|
+
var needResetDate = validateDateType(endDateOptions.currentDate) && !isNil((_a = validationOption === null || validationOption === void 0 ? void 0 : validationOption.initDate) === null || _a === void 0 ? void 0 : _a.endDate);
|
|
96
97
|
if (needResetDate) {
|
|
97
98
|
resetDateAndAlert('end');
|
|
98
99
|
return;
|
|
99
100
|
}
|
|
100
101
|
var isNotTodayEndDate = !moment(endDateOptions.currentDate).isSame(moment(), 'day');
|
|
101
|
-
if (!isNotTodayEndDate) {
|
|
102
|
+
if (!(validationOption === null || validationOption === void 0 ? void 0 : validationOption.setting) || !isNotTodayEndDate) {
|
|
102
103
|
return;
|
|
103
104
|
}
|
|
104
105
|
var isOverDate = moment(endDateOptions.currentDate).isBefore(startDateOptions.currentDate);
|
|
105
106
|
if (isOverDate) {
|
|
106
107
|
changeSettingDateAndAlert('end');
|
|
107
|
-
}
|
|
108
|
-
if (!(validationOption === null || validationOption === void 0 ? void 0 : validationOption.setting)) {
|
|
109
108
|
return;
|
|
110
109
|
}
|
|
111
110
|
var _b = validationOption.setting,
|
|
@@ -113,9 +112,9 @@ export var RangeDatePicker = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
113
112
|
period = _b.period;
|
|
114
113
|
var isValidPeriod = moment(endDateOptions.currentDate).isSameOrBefore(moment(startDateOptions.currentDate).add(period, unit));
|
|
115
114
|
if (!isValidPeriod) {
|
|
116
|
-
changeSettingDateAndAlert('end',
|
|
115
|
+
changeSettingDateAndAlert('end', true);
|
|
117
116
|
}
|
|
118
|
-
}, [endDateOptions.currentDate
|
|
117
|
+
}, [endDateOptions.currentDate]);
|
|
119
118
|
return _jsxs("div", __assign({
|
|
120
119
|
className: "ncua-range-date-picker",
|
|
121
120
|
ref: ref || undefined
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { unitOfTime } from 'moment';
|
|
2
3
|
import { DatePickerProps } from './DatePicker';
|
|
3
4
|
export type RangeDatePickerProps = {
|
|
@@ -20,5 +21,5 @@ export type RangeDatePickerProps = {
|
|
|
20
21
|
currentDate: string;
|
|
21
22
|
}) => void;
|
|
22
23
|
};
|
|
23
|
-
export declare const RangeDatePicker:
|
|
24
|
+
export declare const RangeDatePicker: React.ForwardRefExoticComponent<RangeDatePickerProps & React.RefAttributes<HTMLDivElement>>;
|
|
24
25
|
//# sourceMappingURL=RangeDatePicker.d.ts.map
|