@dhtmlx/trial-vue-gantt 1.1.2 → 9.1.4

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 (46) hide show
  1. package/README.md +126 -262
  2. package/dist/dhtmlxgantt.vue.es.d.ts +352 -0
  3. package/dist/dhtmlxgantt.vue.es.js +18052 -0
  4. package/dist/vue-gantt.css +1 -0
  5. package/license.txt +43 -0
  6. package/package.json +55 -62
  7. package/whatsnew.md +1157 -0
  8. package/public/dist/gantt.js +0 -1
  9. package/src/components/Gantt.vue +0 -238
  10. package/src/components/TimeScale.vue +0 -57
  11. package/src/components/chart/Bars.vue +0 -470
  12. package/src/components/chart/CellGrid.vue +0 -22
  13. package/src/components/chart/Chart.vue +0 -236
  14. package/src/components/chart/Links.vue +0 -35
  15. package/src/components/chart/NewLink.vue +0 -39
  16. package/src/components/grid/Body.vue +0 -256
  17. package/src/components/grid/Grid.vue +0 -98
  18. package/src/components/grid/Header.vue +0 -104
  19. package/src/components/grid/actions/reorder.js +0 -193
  20. package/src/components/sidebar/Links.vue +0 -147
  21. package/src/components/sidebar/Sidebar.vue +0 -219
  22. package/src/locales/cn.js +0 -21
  23. package/src/locales/en.js +0 -21
  24. package/src/locales/ru.js +0 -21
  25. package/src/main.js +0 -46
  26. package/src/state/local.js +0 -48
  27. package/src/wx/Button.vue +0 -54
  28. package/src/wx/CNLocale.js +0 -15
  29. package/src/wx/Calendar.vue +0 -194
  30. package/src/wx/Counter.vue +0 -154
  31. package/src/wx/Datepicker.vue +0 -153
  32. package/src/wx/DefaultTheme.vue +0 -104
  33. package/src/wx/ENLocale.js +0 -15
  34. package/src/wx/IconButton.vue +0 -39
  35. package/src/wx/MaterialTheme.vue +0 -107
  36. package/src/wx/RULocale.js +0 -15
  37. package/src/wx/Select.vue +0 -75
  38. package/src/wx/Slider.vue +0 -150
  39. package/src/wx/Text.vue +0 -73
  40. package/src/wx/Textarea.vue +0 -63
  41. package/src/wx/Tooltip.vue +0 -110
  42. package/src/wx/index.js +0 -35
  43. package/src/wx/locale.js +0 -1
  44. package/src/wx/locales/cn.js +0 -39
  45. package/src/wx/locales/en.js +0 -39
  46. package/src/wx/locales/ru.js +0 -39
