nuxt-ui-elements-pro 0.1.5 → 0.1.7

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.
Files changed (67) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +153 -18
  3. package/dist/runtime/components/EventCalendar.d.vue.ts +109 -22
  4. package/dist/runtime/components/EventCalendar.vue +225 -602
  5. package/dist/runtime/components/EventCalendar.vue.d.ts +109 -22
  6. package/dist/runtime/components/OrgChart.d.vue.ts +191 -0
  7. package/dist/runtime/components/OrgChart.vue +290 -0
  8. package/dist/runtime/components/OrgChart.vue.d.ts +191 -0
  9. package/dist/runtime/components/event-calendar/EventCalendarHeader.d.vue.ts +45 -0
  10. package/dist/runtime/components/event-calendar/EventCalendarHeader.vue +55 -0
  11. package/dist/runtime/components/event-calendar/EventCalendarHeader.vue.d.ts +45 -0
  12. package/dist/runtime/components/event-calendar/EventCalendarListView.d.vue.ts +25 -0
  13. package/dist/runtime/components/event-calendar/EventCalendarListView.vue +95 -0
  14. package/dist/runtime/components/event-calendar/EventCalendarListView.vue.d.ts +25 -0
  15. package/dist/runtime/components/event-calendar/EventCalendarMonthView.d.vue.ts +34 -0
  16. package/dist/runtime/components/event-calendar/EventCalendarMonthView.vue +336 -0
  17. package/dist/runtime/components/event-calendar/EventCalendarMonthView.vue.d.ts +34 -0
  18. package/dist/runtime/components/event-calendar/EventCalendarTimeGrid.d.vue.ts +31 -0
  19. package/dist/runtime/components/event-calendar/EventCalendarTimeGrid.vue +306 -0
  20. package/dist/runtime/components/event-calendar/EventCalendarTimeGrid.vue.d.ts +31 -0
  21. package/dist/runtime/components/org-chart/OrgChartConnectors.d.vue.ts +15 -0
  22. package/dist/runtime/components/org-chart/OrgChartConnectors.vue +29 -0
  23. package/dist/runtime/components/org-chart/OrgChartConnectors.vue.d.ts +15 -0
  24. package/dist/runtime/components/org-chart/OrgChartControls.d.vue.ts +19 -0
  25. package/dist/runtime/components/org-chart/OrgChartControls.vue +25 -0
  26. package/dist/runtime/components/org-chart/OrgChartControls.vue.d.ts +19 -0
  27. package/dist/runtime/components/org-chart/OrgChartNode.d.vue.ts +30 -0
  28. package/dist/runtime/components/org-chart/OrgChartNode.vue +129 -0
  29. package/dist/runtime/components/org-chart/OrgChartNode.vue.d.ts +30 -0
  30. package/dist/runtime/composables/useEventCalendar.d.ts +52 -0
  31. package/dist/runtime/composables/useEventCalendar.js +362 -0
  32. package/dist/runtime/composables/useEventCalendarContext.d.ts +8 -0
  33. package/dist/runtime/composables/useEventCalendarContext.js +11 -0
  34. package/dist/runtime/composables/useEventCalendarDragDrop.d.ts +1 -1
  35. package/dist/runtime/composables/useEventCalendarDragDrop.js +11 -9
  36. package/dist/runtime/composables/useEventCalendarKeyboard.d.ts +20 -0
  37. package/dist/runtime/composables/useEventCalendarKeyboard.js +128 -0
  38. package/dist/runtime/composables/useEventCalendarResize.d.ts +31 -0
  39. package/dist/runtime/composables/useEventCalendarResize.js +87 -0
  40. package/dist/runtime/composables/useEventCalendarSelect.d.ts +21 -0
  41. package/dist/runtime/composables/useEventCalendarSelect.js +119 -0
  42. package/dist/runtime/composables/useOrgChart.d.ts +42 -0
  43. package/dist/runtime/composables/useOrgChart.js +154 -0
  44. package/dist/runtime/composables/useOrgChartContext.d.ts +8 -0
  45. package/dist/runtime/composables/useOrgChartContext.js +11 -0
  46. package/dist/runtime/composables/useOrgChartDragDrop.d.ts +20 -0
  47. package/dist/runtime/composables/useOrgChartDragDrop.js +67 -0
  48. package/dist/runtime/composables/useOrgChartKeyboard.d.ts +16 -0
  49. package/dist/runtime/composables/useOrgChartKeyboard.js +101 -0
  50. package/dist/runtime/composables/useOrgChartSearch.d.ts +16 -0
  51. package/dist/runtime/composables/useOrgChartSearch.js +62 -0
  52. package/dist/runtime/composables/useOrgChartZoom.d.ts +26 -0
  53. package/dist/runtime/composables/useOrgChartZoom.js +101 -0
  54. package/dist/runtime/index.d.ts +3 -0
  55. package/dist/runtime/index.js +2 -0
  56. package/dist/runtime/types/event-calendar.d.ts +170 -0
  57. package/dist/runtime/types/index.d.ts +2 -0
  58. package/dist/runtime/types/index.js +2 -0
  59. package/dist/runtime/types/org-chart.d.ts +181 -0
  60. package/dist/runtime/types/org-chart.js +0 -0
  61. package/dist/runtime/utils/event-calendar.d.ts +22 -1
  62. package/dist/runtime/utils/event-calendar.js +199 -1
  63. package/dist/runtime/utils/org-chart.d.ts +55 -0
  64. package/dist/runtime/utils/org-chart.js +367 -0
  65. package/dist/runtime/utils/recurrence.d.ts +30 -0
  66. package/dist/runtime/utils/recurrence.js +150 -0
  67. package/package.json +15 -6
