vxe-gantt 3.1.16 → 3.1.18

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.16";
16
+ _core.VxeUI.ganttVersion = "3.1.18";
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.16","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.18","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.16");
9
+ var version = "gantt v".concat("3.1.18");
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.16"),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.18"),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.16",
3
+ "version": "3.1.18",
4
4
  "description": "A vue based gantt component",
5
5
  "scripts": {
6
6
  "update": "npm install --legacy-peer-deps",
@@ -60,8 +60,8 @@
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",
64
- "vxe-table": "^3.19.33"
63
+ "vxe-pc-ui": "^3.11.20",
64
+ "vxe-table": "^3.19.35"
65
65
  },
66
66
  "vetur": {
67
67
  "tags": "helper/vetur/tags.json",
@@ -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,15 @@ 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
+ if (isMinWeek && checkWeekOfsetYear(W, M)) {
147
+ yyyy = `${Number(yyyy) + 1}`
148
+ }
146
149
  const dateObj: VxeGanttDefines.ScaleDateObj = { date: itemDate, yy, yyyy, M, MM, d, dd, H, HH, m, mm, s, ss, q, W, WW, E, e }
147
150
  const colMaps: Record<VxeGanttDefines.ColumnScaleType, VxeGanttDefines.ViewColumn> = {
148
151
  year: {
@@ -251,6 +254,32 @@ function handleColumnHeader ($xeGanttView: VxeGanttViewConstructor & VxeGanttVie
251
254
  }
252
255
  }
253
256
 
257
+ /**
258
+ * 判断周的年份是否跨年
259
+ */
260
+ function checkWeekOfsetYear (W: number | string, M: number | string) {
261
+ return `${W}` === '1' && `${M}` === '12'
262
+ }
263
+
264
+ /**
265
+ * 周维度,由于年份和第几周是冲突的行为,所以需要特殊处理,判断是否跨年,例如
266
+ * '2024-12-31' 'yyyy-MM-dd W' >> '2024-12-31 1'
267
+ * '2025-01-01' 'yyyy-MM-dd W' >> '2025-01-01 1'
268
+ */
269
+ function parseWeekObj (date: any, firstDay?: 0 | 5 | 1 | 2 | 3 | 4 | 6) {
270
+ const currDate = XEUtils.toStringDate(date)
271
+ let yyyy = currDate.getFullYear()
272
+ const month = currDate.getMonth()
273
+ const weekNum = XEUtils.getYearWeek(currDate, firstDay)
274
+ if (checkWeekOfsetYear(weekNum, month + 1)) {
275
+ yyyy++
276
+ }
277
+ return {
278
+ yyyy,
279
+ W: weekNum
280
+ }
281
+ }
282
+
254
283
  function createChartRender ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivateMethods, fullCols: VxeGanttDefines.ViewColumn[]) {
255
284
  const $xeGantt = $xeGanttView.$xeGantt
256
285
  const reactData = $xeGanttView.reactData
@@ -332,15 +361,17 @@ function createChartRender ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
332
361
  case 'week': {
333
362
  const indexMaps: Record<string, number> = {}
334
363
  fullCols.forEach(({ dateObj }, i) => {
335
- const yyyyW = XEUtils.toDateString(dateObj.date, 'yyyy-W', { firstDay: weekScale ? weekScale.startDay : undefined })
364
+ const yyyyW = `${dateObj.yyyy}-${dateObj.W}`
336
365
  indexMaps[yyyyW] = i
337
366
  })
338
367
  return (startValue: any, endValue: any) => {
339
368
  const startDate = parseStringDate($xeGanttView, startValue)
340
369
  const endDate = parseStringDate($xeGanttView, endValue)
341
- const startStr = XEUtils.toDateString(startDate, 'yyyy-W', { firstDay: weekScale ? weekScale.startDay : undefined })
370
+ const startWeekObj = parseWeekObj(startDate, weekScale ? weekScale.startDay : undefined)
371
+ const startStr = `${startWeekObj.yyyy}-${startWeekObj.W}`
342
372
  const startFirstDate = XEUtils.getWhatWeek(startDate, 0, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined)
343
- const endStr = XEUtils.toDateString(endDate, 'yyyy-W', { firstDay: weekScale ? weekScale.startDay : undefined })
373
+ const endWeekObj = parseWeekObj(endDate, weekScale ? weekScale.startDay : undefined)
374
+ const endStr = `${endWeekObj.yyyy}-${endWeekObj.W}`
344
375
  const endFirstDate = XEUtils.getWhatWeek(endDate, 0, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined)
345
376
  const dateSize = Math.floor((XEUtils.getWhatWeek(endDate, 1, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined).getTime() - endFirstDate.getTime()) / dayMs)
346
377
  const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize
@@ -1269,6 +1300,7 @@ export default defineVxeComponent({
1269
1300
  const taskViewOpts = $xeGantt.computeTaskViewOpts
1270
1301
  const minScale = $xeGantt.computeMinScale
1271
1302
  const { gridding } = taskViewOpts
1303
+ const { type, startDay } = minScale
1272
1304
  const dateList: Date[] = []
1273
1305
  if (!minViewDate || !maxViewDate) {
1274
1306
  return dateList
@@ -1276,14 +1308,15 @@ export default defineVxeComponent({
1276
1308
 
1277
1309
  const leftSize = -XEUtils.toNumber(gridding ? gridding.leftSpacing || 0 : 0)
1278
1310
  const rightSize = XEUtils.toNumber(gridding ? gridding.rightSpacing || 0 : 0)
1279
- switch (minScale.type) {
1311
+ const currStep = 1// XEUtils.toNumber(step || 1) || 1
1312
+ switch (type) {
1280
1313
  case 'year': {
1281
1314
  let currDate = XEUtils.getWhatYear(minViewDate, leftSize, 'first')
1282
1315
  const endDate = XEUtils.getWhatYear(maxViewDate, rightSize, 'first')
1283
1316
  while (currDate <= endDate) {
1284
1317
  const itemDate = currDate
1285
1318
  dateList.push(itemDate)
1286
- currDate = XEUtils.getWhatYear(currDate, 1)
1319
+ currDate = XEUtils.getWhatYear(currDate, currStep)
1287
1320
  }
1288
1321
  break
1289
1322
  }
@@ -1293,7 +1326,7 @@ export default defineVxeComponent({
1293
1326
  while (currDate <= endDate) {
1294
1327
  const itemDate = currDate
1295
1328
  dateList.push(itemDate)
1296
- currDate = XEUtils.getWhatQuarter(currDate, 1)
1329
+ currDate = XEUtils.getWhatQuarter(currDate, currStep)
1297
1330
  }
1298
1331
  break
1299
1332
  }
@@ -1303,17 +1336,17 @@ export default defineVxeComponent({
1303
1336
  while (currDate <= endDate) {
1304
1337
  const itemDate = currDate
1305
1338
  dateList.push(itemDate)
1306
- currDate = XEUtils.getWhatMonth(currDate, 1)
1339
+ currDate = XEUtils.getWhatMonth(currDate, currStep)
1307
1340
  }
1308
1341
  break
1309
1342
  }
1310
1343
  case 'week': {
1311
- let currDate = XEUtils.getWhatWeek(minViewDate, leftSize, minScale.startDay, minScale.startDay)
1312
- const endDate = XEUtils.getWhatWeek(maxViewDate, rightSize, minScale.startDay, minScale.startDay)
1344
+ let currDate = XEUtils.getWhatWeek(minViewDate, leftSize, startDay, startDay)
1345
+ const endDate = XEUtils.getWhatWeek(maxViewDate, rightSize, startDay, startDay)
1313
1346
  while (currDate <= endDate) {
1314
1347
  const itemDate = currDate
1315
1348
  dateList.push(itemDate)
1316
- currDate = XEUtils.getWhatWeek(currDate, 1)
1349
+ currDate = XEUtils.getWhatWeek(currDate, currStep)
1317
1350
  }
1318
1351
  break
1319
1352
  }
@@ -1324,14 +1357,14 @@ export default defineVxeComponent({
1324
1357
  while (currDate <= endDate) {
1325
1358
  const itemDate = currDate
1326
1359
  dateList.push(itemDate)
1327
- currDate = XEUtils.getWhatDay(currDate, 1)
1360
+ currDate = XEUtils.getWhatDay(currDate, currStep)
1328
1361
  }
1329
1362
  break
1330
1363
  }
1331
1364
  case 'hour':
1332
1365
  case 'minute':
1333
1366
  case 'second': {
1334
- const gapTime = getStandardGapTime(minScale.type)
1367
+ const gapTime = getStandardGapTime(minScale.type) * currStep
1335
1368
  let currTime = minViewDate.getTime() + (leftSize * gapTime)
1336
1369
  const endTime = maxViewDate.getTime() + (rightSize * gapTime)
1337
1370
  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