@visactor/vtable-calendar 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.
@@ -43307,12 +43307,14 @@
43307
43307
  }
43308
43308
  class MenuElement {
43309
43309
  constructor(table) {
43310
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
43310
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
43311
43311
  this._handler = new EventHandler(), this._rootElement = createMenuDomElement$1(), this._secondElement = createMenuDomElement$1(), this._secondElement.sub = !0, this._showChildrenIndex = -1, this._rootElement.addEventListener("wheel", e => {
43312
43312
  e.stopPropagation();
43313
43313
  }), null === (_a = this._rootElement) || void 0 === _a || _a.addEventListener("mousedown", e => {
43314
43314
  e.stopPropagation(), e.preventDefault();
43315
- }), null === (_b = this._rootElement) || void 0 === _b || _b.addEventListener("touchend", e => {
43315
+ }), null === (_b = this._rootElement) || void 0 === _b || _b.addEventListener("contextmenu", e => {
43316
+ e.stopPropagation(), e.preventDefault();
43317
+ }), null === (_c = this._rootElement) || void 0 === _c || _c.addEventListener("touchend", e => {
43316
43318
  if (e.stopPropagation(), e.preventDefault(), this._rootElement.classList.contains(HIDDEN_CLASSNAME$1)) return;
43317
43319
  const {
43318
43320
  col: col,
@@ -43335,7 +43337,7 @@
43335
43337
  cellLocation: table.getCellLocation(col, row),
43336
43338
  event: e
43337
43339
  }), table.fireListeners(TABLE_EVENT_TYPE.DROPDOWN_MENU_CLEAR, null), table.fireListeners(TABLE_EVENT_TYPE.HIDE_MENU, null), e.stopPropagation();
43338
- }), null === (_c = this._rootElement) || void 0 === _c || _c.addEventListener("click", e => {
43340
+ }), null === (_d = this._rootElement) || void 0 === _d || _d.addEventListener("click", e => {
43339
43341
  if (e.stopPropagation(), e.preventDefault(), this._rootElement.classList.contains(HIDDEN_CLASSNAME$1)) return;
43340
43342
  const {
43341
43343
  col: col,
@@ -43358,7 +43360,7 @@
43358
43360
  cellLocation: table.getCellLocation(col, row),
43359
43361
  event: e
43360
43362
  }), table.fireListeners(TABLE_EVENT_TYPE.DROPDOWN_MENU_CLEAR, null), table.fireListeners(TABLE_EVENT_TYPE.HIDE_MENU, null), e.stopPropagation();
43361
- }), null === (_d = this._rootElement) || void 0 === _d || _d.addEventListener("mousemove", e => {
43363
+ }), null === (_e = this._rootElement) || void 0 === _e || _e.addEventListener("mousemove", e => {
43362
43364
  var _a, _b;
43363
43365
  if (this._rootElement.classList.contains(HIDDEN_CLASSNAME$1)) return;
43364
43366
  e.stopPropagation();
@@ -43391,17 +43393,17 @@
43391
43393
  null == secondElement || secondElement.classList.remove(SHOWN_CLASSNAME$1), null == secondElement || secondElement.classList.add(HIDDEN_CLASSNAME$1);
43392
43394
  }
43393
43395
  }, 300);
43394
- }), null === (_e = this._secondElement) || void 0 === _e || _e.addEventListener("wheel", e => {
43396
+ }), null === (_f = this._secondElement) || void 0 === _f || _f.addEventListener("wheel", e => {
43395
43397
  e.stopPropagation();
43396
- }), null === (_f = this._secondElement) || void 0 === _f || _f.addEventListener("mousemove", e => {
43398
+ }), null === (_g = this._secondElement) || void 0 === _g || _g.addEventListener("mousemove", e => {
43397
43399
  this._rootElement.classList.contains(HIDDEN_CLASSNAME$1) || e.stopPropagation();
43398
- }), null === (_g = this._secondElement) || void 0 === _g || _g.addEventListener("mouseenter", e => {
43400
+ }), null === (_h = this._secondElement) || void 0 === _h || _h.addEventListener("mouseenter", e => {
43399
43401
  this._mouseEnterSecondElement = !0;
43400
- }), null === (_h = this._secondElement) || void 0 === _h || _h.addEventListener("mouseleave", e => {
43402
+ }), null === (_j = this._secondElement) || void 0 === _j || _j.addEventListener("mouseleave", e => {
43401
43403
  this._mouseEnterSecondElement = !1;
43402
- }), null === (_j = this._secondElement) || void 0 === _j || _j.addEventListener("mousedown", e => {
43404
+ }), null === (_k = this._secondElement) || void 0 === _k || _k.addEventListener("mousedown", e => {
43403
43405
  e.stopPropagation(), e.preventDefault();
43404
- }), null === (_k = this._secondElement) || void 0 === _k || _k.addEventListener("click", e => {
43406
+ }), null === (_l = this._secondElement) || void 0 === _l || _l.addEventListener("click", e => {
43405
43407
  if (e.stopPropagation(), e.preventDefault(), this._secondElement.classList.contains(HIDDEN_CLASSNAME$1)) return;
43406
43408
  const {
43407
43409
  col: col,
@@ -43471,11 +43473,12 @@
43471
43473
  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));
43472
43474
  }
