@datorama/core 22.8.1 → 22.9.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.
Files changed (38) hide show
  1. package/bundles/datorama-core.umd.js +83 -55
  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 +11 -12
  13. package/esm2015/lib/grid-v2/grid-toolbar/grid-toolbar.component.js +7 -1
  14. package/esm2015/lib/rich-text/rich-text.directive.js +15 -33
  15. package/esm2015/lib/rich-text/rich-text.service.js +50 -0
  16. package/esm2015/lib/select/select.component.js +5 -10
  17. package/esm2015/lib/version.js +2 -2
  18. package/esm5/datorama-core.js +2 -1
  19. package/esm5/lib/breadcrumbs/breadcrumbs.component.js +4 -2
  20. package/esm5/lib/grid-v2/grid/grid-v2.types.js +1 -1
  21. package/esm5/lib/grid-v2/grid-controller/grid-controller.component.js +5 -2
  22. package/esm5/lib/grid-v2/grid-settings.js +2 -2
  23. package/esm5/lib/grid-v2/grid-store/grid.service.js +11 -12
  24. package/esm5/lib/grid-v2/grid-toolbar/grid-toolbar.component.js +13 -1
  25. package/esm5/lib/rich-text/rich-text.directive.js +16 -34
  26. package/esm5/lib/rich-text/rich-text.service.js +51 -0
  27. package/esm5/lib/select/select.component.js +5 -10
  28. package/esm5/lib/version.js +2 -2
  29. package/fesm2015/datorama-core.js +75 -55
  30. package/fesm2015/datorama-core.js.map +1 -1
  31. package/fesm5/datorama-core.js +83 -56
  32. package/fesm5/datorama-core.js.map +1 -1
  33. package/lib/grid-v2/grid/grid-v2.types.d.ts +1 -0
  34. package/lib/grid-v2/grid-settings.d.ts +2 -2
  35. package/lib/grid-v2/grid-toolbar/grid-toolbar.component.d.ts +2 -0
  36. package/lib/rich-text/rich-text.directive.d.ts +4 -6
  37. package/lib/rich-text/rich-text.service.d.ts +10 -0
  38. package/package.json +1 -1
