@easyquery/ui 7.3.4 → 7.3.5-rc02

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.
@@ -427,6 +427,7 @@
427
427
  justify-content: flex-start;
428
428
  padding: 20px;
429
429
  position: relative;
430
+ width: 100%;
430
431
  }
431
432
 
432
433
  .kdlg-footer.align-right {
@@ -531,6 +532,7 @@
531
532
  padding: 20px;
532
533
  font-size: 1em;
533
534
  color: #4a4a4a;
535
+ width: 100%;
534
536
  }
535
537
 
536
538
 
@@ -5124,7 +5126,8 @@ input.eqjs-invalid {
5124
5126
 
5125
5127
  .eqjs-cb-addrow.eqjs-mobile a, .eqjs-sb-addrow.eqjs-mobile a {
5126
5128
  background: none!important;
5127
- }
5129
+ }
5130
+
5128
5131
  /*setting to all page */
5129
5132
  #eqv-main{
5130
5133
  width:1174px;
@@ -452,4 +452,4 @@
452
452
 
453
453
  .eqjs-cb-addrow.eqjs-mobile a, .eqjs-sb-addrow.eqjs-mobile a {
454
454
  background: none!important;
455
- }
455
+ }
@@ -1417,7 +1417,7 @@ class MenuLevel {
1417
1417
  }
1418
1418
  return res;
1419
1419
  }
