@datorama/core 22.0.3 → 22.0.4-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.
Files changed (41) hide show
  1. package/bundles/datorama-core.umd.js +99 -56
  2. package/bundles/datorama-core.umd.js.map +1 -1
  3. package/bundles/datorama-core.umd.min.js +14 -14
  4. package/bundles/datorama-core.umd.min.js.map +1 -1
  5. package/datorama-core.d.ts +1 -0
  6. package/datorama-core.metadata.json +1 -1
  7. package/esm2015/datorama-core.js +2 -1
  8. package/esm2015/lib/breadcrumbs/breadcrumbs.component.js +4 -2
  9. package/esm2015/lib/grid-v2/grid/grid-v2.types.js +1 -1
  10. package/esm2015/lib/grid-v2/grid-controller/grid-controller.component.js +5 -2
  11. package/esm2015/lib/grid-v2/grid-settings.js +2 -2
  12. package/esm2015/lib/grid-v2/grid-store/grid.service.js +3 -2
  13. package/esm2015/lib/grid-v2/grid-toolbar/grid-toolbar.component.js +7 -1
  14. package/esm2015/lib/progress-bar/progress-bar.component.js +26 -13
  15. package/esm2015/lib/rich-text/rich-text.directive.js +15 -33
  16. package/esm2015/lib/rich-text/rich-text.service.js +50 -0
  17. package/esm2015/lib/select/select.component.js +5 -10
  18. package/esm2015/lib/version.js +2 -2
  19. package/esm5/datorama-core.js +2 -1
  20. package/esm5/lib/breadcrumbs/breadcrumbs.component.js +4 -2
  21. package/esm5/lib/grid-v2/grid/grid-v2.types.js +1 -1
  22. package/esm5/lib/grid-v2/grid-controller/grid-controller.component.js +5 -2
  23. package/esm5/lib/grid-v2/grid-settings.js +2 -2
  24. package/esm5/lib/grid-v2/grid-store/grid.service.js +3 -2
  25. package/esm5/lib/grid-v2/grid-toolbar/grid-toolbar.component.js +13 -1
  26. package/esm5/lib/progress-bar/progress-bar.component.js +26 -13
  27. package/esm5/lib/rich-text/rich-text.directive.js +16 -34
  28. package/esm5/lib/rich-text/rich-text.service.js +51 -0
  29. package/esm5/lib/select/select.component.js +5 -10
  30. package/esm5/lib/version.js +2 -2
  31. package/fesm2015/datorama-core.js +91 -56
  32. package/fesm2015/datorama-core.js.map +1 -1
  33. package/fesm5/datorama-core.js +99 -57
  34. package/fesm5/datorama-core.js.map +1 -1
  35. package/lib/grid-v2/grid/grid-v2.types.d.ts +1 -0
  36. package/lib/grid-v2/grid-settings.d.ts +2 -2
  37. package/lib/grid-v2/grid-toolbar/grid-toolbar.component.d.ts +2 -0
  38. package/lib/progress-bar/progress-bar.component.d.ts +6 -2
  39. package/lib/rich-text/rich-text.directive.d.ts +4 -6
  40. package/lib/rich-text/rich-text.service.d.ts +10 -0
  41. package/package.json +2 -2