@@ -8748,9 +8748,8 @@
8748
8748
  DatoSelectComponent.prototype.writeValue = function (activeOptions) {
8749
8749
  this._model = activeOptions ? akita.coerceArray(activeOptions) : [];
8750
8750
  if (this.options) {
8751
- var overTheLimit = this.limitSelectedTo && this.isMulti && this._model.length >= this.limitSelectedTo;
8752
8751
  this.markAsActive(this._model, { deselectAll: true });
8753
- overTheLimit && this.updateDisabledState();
8752
+ this.limitSelectedTo && this.updateDisabledState();
8754
8753
  }
8755
8754
  /** For later updates */
8756
8755
  this.cdr.markForCheck();
@@ -8787,7 +8786,7 @@
8787
8786
  */
8788
8787
  if (this.hasValue && this._initialOpen) {
8789
8788
  this.markAsActive(this._model);
8790
- if (this.limitSelectedTo && this._model.length === this.limitSelectedTo) {
8789
+ if (this.limitSelectedTo) {
8791
8790
  this.updateDisabledState();
8792
8791
  }
8793
8792
  this._initialOpen = false;
@@ -8876,7 +8875,6 @@
8876
8875
  };
8877
8876
  DatoSelectComponent.prototype.removeOption = function (option) {
8878
8877
  var _this = this;
8879
- var updateDisabled = this.limitSelectedTo && this._model.length === this.limitSelectedTo;
8880
8878
  this._model = this._model.filter(function (current) { return current[_this.idKey] !== option[_this.idKey]; });
8881
8879
  var optionToRemove = this.options.find(function (datoOption) { return datoOption.option && datoOption.option[_this.idKey] === option[_this.idKey]; });
8882
8880
  /**
@@ -8886,7 +8884,7 @@
8886
8884
  if (optionToRemove) {
8887
8885
  optionToRemove.active = false;
8888
8886
  }
8889
- updateDisabled && this.updateDisabledState();
8887
+ this.limitSelectedTo && this.updateDisabledState();
8890
8888
  this.onChange(this._model);
8891
8889
  this.cdr.markForCheck();
8892
8890
  this.asyncUpdateDropdownPosition();
@@ -9234,9 +9232,6 @@
9234
9232
  if (!datoOption) {
9235
9233
  return;
9236
9234
  }
9237
- var modelLength = this._model.length;
9238
- var updateDisabled = this.limitSelectedTo &&
9239
- (modelLength === this.limitSelectedTo || (modelLength === this.limitSelectedTo - 1 && !datoOption.active));
9240
9235
  datoOption.active = !datoOption.active;
9241
9236
  var rawOption = datoOption.option;
9242
9237
  if (datoOption.active) {
@@ -9245,7 +9240,7 @@
9245
9240
  else {
9246
9241
  this._model = this._model.filter(function (current) { return current[_this.idKey] !== rawOption[_this.idKey]; });
9247
9242
  }
9248
- updateDisabled && this.updateDisabledState();
9243
+ this.limitSelectedTo && this.updateDisabledState();
9249
9244
  this.onChange(this._model);
9250
9245
  this.cdr.markForCheck();
9251
9246
  this.asyncUpdateDropdownPosition();
@@ -12050,7 +12045,7 @@
12050
12045
  return contextActions;
12051
12046
  }
12052
12047
 
12053
- var DATO_GRID_STORAGE_API = new core.InjectionToken('DATO_GRID_STORAGE_API');
12048
+ var DATO_GRID_STORAGE_API = new core.InjectionToken('DATO_GRID_STORAGE_AP');
12054
12049
 
12055
12050
  var defaultEditableColumnRenderer = function (params) {
12056
12051
  return params && params.value ? "<div class=\"value-wrapper ellipsis\">" + params.value + "</div>" : null;
@@ -14482,7 +14477,14 @@
14482
14477
  var gridColumns = this.api.columns.getAllGridColumns();
14483
14478
  if (gridColumns) {
14484
14479
  var sortToApply = gridSort;
14485
- if (!isNil(sortIndex)) {
14480
+ /** Sort by column id */
14481
+ var columnById = gridColumns.find(function (col) {
14482
+ return (col.getColDef().showRowGroup || col.getColId()) === colId_1;
14483
+ });
14484
+ if (columnById) {
14485
+ sortToApply = { colId: columnById.getColId(), sort: sort };
14486
+ }
14487
+ else if (!isNil(sortIndex)) {
14486
14488
  var valueColumns = this.api.columns.getValueColumns();
14487
14489
  var valueColumn = valueColumns.find(function (col) { return col.getColId() === colId_1; });
14488
14490
  var isPivotColId = colId_1.startsWith('pivot');
@@ -14492,15 +14494,6 @@
14492
14494
  sortToApply = { colId: columnByIndex.getColId(), sort: sort, sortIndex: sortIndex };
14493
14495
  }
14494
14496
  }
14495
- else {
14496
- /** Sort by column id */
14497
- var columnById = gridColumns.find(function (col) {
14498
- return (col.getColDef().showRowGroup || col.getColId()) === colId_1;
14499
- });
14500
- if (columnById) {
14501
- sortToApply = { colId: columnById.getColId(), sort: sort };
14502
- }
14503
- }
14504
14497
  this.updateSettings({ sort: sortToApply });
14505
14498
  this.api.grid.setSortModel([sortToApply]);
14506
14499
  }
@@ -14561,7 +14554,8 @@
14561
14554
  this.updateSettings({ gridAlignment: gridAlignment, columnsSizes: null });
14562
14555
  };
14563
14556
  GridService.prototype.saveSettingsToServer = function (settings) {
14564
- this.storageAPI.set(this.gridName, settings);
14557
+ var isGlobal = this.gridQuery.getGridOptions().isGlobalSettings;
14558
+ this.storageAPI.set(this.gridName, settings, isGlobal);
14565
14559
  };