@@ -1,35 +0,0 @@
1
- <template>
2
- <svg class="links" :width="width" :height="height">
3
- <polyline
4
- class="line"
5
- v-for="link in links"
6
- :key="link.id"
7
- :points="link.$p"
8
- />
9
- </svg>
10
- </template>
11
-
12
- <script>
13
- export default {
14
- props: ["links", "width", "height"],
15
- };
16
- </script>
17
-
18
- <style scoped>
19
- .links {
20
- position: absolute;
21
- top: 0;
22
- left: 0;
23
- }
24
-
25
- .line {
26
- user-select: auto;
27
- pointer-events: stroke;
28
- position: relative;
29
- cursor: pointer;
30
- stroke: var(--wx-gantt-link-color);
31
- stroke-width: 2;
32
- z-index: 0;
33
- fill: transparent;
34
- }
35
- </style>
@@ -1,39 +0,0 @@
1
- <template>
2
- <svg
3
- class="new"
4
- :style="`top:${link.top}px;left:${link.left}px`"
5
- :width="link.width"
6
- :height="link.height"
7
- >
8
- <polyline class="line" :points="link.p" />
9
- </svg>
10
- </template>
11
-
12
- <script>
13
- import { placeLink } from "@dhtmlx/trial-lib-gantt";
14
-
15
- export default {
16
- props: ["layer", "start", "end"],
17
-
18
- computed: {
19
- link() {
20
- const box = this.layer.getBoundingClientRect();
21
- const link = placeLink(box, this.start, this.end);
22
- return link;
23
- },
24
- },
25
- };
26
- </script>
27
-
28
- <style scoped>
29
- .new {
30
- position: relative;
31
- pointer-events: none;
32
- }
33
-
34
- .line {
35
- stroke: var(--wx-gantt-link-color);
36
- stroke-width: 2;
37
- fill: none;
38
- }
39
- </style>
@@ -1,256 +0,0 @@
1
- <template>
2
- <div
3
- class="table"
4
- ref="node"
5
- :style="{ top: -(scrollTop - scrollDelta) + 'px' }"
6
- @wheel.passive="wheel"
7
- @click="click"
8
- @dblclick="dblclick"
9
- @touchstart="touchStart"
10
- @touchmove="touchMove"
11
- @touchend="endScroll"
12
- >
13
- <div
14
- v-for="task in tasks"
15
- :key="task.id"
16
- :class="['row', { selected: selected && selected.id == task.id }]"
17
- :style="{ height: cellHeight + 'px' }"
18
- :data-id="task.id"
19
- >
20
- <div
21
- v-for="column in columns"
22
- :key="column.name"
23
- class="cell"
24
- :style="cellStyle(column)"
25
- >
26
- <template v-if="column.name === 'text'">
27
- <div class="content" :style="contentStyle(task)">
28
- <div
29
- class="icon"
30
- :class="getIcon(task)"
31
- data-action="toggle-task"
32
- ></div>
33
- {{ column.template(task) }}
34
- </div>
35
- </template>
36
-
37
- <template v-else-if="column.action">
38
- <span class="add" :data-action="column.action" />
39
- </template>
40
-
41
- <template v-else>
42
- {{ column.template(task) }}
43
- </template>
44
- </div>
45
- </div>
46
- </div>
47
- </template>
48
-
49
- <script>
50
- import { locateID } from "@dhtmlx/trial-lib-gantt";
51
- import { reorder } from "./actions/reorder";
52
-
53
- export default {
54
- props: [
55
- "tasks",
56
- "columns",
57
- "cellHeight",
58
- "scrollTop",
59
- "scrollDelta",
60
- "selected",
61
- ],
62
-
63
- data: () => ({
64
- delta: 20,
65
- touchY: null,
66
- scroll: true,
67
- }),
68
-
69
- mounted() {
70
- reorder(this.$refs.node, {
71
- start: e => this.startReorder(e),
72
- move: e => this.moveReorder(e),
73
- end: e => this.endReorder(e),
74
- touchStart: () => this.endScroll(),
75
- });
76
- },
77
-
78
- methods: {
79
- click(e) {
80
- const id = locateID(e);
81
- if (!id) return;
82
-
83
- const action = e.target.dataset.action;
84
- if (action) {
85
- this.$emit("action", { id, action });
86
- e.preventDefault();
87
- } else {
88
- this.$emit("action", { action: "select-task", id });
89
- }
90
- },
91
-
92
- dblclick(e) {
93
- const id = locateID(e);
94
- if (id) this.$emit("action", { action: "show-details", id });
95
- },
96
-
97
- wheel(e) {
98
- const step = e.deltaMode ? e.deltaY * 18 : e.deltaY;
99
- const top = Math.max(0, this.scrollTop + step);
100
- this.$emit("action", { action: "scroll-chart", top });
101
- },
102
-
103
- touchStart(e) {
104
- this.scroll = true;
105
- this.touchY = e.touches[0].clientY + this.scrollTop;
106
- },
107
-
108
- touchMove(e) {
109
- if (this.scroll) {
110
- const delta = this.touchY - e.touches[0].clientY;
111
- this.$emit("action", { action: "scroll-chart", top: delta });
112
- }
113
- },
114
-
115
- endScroll() {
116
- this.scroll = false;
117
- },
118
-
119
- cellStyle(column) {
120
- const align = `text-align:${column.align}`;
121
- const width =
122
- column.width === "100%" ? `flex:1` : `width:${column.width}`;
123
- return `${width};${align}`;
124
- },
125
-
126
- contentStyle(task) {
127
- return {
128
- paddingLeft: (task.$level - 1) * this.delta + "px",
129
- };
130
- },
131
-
132
- getIcon(task) {
133
- if (!task.data) return "";
134
- return task.open ? "icon-close" : "icon-open";
135
- },
136
-
137
- startReorder({ id }) {
138
- id *= 1;
139
- const task = this.tasks.find(a => a.id === id);
140
- if (!task) return;
141
-
142
- if (task.open) this.$emit("action", { id, action: "toggle-task" });
143
-
144
- this.$emit("action", { action: "hide-details" });
145
- },
146
-
147
- moveReorder({ id, top }) {
148
- this.$emit("action", {
149
- action: "move-task",
150
- id,
151
- obj: { top: top + this.scrollDelta },
152
- });
153
- },
154
-
155
- endReorder(result) {
156
- let id = result.id * 1;
157
- const { before, after } = result;
158
- const target = (before || after) * 1;
159
-
160
- if (!target) {
161
- this.$emit("action", { id, action: "repaint-task" });
162
- return;
163
- }
164
-
165
- const mode = before ? "before" : "after";
166
-
167
- this.$emit("action", {
168
- id,
169
- action: "reorder-task",
170
- obj: { id, mode, target },
171
- });
172
- },
173
- },
174
- };
175
- </script>
176
-
177
- <style scoped>
178
- .table {
179
- position: relative;
180
- width: 100%;
181
- font: var(--wx-grid-body-font);
182
- color: var(--wx-grid-body-font-color);
183
- }
184
-
185
- .row {
186
- display: flex;
187
- align-items: center;
188
- box-sizing: border-box;
189
- border-bottom: var(--wx-grid-body-row-border);
190
- }
191
-
192
- .row.selected {
193
- background: var(--wx-gantt-select-color);
194
- }
195
-
196
- .cell {
197
- box-sizing: border-box;
198
- flex: 0 0 auto;
199
- padding: 0 5px;
200
- overflow: hidden;
201
- }
202
-
203
- .content {
204
- width: 100%;
205
- white-space: nowrap;
206
- display: flex;
207
- justify-content: flex-start;
208
- align-items: center;
209
- }
210
-
211
- .icon {
212
- width: 12px;
213
- min-width: 12px;
214
- height: 12px;
215
- margin: 0 5px;
216
- pointer-events: none;
217
- }
218
-
219
- .icon-close,
220
- .icon-open {
221
- cursor: pointer;
222
- pointer-events: auto;
223
- }
224
-
225
- .icon-close {
226
- background: var(--wx-close-btn-icon) center center no-repeat;
227
- }
228
-
229
- .icon-open {
230
- background: var(--wx-open-btn-icon) center center no-repeat;
231
- }
232
-
233
- .add {
234
- display: inline-block;
235
- width: 12px;
236
- height: 12px;
237
- background: var(--wx-add-btn-icon) center center no-repeat;
238
- opacity: 0.54;
239
- cursor: pointer;
240
- }
241
-
242
- .add:hover {
243
- opacity: 1;
244
- }
245
-
246
- .wx-reorder-card.row {
247
- width: 100%;
248
- background: white;
249
- border-top: var(--wx-grid-body-row-border);
250
- opacity: 50%;
251
- }
252
-
253
- .wx-reorder.row {
254
- opacity: 50%;
255
- }
256
- </style>
@@ -1,98 +0,0 @@
1
- <template>
2
- <div class="grid" :style="{ flex: `0 0 ${basis}` }">
3
- <Header
4
- :compactMode="compactMode"
5
- :columns="cols"
6
- :height="scales.height"
7
- @action="action"
8
- />
9
-
10
- <Body
11
- :tasks="tasks"
12
- :columns="cols"
13
- :cellHeight="cellHeight"
14
- :scrollTop="scrollTop"
15
- :scrollDelta="scrollDelta"
16
- :selected="selected"
17
- @action="action"
18
- />
19
- </div>
20
- </template>
21
-
22
- <script>
23
- import Header from "./Header.vue";
24
- import Body from "./Body.vue";
25
-
26
- export default {
27
- components: {
28
- Header,
29
- Body,
30
- },
31
-
32
- data: () => ({
33
- showFull: false,
34
- }),
35
-
36
- props: [
37
- "compactMode",
38
- "width",
39
- "tasks",
40
- "columns",
41
- "scales",
42
- "cellHeight",
43
- "scrollTop",
44
- "scrollDelta",
45
- "selected",
46
- ],
47
-
48
- methods: {
49
- action(ev) {
50
- const { action } = ev;
51
-
52
- switch (action) {
53
- case "toggle-grid":
54
- this.showFull = !this.showFull;
55
- break;
56
-
57
- default:
58
- this.$emit("action", ev);
59
- break;
60
- }
61
- },
62
- },
63
-
64
- computed: {
65
- cols() {
66
- const { compactMode, columns } = this;
67
- return compactMode
68
- ? [
69
- columns[columns.length - 1],
70
- ...columns.slice(0, columns.length - 1),
71
- ]
72
- : columns;
73
- },
74
-
75
- basis() {
76
- return this.showFull ? "100%" : `${this.width}px`;
77
- },
78
- },
79
-
80
- watch: {
81
- compactMode() {
82
- if (!this.compactMode) {
83
- this.showFull = false;
84
- }
85
- },
86
- },
87
- };
88
- </script>
89
-
90
- <style scoped>
91
- .grid {
92
- display: flex;
93
- flex-direction: column;
94
- box-sizing: border-box;
95
- border-right: 1px solid var(--wx-border-color);
96
- overflow: hidden;
97
- }
98
- </style>
@@ -1,104 +0,0 @@
1
- <template>
2
- <div class="table">
3
- <div class="row" :style="headerStyle">
4
- <div
5
- v-for="column in columns"
6
- :key="column.name"
7
- class="cell"
8
- :style="cellStyle(column)"
9
- >
10
- <template v-if="column.action">
11
- <span
12
- v-if="compactMode"
13
- class="mdi mdi-menu"
14
- @click="toggleGrid"
15
- ></span>
16
- <span v-else class="add" @click="addTask"></span>
17
- </template>
18
- <template v-else>{{ t("gantt", column.label) }}</template>
19
- </div>
20
- </div>
21
- </div>
22
- </template>
23
-
24
- <script>
25
- import { LocaleContext } from "@/wx/locale";
26
- import { inject } from "vue";
27
-
28
- export default {
29
- props: ["compactMode", "columns", "height"],
30
-
31
- setup() {
32
- return { t: inject(LocaleContext).__ };
33
- },
34
-
35
- methods: {
36
- cellStyle(column) {
37
- const align = `text-align:${column.align}`;
38
- const width =
39
- column.width === "100%" ? `flex:1` : `width:${column.width}`;
40
- return `${width};${align}`;
41
- },
42
-
43
- addTask() {
44
- this.$emit("action", { action: "add-task", id: 0 });
45
- },
46
-
47
- toggleGrid() {
48
- this.$emit("action", { action: "toggle-grid" });
49
- },
50
- },
51
-
52
- computed: {
53
- headerStyle() {
54
- return {
55
- height: this.height + "px",
56
- };
57
- },
58
- },
59
- };
60
- </script>
61
-
62
- <style scoped>
63
- .table {
64
- position: relative;
65
- width: 100%;
66
- box-shadow: var(--wx-grid-header-shadow);
67
- background-color: #fff;
68
- z-index: 1;
69
- }
70
-
71
- .row {
72
- box-sizing: border-box;
73
- display: flex;
74
- align-items: center;
75
- border-bottom: 1px solid var(--wx-border-color);
76
- }
77
-
78
- .cell {
79
- box-sizing: border-box;
80
- flex: 0 0 auto;
81
- font: var(--wx-grid-header-font);
82
- text-transform: var(--wx-grid-header-text-transform);
83
- color: var(--wx-grid-header-font-color);
84
- }
85
-
86
- .add {
87
- display: inline-block;
88
- width: 12px;
89
- height: 12px;
90
- background: var(--wx-add-btn-icon) center center no-repeat;
91
- opacity: 0.54;
92
- cursor: pointer;
93
- }
94
-
95
- .add:hover {
96
- opacity: 1;
97
- }
98
-
99
- .mdi-menu {
100
- cursor: pointer;
101
- font-size: 20px;
102
- color: var(--wx-button-primary-color);
103
- }
104
- </style>
@@ -1,193 +0,0 @@
1
- import { locate } from "@dhtmlx/trial-lib-gantt";
2
-
3
- function getOffset(node, relative, ev) {
4
- const box = node.getBoundingClientRect();
5
- const base = relative.getBoundingClientRect();
6
-
7
- return {
8
- top: box.top - base.top,
9
- left: box.left - base.left,
10
- dt: box.bottom - ev.clientY,
11
- db: ev.clientY - box.top,
12
- };
13
- }
14
-
15
- const SHIFT = 5;
16
-
17
- export function reorder(node, config) {
18
- let source, clone;
19
- let x, y, base, detail;
20
- let touched, touchTimer;
21
-
22
- function down(event) {
23
- x = event.clientX;
24
- y = event.clientY;
25
- base = getOffset(source, node, event);
26
-
27
- document.body.style.userSelect = "none";
28
- }
29
-
30
- function handleTouchstart(event) {
31
- source = locate(event);
32
- if (!source) return;
33
-
34
- touchTimer = setTimeout(() => {
35
- touched = true;
36
- if (config && config.touchStart) config.touchStart();
37
- source.classList.add("wx-reorder");
38
- down(event.touches[0]);
39
- }, 500);
40
-
41
- node.addEventListener("touchmove", handleTouchmove);
42
- node.addEventListener("contextmenu", handleContext);
43
- window.addEventListener("touchend", handleTouchend);
44
- }
45
-
46
- function handleContext(event) {
47
- if (touched || touchTimer) {
48
- event.preventDefault();
49
- return false;
50
- }
51
- }
52
-
53
- function handleMousedown(event) {
54
- if (event.which === 3) return;
55
-
56
- source = locate(event);
57
- if (!source) return;
58
-
59
- node.addEventListener("mousemove", handleMousemove);
60
- window.addEventListener("mouseup", handleMouseup);
61
-
62
- down(event);
63
- }
64
-
65
- function end(full) {
66
- node.removeEventListener("mousemove", handleMousemove);
67
- node.removeEventListener("touchmove", handleTouchmove);
68
- window.removeEventListener("mouseup", handleMouseup);
69
- window.removeEventListener("touchend", handleTouchend);
70
- document.body.style.userSelect = "";
71
-
72
- if (full) {
73
- node.removeEventListener("mousedown", handleMousedown);
74
- node.removeEventListener("touchstart", handleTouchstart);
75
- }
76
- }
77
-
78
- function move(event) {
79
- const dx = event.clientX - x;
80
- const dy = event.clientY - y;
81
- if (!clone) {
82
- if (config && config.start) {
83
- if (config.start({ id: source.dataset.id, e: event }) === false) return;
84
- }
85
- if (Math.abs(dx) < SHIFT && Math.abs(dy) < SHIFT) return;
86
-
87
- clone = source.cloneNode(true);
88
- clone.style.pointerEvents = "none";
89
- clone.classList.add("wx-reorder-card");
90
- clone.style.position = "absolute";
91
- clone.style.left = base.left + "px";
92
- clone.style.top = base.top + "px";
93
-
94
- source.style.visibility = "hidden";
95
- source.parentNode.insertBefore(clone, source);
96
- }
97
-
98
- if (clone) {
99
- const top = Math.max(0, base.top + dy);
100
- clone.style.top = top + "px";
101
-
102
- const targetNode = document.elementFromPoint(
103
- event.clientX,
104
- event.clientY
105
- );
106
- const target = locate(targetNode);
107
-
108
- if (target && target !== source) {
109
- const box = target.getBoundingClientRect();
110
- const line = box.top + box.height / 2;
111
-
112
- const after =
113
- event.clientY + base.db > line &&
114
- target.nextElementSibling !== source;
115
- const before =
116
- event.clientY - base.dt < line &&
117
- target.previousElementSibling !== source;
118
- if (config && config.move)
119
- if (
120
- config.move({ id: source.dataset.id, top, before, after }) === false
121
- )
122
- return;
123
- if (after) {
124
- // move down
125
- target.parentNode.insertBefore(source, target.nextElementSibling);
126
- detail = { id: source.dataset.id, after: target.dataset.id };
127
- } else if (before) {
128
- // move up
129
- target.parentNode.insertBefore(source, target);
130
- detail = { id: source.dataset.id, before: target.dataset.id };
131
- }
132
- return;
133
- }
134
-
135
- if (config && config.move) config.move({ id: source.dataset.id, top });
136
- }
137
- }
138
-
139
- function handleMousemove(event) {
140
- move(event);
141
- }
142
-
143
- function handleTouchmove(event) {
144
- if (touched) {
145
- event.preventDefault();
146
- move(event.touches[0]);
147
- } else if (touchTimer) {
148
- clearTimeout(touchTimer);
149
- touchTimer = null;
150
- }
151
- }
152
-
153
- function handleTouchend() {
154
- touched = null;
155
- if (touchTimer) {
156
- clearTimeout(touchTimer);
157
- touchTimer = null;
158
- }
159
- up();
160
- }
161
-
162
- function handleMouseup() {
163
- up();
164
- }
165
-
166
- function up() {
167
- if (source) {
168
- source.style.visibility = "";
169
- source.classList.remove("wx-reorder");
170
- }
171
- if (clone) {
172
- clone.parentNode.removeChild(clone);
173
- if (config && config.end)
174
- if (config.end(detail || { id: source.dataset.id }) === false) {
175
- source.parentNode.removeChild(source);
176
- }
177
- }
178
-
179
- source = clone = base = detail = null;
180
- end();
181
- }
182
-
183
- if (node.style.position !== "absolute") node.style.position = "relative";
184
-
185
- node.addEventListener("mousedown", handleMousedown);
186
- node.addEventListener("touchstart", handleTouchstart);
187
-
188
- return {
189
- destroy() {
190
- end(true);
191
- },
192
- };
193
- }