vxe-gantt 3.1.2 → 3.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/lib/ui/index.js CHANGED
@@ -15,7 +15,9 @@ var _log = require("./src/log");
15
15
  var setConfig = _core.VxeUI.setConfig,
16
16
  setIcon = _core.VxeUI.setIcon,
17
17
  checkVersion = _core.VxeUI.checkVersion;
18
- _core.VxeUI.ganttVersion = "3.1.2";
18
+ _core.VxeUI.ganttVersion = "3.1.4";
19
+ var ymdFormat = 'yyyy-MM-dd';
20
+ var ymdhmsFormat = 'yyyy-MM-dd HH:mm:ss';
19
21
  setConfig({
20
22
  gantt: {
21
23
  // size: null,
@@ -58,12 +60,41 @@ setConfig({
58
60
  enterable: true
59
61
  },
60
62
  taskViewScaleConfig: {
63
+ year: {
64
+ valueFormat: ymdFormat
65
+ },
66
+ quarter: {
67
+ valueFormat: ymdFormat
68
+ },
69
+ month: {
70
+ valueFormat: ymdFormat
71
+ },
61
72
  week: {
62
- startDay: 1
73
+ startDay: 1,
74
+ valueFormat: ymdFormat
75
+ },
76
+ day: {
77
+ valueFormat: ymdFormat
78
+ },
79
+ date: {
80
+ valueFormat: ymdFormat
81
+ },
82
+ hour: {
83
+ valueFormat: ymdhmsFormat
84
+ },
85
+ minute: {
86
+ valueFormat: ymdhmsFormat
87
+ },
88
+ second: {
89
+ valueFormat: ymdhmsFormat
63
90
  }
64
91
  },
65
92
  taskViewConfig: {
66
- showNowLine: true
93
+ showNowLine: true,
94
+ gridding: {
95
+ // leftSpacing: 0,
96
+ // rightSpacing: 0
97
+ }
67
98
  },
68
99
  taskSplitConfig: {
69
100
  enabled: true,
@@ -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"),_log=require("./src/log"),setConfig=_core.VxeUI.setConfig,setIcon=_core.VxeUI.setIcon,checkVersion=_core.VxeUI.checkVersion,iconPrefix=(_core.VxeUI.ganttVersion="3.1.2",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},taskViewScaleConfig:{week:{startDay:1}},taskViewConfig:{showNowLine:!0},taskSplitConfig:{enabled:!0,resize:!0,showCollapseTableButton:!0,showCollapseTaskButton:!0}}}),"vxe-icon-"),pVersion=(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"}),3),sVersion=18,_default=(checkVersion?checkVersion(_core.VxeUI.tableVersion,pVersion,sVersion)||(0,_log.errLog)("vxe.error.errorVersion",["vxe-table@".concat(_core.VxeUI.tableVersion||"?"),"vxe-table v".concat(pVersion,".").concat(sVersion,"+")]):(0,_log.errLog)("Requires vxe-table v".concat(pVersion,".").concat(sVersion,"+")),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"),_log=require("./src/log"),setConfig=_core.VxeUI.setConfig,setIcon=_core.VxeUI.setIcon,checkVersion=_core.VxeUI.checkVersion,ymdFormat=(_core.VxeUI.ganttVersion="3.1.4","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},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:{}},taskSplitConfig:{enabled:!0,resize:!0,showCollapseTableButton:!0,showCollapseTaskButton:!0}}}),"vxe-icon-"),pVersion=(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"}),3),sVersion=18,_default=(checkVersion?checkVersion(_core.VxeUI.tableVersion,pVersion,sVersion)||(0,_log.errLog)("vxe.error.errorVersion",["vxe-table@".concat(_core.VxeUI.tableVersion||"?"),"vxe-table v".concat(pVersion,".").concat(sVersion,"+")]):(0,_log.errLog)("Requires vxe-table v".concat(pVersion,".").concat(sVersion,"+")),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.2");
9
+ var version = "gantt v".concat("3.1.4");
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.2"),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.4"),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.2",
3
+ "version": "3.1.4",
4
4
  "description": "A vue based gantt component",
5
5
  "scripts": {
6
6
  "update": "npm install --legacy-peer-deps",
@@ -64,8 +64,8 @@
64
64
  "vue": "~2.6.14",
65
65
  "vue-i18n": "^8.15.1",
66
66
  "vue-router": "^3.5.1",
67
- "vxe-pc-ui": "^3.10.45",
68
- "vxe-table": "^3.19.26"
67
+ "vxe-pc-ui": "^3.10.46",
68
+ "vxe-table": "^3.19.27"
69
69
  },
70
70
  "vetur": {
71
71
  "tags": "helper/vetur/tags.json",
@@ -1,7 +1,7 @@
1
1
  import { VNode, CreateElement } from 'vue'
2
2
  import { defineVxeComponent } from '../../ui/src/comp'
3
3
  import { VxeUI } from '@vxe-ui/core'
4
- import { setScrollTop, setScrollLeft, removeClass, addClass } from '../../ui/src/dom'
4
+ import { setScrollTop, setScrollLeft, removeClass, addClass, hasClass } from '../../ui/src/dom'
5
5
  import { getRefElem, getStandardGapTime } from './util'
6
6
  import XEUtils from 'xe-utils'
7
7
  import GanttViewHeaderComponent from './gantt-header'
@@ -137,12 +137,13 @@ 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 [yyyy, MM, dd, HH, mm, ss] = XEUtils.toDateString(itemDate, 'yyyy-M-d-H-m-s').split('-')
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('-')
141
141
  const e = itemDate.getDay()
142
142
  const E = e + 1
143
143
  const q = Math.ceil((itemDate.getMonth() + 1) / 3)
144
- const W = XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined)
145
- const dateObj: VxeGanttDefines.ScaleDateObj = { date: itemDate, yy: yyyy, M: MM, d: dd, H: HH, m: mm, s: ss, q, W, E, e }
144
+ const W = `${XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined)}`
145
+ const WW = XEUtils.padStart(W, 2, '0')
146
+ const dateObj: VxeGanttDefines.ScaleDateObj = { date: itemDate, yy, yyyy, M, MM, d, dd, H, HH, m, mm, s, ss, q, W, WW, E, e }
146
147
  const colMaps: Record<VxeGanttDefines.ColumnScaleType, VxeGanttDefines.ViewColumn> = {
147
148
  year: {
148
149
  field: yyyy,
@@ -278,7 +279,7 @@ function createChartRender ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
278
279
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
279
280
  return {
280
281
  offsetLeftSize,
281
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
282
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
282
283
  }
283
284
  }
284
285
  }
@@ -301,7 +302,7 @@ function createChartRender ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
301
302
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
302
303
  return {
303
304
  offsetLeftSize,
304
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
305
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
305
306
  }
306
307
  }
307
308
  }
@@ -324,7 +325,7 @@ function createChartRender ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
324
325
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
325
326
  return {
326
327
  offsetLeftSize,
327
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
328
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
328
329
  }
329
330
  }
330
331
  }
@@ -347,7 +348,7 @@ function createChartRender ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
347
348
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
348
349
  return {
349
350
  offsetLeftSize,
350
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
351
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
351
352
  }
352
353
  }
353
354
  }
@@ -371,7 +372,7 @@ function createChartRender ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
371
372
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
372
373
  return {
373
374
  offsetLeftSize,
374
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
375
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
375
376
  }
376
377
  }
377
378
  }
@@ -394,7 +395,7 @@ function createChartRender ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
394
395
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
395
396
  return {
396
397
  offsetLeftSize,
397
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
398
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
398
399
  }
399
400
  }
400
401
  }
@@ -417,7 +418,7 @@ function createChartRender ($xeGanttView: VxeGanttViewConstructor & VxeGanttView
417
418
  const offsetLeftSize = (indexMaps[startStr] || 0) + subtract
418
419
  return {
419
420
  offsetLeftSize,
420
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
421
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + 1
421
422
  }
422
423
  }
423
424
  }
@@ -610,7 +611,7 @@ function updateChart ($xeGanttView: VxeGanttViewConstructor & VxeGanttViewPrivat
610
611
  if (chartWrapper) {
611
612
  XEUtils.arrayEach(chartWrapper.children, (rowEl) => {
612
613
  const barEl = rowEl.children[0] as HTMLDivElement
613
- if (!barEl) {
614
+ if (!barEl || hasClass(barEl, 'is--drag')) {
614
615
  return
615
616
  }
616
617
  const rowid = rowEl.getAttribute('rowid')
@@ -1212,18 +1213,21 @@ export default defineVxeComponent({
1212
1213
  const reactData = $xeGanttView.reactData
1213
1214
 
1214
1215
  const { minViewDate, maxViewDate } = reactData
1216
+ const taskViewOpts = $xeGantt.computeTaskViewOpts
1215
1217
  const minScale = $xeGantt.computeMinScale
1218
+ const { gridding } = taskViewOpts
1216
1219
  const dateList: Date[] = []
1217
1220
  if (!minViewDate || !maxViewDate) {
1218
1221
  return dateList
1219
1222
  }
1220
1223
 
1221
- const startTime = minViewDate.getTime()
1222
- const endTime = maxViewDate.getTime()
1224
+ const leftSize = -XEUtils.toNumber(gridding ? gridding.leftSpacing || 0 : 0)
1225
+ const rightSize = XEUtils.toNumber(gridding ? gridding.rightSpacing || 0 : 0)
1223
1226
  switch (minScale.type) {
1224
1227
  case 'year': {
1225
- let currDate = XEUtils.getWhatYear(minViewDate, 0, 'first')
1226
- while (currDate <= maxViewDate) {
1228
+ let currDate = XEUtils.getWhatYear(minViewDate, leftSize, 'first')
1229
+ const endDate = XEUtils.getWhatYear(maxViewDate, rightSize, 'first')
1230
+ while (currDate <= endDate) {
1227
1231
  const itemDate = currDate
1228
1232
  dateList.push(itemDate)
1229
1233
  currDate = XEUtils.getWhatYear(currDate, 1)
@@ -1231,8 +1235,9 @@ export default defineVxeComponent({
1231
1235
  break
1232
1236
  }
1233
1237
  case 'quarter': {
1234
- let currDate = XEUtils.getWhatQuarter(minViewDate, 0, 'first')
1235
- while (currDate <= maxViewDate) {
1238
+ let currDate = XEUtils.getWhatQuarter(minViewDate, leftSize, 'first')
1239
+ const endDate = XEUtils.getWhatQuarter(maxViewDate, rightSize, 'first')
1240
+ while (currDate <= endDate) {
1236
1241
  const itemDate = currDate
1237
1242
  dateList.push(itemDate)
1238
1243
  currDate = XEUtils.getWhatQuarter(currDate, 1)
@@ -1240,8 +1245,9 @@ export default defineVxeComponent({
1240
1245
  break
1241
1246
  }
1242
1247
  case 'month': {
1243
- let currDate = XEUtils.getWhatMonth(minViewDate, 0, 'first')
1244
- while (currDate <= maxViewDate) {
1248
+ let currDate = XEUtils.getWhatMonth(minViewDate, leftSize, 'first')
1249
+ const endDate = XEUtils.getWhatMonth(maxViewDate, rightSize, 'first')
1250
+ while (currDate <= endDate) {
1245
1251
  const itemDate = currDate
1246
1252
  dateList.push(itemDate)
1247
1253
  currDate = XEUtils.getWhatMonth(currDate, 1)
@@ -1249,8 +1255,9 @@ export default defineVxeComponent({
1249
1255
  break
1250
1256
  }
1251
1257
  case 'week': {
1252
- let currDate = XEUtils.getWhatWeek(minViewDate, 0, minScale.startDay, minScale.startDay)
1253
- while (currDate <= maxViewDate) {
1258
+ let currDate = XEUtils.getWhatWeek(minViewDate, leftSize, minScale.startDay, minScale.startDay)
1259
+ const endDate = XEUtils.getWhatWeek(maxViewDate, rightSize, minScale.startDay, minScale.startDay)
1260
+ while (currDate <= endDate) {
1254
1261
  const itemDate = currDate
1255
1262
  dateList.push(itemDate)
1256
1263
  currDate = XEUtils.getWhatWeek(currDate, 1)
@@ -1258,12 +1265,22 @@ export default defineVxeComponent({
1258
1265
  break
1259
1266
  }
1260
1267
  case 'day':
1261
- case 'date':
1268
+ case 'date': {
1269
+ let currDate = XEUtils.getWhatDay(minViewDate, leftSize, 'first')
1270
+ const endDate = XEUtils.getWhatDay(maxViewDate, rightSize, 'first')
1271
+ while (currDate <= endDate) {
1272
+ const itemDate = currDate
1273
+ dateList.push(itemDate)
1274
+ currDate = XEUtils.getWhatDay(currDate, 1)
1275
+ }
1276
+ break
1277
+ }
1262
1278
  case 'hour':
1263
1279
  case 'minute':
1264
1280
  case 'second': {
1265
1281
  const gapTime = getStandardGapTime(minScale.type)
1266
- let currTime = startTime
1282
+ let currTime = minViewDate.getTime() + (leftSize * gapTime)
1283
+ const endTime = maxViewDate.getTime() + (rightSize * gapTime)
1267
1284
  while (currTime <= endTime) {
1268
1285
  const itemDate = new Date(currTime)
1269
1286
  dateList.push(itemDate)
@@ -78,7 +78,8 @@ function createInternalData (): GanttInternalData {
78
78
  return {
79
79
  uFoot: false,
80
80
  resizeTableWidth: 0
81
- // barTipTimeout: undefined
81
+ // barTipTimeout: null
82
+ // dragBarRow: null
82
83
  }
83
84
  }
84
85
 
@@ -593,31 +594,24 @@ export default /* define-vxe-component start */ defineVxeComponent({
593
594
  const taskScaleConfs = $xeGantt.computeTaskViewScales
594
595
  const taskViewScaleOpts = $xeGantt.computeTaskViewScaleOpts
595
596
  const scaleConfs: VxeGanttDefines.ColumnScaleObj[] = []
596
- if (taskScaleConfs) {
597
- const keyMaps: Record<string, boolean> = {}
598
- taskScaleConfs.forEach(conf => {
599
- const sConf = !conf || XEUtils.isString(conf) ? { type: conf } : conf
600
- const { type } = sConf
601
- if (!type || !viewTypeLevelMaps[type]) {
602
- errLog('vxe.error.errProp', [`type=${type}`, XEUtils.keys(viewTypeLevelMaps).join(',')])
603
- return
604
- }
605
- if (keyMaps[type]) {
606
- errLog('vxe.error.repeatProp', ['type', type])
607
- return
608
- }
609
- keyMaps[type] = true
610
- scaleConfs.push(Object.assign({}, type ? taskViewScaleOpts[type] || {} : {}, sConf, {
611
- level: getViewTypeLevel(type)
612
- }))
613
- })
614
- }
615
- if (!scaleConfs.length) {
616
- scaleConfs.push(
617
- { type: 'month', level: viewTypeLevelMaps.month },
618
- { type: 'date', level: viewTypeLevelMaps.date }
619
- )
620
- }
597
+ const keyMaps: Record<string, boolean> = {}
598
+ const scaleList = (taskScaleConfs && taskScaleConfs.length ? taskScaleConfs : ['month', 'date'] as VxeGanttDefines.ColumnScaleType[])
599
+ scaleList.forEach(conf => {
600
+ const sConf = !conf || XEUtils.isString(conf) ? { type: conf } : conf
601
+ const { type } = sConf
602
+ if (!type || !viewTypeLevelMaps[type]) {
603
+ errLog('vxe.error.errProp', [`type=${type}`, XEUtils.keys(viewTypeLevelMaps).join(',')])
604
+ return
605
+ }
606
+ if (keyMaps[type]) {
607
+ errLog('vxe.error.repeatProp', ['type', type])
608
+ return
609
+ }
610
+ keyMaps[type] = true
611
+ scaleConfs.push(Object.assign({}, type ? taskViewScaleOpts[type] || {} : {}, sConf, {
612
+ level: getViewTypeLevel(type)
613
+ }))
614
+ })
621
615
  reactData.taskScaleList = XEUtils.orderBy(scaleConfs, { field: 'level', order: 'desc' })
622
616
  },
623
617
  initToolbar () {
@@ -5,6 +5,9 @@ const { setConfig, setIcon, checkVersion } = VxeUI
5
5
 
6
6
  VxeUI.ganttVersion = process.env.VUE_APP_VXE_VERSION as string
7
7
 
8
+ const ymdFormat = 'yyyy-MM-dd'
9
+ const ymdhmsFormat = 'yyyy-MM-dd HH:mm:ss'
10
+
8
11
  setConfig({
9
12
  gantt: {
10
13
  // size: null,
@@ -47,12 +50,41 @@ setConfig({
47
50
  enterable: true
48
51
  },
49
52
  taskViewScaleConfig: {
53
+ year: {
54
+ valueFormat: ymdFormat
55
+ },
56
+ quarter: {
57
+ valueFormat: ymdFormat
58
+ },
59
+ month: {
60
+ valueFormat: ymdFormat
61
+ },
50
62
  week: {
51
- startDay: 1
63
+ startDay: 1,
64
+ valueFormat: ymdFormat
65
+ },
66
+ day: {
67
+ valueFormat: ymdFormat
68
+ },
69
+ date: {
70
+ valueFormat: ymdFormat
71
+ },
72
+ hour: {
73
+ valueFormat: ymdhmsFormat
74
+ },
75
+ minute: {
76
+ valueFormat: ymdhmsFormat
77
+ },
78
+ second: {
79
+ valueFormat: ymdhmsFormat
52
80
  }
53
81
  },
54
82
  taskViewConfig: {
55
- showNowLine: true
83
+ showNowLine: true,
84
+ gridding: {
85
+ // leftSpacing: 0,
86
+ // rightSpacing: 0
87
+ }
56
88
  },
57
89
  taskSplitConfig: {
58
90
  enabled: true,