vxe-gantt 4.1.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.umd.js CHANGED
@@ -2780,7 +2780,7 @@ var core_ = __webpack_require__(4345);
2780
2780
  const {
2781
2781
  log
2782
2782
  } = core_.VxeUI;
2783
- const version = `gantt v${"4.1.0"}`;
2783
+ const version = `gantt v${"4.1.1"}`;
2784
2784
  const warnLog = log.create('warn', version);
2785
2785
  const errLog = log.create('error', version);
2786
2786
  ;// ./packages/ui/index.ts
@@ -2791,7 +2791,7 @@ const {
2791
2791
  setIcon,
2792
2792
  checkVersion
2793
2793
  } = core_.VxeUI;
2794
- core_.VxeUI.ganttVersion = "4.1.0";
2794
+ core_.VxeUI.ganttVersion = "4.1.1";
2795
2795
  setConfig({
2796
2796
  gantt: {
2797
2797
  // size: null,
@@ -2830,6 +2830,9 @@ setConfig({
2830
2830
  // beforeSave: null,
2831
2831
  // afterSave: null
2832
2832
  },
2833
+ taskBarTooltipConfig: {
2834
+ enterable: true
2835
+ },
2833
2836
  taskViewScaleConfig: {
2834
2837
  week: {
2835
2838
  startDay: 1
@@ -3079,7 +3082,7 @@ function getFuncText(content, args) {
3079
3082
  return '';
3080
3083
  }
3081
3084
  function formatText(value, placeholder) {
3082
- return '' + (isEmptyValue(value) ? placeholder ? VxeUI.getConfig().emptyCell : '' : value);
3085
+ return '' + (isEmptyValue(value) ? placeholder ? core_.VxeUI.getConfig().emptyCell : '' : value);
3083
3086
  }
3084
3087
  /**
3085
3088
  * 判断值为:'' | null | undefined 时都属于空值
@@ -3297,7 +3300,7 @@ const tableEmits = ['update:data', 'keydown-start', 'keydown', 'keydown-end', 'p
3297
3300
  const gridEmits = [...tableEmits, 'page-change', 'form-submit', 'form-submit-invalid', 'form-reset', 'form-collapse', 'form-toggle-collapse', 'proxy-query', 'proxy-delete', 'proxy-save', 'toolbar-button-click', 'toolbar-tool-click', 'zoom'];
3298
3301
  ;// ./packages/gantt/src/emits.ts
3299
3302
 
3300
- const ganttEmits = [...gridEmits, 'task-cell-click', 'task-cell-dblclick', 'task-bar-click', 'task-bar-dblclick', 'task-view-cell-click', 'task-view-cell-dblclick'];
3303
+ const ganttEmits = [...gridEmits, 'task-cell-click', 'task-cell-dblclick', 'task-bar-mouseenter', 'task-bar-mouseleave', 'task-bar-click', 'task-bar-dblclick', 'task-view-cell-click', 'task-view-cell-dblclick'];
3301
3304
  ;// ./packages/gantt/src/util.ts
3302
3305
  function getRefElem(refEl) {
3303
3306
  if (refEl) {
@@ -3412,15 +3415,17 @@ const viewType = 'header';
3412
3415
  dateObj
3413
3416
  } = column;
3414
3417
  let label = `${column.title}`;
3415
- if ($rowIndex < headerGroups.length - 1) {
3416
- if (scaleItem.type === 'day') {
3417
- label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`);
3418
- } else {
3419
- label = getI18n(`vxe.gantt.${!$rowIndex && headerGroups.length > 1 ? 'tFullFormat' : 'tSimpleFormat'}.${type}`, dateObj);
3420
- }
3418
+ if (scaleItem.type === 'day') {
3419
+ label = getI18n(`vxe.gantt.dayss.w${dateObj.e}`);
3421
3420
  } else {
3422
- if (isLast && scaleItem.type === 'week') {
3421
+ if ($rowIndex) {
3423
3422
  label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, dateObj);
3423
+ } else {
3424
+ if (isLast && scaleItem.type === 'week') {
3425
+ label = getI18n(`vxe.gantt.tSimpleFormat.${type}`, dateObj);
3426
+ } else {
3427
+ label = getI18n(`vxe.gantt.tFullFormat.${type}`, dateObj);
3428
+ }
3424
3429
  }
3425
3430
  }
3426
3431
  let cellVNs = label;
@@ -3551,7 +3556,8 @@ const gantt_chart_viewType = 'chart';
3551
3556
  showContent,
3552
3557
  contentMethod,
3553
3558
  barStyle,
3554
- drag
3559
+ drag,
3560
+ showTooltip
3555
3561
  } = taskBarOpts;
3556
3562
  const isBarRowStyle = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(barStyle);
3557
3563
  const barStyObj = (barStyle ? isBarRowStyle ? barStyle(barParams) : barStyle : {}) || {};
@@ -3592,8 +3598,38 @@ const gantt_chart_viewType = 'chart';
3592
3598
  row,
3593
3599
  $rowIndex,
3594
3600
  rowIndex,
3595
- _rowIndex
3601
+ _rowIndex,
3602
+ $gantt: $xeGantt
3603
+ };
3604
+ const ons = {
3605
+ onClick(evnt) {
3606
+ $xeGantt.handleTaskBarClickEvent(evnt, barParams);
3607
+ },
3608
+ onDblclick(evnt) {
3609
+ $xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
3610
+ },
3611
+ onMousedown(evnt) {
3612
+ if ($xeGantt.handleTaskBarMousedownEvent) {
3613
+ $xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
3614
+ }
3615
+ }
3596
3616
  };
3617
+ if (showTooltip) {
3618
+ ons.onMouseover = evnt => {
3619
+ const ttParams = Object.assign({
3620
+ $event: evnt
3621
+ }, ctParams);
3622
+ $xeGantt.triggerTaskBarTooltipEvent(evnt, ttParams);
3623
+ $xeGantt.dispatchEvent('task-bar-mouseenter', ttParams, evnt);
3624
+ };
3625
+ ons.onMouseleave = evnt => {
3626
+ const ttParams = Object.assign({
3627
+ $event: evnt
3628
+ }, ctParams);
3629
+ $xeGantt.handleTaskBarTooltipLeaveEvent(evnt, ttParams);
3630
+ $xeGantt.dispatchEvent('task-bar-mouseleave', ttParams, evnt);
3631
+ };
3632
+ }
3597
3633
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
3598
3634
  key: treeConfig ? rowid : $rowIndex,
3599
3635
  rowid,
@@ -3612,17 +3648,7 @@ const gantt_chart_viewType = 'chart';
3612
3648
  class: taskBarSlot ? 'vxe-gantt-view--chart-custom-bar' : 'vxe-gantt-view--chart-bar',
3613
3649
  style: vbStyle,
3614
3650
  rowid,
3615
- onClick(evnt) {
3616
- $xeGantt.handleTaskBarClickEvent(evnt, barParams);
3617
- },
3618
- onDblclick(evnt) {
3619
- $xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
3620
- },
3621
- onMousedown(evnt) {
3622
- if ($xeGantt.handleTaskBarMousedownEvent) {
3623
- $xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
3624
- }
3625
- }
3651
+ ...ons
3626
3652
  }, taskBarSlot ? $xeGantt.callSlot(taskBarSlot, barParams) : [showProgress ? (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
3627
3653
  class: 'vxe-gantt-view--chart-progress',
3628
3654
  style: vpStyle
@@ -4439,7 +4465,7 @@ const maxYHeight = 5e6;
4439
4465
  if (minScale.level < 17) {
4440
4466
  handleData('quarter', colMaps, minCol);
4441
4467
  }
4442
- if (minScale.level < 14) {
4468
+ if (minScale.level < 15) {
4443
4469
  handleData('month', colMaps, minCol);
4444
4470
  }
4445
4471
  if (minScale.level < 13) {
@@ -4448,7 +4474,7 @@ const maxYHeight = 5e6;
4448
4474
  if (minScale.level < 11) {
4449
4475
  handleData('day', colMaps, minCol);
4450
4476
  }
4451
- if (minScale.level < 12) {
4477
+ if (minScale.level < 9) {
4452
4478
  handleData('date', colMaps, minCol);
4453
4479
  }
4454
4480
  if (minScale.level < 7) {
@@ -4457,6 +4483,9 @@ const maxYHeight = 5e6;
4457
4483
  if (minScale.level < 5) {
4458
4484
  handleData('minute', colMaps, minCol);
4459
4485
  }
4486
+ if (minScale.level < 3) {
4487
+ handleData('second', colMaps, minCol);
4488
+ }
4460
4489
  fullCols.push(minCol);
4461
4490
  }
4462
4491
  taskScaleList.forEach(scaleItem => {
@@ -5787,6 +5816,7 @@ function gantt_createInternalData() {
5787
5816
  return {
5788
5817
  uFoot: false,
5789
5818
  resizeTableWidth: 0
5819
+ // barTipTimeout: undefined
5790
5820
  };
5791
5821
  }
5792
5822
  const viewTypeLevelMaps = {
@@ -5819,6 +5849,7 @@ function getViewTypeLevel(type) {
5819
5849
  taskViewScaleConfig: Object,
5820
5850
  taskViewConfig: Object,
5821
5851
  taskBarConfig: Object,
5852
+ taskBarTooltipConfig: Object,
5822
5853
  taskSplitConfig: Object,
5823
5854
  taskBarResizeConfig: Object,
5824
5855
  taskBarDragConfig: Object,
@@ -5839,6 +5870,7 @@ function getViewTypeLevel(type) {
5839
5870
  const VxeUIPagerComponent = core_.VxeUI.getComponent('VxePager');
5840
5871
  const VxeTableComponent = core_.VxeUI.getComponent('VxeTable');
5841
5872
  const VxeToolbarComponent = core_.VxeUI.getComponent('VxeToolbar');
5873
+ const VxeUITooltipComponent = core_.VxeUI.getComponent('VxeTooltip');
5842
5874
  const {
5843
5875
  computeSize
5844
5876
  } = useFns.useSize(props);
@@ -5859,7 +5891,13 @@ function getViewTypeLevel(type) {
5859
5891
  },
5860
5892
  showLeftView: true,
5861
5893
  showRightView: true,
5862
- taskScaleList: []
5894
+ taskScaleList: [],
5895
+ barTipStore: {
5896
+ row: null,
5897
+ content: '',
5898
+ visible: false,
5899
+ params: null
5900
+ }
5863
5901
  });
5864
5902
  const internalData = gantt_createInternalData();
5865
5903
  const refElem = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
@@ -5878,6 +5916,7 @@ function getViewTypeLevel(type) {
5878
5916
  const refPagerWrapper = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
5879
5917
  const refTableWrapper = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
5880
5918
  const refGanttWrapper = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
5919
+ const refTooltip = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
5881
5920
  const refResizableSplitTip = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.ref)();
5882
5921
  const extendTableMethods = methodKeys => {
5883
5922
  const funcs = {};
@@ -5944,6 +5983,9 @@ function getViewTypeLevel(type) {
5944
5983
  const computeTaskSplitOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
5945
5984
  return Object.assign({}, getConfig().gantt.taskSplitConfig, props.taskSplitConfig);
5946
5985
  });
5986
+ const computeTaskBarTooltipOpts = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
5987
+ return Object.assign({}, getConfig().gantt.taskBarTooltipConfig, props.taskBarTooltipConfig);
5988
+ });
5947
5989
  const computeScaleUnit = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
5948
5990
  const minScale = computeMinScale.value;
5949
5991
  return minScale ? minScale.type : 'date';
@@ -5960,7 +6002,7 @@ function getViewTypeLevel(type) {
5960
6002
  } = reactData;
5961
6003
  return taskScaleList.find(item => item.type === 'week');
5962
6004
  });
5963
- const computeTaskScaleConfs = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
6005
+ const computeTaskViewScales = (0,external_commonjs_vue_commonjs2_vue_root_Vue_.computed)(() => {
5964
6006
  const taskViewOpts = computeTaskViewOpts.value;
5965
6007
  const {
5966
6008
  scales
@@ -6220,7 +6262,8 @@ function getViewTypeLevel(type) {
6220
6262
  computeTaskBarDragOpts,
6221
6263
  computeTaskBarResizeOpts,
6222
6264
  computeTaskSplitOpts,
6223
- computeTaskScaleConfs,
6265
+ computeTaskBarTooltipOpts,
6266
+ computeTaskViewScales,
6224
6267
  computeScaleUnit,
6225
6268
  computeMinScale,
6226
6269
  computeWeekScale,
@@ -6232,6 +6275,7 @@ function getViewTypeLevel(type) {
6232
6275
  computeScrollbarXToTop,
6233
6276
  computeScrollbarYToLeft
6234
6277
  };
6278
+ computeMaps.computeTaskScaleConfs = computeTaskViewScales;
6235
6279
  const $xeGantt = {
6236
6280
  xID,
6237
6281
  props: props,
@@ -6242,7 +6286,7 @@ function getViewTypeLevel(type) {
6242
6286
  getComputeMaps: () => computeMaps
6243
6287
  };
6244
6288
  const handleTaskScaleConfig = () => {
6245
- const taskScaleConfs = computeTaskScaleConfs.value;
6289
+ const taskScaleConfs = computeTaskViewScales.value;
6246
6290
  const taskViewScaleOpts = computeTaskViewScaleOpts.value;
6247
6291
  const scaleConfs = [];
6248
6292
  if (taskScaleConfs) {
@@ -6779,6 +6823,17 @@ function getViewTypeLevel(type) {
6779
6823
  $gantt: $xeGantt
6780
6824
  }, params));
6781
6825
  };
6826
+ const handleTargetEnterEvent = isClear => {
6827
+ const $tooltip = refTooltip.value;
6828
+ clearTimeout(internalData.barTipTimeout);
6829
+ if (isClear) {
6830
+ $xeGantt.closeTaskBarTooltip();
6831
+ } else {
6832
+ if ($tooltip && $tooltip.setActived) {
6833
+ $tooltip.setActived(true);
6834
+ }
6835
+ }
6836
+ };
6782
6837
  const ganttMethods = {
6783
6838
  dispatchEvent,
6784
6839
  getEl() {
@@ -7514,6 +7569,27 @@ function getViewTypeLevel(type) {
7514
7569
  hideTaskView() {
7515
7570
  reactData.showRightView = false;
7516
7571
  return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
7572
+ },
7573
+ /**
7574
+ * 关闭 bar tooltip
7575
+ */
7576
+ closeTaskBarTooltip() {
7577
+ const {
7578
+ barTipStore
7579
+ } = reactData;
7580
+ const $tooltip = refTooltip.value;
7581
+ if (barTipStore.visible) {
7582
+ Object.assign(barTipStore, {
7583
+ row: null,
7584
+ content: null,
7585
+ visible: false,
7586
+ params: {}
7587
+ });
7588
+ if ($tooltip && $tooltip.close) {
7589
+ $tooltip.close();
7590
+ }
7591
+ }
7592
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();
7517
7593
  }
7518
7594
  };
7519
7595
  const ganttPrivateMethods = {
@@ -7659,6 +7735,58 @@ function getViewTypeLevel(type) {
7659
7735
  handleTaskBarDblclickEvent(evnt, params) {
7660
7736
  $xeGantt.dispatchEvent('task-bar-dblclick', params, evnt);
7661
7737
  },
7738
+ triggerTaskBarTooltipEvent(evnt, params) {
7739
+ const {
7740
+ barTipStore
7741
+ } = reactData;
7742
+ const taskBarTooltipOpts = computeTaskBarTooltipOpts.value;
7743
+ const titleField = computeTitleField.value;
7744
+ const {
7745
+ contentMethod
7746
+ } = taskBarTooltipOpts;
7747
+ const {
7748
+ row
7749
+ } = params;
7750
+ let content = formatText(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, titleField));
7751
+ if (contentMethod) {
7752
+ content = formatText(contentMethod(params));
7753
+ }
7754
+ handleTargetEnterEvent(barTipStore.row !== row);
7755
+ const tipContent = formatText(content);
7756
+ Object.assign(barTipStore, {
7757
+ row,
7758
+ visible: true,
7759
+ content: tipContent,
7760
+ params
7761
+ });
7762
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)(() => {
7763
+ const $tooltip = refTooltip.value;
7764
+ if ($tooltip) {
7765
+ if ($tooltip.openByEvent) {
7766
+ $tooltip.openByEvent(evnt, evnt.currentTarget, tipContent);
7767
+ } else if ($tooltip.open) {
7768
+ $tooltip.open(evnt.currentTarget, tipContent);
7769
+ }
7770
+ }
7771
+ });
7772
+ },
7773
+ handleTaskBarTooltipLeaveEvent() {
7774
+ const taskBarTooltipOpts = computeTaskBarTooltipOpts.value;
7775
+ let $tooltip = refTooltip.value;
7776
+ if ($tooltip && $tooltip.setActived) {
7777
+ $tooltip.setActived(false);
7778
+ }
7779
+ if (taskBarTooltipOpts.enterable) {
7780
+ internalData.barTipTimeout = setTimeout(() => {
7781
+ $tooltip = refTooltip.value;
7782
+ if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
7783
+ $xeGantt.closeTaskBarTooltip();
7784
+ }
7785
+ }, taskBarTooltipOpts.leaveDelay);
7786
+ } else {
7787
+ $xeGantt.closeTaskBarTooltip();
7788
+ }
7789
+ },
7662
7790
  handleTaskHeaderContextmenuEvent(evnt, params) {
7663
7791
  const $xeTable = refTable.value;
7664
7792
  if ($xeTable) {
@@ -8112,14 +8240,19 @@ function getViewTypeLevel(type) {
8112
8240
  return childVNs;
8113
8241
  };
8114
8242
  const renderLayout = () => {
8243
+ const {
8244
+ barTipStore
8245
+ } = reactData;
8115
8246
  const currLayoutConf = computeCurrLayoutConf.value;
8116
8247
  const {
8117
8248
  headKeys,
8118
8249
  bodyKeys,
8119
8250
  footKeys
8120
8251
  } = currLayoutConf;
8252
+ const taskBarTooltipOpts = computeTaskBarTooltipOpts.value;
8121
8253
  const asideLeftSlot = slots.asideLeft || slots['aside-left'];
8122
8254
  const asideRightSlot = slots.asideRight || slots['aside-right'];
8255
+ const taskBarTooltipSlot = slots.taskBarTooltip || slots['task-bar-tooltip'];
8123
8256
  return [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
8124
8257
  class: 'vxe-gantt--layout-header-wrapper'
8125
8258
  }, renderChildLayout(headKeys)), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
@@ -8134,7 +8267,40 @@ function getViewTypeLevel(type) {
8134
8267
  class: 'vxe-gantt--layout-footer-wrapper'
8135
8268
  }, renderChildLayout(footKeys)), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {
8136
8269
  ref: refPopupContainerElem
8137
- })];
8270
+ }), (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {}, [
8271
+ /**
8272
+ * 任务条提示
8273
+ */
8274
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)(VxeUITooltipComponent, {
8275
+ key: 'gtp',
8276
+ ref: refTooltip,
8277
+ theme: taskBarTooltipOpts.theme,
8278
+ enterable: taskBarTooltipOpts.enterable,
8279
+ enterDelay: taskBarTooltipOpts.enterDelay,
8280
+ leaveDelay: taskBarTooltipOpts.leaveDelay,
8281
+ useHTML: taskBarTooltipOpts.useHTML,
8282
+ width: taskBarTooltipOpts.width,
8283
+ height: taskBarTooltipOpts.height,
8284
+ minWidth: taskBarTooltipOpts.minWidth,
8285
+ minHeight: taskBarTooltipOpts.minHeight,
8286
+ maxWidth: taskBarTooltipOpts.maxWidth,
8287
+ maxHeight: taskBarTooltipOpts.maxHeight,
8288
+ isArrow: false
8289
+ }, taskBarTooltipSlot ? {
8290
+ content: () => {
8291
+ const {
8292
+ row,
8293
+ content: tooltipContent
8294
+ } = barTipStore;
8295
+ if (row) {
8296
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('div', {}, taskBarTooltipSlot(Object.assign({
8297
+ tooltipContent,
8298
+ $gantt: $xeGantt
8299
+ }, barTipStore.params)));
8300
+ }
8301
+ return gantt_renderEmptyElement($xeGantt);
8302
+ }
8303
+ } : {})])];
8138
8304
  };
8139
8305
  const renderVN = () => {
8140
8306
  const {
@@ -8185,7 +8351,7 @@ function getViewTypeLevel(type) {
8185
8351
  (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(() => props.proxyConfig, () => {
8186
8352
  initProxy();
8187
8353
  });
8188
- (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(computeTaskScaleConfs, () => {
8354
+ (0,external_commonjs_vue_commonjs2_vue_root_Vue_.watch)(computeTaskViewScales, () => {
8189
8355
  handleTaskScaleConfig();
8190
8356
  $xeGantt.refreshTaskView();
8191
8357
  });