vxe-gantt 3.1.15 → 3.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/lib/ui/index.js CHANGED
@@ -13,7 +13,7 @@ exports.default = void 0;
13
13
  var _core = require("@vxe-ui/core");
14
14
  var setConfig = _core.VxeUI.setConfig,
15
15
  setIcon = _core.VxeUI.setIcon;
16
- _core.VxeUI.ganttVersion = "3.1.15";
16
+ _core.VxeUI.ganttVersion = "3.1.17";
17
17
  var ymdFormat = 'yyyy-MM-dd';
18
18
  var ymdhmsFormat = 'yyyy-MM-dd HH:mm:ss';
19
19
  setConfig({
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"VxeUI",{enumerable:!0,get:function(){return _core.VxeUI}}),exports.default=void 0;var _core=require("@vxe-ui/core"),setConfig=_core.VxeUI.setConfig,setIcon=_core.VxeUI.setIcon,ymdFormat=(_core.VxeUI.ganttVersion="3.1.15","yyyy-MM-dd"),ymdhmsFormat="yyyy-MM-dd HH:mm:ss",iconPrefix=(setConfig({gantt:{formConfig:{enabled:!0},pagerConfig:{enabled:!0},toolbarConfig:{enabled:!0},proxyConfig:{enabled:!0,autoLoad:!0,showLoading:!0,showResponseMsg:!0,showActionMsg:!0,response:{list:null,result:"result",total:"page.total",message:"message"}},taskBarTooltipConfig:{enterable:!0},taskLinkConfig:{enabled:!0,showArrow:!0},taskViewScaleConfig:{year:{valueFormat:ymdFormat},quarter:{valueFormat:ymdFormat},month:{valueFormat:ymdFormat},week:{startDay:1,valueFormat:ymdFormat},day:{valueFormat:ymdFormat},date:{valueFormat:ymdFormat},hour:{valueFormat:ymdhmsFormat},minute:{valueFormat:ymdhmsFormat},second:{valueFormat:ymdhmsFormat}},taskViewConfig:{showNowLine:!0,gridding:{leftSpacing:1,rightSpacing:1}},taskSplitConfig:{enabled:!0,resize:!0,showCollapseTableButton:!0,showCollapseTaskButton:!0}}}),"vxe-icon-"),_default=(setIcon({GANTT_VIEW_LEFT_OPEN:iconPrefix+"arrow-left",GANTT_VIEW_LEFT_CLOSE:iconPrefix+"arrow-right",GANTT_VIEW_RIGHT_OPEN:iconPrefix+"arrow-right",GANTT_VIEW_RIGHT_CLOSE:iconPrefix+"arrow-left",GANTT_VIEW_TASK_MILESTONE:iconPrefix+"square-fill rotate45"}),exports.default=_core.VxeUI);
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"VxeUI",{enumerable:!0,get:function(){return _core.VxeUI}}),exports.default=void 0;var _core=require("@vxe-ui/core"),setConfig=_core.VxeUI.setConfig,setIcon=_core.VxeUI.setIcon,ymdFormat=(_core.VxeUI.ganttVersion="3.1.17","yyyy-MM-dd"),ymdhmsFormat="yyyy-MM-dd HH:mm:ss",iconPrefix=(setConfig({gantt:{formConfig:{enabled:!0},pagerConfig:{enabled:!0},toolbarConfig:{enabled:!0},proxyConfig:{enabled:!0,autoLoad:!0,showLoading:!0,showResponseMsg:!0,showActionMsg:!0,response:{list:null,result:"result",total:"page.total",message:"message"}},taskBarTooltipConfig:{enterable:!0},taskLinkConfig:{enabled:!0,showArrow:!0},taskViewScaleConfig:{year:{valueFormat:ymdFormat},quarter:{valueFormat:ymdFormat},month:{valueFormat:ymdFormat},week:{startDay:1,valueFormat:ymdFormat},day:{valueFormat:ymdFormat},date:{valueFormat:ymdFormat},hour:{valueFormat:ymdhmsFormat},minute:{valueFormat:ymdhmsFormat},second:{valueFormat:ymdhmsFormat}},taskViewConfig:{showNowLine:!0,gridding:{leftSpacing:1,rightSpacing:1}},taskSplitConfig:{enabled:!0,resize:!0,showCollapseTableButton:!0,showCollapseTaskButton:!0}}}),"vxe-icon-"),_default=(setIcon({GANTT_VIEW_LEFT_OPEN:iconPrefix+"arrow-left",GANTT_VIEW_LEFT_CLOSE:iconPrefix+"arrow-right",GANTT_VIEW_RIGHT_OPEN:iconPrefix+"arrow-right",GANTT_VIEW_RIGHT_CLOSE:iconPrefix+"arrow-left",GANTT_VIEW_TASK_MILESTONE:iconPrefix+"square-fill rotate45"}),exports.default=_core.VxeUI);
package/lib/ui/src/log.js CHANGED
@@ -6,6 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.warnLog = exports.errLog = void 0;
7
7
  var _core = require("@vxe-ui/core");
