@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.
@@ -139,7 +139,7 @@ const Time = React__default.forwardRef((props, ref) => {
139
139
  });
140
140
  const AbsoluteDate = React__default.forwardRef(
141
141
  (props, ref) => {
142
- const { range, minDate, maxDate, onChange, onOk } = props;
142
+ const { range, minDate, maxDate, maxRange, onChange, onOk } = props;
143
143
  const timeRef = useRef(null);
144
144
  useImperativeHandle(ref, () => {
145
145
  var _a;
@@ -158,6 +158,7 @@ const AbsoluteDate = React__default.forwardRef(
158
158
  range,
159
159
  minDate,
160
160
  maxDate,
161
+ maxRange,
161
162
  onChange
162
163
  }
163
164
  ), /* @__PURE__ */ React__default.createElement(
@@ -7,8 +7,9 @@ import Input from '../../core/Input/index.js';
7
7
  import { Typo } from '../../core/Typo/index.js';
8
8
  import useElementIntersectionRatio from '../../hooks/useElementIntersectionRatio.js';
9
9
  import useParrotTranslation from '../../hooks/useParrotTranslation.js';
10
+ import { parseNumberAndUnit } from '../../utils/unit.js';
10
11
  import dayjs from 'dayjs';
11
- import React__default, { useState, useEffect, useRef } from 'react';
12
+ import React__default, { useState, useEffect, useRef, useMemo } from 'react';
12
13
  import { getDiffMonthAndDate, getTime, checkDateNotInRange, getClassNameForDateBlock } from './common.js';
13
14
  import { CalendarStyle } from './DateRangePicker.style.js';
14
15
  import { getFirstDateOfMonth } from './utils.js';
@@ -77,6 +78,7 @@ const MonthItem = (props) => {
77
78
  highlightDay,
78
79
  minDate,
79
80
  maxDate,
81
+ maxRange,
80
82
  parentElement,
81
83
  onRangeChange,
82
84
  onMouseEnter
@@ -126,6 +128,74 @@ const MonthItem = (props) => {
126
128
  }
127
129
  onRangeChange(_range);
128
130
  }
131
+ const datesElements = useMemo(() => {
132
+ return initMonth.dates.map((date) => {
133
+ const _date = getTime(initYear, initMonth.month, date);
134
+ const { number: maxRangeNumber, unit: maxRangeUnit } = parseNumberAndUnit(maxRange || "") || {};
135
+ const dateNotIncludeInRange = checkDateNotInRange(
136
+ _date,
137
+ minDate,
138
+ maxDate
139
+ );
140
+ const isLimitRangeEnd = !!rangeStart && !rangeEnd;
141
+ const isDateBeforeRangeStart = isLimitRangeEnd ? _date.valueOf() < rangeStart.valueOf() : false;
142
+ const isDateNotIncludeInMaxRange = isLimitRangeEnd && maxRangeNumber && maxRangeUnit ? rangeStart.add(maxRangeNumber, maxRangeUnit).valueOf() <= _date.valueOf() : false;
143
+ const disabled = Boolean(isDateBeforeRangeStart || isDateNotIncludeInMaxRange) || !dateNotIncludeInRange;
144
+ const dateClassName = getClassNameForDateBlock(
145
+ range,
146
+ _date,
147
+ mapOfHighlightDay,
148
+ disabled
149
+ );
150
+ const highlightIndex = mapOfHighlightDay.get(_date.format("YYYY-MM-DD"));
151
+ const isFirstDayInWeek = _date.day() === 1;
152
+ const isLastDayInWeek = _date.day() === 0;
153
+ const isFirstDayInMonth = _date.date() === 1;
154
+ const isLastDayInMonth = _date.date() === _date.daysInMonth();
155
+ const isLastDayIsSingleDayInWeek = isLastDayInMonth && isFirstDayInWeek;
156
+ const isFirstHighlight = highlightIndex === 0 || isFirstDayInWeek || isFirstDayInMonth || isLastDayIsSingleDayInWeek;
157
+ const isLastHighlight = highlightIndex === Math.max(mapOfHighlightDay.size - 1, 0) || isLastDayInWeek || isLastDayInMonth;
158
+ return /* @__PURE__ */ React__default.createElement(
159
+ "span",
160
+ {
161
+ key: `date-${date}`,
162
+ className: cx(
163
+ "date-block",
164
+ dateClassName,
165
+ isFirstHighlight && "first-highlight",
166
+ isLastHighlight && "last-highlight"
167
+ ),
168
+ onClick: () => {
169
+ if (disabled) {
170
+ return;
171
+ }
172
+ clickDate(date);
173
+ },
174
+ onMouseEnter: () => {
175
+ if (disabled) {
176
+ onMouseEnter(null);
177
+ } else if (rangeStart && !rangeEnd) {
178
+ onMouseEnter(_date);
179
+ }
180
+ }
181
+ },
182
+ /* @__PURE__ */ React__default.createElement("span", { className: cx("date-text", dateClassName) }, date)
183
+ );
184
+ });
185
+ }, [
186
+ initMonth.dates,
187
+ initMonth.month,
188
+ initYear,
189
+ maxRange,
190
+ minDate,
191
+ maxDate,
192
+ rangeStart,
193
+ rangeEnd,
194
+ range,
195
+ mapOfHighlightDay,
196
+ clickDate,
197
+ onMouseEnter
198
+ ]);
129
199
  return /* @__PURE__ */ React__default.createElement("li", { className: "month-container", ref: containerRef }, /* @__PURE__ */ React__default.createElement(
130
200
  "header",
131
201
  {
@@ -133,62 +203,10 @@ const MonthItem = (props) => {
133
203
  ref: headerRef
134
204
  },
135
205
  getCalendarTitle(initMonth.month.toString(), parrotI18n.t, parrotI18n)
136
- ), /* @__PURE__ */ React__default.createElement("div", { className: "dates-in-month", ref: datesContainerRef }, new Array(initMonth.firstDateOfDay).fill(null).map((value, index) => /* @__PURE__ */ React__default.createElement("span", { key: `blank-date-${index}`, className: "blank" })), initMonth.dates.map((date) => {
137
- const _date = getTime(initYear, initMonth.month, date);
138
- const dateNotIncludeInRange = checkDateNotInRange(
139
- _date,
140
- minDate,
141
- maxDate
142
- );
143
- const disabled = Boolean(
144
- rangeStart && !rangeEnd && rangeStart.valueOf() > _date.valueOf()
145
- ) || !dateNotIncludeInRange;
146
- const dateClassName = getClassNameForDateBlock(
147
- range,
148
- _date,
149
- mapOfHighlightDay,
150
- disabled
151
- );
152
- const highlightIndex = mapOfHighlightDay.get(
153
- _date.format("YYYY-MM-DD")
154
- );
155
- const isFirstDayInWeek = _date.day() === 1;
156
- const isLastDayInWeek = _date.day() === 0;
157
- const isFirstDayInMonth = _date.date() === 1;
158
- const isLastDayInMonth = _date.date() === _date.daysInMonth();
159
- const isLastDayIsSingleDayInWeek = isLastDayInMonth && isFirstDayInWeek;
160
- const isFirstHighlight = highlightIndex === 0 || isFirstDayInWeek || isFirstDayInMonth || isLastDayIsSingleDayInWeek;
161
- const isLastHighlight = highlightIndex === Math.max(mapOfHighlightDay.size - 1, 0) || isLastDayInWeek || isLastDayInMonth;
162
- return /* @__PURE__ */ React__default.createElement(
163
- "span",
164
- {
165
- key: `date-${date}`,
166
- className: cx(
167
- "date-block",
168
- dateClassName,
169
- isFirstHighlight && "first-highlight",
170
- isLastHighlight && "last-highlight"
171
- ),
172
- onClick: () => {
173
- if (disabled) {
174
- return;
175
- }
176
- clickDate(date);
177
- },
178
- onMouseEnter: () => {
179
- if (disabled) {
180
- onMouseEnter(null);
181
- } else if (rangeStart && !rangeEnd) {
182
- onMouseEnter(_date);
183
- }
184
- }
185
- },
186
- /* @__PURE__ */ React__default.createElement("span", { className: cx("date-text", dateClassName) }, date)
187
- );
188
- })));
206
+ ), /* @__PURE__ */ React__default.createElement("div", { className: "dates-in-month", ref: datesContainerRef }, new Array(initMonth.firstDateOfDay).fill(null).map((value, index) => /* @__PURE__ */ React__default.createElement("span", { key: `blank-date-${index}`, className: "blank" })), datesElements));
189
207
  };
190
208
  const Month = (props) => {
191
- const { year, range, minDate, maxDate, onRangeChange } = props;
209
+ const { year, range, minDate, maxDate, maxRange, onRangeChange } = props;
192
210
  const monthContainerRef = useRef(null);
193
211
  const [month, setMonth] = useState([]);
194
212
  const [highlightDay, setHighlightDay] = useState(() => {
@@ -246,6 +264,7 @@ const Month = (props) => {
246
264
  range,
247
265
  minDate,
248
266
  maxDate,
267
+ maxRange,
249
268
  highlightDay: highlightDay || controlHighlightDay || [],
250
269
  parentElement: monthContainerRef,
251
270
  onRangeChange,
@@ -259,7 +278,7 @@ const Week = () => {
259
278
  return /* @__PURE__ */ React__default.createElement(CalendarStyle.Week, null, /* @__PURE__ */ React__default.createElement("li", { className: Typo.Label.l1_regular }, t("components.monday-simple")), /* @__PURE__ */ React__default.createElement("li", { className: Typo.Label.l1_regular }, t("components.tuesday-simple")), /* @__PURE__ */ React__default.createElement("li", { className: Typo.Label.l1_regular }, t("components.wednesday-simple")), /* @__PURE__ */ React__default.createElement("li", { className: Typo.Label.l1_regular }, t("components.thursday-simple")), /* @__PURE__ */ React__default.createElement("li", { className: Typo.Label.l1_regular }, t("components.friday-simple")), /* @__PURE__ */ React__default.createElement("li", { className: Typo.Label.l1_regular }, t("components.saturday-simple")), /* @__PURE__ */ React__default.createElement("li", { className: Typo.Label.l1_regular }, t("components.sunday-simple")));
260
279
  };
261
280
  const Calendar = (props) => {
262
- const { range: initRange, minDate, maxDate, onChange } = props;
281
+ const { range: initRange, minDate, maxDate, maxRange, onChange } = props;
263
282
  const [year, setYear] = useState(dayjs().year());
264
283
  const [range, setRange] = useState(
265
284
  initRange || [null, null]
@@ -278,6 +297,7 @@ const Calendar = (props) => {
278
297
  range,
279
298
  minDate,
280
299
  maxDate,
300
+ maxRange,
281
301
  onRangeChange: handleRangeChange
282
302
  }
283
303
  ));
@@ -42,6 +42,7 @@ const TimeRange = (props) => {
42
42
  mode = ["relative", "absolute"],
43
43
  minDate,
44
44
  maxDate,
45
+ maxRange,
45
46
  onTypeChange,
46
47
  onRelativeTimeChange,
47
48
  onAbsoluteTimeOk,
@@ -101,6 +102,7 @@ const TimeRange = (props) => {
101
102
  range: range || [null, null],
102
103
  minDate,
103
104
  maxDate,
105
+ maxRange,
104
106
  onChange: (range2) => onAbsoluteTimeChange == null ? void 0 : onAbsoluteTimeChange(range2),
105
107
  onOk: (range2) => onAbsoluteTimeOk == null ? void 0 : onAbsoluteTimeOk(range2)
106
108
  }
@@ -152,6 +154,7 @@ const DateRangePicker = (props) => {
152
154
  mode = ["relative", "absolute"],
153
155
  minDate,
154
156
  maxDate,
157
+ maxRange,
155
158
  onChange,
156
159
  relativeTimeSelectOptions
157
160
  } = props;
@@ -286,6 +289,7 @@ const DateRangePicker = (props) => {
286
289
  mode,
287
290
  minDate,
288
291
  maxDate,
292
+ maxRange,
289
293
  onTypeChange: setType,
290
294
  onRelativeTimeChange: (time) => {
291
295
  handleChange("relative", time);
package/dist/esm/index.js CHANGED
@@ -79,7 +79,7 @@ export { default as Token, TokenPresetColors } from './core/Token/index.js';
79
79
  export { default as Tooltip } from './core/Tooltip/index.js';
80
80
  export { default as Truncate } from './core/Truncate/index.js';
81
81
  export { Antd5Dropdown } from './core/Antd5Dropdown/Antd5Dropdown.js';
82
- export { Antd5Tree } from './core/Antd5Tree/Antd5Tree.js';
82
+ export { Tree as Antd5Tree } from 'antd5';
83
83
  export { Architecture } from './core/Arch/arch.type.js';
84
84
  export { Banner } from './core/Banner/index.js';
85
85
  export { BasicCTError } from './core/BasicCTError/index.js';