14566
14560
  /**
14567
14561
  * @internal used to log grid events to the platform's logging service
@@ -15566,7 +15560,10 @@
15566
15560
  .pipe(operators.switchMap(function () {
15567
15561
  _this.gridOptions = _this.normalizeOptions();
15568
15562
  agGrid.gridOptions = _this.gridOptions;
15569
- var settingsLoader = _this.gridOptions.saveSettings === false ? rxjs.of(null) : _this.storageAPI.get(_this.gridOptions.gridName);
15563
+ var isGlobal = _this.gridOptions.isGlobalSettings;
15564
+ var settingsLoader = _this.gridOptions.saveSettings === false
15565
+ ? rxjs.of(null)
15566
+ : _this.storageAPI.get(_this.gridOptions.gridName, isGlobal);
15570
15567
  return rxjs.combineLatest([agGrid.gridReady, settingsLoader]);
15571
15568
  }), ngxTakeUntilDestroy.untilDestroyed(this))
15572
15569
  .subscribe(function (_a) {
@@ -16848,6 +16845,18 @@
16848
16845
  this.registerGroupListeners();
16849
16846
  this.subscribeRowsSelectionData();
16850
16847
  };
16848
+ DatoGridV2ToolbarComponent.prototype.getCellValueChangeEvent = function () {
16849
+ var _this = this;
16850
+ return this.gridController.gridQuery.waitForGrid(function () {
16851
+ return _this.gridQuery.gridRef.cellValueChanged.pipe(operators.debounceTime(100), ngxTakeUntilDestroy.untilDestroyed(_this));
16852
+ });
16853
+ };
16854
+ DatoGridV2ToolbarComponent.prototype.getRowDataUpdatedEvent = function () {
16855
+ var _this = this;
16856
+ return this.gridController.gridQuery.waitForGrid(function () {
16857
+ return _this.gridQuery.gridRef.rowDataUpdated.pipe(operators.debounceTime(100), ngxTakeUntilDestroy.untilDestroyed(_this));
16858
+ });
16859
+ };
16851
16860
  DatoGridV2ToolbarComponent.prototype.onActionClick = function (action) {
16852
16861
  if (isFunction(action.onClick)) {
16853
16862
  var selectedRowsCount = this.gridController.gridQuery.getSelectedRowsCount();
@@ -21323,6 +21332,40 @@
21323
21332
  * found in the LICENSE file at https://github.com/datorama/client-core/blob/master/LICENSE
21324
21333
  */
21325
21334
 
