@datorama/core 22.12.3-rc.2 → 22.12.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 (50) hide show
  1. package/bundles/datorama-core.umd.js +92 -80
  2. package/bundles/datorama-core.umd.js.map +1 -1
  3. package/bundles/datorama-core.umd.min.js +55 -55
  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 +2 -3
  13. package/esm2015/lib/grid-v2/grid-toolbar/grid-toolbar.component.js +1 -7
  14. package/esm2015/lib/pipes/pipes.module.js +4 -2
  15. package/esm2015/lib/pipes/public_api.js +2 -1
  16. package/esm2015/lib/pipes/short-number.pipe.js +15 -0
  17. package/esm2015/lib/rich-text/rich-text.directive.js +38 -20
  18. package/esm2015/lib/select/select.component.js +9 -4
  19. package/esm2015/lib/utils/number.js +24 -1
  20. package/esm2015/lib/version.js +2 -2
  21. package/esm5/datorama-core.js +1 -2
  22. package/esm5/lib/breadcrumbs/breadcrumbs.component.js +2 -4
  23. package/esm5/lib/grid-v2/grid/grid-v2.types.js +1 -1
  24. package/esm5/lib/grid-v2/grid-controller/grid-controller.component.js +2 -5
  25. package/esm5/lib/grid-v2/grid-settings.js +2 -2
  26. package/esm5/lib/grid-v2/grid-store/grid.service.js +2 -3
  27. package/esm5/lib/grid-v2/grid-toolbar/grid-toolbar.component.js +1 -13
  28. package/esm5/lib/pipes/pipes.module.js +4 -2
  29. package/esm5/lib/pipes/public_api.js +2 -1
  30. package/esm5/lib/pipes/short-number.pipe.js +19 -0
  31. package/esm5/lib/rich-text/rich-text.directive.js +39 -21
  32. package/esm5/lib/select/select.component.js +9 -4
  33. package/esm5/lib/utils/number.js +25 -1
  34. package/esm5/lib/version.js +2 -2
  35. package/fesm2015/datorama-core.js +85 -72
  36. package/fesm2015/datorama-core.js.map +1 -1
  37. package/fesm5/datorama-core.js +91 -80
  38. package/fesm5/datorama-core.js.map +1 -1
  39. package/lib/date-picker/date-picker-config.d.ts +1 -1
  40. package/lib/grid-v2/grid/grid-v2.types.d.ts +0 -1
  41. package/lib/grid-v2/grid-settings.d.ts +2 -2
  42. package/lib/grid-v2/grid-toolbar/grid-toolbar.component.d.ts +0 -2
  43. package/lib/pipes/public_api.d.ts +1 -0
  44. package/lib/pipes/short-number.pipe.d.ts +4 -0
  45. package/lib/rich-text/rich-text.directive.d.ts +6 -4
  46. package/lib/utils/number.d.ts +1 -0
  47. package/package.json +2 -2
  48. package/esm2015/lib/rich-text/rich-text.service.js +0 -50
  49. package/esm5/lib/rich-text/rich-text.service.js +0 -51
  50. package/lib/rich-text/rich-text.service.d.ts +0 -10
@@ -1649,6 +1649,30 @@
1649
1649
  function isNaN$1(number) {
1650
1650
  return typeof number === 'number' && number !== number;
1651
1651
  }
1652
+ function shortNumber(value, decimalPlaces) {
1653
+ if (decimalPlaces === void 0) { decimalPlaces = 0; }
1654
+ if (!isNumber(value)) {
1655
+ return '';
1656
+ }
1657
+ if (value < 1000) {
1658
+ return value.toString();
1659
+ }
1660
+ var suffixes = [
1661
+ { suffix: 'Q', minValue: Math.pow(10, 15) },
1662
+ { suffix: 'T', minValue: Math.pow(10, 12) },
1663
+ { suffix: 'B', minValue: Math.pow(10, 9) },
1664
+ { suffix: 'M', minValue: Math.pow(10, 6) },
1665
+ { suffix: 'K', minValue: 1000 }
1666
+ ];
1667
+ var round = function (num) { return Number(num.toFixed(decimalPlaces)); };
1668
+ for (var i = 0; i < suffixes.length; i++) {
1669
+ var _a = suffixes[i], minValue = _a.minValue, suffix = _a.suffix;
1670
+ if (value >= minValue) {
1671
+ return "" + round(value / minValue) + suffix;
1672
+ }
1673
+ }
1674
+ return "" + round(value);
1675
+ }
1652
1676
 
