@refinitiv-ui/efx-grid 6.0.137 → 6.0.138
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/lib/column-selection-dialog/lib/column-selection-dialog.js +67 -62
- package/lib/grid/index.js +1 -1
- package/lib/types/es6/RowFiltering.d.ts +2 -1
- package/lib/types/es6/Zoom.d.ts +14 -14
- package/lib/versions.json +2 -2
- package/lib/zoom/es6/Zoom.d.ts +14 -14
- package/lib/zoom/es6/Zoom.js +43 -31
- package/package.json +1 -1
@@ -570,7 +570,7 @@ class ColumnSelectionDialog extends BasicElement {
|
|
570
570
|
this._excludedRightColumns = 0;
|
571
571
|
this._unmovableColumns = 0;
|
572
572
|
this._pendingScroll = false;
|
573
|
-
this.
|
573
|
+
this._focusedElement = null;
|
574
574
|
this._pendingTreeRefresh = false;
|
575
575
|
this._pendingResetSearchInput = false;
|
576
576
|
this._middleSeparator = "";
|
@@ -613,6 +613,8 @@ class ColumnSelectionDialog extends BasicElement {
|
|
613
613
|
this._handleInfoIconMouseover = this._handleInfoIconMouseover.bind(this);
|
614
614
|
this._handleInfoIconMouseout = this._handleInfoIconMouseout.bind(this);
|
615
615
|
this._handleClick = this._handleClick.bind(this);
|
616
|
+
this._handleFocusIn = this._handleFocusIn.bind(this);
|
617
|
+
this._handleFocusOut = this._handleFocusOut.bind(this);
|
616
618
|
this._createTreeCustomRender = this._createTreeCustomRender.bind(this);
|
617
619
|
this._selectAllCheckedChanged = this._selectAllCheckedChanged.bind(this);
|
618
620
|
|
@@ -738,7 +740,7 @@ class ColumnSelectionDialog extends BasicElement {
|
|
738
740
|
</div>
|
739
741
|
<div class="row">
|
740
742
|
<div class="side">
|
741
|
-
<ef-search-field placeholder="${this._searchPlaceholder ? this._searchPlaceholder : t["Search"]}" id="searchInput"></ef-search-field>
|
743
|
+
<ef-search-field aria-label="search for columns" placeholder="${this._searchPlaceholder ? this._searchPlaceholder : t["Search"]}" id="searchInput"></ef-search-field>
|
742
744
|
</div>
|
743
745
|
<div class="side">
|
744
746
|
<label>${t["Show in this order"]}</label>
|
@@ -750,13 +752,13 @@ class ColumnSelectionDialog extends BasicElement {
|
|
750
752
|
<div id="allColumns">
|
751
753
|
<ef-item id="treeNoResult" class="no-results" label="${t["No results found"]}"></ef-item>
|
752
754
|
<ef-header level="1" id="selectAllHeader">
|
753
|
-
<ef-checkbox id="selectAllCheckbox">${t["Select All"]}</ef-checkbox>
|
755
|
+
<ef-checkbox aria-label="select all columns" id="selectAllCheckbox">${t["Select All"]}</ef-checkbox>
|
754
756
|
</ef-header>
|
755
|
-
<ef-tree id="tree" multiple></ef-tree>
|
757
|
+
<ef-tree aria-label="column list" id="tree" multiple></ef-tree>
|
756
758
|
</div>
|
757
759
|
</div>
|
758
760
|
<div class="side" id="visibleSide">
|
759
|
-
<div id="visibleColumns">
|
761
|
+
<div id="visibleColumns" aria-label="visible column list">
|
760
762
|
${this._visibleColumnList.map(item => html`
|
761
763
|
<ef-item
|
762
764
|
value="${item.value}"
|
@@ -768,10 +770,10 @@ class ColumnSelectionDialog extends BasicElement {
|
|
768
770
|
</div>
|
769
771
|
<div id="ordering_div">
|
770
772
|
<div id="ordering_buttons">
|
771
|
-
<ef-button icon="up" @click="${this._onUpItem}" id="upItem">${t["Up"]}</ef-button><!--
|
772
|
-
--><ef-button icon="down" @click="${this._onDownItem}" id="downItem">${t["Down"]}</ef-button>
|
773
|
+
<ef-button aria-label="move selected visible columns up" icon="up" @click="${this._onUpItem}" id="upItem">${t["Up"]}</ef-button><!--
|
774
|
+
--><ef-button aria-label="move selected visible columns down" icon="down" @click="${this._onDownItem}" id="downItem">${t["Down"]}</ef-button>
|
773
775
|
</div>
|
774
|
-
<ef-button id="removeFromVisibleColumnsBtn" @click="${this._removeBtnClicked}">${t["Remove"]}</ef-button>
|
776
|
+
<ef-button aria-label="remove selected visible columns" id="removeFromVisibleColumnsBtn" @click="${this._removeBtnClicked}">${t["Remove"]}</ef-button>
|
775
777
|
</div>
|
776
778
|
</div>
|
777
779
|
</div>
|
@@ -779,7 +781,7 @@ class ColumnSelectionDialog extends BasicElement {
|
|
779
781
|
</div>
|
780
782
|
<div slot="footer">
|
781
783
|
<div part="custom-buttons">
|
782
|
-
${this._defaultItems ? html`<ef-button id="restore_btn" @click="${this._restoreDefault}" tabindex="0">${t["RESTORE DEFAULT"]}</ef-button>` : ""}
|
784
|
+
${this._defaultItems ? html`<ef-button aria-label="restore default visible columns" id="restore_btn" @click="${this._restoreDefault}" tabindex="0">${t["RESTORE DEFAULT"]}</ef-button>` : ""}
|
783
785
|
${hasNoVisibleItem ? html`<ef-icon icon="warning-circle"></ef-icon>` : ""}
|
784
786
|
${hasNoVisibleItem ? html`<div id="status_div">${t["WARNING_1"]}</div>` : ""}
|
785
787
|
</div>
|
@@ -827,6 +829,8 @@ class ColumnSelectionDialog extends BasicElement {
|
|
827
829
|
this._visibleColumnsContainer.addEventListener('mouseout', this._handleMouseout);
|
828
830
|
this._visibleColumnsContainer.addEventListener('click', this._handleClick);
|
829
831
|
this._visibleColumnsContainer.addEventListener('dblclick', this._removeBtnClicked);
|
832
|
+
this._visibleColumnsContainer.addEventListener('focusin', this._handleFocusIn);
|
833
|
+
this._visibleColumnsContainer.addEventListener('focusout', this._handleFocusOut);
|
830
834
|
|
831
835
|
// icon custom renderer
|
832
836
|
if(this._descriptionBox) { // TODO: This should not work only for the first time
|
@@ -1131,58 +1135,42 @@ class ColumnSelectionDialog extends BasicElement {
|
|
1131
1135
|
return getItemIndex(this._visibleColumnList, separatorCol.value, "value");
|
1132
1136
|
}
|
1133
1137
|
|
1134
|
-
/** This will also remove focused state set by ef-item
|
1135
|
-
* @private
|
1136
|
-
*/
|
1137
|
-
_unhighlightItems() {
|
1138
|
-
if(this._highlightedElem) { // There can be only one highlighted Item
|
1139
|
-
this._highlightedElem.highlighted = false;
|
1140
|
-
this._highlightedElem.removeAttribute('focused'); // WORKAROUND: Focused and highlighted have the same styles in Halo themes
|
1141
|
-
this._highlightedElem = null;
|
1142
|
-
}
|
1143
|
-
}
|
1144
|
-
|
1145
1138
|
/** @private
|
1146
1139
|
* @param {number} step if positive highlight will move up, if negative highlight will move down
|
1147
1140
|
*/
|
1148
|
-
|
1141
|
+
_moveFocusedItem(step) {
|
1149
1142
|
if (!step) {
|
1150
1143
|
return;
|
1151
1144
|
}
|
1152
1145
|
|
1153
|
-
|
1146
|
+
var focusedEl = this._focusedElement;
|
1147
|
+
if (!focusedEl) {
|
1154
1148
|
var selectedIndexes = _getSelectedItemIndexes(this._visibleColumnList);
|
1155
1149
|
if (!selectedIndexes.length) {
|
1156
1150
|
return;
|
1157
1151
|
}
|
1158
1152
|
|
1159
|
-
|
1160
|
-
this._highlightedElem.highlighted = true;
|
1153
|
+
focusedEl = this._visibleColumnsContainer.children[selectedIndexes[0]];
|
1161
1154
|
}
|
1162
1155
|
|
1163
|
-
var pn =
|
1156
|
+
var pn = focusedEl.parentNode;
|
1164
1157
|
if(!pn) {
|
1165
1158
|
return;
|
1166
1159
|
}
|
1167
1160
|
|
1168
1161
|
var chdr = pn.children;
|
1169
1162
|
var childCount = chdr.length;
|
1170
|
-
var i; //
|
1163
|
+
var i; // focused element index
|
1171
1164
|
for(i = 0; i < childCount; ++i) {
|
1172
|
-
if(chdr[i] ===
|
1165
|
+
if(chdr[i] === focusedEl) {
|
1173
1166
|
break;
|
1174
1167
|
}
|
1175
1168
|
}
|
1176
|
-
if(i >= childCount) {
|
1177
|
-
return;
|
1178
|
-
}
|
1179
1169
|
|
1180
1170
|
i += step;
|
1181
1171
|
if (i >= 0 && i < childCount) {
|
1182
|
-
this._unhighlightItems();
|
1183
|
-
this._highlightedElem = chdr[i];
|
1184
|
-
this._highlightedElem.highlighted = true;
|
1185
1172
|
scrollToItem(pn, i);
|
1173
|
+
chdr[i].focus();
|
1186
1174
|
}
|
1187
1175
|
}
|
1188
1176
|
|
@@ -1501,6 +1489,22 @@ class ColumnSelectionDialog extends BasicElement {
|
|
1501
1489
|
this._selectAllStatus && this._selectAllCheckbox.setAttribute(this._selectAllStatus, "");
|
1502
1490
|
}
|
1503
1491
|
|
1492
|
+
/**
|
1493
|
+
* @private
|
1494
|
+
* @param {Object} e
|
1495
|
+
*/
|
1496
|
+
_handleFocusIn(e) {
|
1497
|
+
this._focusedElement = e.target;
|
1498
|
+
}
|
1499
|
+
|
1500
|
+
/**
|
1501
|
+
* @private
|
1502
|
+
* @param {Object} e
|
1503
|
+
*/
|
1504
|
+
_handleFocusOut(e) {
|
1505
|
+
this._focusedElement = null;
|
1506
|
+
}
|
1507
|
+
|
1504
1508
|
/**
|
1505
1509
|
* @private
|
1506
1510
|
* @param {Object} e
|
@@ -1509,17 +1513,32 @@ class ColumnSelectionDialog extends BasicElement {
|
|
1509
1513
|
var handled = false;
|
1510
1514
|
switch (e.keyCode) {
|
1511
1515
|
case 40: // down
|
1512
|
-
|
1513
|
-
this._moveHighlightedItems(1);
|
1516
|
+
this._moveFocusedItem(1);
|
1514
1517
|
handled = true;
|
1515
1518
|
break;
|
1516
1519
|
case 38: // up
|
1517
|
-
this.
|
1520
|
+
this._moveFocusedItem(-1);
|
1518
1521
|
handled = true;
|
1519
1522
|
break;
|
1523
|
+
case 9: // tab
|
1524
|
+
var focusedEl = this._focusedElement;
|
1525
|
+
if (focusedEl) {
|
1526
|
+
if (e.shiftKey) {
|
1527
|
+
if(focusedEl.previousElementSibling) {
|
1528
|
+
this._moveFocusedItem(-1);
|
1529
|
+
handled = true;
|
1530
|
+
}
|
1531
|
+
} else {
|
1532
|
+
if (focusedEl.nextElementSibling) {
|
1533
|
+
this._moveFocusedItem(1);
|
1534
|
+
handled = true;
|
1535
|
+
}
|
1536
|
+
}
|
1537
|
+
}
|
1538
|
+
break;
|
1520
1539
|
case 13: // enter
|
1521
|
-
if(this.
|
1522
|
-
this.
|
1540
|
+
if(this._focusedElement) {
|
1541
|
+
this._focusedElement.click();
|
1523
1542
|
handled = true;
|
1524
1543
|
}
|
1525
1544
|
break;
|
@@ -1527,7 +1546,6 @@ class ColumnSelectionDialog extends BasicElement {
|
|
1527
1546
|
|
1528
1547
|
if(handled) {
|
1529
1548
|
e.preventDefault();
|
1530
|
-
e.stopPropagation();
|
1531
1549
|
}
|
1532
1550
|
}
|
1533
1551
|
|
@@ -1538,14 +1556,7 @@ class ColumnSelectionDialog extends BasicElement {
|
|
1538
1556
|
_handleMouseover(e) {
|
1539
1557
|
var targetElem = e.target;
|
1540
1558
|
if (targetElem.highlightable) {
|
1541
|
-
|
1542
|
-
if(this._highlightedElem === targetElem) {
|
1543
|
-
return;
|
1544
|
-
}
|
1545
|
-
this._highlightedElem.highlighted = false;
|
1546
|
-
}
|
1547
|
-
this._highlightedElem = targetElem;
|
1548
|
-
this._highlightedElem.highlighted = true;
|
1559
|
+
targetElem.highlighted = true;
|
1549
1560
|
}
|
1550
1561
|
}
|
1551
1562
|
|
@@ -1554,11 +1565,7 @@ class ColumnSelectionDialog extends BasicElement {
|
|
1554
1565
|
* @param {Object} e
|
1555
1566
|
*/
|
1556
1567
|
_handleMouseout(e) {
|
1557
|
-
|
1558
|
-
if (targetElem === this._highlightedElem) {
|
1559
|
-
targetElem.highlighted = false;
|
1560
|
-
this._highlightedElem = null;
|
1561
|
-
}
|
1568
|
+
e.target.highlighted = false;
|
1562
1569
|
}
|
1563
1570
|
|
1564
1571
|
/**
|
@@ -1582,8 +1589,7 @@ class ColumnSelectionDialog extends BasicElement {
|
|
1582
1589
|
return;
|
1583
1590
|
}
|
1584
1591
|
|
1585
|
-
var list =
|
1586
|
-
list = this._visibleColumnList;
|
1592
|
+
var list = this._visibleColumnList;
|
1587
1593
|
var selectedIndex = getDomElementIndex(selectedElement);
|
1588
1594
|
|
1589
1595
|
if(e.metaKey || e.ctrlKey) {
|
@@ -1608,7 +1614,7 @@ class ColumnSelectionDialog extends BasicElement {
|
|
1608
1614
|
* @private
|
1609
1615
|
* @param {object} e - event object
|
1610
1616
|
*/
|
1611
|
-
|
1617
|
+
_handleInfoIconClicked(e) {
|
1612
1618
|
var targetElem = e.currentTarget;
|
1613
1619
|
var divItem = targetElem.parentNode;
|
1614
1620
|
var treeItem = divItem.parentNode;
|
@@ -1621,7 +1627,7 @@ class ColumnSelectionDialog extends BasicElement {
|
|
1621
1627
|
* @private
|
1622
1628
|
* @param {object} e - event object
|
1623
1629
|
*/
|
1624
|
-
|
1630
|
+
_handleInfoIconMouseover(e) {
|
1625
1631
|
var targetElem = e.currentTarget;
|
1626
1632
|
var divItem = targetElem.parentNode;
|
1627
1633
|
var treeItem = divItem.parentNode;
|
@@ -1634,7 +1640,7 @@ class ColumnSelectionDialog extends BasicElement {
|
|
1634
1640
|
* @private
|
1635
1641
|
* @param {object} e - event object
|
1636
1642
|
*/
|
1637
|
-
|
1643
|
+
_handleInfoIconMouseout(e) {
|
1638
1644
|
var targetElem = e.currentTarget;
|
1639
1645
|
var divItem = targetElem.parentNode;
|
1640
1646
|
var treeItem = divItem.parentNode;
|
@@ -1873,10 +1879,10 @@ class ColumnSelectionDialog extends BasicElement {
|
|
1873
1879
|
}
|
1874
1880
|
|
1875
1881
|
/**
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1882
|
+
* ef-tree value changed event
|
1883
|
+
* @param {Object} e
|
1884
|
+
* @private
|
1885
|
+
*/
|
1880
1886
|
_treeValueChanged(e) {
|
1881
1887
|
var selectedMapping = {};
|
1882
1888
|
|
@@ -2007,7 +2013,6 @@ class ColumnSelectionDialog extends BasicElement {
|
|
2007
2013
|
if (index >= 0) this._visibleColumnList[index] = null;
|
2008
2014
|
}
|
2009
2015
|
this._visibleColumnList = this._visibleColumnList.filter(Boolean); // clear null element
|
2010
|
-
this._unhighlightItems();
|
2011
2016
|
this._pendingButtonUpdate = true;
|
2012
2017
|
}
|
2013
2018
|
}
|
package/lib/grid/index.js
CHANGED
@@ -37,7 +37,8 @@ declare namespace RowFilteringPlugin {
|
|
37
37
|
itemList?: any[]|null,
|
38
38
|
additionalItems?: any[]|null,
|
39
39
|
compactMode?: boolean|null,
|
40
|
-
blankValues?: (boolean|string)|null
|
40
|
+
blankValues?: (boolean|string)|null,
|
41
|
+
dateTimeFormat?: string|null
|
41
42
|
};
|
42
43
|
|
43
44
|
type FilterEntry = {
|
package/lib/types/es6/Zoom.d.ts
CHANGED
@@ -4,23 +4,23 @@ import Ext from "../../tr-grid-util/es6/Ext.js";
|
|
4
4
|
declare namespace ZoomPlugin {
|
5
5
|
|
6
6
|
type Options = {
|
7
|
-
zoomFactor?: number,
|
8
|
-
step?: number,
|
9
|
-
wheel?: boolean,
|
10
|
-
maxFactor?: number,
|
11
|
-
minFactor?: number,
|
12
|
-
zoomChanged?: ((...params: any[]) => any)
|
7
|
+
zoomFactor?: number|null,
|
8
|
+
step?: number|null,
|
9
|
+
wheel?: boolean|null,
|
10
|
+
maxFactor?: number|null,
|
11
|
+
minFactor?: number|null,
|
12
|
+
zoomChanged?: ((...params: any[]) => any)|null
|
13
13
|
};
|
14
14
|
|
15
15
|
}
|
16
16
|
|
17
17
|
declare class ZoomPlugin extends GridPlugin {
|
18
18
|
|
19
|
-
constructor(options?: ZoomPlugin.Options);
|
19
|
+
constructor(options?: ZoomPlugin.Options|null);
|
20
20
|
|
21
21
|
public hasMultiTableSupport(): boolean;
|
22
22
|
|
23
|
-
public config(options?: ZoomPlugin.Options): void;
|
23
|
+
public config(options?: ZoomPlugin.Options|null): void;
|
24
24
|
|
25
25
|
public getConfigObject(gridOptions?: any): any;
|
26
26
|
|
@@ -30,21 +30,21 @@ declare class ZoomPlugin extends GridPlugin {
|
|
30
30
|
|
31
31
|
public zoomOut(): number;
|
32
32
|
|
33
|
-
public zoomTo(factor?: number): number;
|
33
|
+
public zoomTo(factor?: number|null): number;
|
34
34
|
|
35
35
|
public setStep(step: number): void;
|
36
36
|
|
37
|
-
public zoomDefault(zoomFactor?: number): number;
|
37
|
+
public zoomDefault(zoomFactor?: number|null): number;
|
38
38
|
|
39
|
-
public addElement(elem: Element): void;
|
39
|
+
public addElement(elem: Element|null): void;
|
40
40
|
|
41
|
-
public removeElement(elem: Element): Element;
|
41
|
+
public removeElement(elem: Element|null): Element|null;
|
42
42
|
|
43
43
|
public updateZoomedLayout(): void;
|
44
44
|
|
45
|
-
public enableWheelToZoom(bool?: boolean): void;
|
45
|
+
public enableWheelToZoom(bool?: boolean|null): void;
|
46
46
|
|
47
|
-
public getDefaultMouseWheelLogic(): ((...params: any[]) => any);
|
47
|
+
public getDefaultMouseWheelLogic(): ((...params: any[]) => any)|null;
|
48
48
|
|
49
49
|
}
|
50
50
|
|
package/lib/versions.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
"@grid/column-dragging": "1.0.21",
|
5
5
|
"@grid/row-segmenting": "1.0.35",
|
6
6
|
"@grid/statistics-row": "1.0.17",
|
7
|
-
"@grid/zoom": "1.0.
|
7
|
+
"@grid/zoom": "1.0.13",
|
8
8
|
"tr-grid-auto-tooltip": "1.1.9",
|
9
9
|
"tr-grid-cell-selection": "1.0.39",
|
10
10
|
"tr-grid-checkbox": "1.0.70",
|
@@ -31,7 +31,7 @@
|
|
31
31
|
"tr-grid-textformatting": "1.0.49",
|
32
32
|
"tr-grid-titlewrap": "1.0.22",
|
33
33
|
"@grid/formatters": "1.0.55",
|
34
|
-
"@grid/column-selection-dialog": "4.0.
|
34
|
+
"@grid/column-selection-dialog": "4.0.59",
|
35
35
|
"@grid/filter-dialog": "4.0.79",
|
36
36
|
"@grid/column-format-dialog": "4.0.45"
|
37
37
|
}
|
package/lib/zoom/es6/Zoom.d.ts
CHANGED
@@ -4,23 +4,23 @@ import Ext from "../../tr-grid-util/es6/Ext.js";
|
|
4
4
|
declare namespace ZoomPlugin {
|
5
5
|
|
6
6
|
type Options = {
|
7
|
-
zoomFactor?: number,
|
8
|
-
step?: number,
|
9
|
-
wheel?: boolean,
|
10
|
-
maxFactor?: number,
|
11
|
-
minFactor?: number,
|
12
|
-
zoomChanged?: ((...params: any[]) => any)
|
7
|
+
zoomFactor?: number|null,
|
8
|
+
step?: number|null,
|
9
|
+
wheel?: boolean|null,
|
10
|
+
maxFactor?: number|null,
|
11
|
+
minFactor?: number|null,
|
12
|
+
zoomChanged?: ((...params: any[]) => any)|null
|
13
13
|
};
|
14
14
|
|
15
15
|
}
|
16
16
|
|
17
17
|
declare class ZoomPlugin extends GridPlugin {
|
18
18
|
|
19
|
-
constructor(options?: ZoomPlugin.Options);
|
19
|
+
constructor(options?: ZoomPlugin.Options|null);
|
20
20
|
|
21
21
|
public hasMultiTableSupport(): boolean;
|
22
22
|
|
23
|
-
public config(options?: ZoomPlugin.Options): void;
|
23
|
+
public config(options?: ZoomPlugin.Options|null): void;
|
24
24
|
|
25
25
|
public getConfigObject(gridOptions?: any): any;
|
26
26
|
|
@@ -30,21 +30,21 @@ declare class ZoomPlugin extends GridPlugin {
|
|
30
30
|
|
31
31
|
public zoomOut(): number;
|
32
32
|
|
33
|
-
public zoomTo(factor?: number): number;
|
33
|
+
public zoomTo(factor?: number|null): number;
|
34
34
|
|
35
35
|
public setStep(step: number): void;
|
36
36
|
|
37
|
-
public zoomDefault(zoomFactor?: number): number;
|
37
|
+
public zoomDefault(zoomFactor?: number|null): number;
|
38
38
|
|
39
|
-
public addElement(elem: Element): void;
|
39
|
+
public addElement(elem: Element|null): void;
|
40
40
|
|
41
|
-
public removeElement(elem: Element): Element;
|
41
|
+
public removeElement(elem: Element|null): Element|null;
|
42
42
|
|
43
43
|
public updateZoomedLayout(): void;
|
44
44
|
|
45
|
-
public enableWheelToZoom(bool?: boolean): void;
|
45
|
+
public enableWheelToZoom(bool?: boolean|null): void;
|
46
46
|
|
47
|
-
public getDefaultMouseWheelLogic(): ((...params: any[]) => any);
|
47
|
+
public getDefaultMouseWheelLogic(): ((...params: any[]) => any)|null;
|
48
48
|
|
49
49
|
}
|
50
50
|
|
package/lib/zoom/es6/Zoom.js
CHANGED
@@ -24,8 +24,8 @@ import Ext from "../../tr-grid-util/es6/Ext.js";
|
|
24
24
|
* @param {ZoomPlugin.Options=} options
|
25
25
|
* @extends {GridPlugin}
|
26
26
|
*/
|
27
|
-
|
28
|
-
|
27
|
+
let ZoomPlugin = function (options) {
|
28
|
+
let t = this;
|
29
29
|
|
30
30
|
t._updateZoomedLayout = t._updateZoomedLayout.bind(t);
|
31
31
|
t._updateElementLayout = t._updateElementLayout.bind(t);
|
@@ -81,7 +81,7 @@ ZoomPlugin.prototype.getName = function () {
|
|
81
81
|
|
82
82
|
/** @override */
|
83
83
|
ZoomPlugin.prototype.initialize = function (host, options) {
|
84
|
-
|
84
|
+
let t = this;
|
85
85
|
if (t._hosts.indexOf(host) >= 0) {
|
86
86
|
return;
|
87
87
|
}
|
@@ -104,8 +104,8 @@ ZoomPlugin.prototype.initialize = function (host, options) {
|
|
104
104
|
|
105
105
|
/** @override */
|
106
106
|
ZoomPlugin.prototype.unload = function (host) {
|
107
|
-
|
108
|
-
|
107
|
+
let t = this;
|
108
|
+
let at = t._hosts.indexOf(host);
|
109
109
|
if (at < 0) { return; }
|
110
110
|
|
111
111
|
if(t._hosts.length === 1) {
|
@@ -123,14 +123,14 @@ ZoomPlugin.prototype.unload = function (host) {
|
|
123
123
|
ZoomPlugin.prototype.config = function (options) {
|
124
124
|
if (!options) { return; }
|
125
125
|
|
126
|
-
|
126
|
+
let extOptions = options["zoom"];
|
127
127
|
|
128
128
|
if (!extOptions) {
|
129
129
|
return;
|
130
130
|
}
|
131
|
-
|
131
|
+
let t = this;
|
132
132
|
|
133
|
-
|
133
|
+
let val = extOptions["wheel"];
|
134
134
|
if (val != null) {
|
135
135
|
t._wheel = !!val;
|
136
136
|
}
|
@@ -163,14 +163,16 @@ ZoomPlugin.prototype.config = function (options) {
|
|
163
163
|
* @return {!Object}
|
164
164
|
*/
|
165
165
|
ZoomPlugin.prototype.getConfigObject = function (gridOptions) {
|
166
|
-
|
166
|
+
let obj = gridOptions || {};
|
167
167
|
|
168
|
-
|
168
|
+
let extOptions = obj.zoom;
|
169
169
|
if(!extOptions) {
|
170
170
|
extOptions = obj.zoom = {};
|
171
171
|
}
|
172
172
|
|
173
|
-
|
173
|
+
if(!this._wheel) {
|
174
|
+
extOptions.wheel = false;
|
175
|
+
}
|
174
176
|
|
175
177
|
if (this._step !== 0.25) {
|
176
178
|
extOptions.step = this._step;
|
@@ -201,7 +203,7 @@ ZoomPlugin.prototype.getZoomFactor = function () {
|
|
201
203
|
* @return {number} zoomFactor
|
202
204
|
*/
|
203
205
|
ZoomPlugin.prototype.zoomIn = function () {
|
204
|
-
|
206
|
+
let t = this;
|
205
207
|
t.zoomTo(t._zoomFactor + t._step);
|
206
208
|
return t._zoomFactor;
|
207
209
|
};
|
@@ -210,7 +212,7 @@ ZoomPlugin.prototype.zoomIn = function () {
|
|
210
212
|
* @return {number} zoomFactor
|
211
213
|
*/
|
212
214
|
ZoomPlugin.prototype.zoomOut = function () {
|
213
|
-
|
215
|
+
let t = this;
|
214
216
|
t.zoomTo(t._zoomFactor - t._step);
|
215
217
|
return t._zoomFactor;
|
216
218
|
};
|
@@ -220,7 +222,7 @@ ZoomPlugin.prototype.zoomOut = function () {
|
|
220
222
|
* @return {number} factor
|
221
223
|
*/
|
222
224
|
ZoomPlugin.prototype.zoomTo = function (factor) {
|
223
|
-
|
225
|
+
let t = this;
|
224
226
|
|
225
227
|
if (!factor) { // 0, NaN, undefined, empty string, and null
|
226
228
|
factor = 1;
|
@@ -239,11 +241,11 @@ ZoomPlugin.prototype.zoomTo = function (factor) {
|
|
239
241
|
return factor;
|
240
242
|
}
|
241
243
|
|
242
|
-
|
244
|
+
let prevZoomFactor = t._zoomFactor;
|
243
245
|
t._zoomFactor = factor;
|
244
246
|
|
245
247
|
// TODO: Refactor the logic, so that the zoom styles are applied directly to the parent element, eliminating margin-right styling
|
246
|
-
|
248
|
+
let i;
|
247
249
|
for (i = t._elems.length; --i >= 0;) {
|
248
250
|
t._applyZoom(t._elems[i]);
|
249
251
|
}
|
@@ -264,7 +266,7 @@ ZoomPlugin.prototype.zoomTo = function (factor) {
|
|
264
266
|
* @param {number} step
|
265
267
|
*/
|
266
268
|
ZoomPlugin.prototype.setStep = function (step) {
|
267
|
-
|
269
|
+
let s = step;
|
268
270
|
if (s != null) {
|
269
271
|
if (typeof s !== "number") {
|
270
272
|
s = parseFloat(s);
|
@@ -285,7 +287,7 @@ ZoomPlugin.prototype.zoomDefault = ZoomPlugin.prototype.zoomTo;
|
|
285
287
|
* @param {Element} elem
|
286
288
|
*/
|
287
289
|
ZoomPlugin.prototype.addElement = function (elem) {
|
288
|
-
|
290
|
+
let t = this;
|
289
291
|
if (elem && t._elems.indexOf(elem) < 0) {
|
290
292
|
t._applyZoom(elem);
|
291
293
|
t._elems.push(elem);
|
@@ -298,8 +300,8 @@ ZoomPlugin.prototype.addElement = function (elem) {
|
|
298
300
|
* @returns {Element}
|
299
301
|
*/
|
300
302
|
ZoomPlugin.prototype.removeElement = function (elem) {
|
301
|
-
|
302
|
-
|
303
|
+
let t = this;
|
304
|
+
let at = t._elems.indexOf(elem);
|
303
305
|
if (at >= 0) {
|
304
306
|
t._elems.splice(at, 1);
|
305
307
|
t._clearZoomStyles(elem);
|
@@ -317,11 +319,11 @@ ZoomPlugin.prototype.updateZoomedLayout = function() {
|
|
317
319
|
* @param {Element|tr.Grid} obj
|
318
320
|
*/
|
319
321
|
ZoomPlugin.prototype._applyZoom = function (obj) {
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
322
|
+
let t = this;
|
323
|
+
let elem = (obj && obj.getElement) ? obj.getElement() : obj;
|
324
|
+
if(!elem) {
|
325
|
+
return;
|
326
|
+
}
|
325
327
|
|
326
328
|
// This type of css scale is most compatable options
|
327
329
|
// alternative css can be more promising but not the most copatable (like: zoom)
|
@@ -343,7 +345,7 @@ ZoomPlugin.prototype._applyZoom = function (obj) {
|
|
343
345
|
* @param {Element} elem
|
344
346
|
*/
|
345
347
|
ZoomPlugin.prototype._updateElementLayout = function (elem) {
|
346
|
-
|
348
|
+
let domStyle = /** @type{CSSStyleDeclaration} */(elem.style);
|
347
349
|
if(this._zoomFactor !== 1) {
|
348
350
|
// After scaling there is empty space between elem and it's parent
|
349
351
|
// So it needs to correct the transformation shift of an inline-element
|
@@ -356,7 +358,7 @@ ZoomPlugin.prototype._updateElementLayout = function (elem) {
|
|
356
358
|
/** @private
|
357
359
|
*/
|
358
360
|
ZoomPlugin.prototype._updateZoomedLayout = function() {
|
359
|
-
|
361
|
+
let i, elem;
|
360
362
|
for(i = this._elems.length; --i >= 0;) {
|
361
363
|
elem = this._elems[i];
|
362
364
|
this._updateElementLayout(elem);
|
@@ -371,7 +373,7 @@ ZoomPlugin.prototype._updateZoomedLayout = function() {
|
|
371
373
|
* @param {Element} elem
|
372
374
|
*/
|
373
375
|
ZoomPlugin.prototype._clearZoomStyles = function (elem) {
|
374
|
-
|
376
|
+
let domStyle = /** @type{CSSStyleDeclaration} */(elem.style);
|
375
377
|
domStyle["transform"] = "";
|
376
378
|
domStyle["transformOrigin"] = "";
|
377
379
|
domStyle["marginRight"] = "";
|
@@ -382,11 +384,11 @@ ZoomPlugin.prototype._clearZoomStyles = function (elem) {
|
|
382
384
|
* @param {boolean=} bool
|
383
385
|
*/
|
384
386
|
ZoomPlugin.prototype.enableWheelToZoom = function (bool) {
|
385
|
-
|
387
|
+
let t = this;
|
386
388
|
bool = !!bool; // Force boolean
|
387
389
|
if (t._wheel !== bool) {
|
388
390
|
t._wheel = bool;
|
389
|
-
for (
|
391
|
+
for (let i = t._hosts.length; --i >= 0;) {
|
390
392
|
if (bool) {
|
391
393
|
t._hosts[i].listen("wheel", t._onWheel);
|
392
394
|
} else {
|
@@ -402,7 +404,7 @@ ZoomPlugin.prototype.enableWheelToZoom = function (bool) {
|
|
402
404
|
ZoomPlugin.prototype._onWheel = function (e) {
|
403
405
|
if (!e.ctrlKey || e.shiftKey || e.altKey) { return; } // Only handle Ctrl+wheel
|
404
406
|
|
405
|
-
|
407
|
+
let delta = e["deltaY"]; // Provided by WheelEvent >> https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent
|
406
408
|
if (!delta) { return; }
|
407
409
|
|
408
410
|
e.preventDefault(); // Disable browser default zoom behaviour
|
@@ -420,6 +422,16 @@ ZoomPlugin.prototype.getDefaultMouseWheelLogic = function () {
|
|
420
422
|
return this._onWheel;
|
421
423
|
};
|
422
424
|
|
425
|
+
/** @public
|
426
|
+
* @ignore
|
427
|
+
* @return {!Object}
|
428
|
+
*/
|
429
|
+
ZoomPlugin.prototype._getEventHandlers = function() {
|
430
|
+
return {
|
431
|
+
"wheel": this._onWheel
|
432
|
+
};
|
433
|
+
};
|
434
|
+
|
423
435
|
|
424
436
|
|
425
437
|
export default ZoomPlugin;
|
package/package.json
CHANGED