@@ -0,0 +1,62 @@
1
+ import { computed } from "vue";
2
+ import { getAncestors } from "../utils/org-chart.js";
3
+ export function useOrgChartSearch(options) {
4
+ const matchedIds = computed(() => {
5
+ const query = options.searchQuery().trim().toLowerCase();
6
+ if (!query) return /* @__PURE__ */ new Set();
7
+ const ids = /* @__PURE__ */ new Set();
8
+ for (const node of options.nodes()) {
9
+ const name = node.name.toLowerCase();
10
+ const title = (node.title ?? "").toLowerCase();
11
+ if (name.includes(query) || title.includes(query)) {
12
+ ids.add(node.id);
13
+ }
14
+ }
15
+ return ids;
16
+ });
17
+ const visibleAncestorIds = computed(() => {
18
+ const query = options.searchQuery().trim();
19
+ if (!query) return /* @__PURE__ */ new Set();
20
+ const ids = /* @__PURE__ */ new Set();
21
+ const map = options.nodeMap.value;
22
+ for (const matchedId of matchedIds.value) {
23
+ const ancestors = getAncestors(matchedId, map);
24
+ for (const a of ancestors) {
25
+ ids.add(a.data.id);
26
+ }
27
+ }
28
+ return ids;
29
+ });
30
+ const isSearchActive = computed(() => options.searchQuery().trim().length > 0);
31
+ function expandToMatches() {
32
+ if (!isSearchActive.value || matchedIds.value.size === 0) return;
33
+ const next = new Set(options.expandedIds.value);
34
+ for (const id of visibleAncestorIds.value) {
35
+ next.add(id);
36
+ }
37
+ options.expandedIds.value = next;
38
+ options.onUpdateExpanded([...next]);
39
+ }
40
+ let lastQuery = "";
41
+ function checkAndExpand() {
42
+ const query = options.searchQuery().trim();
43
+ if (query !== lastQuery) {
44
+ lastQuery = query;
45
+ if (query) expandToMatches();
46
+ }
47
+ }
48
+ function isMatched(id) {
49
+ return matchedIds.value.has(id);
50
+ }
51
+ function isDimmed(id) {
52
+ if (!isSearchActive.value) return false;
53
+ return !matchedIds.value.has(id) && !visibleAncestorIds.value.has(id);
54
+ }
55
+ return {
56
+ matchedIds,
57
+ isSearchActive,
58
+ isMatched,
59
+ isDimmed,
60
+ checkAndExpand
61
+ };
62
+ }
@@ -0,0 +1,26 @@
1
+ import type { ComputedRef, Ref } from "vue";
2
+ import type { OrgChartTreeNode, ResolvedZoomConfig, ResolvedLayoutConfig } from "../types/org-chart.js";
3
+ export interface UseOrgChartZoomOptions {
4
+ config: () => ResolvedZoomConfig;
5
+ containerRef: Ref<HTMLElement | null>;
6
+ layoutWidth: ComputedRef<number>;
7
+ layoutHeight: ComputedRef<number>;
8
+ nodeMap: ComputedRef<Map<string | number, OrgChartTreeNode>>;
9
+ layoutConfig: () => ResolvedLayoutConfig;
10
+ }
11
+ export declare function useOrgChartZoom(options: UseOrgChartZoomOptions): {
12
+ scale: Ref<number, number>;
13
+ translateX: Ref<number, number>;
14
+ translateY: Ref<number, number>;
15
+ transformStyle: ComputedRef<{
16
+ transform: string;
17
+ transformOrigin: string;
18
+ }>;
19
+ zoomIn: () => void;
20
+ zoomOut: () => void;
21
+ zoomReset: () => void;
22
+ fitToView: () => void;
23
+ scrollToNode: (id: string | number) => void;
24
+ onWheel: (e: WheelEvent) => void;
25
+ onPointerDown: (e: PointerEvent) => void;
26
+ };
@@ -0,0 +1,101 @@
1
+ import { computed, ref } from "vue";
2
+ export function useOrgChartZoom(options) {
3
+ const scale = ref(options.config().initial);
4
+ const translateX = ref(0);
5
+ const translateY = ref(0);
6
+ let isPanning = false;
7
+ let panStartX = 0;
8
+ let panStartY = 0;
9
+ let panStartTX = 0;
10
+ let panStartTY = 0;
11
+ const transformStyle = computed(() => ({
12
+ transform: `scale(${scale.value}) translate(${translateX.value}px, ${translateY.value}px)`,
13
+ transformOrigin: "0 0"
14
+ }));
15
+ function clampScale(s) {
16
+ const cfg = options.config();
17
+ return Math.min(Math.max(s, cfg.min), cfg.max);
18
+ }
19
+ function zoomIn() {
20
+ scale.value = clampScale(scale.value + options.config().step);
21
+ }
22
+ function zoomOut() {
23
+ scale.value = clampScale(scale.value - options.config().step);
24
+ }
25
+ function zoomReset() {
26
+ scale.value = options.config().initial;
27
+ translateX.value = 0;
28
+ translateY.value = 0;
29
+ }
30
+ function fitToView() {
31
+ const container = options.containerRef.value?.parentElement;
32
+ if (!container) return;
33
+ const lw = options.layoutWidth.value;
34
+ const lh = options.layoutHeight.value;
35
+ if (lw === 0 || lh === 0) return;
36
+ const cw = container.clientWidth;
37
+ const ch = container.clientHeight;
38
+ const sx = cw / lw;
39
+ const sy = ch / lh;
40
+ const s = clampScale(Math.min(sx, sy) * 0.9);
41
+ scale.value = s;
42
+ translateX.value = (cw / s - lw) / 2;
43
+ translateY.value = (ch / s - lh) / 2;
44
+ }
45
+ function scrollToNode(id) {
46
+ const node = options.nodeMap.value.get(id);
47
+ const container = options.containerRef.value?.parentElement;
48
+ if (!node || !container) return;
49
+ const cfg = options.layoutConfig();
50
+ const nodeCenterX = node.x + cfg.nodeWidth / 2;
51
+ const nodeCenterY = node.y + cfg.nodeHeight / 2;
52
+ const cw = container.clientWidth;
53
+ const ch = container.clientHeight;
54
+ translateX.value = cw / scale.value / 2 - nodeCenterX;
55
+ translateY.value = ch / scale.value / 2 - nodeCenterY;
56
+ }
57
+ function onWheel(e) {
58
+ if (!options.config().enabled) return;
59
+ e.preventDefault();
60
+ let delta = e.deltaY;
61
+ if (e.deltaMode === 1) delta *= 40;
62
+ const zoomDelta = -delta * 1e-3;
63
+ scale.value = clampScale(scale.value + zoomDelta);
64
+ }
65
+ function onPointerDown(e) {
66
+ if (!options.config().enabled) return;
67
+ if (e.button !== 1 && !e.metaKey && !e.ctrlKey) return;
68
+ isPanning = true;
69
+ panStartX = e.clientX;
70
+ panStartY = e.clientY;
71
+ panStartTX = translateX.value;
72
+ panStartTY = translateY.value;
73
+ const onMove = (ev) => {
74
+ if (!isPanning) return;
75
+ const dx = (ev.clientX - panStartX) / scale.value;
76
+ const dy = (ev.clientY - panStartY) / scale.value;
77
+ translateX.value = panStartTX + dx;
78
+ translateY.value = panStartTY + dy;
79
+ };
80
+ const onUp = () => {
81
+ isPanning = false;
82
+ window.removeEventListener("pointermove", onMove);
83
+ window.removeEventListener("pointerup", onUp);
84
+ };
85
+ window.addEventListener("pointermove", onMove);
86
+ window.addEventListener("pointerup", onUp);
87
+ }
88
+ return {
89
+ scale,
90
+ translateX,
91
+ translateY,
92
+ transformStyle,
93
+ zoomIn,
94
+ zoomOut,
95
+ zoomReset,
96
+ fitToView,
97
+ scrollToNode,
98
+ onWheel,
99
+ onPointerDown
100
+ };
101
+ }
@@ -1 +1,4 @@
1
1
  export * from "./types/index.js";
