@activecollab/components 2.0.577 → 2.0.578
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/presentation/myWork/MyWorkTasks.js +83 -30
- package/dist/cjs/presentation/myWork/MyWorkTasks.js.map +1 -1
- package/dist/cjs/presentation/myWork/agendaGrid.js +1095 -0
- package/dist/cjs/presentation/myWork/agendaGrid.js.map +1 -0
- package/dist/cjs/presentation/shared/settings.js +6 -2
- package/dist/cjs/presentation/shared/settings.js.map +1 -1
- package/dist/cjs/presentation/shared/tokens.js +8 -1
- package/dist/cjs/presentation/shared/tokens.js.map +1 -1
- package/dist/cjs/presentation/timeboxes/AdjustmentList.js +31 -0
- package/dist/cjs/presentation/timeboxes/AdjustmentList.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/AgendaDayView.js +1722 -0
- package/dist/cjs/presentation/timeboxes/AgendaDayView.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/CapacityBar.js +54 -0
- package/dist/cjs/presentation/timeboxes/CapacityBar.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/SimulationCard.js +47 -0
- package/dist/cjs/presentation/timeboxes/SimulationCard.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/SimulationPanel.js +319 -0
- package/dist/cjs/presentation/timeboxes/SimulationPanel.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/TimeRecordsSection.js +206 -0
- package/dist/cjs/presentation/timeboxes/TimeRecordsSection.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/WorkloadView.js +887 -0
- package/dist/cjs/presentation/timeboxes/WorkloadView.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/__tests__/timeboxes.test.js +699 -0
- package/dist/cjs/presentation/timeboxes/__tests__/timeboxes.test.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/changes.js +293 -0
- package/dist/cjs/presentation/timeboxes/changes.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/mockData.js +320 -0
- package/dist/cjs/presentation/timeboxes/mockData.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/model.js +186 -0
- package/dist/cjs/presentation/timeboxes/model.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/pillLook.js +72 -0
- package/dist/cjs/presentation/timeboxes/pillLook.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/plan.js +181 -0
- package/dist/cjs/presentation/timeboxes/plan.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/reducer.js +763 -0
- package/dist/cjs/presentation/timeboxes/reducer.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/scheduler.js +147 -0
- package/dist/cjs/presentation/timeboxes/scheduler.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/store.js +65 -0
- package/dist/cjs/presentation/timeboxes/store.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/timeBlocks.js +1931 -0
- package/dist/cjs/presentation/timeboxes/timeBlocks.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/timeboxSettings.js +369 -0
- package/dist/cjs/presentation/timeboxes/timeboxSettings.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/tracked.js +189 -0
- package/dist/cjs/presentation/timeboxes/tracked.js.map +1 -0
- package/dist/esm/presentation/myWork/MyWorkTasks.d.ts +81 -1
- package/dist/esm/presentation/myWork/MyWorkTasks.d.ts.map +1 -1
- package/dist/esm/presentation/myWork/MyWorkTasks.js +76 -23
- package/dist/esm/presentation/myWork/MyWorkTasks.js.map +1 -1
- package/dist/esm/presentation/myWork/agendaGrid.d.ts +341 -0
- package/dist/esm/presentation/myWork/agendaGrid.d.ts.map +1 -0
- package/dist/esm/presentation/myWork/agendaGrid.js +1001 -0
- package/dist/esm/presentation/myWork/agendaGrid.js.map +1 -0
- package/dist/esm/presentation/shared/settings.d.ts +2 -0
- package/dist/esm/presentation/shared/settings.d.ts.map +1 -1
- package/dist/esm/presentation/shared/settings.js +5 -1
- package/dist/esm/presentation/shared/settings.js.map +1 -1
- package/dist/esm/presentation/shared/tokens.d.ts +6 -0
- package/dist/esm/presentation/shared/tokens.d.ts.map +1 -1
- package/dist/esm/presentation/shared/tokens.js +7 -0
- package/dist/esm/presentation/shared/tokens.js.map +1 -1
- package/dist/esm/presentation/timeboxes/AdjustmentList.d.ts +11 -0
- package/dist/esm/presentation/timeboxes/AdjustmentList.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/AdjustmentList.js +22 -0
- package/dist/esm/presentation/timeboxes/AdjustmentList.js.map +1 -0
- package/dist/esm/presentation/timeboxes/AgendaDayView.d.ts +15 -0
- package/dist/esm/presentation/timeboxes/AgendaDayView.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/AgendaDayView.js +1524 -0
- package/dist/esm/presentation/timeboxes/AgendaDayView.js.map +1 -0
- package/dist/esm/presentation/timeboxes/CapacityBar.d.ts +15 -0
- package/dist/esm/presentation/timeboxes/CapacityBar.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/CapacityBar.js +48 -0
- package/dist/esm/presentation/timeboxes/CapacityBar.js.map +1 -0
- package/dist/esm/presentation/timeboxes/SimulationCard.d.ts +13 -0
- package/dist/esm/presentation/timeboxes/SimulationCard.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/SimulationCard.js +41 -0
- package/dist/esm/presentation/timeboxes/SimulationCard.js.map +1 -0
- package/dist/esm/presentation/timeboxes/SimulationPanel.d.ts +18 -0
- package/dist/esm/presentation/timeboxes/SimulationPanel.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/SimulationPanel.js +267 -0
- package/dist/esm/presentation/timeboxes/SimulationPanel.js.map +1 -0
- package/dist/esm/presentation/timeboxes/TimeRecordsSection.d.ts +14 -0
- package/dist/esm/presentation/timeboxes/TimeRecordsSection.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/TimeRecordsSection.js +159 -0
- package/dist/esm/presentation/timeboxes/TimeRecordsSection.js.map +1 -0
- package/dist/esm/presentation/timeboxes/WorkloadView.d.ts +9 -0
- package/dist/esm/presentation/timeboxes/WorkloadView.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/WorkloadView.js +761 -0
- package/dist/esm/presentation/timeboxes/WorkloadView.js.map +1 -0
- package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.d.ts +2 -0
- package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.js +640 -0
- package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.js.map +1 -0
- package/dist/esm/presentation/timeboxes/changes.d.ts +72 -0
- package/dist/esm/presentation/timeboxes/changes.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/changes.js +224 -0
- package/dist/esm/presentation/timeboxes/changes.js.map +1 -0
- package/dist/esm/presentation/timeboxes/mockData.d.ts +16 -0
- package/dist/esm/presentation/timeboxes/mockData.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/mockData.js +297 -0
- package/dist/esm/presentation/timeboxes/mockData.js.map +1 -0
- package/dist/esm/presentation/timeboxes/model.d.ts +136 -0
- package/dist/esm/presentation/timeboxes/model.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/model.js +129 -0
- package/dist/esm/presentation/timeboxes/model.js.map +1 -0
- package/dist/esm/presentation/timeboxes/pillLook.d.ts +40 -0
- package/dist/esm/presentation/timeboxes/pillLook.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/pillLook.js +65 -0
- package/dist/esm/presentation/timeboxes/pillLook.js.map +1 -0
- package/dist/esm/presentation/timeboxes/plan.d.ts +62 -0
- package/dist/esm/presentation/timeboxes/plan.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/plan.js +116 -0
- package/dist/esm/presentation/timeboxes/plan.js.map +1 -0
- package/dist/esm/presentation/timeboxes/reducer.d.ts +203 -0
- package/dist/esm/presentation/timeboxes/reducer.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/reducer.js +616 -0
- package/dist/esm/presentation/timeboxes/reducer.js.map +1 -0
- package/dist/esm/presentation/timeboxes/scheduler.d.ts +63 -0
- package/dist/esm/presentation/timeboxes/scheduler.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/scheduler.js +120 -0
- package/dist/esm/presentation/timeboxes/scheduler.js.map +1 -0
- package/dist/esm/presentation/timeboxes/store.d.ts +23 -0
- package/dist/esm/presentation/timeboxes/store.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/store.js +46 -0
- package/dist/esm/presentation/timeboxes/store.js.map +1 -0
- package/dist/esm/presentation/timeboxes/timeBlocks.d.ts +10 -0
- package/dist/esm/presentation/timeboxes/timeBlocks.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/timeBlocks.js +1767 -0
- package/dist/esm/presentation/timeboxes/timeBlocks.js.map +1 -0
- package/dist/esm/presentation/timeboxes/timeboxSettings.d.ts +71 -0
- package/dist/esm/presentation/timeboxes/timeboxSettings.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/timeboxSettings.js +302 -0
- package/dist/esm/presentation/timeboxes/timeboxSettings.js.map +1 -0
- package/dist/esm/presentation/timeboxes/tracked.d.ts +51 -0
- package/dist/esm/presentation/timeboxes/tracked.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/tracked.js +136 -0
- package/dist/esm/presentation/timeboxes/tracked.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1001 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import React, { useCallback, useLayoutEffect, useMemo, useState } from "react";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import { Checkbox } from "../../components/Checkbox";
|
|
5
|
+
import { Chip } from "../../components/Chip";
|
|
6
|
+
import { DrilldownMenu } from "../../components/DrilldownMenu";
|
|
7
|
+
import { Filter } from "../../components/Filter";
|
|
8
|
+
import { Header } from "../../components/Header";
|
|
9
|
+
import { IconButton } from "../../components/IconButton";
|
|
10
|
+
import { CalendarDateIcon, CalendarIcon, CalendarMonthIcon, CheckboxCircleBlankIcon, ClockIcon, ProjectIcon, SettingsIcon, ViewDayIcon, ViewGridIcon, ViewListIcon } from "../../components/Icons";
|
|
11
|
+
import { Label } from "../../components/Label";
|
|
12
|
+
import { List, ListItem, ListSeparator } from "../../components/List";
|
|
13
|
+
import { Item, Nav } from "../../components/Nav";
|
|
14
|
+
import { Tooltip } from "../../components/Tooltip";
|
|
15
|
+
import { Body2, Caption1 } from "../../components/Typography";
|
|
16
|
+
import { Typography } from "../../components/Typography/Typography";
|
|
17
|
+
import { ViewSwitcher, SubViewSwitcher } from "../../components/ViewSwitcher";
|
|
18
|
+
import { DUE_BAR_TRACK, LG, NON_WORKING_HATCH, StyledPagePaper, TRANSITION } from "../shared";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The My Work Agenda's calendar pieces, shared by the "My work calendar" and
|
|
22
|
+
* the time blocks presentations (timeboxes/timeBlocks): dates, the in-paper
|
|
23
|
+
* toolbar, the week/day header cells, the All Day lane row and its pills, the hour grid,
|
|
24
|
+
* the timed event box, the day split, the options menu and the My Work tab
|
|
25
|
+
* bar with the Agenda view menu.
|
|
26
|
+
*
|
|
27
|
+
* Mirrors src/components/MyWork/Agenda (AgendaToolbar, AgendaDayHeader,
|
|
28
|
+
* AgendaTimeGrid, agendaCalendarProps) and src/styles/calendar.less.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/* ================================================================== */
|
|
32
|
+
/* Dates */
|
|
33
|
+
/* ================================================================== */
|
|
34
|
+
|
|
35
|
+
export const SECONDS_PER_DAY = 86400;
|
|
36
|
+
|
|
37
|
+
/** Unix seconds at UTC midnight — the shape task `start_on` / `due_on` take. */
|
|
38
|
+
export const utcMidnight = (year, month, day) => Date.UTC(year, month - 1, day) / 1000;
|
|
39
|
+
|
|
40
|
+
/** Whole days since the epoch; every grid position is one of these. */
|
|
41
|
+
export const toDayNumber = seconds => Math.floor(seconds / SECONDS_PER_DAY);
|
|
42
|
+
export const toDate = dayNumber => new Date(dayNumber * SECONDS_PER_DAY * 1000);
|
|
43
|
+
|
|
44
|
+
/** An event's "YYYY-MM-DD" (for-screen payload), read for placement only. */
|
|
45
|
+
export const isoToDayNumber = iso => {
|
|
46
|
+
const _iso$split$map = iso.split("-").map(Number),
|
|
47
|
+
year = _iso$split$map[0],
|
|
48
|
+
month = _iso$split$map[1],
|
|
49
|
+
day = _iso$split$map[2];
|
|
50
|
+
return toDayNumber(utcMidnight(year, month, day));
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** An event's "HH:mm:ss", as minutes after midnight, for placement only. */
|
|
54
|
+
export const clockToMinutes = clock => {
|
|
55
|
+
const _clock$split$map = clock.split(":").map(Number),
|
|
56
|
+
hours = _clock$split$map[0],
|
|
57
|
+
minutes = _clock$split$map[1];
|
|
58
|
+
return hours * 60 + minutes;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/** The app's 12-hour clock: "09:00 AM". */
|
|
62
|
+
export const formatTimeOfDay = minutes => {
|
|
63
|
+
const hours = Math.floor(minutes / 60) % 24;
|
|
64
|
+
const suffix = hours < 12 ? "AM" : "PM";
|
|
65
|
+
const twelve = hours % 12 === 0 ? 12 : hours % 12;
|
|
66
|
+
return String(twelve).padStart(2, "0") + ":" + String(minutes % 60).padStart(2, "0") + " " + suffix;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/** Weeks start on Monday, as the user's Calendar page does. */
|
|
70
|
+
export const mondayOf = dayNumber => dayNumber - (toDate(dayNumber).getUTCDay() + 6) % 7;
|
|
71
|
+
export const isoWeekNumber = dayNumber => {
|
|
72
|
+
const thursday = mondayOf(dayNumber) + 3;
|
|
73
|
+
const yearStart = toDayNumber(utcMidnight(toDate(thursday).getUTCFullYear(), 1, 1));
|
|
74
|
+
return Math.floor((thursday - yearStart) / 7) + 1;
|
|
75
|
+
};
|
|
76
|
+
export const SHORT_DAYS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
|
|
77
|
+
export const LONG_DAYS = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
|
|
78
|
+
export const SHORT_MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
79
|
+
export const LONG_MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
80
|
+
export const longDayOf = dayNumber => LONG_DAYS[(toDate(dayNumber).getUTCDay() + 6) % 7];
|
|
81
|
+
export const shortDayOf = dayNumber => SHORT_DAYS[(toDate(dayNumber).getUTCDay() + 6) % 7];
|
|
82
|
+
export const isWeekendDay = dayNumber => {
|
|
83
|
+
const weekday = toDate(dayNumber).getUTCDay();
|
|
84
|
+
return weekday === 0 || weekday === 6;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
/* ================================================================== */
|
|
88
|
+
/* Events */
|
|
89
|
+
/* ================================================================== */
|
|
90
|
+
|
|
91
|
+
/* ================================================================== */
|
|
92
|
+
/* Grid items */
|
|
93
|
+
/* ================================================================== */
|
|
94
|
+
|
|
95
|
+
/** A task, a subtask or an event, placed on the grid's day axis. */
|
|
96
|
+
|
|
97
|
+
export const isTimed = entry => entry.startMinute !== undefined;
|
|
98
|
+
|
|
99
|
+
/** On one day: events, then tasks, then subtasks. */
|
|
100
|
+
export const KIND_RANK = {
|
|
101
|
+
event: 0,
|
|
102
|
+
task: 1,
|
|
103
|
+
subtask: 2
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/** One entry inside one row of days, clamped to it and given a lane. */
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The order rbc's month row packs in, cut to the row: earlier first, then —
|
|
110
|
+
* on the same day — events, tasks, then subtasks, all-day before timed, longer before
|
|
111
|
+
* shorter, earlier time first. Events lead a cell without starving the tasks
|
|
112
|
+
* that began earlier in the week of a lane.
|
|
113
|
+
*/
|
|
114
|
+
export const segmentOrder = (a, b) => {
|
|
115
|
+
var _a$startMinute, _b$startMinute;
|
|
116
|
+
if (a.from !== b.from) return a.from - b.from;
|
|
117
|
+
if (a.kind !== b.kind) return KIND_RANK[a.kind] - KIND_RANK[b.kind];
|
|
118
|
+
if (isTimed(a) !== isTimed(b)) return isTimed(a) ? 1 : -1;
|
|
119
|
+
const lengthDifference = b.to - b.from - (a.to - a.from);
|
|
120
|
+
if (lengthDifference !== 0) return lengthDifference;
|
|
121
|
+
return ((_a$startMinute = a.startMinute) != null ? _a$startMinute : 0) - ((_b$startMinute = b.startMinute) != null ? _b$startMinute : 0);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/** Lanes per row, not per day, so a span keeps its lane across the week. */
|
|
125
|
+
export const assignLanes = (entries, firstDay, dayCount) => {
|
|
126
|
+
const lastDay = firstDay + dayCount - 1;
|
|
127
|
+
const laneEnds = [];
|
|
128
|
+
return entries.filter(entry => entry.endDay >= firstDay && entry.startDay <= lastDay).map(entry => _extends({}, entry, {
|
|
129
|
+
from: Math.max(entry.startDay, firstDay),
|
|
130
|
+
to: Math.min(entry.endDay, lastDay),
|
|
131
|
+
continuesPrior: entry.startDay < firstDay,
|
|
132
|
+
continuesAfter: entry.endDay > lastDay,
|
|
133
|
+
lane: 0
|
|
134
|
+
})).sort(segmentOrder).map(segment => {
|
|
135
|
+
let lane = laneEnds.findIndex(end => end < segment.from);
|
|
136
|
+
if (lane === -1) lane = laneEnds.length;
|
|
137
|
+
laneEnds[lane] = segment.to;
|
|
138
|
+
return _extends({}, segment, {
|
|
139
|
+
lane
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/* ================================================================== */
|
|
145
|
+
/* Geometry */
|
|
146
|
+
/* ================================================================== */
|
|
147
|
+
|
|
148
|
+
/** Month: week-number gutter (.show-week-number in calendar.less). */
|
|
149
|
+
export const WEEK_NUMBER_GUTTER = 50;
|
|
150
|
+
/** Week / day: the hour gutter (.rbc-time-gutter). */
|
|
151
|
+
export const TIME_GUTTER = 96;
|
|
152
|
+
/** A lane, as on the Calendar page: the 22px pill, its 2px margin-bottom
|
|
153
|
+
(.rbc-event) and the segment's 1px bottom padding (.rbc-row-segment).
|
|
154
|
+
Tasks and subtasks take the same lane, so every row lines up. */
|
|
155
|
+
export const LANE_STEP = 25;
|
|
156
|
+
/** Month cells show four lanes, then "+N more" (ProjectCalendar.jsx). */
|
|
157
|
+
export const MONTH_VISIBLE_LANES = 4;
|
|
158
|
+
/** The week / day All Day row shows ten lanes, then "+N more" (rbc's
|
|
159
|
+
allDayMaxRows, which the Calendar page sets to 2 for events alone). */
|
|
160
|
+
export const ALL_DAY_VISIBLE_LANES = 10;
|
|
161
|
+
/** 24px date line + four lanes + the 20px "+N more" line. */
|
|
162
|
+
export const MONTH_ROW_MIN_HEIGHT = 24 + MONTH_VISIBLE_LANES * LANE_STEP + 20;
|
|
163
|
+
/** The Calendar page's hour: 73px per two-hour slot group, rounded down. */
|
|
164
|
+
export const HOUR_HEIGHT = 36;
|
|
165
|
+
/** The hour the week and day grids open on (calendar_starting_hours). */
|
|
166
|
+
export const SCROLL_TO_HOUR = 7;
|
|
167
|
+
export const CALENDAR_TOOLBAR_HEIGHT = 40;
|
|
168
|
+
|
|
169
|
+
/* ================================================================== */
|
|
170
|
+
/* Styles */
|
|
171
|
+
/* ================================================================== */
|
|
172
|
+
|
|
173
|
+
/* The My Work tab bar (MyWorkPageShell.jsx): DS Header, Nav of Body2 items,
|
|
174
|
+
section controls and the add button on the right. */
|
|
175
|
+
export const StyledMyWorkTabs = styled(Header).withConfig({
|
|
176
|
+
displayName: "agendaGrid__StyledMyWorkTabs",
|
|
177
|
+
componentId: "sc-19ticyf-0"
|
|
178
|
+
})(["justify-content:space-between;align-items:center;margin-bottom:16px;min-height:64px;flex-shrink:0;.section-controls{display:flex;align-items:center;flex-shrink:0;gap:4px;}.filter-button{display:flex;align-items:center;gap:6px;}.tab-label{display:flex;align-items:center;gap:6px;}.c-nav__item--active .tab-text{color:var(--color-primary);}.control-divider{width:1px;height:20px;margin:0 12px 0 8px;background-color:var(--color-theme-300);}"]);
|
|
179
|
+
export const StyledMyCalendarPaper = styled(StyledPagePaper).withConfig({
|
|
180
|
+
displayName: "agendaGrid__StyledMyCalendarPaper",
|
|
181
|
+
componentId: "sc-19ticyf-1"
|
|
182
|
+
})(["display:flex;flex-direction:column;padding:0;overflow:hidden;@media (min-width:", "){&.fill-height{flex:none;height:var(--fill-height);}}"], LG);
|
|
183
|
+
|
|
184
|
+
/* ProjectCalendarToolbar.jsx: 40px, border-bottom, 13px left padding. */
|
|
185
|
+
export const StyledMyCalendarToolbar = styled.div.withConfig({
|
|
186
|
+
displayName: "agendaGrid__StyledMyCalendarToolbar",
|
|
187
|
+
componentId: "sc-19ticyf-2"
|
|
188
|
+
})(["box-sizing:border-box;display:flex;flex-shrink:0;align-items:center;gap:4px;height:", "px;padding:0 4px 0 13px;background-color:var(--page-paper-main);border-bottom:1px solid var(--border-primary);.period-label{margin:0 8px 0 4px;white-space:nowrap;}.toolbar-spacer{flex:1 1 auto;}.view-switch{display:flex;gap:2px;}.options-target{display:flex;margin-left:4px;}"], CALENDAR_TOOLBAR_HEIGHT);
|
|
189
|
+
|
|
190
|
+
/* A row of day headers: Month's weekday names, Week/Day's 64px date cells. */
|
|
191
|
+
export const StyledDayHeaders = styled.div.withConfig({
|
|
192
|
+
displayName: "agendaGrid__StyledDayHeaders",
|
|
193
|
+
componentId: "sc-19ticyf-3"
|
|
194
|
+
})(["display:flex;flex-shrink:0;background-color:var(--page-paper-main);border-bottom:1px solid var(--border-primary);.header-gutter{flex-shrink:0;}.header-cell{box-sizing:border-box;flex:1 1 0;min-width:0;height:40px;display:flex;align-items:center;justify-content:center;border-left:1px solid var(--border-primary);}.header-cell.non-working{background-color:var(--color-theme-200);}&.dated .header-cell{height:64px;flex-direction:column;align-items:stretch;justify-content:flex-start;padding:8px 8px 0;}&.dated .header-cell.today{background-color:var(--color-primary-300);}.header-line{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.day-full{display:none;}@media (min-width:", "){.day-full{display:inline;}.day-short{display:none;}}.due-bar{display:block;height:4px;margin-top:6px;border-radius:var(--ac-br-4);overflow:hidden;background-color:", ";}.due-bar.empty{background-color:transparent;}.due-bar-fill{display:block;height:100%;background-color:var(--color-theme-700);}.due-bar-fill.overdue{background-color:var(--red-alert);}"], LG, DUE_BAR_TRACK);
|
|
195
|
+
|
|
196
|
+
/* One row of days with lanes: a month week, or week/day's All Day row. */
|
|
197
|
+
export const StyledLaneRow = styled.div.withConfig({
|
|
198
|
+
displayName: "agendaGrid__StyledLaneRow",
|
|
199
|
+
componentId: "sc-19ticyf-4"
|
|
200
|
+
})(["display:flex;flex-shrink:0;border-bottom:1px solid var(--border-primary);&.month-row{flex:1 0 0;min-height:", "px;}.row-gutter{box-sizing:border-box;flex-shrink:0;display:flex;align-items:flex-start;justify-content:center;padding-top:6px;}.row-body{position:relative;flex:1 1 0;min-width:0;}.day-backgrounds{position:absolute;inset:0;display:flex;}.day-bg{box-sizing:border-box;flex:1 1 0;border-left:1px solid var(--border-primary);}.day-bg.off-range{background-color:var(--color-theme-200);}.day-bg.today{background-color:var(--color-primary-300);}.day-bg.non-working{background-image:", ";}.row-content{position:relative;height:100%;}.date-line{display:flex;}.date-cell{box-sizing:border-box;flex:1 1 0;min-width:0;height:24px;display:flex;align-items:baseline;justify-content:space-between;gap:4px;padding:4px 8px 2px;}.day-off-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.lane-area{position:relative;}&.all-day-row .lane-area{margin:4px 0;}"], MONTH_ROW_MIN_HEIGHT, NON_WORKING_HATCH);
|
|
201
|
+
|
|
202
|
+
/* The pill both screens draw (calendar.less .rbc-event): the item's colour
|
|
203
|
+
mixed into the paper, a transparent border, 4px radius. Every
|
|
204
|
+
pill — event, task, subtask — is the Calendar page's 22px: the 20px
|
|
205
|
+
.month-event content and its 1px borders. (The project calendar's task pill
|
|
206
|
+
is 20px; here it takes the Calendar page's height so the rows line up.) */
|
|
207
|
+
export const StyledPill = styled.div.withConfig({
|
|
208
|
+
displayName: "agendaGrid__StyledPill",
|
|
209
|
+
componentId: "sc-19ticyf-5"
|
|
210
|
+
})(["box-sizing:border-box;position:absolute;height:22px;display:flex;align-items:center;justify-content:space-between;gap:4px;padding:0 4px;border-radius:4px;border-style:solid;border-width:1px 1px 1px 3px;border-color:transparent;background-color:light-dark( color-mix( in srgb,var(--event-color,var(--color-theme-500)) 40%,var(--page-paper-main) ),color-mix( in srgb,var(--event-color,var(--color-theme-500)) 38%,var(--page-paper-main) ) );cursor:pointer;overflow:hidden;transition:padding 0.2s ease;&.completed{opacity:0.4;}&.resizable:hover{padding-left:12px;padding-right:12px;}.resize-handle{box-sizing:border-box;position:absolute;top:50%;display:none;height:10px;border-left:3px double var(--border-primary);transform:translateY(-50%);cursor:ew-resize;}.resize-handle.start{left:4px;}.resize-handle.end{right:4px;}&:hover .resize-handle{display:block;}&.continues-prior{border-top-left-radius:0;border-bottom-left-radius:0;border-left-width:1px;border-left-style:dashed;border-left-color:var(--event-color);}&.continues-after{border-top-right-radius:0;border-bottom-right-radius:0;border-right-style:dashed;border-right-color:var(--event-color);}&.subtask{justify-content:flex-start;padding:0 2px;border:none;background-color:transparent;}.pill-lead{display:flex;align-items:center;gap:4px;min-width:0;}.pill-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.pill-time{flex-shrink:0;}.meeting-icon{display:flex;flex-shrink:0;}"]);
|
|
211
|
+
|
|
212
|
+
/* ds-exception: the app's "+N more" (calendar.less .rbc-show-more) and the
|
|
213
|
+
week number are bare 12px text, not a button shape; DS Button cannot be
|
|
214
|
+
bare text at that size. The text itself is Caption1. */
|
|
215
|
+
export const StyledTextTrigger = styled.div.withConfig({
|
|
216
|
+
displayName: "agendaGrid__StyledTextTrigger",
|
|
217
|
+
componentId: "sc-19ticyf-6"
|
|
218
|
+
})(["display:inline-flex;align-items:center;height:20px;padding:0 6px;border-radius:4px;cursor:pointer;transition:background-color ", ";&:hover{background-color:var(--color-theme-200);}"], TRANSITION);
|
|
219
|
+
|
|
220
|
+
/* The hour grid (week / day): gutter labels, hour lines, timed events. */
|
|
221
|
+
export const StyledHourGrid = styled.div.withConfig({
|
|
222
|
+
displayName: "agendaGrid__StyledHourGrid",
|
|
223
|
+
componentId: "sc-19ticyf-7"
|
|
224
|
+
})(["flex:1 1 auto;min-height:320px;height:calc(100vh - 360px);overflow-y:auto;.time-canvas{position:relative;display:flex;height:", "px;}.time-gutter{flex-shrink:0;position:relative;}.hour-label{position:absolute;right:0;left:0;padding:0 5px;text-align:right;transform:translateY(-50%);}.time-columns{position:relative;flex:1 1 0;display:flex;min-width:0;}.time-column{box-sizing:border-box;position:relative;flex:1 1 0;min-width:0;border-left:1px solid var(--border-primary);background-image:repeating-linear-gradient( to bottom,transparent 0,transparent ", "px,var(--border-primary) ", "px,var(--border-primary) ", "px );}.time-column.today{background-color:var(--color-primary-300);}.time-column.non-working::before{content:\"\";position:absolute;inset:0;background-image:", ";pointer-events:none;}.now-line{position:absolute;left:0;right:0;height:2px;background-color:var(--color-primary);z-index:2;}"], 24 * HOUR_HEIGHT, HOUR_HEIGHT - 1, HOUR_HEIGHT - 1, HOUR_HEIGHT, NON_WORKING_HATCH);
|
|
225
|
+
|
|
226
|
+
/* DayEvent.jsx: the timed event box — name, then "start – end". */
|
|
227
|
+
export const StyledTimedEvent = styled.div.withConfig({
|
|
228
|
+
displayName: "agendaGrid__StyledTimedEvent",
|
|
229
|
+
componentId: "sc-19ticyf-8"
|
|
230
|
+
})(["box-sizing:border-box;position:absolute;display:flex;flex-direction:column;min-height:20px;padding:3px 4px;border-radius:4px;border-style:solid;border-width:1px 1px 1px 3px;border-color:transparent;background-color:light-dark( color-mix( in srgb,var(--event-color,var(--color-theme-500)) 40%,var(--page-paper-main) ),color-mix( in srgb,var(--event-color,var(--color-theme-500)) 38%,var(--page-paper-main) ) );box-shadow:0 0 0 1px var(--page-paper-main);overflow:hidden;cursor:pointer;z-index:1;transition:padding 0.2s ease;&:not(.compact):hover{padding-top:11px;padding-bottom:11px;}.resize-handle{box-sizing:border-box;position:absolute;left:50%;display:none;width:24px;height:2px;border-top:3px double var(--border-primary);transform:translateX(-50%);cursor:ns-resize;}.resize-handle.top{top:6px;}.resize-handle.bottom{bottom:6px;}&:not(.compact):hover .resize-handle{display:block;}&.compact{justify-content:center;padding-top:0;padding-bottom:0;}&.compact .event-time{display:none;}.event-name-line{display:flex;align-items:center;gap:4px;min-width:0;}.event-name-line .meeting-icon{display:flex;flex-shrink:0;}.event-line{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}"]);
|
|
231
|
+
|
|
232
|
+
/* The day view: grid at 40%, the tasks agenda at 60% from lg up. */
|
|
233
|
+
export const StyledDaySplit = styled.div.withConfig({
|
|
234
|
+
displayName: "agendaGrid__StyledDaySplit",
|
|
235
|
+
componentId: "sc-19ticyf-9"
|
|
236
|
+
})(["display:flex;flex-direction:column;flex:1 1 auto;min-height:0;.day-grid{display:flex;flex-direction:column;min-width:0;}.day-agenda{box-sizing:border-box;display:flex;flex-direction:column;gap:20px;min-width:0;padding:20px 24px 32px;border-top:1px solid var(--border-primary);}.agenda-header{display:flex;align-items:center;justify-content:space-between;}.day-resizer{display:none;}@media (min-width:", "){flex-direction:row;.day-grid{position:relative;flex-shrink:0;min-height:0;width:var(--day-grid-width,40%);}.day-grid .hour-grid{flex:1 1 0;min-height:0;height:auto;}.day-agenda{flex:1 1 0;min-height:0;overflow-y:auto;border-top:none;border-left:1px solid var(--border-primary);}.day-resizer{display:block;}}"], LG);
|
|
237
|
+
|
|
238
|
+
/* The day view's grid, resized like the Timeline outline: the same bounds as
|
|
239
|
+
every resizable panel in the product (260–780px). */
|
|
240
|
+
export const DAY_GRID_MIN_WIDTH = 260;
|
|
241
|
+
export const DAY_GRID_MAX_WIDTH = 780;
|
|
242
|
+
export const DAY_GRID_WIDTH_STORAGE_KEY = "presentation.myWorkCalendar.dayGridWidth";
|
|
243
|
+
export const StyledMyOptionsList = styled(List).withConfig({
|
|
244
|
+
displayName: "agendaGrid__StyledMyOptionsList",
|
|
245
|
+
componentId: "sc-19ticyf-10"
|
|
246
|
+
})(["padding:8px 0;"]);
|
|
247
|
+
|
|
248
|
+
/* DS Label paired with the DS Checkbox by `htmlFor` — one change per press. */
|
|
249
|
+
export const StyledMyOptionsItem = styled(ListItem).withConfig({
|
|
250
|
+
displayName: "agendaGrid__StyledMyOptionsItem",
|
|
251
|
+
componentId: "sc-19ticyf-11"
|
|
252
|
+
})(["&&{justify-content:space-between;align-items:center;gap:12px;min-height:28px;cursor:pointer;}.option-label{flex:1;min-width:0;cursor:pointer;}"]);
|
|
253
|
+
|
|
254
|
+
/* ================================================================== */
|
|
255
|
+
/* Pieces */
|
|
256
|
+
/* ================================================================== */
|
|
257
|
+
|
|
258
|
+
export const percentOf = (part, whole) => part / whole * 100 + "%";
|
|
259
|
+
/**
|
|
260
|
+
* Marks an event apart from a task at a glance: the DS calendar icon at 12px,
|
|
261
|
+
* in the event's calendar colour (a data colour, through style, as the
|
|
262
|
+
* project calendar tints its subtask glyph).
|
|
263
|
+
*/
|
|
264
|
+
export const EventGlyph = _ref => {
|
|
265
|
+
let color = _ref.color;
|
|
266
|
+
return /*#__PURE__*/React.createElement(CalendarIcon, {
|
|
267
|
+
width: 12,
|
|
268
|
+
height: 12,
|
|
269
|
+
style: {
|
|
270
|
+
fill: color,
|
|
271
|
+
flexShrink: 0
|
|
272
|
+
},
|
|
273
|
+
"aria-hidden": true
|
|
274
|
+
});
|
|
275
|
+
};
|
|
276
|
+
EventGlyph.displayName = "EventGlyph";
|
|
277
|
+
export const MEETING_SERVICE_NAMES = {
|
|
278
|
+
zoom: "Zoom",
|
|
279
|
+
meet: "Google Meet",
|
|
280
|
+
teams: "Microsoft Teams",
|
|
281
|
+
webex: "Webex"
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
/** Which service a Meeting Link points at, read off its host at render time;
|
|
285
|
+
null for a link to anything else. */
|
|
286
|
+
export const meetingServiceOf = url => {
|
|
287
|
+
let host;
|
|
288
|
+
try {
|
|
289
|
+
host = new URL(url).hostname.toLowerCase();
|
|
290
|
+
} catch (_unused) {
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
const on = domain => host === domain || host.endsWith("." + domain);
|
|
294
|
+
if (on("zoom.us")) return "zoom";
|
|
295
|
+
if (on("meet.google.com")) return "meet";
|
|
296
|
+
if (on("teams.microsoft.com") || on("teams.live.com")) return "teams";
|
|
297
|
+
if (on("webex.com")) return "webex";
|
|
298
|
+
return null;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
/* ds-exception: the DS has no meeting-service logos; these simplified 12px
|
|
302
|
+
marks live in this story only. Brand colours are data, hardcoded. */
|
|
303
|
+
export const MEETING_LOGOS = {
|
|
304
|
+
zoom: /*#__PURE__*/React.createElement("svg", {
|
|
305
|
+
width: 12,
|
|
306
|
+
height: 12,
|
|
307
|
+
viewBox: "0 0 12 12",
|
|
308
|
+
"aria-hidden": true
|
|
309
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
310
|
+
width: 12,
|
|
311
|
+
height: 12,
|
|
312
|
+
rx: 3,
|
|
313
|
+
fill: "#2D8CFF"
|
|
314
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
315
|
+
x: 2.25,
|
|
316
|
+
y: 4,
|
|
317
|
+
width: 5,
|
|
318
|
+
height: 4,
|
|
319
|
+
rx: 1,
|
|
320
|
+
fill: "#FFFFFF"
|
|
321
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
322
|
+
d: "M7.75 5.4 9.75 4.1v3.8L7.75 6.6Z",
|
|
323
|
+
fill: "#FFFFFF"
|
|
324
|
+
})),
|
|
325
|
+
meet: /*#__PURE__*/React.createElement("svg", {
|
|
326
|
+
width: 12,
|
|
327
|
+
height: 12,
|
|
328
|
+
viewBox: "0 0 12 12",
|
|
329
|
+
"aria-hidden": true
|
|
330
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
331
|
+
d: "M1 4.5 3.5 2H8v3.5H1Z",
|
|
332
|
+
fill: "#00AC47"
|
|
333
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
334
|
+
d: "M1 4.5h3V10H2a1 1 0 0 1-1-1Z",
|
|
335
|
+
fill: "#2684FC"
|
|
336
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
337
|
+
d: "M4 5.5h4V9a1 1 0 0 1-1 1H4Z",
|
|
338
|
+
fill: "#00832D"
|
|
339
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
340
|
+
d: "M8 5 11 2.75v6.5L8 7Z",
|
|
341
|
+
fill: "#00AC47"
|
|
342
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
343
|
+
d: "M1 4.5 3.5 2v2.5Z",
|
|
344
|
+
fill: "#EA4335"
|
|
345
|
+
})),
|
|
346
|
+
teams: /*#__PURE__*/React.createElement("svg", {
|
|
347
|
+
width: 12,
|
|
348
|
+
height: 12,
|
|
349
|
+
viewBox: "0 0 12 12",
|
|
350
|
+
"aria-hidden": true
|
|
351
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
|
352
|
+
cx: 9.25,
|
|
353
|
+
cy: 3.25,
|
|
354
|
+
r: 1.75,
|
|
355
|
+
fill: "#7B83EB"
|
|
356
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
357
|
+
x: 6.5,
|
|
358
|
+
y: 5.5,
|
|
359
|
+
width: 5,
|
|
360
|
+
height: 4.5,
|
|
361
|
+
rx: 1.25,
|
|
362
|
+
fill: "#7B83EB"
|
|
363
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
364
|
+
x: 0.5,
|
|
365
|
+
y: 2.5,
|
|
366
|
+
width: 7.5,
|
|
367
|
+
height: 7.5,
|
|
368
|
+
rx: 1.25,
|
|
369
|
+
fill: "#5059C9"
|
|
370
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
371
|
+
d: "M2.4 4.6h3.7v1H4.75v3.1h-1.1V5.6H2.4Z",
|
|
372
|
+
fill: "#FFFFFF"
|
|
373
|
+
})),
|
|
374
|
+
webex: /*#__PURE__*/React.createElement("svg", {
|
|
375
|
+
width: 12,
|
|
376
|
+
height: 12,
|
|
377
|
+
viewBox: "0 0 12 12",
|
|
378
|
+
"aria-hidden": true
|
|
379
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
|
380
|
+
cx: 6,
|
|
381
|
+
cy: 6,
|
|
382
|
+
r: 5.5,
|
|
383
|
+
fill: "#07C160"
|
|
384
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
385
|
+
cx: 6,
|
|
386
|
+
cy: 6,
|
|
387
|
+
r: 5.5,
|
|
388
|
+
fill: "#00BCEB",
|
|
389
|
+
fillOpacity: 0.65
|
|
390
|
+
}), /*#__PURE__*/React.createElement("circle", {
|
|
391
|
+
cx: 6,
|
|
392
|
+
cy: 6,
|
|
393
|
+
r: 2.25,
|
|
394
|
+
fill: "none",
|
|
395
|
+
stroke: "#FFFFFF",
|
|
396
|
+
strokeWidth: 1.5
|
|
397
|
+
}))
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
/** The meeting service's logo, with its name on hover; nothing when the link
|
|
401
|
+
is not a known service. */
|
|
402
|
+
export const MeetingServiceIcon = _ref2 => {
|
|
403
|
+
let url = _ref2.url;
|
|
404
|
+
const service = meetingServiceOf(url);
|
|
405
|
+
if (service === null) return null;
|
|
406
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
407
|
+
title: MEETING_SERVICE_NAMES[service] + " meeting"
|
|
408
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
409
|
+
className: "meeting-icon"
|
|
410
|
+
}, MEETING_LOGOS[service]));
|
|
411
|
+
};
|
|
412
|
+
MeetingServiceIcon.displayName = "MeetingServiceIcon";
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* A task is MonthPill.jsx: the name in Caption 1, red when important, struck
|
|
416
|
+
* through and faded when completed. An event is MonthEvent.jsx: the name in
|
|
417
|
+
* Caption 1 medium (tertiary when the user is not a participant) and the
|
|
418
|
+
* start time on the right when it is timed.
|
|
419
|
+
*/
|
|
420
|
+
export const CalendarPill = _ref3 => {
|
|
421
|
+
let segment = _ref3.segment,
|
|
422
|
+
style = _ref3.style,
|
|
423
|
+
_ref3$showTaskId = _ref3.showTaskId,
|
|
424
|
+
showTaskId = _ref3$showTaskId === void 0 ? false : _ref3$showTaskId;
|
|
425
|
+
/* Tasks and events resize; a subtask carries one date and does not. */
|
|
426
|
+
const resizable = segment.kind !== "subtask";
|
|
427
|
+
const className = [segment.kind === "subtask" ? "subtask" : "", resizable ? "resizable" : "", segment.completed ? "completed" : "", segment.continuesPrior ? "continues-prior" : "", segment.continuesAfter ? "continues-after" : ""].filter(Boolean).join(" ");
|
|
428
|
+
|
|
429
|
+
/* No tooltip with the name: the pill already shows it. */
|
|
430
|
+
return /*#__PURE__*/React.createElement(StyledPill, {
|
|
431
|
+
className: className || undefined,
|
|
432
|
+
style: _extends({}, style, {
|
|
433
|
+
"--event-color": segment.color
|
|
434
|
+
})
|
|
435
|
+
}, segment.kind === "subtask" ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CheckboxCircleBlankIcon, {
|
|
436
|
+
width: 14,
|
|
437
|
+
height: 14,
|
|
438
|
+
style: {
|
|
439
|
+
fill: segment.color,
|
|
440
|
+
flexShrink: 0
|
|
441
|
+
},
|
|
442
|
+
"aria-hidden": true
|
|
443
|
+
}), /*#__PURE__*/React.createElement(Caption1, {
|
|
444
|
+
className: "pill-name",
|
|
445
|
+
decoration: segment.completed ? "line-through" : undefined
|
|
446
|
+
}, segment.name)) : segment.kind === "task" ? /*#__PURE__*/React.createElement("span", {
|
|
447
|
+
className: "pill-lead"
|
|
448
|
+
}, showTaskId && segment.taskNumber !== undefined ? /*#__PURE__*/React.createElement(Caption1, {
|
|
449
|
+
color: "tertiary",
|
|
450
|
+
className: "pill-time"
|
|
451
|
+
}, "#" + segment.taskNumber) : null, /*#__PURE__*/React.createElement(Caption1, {
|
|
452
|
+
className: "pill-name",
|
|
453
|
+
color: segment.important ? "alert" : "primary",
|
|
454
|
+
decoration: segment.completed ? "line-through" : undefined
|
|
455
|
+
}, segment.name)) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
456
|
+
className: "pill-lead"
|
|
457
|
+
}, /*#__PURE__*/React.createElement(EventGlyph, {
|
|
458
|
+
color: segment.color
|
|
459
|
+
}), segment.meetingUrl ? /*#__PURE__*/React.createElement(MeetingServiceIcon, {
|
|
460
|
+
url: segment.meetingUrl
|
|
461
|
+
}) : null, /*#__PURE__*/React.createElement(Typography, {
|
|
462
|
+
variant: "Caption 1",
|
|
463
|
+
weight: "medium",
|
|
464
|
+
color: segment.participant ? "primary" : "tertiary",
|
|
465
|
+
className: "pill-name"
|
|
466
|
+
}, segment.name)), segment.startMinute !== undefined ? /*#__PURE__*/React.createElement(Caption1, {
|
|
467
|
+
color: "secondary",
|
|
468
|
+
className: "pill-time"
|
|
469
|
+
}, formatTimeOfDay(segment.startMinute)) : null), resizable && !segment.continuesPrior ? /*#__PURE__*/React.createElement("span", {
|
|
470
|
+
className: "resize-handle start"
|
|
471
|
+
}) : null, resizable && !segment.continuesAfter ? /*#__PURE__*/React.createElement("span", {
|
|
472
|
+
className: "resize-handle end"
|
|
473
|
+
}) : null);
|
|
474
|
+
};
|
|
475
|
+
CalendarPill.displayName = "CalendarPill";
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* A timed event in the hour grid (DayEvent.jsx with the agenda's leading
|
|
479
|
+
* glyph): the name, then "start – end". The caller places it; under 36px
|
|
480
|
+
* there is room for the name only.
|
|
481
|
+
*/
|
|
482
|
+
export const TimedEventBox = _ref4 => {
|
|
483
|
+
var _entry$startMinute, _entry$endMinute;
|
|
484
|
+
let entry = _ref4.entry,
|
|
485
|
+
style = _ref4.style,
|
|
486
|
+
compact = _ref4.compact,
|
|
487
|
+
className = _ref4.className;
|
|
488
|
+
const start = (_entry$startMinute = entry.startMinute) != null ? _entry$startMinute : 0;
|
|
489
|
+
const end = (_entry$endMinute = entry.endMinute) != null ? _entry$endMinute : start;
|
|
490
|
+
return /*#__PURE__*/React.createElement(StyledTimedEvent, {
|
|
491
|
+
className: [compact ? "compact" : "", className != null ? className : ""].filter(Boolean).join(" "),
|
|
492
|
+
style: _extends({}, style, {
|
|
493
|
+
["--event-color"]: entry.color
|
|
494
|
+
})
|
|
495
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
496
|
+
className: "event-name-line"
|
|
497
|
+
}, /*#__PURE__*/React.createElement(EventGlyph, {
|
|
498
|
+
color: entry.color
|
|
499
|
+
}), entry.meetingUrl ? /*#__PURE__*/React.createElement(MeetingServiceIcon, {
|
|
500
|
+
url: entry.meetingUrl
|
|
501
|
+
}) : null, /*#__PURE__*/React.createElement(Typography, {
|
|
502
|
+
variant: "Caption 1",
|
|
503
|
+
weight: "medium",
|
|
504
|
+
color: entry.participant ? "primary" : "tertiary",
|
|
505
|
+
className: "event-line"
|
|
506
|
+
}, entry.name)), /*#__PURE__*/React.createElement(Caption1, {
|
|
507
|
+
color: "secondary",
|
|
508
|
+
className: "event-line event-time"
|
|
509
|
+
}, formatTimeOfDay(start) + " \u2013 " + formatTimeOfDay(end)), /*#__PURE__*/React.createElement("span", {
|
|
510
|
+
className: "resize-handle top"
|
|
511
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
512
|
+
className: "resize-handle bottom"
|
|
513
|
+
}));
|
|
514
|
+
};
|
|
515
|
+
TimedEventBox.displayName = "TimedEventBox";
|
|
516
|
+
export const LaneRow = _ref5 => {
|
|
517
|
+
let days = _ref5.days,
|
|
518
|
+
entries = _ref5.entries,
|
|
519
|
+
today = _ref5.today,
|
|
520
|
+
isNonWorking = _ref5.isNonWorking,
|
|
521
|
+
dayOffNameOf = _ref5.dayOffNameOf,
|
|
522
|
+
gutterWidth = _ref5.gutterWidth,
|
|
523
|
+
gutter = _ref5.gutter,
|
|
524
|
+
renderSegment = _ref5.renderSegment,
|
|
525
|
+
month = _ref5.month,
|
|
526
|
+
maxLanes = _ref5.maxLanes,
|
|
527
|
+
onShowMore = _ref5.onShowMore,
|
|
528
|
+
_ref5$showTaskIds = _ref5.showTaskIds,
|
|
529
|
+
showTaskIds = _ref5$showTaskIds === void 0 ? false : _ref5$showTaskIds,
|
|
530
|
+
className = _ref5.className;
|
|
531
|
+
const firstDay = days[0];
|
|
532
|
+
const segments = useMemo(() => assignLanes(entries, firstDay, days.length), [entries, firstDay, days.length]);
|
|
533
|
+
const visible = maxLanes === undefined ? segments : segments.filter(segment => segment.lane < maxLanes);
|
|
534
|
+
const hidden = maxLanes === undefined ? [] : segments.filter(segment => segment.lane >= maxLanes);
|
|
535
|
+
const laneCount = segments.reduce((count, segment) => Math.max(count, segment.lane + 1), 0);
|
|
536
|
+
const shownLanes = maxLanes === undefined ? laneCount : Math.min(laneCount, maxLanes);
|
|
537
|
+
const laneAreaHeight = Math.max(shownLanes, 1) * LANE_STEP + (hidden.length > 0 ? 20 : 0);
|
|
538
|
+
return /*#__PURE__*/React.createElement(StyledLaneRow, {
|
|
539
|
+
className: className
|
|
540
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
541
|
+
className: "row-gutter",
|
|
542
|
+
style: {
|
|
543
|
+
width: gutterWidth
|
|
544
|
+
}
|
|
545
|
+
}, gutter), /*#__PURE__*/React.createElement("div", {
|
|
546
|
+
className: "row-body"
|
|
547
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
548
|
+
className: "day-backgrounds"
|
|
549
|
+
}, days.map(day => {
|
|
550
|
+
const classes = ["day-bg", month !== undefined && toDate(day).getUTCMonth() + 1 !== month ? "off-range" : "", day === today ? "today" : "", isNonWorking(day) ? "non-working" : ""].filter(Boolean).join(" ");
|
|
551
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
552
|
+
className: classes,
|
|
553
|
+
key: day
|
|
554
|
+
});
|
|
555
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
556
|
+
className: "row-content"
|
|
557
|
+
}, month !== undefined ? /*#__PURE__*/React.createElement("div", {
|
|
558
|
+
className: "date-line"
|
|
559
|
+
}, days.map(day => {
|
|
560
|
+
var _dayOffNameOf;
|
|
561
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
562
|
+
className: "date-cell",
|
|
563
|
+
key: day
|
|
564
|
+
}, /*#__PURE__*/React.createElement(Caption1, {
|
|
565
|
+
color: "secondary",
|
|
566
|
+
className: "day-off-name"
|
|
567
|
+
}, (_dayOffNameOf = dayOffNameOf == null ? void 0 : dayOffNameOf(day)) != null ? _dayOffNameOf : ""), /*#__PURE__*/React.createElement(Caption1, {
|
|
568
|
+
color: "secondary"
|
|
569
|
+
}, String(toDate(day).getUTCDate()).padStart(2, "0")));
|
|
570
|
+
})) : null, /*#__PURE__*/React.createElement("div", {
|
|
571
|
+
className: "lane-area",
|
|
572
|
+
style: {
|
|
573
|
+
height: laneAreaHeight
|
|
574
|
+
}
|
|
575
|
+
}, visible.map(segment => {
|
|
576
|
+
const style = {
|
|
577
|
+
/* 2px of air either side (.rbc-row-segment px-[2px]). */
|
|
578
|
+
left: "calc(" + percentOf(segment.from - firstDay, days.length) + " + 2px)",
|
|
579
|
+
width: "calc(" + percentOf(segment.to - segment.from + 1, days.length) + " - 4px)",
|
|
580
|
+
top: segment.lane * LANE_STEP
|
|
581
|
+
};
|
|
582
|
+
const custom = renderSegment == null ? void 0 : renderSegment(segment, style);
|
|
583
|
+
return custom ? /*#__PURE__*/React.createElement(React.Fragment, {
|
|
584
|
+
key: segment.key
|
|
585
|
+
}, custom) : /*#__PURE__*/React.createElement(CalendarPill, {
|
|
586
|
+
key: segment.key,
|
|
587
|
+
segment: segment,
|
|
588
|
+
showTaskId: showTaskIds,
|
|
589
|
+
style: style
|
|
590
|
+
});
|
|
591
|
+
}), days.map(day => {
|
|
592
|
+
const count = hidden.filter(segment => segment.from <= day && segment.to >= day).length;
|
|
593
|
+
if (count === 0) return null;
|
|
594
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
595
|
+
title: "Show this day",
|
|
596
|
+
key: day
|
|
597
|
+
}, /*#__PURE__*/React.createElement(StyledTextTrigger, {
|
|
598
|
+
style: {
|
|
599
|
+
position: "absolute",
|
|
600
|
+
left: percentOf(day - firstDay, days.length),
|
|
601
|
+
top: shownLanes * LANE_STEP
|
|
602
|
+
},
|
|
603
|
+
onClick: () => onShowMore == null ? void 0 : onShowMore(day)
|
|
604
|
+
}, /*#__PURE__*/React.createElement(Caption1, {
|
|
605
|
+
color: "secondary"
|
|
606
|
+
}, "+" + count + " more")));
|
|
607
|
+
})))));
|
|
608
|
+
};
|
|
609
|
+
LaneRow.displayName = "LaneRow";
|
|
610
|
+
|
|
611
|
+
/** Week / day header cells, as the project calendar's WeekDayHeader; the
|
|
612
|
+
bar under the date is the caller's (WeekDueBar on the Agenda). */
|
|
613
|
+
export const DatedHeaders = _ref6 => {
|
|
614
|
+
let days = _ref6.days,
|
|
615
|
+
todayDay = _ref6.today,
|
|
616
|
+
isNonWorking = _ref6.isNonWorking,
|
|
617
|
+
renderBar = _ref6.renderBar;
|
|
618
|
+
return /*#__PURE__*/React.createElement(StyledDayHeaders, {
|
|
619
|
+
className: "dated"
|
|
620
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
621
|
+
className: "header-gutter",
|
|
622
|
+
style: {
|
|
623
|
+
width: TIME_GUTTER
|
|
624
|
+
}
|
|
625
|
+
}), days.map(day => {
|
|
626
|
+
const today = day === todayDay;
|
|
627
|
+
const nonWorking = !today && isNonWorking(day);
|
|
628
|
+
const date = toDate(day);
|
|
629
|
+
const classes = ["header-cell", today ? "today" : "", nonWorking ? "non-working" : ""].filter(Boolean).join(" ");
|
|
630
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
631
|
+
className: classes,
|
|
632
|
+
key: day,
|
|
633
|
+
"aria-current": today ? "date" : undefined
|
|
634
|
+
}, /*#__PURE__*/React.createElement(Body2, {
|
|
635
|
+
weight: "bold",
|
|
636
|
+
color: today ? "theme-primary" : "primary",
|
|
637
|
+
className: "header-line"
|
|
638
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
639
|
+
className: "day-full"
|
|
640
|
+
}, longDayOf(day)), /*#__PURE__*/React.createElement("span", {
|
|
641
|
+
className: "day-short"
|
|
642
|
+
}, shortDayOf(day))), /*#__PURE__*/React.createElement(Typography, {
|
|
643
|
+
variant: "Caption 1",
|
|
644
|
+
weight: "medium",
|
|
645
|
+
color: today ? "theme-primary" : "secondary",
|
|
646
|
+
className: "header-line"
|
|
647
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
648
|
+
className: "day-full"
|
|
649
|
+
}, SHORT_MONTHS[date.getUTCMonth()] + " " + date.getUTCDate()), /*#__PURE__*/React.createElement("span", {
|
|
650
|
+
className: "day-short"
|
|
651
|
+
}, date.getUTCDate())), renderBar(day));
|
|
652
|
+
}));
|
|
653
|
+
};
|
|
654
|
+
DatedHeaders.displayName = "DatedHeaders";
|
|
655
|
+
/** Side-by-side columns for overlapping timed items in one day
|
|
656
|
+
(react-big-calendar's overlap layout). */
|
|
657
|
+
export const placeSideBySide = (items, startOf, endOf) => {
|
|
658
|
+
const sorted = [...items].sort((a, b) => startOf(a) - startOf(b));
|
|
659
|
+
const columnEnds = [];
|
|
660
|
+
const placed = sorted.map(item => {
|
|
661
|
+
let column = columnEnds.findIndex(end => end <= startOf(item));
|
|
662
|
+
if (column === -1) column = columnEnds.length;
|
|
663
|
+
columnEnds[column] = endOf(item);
|
|
664
|
+
return {
|
|
665
|
+
item,
|
|
666
|
+
column,
|
|
667
|
+
columns: 1
|
|
668
|
+
};
|
|
669
|
+
});
|
|
670
|
+
return placed.map(entry => _extends({}, entry, {
|
|
671
|
+
columns: Math.max(1, ...placed.filter(other => startOf(other.item) < endOf(entry.item) && endOf(other.item) > startOf(entry.item)).map(other => other.column + 1))
|
|
672
|
+
}));
|
|
673
|
+
};
|
|
674
|
+
|
|
675
|
+
/* ================================================================== */
|
|
676
|
+
/* Toolbar pieces */
|
|
677
|
+
/* ================================================================== */
|
|
678
|
+
|
|
679
|
+
export const MY_CALENDAR_OPTION_ROWS = [{
|
|
680
|
+
key: "showTasks",
|
|
681
|
+
label: "Show Tasks"
|
|
682
|
+
}, {
|
|
683
|
+
key: "showEvents",
|
|
684
|
+
label: "Show Events"
|
|
685
|
+
}, {
|
|
686
|
+
key: "showCompleted",
|
|
687
|
+
label: "Show Completed"
|
|
688
|
+
}, {
|
|
689
|
+
key: "showSubtasks",
|
|
690
|
+
label: "Show Subtasks"
|
|
691
|
+
}, {
|
|
692
|
+
key: "showNonWorking",
|
|
693
|
+
label: "Show Non-Working Days"
|
|
694
|
+
}, {
|
|
695
|
+
key: "showWeekNumbers",
|
|
696
|
+
label: "Show Week Numbers"
|
|
697
|
+
}];
|
|
698
|
+
|
|
699
|
+
/* Below their own separator, as the Calendar view story fences off its story
|
|
700
|
+
switches: dev rows, not part of the app's menu. */
|
|
701
|
+
export const MY_CALENDAR_DEV_ROWS = [{
|
|
702
|
+
key: "showTaskIds",
|
|
703
|
+
label: "Dev: Show Task IDs"
|
|
704
|
+
}];
|
|
705
|
+
|
|
706
|
+
/** ProjectCalendarOptionsMenu: the gear, 260px, Label + Checkbox rows. */
|
|
707
|
+
|
|
708
|
+
export const MyCalendarOptionsMenu = _ref7 => {
|
|
709
|
+
let options = _ref7.options,
|
|
710
|
+
onToggle = _ref7.onToggle,
|
|
711
|
+
onOpenListSettings = _ref7.onOpenListSettings,
|
|
712
|
+
_ref7$actions = _ref7.actions,
|
|
713
|
+
actions = _ref7$actions === void 0 ? [] : _ref7$actions;
|
|
714
|
+
const _useState = useState(false),
|
|
715
|
+
open = _useState[0],
|
|
716
|
+
setOpen = _useState[1];
|
|
717
|
+
const close = useCallback(() => setOpen(false), []);
|
|
718
|
+
const settingsActions = [...(onOpenListSettings ? [{
|
|
719
|
+
key: "list-settings",
|
|
720
|
+
label: "List Settings",
|
|
721
|
+
icon: /*#__PURE__*/React.createElement(SettingsIcon, null),
|
|
722
|
+
onSelect: onOpenListSettings
|
|
723
|
+
}] : []), ...actions];
|
|
724
|
+
return /*#__PURE__*/React.createElement(DrilldownMenu, {
|
|
725
|
+
open: open,
|
|
726
|
+
onOpen: () => setOpen(true),
|
|
727
|
+
onClose: close,
|
|
728
|
+
position: "bottom-end",
|
|
729
|
+
width: 260,
|
|
730
|
+
target: /*#__PURE__*/React.createElement("div", {
|
|
731
|
+
className: "options-target"
|
|
732
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
733
|
+
title: "Calendar Options"
|
|
734
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
735
|
+
type: "button",
|
|
736
|
+
size: "small",
|
|
737
|
+
variant: "text gray",
|
|
738
|
+
"aria-label": "Calendar Options",
|
|
739
|
+
active: open
|
|
740
|
+
}, /*#__PURE__*/React.createElement(SettingsIcon, null))))
|
|
741
|
+
}, () => /*#__PURE__*/React.createElement(StyledMyOptionsList, {
|
|
742
|
+
tabIndex: 0
|
|
743
|
+
}, [...MY_CALENDAR_OPTION_ROWS, ...MY_CALENDAR_DEV_ROWS].map((row, index) => /*#__PURE__*/React.createElement(React.Fragment, {
|
|
744
|
+
key: row.key
|
|
745
|
+
}, row === MY_CALENDAR_DEV_ROWS[0] && settingsActions.length > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ListSeparator, null), settingsActions.map(action => /*#__PURE__*/React.createElement(ListItem, {
|
|
746
|
+
key: action.key,
|
|
747
|
+
onClick: () => {
|
|
748
|
+
close();
|
|
749
|
+
action.onSelect();
|
|
750
|
+
}
|
|
751
|
+
}, action.icon, action.label))) : null, index === 2 || row === MY_CALENDAR_DEV_ROWS[0] ? /*#__PURE__*/React.createElement(ListSeparator, null) : null, /*#__PURE__*/React.createElement(StyledMyOptionsItem, null, /*#__PURE__*/React.createElement(Label, {
|
|
752
|
+
htmlFor: "my-calendar-option-" + row.key,
|
|
753
|
+
weight: "regular",
|
|
754
|
+
className: "option-label"
|
|
755
|
+
}, row.label), /*#__PURE__*/React.createElement(Checkbox, {
|
|
756
|
+
id: "my-calendar-option-" + row.key,
|
|
757
|
+
checked: options[row.key],
|
|
758
|
+
onChange: () => onToggle(row.key)
|
|
759
|
+
}))))));
|
|
760
|
+
};
|
|
761
|
+
MyCalendarOptionsMenu.displayName = "MyCalendarOptionsMenu";
|
|
762
|
+
export const MODE_SWITCH = [{
|
|
763
|
+
mode: "day",
|
|
764
|
+
label: "Day",
|
|
765
|
+
icon: /*#__PURE__*/React.createElement(ViewDayIcon, null)
|
|
766
|
+
}, {
|
|
767
|
+
mode: "week",
|
|
768
|
+
label: "Week",
|
|
769
|
+
icon: /*#__PURE__*/React.createElement(ViewListIcon, {
|
|
770
|
+
style: {
|
|
771
|
+
transform: "rotate(90deg)"
|
|
772
|
+
}
|
|
773
|
+
})
|
|
774
|
+
}, {
|
|
775
|
+
mode: "month",
|
|
776
|
+
label: "Month",
|
|
777
|
+
icon: /*#__PURE__*/React.createElement(ViewGridIcon, null)
|
|
778
|
+
}];
|
|
779
|
+
export const MY_WORK_TABS = [{
|
|
780
|
+
key: "tasks",
|
|
781
|
+
label: "Tasks"
|
|
782
|
+
}, {
|
|
783
|
+
key: "agenda",
|
|
784
|
+
label: "Agenda"
|
|
785
|
+
}, {
|
|
786
|
+
key: "timesheet",
|
|
787
|
+
label: "Timesheet"
|
|
788
|
+
}, {
|
|
789
|
+
key: "teams",
|
|
790
|
+
label: "Teams"
|
|
791
|
+
}, {
|
|
792
|
+
key: "activity",
|
|
793
|
+
label: "Activity"
|
|
794
|
+
}, {
|
|
795
|
+
key: "availability",
|
|
796
|
+
label: "Availability"
|
|
797
|
+
}];
|
|
798
|
+
|
|
799
|
+
/* The open-tasks count as a Chip instead of "Tasks (61)"; primary-tinted on
|
|
800
|
+
the active tab. */
|
|
801
|
+
export const TabCountChip = _ref8 => {
|
|
802
|
+
let count = _ref8.count,
|
|
803
|
+
active = _ref8.active;
|
|
804
|
+
return /*#__PURE__*/React.createElement(Chip, {
|
|
805
|
+
label: "" + count,
|
|
806
|
+
size: "small",
|
|
807
|
+
backgroundColor: active ? "color-mix(in srgb, var(--color-primary) 12%, transparent)" : "color-mix(in srgb, var(--color-theme-300) 60%, transparent)",
|
|
808
|
+
color: active ? "var(--color-primary)" : "var(--color-theme-700)",
|
|
809
|
+
typographyProps: {
|
|
810
|
+
variant: "Caption 1",
|
|
811
|
+
weight: "medium",
|
|
812
|
+
tabularNums: true
|
|
813
|
+
}
|
|
814
|
+
});
|
|
815
|
+
};
|
|
816
|
+
/** MyWorkPageShell.jsx's tab bar, with Agenda after Tasks; the calendar
|
|
817
|
+
views live in the Agenda tab's view menu. */
|
|
818
|
+
export const MyWorkTabs = _ref9 => {
|
|
819
|
+
let active = _ref9.active,
|
|
820
|
+
onSelect = _ref9.onSelect,
|
|
821
|
+
tasksCount = _ref9.tasksCount,
|
|
822
|
+
controls = _ref9.controls;
|
|
823
|
+
return /*#__PURE__*/React.createElement(StyledMyWorkTabs, null, /*#__PURE__*/React.createElement(Nav, {
|
|
824
|
+
onSelect: index => onSelect(MY_WORK_TABS[index].key)
|
|
825
|
+
}, MY_WORK_TABS.map(tab => /*#__PURE__*/React.createElement(Item, {
|
|
826
|
+
active: tab.key === active,
|
|
827
|
+
key: tab.key,
|
|
828
|
+
name: tab.label
|
|
829
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
830
|
+
className: "tab-label"
|
|
831
|
+
}, /*#__PURE__*/React.createElement(Body2, {
|
|
832
|
+
color: "secondary",
|
|
833
|
+
weight: "medium",
|
|
834
|
+
className: "tab-text"
|
|
835
|
+
}, tab.label), tab.key === "tasks" ? /*#__PURE__*/React.createElement(TabCountChip, {
|
|
836
|
+
count: tasksCount,
|
|
837
|
+
active: tab.key === active
|
|
838
|
+
}) : null)))), /*#__PURE__*/React.createElement("div", {
|
|
839
|
+
className: "section-controls"
|
|
840
|
+
}, controls));
|
|
841
|
+
};
|
|
842
|
+
MyWorkTabs.displayName = "MyWorkTabs";
|
|
843
|
+
export const periodLabelFor = (mode, anchor) => {
|
|
844
|
+
const date = toDate(anchor);
|
|
845
|
+
if (mode === "month") {
|
|
846
|
+
return LONG_MONTHS[date.getUTCMonth()] + " " + date.getUTCFullYear();
|
|
847
|
+
}
|
|
848
|
+
if (mode === "day") {
|
|
849
|
+
return shortDayOf(anchor) + ", " + SHORT_MONTHS[date.getUTCMonth()] + " " + date.getUTCDate();
|
|
850
|
+
}
|
|
851
|
+
const monday = mondayOf(anchor);
|
|
852
|
+
const sunday = toDate(monday + 6);
|
|
853
|
+
const mondayDate = toDate(monday);
|
|
854
|
+
const end = sunday.getUTCMonth() === mondayDate.getUTCMonth() ? "" + sunday.getUTCDate() : SHORT_MONTHS[sunday.getUTCMonth()] + " " + sunday.getUTCDate();
|
|
855
|
+
return SHORT_MONTHS[mondayDate.getUTCMonth()] + " " + mondayDate.getUTCDate() + " \u2013 " + end;
|
|
856
|
+
};
|
|
857
|
+
export const stepAnchor = (mode, anchor, direction) => {
|
|
858
|
+
if (mode === "day") return anchor + direction;
|
|
859
|
+
if (mode === "week") return anchor + 7 * direction;
|
|
860
|
+
const date = toDate(anchor);
|
|
861
|
+
return toDayNumber(utcMidnight(date.getUTCFullYear(), date.getUTCMonth() + 1 + direction, 1));
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
/** The page's bottom padding under the paper (StyledPageBody). */
|
|
865
|
+
export const PAGE_BOTTOM_GAP = 32;
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* The height that takes an element from where it starts down to the
|
|
869
|
+
* viewport's bottom, less the page's bottom padding; null while inactive.
|
|
870
|
+
* The shell lets a page grow with its content, so a paper that must hold the
|
|
871
|
+
* viewport's height measures it.
|
|
872
|
+
*/
|
|
873
|
+
export const useViewportFillHeight = (ref, active) => {
|
|
874
|
+
const _useState2 = useState(null),
|
|
875
|
+
height = _useState2[0],
|
|
876
|
+
setHeight = _useState2[1];
|
|
877
|
+
useLayoutEffect(() => {
|
|
878
|
+
if (!active) {
|
|
879
|
+
setHeight(null);
|
|
880
|
+
return undefined;
|
|
881
|
+
}
|
|
882
|
+
const update = () => {
|
|
883
|
+
const element = ref.current;
|
|
884
|
+
if (!element) return;
|
|
885
|
+
const top = element.getBoundingClientRect().top;
|
|
886
|
+
setHeight(Math.max(320, window.innerHeight - top - PAGE_BOTTOM_GAP));
|
|
887
|
+
};
|
|
888
|
+
update();
|
|
889
|
+
window.addEventListener("resize", update);
|
|
890
|
+
return () => window.removeEventListener("resize", update);
|
|
891
|
+
}, [ref, active]);
|
|
892
|
+
return height;
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
/* ================================================================== */
|
|
896
|
+
/* Agenda: Tasks and Calendar views behind one view switch */
|
|
897
|
+
/* ================================================================== */
|
|
898
|
+
|
|
899
|
+
export const AGENDA_MAIN_VIEWS = [{
|
|
900
|
+
id: "project",
|
|
901
|
+
label: "Tasks by Project",
|
|
902
|
+
icon: /*#__PURE__*/React.createElement(ProjectIcon, null)
|
|
903
|
+
}, {
|
|
904
|
+
id: "dates",
|
|
905
|
+
label: "Tasks by Date",
|
|
906
|
+
icon: /*#__PURE__*/React.createElement(CalendarDateIcon, null)
|
|
907
|
+
}, {
|
|
908
|
+
id: "calendar",
|
|
909
|
+
label: "Calendar",
|
|
910
|
+
icon: /*#__PURE__*/React.createElement(CalendarMonthIcon, null)
|
|
911
|
+
}];
|
|
912
|
+
export const AGENDA_SECOND_VIEWS = {
|
|
913
|
+
dates: [{
|
|
914
|
+
id: "start_date",
|
|
915
|
+
label: "Start Date",
|
|
916
|
+
icon: /*#__PURE__*/React.createElement(ClockIcon, null)
|
|
917
|
+
}, {
|
|
918
|
+
id: "date",
|
|
919
|
+
label: "Due Date",
|
|
920
|
+
icon: /*#__PURE__*/React.createElement(CalendarIcon, null)
|
|
921
|
+
}],
|
|
922
|
+
calendar: [{
|
|
923
|
+
id: "day",
|
|
924
|
+
label: "Day",
|
|
925
|
+
icon: /*#__PURE__*/React.createElement(ViewDayIcon, null)
|
|
926
|
+
}, {
|
|
927
|
+
id: "week",
|
|
928
|
+
label: "Week",
|
|
929
|
+
icon: /*#__PURE__*/React.createElement(ViewListIcon, {
|
|
930
|
+
style: {
|
|
931
|
+
transform: "rotate(90deg)"
|
|
932
|
+
}
|
|
933
|
+
})
|
|
934
|
+
}, {
|
|
935
|
+
id: "month",
|
|
936
|
+
label: "Month",
|
|
937
|
+
icon: /*#__PURE__*/React.createElement(ViewGridIcon, null)
|
|
938
|
+
}]
|
|
939
|
+
};
|
|
940
|
+
export const agendaMainViewOf = view => view === "project" ? "project" : view === "start_date" || view === "date" ? "dates" : "calendar";
|
|
941
|
+
export const isCalendarView = view => view === "day" || view === "week" || view === "month";
|
|
942
|
+
|
|
943
|
+
/** MyWork/Agenda/AgendaViewSwitch.jsx: the second menu remembers the last view of its group. */
|
|
944
|
+
export const AgendaViewSwitch = _ref0 => {
|
|
945
|
+
let view = _ref0.view,
|
|
946
|
+
onChange = _ref0.onChange;
|
|
947
|
+
const _useState3 = useState("date"),
|
|
948
|
+
lastDate = _useState3[0],
|
|
949
|
+
setLastDate = _useState3[1];
|
|
950
|
+
const _useState4 = useState("day"),
|
|
951
|
+
lastCalendar = _useState4[0],
|
|
952
|
+
setLastCalendar = _useState4[1];
|
|
953
|
+
const mainView = agendaMainViewOf(view);
|
|
954
|
+
const selectSecondView = next => {
|
|
955
|
+
(mainView === "dates" ? setLastDate : setLastCalendar)(next);
|
|
956
|
+
onChange(next);
|
|
957
|
+
};
|
|
958
|
+
const selectMainView = next => {
|
|
959
|
+
onChange(next === "project" ? "project" : next === "dates" ? lastDate : lastCalendar);
|
|
960
|
+
};
|
|
961
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
962
|
+
style: {
|
|
963
|
+
display: "inline-flex",
|
|
964
|
+
alignItems: "center",
|
|
965
|
+
gap: 8
|
|
966
|
+
}
|
|
967
|
+
}, mainView === "project" ? null : /*#__PURE__*/React.createElement(SubViewSwitcher, {
|
|
968
|
+
"aria-label": mainView === "dates" ? "Group By" : "Calendar Range",
|
|
969
|
+
options: AGENDA_SECOND_VIEWS[mainView],
|
|
970
|
+
value: view,
|
|
971
|
+
onChange: selectSecondView
|
|
972
|
+
}), /*#__PURE__*/React.createElement(ViewSwitcher, {
|
|
973
|
+
"aria-label": "View",
|
|
974
|
+
views: AGENDA_MAIN_VIEWS,
|
|
975
|
+
value: mainView,
|
|
976
|
+
onChange: selectMainView
|
|
977
|
+
}));
|
|
978
|
+
};
|
|
979
|
+
|
|
980
|
+
/** MyWork/Agenda/AgendaFilters.jsx: one search and one filter for all views. */
|
|
981
|
+
export const AgendaFilter = () => {
|
|
982
|
+
const _useState5 = useState(""),
|
|
983
|
+
search = _useState5[0],
|
|
984
|
+
setSearch = _useState5[1];
|
|
985
|
+
return /*#__PURE__*/React.createElement(Filter, {
|
|
986
|
+
data: [],
|
|
987
|
+
selected: {},
|
|
988
|
+
onChange: () => undefined,
|
|
989
|
+
label: "Filter",
|
|
990
|
+
clearAllText: "Clear All",
|
|
991
|
+
resetLabel: "Reset",
|
|
992
|
+
noResultText: "No results",
|
|
993
|
+
search: {
|
|
994
|
+
value: search,
|
|
995
|
+
onChange: setSearch,
|
|
996
|
+
placeholder: "Search",
|
|
997
|
+
clearLabel: "Clear Search"
|
|
998
|
+
}
|
|
999
|
+
});
|
|
1000
|
+
};
|
|
1001
|
+
//# sourceMappingURL=agendaGrid.js.map
|