@visactor/vtable-gantt 1.18.0 → 1.18.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/cjs/index.d.ts CHANGED
@@ -5,5 +5,5 @@ import { Gantt } from './Gantt';
5
5
  import * as tools from './tools';
6
6
  import * as VRender from './vrender';
7
7
  import * as VTable from './vtable';
8
- export declare const version = "1.18.0";
8
+ export declare const version = "1.18.1";
9
9
  export { TYPES, GanttConstructorOptions, Gantt, ColumnsDefine, ColumnDefine, LinkColumnDefine, ChartColumnDefine, ImageColumnDefine, SparklineColumnDefine, ProgressbarColumnDefine, TextColumnDefine, GroupColumnDefine, TextAlignType, TextBaselineType, tools, VRender, VTable };
package/cjs/index.js CHANGED
@@ -52,5 +52,5 @@ exports.VRender = VRender;
52
52
 
53
53
  const VTable = __importStar(require("./vtable"));
54
54
 
55
- exports.VTable = VTable, exports.version = "1.18.0";
55
+ exports.VTable = VTable, exports.version = "1.18.1";
56
56
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoC;AAuBlC,sBAAK;AATP,mCAAgC;AAW9B,sFAXO,aAAK,OAWP;AAVP,+CAAiC;AAsB/B,sBAAK;AArBP,mDAAqC;AAsBnC,0BAAO;AArBT,iDAAmC;AAsBjC,wBAAM;AArBK,QAAA,OAAO,GAAG,QAAQ,CAAC","file":"index.js","sourcesContent":["import type { GanttConstructorOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vtable';\nimport { Gantt } from './Gantt';\nimport * as tools from './tools';\nimport * as VRender from './vrender';\nimport * as VTable from './vtable';\nexport const version = \"1.18.0\";\n/**\n * @namespace VTable\n */\nexport {\n TYPES,\n GanttConstructorOptions,\n Gantt,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n tools,\n VRender,\n VTable\n};\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kDAAoC;AAuBlC,sBAAK;AATP,mCAAgC;AAW9B,sFAXO,aAAK,OAWP;AAVP,+CAAiC;AAsB/B,sBAAK;AArBP,mDAAqC;AAsBnC,0BAAO;AArBT,iDAAmC;AAsBjC,wBAAM;AArBK,QAAA,OAAO,GAAG,QAAQ,CAAC","file":"index.js","sourcesContent":["import type { GanttConstructorOptions } from './ts-types';\nimport * as TYPES from './ts-types';\nimport type {\n ColumnDefine,\n ColumnsDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType\n} from '@visactor/vtable';\nimport { Gantt } from './Gantt';\nimport * as tools from './tools';\nimport * as VRender from './vrender';\nimport * as VTable from './vtable';\nexport const version = \"1.18.1\";\n/**\n * @namespace VTable\n */\nexport {\n TYPES,\n GanttConstructorOptions,\n Gantt,\n ColumnsDefine,\n ColumnDefine,\n LinkColumnDefine,\n ChartColumnDefine,\n ImageColumnDefine,\n SparklineColumnDefine,\n ProgressbarColumnDefine,\n TextColumnDefine,\n GroupColumnDefine,\n TextAlignType,\n TextBaselineType,\n tools,\n VRender,\n VTable\n};\n"]}
@@ -3852,6 +3852,11 @@
3852
3852
  return this.context.tryUpdateLength();
3853
3853
  }
3854
3854
  };
