@datorama/core 22.6.3 → 22.8.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 (41) hide show
  1. package/bundles/datorama-core.umd.js +112 -84
  2. package/bundles/datorama-core.umd.js.map +1 -1
  3. package/bundles/datorama-core.umd.min.js +15 -15
  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 +6 -3
  11. package/esm2015/lib/grid-v2/grid-settings.js +2 -2
  12. package/esm2015/lib/grid-v2/grid-store/grid.query.js +19 -19
  13. package/esm2015/lib/grid-v2/grid-store/grid.service.js +21 -22
  14. package/esm2015/lib/grid-v2/grid-toolbar/grid-toolbar.component.js +7 -1
  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 +6 -3
  23. package/esm5/lib/grid-v2/grid-settings.js +2 -2
  24. package/esm5/lib/grid-v2/grid-store/grid.query.js +19 -19
  25. package/esm5/lib/grid-v2/grid-store/grid.service.js +21 -22
  26. package/esm5/lib/grid-v2/grid-toolbar/grid-toolbar.component.js +13 -1
  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 +104 -84
  32. package/fesm2015/datorama-core.js.map +1 -1
  33. package/fesm5/datorama-core.js +112 -85
  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-store/grid.query.d.ts +1 -0
  38. package/lib/grid-v2/grid-toolbar/grid-toolbar.component.d.ts +2 -0
  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 +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();
@@ -11601,26 +11596,26 @@
11601
11596
  return settings;
11602
11597
  };
