nuxt-ui-elements-pro 0.1.6 → 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 (52) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +103 -3
  3. package/dist/runtime/components/EventCalendar.d.vue.ts +84 -3
  4. package/dist/runtime/components/EventCalendar.vue +129 -12
  5. package/dist/runtime/components/EventCalendar.vue.d.ts +84 -3
  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/{EventCalendarHeader.d.vue.ts → event-calendar/EventCalendarHeader.d.vue.ts} +20 -1
  10. package/dist/runtime/components/event-calendar/EventCalendarHeader.vue +55 -0
  11. package/dist/runtime/components/{EventCalendarHeader.vue.d.ts → event-calendar/EventCalendarHeader.vue.d.ts} +20 -1
  12. package/dist/runtime/components/{EventCalendarListView.d.vue.ts → event-calendar/EventCalendarListView.d.vue.ts} +1 -1
  13. package/dist/runtime/components/{EventCalendarListView.vue → event-calendar/EventCalendarListView.vue} +1 -1
  14. package/dist/runtime/components/{EventCalendarListView.vue.d.ts → event-calendar/EventCalendarListView.vue.d.ts} +1 -1
  15. package/dist/runtime/components/{EventCalendarMonthView.d.vue.ts → event-calendar/EventCalendarMonthView.d.vue.ts} +1 -1
  16. package/dist/runtime/components/{EventCalendarMonthView.vue → event-calendar/EventCalendarMonthView.vue} +1 -1
  17. package/dist/runtime/components/{EventCalendarMonthView.vue.d.ts → event-calendar/EventCalendarMonthView.vue.d.ts} +1 -1
  18. package/dist/runtime/components/{EventCalendarTimeGrid.d.vue.ts → event-calendar/EventCalendarTimeGrid.d.vue.ts} +1 -1
  19. package/dist/runtime/components/{EventCalendarTimeGrid.vue → event-calendar/EventCalendarTimeGrid.vue} +1 -1
  20. package/dist/runtime/components/{EventCalendarTimeGrid.vue.d.ts → event-calendar/EventCalendarTimeGrid.vue.d.ts} +1 -1
  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/useOrgChart.d.ts +42 -0
  31. package/dist/runtime/composables/useOrgChart.js +154 -0
  32. package/dist/runtime/composables/useOrgChartContext.d.ts +8 -0
  33. package/dist/runtime/composables/useOrgChartContext.js +11 -0
  34. package/dist/runtime/composables/useOrgChartDragDrop.d.ts +20 -0
  35. package/dist/runtime/composables/useOrgChartDragDrop.js +67 -0
  36. package/dist/runtime/composables/useOrgChartKeyboard.d.ts +16 -0
  37. package/dist/runtime/composables/useOrgChartKeyboard.js +101 -0
  38. package/dist/runtime/composables/useOrgChartSearch.d.ts +16 -0
  39. package/dist/runtime/composables/useOrgChartSearch.js +62 -0
  40. package/dist/runtime/composables/useOrgChartZoom.d.ts +26 -0
  41. package/dist/runtime/composables/useOrgChartZoom.js +101 -0
  42. package/dist/runtime/index.d.ts +1 -0
  43. package/dist/runtime/index.js +1 -0
  44. package/dist/runtime/types/event-calendar.d.ts +1 -0
  45. package/dist/runtime/types/index.d.ts +2 -4
  46. package/dist/runtime/types/index.js +2 -4
  47. package/dist/runtime/types/org-chart.d.ts +181 -0
  48. package/dist/runtime/types/org-chart.js +0 -0
  49. package/dist/runtime/utils/org-chart.d.ts +55 -0
  50. package/dist/runtime/utils/org-chart.js +367 -0
  51. package/package.json +1 -1
  52. package/dist/runtime/components/EventCalendarHeader.vue +0 -48
