@datorama/core 22.7.1 → 22.8.1-rc.3

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 +79 -47
  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 +7 -4
  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 +7 -4
  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 +71 -47
  30. package/fesm2015/datorama-core.js.map +1 -1
  31. package/fesm5/datorama-core.js +79 -48
  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();
@@ -12048,7 +12043,7 @@
12048
12043
  return contextActions;
12049
12044
  }
12050
12045
 
12051
- var DATO_GRID_STORAGE_API = new core.InjectionToken('DATO_GRID_STORAGE_API');
12046
+ var DATO_GRID_STORAGE_API = new core.InjectionToken('DATO_GRID_STORAGE_AP');
12052
12047
 
12053
12048
  var defaultEditableColumnRenderer = function (params) {
12054
12049
  return params && params.value ? "<div class=\"value-wrapper ellipsis\">" + params.value + "</div>" : null;
@@ -14465,7 +14460,7 @@
14465
14460
  }
14466
14461
  };
14467
14462
  GridService.prototype.setGridSort = function (gridSort) {
14468
- if (this.api && gridSort) {
14463
+ if (gridSort && this.api && this.api.grid.getDisplayedRowCount() > 0) {
14469
14464
  var colId_1 = gridSort.colId, sort = gridSort.sort, sortIndex = gridSort.sortIndex;
14470
14465
  var sortToApply = gridSort;
14471
14466
  if (!isNil(sortIndex)) {
@@ -14477,7 +14472,9 @@
14477
14472
  if (isPivotColId || valueColumn) {
14478
14473
  /** Column is pivot value column, sort by index */
14479
14474
  var columnByIndex = gridColumns[sortIndex];
14480
- if (columnByIndex) {
14475
+ var pivotValueColumn = columnByIndex && columnByIndex.getColDef().pivotValueColumn;
14476
+ var pivotValueColumnId = pivotValueColumn && pivotValueColumn.getColId();
14477
+ if (pivotValueColumnId === colId_1) {
14481
14478
  sortToApply = { colId: columnByIndex.getColId(), sort: sort };
14482
14479
  }
14483
14480
  }
@@ -14551,7 +14548,8 @@
14551
14548
  this.updateSettings({ gridAlignment: gridAlignment, columnsSizes: null });
14552
14549
  };
14553
14550
  GridService.prototype.saveSettingsToServer = function (settings) {
14554
- this.storageAPI.set(this.gridName, settings);
14551
+ var isGlobal = this.gridQuery.getGridOptions().isGlobalSettings;
14552
+ this.storageAPI.set(this.gridName, settings, isGlobal);
14555
14553
  };
14556
14554
  /**
14557
14555
  * @internal used to log grid events to the platform's logging service
@@ -15556,7 +15554,10 @@
15556
15554
  .pipe(operators.switchMap(function () {
15557
15555
  _this.gridOptions = _this.normalizeOptions();
15558
15556
  agGrid.gridOptions = _this.gridOptions;
15559
- var settingsLoader = _this.gridOptions.saveSettings === false ? rxjs.of(null) : _this.storageAPI.get(_this.gridOptions.gridName);
15557
+ var isGlobal = _this.gridOptions.isGlobalSettings;
15558
+ var settingsLoader = _this.gridOptions.saveSettings === false
15559
+ ? rxjs.of(null)
15560
+ : _this.storageAPI.get(_this.gridOptions.gridName, isGlobal);
15560
15561
  return rxjs.combineLatest([agGrid.gridReady, settingsLoader]);
15561
15562
  }), ngxTakeUntilDestroy.untilDestroyed(this))
15562
15563
  .subscribe(function (_a) {
@@ -16838,6 +16839,18 @@
16838
16839
  this.registerGroupListeners();
16839
16840
  this.subscribeRowsSelectionData();
16840
16841
  };
16842
+ DatoGridV2ToolbarComponent.prototype.getCellValueChangeEvent = function () {
16843
+ var _this = this;
16844
+ return this.gridController.gridQuery.waitForGrid(function () {
16845
+ return _this.gridQuery.gridRef.cellValueChanged.pipe(operators.debounceTime(100), ngxTakeUntilDestroy.untilDestroyed(_this));
16846
+ });
16847
+ };
16848
+ DatoGridV2ToolbarComponent.prototype.getRowDataUpdatedEvent = function () {
16849
+ var _this = this;
16850
+ return this.gridController.gridQuery.waitForGrid(function () {
16851
+ return _this.gridQuery.gridRef.rowDataUpdated.pipe(operators.debounceTime(100), ngxTakeUntilDestroy.untilDestroyed(_this));
16852
+ });
16853
+ };
16841
16854
  DatoGridV2ToolbarComponent.prototype.onActionClick = function (action) {
16842
16855
  if (isFunction(action.onClick)) {
16843
16856
  var selectedRowsCount = this.gridController.gridQuery.getSelectedRowsCount();
@@ -21313,6 +21326,40 @@
21313
21326
  * found in the LICENSE file at https://github.com/datorama/client-core/blob/master/LICENSE
21314
21327
  */
21315
21328
 
21329
+ var RichTextService = /** @class */ (function () {
21330
+ function RichTextService(http, config) {
21331
+ this.http = http;
21332
+ this.config = config;
21333
+ }
21334
+ RichTextService.prototype.getLib = function (appendScriptFunc, appendStyleFunc) {
21335
+ if (!this.richTextScript$) {
21336
+ this.initLib(appendScriptFunc, appendStyleFunc);
21337
+ }
21338
+ return this.richTextScript$;
21339
+ };
21340
+ RichTextService.prototype.initLib = function (appendScriptFunc, appendStyleFunc) {
21341
+ this.richTextScript$ = rxjs.combineLatest([
21342
+ this.http
21343
+ .get(this.config.paths.richText + "/index.js", { responseType: 'text' })
21344
+ .pipe(operators.tap(function (lib) { return appendScriptFunc(lib, 'rich-text-editor'); })),
21345
+ this.http
21346
+ .get(this.config.paths.richText + "/plugins/autocomplete/plugin.css", { responseType: 'text' })
21347
+ .pipe(operators.tap(function (style) { return appendStyleFunc(style, 'tinymce-autocomplete'); }))
21348
+ ]).pipe(operators.shareReplay(1));
21349
+ };
21350
+ RichTextService.ctorParameters = function () { return [
21351
+ { type: http.HttpClient },
21352
+ { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] }
21353
+ ]; };
21354
+ RichTextService.ɵprov = core.ɵɵdefineInjectable({ factory: function RichTextService_Factory() { return new RichTextService(core.ɵɵinject(http.HttpClient), core.ɵɵinject(DATO_CORE_CONFIG)); }, token: RichTextService, providedIn: "root" });
21355
+ RichTextService = __decorate([
21356
+ core.Injectable({ providedIn: 'root' }),
21357
+ __param(1, core.Inject(DATO_CORE_CONFIG)),
21358
+ __metadata("design:paramtypes", [http.HttpClient, Object])
21359
+ ], RichTextService);
21360
+ return RichTextService;
21361
+ }());
21362
+
21316
21363
  /**
21317
21364
  * @license
21318
21365
  * Copyright Datorama. All Rights Reserved.
@@ -21326,12 +21373,12 @@
21326
21373
  var ɵ0$3 = getTinymce;
21327
21374
  var DatoRichTextDirective = /** @class */ (function (_super) {
21328
21375
  __extends(DatoRichTextDirective, _super);
21329
- function DatoRichTextDirective(ngZone, http, host, config) {
21376
+ function DatoRichTextDirective(ngZone, richTextService, config, host) {
21330
21377
  var _this = _super.call(this) || this;
21331
21378
  _this.ngZone = ngZone;
21332
- _this.http = http;
21333
- _this.host = host;
21379
+ _this.richTextService = richTextService;
21334
21380
  _this.config = config;
21381
+ _this.host = host;
21335
21382
  _this.autocompleteOptions = {};
21336
21383
  _this.forcePlainTextPasting = false;
21337
21384
  _this.format = 'html';
@@ -21365,28 +21412,11 @@
21365
21412
  base: this.config.paths.richText,
21366
21413
  query: ''
21367
21414
  };
21368
- /**
21369
- * We support only one instance in load time
21370
- */
21371
- if (window.tinymce) {
21372
- this.init.call(this);
21373
- }
21374
- else {
21375
- this.loadLib().subscribe(function (lib) {
21376
- appendScript(lib, 'rich-text-editor');
21377
- _this.init.call(_this);
21378
- _this.loadAutoCompleteStyle();
21379
- });
21380
- }
21381
- };
21382
- DatoRichTextDirective.prototype.loadLib = function () {
21383
- return this.http.get(this.config.paths.richText + "/index.js", { responseType: 'text' });
21384
- };
21385
- DatoRichTextDirective.prototype.loadAutoCompleteStyle = function () {
21386
- this.http
21387
- .get(this.config.paths.richText + "/plugins/autocomplete/plugin.css", { responseType: 'text' })
21388
- .subscribe(function (style) {
21389
- appendStyle(style, 'tinymce-autocomplete');
21415
+ this.richTextService
21416
+ .getLib(appendScript, appendStyle)
21417
+ .pipe(ngxTakeUntilDestroy.untilDestroyed(this))
21418
+ .subscribe(function () {
21419
+ _this.init.call(_this);
21390
21420
  });
21391
21421
  };
21392
21422
  DatoRichTextDirective.prototype.initEditor = function (_, editor) {
@@ -21479,9 +21509,9 @@
21479
21509
  var DatoRichTextDirective_1;
21480
21510
  DatoRichTextDirective.ctorParameters = function () { return [
21481
21511
  { type: core.NgZone },
21482
- { type: http.HttpClient },
21483
- { type: core.ElementRef },
21484
- { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] }
21512
+ { type: RichTextService },
21513
+ { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] },
21514
+ { type: core.ElementRef }
21485
21515
  ]; };
21486
21516
  __decorate([
21487
21517
  core.Input(),
@@ -21547,10 +21577,9 @@
21547
21577
  }
21548
21578
  ]
21549
21579
  }),
21550
- __param(3, core.Inject(DATO_CORE_CONFIG)),
21580
+ __param(2, core.Inject(DATO_CORE_CONFIG)),
21551
21581
  __metadata("design:paramtypes", [core.NgZone,
21552
- http.HttpClient,
21553
- core.ElementRef, Object])
21582
+ RichTextService, Object, core.ElementRef])
21554
21583
  ], DatoRichTextDirective);
