vxe-gantt 4.0.22 → 4.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
@@ -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.0.22"}`;
2783
+ const version = `gantt v${"4.0.24"}`;
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.0.22";
2794
+ core_.VxeUI.ganttVersion = "4.0.24";
2795
2795
  setConfig({
2796
2796
  gantt: {
2797
2797
  // size: null,
@@ -3088,6 +3088,9 @@ function eqEmptyValue(cellValue) {
3088
3088
  function getStringValue(cellValue) {
3089
3089
  return eqEmptyValue(cellValue) ? '' : cellValue;
3090
3090
  }
3091
+ function getClass(property, params) {
3092
+ return property ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(property) ? property(params) : property : '';
3093
+ }
3091
3094
  ;// ./packages/ui/src/dom.ts
3092
3095
 
3093
3096
  const reClsMap = {};
@@ -3130,7 +3133,7 @@ function getNodeOffset(elem, container, rest) {
3130
3133
  return rest;
3131
3134
  }
3132
3135
  function isPx(val) {
3133
- return val && /^\d+(\.\d+)?px?$/.test(val);
3136
+ return val && /^\d+(\.\d+)?(px)?$/.test(val);
3134
3137
  }
3135
3138
  function isScale(val) {
3136
3139
  return val && /^\d+(\.\d+)?%$/.test(val);
@@ -3691,6 +3694,8 @@ const gantt_chart_viewType = 'chart';
3691
3694
 
3692
3695
 
3693
3696
 
3697
+
3698
+
3694
3699
  const gantt_body_sourceType = 'gantt';
3695
3700
  const gantt_body_viewType = 'body';
3696
3701
  /* harmony default export */ var gantt_body = (defineVxeComponent({
@@ -3741,14 +3746,20 @@ const gantt_body_viewType = 'body';
3741
3746
  } = internalData;
3742
3747
  const taskViewOpts = computeTaskViewOpts.value;
3743
3748
  const {
3744
- showNowLine
3749
+ showNowLine,
3750
+ viewStyle
3745
3751
  } = taskViewOpts;
3746
3752
  const {
3747
3753
  scaleItem
3748
3754
  } = headerGroups[headerGroups.length - 1] || {};
3749
3755
  const {
3750
- field
3756
+ field,
3757
+ dateObj
3751
3758
  } = column;
3759
+ const {
3760
+ cellClassName,
3761
+ cellStyle
3762
+ } = viewStyle || {};
3752
3763
  const todayValue = showNowLine && scaleItem ? todayDateMaps[scaleItem.type] : null;
3753
3764
  const rowRest = fullAllDataRowIdData[rowid] || {};
3754
3765
  const resizeHeight = resizeHeightFlag ? rowRest.resizeHeight : 0;
@@ -3790,6 +3801,7 @@ const gantt_body_viewType = 'body';
3790
3801
  const ctParams = {
3791
3802
  source: gantt_body_sourceType,
3792
3803
  type: gantt_body_viewType,
3804
+ dateObj,
3793
3805
  row,
3794
3806
  column,
3795
3807
  $rowIndex,
@@ -3801,8 +3813,10 @@ const gantt_body_viewType = 'body';
3801
3813
  class: ['vxe-gantt-view--body-column', {
3802
3814
  'is--now': showNowLine && todayValue === field,
3803
3815
  'col--rs-height': isRsHeight
3804
- }],
3805
- style: {
3816
+ }, getClass(cellClassName, ctParams)],
3817
+ style: cellStyle ? Object.assign({}, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(cellStyle) ? cellStyle(ctParams) : cellStyle, {
3818
+ height: `${cellHeight}px`
3819
+ }) : {
3806
3820
  height: `${cellHeight}px`
3807
3821
  },
3808
3822
  onClick(evnt) {
@@ -3857,6 +3871,14 @@ const gantt_body_viewType = 'body';
3857
3871
  transform
3858
3872
  } = treeOpts;
3859
3873
  const childrenField = treeOpts.children || treeOpts.childrenField;
3874
+ const taskViewOpts = computeTaskViewOpts.value;
3875
+ const {
3876
+ viewStyle
3877
+ } = taskViewOpts;
3878
+ const {
3879
+ rowClassName,
3880
+ rowStyle
3881
+ } = viewStyle || {};
3860
3882
  const {
3861
3883
  tableColumn,
3862
3884
  scrollYLoad
@@ -3895,6 +3917,14 @@ const gantt_body_viewType = 'body';
3895
3917
  trOns.onDragend = $xeTable.handleRowDragDragendEvent;
3896
3918
  trOns.onDragover = $xeTable.handleRowDragDragoverEvent;
3897
3919
  }
3920
+ const rowParams = {
3921
+ source: gantt_body_sourceType,
3922
+ type: gantt_body_viewType,
3923
+ row,
3924
+ rowIndex,
3925
+ $rowIndex,
3926
+ _rowIndex
3927
+ };
3898
3928
  trVNs.push((0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('tr', {
3899
3929
  key: treeConfig ? rowid : $rowIndex,
3900
3930
  class: ['vxe-gantt-view--body-row', {
@@ -3903,8 +3933,9 @@ const gantt_body_viewType = 'body';
3903
3933
  'row--radio': radioOpts.highlight && $xeTable.eqRow(selectRadioRow, row),
3904
3934
  'row--checked': checkboxOpts.highlight && $xeTable.isCheckedByCheckboxRow(row),
3905
3935
  'row--pending': !!pendingRowFlag && !!pendingRowMaps[rowid]
3906
- }],
3936
+ }, getClass(rowClassName, rowParams)],
3907
3937
  rowid,
3938
+ style: rowStyle ? external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(rowStyle) ? rowStyle(rowParams) : rowStyle : undefined,
3908
3939
  ...trOns
3909
3940
  }, tableColumn.map((column, $columnIndex) => renderColumn($xeTable, row, rowid, rowIndex, $rowIndex, _rowIndex, column, $columnIndex))));
3910
3941
  let isExpandTree = false;
@@ -4053,6 +4084,7 @@ const gantt_footer_viewType = 'footer';
4053
4084
  const {
4054
4085
  globalEvents
4055
4086
  } = core_.VxeUI;
4087
+ const gantt_view_sourceType = 'gantt';
4056
4088
  function createInternalData() {
4057
4089
  return {
4058
4090
  xeTable: null,
@@ -4955,8 +4987,7 @@ const maxYHeight = 5e6;
4955
4987
  reactData.lazScrollLoading = false;
4956
4988
  }, 200);
4957
4989
  };
4958
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
4959
- const handleScrollEvent = (evnt, isRollY, isRollX, scrollTop, scrollLeft) => {
4990
+ const handleScrollData = (isRollY, isRollX, scrollTop, scrollLeft) => {
4960
4991
  if (isRollX) {
4961
4992
  internalData.lastScrollLeft = scrollLeft;
4962
4993
  }
@@ -4966,6 +4997,95 @@ const maxYHeight = 5e6;
4966
4997
  reactData.lastScrollTime = Date.now();
4967
4998
  checkLastSyncScroll(isRollX, isRollY);
4968
4999
  };
5000
+ const handleScrollEvent = (evnt, isRollY, isRollX, scrollTop, scrollLeft) => {
5001
+ const $xeTable = internalData.xeTable;
5002
+ const {
5003
+ lastScrollLeft,
5004
+ lastScrollTop
5005
+ } = internalData;
5006
+ const xHandleEl = refScrollXHandleElem.value;
5007
+ const yHandleEl = refScrollYHandleElem.value;
5008
+ if (!xHandleEl || !yHandleEl) {
5009
+ return;
5010
+ }
5011
+ if (!$xeTable) {
5012
+ return;
5013
+ }
5014
+ const {
5015
+ computeScrollXThreshold,
5016
+ computeScrollYThreshold
5017
+ } = $xeTable.getComputeMaps();
5018
+ const bodyHeight = yHandleEl.clientHeight;
5019
+ const bodyWidth = xHandleEl.clientWidth;
5020
+ const scrollHeight = yHandleEl.scrollHeight;
5021
+ const scrollWidth = xHandleEl.scrollWidth;
5022
+ let isTop = false;
5023
+ let isBottom = false;
5024
+ let isLeft = false;
5025
+ let isRight = false;
5026
+ let direction = '';
5027
+ let isTopBoundary = false;
5028
+ let isBottomBoundary = false;
5029
+ let isLeftBoundary = false;
5030
+ let isRightBoundary = false;
5031
+ if (isRollX) {
5032
+ const xThreshold = computeScrollXThreshold.value;
5033
+ isLeft = scrollLeft <= 0;
5034
+ if (!isLeft) {
5035
+ isRight = scrollLeft + bodyWidth >= scrollWidth - 1;
5036
+ }
5037
+ if (scrollLeft > lastScrollLeft) {
5038
+ direction = 'right';
5039
+ if (scrollLeft + bodyWidth >= scrollWidth - xThreshold) {
5040
+ isRightBoundary = true;
5041
+ }
5042
+ } else {
5043
+ direction = 'left';
5044
+ if (scrollLeft <= xThreshold) {
5045
+ isLeftBoundary = true;
5046
+ }
5047
+ }
5048
+ }
5049
+ if (isRollY) {
5050
+ const yThreshold = computeScrollYThreshold.value;
5051
+ isTop = scrollTop <= 0;
5052
+ if (!isTop) {
5053
+ isBottom = scrollTop + bodyHeight >= scrollHeight - 1;
5054
+ }
5055
+ if (scrollTop > lastScrollTop) {
5056
+ direction = 'bottom';
5057
+ if (scrollTop + bodyHeight >= scrollHeight - yThreshold) {
5058
+ isBottomBoundary = true;
5059
+ }
5060
+ } else {
5061
+ direction = 'top';
5062
+ if (scrollTop <= yThreshold) {
5063
+ isTopBoundary = true;
5064
+ }
5065
+ }
5066
+ }
5067
+ handleScrollData(isRollY, isRollX, scrollTop, scrollLeft);
5068
+ const evntParams = {
5069
+ source: gantt_view_sourceType,
5070
+ scrollTop,
5071
+ scrollLeft,
5072
+ bodyHeight,
5073
+ bodyWidth,
5074
+ scrollHeight,
5075
+ scrollWidth,
5076
+ isX: isRollX,
5077
+ isY: isRollY,
5078
+ isTop,
5079
+ isBottom,
5080
+ isLeft,
5081
+ isRight,
5082
+ direction
5083
+ };
5084
+ if (isBottomBoundary || isTopBoundary || isRightBoundary || isLeftBoundary) {
5085
+ $xeGantt.dispatchEvent('scroll-boundary', evntParams, evnt);
5086
+ }
5087
+ $xeGantt.dispatchEvent('scroll', evntParams, evnt);
5088
+ };
4969
5089
  const ganttViewMethods = {
4970
5090
  refreshData() {
4971
5091
  handleUpdateData();
@@ -5105,7 +5225,12 @@ const maxYHeight = 5e6;
5105
5225
  triggerScrollXEvent();
5106
5226
  }
5107
5227
  }
5108
- handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, scrollLeft);
5228
+ if (isRollY) {
5229
+ handleScrollData(isRollY, isRollX, wrapperEl.scrollTop, scrollLeft);
5230
+ }
5231
+ if (isRollX) {
5232
+ handleScrollEvent(evnt, isRollY, isRollX, wrapperEl.scrollTop, scrollLeft);
5233
+ }
5109
5234
  },
5110
5235
  // triggerFooterScrollEvent (evnt) {
5111
5236
  // const { inVirtualScroll, inHeaderScroll, inBodyScroll } = internalData
@@ -5169,7 +5294,7 @@ const maxYHeight = 5e6;
5169
5294
  internalData.inVirtualScroll = true;
5170
5295
  setScrollTop(bodyScrollElem, currTopNum);
5171
5296
  syncTableScrollTop(currTopNum);
5172
- handleScrollEvent(evnt, isRollY, isRollX, currTopNum, wrapperEl.scrollLeft);
5297
+ handleScrollData(isRollY, isRollX, currTopNum, wrapperEl.scrollLeft);
5173
5298
  }
5174
5299
  },
5175
5300
  handleUpdateSXSpace() {