2
+ export { expandRecurringEvents, expandRecurringEventsAsync, getVisibleRange } from "./utils/recurrence.js";
3
+ export type { VisibleRange } from "./utils/recurrence.js";
4
+ export { buildTree, computeLayout, computeFullLayout, computeConnectionPaths, flattenVisibleTree, buildNodeMap, getAllNodeIds, getAncestors, getDescendants } from "./utils/org-chart.js";
@@ -1 +1,3 @@
1
1
  export * from "./types/index.js";
2
+ export { expandRecurringEvents, expandRecurringEventsAsync, getVisibleRange } from "./utils/recurrence.js";
3
+ export { buildTree, computeLayout, computeFullLayout, computeConnectionPaths, flattenVisibleTree, buildNodeMap, getAllNodeIds, getAncestors, getDescendants } from "./utils/org-chart.js";
@@ -1,4 +1,7 @@
1
1
  import type { CalendarDate, CalendarDateTime, DateValue } from "@internationalized/date";
2
+ import type { ComputedRef, Ref, ShallowRef } from "vue";
3
+ /** All supported calendar view modes */
4
+ export type CalendarView = "month" | "week" | "day" | "list";
2
5
  /**
3
6
  * Represents an event on the calendar.
4
7
  * Accepts flexible date inputs (Date, ISO string, or DateValue).
@@ -18,6 +21,16 @@ export interface CalendarEvent {
18
21
  allDay?: boolean;
19
22
  /** Whether this event can be dragged. Defaults to true */