21335
+ var RichTextService = /** @class */ (function () {
21336
+ function RichTextService(http, config) {
21337
+ this.http = http;
21338
+ this.config = config;
21339
+ }
21340
+ RichTextService.prototype.getLib = function (appendScriptFunc, appendStyleFunc) {
21341
+ if (!this.richTextScript$) {
21342
+ this.initLib(appendScriptFunc, appendStyleFunc);
21343
+ }
21344
+ return this.richTextScript$;
21345
+ };
21346
+ RichTextService.prototype.initLib = function (appendScriptFunc, appendStyleFunc) {
21347
+ this.richTextScript$ = rxjs.combineLatest([
21348
+ this.http
21349
+ .get(this.config.paths.richText + "/index.js", { responseType: 'text' })
21350
+ .pipe(operators.tap(function (lib) { return appendScriptFunc(lib, 'rich-text-editor'); })),
21351
+ this.http
21352
+ .get(this.config.paths.richText + "/plugins/autocomplete/plugin.css", { responseType: 'text' })
21353
+ .pipe(operators.tap(function (style) { return appendStyleFunc(style, 'tinymce-autocomplete'); }))
21354
+ ]).pipe(operators.shareReplay(1));
21355
+ };
21356
+ RichTextService.ctorParameters = function () { return [
21357
+ { type: http.HttpClient },
21358
+ { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] }
21359
+ ]; };
21360
+ RichTextService.ɵprov = core.ɵɵdefineInjectable({ factory: function RichTextService_Factory() { return new RichTextService(core.ɵɵinject(http.HttpClient), core.ɵɵinject(DATO_CORE_CONFIG)); }, token: RichTextService, providedIn: "root" });
21361
+ RichTextService = __decorate([
21362
+ core.Injectable({ providedIn: 'root' }),
21363
+ __param(1, core.Inject(DATO_CORE_CONFIG)),
21364
+ __metadata("design:paramtypes", [http.HttpClient, Object])
21365
+ ], RichTextService);
21366
+ return RichTextService;
21367
+ }());
21368
+
21326
21369
  /**
21327
21370
  * @license
21328
21371
  * Copyright Datorama. All Rights Reserved.
@@ -21336,12 +21379,12 @@
21336
21379
  var ɵ0$3 = getTinymce;
21337
21380
  var DatoRichTextDirective = /** @class */ (function (_super) {
21338
21381
  __extends(DatoRichTextDirective, _super);
21339
- function DatoRichTextDirective(ngZone, http, host, config) {
21382
+ function DatoRichTextDirective(ngZone, richTextService, config, host) {
21340
21383
  var _this = _super.call(this) || this;
21341
21384
  _this.ngZone = ngZone;
21342
- _this.http = http;
21343
- _this.host = host;
21385
+ _this.richTextService = richTextService;
21344
21386
  _this.config = config;
21387
+ _this.host = host;
21345
21388
  _this.autocompleteOptions = {};
21346
21389
  _this.forcePlainTextPasting = false;
21347
21390
  _this.format = 'html';
@@ -21375,28 +21418,11 @@
21375
21418
  base: this.config.paths.richText,
21376
21419
  query: ''
21377
21420
  };
21378
- /**
21379
- * We support only one instance in load time
21380
- */
21381
- if (window.tinymce) {
21382
- this.init.call(this);
21383
- }
21384
- else {
21385
- this.loadLib().subscribe(function (lib) {
21386
- appendScript(lib, 'rich-text-editor');
21387
- _this.init.call(_this);
21388
- _this.loadAutoCompleteStyle();
21389
- });
21390
- }
21391
- };
21392
- DatoRichTextDirective.prototype.loadLib = function () {
21393
- return this.http.get(this.config.paths.richText + "/index.js", { responseType: 'text' });
21394
- };
21395
- DatoRichTextDirective.prototype.loadAutoCompleteStyle = function () {
21396
- this.http
21397
- .get(this.config.paths.richText + "/plugins/autocomplete/plugin.css", { responseType: 'text' })
21398
- .subscribe(function (style) {
21399
- appendStyle(style, 'tinymce-autocomplete');
21421
+ this.richTextService
21422
+ .getLib(appendScript, appendStyle)
21423
+ .pipe(ngxTakeUntilDestroy.untilDestroyed(this))
21424
+ .subscribe(function () {
21425
+ _this.init.call(_this);
21400
21426
  });
21401
21427
  };
21402
21428
  DatoRichTextDirective.prototype.initEditor = function (_, editor) {
@@ -21489,9 +21515,9 @@
21489
21515
  var DatoRichTextDirective_1;
21490
21516
  DatoRichTextDirective.ctorParameters = function () { return [
21491
21517
  { type: core.NgZone },
21492
- { type: http.HttpClient },
21493
- { type: core.ElementRef },
21494
- { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] }
21518
+ { type: RichTextService },
21519
+ { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] },
21520
+ { type: core.ElementRef }
21495
21521
  ]; };
21496
21522
  __decorate([
21497
21523
  core.Input(),
@@ -21557,10 +21583,9 @@
21557
21583
  }
21558
21584
  ]
21559
21585
  }),
21560
- __param(3, core.Inject(DATO_CORE_CONFIG)),
21586
+ __param(2, core.Inject(DATO_CORE_CONFIG)),
21561
21587
  __metadata("design:paramtypes", [core.NgZone,
21562
- http.HttpClient,
21563
- core.ElementRef, Object])
21588
+ RichTextService, Object, core.ElementRef])
21564
21589
  ], DatoRichTextDirective);
21565
21590
  return DatoRichTextDirective;
21566
21591
  }(BaseCustomControl));
@@ -24083,7 +24108,9 @@
24083
24108
  };
24084
24109
  DatoBreadcrumbsComponent.prototype.initEditableHeader = function () {
24085
24110
  var _this = this;
24086
- this.headerControl.valueChanges.pipe(operators.debounceTime(300), ngxTakeUntilDestroy.untilDestroyed(this)).subscribe(function (res) {
24111
+ this.headerControl.valueChanges
24112
+ .pipe(operators.debounceTime(300), ngxTakeUntilDestroy.untilDestroyed(this))
24113
+ .subscribe(function (res) {
24087
24114
  _this.updateEditableText.emit(res);
24088
24115
  _this.cdr.detectChanges();
24089
24116
  });
@@ -25446,7 +25473,7 @@
25446
25473
  };
25447
25474
  }
25448
25475
 
25449
- window.coreVersion = '22.8.1';
25476
+ window.coreVersion = '22.9.1-rc.';
25450
25477
 
25451
25478
  exports.APP_TRANSLATE = APP_TRANSLATE;
25452
25479
  exports.AceService = AceService;
@@ -25888,6 +25915,7 @@
25888
25915
  exports.ɵl = DatoGridItemsCountCellComponent;
25889
25916
  exports.ɵm = DatoGridV2ToolbarMoreMenuComponent;
25890
25917
  exports.ɵn = DatoGridSearchBarComponent;
25918
+ exports.ɵo = RichTextService;
25891
25919
 
25892
25920
  Object.defineProperty(exports, '__esModule', { value: true });
25893
25921