@@ -8629,9 +8629,8 @@
8629
8629
  DatoSelectComponent.prototype.writeValue = function (activeOptions) {
8630
8630
  this._model = activeOptions ? akita.coerceArray(activeOptions) : [];
8631
8631
  if (this.options) {
8632
- var overTheLimit = this.limitSelectedTo && this.isMulti && this._model.length >= this.limitSelectedTo;
8633
8632
  this.markAsActive(this._model, { deselectAll: true });
8634
- overTheLimit && this.updateDisabledState();
8633
+ this.limitSelectedTo && this.updateDisabledState();
8635
8634
  }
8636
8635
  /** For later updates */
8637
8636
  this.cdr.markForCheck();
@@ -8668,7 +8667,7 @@
8668
8667
  */
8669
8668
  if (this.hasValue && this._initialOpen) {
8670
8669
  this.markAsActive(this._model);
8671
- if (this.limitSelectedTo && this._model.length === this.limitSelectedTo) {
8670
+ if (this.limitSelectedTo) {
8672
8671
  this.updateDisabledState();
8673
8672
  }
8674
8673
  this._initialOpen = false;
@@ -8757,7 +8756,6 @@
8757
8756
  };
8758
8757
  DatoSelectComponent.prototype.removeOption = function (option) {
8759
8758
  var _this = this;
8760
- var updateDisabled = this.limitSelectedTo && this._model.length === this.limitSelectedTo;
8761
8759
  this._model = this._model.filter(function (current) { return current[_this.idKey] !== option[_this.idKey]; });
8762
8760
  var optionToRemove = this.options.find(function (datoOption) { return datoOption.option && datoOption.option[_this.idKey] === option[_this.idKey]; });
8763
8761
  /**
@@ -8767,7 +8765,7 @@
8767
8765
  if (optionToRemove) {
8768
8766
  optionToRemove.active = false;
8769
8767
  }
8770
- updateDisabled && this.updateDisabledState();
8768
+ this.limitSelectedTo && this.updateDisabledState();
8771
8769
  this.onChange(this._model);
8772
8770
  this.cdr.markForCheck();
8773
8771
  if (this.datoOverlay.attached) {
@@ -9117,9 +9115,6 @@
9117
9115
  if (!datoOption) {
9118
9116
  return;
9119
9117
  }
9120
- var modelLength = this._model.length;
9121
- var updateDisabled = this.limitSelectedTo &&
9122
- (modelLength === this.limitSelectedTo || (modelLength === this.limitSelectedTo - 1 && !datoOption.active));
9123
9118
  datoOption.active = !datoOption.active;
9124
9119
  var rawOption = datoOption.option;
9125
9120
  if (datoOption.active) {
@@ -9128,7 +9123,7 @@
9128
9123
  else {
9129
9124
  this._model = this._model.filter(function (current) { return current[_this.idKey] !== rawOption[_this.idKey]; });
9130
9125
  }
9131
- updateDisabled && this.updateDisabledState();
9126
+ this.limitSelectedTo && this.updateDisabledState();
9132
9127
  this.onChange(this._model);
9133
9128
  this.cdr.markForCheck();
9134
9129
  this.datoOverlay.scheduleUpdate();
@@ -12015,7 +12010,7 @@
12015
12010
  return contextActions;
12016
12011
  }
12017
12012
 
12018
- var DATO_GRID_STORAGE_API = new core.InjectionToken('DATO_GRID_STORAGE_API');
12013
+ var DATO_GRID_STORAGE_API = new core.InjectionToken('DATO_GRID_STORAGE_AP');
12019
12014
 
12020
12015
  var defaultEditableColumnRenderer = function (params) {
12021
12016
  return params && params.value ? "<div class=\"value-wrapper ellipsis\">" + params.value + "</div>" : null;
@@ -14466,7 +14461,8 @@
14466
14461
  this.updateSettings({ gridAlignment: gridAlignment, columnsSizes: null });
14467
14462
  };
14468
14463
  GridService.prototype.saveSettingsToServer = function (settings) {
14469
- this.storageAPI.set(this.gridName, settings);
14464
+ var isGlobal = this.gridQuery.getGridOptions().isGlobalSettings;
14465
+ this.storageAPI.set(this.gridName, settings, isGlobal);
14470
14466
  };
14471
14467
  /**
14472
14468
  * @internal used to log grid events to the platform's logging service
@@ -15464,7 +15460,10 @@
15464
15460
  .pipe(operators.switchMap(function () {
15465
15461
  _this.gridOptions = _this.normalizeOptions();
15466
15462
  agGrid.gridOptions = _this.gridOptions;
15467
- var settingsLoader = _this.gridOptions.saveSettings === false ? rxjs.of(null) : _this.storageAPI.get(_this.gridOptions.gridName);
15463
+ var isGlobal = _this.gridOptions.isGlobalSettings;
15464
+ var settingsLoader = _this.gridOptions.saveSettings === false
15465
+ ? rxjs.of(null)
15466
+ : _this.storageAPI.get(_this.gridOptions.gridName, isGlobal);
15468
15467
  return rxjs.combineLatest([agGrid.gridReady, settingsLoader]);
15469
15468
  }), ngxTakeUntilDestroy.untilDestroyed(this))
15470
15469
  .subscribe(function (_a) {
@@ -16739,6 +16738,18 @@
16739
16738
  this.registerGroupListeners();
16740
16739
  this.subscribeRowsSelectionData();
16741
16740
  };
16741
+ DatoGridV2ToolbarComponent.prototype.getCellValueChangeEvent = function () {
16742
+ var _this = this;
16743
+ return this.gridController.gridQuery.waitForGrid(function () {
16744
+ return _this.gridQuery.gridRef.cellValueChanged.pipe(operators.debounceTime(100), ngxTakeUntilDestroy.untilDestroyed(_this));
16745
+ });
16746
+ };
16747
+ DatoGridV2ToolbarComponent.prototype.getRowDataUpdatedEvent = function () {
16748
+ var _this = this;
16749
+ return this.gridController.gridQuery.waitForGrid(function () {
16750
+ return _this.gridQuery.gridRef.rowDataUpdated.pipe(operators.debounceTime(100), ngxTakeUntilDestroy.untilDestroyed(_this));
16751
+ });
16752
+ };
16742
16753
  DatoGridV2ToolbarComponent.prototype.onActionClick = function (action) {
16743
16754
  if (isFunction(action.onClick)) {
16744
16755
  var selectedRowsCount = this.gridController.gridQuery.getSelectedRowsCount();
@@ -21214,6 +21225,40 @@
21214
21225
  * found in the LICENSE file at https://github.com/datorama/client-core/blob/master/LICENSE
21215
21226
  */
21216
21227
 
21228
+ var RichTextService = /** @class */ (function () {
21229
+ function RichTextService(http, config) {
21230
+ this.http = http;
21231
+ this.config = config;
21232
+ }
21233
+ RichTextService.prototype.getLib = function (appendScriptFunc, appendStyleFunc) {
21234
+ if (!this.richTextScript$) {
21235
+ this.initLib(appendScriptFunc, appendStyleFunc);
21236
+ }
21237
+ return this.richTextScript$;
21238
+ };
21239
+ RichTextService.prototype.initLib = function (appendScriptFunc, appendStyleFunc) {
21240
+ this.richTextScript$ = rxjs.combineLatest([
21241
+ this.http
21242
+ .get(this.config.paths.richText + "/index.js", { responseType: 'text' })
21243
+ .pipe(operators.tap(function (lib) { return appendScriptFunc(lib, 'rich-text-editor'); })),
21244
+ this.http
21245
+ .get(this.config.paths.richText + "/plugins/autocomplete/plugin.css", { responseType: 'text' })
21246
+ .pipe(operators.tap(function (style) { return appendStyleFunc(style, 'tinymce-autocomplete'); }))
21247
+ ]).pipe(operators.shareReplay(1));
21248
+ };
21249
+ RichTextService.ctorParameters = function () { return [
21250
+ { type: http.HttpClient },
21251
+ { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] }
21252
+ ]; };
21253
+ RichTextService.ɵprov = core.ɵɵdefineInjectable({ factory: function RichTextService_Factory() { return new RichTextService(core.ɵɵinject(http.HttpClient), core.ɵɵinject(DATO_CORE_CONFIG)); }, token: RichTextService, providedIn: "root" });
21254
+ RichTextService = __decorate([
21255
+ core.Injectable({ providedIn: 'root' }),
21256
+ __param(1, core.Inject(DATO_CORE_CONFIG)),
21257
+ __metadata("design:paramtypes", [http.HttpClient, Object])
21258
+ ], RichTextService);
21259
+ return RichTextService;
21260
+ }());
21261
+
21217
21262
  /**
21218
21263
  * @license
21219
21264
  * Copyright Datorama. All Rights Reserved.
@@ -21227,12 +21272,12 @@
21227
21272
  var ɵ0$3 = getTinymce;
21228
21273
  var DatoRichTextDirective = /** @class */ (function (_super) {
21229
21274
  __extends(DatoRichTextDirective, _super);
21230
- function DatoRichTextDirective(ngZone, http, host, config) {
21275
+ function DatoRichTextDirective(ngZone, richTextService, config, host) {
21231
21276
  var _this = _super.call(this) || this;
21232
21277
  _this.ngZone = ngZone;
21233
- _this.http = http;
21234
- _this.host = host;
21278
+ _this.richTextService = richTextService;
21235
21279
  _this.config = config;
21280
+ _this.host = host;
21236
21281
  _this.autocompleteOptions = {};
21237
21282
  _this.forcePlainTextPasting = false;
21238
21283
  _this.format = 'html';
@@ -21266,28 +21311,11 @@
21266
21311
  base: this.config.paths.richText,
21267
21312
  query: ''
21268
21313
  };
21269
- /**
21270
- * We support only one instance in load time
21271
- */
21272
- if (window.tinymce) {
21273
- this.init.call(this);
21274
- }
21275
- else {
21276
- this.loadLib().subscribe(function (lib) {
21277
- appendScript(lib, 'rich-text-editor');
21278
- _this.init.call(_this);
21279
- _this.loadAutoCompleteStyle();
21280
- });
21281
- }
21282
- };
21283
- DatoRichTextDirective.prototype.loadLib = function () {
21284
- return this.http.get(this.config.paths.richText + "/index.js", { responseType: 'text' });
21285
- };
21286
- DatoRichTextDirective.prototype.loadAutoCompleteStyle = function () {
21287
- this.http
21288
- .get(this.config.paths.richText + "/plugins/autocomplete/plugin.css", { responseType: 'text' })
21289
- .subscribe(function (style) {
21290
- appendStyle(style, 'tinymce-autocomplete');
21314
+ this.richTextService
21315
+ .getLib(appendScript, appendStyle)
21316
+ .pipe(ngxTakeUntilDestroy.untilDestroyed(this))
21317
+ .subscribe(function () {
21318
+ _this.init.call(_this);
21291
21319
  });
21292
21320
  };
21293
21321
  DatoRichTextDirective.prototype.initEditor = function (_, editor) {
@@ -21380,9 +21408,9 @@
21380
21408
  var DatoRichTextDirective_1;
21381
21409
  DatoRichTextDirective.ctorParameters = function () { return [
21382
21410
  { type: core.NgZone },
21383
- { type: http.HttpClient },
21384
- { type: core.ElementRef },
21385
- { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] }
21411
+ { type: RichTextService },
21412
+ { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] },
21413
+ { type: core.ElementRef }
21386
21414
  ]; };
21387
21415
  __decorate([
21388
21416
  core.Input(),
@@ -21448,10 +21476,9 @@
21448
21476
  }
21449
21477
  ]
21450
21478
  }),
21451
- __param(3, core.Inject(DATO_CORE_CONFIG)),
21479
+ __param(2, core.Inject(DATO_CORE_CONFIG)),
21452
21480
  __metadata("design:paramtypes", [core.NgZone,
21453
- http.HttpClient,
21454
- core.ElementRef, Object])
21481
+ RichTextService, Object, core.ElementRef])
21455
21482
  ], DatoRichTextDirective);
