ng-miam 4.0.2 → 4.0.3

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.
@@ -1358,7 +1358,7 @@
1358
1358
  if (this.currentSubscription) {
1359
1359
  this.currentSubscription.unsubscribe();
1360
1360
  }
1361
- this.currentSubscription = this.get(endpoint).pipe(operators.skipWhile(function (l) { return l.is_loading; }), operators.tap(function (l) { return _this.assignList(l); })).subscribe();
1361
+ this.currentSubscription = this.get(endpoint + '&include=groceries-entries').pipe(operators.skipWhile(function (l) { return l.is_loading; }), operators.tap(function (l) { return _this.assignList(l); })).subscribe();
1362
1362
  return this._list$;
1363
1363
  };
1364
1364
  GroceriesListsService.prototype.resetList = function () {
@@ -13826,14 +13826,20 @@
13826
13826
  }
13827
13827
  this.loading = true;
13828
13828
  this.cdr.detectChanges();
13829
- this.listsService.addEntriesFromPicture(file, ['groceries-entries'], this.disableIngredientsMatching).subscribe(function (list) {
13830
- var addedEntries = list.entries.data.filter(function (entry) { return !entry.recipesIds || entry.recipesIds.length === 0; });
13831
- _this.loading = false;
13832
- _this.entriesAdded.emit(addedEntries);
13829
+ // takeFirstList to make sure the list is initialised before checking its value
13830
+ this.listsService.takeFirstList().subscribe(function (currentList) {
13831
+ var precedentEntries = currentList.entries.data;
13832
+ _this.listsService.addEntriesFromPicture(file, ['groceries-entries'], _this.disableIngredientsMatching).subscribe(function (list) {
13833
+ var addedEntries = list.entries.data
13834
+ // Remove entries that were already present in the same quantities before
13835
+ .filter(function (entry) { return -1 === precedentEntries.findIndex(function (e) { return e.id === entry.id; }); });
13836
+ _this.loading = false;
13837
+ _this.entriesAdded.emit(addedEntries);
13838
+ _this.cdr.detectChanges();
13839
+ });
13840
+ event.target.value = null;
13833
13841
  _this.cdr.detectChanges();
13834
13842
  });
13835
- event.target.value = null;
13836
- this.cdr.detectChanges();
13837
13843
  };
13838
13844
  return ListScanFilesInputsComponent;
13839
13845
  }());
@@ -14182,6 +14188,7 @@
14182
14188
  this.basketsService = basketsService;
14183
14189
  this.entries = [];
14184
14190
  this.closed = new i0.EventEmitter();
14191
+ this.cancelled = new i0.EventEmitter();
14185
14192
  this.icon = exports.Icon;
14186
14193
  this.lines = [];
14187
14194
  this.unavailable = [];
@@ -14208,6 +14215,9 @@
14208
14215
  ListScanBasketPreviewComponent.prototype.close = function () {
14209
14216
  this.closed.emit();
14210
14217
  };
14218
+ ListScanBasketPreviewComponent.prototype.cancel = function () {
14219
+ this.cancelled.emit();
14220
+ };
14211
14221
  // Remove groceries entry from entries array, and line from lines array
14212
14222
  ListScanBasketPreviewComponent.prototype.deleteEntry = function (line) {
14213
14223
  var _this = this;
@@ -14227,12 +14237,12 @@
14227
14237
  return ListScanBasketPreviewComponent;
14228
14238
  }());
14229
14239
  ListScanBasketPreviewComponent.ɵfac = function ListScanBasketPreviewComponent_Factory(t) { return new (t || ListScanBasketPreviewComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(BasketsService)); };
