@refinitiv-ui/efx-grid 6.0.105 → 6.0.107
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/core/dist/core.js +12 -11
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/grid/Core.js +7 -8
- package/lib/core/es6/grid/ILayoutGrid.js +1 -1
- package/lib/core/es6/grid/components/Scrollbar.js +4 -2
- package/lib/filter-dialog/lib/filter-dialog.d.ts +2 -0
- package/lib/filter-dialog/lib/filter-dialog.js +23 -1
- package/lib/filter-dialog/themes/base-checkbox.less +1 -2
- package/lib/filter-dialog/themes/elemental/dark/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +1 -1
- package/lib/filter-dialog/themes/elemental/light/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/elemental/light/es5/all-elements.js +1 -1
- package/lib/filter-dialog/themes/halo/dark/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/filter-dialog/themes/halo/light/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/filter-dialog/themes/solar/charcoal/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/solar/charcoal/es5/all-elements.js +1 -1
- package/lib/filter-dialog/themes/solar/pearl/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/solar/pearl/es5/all-elements.js +1 -1
- package/lib/formatters/es6/FormatterBuilder.js +10 -1
- package/lib/formatters/es6/SimpleTickerFormatter.d.ts +0 -2
- package/lib/formatters/es6/SimpleTickerFormatter.js +1 -0
- package/lib/grid/index.js +1 -1
- package/lib/rt-grid/dist/rt-grid.js +32 -15
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/FieldDefinition.d.ts +2 -0
- package/lib/rt-grid/es6/FieldDefinition.js +20 -4
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +128 -89
- package/lib/tr-grid-printer/es6/CellWriter.d.ts +6 -5
- package/lib/tr-grid-printer/es6/CellWriter.js +57 -49
- package/lib/tr-grid-printer/es6/ColumnWriter.d.ts +1 -0
- package/lib/tr-grid-printer/es6/ColumnWriter.js +3 -1
- package/lib/tr-grid-printer/es6/GridPrinter.js +117 -99
- package/lib/tr-grid-printer/es6/PrintTrait.d.ts +1 -0
- package/lib/tr-grid-printer/es6/PrintTrait.js +60 -47
- package/lib/tr-grid-printer/es6/SectionWriter.d.ts +4 -1
- package/lib/tr-grid-printer/es6/SectionWriter.js +40 -15
- package/lib/tr-grid-row-filtering/es6/RowFiltering.d.ts +2 -0
- package/lib/tr-grid-row-filtering/es6/RowFiltering.js +14 -0
- package/lib/tr-grid-row-grouping/es6/RowGrouping.js +6 -0
- package/lib/tr-grid-util/es6/MultiTableManager.js +1 -0
- package/lib/types/es6/RealtimeGrid/FieldDefinition.d.ts +2 -0
- package/lib/types/es6/SimpleTickerFormatter.d.ts +0 -2
- package/lib/versions.json +7 -7
- package/package.json +1 -1
@@ -35,7 +35,11 @@ let FieldDefinition = {};
|
|
35
35
|
/** @type {Object.<string, Object>}
|
36
36
|
* @private
|
37
37
|
*/
|
38
|
-
FieldDefinition._defs = {
|
38
|
+
FieldDefinition._defs = {};
|
39
|
+
/** @type {Object.<string, Object>}
|
40
|
+
* @private
|
41
|
+
*/
|
42
|
+
FieldDefinition._defaults = {
|
39
43
|
"CF_NAME": {
|
40
44
|
name: "Name",
|
41
45
|
rank: 2800003,
|
@@ -180,6 +184,17 @@ FieldDefinition.set = function(field, def) {
|
|
180
184
|
/** Get field definition object
|
181
185
|
* @public
|
182
186
|
* @function
|
187
|
+
*/
|
188
|
+
FieldDefinition.resetAll = function() {
|
189
|
+
let defs = FieldDefinition._defs = {};
|
190
|
+
let defaultFields = FieldDefinition._defaults;
|
191
|
+
for(let key in defaultFields) {
|
192
|
+
defs[key] = defaultFields[key];
|
193
|
+
}
|
194
|
+
};
|
195
|
+
/** Get field definition object
|
196
|
+
* @public
|
197
|
+
* @function
|
183
198
|
* @param {string} field
|
184
199
|
* @return {Object}
|
185
200
|
*/
|
@@ -244,7 +259,7 @@ FieldDefinition.setSynapseConfig = function (config) {
|
|
244
259
|
* @param {boolean} disabled=true if disable it, time series will not be expand
|
245
260
|
*/
|
246
261
|
FieldDefinition.disableTimeSeriesExpansion = function(disabled) {
|
247
|
-
FieldDefinition._timeSeriesExpansion = disabled
|
262
|
+
FieldDefinition._timeSeriesExpansion = disabled === false;
|
248
263
|
};
|
249
264
|
|
250
265
|
/** @public
|
@@ -535,8 +550,9 @@ function onLoadEnd(e) {
|
|
535
550
|
}
|
536
551
|
|
537
552
|
(function() { // Add "field" property to all default field definitions. This reduces file size and redundancy
|
538
|
-
for(let key in FieldDefinition.
|
539
|
-
FieldDefinition.
|
553
|
+
for(let key in FieldDefinition._defaults) {
|
554
|
+
FieldDefinition._defaults[key]["field"] = key;
|
555
|
+
FieldDefinition._defs[key] = FieldDefinition._defaults[key];
|
540
556
|
}
|
541
557
|
})();
|
542
558
|
|
@@ -119,17 +119,18 @@ import { CoralItems } from "../../tr-grid-util/es6/CoralItems.js";
|
|
119
119
|
* @property {Object} grid core grid instance
|
120
120
|
* @property {number} rowIndex row index that editor placed.
|
121
121
|
* @property {number} rowId row id, It's better to use row id as a reference to collect data.
|
122
|
-
* @property {
|
122
|
+
* @property {Object} fieldValues Object that contains text in each field
|
123
|
+
* @property {Object} fieldValue Alias to fieldValues
|
123
124
|
* @property {boolean=} cancel Set to true to cancel the commit operation.
|
124
125
|
* @example
|
125
126
|
* let cep = new InCellEditingPlugin();
|
126
127
|
* cep.listen("beforeRowCommit", function(e) {
|
127
|
-
* let
|
128
|
-
* for(let field in
|
129
|
-
* if(!
|
130
|
-
* let value =
|
128
|
+
* let fieldValues = e.fieldValues;
|
129
|
+
* for(let field in fieldValues) {
|
130
|
+
* if(!fieldValues.hasOwnProperty(field)) continue;
|
131
|
+
* let value = fieldValues[field];
|
131
132
|
* if(checkValid(value)) { // check value is valid
|
132
|
-
*
|
133
|
+
* fieldValues[field] = value + "foo bar"; // modify text
|
133
134
|
* } else {
|
134
135
|
* e.cancel = true; // if not valid maybe cancel commit
|
135
136
|
* break;
|
@@ -138,13 +139,30 @@ import { CoralItems } from "../../tr-grid-util/es6/CoralItems.js";
|
|
138
139
|
* });
|
139
140
|
*/
|
140
141
|
|
142
|
+
/** @event InCellEditingPlugin#rowEditorOpened
|
143
|
+
* @description Fired after the opening of text editor in row editing mode
|
144
|
+
* @type {Object}
|
145
|
+
* @property {number} rowIndex
|
146
|
+
* @property {string} rowId
|
147
|
+
* @property {Object} grid Core grid instance
|
148
|
+
* @property {Array.<string>} fields
|
149
|
+
* @property {Array} cells Array of Cell instances
|
150
|
+
* @property {Array.<Element>} inputs Array of input elements
|
151
|
+
* @property {Array} initialValues Array of data retrieved from Grid corresponding to the cells/inputs
|
152
|
+
* @property {Object} fieldValues Object that contains text in each field
|
153
|
+
*/
|
141
154
|
/** @event InCellEditingPlugin#rowEditorClosed
|
142
155
|
* @description Fired after the text editor has been closed and all operations are done. This is useful to clean up left over resource and get result text entered.
|
143
156
|
* @type {Object}
|
144
|
-
* @property {number} rowIndex
|
157
|
+
* @property {number} rowIndex
|
158
|
+
* @property {string} rowId
|
159
|
+
* @property {Object} grid Core grid instance
|
160
|
+
* @property {Array.<string>} fields
|
161
|
+
* @property {Array} cells Array of Cell instances
|
162
|
+
* @property {Array.<Element>} inputs Array of input elements
|
163
|
+
* @property {Object} fieldValues Object that contains text in each field
|
164
|
+
* @property {Object} fieldValue Alias to fieldValues
|
145
165
|
* @property {boolean} committed Indicates whether the commit operation has been done or not.
|
146
|
-
* @property {Object} grid grid instance
|
147
|
-
* @property {Object} fieldValue object that contain text in each field
|
148
166
|
*/
|
149
167
|
|
150
168
|
/** @event InCellEditingPlugin#keyUp
|
@@ -595,9 +613,19 @@ InCellEditingPlugin.prototype.initialize = function (host, options) {
|
|
595
613
|
|
596
614
|
this._hosts.push(host);
|
597
615
|
|
616
|
+
let elemMap = InCellEditingPlugin._uiElementTypesMap;
|
598
617
|
if(ElfUtil.getElfVersion() < 4) {
|
599
618
|
// ef-input available in elf version < 4
|
600
|
-
|
619
|
+
elemMap["number"] = "ef-input";
|
620
|
+
}
|
621
|
+
if(ElfUtil.getElfVersion() >= 6) {
|
622
|
+
elemMap["number"] = "ef-number-field";
|
623
|
+
elemMap["select"] = "ef-select";
|
624
|
+
elemMap["dropdown"] = "ef-select";
|
625
|
+
elemMap["date"] = "ef-datetime-picker";
|
626
|
+
elemMap["checkbox"] = "ef-checkbox";
|
627
|
+
elemMap["boolean"] = "ef-checkbox";
|
628
|
+
elemMap["combobox"] = "ef-combo-box";
|
601
629
|
}
|
602
630
|
|
603
631
|
if(ElfUtil.isHaloTheme()) {
|
@@ -732,6 +760,7 @@ InCellEditingPlugin.prototype.config = function(options) {
|
|
732
760
|
t.addListener(pluginOption, "beforeCommit");
|
733
761
|
t.addListener(pluginOption, "editorClosed");
|
734
762
|
t.addListener(pluginOption, "keyUp");
|
763
|
+
t.addListener(pluginOption, "rowEditorOpened");
|
735
764
|
t.addListener(pluginOption, "beforeRowCommit");
|
736
765
|
t.addListener(pluginOption, "rowEditorClosed");
|
737
766
|
};
|
@@ -1536,14 +1565,16 @@ InCellEditingPlugin.prototype._openEditor = function (e, host, arg) {
|
|
1536
1565
|
* @public
|
1537
1566
|
* @param {number} rowIndex
|
1538
1567
|
* @param {Object=} grid core grid object
|
1568
|
+
* @fires InCellEditingPlugin#rowEditorOpened
|
1539
1569
|
*/
|
1540
1570
|
InCellEditingPlugin.prototype.openRowEditor = function (rowIndex, grid) {
|
1541
1571
|
let t = this;
|
1542
1572
|
grid = grid || t._hosts[0];
|
1543
|
-
// if open same row we will do nothing
|
1544
|
-
if(t._getRowIndex(t._activeRowId) === rowIndex || !grid || t._readonly) { return; }
|
1545
1573
|
|
1546
|
-
|
1574
|
+
if(t._getRowIndex(t._activeRowId) === rowIndex || !grid || t._readonly) {
|
1575
|
+
return;
|
1576
|
+
}
|
1577
|
+
|
1547
1578
|
t.closeRowEditor(false, grid);
|
1548
1579
|
t._commitText(false);
|
1549
1580
|
|
@@ -1551,7 +1582,7 @@ InCellEditingPlugin.prototype.openRowEditor = function (rowIndex, grid) {
|
|
1551
1582
|
let sectionType = "content";
|
1552
1583
|
let section = grid.getSection(sectionType);
|
1553
1584
|
let dataSource = grid.getDataSource();
|
1554
|
-
let
|
1585
|
+
let colCount = section.getColumnCount();
|
1555
1586
|
let isBottom = (rowIndex + 1) >= section.getRowCount();
|
1556
1587
|
let sectionBGColor = (this._elfVersion || t._inlineStyling) ? section.getComputedStyle().backgroundColor : null;
|
1557
1588
|
let rowH = section.getRowHeight(rowIndex);
|
@@ -1565,25 +1596,36 @@ InCellEditingPlugin.prototype.openRowEditor = function (rowIndex, grid) {
|
|
1565
1596
|
parentElement = grid.getElement().parentElement;
|
1566
1597
|
}
|
1567
1598
|
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1599
|
+
let arg = {
|
1600
|
+
"rowIndex": rowIndex,
|
1601
|
+
"rowId": "",
|
1602
|
+
"grid": grid,
|
1603
|
+
"fields": [],
|
1604
|
+
"cells": [],
|
1605
|
+
"inputs": [],
|
1606
|
+
"initialValues": [],
|
1607
|
+
"fieldValues": {}
|
1608
|
+
};
|
1609
|
+
for(let colIndex = 0; colIndex < colCount; colIndex++) {
|
1610
|
+
if(!t.isColumnEditable(colIndex)) {
|
1611
|
+
continue;
|
1612
|
+
}
|
1613
|
+
let cell = section.getCell(colIndex, rowIndex);
|
1573
1614
|
if(!cell || cell.hasClass("no-editing")) {
|
1574
1615
|
continue;
|
1575
|
-
}
|
1616
|
+
}
|
1576
1617
|
|
1577
|
-
|
1578
|
-
let
|
1618
|
+
arg["cells"][colIndex] = cell;
|
1619
|
+
let field = t._getField(colIndex);
|
1620
|
+
arg["fields"][colIndex] = field;
|
1621
|
+
|
1622
|
+
let inCellCache = t._createContentEditor(colIndex, grid);
|
1623
|
+
inCellCache.field = field; // The field may be changed at runtime
|
1579
1624
|
|
1580
|
-
let content = cell.getContent();
|
1581
|
-
let field = t._getField(columnIndex);
|
1582
|
-
let sourceContent = t._getSourceContent(dataSource, rowIndex, field, content, sectionType);
|
1583
1625
|
let inputElement = inCellCache["inputElement"];
|
1584
|
-
let editor = inCellCache["editor"];
|
1585
1626
|
let balloonPopup = inCellCache["balloonPopup"];
|
1586
1627
|
|
1628
|
+
arg["inputs"][colIndex] = inputElement;
|
1587
1629
|
if(!firstInput) {
|
1588
1630
|
firstInput = inputElement;
|
1589
1631
|
firstPopup = balloonPopup;
|
@@ -1592,6 +1634,10 @@ InCellEditingPlugin.prototype.openRowEditor = function (rowIndex, grid) {
|
|
1592
1634
|
balloonPopup.enableUIBlocking(false);
|
1593
1635
|
}
|
1594
1636
|
|
1637
|
+
let content = cell.getContent();
|
1638
|
+
let sourceContent = t._getSourceContent(dataSource, rowIndex, field, content, sectionType);
|
1639
|
+
arg["initialValues"][colIndex] = sourceContent;
|
1640
|
+
arg["fieldValues"][field] = sourceContent;
|
1595
1641
|
t._setText(sourceContent, inputElement); // WARNING: value-changed event from ELF v3 component may be triggered due to their design flaw
|
1596
1642
|
|
1597
1643
|
if(isBottom) {
|
@@ -1600,15 +1646,15 @@ InCellEditingPlugin.prototype.openRowEditor = function (rowIndex, grid) {
|
|
1600
1646
|
inputElement.classList.remove("bottom");
|
1601
1647
|
}
|
1602
1648
|
|
1649
|
+
let editor = inCellCache["editor"];
|
1603
1650
|
let editorStyle = editor.style;
|
1604
1651
|
if(sectionBGColor) {
|
1605
1652
|
editorStyle.backgroundColor = sectionBGColor;
|
1606
1653
|
}
|
1607
1654
|
editorStyle.height = rowH + "px";
|
1608
1655
|
|
1609
|
-
//
|
1610
|
-
|
1611
|
-
let width = section.getCellWidth(columnIndex, rowIndex);
|
1656
|
+
// row editing mode does not support balloon mode
|
1657
|
+
let width = section.getCellWidth(colIndex, rowIndex);
|
1612
1658
|
editorStyle.width = width + "px";
|
1613
1659
|
editor.classList.remove("balloon");
|
1614
1660
|
|
@@ -1618,12 +1664,10 @@ InCellEditingPlugin.prototype.openRowEditor = function (rowIndex, grid) {
|
|
1618
1664
|
balloonPopup.show(true, parentElement);
|
1619
1665
|
|
1620
1666
|
this._updateEditorPopup(inCellCache, cell, grid);
|
1621
|
-
|
1622
|
-
// this._updateEditorLayout(inputElement); // Adjust sizes after append to the DOM
|
1623
1667
|
}
|
1624
1668
|
|
1625
|
-
// if firstInput not undefined that mean at lease one popup is open
|
1626
1669
|
if(firstInput) {
|
1670
|
+
// At least one cell is valid for editing
|
1627
1671
|
firstPopup.addEventListener("hidden", t._onPopupHide);
|
1628
1672
|
t._lastActiveGrid = grid;
|
1629
1673
|
t._editing = true; // Editing state cannot be false until a text has been committed or cancelled
|
@@ -1633,6 +1677,9 @@ InCellEditingPlugin.prototype.openRowEditor = function (rowIndex, grid) {
|
|
1633
1677
|
if(t._disablingScroll) {
|
1634
1678
|
t._freezeScrolling(grid, true);
|
1635
1679
|
}
|
1680
|
+
|
1681
|
+
arg["rowId"] = t._activeRowId;
|
1682
|
+
t._dispatch("rowEditorOpened", arg);
|
1636
1683
|
}
|
1637
1684
|
};
|
1638
1685
|
|
@@ -1645,7 +1692,6 @@ InCellEditingPlugin.prototype.openRowEditor = function (rowIndex, grid) {
|
|
1645
1692
|
InCellEditingPlugin.prototype.closeRowEditor = function (isCommit) {
|
1646
1693
|
let t = this;
|
1647
1694
|
let grid = t._lastActiveGrid;
|
1648
|
-
// if no row active then do nothing
|
1649
1695
|
if(!t._activeRowId || !grid) { return; }
|
1650
1696
|
|
1651
1697
|
let rowId = t._activeRowId;
|
@@ -1657,81 +1703,74 @@ InCellEditingPlugin.prototype.closeRowEditor = function (isCommit) {
|
|
1657
1703
|
}
|
1658
1704
|
|
1659
1705
|
let section = grid.getSection("content");
|
1660
|
-
let
|
1661
|
-
let
|
1706
|
+
let colCount = grid.getColumnCount();
|
1707
|
+
let fieldValues = {};
|
1662
1708
|
let inCellCaches = [];
|
1663
1709
|
let inCellCache;
|
1710
|
+
let arg = {
|
1711
|
+
"rowIndex": rowIndex,
|
1712
|
+
"rowId": t._activeRowId,
|
1713
|
+
"grid": grid,
|
1714
|
+
"fields": [],
|
1715
|
+
"cells": [],
|
1716
|
+
"inputs": [],
|
1717
|
+
// "initialValues": [],
|
1718
|
+
"fieldValues": fieldValues,
|
1719
|
+
"fieldValue": fieldValues, // Add alias for backward compatability
|
1720
|
+
"cancel": false
|
1721
|
+
};
|
1664
1722
|
|
1665
|
-
|
1666
|
-
|
1667
|
-
let columnData = t._getColumnData(columnIndex, grid);
|
1723
|
+
for(let colIndex = 0; colIndex < colCount; colIndex++) {
|
1724
|
+
let columnData = t._getColumnData(colIndex, grid);
|
1668
1725
|
inCellCache = columnData && columnData["inCellCache"];
|
1669
1726
|
|
1670
|
-
|
1671
|
-
|
1727
|
+
if(inCellCache) {
|
1728
|
+
inCellCache.columnIndex = colIndex;
|
1729
|
+
inCellCaches.push(inCellCache);
|
1672
1730
|
|
1673
|
-
|
1674
|
-
|
1731
|
+
arg["fields"][colIndex] = inCellCache.field;
|
1732
|
+
arg["cells"][colIndex] = section.getCell(colIndex, rowIndex);
|
1733
|
+
arg["inputs"][colIndex] = inCellCache["inputElement"];
|
1675
1734
|
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
fieldValue[field] = this._getValue(inCellCache["inputElement"]);
|
1735
|
+
if(isCommit) {
|
1736
|
+
fieldValues[inCellCache.field] = this._getValue(inCellCache["inputElement"]);
|
1737
|
+
}
|
1680
1738
|
}
|
1681
1739
|
}
|
1682
1740
|
|
1683
|
-
let length = inCellCaches.length;
|
1684
|
-
let i, e;
|
1685
|
-
|
1686
|
-
// dispatch event beforeRowCommit
|
1687
1741
|
if(isCommit) {
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
fieldValue: fieldValue,
|
1693
|
-
cancel: false,
|
1694
|
-
rowId: t._activeRowId
|
1695
|
-
};
|
1696
|
-
t._dispatch("beforeRowCommit", e);
|
1697
|
-
// e.cancel = true mean user want to cancel closeRowEditor operation
|
1698
|
-
isCommit = !e.cancel;
|
1699
|
-
}
|
1742
|
+
t._dispatch("beforeRowCommit", arg);
|
1743
|
+
// arg.cancel = true mean user want to cancel closeRowEditor operation
|
1744
|
+
isCommit = !arg.cancel;
|
1745
|
+
}
|
1700
1746
|
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1747
|
+
let i;
|
1748
|
+
let editorCount = inCellCaches.length;
|
1749
|
+
if(isCommit) {
|
1750
|
+
let dataSource = grid.getDataSource();
|
1751
|
+
for(i = 0; i < editorCount; i++) {
|
1752
|
+
inCellCache = inCellCaches[i];
|
1753
|
+
let value = fieldValues[inCellCache.field];
|
1754
|
+
// set data to datasource
|
1755
|
+
if(dataSource) {
|
1756
|
+
// Only use value from fieldValues because fieldValues maybe mutate from beforeRowCommit event
|
1757
|
+
t._setData(dataSource, rowIndex, inCellCache.field, value);
|
1758
|
+
}
|
1712
1759
|
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
}
|
1760
|
+
// set value to ui if content is a build in text
|
1761
|
+
let cell = arg["cells"][inCellCache.columnIndex];
|
1762
|
+
let content = cell.getContent();
|
1763
|
+
if(content && content.classList.contains("text")) {
|
1764
|
+
cell.setContent(value);
|
1719
1765
|
}
|
1720
1766
|
}
|
1721
1767
|
}
|
1722
1768
|
|
1723
|
-
|
1724
|
-
|
1725
|
-
grid: grid,
|
1726
|
-
rowIndex: rowIndex,
|
1727
|
-
fieldValue: fieldValue,
|
1728
|
-
committed: isCommit
|
1729
|
-
};
|
1730
|
-
t._dispatch("rowEditorClosed", e);
|
1731
|
-
}
|
1769
|
+
arg["committed"] = isCommit;
|
1770
|
+
t._dispatch("rowEditorClosed", arg);
|
1732
1771
|
|
1733
1772
|
// hide editor by remove popup from dom
|
1734
|
-
for(i = 0; i <
|
1773
|
+
for(i = 0; i < editorCount; i++) {
|
1735
1774
|
let popup = inCellCaches[i].balloonPopup;
|
1736
1775
|
popup.removeEventListener("hidden", t._onPopupHide); // remove event every popup to make sure nothing left
|
1737
1776
|
popup.hide();
|
@@ -6,9 +6,11 @@ declare class CellWriter extends ElementWrapper {
|
|
6
6
|
|
7
7
|
constructor();
|
8
8
|
|
9
|
-
public
|
9
|
+
public getParent(): Node|null;
|
10
10
|
|
11
|
-
public
|
11
|
+
public getContent(): Node|null;
|
12
|
+
|
13
|
+
public setContent(content: any, tooltip?: boolean|null): Element|null;
|
12
14
|
|
13
15
|
public setTooltip(str: string): void;
|
14
16
|
|
@@ -26,11 +28,9 @@ declare class CellWriter extends ElementWrapper {
|
|
26
28
|
|
27
29
|
public listen(): void;
|
28
30
|
|
29
|
-
public setTooltip(): void;
|
30
|
-
|
31
31
|
public addClass(str: string): void;
|
32
32
|
|
33
|
-
public hasClass(str: string):
|
33
|
+
public hasClass(str: string): boolean;
|
34
34
|
|
35
35
|
public removeClass(str: string): void;
|
36
36
|
|
@@ -46,4 +46,5 @@ declare class CellWriter extends ElementWrapper {
|
|
46
46
|
|
47
47
|
}
|
48
48
|
|
49
|
+
export default CellWriter;
|
49
50
|
export { CellWriter };
|
@@ -6,7 +6,7 @@ import { Dom } from "../../tr-grid-util/es6/Dom.js";
|
|
6
6
|
* @constructor
|
7
7
|
* @extends {ElementWrapper}
|
8
8
|
*/
|
9
|
-
|
9
|
+
let CellWriter = function () {
|
10
10
|
};
|
11
11
|
Ext.inherits(CellWriter, ElementWrapper);
|
12
12
|
|
@@ -23,19 +23,34 @@ CellWriter.prototype._floatingPanel = null;
|
|
23
23
|
*/
|
24
24
|
CellWriter.prototype._frontPanel = null;
|
25
25
|
|
26
|
+
/** @private
|
27
|
+
* @type {Element}
|
28
|
+
*/
|
29
|
+
CellWriter.prototype._parent = null;
|
30
|
+
|
26
31
|
|
27
32
|
/** @public
|
28
|
-
* @return {Node
|
33
|
+
* @return {Node} content
|
34
|
+
*/
|
35
|
+
CellWriter.prototype.getParent = function () {
|
36
|
+
if(!this._parent) {
|
37
|
+
this._parent = document.createElement("div");
|
38
|
+
}
|
39
|
+
return this._parent;
|
40
|
+
};
|
41
|
+
/** @public
|
42
|
+
* @return {Node} content
|
29
43
|
*/
|
30
44
|
CellWriter.prototype.getContent = function () {
|
31
45
|
return this._elem.children[0] || null;
|
32
46
|
};
|
33
47
|
/** @public
|
34
48
|
* @param {*} content
|
35
|
-
* @param {boolean=}
|
49
|
+
* @param {boolean=} tooltip
|
36
50
|
* @return {Element}
|
37
51
|
*/
|
38
|
-
CellWriter.prototype.setContent = function (content,
|
52
|
+
CellWriter.prototype.setContent = function (content, tooltip) {
|
53
|
+
Dom.removeChildren(this._elem);
|
39
54
|
if(content == null) {
|
40
55
|
return null;
|
41
56
|
}
|
@@ -44,7 +59,7 @@ CellWriter.prototype.setContent = function (content, opt_tooltip) {
|
|
44
59
|
} else if(content.nodeType !== 1) {
|
45
60
|
content = this._createTextContent(content);
|
46
61
|
}
|
47
|
-
|
62
|
+
|
48
63
|
this._elem.appendChild(/** @type{Node} */(content));
|
49
64
|
return /** @type{Element} */(content);
|
50
65
|
};
|
@@ -82,7 +97,7 @@ CellWriter.prototype.addContent = function (n) {
|
|
82
97
|
* @return {Element}
|
83
98
|
*/
|
84
99
|
CellWriter.prototype._createTextContent = function (str) {
|
85
|
-
|
100
|
+
let div = Dom.div("text");
|
86
101
|
if(str != null) {
|
87
102
|
div.textContent = str;
|
88
103
|
this["percentText"] = str; // HACK
|
@@ -97,6 +112,26 @@ CellWriter.prototype._createTextContent = function (str) {
|
|
97
112
|
CellWriter.prototype.setStyle = function (str, val) {
|
98
113
|
this._elem.style[str] = val;
|
99
114
|
};
|
115
|
+
/** @private
|
116
|
+
* @returns {!Element} flex row
|
117
|
+
*/
|
118
|
+
CellWriter.prototype._insertFlexRow = function () {
|
119
|
+
let flexRow = this._flexRow;
|
120
|
+
if(!flexRow) {
|
121
|
+
flexRow = this._flexRow = document.createElement("div");
|
122
|
+
flexRow.className = "tr-printing-flex-row";
|
123
|
+
}
|
124
|
+
|
125
|
+
let elem = this._elem;
|
126
|
+
if(elem.firstChild !== flexRow) {
|
127
|
+
while(elem.firstChild) {
|
128
|
+
flexRow.appendChild(elem.firstChild);
|
129
|
+
}
|
130
|
+
elem.appendChild(flexRow);
|
131
|
+
}
|
132
|
+
|
133
|
+
return flexRow;
|
134
|
+
};
|
100
135
|
/** @public
|
101
136
|
* @param {*} n
|
102
137
|
*/
|
@@ -106,26 +141,14 @@ CellWriter.prototype.removeIcon = function (n) {};
|
|
106
141
|
*/
|
107
142
|
CellWriter.prototype.updateIcon = function (elem) {
|
108
143
|
if(elem && elem.nodeType === 1) {
|
109
|
-
|
144
|
+
let flexRow = this._insertFlexRow();
|
145
|
+
let fp = this._frontPanel;
|
110
146
|
if(!fp) {
|
111
|
-
this.
|
112
|
-
|
113
|
-
|
114
|
-
fp = this._floatingPanel = document.createElement("div");
|
115
|
-
fp.className = "tr-printing-float-right";
|
116
|
-
this._flexRow.appendChild(fp);
|
117
|
-
var chdr = this._elem.children;
|
118
|
-
var childCount = chdr.length;
|
119
|
-
if(childCount) {
|
120
|
-
var ary = new Array(childCount);
|
121
|
-
for(var i = 0; i < childCount; ++i) {
|
122
|
-
ary[i] = chdr[i];
|
123
|
-
}
|
124
|
-
Dom.appendChild(this._flexRow, ary);
|
125
|
-
}
|
126
|
-
this._elem.appendChild(this._flexRow);
|
147
|
+
fp = this._frontPanel = document.createElement("div");
|
148
|
+
fp.className = "tr-printing-float-right"; // WARNING: This may need to be float-left
|
149
|
+
flexRow.insertBefore(fp, flexRow.firstChild);
|
127
150
|
}
|
128
|
-
fp.appendChild(elem.cloneNode(true));
|
151
|
+
fp.appendChild(elem.cloneNode(true)); // WARNING: This may not need to be cloned
|
129
152
|
}
|
130
153
|
};
|
131
154
|
/** @public
|
@@ -135,10 +158,6 @@ CellWriter.prototype.unlisten = function () {};
|
|
135
158
|
*/
|
136
159
|
CellWriter.prototype.listen = function () {};
|
137
160
|
|
138
|
-
/** @public
|
139
|
-
*/
|
140
|
-
CellWriter.prototype.setTooltip = function () {};
|
141
|
-
|
142
161
|
/** @public
|
143
162
|
* @param {string} str
|
144
163
|
*/
|
@@ -147,9 +166,10 @@ CellWriter.prototype.addClass = function (str) {
|
|
147
166
|
};
|
148
167
|
/** @public
|
149
168
|
* @param {string} str
|
169
|
+
* @returns {boolean}
|
150
170
|
*/
|
151
171
|
CellWriter.prototype.hasClass = function (str) {
|
152
|
-
this._elem.classList.contains(str);
|
172
|
+
return this._elem.classList.contains(str);
|
153
173
|
};
|
154
174
|
/** @public
|
155
175
|
* @param {string} str
|
@@ -175,26 +195,14 @@ CellWriter.prototype.enableClass = function (str, bool) {
|
|
175
195
|
*/
|
176
196
|
CellWriter.prototype.insertFloatingIcon = function (elem, order) {
|
177
197
|
if(elem && elem.nodeType === 1) {
|
178
|
-
|
198
|
+
let flexRow = this._insertFlexRow();
|
199
|
+
let fp = this._floatingPanel;
|
179
200
|
if(!fp) {
|
180
|
-
this._flexRow = document.createElement("div");
|
181
|
-
this._flexRow.className = "tr-printing-flex-row";
|
182
|
-
|
183
|
-
var chdr = this._elem.children;
|
184
|
-
var childCount = chdr.length;
|
185
|
-
if(childCount) {
|
186
|
-
var ary = new Array(childCount);
|
187
|
-
for(var i = 0; i < childCount; ++i) {
|
188
|
-
ary[i] = chdr[i];
|
189
|
-
}
|
190
|
-
Dom.appendChild(this._flexRow, ary);
|
191
|
-
}
|
192
201
|
fp = this._floatingPanel = document.createElement("div");
|
193
202
|
fp.className = "tr-printing-float-right";
|
194
|
-
|
195
|
-
this._elem.appendChild(this._flexRow);
|
203
|
+
flexRow.appendChild(fp);
|
196
204
|
}
|
197
|
-
fp.appendChild(elem.cloneNode(true));
|
205
|
+
fp.appendChild(elem.cloneNode(true)); // WARNING: This may not need to be cloned
|
198
206
|
}
|
199
207
|
};
|
200
208
|
/** @public
|
@@ -214,13 +222,13 @@ CellWriter.prototype.getSection = function () {
|
|
214
222
|
* @param {Element} elem
|
215
223
|
*/
|
216
224
|
CellWriter.prototype.cloak = function (elem) {
|
217
|
-
|
218
|
-
|
219
|
-
delete this._floatingPanel;
|
220
|
-
delete this._frontPanel;
|
225
|
+
this.percentText = ""; // Hack
|
226
|
+
this._flexRow = this._frontPanel = this._floatingPanel = null;
|
221
227
|
elem.className = "cell";
|
222
228
|
this._elem = elem;
|
223
229
|
};
|
224
230
|
|
225
231
|
|
232
|
+
|
233
|
+
export default CellWriter;
|
226
234
|
export { CellWriter };
|
@@ -5,7 +5,7 @@ import { ElementWrapper } from "../../tr-grid-util/es6/ElementWrapper.js";
|
|
5
5
|
* @constructor
|
6
6
|
* @extends {ElementWrapper}
|
7
7
|
*/
|
8
|
-
|
8
|
+
let ColumnWriter = function () {
|
9
9
|
};
|
10
10
|
Ext.inherits(ColumnWriter, ElementWrapper);
|
11
11
|
|
@@ -18,4 +18,6 @@ ColumnWriter.prototype.isActive = function () {
|
|
18
18
|
};
|
19
19
|
|
20
20
|
|
21
|
+
|
22
|
+
export default ColumnWriter;
|
21
23
|
export { ColumnWriter };
|