3855
+ class StepClosed extends Step$1 {
3856
+ lineEnd() {
3857
+ this.context.closePath();
3858
+ }
3859
+ }
3855
3860
  function genStepSegments(points, t) {
3856
3861
  let params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
3857
3862
  const {
@@ -3865,6 +3870,16 @@
3865
3870
  function genStepTypeSegments(path, points) {
3866
3871
  return genCurveSegments(path, points);
3867
3872
  }
3873
+ function genStepClosedSegments(points, t) {
3874
+ let params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
3875
+ const {
3876
+ direction: direction,
3877
+ startPoint: startPoint
3878
+ } = params;
3879
+ if (points.length < 2 - Number(!!startPoint)) return null;
3880
+ const segContext = new SegContext("step", null != direction ? direction : abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y) ? Direction$2.ROW : Direction$2.COLUMN);
3881
+ return genStepTypeSegments(new StepClosed(segContext, t, startPoint), points), segContext;
3882
+ }
3868
3883
 
3869
3884
  class LinearClosed extends Linear {
3870
3885
  lineEnd() {
@@ -4094,6 +4109,8 @@
4094
4109
  return genMonotoneYSegments(points, params);
4095
4110
  case "step":
4096
4111
  return genStepSegments(points, .5, params);
4112
+ case "stepClosed":
4113
+ return genStepClosedSegments(points, .5, params);
4097
4114
  case "stepBefore":
4098
4115
  return genStepSegments(points, 0, params);
4099
4116
  case "stepAfter":
@@ -4968,7 +4985,7 @@
4968
4985
  function createColor(context, c, params) {
4969
4986
  let offsetX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
4970
4987
  let offsetY = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
4971
- var _a, _b;
4988
+ var _a, _b, _c, _d;
4972
4989
  if (!c || !0 === c) return "black";
4973
4990
  let result, color;
4974
4991
  if (isArray$9(c)) for (let i = 0; i < c.length && (color = c[i], !color); i++);else color = c;
@@ -4985,7 +5002,7 @@
4985
5002
  scaleY = 1,
4986
5003
  angle = 0
4987
5004
  } = params.attribute;
4988
- w /= scaleX, h /= scaleY, x /= scaleX, y /= scaleY, (angle || 1 !== scaleX || 1 !== scaleY) && (x = 0, y = 0, w = null !== (_a = params.widthWithoutTransform) && void 0 !== _a ? _a : w, h = null !== (_b = params.heightWithoutTransform) && void 0 !== _b ? _b : h);
5005
+ w /= scaleX, h /= scaleY, x /= scaleX, y /= scaleY, (angle || 1 !== scaleX || 1 !== scaleY) && (x = null !== (_a = params.x1WithoutTransform) && void 0 !== _a ? _a : 0, y = null !== (_b = params.y1WithoutTransform) && void 0 !== _b ? _b : 0, w = null !== (_c = params.widthWithoutTransform) && void 0 !== _c ? _c : w, h = null !== (_d = params.heightWithoutTransform) && void 0 !== _d ? _d : h);
4989
5006
  }
4990
5007
  "linear" === color.gradient ? result = createLinearGradient(context, color, x, y, w, h) : "conical" === color.gradient ? result = createConicGradient(context, color, x, y, w, h) : "radial" === color.gradient && (result = createRadialGradient(context, color, x, y, w, h));
4991
5008
  }
@@ -5010,7 +5027,7 @@
5010
5027
  const canvasGradient = context.createConicGradient(x + (null !== (_a = color.x) && void 0 !== _a ? _a : 0) * w, y + (null !== (_b = color.y) && void 0 !== _b ? _b : 0) * h, color.startAngle, color.endAngle);
5011
5028
  return color.stops.forEach(stop => {
5012
5029
  canvasGradient.addColorStop(stop.offset, stop.color);
5013
- }), canvasGradient.GetPattern(w + x, h + y, undefined);
5030
+ }), canvasGradient.GetPattern ? canvasGradient.GetPattern(w + x, h + y, undefined) : canvasGradient;
5014
5031
  }
5015
5032
 
5016
5033
  const DIRECTION_KEY = {
@@ -8572,7 +8589,7 @@
8572
8589
  }
8573
8590
  var rect = new RectSymbol();
8574
8591
 
8575
- const tempBounds$1 = new AABBBounds$1();
8592
+ const tempBounds = new AABBBounds$1();
8576
8593
  class CustomSymbolClass {
8577
8594
  constructor(type, path) {
8578
8595
  let isSvg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
@@ -8601,7 +8618,7 @@
8601
8618
  let {
8602
8619
  path: path
8603
8620
  } = _ref;
8604
- tempBounds$1.x1 = path.bounds.x1 * size, tempBounds$1.y1 = path.bounds.y1 * size, tempBounds$1.x2 = path.bounds.x2 * size, tempBounds$1.y2 = path.bounds.y2 * size, bounds.union(tempBounds$1);
8621
+ tempBounds.x1 = path.bounds.x1 * size, tempBounds.y1 = path.bounds.y1 * size, tempBounds.x2 = path.bounds.x2 * size, tempBounds.y2 = path.bounds.y2 * size, bounds.union(tempBounds);
8605
8622
  });
