@clr/angular 12.2.0 → 12.3.0
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/bundles/clr-angular.umd.js +91 -8
- package/bundles/clr-angular.umd.js.map +1 -1
- package/clarity.api.md +3 -2
- package/clr-angular.metadata.json +1 -1
- package/data/datagrid/datagrid-row.d.ts +12 -1
- package/data/datagrid/datagrid.d.ts +4 -2
- package/data/datagrid/providers/selection.d.ts +8 -0
- package/esm2015/accordion/stepper/stepper.js +16 -5
- package/esm2015/data/datagrid/datagrid-row.js +58 -5
- package/esm2015/data/datagrid/datagrid.js +23 -5
- package/esm2015/data/datagrid/providers/selection.js +5 -1
- package/fesm2015/clr-angular.js +91 -9
- package/fesm2015/clr-angular.js.map +1 -1
- package/package.json +2 -2
|
@@ -1555,9 +1555,7 @@
|
|
|
1555
1555
|
};
|
|
1556
1556
|
ClrStepper.prototype.listenForFormResetChanges = function () {
|
|
1557
1557
|
var _this = this;
|
|
1558
|
-
return this.form.
|
|
1559
|
-
.pipe(operators.filter(function () { return _this.form.pristine; })) // https://github.com/angular/angular/issues/10887
|
|
1560
|
-
.subscribe(function () { return _this.stepperService.resetPanels(); });
|
|
1558
|
+
return fromControlReset(this.form.form).subscribe(function () { return _this.stepperService.resetPanels(); });
|
|
1561
1559
|
};
|
|
1562
1560
|
ClrStepper.prototype.listenForPanelsCompleted = function () {
|
|
1563
1561
|
var _this = this;
|
|
@@ -1606,6 +1604,18 @@
|
|
|
1606
1604
|
initialPanel: [{ type: i0.Input, args: ['clrInitialStep',] }],
|
|
1607
1605
|
panels: [{ type: i0.ContentChildren, args: [ClrStepperPanel, { descendants: true },] }]
|
|
1608
1606
|
};
|
|
1607
|
+
function fromControlReset(control) {
|
|
1608
|
+
return new rxjs.Observable(function (observer) {
|
|
1609
|
+
var unpatchedControlReset = control.reset;
|
|
1610
|
+
control.reset = function () {
|
|
1611
|
+
observer.next();
|
|
1612
|
+
unpatchedControlReset.apply(control);
|
|
1613
|
+
};
|
|
1614
|
+
return function () {
|
|
1615
|
+
control.reset = unpatchedControlReset;
|
|
1616
|
+
};
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1609
1619
|
|
|
1610
1620
|
var StepperWillyWonka = /** @class */ (function (_super) {
|
|
1611
1621
|
__extends(StepperWillyWonka, _super);
|
|
@@ -14079,6 +14089,10 @@
|
|
|
14079
14089
|
* Subscriptions to the other providers changes.
|
|
14080
14090
|
*/
|
|
14081
14091
|
this.subscriptions = [];
|
|
14092
|
+
/**
|
|
14093
|
+
* Shift key state, for use in range selection.
|
|
14094
|
+
*/
|
|
14095
|
+
this.shiftPressed = false;
|
|
14082
14096
|
this.valueCollector = new rxjs.Subject();
|
|
14083
14097
|
/**
|
|
14084
14098
|
* The Observable that lets other classes subscribe to selection changes
|
|
@@ -14481,7 +14495,7 @@
|
|
|
14481
14495
|
|
|
14482
14496
|
var nbRow = 0;
|
|
14483
14497
|
var ClrDatagridRow = /** @class */ (function () {
|
|
14484
|
-
function ClrDatagridRow(selection, rowActionService, globalExpandable, expand, detailService, displayMode, vcr, renderer, el, commonStrings) {
|
|
14498
|
+
function ClrDatagridRow(selection, rowActionService, globalExpandable, expand, detailService, displayMode, vcr, renderer, el, commonStrings, items, document) {
|
|
14485
14499
|
var _this = this;
|
|
14486
14500
|
this.selection = selection;
|
|
14487
14501
|
this.rowActionService = rowActionService;
|
|
@@ -14493,6 +14507,8 @@
|
|
|
14493
14507
|
this.renderer = renderer;
|
|
14494
14508
|
this.el = el;
|
|
14495
14509
|
this.commonStrings = commonStrings;
|
|
14510
|
+
this.items = items;
|
|
14511
|
+
this.document = document;
|
|
14496
14512
|
/* reference to the enum so that template can access */
|
|
14497
14513
|
this.SELECTION_TYPE = SelectionType;
|
|
14498
14514
|
this.expandAnimationTrigger = false;
|
|
@@ -14523,6 +14539,24 @@
|
|
|
14523
14539
|
}
|
|
14524
14540
|
}));
|
|
14525
14541
|
}
|
|
14542
|
+
/**
|
|
14543
|
+
* The default behavior in Chrome and Firefox for shift-clicking on a label is to perform text-selection.
|
|
14544
|
+
* This prevents our intended range-selection, because this text-selection overrides our shift-click event.
|
|
14545
|
+
* We need to clear the stored selection range when shift-clicking. This will override the mostly unused shift-click
|
|
14546
|
+
* selection browser functionality, which is inconsistently implemented in browsers anyway.
|
|
14547
|
+
*/
|
|
14548
|
+
ClrDatagridRow.prototype.clearRanges = function (event) {
|
|
14549
|
+
if (event.shiftKey) {
|
|
14550
|
+
this.document.getSelection().removeAllRanges();
|
|
14551
|
+
// Firefox is too persistent about its text-selection behaviour. So we need to add a preventDefault();
|
|
14552
|
+
// We should not try to enforce this on the other browsers, though, because their toggle cycle does not get canceled by
|
|
14553
|
+
// the preventDefault() and they toggle the checkbox second time, effectively retrurning it to not-selected.
|
|
14554
|
+
if (window.navigator.userAgent.indexOf('Firefox') !== -1) {
|
|
14555
|
+
event.preventDefault();
|
|
14556
|
+
this.toggle(true);
|
|
14557
|
+
}
|
|
14558
|
+
}
|
|
14559
|
+
};
|
|
14526
14560
|
Object.defineProperty(ClrDatagridRow.prototype, "selected", {
|
|
14527
14561
|
/**
|
|
14528
14562
|
* Indicates if the row is selected
|
|
@@ -14540,6 +14574,12 @@
|
|
|
14540
14574
|
this._selected = value;
|
|
14541
14575
|
}
|
|
14542
14576
|
else {
|
|
14577
|
+
if (value && this.selection.selectionType === SelectionType.Multi) {
|
|
14578
|
+
this.rangeSelect();
|
|
14579
|
+
}
|
|
14580
|
+
else {
|
|
14581
|
+
this.selection.rangeStart = null;
|
|
14582
|
+
}
|
|
14543
14583
|
this.selection.setSelected(this.item, value);
|
|
14544
14584
|
}
|
|
14545
14585
|
},
|
|
@@ -14643,6 +14683,30 @@
|
|
|
14643
14683
|
_this.expandAnimationTrigger = !_this.expandAnimationTrigger;
|
|
14644
14684
|
}));
|
|
14645
14685
|
};
|
|
14686
|
+
ClrDatagridRow.prototype.rangeSelect = function () {
|
|
14687
|
+
var _a;
|
|
14688
|
+
var items = this.items.displayed;
|
|
14689
|
+
if (!items) {
|
|
14690
|
+
return;
|
|
14691
|
+
}
|
|
14692
|
+
var startIx = items.indexOf(this.selection.rangeStart);
|
|
14693
|
+
if (this.selection.rangeStart &&
|
|
14694
|
+
this.selection.current.includes(this.selection.rangeStart) &&
|
|
14695
|
+
this.selection.shiftPressed &&
|
|
14696
|
+
startIx !== -1) {
|
|
14697
|
+
var endIx = items.indexOf(this.item);
|
|
14698
|
+
// Using Set to remove duplicates
|
|
14699
|
+
var newSelection = new Set(this.selection.current.concat(items.slice(Math.min(startIx, endIx), Math.max(startIx, endIx) + 1)));
|
|
14700
|
+
this.selection.clearSelection();
|
|
14701
|
+
(_a = this.selection.current).push.apply(_a, __spreadArray([], __read(newSelection)));
|
|
14702
|
+
}
|
|
14703
|
+
else {
|
|
14704
|
+
// page number has changed or
|
|
14705
|
+
// no Shift was pressed or
|
|
14706
|
+
// rangeStart not yet set
|
|
14707
|
+
this.selection.rangeStart = this.item;
|
|
14708
|
+
}
|
|
14709
|
+
};
|
|
14646
14710
|
ClrDatagridRow.prototype.ngOnDestroy = function () {
|
|
14647
14711
|
this.subscriptions.forEach(function (sub) { return sub.unsubscribe(); });
|
|
14648
14712
|
};
|
|
@@ -14662,7 +14726,7 @@
|
|
|
14662
14726
|
ClrDatagridRow.decorators = [
|
|
14663
14727
|
{ type: i0.Component, args: [{
|
|
14664
14728
|
selector: 'clr-dg-row',
|
|
14665
|
-
template: "<!--\n We need to wrap the #rowContent in label element if we are in rowSelectionMode.\n Clicking of that wrapper label will equate to clicking on the whole row, which triggers the checkbox to toggle.\n-->\n<label class=\"datagrid-row-clickable\" *ngIf=\"selection.rowSelectionMode\">\n <clr-expandable-animation [clrExpandTrigger]=\"expandAnimationTrigger\" *ngIf=\"expand.expandable\">\n <ng-template [ngTemplateOutlet]=\"rowContent\"></ng-template>\n </clr-expandable-animation>\n <ng-template [ngTemplateOutlet]=\"rowContent\" *ngIf=\"!expand.expandable\"></ng-template>\n</label>\n\n<clr-expandable-animation\n *ngIf=\"!selection.rowSelectionMode && expand.expandable\"\n [clrExpandTrigger]=\"expandAnimationTrigger\"\n>\n <ng-template [ngTemplateOutlet]=\"rowContent\"></ng-template>\n</clr-expandable-animation>\n\n<ng-template *ngIf=\"!selection.rowSelectionMode && !expand.expandable\" [ngTemplateOutlet]=\"rowContent\"></ng-template>\n\n<!--\n We need the \"project into template\" hacks because we need this in 2 different places\n depending on whether the details replace the row or not.\n-->\n<ng-template #detail>\n <ng-content select=\"clr-dg-row-detail\"></ng-content>\n</ng-template>\n\n<ng-template #rowContent>\n <div\n role=\"row\"\n [id]=\"id\"\n class=\"datagrid-row-master datagrid-row-flex\"\n [class.datagrid-row-detail-open]=\"detailService.isRowOpen(item)\"\n >\n <div class=\"datagrid-row-sticky\">\n <!-- Sticky elements here -->\n <ng-container #stickyCells>\n <div\n *ngIf=\"selection.selectionType === SELECTION_TYPE.Multi\"\n class=\"datagrid-select datagrid-fixed-column datagrid-cell\"\n [ngClass]=\"{ 'clr-form-control-disabled': !clrDgSelectable }\"\n role=\"gridcell\"\n >\n <div class=\"clr-checkbox-wrapper\">\n <input\n type=\"checkbox\"\n [ngModel]=\"selected\"\n (ngModelChange)=\"toggle($event)\"\n [id]=\"checkboxId\"\n [attr.disabled]=\"clrDgSelectable ? null : true\"\n [attr.aria-disabled]=\"clrDgSelectable ? null : true\"\n [attr.aria-label]=\"commonStrings.keys.select\"\n />\n <!-- Usage of class clr-col-null here prevents clr-col-* classes from being added when a datagrid is wrapped inside clrForm -->\n <label [for]=\"checkboxId\" class=\"clr-control-label clr-col-null\">\n <span class=\"clr-sr-only\">{{commonStrings.keys.select}}</span>\n </label>\n </div>\n </div>\n <div\n *ngIf=\"selection.selectionType === SELECTION_TYPE.Single\"\n class=\"datagrid-select datagrid-fixed-column datagrid-cell\"\n role=\"gridcell\"\n [ngClass]=\"{ 'clr-form-control-disabled': !clrDgSelectable }\"\n >\n <!-- TODO: it would be better if in addition to the generic \"Select\" label, we could add aria-labelledby\n to label the radio by the first cell in the row (typically an id or name).\n It's pretty easy to label it with the whole row since we already have an id for it, but in most\n cases the row is far too long to serve as a label, the screenreader reads every single cell content. -->\n <input\n type=\"radio\"\n clrRadio\n [id]=\"radioId\"\n [name]=\"selection.id + '-radio'\"\n [value]=\"item\"\n [(ngModel)]=\"selection.currentSingle\"\n [checked]=\"selection.currentSingle === item\"\n [attr.disabled]=\"clrDgSelectable ? null : true\"\n [attr.aria-disabled]=\"clrDgSelectable ? null : true\"\n [attr.aria-label]=\"commonStrings.keys.select\"\n />\n </div>\n <div\n *ngIf=\"rowActionService.hasActionableRow\"\n class=\"datagrid-row-actions datagrid-fixed-column datagrid-cell\"\n role=\"gridcell\"\n >\n <ng-content select=\"clr-dg-action-overflow\"></ng-content>\n </div>\n <div\n *ngIf=\"globalExpandable.hasExpandableRow\"\n class=\"datagrid-expandable-caret datagrid-fixed-column datagrid-cell\"\n role=\"gridcell\"\n >\n <ng-container *ngIf=\"expand.expandable\">\n <button\n *ngIf=\"!expand.loading\"\n (click)=\"toggleExpand()\"\n type=\"button\"\n class=\"datagrid-expandable-caret-button\"\n [attr.aria-expanded]=\"expand.expanded\"\n [attr.aria-label]=\"expand.expanded ? clrDgDetailCloseLabel : clrDgDetailOpenLabel\"\n [attr.aria-controls]=\"expandableId\"\n >\n <cds-icon\n shape=\"angle\"\n class=\"datagrid-expandable-caret-icon\"\n [attr.direction]=\"expand.expanded ? 'down' : 'right'\"\n [attr.title]=\"expand.expanded ? commonStrings.keys.collapse : commonStrings.keys.expand\"\n ></cds-icon>\n </button>\n <clr-spinner *ngIf=\"expand.loading\" clrSmall>{{ commonStrings.keys.loading }}</clr-spinner>\n </ng-container>\n </div>\n <div *ngIf=\"detailService.enabled\" class=\"datagrid-detail-caret datagrid-fixed-column datagrid-cell\">\n <button\n (click)=\"detailService.toggle(item, detailButton)\"\n type=\"button\"\n #detailButton\n class=\"datagrid-detail-caret-button\"\n [class.is-open]=\"detailService.isRowOpen(item)\"\n [attr.aria-label]=\"detailService.isOpen ? clrDgDetailCloseLabel : clrDgDetailOpenLabel\"\n [attr.aria-expanded]=\"detailService.isOpen\"\n [attr.aria-controls]=\"detailService.id\"\n aria-haspopup=\"dialog\"\n >\n <cds-icon\n shape=\"angle-double\"\n [attr.direction]=\"detailService.isRowOpen(item) ? 'left' : 'right'\"\n class=\"datagrid-detail-caret-icon\"\n [attr.title]=\"detailService.isRowOpen(item) ? commonStrings.keys.close: commonStrings.keys.open\"\n ></cds-icon>\n </button>\n </div>\n </ng-container>\n <!-- placeholder for projecting other sticky cells as pinned-->\n </div>\n <div class=\"datagrid-row-scrollable\" [ngClass]=\"{'is-replaced': replaced && expanded}\">\n <div class=\"datagrid-scrolling-cells\">\n <ng-content select=\"clr-dg-cell\"></ng-content>\n <ng-container #scrollableCells></ng-container>\n </div>\n <!-- details here when replace, re-visit when sticky container is used for pinned cells -->\n <ng-template *ngIf=\"replaced && !expand.loading\" [ngTemplateOutlet]=\"detail\"></ng-template>\n <ng-template *ngIf=\"!replaced && !expand.loading\" [ngTemplateOutlet]=\"detail\"></ng-template>\n </div>\n </div>\n</ng-template>\n\n<ng-container #calculatedCells></ng-container>\n",
|
|
14729
|
+
template: "<!--\n We need to wrap the #rowContent in label element if we are in rowSelectionMode.\n Clicking of that wrapper label will equate to clicking on the whole row, which triggers the checkbox to toggle.\n-->\n<label class=\"datagrid-row-clickable\" *ngIf=\"selection.rowSelectionMode\" (mousedown)=\"clearRanges($event)\">\n <clr-expandable-animation [clrExpandTrigger]=\"expandAnimationTrigger\" *ngIf=\"expand.expandable\">\n <ng-template [ngTemplateOutlet]=\"rowContent\"></ng-template>\n </clr-expandable-animation>\n <ng-template [ngTemplateOutlet]=\"rowContent\" *ngIf=\"!expand.expandable\"></ng-template>\n</label>\n\n<clr-expandable-animation\n *ngIf=\"!selection.rowSelectionMode && expand.expandable\"\n [clrExpandTrigger]=\"expandAnimationTrigger\"\n>\n <ng-template [ngTemplateOutlet]=\"rowContent\"></ng-template>\n</clr-expandable-animation>\n\n<ng-template *ngIf=\"!selection.rowSelectionMode && !expand.expandable\" [ngTemplateOutlet]=\"rowContent\"></ng-template>\n\n<!--\n We need the \"project into template\" hacks because we need this in 2 different places\n depending on whether the details replace the row or not.\n-->\n<ng-template #detail>\n <ng-content select=\"clr-dg-row-detail\"></ng-content>\n</ng-template>\n\n<ng-template #rowContent>\n <div\n role=\"row\"\n [id]=\"id\"\n class=\"datagrid-row-master datagrid-row-flex\"\n [class.datagrid-row-detail-open]=\"detailService.isRowOpen(item)\"\n >\n <div class=\"datagrid-row-sticky\">\n <!-- Sticky elements here -->\n <ng-container #stickyCells>\n <div\n *ngIf=\"selection.selectionType === SELECTION_TYPE.Multi\"\n class=\"datagrid-select datagrid-fixed-column datagrid-cell\"\n [ngClass]=\"{ 'clr-form-control-disabled': !clrDgSelectable }\"\n role=\"gridcell\"\n >\n <div class=\"clr-checkbox-wrapper\">\n <input\n type=\"checkbox\"\n [ngModel]=\"selected\"\n (ngModelChange)=\"toggle($event)\"\n [id]=\"checkboxId\"\n [attr.disabled]=\"clrDgSelectable ? null : true\"\n [attr.aria-disabled]=\"clrDgSelectable ? null : true\"\n [attr.aria-label]=\"commonStrings.keys.select\"\n />\n <!-- Usage of class clr-col-null here prevents clr-col-* classes from being added when a datagrid is wrapped inside clrForm -->\n <label [for]=\"checkboxId\" class=\"clr-control-label clr-col-null\" (click)=\"clearRanges($event)\">\n <span class=\"clr-sr-only\">{{commonStrings.keys.select}}</span>\n </label>\n </div>\n </div>\n <div\n *ngIf=\"selection.selectionType === SELECTION_TYPE.Single\"\n class=\"datagrid-select datagrid-fixed-column datagrid-cell\"\n role=\"gridcell\"\n [ngClass]=\"{ 'clr-form-control-disabled': !clrDgSelectable }\"\n >\n <!-- TODO: it would be better if in addition to the generic \"Select\" label, we could add aria-labelledby\n to label the radio by the first cell in the row (typically an id or name).\n It's pretty easy to label it with the whole row since we already have an id for it, but in most\n cases the row is far too long to serve as a label, the screenreader reads every single cell content. -->\n <input\n type=\"radio\"\n clrRadio\n [id]=\"radioId\"\n [name]=\"selection.id + '-radio'\"\n [value]=\"item\"\n [(ngModel)]=\"selection.currentSingle\"\n [checked]=\"selection.currentSingle === item\"\n [attr.disabled]=\"clrDgSelectable ? null : true\"\n [attr.aria-disabled]=\"clrDgSelectable ? null : true\"\n [attr.aria-label]=\"commonStrings.keys.select\"\n />\n </div>\n <div\n *ngIf=\"rowActionService.hasActionableRow\"\n class=\"datagrid-row-actions datagrid-fixed-column datagrid-cell\"\n role=\"gridcell\"\n >\n <ng-content select=\"clr-dg-action-overflow\"></ng-content>\n </div>\n <div\n *ngIf=\"globalExpandable.hasExpandableRow\"\n class=\"datagrid-expandable-caret datagrid-fixed-column datagrid-cell\"\n role=\"gridcell\"\n >\n <ng-container *ngIf=\"expand.expandable\">\n <button\n *ngIf=\"!expand.loading\"\n (click)=\"toggleExpand()\"\n type=\"button\"\n class=\"datagrid-expandable-caret-button\"\n [attr.aria-expanded]=\"expand.expanded\"\n [attr.aria-label]=\"expand.expanded ? clrDgDetailCloseLabel : clrDgDetailOpenLabel\"\n [attr.aria-controls]=\"expandableId\"\n >\n <cds-icon\n shape=\"angle\"\n class=\"datagrid-expandable-caret-icon\"\n [attr.direction]=\"expand.expanded ? 'down' : 'right'\"\n [attr.title]=\"expand.expanded ? commonStrings.keys.collapse : commonStrings.keys.expand\"\n ></cds-icon>\n </button>\n <clr-spinner *ngIf=\"expand.loading\" clrSmall>{{ commonStrings.keys.loading }}</clr-spinner>\n </ng-container>\n </div>\n <div *ngIf=\"detailService.enabled\" class=\"datagrid-detail-caret datagrid-fixed-column datagrid-cell\">\n <button\n (click)=\"detailService.toggle(item, detailButton)\"\n type=\"button\"\n #detailButton\n class=\"datagrid-detail-caret-button\"\n [class.is-open]=\"detailService.isRowOpen(item)\"\n [attr.aria-label]=\"detailService.isOpen ? clrDgDetailCloseLabel : clrDgDetailOpenLabel\"\n [attr.aria-expanded]=\"detailService.isOpen\"\n [attr.aria-controls]=\"detailService.id\"\n aria-haspopup=\"dialog\"\n >\n <cds-icon\n shape=\"angle-double\"\n [attr.direction]=\"detailService.isRowOpen(item) ? 'left' : 'right'\"\n class=\"datagrid-detail-caret-icon\"\n [attr.title]=\"detailService.isRowOpen(item) ? commonStrings.keys.close: commonStrings.keys.open\"\n ></cds-icon>\n </button>\n </div>\n </ng-container>\n <!-- placeholder for projecting other sticky cells as pinned-->\n </div>\n <div class=\"datagrid-row-scrollable\" [ngClass]=\"{'is-replaced': replaced && expanded}\">\n <div class=\"datagrid-scrolling-cells\">\n <ng-content select=\"clr-dg-cell\"></ng-content>\n <ng-container #scrollableCells></ng-container>\n </div>\n <!-- details here when replace, re-visit when sticky container is used for pinned cells -->\n <ng-template *ngIf=\"replaced && !expand.loading\" [ngTemplateOutlet]=\"detail\"></ng-template>\n <ng-template *ngIf=\"!replaced && !expand.loading\" [ngTemplateOutlet]=\"detail\"></ng-template>\n </div>\n </div>\n</ng-template>\n\n<ng-container #calculatedCells></ng-container>\n",
|
|
14666
14730
|
host: {
|
|
14667
14731
|
'[class.datagrid-row]': 'true',
|
|
14668
14732
|
'[class.datagrid-selected]': 'selected',
|
|
@@ -14686,7 +14750,9 @@
|
|
|
14686
14750
|
{ type: i0.ViewContainerRef },
|
|
14687
14751
|
{ type: i0.Renderer2 },
|
|
14688
14752
|
{ type: i0.ElementRef },
|
|
14689
|
-
{ type: ClrCommonStringsService }
|
|
14753
|
+
{ type: ClrCommonStringsService },
|
|
14754
|
+
{ type: Items },
|
|
14755
|
+
{ type: undefined, decorators: [{ type: i0.Inject, args: [i1.DOCUMENT,] }] }
|
|
14690
14756
|
]; };
|
|
14691
14757
|
ClrDatagridRow.propDecorators = {
|
|
14692
14758
|
expandAnimation: [{ type: i0.ViewChild, args: [ClrExpandableAnimation,] }],
|
|
@@ -15102,7 +15168,7 @@
|
|
|
15102
15168
|
* The full license information can be found in LICENSE in the root directory of this project.
|
|
15103
15169
|
*/
|
|
15104
15170
|
var ClrDatagrid = /** @class */ (function () {
|
|
15105
|
-
function ClrDatagrid(organizer, items, expandableRows, selection, rowActionService, stateProvider, displayMode, renderer, detailService, datagridId, el, page, commonStrings, columnsService, keyNavigation) {
|
|
15171
|
+
function ClrDatagrid(organizer, items, expandableRows, selection, rowActionService, stateProvider, displayMode, renderer, detailService, datagridId, document, el, page, commonStrings, columnsService, keyNavigation, zone) {
|
|
15106
15172
|
this.organizer = organizer;
|
|
15107
15173
|
this.items = items;
|
|
15108
15174
|
this.expandableRows = expandableRows;
|
|
@@ -15112,11 +15178,13 @@
|
|
|
15112
15178
|
this.displayMode = displayMode;
|
|
15113
15179
|
this.renderer = renderer;
|
|
15114
15180
|
this.detailService = detailService;
|
|
15181
|
+
this.document = document;
|
|
15115
15182
|
this.el = el;
|
|
15116
15183
|
this.page = page;
|
|
15117
15184
|
this.commonStrings = commonStrings;
|
|
15118
15185
|
this.columnsService = columnsService;
|
|
15119
15186
|
this.keyNavigation = keyNavigation;
|
|
15187
|
+
this.zone = zone;
|
|
15120
15188
|
/* reference to the enum so that template can access */
|
|
15121
15189
|
this.SELECTION_TYPE = SelectionType;
|
|
15122
15190
|
/**
|
|
@@ -15327,6 +15395,19 @@
|
|
|
15327
15395
|
});
|
|
15328
15396
|
}
|
|
15329
15397
|
}));
|
|
15398
|
+
// We need to preserve shift state, so it can be used on selection change, regardless of the input event
|
|
15399
|
+
// that triggered the change. This helps us to easily resolve the k/b only case together with the mouse selection case.
|
|
15400
|
+
this.zone.runOutsideAngular(function () {
|
|
15401
|
+
_this._subscriptions.push(rxjs.fromEvent(_this.document.body, 'keydown').subscribe(function (event) {
|
|
15402
|
+
if (event.key === 'Shift') {
|
|
15403
|
+
_this.selection.shiftPressed = true;
|
|
15404
|
+
}
|
|
15405
|
+
}), rxjs.fromEvent(_this.document.body, 'keyup').subscribe(function (event) {
|
|
15406
|
+
if (event.key === 'Shift') {
|
|
15407
|
+
_this.selection.shiftPressed = false;
|
|
15408
|
+
}
|
|
15409
|
+
}));
|
|
15410
|
+
});
|
|
15330
15411
|
};
|
|
15331
15412
|
ClrDatagrid.prototype.ngOnDestroy = function () {
|
|
15332
15413
|
this._subscriptions.forEach(function (sub) { return sub.unsubscribe(); });
|
|
@@ -15375,11 +15456,13 @@
|
|
|
15375
15456
|
{ type: i0.Renderer2 },
|
|
15376
15457
|
{ type: DetailService },
|
|
15377
15458
|
{ type: String, decorators: [{ type: i0.Inject, args: [UNIQUE_ID,] }] },
|
|
15459
|
+
{ type: undefined, decorators: [{ type: i0.Inject, args: [i1.DOCUMENT,] }] },
|
|
15378
15460
|
{ type: i0.ElementRef },
|
|
15379
15461
|
{ type: Page },
|
|
15380
15462
|
{ type: ClrCommonStringsService },
|
|
15381
15463
|
{ type: ColumnsService },
|
|
15382
|
-
{ type: KeyNavigationGridController }
|
|
15464
|
+
{ type: KeyNavigationGridController },
|
|
15465
|
+
{ type: i0.NgZone }
|
|
15383
15466
|
]; };
|
|
15384
15467
|
ClrDatagrid.propDecorators = {
|
|
15385
15468
|
loading: [{ type: i0.Input, args: ['clrDgLoading',] }],
|