@datorama/core 22.8.2-rc.2 → 22.8.2

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 +58 -94
  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 +0 -1
  6. package/datorama-core.metadata.json +1 -1
  7. package/esm2015/datorama-core.js +1 -2
  8. package/esm2015/lib/breadcrumbs/breadcrumbs.component.js +2 -4
  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 +2 -5
  11. package/esm2015/lib/grid-v2/grid-settings.js +2 -2
  12. package/esm2015/lib/grid-v2/grid-store/grid.service.js +15 -22
  13. package/esm2015/lib/grid-v2/grid-toolbar/grid-toolbar.component.js +1 -7
  14. package/esm2015/lib/rich-text/rich-text.directive.js +33 -15
  15. package/esm2015/lib/select/select.component.js +10 -5
  16. package/esm2015/lib/version.js +2 -2
  17. package/esm5/datorama-core.js +1 -2
  18. package/esm5/lib/breadcrumbs/breadcrumbs.component.js +2 -4
  19. package/esm5/lib/grid-v2/grid/grid-v2.types.js +1 -1
  20. package/esm5/lib/grid-v2/grid-controller/grid-controller.component.js +2 -5
  21. package/esm5/lib/grid-v2/grid-settings.js +2 -2
  22. package/esm5/lib/grid-v2/grid-store/grid.service.js +15 -22
  23. package/esm5/lib/grid-v2/grid-toolbar/grid-toolbar.component.js +1 -13
  24. package/esm5/lib/rich-text/rich-text.directive.js +34 -16
  25. package/esm5/lib/select/select.component.js +10 -5
  26. package/esm5/lib/version.js +2 -2
  27. package/fesm2015/datorama-core.js +58 -86
  28. package/fesm2015/datorama-core.js.map +1 -1
  29. package/fesm5/datorama-core.js +59 -94
  30. package/fesm5/datorama-core.js.map +1 -1
  31. package/lib/grid-v2/grid/grid-v2.types.d.ts +0 -1
  32. package/lib/grid-v2/grid-settings.d.ts +2 -2
  33. package/lib/grid-v2/grid-toolbar/grid-toolbar.component.d.ts +0 -2
  34. package/lib/rich-text/rich-text.directive.d.ts +6 -4
  35. package/package.json +1 -1
  36. package/esm2015/lib/rich-text/rich-text.service.js +0 -50
  37. package/esm5/lib/rich-text/rich-text.service.js +0 -51
  38. package/lib/rich-text/rich-text.service.d.ts +0 -10
@@ -8748,8 +8748,9 @@
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;
8751
8752
  this.markAsActive(this._model, { deselectAll: true });
8752
- this.limitSelectedTo && this.updateDisabledState();
8753
+ overTheLimit && this.updateDisabledState();
8753
8754
  }
8754
8755
  /** For later updates */
8755
8756
  this.cdr.markForCheck();
@@ -8786,7 +8787,7 @@
8786
8787
  */
