@datorama/core 22.10.0 → 22.10.1-rc.1

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.
@@ -8231,6 +8231,91 @@ function isTestEnv() {
8231
8231
  return !!window.Cypress;
8232
8232
  }
8233
8233
 
8234
+ /**
8235
+ * @license
8236
+ * Copyright Datorama. All Rights Reserved.
8237
+ *
8238
+ * Use of this source code is governed by an Apache License 2.0 license that can be
8239
+ * found in the LICENSE file at https://github.com/datorama/client-core/blob/master/LICENSE
8240
+ */
8241
+ var DatoTriggerSingle = /** @class */ (function () {
8242
+ function DatoTriggerSingle(cdr) {
8243
+ this.cdr = cdr;
8244
+ this._placeholder = '';
8245
+ }
8246
+ Object.defineProperty(DatoTriggerSingle.prototype, "placeholder", {
8247
+ set: function (value) {
8248
+ this._placeholder = value;
8249
+ this.cdr.detectChanges();
8250
+ },
8251
+ enumerable: true,
8252
+ configurable: true
8253
+ });
8254
+ Object.defineProperty(DatoTriggerSingle.prototype, "context", {
8255
+ set: function (value) {
8256
+ this._model = { $implicit: value };
8257
+ this.cdr.detectChanges();
8258
+ },
8259
+ enumerable: true,
8260
+ configurable: true
8261
+ });
8262
+ Object.defineProperty(DatoTriggerSingle.prototype, "hidePlaceholder", {
8263
+ get: function () {
8264
+ return !this._model || !this._model.$implicit;
8265
+ },
8266
+ enumerable: true,
8267
+ configurable: true
8268
+ });
8269
+ DatoTriggerSingle.prototype.ngOnInit = function () {
8270
+ this.cdr.detach();
8271
+ };
8272
+ Object.defineProperty(DatoTriggerSingle.prototype, "getLabel", {
8273
+ get: function () {
8274
+ return this._model && this._model.$implicit && this._model.$implicit[this.labelKey];
8275
+ },
8276
+ enumerable: true,
8277
+ configurable: true
8278
+ });
8279
+ DatoTriggerSingle.prototype.triggerChangeDetection = function () {
8280
+ this.cdr.detectChanges();
8281
+ };
8282
+ DatoTriggerSingle.ctorParameters = function () { return [
8283
+ { type: ChangeDetectorRef }
8284
+ ]; };
8285
+ __decorate([
8286
+ Input(),
8287
+ __metadata("design:type", TemplateRef)
8288
+ ], DatoTriggerSingle.prototype, "loadingTemplate", void 0);
8289
+ __decorate([
8290
+ Input(),
8291
+ __metadata("design:type", DatoSelectActiveDirective)
8292
+ ], DatoTriggerSingle.prototype, "active", void 0);
8293
+ __decorate([
8294
+ Input(),
8295
+ __metadata("design:type", Object),
8296
+ __metadata("design:paramtypes", [Object])
8297
+ ], DatoTriggerSingle.prototype, "placeholder", null);
8298
+ __decorate([
8299
+ Input(),
8300
+ __metadata("design:type", String)
8301
+ ], DatoTriggerSingle.prototype, "labelKey", void 0);
8302
+ __decorate([
8303
+ Input(),
8304
+ __metadata("design:type", Object),
8305
+ __metadata("design:paramtypes", [Object])
8306
+ ], DatoTriggerSingle.prototype, "context", null);
8307
+ DatoTriggerSingle = __decorate([
8308
+ Component({
8309
+ selector: 'dato-trigger-single',
8310
+ template: "<ng-template *ngIf=\"loadingTemplate\" [ngTemplateOutlet]=\"loadingTemplate\"></ng-template>\n<ng-container\n *ngIf=\"active && !hidePlaceholder\"\n [ngTemplateOutlet]=\"active.tpl\"\n [ngTemplateOutletContext]=\"_model\">\n</ng-container>\n<ng-container *ngIf=\"!active\">{{getLabel | translate}}</ng-container>\n<span class=\"dato-select__placeholder\" *ngIf=\"hidePlaceholder\">{{_placeholder}}</span>\n<dato-icon datoIcon=\"arrow-down\" datoSize=\"sm\" class=\"dato-select__single__arrow\"></dato-icon>\n",
8311
+ changeDetection: ChangeDetectionStrategy.OnPush,
8312
+ styles: [":host{display:block;position:relative;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host dato-icon{position:absolute;top:50%;transform:translateY(-50%);right:10px}"]
8313
+ }),
8314
+ __metadata("design:paramtypes", [ChangeDetectorRef])
8315
+ ], DatoTriggerSingle);
8316
+ return DatoTriggerSingle;
8317
+ }());
8318
+
8234
8319
  /**
8235
8320
  * @license
8236
8321
  * Copyright Datorama. All Rights Reserved.
@@ -9112,6 +9197,9 @@ var DatoSelectComponent = /** @class */ (function (_super) {
9112
9197
  setTimeout(function () { return _this.datoOverlay.scheduleUpdate(); }, 0);
9113
9198
  }
9114
9199
  };
