@dou-ui/gantt 0.0.0-stage → 0.1.0-alpha.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.
Files changed (119) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -2
  3. package/dist/collaboration/index.js +323 -0
  4. package/dist/collaboration/index.js.map +1 -0
  5. package/dist/collaboration/peers.js +78 -0
  6. package/dist/collaboration/peers.js.map +1 -0
  7. package/dist/components/cell-editor.js +6 -0
  8. package/dist/components/cell-editor.js.map +1 -0
  9. package/dist/components/cell-editor.vue_vue_type_script_setup_true_lang.js +114 -0
  10. package/dist/components/cell-editor.vue_vue_type_script_setup_true_lang.js.map +1 -0
  11. package/dist/components/gantt-menu.js +6 -0
  12. package/dist/components/gantt-menu.js.map +1 -0
  13. package/dist/components/gantt-menu.vue_vue_type_script_setup_true_lang.js +40 -0
  14. package/dist/components/gantt-menu.vue_vue_type_script_setup_true_lang.js.map +1 -0
  15. package/dist/components/time-grid.js +6 -0
  16. package/dist/components/time-grid.js.map +1 -0
  17. package/dist/components/time-grid.vue_vue_type_script_setup_true_lang.js +32 -0
  18. package/dist/components/time-grid.vue_vue_type_script_setup_true_lang.js.map +1 -0
  19. package/dist/components/time-header.js +6 -0
  20. package/dist/components/time-header.js.map +1 -0
  21. package/dist/components/time-header.vue_vue_type_script_setup_true_lang.js +60 -0
  22. package/dist/components/time-header.vue_vue_type_script_setup_true_lang.js.map +1 -0
  23. package/dist/context.js +12 -0
  24. package/dist/context.js.map +1 -0
  25. package/dist/core/baseline.js +48 -0
  26. package/dist/core/baseline.js.map +1 -0
  27. package/dist/core/calendar.js +191 -0
  28. package/dist/core/calendar.js.map +1 -0
  29. package/dist/core/csv.js +424 -0
  30. package/dist/core/csv.js.map +1 -0
  31. package/dist/core/document.js +231 -0
  32. package/dist/core/document.js.map +1 -0
  33. package/dist/core/extension.js +42 -0
  34. package/dist/core/extension.js.map +1 -0
  35. package/dist/core/geometry.js +112 -0
  36. package/dist/core/geometry.js.map +1 -0
  37. package/dist/core/history.js +70 -0
  38. package/dist/core/history.js.map +1 -0
  39. package/dist/core/links.js +72 -0
  40. package/dist/core/links.js.map +1 -0
  41. package/dist/core/model.js +52 -0
  42. package/dist/core/model.js.map +1 -0
  43. package/dist/core/order.js +34 -0
  44. package/dist/core/order.js.map +1 -0
  45. package/dist/core/scale.js +118 -0
  46. package/dist/core/scale.js.map +1 -0
  47. package/dist/core/schedule.js +235 -0
  48. package/dist/core/schedule.js.map +1 -0
  49. package/dist/core/time.js +81 -0
  50. package/dist/core/time.js.map +1 -0
  51. package/dist/core/transaction.js +371 -0
  52. package/dist/core/transaction.js.map +1 -0
  53. package/dist/core/tree.js +114 -0
  54. package/dist/core/tree.js.map +1 -0
  55. package/dist/export/draw.js +214 -0
  56. package/dist/export/draw.js.map +1 -0
  57. package/dist/export/theme.js +131 -0
  58. package/dist/export/theme.js.map +1 -0
  59. package/dist/gantt.js +6 -0
  60. package/dist/gantt.js.map +1 -0
  61. package/dist/gantt.vue_vue_type_script_setup_true_lang.js +2774 -0
  62. package/dist/gantt.vue_vue_type_script_setup_true_lang.js.map +1 -0
  63. package/dist/index.js +20 -0
  64. package/dist/index.js.map +1 -0
  65. package/dist/labels.js +87 -0
  66. package/dist/labels.js.map +1 -0
  67. package/dist/locale.js +355 -0
  68. package/dist/locale.js.map +1 -0
  69. package/dist/scheduler/index.js +8 -0
  70. package/dist/scheduler/index.js.map +1 -0
  71. package/dist/scheduler/layout.js +97 -0
  72. package/dist/scheduler/layout.js.map +1 -0
  73. package/dist/scheduler/scheduler.js +6 -0
  74. package/dist/scheduler/scheduler.js.map +1 -0
  75. package/dist/scheduler/scheduler.vue_vue_type_script_setup_true_lang.js +1359 -0
  76. package/dist/scheduler/scheduler.vue_vue_type_script_setup_true_lang.js.map +1 -0
  77. package/dist/scheduler/style.d.ts +1 -0
  78. package/dist/scheduler/style.js +2 -0
  79. package/dist/style.css +1 -0
  80. package/dist/style.d.ts +1 -0
  81. package/dist/style.js +4 -0
  82. package/dist/time-axis.js +337 -0
  83. package/dist/time-axis.js.map +1 -0
  84. package/dist/types/collaboration/index.d.ts +39 -0
  85. package/dist/types/collaboration/peers.d.ts +22 -0
  86. package/dist/types/components/cell-editor.vue.d.ts +21 -0
  87. package/dist/types/components/gantt-menu.vue.d.ts +18 -0
  88. package/dist/types/components/time-grid.vue.d.ts +12 -0
  89. package/dist/types/components/time-header.vue.d.ts +23 -0
  90. package/dist/types/context.d.ts +64 -0
  91. package/dist/types/core/baseline.d.ts +14 -0
  92. package/dist/types/core/calendar.d.ts +75 -0
  93. package/dist/types/core/csv.d.ts +77 -0
  94. package/dist/types/core/document.d.ts +51 -0
  95. package/dist/types/core/extension.d.ts +88 -0
  96. package/dist/types/core/geometry.d.ts +33 -0
  97. package/dist/types/core/history.d.ts +19 -0
  98. package/dist/types/core/links.d.ts +20 -0
  99. package/dist/types/core/menu.d.ts +27 -0
  100. package/dist/types/core/model.d.ts +72 -0
  101. package/dist/types/core/order.d.ts +9 -0
  102. package/dist/types/core/scale.d.ts +33 -0
  103. package/dist/types/core/schedule.d.ts +44 -0
  104. package/dist/types/core/time.d.ts +39 -0
  105. package/dist/types/core/transaction.d.ts +134 -0
  106. package/dist/types/core/tree.d.ts +30 -0
  107. package/dist/types/export/draw.d.ts +76 -0
  108. package/dist/types/export/theme.d.ts +49 -0
  109. package/dist/types/gantt.vue.d.ts +54 -0
  110. package/dist/types/index.d.ts +148 -0
  111. package/dist/types/labels.d.ts +24 -0
  112. package/dist/types/locale.d.ts +161 -0
  113. package/dist/types/scheduler/index.d.ts +102 -0
  114. package/dist/types/scheduler/layout.d.ts +58 -0
  115. package/dist/types/scheduler/scheduler.vue.d.ts +46 -0
  116. package/dist/types/scheduler/types.d.ts +109 -0
  117. package/dist/types/time-axis.d.ts +80 -0
  118. package/dist/types/types.d.ts +305 -0
  119. package/package.json +79 -4
