@datorama/core 22.5.1 → 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.
@@ -7410,6 +7410,114 @@ var defaultClientSearchStrategy = function (searchIn, searchValue, labelKey) {
7410
7410
  return false;
7411
7411
  };
7412
7412
 
7413
+ /**
7414
+ * @license
7415
+ * Copyright Datorama. All Rights Reserved.
7416
+ *
7417
+ * Use of this source code is governed by an Apache License 2.0 license that can be
7418
+ * found in the LICENSE file at https://github.com/datorama/client-core/blob/master/LICENSE
7419
+ */
7420
+ var DatoSortableComponent = /** @class */ (function () {
7421
+ function DatoSortableComponent() {
7422
+ this.list = [];
7423
+ this.noop = noop;
7424
+ /**
7425
+ * Sortablejs options
7426
+ */
7427
+ this.datoOptions = {};
7428
+ /**
7429
+ * Fired once items order has changed
7430
+ */
7431
+ this.orderUpdated = new EventEmitter();
7432
+ this.defaultOptions = {
7433
+ handle: '.dato-sortable-handler',
7434
+ ghostClass: 'dato-sortable-ghost',
7435
+ chosenClass: 'dato-sortable-chosen',
7436
+ dragClass: 'dato-sortable-drag'
7437
+ };
7438
+ }
7439
+ Object.defineProperty(DatoSortableComponent.prototype, "datoList", {
7440
+ set: function (list) {
7441
+ var isArr = Array.isArray(list);
7442
+ var validInput = isArr || (list instanceof FormControl && Array.isArray(list.value));
7443
+ if (!validInput) {
7444
+ throw new Error("DatoSortable - datoList expected array or form control but got " + typeof list);
7445
+ }
7446
+ if (!isArr) {
7447
+ this.formControl = list;
7448
+ this.list = __spread(this.formControl.value);
7449
+ }
7450
+ else {
7451
+ this.list = list;
7452
+ }
7453
+ },
7454
+ enumerable: true,
7455
+ configurable: true
7456
+ });
7457
+ DatoSortableComponent.prototype.ngOnInit = function () {
7458
+ var _this = this;
7459
+ var _a = this.datoOptions, dynamicGhostHeight = _a.dynamicGhostHeight, hasStaticItems = _a.hasStaticItems, sortableOptions = __rest(_a, ["dynamicGhostHeight", "hasStaticItems"]);
7460
+ var mergedOptions = __assign(__assign(__assign({}, this.defaultOptions), sortableOptions), { onUpdate: function (event) { return (sortableOptions.onUpdate ? sortableOptions.onUpdate(event) : _this.emitUpdate(event)); } });
7461
+ if (dynamicGhostHeight) {
7462
+ mergedOptions.onStart = function (event) { return _this.setGhostHeight(event); };
7463
+ }
7464
+ if (hasStaticItems) {
7465
+ mergedOptions.onMove = function (event) {
7466
+ if (event.related.classList.contains('dato-sortable-static-item')) {
7467
+ return false;
7468
+ }
7469
+ return sortableOptions.onMove ? sortableOptions.onMove(event) : true;
7470
+ };
7471
+ }
7472
+ this.mergedOptions = mergedOptions;
7473
+ };
7474
+ DatoSortableComponent.prototype.emitUpdate = function (event) {
7475
+ if (this.formControl) {
7476
+ this.formControl.setValue(this.list);
7477
+ }
7478
+ this.orderUpdated.emit(event);
7479
+ };
7480
+ DatoSortableComponent.prototype.setGhostHeight = function (event) {
7481
+ var originalEl = event.from.children[event.oldIndex];
7482
+ setStyle(originalEl, 'display', 'block');
7483
+ var height = originalEl.getBoundingClientRect().height;
7484
+ setStyle(originalEl, 'display', 'none');
7485
+ var ghostEl = query('.dato-sortable-ghost');
7486
+ setStyle(ghostEl, 'height', height + "px");
7487
+ };
7488
+ __decorate([
7489
+ ContentChildren(DatoAccordionGroupComponent),
7490
+ __metadata("design:type", QueryList)
7491
+ ], DatoSortableComponent.prototype, "accordionGroups", void 0);
7492
+ __decorate([
7493
+ Input(),
7494
+ __metadata("design:type", Object),
7495
+ __metadata("design:paramtypes", [Object])
7496
+ ], DatoSortableComponent.prototype, "datoList", null);
7497
+ __decorate([
7498
+ Input(),
7499
+ __metadata("design:type", Object)
7500
+ ], DatoSortableComponent.prototype, "datoOptions", void 0);
7501
+ __decorate([
7502
+ Input(),
7503
+ __metadata("design:type", String)
7504
+ ], DatoSortableComponent.prototype, "containerClass", void 0);
7505
+ __decorate([
7506
+ Output(),
7507
+ __metadata("design:type", Object)
7508
+ ], DatoSortableComponent.prototype, "orderUpdated", void 0);
7509
+ DatoSortableComponent = __decorate([
7510
+ Component({
7511
+ selector: 'dato-sortable',
7512
+ 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>",
7513
+ changeDetection: ChangeDetectionStrategy.OnPush,
7514
+ encapsulation: ViewEncapsulation.None,
7515
+ 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)}"]
7516
+ })
7517
+ ], DatoSortableComponent);
7518
+ return DatoSortableComponent;
7519
+ }());
7520
+
7413
7521
  /**
7414
7522
  * @license
7415
7523
  * Copyright Datorama. All Rights Reserved.
@@ -7455,6 +7563,13 @@ var DatoAccordionComponent = /** @class */ (function () {
7455
7563
  enumerable: true,
7456
7564
  configurable: true
7457
7565
  });