8787
8788
  if (this.hasValue && this._initialOpen) {
8788
8789
  this.markAsActive(this._model);
8789
- if (this.limitSelectedTo) {
8790
+ if (this.limitSelectedTo && this._model.length === this.limitSelectedTo) {
8790
8791
  this.updateDisabledState();
8791
8792
  }
8792
8793
  this._initialOpen = false;
@@ -8875,6 +8876,7 @@
8875
8876
  };
8876
8877
  DatoSelectComponent.prototype.removeOption = function (option) {
8877
8878
  var _this = this;
8879
+ var updateDisabled = this.limitSelectedTo && this._model.length === this.limitSelectedTo;
8878
8880
  this._model = this._model.filter(function (current) { return current[_this.idKey] !== option[_this.idKey]; });
8879
8881
  var optionToRemove = this.options.find(function (datoOption) { return datoOption.option && datoOption.option[_this.idKey] === option[_this.idKey]; });
8880
8882
  /**
@@ -8884,7 +8886,7 @@
8884
8886
  if (optionToRemove) {
8885
8887
  optionToRemove.active = false;
8886
8888
  }
8887
- this.limitSelectedTo && this.updateDisabledState();
8889
+ updateDisabled && this.updateDisabledState();
8888
8890
  this.onChange(this._model);
8889
8891
  this.cdr.markForCheck();
8890
8892
  this.asyncUpdateDropdownPosition();
@@ -9232,6 +9234,9 @@
9232
9234
  if (!datoOption) {
9233
9235
  return;
9234
9236
  }
9237
+ var modelLength = this._model.length;
9238
+ var updateDisabled = this.limitSelectedTo &&
9239
+ (modelLength === this.limitSelectedTo || (modelLength === this.limitSelectedTo - 1 && !datoOption.active));
9235
9240
  datoOption.active = !datoOption.active;
9236
9241
  var rawOption = datoOption.option;
9237
9242
  if (datoOption.active) {
@@ -9240,7 +9245,7 @@
9240
9245
  else {
9241
9246
  this._model = this._model.filter(function (current) { return current[_this.idKey] !== rawOption[_this.idKey]; });
9242
9247
  }
9243
- this.limitSelectedTo && this.updateDisabledState();
9248
+ updateDisabled && this.updateDisabledState();
9244
9249
  this.onChange(this._model);
9245
9250
  this.cdr.markForCheck();
9246
9251
  this.asyncUpdateDropdownPosition();
@@ -12045,7 +12050,7 @@
12045
12050
  return contextActions;
12046
12051
  }
12047
12052
 
12048
- var DATO_GRID_STORAGE_API = new core.InjectionToken('DATO_GRID_STORAGE_AP');
12053
+ var DATO_GRID_STORAGE_API = new core.InjectionToken('DATO_GRID_STORAGE_API');
12049
12054
 
12050
12055
  var defaultEditableColumnRenderer = function (params) {
12051
12056
  return params && params.value ? "<div class=\"value-wrapper ellipsis\">" + params.value + "</div>" : null;
@@ -14474,35 +14479,29 @@
14474
14479
  GridService.prototype.setGridSort = function (gridSort) {
14475
14480
  if (gridSort && this.api && this.api.grid.getDisplayedRowCount() > 0) {
14476
14481
  var colId_1 = gridSort.colId, sort = gridSort.sort, sortIndex = gridSort.sortIndex;
14477
- var sortToApply = gridSort;
14478
- if (!isNil(sortIndex)) {
14479
- var gridColumns = this.api.columns.getAllGridColumns();
14480
- if (gridColumns) {
14482
+ var gridColumns = this.api.columns.getAllGridColumns();
14483
+ if (gridColumns) {
14484
+ var sortToApply = gridSort;
14485
+ /** Sort by column id */
14486
+ var columnById = gridColumns.find(function (col) {
14487
+ return (col.getColDef().showRowGroup || col.getColId()) === colId_1;
14488
+ });
14489
+ if (columnById) {
14490
+ sortToApply = { colId: columnById.getColId(), sort: sort };
14491
+ }
14492
+ else if (!isNil(sortIndex)) {
14481
14493
  var valueColumns = this.api.columns.getValueColumns();
14482
14494
  var valueColumn = valueColumns.find(function (col) { return col.getColId() === colId_1; });
14483
14495
  var isPivotColId = colId_1.startsWith('pivot');
14484
14496
  if (isPivotColId || valueColumn) {
14485
14497
  /** Column is pivot value column, sort by index */
14486
14498
  var columnByIndex = gridColumns[sortIndex];
14487
- // const pivotValueColumn = columnByIndex && columnByIndex.getColDef().pivotValueColumn;
14488
- // const pivotValueColumnId = pivotValueColumn && pivotValueColumn.getColId();
14489
- // if (pivotValueColumnId === colId) {
14490
14499
  sortToApply = { colId: columnByIndex.getColId(), sort: sort, sortIndex: sortIndex };
14491
- // }
14492
- }
14493
- else {
14494
- /** Sort by column id */
14495
- var columnById = gridColumns.find(function (col) {
14496
- return (col.getColDef().showRowGroup || col.getColId()) === colId_1;
14497
- });
14498
- if (columnById) {
14499
- sortToApply = { colId: columnById.getColId(), sort: sort };
14500
- }
14501
14500
  }
14502
14501
  }
14502
+ this.updateSettings({ sort: sortToApply });
14503
+ this.api.grid.setSortModel([sortToApply]);
14503
14504
  }
14504
- this.updateSettings({ sort: sortToApply });
14505
- this.api.grid.setSortModel([sortToApply]);
14506
14505
  }
14507
14506
  };
14508
14507
  GridService.prototype.updateFilter = function (column, filter) {
@@ -14560,8 +14559,7 @@
14560
14559
  this.updateSettings({ gridAlignment: gridAlignment, columnsSizes: null });
14561
14560
  };
14562
14561
  GridService.prototype.saveSettingsToServer = function (settings) {
14563
- var isGlobal = this.gridQuery.getGridOptions().isGlobalSettings;
14564
- this.storageAPI.set(this.gridName, settings, isGlobal);
14562
+ this.storageAPI.set(this.gridName, settings);
14565
14563
  };