21555
21584
  return DatoRichTextDirective;
21556
21585
  }(BaseCustomControl));
@@ -24073,7 +24102,9 @@
24073
24102
  };
24074
24103
  DatoBreadcrumbsComponent.prototype.initEditableHeader = function () {
24075
24104
  var _this = this;
24076
- this.headerControl.valueChanges.pipe(operators.debounceTime(300), ngxTakeUntilDestroy.untilDestroyed(this)).subscribe(function (res) {
24105
+ this.headerControl.valueChanges
24106
+ .pipe(operators.debounceTime(300), ngxTakeUntilDestroy.untilDestroyed(this))
24107
+ .subscribe(function (res) {
24077
24108
  _this.updateEditableText.emit(res);
24078
24109
  _this.cdr.detectChanges();
24079
24110
  });
@@ -25436,7 +25467,7 @@
25436
25467
  };
25437
25468
  }
25438
25469
 
25439
- window.coreVersion = '22.7.1';
25470
+ window.coreVersion = '22.8.1-rc.';
25440
25471
 
25441
25472
  exports.APP_TRANSLATE = APP_TRANSLATE;
25442
25473
  exports.AceService = AceService;
@@ -25878,6 +25909,7 @@
25878
25909
  exports.ɵl = DatoGridItemsCountCellComponent;
25879
25910
  exports.ɵm = DatoGridV2ToolbarMoreMenuComponent;
25880
25911
  exports.ɵn = DatoGridSearchBarComponent;
25912
+ exports.ɵo = RichTextService;
25881
25913
 
25882
25914
  Object.defineProperty(exports, '__esModule', { value: true });
25883
25915