@@ -0,0 +1,154 @@
1
+ import { computed, ref, watch } from "vue";
2
+ import {
3
+ buildTree,
4
+ buildNodeMap,
5
+ computeFullLayout,
6
+ flattenVisibleTree,
7
+ getAllNodeIds,
8
+ getAncestors as getAncestorsUtil
9
+ } from "../utils/org-chart.js";
10
+ export function useOrgChart(options) {
11
+ const tree = computed(() => buildTree(options.nodes()));
12
+ const nodeMap = computed(() => {
13
+ if (!tree.value) return /* @__PURE__ */ new Map();
14
+ return buildNodeMap(tree.value);
15
+ });
16
+ const expandedIds = ref(/* @__PURE__ */ new Set());
17
+ watch(tree, (t) => {
18
+ if (!t) return;
19
+ const externalExpanded = options.expanded();
20
+ if (externalExpanded !== void 0) {
21
+ expandedIds.value = new Set(externalExpanded);
22
+ } else {
23
+ expandedIds.value = getAllNodeIds(t);
24
+ }
25
+ }, { immediate: true });
26
+ watch(() => options.expanded(), (ext) => {
27
+ if (ext !== void 0) {
28
+ expandedIds.value = new Set(ext);
29
+ }
30
+ });
31
+ function emitExpanded() {
32
+ options.onUpdateExpanded([...expandedIds.value]);
33
+ }
34
+ function toggleExpand(id) {
35
+ const next = new Set(expandedIds.value);
36
+ const node = nodeMap.value.get(id);
37
+ if (!node || node.children.length === 0) return;
38
+ const wasExpanded = next.has(id);
39
+ if (wasExpanded) {
40
+ next.delete(id);
41
+ } else {
42
+ next.add(id);
43
+ }
44
+ expandedIds.value = next;
45
+ emitExpanded();
46
+ if (node) {
47
+ options.onNodeExpand({ node: node.data, expanded: !wasExpanded });
48
+ }
49
+ }
50
+ function expandAll() {
51
+ if (!tree.value) return;
52
+ expandedIds.value = getAllNodeIds(tree.value);
53
+ emitExpanded();
54
+ }
55
+ function collapseAll() {
56
+ if (!tree.value) return;
57
+ expandedIds.value = /* @__PURE__ */ new Set([tree.value.data.id]);
58
+ emitExpanded();
59
+ }
60
+ const selectedIds = ref(/* @__PURE__ */ new Set());
61
+ watch(() => options.selected(), (ext) => {
62
+ if (ext !== void 0) {
63
+ selectedIds.value = new Set(ext);
64
+ }
65
+ }, { immediate: true });
66
+ function emitSelected() {
67
+ options.onUpdateSelected([...selectedIds.value]);
68
+ }
69
+ function selectNode(id) {
70
+ const mode = options.selectionMode();
71
+ if (mode === "none") return;
72
+ const node = nodeMap.value.get(id);
73
+ if (!node) return;
74
+ const next = new Set(mode === "single" ? [] : [...selectedIds.value]);
75
+ const wasSelected = selectedIds.value.has(id);
76
+ if (wasSelected) {
77
+ next.delete(id);
78
+ } else {
79
+ next.add(id);
80
+ }
81
+ selectedIds.value = next;
82
+ emitSelected();
83
+ options.onNodeSelect({ node: node.data, selected: !wasSelected });
84
+ }
85
+ function deselectNode(id) {
86
+ const next = new Set(selectedIds.value);
87
+ next.delete(id);
88
+ selectedIds.value = next;
89
+ emitSelected();
90
+ }
91
+ const layout = computed(() => {
92
+ if (!tree.value) {
93
+ return { nodes: [], connectors: [], connectionPaths: [], width: 0, height: 0 };
94
+ }
95
+ return computeFullLayout(
96
+ tree.value,
97
+ options.layoutConfig(),
98
+ options.direction(),
99
+ options.connectorStyle(),
100
+ expandedIds.value,
101
+ options.connections()
102
+ );
103
+ });
104
+ const flatVisibleNodes = computed(() => {
105
+ if (!tree.value) return [];
106
+ return flattenVisibleTree(tree.value, expandedIds.value);
107
+ });
108
+ function isExpanded(id) {
109
+ return expandedIds.value.has(id);
110
+ }
111
+ function isSelected(id) {
112
+ return selectedIds.value.has(id);
113
+ }
114
+ function getDescendantCount(id) {
115
+ const node = nodeMap.value.get(id);
116
+ return node ? node.descendantCount : 0;
117
+ }
118
+ function getNode(id) {
119
+ return nodeMap.value.get(id);
120
+ }
121
+ function getChildren(id) {
122
+ const node = nodeMap.value.get(id);
123
+ return node ? node.children : [];
124
+ }
125
+ function getAncestors(id) {
126
+ return getAncestorsUtil(id, nodeMap.value);
127
+ }
128
+ function handleNodeClick(treeNode, _e) {
129
+ options.onNodeClick(treeNode.data);
130
+ if (options.selectionMode() !== "none") {
131
+ selectNode(treeNode.data.id);
132
+ }
133
+ }
134
+ return {
135
+ tree,
136
+ nodeMap,
137
+ layout,
138
+ flatVisibleNodes,
139
+ expandedIds,
140
+ selectedIds,
141
+ toggleExpand,
142
+ expandAll,
143
+ collapseAll,
144
+ selectNode,
145
+ deselectNode,
146
+ isExpanded,
147
+ isSelected,
148
+ getDescendantCount,
149
+ getNode,
150
+ getChildren,
151
+ getAncestors,
152
+ handleNodeClick
153
+ };
154
+ }
@@ -0,0 +1,8 @@
1
+ import type { InjectionKey } from "vue";
2
+ import type { OrgChartContext } from "../types/org-chart.js";
3
+ export declare const orgChartContextKey: InjectionKey<OrgChartContext>;
4
+ /**
5
+ * Inject the OrgChart context in a sub-component.
6
+ * Throws if called outside an <UEOrgChart> root.
7
+ */
8
+ export declare function useOrgChartContext(): OrgChartContext;
@@ -0,0 +1,11 @@
1
+ import { inject } from "vue";
2
+ export const orgChartContextKey = Symbol("nuxt-ui-elements-pro.org-chart");
3
+ export function useOrgChartContext() {
4
+ const ctx = inject(orgChartContextKey);
5
+ if (!ctx) {
6
+ throw new Error(
7
+ "[OrgChart] useOrgChartContext() was called outside of an <UEOrgChart> root. Sub-components must be used as children of <UEOrgChart>."
8
+ );
9
+ }
10
+ return ctx;
11
+ }
@@ -0,0 +1,20 @@
1
+ import type { ComputedRef } from "vue";
2
+ import type { OrgChartNode, OrgChartTreeNode } from "../types/org-chart.js";
3
+ export interface UseOrgChartDragDropOptions {
4
+ draggable: () => boolean;
5
+ nodeMap: ComputedRef<Map<string | number, OrgChartTreeNode>>;
6
+ onNodeDrop: (payload: {
7
+ node: OrgChartNode;
8
+ oldParentId: string | number | null;
9
+ newParentId: string | number;
10
+ }) => void;
11
+ }
12
+ export declare function useOrgChartDragDrop(options: UseOrgChartDragDropOptions): {
13
+ draggedNodeId: import("vue").Ref<string | number | null, string | number | null>;
14
+ dropTargetId: import("vue").Ref<string | number | null, string | number | null>;
15
+ onDragStart: (nodeId: string | number, e: DragEvent) => void;
16
+ onDragOver: (nodeId: string | number, e: DragEvent) => void;
17
+ onDragLeave: (_e: DragEvent) => void;
18
+ onDrop: (nodeId: string | number, e: DragEvent) => void;
19
+ onDragEnd: (_e: DragEvent) => void;
20
+ };
@@ -0,0 +1,67 @@
1
+ import { ref } from "vue";
2
+ import { getDescendants } from "../utils/org-chart.js";
3
+ export function useOrgChartDragDrop(options) {
4
+ const draggedNodeId = ref(null);
5
+ const dropTargetId = ref(null);
6
+ function onDragStart(nodeId, e) {
7
+ if (!options.draggable()) return;
8
+ const node = options.nodeMap.value.get(nodeId);
9
+ if (!node) return;
10
+ if (!node.parent) {
11
+ e.preventDefault();
12
+ return;
13
+ }
14
+ draggedNodeId.value = nodeId;
15
+ if (e.dataTransfer) {
16
+ e.dataTransfer.effectAllowed = "move";
17
+ e.dataTransfer.setData("text/plain", String(nodeId));
18
+ }
19
+ }
20
+ function onDragOver(nodeId, e) {
21
+ if (!options.draggable() || draggedNodeId.value === null) return;
22
+ if (nodeId === draggedNodeId.value) return;
23
+ const draggedNode = options.nodeMap.value.get(draggedNodeId.value);
24
+ if (draggedNode) {
25
+ const descendants = getDescendants(draggedNode);
26
+ if (descendants.some((d) => d.data.id === nodeId)) return;
27
+ }
28
+ e.preventDefault();
29
+ if (e.dataTransfer) {
30
+ e.dataTransfer.dropEffect = "move";
31
+ }
32
+ dropTargetId.value = nodeId;
33
+ }
34
+ function onDragLeave(_e) {
35
+ dropTargetId.value = null;
36
+ }
37
+ function onDrop(nodeId, e) {
38
+ if (!options.draggable() || draggedNodeId.value === null) return;
39
+ e.preventDefault();
40
+ const draggedNode = options.nodeMap.value.get(draggedNodeId.value);
41
+ if (!draggedNode) return;
42
+ if (nodeId === draggedNodeId.value) return;
43
+ const descendants = getDescendants(draggedNode);
44
+ if (descendants.some((d) => d.data.id === nodeId)) return;
45
+ const oldParentId = draggedNode.data.parentId;
46
+ options.onNodeDrop({
47
+ node: draggedNode.data,
48
+ oldParentId,
49
+ newParentId: nodeId
50
+ });
51
+ draggedNodeId.value = null;
52
+ dropTargetId.value = null;
53
+ }
54
+ function onDragEnd(_e) {
55
+ draggedNodeId.value = null;
56
+ dropTargetId.value = null;
57
+ }
58
+ return {
59
+ draggedNodeId,
60
+ dropTargetId,
61
+ onDragStart,
62
+ onDragOver,
63
+ onDragLeave,
64
+ onDrop,
65
+ onDragEnd
66
+ };
67
+ }
@@ -0,0 +1,16 @@
1
+ import type { ComputedRef, Ref } from "vue";
2
+ import type { OrgChartTreeNode, OrgChartSelectionMode } from "../types/org-chart.js";
3
+ export interface UseOrgChartKeyboardOptions {
4
+ flatVisibleNodes: ComputedRef<OrgChartTreeNode[]>;
5
+ nodeMap: ComputedRef<Map<string | number, OrgChartTreeNode>>;
6
+ expandedIds: Ref<Set<string | number>>;
7
+ selectionMode: () => OrgChartSelectionMode;
8
+ toggleExpand: (id: string | number) => void;
9
+ selectNode: (id: string | number) => void;
10
+ scrollToNode: (id: string | number) => void;
11
+ }
12
+ export declare function useOrgChartKeyboard(options: UseOrgChartKeyboardOptions): {
13
+ focusedId: Ref<string | number | null, string | number | null>;
14
+ isFocused: (id: string | number) => boolean;
15
+ onKeydown: (e: KeyboardEvent) => void;
16
+ };
@@ -0,0 +1,101 @@
1
+ import { ref } from "vue";
2
+ export function useOrgChartKeyboard(options) {
3
+ const focusedId = ref(null);
4
+ function isFocused(id) {
5
+ return focusedId.value === id;
6
+ }
7
+ function focusNode(id) {
8
+ focusedId.value = id;
9
+ options.scrollToNode(id);
10
+ }
11
+ function onKeydown(e) {
12
+ const nodes = options.flatVisibleNodes.value;
13
+ if (nodes.length === 0) return;
14
+ if (focusedId.value === null) {
15
+ focusNode(nodes[0].data.id);
16
+ return;
17
+ }
18
+ const currentIndex = nodes.findIndex((n) => n.data.id === focusedId.value);
19
+ if (currentIndex === -1) {
20
+ focusNode(nodes[0].data.id);
21
+ return;
22
+ }
23
+ const current = nodes[currentIndex];
24
+ switch (e.key) {
25
+ case "ArrowUp": {
26
+ e.preventDefault();
27
+ if (current.parent) {
28
+ focusNode(current.parent.data.id);
29
+ }
30
+ break;
31
+ }
32
+ case "ArrowDown": {
33
+ e.preventDefault();
34
+ if (current.children.length > 0 && options.expandedIds.value.has(current.data.id)) {
35
+ focusNode(current.children[0].data.id);
36
+ }
37
+ break;
38
+ }
39
+ case "ArrowLeft": {
40
+ e.preventDefault();
41
+ if (current.children.length > 0 && options.expandedIds.value.has(current.data.id)) {
42
+ options.toggleExpand(current.data.id);
43
+ } else if (current.parent) {
44
+ focusNode(current.parent.data.id);
45
+ }
46
+ break;
47
+ }
48
+ case "ArrowRight": {
49
+ e.preventDefault();
50
+ if (current.children.length > 0) {
51
+ if (!options.expandedIds.value.has(current.data.id)) {
52
+ options.toggleExpand(current.data.id);
53
+ } else {
54
+ focusNode(current.children[0].data.id);
55
+ }
56
+ }
57
+ break;
58
+ }
59
+ case "Enter": {
60
+ e.preventDefault();
61
+ if (current.children.length > 0) {
62
+ options.toggleExpand(current.data.id);
63
+ }
64
+ break;
65
+ }
66
+ case " ": {
67
+ e.preventDefault();
68
+ if (options.selectionMode() !== "none") {
69
+ options.selectNode(current.data.id);
70
+ }
71
+ break;
72
+ }
73
+ case "Home": {
74
+ e.preventDefault();
75
+ focusNode(nodes[0].data.id);
76
+ break;
77
+ }
78
+ case "End": {
79
+ e.preventDefault();
80
+ focusNode(nodes[nodes.length - 1].data.id);
81
+ break;
82
+ }
83
+ case "*": {
84
+ e.preventDefault();
85
+ if (current.parent) {
86
+ for (const sibling of current.parent.children) {
87
+ if (sibling.children.length > 0 && !options.expandedIds.value.has(sibling.data.id)) {
88
+ options.toggleExpand(sibling.data.id);
89
+ }
90
+ }
91
+ }
92
+ break;
93
+ }
94
+ }
95
+ }
96
+ return {
97
+ focusedId,
98
+ isFocused,
99
+ onKeydown
100
+ };
101
+ }
@@ -0,0 +1,16 @@
1
+ import type { ComputedRef, Ref } from "vue";
2
+ import type { OrgChartNode, OrgChartTreeNode } from "../types/org-chart.js";
3
+ export interface UseOrgChartSearchOptions {
4
+ searchQuery: () => string;
5
+ nodes: () => OrgChartNode[];
6
+ nodeMap: ComputedRef<Map<string | number, OrgChartTreeNode>>;
7
+ expandedIds: Ref<Set<string | number>>;
8
+ onUpdateExpanded: (ids: (string | number)[]) => void;
9
+ }
10
+ export declare function useOrgChartSearch(options: UseOrgChartSearchOptions): {
11
+ matchedIds: ComputedRef<Set<string | number>>;
12
+ isSearchActive: ComputedRef<boolean>;
13
+ isMatched: (id: string | number) => boolean;
14
+ isDimmed: (id: string | number) => boolean;
15
+ checkAndExpand: () => void;
16
+ };
@@ -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,3 +1,4 @@
1
1
  export * from "./types/index.js";
