@easyquery/ui 7.3.4 → 7.3.5-rc01

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.
@@ -5124,6 +5124,10 @@ input.eqjs-invalid {
5124
5124
 
5125
5125
  .eqjs-cb-addrow.eqjs-mobile a, .eqjs-sb-addrow.eqjs-mobile a {
5126
5126
  background: none!important;
5127
+ }
5128
+
5129
+ .eqjs-menu-levelDiv {
5130
+ max-height: 96vh;
5127
5131
  }
5128
5132
  /*setting to all page */
5129
5133
  #eqv-main{
@@ -452,4 +452,8 @@
452
452
 
453
453
  .eqjs-cb-addrow.eqjs-mobile a, .eqjs-sb-addrow.eqjs-mobile a {
454
454
  background: none!important;
455
+ }
456
+
457
+ .eqjs-menu-levelDiv {
458
+ max-height: 96vh;
455
459
  }
@@ -1425,6 +1425,7 @@ class MenuLevel {
1425
1425
  //crocodile
1426
1426
  this.turnCheckboxes(this.items);
1427
1427
  this.renderItems();
1428
+ const winSize = ui.getWinSize();
1428
1429
  const levelStyle = this.levelDiv.style;
1429
1430
  if (hidden) {
1430
1431
  this.levelDiv.style.visibility = 'hidden';
@@ -1434,20 +1435,60 @@ 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
+ if (useMaxSpace === false) {
1440
+ const levelDivRect = this.levelDiv.getBoundingClientRect();
1441
+ const ldHeight = levelDivRect.height;
1442
+ const vpHeight = winSize.height;
1443
+ const top = y - 16 - scrollY;
1444
+ const bottom = vpHeight - top;
1445
+ if (top > bottom) {
1446
+ // console.log("top > bottom");
1447
+ if (ldHeight > bottom) {
1448
+ let maxHeight = top;
1449
+ if (this.searchDiv != null) {
1450
+ maxHeight -= this.searchDiv.offsetHeight;
1451
+ }
1452
+ if (this.closeDiv != null) {
1453
+ maxHeight -= this.closeDiv.offsetHeight;
1454
+ }
1455
+ this.scrollDiv.style.maxHeight = (maxHeight - 24) + 'px';
1456
+ this.levelDiv.style.top = Math.max(6, y - ldHeight - 24) + 'px';
1457
+ }
1442
1458
  }
1443
- else if (this.scrollDiv.scrollHeight > winSize / 2) {
1444
- this.scrollDiv.style.height = (winSize - y - 56) + 'px';
1459
+ else {
1460
+ // console.log("bottom > top");
1461
+ this.scrollDiv.style.maxHeight = (bottom - 80) + 'px';
1445
1462
  }
1446
1463
  }
1447
1464
  //adjusting level top position
1448
- if (adjustTopPos) {
1465
+ if (useMaxSpace) {
1449
1466
  y = this.adjustTopPos(y);
1450
1467
  levelStyle.top = y + 'px';
1468
+ //adjustinng maximum height of the menu level if it does not fit to browser window
1469
+ let maxHeight = winSize.height - (y - ui.getScrollPos().top) - 15; //document.documentElement.scrollTop
1470
+ if (this.parentMenu.maxHeight > 0 && maxHeight > this.parentMenu.maxHeight) {
1471
+ maxHeight = this.parentMenu.maxHeight;
1472
+ }
1473
+ if (this._applyItem != null && this._applyItem.itemDiv != null) {
1474
+ maxHeight -= this._applyItem.itemDiv.offsetHeight + 5;
1475
+ }
1476
+ if (this.searchDiv != null) {
1477
+ maxHeight -= this.searchDiv.offsetHeight;
1478
+ }
1479
+ if (this.closeDiv != null) {
1480
+ maxHeight -= this.closeDiv.offsetHeight;
1481
+ }
1482
+ if (this.levelDiv.offsetHeight > maxHeight) {
1483
+ let newHeight = maxHeight;
1484
+ if (newHeight < 50) {
1485
+ newHeight = 50;
1486
+ }
1487
+ this.scrollDiv.style.height = newHeight + "px";
1488
+ }
1489
+ else {
1490
+ this.scrollDiv.style.height = "auto";
1491
+ }
1451
1492
  }
1452
1493
  //setting minimal level width if it is defined
1453
1494
  let minItemWidth = this.parentMenu.minItemWidth;
@@ -1463,30 +1504,6 @@ class MenuLevel {
1463
1504
  this.items[i].itemDiv.style.overflowX = "hidden";
1464
1505
  }
1465
1506
  }
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
1507
  this.activeItem = null;
1491
1508
  }
1492
1509
  focus() {
@@ -1791,16 +1808,7 @@ class PopupMenu {
1791
1808
  const leftSpace = pos.x + anchorWidth - scroll.left;
1792
1809
  const rightSpace = winSize.width - leftSpace + anchorWidth;
1793
1810
  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
- }
1811
+ this.rootLevel.showAt(pos.x, pos.y, true, true);
1804
1812
  this.rootLevel.levelDiv.style.width = '';
1805
1813
  this.rootLevel.levelDiv.style.right = '';
1806
1814
  if (!this.rootLevel.levelDiv.style.zIndex) {
@@ -8718,8 +8726,7 @@ class EasyGridWidget extends Grid {
8718
8726
  else {
8719
8727
  gridOptions.aggregates = { settings: context.getQuery().getAggregationSettings(), calculatorRef: null };
8720
8728
  }
8721
- gridOptions.aggregates.calculatorRef = this.context.getServices()
8722
- .getAggregatesCalculator(this.context);
8729
+ gridOptions.aggregates.calculatorRef = this.context.getAggregatesCalculator();
8723
8730
  this.destroy();
8724
8731
  this.grid = new ui.EasyGrid(gridOptions);
8725
8732
  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;
@@ -1423,6 +1423,7 @@ class MenuLevel {
1423
1423
  //crocodile
1424
1424
  this.turnCheckboxes(this.items);
1425
1425
  this.renderItems();
1426
+ const winSize = getWinSize();
1426
1427
  const levelStyle = this.levelDiv.style;
1427
1428
  if (hidden) {
1428
1429
  this.levelDiv.style.visibility = 'hidden';
@@ -1432,20 +1433,60 @@ 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
+ if (useMaxSpace === false) {
1438
+ const levelDivRect = this.levelDiv.getBoundingClientRect();
1439
+ const ldHeight = levelDivRect.height;
1440
+ const vpHeight = winSize.height;
1441
+ const top = y - 16 - scrollY;
1442
+ const bottom = vpHeight - top;
1443
+ if (top > bottom) {
1444
+ // console.log("top > bottom");
1445
+ if (ldHeight > bottom) {
1446
+ let maxHeight = top;
1447
+ if (this.searchDiv != null) {
1448
+ maxHeight -= this.searchDiv.offsetHeight;
1449
+ }
1450
+ if (this.closeDiv != null) {
1451
+ maxHeight -= this.closeDiv.offsetHeight;
1452
+ }
1453
+ this.scrollDiv.style.maxHeight = (maxHeight - 24) + 'px';
1454
+ this.levelDiv.style.top = Math.max(6, y - ldHeight - 24) + 'px';
1455
+ }
1440
1456
  }
1441
- else if (this.scrollDiv.scrollHeight > winSize / 2) {
1442
- this.scrollDiv.style.height = (winSize - y - 56) + 'px';
1457
+ else {
1458
+ // console.log("bottom > top");
1459
+ this.scrollDiv.style.maxHeight = (bottom - 80) + 'px';
1443
1460
  }
1444
1461
  }
1445
1462
  //adjusting level top position
1446
- if (adjustTopPos) {
1463
+ if (useMaxSpace) {
1447
1464
  y = this.adjustTopPos(y);
1448
1465
  levelStyle.top = y + 'px';
1466
+ //adjustinng maximum height of the menu level if it does not fit to browser window
1467
+ let maxHeight = winSize.height - (y - getScrollPos().top) - 15; //document.documentElement.scrollTop
1468
+ if (this.parentMenu.maxHeight > 0 && maxHeight > this.parentMenu.maxHeight) {
1469
+ maxHeight = this.parentMenu.maxHeight;
1470
+ }
1471
+ if (this._applyItem != null && this._applyItem.itemDiv != null) {
1472
+ maxHeight -= this._applyItem.itemDiv.offsetHeight + 5;
1473
+ }
1474
+ if (this.searchDiv != null) {
1475
+ maxHeight -= this.searchDiv.offsetHeight;
1476
+ }
1477
+ if (this.closeDiv != null) {
1478
+ maxHeight -= this.closeDiv.offsetHeight;
1479
+ }
1480
+ if (this.levelDiv.offsetHeight > maxHeight) {
1481
+ let newHeight = maxHeight;
1482
+ if (newHeight < 50) {
1483
+ newHeight = 50;
1484
+ }
1485
+ this.scrollDiv.style.height = newHeight + "px";
1486
+ }
1487
+ else {
1488
+ this.scrollDiv.style.height = "auto";
1489
+ }
1449
1490
  }
1450
1491
  //setting minimal level width if it is defined
1451
1492
  let minItemWidth = this.parentMenu.minItemWidth;
@@ -1461,30 +1502,6 @@ class MenuLevel {
1461
1502
  this.items[i].itemDiv.style.overflowX = "hidden";
1462
1503
  }
1463
1504
  }
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
1505
  this.activeItem = null;
1489
1506
  }
1490
1507
  focus() {
@@ -1789,16 +1806,7 @@ class PopupMenu {
1789
1806
  const leftSpace = pos.x + anchorWidth - scroll.left;
1790
1807
  const rightSpace = winSize.width - leftSpace + anchorWidth;
1791
1808
  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
- }
1809
+ this.rootLevel.showAt(pos.x, pos.y, true, true);
1802
1810
  this.rootLevel.levelDiv.style.width = '';
1803
1811
  this.rootLevel.levelDiv.style.right = '';
1804
1812
  if (!this.rootLevel.levelDiv.style.zIndex) {
@@ -8716,8 +8724,7 @@ class EasyGridWidget extends Grid {
8716
8724
  else {
8717
8725
  gridOptions.aggregates = { settings: context.getQuery().getAggregationSettings(), calculatorRef: null };
8718
8726
  }
8719
- gridOptions.aggregates.calculatorRef = this.context.getServices()
8720
- .getAggregatesCalculator(this.context);
8727
+ gridOptions.aggregates.calculatorRef = this.context.getAggregatesCalculator();
8721
8728
  this.destroy();
8722
8729
  this.grid = new EasyGrid(gridOptions);
8723
8730
  if (this.options.autoRefresh) {
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-rc01",
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-rc01"
34
34
  },
35
35
  "files": [
36
36
  "dist",