@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.
- package/LICENSE +21 -0
- package/README.md +10 -2
- package/dist/collaboration/index.js +323 -0
- package/dist/collaboration/index.js.map +1 -0
- package/dist/collaboration/peers.js +78 -0
- package/dist/collaboration/peers.js.map +1 -0
- package/dist/components/cell-editor.js +6 -0
- package/dist/components/cell-editor.js.map +1 -0
- package/dist/components/cell-editor.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/components/cell-editor.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/gantt-menu.js +6 -0
- package/dist/components/gantt-menu.js.map +1 -0
- package/dist/components/gantt-menu.vue_vue_type_script_setup_true_lang.js +40 -0
- package/dist/components/gantt-menu.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/time-grid.js +6 -0
- package/dist/components/time-grid.js.map +1 -0
- package/dist/components/time-grid.vue_vue_type_script_setup_true_lang.js +32 -0
- package/dist/components/time-grid.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/time-header.js +6 -0
- package/dist/components/time-header.js.map +1 -0
- package/dist/components/time-header.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/components/time-header.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/context.js +12 -0
- package/dist/context.js.map +1 -0
- package/dist/core/baseline.js +48 -0
- package/dist/core/baseline.js.map +1 -0
- package/dist/core/calendar.js +191 -0
- package/dist/core/calendar.js.map +1 -0
- package/dist/core/csv.js +424 -0
- package/dist/core/csv.js.map +1 -0
- package/dist/core/document.js +231 -0
- package/dist/core/document.js.map +1 -0
- package/dist/core/extension.js +42 -0
- package/dist/core/extension.js.map +1 -0
- package/dist/core/geometry.js +112 -0
- package/dist/core/geometry.js.map +1 -0
- package/dist/core/history.js +70 -0
- package/dist/core/history.js.map +1 -0
- package/dist/core/links.js +72 -0
- package/dist/core/links.js.map +1 -0
- package/dist/core/model.js +52 -0
- package/dist/core/model.js.map +1 -0
- package/dist/core/order.js +34 -0
- package/dist/core/order.js.map +1 -0
- package/dist/core/scale.js +118 -0
- package/dist/core/scale.js.map +1 -0
- package/dist/core/schedule.js +235 -0
- package/dist/core/schedule.js.map +1 -0
- package/dist/core/time.js +81 -0
- package/dist/core/time.js.map +1 -0
- package/dist/core/transaction.js +371 -0
- package/dist/core/transaction.js.map +1 -0
- package/dist/core/tree.js +114 -0
- package/dist/core/tree.js.map +1 -0
- package/dist/export/draw.js +214 -0
- package/dist/export/draw.js.map +1 -0
- package/dist/export/theme.js +131 -0
- package/dist/export/theme.js.map +1 -0
- package/dist/gantt.js +6 -0
- package/dist/gantt.js.map +1 -0
- package/dist/gantt.vue_vue_type_script_setup_true_lang.js +2774 -0
- package/dist/gantt.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/labels.js +87 -0
- package/dist/labels.js.map +1 -0
- package/dist/locale.js +355 -0
- package/dist/locale.js.map +1 -0
- package/dist/scheduler/index.js +8 -0
- package/dist/scheduler/index.js.map +1 -0
- package/dist/scheduler/layout.js +97 -0
- package/dist/scheduler/layout.js.map +1 -0
- package/dist/scheduler/scheduler.js +6 -0
- package/dist/scheduler/scheduler.js.map +1 -0
- package/dist/scheduler/scheduler.vue_vue_type_script_setup_true_lang.js +1359 -0
- package/dist/scheduler/scheduler.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/scheduler/style.d.ts +1 -0
- package/dist/scheduler/style.js +2 -0
- package/dist/style.css +1 -0
- package/dist/style.d.ts +1 -0
- package/dist/style.js +4 -0
- package/dist/time-axis.js +337 -0
- package/dist/time-axis.js.map +1 -0
- package/dist/types/collaboration/index.d.ts +39 -0
- package/dist/types/collaboration/peers.d.ts +22 -0
- package/dist/types/components/cell-editor.vue.d.ts +21 -0
- package/dist/types/components/gantt-menu.vue.d.ts +18 -0
- package/dist/types/components/time-grid.vue.d.ts +12 -0
- package/dist/types/components/time-header.vue.d.ts +23 -0
- package/dist/types/context.d.ts +64 -0
- package/dist/types/core/baseline.d.ts +14 -0
- package/dist/types/core/calendar.d.ts +75 -0
- package/dist/types/core/csv.d.ts +77 -0
- package/dist/types/core/document.d.ts +51 -0
- package/dist/types/core/extension.d.ts +88 -0
- package/dist/types/core/geometry.d.ts +33 -0
- package/dist/types/core/history.d.ts +19 -0
- package/dist/types/core/links.d.ts +20 -0
- package/dist/types/core/menu.d.ts +27 -0
- package/dist/types/core/model.d.ts +72 -0
- package/dist/types/core/order.d.ts +9 -0
- package/dist/types/core/scale.d.ts +33 -0
- package/dist/types/core/schedule.d.ts +44 -0
- package/dist/types/core/time.d.ts +39 -0
- package/dist/types/core/transaction.d.ts +134 -0
- package/dist/types/core/tree.d.ts +30 -0
- package/dist/types/export/draw.d.ts +76 -0
- package/dist/types/export/theme.d.ts +49 -0
- package/dist/types/gantt.vue.d.ts +54 -0
- package/dist/types/index.d.ts +148 -0
- package/dist/types/labels.d.ts +24 -0
- package/dist/types/locale.d.ts +161 -0
- package/dist/types/scheduler/index.d.ts +102 -0
- package/dist/types/scheduler/layout.d.ts +58 -0
- package/dist/types/scheduler/scheduler.vue.d.ts +46 -0
- package/dist/types/scheduler/types.d.ts +109 -0
- package/dist/types/time-axis.d.ts +80 -0
- package/dist/types/types.d.ts +305 -0
- package/package.json +79 -4
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type ComputedRef, type Ref, type ShallowRef } from 'vue';
|
|
2
|
+
import { type WorkCalendar } from './core/calendar';
|
|
3
|
+
import { type GanttScale } from './core/scale';
|
|
4
|
+
import type { GanttMessages } from './locale';
|
|
5
|
+
export interface HeaderCell {
|
|
6
|
+
key: number;
|
|
7
|
+
end: number;
|
|
8
|
+
left: number;
|
|
9
|
+
width: number;
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
export interface TimeAxisOptions {
|
|
13
|
+
/** The scrolling timeline. */
|
|
14
|
+
chart: Readonly<ShallowRef<HTMLElement | null>>;
|
|
15
|
+
/** The table body, kept at the same vertical scroll. */
|
|
16
|
+
tableBody: Readonly<ShallowRef<HTMLElement | null>>;
|
|
17
|
+
viewWidth: Ref<number>;
|
|
18
|
+
scale: Ref<GanttScale | undefined>;
|
|
19
|
+
range: () => [string, string] | undefined;
|
|
20
|
+
today: () => boolean;
|
|
21
|
+
weekStart: ComputedRef<0 | 1>;
|
|
22
|
+
calendar: ComputedRef<WorkCalendar>;
|
|
23
|
+
messages: ComputedRef<GanttMessages>;
|
|
24
|
+
/** The time the content covers, or `null` when nothing is scheduled. */
|
|
25
|
+
content: ComputedRef<{
|
|
26
|
+
start: number;
|
|
27
|
+
end: number;
|
|
28
|
+
} | null>;
|
|
29
|
+
/** The width the timeline will have once laid out, for fitting. */
|
|
30
|
+
fitWidth: () => number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The time axis the gantt chart and the scheduler share: zoom, the extent
|
|
34
|
+
* that grows as you scroll, the header cells, days off and the today line.
|
|
35
|
+
*/
|
|
36
|
+
export declare function useTimeAxis(o: TimeAxisOptions): {
|
|
37
|
+
dayWidth: Ref<number, number>;
|
|
38
|
+
level: ComputedRef<import("./core/scale").ScaleLevel>;
|
|
39
|
+
ppm: ComputedRef<number>;
|
|
40
|
+
now: ComputedRef<number>;
|
|
41
|
+
extent: ComputedRef<{
|
|
42
|
+
start: number;
|
|
43
|
+
end: number;
|
|
44
|
+
}>;
|
|
45
|
+
origin: ComputedRef<number>;
|
|
46
|
+
totalWidth: ComputedRef<number>;
|
|
47
|
+
xOf: (at: number) => number;
|
|
48
|
+
contentX: (clientX: number) => number;
|
|
49
|
+
scrollTop: Ref<number, number>;
|
|
50
|
+
scrollLeft: Ref<number, number>;
|
|
51
|
+
scrollbar: Ref<number, number>;
|
|
52
|
+
measureScrollbar: () => void;
|
|
53
|
+
onChartScroll: () => void;
|
|
54
|
+
onTableScroll: () => void;
|
|
55
|
+
scrollToTime: (at: number, offset?: number) => void;
|
|
56
|
+
scrollToDate: (date: string) => void;
|
|
57
|
+
scrollToToday: () => void;
|
|
58
|
+
fit: () => void;
|
|
59
|
+
fitWhenSized: () => void;
|
|
60
|
+
zoomTo: (width: number, anchor?: number) => void;
|
|
61
|
+
zoomIn: () => void;
|
|
62
|
+
zoomOut: () => void;
|
|
63
|
+
onWheel: (event: WheelEvent) => void;
|
|
64
|
+
pinchStart: (event: TouchEvent) => boolean;
|
|
65
|
+
pinchMove: (event: TouchEvent) => boolean;
|
|
66
|
+
pinchEnd: (event: TouchEvent) => void;
|
|
67
|
+
timeWindow: ComputedRef<{
|
|
68
|
+
start: number;
|
|
69
|
+
end: number;
|
|
70
|
+
}>;
|
|
71
|
+
topCells: ComputedRef<HeaderCell[]>;
|
|
72
|
+
bottomCells: ComputedRef<HeaderCell[]>;
|
|
73
|
+
shaded: ComputedRef<{
|
|
74
|
+
key: number;
|
|
75
|
+
left: number;
|
|
76
|
+
width: number;
|
|
77
|
+
}[]>;
|
|
78
|
+
todayX: ComputedRef<number | null>;
|
|
79
|
+
};
|
|
80
|
+
export type TimeAxis = ReturnType<typeof useTimeAxis>;
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import type { ContextMenuItem } from 'dou-ui';
|
|
2
|
+
import type { GanttBaselineItem } from './core/baseline';
|
|
3
|
+
import type { GanttCalendar } from './core/calendar';
|
|
4
|
+
import type { GanttCSVImportOptions, GanttCSVResult } from './core/csv';
|
|
5
|
+
import type { GanttExtension } from './core/extension';
|
|
6
|
+
import type { GanttLink, GanttTask } from './core/model';
|
|
7
|
+
import type { Tone } from 'dou-ui';
|
|
8
|
+
import type { GanttSchedule } from './core/schedule';
|
|
9
|
+
import type { GanttScale } from './core/scale';
|
|
10
|
+
import type { GanttDocument, GanttTransaction, GanttTransactionMeta } from './core/transaction';
|
|
11
|
+
import type { GanttRow } from './core/tree';
|
|
12
|
+
import type { GanttMenuTarget } from './core/menu';
|
|
13
|
+
import type { GanttMessagesOverride } from './locale';
|
|
14
|
+
/** A column of the task table; written like a column of `DouTable`. */
|
|
15
|
+
export interface GanttColumn {
|
|
16
|
+
/**
|
|
17
|
+
* Identifies the column. `title`, `start`, `end`, `duration` and
|
|
18
|
+
* `progress` are built in; any other key reads the task's `data`, unless
|
|
19
|
+
* `value` is given.
|
|
20
|
+
*/
|
|
21
|
+
key: string;
|
|
22
|
+
/** Header text; built-in columns have their own. */
|
|
23
|
+
title?: string;
|
|
24
|
+
/** Reads the cell value from a task. */
|
|
25
|
+
value?: (task: GanttTask) => unknown;
|
|
26
|
+
/** A number is in px. A column without one takes the room left over. */
|
|
27
|
+
width?: number | string;
|
|
28
|
+
minWidth?: number | string;
|
|
29
|
+
align?: 'start' | 'center' | 'end';
|
|
30
|
+
/**
|
|
31
|
+
* Double-click (or F2 for the title) to edit. Built-in columns are
|
|
32
|
+
* editable unless this is `false`; other columns only when it is `true`,
|
|
33
|
+
* and they write to the task's `data`, through `parse`.
|
|
34
|
+
*/
|
|
35
|
+
editable?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* For an editable column of your own: the value to write for the typed
|
|
38
|
+
* text. Return `undefined` when the text can't be read: the field stays
|
|
39
|
+
* open, marked invalid. Without it the text is written as it is.
|
|
40
|
+
*/
|
|
41
|
+
parse?: (text: string, task: GanttTask) => unknown;
|
|
42
|
+
/** For a column of your own: the text a value shows as in its cell. Its editor starts from `String(value)`. */
|
|
43
|
+
format?: (value: unknown, task: GanttTask) => string;
|
|
44
|
+
/** For an editable column of your own: `number` brings up a number keypad. */
|
|
45
|
+
input?: 'text' | 'number';
|
|
46
|
+
}
|
|
47
|
+
/** Where `insertTask` puts the new task. */
|
|
48
|
+
export interface GanttInsertOptions {
|
|
49
|
+
/** After `near` (the default), or as its last subtask. */
|
|
50
|
+
where?: 'after' | 'inside';
|
|
51
|
+
/**
|
|
52
|
+
* When it starts, as a date or minutes; it lasts a working day. Without
|
|
53
|
+
* it the task starts after the one above it, or today.
|
|
54
|
+
*/
|
|
55
|
+
start?: string | number;
|
|
56
|
+
}
|
|
57
|
+
/** A vertical line across the timeline, such as a release day or a freeze. */
|
|
58
|
+
export interface GanttMarker {
|
|
59
|
+
/** Where, as `YYYY-MM-DD` (the start of that day) or `YYYY-MM-DD HH:mm`. */
|
|
60
|
+
date: string;
|
|
61
|
+
/** Shown in the time header. */
|
|
62
|
+
label?: string;
|
|
63
|
+
tone?: Tone;
|
|
64
|
+
}
|
|
65
|
+
/** New dates about to be given to a task, as they would be written. */
|
|
66
|
+
export interface GanttMove {
|
|
67
|
+
task: GanttTask;
|
|
68
|
+
start: string;
|
|
69
|
+
end?: string;
|
|
70
|
+
}
|
|
71
|
+
/** How a bar shows its task's title. */
|
|
72
|
+
export type GanttBarLabel = 'auto' | 'inside' | 'outside' | 'none';
|
|
73
|
+
export interface GanttProps {
|
|
74
|
+
/** Which days and hours are worked; shades the rest and counts durations. */
|
|
75
|
+
calendar?: GanttCalendar;
|
|
76
|
+
/** Columns of the task table. Defaults to title, start and duration. */
|
|
77
|
+
columns?: GanttColumn[];
|
|
78
|
+
/**
|
|
79
|
+
* Show the task table beside the timeline. Below 520px it steps aside and
|
|
80
|
+
* the task titles show on the timeline.
|
|
81
|
+
*/
|
|
82
|
+
table?: boolean;
|
|
83
|
+
/** Starting width of the task table, in px. */
|
|
84
|
+
tableWidth?: number;
|
|
85
|
+
/** Height of a row, in px. */
|
|
86
|
+
rowHeight?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Where a bar's title goes: `auto` puts it inside when it fits and
|
|
89
|
+
* beside the bar otherwise.
|
|
90
|
+
*/
|
|
91
|
+
barLabel?: GanttBarLabel;
|
|
92
|
+
/**
|
|
93
|
+
* The span the timeline covers, as two dates. Leave it out to cover the
|
|
94
|
+
* tasks with room around them; scrolling to either end adds more.
|
|
95
|
+
*/
|
|
96
|
+
range?: [string, string];
|
|
97
|
+
/** Mark the current time with a line. */
|
|
98
|
+
today?: boolean;
|
|
99
|
+
/** The first day of a week: `0` Sunday, `1` Monday. Defaults to the locale's. */
|
|
100
|
+
weekStart?: 0 | 1;
|
|
101
|
+
/**
|
|
102
|
+
* `manual` (the default) changes only what is moved; links are shown and
|
|
103
|
+
* checked, and the ones not kept are drawn dashed. `auto` also pushes
|
|
104
|
+
* the tasks that wait on a moved task later, in the same undo step.
|
|
105
|
+
*/
|
|
106
|
+
scheduling?: 'manual' | 'auto';
|
|
107
|
+
/** Show a row below the table for adding tasks; only while editable. */
|
|
108
|
+
addRow?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* The built-in context menu items: rename, add, indent, remove. Turn off
|
|
111
|
+
* to keep only the extensions' items, or no menu at all.
|
|
112
|
+
*/
|
|
113
|
+
menu?: boolean;
|
|
114
|
+
/**
|
|
115
|
+
* Your own context menu items, shown first; the extensions' and the
|
|
116
|
+
* built-in ones follow. Return none to add nothing.
|
|
117
|
+
*/
|
|
118
|
+
contextMenu?: (target: GanttMenuTarget) => ContextMenuItem[];
|
|
119
|
+
/** Highlight the critical path: the tasks with no slack, and the links that drive them. */
|
|
120
|
+
critical?: boolean;
|
|
121
|
+
/** Show the plan without changing it: no dragging, no new links, no undo keys. */
|
|
122
|
+
readonly?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* The last check before a link is made, by dragging or by keys. Return `true` to
|
|
125
|
+
* allow it; anything else refuses it, and a string is shown as the reason.
|
|
126
|
+
*/
|
|
127
|
+
canLink?: (link: Pick<GanttLink, 'from' | 'to' | 'type'>, doc: GanttDocument) => boolean | string;
|
|
128
|
+
/**
|
|
129
|
+
* The last check before new dates are written, by dragging or by keys.
|
|
130
|
+
* Return `true` to allow them; anything else refuses them, and a string
|
|
131
|
+
* is shown as the reason.
|
|
132
|
+
*/
|
|
133
|
+
canMove?: (move: GanttMove, doc: GanttDocument) => boolean | string;
|
|
134
|
+
/** Vertical marker lines, such as release days. */
|
|
135
|
+
markers?: GanttMarker[];
|
|
136
|
+
/**
|
|
137
|
+
* The dates as planned, from `takeBaseline`: each task shows a thin line
|
|
138
|
+
* under its bar where the plan had it, and reads out how far it moved.
|
|
139
|
+
*/
|
|
140
|
+
baseline?: GanttBaselineItem[];
|
|
141
|
+
/** Columns, rules, keys and layers added to the chart; see `defineGanttExtension`. */
|
|
142
|
+
extensions?: (GanttExtension | GanttExtension[])[];
|
|
143
|
+
/** Accessible name of the chart. */
|
|
144
|
+
ariaLabel?: string;
|
|
145
|
+
/** Texts to change; only the ones given are replaced. */
|
|
146
|
+
messages?: GanttMessagesOverride;
|
|
147
|
+
}
|
|
148
|
+
export interface GanttEmits {
|
|
149
|
+
/** Every change to tasks or links, with its steps; sent after the `update:` events. */
|
|
150
|
+
transaction: [tr: GanttTransaction];
|
|
151
|
+
/**
|
|
152
|
+
* An extension's `transaction` hook cancelled a change; `tr.cancelReason`
|
|
153
|
+
* says why, and the editor shows it and reads it out.
|
|
154
|
+
*/
|
|
155
|
+
transactionCancel: [tr: GanttTransaction];
|
|
156
|
+
/** A link was drawn by dragging from one bar to another. */
|
|
157
|
+
link: [link: GanttLink];
|
|
158
|
+
taskClick: [task: GanttTask, event: MouseEvent];
|
|
159
|
+
taskDblclick: [task: GanttTask, event: MouseEvent];
|
|
160
|
+
taskContextmenu: [task: GanttTask, event: MouseEvent];
|
|
161
|
+
linkClick: [link: GanttLink, event: MouseEvent];
|
|
162
|
+
/** Sent before the menu opens; `event.preventDefault()` keeps it closed. */
|
|
163
|
+
linkContextmenu: [link: GanttLink, event: MouseEvent];
|
|
164
|
+
}
|
|
165
|
+
export interface GanttSlots {
|
|
166
|
+
/** A cell of the task table. */
|
|
167
|
+
cell?: (props: {
|
|
168
|
+
task: GanttTask;
|
|
169
|
+
row: GanttRow;
|
|
170
|
+
column: GanttColumn;
|
|
171
|
+
text: string;
|
|
172
|
+
}) => unknown;
|
|
173
|
+
/** The content of a bar, in place of its title. */
|
|
174
|
+
bar?: (props: {
|
|
175
|
+
task: GanttTask;
|
|
176
|
+
row: GanttRow;
|
|
177
|
+
}) => unknown;
|
|
178
|
+
/** Drawn over the chart, e.g. a panel; it can call `useGantt()`. */
|
|
179
|
+
default?: () => unknown;
|
|
180
|
+
}
|
|
181
|
+
export interface GanttExportOptions {
|
|
182
|
+
/**
|
|
183
|
+
* `all` (the default): every row and the time all tasks cover. `view`:
|
|
184
|
+
* the rows and the time in view now.
|
|
185
|
+
*/
|
|
186
|
+
range?: 'all' | 'view';
|
|
187
|
+
/** Draw the table beside the timeline. Defaults to whether it is shown. */
|
|
188
|
+
table?: boolean;
|
|
189
|
+
/** The time scale to draw at; defaults to the current zoom. */
|
|
190
|
+
scale?: GanttScale;
|
|
191
|
+
/**
|
|
192
|
+
* Fill the header and the rows with the page colors. `false` leaves them
|
|
193
|
+
* transparent, for placing on a slide or page of another color. Defaults to `true`.
|
|
194
|
+
*/
|
|
195
|
+
background?: boolean;
|
|
196
|
+
}
|
|
197
|
+
export interface GanttImageOptions extends GanttExportOptions {
|
|
198
|
+
/** Pixels per CSS pixel. Defaults to `2`, sharp on most screens and in print. */
|
|
199
|
+
pixelRatio?: number;
|
|
200
|
+
}
|
|
201
|
+
export interface GanttPrintOptions {
|
|
202
|
+
/** Defaults to `landscape`. */
|
|
203
|
+
orientation?: 'landscape' | 'portrait';
|
|
204
|
+
/**
|
|
205
|
+
* Draw the table beside the timeline. Defaults to `true`: a page has
|
|
206
|
+
* room for it even when a narrow screen hides it. (An exported image
|
|
207
|
+
* follows what is shown, as it is often taken on that screen.)
|
|
208
|
+
*/
|
|
209
|
+
table?: boolean;
|
|
210
|
+
}
|
|
211
|
+
export interface GanttCSVExportOptions {
|
|
212
|
+
/**
|
|
213
|
+
* Writes what the table shows (`3月2日`, `5 天`) instead of values a
|
|
214
|
+
* spreadsheet can sort and add up (`2026-03-02`, `5`). Off by default.
|
|
215
|
+
* Such a file can't be read back with `importCSV`.
|
|
216
|
+
*/
|
|
217
|
+
text?: boolean;
|
|
218
|
+
/** Starts with a byte order mark, so spreadsheets read the file as UTF-8. On by default. */
|
|
219
|
+
bom?: boolean;
|
|
220
|
+
/**
|
|
221
|
+
* Start with two more columns, the task's `id` and its parent's, so that
|
|
222
|
+
* `importCSV` reads the tasks back in their tree, with the ids they have.
|
|
223
|
+
* Off by default.
|
|
224
|
+
*/
|
|
225
|
+
ids?: boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Puts a `'` before text a spreadsheet program would run as a formula
|
|
228
|
+
* (starting with `=`, `+`, `-`, `@`, a tab or a carriage return), such as a
|
|
229
|
+
* task named `-复盘`; numbers stay as they are, and `importCSV` takes the
|
|
230
|
+
* `'` off again. On by default; `false` writes such text as it is.
|
|
231
|
+
*/
|
|
232
|
+
escapeFormulas?: boolean;
|
|
233
|
+
}
|
|
234
|
+
export interface GanttExpose {
|
|
235
|
+
/** Applies changes as one transaction, one undo step. */
|
|
236
|
+
transact: (fn: (tr: GanttTransaction) => void, meta?: GanttTransactionMeta) => GanttTransaction;
|
|
237
|
+
undo: () => boolean;
|
|
238
|
+
redo: () => boolean;
|
|
239
|
+
readonly canUndo: boolean;
|
|
240
|
+
readonly canRedo: boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Moves tasks so that every link is kept, as one undo step, and returns
|
|
243
|
+
* what moved. Only pushes tasks later, unless `pull` is set.
|
|
244
|
+
*/
|
|
245
|
+
schedule: (options?: {
|
|
246
|
+
pull?: boolean;
|
|
247
|
+
}) => GanttSchedule;
|
|
248
|
+
/** Starts editing a cell of the table, the title by default; `false` when it can't be edited. */
|
|
249
|
+
editCell: (id: string, key?: string) => boolean;
|
|
250
|
+
/**
|
|
251
|
+
* Adds a task named with `messages.newTask` after another one (or at
|
|
252
|
+
* the end), lasting a working day, and starts editing its title.
|
|
253
|
+
* Returns its id.
|
|
254
|
+
*/
|
|
255
|
+
insertTask: (near: string | null, options?: GanttInsertOptions) => string;
|
|
256
|
+
/** Makes a task the last subtask of the one above it. */
|
|
257
|
+
indentTask: (id: string) => boolean;
|
|
258
|
+
/** Moves a task out of its parent, to just after it. */
|
|
259
|
+
outdentTask: (id: string) => boolean;
|
|
260
|
+
/** Picks the day width that fits all tasks into view and scrolls to the first one. */
|
|
261
|
+
fit: () => void;
|
|
262
|
+
/** Scrolls so that a date (or time) is near the left of the timeline. */
|
|
263
|
+
scrollToDate: (date: string) => void;
|
|
264
|
+
/** Scrolls a task into view, rows and time. */
|
|
265
|
+
scrollToTask: (id: string) => void;
|
|
266
|
+
/** Scrolls so that now is in view. */
|
|
267
|
+
scrollToToday: () => void;
|
|
268
|
+
/** Puts the keyboard on a task, scrolls it into view and focuses its bar. */
|
|
269
|
+
focusTask: (id: string) => void;
|
|
270
|
+
/** Widens the days by a step, keeping the middle of the view in place. */
|
|
271
|
+
zoomIn: () => void;
|
|
272
|
+
zoomOut: () => void;
|
|
273
|
+
/** The chart as an SVG document, in the current theme. */
|
|
274
|
+
exportSVG: (options?: GanttExportOptions) => string;
|
|
275
|
+
/** The chart as a PNG image. */
|
|
276
|
+
exportPNG: (options?: GanttImageOptions) => Promise<Blob>;
|
|
277
|
+
/**
|
|
278
|
+
* The table as CSV, every task in order. Dates are `YYYY-MM-DD` (with
|
|
279
|
+
* `HH:mm` for timed tasks), the duration is working days (working hours
|
|
280
|
+
* for timed tasks, the unit in its header; with both, each value keeps
|
|
281
|
+
* its unit) and progress is 0–100.
|
|
282
|
+
*/
|
|
283
|
+
toCSV: (options?: GanttCSVExportOptions) => string;
|
|
284
|
+
/**
|
|
285
|
+
* Reads tasks from CSV written by `toCSV` (not with `text`), or by
|
|
286
|
+
* hand with the same headers or the field keys (`title`, `start`,
|
|
287
|
+
* `end`…). Changes nothing in the chart. Throws a `GanttCSVError` when
|
|
288
|
+
* no header is the title column.
|
|
289
|
+
*/
|
|
290
|
+
readCSV: (text: string) => GanttCSVResult;
|
|
291
|
+
/**
|
|
292
|
+
* Reads tasks from CSV like `readCSV` and puts them in the chart, as
|
|
293
|
+
* one undo step. By default they replace the tasks; a task with an id
|
|
294
|
+
* the chart has keeps its links and what the file doesn't have, or
|
|
295
|
+
* can't read. `null` while `readonly`, and nothing is written.
|
|
296
|
+
*/
|
|
297
|
+
importCSV: (text: string, options?: GanttCSVImportOptions) => GanttCSVResult | null;
|
|
298
|
+
/**
|
|
299
|
+
* Prints every row, scaled to the page width, with the header repeated on
|
|
300
|
+
* each page.
|
|
301
|
+
*/
|
|
302
|
+
print: (options?: GanttPrintOptions) => void;
|
|
303
|
+
}
|
|
304
|
+
export type { GanttScale };
|
|
305
|
+
export type { GanttCSVErrorCode, GanttCSVImportOptions, GanttCSVResult, GanttCSVWarning, } from './core/csv';
|
package/package.json
CHANGED
|
@@ -1,6 +1,81 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dou-ui/gantt",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "DouUI 的甘特图:任务排期、依赖与工作日历",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"vue",
|
|
7
|
+
"vue3",
|
|
8
|
+
"gantt",
|
|
9
|
+
"schedule",
|
|
10
|
+
"timeline",
|
|
11
|
+
"project"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "daidr <daidr@daidr.me>",
|
|
15
|
+
"homepage": "https://github.com/daidr/dou-ui#readme",
|
|
16
|
+
"bugs": "https://github.com/daidr/dou-ui/issues",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/daidr/dou-ui.git",
|
|
20
|
+
"directory": "packages/gantt"
|
|
21
|
+
},
|
|
22
|
+
"type": "module",
|
|
23
|
+
"sideEffects": [
|
|
24
|
+
"*.css",
|
|
25
|
+
"./dist/style.js",
|
|
26
|
+
"./dist/*/style.js"
|
|
27
|
+
],
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"module": "./dist/index.js",
|
|
30
|
+
"types": "./dist/types/index.d.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/types/index.d.ts",
|
|
34
|
+
"import": "./dist/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./collaboration": {
|
|
37
|
+
"types": "./dist/types/collaboration/index.d.ts",
|
|
38
|
+
"import": "./dist/collaboration/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./scheduler": {
|
|
41
|
+
"types": "./dist/types/scheduler/index.d.ts",
|
|
42
|
+
"import": "./dist/scheduler/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./scheduler/style": {
|
|
45
|
+
"types": "./dist/scheduler/style.d.ts",
|
|
46
|
+
"import": "./dist/scheduler/style.js"
|
|
47
|
+
},
|
|
48
|
+
"./style": {
|
|
49
|
+
"types": "./dist/style.d.ts",
|
|
50
|
+
"import": "./dist/style.js"
|
|
51
|
+
},
|
|
52
|
+
"./style.css": "./dist/style.css",
|
|
53
|
+
"./package.json": "./package.json"
|
|
54
|
+
},
|
|
55
|
+
"files": [
|
|
56
|
+
"dist"
|
|
57
|
+
],
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "vite build && vue-tsc -p tsconfig.build.json && bun scripts/build-style.ts"
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"dou-ui": "0.1.0-alpha.0",
|
|
63
|
+
"vue": "^3.5.0",
|
|
64
|
+
"yjs": "^13.6.0"
|
|
65
|
+
},
|
|
66
|
+
"peerDependenciesMeta": {
|
|
67
|
+
"yjs": {
|
|
68
|
+
"optional": true
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"@dou-ui/icons": "0.1.0-alpha.0"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"y-protocols": "^1.0.7",
|
|
76
|
+
"yjs": "^13.6.33"
|
|
77
|
+
},
|
|
78
|
+
"publishConfig": {
|
|
79
|
+
"access": "public"
|
|
80
|
+
}
|
|
81
|
+
}
|