@wizishop/angular-components 0.0.202 → 0.0.204

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.
@@ -4571,26 +4571,36 @@
4571
4571
 
4572
4572
  var DraganddropListComponent = /** @class */ (function () {
4573
4573
  function DraganddropListComponent() {
4574
- this.disable = false;
4574
+ this.disabled = false;
4575
4575
  this.backgroundColor = '#fff';
4576
4576
  this.showTriggerSave = false;
4577
4577
  this.itemsChange = new i0.EventEmitter();
4578
4578
  }
4579
+ DraganddropListComponent.prototype.ngOnInit = function () {
4580
+ this.setTempCopy();
4581
+ };
4579
4582
  DraganddropListComponent.prototype.drop = function (event) {
4580
- if (!this.disable) {
4583
+ if (!this.disabled) {
4581
4584
  dragDrop.moveItemInArray(this.items, event.previousIndex, event.currentIndex);
4582
4585
  this.itemsChange.emit(this.items);
4586
+ this.setTempCopy();
4583
4587
  }
4584
4588
  };
4585
4589
  DraganddropListComponent.prototype.delete = function (index) {
4586
- if (!this.disable) {
4590
+ if (!this.disabled) {
4587
4591
  this.items = this.items.filter(function (value, i) { return i !== index; });
4588
4592
  this.itemsChange.emit(this.items);
4593
+ this.setTempCopy();
4589
4594
  }
4590
4595
  };
4591
4596
  DraganddropListComponent.prototype.saveField = function (index, event) {
4597
+ this.copyTemps[index] = event.target.value;
4598
+ this.itemsChange.emit(this.copyTemps);
4599
+ };
4600
+ DraganddropListComponent.prototype.saveFieldEnd = function (index, event) {
4592
4601
  this.items[index] = event.target.value;
4593
4602
  this.itemsChange.emit(this.items);
4603
+ this.setTempCopy();
4594
4604
  };
4595
4605
  DraganddropListComponent.prototype.addField = function () {
4596
4606
  this.showTriggerSave = true;
@@ -4598,20 +4608,24 @@
4598
4608
  DraganddropListComponent.prototype.saveNewField = function (event) {
4599
4609
  this.items.push(event.target.value);
4600
4610
  this.itemsChange.emit(this.items);
4611
+ this.setTempCopy();
4601
4612
  this.showTriggerSave = false;
4602
4613
  };
4614
+ DraganddropListComponent.prototype.setTempCopy = function () {
4615
+ this.copyTemps = Object.assign({}, this.items);
4616
+ };
4603
4617
  return DraganddropListComponent;
4604
4618
  }());
4605
4619
  DraganddropListComponent.decorators = [
4606
4620
  { type: i0.Component, args: [{
4607
4621
  selector: 'wac-draganddrop-list',
4608
- template: "<div class=\"wac-draganddrop-list\" *ngIf=\"!disable\" [style.backgroundColor]=\"backgroundColor\">\n <div class=\"wac-draganddrop-list__wrapper\" [cdkDropListLockAxis]=\"'y'\" cdkDropList (cdkDropListDropped)=\"drop($event)\">\n <div class=\"wac-draganddrop-list__wrapper__item\" [style.backgroundColor]=\"backgroundColor\" *ngFor=\"let item of items;let i = index;\" cdkDrag>\n <div>\n <span class=\"wac-draganddrop-list__wrapper__item__icon\">\n <span></span>\n </span>\n <span (mousedown)=\"$event.stopPropagation()\" class=\"wac-draganddrop-list__wrapper__item__input\">\n <wac-input [value]=\"item\" [extraClasses]=\"'transparent'\" (keyup.enter)=\"saveField(i, $event)\" (focusout)=\"saveField(i, $event)\"></wac-input>\n </span>\n </div>\n <div (mousedown)=\"$event.stopPropagation()\">\n <wac-button [iconFontSize]=\"'14px'\" [opacity]=\"true\" [icon]=\"'fa-regular fa-trash-can'\" [extraClasses]=\"'is-danger'\" (click)=\"delete(i)\"></wac-button>\n </div>\n </div>\n <div class=\"wac-draganddrop-list__wrapper__item wac-draganddrop-list__wrapper__item--trigger\" *ngIf=\"showTriggerSave\">\n <div>\n <span class=\"wac-draganddrop-list__wrapper__item__icon\">\n <span></span>\n </span>\n <span class=\"wac-draganddrop-list__wrapper__item__input\">\n <wac-input [extraClasses]=\"'transparent'\" (keyup.enter)=\"saveNewField($event)\" (focusout)=\"saveNewField($event)\"></wac-input>\n </span>\n </div>\n </div>\n </div>\n <div class=\"wac-draganddrop-list__add\" *ngIf=\"max && !showTriggerSave\">\n <div class=\"wac-draganddrop-list__add__btn\" *ngIf=\"max > items.length\">\n <wac-button [extraClasses]=\"'is-success'\" [label]=\"labelBtnAdd\" (click)=\"addField()\"></wac-button>\n </div>\n </div>\n</div>\n\n<div class=\"wac-draganddrop-list wac-draganddrop-list--disabled\" *ngIf=\"disable\">\n <div class=\"wac-draganddrop-list__wrapper\">\n <div class=\"wac-draganddrop-list__wrapper__item\" *ngFor=\"let item of items;let i = index;\">\n <div>\n <span class=\"wac-draganddrop-list__wrapper__item__label\" [innerHTML]=\"item\"></span>\n </div>\n </div>\n </div>\n</div>\n",
4622
+ template: "<div class=\"wac-draganddrop-list\" *ngIf=\"!disabled\" [style.backgroundColor]=\"backgroundColor\">\n <div class=\"wac-draganddrop-list__wrapper\" [cdkDropListLockAxis]=\"'y'\" cdkDropList (cdkDropListDropped)=\"drop($event)\">\n <div class=\"wac-draganddrop-list__wrapper__item\" [style.backgroundColor]=\"backgroundColor\" *ngFor=\"let item of items;let i = index;\" cdkDrag>\n <div>\n <span class=\"wac-draganddrop-list__wrapper__item__icon\">\n <span></span>\n </span>\n <span (mousedown)=\"$event.stopPropagation()\" class=\"wac-draganddrop-list__wrapper__item__input\">\n <wac-input [value]=\"item\" [extraClasses]=\"'transparent'\" (keydown)=\"saveField(i, $event)\" (focusout)=\"saveFieldEnd(i, $event)\"></wac-input>\n </span>\n </div>\n <div (mousedown)=\"$event.stopPropagation()\">\n <wac-button [iconFontSize]=\"'14px'\" [opacity]=\"true\" [icon]=\"'fa-regular fa-trash-can'\" [extraClasses]=\"'is-danger'\" (click)=\"delete(i)\"></wac-button>\n </div>\n </div>\n <div class=\"wac-draganddrop-list__wrapper__item wac-draganddrop-list__wrapper__item--trigger\" *ngIf=\"showTriggerSave\">\n <div>\n <span class=\"wac-draganddrop-list__wrapper__item__icon\">\n <span></span>\n </span>\n <span class=\"wac-draganddrop-list__wrapper__item__input\">\n <wac-input [extraClasses]=\"'transparent'\" (keyup.enter)=\"saveNewField($event)\" (focusout)=\"saveNewField($event)\"></wac-input>\n </span>\n </div>\n </div>\n </div>\n <div class=\"wac-draganddrop-list__add\" *ngIf=\"max && !showTriggerSave\">\n <div class=\"wac-draganddrop-list__add__btn\" *ngIf=\"max > items.length\">\n <wac-button [extraClasses]=\"'is-success'\" [label]=\"labelBtnAdd\" (click)=\"addField()\"></wac-button>\n </div>\n </div>\n</div>\n\n<div class=\"wac-draganddrop-list wac-draganddrop-list--disabled\" *ngIf=\"disabled\">\n <div class=\"wac-draganddrop-list__wrapper\">\n <div class=\"wac-draganddrop-list__wrapper__item\" *ngFor=\"let item of items;let i = index;\">\n <div>\n <span class=\"wac-draganddrop-list__wrapper__item__label\" [innerHTML]=\"item\"></span>\n </div>\n </div>\n </div>\n</div>\n",
4609
4623
  changeDetection: i0.ChangeDetectionStrategy.OnPush
4610
4624
  },] }
4611
4625
  ];
4612
4626
  DraganddropListComponent.propDecorators = {
4613
4627
  items: [{ type: i0.Input }],
4614
- disable: [{ type: i0.Input }],
4628
+ disabled: [{ type: i0.Input }],
4615
4629
  max: [{ type: i0.Input }],
4616
4630
  labelBtnAdd: [{ type: i0.Input }],
4617
4631
  backgroundColor: [{ type: i0.Input }],