@haus-tech/product-import-export-plugin 3.0.19 → 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/providers/import-providers/import-parser.d.ts +1 -0
- package/dist/providers/import-providers/import-parser.js +1 -0
- package/dist/providers/import-providers/product-importer.js +1 -0
- package/dist/services/product-export.service.js +2 -1
- package/dist/types.d.ts +1 -1
- package/dist/ui/components/export-dialog.component.d.ts +3 -1
- package/dist/ui/components/export-dialog.component.html +5 -0
- package/dist/ui/components/export-dialog.component.js +18 -0
- package/dist/ui/components/export-dialog.component.ts +23 -0
- package/dist/ui/translations/en.json +2 -1
- package/dist/ui/translations/sv.json +2 -1
- package/package.json +1 -1
|
@@ -377,6 +377,7 @@ let ImportParser = class ImportParser {
|
|
|
377
377
|
price: r.price ? parseNumber(r.price) : undefined,
|
|
378
378
|
taxCategory: parseString(r.taxCategory),
|
|
379
379
|
stockOnHand: parseNumber(r.stockOnHand),
|
|
380
|
+
enabled: parseBoolean(r.enabled),
|
|
380
381
|
trackInventory: r.trackInventory == null || r.trackInventory === ''
|
|
381
382
|
? generated_types_1.GlobalFlag.INHERIT
|
|
382
383
|
: parseBoolean(r.trackInventory)
|
|
@@ -469,6 +469,7 @@ let ProductImporter = class ProductImporter {
|
|
|
469
469
|
taxCategoryId: this.getMatchingTaxCategoryId(variant.taxCategory, taxCategories.items),
|
|
470
470
|
stockOnHand: variant.stockOnHand,
|
|
471
471
|
trackInventory: variant.trackInventory,
|
|
472
|
+
enabled: variant.enabled,
|
|
472
473
|
optionIds,
|
|
473
474
|
translations: await Promise.all(variant.translations.map(async (translation) => {
|
|
474
475
|
const productTranslation = product.translations.find((t) => t.languageCode === translation.languageCode);
|
|
@@ -86,7 +86,7 @@ let ProductExportService = class ProductExportService {
|
|
|
86
86
|
headers.push({ id: 'assets', title: 'assets' }, ...languages.map((lang) => ({ id: `facets:${lang}`, title: `facets:${lang}` })), ...languages.map((lang) => ({ id: `optionGroups:${lang}`, title: `optionGroups:${lang}` })), ...languages.map((lang) => ({ id: `optionValues:${lang}`, title: `optionValues:${lang}` })), { id: 'sku', title: 'sku' }, { id: 'price', title: 'price' }, { id: 'taxCategory', title: 'taxCategory' }, { id: 'stockOnHand', title: 'stockOnHand' }, { id: 'trackInventory', title: 'trackInventory' }, { id: 'variantAssets', title: 'variantAssets' }, ...languages.map((lang) => ({ id: `variantFacets:${lang}`, title: `variantFacets:${lang}` })), ...filteredCustomFieldNames.map((field) => ({
|
|
87
87
|
id: field,
|
|
88
88
|
title: field,
|
|
89
|
-
})));
|
|
89
|
+
})), { id: 'enabled', title: 'enabled' });
|
|
90
90
|
const selectedExportFieldsArray = selectedExportFields.split(',');
|
|
91
91
|
const selectedExportFieldsSet = new Set(selectedExportFieldsArray);
|
|
92
92
|
const filteredHeaders = headers.filter((header) => {
|
|
@@ -212,6 +212,7 @@ let ProductExportService = class ProductExportService {
|
|
|
212
212
|
record.stockOnHand = stockOnHand;
|
|
213
213
|
record.trackInventory = variant.trackInventory.toLowerCase();
|
|
214
214
|
record.variantAssets = variantAssets;
|
|
215
|
+
record.enabled = variant.enabled.toString();
|
|
215
216
|
for (const field of filteredCustomFieldNames) {
|
|
216
217
|
const [entity, fieldName, type] = field.split(':');
|
|
217
218
|
if (entity === 'product') {
|
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 {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ElementRef, AfterViewInit, OnInit } from '@angular/core';
|
|
2
2
|
import { Dialog } from '@vendure/admin-ui/core';
|
|
3
3
|
type ProductFields = 'productId' | 'name' | 'slug' | 'description' | 'assets' | 'facets' | 'optionGroups';
|
|
4
|
-
type VariantFields = 'sku' | 'optionValues' | 'price' | 'taxCategory' | 'stockOnHand' | 'trackInventory' | 'variantAssets' | 'variantFacets';
|
|
4
|
+
type VariantFields = 'sku' | 'optionValues' | 'price' | 'taxCategory' | 'stockOnHand' | 'trackInventory' | 'variantAssets' | 'variantFacets' | 'enabled';
|
|
5
5
|
type ExportFields = Array<ProductFields | VariantFields>;
|
|
6
6
|
interface PluginInitOptions {
|
|
7
7
|
defaultFileName?: string;
|
|
@@ -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
|
|
@@ -39,8 +39,10 @@ let ExportDialogComponent = class ExportDialogComponent {
|
|
|
39
39
|
'trackInventory',
|
|
40
40
|
'variantAssets',
|
|
41
41
|
'variantFacets',
|
|
42
|
+
'enabled',
|
|
42
43
|
];
|
|
43
44
|
config;
|
|
45
|
+
toggleAllChecked = false;
|
|
44
46
|
ngOnInit() {
|
|
45
47
|
this.selectedFields = [...this.customFields];
|
|
46
48
|
if (this.config.defaultExportAssetsAs?.includes(this.config.defaultExportAssetsAs)) {
|
|
@@ -82,6 +84,7 @@ let ExportDialogComponent = class ExportDialogComponent {
|
|
|
82
84
|
else {
|
|
83
85
|
this.selectedFields.push(fieldName);
|
|
84
86
|
}
|
|
87
|
+
this.toggleAllChecked = this.selectedFields.length === this.availableExportFields.length;
|
|
85
88
|
}
|
|
86
89
|
toggleExportFieldSelection(fieldName) {
|
|
87
90
|
const index = this.selectedExportFields.indexOf(fieldName);
|
|
@@ -91,6 +94,21 @@ let ExportDialogComponent = class ExportDialogComponent {
|
|
|
91
94
|
else {
|
|
92
95
|
this.selectedExportFields.push(fieldName);
|
|
93
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
|
+
}
|
|
94
112
|
}
|
|
95
113
|
};
|
|
96
114
|
__decorate([
|
|
@@ -22,6 +22,7 @@ type VariantFields =
|
|
|
22
22
|
| 'trackInventory'
|
|
23
23
|
| 'variantAssets'
|
|
24
24
|
| 'variantFacets'
|
|
25
|
+
| 'enabled'
|
|
25
26
|
|
|
26
27
|
type ExportFields = Array<ProductFields | VariantFields>
|
|
27
28
|
interface PluginInitOptions {
|
|
@@ -81,9 +82,11 @@ export class ExportDialogComponent
|
|
|
81
82
|
'trackInventory',
|
|
82
83
|
'variantAssets',
|
|
83
84
|
'variantFacets',
|
|
85
|
+
'enabled',
|
|
84
86
|
]
|
|
85
87
|
|
|
86
88
|
config: PluginInitOptions
|
|
89
|
+
toggleAllChecked: boolean = false
|
|
87
90
|
|
|
88
91
|
ngOnInit(): void {
|
|
89
92
|
this.selectedFields = [...this.customFields]
|
|
@@ -129,6 +132,8 @@ export class ExportDialogComponent
|
|
|
129
132
|
} else {
|
|
130
133
|
this.selectedFields.push(fieldName)
|
|
131
134
|
}
|
|
135
|
+
|
|
136
|
+
this.toggleAllChecked = this.selectedFields.length === this.availableExportFields.length
|
|
132
137
|
}
|
|
133
138
|
|
|
134
139
|
toggleExportFieldSelection(fieldName: ProductFields | VariantFields) {
|
|
@@ -138,5 +143,23 @@ export class ExportDialogComponent
|
|
|
138
143
|
} else {
|
|
139
144
|
this.selectedExportFields.push(fieldName)
|
|
140
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
|
+
}
|
|
141
164
|
}
|
|
142
165
|
}
|