@baishuyun/ui-base 6.1.0 → 6.2.0
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/Amap/AmapProvider/index.js +3 -3
- package/dist/Amap/{AmapProvider-H1GNfMdk.js → AmapProvider-BgGnih_w.js} +1 -1
- package/dist/Amap/index.js +3 -3
- package/dist/Calendar/AllDaySection-DS0Frx1p.js +53 -0
- package/dist/Calendar/Calendar-CAG1Fxlh.js +806 -0
- package/dist/Calendar/CurrentTimeIndicator-DaIywtIA.js +59 -0
- package/dist/Calendar/EventCard-D_VeOVDQ.js +155 -0
- package/dist/Calendar/TimeAxis-gKb8dTwY.js +13 -0
- package/dist/Calendar/TimeGrid-D8Du5vFP.js +47 -0
- package/dist/Calendar/adapters/index.js +2 -0
- package/dist/Calendar/adapters-zYR7CgzD.js +20 -0
- package/dist/Calendar/colorUtils-DcpqM3KR.js +55 -0
- package/dist/Calendar/context/index.js +2 -0
- package/dist/Calendar/context-DNOJ9LW_.js +21 -0
- package/dist/Calendar/index.js +21 -0
- package/dist/Calendar/layout-DvWx_7gn.js +302 -0
- package/dist/Calendar/shared/AllDaySection/index.js +8 -0
- package/dist/Calendar/shared/CurrentTimeIndicator/index.js +5 -0
- package/dist/Calendar/shared/EventCard/index.js +6 -0
- package/dist/Calendar/shared/TimeAxis/index.js +4 -0
- package/dist/Calendar/shared/TimeGrid/index.js +4 -0
- package/dist/Calendar/style/index.js +2 -0
- package/dist/Calendar/style-hCRKx3m1.js +55 -0
- package/dist/Calendar/utils/index.js +114 -0
- package/dist/Calendar/utils/layout/index.js +3 -0
- package/dist/CheckBox/{CheckBox-D1aeCoQb.js → CheckBox-DIunYcfS.js} +1 -1
- package/dist/CheckBox/index.js +2 -2
- package/dist/ColorPicker/ColorPicker-CKqNqAsK.js +150 -0
- package/dist/ColorPicker/index.js +5 -4
- package/dist/ConfigProvider/index.js +2 -2
- package/dist/DatePicker/DatePicker-BIxiJQ_W.js +91 -0
- package/dist/DatePicker/DatePickerPanel-CsiEGC-1.js +217 -0
- package/dist/DatePicker/ensureDayjsPlugins-DZjJnZgo.js +16 -0
- package/dist/DatePicker/index.js +8 -0
- package/dist/DatePicker/pickerLocale-VqSP_iIm.js +15 -0
- package/dist/DatePicker/style/index.js +2 -0
- package/dist/DatePicker/style-DZaSSoNs.js +15 -0
- package/dist/DropDown/{DropDown-DNEQ5nQz.js → DropDown-BR-Tz58r.js} +5 -5
- package/dist/DropDown/index.js +6 -6
- package/dist/Editor/{Buttons-0qZ4g7Ig.js → Buttons-DdZg3jAa.js} +4 -4
- package/dist/Editor/ToolbarPlugin/Buttons/index.js +12 -11
- package/dist/Editor/index.js +12 -11
- package/dist/InputTag/index.js +1 -1
- package/dist/Loading/index.js +1 -1
- package/dist/NotFoundContent/index.js +1 -1
- package/dist/Radio/index.js +1 -1
- package/dist/Segmented/Segmented-BTW445jc.js +82 -0
- package/dist/Segmented/index.js +1 -1
- package/dist/Select/{Select-BSPmsIMh.js → Select-BGsQ-PVq.js} +7 -7
- package/dist/Select/{SelectInputSearch-Cj9Uubc4.js → SelectInputSearch-CraymTXM.js} +1 -1
- package/dist/Select/index.js +10 -10
- package/dist/Tabs/{Tabs-BVSzo2qS.js → Tabs-CPRNkfMo.js} +3 -3
- package/dist/Tabs/index.js +3 -3
- package/dist/Tooltip/Tooltip-RkD8fs0B.js +169 -0
- package/dist/Tooltip/index.js +2 -0
- package/dist/Tree/index.js +3 -3
- package/dist/components/Calendar/Calendar.d.ts +3 -0
- package/dist/components/Calendar/Header/CalendarHeader/CalendarHeader.d.ts +2 -0
- package/dist/components/Calendar/Header/CalendarHeaderLeft/CalendarHeaderLeft.d.ts +2 -0
- package/dist/components/Calendar/Header/DateDisplay/DateDisplay.d.ts +2 -0
- package/dist/components/Calendar/Header/DateDisplay/__tests__/DateDisplay.weekPicker.test.d.ts +1 -0
- package/dist/components/Calendar/Header/NavButton/NavButton.d.ts +6 -0
- package/dist/components/Calendar/Header/TodayButton/TodayButton.d.ts +2 -0
- package/dist/components/Calendar/__tests__/Calendar.contract.test.d.ts +1 -0
- package/dist/components/Calendar/__tests__/algorithm/monthLayoutAlgorithm.test.d.ts +1 -0
- package/dist/components/Calendar/__tests__/helpers/testFormatMessage.d.ts +2 -0
- package/dist/components/Calendar/adapters/__tests__/platformTheme.test.d.ts +1 -0
- package/dist/components/Calendar/adapters/index.d.ts +1 -0
- package/dist/components/Calendar/adapters/platformTheme.d.ts +29 -0
- package/dist/components/Calendar/constants.d.ts +12 -0
- package/dist/components/Calendar/context/CalendarContext.d.ts +29 -0
- package/dist/components/Calendar/context/index.d.ts +2 -0
- package/dist/components/Calendar/context/useCalendarContext.d.ts +3 -0
- package/dist/components/Calendar/index.d.ts +4 -0
- package/dist/components/Calendar/interface.d.ts +62 -0
- package/dist/components/Calendar/internalTypes.d.ts +56 -0
- package/dist/components/Calendar/panels/DayPanel/DayPanel.d.ts +3 -0
- package/dist/components/Calendar/panels/DayPanel/__tests__/CalendarDay.dayFilter.test.d.ts +1 -0
- package/dist/components/Calendar/panels/MonthPanel/MonthCell/MonthCell.d.ts +10 -0
- package/dist/components/Calendar/panels/MonthPanel/MonthCell/MonthCellPopover/MonthCellPopover.d.ts +10 -0
- package/dist/components/Calendar/panels/MonthPanel/MonthHeader/MonthHeader.d.ts +2 -0
- package/dist/components/Calendar/panels/MonthPanel/MonthPanel.d.ts +3 -0
- package/dist/components/Calendar/panels/MonthPanel/WeekEventLayer/MoreButton.d.ts +11 -0
- package/dist/components/Calendar/panels/MonthPanel/WeekEventLayer/WeekEventLayer.d.ts +3 -0
- package/dist/components/Calendar/panels/WeekPanel/WeekAllDaySection/WeekAllDaySection.d.ts +11 -0
- package/dist/components/Calendar/panels/WeekPanel/WeekHeader/WeekHeader.d.ts +6 -0
- package/dist/components/Calendar/panels/WeekPanel/WeekPanel.d.ts +3 -0
- package/dist/components/Calendar/shared/AllDaySection/AllDaySection.d.ts +7 -0
- package/dist/components/Calendar/shared/AllDaySection/index.d.ts +1 -0
- package/dist/components/Calendar/shared/CurrentTimeIndicator/CurrentTimeIndicator.d.ts +10 -0
- package/dist/components/Calendar/shared/CurrentTimeIndicator/__tests__/CurrentTimeIndicator.test.d.ts +1 -0
- package/dist/components/Calendar/shared/CurrentTimeIndicator/index.d.ts +1 -0
- package/dist/components/Calendar/shared/EventCard/EventCard.d.ts +22 -0
- package/dist/components/Calendar/shared/EventCard/__tests__/EventCard.tooltip.test.d.ts +1 -0
- package/dist/components/Calendar/shared/EventCard/index.d.ts +1 -0
- package/dist/components/Calendar/shared/TimeAxis/TimeAxis.d.ts +6 -0
- package/dist/components/Calendar/shared/TimeAxis/index.d.ts +1 -0
- package/dist/components/Calendar/shared/TimeGrid/TimeGrid.d.ts +11 -0
- package/dist/components/Calendar/shared/TimeGrid/index.d.ts +1 -0
- package/dist/components/Calendar/style/__tests__/resolveCalendarThemeVars.test.d.ts +1 -0
- package/dist/components/Calendar/style/__tests__/resolveScheduleColorVars.test.d.ts +1 -0
- package/dist/components/Calendar/style/__tests__/resolveSubcomponentThemes.test.d.ts +1 -0
- package/dist/components/Calendar/style/index.d.ts +5 -0
- package/dist/components/Calendar/style/resolveCalendarThemeVars.d.ts +2 -0
- package/dist/components/Calendar/style/resolveScheduleColorVars.d.ts +3 -0
- package/dist/components/Calendar/style/resolveSubcomponentThemes.d.ts +5 -0
- package/dist/components/Calendar/utils/__tests__/dateUtils.test.d.ts +1 -0
- package/dist/components/Calendar/utils/__tests__/eventUtils.contract.test.d.ts +1 -0
- package/dist/components/Calendar/utils/__tests__/normalizeData.test.d.ts +1 -0
- package/dist/components/Calendar/utils/colorUtils.d.ts +8 -0
- package/dist/components/Calendar/utils/dateUtils.d.ts +25 -0
- package/dist/components/Calendar/utils/eventUtils.d.ts +44 -0
- package/dist/components/Calendar/utils/index.d.ts +7 -0
- package/dist/components/Calendar/utils/layout/dayLayoutAlgorithm.d.ts +31 -0
- package/dist/components/Calendar/utils/layout/index.d.ts +3 -0
- package/dist/components/Calendar/utils/layout/monthLayoutAlgorithm.d.ts +59 -0
- package/dist/components/Calendar/utils/layout/weekLayoutAlgorithm.d.ts +7 -0
- package/dist/components/Calendar/utils/normalizeData.d.ts +7 -0
- package/dist/components/Calendar/utils/timeUtils.d.ts +27 -0
- package/dist/components/Calendar/utils/weekTimedLayout.d.ts +14 -0
- package/dist/components/ColorPicker/useFloatingColorPicker.d.ts +1 -23
- package/dist/components/DatePicker/DatePicker.d.ts +3 -0
- package/dist/components/DatePicker/DatePickerHeader/DatePickerHeader.d.ts +17 -0
- package/dist/components/DatePicker/DatePickerPanel/DatePickerPanel.d.ts +9 -0
- package/dist/components/DatePicker/MonthPicker/MonthPicker.d.ts +4 -0
- package/dist/components/DatePicker/TodayFooter/TodayFooter.d.ts +5 -0
- package/dist/components/DatePicker/YearPicker/YearPicker.d.ts +4 -0
- package/dist/components/DatePicker/__tests__/DatePicker.theme.test.d.ts +1 -0
- package/dist/components/DatePicker/__tests__/DatePickerPanel.dom.test.d.ts +1 -0
- package/dist/components/DatePicker/__tests__/DatePickerPanel.styles.test.d.ts +1 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/DatePicker/interface.d.ts +37 -0
- package/dist/components/DatePicker/style/__tests__/resolveDatePickerThemeVars.test.d.ts +1 -0
- package/dist/components/DatePicker/style/index.d.ts +1 -0
- package/dist/components/DatePicker/style/resolveDatePickerThemeVars.d.ts +2 -0
- package/dist/components/DatePicker/utils/__tests__/normalizePickerValue.test.d.ts +1 -0
- package/dist/components/DatePicker/utils/chunkArray.d.ts +1 -0
- package/dist/components/DatePicker/utils/ensureDayjsPlugins.d.ts +2 -0
- package/dist/components/DatePicker/utils/formatPickerLabel.d.ts +1 -0
- package/dist/components/DatePicker/utils/normalizePickerValue.d.ts +10 -0
- package/dist/components/DatePicker/utils/pickerConstants.d.ts +8 -0
- package/dist/components/DatePicker/utils/pickerLocale.d.ts +4 -0
- package/dist/components/Segmented/Segmented.type.d.ts +26 -0
- package/dist/components/Segmented/__tests__/Segmented.theme.test.d.ts +1 -0
- package/dist/components/Segmented/index.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +6 -0
- package/dist/components/Tooltip/Tooltip.type.d.ts +33 -0
- package/dist/components/Tooltip/__tests__/Tooltip.test.d.ts +1 -0
- package/dist/components/Tooltip/context/TooltipFloatingContext.d.ts +2 -0
- package/dist/components/Tooltip/index.d.ts +3 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/hooks/useFloatingOverlay.d.ts +20 -0
- package/dist/hooks/useLocale.d.ts +4 -2
- package/dist/index.js +36 -20
- package/dist/locale/LocaleContext.d.ts +2 -1
- package/dist/locale/formatLocaleMessage.d.ts +2 -0
- package/dist/locale/lang/en-US.json.d.ts +43 -1
- package/dist/locale/lang/zh-CN.json.d.ts +43 -1
- package/dist/locale/lang/zh-TW.json.d.ts +43 -1
- package/dist/style.css +1 -1
- package/dist/utils/cssVars.d.ts +1 -0
- package/dist/utils/mergeRefs.d.ts +4 -0
- package/dist/vendors/{ConfigProvider-Bd6SRQtO.js → ConfigProvider-aWr8b3e3.js} +121 -37
- package/dist/vendors/{LocaleContext-Jj_JGgi2.js → LocaleContext-CuXR7Y03.js} +52 -7
- package/dist/vendors/{Tree-D7ZZAwIg.js → Tree-BTQ25Pi7.js} +2 -2
- package/dist/vendors/cssVars-C4BlzyxA.js +6 -0
- package/dist/vendors/useFloatingOverlay-uxlI1G-V.js +26 -0
- package/dist/vendors/{useLocale-Mk0d7wNt.js → useLocale-DvdSwM9e.js} +1 -1
- package/package.json +7 -2
- package/dist/ColorPicker/ColorPicker-CFKvAzYa.js +0 -168
- package/dist/Segmented/Segmented-DkhT5_Ty.js +0 -73
- /package/dist/CheckBox/{CheckBox-BsihF-AN.js → CheckBox-CkVe5Boq.js} +0 -0
- /package/dist/InputTag/{InputTag-DcVn_bRl.js → InputTag-zP5QdId7.js} +0 -0
- /package/dist/Loading/{Loading-dsLWSWsE.js → Loading-WjmzBabh.js} +0 -0
- /package/dist/NotFoundContent/{NotFoundContent-DJUQ0_2D.js → NotFoundContent-7xV-zOG2.js} +0 -0
- /package/dist/Radio/{Radio-WNw-VqIS.js → Radio-DkrZHoG1.js} +0 -0
- /package/dist/vendors/{animations-C2i5EijE.js → animations-BmT0HT5q.js} +0 -0
- /package/dist/vendors/{color-CxdZwdYM.js → color-BeQo449h.js} +0 -0
- /package/dist/vendors/{useFloatingPortal-CDgiCnbb.js → useFloatingPortal-DsEtsAGW.js} +0 -0
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { t as e } from "../DatePicker/ensureDayjsPlugins-DZjJnZgo.js";
|
|
2
|
+
import t from "dayjs";
|
|
3
|
+
//#region src/components/Calendar/utils/normalizeData.ts
|
|
4
|
+
e();
|
|
5
|
+
var n = () => t(null), r = (e, t) => !!(t && e.$x?.$timezone === t), i = (e, i) => {
|
|
6
|
+
if (e == null || e === "") return n();
|
|
7
|
+
if (t.isDayjs(e)) return e.isValid() ? !i || r(e, i) ? e : e.tz(i) : n();
|
|
8
|
+
if (typeof e == "number" || e instanceof Date) {
|
|
9
|
+
let r = t(e);
|
|
10
|
+
return r.isValid() ? i ? r.tz(i) : r : n();
|
|
11
|
+
}
|
|
12
|
+
if (typeof e == "string") {
|
|
13
|
+
let r = t(e);
|
|
14
|
+
return r.isValid() ? i ? r.tz(i) : r : n();
|
|
15
|
+
}
|
|
16
|
+
return n();
|
|
17
|
+
}, a = (e, t = {}) => {
|
|
18
|
+
let { timeZone: n } = t;
|
|
19
|
+
return Array.isArray(e) ? e.map((e, t) => ({
|
|
20
|
+
id: e.id ?? t,
|
|
21
|
+
sourceIndex: t,
|
|
22
|
+
label: e.label ?? "",
|
|
23
|
+
startTime: i(e.startTime, n),
|
|
24
|
+
endTime: i(e.endTime, n),
|
|
25
|
+
color: e.color
|
|
26
|
+
})) : (process.env.NODE_ENV !== "production" && console.warn("[normalizeData] 无效入参", { data: e }), []);
|
|
27
|
+
}, o = (e) => e.id, s = (e, t) => {
|
|
28
|
+
let n = i(e.startTime, t), r = i(e.endTime, t);
|
|
29
|
+
return !n.isValid() || !r.isValid() ? !1 : !n.isSame(r, "day");
|
|
30
|
+
}, c = (e, t) => {
|
|
31
|
+
let n = [], r = [];
|
|
32
|
+
for (let i of e) s(i, t) ? n.push(i) : r.push(i);
|
|
33
|
+
return {
|
|
34
|
+
allDayEvents: n,
|
|
35
|
+
timedEvents: r
|
|
36
|
+
};
|
|
37
|
+
}, l = (e, t, n) => {
|
|
38
|
+
let r = i(e.startTime, t), a = i(e.endTime, t);
|
|
39
|
+
if (!r.isSame(a, "day")) return n("allDay");
|
|
40
|
+
let o = (e) => `${String(e.hour()).padStart(2, "0")}:${String(e.minute()).padStart(2, "0")}`;
|
|
41
|
+
return `${o(r)} - ${o(a)}`;
|
|
42
|
+
}, u = (e, t = 22, n = 4) => e * t + Math.max(0, e - 1) * n, d = (e) => ({
|
|
43
|
+
mode: "grid",
|
|
44
|
+
row: e.row,
|
|
45
|
+
startCol: e.startCol,
|
|
46
|
+
endCol: e.endCol
|
|
47
|
+
}), f = (e) => ({
|
|
48
|
+
mode: "absolute",
|
|
49
|
+
top: e.top,
|
|
50
|
+
height: e.height,
|
|
51
|
+
hOffset: e.left,
|
|
52
|
+
hSpan: e.width,
|
|
53
|
+
hIsPercent: e.isPercent,
|
|
54
|
+
isLastInColumn: e.isLastInColumn
|
|
55
|
+
}), p = (e, t, n, r) => !e.isValid() || !t.isValid() || !n.isValid() || !r.isValid() ? !1 : e.isSame(t) ? (e.isSame(n) || e.isAfter(n)) && e.isBefore(r) : e.isBefore(r) && t.isAfter(n), m = (e, t, n, r, a) => p(i(e, a), i(t, a), i(n, a), i(r, a)), h = 15, g = {
|
|
56
|
+
allowStackLayout: !0,
|
|
57
|
+
maxColumnsBeforeStack: 10
|
|
58
|
+
}, _ = (e, t) => i(e, t), v = (e, t) => {
|
|
59
|
+
let n = _(e.startTime, t), r = _(e.endTime, t);
|
|
60
|
+
return r.diff(n, "minute") < h ? n.add(h, "minute") : r;
|
|
61
|
+
}, y = (e, t, n) => {
|
|
62
|
+
let r = _(e.startTime, n), i = v(e, n), a = _(t.startTime, n), o = v(t, n);
|
|
63
|
+
return r.isBefore(o) && i.isAfter(a);
|
|
64
|
+
}, b = (e, t) => {
|
|
65
|
+
if (e.length === 0) return [];
|
|
66
|
+
let n = [...e].sort((e, n) => _(e.startTime, t).valueOf() - _(n.startTime, t).valueOf()), r = [], i = [n[0]], a = v(n[0], t);
|
|
67
|
+
for (let e = 1; e < n.length; e++) {
|
|
68
|
+
let o = n[e];
|
|
69
|
+
if (_(o.startTime, t).isBefore(a)) {
|
|
70
|
+
i.push(o);
|
|
71
|
+
let e = v(o, t);
|
|
72
|
+
e.isAfter(a) && (a = e);
|
|
73
|
+
} else r.push(i), i = [o], a = v(o, t);
|
|
74
|
+
}
|
|
75
|
+
return r.push(i), r;
|
|
76
|
+
}, x = (e, t) => {
|
|
77
|
+
let n = /* @__PURE__ */ new Map(), r = [], i = [...e].sort((e, n) => _(e.startTime, t).valueOf() - _(n.startTime, t).valueOf());
|
|
78
|
+
for (let e of i) {
|
|
79
|
+
let i = !1;
|
|
80
|
+
for (let a = 0; a < r.length; a++) if (r[a].every((n) => !y(n, e, t))) {
|
|
81
|
+
r[a].push(e), n.set(o(e), a), i = !0;
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
i || (r.push([e]), n.set(o(e), r.length - 1));
|
|
85
|
+
}
|
|
86
|
+
return n;
|
|
87
|
+
}, S = (e, t, n, r, i, a) => {
|
|
88
|
+
let s = n;
|
|
89
|
+
for (let n of r) {
|
|
90
|
+
if (o(n) === o(e)) continue;
|
|
91
|
+
let r = i.get(o(n));
|
|
92
|
+
r > t && y(e, n, a) && (s = Math.min(s, r));
|
|
93
|
+
}
|
|
94
|
+
return s - t;
|
|
95
|
+
}, C = (e, t, n = {}) => {
|
|
96
|
+
let { allowStackLayout: r, maxColumnsBeforeStack: i, timeZone: a } = {
|
|
97
|
+
...g,
|
|
98
|
+
...n
|
|
99
|
+
}, s = Math.max(...Array.from(t.values())) + 1, c = /* @__PURE__ */ new Map(), l = r && s > i;
|
|
100
|
+
for (let n of e) {
|
|
101
|
+
let r = o(n), i = t.get(r), u = S(n, i, s, e, t, a), d = i + u === s;
|
|
102
|
+
if (l) {
|
|
103
|
+
let e = i * 15;
|
|
104
|
+
c.set(r, {
|
|
105
|
+
left: e,
|
|
106
|
+
width: 85,
|
|
107
|
+
isPercent: !1,
|
|
108
|
+
isLastInColumn: d
|
|
109
|
+
});
|
|
110
|
+
} else {
|
|
111
|
+
let e = 100 / s;
|
|
112
|
+
c.set(r, {
|
|
113
|
+
left: i * e,
|
|
114
|
+
width: e * u,
|
|
115
|
+
isPercent: !0,
|
|
116
|
+
isLastInColumn: d
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return c;
|
|
121
|
+
}, w = (e, t, n = {}) => {
|
|
122
|
+
let { timeZone: r, ...i } = {
|
|
123
|
+
...g,
|
|
124
|
+
...n
|
|
125
|
+
}, { allDayEvents: a, timedEvents: s } = c(e, r), l = b(s, r), u = [];
|
|
126
|
+
for (let e of l) {
|
|
127
|
+
let n = x(e, r), a = C(e, n, {
|
|
128
|
+
...i,
|
|
129
|
+
timeZone: r
|
|
130
|
+
}), s = Math.max(...Array.from(n.values())) + 1;
|
|
131
|
+
for (let i of e) {
|
|
132
|
+
let e = _(i.startTime, r), c = _(i.endTime, r), l = e.hour() * 60 + e.minute(), d = c.hour() * 60 + c.minute(), f = Math.max(d - l, h), p = l / t.interval * t.rowHeight, m = f / t.interval * t.rowHeight, g = o(i), v = a.get(g);
|
|
133
|
+
u.push({
|
|
134
|
+
event: i,
|
|
135
|
+
top: p,
|
|
136
|
+
height: m,
|
|
137
|
+
left: v.left,
|
|
138
|
+
width: v.width,
|
|
139
|
+
isPercent: v.isPercent,
|
|
140
|
+
column: n.get(g),
|
|
141
|
+
totalColumns: s,
|
|
142
|
+
isLastInColumn: v.isLastInColumn
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
timedEvents: u,
|
|
148
|
+
allDayEvents: a
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/components/Calendar/utils/layout/weekLayoutAlgorithm.ts
|
|
153
|
+
function T(e, n, r) {
|
|
154
|
+
let a = i(e.startTime, r), o = i(e.endTime, r), s = n.add(7, "day"), c = a.isBefore(n) ? n : a, l = o.isAfter(s) ? s : o, u = n.utcOffset(), d = c.utcOffset(u), f = l.utcOffset(u), p = d.format("YYYY-MM-DD"), m = n.format("YYYY-MM-DD"), h = t(p).diff(m, "day"), g = t(f.hour() === 0 && f.minute() === 0 && f.second() === 0 ? f.format("YYYY-MM-DD") : f.add(1, "day").format("YYYY-MM-DD")).diff(m, "day");
|
|
155
|
+
return {
|
|
156
|
+
event: e,
|
|
157
|
+
startCol: h,
|
|
158
|
+
endCol: g,
|
|
159
|
+
span: g - h
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function E(e, t) {
|
|
163
|
+
return e.startCol < t.endCol && e.endCol > t.startCol;
|
|
164
|
+
}
|
|
165
|
+
function D(e, t, n) {
|
|
166
|
+
if (!e || e.length === 0) return [];
|
|
167
|
+
let r = e.map((e) => T(e, t, n)).filter((e) => e.span > 0);
|
|
168
|
+
r.sort((e, t) => e.startCol === t.startCol ? t.span - e.span : e.startCol - t.startCol);
|
|
169
|
+
let i = [], a = [];
|
|
170
|
+
for (let e of r) {
|
|
171
|
+
let t = !1;
|
|
172
|
+
for (let n = 0; n < i.length; n++) if (!i[n].some((t) => E(t, e))) {
|
|
173
|
+
i[n].push(e), a.push({
|
|
174
|
+
...e,
|
|
175
|
+
row: n
|
|
176
|
+
}), t = !0;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
t || (i.push([e]), a.push({
|
|
180
|
+
...e,
|
|
181
|
+
row: i.length - 1
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
return a;
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/components/Calendar/utils/layout/monthLayoutAlgorithm.ts
|
|
188
|
+
var O = {
|
|
189
|
+
HEADER_HEIGHT: 34,
|
|
190
|
+
SLOT_HEIGHT: 22,
|
|
191
|
+
SLOT_GAP: 4,
|
|
192
|
+
WEEK_PADDING_X: 10,
|
|
193
|
+
EVENT_RIGHT_GAP: 4
|
|
194
|
+
};
|
|
195
|
+
function k(e) {
|
|
196
|
+
let { startCol: t, endCol: n, row: r } = e, { HEADER_HEIGHT: i, SLOT_HEIGHT: a, SLOT_GAP: o, EVENT_RIGHT_GAP: s, WEEK_PADDING_X: c } = O, l = 100 / 7, u = t > 0 ? c : 0;
|
|
197
|
+
return {
|
|
198
|
+
top: i + r * (a + o),
|
|
199
|
+
height: a,
|
|
200
|
+
left: `calc(${t * l}% + ${u}px)`,
|
|
201
|
+
width: `calc(${(n - t) * l}% - ${s + u}px)`
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function A(e, t, n, r) {
|
|
205
|
+
let a = i(e.startTime, r), o = i(e.endTime, r), s = t.add(n, "day"), c = a.isBefore(t) ? t : a, l = o.isAfter(s) ? s : o, u = c.diff(t, "day"), d = a.startOf("day").diff(t.startOf("day"), "day"), f = l.hour() === 0 && l.minute() === 0 && l.second() === 0, p = a.isSame(o) && !a.isBefore(t) && a.isBefore(s) ? u + 1 : f ? l.diff(t, "day") : l.diff(t, "day") + 1;
|
|
206
|
+
return {
|
|
207
|
+
event: e,
|
|
208
|
+
startDayIndex: u,
|
|
209
|
+
endDayIndex: p,
|
|
210
|
+
span: p - u,
|
|
211
|
+
originalStartDayIndex: d
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function j(e, t, n, r) {
|
|
215
|
+
return !e || e.length === 0 ? [] : e.map((e) => A(e, t, n, r));
|
|
216
|
+
}
|
|
217
|
+
function M(e) {
|
|
218
|
+
if (!e || e.length === 0) return /* @__PURE__ */ new Map();
|
|
219
|
+
let t = [...e].sort((e, t) => e.startDayIndex === t.startDayIndex ? t.span - e.span : e.startDayIndex - t.startDayIndex), n = /* @__PURE__ */ new Map(), r = [];
|
|
220
|
+
for (let e of t) {
|
|
221
|
+
let { event: t, startDayIndex: i, endDayIndex: a } = e, s = -1;
|
|
222
|
+
for (let e = 0; e <= r.length; e++) {
|
|
223
|
+
r[e] || (r[e] = []);
|
|
224
|
+
let t = !0;
|
|
225
|
+
for (let n = i; n < a; n++) if (r[e][n]) {
|
|
226
|
+
t = !1;
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
if (t) {
|
|
230
|
+
s = e;
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
r[s] || (r[s] = []);
|
|
235
|
+
let c = o(t);
|
|
236
|
+
for (let e = i; e < a; e++) r[s][e] = c;
|
|
237
|
+
n.set(c, s);
|
|
238
|
+
}
|
|
239
|
+
return n;
|
|
240
|
+
}
|
|
241
|
+
function N(e, t, n, r) {
|
|
242
|
+
return !e || e.length === 0 ? /* @__PURE__ */ new Map() : M(j(e, t, n, r));
|
|
243
|
+
}
|
|
244
|
+
function P(e, t) {
|
|
245
|
+
let { event: n, startDayIndex: r, endDayIndex: i, originalStartDayIndex: a } = e, o = [], s = r;
|
|
246
|
+
for (; s < i;) {
|
|
247
|
+
let e = Math.floor(s / 7), r = (e + 1) * 7, c = Math.min(i, r), l = s % 7;
|
|
248
|
+
o.push({
|
|
249
|
+
event: n,
|
|
250
|
+
weekIndex: e,
|
|
251
|
+
startCol: l,
|
|
252
|
+
endCol: c - e * 7,
|
|
253
|
+
row: t,
|
|
254
|
+
isStart: s === a,
|
|
255
|
+
isEnd: c === i,
|
|
256
|
+
isWeekStart: l === 0
|
|
257
|
+
}), s = c;
|
|
258
|
+
}
|
|
259
|
+
return o;
|
|
260
|
+
}
|
|
261
|
+
function F(e, t, n, r, i, a, s) {
|
|
262
|
+
let c = /* @__PURE__ */ new Set(), l = a || j(t, n, r, s);
|
|
263
|
+
if (l.length === 0) return c;
|
|
264
|
+
let u = Array.from({ length: r }, () => []);
|
|
265
|
+
for (let e of l) for (let t = e.startDayIndex; t < e.endDayIndex; t++) u[t].push(e);
|
|
266
|
+
for (let t = 0; t < r; t++) {
|
|
267
|
+
let n = u[t].filter((e) => !c.has(o(e.event))), r = n.some((t) => e.get(o(t.event)) >= i) && i > 1 ? i - 1 : i;
|
|
268
|
+
for (let t of n) {
|
|
269
|
+
let n = o(t.event);
|
|
270
|
+
e.get(n) >= r && c.add(n);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return c;
|
|
274
|
+
}
|
|
275
|
+
function I(e, t, n = 6, r) {
|
|
276
|
+
let i = j(e, t, n * 7, r);
|
|
277
|
+
if (!e || e.length === 0) return {
|
|
278
|
+
weekLayouts: Array.from({ length: n }, () => []),
|
|
279
|
+
eventRowMap: /* @__PURE__ */ new Map(),
|
|
280
|
+
gridEvents: i
|
|
281
|
+
};
|
|
282
|
+
let a = M(i), s = Array.from({ length: n }, () => []);
|
|
283
|
+
for (let e of i) {
|
|
284
|
+
let t = P(e, a.get(o(e.event)));
|
|
285
|
+
for (let e of t) s[e.weekIndex].push(e);
|
|
286
|
+
}
|
|
287
|
+
return {
|
|
288
|
+
weekLayouts: s,
|
|
289
|
+
eventRowMap: a,
|
|
290
|
+
gridEvents: i
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function L(e, t, n) {
|
|
294
|
+
let r = Array(7).fill(0), i = Array.from({ length: 7 }, () => /* @__PURE__ */ new Set());
|
|
295
|
+
for (let a of e) {
|
|
296
|
+
let e = o(a.event);
|
|
297
|
+
if (t.has(e) || a.row >= n) for (let t = a.startCol; t < a.endCol; t++) i[t].has(e) || (i[t].add(e), r[t]++);
|
|
298
|
+
}
|
|
299
|
+
return r;
|
|
300
|
+
}
|
|
301
|
+
//#endregion
|
|
302
|
+
export { i as C, a as S, p as _, F as a, f as b, x as c, w as d, b as f, s as g, o as h, k as i, S as l, l as m, N as n, L as o, u as p, I as r, D as s, O as t, C as u, m as v, d as x, c as y };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "../../../Icon/Icon-BQ3Whub2.js";
|
|
2
|
+
import "../../../Tooltip/Tooltip-RkD8fs0B.js";
|
|
3
|
+
import "../../context-DNOJ9LW_.js";
|
|
4
|
+
import "../../../DatePicker/ensureDayjsPlugins-DZjJnZgo.js";
|
|
5
|
+
import "../../layout-DvWx_7gn.js";
|
|
6
|
+
import "../../EventCard-D_VeOVDQ.js";
|
|
7
|
+
import { t as e } from "../../AllDaySection-DS0Frx1p.js";
|
|
8
|
+
export { e as default };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { t as e } from "../vendors/cssVars-C4BlzyxA.js";
|
|
2
|
+
import { n as t } from "./colorUtils-DcpqM3KR.js";
|
|
3
|
+
//#region src/components/Calendar/style/resolveScheduleColorVars.ts
|
|
4
|
+
var n = (e, t, n) => {
|
|
5
|
+
let r = {};
|
|
6
|
+
return e && (r["--calendar-schedule-border"] = e), t && (r["--calendar-schedule-bg"] = t), n && (r["--calendar-schedule-hover"] = n), r;
|
|
7
|
+
}, r = (e) => {
|
|
8
|
+
if (!e) return {};
|
|
9
|
+
let r = t(e);
|
|
10
|
+
return n(e, r.normal, r.hover);
|
|
11
|
+
}, i = {
|
|
12
|
+
center: {
|
|
13
|
+
backgroundPosition: "50%",
|
|
14
|
+
backgroundSize: "contain"
|
|
15
|
+
},
|
|
16
|
+
stretch: {
|
|
17
|
+
backgroundPosition: "50%",
|
|
18
|
+
backgroundSize: "cover"
|
|
19
|
+
},
|
|
20
|
+
masterDrawingCenter: {
|
|
21
|
+
backgroundPosition: "50%",
|
|
22
|
+
backgroundSize: "100% 100%"
|
|
23
|
+
}
|
|
24
|
+
}, a = (t) => {
|
|
25
|
+
let n = {};
|
|
26
|
+
if (e(n, "--calendar-background-color", t.colorBgContainer), t.panelBgImage) {
|
|
27
|
+
let e = i[t.panelBgImagePosition ?? "center"] ?? i.center;
|
|
28
|
+
n["--calendar-background-image"] = `url(${t.panelBgImage})`, n["--calendar-background-position"] = e.backgroundPosition, n["--calendar-background-size"] = e.backgroundSize, n["--calendar-background-repeat"] = "no-repeat";
|
|
29
|
+
}
|
|
30
|
+
return n;
|
|
31
|
+
}, o = (t, i) => {
|
|
32
|
+
let o = { ...r(i) };
|
|
33
|
+
return !t || typeof t != "object" ? o : (Object.assign(o, a(t)), e(o, "--calendar-title-color", t.colorText), e(o, "--calendar-over-title-color", t.colorTextTertiary), e(o, "--calendar-specifically-color", t.colorTextQuaternary ?? t.colorTextTertiary), e(o, "--calendar-header-background", t.colorFillSecondary), e(o, "--calendar-highlight-color", t.colorPrimary), e(o, "--calendar-highlight-text-color", t.colorPrimaryText), e(o, "--calendar-border-color", t.colorSplit), e(o, "--calendar-more-record-color", t.colorLink), (t.eventBorderColor || t.eventBg || t.eventBgHover) && Object.assign(o, n(t.eventBorderColor, t.eventBg, t.eventBgHover)), o);
|
|
34
|
+
}, s = (e) => e.colorText !== void 0 || e.colorPrimary !== void 0 || e.colorFillSecondary !== void 0, c = (e) => e.datePickerColorBgContainer !== void 0 || e.datePickerWeekRangeBg !== void 0 || e.colorPrimary !== void 0 || e.colorText !== void 0 || e.colorTextTertiary !== void 0 || e.colorTextQuaternary !== void 0, l = (e) => {
|
|
35
|
+
if (!(!e || !s(e))) return {
|
|
36
|
+
colorText: e.colorText,
|
|
37
|
+
itemSelectedBg: e.colorPrimary,
|
|
38
|
+
itemHoverBg: e.colorPrimary,
|
|
39
|
+
itemHoverBorder: e.colorPrimary,
|
|
40
|
+
trackBg: e.colorFillSecondary
|
|
41
|
+
};
|
|
42
|
+
}, u = (e) => {
|
|
43
|
+
if (!(!e || !c(e))) return {
|
|
44
|
+
colorBgContainer: e.datePickerColorBgContainer,
|
|
45
|
+
colorPrimary: e.colorPrimary,
|
|
46
|
+
headerColor: e.colorText,
|
|
47
|
+
headerHoverColor: e.colorPrimary,
|
|
48
|
+
colorText: e.colorText,
|
|
49
|
+
colorTextTertiary: e.colorTextTertiary ?? e.colorTextQuaternary,
|
|
50
|
+
cellSelectedBg: e.colorPrimary,
|
|
51
|
+
weekRangeBg: e.datePickerWeekRangeBg
|
|
52
|
+
};
|
|
53
|
+
}, d = "#ff5631";
|
|
54
|
+
//#endregion
|
|
55
|
+
export { r as a, o as i, u as n, l as r, d as t };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { t as e } from "../../DatePicker/ensureDayjsPlugins-DZjJnZgo.js";
|
|
2
|
+
import { C as t, S as n, _ as r, a as i, b as a, c as o, d as s, f as c, g as l, h as u, i as d, l as f, m as p, n as m, o as h, p as g, r as _, s as v, t as y, u as b, v as x, x as S, y as C } from "../layout-DvWx_7gn.js";
|
|
3
|
+
import { n as w, t as T } from "../colorUtils-DcpqM3KR.js";
|
|
4
|
+
import E from "dayjs";
|
|
5
|
+
//#region src/components/Calendar/utils/dateUtils.ts
|
|
6
|
+
var D = (e, n) => t(e, n), O = (e) => String(e).padStart(2, "0"), k = (e, t) => {
|
|
7
|
+
let n = D(e, t), r = n.startOf("month").startOf("isoWeek"), i = n.endOf("month").endOf("isoWeek").diff(r, "day") + 1;
|
|
8
|
+
return {
|
|
9
|
+
gridStart: r,
|
|
10
|
+
weekCount: Math.ceil(i / 7)
|
|
11
|
+
};
|
|
12
|
+
}, A = (e, t) => t("fullDate", {
|
|
13
|
+
year: e.year(),
|
|
14
|
+
month: O(e.month() + 1),
|
|
15
|
+
day: O(e.date())
|
|
16
|
+
}), j = (e, t, n, r) => D(e, r).add(t, n).toDate(), M = (e, t) => D(e, t).startOf("isoWeek"), N = (e, t) => D(e, t).endOf("isoWeek").startOf("day"), P = (e, t, n) => {
|
|
17
|
+
let r = D(e, t);
|
|
18
|
+
return n("yearMonth", {
|
|
19
|
+
year: r.year(),
|
|
20
|
+
month: O(r.month() + 1)
|
|
21
|
+
});
|
|
22
|
+
}, F = (e, t, n) => A(D(e, t), n), I = (e, t, n) => {
|
|
23
|
+
let r = D(e, n);
|
|
24
|
+
return r.date() === 1 ? t("monthDay", {
|
|
25
|
+
month: r.month() + 1,
|
|
26
|
+
day: r.date()
|
|
27
|
+
}) : String(r.date());
|
|
28
|
+
}, L = (e, t, n, r) => {
|
|
29
|
+
let i = D(e, n), a = D(t, n);
|
|
30
|
+
return i.year() === a.year() ? i.month() === a.month() ? r("dayOnly", { day: i.date() }) : r("monthDay", {
|
|
31
|
+
month: i.month() + 1,
|
|
32
|
+
day: i.date()
|
|
33
|
+
}) : A(i, r);
|
|
34
|
+
}, R = (e, t, n) => j(e, t, "day", n), z = (e, t, n) => j(e, t, "week", n), B = (e, t, n) => j(e, t, "month", n), V = (e, t) => k(e, t).weekCount, H = (e, t) => {
|
|
35
|
+
let { gridStart: n, weekCount: r } = k(e, t);
|
|
36
|
+
return Array.from({ length: r * 7 }, (e, t) => n.add(t, "day"));
|
|
37
|
+
}, U = (e, t) => {
|
|
38
|
+
let { gridStart: n, weekCount: r } = k(e, t);
|
|
39
|
+
return {
|
|
40
|
+
start: n,
|
|
41
|
+
end: n.add(r * 7, "day")
|
|
42
|
+
};
|
|
43
|
+
}, W = (e, t) => {
|
|
44
|
+
let n = D(e, t);
|
|
45
|
+
return n.year() * 12 + n.month();
|
|
46
|
+
}, G = (e, t, n) => W(e, n) === W(t, n), K = (e, t, n) => {
|
|
47
|
+
if (t === "day") {
|
|
48
|
+
let t = D(e, n).startOf("day");
|
|
49
|
+
return {
|
|
50
|
+
start: t,
|
|
51
|
+
end: t.add(1, "day")
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (t === "week") {
|
|
55
|
+
let t = M(e, n);
|
|
56
|
+
return {
|
|
57
|
+
start: t,
|
|
58
|
+
end: t.add(7, "day")
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return t === "month" ? U(e, n) : {
|
|
62
|
+
start: null,
|
|
63
|
+
end: null
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/components/Calendar/utils/timeUtils.ts
|
|
68
|
+
e();
|
|
69
|
+
var q = {
|
|
70
|
+
short: {
|
|
71
|
+
interval: 60,
|
|
72
|
+
rowHeight: 60,
|
|
73
|
+
totalRows: 24
|
|
74
|
+
},
|
|
75
|
+
medium: {
|
|
76
|
+
interval: 30,
|
|
77
|
+
rowHeight: 104,
|
|
78
|
+
totalRows: 48
|
|
79
|
+
},
|
|
80
|
+
long: {
|
|
81
|
+
interval: 15,
|
|
82
|
+
rowHeight: 148,
|
|
83
|
+
totalRows: 96
|
|
84
|
+
}
|
|
85
|
+
}, J = (e) => q[e] || q.medium, Y = (e, t) => e / t.interval * t.rowHeight, X = (e) => e.totalRows * e.rowHeight, Z = (e, t) => {
|
|
86
|
+
let n = e * t.interval, r = Math.floor(n / 60), i = n % 60;
|
|
87
|
+
return `${String(r).padStart(2, "0")}:${String(i).padStart(2, "0")}`;
|
|
88
|
+
}, Q = (e) => e ? E().tz(e) : E(), $ = (e) => {
|
|
89
|
+
let t = e ? E().tz(e).utcOffset() : E().utcOffset(), n = t >= 0 ? "+" : "-", r = Math.abs(t), i = Math.floor(r / 60), a = r % 60;
|
|
90
|
+
return a === 0 ? `GMT${n}${i}` : `GMT${n}${i}:${String(a).padStart(2, "0")}`;
|
|
91
|
+
}, ee = (e, n) => {
|
|
92
|
+
let r = Q(n);
|
|
93
|
+
return t(e, n).isSame(r, "day");
|
|
94
|
+
}, te = (e, t) => {
|
|
95
|
+
let n = Q(t);
|
|
96
|
+
return Y(n.hour() * 60 + n.minute(), e);
|
|
97
|
+
}, ne = (e, n, i, a) => Array.from({ length: 7 }, (o, c) => {
|
|
98
|
+
let l = n.add(c, "day").startOf("day"), u = l.add(1, "day"), d = [];
|
|
99
|
+
for (let n of e) {
|
|
100
|
+
let e = t(n.startTime, a), i = t(n.endTime, a);
|
|
101
|
+
r(e, i, l, u) && d.push({
|
|
102
|
+
...n,
|
|
103
|
+
startTime: e.isBefore(l) ? l : e,
|
|
104
|
+
endTime: i.isAfter(u) ? u : i
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
let { timedEvents: f } = s(d, i, {
|
|
108
|
+
allowStackLayout: !0,
|
|
109
|
+
timeZone: a
|
|
110
|
+
});
|
|
111
|
+
return f;
|
|
112
|
+
});
|
|
113
|
+
//#endregion
|
|
114
|
+
export { T as COLOR_SCHEME, y as MONTH_LAYOUT_CONSTANTS, q as ZOOM_CONFIG, R as addDays, B as addMonths, z as addWeeks, v as assignAllDayRows, o as assignColumns, m as assignGlobalRows, _ as assignMonthEventRows, g as calcAllDaySectionHeight, f as calculateExpansion, b as calculateHorizontalLayout, s as calculateLayout, d as calculateSegmentPosition, i as computeVisibility, h as computeWeekHiddenCounts, I as formatCalendarDayNumber, p as formatEventTime, F as formatFullDate, Z as formatTimeLabel, L as formatWeekEndDate, P as formatYearMonth, u as getCalendarEventId, W as getCalendarMonthKey, w as getColorScheme, Q as getCurrentTimeInTZ, te as getCurrentTimeTop, H as getDynamicMonthViewDates, U as getMonthViewRange, V as getMonthWeekCount, $ as getTimeZoneLabel, X as getTotalHeight, K as getVisibleRangeByMode, N as getWeekEnd, M as getWeekStart, J as getZoomConfig, c as groupIntoClusters, l as isAllDayEvent, G as isCurrentMonth, ee as isToday, ne as layoutTimedEventsForWeek, Y as minutesToPixels, n as normalizeData, r as overlapsHalfOpenInstant, x as overlapsRangeHalfOpen, t as parseCalendarTime, C as partitionCalendarEvents, a as toAbsolutePosition, S as toGridPosition };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import "../../../DatePicker/ensureDayjsPlugins-DZjJnZgo.js";
|
|
2
|
+
import { a as e, c as t, d as n, f as r, i, l as a, n as o, o as s, r as c, s as l, t as u, u as d } from "../../layout-DvWx_7gn.js";
|
|
3
|
+
export { u as MONTH_LAYOUT_CONSTANTS, l as assignAllDayRows, t as assignColumns, o as assignGlobalRows, c as assignMonthEventRows, a as calculateExpansion, d as calculateHorizontalLayout, n as calculateLayout, i as calculateSegmentPosition, e as computeVisibility, s as computeWeekHiddenCounts, r as groupIntoClusters };
|
package/dist/CheckBox/index.js
CHANGED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { t as e } from "../Icon/Icon-BQ3Whub2.js";
|
|
2
|
+
import { t } from "../vendors/useFloatingOverlay-uxlI1G-V.js";
|
|
3
|
+
import { t as n } from "../vendors/useLocale-DvdSwM9e.js";
|
|
4
|
+
import { t as r } from "../vendors/color-BeQo449h.js";
|
|
5
|
+
import { n as i } from "../vendors/animations-BmT0HT5q.js";
|
|
6
|
+
import { isArray as a } from "lodash-es";
|
|
7
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
|
+
import { cloneElement as l, isValidElement as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
9
|
+
import { ColorPicker as m } from "antd";
|
|
10
|
+
import h from "clsx";
|
|
11
|
+
import { useControllableValue as g } from "ahooks";
|
|
12
|
+
import { AnimatePresence as _, motion as v } from "motion/react";
|
|
13
|
+
import { FloatingPortal as y } from "@floating-ui/react";
|
|
14
|
+
import b from "tinycolor2";
|
|
15
|
+
//#region src/components/ColorPicker/constants.ts
|
|
16
|
+
var x = [
|
|
17
|
+
"rgba(240, 102, 72, 1)",
|
|
18
|
+
"rgba(255, 197, 2, 1)",
|
|
19
|
+
"rgba(74, 204, 140, 1)",
|
|
20
|
+
"rgba(74, 192, 236, 1)",
|
|
21
|
+
"rgba(255, 153, 33, 1)",
|
|
22
|
+
"rgba(101, 101, 101, 1)",
|
|
23
|
+
"rgba(255, 156, 136, 1)",
|
|
24
|
+
"rgba(98, 98, 206, 1)",
|
|
25
|
+
"rgba(241, 104, 182, 1)",
|
|
26
|
+
"rgba(55, 103, 241, 1)",
|
|
27
|
+
"rgba(162, 206, 30, 1)",
|
|
28
|
+
"rgba(179, 179, 179, 1)",
|
|
29
|
+
"rgba(0, 0, 0, 1)",
|
|
30
|
+
"rgba(102, 102, 102, 1)",
|
|
31
|
+
"rgba(153, 153, 153, 1)",
|
|
32
|
+
"rgba(194, 194, 194, 1)",
|
|
33
|
+
"rgba(224, 224, 224, 1)",
|
|
34
|
+
"rgba(77, 96, 159, 1)"
|
|
35
|
+
], S = (e = "bottom-start") => t({ placement: e }), C = "_preview_11t7y_62", w = {
|
|
36
|
+
"bsy-color-picker__floating": "_bsy-color-picker__floating_11t7y_1",
|
|
37
|
+
"bsy-color-picker__content": "_bsy-color-picker__content_11t7y_4",
|
|
38
|
+
"bsy-color-picker__grid": "_bsy-color-picker__grid_11t7y_11",
|
|
39
|
+
"bsy-color-picker__preset-colors-title": "_bsy-color-picker__preset-colors-title_11t7y_15",
|
|
40
|
+
"bsy-color-picker__preset-colors-grid": "_bsy-color-picker__preset-colors-grid_11t7y_19",
|
|
41
|
+
"bsy-color-picker__preset-colors-item": "_bsy-color-picker__preset-colors-item_11t7y_24",
|
|
42
|
+
"bsy-color-picker__custom-color-title": "_bsy-color-picker__custom-color-title_11t7y_48",
|
|
43
|
+
"bsy-color-picker__custom-color-btn": "_bsy-color-picker__custom-color-btn_11t7y_52",
|
|
44
|
+
preview: C,
|
|
45
|
+
"bsy-color-picker__custom-color-btn--active": "_bsy-color-picker__custom-color-btn--active_11t7y_62",
|
|
46
|
+
"bsy-color-picker__custom-color-btn--preview": "_bsy-color-picker__custom-color-btn--preview_11t7y_66",
|
|
47
|
+
"bsy-color-picker__custom-color-content": "_bsy-color-picker__custom-color-content_11t7y_69",
|
|
48
|
+
"bsy-color-picker__check-icon": "_bsy-color-picker__check-icon_11t7y_73"
|
|
49
|
+
}, T = ({ currentColor: t, onColorSelect: n, options: i, style: a }) => /* @__PURE__ */ s("div", {
|
|
50
|
+
className: w["bsy-color-picker__preset-colors-grid"],
|
|
51
|
+
style: a,
|
|
52
|
+
children: i.map((i) => /* @__PURE__ */ s("div", {
|
|
53
|
+
className: w["bsy-color-picker__preset-colors-item"],
|
|
54
|
+
style: {
|
|
55
|
+
backgroundColor: i,
|
|
56
|
+
"--hover-color": b(i).setAlpha(.5).toRgbString()
|
|
57
|
+
},
|
|
58
|
+
onClick: () => n(i),
|
|
59
|
+
children: r(t, i) && /* @__PURE__ */ s(e, {
|
|
60
|
+
name: "checkthebox",
|
|
61
|
+
className: w["bsy-color-picker__check-icon"]
|
|
62
|
+
})
|
|
63
|
+
}, i))
|
|
64
|
+
}), E = (e) => {
|
|
65
|
+
let { children: t, placement: p = "bottom-start", disabled: m = !1, presetColors: h, getPopupContainer: b } = e, { t: C } = n(), [E, O] = g(e, { defaultValue: e.value }), { isOpen: k, refs: A, floatingStyles: j, getReferenceProps: M, getFloatingProps: N } = S(p), P = u(t) ? l(t, {
|
|
66
|
+
...M(),
|
|
67
|
+
ref: A.setReference,
|
|
68
|
+
disabled: m
|
|
69
|
+
}) : t, F = a(h) && h.length ? h : x, I = f(F.some((e) => r(e, E)) ? [] : [E]);
|
|
70
|
+
return /* @__PURE__ */ c(o, { children: [P, /* @__PURE__ */ s(y, {
|
|
71
|
+
root: d(() => k ? b?.() : void 0, [k, b]),
|
|
72
|
+
children: /* @__PURE__ */ s(_, { children: k && /* @__PURE__ */ s("div", {
|
|
73
|
+
ref: A.setFloating,
|
|
74
|
+
style: j,
|
|
75
|
+
...N(),
|
|
76
|
+
className: w["bsy-color-picker__floating"],
|
|
77
|
+
children: /* @__PURE__ */ s(v.div, {
|
|
78
|
+
...i,
|
|
79
|
+
children: /* @__PURE__ */ s("div", {
|
|
80
|
+
className: w["bsy-color-picker__content"],
|
|
81
|
+
children: /* @__PURE__ */ c("div", {
|
|
82
|
+
className: w["bsy-color-picker__grid"],
|
|
83
|
+
children: [/* @__PURE__ */ c("div", {
|
|
84
|
+
className: w["bsy-color-picker__preset-colors"],
|
|
85
|
+
children: [/* @__PURE__ */ s("div", {
|
|
86
|
+
className: w["bsy-color-picker__preset-colors-title"],
|
|
87
|
+
children: C("presetColors")
|
|
88
|
+
}), /* @__PURE__ */ s(T, {
|
|
89
|
+
currentColor: E,
|
|
90
|
+
onColorSelect: O,
|
|
91
|
+
options: F
|
|
92
|
+
})]
|
|
93
|
+
}), /* @__PURE__ */ s(D, {
|
|
94
|
+
value: E,
|
|
95
|
+
onChange: O,
|
|
96
|
+
onColorInput: e.onColorInput,
|
|
97
|
+
options: F,
|
|
98
|
+
list: I.current
|
|
99
|
+
})]
|
|
100
|
+
})
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
}) })
|
|
104
|
+
})] });
|
|
105
|
+
}, D = (t) => {
|
|
106
|
+
let { list: r } = t, [i, a] = p(), [o, l] = p(!1), { t: u } = n();
|
|
107
|
+
return /* @__PURE__ */ c("div", {
|
|
108
|
+
className: w["bsy-color-picker__custom-color"],
|
|
109
|
+
children: [/* @__PURE__ */ s("div", {
|
|
110
|
+
className: w["bsy-color-picker__custom-color-title"],
|
|
111
|
+
children: u("customColor")
|
|
112
|
+
}), /* @__PURE__ */ c("div", {
|
|
113
|
+
className: w["bsy-color-picker__custom-color-content"],
|
|
114
|
+
children: [/* @__PURE__ */ s(m, {
|
|
115
|
+
value: i,
|
|
116
|
+
onChange: (e) => {
|
|
117
|
+
let n = e.toRgbString();
|
|
118
|
+
a(n), t.onColorInput?.(n);
|
|
119
|
+
},
|
|
120
|
+
open: o,
|
|
121
|
+
onOpenChange: (e) => {
|
|
122
|
+
l(e), !e && i && (r.includes(i) || r.unshift(i), t.onChange(i), a(void 0));
|
|
123
|
+
},
|
|
124
|
+
children: /* @__PURE__ */ s("div", {
|
|
125
|
+
className: h(w["bsy-color-picker__custom-color-btn"], {
|
|
126
|
+
[w["bsy-color-picker__custom-color-btn--active"]]: o && !i,
|
|
127
|
+
[w["bsy-color-picker__custom-color-btn--preview"]]: !!i
|
|
128
|
+
}),
|
|
129
|
+
role: "button",
|
|
130
|
+
style: { backgroundColor: i || void 0 },
|
|
131
|
+
onClick: () => {
|
|
132
|
+
l(!0);
|
|
133
|
+
},
|
|
134
|
+
children: /* @__PURE__ */ s(e, {
|
|
135
|
+
name: "add",
|
|
136
|
+
style: { visibility: i ? "hidden" : "visible" }
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
}), /* @__PURE__ */ s(T, {
|
|
140
|
+
currentColor: t.value,
|
|
141
|
+
onColorSelect: t.onChange,
|
|
142
|
+
options: r.slice(0, 5),
|
|
143
|
+
style: { gridTemplateColumns: "repeat(5, 1fr)" }
|
|
144
|
+
})]
|
|
145
|
+
})]
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
E.displayName = "BsyColorPicker";
|
|
149
|
+
//#endregion
|
|
150
|
+
export { x as n, E as t };
|