@visactor/vtable-gantt 1.11.2-alpha.2 → 1.11.2-alpha.3

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.11.2-alpha.2";
8
+ export declare const version = "1.11.2-alpha.3";
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.11.2-alpha.2";
55
+ exports.VTable = VTable, exports.version = "1.11.2-alpha.3";
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,gBAAgB,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.11.2-alpha.2\";\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,gBAAgB,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.11.2-alpha.3\";\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"]}
@@ -46316,12 +46316,14 @@
46316
46316
  }
46317
46317
  class MenuElement {
46318
46318
  constructor(table) {
46319
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
46319
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
46320
46320
  this._handler = new EventHandler$1(), this._rootElement = createMenuDomElement$1(), this._secondElement = createMenuDomElement$1(), this._secondElement.sub = !0, this._showChildrenIndex = -1, this._rootElement.addEventListener("wheel", e => {
46321
46321
  e.stopPropagation();
46322
46322
  }), null === (_a = this._rootElement) || void 0 === _a || _a.addEventListener("mousedown", e => {
46323
46323
  e.stopPropagation(), e.preventDefault();
46324
- }), null === (_b = this._rootElement) || void 0 === _b || _b.addEventListener("touchend", e => {
46324
+ }), null === (_b = this._rootElement) || void 0 === _b || _b.addEventListener("contextmenu", e => {
46325
+ e.stopPropagation(), e.preventDefault();
46326
+ }), null === (_c = this._rootElement) || void 0 === _c || _c.addEventListener("touchend", e => {
46325
46327
  if (e.stopPropagation(), e.preventDefault(), this._rootElement.classList.contains(HIDDEN_CLASSNAME$1)) return;
46326
46328
  const {
46327
46329
  col: col,
@@ -46344,7 +46346,7 @@
46344
46346
  cellLocation: table.getCellLocation(col, row),
46345
46347
  event: e
46346
46348
  }), table.fireListeners(TABLE_EVENT_TYPE.DROPDOWN_MENU_CLEAR, null), table.fireListeners(TABLE_EVENT_TYPE.HIDE_MENU, null), e.stopPropagation();
46347
- }), null === (_c = this._rootElement) || void 0 === _c || _c.addEventListener("click", e => {
46349
+ }), null === (_d = this._rootElement) || void 0 === _d || _d.addEventListener("click", e => {
46348
46350
  if (e.stopPropagation(), e.preventDefault(), this._rootElement.classList.contains(HIDDEN_CLASSNAME$1)) return;
46349
46351
  const {
46350
46352
  col: col,
@@ -46367,7 +46369,7 @@
46367
46369
  cellLocation: table.getCellLocation(col, row),
46368
46370
  event: e
46369
46371
  }), table.fireListeners(TABLE_EVENT_TYPE.DROPDOWN_MENU_CLEAR, null), table.fireListeners(TABLE_EVENT_TYPE.HIDE_MENU, null), e.stopPropagation();
46370
- }), null === (_d = this._rootElement) || void 0 === _d || _d.addEventListener("mousemove", e => {
46372
+ }), null === (_e = this._rootElement) || void 0 === _e || _e.addEventListener("mousemove", e => {
46371
46373
  var _a, _b;
46372
46374
  if (this._rootElement.classList.contains(HIDDEN_CLASSNAME$1)) return;
46373
46375
  e.stopPropagation();
@@ -46400,17 +46402,17 @@
46400
46402
  null == secondElement || secondElement.classList.remove(SHOWN_CLASSNAME$1), null == secondElement || secondElement.classList.add(HIDDEN_CLASSNAME$1);
46401
46403
  }
46402
46404
  }, 300);