14566
14564
  /**
14567
14565
  * @internal used to log grid events to the platform's logging service
@@ -15566,10 +15564,7 @@
15566
15564
  .pipe(operators.switchMap(function () {
15567
15565
  _this.gridOptions = _this.normalizeOptions();
15568
15566
  agGrid.gridOptions = _this.gridOptions;
15569
- var isGlobal = _this.gridOptions.isGlobalSettings;
15570
- var settingsLoader = _this.gridOptions.saveSettings === false
15571
- ? rxjs.of(null)
15572
- : _this.storageAPI.get(_this.gridOptions.gridName, isGlobal);
15567
+ var settingsLoader = _this.gridOptions.saveSettings === false ? rxjs.of(null) : _this.storageAPI.get(_this.gridOptions.gridName);
15573
15568
  return rxjs.combineLatest([agGrid.gridReady, settingsLoader]);
15574
15569
  }), ngxTakeUntilDestroy.untilDestroyed(this))
15575
15570
  .subscribe(function (_a) {
@@ -16851,18 +16846,6 @@
16851
16846
  this.registerGroupListeners();
16852
16847
  this.subscribeRowsSelectionData();
16853
16848
  };
16854
- DatoGridV2ToolbarComponent.prototype.getCellValueChangeEvent = function () {
16855
- var _this = this;
16856
- return this.gridController.gridQuery.waitForGrid(function () {
16857
- return _this.gridQuery.gridRef.cellValueChanged.pipe(operators.debounceTime(100), ngxTakeUntilDestroy.untilDestroyed(_this));
16858
- });
16859
- };
16860
- DatoGridV2ToolbarComponent.prototype.getRowDataUpdatedEvent = function () {
16861
- var _this = this;
16862
- return this.gridController.gridQuery.waitForGrid(function () {
16863
- return _this.gridQuery.gridRef.rowDataUpdated.pipe(operators.debounceTime(100), ngxTakeUntilDestroy.untilDestroyed(_this));
16864
- });
16865
- };
16866
16849
  DatoGridV2ToolbarComponent.prototype.onActionClick = function (action) {
16867
16850
  if (isFunction(action.onClick)) {
16868
16851
  var selectedRowsCount = this.gridController.gridQuery.getSelectedRowsCount();
@@ -21338,40 +21321,6 @@
21338
21321
  * found in the LICENSE file at https://github.com/datorama/client-core/blob/master/LICENSE
21339
21322
  */
21340
21323
 