8
8
  var log = _core.VxeUI.log;
9
- var version = "gantt v".concat("3.1.15");
9
+ var version = "gantt v".concat("3.1.17");
10
10
  var warnLog = exports.warnLog = log.create('warn', version);
11
11
  var errLog = exports.errLog = log.create('error', version);
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.warnLog=exports.errLog=void 0;var _core=require("@vxe-ui/core"),log=_core.VxeUI.log,version="gantt v".concat("3.1.15"),warnLog=exports.warnLog=log.create("warn",version),errLog=exports.errLog=log.create("error",version);
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.warnLog=exports.errLog=void 0;var _core=require("@vxe-ui/core"),log=_core.VxeUI.log,version="gantt v".concat("3.1.17"),warnLog=exports.warnLog=log.create("warn",version),errLog=exports.errLog=log.create("error",version);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vxe-gantt",
3
- "version": "3.1.15",
3
+ "version": "3.1.17",
4
4
  "description": "A vue based gantt component",
5
5
  "scripts": {
6
6
  "update": "npm install --legacy-peer-deps",
@@ -60,7 +60,7 @@
60
60
  "vue": "~2.6.14",
61
61
  "vue-i18n": "^8.15.1",
62
62
  "vue-router": "^3.5.1",
63
- "vxe-pc-ui": "^3.11.17",
63
+ "vxe-pc-ui": "^3.11.18",
64
64
  "vxe-table": "^3.19.33"
65
65
  },
