@skyux/lists 5.0.1 → 5.0.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.
@@ -1649,6 +1649,7 @@
1649
1649
  this.repeaterService.repeaterGroupId = uniqueId;
1650
1650
  this.updateForExpandMode();
1651
1651
  this.adapterService.setRepeaterHost(this.elementRef);
1652
+ this.initializeDragAndDrop();
1652
1653
  }
1653
1654
  Object.defineProperty(SkyRepeaterComponent.prototype, "expandMode", {
1654
1655
  get: function () {
@@ -1726,9 +1727,6 @@
1726
1727
  if (this.items) {
1727
1728
  this.items.forEach(function (item) { return item.reorderable = _this.reorderable; });
1728
1729
  }
1729
- if (this.reorderable) {
1730
- this.initializeDragAndDrop();
1731
- }
1732
1730
  this.changeDetector.markForCheck();
1733
1731
  }
1734
1732
  };
@@ -1759,18 +1757,16 @@
1759
1757
  };
1760
1758
  SkyRepeaterComponent.prototype.initializeDragAndDrop = function () {
1761
1759
  var _this = this;
1760
+ /* Sanity check that we haven't already set up dragging abilities */
1761
+ /* istanbul ignore else */
1762
1762
  if (!this.dragulaService.find(this.dragulaGroupName)) {
1763
1763
  this.dragulaService.setOptions(this.dragulaGroupName, {
1764
1764
  moves: function (el, container, handle) {
1765
1765
  var target = el.querySelector('.sky-repeater-item-grab-handle');
1766
- return (target && target.contains(handle));
1766
+ return (_this.reorderable && target && target.contains(handle));
1767
1767
  }
1768
1768
  });
1769
1769
  }
1770
- // Reset the current dragula subscriptions.
1771
- this.dragulaUnsubscribe.next();
1772
- this.dragulaUnsubscribe.complete();
1773
- this.dragulaUnsubscribe = new rxjs.Subject();
1774
1770
  var draggedItemIndex;
1775
1771
  this.dragulaService.drag
1776
1772
  .pipe(operators.takeUntil(this.dragulaUnsubscribe))
@@ -1804,6 +1800,8 @@
1804
1800
  this.dragulaUnsubscribe.next();
1805
1801
  this.dragulaUnsubscribe.complete();
1806
1802
  this.dragulaUnsubscribe = undefined;
1803
+ /* Sanity check that we have set up dragging abilities */
1804
+ /* istanbul ignore else */
1807
1805
  if (this.dragulaService.find(this.dragulaGroupName)) {
1808
1806
  this.dragulaService.destroy(this.dragulaGroupName);
1809
1807
  }
@@ -1825,7 +1823,7 @@
1825
1823
  return SkyRepeaterComponent;
1826
1824
  }());
1827
1825
  SkyRepeaterComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: SkyRepeaterComponent, deps: [{ token: i0__namespace.ChangeDetectorRef }, { token: SkyRepeaterService }, { token: SkyRepeaterAdapterService }, { token: i3__namespace$1.DragulaService }, { token: i0__namespace.ElementRef }, { token: i0__namespace.Renderer2 }], target: i0__namespace.ɵɵFactoryTarget.Component });
1828
- SkyRepeaterComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", type: SkyRepeaterComponent, selector: "sky-repeater", inputs: { activeIndex: "activeIndex", ariaLabel: "ariaLabel", reorderable: "reorderable", expandMode: "expandMode" }, outputs: { activeIndexChange: "activeIndexChange", orderChange: "orderChange" }, providers: [SkyRepeaterService, SkyRepeaterAdapterService], queries: [{ propertyName: "items", predicate: SkyRepeaterItemComponent }], usesOnChanges: true, ngImport: i0__namespace, template: "<ng-container #repeaterHost>\n <div *ngIf=\"!reorderable; else draggable\"\n class=\"sky-repeater\"\n role=\"listbox\"\n [attr.aria-label]=\"ariaLabel || ( 'skyux_repeater_label' | skyLibResources)\"\n >\n <ng-container *ngTemplateOutlet=\"content\">\n </ng-container>\n </div>\n</ng-container>\n\n<ng-template #draggable>\n <div\n class=\"sky-repeater\"\n role=\"listbox\"\n [attr.aria-label]=\"ariaLabel || ( 'skyux_repeater_label' | skyLibResources)\"\n [dragula]=\"dragulaGroupName\"\n >\n <ng-container *ngTemplateOutlet=\"content\">\n </ng-container>\n </div>\n</ng-template>\n\n<ng-template #content>\n <ng-content></ng-content>\n</ng-template>", styles: [".sky-repeater{padding:0}\n"], directives: [{ type: i2__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i3__namespace$1.DragulaDirective, selector: "[dragula]", inputs: ["dragula", "dragulaModel", "dragulaOptions"] }], pipes: { "skyLibResources": i4__namespace.SkyLibResourcesPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1826
+ SkyRepeaterComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.10", type: SkyRepeaterComponent, selector: "sky-repeater", inputs: { activeIndex: "activeIndex", ariaLabel: "ariaLabel", reorderable: "reorderable", expandMode: "expandMode" }, outputs: { activeIndexChange: "activeIndexChange", orderChange: "orderChange" }, providers: [SkyRepeaterService, SkyRepeaterAdapterService], queries: [{ propertyName: "items", predicate: SkyRepeaterItemComponent }], usesOnChanges: true, ngImport: i0__namespace, template: "<ng-container #repeaterHost>\n <div\n class=\"sky-repeater\"\n role=\"listbox\"\n [attr.aria-label]=\"ariaLabel || ( 'skyux_repeater_label' | skyLibResources)\"\n [dragula]=\"dragulaGroupName\"\n >\n <ng-content></ng-content>\n </div>\n</ng-container>\n", styles: [".sky-repeater{padding:0}\n"], directives: [{ type: i3__namespace$1.DragulaDirective, selector: "[dragula]", inputs: ["dragula", "dragulaModel", "dragulaOptions"] }], pipes: { "skyLibResources": i4__namespace.SkyLibResourcesPipe }, changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
1829
1827
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.10", ngImport: i0__namespace, type: SkyRepeaterComponent, decorators: [{
1830
1828
  type: i0.Component,
1831
1829
  args: [{