21341
- var RichTextService = /** @class */ (function () {
21342
- function RichTextService(http, config) {
21343
- this.http = http;
21344
- this.config = config;
21345
- }
21346
- RichTextService.prototype.getLib = function (appendScriptFunc, appendStyleFunc) {
21347
- if (!this.richTextScript$) {
21348
- this.initLib(appendScriptFunc, appendStyleFunc);
21349
- }
21350
- return this.richTextScript$;
21351
- };
21352
- RichTextService.prototype.initLib = function (appendScriptFunc, appendStyleFunc) {
21353
- this.richTextScript$ = rxjs.combineLatest([
21354
- this.http
21355
- .get(this.config.paths.richText + "/index.js", { responseType: 'text' })
21356
- .pipe(operators.tap(function (lib) { return appendScriptFunc(lib, 'rich-text-editor'); })),
21357
- this.http
21358
- .get(this.config.paths.richText + "/plugins/autocomplete/plugin.css", { responseType: 'text' })
21359
- .pipe(operators.tap(function (style) { return appendStyleFunc(style, 'tinymce-autocomplete'); }))
21360
- ]).pipe(operators.shareReplay(1));
21361
- };
21362
- RichTextService.ctorParameters = function () { return [
21363
- { type: http.HttpClient },
21364
- { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] }
21365
- ]; };
21366
- RichTextService.ɵprov = core.ɵɵdefineInjectable({ factory: function RichTextService_Factory() { return new RichTextService(core.ɵɵinject(http.HttpClient), core.ɵɵinject(DATO_CORE_CONFIG)); }, token: RichTextService, providedIn: "root" });
21367
- RichTextService = __decorate([
21368
- core.Injectable({ providedIn: 'root' }),
21369
- __param(1, core.Inject(DATO_CORE_CONFIG)),
21370
- __metadata("design:paramtypes", [http.HttpClient, Object])
21371
- ], RichTextService);
21372
- return RichTextService;
21373
- }());
21374
-
21375
21324
  /**
21376
21325
  * @license
21377
21326
  * Copyright Datorama. All Rights Reserved.
@@ -21385,12 +21334,12 @@
21385
21334
  var ɵ0$3 = getTinymce;
21386
21335
  var DatoRichTextDirective = /** @class */ (function (_super) {
21387
21336
  __extends(DatoRichTextDirective, _super);
21388
- function DatoRichTextDirective(ngZone, richTextService, config, host) {
21337
+ function DatoRichTextDirective(ngZone, http, host, config) {
21389
21338
  var _this = _super.call(this) || this;
21390
21339
  _this.ngZone = ngZone;
21391
- _this.richTextService = richTextService;
21392
- _this.config = config;
21340
+ _this.http = http;
21393
21341
  _this.host = host;
21342
+ _this.config = config;
21394
21343
  _this.autocompleteOptions = {};
21395
21344
  _this.forcePlainTextPasting = false;
21396
21345
  _this.format = 'html';
@@ -21424,11 +21373,28 @@
21424
21373
  base: this.config.paths.richText,
21425
21374
  query: ''
21426
21375
  };
21427
- this.richTextService
21428
- .getLib(appendScript, appendStyle)
21429
- .pipe(ngxTakeUntilDestroy.untilDestroyed(this))
21430
- .subscribe(function () {
21431
- _this.init.call(_this);
21376
+ /**
21377
+ * We support only one instance in load time
21378
+ */
21379
+ if (window.tinymce) {
21380
+ this.init.call(this);
21381
+ }
21382
+ else {
21383
+ this.loadLib().subscribe(function (lib) {
21384
+ appendScript(lib, 'rich-text-editor');
21385
+ _this.init.call(_this);
21386
+ _this.loadAutoCompleteStyle();
21387
+ });
21388
+ }
21389
+ };
21390
+ DatoRichTextDirective.prototype.loadLib = function () {
21391
+ return this.http.get(this.config.paths.richText + "/index.js", { responseType: 'text' });
21392
+ };
21393
+ DatoRichTextDirective.prototype.loadAutoCompleteStyle = function () {
21394
+ this.http
21395
+ .get(this.config.paths.richText + "/plugins/autocomplete/plugin.css", { responseType: 'text' })
21396
+ .subscribe(function (style) {
21397
+ appendStyle(style, 'tinymce-autocomplete');
21432
21398
  });
21433
21399
  };
21434
21400
  DatoRichTextDirective.prototype.initEditor = function (_, editor) {
@@ -21521,9 +21487,9 @@
21521
21487
  var DatoRichTextDirective_1;
21522
21488
  DatoRichTextDirective.ctorParameters = function () { return [
21523
21489
  { type: core.NgZone },
21524
- { type: RichTextService },
21525
- { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] },
21526
- { type: core.ElementRef }
21490
+ { type: http.HttpClient },
21491
+ { type: core.ElementRef },
21492
+ { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] }
21527
21493
  ]; };
21528
21494
  __decorate([
21529
21495
  core.Input(),
@@ -21589,9 +21555,10 @@
21589
21555
  }
21590
21556
  ]
21591
21557
  }),
21592
- __param(2, core.Inject(DATO_CORE_CONFIG)),
21558
+ __param(3, core.Inject(DATO_CORE_CONFIG)),
21593
21559
  __metadata("design:paramtypes", [core.NgZone,
21594
- RichTextService, Object, core.ElementRef])
21560
+ http.HttpClient,
21561
+ core.ElementRef, Object])
21595
21562
  ], DatoRichTextDirective);
21596
21563
  return DatoRichTextDirective;
21597
21564
  }(BaseCustomControl));
@@ -24114,9 +24081,7 @@
24114
24081
  };
24115
24082
  DatoBreadcrumbsComponent.prototype.initEditableHeader = function () {
24116
24083
  var _this = this;
24117
- this.headerControl.valueChanges
24118
- .pipe(operators.debounceTime(300), ngxTakeUntilDestroy.untilDestroyed(this))
24119
- .subscribe(function (res) {
24084
+ this.headerControl.valueChanges.pipe(operators.debounceTime(300), ngxTakeUntilDestroy.untilDestroyed(this)).subscribe(function (res) {
24120
24085
  _this.updateEditableText.emit(res);
24121
24086
  _this.cdr.detectChanges();
24122
24087
  });
@@ -25479,7 +25444,7 @@
25479
25444
  };
25480
25445
  }
25481
25446
 
25482
- window.coreVersion = '22.8.2-rc.';
25447
+ window.coreVersion = '22.8.2';
25483
25448
 
25484
25449
  exports.APP_TRANSLATE = APP_TRANSLATE;
25485
25450
  exports.AceService = AceService;
@@ -25921,7 +25886,6 @@
25921
25886
  exports.ɵl = DatoGridItemsCountCellComponent;
25922
25887
  exports.ɵm = DatoGridV2ToolbarMoreMenuComponent;
25923
25888
  exports.ɵn = DatoGridSearchBarComponent;
25924
- exports.ɵo = RichTextService;
25925
25889
 
25926
25890
  Object.defineProperty(exports, '__esModule', { value: true });
25927
25891