@refinitiv-ui/efx-grid 6.0.3 → 6.0.4
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-dragging/es6/ColumnDragging.d.ts +49 -0
- package/lib/column-dragging/es6/ColumnDragging.js +764 -0
- package/lib/column-dragging/es6/index.d.ts +1 -0
- package/lib/column-dragging/es6/index.js +1 -0
- package/lib/core/dist/core.css +1 -1
- package/lib/core/dist/core.js +389 -1070
- package/lib/core/dist/core.min.js +1 -1
- package/lib/core/es6/data/ColumnStats.d.ts +2 -2
- package/lib/core/es6/data/DataCache.d.ts +4 -4
- package/lib/core/es6/data/DataTable.d.ts +5 -5
- package/lib/core/es6/data/DataTable.js +1 -1
- package/lib/core/es6/data/DataView.d.ts +12 -12
- package/lib/core/es6/data/SegmentCollection.d.ts +3 -3
- package/lib/core/es6/data/WrappedView.d.ts +13 -13
- package/lib/core/es6/grid/Core.d.ts +29 -27
- package/lib/core/es6/grid/Core.js +26 -4
- package/lib/core/es6/grid/ILayoutGrid.d.ts +15 -15
- package/lib/core/es6/grid/LayoutGrid.js +54 -26
- package/lib/core/es6/grid/VirtualizedLayoutGrid.js +66 -0
- package/lib/core/es6/grid/components/Cell.d.ts +4 -4
- package/lib/core/es6/grid/components/CellFloatingPanel.d.ts +1 -1
- package/lib/core/es6/grid/components/CellSpans.d.ts +8 -8
- package/lib/core/es6/grid/components/Column.d.ts +1 -1
- package/lib/core/es6/grid/components/ElementWrapper.d.ts +6 -6
- package/lib/core/es6/grid/components/Scrollbar.d.ts +1 -1
- package/lib/core/es6/grid/components/StretchedCells.js +2 -2
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.d.ts +14 -6
- package/lib/core/es6/grid/plugins/SortableTitlePlugin.js +147 -81
- package/lib/core/es6/grid/util/Conflator.d.ts +2 -2
- package/lib/core/es6/grid/util/ElementFrameWork.d.ts +3 -3
- package/lib/core/es6/grid/util/HttpRequest.d.ts +2 -2
- package/lib/core/es6/grid/util/PercentBarRenderer.d.ts +1 -1
- package/lib/core/es6/grid/util/RangeBar.d.ts +1 -1
- package/lib/core/es6/grid/util/SectionSettings.d.ts +5 -5
- package/lib/core/es6/grid/util/SectionSettings.js +5 -0
- package/lib/core/es6/grid/util/SelectionList.d.ts +2 -2
- package/lib/core/es6/grid/util/TrackLayout.d.ts +7 -3
- package/lib/core/es6/grid/util/TrackLayout.js +27 -0
- package/lib/core/es6/grid/util/util.d.ts +2 -2
- package/lib/core/es6/index.d.ts +1 -5
- package/lib/core/es6/index.js +1 -7
- package/lib/core/es6/tr-grid-theme.js +1 -1
- package/lib/filter-dialog/lib/filter-dialog.d.ts +1 -0
- package/lib/filter-dialog/lib/filter-dialog.js +73 -26
- package/lib/filter-dialog/themes/base-checkbox.less +8 -1
- package/lib/filter-dialog/themes/base.less +69 -1
- package/lib/filter-dialog/themes/elemental/dark/checkbox-list.js +1 -1
- package/lib/filter-dialog/themes/elemental/dark/es5/all-elements.js +2 -2
- package/lib/filter-dialog/themes/elemental/dark/filter-dialog.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 +2 -2
- package/lib/filter-dialog/themes/elemental/light/filter-dialog.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 +2 -2
- package/lib/filter-dialog/themes/halo/dark/filter-dialog.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 +2 -2
- package/lib/filter-dialog/themes/halo/light/filter-dialog.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 +2 -2
- package/lib/filter-dialog/themes/solar/charcoal/filter-dialog.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 +2 -2
- package/lib/filter-dialog/themes/solar/pearl/filter-dialog.js +1 -1
- package/lib/grid/lib/efx-grid.d.ts +8 -5
- package/lib/grid/lib/efx-grid.js +10 -4
- package/lib/grid/themes/halo/dark/efx-grid.js +1 -1
- package/lib/grid/themes/halo/dark/es5/all-elements.js +1 -1
- package/lib/grid/themes/halo/efx-grid.less +33 -39
- package/lib/grid/themes/halo/light/efx-grid.js +1 -1
- package/lib/grid/themes/halo/light/es5/all-elements.js +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/row-segmenting/es6/RowSegmenting.d.ts +7 -2
- package/lib/row-segmenting/es6/RowSegmenting.js +94 -9
- package/lib/rt-grid/dist/rt-grid.js +567 -1171
- package/lib/rt-grid/dist/rt-grid.min.js +1 -1
- package/lib/rt-grid/es6/ColumnDefinition.d.ts +5 -3
- package/lib/rt-grid/es6/ColumnDefinition.js +17 -108
- package/lib/rt-grid/es6/DataConnector.d.ts +3 -3
- package/lib/rt-grid/es6/Grid.d.ts +17 -9
- package/lib/rt-grid/es6/Grid.js +201 -101
- package/lib/rt-grid/es6/RowDefSorter.d.ts +19 -0
- package/lib/rt-grid/es6/RowDefSorter.js +137 -0
- package/lib/rt-grid/es6/RowDefinition.d.ts +9 -7
- package/lib/rt-grid/es6/RowDefinition.js +6 -0
- package/lib/rt-grid/es6/SnapshotFiller.d.ts +3 -1
- package/lib/rt-grid/es6/SnapshotFiller.js +23 -0
- package/lib/tr-grid-checkbox/es6/Checkbox.d.ts +2 -2
- package/lib/tr-grid-checkbox/es6/Checkbox.js +38 -20
- package/lib/tr-grid-column-selection/es6/ColumnSelection.js +46 -9
- package/lib/tr-grid-column-stack/es6/ColumnStack.d.ts +8 -4
- package/lib/tr-grid-column-stack/es6/ColumnStack.js +240 -125
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.d.ts +1 -1
- package/lib/tr-grid-conditional-coloring/es6/ConditionalColoring.js +18 -12
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.d.ts +7 -4
- package/lib/tr-grid-in-cell-editing/es6/InCellEditing.js +93 -2
- package/lib/tr-grid-printer/es6/CellWriter.d.ts +3 -3
- package/lib/tr-grid-printer/es6/GridPrinter.d.ts +1 -1
- package/lib/tr-grid-printer/es6/GridPrinter.js +26 -13
- package/lib/tr-grid-printer/es6/PrintTrait.d.ts +2 -2
- package/lib/tr-grid-printer/es6/SectionWriter.d.ts +3 -3
- package/lib/tr-grid-row-dragging/es6/RowDragging.d.ts +2 -1
- package/lib/tr-grid-row-dragging/es6/RowDragging.js +29 -143
- package/lib/tr-grid-row-grouping/es6/RowGrouping.d.ts +7 -2
- package/lib/tr-grid-row-grouping/es6/RowGrouping.js +97 -7
- package/lib/tr-grid-row-selection/es6/RowSelection.js +10 -0
- package/lib/tr-grid-textformatting/es6/TextFormatting.d.ts +1 -1
- package/lib/tr-grid-textformatting/es6/TextFormatting.js +12 -0
- package/lib/tr-grid-util/es6/DragUI.d.ts +16 -0
- package/lib/tr-grid-util/es6/DragUI.js +214 -0
- package/lib/tr-grid-util/es6/ElementObserver.d.ts +2 -0
- package/lib/tr-grid-util/es6/ElementObserver.js +28 -1
- package/lib/tr-grid-util/es6/ElfUtil.js +1 -1
- package/lib/tr-grid-util/es6/FieldFormatter.js +7 -5
- package/lib/tr-grid-util/es6/GridPlugin.js +8 -4
- package/lib/tr-grid-util/es6/NumberFormatter.d.ts +2 -0
- package/lib/tr-grid-util/es6/NumberFormatter.js +64 -19
- package/lib/tr-grid-util/es6/RowPainter.js +41 -11
- package/lib/tr-grid-util/es6/formula/Formula.js +9 -1
- package/lib/types/es6/Checkbox.d.ts +2 -2
- package/lib/types/es6/ColumnStack.d.ts +8 -4
- package/lib/types/es6/CompositeGrid/ColumnSelectionPlugin.d.ts +3 -2
- package/lib/types/es6/CompositeGrid/ColumnWidthAdjustingPlugin.d.ts +2 -1
- package/lib/types/es6/CompositeGrid/CompositeGrid.d.ts +20 -18
- package/lib/types/es6/CompositeGrid/DragAndDropTitlePlugin.d.ts +2 -1
- package/lib/types/es6/CompositeGrid/DraggableContentPlugin.d.ts +3 -2
- package/lib/types/es6/CompositeGrid/Plugin.d.ts +28 -0
- package/lib/types/es6/CompositeGrid/ResizableTitlePlugin.d.ts +2 -1
- package/lib/types/es6/CompositeGrid/RowSelectionPlugin.d.ts +5 -4
- package/lib/types/es6/CompositeGrid/TreeIndentingPlugin.d.ts +2 -1
- package/lib/types/es6/CompositeGrid/index.d.ts +9 -9
- package/lib/types/es6/ConditionalColoring.d.ts +1 -1
- package/lib/types/es6/Core/data/ColumnStats.d.ts +2 -2
- package/lib/types/es6/Core/data/DataCache.d.ts +4 -4
- package/lib/types/es6/Core/data/DataTable.d.ts +5 -5
- package/lib/types/es6/Core/data/DataView.d.ts +12 -12
- package/lib/types/es6/Core/data/SegmentCollection.d.ts +3 -3
- package/lib/types/es6/Core/data/WrappedView.d.ts +13 -13
- package/lib/types/es6/Core/grid/Core.d.ts +29 -27
- package/lib/types/es6/Core/grid/ILayoutGrid.d.ts +15 -15
- package/lib/types/es6/Core/grid/components/Cell.d.ts +4 -4
- package/lib/types/es6/Core/grid/components/CellFloatingPanel.d.ts +1 -1
- package/lib/types/es6/Core/grid/components/CellSpans.d.ts +8 -8
- package/lib/types/es6/Core/grid/components/Column.d.ts +1 -1
- package/lib/types/es6/Core/grid/components/ElementWrapper.d.ts +6 -6
- package/lib/types/es6/Core/grid/components/Scrollbar.d.ts +1 -1
- package/lib/types/es6/Core/grid/plugins/SortableTitlePlugin.d.ts +14 -6
- package/lib/types/es6/Core/grid/util/Conflator.d.ts +2 -2
- package/lib/types/es6/Core/grid/util/ElementFrameWork.d.ts +3 -3
- package/lib/types/es6/Core/grid/util/HttpRequest.d.ts +2 -2
- package/lib/types/es6/Core/grid/util/PercentBarRenderer.d.ts +1 -1
- package/lib/types/es6/Core/grid/util/RangeBar.d.ts +1 -1
- package/lib/types/es6/Core/grid/util/SectionSettings.d.ts +5 -5
- package/lib/types/es6/Core/grid/util/SelectionList.d.ts +2 -2
- package/lib/types/es6/Core/grid/util/TrackLayout.d.ts +7 -3
- package/lib/types/es6/Core/grid/util/util.d.ts +2 -2
- package/lib/types/es6/Core/index.d.ts +1 -5
- package/lib/types/es6/ExtensionOptions.d.ts +2 -0
- package/lib/types/es6/InCellEditing.d.ts +7 -4
- package/lib/types/es6/RealtimeGrid/ColumnDefinition.d.ts +5 -3
- package/lib/types/es6/RealtimeGrid/DataConnector.d.ts +3 -3
- package/lib/types/es6/RealtimeGrid/Grid.d.ts +17 -9
- package/lib/types/es6/RealtimeGrid/RowDefSorter.d.ts +19 -0
- package/lib/types/es6/RealtimeGrid/RowDefinition.d.ts +9 -7
- package/lib/types/es6/RealtimeGrid/SnapshotFiller.d.ts +3 -1
- package/lib/types/es6/RowDragging.d.ts +2 -1
- package/lib/types/es6/RowGrouping.d.ts +7 -2
- package/lib/types/es6/RowSegmenting.d.ts +7 -2
- package/lib/types/es6/TextFormatting.d.ts +1 -1
- package/lib/versions.json +14 -13
- package/package.json +1 -1
- package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
- package/lib/core/es6/grid/plugins/DragAndDropTitlePlugin.js +0 -615
- package/lib/core/es6/grid/plugins/Plugin.d.ts +0 -28
- package/lib/core/es6/grid/plugins/Plugin.js +0 -272
- package/lib/types/es6/Core/grid/plugins/DragAndDropTitlePlugin.d.ts +0 -24
- package/lib/types/es6/Core/grid/plugins/Plugin.d.ts +0 -28
@@ -3,6 +3,7 @@ import { GridPlugin } from "../../tr-grid-util/es6/GridPlugin.js";
|
|
3
3
|
import { ExpanderIcon } from "../../tr-grid-util/es6/ExpanderIcon.js";
|
4
4
|
import { ElfUtil } from "../../tr-grid-util/es6/ElfUtil.js";
|
5
5
|
import { RowPainter } from "../../tr-grid-util/es6/RowPainter.js";
|
6
|
+
import { injectCss, prettifyCss } from "../../tr-grid-util/es6/Util.js";
|
6
7
|
|
7
8
|
/** @typedef {Object} RowGroupingPlugin~Options
|
8
9
|
* @description The options can be specified by `rowGrouping` property of the main grid's options
|
@@ -23,6 +24,8 @@ import { RowPainter } from "../../tr-grid-util/es6/RowPainter.js";
|
|
23
24
|
* @property {boolean=} autoGroupSorting=false If enabled, group sorting will be performed after each `groupAdded` event
|
24
25
|
* @property {(boolean|number|Array.<number>)=} indentSize Use array to define indent for each group level. Use boolean to turn on or off indentation. Use number to define incremental step.
|
25
26
|
* @property {boolean=} colorTag If not specified, the color tag will be disabled when using extension without halo theme.
|
27
|
+
* @property {Object=} predefinedColors Predefined color object map for color tag
|
28
|
+
* @property {Object=} groupColors The object map of group ID and predefined color.
|
26
29
|
* @property {Function=} clicked=null Event handler when user clicks on arrows or cells
|
27
30
|
* @property {Function=} groupAdded=null Event handler
|
28
31
|
* @property {Function=} beforeGroupAdded=null Event handler
|
@@ -264,6 +267,22 @@ RowGroupingPlugin.prototype._rowPainter = null;
|
|
264
267
|
* @private
|
265
268
|
*/
|
266
269
|
RowGroupingPlugin.prototype._colorTag = null;
|
270
|
+
/** @type {Object}
|
271
|
+
* @private
|
272
|
+
*/
|
273
|
+
RowGroupingPlugin.prototype._predefinedColors = null;
|
274
|
+
/** @type {Object}
|
275
|
+
* @private
|
276
|
+
*/
|
277
|
+
RowGroupingPlugin.prototype._groupColors = null;
|
278
|
+
/** @type {string}
|
279
|
+
* @private
|
280
|
+
*/
|
281
|
+
RowGroupingPlugin._controlClass = "predefined-color-tag";
|
282
|
+
/** @type {Object}
|
283
|
+
* @private
|
284
|
+
*/
|
285
|
+
RowGroupingPlugin.prototype._styleTag = null;
|
267
286
|
|
268
287
|
/** @type {Function}
|
269
288
|
* @private
|
@@ -391,6 +410,12 @@ RowGroupingPlugin.prototype.initialize = function (host, options) {
|
|
391
410
|
|
392
411
|
var enabled = this._colorTag != null ? this._colorTag : ElfUtil.isHaloTheme();
|
393
412
|
RowPainter.disableColorTag(host, enabled === false);
|
413
|
+
|
414
|
+
if (this._predefinedColors != null) {
|
415
|
+
this._injectStyles(this._predefinedColors);
|
416
|
+
host.enableClass(RowGroupingPlugin._controlClass);
|
417
|
+
}
|
418
|
+
|
394
419
|
RowPainter.applyGroupingStyles(host);
|
395
420
|
|
396
421
|
this._applyGrouping(); // TODO: Support run-time theme loading
|
@@ -528,17 +553,27 @@ RowGroupingPlugin.prototype.config = function (options) {
|
|
528
553
|
if (this.hasListener("groupFooterBinding")) {
|
529
554
|
this._footerRows = 1;
|
530
555
|
}
|
531
|
-
|
532
|
-
clickableCell: this._clickableCell,
|
533
|
-
headerSpanning: this._headerSpanning,
|
534
|
-
footerSpanning: this._footerSpanning,
|
535
|
-
onCellClicked: this._onCellClicked
|
536
|
-
});
|
556
|
+
|
537
557
|
if (option.colorTag != null) {
|
538
558
|
this._colorTag = option.colorTag;
|
539
559
|
}
|
560
|
+
|
561
|
+
if (option.groupColors != null && typeof option.groupColors === "object") {
|
562
|
+
this._groupColors = option.groupColors;
|
563
|
+
}
|
564
|
+
|
565
|
+
if (option.predefinedColors != null && typeof option.predefinedColors === "object") {
|
566
|
+
this._predefinedColors = option.predefinedColors;
|
567
|
+
}
|
540
568
|
}
|
541
569
|
|
570
|
+
this._rowPainter = new RowPainter({
|
571
|
+
clickableCell: this._clickableCell,
|
572
|
+
headerSpanning: this._headerSpanning,
|
573
|
+
footerSpanning: this._footerSpanning,
|
574
|
+
onCellClicked: this._onCellClicked
|
575
|
+
});
|
576
|
+
|
542
577
|
if (this._fixedDisplayColumn < 0) {
|
543
578
|
var checkboxColumnIndex = this._findCheckboxColumnIndexFromConfig(options.columns);
|
544
579
|
if (checkboxColumnIndex >= 0) { // has checkbox column
|
@@ -620,10 +655,15 @@ RowGroupingPlugin.prototype.getConfigObject = function (gridOptions) {
|
|
620
655
|
if(this._indentSizes) {
|
621
656
|
extOptions.indentSize = this._indentSizes;
|
622
657
|
}
|
623
|
-
|
624
658
|
if(this._colorTag != null) {
|
625
659
|
extOptions.colorTag = this._colorTag;
|
626
660
|
}
|
661
|
+
if(this._groupColors != null) {
|
662
|
+
extOptions.groupColors = this._groupColors;
|
663
|
+
}
|
664
|
+
if(this._predefinedColors != null) {
|
665
|
+
extOptions.predefinedColors = this._predefinedColors;
|
666
|
+
}
|
627
667
|
|
628
668
|
return obj;
|
629
669
|
};
|
@@ -699,6 +739,32 @@ RowGroupingPlugin.prototype.getColumnMenu = function (colIndex, config) {
|
|
699
739
|
return config;
|
700
740
|
};
|
701
741
|
|
742
|
+
/** @private
|
743
|
+
* @param {Object} predefinedColors Predefined color object map
|
744
|
+
*/
|
745
|
+
RowGroupingPlugin.prototype._injectStyles = function(predefinedColors) {
|
746
|
+
var prefix = ".tr-grid." + RowGroupingPlugin._controlClass + " .tr-lg .cell";
|
747
|
+
var css = [];
|
748
|
+
var value;
|
749
|
+
for (var className in predefinedColors) {
|
750
|
+
css.push(prefix + "." + className + "::before");
|
751
|
+
value = predefinedColors[className]["backgroundColor"];
|
752
|
+
if (value) {
|
753
|
+
css.push(["background-color: " + value + ";"]);
|
754
|
+
}
|
755
|
+
}
|
756
|
+
|
757
|
+
var host = this._hosts[0];
|
758
|
+
|
759
|
+
if (this._styleTag) {
|
760
|
+
if (this._styleTag.parentNode) {
|
761
|
+
this._styleTag.parentNode.removeChild(this._styleTag);
|
762
|
+
}
|
763
|
+
this._styleTag = null;
|
764
|
+
}
|
765
|
+
this._styleTag = injectCss(prettifyCss(css), host.getElement());
|
766
|
+
};
|
767
|
+
|
702
768
|
/** @private
|
703
769
|
* @param {Object} e
|
704
770
|
*/
|
@@ -918,6 +984,16 @@ RowGroupingPlugin.prototype.setPredefinedGroups = function (predefinedGroups) {
|
|
918
984
|
}
|
919
985
|
};
|
920
986
|
|
987
|
+
/** @public
|
988
|
+
* @param {Object} predefinedColors Predefined color object map
|
989
|
+
*/
|
990
|
+
RowGroupingPlugin.prototype.setPredefinedColors = function(predefinedColors) {
|
991
|
+
if(predefinedColors != null && typeof predefinedColors === "object") {
|
992
|
+
this._predefinedColors = predefinedColors;
|
993
|
+
this._injectStyles(predefinedColors);
|
994
|
+
}
|
995
|
+
};
|
996
|
+
|
921
997
|
/** Trigger group sorting logic -- re-sort the existing groups. This will not continuously apply to each data update.
|
922
998
|
* @public
|
923
999
|
*/
|
@@ -1217,6 +1293,8 @@ RowGroupingPlugin.prototype._updateHeader = function (settings, firstRowIndex, l
|
|
1217
1293
|
if(needCal) {
|
1218
1294
|
currentGroup = dataSource.getGroup(rowId); // Slow
|
1219
1295
|
curGroupLevel = currentGroup.getGroupLevel();
|
1296
|
+
} else if(!currentGroup) {
|
1297
|
+
currentGroup = dataSource.getGroup(rowId); // Slow
|
1220
1298
|
}
|
1221
1299
|
|
1222
1300
|
if (contentHeaderGroup || nonGroupListener) {
|
@@ -1275,6 +1353,18 @@ RowGroupingPlugin.prototype._updateHeader = function (settings, firstRowIndex, l
|
|
1275
1353
|
|
1276
1354
|
arg.indentSize = indentSize;
|
1277
1355
|
|
1356
|
+
if (this._groupColors) {
|
1357
|
+
// TODO: Need better method to find the first level parent's group id
|
1358
|
+
var rootGroup = currentGroup ? currentGroup : dataSource.getGroup(rowId); // Slow
|
1359
|
+
if (curGroupLevel > 1) {
|
1360
|
+
for (var i = curGroupLevel; i > 1; i--) {
|
1361
|
+
rootGroup = rootGroup.getDataSource();
|
1362
|
+
}
|
1363
|
+
}
|
1364
|
+
var groupId = rootGroup.getGroupId();
|
1365
|
+
arg.colorTagClass = this._groupColors[groupId];
|
1366
|
+
}
|
1367
|
+
|
1278
1368
|
if (groupView) {
|
1279
1369
|
rowPainter.applyHeaderStyle(arg);
|
1280
1370
|
this._dispatch(footerRow ? "groupFooterBinding" : "groupHeaderBinding", arg);
|
@@ -611,6 +611,9 @@ RowSelectionPlugin.prototype._onClick = function (e) {
|
|
611
611
|
}
|
612
612
|
this._dispatchSelectionChanged(e);
|
613
613
|
}
|
614
|
+
if(this._activeGrid != null){
|
615
|
+
this._activeGrid.focus();
|
616
|
+
}
|
614
617
|
};
|
615
618
|
/** @private
|
616
619
|
* @description Left click will cause single row selection <br>
|
@@ -1009,6 +1012,10 @@ RowSelectionPlugin.prototype._selectByKey = function (direction, e, pageKey) {
|
|
1009
1012
|
|
1010
1013
|
if (!this._anchorSection) { return; }
|
1011
1014
|
|
1015
|
+
if(this._activeGrid != null){
|
1016
|
+
this._activeGrid.focus();
|
1017
|
+
}
|
1018
|
+
|
1012
1019
|
var shiftKey = e.shiftKey;
|
1013
1020
|
var next = 0;
|
1014
1021
|
var rowLimit = this._anchorSection.getRowCount() - 1;
|
@@ -1322,6 +1329,9 @@ RowSelectionPlugin.prototype._gotoGrid = function (gridIndex) {
|
|
1322
1329
|
var sectionIndex = this._anchorSection.getIndex();
|
1323
1330
|
this.clearSelectedRows(); // Clear all current grid's selections
|
1324
1331
|
this.selectSingleRow(anchorRow, sectionIndex, this._hosts[gridIndex]); // go to the next grid at the first column
|
1332
|
+
if(this._activeGrid != null){
|
1333
|
+
this._activeGrid.focus();
|
1334
|
+
}
|
1325
1335
|
};
|
1326
1336
|
|
1327
1337
|
/** @private
|
@@ -65,7 +65,7 @@ declare class TextFormattingPlugin extends GridPlugin {
|
|
65
65
|
|
66
66
|
public getColumnFormatOptions(colIndex: number, options?: any): any;
|
67
67
|
|
68
|
-
public getFormatter(colIndex: number): FieldFormatter;
|
68
|
+
public getFormatter(colIndex: number): FieldFormatter|null;
|
69
69
|
|
70
70
|
public formatText(colIndex: number, obj: any): string;
|
71
71
|
|
@@ -122,6 +122,18 @@ TextFormattingPlugin.prototype.initialize = function (host, options) {
|
|
122
122
|
this.config(options);
|
123
123
|
}
|
124
124
|
};
|
125
|
+
/** @override
|
126
|
+
*/
|
127
|
+
|
128
|
+
|
129
|
+
TextFormattingPlugin.prototype._afterInit = function () {
|
130
|
+
// WOWRKAROUND : In test-resource and tr-grid-util, avoid using static variables. duplicating DateTime
|
131
|
+
var rtGrid = this._realTimeGrid;
|
132
|
+
|
133
|
+
if (rtGrid && rtGrid.setDateTimeUtil) {
|
134
|
+
rtGrid.setDateTimeUtil(DateTime);
|
135
|
+
}
|
136
|
+
};
|
125
137
|
/** @public
|
126
138
|
* @param {Object} host core grid instance
|
127
139
|
*/
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { injectCss, prettifyCss } from "./Util.js";
|
2
|
+
import Dom from "./Dom.js";
|
3
|
+
import ElfUtil from "./ElfUtil.js";
|
4
|
+
|
5
|
+
declare class DragUI {
|
6
|
+
|
7
|
+
constructor(options: any);
|
8
|
+
|
9
|
+
public static applyThemeColor(grid: any): void;
|
10
|
+
|
11
|
+
public onThemeLoaded(colors: any): void;
|
12
|
+
|
13
|
+
}
|
14
|
+
|
15
|
+
export default DragUI;
|
16
|
+
export {DragUI};
|
@@ -0,0 +1,214 @@
|
|
1
|
+
import { injectCss, prettifyCss } from "./Util.js";
|
2
|
+
import Dom from "./Dom.js";
|
3
|
+
import ElfUtil from "./ElfUtil.js";
|
4
|
+
|
5
|
+
/**
|
6
|
+
* @constructor
|
7
|
+
* @param {Object} options
|
8
|
+
*/
|
9
|
+
var DragUI = function(options) {
|
10
|
+
this._dragBox = options.dragBox;
|
11
|
+
this._dragBoxIcon = options.dragBoxIcon;
|
12
|
+
|
13
|
+
};
|
14
|
+
|
15
|
+
/** @type {string}
|
16
|
+
* @private
|
17
|
+
*/
|
18
|
+
DragUI._styles = ""; // Static variable
|
19
|
+
/** @type {Element}
|
20
|
+
* @private
|
21
|
+
*/
|
22
|
+
DragUI.prototype._guideline = null;
|
23
|
+
/** @type {Element}
|
24
|
+
* @private
|
25
|
+
*/
|
26
|
+
DragUI.prototype._dragBox = null;
|
27
|
+
/** @type {Element}
|
28
|
+
* @private
|
29
|
+
*/
|
30
|
+
DragUI.prototype._dragBoxIcon = null;
|
31
|
+
/** Core grid instance
|
32
|
+
* @type {Object}
|
33
|
+
* @private
|
34
|
+
*/
|
35
|
+
DragUI.prototype._grid = null;
|
36
|
+
|
37
|
+
/** @public
|
38
|
+
* @param {Object} grid core grid instance
|
39
|
+
*/
|
40
|
+
DragUI.applyThemeColor = function(grid) {
|
41
|
+
// This call after onThemeLoaded from extensions initialize
|
42
|
+
|
43
|
+
if(!grid || grid._dragUIStyles) {
|
44
|
+
return;
|
45
|
+
}
|
46
|
+
|
47
|
+
if(DragUI._styles) {
|
48
|
+
grid._dragUIStyles = true; // Prevent loading the same style twice
|
49
|
+
injectCss(DragUI._styles, grid.getElement());
|
50
|
+
} else {
|
51
|
+
// TODO : Handle if can not load DragUI._styles try to set new DragUI._styles
|
52
|
+
// Warning: This process have to use ElfUtil.getThemeColors() that async process for Backward compatability.
|
53
|
+
// When use async process, then it can be load theme multiple times.
|
54
|
+
|
55
|
+
}
|
56
|
+
};
|
57
|
+
|
58
|
+
/** @public
|
59
|
+
* @param {Object} colors
|
60
|
+
*/
|
61
|
+
DragUI.prototype.onThemeLoaded = function(colors) {
|
62
|
+
if(!DragUI._styles) {
|
63
|
+
var styles = [ // Main Styles without theme
|
64
|
+
".tr-row-guideline", [ // Backward compatability of row dragging
|
65
|
+
"position: absolute;",
|
66
|
+
"left: 0;",
|
67
|
+
"top: 0;",
|
68
|
+
"pointer-events: none;",
|
69
|
+
"text-align: center;",
|
70
|
+
"border-top-width: 3px;",
|
71
|
+
"border-top-style: solid;"
|
72
|
+
],
|
73
|
+
".guideline", [
|
74
|
+
"position: absolute;",
|
75
|
+
"left: 0;",
|
76
|
+
"top: 0;",
|
77
|
+
"pointer-events: none;",
|
78
|
+
"text-align: center;",
|
79
|
+
"border-top-style: solid;",
|
80
|
+
"width: 3px;",
|
81
|
+
"border-top-color: var(--grid-title-icon-color);",
|
82
|
+
"color: var(--grid-title-icon-color);",
|
83
|
+
"background-color: var(--grid-title-icon-color);"
|
84
|
+
],
|
85
|
+
".drag-box", [
|
86
|
+
"position: absolute;",
|
87
|
+
"left: 0;",
|
88
|
+
"top: 0;",
|
89
|
+
"pointer-events: none;",
|
90
|
+
"background-color: var(--grid-dragbox-bgcolor);",
|
91
|
+
"border: solid 1px var(--grid-title-sort-icon-color);",
|
92
|
+
"width: 134px;",
|
93
|
+
"height: 29px;",
|
94
|
+
"line-height: 29px;",
|
95
|
+
"white-space: nowrap;",
|
96
|
+
"overflow-x: clip;",
|
97
|
+
"text-overflow: ellipsis;",
|
98
|
+
"padding: 0 7px 0 7px;",
|
99
|
+
"box-shadow: 0 0 8px var(--grid-dragbox-bordercolor);"
|
100
|
+
],
|
101
|
+
".drag-box-disabled", [
|
102
|
+
"width: 100px;",
|
103
|
+
"left: 0;",
|
104
|
+
"top: 0;",
|
105
|
+
"position: absolute;"
|
106
|
+
],
|
107
|
+
".drag-box-icon", [
|
108
|
+
"top: -4px;",
|
109
|
+
"left: 12px;",
|
110
|
+
"padding: 2px;",
|
111
|
+
"border-radius: 100%;",
|
112
|
+
"font-size: 11px;",
|
113
|
+
"position: absolute;"
|
114
|
+
],
|
115
|
+
".drag-box-icon[icon='void']", [
|
116
|
+
"background-color:var(--grid-void-icon-bgcolor);",
|
117
|
+
"color:var(--grid-void-icon-color);"
|
118
|
+
],
|
119
|
+
".drag-box-icon[icon='add']", [
|
120
|
+
"background-color:var(--grid-insertion-icon-bgcolor);",
|
121
|
+
"color:var(--grid-insertion-icon-color);"
|
122
|
+
],
|
123
|
+
":host", [
|
124
|
+
"--grid-dragbox-bgcolor: #ffffff;", // If the value cannot be found, default to halo-light
|
125
|
+
"--grid-insertion-icon-bgcolor: #39c46e;",
|
126
|
+
"--grid-insertion-icon-color: #1A1A1A;",
|
127
|
+
"--grid-void-icon-bgcolor: #F5475B;",
|
128
|
+
"--grid-void-icon-color: #FFFFFF;"
|
129
|
+
],
|
130
|
+
".mouse-dragging .cell:hover", [ // for change mouse cursor when hover header while dragging
|
131
|
+
"cursor: grabbing !important;"
|
132
|
+
],
|
133
|
+
":host .column .cell.drag-indicator", [
|
134
|
+
"border: var(--grid-drag-indicator);" // defualt is "none"
|
135
|
+
],
|
136
|
+
".tr-dragging, .tr-dragging *", [
|
137
|
+
"-webkit-touch-callout: none;",
|
138
|
+
".user-select(none);"
|
139
|
+
]
|
140
|
+
];
|
141
|
+
var guidelineColor = "#ff9933";
|
142
|
+
var ElfVersion = ElfUtil.getElfVersion();
|
143
|
+
if(colors.primary) {
|
144
|
+
guidelineColor = colors.primary;
|
145
|
+
}
|
146
|
+
guidelineColor += ";";
|
147
|
+
|
148
|
+
styles.push(".tr-row-guideline", [
|
149
|
+
"border-top-color: " + guidelineColor,
|
150
|
+
"color: " + guidelineColor
|
151
|
+
]);
|
152
|
+
|
153
|
+
if(ElfVersion < 3) { // Backward compatability
|
154
|
+
styles.push(".pearl .tr-row-guideline, *[theme=pearl] .tr-row-guideline", [
|
155
|
+
"border-top-color: #ee7600;",
|
156
|
+
"color: #ee7600;",
|
157
|
+
"background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.1));"
|
158
|
+
]);
|
159
|
+
}
|
160
|
+
DragUI._styles = prettifyCss(styles);
|
161
|
+
}
|
162
|
+
};
|
163
|
+
|
164
|
+
/** @private
|
165
|
+
* @param {!Element|Event|MouseEvent} e
|
166
|
+
* @param {Object} grid
|
167
|
+
* @returns {boolean}=true means dragBox can be drop
|
168
|
+
*/
|
169
|
+
DragUI.prototype.renderDragBox = function (e, grid) {
|
170
|
+
if(!grid) {
|
171
|
+
return false;
|
172
|
+
}
|
173
|
+
|
174
|
+
var gridElem = grid.getElement();
|
175
|
+
var gridParent = grid.getParent().parentNode;
|
176
|
+
var pn = this._dragBox.parentNode;
|
177
|
+
if(!pn) {
|
178
|
+
gridParent.appendChild(this._dragBox);
|
179
|
+
}
|
180
|
+
|
181
|
+
var iconParent = this._dragBoxIcon.parentNode;
|
182
|
+
|
183
|
+
var dragBoxIcon = e.dragBoxIcon || this._dragBox.dragBoxIcon;
|
184
|
+
this._dragBoxIcon.style.visibility = "visible";
|
185
|
+
var drop = true;
|
186
|
+
if(dragBoxIcon === "insertion") {
|
187
|
+
drop = false;
|
188
|
+
this._dragBoxIcon.icon = "add";
|
189
|
+
if(!iconParent) {
|
190
|
+
this._dragBox.appendChild(this._dragBoxIcon);
|
191
|
+
}
|
192
|
+
} else if (dragBoxIcon === "not-allowed" || dragBoxIcon === "no-drop" || dragBoxIcon === "void" ) {
|
193
|
+
drop = false;
|
194
|
+
this._dragBoxIcon.icon = "void";
|
195
|
+
if(!iconParent) {
|
196
|
+
this._dragBox.appendChild(this._dragBoxIcon);
|
197
|
+
}
|
198
|
+
} else {
|
199
|
+
Dom.removeParent(this._dragBoxIcon);
|
200
|
+
}
|
201
|
+
|
202
|
+
var gridRect = gridElem.getBoundingClientRect();
|
203
|
+
|
204
|
+
var x = e.clientX - gridRect.left;
|
205
|
+
var y = e.pageY - gridRect.top;
|
206
|
+
|
207
|
+
// space for mouse cursor
|
208
|
+
this._dragBox.style.left = x - 5 + "px";
|
209
|
+
this._dragBox.style.top = y + 8 + "px";
|
210
|
+
return drop;
|
211
|
+
};
|
212
|
+
|
213
|
+
export default DragUI;
|
214
|
+
export {DragUI};
|
@@ -13,6 +13,23 @@ var _onLanguageMutated = function (elem, mutation) {
|
|
13
13
|
}
|
14
14
|
};
|
15
15
|
|
16
|
+
/** @private
|
17
|
+
* @param {Function} listener
|
18
|
+
* @param {string=} attributeName
|
19
|
+
* @param {MutationRecord} mutation
|
20
|
+
*/
|
21
|
+
var _onAttributeMutated = function (listener, attributeName, mutation) {
|
22
|
+
if (mutation.type === "attributes") {
|
23
|
+
if (attributeName != null) {
|
24
|
+
if (mutation.attributeName === attributeName) {
|
25
|
+
listener(mutation);
|
26
|
+
}
|
27
|
+
} else {
|
28
|
+
listener(mutation);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
};
|
32
|
+
|
16
33
|
/** @private
|
17
34
|
* @return {string}
|
18
35
|
*/
|
@@ -71,7 +88,7 @@ ElementObserver._addListener = function(elem, fn) {
|
|
71
88
|
};
|
72
89
|
|
73
90
|
/** @public Add a listener to a html lang attribute
|
74
|
-
* @param {Element} element
|
91
|
+
* @param {Element} element An element within the DOM tree to watch for changes
|
75
92
|
*/
|
76
93
|
ElementObserver.addLanguageListener = function(element) {
|
77
94
|
if (!element) { return; }
|
@@ -81,6 +98,16 @@ ElementObserver.addLanguageListener = function(element) {
|
|
81
98
|
ElementObserver._addObserver(document.documentElement, _onLanguageMutated.bind(null, element));
|
82
99
|
};
|
83
100
|
|
101
|
+
/** @public Add a listener to a html attribute
|
102
|
+
* @param {Element} element An element within the DOM tree to watch for changes
|
103
|
+
* @param {Function} listener A function which will be called on each attribute change
|
104
|
+
* @param {string=} attributeName If not specified, listener will be called on every attribute change
|
105
|
+
*/
|
106
|
+
ElementObserver.addAttributeListener = function(element, listener, attributeName) {
|
107
|
+
if (!element || !listener) { return; }
|
108
|
+
ElementObserver._addObserver(element, _onAttributeMutated.bind(null, listener, attributeName));
|
109
|
+
};
|
110
|
+
|
84
111
|
/**
|
85
112
|
* @type {MutationObserver}
|
86
113
|
* @private
|
@@ -167,7 +167,7 @@ FieldFormatter.prototype.init = function(options) { // deserialize
|
|
167
167
|
var utc = options["useUTCTime"];
|
168
168
|
if(utc != null || dtf != null) {
|
169
169
|
this.setDateTimeMeta(
|
170
|
-
dtf
|
170
|
+
dtf,
|
171
171
|
utc,
|
172
172
|
(options["idnSource"]) ? "idn" : "" // IDN Source will send time in second instead of millisecond.
|
173
173
|
);
|
@@ -188,8 +188,10 @@ FieldFormatter.prototype.getOptions = function(options) { // serialize
|
|
188
188
|
|
189
189
|
options["field"] = this._field;
|
190
190
|
options["formatType"] = this._userFormatType ? this._userFormatType : this._formatType; // WARNING: Beware of case sensitivity
|
191
|
-
options["
|
192
|
-
|
191
|
+
if(toDateTimeType(options["formatType"]) == DATE_TIME){
|
192
|
+
options["dateTimeFormat"] = this._dateTimeFormat;
|
193
|
+
options["useUTCTime"] = (this._timeZone == "GMT");
|
194
|
+
}
|
193
195
|
return options;
|
194
196
|
};
|
195
197
|
/** @public
|
@@ -244,7 +246,7 @@ FieldFormatter.prototype.setField = function(field, combinedField, formattedFiel
|
|
244
246
|
* @param {string=} lang
|
245
247
|
*/
|
246
248
|
FieldFormatter.prototype.setDateTimeMeta = function(format, gmtTimeZone, inputSource, lang) {
|
247
|
-
this._dateTimeFormat = format;
|
249
|
+
this._dateTimeFormat = format || "";
|
248
250
|
this._timeZone = (gmtTimeZone !== false) ? "GMT" : "LOCAL";
|
249
251
|
this._idnSource = (inputSource && inputSource.toLowerCase() == "idn") ? "idn" : "";
|
250
252
|
DateTime.setLocale(lang);
|
@@ -385,7 +387,7 @@ FieldFormatter.prototype._formatDateTime = function(val, rowData) {
|
|
385
387
|
}
|
386
388
|
val = new Date(sec * 1000); // Convert real-time raw data (second) to millisecond
|
387
389
|
}
|
388
|
-
return this._df(val, this._dateTimeFormat, this._timeZone);
|
390
|
+
return this._df(val, this._dateTimeFormat || "MM/DD/YYYY", this._timeZone);
|
389
391
|
};
|
390
392
|
/** @private
|
391
393
|
* @param {number|string|Date} val
|
@@ -262,13 +262,17 @@ GridPlugin.prototype.getColumnIndex = function (colId) {
|
|
262
262
|
GridPlugin.prototype.getColumnIndices = function (colRefs) {
|
263
263
|
if(this._compositeGrid) {
|
264
264
|
var allFields = this._compositeGrid.getColumnFields();
|
265
|
+
var columnCount = this._compositeGrid.getColumnCount();
|
265
266
|
var columnIndices = [];
|
267
|
+
var colRef;
|
266
268
|
for (var i = 0; i < colRefs.length; i++) {
|
267
|
-
|
268
|
-
if(typeof
|
269
|
-
|
269
|
+
colRef = colRefs[i];
|
270
|
+
if(typeof colRef === 'number') { // When user pass index
|
271
|
+
if(colRef >= 0 && colRef < columnCount) {
|
272
|
+
columnIndices.push(colRef);
|
273
|
+
}
|
270
274
|
} else {
|
271
|
-
var columnIndex = allFields.indexOf(
|
275
|
+
var columnIndex = allFields.indexOf(colRef); // Looping check column index of colRefs field
|
272
276
|
if(columnIndex !== -1) {
|
273
277
|
columnIndices.push(columnIndex);
|
274
278
|
}
|
@@ -27,6 +27,8 @@ declare class NumberFormatter {
|
|
27
27
|
|
28
28
|
public static padDecimalPartWithZeroes(str: string, precision: number): string;
|
29
29
|
|
30
|
+
public static multiplyByHundred(num: number): number;
|
31
|
+
|
30
32
|
public getOptions(options?: any): any;
|
31
33
|
|
32
34
|
public format(origVal: number): string;
|