@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.
@@ -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)
@@ -10182,110 +10301,6 @@
10182
10301
  return DatoOptionsModule;
10183
10302
  }());
10184
10303
 
10185
- /**
10186
- * @license
10187
- * Copyright Datorama. All Rights Reserved.
10188
- *
10189
- * Use of this source code is governed by an Apache License 2.0 license that can be
10190
- * found in the LICENSE file at https://github.com/datorama/client-core/blob/master/LICENSE
10191
- */
10192
- var DatoSortableComponent = /** @class */ (function () {
10193
- function DatoSortableComponent() {
10194
- this.list = [];
10195
- this.noop = noop;
10196
- /**
10197
- * Sortablejs options
10198
- */
10199
- this.datoOptions = {};
10200
- /**
10201
- * Fired once items order has changed
10202
- */
10203
- this.orderUpdated = new core.EventEmitter();
10204
- this.defaultOptions = {
10205
- handle: '.dato-sortable-handler',
10206
- ghostClass: 'dato-sortable-ghost',
10207
- chosenClass: 'dato-sortable-chosen',
10208
- dragClass: 'dato-sortable-drag'
10209
- };
10210
- }
10211
- Object.defineProperty(DatoSortableComponent.prototype, "datoList", {
10212
- set: function (list) {
10213
- var isArr = Array.isArray(list);
10214
- var validInput = isArr || (list instanceof forms.FormControl && Array.isArray(list.value));
10215
- if (!validInput) {
10216
- throw new Error("DatoSortable - datoList expected array or form control but got " + typeof list);
10217
- }
10218
- if (!isArr) {
10219
- this.formControl = list;
10220
- this.list = __spread(this.formControl.value);
10221
- }
10222
- else {
10223
- this.list = list;
10224
- }
10225
- },
10226
- enumerable: true,
10227
- configurable: true
10228
- });
10229
- DatoSortableComponent.prototype.ngOnInit = function () {
10230
- var _this = this;
10231
- var _a = this.datoOptions, dynamicGhostHeight = _a.dynamicGhostHeight, hasStaticItems = _a.hasStaticItems, sortableOptions = __rest(_a, ["dynamicGhostHeight", "hasStaticItems"]);
10232
- var mergedOptions = __assign(__assign(__assign({}, this.defaultOptions), sortableOptions), { onUpdate: function (event) { return (sortableOptions.onUpdate ? sortableOptions.onUpdate(event) : _this.emitUpdate(event)); } });
10233
- if (dynamicGhostHeight) {
10234
- mergedOptions.onStart = function (event) { return _this.setGhostHeight(event); };
10235
- }
10236
- if (hasStaticItems) {
10237
- mergedOptions.onMove = function (event) {
10238
- if (event.related.classList.contains('dato-sortable-static-item')) {
10239
- return false;
10240
- }
10241
- return sortableOptions.onMove ? sortableOptions.onMove(event) : true;
10242
- };
10243
- }
10244
- this.mergedOptions = mergedOptions;
10245
- };
10246
- DatoSortableComponent.prototype.emitUpdate = function (event) {
10247
- if (this.formControl) {
10248
- this.formControl.setValue(this.list);
10249
- }
10250
- this.orderUpdated.emit(event);
10251
- };
10252
- DatoSortableComponent.prototype.setGhostHeight = function (event) {
10253
- var originalEl = event.from.children[event.oldIndex];
10254
- setStyle(originalEl, 'display', 'block');
10255
- var height = originalEl.getBoundingClientRect().height;
10256
- setStyle(originalEl, 'display', 'none');
10257
- var ghostEl = query('.dato-sortable-ghost');
10258
- setStyle(ghostEl, 'height', height + "px");
10259
- };
10260
- __decorate([
10261
- core.Input(),
10262
- __metadata("design:type", Object),
10263
- __metadata("design:paramtypes", [Object])
10264
- ], DatoSortableComponent.prototype, "datoList", null);
10265
- __decorate([
10266
- core.Input(),
10267
- __metadata("design:type", Object)
10268
- ], DatoSortableComponent.prototype, "datoOptions", void 0);
10269
- __decorate([
10270
- core.Input(),
10271
- __metadata("design:type", String)
10272
- ], DatoSortableComponent.prototype, "containerClass", void 0);
10273
- __decorate([
10274
- core.Output(),
10275
- __metadata("design:type", Object)
10276
- ], DatoSortableComponent.prototype, "orderUpdated", void 0);
10277
- DatoSortableComponent = __decorate([
10278
- core.Component({
10279
- selector: 'dato-sortable',
10280
- 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>",
10281
- changeDetection: core.ChangeDetectionStrategy.OnPush,
10282
- encapsulation: core.ViewEncapsulation.None,
10283
- 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)}"]
10284
- })
10285
- ], DatoSortableComponent);
10286
- return DatoSortableComponent;
10287
- }());
10288
-
10289
10304
  /**
10290
10305
  * @license
10291
10306
  * Copyright Datorama. All Rights Reserved.
@@ -25392,7 +25407,7 @@
25392
25407
  };
25393
25408
  }
25394
25409
 
25395
- window.coreVersion = '22.5.1';
25410
+ window.coreVersion = '22.5.2';
25396
25411
 
25397
25412
  exports.APP_TRANSLATE = APP_TRANSLATE;
25398
25413
  exports.AceService = AceService;