14230
- ListScanBasketPreviewComponent.ɵcmp = i0.ɵɵdefineComponent({ type: ListScanBasketPreviewComponent, selectors: [["ng-miam-list-scan-basket-preview"]], inputs: { entries: "entries" }, outputs: { closed: "closed" }, decls: 13, vars: 8, consts: [[1, "miam-list-scan__basket-preview"], [1, "miam-list-scan__basket-preview__header"], ["width", "24", "height", "24", 3, "iconName", "click"], [1, "miam-list-scan__basket-preview__content", 3, "ngClass"], [4, "ngFor", "ngForOf"], [3, "entries", 4, "ngIf"], [1, "miam-list-scan__basket-preview__controls"], [1, "m-button-primary", 3, "click"], ["width", "24", "height", "24", 3, "iconName"], [3, "line", "removed", "replaceItem", 4, "ngIf"], [3, "line", "selected", 4, "ngIf"], [3, "line", "removed", "replaceItem"], [3, "line", "selected"], [3, "entries"]], template: function ListScanBasketPreviewComponent_Template(rf, ctx) {
14240
+ ListScanBasketPreviewComponent.ɵcmp = i0.ɵɵdefineComponent({ type: ListScanBasketPreviewComponent, selectors: [["ng-miam-list-scan-basket-preview"]], inputs: { entries: "entries" }, outputs: { closed: "closed", cancelled: "cancelled" }, decls: 13, vars: 8, consts: [[1, "miam-list-scan__basket-preview"], [1, "miam-list-scan__basket-preview__header"], ["width", "24", "height", "24", 3, "iconName", "click"], [1, "miam-list-scan__basket-preview__content", 3, "ngClass"], [4, "ngFor", "ngForOf"], [3, "entries", 4, "ngIf"], [1, "miam-list-scan__basket-preview__controls"], [1, "m-button-primary", 3, "click"], ["width", "24", "height", "24", 3, "iconName"], [3, "line", "removed", "replaceItem", 4, "ngIf"], [3, "line", "selected", 4, "ngIf"], [3, "line", "removed", "replaceItem"], [3, "line", "selected"], [3, "entries"]], template: function ListScanBasketPreviewComponent_Template(rf, ctx) {
14231
14241
  if (rf & 1) {
14232
14242
  i0.ɵɵelementStart(0, "div", 0);
14233
14243
  i0.ɵɵelementStart(1, "div", 1);
14234
14244
  i0.ɵɵelementStart(2, "ng-miam-icon", 2);
14235
- i0.ɵɵlistener("click", function ListScanBasketPreviewComponent_Template_ng_miam_icon_click_2_listener() { return ctx.replaceItemCurrentLine ? ctx.toggleReplacing(ctx.replaceItemCurrentLine) : ctx.close(); });
14245
+ i0.ɵɵlistener("click", function ListScanBasketPreviewComponent_Template_ng_miam_icon_click_2_listener() { return ctx.replaceItemCurrentLine ? ctx.toggleReplacing(ctx.replaceItemCurrentLine) : ctx.cancel(); });
14236
14246
  i0.ɵɵelementEnd();
14237
14247
  i0.ɵɵelementStart(3, "h3");
14238
14248
  i0.ɵɵtext(4);
@@ -14282,6 +14292,8 @@
14282
14292
  type: i0.Input
14283
14293
  }], closed: [{
14284
14294
  type: i0.Output
14295
+ }], cancelled: [{
14296
+ type: i0.Output
14285
14297
  }] });
14286
14298
  })();
14287
14299
 
@@ -14325,7 +14337,7 @@
14325
14337
  if (rf & 1) {
14326
14338
  var _r12_1 = i0.ɵɵgetCurrentView();
14327
14339
  i0.ɵɵelementStart(0, "ng-miam-list-scan-basket-preview", 9);
14328
- i0.ɵɵlistener("closed", function ListScanComponent_ng_miam_list_scan_basket_preview_5_Template_ng_miam_list_scan_basket_preview_closed_0_listener() { i0.ɵɵrestoreView(_r12_1); var ctx_r11 = i0.ɵɵnextContext(); return ctx_r11.hideBasketPreview(); });
14340
+ i0.ɵɵlistener("closed", function ListScanComponent_ng_miam_list_scan_basket_preview_5_Template_ng_miam_list_scan_basket_preview_closed_0_listener() { i0.ɵɵrestoreView(_r12_1); var ctx_r11 = i0.ɵɵnextContext(); return ctx_r11.hideBasketPreview(); })("cancel", function ListScanComponent_ng_miam_list_scan_basket_preview_5_Template_ng_miam_list_scan_basket_preview_cancel_0_listener() { i0.ɵɵrestoreView(_r12_1); var ctx_r13 = i0.ɵɵnextContext(); return ctx_r13.returnToIngredients(); });
14329
14341
  i0.ɵɵelementEnd();
14330
14342
  }
14331
14343
  if (rf & 2) {
@@ -14353,6 +14365,11 @@
14353
14365
  this.ingredientsShown = false;
14354
14366
  this.cdr.detectChanges();
14355
14367
  };
14368
+ ListScanComponent.prototype.returnToIngredients = function () {
14369
+ this.basketPreviewShown = false;
14370
+ this.ingredientsShown = true;
14371
+ this.cdr.detectChanges();
14372
+ };
14356
14373
  ListScanComponent.prototype.showBasketPreview = function () {
14357
14374
  this.basketPreviewShown = true;
14358
14375
  this.hideIngredients();
@@ -14365,7 +14382,7 @@
14365
14382
  return ListScanComponent;
14366
14383
  }());
