vxe-gantt 4.4.9 → 4.5.0

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/dist/all.esm.js CHANGED
@@ -6,7 +6,7 @@ import DomZIndex from 'dom-zindex';
6
6
  import { VxeTable } from 'vxe-table';
7
7
 
8
8
  const { setConfig: setConfig$1, setIcon } = VxeUI;
9
- VxeUI.ganttVersion = "4.4.9";
9
+ VxeUI.ganttVersion = "4.5.0";
10
10
  const ymdFormat = 'yyyy-MM-dd';
11
11
  const ymdhmsFormat = 'yyyy-MM-dd HH:mm:ss';
12
12
  setConfig$1({
@@ -114,20 +114,29 @@ setIcon({
114
114
  });
115
115
 
116
116
  const { log } = VxeUI;
117
- const version = `gantt v${"4.4.9"}`;
118
- const warnLog = log.create('warn', version);
119
- const errLog = log.create('error', version);
117
+ const ganttVersion = `gantt v${"4.5.0"}`;
118
+ function createComponentLog(name) {
119
+ const uiVersion = VxeUI.uiVersion ? `ui v${VxeUI.uiVersion}` : '';
120
+ const tableVersion = VxeUI.tableVersion ? `table v${VxeUI.tableVersion}` : '';
121
+ const designVersion = VxeUI.designVersion ? `design v${VxeUI.designVersion}` : '';
122
+ return {
123
+ warnLog: log.create('warn', uiVersion + tableVersion + ganttVersion + designVersion + '] [' + name),
124
+ errLog: log.create('error', uiVersion + tableVersion + ganttVersion + designVersion + '] [' + name)
125
+ };
126
+ }
127
+ log.create('warn', ganttVersion);
128
+ const errLog$1 = log.create('error', ganttVersion);
120
129
 
121
130
  function checkDependVersion() {
122
131
  const pVersion = 4;
123
132
  const sVersion = 17;
124
133
  if (VxeUI.checkVersion) {
125
134
  if (!VxeUI.checkVersion(VxeUI.tableVersion, pVersion, sVersion)) {
126
- errLog('vxe.error.errorVersion', [`vxe-table@${VxeUI.tableVersion || '?'}`, `vxe-table v${pVersion}.${sVersion}+`]);
135
+ errLog$1('vxe.error.errorVersion', [`vxe-table@${VxeUI.tableVersion || '?'}`, `vxe-table v${pVersion}.${sVersion}+`]);
127
136
  }
128
137
  }
129
138
  else {
130
- errLog(`Requires vxe-table v${pVersion}.${sVersion}+`);
139
+ errLog$1(`Requires vxe-table v${pVersion}.${sVersion}+`);
131
140
  }
132
141
  }
133
142
 
@@ -248,7 +257,7 @@ const tableEmits = [
248
257
  'columns-change',
249
258
  'data-change',
250
259
  'footer-data-change',
251
- 'current-change',
260
+ 'current-change', // 已废弃
252
261
  'current-row-change',
253
262
  'current-row-disabled',
254
263
  'current-column-change',
@@ -282,7 +291,7 @@ const tableEmits = [
282
291
  'filter-visible',
283
292
  'clear-filter',
284
293
  'clear-all-filter',
285
- 'resizable-change',
294
+ 'resizable-change', // 废弃
286
295
  'column-resizable-change',
287
296
  'row-resizable-change',
288
297
  'toggle-row-group-expand',
@@ -300,7 +309,7 @@ const tableEmits = [
300
309
  'column-dragend',
301
310
  'enter-append-row',
302
311
  'tab-append-row',
303
- 'edit-actived',
312
+ 'edit-actived', // 废弃
304
313
  'edit-activated',
305
314
  'edit-disabled',
306
315
  'valid-error',
@@ -311,7 +320,7 @@ const tableEmits = [
311
320
  'custom-visible-all',
312
321
  'custom-fixed-change',
313
322
  'custom-sort-change',
314
- 'change-fnr',
323
+ 'change-fnr', // 废弃
315
324
  'open-fnr',
316
325
  'show-fnr',
317
326
  'hide-fnr',
@@ -1269,8 +1278,10 @@ var GanttViewFooterComponent = defineVxeComponent({
1269
1278
 
1270
1279
  const { globalEvents: globalEvents$1 } = VxeUI;
1271
1280
  const sourceType = 'gantt';
1281
+ const secondMs = 1000;
1272
1282
  const minuteMs = 1000 * 60;
1273
- const dayMs = minuteMs * 60 * 24;
1283
+ const hourMs = 1000 * 60 * 60;
1284
+ const dayMs = hourMs * 24;
1274
1285
  function createInternalData$1() {
1275
1286
  return {
1276
1287
  xeTable: null,
@@ -1335,7 +1346,7 @@ var GanttViewComponent = defineVxeComponent({
1335
1346
  const xID = XEUtils.uniqueId();
1336
1347
  const $xeGantt = inject('$xeGantt', {});
1337
1348
  const { reactData: ganttReactData, internalData: ganttInternalData } = $xeGantt;
1338
- const { computeTaskOpts, computeTaskViewOpts, computeStartField, computeEndField, computeTypeField, computeScrollbarOpts, computeScrollbarXToTop, computeScrollbarYToLeft, computeScaleUnit, computeWeekScale, computeMinScale, computeTaskNowLineOpts } = $xeGantt.getComputeMaps();
1349
+ const { computeDateFormat, computeTaskViewOpts, computeStartField, computeEndField, computeTypeField, computeScrollbarOpts, computeScrollbarXToTop, computeScrollbarYToLeft, computeScaleUnit, computeWeekScale, computeMinScale, computeTaskNowLineOpts } = $xeGantt.getComputeMaps();
1339
1350
  const refElem = ref();
1340
1351
  const refScrollXVirtualElem = ref();
1341
1352
  const refScrollYVirtualElem = ref();
@@ -1494,9 +1505,8 @@ var GanttViewComponent = defineVxeComponent({
1494
1505
  getComputeMaps: () => computeMaps
1495
1506
  };
1496
1507
  const parseStringDate = (dateValue) => {
1497
- const taskOpts = computeTaskOpts.value;
1498
- const { dateFormat } = taskOpts;
1499
- return XEUtils.toStringDate(dateValue, dateFormat || null);
1508
+ const dateFormat = computeDateFormat.value;
1509
+ return XEUtils.toStringDate(dateValue, dateFormat);
1500
1510
  };
1501
1511
  const updateTodayData = () => {
1502
1512
  const ganttReactData = $xeGantt.reactData;
@@ -1724,195 +1734,270 @@ var GanttViewComponent = defineVxeComponent({
1724
1734
  };
1725
1735
  };
1726
1736
  const createChartRender = (fullCols) => {
1727
- const { minViewDate } = reactData;
1728
1737
  const minScale = computeMinScale.value;
1729
1738
  const scaleUnit = computeScaleUnit.value;
1730
1739
  const weekScale = computeWeekScale.value;
1740
+ const dateFormat = computeDateFormat.value;
1731
1741
  if (minScale) {
1732
1742
  switch (scaleUnit) {
1733
1743
  case 'year': {
1744
+ const showActualProgress = /M|d|H|mm|ss|S/.test(dateFormat);
1745
+ const renderFormat = 'yyyy';
1734
1746
  const indexMaps = {};
1735
1747
  fullCols.forEach(({ dateObj }, i) => {
1736
1748
  const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy');
1737
1749
  indexMaps[yyyyMM] = i;
1738
1750
  });
1739
1751
  return (startValue, endValue) => {
1740
- const startDate = parseStringDate(startValue);
1741
- const endDate = parseStringDate(endValue);
1742
- const startStr = XEUtils.toDateString(startDate, 'yyyy');
1743
- const startFirstDate = XEUtils.getWhatYear(startDate, 0, 'first');
1744
- const endStr = XEUtils.toDateString(endDate, 'yyyy');
1752
+ const startValDate = parseStringDate(startValue);
1753
+ const endValDate = parseStringDate(endValue);
1754
+ const startStr = XEUtils.toDateString(startValDate, renderFormat);
1755
+ const startDate = showActualProgress ? startValDate : XEUtils.getWhatYear(startValDate, 0, 'first');
1756
+ const startFirstDate = XEUtils.getWhatYear(startValDate, 0, 'first');
1757
+ const endStr = XEUtils.toDateString(endValDate, renderFormat);
1758
+ const endDate = showActualProgress ? endValDate : XEUtils.getWhatYear(endValDate, 0, 'last');
1745
1759
  const endFirstDate = XEUtils.getWhatYear(endDate, 0, 'first');
1746
- const dateSize = Math.floor((XEUtils.getWhatYear(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / dayMs);
1747
- const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
1748
- const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
1749
- const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
1760
+ // 当前是年维度,当指定解析格式精确到天时,显示实际进度
1761
+ let startSubtractSize = 0;
1762
+ let endSubtractSize = 1;
1763
+ if (showActualProgress) {
1764
+ // 按年的天数比计算
1765
+ const syDaySize = XEUtils.getDayOfYear(startDate, 0);
1766
+ startSubtractSize = (startDate.getTime() - startFirstDate.getTime()) / dayMs / syDaySize;
1767
+ const eyDaySize = XEUtils.getDayOfYear(endDate, 0);
1768
+ endSubtractSize = (endDate.getTime() - endFirstDate.getTime()) / dayMs / eyDaySize;
1769
+ }
1770
+ const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtractSize;
1750
1771
  return {
1751
1772
  offsetLeftSize,
1752
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
1773
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + endSubtractSize
1753
1774
  };
1754
1775
  };
1755
1776
  }
1756
1777
  case 'quarter': {
1778
+ const showActualProgress = /M|d|H|mm|ss|S/.test(dateFormat);
1779
+ const renderFormat = 'yyyy-q';
1757
1780
  const indexMaps = {};
1758
1781
  fullCols.forEach(({ dateObj }, i) => {
1759
- const q = XEUtils.toDateString(dateObj.date, 'yyyy-q');
1782
+ const q = XEUtils.toDateString(dateObj.date, renderFormat);
1760
1783
  indexMaps[q] = i;
1761
1784
  });
1762
1785
  return (startValue, endValue) => {
1763
- const startDate = parseStringDate(startValue);
1764
- const endDate = parseStringDate(endValue);
1765
- const startStr = XEUtils.toDateString(startDate, 'yyyy-q');
1766
- const startFirstDate = XEUtils.getWhatQuarter(startDate, 0, 'first');
1767
- const endStr = XEUtils.toDateString(endDate, 'yyyy-q');
1786
+ const startValDate = parseStringDate(startValue);
1787
+ const endValDate = parseStringDate(endValue);
1788
+ const startStr = XEUtils.toDateString(startValDate, renderFormat);
1789
+ const startDate = showActualProgress ? startValDate : XEUtils.getWhatQuarter(startValDate, 0, 'first');
1790
+ const startFirstDate = XEUtils.getWhatQuarter(startValDate, 0, 'first');
1791
+ const endStr = XEUtils.toDateString(endValDate, renderFormat);
1792
+ const endDate = showActualProgress ? endValDate : XEUtils.getWhatQuarter(endValDate, 0, 'last');
1768
1793
  const endFirstDate = XEUtils.getWhatQuarter(endDate, 0, 'first');
1769
- const dateSize = Math.floor((XEUtils.getWhatQuarter(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / dayMs);
1770
- const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
1771
- const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
1772
- const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
1794
+ // 当前是季度维度,当指定解析格式精确到天时,显示实际进度
1795
+ let startSubtractSize = 0;
1796
+ let endSubtractSize = 1;
1797
+ if (showActualProgress) {
1798
+ // 按季度天数比计算
1799
+ const sqDaySize = XEUtils.getDayOfQuarter(startDate, 0);
1800
+ startSubtractSize = (startDate.getTime() - startFirstDate.getTime()) / dayMs / sqDaySize;
1801
+ const eqDaySize = XEUtils.getDayOfQuarter(endDate, 0);
1802
+ endSubtractSize = (endDate.getTime() - endFirstDate.getTime()) / dayMs / eqDaySize;
1803
+ }
1804
+ const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtractSize;
1773
1805
  return {
1774
1806
  offsetLeftSize,
1775
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
1807
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + endSubtractSize
1776
1808
  };
1777
1809
  };
1778
1810
  }
1779
1811
  case 'month': {
1812
+ const renderFormat = 'yyyy-MM';
1813
+ const showActualProgress = /d|H|mm|ss|S/.test(dateFormat);
1780
1814
  const indexMaps = {};
1781
1815
  fullCols.forEach(({ dateObj }, i) => {
1782
- const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy-MM');
1816
+ const yyyyMM = XEUtils.toDateString(dateObj.date, renderFormat);
1783
1817
  indexMaps[yyyyMM] = i;
1784
1818
  });
1785
1819
  return (startValue, endValue) => {
1786
- const startDate = parseStringDate(startValue);
1787
- const endDate = parseStringDate(endValue);
1788
- const startStr = XEUtils.toDateString(startDate, 'yyyy-MM');
1789
- const startFirstDate = XEUtils.getWhatMonth(startDate, 0, 'first');
1790
- const endStr = XEUtils.toDateString(endDate, 'yyyy-MM');
1820
+ const startValDate = parseStringDate(startValue);
1821
+ const endValDate = parseStringDate(endValue);
1822
+ const startStr = XEUtils.toDateString(startValDate, renderFormat);
1823
+ const startDate = showActualProgress ? startValDate : XEUtils.getWhatMonth(startValDate, 0, 'first');
1824
+ const startFirstDate = XEUtils.getWhatMonth(startValDate, 0, 'first');
1825
+ const endStr = XEUtils.toDateString(endValDate, renderFormat);
1826
+ const endDate = showActualProgress ? endValDate : XEUtils.getWhatMonth(endValDate, 0, 'last');
1791
1827
  const endFirstDate = XEUtils.getWhatMonth(endDate, 0, 'first');
1792
- const dateSize = Math.floor((XEUtils.getWhatMonth(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / dayMs);
1793
- const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
1794
- const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
1795
- const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
1828
+ // 当前是月维度,当指定解析格式精确到天时,显示实际进度
1829
+ let startSubtractSize = 0;
1830
+ let endSubtractSize = 1;
1831
+ if (showActualProgress) {
1832
+ // 按月天数比计算
1833
+ const smDaySize = XEUtils.getDayOfMonth(startDate, 0);
1834
+ startSubtractSize = (startDate.getTime() - startFirstDate.getTime()) / dayMs / smDaySize;
1835
+ const emDaySize = XEUtils.getDayOfMonth(endDate, 0);
1836
+ endSubtractSize = (endDate.getTime() - endFirstDate.getTime()) / dayMs / emDaySize;
1837
+ }
1838
+ const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtractSize;
1796
1839
  return {
1797
1840
  offsetLeftSize,
1798
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
1841
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + endSubtractSize
1799
1842
  };
1800
1843
  };
1801
1844
  }
1802
1845
  case 'week': {
1846
+ const showActualProgress = /d|mm|ss|S/.test(dateFormat);
1803
1847
  const indexMaps = {};
1804
1848
  fullCols.forEach(({ dateObj }, i) => {
1805
1849
  const yyyyW = `${dateObj.yyyy}-${dateObj.W}`;
1806
1850
  indexMaps[yyyyW] = i;
1807
1851
  });
1808
1852
  return (startValue, endValue) => {
1809
- const startDate = parseStringDate(startValue);
1810
- const endDate = parseStringDate(endValue);
1811
- const startWeekObj = parseWeekObj(startDate, weekScale ? weekScale.startDay : undefined);
1853
+ const weekStartDay = weekScale ? weekScale.startDay : undefined;
1854
+ const startValDate = parseStringDate(startValue);
1855
+ const endValDate = parseStringDate(endValue);
1856
+ const startDate = showActualProgress ? startValDate : XEUtils.getWhatWeek(startValDate, 0, 'first', weekStartDay);
1857
+ const startWeekObj = parseWeekObj(startDate, weekStartDay);
1812
1858
  const startStr = `${startWeekObj.yyyy}-${startWeekObj.W}`;
1813
- const startFirstDate = XEUtils.getWhatWeek(startDate, 0, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined);
1814
- const endWeekObj = parseWeekObj(endDate, weekScale ? weekScale.startDay : undefined);
1859
+ const startFirstDate = XEUtils.getWhatWeek(startDate, 0, 'first', weekStartDay);
1860
+ const endDate = showActualProgress ? endValDate : XEUtils.getWhatWeek(endValDate, 0, 'first', weekStartDay);
1861
+ const endWeekObj = parseWeekObj(endDate, weekStartDay);
1815
1862
  const endStr = `${endWeekObj.yyyy}-${endWeekObj.W}`;
1816
- const endFirstDate = XEUtils.getWhatWeek(endDate, 0, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined);
1817
- const dateSize = Math.floor((XEUtils.getWhatWeek(endDate, 1, weekScale ? weekScale.startDay : undefined, weekScale ? weekScale.startDay : undefined).getTime() - endFirstDate.getTime()) / dayMs);
1818
- const subtract = (startDate.getTime() - startFirstDate.getTime()) / dayMs / dateSize;
1819
- const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / dayMs + 1) / dateSize;
1820
- const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
1863
+ const endFirstDate = XEUtils.getWhatWeek(endDate, 0, 'first', weekStartDay);
1864
+ // 当前是周维度,当指定解析格式精确到天时,显示实际进度
1865
+ let startSubtractSize = 0;
1866
+ let endSubtractSize = 1;
1867
+ if (showActualProgress) {
1868
+ // 按周天数比计算
1869
+ startSubtractSize = (startDate.getTime() - startFirstDate.getTime()) / dayMs / 7;
1870
+ endSubtractSize = (endDate.getTime() - endFirstDate.getTime()) / dayMs / 7;
1871
+ }
1872
+ const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtractSize;
1821
1873
  return {
1822
1874
  offsetLeftSize,
1823
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
1875
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + endSubtractSize
1824
1876
  };
1825
1877
  };
1826
1878
  }
1827
1879
  case 'day':
1828
1880
  case 'date': {
1881
+ const renderFormat = 'yyyy-MM-dd';
1882
+ const showActualProgress = /mm|ss|S/.test(dateFormat);
1829
1883
  const indexMaps = {};
1830
1884
  fullCols.forEach(({ dateObj }, i) => {
1831
- const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy-MM-dd');
1885
+ const yyyyMM = XEUtils.toDateString(dateObj.date, renderFormat);
1832
1886
  indexMaps[yyyyMM] = i;
1833
1887
  });
1834
1888
  return (startValue, endValue) => {
1835
- const startDate = parseStringDate(startValue);
1836
- const endDate = parseStringDate(endValue);
1837
- const startStr = XEUtils.toDateString(startDate, 'yyyy-MM-dd');
1889
+ const startValDate = parseStringDate(startValue);
1890
+ const endValDate = parseStringDate(endValue);
1891
+ const startStr = XEUtils.toDateString(startValDate, renderFormat);
1892
+ const startDate = showActualProgress ? startValDate : XEUtils.getWhatDay(startValDate, 0, 'first');
1838
1893
  const startFirstDate = XEUtils.getWhatDay(startDate, 0, 'first');
1839
- const endStr = XEUtils.toDateString(endDate, 'yyyy-MM-dd');
1894
+ const endStr = XEUtils.toDateString(endValDate, renderFormat);
1895
+ const endDate = showActualProgress ? endValDate : XEUtils.getWhatDay(endValDate, 0, 'last');
1840
1896
  const endFirstDate = XEUtils.getWhatDay(endDate, 0, 'first');
1841
- const minuteSize = Math.floor((XEUtils.getWhatDay(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / minuteMs);
1842
- // 开始和结束时间是否存在偏移时
1843
- const startSubtract = (startDate.getTime() - startFirstDate.getTime()) / minuteMs / minuteSize;
1844
- const endSubtract = (endDate.getTime() - endFirstDate.getTime()) / minuteMs / minuteSize;
1845
- const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / minuteMs + 1) / minuteSize;
1846
- const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtract;
1847
- // 如果最小轴为天,当存在时分秒时,在当前单元格内渲染维度;如果不存在,则填充满单元格
1897
+ // 当前是天维度,当指定解析格式精确到时分秒豪秒时,显示实际进度
1898
+ let startSubtractSize = 0;
1899
+ let endSubtractSize = 1;
1900
+ if (showActualProgress) {
1901
+ startSubtractSize = (startDate.getTime() - startFirstDate.getTime()) / dayMs;
1902
+ endSubtractSize = (endDate.getTime() - endFirstDate.getTime()) / dayMs;
1903
+ }
1904
+ const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtractSize;
1848
1905
  return {
1849
1906
  offsetLeftSize,
1850
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + (startSubtract || endSubtract ? 0 : 1)
1907
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + endSubtractSize
1851
1908
  };
1852
1909
  };
1853
1910
  }
1854
1911
  case 'hour': {
1912
+ const renderFormat = 'yyyy-MM-dd HH';
1913
+ const showActualProgress = /mm|ss|S/.test(dateFormat);
1855
1914
  const indexMaps = {};
1856
1915
  fullCols.forEach(({ dateObj }, i) => {
1857
- const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy-MM-dd HH');
1916
+ const yyyyMM = XEUtils.toDateString(dateObj.date, renderFormat);
1858
1917
  indexMaps[yyyyMM] = i;
1859
1918
  });
1860
1919
  return (startValue, endValue) => {
1861
- const startDate = parseStringDate(startValue);
1862
- const endDate = parseStringDate(endValue);
1863
- const startStr = XEUtils.toDateString(startDate, 'yyyy-MM-dd HH');
1920
+ const startValDate = parseStringDate(startValue);
1921
+ const endValDate = parseStringDate(endValue);
1922
+ const startStr = XEUtils.toDateString(startValDate, renderFormat);
1923
+ const startDate = showActualProgress ? startValDate : XEUtils.getWhatHours(startValDate, 0, 'first');
1864
1924
  const startFirstDate = XEUtils.getWhatHours(startDate, 0, 'first');
1865
- const endStr = XEUtils.toDateString(endDate, 'yyyy-MM-dd HH');
1925
+ const endStr = XEUtils.toDateString(endValDate, renderFormat);
1926
+ const endDate = showActualProgress ? endValDate : XEUtils.getWhatHours(endValDate, 0, 'last');
1866
1927
  const endFirstDate = XEUtils.getWhatHours(endDate, 0, 'first');
1867
- const minuteSize = Math.floor((XEUtils.getWhatHours(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / minuteMs);
1868
- // 开始和结束时间是否存在偏移时
1869
- const startSubtract = (startDate.getTime() - startFirstDate.getTime()) / minuteMs / minuteSize;
1870
- const endSubtract = (endDate.getTime() - endFirstDate.getTime()) / minuteMs / minuteSize;
1871
- const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / minuteMs + 1) / minuteSize;
1872
- const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtract;
1928
+ // 当前是小时维度,当指定解析格式精确到分秒豪秒时,显示实际进度
1929
+ let startSubtractSize = 0;
1930
+ let endSubtractSize = 1;
1931
+ if (showActualProgress) {
1932
+ startSubtractSize = (startDate.getTime() - startFirstDate.getTime()) / hourMs;
1933
+ endSubtractSize = (endDate.getTime() - endFirstDate.getTime()) / hourMs;
1934
+ }
1935
+ const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtractSize;
1873
1936
  return {
1874
1937
  offsetLeftSize,
1875
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize + (startSubtract || endSubtract ? 0 : 1)
1938
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + endSubtractSize
1876
1939
  };
1877
1940
  };
1878
1941
  }
1879
1942
  case 'minute': {
1943
+ const renderFormat = 'yyyy-MM-dd HH:mm';
1944
+ const showActualProgress = /ss|S/.test(dateFormat);
1880
1945
  const indexMaps = {};
1881
1946
  fullCols.forEach(({ dateObj }, i) => {
1882
- const yyyyMM = XEUtils.toDateString(dateObj.date, 'yyyy-MM-dd HH:mm');
1947
+ const yyyyMM = XEUtils.toDateString(dateObj.date, renderFormat);
1883
1948
  indexMaps[yyyyMM] = i;
1884
1949
  });
1885
1950
  return (startValue, endValue) => {
1886
- const startDate = parseStringDate(startValue);
1887
- const endDate = parseStringDate(endValue);
1888
- const startStr = XEUtils.toDateString(startDate, 'yyyy-MM-dd HH:mm');
1951
+ const startValDate = parseStringDate(startValue);
1952
+ const endValDate = parseStringDate(endValue);
1953
+ const startStr = XEUtils.toDateString(startValDate, renderFormat);
1954
+ const startDate = showActualProgress ? startValDate : XEUtils.getWhatMinutes(startValDate, 0, 'first');
1889
1955
  const startFirstDate = XEUtils.getWhatMinutes(startDate, 0, 'first');
1890
- const endStr = XEUtils.toDateString(endDate, 'yyyy-MM-dd HH:mm');
1956
+ const endStr = XEUtils.toDateString(endValDate, renderFormat);
1957
+ const endDate = showActualProgress ? endValDate : XEUtils.getWhatMinutes(endValDate, 0, 'last');
1891
1958
  const endFirstDate = XEUtils.getWhatMinutes(endDate, 0, 'first');
1892
- const minuteSize = Math.floor((XEUtils.getWhatMinutes(endDate, 1, 'first').getTime() - endFirstDate.getTime()) / minuteMs);
1893
- const subtract = (startDate.getTime() - startFirstDate.getTime()) / minuteMs / minuteSize;
1894
- const addSize = Math.max(0, (endDate.getTime() - endFirstDate.getTime()) / minuteMs + 1) / minuteSize;
1895
- const offsetLeftSize = (indexMaps[startStr] || 0) + subtract;
1959
+ // 当前是分钟维度,当指定解析格式精确到秒豪秒时,显示实际进度
1960
+ let startSubtractSize = 0;
1961
+ let endSubtractSize = 1;
1962
+ if (showActualProgress) {
1963
+ startSubtractSize = (startDate.getTime() - startFirstDate.getTime()) / minuteMs;
1964
+ endSubtractSize = (endDate.getTime() - endFirstDate.getTime()) / minuteMs;
1965
+ }
1966
+ const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtractSize;
1896
1967
  return {
1897
1968
  offsetLeftSize,
1898
- offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + addSize
1969
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + endSubtractSize
1899
1970
  };
1900
1971
  };
1901
1972
  }
1902
1973
  case 'second': {
1903
- const gapTime = getStandardGapTime(minScale.type);
1974
+ const renderFormat = 'yyyy-MM-dd HH:mm:ss';
1975
+ const showActualProgress = /S/.test(dateFormat);
1976
+ const indexMaps = {};
1977
+ fullCols.forEach(({ dateObj }, i) => {
1978
+ const yyyyMM = XEUtils.toDateString(dateObj.date, renderFormat);
1979
+ indexMaps[yyyyMM] = i;
1980
+ });
1904
1981
  return (startValue, endValue) => {
1905
- const startDate = parseStringDate(startValue);
1906
- const endDate = parseStringDate(endValue);
1907
- let offsetLeftSize = 0;
1908
- let offsetWidthSize = 0;
1909
- if (minViewDate) {
1910
- offsetLeftSize = (startDate.getTime() - minViewDate.getTime()) / gapTime;
1911
- offsetWidthSize = ((endDate.getTime() - startDate.getTime()) / gapTime);
1982
+ const startValDate = parseStringDate(startValue);
1983
+ const endValDate = parseStringDate(endValue);
1984
+ const startStr = XEUtils.toDateString(startValDate, renderFormat);
1985
+ const startDate = showActualProgress ? startValDate : XEUtils.getWhatSeconds(startValDate, 0, 'first');
1986
+ const startFirstDate = XEUtils.getWhatSeconds(startDate, 0, 'first');
1987
+ const endStr = XEUtils.toDateString(endValDate, renderFormat);
1988
+ const endDate = showActualProgress ? endValDate : XEUtils.getWhatSeconds(endValDate, 0, 'last');
1989
+ const endFirstDate = XEUtils.getWhatSeconds(endDate, 0, 'first');
1990
+ // 当前是秒维度,当指定解析格式精确到豪秒时,显示实际进度
1991
+ let startSubtractSize = 0;
1992
+ let endSubtractSize = 1;
1993
+ if (showActualProgress) {
1994
+ startSubtractSize = (startDate.getTime() - startFirstDate.getTime()) / secondMs;
1995
+ endSubtractSize = (endDate.getTime() - endFirstDate.getTime()) / secondMs;
1912
1996
  }
1997
+ const offsetLeftSize = (indexMaps[startStr] || 0) + startSubtractSize;
1913
1998
  return {
1914
1999
  offsetLeftSize,
1915
- offsetWidthSize
2000
+ offsetWidthSize: (indexMaps[endStr] || 0) - offsetLeftSize + endSubtractSize
1916
2001
  };
1917
2002
  };
1918
2003
  }
@@ -3009,6 +3094,7 @@ var GanttViewComponent = defineVxeComponent({
3009
3094
  }
3010
3095
  });
3011
3096
 
3097
+ const { warnLog, errLog } = createComponentLog('gantt');
3012
3098
  const { getConfig, getIcon, getI18n, commands, hooks, useFns, createEvent, globalEvents, GLOBAL_EVENT_KEYS, renderEmptyElement } = VxeUI;
3013
3099
  const tableProps = VxeTable.props;
3014
3100
  const tableComponentPropKeys = Object.keys(tableProps);
@@ -3204,6 +3290,11 @@ var VxeGanttComponent = defineVxeComponent({
3204
3290
  const computeTaskLinkOpts = computed(() => {
3205
3291
  return Object.assign({}, getConfig().gantt.taskLinkConfig, props.taskLinkConfig);
3206
3292
  });
3293
+ const computeDateFormat = computed(() => {
3294
+ const taskOpts = computeTaskOpts.value;
3295
+ const { dateFormat } = taskOpts;
3296
+ return dateFormat || '';
3297
+ });
3207
3298
  const computeScaleUnit = computed(() => {
3208
3299
  const minScale = computeMinScale.value;
3209
3300
  return minScale ? minScale.type : 'date';
@@ -3470,6 +3561,7 @@ var VxeGanttComponent = defineVxeComponent({
3470
3561
  computeTaskLinkOpts,
3471
3562
  computeTaskViewScales,
3472
3563
  computeScaleUnit,
3564
+ computeDateFormat,
3473
3565
  computeMinScale,
3474
3566
  computeWeekScale,
3475
3567
  computeTitleField,
@@ -4197,7 +4289,7 @@ var VxeGanttComponent = defineVxeComponent({
4197
4289
  });
4198
4290
  }
4199
4291
  else {
4200
- errLog('vxe.error.notFunc', ['[gantt] proxy-config.ajax.query']);
4292
+ errLog('vxe.error.notFunc', ['proxy-config.ajax.query']);
4201
4293
  }
4202
4294
  break;
4203
4295
  }
@@ -4237,7 +4329,7 @@ var VxeGanttComponent = defineVxeComponent({
4237
4329
  });
4238
4330
  }
4239
4331
  else {
4240
- errLog('vxe.error.notFunc', ['[gantt] proxy-config.ajax.queryFooter']);
4332
+ errLog('vxe.error.notFunc', ['proxy-config.ajax.queryFooter']);
4241
4333
  }
4242
4334
  break;
4243
4335
  }
@@ -4311,7 +4403,7 @@ var VxeGanttComponent = defineVxeComponent({
4311
4403
  }
4312
4404
  }
4313
4405
  else {
4314
- errLog('vxe.error.notFunc', ['[gantt] proxy-config.ajax.delete']);
4406
+ errLog('vxe.error.notFunc', ['proxy-config.ajax.delete']);
4315
4407
  }
4316
4408
  break;
4317
4409
  }
@@ -4398,7 +4490,7 @@ var VxeGanttComponent = defineVxeComponent({
4398
4490
  });
4399
4491
  }
4400
4492
  else {
4401
- errLog('vxe.error.notFunc', ['[gantt] proxy-config.ajax.save']);
4493
+ errLog('vxe.error.notFunc', ['proxy-config.ajax.save']);
4402
4494
  }
4403
4495
  break;
4404
4496
  }
@@ -4410,7 +4502,7 @@ var VxeGanttComponent = defineVxeComponent({
4410
4502
  tCommandMethod({ code, button, $table: $xeTable, $grid: null, $gantt: $xeGantt }, ...args);
4411
4503
  }
4412
4504
  else {
4413
- errLog('vxe.error.notCommands', [`[grid] ${code}`]);
4505
+ errLog('vxe.error.notCommands', [code]);
4414
4506
  }
4415
4507
  }
4416
4508
  }