vxe-gantt 3.1.0 → 3.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
@@ -8182,7 +8182,7 @@ var core_ = __webpack_require__(4345);
8182
8182
  ;// ./packages/ui/src/log.ts
8183
8183
 
8184
8184
  var log = core_.VxeUI.log;
8185
- var version = "gantt v".concat("3.1.0");
8185
+ var version = "gantt v".concat("3.1.1");
8186
8186
  var warnLog = log.create('warn', version);
8187
8187
  var errLog = log.create('error', version);
8188
8188
  ;// ./packages/ui/index.ts
@@ -8192,7 +8192,7 @@ var errLog = log.create('error', version);
8192
8192
  var setConfig = core_.VxeUI.setConfig,
8193
8193
  setIcon = core_.VxeUI.setIcon,
8194
8194
  checkVersion = core_.VxeUI.checkVersion;
8195
- core_.VxeUI.ganttVersion = "3.1.0";
8195
+ core_.VxeUI.ganttVersion = "3.1.1";
8196
8196
  setConfig({
8197
8197
  gantt: {
8198
8198
  // size: null,
@@ -8231,6 +8231,9 @@ setConfig({
8231
8231
  // beforeSave: null,
8232
8232
  // afterSave: null
8233
8233
  },
8234
+ taskBarTooltipConfig: {
8235
+ enterable: true
8236
+ },
8234
8237
  taskViewScaleConfig: {
8235
8238
  week: {
8236
8239
  startDay: 1
@@ -8714,6 +8717,9 @@ var getConfig = core_.VxeUI.getConfig;
8714
8717
  function isEnableConf(conf) {
8715
8718
  return conf && conf.enabled !== false;
8716
8719
  }
8720
+ function isEmptyValue(cellValue) {
8721
+ return cellValue === null || cellValue === undefined || cellValue === '';
8722
+ }
8717
8723
  function nextZIndex() {
8718
8724
  return index_esm.getNext();
8719
8725
  }
@@ -8739,6 +8745,9 @@ function getFuncText(content, args) {
8739
8745
  }
8740
8746
  return '';
8741
8747
  }
8748
+ function formatText(value, placeholder) {
8749
+ return '' + (isEmptyValue(value) ? placeholder ? core_.VxeUI.getConfig().emptyCell : '' : value);
8750
+ }
8742
8751
  /**
8743
8752
  * 判断值为:'' | null | undefined 时都属于空值
8744
8753
  */
@@ -9000,7 +9009,6 @@ function getStandardGapTime(type) {
9000
9009
 
9001
9010
 
9002
9011
 
9003
-
9004
9012
  var getI18n = core_.VxeUI.getI18n;
9005
9013
  var sourceType = 'gantt';
9006
9014
  var viewType = 'header';
@@ -9071,15 +9079,17 @@ var viewType = 'header';
9071
9079
  childCount = column.childCount,
9072
9080
  dateObj = column.dateObj;
9073
9081
  var label = "".concat(column.title);
9074
- if ($rowIndex < headerGroups.length - 1) {
9075
- if (scaleItem.type === 'day') {
9076
- label = getI18n("vxe.gantt.dayss.w".concat(dateObj.e));
9077
- } else {
9078
- label = getI18n("vxe.gantt.".concat(!$rowIndex && headerGroups.length > 1 ? 'tFullFormat' : 'tSimpleFormat', ".").concat(type), dateObj);
9079
- }
9082
+ if (scaleItem.type === 'day') {
9083
+ label = getI18n("vxe.gantt.dayss.w".concat(dateObj.e));
9080
9084
  } else {
9081
- if (isLast && scaleItem.type === 'week') {
9085
+ if ($rowIndex) {
9082
9086
  label = getI18n("vxe.gantt.tSimpleFormat.".concat(type), dateObj);
9087
+ } else {
9088
+ if (isLast && scaleItem.type === 'week') {
9089
+ label = getI18n("vxe.gantt.tSimpleFormat.".concat(type), dateObj);
9090
+ } else {
9091
+ label = getI18n("vxe.gantt.tFullFormat.".concat(type), dateObj);
9092
+ }
9083
9093
  }
9084
9094
  }
9085
9095
  var cellVNs = label;
@@ -9166,6 +9176,7 @@ var viewType = 'header';
9166
9176
 
9167
9177
 
9168
9178
 
9179
+
9169
9180
  var renderEmptyElement = core_.VxeUI.renderEmptyElement;
9170
9181
  var gantt_chart_sourceType = 'gantt';
9171
9182
  var gantt_chart_viewType = 'chart';
@@ -9213,7 +9224,8 @@ var gantt_chart_viewType = 'chart';
9213
9224
  showContent = taskBarOpts.showContent,
9214
9225
  contentMethod = taskBarOpts.contentMethod,
9215
9226
  barStyle = taskBarOpts.barStyle,
9216
- drag = taskBarOpts.drag;
9227
+ drag = taskBarOpts.drag,
9228
+ showTooltip = taskBarOpts.showTooltip;
9217
9229
  var isBarRowStyle = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(barStyle);
9218
9230
  var barStyObj = (barStyle ? isBarRowStyle ? barStyle(barParams) : barStyle : {}) || {};
9219
9231
  var round = barStyObj.round;
@@ -9249,8 +9261,34 @@ var gantt_chart_viewType = 'chart';
9249
9261
  row: row,
9250
9262
  $rowIndex: $rowIndex,
9251
9263
  rowIndex: rowIndex,
9252
- _rowIndex: _rowIndex
9264
+ _rowIndex: _rowIndex,
9265
+ $gantt: $xeGantt
9266
+ };
9267
+ var ons = {
9268
+ click: function click(evnt) {
9269
+ $xeGantt.handleTaskBarClickEvent(evnt, barParams);
9270
+ },
9271
+ dblclick: function dblclick(evnt) {
9272
+ $xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
9273
+ },
9274
+ mousedown: function mousedown(evnt) {
9275
+ if ($xeGantt.handleTaskBarMousedownEvent) {
9276
+ $xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
9277
+ }
9278
+ }
9253
9279
  };
9280
+ if (showTooltip) {
9281
+ ons.mouseover = function (evnt) {
9282
+ $xeGantt.triggerTaskBarTooltipEvent(evnt, Object.assign({
9283
+ $event: evnt
9284
+ }, ctParams));
9285
+ };
9286
+ ons.mouseleave = function (evnt) {
9287
+ $xeGantt.handleTaskBarTooltipLeaveEvent(evnt, Object.assign({
9288
+ $event: evnt
9289
+ }, ctParams));
9290
+ };
9291
+ }
9254
9292
  return h('div', {
9255
9293
  key: treeConfig ? rowid : $rowIndex,
9256
9294
  attrs: {
@@ -9275,19 +9313,7 @@ var gantt_chart_viewType = 'chart';
9275
9313
  attrs: {
9276
9314
  rowid: rowid
9277
9315
  },
9278
- on: {
9279
- click: function click(evnt) {
9280
- $xeGantt.handleTaskBarClickEvent(evnt, barParams);
9281
- },
9282
- dblclick: function dblclick(evnt) {
9283
- $xeGantt.handleTaskBarDblclickEvent(evnt, barParams);
9284
- },
9285
- mousedown: function mousedown(evnt) {
9286
- if ($xeGantt.handleTaskBarMousedownEvent) {
9287
- $xeGantt.handleTaskBarMousedownEvent(evnt, barParams);
9288
- }
9289
- }
9290
- }
9316
+ on: ons
9291
9317
  }, taskBarSlot ? $xeGantt.callSlot(taskBarSlot, barParams, h) : [showProgress ? h('div', {
9292
9318
  class: 'vxe-gantt-view--chart-progress',
9293
9319
  style: vpStyle
@@ -9976,7 +10002,7 @@ function handleColumnHeader($xeGanttView) {
9976
10002
  if (minScale.level < 17) {
9977
10003
  handleData('quarter', colMaps, minCol);
9978
10004
  }
9979
- if (minScale.level < 14) {
10005
+ if (minScale.level < 15) {
9980
10006
  handleData('month', colMaps, minCol);
9981
10007
  }
9982
10008
  if (minScale.level < 13) {
@@ -9985,7 +10011,7 @@ function handleColumnHeader($xeGanttView) {
9985
10011
  if (minScale.level < 11) {
9986
10012
  handleData('day', colMaps, minCol);
9987
10013
  }
9988
- if (minScale.level < 12) {
10014
+ if (minScale.level < 9) {
9989
10015
  handleData('date', colMaps, minCol);
9990
10016
  }
9991
10017
  if (minScale.level < 7) {
@@ -9994,6 +10020,9 @@ function handleColumnHeader($xeGanttView) {
9994
10020
  if (minScale.level < 5) {
9995
10021
  handleData('minute', colMaps, minCol);
9996
10022
  }
10023
+ if (minScale.level < 3) {
10024
+ handleData('second', colMaps, minCol);
10025
+ }
9997
10026
  fullCols.push(minCol);
9998
10027
  }
9999
10028
  taskScaleList.forEach(function (scaleItem) {
@@ -11485,6 +11514,7 @@ function gantt_createInternalData() {
11485
11514
  return {
11486
11515
  uFoot: false,
11487
11516
  resizeTableWidth: 0
11517
+ // barTipTimeout: undefined
11488
11518
  };
11489
11519
  }
11490
11520
  /* harmony default export */ var gantt = (/* define-vxe-component start */defineVxeComponent({
@@ -11502,6 +11532,7 @@ function gantt_createInternalData() {
11502
11532
  taskViewScaleConfig: Object,
11503
11533
  taskViewConfig: Object,
11504
11534
  taskBarConfig: Object,
11535
+ taskBarTooltipConfig: Object,
11505
11536
  taskSplitConfig: Object,
11506
11537
  taskBarResizeConfig: Object,
11507
11538
  taskBarDragConfig: Object,
@@ -11540,7 +11571,13 @@ function gantt_createInternalData() {
11540
11571
  },
11541
11572
  showLeftView: true,
11542
11573
  showRightView: true,
11543
- taskScaleList: []
11574
+ taskScaleList: [],
11575
+ barTipStore: {
11576
+ row: null,
11577
+ content: '',
11578
+ visible: false,
11579
+ params: null
11580
+ }
11544
11581
  };
11545
11582
  var internalData = gantt_createInternalData();
11546
11583
  return {
@@ -11620,6 +11657,11 @@ function gantt_createInternalData() {
11620
11657
  var props = $xeGantt;
11621
11658
  return Object.assign({}, gantt_getConfig().gantt.taskSplitConfig, props.taskSplitConfig);
11622
11659
  },
11660
+ computeTaskBarTooltipOpts: function computeTaskBarTooltipOpts() {
11661
+ var $xeGantt = this;
11662
+ var props = $xeGantt;
11663
+ return Object.assign({}, gantt_getConfig().gantt.taskBarTooltipConfig, props.taskBarTooltipConfig);
11664
+ },
11623
11665
  computeScaleUnit: function computeScaleUnit() {
11624
11666
  var $xeGantt = this;
11625
11667
  var minScale = $xeGantt.computeMinScale;
@@ -11639,12 +11681,19 @@ function gantt_createInternalData() {
11639
11681
  return item.type === 'week';
11640
11682
  });
11641
11683
  },
11642
- computeTaskScaleConfs: function computeTaskScaleConfs() {
11684
+ computeTaskViewScales: function computeTaskViewScales() {
11643
11685
  var $xeGantt = this;
11644
11686
  var taskViewOpts = $xeGantt.computeTaskViewOpts;
11645
11687
  var scales = taskViewOpts.scales;
11646
11688
  return scales;
11647
11689
  },
11690
+ /**
11691
+ * 已废弃,保留兼容
11692
+ * @deprecated
11693
+ */
11694
+ computeTaskScaleConfs: function computeTaskScaleConfs() {
11695
+ return this.computeTaskViewScales;
11696
+ },
11648
11697
  computeTitleField: function computeTitleField() {
11649
11698
  var $xeGantt = this;
11650
11699
  var taskOpts = $xeGantt.computeTaskOpts;
@@ -11902,7 +11951,7 @@ function gantt_createInternalData() {
11902
11951
  var $xeGantt = this;
11903
11952
  $xeGantt.initProxy();
11904
11953
  },
11905
- computeTaskScaleConfs: function computeTaskScaleConfs() {
11954
+ computeTaskViewScales: function computeTaskViewScales() {
11906
11955
  var $xeGantt = this;
11907
11956
  $xeGantt.handleTaskScaleConfig();
11908
11957
  $xeGantt.refreshTaskView();
@@ -11919,7 +11968,7 @@ function gantt_createInternalData() {
11919
11968
  handleTaskScaleConfig: function handleTaskScaleConfig() {
11920
11969
  var $xeGantt = this;
11921
11970
  var reactData = $xeGantt.reactData;
11922
- var taskScaleConfs = $xeGantt.computeTaskScaleConfs;
11971
+ var taskScaleConfs = $xeGantt.computeTaskViewScales;
11923
11972
  var taskViewScaleOpts = $xeGantt.computeTaskViewScaleOpts;
11924
11973
  var scaleConfs = [];
11925
11974
  if (taskScaleConfs) {
@@ -13152,6 +13201,27 @@ function gantt_createInternalData() {
13152
13201
  reactData.showRightView = false;
13153
13202
  return $xeGantt.$nextTick();
13154
13203
  },
13204
+ /**
13205
+ * 关闭 bar tooltip
13206
+ */
13207
+ closeTaskBarTooltip: function closeTaskBarTooltip() {
13208
+ var $xeGantt = this;
13209
+ var reactData = $xeGantt.reactData;
13210
+ var barTipStore = reactData.barTipStore;
13211
+ var $tooltip = $xeGantt.$refs.refTooltip;
13212
+ if (barTipStore.visible) {
13213
+ Object.assign(barTipStore, {
13214
+ row: null,
13215
+ content: null,
13216
+ visible: false,
13217
+ params: {}
13218
+ });
13219
+ if ($tooltip && $tooltip.close) {
13220
+ $tooltip.close();
13221
+ }
13222
+ }
13223
+ return $xeGantt.$nextTick();
13224
+ },
13155
13225
  callSlot: function callSlot(slotFunc, params, h) {
13156
13226
  var $xeGantt = this;
13157
13227
  var slots = $xeGantt.$scopedSlots;
@@ -13286,6 +13356,69 @@ function gantt_createInternalData() {
13286
13356
  var $xeGantt = this;
13287
13357
  $xeGantt.dispatchEvent('task-bar-dblclick', params, evnt);
13288
13358
  },
13359
+ triggerTaskBarTooltipEvent: function triggerTaskBarTooltipEvent(evnt, params) {
13360
+ var $xeGantt = this;
13361
+ var reactData = $xeGantt.reactData;
13362
+ var barTipStore = reactData.barTipStore;
13363
+ var taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts;
13364
+ var titleField = $xeGantt.computeTitleField;
13365
+ var contentMethod = taskBarTooltipOpts.contentMethod;
13366
+ var row = params.row;
13367
+ var content = formatText(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row, titleField));
13368
+ if (contentMethod) {
13369
+ content = formatText(contentMethod(params));
13370
+ }
13371
+ $xeGantt.handleTargetEnterEvent(barTipStore.row !== row);
13372
+ var tipContent = formatText(content);
13373
+ Object.assign(barTipStore, {
13374
+ row: row,
13375
+ visible: true,
13376
+ content: tipContent,
13377
+ params: params
13378
+ });
13379
+ $xeGantt.$nextTick(function () {
13380
+ var $tooltip = $xeGantt.$refs.refTooltip;
13381
+ if ($tooltip) {
13382
+ if ($tooltip.openByEvent) {
13383
+ $tooltip.openByEvent(evnt, evnt.currentTarget, tipContent);
13384
+ } else if ($tooltip.open) {
13385
+ $tooltip.open(evnt.currentTarget, tipContent);
13386
+ }
13387
+ }
13388
+ });
13389
+ },
13390
+ handleTargetEnterEvent: function handleTargetEnterEvent(isClear) {
13391
+ var $xeGantt = this;
13392
+ var internalData = $xeGantt.internalData;
13393
+ var $tooltip = $xeGantt.$refs.refTooltip;
13394
+ clearTimeout(internalData.barTipTimeout);
13395
+ if (isClear) {
13396
+ $xeGantt.closeTaskBarTooltip();
13397
+ } else {
13398
+ if ($tooltip && $tooltip.setActived) {
13399
+ $tooltip.setActived(true);
13400
+ }
13401
+ }
13402
+ },
13403
+ handleTaskBarTooltipLeaveEvent: function handleTaskBarTooltipLeaveEvent() {
13404
+ var $xeGantt = this;
13405
+ var internalData = $xeGantt.internalData;
13406
+ var taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts;
13407
+ var $tooltip = $xeGantt.$refs.refTooltip;
13408
+ if ($tooltip && $tooltip.setActived) {
13409
+ $tooltip.setActived(false);
13410
+ }
13411
+ if (taskBarTooltipOpts.enterable) {
13412
+ internalData.barTipTimeout = setTimeout(function () {
13413
+ $tooltip = $xeGantt.$refs.refTooltip;
13414
+ if ($tooltip && $tooltip.isActived && !$tooltip.isActived()) {
13415
+ $xeGantt.closeTaskBarTooltip();
13416
+ }
13417
+ }, taskBarTooltipOpts.leaveDelay);
13418
+ } else {
13419
+ $xeGantt.closeTaskBarTooltip();
13420
+ }
13421
+ },
13289
13422
  handleTaskHeaderContextmenuEvent: function handleTaskHeaderContextmenuEvent(evnt, params) {
13290
13423
  var $xeGantt = this;
13291
13424
  var $xeTable = $xeGantt.$refs.refTable;
@@ -13736,14 +13869,19 @@ function gantt_createInternalData() {
13736
13869
  return childVNs;
13737
13870
  },
13738
13871
  renderLayout: function renderLayout(h) {
13872
+ var VxeUITooltipComponent = core_.VxeUI.getComponent('VxeTooltip');
13739
13873
  var $xeGantt = this;
13874
+ var reactData = $xeGantt.reactData;
13740
13875
  var slots = $xeGantt.$scopedSlots;
13876
+ var barTipStore = reactData.barTipStore;
13741
13877
  var currLayoutConf = $xeGantt.computeCurrLayoutConf;
13742
13878
  var headKeys = currLayoutConf.headKeys,
13743
13879
  bodyKeys = currLayoutConf.bodyKeys,
13744
13880
  footKeys = currLayoutConf.footKeys;
13881
+ var taskBarTooltipOpts = $xeGantt.computeTaskBarTooltipOpts;
13745
13882
  var asideLeftSlot = slots.asideLeft || slots['aside-left'];
13746
13883
  var asideRightSlot = slots.asideRight || slots['aside-right'];
13884
+ var taskBarTooltipSlot = slots.taskBarTooltip || slots['task-bar-tooltip'];
13747
13885
  return [h('div', {
13748
13886
  class: 'vxe-gantt--layout-header-wrapper'
13749
13887
  }, $xeGantt.renderChildLayout(h, headKeys)), h('div', {
@@ -13758,7 +13896,41 @@ function gantt_createInternalData() {
13758
13896
  class: 'vxe-gantt--layout-footer-wrapper'
13759
13897
  }, $xeGantt.renderChildLayout(h, footKeys)), h('div', {
13760
13898
  ref: 'refPopupContainerElem'
13761
- })];
13899
+ }), h('div', {}, [
13900
+ /**
13901
+ * 任务条提示
13902
+ */
13903
+ h(VxeUITooltipComponent, {
13904
+ key: 'gtp',
13905
+ ref: 'refTooltip',
13906
+ props: {
13907
+ theme: taskBarTooltipOpts.theme,
13908
+ enterable: taskBarTooltipOpts.enterable,
13909
+ enterDelay: taskBarTooltipOpts.enterDelay,
13910
+ leaveDelay: taskBarTooltipOpts.leaveDelay,
13911
+ useHTML: taskBarTooltipOpts.useHTML,
13912
+ width: taskBarTooltipOpts.width,
13913
+ height: taskBarTooltipOpts.height,
13914
+ minWidth: taskBarTooltipOpts.minWidth,
13915
+ minHeight: taskBarTooltipOpts.minHeight,
13916
+ maxWidth: taskBarTooltipOpts.maxWidth,
13917
+ maxHeight: taskBarTooltipOpts.maxHeight,
13918
+ isArrow: false
13919
+ },
13920
+ scopedSlots: taskBarTooltipSlot ? {
13921
+ content: function content() {
13922
+ var row = barTipStore.row,
13923
+ tooltipContent = barTipStore.content;
13924
+ if (row) {
13925
+ return h('div', {}, taskBarTooltipSlot(Object.assign({
13926
+ tooltipContent: tooltipContent,
13927
+ $gantt: $xeGantt
13928
+ }, barTipStore.params)));
13929
+ }
13930
+ return gantt_renderEmptyElement($xeGantt);
13931
+ }
13932
+ } : {}
13933
+ })])];
13762
13934
  },
13763
13935
  renderVN: function renderVN(h) {
13764
13936
  var $xeGantt = this;