@easyquery/ui 7.4.0-rc01 → 7.4.0-rc03
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/dist/assets/css/easyquery.css +1 -0
- package/dist/assets/css/easyquery.ui.css +3 -0
- package/dist/easyquery.ui.cjs.js +122 -104
- package/dist/easyquery.ui.esm.js +123 -105
- package/dist/types/utils/popup_menu.d.ts +1 -0
- package/dist/types/widgets/columns_bar.d.ts +1 -0
- package/dist/types/widgets/renderers/columnsbar/editable_column_renderer_cb.d.ts +5 -0
- package/dist/types/widgets/widget_options.d.ts +7 -0
- package/package.json +2 -2
|
@@ -3295,6 +3295,9 @@ body {
|
|
|
3295
3295
|
position: relative;
|
|
3296
3296
|
font: normal 14px Trebuchet MS, Tahoma, Verdana, Geneva, Arial, Helvetica, sans-serif;
|
|
3297
3297
|
padding: 0.5rem;
|
|
3298
|
+
-webkit-user-select: none;
|
|
3299
|
+
-moz-user-select: none;
|
|
3300
|
+
user-select: none;
|
|
3298
3301
|
}
|
|
3299
3302
|
|
|
3300
3303
|
.eqjs-cb-header, .eqjs-sb-header {
|
package/dist/easyquery.ui.cjs.js
CHANGED
|
@@ -682,20 +682,20 @@ class MenuLevel {
|
|
|
682
682
|
const applyItem = this._applyItem;
|
|
683
683
|
//if multiselect option is on - then we should add special "apply" item
|
|
684
684
|
if (multiselect && this.levelIndex === 0 && this.parentMenu.options.hideButtons !== true) {
|
|
685
|
-
|
|
686
|
-
applyDiv.classList.add(`${this.cssPrefix}-applyDiv`);
|
|
687
|
-
applyDiv['menuItem'] = applyItem;
|
|
685
|
+
this.applyDiv = document.createElement("div");
|
|
686
|
+
this.applyDiv.classList.add(`${this.cssPrefix}-applyDiv`);
|
|
687
|
+
this.applyDiv['menuItem'] = applyItem;
|
|
688
688
|
this.applyBtn = document.createElement('button');
|
|
689
689
|
if (this.parentMenu.options.useDefaultStyles) {
|
|
690
|
-
applyDiv.style.borderBottom = '1px solid';
|
|
691
|
-
applyDiv.style.padding = '5px';
|
|
692
|
-
applyDiv.style.marginBottom = '5px';
|
|
690
|
+
this.applyDiv.style.borderBottom = '1px solid';
|
|
691
|
+
this.applyDiv.style.padding = '5px';
|
|
692
|
+
this.applyDiv.style.marginBottom = '5px';
|
|
693
693
|
this.applyBtn.style.padding = '0 5px';
|
|
694
694
|
this.applyBtn.style.cursor = "pointer";
|
|
695
695
|
}
|
|
696
696
|
const applyTextNode = document.createTextNode(this.parentMenu.options.buttons.submit);
|
|
697
697
|
this.applyBtn.appendChild(applyTextNode);
|
|
698
|
-
applyDiv.appendChild(this.applyBtn);
|
|
698
|
+
this.applyDiv.appendChild(this.applyBtn);
|
|
699
699
|
//cancel btn
|
|
700
700
|
const cancelBtn = document.createElement('button');
|
|
701
701
|
cancelBtn.classList.add(`${this.cssPrefix}-cancel`);
|
|
@@ -706,9 +706,9 @@ class MenuLevel {
|
|
|
706
706
|
}
|
|
707
707
|
const cancelText = document.createTextNode(this.parentMenu.options.buttons.cancel);
|
|
708
708
|
cancelBtn.appendChild(cancelText);
|
|
709
|
-
applyDiv.appendChild(cancelBtn);
|
|
710
|
-
baseDiv.appendChild(applyDiv);
|
|
711
|
-
applyItem.itemDiv = applyDiv;
|
|
709
|
+
this.applyDiv.appendChild(cancelBtn);
|
|
710
|
+
baseDiv.appendChild(this.applyDiv);
|
|
711
|
+
applyItem.itemDiv = this.applyDiv;
|
|
712
712
|
this.applyBtn.addEventListener('click', () => {
|
|
713
713
|
this.submit(this._applyItem);
|
|
714
714
|
});
|
|
@@ -1436,78 +1436,52 @@ class MenuLevel {
|
|
|
1436
1436
|
levelStyle.top = y + 'px';
|
|
1437
1437
|
this.scrollDiv.style.width = "auto";
|
|
1438
1438
|
this.scrollDiv.style.height = "auto";
|
|
1439
|
+
this.scrollDiv.style.maxHeight = null;
|
|
1439
1440
|
const useMaxSpace = this.parentMenu.options.useMaxSpace;
|
|
1440
1441
|
const viewportHeight = ui.getViewportSize().height;
|
|
1441
|
-
const top = y - scrollY;
|
|
1442
|
-
const bottom = viewportHeight - top;
|
|
1443
1442
|
const anchorRect = anchor ? anchor.getBoundingClientRect() : null;
|
|
1444
1443
|
const anchorHeight = anchorRect ? anchorRect.height : 0;
|
|
1445
|
-
const
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
maxHeight
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
}
|
|
1487
|
-
if (this.closeDiv) {
|
|
1488
|
-
maxHeight -= this.closeDiv.offsetHeight;
|
|
1489
|
-
}
|
|
1490
|
-
// Рахуємо початковий контейнер
|
|
1491
|
-
let levelDivRect = this.levelDiv.getBoundingClientRect();
|
|
1492
|
-
if (levelDivRect.height < bottom - anchorHeight) {
|
|
1493
|
-
// Контейнер може впасти вниз
|
|
1494
|
-
this.scrollDiv.style.maxHeight = maxHeight - magic + 'px';
|
|
1495
|
-
levelStyle.top = y + anchorHeight + 'px';
|
|
1496
|
-
}
|
|
1497
|
-
else {
|
|
1498
|
-
// Визначаємо більший простір зверху чи знизу від анкора
|
|
1499
|
-
if (top > bottom) {
|
|
1500
|
-
// Падаємо вверх
|
|
1501
|
-
this.scrollDiv.style.maxHeight = maxHeight + 'px';
|
|
1502
|
-
levelDivRect = this.levelDiv.getBoundingClientRect();
|
|
1503
|
-
levelStyle.top = y - levelDivRect.height + 'px'; // - anchorHeight
|
|
1504
|
-
}
|
|
1505
|
-
else {
|
|
1506
|
-
// Падаємо вниз
|
|
1507
|
-
this.scrollDiv.style.maxHeight = maxHeight - magic - anchorHeight + 'px';
|
|
1508
|
-
levelStyle.top = y + anchorHeight + 'px';
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1444
|
+
const upperSpace = y - scrollY;
|
|
1445
|
+
const lowerSpace = viewportHeight - upperSpace - anchorHeight;
|
|
1446
|
+
const minOffset = 15;
|
|
1447
|
+
// Рахуємо початковий контейнер
|
|
1448
|
+
let levelDivRect = this.levelDiv.getBoundingClientRect();
|
|
1449
|
+
if (this.levelIndex == 0 && levelDivRect.height < lowerSpace - minOffset) { //root level. Have enough space to drop down without scroll
|
|
1450
|
+
levelStyle.top = (y + anchorHeight) + 'px';
|
|
1451
|
+
}
|
|
1452
|
+
else if (this.levelIndex == 0 && levelDivRect.height < upperSpace - minOffset) { //root level. Have enough space to drop up without scroll
|
|
1453
|
+
levelStyle.top = (y - levelDivRect.height) + 'px';
|
|
1454
|
+
}
|
|
1455
|
+
else if (useMaxSpace || this.levelIndex > 0) { //sub-level or useMaxSpace option set. Use all the space
|
|
1456
|
+
const outsideBottom = levelDivRect.bottom + minOffset - scrollY - viewportHeight;
|
|
1457
|
+
if (outsideBottom > 0) {
|
|
1458
|
+
levelStyle.top = levelDivRect.top - outsideBottom + 'px';
|
|
1459
|
+
}
|
|
1460
|
+
levelDivRect = this.levelDiv.getBoundingClientRect();
|
|
1461
|
+
const outsideTop = scrollY + minOffset - levelDivRect.top;
|
|
1462
|
+
if (outsideTop > 0) {
|
|
1463
|
+
const scrollDivRect = this.scrollDiv.getBoundingClientRect();
|
|
1464
|
+
this.scrollDiv.style.maxHeight = scrollDivRect.height - outsideTop + 'px';
|
|
1465
|
+
levelStyle.top = levelDivRect.top + outsideTop + 'px';
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
else if (upperSpace <= lowerSpace) { //root level. Drop down with scroll
|
|
1469
|
+
levelStyle.top = (y + anchorHeight) + 'px';
|
|
1470
|
+
const outsideBottom = levelDivRect.height + minOffset - lowerSpace;
|
|
1471
|
+
if (outsideBottom > 0) {
|
|
1472
|
+
const scrollDivRect = this.scrollDiv.getBoundingClientRect();
|
|
1473
|
+
this.scrollDiv.style.maxHeight = scrollDivRect.height - outsideBottom + 'px';
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
else { //root level. Drop up with scroll
|
|
1477
|
+
y -= levelDivRect.height;
|
|
1478
|
+
const outsideTop = scrollY + minOffset - y;
|
|
1479
|
+
if (outsideTop > 0) {
|
|
1480
|
+
const scrollDivRect = this.scrollDiv.getBoundingClientRect();
|
|
1481
|
+
this.scrollDiv.style.maxHeight = scrollDivRect.height - outsideTop + 'px';
|
|
1482
|
+
y += outsideTop;
|
|
1483
|
+
}
|
|
1484
|
+
levelStyle.top = y + 'px';
|
|
1511
1485
|
}
|
|
1512
1486
|
//setting minimal level width if it is defined
|
|
1513
1487
|
let minItemWidth = this.parentMenu.minItemWidth;
|
|
@@ -1805,12 +1779,13 @@ class PopupMenu {
|
|
|
1805
1779
|
this.active = true;
|
|
1806
1780
|
this.setSelectedItems(this.options.items, selectedIds);
|
|
1807
1781
|
if (ui.browserUtils.isMobileMode()) {
|
|
1808
|
-
this.rootLevel.
|
|
1782
|
+
this.rootLevel.initLevelDiv();
|
|
1809
1783
|
this.rootLevel.levelDiv.style.top = '0px';
|
|
1810
1784
|
this.rootLevel.levelDiv.style.bottom = '0px';
|
|
1811
1785
|
this.rootLevel.levelDiv.style.right = '0px';
|
|
1812
1786
|
this.rootLevel.levelDiv.style.position = 'fixed';
|
|
1813
1787
|
this.rootLevel.levelDiv.style.fontSize = '20px';
|
|
1788
|
+
this.rootLevel.showAt(0, 0, true, true);
|
|
1814
1789
|
}
|
|
1815
1790
|
else {
|
|
1816
1791
|
const anchor = options.anchor || document.documentElement;
|
|
@@ -1827,9 +1802,13 @@ class PopupMenu {
|
|
|
1827
1802
|
const leftSpace = pos.x + anchorWidth - scroll.left;
|
|
1828
1803
|
const rightSpace = winSize.width - leftSpace + anchorWidth;
|
|
1829
1804
|
pos.x += 2;
|
|
1830
|
-
this.rootLevel.
|
|
1805
|
+
this.rootLevel.initLevelDiv();
|
|
1831
1806
|
this.rootLevel.levelDiv.style.width = '';
|
|
1832
1807
|
this.rootLevel.levelDiv.style.right = '';
|
|
1808
|
+
this.rootLevel.levelDiv.style.bottom = '';
|
|
1809
|
+
this.rootLevel.levelDiv.style.position = 'absolute';
|
|
1810
|
+
this.rootLevel.levelDiv.style.fontSize = '14px';
|
|
1811
|
+
this.rootLevel.showAt(pos.x, pos.y, true, true, anchor);
|
|
1833
1812
|
if (!this.rootLevel.levelDiv.style.zIndex) {
|
|
1834
1813
|
// z-index is at least 10000 and more if anchor has bigger
|
|
1835
1814
|
this.rootLevel.levelDiv.style.zIndex = `${Math.max(10000, findHighestZIndex(anchor) + 1)}`;
|
|
@@ -1850,7 +1829,6 @@ class PopupMenu {
|
|
|
1850
1829
|
}
|
|
1851
1830
|
this.rootLevel.levelDiv.style.right = ui.getViewportSize().width - pos.x - anchorWidth + 'px';
|
|
1852
1831
|
}
|
|
1853
|
-
this.rootLevel.levelDiv.style.fontSize = '14px';
|
|
1854
1832
|
}
|
|
1855
1833
|
this.rootLevel.levelDiv.style.visibility = 'visible';
|
|
1856
1834
|
this.rootLevel.focus();
|
|
@@ -3633,7 +3611,9 @@ class ColumnsPanel extends core.Widget {
|
|
|
3633
3611
|
}
|
|
3634
3612
|
setOptions(options) {
|
|
3635
3613
|
core$1.utils.assignDeep(this.options, options);
|
|
3636
|
-
|
|
3614
|
+
if (typeof options.allowCustomExpressions !== 'undefined') {
|
|
3615
|
+
this.context.options.allowCustomExpressions = options.allowCustomExpressions;
|
|
3616
|
+
}
|
|
3637
3617
|
if (options.attrElementFormat) {
|
|
3638
3618
|
this.context.options.attributeFormat = options.attrElementFormat;
|
|
3639
3619
|
}
|
|
@@ -3995,6 +3975,13 @@ class ColumnsPanel extends core.Widget {
|
|
|
3995
3975
|
}
|
|
3996
3976
|
}
|
|
3997
3977
|
|
|
3978
|
+
exports.ColumnsEditMode = void 0;
|
|
3979
|
+
(function (ColumnsEditMode) {
|
|
3980
|
+
ColumnsEditMode[ColumnsEditMode["ReadOnly"] = 0] = "ReadOnly";
|
|
3981
|
+
ColumnsEditMode[ColumnsEditMode["FixedList"] = 16] = "FixedList";
|
|
3982
|
+
ColumnsEditMode[ColumnsEditMode["Full"] = 255] = "Full";
|
|
3983
|
+
})(exports.ColumnsEditMode || (exports.ColumnsEditMode = {}));
|
|
3984
|
+
|
|
3998
3985
|
class ColumnRendererCB {
|
|
3999
3986
|
constructor(panel, column, slot) {
|
|
4000
3987
|
this.functionMenu = null;
|
|
@@ -4018,7 +4005,7 @@ class ColumnRendererCB {
|
|
|
4018
4005
|
.replaceChild(builder.toDOM(), this.element);
|
|
4019
4006
|
}
|
|
4020
4007
|
this.element = builder.toDOM();
|
|
4021
|
-
if (this.bar.
|
|
4008
|
+
if (this.bar.isDraggable()) {
|
|
4022
4009
|
ui.eqDragManager.registerDraggableItem({
|
|
4023
4010
|
element: this.element,
|
|
4024
4011
|
scope: "entityAttrSort",
|
|
@@ -4065,15 +4052,19 @@ class ColumnRendererCB {
|
|
|
4065
4052
|
this.render();
|
|
4066
4053
|
}
|
|
4067
4054
|
isEditable() {
|
|
4068
|
-
|
|
4055
|
+
// Editable if enabled, not read-only, and editMode is All or FixedList (for title/sort/order)
|
|
4056
|
+
return this.column.enabled && !this.column.isReadOnly() && (this.bar.options.editMode === exports.ColumnsEditMode.Full || this.bar.options.editMode === exports.ColumnsEditMode.FixedList);
|
|
4069
4057
|
}
|
|
4070
4058
|
renderButtonsBlock() {
|
|
4059
|
+
// Only show delete/type buttons in All mode
|
|
4060
|
+
const showDelete = this.bar.options.editMode === exports.ColumnsEditMode.Full;
|
|
4061
|
+
const showType = this.bar.options.editMode === exports.ColumnsEditMode.Full;
|
|
4071
4062
|
return ui.domel('div', this.element)
|
|
4072
4063
|
.addClass(`${eqCssPrefix}-column-buttonsBlock`, `${this.cssPrefix}-buttonsBlock`)
|
|
4073
4064
|
.addChildElement(this.renderSortingButton())
|
|
4074
|
-
.addChildElement(this.renderColumnTypeButton())
|
|
4065
|
+
.addChildElement(showType ? this.renderColumnTypeButton() : null)
|
|
4075
4066
|
.addChildElement(this.renderColumnFormatButton())
|
|
4076
|
-
.addChildElement(this.renderDeleteButton())
|
|
4067
|
+
.addChildElement(showDelete ? this.renderDeleteButton() : null)
|
|
4077
4068
|
.toDOM();
|
|
4078
4069
|
}
|
|
4079
4070
|
renderCaptionBlock() {
|
|
@@ -4258,7 +4249,8 @@ class ColumnRendererCB {
|
|
|
4258
4249
|
return false;
|
|
4259
4250
|
}
|
|
4260
4251
|
renderDeleteButton() {
|
|
4261
|
-
|
|
4252
|
+
// Only show delete in All mode
|
|
4253
|
+
if (this.column.isReadOnly() || this.bar.options.editMode !== exports.ColumnsEditMode.Full) {
|
|
4262
4254
|
return null;
|
|
4263
4255
|
}
|
|
4264
4256
|
return ui.domel('div')
|
|
@@ -4331,7 +4323,8 @@ class ColumnRendererCB {
|
|
|
4331
4323
|
});
|
|
4332
4324
|
}
|
|
4333
4325
|
renderColumnTypeButton() {
|
|
4334
|
-
|
|
4326
|
+
// Only show type button in All mode
|
|
4327
|
+
if (!this.isEditable() || this.bar.options.allowAggrColumns === false || this.bar.options.editMode !== exports.ColumnsEditMode.Full) {
|
|
4335
4328
|
return null;
|
|
4336
4329
|
}
|
|
4337
4330
|
return ui.domel('div')
|
|
@@ -4542,6 +4535,9 @@ class AttrColumnRendererCB extends ColumnRendererCB {
|
|
|
4542
4535
|
this.fireColumnChanged();
|
|
4543
4536
|
}
|
|
4544
4537
|
changeColumnTypeHandler(ev) {
|
|
4538
|
+
// Only allow type change in All mode
|
|
4539
|
+
if (this.bar.options.editMode !== exports.ColumnsEditMode.Full)
|
|
4540
|
+
return;
|
|
4545
4541
|
this.functionMenu.showMenu({
|
|
4546
4542
|
anchor: ev.target,
|
|
4547
4543
|
selectedIds: null,
|
|
@@ -4586,10 +4582,18 @@ class AggrFuncColumnRendererCB extends AttrColumnRendererCB {
|
|
|
4586
4582
|
this.fireColumnChanged();
|
|
4587
4583
|
}
|
|
4588
4584
|
changeColumnTypeHandler(ev) {
|
|
4585
|
+
// Only allow type change in All mode
|
|
4586
|
+
if (this.bar.options.editMode !== exports.ColumnsEditMode.Full)
|
|
4587
|
+
return;
|
|
4589
4588
|
this.changeTypeToSimple();
|
|
4590
4589
|
}
|
|
4591
4590
|
}
|
|
4592
4591
|
|
|
4592
|
+
/**
|
|
4593
|
+
* Base class for editable column renderers for the ColumnsBar widgets.
|
|
4594
|
+
* It provides common functionality for rendering editable columns,
|
|
4595
|
+
* including handling column type changes and rendering buttons.
|
|
4596
|
+
*/
|
|
4593
4597
|
class EditableColumnRendererCB extends ColumnRendererCB {
|
|
4594
4598
|
getClassesToAdd() {
|
|
4595
4599
|
return `${this.cssPrefix}-row ${this.cssPrefix}-row-column-entattr` + super.getClassesToAdd();
|
|
@@ -4616,6 +4620,9 @@ class EditableColumnRendererCB extends ColumnRendererCB {
|
|
|
4616
4620
|
return true;
|
|
4617
4621
|
}
|
|
4618
4622
|
changeColumnTypeHandler(ev) {
|
|
4623
|
+
// Only allow type change in All mode
|
|
4624
|
+
if (this.bar.options.editMode !== exports.ColumnsEditMode.Full)
|
|
4625
|
+
return;
|
|
4619
4626
|
this.changeTypeToSimple();
|
|
4620
4627
|
}
|
|
4621
4628
|
}
|
|
@@ -4683,7 +4690,8 @@ class ColumnsBar extends core.Widget {
|
|
|
4683
4690
|
sortEntities: false,
|
|
4684
4691
|
columnRenderedCallback: null,
|
|
4685
4692
|
customExpressionText: 0,
|
|
4686
|
-
showAddAllForEntity: false
|
|
4693
|
+
showAddAllForEntity: false,
|
|
4694
|
+
editMode: exports.ColumnsEditMode.Full
|
|
4687
4695
|
};
|
|
4688
4696
|
this.landingSlot = ui.domel('div')
|
|
4689
4697
|
.addClass(`${eqCssPrefix}-highlight`)
|
|
@@ -4710,6 +4718,10 @@ class ColumnsBar extends core.Widget {
|
|
|
4710
4718
|
getWidgetType() {
|
|
4711
4719
|
return 'columnsBar';
|
|
4712
4720
|
}
|
|
4721
|
+
isDraggable() {
|
|
4722
|
+
// Only allow drag-drop in All and FixedList modes
|
|
4723
|
+
return this.options.allowDragDrop && this.options.editMode > exports.ColumnsEditMode.ReadOnly;
|
|
4724
|
+
}
|
|
4713
4725
|
init(context, options) {
|
|
4714
4726
|
super.init(context, options);
|
|
4715
4727
|
this.setOptions(options);
|
|
@@ -4722,7 +4734,8 @@ class ColumnsBar extends core.Widget {
|
|
|
4722
4734
|
this.detachQueryObserver();
|
|
4723
4735
|
this.attachQueryObserver();
|
|
4724
4736
|
ui.eqDragManager.removeDropContainer(this.slot);
|
|
4725
|
-
|
|
4737
|
+
// Only allow drag-drop in All and FixedList modes
|
|
4738
|
+
if (this.isDraggable()) {
|
|
4726
4739
|
ui.eqDragManager.registerDropContainer({
|
|
4727
4740
|
element: this.slot,
|
|
4728
4741
|
scopes: ["entityAttrSort"],
|
|
@@ -4848,7 +4861,9 @@ class ColumnsBar extends core.Widget {
|
|
|
4848
4861
|
}
|
|
4849
4862
|
setOptions(options) {
|
|
4850
4863
|
this.options = core$1.utils.assignDeep(this.options, options);
|
|
4851
|
-
|
|
4864
|
+
if (typeof options.allowCustomExpressions !== 'undefined') {
|
|
4865
|
+
this.context.options.allowCustomExpressions = options.allowCustomExpressions;
|
|
4866
|
+
}
|
|
4852
4867
|
}
|
|
4853
4868
|
showLandingSlot(pageX, pageY) {
|
|
4854
4869
|
const elements = this.columnsBlock.querySelectorAll(`[class*=${this.cssPrefix}-row]`);
|
|
@@ -4959,7 +4974,8 @@ class ColumnsBar extends core.Widget {
|
|
|
4959
4974
|
.addClass(`${this.cssPrefix}-columns`)
|
|
4960
4975
|
.addClass(getMobileCssClass())
|
|
4961
4976
|
.toDOM();
|
|
4962
|
-
|
|
4977
|
+
// Only show add row in All mode
|
|
4978
|
+
if (this.options.showAddRow && this.options.editMode === exports.ColumnsEditMode.Full) {
|
|
4963
4979
|
this.addRowButton =
|
|
4964
4980
|
ui.domel('div')
|
|
4965
4981
|
.toDOM();
|
|
@@ -5022,16 +5038,18 @@ class ColumnsBar extends core.Widget {
|
|
|
5022
5038
|
return false;
|
|
5023
5039
|
})
|
|
5024
5040
|
.toDOM();
|
|
5025
|
-
this.
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5041
|
+
if (this.options.editMode == exports.ColumnsEditMode.Full) {
|
|
5042
|
+
this.buttonsBlockDeleteButton = ui.domel('div', this.columnButtonsBlockMobile)
|
|
5043
|
+
.addClass(`${this.cssPrefix}-column-button`, `${this.cssPrefix}-column-button-delete`)
|
|
5044
|
+
.on('touchstart click', (ev) => {
|
|
5045
|
+
ev.stopPropagation();
|
|
5046
|
+
this.currentColumnRenderer.buttonDeleteClickHandler.call(this.currentColumnRenderer, ev);
|
|
5047
|
+
this.toggleColumnPicked(null);
|
|
5048
|
+
this.hideColumnButtonsMobile();
|
|
5049
|
+
return false;
|
|
5050
|
+
})
|
|
5051
|
+
.toDOM();
|
|
5052
|
+
}
|
|
5035
5053
|
ui.domel('div', this.columnButtonsBlockMobile)
|
|
5036
5054
|
.addClass(`${this.cssPrefix}-column-button-close-block`)
|
|
5037
5055
|
.on('touchstart click', () => {
|
|
@@ -5060,7 +5078,7 @@ class ColumnsBar extends core.Widget {
|
|
|
5060
5078
|
.setStyle('top', (top + rect.height).toString() + 'px');
|
|
5061
5079
|
}
|
|
5062
5080
|
//show/hide separate buttons
|
|
5063
|
-
if (column.enabled && !column.isReadOnly()) {
|
|
5081
|
+
if (column.enabled && !column.isReadOnly() && this.options.editMode > exports.ColumnsEditMode.ReadOnly) {
|
|
5064
5082
|
ui.domel(this.buttonsBlockSortingButton).show();
|
|
5065
5083
|
ui.domel(this.buttonsBlockTypeButton).show();
|
|
5066
5084
|
if (columnRenderer.formatButtonIsShown()) {
|
|
@@ -5075,7 +5093,7 @@ class ColumnsBar extends core.Widget {
|
|
|
5075
5093
|
ui.domel(this.buttonsBlockTypeButton).hide();
|
|
5076
5094
|
}
|
|
5077
5095
|
//show
|
|
5078
|
-
if (column.isReadOnly()) {
|
|
5096
|
+
if (column.isReadOnly() || this.options.editMode == exports.ColumnsEditMode.ReadOnly) {
|
|
5079
5097
|
ui.domel(this.columnButtonsBlockMobile).hide();
|
|
5080
5098
|
}
|
|
5081
5099
|
else {
|
package/dist/easyquery.ui.esm.js
CHANGED
|
@@ -680,20 +680,20 @@ class MenuLevel {
|
|
|
680
680
|
const applyItem = this._applyItem;
|
|
681
681
|
//if multiselect option is on - then we should add special "apply" item
|
|
682
682
|
if (multiselect && this.levelIndex === 0 && this.parentMenu.options.hideButtons !== true) {
|
|
683
|
-
|
|
684
|
-
applyDiv.classList.add(`${this.cssPrefix}-applyDiv`);
|
|
685
|
-
applyDiv['menuItem'] = applyItem;
|
|
683
|
+
this.applyDiv = document.createElement("div");
|
|
684
|
+
this.applyDiv.classList.add(`${this.cssPrefix}-applyDiv`);
|
|
685
|
+
this.applyDiv['menuItem'] = applyItem;
|
|
686
686
|
this.applyBtn = document.createElement('button');
|
|
687
687
|
if (this.parentMenu.options.useDefaultStyles) {
|
|
688
|
-
applyDiv.style.borderBottom = '1px solid';
|
|
689
|
-
applyDiv.style.padding = '5px';
|
|
690
|
-
applyDiv.style.marginBottom = '5px';
|
|
688
|
+
this.applyDiv.style.borderBottom = '1px solid';
|
|
689
|
+
this.applyDiv.style.padding = '5px';
|
|
690
|
+
this.applyDiv.style.marginBottom = '5px';
|
|
691
691
|
this.applyBtn.style.padding = '0 5px';
|
|
692
692
|
this.applyBtn.style.cursor = "pointer";
|
|
693
693
|
}
|
|
694
694
|
const applyTextNode = document.createTextNode(this.parentMenu.options.buttons.submit);
|
|
695
695
|
this.applyBtn.appendChild(applyTextNode);
|
|
696
|
-
applyDiv.appendChild(this.applyBtn);
|
|
696
|
+
this.applyDiv.appendChild(this.applyBtn);
|
|
697
697
|
//cancel btn
|
|
698
698
|
const cancelBtn = document.createElement('button');
|
|
699
699
|
cancelBtn.classList.add(`${this.cssPrefix}-cancel`);
|
|
@@ -704,9 +704,9 @@ class MenuLevel {
|
|
|
704
704
|
}
|
|
705
705
|
const cancelText = document.createTextNode(this.parentMenu.options.buttons.cancel);
|
|
706
706
|
cancelBtn.appendChild(cancelText);
|
|
707
|
-
applyDiv.appendChild(cancelBtn);
|
|
708
|
-
baseDiv.appendChild(applyDiv);
|
|
709
|
-
applyItem.itemDiv = applyDiv;
|
|
707
|
+
this.applyDiv.appendChild(cancelBtn);
|
|
708
|
+
baseDiv.appendChild(this.applyDiv);
|
|
709
|
+
applyItem.itemDiv = this.applyDiv;
|
|
710
710
|
this.applyBtn.addEventListener('click', () => {
|
|
711
711
|
this.submit(this._applyItem);
|
|
712
712
|
});
|
|
@@ -1434,78 +1434,52 @@ class MenuLevel {
|
|
|
1434
1434
|
levelStyle.top = y + 'px';
|
|
1435
1435
|
this.scrollDiv.style.width = "auto";
|
|
1436
1436
|
this.scrollDiv.style.height = "auto";
|
|
1437
|
+
this.scrollDiv.style.maxHeight = null;
|
|
1437
1438
|
const useMaxSpace = this.parentMenu.options.useMaxSpace;
|
|
1438
1439
|
const viewportHeight = getViewportSize().height;
|
|
1439
|
-
const top = y - scrollY;
|
|
1440
|
-
const bottom = viewportHeight - top;
|
|
1441
1440
|
const anchorRect = anchor ? anchor.getBoundingClientRect() : null;
|
|
1442
1441
|
const anchorHeight = anchorRect ? anchorRect.height : 0;
|
|
1443
|
-
const
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
maxHeight
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
}
|
|
1485
|
-
if (this.closeDiv) {
|
|
1486
|
-
maxHeight -= this.closeDiv.offsetHeight;
|
|
1487
|
-
}
|
|
1488
|
-
// Рахуємо початковий контейнер
|
|
1489
|
-
let levelDivRect = this.levelDiv.getBoundingClientRect();
|
|
1490
|
-
if (levelDivRect.height < bottom - anchorHeight) {
|
|
1491
|
-
// Контейнер може впасти вниз
|
|
1492
|
-
this.scrollDiv.style.maxHeight = maxHeight - magic + 'px';
|
|
1493
|
-
levelStyle.top = y + anchorHeight + 'px';
|
|
1494
|
-
}
|
|
1495
|
-
else {
|
|
1496
|
-
// Визначаємо більший простір зверху чи знизу від анкора
|
|
1497
|
-
if (top > bottom) {
|
|
1498
|
-
// Падаємо вверх
|
|
1499
|
-
this.scrollDiv.style.maxHeight = maxHeight + 'px';
|
|
1500
|
-
levelDivRect = this.levelDiv.getBoundingClientRect();
|
|
1501
|
-
levelStyle.top = y - levelDivRect.height + 'px'; // - anchorHeight
|
|
1502
|
-
}
|
|
1503
|
-
else {
|
|
1504
|
-
// Падаємо вниз
|
|
1505
|
-
this.scrollDiv.style.maxHeight = maxHeight - magic - anchorHeight + 'px';
|
|
1506
|
-
levelStyle.top = y + anchorHeight + 'px';
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1442
|
+
const upperSpace = y - scrollY;
|
|
1443
|
+
const lowerSpace = viewportHeight - upperSpace - anchorHeight;
|
|
1444
|
+
const minOffset = 15;
|
|
1445
|
+
// Рахуємо початковий контейнер
|
|
1446
|
+
let levelDivRect = this.levelDiv.getBoundingClientRect();
|
|
1447
|
+
if (this.levelIndex == 0 && levelDivRect.height < lowerSpace - minOffset) { //root level. Have enough space to drop down without scroll
|
|
1448
|
+
levelStyle.top = (y + anchorHeight) + 'px';
|
|
1449
|
+
}
|
|
1450
|
+
else if (this.levelIndex == 0 && levelDivRect.height < upperSpace - minOffset) { //root level. Have enough space to drop up without scroll
|
|
1451
|
+
levelStyle.top = (y - levelDivRect.height) + 'px';
|
|
1452
|
+
}
|
|
1453
|
+
else if (useMaxSpace || this.levelIndex > 0) { //sub-level or useMaxSpace option set. Use all the space
|
|
1454
|
+
const outsideBottom = levelDivRect.bottom + minOffset - scrollY - viewportHeight;
|
|
1455
|
+
if (outsideBottom > 0) {
|
|
1456
|
+
levelStyle.top = levelDivRect.top - outsideBottom + 'px';
|
|
1457
|
+
}
|
|
1458
|
+
levelDivRect = this.levelDiv.getBoundingClientRect();
|
|
1459
|
+
const outsideTop = scrollY + minOffset - levelDivRect.top;
|
|
1460
|
+
if (outsideTop > 0) {
|
|
1461
|
+
const scrollDivRect = this.scrollDiv.getBoundingClientRect();
|
|
1462
|
+
this.scrollDiv.style.maxHeight = scrollDivRect.height - outsideTop + 'px';
|
|
1463
|
+
levelStyle.top = levelDivRect.top + outsideTop + 'px';
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
else if (upperSpace <= lowerSpace) { //root level. Drop down with scroll
|
|
1467
|
+
levelStyle.top = (y + anchorHeight) + 'px';
|
|
1468
|
+
const outsideBottom = levelDivRect.height + minOffset - lowerSpace;
|
|
1469
|
+
if (outsideBottom > 0) {
|
|
1470
|
+
const scrollDivRect = this.scrollDiv.getBoundingClientRect();
|
|
1471
|
+
this.scrollDiv.style.maxHeight = scrollDivRect.height - outsideBottom + 'px';
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
else { //root level. Drop up with scroll
|
|
1475
|
+
y -= levelDivRect.height;
|
|
1476
|
+
const outsideTop = scrollY + minOffset - y;
|
|
1477
|
+
if (outsideTop > 0) {
|
|
1478
|
+
const scrollDivRect = this.scrollDiv.getBoundingClientRect();
|
|
1479
|
+
this.scrollDiv.style.maxHeight = scrollDivRect.height - outsideTop + 'px';
|
|
1480
|
+
y += outsideTop;
|
|
1481
|
+
}
|
|
1482
|
+
levelStyle.top = y + 'px';
|
|
1509
1483
|
}
|
|
1510
1484
|
//setting minimal level width if it is defined
|
|
1511
1485
|
let minItemWidth = this.parentMenu.minItemWidth;
|
|
@@ -1803,12 +1777,13 @@ class PopupMenu {
|
|
|
1803
1777
|
this.active = true;
|
|
1804
1778
|
this.setSelectedItems(this.options.items, selectedIds);
|
|
1805
1779
|
if (browserUtils.isMobileMode()) {
|
|
1806
|
-
this.rootLevel.
|
|
1780
|
+
this.rootLevel.initLevelDiv();
|
|
1807
1781
|
this.rootLevel.levelDiv.style.top = '0px';
|
|
1808
1782
|
this.rootLevel.levelDiv.style.bottom = '0px';
|
|
1809
1783
|
this.rootLevel.levelDiv.style.right = '0px';
|
|
1810
1784
|
this.rootLevel.levelDiv.style.position = 'fixed';
|
|
1811
1785
|
this.rootLevel.levelDiv.style.fontSize = '20px';
|
|
1786
|
+
this.rootLevel.showAt(0, 0, true, true);
|
|
1812
1787
|
}
|
|
1813
1788
|
else {
|
|
1814
1789
|
const anchor = options.anchor || document.documentElement;
|
|
@@ -1825,9 +1800,13 @@ class PopupMenu {
|
|
|
1825
1800
|
const leftSpace = pos.x + anchorWidth - scroll.left;
|
|
1826
1801
|
const rightSpace = winSize.width - leftSpace + anchorWidth;
|
|
1827
1802
|
pos.x += 2;
|
|
1828
|
-
this.rootLevel.
|
|
1803
|
+
this.rootLevel.initLevelDiv();
|
|
1829
1804
|
this.rootLevel.levelDiv.style.width = '';
|
|
1830
1805
|
this.rootLevel.levelDiv.style.right = '';
|
|
1806
|
+
this.rootLevel.levelDiv.style.bottom = '';
|
|
1807
|
+
this.rootLevel.levelDiv.style.position = 'absolute';
|
|
1808
|
+
this.rootLevel.levelDiv.style.fontSize = '14px';
|
|
1809
|
+
this.rootLevel.showAt(pos.x, pos.y, true, true, anchor);
|
|
1831
1810
|
if (!this.rootLevel.levelDiv.style.zIndex) {
|
|
1832
1811
|
// z-index is at least 10000 and more if anchor has bigger
|
|
1833
1812
|
this.rootLevel.levelDiv.style.zIndex = `${Math.max(10000, findHighestZIndex(anchor) + 1)}`;
|
|
@@ -1848,7 +1827,6 @@ class PopupMenu {
|
|
|
1848
1827
|
}
|
|
1849
1828
|
this.rootLevel.levelDiv.style.right = getViewportSize().width - pos.x - anchorWidth + 'px';
|
|
1850
1829
|
}
|
|
1851
|
-
this.rootLevel.levelDiv.style.fontSize = '14px';
|
|
1852
1830
|
}
|
|
1853
1831
|
this.rootLevel.levelDiv.style.visibility = 'visible';
|
|
1854
1832
|
this.rootLevel.focus();
|
|
@@ -3631,7 +3609,9 @@ class ColumnsPanel extends Widget {
|
|
|
3631
3609
|
}
|
|
3632
3610
|
setOptions(options) {
|
|
3633
3611
|
utils.assignDeep(this.options, options);
|
|
3634
|
-
|
|
3612
|
+
if (typeof options.allowCustomExpressions !== 'undefined') {
|
|
3613
|
+
this.context.options.allowCustomExpressions = options.allowCustomExpressions;
|
|
3614
|
+
}
|
|
3635
3615
|
if (options.attrElementFormat) {
|
|
3636
3616
|
this.context.options.attributeFormat = options.attrElementFormat;
|
|
3637
3617
|
}
|
|
@@ -3993,6 +3973,13 @@ class ColumnsPanel extends Widget {
|
|
|
3993
3973
|
}
|
|
3994
3974
|
}
|
|
3995
3975
|
|
|
3976
|
+
var ColumnsEditMode;
|
|
3977
|
+
(function (ColumnsEditMode) {
|
|
3978
|
+
ColumnsEditMode[ColumnsEditMode["ReadOnly"] = 0] = "ReadOnly";
|
|
3979
|
+
ColumnsEditMode[ColumnsEditMode["FixedList"] = 16] = "FixedList";
|
|
3980
|
+
ColumnsEditMode[ColumnsEditMode["Full"] = 255] = "Full";
|
|
3981
|
+
})(ColumnsEditMode || (ColumnsEditMode = {}));
|
|
3982
|
+
|
|
3996
3983
|
class ColumnRendererCB {
|
|
3997
3984
|
constructor(panel, column, slot) {
|
|
3998
3985
|
this.functionMenu = null;
|
|
@@ -4016,7 +4003,7 @@ class ColumnRendererCB {
|
|
|
4016
4003
|
.replaceChild(builder.toDOM(), this.element);
|
|
4017
4004
|
}
|
|
4018
4005
|
this.element = builder.toDOM();
|
|
4019
|
-
if (this.bar.
|
|
4006
|
+
if (this.bar.isDraggable()) {
|
|
4020
4007
|
eqDragManager.registerDraggableItem({
|
|
4021
4008
|
element: this.element,
|
|
4022
4009
|
scope: "entityAttrSort",
|
|
@@ -4063,15 +4050,19 @@ class ColumnRendererCB {
|
|
|
4063
4050
|
this.render();
|
|
4064
4051
|
}
|
|
4065
4052
|
isEditable() {
|
|
4066
|
-
|
|
4053
|
+
// Editable if enabled, not read-only, and editMode is All or FixedList (for title/sort/order)
|
|
4054
|
+
return this.column.enabled && !this.column.isReadOnly() && (this.bar.options.editMode === ColumnsEditMode.Full || this.bar.options.editMode === ColumnsEditMode.FixedList);
|
|
4067
4055
|
}
|
|
4068
4056
|
renderButtonsBlock() {
|
|
4057
|
+
// Only show delete/type buttons in All mode
|
|
4058
|
+
const showDelete = this.bar.options.editMode === ColumnsEditMode.Full;
|
|
4059
|
+
const showType = this.bar.options.editMode === ColumnsEditMode.Full;
|
|
4069
4060
|
return domel('div', this.element)
|
|
4070
4061
|
.addClass(`${eqCssPrefix}-column-buttonsBlock`, `${this.cssPrefix}-buttonsBlock`)
|
|
4071
4062
|
.addChildElement(this.renderSortingButton())
|
|
4072
|
-
.addChildElement(this.renderColumnTypeButton())
|
|
4063
|
+
.addChildElement(showType ? this.renderColumnTypeButton() : null)
|
|
4073
4064
|
.addChildElement(this.renderColumnFormatButton())
|
|
4074
|
-
.addChildElement(this.renderDeleteButton())
|
|
4065
|
+
.addChildElement(showDelete ? this.renderDeleteButton() : null)
|
|
4075
4066
|
.toDOM();
|
|
4076
4067
|
}
|
|
4077
4068
|
renderCaptionBlock() {
|
|
@@ -4256,7 +4247,8 @@ class ColumnRendererCB {
|
|
|
4256
4247
|
return false;
|
|
4257
4248
|
}
|
|
4258
4249
|
renderDeleteButton() {
|
|
4259
|
-
|
|
4250
|
+
// Only show delete in All mode
|
|
4251
|
+
if (this.column.isReadOnly() || this.bar.options.editMode !== ColumnsEditMode.Full) {
|
|
4260
4252
|
return null;
|
|
4261
4253
|
}
|
|
4262
4254
|
return domel('div')
|
|
@@ -4329,7 +4321,8 @@ class ColumnRendererCB {
|
|
|
4329
4321
|
});
|
|
4330
4322
|
}
|
|
4331
4323
|
renderColumnTypeButton() {
|
|
4332
|
-
|
|
4324
|
+
// Only show type button in All mode
|
|
4325
|
+
if (!this.isEditable() || this.bar.options.allowAggrColumns === false || this.bar.options.editMode !== ColumnsEditMode.Full) {
|
|
4333
4326
|
return null;
|
|
4334
4327
|
}
|
|
4335
4328
|
return domel('div')
|
|
@@ -4540,6 +4533,9 @@ class AttrColumnRendererCB extends ColumnRendererCB {
|
|
|
4540
4533
|
this.fireColumnChanged();
|
|
4541
4534
|
}
|
|
4542
4535
|
changeColumnTypeHandler(ev) {
|
|
4536
|
+
// Only allow type change in All mode
|
|
4537
|
+
if (this.bar.options.editMode !== ColumnsEditMode.Full)
|
|
4538
|
+
return;
|
|
4543
4539
|
this.functionMenu.showMenu({
|
|
4544
4540
|
anchor: ev.target,
|
|
4545
4541
|
selectedIds: null,
|
|
@@ -4584,10 +4580,18 @@ class AggrFuncColumnRendererCB extends AttrColumnRendererCB {
|
|
|
4584
4580
|
this.fireColumnChanged();
|
|
4585
4581
|
}
|
|
4586
4582
|
changeColumnTypeHandler(ev) {
|
|
4583
|
+
// Only allow type change in All mode
|
|
4584
|
+
if (this.bar.options.editMode !== ColumnsEditMode.Full)
|
|
4585
|
+
return;
|
|
4587
4586
|
this.changeTypeToSimple();
|
|
4588
4587
|
}
|
|
4589
4588
|
}
|
|
4590
4589
|
|
|
4590
|
+
/**
|
|
4591
|
+
* Base class for editable column renderers for the ColumnsBar widgets.
|
|
4592
|
+
* It provides common functionality for rendering editable columns,
|
|
4593
|
+
* including handling column type changes and rendering buttons.
|
|
4594
|
+
*/
|
|
4591
4595
|
class EditableColumnRendererCB extends ColumnRendererCB {
|
|
4592
4596
|
getClassesToAdd() {
|
|
4593
4597
|
return `${this.cssPrefix}-row ${this.cssPrefix}-row-column-entattr` + super.getClassesToAdd();
|
|
@@ -4614,6 +4618,9 @@ class EditableColumnRendererCB extends ColumnRendererCB {
|
|
|
4614
4618
|
return true;
|
|
4615
4619
|
}
|
|
4616
4620
|
changeColumnTypeHandler(ev) {
|
|
4621
|
+
// Only allow type change in All mode
|
|
4622
|
+
if (this.bar.options.editMode !== ColumnsEditMode.Full)
|
|
4623
|
+
return;
|
|
4617
4624
|
this.changeTypeToSimple();
|
|
4618
4625
|
}
|
|
4619
4626
|
}
|
|
@@ -4681,7 +4688,8 @@ class ColumnsBar extends Widget {
|
|
|
4681
4688
|
sortEntities: false,
|
|
4682
4689
|
columnRenderedCallback: null,
|
|
4683
4690
|
customExpressionText: 0,
|
|
4684
|
-
showAddAllForEntity: false
|
|
4691
|
+
showAddAllForEntity: false,
|
|
4692
|
+
editMode: ColumnsEditMode.Full
|
|
4685
4693
|
};
|
|
4686
4694
|
this.landingSlot = domel('div')
|
|
4687
4695
|
.addClass(`${eqCssPrefix}-highlight`)
|
|
@@ -4708,6 +4716,10 @@ class ColumnsBar extends Widget {
|
|
|
4708
4716
|
getWidgetType() {
|
|
4709
4717
|
return 'columnsBar';
|
|
4710
4718
|
}
|
|
4719
|
+
isDraggable() {
|
|
4720
|
+
// Only allow drag-drop in All and FixedList modes
|
|
4721
|
+
return this.options.allowDragDrop && this.options.editMode > ColumnsEditMode.ReadOnly;
|
|
4722
|
+
}
|
|
4711
4723
|
init(context, options) {
|
|
4712
4724
|
super.init(context, options);
|
|
4713
4725
|
this.setOptions(options);
|
|
@@ -4720,7 +4732,8 @@ class ColumnsBar extends Widget {
|
|
|
4720
4732
|
this.detachQueryObserver();
|
|
4721
4733
|
this.attachQueryObserver();
|
|
4722
4734
|
eqDragManager.removeDropContainer(this.slot);
|
|
4723
|
-
|
|
4735
|
+
// Only allow drag-drop in All and FixedList modes
|
|
4736
|
+
if (this.isDraggable()) {
|
|
4724
4737
|
eqDragManager.registerDropContainer({
|
|
4725
4738
|
element: this.slot,
|
|
4726
4739
|
scopes: ["entityAttrSort"],
|
|
@@ -4846,7 +4859,9 @@ class ColumnsBar extends Widget {
|
|
|
4846
4859
|
}
|
|
4847
4860
|
setOptions(options) {
|
|
4848
4861
|
this.options = utils.assignDeep(this.options, options);
|
|
4849
|
-
|
|
4862
|
+
if (typeof options.allowCustomExpressions !== 'undefined') {
|
|
4863
|
+
this.context.options.allowCustomExpressions = options.allowCustomExpressions;
|
|
4864
|
+
}
|
|
4850
4865
|
}
|
|
4851
4866
|
showLandingSlot(pageX, pageY) {
|
|
4852
4867
|
const elements = this.columnsBlock.querySelectorAll(`[class*=${this.cssPrefix}-row]`);
|
|
@@ -4957,7 +4972,8 @@ class ColumnsBar extends Widget {
|
|
|
4957
4972
|
.addClass(`${this.cssPrefix}-columns`)
|
|
4958
4973
|
.addClass(getMobileCssClass())
|
|
4959
4974
|
.toDOM();
|
|
4960
|
-
|
|
4975
|
+
// Only show add row in All mode
|
|
4976
|
+
if (this.options.showAddRow && this.options.editMode === ColumnsEditMode.Full) {
|
|
4961
4977
|
this.addRowButton =
|
|
4962
4978
|
domel('div')
|
|
4963
4979
|
.toDOM();
|
|
@@ -5020,16 +5036,18 @@ class ColumnsBar extends Widget {
|
|
|
5020
5036
|
return false;
|
|
5021
5037
|
})
|
|
5022
5038
|
.toDOM();
|
|
5023
|
-
this.
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5039
|
+
if (this.options.editMode == ColumnsEditMode.Full) {
|
|
5040
|
+
this.buttonsBlockDeleteButton = domel('div', this.columnButtonsBlockMobile)
|
|
5041
|
+
.addClass(`${this.cssPrefix}-column-button`, `${this.cssPrefix}-column-button-delete`)
|
|
5042
|
+
.on('touchstart click', (ev) => {
|
|
5043
|
+
ev.stopPropagation();
|
|
5044
|
+
this.currentColumnRenderer.buttonDeleteClickHandler.call(this.currentColumnRenderer, ev);
|
|
5045
|
+
this.toggleColumnPicked(null);
|
|
5046
|
+
this.hideColumnButtonsMobile();
|
|
5047
|
+
return false;
|
|
5048
|
+
})
|
|
5049
|
+
.toDOM();
|
|
5050
|
+
}
|
|
5033
5051
|
domel('div', this.columnButtonsBlockMobile)
|
|
5034
5052
|
.addClass(`${this.cssPrefix}-column-button-close-block`)
|
|
5035
5053
|
.on('touchstart click', () => {
|
|
@@ -5058,7 +5076,7 @@ class ColumnsBar extends Widget {
|
|
|
5058
5076
|
.setStyle('top', (top + rect.height).toString() + 'px');
|
|
5059
5077
|
}
|
|
5060
5078
|
//show/hide separate buttons
|
|
5061
|
-
if (column.enabled && !column.isReadOnly()) {
|
|
5079
|
+
if (column.enabled && !column.isReadOnly() && this.options.editMode > ColumnsEditMode.ReadOnly) {
|
|
5062
5080
|
domel(this.buttonsBlockSortingButton).show();
|
|
5063
5081
|
domel(this.buttonsBlockTypeButton).show();
|
|
5064
5082
|
if (columnRenderer.formatButtonIsShown()) {
|
|
@@ -5073,7 +5091,7 @@ class ColumnsBar extends Widget {
|
|
|
5073
5091
|
domel(this.buttonsBlockTypeButton).hide();
|
|
5074
5092
|
}
|
|
5075
5093
|
//show
|
|
5076
|
-
if (column.isReadOnly()) {
|
|
5094
|
+
if (column.isReadOnly() || this.options.editMode == ColumnsEditMode.ReadOnly) {
|
|
5077
5095
|
domel(this.columnButtonsBlockMobile).hide();
|
|
5078
5096
|
}
|
|
5079
5097
|
else {
|
|
@@ -14481,4 +14499,4 @@ if (!Array.prototype.findIndex) {
|
|
|
14481
14499
|
};
|
|
14482
14500
|
}
|
|
14483
14501
|
|
|
14484
|
-
export { AddRowRenderer, AdvancedSearchView, AggrFuncColumnRendererCB, AggrFuncColumnRendererCP, AggrSettingsDialog, AggrSettingsRenderer, AggregationBar, AttrColumnRendererCB, AttrColumnRendererCP, AttributeExpressionRenderer, BaseElementRenderer, ChartFacet, ChartJsWidget, ChartType, ChartWidget, ColumnAction, ColumnRendererCB, ColumnRendererCP, ColumnsBar, ColumnsPanel, ConditionAction, ConditionGroupRenderer, ConditionGroupRowRenderer, ConditionRenderer, ConstColumnRendererCP, CustomListExpressionRenderer, CustomSqlColumnRendererCP, DataFilterView, DataTableFacet, DateTimeExpressionRenderer, DomDropDownElementBuilder, DropDownRenderer, EasyGridWidget, EntitiesPanel, EqHtmlGrid, ExportDialog, ExportWidget, ExpressionRenderer, FacetContainer, FacetType, FilterBar, GoogleChartWidget, Grid, HtmlContentWidget, HtmlDataFilterView, InputExpressionRenderer, ListExpressionRenderer, ManageDrillDownWidget, OperatorRenderer, PivotTableFacet, PopupMenu, ProcessWidget, QPEditablePart, QueryPanel, ReportView, ResultFacet, ResultFacetsPanel, SimpleConditionRenderer, SortingBar, SqlListExpressionRenderer, StatementPanel, SubQueryExpressionRenderer, TextRenderer, View, dropdown };
|
|
14502
|
+
export { AddRowRenderer, AdvancedSearchView, AggrFuncColumnRendererCB, AggrFuncColumnRendererCP, AggrSettingsDialog, AggrSettingsRenderer, AggregationBar, AttrColumnRendererCB, AttrColumnRendererCP, AttributeExpressionRenderer, BaseElementRenderer, ChartFacet, ChartJsWidget, ChartType, ChartWidget, ColumnAction, ColumnRendererCB, ColumnRendererCP, ColumnsBar, ColumnsEditMode, ColumnsPanel, ConditionAction, ConditionGroupRenderer, ConditionGroupRowRenderer, ConditionRenderer, ConstColumnRendererCP, CustomListExpressionRenderer, CustomSqlColumnRendererCP, DataFilterView, DataTableFacet, DateTimeExpressionRenderer, DomDropDownElementBuilder, DropDownRenderer, EasyGridWidget, EntitiesPanel, EqHtmlGrid, ExportDialog, ExportWidget, ExpressionRenderer, FacetContainer, FacetType, FilterBar, GoogleChartWidget, Grid, HtmlContentWidget, HtmlDataFilterView, InputExpressionRenderer, ListExpressionRenderer, ManageDrillDownWidget, OperatorRenderer, PivotTableFacet, PopupMenu, ProcessWidget, QPEditablePart, QueryPanel, ReportView, ResultFacet, ResultFacetsPanel, SimpleConditionRenderer, SortingBar, SqlListExpressionRenderer, StatementPanel, SubQueryExpressionRenderer, TextRenderer, View, dropdown };
|
|
@@ -20,6 +20,7 @@ export declare class ColumnsBar extends Widget {
|
|
|
20
20
|
private customQuery?;
|
|
21
21
|
constructor(slot: HTMLElement, customQuery?: Query);
|
|
22
22
|
getWidgetType(): string;
|
|
23
|
+
isDraggable(): boolean;
|
|
23
24
|
init(context: EqContext, options?: ColumnsBarOptions): void;
|
|
24
25
|
private attachQueryObserver;
|
|
25
26
|
getQuery(): Query;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { ColumnRendererCB } from './column_renderer_cb';
|
|
2
|
+
/**
|
|
3
|
+
* Base class for editable column renderers for the ColumnsBar widgets.
|
|
4
|
+
* It provides common functionality for rendering editable columns,
|
|
5
|
+
* including handling column type changes and rendering buttons.
|
|
6
|
+
*/
|
|
2
7
|
export declare class EditableColumnRendererCB extends ColumnRendererCB {
|
|
3
8
|
protected getClassesToAdd(): string;
|
|
4
9
|
protected renderColumnTypeButton(): HTMLDivElement;
|
|
@@ -15,6 +15,11 @@ export interface UseInOptions {
|
|
|
15
15
|
useInResult: boolean;
|
|
16
16
|
useInSorting: boolean;
|
|
17
17
|
}
|
|
18
|
+
export declare enum ColumnsEditMode {
|
|
19
|
+
ReadOnly = 0,
|
|
20
|
+
FixedList = 16,
|
|
21
|
+
Full = 255
|
|
22
|
+
}
|
|
18
23
|
/** EntitiesPanel options */
|
|
19
24
|
export interface EntitiesPanelOptions {
|
|
20
25
|
showToolbar?: boolean;
|
|
@@ -168,6 +173,8 @@ export interface ColumnsPanelOptions {
|
|
|
168
173
|
showAddAllForEntity?: boolean;
|
|
169
174
|
/** Gets or sets a value indicating whether a progress indicator should appear while the model is loading */
|
|
170
175
|
showIndicatorOnLoad?: boolean;
|
|
176
|
+
/** Gets or sets the edit mode option: All, FixedList or ReadOnly */
|
|
177
|
+
editMode?: ColumnsEditMode;
|
|
171
178
|
[name: string]: any;
|
|
172
179
|
}
|
|
173
180
|
/** Columns bar options */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easyquery/ui",
|
|
3
|
-
"version": "7.4.0-
|
|
3
|
+
"version": "7.4.0-rc03",
|
|
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.4.0-
|
|
33
|
+
"@easyquery/core": "^7.4.0-rc03"
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"dist",
|