@datorama/core 22.2.5 → 22.5.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/bundle.scss +22 -0
  2. package/bundles/datorama-core.umd.js +143 -118
  3. package/bundles/datorama-core.umd.js.map +1 -1
  4. package/bundles/datorama-core.umd.min.js +17 -17
  5. package/bundles/datorama-core.umd.min.js.map +1 -1
  6. package/datorama-core.metadata.json +1 -1
  7. package/esm2015/lib/accordion/accordion/accordion.component.js +11 -3
  8. package/esm2015/lib/date-picker/date-picker-container/date-picker-container.component.js +5 -5
  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 +7 -3
  11. package/esm2015/lib/grid-v2/grid-filter/grid-filter.component.js +1 -1
  12. package/esm2015/lib/grid-v2/grid-filter/grid-filter.types.js +1 -1
  13. package/esm2015/lib/grid-v2/grid-store/grid.service.js +1 -1
  14. package/esm2015/lib/grid-v2/grid-toolbar/grid-toolbar.component.js +1 -1
  15. package/esm2015/lib/select/select.component.js +12 -7
  16. package/esm2015/lib/sortable/sortable.component.js +7 -2
  17. package/esm2015/lib/version.js +2 -2
  18. package/esm5/lib/accordion/accordion/accordion.component.js +15 -3
  19. package/esm5/lib/date-picker/date-picker-container/date-picker-container.component.js +5 -5
  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 +7 -3
  22. package/esm5/lib/grid-v2/grid-filter/grid-filter.component.js +1 -1
  23. package/esm5/lib/grid-v2/grid-filter/grid-filter.types.js +1 -1
  24. package/esm5/lib/grid-v2/grid-store/grid.service.js +1 -1
  25. package/esm5/lib/grid-v2/grid-toolbar/grid-toolbar.component.js +1 -1
  26. package/esm5/lib/select/select.component.js +13 -7
  27. package/esm5/lib/sortable/sortable.component.js +7 -2
  28. package/esm5/lib/version.js +2 -2
  29. package/fesm2015/datorama-core.js +132 -112
  30. package/fesm2015/datorama-core.js.map +1 -1
  31. package/fesm5/datorama-core.js +143 -118
  32. package/fesm5/datorama-core.js.map +1 -1
  33. package/lib/accordion/accordion/accordion.component.d.ts +4 -1
  34. package/lib/date-picker/date-picker-container/date-picker-container.component.d.ts +1 -1
  35. package/lib/grid-v2/grid/grid-v2.types.d.ts +2 -1
  36. package/lib/select/select.component.d.ts +1 -0
  37. package/lib/sortable/sortable.component.d.ts +3 -1
  38. package/package.json +1 -1
package/bundle.scss CHANGED
@@ -11199,8 +11199,30 @@ dato-date-picker .icon-text-border {
11199
11199
  border-radius: 2px;
11200
11200
  }
11201
11201
 
11202
+ .dato-date-picker-trigger {
11203
+ font-weight: 600;
11204
+ color: themify(primary-300);
11205
+ }
11206
+
11202
11207
  .dato-date-picker-trigger dato-icon {
11203
11208
  margin-right: 7px;
11209
+ color: themify(primary-300);
11210
+ }
11211
+
11212
+ .dato-date-picker-trigger:hover {
11213
+ color: themify(primary-400);
11214
+ }
11215
+
11216
+ .dato-date-picker-trigger:hover dato-icon {
11217
+ color: themify(primary-400);
11218
+ }
11219
+
11220
+ .dato-date-picker-trigger.open {
11221
+ color: themify(accent-400);
11222
+ }
11223
+
11224
+ .dato-date-picker-trigger.open dato-icon {
11225
+ color: themify(accent-400);
11204
11226
  }
11205
11227
 
11206
11228
  .date-picker-months-0 [datoicon="up"] {
@@ -7609,6 +7609,114 @@
7609
7609
  return false;
7610
7610
  };
7611
7611
 
