@vendure/admin-ui 3.1.0-next.0 → 3.1.0-next.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.
@@ -3617,23 +3617,18 @@ class ProductDetailComponent extends TypedBaseDetailComponent {
3617
3617
  selectProductFacetValue() {
3618
3618
  this.displayFacetValueModal().subscribe(facetValueIds => {
3619
3619
  if (facetValueIds) {
3620
- const productGroup = this.detailForm;
3621
- const currentFacetValueIds = productGroup.value.facetValueIds ?? [];
3622
- productGroup.patchValue({
3623
- facetValueIds: unique([...currentFacetValueIds, ...facetValueIds]),
3624
- });
3625
- productGroup.markAsDirty();
3626
- this.changeDetector.markForCheck();
3620
+ const facetValueIdsControl = this.detailForm.controls.facetValueIds;
3621
+ const currentFacetValueIds = facetValueIdsControl.value ?? [];
3622
+ facetValueIdsControl.setValue(unique([...currentFacetValueIds, ...facetValueIds]));
3623
+ facetValueIdsControl.markAsDirty();
3627
3624
  }
3628
3625
  });
3629
3626
  }
3630
3627
  removeProductFacetValue(facetValueId) {
3631
- const productGroup = this.detailForm;
3632
- const currentFacetValueIds = productGroup.value.facetValueIds ?? [];
3633
- productGroup.patchValue({
3634
- facetValueIds: currentFacetValueIds.filter(id => id !== facetValueId),
3635
- });
3636
- productGroup.markAsDirty();
3628
+ const facetValueIdsControl = this.detailForm.controls.facetValueIds;
3629
+ const currentFacetValueIds = facetValueIdsControl.value ?? [];
3630
+ facetValueIdsControl.setValue(currentFacetValueIds.filter(id => id !== facetValueId));
3631
+ facetValueIdsControl.markAsDirty();
3637
3632
  }
3638
3633
  displayFacetValueModal() {
3639
3634
  return this.modalService
@@ -3752,7 +3747,9 @@ class ProductDetailComponent extends TypedBaseDetailComponent {
3752
3747
  ...updatedProduct,
3753
3748
  assetIds: this.assetChanges.assets?.map(a => a.id),
3754
3749
  featuredAssetId: this.assetChanges.featuredAsset?.id,
3755
- facetValueIds: productFormGroup.value.facetValueIds,
3750
+ facetValueIds: productFormGroup.controls.facetValueIds.dirty
3751
+ ? productFormGroup.value.facetValueIds
3752
+ : undefined,
3756
3753
  };
3757
3754
  }
3758
3755
  /**
@@ -4337,21 +4334,18 @@ class ProductVariantDetailComponent extends TypedBaseDetailComponent {
4337
4334
  return translation.name;
4338
4335
  }
4339
4336
  removeFacetValue(facetValueId) {
4340
- const productGroup = this.detailForm;
4341
- const currentFacetValueIds = productGroup.value.facetValueIds ?? [];
4342
- productGroup.patchValue({
4343
- facetValueIds: currentFacetValueIds.filter(id => id !== facetValueId),
4344
- });
4345
- productGroup.markAsDirty();
4337
+ const facetValueIdsControl = this.detailForm.controls.facetValueIds;
4338
+ const currentFacetValueIds = facetValueIdsControl.value ?? [];
4339
+ facetValueIdsControl.setValue(currentFacetValueIds.filter(id => id !== facetValueId));
4340
+ facetValueIdsControl.markAsDirty();
4346
4341
  }
4347
4342
  selectFacetValue() {
4348
4343
  this.displayFacetValueModal().subscribe(facetValueIds => {
4349
4344
  if (facetValueIds) {
4350
- const currentFacetValueIds = this.detailForm.value.facetValueIds ?? [];
4351
- this.detailForm.patchValue({
4352
- facetValueIds: unique([...currentFacetValueIds, ...facetValueIds]),
4353
- });
4354
- this.detailForm.markAsDirty();
4345
+ const facetValueIdsControl = this.detailForm.controls.facetValueIds;
4346
+ const currentFacetValueIds = facetValueIdsControl.value ?? [];
4347
+ facetValueIdsControl.setValue(unique([...currentFacetValueIds, ...facetValueIds]));
4348
+ facetValueIdsControl.markAsDirty();
4355
4349
  }
4356
4350
  });
4357
4351
  }
@@ -4418,8 +4412,12 @@ class ProductVariantDetailComponent extends TypedBaseDetailComponent {
4418
4412
  ...updatedProduct,
4419
4413
  assetIds: this.assetChanges.assets?.map(a => a.id),
4420
4414
  featuredAssetId: this.assetChanges.featuredAsset?.id,
4421
- facetValueIds: variantFormGroup.value.facetValueIds,
4422
- taxCategoryId: variantFormGroup.value.taxCategoryId,
4415
+ facetValueIds: variantFormGroup.controls.facetValueIds.dirty
4416
+ ? variantFormGroup.value.facetValueIds
4417
+ : undefined,
4418
+ taxCategoryId: variantFormGroup.controls.taxCategoryId.dirty
4419
+ ? variantFormGroup.value.taxCategoryId
4420
+ : undefined,
4423
4421
  };
4424
4422
  }
4425
4423
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.2.4", ngImport: i0, type: ProductVariantDetailComponent, deps: [{ token: ProductDetailService }, { token: i2.FormBuilder }, { token: i1.ModalService }, { token: i1.NotificationService }, { token: i1.DataService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }