vxe-gantt 3.1.16 → 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.
@@ -99,6 +99,7 @@ function handleColumnHeader($xeGanttView) {
99
99
  minute: {},
100
100
  second: {}
101
101
  };
102
+ const isMinWeek = minScale.type === 'week';
102
103
  const handleData = (type, colMaps, minCol) => {
103
104
  if (minScale.type === type) {
104
105
  return;
@@ -120,12 +121,22 @@ function handleColumnHeader($xeGanttView) {
120
121
  };
121
122
  for (let i = 0; i < scaleDateList.length; i++) {
122
123
  const itemDate = scaleDateList[i];
123
- 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('-');
124
+ 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('-');
124
125
  const e = itemDate.getDay();
125
126
  const E = e + 1;
126
127
  const q = Math.ceil((itemDate.getMonth() + 1) / 3);
127
128
  const W = `${XEUtils.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined)}`;
128
129
  const WW = XEUtils.padStart(W, 2, '0');
130
+ let wYear = yyyy;
131
+ // 周维度,由于年份和第几周是冲突的行为,所以需要特殊处理,判断是否跨年,例如
132
+ // '2024-12-31' 'yyyy-MM-dd W' >> '2024-12-31 1'
133
+ // '2025-01-01' 'yyyy-MM-dd W' >> '2025-01-01 1'
134
+ if (W === '1' && MM === '12') {
135
+ wYear = `${Number(yyyy) + 1}`;
136
+ if (isMinWeek) {
137
+ yyyy = wYear;
138
+ }
139
+ }
129
140
  const dateObj = { date: itemDate, yy, yyyy, M, MM, d, dd, H, HH, m, mm, s, ss, q, W, WW, E, e };
130
141
  const colMaps = {
131
142
  year: {
@@ -144,7 +155,7 @@ function handleColumnHeader($xeGanttView) {
144
155
  dateObj
145
156
  },
146
157
  week: {
147
- field: `${yyyy}_W${W}`,
158
+ field: `${wYear}_W${W}`,
148
159
  title: `${W}`,
149
160
  dateObj
150
161
  },
@@ -310,7 +321,7 @@ function createChartRender($xeGanttView, fullCols) {
310
321
  case 'week': {
311
322
  const indexMaps = {};
312
323
  fullCols.forEach(({ dateObj }, i) => {
313
- const yyyyW = XEUtils.toDateString(dateObj.date, 'yyyy-W', { firstDay: weekScale ? weekScale.startDay : undefined });
324
+ const yyyyW = `${dateObj.yyyy}-${dateObj.W}`;
314
325
  indexMaps[yyyyW] = i;
315
326
  });
316
327
  return (startValue, endValue) => {
@@ -1168,20 +1179,22 @@ export default defineVxeComponent({
1168
1179
  const taskViewOpts = $xeGantt.computeTaskViewOpts;
1169
1180
  const minScale = $xeGantt.computeMinScale;
1170
1181
  const { gridding } = taskViewOpts;
1182
+ const { type, startDay } = minScale;
1171
1183
  const dateList = [];
1172
1184
  if (!minViewDate || !maxViewDate) {
1173
1185
  return dateList;
1174
1186
  }
1175
1187
  const leftSize = -XEUtils.toNumber(gridding ? gridding.leftSpacing || 0 : 0);
1176
1188
  const rightSize = XEUtils.toNumber(gridding ? gridding.rightSpacing || 0 : 0);
1177
- switch (minScale.type) {
1189
+ const currStep = 1; // XEUtils.toNumber(step || 1) || 1
1190
+ switch (type) {
1178
1191
  case 'year': {
1179
1192
  let currDate = XEUtils.getWhatYear(minViewDate, leftSize, 'first');
1180
1193
  const endDate = XEUtils.getWhatYear(maxViewDate, rightSize, 'first');
1181
1194
  while (currDate <= endDate) {
1182
1195
  const itemDate = currDate;
1183
1196
  dateList.push(itemDate);
1184
- currDate = XEUtils.getWhatYear(currDate, 1);
1197
+ currDate = XEUtils.getWhatYear(currDate, currStep);
1185
1198
  }
1186
1199
  break;
1187
1200
  }
@@ -1191,7 +1204,7 @@ export default defineVxeComponent({
1191
1204
  while (currDate <= endDate) {
1192
1205
  const itemDate = currDate;
1193
1206
  dateList.push(itemDate);
1194
- currDate = XEUtils.getWhatQuarter(currDate, 1);
1207
+ currDate = XEUtils.getWhatQuarter(currDate, currStep);
1195
1208
  }
1196
1209
  break;
1197
1210
  }
@@ -1201,17 +1214,17 @@ export default defineVxeComponent({
1201
1214
  while (currDate <= endDate) {
1202
1215
  const itemDate = currDate;
1203
1216
  dateList.push(itemDate);
1204
- currDate = XEUtils.getWhatMonth(currDate, 1);
1217
+ currDate = XEUtils.getWhatMonth(currDate, currStep);
1205
1218
  }
1206
1219
  break;
1207
1220
  }
1208
1221
  case 'week': {
1209
- let currDate = XEUtils.getWhatWeek(minViewDate, leftSize, minScale.startDay, minScale.startDay);
1210
- const endDate = XEUtils.getWhatWeek(maxViewDate, rightSize, minScale.startDay, minScale.startDay);
1222
+ let currDate = XEUtils.getWhatWeek(minViewDate, leftSize, startDay, startDay);
1223
+ const endDate = XEUtils.getWhatWeek(maxViewDate, rightSize, startDay, startDay);
1211
1224
  while (currDate <= endDate) {
1212
1225
  const itemDate = currDate;
1213
1226
  dateList.push(itemDate);
1214
- currDate = XEUtils.getWhatWeek(currDate, 1);
1227
+ currDate = XEUtils.getWhatWeek(currDate, currStep);
1215
1228
  }
1216
1229
  break;
1217
1230
  }
@@ -1222,14 +1235,14 @@ export default defineVxeComponent({
1222
1235
  while (currDate <= endDate) {
1223
1236
  const itemDate = currDate;
1224
1237
  dateList.push(itemDate);
1225
- currDate = XEUtils.getWhatDay(currDate, 1);
1238
+ currDate = XEUtils.getWhatDay(currDate, currStep);
1226
1239
  }
1227
1240
  break;
1228
1241
  }
1229
1242
  case 'hour':
1230
1243
  case 'minute':
1231
1244
  case 'second': {
1232
- const gapTime = getStandardGapTime(minScale.type);
1245
+ const gapTime = getStandardGapTime(minScale.type) * currStep;
1233
1246
  let currTime = minViewDate.getTime() + (leftSize * gapTime);
1234
1247
  const endTime = maxViewDate.getTime() + (rightSize * gapTime);
1235
1248
  while (currTime <= endTime) {
@@ -528,7 +528,10 @@ export default {
528
528
  const scaleList = (taskScaleConfs && taskScaleConfs.length ? taskScaleConfs : ['month', 'date']);
529
529
  scaleList.forEach(conf => {
530
530
  const sConf = !conf || XEUtils.isString(conf) ? { type: conf } : conf;
531
- const { type } = sConf;
531
+ const { type, step } = sConf;
532
+ if (step) {
533
+ errLog('vxe.error.errProp', [`step=${step}`, 'step=1']);
534
+ }
532
535
  if (!type || !viewTypeLevelMaps[type]) {
533
536
  errLog('vxe.error.errProp', [`type=${type}`, XEUtils.keys(viewTypeLevelMaps).join(',')]);
534
537
  return;
package/es/ui/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { setConfig, setIcon } = VxeUI;
3
- VxeUI.ganttVersion = "3.1.16";
3
+ VxeUI.ganttVersion = "3.1.17";
4
4
  const ymdFormat = 'yyyy-MM-dd';
5
5
  const ymdhmsFormat = 'yyyy-MM-dd HH:mm:ss';
6
6
  setConfig({
package/es/ui/src/log.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { VxeUI } from '@vxe-ui/core';
2
2
  const { log } = VxeUI;
3
- const version = `gantt v${"3.1.16"}`;
3
+ const version = `gantt v${"3.1.17"}`;
4
4
  export const warnLog = log.create('warn', version);
5
5
  export const errLog = log.create('error', version);
@@ -121,6 +121,7 @@ function handleColumnHeader($xeGanttView) {
121
121
  minute: {},
122
122
  second: {}
123
123
  };
124
+ var isMinWeek = minScale.type === 'week';
124
125
  var handleData = function handleData(type, colMaps, minCol) {
125
126
  if (minScale.type === type) {
126
127
  return;
@@ -161,6 +162,16 @@ function handleColumnHeader($xeGanttView) {
161
162
  var q = Math.ceil((itemDate.getMonth() + 1) / 3);
162
163
  var W = "".concat(_xeUtils.default.getYearWeek(itemDate, weekScale ? weekScale.startDay : undefined));
163
164
  var WW = _xeUtils.default.padStart(W, 2, '0');
165
+ var wYear = yyyy;
166
+ // 周维度,由于年份和第几周是冲突的行为,所以需要特殊处理,判断是否跨年,例如
167
+ // '2024-12-31' 'yyyy-MM-dd W' >> '2024-12-31 1'
168
+ // '2025-01-01' 'yyyy-MM-dd W' >> '2025-01-01 1'
169
+ if (W === '1' && MM === '12') {
170
+ wYear = "".concat(Number(yyyy) + 1);
171
+ if (isMinWeek) {
172
+ yyyy = wYear;
173
+ }
174
+ }
164
175
  var dateObj = {
165
176
  date: itemDate,
166
177
  yy: yy,
@@ -198,7 +209,7 @@ function handleColumnHeader($xeGanttView) {
198
209
  dateObj: dateObj
199
210
  },
200
211
  week: {
201
- field: "".concat(yyyy, "_W").concat(W),
212
+ field: "".concat(wYear, "_W").concat(W),
202
213
  title: "".concat(W),
203
214
  dateObj: dateObj
204
215
  },
@@ -372,9 +383,7 @@ function createChartRender($xeGanttView, fullCols) {
372
383
  var _indexMaps3 = {};
373
384
  fullCols.forEach(function (_ref4, i) {
374
385
  var dateObj = _ref4.dateObj;
375
- var yyyyW = _xeUtils.default.toDateString(dateObj.date, 'yyyy-W', {
376
- firstDay: weekScale ? weekScale.startDay : undefined
377
- });
386
+ var yyyyW = "".concat(dateObj.yyyy, "-").concat(dateObj.W);
378
387
  _indexMaps3[yyyyW] = i;
379
388
  });
380
389
  return function (startValue, endValue) {
@@ -1276,13 +1285,16 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
1276
1285
  var taskViewOpts = $xeGantt.computeTaskViewOpts;
1277
1286
  var minScale = $xeGantt.computeMinScale;
1278
1287
  var gridding = taskViewOpts.gridding;
1288
+ var type = minScale.type,
1289
+ startDay = minScale.startDay;
1279
1290
  var dateList = [];
1280
1291
  if (!minViewDate || !maxViewDate) {
1281
1292
  return dateList;
1282
1293
  }
1283
1294
  var leftSize = -_xeUtils.default.toNumber(gridding ? gridding.leftSpacing || 0 : 0);
1284
1295
  var rightSize = _xeUtils.default.toNumber(gridding ? gridding.rightSpacing || 0 : 0);
1285
- switch (minScale.type) {
1296
+ var currStep = 1; // XEUtils.toNumber(step || 1) || 1
1297
+ switch (type) {
1286
1298
  case 'year':
1287
1299
  {
1288
1300
  var currDate = _xeUtils.default.getWhatYear(minViewDate, leftSize, 'first');
@@ -1290,7 +1302,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
1290
1302
  while (currDate <= endDate) {
1291
1303
  var itemDate = currDate;
1292
1304
  dateList.push(itemDate);
1293
- currDate = _xeUtils.default.getWhatYear(currDate, 1);
1305
+ currDate = _xeUtils.default.getWhatYear(currDate, currStep);
1294
1306
  }
1295
1307
  break;
1296
1308
  }
@@ -1301,7 +1313,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
1301
1313
  while (_currDate <= _endDate) {
1302
1314
  var _itemDate = _currDate;
1303
1315
  dateList.push(_itemDate);
1304
- _currDate = _xeUtils.default.getWhatQuarter(_currDate, 1);
1316
+ _currDate = _xeUtils.default.getWhatQuarter(_currDate, currStep);
1305
1317
  }
1306
1318
  break;
1307
1319
  }
@@ -1312,18 +1324,18 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
1312
1324
  while (_currDate2 <= _endDate2) {
1313
1325
  var _itemDate2 = _currDate2;
1314
1326
  dateList.push(_itemDate2);
1315
- _currDate2 = _xeUtils.default.getWhatMonth(_currDate2, 1);
1327
+ _currDate2 = _xeUtils.default.getWhatMonth(_currDate2, currStep);
1316
1328
  }
1317
1329
  break;
1318
1330
  }
1319
1331
  case 'week':
1320
1332
  {
1321
- var _currDate3 = _xeUtils.default.getWhatWeek(minViewDate, leftSize, minScale.startDay, minScale.startDay);
1322
- var _endDate3 = _xeUtils.default.getWhatWeek(maxViewDate, rightSize, minScale.startDay, minScale.startDay);
1333
+ var _currDate3 = _xeUtils.default.getWhatWeek(minViewDate, leftSize, startDay, startDay);
1334
+ var _endDate3 = _xeUtils.default.getWhatWeek(maxViewDate, rightSize, startDay, startDay);
1323
1335
  while (_currDate3 <= _endDate3) {
1324
1336
  var _itemDate3 = _currDate3;
1325
1337
  dateList.push(_itemDate3);
1326
- _currDate3 = _xeUtils.default.getWhatWeek(_currDate3, 1);
1338
+ _currDate3 = _xeUtils.default.getWhatWeek(_currDate3, currStep);
1327
1339
  }
1328
1340
  break;
1329
1341
  }
@@ -1335,7 +1347,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
1335
1347
  while (_currDate4 <= _endDate4) {
1336
1348
  var _itemDate4 = _currDate4;
1337
1349
  dateList.push(_itemDate4);
1338
- _currDate4 = _xeUtils.default.getWhatDay(_currDate4, 1);
1350
+ _currDate4 = _xeUtils.default.getWhatDay(_currDate4, currStep);
1339
1351
  }
1340
1352
  break;
1341
1353
  }
@@ -1343,7 +1355,7 @@ var _default = exports.default = (0, _comp.defineVxeComponent)({
1343
1355
  case 'minute':
1344
1356
  case 'second':
1345
1357
  {
1346
- var gapTime = (0, _util.getStandardGapTime)(minScale.type);
1358
+ var gapTime = (0, _util.getStandardGapTime)(minScale.type) * currStep;
1347
1359
  var currTime = minViewDate.getTime() + leftSize * gapTime;
1348
1360
  var endTime = maxViewDate.getTime() + rightSize * gapTime;
1349
1361
  while (currTime <= endTime) {
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _comp=require("../../ui/src/comp"),_core=require("@vxe-ui/core"),_dom=require("../../ui/src/dom"),_util=require("./util"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ganttHeader=_interopRequireDefault(require("./gantt-header")),_ganttBody=_interopRequireDefault(require("./gantt-body")),_ganttFooter=_interopRequireDefault(require("./gantt-footer"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var a;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(a="Object"===(a={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:a)||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,l=Array(t);a<t;a++)l[a]=e[a];return l}function _iterableToArrayLimit(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var l,r,i,n,o=[],c=!0,s=!1;try{if(i=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;c=!1}else for(;!(c=(l=i.call(a)).done)&&(o.push(l.value),o.length!==t);c=!0);}catch(e){s=!0,r=e}finally{try{if(!c&&null!=a.return&&(n=a.return(),Object(n)!==n))return}finally{if(s)throw r}}return o}}function _arrayWithHoles(e){if(Array.isArray(e))return e}var globalEvents=_core.VxeUI.globalEvents,sourceType="gantt",minuteMs=6e4,dayMs=60*minuteMs*24;function createInternalData(){return{xeTable:null,visibleColumn:[],startMaps:{},endMaps:{},chartMaps:{},todayDateMaps:{},elemStore:{},scrollXStore:{preloadSize:0,offsetSize:0,visibleSize:0,visibleStartIndex:0,visibleEndIndex:0,startIndex:0,endIndex:0},lastScrollTop:0,lastScrollLeft:0}}var maxYHeight=5e6;function parseStringDate(e,t){e=e.$xeGantt.computeTaskOpts.dateFormat;return _xeUtils.default.toStringDate(t,e||null)}function updateTodayData(e){var t=e.$xeGantt,e=e.internalData,t=t.reactData.taskScaleList.find(function(e){return"week"===e.type}),a=new Date,l=_slicedToArray(_xeUtils.default.toDateString(a,"yyyy-M-d-H-m-s").split("-"),6),r=l[0],i=l[1],n=l[2],o=l[3],c=l[4],l=l[5],s=a.getDay()+1,d=Math.ceil((a.getMonth()+1)/3),a=_xeUtils.default.getYearWeek(a,t?t.startDay:void 0);e.todayDateMaps={year:r,quarter:"".concat(r,"_q").concat(d),month:"".concat(r,"_").concat(i),week:"".concat(r,"_W").concat(a),day:"".concat(r,"_").concat(i,"_").concat(n,"_E").concat(s),date:"".concat(r,"_").concat(i,"_").concat(n),hour:"".concat(r,"_").concat(i,"_").concat(n,"_").concat(o),minute:"".concat(r,"_").concat(i,"_").concat(n,"_").concat(o,"_").concat(c),second:"".concat(r,"_").concat(i,"_").concat(n,"_").concat(o,"_").concat(c,"_").concat(l)}}function handleColumnHeader(e){var t=e.$xeGantt,a=t.reactData.taskScaleList,i=t.computeMinScale,l=t.computeWeekScale,r=e.computeScaleDateList,n=[],o=[];if(i&&t.computeScaleUnit&&r.length){for(var c={year:[],quarter:[],month:[],week:[],day:[],date:[],hour:[],minute:[],second:[]},s={year:{},quarter:{},month:{},week:{},day:{},date:{},hour:{},minute:{},second:{}},d=function(e,t,a){var l,r;i.type!==e&&(t=t[e],l="".concat(t.field),(r=s[e][l])||(s[e][l]=r=t,c[e].push(r)),r)&&(r.children||(r.children=[]),r.children.push(a))},u=0;u<r.length;u++){var f=r[u],h=_slicedToArray(_xeUtils.default.toDateString(f,"yy-yyyy-M-MM-d-dd-H-HH-m-mm-s-ss").split("-"),12),m=h[0],y=h[1],g=h[2],p=h[3],S=h[4],x=h[5],v=h[6],_=h[7],D=h[8],T=h[9],b=h[10],h=h[11],w=f.getDay(),M=w+1,E=Math.ceil((f.getMonth()+1)/3),U="".concat(_xeUtils.default.getYearWeek(f,l?l.startDay:void 0)),f={date:f,yy:m,yyyy:y,M:g,MM:p,d:S,dd:x,H:v,HH:_,m:D,mm:T,s:b,ss:h,q:E,W:U,WW:_xeUtils.default.padStart(U,2,"0"),E:M,e:w},m={year:{field:y,title:y,dateObj:f},quarter:{field:"".concat(y,"_q").concat(E),title:"".concat(E),dateObj:f},month:{field:"".concat(y,"_").concat(p),title:p,dateObj:f},week:{field:"".concat(y,"_W").concat(U),title:"".concat(U),dateObj:f},day:{field:"".concat(y,"_").concat(p,"_").concat(x,"_E").concat(M),title:"".concat(M),dateObj:f},date:{field:"".concat(y,"_").concat(p,"_").concat(x),title:x,dateObj:f},hour:{field:"".concat(y,"_").concat(p,"_").concat(x,"_").concat(_),title:_,dateObj:f},minute:{field:"".concat(y,"_").concat(p,"_").concat(x,"_").concat(_,"_").concat(T),title:T,dateObj:f},second:{field:"".concat(y,"_").concat(p,"_").concat(x,"_").concat(_,"_").concat(T,"_").concat(h),title:h,dateObj:f}},g=m[i.type];i.level<19&&d("year",m,g),i.level<17&&d("quarter",m,g),i.level<15&&d("month",m,g),i.level<13&&d("week",m,g),i.level<11&&d("day",m,g),i.level<9&&d("date",m,g),i.level<7&&d("hour",m,g),i.level<5&&d("minute",m,g),i.level<3&&d("second",m,g),n.push(g)}a.forEach(function(e){var t;e.type===i.type?o.push({scaleItem:e,columns:n}):((t=c[e.type]||[])&&t.forEach(function(e){e.childCount=e.children?e.children.length:0,e.children=void 0}),o.push({scaleItem:e,columns:t}))})}return{fullCols:n,groupCols:o}}function createChartRender(o,e){var t=o.$xeGantt,r=o.reactData.minViewDate,a=t.computeMinScale,c=t.computeWeekScale;switch(t.computeScaleUnit){case"year":var s={};return e.forEach(function(e,t){e=e.dateObj,e=_xeUtils.default.toDateString(e.date,"yyyy");s[e]=t}),function(e,t){var e=parseStringDate(o,e),t=parseStringDate(o,t),a=_xeUtils.default.toDateString(e,"yyyy"),l=_xeUtils.default.getWhatYear(e,0,"first"),r=_xeUtils.default.toDateString(t,"yyyy"),i=_xeUtils.default.getWhatYear(t,0,"first"),n=Math.floor((_xeUtils.default.getWhatYear(t,1,"first").getTime()-i.getTime())/dayMs),e=(e.getTime()-l.getTime())/dayMs/n,l=Math.max(0,(t.getTime()-i.getTime())/dayMs+1)/n,t=(s[a]||0)+e;return{offsetLeftSize:t,offsetWidthSize:(s[r]||0)-t+l}};case"quarter":var d={};return e.forEach(function(e,t){e=e.dateObj,e=_xeUtils.default.toDateString(e.date,"yyyy-q");d[e]=t}),function(e,t){var e=parseStringDate(o,e),t=parseStringDate(o,t),a=_xeUtils.default.toDateString(e,"yyyy-q"),l=_xeUtils.default.getWhatQuarter(e,0,"first"),r=_xeUtils.default.toDateString(t,"yyyy-q"),i=_xeUtils.default.getWhatQuarter(t,0,"first"),n=Math.floor((_xeUtils.default.getWhatQuarter(t,1,"first").getTime()-i.getTime())/dayMs),e=(e.getTime()-l.getTime())/dayMs/n,l=Math.max(0,(t.getTime()-i.getTime())/dayMs+1)/n,t=(d[a]||0)+e;return{offsetLeftSize:t,offsetWidthSize:(d[r]||0)-t+l}};case"month":var u={};return e.forEach(function(e,t){e=e.dateObj,e=_xeUtils.default.toDateString(e.date,"yyyy-MM");u[e]=t}),function(e,t){var e=parseStringDate(o,e),t=parseStringDate(o,t),a=_xeUtils.default.toDateString(e,"yyyy-MM"),l=_xeUtils.default.getWhatMonth(e,0,"first"),r=_xeUtils.default.toDateString(t,"yyyy-MM"),i=_xeUtils.default.getWhatMonth(t,0,"first"),n=Math.floor((_xeUtils.default.getWhatMonth(t,1,"first").getTime()-i.getTime())/dayMs),e=(e.getTime()-l.getTime())/dayMs/n,l=Math.max(0,(t.getTime()-i.getTime())/dayMs+1)/n,t=(u[a]||0)+e;return{offsetLeftSize:t,offsetWidthSize:(u[r]||0)-t+l}};case"week":var f={};return e.forEach(function(e,t){e=e.dateObj,e=_xeUtils.default.toDateString(e.date,"yyyy-W",{firstDay:c?c.startDay:void 0});f[e]=t}),function(e,t){var e=parseStringDate(o,e),t=parseStringDate(o,t),a=_xeUtils.default.toDateString(e,"yyyy-W",{firstDay:c?c.startDay:void 0}),l=_xeUtils.default.getWhatWeek(e,0,c?c.startDay:void 0,c?c.startDay:void 0),r=_xeUtils.default.toDateString(t,"yyyy-W",{firstDay:c?c.startDay:void 0}),i=_xeUtils.default.getWhatWeek(t,0,c?c.startDay:void 0,c?c.startDay:void 0),n=Math.floor((_xeUtils.default.getWhatWeek(t,1,c?c.startDay:void 0,c?c.startDay:void 0).getTime()-i.getTime())/dayMs),e=(e.getTime()-l.getTime())/dayMs/n,l=Math.max(0,(t.getTime()-i.getTime())/dayMs+1)/n,t=(f[a]||0)+e;return{offsetLeftSize:t,offsetWidthSize:(f[r]||0)-t+l}};case"day":case"date":var h={};return e.forEach(function(e,t){e=e.dateObj,e=_xeUtils.default.toDateString(e.date,"yyyy-MM-dd");h[e]=t}),function(e,t){var e=parseStringDate(o,e),t=parseStringDate(o,t),a=_xeUtils.default.toDateString(e,"yyyy-MM-dd"),l=_xeUtils.default.getWhatDay(e,0,"first"),r=_xeUtils.default.toDateString(t,"yyyy-MM-dd"),i=_xeUtils.default.getWhatDay(t,0,"first"),n=Math.floor((_xeUtils.default.getWhatDay(t,1,"first").getTime()-i.getTime())/minuteMs),e=(e.getTime()-l.getTime())/minuteMs/n,l=Math.max(0,(t.getTime()-i.getTime())/minuteMs+1)/n,t=(h[a]||0)+e;return{offsetLeftSize:t,offsetWidthSize:(h[r]||0)-t+l+1}};case"hour":var m={};return e.forEach(function(e,t){e=e.dateObj,e=_xeUtils.default.toDateString(e.date,"yyyy-MM-dd HH");m[e]=t}),function(e,t){var e=parseStringDate(o,e),t=parseStringDate(o,t),a=_xeUtils.default.toDateString(e,"yyyy-MM-dd HH"),l=_xeUtils.default.getWhatHours(e,0,"first"),r=_xeUtils.default.toDateString(t,"yyyy-MM-dd HH"),i=_xeUtils.default.getWhatHours(t,0,"first"),n=Math.floor((_xeUtils.default.getWhatHours(t,1,"first").getTime()-i.getTime())/minuteMs),e=(e.getTime()-l.getTime())/minuteMs/n,l=Math.max(0,(t.getTime()-i.getTime())/minuteMs+1)/n,t=(m[a]||0)+e;return{offsetLeftSize:t,offsetWidthSize:(m[r]||0)-t+l}};case"minute":var y={};return e.forEach(function(e,t){e=e.dateObj,e=_xeUtils.default.toDateString(e.date,"yyyy-MM-dd HH:mm");y[e]=t}),function(e,t){var e=parseStringDate(o,e),t=parseStringDate(o,t),a=_xeUtils.default.toDateString(e,"yyyy-MM-dd HH:mm"),l=_xeUtils.default.getWhatMinutes(e,0,"first"),r=_xeUtils.default.toDateString(t,"yyyy-MM-dd HH:mm"),i=_xeUtils.default.getWhatMinutes(t,0,"first"),n=Math.floor((_xeUtils.default.getWhatMinutes(t,1,"first").getTime()-i.getTime())/minuteMs),e=(e.getTime()-l.getTime())/minuteMs/n,l=Math.max(0,(t.getTime()-i.getTime())/minuteMs+1)/n,t=(y[a]||0)+e;return{offsetLeftSize:t,offsetWidthSize:(y[r]||0)-t+l}};case"second":var i=(0,_util.getStandardGapTime)(a.type);return function(e,t){var e=parseStringDate(o,e),t=parseStringDate(o,t),a=0,l=0;return r&&(a=(e.getTime()-r.getTime())/i,l=(t.getTime()-e.getTime())/i),{offsetLeftSize:a,offsetWidthSize:l}}}return function(){return{offsetLeftSize:0,offsetWidthSize:0}}}function handleParseColumn(e){var r,i,n,o,t,a,l,c,s,d,u,f,h=e.$xeGantt,m=e.reactData,y=e.internalData,g=h.treeConfig,p=m.minViewDate,S=m.maxViewDate,x=handleColumnHeader(e),v=x.fullCols,x=x.groupCols;p&&S&&(r=y.xeTable)&&(i=h.computeStartField,n=h.computeEndField,o=h.computeTypeField,p=r.isRowGroupStatus,S=r.afterFullData,h=r.afterTreeFullData,t=r.afterGroupFullData,a=r.computeAggregateOpts,c=(l=r.computeTreeOpts).transform,s=l.children||l.childrenField,d={},u=createChartRender(e,v),f=function(e){var t=r.getRowid(e),a=_xeUtils.default.get(e,i),l=_xeUtils.default.get(e,n);(0,_util.hasMilestoneTask)(_xeUtils.default.get(e,o))&&(l=a=a||l),a&&l&&(l=(a=u(a,l)).offsetLeftSize,d[t]={row:e,rowid:t,oLeftSize:l,oWidthSize:a.offsetWidthSize})},p?(p=a.mapChildrenField)&&_xeUtils.default.eachTree(t,f,{children:p}):g?_xeUtils.default.eachTree(h,f,{children:c?l.mapChildrenField:s}):S.forEach(f),y.chartMaps=d),y.visibleColumn=v,m.headerGroups=x,updateTodayData(e),updateScrollXStatus(e),handleTableColumn(e)}function handleUpdateData(l){var r,i,n,e,t,a,o,c,s,d,u=l.$xeGantt,f=l.reactData,h=l.internalData,m=u.treeConfig,y=h.scrollXStore,g=h.xeTable,p=null,S=null;g&&(r=u.computeStartField,i=u.computeEndField,n=u.computeTypeField,u=g.isRowGroupStatus,e=g.afterFullData,t=g.afterTreeFullData,a=g.computeAggregateOpts,c=(o=g.computeTreeOpts).transform,s=o.children||o.childrenField,d=function(e){var t=_xeUtils.default.get(e,r),a=_xeUtils.default.get(e,i),e=_xeUtils.default.get(e,n),t=t||a;!(0,_util.hasMilestoneTask)(e)&&a||(a=t),t&&(e=parseStringDate(l,t),!p||p.getTime()>e.getTime())&&(p=e),a&&(t=parseStringDate(l,a),!S||S.getTime()<t.getTime())&&(S=t)},u?(u=a.mapChildrenField)&&_xeUtils.default.eachTree(g.afterGroupFullData,d,{children:u}):m?_xeUtils.default.eachTree(t,d,{children:c?o.mapChildrenField:s}):e.forEach(d)),y.startIndex=0,y.endIndex=Math.max(1,y.visibleSize),f.minViewDate=p,f.maxViewDate=S,h.startMaps={},h.endMaps={},handleParseColumn(l)}function calcScrollbar(e){var t=e.$xeGantt,a=e.reactData,l=a.scrollXWidth,r=a.scrollYHeight,i=e.internalData.elemStore,t=t.computeScrollbarOpts,i=(0,_util.getRefElem)(i["main-body-wrapper"]),n=e.$refs.refScrollXHandleElem,e=e.$refs.refScrollYHandleElem;i&&(r=r>i.clientHeight,e&&(a.scrollbarWidth=t.width||e.offsetWidth-e.clientWidth||14),a.overflowY=r,e=l>i.clientWidth,n&&(a.scrollbarHeight=t.height||n.offsetHeight-n.clientHeight||14),a.overflowX=e)}function updateTaskChart(e){var t=e.$xeGantt,a=e.internalData,t=t.internalData,l=a.xeTable,r=t.dragBarRow,i=e.reactData.viewCellWidth,n=a.chartMaps,t=(0,_util.getRefElem)(a.elemStore["main-chart-task-wrapper"]);return t&&l&&_xeUtils.default.arrayEach(t.children,function(e){var t=e.children[0];t&&(e=e.getAttribute("rowid"),r&&l.getRowid(r)===e||(e=e?n[e]:null,t.style.left="".concat((0,_util.getTaskBarLeft)(e,i),"px"),(0,_dom.hasClass)(t,"is--milestone"))||(t.style.width="".concat((0,_util.getTaskBarWidth)(e,i),"px")))}),e.$nextTick()}function updateStyle(e){var t,a,l,r,i,n,o,c,s=e.$xeGantt,d=e.reactData,u=e.internalData,f=d.scrollbarWidth,h=d.scrollbarHeight,m=d.headerGroups,y=d.tableColumn,g=u.elemStore,p=u.visibleColumn,u=u.xeTable,S=e.$refs.refElem;if(S&&s)return r=s.computeScrollbarOpts,n=s.computeScrollbarXToTop,i=e.$refs.refScrollXLeftCornerElem,o=e.$refs.refScrollXRightCornerElem,c=e.$refs.refScrollXVirtualElem,f=f,h=h,l=a=t=0,u&&(t=u.tBodyHeight,a=u.tHeaderHeight,l=u.tFooterHeight),u="visible",(s.computeScrollbarYToLeft||r.y&&!1===r.y.visible)&&(f=0,u="hidden"),(r=(0,_util.getRefElem)(g["main-header-scroll"]))&&(r.style.height="".concat(a,"px"),r.style.setProperty("--vxe-ui-gantt-view-cell-height","".concat(a/m.length,"px"))),(r=(0,_util.getRefElem)(g["main-body-scroll"]))&&(r.style.height="".concat(t,"px")),(m=(0,_util.getRefElem)(g["main-footer-scroll"]))&&(m.style.height="".concat(l,"px")),c&&(c.style.height="".concat(h,"px"),c.style.visibility="visible"),(m=e.$refs.refScrollXWrapperElem)&&(m.style.left=n?"".concat(f,"px"):"",m.style.width="".concat(S.clientWidth-f,"px")),i&&(i.style.width=n?"".concat(f,"px"):"",i.style.display=n&&h?"block":""),o&&(o.style.width=n?"":"".concat(f,"px"),o.style.display=!n&&h?"block":""),(c=e.$refs.refScrollYVirtualElem)&&(c.style.width="".concat(f,"px"),c.style.height="".concat(t+a+l,"px"),c.style.visibility=u),(m=e.$refs.refScrollYTopCornerElem)&&(m.style.height="".concat(a,"px"),m.style.display=a?"block":""),(S=e.$refs.refScrollYWrapperElem)&&(S.style.height="".concat(t,"px"),S.style.top="".concat(a,"px")),(i=e.$refs.refScrollYBottomCornerElem)&&(i.style.height="".concat(l,"px"),i.style.top="".concat(a+t,"px"),i.style.display=l?"block":""),o=40,h=o=(n=e.$refs.refColInfoElem)?n.clientWidth||40:o,p.length&&(h=Math.max(0,o*p.length),r)&&0<(c=(f=r.clientWidth)-h)&&(o+=Math.max(0,c/p.length),h=f),d.viewCellWidth=o,u=(0,_util.getRefElem)(g["main-header-table"]),m=(0,_util.getRefElem)(g["main-body-table"]),S=o*y.length,u&&(u.style.width="".concat(h,"px")),m&&(m.style.width="".concat(S,"px")),d.scrollXWidth=h,Promise.all([updateTaskChart(e),s.handleUpdateTaskLink?s.handleUpdateTaskLink(e):null])}function handleRecalculateStyle(e){var t=e.internalData,a=e.$xeGantt,l=e.$refs.refElem;return t.rceRunTime=Date.now(),l&&l.clientWidth&&a?(calcScrollbar(e),updateStyle(e),computeScrollLoad(e)):e.$nextTick()}function _handleLazyRecalculate(i){var n=i.internalData;return new Promise(function(e){var t=n.rceTimeout,a=n.rceRunTime,l=n.xeTable,r=30;l&&(r=l.computeResizeOpts.refreshDelay||r),!t||(clearTimeout(t),a&&a+(r-5)<Date.now())?e(handleRecalculateStyle(i)):i.$nextTick(function(){e()}),n.rceTimeout=setTimeout(function(){n.rceTimeout=void 0,handleRecalculateStyle(i)},r)})}function computeScrollLoad(l){var r=l.reactData,i=l.internalData;return l.$nextTick().then(function(){var e,t=r.scrollXLoad,a=i.scrollXStore;t?(e=(t=handleVirtualXVisible(l)).toVisibleIndex,t=t.visibleSize,a.preloadSize=1,a.offsetSize=2,a.visibleSize=t,a.endIndex=Math.max(a.startIndex+a.visibleSize+2,a.endIndex),a.visibleStartIndex=Math.max(a.startIndex,e),a.visibleEndIndex=Math.min(a.endIndex,e+t),updateScrollXData(l).then(function(){loadScrollXData(l)})):updateScrollXSpace(l)})}function handleVirtualXVisible(e){var t,a=e.reactData.viewCellWidth,e=e.internalData.elemStore,e=(0,_util.getRefElem)(e["main-body-scroll"]);return e?(t=e.clientWidth,e=e.scrollLeft,e=Math.floor(e/a)-1,t=Math.ceil(t/a)+1,{toVisibleIndex:Math.max(0,e),visibleSize:Math.max(1,t)}):{toVisibleIndex:0,visibleSize:6}}function loadScrollXData(e){var t=e.reactData.isScrollXBig,a=e.internalData.scrollXStore,l=a.preloadSize,r=a.startIndex,i=a.endIndex,n=a.offsetSize,o=handleVirtualXVisible(e),c=o.toVisibleIndex,o=o.visibleSize,t={startIndex:Math.max(0,t?c-1:c-1-n-l),endIndex:t?c+o:c+o+n+l},n=(a.visibleStartIndex=c-1,a.visibleEndIndex=c+o+1,t.startIndex),l=t.endIndex;!(c<=r||i-o-1<=c)||r===n&&i===l||(a.startIndex=n,a.endIndex=l,updateScrollXData(e))}function updateScrollXData(e){return handleTableColumn(e),updateScrollXSpace(e),e.$nextTick()}function updateScrollXStatus(e){return e.reactData.scrollXLoad=!0}function handleTableColumn(e){var t=e.reactData,e=e.internalData,a=t.scrollXLoad,l=e.visibleColumn,e=e.scrollXStore,a=a?l.slice(e.startIndex,e.endIndex):l.slice(0);t.tableColumn=a}function updateScrollXSpace(e){var t=e.reactData,a=e.internalData,l=t.scrollXLoad,r=t.scrollXWidth,i=t.viewCellWidth,n=a.elemStore,a=a.scrollXStore,o=(0,_util.getRefElem)(n["main-body-table"]),a=a.startIndex,c=0,a=(l&&(c=Math.max(0,a*i)),o&&(o.style.transform="translate(".concat(c,"px, ").concat(t.scrollYTop||0,"px)")),["header","body","footer"].forEach(function(e){e=(0,_util.getRefElem)(n["main-".concat(e,"-xSpace")]);e&&(e.style.width=l?"".concat(r,"px"):"")}),e.$refs.refScrollXSpaceElem),i=(a&&(a.style.width="".concat(r,"px")),(0,_util.getRefElem)(n["main-chart-line-wrapper"])),o=i?i.firstElementChild:null;return o&&(o.style.width="".concat(r,"px")),calcScrollbar(e),e.$nextTick()}function triggerScrollXEvent(e){loadScrollXData(e)}function updateScrollYSpace(e){var t=e.reactData,a=e.internalData,l=t.scrollYLoad,r=t.overflowY,i=a.elemStore,a=a.xeTable,n=(0,_util.getRefElem)(i["main-body-scroll"]),o=(0,_util.getRefElem)(i["main-body-table"]),c=0,s=0,d=!1,a=(a&&(c=a.scrollYTop,s=a.scrollYHeight,d=a.isScrollYBig),s),u=c,f=0,n=(n&&(f=n.clientHeight),d&&(u=n&&o&&n.scrollTop+f>=maxYHeight?maxYHeight-o.clientHeight:c/(s-f)*(maxYHeight-f),a=maxYHeight),l&&r||(u=0),(0,_util.getRefElem)(i["main-chart-task-wrapper"])),c=(o&&(o.style.transform="translate(".concat(t.scrollXLeft||0,"px, ").concat(u,"px)")),n&&(n.style.transform="translate(".concat(t.scrollXLeft||0,"px, ").concat(u,"px)")),(0,_util.getRefElem)(i["main-body-ySpace"])),f=(c&&(c.style.height=a?"".concat(a,"px"):""),e.$refs.refScrollYSpaceElem),l=(f&&(f.style.height=a?"".concat(a,"px"):""),(0,_util.getRefElem)(i["main-chart-line-wrapper"])),r=l?l.firstElementChild:null;return r&&(r.style.height=a?"".concat(a,"px"):""),t.scrollYTop=u,t.scrollYHeight=s,t.isScrollYBig=d,calcScrollbar(e),e.$nextTick().then(function(){updateStyle(e)})}function checkLastSyncScroll(e,t,a){var l=e.reactData,r=e.internalData,e=r.lcsTimeout;l.lazScrollLoading=!0,e&&clearTimeout(e),r.lcsTimeout=setTimeout(function(){r.lcsRunTime=Date.now(),r.lcsTimeout=void 0,r.intoRunScroll=!1,r.inVirtualScroll=!1,r.inWheelScroll=!1,r.inHeaderScroll=!1,r.inBodyScroll=!1,r.inFooterScroll=!1,l.lazScrollLoading=!1},200)}function handleScrollData(e,t,a,l,r){var i=e.reactData,n=e.internalData;a&&(n.lastScrollLeft=r),t&&(n.lastScrollTop=l),i.lastScrollTime=Date.now(),checkLastSyncScroll(e,a,t)}function handleScrollEvent(e,t,a,l,r,i){var n,o,c,s,d,u,f,h,m,y,g,p,S=e.$xeGantt,x=e.internalData,v=x.xeTable,_=e.$refs.refScrollXHandleElem,D=e.$refs.refScrollYHandleElem;_&&D&&v&&(n=D.clientHeight,o=_.clientWidth,D=D.scrollHeight,_=_.scrollWidth,d="",m=h=f=u=s=y=c=p=!1,l&&(g=v.computeScrollXThreshold,(y=i<=0)||(s=_-1<=i+o),x.lastScrollLeft<i?(d="right",_-g<=i+o&&(m=!0)):(d="left",i<=g&&(h=!0))),a&&(g=v.computeScrollYThreshold,(p=r<=0)||(c=D-1<=r+n),x.lastScrollTop<r?(d="bottom",D-g<=r+n&&(f=!0)):(d="top",r<=g&&(u=!0))),handleScrollData(e,a,l,r,i),v={source:sourceType,scrollTop:r,scrollLeft:i,bodyHeight:n,bodyWidth:o,scrollHeight:D,scrollWidth:_,isX:l,isY:a,isTop:p,isBottom:c,isLeft:y,isRight:s,direction:d},(f||u||m||h)&&S.dispatchEvent("scroll-boundary",v,t),S.dispatchEvent("scroll",v,t))}function syncTableScrollTop(e,t){var e=e.internalData.xeTable;e&&(e=e.elemStore,e=(0,_util.getRefElem)(e["main-body-scroll"]))&&(e.scrollTop=t)}var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeGanttView",inject:{$xeGantt:{default:null}},provide:function(){return{$xeGanttView:this}},props:{},data:function(){return{xID:_xeUtils.default.uniqueId(),reactData:{scrollXLoad:!1,scrollYLoad:!1,overflowY:!0,overflowX:!0,scrollbarWidth:0,scrollbarHeight:0,lastScrollTime:0,lazScrollLoading:!1,scrollVMLoading:!1,scrollYHeight:0,scrollYTop:0,isScrollYBig:!1,scrollXLeft:0,scrollXWidth:0,isScrollXBig:!1,minViewDate:null,maxViewDate:null,tableData:[],tableColumn:[],headerGroups:[],viewCellWidth:40},internalData:createInternalData()}},computed:Object.assign(Object.assign({},{}),{computeScaleDateList:function(){var e=this.$xeGantt,t=this.reactData,a=t.minViewDate,l=t.maxViewDate,t=e.computeTaskViewOpts,r=e.computeMinScale,e=t.gridding,i=[];if(a&&l){var n=-_xeUtils.default.toNumber(e&&e.leftSpacing||0),o=_xeUtils.default.toNumber(e&&e.rightSpacing||0);switch(r.type){case"year":for(var c=_xeUtils.default.getWhatYear(a,n,"first"),s=_xeUtils.default.getWhatYear(l,o,"first");c<=s;){var d=c;i.push(d),c=_xeUtils.default.getWhatYear(c,1)}break;case"quarter":for(var u=_xeUtils.default.getWhatQuarter(a,n,"first"),f=_xeUtils.default.getWhatQuarter(l,o,"first");u<=f;){var h=u;i.push(h),u=_xeUtils.default.getWhatQuarter(u,1)}break;case"month":for(var m=_xeUtils.default.getWhatMonth(a,n,"first"),y=_xeUtils.default.getWhatMonth(l,o,"first");m<=y;){var g=m;i.push(g),m=_xeUtils.default.getWhatMonth(m,1)}break;case"week":for(var p=_xeUtils.default.getWhatWeek(a,n,r.startDay,r.startDay),S=_xeUtils.default.getWhatWeek(l,o,r.startDay,r.startDay);p<=S;){var x=p;i.push(x),p=_xeUtils.default.getWhatWeek(p,1)}break;case"day":case"date":for(var v=_xeUtils.default.getWhatDay(a,n,"first"),_=_xeUtils.default.getWhatDay(l,o,"first");v<=_;){var D=v;i.push(D),v=_xeUtils.default.getWhatDay(v,1)}break;case"hour":case"minute":case"second":for(var T=(0,_util.getStandardGapTime)(r.type),b=a.getTime()+n*T,w=l.getTime()+o*T;b<=w;){var M=new Date(b);i.push(M),b+=T}}}return i}}),methods:{refreshData:function(){var t=this,a=t.internalData;return handleUpdateData(t),handleRecalculateStyle(t),t.$nextTick().then(function(){var e=a.xeTable;if(handleRecalculateStyle(t),e)return e.recalculate()})},updateViewData:function(){var e=this.reactData,t=this.internalData.xeTable;return t&&(t=t.tableData,e.tableData=t),this.$nextTick()},connectUpdate:function(e){var e=e.$table,t=this.internalData;return e&&(t.xeTable=e),this.$nextTick()},handleUpdateStyle:function(){return updateStyle(this)},handleLazyRecalculate:function(){return _handleLazyRecalculate(this)},handleUpdateCurrentRow:function(e){var t=this.internalData.xeTable,a=this.$refs.refElem;t&&a&&(e?(t.computeRowOpts.isCurrent||t.highlightCurrentRow)&&_xeUtils.default.arrayEach(a.querySelectorAll('[rowid="'.concat(t.getRowid(e),'"]')),function(e){return(0,_dom.addClass)(e,"row--current")}):_xeUtils.default.arrayEach(a.querySelectorAll(".row--current"),function(e){return(0,_dom.removeClass)(e,"row--current")}))},handleUpdateHoverRow:function(e){var t=this.internalData.xeTable,a=this.$refs.refElem;t&&a&&(e?_xeUtils.default.arrayEach(a.querySelectorAll('.vxe-body--row[rowid="'.concat(t.getRowid(e),'"]')),function(e){return(0,_dom.addClass)(e,"row--hover")}):_xeUtils.default.arrayEach(a.querySelectorAll(".vxe-body--row.row--hover"),function(e){return(0,_dom.removeClass)(e,"row--hover")}))},triggerHeaderScrollEvent:function(e){var t,a,l,r=this.internalData,i=r.elemStore;r.inVirtualScroll||r.inBodyScroll||r.inFooterScroll||(t=e.currentTarget,i=(0,_util.getRefElem)(i["main-body-scroll"]),a=this.$refs.refScrollXHandleElem,i&&t&&(l=t.scrollLeft,r.inHeaderScroll=!0,(0,_dom.setScrollLeft)(a,l),(0,_dom.setScrollLeft)(i,l),handleScrollEvent(this,e,!1,!0,t.scrollTop,l)))},triggerBodyScrollEvent:function(e){var t,a,l,r,i,n=this,o=n.reactData,c=n.internalData,o=o.scrollXLoad,s=c.elemStore,d=c.lastScrollLeft,u=c.lastScrollTop;c.inVirtualScroll||c.inHeaderScroll||c.inFooterScroll||(t=e.currentTarget,s=(0,_util.getRefElem)(s["main-header-scroll"]),a=n.$refs.refScrollXHandleElem,l=n.$refs.refScrollYHandleElem,d=(r=t.scrollLeft)!==d,u=(i=t.scrollTop)!==u,c.inBodyScroll=!0,c.scrollRenderType="",u&&((0,_dom.setScrollTop)(l,i),syncTableScrollTop(n,i)),d&&(c.inBodyScroll=!0,(0,_dom.setScrollLeft)(a,r),(0,_dom.setScrollLeft)(s,r),o)&&triggerScrollXEvent(n),handleScrollEvent(n,e,u,d,t.scrollTop,r))},triggerVirtualScrollXEvent:function(e){var t,a,l,r=this.reactData,i=this.internalData,r=r.scrollXLoad,n=i.elemStore;i.inHeaderScroll||i.inBodyScroll||(t=e.currentTarget,a=(0,_util.getRefElem)(n["main-header-scroll"]),n=(0,_util.getRefElem)(n["main-body-scroll"]),t&&(l=t.scrollLeft,i.inVirtualScroll=!0,(0,_dom.setScrollLeft)(a,l),(0,_dom.setScrollLeft)(n,l),r&&triggerScrollXEvent(this),handleScrollEvent(this,e,!1,!0,t.scrollTop,l)))},triggerVirtualScrollYEvent:function(e){var t,a,l=this.internalData,r=l.elemStore;l.inHeaderScroll||l.inBodyScroll||(t=e.currentTarget,r=(0,_util.getRefElem)(r["main-body-scroll"]),t&&(a=t.scrollTop,l.inVirtualScroll=!0,(0,_dom.setScrollTop)(r,a),syncTableScrollTop(this,a),handleScrollEvent(this,e,!0,!1,a,t.scrollLeft)))},handleUpdateSXSpace:function(){return updateScrollXSpace(this)},handleUpdateSYSpace:function(){return updateScrollYSpace(this)},handleUpdateSYStatus:function(e){this.reactData.scrollYLoad=e},handleGlobalResizeEvent:function(){_handleLazyRecalculate(this)},renderScrollX:function(e){return e("div",{key:"vsx",ref:"refScrollXVirtualElem",class:"vxe-gantt-view--scroll-x-virtual"},[e("div",{ref:"refScrollXLeftCornerElem",class:"vxe-gantt-view--scroll-x-left-corner"}),e("div",{ref:"refScrollXWrapperElem",class:"vxe-gantt-view--scroll-x-wrapper"},[e("div",{ref:"refScrollXHandleElem",class:"vxe-gantt-view--scroll-x-handle",on:{scroll:this.triggerVirtualScrollXEvent}},[e("div",{ref:"refScrollXSpaceElem",class:"vxe-gantt-view--scroll-x-space"})]),e("div",{class:"vxe-gantt-view--scroll-x-handle-appearance"})]),e("div",{ref:"refScrollXRightCornerElem",class:"vxe-gantt-view--scroll-x-right-corner"})])},renderScrollY:function(e){return e("div",{ref:"refScrollYVirtualElem",class:"vxe-gantt-view--scroll-y-virtual"},[e("div",{ref:"refScrollYTopCornerElem",class:"vxe-gantt-view--scroll-y-top-corner"}),e("div",{ref:"refScrollYWrapperElem",class:"vxe-gantt-view--scroll-y-wrapper"},[e("div",{ref:"refScrollYHandleElem",class:"vxe-gantt-view--scroll-y-handle",on:{scroll:this.triggerVirtualScrollYEvent}},[e("div",{ref:"refScrollYSpaceElem",class:"vxe-gantt-view--scroll-y-space"})]),e("div",{class:"vxe-gantt-view--scroll-y-handle-appearance"})]),e("div",{ref:"refScrollYBottomCornerElem",class:"vxe-gantt-view--scroll-y-bottom-corner"})])},renderViewport:function(e){return e("div",{class:"vxe-gantt-view--viewport-wrapper"},[e(_ganttHeader.default),e(_ganttBody.default),e(_ganttFooter.default)])},renderBody:function(e){var t=this;return e("div",{class:"vxe-gantt-view--layout-wrapper"},t.$xeGantt.computeScrollbarYToLeft?[t.renderScrollY(e),t.renderViewport(e)]:[t.renderViewport(e),t.renderScrollY(e)])},renderVN:function(e){var t=this,a=t.$xeGantt,l=t.reactData,r=l.overflowX;return e("div",{ref:"refElem",class:["vxe-gantt-view",{"is--scroll-y":l.overflowY,"is--scroll-x":r,"is--virtual-x":l.scrollXLoad,"is--virtual-y":l.scrollYLoad}]},[e("div",{class:"vxe-gantt-view--render-wrapper"},a.computeScrollbarXToTop?[t.renderScrollX(e),t.renderBody(e)]:[t.renderBody(e),t.renderScrollX(e)]),e("div",{class:"vxe-gantt-view--render-vars"},[e("div",{ref:"refColInfoElem",class:"vxe-gantt-view--column-info"})])])}},watch:{"reactData.tableData":function(){handleUpdateData(this)}},mounted:function(){globalEvents.on(this,"resize",this.handleGlobalResizeEvent)},beforeDestroy:function(){var e=this.internalData;globalEvents.off(this,"keydown"),_xeUtils.default.assign(e,createInternalData())},render:function(e){return this.renderVN(e)}});
1
+ Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _comp=require("../../ui/src/comp"),_core=require("@vxe-ui/core"),_dom=require("../../ui/src/dom"),_util=require("./util"),_xeUtils=_interopRequireDefault(require("xe-utils")),_ganttHeader=_interopRequireDefault(require("./gantt-header")),_ganttBody=_interopRequireDefault(require("./gantt-body")),_ganttFooter=_interopRequireDefault(require("./gantt-footer"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){var a;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(a="Object"===(a={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:a)||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,l=Array(t);a<t;a++)l[a]=e[a];return l}function _iterableToArrayLimit(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var l,r,i,n,o=[],c=!0,s=!1;try{if(i=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;c=!1}else for(;!(c=(l=i.call(a)).done)&&(o.push(l.value),o.length!==t);c=!0);}catch(e){s=!0,r=e}finally{try{if(!c&&null!=a.return&&(n=a.return(),Object(n)!==n))return}finally{if(s)throw r}}return o}}function _arrayWithHoles(e){if(Array.isArray(e))return e}var globalEvents=_core.VxeUI.globalEvents,sourceType="gantt",minuteMs=6e4,dayMs=60*minuteMs*24;function createInternalData(){return{xeTable:null,visibleColumn:[],startMaps:{},endMaps:{},chartMaps:{},todayDateMaps:{},elemStore:{},scrollXStore:{preloadSize:0,offsetSize:0,visibleSize:0,visibleStartIndex:0,visibleEndIndex:0,startIndex:0,endIndex:0},lastScrollTop:0,lastScrollLeft:0}}var maxYHeight=5e6;function parseStringDate(e,t){e=e.$xeGantt.computeTaskOpts.dateFormat;return _xeUtils.default.toStringDate(t,e||null)}function updateTodayData(e){var t=e.$xeGantt,e=e.internalData,t=t.reactData.taskScaleList.find(function(e){return"week"===e.type}),a=new Date,l=_slicedToArray(_xeUtils.default.toDateString(a,"yyyy-M-d-H-m-s").split("-"),6),r=l[0],i=l[1],n=l[2],o=l[3],c=l[4],l=l[5],s=a.getDay()+1,d=Math.ceil((a.getMonth()+1)/3),a=_xeUtils.default.getYearWeek(a,t?t.startDay:void 0);e.todayDateMaps={year:r,quarter:"".concat(r,"_q").concat(d),month:"".concat(r,"_").concat(i),week:"".concat(r,"_W").concat(a),day:"".concat(r,"_").concat(i,"_").concat(n,"_E").concat(s),date:"".concat(r,"_").concat(i,"_").concat(n),hour:"".concat(r,"_").concat(i,"_").concat(n,"_").concat(o),minute:"".concat(r,"_").concat(i,"_").concat(n,"_").concat(o,"_").concat(c),second:"".concat(r,"_").concat(i,"_").concat(n,"_").concat(o,"_").concat(c,"_").concat(l)}}function handleColumnHeader(e){var t=e.$xeGantt,a=t.reactData.taskScaleList,i=t.computeMinScale,l=t.computeWeekScale,r=e.computeScaleDateList,n=[],o=[];if(i&&t.computeScaleUnit&&r.length){for(var c={year:[],quarter:[],month:[],week:[],day:[],date:[],hour:[],minute:[],second:[]},s={year:{},quarter:{},month:{},week:{},day:{},date:{},hour:{},minute:{},second:{}},d="week"===i.type,u=function(e,t,a){var l,r;i.type!==e&&(t=t[e],l="".concat(t.field),(r=s[e][l])||(s[e][l]=r=t,c[e].push(r)),r)&&(r.children||(r.children=[]),r.children.push(a))},f=0;f<r.length;f++){var h=r[f],m=_slicedToArray(_xeUtils.default.toDateString(h,"yy-yyyy-M-MM-d-dd-H-HH-m-mm-s-ss").split("-"),12),y=m[0],g=m[1],p=m[2],S=m[3],x=m[4],v=m[5],_=m[6],D=m[7],T=m[8],b=m[9],w=m[10],m=m[11],M=h.getDay(),E=M+1,U=Math.ceil((h.getMonth()+1)/3),W="".concat(_xeUtils.default.getYearWeek(h,l?l.startDay:void 0)),L=_xeUtils.default.padStart(W,2,"0"),H=g,h={date:h,yy:y,yyyy:g="1"===W&&"12"===S&&(H="".concat(Number(g)+1),d)?H:g,M:p,MM:S,d:x,dd:v,H:_,HH:D,m:T,mm:b,s:w,ss:m,q:U,W:W,WW:L,E:E,e:M},y={year:{field:g,title:g,dateObj:h},quarter:{field:"".concat(g,"_q").concat(U),title:"".concat(U),dateObj:h},month:{field:"".concat(g,"_").concat(S),title:S,dateObj:h},week:{field:"".concat(H,"_W").concat(W),title:"".concat(W),dateObj:h},day:{field:"".concat(g,"_").concat(S,"_").concat(v,"_E").concat(E),title:"".concat(E),dateObj:h},date:{field:"".concat(g,"_").concat(S,"_").concat(v),title:v,dateObj:h},hour:{field:"".concat(g,"_").concat(S,"_").concat(v,"_").concat(D),title:D,dateObj:h},minute:{field:"".concat(g,"_").concat(S,"_").concat(v,"_").concat(D,"_").concat(b),title:b,dateObj:h},second:{field:"".concat(g,"_").concat(S,"_").concat(v,"_").concat(D,"_").concat(b,"_").concat(m),title:m,dateObj:h}},p=y[i.type];i.level<19&&u("year",y,p),i.level<17&&u("quarter",y,p),i.level<15&&u("month",y,p),i.level<13&&u("week",y,p),i.level<11&&u("day",y,p),i.level<9&&u("date",y,p),i.level<7&&u("hour",y,p),i.level<5&&u("minute",y,p),i.level<3&&u("second",y,p),n.push(p)}a.forEach(function(e){var t;e.type===i.type?o.push({scaleItem:e,columns:n}):((t=c[e.type]||[])&&t.forEach(function(e){e.childCount=e.children?e.children.length:0,e.children=void 0}),o.push({scaleItem:e,columns:t}))})}return{fullCols:n,groupCols:o}}function createChartRender(o,e){var t=o.$xeGantt,r=o.reactData.minViewDate,a=t.computeMinScale,c=t.computeWeekScale;switch(t.computeScaleUnit){case"year":var s={};return e.forEach(function(e,t){e=e.dateObj,e=_xeUtils.default.toDateString(e.date,"yyyy");s[e]=t}),function(e,t){var e=parseStringDate(o,e),t=parseStringDate(o,t),a=_xeUtils.default.toDateString(e,"yyyy"),l=_xeUtils.default.getWhatYear(e,0,"first"),r=_xeUtils.default.toDateString(t,"yyyy"),i=_xeUtils.default.getWhatYear(t,0,"first"),n=Math.floor((_xeUtils.default.getWhatYear(t,1,"first").getTime()-i.getTime())/dayMs),e=(e.getTime()-l.getTime())/dayMs/n,l=Math.max(0,(t.getTime()-i.getTime())/dayMs+1)/n,t=(s[a]||0)+e;return{offsetLeftSize:t,offsetWidthSize:(s[r]||0)-t+l}};case"quarter":var d={};return e.forEach(function(e,t){e=e.dateObj,e=_xeUtils.default.toDateString(e.date,"yyyy-q");d[e]=t}),function(e,t){var e=parseStringDate(o,e),t=parseStringDate(o,t),a=_xeUtils.default.toDateString(e,"yyyy-q"),l=_xeUtils.default.getWhatQuarter(e,0,"first"),r=_xeUtils.default.toDateString(t,"yyyy-q"),i=_xeUtils.default.getWhatQuarter(t,0,"first"),n=Math.floor((_xeUtils.default.getWhatQuarter(t,1,"first").getTime()-i.getTime())/dayMs),e=(e.getTime()-l.getTime())/dayMs/n,l=Math.max(0,(t.getTime()-i.getTime())/dayMs+1)/n,t=(d[a]||0)+e;return{offsetLeftSize:t,offsetWidthSize:(d[r]||0)-t+l}};case"month":var u={};return e.forEach(function(e,t){e=e.dateObj,e=_xeUtils.default.toDateString(e.date,"yyyy-MM");u[e]=t}),function(e,t){var e=parseStringDate(o,e),t=parseStringDate(o,t),a=_xeUtils.default.toDateString(e,"yyyy-MM"),l=_xeUtils.default.getWhatMonth(e,0,"first"),r=_xeUtils.default.toDateString(t,"yyyy-MM"),i=_xeUtils.default.getWhatMonth(t,0,"first"),n=Math.floor((_xeUtils.default.getWhatMonth(t,1,"first").getTime()-i.getTime())/dayMs),e=(e.getTime()-l.getTime())/dayMs/n,l=Math.max(0,(t.getTime()-i.getTime())/dayMs+1)/n,t=(u[a]||0)+e;return{offsetLeftSize:t,offsetWidthSize:(u[r]||0)-t+l}};case"week":var f={};return e.forEach(function(e,t){e=e.dateObj,e="".concat(e.yyyy,"-").concat(e.W);f[e]=t}),function(e,t){var e=parseStringDate(o,e),t=parseStringDate(o,t),a=_xeUtils.default.toDateString(e,"yyyy-W",{firstDay:c?c.startDay:void 0}),l=_xeUtils.default.getWhatWeek(e,0,c?c.startDay:void 0,c?c.startDay:void 0),r=_xeUtils.default.toDateString(t,"yyyy-W",{firstDay:c?c.startDay:void 0}),i=_xeUtils.default.getWhatWeek(t,0,c?c.startDay:void 0,c?c.startDay:void 0),n=Math.floor((_xeUtils.default.getWhatWeek(t,1,c?c.startDay:void 0,c?c.startDay:void 0).getTime()-i.getTime())/dayMs),e=(e.getTime()-l.getTime())/dayMs/n,l=Math.max(0,(t.getTime()-i.getTime())/dayMs+1)/n,t=(f[a]||0)+e;return{offsetLeftSize:t,offsetWidthSize:(f[r]||0)-t+l}};case"day":case"date":var h={};return e.forEach(function(e,t){e=e.dateObj,e=_xeUtils.default.toDateString(e.date,"yyyy-MM-dd");h[e]=t}),function(e,t){var e=parseStringDate(o,e),t=parseStringDate(o,t),a=_xeUtils.default.toDateString(e,"yyyy-MM-dd"),l=_xeUtils.default.getWhatDay(e,0,"first"),r=_xeUtils.default.toDateString(t,"yyyy-MM-dd"),i=_xeUtils.default.getWhatDay(t,0,"first"),n=Math.floor((_xeUtils.default.getWhatDay(t,1,"first").getTime()-i.getTime())/minuteMs),e=(e.getTime()-l.getTime())/minuteMs/n,l=Math.max(0,(t.getTime()-i.getTime())/minuteMs+1)/n,t=(h[a]||0)+e;return{offsetLeftSize:t,offsetWidthSize:(h[r]||0)-t+l+1}};case"hour":var m={};return e.forEach(function(e,t){e=e.dateObj,e=_xeUtils.default.toDateString(e.date,"yyyy-MM-dd HH");m[e]=t}),function(e,t){var e=parseStringDate(o,e),t=parseStringDate(o,t),a=_xeUtils.default.toDateString(e,"yyyy-MM-dd HH"),l=_xeUtils.default.getWhatHours(e,0,"first"),r=_xeUtils.default.toDateString(t,"yyyy-MM-dd HH"),i=_xeUtils.default.getWhatHours(t,0,"first"),n=Math.floor((_xeUtils.default.getWhatHours(t,1,"first").getTime()-i.getTime())/minuteMs),e=(e.getTime()-l.getTime())/minuteMs/n,l=Math.max(0,(t.getTime()-i.getTime())/minuteMs+1)/n,t=(m[a]||0)+e;return{offsetLeftSize:t,offsetWidthSize:(m[r]||0)-t+l}};case"minute":var y={};return e.forEach(function(e,t){e=e.dateObj,e=_xeUtils.default.toDateString(e.date,"yyyy-MM-dd HH:mm");y[e]=t}),function(e,t){var e=parseStringDate(o,e),t=parseStringDate(o,t),a=_xeUtils.default.toDateString(e,"yyyy-MM-dd HH:mm"),l=_xeUtils.default.getWhatMinutes(e,0,"first"),r=_xeUtils.default.toDateString(t,"yyyy-MM-dd HH:mm"),i=_xeUtils.default.getWhatMinutes(t,0,"first"),n=Math.floor((_xeUtils.default.getWhatMinutes(t,1,"first").getTime()-i.getTime())/minuteMs),e=(e.getTime()-l.getTime())/minuteMs/n,l=Math.max(0,(t.getTime()-i.getTime())/minuteMs+1)/n,t=(y[a]||0)+e;return{offsetLeftSize:t,offsetWidthSize:(y[r]||0)-t+l}};case"second":var i=(0,_util.getStandardGapTime)(a.type);return function(e,t){var e=parseStringDate(o,e),t=parseStringDate(o,t),a=0,l=0;return r&&(a=(e.getTime()-r.getTime())/i,l=(t.getTime()-e.getTime())/i),{offsetLeftSize:a,offsetWidthSize:l}}}return function(){return{offsetLeftSize:0,offsetWidthSize:0}}}function handleParseColumn(e){var r,i,n,o,t,a,l,c,s,d,u,f,h=e.$xeGantt,m=e.reactData,y=e.internalData,g=h.treeConfig,p=m.minViewDate,S=m.maxViewDate,x=handleColumnHeader(e),v=x.fullCols,x=x.groupCols;p&&S&&(r=y.xeTable)&&(i=h.computeStartField,n=h.computeEndField,o=h.computeTypeField,p=r.isRowGroupStatus,S=r.afterFullData,h=r.afterTreeFullData,t=r.afterGroupFullData,a=r.computeAggregateOpts,c=(l=r.computeTreeOpts).transform,s=l.children||l.childrenField,d={},u=createChartRender(e,v),f=function(e){var t=r.getRowid(e),a=_xeUtils.default.get(e,i),l=_xeUtils.default.get(e,n);(0,_util.hasMilestoneTask)(_xeUtils.default.get(e,o))&&(l=a=a||l),a&&l&&(l=(a=u(a,l)).offsetLeftSize,d[t]={row:e,rowid:t,oLeftSize:l,oWidthSize:a.offsetWidthSize})},p?(p=a.mapChildrenField)&&_xeUtils.default.eachTree(t,f,{children:p}):g?_xeUtils.default.eachTree(h,f,{children:c?l.mapChildrenField:s}):S.forEach(f),y.chartMaps=d),y.visibleColumn=v,m.headerGroups=x,updateTodayData(e),updateScrollXStatus(e),handleTableColumn(e)}function handleUpdateData(l){var r,i,n,e,t,a,o,c,s,d,u=l.$xeGantt,f=l.reactData,h=l.internalData,m=u.treeConfig,y=h.scrollXStore,g=h.xeTable,p=null,S=null;g&&(r=u.computeStartField,i=u.computeEndField,n=u.computeTypeField,u=g.isRowGroupStatus,e=g.afterFullData,t=g.afterTreeFullData,a=g.computeAggregateOpts,c=(o=g.computeTreeOpts).transform,s=o.children||o.childrenField,d=function(e){var t=_xeUtils.default.get(e,r),a=_xeUtils.default.get(e,i),e=_xeUtils.default.get(e,n),t=t||a;!(0,_util.hasMilestoneTask)(e)&&a||(a=t),t&&(e=parseStringDate(l,t),!p||p.getTime()>e.getTime())&&(p=e),a&&(t=parseStringDate(l,a),!S||S.getTime()<t.getTime())&&(S=t)},u?(u=a.mapChildrenField)&&_xeUtils.default.eachTree(g.afterGroupFullData,d,{children:u}):m?_xeUtils.default.eachTree(t,d,{children:c?o.mapChildrenField:s}):e.forEach(d)),y.startIndex=0,y.endIndex=Math.max(1,y.visibleSize),f.minViewDate=p,f.maxViewDate=S,h.startMaps={},h.endMaps={},handleParseColumn(l)}function calcScrollbar(e){var t=e.$xeGantt,a=e.reactData,l=a.scrollXWidth,r=a.scrollYHeight,i=e.internalData.elemStore,t=t.computeScrollbarOpts,i=(0,_util.getRefElem)(i["main-body-wrapper"]),n=e.$refs.refScrollXHandleElem,e=e.$refs.refScrollYHandleElem;i&&(r=r>i.clientHeight,e&&(a.scrollbarWidth=t.width||e.offsetWidth-e.clientWidth||14),a.overflowY=r,e=l>i.clientWidth,n&&(a.scrollbarHeight=t.height||n.offsetHeight-n.clientHeight||14),a.overflowX=e)}function updateTaskChart(e){var t=e.$xeGantt,a=e.internalData,t=t.internalData,l=a.xeTable,r=t.dragBarRow,i=e.reactData.viewCellWidth,n=a.chartMaps,t=(0,_util.getRefElem)(a.elemStore["main-chart-task-wrapper"]);return t&&l&&_xeUtils.default.arrayEach(t.children,function(e){var t=e.children[0];t&&(e=e.getAttribute("rowid"),r&&l.getRowid(r)===e||(e=e?n[e]:null,t.style.left="".concat((0,_util.getTaskBarLeft)(e,i),"px"),(0,_dom.hasClass)(t,"is--milestone"))||(t.style.width="".concat((0,_util.getTaskBarWidth)(e,i),"px")))}),e.$nextTick()}function updateStyle(e){var t,a,l,r,i,n,o,c,s=e.$xeGantt,d=e.reactData,u=e.internalData,f=d.scrollbarWidth,h=d.scrollbarHeight,m=d.headerGroups,y=d.tableColumn,g=u.elemStore,p=u.visibleColumn,u=u.xeTable,S=e.$refs.refElem;if(S&&s)return r=s.computeScrollbarOpts,n=s.computeScrollbarXToTop,i=e.$refs.refScrollXLeftCornerElem,o=e.$refs.refScrollXRightCornerElem,c=e.$refs.refScrollXVirtualElem,f=f,h=h,l=a=t=0,u&&(t=u.tBodyHeight,a=u.tHeaderHeight,l=u.tFooterHeight),u="visible",(s.computeScrollbarYToLeft||r.y&&!1===r.y.visible)&&(f=0,u="hidden"),(r=(0,_util.getRefElem)(g["main-header-scroll"]))&&(r.style.height="".concat(a,"px"),r.style.setProperty("--vxe-ui-gantt-view-cell-height","".concat(a/m.length,"px"))),(r=(0,_util.getRefElem)(g["main-body-scroll"]))&&(r.style.height="".concat(t,"px")),(m=(0,_util.getRefElem)(g["main-footer-scroll"]))&&(m.style.height="".concat(l,"px")),c&&(c.style.height="".concat(h,"px"),c.style.visibility="visible"),(m=e.$refs.refScrollXWrapperElem)&&(m.style.left=n?"".concat(f,"px"):"",m.style.width="".concat(S.clientWidth-f,"px")),i&&(i.style.width=n?"".concat(f,"px"):"",i.style.display=n&&h?"block":""),o&&(o.style.width=n?"":"".concat(f,"px"),o.style.display=!n&&h?"block":""),(c=e.$refs.refScrollYVirtualElem)&&(c.style.width="".concat(f,"px"),c.style.height="".concat(t+a+l,"px"),c.style.visibility=u),(m=e.$refs.refScrollYTopCornerElem)&&(m.style.height="".concat(a,"px"),m.style.display=a?"block":""),(S=e.$refs.refScrollYWrapperElem)&&(S.style.height="".concat(t,"px"),S.style.top="".concat(a,"px")),(i=e.$refs.refScrollYBottomCornerElem)&&(i.style.height="".concat(l,"px"),i.style.top="".concat(a+t,"px"),i.style.display=l?"block":""),o=40,h=o=(n=e.$refs.refColInfoElem)?n.clientWidth||40:o,p.length&&(h=Math.max(0,o*p.length),r)&&0<(c=(f=r.clientWidth)-h)&&(o+=Math.max(0,c/p.length),h=f),d.viewCellWidth=o,u=(0,_util.getRefElem)(g["main-header-table"]),m=(0,_util.getRefElem)(g["main-body-table"]),S=o*y.length,u&&(u.style.width="".concat(h,"px")),m&&(m.style.width="".concat(S,"px")),d.scrollXWidth=h,Promise.all([updateTaskChart(e),s.handleUpdateTaskLink?s.handleUpdateTaskLink(e):null])}function handleRecalculateStyle(e){var t=e.internalData,a=e.$xeGantt,l=e.$refs.refElem;return t.rceRunTime=Date.now(),l&&l.clientWidth&&a?(calcScrollbar(e),updateStyle(e),computeScrollLoad(e)):e.$nextTick()}function _handleLazyRecalculate(i){var n=i.internalData;return new Promise(function(e){var t=n.rceTimeout,a=n.rceRunTime,l=n.xeTable,r=30;l&&(r=l.computeResizeOpts.refreshDelay||r),!t||(clearTimeout(t),a&&a+(r-5)<Date.now())?e(handleRecalculateStyle(i)):i.$nextTick(function(){e()}),n.rceTimeout=setTimeout(function(){n.rceTimeout=void 0,handleRecalculateStyle(i)},r)})}function computeScrollLoad(l){var r=l.reactData,i=l.internalData;return l.$nextTick().then(function(){var e,t=r.scrollXLoad,a=i.scrollXStore;t?(e=(t=handleVirtualXVisible(l)).toVisibleIndex,t=t.visibleSize,a.preloadSize=1,a.offsetSize=2,a.visibleSize=t,a.endIndex=Math.max(a.startIndex+a.visibleSize+2,a.endIndex),a.visibleStartIndex=Math.max(a.startIndex,e),a.visibleEndIndex=Math.min(a.endIndex,e+t),updateScrollXData(l).then(function(){loadScrollXData(l)})):updateScrollXSpace(l)})}function handleVirtualXVisible(e){var t,a=e.reactData.viewCellWidth,e=e.internalData.elemStore,e=(0,_util.getRefElem)(e["main-body-scroll"]);return e?(t=e.clientWidth,e=e.scrollLeft,e=Math.floor(e/a)-1,t=Math.ceil(t/a)+1,{toVisibleIndex:Math.max(0,e),visibleSize:Math.max(1,t)}):{toVisibleIndex:0,visibleSize:6}}function loadScrollXData(e){var t=e.reactData.isScrollXBig,a=e.internalData.scrollXStore,l=a.preloadSize,r=a.startIndex,i=a.endIndex,n=a.offsetSize,o=handleVirtualXVisible(e),c=o.toVisibleIndex,o=o.visibleSize,t={startIndex:Math.max(0,t?c-1:c-1-n-l),endIndex:t?c+o:c+o+n+l},n=(a.visibleStartIndex=c-1,a.visibleEndIndex=c+o+1,t.startIndex),l=t.endIndex;!(c<=r||i-o-1<=c)||r===n&&i===l||(a.startIndex=n,a.endIndex=l,updateScrollXData(e))}function updateScrollXData(e){return handleTableColumn(e),updateScrollXSpace(e),e.$nextTick()}function updateScrollXStatus(e){return e.reactData.scrollXLoad=!0}function handleTableColumn(e){var t=e.reactData,e=e.internalData,a=t.scrollXLoad,l=e.visibleColumn,e=e.scrollXStore,a=a?l.slice(e.startIndex,e.endIndex):l.slice(0);t.tableColumn=a}function updateScrollXSpace(e){var t=e.reactData,a=e.internalData,l=t.scrollXLoad,r=t.scrollXWidth,i=t.viewCellWidth,n=a.elemStore,a=a.scrollXStore,o=(0,_util.getRefElem)(n["main-body-table"]),a=a.startIndex,c=0,a=(l&&(c=Math.max(0,a*i)),o&&(o.style.transform="translate(".concat(c,"px, ").concat(t.scrollYTop||0,"px)")),["header","body","footer"].forEach(function(e){e=(0,_util.getRefElem)(n["main-".concat(e,"-xSpace")]);e&&(e.style.width=l?"".concat(r,"px"):"")}),e.$refs.refScrollXSpaceElem),i=(a&&(a.style.width="".concat(r,"px")),(0,_util.getRefElem)(n["main-chart-line-wrapper"])),o=i?i.firstElementChild:null;return o&&(o.style.width="".concat(r,"px")),calcScrollbar(e),e.$nextTick()}function triggerScrollXEvent(e){loadScrollXData(e)}function updateScrollYSpace(e){var t=e.reactData,a=e.internalData,l=t.scrollYLoad,r=t.overflowY,i=a.elemStore,a=a.xeTable,n=(0,_util.getRefElem)(i["main-body-scroll"]),o=(0,_util.getRefElem)(i["main-body-table"]),c=0,s=0,d=!1,a=(a&&(c=a.scrollYTop,s=a.scrollYHeight,d=a.isScrollYBig),s),u=c,f=0,n=(n&&(f=n.clientHeight),d&&(u=n&&o&&n.scrollTop+f>=maxYHeight?maxYHeight-o.clientHeight:c/(s-f)*(maxYHeight-f),a=maxYHeight),l&&r||(u=0),(0,_util.getRefElem)(i["main-chart-task-wrapper"])),c=(o&&(o.style.transform="translate(".concat(t.scrollXLeft||0,"px, ").concat(u,"px)")),n&&(n.style.transform="translate(".concat(t.scrollXLeft||0,"px, ").concat(u,"px)")),(0,_util.getRefElem)(i["main-body-ySpace"])),f=(c&&(c.style.height=a?"".concat(a,"px"):""),e.$refs.refScrollYSpaceElem),l=(f&&(f.style.height=a?"".concat(a,"px"):""),(0,_util.getRefElem)(i["main-chart-line-wrapper"])),r=l?l.firstElementChild:null;return r&&(r.style.height=a?"".concat(a,"px"):""),t.scrollYTop=u,t.scrollYHeight=s,t.isScrollYBig=d,calcScrollbar(e),e.$nextTick().then(function(){updateStyle(e)})}function checkLastSyncScroll(e,t,a){var l=e.reactData,r=e.internalData,e=r.lcsTimeout;l.lazScrollLoading=!0,e&&clearTimeout(e),r.lcsTimeout=setTimeout(function(){r.lcsRunTime=Date.now(),r.lcsTimeout=void 0,r.intoRunScroll=!1,r.inVirtualScroll=!1,r.inWheelScroll=!1,r.inHeaderScroll=!1,r.inBodyScroll=!1,r.inFooterScroll=!1,l.lazScrollLoading=!1},200)}function handleScrollData(e,t,a,l,r){var i=e.reactData,n=e.internalData;a&&(n.lastScrollLeft=r),t&&(n.lastScrollTop=l),i.lastScrollTime=Date.now(),checkLastSyncScroll(e,a,t)}function handleScrollEvent(e,t,a,l,r,i){var n,o,c,s,d,u,f,h,m,y,g,p,S=e.$xeGantt,x=e.internalData,v=x.xeTable,_=e.$refs.refScrollXHandleElem,D=e.$refs.refScrollYHandleElem;_&&D&&v&&(n=D.clientHeight,o=_.clientWidth,D=D.scrollHeight,_=_.scrollWidth,d="",m=h=f=u=s=y=c=p=!1,l&&(g=v.computeScrollXThreshold,(y=i<=0)||(s=_-1<=i+o),x.lastScrollLeft<i?(d="right",_-g<=i+o&&(m=!0)):(d="left",i<=g&&(h=!0))),a&&(g=v.computeScrollYThreshold,(p=r<=0)||(c=D-1<=r+n),x.lastScrollTop<r?(d="bottom",D-g<=r+n&&(f=!0)):(d="top",r<=g&&(u=!0))),handleScrollData(e,a,l,r,i),v={source:sourceType,scrollTop:r,scrollLeft:i,bodyHeight:n,bodyWidth:o,scrollHeight:D,scrollWidth:_,isX:l,isY:a,isTop:p,isBottom:c,isLeft:y,isRight:s,direction:d},(f||u||m||h)&&S.dispatchEvent("scroll-boundary",v,t),S.dispatchEvent("scroll",v,t))}function syncTableScrollTop(e,t){var e=e.internalData.xeTable;e&&(e=e.elemStore,e=(0,_util.getRefElem)(e["main-body-scroll"]))&&(e.scrollTop=t)}var _default=exports.default=(0,_comp.defineVxeComponent)({name:"VxeGanttView",inject:{$xeGantt:{default:null}},provide:function(){return{$xeGanttView:this}},props:{},data:function(){return{xID:_xeUtils.default.uniqueId(),reactData:{scrollXLoad:!1,scrollYLoad:!1,overflowY:!0,overflowX:!0,scrollbarWidth:0,scrollbarHeight:0,lastScrollTime:0,lazScrollLoading:!1,scrollVMLoading:!1,scrollYHeight:0,scrollYTop:0,isScrollYBig:!1,scrollXLeft:0,scrollXWidth:0,isScrollXBig:!1,minViewDate:null,maxViewDate:null,tableData:[],tableColumn:[],headerGroups:[],viewCellWidth:40},internalData:createInternalData()}},computed:Object.assign(Object.assign({},{}),{computeScaleDateList:function(){var e=this.$xeGantt,t=this.reactData,a=t.minViewDate,l=t.maxViewDate,t=e.computeTaskViewOpts,r=e.computeMinScale,e=t.gridding,t=r.type,i=r.startDay,n=[];if(a&&l){var o=-_xeUtils.default.toNumber(e&&e.leftSpacing||0),c=_xeUtils.default.toNumber(e&&e.rightSpacing||0);switch(t){case"year":for(var s=_xeUtils.default.getWhatYear(a,o,"first"),d=_xeUtils.default.getWhatYear(l,c,"first");s<=d;){var u=s;n.push(u),s=_xeUtils.default.getWhatYear(s,1)}break;case"quarter":for(var f=_xeUtils.default.getWhatQuarter(a,o,"first"),h=_xeUtils.default.getWhatQuarter(l,c,"first");f<=h;){var m=f;n.push(m),f=_xeUtils.default.getWhatQuarter(f,1)}break;case"month":for(var y=_xeUtils.default.getWhatMonth(a,o,"first"),g=_xeUtils.default.getWhatMonth(l,c,"first");y<=g;){var p=y;n.push(p),y=_xeUtils.default.getWhatMonth(y,1)}break;case"week":for(var S=_xeUtils.default.getWhatWeek(a,o,i,i),x=_xeUtils.default.getWhatWeek(l,c,i,i);S<=x;){var v=S;n.push(v),S=_xeUtils.default.getWhatWeek(S,1)}break;case"day":case"date":for(var _=_xeUtils.default.getWhatDay(a,o,"first"),D=_xeUtils.default.getWhatDay(l,c,"first");_<=D;){var T=_;n.push(T),_=_xeUtils.default.getWhatDay(_,1)}break;case"hour":case"minute":case"second":for(var b=+(0,_util.getStandardGapTime)(r.type),w=a.getTime()+o*b,M=l.getTime()+c*b;w<=M;){var E=new Date(w);n.push(E),w+=b}}}return n}}),methods:{refreshData:function(){var t=this,a=t.internalData;return handleUpdateData(t),handleRecalculateStyle(t),t.$nextTick().then(function(){var e=a.xeTable;if(handleRecalculateStyle(t),e)return e.recalculate()})},updateViewData:function(){var e=this.reactData,t=this.internalData.xeTable;return t&&(t=t.tableData,e.tableData=t),this.$nextTick()},connectUpdate:function(e){var e=e.$table,t=this.internalData;return e&&(t.xeTable=e),this.$nextTick()},handleUpdateStyle:function(){return updateStyle(this)},handleLazyRecalculate:function(){return _handleLazyRecalculate(this)},handleUpdateCurrentRow:function(e){var t=this.internalData.xeTable,a=this.$refs.refElem;t&&a&&(e?(t.computeRowOpts.isCurrent||t.highlightCurrentRow)&&_xeUtils.default.arrayEach(a.querySelectorAll('[rowid="'.concat(t.getRowid(e),'"]')),function(e){return(0,_dom.addClass)(e,"row--current")}):_xeUtils.default.arrayEach(a.querySelectorAll(".row--current"),function(e){return(0,_dom.removeClass)(e,"row--current")}))},handleUpdateHoverRow:function(e){var t=this.internalData.xeTable,a=this.$refs.refElem;t&&a&&(e?_xeUtils.default.arrayEach(a.querySelectorAll('.vxe-body--row[rowid="'.concat(t.getRowid(e),'"]')),function(e){return(0,_dom.addClass)(e,"row--hover")}):_xeUtils.default.arrayEach(a.querySelectorAll(".vxe-body--row.row--hover"),function(e){return(0,_dom.removeClass)(e,"row--hover")}))},triggerHeaderScrollEvent:function(e){var t,a,l,r=this.internalData,i=r.elemStore;r.inVirtualScroll||r.inBodyScroll||r.inFooterScroll||(t=e.currentTarget,i=(0,_util.getRefElem)(i["main-body-scroll"]),a=this.$refs.refScrollXHandleElem,i&&t&&(l=t.scrollLeft,r.inHeaderScroll=!0,(0,_dom.setScrollLeft)(a,l),(0,_dom.setScrollLeft)(i,l),handleScrollEvent(this,e,!1,!0,t.scrollTop,l)))},triggerBodyScrollEvent:function(e){var t,a,l,r,i,n=this,o=n.reactData,c=n.internalData,o=o.scrollXLoad,s=c.elemStore,d=c.lastScrollLeft,u=c.lastScrollTop;c.inVirtualScroll||c.inHeaderScroll||c.inFooterScroll||(t=e.currentTarget,s=(0,_util.getRefElem)(s["main-header-scroll"]),a=n.$refs.refScrollXHandleElem,l=n.$refs.refScrollYHandleElem,d=(r=t.scrollLeft)!==d,u=(i=t.scrollTop)!==u,c.inBodyScroll=!0,c.scrollRenderType="",u&&((0,_dom.setScrollTop)(l,i),syncTableScrollTop(n,i)),d&&(c.inBodyScroll=!0,(0,_dom.setScrollLeft)(a,r),(0,_dom.setScrollLeft)(s,r),o)&&triggerScrollXEvent(n),handleScrollEvent(n,e,u,d,t.scrollTop,r))},triggerVirtualScrollXEvent:function(e){var t,a,l,r=this.reactData,i=this.internalData,r=r.scrollXLoad,n=i.elemStore;i.inHeaderScroll||i.inBodyScroll||(t=e.currentTarget,a=(0,_util.getRefElem)(n["main-header-scroll"]),n=(0,_util.getRefElem)(n["main-body-scroll"]),t&&(l=t.scrollLeft,i.inVirtualScroll=!0,(0,_dom.setScrollLeft)(a,l),(0,_dom.setScrollLeft)(n,l),r&&triggerScrollXEvent(this),handleScrollEvent(this,e,!1,!0,t.scrollTop,l)))},triggerVirtualScrollYEvent:function(e){var t,a,l=this.internalData,r=l.elemStore;l.inHeaderScroll||l.inBodyScroll||(t=e.currentTarget,r=(0,_util.getRefElem)(r["main-body-scroll"]),t&&(a=t.scrollTop,l.inVirtualScroll=!0,(0,_dom.setScrollTop)(r,a),syncTableScrollTop(this,a),handleScrollEvent(this,e,!0,!1,a,t.scrollLeft)))},handleUpdateSXSpace:function(){return updateScrollXSpace(this)},handleUpdateSYSpace:function(){return updateScrollYSpace(this)},handleUpdateSYStatus:function(e){this.reactData.scrollYLoad=e},handleGlobalResizeEvent:function(){_handleLazyRecalculate(this)},renderScrollX:function(e){return e("div",{key:"vsx",ref:"refScrollXVirtualElem",class:"vxe-gantt-view--scroll-x-virtual"},[e("div",{ref:"refScrollXLeftCornerElem",class:"vxe-gantt-view--scroll-x-left-corner"}),e("div",{ref:"refScrollXWrapperElem",class:"vxe-gantt-view--scroll-x-wrapper"},[e("div",{ref:"refScrollXHandleElem",class:"vxe-gantt-view--scroll-x-handle",on:{scroll:this.triggerVirtualScrollXEvent}},[e("div",{ref:"refScrollXSpaceElem",class:"vxe-gantt-view--scroll-x-space"})]),e("div",{class:"vxe-gantt-view--scroll-x-handle-appearance"})]),e("div",{ref:"refScrollXRightCornerElem",class:"vxe-gantt-view--scroll-x-right-corner"})])},renderScrollY:function(e){return e("div",{ref:"refScrollYVirtualElem",class:"vxe-gantt-view--scroll-y-virtual"},[e("div",{ref:"refScrollYTopCornerElem",class:"vxe-gantt-view--scroll-y-top-corner"}),e("div",{ref:"refScrollYWrapperElem",class:"vxe-gantt-view--scroll-y-wrapper"},[e("div",{ref:"refScrollYHandleElem",class:"vxe-gantt-view--scroll-y-handle",on:{scroll:this.triggerVirtualScrollYEvent}},[e("div",{ref:"refScrollYSpaceElem",class:"vxe-gantt-view--scroll-y-space"})]),e("div",{class:"vxe-gantt-view--scroll-y-handle-appearance"})]),e("div",{ref:"refScrollYBottomCornerElem",class:"vxe-gantt-view--scroll-y-bottom-corner"})])},renderViewport:function(e){return e("div",{class:"vxe-gantt-view--viewport-wrapper"},[e(_ganttHeader.default),e(_ganttBody.default),e(_ganttFooter.default)])},renderBody:function(e){var t=this;return e("div",{class:"vxe-gantt-view--layout-wrapper"},t.$xeGantt.computeScrollbarYToLeft?[t.renderScrollY(e),t.renderViewport(e)]:[t.renderViewport(e),t.renderScrollY(e)])},renderVN:function(e){var t=this,a=t.$xeGantt,l=t.reactData,r=l.overflowX;return e("div",{ref:"refElem",class:["vxe-gantt-view",{"is--scroll-y":l.overflowY,"is--scroll-x":r,"is--virtual-x":l.scrollXLoad,"is--virtual-y":l.scrollYLoad}]},[e("div",{class:"vxe-gantt-view--render-wrapper"},a.computeScrollbarXToTop?[t.renderScrollX(e),t.renderBody(e)]:[t.renderBody(e),t.renderScrollX(e)]),e("div",{class:"vxe-gantt-view--render-vars"},[e("div",{ref:"refColInfoElem",class:"vxe-gantt-view--column-info"})])])}},watch:{"reactData.tableData":function(){handleUpdateData(this)}},mounted:function(){globalEvents.on(this,"resize",this.handleGlobalResizeEvent)},beforeDestroy:function(){var e=this.internalData;globalEvents.off(this,"keydown"),_xeUtils.default.assign(e,createInternalData())},render:function(e){return this.renderVN(e)}});
@@ -615,7 +615,11 @@ var _default2 = exports.default = /* define-vxe-component start */(0, _comp.defi
615
615
  var sConf = !conf || _xeUtils.default.isString(conf) ? {
616
616
  type: conf
617
617
  } : conf;
618
- var type = sConf.type;
618
+ var type = sConf.type,
619
+ step = sConf.step;
620
+ if (step) {
621
+ (0, _log.errLog)('vxe.error.errProp', ["step=".concat(step), 'step=1']);
622
+ }
619
623
  if (!type || !viewTypeLevelMaps[type]) {
620
624
  (0, _log.errLog)('vxe.error.errProp', ["type=".concat(type), _xeUtils.default.keys(viewTypeLevelMaps).join(',')]);
621
625
  return;