package/dist/locale.js ADDED
@@ -0,0 +1,355 @@
1
+ import { useLocale } from "dou-ui";
2
+ import { computed, toValue } from "vue";
3
+ // src/locale.ts
4
+ var zhCN = {
5
+ chart: "甘特图",
6
+ columns: {
7
+ title: "任务",
8
+ start: "开始",
9
+ end: "结束",
10
+ duration: "工期",
11
+ progress: "进度"
12
+ },
13
+ months: Array.from({ length: 12 }, (_, i) => `${i + 1}月`),
14
+ weekdays: [
15
+ "周日",
16
+ "周一",
17
+ "周二",
18
+ "周三",
19
+ "周四",
20
+ "周五",
21
+ "周六"
22
+ ],
23
+ year: "{year}年",
24
+ yearMonth: "{year}年{month}",
25
+ month: "{month}",
26
+ monthDay: "{month}{day}日",
27
+ dayWithWeekday: "{month}{day}日 {weekday}",
28
+ quarter: "Q{quarter}",
29
+ halves: ["上半年", "下半年"],
30
+ hour: "{hour}:00",
31
+ days: "{count} 天",
32
+ hours: "{count} 小时",
33
+ today: "今天",
34
+ expand: "展开",
35
+ collapse: "收起",
36
+ task: "{title},{dates},{duration},进度 {progress}%",
37
+ milestone: "里程碑:{title},{start}",
38
+ summary: "{title},{dates},进度 {progress}%",
39
+ unscheduled: "{title},未排期",
40
+ range: "{start}至{end}",
41
+ offDays: "休息日",
42
+ offHours: "非工作时间",
43
+ dateTime: "{date} {time}",
44
+ rangeTip: "{start} – {end} · {duration}",
45
+ progressTip: "进度 {value}%",
46
+ linkRefusals: {
47
+ nested: "不能连到自己的上级或子任务",
48
+ duplicate: "这两个任务之间已经有依赖",
49
+ cycle: "会形成循环依赖"
50
+ },
51
+ baseline: {
52
+ late: "比计划晚 {duration}",
53
+ early: "比计划早 {duration}",
54
+ withChange: "{task},{change}"
55
+ },
56
+ moveRefused: "不能移到这里",
57
+ resizeTable: "调整列表宽度",
58
+ daysColumn: "{title}(天)",
59
+ hoursColumn: "{title}(小时)",
60
+ idColumn: "ID",
61
+ parentColumn: "上级任务 ID",
62
+ csvNoTitle: "文件里没有“{title}”列,无法读出任务",
63
+ keys: "上下键选择任务,左右键收起或展开,空格选中;Alt 加左右键移动任务,Alt 加 Shift 加左右键调整结束时间;L 添加依赖;F2 重命名,菜单键打开菜单",
64
+ linkMode: "从“{title}”添加依赖:上下键选择后续任务,Enter 确认,Esc 取消",
65
+ linked: "已添加依赖:{from} → {to}",
66
+ linkRemoved: "已删除依赖",
67
+ cancelled: "已取消",
68
+ linkChanged: "依赖已修改",
69
+ taskRemoved: "{title},已删除",
70
+ undone: "已撤销:{change}",
71
+ redone: "已重做:{change}",
72
+ changeCancelled: "这次修改没有生效",
73
+ pushed: "{task};另有 {count} 个任务随之推后",
74
+ broken: "{task};{count} 条依赖未满足",
75
+ scheduled: "已重新排期,移动了 {count} 个任务",
76
+ newTask: "新任务",
77
+ addRow: "添加任务",
78
+ taskAdded: "已添加{title}",
79
+ movedUnder: "{task}已移到{parent}下",
80
+ movedTop: "{task}已移到最外层",
81
+ invalidValue: "{column}无效,未修改",
82
+ tasksRemoved: "已删除:{titles}",
83
+ listSeparator: "、",
84
+ editCell: "编辑{column}",
85
+ menu: {
86
+ rename: "重命名",
87
+ addAfter: "在下方添加任务",
88
+ addInside: "添加子任务",
89
+ addTask: "添加任务",
90
+ indent: "缩进",
91
+ outdent: "取消缩进",
92
+ removeTask: "删除任务",
93
+ removeTasks: "删除 {count} 个任务",
94
+ removeLink: "删除依赖"
95
+ },
96
+ criticalTask: "{task},关键任务",
97
+ scheduler: {
98
+ name: "资源排期",
99
+ resource: "资源",
100
+ unassigned: "未分配",
101
+ keys: "方向键在任务之间移动,Alt 加左右方向键改时间,Alt 加上下方向键换资源,菜单键打开菜单,Delete 删除,Mod+Z 撤销",
102
+ task: "{title},{dates},{duration}",
103
+ item: "{task},{resource}",
104
+ row: "{title},{count} 项",
105
+ overloaded: "{row},有时段超出可承担的数量",
106
+ overloadHint: "有时段超出可承担的数量",
107
+ moved: "{title}已移到{resource}"
108
+ }
109
+ };
110
+ var zhTW = {
111
+ ...zhCN,
112
+ chart: "甘特圖",
113
+ columns: {
114
+ title: "任務",
115
+ start: "開始",
116
+ end: "結束",
117
+ duration: "工期",
118
+ progress: "進度"
119
+ },
120
+ weekdays: [
121
+ "週日",
122
+ "週一",
123
+ "週二",
124
+ "週三",
125
+ "週四",
126
+ "週五",
127
+ "週六"
128
+ ],
129
+ halves: ["上半年", "下半年"],
130
+ hours: "{count} 小時",
131
+ expand: "展開",
132
+ collapse: "收合",
133
+ task: "{title},{dates},{duration},進度 {progress}%",
134
+ milestone: "里程碑:{title},{start}",
135
+ summary: "{title},{dates},進度 {progress}%",
136
+ unscheduled: "{title},未排程",
137
+ range: "{start}至{end}",
138
+ offDays: "休息日",
139
+ offHours: "非工作時間",
140
+ progressTip: "進度 {value}%",
141
+ linkRefusals: {
142
+ nested: "不能連到自己的上層或子任務",
143
+ duplicate: "這兩個任務之間已經有相依關係",
144
+ cycle: "會形成循環相依"
145
+ },
146
+ baseline: {
147
+ late: "比計畫晚 {duration}",
148
+ early: "比計畫早 {duration}",
149
+ withChange: "{task},{change}"
150
+ },
151
+ moveRefused: "不能移到這裡",
152
+ resizeTable: "調整列表寬度",
153
+ daysColumn: "{title}(天)",
154
+ hoursColumn: "{title}(小時)",
155
+ idColumn: "ID",
156
+ parentColumn: "上層任務 ID",
157
+ csvNoTitle: "檔案裡沒有「{title}」欄,無法讀出任務",
158
+ keys: "上下鍵選擇任務,左右鍵收合或展開,空白鍵選取;Alt 加左右鍵移動任務,Alt 加 Shift 加左右鍵調整結束時間;L 新增相依;F2 重新命名,選單鍵開啟選單",
159
+ linkMode: "從「{title}」新增相依:上下鍵選擇後續任務,Enter 確認,Esc 取消",
160
+ linked: "已新增相依:{from} → {to}",
161
+ linkRemoved: "已刪除相依",
162
+ cancelled: "已取消",
163
+ linkChanged: "相依已修改",
164
+ taskRemoved: "{title},已刪除",
165
+ undone: "已復原:{change}",
166
+ redone: "已重做:{change}",
167
+ changeCancelled: "這次修改沒有生效",
168
+ pushed: "{task};另有 {count} 個任務隨之延後",
169
+ broken: "{task};{count} 條相依未滿足",
170
+ scheduled: "已重新排程,移動了 {count} 個任務",
171
+ newTask: "新任務",
172
+ addRow: "新增任務",
173
+ taskAdded: "已新增{title}",
174
+ movedUnder: "{task}已移到{parent}下",
175
+ movedTop: "{task}已移到最外層",
176
+ invalidValue: "{column}無效,未修改",
177
+ tasksRemoved: "已刪除:{titles}",
178
+ editCell: "編輯{column}",
179
+ menu: {
180
+ rename: "重新命名",
181
+ addAfter: "在下方新增任務",
182
+ addInside: "新增子任務",
183
+ addTask: "新增任務",
184
+ indent: "縮排",
185
+ outdent: "取消縮排",
186
+ removeTask: "刪除任務",
187
+ removeTasks: "刪除 {count} 個任務",
188
+ removeLink: "刪除相依"
189
+ },
190
+ criticalTask: "{task},要徑任務",
191
+ scheduler: {
192
+ name: "資源排程",
193
+ resource: "資源",
194
+ unassigned: "未分配",
195
+ keys: "方向鍵在任務之間移動,Alt 加左右方向鍵改時間,Alt 加上下方向鍵換資源,選單鍵開啟選單,Delete 刪除,Mod+Z 復原",
196
+ task: "{title},{dates},{duration}",
197
+ item: "{task},{resource}",
198
+ row: "{title},{count} 項",
199
+ overloaded: "{row},有時段超出可承擔的數量",
200
+ overloadHint: "有時段超出可承擔的數量",
201
+ moved: "{title}已移到{resource}"
202
+ }
203
+ };
204
+ var en = {
205
+ chart: "Gantt chart",
206
+ columns: {
207
+ title: "Task",
208
+ start: "Start",
209
+ end: "End",
210
+ duration: "Duration",
211
+ progress: "Progress"
212
+ },
213
+ months: [
214
+ "Jan",
215
+ "Feb",
216
+ "Mar",
217
+ "Apr",
218
+ "May",
219
+ "Jun",
220
+ "Jul",
221
+ "Aug",
222
+ "Sep",
223
+ "Oct",
224
+ "Nov",
225
+ "Dec"
226
+ ],
227
+ weekdays: [
228
+ "Sun",
229
+ "Mon",
230
+ "Tue",
231
+ "Wed",
232
+ "Thu",
233
+ "Fri",
234
+ "Sat"
235
+ ],
236
+ year: "{year}",
237
+ yearMonth: "{month} {year}",
238
+ month: "{month}",
239
+ monthDay: "{month} {day}",
240
+ dayWithWeekday: "{weekday}, {month} {day}",
241
+ quarter: "Q{quarter}",
242
+ halves: ["H1", "H2"],
243
+ hour: "{hour}:00",
244
+ days: "{count} d",
245
+ hours: "{count} h",
246
+ today: "Today",
247
+ expand: "Expand",
248
+ collapse: "Collapse",
249
+ task: "{title}, {dates}, {duration}, {progress}% done",
250
+ milestone: "Milestone: {title}, {start}",
251
+ summary: "{title}, {dates}, {progress}% done",
252
+ unscheduled: "{title}, not scheduled",
253
+ range: "{start} to {end}",
254
+ offDays: "days off",
255
+ offHours: "outside working hours",
256
+ dateTime: "{date} {time}",
257
+ rangeTip: "{start} – {end} · {duration}",
258
+ progressTip: "{value}% done",
259
+ linkRefusals: {
260
+ nested: "Can’t link a task to its own parent or subtask",
261
+ duplicate: "These tasks are already linked",
262
+ cycle: "This would make a loop"
263
+ },
264
+ baseline: {
265
+ late: "{duration} behind plan",
266
+ early: "{duration} ahead of plan",
267
+ withChange: "{task}, {change}"
268
+ },
269
+ moveRefused: "Can’t move here",
270
+ resizeTable: "Resize the list",
271
+ daysColumn: "{title} (days)",
272
+ hoursColumn: "{title} (hours)",
273
+ idColumn: "ID",
274
+ parentColumn: "Parent ID",
275
+ csvNoTitle: "The file has no “{title}” column, so no tasks could be read",
276
+ keys: "Up and Down pick a task, Left and Right fold, Space selects; Alt with Left or Right moves the task, Alt with Shift and Left or Right changes its end; L adds a dependency; F2 renames, the menu key opens the menu",
277
+ linkMode: "Adding a dependency from “{title}”: pick the next task with Up and Down, Enter to confirm, Escape to cancel",
278
+ linked: "Linked {from} → {to}",
279
+ linkRemoved: "Dependency removed",
280
+ cancelled: "Cancelled",
281
+ linkChanged: "Dependency changed",
282
+ taskRemoved: "{title}, removed",
283
+ undone: "Undone: {change}",
284
+ redone: "Redone: {change}",
285
+ changeCancelled: "That change wasn't made",
286
+ pushed: "{task}; {count} more pushed later",
287
+ broken: "{task}; {count} dependencies not kept",
288
+ scheduled: "Rescheduled, {count} tasks moved",
289
+ newTask: "New task",
290
+ addRow: "Add a task",
291
+ taskAdded: "Added {title}",
292
+ movedUnder: "{task} moved under {parent}",
293
+ movedTop: "{task} moved to the top level",
294
+ invalidValue: "{column} not valid, nothing changed",
295
+ tasksRemoved: "Removed {titles}",
296
+ listSeparator: ", ",
297
+ editCell: "Edit {column}",
298
+ menu: {
299
+ rename: "Rename",
300
+ addAfter: "Add task below",
301
+ addInside: "Add subtask",
302
+ addTask: "Add task",
303
+ indent: "Indent",
304
+ outdent: "Outdent",
305
+ removeTask: "Delete task",
306
+ removeTasks: "Delete {count} tasks",
307
+ removeLink: "Delete dependency"
308
+ },
309
+ criticalTask: "{task}, critical",
310
+ scheduler: {
311
+ name: "Scheduler",
312
+ resource: "Resource",
313
+ unassigned: "Unassigned",
314
+ keys: "Arrow keys move between tasks, Alt with left or right changes the time, Alt with up or down changes the resource, the menu key opens the menu, Delete removes, Mod+Z undoes",
315
+ task: "{title}, {dates}, {duration}",
316
+ item: "{task}, {resource}",
317
+ row: "{title}, {count} tasks",
318
+ overloaded: "{row}, takes more than it can at times",
319
+ overloadHint: "Takes more than it can at times",
320
+ moved: "{title} moved to {resource}"
321
+ }
322
+ };
323
+ var ganttLocales = {
324
+ "zh-CN": zhCN,
325
+ "zh-TW": zhTW,
326
+ en
327
+ };
328
+ /**
329
+ * The Gantt chart's texts, picked by the name of DouUI's current locale.
330
+ * Pass `messages` to override any of them.
331
+ */
332
+ function useGanttMessages(override) {
333
+ const { locale } = useLocale();
334
+ return computed(() => {
335
+ const name = locale.value.name;
336
+ const base = ganttLocales[name] ?? ganttLocales[name.split("-")[0]] ?? (name.startsWith("zh") ? zhCN : en);
337
+ const extra = toValue(override);
338
+ if (!extra) return base;
339
+ const out = { ...base };
340
+ for (const [key, value] of Object.entries(extra)) {
341
+ if (value === void 0) continue;
342
+ const own = out[key];
343
+ out[key] = typeof own === "object" && own && !Array.isArray(own) ? {
344
+ ...own,
345
+ ...value
346
+ } : value;
347
+ }
348
+ return out;
349
+ });
350
+ }
351
+ /** Fills `{name}` placeholders. */
352
+ var format = (text, params) => text.replace(/\{(\w+)\}/g, (match, key) => String(params[key] ?? match));
353
+ export { format, ganttLocales, useGanttMessages };
354
+
355
+ //# sourceMappingURL=locale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.js","names":[],"sources":["../src/locale.ts"],"sourcesContent":["import { useLocale } from 'dou-ui'\nimport { computed, toValue, type MaybeRefOrGetter } from 'vue'\n\nexport interface GanttMessages {\n /** The chart's accessible name when none is given. */\n chart: string\n /** Column headers. */\n columns: { title: string; start: string; end: string; duration: string; progress: string }\n /** Short month names, January first. */\n months: string[]\n /** Short weekday names, Sunday first. */\n weekdays: string[]\n /** Header labels. `{year}`, `{month}` (a name from `months`), `{day}`, `{weekday}`, `{quarter}`, `{hour}`. */\n year: string\n yearMonth: string\n month: string\n monthDay: string\n dayWithWeekday: string\n quarter: string\n halves: [string, string]\n hour: string\n /** Durations; `{count}` is a number. */\n days: string\n hours: string\n today: string\n expand: string\n collapse: string\n /**\n * Read out for a task; `{title}`, `{dates}`, `{duration}` and `{progress}`\n * are filled in. `{dates}` is `range`, or the one date of a one-day task.\n */\n task: string\n milestone: string\n summary: string\n unscheduled: string\n /** A task's dates, read out: `{start}` and `{end}`. */\n range: string\n /** Read out instead of a duration when the task has no working time. */\n offDays: string\n offHours: string\n /** `{date}` and `{time}`. */\n dateTime: string\n /** Shown while dragging: `{start}`, `{end}`, `{duration}`; `{value}` is a percentage. */\n rangeTip: string\n progressTip: string\n /** Why a link being drawn can't be made. */\n linkRefusals: { nested: string; duplicate: string; cycle: string }\n /** Comparing with the `baseline`: `{duration}` is how far the end moved. */\n baseline: { late: string; early: string; withChange: string }\n /** Shown when `can-move` refuses without a reason. */\n moveRefused: string\n /** The handle between the list and the timeline. */\n resizeTable: string\n /** A duration column's header in exported CSV, where values are bare numbers: `{title}`. */\n daysColumn: string\n hoursColumn: string\n /** Headers of the columns `toCSV({ ids: true })` adds: the task's id and its parent's. */\n idColumn: string\n parentColumn: string\n /** The `reason` of a `GanttCSVError` for a file without a title column: `{title}` is its header. */\n csvNoTitle: string\n /** How to use the chart with keys; read out when it gets focus. */\n keys: string\n /** Read out: linking by keys (`{title}` is where it starts), what was done. */\n linkMode: string\n linked: string\n linkRemoved: string\n cancelled: string\n /** `{change}` is the task (or link) as it is afterwards. */\n undone: string\n redone: string\n /** Said when an extension cancels a change without saying why. */\n changeCancelled: string\n /** For `{change}`: a link's lag or type changed, a task was removed. */\n linkChanged: string\n taskRemoved: string\n /** Read out when a change pushed other tasks: `{task}` is the rest, `{count}` how many. */\n pushed: string\n /** Read out when a change leaves links not kept: `{task}` is the rest, `{count}` how many. */\n broken: string\n /** The title of a task added from the menu. */\n newTask: string\n /** The row below the table that adds a task. */\n addRow: string\n /** Read out when a task is added from the row below the table. */\n taskAdded: string\n /** Read out after indenting or outdenting: `{task}` moved under `{parent}`, or to the top level. */\n movedUnder: string\n movedTop: string\n /** Read out when an edited value can't be read, so the cell keeps its value. */\n invalidValue: string\n /** Read out when tasks are removed; `{titles}` joined with `listSeparator`. */\n tasksRemoved: string\n listSeparator: string\n /** The name of a cell's editor; `{column}` is its header. */\n editCell: string\n /** The built-in context menu items. */\n menu: {\n rename: string\n addAfter: string\n addInside: string\n addTask: string\n indent: string\n outdent: string\n removeTask: string\n /** `{count}` tasks. */\n removeTasks: string\n removeLink: string\n }\n /** Read out after `schedule()`: `{count}` tasks moved. */\n scheduled: string\n /** A task on the critical path, read out: `{task}` is the rest. */\n criticalTask: string\n /** The scheduler's texts. */\n scheduler: {\n /** Its accessible name when none is given. */\n name: string\n /** The header over the resources. */\n resource: string\n /** The row for tasks without a resource. */\n unassigned: string\n /** How to use it with keys; read out when it gets focus. */\n keys: string\n /** A task's dates: `{title}`, `{dates}`, `{duration}`. */\n task: string\n /** Read out for a task: `{task}` (its dates, or the milestone text) and `{resource}`. */\n item: string\n /** Read out for a resource: `{title}`, `{count}` tasks. */\n row: string\n /** Added to a resource that takes more than it can at times: `{row}` is the rest. */\n overloaded: string\n /** Beside an overloaded resource's name. */\n overloadHint: string\n /** Read out after a task moved to another resource: `{title}`, `{resource}`. */\n moved: string\n }\n}\n\nconst zhMonths = Array.from({ length: 12 }, (_, i) => `${i + 1}月`)\n\nconst zhCN: GanttMessages = {\n chart: '甘特图',\n columns: { title: '任务', start: '开始', end: '结束', duration: '工期', progress: '进度' },\n months: zhMonths,\n weekdays: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],\n year: '{year}年',\n yearMonth: '{year}年{month}',\n month: '{month}',\n monthDay: '{month}{day}日',\n dayWithWeekday: '{month}{day}日 {weekday}',\n quarter: 'Q{quarter}',\n halves: ['上半年', '下半年'],\n hour: '{hour}:00',\n days: '{count} 天',\n hours: '{count} 小时',\n today: '今天',\n expand: '展开',\n collapse: '收起',\n task: '{title},{dates},{duration},进度 {progress}%',\n milestone: '里程碑:{title},{start}',\n summary: '{title},{dates},进度 {progress}%',\n unscheduled: '{title},未排期',\n range: '{start}至{end}',\n offDays: '休息日',\n offHours: '非工作时间',\n dateTime: '{date} {time}',\n rangeTip: '{start} – {end} · {duration}',\n progressTip: '进度 {value}%',\n linkRefusals: {\n nested: '不能连到自己的上级或子任务',\n duplicate: '这两个任务之间已经有依赖',\n cycle: '会形成循环依赖',\n },\n baseline: {\n late: '比计划晚 {duration}',\n early: '比计划早 {duration}',\n withChange: '{task},{change}',\n },\n moveRefused: '不能移到这里',\n resizeTable: '调整列表宽度',\n daysColumn: '{title}(天)',\n hoursColumn: '{title}(小时)',\n idColumn: 'ID',\n parentColumn: '上级任务 ID',\n csvNoTitle: '文件里没有“{title}”列,无法读出任务',\n keys: '上下键选择任务,左右键收起或展开,空格选中;Alt 加左右键移动任务,Alt 加 Shift 加左右键调整结束时间;L 添加依赖;F2 重命名,菜单键打开菜单',\n linkMode: '从“{title}”添加依赖:上下键选择后续任务,Enter 确认,Esc 取消',\n linked: '已添加依赖:{from} → {to}',\n linkRemoved: '已删除依赖',\n cancelled: '已取消',\n linkChanged: '依赖已修改',\n taskRemoved: '{title},已删除',\n undone: '已撤销:{change}',\n redone: '已重做:{change}',\n changeCancelled: '这次修改没有生效',\n pushed: '{task};另有 {count} 个任务随之推后',\n broken: '{task};{count} 条依赖未满足',\n scheduled: '已重新排期,移动了 {count} 个任务',\n newTask: '新任务',\n addRow: '添加任务',\n taskAdded: '已添加{title}',\n movedUnder: '{task}已移到{parent}下',\n movedTop: '{task}已移到最外层',\n invalidValue: '{column}无效,未修改',\n tasksRemoved: '已删除:{titles}',\n listSeparator: '、',\n editCell: '编辑{column}',\n menu: {\n rename: '重命名',\n addAfter: '在下方添加任务',\n addInside: '添加子任务',\n addTask: '添加任务',\n indent: '缩进',\n outdent: '取消缩进',\n removeTask: '删除任务',\n removeTasks: '删除 {count} 个任务',\n removeLink: '删除依赖',\n },\n criticalTask: '{task},关键任务',\n scheduler: {\n name: '资源排期',\n resource: '资源',\n unassigned: '未分配',\n keys: '方向键在任务之间移动,Alt 加左右方向键改时间,Alt 加上下方向键换资源,菜单键打开菜单,Delete 删除,Mod+Z 撤销',\n task: '{title},{dates},{duration}',\n item: '{task},{resource}',\n row: '{title},{count} 项',\n overloaded: '{row},有时段超出可承担的数量',\n overloadHint: '有时段超出可承担的数量',\n moved: '{title}已移到{resource}',\n },\n}\n\nconst zhTW: GanttMessages = {\n ...zhCN,\n chart: '甘特圖',\n columns: { title: '任務', start: '開始', end: '結束', duration: '工期', progress: '進度' },\n weekdays: ['週日', '週一', '週二', '週三', '週四', '週五', '週六'],\n halves: ['上半年', '下半年'],\n hours: '{count} 小時',\n expand: '展開',\n collapse: '收合',\n task: '{title},{dates},{duration},進度 {progress}%',\n milestone: '里程碑:{title},{start}',\n summary: '{title},{dates},進度 {progress}%',\n unscheduled: '{title},未排程',\n range: '{start}至{end}',\n offDays: '休息日',\n offHours: '非工作時間',\n progressTip: '進度 {value}%',\n linkRefusals: {\n nested: '不能連到自己的上層或子任務',\n duplicate: '這兩個任務之間已經有相依關係',\n cycle: '會形成循環相依',\n },\n baseline: {\n late: '比計畫晚 {duration}',\n early: '比計畫早 {duration}',\n withChange: '{task},{change}',\n },\n moveRefused: '不能移到這裡',\n resizeTable: '調整列表寬度',\n daysColumn: '{title}(天)',\n hoursColumn: '{title}(小時)',\n idColumn: 'ID',\n parentColumn: '上層任務 ID',\n csvNoTitle: '檔案裡沒有「{title}」欄,無法讀出任務',\n keys: '上下鍵選擇任務,左右鍵收合或展開,空白鍵選取;Alt 加左右鍵移動任務,Alt 加 Shift 加左右鍵調整結束時間;L 新增相依;F2 重新命名,選單鍵開啟選單',\n linkMode: '從「{title}」新增相依:上下鍵選擇後續任務,Enter 確認,Esc 取消',\n linked: '已新增相依:{from} → {to}',\n linkRemoved: '已刪除相依',\n cancelled: '已取消',\n linkChanged: '相依已修改',\n taskRemoved: '{title},已刪除',\n undone: '已復原:{change}',\n redone: '已重做:{change}',\n changeCancelled: '這次修改沒有生效',\n pushed: '{task};另有 {count} 個任務隨之延後',\n broken: '{task};{count} 條相依未滿足',\n scheduled: '已重新排程,移動了 {count} 個任務',\n newTask: '新任務',\n addRow: '新增任務',\n taskAdded: '已新增{title}',\n movedUnder: '{task}已移到{parent}下',\n movedTop: '{task}已移到最外層',\n invalidValue: '{column}無效,未修改',\n tasksRemoved: '已刪除:{titles}',\n editCell: '編輯{column}',\n menu: {\n rename: '重新命名',\n addAfter: '在下方新增任務',\n addInside: '新增子任務',\n addTask: '新增任務',\n indent: '縮排',\n outdent: '取消縮排',\n removeTask: '刪除任務',\n removeTasks: '刪除 {count} 個任務',\n removeLink: '刪除相依',\n },\n criticalTask: '{task},要徑任務',\n scheduler: {\n name: '資源排程',\n resource: '資源',\n unassigned: '未分配',\n keys: '方向鍵在任務之間移動,Alt 加左右方向鍵改時間,Alt 加上下方向鍵換資源,選單鍵開啟選單,Delete 刪除,Mod+Z 復原',\n task: '{title},{dates},{duration}',\n item: '{task},{resource}',\n row: '{title},{count} 項',\n overloaded: '{row},有時段超出可承擔的數量',\n overloadHint: '有時段超出可承擔的數量',\n moved: '{title}已移到{resource}',\n },\n}\n\nconst en: GanttMessages = {\n chart: 'Gantt chart',\n columns: {\n title: 'Task',\n start: 'Start',\n end: 'End',\n duration: 'Duration',\n progress: 'Progress',\n },\n months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],\n weekdays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n year: '{year}',\n yearMonth: '{month} {year}',\n month: '{month}',\n monthDay: '{month} {day}',\n dayWithWeekday: '{weekday}, {month} {day}',\n quarter: 'Q{quarter}',\n halves: ['H1', 'H2'],\n hour: '{hour}:00',\n days: '{count} d',\n hours: '{count} h',\n today: 'Today',\n expand: 'Expand',\n collapse: 'Collapse',\n task: '{title}, {dates}, {duration}, {progress}% done',\n milestone: 'Milestone: {title}, {start}',\n summary: '{title}, {dates}, {progress}% done',\n unscheduled: '{title}, not scheduled',\n range: '{start} to {end}',\n offDays: 'days off',\n offHours: 'outside working hours',\n dateTime: '{date} {time}',\n rangeTip: '{start} – {end} · {duration}',\n progressTip: '{value}% done',\n linkRefusals: {\n nested: 'Can’t link a task to its own parent or subtask',\n duplicate: 'These tasks are already linked',\n cycle: 'This would make a loop',\n },\n baseline: {\n late: '{duration} behind plan',\n early: '{duration} ahead of plan',\n withChange: '{task}, {change}',\n },\n moveRefused: 'Can’t move here',\n resizeTable: 'Resize the list',\n daysColumn: '{title} (days)',\n hoursColumn: '{title} (hours)',\n idColumn: 'ID',\n parentColumn: 'Parent ID',\n csvNoTitle: 'The file has no “{title}” column, so no tasks could be read',\n keys: 'Up and Down pick a task, Left and Right fold, Space selects; Alt with Left or Right moves the task, Alt with Shift and Left or Right changes its end; L adds a dependency; F2 renames, the menu key opens the menu',\n linkMode:\n 'Adding a dependency from “{title}”: pick the next task with Up and Down, Enter to confirm, Escape to cancel',\n linked: 'Linked {from} → {to}',\n linkRemoved: 'Dependency removed',\n cancelled: 'Cancelled',\n linkChanged: 'Dependency changed',\n taskRemoved: '{title}, removed',\n undone: 'Undone: {change}',\n redone: 'Redone: {change}',\n changeCancelled: \"That change wasn't made\",\n pushed: '{task}; {count} more pushed later',\n broken: '{task}; {count} dependencies not kept',\n scheduled: 'Rescheduled, {count} tasks moved',\n newTask: 'New task',\n addRow: 'Add a task',\n taskAdded: 'Added {title}',\n movedUnder: '{task} moved under {parent}',\n movedTop: '{task} moved to the top level',\n invalidValue: '{column} not valid, nothing changed',\n tasksRemoved: 'Removed {titles}',\n listSeparator: ', ',\n editCell: 'Edit {column}',\n menu: {\n rename: 'Rename',\n addAfter: 'Add task below',\n addInside: 'Add subtask',\n addTask: 'Add task',\n indent: 'Indent',\n outdent: 'Outdent',\n removeTask: 'Delete task',\n removeTasks: 'Delete {count} tasks',\n removeLink: 'Delete dependency',\n },\n criticalTask: '{task}, critical',\n scheduler: {\n name: 'Scheduler',\n resource: 'Resource',\n unassigned: 'Unassigned',\n keys: 'Arrow keys move between tasks, Alt with left or right changes the time, Alt with up or down changes the resource, the menu key opens the menu, Delete removes, Mod+Z undoes',\n task: '{title}, {dates}, {duration}',\n item: '{task}, {resource}',\n row: '{title}, {count} tasks',\n overloaded: '{row}, takes more than it can at times',\n overloadHint: 'Takes more than it can at times',\n moved: '{title} moved to {resource}',\n },\n}\n\nexport const ganttLocales: Record<string, GanttMessages> = {\n 'zh-CN': zhCN,\n 'zh-TW': zhTW,\n en,\n}\n\n/** Texts to change; nested groups are merged, so only the ones given are replaced. */\nexport type GanttMessagesOverride = {\n [K in keyof GanttMessages]?: GanttMessages[K] extends string\n ? string\n : GanttMessages[K] extends unknown[]\n ? GanttMessages[K]\n : Partial<GanttMessages[K]>\n}\n\n/**\n * The Gantt chart's texts, picked by the name of DouUI's current locale.\n * Pass `messages` to override any of them.\n */\nexport function useGanttMessages(override?: MaybeRefOrGetter<GanttMessagesOverride | undefined>) {\n const { locale } = useLocale()\n return computed<GanttMessages>(() => {\n const name = locale.value.name\n const base =\n ganttLocales[name] ?? ganttLocales[name.split('-')[0]!] ?? (name.startsWith('zh') ? zhCN : en)\n const extra = toValue(override)\n if (!extra) return base\n const out = { ...base } as Record<string, unknown>\n for (const [key, value] of Object.entries(extra)) {\n if (value === undefined) continue\n const own = out[key]\n out[key] =\n typeof own === 'object' && own && !Array.isArray(own)\n ? { ...own, ...(value as object) }\n : value\n }\n return out as unknown as GanttMessages\n })\n}\n\n/** Fills `{name}` placeholders. */\nexport const format = (text: string, params: Record<string, string | number>) =>\n text.replace(/\\{(\\w+)\\}/g, (match, key: string) => String(params[key] ?? match))\n"],"mappings":";;;AA4IA,IAAM,OAAsB;CAC1B,OAAO;CACP,SAAS;EAAE,OAAO;EAAM,OAAO;EAAM,KAAK;EAAM,UAAU;EAAM,UAAU;CAAK;CAC/E,QALe,MAAM,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,EAAE,EAKrD;CACR,UAAU;EAAC;EAAM;EAAM;EAAM;EAAM;EAAM;EAAM;CAAI;CACnD,MAAM;CACN,WAAW;CACX,OAAO;CACP,UAAU;CACV,gBAAgB;CAChB,SAAS;CACT,QAAQ,CAAC,OAAO,KAAK;CACrB,MAAM;CACN,MAAM;CACN,OAAO;CACP,OAAO;CACP,QAAQ;CACR,UAAU;CACV,MAAM;CACN,WAAW;CACX,SAAS;CACT,aAAa;CACb,OAAO;CACP,SAAS;CACT,UAAU;CACV,UAAU;CACV,UAAU;CACV,aAAa;CACb,cAAc;EACZ,QAAQ;EACR,WAAW;EACX,OAAO;CACT;CACA,UAAU;EACR,MAAM;EACN,OAAO;EACP,YAAY;CACd;CACA,aAAa;CACb,aAAa;CACb,YAAY;CACZ,aAAa;CACb,UAAU;CACV,cAAc;CACd,YAAY;CACZ,MAAM;CACN,UAAU;CACV,QAAQ;CACR,aAAa;CACb,WAAW;CACX,aAAa;CACb,aAAa;CACb,QAAQ;CACR,QAAQ;CACR,iBAAiB;CACjB,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,SAAS;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M;EACN,UAAU;EACV,YAAY;EACZ,MAAM;EACN,MAAM;EACN,MAAM;EACN,KAAK;EACL,YAAY;EACZ,cAAc;EACd,OAAO;CACT;AACF;AAEA,IAAa,eAA8C;CACzD,SAAS;CACT,SAAS;CACT;AACF;;;;;AAeA,SAAgB,iBAAiB,UAAgE;CAC/F,MAAM,EAAE,WAAW,UAAU;CAC7B,OAAO,eAA8B;EACnC,MAAM,OAAO,OAAO,MAAM;EAC1B,MAAM,OACJ,aAAa,SAAS,aAAa,KAAK,MAAM,GAAG,CAAC,CAAC,QAAS,KAAK,WAAW,IAAI,IAAI,OAAO;EAC7F,MAAM,QAAQ,QAAQ,QAAQ;EAC9B,IAAI,CAAC,OAAO,OAAO;EACnB,MAAM,MAAM,EAAE,GAAG,KAAK;EACtB,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAAG;GAChD,IAAI,UAAU,KAAA,GAAW;GACzB,MAAM,MAAM,IAAI;GAChB,IAAI,OACF,OAAO,QAAQ,YAAY,OAAO,CAAC,MAAM,QAAQ,GAAG,IAChD;IAAE,GAAG;IAAK,GAAI;GAAiB,IAC/B;EACR;EACA,OAAO;CACT,CAAC;AACH;;AAGA,IAAa,UAAU,MAAc,WACnC,KAAK,QAAQ,eAAe,OAAO,QAAgB,OAAO,OAAO,QAAQ,KAAK,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { findConflict, groupByResource, loadSegments, packLanes } from "./layout.js";
2
+ import scheduler_default from "./scheduler.js";
3
+ import { withInstall } from "dou-ui";
4
+ // src/scheduler/index.ts
5
+ var DouScheduler = withInstall(scheduler_default);
6
+ export { DouScheduler, DouScheduler as default, findConflict, groupByResource, loadSegments, packLanes };
7
+
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["Scheduler"],"sources":["../../src/scheduler/index.ts"],"sourcesContent":["import { withInstall } from 'dou-ui'\nimport Scheduler from './scheduler.vue'\n\nexport const DouScheduler = withInstall(Scheduler)\nexport default DouScheduler\n\nexport { findConflict, groupByResource, loadSegments, packLanes } from './layout'\nexport type {\n SchedulerItem,\n SchedulerLoadSegment,\n SchedulerPlace,\n SchedulerResource,\n} from './layout'\nexport type {\n SchedulerEmits,\n SchedulerExpose,\n SchedulerMenuTarget,\n SchedulerMove,\n SchedulerProps,\n SchedulerRange,\n SchedulerSlots,\n} from './types'\n\ndeclare module 'vue' {\n export interface GlobalComponents {\n DouScheduler: typeof DouScheduler\n }\n}\n"],"mappings":";;;;AAGA,IAAa,eAAe,YAAYA,iBAAS"}
@@ -0,0 +1,97 @@
1
+ import { spanOf } from "../core/model.js";
2
+ // src/scheduler/layout.ts
3
+ /** A milestone takes no time; for packing, it holds a moment this long, in minutes. */
4
+ var POINT = 1;
5
+ var endOf = (span) => Math.max(span.end, span.start + POINT);
6
+ /**
7
+ * Puts overlapping tasks in separate lanes: each task takes the first lane
8
+ * that is free when it starts. Returns the lane count.
9
+ */
10
+ function packLanes(items) {
11
+ const sorted = [...items];
12
+ sorted.sort((a, b) => a.span.start - b.span.start || endOf(b.span) - endOf(a.span));
13
+ /** When each lane is free again. */
14
+ const free = [];
15
+ for (const item of sorted) {
16
+ let lane = free.findIndex((at) => at <= item.span.start);
17
+ if (lane === -1) lane = free.length;
18
+ free[lane] = endOf(item.span);
19
+ item.lane = lane;
20
+ }
21
+ return free.length;
22
+ }
23
+ /** How many tasks are going on over time; stretches with none are left out. */
24
+ function loadSegments(spans) {
25
+ const changes = /* @__PURE__ */ new Map();
26
+ for (const span of spans) {
27
+ if (span.end <= span.start) continue;
28
+ changes.set(span.start, (changes.get(span.start) ?? 0) + 1);
29
+ changes.set(span.end, (changes.get(span.end) ?? 0) - 1);
30
+ }
31
+ const times = [...changes.keys()].sort((a, b) => a - b);
32
+ const out = [];
33
+ let count = 0;
34
+ for (let i = 0; i < times.length - 1; i++) {
35
+ count += changes.get(times[i]);
36
+ if (count <= 0) continue;
37
+ const last = out.at(-1);
38
+ if (last && last.count === count && last.end === times[i]) last.end = times[i + 1];
39
+ else out.push({
40
+ start: times[i],
41
+ end: times[i + 1],
42
+ count
43
+ });
44
+ }
45
+ return out;
46
+ }
47
+ /**
48
+ * The tasks of each resource, packed into lanes. Tasks without a resource,
49
+ * or with one that isn't listed, go under `''`; tasks without dates are
50
+ * left out.
51
+ */
52
+ function groupByResource(tasks, resources) {
53
+ const known = new Set(resources.map((resource) => resource.id));
54
+ const out = /* @__PURE__ */ new Map();
55
+ for (const task of tasks) {
56
+ const span = spanOf(task);
57
+ if (!span) continue;
58
+ const key = task.resource && known.has(task.resource) ? task.resource : "";
59
+ let entry = out.get(key);
60
+ if (!entry) out.set(key, entry = {
61
+ items: [],
62
+ lanes: 0
63
+ });
64
+ entry.items.push({
65
+ task,
66
+ span,
67
+ lane: 0
68
+ });
69
+ }
70
+ for (const entry of out.values()) entry.lanes = packLanes(entry.items);
71
+ return out;
72
+ }
73
+ /**
74
+ * The first task on the same resource whose time overlaps `place`, or
75
+ * `undefined`. Tasks only touching end to start don't overlap; without a
76
+ * resource nothing conflicts.
77
+ */
78
+ function findConflict(tasks, place) {
79
+ if (place.resource == null) return void 0;
80
+ const own = spanOf({
81
+ id: "",
82
+ title: "",
83
+ type: place.task?.type,
84
+ start: place.start,
85
+ end: place.end
86
+ });
87
+ if (!own) return void 0;
88
+ const ownEnd = endOf(own);
89
+ return tasks.find((task) => {
90
+ if (task.resource !== place.resource || task.id === place.task?.id) return false;
91
+ const span = spanOf(task);
92
+ return !!span && span.start < ownEnd && own.start < endOf(span);
93
+ });
94
+ }
95
+ export { findConflict, groupByResource, loadSegments, packLanes };
96
+
97
+ //# sourceMappingURL=layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.js","names":[],"sources":["../../src/scheduler/layout.ts"],"sourcesContent":["import { spanOf, type GanttData, type GanttTask, type TaskSpan } from '../core/model'\n\n/** A row of the scheduler: a person, a room, a machine. */\nexport interface SchedulerResource<Data extends GanttData = GanttData> {\n id: string\n title: string\n /** Resources with the same group are listed together under its name. */\n group?: string\n /** How many tasks it can take at once; more than that shows as overloaded. Defaults to `1`. */\n capacity?: number\n /** Your own fields. */\n data?: Data\n}\n\n/** A task placed in its row. */\nexport interface SchedulerItem {\n task: GanttTask\n span: TaskSpan\n /** Which of the row's lanes it is drawn in, from `0`. */\n lane: number\n}\n\n/** A stretch of time with the same number of tasks going on. */\nexport interface SchedulerLoadSegment {\n start: number\n end: number\n count: number\n}\n\n/** A milestone takes no time; for packing, it holds a moment this long, in minutes. */\nconst POINT = 1\n\nconst endOf = (span: TaskSpan) => Math.max(span.end, span.start + POINT)\n\n/**\n * Puts overlapping tasks in separate lanes: each task takes the first lane\n * that is free when it starts. Returns the lane count.\n */\nexport function packLanes(items: { span: TaskSpan; lane: number }[]) {\n const sorted = [...items]\n // oxlint-disable-next-line unicorn/no-array-sort -- sorts a fresh array\n sorted.sort((a, b) => a.span.start - b.span.start || endOf(b.span) - endOf(a.span))\n /** When each lane is free again. */\n const free: number[] = []\n for (const item of sorted) {\n let lane = free.findIndex((at) => at <= item.span.start)\n if (lane === -1) lane = free.length\n free[lane] = endOf(item.span)\n item.lane = lane\n }\n return free.length\n}\n\n/** How many tasks are going on over time; stretches with none are left out. */\nexport function loadSegments(spans: Iterable<TaskSpan>): SchedulerLoadSegment[] {\n const changes = new Map<number, number>()\n for (const span of spans) {\n // a milestone is not work\n if (span.end <= span.start) continue\n changes.set(span.start, (changes.get(span.start) ?? 0) + 1)\n changes.set(span.end, (changes.get(span.end) ?? 0) - 1)\n }\n // oxlint-disable-next-line unicorn/no-array-sort -- sorts a fresh array\n const times = [...changes.keys()].sort((a, b) => a - b)\n const out: SchedulerLoadSegment[] = []\n let count = 0\n for (let i = 0; i < times.length - 1; i++) {\n count += changes.get(times[i]!)!\n if (count <= 0) continue\n const last = out.at(-1)\n if (last && last.count === count && last.end === times[i]) last.end = times[i + 1]!\n else out.push({ start: times[i]!, end: times[i + 1]!, count })\n }\n return out\n}\n\n/**\n * The tasks of each resource, packed into lanes. Tasks without a resource,\n * or with one that isn't listed, go under `''`; tasks without dates are\n * left out.\n */\nexport function groupByResource(\n tasks: readonly GanttTask[],\n resources: readonly SchedulerResource[],\n) {\n const known = new Set(resources.map((resource) => resource.id))\n const out = new Map<string, { items: SchedulerItem[]; lanes: number }>()\n for (const task of tasks) {\n const span = spanOf(task)\n if (!span) continue\n const key = task.resource && known.has(task.resource) ? task.resource : ''\n let entry = out.get(key)\n if (!entry) out.set(key, (entry = { items: [], lanes: 0 }))\n entry.items.push({ task, span, lane: 0 })\n }\n for (const entry of out.values()) entry.lanes = packLanes(entry.items)\n return out\n}\n\n/** Where a task would go: as `can-move` gets it, or a new booking. */\nexport interface SchedulerPlace {\n /** The task being moved; it never conflicts with itself. */\n task?: GanttTask\n resource?: string\n start: string\n end?: string\n}\n\n/**\n * The first task on the same resource whose time overlaps `place`, or\n * `undefined`. Tasks only touching end to start don't overlap; without a\n * resource nothing conflicts.\n */\nexport function findConflict(\n tasks: readonly GanttTask[],\n place: SchedulerPlace,\n): GanttTask | undefined {\n if (place.resource == null) return undefined\n const own = spanOf({\n id: '',\n title: '',\n type: place.task?.type,\n start: place.start,\n end: place.end,\n })\n if (!own) return undefined\n const ownEnd = endOf(own)\n return tasks.find((task) => {\n if (task.resource !== place.resource || task.id === place.task?.id) return false\n const span = spanOf(task)\n return !!span && span.start < ownEnd && own.start < endOf(span)\n })\n}\n"],"mappings":";;;AA8BA,IAAM,QAAQ;AAEd,IAAM,SAAS,SAAmB,KAAK,IAAI,KAAK,KAAK,KAAK,QAAQ,KAAK;;;;;AAMvE,SAAgB,UAAU,OAA2C;CACnE,MAAM,SAAS,CAAC,GAAG,KAAK;CAExB,OAAO,MAAM,GAAG,MAAM,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,MAAM,EAAE,IAAI,IAAI,MAAM,EAAE,IAAI,CAAC;;CAElF,MAAM,OAAiB,CAAC;CACxB,KAAK,MAAM,QAAQ,QAAQ;EACz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AK,WAAW;EACxE,IAAI,QAAQ,IAAI,IAAI,GAAG;EACvB,IAAI,CAAC,OAAO,IAAI,IAAI,KAAM,QAAQ;GAAE,OAAO,CAAC;GAAG,OAAO;EAAE,CAAE;EAC1D,MAAM,MAAM,KAAK;GAAE;GAAM;GAAM,MAAM;EAAE,CAAC;CAC1C;CACA,KAAK,MAAM,SAAS,IAAI,OAAO,GAAG,MAAM,QAAQ,UAAU,MAAM,KAAK;CACrE,OAAO;AACT;;;;;;AAgBA,SAAgB,aACd,OACA,OACuB;CACvB,IAAI,MAAM,YAAY,MAAM,OAAO,KAAA;CACnC,MAAM,MAAM,OAAO;EACjB,IAAI;EACJ,OAAO;EACP,MAAM,MAAM,MAAM;EAClB,OAAO,MAAM;EACb,KAAK,MAAM;CACb,CAAC;CACD,IAAI,CAAC,KAAK,OAAO,KAAA;CACjB,MAAM,SAAS,MAAM,GAAG;CACxB,OAAO,MAAM,MAAM,SAAS;EAC1B,IAAI,KAAK,aAAa,MAAM,YAAY,KAAK,OAAO,MAAM,MAAM,IAAI,OAAO;EAC3E,MAAM,OAAO,OAAO,IAAI;EACxB,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ,UAAU,IAAI,QAAQ,MAAM,IAAI;CAChE,CAAC;AACH"}
@@ -0,0 +1,6 @@
1
+ import scheduler_vue_vue_type_script_setup_true_lang_default from "./scheduler.vue_vue_type_script_setup_true_lang.js";
2
+ // src/scheduler/scheduler.vue
3
+ var scheduler_default = scheduler_vue_vue_type_script_setup_true_lang_default;
4
+ export { scheduler_default as default };
5
+
6
+ //# sourceMappingURL=scheduler.js.map