46403
- }), null === (_e = this._secondElement) || void 0 === _e || _e.addEventListener("wheel", e => {
46405
+ }), null === (_f = this._secondElement) || void 0 === _f || _f.addEventListener("wheel", e => {
46404
46406
  e.stopPropagation();
46405
- }), null === (_f = this._secondElement) || void 0 === _f || _f.addEventListener("mousemove", e => {
46407
+ }), null === (_g = this._secondElement) || void 0 === _g || _g.addEventListener("mousemove", e => {
46406
46408
  this._rootElement.classList.contains(HIDDEN_CLASSNAME$1) || e.stopPropagation();
46407
- }), null === (_g = this._secondElement) || void 0 === _g || _g.addEventListener("mouseenter", e => {
46409
+ }), null === (_h = this._secondElement) || void 0 === _h || _h.addEventListener("mouseenter", e => {
46408
46410
  this._mouseEnterSecondElement = !0;
46409
- }), null === (_h = this._secondElement) || void 0 === _h || _h.addEventListener("mouseleave", e => {
46411
+ }), null === (_j = this._secondElement) || void 0 === _j || _j.addEventListener("mouseleave", e => {
46410
46412
  this._mouseEnterSecondElement = !1;
46411
- }), null === (_j = this._secondElement) || void 0 === _j || _j.addEventListener("mousedown", e => {
46413
+ }), null === (_k = this._secondElement) || void 0 === _k || _k.addEventListener("mousedown", e => {
46412
46414
  e.stopPropagation(), e.preventDefault();
46413
- }), null === (_k = this._secondElement) || void 0 === _k || _k.addEventListener("click", e => {
46415
+ }), null === (_l = this._secondElement) || void 0 === _l || _l.addEventListener("click", e => {
46414
46416
  if (e.stopPropagation(), e.preventDefault(), this._secondElement.classList.contains(HIDDEN_CLASSNAME$1)) return;
46415
46417
  const {
46416
46418
  col: col,
@@ -46480,11 +46482,12 @@
46480
46482
  this._menuInstanceInfo = void 0, (null == rootElement ? void 0 : rootElement.parentElement) && (rootElement.classList.remove(SHOWN_CLASSNAME$1), rootElement.classList.add(HIDDEN_CLASSNAME$1)), (null == secondElement ? void 0 : secondElement.parentElement) && (secondElement.classList.remove(SHOWN_CLASSNAME$1), secondElement.classList.add(HIDDEN_CLASSNAME$1));
46481
46483
  }
46482
46484
  _canBindToCell(table, col, row) {
46485
+ var _a;
46483
46486
  const rect = table.getCellRangeRelativeRect({
46484
46487
  col: col,
46485
46488
  row: row
46486
46489
  }),
46487
- element = table.getElement(),
46490
+ element = null !== (_a = table.internalProps.menu.parentElement) && void 0 !== _a ? _a : table.getElement(),
46488
46491
  {
46489
46492
  top: top,
46490
46493
  bottom: bottom,
@@ -46500,12 +46503,15 @@
46500
46503
  return !(offsetHeight < top) && !(offsetWidth < left);
46501
46504
  }
46502
46505
  _bindToCell(table, col, row, position, referencePosition) {
46506
+ var _a;
46503
46507
  const rootElement = this._rootElement,
46504
- element = table.getElement(),
46508
+ element = null !== (_a = table.internalProps.menu.parentElement) && void 0 !== _a ? _a : table.getElement(),
46505
46509
  {
46506
46510
  width: containerWidth,
46507
- height: containerHeight
46508
- } = table.internalProps.element.getBoundingClientRect();
46511
+ height: containerHeight,
46512
+ left: containerLeft,
46513
+ top: containerTop
46514
+ } = element.getBoundingClientRect();
46509
46515
  if (rootElement) {
46510
46516
  rootElement.parentElement !== element && element.appendChild(rootElement), rootElement.style.left = "0px";
46511
46517
  const maxWidth = .8 * containerWidth;
@@ -46517,19 +46523,30 @@
46517
46523
  const rect = element.getBoundingClientRect(),
46518
46524
  scaleX = rect.width / element.offsetWidth,
46519
46525
  scaleY = rect.height / element.offsetHeight;
46520
- return rootElementTop * scaleY + rootElementHeight > containerHeight && (rootElementTop = (containerHeight - rootElementHeight) / scaleY), rootElementTop < 0 && (rootElementTop /= 2), rootElement.style.top = `${rootElementTop}px`, rootElementLeft < 0 ? rootElementLeft = 0 : rootElementLeft * scaleX + rootElementWidth > containerWidth && (rootElementLeft = (containerWidth - rootElementWidth) / scaleX), rootElement.style.left = `${rootElementLeft}px`, !0;
46526
+ rootElementTop * scaleY + rootElementHeight > containerHeight && (rootElementTop = (containerHeight - rootElementHeight) / scaleY), rootElementTop < 0 && (rootElementTop /= 2);
46527
+ let deltaTop = 0,
46528
+ deltaLeft = 0;
46529
+ if (table.getElement() !== element) {
46530
+ const {
46531
+ left: left,
46532
+ top: top
46533
+ } = table.getElement().getBoundingClientRect();
46534
+ deltaTop = top - containerTop, deltaLeft = left - containerLeft;
46535
+ }
46536
+ return rootElement.style.top = `${rootElementTop + deltaTop}px`, rootElementLeft < 0 ? rootElementLeft = 0 : rootElementLeft * scaleX + rootElementWidth > containerWidth && (rootElementLeft = (containerWidth - rootElementWidth) / scaleX), rootElement.style.left = `${rootElementLeft + deltaLeft}px`, !0;
46521
46537
  }
46522
46538
  return !1;
46523
46539
  }
46524
46540
  _bindSecondElement(table, col, row, x, y) {
46541
+ var _a;
46525
46542
  const secondElement = this._secondElement,
46526
46543
  rootElement = this._rootElement,
46527
- element = table.getElement(),
46544
+ element = null !== (_a = table.internalProps.menu.parentElement) && void 0 !== _a ? _a : table.getElement(),
46528
46545
  {
46529
46546
  width: containerWidth,
46530
46547
  left: containerLeft,
46531
46548
  top: containerTop
46532
- } = table.internalProps.element.getBoundingClientRect(),
46549
+ } = element.getBoundingClientRect(),
46533
46550
  {
46534
46551
  x: rootLeft,
46535
46552
  y: rootTop,
@@ -48480,7 +48497,7 @@
48480
48497
  constructor(container) {
48481
48498
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
48482
48499
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
48483
- if (super(), this.showFrozenIcon = !0, this.version = "1.11.2-alpha.2", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
48500
+ if (super(), this.showFrozenIcon = !0, this.version = "1.11.2-alpha.3", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
48484
48501
  const {
48485
48502
  frozenColCount = 0,
48486
48503
  frozenRowCount: frozenRowCount,
@@ -54015,11 +54032,12 @@
54015
54032
  this._menuInstanceInfo = void 0, (null == rootElement ? void 0 : rootElement.parentElement) && (rootElement.classList.remove(SHOWN_CLASSNAME), rootElement.classList.add(HIDDEN_CLASSNAME));
54016
54033
  }
54017
54034
  _canBindToCell(table, col, row) {
54035
+ var _a;
54018
54036
  const rect = table.getCellRangeRelativeRect({
54019
54037
  col: col,
54020
54038
  row: row
54021
54039
  }),
54022
- element = table.getElement(),
54040
+ element = null !== (_a = table.internalProps.menu.parentElement) && void 0 !== _a ? _a : table.getElement(),
54023
54041
  {
54024
54042
  top: top,
54025
54043
  bottom: bottom,
@@ -54035,12 +54053,15 @@
54035
54053
  return !(offsetHeight < top) && !(offsetWidth < left);
54036
54054
  }
54037
54055
  _bindCell(table, col, row, position, referencePosition) {
54056
+ var _a;
54038
54057
  const rootElement = this._rootElement,
54039
- element = table.getElement(),
54058
+ element = null !== (_a = table.internalProps.menu.parentElement) && void 0 !== _a ? _a : table.getElement(),
54040
54059
  {
54041
54060
  width: containerWidth,
54042
- height: containerHeight
54043
- } = table.internalProps.element.getBoundingClientRect();
54061
+ height: containerHeight,
54062
+ left: containerLeft,
54063
+ top: containerTop
54064
+ } = element.getBoundingClientRect();
54044
54065
  if (rootElement) {
54045
54066
  rootElement.parentElement !== element && element.appendChild(rootElement), rootElement.style.left = "0px";
54046
54067
  const maxWidth = .8 * containerWidth;
@@ -54048,7 +54069,17 @@
54048
54069
  const rootElementWidth = rootElement.clientWidth,
54049
54070
  rootElementHeight = rootElement.clientHeight;
54050
54071
  let rootElementLeft, rootElementTop;
54051
- return position && (rootElementLeft = position.x, rootElementTop = position.y), referencePosition && (rootElementLeft = referencePosition.rect.right - rootElementWidth, rootElementTop = referencePosition.rect.bottom), rootElementTop + rootElementHeight > containerHeight && (rootElementTop = containerHeight - rootElementHeight, rootElementLeft += rootElementWidth - 2), rootElementTop < 0 && (rootElementTop /= 2), rootElement.style.top = `${rootElementTop}px`, rootElementLeft < 0 ? rootElementLeft = 0 : rootElementLeft + rootElementWidth > containerWidth && (rootElementLeft = containerWidth - rootElementWidth), rootElement.style.left = `${rootElementLeft}px`, !0;
54072
+ position && (rootElementLeft = position.x, rootElementTop = position.y), referencePosition && (rootElementLeft = referencePosition.rect.right - rootElementWidth, rootElementTop = referencePosition.rect.bottom), rootElementTop + rootElementHeight > containerHeight && (rootElementTop = containerHeight - rootElementHeight, rootElementLeft += rootElementWidth - 2), rootElementTop < 0 && (rootElementTop /= 2);
54073
+ let deltaTop = 0,
54074
+ deltaLeft = 0;
54075
+ if (table.getElement() !== element) {
54076
+ const {
54077
+ left: left,
54078
+ top: top
54079
+ } = table.getElement().getBoundingClientRect();
54080
+ deltaTop = top - containerTop, deltaLeft = left - containerLeft;
54081
+ }
54082
+ return rootElement.style.top = `${rootElementTop + deltaTop}px`, rootElementLeft < 0 ? rootElementLeft = 0 : rootElementLeft + rootElementWidth > containerWidth && (rootElementLeft = containerWidth - rootElementWidth), rootElement.style.left = `${rootElementLeft + deltaLeft}px`, !0;
54052
54083
  }
54053
54084
  return !1;
54054
54085
  }
@@ -58363,7 +58394,7 @@
58363
58394
  themes: themes$1
58364
58395
  });
58365
58396
 
58366
- const version = "1.11.2-alpha.2";
58397
+ const version = "1.11.2-alpha.3";
58367
58398
 
58368
58399
  exports.Gantt = Gantt;
58369
58400
  exports.TYPES = index$2;