8606
8623
  }
8607
8624
  this.path.bounds && (bounds.x1 = this.path.bounds.x1 * size, bounds.y1 = this.path.bounds.y1 * size, bounds.x2 = this.path.bounds.x2 * size, bounds.y2 = this.path.bounds.y2 * size);
@@ -8915,8 +8932,8 @@
8915
8932
  const SVG_PARSE_ATTRIBUTE_MAP_KEYS = Object.keys(SVG_PARSE_ATTRIBUTE_MAP);
8916
8933
 
8917
8934
  const _tempBounds$1 = new AABBBounds$1(),
8918
- tempMatrix = new Matrix(),
8919
- tempBounds = new AABBBounds$1();
8935
+ tempMatrix = new Matrix();
8936
+ new AABBBounds$1();
8920
8937
  const GRAPHIC_UPDATE_TAG_KEY = ["lineWidth", "scaleX", "scaleY", "angle", "anchor", "visible"];
8921
8938
  const tempConstantXYKey = ["x", "y"],
8922
8939
  tempConstantScaleXYKey = ["scaleX", "scaleY"],
@@ -9435,25 +9452,12 @@
9435
9452
  needUpdateLayout() {
9436
9453
  return !!(this._updateTag & UpdateTag.UPDATE_LAYOUT);
9437
9454
  }
