@cloudtower/eagle 0.33.22 → 0.33.24
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/cjs/coreX/DateRangePicker/AbsoluteDate.js +2 -1
- package/dist/cjs/coreX/DateRangePicker/Calendar.js +75 -55
- package/dist/cjs/coreX/DateRangePicker/index.js +4 -0
- package/dist/cjs/index.js +5 -2
- package/dist/cjs/stats1.html +1 -1
- package/dist/cjs/utils/unit.js +19 -0
- package/dist/components.css +967 -967
- package/dist/esm/coreX/DateRangePicker/AbsoluteDate.js +2 -1
- package/dist/esm/coreX/DateRangePicker/Calendar.js +76 -56
- package/dist/esm/coreX/DateRangePicker/index.js +4 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/stats1.html +1 -1
- package/dist/esm/utils/unit.js +17 -0
- package/dist/linaria.merged.scss +1084 -1084
- package/dist/src/core/Antd5Tree/Antd5Tree.d.ts +1 -3
- package/dist/src/core/Antd5Tree/Antd5Tree.type.d.ts +3 -1
- package/dist/src/coreX/DateRangePicker/dateRangePicker.type.d.ts +10 -2
- package/dist/src/utils/__test__/unit.spec.d.ts +1 -0
- package/dist/src/utils/unit.d.ts +14 -0
- package/dist/stories/docs/core/Antd5Tree.stories.d.ts +12 -1
- package/dist/stories/docs/coreX/DateRangePicker.stories.d.ts +1 -0
- package/dist/style.css +874 -874
- package/package.json +4 -4
- package/dist/cjs/core/Antd5Tree/Antd5Tree.js +0 -30
- package/dist/esm/core/Antd5Tree/Antd5Tree.js +0 -24
|
@@ -146,7 +146,7 @@ const Time = React__default.default.forwardRef((props, ref) => {
|
|
|
146
146
|
});
|
|
147
147
|
const AbsoluteDate = React__default.default.forwardRef(
|
|
148
148
|
(props, ref) => {
|
|
149
|
-
const { range, minDate, maxDate, onChange, onOk } = props;
|
|
149
|
+
const { range, minDate, maxDate, maxRange, onChange, onOk } = props;
|
|
150
150
|
const timeRef = React.useRef(null);
|
|
151
151
|
React.useImperativeHandle(ref, () => {
|
|
152
152
|
var _a;
|
|
@@ -165,6 +165,7 @@ const AbsoluteDate = React__default.default.forwardRef(
|
|
|
165
165
|
range,
|
|
166
166
|
minDate,
|
|
167
167
|
maxDate,
|
|
168
|
+
maxRange,
|
|
168
169
|
onChange
|
|
169
170
|
}
|
|
170
171
|
), /* @__PURE__ */ React__default.default.createElement(
|
|
@@ -9,6 +9,7 @@ var index$1 = require('../../core/Input/index.js');
|
|
|
9
9
|
var index = require('../../core/Typo/index.js');
|
|
10
10
|
var useElementIntersectionRatio = require('../../hooks/useElementIntersectionRatio.js');
|
|
11
11
|
var useParrotTranslation = require('../../hooks/useParrotTranslation.js');
|
|
12
|
+
var unit = require('../../utils/unit.js');
|
|
12
13
|
var dayjs = require('dayjs');
|
|
13
14
|
var React = require('react');
|
|
14
15
|
var common = require('./common.js');
|
|
@@ -84,6 +85,7 @@ const MonthItem = (props) => {
|
|
|
84
85
|
highlightDay,
|
|
85
86
|
minDate,
|
|
86
87
|
maxDate,
|
|
88
|
+
maxRange,
|
|
87
89
|
parentElement,
|
|
88
90
|
onRangeChange,
|
|
89
91
|
onMouseEnter
|
|
@@ -133,6 +135,74 @@ const MonthItem = (props) => {
|
|
|
133
135
|
}
|
|
134
136
|
onRangeChange(_range);
|
|
135
137
|
}
|
|
138
|
+
const datesElements = React.useMemo(() => {
|
|
139
|
+
return initMonth.dates.map((date) => {
|
|
140
|
+
const _date = common.getTime(initYear, initMonth.month, date);
|
|
141
|
+
const { number: maxRangeNumber, unit: maxRangeUnit } = unit.parseNumberAndUnit(maxRange || "") || {};
|
|
142
|
+
const dateNotIncludeInRange = common.checkDateNotInRange(
|
|
143
|
+
_date,
|
|
144
|
+
minDate,
|
|
145
|
+
maxDate
|
|
146
|
+
);
|
|
147
|
+
const isLimitRangeEnd = !!rangeStart && !rangeEnd;
|
|
148
|
+
const isDateBeforeRangeStart = isLimitRangeEnd ? _date.valueOf() < rangeStart.valueOf() : false;
|
|
149
|
+
const isDateNotIncludeInMaxRange = isLimitRangeEnd && maxRangeNumber && maxRangeUnit ? rangeStart.add(maxRangeNumber, maxRangeUnit).valueOf() <= _date.valueOf() : false;
|
|
150
|
+
const disabled = Boolean(isDateBeforeRangeStart || isDateNotIncludeInMaxRange) || !dateNotIncludeInRange;
|
|
151
|
+
const dateClassName = common.getClassNameForDateBlock(
|
|
152
|
+
range,
|
|
153
|
+
_date,
|
|
154
|
+
mapOfHighlightDay,
|
|
155
|
+
disabled
|
|
156
|
+
);
|
|
157
|
+
const highlightIndex = mapOfHighlightDay.get(_date.format("YYYY-MM-DD"));
|
|
158
|
+
const isFirstDayInWeek = _date.day() === 1;
|
|
159
|
+
const isLastDayInWeek = _date.day() === 0;
|
|
160
|
+
const isFirstDayInMonth = _date.date() === 1;
|
|
161
|
+
const isLastDayInMonth = _date.date() === _date.daysInMonth();
|
|
162
|
+
const isLastDayIsSingleDayInWeek = isLastDayInMonth && isFirstDayInWeek;
|
|
163
|
+
const isFirstHighlight = highlightIndex === 0 || isFirstDayInWeek || isFirstDayInMonth || isLastDayIsSingleDayInWeek;
|
|
164
|
+
const isLastHighlight = highlightIndex === Math.max(mapOfHighlightDay.size - 1, 0) || isLastDayInWeek || isLastDayInMonth;
|
|
165
|
+
return /* @__PURE__ */ React__default.default.createElement(
|
|
166
|
+
"span",
|
|
167
|
+
{
|
|
168
|
+
key: `date-${date}`,
|
|
169
|
+
className: core.cx(
|
|
170
|
+
"date-block",
|
|
171
|
+
dateClassName,
|
|
172
|
+
isFirstHighlight && "first-highlight",
|
|
173
|
+
isLastHighlight && "last-highlight"
|
|
174
|
+
),
|
|
175
|
+
onClick: () => {
|
|
176
|
+
if (disabled) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
clickDate(date);
|
|
180
|
+
},
|
|
181
|
+
onMouseEnter: () => {
|
|
182
|
+
if (disabled) {
|
|
183
|
+
onMouseEnter(null);
|
|
184
|
+
} else if (rangeStart && !rangeEnd) {
|
|
185
|
+
onMouseEnter(_date);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
/* @__PURE__ */ React__default.default.createElement("span", { className: core.cx("date-text", dateClassName) }, date)
|
|
190
|
+
);
|
|
191
|
+
});
|
|
192
|
+
}, [
|
|
193
|
+
initMonth.dates,
|
|
194
|
+
initMonth.month,
|
|
195
|
+
initYear,
|
|
196
|
+
maxRange,
|
|
197
|
+
minDate,
|
|
198
|
+
maxDate,
|
|
199
|
+
rangeStart,
|
|
200
|
+
rangeEnd,
|
|
201
|
+
range,
|
|
202
|
+
mapOfHighlightDay,
|
|
203
|
+
clickDate,
|
|
204
|
+
onMouseEnter
|
|
205
|
+
]);
|
|
136
206
|
return /* @__PURE__ */ React__default.default.createElement("li", { className: "month-container", ref: containerRef }, /* @__PURE__ */ React__default.default.createElement(
|
|
137
207
|
"header",
|
|
138
208
|
{
|
|
@@ -140,62 +210,10 @@ const MonthItem = (props) => {
|
|
|
140
210
|
ref: headerRef
|
|
141
211
|
},
|
|
142
212
|
getCalendarTitle.getCalendarTitle(initMonth.month.toString(), parrot.parrotI18n.t, parrot.parrotI18n)
|
|
143
|
-
), /* @__PURE__ */ React__default.default.createElement("div", { className: "dates-in-month", ref: datesContainerRef }, new Array(initMonth.firstDateOfDay).fill(null).map((value, index) => /* @__PURE__ */ React__default.default.createElement("span", { key: `blank-date-${index}`, className: "blank" })),
|
|
144
|
-
const _date = common.getTime(initYear, initMonth.month, date);
|
|
145
|
-
const dateNotIncludeInRange = common.checkDateNotInRange(
|
|
146
|
-
_date,
|
|
147
|
-
minDate,
|
|
148
|
-
maxDate
|
|
149
|
-
);
|
|
150
|
-
const disabled = Boolean(
|
|
151
|
-
rangeStart && !rangeEnd && rangeStart.valueOf() > _date.valueOf()
|
|
152
|
-
) || !dateNotIncludeInRange;
|
|
153
|
-
const dateClassName = common.getClassNameForDateBlock(
|
|
154
|
-
range,
|
|
155
|
-
_date,
|
|
156
|
-
mapOfHighlightDay,
|
|
157
|
-
disabled
|
|
158
|
-
);
|
|
159
|
-
const highlightIndex = mapOfHighlightDay.get(
|
|
160
|
-
_date.format("YYYY-MM-DD")
|
|
161
|
-
);
|
|
162
|
-
const isFirstDayInWeek = _date.day() === 1;
|
|
163
|
-
const isLastDayInWeek = _date.day() === 0;
|
|
164
|
-
const isFirstDayInMonth = _date.date() === 1;
|
|
165
|
-
const isLastDayInMonth = _date.date() === _date.daysInMonth();
|
|
166
|
-
const isLastDayIsSingleDayInWeek = isLastDayInMonth && isFirstDayInWeek;
|
|
167
|
-
const isFirstHighlight = highlightIndex === 0 || isFirstDayInWeek || isFirstDayInMonth || isLastDayIsSingleDayInWeek;
|
|
168
|
-
const isLastHighlight = highlightIndex === Math.max(mapOfHighlightDay.size - 1, 0) || isLastDayInWeek || isLastDayInMonth;
|
|
169
|
-
return /* @__PURE__ */ React__default.default.createElement(
|
|
170
|
-
"span",
|
|
171
|
-
{
|
|
172
|
-
key: `date-${date}`,
|
|
173
|
-
className: core.cx(
|
|
174
|
-
"date-block",
|
|
175
|
-
dateClassName,
|
|
176
|
-
isFirstHighlight && "first-highlight",
|
|
177
|
-
isLastHighlight && "last-highlight"
|
|
178
|
-
),
|
|
179
|
-
onClick: () => {
|
|
180
|
-
if (disabled) {
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
clickDate(date);
|
|
184
|
-
},
|
|
185
|
-
onMouseEnter: () => {
|
|
186
|
-
if (disabled) {
|
|
187
|
-
onMouseEnter(null);
|
|
188
|
-
} else if (rangeStart && !rangeEnd) {
|
|
189
|
-
onMouseEnter(_date);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
/* @__PURE__ */ React__default.default.createElement("span", { className: core.cx("date-text", dateClassName) }, date)
|
|
194
|
-
);
|
|
195
|
-
})));
|
|
213
|
+
), /* @__PURE__ */ React__default.default.createElement("div", { className: "dates-in-month", ref: datesContainerRef }, new Array(initMonth.firstDateOfDay).fill(null).map((value, index) => /* @__PURE__ */ React__default.default.createElement("span", { key: `blank-date-${index}`, className: "blank" })), datesElements));
|
|
196
214
|
};
|
|
197
215
|
const Month = (props) => {
|
|
198
|
-
const { year, range, minDate, maxDate, onRangeChange } = props;
|
|
216
|
+
const { year, range, minDate, maxDate, maxRange, onRangeChange } = props;
|
|
199
217
|
const monthContainerRef = React.useRef(null);
|
|
200
218
|
const [month, setMonth] = React.useState([]);
|
|
201
219
|
const [highlightDay, setHighlightDay] = React.useState(() => {
|
|
@@ -253,6 +271,7 @@ const Month = (props) => {
|
|
|
253
271
|
range,
|
|
254
272
|
minDate,
|
|
255
273
|
maxDate,
|
|
274
|
+
maxRange,
|
|
256
275
|
highlightDay: highlightDay || controlHighlightDay || [],
|
|
257
276
|
parentElement: monthContainerRef,
|
|
258
277
|
onRangeChange,
|
|
@@ -266,7 +285,7 @@ const Week = () => {
|
|
|
266
285
|
return /* @__PURE__ */ React__default.default.createElement(DateRangePicker_style.CalendarStyle.Week, null, /* @__PURE__ */ React__default.default.createElement("li", { className: index.Typo.Label.l1_regular }, t("components.monday-simple")), /* @__PURE__ */ React__default.default.createElement("li", { className: index.Typo.Label.l1_regular }, t("components.tuesday-simple")), /* @__PURE__ */ React__default.default.createElement("li", { className: index.Typo.Label.l1_regular }, t("components.wednesday-simple")), /* @__PURE__ */ React__default.default.createElement("li", { className: index.Typo.Label.l1_regular }, t("components.thursday-simple")), /* @__PURE__ */ React__default.default.createElement("li", { className: index.Typo.Label.l1_regular }, t("components.friday-simple")), /* @__PURE__ */ React__default.default.createElement("li", { className: index.Typo.Label.l1_regular }, t("components.saturday-simple")), /* @__PURE__ */ React__default.default.createElement("li", { className: index.Typo.Label.l1_regular }, t("components.sunday-simple")));
|
|
267
286
|
};
|
|
268
287
|
const Calendar = (props) => {
|
|
269
|
-
const { range: initRange, minDate, maxDate, onChange } = props;
|
|
288
|
+
const { range: initRange, minDate, maxDate, maxRange, onChange } = props;
|
|
270
289
|
const [year, setYear] = React.useState(dayjs__default.default().year());
|
|
271
290
|
const [range, setRange] = React.useState(
|
|
272
291
|
initRange || [null, null]
|
|
@@ -285,6 +304,7 @@ const Calendar = (props) => {
|
|
|
285
304
|
range,
|
|
286
305
|
minDate,
|
|
287
306
|
maxDate,
|
|
307
|
+
maxRange,
|
|
288
308
|
onRangeChange: handleRangeChange
|
|
289
309
|
}
|
|
290
310
|
));
|
|
@@ -51,6 +51,7 @@ const TimeRange = (props) => {
|
|
|
51
51
|
mode = ["relative", "absolute"],
|
|
52
52
|
minDate,
|
|
53
53
|
maxDate,
|
|
54
|
+
maxRange,
|
|
54
55
|
onTypeChange,
|
|
55
56
|
onRelativeTimeChange,
|
|
56
57
|
onAbsoluteTimeOk,
|
|
@@ -110,6 +111,7 @@ const TimeRange = (props) => {
|
|
|
110
111
|
range: range || [null, null],
|
|
111
112
|
minDate,
|
|
112
113
|
maxDate,
|
|
114
|
+
maxRange,
|
|
113
115
|
onChange: (range2) => onAbsoluteTimeChange == null ? void 0 : onAbsoluteTimeChange(range2),
|
|
114
116
|
onOk: (range2) => onAbsoluteTimeOk == null ? void 0 : onAbsoluteTimeOk(range2)
|
|
115
117
|
}
|
|
@@ -161,6 +163,7 @@ const DateRangePicker = (props) => {
|
|
|
161
163
|
mode = ["relative", "absolute"],
|
|
162
164
|
minDate,
|
|
163
165
|
maxDate,
|
|
166
|
+
maxRange,
|
|
164
167
|
onChange,
|
|
165
168
|
relativeTimeSelectOptions
|
|
166
169
|
} = props;
|
|
@@ -295,6 +298,7 @@ const DateRangePicker = (props) => {
|
|
|
295
298
|
mode,
|
|
296
299
|
minDate,
|
|
297
300
|
maxDate,
|
|
301
|
+
maxRange,
|
|
298
302
|
onTypeChange: setType,
|
|
299
303
|
onRelativeTimeChange: (time) => {
|
|
300
304
|
handleChange("relative", time);
|
package/dist/cjs/index.js
CHANGED
|
@@ -81,7 +81,7 @@ var index$17 = require('./core/Token/index.js');
|
|
|
81
81
|
var index$18 = require('./core/Tooltip/index.js');
|
|
82
82
|
var index$19 = require('./core/Truncate/index.js');
|
|
83
83
|
var Antd5Dropdown = require('./core/Antd5Dropdown/Antd5Dropdown.js');
|
|
84
|
-
var
|
|
84
|
+
var antd5 = require('antd5');
|
|
85
85
|
var arch_type = require('./core/Arch/arch.type.js');
|
|
86
86
|
var index$1a = require('./core/Banner/index.js');
|
|
87
87
|
var index$1b = require('./core/BasicCTError/index.js');
|
|
@@ -415,7 +415,10 @@ exports.TokenPresetColors = index$17.TokenPresetColors;
|
|
|
415
415
|
exports.Tooltip = index$18;
|
|
416
416
|
exports.Truncate = index$19;
|
|
417
417
|
exports.Antd5Dropdown = Antd5Dropdown.Antd5Dropdown;
|
|
418
|
-
exports
|
|
418
|
+
Object.defineProperty(exports, 'Antd5Tree', {
|
|
419
|
+
enumerable: true,
|
|
420
|
+
get: function () { return antd5.Tree; }
|
|
421
|
+
});
|
|
419
422
|
exports.Architecture = arch_type.Architecture;
|
|
420
423
|
exports.Banner = index$1a.Banner;
|
|
421
424
|
exports.BasicCTError = index$1b.BasicCTError;
|