vxe-gantt 4.1.16 → 4.1.17
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-view.js +24 -11
- package/es/gantt/src/gantt.js +4 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/gantt/src/gantt-view.js +27 -13
- package/lib/gantt/src/gantt-view.min.js +1 -1
- package/lib/gantt/src/gantt.js +5 -1
- package/lib/gantt/src/gantt.min.js +1 -1
- package/lib/index.umd.js +34 -16
- package/lib/index.umd.min.js +1 -1
- package/lib/ui/index.js +1 -1
- 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 +2 -2
- package/packages/gantt/src/gantt-view.ts +24 -13
- package/packages/gantt/src/gantt.ts +4 -1
|
@@ -119,6 +119,7 @@ export default defineVxeComponent({
|
|
|
119
119
|
const taskViewOpts = computeTaskViewOpts.value
|
|
120
120
|
const minScale = computeMinScale.value
|
|
121
121
|
const { gridding } = taskViewOpts
|
|
122
|
+
const { type, startDay } = minScale
|
|
122
123
|
const dateList: Date[] = []
|
|
123
124
|
if (!minViewDate || !maxViewDate) {
|
|
124
125
|
return dateList
|
|
@@ -126,14 +127,15 @@ export default defineVxeComponent({
|
|
|
126
127
|
|
|
127
128
|
const leftSize = -XEUtils.toNumber(gridding ? gridding.leftSpacing || 0 : 0)
|
|
128
129
|
const rightSize = XEUtils.toNumber(gridding ? gridding.rightSpacing || 0 : 0)
|
|
129
|
-
|
|
130
|
+
const currStep = 1// XEUtils.toNumber(step || 1) || 1
|
|
131
|
+
switch (type) {
|
|
130
132
|
case 'year': {
|
|
131
133
|
let currDate = XEUtils.getWhatYear(minViewDate, leftSize, 'first')
|
|
132
134
|
const endDate = XEUtils.getWhatYear(maxViewDate, rightSize, 'first')
|
|
133
135
|
while (currDate <= endDate) {
|
|
134
136
|
const itemDate = currDate
|
|
135
137
|
dateList.push(itemDate)
|
|
136
|
-
currDate = XEUtils.getWhatYear(currDate,
|
|
138
|
+
currDate = XEUtils.getWhatYear(currDate, currStep)
|
|
137
139
|
}
|
|
138
140
|
break
|
|
139
141
|
}
|
|
@@ -143,7 +145,7 @@ export default defineVxeComponent({
|
|
|
143
145
|
while (currDate <= endDate) {
|
|
144
146
|
const itemDate = currDate
|
|
145
147
|
dateList.push(itemDate)
|
|
146
|
-
currDate = XEUtils.getWhatQuarter(currDate,
|
|
148
|
+
currDate = XEUtils.getWhatQuarter(currDate, currStep)
|
|
147
149
|
}
|
|
148
150
|
break
|
|
149
151
|
}
|
|
@@ -153,17 +155,17 @@ export default defineVxeComponent({
|
|
|
153
155
|
while (currDate <= endDate) {
|
|
154
156
|
const itemDate = currDate
|
|
155
157
|
dateList.push(itemDate)
|
|
156
|
-
currDate = XEUtils.getWhatMonth(currDate,
|
|
158
|
+
currDate = XEUtils.getWhatMonth(currDate, currStep)
|
|
157
159
|
}
|
|
158
160
|
break
|
|
159
161
|
}
|
|
160
162
|
case 'week': {
|
|
161
|
-
let currDate = XEUtils.getWhatWeek(minViewDate, leftSize,
|
|
162
|
-
const endDate = XEUtils.getWhatWeek(maxViewDate, rightSize,
|
|
163
|
+
let currDate = XEUtils.getWhatWeek(minViewDate, leftSize, startDay, startDay)
|
|
164
|
+
const endDate = XEUtils.getWhatWeek(maxViewDate, rightSize, startDay, startDay)
|
|
163
165
|
while (currDate <= endDate) {
|
|
164
166
|
const itemDate = currDate
|
|
165
167
|
dateList.push(itemDate)
|
|
166
|
-
currDate = XEUtils.getWhatWeek(currDate,
|
|
168
|
+
currDate = XEUtils.getWhatWeek(currDate, currStep)
|
|
167
169
|
}
|
|
168
170
|
break
|
|
169
171
|
}
|
|
@@ -174,14 +176,14 @@ export default defineVxeComponent({
|
|
|
174
176
|
while (currDate <= endDate) {
|
|
175
177
|
const itemDate = currDate
|
|
176
178
|
dateList.push(itemDate)
|
|
177
|
-
currDate = XEUtils.getWhatDay(currDate,
|
|
179
|
+
currDate = XEUtils.getWhatDay(currDate, currStep)
|
|
178
180
|
}
|
|
179
181
|
break
|
|
180
182
|
}
|
|
181
183
|
case 'hour':
|
|
182
184
|
case 'minute':
|
|
183
185
|
case 'second': {
|
|
184
|
-
const gapTime = getStandardGapTime(minScale.type)
|
|
186
|
+
const gapTime = getStandardGapTime(minScale.type) * currStep
|
|
185
187
|
let currTime = minViewDate.getTime() + (leftSize * gapTime)
|
|
186
188
|
const endTime = maxViewDate.getTime() + (rightSize * gapTime)
|
|
187
189
|
while (currTime <= endTime) {
|
|
@@ -261,7 +263,6 @@ export default defineVxeComponent({
|
|
|
261
263
|
minute: [],
|
|
262
264
|
second: []
|
|
263
265
|
}
|
|
264
|
-
|
|
265
266
|
const tempTypeMaps: Record<VxeGanttDefines.ColumnScaleType, Record<string, VxeGanttDefines.ViewColumn>> = {
|
|
266
267
|
year: {},
|
|
267
268
|
quarter: {},
|
|
@@ -273,6 +274,7 @@ export default defineVxeComponent({
|
|
|
273
274
|
minute: {},
|
|
274
275
|
second: {}
|
|
275
276
|
}
|
|
277
|
+
const isMinWeek = minScale.type === 'week'
|
|
276
278
|
|
|
277
279
|
const handleData = (type: VxeGanttDefines.ColumnScaleType, colMaps: Record<VxeGanttDefines.ColumnScaleType, VxeGanttDefines.ViewColumn>, minCol: VxeGanttDefines.ViewColumn) => {
|
|
278
280
|
if (minScale.type === type) {
|
|
@@ -293,15 +295,24 @@ export default defineVxeComponent({
|
|
|
293
295
|
currGpCol.children.push(minCol)
|
|
294
296
|
}
|
|
295
297
|
}
|
|
296
|
-
|
|
297
298
|
for (let i = 0; i < scaleDateList.length; i++) {
|
|
298
299
|
const itemDate = scaleDateList[i]
|
|
299
|
-
|
|
300
|
+
let [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('-')
|
|
300
301
|
const e = itemDate.getDay()
|
|
301
302
|
const E = e + 1
|
|
302
303
|
const q = Math.ceil((itemDate.getMonth() + 1) / 3)
|
|
303
304
|
const W = `${XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined)}`
|
|
304
305
|
const WW = XEUtils.padStart(W, 2, '0')
|
|
306
|
+
let wYear = yyyy
|
|
307
|
+
// 周维度,由于年份和第几周是冲突的行为,所以需要特殊处理,判断是否跨年,例如
|
|
308
|
+
// '2024-12-31' 'yyyy-MM-dd W' >> '2024-12-31 1'
|
|
309
|
+
// '2025-01-01' 'yyyy-MM-dd W' >> '2025-01-01 1'
|
|
310
|
+
if (W === '1' && MM === '12') {
|
|
311
|
+
wYear = `${Number(yyyy) + 1}`
|
|
312
|
+
if (isMinWeek) {
|
|
313
|
+
yyyy = wYear
|
|
314
|
+
}
|
|
315
|
+
}
|
|
305
316
|
const dateObj: VxeGanttDefines.ScaleDateObj = { date: itemDate, yy, yyyy, M, MM, d, dd, H, HH, m, mm, s, ss, q, W, WW, E, e }
|
|
306
317
|
const colMaps: Record<VxeGanttDefines.ColumnScaleType, VxeGanttDefines.ViewColumn> = {
|
|
307
318
|
year: {
|
|
@@ -488,7 +499,7 @@ export default defineVxeComponent({
|
|
|
488
499
|
case 'week': {
|
|
489
500
|
const indexMaps: Record<string, number> = {}
|
|
490
501
|
fullCols.forEach(({ dateObj }, i) => {
|
|
491
|
-
const yyyyW =
|
|
502
|
+
const yyyyW = `${dateObj.yyyy}-${dateObj.W}`
|
|
492
503
|
indexMaps[yyyyW] = i
|
|
493
504
|
})
|
|
494
505
|
return (startValue: any, endValue: any) => {
|
|
@@ -560,7 +560,10 @@ export default defineVxeComponent({
|
|
|
560
560
|
const scaleList = (taskScaleConfs && taskScaleConfs.length ? taskScaleConfs : ['month', 'date'] as VxeGanttDefines.ColumnScaleType[])
|
|
561
561
|
scaleList.forEach(conf => {
|
|
562
562
|
const sConf = !conf || XEUtils.isString(conf) ? { type: conf } : conf
|
|
563
|
-
const { type } = sConf
|
|
563
|
+
const { type, step } = sConf
|
|
564
|
+
if (step) {
|
|
565
|
+
errLog('vxe.error.errProp', [`step=${step}`, 'step=1'])
|
|
566
|
+
}
|
|
564
567
|
if (!type || !viewTypeLevelMaps[type]) {
|
|
565
568
|
errLog('vxe.error.errProp', [`type=${type}`, XEUtils.keys(viewTypeLevelMaps).join(',')])
|
|
566
569
|
return
|