1420
- showAt(x, y, adjustTopPos, hidden) {
1420
+ showAt(x, y, adjustTopPos, hidden, anchor) {
1421
1421
  if (!this.items) {
1422
1422
  return;
1423
1423
  }
@@ -1425,6 +1425,7 @@ class MenuLevel {
1425
1425
  //crocodile
1426
1426
  this.turnCheckboxes(this.items);
1427
1427
  this.renderItems();
1428
+ ui.getWinSize();
1428
1429
  const levelStyle = this.levelDiv.style;
1429
1430
  if (hidden) {
1430
1431
  this.levelDiv.style.visibility = 'hidden';
@@ -1434,20 +1435,65 @@ class MenuLevel {
1434
1435
  levelStyle.top = y + 'px';
1435
1436
  this.scrollDiv.style.width = "auto";
1436
1437
  this.scrollDiv.style.height = "auto";
1437
- if (this.parentMenu.options.useMaxSpace === false) {
1438
- const winSize = ui.getWinSize().height;
1439
- if (y > winSize / 2 && this.scrollDiv.scrollHeight > winSize / 2) {
1440
- this.scrollDiv.style.height = (y - 16 - 56) + 'px';
1441
- levelStyle.top = 0 + 'px';
1438
+ const useMaxSpace = this.parentMenu.options.useMaxSpace;
1439
+ const viewportHeight = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0);
1440
+ const top = y - scrollY;
1441
+ const bottom = viewportHeight - top;
1442
+ const anchorRect = anchor ? anchor.getBoundingClientRect() : null;
1443
+ const anchorHeight = anchorRect ? anchorRect.height : 0;
1444
+ const magic = 24;
1445
+ if (this.levelIndex === 0 && useMaxSpace) {
1446
+ let maxHeight = viewportHeight;
1447
+ if (this.searchDiv) {
1448
+ maxHeight -= this.searchDiv.scrollHeight;
1449
+ }
1450
+ if (this.closeDiv) {
1451
+ maxHeight -= this.closeDiv.offsetHeight;
1452
+ }
1453
+ this.scrollDiv.style.maxHeight = maxHeight + 'px';
1454
+ const levelDivRect = this.levelDiv.getBoundingClientRect();
1455
+ const levelDivHeight = levelDivRect.height;
1456
+ if (levelDivHeight < bottom - anchorHeight) {
1457
+ levelStyle.top = y + anchorHeight + 'px';
1442
1458
  }
1443
- else if (this.scrollDiv.scrollHeight > winSize / 2) {
1444
- this.scrollDiv.style.height = (winSize - y - 56) + 'px';
1459
+ else {
1460
+ if (top < bottom) {
1461
+ levelStyle.top = y - top + 'px';
1462
+ }
1463
+ else {
1464
+ levelStyle.top = Math.max(0, viewportHeight - levelDivHeight) + 'px';
1465
+ }
1445
1466
  }
1446
1467
  }
1447
- //adjusting level top position
1448
- if (adjustTopPos) {
1449
- y = this.adjustTopPos(y);
1450
- levelStyle.top = y + 'px';
1468
+ else {
1469
+ let maxHeight = Math.max(top, bottom) - magic;
1470
+ if (this.searchDiv) {
1471
+ maxHeight -= this.searchDiv.scrollHeight;
1472
+ }
1473
+ if (this.closeDiv) {
1474
+ maxHeight -= this.closeDiv.offsetHeight;
1475
+ }
1476
+ // Рахуємо початковий контейнер
1477
+ let levelDivRect = this.levelDiv.getBoundingClientRect();
1478
+ if (levelDivRect.height < bottom - anchorHeight) {
1479
+ // Контейнер може впасти вниз
1480
+ this.scrollDiv.style.maxHeight = maxHeight - magic + 'px';
1481
+ levelStyle.top = y + anchorHeight + 'px';
1482
+ }
1483
+ else {
1484
+ // Визначаємо більший простір зверху чи знизу від анкора
1485
+ if (top > bottom) {
1486
+ // Падаємо вверх
1487
+ this.scrollDiv.style.maxHeight = maxHeight + 'px';
1488
+ levelDivRect = this.levelDiv.getBoundingClientRect();
1489
+ levelStyle.top = y - levelDivRect.height + 'px';
1490
+ }
1491
+ else {
1492
+ // Падаємо вниз
1493
+ this.scrollDiv.style.maxHeight = maxHeight - magic + 'px';
1494
+ levelStyle.top = y + anchorHeight + 'px';
1495
+ }
1496
+ }
1451
1497
  }
1452
1498
  //setting minimal level width if it is defined
1453
1499
  let minItemWidth = this.parentMenu.minItemWidth;
@@ -1463,30 +1509,6 @@ class MenuLevel {
1463
1509
  this.items[i].itemDiv.style.overflowX = "hidden";
1464
1510
  }
1465
1511
  }
1466
- const winSize = ui.getWinSize();
1467
- //adjustinng maximum height of the menu level if it does not fit to browser window
1468
- let maxHeight = winSize.height - (y - ui.getScrollPos().top) - 15; //document.documentElement.scrollTop
1469
- if (this.parentMenu.maxHeight > 0 && maxHeight > this.parentMenu.maxHeight) {
1470
- maxHeight = this.parentMenu.maxHeight;
1471
- }
1472
- if (this._applyItem != null && this._applyItem.itemDiv != null) {
1473
- maxHeight -= this._applyItem.itemDiv.offsetHeight + 5;
1474
- }
1475
- if (this.searchDiv != null) {
1476
- maxHeight -= this.searchDiv.offsetHeight;
1477
- }
1478
- if (this.closeDiv != null) {
1479
- maxHeight -= this.closeDiv.offsetHeight;
1480
- }
1481
- // if (this.levelDiv.offsetHeight > maxHeight) {
1482
- // let newHeight = maxHeight;
1483
- // if (newHeight < 50) { newHeight = 50; }
1484
- //
1485
- // this.scrollDiv.style.height = newHeight + "px";
1486
- // }
1487
- // else {
1488
- // this.scrollDiv.style.height = "auto";
1489
- // }
1490
1512
  this.activeItem = null;
1491
1513
  }
1492
1514
  focus() {
@@ -1779,11 +1801,11 @@ class PopupMenu {
1779
1801
  else {
1780
1802
  const anchor = options.anchor || document.documentElement;
1781
1803
  const srcPos = ui.getElementAbsolutePos(anchor);
1782
- const anchorHeight = anchor.offsetHeight;
1804
+ anchor.offsetHeight;
1783
1805
  const anchorWidth = anchor.offsetWidth;
1784
1806
  const pos = {
1785
1807
  x: srcPos.x,
1786
- y: srcPos.y + anchorHeight + 2
1808
+ y: srcPos.y // + anchorHeight + 2
1787
1809
  };
1788
1810
  const scroll = ui.getScrollPos();
1789
1811
  const winSize = ui.getWinSize();
@@ -1791,16 +1813,7 @@ class PopupMenu {
1791
1813
  const leftSpace = pos.x + anchorWidth - scroll.left;
1792
1814
  const rightSpace = winSize.width - leftSpace + anchorWidth;
1793
1815
  pos.x += 2;
1794
- if (this.options.useMaxSpace === true) {
1795
- this.rootLevel.showAt(pos.x, pos.y, true, true);
1796
- }
1797
- else {
1798
- // console.log(this.rootLevel.levelDiv)
1799
- // if (this.rootLevel.levelDiv.scrollHeight > 500 && pos.y > winSize.height / 2) {
1800
- // pos.y = 0
1801
- // }
1802
- this.rootLevel.showAt(pos.x, pos.y, false, true);
1803
- }
1816
+ this.rootLevel.showAt(pos.x, pos.y, true, true, anchor);
1804
1817
  this.rootLevel.levelDiv.style.width = '';
1805
1818
  this.rootLevel.levelDiv.style.right = '';
1806
1819
  if (!this.rootLevel.levelDiv.style.zIndex) {
@@ -8718,8 +8731,7 @@ class EasyGridWidget extends Grid {
8718
8731
  else {
8719
8732
  gridOptions.aggregates = { settings: context.getQuery().getAggregationSettings(), calculatorRef: null };
8720
8733
  }
8721
- gridOptions.aggregates.calculatorRef = this.context.getServices()
8722
- .getAggregatesCalculator(this.context);
8734
+ gridOptions.aggregates.calculatorRef = this.context.getAggregatesCalculator();
8723
8735
  this.destroy();
8724
8736
  this.grid = new ui.EasyGrid(gridOptions);
8725
8737
  if (this.options.autoRefresh) {
@@ -1,6 +1,6 @@
1
1
  import { utils, i18n, DataType, EasyDataTable, AggregationSettings } from '@easydata/core';
2
2
  import { Widget, WidgetGroup, QueryChangePart, QueryChangeAction, ExprTag, SortDirection, i18n as i18n$1, equtils, eqconsts, ConditionPart, DataKind, Query, Expression, CondTag, EqEditorTag, EqValueEditor, EqServiceProvider, createEqContext } from '@easyquery/core';
3
- import { browserUtils, eqDragManager, domel, getElementAbsolutePos, getScrollPos, getWinSize, getViewportSize, DropEffect, createBrowserEvent, DomElementBuilder, DefaultDateTimePicker, slideDown, slideUp, EasyGrid, addCssClass, hideElement, showElement, isVisible, toggleVisibility, addElement, DefaultDialogService } from '@easydata/ui';
3
+ import { browserUtils, eqDragManager, getElementAbsolutePos, getScrollPos, getWinSize, getViewportSize, domel, DropEffect, createBrowserEvent, DomElementBuilder, DefaultDateTimePicker, slideDown, slideUp, EasyGrid, addCssClass, hideElement, showElement, isVisible, toggleVisibility, addElement, DefaultDialogService } from '@easydata/ui';
4
4
 
5
5
  function findHighestZIndex(elem) {
6
6
  let highest = 0;
@@ -1415,7 +1415,7 @@ class MenuLevel {
1415
1415
  }
1416
1416
  return res;
1417
1417
  }
1418
- showAt(x, y, adjustTopPos, hidden) {
1418
+ showAt(x, y, adjustTopPos, hidden, anchor) {
1419
1419
  if (!this.items) {
1420
1420
  return;
1421
1421
  }
@@ -1423,6 +1423,7 @@ class MenuLevel {
1423
1423
  //crocodile
1424
1424
  this.turnCheckboxes(this.items);
1425
1425
  this.renderItems();
1426
+ getWinSize();
1426
1427
  const levelStyle = this.levelDiv.style;
1427
1428
  if (hidden) {
1428
1429
  this.levelDiv.style.visibility = 'hidden';
@@ -1432,20 +1433,65 @@ class MenuLevel {
1432
1433
  levelStyle.top = y + 'px';
1433
1434
  this.scrollDiv.style.width = "auto";
1434
1435
  this.scrollDiv.style.height = "auto";
1435
- if (this.parentMenu.options.useMaxSpace === false) {
1436
- const winSize = getWinSize().height;
1437
- if (y > winSize / 2 && this.scrollDiv.scrollHeight > winSize / 2) {
1438
- this.scrollDiv.style.height = (y - 16 - 56) + 'px';
1439
- levelStyle.top = 0 + 'px';
1436
+ const useMaxSpace = this.parentMenu.options.useMaxSpace;
1437
+ const viewportHeight = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0);
1438
+ const top = y - scrollY;
1439
+ const bottom = viewportHeight - top;
1440
+ const anchorRect = anchor ? anchor.getBoundingClientRect() : null;
1441
+ const anchorHeight = anchorRect ? anchorRect.height : 0;
1442
+ const magic = 24;
1443
+ if (this.levelIndex === 0 && useMaxSpace) {
1444
+ let maxHeight = viewportHeight;
1445
+ if (this.searchDiv) {
1446
+ maxHeight -= this.searchDiv.scrollHeight;
1447
+ }
1448
+ if (this.closeDiv) {
1449
+ maxHeight -= this.closeDiv.offsetHeight;
1450
+ }
1451
+ this.scrollDiv.style.maxHeight = maxHeight + 'px';
1452
+ const levelDivRect = this.levelDiv.getBoundingClientRect();
1453
+ const levelDivHeight = levelDivRect.height;
1454
+ if (levelDivHeight < bottom - anchorHeight) {
1455
+ levelStyle.top = y + anchorHeight + 'px';
1440
1456
  }
1441
- else if (this.scrollDiv.scrollHeight > winSize / 2) {
1442
- this.scrollDiv.style.height = (winSize - y - 56) + 'px';
1457
+ else {
1458
+ if (top < bottom) {
1459
+ levelStyle.top = y - top + 'px';
1460
+ }
1461
+ else {
1462
+ levelStyle.top = Math.max(0, viewportHeight - levelDivHeight) + 'px';
1463
+ }
1443
1464
  }
1444
1465
  }
1445
- //adjusting level top position
1446
- if (adjustTopPos) {
1447
- y = this.adjustTopPos(y);
1448
- levelStyle.top = y + 'px';
1466
+ else {
1467
+ let maxHeight = Math.max(top, bottom) - magic;
1468
+ if (this.searchDiv) {
1469
+ maxHeight -= this.searchDiv.scrollHeight;
1470
+ }
1471
+ if (this.closeDiv) {
1472
+ maxHeight -= this.closeDiv.offsetHeight;
1473
+ }
1474
+ // Рахуємо початковий контейнер
1475
+ let levelDivRect = this.levelDiv.getBoundingClientRect();
1476
+ if (levelDivRect.height < bottom - anchorHeight) {
1477
+ // Контейнер може впасти вниз
1478
+ this.scrollDiv.style.maxHeight = maxHeight - magic + 'px';
1479
+ levelStyle.top = y + anchorHeight + 'px';
1480
+ }
1481
+ else {
1482
+ // Визначаємо більший простір зверху чи знизу від анкора
1483
+ if (top > bottom) {
1484
+ // Падаємо вверх
1485
+ this.scrollDiv.style.maxHeight = maxHeight + 'px';
1486
+ levelDivRect = this.levelDiv.getBoundingClientRect();
1487
+ levelStyle.top = y - levelDivRect.height + 'px';
1488
+ }
1489
+ else {
1490
+ // Падаємо вниз
1491
+ this.scrollDiv.style.maxHeight = maxHeight - magic + 'px';
1492
+ levelStyle.top = y + anchorHeight + 'px';
1493
+ }
1494
+ }
1449
1495
  }
1450
1496
  //setting minimal level width if it is defined
1451
1497
  let minItemWidth = this.parentMenu.minItemWidth;
@@ -1461,30 +1507,6 @@ class MenuLevel {
1461
1507
  this.items[i].itemDiv.style.overflowX = "hidden";
1462
1508
  }
1463
1509
  }
1464
- const winSize = getWinSize();
1465
- //adjustinng maximum height of the menu level if it does not fit to browser window
1466
- let maxHeight = winSize.height - (y - getScrollPos().top) - 15; //document.documentElement.scrollTop
1467
- if (this.parentMenu.maxHeight > 0 && maxHeight > this.parentMenu.maxHeight) {
1468
- maxHeight = this.parentMenu.maxHeight;
1469
- }
1470
- if (this._applyItem != null && this._applyItem.itemDiv != null) {
1471
- maxHeight -= this._applyItem.itemDiv.offsetHeight + 5;
1472
- }
1473
- if (this.searchDiv != null) {
1474
- maxHeight -= this.searchDiv.offsetHeight;
1475
- }
1476
- if (this.closeDiv != null) {
1477
- maxHeight -= this.closeDiv.offsetHeight;
1478
- }
1479
- // if (this.levelDiv.offsetHeight > maxHeight) {
1480
- // let newHeight = maxHeight;
1481
- // if (newHeight < 50) { newHeight = 50; }
1482
- //
1483
- // this.scrollDiv.style.height = newHeight + "px";
1484
- // }
1485
- // else {
1486
- // this.scrollDiv.style.height = "auto";
1487
- // }
1488
1510
  this.activeItem = null;
1489
1511
  }
1490
1512
  focus() {
@@ -1777,11 +1799,11 @@ class PopupMenu {
1777
1799
  else {
1778
1800
  const anchor = options.anchor || document.documentElement;
1779
1801
  const srcPos = getElementAbsolutePos(anchor);
1780
- const anchorHeight = anchor.offsetHeight;
1802
+ anchor.offsetHeight;
1781
1803
  const anchorWidth = anchor.offsetWidth;
1782
1804
  const pos = {
1783
1805
  x: srcPos.x,
1784
- y: srcPos.y + anchorHeight + 2
1806
+ y: srcPos.y // + anchorHeight + 2
1785
1807
  };
1786
1808
  const scroll = getScrollPos();
1787
1809
  const winSize = getWinSize();
@@ -1789,16 +1811,7 @@ class PopupMenu {
1789
1811
  const leftSpace = pos.x + anchorWidth - scroll.left;
1790
1812
  const rightSpace = winSize.width - leftSpace + anchorWidth;
1791
1813
  pos.x += 2;
1792
- if (this.options.useMaxSpace === true) {
1793
- this.rootLevel.showAt(pos.x, pos.y, true, true);
1794
- }
1795
- else {
1796
- // console.log(this.rootLevel.levelDiv)
1797
- // if (this.rootLevel.levelDiv.scrollHeight > 500 && pos.y > winSize.height / 2) {
1798
- // pos.y = 0
1799
- // }
1800
- this.rootLevel.showAt(pos.x, pos.y, false, true);
1801
- }
1814
+ this.rootLevel.showAt(pos.x, pos.y, true, true, anchor);
1802
1815
  this.rootLevel.levelDiv.style.width = '';
1803
1816
  this.rootLevel.levelDiv.style.right = '';
1804
1817
  if (!this.rootLevel.levelDiv.style.zIndex) {
@@ -8716,8 +8729,7 @@ class EasyGridWidget extends Grid {
8716
8729
  else {
8717
8730
  gridOptions.aggregates = { settings: context.getQuery().getAggregationSettings(), calculatorRef: null };
8718
8731
  }
8719
- gridOptions.aggregates.calculatorRef = this.context.getServices()
8720
- .getAggregatesCalculator(this.context);
8732
+ gridOptions.aggregates.calculatorRef = this.context.getAggregatesCalculator();
8721
8733
  this.destroy();
8722
8734
  this.grid = new EasyGrid(gridOptions);
8723
8735
  if (this.options.autoRefresh) {
@@ -62,7 +62,7 @@ declare class MenuLevel {
62
62
  deactivateItem(menuItem: any): void;
63
63
  showSubLevel(menuItem: MenuItem): void;
64
64
  adjustTopPos(top: number): number;
65
- showAt(x: number, y: number, adjustTopPos: boolean, hidden: boolean): void;
65
+ showAt(x: number, y: number, adjustTopPos: boolean, hidden: boolean, anchor?: HTMLElement): void;
66
66
  focus(): void;
67
67
  hide(): void;
68
68
  initLevelDiv(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyquery/ui",
3
- "version": "7.3.4",
3
+ "version": "7.3.5-rc02",
4
4
  "description": "EasyQuery.JS Community UI widgets",
5
5
  "types": "./dist/types/public_api.d.ts",
6
6
  "main": "./dist/easyquery.ui.cjs.js",
@@ -30,7 +30,7 @@
30
30
  "bugs": "https://korzh.com/support",
31
31
  "license": "LGPL-3.0",
32
32
  "peerDependencies": {
33
- "@easyquery/core": "^7.3.4"
33
+ "@easyquery/core": "^7.3.5-rc02"
34
34
  },
35
35
  "files": [
36
36
  "dist",