43473
43475
  _canBindToCell(table, col, row) {
43476
+ var _a;
43474
43477
  const rect = table.getCellRangeRelativeRect({
43475
43478
  col: col,
43476
43479
  row: row
43477
43480
  }),
43478
- element = table.getElement(),
43481
+ element = null !== (_a = table.internalProps.menu.parentElement) && void 0 !== _a ? _a : table.getElement(),
43479
43482
  {
43480
43483
  top: top,
43481
43484
  bottom: bottom,
@@ -43491,12 +43494,15 @@
43491
43494
  return !(offsetHeight < top) && !(offsetWidth < left);
43492
43495
  }
43493
43496
  _bindToCell(table, col, row, position, referencePosition) {
43497
+ var _a;
43494
43498
  const rootElement = this._rootElement,
43495
- element = table.getElement(),
43499
+ element = null !== (_a = table.internalProps.menu.parentElement) && void 0 !== _a ? _a : table.getElement(),
43496
43500
  {
43497
43501
  width: containerWidth,
43498
- height: containerHeight
43499
- } = table.internalProps.element.getBoundingClientRect();
43502
+ height: containerHeight,
43503
+ left: containerLeft,
43504
+ top: containerTop
43505
+ } = element.getBoundingClientRect();
43500
43506
  if (rootElement) {
43501
43507
  rootElement.parentElement !== element && element.appendChild(rootElement), rootElement.style.left = "0px";
43502
43508
  const maxWidth = .8 * containerWidth;
@@ -43508,19 +43514,30 @@
43508
43514
  const rect = element.getBoundingClientRect(),
43509
43515
  scaleX = rect.width / element.offsetWidth,
43510
43516
  scaleY = rect.height / element.offsetHeight;
43511
- 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;
43517
+ rootElementTop * scaleY + rootElementHeight > containerHeight && (rootElementTop = (containerHeight - rootElementHeight) / scaleY), rootElementTop < 0 && (rootElementTop /= 2);
43518
+ let deltaTop = 0,
43519
+ deltaLeft = 0;
43520
+ if (table.getElement() !== element) {
43521
+ const {
43522
+ left: left,
43523
+ top: top
43524
+ } = table.getElement().getBoundingClientRect();
43525
+ deltaTop = top - containerTop, deltaLeft = left - containerLeft;
43526
+ }
43527
+ 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;
43512
43528
  }
43513
43529
  return !1;
43514
43530
  }
43515
43531
  _bindSecondElement(table, col, row, x, y) {
43532
+ var _a;
43516
43533
  const secondElement = this._secondElement,
43517
43534
  rootElement = this._rootElement,
43518
- element = table.getElement(),
43535
+ element = null !== (_a = table.internalProps.menu.parentElement) && void 0 !== _a ? _a : table.getElement(),
43519
43536
  {
43520
43537
  width: containerWidth,
43521
43538
  left: containerLeft,
43522
43539
  top: containerTop
43523
- } = table.internalProps.element.getBoundingClientRect(),
43540
+ } = element.getBoundingClientRect(),
43524
43541
  {
43525
43542
  x: rootLeft,
43526
43543
  y: rootTop,
@@ -45471,7 +45488,7 @@
45471
45488
  constructor(container) {
45472
45489
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
45473
45490
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
45474
- 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");
45491
+ 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");
45475
45492
  const {
45476
45493
  frozenColCount = 0,
45477
45494
  frozenRowCount: frozenRowCount,
@@ -50974,11 +50991,12 @@
50974
50991
  this._menuInstanceInfo = void 0, (null == rootElement ? void 0 : rootElement.parentElement) && (rootElement.classList.remove(SHOWN_CLASSNAME), rootElement.classList.add(HIDDEN_CLASSNAME));
50975
50992
  }
50976
50993
  _canBindToCell(table, col, row) {
50994
+ var _a;
50977
50995
  const rect = table.getCellRangeRelativeRect({
50978
50996
  col: col,
50979
50997
  row: row
50980
50998
  }),
50981
- element = table.getElement(),
50999
+ element = null !== (_a = table.internalProps.menu.parentElement) && void 0 !== _a ? _a : table.getElement(),
50982
51000
  {
50983
51001
  top: top,
50984
51002
  bottom: bottom,
@@ -50994,12 +51012,15 @@
50994
51012
  return !(offsetHeight < top) && !(offsetWidth < left);
50995
51013
  }
50996
51014
  _bindCell(table, col, row, position, referencePosition) {
51015
+ var _a;
50997
51016
  const rootElement = this._rootElement,
50998
- element = table.getElement(),
51017
+ element = null !== (_a = table.internalProps.menu.parentElement) && void 0 !== _a ? _a : table.getElement(),
50999
51018
  {
51000
51019
  width: containerWidth,
51001
- height: containerHeight
51002
- } = table.internalProps.element.getBoundingClientRect();
51020
+ height: containerHeight,
51021
+ left: containerLeft,
51022
+ top: containerTop
51023
+ } = element.getBoundingClientRect();
51003
51024
  if (rootElement) {
51004
51025
  rootElement.parentElement !== element && element.appendChild(rootElement), rootElement.style.left = "0px";
51005
51026
  const maxWidth = .8 * containerWidth;
@@ -51007,7 +51028,17 @@
51007
51028
  const rootElementWidth = rootElement.clientWidth,
51008
51029
  rootElementHeight = rootElement.clientHeight;
51009
51030
  let rootElementLeft, rootElementTop;
51010
- 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;
51031
+ 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);
51032
+ let deltaTop = 0,
51033
+ deltaLeft = 0;
51034
+ if (table.getElement() !== element) {
51035
+ const {
51036
+ left: left,
51037
+ top: top
51038
+ } = table.getElement().getBoundingClientRect();
51039
+ deltaTop = top - containerTop, deltaLeft = left - containerLeft;
51040
+ }
51041
+ return rootElement.style.top = `${rootElementTop + deltaTop}px`, rootElementLeft < 0 ? rootElementLeft = 0 : rootElementLeft + rootElementWidth > containerWidth && (rootElementLeft = containerWidth - rootElementWidth), rootElement.style.left = `${rootElementLeft + deltaLeft}px`, !0;
51011
51042
  }
51012
51043
  return !1;
51013
51044
  }