11603
11598
  GridQuery.prototype.getSort = function () {
11604
- if (this.gridRef.gridOptions.pivotMode) {
11605
- var _a = this.api.grid.getSortModel().pop() || {}, sort = _a.sort, colId = _a.colId;
11606
- var column = this.api.columns.getColumn(colId);
11607
- var allColumns = this.api.columns.getAllGridColumns();
11608
- if (column) {
11609
- return { colId: colId, sort: sort, field: getColField(column.getColDef()), sortIndex: allColumns.indexOf(column) };
11610
- }
11611
- else {
11612
- var secondaryColumn = this.getSecondaryColumn(colId);
11613
- if (secondaryColumn) {
11614
- return {
11615
- colId: colId,
11616
- sort: sort,
11617
- field: getColField(secondaryColumn.getColDef()),
11618
- sortIndex: allColumns.indexOf(secondaryColumn)
11619
- };
11620
- }
11599
+ return this.api.grid.getSortModel().pop();
11600
+ };
11601
+ GridQuery.prototype.getExternalSort = function () {
11602
+ var _a = this.getSort() || {}, sort = _a.sort, colId = _a.colId;
11603
+ var column = this.api.columns.getColumn(colId);
11604
+ var allColumns = this.api.columns.getAllGridColumns();
11605
+ if (column) {
11606
+ return { colId: colId, sort: sort, field: getColField(column.getColDef()), sortIndex: allColumns.indexOf(column) };
11607
+ }
11608
+ else {
11609
+ var secondaryColumn = this.getSecondaryColumn(colId);
11610
+ if (secondaryColumn) {
11611
+ return {
11612
+ colId: colId,
11613
+ sort: sort,
11614
+ field: getColField(secondaryColumn.getColDef()),
11615
+ sortIndex: allColumns.indexOf(secondaryColumn)
11616
+ };
11621
11617
  }
11622
11618
  }
11623
- return this.api.grid.getSortModel().pop();
11624
11619
  };
11625
11620
  GridQuery.prototype.selectSort = function () {
11626
11621
  return this.select(function (state) { return state.settings.sort; });
@@ -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;
@@ -14466,37 +14461,35 @@
14466
14461
  };
14467
14462
  GridService.prototype.setGridSort = function (gridSort) {
14468
14463
  if (this.api && gridSort) {
14469
- var sort = gridSort.sort, sortIndex = gridSort.sortIndex, colId_1 = gridSort.colId;
14464
+ var colId_1 = gridSort.colId, sort = gridSort.sort, sortIndex = gridSort.sortIndex;
14465
+ var sortToApply = gridSort;
14470
14466
  if (!isNil(sortIndex)) {
14471
14467
  var gridColumns = this.api.columns.getAllGridColumns();
14472
14468
  if (gridColumns) {
14473
- var primaryColumns = this.api.columns.getPrimaryColumns();
14474
- var primaryColumn = primaryColumns.find(function (col) { return col.getColId() === colId_1; });
14475
- if (primaryColumn) {
14476
- /** Column is no pivot value column */
14469
+ var valueColumns = this.api.columns.getValueColumns();
14470
+ var valueColumn = valueColumns.find(function (col) { return col.getColId() === colId_1; });
14471
+ var isPivotColId = colId_1.startsWith('pivot');
14472
+ if (isPivotColId || valueColumn) {
14473
+ /** Column is pivot value column, sort by index */
14474
+ var columnByIndex = gridColumns[sortIndex];
14475
+ var valueColumnId = columnByIndex && columnByIndex.getColDef().pivotValueColumn.getColId();
14476
+ if (valueColumnId === colId_1) {
14477
+ sortToApply = { colId: columnByIndex.getColId(), sort: sort };
14478
+ }
14479
+ }
14480
+ else {
14481
+ /** Sort by column id */
14477
14482
  var columnById = gridColumns.find(function (col) {
14478
14483
  return (col.getColDef().showRowGroup || col.getColId()) === colId_1;
14479
14484
  });
14480
14485
  if (columnById) {
14481
- var sortToApply = { colId: columnById.getColId(), sort: sort };
14482
- this.updateSettings({ sort: sortToApply });
14483
- this.api.grid.setSortModel([sortToApply]);
14484
- }
14485
- }
14486
- else {
14487
- var columnByIndex = gridColumns[sortIndex];
14488
- if (columnByIndex) {
14489
- var sortToApply = { colId: columnByIndex.getColId(), sort: sort };
14490
- this.updateSettings({ sort: sortToApply });
14491
- this.api.grid.setSortModel([sortToApply]);
14486
+ sortToApply = { colId: columnById.getColId(), sort: sort };
14492
14487
  }
14493
14488
  }
14494
14489
  }
14495
14490
  }
14496
- else {
14497
- this.updateSettings({ sort: gridSort });
14498
- this.api.grid.setSortModel([gridSort]);
14499
- }
14491
+ this.updateSettings({ sort: sortToApply });
14492
+ this.api.grid.setSortModel([sortToApply]);
14500
14493
  }
14501
14494
  };
14502
14495
  GridService.prototype.updateFilter = function (column, filter) {
@@ -14554,7 +14547,8 @@
14554
14547
  this.updateSettings({ gridAlignment: gridAlignment, columnsSizes: null });
14555
14548
  };
14556
14549
  GridService.prototype.saveSettingsToServer = function (settings) {
14557
- this.storageAPI.set(this.gridName, settings);
14550
+ var isGlobal = this.gridQuery.getGridOptions().isGlobalSettings;
14551
+ this.storageAPI.set(this.gridName, settings, isGlobal);
14558
14552
  };
14559
14553
  /**
14560
14554
  * @internal used to log grid events to the platform's logging service
@@ -15559,7 +15553,10 @@
15559
15553
  .pipe(operators.switchMap(function () {
15560
15554
  _this.gridOptions = _this.normalizeOptions();
15561
15555
  agGrid.gridOptions = _this.gridOptions;
15562
- var settingsLoader = _this.gridOptions.saveSettings === false ? rxjs.of(null) : _this.storageAPI.get(_this.gridOptions.gridName);
15556
+ var isGlobal = _this.gridOptions.isGlobalSettings;
15557
+ var settingsLoader = _this.gridOptions.saveSettings === false
15558
+ ? rxjs.of(null)
15559
+ : _this.storageAPI.get(_this.gridOptions.gridName, isGlobal);
15563
15560
  return rxjs.combineLatest([agGrid.gridReady, settingsLoader]);
15564
15561
  }), ngxTakeUntilDestroy.untilDestroyed(this))
15565
15562
  .subscribe(function (_a) {
@@ -15673,7 +15670,7 @@
15673
15670
  var data = _this.getGridData();
15674
15671
  _this.onGridChange.emit({
15675
15672
  filter: _this.gridQuery.getExternalFilter(),
15676
- sort: _this.gridQuery.getSort(),
15673
+ sort: _this.gridQuery.getExternalSort(),
15677
15674
  type: type,
15678
15675
  data: data
15679
15676
  });
@@ -16841,6 +16838,18 @@
16841
16838
  this.registerGroupListeners();
16842
16839
  this.subscribeRowsSelectionData();
16843
16840
  };
16841
+ DatoGridV2ToolbarComponent.prototype.getCellValueChangeEvent = function () {
16842
+ var _this = this;
16843
+ return this.gridController.gridQuery.waitForGrid(function () {
16844
+ return _this.gridQuery.gridRef.cellValueChanged.pipe(operators.debounceTime(100), ngxTakeUntilDestroy.untilDestroyed(_this));
16845
+ });
16846
+ };
16847
+ DatoGridV2ToolbarComponent.prototype.getRowDataUpdatedEvent = function () {
16848
+ var _this = this;
16849
+ return this.gridController.gridQuery.waitForGrid(function () {
16850
+ return _this.gridQuery.gridRef.rowDataUpdated.pipe(operators.debounceTime(100), ngxTakeUntilDestroy.untilDestroyed(_this));
16851
+ });
16852
+ };
16844
16853
  DatoGridV2ToolbarComponent.prototype.onActionClick = function (action) {
16845
16854
  if (isFunction(action.onClick)) {
16846
16855
  var selectedRowsCount = this.gridController.gridQuery.getSelectedRowsCount();
@@ -21316,6 +21325,40 @@
21316
21325
  * found in the LICENSE file at https://github.com/datorama/client-core/blob/master/LICENSE
21317
21326
  */
21318
21327
 
21328
+ var RichTextService = /** @class */ (function () {
21329
+ function RichTextService(http, config) {
21330
+ this.http = http;
21331
+ this.config = config;
21332
+ }
21333
+ RichTextService.prototype.getLib = function (appendScriptFunc, appendStyleFunc) {
21334
+ if (!this.richTextScript$) {
21335
+ this.initLib(appendScriptFunc, appendStyleFunc);
21336
+ }
21337
+ return this.richTextScript$;
21338
+ };
21339
+ RichTextService.prototype.initLib = function (appendScriptFunc, appendStyleFunc) {
21340
+ this.richTextScript$ = rxjs.combineLatest([
21341
+ this.http
21342
+ .get(this.config.paths.richText + "/index.js", { responseType: 'text' })
21343
+ .pipe(operators.tap(function (lib) { return appendScriptFunc(lib, 'rich-text-editor'); })),
21344
+ this.http
21345
+ .get(this.config.paths.richText + "/plugins/autocomplete/plugin.css", { responseType: 'text' })
21346
+ .pipe(operators.tap(function (style) { return appendStyleFunc(style, 'tinymce-autocomplete'); }))
21347
+ ]).pipe(operators.shareReplay(1));
21348
+ };
21349
+ RichTextService.ctorParameters = function () { return [
21350
+ { type: http.HttpClient },
21351
+ { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] }
21352
+ ]; };
21353
+ RichTextService.ɵprov = core.ɵɵdefineInjectable({ factory: function RichTextService_Factory() { return new RichTextService(core.ɵɵinject(http.HttpClient), core.ɵɵinject(DATO_CORE_CONFIG)); }, token: RichTextService, providedIn: "root" });
21354
+ RichTextService = __decorate([
21355
+ core.Injectable({ providedIn: 'root' }),
21356
+ __param(1, core.Inject(DATO_CORE_CONFIG)),
21357
+ __metadata("design:paramtypes", [http.HttpClient, Object])
21358
+ ], RichTextService);
21359
+ return RichTextService;
21360
+ }());
21361
+
21319
21362
  /**
21320
21363
  * @license
21321
21364
  * Copyright Datorama. All Rights Reserved.
@@ -21329,12 +21372,12 @@
21329
21372
  var ɵ0$3 = getTinymce;
21330
21373
  var DatoRichTextDirective = /** @class */ (function (_super) {
21331
21374
  __extends(DatoRichTextDirective, _super);
21332
- function DatoRichTextDirective(ngZone, http, host, config) {
21375
+ function DatoRichTextDirective(ngZone, richTextService, config, host) {
21333
21376
  var _this = _super.call(this) || this;
21334
21377
  _this.ngZone = ngZone;
21335
- _this.http = http;
21336
- _this.host = host;
21378
+ _this.richTextService = richTextService;
21337
21379
  _this.config = config;
21380
+ _this.host = host;
21338
21381
  _this.autocompleteOptions = {};
21339
21382
  _this.forcePlainTextPasting = false;
21340
21383
  _this.format = 'html';
@@ -21368,28 +21411,11 @@
21368
21411
  base: this.config.paths.richText,
21369
21412
  query: ''
21370
21413
  };
21371
- /**
21372
- * We support only one instance in load time
21373
- */
21374
- if (window.tinymce) {
21375
- this.init.call(this);
21376
- }
21377
- else {
21378
- this.loadLib().subscribe(function (lib) {
21379
- appendScript(lib, 'rich-text-editor');
21380
- _this.init.call(_this);
21381
- _this.loadAutoCompleteStyle();
21382
- });
21383
- }
21384
- };
21385
- DatoRichTextDirective.prototype.loadLib = function () {
21386
- return this.http.get(this.config.paths.richText + "/index.js", { responseType: 'text' });
21387
- };
21388
- DatoRichTextDirective.prototype.loadAutoCompleteStyle = function () {
21389
- this.http
21390
- .get(this.config.paths.richText + "/plugins/autocomplete/plugin.css", { responseType: 'text' })
21391
- .subscribe(function (style) {
21392
- appendStyle(style, 'tinymce-autocomplete');
21414
+ this.richTextService
21415
+ .getLib(appendScript, appendStyle)
21416
+ .pipe(ngxTakeUntilDestroy.untilDestroyed(this))
21417
+ .subscribe(function () {
21418
+ _this.init.call(_this);
21393
21419
  });
21394
21420
  };
21395
21421
  DatoRichTextDirective.prototype.initEditor = function (_, editor) {
@@ -21482,9 +21508,9 @@
21482
21508
  var DatoRichTextDirective_1;
21483
21509
  DatoRichTextDirective.ctorParameters = function () { return [
21484
21510
  { type: core.NgZone },
21485
- { type: http.HttpClient },
21486
- { type: core.ElementRef },
21487
- { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] }
21511
+ { type: RichTextService },
21512
+ { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] },
21513
+ { type: core.ElementRef }
21488
21514
  ]; };
21489
21515
  __decorate([
21490
21516
  core.Input(),
@@ -21550,10 +21576,9 @@
21550
21576
  }
21551
21577
  ]
21552
21578
  }),
21553
- __param(3, core.Inject(DATO_CORE_CONFIG)),
21579
+ __param(2, core.Inject(DATO_CORE_CONFIG)),
21554
21580
  __metadata("design:paramtypes", [core.NgZone,
21555
- http.HttpClient,
21556
- core.ElementRef, Object])
21581
+ RichTextService, Object, core.ElementRef])
21557
21582
  ], DatoRichTextDirective);