9438
- getAnchor(anchor, params) {
9455
+ getAnchor(anchor, params, resetScale) {
9439
9456
  const _anchor = [0, 0],
9440
9457
  getBounds = () => {
9441
9458
  if (params.b) return params.b;
9442
- const {
9443
- scaleX: scaleX,
9444
- scaleY: scaleY,
9445
- angle: angle,
9446
- scaleCenter: scaleCenter
9447
- } = this.attribute;
9448
- return tempBounds.copy(this._AABBBounds), this.setAttributes({
9449
- angle: 0,
9450
- scaleCenter: null
9451
- }), params.b = this.AABBBounds.clone(), this._AABBBounds.copy(tempBounds), this.setAttributes({
9452
- scaleX: scaleX,
9453
- scaleY: scaleY,
9454
- angle: angle,
9455
- scaleCenter: scaleCenter
9456
- }), params.b;
9459
+ const graphic = this.clone();
9460
+ return graphic.attribute.angle = 0, graphic.attribute.scaleCenter = null, resetScale && (graphic.attribute.scaleX = 1, graphic.attribute.scaleY = 1), params.b = graphic.AABBBounds, params.b;
9457
9461
  };
9458
9462
  if ("string" == typeof anchor[0]) {
9459
9463
  const ratio = parseFloat(anchor[0]) / 100,
@@ -9482,7 +9486,7 @@
9482
9486
  const params = {};
9483
9487
  if (anchor && angle && (_anchor = this.getAnchor(anchor, params)), !scaleCenter || 1 === scaleX && 1 === scaleY) normalTransform(this._transMatrix, this._transMatrix.reset(), x, y, scaleX, scaleY, angle, anchor && _anchor);else {
9484
9488
  const m = this._transMatrix;
9485
- m.reset(), m.translate(_anchor[0], _anchor[1]), m.rotate(angle), m.translate(-_anchor[0], -_anchor[1]), m.translate(x, y), _anchor = this.getAnchor(scaleCenter, params), application.transformUtil.fromMatrix(m, m).scale(scaleX, scaleY, {
9489
+ m.reset(), m.translate(_anchor[0], _anchor[1]), m.rotate(angle), m.translate(-_anchor[0], -_anchor[1]), m.translate(x, y), _anchor = this.getAnchor(scaleCenter, params, !0), application.transformUtil.fromMatrix(m, m).scale(scaleX, scaleY, {
9486
9490
  x: _anchor[0],
9487
9491
  y: _anchor[1]
9488
9492
  });
@@ -11555,7 +11559,7 @@
11555
11559
  tb1: tb1,
11556
11560
  tb2: tb2
11557
11561
  } = application.graphicService.updateTempAABBBounds(aabbBounds);
11558
- updateBoundsOfSymbolOuterBorder(attribute, symbolTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
11562
+ updateBoundsOfSymbolOuterBorder(attribute, symbolTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, this.x1WithoutTransform = aabbBounds.x1, this.y1WithoutTransform = aabbBounds.y1;
11559
11563
  const {
11560
11564
  lineJoin = symbolTheme.lineJoin
11561
11565
  } = attribute;
@@ -18924,6 +18928,7 @@
18924
18928
  return this.nativeContext.createRadialGradient(x0, y0, r0, x1, y1, r1);
18925
18929
  }
18926
18930
  createConicGradient(x, y, startAngle, endAngle) {
18931
+ if (this.nativeContext.createConicGradient && Math.abs(endAngle - startAngle - 2 * Math.PI) < .001) return this.nativeContext.createConicGradient(startAngle, x, y);
18927
18932
  let pattern,
18928
18933
  edit = !1;
18929
18934
  const ctx = this;
@@ -21435,7 +21440,9 @@
21435
21440
  loadScrollbarComponent();
21436
21441
  class ScrollBar extends AbstractComponent {
21437
21442
  constructor(attributes, options) {
21438
- super((null == options ? void 0 : options.skipDefault) ? attributes : merge$2({}, ScrollBar.defaultAttributes, attributes)), this.name = "scrollbar", this._onRailPointerDown = e => {
21443
+ super((null == options ? void 0 : options.skipDefault) ? attributes : merge$2({}, ScrollBar.defaultAttributes, attributes)), this.name = "scrollbar", this._handleTouchMove = e => {
21444
+ isValid$5(this._prePos) && e.preventDefault();
21445
+ }, this._onRailPointerDown = e => {
21439
21446
  const {
21440
21447
  viewX: viewX,
21441
21448
  viewY: viewY
@@ -21479,8 +21486,7 @@
21479
21486
  const triggers = getEndTriggersOfDrag(),
21480
21487
  obj = "browser" === vglobal.env ? vglobal : this.stage;
21481
21488
  obj.addEventListener("pointermove", this._onSliderPointerMoveWithDelay, {
21482
- capture: !0,
21483
- passive: !0
21489
+ capture: !0
21484
21490
  }), triggers.forEach(trigger => {
21485
21491
  obj.addEventListener(trigger, this._onSliderPointerUp);
21486
21492
  });
@@ -21501,7 +21507,6 @@
21501
21507
  } = this.getSliderRenderBounds();
21502
21508
  return "vertical" === direction ? (currentPos = y, delta = currentPos - this._prePos, currentScrollValue = delta / height) : (currentPos = x, delta = currentPos - this._prePos, currentScrollValue = delta / width), [currentPos, currentScrollValue];
21503
21509
  }, this._onSliderPointerMove = e => {
21504
- e.preventDefault();
21505
21510
  const {
21506
21511
  stopSliderMovePropagation = !0
21507
21512
  } = this.attribute;
@@ -21517,7 +21522,7 @@
21517
21522
  preScrollRange = this.getScrollRange(),
21518
21523
  [currentPos, currentScrollValue] = this._computeScrollValue(e),
21519
21524
  range = [preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue];
21520
- this._dispatchEvent(SCROLLBAR_END_EVENT, {
21525
+ this._prePos = null, this._dispatchEvent(SCROLLBAR_END_EVENT, {
21521
21526
  pre: preRange,
21522
21527
  value: clampRange$1(range, limitRange[0], limitRange[1])
21523
21528
  }), this._clearDragEvents();
@@ -21559,7 +21564,9 @@
21559
21564
  delayType = "throttle",
21560
21565
  delayTime = 0
21561
21566
  } = this.attribute;
21562
- this._rail && this._rail.addEventListener("pointerdown", delayMap[delayType](this._onRailPointerDown, delayTime)), this._slider && this._slider.addEventListener("pointerdown", this._onSliderPointerDown);
21567
+ this._rail && this._rail.addEventListener("pointerdown", delayMap[delayType](this._onRailPointerDown, delayTime)), this._slider && this._slider.addEventListener("pointerdown", this._onSliderPointerDown), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
21568
+ passive: !1
21569
+ });
21563
21570
  }
21564
21571
  render() {
21565
21572
  this._reset();
@@ -21673,8 +21680,7 @@
21673
21680
  const triggers = getEndTriggersOfDrag(),
21674
21681
  obj = "browser" === vglobal.env ? vglobal : this.stage;
21675
21682
  obj.removeEventListener("pointermove", this._onSliderPointerMoveWithDelay, {
21676
- capture: !0,
21677
- passive: !1
21683
+ capture: !0
21678
21684
  }), triggers.forEach(trigger => {
21679
21685
  obj.removeEventListener(trigger, this._onSliderPointerUp);
21680
21686
  });
@@ -21682,6 +21688,11 @@
21682
21688
  _reset() {
21683
21689
  this._sliderRenderBounds = null, this._sliderLimitRange = null;
21684
21690
  }
21691
+ release(all) {
21692
+ super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
21693
+ passive: !1
21694
+ }), this._clearDragEvents();
21695
+ }
21685
21696
  }
21686
21697
  ScrollBar.defaultAttributes = {
21687
21698
  direction: "horizontal",
@@ -26007,14 +26018,13 @@
26007
26018
  const triggers = getEndTriggersOfDrag(),
26008
26019
  obj = "browser" === vglobal.env ? vglobal : this.stage;
26009
26020
  obj.addEventListener("pointermove", this._onHandlerPointerMove, {
26010
- capture: !0,
26011
- passive: !1
26021
+ capture: !0
26012
26022
  }), triggers.forEach(trigger => {
26013
26023
  obj.addEventListener(trigger, this._onHandlerPointerUp);
26014
26024
  });
26015
26025
  }, this._onHandlerPointerMove = e => {
26016
26026
  var _a, _b;
26017
- e.preventDefault(), this._isChanging = !0;
26027
+ this._isChanging = !0;
26018
26028
  const {
26019
26029
  railWidth: railWidth,
26020
26030
  railHeight: railHeight,
@@ -26048,13 +26058,12 @@
26048
26058
  const triggers = getEndTriggersOfDrag(),
26049
26059
  obj = "browser" === vglobal.env ? vglobal : this.stage;
26050
26060
  obj.addEventListener("pointermove", this._onTrackPointerMove, {
26051
- capture: !0,
26052
- passive: !1
26061
+ capture: !0
26053
26062
  }), triggers.forEach(trigger => {
26054
26063
  obj.addEventListener(trigger, this._onTrackPointerUp);
26055
26064
  });
26056
26065
  }, this._onTrackPointerMove = e => {
26057
- e.preventDefault(), this._isChanging = !0;
26066
+ this._isChanging = !0;
26058
26067
  const {
26059
26068
  railWidth: railWidth,
26060
26069
  railHeight: railHeight,
@@ -26429,13 +26438,11 @@
26429
26438
  const triggers = getEndTriggersOfDrag(),
26430
26439
  obj = "browser" === vglobal.env ? vglobal : this.stage;
26431
26440
  obj.removeEventListener("pointermove", this._onHandlerPointerMove, {
26432
- capture: !0,
26433
- passive: !1
26441
+ capture: !0
26434
26442
  }), triggers.forEach(trigger => {
26435
26443
  obj.removeEventListener(trigger, this._onHandlerPointerUp);
26436
26444
  }), obj.removeEventListener("pointermove", this._onTrackPointerMove, {
26437
- capture: !0,
26438
- passive: !1
26445
+ capture: !0
26439
26446
  }), triggers.forEach(trigger => {
26440
26447
  obj.removeEventListener(trigger, this._onTrackPointerUp);
26441
26448
  });
@@ -54146,7 +54153,7 @@
54146
54153
  constructor(container) {
54147
54154
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
54148
54155
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
54149
- if (super(), this.showFrozenIcon = !0, this.version = "1.18.0", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
54156
+ if (super(), this.showFrozenIcon = !0, this.version = "1.18.1", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
54150
54157
  this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
54151
54158
  options: options,
54152
54159
  container: container
@@ -67291,7 +67298,7 @@
67291
67298
  themes: themes$1
67292
67299
  });
67293
67300
 
67294
- const version = "1.18.0";
67301
+ const version = "1.18.1";
67295
67302
 
67296
67303
  exports.Gantt = Gantt;
67297
67304
  exports.TYPES = index$3;