react-timelane 1.2.0 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/bind-all.js +4 -0
- package/dist/_virtual/bind.js +4 -0
- package/dist/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/_virtual/index3.js +5 -0
- package/dist/_virtual/index4.js +4 -0
- package/dist/_virtual/react-dom.development.js +4 -0
- package/dist/_virtual/react-dom.production.js +4 -0
- package/dist/components/Timelane/Timelane.css +1 -0
- package/dist/components/Timelane/Timelane.js +53 -0
- package/dist/components/TimelaneAllocation/TimelaneAllocation.js +49 -0
- package/dist/components/TimelaneAside/TimelaneAside.d.ts +6 -1
- package/dist/components/TimelaneAside/TimelaneAside.js +60 -0
- package/dist/components/TimelaneBackground/TimelaneBackground.js +46 -0
- package/dist/components/TimelaneBody/TimelaneBody.js +13 -0
- package/dist/components/TimelaneBody/TimelaneSelectionLayer.js +96 -0
- package/dist/components/TimelaneHeader/DaysHeader.js +30 -0
- package/dist/components/TimelaneHeader/MonthsHeader.js +38 -0
- package/dist/components/TimelaneHeader/TimelaneHeader.js +55 -0
- package/dist/components/TimelaneHeader/WeeksHeader.js +39 -0
- package/dist/components/TimelaneHeader/renderingUtils.js +26 -0
- package/dist/components/TimelaneItem/DragResizeComponent.js +125 -0
- package/dist/components/TimelaneItem/TimelaneItem.js +42 -0
- package/dist/components/TimelaneLane/DropPreview.js +25 -0
- package/dist/components/TimelaneLane/DropTarget.js +57 -0
- package/dist/components/TimelaneLane/OverlapIndicator.js +21 -0
- package/dist/components/TimelaneLane/TimelaneLane.js +164 -0
- package/dist/components/TimelaneLayout/TimelaneLayout.js +77 -0
- package/dist/components/TimelaneLayout/layout.css +1 -0
- package/dist/components/TimelaneSettingsProvider/TimelaneSettingsContext.js +21 -0
- package/dist/components/TimelaneSettingsProvider/TimelaneSettingsProvider.js +15 -0
- package/dist/components/utils.js +243 -0
- package/dist/hooks/useScroll.js +47 -0
- package/dist/hooks/useTimelaneContext.js +6 -0
- package/dist/index.js +36 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter-native-data-key.js +4 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter.js +127 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/get-element-from-point-without-honey-pot.js +9 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/honey-pot-data-attribute.js +4 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/is-honey-pot-element.js +7 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/honey-pot-fix/make-honey-pot-fix.js +226 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/dispatch-consumer-event.js +107 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/lifecycle-manager.js +195 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/ledger/usage-ledger.js +21 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-adapter.js +43 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-drop-target.js +253 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/make-adapter/make-monitor.js +121 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/combine.js +12 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/public-utils/once.js +17 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/add-attribute.js +9 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/android.js +8 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/count-events-for-safari.js +57 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-from-another-window.js +9 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/changing-window/is-leaving-window.js +13 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/detect-broken-drag.js +47 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/get-input.js +17 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-firefox.js +7 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/is-safari.js +10 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/max-z-index.js +4 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/media-types/text-media-type.js +4 -0
- package/dist/node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/util/media-types/url-media-type.js +4 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +8 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js +6 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +7 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/defineProperty.js +12 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +6 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js +21 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableRest.js +7 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +7 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/slicedToArray.js +10 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +10 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +14 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +9 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/typeof.js +11 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +11 -0
- package/dist/node_modules/bind-event-listener/dist/bind-all.js +45 -0
- package/dist/node_modules/bind-event-listener/dist/bind.js +16 -0
- package/dist/node_modules/bind-event-listener/dist/index.js +20 -0
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +7 -0
- package/dist/node_modules/date-fns/_lib/defaultOptions.js +7 -0
- package/dist/node_modules/date-fns/_lib/format/formatters.js +583 -0
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +59 -0
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js +52 -0
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +18 -0
- package/dist/node_modules/date-fns/_lib/normalizeDates.js +11 -0
- package/dist/node_modules/date-fns/_lib/normalizeInterval.js +8 -0
- package/dist/node_modules/date-fns/_lib/protectedTokens.js +20 -0
- package/dist/node_modules/date-fns/addDays.js +10 -0
- package/dist/node_modules/date-fns/addWeeks.js +8 -0
- package/dist/node_modules/date-fns/constants.js +6 -0
- package/dist/node_modules/date-fns/constructFrom.js +8 -0
- package/dist/node_modules/date-fns/differenceInCalendarDays.js +16 -0
- package/dist/node_modules/date-fns/eachDayOfInterval.js +17 -0
- package/dist/node_modules/date-fns/eachMonthOfInterval.js +17 -0
- package/dist/node_modules/date-fns/eachWeekOfInterval.js +22 -0
- package/dist/node_modules/date-fns/format.js +59 -0
- package/dist/node_modules/date-fns/getDay.js +8 -0
- package/dist/node_modules/date-fns/getDayOfYear.js +11 -0
- package/dist/node_modules/date-fns/getISOWeek.js +12 -0
- package/dist/node_modules/date-fns/getISOWeekYear.js +15 -0
- package/dist/node_modules/date-fns/getWeek.js +12 -0
- package/dist/node_modules/date-fns/getWeekYear.js +17 -0
- package/dist/node_modules/date-fns/isDate.js +7 -0
- package/dist/node_modules/date-fns/isSameDay.js +14 -0
- package/dist/node_modules/date-fns/isSunday.js +8 -0
- package/dist/node_modules/date-fns/isValid.js +9 -0
- package/dist/node_modules/date-fns/lastDayOfMonth.js +9 -0
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +9 -0
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +18 -0
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +31 -0
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +15 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +70 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +33 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +11 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +155 -0
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +110 -0
- package/dist/node_modules/date-fns/locale/en-US.js +21 -0
- package/dist/node_modules/date-fns/max.js +14 -0
- package/dist/node_modules/date-fns/min.js +14 -0
- package/dist/node_modules/date-fns/nextDay.js +10 -0
- package/dist/node_modules/date-fns/nextSunday.js +8 -0
- package/dist/node_modules/date-fns/setHours.js +9 -0
- package/dist/node_modules/date-fns/startOfDay.js +9 -0
- package/dist/node_modules/date-fns/startOfISOWeek.js +8 -0
- package/dist/node_modules/date-fns/startOfISOWeekYear.js +11 -0
- package/dist/node_modules/date-fns/startOfWeek.js +11 -0
- package/dist/node_modules/date-fns/startOfWeekYear.js +13 -0
- package/dist/node_modules/date-fns/startOfYear.js +9 -0
- package/dist/node_modules/date-fns/toDate.js +8 -0
- package/dist/node_modules/raf-schd/dist/raf-schd.esm.js +15 -0
- package/dist/node_modules/re-resizable/lib/index.js +424 -0
- package/dist/node_modules/re-resizable/lib/resizer.js +49 -0
- package/dist/node_modules/react-dom/cjs/react-dom.development.js +227 -0
- package/dist/node_modules/react-dom/cjs/react-dom.production.js +147 -0
- package/dist/node_modules/react-dom/index.js +23 -0
- package/dist/node_modules/tiny-invariant/dist/esm/tiny-invariant.js +12 -0
- package/dist/types/Item.js +6 -0
- package/package.json +15 -6
- package/dist/react-timelane.css +0 -1
- package/dist/react-timelane.js +0 -4752
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*{box-sizing:border-box}.timelane{--timelane-aside-width: 150px;--timelane-border-color-light: #f0f0f0;--timelane-border-color-normal: lightgray;--timelane-border-color-dark: gray;--timelane-highlight-color: #f8f8f8;--timelane-focused-color: rgba(0, 0, 255, .1);--timelane-hover-color: rgba(0, 0, 0, .05);overflow:auto;position:relative;width:100%;height:100%}.timelane .timelane-header{width:fit-content;top:0;z-index:101;background:#fff}.timelane .timelane-header .timelane-header-months{display:flex;flex-flow:row nowrap}.timelane .timelane-header .timelane-header-months .timelane-header-month-label{border-right:1px solid var(--timelane-border-color-normal);border-bottom:1px solid var(--timelane-border-color-normal);overflow:hidden;font-size:1em;height:30px;line-height:30px;text-align:center;cursor:pointer}.timelane .timelane-header .timelane-header-months .timelane-header-month-label:hover{background:var(--timelane-hover-color)}.timelane .timelane-header .timelane-header-weeks{display:flex;flex-flow:row nowrap}.timelane .timelane-header .timelane-header-weeks .timelane-header-week-label{border-right:1px solid var(--timelane-border-color-normal);border-bottom:1px solid var(--timelane-border-color-normal);overflow:hidden;font-size:1em;height:30px;line-height:30px;text-align:center;cursor:pointer}.timelane .timelane-header .timelane-header-weeks .timelane-header-week-label:hover{background:var(--timelane-hover-color)}.timelane .timelane-header .timelane-header-days{display:flex;flex-flow:row nowrap}.timelane .timelane-header .timelane-header-days .timelane-header-day-label{border-right:1px solid var(--timelane-border-color-normal);overflow:hidden;font-size:.8em;height:20px;line-height:20px;text-align:center;cursor:pointer}.timelane .timelane-header .timelane-header-days .timelane-header-day-label:hover{background:var(--timelane-hover-color)}.timelane .timelane-header .timelane-header-days .timelane-header-day-label.timelane-header-day-label-focused{background:var(--timelane-focused-color)}.timelane .timelane-header-corner{z-index:102;background:#fff}.timelane .timelane-body{z-index:99;position:relative;width:fit-content}.timelane .timelane-body .timelane-lane{border-color:var(--timelane-border-color-normal)!important;border-top:1px solid gray;margin-top:-1px;overflow:hidden}.timelane .timelane-body .timelane-lane .timelane-drop-target{position:relative;width:100%;height:100%}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item{position:absolute;cursor:pointer;border-radius:3px;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item.timelane-item-marked .timelane-allocation{border:2px dashed rgba(0,0,0,.5)}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-item-drag-handle{height:100%}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-item-resize-handle{background:#bed7dc;border-radius:5px;top:4px!important;bottom:4px!important;height:auto!important;width:6px!important;z-index:2;background:transparent!important;transition:.2s}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-item-resize-handle:hover{background:#0000001a!important}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-item-resize-handle.timelane-item-resize-handle-left{left:0!important;margin-left:1px}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-item-resize-handle.timelane-item-resize-handle-right{right:0!important}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-allocation{background:#92a8d1;border-radius:2px;border:2px solid transparent;height:calc(100% - 1px);overflow:hidden;cursor:pointer;padding:0 4px;margin-left:1px;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;container-type:size;container-name:timelane-allocation}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-allocation .timelane-allocation-title{font-weight:700;transform-origin:top left;line-height:30px;white-space:nowrap}@container timelane-allocation (max-height: 30px){.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-allocation .timelane-allocation-title{margin:0}}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item .timelane-allocation.timelane-allocation-selected{border:2px dashed rgba(0,0,0,.5)}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-item.dragging{opacity:0}.timelane .timelane-body .timelane-lane .timelane-drop-target .timelane-drop-preview{background:#00f;position:absolute;border-radius:2px;color:#fff}.timelane .timelane-body .timelane-lane.timelane-row-focused{background:var(--timelane-focused-color)}.timelane .timelane-aside{width:var(--timelane-aside-width);background:#fff}.timelane .timelane-aside .timelane-aside-lane-header{border-top:1px solid var(--timelane-border-color-normal);margin-top:-1px;padding:10px;overflow:hidden;position:relative;cursor:pointer}.timelane .timelane-aside .timelane-aside-lane-header.timelane-aside-lane-header-focused{background:var(--timelane-focused-color)}.timelane .timelane-aside .timelane-aside-lane-header:hover .timelane-aside-resource-menu{opacity:1}.timelane .timelane-aside .timelane-aside-lane-header .timelane-aside-resource-menu{position:absolute;top:5px;right:5px;opacity:0;transition:.15s}.timelane .timelane-aside .timelane-aside-lane-header .timelane-aside-resource-menu.timelane-aside-resource-menu-open{opacity:1}.timelane .timelane-background{position:relative;width:100%;height:100%}.timelane .timelane-background .timelane-background-inner{display:flex;flex-flow:row nowrap;height:100%}.timelane .timelane-background .timelane-background-inner .timelane-background-day-label{border-right:1px solid var(--timelane-border-color-light);overflow:hidden;font-size:.8em;height:100%;z-index:-100}.timelane .timelane-background .timelane-background-inner .timelane-background-day-label.timelane-background-day-label-sunday{border-right:1px solid var(--timelane-border-color-normal)}.timelane .timelane-background .timelane-background-inner .timelane-background-day-label.timelane-background-day-label-focused{background:var(--timelane-focused-color)}.timelane .timelane-background .timelane-background-inner .timelane-background-focused-day-position{position:absolute;height:100%;background:var(--timelane-focused-color);z-index:-101}.timelane-header-tooltip,.timelane-header-day-tooltip{font-size:2em}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { TimelaneLane as T } from "../TimelaneLane/TimelaneLane.js";
|
|
3
|
+
import { TimelaneBody as c } from "../TimelaneBody/TimelaneBody.js";
|
|
4
|
+
import { TimelaneLayout as l } from "../TimelaneLayout/TimelaneLayout.js";
|
|
5
|
+
import { TimelaneHeader as u } from "../TimelaneHeader/TimelaneHeader.js";
|
|
6
|
+
import { TimelaneBackground as x } from "../TimelaneBackground/TimelaneBackground.js";
|
|
7
|
+
import { TimelaneAside as y } from "../TimelaneAside/TimelaneAside.js";
|
|
8
|
+
import { TimelaneSettingsProvider as h } from "../TimelaneSettingsProvider/TimelaneSettingsProvider.js";
|
|
9
|
+
import { useTimelaneContext as L } from "../../hooks/useTimelaneContext.js";
|
|
10
|
+
import './Timelane.css';/* empty css */
|
|
11
|
+
function i({
|
|
12
|
+
start: d,
|
|
13
|
+
end: p,
|
|
14
|
+
pixelsPerDay: f,
|
|
15
|
+
pixelsPerLane: g,
|
|
16
|
+
showMonths: r,
|
|
17
|
+
showWeeks: n,
|
|
18
|
+
showDays: a,
|
|
19
|
+
allowOverlaps: m,
|
|
20
|
+
enableItemResizing: t,
|
|
21
|
+
enableItemDragging: s,
|
|
22
|
+
children: v
|
|
23
|
+
}) {
|
|
24
|
+
const { settings: e } = L();
|
|
25
|
+
return /* @__PURE__ */ o(
|
|
26
|
+
h,
|
|
27
|
+
{
|
|
28
|
+
settings: {
|
|
29
|
+
...e,
|
|
30
|
+
start: d || e.start,
|
|
31
|
+
end: p || e.end,
|
|
32
|
+
pixelsPerDay: f || e.pixelsPerDay,
|
|
33
|
+
pixelsPerLane: g || e.pixelsPerLane,
|
|
34
|
+
showMonths: r !== void 0 ? r : e.showMonths,
|
|
35
|
+
showWeeks: n !== void 0 ? n : e.showWeeks,
|
|
36
|
+
showDays: a !== void 0 ? a : e.showDays,
|
|
37
|
+
allowOverlaps: m !== void 0 ? m : e.allowOverlaps,
|
|
38
|
+
enableItemDragging: s !== void 0 ? s : e.enableItemDragging,
|
|
39
|
+
enableItemResizing: t !== void 0 ? t : e.enableItemResizing
|
|
40
|
+
},
|
|
41
|
+
children: /* @__PURE__ */ o("div", { className: "timelane", children: /* @__PURE__ */ o(l, { children: v }) })
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
i.Header = u;
|
|
46
|
+
i.Body = c;
|
|
47
|
+
i.Background = x;
|
|
48
|
+
i.Aside = y;
|
|
49
|
+
i.Lane = T;
|
|
50
|
+
i.Layout = l;
|
|
51
|
+
export {
|
|
52
|
+
i as Timelane
|
|
53
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsxs as m, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as d } from "react";
|
|
3
|
+
const i = 30;
|
|
4
|
+
function h({
|
|
5
|
+
name: o,
|
|
6
|
+
description: a = "",
|
|
7
|
+
isSelected: s = !1,
|
|
8
|
+
onClick: c = () => {
|
|
9
|
+
},
|
|
10
|
+
onContextMenu: r = () => {
|
|
11
|
+
}
|
|
12
|
+
}) {
|
|
13
|
+
const t = d(null);
|
|
14
|
+
let l = 1;
|
|
15
|
+
if (t.current) {
|
|
16
|
+
const e = t.current.getBoundingClientRect().height;
|
|
17
|
+
e > 0 && e < i && (l = e / i);
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ m(
|
|
20
|
+
"div",
|
|
21
|
+
{
|
|
22
|
+
className: `timelane-allocation ${s ? "timelane-allocation-selected" : ""}`,
|
|
23
|
+
onClick: c,
|
|
24
|
+
onContextMenu: (e) => {
|
|
25
|
+
e.preventDefault(), e.stopPropagation(), r(e);
|
|
26
|
+
},
|
|
27
|
+
ref: t,
|
|
28
|
+
style: {
|
|
29
|
+
background: "lightblue"
|
|
30
|
+
},
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ n(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
className: "timelane-allocation-title",
|
|
36
|
+
style: {
|
|
37
|
+
transform: `scale(${l})`
|
|
38
|
+
},
|
|
39
|
+
children: o
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
/* @__PURE__ */ n("div", { style: { fontSize: "small" }, children: a })
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
h as TimelaneAllocation
|
|
49
|
+
};
|
|
@@ -2,6 +2,11 @@ import { MouseEvent, ReactElement } from 'react';
|
|
|
2
2
|
import { Lane } from '../../types';
|
|
3
3
|
export interface TimelaneAsideProps {
|
|
4
4
|
lanes: Lane[];
|
|
5
|
+
/**
|
|
6
|
+
* the width in px
|
|
7
|
+
*/
|
|
8
|
+
width?: number;
|
|
9
|
+
side?: "left" | "right";
|
|
5
10
|
/**
|
|
6
11
|
* deprecated
|
|
7
12
|
*/
|
|
@@ -22,4 +27,4 @@ export interface TimelaneAsideProps {
|
|
|
22
27
|
*
|
|
23
28
|
* It must be a child component of `<Timelane>`.
|
|
24
29
|
*/
|
|
25
|
-
export declare function TimelaneAside({ lanes, focusedLane, setFocusedLane, onLaneHeaderClick, onLaneHeaderDoubleClick, onLaneHeaderContextMenu, renderLaneHeader, }: TimelaneAsideProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare function TimelaneAside({ lanes, width, side, focusedLane, setFocusedLane, onLaneHeaderClick, onLaneHeaderDoubleClick, onLaneHeaderContextMenu, renderLaneHeader, }: TimelaneAsideProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { TimelaneLayout as h } from "../TimelaneLayout/TimelaneLayout.js";
|
|
3
|
+
import { useTimelaneContext as f } from "../../hooks/useTimelaneContext.js";
|
|
4
|
+
function y({
|
|
5
|
+
lanes: i,
|
|
6
|
+
width: o = 100,
|
|
7
|
+
side: r = "left",
|
|
8
|
+
focusedLane: n,
|
|
9
|
+
setFocusedLane: s = () => {
|
|
10
|
+
},
|
|
11
|
+
onLaneHeaderClick: a = () => {
|
|
12
|
+
},
|
|
13
|
+
onLaneHeaderDoubleClick: l = () => {
|
|
14
|
+
},
|
|
15
|
+
onLaneHeaderContextMenu: m = () => {
|
|
16
|
+
},
|
|
17
|
+
renderLaneHeader: c = v
|
|
18
|
+
}) {
|
|
19
|
+
const { settings: u } = f();
|
|
20
|
+
return /* @__PURE__ */ t(h.Aside, { side: r, children: /* @__PURE__ */ t("div", { className: "timelane-aside", style: { width: `${o}px` }, children: i && i.map((e) => /* @__PURE__ */ t(
|
|
21
|
+
p,
|
|
22
|
+
{
|
|
23
|
+
height: u.pixelsPerLane,
|
|
24
|
+
isFocused: n ? n.id === e.id : !1,
|
|
25
|
+
onClick: (d) => {
|
|
26
|
+
s(e), a(e, d);
|
|
27
|
+
},
|
|
28
|
+
onDoubleClick: (d) => l(e, d),
|
|
29
|
+
onContextMenu: (d) => m(e, d),
|
|
30
|
+
children: c(e)
|
|
31
|
+
},
|
|
32
|
+
e.id
|
|
33
|
+
)) }) });
|
|
34
|
+
}
|
|
35
|
+
function p({
|
|
36
|
+
height: i,
|
|
37
|
+
isFocused: o,
|
|
38
|
+
onClick: r,
|
|
39
|
+
onDoubleClick: n,
|
|
40
|
+
onContextMenu: s,
|
|
41
|
+
children: a
|
|
42
|
+
}) {
|
|
43
|
+
return /* @__PURE__ */ t(
|
|
44
|
+
"div",
|
|
45
|
+
{
|
|
46
|
+
className: `timelane-aside-lane-header ${o ? "timelane-aside-lane-header-focused" : ""}`,
|
|
47
|
+
style: { height: `${i}px` },
|
|
48
|
+
onClick: r,
|
|
49
|
+
onDoubleClick: n,
|
|
50
|
+
onContextMenu: s,
|
|
51
|
+
children: a
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
function v(i) {
|
|
56
|
+
return /* @__PURE__ */ t("div", { children: i.id });
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
y as TimelaneAside
|
|
60
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as e, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import { dateToPixel as n } from "../utils.js";
|
|
3
|
+
import { useTimelaneContext as m } from "../../hooks/useTimelaneContext.js";
|
|
4
|
+
import { TimelaneLayout as d } from "../TimelaneLayout/TimelaneLayout.js";
|
|
5
|
+
import { eachDayOfInterval as l } from "../../node_modules/date-fns/eachDayOfInterval.js";
|
|
6
|
+
import { formatDate as s } from "../../node_modules/date-fns/format.js";
|
|
7
|
+
import { isSunday as c } from "../../node_modules/date-fns/isSunday.js";
|
|
8
|
+
function b({ focusedDay: t }) {
|
|
9
|
+
const { settings: a } = m();
|
|
10
|
+
return /* @__PURE__ */ e(d.Background, { children: /* @__PURE__ */ e("div", { className: "timelane-background", children: /* @__PURE__ */ o("div", { className: "timelane-background-inner", children: [
|
|
11
|
+
t && /* @__PURE__ */ e(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
className: "timelane-background-focused-day-position",
|
|
15
|
+
style: {
|
|
16
|
+
width: `${a.pixelsPerDay}px`,
|
|
17
|
+
marginLeft: `${n(t, a.start, a) - a.pixelsPerDay / 2}px`
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
),
|
|
21
|
+
/* @__PURE__ */ e(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
id: "timelane-background-date-anchor",
|
|
25
|
+
style: {
|
|
26
|
+
position: "absolute",
|
|
27
|
+
top: 0,
|
|
28
|
+
width: "1px",
|
|
29
|
+
height: "100%"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
l(a).map((i, r) => /* @__PURE__ */ e(
|
|
34
|
+
"div",
|
|
35
|
+
{
|
|
36
|
+
className: `timelane-background-day-label ${c(i) ? "timelane-background-day-label-sunday" : ""} `,
|
|
37
|
+
style: { width: `${a.pixelsPerDay}px` },
|
|
38
|
+
"data-day": s(i, "yyyy-MM-dd")
|
|
39
|
+
},
|
|
40
|
+
r
|
|
41
|
+
))
|
|
42
|
+
] }) }) });
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
b as TimelaneBackground
|
|
46
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { TimelaneLayout as r } from "../TimelaneLayout/TimelaneLayout.js";
|
|
3
|
+
import { TimelaneSelectionLayer as m } from "./TimelaneSelectionLayer.js";
|
|
4
|
+
function l({
|
|
5
|
+
onSelect: o = () => {
|
|
6
|
+
},
|
|
7
|
+
children: i
|
|
8
|
+
}) {
|
|
9
|
+
return /* @__PURE__ */ e(r.Body, { children: /* @__PURE__ */ e(m, { onSelect: o, children: /* @__PURE__ */ e("div", { className: "timelane-body", children: i }) }) });
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
l as TimelaneBody
|
|
13
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsxs as R, jsx as M } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m, useRef as S, useEffect as y } from "react";
|
|
3
|
+
import { doOverlap as a } from "../utils.js";
|
|
4
|
+
import { monitorForElements as b } from "../../node_modules/@atlaskit/pragmatic-drag-and-drop/dist/esm/adapter/element-adapter.js";
|
|
5
|
+
function q({
|
|
6
|
+
children: o,
|
|
7
|
+
onSelect: d
|
|
8
|
+
}) {
|
|
9
|
+
const [f, c] = m([]), r = S(null), [n, h] = m(null), [s, p] = m(null);
|
|
10
|
+
y(() => b({
|
|
11
|
+
onDragStart: (e) => {
|
|
12
|
+
c([e.source.data.id]);
|
|
13
|
+
}
|
|
14
|
+
}), []), y(() => {
|
|
15
|
+
d(f);
|
|
16
|
+
}, [d, f]);
|
|
17
|
+
function x(e) {
|
|
18
|
+
!e.shiftKey && !e.ctrlKey && c([]), h({ x: e.clientX, y: e.clientY });
|
|
19
|
+
}
|
|
20
|
+
function w(e) {
|
|
21
|
+
if (n) {
|
|
22
|
+
const i = {
|
|
23
|
+
x: Math.min(e.clientX, n.x),
|
|
24
|
+
y: Math.min(e.clientY, n.y),
|
|
25
|
+
width: Math.abs(e.clientX - n.x),
|
|
26
|
+
height: Math.abs(e.clientY - n.y)
|
|
27
|
+
}, l = e.currentTarget.getBoundingClientRect();
|
|
28
|
+
p({
|
|
29
|
+
...i,
|
|
30
|
+
x: i.x - l.left,
|
|
31
|
+
y: i.y - l.top
|
|
32
|
+
}), document.querySelectorAll(".timelane-drop-target").forEach((t) => {
|
|
33
|
+
a(t.getBoundingClientRect(), i) && t.querySelectorAll(".timelane-item").forEach((u) => {
|
|
34
|
+
a(u.getBoundingClientRect(), i) ? u.classList.add("timelane-item-marked") : u.classList.remove("timelane-item-marked");
|
|
35
|
+
});
|
|
36
|
+
}), (i.width > 5 || i.height > 5) && !r.current && (r.current = g, window.addEventListener("click", g, !0));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function v(e) {
|
|
40
|
+
if (n && s) {
|
|
41
|
+
e.stopPropagation();
|
|
42
|
+
const i = {
|
|
43
|
+
x: Math.min(e.clientX, n.x),
|
|
44
|
+
y: Math.min(e.clientY, n.y),
|
|
45
|
+
width: Math.abs(e.clientX - n.x),
|
|
46
|
+
height: Math.abs(e.clientY - n.y)
|
|
47
|
+
}, l = Array.from(
|
|
48
|
+
document.querySelectorAll(".timelane-drop-target")
|
|
49
|
+
).filter((t) => a(t.getBoundingClientRect(), i)).map((t) => Array.from(t.querySelectorAll(".timelane-item"))).flatMap((t) => t).filter((t) => a(t.getBoundingClientRect(), i)).map((t) => t instanceof HTMLElement ? Number.parseInt(t.dataset.timelaneItemId || "-1") : -1).filter((t) => t > 0);
|
|
50
|
+
l.length > 0 && (e.shiftKey || e.ctrlKey ? c((t) => Array.from(/* @__PURE__ */ new Set([...t, ...l]))) : c(l)), document.querySelectorAll(".timelane-item-marked").forEach((t) => {
|
|
51
|
+
t.classList.remove("timelane-item-marked");
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
h(null), p(null), requestAnimationFrame(() => {
|
|
55
|
+
r.current && r.current !== null && (window.removeEventListener("click", r.current, !0), r.current = null);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return /* @__PURE__ */ R(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
onMouseDown: x,
|
|
62
|
+
onMouseMove: w,
|
|
63
|
+
onMouseUp: v,
|
|
64
|
+
style: {
|
|
65
|
+
position: "relative"
|
|
66
|
+
},
|
|
67
|
+
children: [
|
|
68
|
+
s && /* @__PURE__ */ M(A, { rect: s }),
|
|
69
|
+
o
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
const g = (o) => {
|
|
75
|
+
o.preventDefault(), o.stopPropagation();
|
|
76
|
+
};
|
|
77
|
+
function A({ rect: o }) {
|
|
78
|
+
return /* @__PURE__ */ M(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
id: "mouse-selection-indicator",
|
|
82
|
+
style: {
|
|
83
|
+
border: "1px dashed blue",
|
|
84
|
+
position: "absolute",
|
|
85
|
+
top: `${o.y}px`,
|
|
86
|
+
left: `${o.x}px`,
|
|
87
|
+
width: `${o.width}px`,
|
|
88
|
+
height: `${o.height}px`,
|
|
89
|
+
zIndex: 1e6
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
export {
|
|
95
|
+
q as TimelaneSelectionLayer
|
|
96
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { renderDayHeader as s } from "./renderingUtils.js";
|
|
3
|
+
import { eachDayOfInterval as p } from "../../node_modules/date-fns/eachDayOfInterval.js";
|
|
4
|
+
import { isSameDay as c } from "../../node_modules/date-fns/isSameDay.js";
|
|
5
|
+
function x({
|
|
6
|
+
range: i,
|
|
7
|
+
pixels: l,
|
|
8
|
+
focusedDay: a,
|
|
9
|
+
setFocusedDay: m = () => {
|
|
10
|
+
},
|
|
11
|
+
render: t = s,
|
|
12
|
+
onDayClick: d = () => {
|
|
13
|
+
}
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ r("div", { className: "timelane-header-days", children: p(i).map((e, o) => /* @__PURE__ */ r(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
className: `timelane-header-day-label ${a && c(a, e) ? "timelane-header-day-label-focused" : ""}`,
|
|
19
|
+
style: { width: `${l.pixelsPerDay}px` },
|
|
20
|
+
onClick: (n) => {
|
|
21
|
+
d({ day: e, e: n }), m(e);
|
|
22
|
+
},
|
|
23
|
+
children: t(e)
|
|
24
|
+
},
|
|
25
|
+
o
|
|
26
|
+
)) });
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
x as DaysHeader
|
|
30
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { renderMonthHeader as s } from "./renderingUtils.js";
|
|
3
|
+
import { eachMonthOfInterval as c } from "../../node_modules/date-fns/eachMonthOfInterval.js";
|
|
4
|
+
import { lastDayOfMonth as p } from "../../node_modules/date-fns/lastDayOfMonth.js";
|
|
5
|
+
import { differenceInCalendarDays as f } from "../../node_modules/date-fns/differenceInCalendarDays.js";
|
|
6
|
+
function b({
|
|
7
|
+
range: t,
|
|
8
|
+
pixels: r,
|
|
9
|
+
setFocusedDay: m = () => {
|
|
10
|
+
},
|
|
11
|
+
render: l = s,
|
|
12
|
+
onMonthClick: a = () => {
|
|
13
|
+
}
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ n("div", { className: "timelane-header-months", children: c(t).map((e, d) => {
|
|
16
|
+
e < t.start && (e = t.start);
|
|
17
|
+
let o = p(e);
|
|
18
|
+
o > t.end && (o = t.end);
|
|
19
|
+
const i = f(o, e) + 1;
|
|
20
|
+
return /* @__PURE__ */ n(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
className: "timelane-header-month-label",
|
|
24
|
+
style: {
|
|
25
|
+
width: `${r.pixelsPerDay * i}px`
|
|
26
|
+
},
|
|
27
|
+
onClick: (h) => {
|
|
28
|
+
a({ firstDay: e, lastDay: o, e: h }), m(e);
|
|
29
|
+
},
|
|
30
|
+
children: l(e, o)
|
|
31
|
+
},
|
|
32
|
+
d
|
|
33
|
+
);
|
|
34
|
+
}) });
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
b as MonthsHeader
|
|
38
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as r, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { MonthsHeader as p } from "./MonthsHeader.js";
|
|
3
|
+
import { WeeksHeader as h } from "./WeeksHeader.js";
|
|
4
|
+
import { DaysHeader as f } from "./DaysHeader.js";
|
|
5
|
+
import { useTimelaneContext as x } from "../../hooks/useTimelaneContext.js";
|
|
6
|
+
import { TimelaneLayout as H } from "../TimelaneLayout/TimelaneLayout.js";
|
|
7
|
+
function u({
|
|
8
|
+
focusedDay: o,
|
|
9
|
+
setFocusedDay: n = () => {
|
|
10
|
+
},
|
|
11
|
+
renderMonthHeader: i,
|
|
12
|
+
renderWeekHeader: m,
|
|
13
|
+
renderDayHeader: s,
|
|
14
|
+
onMonthClick: a,
|
|
15
|
+
onDayClick: t,
|
|
16
|
+
onWeekClick: d
|
|
17
|
+
}) {
|
|
18
|
+
const { settings: e } = x();
|
|
19
|
+
return /* @__PURE__ */ r(H.Header, { children: /* @__PURE__ */ l("div", { className: "timelane-header", children: [
|
|
20
|
+
e.showMonths && /* @__PURE__ */ r(
|
|
21
|
+
p,
|
|
22
|
+
{
|
|
23
|
+
range: e,
|
|
24
|
+
pixels: e,
|
|
25
|
+
setFocusedDay: n,
|
|
26
|
+
render: i,
|
|
27
|
+
onMonthClick: a
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
e.showWeeks && /* @__PURE__ */ r(
|
|
31
|
+
h,
|
|
32
|
+
{
|
|
33
|
+
range: e,
|
|
34
|
+
pixels: e,
|
|
35
|
+
setFocusedDay: n,
|
|
36
|
+
render: m,
|
|
37
|
+
onWeekClick: d
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
e.showDays && /* @__PURE__ */ r(
|
|
41
|
+
f,
|
|
42
|
+
{
|
|
43
|
+
range: e,
|
|
44
|
+
pixels: e,
|
|
45
|
+
focusedDay: o,
|
|
46
|
+
setFocusedDay: n,
|
|
47
|
+
render: s,
|
|
48
|
+
onDayClick: t
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
] }) });
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
u as TimelaneHeader
|
|
55
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { renderWeekHeader as c } from "./renderingUtils.js";
|
|
3
|
+
import { eachWeekOfInterval as s } from "../../node_modules/date-fns/eachWeekOfInterval.js";
|
|
4
|
+
import { isSunday as k } from "../../node_modules/date-fns/isSunday.js";
|
|
5
|
+
import { nextSunday as h } from "../../node_modules/date-fns/nextSunday.js";
|
|
6
|
+
import { differenceInCalendarDays as u } from "../../node_modules/date-fns/differenceInCalendarDays.js";
|
|
7
|
+
function W({
|
|
8
|
+
range: r,
|
|
9
|
+
pixels: d,
|
|
10
|
+
setFocusedDay: o = () => {
|
|
11
|
+
},
|
|
12
|
+
render: t = c,
|
|
13
|
+
onWeekClick: l = () => {
|
|
14
|
+
}
|
|
15
|
+
}) {
|
|
16
|
+
return /* @__PURE__ */ n("div", { className: "timelane-header-weeks", children: s(r, { weekStartsOn: 1 }).map((e, a) => {
|
|
17
|
+
e < r.start && (e = r.start);
|
|
18
|
+
let m = k(e) ? e : h(e);
|
|
19
|
+
m > r.end && (m = r.end);
|
|
20
|
+
const i = u(m, e) + 1;
|
|
21
|
+
return /* @__PURE__ */ n(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
className: "timelane-header-week-label",
|
|
25
|
+
style: {
|
|
26
|
+
width: `${d.pixelsPerDay * i}px`
|
|
27
|
+
},
|
|
28
|
+
onClick: (p) => {
|
|
29
|
+
l({ firstDay: e, lastDay: m, e: p }), o(e);
|
|
30
|
+
},
|
|
31
|
+
children: t(e, m)
|
|
32
|
+
},
|
|
33
|
+
a
|
|
34
|
+
);
|
|
35
|
+
}) });
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
W as WeeksHeader
|
|
39
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as d, Fragment as t, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { formatDate as r } from "../../node_modules/date-fns/format.js";
|
|
3
|
+
import { differenceInCalendarDays as c } from "../../node_modules/date-fns/differenceInCalendarDays.js";
|
|
4
|
+
function M(e, n) {
|
|
5
|
+
const o = c(n, e) + 1;
|
|
6
|
+
return /* @__PURE__ */ d(t, { children: o > 4 ? r(e, "LLLL yyyy") : /* @__PURE__ */ d(t, {}) });
|
|
7
|
+
}
|
|
8
|
+
function l(e, n) {
|
|
9
|
+
const o = c(n, e) + 1, i = `KW ${r(e, "w")} (${r(
|
|
10
|
+
e,
|
|
11
|
+
"MM-dd"
|
|
12
|
+
)} - ${r(n, "MM-dd")}`;
|
|
13
|
+
return /* @__PURE__ */ d("div", { title: i, children: o > 2 ? /* @__PURE__ */ m(t, { children: [
|
|
14
|
+
"KW ",
|
|
15
|
+
r(e, "w")
|
|
16
|
+
] }) : /* @__PURE__ */ d(t, {}) });
|
|
17
|
+
}
|
|
18
|
+
function s(e) {
|
|
19
|
+
const n = `${r(e, "yyyy-MM-dd")}`;
|
|
20
|
+
return /* @__PURE__ */ d("div", { title: n, children: r(e, "d") });
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
s as renderDayHeader,
|
|
24
|
+
M as renderMonthHeader,
|
|
25
|
+
l as renderWeekHeader
|
|
26
|
+
};
|