1653
1677
  /**
1654
1678
  *
@@ -4877,6 +4901,21 @@
4877
4901
  return DatoTreePipe;
4878
4902
  }());
4879
4903
 
4904
+ var DatoShortNumberPipe = /** @class */ (function () {
4905
+ function DatoShortNumberPipe() {
4906
+ }
4907
+ DatoShortNumberPipe.prototype.transform = function (value, decimalPlaces) {
4908
+ if (decimalPlaces === void 0) { decimalPlaces = 0; }
4909
+ return shortNumber(value, decimalPlaces);
4910
+ };
4911
+ DatoShortNumberPipe = __decorate([
4912
+ core.Pipe({
4913
+ name: 'shortNumber'
4914
+ })
4915
+ ], DatoShortNumberPipe);
4916
+ return DatoShortNumberPipe;
4917
+ }());
4918
+
4880
4919
  /**
4881
4920
  * @license
4882
4921
  * Copyright Datorama. All Rights Reserved.
@@ -4892,7 +4931,8 @@
4892
4931
  DatoSearchResultsGroupSortPipe,
4893
4932
  DatoSearchResultsSortPipe,
4894
4933
  DatoTrackByPropPipe,
4895
- DatoTreePipe
4934
+ DatoTreePipe,
4935
+ DatoShortNumberPipe
4896
4936
  ];
4897
4937
  var DatoPipesModule = /** @class */ (function () {
4898
4938
  function DatoPipesModule() {
@@ -8833,8 +8873,9 @@
8833
8873
  DatoSelectComponent.prototype.writeValue = function (activeOptions) {
8834
8874
  this._model = activeOptions ? akita.coerceArray(activeOptions) : [];
8835
8875
  if (this.options) {
8876
+ var overTheLimit = this.limitSelectedTo && this.isMulti && this._model.length >= this.limitSelectedTo;
8836
8877
  this.markAsActive(this._model, { deselectAll: true });
8837
- this.limitSelectedTo && this.updateDisabledState();
8878
+ overTheLimit && this.updateDisabledState();
8838
8879
  }
8839
8880
  /** For later updates */
8840
8881
  this.cdr.markForCheck();
@@ -8962,6 +9003,7 @@
8962
9003
  };
8963
9004
  DatoSelectComponent.prototype.removeOption = function (option) {
8964
9005
  var _this = this;
9006
+ var updateDisabled = this.limitSelectedTo && this._model.length === this.limitSelectedTo;
8965
9007
  this._model = this._model.filter(function (current) { return current[_this.idKey] !== option[_this.idKey]; });
8966
9008
  var optionToRemove = this.options.find(function (datoOption) { return datoOption.option && datoOption.option[_this.idKey] === option[_this.idKey]; });
8967
9009
  /**
@@ -8971,7 +9013,7 @@
8971
9013
  if (optionToRemove) {
8972
9014
  optionToRemove.active = false;
8973
9015
  }
8974
- this.limitSelectedTo && this.updateDisabledState();
9016
+ updateDisabled && this.updateDisabledState();
8975
9017
  this.onChange(this._model);
8976
9018
  this.cdr.markForCheck();
8977
9019
  this.asyncUpdateDropdownPosition();
@@ -9319,6 +9361,9 @@
9319
9361
  if (!datoOption) {
9320
9362
  return;
9321
9363
  }
9364
+ var modelLength = this._model.length;
9365
+ var updateDisabled = this.limitSelectedTo &&
9366
+ (modelLength === this.limitSelectedTo || (modelLength === this.limitSelectedTo - 1 && !datoOption.active));
9322
9367
  datoOption.active = !datoOption.active;
9323
9368
  var rawOption = datoOption.option;
9324
9369
  if (datoOption.active) {
@@ -9327,7 +9372,7 @@
9327
9372
  else {
9328
9373
  this._model = this._model.filter(function (current) { return current[_this.idKey] !== rawOption[_this.idKey]; });
9329
9374
  }
9330
- this.limitSelectedTo && this.updateDisabledState();
9375
+ updateDisabled && this.updateDisabledState();
9331
9376
  this.onChange(this._model);
9332
9377
  this.cdr.markForCheck();
9333
9378
  this.asyncUpdateDropdownPosition();
@@ -12060,7 +12105,7 @@
12060
12105
  return contextActions;
12061
12106
  }
12062
12107
 
12063
- var DATO_GRID_STORAGE_API = new core.InjectionToken('DATO_GRID_STORAGE_AP');
12108
+ var DATO_GRID_STORAGE_API = new core.InjectionToken('DATO_GRID_STORAGE_API');
12064
12109
 
12065
12110
  var defaultEditableColumnRenderer = function (params) {
12066
12111
  return params && params.value ? "<div class=\"value-wrapper ellipsis\">" + params.value + "</div>" : null;
@@ -14722,8 +14767,7 @@
14722
14767
  this.updateSettings({ gridAlignment: gridAlignment, columnsSizes: null });
14723
14768
  };
14724
14769
  GridService.prototype.saveSettingsToServer = function (settings) {
14725
- var isGlobal = this.gridQuery.getGridOptions().isGlobalSettings;
14726
- this.storageAPI.set(this.gridName, settings, isGlobal);
14770
+ this.storageAPI.set(this.gridName, settings);
14727
14771
  };
14728
14772
  /**
14729
14773
  * @internal used to log grid events to the platform's logging service
@@ -15733,10 +15777,7 @@
15733
15777
  .pipe(operators.switchMap(function () {
15734
15778
  _this.gridOptions = _this.normalizeOptions();
15735
15779
  agGrid.gridOptions = _this.gridOptions;
15736
- var isGlobal = _this.gridOptions.isGlobalSettings;
15737
- var settingsLoader = _this.gridOptions.saveSettings === false
15738
- ? rxjs.of(null)
15739
- : _this.storageAPI.get(_this.gridOptions.gridName, isGlobal);
15780
+ var settingsLoader = _this.gridOptions.saveSettings === false ? rxjs.of(null) : _this.storageAPI.get(_this.gridOptions.gridName);
15740
15781
  return rxjs.combineLatest([agGrid.gridReady, settingsLoader]);
15741
15782
  }), ngxTakeUntilDestroy.untilDestroyed(this))
15742
15783
  .subscribe(function (_a) {
@@ -17031,18 +17072,6 @@
17031
17072
  this.registerGroupListeners();
17032
17073
  this.subscribeRowsSelectionData();
17033
17074
  };
17034
- DatoGridV2ToolbarComponent.prototype.getCellValueChangeEvent = function () {
17035
- var _this = this;
17036
- return this.gridController.gridQuery.waitForGrid(function () {
17037
- return _this.gridQuery.gridRef.cellValueChanged.pipe(operators.debounceTime(100), ngxTakeUntilDestroy.untilDestroyed(_this));
17038
- });
17039
- };
17040
- DatoGridV2ToolbarComponent.prototype.getRowDataUpdatedEvent = function () {
17041
- var _this = this;
17042
- return this.gridController.gridQuery.waitForGrid(function () {
17043
- return _this.gridQuery.gridRef.rowDataUpdated.pipe(operators.debounceTime(100), ngxTakeUntilDestroy.untilDestroyed(_this));
17044
- });
17045
- };
17046
17075
  DatoGridV2ToolbarComponent.prototype.onActionClick = function (action) {
17047
17076
  if (isFunction(action.onClick)) {
17048
17077
  var selectedRowsCount = this.gridController.gridQuery.getSelectedRowsCount();
@@ -21530,40 +21559,6 @@
21530
21559
  * found in the LICENSE file at https://github.com/datorama/client-core/blob/master/LICENSE
21531
21560
  */
21532
21561
 
21533
- var RichTextService = /** @class */ (function () {
21534
- function RichTextService(http, config) {
21535
- this.http = http;
21536
- this.config = config;
21537
- }
21538
- RichTextService.prototype.getLib = function (appendScriptFunc, appendStyleFunc) {
21539
- if (!this.richTextScript$) {
21540
- this.initLib(appendScriptFunc, appendStyleFunc);
21541
- }
21542
- return this.richTextScript$;
21543
- };
21544
- RichTextService.prototype.initLib = function (appendScriptFunc, appendStyleFunc) {
21545
- this.richTextScript$ = rxjs.combineLatest([
21546
- this.http
21547
- .get(this.config.paths.richText + "/index.js", { responseType: 'text' })
21548
- .pipe(operators.tap(function (lib) { return appendScriptFunc(lib, 'rich-text-editor'); })),
21549
- this.http
21550
- .get(this.config.paths.richText + "/plugins/autocomplete/plugin.css", { responseType: 'text' })
21551
- .pipe(operators.tap(function (style) { return appendStyleFunc(style, 'tinymce-autocomplete'); }))
21552
- ]).pipe(operators.shareReplay(1));
21553
- };
21554
- RichTextService.ctorParameters = function () { return [
21555
- { type: http.HttpClient },
21556
- { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] }
21557
- ]; };
21558
- RichTextService.ɵprov = core.ɵɵdefineInjectable({ factory: function RichTextService_Factory() { return new RichTextService(core.ɵɵinject(http.HttpClient), core.ɵɵinject(DATO_CORE_CONFIG)); }, token: RichTextService, providedIn: "root" });
21559
- RichTextService = __decorate([
21560
- core.Injectable({ providedIn: 'root' }),
21561
- __param(1, core.Inject(DATO_CORE_CONFIG)),
21562
- __metadata("design:paramtypes", [http.HttpClient, Object])
21563
- ], RichTextService);
21564
- return RichTextService;
21565
- }());
21566
-
21567
21562
  /**
21568
21563
  * @license
21569
21564
  * Copyright Datorama. All Rights Reserved.
@@ -21577,20 +21572,20 @@
21577
21572
  var ɵ0$3 = getTinymce;
21578
21573
  var DatoRichTextDirective = /** @class */ (function (_super) {
21579
21574
  __extends(DatoRichTextDirective, _super);
21580
- function DatoRichTextDirective(ngZone, richTextService, config, host) {
21575
+ function DatoRichTextDirective(ngZone, http, host, config) {
21581
21576
  var _this = _super.call(this) || this;
21582
21577
  _this.ngZone = ngZone;
21583
- _this.richTextService = richTextService;
21584
- _this.config = config;
21578
+ _this.http = http;
21585
21579
  _this.host = host;
21580
+ _this.config = config;
21586
21581
  _this.autocompleteOptions = {};
21587
21582
  _this.forcePlainTextPasting = false;
21588
21583
  _this.format = 'html';
21589
21584
  _this.isOneLine = false;
21590
21585
  _this.initialValue = '';
21591
- _this.defaultPlugins = 'link fullscreen image lists table autocomplete';
21586
+ _this.defaultPlugins = 'link fullscreen textcolor colorpicker image lists table textpattern autocomplete';
21592
21587
  _this.defaultToolbar = [
21593
- 'fontfamily fontsize forecolor backcolor bold italic underline link',
21588
+ 'fontselect fontsizeselect forecolor backcolor bold italic underline link',
21594
21589
  'alignleft aligncenter alignright alignjustify outdent indent | table numlist bullist | image fullscreen'
21595
21590
  ];
21596
21591
  return _this;
@@ -21616,11 +21611,28 @@
21616
21611
  base: this.config.paths.richText,
21617
21612
  query: ''
21618
21613
  };
21619
- this.richTextService
21620
- .getLib(appendScript, appendStyle)
21621
- .pipe(ngxTakeUntilDestroy.untilDestroyed(this))
21622
- .subscribe(function () {
21623
- _this.init.call(_this);
21614
+ /**
21615
+ * We support only one instance in load time
21616
+ */
21617
+ if (window.tinymce) {
21618
+ this.init.call(this);
21619
+ }
21620
+ else {
21621
+ this.loadLib().subscribe(function (lib) {
21622
+ appendScript(lib, 'rich-text-editor');
21623
+ _this.init.call(_this);
21624
+ _this.loadAutoCompleteStyle();
21625
+ });
21626
+ }
21627
+ };
21628
+ DatoRichTextDirective.prototype.loadLib = function () {
21629
+ return this.http.get(this.config.paths.richText + "/index.js", { responseType: 'text' });
21630
+ };
21631
+ DatoRichTextDirective.prototype.loadAutoCompleteStyle = function () {
21632
+ this.http
21633
+ .get(this.config.paths.richText + "/plugins/autocomplete/plugin.css", { responseType: 'text' })
21634
+ .subscribe(function (style) {
21635
+ appendStyle(style, 'tinymce-autocomplete');
21624
21636
  });
21625
21637
  };
21626
21638
  DatoRichTextDirective.prototype.initEditor = function (_, editor) {
@@ -21644,6 +21656,8 @@
21644
21656
  target: this.host.nativeElement,
21645
21657
  width: this.width || 600,
21646
21658
  height: this.height || 300,
21659
+ force_br_newlines: true,
21660
+ force_p_newlines: false,
21647
21661
  resize: 'both',
21648
21662
  branding: false,
21649
21663
  inline: this.inline,
@@ -21651,12 +21665,10 @@
21651
21665
  readonly: this.disabled,
21652
21666
  plugins: this.plugins || this.defaultPlugins,
21653
21667
  toolbar: isNil(this.toolbar) ? this.defaultToolbar : this.toolbar,
21654
- font_size_formats: '8px 10px 12px 14px 18px 24px 36px',
21668
+ fontsize_formats: '8px 10px 12px 14px 18px 24px 36px',
21655
21669
  min_width: 480,
21656
21670
  menubar: false,
21657
21671
  autocomplete: this.autocompleteOptions,
21658
- suffix: '.min',
21659
- skin: 'tinymce-5',
21660
21672
  setup: function (editor) {
21661
21673
  _this.editor = editor;
21662
21674
  editor.on('init', function (e) {
@@ -21713,9 +21725,9 @@
21713
21725
  var DatoRichTextDirective_1;
21714
21726
  DatoRichTextDirective.ctorParameters = function () { return [
21715
21727
  { type: core.NgZone },
21716
- { type: RichTextService },
21717
- { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] },
21718
- { type: core.ElementRef }
21728
+ { type: http.HttpClient },
21729
+ { type: core.ElementRef },
21730
+ { type: undefined, decorators: [{ type: core.Inject, args: [DATO_CORE_CONFIG,] }] }
21719
21731
  ]; };
21720
21732
  __decorate([
21721
21733
  core.Input(),
@@ -21781,9 +21793,10 @@
21781
21793
  }
21782
21794
  ]
21783
21795
  }),
21784
- __param(2, core.Inject(DATO_CORE_CONFIG)),
21796
+ __param(3, core.Inject(DATO_CORE_CONFIG)),
21785
21797
  __metadata("design:paramtypes", [core.NgZone,
21786
- RichTextService, Object, core.ElementRef])
21798
+ http.HttpClient,
21799
+ core.ElementRef, Object])
21787
21800
  ], DatoRichTextDirective);
21788
21801
  return DatoRichTextDirective;
21789
21802
  }(BaseCustomControl));
@@ -24306,9 +24319,7 @@
24306
24319
  };
24307
24320
  DatoBreadcrumbsComponent.prototype.initEditableHeader = function () {
24308
24321
  var _this = this;
24309
- this.headerControl.valueChanges
24310
- .pipe(operators.debounceTime(300), ngxTakeUntilDestroy.untilDestroyed(this))
24311
- .subscribe(function (res) {
24322
+ this.headerControl.valueChanges.pipe(operators.debounceTime(300), ngxTakeUntilDestroy.untilDestroyed(this)).subscribe(function (res) {
24312
24323
  _this.updateEditableText.emit(res);
24313
24324
  _this.cdr.detectChanges();
24314
24325
  });
@@ -25671,7 +25682,7 @@
25671
25682
  };
25672
25683
  }
25673
25684
 
25674
- window.coreVersion = '22.13.2-rc.';
25685
+ window.coreVersion = '22.12.3';
25675
25686
 
25676
25687
  exports.APP_TRANSLATE = APP_TRANSLATE;
25677
25688
  exports.AceService = AceService;
@@ -25858,6 +25869,7 @@
25858
25869
  exports.DatoSelectComponent = DatoSelectComponent;
25859
25870
  exports.DatoSelectEmptyComponent = DatoSelectEmptyComponent;
25860
25871
  exports.DatoSelectModule = DatoSelectModule;
25872
+ exports.DatoShortNumberPipe = DatoShortNumberPipe;
25861
25873
  exports.DatoSliderComponent = DatoSliderComponent;
25862
25874
  exports.DatoSliderModule = DatoSliderModule;
25863
25875
  exports.DatoSnackbar = DatoSnackbar;
@@ -26065,6 +26077,7 @@
26065
26077
  exports.setMinDimensions = setMinDimensions;
26066
26078
  exports.setStyle = setStyle;
26067
26079
  exports.setStyles = setStyles;
26080
+ exports.shortNumber = shortNumber;
26068
26081
  exports.size = size;
26069
26082
  exports.sortBy = sortBy;
26070
26083
  exports.stubs = stubs;
@@ -26113,7 +26126,6 @@
26113
26126
  exports.ɵl = DatoGridItemsCountCellComponent;
26114
26127
  exports.ɵm = DatoGridV2ToolbarMoreMenuComponent;
26115
26128
  exports.ɵn = DatoGridSearchBarComponent;
26116
- exports.ɵo = RichTextService;
26117
26129
 
26118
26130
  Object.defineProperty(exports, '__esModule', { value: true });
26119
26131