@haus-tech/product-import-export-plugin 3.0.18 → 3.0.20

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.
package/dist/types.d.ts CHANGED
@@ -36,6 +36,6 @@ export type JsonAsset = {
36
36
  };
37
37
  type ExportFields = Array<ProductFields | VariantFields>;
38
38
  type ProductFields = 'productId' | 'name' | 'slug' | 'description' | 'assets' | 'facets' | 'optionGroups';
39
- type VariantFields = 'sku' | 'optionValues' | 'price' | 'taxCategory' | 'stockOnHand' | 'trackInventory' | 'variantAssets' | 'variantFacets';
39
+ type VariantFields = 'sku' | 'optionValues' | 'price' | 'taxCategory' | 'stockOnHand' | 'trackInventory' | 'variantAssets' | 'variantFacets' | 'enabled';
40
40
  export type UpdatingStrategy = 'replace' | 'merge';
41
41
  export {};
@@ -33,11 +33,13 @@ export declare class ExportDialogComponent implements Dialog<{
33
33
  selectedExportFields: ExportFields;
34
34
  availableExportFields: ExportFields;
35
35
  config: PluginInitOptions;
36
+ toggleAllChecked: boolean;
36
37
  ngOnInit(): void;
37
38
  ngAfterViewInit(): void;
38
39
  export(): void;
39
40
  cancel(): void;
40
41
  toggleFieldSelection(fieldName: string): void;
41
42
  toggleExportFieldSelection(fieldName: ProductFields | VariantFields): void;
43
+ toggleSelectAll(event: Event): void;
42
44
  }
43
45
  export {};
@@ -11,6 +11,11 @@
11
11
  </vdr-form-field>
12
12
  </div>
13
13
 
14
+ <div class="input-row" style="margin-top: 16px">
15
+ <input type="checkbox" (change)="toggleSelectAll($event)" [checked]="toggleAllChecked" />
16
+ {{ 'product-export.dialog.selectAll' | translate }}
17
+ </div>
18
+
14
19
  <div class="input-row" style="margin-top: 16px">
15
20
  <label style="margin-bottom: 8px; display: inline-block">{{
16
21
  'product-export.dialog.availableExportFieldsLabel' | translate
@@ -42,6 +42,7 @@ let ExportDialogComponent = class ExportDialogComponent {
42
42
  'enabled',
43
43
  ];
44
44
  config;
45
+ toggleAllChecked = false;
45
46
  ngOnInit() {
46
47
  this.selectedFields = [...this.customFields];
47
48
  if (this.config.defaultExportAssetsAs?.includes(this.config.defaultExportAssetsAs)) {
@@ -83,6 +84,7 @@ let ExportDialogComponent = class ExportDialogComponent {
83
84
  else {
84
85
  this.selectedFields.push(fieldName);
85
86
  }
87
+ this.toggleAllChecked = this.selectedFields.length === this.availableExportFields.length;
86
88
  }
87
89
  toggleExportFieldSelection(fieldName) {
88
90
  const index = this.selectedExportFields.indexOf(fieldName);
@@ -92,6 +94,21 @@ let ExportDialogComponent = class ExportDialogComponent {
92
94
  else {
93
95
  this.selectedExportFields.push(fieldName);
94
96
  }
97
+ this.toggleAllChecked = this.selectedExportFields.length === this.availableExportFields.length;
98
+ }
99
+ toggleSelectAll(event) {
100
+ const isChecked = event.target.checked;
101
+ this.toggleAllChecked = isChecked;
102
+ if (isChecked) {
103
+ this.selectedExportFields = [...this.availableExportFields];
104
+ this.selectedFields = [...this.customFields];
105
+ }
106
+ else {
107
+ this.selectedExportFields = [
108
+ ...this.availableExportFields.filter((field) => this.config.requiredExportFields?.includes(field)),
109
+ ];
110
+ this.selectedFields = [];
111
+ }
95
112
  }
96
113
  };
97
114
  __decorate([
@@ -86,6 +86,7 @@ export class ExportDialogComponent
86
86
  ]
87
87
 
88
88
  config: PluginInitOptions
89
+ toggleAllChecked: boolean = false
89
90
 
90
91
  ngOnInit(): void {
91
92
  this.selectedFields = [...this.customFields]
@@ -131,6 +132,8 @@ export class ExportDialogComponent
131
132
  } else {
132
133
  this.selectedFields.push(fieldName)
133
134
  }
135
+
136
+ this.toggleAllChecked = this.selectedFields.length === this.availableExportFields.length
134
137
  }
135
138
 
136
139
  toggleExportFieldSelection(fieldName: ProductFields | VariantFields) {
@@ -140,5 +143,23 @@ export class ExportDialogComponent
140
143
  } else {
141
144
  this.selectedExportFields.push(fieldName)
142
145
  }
146
+
147
+ this.toggleAllChecked = this.selectedExportFields.length === this.availableExportFields.length
148
+ }
149
+
150
+ toggleSelectAll(event: Event) {
151
+ const isChecked = (event.target as HTMLInputElement).checked
152
+ this.toggleAllChecked = isChecked
153
+ if (isChecked) {
154
+ this.selectedExportFields = [...this.availableExportFields]
155
+ this.selectedFields = [...this.customFields]
156
+ } else {
157
+ this.selectedExportFields = [
158
+ ...this.availableExportFields.filter((field) =>
159
+ this.config.requiredExportFields?.includes(field),
160
+ ),
161
+ ]
162
+ this.selectedFields = []
163
+ }
143
164
  }
144
165
  }
@@ -46,7 +46,8 @@
46
46
  "url": "URL",
47
47
  "json": "JSON"
48
48
  },
49
- "availableExportFieldsLabel": "Fields to export"
49
+ "availableExportFieldsLabel": "Fields to export",
50
+ "selectAll": "Select all"
50
51
  }
51
52
  }
52
53
  }
@@ -46,7 +46,8 @@
46
46
  "url": "URL",
47
47
  "json": "JSON"
48
48
  },
49
- "availableExportFieldsLabel": "Fält att exportera"
49
+ "availableExportFieldsLabel": "Fält att exportera",
50
+ "selectAll": "Välj alla"
50
51
  }
51
52
  }
52
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haus-tech/product-import-export-plugin",
3
- "version": "3.0.18",
3
+ "version": "3.0.20",
4
4
  "description": "A Vendure plugin for importing and exporting products using a CSV file",
5
5
  "author": "Haus Tech",
6
6
  "repository": {