21456
21483
  return DatoRichTextDirective;
21457
21484
  }(BaseCustomControl));
@@ -23974,7 +24001,9 @@
23974
24001
  };
23975
24002
  DatoBreadcrumbsComponent.prototype.initEditableHeader = function () {
23976
24003
  var _this = this;
23977
- this.headerControl.valueChanges.pipe(operators.debounceTime(300), ngxTakeUntilDestroy.untilDestroyed(this)).subscribe(function (res) {
24004
+ this.headerControl.valueChanges
24005
+ .pipe(operators.debounceTime(300), ngxTakeUntilDestroy.untilDestroyed(this))
24006
+ .subscribe(function (res) {
23978
24007
  _this.updateEditableText.emit(res);
23979
24008
  _this.cdr.detectChanges();
23980
24009
  });
@@ -24669,16 +24698,9 @@
24669
24698
  }
24670
24699
  DatoProgressBarComponent.prototype.ngOnInit = function () {
24671
24700
  if (!this.parts && this.percent) {
24672
- if (!this.color) {
24673
- this.initColor();
24674
- }
24675
- this.parts = [
24676
- {
24677
- percent: this.percent,
24678
- color: this.color,
24679
- tooltip: this.tooltip
24680
- }
24681
- ];
24701
+ this.isByPercent = true;
24702
+ this.hasInitialColor = !!this.color;
24703
+ this.initSinglePart();
24682
24704
  }
24683
24705
  else if (this.parts &&
24684
24706
  this.parts.every(function (part) { return part.weight >= 0; }) &&
@@ -24686,6 +24708,26 @@
24686
24708
  this.initPartsPercent();
24687
24709
  }
24688
24710
  };
24711
+ DatoProgressBarComponent.prototype.ngOnChanges = function (changes) {
24712
+ if (this.isByPercent &&
24713
+ ((changes.percent && !changes.percent.firstChange) ||
24714
+ (changes.color && !changes.color.firstChange) ||
24715
+ (changes.tooltip && !changes.tooltip.firstChange))) {
24716
+ this.initSinglePart();
24717
+ }
24718
+ };
24719
+ DatoProgressBarComponent.prototype.initSinglePart = function () {
24720
+ if (!this.color || !this.hasInitialColor) {
24721
+ this.initColor();
24722
+ }
24723
+ this.parts = [
24724
+ {
24725
+ percent: this.percent,
24726
+ color: this.color,
24727
+ tooltip: this.tooltip
24728
+ }
24729
+ ];
24730
+ };
24689
24731
  DatoProgressBarComponent.prototype.initColor = function () {
24690
24732
  if (isEmpty(this.thresholds)) {
24691
24733
  this.color = 'accent-400';
@@ -24761,7 +24803,7 @@
24761
24803
  DatoProgressBarComponent = __decorate([
24762
24804
  core.Component({
24763
24805
  selector: 'dato-progress-bar',
24764
- template: "<div class=\"bar d-flex width-100 overflow-hidden\"\n [style.width]=\"width\"\n [class]=\"barColor + '-background-color'\">\n <div *ngFor=\"let part of parts; index as i\"\n class=\"part height-100\"\n [ngClass]=\"part.color ? part.color + '-background-color' : ''\"\n [style.width]=\"i > 0 ? 'calc(' + part.percent + '% + 8px)' : part.percent + '%'\"\n [style.z-index]=\"100 - i\"\n [datoTooltipV2]=\"part.tooltip\">\n </div>\n</div>\n\n<div *ngIf=\"showLegend\" class=\"d-flex mt-12\">\n <div *ngFor=\"let part of parts; index as i\" class=\"d-flex mr-16\">\n <div class=\"d-flex dato-note primary-400-color\">\n <div class=\"legend-color mr-6\" [ngClass]=\"part.color ? part.color + '-background-color' : ''\"></div>\n <div>{{ part.legendLabel || part.tooltip }}</div>\n </div>\n </div>\n</div>\n",
24806
+ template: "<div class=\"bar d-flex width-100 overflow-hidden\"\n [style.width]=\"width\"\n [class]=\"barColor + '-background-color'\">\n <div *ngFor=\"let part of parts; index as i\"\n class=\"part height-100\"\n [ngClass]=\"part.color ? part.color + '-background-color' : ''\"\n [style.width]=\"i > 0 ? 'calc(' + part.percent + '% + 8px)' : part.percent + '%'\"\n [style.z-index]=\"100 - i\"\n [datoTooltipV2]=\"part.tooltip\">\n </div>\n</div>\n\n<ng-content></ng-content>\n\n<div *ngIf=\"showLegend\" class=\"d-flex mt-12\">\n <div *ngFor=\"let part of parts; index as i\" class=\"d-flex mr-16\">\n <div class=\"d-flex dato-note primary-400-color\">\n <div class=\"legend-color mr-6\" [ngClass]=\"part.color ? part.color + '-background-color' : ''\"></div>\n <div>{{ part.legendLabel || part.tooltip }}</div>\n </div>\n </div>\n</div>\n",
24765
24807
  changeDetection: core.ChangeDetectionStrategy.OnPush,
24766
24808
  encapsulation: core.ViewEncapsulation.None,
24767
24809
  styles: ["dato-progress-bar .bar{height:8px;border-radius:4px}dato-progress-bar .part{border-radius:0 4px 4px 0}dato-progress-bar .part:not(:first-child){margin-left:-8px}dato-progress-bar .legend-color{width:16px;height:16px;min-width:16px;border-radius:50%}"]
@@ -25317,7 +25359,7 @@
25317
25359
  };
25318
25360
  }
25319
25361
 
25320
- window.coreVersion = '22.0.3';
25362
+ window.coreVersion = '22.1.3-rc.';
25321
25363
 
25322
25364
  exports.APP_TRANSLATE = APP_TRANSLATE;
25323
25365
  exports.AceService = AceService;
@@ -25759,6 +25801,7 @@
25759
25801
  exports.ɵl = DatoGridItemsCountCellComponent;
25760
25802
  exports.ɵm = DatoGridV2ToolbarMoreMenuComponent;
25761
25803
  exports.ɵn = DatoGridSearchBarComponent;
25804
+ exports.ɵo = RichTextService;
25762
25805
 
25763
25806
  Object.defineProperty(exports, '__esModule', { value: true });
25764
25807