7566
+ Object.defineProperty(DatoAccordionComponent.prototype, "groups", {
7567
+ get: function () {
7568
+ return this.sortable && this.sortable.accordionGroups.length > 0 ? this.sortable.accordionGroups : this.childGroups;
7569
+ },
7570
+ enumerable: true,
7571
+ configurable: true
7572
+ });
7458
7573
  DatoAccordionComponent.prototype.ngOnChanges = function (changes) {
7459
7574
  var _this = this;
7460
7575
  if (changes.expandAll && !changes.expandAll.firstChange) {
@@ -7672,11 +7787,15 @@ var DatoAccordionComponent = /** @class */ (function () {
7672
7787
  __decorate([
7673
7788
  ContentChildren(DatoAccordionGroupComponent),
7674
7789
  __metadata("design:type", QueryList)
7675
- ], DatoAccordionComponent.prototype, "groups", void 0);
7790
+ ], DatoAccordionComponent.prototype, "childGroups", void 0);
7676
7791
  __decorate([
7677
7792
  ContentChildren(DatoAccordionComponent_1, { descendants: true }),
7678
7793
  __metadata("design:type", QueryList)
7679
7794
  ], DatoAccordionComponent.prototype, "childAccordion", void 0);
7795
+ __decorate([
7796
+ ContentChild(DatoSortableComponent, { static: true }),
7797
+ __metadata("design:type", DatoSortableComponent)
7798
+ ], DatoAccordionComponent.prototype, "sortable", void 0);
7680
7799
  __decorate([
7681
7800
  Input(),
7682
7801
  __metadata("design:type", Object)
@@ -9983,110 +10102,6 @@ var DatoOptionsModule = /** @class */ (function () {
9983
10102
  return DatoOptionsModule;
9984
10103
  }());
9985
10104
 
9986
- /**
9987
- * @license
9988
- * Copyright Datorama. All Rights Reserved.
9989
- *
9990
- * Use of this source code is governed by an Apache License 2.0 license that can be
9991
- * found in the LICENSE file at https://github.com/datorama/client-core/blob/master/LICENSE
9992
- */
9993
- var DatoSortableComponent = /** @class */ (function () {
9994
- function DatoSortableComponent() {
9995
- this.list = [];
9996
- this.noop = noop;
9997
- /**
9998
- * Sortablejs options
9999
- */
10000
- this.datoOptions = {};
10001
- /**
10002
- * Fired once items order has changed
10003
- */
10004
- this.orderUpdated = new EventEmitter();
10005
- this.defaultOptions = {
10006
- handle: '.dato-sortable-handler',
10007
- ghostClass: 'dato-sortable-ghost',
10008
- chosenClass: 'dato-sortable-chosen',
10009
- dragClass: 'dato-sortable-drag'
10010
- };
10011
- }
10012
- Object.defineProperty(DatoSortableComponent.prototype, "datoList", {
10013
- set: function (list) {
10014
- var isArr = Array.isArray(list);
10015
- var validInput = isArr || (list instanceof FormControl && Array.isArray(list.value));
10016
- if (!validInput) {
10017
- throw new Error("DatoSortable - datoList expected array or form control but got " + typeof list);
10018
- }
10019
- if (!isArr) {
10020
- this.formControl = list;
10021
- this.list = __spread(this.formControl.value);
10022
- }
10023
- else {
10024
- this.list = list;
10025
- }
10026
- },
10027
- enumerable: true,
10028
- configurable: true
10029
- });
10030
- DatoSortableComponent.prototype.ngOnInit = function () {
10031
- var _this = this;
10032
- var _a = this.datoOptions, dynamicGhostHeight = _a.dynamicGhostHeight, hasStaticItems = _a.hasStaticItems, sortableOptions = __rest(_a, ["dynamicGhostHeight", "hasStaticItems"]);
10033
- var mergedOptions = __assign(__assign(__assign({}, this.defaultOptions), sortableOptions), { onUpdate: function (event) { return (sortableOptions.onUpdate ? sortableOptions.onUpdate(event) : _this.emitUpdate(event)); } });
10034
- if (dynamicGhostHeight) {
10035
- mergedOptions.onStart = function (event) { return _this.setGhostHeight(event); };
10036
- }
10037
- if (hasStaticItems) {
10038
- mergedOptions.onMove = function (event) {
10039
- if (event.related.classList.contains('dato-sortable-static-item')) {
10040
- return false;
10041
- }
10042
- return sortableOptions.onMove ? sortableOptions.onMove(event) : true;
10043
- };
10044
- }
10045
- this.mergedOptions = mergedOptions;
10046
- };
10047
- DatoSortableComponent.prototype.emitUpdate = function (event) {
10048
- if (this.formControl) {
10049
- this.formControl.setValue(this.list);
10050
- }
10051
- this.orderUpdated.emit(event);
10052
- };
10053
- DatoSortableComponent.prototype.setGhostHeight = function (event) {
10054
- var originalEl = event.from.children[event.oldIndex];
10055
- setStyle(originalEl, 'display', 'block');
10056
- var height = originalEl.getBoundingClientRect().height;
10057
- setStyle(originalEl, 'display', 'none');
10058
- var ghostEl = query('.dato-sortable-ghost');
10059
- setStyle(ghostEl, 'height', height + "px");
10060
- };
10061
- __decorate([
10062
- Input(),
10063
- __metadata("design:type", Object),
10064
- __metadata("design:paramtypes", [Object])
10065
- ], DatoSortableComponent.prototype, "datoList", null);
10066
- __decorate([
10067
- Input(),
10068
- __metadata("design:type", Object)
10069
- ], DatoSortableComponent.prototype, "datoOptions", void 0);
10070
- __decorate([
10071
- Input(),
10072
- __metadata("design:type", String)
10073
- ], DatoSortableComponent.prototype, "containerClass", void 0);
10074
- __decorate([
10075
- Output(),
10076
- __metadata("design:type", Object)
10077
- ], DatoSortableComponent.prototype, "orderUpdated", void 0);
10078
- DatoSortableComponent = __decorate([
10079
- Component({
10080
- selector: 'dato-sortable',
10081
- 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>",
10082
- changeDetection: ChangeDetectionStrategy.OnPush,
10083
- encapsulation: ViewEncapsulation.None,
10084
- 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)}"]
10085
- })
10086
- ], DatoSortableComponent);
10087
- return DatoSortableComponent;
10088
- }());
10089
-
10090
10105
  /**
10091
10106
  * @license
10092
10107
  * Copyright Datorama. All Rights Reserved.
@@ -25193,7 +25208,7 @@ function fixNgLeaks() {
25193
25208
  };
25194
25209
  }
25195
25210
 
25196
- window.coreVersion = '22.5.1';
25211
+ window.coreVersion = '22.5.2';
25197
25212
 
25198
25213
  /**
25199
25214
  * @license