66
66
  "vetur": {
@@ -102,7 +102,6 @@ function handleColumnHeader ($xeGanttView: VxeGanttViewConstructor & VxeGanttVie
102
102
  minute: [],
103
103
  second: []
104
104
  }
105
-
106
105
  const tempTypeMaps: Record<VxeGanttDefines.ColumnScaleType, Record<string, VxeGanttDefines.ViewColumn>> = {
107
106
  year: {},
108
107
  quarter: {},
@@ -114,6 +113,7 @@ function handleColumnHeader ($xeGanttView: VxeGanttViewConstructor & VxeGanttVie
114
113
  minute: {},
115
114
  second: {}
116
115
  }
116
+ const isMinWeek = minScale.type === 'week'
117
117
 
118
118
  const handleData = (type: VxeGanttDefines.ColumnScaleType, colMaps: Record<VxeGanttDefines.ColumnScaleType, VxeGanttDefines.ViewColumn>, minCol: VxeGanttDefines.ViewColumn) => {
119
119
  if (minScale.type === type) {
@@ -137,12 +137,22 @@ function handleColumnHeader ($xeGanttView: VxeGanttViewConstructor & VxeGanttVie
137
137
 
138
138
  for (let i = 0; i < scaleDateList.length; i++) {
139
139
  const itemDate = scaleDateList[i]
140
- 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('-')
140
+ 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('-')
141
141
  const e = itemDate.getDay()
142
142
  const E = e + 1
143
143
  const q = Math.ceil((itemDate.getMonth() + 1) / 3)
144
144
  const W = `${XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined)}`
145
145
  const WW = XEUtils.padStart(W, 2, '0')
146
+ let wYear = yyyy
147
+ // 周维度,由于年份和第几周是冲突的行为,所以需要特殊处理,判断是否跨年,例如
148
+ // '2024-12-31' 'yyyy-MM-dd W' >> '2024-12-31 1'
149
+ // '2025-01-01' 'yyyy-MM-dd W' >> '2025-01-01 1'
150
+ if (W === '1' && MM === '12') {
151
+ wYear = `${Number(yyyy) + 1}`
152
+ if (isMinWeek) {
153
+ yyyy = wYear
154
+ }
155
+ }
146
156
  const dateObj: VxeGanttDefines.ScaleDateObj = { date: itemDate, yy, yyyy, M, MM, d, dd, H, HH, m, mm, s, ss, q, W, WW, E, e }
147
157
  const colMaps: Record<VxeGanttDefines.ColumnScaleType, VxeGanttDefines.ViewColumn> = {
148
158
  year: {
@@ -161,7 +171,7 @@ function handleColumnHeader ($xeGanttView: VxeGanttViewConstructor & VxeGanttVie
161
171
  dateObj
162
172
  },
163
173
  week: {
164
- field: `${yyyy}_W${W}`,
174
+ field: `${wYear}_W${W}`,
165
175
  title: `${W}`,
166
176
  dateObj
167
177
  },
@@ -279,7 +289,7 @@ function createChartRender ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
279
289
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
280
290
  return {
281
291
  offsetLeftSize,
282
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
292
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
283
293
  }
284
294
  }
285
295
  }
@@ -302,7 +312,7 @@ function createChartRender ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
302
312
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
303
313
  return {
304
314
  offsetLeftSize,
305
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
315
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
306
316
  }
307
317
  }
308
318
  }
@@ -325,14 +335,14 @@ function createChartRender ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
325
335
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
326
336
  return {
327
337
  offsetLeftSize,
328
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
338
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
329
339
  }
330
340
  }
331
341
  }
332
342
  case 'week': {
333
343
  const indexMaps: Record<string, number> = {}
334
344
  fullCols.forEach(({ dateObj }, i) => {
335
- const yyyyW = XEUtils.toDateString(dateObj.date, 'yyyy-W', { firstDay: weekScale ? weekScale.startDay : undefined })
345
+ const yyyyW = `${dateObj.yyyy}-${dateObj.W}`
336
346
  indexMaps[yyyyW] = i
337
347
  })
338
348
  return (startValue: any, endValue: any) => {
@@ -348,7 +358,7 @@ function createChartRender ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
348
358
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
349
359
  return {
350
360
  offsetLeftSize,
351
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
361
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
352
362
  }
353
363
  }
354
364
  }
@@ -395,7 +405,7 @@ function createChartRender ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
395
405
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
396
406
  return {
397
407
  offsetLeftSize,
398
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
408
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
399
409
  }
400
410
  }
401
411
  }
@@ -418,7 +428,7 @@ function createChartRender ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
418
428
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
419
429
  return {
420
430
  offsetLeftSize,
421
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
431
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
422
432
  }
423
433
  }
424
434
  }
@@ -431,7 +441,7 @@ function createChartRender ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
431
441
  let offsetWidthSize = 0
432
442
  if (minViewDate) {
433
443
  offsetLeftSize = (startDate.getTime() - minViewDate.getTime()) / gapTime
434
- offsetWidthSize = ((endDate.getTime() - startDate.getTime()) / gapTime) + 1
444
+ offsetWidthSize = ((endDate.getTime() - startDate.getTime()) / gapTime)
435
445
  }