2
2
  export { expandRecurringEvents, expandRecurringEventsAsync, getVisibleRange } from "./utils/recurrence.js";
3
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,2 +1,3 @@
1
1
  export * from "./types/index.js";
2
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";
@@ -192,6 +192,7 @@ export interface EventCalendarContext {
192
192
  editable: ComputedRef<boolean>;
193
193
  loading: ComputedRef<boolean>;
194
194
  color: ComputedRef<string>;
195
+ views: ComputedRef<CalendarView[]>;
195
196
  monthConfig: ComputedRef<{
196
197
  maxEvents: number;
197
198
  fixedWeeks: boolean;
@@ -1,6 +1,4 @@
1
1
  export * from "./event-calendar.js";
2
2
  export * from "../components/EventCalendar.vue.js";
3
- export * from "../components/EventCalendarHeader.vue.js";
4
- export * from "../components/EventCalendarMonthView.vue.js";
5
- export * from "../components/EventCalendarTimeGrid.vue.js";
6
- export * from "../components/EventCalendarListView.vue.js";
3
+ export * from "./org-chart.js";
4
+ export * from "../components/OrgChart.vue.js";
@@ -1,6 +1,4 @@
1
1
  export * from "./event-calendar.js";
2
2
  export * from "../components/EventCalendar.vue";
3
- export * from "../components/EventCalendarHeader.vue";
4
- export * from "../components/EventCalendarMonthView.vue";
5
- export * from "../components/EventCalendarTimeGrid.vue";
6
- export * from "../components/EventCalendarListView.vue";
3
+ export * from "./org-chart.js";
4
+ export * from "../components/OrgChart.vue";