@svar-ui/svelte-calendar 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Demo.svelte +7 -0
- package/dist/Demo.svelte.d.ts +26 -0
- package/dist/components/AddEventButton.svelte +12 -0
- package/dist/components/AddEventButton.svelte.d.ts +18 -0
- package/dist/components/Calendar.svelte +110 -0
- package/dist/components/Calendar.svelte.d.ts +153 -0
- package/dist/components/CalendarPanel.svelte +147 -0
- package/dist/components/CalendarPanel.svelte.d.ts +18 -0
- package/dist/components/ContextMenu.svelte +87 -0
- package/dist/components/ContextMenu.svelte.d.ts +17 -0
- package/dist/components/DateLabel.svelte +13 -0
- package/dist/components/DateLabel.svelte.d.ts +18 -0
- package/dist/components/DateNav.svelte +31 -0
- package/dist/components/DateNav.svelte.d.ts +18 -0
- package/dist/components/DateTimePicker.svelte +30 -0
- package/dist/components/DateTimePicker.svelte.d.ts +8 -0
- package/dist/components/Editor.svelte +123 -0
- package/dist/components/Editor.svelte.d.ts +10 -0
- package/dist/components/Layout.svelte +76 -0
- package/dist/components/Layout.svelte.d.ts +21 -0
- package/dist/components/MenuButton.svelte +9 -0
- package/dist/components/MenuButton.svelte.d.ts +18 -0
- package/dist/components/Navigation.svelte +59 -0
- package/dist/components/Navigation.svelte.d.ts +12 -0
- package/dist/components/Render/BarSection.svelte +89 -0
- package/dist/components/Render/BarSection.svelte.d.ts +13 -0
- package/dist/components/Render/BoxSection.svelte +94 -0
- package/dist/components/Render/BoxSection.svelte.d.ts +15 -0
- package/dist/components/Render/Grid.svelte +16 -0
- package/dist/components/Render/Grid.svelte.d.ts +14 -0
- package/dist/components/Render/GridCells.svelte +98 -0
- package/dist/components/Render/GridCells.svelte.d.ts +14 -0
- package/dist/components/Render/GridLines.svelte +45 -0
- package/dist/components/Render/GridLines.svelte.d.ts +10 -0
- package/dist/components/Render/GridSection.svelte +348 -0
- package/dist/components/Render/GridSection.svelte.d.ts +16 -0
- package/dist/components/Render/Headers.svelte +86 -0
- package/dist/components/Render/Headers.svelte.d.ts +8 -0
- package/dist/components/Render/ListSection.svelte +110 -0
- package/dist/components/Render/ListSection.svelte.d.ts +8 -0
- package/dist/components/Render/NowLine.svelte +68 -0
- package/dist/components/Render/NowLine.svelte.d.ts +8 -0
- package/dist/components/Render/ScrollableSection.svelte +207 -0
- package/dist/components/Render/ScrollableSection.svelte.d.ts +14 -0
- package/dist/components/Render/SectionContent.svelte +83 -0
- package/dist/components/Render/SectionContent.svelte.d.ts +17 -0
- package/dist/components/Render/Sections.svelte +340 -0
- package/dist/components/Render/Sections.svelte.d.ts +14 -0
- package/dist/components/Render/YearSection.svelte +265 -0
- package/dist/components/Render/YearSection.svelte.d.ts +9 -0
- package/dist/components/Render/useEventOverlay.svelte.d.ts +21 -0
- package/dist/components/Render/useEventOverlay.svelte.js +60 -0
- package/dist/components/TodayButton.svelte +11 -0
- package/dist/components/TodayButton.svelte.d.ts +18 -0
- package/dist/components/editorItems.d.ts +15 -0
- package/dist/components/editorItems.js +20 -0
- package/dist/components/types.d.ts +29 -0
- package/dist/components/types.js +1 -0
- package/dist/directives/clickdate.d.ts +8 -0
- package/dist/directives/clickdate.js +45 -0
- package/dist/directives/clickevent.d.ts +15 -0
- package/dist/directives/clickevent.js +54 -0
- package/dist/directives/drag.d.ts +19 -0
- package/dist/directives/drag.js +494 -0
- package/dist/directives/dragresize.d.ts +10 -0
- package/dist/directives/dragresize.js +58 -0
- package/dist/directives/resize.d.ts +5 -0
- package/dist/directives/resize.js +11 -0
- package/dist/dom.d.ts +1 -0
- package/dist/dom.js +12 -0
- package/dist/env.d.ts +9 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +12 -0
- package/dist/init.d.ts +1 -0
- package/dist/init.js +5 -0
- package/dist/themes/Willow.svelte +16 -0
- package/dist/themes/Willow.svelte.d.ts +7 -0
- package/dist/themes/WillowDark.svelte +16 -0
- package/dist/themes/WillowDark.svelte.d.ts +7 -0
- package/license.txt +21 -0
- package/package.json +60 -0
- package/readme.md +107 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<script lang="ts">import { getContext } from "svelte";
|
|
2
|
+
import { setID } from "@svar-ui/lib-dom";
|
|
3
|
+
const { primitives, eventContent } = $props();
|
|
4
|
+
const api = getContext("calendar-api");
|
|
5
|
+
const _ = getContext("wx-i18n").getGroup("eventCalendar");
|
|
6
|
+
const fmtDate = api.fmt("agendaDayFormat");
|
|
7
|
+
const fmtTime = api.fmt("timeScaleFormat");
|
|
8
|
+
function formatRange(event) {
|
|
9
|
+
const { start, end } = event;
|
|
10
|
+
if (event.allDay || start.getFullYear() !== end.getFullYear() || start.getMonth() !== end.getMonth() || start.getDate() !== end.getDate()) {
|
|
11
|
+
return _("Full day");
|
|
12
|
+
}
|
|
13
|
+
return `${fmtTime(start)} – ${fmtTime(end)}`;
|
|
14
|
+
}
|
|
15
|
+
const groups = $derived.by(() => {
|
|
16
|
+
const map = new Map();
|
|
17
|
+
for (const p of primitives) {
|
|
18
|
+
const d = p.event.start;
|
|
19
|
+
const key = `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
|
|
20
|
+
let group = map.get(key);
|
|
21
|
+
if (!group) {
|
|
22
|
+
const date = new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
23
|
+
group = {
|
|
24
|
+
date,
|
|
25
|
+
label: fmtDate(date),
|
|
26
|
+
events: []
|
|
27
|
+
};
|
|
28
|
+
map.set(key, group);
|
|
29
|
+
}
|
|
30
|
+
group.events.push(p);
|
|
31
|
+
}
|
|
32
|
+
return Array.from(map.values());
|
|
33
|
+
});
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<div class="wx-list-section">
|
|
37
|
+
{#each groups as group (group.date.getTime())}
|
|
38
|
+
<div class="wx-list-day">
|
|
39
|
+
<div class="wx-list-date">{group.label}</div>
|
|
40
|
+
<div class="wx-list-events">
|
|
41
|
+
{#each group.events as p (p.id)}
|
|
42
|
+
<div
|
|
43
|
+
class="wx-list-event"
|
|
44
|
+
data-id={setID(p.id)}
|
|
45
|
+
>
|
|
46
|
+
{#if eventContent}
|
|
47
|
+
{@const EventContentCmp = eventContent}
|
|
48
|
+
<div class="wx-list-event-content">
|
|
49
|
+
<EventContentCmp event={p.event} mode="list" />
|
|
50
|
+
</div>
|
|
51
|
+
{:else}
|
|
52
|
+
<span class="wx-event-time">
|
|
53
|
+
{formatRange(p.event)}
|
|
54
|
+
</span>
|
|
55
|
+
<span class="wx-event-title">
|
|
56
|
+
{p.event.text || ""}
|
|
57
|
+
</span>
|
|
58
|
+
{/if}
|
|
59
|
+
</div>
|
|
60
|
+
{/each}
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
{/each}
|
|
64
|
+
{#if groups.length === 0}
|
|
65
|
+
<div class="wx-list-empty" role="status">No events this month</div>
|
|
66
|
+
{/if}
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
<style>
|
|
70
|
+
.wx-list-section {
|
|
71
|
+
padding: 8px 0;
|
|
72
|
+
}
|
|
73
|
+
.wx-list-day {
|
|
74
|
+
margin-bottom: 4px;
|
|
75
|
+
}
|
|
76
|
+
.wx-list-date {
|
|
77
|
+
padding: 8px 16px;
|
|
78
|
+
font-weight: var(--wx-font-weight-md);
|
|
79
|
+
border-bottom: var(--wx-border);
|
|
80
|
+
background: var(--wx-background-alt);
|
|
81
|
+
}
|
|
82
|
+
.wx-list-event {
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
padding: 8px 16px 8px 32px;
|
|
86
|
+
border-bottom: var(--wx-border);
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
}
|
|
89
|
+
.wx-list-event:hover {
|
|
90
|
+
background-color: var(--wx-background-hover);
|
|
91
|
+
}
|
|
92
|
+
.wx-event-time {
|
|
93
|
+
flex-shrink: 0;
|
|
94
|
+
width: 130px;
|
|
95
|
+
font-size: 13px;
|
|
96
|
+
color: var(--wx-color-font-alt);
|
|
97
|
+
}
|
|
98
|
+
.wx-event-title {
|
|
99
|
+
font-size: var(--wx-font-size);
|
|
100
|
+
}
|
|
101
|
+
.wx-list-event-content {
|
|
102
|
+
flex: 1;
|
|
103
|
+
min-width: 0;
|
|
104
|
+
}
|
|
105
|
+
.wx-list-empty {
|
|
106
|
+
padding: 32px 16px;
|
|
107
|
+
text-align: center;
|
|
108
|
+
color: var(--wx-color-font-alt);
|
|
109
|
+
}
|
|
110
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Primitive } from "@svar-ui/calendar-store";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
primitives: Primitive[];
|
|
4
|
+
eventContent?: any;
|
|
5
|
+
};
|
|
6
|
+
declare const ListSection: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type ListSection = ReturnType<typeof ListSection>;
|
|
8
|
+
export default ListSection;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script lang="ts">import { onMount } from "svelte";
|
|
2
|
+
const { yHeaders, dy } = $props();
|
|
3
|
+
let now = $state(new Date());
|
|
4
|
+
onMount(() => {
|
|
5
|
+
const id = setInterval(() => {
|
|
6
|
+
now = new Date();
|
|
7
|
+
}, 6e4);
|
|
8
|
+
return () => clearInterval(id);
|
|
9
|
+
});
|
|
10
|
+
const position = $derived.by(() => {
|
|
11
|
+
if (!yHeaders) return null;
|
|
12
|
+
const inner = yHeaders[yHeaders.length - 1];
|
|
13
|
+
if (!inner?.length) return null;
|
|
14
|
+
const first = inner[0]?.ui?.date;
|
|
15
|
+
const last = inner[inner.length - 1]?.ui?.date;
|
|
16
|
+
if (!first || !last) return null;
|
|
17
|
+
const rangeStart = first.getTime();
|
|
18
|
+
// range end = last unit position + last unit size worth of time
|
|
19
|
+
const unitMs = (last.getTime() - first.getTime()) / (inner.length - 1 || 1);
|
|
20
|
+
const rangeEnd = last.getTime() + unitMs;
|
|
21
|
+
const nowMs = now.getTime();
|
|
22
|
+
if (nowMs < rangeStart || nowMs > rangeEnd) return null;
|
|
23
|
+
// same math as LinearScale.eventToPosition
|
|
24
|
+
const pos = (nowMs - rangeStart) / (rangeEnd - rangeStart) * 100;
|
|
25
|
+
return pos;
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
{#if position !== null}
|
|
30
|
+
<div
|
|
31
|
+
class="wx-now-line"
|
|
32
|
+
style="top:{dy * position}px"
|
|
33
|
+
aria-hidden="true"
|
|
34
|
+
>
|
|
35
|
+
<div class="wx-now-dot"></div>
|
|
36
|
+
</div>
|
|
37
|
+
{/if}
|
|
38
|
+
|
|
39
|
+
<style>
|
|
40
|
+
.wx-now-line {
|
|
41
|
+
position: absolute;
|
|
42
|
+
left: 0;
|
|
43
|
+
right: 0;
|
|
44
|
+
height: 0;
|
|
45
|
+
z-index: 3;
|
|
46
|
+
pointer-events: none;
|
|
47
|
+
}
|
|
48
|
+
.wx-now-line::after {
|
|
49
|
+
content: "";
|
|
50
|
+
position: absolute;
|
|
51
|
+
left: 0;
|
|
52
|
+
right: 0;
|
|
53
|
+
top: 0;
|
|
54
|
+
height: 2px;
|
|
55
|
+
background: var(--wx-color-danger);
|
|
56
|
+
transform: translateY(-50%);
|
|
57
|
+
}
|
|
58
|
+
.wx-now-dot {
|
|
59
|
+
position: absolute;
|
|
60
|
+
left: 0;
|
|
61
|
+
top: 0;
|
|
62
|
+
width: 8px;
|
|
63
|
+
height: 8px;
|
|
64
|
+
border-radius: 50%;
|
|
65
|
+
background: var(--wx-color-danger);
|
|
66
|
+
transform: translate(-50%, -50%);
|
|
67
|
+
}
|
|
68
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ScaleUnit } from "@svar-ui/calendar-store";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
yHeaders: ScaleUnit[][] | null;
|
|
4
|
+
dy: number;
|
|
5
|
+
};
|
|
6
|
+
declare const NowLine: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type NowLine = ReturnType<typeof NowLine>;
|
|
8
|
+
export default NowLine;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
<script lang="ts">import { getContext, onMount } from "svelte";
|
|
2
|
+
import { drag } from "../../directives/drag.js";
|
|
3
|
+
import { clickevent } from "../../directives/clickevent.js";
|
|
4
|
+
import { clickdate } from "../../directives/clickdate.js";
|
|
5
|
+
import { Popup } from "@svar-ui/svelte-core";
|
|
6
|
+
import Headers from "./Headers.svelte";
|
|
7
|
+
import SectionContent from "./SectionContent.svelte";
|
|
8
|
+
import { useEventOverlay } from "./useEventOverlay.svelte.js";
|
|
9
|
+
const api = getContext("calendar-api");
|
|
10
|
+
const { _view } = api.getReactiveState();
|
|
11
|
+
const { data, cellCss, eventCss, eventContent, view, tooltip, eventPopup, readonly = false } = $props();
|
|
12
|
+
const section = $derived(data[0]);
|
|
13
|
+
const xHeaders = $derived(section?.xHeaders ?? null);
|
|
14
|
+
const yHeaders = $derived(section?.yHeaders ?? null);
|
|
15
|
+
const showXHeaders = $derived(xHeaders !== null && section?.xVisible !== false);
|
|
16
|
+
const showYHeaders = $derived(yHeaders !== null && section?.yVisible !== false);
|
|
17
|
+
// oxlint-disable-next-line no-unused-vars no-unassigned-vars
|
|
18
|
+
let contentEl;
|
|
19
|
+
let contentWidth = $state(0);
|
|
20
|
+
let contentHeight = $state(0);
|
|
21
|
+
let ready = $state(false);
|
|
22
|
+
function measure() {
|
|
23
|
+
if (contentEl) {
|
|
24
|
+
const rect = contentEl.getBoundingClientRect();
|
|
25
|
+
const w = Math.round(rect.width * 1e3) / 1e3;
|
|
26
|
+
const h = Math.round(rect.height * 1e3) / 1e3;
|
|
27
|
+
if (w !== contentWidth || h !== contentHeight) {
|
|
28
|
+
contentWidth = w;
|
|
29
|
+
contentHeight = h;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
onMount(() => {
|
|
34
|
+
measure();
|
|
35
|
+
ready = true;
|
|
36
|
+
const ro = new ResizeObserver(() => measure());
|
|
37
|
+
ro.observe(contentEl);
|
|
38
|
+
return () => ro.disconnect();
|
|
39
|
+
});
|
|
40
|
+
const dx = $derived(contentWidth / 100);
|
|
41
|
+
const dy = $derived(contentHeight / 100);
|
|
42
|
+
function getMinContentWidth() {
|
|
43
|
+
if (!xHeaders) return 0;
|
|
44
|
+
const inner = xHeaders[xHeaders.length - 1];
|
|
45
|
+
if (!inner?.length) return 0;
|
|
46
|
+
const v = inner[0].ui?.minUnitWidth;
|
|
47
|
+
return typeof v === "number" ? inner.length * v : 0;
|
|
48
|
+
}
|
|
49
|
+
function getMinContentHeight() {
|
|
50
|
+
if (!yHeaders) return 0;
|
|
51
|
+
const inner = yHeaders[yHeaders.length - 1];
|
|
52
|
+
if (!inner?.length) return 0;
|
|
53
|
+
const v = inner[0].ui?.minUnitHeight;
|
|
54
|
+
return typeof v === "number" ? inner.length * v : 0;
|
|
55
|
+
}
|
|
56
|
+
const minW = $derived(getMinContentWidth());
|
|
57
|
+
const minH = $derived(getMinContentHeight());
|
|
58
|
+
const overlay = useEventOverlay((id) => api.getEvent(id), () => section?.mode === "boxes" ? "right-start" : "bottom-start");
|
|
59
|
+
// trackScroll exists in Popup but is missing from its .d.ts
|
|
60
|
+
const popupExtra = { trackScroll: true };
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<div class="wx-scrollable-section">
|
|
64
|
+
<div
|
|
65
|
+
class="wx-scroll-grid"
|
|
66
|
+
class:wx-has-x-headers={showXHeaders}
|
|
67
|
+
class:wx-has-y-headers={showYHeaders}
|
|
68
|
+
>
|
|
69
|
+
{#if showXHeaders && showYHeaders}
|
|
70
|
+
<div class="wx-corner"></div>
|
|
71
|
+
{/if}
|
|
72
|
+
{#if showXHeaders}
|
|
73
|
+
<div class="wx-x-headers-sticky">
|
|
74
|
+
<Headers headers={xHeaders} direction="x" />
|
|
75
|
+
</div>
|
|
76
|
+
{/if}
|
|
77
|
+
{#if showYHeaders}
|
|
78
|
+
<div class="wx-y-headers-sticky">
|
|
79
|
+
<Headers headers={yHeaders} direction="y" />
|
|
80
|
+
</div>
|
|
81
|
+
{/if}
|
|
82
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
83
|
+
<div
|
|
84
|
+
class="wx-content"
|
|
85
|
+
style:min-width={minW > 0 ? `${minW}px` : undefined}
|
|
86
|
+
style:min-height={minH > 0 ? `${minH}px` : undefined}
|
|
87
|
+
bind:this={contentEl}
|
|
88
|
+
use:clickevent={{
|
|
89
|
+
exec: api.exec,
|
|
90
|
+
getEvent: id => api.getEvent(id),
|
|
91
|
+
onEventPopup: eventPopup ? overlay.handleEventPopup : undefined,
|
|
92
|
+
}}
|
|
93
|
+
use:clickdate={{ exec: api.exec }}
|
|
94
|
+
onmousemove={tooltip ? overlay.handleTooltipMove : undefined}
|
|
95
|
+
onmouseleave={tooltip ? overlay.handleTooltipLeave : undefined}
|
|
96
|
+
use:drag={{
|
|
97
|
+
mode: section?.mode ?? "boxes",
|
|
98
|
+
dx,
|
|
99
|
+
dy,
|
|
100
|
+
xHeaders,
|
|
101
|
+
yHeaders,
|
|
102
|
+
sectionName: section?.name ?? "",
|
|
103
|
+
model: $_view,
|
|
104
|
+
exec: api.exec,
|
|
105
|
+
getEvent: id => api.getEvent(id),
|
|
106
|
+
move: !readonly && !!section?.ui?.drag,
|
|
107
|
+
clipDrag: section?.ui?.clipDrag !== false,
|
|
108
|
+
create: !readonly && !!section?.ui?.dragCreate,
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
{#if section?.ui?.dragCreate}
|
|
112
|
+
<div class="wx-drag-stub" data-drag-stub aria-hidden="true"></div>
|
|
113
|
+
{/if}
|
|
114
|
+
{#if section}
|
|
115
|
+
<SectionContent
|
|
116
|
+
{section}
|
|
117
|
+
{dx}
|
|
118
|
+
{dy}
|
|
119
|
+
scrollHeight={null}
|
|
120
|
+
measured={ready && contentWidth > 0 && contentHeight > 0}
|
|
121
|
+
{cellCss}
|
|
122
|
+
{eventCss}
|
|
123
|
+
{eventContent}
|
|
124
|
+
{view}
|
|
125
|
+
{tooltip}
|
|
126
|
+
/>
|
|
127
|
+
{/if}
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
{#if overlay.tooltipState && tooltip}
|
|
132
|
+
{@const TooltipCmp = tooltip}
|
|
133
|
+
<div
|
|
134
|
+
class="wx-calendar-tooltip"
|
|
135
|
+
style="position:fixed;left:{overlay.mousePos.x + 12}px;top:{overlay.mousePos.y + 16}px;z-index:10000;pointer-events:none"
|
|
136
|
+
aria-hidden="true"
|
|
137
|
+
>
|
|
138
|
+
<TooltipCmp event={overlay.tooltipState.event} />
|
|
139
|
+
</div>
|
|
140
|
+
{/if}
|
|
141
|
+
|
|
142
|
+
{#if overlay.eventPopupState && eventPopup}
|
|
143
|
+
{@const EventPopupCmp = eventPopup}
|
|
144
|
+
<Popup
|
|
145
|
+
at={overlay.eventPopupState.at}
|
|
146
|
+
parent={overlay.eventPopupState.element}
|
|
147
|
+
oncancel={overlay.hideEventPopup}
|
|
148
|
+
{...popupExtra}
|
|
149
|
+
>
|
|
150
|
+
<EventPopupCmp
|
|
151
|
+
event={overlay.eventPopupState.event}
|
|
152
|
+
close={overlay.hideEventPopup}
|
|
153
|
+
/>
|
|
154
|
+
</Popup>
|
|
155
|
+
{/if}
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<style>
|
|
159
|
+
.wx-scrollable-section {
|
|
160
|
+
flex: 1;
|
|
161
|
+
min-height: 0;
|
|
162
|
+
overflow: auto;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.wx-scroll-grid {
|
|
166
|
+
display: grid;
|
|
167
|
+
grid-template-columns: 1fr;
|
|
168
|
+
grid-template-rows: 1fr;
|
|
169
|
+
min-height: 100%;
|
|
170
|
+
}
|
|
171
|
+
.wx-scroll-grid.wx-has-y-headers {
|
|
172
|
+
grid-template-columns: auto 1fr;
|
|
173
|
+
}
|
|
174
|
+
.wx-scroll-grid.wx-has-x-headers {
|
|
175
|
+
grid-template-rows: auto 1fr;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.wx-corner {
|
|
179
|
+
position: sticky;
|
|
180
|
+
top: 0;
|
|
181
|
+
left: 0;
|
|
182
|
+
z-index: 3;
|
|
183
|
+
background: var(--wx-background);
|
|
184
|
+
width: var(--wx-calendar-y-scale-width, 60px);
|
|
185
|
+
border-right: var(--wx-border);
|
|
186
|
+
border-bottom: var(--wx-border);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.wx-x-headers-sticky {
|
|
190
|
+
position: sticky;
|
|
191
|
+
top: 0;
|
|
192
|
+
z-index: 2;
|
|
193
|
+
background: var(--wx-background);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.wx-y-headers-sticky {
|
|
197
|
+
position: sticky;
|
|
198
|
+
left: 0;
|
|
199
|
+
z-index: 1;
|
|
200
|
+
background: var(--wx-background);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.wx-content {
|
|
204
|
+
position: relative;
|
|
205
|
+
z-index: 0;
|
|
206
|
+
}
|
|
207
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { SectionResult, CellCss, EventCss } from "@svar-ui/calendar-store";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
data: SectionResult[];
|
|
4
|
+
cellCss?: CellCss;
|
|
5
|
+
eventCss?: EventCss;
|
|
6
|
+
eventContent?: any;
|
|
7
|
+
view: string;
|
|
8
|
+
tooltip?: any;
|
|
9
|
+
eventPopup?: any;
|
|
10
|
+
readonly?: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const ScrollableSection: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
13
|
+
type ScrollableSection = ReturnType<typeof ScrollableSection>;
|
|
14
|
+
export default ScrollableSection;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<script lang="ts">import BoxSection from "./BoxSection.svelte";
|
|
2
|
+
import BarSection from "./BarSection.svelte";
|
|
3
|
+
import GridSection from "./GridSection.svelte";
|
|
4
|
+
import ListSection from "./ListSection.svelte";
|
|
5
|
+
import YearSection from "./YearSection.svelte";
|
|
6
|
+
import Grid from "./Grid.svelte";
|
|
7
|
+
import NowLine from "./NowLine.svelte";
|
|
8
|
+
const { section, dx, dy, scrollHeight, measured, cellCss, eventCss, eventContent, view, tooltip, onoverflow } = $props();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
{#if section.mode === "list"}
|
|
12
|
+
<ListSection primitives={section.primitives} {eventContent} />
|
|
13
|
+
{:else if section.mode === "year"}
|
|
14
|
+
<YearSection {section} {tooltip} {eventContent} />
|
|
15
|
+
{:else if measured}
|
|
16
|
+
{#snippet gridContent()}
|
|
17
|
+
{#if section.mode === "grid" && section.cells}
|
|
18
|
+
<GridSection
|
|
19
|
+
primitives={section.primitives}
|
|
20
|
+
cells={section.cells}
|
|
21
|
+
{dx}
|
|
22
|
+
{dy}
|
|
23
|
+
{cellCss}
|
|
24
|
+
{eventCss}
|
|
25
|
+
{eventContent}
|
|
26
|
+
{view}
|
|
27
|
+
section={section.name}
|
|
28
|
+
{onoverflow}
|
|
29
|
+
/>
|
|
30
|
+
{:else}
|
|
31
|
+
<Grid
|
|
32
|
+
xHeaders={section.xHeaders}
|
|
33
|
+
yHeaders={section.yHeaders}
|
|
34
|
+
{dx}
|
|
35
|
+
{dy}
|
|
36
|
+
{cellCss}
|
|
37
|
+
{view}
|
|
38
|
+
section={section.name}
|
|
39
|
+
mode={section.mode}
|
|
40
|
+
/>
|
|
41
|
+
{#if section.mode === "boxes"}
|
|
42
|
+
<BoxSection
|
|
43
|
+
primitives={section.primitives}
|
|
44
|
+
{dx}
|
|
45
|
+
{dy}
|
|
46
|
+
layoutMode={section.ui?.boxLayout ?? "split"}
|
|
47
|
+
{eventCss}
|
|
48
|
+
{eventContent}
|
|
49
|
+
{view}
|
|
50
|
+
section={section.name}
|
|
51
|
+
/>
|
|
52
|
+
{:else}
|
|
53
|
+
<BarSection
|
|
54
|
+
primitives={section.primitives}
|
|
55
|
+
{dx}
|
|
56
|
+
{dy}
|
|
57
|
+
{eventCss}
|
|
58
|
+
{eventContent}
|
|
59
|
+
{view}
|
|
60
|
+
section={section.name}
|
|
61
|
+
/>
|
|
62
|
+
{/if}
|
|
63
|
+
{#if section.ui?.nowLine}
|
|
64
|
+
<NowLine yHeaders={section.yHeaders} {dy} />
|
|
65
|
+
{/if}
|
|
66
|
+
{/if}
|
|
67
|
+
{/snippet}
|
|
68
|
+
|
|
69
|
+
{#if scrollHeight !== null}
|
|
70
|
+
<div class="wx-scroll-inner" style="height:{scrollHeight}px">
|
|
71
|
+
{@render gridContent()}
|
|
72
|
+
</div>
|
|
73
|
+
{:else}
|
|
74
|
+
{@render gridContent()}
|
|
75
|
+
{/if}
|
|
76
|
+
{/if}
|
|
77
|
+
|
|
78
|
+
<style>
|
|
79
|
+
.wx-scroll-inner {
|
|
80
|
+
position: relative;
|
|
81
|
+
width: 100%;
|
|
82
|
+
}
|
|
83
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SectionResult, CellCss, EventCss } from "@svar-ui/calendar-store";
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
section: SectionResult;
|
|
4
|
+
dx: number;
|
|
5
|
+
dy: number;
|
|
6
|
+
scrollHeight: number | null;
|
|
7
|
+
measured: boolean;
|
|
8
|
+
cellCss?: CellCss;
|
|
9
|
+
eventCss?: EventCss;
|
|
10
|
+
eventContent?: any;
|
|
11
|
+
view: string;
|
|
12
|
+
tooltip?: any;
|
|
13
|
+
onoverflow?: (overflow: boolean) => void;
|
|
14
|
+
};
|
|
15
|
+
declare const SectionContent: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
16
|
+
type SectionContent = ReturnType<typeof SectionContent>;
|
|
17
|
+
export default SectionContent;
|