436
446
  return {
437
447
  offsetLeftSize,
@@ -1269,6 +1279,7 @@ export default defineVxeComponent({
1269
1279
  const taskViewOpts = $xeGantt.computeTaskViewOpts
1270
1280
  const minScale = $xeGantt.computeMinScale
1271
1281
  const { gridding } = taskViewOpts
1282
+ const { type, startDay } = minScale
1272
1283
  const dateList: Date[] = []
1273
1284
  if (!minViewDate || !maxViewDate) {
1274
1285
  return dateList
@@ -1276,14 +1287,15 @@ export default defineVxeComponent({
1276
1287
 
1277
1288
  const leftSize = -XEUtils.toNumber(gridding ? gridding.leftSpacing || 0 : 0)
1278
1289
  const rightSize = XEUtils.toNumber(gridding ? gridding.rightSpacing || 0 : 0)
1279
- switch (minScale.type) {
1290
+ const currStep = 1// XEUtils.toNumber(step || 1) || 1
1291
+ switch (type) {
1280
1292
  case 'year': {
1281
1293
  let currDate = XEUtils.getWhatYear(minViewDate, leftSize, 'first')
1282
1294
  const endDate = XEUtils.getWhatYear(maxViewDate, rightSize, 'first')
1283
1295
  while (currDate <= endDate) {
1284
1296
  const itemDate = currDate
1285
1297
  dateList.push(itemDate)
1286
- currDate = XEUtils.getWhatYear(currDate, 1)
1298
+ currDate = XEUtils.getWhatYear(currDate, currStep)
1287
1299
  }
1288
1300
  break
1289
1301
  }
@@ -1293,7 +1305,7 @@ export default defineVxeComponent({
1293
1305
  while (currDate <= endDate) {
1294
1306
  const itemDate = currDate
1295
1307
  dateList.push(itemDate)
1296
- currDate = XEUtils.getWhatQuarter(currDate, 1)
1308
+ currDate = XEUtils.getWhatQuarter(currDate, currStep)
1297
1309
  }
1298
1310
  break
1299
1311
  }
@@ -1303,17 +1315,17 @@ export default defineVxeComponent({
1303
1315
  while (currDate <= endDate) {
1304
1316
  const itemDate = currDate
1305
1317
  dateList.push(itemDate)
1306
- currDate = XEUtils.getWhatMonth(currDate, 1)
1318
+ currDate = XEUtils.getWhatMonth(currDate, currStep)
1307
1319
  }
1308
1320
  break
1309
1321
  }
1310
1322
  case 'week': {
1311
- let currDate = XEUtils.getWhatWeek(minViewDate, leftSize, minScale.startDay, minScale.startDay)
1312
- const endDate = XEUtils.getWhatWeek(maxViewDate, rightSize, minScale.startDay, minScale.startDay)
1323
+ let currDate = XEUtils.getWhatWeek(minViewDate, leftSize, startDay, startDay)
1324
+ const endDate = XEUtils.getWhatWeek(maxViewDate, rightSize, startDay, startDay)
1313
1325
  while (currDate <= endDate) {
1314
1326
  const itemDate = currDate
1315
1327
  dateList.push(itemDate)
1316
- currDate = XEUtils.getWhatWeek(currDate, 1)
1328
+ currDate = XEUtils.getWhatWeek(currDate, currStep)
1317
1329
  }
1318
1330
  break
1319
1331
  }
@@ -1324,14 +1336,14 @@ export default defineVxeComponent({
1324
1336
  while (currDate <= endDate) {
1325
1337
  const itemDate = currDate
1326
1338
  dateList.push(itemDate)
1327
- currDate = XEUtils.getWhatDay(currDate, 1)
1339
+ currDate = XEUtils.getWhatDay(currDate, currStep)
1328
1340
  }
1329
1341
  break
1330
1342
  }
1331
1343
  case 'hour':
1332
1344
  case 'minute':
1333
1345
  case 'second': {
1334
- const gapTime = getStandardGapTime(minScale.type)
1346
+ const gapTime = getStandardGapTime(minScale.type) * currStep
1335
1347
  let currTime = minViewDate.getTime() + (leftSize * gapTime)
1336
1348
  const endTime = maxViewDate.getTime() + (rightSize * gapTime)
1337
1349
  while (currTime <= endTime) {
@@ -646,7 +646,10 @@ export default /* define-vxe-component start */ defineVxeComponent({
646
646
  const scaleList = (taskScaleConfs && taskScaleConfs.length ? taskScaleConfs : ['month', 'date'] as VxeGanttDefines.ColumnScaleType[])
647
647
  scaleList.forEach(conf => {
648
648
  const sConf = !conf || XEUtils.isString(conf) ? { type: conf } : conf
649
- const { type } = sConf
649
+ const { type, step } = sConf
650
+ if (step) {
651
+ errLog('vxe.error.errProp', [`step=${step}`, 'step=1'])
652
+ }
650
653
  if (!type || !viewTypeLevelMaps[type]) {
651
654
  errLog('vxe.error.errProp', [`type=${type}`, XEUtils.keys(viewTypeLevelMaps).join(',')])
652
655
  return