vxe-gantt 4.1.3 → 4.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.
- package/es/gantt/src/gantt-chart.js +9 -2
- package/es/gantt/src/gantt-view.js +47 -24
- package/es/gantt/src/gantt.js +2 -1
- package/es/ui/index.js +6 -2
- package/es/ui/src/log.js +1 -1
- package/lib/gantt/src/gantt-chart.js +15 -2
- package/lib/gantt/src/gantt-chart.min.js +1 -1
- package/lib/gantt/src/gantt-view.js +65 -27
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +2 -1
- package/lib/index.umd.js +89 -33
- package/lib/index.umd.min.js +1 -1
- package/lib/ui/index.js +6 -2
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +3 -3
- package/packages/gantt/src/gantt-chart.ts +9 -2
- package/packages/gantt/src/gantt-view.ts +47 -24
- package/packages/gantt/src/gantt.ts +2 -1
- package/packages/ui/index.ts +5 -1
|
@@ -20,6 +20,7 @@ export default defineVxeComponent({
|
|
|
20
20
|
const $xeGantt = inject('$xeGantt', {} as (VxeGanttConstructor & VxeGanttPrivateMethods))
|
|
21
21
|
const $xeGanttView = inject('$xeGanttView', {} as VxeGanttViewConstructor & VxeGanttViewPrivateMethods)
|
|
22
22
|
|
|
23
|
+
const { internalData: ganttInternalData } = $xeGantt
|
|
23
24
|
const { reactData, internalData } = $xeGanttView
|
|
24
25
|
const { computeProgressField, computeTitleField, computeTaskBarOpts, computeScaleUnit } = $xeGantt.getComputeMaps()
|
|
25
26
|
|
|
@@ -107,13 +108,19 @@ export default defineVxeComponent({
|
|
|
107
108
|
}
|
|
108
109
|
if (showTooltip) {
|
|
109
110
|
ons.onMouseover = (evnt: MouseEvent) => {
|
|
111
|
+
const { dragBarRow } = ganttInternalData
|
|
110
112
|
const ttParams = Object.assign({ $event: evnt }, ctParams)
|
|
111
|
-
|
|
113
|
+
if (!dragBarRow) {
|
|
114
|
+
$xeGantt.triggerTaskBarTooltipEvent(evnt, ttParams)
|
|
115
|
+
}
|
|
112
116
|
$xeGantt.dispatchEvent('task-bar-mouseenter', ttParams, evnt)
|
|
113
117
|
}
|
|
114
118
|
ons.onMouseleave = (evnt: MouseEvent) => {
|
|
119
|
+
const { dragBarRow } = ganttInternalData
|
|
115
120
|
const ttParams = Object.assign({ $event: evnt }, ctParams)
|
|
116
|
-
|
|
121
|
+
if (!dragBarRow) {
|
|
122
|
+
$xeGantt.handleTaskBarTooltipLeaveEvent(evnt, ttParams)
|
|
123
|
+
}
|
|
117
124
|
$xeGantt.dispatchEvent('task-bar-mouseleave', ttParams, evnt)
|
|
118
125
|
}
|
|
119
126
|
}
|
|
@@ -51,7 +51,8 @@ export default defineVxeComponent({
|
|
|
51
51
|
|
|
52
52
|
const $xeGantt = inject('$xeGantt', {} as (VxeGanttConstructor & VxeGanttPrivateMethods))
|
|
53
53
|
|
|
54
|
-
const {
|
|
54
|
+
const { internalData: ganttInternalData } = $xeGantt
|
|
55
|
+
const { computeTaskOpts, computeTaskViewOpts, computeStartField, computeEndField, computeScrollbarOpts, computeScrollbarXToTop, computeScrollbarYToLeft, computeScaleUnit, computeWeekScale, computeMinScale } = $xeGantt.getComputeMaps()
|
|
55
56
|
|
|
56
57
|
const refElem = ref<HTMLDivElement>()
|
|
57
58
|
|
|
@@ -113,18 +114,21 @@ export default defineVxeComponent({
|
|
|
113
114
|
|
|
114
115
|
const computeScaleDateList = computed(() => {
|
|
115
116
|
const { minViewDate, maxViewDate } = reactData
|
|
117
|
+
const taskViewOpts = computeTaskViewOpts.value
|
|
116
118
|
const minScale = computeMinScale.value
|
|
119
|
+
const { gridding } = taskViewOpts
|
|
117
120
|
const dateList: Date[] = []
|
|
118
121
|
if (!minViewDate || !maxViewDate) {
|
|
119
122
|
return dateList
|
|
120
123
|
}
|
|
121
124
|
|
|
122
|
-
const
|
|
123
|
-
const
|
|
125
|
+
const leftSize = -XEUtils.toNumber(gridding ? gridding.leftSpacing || 0 : 0)
|
|
126
|
+
const rightSize = XEUtils.toNumber(gridding ? gridding.rightSpacing || 0 : 0)
|
|
124
127
|
switch (minScale.type) {
|
|
125
128
|
case 'year': {
|
|
126
|
-
let currDate = XEUtils.getWhatYear(minViewDate,
|
|
127
|
-
|
|
129
|
+
let currDate = XEUtils.getWhatYear(minViewDate, leftSize, 'first')
|
|
130
|
+
const endDate = XEUtils.getWhatYear(maxViewDate, rightSize, 'first')
|
|
131
|
+
while (currDate <= endDate) {
|
|
128
132
|
const itemDate = currDate
|
|
129
133
|
dateList.push(itemDate)
|
|
130
134
|
currDate = XEUtils.getWhatYear(currDate, 1)
|
|
@@ -132,8 +136,9 @@ export default defineVxeComponent({
|
|
|
132
136
|
break
|
|
133
137
|
}
|
|
134
138
|
case 'quarter': {
|
|
135
|
-
let currDate = XEUtils.getWhatQuarter(minViewDate,
|
|
136
|
-
|
|
139
|
+
let currDate = XEUtils.getWhatQuarter(minViewDate, leftSize, 'first')
|
|
140
|
+
const endDate = XEUtils.getWhatQuarter(maxViewDate, rightSize, 'first')
|
|
141
|
+
while (currDate <= endDate) {
|
|
137
142
|
const itemDate = currDate
|
|
138
143
|
dateList.push(itemDate)
|
|
139
144
|
currDate = XEUtils.getWhatQuarter(currDate, 1)
|
|
@@ -141,8 +146,9 @@ export default defineVxeComponent({
|
|
|
141
146
|
break
|
|
142
147
|
}
|
|
143
148
|
case 'month': {
|
|
144
|
-
let currDate = XEUtils.getWhatMonth(minViewDate,
|
|
145
|
-
|
|
149
|
+
let currDate = XEUtils.getWhatMonth(minViewDate, leftSize, 'first')
|
|
150
|
+
const endDate = XEUtils.getWhatMonth(maxViewDate, rightSize, 'first')
|
|
151
|
+
while (currDate <= endDate) {
|
|
146
152
|
const itemDate = currDate
|
|
147
153
|
dateList.push(itemDate)
|
|
148
154
|
currDate = XEUtils.getWhatMonth(currDate, 1)
|
|
@@ -150,8 +156,9 @@ export default defineVxeComponent({
|
|
|
150
156
|
break
|
|
151
157
|
}
|
|
152
158
|
case 'week': {
|
|
153
|
-
let currDate = XEUtils.getWhatWeek(minViewDate,
|
|
154
|
-
|
|
159
|
+
let currDate = XEUtils.getWhatWeek(minViewDate, leftSize, minScale.startDay, minScale.startDay)
|
|
160
|
+
const endDate = XEUtils.getWhatWeek(maxViewDate, rightSize, minScale.startDay, minScale.startDay)
|
|
161
|
+
while (currDate <= endDate) {
|
|
155
162
|
const itemDate = currDate
|
|
156
163
|
dateList.push(itemDate)
|
|
157
164
|
currDate = XEUtils.getWhatWeek(currDate, 1)
|
|
@@ -159,12 +166,22 @@ export default defineVxeComponent({
|
|
|
159
166
|
break
|
|
160
167
|
}
|
|
161
168
|
case 'day':
|
|
162
|
-
case 'date':
|
|
169
|
+
case 'date': {
|
|
170
|
+
let currDate = XEUtils.getWhatDay(minViewDate, leftSize, 'first')
|
|
171
|
+
const endDate = XEUtils.getWhatDay(maxViewDate, rightSize, 'first')
|
|
172
|
+
while (currDate <= endDate) {
|
|
173
|
+
const itemDate = currDate
|
|
174
|
+
dateList.push(itemDate)
|
|
175
|
+
currDate = XEUtils.getWhatDay(currDate, 1)
|
|
176
|
+
}
|
|
177
|
+
break
|
|
178
|
+
}
|
|
163
179
|
case 'hour':
|
|
164
180
|
case 'minute':
|
|
165
181
|
case 'second': {
|
|
166
182
|
const gapTime = getStandardGapTime(minScale.type)
|
|
167
|
-
let currTime =
|
|
183
|
+
let currTime = minViewDate.getTime() + (leftSize * gapTime)
|
|
184
|
+
const endTime = maxViewDate.getTime() + (rightSize * gapTime)
|
|
168
185
|
while (currTime <= endTime) {
|
|
169
186
|
const itemDate = new Date(currTime)
|
|
170
187
|
dateList.push(itemDate)
|
|
@@ -277,12 +294,13 @@ export default defineVxeComponent({
|
|
|
277
294
|
|
|
278
295
|
for (let i = 0; i < scaleDateList.length; i++) {
|
|
279
296
|
const itemDate = scaleDateList[i]
|
|
280
|
-
const [yyyy, MM, dd, HH, mm, ss] = XEUtils.toDateString(itemDate, 'yyyy-M-d-H-m-s').split('-')
|
|
297
|
+
const [yy, yyyy, M, MM, d, dd, H, HH, m, mm, s, ss] = XEUtils.toDateString(itemDate, 'yy-yyyy-M-MM-d-dd-H-HH-m-mm-s-ss').split('-')
|
|
281
298
|
const e = itemDate.getDay()
|
|
282
299
|
const E = e + 1
|
|
283
300
|
const q = Math.ceil((itemDate.getMonth() + 1) / 3)
|
|
284
|
-
const W = XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined)
|
|
285
|
-
const
|
|
301
|
+
const W = `${XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined)}`
|
|
302
|
+
const WW = XEUtils.padStart(W, 2, '0')
|
|
303
|
+
const dateObj: VxeGanttDefines.ScaleDateObj = { date: itemDate, yy, yyyy, M, MM, d, dd, H, HH, m, mm, s, ss, q, W, WW, E, e }
|
|
286
304
|
const colMaps: Record<VxeGanttDefines.ColumnScaleType, VxeGanttDefines.ViewColumn> = {
|
|
287
305
|
year: {
|
|
288
306
|
field: yyyy,
|
|
@@ -415,7 +433,7 @@ export default defineVxeComponent({
|
|
|
415
433
|
const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
|
|
416
434
|
return {
|
|
417
435
|
offsetLeftSize,
|
|
418
|
-
offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
|
|
436
|
+
offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
|
|
419
437
|
}
|
|
420
438
|
}
|
|
421
439
|
}
|
|
@@ -438,7 +456,7 @@ export default defineVxeComponent({
|
|
|
438
456
|
const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
|
|
439
457
|
return {
|
|
440
458
|
offsetLeftSize,
|
|
441
|
-
offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
|
|
459
|
+
offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
|
|
442
460
|
}
|
|
443
461
|
}
|
|
444
462
|
}
|
|
@@ -461,7 +479,7 @@ export default defineVxeComponent({
|
|
|
461
479
|
const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
|
|
462
480
|
return {
|
|
463
481
|
offsetLeftSize,
|
|
464
|
-
offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
|
|
482
|
+
offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
|
|
465
483
|
}
|
|
466
484
|
}
|
|
467
485
|
}
|
|
@@ -484,7 +502,7 @@ export default defineVxeComponent({
|
|
|
484
502
|
const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
|
|
485
503
|
return {
|
|
486
504
|
offsetLeftSize,
|
|
487
|
-
offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
|
|
505
|
+
offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
|
|
488
506
|
}
|
|
489
507
|
}
|
|
490
508
|
}
|
|
@@ -508,7 +526,7 @@ export default defineVxeComponent({
|
|
|
508
526
|
const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
|
|
509
527
|
return {
|
|
510
528
|
offsetLeftSize,
|
|
511
|
-
offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
|
|
529
|
+
offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
|
|
512
530
|
}
|
|
513
531
|
}
|
|
514
532
|
}
|
|
@@ -531,7 +549,7 @@ export default defineVxeComponent({
|
|
|
531
549
|
const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
|
|
532
550
|
return {
|
|
533
551
|
offsetLeftSize,
|
|
534
|
-
offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
|
|
552
|
+
offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
|
|
535
553
|
}
|
|
536
554
|
}
|
|
537
555
|
}
|
|
@@ -554,7 +572,7 @@ export default defineVxeComponent({
|
|
|
554
572
|
const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
|
|
555
573
|
return {
|
|
556
574
|
offsetLeftSize,
|
|
557
|
-
offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
|
|
575
|
+
offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
|
|
558
576
|
}
|
|
559
577
|
}
|
|
560
578
|
}
|
|
@@ -728,16 +746,21 @@ export default defineVxeComponent({
|
|
|
728
746
|
}
|
|
729
747
|
|
|
730
748
|
const updateChart = () => {
|
|
749
|
+
const { dragBarRow } = ganttInternalData
|
|
731
750
|
const { viewCellWidth } = reactData
|
|
732
751
|
const { elemStore, chartMaps } = internalData
|
|
752
|
+
const $xeTable = internalData.xeTable
|
|
733
753
|
const chartWrapper = getRefElem(elemStore['main-chart-wrapper'])
|
|
734
|
-
if (chartWrapper) {
|
|
754
|
+
if (chartWrapper && $xeTable) {
|
|
735
755
|
XEUtils.arrayEach(chartWrapper.children, (rowEl) => {
|
|
736
756
|
const barEl = rowEl.children[0] as HTMLDivElement
|
|
737
757
|
if (!barEl) {
|
|
738
758
|
return
|
|
739
759
|
}
|
|
740
760
|
const rowid = rowEl.getAttribute('rowid')
|
|
761
|
+
if (dragBarRow && $xeTable.getRowid(dragBarRow) === rowid) {
|
|
762
|
+
return
|
|
763
|
+
}
|
|
741
764
|
const rowRest = rowid ? chartMaps[rowid] : null
|
|
742
765
|
barEl.style.left = `${rowRest ? viewCellWidth * rowRest.oLeftSize : 0}px`
|
|
743
766
|
barEl.style.width = `${rowRest ? viewCellWidth * rowRest.oWidthSize : 0}px`
|