7612
+ /**
7613
+ * @license
7614
+ * Copyright Datorama. All Rights Reserved.
7615
+ *
7616
+ * Use of this source code is governed by an Apache License 2.0 license that can be
7617
+ * found in the LICENSE file at https://github.com/datorama/client-core/blob/master/LICENSE
7618
+ */
7619
+ var DatoSortableComponent = /** @class */ (function () {
7620
+ function DatoSortableComponent() {
7621
+ this.list = [];
7622
+ this.noop = noop;
7623
+ /**
7624
+ * Sortablejs options
7625
+ */
7626
+ this.datoOptions = {};
7627
+ /**
7628
+ * Fired once items order has changed
7629
+ */
7630
+ this.orderUpdated = new core.EventEmitter();
7631
+ this.defaultOptions = {
7632
+ handle: '.dato-sortable-handler',
7633
+ ghostClass: 'dato-sortable-ghost',
7634
+ chosenClass: 'dato-sortable-chosen',
7635
+ dragClass: 'dato-sortable-drag'
7636
+ };
7637
+ }
7638
+ Object.defineProperty(DatoSortableComponent.prototype, "datoList", {
7639
+ set: function (list) {
7640
+ var isArr = Array.isArray(list);
7641
+ var validInput = isArr || (list instanceof forms.FormControl && Array.isArray(list.value));
7642
+ if (!validInput) {
7643
+ throw new Error("DatoSortable - datoList expected array or form control but got " + typeof list);
7644
+ }
7645
+ if (!isArr) {
7646
+ this.formControl = list;
7647
+ this.list = __spread(this.formControl.value);
7648
+ }
7649
+ else {
7650
+ this.list = list;
7651
+ }
7652
+ },
7653
+ enumerable: true,
7654
+ configurable: true
7655
+ });
7656
+ DatoSortableComponent.prototype.ngOnInit = function () {
7657
+ var _this = this;
7658
+ var _a = this.datoOptions, dynamicGhostHeight = _a.dynamicGhostHeight, hasStaticItems = _a.hasStaticItems, sortableOptions = __rest(_a, ["dynamicGhostHeight", "hasStaticItems"]);
7659
+ var mergedOptions = __assign(__assign(__assign({}, this.defaultOptions), sortableOptions), { onUpdate: function (event) { return (sortableOptions.onUpdate ? sortableOptions.onUpdate(event) : _this.emitUpdate(event)); } });
7660
+ if (dynamicGhostHeight) {
7661
+ mergedOptions.onStart = function (event) { return _this.setGhostHeight(event); };
7662
+ }
7663
+ if (hasStaticItems) {
7664
+ mergedOptions.onMove = function (event) {
7665
+ if (event.related.classList.contains('dato-sortable-static-item')) {
7666
+ return false;
7667
+ }
7668
+ return sortableOptions.onMove ? sortableOptions.onMove(event) : true;
7669
+ };
7670
+ }
7671
+ this.mergedOptions = mergedOptions;
7672
+ };
7673
+ DatoSortableComponent.prototype.emitUpdate = function (event) {
7674
+ if (this.formControl) {
7675
+ this.formControl.setValue(this.list);
7676
+ }
7677
+ this.orderUpdated.emit(event);
7678
+ };
7679
+ DatoSortableComponent.prototype.setGhostHeight = function (event) {
7680
+ var originalEl = event.from.children[event.oldIndex];
7681
+ setStyle(originalEl, 'display', 'block');
7682
+ var height = originalEl.getBoundingClientRect().height;
7683
+ setStyle(originalEl, 'display', 'none');
7684
+ var ghostEl = query('.dato-sortable-ghost');
7685
+ setStyle(ghostEl, 'height', height + "px");
7686
+ };
7687
+ __decorate([
7688
+ core.ContentChildren(DatoAccordionGroupComponent),
7689
+ __metadata("design:type", core.QueryList)
7690
+ ], DatoSortableComponent.prototype, "accordionGroups", void 0);
7691
+ __decorate([
7692
+ core.Input(),
7693
+ __metadata("design:type", Object),
7694
+ __metadata("design:paramtypes", [Object])
7695
+ ], DatoSortableComponent.prototype, "datoList", null);
7696
+ __decorate([
7697
+ core.Input(),
7698
+ __metadata("design:type", Object)
7699
+ ], DatoSortableComponent.prototype, "datoOptions", void 0);
7700
+ __decorate([
7701
+ core.Input(),
7702
+ __metadata("design:type", String)
7703
+ ], DatoSortableComponent.prototype, "containerClass", void 0);
7704
+ __decorate([
7705
+ core.Output(),
7706
+ __metadata("design:type", Object)
7707
+ ], DatoSortableComponent.prototype, "orderUpdated", void 0);
7708
+ DatoSortableComponent = __decorate([
7709
+ core.Component({
7710
+ selector: 'dato-sortable',
7711
+ template: "<section [sortablejs]=\"list\" [sortablejsOptions]=\"mergedOptions\" [ngClass]=\"containerClass\"\n (update.stop)=\"noop()\" (add.stop)=\"noop()\" (sort.stop)=\"noop()\" (remove.stop)=\"noop()\"\n (filter.stop)=\"noop()\" (change.stop)=\"noop()\" (drag.stop)=\"noop()\">\n <ng-content></ng-content>\n</section>",
7712
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
7713
+ encapsulation: core.ViewEncapsulation.None,
7714
+ styles: ["dato-sortable{display:inline-block}dato-sortable .dato-sortable-handler{cursor:move;cursor:-webkit-grabbing}.dato-sortable-ghost>*{display:none!important}.dato-sortable-drag{box-shadow:0 2px 14px 0 rgba(0,0,0,.2)}"]
7715
+ })
7716
+ ], DatoSortableComponent);
7717
+ return DatoSortableComponent;
7718
+ }());
7719
+
7612
7720
  /**
7613
7721
  * @license
7614
7722
  * Copyright Datorama. All Rights Reserved.
@@ -7654,6 +7762,13 @@
7654
7762
  enumerable: true,
7655
7763
  configurable: true
7656
7764
  });
7765
+ Object.defineProperty(DatoAccordionComponent.prototype, "groups", {
7766
+ get: function () {
7767
+ return this.sortable && this.sortable.accordionGroups.length > 0 ? this.sortable.accordionGroups : this.childGroups;
7768
+ },
7769
+ enumerable: true,
7770
+ configurable: true
7771
+ });
7657
7772
  DatoAccordionComponent.prototype.ngOnChanges = function (changes) {
7658
7773
  var _this = this;
7659
7774
  if (changes.expandAll && !changes.expandAll.firstChange) {
@@ -7871,11 +7986,15 @@
7871
7986
  __decorate([
7872
7987
  core.ContentChildren(DatoAccordionGroupComponent),
7873
7988
  __metadata("design:type", core.QueryList)
7874
- ], DatoAccordionComponent.prototype, "groups", void 0);
7989
+ ], DatoAccordionComponent.prototype, "childGroups", void 0);
7875
7990
  __decorate([
7876
7991
  core.ContentChildren(DatoAccordionComponent_1, { descendants: true }),
7877
7992
  __metadata("design:type", core.QueryList)
7878
7993
  ], DatoAccordionComponent.prototype, "childAccordion", void 0);
7994
+ __decorate([
7995
+ core.ContentChild(DatoSortableComponent, { static: true }),
7996
+ __metadata("design:type", DatoSortableComponent)
7997
+ ], DatoAccordionComponent.prototype, "sortable", void 0);
7879
7998
  __decorate([
7880
7999
  core.Input(),
7881
8000
  __metadata("design:type", Object)
@@ -8748,8 +8867,8 @@
8748
8867
  }
8749
8868
  }
8750
8869
  this.onChange(this._model);
8751
- this.datoOverlay.scheduleUpdate();
8752
8870
  this.cdr.markForCheck();
8871
+ this.asyncUpdateDropdownPosition();
8753
8872
  };
8754
8873
  DatoSelectComponent.prototype.reorderOptions = function (newOrder) {
8755
8874
  this._model = newOrder;
@@ -8770,9 +8889,7 @@
8770
8889
  updateDisabled && this.updateDisabledState();
8771
8890
  this.onChange(this._model);
8772
8891
  this.cdr.markForCheck();
8773
- if (this.datoOverlay.attached) {
8774
- this.datoOverlay.scheduleUpdate();
8775
- }
8892
+ this.asyncUpdateDropdownPosition();
8776
8893
  };
8777
8894
  DatoSelectComponent.prototype.preventBodyScroll = function (event) {
8778
8895
  if (isArrowUpDown(event)) {
@@ -9027,7 +9144,7 @@
9027
9144
  _this.searchTerm = value;
9028
9145
  _this.keyManager.setActiveItem(-1);
9029
9146
  _this.cdr.markForCheck();
9030
- _this.datoOverlay && _this.datoOverlay.scheduleUpdate();
9147
+ _this.asyncUpdateDropdownPosition();
9031
9148
  });
9032
9149
  };
9033
9150
  /**
@@ -9131,7 +9248,7 @@
9131
9248
  updateDisabled && this.updateDisabledState();
9132
9249
  this.onChange(this._model);
9133
9250
  this.cdr.markForCheck();
9134
- this.datoOverlay.scheduleUpdate();
9251
+ this.asyncUpdateDropdownPosition();
9135
9252
  };
9136
9253
  DatoSelectComponent.prototype.activateInfiniteScroll = function () {
9137
9254
  var _this = this;
@@ -9184,6 +9301,14 @@
9184
9301
  finally { if (e_9) throw e_9.error; }
9185
9302
  }
9186
9303
  };
9304
+ // Make sure the overlay will be update AFTER Change Detection was done
9305
+ // So the items in the input (and its height) is update
9306
+ DatoSelectComponent.prototype.asyncUpdateDropdownPosition = function () {
9307
+ var _this = this;
9308
+ if (this.datoOverlay && this.datoOverlay.attached) {
9309
+ setTimeout(function () { return _this.datoOverlay.scheduleUpdate(); }, 0);
9310
+ }
9311
+ };
9187
9312
  DatoSelectComponent.ctorParameters = function () { return [
9188
9313
  { type: core.ChangeDetectorRef },
9189
9314
  { type: DatoTranslateService },
@@ -10176,110 +10301,6 @@
10176
10301
  return DatoOptionsModule;
10177
10302
  }());
10178
10303
 
10179
- /**
10180
- * @license
10181
- * Copyright Datorama. All Rights Reserved.
10182
- *
10183
- * Use of this source code is governed by an Apache License 2.0 license that can be
10184
- * found in the LICENSE file at https://github.com/datorama/client-core/blob/master/LICENSE
10185
- */
10186
- var DatoSortableComponent = /** @class */ (function () {
10187
- function DatoSortableComponent() {
10188
- this.list = [];
10189
- this.noop = noop;
10190
- /**
10191
- * Sortablejs options
10192
- */
10193
- this.datoOptions = {};
10194
- /**
10195
- * Fired once items order has changed
10196
- */
10197
- this.orderUpdated = new core.EventEmitter();
10198
- this.defaultOptions = {
10199
- handle: '.dato-sortable-handler',
10200
- ghostClass: 'dato-sortable-ghost',
10201
- chosenClass: 'dato-sortable-chosen',
10202
- dragClass: 'dato-sortable-drag'
10203
- };
10204
- }
10205
- Object.defineProperty(DatoSortableComponent.prototype, "datoList", {
10206
- set: function (list) {
10207
- var isArr = Array.isArray(list);
10208
- var validInput = isArr || (list instanceof forms.FormControl && Array.isArray(list.value));
10209
- if (!validInput) {
10210
- throw new Error("DatoSortable - datoList expected array or form control but got " + typeof list);
10211
- }
10212
- if (!isArr) {
10213
- this.formControl = list;
10214
- this.list = __spread(this.formControl.value);
10215
- }
10216
- else {
10217
- this.list = list;
10218
- }
10219
- },
10220
- enumerable: true,
10221
- configurable: true
10222
- });
10223
- DatoSortableComponent.prototype.ngOnInit = function () {
10224
- var _this = this;
10225
- var _a = this.datoOptions, dynamicGhostHeight = _a.dynamicGhostHeight, hasStaticItems = _a.hasStaticItems, sortableOptions = __rest(_a, ["dynamicGhostHeight", "hasStaticItems"]);
10226
- var mergedOptions = __assign(__assign(__assign({}, this.defaultOptions), sortableOptions), { onUpdate: function (event) { return (sortableOptions.onUpdate ? sortableOptions.onUpdate(event) : _this.emitUpdate(event)); } });
10227
- if (dynamicGhostHeight) {
10228
- mergedOptions.onStart = function (event) { return _this.setGhostHeight(event); };
10229
- }
10230
- if (hasStaticItems) {
10231
- mergedOptions.onMove = function (event) {
10232
- if (event.related.classList.contains('dato-sortable-static-item')) {
10233
- return false;
10234
- }
10235
- return sortableOptions.onMove ? sortableOptions.onMove(event) : true;
10236
- };
10237
- }
10238
- this.mergedOptions = mergedOptions;
10239
- };
10240
- DatoSortableComponent.prototype.emitUpdate = function (event) {
10241
- if (this.formControl) {
10242
- this.formControl.setValue(this.list);
10243
- }
10244
- this.orderUpdated.emit(event);
10245
- };
10246
- DatoSortableComponent.prototype.setGhostHeight = function (event) {
10247
- var originalEl = event.from.children[event.oldIndex];
10248
- setStyle(originalEl, 'display', 'block');
10249
- var height = originalEl.getBoundingClientRect().height;
10250
- setStyle(originalEl, 'display', 'none');
10251
- var ghostEl = query('.dato-sortable-ghost');
10252
- setStyle(ghostEl, 'height', height + "px");
10253
- };
10254
- __decorate([
10255
- core.Input(),
10256
- __metadata("design:type", Object),
10257
- __metadata("design:paramtypes", [Object])
10258
- ], DatoSortableComponent.prototype, "datoList", null);
10259
- __decorate([
10260
- core.Input(),
10261
- __metadata("design:type", Object)
10262
- ], DatoSortableComponent.prototype, "datoOptions", void 0);
10263
- __decorate([
10264
- core.Input(),
10265
- __metadata("design:type", String)
10266
- ], DatoSortableComponent.prototype, "containerClass", void 0);
10267
- __decorate([
10268
- core.Output(),
10269
- __metadata("design:type", Object)
10270
- ], DatoSortableComponent.prototype, "orderUpdated", void 0);
10271
- DatoSortableComponent = __decorate([
10272
- core.Component({
10273
- selector: 'dato-sortable',
10274
- template: "<section [sortablejs]=\"list\" [sortablejsOptions]=\"mergedOptions\" [ngClass]=\"containerClass\"\n (update.stop)=\"noop()\" (add.stop)=\"noop()\" (sort.stop)=\"noop()\" (remove.stop)=\"noop()\"\n (filter.stop)=\"noop()\" (change.stop)=\"noop()\" (drag.stop)=\"noop()\">\n <ng-content></ng-content>\n</section>",
10275
- changeDetection: core.ChangeDetectionStrategy.OnPush,
10276
- encapsulation: core.ViewEncapsulation.None,
10277
- styles: ["dato-sortable{display:inline-block}dato-sortable .dato-sortable-handler{cursor:move;cursor:-webkit-grabbing}.dato-sortable-ghost>*{display:none!important}.dato-sortable-drag{box-shadow:0 2px 14px 0 rgba(0,0,0,.2)}"]
10278
- })
10279
- ], DatoSortableComponent);
10280
- return DatoSortableComponent;
10281
- }());
10282
-
10283
10304
  /**
10284
10305
  * @license
10285
10306
  * Copyright Datorama. All Rights Reserved.
@@ -15618,8 +15639,12 @@
15618
15639
  var settingsDiff = _this.gridService.getSettingsDiff();
15619
15640
  _this.gridService.updateSettings(settingsDiff);
15620
15641
  var data = _this.getGridData();
15621
- _this.onGridChange.emit(__assign(__assign({}, settingsDiff), { filter: _this.gridQuery.getExternalFilter(), type: type,
15622
- data: data }));
15642
+ _this.onGridChange.emit({
15643
+ filter: _this.gridQuery.getExternalFilter(),
15644
+ sort: _this.gridQuery.getSort(),
15645
+ type: type,
15646
+ data: data
15647
+ });
15623
15648
  });
15624
15649
  };
15625
15650
  DatoGridControllerComponent.prototype.listenToStoreSettingsChanges = function () {
@@ -18466,9 +18491,11 @@
18466
18491
  .subscribe(function (event) {
18467
18492
  _this.toggle.emit(event);
18468
18493
  _this.open = false;
18494
+ _this.cdr.detectChanges();
18469
18495
  _this.input && _this.setInputValue();
18470
18496
  });
18471
18497
  this.open = true;
18498
+ this.cdr.detectChanges();
18472
18499
  this.input && this.handleEnter();
18473
18500
  }
18474
18501
  };
@@ -18522,9 +18549,7 @@
18522
18549
  };
18523
18550
  DatoDatePickerContainerComponent.prototype.handleEnter = function () {
18524
18551
  var _this = this;
18525
- this.input.keydown$
18526
- .pipe(operators.filter(isEnter), operators.takeUntil(this.toggle))
18527
- .subscribe(function () {
18552
+ this.input.keydown$.pipe(operators.filter(isEnter), operators.takeUntil(this.toggle)).subscribe(function () {
18528
18553
  _this.setInputValue();
18529
18554
  _this.popover.closeById(DATE_PICKER_POPOVER_ID);
18530
18555
  _this.input.blur();
@@ -18589,7 +18614,7 @@
18589
18614
  DatoDatePickerContainerComponent = __decorate([
18590
18615
  core.Component({
18591
18616
  selector: 'dato-date-picker',
18592
- template: "<div class=\"d-flex {{ triggerStyle }} items-center dato-date-picker-trigger\" (click)=\"openDatepicker(origin)\" #origin\n [class.pointer]=\"!viewMode\">\n <ng-template #defaultView>\n <dato-icon datoIcon=\"calendarcore\" width=\"16px\" class=\"primary-400-color\"></dato-icon>\n <div class=\"ellipsis\"\n [datoTooltip]=\"dateLabel + ' ' + dateRange\"\n [datoTooltipPosition]=\"labelTooltipPosition\"\n [datoTooltipOnTextOverflow]=\"true\">\n <span class=\"dato-note date-label\" *ngIf=\"dateLabel\">{{dateLabel | translate}}&nbsp;</span>\n <span class=\"dato-note date-range\">{{dateRange}}</span>\n </div>\n </ng-template>\n\n <ng-template [ngTemplateOutlet]=\"triggerTpl ? triggerTpl : defaultView\"\n [ngTemplateOutletContext]=\"{label: dateLabel, range: dateRange, icon: 'calendar'}\"></ng-template>\n </div>\n",
18617
+ template: "<div class=\"d-flex {{ triggerStyle }} items-center dato-date-picker-trigger\" [class.open]=\"open\" (click)=\"openDatepicker(origin)\" #origin\n [class.pointer]=\"!viewMode\">\n <ng-template #defaultView>\n <dato-icon datoIcon=\"calendarcore\" width=\"16px\" class=\"primary-400-color\"></dato-icon>\n <div class=\"ellipsis\"\n [datoTooltip]=\"dateLabel + ' ' + dateRange\"\n [datoTooltipPosition]=\"labelTooltipPosition\"\n [datoTooltipOnTextOverflow]=\"true\">\n <span class=\"dato-note date-label\" *ngIf=\"dateLabel\">{{dateLabel | translate}}&nbsp;</span>\n <span class=\"dato-note date-range\">{{dateRange}}</span>\n </div>\n </ng-template>\n\n <ng-template [ngTemplateOutlet]=\"triggerTpl ? triggerTpl : defaultView\"\n [ngTemplateOutletContext]=\"{label: dateLabel, range: dateRange, icon: 'calendar'}\"></ng-template>\n </div>\n",
18593
18618
  changeDetection: core.ChangeDetectionStrategy.OnPush
18594
18619
  }),
18595
18620
  __param(0, core.Self()), __param(0, core.Optional()),
@@ -25382,7 +25407,7 @@
25382
25407
  };
25383
25408
  }
25384
25409
 
25385
- window.coreVersion = '22.2.5';
25410
+ window.coreVersion = '22.5.2';
25386
25411
 
25387
25412
  exports.APP_TRANSLATE = APP_TRANSLATE;
25388
25413
  exports.AceService = AceService;