@banzamel/mineralui 1.8.0 → 1.9.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/README.md +1 -1
- package/dist/{MAvatar-BcayQCnp.js → MAvatar-D_dVAPaR.js} +3 -3
- package/dist/{MAvatar-BcayQCnp.js.map → MAvatar-D_dVAPaR.js.map} +1 -1
- package/dist/{MAvatar-BgevCYi3.cjs → MAvatar-DzZPRbot.cjs} +2 -2
- package/dist/{MAvatar-BgevCYi3.cjs.map → MAvatar-DzZPRbot.cjs.map} +1 -1
- package/dist/MAvatarStack-CrhkO_SO.js +330 -0
- package/dist/MAvatarStack-CrhkO_SO.js.map +1 -0
- package/dist/MAvatarStack-DN79aJo1.cjs +2 -0
- package/dist/MAvatarStack-DN79aJo1.cjs.map +1 -0
- package/dist/{MButton-DZLLrtQb.js → MButton-C1pnL4_j.js} +2 -2
- package/dist/{MButton-DZLLrtQb.js.map → MButton-C1pnL4_j.js.map} +1 -1
- package/dist/{MButton-8UCydOik.cjs → MButton-DFRHWHzh.cjs} +2 -2
- package/dist/{MButton-8UCydOik.cjs.map → MButton-DFRHWHzh.cjs.map} +1 -1
- package/dist/{MDataTable-95_Mb6jE.cjs → MDataTable-7nJuwzJR.cjs} +2 -2
- package/dist/{MDataTable-95_Mb6jE.cjs.map → MDataTable-7nJuwzJR.cjs.map} +1 -1
- package/dist/{MDataTable-DxDS5auV.js → MDataTable-CQt_pINO.js} +4 -4
- package/dist/{MDataTable-DxDS5auV.js.map → MDataTable-CQt_pINO.js.map} +1 -1
- package/dist/{MDrawer-CXNHYwPO.js → MDrawer-B83--EVv.js} +2 -2
- package/dist/{MDrawer-CXNHYwPO.js.map → MDrawer-B83--EVv.js.map} +1 -1
- package/dist/{MDrawer-DzqtHVeA.cjs → MDrawer-D6cy9K7J.cjs} +2 -2
- package/dist/{MDrawer-DzqtHVeA.cjs.map → MDrawer-D6cy9K7J.cjs.map} +1 -1
- package/dist/MGrid-B-fP4GME.cjs +2 -0
- package/dist/MGrid-B-fP4GME.cjs.map +1 -0
- package/dist/{MGrid-DR0fHItF.js → MGrid-DVluuula.js} +56 -56
- package/dist/MGrid-DVluuula.js.map +1 -0
- package/dist/{MHeading-MPh8Qm9q.js → MHeading-B7KgSP4T.js} +3 -3
- package/dist/{MHeading-MPh8Qm9q.js.map → MHeading-B7KgSP4T.js.map} +1 -1
- package/dist/{MHeading-CKe5lcM_.cjs → MHeading-f3hwkW3r.cjs} +2 -2
- package/dist/{MHeading-CKe5lcM_.cjs.map → MHeading-f3hwkW3r.cjs.map} +1 -1
- package/dist/{MInput-D_zaoWwX.cjs → MInput-BLGduKL_.cjs} +2 -2
- package/dist/{MInput-D_zaoWwX.cjs.map → MInput-BLGduKL_.cjs.map} +1 -1
- package/dist/{MInput-7i0Dy1t4.js → MInput-IsUELgN2.js} +2 -2
- package/dist/{MInput-7i0Dy1t4.js.map → MInput-IsUELgN2.js.map} +1 -1
- package/dist/{MInputExpDate-DhO5zN7L.js → MInputExpDate-CeCmw6fj.js} +2 -2
- package/dist/{MInputExpDate-DhO5zN7L.js.map → MInputExpDate-CeCmw6fj.js.map} +1 -1
- package/dist/{MInputExpDate-DWWwjMYK.cjs → MInputExpDate-DZ8JtSjs.cjs} +2 -2
- package/dist/{MInputExpDate-DWWwjMYK.cjs.map → MInputExpDate-DZ8JtSjs.cjs.map} +1 -1
- package/dist/{MInputSearch-CmzHPnmC.js → MInputSearch-BBxUF5pw.js} +2 -2
- package/dist/{MInputSearch-CmzHPnmC.js.map → MInputSearch-BBxUF5pw.js.map} +1 -1
- package/dist/{MInputSearch-DpHSVpmL.cjs → MInputSearch-_7jfFGr1.cjs} +2 -2
- package/dist/{MInputSearch-DpHSVpmL.cjs.map → MInputSearch-_7jfFGr1.cjs.map} +1 -1
- package/dist/{MLink-rFKN1mcM.js → MLink-Bd8fLH1N.js} +2 -2
- package/dist/{MLink-rFKN1mcM.js.map → MLink-Bd8fLH1N.js.map} +1 -1
- package/dist/{MLink-B3ImjkJV.cjs → MLink-CRK8YvR4.cjs} +2 -2
- package/dist/{MLink-B3ImjkJV.cjs.map → MLink-CRK8YvR4.cjs.map} +1 -1
- package/dist/{MModal-DGmeQlWo.js → MModal-DiTjBO8B.js} +2 -2
- package/dist/{MModal-DGmeQlWo.js.map → MModal-DiTjBO8B.js.map} +1 -1
- package/dist/{MModal-CP0e31pv.cjs → MModal-eJDG6riB.cjs} +2 -2
- package/dist/{MModal-CP0e31pv.cjs.map → MModal-eJDG6riB.cjs.map} +1 -1
- package/dist/{MPagination-CS62B9kZ.cjs → MPagination-D1hYqLDb.cjs} +2 -2
- package/dist/{MPagination-CS62B9kZ.cjs.map → MPagination-D1hYqLDb.cjs.map} +1 -1
- package/dist/{MPagination-Dr110are.js → MPagination-DvToi2cs.js} +2 -2
- package/dist/{MPagination-Dr110are.js.map → MPagination-DvToi2cs.js.map} +1 -1
- package/dist/{MQrCode-B0-Np-N3.cjs → MQrCode-HO2YIC7e.cjs} +2 -2
- package/dist/{MQrCode-B0-Np-N3.cjs.map → MQrCode-HO2YIC7e.cjs.map} +1 -1
- package/dist/{MQrCode-6ANDcExA.js → MQrCode-Kb997gaE.js} +5 -5
- package/dist/{MQrCode-6ANDcExA.js.map → MQrCode-Kb997gaE.js.map} +1 -1
- package/dist/{MSkeleton-BvXgnYs_.js → MSkeleton-CVofhuDp.js} +3 -3
- package/dist/{MSkeleton-BvXgnYs_.js.map → MSkeleton-CVofhuDp.js.map} +1 -1
- package/dist/{MSkeleton-BdwhPx-k.cjs → MSkeleton-CuYA8eN3.cjs} +2 -2
- package/dist/{MSkeleton-BdwhPx-k.cjs.map → MSkeleton-CuYA8eN3.cjs.map} +1 -1
- package/dist/{MStack-DFIc3S4_.js → MStack-C4Eocfb5.js} +2 -2
- package/dist/{MStack-DFIc3S4_.js.map → MStack-C4Eocfb5.js.map} +1 -1
- package/dist/{MStack-ByFYGSsy.cjs → MStack-w8XcuIJK.cjs} +2 -2
- package/dist/{MStack-ByFYGSsy.cjs.map → MStack-w8XcuIJK.cjs.map} +1 -1
- package/dist/{MSubText-BFdfBlpS.js → MSubText-C-N15d4Z.js} +3 -3
- package/dist/{MSubText-BFdfBlpS.js.map → MSubText-C-N15d4Z.js.map} +1 -1
- package/dist/{MSubText-1ilKSz8e.cjs → MSubText-CIMKPb8o.cjs} +2 -2
- package/dist/{MSubText-1ilKSz8e.cjs.map → MSubText-CIMKPb8o.cjs.map} +1 -1
- package/dist/{MSurface-CpAuwpHv.cjs → MSurface-KvAS2hkl.cjs} +2 -2
- package/dist/{MSurface-CpAuwpHv.cjs.map → MSurface-KvAS2hkl.cjs.map} +1 -1
- package/dist/{MSurface-CmVIQC1A.js → MSurface-odrvQXkb.js} +2 -2
- package/dist/{MSurface-CmVIQC1A.js.map → MSurface-odrvQXkb.js.map} +1 -1
- package/dist/{MTag-DwQ-j1sV.cjs → MTag-DZqV4S13.cjs} +2 -2
- package/dist/{MTag-DwQ-j1sV.cjs.map → MTag-DZqV4S13.cjs.map} +1 -1
- package/dist/{MTag-C4SUJly2.js → MTag-DgB6ukFJ.js} +3 -3
- package/dist/{MTag-C4SUJly2.js.map → MTag-DgB6ukFJ.js.map} +1 -1
- package/dist/{MText-D0fI_D_Q.cjs → MText-BHbI7KJO.cjs} +2 -2
- package/dist/{MText-D0fI_D_Q.cjs.map → MText-BHbI7KJO.cjs.map} +1 -1
- package/dist/{MText-DcB1GAt-.js → MText-CL-LPcXi.js} +2 -2
- package/dist/{MText-DcB1GAt-.js.map → MText-CL-LPcXi.js.map} +1 -1
- package/dist/{cards-D7oHIHmU.js → cards-C50fpYud.js} +20 -16
- package/dist/cards-C50fpYud.js.map +1 -0
- package/dist/cards-Ci1FoV9C.cjs +2 -0
- package/dist/cards-Ci1FoV9C.cjs.map +1 -0
- package/dist/cards.cjs +1 -1
- package/dist/cards.js +3 -3
- package/dist/components/cards/MCardGrid/MCardGrid.types.d.ts +40 -1
- package/dist/components/cards/MCardGrid/index.d.ts +1 -1
- package/dist/components/cards/MStatCard/MStatCard.d.ts +0 -1
- package/dist/components/cards/MStatCard/MStatCard.types.d.ts +0 -2
- package/dist/components/cards/MStatCard/index.d.ts +2 -2
- package/dist/components/cards/index.d.ts +3 -3
- package/dist/components/data/MTimelineCalendar/DayStrip.d.ts +11 -0
- package/dist/components/data/MTimelineCalendar/EventPopover.d.ts +18 -0
- package/dist/components/data/MTimelineCalendar/MTimelineCalendar.d.ts +2 -0
- package/dist/components/data/MTimelineCalendar/MTimelineCalendar.helpers.d.ts +55 -0
- package/dist/components/data/MTimelineCalendar/MTimelineCalendar.types.d.ts +89 -0
- package/dist/components/data/MTimelineCalendar/index.d.ts +2 -0
- package/dist/components/data/index.d.ts +4 -0
- package/dist/components/layout/MGrid/MGrid.d.ts +1 -1
- package/dist/components/layout/MNavbar/MNavbar.d.ts +1 -1
- package/dist/components/layout/MNavbar/MNavbar.types.d.ts +19 -0
- package/dist/components/layout/index.d.ts +0 -4
- package/dist/components/media/MAvatarStack/MAvatarStack.d.ts +1 -1
- package/dist/components/media/MAvatarStack/MAvatarStack.types.d.ts +14 -1
- package/dist/components/typography/MHeading/MHeading.d.ts +1 -562
- package/dist/{controls-BfV0vxeJ.cjs → controls-CYQxPd4U.cjs} +2 -2
- package/dist/{controls-BfV0vxeJ.cjs.map → controls-CYQxPd4U.cjs.map} +1 -1
- package/dist/{controls-BczTk73I.js → controls-CcbEqqWo.js} +3 -3
- package/dist/{controls-BczTk73I.js.map → controls-CcbEqqWo.js.map} +1 -1
- package/dist/controls.cjs +1 -1
- package/dist/controls.js +2 -2
- package/dist/data-DtShJEic.cjs +2 -0
- package/dist/data-DtShJEic.cjs.map +1 -0
- package/dist/data-RXuvb9VI.js +3454 -0
- package/dist/data-RXuvb9VI.js.map +1 -0
- package/dist/data.cjs +1 -1
- package/dist/data.js +3 -3
- package/dist/{display-Cw3-bTsm.cjs → display-96-TEGmZ.cjs} +2 -2
- package/dist/{display-Cw3-bTsm.cjs.map → display-96-TEGmZ.cjs.map} +1 -1
- package/dist/{display-DyC7084n.js → display-C7YRf4Ze.js} +5 -5
- package/dist/{display-DyC7084n.js.map → display-C7YRf4Ze.js.map} +1 -1
- package/dist/display.cjs +1 -1
- package/dist/display.js +2 -2
- package/dist/{dropdowns-6eO0b6eI.cjs → dropdowns-Ce3Pb2JM.cjs} +2 -2
- package/dist/{dropdowns-6eO0b6eI.cjs.map → dropdowns-Ce3Pb2JM.cjs.map} +1 -1
- package/dist/{dropdowns-zXgrjNXZ.js → dropdowns-DfXhVlWQ.js} +4 -4
- package/dist/{dropdowns-zXgrjNXZ.js.map → dropdowns-DfXhVlWQ.js.map} +1 -1
- package/dist/dropdowns.cjs +1 -1
- package/dist/dropdowns.js +1 -1
- package/dist/{feedback-DfBjzJAw.js → feedback-DGT28-Zx.js} +11 -11
- package/dist/{feedback-DfBjzJAw.js.map → feedback-DGT28-Zx.js.map} +1 -1
- package/dist/{feedback-BvRmoSzV.cjs → feedback-Dr7G3K_R.cjs} +2 -2
- package/dist/{feedback-BvRmoSzV.cjs.map → feedback-Dr7G3K_R.cjs.map} +1 -1
- package/dist/feedback.cjs +1 -1
- package/dist/feedback.js +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.js +52 -52
- package/dist/index.js.map +1 -1
- package/dist/{inputs-C1I1SLZ8.cjs → inputs-BJMmyEdL.cjs} +2 -2
- package/dist/{inputs-C1I1SLZ8.cjs.map → inputs-BJMmyEdL.cjs.map} +1 -1
- package/dist/{inputs-Dy1WurNK.js → inputs-CNPeF6gb.js} +3 -3
- package/dist/{inputs-Dy1WurNK.js.map → inputs-CNPeF6gb.js.map} +1 -1
- package/dist/inputs.cjs +1 -1
- package/dist/inputs.js +4 -4
- package/dist/layout-dUrQeGc2.cjs +2 -0
- package/dist/layout-dUrQeGc2.cjs.map +1 -0
- package/dist/{layout-D1-mF4xn.js → layout-tIq6BGQK.js} +240 -301
- package/dist/layout-tIq6BGQK.js.map +1 -0
- package/dist/layout.cjs +1 -1
- package/dist/layout.js +8 -8
- package/dist/licensing-9sZ43Cif.cjs +2 -0
- package/dist/licensing-9sZ43Cif.cjs.map +1 -0
- package/dist/{licensing-ZFCUU4Z8.js → licensing-Bq78CLC_.js} +5 -5
- package/dist/licensing-Bq78CLC_.js.map +1 -0
- package/dist/media-BySr5LGc.cjs +2 -0
- package/dist/media-BySr5LGc.cjs.map +1 -0
- package/dist/media-IQ4iYTs-.js +391 -0
- package/dist/media-IQ4iYTs-.js.map +1 -0
- package/dist/media.cjs +1 -1
- package/dist/media.js +4 -4
- package/dist/{overlays-B0khU6Wb.js → overlays-BabXGLEM.js} +7 -7
- package/dist/{overlays-B0khU6Wb.js.map → overlays-BabXGLEM.js.map} +1 -1
- package/dist/{overlays-VAh5PqAe.cjs → overlays-CTR3n21O.cjs} +2 -2
- package/dist/{overlays-VAh5PqAe.cjs.map → overlays-CTR3n21O.cjs.map} +1 -1
- package/dist/overlays.cjs +1 -1
- package/dist/overlays.js +3 -3
- package/dist/style-runtime.cjs +1 -1
- package/dist/style-runtime.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/theme/MTheme.types.d.ts +5 -0
- package/dist/theme/responsive.d.ts +1 -10
- package/dist/{theme-D_f-cmSA.js → theme-DAOU1aPs.js} +4 -3
- package/dist/{theme-D_f-cmSA.js.map → theme-DAOU1aPs.js.map} +1 -1
- package/dist/{theme-BaroO-OB.cjs → theme-DsTDooyX.cjs} +2 -2
- package/dist/{theme-BaroO-OB.cjs.map → theme-DsTDooyX.cjs.map} +1 -1
- package/dist/theme.cjs +1 -1
- package/dist/theme.js +1 -1
- package/dist/{typography-CldwDFse.js → typography-CAW17MDj.js} +2 -2
- package/dist/{typography-CldwDFse.js.map → typography-CAW17MDj.js.map} +1 -1
- package/dist/{typography-D7COsP1O.cjs → typography-sbLuXqFn.cjs} +2 -2
- package/dist/{typography-D7COsP1O.cjs.map → typography-sbLuXqFn.cjs.map} +1 -1
- package/dist/typography.cjs +1 -1
- package/dist/typography.js +5 -5
- package/dist/utils/commandPaletteFromNavGroups.d.ts +74 -0
- package/dist/utils/licensing.d.ts +4 -4
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/dist/MGrid-C4kPZDSa.cjs +0 -2
- package/dist/MGrid-C4kPZDSa.cjs.map +0 -1
- package/dist/MGrid-DR0fHItF.js.map +0 -1
- package/dist/MImage-BZ6SrSao.cjs +0 -2
- package/dist/MImage-BZ6SrSao.cjs.map +0 -1
- package/dist/MImage-Btx_7g2Z.js +0 -257
- package/dist/MImage-Btx_7g2Z.js.map +0 -1
- package/dist/cards-B9g6Lf1n.cjs +0 -2
- package/dist/cards-B9g6Lf1n.cjs.map +0 -1
- package/dist/cards-D7oHIHmU.js.map +0 -1
- package/dist/components/layout/MAppMenu/MAppMenu.d.ts +0 -2
- package/dist/components/layout/MAppMenu/MAppMenu.types.d.ts +0 -63
- package/dist/components/layout/MAppMenu/index.d.ts +0 -2
- package/dist/data-7kG1MC1Z.cjs +0 -2
- package/dist/data-7kG1MC1Z.cjs.map +0 -1
- package/dist/data-z3e8XTSt.js +0 -2692
- package/dist/data-z3e8XTSt.js.map +0 -1
- package/dist/layout-D1-mF4xn.js.map +0 -1
- package/dist/layout-Op6GWQ8w.cjs +0 -2
- package/dist/layout-Op6GWQ8w.cjs.map +0 -1
- package/dist/licensing-DmF0ObpG.cjs +0 -2
- package/dist/licensing-DmF0ObpG.cjs.map +0 -1
- package/dist/licensing-ZFCUU4Z8.js.map +0 -1
- package/dist/media-DbToUupt.cjs +0 -2
- package/dist/media-DbToUupt.cjs.map +0 -1
- package/dist/media-DdChr0Cw.js +0 -431
- package/dist/media-DdChr0Cw.js.map +0 -1
- package/dist/utils/commandPaletteFromAppMenu.d.ts +0 -42
package/dist/data-z3e8XTSt.js
DELETED
|
@@ -1,2692 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./theme-D_f-cmSA.js";
|
|
2
|
-
import { $r as t, Ai as n, Ar as r, At as i, Br as a, Cr as o, Dr as s, Ei as c, Fr as l, Gr as u, Hr as d, Ir as f, Jr as p, Kr as m, Li as h, Lr as g, Mr as _, Or as v, Pr as y, Qr as b, Rr as x, Sr as S, Tr as C, Ur as w, Vr as T, Wr as E, Yr as D, br as O, cn as k, dn as A, ei as j, en as M, ii as ee, jr as te, jt as ne, kr as re, nn as ie, pi as ae, qr as oe, sn as se, ti as ce, tn as N, vr as le, wr as ue, xr as de, zr as fe } from "./icons-CfpYxnfg.js";
|
|
3
|
-
import { t as P } from "./cn-YER3QsV1.js";
|
|
4
|
-
import { t as pe } from "./MPortal-Ba2Sxset.js";
|
|
5
|
-
import { t as me } from "./MPopover-Cqz5TsHg.js";
|
|
6
|
-
import { n as he, t as ge } from "./MStack-DFIc3S4_.js";
|
|
7
|
-
import { t as F } from "./MText-DcB1GAt-.js";
|
|
8
|
-
import { t as I } from "./MHeading-MPh8Qm9q.js";
|
|
9
|
-
import { t as _e } from "./MSubText-BFdfBlpS.js";
|
|
10
|
-
import { r as L, t as R } from "./MButton-DZLLrtQb.js";
|
|
11
|
-
import { t as ve } from "./MCheckbox-B7SpcD4H.js";
|
|
12
|
-
import { n as ye, r as z, s as B } from "./MSkeleton-BvXgnYs_.js";
|
|
13
|
-
import { t as be } from "./MModal-DGmeQlWo.js";
|
|
14
|
-
import { t as xe } from "./MInputSearch-CmzHPnmC.js";
|
|
15
|
-
import { t as Se } from "./MTooltip-jSf4VBtB.js";
|
|
16
|
-
import { i as Ce, r as we } from "./MDropdownMenu-CeiC1tz3.js";
|
|
17
|
-
import { t as Te } from "./locale-CS1-IY_I.js";
|
|
18
|
-
import { t as V } from "./MTimeAgo-Db8gOade.js";
|
|
19
|
-
import { t as H } from "./MImage-Btx_7g2Z.js";
|
|
20
|
-
import { t as U } from "./MAvatar-BcayQCnp.js";
|
|
21
|
-
import { a as W, c as G, d as Ee, f as De, i as Oe, l as ke, o as Ae, p as je, r as Me, s as Ne, t as Pe, u as Fe } from "./MTreeView-AqH8XMPz.js";
|
|
22
|
-
import { a as Ie, r as Le, t as Re } from "./frameworkTexts-BTFyhWFD.js";
|
|
23
|
-
import { t as ze } from "./MTabs-BQZ--mMq.js";
|
|
24
|
-
import { Children as Be, createContext as Ve, isValidElement as He, useCallback as K, useContext as Ue, useEffect as We, useMemo as q, useRef as J, useState as Y } from "react";
|
|
25
|
-
import { Fragment as Ge, jsx as X, jsxs as Z } from "react/jsx-runtime";
|
|
26
|
-
//#region src/components/data/MChat/MChatContext.ts
|
|
27
|
-
var Ke = Ve({});
|
|
28
|
-
function qe() {
|
|
29
|
-
return Ue(Ke);
|
|
30
|
-
}
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region src/components/data/MChat/MChat.tsx
|
|
33
|
-
function Je(e, t) {
|
|
34
|
-
return He(e) && !!e.type[t];
|
|
35
|
-
}
|
|
36
|
-
function Ye({ variant: e = "inline", open: t, onToggle: n, unreadCount: r, color: a = "primary", className: o, children: s, ...c }) {
|
|
37
|
-
let l = null, u = null, d = [];
|
|
38
|
-
Be.forEach(s, (e) => {
|
|
39
|
-
if (Je(e, "__chatHeader")) {
|
|
40
|
-
l = e;
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (Je(e, "__chatConversationList")) {
|
|
44
|
-
u = e;
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
d.push(e);
|
|
48
|
-
});
|
|
49
|
-
let f = q(() => ({ color: a }), [a]), p = /* @__PURE__ */ X(Ke.Provider, {
|
|
50
|
-
value: f,
|
|
51
|
-
children: /* @__PURE__ */ Z("div", {
|
|
52
|
-
className: P("chat", e, `color-${a}`, e === "floating" && t && "open", o),
|
|
53
|
-
...c,
|
|
54
|
-
children: [u && /* @__PURE__ */ X("div", {
|
|
55
|
-
className: "chat-sidebar",
|
|
56
|
-
children: u
|
|
57
|
-
}), /* @__PURE__ */ Z("div", {
|
|
58
|
-
className: "chat-main",
|
|
59
|
-
children: [l, d]
|
|
60
|
-
})]
|
|
61
|
-
})
|
|
62
|
-
});
|
|
63
|
-
return e === "floating" ? /* @__PURE__ */ X(pe, { children: /* @__PURE__ */ Z("div", {
|
|
64
|
-
className: P("chat-floating-wrapper", t && "open"),
|
|
65
|
-
children: [t && p, /* @__PURE__ */ X(R, {
|
|
66
|
-
variant: "filled",
|
|
67
|
-
color: a,
|
|
68
|
-
shape: "circle",
|
|
69
|
-
size: "lg",
|
|
70
|
-
className: "chat-floating-trigger",
|
|
71
|
-
onClick: n,
|
|
72
|
-
"aria-label": t ? "Close chat" : "Open chat",
|
|
73
|
-
badge: !t && r ? r : void 0,
|
|
74
|
-
badgeColor: "error",
|
|
75
|
-
badgePulsing: !t && !!r,
|
|
76
|
-
children: /* @__PURE__ */ X(i, {})
|
|
77
|
-
})]
|
|
78
|
-
}) }) : p;
|
|
79
|
-
}
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/components/data/MChat/MChatHeader.tsx
|
|
82
|
-
function Xe({ bordered: e = !1, className: t, children: n, ...r }) {
|
|
83
|
-
return /* @__PURE__ */ X("div", {
|
|
84
|
-
className: P("chat-header", e && "bordered", t),
|
|
85
|
-
...r,
|
|
86
|
-
children: n
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
Xe.__chatHeader = !0;
|
|
90
|
-
//#endregion
|
|
91
|
-
//#region src/components/data/MChat/MChatMessage.tsx
|
|
92
|
-
function Ze({ status: e }) {
|
|
93
|
-
if (!e) return null;
|
|
94
|
-
let t = e === "delivered" || e === "read";
|
|
95
|
-
return /* @__PURE__ */ X("span", {
|
|
96
|
-
className: P("chat-status", e === "read" ? "chat-status-read" : ""),
|
|
97
|
-
"aria-label": e,
|
|
98
|
-
children: t ? "✓✓" : "✓"
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
function Qe({ message: e, showAvatar: t = !0, showTimestamp: n = !0, color: r, className: i, ...a }) {
|
|
102
|
-
let { content: o, sender: s, timestamp: c, status: l, isOwn: u, images: d } = e;
|
|
103
|
-
return /* @__PURE__ */ Z("div", {
|
|
104
|
-
className: P("chat-message", u && "own", r || void 0, i),
|
|
105
|
-
...a,
|
|
106
|
-
children: [t && !u && /* @__PURE__ */ X(U, {
|
|
107
|
-
src: s.avatar,
|
|
108
|
-
name: s.name,
|
|
109
|
-
size: "sm",
|
|
110
|
-
color: r,
|
|
111
|
-
className: "chat-message-avatar"
|
|
112
|
-
}), /* @__PURE__ */ Z("div", {
|
|
113
|
-
className: "chat-message-content",
|
|
114
|
-
children: [
|
|
115
|
-
!u && /* @__PURE__ */ X(F, {
|
|
116
|
-
className: "chat-message-sender",
|
|
117
|
-
color: "neutral",
|
|
118
|
-
children: s.name
|
|
119
|
-
}),
|
|
120
|
-
/* @__PURE__ */ Z("div", {
|
|
121
|
-
className: "chat-message-bubble",
|
|
122
|
-
children: [o && /* @__PURE__ */ X(F, { children: o }), d && d.length > 0 && /* @__PURE__ */ X("div", {
|
|
123
|
-
className: P("chat-message-images", d.length > 1 && "grid"),
|
|
124
|
-
children: d.map((e, t) => /* @__PURE__ */ X(H, {
|
|
125
|
-
src: e,
|
|
126
|
-
alt: "",
|
|
127
|
-
fit: "cover",
|
|
128
|
-
rounded: !0,
|
|
129
|
-
className: "chat-message-image"
|
|
130
|
-
}, t))
|
|
131
|
-
})]
|
|
132
|
-
}),
|
|
133
|
-
/* @__PURE__ */ Z("div", {
|
|
134
|
-
className: "chat-message-meta",
|
|
135
|
-
children: [u && /* @__PURE__ */ X(Ze, { status: l }), n && /* @__PURE__ */ X(_e, {
|
|
136
|
-
className: "chat-message-time",
|
|
137
|
-
children: /* @__PURE__ */ X(V, { value: c })
|
|
138
|
-
})]
|
|
139
|
-
})
|
|
140
|
-
]
|
|
141
|
-
})]
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
//#endregion
|
|
145
|
-
//#region src/components/data/MChat/MChatBody.tsx
|
|
146
|
-
function $e({ messages: e, onScrollTop: t, loading: n = !1, color: r, className: i, children: a, ...o }) {
|
|
147
|
-
let { color: s } = qe(), c = r ?? s, l = J(null), u = J(!0), d = J(0), f = K(() => {
|
|
148
|
-
let e = l.current;
|
|
149
|
-
e && (e.scrollTop = e.scrollHeight);
|
|
150
|
-
}, []);
|
|
151
|
-
return We(() => {
|
|
152
|
-
let t = e?.length ?? 0;
|
|
153
|
-
t > d.current && u.current && f(), d.current = t;
|
|
154
|
-
}, [e?.length, f]), We(() => {
|
|
155
|
-
f();
|
|
156
|
-
}, [f]), /* @__PURE__ */ Z("div", {
|
|
157
|
-
ref: l,
|
|
158
|
-
className: P("chat-body", i),
|
|
159
|
-
onScroll: () => {
|
|
160
|
-
let e = l.current;
|
|
161
|
-
e && (u.current = e.scrollHeight - e.scrollTop - e.clientHeight < 40, e.scrollTop < 40 && t && !n && t());
|
|
162
|
-
},
|
|
163
|
-
...o,
|
|
164
|
-
children: [
|
|
165
|
-
n && /* @__PURE__ */ X("div", {
|
|
166
|
-
className: "chat-body-loader",
|
|
167
|
-
children: /* @__PURE__ */ X(L, { size: "sm" })
|
|
168
|
-
}),
|
|
169
|
-
e?.map((e) => /* @__PURE__ */ X(Qe, {
|
|
170
|
-
message: e,
|
|
171
|
-
color: c
|
|
172
|
-
}, e.id)),
|
|
173
|
-
a
|
|
174
|
-
]
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
//#endregion
|
|
178
|
-
//#region src/components/data/MChat/emojis.ts
|
|
179
|
-
var et = [
|
|
180
|
-
{
|
|
181
|
-
label: "Smileys",
|
|
182
|
-
emojis: /* @__PURE__ */ "😀.😃.😄.😁.😆.😅.🤣.😂.🙂.😊.😇.🥰.😍.🤩.😘.😗.😋.😛.😜.🤪.😝.🤗.🤔.🫡.🤐.🤨.😐.😑.😶.🫠.😏.😒.🙄.😬.😮💨.🤥.😌.😔.😪.🤤.😴.😷.🤒.🤕.🤢.🤮.🤧.🥵.🥶.😵.🤯.🥳.🥸.😎.🤓.🧐".split(".")
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
label: "Gestures",
|
|
186
|
-
emojis: /* @__PURE__ */ "👋.🤚.🖐️.✋.🖖.🫱.🫲.👌.🤌.🤏.✌️.🤞.🫰.🤟.🤘.🤙.👈.👉.👆.👇.☝️.👍.👎.✊.👊.🤛.🤜.👏.🙌.🫶.👐.🤝".split(".")
|
|
187
|
-
},
|
|
188
|
-
{
|
|
189
|
-
label: "Hearts",
|
|
190
|
-
emojis: [
|
|
191
|
-
"❤️",
|
|
192
|
-
"🧡",
|
|
193
|
-
"💛",
|
|
194
|
-
"💚",
|
|
195
|
-
"💙",
|
|
196
|
-
"💜",
|
|
197
|
-
"🖤",
|
|
198
|
-
"🤍",
|
|
199
|
-
"🤎",
|
|
200
|
-
"💔",
|
|
201
|
-
"❤️🔥",
|
|
202
|
-
"❤️🩹",
|
|
203
|
-
"💕",
|
|
204
|
-
"💞",
|
|
205
|
-
"💓",
|
|
206
|
-
"💗",
|
|
207
|
-
"💖",
|
|
208
|
-
"💘",
|
|
209
|
-
"💝",
|
|
210
|
-
"💟"
|
|
211
|
-
]
|
|
212
|
-
},
|
|
213
|
-
{
|
|
214
|
-
label: "Objects",
|
|
215
|
-
emojis: [
|
|
216
|
-
"🔥",
|
|
217
|
-
"✨",
|
|
218
|
-
"🌟",
|
|
219
|
-
"💫",
|
|
220
|
-
"⚡",
|
|
221
|
-
"💥",
|
|
222
|
-
"🎉",
|
|
223
|
-
"🎊",
|
|
224
|
-
"🏆",
|
|
225
|
-
"🥇",
|
|
226
|
-
"🎯",
|
|
227
|
-
"💡",
|
|
228
|
-
"📌",
|
|
229
|
-
"📎",
|
|
230
|
-
"✅",
|
|
231
|
-
"❌",
|
|
232
|
-
"⭐",
|
|
233
|
-
"💬",
|
|
234
|
-
"👁️🗨️",
|
|
235
|
-
"🔔"
|
|
236
|
-
]
|
|
237
|
-
}
|
|
238
|
-
], tt = "image/png,image/jpeg,image/gif,image/webp";
|
|
239
|
-
function nt({ onSend: e, placeholder: t = "Type a message…", disabled: n = !1, showEmoji: r = !0, showAttach: i = !0, onTyping: a, color: o, className: s, ...l }) {
|
|
240
|
-
let { color: u } = qe(), d = o ?? u, [f, p] = Y(""), [m, g] = Y(!1), [_, v] = Y([]), [y, b] = Y([]), [x, S] = Y(!1), C = J(null), w = J(null), T = J(null), E = J(!1), D = J(void 0), O = K((e) => {
|
|
241
|
-
let t = e.filter((e) => e.type.startsWith("image/"));
|
|
242
|
-
t.length !== 0 && (v((e) => [...e, ...t]), t.forEach((e) => {
|
|
243
|
-
let t = URL.createObjectURL(e);
|
|
244
|
-
b((e) => [...e, t]);
|
|
245
|
-
}));
|
|
246
|
-
}, []), k = K((e) => {
|
|
247
|
-
b((t) => (URL.revokeObjectURL(t[e]), t.filter((t, n) => n !== e))), v((t) => t.filter((t, n) => n !== e));
|
|
248
|
-
}, []);
|
|
249
|
-
We(() => () => y.forEach((e) => URL.revokeObjectURL(e)), []);
|
|
250
|
-
let A = K(() => {
|
|
251
|
-
let t = f.trim();
|
|
252
|
-
!t && _.length === 0 || n || (e?.(t, _.length > 0 ? _ : void 0), p(""), v([]), b((e) => (e.forEach((e) => URL.revokeObjectURL(e)), [])), C.current && (C.current.style.height = "auto"), E.current && (E.current = !1, a?.(!1)));
|
|
253
|
-
}, [
|
|
254
|
-
f,
|
|
255
|
-
_,
|
|
256
|
-
n,
|
|
257
|
-
e,
|
|
258
|
-
a
|
|
259
|
-
]), j = (e) => {
|
|
260
|
-
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), A());
|
|
261
|
-
}, M = (e) => {
|
|
262
|
-
p(e.target.value), ee(e.target), a && (E.current || (E.current = !0, a(!0)), clearTimeout(D.current), D.current = setTimeout(() => {
|
|
263
|
-
E.current = !1, a(!1);
|
|
264
|
-
}, 1500));
|
|
265
|
-
}, ee = (e) => {
|
|
266
|
-
e.style.height = "auto", e.style.height = Math.min(e.scrollHeight, 120) + "px";
|
|
267
|
-
};
|
|
268
|
-
We(() => () => clearTimeout(D.current), []);
|
|
269
|
-
let te = (e) => {
|
|
270
|
-
p((t) => t + e), g(!1), C.current?.focus();
|
|
271
|
-
}, re = (e) => {
|
|
272
|
-
e.preventDefault(), S(!0);
|
|
273
|
-
}, ie = (e) => {
|
|
274
|
-
e.preventDefault(), S(!1);
|
|
275
|
-
}, ae = (e) => {
|
|
276
|
-
e.preventDefault(), S(!1), O(Array.from(e.dataTransfer.files));
|
|
277
|
-
}, oe = () => {
|
|
278
|
-
let e = T.current?.files;
|
|
279
|
-
e && O(Array.from(e)), T.current && (T.current.value = "");
|
|
280
|
-
}, se = f.trim() || _.length > 0;
|
|
281
|
-
return /* @__PURE__ */ Z("div", {
|
|
282
|
-
className: P("chat-input", x && "drag-over", s),
|
|
283
|
-
onDragOver: re,
|
|
284
|
-
onDragLeave: ie,
|
|
285
|
-
onDrop: ae,
|
|
286
|
-
...l,
|
|
287
|
-
children: [y.length > 0 && /* @__PURE__ */ X("div", {
|
|
288
|
-
className: "chat-input-previews",
|
|
289
|
-
children: y.map((e, t) => /* @__PURE__ */ Z("div", {
|
|
290
|
-
className: "chat-input-preview",
|
|
291
|
-
children: [/* @__PURE__ */ X(H, {
|
|
292
|
-
src: e,
|
|
293
|
-
alt: "",
|
|
294
|
-
fit: "cover",
|
|
295
|
-
rounded: !0,
|
|
296
|
-
className: "chat-input-preview-img"
|
|
297
|
-
}), /* @__PURE__ */ X("button", {
|
|
298
|
-
type: "button",
|
|
299
|
-
className: "chat-input-preview-remove",
|
|
300
|
-
onClick: () => k(t),
|
|
301
|
-
"aria-label": "Remove image",
|
|
302
|
-
children: /* @__PURE__ */ X(h, {})
|
|
303
|
-
})]
|
|
304
|
-
}, t))
|
|
305
|
-
}), /* @__PURE__ */ Z("div", {
|
|
306
|
-
className: "chat-input-field",
|
|
307
|
-
children: [
|
|
308
|
-
r && /* @__PURE__ */ Z(Ge, { children: [/* @__PURE__ */ X("button", {
|
|
309
|
-
ref: w,
|
|
310
|
-
type: "button",
|
|
311
|
-
className: "chat-input-emoji-trigger",
|
|
312
|
-
onClick: () => g((e) => !e),
|
|
313
|
-
"aria-label": "Emoji",
|
|
314
|
-
disabled: n,
|
|
315
|
-
children: "😊"
|
|
316
|
-
}), /* @__PURE__ */ X(me, {
|
|
317
|
-
open: m,
|
|
318
|
-
anchorRef: w,
|
|
319
|
-
onClose: () => g(!1),
|
|
320
|
-
placement: "top-start",
|
|
321
|
-
children: /* @__PURE__ */ X("div", {
|
|
322
|
-
className: "chat-emoji-picker",
|
|
323
|
-
children: et.map((e) => /* @__PURE__ */ Z("div", {
|
|
324
|
-
className: "chat-emoji-category",
|
|
325
|
-
children: [/* @__PURE__ */ X("div", {
|
|
326
|
-
className: "chat-emoji-category-label",
|
|
327
|
-
children: e.label
|
|
328
|
-
}), /* @__PURE__ */ X("div", {
|
|
329
|
-
className: "chat-emoji-grid",
|
|
330
|
-
children: e.emojis.map((e) => /* @__PURE__ */ X("button", {
|
|
331
|
-
type: "button",
|
|
332
|
-
className: "chat-emoji-btn",
|
|
333
|
-
onClick: () => te(e),
|
|
334
|
-
children: e
|
|
335
|
-
}, e))
|
|
336
|
-
})]
|
|
337
|
-
}, e.label))
|
|
338
|
-
})
|
|
339
|
-
})] }),
|
|
340
|
-
i && /* @__PURE__ */ Z(Ge, { children: [/* @__PURE__ */ X("input", {
|
|
341
|
-
ref: T,
|
|
342
|
-
type: "file",
|
|
343
|
-
accept: tt,
|
|
344
|
-
multiple: !0,
|
|
345
|
-
className: "chat-input-file-hidden",
|
|
346
|
-
onChange: oe,
|
|
347
|
-
tabIndex: -1
|
|
348
|
-
}), /* @__PURE__ */ X("button", {
|
|
349
|
-
type: "button",
|
|
350
|
-
className: "chat-input-attach-trigger",
|
|
351
|
-
onClick: () => T.current?.click(),
|
|
352
|
-
"aria-label": "Attach image",
|
|
353
|
-
disabled: n,
|
|
354
|
-
children: /* @__PURE__ */ X(c, { color: "inherit" })
|
|
355
|
-
})] }),
|
|
356
|
-
/* @__PURE__ */ X("textarea", {
|
|
357
|
-
ref: C,
|
|
358
|
-
className: "chat-input-textarea",
|
|
359
|
-
value: f,
|
|
360
|
-
onChange: M,
|
|
361
|
-
onKeyDown: j,
|
|
362
|
-
placeholder: t,
|
|
363
|
-
disabled: n,
|
|
364
|
-
rows: 1
|
|
365
|
-
}),
|
|
366
|
-
/* @__PURE__ */ X(R, {
|
|
367
|
-
variant: "filled",
|
|
368
|
-
size: "sm",
|
|
369
|
-
color: d ?? "primary",
|
|
370
|
-
iconOnly: !0,
|
|
371
|
-
shape: "circle",
|
|
372
|
-
className: "chat-input-send",
|
|
373
|
-
onClick: A,
|
|
374
|
-
disabled: n || !se,
|
|
375
|
-
"aria-label": "Send",
|
|
376
|
-
children: /* @__PURE__ */ X(ne, {})
|
|
377
|
-
})
|
|
378
|
-
]
|
|
379
|
-
})]
|
|
380
|
-
});
|
|
381
|
-
}
|
|
382
|
-
//#endregion
|
|
383
|
-
//#region src/components/data/MChat/MChatTypingIndicator.tsx
|
|
384
|
-
function rt({ users: e = [], visible: t = !0, className: n, ...r }) {
|
|
385
|
-
if (!t || e.length === 0) return null;
|
|
386
|
-
let i = e.length === 1 ? `${e[0].name} is typing` : e.length === 2 ? `${e[0].name} and ${e[1].name} are typing` : `${e[0].name} and ${e.length - 1} others are typing`;
|
|
387
|
-
return /* @__PURE__ */ Z("div", {
|
|
388
|
-
className: P("chat-typing", n),
|
|
389
|
-
"aria-label": i,
|
|
390
|
-
...r,
|
|
391
|
-
children: [e.length === 1 && /* @__PURE__ */ X(U, {
|
|
392
|
-
src: e[0].avatar,
|
|
393
|
-
name: e[0].name,
|
|
394
|
-
size: "sm",
|
|
395
|
-
className: "chat-typing-avatar"
|
|
396
|
-
}), /* @__PURE__ */ Z("div", {
|
|
397
|
-
className: "chat-typing-dots",
|
|
398
|
-
children: [
|
|
399
|
-
/* @__PURE__ */ X("span", { className: "chat-typing-dot" }),
|
|
400
|
-
/* @__PURE__ */ X("span", { className: "chat-typing-dot" }),
|
|
401
|
-
/* @__PURE__ */ X("span", { className: "chat-typing-dot" })
|
|
402
|
-
]
|
|
403
|
-
})]
|
|
404
|
-
});
|
|
405
|
-
}
|
|
406
|
-
//#endregion
|
|
407
|
-
//#region src/components/data/MChat/MChatConversationList.tsx
|
|
408
|
-
function it({ className: e, children: t, ...n }) {
|
|
409
|
-
return /* @__PURE__ */ X("div", {
|
|
410
|
-
className: P("chat-conversation-list", e),
|
|
411
|
-
...n,
|
|
412
|
-
children: t
|
|
413
|
-
});
|
|
414
|
-
}
|
|
415
|
-
it.__chatConversationList = !0;
|
|
416
|
-
//#endregion
|
|
417
|
-
//#region src/components/data/MChat/MChatConversationItem.tsx
|
|
418
|
-
function at({ conversation: e, active: t = !1, color: n, onClick: r, className: i, ...a }) {
|
|
419
|
-
let { color: o } = qe(), s = n ?? o, { title: c, participants: l, lastMessage: u, unreadCount: d } = e, f = c ?? l.map((e) => e.name).join(", "), p = l[0], m = l.some((e) => e.online);
|
|
420
|
-
return /* @__PURE__ */ Z("div", {
|
|
421
|
-
className: P("chat-conversation-item", t && "active", i),
|
|
422
|
-
onClick: () => r?.(e),
|
|
423
|
-
role: "button",
|
|
424
|
-
tabIndex: 0,
|
|
425
|
-
onKeyDown: (t) => {
|
|
426
|
-
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), r?.(e));
|
|
427
|
-
},
|
|
428
|
-
...a,
|
|
429
|
-
children: [/* @__PURE__ */ X(U, {
|
|
430
|
-
src: p?.avatar,
|
|
431
|
-
name: p?.name,
|
|
432
|
-
size: "md",
|
|
433
|
-
color: s,
|
|
434
|
-
badge: m,
|
|
435
|
-
badgeColor: "success",
|
|
436
|
-
className: "chat-conversation-avatar"
|
|
437
|
-
}), /* @__PURE__ */ Z("div", {
|
|
438
|
-
className: "chat-conversation-info",
|
|
439
|
-
children: [/* @__PURE__ */ Z("div", {
|
|
440
|
-
className: "chat-conversation-top",
|
|
441
|
-
children: [/* @__PURE__ */ X(F, {
|
|
442
|
-
className: "chat-conversation-name",
|
|
443
|
-
children: f
|
|
444
|
-
}), u && /* @__PURE__ */ X(_e, {
|
|
445
|
-
className: "chat-conversation-time",
|
|
446
|
-
children: /* @__PURE__ */ X(V, { value: u.timestamp })
|
|
447
|
-
})]
|
|
448
|
-
}), u && /* @__PURE__ */ Z("div", {
|
|
449
|
-
className: "chat-conversation-bottom",
|
|
450
|
-
children: [/* @__PURE__ */ Z(_e, {
|
|
451
|
-
className: "chat-conversation-preview",
|
|
452
|
-
children: [u.isOwn ? "You: " : "", u.content]
|
|
453
|
-
}), !!d && d > 0 && /* @__PURE__ */ X(B, {
|
|
454
|
-
color: s ?? "primary",
|
|
455
|
-
size: "sm",
|
|
456
|
-
rounded: !0,
|
|
457
|
-
children: d
|
|
458
|
-
})]
|
|
459
|
-
})]
|
|
460
|
-
})]
|
|
461
|
-
});
|
|
462
|
-
}
|
|
463
|
-
//#endregion
|
|
464
|
-
//#region src/components/data/MTaskList/MTaskList.tsx
|
|
465
|
-
function ot({ items: e, color: t = "primary", strikethrough: n = !0, onChange: r, className: i, ...a }) {
|
|
466
|
-
return /* @__PURE__ */ X("div", {
|
|
467
|
-
className: P("task list", `color-${t}`, i),
|
|
468
|
-
role: "list",
|
|
469
|
-
...a,
|
|
470
|
-
children: e.map((e) => /* @__PURE__ */ Z("div", {
|
|
471
|
-
className: P("task item", e.checked && "checked", e.disabled && "disabled"),
|
|
472
|
-
role: "listitem",
|
|
473
|
-
onClick: (t) => {
|
|
474
|
-
e.disabled || t.target.closest(".checkbox") || r?.(e.id, !(e.checked ?? !1));
|
|
475
|
-
},
|
|
476
|
-
children: [/* @__PURE__ */ X(ve, {
|
|
477
|
-
className: "task control",
|
|
478
|
-
checked: e.checked ?? !1,
|
|
479
|
-
color: t,
|
|
480
|
-
size: "sm",
|
|
481
|
-
disabled: e.disabled,
|
|
482
|
-
onChange: (t) => r?.(e.id, t.target.checked),
|
|
483
|
-
clickEffect: "ripple"
|
|
484
|
-
}), /* @__PURE__ */ X("span", {
|
|
485
|
-
className: P("task label", e.checked && n && "done"),
|
|
486
|
-
children: e.label
|
|
487
|
-
})]
|
|
488
|
-
}, e.id))
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
//#endregion
|
|
492
|
-
//#region src/components/data/MFileManager/MFileManager.tsx
|
|
493
|
-
var st = {
|
|
494
|
-
pdf: /* @__PURE__ */ X(j, {}),
|
|
495
|
-
ts: /* @__PURE__ */ X(w, {}),
|
|
496
|
-
tsx: /* @__PURE__ */ X(E, {}),
|
|
497
|
-
js: /* @__PURE__ */ X(te, {}),
|
|
498
|
-
jsx: /* @__PURE__ */ X(b, {}),
|
|
499
|
-
css: /* @__PURE__ */ X(ue, {}),
|
|
500
|
-
scss: /* @__PURE__ */ X(ue, {}),
|
|
501
|
-
html: /* @__PURE__ */ X(re, {}),
|
|
502
|
-
json: /* @__PURE__ */ X(_, {}),
|
|
503
|
-
md: /* @__PURE__ */ X(y, {}),
|
|
504
|
-
txt: /* @__PURE__ */ X(u, {}),
|
|
505
|
-
csv: /* @__PURE__ */ X(C, {}),
|
|
506
|
-
zip: /* @__PURE__ */ X(D, {}),
|
|
507
|
-
rar: /* @__PURE__ */ X(T, {}),
|
|
508
|
-
svg: /* @__PURE__ */ X(d, {}),
|
|
509
|
-
png: /* @__PURE__ */ X(fe, {}),
|
|
510
|
-
jpg: /* @__PURE__ */ X(r, {}),
|
|
511
|
-
jpeg: /* @__PURE__ */ X(t, {}),
|
|
512
|
-
gif: /* @__PURE__ */ X(v, {}),
|
|
513
|
-
webp: /* @__PURE__ */ X(m, {}),
|
|
514
|
-
php: /* @__PURE__ */ X(x, {}),
|
|
515
|
-
xml: /* @__PURE__ */ X(p, {}),
|
|
516
|
-
xls: /* @__PURE__ */ X(oe, {}),
|
|
517
|
-
ppt: /* @__PURE__ */ X(a, {}),
|
|
518
|
-
odt: /* @__PURE__ */ X(g, {}),
|
|
519
|
-
exe: /* @__PURE__ */ X(s, {}),
|
|
520
|
-
mp3: /* @__PURE__ */ X(l, {}),
|
|
521
|
-
mp4: /* @__PURE__ */ X(f, {})
|
|
522
|
-
};
|
|
523
|
-
function ct(e) {
|
|
524
|
-
let t = e.lastIndexOf(".");
|
|
525
|
-
return t < 1 ? null : e.slice(t + 1).toLowerCase();
|
|
526
|
-
}
|
|
527
|
-
function Q(e) {
|
|
528
|
-
return e?.kind === "folder" || !!e?.children?.length;
|
|
529
|
-
}
|
|
530
|
-
function lt(e) {
|
|
531
|
-
let t = ct(e);
|
|
532
|
-
return t ? st[t] ?? /* @__PURE__ */ X(ce, {}) : /* @__PURE__ */ X(ee, {});
|
|
533
|
-
}
|
|
534
|
-
function ut(e, t = !1) {
|
|
535
|
-
return e.icon ? e.icon : Q(e) ? X(t ? S : o, {}) : lt(e.label);
|
|
536
|
-
}
|
|
537
|
-
function dt(e) {
|
|
538
|
-
if (!e || e < 1) return null;
|
|
539
|
-
let t = [
|
|
540
|
-
"B",
|
|
541
|
-
"KB",
|
|
542
|
-
"MB",
|
|
543
|
-
"GB",
|
|
544
|
-
"TB"
|
|
545
|
-
], n = e, r = 0;
|
|
546
|
-
for (; n >= 1024 && r < t.length - 1;) n /= 1024, r += 1;
|
|
547
|
-
let i = n >= 100 || r === 0 ? 0 : 1;
|
|
548
|
-
return `${n.toFixed(i)} ${t[r]}`;
|
|
549
|
-
}
|
|
550
|
-
function ft(e, t) {
|
|
551
|
-
if (!e) return null;
|
|
552
|
-
let n = e instanceof Date ? e : new Date(e);
|
|
553
|
-
return Number.isNaN(n.getTime()) ? null : new Intl.DateTimeFormat(t, {
|
|
554
|
-
year: "numeric",
|
|
555
|
-
month: "short",
|
|
556
|
-
day: "numeric",
|
|
557
|
-
hour: "2-digit",
|
|
558
|
-
minute: "2-digit"
|
|
559
|
-
}).format(n);
|
|
560
|
-
}
|
|
561
|
-
function pt(e) {
|
|
562
|
-
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
563
|
-
function r(e, i) {
|
|
564
|
-
for (let a of e) t.set(a.id, a), n.set(a.id, i), a.children?.length && r(a.children, a.id);
|
|
565
|
-
}
|
|
566
|
-
return r(e, null), {
|
|
567
|
-
nodeMap: t,
|
|
568
|
-
parentMap: n
|
|
569
|
-
};
|
|
570
|
-
}
|
|
571
|
-
function mt(e) {
|
|
572
|
-
return e.flatMap((e) => Q(e) ? [{
|
|
573
|
-
...e,
|
|
574
|
-
kind: "folder",
|
|
575
|
-
children: mt(e.children ?? [])
|
|
576
|
-
}] : []);
|
|
577
|
-
}
|
|
578
|
-
function ht(e, t, n) {
|
|
579
|
-
let r = [], i = e;
|
|
580
|
-
for (; i;) {
|
|
581
|
-
let e = t.get(i);
|
|
582
|
-
if (!e) break;
|
|
583
|
-
r.unshift(e), i = n.get(i) ?? null;
|
|
584
|
-
}
|
|
585
|
-
return r;
|
|
586
|
-
}
|
|
587
|
-
function gt(e, t, n) {
|
|
588
|
-
if (!e) return null;
|
|
589
|
-
let r = t.get(e);
|
|
590
|
-
return r ? Q(r) ? r.id : n.get(r.id) ?? null : null;
|
|
591
|
-
}
|
|
592
|
-
function _t(e, t) {
|
|
593
|
-
return e ? e.children ?? [] : t;
|
|
594
|
-
}
|
|
595
|
-
function vt(e, t, n, r, i) {
|
|
596
|
-
let a = e ? t.get(e) ?? null : null, o = a ? n.get(a.id) ?? null : null;
|
|
597
|
-
return {
|
|
598
|
-
id: e,
|
|
599
|
-
node: a,
|
|
600
|
-
parentId: o,
|
|
601
|
-
parentNode: o ? t.get(o) ?? null : null,
|
|
602
|
-
activeFolderId: r,
|
|
603
|
-
activeFolder: i
|
|
604
|
-
};
|
|
605
|
-
}
|
|
606
|
-
function yt(e, t) {
|
|
607
|
-
return [
|
|
608
|
-
...Q(e) ? [] : [{
|
|
609
|
-
id: "download",
|
|
610
|
-
label: t.download,
|
|
611
|
-
icon: /* @__PURE__ */ X(N, {}),
|
|
612
|
-
color: "primary"
|
|
613
|
-
}],
|
|
614
|
-
{
|
|
615
|
-
id: "rename",
|
|
616
|
-
label: t.rename,
|
|
617
|
-
icon: /* @__PURE__ */ X(ie, {})
|
|
618
|
-
},
|
|
619
|
-
{
|
|
620
|
-
id: "move",
|
|
621
|
-
label: t.moveTo,
|
|
622
|
-
icon: /* @__PURE__ */ X(n, {})
|
|
623
|
-
},
|
|
624
|
-
{
|
|
625
|
-
id: "delete",
|
|
626
|
-
label: t.delete,
|
|
627
|
-
icon: /* @__PURE__ */ X(A, {}),
|
|
628
|
-
color: "error"
|
|
629
|
-
}
|
|
630
|
-
];
|
|
631
|
-
}
|
|
632
|
-
function bt(e, t) {
|
|
633
|
-
return [...Q(e) ? [{
|
|
634
|
-
id: "new-folder",
|
|
635
|
-
label: t.newFolder,
|
|
636
|
-
icon: /* @__PURE__ */ X(de, {})
|
|
637
|
-
}] : [], ...yt(e, t)];
|
|
638
|
-
}
|
|
639
|
-
function xt({ items: e, locale: t, defaultExpanded: n = [], expanded: r, onExpandChange: i, folderId: a, defaultFolderId: o = null, onFolderChange: s, selectedId: c, onSelectionChange: l, view: u, defaultView: d = "list", onViewChange: f, searchValue: p, defaultSearchValue: m = "", onSearchChange: h, searchable: g = !0, searchPlaceholder: _, showSidebar: v = !0, showPreview: y = !0, emptyText: b, toolbarActions: x = [], onToolbarAction: S, onOpenItem: C, onItemAction: w, onContextMenuAction: T, canDrop: E, onMove: D, renderPreview: O, className: k, ...A }) {
|
|
640
|
-
let j = Te(t), M = Ie(), [ee, te] = Y(o), [ne, re] = Y(null), [ie, ae] = Y(d), [oe, ce] = Y(m), { nodeMap: N, parentMap: ue } = q(() => pt(e), [e]), de = q(() => mt(e), [e]), fe = gt(a === void 0 ? ee : a, N, ue), pe = fe ? N.get(fe) ?? null : null, me = c === void 0 ? ne : c, I = me ? N.get(me) ?? null : null, _e = I ? I.id : null, L = u ?? ie, ve = p ?? oe, ye = _t(pe, e), z = ve.trim().toLowerCase(), be = ht(fe, N, ue), Se = _ ?? M.searchPlaceholder, V = b ?? M.emptyText, H = !!(w || T), U = q(() => z ? ye.filter((e) => e.label.toLowerCase().includes(z)) : ye, [ye, z]);
|
|
641
|
-
function W(e) {
|
|
642
|
-
let t = gt(e, N, ue), n = t ? N.get(t) ?? null : null;
|
|
643
|
-
s ? s(t, n) : te(t);
|
|
644
|
-
}
|
|
645
|
-
function G(e, t = fe, n = pe) {
|
|
646
|
-
let r = vt(e, N, ue, t, n);
|
|
647
|
-
l ? l(r) : re(e);
|
|
648
|
-
}
|
|
649
|
-
function Ee(e) {
|
|
650
|
-
f ? f(e) : ae(e);
|
|
651
|
-
}
|
|
652
|
-
function De(e) {
|
|
653
|
-
h ? h(e) : ce(e);
|
|
654
|
-
}
|
|
655
|
-
function Oe(e, t) {
|
|
656
|
-
W(e), G(e, t.id, t);
|
|
657
|
-
}
|
|
658
|
-
function ke(e) {
|
|
659
|
-
if (Q(e)) {
|
|
660
|
-
W(e.id), G(e.id, e.id, e);
|
|
661
|
-
return;
|
|
662
|
-
}
|
|
663
|
-
G(e.id);
|
|
664
|
-
}
|
|
665
|
-
function Ae(e) {
|
|
666
|
-
S && S({
|
|
667
|
-
...vt(_e, N, ue, fe, pe),
|
|
668
|
-
actionId: e,
|
|
669
|
-
visibleItems: U
|
|
670
|
-
});
|
|
671
|
-
}
|
|
672
|
-
function je(e, t) {
|
|
673
|
-
(w ?? T)?.(e, t);
|
|
674
|
-
}
|
|
675
|
-
function Me(e, t) {
|
|
676
|
-
(T ?? w)?.(e, t);
|
|
677
|
-
}
|
|
678
|
-
function Ne(e) {
|
|
679
|
-
let t = [], n = dt(e.size), r = ft(e.modifiedAt, j);
|
|
680
|
-
return Q(e) && t.push(M.itemsCount(e.children?.length ?? 0)), n && t.push(n), r && t.push(r), t.join(" / ");
|
|
681
|
-
}
|
|
682
|
-
return /* @__PURE__ */ Z("div", {
|
|
683
|
-
className: P("file-manager", !v && "no-sidebar", !y && "no-preview", k),
|
|
684
|
-
...A,
|
|
685
|
-
children: [/* @__PURE__ */ Z("div", {
|
|
686
|
-
className: "toolbar",
|
|
687
|
-
children: [/* @__PURE__ */ Z("div", {
|
|
688
|
-
className: "toolbar-main",
|
|
689
|
-
children: [/* @__PURE__ */ Z("div", {
|
|
690
|
-
className: "breadcrumbs",
|
|
691
|
-
children: [/* @__PURE__ */ Z("button", {
|
|
692
|
-
type: "button",
|
|
693
|
-
className: "breadcrumb root",
|
|
694
|
-
onClick: () => W(null),
|
|
695
|
-
children: [/* @__PURE__ */ X(le, {}), /* @__PURE__ */ X(F, {
|
|
696
|
-
as: "span",
|
|
697
|
-
weight: "semibold",
|
|
698
|
-
children: M.home
|
|
699
|
-
})]
|
|
700
|
-
}), be.map((e) => /* @__PURE__ */ Z("div", {
|
|
701
|
-
className: "breadcrumbs",
|
|
702
|
-
children: [/* @__PURE__ */ X("span", {
|
|
703
|
-
className: "breadcrumb-separator",
|
|
704
|
-
children: "/"
|
|
705
|
-
}), /* @__PURE__ */ X("button", {
|
|
706
|
-
type: "button",
|
|
707
|
-
className: "breadcrumb",
|
|
708
|
-
onClick: () => W(e.id),
|
|
709
|
-
children: /* @__PURE__ */ X(F, {
|
|
710
|
-
as: "span",
|
|
711
|
-
children: e.label
|
|
712
|
-
})
|
|
713
|
-
})]
|
|
714
|
-
}, e.id))]
|
|
715
|
-
}), g && /* @__PURE__ */ X(xe, {
|
|
716
|
-
className: "toolbar-search",
|
|
717
|
-
size: "sm",
|
|
718
|
-
placeholder: Se,
|
|
719
|
-
value: ve,
|
|
720
|
-
onChange: (e) => De(e.target.value),
|
|
721
|
-
onClear: () => De("")
|
|
722
|
-
})]
|
|
723
|
-
}), /* @__PURE__ */ Z("div", {
|
|
724
|
-
className: "toolbar-actions",
|
|
725
|
-
children: [x.map((e) => /* @__PURE__ */ X(R, {
|
|
726
|
-
size: "sm",
|
|
727
|
-
variant: e.variant ?? "ghost",
|
|
728
|
-
color: e.color,
|
|
729
|
-
disabled: e.disabled,
|
|
730
|
-
onClick: () => Ae(e.id),
|
|
731
|
-
startIcon: e.icon,
|
|
732
|
-
children: e.label
|
|
733
|
-
}, e.id)), /* @__PURE__ */ Z("div", {
|
|
734
|
-
className: "view-switch",
|
|
735
|
-
children: [/* @__PURE__ */ X(R, {
|
|
736
|
-
size: "sm",
|
|
737
|
-
variant: L === "list" ? "secondary" : "ghost",
|
|
738
|
-
onClick: () => Ee("list"),
|
|
739
|
-
children: M.listView
|
|
740
|
-
}), /* @__PURE__ */ X(R, {
|
|
741
|
-
size: "sm",
|
|
742
|
-
variant: L === "grid" ? "secondary" : "ghost",
|
|
743
|
-
onClick: () => Ee("grid"),
|
|
744
|
-
children: M.gridView
|
|
745
|
-
})]
|
|
746
|
-
})]
|
|
747
|
-
})]
|
|
748
|
-
}), /* @__PURE__ */ Z("div", {
|
|
749
|
-
className: "body",
|
|
750
|
-
children: [
|
|
751
|
-
v && /* @__PURE__ */ Z("aside", {
|
|
752
|
-
className: "panel",
|
|
753
|
-
children: [/* @__PURE__ */ Z("div", {
|
|
754
|
-
className: "panel-header",
|
|
755
|
-
children: [/* @__PURE__ */ X(F, {
|
|
756
|
-
weight: "semibold",
|
|
757
|
-
children: M.folders
|
|
758
|
-
}), /* @__PURE__ */ X(B, {
|
|
759
|
-
size: "sm",
|
|
760
|
-
color: "info",
|
|
761
|
-
children: de.length
|
|
762
|
-
})]
|
|
763
|
-
}), /* @__PURE__ */ X("div", {
|
|
764
|
-
className: "panel-body sidebar-body",
|
|
765
|
-
children: de.length > 0 ? /* @__PURE__ */ X(Pe, {
|
|
766
|
-
items: de,
|
|
767
|
-
selectable: !0,
|
|
768
|
-
fileIcons: !0,
|
|
769
|
-
defaultExpanded: n,
|
|
770
|
-
expanded: r,
|
|
771
|
-
onExpandChange: i,
|
|
772
|
-
selected: fe,
|
|
773
|
-
onSelect: (e, t) => Oe(e, t),
|
|
774
|
-
draggable: !!D,
|
|
775
|
-
canDrop: E ? (e, t) => E(e, t) : void 0,
|
|
776
|
-
onMove: D ? (e) => D({
|
|
777
|
-
draggedId: e.draggedId,
|
|
778
|
-
draggedNode: e.draggedNode,
|
|
779
|
-
targetId: e.targetId,
|
|
780
|
-
targetNode: e.targetNode
|
|
781
|
-
}) : void 0,
|
|
782
|
-
contextMenuItems: H ? (e) => bt(e, M) : void 0,
|
|
783
|
-
onContextMenuAction: H ? (e, t) => Me(e, t) : void 0
|
|
784
|
-
}) : /* @__PURE__ */ X("div", {
|
|
785
|
-
className: "empty-state",
|
|
786
|
-
children: M.noFoldersAvailable
|
|
787
|
-
})
|
|
788
|
-
})]
|
|
789
|
-
}),
|
|
790
|
-
/* @__PURE__ */ Z("section", {
|
|
791
|
-
className: "panel",
|
|
792
|
-
children: [/* @__PURE__ */ Z("div", {
|
|
793
|
-
className: "panel-header",
|
|
794
|
-
children: [/* @__PURE__ */ Z(he, {
|
|
795
|
-
align: "center",
|
|
796
|
-
wrap: "wrap",
|
|
797
|
-
children: [/* @__PURE__ */ X(F, {
|
|
798
|
-
weight: "semibold",
|
|
799
|
-
children: pe?.label ?? M.home
|
|
800
|
-
}), /* @__PURE__ */ X(B, {
|
|
801
|
-
size: "sm",
|
|
802
|
-
children: U.length
|
|
803
|
-
})]
|
|
804
|
-
}), /* @__PURE__ */ X(F, {
|
|
805
|
-
size: "sm",
|
|
806
|
-
tone: "muted",
|
|
807
|
-
children: z ? M.filteredBy(ve) : M.currentFolder
|
|
808
|
-
})]
|
|
809
|
-
}), /* @__PURE__ */ X("div", {
|
|
810
|
-
className: "panel-body",
|
|
811
|
-
children: U.length > 0 ? /* @__PURE__ */ X("div", {
|
|
812
|
-
className: P("content-items", L),
|
|
813
|
-
children: U.map((e) => {
|
|
814
|
-
let t = _e === e.id, n = Ne(e), r = H ? yt(e, M) : [];
|
|
815
|
-
return /* @__PURE__ */ Z("div", {
|
|
816
|
-
className: P("item-card", t && "selected"),
|
|
817
|
-
children: [/* @__PURE__ */ Z("button", {
|
|
818
|
-
type: "button",
|
|
819
|
-
className: "item-card-main",
|
|
820
|
-
onClick: () => ke(e),
|
|
821
|
-
onDoubleClick: () => C?.(e),
|
|
822
|
-
children: [/* @__PURE__ */ X("span", {
|
|
823
|
-
className: "item-icon",
|
|
824
|
-
children: ut(e)
|
|
825
|
-
}), /* @__PURE__ */ Z("span", {
|
|
826
|
-
className: "item-text",
|
|
827
|
-
children: [
|
|
828
|
-
/* @__PURE__ */ X(F, {
|
|
829
|
-
as: "span",
|
|
830
|
-
weight: "semibold",
|
|
831
|
-
truncate: !0,
|
|
832
|
-
children: e.label
|
|
833
|
-
}),
|
|
834
|
-
e.description ? /* @__PURE__ */ X(F, {
|
|
835
|
-
as: "span",
|
|
836
|
-
size: "sm",
|
|
837
|
-
tone: "muted",
|
|
838
|
-
truncate: 2,
|
|
839
|
-
children: e.description
|
|
840
|
-
}) : null,
|
|
841
|
-
/* @__PURE__ */ Z("span", {
|
|
842
|
-
className: "item-meta",
|
|
843
|
-
children: [/* @__PURE__ */ X(B, {
|
|
844
|
-
size: "sm",
|
|
845
|
-
color: Q(e) ? "info" : "primary",
|
|
846
|
-
children: Q(e) ? M.folder : M.file
|
|
847
|
-
}), n ? /* @__PURE__ */ X(F, {
|
|
848
|
-
as: "span",
|
|
849
|
-
size: "sm",
|
|
850
|
-
tone: "muted",
|
|
851
|
-
truncate: !0,
|
|
852
|
-
children: n
|
|
853
|
-
}) : null]
|
|
854
|
-
})
|
|
855
|
-
]
|
|
856
|
-
})]
|
|
857
|
-
}), r.length > 0 ? /* @__PURE__ */ X("div", {
|
|
858
|
-
className: "item-card-actions",
|
|
859
|
-
children: /* @__PURE__ */ X(Ce, {
|
|
860
|
-
placement: "bottom-end",
|
|
861
|
-
trigger: /* @__PURE__ */ X(R, {
|
|
862
|
-
"aria-label": `${M.preview}: ${e.label}`,
|
|
863
|
-
variant: "ghost",
|
|
864
|
-
size: "sm",
|
|
865
|
-
iconOnly: !0,
|
|
866
|
-
children: /* @__PURE__ */ X(se, {})
|
|
867
|
-
}),
|
|
868
|
-
children: r.map((t) => /* @__PURE__ */ X(we, {
|
|
869
|
-
icon: t.icon,
|
|
870
|
-
label: t.label,
|
|
871
|
-
color: t.color,
|
|
872
|
-
onClick: () => je(t.id, e)
|
|
873
|
-
}, t.id))
|
|
874
|
-
})
|
|
875
|
-
}) : null]
|
|
876
|
-
}, e.id);
|
|
877
|
-
})
|
|
878
|
-
}) : /* @__PURE__ */ X("div", {
|
|
879
|
-
className: "empty-state",
|
|
880
|
-
children: V
|
|
881
|
-
})
|
|
882
|
-
})]
|
|
883
|
-
}),
|
|
884
|
-
y && /* @__PURE__ */ Z("aside", {
|
|
885
|
-
className: "panel",
|
|
886
|
-
children: [/* @__PURE__ */ Z("div", {
|
|
887
|
-
className: "panel-header",
|
|
888
|
-
children: [/* @__PURE__ */ X(F, {
|
|
889
|
-
weight: "semibold",
|
|
890
|
-
children: M.preview
|
|
891
|
-
}), I ? /* @__PURE__ */ X(B, {
|
|
892
|
-
size: "sm",
|
|
893
|
-
color: Q(I) ? "info" : "primary",
|
|
894
|
-
children: Q(I) ? M.folder : M.file
|
|
895
|
-
}) : null]
|
|
896
|
-
}), /* @__PURE__ */ X("div", {
|
|
897
|
-
className: "panel-body",
|
|
898
|
-
children: I ? /* @__PURE__ */ Z(ge, { children: [
|
|
899
|
-
/* @__PURE__ */ X("div", {
|
|
900
|
-
className: "preview-visual",
|
|
901
|
-
children: O ? O(I) : I.preview ? I.preview : /* @__PURE__ */ X("span", {
|
|
902
|
-
className: "preview-icon",
|
|
903
|
-
children: ut(I, !0)
|
|
904
|
-
})
|
|
905
|
-
}),
|
|
906
|
-
/* @__PURE__ */ X(F, {
|
|
907
|
-
weight: "semibold",
|
|
908
|
-
children: I.label
|
|
909
|
-
}),
|
|
910
|
-
I.description ? /* @__PURE__ */ X(F, {
|
|
911
|
-
size: "sm",
|
|
912
|
-
tone: "muted",
|
|
913
|
-
children: I.description
|
|
914
|
-
}) : null,
|
|
915
|
-
/* @__PURE__ */ Z("div", {
|
|
916
|
-
className: "preview-meta",
|
|
917
|
-
children: [
|
|
918
|
-
/* @__PURE__ */ X(B, {
|
|
919
|
-
size: "sm",
|
|
920
|
-
color: Q(I) ? "info" : "primary",
|
|
921
|
-
children: Q(I) ? M.folder : M.file
|
|
922
|
-
}),
|
|
923
|
-
dt(I.size) ? /* @__PURE__ */ X(B, {
|
|
924
|
-
size: "sm",
|
|
925
|
-
children: dt(I.size)
|
|
926
|
-
}) : null,
|
|
927
|
-
ft(I.modifiedAt, j) ? /* @__PURE__ */ X(B, {
|
|
928
|
-
size: "sm",
|
|
929
|
-
color: "neutral",
|
|
930
|
-
children: ft(I.modifiedAt, j)
|
|
931
|
-
}) : null
|
|
932
|
-
]
|
|
933
|
-
}),
|
|
934
|
-
/* @__PURE__ */ Z(F, {
|
|
935
|
-
size: "sm",
|
|
936
|
-
tone: "muted",
|
|
937
|
-
children: [
|
|
938
|
-
M.path,
|
|
939
|
-
":",
|
|
940
|
-
" ",
|
|
941
|
-
[M.home, ...ht(I.id, N, ue).map((e) => e.label)].join(" / ")
|
|
942
|
-
]
|
|
943
|
-
})
|
|
944
|
-
] }) : /* @__PURE__ */ X("div", {
|
|
945
|
-
className: "preview-empty",
|
|
946
|
-
children: M.selectItemToInspect
|
|
947
|
-
})
|
|
948
|
-
})]
|
|
949
|
-
})
|
|
950
|
-
]
|
|
951
|
-
})]
|
|
952
|
-
});
|
|
953
|
-
}
|
|
954
|
-
//#endregion
|
|
955
|
-
//#region src/components/data/MCalendarBoard/MCalendarBoard.tsx
|
|
956
|
-
var St = 24, $ = 60, Ct = 56, wt = 110, Tt = 6, Et = ["rgba(14, 165, 233, 0.85)", "rgba(244, 63, 94, 0.85)"];
|
|
957
|
-
function Dt(e) {
|
|
958
|
-
return new Date(e.getFullYear(), e.getMonth(), e.getDate());
|
|
959
|
-
}
|
|
960
|
-
function Ot(e) {
|
|
961
|
-
if (!e) return null;
|
|
962
|
-
if (e instanceof Date) return Dt(e);
|
|
963
|
-
let t = new Date(e);
|
|
964
|
-
return Number.isNaN(t.getTime()) ? null : Dt(t);
|
|
965
|
-
}
|
|
966
|
-
function kt(e) {
|
|
967
|
-
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
|
|
968
|
-
}
|
|
969
|
-
function At(e) {
|
|
970
|
-
return Ot(e.date);
|
|
971
|
-
}
|
|
972
|
-
function jt(e, t) {
|
|
973
|
-
let n = new Date(e);
|
|
974
|
-
return n.setDate(n.getDate() + t), Dt(n);
|
|
975
|
-
}
|
|
976
|
-
function Mt(e, t) {
|
|
977
|
-
let n = Dt(e);
|
|
978
|
-
return jt(n, -((n.getDay() - t + 7) % 7));
|
|
979
|
-
}
|
|
980
|
-
function Nt(e) {
|
|
981
|
-
return [...e].sort((e, t) => {
|
|
982
|
-
let n = e.startTime ?? "99:99", r = t.startTime ?? "99:99";
|
|
983
|
-
return n.localeCompare(r);
|
|
984
|
-
});
|
|
985
|
-
}
|
|
986
|
-
function Pt(e, t) {
|
|
987
|
-
let n = Mt(new Date(e.getFullYear(), e.getMonth(), 1), t);
|
|
988
|
-
return Array.from({ length: 42 }, (e, t) => jt(n, t));
|
|
989
|
-
}
|
|
990
|
-
function Ft(e) {
|
|
991
|
-
switch (e) {
|
|
992
|
-
case "active": return "rgba(14, 165, 233, 1)";
|
|
993
|
-
case "done": return "rgba(34, 197, 94, 1)";
|
|
994
|
-
case "cancelled": return "rgba(239, 68, 68, 1)";
|
|
995
|
-
default: return "rgba(245, 158, 11, 1)";
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
function It(e) {
|
|
999
|
-
return e.color ?? Ft(e.status);
|
|
1000
|
-
}
|
|
1001
|
-
function Lt(e, t) {
|
|
1002
|
-
return new Intl.DateTimeFormat(t, {
|
|
1003
|
-
weekday: "long",
|
|
1004
|
-
day: "numeric",
|
|
1005
|
-
month: "long",
|
|
1006
|
-
year: "numeric"
|
|
1007
|
-
}).format(e);
|
|
1008
|
-
}
|
|
1009
|
-
function Rt(e, t) {
|
|
1010
|
-
let n = jt(e, 6), r = new Intl.DateTimeFormat(t, {
|
|
1011
|
-
day: "numeric",
|
|
1012
|
-
month: "short"
|
|
1013
|
-
});
|
|
1014
|
-
return `${r.format(e)} - ${r.format(n)}`;
|
|
1015
|
-
}
|
|
1016
|
-
function zt(e, t) {
|
|
1017
|
-
return e.startTime && e.endTime ? `${e.startTime} - ${e.endTime}` : e.startTime ? e.startTime : t.allDay;
|
|
1018
|
-
}
|
|
1019
|
-
function Bt(e) {
|
|
1020
|
-
let t = /^(\d{1,2}):(\d{2})$/.exec(e);
|
|
1021
|
-
return t ? Number(t[1]) * 60 + Number(t[2]) : null;
|
|
1022
|
-
}
|
|
1023
|
-
function Vt(e) {
|
|
1024
|
-
if (!e.startTime || !e.endTime) return null;
|
|
1025
|
-
let t = Bt(e.startTime), n = Bt(e.endTime);
|
|
1026
|
-
if (t === null || n === null || n <= t) return null;
|
|
1027
|
-
let r = n - t, i = Math.floor(r / 60), a = r % 60;
|
|
1028
|
-
return i === 0 ? `${a}m` : a === 0 ? `${i}h` : `${i}h ${a}m`;
|
|
1029
|
-
}
|
|
1030
|
-
function Ht(e, t) {
|
|
1031
|
-
let n = /* @__PURE__ */ new Date(), r = new Date(e);
|
|
1032
|
-
r.setHours(t, 0, 0, 0);
|
|
1033
|
-
let i = new Date(r);
|
|
1034
|
-
return i.setHours(t + 1, 0, 0, 0), i <= n ? "past" : r <= n && i > n ? "active" : "upcoming";
|
|
1035
|
-
}
|
|
1036
|
-
function Ut(e) {
|
|
1037
|
-
if (!e) return null;
|
|
1038
|
-
let [t, n] = e.split(":"), r = Number(t), i = Number(n ?? 0);
|
|
1039
|
-
return Number.isNaN(r) || Number.isNaN(i) ? null : r * $ + i;
|
|
1040
|
-
}
|
|
1041
|
-
function Wt(e) {
|
|
1042
|
-
let t = Ut(e.startTime);
|
|
1043
|
-
if (t === null) return null;
|
|
1044
|
-
let n = Ut(e.endTime), r = n !== null && n > t ? n : t + $;
|
|
1045
|
-
return {
|
|
1046
|
-
start: t,
|
|
1047
|
-
end: Math.min(r, St * $)
|
|
1048
|
-
};
|
|
1049
|
-
}
|
|
1050
|
-
function Gt(e, t) {
|
|
1051
|
-
let n = t * $, r = n + $, i = [];
|
|
1052
|
-
return e.forEach((e) => {
|
|
1053
|
-
let t = Wt(e);
|
|
1054
|
-
if (!t) return;
|
|
1055
|
-
let a = Math.max(t.start, n), o = Math.min(t.end, r);
|
|
1056
|
-
o <= a || i.push({
|
|
1057
|
-
event: e,
|
|
1058
|
-
fromPercent: (a - n) / $ * 100,
|
|
1059
|
-
toPercent: (o - n) / $ * 100
|
|
1060
|
-
});
|
|
1061
|
-
}), i;
|
|
1062
|
-
}
|
|
1063
|
-
function Kt(e) {
|
|
1064
|
-
let t = /* @__PURE__ */ new Set(), n = e.map((e) => {
|
|
1065
|
-
let t = Wt(e);
|
|
1066
|
-
return t ? {
|
|
1067
|
-
event: e,
|
|
1068
|
-
...t
|
|
1069
|
-
} : null;
|
|
1070
|
-
}).filter((e) => e !== null).sort((e, t) => e.start - t.start);
|
|
1071
|
-
for (let e = 0; e < n.length; e += 1) for (let r = e + 1; r < n.length && !(n[r].start >= n[e].end); r += 1) t.add(n[e].event.id), t.add(n[r].event.id);
|
|
1072
|
-
return t;
|
|
1073
|
-
}
|
|
1074
|
-
function qt(e, t, n) {
|
|
1075
|
-
if (!t.length || !n.length) return e;
|
|
1076
|
-
let r = t.filter((e) => n.includes(e.id));
|
|
1077
|
-
return r.length ? e.filter((e) => r.some((t) => t.predicate(e))) : e;
|
|
1078
|
-
}
|
|
1079
|
-
function Jt(e, t, n, r) {
|
|
1080
|
-
return t === "week" ? Rt(Mt(e, r), n) : new Intl.DateTimeFormat(n, {
|
|
1081
|
-
month: "long",
|
|
1082
|
-
year: "numeric"
|
|
1083
|
-
}).format(e);
|
|
1084
|
-
}
|
|
1085
|
-
function Yt(e, t) {
|
|
1086
|
-
return e === "week" ? t.weekView : t.monthView;
|
|
1087
|
-
}
|
|
1088
|
-
function Xt(e, t) {
|
|
1089
|
-
let n = [];
|
|
1090
|
-
return e && n.push({
|
|
1091
|
-
id: "add",
|
|
1092
|
-
label: t ?? "Add event",
|
|
1093
|
-
icon: /* @__PURE__ */ X(O, {}),
|
|
1094
|
-
onSelect: (t) => e(t)
|
|
1095
|
-
}), n;
|
|
1096
|
-
}
|
|
1097
|
-
function Zt(e, t, n) {
|
|
1098
|
-
let r = [];
|
|
1099
|
-
e.href && r.push({
|
|
1100
|
-
id: "open",
|
|
1101
|
-
label: "Open",
|
|
1102
|
-
icon: /* @__PURE__ */ X(M, {}),
|
|
1103
|
-
href: e.href
|
|
1104
|
-
});
|
|
1105
|
-
let i = e.onEdit ?? t;
|
|
1106
|
-
i && r.push({
|
|
1107
|
-
id: "edit",
|
|
1108
|
-
label: "Edit",
|
|
1109
|
-
icon: /* @__PURE__ */ X(ie, {}),
|
|
1110
|
-
onSelect: i
|
|
1111
|
-
});
|
|
1112
|
-
let a = e.onDelete ?? n;
|
|
1113
|
-
return a && r.push({
|
|
1114
|
-
id: "delete",
|
|
1115
|
-
label: "Delete",
|
|
1116
|
-
icon: /* @__PURE__ */ X(A, {}),
|
|
1117
|
-
color: "error",
|
|
1118
|
-
onSelect: a
|
|
1119
|
-
}), r;
|
|
1120
|
-
}
|
|
1121
|
-
function Qt({ date: e, events: t, overlapWarning: n = !1, orientation: r = "vertical", className: i, ...a }) {
|
|
1122
|
-
let o = Re(), s = q(() => Kt(t), [t]), c = Array.from({ length: St }, (e, t) => t);
|
|
1123
|
-
return /* @__PURE__ */ X("div", {
|
|
1124
|
-
className: P("calendar hourbar", r, i),
|
|
1125
|
-
"aria-hidden": "true",
|
|
1126
|
-
...a,
|
|
1127
|
-
children: c.map((e) => {
|
|
1128
|
-
let r = Gt(t, e), i = Math.min(100, r.reduce((e, t) => e + (t.toPercent - t.fromPercent), 0)), a = n && r.some((e) => s.has(e.event.id));
|
|
1129
|
-
return /* @__PURE__ */ X("div", {
|
|
1130
|
-
className: P("hourbar slot", r.length > 0 && "filled", a && "overlap"),
|
|
1131
|
-
style: { "--mineral-hourbar-fill": `${i}%` },
|
|
1132
|
-
children: r.map((e, t) => {
|
|
1133
|
-
let n = a && r.length > 1 ? Et[t % Et.length] : It(e.event), i = Vt(e.event), s = zt(e.event, o);
|
|
1134
|
-
return /* @__PURE__ */ X(Se, {
|
|
1135
|
-
placement: "left",
|
|
1136
|
-
delay: 120,
|
|
1137
|
-
className: "hourbar segment-wrapper",
|
|
1138
|
-
style: {
|
|
1139
|
-
position: "absolute",
|
|
1140
|
-
left: 0,
|
|
1141
|
-
right: 0,
|
|
1142
|
-
top: `${e.fromPercent}%`,
|
|
1143
|
-
height: `${e.toPercent - e.fromPercent}%`,
|
|
1144
|
-
background: n
|
|
1145
|
-
},
|
|
1146
|
-
content: /* @__PURE__ */ Z("div", {
|
|
1147
|
-
className: "hourbar tooltip-content",
|
|
1148
|
-
children: [/* @__PURE__ */ X("strong", { children: e.event.title }), /* @__PURE__ */ X("span", { children: i ? `${s} · ${i}` : s })]
|
|
1149
|
-
}),
|
|
1150
|
-
children: /* @__PURE__ */ X("span", {
|
|
1151
|
-
className: "hourbar segment-fill",
|
|
1152
|
-
"aria-hidden": "true"
|
|
1153
|
-
})
|
|
1154
|
-
}, `${e.event.id}-${t}`);
|
|
1155
|
-
})
|
|
1156
|
-
}, e);
|
|
1157
|
-
})
|
|
1158
|
-
});
|
|
1159
|
-
}
|
|
1160
|
-
function $t({ filters: e, activeFilterIds: t, onToggle: n }) {
|
|
1161
|
-
return e.length ? /* @__PURE__ */ X("div", {
|
|
1162
|
-
className: "calendar filters",
|
|
1163
|
-
children: e.map((e) => {
|
|
1164
|
-
let r = t.includes(e.id);
|
|
1165
|
-
return /* @__PURE__ */ X(R, {
|
|
1166
|
-
type: "button",
|
|
1167
|
-
size: "sm",
|
|
1168
|
-
variant: "outlined",
|
|
1169
|
-
color: r ? "primary" : "neutral",
|
|
1170
|
-
active: r,
|
|
1171
|
-
className: "calendar filter button",
|
|
1172
|
-
onClick: () => n(e.id),
|
|
1173
|
-
children: e.label
|
|
1174
|
-
}, e.id);
|
|
1175
|
-
})
|
|
1176
|
-
}) : null;
|
|
1177
|
-
}
|
|
1178
|
-
function en({ days: e, eventsByDay: t, selectedDate: n, activeDate: r, onDayInteract: i, dayBadge: a, renderDayCell: o, showHourBar: s, overlapWarning: c, onAddEvent: l, addEventLabel: u }) {
|
|
1179
|
-
let d = kt(Dt(/* @__PURE__ */ new Date()));
|
|
1180
|
-
return /* @__PURE__ */ X("div", {
|
|
1181
|
-
className: "calendar week",
|
|
1182
|
-
children: e.map((e) => {
|
|
1183
|
-
let f = kt(e), p = t.get(f) ?? [], m = a?.(e, p) ?? (p.length > 0 ? /* @__PURE__ */ X(B, {
|
|
1184
|
-
size: "sm",
|
|
1185
|
-
children: p.length
|
|
1186
|
-
}) : null), h = !!(n && kt(n) === f), g = {
|
|
1187
|
-
date: e,
|
|
1188
|
-
events: p,
|
|
1189
|
-
badge: m,
|
|
1190
|
-
isToday: f === d,
|
|
1191
|
-
isSelected: h,
|
|
1192
|
-
isOutsideMonth: !1
|
|
1193
|
-
};
|
|
1194
|
-
return /* @__PURE__ */ X("div", {
|
|
1195
|
-
className: "calendar week column",
|
|
1196
|
-
children: /* @__PURE__ */ X(tn, {
|
|
1197
|
-
date: e,
|
|
1198
|
-
events: p,
|
|
1199
|
-
badge: m,
|
|
1200
|
-
isToday: g.isToday,
|
|
1201
|
-
isSelected: h || !!(r && kt(r) === f),
|
|
1202
|
-
isOutsideMonth: !1,
|
|
1203
|
-
showHourBar: s,
|
|
1204
|
-
overlapWarning: c,
|
|
1205
|
-
onAddEvent: l ? (e) => l(e) : void 0,
|
|
1206
|
-
addEventLabel: u,
|
|
1207
|
-
onClick: (t) => i(e, t.currentTarget, p),
|
|
1208
|
-
children: o ? o(e, g) : void 0
|
|
1209
|
-
})
|
|
1210
|
-
}, f);
|
|
1211
|
-
})
|
|
1212
|
-
});
|
|
1213
|
-
}
|
|
1214
|
-
function tn({ date: e, events: t = [], badge: n, isToday: r = !1, isSelected: i = !1, isOutsideMonth: a = !1, showHourBar: o = !1, overlapWarning: s = !1, onAddEvent: c, addEventLabel: l, className: u, children: d, ...f }) {
|
|
1215
|
-
let p = (t) => {
|
|
1216
|
-
t.stopPropagation(), c?.(e);
|
|
1217
|
-
};
|
|
1218
|
-
return /* @__PURE__ */ X("button", {
|
|
1219
|
-
type: "button",
|
|
1220
|
-
className: P("calendar day cell", r && "today", i && "selected", a && "outside-month", o && "has-hourbar", u),
|
|
1221
|
-
...f,
|
|
1222
|
-
children: d ?? /* @__PURE__ */ Z(Ge, { children: [/* @__PURE__ */ Z("div", {
|
|
1223
|
-
className: "day inner",
|
|
1224
|
-
children: [/* @__PURE__ */ Z("div", {
|
|
1225
|
-
className: "day header",
|
|
1226
|
-
children: [/* @__PURE__ */ X("span", {
|
|
1227
|
-
className: "day number",
|
|
1228
|
-
children: e.getDate()
|
|
1229
|
-
}), /* @__PURE__ */ X("div", {
|
|
1230
|
-
className: "day meta",
|
|
1231
|
-
children: n
|
|
1232
|
-
})]
|
|
1233
|
-
}), c && /* @__PURE__ */ X("div", {
|
|
1234
|
-
className: "day footer",
|
|
1235
|
-
children: /* @__PURE__ */ X("span", {
|
|
1236
|
-
role: "button",
|
|
1237
|
-
tabIndex: -1,
|
|
1238
|
-
"aria-label": l,
|
|
1239
|
-
title: l,
|
|
1240
|
-
className: "day add",
|
|
1241
|
-
onClick: p,
|
|
1242
|
-
children: /* @__PURE__ */ X(O, { size: 14 })
|
|
1243
|
-
})
|
|
1244
|
-
})]
|
|
1245
|
-
}), o && /* @__PURE__ */ X(Qt, {
|
|
1246
|
-
date: e,
|
|
1247
|
-
events: t,
|
|
1248
|
-
overlapWarning: s,
|
|
1249
|
-
className: "embedded"
|
|
1250
|
-
})] })
|
|
1251
|
-
});
|
|
1252
|
-
}
|
|
1253
|
-
function nn({ event: e, locale: t, className: n, currentDate: r, menuItems: i, renderMenu: a, showActions: o = !0, overlap: s = !1, onSelect: c, onEdit: l, onDelete: u, ...d }) {
|
|
1254
|
-
let f = Te(t), p = Re(), m = e.status === "cancelled" ? "error" : e.status === "done" ? "success" : e.status === "active" ? "info" : "warning", h = e.menuItems ?? i ?? a?.(e) ?? Zt(e, l, u), g = !!(e.href || e.onClick || c), _ = It(e), v = (t) => {
|
|
1255
|
-
t.target.closest(".event-menu, .event-menu-trigger") || (e.onClick?.(e), c?.(e));
|
|
1256
|
-
}, y = (t) => /* @__PURE__ */ Z(t, {
|
|
1257
|
-
...t === "a" ? {
|
|
1258
|
-
href: e.href,
|
|
1259
|
-
target: (e.href, void 0)
|
|
1260
|
-
} : {},
|
|
1261
|
-
...t === "button" ? {
|
|
1262
|
-
type: "button",
|
|
1263
|
-
onClick: v
|
|
1264
|
-
} : {},
|
|
1265
|
-
...t === "a" ? { onClick: v } : {},
|
|
1266
|
-
className: P("calendar event item", g && "interactive", s && "overlap", n),
|
|
1267
|
-
style: { "--mineral-event-accent": _ },
|
|
1268
|
-
...d,
|
|
1269
|
-
children: [
|
|
1270
|
-
/* @__PURE__ */ Z("div", {
|
|
1271
|
-
className: "event time",
|
|
1272
|
-
children: [/* @__PURE__ */ X("span", {
|
|
1273
|
-
className: "event accent",
|
|
1274
|
-
"aria-hidden": "true"
|
|
1275
|
-
}), zt(e, p)]
|
|
1276
|
-
}),
|
|
1277
|
-
/* @__PURE__ */ Z("div", {
|
|
1278
|
-
className: "event content",
|
|
1279
|
-
children: [
|
|
1280
|
-
/* @__PURE__ */ Z("div", {
|
|
1281
|
-
className: "event title row",
|
|
1282
|
-
children: [/* @__PURE__ */ X(I, {
|
|
1283
|
-
level: 5,
|
|
1284
|
-
children: e.title
|
|
1285
|
-
}), /* @__PURE__ */ Z("div", {
|
|
1286
|
-
className: "event title meta",
|
|
1287
|
-
children: [s && /* @__PURE__ */ Z(B, {
|
|
1288
|
-
color: "warning",
|
|
1289
|
-
size: "sm",
|
|
1290
|
-
children: [/* @__PURE__ */ X(ae, { size: 12 }), " Overlap"]
|
|
1291
|
-
}), e.status && /* @__PURE__ */ X(B, {
|
|
1292
|
-
color: m,
|
|
1293
|
-
size: "sm",
|
|
1294
|
-
children: e.status
|
|
1295
|
-
})]
|
|
1296
|
-
})]
|
|
1297
|
-
}),
|
|
1298
|
-
e.description && /* @__PURE__ */ X(F, {
|
|
1299
|
-
size: "sm",
|
|
1300
|
-
tone: "muted",
|
|
1301
|
-
children: e.description
|
|
1302
|
-
}),
|
|
1303
|
-
/* @__PURE__ */ Z("div", {
|
|
1304
|
-
className: "event details",
|
|
1305
|
-
children: [
|
|
1306
|
-
e.type && /* @__PURE__ */ X(B, {
|
|
1307
|
-
color: "neutral",
|
|
1308
|
-
size: "sm",
|
|
1309
|
-
children: e.type
|
|
1310
|
-
}),
|
|
1311
|
-
e.badgeLabel && /* @__PURE__ */ X(B, {
|
|
1312
|
-
size: "sm",
|
|
1313
|
-
children: e.badgeLabel
|
|
1314
|
-
}),
|
|
1315
|
-
e.user && /* @__PURE__ */ Z("span", {
|
|
1316
|
-
className: "event user",
|
|
1317
|
-
children: [/* @__PURE__ */ X(U, {
|
|
1318
|
-
size: "sm",
|
|
1319
|
-
src: e.user.avatar,
|
|
1320
|
-
name: e.user.name,
|
|
1321
|
-
backgroundColor: e.user.color
|
|
1322
|
-
}), e.user.name]
|
|
1323
|
-
}),
|
|
1324
|
-
!e.startTime && !e.endTime && r && /* @__PURE__ */ X(F, {
|
|
1325
|
-
size: "sm",
|
|
1326
|
-
tone: "muted",
|
|
1327
|
-
children: Lt(r, f)
|
|
1328
|
-
})
|
|
1329
|
-
]
|
|
1330
|
-
})
|
|
1331
|
-
]
|
|
1332
|
-
}),
|
|
1333
|
-
o && h.length > 0 && /* @__PURE__ */ X("div", {
|
|
1334
|
-
className: "event-menu",
|
|
1335
|
-
onClick: (e) => e.stopPropagation(),
|
|
1336
|
-
onMouseDown: (e) => e.stopPropagation(),
|
|
1337
|
-
children: /* @__PURE__ */ X(Ce, {
|
|
1338
|
-
placement: "bottom-end",
|
|
1339
|
-
trigger: /* @__PURE__ */ X("span", {
|
|
1340
|
-
className: "event-menu-trigger",
|
|
1341
|
-
"aria-label": "Event actions",
|
|
1342
|
-
role: "presentation",
|
|
1343
|
-
children: /* @__PURE__ */ X(se, { size: 16 })
|
|
1344
|
-
}),
|
|
1345
|
-
children: h.map((t) => t.href ? /* @__PURE__ */ X(we, {
|
|
1346
|
-
icon: t.icon,
|
|
1347
|
-
label: t.label,
|
|
1348
|
-
href: t.href,
|
|
1349
|
-
color: t.color,
|
|
1350
|
-
disabled: t.disabled
|
|
1351
|
-
}, t.id) : /* @__PURE__ */ X(we, {
|
|
1352
|
-
icon: t.icon,
|
|
1353
|
-
label: t.label,
|
|
1354
|
-
color: t.color,
|
|
1355
|
-
disabled: t.disabled,
|
|
1356
|
-
onClick: () => t.onSelect?.(e)
|
|
1357
|
-
}, t.id))
|
|
1358
|
-
})
|
|
1359
|
-
})
|
|
1360
|
-
]
|
|
1361
|
-
});
|
|
1362
|
-
return e.href ? y("a") : y(g ? "button" : "div");
|
|
1363
|
-
}
|
|
1364
|
-
function rn({ events: e, locale: t, currentDate: n, emptyStateText: r, overlapWarning: i = !1, renderEventItem: a, renderEventMenu: o, onEventSelect: s, onEventEdit: c, onEventDelete: l, className: u, ...d }) {
|
|
1365
|
-
let f = Te(t), p = Re(), m = q(() => i ? Kt(e) : /* @__PURE__ */ new Set(), [e, i]);
|
|
1366
|
-
return e.length ? /* @__PURE__ */ X("div", {
|
|
1367
|
-
className: P("calendar event list", u),
|
|
1368
|
-
...d,
|
|
1369
|
-
children: /* @__PURE__ */ X(ge, { children: Nt(e).map((e) => a ? /* @__PURE__ */ X("div", { children: a(e) }, e.id) : /* @__PURE__ */ X(nn, {
|
|
1370
|
-
event: e,
|
|
1371
|
-
locale: f,
|
|
1372
|
-
currentDate: n,
|
|
1373
|
-
renderMenu: o,
|
|
1374
|
-
overlap: m.has(e.id),
|
|
1375
|
-
onSelect: s,
|
|
1376
|
-
onEdit: c,
|
|
1377
|
-
onDelete: l
|
|
1378
|
-
}, e.id)) })
|
|
1379
|
-
}) : /* @__PURE__ */ X(F, {
|
|
1380
|
-
size: "sm",
|
|
1381
|
-
tone: "muted",
|
|
1382
|
-
className: P("calendar event list", u),
|
|
1383
|
-
...d,
|
|
1384
|
-
children: r ?? p.emptyStateText
|
|
1385
|
-
});
|
|
1386
|
-
}
|
|
1387
|
-
function an({ event: e, locale: t, date: n, timeLabel: r, overlap: i, renderEventMenu: a, onSelect: o, onEdit: s, onDelete: c }) {
|
|
1388
|
-
let [l, u] = Y(!1), d = J(null);
|
|
1389
|
-
return /* @__PURE__ */ Z(Ge, { children: [/* @__PURE__ */ Z("button", {
|
|
1390
|
-
ref: d,
|
|
1391
|
-
type: "button",
|
|
1392
|
-
className: P("timeline event-chip", i && "overlap", l && "open"),
|
|
1393
|
-
style: { "--mineral-event-color": It(e) },
|
|
1394
|
-
onClick: () => u((e) => !e),
|
|
1395
|
-
children: [/* @__PURE__ */ X("span", {
|
|
1396
|
-
className: "timeline event-chip-time",
|
|
1397
|
-
children: r
|
|
1398
|
-
}), /* @__PURE__ */ X("span", {
|
|
1399
|
-
className: "timeline event-chip-title",
|
|
1400
|
-
children: e.title
|
|
1401
|
-
})]
|
|
1402
|
-
}), /* @__PURE__ */ X(me, {
|
|
1403
|
-
open: l,
|
|
1404
|
-
anchorRef: d,
|
|
1405
|
-
onClose: () => u(!1),
|
|
1406
|
-
placement: "right-start",
|
|
1407
|
-
children: /* @__PURE__ */ X(ye, {
|
|
1408
|
-
className: "timeline event-popup",
|
|
1409
|
-
outlined: !1,
|
|
1410
|
-
children: /* @__PURE__ */ X(z, { children: /* @__PURE__ */ X(nn, {
|
|
1411
|
-
event: e,
|
|
1412
|
-
locale: t,
|
|
1413
|
-
currentDate: n,
|
|
1414
|
-
renderMenu: a,
|
|
1415
|
-
overlap: i,
|
|
1416
|
-
onSelect: o,
|
|
1417
|
-
onEdit: s,
|
|
1418
|
-
onDelete: c
|
|
1419
|
-
}) })
|
|
1420
|
-
})
|
|
1421
|
-
})] });
|
|
1422
|
-
}
|
|
1423
|
-
function on({ date: e, events: t, locale: n, startHour: r = 0, endHour: i = 23, emptyStateText: a, overlapWarning: o = !1, onAddEvent: s, addEventLabel: c, renderEventItem: l, renderEventMenu: u, onEventSelect: d, onEventEdit: f, onEventDelete: p, className: m, ...h }) {
|
|
1424
|
-
let g = Te(n), _ = Re(), v = Math.max(0, Math.min(r, St - 1)), y = Math.max(v, Math.min(i, St - 1)), b = Array.from({ length: y - v + 1 }, (e, t) => v + t), x = t.filter((e) => !e.startTime), S = q(() => o ? Kt(t) : /* @__PURE__ */ new Set(), [t, o]), C = /* @__PURE__ */ X("div", {
|
|
1425
|
-
className: "timeline allday-panel",
|
|
1426
|
-
children: x.length > 0 ? /* @__PURE__ */ X(ge, {
|
|
1427
|
-
spacing: "xs",
|
|
1428
|
-
children: x.map((t) => l ? /* @__PURE__ */ X("div", { children: l(t) }, t.id) : /* @__PURE__ */ X(nn, {
|
|
1429
|
-
event: t,
|
|
1430
|
-
locale: g,
|
|
1431
|
-
currentDate: e,
|
|
1432
|
-
renderMenu: u,
|
|
1433
|
-
overlap: S.has(t.id),
|
|
1434
|
-
onSelect: d,
|
|
1435
|
-
onEdit: f,
|
|
1436
|
-
onDelete: p
|
|
1437
|
-
}, t.id))
|
|
1438
|
-
}) : /* @__PURE__ */ X(F, {
|
|
1439
|
-
size: "sm",
|
|
1440
|
-
tone: "muted",
|
|
1441
|
-
children: a ?? _.emptyStateText
|
|
1442
|
-
})
|
|
1443
|
-
}), w = v * $, T = (y + 1) * $, E = (y - v + 1) * Ct, D = q(() => {
|
|
1444
|
-
let e = Nt(t.filter((e) => !!e.startTime)), n = [];
|
|
1445
|
-
e.forEach((e) => {
|
|
1446
|
-
let t = Wt(e);
|
|
1447
|
-
!t || t.end <= w || t.start >= T || n.push({
|
|
1448
|
-
event: e,
|
|
1449
|
-
start: t.start,
|
|
1450
|
-
end: t.end,
|
|
1451
|
-
column: 0,
|
|
1452
|
-
columns: 1
|
|
1453
|
-
});
|
|
1454
|
-
});
|
|
1455
|
-
let r = [];
|
|
1456
|
-
n.forEach((e) => {
|
|
1457
|
-
let t = -1;
|
|
1458
|
-
for (let n = 0; n < r.length; n++) if (r[n] <= e.start) {
|
|
1459
|
-
t = n, r[n] = e.end;
|
|
1460
|
-
break;
|
|
1461
|
-
}
|
|
1462
|
-
t === -1 && (t = r.length, r.push(e.end)), e.column = t;
|
|
1463
|
-
});
|
|
1464
|
-
let i = 0;
|
|
1465
|
-
for (; i < n.length;) {
|
|
1466
|
-
let e = i, t = n[i].end;
|
|
1467
|
-
for (; e + 1 < n.length && n[e + 1].start < t;) e++, t = Math.max(t, n[e].end);
|
|
1468
|
-
let r = 0;
|
|
1469
|
-
for (let t = i; t <= e; t++) r = Math.max(r, n[t].column + 1);
|
|
1470
|
-
for (let t = i; t <= e; t++) n[t].columns = r;
|
|
1471
|
-
i = e + 1;
|
|
1472
|
-
}
|
|
1473
|
-
return n;
|
|
1474
|
-
}, [
|
|
1475
|
-
t,
|
|
1476
|
-
w,
|
|
1477
|
-
T
|
|
1478
|
-
]), k = /* @__PURE__ */ Z("div", {
|
|
1479
|
-
className: "timeline canvas",
|
|
1480
|
-
style: {
|
|
1481
|
-
"--timeline-hour-height": `${Ct}px`,
|
|
1482
|
-
height: `${E}px`
|
|
1483
|
-
},
|
|
1484
|
-
children: [/* @__PURE__ */ X("div", {
|
|
1485
|
-
className: "timeline rows",
|
|
1486
|
-
children: b.map((t) => {
|
|
1487
|
-
let n = Ht(e, t), r = s ? () => s(e, t) : void 0;
|
|
1488
|
-
return /* @__PURE__ */ Z("div", {
|
|
1489
|
-
className: P("timeline row", n),
|
|
1490
|
-
children: [
|
|
1491
|
-
/* @__PURE__ */ Z("div", {
|
|
1492
|
-
className: "row time-cell",
|
|
1493
|
-
children: [/* @__PURE__ */ X("span", { children: `${String(t).padStart(2, "0")}:00` }), r && /* @__PURE__ */ X("button", {
|
|
1494
|
-
type: "button",
|
|
1495
|
-
className: "row add",
|
|
1496
|
-
"aria-label": c,
|
|
1497
|
-
title: c,
|
|
1498
|
-
onClick: r,
|
|
1499
|
-
children: /* @__PURE__ */ X(O, { size: 12 })
|
|
1500
|
-
})]
|
|
1501
|
-
}),
|
|
1502
|
-
/* @__PURE__ */ X("div", {
|
|
1503
|
-
className: "row rail",
|
|
1504
|
-
"aria-hidden": "true"
|
|
1505
|
-
}),
|
|
1506
|
-
/* @__PURE__ */ X("div", {
|
|
1507
|
-
className: "row body",
|
|
1508
|
-
"aria-hidden": "true"
|
|
1509
|
-
})
|
|
1510
|
-
]
|
|
1511
|
-
}, t);
|
|
1512
|
-
})
|
|
1513
|
-
}), /* @__PURE__ */ X("div", {
|
|
1514
|
-
className: "timeline events",
|
|
1515
|
-
children: D.length === 0 ? /* @__PURE__ */ X("div", {
|
|
1516
|
-
className: "timeline events-empty",
|
|
1517
|
-
children: /* @__PURE__ */ X(F, {
|
|
1518
|
-
size: "sm",
|
|
1519
|
-
tone: "muted",
|
|
1520
|
-
children: a ?? _.timelineEmptyState
|
|
1521
|
-
})
|
|
1522
|
-
}) : D.map((t) => {
|
|
1523
|
-
let n = Math.max(t.start, w) - w, r = Math.min(t.end, T) - w, i = n / $ * Ct, a = Math.max((r - n) / $ * Ct, 28), o = t.column * (wt + Tt);
|
|
1524
|
-
return /* @__PURE__ */ X("div", {
|
|
1525
|
-
className: "timeline event-block",
|
|
1526
|
-
style: {
|
|
1527
|
-
top: `${i}px`,
|
|
1528
|
-
height: `${a}px`,
|
|
1529
|
-
left: `${o}px`,
|
|
1530
|
-
width: `${wt}px`
|
|
1531
|
-
},
|
|
1532
|
-
children: l ? l(t.event) : /* @__PURE__ */ X(an, {
|
|
1533
|
-
event: t.event,
|
|
1534
|
-
locale: g,
|
|
1535
|
-
date: e,
|
|
1536
|
-
timeLabel: zt(t.event, _),
|
|
1537
|
-
overlap: S.has(t.event.id),
|
|
1538
|
-
renderEventMenu: u,
|
|
1539
|
-
onSelect: d,
|
|
1540
|
-
onEdit: f,
|
|
1541
|
-
onDelete: p
|
|
1542
|
-
})
|
|
1543
|
-
}, t.event.id);
|
|
1544
|
-
})
|
|
1545
|
-
})]
|
|
1546
|
-
});
|
|
1547
|
-
return /* @__PURE__ */ X("div", {
|
|
1548
|
-
className: P("calendar timeline", m),
|
|
1549
|
-
...h,
|
|
1550
|
-
children: /* @__PURE__ */ Z(ge, { children: [/* @__PURE__ */ Z("div", {
|
|
1551
|
-
className: "timeline header",
|
|
1552
|
-
children: [/* @__PURE__ */ X(I, {
|
|
1553
|
-
level: 5,
|
|
1554
|
-
children: _.timelineTitle
|
|
1555
|
-
}), o && S.size > 0 && /* @__PURE__ */ Z(B, {
|
|
1556
|
-
color: "warning",
|
|
1557
|
-
size: "sm",
|
|
1558
|
-
children: [/* @__PURE__ */ X(ae, { size: 12 }), " Overlap"]
|
|
1559
|
-
})]
|
|
1560
|
-
}), x.length > 0 ? /* @__PURE__ */ X(ze, {
|
|
1561
|
-
className: "calendar timeline-tabs",
|
|
1562
|
-
variant: "underline",
|
|
1563
|
-
size: "sm",
|
|
1564
|
-
fullWidth: !0,
|
|
1565
|
-
defaultValue: "timeline",
|
|
1566
|
-
items: [{
|
|
1567
|
-
value: "timeline",
|
|
1568
|
-
label: _.timelineTab,
|
|
1569
|
-
content: k
|
|
1570
|
-
}, {
|
|
1571
|
-
value: "allday",
|
|
1572
|
-
label: `${_.allDayTab} (${x.length})`,
|
|
1573
|
-
content: C
|
|
1574
|
-
}]
|
|
1575
|
-
}) : k] })
|
|
1576
|
-
});
|
|
1577
|
-
}
|
|
1578
|
-
function sn({ date: e, events: t, locale: n, timelineStartHour: r, timelineEndHour: i, showTimeline: a, overlapWarning: o, emptyStateText: s, addEventLabel: c, dayMenuLabel: l, onAddEvent: u, renderDayMenu: d, onEventSelect: f, onEventEdit: p, onEventDelete: m, renderEventItem: h, renderEventMenu: g }) {
|
|
1579
|
-
let _ = Re();
|
|
1580
|
-
if (!e) return null;
|
|
1581
|
-
let v = d?.(e, t) ?? Xt(u, c);
|
|
1582
|
-
return /* @__PURE__ */ Z(ge, { children: [/* @__PURE__ */ Z("div", {
|
|
1583
|
-
className: "calendar details header",
|
|
1584
|
-
children: [/* @__PURE__ */ Z(ge, {
|
|
1585
|
-
spacing: "xs",
|
|
1586
|
-
children: [/* @__PURE__ */ X(I, {
|
|
1587
|
-
level: 4,
|
|
1588
|
-
children: Lt(e, n)
|
|
1589
|
-
}), /* @__PURE__ */ X(F, {
|
|
1590
|
-
tone: "muted",
|
|
1591
|
-
size: "sm",
|
|
1592
|
-
children: t.length > 0 ? _.itemsCount(t.length) : s
|
|
1593
|
-
})]
|
|
1594
|
-
}), v.length > 0 && /* @__PURE__ */ X(Ce, {
|
|
1595
|
-
placement: "bottom-end",
|
|
1596
|
-
trigger: /* @__PURE__ */ X("button", {
|
|
1597
|
-
type: "button",
|
|
1598
|
-
className: "day-menu-trigger",
|
|
1599
|
-
"aria-label": l ?? "Day actions",
|
|
1600
|
-
title: l ?? "Day actions",
|
|
1601
|
-
children: /* @__PURE__ */ X(k, { size: 18 })
|
|
1602
|
-
}),
|
|
1603
|
-
children: v.map((n) => n.href ? /* @__PURE__ */ X(we, {
|
|
1604
|
-
icon: n.icon,
|
|
1605
|
-
label: n.label,
|
|
1606
|
-
href: n.href,
|
|
1607
|
-
color: n.color,
|
|
1608
|
-
disabled: n.disabled
|
|
1609
|
-
}, n.id) : /* @__PURE__ */ X(we, {
|
|
1610
|
-
icon: n.icon,
|
|
1611
|
-
label: n.label,
|
|
1612
|
-
color: n.color,
|
|
1613
|
-
disabled: n.disabled,
|
|
1614
|
-
onClick: () => n.onSelect?.(e, t)
|
|
1615
|
-
}, n.id))
|
|
1616
|
-
})]
|
|
1617
|
-
}), a ? /* @__PURE__ */ X(on, {
|
|
1618
|
-
date: e,
|
|
1619
|
-
events: t,
|
|
1620
|
-
locale: n,
|
|
1621
|
-
startHour: r,
|
|
1622
|
-
endHour: i,
|
|
1623
|
-
overlapWarning: o,
|
|
1624
|
-
onAddEvent: u,
|
|
1625
|
-
addEventLabel: c,
|
|
1626
|
-
renderEventItem: h,
|
|
1627
|
-
renderEventMenu: g,
|
|
1628
|
-
onEventSelect: f,
|
|
1629
|
-
onEventEdit: p,
|
|
1630
|
-
onEventDelete: m,
|
|
1631
|
-
emptyStateText: s
|
|
1632
|
-
}) : /* @__PURE__ */ X(rn, {
|
|
1633
|
-
events: t,
|
|
1634
|
-
locale: n,
|
|
1635
|
-
currentDate: e,
|
|
1636
|
-
emptyStateText: s,
|
|
1637
|
-
overlapWarning: o,
|
|
1638
|
-
renderEventItem: h,
|
|
1639
|
-
renderEventMenu: g,
|
|
1640
|
-
onEventSelect: f,
|
|
1641
|
-
onEventEdit: p,
|
|
1642
|
-
onEventDelete: m
|
|
1643
|
-
})] });
|
|
1644
|
-
}
|
|
1645
|
-
function cn({ open: e, anchorRef: t, onClose: n, date: r, events: i, locale: a, timelineStartHour: o = 0, timelineEndHour: s = 23, showTimeline: c = !0, emptyStateText: l, overlapWarning: u = !1, onAddEvent: d, addEventLabel: f, dayMenuLabel: p, onEventSelect: m, onEventEdit: h, onEventDelete: g, renderEventItem: _, renderEventMenu: v, renderDayMenu: y, className: b, style: x }) {
|
|
1646
|
-
let S = Te(a), C = Re();
|
|
1647
|
-
return /* @__PURE__ */ Z(Ge, { children: [e && /* @__PURE__ */ X(pe, { children: /* @__PURE__ */ X("div", {
|
|
1648
|
-
className: "calendar popover-shield",
|
|
1649
|
-
onMouseDown: (e) => {
|
|
1650
|
-
e.preventDefault(), e.stopPropagation(), n();
|
|
1651
|
-
},
|
|
1652
|
-
onClick: (e) => {
|
|
1653
|
-
e.preventDefault(), e.stopPropagation();
|
|
1654
|
-
},
|
|
1655
|
-
"aria-hidden": "true"
|
|
1656
|
-
}) }), /* @__PURE__ */ X(me, {
|
|
1657
|
-
open: e,
|
|
1658
|
-
anchorRef: t,
|
|
1659
|
-
onClose: n,
|
|
1660
|
-
placement: "bottom-start",
|
|
1661
|
-
className: P("calendar popover", b),
|
|
1662
|
-
style: x,
|
|
1663
|
-
children: /* @__PURE__ */ X(ye, {
|
|
1664
|
-
className: "calendar event-popover",
|
|
1665
|
-
children: /* @__PURE__ */ X(z, { children: /* @__PURE__ */ X("div", {
|
|
1666
|
-
className: "calendar popover-scroll",
|
|
1667
|
-
children: /* @__PURE__ */ X(sn, {
|
|
1668
|
-
date: r,
|
|
1669
|
-
events: i,
|
|
1670
|
-
locale: S,
|
|
1671
|
-
timelineStartHour: o,
|
|
1672
|
-
timelineEndHour: s,
|
|
1673
|
-
showTimeline: c,
|
|
1674
|
-
overlapWarning: u,
|
|
1675
|
-
emptyStateText: l ?? C.emptyStateText,
|
|
1676
|
-
addEventLabel: f,
|
|
1677
|
-
dayMenuLabel: p,
|
|
1678
|
-
onAddEvent: d,
|
|
1679
|
-
renderDayMenu: y,
|
|
1680
|
-
onEventSelect: m,
|
|
1681
|
-
onEventEdit: h,
|
|
1682
|
-
onEventDelete: g,
|
|
1683
|
-
renderEventItem: _,
|
|
1684
|
-
renderEventMenu: v
|
|
1685
|
-
})
|
|
1686
|
-
}) })
|
|
1687
|
-
})
|
|
1688
|
-
})] });
|
|
1689
|
-
}
|
|
1690
|
-
function ln({ month: t, defaultMonth: n, onMonthChange: r, events: i = [], locale: a, weekStartsOn: o = 1, view: s, defaultView: c = "month", views: l = ["month", "week"], onViewChange: u, selectedDate: d, defaultSelectedDate: f, onDayClick: p, dayBadge: m, renderDayCell: h, renderEventItem: g, renderEventMenu: _, detailsMode: v = "auto", showTimeline: y = !0, showHourBar: b = !0, timelineStartHour: x = 0, timelineEndHour: S = 23, overlapWarning: C = !1, onAddEvent: w, addEventLabel: T = "Add event", dayMenuLabel: E, renderDayMenu: D, onEventSelect: O, onEventEdit: k, onEventDelete: A, emptyStateText: j, filters: M = [], activeFilters: ee, defaultActiveFilters: te = [], onActiveFiltersChange: ne, fullWidth: re = !1, className: ie, ...ae }) {
|
|
1691
|
-
let oe = Te(a), se = Le(), ce = Re(), N = Dt(/* @__PURE__ */ new Date()), [le, ue] = Y(Dt(n ?? t ?? N)), [de, fe] = Y(c), [pe, me] = Y(Ot(f)), [he, _e] = Y(te), [L, ve] = Y(null), [ye, z] = Y(!1), [xe, Se] = Y(!1), Ce = J(null), we = t !== void 0 && typeof r == "function", V = Dt(we ? t ?? le : le), H = s ?? de, U = Ot(d) ?? pe, W = ee ?? he;
|
|
1692
|
-
We(() => {
|
|
1693
|
-
let t = window.matchMedia(`(max-width: ${e.md}px)`), n = () => Se(t.matches);
|
|
1694
|
-
return n(), t.addEventListener("change", n), () => t.removeEventListener("change", n);
|
|
1695
|
-
}, []), We(() => {
|
|
1696
|
-
we && t && ue(Dt(t));
|
|
1697
|
-
}, [we, t]), We(() => {
|
|
1698
|
-
s && fe(s);
|
|
1699
|
-
}, [s]), We(() => {
|
|
1700
|
-
d !== void 0 && me(Ot(d));
|
|
1701
|
-
}, [d]);
|
|
1702
|
-
let G = q(() => qt(i, M, W), [
|
|
1703
|
-
i,
|
|
1704
|
-
M,
|
|
1705
|
-
W
|
|
1706
|
-
]), Ee = q(() => {
|
|
1707
|
-
let e = /* @__PURE__ */ new Map();
|
|
1708
|
-
return G.forEach((t) => {
|
|
1709
|
-
let n = At(t);
|
|
1710
|
-
if (!n) return;
|
|
1711
|
-
let r = kt(n), i = e.get(r) ?? [];
|
|
1712
|
-
i.push(t), e.set(r, i);
|
|
1713
|
-
}), e;
|
|
1714
|
-
}, [G]), De = q(() => {
|
|
1715
|
-
if (H === "week") {
|
|
1716
|
-
let e = Mt(U ?? V, o);
|
|
1717
|
-
return Array.from({ length: 7 }, (t, n) => jt(e, n));
|
|
1718
|
-
}
|
|
1719
|
-
return Pt(V, o);
|
|
1720
|
-
}, [
|
|
1721
|
-
H,
|
|
1722
|
-
U,
|
|
1723
|
-
V,
|
|
1724
|
-
o
|
|
1725
|
-
]), Oe = v === "auto" ? xe ? "modal" : "popover" : v, ke = L ? Ee.get(kt(L)) ?? [] : [], Ae = l.includes("month"), je = l.includes("week"), Me = (e) => {
|
|
1726
|
-
let t = Dt(e);
|
|
1727
|
-
ue(t), r?.(t);
|
|
1728
|
-
}, Ne = (e) => {
|
|
1729
|
-
if (H === "week") {
|
|
1730
|
-
let t = jt(U ?? V, e * 7);
|
|
1731
|
-
Me(t), me(t), ve(t), z(!1);
|
|
1732
|
-
return;
|
|
1733
|
-
}
|
|
1734
|
-
Me(new Date(V.getFullYear(), V.getMonth() + e, 1)), z(!1), ve(null);
|
|
1735
|
-
}, Pe = (e) => {
|
|
1736
|
-
fe(e), u?.(e);
|
|
1737
|
-
}, Fe = (e, t) => {
|
|
1738
|
-
let n = Dt(e);
|
|
1739
|
-
me(n), p?.(n, t);
|
|
1740
|
-
}, Ie = (e, t, n) => {
|
|
1741
|
-
Ce.current = t, ve(e), Fe(e, n), z(!0);
|
|
1742
|
-
}, ze = (e, t, n) => {
|
|
1743
|
-
Ie(e, t, n), H === "month" && e.getMonth() !== V.getMonth() && Me(new Date(e.getFullYear(), e.getMonth(), 1));
|
|
1744
|
-
}, Be = (e) => {
|
|
1745
|
-
let t = W.includes(e) ? W.filter((t) => t !== e) : [...W, e];
|
|
1746
|
-
_e(t), ne?.(t);
|
|
1747
|
-
}, Ve = Mt(H === "week" ? U ?? V : V, o);
|
|
1748
|
-
return /* @__PURE__ */ Z("div", {
|
|
1749
|
-
className: P("calendar board", re && "full-width", ie),
|
|
1750
|
-
...ae,
|
|
1751
|
-
children: [
|
|
1752
|
-
/* @__PURE__ */ Z("div", {
|
|
1753
|
-
className: "calendar header",
|
|
1754
|
-
children: [/* @__PURE__ */ Z(ge, { children: [/* @__PURE__ */ X(I, {
|
|
1755
|
-
level: 3,
|
|
1756
|
-
children: Jt(V, H, oe, o)
|
|
1757
|
-
}), /* @__PURE__ */ X(F, {
|
|
1758
|
-
size: "sm",
|
|
1759
|
-
tone: "muted",
|
|
1760
|
-
children: Yt(H, ce)
|
|
1761
|
-
})] }), /* @__PURE__ */ Z(ge, {
|
|
1762
|
-
align: "end",
|
|
1763
|
-
children: [/* @__PURE__ */ Z("div", {
|
|
1764
|
-
className: "calendar actions",
|
|
1765
|
-
children: [/* @__PURE__ */ X(R, {
|
|
1766
|
-
type: "button",
|
|
1767
|
-
size: "sm",
|
|
1768
|
-
variant: "outlined",
|
|
1769
|
-
color: "neutral",
|
|
1770
|
-
onClick: () => Ne(-1),
|
|
1771
|
-
children: H === "week" ? ce.previousWeek : se.previousMonth
|
|
1772
|
-
}), /* @__PURE__ */ X(R, {
|
|
1773
|
-
type: "button",
|
|
1774
|
-
size: "sm",
|
|
1775
|
-
variant: "outlined",
|
|
1776
|
-
color: "neutral",
|
|
1777
|
-
onClick: () => Ne(1),
|
|
1778
|
-
children: H === "week" ? ce.nextWeek : se.nextMonth
|
|
1779
|
-
})]
|
|
1780
|
-
}), (Ae || je) && /* @__PURE__ */ Z("div", {
|
|
1781
|
-
className: "calendar views",
|
|
1782
|
-
children: [Ae && /* @__PURE__ */ X(R, {
|
|
1783
|
-
type: "button",
|
|
1784
|
-
size: "sm",
|
|
1785
|
-
variant: "outlined",
|
|
1786
|
-
color: H === "month" ? "primary" : "neutral",
|
|
1787
|
-
active: H === "month",
|
|
1788
|
-
onClick: () => Pe("month"),
|
|
1789
|
-
children: ce.monthView
|
|
1790
|
-
}), je && /* @__PURE__ */ X(R, {
|
|
1791
|
-
type: "button",
|
|
1792
|
-
size: "sm",
|
|
1793
|
-
variant: "outlined",
|
|
1794
|
-
color: H === "week" ? "primary" : "neutral",
|
|
1795
|
-
active: H === "week",
|
|
1796
|
-
onClick: () => Pe("week"),
|
|
1797
|
-
children: ce.weekView
|
|
1798
|
-
})]
|
|
1799
|
-
})]
|
|
1800
|
-
})]
|
|
1801
|
-
}),
|
|
1802
|
-
/* @__PURE__ */ X($t, {
|
|
1803
|
-
filters: M,
|
|
1804
|
-
activeFilterIds: W,
|
|
1805
|
-
onToggle: Be
|
|
1806
|
-
}),
|
|
1807
|
-
/* @__PURE__ */ X("div", {
|
|
1808
|
-
className: "calendar days",
|
|
1809
|
-
children: Array.from({ length: 7 }, (e, t) => jt(Ve, t)).map((e) => /* @__PURE__ */ X("div", {
|
|
1810
|
-
className: "calendar day",
|
|
1811
|
-
children: new Intl.DateTimeFormat(oe, { weekday: "short" }).format(e)
|
|
1812
|
-
}, kt(e)))
|
|
1813
|
-
}),
|
|
1814
|
-
H === "week" ? /* @__PURE__ */ X(en, {
|
|
1815
|
-
days: De,
|
|
1816
|
-
eventsByDay: Ee,
|
|
1817
|
-
selectedDate: U,
|
|
1818
|
-
activeDate: L,
|
|
1819
|
-
onDayInteract: ze,
|
|
1820
|
-
dayBadge: m,
|
|
1821
|
-
renderDayCell: h,
|
|
1822
|
-
showHourBar: b,
|
|
1823
|
-
overlapWarning: C,
|
|
1824
|
-
onAddEvent: w,
|
|
1825
|
-
addEventLabel: T
|
|
1826
|
-
}) : /* @__PURE__ */ X("div", {
|
|
1827
|
-
className: "calendar grid",
|
|
1828
|
-
children: De.map((e) => {
|
|
1829
|
-
let t = kt(e), n = Ee.get(t) ?? [], r = m?.(e, n) ?? (n.length > 0 ? /* @__PURE__ */ X(B, {
|
|
1830
|
-
size: "sm",
|
|
1831
|
-
children: n.length
|
|
1832
|
-
}) : null), i = t === kt(N), a = !!(U && t === kt(U)), o = e.getMonth() !== V.getMonth(), s = {
|
|
1833
|
-
date: e,
|
|
1834
|
-
events: n,
|
|
1835
|
-
badge: r,
|
|
1836
|
-
isToday: i,
|
|
1837
|
-
isSelected: a,
|
|
1838
|
-
isOutsideMonth: o
|
|
1839
|
-
};
|
|
1840
|
-
return /* @__PURE__ */ X(tn, {
|
|
1841
|
-
date: e,
|
|
1842
|
-
events: n,
|
|
1843
|
-
badge: r,
|
|
1844
|
-
isToday: i,
|
|
1845
|
-
isSelected: a || !!(L && t === kt(L)),
|
|
1846
|
-
isOutsideMonth: o,
|
|
1847
|
-
showHourBar: b,
|
|
1848
|
-
overlapWarning: C,
|
|
1849
|
-
onAddEvent: w ? (e) => w(e) : void 0,
|
|
1850
|
-
addEventLabel: T,
|
|
1851
|
-
onClick: (t) => ze(e, t.currentTarget, n),
|
|
1852
|
-
children: h ? h(e, s) : void 0
|
|
1853
|
-
}, t);
|
|
1854
|
-
})
|
|
1855
|
-
}),
|
|
1856
|
-
Oe === "popover" ? /* @__PURE__ */ X(cn, {
|
|
1857
|
-
open: ye && !!L && !!Ce.current,
|
|
1858
|
-
anchorRef: Ce,
|
|
1859
|
-
onClose: () => z(!1),
|
|
1860
|
-
date: L,
|
|
1861
|
-
events: ke,
|
|
1862
|
-
locale: oe,
|
|
1863
|
-
timelineStartHour: x,
|
|
1864
|
-
timelineEndHour: S,
|
|
1865
|
-
showTimeline: y,
|
|
1866
|
-
overlapWarning: C,
|
|
1867
|
-
onAddEvent: w,
|
|
1868
|
-
addEventLabel: T,
|
|
1869
|
-
dayMenuLabel: E,
|
|
1870
|
-
renderDayMenu: D,
|
|
1871
|
-
onEventSelect: O,
|
|
1872
|
-
onEventEdit: k,
|
|
1873
|
-
onEventDelete: A,
|
|
1874
|
-
emptyStateText: j ?? ce.emptyStateText,
|
|
1875
|
-
renderEventItem: g,
|
|
1876
|
-
renderEventMenu: _
|
|
1877
|
-
}) : /* @__PURE__ */ X(be, {
|
|
1878
|
-
open: ye && !!L,
|
|
1879
|
-
onClose: () => z(!1),
|
|
1880
|
-
size: "lg",
|
|
1881
|
-
children: /* @__PURE__ */ X("div", {
|
|
1882
|
-
className: "calendar popover-scroll",
|
|
1883
|
-
children: /* @__PURE__ */ X(sn, {
|
|
1884
|
-
date: L,
|
|
1885
|
-
events: ke,
|
|
1886
|
-
locale: oe,
|
|
1887
|
-
timelineStartHour: x,
|
|
1888
|
-
timelineEndHour: S,
|
|
1889
|
-
showTimeline: y,
|
|
1890
|
-
overlapWarning: C,
|
|
1891
|
-
emptyStateText: j ?? ce.emptyStateText,
|
|
1892
|
-
addEventLabel: T,
|
|
1893
|
-
dayMenuLabel: E,
|
|
1894
|
-
onAddEvent: w,
|
|
1895
|
-
renderDayMenu: D,
|
|
1896
|
-
onEventSelect: O,
|
|
1897
|
-
onEventEdit: k,
|
|
1898
|
-
onEventDelete: A,
|
|
1899
|
-
renderEventItem: g,
|
|
1900
|
-
renderEventMenu: _
|
|
1901
|
-
})
|
|
1902
|
-
})
|
|
1903
|
-
})
|
|
1904
|
-
]
|
|
1905
|
-
});
|
|
1906
|
-
}
|
|
1907
|
-
//#endregion
|
|
1908
|
-
//#region src/components/data/MChart/MChart.types.ts
|
|
1909
|
-
var un = [
|
|
1910
|
-
"primary",
|
|
1911
|
-
"info",
|
|
1912
|
-
"success",
|
|
1913
|
-
"warning",
|
|
1914
|
-
"error",
|
|
1915
|
-
"news",
|
|
1916
|
-
"neutral",
|
|
1917
|
-
"dark"
|
|
1918
|
-
], dn = {
|
|
1919
|
-
top: 20,
|
|
1920
|
-
right: 20,
|
|
1921
|
-
bottom: 40,
|
|
1922
|
-
left: 50
|
|
1923
|
-
}, fn = {
|
|
1924
|
-
top: 20,
|
|
1925
|
-
right: 20,
|
|
1926
|
-
bottom: 55,
|
|
1927
|
-
left: 65
|
|
1928
|
-
};
|
|
1929
|
-
//#endregion
|
|
1930
|
-
//#region src/components/data/MChart/utils/formats.ts
|
|
1931
|
-
function pn(e) {
|
|
1932
|
-
return Math.abs(e) >= 1e6 ? (e / 1e6).toFixed(1).replace(/\.0$/, "") + "M" : Math.abs(e) >= 1e3 ? (e / 1e3).toFixed(1).replace(/\.0$/, "") + "k" : Number.isInteger(e) ? String(e) : e.toFixed(1);
|
|
1933
|
-
}
|
|
1934
|
-
function mn(e) {
|
|
1935
|
-
return e;
|
|
1936
|
-
}
|
|
1937
|
-
//#endregion
|
|
1938
|
-
//#region src/components/data/MChart/parts/ChartGrid.tsx
|
|
1939
|
-
function hn({ x: e, y: t, width: n, height: r, horizontalLines: i, verticalLines: a }) {
|
|
1940
|
-
return /* @__PURE__ */ Z("g", {
|
|
1941
|
-
className: "chart-grid",
|
|
1942
|
-
children: [i.map((t, r) => /* @__PURE__ */ X("line", {
|
|
1943
|
-
x1: e,
|
|
1944
|
-
y1: t,
|
|
1945
|
-
x2: e + n,
|
|
1946
|
-
y2: t,
|
|
1947
|
-
className: "chart-grid-line"
|
|
1948
|
-
}, `h${r}`)), a?.map((e, n) => /* @__PURE__ */ X("line", {
|
|
1949
|
-
x1: e,
|
|
1950
|
-
y1: t,
|
|
1951
|
-
x2: e,
|
|
1952
|
-
y2: t + r,
|
|
1953
|
-
className: "chart-grid-line chart-grid-line-vertical"
|
|
1954
|
-
}, `v${n}`))]
|
|
1955
|
-
});
|
|
1956
|
-
}
|
|
1957
|
-
//#endregion
|
|
1958
|
-
//#region src/components/data/MChart/parts/ChartAxis.tsx
|
|
1959
|
-
function gn({ type: e, x: t, y: n, length: r, ticks: i, title: a }) {
|
|
1960
|
-
let o = e === "x";
|
|
1961
|
-
return /* @__PURE__ */ Z("g", {
|
|
1962
|
-
className: `chart-axis chart-axis-${e}`,
|
|
1963
|
-
children: [
|
|
1964
|
-
/* @__PURE__ */ X("line", {
|
|
1965
|
-
x1: t,
|
|
1966
|
-
y1: n,
|
|
1967
|
-
x2: o ? t + r : t,
|
|
1968
|
-
y2: o ? n : n - r,
|
|
1969
|
-
className: "chart-axis-line"
|
|
1970
|
-
}),
|
|
1971
|
-
i.map((e, r) => /* @__PURE__ */ X("g", { children: o ? /* @__PURE__ */ X("text", {
|
|
1972
|
-
x: e.position,
|
|
1973
|
-
y: n + 16,
|
|
1974
|
-
textAnchor: "middle",
|
|
1975
|
-
className: "chart-axis-label",
|
|
1976
|
-
children: e.label
|
|
1977
|
-
}) : /* @__PURE__ */ X("text", {
|
|
1978
|
-
x: t - 8,
|
|
1979
|
-
y: e.position,
|
|
1980
|
-
textAnchor: "end",
|
|
1981
|
-
dominantBaseline: "middle",
|
|
1982
|
-
className: "chart-axis-label",
|
|
1983
|
-
children: e.label
|
|
1984
|
-
}) }, r)),
|
|
1985
|
-
a && (o ? /* @__PURE__ */ X("text", {
|
|
1986
|
-
x: t + r / 2,
|
|
1987
|
-
y: n + 36,
|
|
1988
|
-
textAnchor: "middle",
|
|
1989
|
-
className: "chart-axis-title",
|
|
1990
|
-
children: a
|
|
1991
|
-
}) : /* @__PURE__ */ X("text", {
|
|
1992
|
-
x: t - 40,
|
|
1993
|
-
y: n - r / 2,
|
|
1994
|
-
textAnchor: "middle",
|
|
1995
|
-
dominantBaseline: "middle",
|
|
1996
|
-
transform: `rotate(-90, ${t - 40}, ${n - r / 2})`,
|
|
1997
|
-
className: "chart-axis-title",
|
|
1998
|
-
children: a
|
|
1999
|
-
}))
|
|
2000
|
-
]
|
|
2001
|
-
});
|
|
2002
|
-
}
|
|
2003
|
-
//#endregion
|
|
2004
|
-
//#region src/components/data/MChart/charts/MLineChart.tsx
|
|
2005
|
-
function _n({ data: e, colors: t, innerWidth: n, innerHeight: r, padding: i, xAxis: a, yAxis: o, showGrid: s, showXAxis: c, showYAxis: l, curved: u, animated: d, valueFormatter: f = pn, onTooltip: p, onDataClick: m }) {
|
|
2006
|
-
let [h, g] = Y(null), _ = n - i.left - i.right, v = r - i.top - i.bottom, { yMin: y, yMax: b, yTicks: x, xLabels: S, seriesPoints: C } = q(() => {
|
|
2007
|
-
let t = e.map((e) => e.data), [n, r] = Fe(t), i = o?.min ?? je(n), s = o?.max ?? De(r, n), c = ke(i, s, o?.ticks ?? 5), l = Math.max(...t.map((e) => e.length), 1), u = a?.labels ?? Array.from({ length: l }, (e, t) => String(t)), d = G([0, Math.max(l - 1, 1)], [0, _]), f = G([i, s], [v, 0]);
|
|
2008
|
-
return {
|
|
2009
|
-
yMin: i,
|
|
2010
|
-
yMax: s,
|
|
2011
|
-
yTicks: c,
|
|
2012
|
-
xLabels: u,
|
|
2013
|
-
seriesPoints: t.map((e) => e.map((e, t) => ({
|
|
2014
|
-
x: d(t),
|
|
2015
|
-
y: f(e)
|
|
2016
|
-
})))
|
|
2017
|
-
};
|
|
2018
|
-
}, [
|
|
2019
|
-
e,
|
|
2020
|
-
_,
|
|
2021
|
-
v,
|
|
2022
|
-
a,
|
|
2023
|
-
o
|
|
2024
|
-
]), w = G([y, b], [v, 0]), T = G([0, Math.max(S.length - 1, 1)], [0, _]), E = K((r) => {
|
|
2025
|
-
let a = r.currentTarget.closest("svg");
|
|
2026
|
-
if (!a) return;
|
|
2027
|
-
let o = a.getBoundingClientRect(), s = n / o.width, c = (r.clientX - o.left) * s - i.left, l = Math.round(c / _ * Math.max(S.length - 1, 1)), u = Math.max(0, Math.min(l, S.length - 1));
|
|
2028
|
-
g(u), p({
|
|
2029
|
-
label: S[u],
|
|
2030
|
-
items: e.map((e, n) => ({
|
|
2031
|
-
name: e.label,
|
|
2032
|
-
value: e.data[u] ?? 0,
|
|
2033
|
-
color: e.color ?? t[n % t.length]
|
|
2034
|
-
})),
|
|
2035
|
-
x: r.clientX - o.left,
|
|
2036
|
-
y: r.clientY - o.top
|
|
2037
|
-
});
|
|
2038
|
-
}, [
|
|
2039
|
-
e,
|
|
2040
|
-
t,
|
|
2041
|
-
S,
|
|
2042
|
-
_,
|
|
2043
|
-
i.left,
|
|
2044
|
-
n,
|
|
2045
|
-
p
|
|
2046
|
-
]), D = K(() => {
|
|
2047
|
-
g(null), p(null);
|
|
2048
|
-
}, [p]), O = x.map((e) => i.top + w(e)), k = S.map((e, t) => i.left + T(t)), A = x.map((e) => ({
|
|
2049
|
-
position: i.top + w(e),
|
|
2050
|
-
label: (o?.formatter ?? f)(e)
|
|
2051
|
-
})), j = S.map((e, t) => ({
|
|
2052
|
-
position: i.left + T(t),
|
|
2053
|
-
label: e
|
|
2054
|
-
}));
|
|
2055
|
-
return /* @__PURE__ */ Z("g", { children: [
|
|
2056
|
-
s && /* @__PURE__ */ X(hn, {
|
|
2057
|
-
x: i.left,
|
|
2058
|
-
y: i.top,
|
|
2059
|
-
width: _,
|
|
2060
|
-
height: v,
|
|
2061
|
-
horizontalLines: O,
|
|
2062
|
-
verticalLines: k
|
|
2063
|
-
}),
|
|
2064
|
-
l && /* @__PURE__ */ X(gn, {
|
|
2065
|
-
type: "y",
|
|
2066
|
-
x: i.left,
|
|
2067
|
-
y: i.top + v,
|
|
2068
|
-
length: v,
|
|
2069
|
-
ticks: A,
|
|
2070
|
-
title: o?.title
|
|
2071
|
-
}),
|
|
2072
|
-
c && /* @__PURE__ */ X(gn, {
|
|
2073
|
-
type: "x",
|
|
2074
|
-
x: i.left,
|
|
2075
|
-
y: i.top + v,
|
|
2076
|
-
length: _,
|
|
2077
|
-
ticks: j,
|
|
2078
|
-
title: a?.title
|
|
2079
|
-
}),
|
|
2080
|
-
/* @__PURE__ */ Z("g", {
|
|
2081
|
-
onMouseMove: E,
|
|
2082
|
-
onMouseLeave: D,
|
|
2083
|
-
children: [
|
|
2084
|
-
/* @__PURE__ */ X("rect", {
|
|
2085
|
-
x: i.left,
|
|
2086
|
-
y: i.top,
|
|
2087
|
-
width: _,
|
|
2088
|
-
height: v,
|
|
2089
|
-
fill: "transparent"
|
|
2090
|
-
}),
|
|
2091
|
-
C.map((n, r) => {
|
|
2092
|
-
let a = e[r].color ?? t[r % t.length], o = u ? Oe(n.map((e) => ({
|
|
2093
|
-
x: e.x + i.left,
|
|
2094
|
-
y: e.y + i.top
|
|
2095
|
-
}))) : W(n.map((e) => ({
|
|
2096
|
-
x: e.x + i.left,
|
|
2097
|
-
y: e.y + i.top
|
|
2098
|
-
})));
|
|
2099
|
-
return /* @__PURE__ */ Z("g", { children: [/* @__PURE__ */ X("path", {
|
|
2100
|
-
className: `chart-line ${a} ${d ? "animated" : ""}`,
|
|
2101
|
-
d: o
|
|
2102
|
-
}), n.map((t, n) => /* @__PURE__ */ X("circle", {
|
|
2103
|
-
className: `chart-dot ${a} ${h === n ? "active" : ""}`,
|
|
2104
|
-
cx: t.x + i.left,
|
|
2105
|
-
cy: t.y + i.top,
|
|
2106
|
-
r: h === n ? 5 : 3,
|
|
2107
|
-
onClick: () => m?.(r, n, e[r].data[n]),
|
|
2108
|
-
style: { cursor: m ? "pointer" : void 0 }
|
|
2109
|
-
}, n))] }, r);
|
|
2110
|
-
}),
|
|
2111
|
-
h !== null && /* @__PURE__ */ X("line", {
|
|
2112
|
-
className: "chart-crosshair",
|
|
2113
|
-
x1: i.left + T(h),
|
|
2114
|
-
y1: i.top,
|
|
2115
|
-
x2: i.left + T(h),
|
|
2116
|
-
y2: i.top + v
|
|
2117
|
-
})
|
|
2118
|
-
]
|
|
2119
|
-
})
|
|
2120
|
-
] });
|
|
2121
|
-
}
|
|
2122
|
-
//#endregion
|
|
2123
|
-
//#region src/components/data/MChart/charts/MBarChart.tsx
|
|
2124
|
-
function vn({ data: e, colors: t, innerWidth: n, innerHeight: r, padding: i, xAxis: a, yAxis: o, showGrid: s, showXAxis: c, showYAxis: l, stacked: u, animated: d, valueFormatter: f = pn, onTooltip: p, onDataClick: m }) {
|
|
2125
|
-
let [h, g] = Y(null), _ = n - i.left - i.right, v = r - i.top - i.bottom, { yMin: y, yMax: b, yTicks: x, xLabels: S, maxLen: C } = q(() => {
|
|
2126
|
-
let t = e.map((e) => e.data), n = Math.max(...t.map((e) => e.length), 1), r, i;
|
|
2127
|
-
u ? [r, i] = Ee(t) : [r, i] = Fe(t);
|
|
2128
|
-
let s = o?.min ?? je(r), c = o?.max ?? De(i, r);
|
|
2129
|
-
return {
|
|
2130
|
-
yMin: s,
|
|
2131
|
-
yMax: c,
|
|
2132
|
-
yTicks: ke(s, c, o?.ticks ?? 5),
|
|
2133
|
-
xLabels: a?.labels ?? Array.from({ length: n }, (e, t) => String(t)),
|
|
2134
|
-
maxLen: n
|
|
2135
|
-
};
|
|
2136
|
-
}, [
|
|
2137
|
-
e,
|
|
2138
|
-
a,
|
|
2139
|
-
o,
|
|
2140
|
-
u
|
|
2141
|
-
]), w = G([y, b], [v, 0]), T = _ / C, E = Math.max(T * .1, 2), D = e.length, O = K((n, r, i) => {
|
|
2142
|
-
g({
|
|
2143
|
-
di: n,
|
|
2144
|
-
pi: r
|
|
2145
|
-
});
|
|
2146
|
-
let a = i.currentTarget.closest("svg");
|
|
2147
|
-
if (!a) return;
|
|
2148
|
-
let o = a.getBoundingClientRect();
|
|
2149
|
-
p({
|
|
2150
|
-
label: S[r],
|
|
2151
|
-
items: u ? e.map((e, n) => ({
|
|
2152
|
-
name: e.label,
|
|
2153
|
-
value: e.data[r] ?? 0,
|
|
2154
|
-
color: e.color ?? t[n % t.length]
|
|
2155
|
-
})) : [{
|
|
2156
|
-
name: e[n].label,
|
|
2157
|
-
value: e[n].data[r],
|
|
2158
|
-
color: e[n].color ?? t[n % t.length]
|
|
2159
|
-
}],
|
|
2160
|
-
x: i.clientX - o.left,
|
|
2161
|
-
y: i.clientY - o.top
|
|
2162
|
-
});
|
|
2163
|
-
}, [
|
|
2164
|
-
e,
|
|
2165
|
-
t,
|
|
2166
|
-
S,
|
|
2167
|
-
u,
|
|
2168
|
-
p
|
|
2169
|
-
]), k = K(() => {
|
|
2170
|
-
g(null), p(null);
|
|
2171
|
-
}, [p]), A = x.map((e) => i.top + w(e)), j = S.map((e, t) => ({
|
|
2172
|
-
position: i.left + T * t + T / 2,
|
|
2173
|
-
label: e
|
|
2174
|
-
})), M = x.map((e) => ({
|
|
2175
|
-
position: i.top + w(e),
|
|
2176
|
-
label: (o?.formatter ?? f)(e)
|
|
2177
|
-
})), ee = w(0);
|
|
2178
|
-
return /* @__PURE__ */ Z("g", { children: [
|
|
2179
|
-
s && /* @__PURE__ */ X(hn, {
|
|
2180
|
-
x: i.left,
|
|
2181
|
-
y: i.top,
|
|
2182
|
-
width: _,
|
|
2183
|
-
height: v,
|
|
2184
|
-
horizontalLines: A
|
|
2185
|
-
}),
|
|
2186
|
-
l && /* @__PURE__ */ X(gn, {
|
|
2187
|
-
type: "y",
|
|
2188
|
-
x: i.left,
|
|
2189
|
-
y: i.top + v,
|
|
2190
|
-
length: v,
|
|
2191
|
-
ticks: M,
|
|
2192
|
-
title: o?.title
|
|
2193
|
-
}),
|
|
2194
|
-
c && /* @__PURE__ */ X(gn, {
|
|
2195
|
-
type: "x",
|
|
2196
|
-
x: i.left,
|
|
2197
|
-
y: i.top + v,
|
|
2198
|
-
length: _,
|
|
2199
|
-
ticks: j,
|
|
2200
|
-
title: a?.title
|
|
2201
|
-
}),
|
|
2202
|
-
/* @__PURE__ */ X("g", {
|
|
2203
|
-
onMouseLeave: k,
|
|
2204
|
-
children: u ? S.map((n, r) => {
|
|
2205
|
-
let a = ee, o = T - E * 2, s = i.left + T * r + E;
|
|
2206
|
-
return /* @__PURE__ */ X("g", { children: e.map((n, c) => {
|
|
2207
|
-
let l = n.data[r] ?? 0, u = ee - w(l), f = a - u;
|
|
2208
|
-
a = f;
|
|
2209
|
-
let p = n.color ?? t[c % t.length], g = h?.di === c && h?.pi === r;
|
|
2210
|
-
return /* @__PURE__ */ X("rect", {
|
|
2211
|
-
className: `chart-bar ${p} ${d ? "animated" : ""} ${g ? "active" : ""}`,
|
|
2212
|
-
x: s,
|
|
2213
|
-
y: i.top + f,
|
|
2214
|
-
width: Math.max(o, 1),
|
|
2215
|
-
height: Math.max(u, 0),
|
|
2216
|
-
rx: c === e.length - 1 ? 3 : 0,
|
|
2217
|
-
onMouseEnter: (e) => O(c, r, e),
|
|
2218
|
-
onClick: () => m?.(c, r, l),
|
|
2219
|
-
style: { cursor: m ? "pointer" : void 0 }
|
|
2220
|
-
}, c);
|
|
2221
|
-
}) }, r);
|
|
2222
|
-
}) : e.map((e, n) => {
|
|
2223
|
-
let r = (T - E * 2) / D;
|
|
2224
|
-
return /* @__PURE__ */ X("g", { children: e.data.map((a, o) => {
|
|
2225
|
-
let s = ee - w(a), c = i.left + T * o + E + r * n, l = Math.min(ee, w(a)), u = e.color ?? t[n % t.length], f = h?.di === n && h?.pi === o;
|
|
2226
|
-
return /* @__PURE__ */ X("rect", {
|
|
2227
|
-
className: `chart-bar ${u} ${d ? "animated" : ""} ${f ? "active" : ""}`,
|
|
2228
|
-
x: c,
|
|
2229
|
-
y: i.top + l,
|
|
2230
|
-
width: Math.max(r, 1),
|
|
2231
|
-
height: Math.max(Math.abs(s), 0),
|
|
2232
|
-
rx: 3,
|
|
2233
|
-
onMouseEnter: (e) => O(n, o, e),
|
|
2234
|
-
onClick: () => m?.(n, o, a),
|
|
2235
|
-
style: { cursor: m ? "pointer" : void 0 }
|
|
2236
|
-
}, o);
|
|
2237
|
-
}) }, n);
|
|
2238
|
-
})
|
|
2239
|
-
})
|
|
2240
|
-
] });
|
|
2241
|
-
}
|
|
2242
|
-
//#endregion
|
|
2243
|
-
//#region src/components/data/MChart/charts/MAreaChart.tsx
|
|
2244
|
-
function yn({ data: e, colors: t, innerWidth: n, innerHeight: r, padding: i, xAxis: a, yAxis: o, showGrid: s, showXAxis: c, showYAxis: l, curved: u, stacked: d, animated: f, valueFormatter: p = pn, onTooltip: m, onDataClick: h }) {
|
|
2245
|
-
let [g, _] = Y(null), v = n - i.left - i.right, y = r - i.top - i.bottom, { yMin: b, yMax: x, yTicks: S, xLabels: C, seriesPoints: w, stackedPaths: T } = q(() => {
|
|
2246
|
-
let t = e.map((e) => e.data), n = Math.max(...t.map((e) => e.length), 1), r, s;
|
|
2247
|
-
d ? [r, s] = Ee(t) : [r, s] = Fe(t);
|
|
2248
|
-
let c = o?.min ?? je(r), l = o?.max ?? De(s, r), f = ke(c, l, o?.ticks ?? 5), p = a?.labels ?? Array.from({ length: n }, (e, t) => String(t)), m = G([0, Math.max(n - 1, 1)], [0, v]), h = G([c, l], [y, 0]);
|
|
2249
|
-
if (d) {
|
|
2250
|
-
let e = [];
|
|
2251
|
-
for (let r = 0; r < t.length; r++) {
|
|
2252
|
-
e[r] = [];
|
|
2253
|
-
for (let i = 0; i < n; i++) e[r][i] = (t[r][i] ?? 0) + (r > 0 ? e[r - 1][i] : 0);
|
|
2254
|
-
}
|
|
2255
|
-
return {
|
|
2256
|
-
yMin: c,
|
|
2257
|
-
yMax: l,
|
|
2258
|
-
yTicks: f,
|
|
2259
|
-
xLabels: p,
|
|
2260
|
-
seriesPoints: [],
|
|
2261
|
-
stackedPaths: e.map((t, n) => {
|
|
2262
|
-
let r = t.map((e, t) => ({
|
|
2263
|
-
x: i.left + m(t),
|
|
2264
|
-
y: i.top + h(e)
|
|
2265
|
-
}));
|
|
2266
|
-
return {
|
|
2267
|
-
area: Ne(r, n === 0 ? t.map((e, t) => ({
|
|
2268
|
-
x: i.left + m(t),
|
|
2269
|
-
y: i.top + h(0)
|
|
2270
|
-
})) : e[n - 1].map((e, t) => ({
|
|
2271
|
-
x: i.left + m(t),
|
|
2272
|
-
y: i.top + h(e)
|
|
2273
|
-
})), u),
|
|
2274
|
-
line: u ? Oe(r) : W(r),
|
|
2275
|
-
topPts: r
|
|
2276
|
-
};
|
|
2277
|
-
})
|
|
2278
|
-
};
|
|
2279
|
-
}
|
|
2280
|
-
return {
|
|
2281
|
-
yMin: c,
|
|
2282
|
-
yMax: l,
|
|
2283
|
-
yTicks: f,
|
|
2284
|
-
xLabels: p,
|
|
2285
|
-
seriesPoints: t.map((e) => e.map((e, t) => ({
|
|
2286
|
-
x: i.left + m(t),
|
|
2287
|
-
y: i.top + h(e)
|
|
2288
|
-
}))),
|
|
2289
|
-
stackedPaths: void 0
|
|
2290
|
-
};
|
|
2291
|
-
}, [
|
|
2292
|
-
e,
|
|
2293
|
-
v,
|
|
2294
|
-
y,
|
|
2295
|
-
a,
|
|
2296
|
-
o,
|
|
2297
|
-
d,
|
|
2298
|
-
u,
|
|
2299
|
-
i
|
|
2300
|
-
]), E = G([b, x], [y, 0]), D = G([0, Math.max(C.length - 1, 1)], [0, v]), O = K((r) => {
|
|
2301
|
-
let a = r.currentTarget.closest("svg");
|
|
2302
|
-
if (!a) return;
|
|
2303
|
-
let o = a.getBoundingClientRect(), s = n / o.width, c = (r.clientX - o.left) * s - i.left, l = Math.round(c / v * Math.max(C.length - 1, 1)), u = Math.max(0, Math.min(l, C.length - 1));
|
|
2304
|
-
_(u), m({
|
|
2305
|
-
label: C[u],
|
|
2306
|
-
items: e.map((e, n) => ({
|
|
2307
|
-
name: e.label,
|
|
2308
|
-
value: e.data[u] ?? 0,
|
|
2309
|
-
color: e.color ?? t[n % t.length]
|
|
2310
|
-
})),
|
|
2311
|
-
x: r.clientX - o.left,
|
|
2312
|
-
y: r.clientY - o.top
|
|
2313
|
-
});
|
|
2314
|
-
}, [
|
|
2315
|
-
e,
|
|
2316
|
-
t,
|
|
2317
|
-
C,
|
|
2318
|
-
v,
|
|
2319
|
-
i.left,
|
|
2320
|
-
n,
|
|
2321
|
-
m
|
|
2322
|
-
]), k = K(() => {
|
|
2323
|
-
_(null), m(null);
|
|
2324
|
-
}, [m]), A = S.map((e) => i.top + E(e)), j = S.map((e) => ({
|
|
2325
|
-
position: i.top + E(e),
|
|
2326
|
-
label: (o?.formatter ?? p)(e)
|
|
2327
|
-
})), M = C.map((e, t) => ({
|
|
2328
|
-
position: i.left + D(t),
|
|
2329
|
-
label: e
|
|
2330
|
-
}));
|
|
2331
|
-
return /* @__PURE__ */ Z("g", { children: [
|
|
2332
|
-
s && /* @__PURE__ */ X(hn, {
|
|
2333
|
-
x: i.left,
|
|
2334
|
-
y: i.top,
|
|
2335
|
-
width: v,
|
|
2336
|
-
height: y,
|
|
2337
|
-
horizontalLines: A
|
|
2338
|
-
}),
|
|
2339
|
-
l && /* @__PURE__ */ X(gn, {
|
|
2340
|
-
type: "y",
|
|
2341
|
-
x: i.left,
|
|
2342
|
-
y: i.top + y,
|
|
2343
|
-
length: y,
|
|
2344
|
-
ticks: j,
|
|
2345
|
-
title: o?.title
|
|
2346
|
-
}),
|
|
2347
|
-
c && /* @__PURE__ */ X(gn, {
|
|
2348
|
-
type: "x",
|
|
2349
|
-
x: i.left,
|
|
2350
|
-
y: i.top + y,
|
|
2351
|
-
length: v,
|
|
2352
|
-
ticks: M,
|
|
2353
|
-
title: a?.title
|
|
2354
|
-
}),
|
|
2355
|
-
/* @__PURE__ */ Z("g", {
|
|
2356
|
-
onMouseMove: O,
|
|
2357
|
-
onMouseLeave: k,
|
|
2358
|
-
children: [
|
|
2359
|
-
/* @__PURE__ */ X("rect", {
|
|
2360
|
-
x: i.left,
|
|
2361
|
-
y: i.top,
|
|
2362
|
-
width: v,
|
|
2363
|
-
height: y,
|
|
2364
|
-
fill: "transparent"
|
|
2365
|
-
}),
|
|
2366
|
-
d && T ? T.map((n, r) => {
|
|
2367
|
-
let i = e[r].color ?? t[r % t.length];
|
|
2368
|
-
return /* @__PURE__ */ Z("g", { children: [/* @__PURE__ */ X("path", {
|
|
2369
|
-
className: `chart-area-fill ${i}`,
|
|
2370
|
-
d: n.area
|
|
2371
|
-
}), /* @__PURE__ */ X("path", {
|
|
2372
|
-
className: `chart-line ${i} ${f ? "animated" : ""}`,
|
|
2373
|
-
d: n.line
|
|
2374
|
-
})] }, r);
|
|
2375
|
-
}) : w.map((n, r) => {
|
|
2376
|
-
let a = e[r].color ?? t[r % t.length], o = u ? Oe(n) : W(n), s = Me(n, i.top + y, u);
|
|
2377
|
-
return /* @__PURE__ */ Z("g", { children: [
|
|
2378
|
-
/* @__PURE__ */ X("path", {
|
|
2379
|
-
className: `chart-area-fill ${a}`,
|
|
2380
|
-
d: s
|
|
2381
|
-
}),
|
|
2382
|
-
/* @__PURE__ */ X("path", {
|
|
2383
|
-
className: `chart-line ${a} ${f ? "animated" : ""}`,
|
|
2384
|
-
d: o
|
|
2385
|
-
}),
|
|
2386
|
-
n.map((t, n) => /* @__PURE__ */ X("circle", {
|
|
2387
|
-
className: `chart-dot ${a} ${g === n ? "active" : ""}`,
|
|
2388
|
-
cx: t.x,
|
|
2389
|
-
cy: t.y,
|
|
2390
|
-
r: g === n ? 5 : 3,
|
|
2391
|
-
onClick: () => h?.(r, n, e[r].data[n]),
|
|
2392
|
-
style: { cursor: h ? "pointer" : void 0 }
|
|
2393
|
-
}, n))
|
|
2394
|
-
] }, r);
|
|
2395
|
-
}),
|
|
2396
|
-
g !== null && /* @__PURE__ */ X("line", {
|
|
2397
|
-
className: "chart-crosshair",
|
|
2398
|
-
x1: i.left + D(g),
|
|
2399
|
-
y1: i.top,
|
|
2400
|
-
x2: i.left + D(g),
|
|
2401
|
-
y2: i.top + y
|
|
2402
|
-
})
|
|
2403
|
-
]
|
|
2404
|
-
})
|
|
2405
|
-
] });
|
|
2406
|
-
}
|
|
2407
|
-
//#endregion
|
|
2408
|
-
//#region src/components/data/MChart/charts/MPieChart.tsx
|
|
2409
|
-
function bn({ data: e, colors: t, innerWidth: n, innerHeight: r, donut: i, donutWidth: a, animated: o, valueFormatter: s = pn, xAxis: c, onTooltip: l, onDataClick: u }) {
|
|
2410
|
-
let [d, f] = Y(null), p = n / 2, m = r / 2, h = Math.min(p, m) - 10, g = i ? h - (a ?? h * .4) : 0, _ = q(() => {
|
|
2411
|
-
let n = e.length === 1 ? e[0].data : e.map((e) => e.data[0] ?? 0), r = e.length === 1 ? c?.labels ?? n.map((e, t) => `Segment ${t + 1}`) : e.map((e) => e.label), i = n.reduce((e, t) => e + Math.max(t, 0), 0) || 1, a = -Math.PI / 2;
|
|
2412
|
-
return n.map((n, o) => {
|
|
2413
|
-
let s = Math.max(n, 0) / i * Math.PI * 2, c = {
|
|
2414
|
-
value: n,
|
|
2415
|
-
label: r[o] ?? `Segment ${o + 1}`,
|
|
2416
|
-
color: (e.length === 1 ? void 0 : e[o].color) ?? t[o % t.length],
|
|
2417
|
-
startAngle: a,
|
|
2418
|
-
endAngle: a + s,
|
|
2419
|
-
percentage: Math.max(n, 0) / i * 100
|
|
2420
|
-
};
|
|
2421
|
-
return a += s, c;
|
|
2422
|
-
});
|
|
2423
|
-
}, [
|
|
2424
|
-
e,
|
|
2425
|
-
t,
|
|
2426
|
-
c
|
|
2427
|
-
]), v = K((e, t) => {
|
|
2428
|
-
f(e);
|
|
2429
|
-
let n = t.currentTarget.closest("svg");
|
|
2430
|
-
if (!n) return;
|
|
2431
|
-
let r = n.getBoundingClientRect();
|
|
2432
|
-
l({
|
|
2433
|
-
label: _[e].label,
|
|
2434
|
-
items: [{
|
|
2435
|
-
name: _[e].label,
|
|
2436
|
-
value: _[e].value,
|
|
2437
|
-
color: _[e].color
|
|
2438
|
-
}],
|
|
2439
|
-
x: t.clientX - r.left,
|
|
2440
|
-
y: t.clientY - r.top
|
|
2441
|
-
});
|
|
2442
|
-
}, [_, l]), y = K(() => {
|
|
2443
|
-
f(null), l(null);
|
|
2444
|
-
}, [l]);
|
|
2445
|
-
return /* @__PURE__ */ Z("g", { children: [_.map((e, t) => {
|
|
2446
|
-
let n = d === t, r = Ae(p, m, n ? h + 4 : h, g, e.startAngle, e.endAngle);
|
|
2447
|
-
return /* @__PURE__ */ X("path", {
|
|
2448
|
-
className: `chart-pie-segment ${e.color} ${o ? "animated" : ""} ${n ? "active" : ""}`,
|
|
2449
|
-
d: r,
|
|
2450
|
-
onMouseEnter: (e) => v(t, e),
|
|
2451
|
-
onMouseLeave: y,
|
|
2452
|
-
onMouseMove: (t) => {
|
|
2453
|
-
let n = t.currentTarget.closest("svg");
|
|
2454
|
-
if (!n) return;
|
|
2455
|
-
let r = n.getBoundingClientRect();
|
|
2456
|
-
l({
|
|
2457
|
-
label: e.label,
|
|
2458
|
-
items: [{
|
|
2459
|
-
name: e.label,
|
|
2460
|
-
value: e.value,
|
|
2461
|
-
color: e.color
|
|
2462
|
-
}],
|
|
2463
|
-
x: t.clientX - r.left,
|
|
2464
|
-
y: t.clientY - r.top
|
|
2465
|
-
});
|
|
2466
|
-
},
|
|
2467
|
-
onClick: () => u?.(0, t, e.value),
|
|
2468
|
-
style: { cursor: u ? "pointer" : void 0 }
|
|
2469
|
-
}, t);
|
|
2470
|
-
}), i && /* @__PURE__ */ X("text", {
|
|
2471
|
-
x: p,
|
|
2472
|
-
y: m,
|
|
2473
|
-
textAnchor: "middle",
|
|
2474
|
-
dominantBaseline: "middle",
|
|
2475
|
-
className: "chart-pie-center",
|
|
2476
|
-
children: s(d === null ? _.reduce((e, t) => e + t.value, 0) : _[d].value)
|
|
2477
|
-
})] });
|
|
2478
|
-
}
|
|
2479
|
-
//#endregion
|
|
2480
|
-
//#region src/components/data/MChart/parts/ChartDefs.tsx
|
|
2481
|
-
var xn = [
|
|
2482
|
-
"primary",
|
|
2483
|
-
"info",
|
|
2484
|
-
"success",
|
|
2485
|
-
"warning",
|
|
2486
|
-
"error",
|
|
2487
|
-
"news",
|
|
2488
|
-
"neutral",
|
|
2489
|
-
"dark",
|
|
2490
|
-
"light"
|
|
2491
|
-
];
|
|
2492
|
-
function Sn() {
|
|
2493
|
-
return /* @__PURE__ */ Z("defs", { children: [
|
|
2494
|
-
xn.map((e) => /* @__PURE__ */ Z("linearGradient", {
|
|
2495
|
-
id: `chart-bar-grad-${e}`,
|
|
2496
|
-
x1: "0",
|
|
2497
|
-
y1: "0",
|
|
2498
|
-
x2: "0",
|
|
2499
|
-
y2: "1",
|
|
2500
|
-
children: [/* @__PURE__ */ X("stop", {
|
|
2501
|
-
offset: "0%",
|
|
2502
|
-
className: `chart-grad-stop-start ${e}`
|
|
2503
|
-
}), /* @__PURE__ */ X("stop", {
|
|
2504
|
-
offset: "100%",
|
|
2505
|
-
className: `chart-grad-stop-end ${e}`
|
|
2506
|
-
})]
|
|
2507
|
-
}, `bar-${e}`)),
|
|
2508
|
-
xn.map((e) => /* @__PURE__ */ Z("linearGradient", {
|
|
2509
|
-
id: `chart-pie-grad-${e}`,
|
|
2510
|
-
x1: "0.3",
|
|
2511
|
-
y1: "0",
|
|
2512
|
-
x2: "0.7",
|
|
2513
|
-
y2: "1",
|
|
2514
|
-
children: [/* @__PURE__ */ X("stop", {
|
|
2515
|
-
offset: "0%",
|
|
2516
|
-
className: `chart-grad-stop-start ${e}`
|
|
2517
|
-
}), /* @__PURE__ */ X("stop", {
|
|
2518
|
-
offset: "100%",
|
|
2519
|
-
className: `chart-grad-stop-end ${e}`
|
|
2520
|
-
})]
|
|
2521
|
-
}, `pie-${e}`)),
|
|
2522
|
-
xn.map((e) => /* @__PURE__ */ Z("linearGradient", {
|
|
2523
|
-
id: `chart-area-grad-${e}`,
|
|
2524
|
-
x1: "0",
|
|
2525
|
-
y1: "0",
|
|
2526
|
-
x2: "0",
|
|
2527
|
-
y2: "1",
|
|
2528
|
-
children: [/* @__PURE__ */ X("stop", {
|
|
2529
|
-
offset: "0%",
|
|
2530
|
-
className: `chart-grad-area-start ${e}`
|
|
2531
|
-
}), /* @__PURE__ */ X("stop", {
|
|
2532
|
-
offset: "100%",
|
|
2533
|
-
className: `chart-grad-area-end ${e}`
|
|
2534
|
-
})]
|
|
2535
|
-
}, `area-${e}`))
|
|
2536
|
-
] });
|
|
2537
|
-
}
|
|
2538
|
-
//#endregion
|
|
2539
|
-
//#region src/components/data/MChart/parts/ChartTooltip.tsx
|
|
2540
|
-
function Cn({ data: e, valueFormatter: t }) {
|
|
2541
|
-
return e ? /* @__PURE__ */ Z("div", {
|
|
2542
|
-
className: "chart-tooltip",
|
|
2543
|
-
style: {
|
|
2544
|
-
left: e.x,
|
|
2545
|
-
top: e.y
|
|
2546
|
-
},
|
|
2547
|
-
children: [/* @__PURE__ */ X("div", {
|
|
2548
|
-
className: "chart-tooltip-label",
|
|
2549
|
-
children: e.label
|
|
2550
|
-
}), e.items.map((e, n) => /* @__PURE__ */ Z("div", {
|
|
2551
|
-
className: "chart-tooltip-row",
|
|
2552
|
-
children: [
|
|
2553
|
-
/* @__PURE__ */ X("span", { className: `chart-tooltip-dot ${e.color}` }),
|
|
2554
|
-
/* @__PURE__ */ X("span", {
|
|
2555
|
-
className: "chart-tooltip-name",
|
|
2556
|
-
children: e.name
|
|
2557
|
-
}),
|
|
2558
|
-
/* @__PURE__ */ X("span", {
|
|
2559
|
-
className: "chart-tooltip-value",
|
|
2560
|
-
children: t(e.value)
|
|
2561
|
-
})
|
|
2562
|
-
]
|
|
2563
|
-
}, n))]
|
|
2564
|
-
}) : null;
|
|
2565
|
-
}
|
|
2566
|
-
//#endregion
|
|
2567
|
-
//#region src/components/data/MChart/parts/ChartLegend.tsx
|
|
2568
|
-
function wn({ items: e }) {
|
|
2569
|
-
return e.length <= 1 ? null : /* @__PURE__ */ X("div", {
|
|
2570
|
-
className: "chart-legend",
|
|
2571
|
-
children: e.map((e, t) => /* @__PURE__ */ Z("div", {
|
|
2572
|
-
className: "chart-legend-item",
|
|
2573
|
-
children: [/* @__PURE__ */ X("span", { className: `chart-legend-dot ${e.color}` }), /* @__PURE__ */ X("span", {
|
|
2574
|
-
className: "chart-legend-label",
|
|
2575
|
-
children: e.label
|
|
2576
|
-
})]
|
|
2577
|
-
}, t))
|
|
2578
|
-
});
|
|
2579
|
-
}
|
|
2580
|
-
//#endregion
|
|
2581
|
-
//#region src/components/data/MChart/MChart.tsx
|
|
2582
|
-
function Tn({ type: e, data: t, width: n = "100%", height: r = 300, aspectRatio: i, xAxis: a, yAxis: o, showGrid: s = !0, showXAxis: c = !0, showYAxis: l = !0, showLegend: u = !0, showTooltip: d = !0, animated: f = !0, stacked: p = !1, curved: m = !1, donut: h = !1, donutWidth: g, valueFormatter: _ = pn, labelFormatter: v = mn, onDataClick: y, className: b, style: x, ...S }) {
|
|
2583
|
-
let C = J(null), [w, T] = Y(null), E = un, D = a?.title || o?.title ? fn : dn, O = i ? void 0 : typeof r == "number" ? r : 300, k = O ?? 300, A = K((e) => {
|
|
2584
|
-
d && T(e);
|
|
2585
|
-
}, [d]), j = q(() => e === "pie" && t.length === 1 ? (a?.labels ?? t[0].data.map((e, t) => `Segment ${t + 1}`)).map((e, t) => ({
|
|
2586
|
-
label: e,
|
|
2587
|
-
color: E[t % E.length]
|
|
2588
|
-
})) : t.map((e, t) => ({
|
|
2589
|
-
label: e.label,
|
|
2590
|
-
color: e.color ?? E[t % E.length]
|
|
2591
|
-
})), [
|
|
2592
|
-
t,
|
|
2593
|
-
E,
|
|
2594
|
-
e,
|
|
2595
|
-
a
|
|
2596
|
-
]), M = {
|
|
2597
|
-
data: t,
|
|
2598
|
-
colors: E,
|
|
2599
|
-
innerWidth: 600,
|
|
2600
|
-
innerHeight: k,
|
|
2601
|
-
padding: D,
|
|
2602
|
-
xAxis: a,
|
|
2603
|
-
yAxis: o,
|
|
2604
|
-
showGrid: s,
|
|
2605
|
-
showXAxis: c,
|
|
2606
|
-
showYAxis: l,
|
|
2607
|
-
animated: f,
|
|
2608
|
-
valueFormatter: _,
|
|
2609
|
-
onTooltip: A,
|
|
2610
|
-
onDataClick: y
|
|
2611
|
-
};
|
|
2612
|
-
return /* @__PURE__ */ Z("div", {
|
|
2613
|
-
ref: C,
|
|
2614
|
-
className: P("chart", b),
|
|
2615
|
-
style: {
|
|
2616
|
-
width: n,
|
|
2617
|
-
height: i ? void 0 : O,
|
|
2618
|
-
aspectRatio: i ? String(i) : void 0,
|
|
2619
|
-
...x
|
|
2620
|
-
},
|
|
2621
|
-
...S,
|
|
2622
|
-
children: [
|
|
2623
|
-
/* @__PURE__ */ Z("svg", {
|
|
2624
|
-
viewBox: `0 0 600 ${k}`,
|
|
2625
|
-
preserveAspectRatio: "xMidYMid meet",
|
|
2626
|
-
className: "chart-svg",
|
|
2627
|
-
children: [
|
|
2628
|
-
/* @__PURE__ */ X(Sn, {}),
|
|
2629
|
-
e === "line" && /* @__PURE__ */ X(_n, {
|
|
2630
|
-
...M,
|
|
2631
|
-
curved: m
|
|
2632
|
-
}),
|
|
2633
|
-
e === "bar" && /* @__PURE__ */ X(vn, {
|
|
2634
|
-
...M,
|
|
2635
|
-
stacked: p
|
|
2636
|
-
}),
|
|
2637
|
-
e === "area" && /* @__PURE__ */ X(yn, {
|
|
2638
|
-
...M,
|
|
2639
|
-
curved: m,
|
|
2640
|
-
stacked: p
|
|
2641
|
-
}),
|
|
2642
|
-
e === "pie" && /* @__PURE__ */ X(bn, {
|
|
2643
|
-
...M,
|
|
2644
|
-
donut: h,
|
|
2645
|
-
donutWidth: g
|
|
2646
|
-
})
|
|
2647
|
-
]
|
|
2648
|
-
}),
|
|
2649
|
-
d && /* @__PURE__ */ X(Cn, {
|
|
2650
|
-
data: w,
|
|
2651
|
-
valueFormatter: _
|
|
2652
|
-
}),
|
|
2653
|
-
u && /* @__PURE__ */ X(wn, { items: j })
|
|
2654
|
-
]
|
|
2655
|
-
});
|
|
2656
|
-
}
|
|
2657
|
-
//#endregion
|
|
2658
|
-
//#region src/components/data/MChart/MLineChart.tsx
|
|
2659
|
-
function En(e) {
|
|
2660
|
-
return /* @__PURE__ */ X(Tn, {
|
|
2661
|
-
type: "line",
|
|
2662
|
-
...e
|
|
2663
|
-
});
|
|
2664
|
-
}
|
|
2665
|
-
//#endregion
|
|
2666
|
-
//#region src/components/data/MChart/MBarChart.tsx
|
|
2667
|
-
function Dn(e) {
|
|
2668
|
-
return /* @__PURE__ */ X(Tn, {
|
|
2669
|
-
type: "bar",
|
|
2670
|
-
...e
|
|
2671
|
-
});
|
|
2672
|
-
}
|
|
2673
|
-
//#endregion
|
|
2674
|
-
//#region src/components/data/MChart/MAreaChart.tsx
|
|
2675
|
-
function On(e) {
|
|
2676
|
-
return /* @__PURE__ */ X(Tn, {
|
|
2677
|
-
type: "area",
|
|
2678
|
-
...e
|
|
2679
|
-
});
|
|
2680
|
-
}
|
|
2681
|
-
//#endregion
|
|
2682
|
-
//#region src/components/data/MChart/MPieChart.tsx
|
|
2683
|
-
function kn(e) {
|
|
2684
|
-
return /* @__PURE__ */ X(Tn, {
|
|
2685
|
-
type: "pie",
|
|
2686
|
-
...e
|
|
2687
|
-
});
|
|
2688
|
-
}
|
|
2689
|
-
//#endregion
|
|
2690
|
-
export { nt as _, ln as a, Xe as b, rn as c, on as d, xt as f, rt as g, it as h, En as i, cn as l, at as m, On as n, tn as o, ot as p, Dn as r, nn as s, kn as t, Qt as u, $e as v, Ye as x, Qe as y };
|
|
2691
|
-
|
|
2692
|
-
//# sourceMappingURL=data-z3e8XTSt.js.map
|