ud-components 0.8.12 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/enums/feature-flag-key.enum.d.ts +2 -1
- package/fesm2022/ud-components.mjs +736 -339
- package/fesm2022/ud-components.mjs.map +1 -1
- package/lib/occupancy-grid/occupancy-grid.component.d.ts +25 -327
- package/lib/occupancy-grid/occupancy-grid.layout.d.ts +20 -4
- package/lib/occupancy-grid/timeline-grid.component.d.ts +357 -0
- package/lib/occupancy-grid/timeline-grid.interface.d.ts +115 -0
- package/lib/occupancy-grid/timeline-grid.layout.d.ts +59 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
|
@@ -4448,7 +4448,7 @@ function minIso(a, b) {
|
|
|
4448
4448
|
return a <= b ? a : b;
|
|
4449
4449
|
}
|
|
4450
4450
|
|
|
4451
|
-
const numeric = (a, b) => a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' });
|
|
4451
|
+
const numeric$1 = (a, b) => a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' });
|
|
4452
4452
|
/** Greedy interval packing. Half-open, so a bar starting the day another ends shares its lane. */
|
|
4453
4453
|
function assignLanes(bars) {
|
|
4454
4454
|
const sorted = [...bars].sort((a, b) => a.startDate.localeCompare(b.startDate) ||
|
|
@@ -4489,7 +4489,7 @@ function buildRows(rooms, dormName, collapsed) {
|
|
|
4489
4489
|
list.push(room);
|
|
4490
4490
|
byFloor.set(room.floorLevel, list);
|
|
4491
4491
|
}
|
|
4492
|
-
for (const floorLevel of [...byFloor.keys()].sort(numeric)) {
|
|
4492
|
+
for (const floorLevel of [...byFloor.keys()].sort(numeric$1)) {
|
|
4493
4493
|
const floorRooms = byFloor.get(floorLevel);
|
|
4494
4494
|
const floorKey = `${dormKey}/floor:${floorLevel}`;
|
|
4495
4495
|
rows.push({
|
|
@@ -4508,7 +4508,7 @@ function buildRows(rooms, dormName, collapsed) {
|
|
|
4508
4508
|
list.push(room);
|
|
4509
4509
|
byType.set(room.type, list);
|
|
4510
4510
|
}
|
|
4511
|
-
for (const type of [...byType.keys()].sort(numeric)) {
|
|
4511
|
+
for (const type of [...byType.keys()].sort(numeric$1)) {
|
|
4512
4512
|
const typeRooms = byType.get(type);
|
|
4513
4513
|
const typeKey = `${floorKey}/type:${type}`;
|
|
4514
4514
|
rows.push({
|
|
@@ -4521,7 +4521,7 @@ function buildRows(rooms, dormName, collapsed) {
|
|
|
4521
4521
|
if (collapsed.has(typeKey)) {
|
|
4522
4522
|
continue;
|
|
4523
4523
|
}
|
|
4524
|
-
for (const room of [...typeRooms].sort((a, b) => numeric(a.number, b.number) || a.roomId.localeCompare(b.roomId))) {
|
|
4524
|
+
for (const room of [...typeRooms].sort((a, b) => numeric$1(a.number, b.number) || a.roomId.localeCompare(b.roomId))) {
|
|
4525
4525
|
const bars = assignLanes(room.bars);
|
|
4526
4526
|
const used = bars.reduce((max, b) => Math.max(max, b.lane + 1), 0);
|
|
4527
4527
|
// A room with spare beds gets one extra empty lane to create a stay
|
|
@@ -4755,21 +4755,195 @@ function overbooksRoom(room, bookingId, start, end) {
|
|
|
4755
4755
|
room.capacity);
|
|
4756
4756
|
}
|
|
4757
4757
|
|
|
4758
|
-
|
|
4758
|
+
/**
|
|
4759
|
+
* Stands in for an open-ended bar's end everywhere a date is compared, so the
|
|
4760
|
+
* packing, overlap and geometry code never needs a null branch. Never emitted:
|
|
4761
|
+
* the component turns it back into null on the way out.
|
|
4762
|
+
*/
|
|
4763
|
+
const OPEN_END = '9999-12-31';
|
|
4764
|
+
function endOf(bar) {
|
|
4765
|
+
return bar.endDate ?? OPEN_END;
|
|
4766
|
+
}
|
|
4767
|
+
/** Greedy interval packing. Half-open, so a bar starting the day another ends shares its slot. */
|
|
4768
|
+
function packBars(bars) {
|
|
4769
|
+
const sorted = [...bars].sort((a, b) => a.startDate.localeCompare(b.startDate) || a.id.localeCompare(b.id));
|
|
4770
|
+
const slotEnds = [];
|
|
4771
|
+
return sorted.map(bar => {
|
|
4772
|
+
let slot = slotEnds.findIndex(end => end <= bar.startDate);
|
|
4773
|
+
if (slot === -1) {
|
|
4774
|
+
slot = slotEnds.length;
|
|
4775
|
+
slotEnds.push(endOf(bar));
|
|
4776
|
+
}
|
|
4777
|
+
else {
|
|
4778
|
+
slotEnds[slot] = endOf(bar);
|
|
4779
|
+
}
|
|
4780
|
+
return { bar, slot };
|
|
4781
|
+
});
|
|
4782
|
+
}
|
|
4783
|
+
function laneCount(node) {
|
|
4784
|
+
let count = node.lanes.length;
|
|
4785
|
+
for (const child of node.children.values()) {
|
|
4786
|
+
count += laneCount(child);
|
|
4787
|
+
}
|
|
4788
|
+
return count;
|
|
4789
|
+
}
|
|
4790
|
+
/**
|
|
4791
|
+
* Lanes under their group headers (outer groups first), groups in the order
|
|
4792
|
+
* they first appear and lanes in input order. Collapsed groups hide everything
|
|
4793
|
+
* below them.
|
|
4794
|
+
*/
|
|
4795
|
+
function buildTimelineRows(lanes, collapsed) {
|
|
4796
|
+
const root = {
|
|
4797
|
+
key: '',
|
|
4798
|
+
label: '',
|
|
4799
|
+
children: new Map(),
|
|
4800
|
+
lanes: [],
|
|
4801
|
+
};
|
|
4802
|
+
for (const lane of lanes) {
|
|
4803
|
+
let node = root;
|
|
4804
|
+
for (const g of [
|
|
4805
|
+
...(lane.parentGroups ?? []),
|
|
4806
|
+
{ id: lane.groupId, label: lane.groupLabel },
|
|
4807
|
+
]) {
|
|
4808
|
+
let child = node.children.get(g.id);
|
|
4809
|
+
if (!child) {
|
|
4810
|
+
child = {
|
|
4811
|
+
key: node.key ? `${node.key}/${g.id}` : g.id,
|
|
4812
|
+
label: g.label,
|
|
4813
|
+
children: new Map(),
|
|
4814
|
+
lanes: [],
|
|
4815
|
+
};
|
|
4816
|
+
node.children.set(g.id, child);
|
|
4817
|
+
}
|
|
4818
|
+
node = child;
|
|
4819
|
+
}
|
|
4820
|
+
node.lanes.push(lane);
|
|
4821
|
+
}
|
|
4822
|
+
const rows = [];
|
|
4823
|
+
const walk = (node, depth) => {
|
|
4824
|
+
for (const child of node.children.values()) {
|
|
4825
|
+
rows.push({
|
|
4826
|
+
kind: 'group',
|
|
4827
|
+
key: child.key,
|
|
4828
|
+
depth,
|
|
4829
|
+
label: child.label,
|
|
4830
|
+
laneCount: laneCount(child),
|
|
4831
|
+
});
|
|
4832
|
+
if (!collapsed.has(child.key)) {
|
|
4833
|
+
walk(child, depth + 1);
|
|
4834
|
+
}
|
|
4835
|
+
}
|
|
4836
|
+
for (const lane of node.lanes) {
|
|
4837
|
+
const bars = packBars(lane.bars);
|
|
4838
|
+
const used = bars.reduce((max, b) => Math.max(max, b.slot + 1), 0);
|
|
4839
|
+
// A lane with spare capacity gets one extra empty slot to create in; an
|
|
4840
|
+
// empty lane already has its one slot.
|
|
4841
|
+
const freeSlot = used > 0 && (lane.capacity ?? 1) > used ? used : null;
|
|
4842
|
+
rows.push({
|
|
4843
|
+
kind: 'lane',
|
|
4844
|
+
key: `lane:${lane.id}`,
|
|
4845
|
+
lane,
|
|
4846
|
+
slots: freeSlot === null ? used : used + 1,
|
|
4847
|
+
freeSlot,
|
|
4848
|
+
bars,
|
|
4849
|
+
});
|
|
4850
|
+
}
|
|
4851
|
+
};
|
|
4852
|
+
walk(root, 0);
|
|
4853
|
+
return rows;
|
|
4854
|
+
}
|
|
4855
|
+
function positionTimelineRows(rows, laneHeight) {
|
|
4856
|
+
let top = 0;
|
|
4857
|
+
return rows.map(row => {
|
|
4858
|
+
const slots = row.kind === 'group' ? 0 : Math.max(1, row.slots);
|
|
4859
|
+
const height = row.kind === 'group'
|
|
4860
|
+
? GROUP_ROW_HEIGHT
|
|
4861
|
+
: 8 + slots * laneHeight + (slots - 1) * 4;
|
|
4862
|
+
const positioned = { row, top, height };
|
|
4863
|
+
top += height;
|
|
4864
|
+
return positioned;
|
|
4865
|
+
});
|
|
4866
|
+
}
|
|
4867
|
+
/** Bars whose days include `date`. */
|
|
4868
|
+
function takenOnLane(lane, date) {
|
|
4869
|
+
return lane.bars.filter(b => b.startDate <= date && date < endOf(b)).length;
|
|
4870
|
+
}
|
|
4871
|
+
/**
|
|
4872
|
+
* The nearest neighbouring bar's boundary on the given edge: the limit a drag
|
|
4873
|
+
* on that edge must not cross. Same slot only, unless `allSlots`.
|
|
4874
|
+
*/
|
|
4875
|
+
function neighborBound(laneBars, barId, edge, allSlots = false) {
|
|
4876
|
+
const mine = laneBars.find(lb => lb.bar.id === barId);
|
|
4877
|
+
if (!mine) {
|
|
4878
|
+
return null;
|
|
4879
|
+
}
|
|
4880
|
+
const others = laneBars.filter(lb => lb.bar.id !== barId && (allSlots || lb.slot === mine.slot));
|
|
4881
|
+
if (edge === 'start') {
|
|
4882
|
+
const before = others.filter(lb => endOf(lb.bar) <= mine.bar.startDate);
|
|
4883
|
+
if (before.length === 0) {
|
|
4884
|
+
return null;
|
|
4885
|
+
}
|
|
4886
|
+
return endOf(before.reduce((a, b) => (endOf(a.bar) > endOf(b.bar) ? a : b)).bar);
|
|
4887
|
+
}
|
|
4888
|
+
const after = others.filter(lb => lb.bar.startDate >= endOf(mine.bar));
|
|
4889
|
+
if (after.length === 0) {
|
|
4890
|
+
return null;
|
|
4891
|
+
}
|
|
4892
|
+
return after.reduce((a, b) => (a.bar.startDate < b.bar.startDate ? a : b)).bar
|
|
4893
|
+
.startDate;
|
|
4894
|
+
}
|
|
4895
|
+
/** Whether `[start, end)` overlaps any OTHER bar in the lane (half-open). */
|
|
4896
|
+
function overlapsLane(lane, barId, start, end) {
|
|
4897
|
+
return lane.bars.some(b => b.id !== barId && start < endOf(b) && b.startDate < end);
|
|
4898
|
+
}
|
|
4899
|
+
/**
|
|
4900
|
+
* The slot a bar over `[start, end)` would sit in: the first one clear of
|
|
4901
|
+
* other bars, or just below the last when none is. `ignoreBarId` ('' for a
|
|
4902
|
+
* new bar) is not an obstacle.
|
|
4903
|
+
*/
|
|
4904
|
+
function slotForSpan(row, start, end, ignoreBarId) {
|
|
4905
|
+
for (let slot = 0; slot < row.slots; slot++) {
|
|
4906
|
+
const taken = row.bars.some(lb => lb.slot === slot &&
|
|
4907
|
+
lb.bar.id !== ignoreBarId &&
|
|
4908
|
+
start < endOf(lb.bar) &&
|
|
4909
|
+
lb.bar.startDate < end);
|
|
4910
|
+
if (!taken) {
|
|
4911
|
+
return slot;
|
|
4912
|
+
}
|
|
4913
|
+
}
|
|
4914
|
+
return row.slots;
|
|
4915
|
+
}
|
|
4916
|
+
|
|
4917
|
+
const TIMELINE_GRID_HEADER_HEIGHT = 52;
|
|
4759
4918
|
/** How far the pointer must move before a mousedown on a bar's body becomes a whole-bar drag rather than a click. */
|
|
4760
4919
|
const MOVE_DRAG_THRESHOLD_PX = 4;
|
|
4920
|
+
const TIMELINE_GRID_DEFAULT_LEGEND = [
|
|
4921
|
+
{ state: 'tentative', labelKey: 'occupancyGrid.states.tentative' },
|
|
4922
|
+
{ state: 'reserved', labelKey: 'occupancyGrid.states.reserved' },
|
|
4923
|
+
{ state: 'in_room', labelKey: 'occupancyGrid.states.in_room' },
|
|
4924
|
+
{ state: 'history', labelKey: 'occupancyGrid.states.history' },
|
|
4925
|
+
];
|
|
4926
|
+
/** An open-ended bar's internal end back to the public null. */
|
|
4927
|
+
function publicEnd(end) {
|
|
4928
|
+
return end === OPEN_END ? null : end;
|
|
4929
|
+
}
|
|
4761
4930
|
/**
|
|
4762
|
-
*
|
|
4763
|
-
*
|
|
4764
|
-
*
|
|
4765
|
-
*
|
|
4766
|
-
*
|
|
4767
|
-
*
|
|
4768
|
-
*
|
|
4769
|
-
*
|
|
4931
|
+
* Lanes as rows, days as columns, one bar per occupant (UC-11, made generic in
|
|
4932
|
+
* UC-42; `ud-occupancy-grid` is the rooms-and-stays wrapper around it). It
|
|
4933
|
+
* never writes anywhere — `lanes` is the only source of truth and this
|
|
4934
|
+
* component never mutates it — but it is not inert: a bar's edge can be
|
|
4935
|
+
* dragged (or, on a focused bar, Shift + arrow-keyed) to propose a new date,
|
|
4936
|
+
* reported via `barResize`; a bar's body can be dragged to a new date, a
|
|
4937
|
+
* different lane, or both, reported via `barMove`; an empty stretch can be
|
|
4938
|
+
* dragged across to propose a new bar (`barCreate`); something dragged in from
|
|
4939
|
+
* outside the grid can be dropped on a lane (`laneDrop`). Every gesture works
|
|
4940
|
+
* the same way: report what happened, apply nothing.
|
|
4941
|
+
*
|
|
4942
|
+
* Inside a lane, overlapping bars are packed into slots (sub-rows); a lane
|
|
4943
|
+
* with spare `capacity` also offers one empty slot to create in.
|
|
4770
4944
|
*
|
|
4771
|
-
* Owns its own row virtualization: rows have different heights (one
|
|
4772
|
-
* overlapping
|
|
4945
|
+
* Owns its own row virtualization: rows have different heights (one slot per
|
|
4946
|
+
* overlapping bar), which the CDK's stable fixed-size strategy cannot do, and
|
|
4773
4947
|
* the autosize strategy is still experimental. Rows are positioned from a
|
|
4774
4948
|
* prefix sum of heights and only those intersecting the viewport are rendered.
|
|
4775
4949
|
*
|
|
@@ -4777,11 +4951,9 @@ const MOVE_DRAG_THRESHOLD_PX = 4;
|
|
|
4777
4951
|
* local-date.ts; `new Date(string)` is never used, so a column can never be
|
|
4778
4952
|
* off by one west of Greenwich.
|
|
4779
4953
|
*/
|
|
4780
|
-
class
|
|
4954
|
+
class TimelineGridComponent {
|
|
4781
4955
|
translate;
|
|
4782
|
-
|
|
4783
|
-
rooms = input([]);
|
|
4784
|
-
dormName = input('');
|
|
4956
|
+
lanes = input([]);
|
|
4785
4957
|
from = input.required();
|
|
4786
4958
|
to = input.required();
|
|
4787
4959
|
today = input(null);
|
|
@@ -4792,150 +4964,126 @@ class OccupancyGridComponent {
|
|
|
4792
4964
|
/** Days the ‹ / › nav buttons and the ArrowLeft/ArrowRight keys shift the window by. */
|
|
4793
4965
|
navStepDays = input(7);
|
|
4794
4966
|
/**
|
|
4795
|
-
* When true, a resize or
|
|
4796
|
-
*
|
|
4797
|
-
*
|
|
4798
|
-
*
|
|
4799
|
-
*
|
|
4800
|
-
*
|
|
4801
|
-
* so a drag simply cannot propose a second one over it: a resize clamps
|
|
4802
|
-
* at the nearest other bar in the room (not just its own lane), and a
|
|
4803
|
-
* move drag ignores any candidate date/room that would overlap, sticking
|
|
4804
|
-
* to the last placement that did not.
|
|
4967
|
+
* When true, a resize, move or create drag is never allowed to leave two
|
|
4968
|
+
* bars in the same lane overlapping in time: a resize clamps at the nearest
|
|
4969
|
+
* other bar in the lane (not just its own slot), and a move or create
|
|
4970
|
+
* ignores any candidate that would overlap, sticking to the last one that
|
|
4971
|
+
* did not. Off by default, because a lane with capacity legitimately holds
|
|
4972
|
+
* overlapping bars in different slots.
|
|
4805
4973
|
*/
|
|
4806
4974
|
preventOverlap = input(false);
|
|
4975
|
+
/** Translation keys for the corner header, the empty state and a lane's aria label (`{{lane}}` and `{{room}}` get the lane label). */
|
|
4976
|
+
cornerLabelKey = input('timelineGrid.lanes');
|
|
4977
|
+
emptyLabelKey = input('timelineGrid.empty');
|
|
4978
|
+
createCellLabelKey = input('timelineGrid.createCell');
|
|
4979
|
+
/** The bar states listed in the legend, and the label each one shows in a bar's tooltip. */
|
|
4980
|
+
legend = input(TIMELINE_GRID_DEFAULT_LEGEND);
|
|
4807
4981
|
/**
|
|
4808
|
-
*
|
|
4809
|
-
*
|
|
4810
|
-
*
|
|
4811
|
-
*
|
|
4982
|
+
* What is being dragged in from outside the grid, or null when nothing is.
|
|
4983
|
+
* The consumer sets it on its own `dragstart` and clears it on `dragend`:
|
|
4984
|
+
* an HTML5 drag's data cannot be read until the drop, so this is how the
|
|
4985
|
+
* grid knows, during the drag, which lanes can take it. Lanes only accept a
|
|
4986
|
+
* drop while it is set.
|
|
4812
4987
|
*/
|
|
4813
|
-
|
|
4988
|
+
dragPayload = input(null);
|
|
4989
|
+
/** Whether a lane can take `dragPayload`. Lanes that cannot are greyed out while the drag is live. Null = every lane can. */
|
|
4990
|
+
canDrop = input(null);
|
|
4814
4991
|
barClick = output();
|
|
4815
4992
|
closureClick = output();
|
|
4816
|
-
|
|
4817
|
-
|
|
4993
|
+
/** The lane's own header cell was clicked. */
|
|
4994
|
+
laneClick = output();
|
|
4995
|
+
/** An empty day cell was clicked: the lane and the date under the pointer. */
|
|
4818
4996
|
cellClick = output();
|
|
4819
4997
|
reachedEnd = output();
|
|
4820
4998
|
/**
|
|
4821
4999
|
* The nav buttons or an arrow key asked to move the window. The component
|
|
4822
|
-
* does not own `from`/`to
|
|
4823
|
-
*
|
|
4824
|
-
*
|
|
4825
|
-
* that wants the shift applied does
|
|
4826
|
-
* `from = addDays(from, delta); to = addDays(to, delta)`.
|
|
5000
|
+
* does not own `from`/`to`, so it reports the signed day delta — negative
|
|
5001
|
+
* for earlier, positive for later. A consumer that wants the shift applied
|
|
5002
|
+
* does `from = addDays(from, delta); to = addDays(to, delta)`.
|
|
4827
5003
|
*/
|
|
4828
5004
|
windowShift = output();
|
|
4829
|
-
/**
|
|
4830
|
-
* A bar's edge was dragged, or Shift + arrow-keyed, to a new date. See
|
|
4831
|
-
* `OccupancyBarResize` — this reports the proposal; it never applies it.
|
|
4832
|
-
*/
|
|
4833
5005
|
barResize = output();
|
|
4834
|
-
/**
|
|
4835
|
-
* A bar's body was dragged to new dates, a different room, or both. See
|
|
4836
|
-
* `OccupancyBarMove` — this reports the proposal; it never applies it.
|
|
4837
|
-
*/
|
|
4838
5006
|
barMove = output();
|
|
4839
|
-
/**
|
|
4840
|
-
* A new booking's dates were proposed by dragging across empty lane cells,
|
|
4841
|
-
* or by the keyboard-driven create flow (see `onLaneKeydown`). See
|
|
4842
|
-
* `OccupancyBarCreate` — this reports the proposal; it never creates a bar
|
|
4843
|
-
* itself.
|
|
4844
|
-
*/
|
|
4845
5007
|
barCreate = output();
|
|
4846
|
-
|
|
5008
|
+
laneDrop = output();
|
|
5009
|
+
headerHeight = TIMELINE_GRID_HEADER_HEIGHT;
|
|
4847
5010
|
scroller = viewChild.required('scroller');
|
|
4848
5011
|
collapsed = signal(new Set());
|
|
4849
5012
|
scrollTop = signal(0);
|
|
4850
5013
|
viewportHeight = signal(600);
|
|
4851
5014
|
lastEndEmittedFor = null;
|
|
4852
5015
|
/**
|
|
4853
|
-
* The in-progress drag, if any
|
|
4854
|
-
*
|
|
4855
|
-
*
|
|
4856
|
-
*
|
|
5016
|
+
* The in-progress edge drag, if any. `geometryOf` and `barTitle` read the
|
|
5017
|
+
* preview dates for whichever bar this names so the drag renders live;
|
|
5018
|
+
* nothing about `lanes` changes, since the component does not own it. An
|
|
5019
|
+
* open-ended bar's end is `OPEN_END` here and null again on the way out.
|
|
4857
5020
|
*/
|
|
4858
5021
|
resize = signal(null);
|
|
5022
|
+
/** Read-only view of `resize`, for a wrapper that surfaces it (ud-occupancy-grid). */
|
|
5023
|
+
activeResize = this.resize.asReadonly();
|
|
4859
5024
|
dragMoveListener = null;
|
|
4860
5025
|
dragUpListener = null;
|
|
4861
5026
|
dragKeyListener = null;
|
|
4862
5027
|
/**
|
|
4863
|
-
* The in-progress whole-bar drag, if any
|
|
4864
|
-
*
|
|
4865
|
-
*
|
|
4866
|
-
*
|
|
4867
|
-
* move. `targetRoom` starts as `fromRoom` and is re-resolved on every
|
|
4868
|
-
* mousemove from whatever `.occ__row--room` is actually under the
|
|
4869
|
-
* pointer — see `roomUnderPoint` — so dragging vertically onto another
|
|
4870
|
-
* room's row is exactly the gesture `roomUnderPoint` is built to read.
|
|
5028
|
+
* The in-progress whole-bar drag, if any. `dragging` only flips true once
|
|
5029
|
+
* the pointer clears a small threshold, so a plain click still reaches
|
|
5030
|
+
* `barClick`. `targetLane` is re-resolved on every mousemove from whatever
|
|
5031
|
+
* lane row is under the pointer — see `laneUnderPoint`.
|
|
4871
5032
|
*/
|
|
4872
5033
|
move = signal(null);
|
|
4873
5034
|
moveMoveListener = null;
|
|
4874
5035
|
moveUpListener = null;
|
|
4875
5036
|
moveKeyListener = null;
|
|
4876
5037
|
/**
|
|
4877
|
-
* The in-progress drag-to-create, if any
|
|
4878
|
-
*
|
|
4879
|
-
*
|
|
4880
|
-
*
|
|
4881
|
-
*
|
|
4882
|
-
* click-vs-drag threshold `move` uses, while a keyboard create is live the
|
|
4883
|
-
* instant Enter starts it (there is no "release" to wait for) and commits
|
|
4884
|
-
* on a second Enter.
|
|
5038
|
+
* The in-progress drag-to-create, if any. `startDate` is the anchor the
|
|
5039
|
+
* drag began from (mouse) or the focused cell it started from (keyboard). A
|
|
5040
|
+
* mouse create only commits on mouseup once it clears the click-vs-drag
|
|
5041
|
+
* threshold; a keyboard create is live the instant Enter starts it and
|
|
5042
|
+
* commits on a second Enter.
|
|
4885
5043
|
*/
|
|
4886
5044
|
create = signal(null);
|
|
4887
5045
|
createMoveListener = null;
|
|
4888
5046
|
createUpListener = null;
|
|
4889
5047
|
createKeyListener = null;
|
|
4890
5048
|
/**
|
|
4891
|
-
* The keyboard-focused empty cell, if any
|
|
4892
|
-
*
|
|
4893
|
-
*
|
|
4894
|
-
* so the highlighted cell does not vanish out from under an active
|
|
4895
|
-
* gesture.
|
|
5049
|
+
* The keyboard-focused empty cell, if any. Cleared on blur unless a
|
|
5050
|
+
* keyboard create is in progress, so the highlighted cell does not vanish
|
|
5051
|
+
* out from under an active gesture.
|
|
4896
5052
|
*/
|
|
4897
5053
|
laneFocus = signal(null);
|
|
4898
5054
|
/**
|
|
4899
|
-
* The day column under the pointer anywhere on the canvas
|
|
4900
|
-
*
|
|
4901
|
-
*
|
|
4902
|
-
* the pointer reads as a crosshair: which room, which night.
|
|
5055
|
+
* The day column under the pointer anywhere on the canvas, as an index into
|
|
5056
|
+
* days(), or null. Drawn as a full-height band, so together with the row
|
|
5057
|
+
* wash the pointer reads as a crosshair: which lane, which day.
|
|
4903
5058
|
*/
|
|
4904
5059
|
hoverDay = signal(null);
|
|
4905
5060
|
/**
|
|
4906
|
-
* The empty cell the mouse is
|
|
4907
|
-
* equivalent of `laneFocus
|
|
4908
|
-
*
|
|
4909
|
-
* whenever any gesture (create, resize, or a whole-bar move) is live, so
|
|
4910
|
-
* it never competes with that gesture's own preview.
|
|
5061
|
+
* The empty cell the mouse (or an external drag) is over, if any — the
|
|
5062
|
+
* pointer equivalent of `laneFocus`. Cleared whenever a create, resize or
|
|
5063
|
+
* move is live, so it never competes with that gesture's own preview.
|
|
4911
5064
|
*/
|
|
4912
5065
|
laneHover = signal(null);
|
|
5066
|
+
/** The lane an external drag is currently over. */
|
|
5067
|
+
dropTarget = signal(null);
|
|
4913
5068
|
/**
|
|
4914
5069
|
* The pointer is over a bar or closure. Suppresses the focus-cursor
|
|
4915
5070
|
* fallback in `laneCursorGeometry`, so a stale keyboard cell does not show
|
|
4916
|
-
* up elsewhere while the pointer is on a
|
|
5071
|
+
* up elsewhere while the pointer is on a bar.
|
|
4917
5072
|
*/
|
|
4918
5073
|
pointerOnBar = signal(false);
|
|
4919
|
-
// A drag that ends with the pointer over the lane
|
|
4920
|
-
// handle, or not back over the bar's own body) still makes the browser
|
|
5074
|
+
// A drag that ends with the pointer over the lane still makes the browser
|
|
4921
5075
|
// synthesize a `click` right after the `mouseup`, targeted at the nearest
|
|
4922
|
-
// common ancestor of the mousedown and mouseup elements
|
|
4923
|
-
//
|
|
4924
|
-
//
|
|
4925
|
-
//
|
|
4926
|
-
//
|
|
4927
|
-
// lands; the timer is a safety net for the rare case where no click
|
|
4928
|
-
// follows at all (e.g. the pointer left the window), so a stray flag never
|
|
4929
|
-
// survives to swallow some later, unrelated click.
|
|
5076
|
+
// common ancestor of the mousedown and mouseup elements. Left alone that
|
|
5077
|
+
// click would surface as a spurious cellClick or barClick the instant a
|
|
5078
|
+
// resize or move finishes. This flag is armed when a drag ends and consumed
|
|
5079
|
+
// by the one click that follows; the timer is a safety net for when no
|
|
5080
|
+
// click follows at all, so a stray flag never swallows a later click.
|
|
4930
5081
|
suppressNextClick = false;
|
|
4931
5082
|
suppressNextClickTimer = null;
|
|
4932
|
-
constructor(translate,
|
|
5083
|
+
constructor(translate, destroyRef) {
|
|
4933
5084
|
this.translate = translate;
|
|
4934
|
-
|
|
4935
|
-
//
|
|
4936
|
-
// consumer navigates away mid-drag) must not leave window-level
|
|
4937
|
-
// listeners behind — they would keep firing against a destroyed
|
|
4938
|
-
// component's signals otherwise, and never get cleaned up any other way.
|
|
5085
|
+
// A drag still active when the component is torn down must not leave
|
|
5086
|
+
// window-level listeners behind.
|
|
4939
5087
|
destroyRef.onDestroy(() => {
|
|
4940
5088
|
this.removeDragListeners();
|
|
4941
5089
|
this.removeMoveListeners();
|
|
@@ -4949,8 +5097,8 @@ class OccupancyGridComponent {
|
|
|
4949
5097
|
? Math.max(0, daysBetween(this.from(), this.to()))
|
|
4950
5098
|
: 0);
|
|
4951
5099
|
canvasWidth = computed(() => this.leftColumnWidth() + this.dayCount() * this.dayWidth());
|
|
4952
|
-
rows = computed(() =>
|
|
4953
|
-
positioned = computed(() =>
|
|
5100
|
+
rows = computed(() => buildTimelineRows(this.lanes(), this.collapsed()));
|
|
5101
|
+
positioned = computed(() => positionTimelineRows(this.rows(), this.laneHeight()));
|
|
4954
5102
|
bodyHeight = computed(() => totalHeight(this.positioned()));
|
|
4955
5103
|
visible = computed(() => {
|
|
4956
5104
|
const { first, last } = visibleRange(this.positioned(), this.scrollTop(), this.viewportHeight());
|
|
@@ -4971,23 +5119,18 @@ class OccupancyGridComponent {
|
|
|
4971
5119
|
}
|
|
4972
5120
|
return daysBetween(this.from(), today) * this.dayWidth();
|
|
4973
5121
|
});
|
|
4974
|
-
|
|
5122
|
+
lanesById = computed(() => {
|
|
4975
5123
|
const map = new Map();
|
|
4976
|
-
for (const
|
|
4977
|
-
map.set(
|
|
5124
|
+
for (const lane of this.lanes()) {
|
|
5125
|
+
map.set(lane.id, lane);
|
|
4978
5126
|
}
|
|
4979
5127
|
return map;
|
|
4980
5128
|
});
|
|
4981
5129
|
/**
|
|
4982
5130
|
* The floating copy of a bar being dragged by its body — null unless a
|
|
4983
5131
|
* move drag has cleared the click threshold. Positioned in canvas
|
|
4984
|
-
* coordinates
|
|
4985
|
-
*
|
|
4986
|
-
* in; `positioned()` already has every visible row's pixel `top`, so no
|
|
4987
|
-
* separate DOM lookup is needed to place it. Always drawn at lane 0 of the
|
|
4988
|
-
* target room — a simplification the consumer's own re-lane on save
|
|
4989
|
-
* supersedes anyway, same as the rest of this component's "report the
|
|
4990
|
-
* gesture, never own the data" contract.
|
|
5132
|
+
* coordinates because a move can target a lane other than the one the drag
|
|
5133
|
+
* started in; `positioned()` already has every visible row's pixel `top`.
|
|
4991
5134
|
*/
|
|
4992
5135
|
moveGhost = computed(() => {
|
|
4993
5136
|
const m = this.move();
|
|
@@ -4995,25 +5138,21 @@ class OccupancyGridComponent {
|
|
|
4995
5138
|
return null;
|
|
4996
5139
|
}
|
|
4997
5140
|
const geometry = barGeometry({ startDate: m.previewStartDate, endDate: m.previewEndDate }, this.from(), this.to(), this.dayWidth());
|
|
4998
|
-
const targetRow = this.
|
|
4999
|
-
p.row.room.roomId === m.targetRoom.roomId);
|
|
5141
|
+
const targetRow = this.laneRowOf(m.targetLane.id);
|
|
5000
5142
|
if (!geometry || !targetRow) {
|
|
5001
5143
|
return null;
|
|
5002
5144
|
}
|
|
5003
|
-
//
|
|
5004
|
-
//
|
|
5005
|
-
|
|
5006
|
-
const lane = laneForSpan(targetRow.row, m.previewStartDate, m.previewEndDate, m.bar.bookingId);
|
|
5145
|
+
// A span over another bar sits in a free slot, or just below the row,
|
|
5146
|
+
// instead of covering it. The moving bar itself is not an obstacle.
|
|
5147
|
+
const slot = slotForSpan(targetRow.row, m.previewStartDate, m.previewEndDate, m.bar.id);
|
|
5007
5148
|
return {
|
|
5008
5149
|
left: this.leftColumnWidth() + geometry.left + 1,
|
|
5009
|
-
top: this.headerHeight +
|
|
5010
|
-
targetRow.top +
|
|
5011
|
-
4 +
|
|
5012
|
-
lane * (this.laneHeight() + 4),
|
|
5150
|
+
top: this.headerHeight + targetRow.top + 4 + slot * (this.laneHeight() + 4),
|
|
5013
5151
|
width: geometry.width - 2,
|
|
5014
5152
|
height: this.laneHeight(),
|
|
5015
|
-
label: m.bar.
|
|
5153
|
+
label: m.bar.title,
|
|
5016
5154
|
state: m.bar.state,
|
|
5155
|
+
openEnded: m.bar.endDate === null,
|
|
5017
5156
|
};
|
|
5018
5157
|
});
|
|
5019
5158
|
/** The in-progress drag-to-create's preview span, once it clears the drag threshold (mouse) or as soon as it starts (keyboard). */
|
|
@@ -5022,17 +5161,15 @@ class OccupancyGridComponent {
|
|
|
5022
5161
|
if (!c || !c.dragging) {
|
|
5023
5162
|
return null;
|
|
5024
5163
|
}
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
: c.lane;
|
|
5031
|
-
return this.ghostGeometry(c.room, c.previewStart, c.previewEnd, lane);
|
|
5164
|
+
const row = this.laneRowOf(c.lane.id)?.row;
|
|
5165
|
+
const slot = row
|
|
5166
|
+
? slotForSpan(row, c.previewStart, c.previewEnd, '')
|
|
5167
|
+
: c.slot;
|
|
5168
|
+
return this.ghostGeometry(c.lane, c.previewStart, c.previewEnd, slot);
|
|
5032
5169
|
});
|
|
5033
5170
|
/**
|
|
5034
|
-
* The empty cell to outline — the
|
|
5035
|
-
*
|
|
5171
|
+
* The empty cell to outline — the pointer (or external drag) position if
|
|
5172
|
+
* there is one, otherwise the keyboard-focused cell — whenever no create
|
|
5036
5173
|
* gesture is overriding it with its own live preview.
|
|
5037
5174
|
*/
|
|
5038
5175
|
laneCursorGeometry = computed(() => {
|
|
@@ -5043,32 +5180,34 @@ class OccupancyGridComponent {
|
|
|
5043
5180
|
if (!f) {
|
|
5044
5181
|
return null;
|
|
5045
5182
|
}
|
|
5046
|
-
const
|
|
5047
|
-
if (!
|
|
5183
|
+
const lane = this.lanesById().get(f.laneId);
|
|
5184
|
+
if (!lane) {
|
|
5048
5185
|
return null;
|
|
5049
5186
|
}
|
|
5050
|
-
const
|
|
5051
|
-
return this.ghostGeometry(
|
|
5187
|
+
const slot = 'slot' in f ? f.slot : this.createSlot(lane);
|
|
5188
|
+
return this.ghostGeometry(lane, f.date, addDays(f.date, 1), slot);
|
|
5052
5189
|
});
|
|
5053
|
-
|
|
5054
|
-
|
|
5190
|
+
laneRowOf(laneId) {
|
|
5191
|
+
return this.positioned().find(p => p.row.kind === 'lane' && p.row.lane.id === laneId);
|
|
5192
|
+
}
|
|
5193
|
+
/** Canvas-coordinate box for a date span in a given lane's row; `slot` picks which of the row's slots it sits in. */
|
|
5194
|
+
ghostGeometry(lane, start, end, slot) {
|
|
5055
5195
|
const geometry = barGeometry({ startDate: start, endDate: end }, this.from(), this.to(), this.dayWidth());
|
|
5056
|
-
const targetRow = this.
|
|
5057
|
-
p.row.room.roomId === room.roomId);
|
|
5196
|
+
const targetRow = this.laneRowOf(lane.id);
|
|
5058
5197
|
if (!geometry || !targetRow) {
|
|
5059
5198
|
return null;
|
|
5060
5199
|
}
|
|
5061
5200
|
return {
|
|
5062
5201
|
left: this.leftColumnWidth() + geometry.left + 1,
|
|
5063
|
-
top: this.headerHeight + targetRow.top + 4 +
|
|
5202
|
+
top: this.headerHeight + targetRow.top + 4 + slot * (this.laneHeight() + 4),
|
|
5064
5203
|
width: geometry.width - 2,
|
|
5065
5204
|
height: this.laneHeight(),
|
|
5066
5205
|
};
|
|
5067
5206
|
}
|
|
5068
|
-
/** Where a keyboard create lands: the
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5207
|
+
/** Where a keyboard create lands: the lane's free slot when it has one, else slot 0. */
|
|
5208
|
+
createSlot(lane) {
|
|
5209
|
+
return (this.laneRowOf(lane.id)?.row?.freeSlot ??
|
|
5210
|
+
0);
|
|
5072
5211
|
}
|
|
5073
5212
|
monthLabels() {
|
|
5074
5213
|
const keys = [
|
|
@@ -5089,42 +5228,39 @@ class OccupancyGridComponent {
|
|
|
5089
5228
|
}
|
|
5090
5229
|
geometryOf(bar) {
|
|
5091
5230
|
const preview = this.previewDatesOf(bar);
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
: bar
|
|
5095
|
-
|
|
5231
|
+
return barGeometry({
|
|
5232
|
+
startDate: preview ? preview.start : bar.startDate,
|
|
5233
|
+
endDate: preview ? preview.end : endOf(bar),
|
|
5234
|
+
}, this.from(), this.to(), this.dayWidth());
|
|
5096
5235
|
}
|
|
5097
5236
|
/** The in-progress drag's proposed dates for this bar, or null if it is not the one being dragged. */
|
|
5098
5237
|
previewDatesOf(bar) {
|
|
5099
5238
|
const r = this.resize();
|
|
5100
|
-
if (!r || r.bar.
|
|
5239
|
+
if (!r || r.bar.id !== bar.id) {
|
|
5101
5240
|
return null;
|
|
5102
5241
|
}
|
|
5103
5242
|
return { start: r.previewStart, end: r.previewEnd };
|
|
5104
5243
|
}
|
|
5105
|
-
isResizing(
|
|
5106
|
-
return this.resize()?.bar.
|
|
5244
|
+
isResizing(barId) {
|
|
5245
|
+
return this.resize()?.bar.id === barId;
|
|
5107
5246
|
}
|
|
5108
|
-
/** True once a whole-bar drag on this
|
|
5109
|
-
isBeingMoved(
|
|
5247
|
+
/** True once a whole-bar drag on this bar has cleared the click threshold — see `move`. */
|
|
5248
|
+
isBeingMoved(barId) {
|
|
5110
5249
|
const m = this.move();
|
|
5111
|
-
return !!m && m.dragging && m.bar.
|
|
5250
|
+
return !!m && m.dragging && m.bar.id === barId;
|
|
5112
5251
|
}
|
|
5113
|
-
/** True while a whole-bar drag
|
|
5114
|
-
isMoveTarget(
|
|
5252
|
+
/** True while a whole-bar drag, or an accepted external drag, is hovering this lane. */
|
|
5253
|
+
isMoveTarget(laneId) {
|
|
5115
5254
|
const m = this.move();
|
|
5116
|
-
return !!m && m.dragging && m.
|
|
5255
|
+
return ((!!m && m.dragging && m.targetLane.id === laneId) ||
|
|
5256
|
+
(this.dragPayload() !== null && this.dropTarget() === laneId));
|
|
5117
5257
|
}
|
|
5118
5258
|
closureGeometryOf(closure) {
|
|
5119
|
-
return
|
|
5259
|
+
return barGeometry(closure, this.from(), this.to(), this.dayWidth());
|
|
5120
5260
|
}
|
|
5121
|
-
/**
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
* window did not include today; the first day shown is always loaded.
|
|
5125
|
-
*/
|
|
5126
|
-
takenOn(room) {
|
|
5127
|
-
return takenOn(room, this.from());
|
|
5261
|
+
/** Bars on the first day shown (UC-18), for lanes with a capacity; null hides the count. */
|
|
5262
|
+
takenOn(lane) {
|
|
5263
|
+
return lane.capacity === undefined ? null : takenOnLane(lane, this.from());
|
|
5128
5264
|
}
|
|
5129
5265
|
isCollapsed(key) {
|
|
5130
5266
|
return this.collapsed().has(key);
|
|
@@ -5142,13 +5278,16 @@ class OccupancyGridComponent {
|
|
|
5142
5278
|
barTitle(bar) {
|
|
5143
5279
|
const preview = this.previewDatesOf(bar);
|
|
5144
5280
|
const start = preview ? preview.start : bar.startDate;
|
|
5145
|
-
const end = preview ? preview.end : bar
|
|
5146
|
-
const
|
|
5147
|
-
|
|
5281
|
+
const end = publicEnd(preview ? preview.end : endOf(bar));
|
|
5282
|
+
const labelKey = this.legend().find(l => l.state === bar.state)?.labelKey ??
|
|
5283
|
+
`occupancyGrid.states.${bar.state}`;
|
|
5284
|
+
const state = this.translate.instant(labelKey);
|
|
5285
|
+
const until = end ?? this.translate.instant('timelineGrid.openEnded');
|
|
5286
|
+
return `${bar.title} · ${start} → ${until} · ${state}`;
|
|
5148
5287
|
}
|
|
5149
5288
|
closureTitle(closure) {
|
|
5150
5289
|
return (this.translate.instant('occupancyGrid.closedReason', {
|
|
5151
|
-
reason: closure.
|
|
5290
|
+
reason: closure.label,
|
|
5152
5291
|
}) + ` · ${closure.startDate} → ${closure.endDate}`);
|
|
5153
5292
|
}
|
|
5154
5293
|
onScroll() {
|
|
@@ -5164,7 +5303,7 @@ class OccupancyGridComponent {
|
|
|
5164
5303
|
trackRow(_, p) {
|
|
5165
5304
|
return p.row.key;
|
|
5166
5305
|
}
|
|
5167
|
-
|
|
5306
|
+
asLaneRow(row) {
|
|
5168
5307
|
return row;
|
|
5169
5308
|
}
|
|
5170
5309
|
/** ‹ / › nav buttons. Emits the signed day delta; see `windowShift`. */
|
|
@@ -5173,15 +5312,10 @@ class OccupancyGridComponent {
|
|
|
5173
5312
|
}
|
|
5174
5313
|
/**
|
|
5175
5314
|
* ArrowLeft/ArrowRight anywhere in the grid page the window, the same as
|
|
5176
|
-
* the nav buttons
|
|
5177
|
-
*
|
|
5178
|
-
* a bar, room cell or group header's own Enter handling is untouched.
|
|
5315
|
+
* the nav buttons. Shift+Arrow on a focused bar resizes it instead (bound on
|
|
5316
|
+
* the bar itself), so it is declined here.
|
|
5179
5317
|
*/
|
|
5180
5318
|
onGridKeydown(event) {
|
|
5181
|
-
// Shift+Arrow on a focused bar resizes it (onBarKeydownResize, bound on
|
|
5182
|
-
// the bar itself); this handler still sees the same bubbled keydown, so
|
|
5183
|
-
// it must decline plain-Arrow handling here or a resize would also page
|
|
5184
|
-
// the window on every keystroke.
|
|
5185
5319
|
if (event.shiftKey) {
|
|
5186
5320
|
return;
|
|
5187
5321
|
}
|
|
@@ -5195,43 +5329,42 @@ class OccupancyGridComponent {
|
|
|
5195
5329
|
}
|
|
5196
5330
|
}
|
|
5197
5331
|
/**
|
|
5198
|
-
* A click inside a
|
|
5199
|
-
*
|
|
5200
|
-
*
|
|
5332
|
+
* A click inside a lane that landed on neither a bar nor a closure (both
|
|
5333
|
+
* stop propagation before this fires) — the lane and the date under the
|
|
5334
|
+
* pointer.
|
|
5201
5335
|
*/
|
|
5202
|
-
onLaneClick(event,
|
|
5336
|
+
onLaneClick(event, lane) {
|
|
5203
5337
|
if (this.consumeSuppressNextClick()) {
|
|
5204
5338
|
return;
|
|
5205
5339
|
}
|
|
5206
5340
|
const rect = event.currentTarget.getBoundingClientRect();
|
|
5207
5341
|
const date = dateAtOffset(event.clientX - rect.left, this.from(), this.dayWidth());
|
|
5208
|
-
this.cellClick.emit({
|
|
5342
|
+
this.cellClick.emit({ lane, date });
|
|
5209
5343
|
}
|
|
5210
|
-
/** The bar's own click handler routes through here so it shares the same
|
|
5211
|
-
onBarClick(bar,
|
|
5344
|
+
/** The bar's own click handler routes through here so it shares the same post-drag click guard as `onLaneClick`. */
|
|
5345
|
+
onBarClick(bar, lane) {
|
|
5212
5346
|
if (this.consumeSuppressNextClick()) {
|
|
5213
5347
|
return;
|
|
5214
5348
|
}
|
|
5215
|
-
this.barClick.emit({ bar,
|
|
5349
|
+
this.barClick.emit({ bar, lane });
|
|
5216
5350
|
}
|
|
5217
5351
|
// ─────────────────────────────────────────────────────── extend / shorten
|
|
5218
5352
|
/**
|
|
5219
|
-
* Mousedown on a bar's edge handle starts a drag. Listeners go on
|
|
5220
|
-
*
|
|
5221
|
-
*
|
|
5222
|
-
*
|
|
5223
|
-
* drawer) or on the lane underneath it (a `cellClick`).
|
|
5353
|
+
* Mousedown on a bar's edge handle starts a drag. Listeners go on `window`
|
|
5354
|
+
* because the pointer leaves an 8px handle the instant the drag starts;
|
|
5355
|
+
* `stopPropagation` keeps this from also reading as a click on the bar or
|
|
5356
|
+
* the lane underneath it.
|
|
5224
5357
|
*/
|
|
5225
|
-
startResize(event,
|
|
5358
|
+
startResize(event, lane, bar, edge, laneBars) {
|
|
5226
5359
|
event.stopPropagation();
|
|
5227
5360
|
event.preventDefault();
|
|
5228
|
-
const bound =
|
|
5361
|
+
const bound = neighborBound(laneBars, bar.id, edge, this.preventOverlap());
|
|
5229
5362
|
this.resize.set({
|
|
5230
|
-
|
|
5363
|
+
lane,
|
|
5231
5364
|
bar,
|
|
5232
5365
|
edge,
|
|
5233
5366
|
previewStart: bar.startDate,
|
|
5234
|
-
previewEnd: bar
|
|
5367
|
+
previewEnd: endOf(bar),
|
|
5235
5368
|
minBound: edge === 'start' ? bound : null,
|
|
5236
5369
|
maxBound: edge === 'end' ? bound : null,
|
|
5237
5370
|
});
|
|
@@ -5258,7 +5391,7 @@ class OccupancyGridComponent {
|
|
|
5258
5391
|
next = r.minBound;
|
|
5259
5392
|
}
|
|
5260
5393
|
if (next >= r.previewEnd) {
|
|
5261
|
-
next = addDays(r.previewEnd, -1); // never less than one
|
|
5394
|
+
next = addDays(r.previewEnd, -1); // never less than one day
|
|
5262
5395
|
}
|
|
5263
5396
|
this.resize.set({ ...r, previewStart: next });
|
|
5264
5397
|
}
|
|
@@ -5282,46 +5415,19 @@ class OccupancyGridComponent {
|
|
|
5282
5415
|
if (!r || !commit) {
|
|
5283
5416
|
return;
|
|
5284
5417
|
}
|
|
5285
|
-
if (r.previewStart === r.bar.startDate && r.previewEnd === r.bar
|
|
5286
|
-
return;
|
|
5287
|
-
}
|
|
5288
|
-
if (this.rejectIfOverbooked(r.room, r.bar.bookingId, r.previewStart, r.previewEnd)) {
|
|
5418
|
+
if (r.previewStart === r.bar.startDate && r.previewEnd === endOf(r.bar)) {
|
|
5289
5419
|
return;
|
|
5290
5420
|
}
|
|
5291
5421
|
this.barResize.emit({
|
|
5292
5422
|
bar: r.bar,
|
|
5293
|
-
|
|
5423
|
+
lane: r.lane,
|
|
5294
5424
|
edge: r.edge,
|
|
5295
5425
|
previousStartDate: r.bar.startDate,
|
|
5296
5426
|
previousEndDate: r.bar.endDate,
|
|
5297
5427
|
proposedStartDate: r.previewStart,
|
|
5298
|
-
proposedEndDate: r.previewEnd,
|
|
5428
|
+
proposedEndDate: publicEnd(r.previewEnd),
|
|
5299
5429
|
});
|
|
5300
5430
|
}
|
|
5301
|
-
/**
|
|
5302
|
-
* With `preventOverbooking`, a gesture that would put more stays in a room
|
|
5303
|
-
* than it has beds is dropped here, so the bar simply stays where it was,
|
|
5304
|
-
* with a snackbar saying why.
|
|
5305
|
-
*/
|
|
5306
|
-
rejectIfOverbooked(room, bookingId, start, end) {
|
|
5307
|
-
if (!this.preventOverbooking() ||
|
|
5308
|
-
!overbooksRoom(room, bookingId, start, end)) {
|
|
5309
|
-
return false;
|
|
5310
|
-
}
|
|
5311
|
-
this.snackBar.openFromComponent(CustomSnackbarComponent, {
|
|
5312
|
-
horizontalPosition: 'end',
|
|
5313
|
-
verticalPosition: 'top',
|
|
5314
|
-
panelClass: ['custom-snackbar-container'],
|
|
5315
|
-
data: {
|
|
5316
|
-
message: this.translate.instant('occupancyGrid.overbooked', {
|
|
5317
|
-
room: room.number,
|
|
5318
|
-
}),
|
|
5319
|
-
type: SnackbarType.WARNING,
|
|
5320
|
-
duration: 3000,
|
|
5321
|
-
},
|
|
5322
|
-
});
|
|
5323
|
-
return true;
|
|
5324
|
-
}
|
|
5325
5431
|
removeDragListeners() {
|
|
5326
5432
|
if (this.dragMoveListener) {
|
|
5327
5433
|
window.removeEventListener('mousemove', this.dragMoveListener);
|
|
@@ -5338,14 +5444,12 @@ class OccupancyGridComponent {
|
|
|
5338
5444
|
}
|
|
5339
5445
|
// ───────────────────────────────────────────────────────── move the bar
|
|
5340
5446
|
/**
|
|
5341
|
-
* Mousedown on a bar's
|
|
5342
|
-
* propagation
|
|
5343
|
-
*
|
|
5344
|
-
*
|
|
5345
|
-
* threshold. That is what lets a plain click still fall through to
|
|
5346
|
-
* `onBarClick` unchanged.
|
|
5447
|
+
* Mousedown on a bar's body (never the edge handles — those stop
|
|
5448
|
+
* propagation first) arms a possible whole-bar move, but nothing changes
|
|
5449
|
+
* until `onBarDragMove` sees the pointer clear a small threshold, so a plain
|
|
5450
|
+
* click still reaches `onBarClick`.
|
|
5347
5451
|
*/
|
|
5348
|
-
startBarMove(event,
|
|
5452
|
+
startBarMove(event, lane, bar) {
|
|
5349
5453
|
if (event.button !== 0) {
|
|
5350
5454
|
return;
|
|
5351
5455
|
}
|
|
@@ -5353,14 +5457,14 @@ class OccupancyGridComponent {
|
|
|
5353
5457
|
event.stopPropagation();
|
|
5354
5458
|
this.move.set({
|
|
5355
5459
|
bar,
|
|
5356
|
-
|
|
5460
|
+
fromLane: lane,
|
|
5357
5461
|
startClientX: event.clientX,
|
|
5358
5462
|
startClientY: event.clientY,
|
|
5359
5463
|
originalStartDate: bar.startDate,
|
|
5360
|
-
originalEndDate: bar
|
|
5464
|
+
originalEndDate: endOf(bar),
|
|
5361
5465
|
previewStartDate: bar.startDate,
|
|
5362
|
-
previewEndDate: bar
|
|
5363
|
-
|
|
5466
|
+
previewEndDate: endOf(bar),
|
|
5467
|
+
targetLane: lane,
|
|
5364
5468
|
dragging: false,
|
|
5365
5469
|
});
|
|
5366
5470
|
this.moveMoveListener = e => this.onBarDragMove(e);
|
|
@@ -5388,15 +5492,14 @@ class OccupancyGridComponent {
|
|
|
5388
5492
|
}
|
|
5389
5493
|
const dayDelta = Math.round(dx / this.dayWidth());
|
|
5390
5494
|
const previewStartDate = addDays(m.originalStartDate, dayDelta);
|
|
5391
|
-
const previewEndDate =
|
|
5392
|
-
|
|
5495
|
+
const previewEndDate = m.originalEndDate === OPEN_END
|
|
5496
|
+
? OPEN_END
|
|
5497
|
+
: addDays(m.originalEndDate, dayDelta);
|
|
5498
|
+
const targetLane = this.laneUnderPoint(event.clientX, event.clientY) ?? m.targetLane;
|
|
5393
5499
|
if (this.preventOverlap() &&
|
|
5394
|
-
|
|
5395
|
-
//
|
|
5396
|
-
//
|
|
5397
|
-
// stays at the last placement that did not overlap (the bar's
|
|
5398
|
-
// original spot, the first time a move ever conflicts) instead of
|
|
5399
|
-
// jumping onto an invalid one and back.
|
|
5500
|
+
overlapsLane(targetLane, m.bar.id, previewStartDate, previewEndDate)) {
|
|
5501
|
+
// Reject just this candidate, not the whole drag: the ghost stays at
|
|
5502
|
+
// the last placement that did not overlap.
|
|
5400
5503
|
this.move.set({ ...m, dragging: true });
|
|
5401
5504
|
return;
|
|
5402
5505
|
}
|
|
@@ -5405,7 +5508,7 @@ class OccupancyGridComponent {
|
|
|
5405
5508
|
dragging: true,
|
|
5406
5509
|
previewStartDate,
|
|
5407
5510
|
previewEndDate,
|
|
5408
|
-
|
|
5511
|
+
targetLane,
|
|
5409
5512
|
});
|
|
5410
5513
|
}
|
|
5411
5514
|
/** Mouseup (commit) or Escape (cancel). Emits `barMove` only on commit with an actual change. */
|
|
@@ -5424,20 +5527,17 @@ class OccupancyGridComponent {
|
|
|
5424
5527
|
}
|
|
5425
5528
|
if (m.previewStartDate === m.originalStartDate &&
|
|
5426
5529
|
m.previewEndDate === m.originalEndDate &&
|
|
5427
|
-
m.
|
|
5428
|
-
return;
|
|
5429
|
-
}
|
|
5430
|
-
if (this.rejectIfOverbooked(m.targetRoom, m.bar.bookingId, m.previewStartDate, m.previewEndDate)) {
|
|
5530
|
+
m.targetLane.id === m.fromLane.id) {
|
|
5431
5531
|
return;
|
|
5432
5532
|
}
|
|
5433
5533
|
this.barMove.emit({
|
|
5434
5534
|
bar: m.bar,
|
|
5435
|
-
|
|
5436
|
-
|
|
5535
|
+
fromLane: m.fromLane,
|
|
5536
|
+
toLane: m.targetLane,
|
|
5437
5537
|
previousStartDate: m.originalStartDate,
|
|
5438
|
-
previousEndDate: m.originalEndDate,
|
|
5538
|
+
previousEndDate: publicEnd(m.originalEndDate),
|
|
5439
5539
|
proposedStartDate: m.previewStartDate,
|
|
5440
|
-
proposedEndDate: m.previewEndDate,
|
|
5540
|
+
proposedEndDate: publicEnd(m.previewEndDate),
|
|
5441
5541
|
});
|
|
5442
5542
|
}
|
|
5443
5543
|
removeMoveListeners() {
|
|
@@ -5456,22 +5556,21 @@ class OccupancyGridComponent {
|
|
|
5456
5556
|
}
|
|
5457
5557
|
// ─────────────────────────────────────────────── create over empty cells
|
|
5458
5558
|
/**
|
|
5459
|
-
* Mousedown on a lane's empty background arms a possible drag-to-create,
|
|
5460
|
-
*
|
|
5461
|
-
*
|
|
5462
|
-
* `endCreate` only emits once `dragging` has flipped true.
|
|
5559
|
+
* Mousedown on a lane's empty background arms a possible drag-to-create, on
|
|
5560
|
+
* the same click-vs-drag threshold as `startBarMove` — a plain click still
|
|
5561
|
+
* falls through to `onLaneClick`'s `cellClick`.
|
|
5463
5562
|
*/
|
|
5464
|
-
startCreate(event,
|
|
5563
|
+
startCreate(event, lane, slot = 0) {
|
|
5465
5564
|
if (event.button !== 0) {
|
|
5466
5565
|
return;
|
|
5467
5566
|
}
|
|
5468
5567
|
const startDate = this.clientXToDate(event.clientX);
|
|
5469
|
-
if (overlapsClosure(
|
|
5568
|
+
if (overlapsClosure(lane, startDate, addDays(startDate, 1))) {
|
|
5470
5569
|
return;
|
|
5471
5570
|
}
|
|
5472
5571
|
this.create.set({
|
|
5473
|
-
room,
|
|
5474
5572
|
lane,
|
|
5573
|
+
slot,
|
|
5475
5574
|
startDate,
|
|
5476
5575
|
startClientX: event.clientX,
|
|
5477
5576
|
previewStart: startDate,
|
|
@@ -5499,24 +5598,27 @@ class OccupancyGridComponent {
|
|
|
5499
5598
|
if (!c.dragging && Math.abs(dx) < MOVE_DRAG_THRESHOLD_PX) {
|
|
5500
5599
|
return;
|
|
5501
5600
|
}
|
|
5502
|
-
const date = clampToClosures(c.
|
|
5601
|
+
const date = clampToClosures(c.lane, c.startDate, this.clientXToDate(event.clientX));
|
|
5503
5602
|
let start = c.startDate;
|
|
5504
5603
|
let end = date;
|
|
5505
5604
|
if (end < start) {
|
|
5506
|
-
// Dragged backwards from the anchor: the anchor becomes the
|
|
5605
|
+
// Dragged backwards from the anchor: the anchor becomes the end.
|
|
5507
5606
|
start = date;
|
|
5508
5607
|
end = c.startDate;
|
|
5509
5608
|
}
|
|
5510
5609
|
if (end <= start) {
|
|
5511
|
-
end = addDays(start, 1); // never less than one
|
|
5610
|
+
end = addDays(start, 1); // never less than one day
|
|
5512
5611
|
}
|
|
5513
|
-
if (this.preventOverlap() &&
|
|
5514
|
-
// Reject just this update, same as a whole-bar move's overlap check —
|
|
5515
|
-
// the preview stays at the last span that did not overlap.
|
|
5612
|
+
if (this.preventOverlap() && overlapsLane(c.lane, '', start, end)) {
|
|
5516
5613
|
this.create.set({ ...c, dragging: true });
|
|
5517
5614
|
return;
|
|
5518
5615
|
}
|
|
5519
|
-
this.create.set({
|
|
5616
|
+
this.create.set({
|
|
5617
|
+
...c,
|
|
5618
|
+
dragging: true,
|
|
5619
|
+
previewStart: start,
|
|
5620
|
+
previewEnd: end,
|
|
5621
|
+
});
|
|
5520
5622
|
}
|
|
5521
5623
|
/** Mouseup (commit) or Escape (cancel), for both the mouse and keyboard paths. Emits `barCreate` only once a drag actually cleared the threshold (or a keyboard create was started) and is committed. */
|
|
5522
5624
|
endCreate(commit) {
|
|
@@ -5530,21 +5632,17 @@ class OccupancyGridComponent {
|
|
|
5530
5632
|
this.armSuppressNextClick();
|
|
5531
5633
|
}
|
|
5532
5634
|
if (c.viaKeyboard) {
|
|
5533
|
-
// Keep the cell focused where the gesture left off
|
|
5534
|
-
// user's position on the grid does not just disappear.
|
|
5635
|
+
// Keep the cell focused where the gesture left off.
|
|
5535
5636
|
this.laneFocus.set({
|
|
5536
|
-
|
|
5637
|
+
laneId: c.lane.id,
|
|
5537
5638
|
date: commit ? c.previewStart : c.startDate,
|
|
5538
5639
|
});
|
|
5539
5640
|
}
|
|
5540
5641
|
if (!c.dragging || !commit) {
|
|
5541
5642
|
return;
|
|
5542
5643
|
}
|
|
5543
|
-
if (this.rejectIfOverbooked(c.room, '', c.previewStart, c.previewEnd)) {
|
|
5544
|
-
return;
|
|
5545
|
-
}
|
|
5546
5644
|
this.barCreate.emit({
|
|
5547
|
-
|
|
5645
|
+
lane: c.lane,
|
|
5548
5646
|
proposedStartDate: c.previewStart,
|
|
5549
5647
|
proposedEndDate: c.previewEnd,
|
|
5550
5648
|
});
|
|
@@ -5564,37 +5662,32 @@ class OccupancyGridComponent {
|
|
|
5564
5662
|
this.createKeyListener = null;
|
|
5565
5663
|
}
|
|
5566
5664
|
/**
|
|
5567
|
-
* Focus lands on an empty lane
|
|
5568
|
-
*
|
|
5569
|
-
*
|
|
5570
|
-
* create is in progress on this lane, so refocusing mid-gesture cannot
|
|
5571
|
-
* reset it.
|
|
5665
|
+
* Focus lands on an empty lane — arm a keyboard cursor at today (or the
|
|
5666
|
+
* window's first day) unless this lane already has one. Left alone while a
|
|
5667
|
+
* keyboard create is in progress, so refocusing mid-gesture cannot reset it.
|
|
5572
5668
|
*/
|
|
5573
|
-
onLaneFocus(
|
|
5669
|
+
onLaneFocus(lane) {
|
|
5574
5670
|
if (this.create()?.viaKeyboard) {
|
|
5575
5671
|
return;
|
|
5576
5672
|
}
|
|
5577
5673
|
const existing = this.laneFocus();
|
|
5578
|
-
const date = existing && existing.
|
|
5674
|
+
const date = existing && existing.laneId === lane.id
|
|
5579
5675
|
? existing.date
|
|
5580
5676
|
: this.defaultCursorDate();
|
|
5581
|
-
this.laneFocus.set({
|
|
5677
|
+
this.laneFocus.set({ laneId: lane.id, date });
|
|
5582
5678
|
}
|
|
5583
5679
|
/**
|
|
5584
5680
|
* The pointer moved over a lane's empty background — update the hover
|
|
5585
|
-
* cursor to the date under it. Ignored while a
|
|
5586
|
-
*
|
|
5587
|
-
* and when the event bubbled up from a bar or closure rather than
|
|
5588
|
-
* landing on the background itself, so hovering an existing booking does
|
|
5589
|
-
* not also outline the empty-cell cursor underneath it.
|
|
5681
|
+
* cursor to the date under it. Ignored while a gesture is live, and when
|
|
5682
|
+
* the event bubbled up from a bar or closure rather than the background.
|
|
5590
5683
|
*/
|
|
5591
|
-
onLaneMouseMove(event,
|
|
5684
|
+
onLaneMouseMove(event, lane, slot = 0) {
|
|
5592
5685
|
if (this.create() || this.resize() || this.move()?.dragging) {
|
|
5593
5686
|
this.laneHover.set(null);
|
|
5594
5687
|
return;
|
|
5595
5688
|
}
|
|
5596
5689
|
if (event.target !== event.currentTarget) {
|
|
5597
|
-
// The free
|
|
5690
|
+
// The free slot handles its own moves; its bubbled event is not a bar.
|
|
5598
5691
|
if (!event.target.classList.contains('occ__lane-free')) {
|
|
5599
5692
|
this.laneHover.set(null);
|
|
5600
5693
|
this.pointerOnBar.set(true);
|
|
@@ -5605,12 +5698,12 @@ class OccupancyGridComponent {
|
|
|
5605
5698
|
const date = this.clientXToDate(event.clientX);
|
|
5606
5699
|
const cur = this.laneHover();
|
|
5607
5700
|
if (cur &&
|
|
5608
|
-
cur.
|
|
5701
|
+
cur.laneId === lane.id &&
|
|
5609
5702
|
cur.date === date &&
|
|
5610
|
-
cur.
|
|
5703
|
+
cur.slot === slot) {
|
|
5611
5704
|
return;
|
|
5612
5705
|
}
|
|
5613
|
-
this.laneHover.set({
|
|
5706
|
+
this.laneHover.set({ laneId: lane.id, date, slot });
|
|
5614
5707
|
}
|
|
5615
5708
|
onCanvasMouseMove(event) {
|
|
5616
5709
|
const el = this.scroller().nativeElement;
|
|
@@ -5624,10 +5717,10 @@ class OccupancyGridComponent {
|
|
|
5624
5717
|
this.hoverDay.set(next);
|
|
5625
5718
|
}
|
|
5626
5719
|
}
|
|
5627
|
-
onLaneMouseLeave(
|
|
5720
|
+
onLaneMouseLeave(lane) {
|
|
5628
5721
|
this.pointerOnBar.set(false);
|
|
5629
5722
|
const cur = this.laneHover();
|
|
5630
|
-
if (cur && cur.
|
|
5723
|
+
if (cur && cur.laneId === lane.id) {
|
|
5631
5724
|
this.laneHover.set(null);
|
|
5632
5725
|
}
|
|
5633
5726
|
}
|
|
@@ -5647,14 +5740,12 @@ class OccupancyGridComponent {
|
|
|
5647
5740
|
/**
|
|
5648
5741
|
* Keyboard path for drag-to-create: with no create in progress, plain
|
|
5649
5742
|
* ArrowLeft/ArrowRight move the focused cell one day and Enter/Space marks
|
|
5650
|
-
* it as the start
|
|
5651
|
-
*
|
|
5652
|
-
* `onBarKeydownResize`'s departure-only convention) and a second Enter
|
|
5653
|
-
* commits, Escape cancels.
|
|
5743
|
+
* it as the start; once that create is live, the same arrow keys move the
|
|
5744
|
+
* end date, a second Enter commits and Escape cancels.
|
|
5654
5745
|
*/
|
|
5655
|
-
onLaneKeydown(event,
|
|
5746
|
+
onLaneKeydown(event, lane) {
|
|
5656
5747
|
const c = this.create();
|
|
5657
|
-
if (c && c.viaKeyboard && c.
|
|
5748
|
+
if (c && c.viaKeyboard && c.lane.id === lane.id) {
|
|
5658
5749
|
if (event.key === 'Escape') {
|
|
5659
5750
|
event.preventDefault();
|
|
5660
5751
|
this.endCreate(false);
|
|
@@ -5670,8 +5761,9 @@ class OccupancyGridComponent {
|
|
|
5670
5761
|
if (next <= c.previewStart) {
|
|
5671
5762
|
next = addDays(c.previewStart, 1);
|
|
5672
5763
|
}
|
|
5673
|
-
if (overlapsClosure(
|
|
5674
|
-
(this.preventOverlap() &&
|
|
5764
|
+
if (overlapsClosure(lane, c.previewStart, next) ||
|
|
5765
|
+
(this.preventOverlap() &&
|
|
5766
|
+
overlapsLane(lane, '', c.previewStart, next))) {
|
|
5675
5767
|
return;
|
|
5676
5768
|
}
|
|
5677
5769
|
this.create.set({ ...c, previewEnd: next });
|
|
@@ -5679,7 +5771,7 @@ class OccupancyGridComponent {
|
|
|
5679
5771
|
return;
|
|
5680
5772
|
}
|
|
5681
5773
|
const cur = this.laneFocus();
|
|
5682
|
-
if (!cur || cur.
|
|
5774
|
+
if (!cur || cur.laneId !== lane.id) {
|
|
5683
5775
|
return;
|
|
5684
5776
|
}
|
|
5685
5777
|
if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
|
|
@@ -5692,16 +5784,16 @@ class OccupancyGridComponent {
|
|
|
5692
5784
|
else if (next >= this.to()) {
|
|
5693
5785
|
next = addDays(this.to(), -1);
|
|
5694
5786
|
}
|
|
5695
|
-
this.laneFocus.set({
|
|
5787
|
+
this.laneFocus.set({ laneId: lane.id, date: next });
|
|
5696
5788
|
}
|
|
5697
5789
|
else if (event.key === 'Enter' || event.key === ' ') {
|
|
5698
5790
|
event.preventDefault();
|
|
5699
|
-
if (overlapsClosure(
|
|
5791
|
+
if (overlapsClosure(lane, cur.date, addDays(cur.date, 1))) {
|
|
5700
5792
|
return;
|
|
5701
5793
|
}
|
|
5702
5794
|
this.create.set({
|
|
5703
|
-
|
|
5704
|
-
|
|
5795
|
+
lane,
|
|
5796
|
+
slot: this.createSlot(lane),
|
|
5705
5797
|
startDate: cur.date,
|
|
5706
5798
|
startClientX: 0,
|
|
5707
5799
|
previewStart: cur.date,
|
|
@@ -5711,12 +5803,64 @@ class OccupancyGridComponent {
|
|
|
5711
5803
|
});
|
|
5712
5804
|
}
|
|
5713
5805
|
}
|
|
5714
|
-
|
|
5715
|
-
|
|
5806
|
+
// ─────────────────────────────────────────── drop from outside the grid
|
|
5807
|
+
canDropOn(lane) {
|
|
5808
|
+
const payload = this.dragPayload();
|
|
5809
|
+
if (payload === null) {
|
|
5810
|
+
return false;
|
|
5811
|
+
}
|
|
5812
|
+
const can = this.canDrop();
|
|
5813
|
+
return !can || can(lane, payload);
|
|
5814
|
+
}
|
|
5815
|
+
isDropDisabled(lane) {
|
|
5816
|
+
return this.dragPayload() !== null && !this.canDropOn(lane);
|
|
5817
|
+
}
|
|
5818
|
+
/** Accepting the dragover (preventDefault) is what lets the browser drop here at all. */
|
|
5819
|
+
onLaneDragOver(event, lane) {
|
|
5820
|
+
if (!this.canDropOn(lane)) {
|
|
5821
|
+
return;
|
|
5822
|
+
}
|
|
5823
|
+
event.preventDefault();
|
|
5824
|
+
const date = this.clientXToDate(event.clientX);
|
|
5825
|
+
const cur = this.laneHover();
|
|
5826
|
+
if (this.dropTarget() !== lane.id) {
|
|
5827
|
+
this.dropTarget.set(lane.id);
|
|
5828
|
+
}
|
|
5829
|
+
if (!cur || cur.laneId !== lane.id || cur.date !== date) {
|
|
5830
|
+
this.laneHover.set({
|
|
5831
|
+
laneId: lane.id,
|
|
5832
|
+
date,
|
|
5833
|
+
slot: this.createSlot(lane),
|
|
5834
|
+
});
|
|
5835
|
+
}
|
|
5836
|
+
}
|
|
5837
|
+
onLaneDragLeave(event, lane) {
|
|
5838
|
+
const into = event.relatedTarget;
|
|
5839
|
+
if (into && event.currentTarget.contains(into)) {
|
|
5840
|
+
return;
|
|
5841
|
+
}
|
|
5842
|
+
if (this.dropTarget() === lane.id) {
|
|
5843
|
+
this.dropTarget.set(null);
|
|
5844
|
+
this.laneHover.set(null);
|
|
5845
|
+
}
|
|
5846
|
+
}
|
|
5847
|
+
onLaneDrop(event, lane) {
|
|
5848
|
+
if (!this.canDropOn(lane)) {
|
|
5849
|
+
return;
|
|
5850
|
+
}
|
|
5851
|
+
event.preventDefault();
|
|
5852
|
+
const date = this.clientXToDate(event.clientX);
|
|
5853
|
+
const payload = this.dragPayload();
|
|
5854
|
+
this.dropTarget.set(null);
|
|
5855
|
+
this.laneHover.set(null);
|
|
5856
|
+
this.laneDrop.emit({ lane, date, payload });
|
|
5857
|
+
}
|
|
5858
|
+
/** Whatever lane row (if any) is actually rendered under this point — see `.occ__row--room`'s `data-lane-id`. */
|
|
5859
|
+
laneUnderPoint(clientX, clientY) {
|
|
5716
5860
|
const el = document.elementFromPoint(clientX, clientY);
|
|
5717
5861
|
const rowEl = el?.closest('.occ__row--room');
|
|
5718
|
-
const
|
|
5719
|
-
return
|
|
5862
|
+
const laneId = rowEl?.dataset['laneId'];
|
|
5863
|
+
return laneId ? (this.lanesById().get(laneId) ?? null) : null;
|
|
5720
5864
|
}
|
|
5721
5865
|
armSuppressNextClick() {
|
|
5722
5866
|
this.suppressNextClick = true;
|
|
@@ -5746,22 +5890,21 @@ class OccupancyGridComponent {
|
|
|
5746
5890
|
return dateAtOffset(x, this.from(), this.dayWidth());
|
|
5747
5891
|
}
|
|
5748
5892
|
/**
|
|
5749
|
-
* The keyboard equivalent of dragging the
|
|
5750
|
-
* extends by a
|
|
5751
|
-
*
|
|
5752
|
-
* drag has). Scoped to the departure edge only — the more common "extend a
|
|
5753
|
-
* stay" gesture — so one binding covers the primary case without a second
|
|
5754
|
-
* modifier combination to document; the arrival edge is still reachable by
|
|
5755
|
-
* dragging its handle with a mouse.
|
|
5893
|
+
* The keyboard equivalent of dragging the end edge: Shift+ArrowRight
|
|
5894
|
+
* extends by a day, Shift+ArrowLeft shortens by one, each press committing
|
|
5895
|
+
* immediately. End edge only; an open-ended bar has none to move.
|
|
5756
5896
|
*/
|
|
5757
|
-
onBarKeydownResize(event,
|
|
5897
|
+
onBarKeydownResize(event, lane, bar, laneBars) {
|
|
5758
5898
|
if (!event.shiftKey ||
|
|
5759
5899
|
(event.key !== 'ArrowRight' && event.key !== 'ArrowLeft')) {
|
|
5760
5900
|
return;
|
|
5761
5901
|
}
|
|
5762
5902
|
event.preventDefault();
|
|
5763
5903
|
event.stopPropagation();
|
|
5764
|
-
|
|
5904
|
+
if (bar.endDate === null) {
|
|
5905
|
+
return;
|
|
5906
|
+
}
|
|
5907
|
+
const bound = neighborBound(laneBars, bar.id, 'end', this.preventOverlap());
|
|
5765
5908
|
let next = addDays(bar.endDate, event.key === 'ArrowRight' ? 1 : -1);
|
|
5766
5909
|
if (bound && next > bound) {
|
|
5767
5910
|
next = bound;
|
|
@@ -5772,12 +5915,9 @@ class OccupancyGridComponent {
|
|
|
5772
5915
|
if (next === bar.endDate) {
|
|
5773
5916
|
return;
|
|
5774
5917
|
}
|
|
5775
|
-
if (this.rejectIfOverbooked(room, bar.bookingId, bar.startDate, next)) {
|
|
5776
|
-
return;
|
|
5777
|
-
}
|
|
5778
5918
|
this.barResize.emit({
|
|
5779
5919
|
bar,
|
|
5780
|
-
|
|
5920
|
+
lane,
|
|
5781
5921
|
edge: 'end',
|
|
5782
5922
|
previousStartDate: bar.startDate,
|
|
5783
5923
|
previousEndDate: bar.endDate,
|
|
@@ -5785,13 +5925,256 @@ class OccupancyGridComponent {
|
|
|
5785
5925
|
proposedEndDate: next,
|
|
5786
5926
|
});
|
|
5787
5927
|
}
|
|
5788
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type:
|
|
5789
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.19", type: OccupancyGridComponent, isStandalone: true, selector: "ud-occupancy-grid", inputs: { rooms: { classPropertyName: "rooms", publicName: "rooms", isSignal: true, isRequired: false, transformFunction: null }, dormName: { classPropertyName: "dormName", publicName: "dormName", isSignal: true, isRequired: false, transformFunction: null }, from: { classPropertyName: "from", publicName: "from", isSignal: true, isRequired: true, transformFunction: null }, to: { classPropertyName: "to", publicName: "to", isSignal: true, isRequired: true, transformFunction: null }, today: { classPropertyName: "today", publicName: "today", isSignal: true, isRequired: false, transformFunction: null }, dayWidth: { classPropertyName: "dayWidth", publicName: "dayWidth", isSignal: true, isRequired: false, transformFunction: null }, leftColumnWidth: { classPropertyName: "leftColumnWidth", publicName: "leftColumnWidth", isSignal: true, isRequired: false, transformFunction: null }, laneHeight: { classPropertyName: "laneHeight", publicName: "laneHeight", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, navStepDays: { classPropertyName: "navStepDays", publicName: "navStepDays", isSignal: true, isRequired: false, transformFunction: null }, preventOverlap: { classPropertyName: "preventOverlap", publicName: "preventOverlap", isSignal: true, isRequired: false, transformFunction: null }, preventOverbooking: { classPropertyName: "preventOverbooking", publicName: "preventOverbooking", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { barClick: "barClick", closureClick: "closureClick", roomClick: "roomClick", cellClick: "cellClick", reachedEnd: "reachedEnd", windowShift: "windowShift", barResize: "barResize", barMove: "barMove", barCreate: "barCreate" }, viewQueries: [{ propertyName: "scroller", first: true, predicate: ["scroller"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n class=\"occ\"\n [class.is-loading]=\"loading()\"\n [class.is-dragging-active]=\"\n resize() !== null || move()?.dragging || create()?.dragging\n \"\n [style.--dw]=\"dayWidth() + 'px'\"\n (keydown)=\"onGridKeydown($event)\">\n <div #scroller class=\"occ__scroller\" (scroll)=\"onScroll()\">\n <div\n class=\"occ__canvas\"\n [style.width.px]=\"canvasWidth()\"\n [style.height.px]=\"bodyHeight() + headerHeight\"\n (mousemove)=\"onCanvasMouseMove($event)\"\n (mouseleave)=\"hoverDay.set(null)\">\n <!-- Sticky two-tier header -->\n <div class=\"occ__header\" [style.height.px]=\"headerHeight\">\n <div class=\"occ__corner\" [style.width.px]=\"leftColumnWidth()\">\n <span class=\"occ__eyebrow\">{{\n 'occupancyGrid.rooms' | translate\n }}</span>\n <div class=\"occ__nav\">\n <button\n type=\"button\"\n class=\"occ__nav-btn\"\n [attr.aria-label]=\"'occupancyGrid.nav.prev' | translate\"\n [udTooltip]=\"'occupancyGrid.nav.prev' | translate\"\n (click)=\"shiftWindow(-1)\">\n \u2039\n </button>\n <button\n type=\"button\"\n class=\"occ__nav-btn\"\n [attr.aria-label]=\"'occupancyGrid.nav.next' | translate\"\n [udTooltip]=\"'occupancyGrid.nav.next' | translate\"\n (click)=\"shiftWindow(1)\">\n \u203A\n </button>\n </div>\n </div>\n <div class=\"occ__months\" [style.left.px]=\"leftColumnWidth()\">\n @for (m of months(); track m.label) {\n <div\n class=\"occ__month\"\n [style.left.px]=\"m.left\"\n [style.width.px]=\"m.width\">\n {{ m.label }}\n </div>\n }\n </div>\n <div class=\"occ__days\" [style.left.px]=\"leftColumnWidth()\">\n @for (d of days(); track d.iso) {\n <div\n class=\"occ__day\"\n [class.is-weekend]=\"d.isWeekend\"\n [class.is-today]=\"d.iso === today()\"\n [class.is-hovered]=\"$index === hoverDay()\"\n [style.left.px]=\"d.left\"\n [style.width.px]=\"dayWidth()\">\n <span class=\"occ__day-num\">{{ d.dayOfMonth }}</span>\n <span class=\"occ__day-wd\">{{\n 'occupancyGrid.weekdays.' + d.weekday | translate\n }}</span>\n </div>\n }\n </div>\n </div>\n\n <!-- Today column, behind rows -->\n @if (todayLeft() !== null) {\n <div\n class=\"occ__today\"\n [style.left.px]=\"leftColumnWidth() + todayLeft()!\"\n [style.top.px]=\"headerHeight\"\n [style.width.px]=\"dayWidth()\"\n [style.height.px]=\"bodyHeight()\"></div>\n }\n\n <!-- Virtualized rows -->\n @for (p of visible(); track trackRow($index, p)) {\n @if (p.row.kind === 'group') {\n <div\n class=\"occ__row occ__row--group\"\n [attr.data-depth]=\"p.row.depth\"\n [style.top.px]=\"headerHeight + p.top\"\n [style.height.px]=\"p.height\"\n role=\"button\"\n tabindex=\"0\"\n (click)=\"toggleGroup(p.row.key)\"\n (keydown.enter)=\"toggleGroup(p.row.key)\">\n <div\n class=\"occ__cell occ__cell--sticky\"\n [style.width.px]=\"leftColumnWidth()\">\n <span\n class=\"occ__chevron\"\n [class.is-collapsed]=\"isCollapsed(p.row.key)\"\n >\u25BE</span\n >\n <span class=\"occ__eyebrow\">{{ p.row.label }}</span>\n <span class=\"occ__count\">{{ p.row.roomCount }}</span>\n </div>\n <div\n class=\"occ__lane-bg\"\n [style.left.px]=\"leftColumnWidth()\"\n [style.width.px]=\"dayCount() * dayWidth()\"\n [style.--weekend-offset]=\"weekendOffsetPx() + 'px'\"></div>\n @if (hoverDay() !== null) {\n <div\n class=\"occ__col-hover\"\n aria-hidden=\"true\"\n [style.left.px]=\"leftColumnWidth() + hoverDay()! * dayWidth()\"\n [style.width.px]=\"dayWidth()\"></div>\n }\n </div>\n } @else {\n <div\n class=\"occ__row occ__row--room\"\n [class.is-inactive]=\"!asRoomRow(p.row).room.active\"\n [class.is-move-target]=\"isMoveTarget(asRoomRow(p.row).room.roomId)\"\n [attr.data-room-id]=\"asRoomRow(p.row).room.roomId\"\n [style.top.px]=\"headerHeight + p.top\"\n [style.height.px]=\"p.height\">\n <div\n class=\"occ__cell occ__cell--sticky occ__room\"\n [style.width.px]=\"leftColumnWidth()\"\n role=\"button\"\n tabindex=\"0\"\n (click)=\"roomClick.emit(asRoomRow(p.row).room)\"\n (keydown.enter)=\"roomClick.emit(asRoomRow(p.row).room)\">\n <span class=\"occ__room-number\">{{\n asRoomRow(p.row).room.number\n }}</span>\n <span class=\"occ__room-type\">{{\n asRoomRow(p.row).room.type\n }}</span>\n @if (takenOn(asRoomRow(p.row).room) !== null) {\n <span\n class=\"occ__room-occ\"\n [udTooltip]=\"\n 'occupancyGrid.takenOn' | translate: { date: from() }\n \"\n [class.is-full]=\"\n takenOn(asRoomRow(p.row).room)! >=\n asRoomRow(p.row).room.capacity\n \">\n {{ takenOn(asRoomRow(p.row).room) }}/{{\n asRoomRow(p.row).room.capacity\n }}\n </span>\n }\n </div>\n <div\n class=\"occ__lane-bg\"\n tabindex=\"0\"\n [attr.aria-label]=\"\n 'occupancyGrid.createCell'\n | translate: { room: asRoomRow(p.row).room.number }\n \"\n [style.left.px]=\"leftColumnWidth()\"\n [style.width.px]=\"dayCount() * dayWidth()\"\n [style.--weekend-offset]=\"weekendOffsetPx() + 'px'\"\n (mousedown)=\"startCreate($event, asRoomRow(p.row).room)\"\n (click)=\"onLaneClick($event, asRoomRow(p.row).room)\"\n (mousemove)=\"onLaneMouseMove($event, asRoomRow(p.row).room)\"\n (mouseleave)=\"onLaneMouseLeave(asRoomRow(p.row).room)\"\n (focus)=\"onLaneFocus(asRoomRow(p.row).room)\"\n (blur)=\"onLaneBlur()\"\n (keydown)=\"onLaneKeydown($event, asRoomRow(p.row).room)\">\n @for (c of asRoomRow(p.row).room.closures; track c.closureId) {\n @if (closureGeometryOf(c); as g) {\n <div\n class=\"occ__closure\"\n [class.is-cut-left]=\"g.cutLeft\"\n [class.is-cut-right]=\"g.cutRight\"\n [style.left.px]=\"g.left\"\n [style.width.px]=\"g.width\"\n [udTooltip]=\"closureTitle(c)\"\n role=\"button\"\n tabindex=\"0\"\n (mousedown)=\"$event.stopPropagation()\"\n (click)=\"\n $event.stopPropagation();\n closureClick.emit({\n closure: c,\n room: asRoomRow(p.row).room,\n })\n \"\n (keydown.enter)=\"\n closureClick.emit({\n closure: c,\n room: asRoomRow(p.row).room,\n })\n \">\n <span class=\"occ__closure-label\">{{ c.reason }}</span>\n </div>\n }\n }\n @if (asRoomRow(p.row).freeLane !== null) {\n <div\n class=\"occ__lane-free\"\n [style.top.px]=\"\n 4 + asRoomRow(p.row).freeLane! * (laneHeight() + 4)\n \"\n [style.height.px]=\"laneHeight()\"\n (mousedown)=\"\n $event.stopPropagation();\n startCreate(\n $event,\n asRoomRow(p.row).room,\n asRoomRow(p.row).freeLane!\n )\n \"\n (mousemove)=\"\n onLaneMouseMove(\n $event,\n asRoomRow(p.row).room,\n asRoomRow(p.row).freeLane!\n )\n \"></div>\n }\n @for (lb of asRoomRow(p.row).bars; track lb.bar.bookingId) {\n @if (geometryOf(lb.bar); as g) {\n <div\n class=\"occ__bar\"\n [attr.data-state]=\"lb.bar.state\"\n [class.is-cut-left]=\"g.cutLeft\"\n [class.is-cut-right]=\"g.cutRight\"\n [class.is-resizing]=\"isResizing(lb.bar.bookingId)\"\n [class.is-moving]=\"isBeingMoved(lb.bar.bookingId)\"\n [style.left.px]=\"g.left + 1\"\n [style.width.px]=\"g.width - 2\"\n [style.top.px]=\"4 + lb.lane * (laneHeight() + 4)\"\n [style.height.px]=\"laneHeight()\"\n [udTooltip]=\"barTitle(lb.bar)\"\n [attr.aria-keyshortcuts]=\"'Shift+ArrowRight Shift+ArrowLeft'\"\n role=\"button\"\n tabindex=\"0\"\n (mousedown)=\"\n startBarMove($event, asRoomRow(p.row).room, lb.bar)\n \"\n (click)=\"\n $event.stopPropagation();\n onBarClick(lb.bar, asRoomRow(p.row).room)\n \"\n (keydown.enter)=\"\n barClick.emit({\n bar: lb.bar,\n room: asRoomRow(p.row).room,\n })\n \"\n (keydown)=\"\n onBarKeydownResize(\n $event,\n asRoomRow(p.row).room,\n lb.bar,\n asRoomRow(p.row).bars\n )\n \">\n @if (!g.cutLeft) {\n <span\n class=\"occ__bar-handle occ__bar-handle--start\"\n aria-hidden=\"true\"\n (mousedown)=\"\n startResize(\n $event,\n asRoomRow(p.row).room,\n lb.bar,\n 'start',\n asRoomRow(p.row).bars\n )\n \"\n (click)=\"$event.stopPropagation()\"></span>\n }\n <span class=\"occ__bar-label\">{{ lb.bar.studentName }}</span>\n @if (!g.cutRight) {\n <span\n class=\"occ__bar-handle occ__bar-handle--end\"\n aria-hidden=\"true\"\n (mousedown)=\"\n startResize(\n $event,\n asRoomRow(p.row).room,\n lb.bar,\n 'end',\n asRoomRow(p.row).bars\n )\n \"\n (click)=\"$event.stopPropagation()\"></span>\n }\n </div>\n }\n }\n </div>\n <div class=\"occ__row-hover\" aria-hidden=\"true\"></div>\n @if (hoverDay() !== null) {\n <div\n class=\"occ__col-hover\"\n aria-hidden=\"true\"\n [style.left.px]=\"leftColumnWidth() + hoverDay()! * dayWidth()\"\n [style.width.px]=\"dayWidth()\"></div>\n }\n </div>\n }\n }\n\n <!-- The floating copy of a bar being dragged by its body \u2014 see `moveGhost`. -->\n @if (moveGhost(); as g) {\n <div\n class=\"occ__bar occ__bar--ghost\"\n aria-hidden=\"true\"\n [attr.data-state]=\"g.state\"\n [style.left.px]=\"g.left\"\n [style.top.px]=\"g.top\"\n [style.width.px]=\"g.width\"\n [style.height.px]=\"g.height\">\n <span class=\"occ__bar-label\">{{ g.label }}</span>\n </div>\n }\n\n <!-- The in-progress drag-to-create's preview span \u2014 see `createGhost`. -->\n @if (createGhost(); as g) {\n <div\n class=\"occ__bar--create\"\n aria-hidden=\"true\"\n [style.left.px]=\"g.left\"\n [style.top.px]=\"g.top\"\n [style.width.px]=\"g.width\"\n [style.height.px]=\"g.height\"></div>\n }\n\n <!-- The hovered or keyboard-focused empty cell \u2014 see `laneCursorGeometry`. -->\n @if (laneCursorGeometry(); as g) {\n <div\n class=\"occ__lane-cursor\"\n aria-hidden=\"true\"\n [style.left.px]=\"g.left\"\n [style.top.px]=\"g.top\"\n [style.width.px]=\"g.width\"\n [style.height.px]=\"g.height\"></div>\n }\n\n @if (rows().length === 0 && !loading()) {\n <div class=\"occ__empty\" [style.top.px]=\"headerHeight\">\n {{ 'occupancyGrid.empty' | translate }}\n </div>\n }\n </div>\n </div>\n\n <div class=\"occ__legend\">\n @for (s of ['tentative', 'reserved', 'in_room', 'history']; track s) {\n <span class=\"occ__legend-item\"\n ><i class=\"occ__swatch\" [attr.data-state]=\"s\"></i\n >{{ 'occupancyGrid.states.' + s | translate }}</span\n >\n }\n <span class=\"occ__legend-item\"\n ><i class=\"occ__swatch occ__swatch--closed\"></i\n >{{ 'occupancyGrid.states.closed' | translate }}</span\n >\n </div>\n</div>\n", styles: ["@charset \"UTF-8\";:host{display:block;width:100%;height:var(--ud-occ-height, 640px);--ud-occ-paper: #f5f4f0;--ud-occ-surface: #ffffff;--ud-occ-ink: #1b2535;--ud-occ-muted: #6b7585;--ud-occ-rule: #ebe9e3;--ud-occ-rule-strong: #d9d5cb;--ud-occ-weekend: rgba(27, 37, 53, .035);--ud-occ-today: rgba(74, 127, 232, .1);--ud-occ-accent: #4a7fe8;--ud-occ-crosshair: rgba(27, 37, 53, .06);--ud-occ-tentative-bg: #fff4d6;--ud-occ-tentative-rail: #d97706;--ud-occ-reserved-bg: #dbeafe;--ud-occ-reserved-rail: #1d4ed8;--ud-occ-inroom-bg: #1b2535;--ud-occ-inroom-rail: #4a7fe8;--ud-occ-inroom-ink: #f5f6f7;--ud-occ-history-bg: #ececec;--ud-occ-history-rail: #9aa1ad;--ud-occ-closed: rgba(220, 38, 38, .1);--ud-occ-closed-rail: #dc2626;--ud-occ-radius: 6px;--ud-occ-font: \"Sora\", system-ui, sans-serif;font-family:var(--ud-occ-font);color:var(--ud-occ-ink)}.occ{display:flex;flex-direction:column;height:100%;background:var(--ud-occ-paper);border:1px solid var(--ud-occ-rule-strong);border-radius:10px;overflow:hidden}.occ.is-loading .occ__canvas{opacity:.55}.occ.is-dragging-active{-webkit-user-select:none;user-select:none}.occ__scroller{position:relative;flex:1;min-height:0;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--ud-occ-rule-strong) transparent}.occ__scroller::-webkit-scrollbar{width:10px;height:10px}.occ__scroller::-webkit-scrollbar-track{background:transparent}.occ__scroller::-webkit-scrollbar-thumb{background-color:var(--ud-occ-rule-strong);border-radius:6px;border:2px solid var(--ud-occ-surface)}.occ__scroller::-webkit-scrollbar-thumb:hover{background-color:var(--ud-occ-muted)}.occ__canvas{position:relative}.occ__eyebrow{font-family:var(--ud-occ-font);font-weight:700;font-size:11px;letter-spacing:.09em;text-transform:uppercase;color:var(--ud-occ-muted)}.occ__header{position:sticky;top:0;z-index:4;background:var(--ud-occ-surface);border-bottom:1px solid var(--ud-occ-rule-strong);width:100%}.occ__corner{position:sticky;left:0;z-index:5;height:100%;display:flex;align-items:center;justify-content:space-between;padding:0 8px 0 12px;background:var(--ud-occ-surface);border-right:1px solid var(--ud-occ-rule-strong);box-shadow:2px 0 5px #1b25350d;box-sizing:border-box}.occ__nav{display:flex;gap:2px}.occ__nav-btn{width:22px;height:22px;display:flex;align-items:center;justify-content:center;border:1px solid var(--ud-occ-rule-strong);border-radius:var(--ud-occ-radius);background:var(--ud-occ-surface);color:var(--ud-occ-muted);font-size:14px;line-height:1;cursor:pointer;padding:0;transition:background .12s ease,color .12s ease,transform 80ms ease}.occ__nav-btn:hover{background:var(--ud-occ-weekend);color:var(--ud-occ-ink)}.occ__nav-btn:active{transform:scale(.92)}.occ__nav-btn:focus-visible{outline:2px solid var(--ud-occ-accent);outline-offset:1px}.occ__months,.occ__days{position:absolute;top:0;height:26px}.occ__days{top:26px}.occ__month{position:absolute;top:0;height:26px;line-height:26px;padding-left:8px;font-size:12px;font-weight:600;border-left:1px solid var(--ud-occ-rule-strong);box-sizing:border-box;white-space:nowrap;overflow:hidden}.occ__day{position:absolute;top:0;height:26px;display:flex;flex-direction:column;align-items:center;justify-content:center;font-variant-numeric:tabular-nums;font-size:11px;line-height:1;border-left:1px solid var(--ud-occ-rule);box-sizing:border-box}.occ__day.is-weekend{background:var(--ud-occ-weekend)}.occ__day.is-today{font-weight:700}.occ__day.is-hovered{background:var(--ud-occ-crosshair);box-shadow:inset 0 -2px 0 var(--ud-occ-accent);color:var(--ud-occ-ink);font-weight:700}.occ__day-num{display:inline-flex}.occ__day.is-today .occ__day-num{align-items:center;justify-content:center;width:16px;height:16px;border-radius:50%;background:var(--ud-occ-accent);color:#fff}.occ__day-wd{font-size:9px;color:var(--ud-occ-muted);margin-top:2px}.occ__today{position:absolute;z-index:1;background:var(--ud-occ-today);border-left:1px solid var(--ud-occ-accent);border-right:1px solid var(--ud-occ-accent);box-sizing:border-box;pointer-events:none}.occ__row{position:absolute;left:0;width:100%;box-sizing:border-box;border-bottom:1px solid var(--ud-occ-rule)}.occ__row--group{cursor:pointer;background:var(--ud-occ-paper);z-index:3}.occ__row--group[data-depth=\"0\"] .occ__eyebrow{color:var(--ud-occ-ink)}.occ__row--group[data-depth=\"1\"] .occ__cell--sticky{padding-left:20px}.occ__row--group[data-depth=\"2\"] .occ__cell--sticky{padding-left:32px}.occ__row--room{background:var(--ud-occ-surface);z-index:2}.occ__row--room.is-inactive .occ__room{opacity:.55}.occ__row-hover{position:absolute;inset:0;background:transparent;pointer-events:none;transition:background .1s ease}.occ__row--room:hover .occ__row-hover{background:var(--ud-occ-crosshair)}.occ__row--room:hover .occ__room{background-image:linear-gradient(var(--ud-occ-crosshair),var(--ud-occ-crosshair));box-shadow:inset 3px 0 0 var(--ud-occ-accent)}.occ__col-hover{position:absolute;top:0;bottom:0;background:var(--ud-occ-crosshair);pointer-events:none}.occ__cell--sticky{position:sticky;left:0;z-index:3;height:100%;display:flex;align-items:center;gap:8px;padding:0 12px;background:inherit;border-right:1px solid var(--ud-occ-rule-strong);box-shadow:2px 0 5px #1b25350a;box-sizing:border-box}.occ__chevron{display:inline-block;transition:transform .15s;font-size:12px}.occ__chevron.is-collapsed{transform:rotate(-90deg)}.occ__count{margin-left:auto;font-family:var(--ud-occ-font);font-weight:600;font-variant-numeric:tabular-nums;font-size:11px;color:var(--ud-occ-muted)}.occ__room{cursor:pointer}.occ__room-number{font-weight:600;font-size:13px}.occ__room-type{font-size:11px;color:var(--ud-occ-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.occ__room-occ{margin-left:auto;font-family:var(--ud-occ-font);font-weight:600;font-size:11px;font-variant-numeric:tabular-nums}.occ__room-occ.is-full{color:var(--ud-occ-closed-rail)}.occ__lane-bg{position:absolute;top:0;height:100%;background-image:linear-gradient(to right,var(--ud-occ-rule) 1px,transparent 1px),repeating-linear-gradient(to right,var(--ud-occ-weekend) 0 calc(var(--dw) * 2),transparent calc(var(--dw) * 2) calc(var(--dw) * 7));background-size:var(--dw) 100%,calc(var(--dw) * 7) 100%;background-position:0 0,var(--weekend-offset, 0px) 0}.occ__row--room .occ__lane-bg{cursor:pointer}.occ__lane-free{position:absolute;left:0;right:0;z-index:0;box-sizing:border-box;border-radius:var(--ud-occ-radius);border:1px dashed var(--ud-occ-rule)}.occ__bar{position:absolute;z-index:2;display:flex;align-items:center;padding:0 6px 0 8px;box-sizing:border-box;border-radius:var(--ud-occ-radius);border-left:4px solid var(--ud-occ-accent);font-size:12px;cursor:grab;overflow:hidden;white-space:nowrap;box-shadow:0 1px 2px #1b253514;transition:box-shadow .12s ease,transform .12s ease}.occ__bar:hover{box-shadow:0 3px 8px #1b25352e;transform:translateY(-1px)}.occ__bar-label{overflow:hidden;text-overflow:ellipsis}.occ__bar.is-moving{opacity:.35;cursor:grabbing}.occ__bar--ghost{z-index:6;cursor:grabbing;pointer-events:none;outline:2px dashed var(--ud-occ-accent);outline-offset:2px;box-shadow:0 8px 20px #1b253552}.occ__row--room.is-move-target .occ__lane-bg{background-color:#4a7fe814}.occ__bar--create{position:absolute;z-index:6;box-sizing:border-box;border-radius:var(--ud-occ-radius);background:#4a7fe82e;border:2px dashed var(--ud-occ-accent);pointer-events:none}.occ__lane-cursor{position:absolute;z-index:3;box-sizing:border-box;border-radius:var(--ud-occ-radius);outline:2px solid var(--ud-occ-accent);outline-offset:-2px;pointer-events:none}.occ__bar-handle{position:absolute;top:0;bottom:0;width:8px;cursor:ew-resize;opacity:0;transition:opacity .12s ease}.occ__bar-handle--start{left:0}.occ__bar-handle--end{right:0}.occ__bar:hover .occ__bar-handle,.occ__bar:focus-visible .occ__bar-handle{opacity:1}.occ__bar[data-state=in_room] .occ__bar-handle{background:#ffffff4d}.occ__bar:not([data-state=in_room]) .occ__bar-handle{background:#1b253524}.occ__bar.is-resizing{z-index:5;box-shadow:0 4px 14px #1b253547;outline:2px dashed var(--ud-occ-accent);outline-offset:2px}.occ__bar.is-resizing .occ__bar-handle{opacity:1}.occ__bar[data-state=tentative]{background:var(--ud-occ-tentative-bg);border-left-color:var(--ud-occ-tentative-rail);border-top:1px dashed var(--ud-occ-tentative-rail);border-bottom:1px dashed var(--ud-occ-tentative-rail);border-right:1px dashed var(--ud-occ-tentative-rail)}.occ__bar[data-state=reserved]{background:var(--ud-occ-reserved-bg);border-left-color:var(--ud-occ-reserved-rail)}.occ__bar[data-state=in_room]{background:var(--ud-occ-inroom-bg);border-left-color:var(--ud-occ-inroom-rail);color:var(--ud-occ-inroom-ink)}.occ__bar[data-state=history]{background:var(--ud-occ-history-bg);border-left-color:var(--ud-occ-history-rail)}.occ__bar.is-cut-left{border-top-left-radius:0;border-bottom-left-radius:0;border-left-width:0;padding-left:10px}.occ__bar.is-cut-right{border-top-right-radius:0;border-bottom-right-radius:0}.occ__bar.is-cut-left:before,.occ__bar.is-cut-right:after{content:\"\\203a\";position:absolute;top:0;bottom:0;display:flex;align-items:center;font-size:12px;opacity:.7}.occ__bar.is-cut-left:before{left:2px;content:\"\\2039\"}.occ__bar.is-cut-right:after{right:2px}.occ__closure{position:absolute;top:0;height:100%;z-index:1;box-sizing:border-box;cursor:pointer;background:repeating-linear-gradient(135deg,var(--ud-occ-closed) 0 6px,transparent 6px 12px);border-left:3px solid var(--ud-occ-closed-rail);border-right:1px solid var(--ud-occ-closed-rail);display:flex;align-items:center;padding-left:8px;font-size:11px;color:var(--ud-occ-closed-rail);overflow:hidden;white-space:nowrap}.occ__closure.is-cut-left{border-left-width:0}.occ__closure.is-cut-right{border-right-width:0}.occ__empty{position:absolute;left:0;right:0;padding:32px;text-align:center;color:var(--ud-occ-muted)}.occ__legend{display:flex;flex-wrap:wrap;align-items:center;gap:16px;padding:10px 12px;border-top:1px solid var(--ud-occ-rule-strong);background:var(--ud-occ-surface);font-size:12px;color:var(--ud-occ-muted)}.occ__legend-item{display:inline-flex;align-items:center;gap:6px}.occ__swatch{width:14px;height:10px;border-radius:2px;border-left:3px solid var(--ud-occ-accent);display:inline-block}.occ__swatch[data-state=tentative]{background:var(--ud-occ-tentative-bg);border-left-color:var(--ud-occ-tentative-rail)}.occ__swatch[data-state=reserved]{background:var(--ud-occ-reserved-bg);border-left-color:var(--ud-occ-reserved-rail)}.occ__swatch[data-state=in_room]{background:var(--ud-occ-inroom-bg);border-left-color:var(--ud-occ-inroom-rail)}.occ__swatch[data-state=history]{background:var(--ud-occ-history-bg);border-left-color:var(--ud-occ-history-rail)}.occ__swatch--closed{background:repeating-linear-gradient(135deg,var(--ud-occ-closed) 0 3px,transparent 3px 6px);border-left-color:var(--ud-occ-closed-rail)}.occ__cell--sticky:focus-visible,.occ__row--group:focus-visible,.occ__bar:focus-visible,.occ__closure:focus-visible{outline:2px solid var(--ud-occ-accent);outline-offset:-2px;z-index:6}.occ__lane-bg:focus-visible{outline:none}@media (prefers-reduced-motion: reduce){.occ__chevron,.occ__nav-btn,.occ__bar,.occ__bar-handle,.occ__row-hover{transition:none}.occ__bar:hover,.occ__nav-btn:active{transform:none}}\n"], dependencies: [{ kind: "directive", type: UdTooltipDirective, selector: "[udTooltip]", inputs: ["udTooltip", "udTooltipPosition", "udTooltipDisabled", "udTooltipShowDelay"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
5928
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TimelineGridComponent, deps: [{ token: i1$4.TranslateService }, { token: i0.DestroyRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
5929
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.19", type: TimelineGridComponent, isStandalone: true, selector: "ud-timeline-grid", inputs: { lanes: { classPropertyName: "lanes", publicName: "lanes", isSignal: true, isRequired: false, transformFunction: null }, from: { classPropertyName: "from", publicName: "from", isSignal: true, isRequired: true, transformFunction: null }, to: { classPropertyName: "to", publicName: "to", isSignal: true, isRequired: true, transformFunction: null }, today: { classPropertyName: "today", publicName: "today", isSignal: true, isRequired: false, transformFunction: null }, dayWidth: { classPropertyName: "dayWidth", publicName: "dayWidth", isSignal: true, isRequired: false, transformFunction: null }, leftColumnWidth: { classPropertyName: "leftColumnWidth", publicName: "leftColumnWidth", isSignal: true, isRequired: false, transformFunction: null }, laneHeight: { classPropertyName: "laneHeight", publicName: "laneHeight", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, navStepDays: { classPropertyName: "navStepDays", publicName: "navStepDays", isSignal: true, isRequired: false, transformFunction: null }, preventOverlap: { classPropertyName: "preventOverlap", publicName: "preventOverlap", isSignal: true, isRequired: false, transformFunction: null }, cornerLabelKey: { classPropertyName: "cornerLabelKey", publicName: "cornerLabelKey", isSignal: true, isRequired: false, transformFunction: null }, emptyLabelKey: { classPropertyName: "emptyLabelKey", publicName: "emptyLabelKey", isSignal: true, isRequired: false, transformFunction: null }, createCellLabelKey: { classPropertyName: "createCellLabelKey", publicName: "createCellLabelKey", isSignal: true, isRequired: false, transformFunction: null }, legend: { classPropertyName: "legend", publicName: "legend", isSignal: true, isRequired: false, transformFunction: null }, dragPayload: { classPropertyName: "dragPayload", publicName: "dragPayload", isSignal: true, isRequired: false, transformFunction: null }, canDrop: { classPropertyName: "canDrop", publicName: "canDrop", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { barClick: "barClick", closureClick: "closureClick", laneClick: "laneClick", cellClick: "cellClick", reachedEnd: "reachedEnd", windowShift: "windowShift", barResize: "barResize", barMove: "barMove", barCreate: "barCreate", laneDrop: "laneDrop" }, viewQueries: [{ propertyName: "scroller", first: true, predicate: ["scroller"], descendants: true, isSignal: true }], ngImport: i0, template: "<div\n class=\"occ\"\n [class.is-loading]=\"loading()\"\n [class.is-dragging-active]=\"\n resize() !== null || move()?.dragging || create()?.dragging\n \"\n [style.--dw]=\"dayWidth() + 'px'\"\n (keydown)=\"onGridKeydown($event)\">\n <div #scroller class=\"occ__scroller\" (scroll)=\"onScroll()\">\n <div\n class=\"occ__canvas\"\n [style.width.px]=\"canvasWidth()\"\n [style.height.px]=\"bodyHeight() + headerHeight\"\n (mousemove)=\"onCanvasMouseMove($event)\"\n (mouseleave)=\"hoverDay.set(null)\">\n <!-- Sticky two-tier header -->\n <div class=\"occ__header\" [style.height.px]=\"headerHeight\">\n <div class=\"occ__corner\" [style.width.px]=\"leftColumnWidth()\">\n <span class=\"occ__eyebrow\">{{ cornerLabelKey() | translate }}</span>\n <div class=\"occ__nav\">\n <button\n type=\"button\"\n class=\"occ__nav-btn\"\n [attr.aria-label]=\"'occupancyGrid.nav.prev' | translate\"\n [udTooltip]=\"'occupancyGrid.nav.prev' | translate\"\n (click)=\"shiftWindow(-1)\">\n \u2039\n </button>\n <button\n type=\"button\"\n class=\"occ__nav-btn\"\n [attr.aria-label]=\"'occupancyGrid.nav.next' | translate\"\n [udTooltip]=\"'occupancyGrid.nav.next' | translate\"\n (click)=\"shiftWindow(1)\">\n \u203A\n </button>\n </div>\n </div>\n <div class=\"occ__months\" [style.left.px]=\"leftColumnWidth()\">\n @for (m of months(); track m.label) {\n <div\n class=\"occ__month\"\n [style.left.px]=\"m.left\"\n [style.width.px]=\"m.width\">\n {{ m.label }}\n </div>\n }\n </div>\n <div class=\"occ__days\" [style.left.px]=\"leftColumnWidth()\">\n @for (d of days(); track d.iso) {\n <div\n class=\"occ__day\"\n [class.is-weekend]=\"d.isWeekend\"\n [class.is-today]=\"d.iso === today()\"\n [class.is-hovered]=\"$index === hoverDay()\"\n [style.left.px]=\"d.left\"\n [style.width.px]=\"dayWidth()\">\n <span class=\"occ__day-num\">{{ d.dayOfMonth }}</span>\n <span class=\"occ__day-wd\">{{\n 'occupancyGrid.weekdays.' + d.weekday | translate\n }}</span>\n </div>\n }\n </div>\n </div>\n\n <!-- Today column, behind rows -->\n @if (todayLeft() !== null) {\n <div\n class=\"occ__today\"\n [style.left.px]=\"leftColumnWidth() + todayLeft()!\"\n [style.top.px]=\"headerHeight\"\n [style.width.px]=\"dayWidth()\"\n [style.height.px]=\"bodyHeight()\"></div>\n }\n\n <!-- Virtualized rows -->\n @for (p of visible(); track trackRow($index, p)) {\n @if (p.row.kind === 'group') {\n <div\n class=\"occ__row occ__row--group\"\n [attr.data-depth]=\"p.row.depth\"\n [style.top.px]=\"headerHeight + p.top\"\n [style.height.px]=\"p.height\"\n role=\"button\"\n tabindex=\"0\"\n (click)=\"toggleGroup(p.row.key)\"\n (keydown.enter)=\"toggleGroup(p.row.key)\">\n <div\n class=\"occ__cell occ__cell--sticky\"\n [style.width.px]=\"leftColumnWidth()\">\n <span\n class=\"occ__chevron\"\n [class.is-collapsed]=\"isCollapsed(p.row.key)\"\n >\u25BE</span\n >\n <span class=\"occ__eyebrow\">{{ p.row.label }}</span>\n <span class=\"occ__count\">{{ p.row.laneCount }}</span>\n </div>\n <div\n class=\"occ__lane-bg\"\n [style.left.px]=\"leftColumnWidth()\"\n [style.width.px]=\"dayCount() * dayWidth()\"\n [style.--weekend-offset]=\"weekendOffsetPx() + 'px'\"></div>\n @if (hoverDay() !== null) {\n <div\n class=\"occ__col-hover\"\n aria-hidden=\"true\"\n [style.left.px]=\"leftColumnWidth() + hoverDay()! * dayWidth()\"\n [style.width.px]=\"dayWidth()\"></div>\n }\n </div>\n } @else {\n @let lr = asLaneRow(p.row);\n <!-- data-room-id mirrors data-lane-id for selectors written against the occupancy grid. -->\n <div\n class=\"occ__row occ__row--room\"\n [class.is-inactive]=\"!lr.lane.active\"\n [class.is-move-target]=\"isMoveTarget(lr.lane.id)\"\n [class.is-drop-disabled]=\"isDropDisabled(lr.lane)\"\n [attr.data-lane-id]=\"lr.lane.id\"\n [attr.data-room-id]=\"lr.lane.id\"\n [style.top.px]=\"headerHeight + p.top\"\n [style.height.px]=\"p.height\">\n <div\n class=\"occ__cell occ__cell--sticky occ__room\"\n [style.width.px]=\"leftColumnWidth()\"\n role=\"button\"\n tabindex=\"0\"\n (click)=\"laneClick.emit(lr.lane)\"\n (keydown.enter)=\"laneClick.emit(lr.lane)\">\n <span class=\"occ__room-number\">{{ lr.lane.label }}</span>\n @if (lr.lane.sublabel) {\n <span class=\"occ__room-type\">{{ lr.lane.sublabel }}</span>\n }\n @for (tag of lr.lane.tags ?? []; track tag) {\n <span class=\"occ__lane-tag\">{{ tag }}</span>\n }\n @let taken = takenOn(lr.lane);\n @if (taken !== null) {\n <span\n class=\"occ__room-occ\"\n [udTooltip]=\"\n 'occupancyGrid.takenOn' | translate: { date: from() }\n \"\n [class.is-full]=\"taken >= lr.lane.capacity!\">\n {{ taken }}/{{ lr.lane.capacity }}\n </span>\n }\n </div>\n <div\n class=\"occ__lane-bg\"\n tabindex=\"0\"\n [attr.aria-label]=\"\n createCellLabelKey()\n | translate: { lane: lr.lane.label, room: lr.lane.label }\n \"\n [style.left.px]=\"leftColumnWidth()\"\n [style.width.px]=\"dayCount() * dayWidth()\"\n [style.--weekend-offset]=\"weekendOffsetPx() + 'px'\"\n (mousedown)=\"startCreate($event, lr.lane)\"\n (click)=\"onLaneClick($event, lr.lane)\"\n (mousemove)=\"onLaneMouseMove($event, lr.lane)\"\n (mouseleave)=\"onLaneMouseLeave(lr.lane)\"\n (focus)=\"onLaneFocus(lr.lane)\"\n (blur)=\"onLaneBlur()\"\n (keydown)=\"onLaneKeydown($event, lr.lane)\"\n (dragover)=\"onLaneDragOver($event, lr.lane)\"\n (dragleave)=\"onLaneDragLeave($event, lr.lane)\"\n (drop)=\"onLaneDrop($event, lr.lane)\">\n @for (c of lr.lane.closures; track c.id) {\n @if (closureGeometryOf(c); as g) {\n <div\n class=\"occ__closure\"\n [class.is-cut-left]=\"g.cutLeft\"\n [class.is-cut-right]=\"g.cutRight\"\n [style.left.px]=\"g.left\"\n [style.width.px]=\"g.width\"\n [udTooltip]=\"closureTitle(c)\"\n role=\"button\"\n tabindex=\"0\"\n (mousedown)=\"$event.stopPropagation()\"\n (click)=\"\n $event.stopPropagation();\n closureClick.emit({ closure: c, lane: lr.lane })\n \"\n (keydown.enter)=\"\n closureClick.emit({ closure: c, lane: lr.lane })\n \">\n <span class=\"occ__closure-label\">{{ c.label }}</span>\n </div>\n }\n }\n @if (lr.freeSlot !== null) {\n <div\n class=\"occ__lane-free\"\n [style.top.px]=\"4 + lr.freeSlot * (laneHeight() + 4)\"\n [style.height.px]=\"laneHeight()\"\n (mousedown)=\"\n $event.stopPropagation();\n startCreate($event, lr.lane, lr.freeSlot)\n \"\n (mousemove)=\"\n onLaneMouseMove($event, lr.lane, lr.freeSlot)\n \"></div>\n }\n @for (lb of lr.bars; track lb.bar.id) {\n @if (geometryOf(lb.bar); as g) {\n <div\n class=\"occ__bar\"\n [attr.data-state]=\"lb.bar.state\"\n [class.is-cut-left]=\"g.cutLeft\"\n [class.is-cut-right]=\"g.cutRight\"\n [class.is-open-ended]=\"lb.bar.endDate === null\"\n [class.is-resizing]=\"isResizing(lb.bar.id)\"\n [class.is-moving]=\"isBeingMoved(lb.bar.id)\"\n [style.left.px]=\"g.left + 1\"\n [style.width.px]=\"g.width - 2\"\n [style.top.px]=\"4 + lb.slot * (laneHeight() + 4)\"\n [style.height.px]=\"laneHeight()\"\n [udTooltip]=\"barTitle(lb.bar)\"\n [attr.aria-keyshortcuts]=\"'Shift+ArrowRight Shift+ArrowLeft'\"\n role=\"button\"\n tabindex=\"0\"\n (mousedown)=\"startBarMove($event, lr.lane, lb.bar)\"\n (click)=\"\n $event.stopPropagation(); onBarClick(lb.bar, lr.lane)\n \"\n (keydown.enter)=\"\n barClick.emit({ bar: lb.bar, lane: lr.lane })\n \"\n (keydown)=\"\n onBarKeydownResize($event, lr.lane, lb.bar, lr.bars)\n \">\n @if (!g.cutLeft) {\n <span\n class=\"occ__bar-handle occ__bar-handle--start\"\n aria-hidden=\"true\"\n (mousedown)=\"\n startResize($event, lr.lane, lb.bar, 'start', lr.bars)\n \"\n (click)=\"$event.stopPropagation()\"></span>\n }\n <span class=\"occ__bar-label\">{{ lb.bar.title }}</span>\n @if (lb.bar.subtitle) {\n <span class=\"occ__bar-sub\">{{ lb.bar.subtitle }}</span>\n }\n @if (lb.bar.badge) {\n <span class=\"occ__bar-badge\">{{ lb.bar.badge }}</span>\n }\n @if (!g.cutRight) {\n <span\n class=\"occ__bar-handle occ__bar-handle--end\"\n aria-hidden=\"true\"\n (mousedown)=\"\n startResize($event, lr.lane, lb.bar, 'end', lr.bars)\n \"\n (click)=\"$event.stopPropagation()\"></span>\n }\n </div>\n }\n }\n </div>\n <div class=\"occ__row-hover\" aria-hidden=\"true\"></div>\n @if (hoverDay() !== null) {\n <div\n class=\"occ__col-hover\"\n aria-hidden=\"true\"\n [style.left.px]=\"leftColumnWidth() + hoverDay()! * dayWidth()\"\n [style.width.px]=\"dayWidth()\"></div>\n }\n </div>\n }\n }\n\n <!-- The floating copy of a bar being dragged by its body \u2014 see `moveGhost`. -->\n @if (moveGhost(); as g) {\n <div\n class=\"occ__bar occ__bar--ghost\"\n aria-hidden=\"true\"\n [attr.data-state]=\"g.state\"\n [class.is-cut-right]=\"g.openEnded\"\n [class.is-open-ended]=\"g.openEnded\"\n [style.left.px]=\"g.left\"\n [style.top.px]=\"g.top\"\n [style.width.px]=\"g.width\"\n [style.height.px]=\"g.height\">\n <span class=\"occ__bar-label\">{{ g.label }}</span>\n </div>\n }\n\n <!-- The in-progress drag-to-create's preview span \u2014 see `createGhost`. -->\n @if (createGhost(); as g) {\n <div\n class=\"occ__bar--create\"\n aria-hidden=\"true\"\n [style.left.px]=\"g.left\"\n [style.top.px]=\"g.top\"\n [style.width.px]=\"g.width\"\n [style.height.px]=\"g.height\"></div>\n }\n\n <!-- The hovered or keyboard-focused empty cell \u2014 see `laneCursorGeometry`. -->\n @if (laneCursorGeometry(); as g) {\n <div\n class=\"occ__lane-cursor\"\n aria-hidden=\"true\"\n [style.left.px]=\"g.left\"\n [style.top.px]=\"g.top\"\n [style.width.px]=\"g.width\"\n [style.height.px]=\"g.height\"></div>\n }\n\n @if (rows().length === 0 && !loading()) {\n <div class=\"occ__empty\" [style.top.px]=\"headerHeight\">\n {{ emptyLabelKey() | translate }}\n </div>\n }\n </div>\n </div>\n\n <div class=\"occ__legend\">\n @for (s of legend(); track s.state) {\n <span class=\"occ__legend-item\"\n ><i class=\"occ__swatch\" [attr.data-state]=\"s.state\"></i\n >{{ s.labelKey | translate }}</span\n >\n }\n <span class=\"occ__legend-item\"\n ><i class=\"occ__swatch occ__swatch--closed\"></i\n >{{ 'occupancyGrid.states.closed' | translate }}</span\n >\n </div>\n</div>\n", styles: ["@charset \"UTF-8\";:host{display:block;width:100%;height:var(--ud-occ-height, 640px);--ud-occ-paper: #f5f4f0;--ud-occ-surface: #ffffff;--ud-occ-ink: #1b2535;--ud-occ-muted: #6b7585;--ud-occ-rule: #ebe9e3;--ud-occ-rule-strong: #d9d5cb;--ud-occ-weekend: rgba(27, 37, 53, .035);--ud-occ-today: rgba(74, 127, 232, .1);--ud-occ-accent: #4a7fe8;--ud-occ-crosshair: rgba(27, 37, 53, .06);--ud-occ-tentative-bg: #fff4d6;--ud-occ-tentative-rail: #d97706;--ud-occ-reserved-bg: #dbeafe;--ud-occ-reserved-rail: #1d4ed8;--ud-occ-inroom-bg: #1b2535;--ud-occ-inroom-rail: #4a7fe8;--ud-occ-inroom-ink: #f5f6f7;--ud-occ-history-bg: #ececec;--ud-occ-history-rail: #9aa1ad;--ud-occ-closed: rgba(220, 38, 38, .1);--ud-occ-closed-rail: #dc2626;--ud-occ-radius: 6px;--ud-occ-font: \"Sora\", system-ui, sans-serif;font-family:var(--ud-occ-font);color:var(--ud-occ-ink)}.occ{display:flex;flex-direction:column;height:100%;background:var(--ud-occ-paper);border:1px solid var(--ud-occ-rule-strong);border-radius:10px;overflow:hidden}.occ.is-loading .occ__canvas{opacity:.55}.occ.is-dragging-active{-webkit-user-select:none;user-select:none}.occ__scroller{position:relative;flex:1;min-height:0;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--ud-occ-rule-strong) transparent}.occ__scroller::-webkit-scrollbar{width:10px;height:10px}.occ__scroller::-webkit-scrollbar-track{background:transparent}.occ__scroller::-webkit-scrollbar-thumb{background-color:var(--ud-occ-rule-strong);border-radius:6px;border:2px solid var(--ud-occ-surface)}.occ__scroller::-webkit-scrollbar-thumb:hover{background-color:var(--ud-occ-muted)}.occ__canvas{position:relative}.occ__eyebrow{font-family:var(--ud-occ-font);font-weight:700;font-size:11px;letter-spacing:.09em;text-transform:uppercase;color:var(--ud-occ-muted)}.occ__header{position:sticky;top:0;z-index:4;background:var(--ud-occ-surface);border-bottom:1px solid var(--ud-occ-rule-strong);width:100%}.occ__corner{position:sticky;left:0;z-index:5;height:100%;display:flex;align-items:center;justify-content:space-between;padding:0 8px 0 12px;background:var(--ud-occ-surface);border-right:1px solid var(--ud-occ-rule-strong);box-shadow:2px 0 5px #1b25350d;box-sizing:border-box}.occ__nav{display:flex;gap:2px}.occ__nav-btn{width:22px;height:22px;display:flex;align-items:center;justify-content:center;border:1px solid var(--ud-occ-rule-strong);border-radius:var(--ud-occ-radius);background:var(--ud-occ-surface);color:var(--ud-occ-muted);font-size:14px;line-height:1;cursor:pointer;padding:0;transition:background .12s ease,color .12s ease,transform 80ms ease}.occ__nav-btn:hover{background:var(--ud-occ-weekend);color:var(--ud-occ-ink)}.occ__nav-btn:active{transform:scale(.92)}.occ__nav-btn:focus-visible{outline:2px solid var(--ud-occ-accent);outline-offset:1px}.occ__months,.occ__days{position:absolute;top:0;height:26px}.occ__days{top:26px}.occ__month{position:absolute;top:0;height:26px;line-height:26px;padding-left:8px;font-size:12px;font-weight:600;border-left:1px solid var(--ud-occ-rule-strong);box-sizing:border-box;white-space:nowrap;overflow:hidden}.occ__day{position:absolute;top:0;height:26px;display:flex;flex-direction:column;align-items:center;justify-content:center;font-variant-numeric:tabular-nums;font-size:11px;line-height:1;border-left:1px solid var(--ud-occ-rule);box-sizing:border-box}.occ__day.is-weekend{background:var(--ud-occ-weekend)}.occ__day.is-today{font-weight:700}.occ__day.is-hovered{background:var(--ud-occ-crosshair);box-shadow:inset 0 -2px 0 var(--ud-occ-accent);color:var(--ud-occ-ink);font-weight:700}.occ__day-num{display:inline-flex}.occ__day.is-today .occ__day-num{align-items:center;justify-content:center;width:16px;height:16px;border-radius:50%;background:var(--ud-occ-accent);color:#fff}.occ__day-wd{font-size:9px;color:var(--ud-occ-muted);margin-top:2px}.occ__today{position:absolute;z-index:1;background:var(--ud-occ-today);border-left:1px solid var(--ud-occ-accent);border-right:1px solid var(--ud-occ-accent);box-sizing:border-box;pointer-events:none}.occ__row{position:absolute;left:0;width:100%;box-sizing:border-box;border-bottom:1px solid var(--ud-occ-rule)}.occ__row--group{cursor:pointer;background:var(--ud-occ-paper);z-index:3}.occ__row--group[data-depth=\"0\"] .occ__eyebrow{color:var(--ud-occ-ink)}.occ__row--group[data-depth=\"1\"] .occ__cell--sticky{padding-left:20px}.occ__row--group[data-depth=\"2\"] .occ__cell--sticky{padding-left:32px}.occ__row--room{background:var(--ud-occ-surface);z-index:2}.occ__row--room.is-inactive .occ__room{opacity:.55}.occ__row-hover{position:absolute;inset:0;background:transparent;pointer-events:none;transition:background .1s ease}.occ__row--room:hover .occ__row-hover{background:var(--ud-occ-crosshair)}.occ__row--room:hover .occ__room{background-image:linear-gradient(var(--ud-occ-crosshair),var(--ud-occ-crosshair));box-shadow:inset 3px 0 0 var(--ud-occ-accent)}.occ__col-hover{position:absolute;top:0;bottom:0;background:var(--ud-occ-crosshair);pointer-events:none}.occ__cell--sticky{position:sticky;left:0;z-index:3;height:100%;display:flex;align-items:center;gap:8px;padding:0 12px;background:inherit;border-right:1px solid var(--ud-occ-rule-strong);box-shadow:2px 0 5px #1b25350a;box-sizing:border-box}.occ__chevron{display:inline-block;transition:transform .15s;font-size:12px}.occ__chevron.is-collapsed{transform:rotate(-90deg)}.occ__count{margin-left:auto;font-family:var(--ud-occ-font);font-weight:600;font-variant-numeric:tabular-nums;font-size:11px;color:var(--ud-occ-muted)}.occ__room{cursor:pointer}.occ__room-number{font-weight:600;font-size:13px}.occ__room-type{font-size:11px;color:var(--ud-occ-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.occ__room-occ{margin-left:auto;font-family:var(--ud-occ-font);font-weight:600;font-size:11px;font-variant-numeric:tabular-nums}.occ__room-occ.is-full{color:var(--ud-occ-closed-rail)}.occ__lane-tag{flex-shrink:0;padding:0 5px;border-radius:999px;background:var(--ud-occ-paper);border:1px solid var(--ud-occ-rule-strong);font-size:10px;line-height:15px;color:var(--ud-occ-muted)}.occ__lane-bg{position:absolute;top:0;height:100%;background-image:linear-gradient(to right,var(--ud-occ-rule) 1px,transparent 1px),repeating-linear-gradient(to right,var(--ud-occ-weekend) 0 calc(var(--dw) * 2),transparent calc(var(--dw) * 2) calc(var(--dw) * 7));background-size:var(--dw) 100%,calc(var(--dw) * 7) 100%;background-position:0 0,var(--weekend-offset, 0px) 0}.occ__row--room .occ__lane-bg{cursor:pointer}.occ__lane-free{position:absolute;left:0;right:0;z-index:0;box-sizing:border-box;border-radius:var(--ud-occ-radius);border:1px dashed var(--ud-occ-rule)}.occ__bar{position:absolute;z-index:2;display:flex;align-items:center;padding:0 6px 0 8px;box-sizing:border-box;border-radius:var(--ud-occ-radius);border-left:4px solid var(--ud-occ-accent);font-size:12px;cursor:grab;overflow:hidden;white-space:nowrap;box-shadow:0 1px 2px #1b253514;transition:box-shadow .12s ease,transform .12s ease}.occ__bar:hover{box-shadow:0 3px 8px #1b25352e;transform:translateY(-1px)}.occ__bar-label{overflow:hidden;text-overflow:ellipsis}.occ__bar-sub{margin-left:6px;opacity:.7;overflow:hidden;text-overflow:ellipsis}.occ__bar-badge{margin-left:auto;padding-left:6px;font-size:10px;font-weight:600}.occ__bar.is-moving{opacity:.35;cursor:grabbing}.occ__bar--ghost{z-index:6;cursor:grabbing;pointer-events:none;outline:2px dashed var(--ud-occ-accent);outline-offset:2px;box-shadow:0 8px 20px #1b253552}.occ__row--room.is-move-target .occ__lane-bg{background-color:#4a7fe814}.occ__row--room.is-drop-disabled{opacity:.4;filter:grayscale(1)}.occ__bar--create{position:absolute;z-index:6;box-sizing:border-box;border-radius:var(--ud-occ-radius);background:#4a7fe82e;border:2px dashed var(--ud-occ-accent);pointer-events:none}.occ__lane-cursor{position:absolute;z-index:3;box-sizing:border-box;border-radius:var(--ud-occ-radius);outline:2px solid var(--ud-occ-accent);outline-offset:-2px;pointer-events:none}.occ__bar-handle{position:absolute;top:0;bottom:0;width:8px;cursor:ew-resize;opacity:0;transition:opacity .12s ease}.occ__bar-handle--start{left:0}.occ__bar-handle--end{right:0}.occ__bar:hover .occ__bar-handle,.occ__bar:focus-visible .occ__bar-handle{opacity:1}.occ__bar[data-state=in_room] .occ__bar-handle{background:#ffffff4d}.occ__bar:not([data-state=in_room]) .occ__bar-handle{background:#1b253524}.occ__bar.is-resizing{z-index:5;box-shadow:0 4px 14px #1b253547;outline:2px dashed var(--ud-occ-accent);outline-offset:2px}.occ__bar.is-resizing .occ__bar-handle{opacity:1}.occ__bar[data-state=tentative]{background:var(--ud-occ-tentative-bg);border-left-color:var(--ud-occ-tentative-rail);border-top:1px dashed var(--ud-occ-tentative-rail);border-bottom:1px dashed var(--ud-occ-tentative-rail);border-right:1px dashed var(--ud-occ-tentative-rail)}.occ__bar[data-state=reserved]{background:var(--ud-occ-reserved-bg);border-left-color:var(--ud-occ-reserved-rail)}.occ__bar[data-state=in_room]{background:var(--ud-occ-inroom-bg);border-left-color:var(--ud-occ-inroom-rail);color:var(--ud-occ-inroom-ink)}.occ__bar[data-state=history]{background:var(--ud-occ-history-bg);border-left-color:var(--ud-occ-history-rail)}.occ__bar.is-cut-left{border-top-left-radius:0;border-bottom-left-radius:0;border-left-width:0;padding-left:10px}.occ__bar.is-cut-right{border-top-right-radius:0;border-bottom-right-radius:0}.occ__bar.is-cut-left:before,.occ__bar.is-cut-right:after{content:\"\\203a\";position:absolute;top:0;bottom:0;display:flex;align-items:center;font-size:12px;opacity:.7}.occ__bar.is-cut-left:before{left:2px;content:\"\\2039\"}.occ__bar.is-cut-right:after{right:2px}.occ__bar.is-open-ended{padding-right:16px}.occ__bar.is-open-ended:after{content:\"\\2192\";opacity:.9}.occ__closure{position:absolute;top:0;height:100%;z-index:1;box-sizing:border-box;cursor:pointer;background:repeating-linear-gradient(135deg,var(--ud-occ-closed) 0 6px,transparent 6px 12px);border-left:3px solid var(--ud-occ-closed-rail);border-right:1px solid var(--ud-occ-closed-rail);display:flex;align-items:center;padding-left:8px;font-size:11px;color:var(--ud-occ-closed-rail);overflow:hidden;white-space:nowrap}.occ__closure.is-cut-left{border-left-width:0}.occ__closure.is-cut-right{border-right-width:0}.occ__empty{position:absolute;left:0;right:0;padding:32px;text-align:center;color:var(--ud-occ-muted)}.occ__legend{display:flex;flex-wrap:wrap;align-items:center;gap:16px;padding:10px 12px;border-top:1px solid var(--ud-occ-rule-strong);background:var(--ud-occ-surface);font-size:12px;color:var(--ud-occ-muted)}.occ__legend-item{display:inline-flex;align-items:center;gap:6px}.occ__swatch{width:14px;height:10px;border-radius:2px;border-left:3px solid var(--ud-occ-accent);display:inline-block}.occ__swatch[data-state=tentative]{background:var(--ud-occ-tentative-bg);border-left-color:var(--ud-occ-tentative-rail)}.occ__swatch[data-state=reserved]{background:var(--ud-occ-reserved-bg);border-left-color:var(--ud-occ-reserved-rail)}.occ__swatch[data-state=in_room]{background:var(--ud-occ-inroom-bg);border-left-color:var(--ud-occ-inroom-rail)}.occ__swatch[data-state=history]{background:var(--ud-occ-history-bg);border-left-color:var(--ud-occ-history-rail)}.occ__swatch--closed{background:repeating-linear-gradient(135deg,var(--ud-occ-closed) 0 3px,transparent 3px 6px);border-left-color:var(--ud-occ-closed-rail)}.occ__cell--sticky:focus-visible,.occ__row--group:focus-visible,.occ__bar:focus-visible,.occ__closure:focus-visible{outline:2px solid var(--ud-occ-accent);outline-offset:-2px;z-index:6}.occ__lane-bg:focus-visible{outline:none}@media (prefers-reduced-motion: reduce){.occ__chevron,.occ__nav-btn,.occ__bar,.occ__bar-handle,.occ__row-hover{transition:none}.occ__bar:hover,.occ__nav-btn:active{transform:none}}\n"], dependencies: [{ kind: "directive", type: UdTooltipDirective, selector: "[udTooltip]", inputs: ["udTooltip", "udTooltipPosition", "udTooltipDisabled", "udTooltipShowDelay"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
5930
|
+
}
|
|
5931
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: TimelineGridComponent, decorators: [{
|
|
5932
|
+
type: Component,
|
|
5933
|
+
args: [{ selector: 'ud-timeline-grid', standalone: true, imports: [UdTooltipDirective, TranslatePipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"occ\"\n [class.is-loading]=\"loading()\"\n [class.is-dragging-active]=\"\n resize() !== null || move()?.dragging || create()?.dragging\n \"\n [style.--dw]=\"dayWidth() + 'px'\"\n (keydown)=\"onGridKeydown($event)\">\n <div #scroller class=\"occ__scroller\" (scroll)=\"onScroll()\">\n <div\n class=\"occ__canvas\"\n [style.width.px]=\"canvasWidth()\"\n [style.height.px]=\"bodyHeight() + headerHeight\"\n (mousemove)=\"onCanvasMouseMove($event)\"\n (mouseleave)=\"hoverDay.set(null)\">\n <!-- Sticky two-tier header -->\n <div class=\"occ__header\" [style.height.px]=\"headerHeight\">\n <div class=\"occ__corner\" [style.width.px]=\"leftColumnWidth()\">\n <span class=\"occ__eyebrow\">{{ cornerLabelKey() | translate }}</span>\n <div class=\"occ__nav\">\n <button\n type=\"button\"\n class=\"occ__nav-btn\"\n [attr.aria-label]=\"'occupancyGrid.nav.prev' | translate\"\n [udTooltip]=\"'occupancyGrid.nav.prev' | translate\"\n (click)=\"shiftWindow(-1)\">\n \u2039\n </button>\n <button\n type=\"button\"\n class=\"occ__nav-btn\"\n [attr.aria-label]=\"'occupancyGrid.nav.next' | translate\"\n [udTooltip]=\"'occupancyGrid.nav.next' | translate\"\n (click)=\"shiftWindow(1)\">\n \u203A\n </button>\n </div>\n </div>\n <div class=\"occ__months\" [style.left.px]=\"leftColumnWidth()\">\n @for (m of months(); track m.label) {\n <div\n class=\"occ__month\"\n [style.left.px]=\"m.left\"\n [style.width.px]=\"m.width\">\n {{ m.label }}\n </div>\n }\n </div>\n <div class=\"occ__days\" [style.left.px]=\"leftColumnWidth()\">\n @for (d of days(); track d.iso) {\n <div\n class=\"occ__day\"\n [class.is-weekend]=\"d.isWeekend\"\n [class.is-today]=\"d.iso === today()\"\n [class.is-hovered]=\"$index === hoverDay()\"\n [style.left.px]=\"d.left\"\n [style.width.px]=\"dayWidth()\">\n <span class=\"occ__day-num\">{{ d.dayOfMonth }}</span>\n <span class=\"occ__day-wd\">{{\n 'occupancyGrid.weekdays.' + d.weekday | translate\n }}</span>\n </div>\n }\n </div>\n </div>\n\n <!-- Today column, behind rows -->\n @if (todayLeft() !== null) {\n <div\n class=\"occ__today\"\n [style.left.px]=\"leftColumnWidth() + todayLeft()!\"\n [style.top.px]=\"headerHeight\"\n [style.width.px]=\"dayWidth()\"\n [style.height.px]=\"bodyHeight()\"></div>\n }\n\n <!-- Virtualized rows -->\n @for (p of visible(); track trackRow($index, p)) {\n @if (p.row.kind === 'group') {\n <div\n class=\"occ__row occ__row--group\"\n [attr.data-depth]=\"p.row.depth\"\n [style.top.px]=\"headerHeight + p.top\"\n [style.height.px]=\"p.height\"\n role=\"button\"\n tabindex=\"0\"\n (click)=\"toggleGroup(p.row.key)\"\n (keydown.enter)=\"toggleGroup(p.row.key)\">\n <div\n class=\"occ__cell occ__cell--sticky\"\n [style.width.px]=\"leftColumnWidth()\">\n <span\n class=\"occ__chevron\"\n [class.is-collapsed]=\"isCollapsed(p.row.key)\"\n >\u25BE</span\n >\n <span class=\"occ__eyebrow\">{{ p.row.label }}</span>\n <span class=\"occ__count\">{{ p.row.laneCount }}</span>\n </div>\n <div\n class=\"occ__lane-bg\"\n [style.left.px]=\"leftColumnWidth()\"\n [style.width.px]=\"dayCount() * dayWidth()\"\n [style.--weekend-offset]=\"weekendOffsetPx() + 'px'\"></div>\n @if (hoverDay() !== null) {\n <div\n class=\"occ__col-hover\"\n aria-hidden=\"true\"\n [style.left.px]=\"leftColumnWidth() + hoverDay()! * dayWidth()\"\n [style.width.px]=\"dayWidth()\"></div>\n }\n </div>\n } @else {\n @let lr = asLaneRow(p.row);\n <!-- data-room-id mirrors data-lane-id for selectors written against the occupancy grid. -->\n <div\n class=\"occ__row occ__row--room\"\n [class.is-inactive]=\"!lr.lane.active\"\n [class.is-move-target]=\"isMoveTarget(lr.lane.id)\"\n [class.is-drop-disabled]=\"isDropDisabled(lr.lane)\"\n [attr.data-lane-id]=\"lr.lane.id\"\n [attr.data-room-id]=\"lr.lane.id\"\n [style.top.px]=\"headerHeight + p.top\"\n [style.height.px]=\"p.height\">\n <div\n class=\"occ__cell occ__cell--sticky occ__room\"\n [style.width.px]=\"leftColumnWidth()\"\n role=\"button\"\n tabindex=\"0\"\n (click)=\"laneClick.emit(lr.lane)\"\n (keydown.enter)=\"laneClick.emit(lr.lane)\">\n <span class=\"occ__room-number\">{{ lr.lane.label }}</span>\n @if (lr.lane.sublabel) {\n <span class=\"occ__room-type\">{{ lr.lane.sublabel }}</span>\n }\n @for (tag of lr.lane.tags ?? []; track tag) {\n <span class=\"occ__lane-tag\">{{ tag }}</span>\n }\n @let taken = takenOn(lr.lane);\n @if (taken !== null) {\n <span\n class=\"occ__room-occ\"\n [udTooltip]=\"\n 'occupancyGrid.takenOn' | translate: { date: from() }\n \"\n [class.is-full]=\"taken >= lr.lane.capacity!\">\n {{ taken }}/{{ lr.lane.capacity }}\n </span>\n }\n </div>\n <div\n class=\"occ__lane-bg\"\n tabindex=\"0\"\n [attr.aria-label]=\"\n createCellLabelKey()\n | translate: { lane: lr.lane.label, room: lr.lane.label }\n \"\n [style.left.px]=\"leftColumnWidth()\"\n [style.width.px]=\"dayCount() * dayWidth()\"\n [style.--weekend-offset]=\"weekendOffsetPx() + 'px'\"\n (mousedown)=\"startCreate($event, lr.lane)\"\n (click)=\"onLaneClick($event, lr.lane)\"\n (mousemove)=\"onLaneMouseMove($event, lr.lane)\"\n (mouseleave)=\"onLaneMouseLeave(lr.lane)\"\n (focus)=\"onLaneFocus(lr.lane)\"\n (blur)=\"onLaneBlur()\"\n (keydown)=\"onLaneKeydown($event, lr.lane)\"\n (dragover)=\"onLaneDragOver($event, lr.lane)\"\n (dragleave)=\"onLaneDragLeave($event, lr.lane)\"\n (drop)=\"onLaneDrop($event, lr.lane)\">\n @for (c of lr.lane.closures; track c.id) {\n @if (closureGeometryOf(c); as g) {\n <div\n class=\"occ__closure\"\n [class.is-cut-left]=\"g.cutLeft\"\n [class.is-cut-right]=\"g.cutRight\"\n [style.left.px]=\"g.left\"\n [style.width.px]=\"g.width\"\n [udTooltip]=\"closureTitle(c)\"\n role=\"button\"\n tabindex=\"0\"\n (mousedown)=\"$event.stopPropagation()\"\n (click)=\"\n $event.stopPropagation();\n closureClick.emit({ closure: c, lane: lr.lane })\n \"\n (keydown.enter)=\"\n closureClick.emit({ closure: c, lane: lr.lane })\n \">\n <span class=\"occ__closure-label\">{{ c.label }}</span>\n </div>\n }\n }\n @if (lr.freeSlot !== null) {\n <div\n class=\"occ__lane-free\"\n [style.top.px]=\"4 + lr.freeSlot * (laneHeight() + 4)\"\n [style.height.px]=\"laneHeight()\"\n (mousedown)=\"\n $event.stopPropagation();\n startCreate($event, lr.lane, lr.freeSlot)\n \"\n (mousemove)=\"\n onLaneMouseMove($event, lr.lane, lr.freeSlot)\n \"></div>\n }\n @for (lb of lr.bars; track lb.bar.id) {\n @if (geometryOf(lb.bar); as g) {\n <div\n class=\"occ__bar\"\n [attr.data-state]=\"lb.bar.state\"\n [class.is-cut-left]=\"g.cutLeft\"\n [class.is-cut-right]=\"g.cutRight\"\n [class.is-open-ended]=\"lb.bar.endDate === null\"\n [class.is-resizing]=\"isResizing(lb.bar.id)\"\n [class.is-moving]=\"isBeingMoved(lb.bar.id)\"\n [style.left.px]=\"g.left + 1\"\n [style.width.px]=\"g.width - 2\"\n [style.top.px]=\"4 + lb.slot * (laneHeight() + 4)\"\n [style.height.px]=\"laneHeight()\"\n [udTooltip]=\"barTitle(lb.bar)\"\n [attr.aria-keyshortcuts]=\"'Shift+ArrowRight Shift+ArrowLeft'\"\n role=\"button\"\n tabindex=\"0\"\n (mousedown)=\"startBarMove($event, lr.lane, lb.bar)\"\n (click)=\"\n $event.stopPropagation(); onBarClick(lb.bar, lr.lane)\n \"\n (keydown.enter)=\"\n barClick.emit({ bar: lb.bar, lane: lr.lane })\n \"\n (keydown)=\"\n onBarKeydownResize($event, lr.lane, lb.bar, lr.bars)\n \">\n @if (!g.cutLeft) {\n <span\n class=\"occ__bar-handle occ__bar-handle--start\"\n aria-hidden=\"true\"\n (mousedown)=\"\n startResize($event, lr.lane, lb.bar, 'start', lr.bars)\n \"\n (click)=\"$event.stopPropagation()\"></span>\n }\n <span class=\"occ__bar-label\">{{ lb.bar.title }}</span>\n @if (lb.bar.subtitle) {\n <span class=\"occ__bar-sub\">{{ lb.bar.subtitle }}</span>\n }\n @if (lb.bar.badge) {\n <span class=\"occ__bar-badge\">{{ lb.bar.badge }}</span>\n }\n @if (!g.cutRight) {\n <span\n class=\"occ__bar-handle occ__bar-handle--end\"\n aria-hidden=\"true\"\n (mousedown)=\"\n startResize($event, lr.lane, lb.bar, 'end', lr.bars)\n \"\n (click)=\"$event.stopPropagation()\"></span>\n }\n </div>\n }\n }\n </div>\n <div class=\"occ__row-hover\" aria-hidden=\"true\"></div>\n @if (hoverDay() !== null) {\n <div\n class=\"occ__col-hover\"\n aria-hidden=\"true\"\n [style.left.px]=\"leftColumnWidth() + hoverDay()! * dayWidth()\"\n [style.width.px]=\"dayWidth()\"></div>\n }\n </div>\n }\n }\n\n <!-- The floating copy of a bar being dragged by its body \u2014 see `moveGhost`. -->\n @if (moveGhost(); as g) {\n <div\n class=\"occ__bar occ__bar--ghost\"\n aria-hidden=\"true\"\n [attr.data-state]=\"g.state\"\n [class.is-cut-right]=\"g.openEnded\"\n [class.is-open-ended]=\"g.openEnded\"\n [style.left.px]=\"g.left\"\n [style.top.px]=\"g.top\"\n [style.width.px]=\"g.width\"\n [style.height.px]=\"g.height\">\n <span class=\"occ__bar-label\">{{ g.label }}</span>\n </div>\n }\n\n <!-- The in-progress drag-to-create's preview span \u2014 see `createGhost`. -->\n @if (createGhost(); as g) {\n <div\n class=\"occ__bar--create\"\n aria-hidden=\"true\"\n [style.left.px]=\"g.left\"\n [style.top.px]=\"g.top\"\n [style.width.px]=\"g.width\"\n [style.height.px]=\"g.height\"></div>\n }\n\n <!-- The hovered or keyboard-focused empty cell \u2014 see `laneCursorGeometry`. -->\n @if (laneCursorGeometry(); as g) {\n <div\n class=\"occ__lane-cursor\"\n aria-hidden=\"true\"\n [style.left.px]=\"g.left\"\n [style.top.px]=\"g.top\"\n [style.width.px]=\"g.width\"\n [style.height.px]=\"g.height\"></div>\n }\n\n @if (rows().length === 0 && !loading()) {\n <div class=\"occ__empty\" [style.top.px]=\"headerHeight\">\n {{ emptyLabelKey() | translate }}\n </div>\n }\n </div>\n </div>\n\n <div class=\"occ__legend\">\n @for (s of legend(); track s.state) {\n <span class=\"occ__legend-item\"\n ><i class=\"occ__swatch\" [attr.data-state]=\"s.state\"></i\n >{{ s.labelKey | translate }}</span\n >\n }\n <span class=\"occ__legend-item\"\n ><i class=\"occ__swatch occ__swatch--closed\"></i\n >{{ 'occupancyGrid.states.closed' | translate }}</span\n >\n </div>\n</div>\n", styles: ["@charset \"UTF-8\";:host{display:block;width:100%;height:var(--ud-occ-height, 640px);--ud-occ-paper: #f5f4f0;--ud-occ-surface: #ffffff;--ud-occ-ink: #1b2535;--ud-occ-muted: #6b7585;--ud-occ-rule: #ebe9e3;--ud-occ-rule-strong: #d9d5cb;--ud-occ-weekend: rgba(27, 37, 53, .035);--ud-occ-today: rgba(74, 127, 232, .1);--ud-occ-accent: #4a7fe8;--ud-occ-crosshair: rgba(27, 37, 53, .06);--ud-occ-tentative-bg: #fff4d6;--ud-occ-tentative-rail: #d97706;--ud-occ-reserved-bg: #dbeafe;--ud-occ-reserved-rail: #1d4ed8;--ud-occ-inroom-bg: #1b2535;--ud-occ-inroom-rail: #4a7fe8;--ud-occ-inroom-ink: #f5f6f7;--ud-occ-history-bg: #ececec;--ud-occ-history-rail: #9aa1ad;--ud-occ-closed: rgba(220, 38, 38, .1);--ud-occ-closed-rail: #dc2626;--ud-occ-radius: 6px;--ud-occ-font: \"Sora\", system-ui, sans-serif;font-family:var(--ud-occ-font);color:var(--ud-occ-ink)}.occ{display:flex;flex-direction:column;height:100%;background:var(--ud-occ-paper);border:1px solid var(--ud-occ-rule-strong);border-radius:10px;overflow:hidden}.occ.is-loading .occ__canvas{opacity:.55}.occ.is-dragging-active{-webkit-user-select:none;user-select:none}.occ__scroller{position:relative;flex:1;min-height:0;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--ud-occ-rule-strong) transparent}.occ__scroller::-webkit-scrollbar{width:10px;height:10px}.occ__scroller::-webkit-scrollbar-track{background:transparent}.occ__scroller::-webkit-scrollbar-thumb{background-color:var(--ud-occ-rule-strong);border-radius:6px;border:2px solid var(--ud-occ-surface)}.occ__scroller::-webkit-scrollbar-thumb:hover{background-color:var(--ud-occ-muted)}.occ__canvas{position:relative}.occ__eyebrow{font-family:var(--ud-occ-font);font-weight:700;font-size:11px;letter-spacing:.09em;text-transform:uppercase;color:var(--ud-occ-muted)}.occ__header{position:sticky;top:0;z-index:4;background:var(--ud-occ-surface);border-bottom:1px solid var(--ud-occ-rule-strong);width:100%}.occ__corner{position:sticky;left:0;z-index:5;height:100%;display:flex;align-items:center;justify-content:space-between;padding:0 8px 0 12px;background:var(--ud-occ-surface);border-right:1px solid var(--ud-occ-rule-strong);box-shadow:2px 0 5px #1b25350d;box-sizing:border-box}.occ__nav{display:flex;gap:2px}.occ__nav-btn{width:22px;height:22px;display:flex;align-items:center;justify-content:center;border:1px solid var(--ud-occ-rule-strong);border-radius:var(--ud-occ-radius);background:var(--ud-occ-surface);color:var(--ud-occ-muted);font-size:14px;line-height:1;cursor:pointer;padding:0;transition:background .12s ease,color .12s ease,transform 80ms ease}.occ__nav-btn:hover{background:var(--ud-occ-weekend);color:var(--ud-occ-ink)}.occ__nav-btn:active{transform:scale(.92)}.occ__nav-btn:focus-visible{outline:2px solid var(--ud-occ-accent);outline-offset:1px}.occ__months,.occ__days{position:absolute;top:0;height:26px}.occ__days{top:26px}.occ__month{position:absolute;top:0;height:26px;line-height:26px;padding-left:8px;font-size:12px;font-weight:600;border-left:1px solid var(--ud-occ-rule-strong);box-sizing:border-box;white-space:nowrap;overflow:hidden}.occ__day{position:absolute;top:0;height:26px;display:flex;flex-direction:column;align-items:center;justify-content:center;font-variant-numeric:tabular-nums;font-size:11px;line-height:1;border-left:1px solid var(--ud-occ-rule);box-sizing:border-box}.occ__day.is-weekend{background:var(--ud-occ-weekend)}.occ__day.is-today{font-weight:700}.occ__day.is-hovered{background:var(--ud-occ-crosshair);box-shadow:inset 0 -2px 0 var(--ud-occ-accent);color:var(--ud-occ-ink);font-weight:700}.occ__day-num{display:inline-flex}.occ__day.is-today .occ__day-num{align-items:center;justify-content:center;width:16px;height:16px;border-radius:50%;background:var(--ud-occ-accent);color:#fff}.occ__day-wd{font-size:9px;color:var(--ud-occ-muted);margin-top:2px}.occ__today{position:absolute;z-index:1;background:var(--ud-occ-today);border-left:1px solid var(--ud-occ-accent);border-right:1px solid var(--ud-occ-accent);box-sizing:border-box;pointer-events:none}.occ__row{position:absolute;left:0;width:100%;box-sizing:border-box;border-bottom:1px solid var(--ud-occ-rule)}.occ__row--group{cursor:pointer;background:var(--ud-occ-paper);z-index:3}.occ__row--group[data-depth=\"0\"] .occ__eyebrow{color:var(--ud-occ-ink)}.occ__row--group[data-depth=\"1\"] .occ__cell--sticky{padding-left:20px}.occ__row--group[data-depth=\"2\"] .occ__cell--sticky{padding-left:32px}.occ__row--room{background:var(--ud-occ-surface);z-index:2}.occ__row--room.is-inactive .occ__room{opacity:.55}.occ__row-hover{position:absolute;inset:0;background:transparent;pointer-events:none;transition:background .1s ease}.occ__row--room:hover .occ__row-hover{background:var(--ud-occ-crosshair)}.occ__row--room:hover .occ__room{background-image:linear-gradient(var(--ud-occ-crosshair),var(--ud-occ-crosshair));box-shadow:inset 3px 0 0 var(--ud-occ-accent)}.occ__col-hover{position:absolute;top:0;bottom:0;background:var(--ud-occ-crosshair);pointer-events:none}.occ__cell--sticky{position:sticky;left:0;z-index:3;height:100%;display:flex;align-items:center;gap:8px;padding:0 12px;background:inherit;border-right:1px solid var(--ud-occ-rule-strong);box-shadow:2px 0 5px #1b25350a;box-sizing:border-box}.occ__chevron{display:inline-block;transition:transform .15s;font-size:12px}.occ__chevron.is-collapsed{transform:rotate(-90deg)}.occ__count{margin-left:auto;font-family:var(--ud-occ-font);font-weight:600;font-variant-numeric:tabular-nums;font-size:11px;color:var(--ud-occ-muted)}.occ__room{cursor:pointer}.occ__room-number{font-weight:600;font-size:13px}.occ__room-type{font-size:11px;color:var(--ud-occ-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.occ__room-occ{margin-left:auto;font-family:var(--ud-occ-font);font-weight:600;font-size:11px;font-variant-numeric:tabular-nums}.occ__room-occ.is-full{color:var(--ud-occ-closed-rail)}.occ__lane-tag{flex-shrink:0;padding:0 5px;border-radius:999px;background:var(--ud-occ-paper);border:1px solid var(--ud-occ-rule-strong);font-size:10px;line-height:15px;color:var(--ud-occ-muted)}.occ__lane-bg{position:absolute;top:0;height:100%;background-image:linear-gradient(to right,var(--ud-occ-rule) 1px,transparent 1px),repeating-linear-gradient(to right,var(--ud-occ-weekend) 0 calc(var(--dw) * 2),transparent calc(var(--dw) * 2) calc(var(--dw) * 7));background-size:var(--dw) 100%,calc(var(--dw) * 7) 100%;background-position:0 0,var(--weekend-offset, 0px) 0}.occ__row--room .occ__lane-bg{cursor:pointer}.occ__lane-free{position:absolute;left:0;right:0;z-index:0;box-sizing:border-box;border-radius:var(--ud-occ-radius);border:1px dashed var(--ud-occ-rule)}.occ__bar{position:absolute;z-index:2;display:flex;align-items:center;padding:0 6px 0 8px;box-sizing:border-box;border-radius:var(--ud-occ-radius);border-left:4px solid var(--ud-occ-accent);font-size:12px;cursor:grab;overflow:hidden;white-space:nowrap;box-shadow:0 1px 2px #1b253514;transition:box-shadow .12s ease,transform .12s ease}.occ__bar:hover{box-shadow:0 3px 8px #1b25352e;transform:translateY(-1px)}.occ__bar-label{overflow:hidden;text-overflow:ellipsis}.occ__bar-sub{margin-left:6px;opacity:.7;overflow:hidden;text-overflow:ellipsis}.occ__bar-badge{margin-left:auto;padding-left:6px;font-size:10px;font-weight:600}.occ__bar.is-moving{opacity:.35;cursor:grabbing}.occ__bar--ghost{z-index:6;cursor:grabbing;pointer-events:none;outline:2px dashed var(--ud-occ-accent);outline-offset:2px;box-shadow:0 8px 20px #1b253552}.occ__row--room.is-move-target .occ__lane-bg{background-color:#4a7fe814}.occ__row--room.is-drop-disabled{opacity:.4;filter:grayscale(1)}.occ__bar--create{position:absolute;z-index:6;box-sizing:border-box;border-radius:var(--ud-occ-radius);background:#4a7fe82e;border:2px dashed var(--ud-occ-accent);pointer-events:none}.occ__lane-cursor{position:absolute;z-index:3;box-sizing:border-box;border-radius:var(--ud-occ-radius);outline:2px solid var(--ud-occ-accent);outline-offset:-2px;pointer-events:none}.occ__bar-handle{position:absolute;top:0;bottom:0;width:8px;cursor:ew-resize;opacity:0;transition:opacity .12s ease}.occ__bar-handle--start{left:0}.occ__bar-handle--end{right:0}.occ__bar:hover .occ__bar-handle,.occ__bar:focus-visible .occ__bar-handle{opacity:1}.occ__bar[data-state=in_room] .occ__bar-handle{background:#ffffff4d}.occ__bar:not([data-state=in_room]) .occ__bar-handle{background:#1b253524}.occ__bar.is-resizing{z-index:5;box-shadow:0 4px 14px #1b253547;outline:2px dashed var(--ud-occ-accent);outline-offset:2px}.occ__bar.is-resizing .occ__bar-handle{opacity:1}.occ__bar[data-state=tentative]{background:var(--ud-occ-tentative-bg);border-left-color:var(--ud-occ-tentative-rail);border-top:1px dashed var(--ud-occ-tentative-rail);border-bottom:1px dashed var(--ud-occ-tentative-rail);border-right:1px dashed var(--ud-occ-tentative-rail)}.occ__bar[data-state=reserved]{background:var(--ud-occ-reserved-bg);border-left-color:var(--ud-occ-reserved-rail)}.occ__bar[data-state=in_room]{background:var(--ud-occ-inroom-bg);border-left-color:var(--ud-occ-inroom-rail);color:var(--ud-occ-inroom-ink)}.occ__bar[data-state=history]{background:var(--ud-occ-history-bg);border-left-color:var(--ud-occ-history-rail)}.occ__bar.is-cut-left{border-top-left-radius:0;border-bottom-left-radius:0;border-left-width:0;padding-left:10px}.occ__bar.is-cut-right{border-top-right-radius:0;border-bottom-right-radius:0}.occ__bar.is-cut-left:before,.occ__bar.is-cut-right:after{content:\"\\203a\";position:absolute;top:0;bottom:0;display:flex;align-items:center;font-size:12px;opacity:.7}.occ__bar.is-cut-left:before{left:2px;content:\"\\2039\"}.occ__bar.is-cut-right:after{right:2px}.occ__bar.is-open-ended{padding-right:16px}.occ__bar.is-open-ended:after{content:\"\\2192\";opacity:.9}.occ__closure{position:absolute;top:0;height:100%;z-index:1;box-sizing:border-box;cursor:pointer;background:repeating-linear-gradient(135deg,var(--ud-occ-closed) 0 6px,transparent 6px 12px);border-left:3px solid var(--ud-occ-closed-rail);border-right:1px solid var(--ud-occ-closed-rail);display:flex;align-items:center;padding-left:8px;font-size:11px;color:var(--ud-occ-closed-rail);overflow:hidden;white-space:nowrap}.occ__closure.is-cut-left{border-left-width:0}.occ__closure.is-cut-right{border-right-width:0}.occ__empty{position:absolute;left:0;right:0;padding:32px;text-align:center;color:var(--ud-occ-muted)}.occ__legend{display:flex;flex-wrap:wrap;align-items:center;gap:16px;padding:10px 12px;border-top:1px solid var(--ud-occ-rule-strong);background:var(--ud-occ-surface);font-size:12px;color:var(--ud-occ-muted)}.occ__legend-item{display:inline-flex;align-items:center;gap:6px}.occ__swatch{width:14px;height:10px;border-radius:2px;border-left:3px solid var(--ud-occ-accent);display:inline-block}.occ__swatch[data-state=tentative]{background:var(--ud-occ-tentative-bg);border-left-color:var(--ud-occ-tentative-rail)}.occ__swatch[data-state=reserved]{background:var(--ud-occ-reserved-bg);border-left-color:var(--ud-occ-reserved-rail)}.occ__swatch[data-state=in_room]{background:var(--ud-occ-inroom-bg);border-left-color:var(--ud-occ-inroom-rail)}.occ__swatch[data-state=history]{background:var(--ud-occ-history-bg);border-left-color:var(--ud-occ-history-rail)}.occ__swatch--closed{background:repeating-linear-gradient(135deg,var(--ud-occ-closed) 0 3px,transparent 3px 6px);border-left-color:var(--ud-occ-closed-rail)}.occ__cell--sticky:focus-visible,.occ__row--group:focus-visible,.occ__bar:focus-visible,.occ__closure:focus-visible{outline:2px solid var(--ud-occ-accent);outline-offset:-2px;z-index:6}.occ__lane-bg:focus-visible{outline:none}@media (prefers-reduced-motion: reduce){.occ__chevron,.occ__nav-btn,.occ__bar,.occ__bar-handle,.occ__row-hover{transition:none}.occ__bar:hover,.occ__nav-btn:active{transform:none}}\n"] }]
|
|
5934
|
+
}], ctorParameters: () => [{ type: i1$4.TranslateService }, { type: i0.DestroyRef }] });
|
|
5935
|
+
|
|
5936
|
+
const OCCUPANCY_GRID_HEADER_HEIGHT = TIMELINE_GRID_HEADER_HEIGHT;
|
|
5937
|
+
const numeric = (a, b) => a.localeCompare(b, undefined, { numeric: true, sensitivity: 'base' });
|
|
5938
|
+
/** A room as a timeline lane under dorm › floor › type headers, numerically ordered. */
|
|
5939
|
+
function roomLanes(rooms, dormName) {
|
|
5940
|
+
return [...rooms]
|
|
5941
|
+
.sort((a, b) => numeric(a.floorLevel, b.floorLevel) ||
|
|
5942
|
+
numeric(a.type, b.type) ||
|
|
5943
|
+
numeric(a.number, b.number) ||
|
|
5944
|
+
a.roomId.localeCompare(b.roomId))
|
|
5945
|
+
.map(room => ({
|
|
5946
|
+
id: room.roomId,
|
|
5947
|
+
label: room.number,
|
|
5948
|
+
sublabel: room.type,
|
|
5949
|
+
groupId: `type:${room.type}`,
|
|
5950
|
+
groupLabel: room.type,
|
|
5951
|
+
parentGroups: [
|
|
5952
|
+
{ id: 'dorm', label: dormName },
|
|
5953
|
+
{ id: `floor:${room.floorLevel}`, label: room.floorLevel },
|
|
5954
|
+
],
|
|
5955
|
+
active: room.active,
|
|
5956
|
+
capacity: room.capacity,
|
|
5957
|
+
bars: room.bars.map((bar) => ({
|
|
5958
|
+
id: bar.bookingId,
|
|
5959
|
+
title: bar.studentName,
|
|
5960
|
+
startDate: bar.startDate,
|
|
5961
|
+
endDate: bar.endDate,
|
|
5962
|
+
continuesBefore: bar.continuesBefore,
|
|
5963
|
+
continuesAfter: bar.continuesAfter,
|
|
5964
|
+
state: bar.state,
|
|
5965
|
+
data: bar,
|
|
5966
|
+
})),
|
|
5967
|
+
closures: room.closures.map((closure) => ({
|
|
5968
|
+
id: closure.closureId,
|
|
5969
|
+
label: closure.reason,
|
|
5970
|
+
startDate: closure.startDate,
|
|
5971
|
+
endDate: closure.endDate,
|
|
5972
|
+
continuesBefore: closure.continuesBefore,
|
|
5973
|
+
continuesAfter: closure.continuesAfter,
|
|
5974
|
+
data: closure,
|
|
5975
|
+
})),
|
|
5976
|
+
data: room,
|
|
5977
|
+
}));
|
|
5978
|
+
}
|
|
5979
|
+
const roomOf = (lane) => lane.data;
|
|
5980
|
+
const barOf = (bar) => bar.data;
|
|
5981
|
+
/**
|
|
5982
|
+
* Rooms as rows, days as columns, one bar per stay (UC-11). Since UC-42 a thin
|
|
5983
|
+
* adapter over `ud-timeline-grid`: rooms become lanes (grouped dorm › floor ›
|
|
5984
|
+
* type), stays become bars, and every generic event is mapped back to the
|
|
5985
|
+
* room/stay one, so its inputs and outputs are what they always were. The one
|
|
5986
|
+
* room-only rule, capacity (`preventOverbooking`), is enforced here.
|
|
5987
|
+
*/
|
|
5988
|
+
class OccupancyGridComponent {
|
|
5989
|
+
translate;
|
|
5990
|
+
snackBar;
|
|
5991
|
+
rooms = input([]);
|
|
5992
|
+
dormName = input('');
|
|
5993
|
+
from = input.required();
|
|
5994
|
+
to = input.required();
|
|
5995
|
+
today = input(null);
|
|
5996
|
+
dayWidth = input(28);
|
|
5997
|
+
leftColumnWidth = input(220);
|
|
5998
|
+
laneHeight = input(22);
|
|
5999
|
+
loading = input(false);
|
|
6000
|
+
/** Days the ‹ / › nav buttons and the ArrowLeft/ArrowRight keys shift the window by. */
|
|
6001
|
+
navStepDays = input(7);
|
|
6002
|
+
/**
|
|
6003
|
+
* When true, a resize or whole-bar move drag is never allowed to leave
|
|
6004
|
+
* two bars in the same room overlapping in time. The default (false)
|
|
6005
|
+
* lets bars in different lanes of the same room legitimately overlap —
|
|
6006
|
+
* an outgoing stay's last few nights next to an incoming one's first, say.
|
|
6007
|
+
*/
|
|
6008
|
+
preventOverlap = input(false);
|
|
6009
|
+
/**
|
|
6010
|
+
* Off by default, like `preventOverlap`: the grid otherwise defers capacity
|
|
6011
|
+
* to the consumer. When set, a create, move or resize that would put more
|
|
6012
|
+
* stays in a room than it has beds on some night is dropped instead of
|
|
6013
|
+
* emitted, the bar stays where it was, and a snackbar says why.
|
|
6014
|
+
*/
|
|
6015
|
+
preventOverbooking = input(false);
|
|
6016
|
+
barClick = output();
|
|
6017
|
+
closureClick = output();
|
|
6018
|
+
roomClick = output();
|
|
6019
|
+
/** An empty day cell was clicked: the room and the date under the pointer. */
|
|
6020
|
+
cellClick = output();
|
|
6021
|
+
reachedEnd = output();
|
|
6022
|
+
/** The signed day delta the nav buttons or an arrow key asked for; see `TimelineGridComponent.windowShift`. */
|
|
6023
|
+
windowShift = output();
|
|
6024
|
+
/** See `OccupancyBarResize` — this reports the proposal; it never applies it. */
|
|
6025
|
+
barResize = output();
|
|
6026
|
+
/** See `OccupancyBarMove` — this reports the proposal; it never applies it. */
|
|
6027
|
+
barMove = output();
|
|
6028
|
+
/** See `OccupancyBarCreate` — this reports the proposal; it never creates a bar itself. */
|
|
6029
|
+
barCreate = output();
|
|
6030
|
+
lanes = computed(() => roomLanes(this.rooms(), this.dormName()));
|
|
6031
|
+
roomOf = roomOf;
|
|
6032
|
+
barOf = barOf;
|
|
6033
|
+
grid = viewChild.required(TimelineGridComponent);
|
|
6034
|
+
/** The live edge drag, as this component held it before UC-42 moved it into the timeline grid. */
|
|
6035
|
+
resize = computed(() => this.grid().activeResize());
|
|
6036
|
+
constructor(translate, snackBar) {
|
|
6037
|
+
this.translate = translate;
|
|
6038
|
+
this.snackBar = snackBar;
|
|
6039
|
+
}
|
|
6040
|
+
onClosureClick(closure, lane) {
|
|
6041
|
+
this.closureClick.emit({
|
|
6042
|
+
closure: closure.data,
|
|
6043
|
+
room: roomOf(lane),
|
|
6044
|
+
});
|
|
6045
|
+
}
|
|
6046
|
+
onBarResize(e) {
|
|
6047
|
+
const room = roomOf(e.lane);
|
|
6048
|
+
const bar = barOf(e.bar);
|
|
6049
|
+
const end = e.proposedEndDate;
|
|
6050
|
+
if (this.rejectIfOverbooked(room, bar.bookingId, e.proposedStartDate, end)) {
|
|
6051
|
+
return;
|
|
6052
|
+
}
|
|
6053
|
+
this.barResize.emit({
|
|
6054
|
+
bar,
|
|
6055
|
+
room,
|
|
6056
|
+
edge: e.edge,
|
|
6057
|
+
previousStartDate: e.previousStartDate,
|
|
6058
|
+
previousEndDate: e.previousEndDate,
|
|
6059
|
+
proposedStartDate: e.proposedStartDate,
|
|
6060
|
+
proposedEndDate: end,
|
|
6061
|
+
});
|
|
6062
|
+
}
|
|
6063
|
+
onBarMove(e) {
|
|
6064
|
+
const toRoom = roomOf(e.toLane);
|
|
6065
|
+
const bar = barOf(e.bar);
|
|
6066
|
+
const end = e.proposedEndDate;
|
|
6067
|
+
if (this.rejectIfOverbooked(toRoom, bar.bookingId, e.proposedStartDate, end)) {
|
|
6068
|
+
return;
|
|
6069
|
+
}
|
|
6070
|
+
this.barMove.emit({
|
|
6071
|
+
bar,
|
|
6072
|
+
fromRoom: roomOf(e.fromLane),
|
|
6073
|
+
toRoom,
|
|
6074
|
+
previousStartDate: e.previousStartDate,
|
|
6075
|
+
previousEndDate: e.previousEndDate,
|
|
6076
|
+
proposedStartDate: e.proposedStartDate,
|
|
6077
|
+
proposedEndDate: end,
|
|
6078
|
+
});
|
|
6079
|
+
}
|
|
6080
|
+
onBarCreate(e) {
|
|
6081
|
+
const room = roomOf(e.lane);
|
|
6082
|
+
if (this.rejectIfOverbooked(room, '', e.proposedStartDate, e.proposedEndDate)) {
|
|
6083
|
+
return;
|
|
6084
|
+
}
|
|
6085
|
+
this.barCreate.emit({
|
|
6086
|
+
room,
|
|
6087
|
+
proposedStartDate: e.proposedStartDate,
|
|
6088
|
+
proposedEndDate: e.proposedEndDate,
|
|
6089
|
+
});
|
|
6090
|
+
}
|
|
6091
|
+
/**
|
|
6092
|
+
* With `preventOverbooking`, a gesture that would put more stays in a room
|
|
6093
|
+
* than it has beds is dropped here, so the bar simply stays where it was,
|
|
6094
|
+
* with a snackbar saying why.
|
|
6095
|
+
*/
|
|
6096
|
+
rejectIfOverbooked(room, bookingId, start, end) {
|
|
6097
|
+
if (!this.preventOverbooking() ||
|
|
6098
|
+
!overbooksRoom(room, bookingId, start, end)) {
|
|
6099
|
+
return false;
|
|
6100
|
+
}
|
|
6101
|
+
this.snackBar.openFromComponent(CustomSnackbarComponent, {
|
|
6102
|
+
horizontalPosition: 'end',
|
|
6103
|
+
verticalPosition: 'top',
|
|
6104
|
+
panelClass: ['custom-snackbar-container'],
|
|
6105
|
+
data: {
|
|
6106
|
+
message: this.translate.instant('occupancyGrid.overbooked', {
|
|
6107
|
+
room: room.number,
|
|
6108
|
+
}),
|
|
6109
|
+
type: SnackbarType.WARNING,
|
|
6110
|
+
duration: 3000,
|
|
6111
|
+
},
|
|
6112
|
+
});
|
|
6113
|
+
return true;
|
|
6114
|
+
}
|
|
6115
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: OccupancyGridComponent, deps: [{ token: i1$4.TranslateService }, { token: i1$2.MatSnackBar }], target: i0.ɵɵFactoryTarget.Component });
|
|
6116
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.19", type: OccupancyGridComponent, isStandalone: true, selector: "ud-occupancy-grid", inputs: { rooms: { classPropertyName: "rooms", publicName: "rooms", isSignal: true, isRequired: false, transformFunction: null }, dormName: { classPropertyName: "dormName", publicName: "dormName", isSignal: true, isRequired: false, transformFunction: null }, from: { classPropertyName: "from", publicName: "from", isSignal: true, isRequired: true, transformFunction: null }, to: { classPropertyName: "to", publicName: "to", isSignal: true, isRequired: true, transformFunction: null }, today: { classPropertyName: "today", publicName: "today", isSignal: true, isRequired: false, transformFunction: null }, dayWidth: { classPropertyName: "dayWidth", publicName: "dayWidth", isSignal: true, isRequired: false, transformFunction: null }, leftColumnWidth: { classPropertyName: "leftColumnWidth", publicName: "leftColumnWidth", isSignal: true, isRequired: false, transformFunction: null }, laneHeight: { classPropertyName: "laneHeight", publicName: "laneHeight", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, navStepDays: { classPropertyName: "navStepDays", publicName: "navStepDays", isSignal: true, isRequired: false, transformFunction: null }, preventOverlap: { classPropertyName: "preventOverlap", publicName: "preventOverlap", isSignal: true, isRequired: false, transformFunction: null }, preventOverbooking: { classPropertyName: "preventOverbooking", publicName: "preventOverbooking", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { barClick: "barClick", closureClick: "closureClick", roomClick: "roomClick", cellClick: "cellClick", reachedEnd: "reachedEnd", windowShift: "windowShift", barResize: "barResize", barMove: "barMove", barCreate: "barCreate" }, viewQueries: [{ propertyName: "grid", first: true, predicate: TimelineGridComponent, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
6117
|
+
<ud-timeline-grid
|
|
6118
|
+
[lanes]="lanes()"
|
|
6119
|
+
[from]="from()"
|
|
6120
|
+
[to]="to()"
|
|
6121
|
+
[today]="today()"
|
|
6122
|
+
[dayWidth]="dayWidth()"
|
|
6123
|
+
[leftColumnWidth]="leftColumnWidth()"
|
|
6124
|
+
[laneHeight]="laneHeight()"
|
|
6125
|
+
[loading]="loading()"
|
|
6126
|
+
[navStepDays]="navStepDays()"
|
|
6127
|
+
[preventOverlap]="preventOverlap()"
|
|
6128
|
+
cornerLabelKey="occupancyGrid.rooms"
|
|
6129
|
+
emptyLabelKey="occupancyGrid.empty"
|
|
6130
|
+
createCellLabelKey="occupancyGrid.createCell"
|
|
6131
|
+
(barClick)="
|
|
6132
|
+
barClick.emit({ bar: barOf($event.bar), room: roomOf($event.lane) })
|
|
6133
|
+
"
|
|
6134
|
+
(closureClick)="onClosureClick($event.closure, $event.lane)"
|
|
6135
|
+
(laneClick)="roomClick.emit(roomOf($event))"
|
|
6136
|
+
(cellClick)="
|
|
6137
|
+
cellClick.emit({ room: roomOf($event.lane), date: $event.date })
|
|
6138
|
+
"
|
|
6139
|
+
(reachedEnd)="reachedEnd.emit($event)"
|
|
6140
|
+
(windowShift)="windowShift.emit($event)"
|
|
6141
|
+
(barResize)="onBarResize($event)"
|
|
6142
|
+
(barMove)="onBarMove($event)"
|
|
6143
|
+
(barCreate)="onBarCreate($event)" />
|
|
6144
|
+
`, isInline: true, styles: [":host{display:block;width:100%;height:var(--ud-occ-height, 640px)}ud-timeline-grid{height:100%}\n"], dependencies: [{ kind: "component", type: TimelineGridComponent, selector: "ud-timeline-grid", inputs: ["lanes", "from", "to", "today", "dayWidth", "leftColumnWidth", "laneHeight", "loading", "navStepDays", "preventOverlap", "cornerLabelKey", "emptyLabelKey", "createCellLabelKey", "legend", "dragPayload", "canDrop"], outputs: ["barClick", "closureClick", "laneClick", "cellClick", "reachedEnd", "windowShift", "barResize", "barMove", "barCreate", "laneDrop"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
5790
6145
|
}
|
|
5791
6146
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: OccupancyGridComponent, decorators: [{
|
|
5792
6147
|
type: Component,
|
|
5793
|
-
args: [{ selector: 'ud-occupancy-grid', standalone: true, imports: [UdTooltipDirective, TranslatePipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"occ\"\n [class.is-loading]=\"loading()\"\n [class.is-dragging-active]=\"\n resize() !== null || move()?.dragging || create()?.dragging\n \"\n [style.--dw]=\"dayWidth() + 'px'\"\n (keydown)=\"onGridKeydown($event)\">\n <div #scroller class=\"occ__scroller\" (scroll)=\"onScroll()\">\n <div\n class=\"occ__canvas\"\n [style.width.px]=\"canvasWidth()\"\n [style.height.px]=\"bodyHeight() + headerHeight\"\n (mousemove)=\"onCanvasMouseMove($event)\"\n (mouseleave)=\"hoverDay.set(null)\">\n <!-- Sticky two-tier header -->\n <div class=\"occ__header\" [style.height.px]=\"headerHeight\">\n <div class=\"occ__corner\" [style.width.px]=\"leftColumnWidth()\">\n <span class=\"occ__eyebrow\">{{\n 'occupancyGrid.rooms' | translate\n }}</span>\n <div class=\"occ__nav\">\n <button\n type=\"button\"\n class=\"occ__nav-btn\"\n [attr.aria-label]=\"'occupancyGrid.nav.prev' | translate\"\n [udTooltip]=\"'occupancyGrid.nav.prev' | translate\"\n (click)=\"shiftWindow(-1)\">\n \u2039\n </button>\n <button\n type=\"button\"\n class=\"occ__nav-btn\"\n [attr.aria-label]=\"'occupancyGrid.nav.next' | translate\"\n [udTooltip]=\"'occupancyGrid.nav.next' | translate\"\n (click)=\"shiftWindow(1)\">\n \u203A\n </button>\n </div>\n </div>\n <div class=\"occ__months\" [style.left.px]=\"leftColumnWidth()\">\n @for (m of months(); track m.label) {\n <div\n class=\"occ__month\"\n [style.left.px]=\"m.left\"\n [style.width.px]=\"m.width\">\n {{ m.label }}\n </div>\n }\n </div>\n <div class=\"occ__days\" [style.left.px]=\"leftColumnWidth()\">\n @for (d of days(); track d.iso) {\n <div\n class=\"occ__day\"\n [class.is-weekend]=\"d.isWeekend\"\n [class.is-today]=\"d.iso === today()\"\n [class.is-hovered]=\"$index === hoverDay()\"\n [style.left.px]=\"d.left\"\n [style.width.px]=\"dayWidth()\">\n <span class=\"occ__day-num\">{{ d.dayOfMonth }}</span>\n <span class=\"occ__day-wd\">{{\n 'occupancyGrid.weekdays.' + d.weekday | translate\n }}</span>\n </div>\n }\n </div>\n </div>\n\n <!-- Today column, behind rows -->\n @if (todayLeft() !== null) {\n <div\n class=\"occ__today\"\n [style.left.px]=\"leftColumnWidth() + todayLeft()!\"\n [style.top.px]=\"headerHeight\"\n [style.width.px]=\"dayWidth()\"\n [style.height.px]=\"bodyHeight()\"></div>\n }\n\n <!-- Virtualized rows -->\n @for (p of visible(); track trackRow($index, p)) {\n @if (p.row.kind === 'group') {\n <div\n class=\"occ__row occ__row--group\"\n [attr.data-depth]=\"p.row.depth\"\n [style.top.px]=\"headerHeight + p.top\"\n [style.height.px]=\"p.height\"\n role=\"button\"\n tabindex=\"0\"\n (click)=\"toggleGroup(p.row.key)\"\n (keydown.enter)=\"toggleGroup(p.row.key)\">\n <div\n class=\"occ__cell occ__cell--sticky\"\n [style.width.px]=\"leftColumnWidth()\">\n <span\n class=\"occ__chevron\"\n [class.is-collapsed]=\"isCollapsed(p.row.key)\"\n >\u25BE</span\n >\n <span class=\"occ__eyebrow\">{{ p.row.label }}</span>\n <span class=\"occ__count\">{{ p.row.roomCount }}</span>\n </div>\n <div\n class=\"occ__lane-bg\"\n [style.left.px]=\"leftColumnWidth()\"\n [style.width.px]=\"dayCount() * dayWidth()\"\n [style.--weekend-offset]=\"weekendOffsetPx() + 'px'\"></div>\n @if (hoverDay() !== null) {\n <div\n class=\"occ__col-hover\"\n aria-hidden=\"true\"\n [style.left.px]=\"leftColumnWidth() + hoverDay()! * dayWidth()\"\n [style.width.px]=\"dayWidth()\"></div>\n }\n </div>\n } @else {\n <div\n class=\"occ__row occ__row--room\"\n [class.is-inactive]=\"!asRoomRow(p.row).room.active\"\n [class.is-move-target]=\"isMoveTarget(asRoomRow(p.row).room.roomId)\"\n [attr.data-room-id]=\"asRoomRow(p.row).room.roomId\"\n [style.top.px]=\"headerHeight + p.top\"\n [style.height.px]=\"p.height\">\n <div\n class=\"occ__cell occ__cell--sticky occ__room\"\n [style.width.px]=\"leftColumnWidth()\"\n role=\"button\"\n tabindex=\"0\"\n (click)=\"roomClick.emit(asRoomRow(p.row).room)\"\n (keydown.enter)=\"roomClick.emit(asRoomRow(p.row).room)\">\n <span class=\"occ__room-number\">{{\n asRoomRow(p.row).room.number\n }}</span>\n <span class=\"occ__room-type\">{{\n asRoomRow(p.row).room.type\n }}</span>\n @if (takenOn(asRoomRow(p.row).room) !== null) {\n <span\n class=\"occ__room-occ\"\n [udTooltip]=\"\n 'occupancyGrid.takenOn' | translate: { date: from() }\n \"\n [class.is-full]=\"\n takenOn(asRoomRow(p.row).room)! >=\n asRoomRow(p.row).room.capacity\n \">\n {{ takenOn(asRoomRow(p.row).room) }}/{{\n asRoomRow(p.row).room.capacity\n }}\n </span>\n }\n </div>\n <div\n class=\"occ__lane-bg\"\n tabindex=\"0\"\n [attr.aria-label]=\"\n 'occupancyGrid.createCell'\n | translate: { room: asRoomRow(p.row).room.number }\n \"\n [style.left.px]=\"leftColumnWidth()\"\n [style.width.px]=\"dayCount() * dayWidth()\"\n [style.--weekend-offset]=\"weekendOffsetPx() + 'px'\"\n (mousedown)=\"startCreate($event, asRoomRow(p.row).room)\"\n (click)=\"onLaneClick($event, asRoomRow(p.row).room)\"\n (mousemove)=\"onLaneMouseMove($event, asRoomRow(p.row).room)\"\n (mouseleave)=\"onLaneMouseLeave(asRoomRow(p.row).room)\"\n (focus)=\"onLaneFocus(asRoomRow(p.row).room)\"\n (blur)=\"onLaneBlur()\"\n (keydown)=\"onLaneKeydown($event, asRoomRow(p.row).room)\">\n @for (c of asRoomRow(p.row).room.closures; track c.closureId) {\n @if (closureGeometryOf(c); as g) {\n <div\n class=\"occ__closure\"\n [class.is-cut-left]=\"g.cutLeft\"\n [class.is-cut-right]=\"g.cutRight\"\n [style.left.px]=\"g.left\"\n [style.width.px]=\"g.width\"\n [udTooltip]=\"closureTitle(c)\"\n role=\"button\"\n tabindex=\"0\"\n (mousedown)=\"$event.stopPropagation()\"\n (click)=\"\n $event.stopPropagation();\n closureClick.emit({\n closure: c,\n room: asRoomRow(p.row).room,\n })\n \"\n (keydown.enter)=\"\n closureClick.emit({\n closure: c,\n room: asRoomRow(p.row).room,\n })\n \">\n <span class=\"occ__closure-label\">{{ c.reason }}</span>\n </div>\n }\n }\n @if (asRoomRow(p.row).freeLane !== null) {\n <div\n class=\"occ__lane-free\"\n [style.top.px]=\"\n 4 + asRoomRow(p.row).freeLane! * (laneHeight() + 4)\n \"\n [style.height.px]=\"laneHeight()\"\n (mousedown)=\"\n $event.stopPropagation();\n startCreate(\n $event,\n asRoomRow(p.row).room,\n asRoomRow(p.row).freeLane!\n )\n \"\n (mousemove)=\"\n onLaneMouseMove(\n $event,\n asRoomRow(p.row).room,\n asRoomRow(p.row).freeLane!\n )\n \"></div>\n }\n @for (lb of asRoomRow(p.row).bars; track lb.bar.bookingId) {\n @if (geometryOf(lb.bar); as g) {\n <div\n class=\"occ__bar\"\n [attr.data-state]=\"lb.bar.state\"\n [class.is-cut-left]=\"g.cutLeft\"\n [class.is-cut-right]=\"g.cutRight\"\n [class.is-resizing]=\"isResizing(lb.bar.bookingId)\"\n [class.is-moving]=\"isBeingMoved(lb.bar.bookingId)\"\n [style.left.px]=\"g.left + 1\"\n [style.width.px]=\"g.width - 2\"\n [style.top.px]=\"4 + lb.lane * (laneHeight() + 4)\"\n [style.height.px]=\"laneHeight()\"\n [udTooltip]=\"barTitle(lb.bar)\"\n [attr.aria-keyshortcuts]=\"'Shift+ArrowRight Shift+ArrowLeft'\"\n role=\"button\"\n tabindex=\"0\"\n (mousedown)=\"\n startBarMove($event, asRoomRow(p.row).room, lb.bar)\n \"\n (click)=\"\n $event.stopPropagation();\n onBarClick(lb.bar, asRoomRow(p.row).room)\n \"\n (keydown.enter)=\"\n barClick.emit({\n bar: lb.bar,\n room: asRoomRow(p.row).room,\n })\n \"\n (keydown)=\"\n onBarKeydownResize(\n $event,\n asRoomRow(p.row).room,\n lb.bar,\n asRoomRow(p.row).bars\n )\n \">\n @if (!g.cutLeft) {\n <span\n class=\"occ__bar-handle occ__bar-handle--start\"\n aria-hidden=\"true\"\n (mousedown)=\"\n startResize(\n $event,\n asRoomRow(p.row).room,\n lb.bar,\n 'start',\n asRoomRow(p.row).bars\n )\n \"\n (click)=\"$event.stopPropagation()\"></span>\n }\n <span class=\"occ__bar-label\">{{ lb.bar.studentName }}</span>\n @if (!g.cutRight) {\n <span\n class=\"occ__bar-handle occ__bar-handle--end\"\n aria-hidden=\"true\"\n (mousedown)=\"\n startResize(\n $event,\n asRoomRow(p.row).room,\n lb.bar,\n 'end',\n asRoomRow(p.row).bars\n )\n \"\n (click)=\"$event.stopPropagation()\"></span>\n }\n </div>\n }\n }\n </div>\n <div class=\"occ__row-hover\" aria-hidden=\"true\"></div>\n @if (hoverDay() !== null) {\n <div\n class=\"occ__col-hover\"\n aria-hidden=\"true\"\n [style.left.px]=\"leftColumnWidth() + hoverDay()! * dayWidth()\"\n [style.width.px]=\"dayWidth()\"></div>\n }\n </div>\n }\n }\n\n <!-- The floating copy of a bar being dragged by its body \u2014 see `moveGhost`. -->\n @if (moveGhost(); as g) {\n <div\n class=\"occ__bar occ__bar--ghost\"\n aria-hidden=\"true\"\n [attr.data-state]=\"g.state\"\n [style.left.px]=\"g.left\"\n [style.top.px]=\"g.top\"\n [style.width.px]=\"g.width\"\n [style.height.px]=\"g.height\">\n <span class=\"occ__bar-label\">{{ g.label }}</span>\n </div>\n }\n\n <!-- The in-progress drag-to-create's preview span \u2014 see `createGhost`. -->\n @if (createGhost(); as g) {\n <div\n class=\"occ__bar--create\"\n aria-hidden=\"true\"\n [style.left.px]=\"g.left\"\n [style.top.px]=\"g.top\"\n [style.width.px]=\"g.width\"\n [style.height.px]=\"g.height\"></div>\n }\n\n <!-- The hovered or keyboard-focused empty cell \u2014 see `laneCursorGeometry`. -->\n @if (laneCursorGeometry(); as g) {\n <div\n class=\"occ__lane-cursor\"\n aria-hidden=\"true\"\n [style.left.px]=\"g.left\"\n [style.top.px]=\"g.top\"\n [style.width.px]=\"g.width\"\n [style.height.px]=\"g.height\"></div>\n }\n\n @if (rows().length === 0 && !loading()) {\n <div class=\"occ__empty\" [style.top.px]=\"headerHeight\">\n {{ 'occupancyGrid.empty' | translate }}\n </div>\n }\n </div>\n </div>\n\n <div class=\"occ__legend\">\n @for (s of ['tentative', 'reserved', 'in_room', 'history']; track s) {\n <span class=\"occ__legend-item\"\n ><i class=\"occ__swatch\" [attr.data-state]=\"s\"></i\n >{{ 'occupancyGrid.states.' + s | translate }}</span\n >\n }\n <span class=\"occ__legend-item\"\n ><i class=\"occ__swatch occ__swatch--closed\"></i\n >{{ 'occupancyGrid.states.closed' | translate }}</span\n >\n </div>\n</div>\n", styles: ["@charset \"UTF-8\";:host{display:block;width:100%;height:var(--ud-occ-height, 640px);--ud-occ-paper: #f5f4f0;--ud-occ-surface: #ffffff;--ud-occ-ink: #1b2535;--ud-occ-muted: #6b7585;--ud-occ-rule: #ebe9e3;--ud-occ-rule-strong: #d9d5cb;--ud-occ-weekend: rgba(27, 37, 53, .035);--ud-occ-today: rgba(74, 127, 232, .1);--ud-occ-accent: #4a7fe8;--ud-occ-crosshair: rgba(27, 37, 53, .06);--ud-occ-tentative-bg: #fff4d6;--ud-occ-tentative-rail: #d97706;--ud-occ-reserved-bg: #dbeafe;--ud-occ-reserved-rail: #1d4ed8;--ud-occ-inroom-bg: #1b2535;--ud-occ-inroom-rail: #4a7fe8;--ud-occ-inroom-ink: #f5f6f7;--ud-occ-history-bg: #ececec;--ud-occ-history-rail: #9aa1ad;--ud-occ-closed: rgba(220, 38, 38, .1);--ud-occ-closed-rail: #dc2626;--ud-occ-radius: 6px;--ud-occ-font: \"Sora\", system-ui, sans-serif;font-family:var(--ud-occ-font);color:var(--ud-occ-ink)}.occ{display:flex;flex-direction:column;height:100%;background:var(--ud-occ-paper);border:1px solid var(--ud-occ-rule-strong);border-radius:10px;overflow:hidden}.occ.is-loading .occ__canvas{opacity:.55}.occ.is-dragging-active{-webkit-user-select:none;user-select:none}.occ__scroller{position:relative;flex:1;min-height:0;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--ud-occ-rule-strong) transparent}.occ__scroller::-webkit-scrollbar{width:10px;height:10px}.occ__scroller::-webkit-scrollbar-track{background:transparent}.occ__scroller::-webkit-scrollbar-thumb{background-color:var(--ud-occ-rule-strong);border-radius:6px;border:2px solid var(--ud-occ-surface)}.occ__scroller::-webkit-scrollbar-thumb:hover{background-color:var(--ud-occ-muted)}.occ__canvas{position:relative}.occ__eyebrow{font-family:var(--ud-occ-font);font-weight:700;font-size:11px;letter-spacing:.09em;text-transform:uppercase;color:var(--ud-occ-muted)}.occ__header{position:sticky;top:0;z-index:4;background:var(--ud-occ-surface);border-bottom:1px solid var(--ud-occ-rule-strong);width:100%}.occ__corner{position:sticky;left:0;z-index:5;height:100%;display:flex;align-items:center;justify-content:space-between;padding:0 8px 0 12px;background:var(--ud-occ-surface);border-right:1px solid var(--ud-occ-rule-strong);box-shadow:2px 0 5px #1b25350d;box-sizing:border-box}.occ__nav{display:flex;gap:2px}.occ__nav-btn{width:22px;height:22px;display:flex;align-items:center;justify-content:center;border:1px solid var(--ud-occ-rule-strong);border-radius:var(--ud-occ-radius);background:var(--ud-occ-surface);color:var(--ud-occ-muted);font-size:14px;line-height:1;cursor:pointer;padding:0;transition:background .12s ease,color .12s ease,transform 80ms ease}.occ__nav-btn:hover{background:var(--ud-occ-weekend);color:var(--ud-occ-ink)}.occ__nav-btn:active{transform:scale(.92)}.occ__nav-btn:focus-visible{outline:2px solid var(--ud-occ-accent);outline-offset:1px}.occ__months,.occ__days{position:absolute;top:0;height:26px}.occ__days{top:26px}.occ__month{position:absolute;top:0;height:26px;line-height:26px;padding-left:8px;font-size:12px;font-weight:600;border-left:1px solid var(--ud-occ-rule-strong);box-sizing:border-box;white-space:nowrap;overflow:hidden}.occ__day{position:absolute;top:0;height:26px;display:flex;flex-direction:column;align-items:center;justify-content:center;font-variant-numeric:tabular-nums;font-size:11px;line-height:1;border-left:1px solid var(--ud-occ-rule);box-sizing:border-box}.occ__day.is-weekend{background:var(--ud-occ-weekend)}.occ__day.is-today{font-weight:700}.occ__day.is-hovered{background:var(--ud-occ-crosshair);box-shadow:inset 0 -2px 0 var(--ud-occ-accent);color:var(--ud-occ-ink);font-weight:700}.occ__day-num{display:inline-flex}.occ__day.is-today .occ__day-num{align-items:center;justify-content:center;width:16px;height:16px;border-radius:50%;background:var(--ud-occ-accent);color:#fff}.occ__day-wd{font-size:9px;color:var(--ud-occ-muted);margin-top:2px}.occ__today{position:absolute;z-index:1;background:var(--ud-occ-today);border-left:1px solid var(--ud-occ-accent);border-right:1px solid var(--ud-occ-accent);box-sizing:border-box;pointer-events:none}.occ__row{position:absolute;left:0;width:100%;box-sizing:border-box;border-bottom:1px solid var(--ud-occ-rule)}.occ__row--group{cursor:pointer;background:var(--ud-occ-paper);z-index:3}.occ__row--group[data-depth=\"0\"] .occ__eyebrow{color:var(--ud-occ-ink)}.occ__row--group[data-depth=\"1\"] .occ__cell--sticky{padding-left:20px}.occ__row--group[data-depth=\"2\"] .occ__cell--sticky{padding-left:32px}.occ__row--room{background:var(--ud-occ-surface);z-index:2}.occ__row--room.is-inactive .occ__room{opacity:.55}.occ__row-hover{position:absolute;inset:0;background:transparent;pointer-events:none;transition:background .1s ease}.occ__row--room:hover .occ__row-hover{background:var(--ud-occ-crosshair)}.occ__row--room:hover .occ__room{background-image:linear-gradient(var(--ud-occ-crosshair),var(--ud-occ-crosshair));box-shadow:inset 3px 0 0 var(--ud-occ-accent)}.occ__col-hover{position:absolute;top:0;bottom:0;background:var(--ud-occ-crosshair);pointer-events:none}.occ__cell--sticky{position:sticky;left:0;z-index:3;height:100%;display:flex;align-items:center;gap:8px;padding:0 12px;background:inherit;border-right:1px solid var(--ud-occ-rule-strong);box-shadow:2px 0 5px #1b25350a;box-sizing:border-box}.occ__chevron{display:inline-block;transition:transform .15s;font-size:12px}.occ__chevron.is-collapsed{transform:rotate(-90deg)}.occ__count{margin-left:auto;font-family:var(--ud-occ-font);font-weight:600;font-variant-numeric:tabular-nums;font-size:11px;color:var(--ud-occ-muted)}.occ__room{cursor:pointer}.occ__room-number{font-weight:600;font-size:13px}.occ__room-type{font-size:11px;color:var(--ud-occ-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.occ__room-occ{margin-left:auto;font-family:var(--ud-occ-font);font-weight:600;font-size:11px;font-variant-numeric:tabular-nums}.occ__room-occ.is-full{color:var(--ud-occ-closed-rail)}.occ__lane-bg{position:absolute;top:0;height:100%;background-image:linear-gradient(to right,var(--ud-occ-rule) 1px,transparent 1px),repeating-linear-gradient(to right,var(--ud-occ-weekend) 0 calc(var(--dw) * 2),transparent calc(var(--dw) * 2) calc(var(--dw) * 7));background-size:var(--dw) 100%,calc(var(--dw) * 7) 100%;background-position:0 0,var(--weekend-offset, 0px) 0}.occ__row--room .occ__lane-bg{cursor:pointer}.occ__lane-free{position:absolute;left:0;right:0;z-index:0;box-sizing:border-box;border-radius:var(--ud-occ-radius);border:1px dashed var(--ud-occ-rule)}.occ__bar{position:absolute;z-index:2;display:flex;align-items:center;padding:0 6px 0 8px;box-sizing:border-box;border-radius:var(--ud-occ-radius);border-left:4px solid var(--ud-occ-accent);font-size:12px;cursor:grab;overflow:hidden;white-space:nowrap;box-shadow:0 1px 2px #1b253514;transition:box-shadow .12s ease,transform .12s ease}.occ__bar:hover{box-shadow:0 3px 8px #1b25352e;transform:translateY(-1px)}.occ__bar-label{overflow:hidden;text-overflow:ellipsis}.occ__bar.is-moving{opacity:.35;cursor:grabbing}.occ__bar--ghost{z-index:6;cursor:grabbing;pointer-events:none;outline:2px dashed var(--ud-occ-accent);outline-offset:2px;box-shadow:0 8px 20px #1b253552}.occ__row--room.is-move-target .occ__lane-bg{background-color:#4a7fe814}.occ__bar--create{position:absolute;z-index:6;box-sizing:border-box;border-radius:var(--ud-occ-radius);background:#4a7fe82e;border:2px dashed var(--ud-occ-accent);pointer-events:none}.occ__lane-cursor{position:absolute;z-index:3;box-sizing:border-box;border-radius:var(--ud-occ-radius);outline:2px solid var(--ud-occ-accent);outline-offset:-2px;pointer-events:none}.occ__bar-handle{position:absolute;top:0;bottom:0;width:8px;cursor:ew-resize;opacity:0;transition:opacity .12s ease}.occ__bar-handle--start{left:0}.occ__bar-handle--end{right:0}.occ__bar:hover .occ__bar-handle,.occ__bar:focus-visible .occ__bar-handle{opacity:1}.occ__bar[data-state=in_room] .occ__bar-handle{background:#ffffff4d}.occ__bar:not([data-state=in_room]) .occ__bar-handle{background:#1b253524}.occ__bar.is-resizing{z-index:5;box-shadow:0 4px 14px #1b253547;outline:2px dashed var(--ud-occ-accent);outline-offset:2px}.occ__bar.is-resizing .occ__bar-handle{opacity:1}.occ__bar[data-state=tentative]{background:var(--ud-occ-tentative-bg);border-left-color:var(--ud-occ-tentative-rail);border-top:1px dashed var(--ud-occ-tentative-rail);border-bottom:1px dashed var(--ud-occ-tentative-rail);border-right:1px dashed var(--ud-occ-tentative-rail)}.occ__bar[data-state=reserved]{background:var(--ud-occ-reserved-bg);border-left-color:var(--ud-occ-reserved-rail)}.occ__bar[data-state=in_room]{background:var(--ud-occ-inroom-bg);border-left-color:var(--ud-occ-inroom-rail);color:var(--ud-occ-inroom-ink)}.occ__bar[data-state=history]{background:var(--ud-occ-history-bg);border-left-color:var(--ud-occ-history-rail)}.occ__bar.is-cut-left{border-top-left-radius:0;border-bottom-left-radius:0;border-left-width:0;padding-left:10px}.occ__bar.is-cut-right{border-top-right-radius:0;border-bottom-right-radius:0}.occ__bar.is-cut-left:before,.occ__bar.is-cut-right:after{content:\"\\203a\";position:absolute;top:0;bottom:0;display:flex;align-items:center;font-size:12px;opacity:.7}.occ__bar.is-cut-left:before{left:2px;content:\"\\2039\"}.occ__bar.is-cut-right:after{right:2px}.occ__closure{position:absolute;top:0;height:100%;z-index:1;box-sizing:border-box;cursor:pointer;background:repeating-linear-gradient(135deg,var(--ud-occ-closed) 0 6px,transparent 6px 12px);border-left:3px solid var(--ud-occ-closed-rail);border-right:1px solid var(--ud-occ-closed-rail);display:flex;align-items:center;padding-left:8px;font-size:11px;color:var(--ud-occ-closed-rail);overflow:hidden;white-space:nowrap}.occ__closure.is-cut-left{border-left-width:0}.occ__closure.is-cut-right{border-right-width:0}.occ__empty{position:absolute;left:0;right:0;padding:32px;text-align:center;color:var(--ud-occ-muted)}.occ__legend{display:flex;flex-wrap:wrap;align-items:center;gap:16px;padding:10px 12px;border-top:1px solid var(--ud-occ-rule-strong);background:var(--ud-occ-surface);font-size:12px;color:var(--ud-occ-muted)}.occ__legend-item{display:inline-flex;align-items:center;gap:6px}.occ__swatch{width:14px;height:10px;border-radius:2px;border-left:3px solid var(--ud-occ-accent);display:inline-block}.occ__swatch[data-state=tentative]{background:var(--ud-occ-tentative-bg);border-left-color:var(--ud-occ-tentative-rail)}.occ__swatch[data-state=reserved]{background:var(--ud-occ-reserved-bg);border-left-color:var(--ud-occ-reserved-rail)}.occ__swatch[data-state=in_room]{background:var(--ud-occ-inroom-bg);border-left-color:var(--ud-occ-inroom-rail)}.occ__swatch[data-state=history]{background:var(--ud-occ-history-bg);border-left-color:var(--ud-occ-history-rail)}.occ__swatch--closed{background:repeating-linear-gradient(135deg,var(--ud-occ-closed) 0 3px,transparent 3px 6px);border-left-color:var(--ud-occ-closed-rail)}.occ__cell--sticky:focus-visible,.occ__row--group:focus-visible,.occ__bar:focus-visible,.occ__closure:focus-visible{outline:2px solid var(--ud-occ-accent);outline-offset:-2px;z-index:6}.occ__lane-bg:focus-visible{outline:none}@media (prefers-reduced-motion: reduce){.occ__chevron,.occ__nav-btn,.occ__bar,.occ__bar-handle,.occ__row-hover{transition:none}.occ__bar:hover,.occ__nav-btn:active{transform:none}}\n"] }]
|
|
5794
|
-
|
|
6148
|
+
args: [{ selector: 'ud-occupancy-grid', standalone: true, imports: [TimelineGridComponent], template: `
|
|
6149
|
+
<ud-timeline-grid
|
|
6150
|
+
[lanes]="lanes()"
|
|
6151
|
+
[from]="from()"
|
|
6152
|
+
[to]="to()"
|
|
6153
|
+
[today]="today()"
|
|
6154
|
+
[dayWidth]="dayWidth()"
|
|
6155
|
+
[leftColumnWidth]="leftColumnWidth()"
|
|
6156
|
+
[laneHeight]="laneHeight()"
|
|
6157
|
+
[loading]="loading()"
|
|
6158
|
+
[navStepDays]="navStepDays()"
|
|
6159
|
+
[preventOverlap]="preventOverlap()"
|
|
6160
|
+
cornerLabelKey="occupancyGrid.rooms"
|
|
6161
|
+
emptyLabelKey="occupancyGrid.empty"
|
|
6162
|
+
createCellLabelKey="occupancyGrid.createCell"
|
|
6163
|
+
(barClick)="
|
|
6164
|
+
barClick.emit({ bar: barOf($event.bar), room: roomOf($event.lane) })
|
|
6165
|
+
"
|
|
6166
|
+
(closureClick)="onClosureClick($event.closure, $event.lane)"
|
|
6167
|
+
(laneClick)="roomClick.emit(roomOf($event))"
|
|
6168
|
+
(cellClick)="
|
|
6169
|
+
cellClick.emit({ room: roomOf($event.lane), date: $event.date })
|
|
6170
|
+
"
|
|
6171
|
+
(reachedEnd)="reachedEnd.emit($event)"
|
|
6172
|
+
(windowShift)="windowShift.emit($event)"
|
|
6173
|
+
(barResize)="onBarResize($event)"
|
|
6174
|
+
(barMove)="onBarMove($event)"
|
|
6175
|
+
(barCreate)="onBarCreate($event)" />
|
|
6176
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:block;width:100%;height:var(--ud-occ-height, 640px)}ud-timeline-grid{height:100%}\n"] }]
|
|
6177
|
+
}], ctorParameters: () => [{ type: i1$4.TranslateService }, { type: i1$2.MatSnackBar }] });
|
|
5795
6178
|
|
|
5796
6179
|
class SummaryViewComponent {
|
|
5797
6180
|
clipboard = inject(Clipboard);
|
|
@@ -5824,7 +6207,7 @@ class SummaryViewComponent {
|
|
|
5824
6207
|
clearTimeout(this.resetTimer);
|
|
5825
6208
|
}
|
|
5826
6209
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: SummaryViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5827
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.19", type: SummaryViewComponent, isStandalone: true, selector: "ud-summary-view", inputs: { title: "title", actions: "actions", summaryFields: "summaryFields", loading: "loading", layout: "layout", skeletonTitleHeight: "skeletonTitleHeight", skeletonBodyHeight: "skeletonBodyHeight", copyLabel: "copyLabel", copiedLabel: "copiedLabel" }, ngImport: i0, template: "<div class=\"summary-view-container\">\n <div class=\"header\">\n @if (loading) {\n <ngx-skeleton-loader\n class=\"loading col-6\"\n [count]=\"1\"\n [theme]=\"{ height: skeletonTitleHeight }\" />\n } @else {\n <h5 class=\"header-title\">{{ title }}</h5>\n }\n <div class=\"header-actions\">\n @for (action of actions; track action.label) {\n @if (action.isAuthorized) {\n @if (action.path) {\n <ud-button\n variant=\"stroked\"\n color=\"primary\"\n size=\"sm\"\n [icon]=\"action.icon\"\n [routerLink]=\"action.path\">\n {{ action.label | translate | capitalize }}\n </ud-button>\n } @else if (action.onClick) {\n <ud-button\n variant=\"stroked\"\n color=\"primary\"\n size=\"sm\"\n [icon]=\"action.icon\"\n (buttonClick)=\"action.onClick!()\">\n {{ action.label | translate | capitalize }}\n </ud-button>\n }\n }\n }\n <ng-content select=\"[header-actions]\" />\n </div>\n </div>\n <div\n class=\"content\"\n [ngClass]=\"{\n reverse: layout === 'text-right',\n 'flex-column': layout === 'text-top',\n }\">\n @if (loading) {\n <ngx-skeleton-loader\n class=\"col\"\n [count]=\"1\"\n [theme]=\"{ height: skeletonBodyHeight }\" />\n } @else {\n @if (layout !== 'text-none') {\n <div [ngClass]=\"layout === 'text-top' || layout === 'text-all' ? 'col-12' : 'col-6'\">\n <div class=\"summary\" [ngClass]=\"{ 'summary-row-wrap': layout === 'text-top' || layout === 'text-all' }\">\n @for (summaryField of summaryFields; track $index) {\n <div class=\"summary-field\">\n @if (summaryField.label) {\n <span>{{ summaryField.label | capitalize }}</span>\n }\n <div class=\"summary-row\">\n <mat-icon
|
|
6210
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.19", type: SummaryViewComponent, isStandalone: true, selector: "ud-summary-view", inputs: { title: "title", actions: "actions", summaryFields: "summaryFields", loading: "loading", layout: "layout", skeletonTitleHeight: "skeletonTitleHeight", skeletonBodyHeight: "skeletonBodyHeight", copyLabel: "copyLabel", copiedLabel: "copiedLabel" }, ngImport: i0, template: "<div class=\"summary-view-container\">\n <div class=\"header\">\n @if (loading) {\n <ngx-skeleton-loader\n class=\"loading col-6\"\n [count]=\"1\"\n [theme]=\"{ height: skeletonTitleHeight }\" />\n } @else {\n <h5 class=\"header-title\">{{ title }}</h5>\n }\n <div class=\"header-actions\">\n @for (action of actions; track action.label) {\n @if (action.isAuthorized) {\n @if (action.path) {\n <ud-button\n variant=\"stroked\"\n color=\"primary\"\n size=\"sm\"\n [icon]=\"action.icon\"\n [routerLink]=\"action.path\">\n {{ action.label | translate | capitalize }}\n </ud-button>\n } @else if (action.onClick) {\n <ud-button\n variant=\"stroked\"\n color=\"primary\"\n size=\"sm\"\n [icon]=\"action.icon\"\n (buttonClick)=\"action.onClick!()\">\n {{ action.label | translate | capitalize }}\n </ud-button>\n }\n }\n }\n <ng-content select=\"[header-actions]\" />\n </div>\n </div>\n <div\n class=\"content\"\n [ngClass]=\"{\n reverse: layout === 'text-right',\n 'flex-column': layout === 'text-top',\n }\">\n @if (loading) {\n <ngx-skeleton-loader\n class=\"col\"\n [count]=\"1\"\n [theme]=\"{ height: skeletonBodyHeight }\" />\n } @else {\n @if (layout !== 'text-none') {\n <div [ngClass]=\"layout === 'text-top' || layout === 'text-all' ? 'col-12' : 'col-6'\">\n <div class=\"summary\" [ngClass]=\"{ 'summary-row-wrap': layout === 'text-top' || layout === 'text-all' }\">\n @for (summaryField of summaryFields; track $index) {\n <div class=\"summary-field\">\n @if (summaryField.label) {\n <div class=\"summary-label\">\n <mat-icon fontSet=\"material-icons-outlined\">{{ summaryField.icon }}</mat-icon>\n <span>{{ summaryField.label | capitalize }}</span>\n </div>\n }\n <div class=\"summary-row\">\n @if (!summaryField.label) {\n <mat-icon fontSet=\"material-icons-outlined\">{{ summaryField.icon }}</mat-icon>\n }\n <mat-label>{{ summaryField.value }}</mat-label>\n @if (summaryField.copyable && hasValue(summaryField)) {\n <div class=\"summary-copy\" [class.is-copied]=\"copiedIndex() === $index\">\n <ud-button\n variant=\"icon-only\"\n color=\"secondary\"\n size=\"sm\"\n [icon]=\"copiedIndex() === $index ? 'check' : 'content_copy'\"\n [udTooltip]=\"(copiedIndex() === $index ? copiedLabel : copyLabel) | translate | capitalize\"\n (buttonClick)=\"copy(summaryField, $index)\" />\n </div>\n }\n </div>\n </div>\n }\n </div>\n </div>\n }\n @if (layout !== 'text-all') {\n <div\n class=\"content-body\"\n [ngClass]=\"{\n 'col-12': layout === 'text-none' || layout === 'text-top',\n 'col-6': layout !== 'text-none' && layout !== 'text-top',\n }\">\n <ng-content></ng-content>\n </div>\n }\n }\n </div>\n</div>\n", styles: [".summary-view-container{justify-self:center;width:100%;border-radius:12px;overflow:hidden;box-shadow:0 0 0 1px #1b253512,0 4px 16px #1b253514;font-family:Sora,system-ui,sans-serif}.header{display:flex;justify-content:space-between;align-items:center;padding:14px 20px;background:#1b2535;min-height:52px}.header .header-title{margin:0;font-family:Sora,system-ui,sans-serif;font-size:.9rem;font-weight:600;color:#fff;letter-spacing:.02em}.header .header-actions{display:flex;align-items:center;gap:8px}.header .header-actions ::ng-deep .ud-btn{border-color:#ffffff4d!important;color:#ffffffd9!important}.header .header-actions ::ng-deep .ud-btn:hover{background:#ffffff1a!important;border-color:#ffffff80!important;color:#fff!important}.header .header-actions ::ng-deep .ud-btn .mat-icon{color:inherit!important}.header .loading{padding:.5rem;border-radius:4px}.header .loading ::ng-deep .skeleton-loader{background:#ffffff1f!important;background-image:linear-gradient(90deg,#ffffff1f,#ffffff38,#ffffff1f 80px)!important}.content{display:flex;flex-wrap:wrap;background:#fff}.content:not(.flex-column):has(.content-body>*)>.col-6:first-child{border-right:1px solid #e8eaee}.content.reverse:has(.content-body>*)>.col-6:last-child{border-right:1px solid #e8eaee;border-left:none}.summary{display:flex;flex-direction:column;gap:0;padding:20px 24px}.summary.summary-row-wrap{flex-direction:row;flex-wrap:wrap;gap:.25rem;padding:16px 8px}.summary-field{display:flex;flex-direction:column;gap:3px;padding:10px 16px;border-radius:8px;transition:background .15s ease}.summary-field:hover{background:#f4f5f7}.summary-row-wrap .summary-field{padding:12px 16px;min-width:140px;border:1px solid #e8eaee}.summary-label,.summary-row{display:flex;align-items:center;gap:6px}.summary-label mat-icon,.summary-row mat-icon{height:14px;width:14px;min-width:14px;font-size:14px;color:#6b7585;flex-shrink:0}.summary-label span{font-family:Sora,system-ui,sans-serif;font-size:.75rem;font-weight:500;color:#6b7585;line-height:1.4}mat-label{font-family:Sora,system-ui,sans-serif;font-size:.9375rem;font-weight:500;color:#1b2535;line-height:1.4}.content-body:has(>*){background:#f4f5f7;padding:20px 24px}.flex-column>.content-body:has(>*){border-top:1px solid #e8eaee}.summary-copy{display:inline-flex;align-items:center;height:1em;margin-left:2px;opacity:0;transition:opacity .12s ease}.summary-field:hover .summary-copy,.summary-copy:focus-within,.summary-copy.is-copied{opacity:1}@media (hover: none){.summary-copy{opacity:1}}@media (prefers-reduced-motion: reduce){.summary-copy{transition:none}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: CapitalizePipe, name: "capitalize" }, { kind: "pipe", type: TranslatePipe, name: "translate" }, { kind: "ngmodule", type: NgxSkeletonLoaderModule }, { kind: "component", type: i2$5.NgxSkeletonLoaderComponent, selector: "ngx-skeleton-loader", inputs: ["count", "loadingText", "appearance", "animation", "ariaLabel", "theme"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: UdButtonComponent, selector: "ud-button", inputs: ["variant", "color", "size", "type", "icon", "iconPosition", "iconFontSet", "loading", "disabled", "ariaLabel", "fullWidth"], outputs: ["buttonClick"] }, { kind: "directive", type: UdTooltipDirective, selector: "[udTooltip]", inputs: ["udTooltip", "udTooltipPosition", "udTooltipDisabled", "udTooltipShowDelay"] }] });
|
|
5828
6211
|
}
|
|
5829
6212
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImport: i0, type: SummaryViewComponent, decorators: [{
|
|
5830
6213
|
type: Component,
|
|
@@ -5840,7 +6223,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.19", ngImpo
|
|
|
5840
6223
|
MatPrefix,
|
|
5841
6224
|
UdButtonComponent,
|
|
5842
6225
|
UdTooltipDirective,
|
|
5843
|
-
], template: "<div class=\"summary-view-container\">\n <div class=\"header\">\n @if (loading) {\n <ngx-skeleton-loader\n class=\"loading col-6\"\n [count]=\"1\"\n [theme]=\"{ height: skeletonTitleHeight }\" />\n } @else {\n <h5 class=\"header-title\">{{ title }}</h5>\n }\n <div class=\"header-actions\">\n @for (action of actions; track action.label) {\n @if (action.isAuthorized) {\n @if (action.path) {\n <ud-button\n variant=\"stroked\"\n color=\"primary\"\n size=\"sm\"\n [icon]=\"action.icon\"\n [routerLink]=\"action.path\">\n {{ action.label | translate | capitalize }}\n </ud-button>\n } @else if (action.onClick) {\n <ud-button\n variant=\"stroked\"\n color=\"primary\"\n size=\"sm\"\n [icon]=\"action.icon\"\n (buttonClick)=\"action.onClick!()\">\n {{ action.label | translate | capitalize }}\n </ud-button>\n }\n }\n }\n <ng-content select=\"[header-actions]\" />\n </div>\n </div>\n <div\n class=\"content\"\n [ngClass]=\"{\n reverse: layout === 'text-right',\n 'flex-column': layout === 'text-top',\n }\">\n @if (loading) {\n <ngx-skeleton-loader\n class=\"col\"\n [count]=\"1\"\n [theme]=\"{ height: skeletonBodyHeight }\" />\n } @else {\n @if (layout !== 'text-none') {\n <div [ngClass]=\"layout === 'text-top' || layout === 'text-all' ? 'col-12' : 'col-6'\">\n <div class=\"summary\" [ngClass]=\"{ 'summary-row-wrap': layout === 'text-top' || layout === 'text-all' }\">\n @for (summaryField of summaryFields; track $index) {\n <div class=\"summary-field\">\n @if (summaryField.label) {\n <span>{{ summaryField.label | capitalize }}</span>\n }\n <div class=\"summary-row\">\n <mat-icon
|
|
6226
|
+
], template: "<div class=\"summary-view-container\">\n <div class=\"header\">\n @if (loading) {\n <ngx-skeleton-loader\n class=\"loading col-6\"\n [count]=\"1\"\n [theme]=\"{ height: skeletonTitleHeight }\" />\n } @else {\n <h5 class=\"header-title\">{{ title }}</h5>\n }\n <div class=\"header-actions\">\n @for (action of actions; track action.label) {\n @if (action.isAuthorized) {\n @if (action.path) {\n <ud-button\n variant=\"stroked\"\n color=\"primary\"\n size=\"sm\"\n [icon]=\"action.icon\"\n [routerLink]=\"action.path\">\n {{ action.label | translate | capitalize }}\n </ud-button>\n } @else if (action.onClick) {\n <ud-button\n variant=\"stroked\"\n color=\"primary\"\n size=\"sm\"\n [icon]=\"action.icon\"\n (buttonClick)=\"action.onClick!()\">\n {{ action.label | translate | capitalize }}\n </ud-button>\n }\n }\n }\n <ng-content select=\"[header-actions]\" />\n </div>\n </div>\n <div\n class=\"content\"\n [ngClass]=\"{\n reverse: layout === 'text-right',\n 'flex-column': layout === 'text-top',\n }\">\n @if (loading) {\n <ngx-skeleton-loader\n class=\"col\"\n [count]=\"1\"\n [theme]=\"{ height: skeletonBodyHeight }\" />\n } @else {\n @if (layout !== 'text-none') {\n <div [ngClass]=\"layout === 'text-top' || layout === 'text-all' ? 'col-12' : 'col-6'\">\n <div class=\"summary\" [ngClass]=\"{ 'summary-row-wrap': layout === 'text-top' || layout === 'text-all' }\">\n @for (summaryField of summaryFields; track $index) {\n <div class=\"summary-field\">\n @if (summaryField.label) {\n <div class=\"summary-label\">\n <mat-icon fontSet=\"material-icons-outlined\">{{ summaryField.icon }}</mat-icon>\n <span>{{ summaryField.label | capitalize }}</span>\n </div>\n }\n <div class=\"summary-row\">\n @if (!summaryField.label) {\n <mat-icon fontSet=\"material-icons-outlined\">{{ summaryField.icon }}</mat-icon>\n }\n <mat-label>{{ summaryField.value }}</mat-label>\n @if (summaryField.copyable && hasValue(summaryField)) {\n <div class=\"summary-copy\" [class.is-copied]=\"copiedIndex() === $index\">\n <ud-button\n variant=\"icon-only\"\n color=\"secondary\"\n size=\"sm\"\n [icon]=\"copiedIndex() === $index ? 'check' : 'content_copy'\"\n [udTooltip]=\"(copiedIndex() === $index ? copiedLabel : copyLabel) | translate | capitalize\"\n (buttonClick)=\"copy(summaryField, $index)\" />\n </div>\n }\n </div>\n </div>\n }\n </div>\n </div>\n }\n @if (layout !== 'text-all') {\n <div\n class=\"content-body\"\n [ngClass]=\"{\n 'col-12': layout === 'text-none' || layout === 'text-top',\n 'col-6': layout !== 'text-none' && layout !== 'text-top',\n }\">\n <ng-content></ng-content>\n </div>\n }\n }\n </div>\n</div>\n", styles: [".summary-view-container{justify-self:center;width:100%;border-radius:12px;overflow:hidden;box-shadow:0 0 0 1px #1b253512,0 4px 16px #1b253514;font-family:Sora,system-ui,sans-serif}.header{display:flex;justify-content:space-between;align-items:center;padding:14px 20px;background:#1b2535;min-height:52px}.header .header-title{margin:0;font-family:Sora,system-ui,sans-serif;font-size:.9rem;font-weight:600;color:#fff;letter-spacing:.02em}.header .header-actions{display:flex;align-items:center;gap:8px}.header .header-actions ::ng-deep .ud-btn{border-color:#ffffff4d!important;color:#ffffffd9!important}.header .header-actions ::ng-deep .ud-btn:hover{background:#ffffff1a!important;border-color:#ffffff80!important;color:#fff!important}.header .header-actions ::ng-deep .ud-btn .mat-icon{color:inherit!important}.header .loading{padding:.5rem;border-radius:4px}.header .loading ::ng-deep .skeleton-loader{background:#ffffff1f!important;background-image:linear-gradient(90deg,#ffffff1f,#ffffff38,#ffffff1f 80px)!important}.content{display:flex;flex-wrap:wrap;background:#fff}.content:not(.flex-column):has(.content-body>*)>.col-6:first-child{border-right:1px solid #e8eaee}.content.reverse:has(.content-body>*)>.col-6:last-child{border-right:1px solid #e8eaee;border-left:none}.summary{display:flex;flex-direction:column;gap:0;padding:20px 24px}.summary.summary-row-wrap{flex-direction:row;flex-wrap:wrap;gap:.25rem;padding:16px 8px}.summary-field{display:flex;flex-direction:column;gap:3px;padding:10px 16px;border-radius:8px;transition:background .15s ease}.summary-field:hover{background:#f4f5f7}.summary-row-wrap .summary-field{padding:12px 16px;min-width:140px;border:1px solid #e8eaee}.summary-label,.summary-row{display:flex;align-items:center;gap:6px}.summary-label mat-icon,.summary-row mat-icon{height:14px;width:14px;min-width:14px;font-size:14px;color:#6b7585;flex-shrink:0}.summary-label span{font-family:Sora,system-ui,sans-serif;font-size:.75rem;font-weight:500;color:#6b7585;line-height:1.4}mat-label{font-family:Sora,system-ui,sans-serif;font-size:.9375rem;font-weight:500;color:#1b2535;line-height:1.4}.content-body:has(>*){background:#f4f5f7;padding:20px 24px}.flex-column>.content-body:has(>*){border-top:1px solid #e8eaee}.summary-copy{display:inline-flex;align-items:center;height:1em;margin-left:2px;opacity:0;transition:opacity .12s ease}.summary-field:hover .summary-copy,.summary-copy:focus-within,.summary-copy.is-copied{opacity:1}@media (hover: none){.summary-copy{opacity:1}}@media (prefers-reduced-motion: reduce){.summary-copy{transition:none}}\n"] }]
|
|
5844
6227
|
}], propDecorators: { title: [{
|
|
5845
6228
|
type: Input
|
|
5846
6229
|
}], actions: [{
|
|
@@ -7394,6 +7777,12 @@ const en = {
|
|
|
7394
7777
|
},
|
|
7395
7778
|
weekdays: { 0: 'S', 1: 'M', 2: 'T', 3: 'W', 4: 'T', 5: 'F', 6: 'S' },
|
|
7396
7779
|
},
|
|
7780
|
+
timelineGrid: {
|
|
7781
|
+
lanes: 'Lanes',
|
|
7782
|
+
empty: 'Nothing to show',
|
|
7783
|
+
createCell: '{{lane}}, press Enter to start a new entry',
|
|
7784
|
+
openEnded: 'open-ended',
|
|
7785
|
+
},
|
|
7397
7786
|
};
|
|
7398
7787
|
const fr = {
|
|
7399
7788
|
actions: {
|
|
@@ -7500,6 +7889,12 @@ const fr = {
|
|
|
7500
7889
|
},
|
|
7501
7890
|
weekdays: { 0: 'D', 1: 'L', 2: 'M', 3: 'M', 4: 'J', 5: 'V', 6: 'S' },
|
|
7502
7891
|
},
|
|
7892
|
+
timelineGrid: {
|
|
7893
|
+
lanes: 'Lignes',
|
|
7894
|
+
empty: 'Rien à afficher',
|
|
7895
|
+
createCell: '{{lane}}, appuyez sur Entrée pour créer une entrée',
|
|
7896
|
+
openEnded: 'sans fin',
|
|
7897
|
+
},
|
|
7503
7898
|
};
|
|
7504
7899
|
/** Languages the library ships strings for. */
|
|
7505
7900
|
const UD_COMPONENTS_TRANSLATIONS = {
|
|
@@ -7612,6 +8007,8 @@ var FeatureFlagKey;
|
|
|
7612
8007
|
FeatureFlagKey["UNIVERSITY_TIMEZONE"] = "UNIVERSITY_TIMEZONE";
|
|
7613
8008
|
// The quoted total on the student's stay summary in the student app.
|
|
7614
8009
|
FeatureFlagKey["SHOW_TOTAL_QUOTE_FOR_STUDENT"] = "SHOW_TOTAL_QUOTE_FOR_STUDENT";
|
|
8010
|
+
// Parking lots, spaces, assignments and the waitlist.
|
|
8011
|
+
FeatureFlagKey["PARKING"] = "PARKING";
|
|
7615
8012
|
})(FeatureFlagKey || (FeatureFlagKey = {}));
|
|
7616
8013
|
|
|
7617
8014
|
var LoadingStatus;
|
|
@@ -7679,5 +8076,5 @@ const generateTimeOptions = (start, end, intervalMinutes = 5) => {
|
|
|
7679
8076
|
* Generated bundle index. Do not edit.
|
|
7680
8077
|
*/
|
|
7681
8078
|
|
|
7682
|
-
export { AppShellComponent, ApplicationStatus, AutocompleteComponent, CalendarComponent, CalendarSlotColor, CapitalizePipe, CarouselComponent, CheckboxComponent, ChipInputComponent, ColumnVisibilityModalComponent, CustomInputComponent, CustomSnackbarComponent, CustomTableComponent, DateInputComponent, DateOperator, DateRangeInputComponent, DynamicComponentComponent, EditViewComponent, EditViewSectionDirective, FeatureFlagKey, FileInputComponent, FilterType, GROUP_ROW_HEIGHT, IconColor, KpiComponent, KpiDataType, KpiPillType, KpiProgressBarType, KpiVariant, LoadingStatus, ModalComponent, ModalInputType, MoneyInputComponent, MultiSelectComponent, MultiSelectMatchMode, NumberOperator, OCCUPANCY_GRID_HEADER_HEIGHT, OccupancyGridComponent, PhoneInputComponent, PillComponent, PillToggleComponent, PluralizePipe, ProgressBarComponent, SIDENAV_LOGO, SIDENAV_LOGO_COLLAPSED, SafePipe, SidenavComponent, SingularPipe, SnackbarType, StringOperator, SummaryViewComponent, TableDisplayColumnType, TabsComponent, TelInputComponent, TextInputComponent, TextareaComponent, TimePickerComponent, ToObservablePipe, ToggleComponent, ToggleOptionComponent, TranslateWrapperService, UD_COMPONENTS_TRANSLATIONS, UdButtonComponent, UdButtonToggleComponent, UdMenuComponent, UdPreviewContainerComponent, UdStepContentDirective, UdStepperComponent, UdTooltipComponent, UdTooltipDirective, activeNavRoute, addDays, assignLanes, barGeometry, buildRows, capitalize, centsToMoney, clampToClosures, closureGeometry, dateAtOffset, dayColumns, dayOfMonth, daysBetween, epochDay, formatLocalDate, formatLocalDateTime, formatLocalDateTimeLongForm, formatLocalTime, formatLocalTimeWithMinutes, formatLocalTimeWithMinutesAmPm, formatMoney, formatMonthYear, formatPhoneNumber, formatStringDate, formatStringDateTime, generateTimeOptions, groupThousands, inListValidator, isIsoDate, laneForSpan, laneNeighborBound, maxIso, minIso, moneyToCents, monthOf, monthSegments, overbooksRoom, overlapsClosure, overlapsRoom, parseLocalDate, parseMoney, pluralize, positionRows, rowHeight, spaceCase, takenOn, totalHeight, udComponentsOnlyTranslateLoader, udComponentsTranslationsFor, updateArray, visibleRange, weekday, weekendOffsetDays, withLoadingState, withUdComponentsTranslations, yearOf };
|
|
8079
|
+
export { AppShellComponent, ApplicationStatus, AutocompleteComponent, CalendarComponent, CalendarSlotColor, CapitalizePipe, CarouselComponent, CheckboxComponent, ChipInputComponent, ColumnVisibilityModalComponent, CustomInputComponent, CustomSnackbarComponent, CustomTableComponent, DateInputComponent, DateOperator, DateRangeInputComponent, DynamicComponentComponent, EditViewComponent, EditViewSectionDirective, FeatureFlagKey, FileInputComponent, FilterType, GROUP_ROW_HEIGHT, IconColor, KpiComponent, KpiDataType, KpiPillType, KpiProgressBarType, KpiVariant, LoadingStatus, ModalComponent, ModalInputType, MoneyInputComponent, MultiSelectComponent, MultiSelectMatchMode, NumberOperator, OCCUPANCY_GRID_HEADER_HEIGHT, OccupancyGridComponent, PhoneInputComponent, PillComponent, PillToggleComponent, PluralizePipe, ProgressBarComponent, SIDENAV_LOGO, SIDENAV_LOGO_COLLAPSED, SafePipe, SidenavComponent, SingularPipe, SnackbarType, StringOperator, SummaryViewComponent, TIMELINE_GRID_DEFAULT_LEGEND, TIMELINE_GRID_HEADER_HEIGHT, TableDisplayColumnType, TabsComponent, TelInputComponent, TextInputComponent, TextareaComponent, TimePickerComponent, TimelineGridComponent, ToObservablePipe, ToggleComponent, ToggleOptionComponent, TranslateWrapperService, UD_COMPONENTS_TRANSLATIONS, UdButtonComponent, UdButtonToggleComponent, UdMenuComponent, UdPreviewContainerComponent, UdStepContentDirective, UdStepperComponent, UdTooltipComponent, UdTooltipDirective, activeNavRoute, addDays, assignLanes, barGeometry, buildRows, capitalize, centsToMoney, clampToClosures, closureGeometry, dateAtOffset, dayColumns, dayOfMonth, daysBetween, epochDay, formatLocalDate, formatLocalDateTime, formatLocalDateTimeLongForm, formatLocalTime, formatLocalTimeWithMinutes, formatLocalTimeWithMinutesAmPm, formatMoney, formatMonthYear, formatPhoneNumber, formatStringDate, formatStringDateTime, generateTimeOptions, groupThousands, inListValidator, isIsoDate, laneForSpan, laneNeighborBound, maxIso, minIso, moneyToCents, monthOf, monthSegments, overbooksRoom, overlapsClosure, overlapsRoom, parseLocalDate, parseMoney, pluralize, positionRows, rowHeight, spaceCase, takenOn, totalHeight, udComponentsOnlyTranslateLoader, udComponentsTranslationsFor, updateArray, visibleRange, weekday, weekendOffsetDays, withLoadingState, withUdComponentsTranslations, yearOf };
|
|
7683
8080
|
//# sourceMappingURL=ud-components.mjs.map
|