14367
14384
  ListScanComponent.ɵfac = function ListScanComponent_Factory(t) { return new (t || ListScanComponent)(i0.ɵɵdirectiveInject(i0.ChangeDetectorRef)); };
14368
- ListScanComponent.ɵcmp = i0.ɵɵdefineComponent({ type: ListScanComponent, selectors: [["ng-miam-list-scan"]], inputs: { floatingButton: "floatingButton", overlay: "overlay", disableIngredientsMatching: "disableIngredientsMatching" }, outputs: { close: "close" }, decls: 6, vars: 8, consts: [[1, "miam-list-scan"], [3, "disableIngredientsMatching", "entriesAdded", 4, "ngIf"], [3, "overlay", "entriesAdded", 4, "ngIf"], [3, "isAngularComponent", "noHeaderMode", "expanded", "expandedChange"], ["class", "miam-list-scan__content", 3, "entries", "closed", "confirmed", 4, "ngIf"], ["class", "miam-list-scan__content", 3, "entries", "closed", 4, "ngIf"], [3, "disableIngredientsMatching", "entriesAdded"], [3, "overlay", "entriesAdded"], [1, "miam-list-scan__content", 3, "entries", "closed", "confirmed"], [1, "miam-list-scan__content", 3, "entries", "closed"]], template: function ListScanComponent_Template(rf, ctx) {
14385
+ ListScanComponent.ɵcmp = i0.ɵɵdefineComponent({ type: ListScanComponent, selectors: [["ng-miam-list-scan"]], inputs: { floatingButton: "floatingButton", overlay: "overlay", disableIngredientsMatching: "disableIngredientsMatching" }, outputs: { close: "close" }, decls: 6, vars: 8, consts: [[1, "miam-list-scan"], [3, "disableIngredientsMatching", "entriesAdded", 4, "ngIf"], [3, "overlay", "entriesAdded", 4, "ngIf"], [3, "isAngularComponent", "noHeaderMode", "expanded", "expandedChange"], ["class", "miam-list-scan__content", 3, "entries", "closed", "confirmed", 4, "ngIf"], ["class", "miam-list-scan__content", 3, "entries", "closed", "cancel", 4, "ngIf"], [3, "disableIngredientsMatching", "entriesAdded"], [3, "overlay", "entriesAdded"], [1, "miam-list-scan__content", 3, "entries", "closed", "confirmed"], [1, "miam-list-scan__content", 3, "entries", "closed", "cancel"]], template: function ListScanComponent_Template(rf, ctx) {
14369
14386
  if (rf & 1) {
14370
14387
  i0.ɵɵelementStart(0, "div", 0);
14371
14388
  i0.ɵɵtemplate(1, ListScanComponent_ng_miam_list_scan_files_inputs_1_Template, 1, 1, "ng-miam-list-scan-files-inputs", 1);