20
23
  draggable?: boolean;
24
+ /** Whether this event can be resized. Defaults to true */
25
+ resizable?: boolean;
26
+ /** RFC 5545 RRULE string, e.g. "FREQ=WEEKLY;BYDAY=MO,WE,FR". Requires the `rrule` package. */
27
+ rrule?: string;
28
+ /** Dates to exclude from the recurrence (RFC 5545 EXDATE) */
29
+ exdate?: (Date | string | DateValue)[];
30
+ /** Duration in minutes. Used to compute end for each occurrence. If absent, inferred from start/end. */
31
+ duration?: number;
32
+ /** ID of the parent recurring event. Present only on expanded occurrences (set internally). */
33
+ recurringEventId?: string | number;
21
34
  }
22
35
  /** Internal normalized event with parsed dates */
23
36
  export interface NormalizedEvent {
@@ -28,7 +41,10 @@ export interface NormalizedEvent {
28
41
  color: string;
29
42
  allDay: boolean;
30
43
  draggable: boolean;
44
+ resizable: boolean;
31
45
  original: CalendarEvent;
46
+ /** ID of the parent recurring event. Present only on expanded occurrences. */
47
+ recurringEventId?: string | number;
32
48
  }
33
49
  /** A single day cell in the calendar grid */
34
50
  export interface CalendarDay {
@@ -73,6 +89,9 @@ export interface DayViewOptions {
73
89
  /** Minutes per time slot row @defaultValue 30 */
74
90
  slotDuration?: 15 | 30 | 60;
75
91
  }
92
+ /** List/agenda view configuration */
93
+ export interface ListViewOptions {
94
+ }
76
95
  /** A timed event with computed pixel positions and overlap column info */
77
96
  export interface PositionedEvent extends NormalizedEvent {
78
97
  topPx: number;
@@ -89,4 +108,155 @@ export interface EventDropPayload {
89
108
  oldEnd: CalendarDate | CalendarDateTime;
90
109
  newStart: CalendarDate | CalendarDateTime;
91
110
  newEnd: CalendarDate | CalendarDateTime;
111
+ /** Parent recurring event ID. Set when a recurring occurrence was dropped. */
112
+ recurringEventId?: string | number;
113
+ /** The specific occurrence date/time that was dragged. Set when a recurring occurrence was dropped. */
114
+ occurrenceDate?: CalendarDate | CalendarDateTime;
115
+ }
116
+ /** Payload emitted after a resize operation */
117
+ export interface EventResizePayload {
118
+ event: CalendarEvent;
119
+ oldStart: CalendarDate | CalendarDateTime;
120
+ oldEnd: CalendarDate | CalendarDateTime;
121
+ newStart: CalendarDate | CalendarDateTime;
122
+ newEnd: CalendarDate | CalendarDateTime;
123
+ }
124
+ /** Payload emitted after a click or drag selection */
125
+ export interface SelectPayload {
126
+ start: CalendarDate | CalendarDateTime;
127
+ end: CalendarDate | CalendarDateTime;
128
+ allDay: boolean;
129
+ }
130
+ /** A spanning event positioned within a week row of the month grid */
131
+ export interface MonthSpanningEvent {
132
+ event: NormalizedEvent;
133
+ /** 0-based column index where this bar starts within the week */
134
+ startCol: number;
135
+ /** Number of columns this bar spans */
136
+ span: number;
137
+ /** 0-based lane (row) index assigned by the greedy algorithm */
138
+ lane: number;
139
+ /** Whether this bar includes the event's true start date */
140
+ isStart: boolean;
141
+ /** Whether this bar includes the event's true end date */
142
+ isEnd: boolean;
143
+ }
144
+ /** A single-day event positioned within a week row of the month grid */
145
+ export interface MonthSingleDayEvent {
146
+ event: NormalizedEvent;
147
+ /** 0-based column index */
148
+ col: number;
149
+ /** 0-based row index among single-day events for this column */
150
+ row: number;
151
+ /** Pre-computed CSS grid row (accounts for per-column spanning offset) */
152
+ gridRow: number;
153
+ }
154
+ /** Per-day overflow info for "+N more" */
155
+ export interface MonthDayOverflow {
156
+ col: number;
157
+ hiddenCount: number;
158
+ hiddenEvents: NormalizedEvent[];
159
+ /** Grid row index for the "+N more" chip */
160
+ gridRow: number;
161
+ }
162
+ /** Complete layout data for one week row in the month view */
163
+ export interface MonthWeekLayout {
164
+ week: CalendarWeek;
165
+ spanning: MonthSpanningEvent[];
166
+ singleDay: MonthSingleDayEvent[];
167
+ overflow: MonthDayOverflow[];
168
+ /** Total event rows for grid-template-rows */
169
+ totalEventRows: number;
170
+ /** Number of spanning lanes used */
171
+ spanningLaneCount: number;
172
+ }
173
+ /** Layout for the all-day row in week/day time grid view */
174
+ export interface AllDayLayout {
175
+ /** Spanning event bars with lane assignments */
176
+ spanning: MonthSpanningEvent[];
177
+ /** Total number of lanes used */
178
+ laneCount: number;
179
+ }
180
+ /** A day column in the week/day time grid view */
181
+ export interface TimeGridDay extends CalendarDay {
182
+ dateKey: string;
183
+ allDayEvents: NormalizedEvent[];
184
+ timedEvents: PositionedEvent[];
185
+ }
186
+ /** The context provided by EventCalendar root to sub-components via provide/inject */
187
+ export interface EventCalendarContext {
188
+ displayDate: ComputedRef<CalendarDate>;
189
+ view: ComputedRef<CalendarView>;
190
+ locale: ComputedRef<string>;
191
+ weekStartsOn: ComputedRef<0 | 1 | 2 | 3 | 4 | 5 | 6>;
192
+ editable: ComputedRef<boolean>;
193
+ loading: ComputedRef<boolean>;
194
+ color: ComputedRef<string>;
195
+ views: ComputedRef<CalendarView[]>;
196
+ monthConfig: ComputedRef<{
197
+ maxEvents: number;
198
+ fixedWeeks: boolean;
199
+ }>;
200
+ weekConfig: ComputedRef<{
201
+ startHour: number;
202
+ endHour: number;
203
+ slotDuration: number;
204
+ }>;
205
+ dayConfig: ComputedRef<{
206
+ startHour: number;
207
+ endHour: number;
208
+ slotDuration: number;
209
+ }>;
210
+ monthWeeks: ComputedRef<CalendarWeek[]>;
211
+ monthWeekLayouts: ComputedRef<MonthWeekLayout[]>;
212
+ weekdayLabels: ComputedRef<string[]>;
213
+ weekDays: ComputedRef<CalendarDay[]>;
214
+ dayViewDate: ComputedRef<CalendarDay>;
215
+ listDays: ComputedRef<CalendarDay[]>;
216
+ timeGridDays: ComputedRef<TimeGridDay[]>;
217
+ allDayLayout: ComputedRef<AllDayLayout>;
218
+ timeGridSlots: ComputedRef<TimeSlot[]>;
219
+ headerTitle: ComputedRef<string>;
220
+ formatTime: (d: CalendarDate | CalendarDateTime) => string;
221
+ formatTimeRange: (start: CalendarDate | CalendarDateTime, end: CalendarDate | CalendarDateTime) => string;
222
+ getEventStyle: (event: NormalizedEvent, bgOpacity?: number) => Record<string, string>;
223
+ isEventStart: (event: NormalizedEvent, date: CalendarDate) => boolean;
224
+ goToPrev: () => void;
225
+ goToNext: () => void;
226
+ goToToday: () => void;
227
+ setView: (v: CalendarView) => void;
228
+ handleDateClick: (day: CalendarDay) => void;
229
+ handleEventClick: (event: NormalizedEvent, e: Event) => void;
230
+ ui: ComputedRef<any>;
231
+ propUi: ComputedRef<any>;
232
+ draggedEventId: Ref<string | number | null>;
233
+ dropTargetKey: Ref<string | null>;
234
+ dragSnapSlot: Ref<string | null>;
235
+ onDragStart: (event: NormalizedEvent, e: DragEvent) => void;
236
+ onDragEnd: (e: DragEvent) => void;
237
+ onDragOver: (key: string, e: DragEvent) => void;
238
+ onDragLeave: () => void;
239
+ onTimeGridDragOver: (dateKey: string, e: DragEvent) => void;
240
+ onSlotDragOver: (slotKey: string, e: DragEvent) => void;
241
+ onDropMonthCell: (targetDate: CalendarDate, e: DragEvent) => void;
242
+ onDropTimeGrid: (targetDate: CalendarDate, e: DragEvent) => void;
243
+ resizingEventId: Ref<string | number | null>;
244
+ resizePreviewHeightPx: Ref<number | null>;
245
+ onResizePointerDown: (event: PositionedEvent, e: PointerEvent) => void;
246
+ focusedDate: ShallowRef<CalendarDate>;
247
+ isFocusedDate: (date: CalendarDate) => boolean;
248
+ onGridKeydown: (e: KeyboardEvent) => void;
249
+ formatDateAriaLabel: (date: CalendarDate) => string;
250
+ formatEventAriaLabel: (event: NormalizedEvent) => string;
251
+ selectable: ComputedRef<boolean>;
252
+ isSelecting: Ref<boolean>;
253
+ isSlotInSelection: (date: CalendarDate, hour: number, minute: number) => boolean;
254
+ isDateInSelection: (date: CalendarDate) => boolean;
255
+ onSlotPointerDown: (date: CalendarDate, hour: number, minute: number, e: PointerEvent) => void;
256
+ onSlotPointerMove: (date: CalendarDate, hour: number, minute: number) => void;
257
+ onDayCellPointerDown: (date: CalendarDate, e: PointerEvent) => void;
258
+ onDayCellPointerMove: (date: CalendarDate) => void;
259
+ onSelectionPointerUp: () => void;
260
+ preventNextClick: Ref<boolean>;
261
+ SLOT_HEIGHT: number;
92
262
  }
@@ -1,2 +1,4 @@
1
1
  export * from "./event-calendar.js";
2
2
  export * from "../components/EventCalendar.vue.js";
3
+ export * from "./org-chart.js";
4
+ export * from "../components/OrgChart.vue.js";
@@ -1,2 +1,4 @@
1
1
  export * from "./event-calendar.js";
2
2
  export * from "../components/EventCalendar.vue";
3
+ export * from "./org-chart.js";
4
+ export * from "../components/OrgChart.vue";
@@ -0,0 +1,181 @@
1
+ import type { ComputedRef, Ref } from "vue";
2
+ /** A single node in the org chart flat data */
3
+ export interface OrgChartNode {
4
+ /** Unique identifier */
5
+ id: string | number;
6
+ /** Parent node ID. `null` for the root node. */
7
+ parentId: string | number | null;
8
+ /** Display name */
9
+ name: string;
10
+ /** Optional secondary text (e.g., job title) */
11
+ title?: string;
12
+ /** Avatar image URL */
13
+ avatar?: string;
14
+ /** Icon name (e.g., `i-lucide-user`) */
15
+ icon?: string;
16
+ /** Nuxt UI color override for this node */
17
+ color?: string;
18
+ /** Arbitrary user-defined metadata passed through to slots */
19
+ metadata?: Record<string, unknown>;
20
+ }
21
+ /** Layout direction */
22
+ export type OrgChartDirection = "vertical" | "horizontal" | "bottom-up" | "right-to-left";
23
+ /** Connector line style */
24
+ export type OrgChartConnectorStyle = "right-angle" | "curved" | "straight";
25
+ /** Selection mode */
26
+ export type OrgChartSelectionMode = "none" | "single" | "multiple";
27
+ /** Tree node with computed relationships and layout position */
28
+ export interface OrgChartTreeNode {
29
+ /** Original flat node data */
30
+ data: OrgChartNode;
31
+ /** Parent tree node (null for root) */
32
+ parent: OrgChartTreeNode | null;
33
+ /** Direct children */
34
+ children: OrgChartTreeNode[];
35
+ /** Depth in the tree (root = 0) */
36
+ depth: number;
37
+ /** 0-based index among siblings */
38
+ indexInSiblings: number;
39
+ /** Total sibling count */
40
+ siblingCount: number;
41
+ /** Count of all descendants */
42
+ descendantCount: number;
43
+ /** Layout x position (top-left of node) */
44
+ x: number;
45
+ /** Layout y position (top-left of node) */
46
+ y: number;
47
+ }
48
+ /** Connector line segment between parent and child */
49
+ export interface OrgChartConnector {
50
+ /** Parent node ID */
51
+ fromId: string | number;
52
+ /** Child node ID */
53
+ toId: string | number;
54
+ /** SVG path data string (d attribute) */
55
+ path: string;
56
+ }
57
+ /** Non-hierarchical connection between any two nodes (e.g., dotted-line reporting) */
58
+ export interface OrgChartConnection {
59
+ /** Unique identifier for this connection */
60
+ id: string | number;
61
+ /** Source node ID */
62
+ fromId: string | number;
63
+ /** Target node ID */
64
+ toId: string | number;
65
+ /** Optional label displayed on the connection */
66
+ label?: string;
67
+ /** Line style @defaultValue 'dashed' */
68
+ style?: "dashed" | "dotted" | "solid";
69
+ /** Nuxt UI color for this connection */
70
+ color?: string;
71
+ /** Arbitrary metadata passed through to slots */
72
+ metadata?: Record<string, unknown>;
73
+ }
74
+ /** Computed connection path for rendering */
75
+ export interface OrgChartConnectionPath {
76
+ /** Original connection data */
77
+ connection: OrgChartConnection;
78
+ /** SVG path data string */
79
+ path: string;
80
+ /** Label position (midpoint of path) */
81
+ labelX: number;
82
+ labelY: number;
83
+ }
84
+ /** Computed layout result */
85
+ export interface OrgChartLayout {
86
+ /** All visible tree nodes with x, y positions */
87
+ nodes: OrgChartTreeNode[];
88
+ /** All connector paths (hierarchical parent-child) */
89
+ connectors: OrgChartConnector[];
90
+ /** Non-hierarchical connection paths */
91
+ connectionPaths: OrgChartConnectionPath[];
92
+ /** Total width of the layout (px) */
93
+ width: number;
94
+ /** Total height of the layout (px) */
95
+ height: number;
96
+ }
97
+ export interface OrgChartLayoutConfig {
98
+ /** Horizontal gap between sibling nodes (px) @defaultValue 40 */
99
+ siblingGap?: number;
100
+ /** Vertical gap between levels (px) @defaultValue 60 */
101
+ levelGap?: number;
102
+ /** Node width (px) @defaultValue 200 */
103
+ nodeWidth?: number;
104
+ /** Node height (px) @defaultValue 80 */
105
+ nodeHeight?: number;
106
+ /** Corner radius for right-angle connectors (px). Set to 0 for sharp corners. @defaultValue 8 */
107
+ connectorRadius?: number;
108
+ }
109
+ export type ResolvedLayoutConfig = Required<OrgChartLayoutConfig>;
110
+ export interface OrgChartZoomConfig {
111
+ /** Enable zoom/pan @defaultValue false */
112
+ enabled?: boolean;
113
+ /** Minimum zoom scale @defaultValue 0.25 */
114
+ min?: number;
115
+ /** Maximum zoom scale @defaultValue 2 */
116
+ max?: number;
117
+ /** Initial zoom scale @defaultValue 1 */
118
+ initial?: number;
119
+ /** Zoom step per scroll tick @defaultValue 0.1 */
120
+ step?: number;
121
+ /** Show zoom controls overlay @defaultValue true */
122
+ controls?: boolean;
123
+ }
124
+ export type ResolvedZoomConfig = Required<OrgChartZoomConfig>;
125
+ export interface OrgChartContext {
126
+ tree: ComputedRef<OrgChartTreeNode | null>;
127
+ layout: ComputedRef<OrgChartLayout>;
128
+ flatVisibleNodes: ComputedRef<OrgChartTreeNode[]>;
129
+ nodeMap: ComputedRef<Map<string | number, OrgChartTreeNode>>;
130
+ direction: ComputedRef<OrgChartDirection>;
131
+ connectorStyle: ComputedRef<OrgChartConnectorStyle>;
132
+ selectionMode: ComputedRef<OrgChartSelectionMode>;
133
+ compact: ComputedRef<boolean>;
134
+ animated: ComputedRef<boolean>;
135
+ draggable: ComputedRef<boolean>;
136
+ layoutConfig: ComputedRef<ResolvedLayoutConfig>;
137
+ zoomConfig: ComputedRef<ResolvedZoomConfig>;
138
+ expandedIds: Ref<Set<string | number>>;
139
+ selectedIds: Ref<Set<string | number>>;
140
+ focusedId: Ref<string | number | null>;
141
+ searchQuery: ComputedRef<string>;
142
+ matchedIds: ComputedRef<Set<string | number>>;
143
+ isMatched: (id: string | number) => boolean;
144
+ isDimmed: (id: string | number) => boolean;
145
+ isExpanded: (id: string | number) => boolean;
146
+ isSelected: (id: string | number) => boolean;
147
+ isFocused: (id: string | number) => boolean;
148
+ getDescendantCount: (id: string | number) => number;
149
+ getNode: (id: string | number) => OrgChartTreeNode | undefined;
150
+ getChildren: (id: string | number) => OrgChartTreeNode[];
151
+ getAncestors: (id: string | number) => OrgChartTreeNode[];
152
+ toggleExpand: (id: string | number) => void;
153
+ expandAll: () => void;
154
+ collapseAll: () => void;
155
+ selectNode: (id: string | number) => void;
156
+ deselectNode: (id: string | number) => void;
157
+ scrollToNode: (id: string | number) => void;
158
+ fitToView: () => void;
159
+ handleNodeClick: (node: OrgChartTreeNode, e: Event) => void;
160
+ onKeydown: (e: KeyboardEvent) => void;
161
+ draggedNodeId: Ref<string | number | null>;
162
+ dropTargetId: Ref<string | number | null>;
163
+ onDragStart: (nodeId: string | number, e: DragEvent) => void;
164
+ onDragOver: (nodeId: string | number, e: DragEvent) => void;
165
+ onDragLeave: (e: DragEvent) => void;
166
+ onDrop: (nodeId: string | number, e: DragEvent) => void;
167
+ onDragEnd: (e: DragEvent) => void;
168
+ connectionPaths: ComputedRef<OrgChartConnectionPath[]>;
169
+ handleConnectionClick: (connection: OrgChartConnection, e: Event) => void;
170
+ ui: ComputedRef<any>;
171
+ propUi: ComputedRef<any>;
172
+ scale: Ref<number>;
173
+ translateX: Ref<number>;
174
+ translateY: Ref<number>;
175
+ transformStyle: ComputedRef<Record<string, string>>;
176
+ zoomIn: () => void;
177
+ zoomOut: () => void;
178
+ zoomReset: () => void;
179
+ onWheel: (e: WheelEvent) => void;
180
+ onPointerDown: (e: PointerEvent) => void;
181
+ }
File without changes
@@ -1,5 +1,14 @@
1
1
  import type { CalendarDate, CalendarDateTime } from "@internationalized/date";
2
- import type { NormalizedEvent, PositionedEvent } from "../types/event-calendar.js";
2
+ import type { NormalizedEvent, PositionedEvent, CalendarWeek, MonthWeekLayout, AllDayLayout, TimeGridDay } from "../types/event-calendar.js";
3
+ /**
4
+ * Compute the start of the week for any weekStartsOn value (0=Sunday … 6=Saturday).
5
+ * Uses getDayOfWeek with a fixed locale ('en-US') so Sunday is always 0.
6
+ */
7
+ export declare function startOfWeekByDay(date: CalendarDate, weekStartsOn: number): CalendarDate;
8
+ /**
9
+ * Compute the end of the week for any weekStartsOn value.
10
+ */
11
+ export declare function endOfWeekByDay(date: CalendarDate, weekStartsOn: number): CalendarDate;
3
12
  /** Check whether a DateValue has hour/minute (CalendarDateTime vs CalendarDate) */
4
13
  export declare function hasTimeComponent(d: CalendarDate | CalendarDateTime): boolean;
5
14
  /**
@@ -14,3 +23,15 @@ export declare function layoutTimedEvents(events: NormalizedEvent[], config: {
14
23
  endHour: number;
15
24
  slotDuration: number;
16
25
  }, slotHeight: number): PositionedEvent[];
26
+ /**
27
+ * Compute layout for one week row in the month view.
28
+ *
29
+ * Assigns spanning (all-day / multi-day) events to horizontal lanes,
30
+ * then positions single-day events below. Returns grid row info for rendering.
31
+ */
32
+ export declare function layoutMonthWeekEvents(week: CalendarWeek, maxEvents: number): MonthWeekLayout;
33
+ /**
34
+ * Layout algorithm for the all-day row in week/day time grid views.
35
+ * Same greedy lane assignment as month view but without maxEvents cap or single-day partitioning.
36
+ */
37
+ export declare function layoutAllDayEvents(days: TimeGridDay[]): AllDayLayout;