vxe-gantt 3.0.22 → 3.0.24

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.0.22");
8185
+ var version = "gantt v".concat("3.0.24");
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.0.22";
8195
+ core_.VxeUI.ganttVersion = "3.0.24";
8196
8196
  setConfig({
8197
8197
  gantt: {
8198
8198
  // size: null,
@@ -8687,6 +8687,9 @@ function eqEmptyValue(cellValue) {
8687
8687
  function getStringValue(cellValue) {
8688
8688
  return eqEmptyValue(cellValue) ? '' : cellValue;
8689
8689
  }
8690
+ function getClass(property, params) {
8691
+ return property ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(property) ? property(params) : property : '';
8692
+ }
8690
8693
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.constructor.js
8691
8694
  var es_regexp_constructor = __webpack_require__(4864);
8692
8695
  // EXTERNAL MODULE: ./node_modules/core-js/modules/es.regexp.dot-all.js
@@ -8748,7 +8751,7 @@ function getNodeOffset(elem, container, rest) {
8748
8751
  return rest;
8749
8752
  }
8750
8753
  function isPx(val) {
8751
- return val && /^\d+(\.\d+)?px?$/.test(val);
8754
+ return val && /^\d+(\.\d+)?(px)?$/.test(val);
8752
8755
  }
8753
8756
  function isScale(val) {
8754
8757
  return val && /^\d+(\.\d+)?%$/.test(val);
@@ -9355,6 +9358,9 @@ var gantt_chart_viewType = 'chart';
9355
9358
 
9356
9359
 
9357
9360
 
9361
+
9362
+
9363
+
9358
9364
  var gantt_body_sourceType = 'gantt';
9359
9365
  var gantt_body_viewType = 'body';
9360
9366
  /* harmony default export */ var gantt_body = (defineVxeComponent({
@@ -9391,10 +9397,15 @@ var gantt_body_viewType = 'body';
9391
9397
  var headerGroups = reactData.headerGroups;
9392
9398
  var todayDateMaps = internalData.todayDateMaps;
9393
9399
  var taskViewOpts = $xeGantt.computeTaskViewOpts;
9394
- var showNowLine = taskViewOpts.showNowLine;
9400
+ var showNowLine = taskViewOpts.showNowLine,
9401
+ viewStyle = taskViewOpts.viewStyle;
9395
9402
  var _ref = headerGroups[headerGroups.length - 1] || {},
9396
9403
  scaleItem = _ref.scaleItem;
9397
- var field = column.field;
9404
+ var field = column.field,
9405
+ dateObj = column.dateObj;
9406
+ var _ref2 = viewStyle || {},
9407
+ cellClassName = _ref2.cellClassName,
9408
+ cellStyle = _ref2.cellStyle;
9398
9409
  var todayValue = showNowLine && scaleItem ? todayDateMaps[scaleItem.type] : null;
9399
9410
  var rowRest = fullAllDataRowIdData[rowid] || {};
9400
9411
  var resizeHeight = resizeHeightFlag ? rowRest.resizeHeight : 0;
@@ -9442,6 +9453,7 @@ var gantt_body_viewType = 'body';
9442
9453
  var ctParams = {
9443
9454
  source: gantt_body_sourceType,
9444
9455
  type: gantt_body_viewType,
9456
+ dateObj: dateObj,
9445
9457
  row: row,
9446
9458
  column: column,
9447
9459
  $rowIndex: $rowIndex,
@@ -9453,8 +9465,10 @@ var gantt_body_viewType = 'body';
9453
9465
  class: ['vxe-gantt-view--body-column', {
9454
9466
  'is--now': showNowLine && todayValue === field,
9455
9467
  'col--rs-height': isRsHeight
9456
- }],
9457
- style: {
9468
+ }, getClass(cellClassName, ctParams)],
9469
+ style: cellStyle ? Object.assign({}, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(cellStyle) ? cellStyle(ctParams) : cellStyle, {
9470
+ height: "".concat(cellHeight, "px")
9471
+ }) : {
9458
9472
  height: "".concat(cellHeight, "px")
9459
9473
  },
9460
9474
  on: {
@@ -9479,6 +9493,7 @@ var gantt_body_viewType = 'body';
9479
9493
  renderRows: function renderRows(h, $xeTable, tableData) {
9480
9494
  var _vm = this;
9481
9495
  var $xeGanttView = _vm.$xeGanttView;
9496
+ var $xeGantt = _vm.$xeGantt;
9482
9497
  var reactData = $xeGanttView.reactData;
9483
9498
  var tableProps = $xeTable;
9484
9499
  var treeConfig = tableProps.treeConfig,
@@ -9500,6 +9515,11 @@ var gantt_body_viewType = 'body';
9500
9515
  var treeOpts = $xeTable.computeTreeOpts;
9501
9516
  var transform = treeOpts.transform;
9502
9517
  var childrenField = treeOpts.children || treeOpts.childrenField;
9518
+ var taskViewOpts = $xeGantt.computeTaskViewOpts;
9519
+ var viewStyle = taskViewOpts.viewStyle;
9520
+ var _ref3 = viewStyle || {},
9521
+ rowClassName = _ref3.rowClassName,
9522
+ rowStyle = _ref3.rowStyle;
9503
9523
  var tableColumn = reactData.tableColumn,
9504
9524
  scrollYLoad = reactData.scrollYLoad;
9505
9525
  var trVNs = [];
@@ -9536,6 +9556,14 @@ var gantt_body_viewType = 'body';
9536
9556
  trOns.dragend = $xeTable.handleRowDragDragendEvent;
9537
9557
  trOns.dragover = $xeTable.handleRowDragDragoverEvent;
9538
9558
  }
9559
+ var rowParams = {
9560
+ source: gantt_body_sourceType,
9561
+ type: gantt_body_viewType,
9562
+ row: row,
9563
+ rowIndex: rowIndex,
9564
+ $rowIndex: $rowIndex,
9565
+ _rowIndex: _rowIndex
9566
+ };
9539
9567
  trVNs.push(h('tr', {
9540
9568
  key: treeConfig ? rowid : $rowIndex,
9541
9569
  class: ['vxe-gantt-view--body-row', {
@@ -9544,7 +9572,8 @@ var gantt_body_viewType = 'body';
9544
9572
  'row--radio': radioOpts.highlight && $xeTable.eqRow(selectRadioRow, row),
9545
9573
  'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
9546
9574
  'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid]
9547
- }],
9575
+ }, getClass(rowClassName, rowParams)],
9576
+ style: rowStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rowStyle) ? rowStyle(rowParams) : rowStyle : undefined,
9548
9577
  attrs: {
9549
9578
  rowid: rowid
9550
9579
  },
@@ -9725,6 +9754,7 @@ var gantt_footer_viewType = 'footer';
9725
9754
 
9726
9755
 
9727
9756
  var globalEvents = core_.VxeUI.globalEvents;
9757
+ var gantt_view_sourceType = 'gantt';
9728
9758
  function createInternalData() {
9729
9759
  return {
9730
9760
  xeTable: null,
@@ -10530,10 +10560,103 @@ function checkLastSyncScroll($xeGanttView, isRollX, isRollY) {
10530
10560
  reactData.lazScrollLoading = false;
10531
10561
  }, 200);
10532
10562
  }
10533
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
10534
- function handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, scrollTop, scrollLeft) {
10563
+ function handleScrollData($xeGanttView, isRollY, isRollX, scrollTop, scrollLeft) {
10564
+ var reactData = $xeGanttView.reactData;
10565
+ var internalData = $xeGanttView.internalData;
10566
+ if (isRollX) {
10567
+ internalData.lastScrollLeft = scrollLeft;
10568
+ }
10569
+ if (isRollY) {
10570
+ internalData.lastScrollTop = scrollTop;
10571
+ }
10572
+ reactData.lastScrollTime = Date.now();
10535
10573
  checkLastSyncScroll($xeGanttView, isRollX, isRollY);
10536
10574
  }
10575
+ function handleScrollEvent($xeGanttView, evnt, isRollY, isRollX, scrollTop, scrollLeft) {
10576
+ var $xeGantt = $xeGanttView.$xeGantt;
10577
+ var internalData = $xeGanttView.internalData;
10578
+ var $xeTable = internalData.xeTable;
10579
+ var lastScrollLeft = internalData.lastScrollLeft,
10580
+ lastScrollTop = internalData.lastScrollTop;
10581
+ var xHandleEl = $xeGanttView.$refs.refScrollXHandleElem;
10582
+ var yHandleEl = $xeGanttView.$refs.refScrollYHandleElem;
10583
+ if (!xHandleEl || !yHandleEl) {
10584
+ return;
10585
+ }
10586
+ if (!$xeTable) {
10587
+ return;
10588
+ }
10589
+ var bodyHeight = yHandleEl.clientHeight;
10590
+ var bodyWidth = xHandleEl.clientWidth;
10591
+ var scrollHeight = yHandleEl.scrollHeight;
10592
+ var scrollWidth = xHandleEl.scrollWidth;
10593
+ var isTop = false;
10594
+ var isBottom = false;
10595
+ var isLeft = false;
10596
+ var isRight = false;
10597
+ var direction = '';
10598
+ var isTopBoundary = false;
10599
+ var isBottomBoundary = false;
10600
+ var isLeftBoundary = false;
10601
+ var isRightBoundary = false;
10602
+ if (isRollX) {
10603
+ var xThreshold = $xeTable.computeScrollXThreshold;
10604
+ isLeft = scrollLeft <= 0;
10605
+ if (!isLeft) {
10606
+ isRight = scrollLeft + bodyWidth >= scrollWidth - 1;
10607
+ }
10608
+ if (scrollLeft > lastScrollLeft) {
10609
+ direction = 'right';
10610
+ if (scrollLeft + bodyWidth >= scrollWidth - xThreshold) {
10611
+ isRightBoundary = true;
10612
+ }
10613
+ } else {
10614
+ direction = 'left';
10615
+ if (scrollLeft <= xThreshold) {
10616
+ isLeftBoundary = true;
10617
+ }
10618
+ }
10619
+ }
10620
+ if (isRollY) {
10621
+ var yThreshold = $xeTable.computeScrollYThreshold;
10622
+ isTop = scrollTop <= 0;
10623
+ if (!isTop) {
10624
+ isBottom = scrollTop + bodyHeight >= scrollHeight - 1;
10625
+ }
10626
+ if (scrollTop > lastScrollTop) {
10627
+ direction = 'bottom';
10628
+ if (scrollTop + bodyHeight >= scrollHeight - yThreshold) {
10629
+ isBottomBoundary = true;
10630
+ }
10631
+ } else {
10632
+ direction = 'top';
10633
+ if (scrollTop <= yThreshold) {
10634
+ isTopBoundary = true;
10635
+ }
10636
+ }
10637
+ }
10638
+ handleScrollData($xeGanttView, isRollY, isRollX, scrollTop, scrollLeft);
10639
+ var evntParams = {
10640
+ source: gantt_view_sourceType,
10641
+ scrollTop: scrollTop,
10642
+ scrollLeft: scrollLeft,
10643
+ bodyHeight: bodyHeight,
10644
+ bodyWidth: bodyWidth,
10645
+ scrollHeight: scrollHeight,
10646
+ scrollWidth: scrollWidth,
10647
+ isX: isRollX,
10648
+ isY: isRollY,
10649
+ isTop: isTop,
10650
+ isBottom: isBottom,
10651
+ isLeft: isLeft,
10652
+ isRight: isRight,
10653
+ direction: direction
10654
+ };
10655
+ if (isBottomBoundary || isTopBoundary || isRightBoundary || isLeftBoundary) {
10656
+ $xeGantt.dispatchEvent('scroll-boundary', evntParams, evnt);
10657
+ }
10658
+ $xeGantt.dispatchEvent('scroll', evntParams, evnt);
10659
+ }
10537
10660
  /**
10538
10661
  * 同步表格滚动
10539
10662
  */