9200
+ DatoSelectComponent.prototype.triggerChangeDetectionInDatoSingle = function () {
9201
+ this.datoTriggerSingle.triggerChangeDetection();
9202
+ };
9115
9203
  DatoSelectComponent.ctorParameters = function () { return [
9116
9204
  { type: ChangeDetectorRef },
9117
9205
  { type: DatoTranslateService },
@@ -9121,6 +9209,10 @@ var DatoSelectComponent = /** @class */ (function (_super) {
9121
9209
  { type: undefined, decorators: [{ type: Attribute, args: ['datoSize',] }] },
9122
9210
  { type: String, decorators: [{ type: Attribute, args: ['width',] }] }
9123
9211
  ]; };
9212
+ __decorate([
9213
+ ViewChild('datoTriggerSingle'),
9214
+ __metadata("design:type", DatoTriggerSingle)
9215
+ ], DatoSelectComponent.prototype, "datoTriggerSingle", void 0);
9124
9216
  __decorate([
9125
9217
  ViewChild('dropdown'),
9126
9218
  __metadata("design:type", TemplateRef)
@@ -9287,7 +9379,7 @@ var DatoSelectComponent = /** @class */ (function (_super) {
9287
9379
  DatoSelectComponent = __decorate([
9288
9380
  Component({
9289
9381
  selector: 'dato-select',
9290
- template: "<section class=\"dato-select__trigger\" [class.dato-select--naked]=\"_naked\" [class.dato-select--disabled]=\"_disabled\">\n\n <div class=\"dato-select__single\" *ngIf=\"isSingle\" [ngClass]=\"_dropdownClass\">\n <dato-input [class.force-hide]=\"(!open && isCombo) || !isCombo\" [placeholder]=\"searchPlaceholder | translate\"\n (keyup)=\"keyup($event)\" [isFocused]=\"_focus\" [isLoading]=\"isLoading\" [formControl]=\"searchControl\" type=\"search\">\n </dato-input>\n\n <dato-trigger-single [loadingTemplate]=\"loadingTemplate\" [active]=\"active\" datoErrorValidationBorderAnchor tabindex=\"0\" [labelKey]=\"labelKey\"\n [context]=\"_model[0]\" [class.force-hide]=\"open && isCombo\" [placeholder]=\"placeholder | translate\"\n class=\"ontop-overlay\" (keydown)=\"preventBodyScroll($event)\" (keyup)=\"keyup($event)\" (click)=\"openDropdown()\">\n </dato-trigger-single>\n </div>\n\n <dato-trigger-multi [loadingTemplate]=\"loadingTemplate\" [options]=\"_model\" datoErrorValidationBorderAnchor [control]=\"searchControl\"\n [placeholder]=\"placeholder | translate\" [labelKey]=\"labelKey\" [idKey]=\"idKey\" (keyup)=\"keyup($event)\"\n [isLoading]=\"isLoading\" [keepFocus]=\"keepFocus\" [limitTo]=\"limitTo\" [clickOutside]=\"_clickOutside\" [isSortable]=\"isSortable\"\n [selectAllChipTxt]=\"selectAllChipTxt\"\n [showSelectAllChip]=\"selectAllChipTxt && showSelectAllChip\"\n (unselectAll)=\"checkAll(false)\"\n (removeOption)=\"removeOption($event)\" (reorderOptions)=\"reorderOptions($event)\" *ngIf=\"isMulti\"\n (click)=\"openDropdown($event)\"></dato-trigger-multi>\n\n</section>\n\n<ng-template #dropdown>\n <section class=\"dato-select__dropdown-container\" tabindex=\"0\" (keyup)=\"keyup($event)\">\n\n <!-- HEADER -->\n\n <header class=\"dato-select__header dato-select__option dato-select__option--simple\" data-is-floating\n *ngIf=\"isMulti && allowSelectAll\" [class.force-hide]=\"_showEmptyResults\" [class.ml-10]=\"containsGroups\">\n <dato-checkbox [checked]=\"_isAllChecked\" (check)=\"checkAll($event)\"\n [indeterminatelyChecked]=\"_isIndeterminatelyChecked\">\n {{'core.select-all' | translate}}<span class=\"primary-300-color note-italic ml-5\">{{_count}}</span>\n </dato-checkbox>\n </header>\n\n <!-- END HEADER -->\n\n <!-- DROPDOWN -->\n\n <div class=\"dato-select__dropdown\">\n\n <ng-content></ng-content>\n\n <dato-select-empty [show]=\"_showEmptyResults\">{{_noItemsLabel}}</dato-select-empty>\n <div class=\"dato-select__option dato-select-infinite-spinner\" data-is-floating *ngIf=\"infiniteScrollLoading\">\n <span class=\"dato-input__spinner\"></span>\n </div>\n\n </div>\n\n <!-- END DROPDOWN -->\n\n\n <!-- FOOTER -->\n\n <footer class=\"dato-select__footer d-flex\" [class.with-actions]=\"_withActions\">\n\n <ng-content select=\"[datoSelectFooter]\"></ng-content>\n\n <ng-container *ngIf=\"_withActions\">\n <dato-link class=\"mr-20\" datoType=\"secondary\" (click)=\"close()\">Cancel</dato-link>\n <dato-button datoSize=\"sm\" (click)=\"save.emit(); close();\">Save</dato-button>\n </ng-container>\n\n </footer>\n\n <!-- END FOOTER -->\n\n </section>\n\n</ng-template>\n",
9382
+ template: "<section class=\"dato-select__trigger\" [class.dato-select--naked]=\"_naked\" [class.dato-select--disabled]=\"_disabled\">\n\n <div class=\"dato-select__single\" *ngIf=\"isSingle\" [ngClass]=\"_dropdownClass\">\n <dato-input [class.force-hide]=\"(!open && isCombo) || !isCombo\" [placeholder]=\"searchPlaceholder | translate\"\n (keyup)=\"keyup($event)\" [isFocused]=\"_focus\" [isLoading]=\"isLoading\" [formControl]=\"searchControl\" type=\"search\">\n </dato-input>\n\n <dato-trigger-single #datoTriggerSingle [loadingTemplate]=\"loadingTemplate\" [active]=\"active\" datoErrorValidationBorderAnchor tabindex=\"0\" [labelKey]=\"labelKey\"\n [context]=\"_model[0]\" [class.force-hide]=\"open && isCombo\" [placeholder]=\"placeholder | translate\"\n class=\"ontop-overlay\" (keydown)=\"preventBodyScroll($event)\" (keyup)=\"keyup($event)\" (click)=\"openDropdown()\">\n </dato-trigger-single>\n </div>\n\n <dato-trigger-multi [loadingTemplate]=\"loadingTemplate\" [options]=\"_model\" datoErrorValidationBorderAnchor [control]=\"searchControl\"\n [placeholder]=\"placeholder | translate\" [labelKey]=\"labelKey\" [idKey]=\"idKey\" (keyup)=\"keyup($event)\"\n [isLoading]=\"isLoading\" [keepFocus]=\"keepFocus\" [limitTo]=\"limitTo\" [clickOutside]=\"_clickOutside\" [isSortable]=\"isSortable\"\n [selectAllChipTxt]=\"selectAllChipTxt\"\n [showSelectAllChip]=\"selectAllChipTxt && showSelectAllChip\"\n (unselectAll)=\"checkAll(false)\"\n (removeOption)=\"removeOption($event)\" (reorderOptions)=\"reorderOptions($event)\" *ngIf=\"isMulti\"\n (click)=\"openDropdown($event)\"></dato-trigger-multi>\n\n</section>\n\n<ng-template #dropdown>\n <section class=\"dato-select__dropdown-container\" tabindex=\"0\" (keyup)=\"keyup($event)\">\n\n <!-- HEADER -->\n\n <header class=\"dato-select__header dato-select__option dato-select__option--simple\" data-is-floating\n *ngIf=\"isMulti && allowSelectAll\" [class.force-hide]=\"_showEmptyResults\" [class.ml-10]=\"containsGroups\">\n <dato-checkbox [checked]=\"_isAllChecked\" (check)=\"checkAll($event)\"\n [indeterminatelyChecked]=\"_isIndeterminatelyChecked\">\n {{'core.select-all' | translate}}<span class=\"primary-300-color note-italic ml-5\">{{_count}}</span>\n </dato-checkbox>\n </header>\n\n <!-- END HEADER -->\n\n <!-- DROPDOWN -->\n\n <div class=\"dato-select__dropdown\">\n\n <ng-content></ng-content>\n\n <dato-select-empty [show]=\"_showEmptyResults\">{{_noItemsLabel}}</dato-select-empty>\n <div class=\"dato-select__option dato-select-infinite-spinner\" data-is-floating *ngIf=\"infiniteScrollLoading\">\n <span class=\"dato-input__spinner\"></span>\n </div>\n\n </div>\n\n <!-- END DROPDOWN -->\n\n\n <!-- FOOTER -->\n\n <footer class=\"dato-select__footer d-flex\" [class.with-actions]=\"_withActions\">\n\n <ng-content select=\"[datoSelectFooter]\"></ng-content>\n\n <ng-container *ngIf=\"_withActions\">\n <dato-link class=\"mr-20\" datoType=\"secondary\" (click)=\"close()\">Cancel</dato-link>\n <dato-button datoSize=\"sm\" (click)=\"save.emit(); close();\">Save</dato-button>\n </ng-container>\n\n </footer>\n\n <!-- END FOOTER -->\n\n </section>\n\n</ng-template>\n",
9291
9383
  preserveWhitespaces: false,
9292
9384
  providers: [valueAccessor$3, DatoOverlay],
9293
9385
  encapsulation: ViewEncapsulation.None,
@@ -9305,88 +9397,6 @@ var DatoSelectComponent = /** @class */ (function (_super) {
9305
9397
  return DatoSelectComponent;
9306
9398
  }(BaseCustomControl));
9307
9399
 
9308
- /**
9309
- * @license
9310
- * Copyright Datorama. All Rights Reserved.
9311
- *
9312
- * Use of this source code is governed by an Apache License 2.0 license that can be
9313
- * found in the LICENSE file at https://github.com/datorama/client-core/blob/master/LICENSE
9314
- */
9315
- var DatoTriggerSingle = /** @class */ (function () {
9316
- function DatoTriggerSingle(cdr) {
9317
- this.cdr = cdr;
9318
- this._placeholder = '';
9319
- }
9320
- Object.defineProperty(DatoTriggerSingle.prototype, "placeholder", {
9321
- set: function (value) {
9322
- this._placeholder = value;
9323
- this.cdr.detectChanges();
9324
- },
9325
- enumerable: true,
9326
- configurable: true
9327
- });
9328
- Object.defineProperty(DatoTriggerSingle.prototype, "context", {
9329
- set: function (value) {
9330
- this._model = { $implicit: value };
9331
- this.cdr.detectChanges();
9332
- },
9333
- enumerable: true,
9334
- configurable: true
9335
- });
9336
- Object.defineProperty(DatoTriggerSingle.prototype, "hidePlaceholder", {
9337
- get: function () {
9338
- return !this._model || !this._model.$implicit;
9339
- },
9340
- enumerable: true,
9341
- configurable: true
9342
- });
9343
- DatoTriggerSingle.prototype.ngOnInit = function () {
9344
- this.cdr.detach();
9345
- };
9346
- Object.defineProperty(DatoTriggerSingle.prototype, "getLabel", {
9347
- get: function () {
9348
- return this._model && this._model.$implicit && this._model.$implicit[this.labelKey];
9349
- },
9350
- enumerable: true,
9351
- configurable: true
9352
- });
9353
- DatoTriggerSingle.ctorParameters = function () { return [
9354
- { type: ChangeDetectorRef }
9355
- ]; };
9356
- __decorate([
9357
- Input(),
9358
- __metadata("design:type", TemplateRef)
9359
- ], DatoTriggerSingle.prototype, "loadingTemplate", void 0);
9360
- __decorate([
9361
- Input(),
9362
- __metadata("design:type", DatoSelectActiveDirective)
9363
- ], DatoTriggerSingle.prototype, "active", void 0);
9364
- __decorate([
9365
- Input(),
9366
- __metadata("design:type", Object),
9367
- __metadata("design:paramtypes", [Object])
9368
- ], DatoTriggerSingle.prototype, "placeholder", null);
9369
- __decorate([
9370
- Input(),
9371
- __metadata("design:type", String)
9372
- ], DatoTriggerSingle.prototype, "labelKey", void 0);
9373
- __decorate([
9374
- Input(),
9375
- __metadata("design:type", Object),
9376
- __metadata("design:paramtypes", [Object])
9377
- ], DatoTriggerSingle.prototype, "context", null);
9378
- DatoTriggerSingle = __decorate([
9379
- Component({
9380
- selector: 'dato-trigger-single',
9381
- template: "<ng-template *ngIf=\"loadingTemplate\" [ngTemplateOutlet]=\"loadingTemplate\"></ng-template>\n<ng-container\n *ngIf=\"active && !hidePlaceholder\"\n [ngTemplateOutlet]=\"active.tpl\"\n [ngTemplateOutletContext]=\"_model\">\n</ng-container>\n<ng-container *ngIf=\"!active\">{{getLabel | translate}}</ng-container>\n<span class=\"dato-select__placeholder\" *ngIf=\"hidePlaceholder\">{{_placeholder}}</span>\n<dato-icon datoIcon=\"arrow-down\" datoSize=\"sm\" class=\"dato-select__single__arrow\"></dato-icon>\n",
9382
- changeDetection: ChangeDetectionStrategy.OnPush,
9383
- styles: [":host{display:block;position:relative;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host dato-icon{position:absolute;top:50%;transform:translateY(-50%);right:10px}"]
9384
- }),
9385
- __metadata("design:paramtypes", [ChangeDetectorRef])
9386
- ], DatoTriggerSingle);
9387
- return DatoTriggerSingle;
9388
- }());
9389
-
9390
9400
  /**
9391
9401
  * @license
9392
9402
  * Copyright Datorama. All Rights Reserved.
@@ -15455,7 +15465,7 @@ var DatoGridControllerComponent = /** @class */ (function () {
15455
15465
  });
15456
15466
  DatoGridControllerComponent.prototype.ngOnDestroy = function () {
15457
15467
  this.contentInit.complete();
15458
- this.tooltip && this.clearTooltip();
15468
+ this.clearTooltip();
15459
15469
  this.rowHoverComponent && this.rowHoverComponent.destroy();
15460
15470
  this.rowHoverComponent = null;
15461
15471
  };
@@ -15682,40 +15692,51 @@ var DatoGridControllerComponent = /** @class */ (function () {
15682
15692
  });
15683
15693
  this.addOnHoverElement();
15684
15694
  }
15685
- agGrid.cellMouseOver
15686
- .pipe(filter$1(function (_a) {
15687
- var node = _a.node, column = _a.column;
15688
- return lastHoveredCell !== node.id + "-" + column.getColId();
15689
- }), untilDestroyed(this))
15690
- .subscribe(function (event) {
15691
- lastHoveredCell = event.node.id + "-" + event.column.getColId();
15695
+ agGrid.cellMouseOver.pipe(untilDestroyed(this)).subscribe(function (event) {
15696
+ var node = event.node, column = event.column;
15697
+ if (lastHoveredCell === node.id + "-" + column.getColId()) {
15698
+ clearTimeout(_this.cellMouseOutTimer);
15699
+ return;
15700
+ }
15701
+ lastHoveredCell = node.id + "-" + column.getColId();
15692
15702
  _this.showTooltip(event);
15693
15703
  var row = event.event.target.parentElement;
15694
- if (onHoverEnabled && (event.node.group === false || isNil(event.node.group)) && _this.lastHoveredRow !== row) {
15704
+ if (onHoverEnabled && (node.group === false || isNil(node.group)) && _this.lastHoveredRow !== row) {
15695
15705
  var previousNode = _this.lastHoveredRow;
15696
15706
  _this.lastHoveredRow = row;
15697
15707
  _this.toggleRowHoverClass([previousNode, _this.lastHoveredRow]);
15698
15708
  _this.setOnHoverState(true, event);
15699
15709
  }
15700
15710
  });
15701
- var onTooltipOut = merge$1(fromEvent(bodyViewport, 'scroll'), fromEvent(this.agGridEl, 'mouseleave'), agGrid.cellMouseOut);
15702
- onTooltipOut
15711
+ var onTooltipOut = merge$1(fromEvent(bodyViewport, 'scroll'), fromEvent(this.agGridEl, 'mouseleave'));
15712
+ onTooltipOut.pipe(untilDestroyed(this)).subscribe(function () {
15713
+ lastHoveredCell = null;
15714
+ _this.clearTooltip();
15715
+ });
15716
+ agGrid.cellMouseOut
15703
15717
  .pipe(filter$1(function () { return !isNil(_this.tooltip); }), untilDestroyed(this))
15704
15718
  .subscribe(function () {
15705
- _this.clearTooltip();
15719
+ _this.cellMouseOutTimer = window.setTimeout(function () { return _this.clearTooltip(); });
15706
15720
  });
15707
15721
  };
15708
15722
  /**
15709
15723
  * Dispose the tooltip
15710
15724
  */
15711
15725
  DatoGridControllerComponent.prototype.clearTooltip = function () {
15712
- this.tooltip.dispose();
15726
+ this.tooltip && this.tooltip.dispose();
15713
15727
  this.tooltip = null;
15714
15728
  };
15715
15729
  DatoGridControllerComponent.prototype.showTooltip = function (event) {
15716
15730
  var cell = event.event.target;
15731
+ if (cell.tagName === 'SPAN' && cell.scrollWidth === 0) {
15732
+ cell = cell.parentElement;
15733
+ }
15734
+ if (event.colDef.editable) {
15735
+ cell = cell.querySelector('.value-wrapper') || cell;
15736
+ }
15717
15737
  var textOverflow = cell.offsetWidth < cell.scrollWidth;
15718
15738
  if (textOverflow) {
15739
+ clearTimeout(this.cellMouseOutTimer);
15719
15740
  var params = { cell: cell, value: cell.innerText };
15720
15741
  isNil(this.tooltip) ? this.createAndShowTooltip(params) : this.updateTooltip(params);
15721
15742
  }