21558
21583
  return DatoRichTextDirective;
21559
21584
  }(BaseCustomControl));
@@ -24076,7 +24101,9 @@
24076
24101
  };
24077
24102
  DatoBreadcrumbsComponent.prototype.initEditableHeader = function () {
24078
24103
  var _this = this;
24079
- this.headerControl.valueChanges.pipe(operators.debounceTime(300), ngxTakeUntilDestroy.untilDestroyed(this)).subscribe(function (res) {
24104
+ this.headerControl.valueChanges
24105
+ .pipe(operators.debounceTime(300), ngxTakeUntilDestroy.untilDestroyed(this))
24106
+ .subscribe(function (res) {
24080
24107
  _this.updateEditableText.emit(res);
24081
24108
  _this.cdr.detectChanges();
24082
24109
  });
@@ -25439,7 +25466,7 @@
25439
25466
  };
25440
25467
  }
25441
25468
 
25442
- window.coreVersion = '22.6.3';
25469
+ window.coreVersion = '22.8.1-rc.';
25443
25470
 
25444
25471
  exports.APP_TRANSLATE = APP_TRANSLATE;
25445
25472
  exports.AceService = AceService;
@@ -25881,6 +25908,7 @@
25881
25908
  exports.ɵl = DatoGridItemsCountCellComponent;
25882
25909
  exports.ɵm = DatoGridV2ToolbarMoreMenuComponent;
25883
25910
  exports.ɵn = DatoGridSearchBarComponent;
25911
+ exports.ɵo = RichTextService;
25884
25912
 
25885
25913
  Object.defineProperty(exports, '__esModule', { value: true });
25886
25914