@vendure/admin-ui 1.9.4 → 1.9.6
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/bundles/vendure-admin-ui-catalog.umd.js +93 -45
- package/bundles/vendure-admin-ui-catalog.umd.js.map +1 -1
- package/bundles/vendure-admin-ui-core.umd.js +1 -1
- package/bundles/vendure-admin-ui-core.umd.js.map +1 -1
- package/bundles/vendure-admin-ui-login.umd.js +1 -1
- package/bundles/vendure-admin-ui-login.umd.js.map +1 -1
- package/bundles/vendure-admin-ui-settings.umd.js +43 -3
- package/bundles/vendure-admin-ui-settings.umd.js.map +1 -1
- package/catalog/components/product-options-editor/product-options-editor.component.d.ts +5 -2
- package/catalog/vendure-admin-ui-catalog.metadata.json +1 -1
- package/core/common/version.d.ts +1 -1
- package/core/vendure-admin-ui-core.metadata.json +1 -1
- package/esm2015/catalog/components/product-options-editor/product-options-editor.component.js +74 -29
- package/esm2015/core/common/version.js +2 -2
- package/esm2015/core/shared/components/dropdown/dropdown.component.js +1 -1
- package/esm2015/login/components/login/login.component.js +2 -2
- package/esm2015/settings/components/administrator-list/administrator-list.component.js +47 -7
- package/fesm2015/vendure-admin-ui-catalog.js +73 -28
- package/fesm2015/vendure-admin-ui-catalog.js.map +1 -1
- package/fesm2015/vendure-admin-ui-core.js +1 -1
- package/fesm2015/vendure-admin-ui-core.js.map +1 -1
- package/fesm2015/vendure-admin-ui-login.js +1 -1
- package/fesm2015/vendure-admin-ui-login.js.map +1 -1
- package/fesm2015/vendure-admin-ui-settings.js +45 -6
- package/fesm2015/vendure-admin-ui-settings.js.map +1 -1
- package/login/vendure-admin-ui-login.metadata.json +1 -1
- package/package.json +2 -2
- package/settings/components/administrator-list/administrator-list.component.d.ts +17 -2
- package/settings/vendure-admin-ui-settings.metadata.json +1 -1
- package/static/i18n-messages/cs.json +3 -2
- package/static/i18n-messages/de.json +4 -3
- package/static/i18n-messages/en.json +3 -2
- package/static/i18n-messages/es.json +3 -2
- package/static/i18n-messages/fr.json +3 -2
- package/static/i18n-messages/it.json +3 -2
- package/static/i18n-messages/pl.json +3 -2
- package/static/i18n-messages/pt_BR.json +3 -2
- package/static/i18n-messages/pt_PT.json +3 -2
- package/static/i18n-messages/ru.json +3 -2
- package/static/i18n-messages/uk.json +3 -2
- package/static/i18n-messages/zh_Hans.json +3 -2
- package/static/i18n-messages/zh_Hant.json +3 -2
|
@@ -2049,10 +2049,10 @@ class ProductOptionsEditorComponent extends BaseDetailComponent {
|
|
|
2049
2049
|
const $product = this.dataService.product.getProduct(this.id).mapSingle(data => data.product);
|
|
2050
2050
|
combineLatest(this.entity$, this.languageCode$, $product)
|
|
2051
2051
|
.pipe(take(1), mergeMap(([{ optionGroups }, languageCode, product]) => {
|
|
2052
|
-
var _a
|
|
2052
|
+
var _a;
|
|
2053
2053
|
const updateOperations = [];
|
|
2054
2054
|
for (const optionGroupForm of this.getOptionGroups()) {
|
|
2055
|
-
if (
|
|
2055
|
+
if (optionGroupForm.dirty) {
|
|
2056
2056
|
const optionGroupEntity = optionGroups.find(og => og.id === optionGroupForm.value.id);
|
|
2057
2057
|
if (optionGroupEntity) {
|
|
2058
2058
|
const input = this.getUpdatedOptionGroup(optionGroupEntity, optionGroupForm, languageCode);
|
|
@@ -2060,9 +2060,9 @@ class ProductOptionsEditorComponent extends BaseDetailComponent {
|
|
|
2060
2060
|
}
|
|
2061
2061
|
}
|
|
2062
2062
|
for (const optionForm of this.getOptions(optionGroupForm)) {
|
|
2063
|
-
if (
|
|
2064
|
-
const optionGroup = (
|
|
2065
|
-
.find(og => og.id === optionGroupForm.value.id)) === null ||
|
|
2063
|
+
if (optionForm.dirty) {
|
|
2064
|
+
const optionGroup = (_a = optionGroups
|
|
2065
|
+
.find(og => og.id === optionGroupForm.value.id)) === null || _a === void 0 ? void 0 : _a.options.find(o => o.id === optionForm.value.id);
|
|
2066
2066
|
if (optionGroup) {
|
|
2067
2067
|
const input = this.getUpdatedOption(optionGroup, optionForm, languageCode);
|
|
2068
2068
|
updateOperations.push(this.productDetailService.updateProductOption(Object.assign(Object.assign({}, input), { autoUpdate: this.autoUpdateVariantNames }), product, languageCode));
|
|
@@ -2101,7 +2101,7 @@ class ProductOptionsEditorComponent extends BaseDetailComponent {
|
|
|
2101
2101
|
const input = createUpdatedTranslatable({
|
|
2102
2102
|
translatable: option,
|
|
2103
2103
|
updatedFields: optionFormGroup.value,
|
|
2104
|
-
customFieldConfig: this.
|
|
2104
|
+
customFieldConfig: this.optionCustomFields,
|
|
2105
2105
|
languageCode,
|
|
2106
2106
|
defaultTranslation: {
|
|
2107
2107
|
languageCode,
|
|
@@ -2111,39 +2111,84 @@ class ProductOptionsEditorComponent extends BaseDetailComponent {
|
|
|
2111
2111
|
return input;
|
|
2112
2112
|
}
|
|
2113
2113
|
setFormValues(entity, languageCode) {
|
|
2114
|
-
const
|
|
2114
|
+
const groupsForm = this.detailForm.get('optionGroups');
|
|
2115
2115
|
for (const optionGroup of entity.optionGroups) {
|
|
2116
2116
|
const groupTranslation = findTranslation(optionGroup, languageCode);
|
|
2117
|
-
const
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
}
|
|
2124
|
-
const optionsFormArray = new FormArray([]);
|
|
2117
|
+
const groupForm = this.setOptionGroupForm(optionGroup, groupsForm, groupTranslation);
|
|
2118
|
+
this.setCustomFieldsForm(this.optionGroupCustomFields, groupForm, optionGroup, groupTranslation);
|
|
2119
|
+
let optionsForm = groupForm.get('options');
|
|
2120
|
+
if (!optionsForm) {
|
|
2121
|
+
optionsForm = this.formBuilder.array([]);
|
|
2122
|
+
groupForm.addControl('options', optionsForm);
|
|
2123
|
+
}
|
|
2125
2124
|
for (const option of optionGroup.options) {
|
|
2126
2125
|
const optionTranslation = findTranslation(option, languageCode);
|
|
2127
|
-
const
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2126
|
+
const optionForm = this.setOptionForm(option, optionsForm, optionTranslation);
|
|
2127
|
+
this.setCustomFieldsForm(this.optionCustomFields, optionForm, option, optionTranslation);
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
setCustomFieldsForm(customFields, formGroup, entity, currentTranslation) {
|
|
2132
|
+
if (customFields.length) {
|
|
2133
|
+
let customValueFieldsGroup = formGroup.get(['customFields']);
|
|
2134
|
+
if (!customValueFieldsGroup) {
|
|
2135
|
+
customValueFieldsGroup = this.formBuilder.group(customFields.reduce((hash, field) => (Object.assign(Object.assign({}, hash), { [field.name]: '' })), {}));
|
|
2136
|
+
formGroup.addControl('customFields', customValueFieldsGroup);
|
|
2135
2137
|
}
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2138
|
+
this.setCustomFieldFormValues(customFields, customValueFieldsGroup, entity, currentTranslation);
|
|
2139
|
+
}
|
|
2140
|
+
}
|
|
2141
|
+
setOptionGroupForm(entity, groupsForm, currentTranslation) {
|
|
2142
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2143
|
+
const group = {
|
|
2144
|
+
id: entity.id,
|
|
2145
|
+
createdAt: entity.createdAt,
|
|
2146
|
+
updatedAt: entity.updatedAt,
|
|
2147
|
+
code: entity.code,
|
|
2148
|
+
name: (_a = currentTranslation === null || currentTranslation === void 0 ? void 0 : currentTranslation.name) !== null && _a !== void 0 ? _a : '',
|
|
2149
|
+
};
|
|
2150
|
+
let groupForm = groupsForm.controls.find(control => control.value.id === entity.id);
|
|
2151
|
+
if (groupForm) {
|
|
2152
|
+
(_b = groupForm.get('id')) === null || _b === void 0 ? void 0 : _b.setValue(group.id);
|
|
2153
|
+
(_c = groupForm.get('code')) === null || _c === void 0 ? void 0 : _c.setValue(group.code);
|
|
2154
|
+
(_d = groupForm.get('name')) === null || _d === void 0 ? void 0 : _d.setValue(group.name);
|
|
2155
|
+
(_e = groupForm.get('createdAt')) === null || _e === void 0 ? void 0 : _e.setValue(group.name);
|
|
2156
|
+
(_f = groupForm.get('updatedAt')) === null || _f === void 0 ? void 0 : _f.setValue(group.name);
|
|
2157
|
+
}
|
|
2158
|
+
else {
|
|
2159
|
+
groupForm = this.formBuilder.group(group);
|
|
2160
|
+
groupsForm.push(groupForm);
|
|
2161
|
+
}
|
|
2162
|
+
return groupForm;
|
|
2163
|
+
}
|
|
2164
|
+
setOptionForm(entity, optionsForm, currentTranslation) {
|
|
2165
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2166
|
+
const group = {
|
|
2167
|
+
id: entity.id,
|
|
2168
|
+
createdAt: entity.createdAt,
|
|
2169
|
+
updatedAt: entity.updatedAt,
|
|
2170
|
+
code: entity.code,
|
|
2171
|
+
name: (_a = currentTranslation === null || currentTranslation === void 0 ? void 0 : currentTranslation.name) !== null && _a !== void 0 ? _a : '',
|
|
2172
|
+
};
|
|
2173
|
+
let optionForm = optionsForm.controls.find(control => control.value.id === entity.id);
|
|
2174
|
+
if (optionForm) {
|
|
2175
|
+
(_b = optionForm.get('id')) === null || _b === void 0 ? void 0 : _b.setValue(group.id);
|
|
2176
|
+
(_c = optionForm.get('code')) === null || _c === void 0 ? void 0 : _c.setValue(group.code);
|
|
2177
|
+
(_d = optionForm.get('name')) === null || _d === void 0 ? void 0 : _d.setValue(group.name);
|
|
2178
|
+
(_e = optionForm.get('createdAt')) === null || _e === void 0 ? void 0 : _e.setValue(group.name);
|
|
2179
|
+
(_f = optionForm.get('updatedAt')) === null || _f === void 0 ? void 0 : _f.setValue(group.name);
|
|
2180
|
+
}
|
|
2181
|
+
else {
|
|
2182
|
+
optionForm = this.formBuilder.group(group);
|
|
2183
|
+
optionsForm.push(optionForm);
|
|
2139
2184
|
}
|
|
2140
|
-
|
|
2185
|
+
return optionForm;
|
|
2141
2186
|
}
|
|
2142
2187
|
}
|
|
2143
2188
|
ProductOptionsEditorComponent.decorators = [
|
|
2144
2189
|
{ type: Component, args: [{
|
|
2145
2190
|
selector: 'vdr-product-options-editor',
|
|
2146
|
-
template: "<vdr-action-bar>\r\n <vdr-ab-left>\r\n <vdr-language-selector\r\n [availableLanguageCodes]=\"availableLanguages$ | async\"\r\n [currentLanguageCode]=\"languageCode$ | async\"\r\n (languageCodeChange)=\"setLanguage($event)\"\r\n ></vdr-language-selector>\r\n </vdr-ab-left>\r\n\r\n <vdr-ab-right>\r\n <div class=\"flex center\">\r\n <div class=\"mr2\">\r\n <clr-checkbox-wrapper>\r\n <input\r\n clrCheckbox\r\n type=\"checkbox\"\r\n id=\"auto-update\"\r\n [(ngModel)]=\"autoUpdateVariantNames\"\r\n />\r\n <label>{{ 'catalog.auto-update-product-variant-name' | translate }}</label>\r\n </clr-checkbox-wrapper>\r\n </div>\r\n <button\r\n *vdrIfPermissions=\"updatePermission\"\r\n class=\"btn btn-primary\"\r\n (click)=\"save()\"\r\n [disabled]=\"detailForm.pristine || detailForm.invalid\"\r\n >\r\n {{ 'common.update' | translate }}\r\n </button>\r\n </div>\r\n </vdr-ab-right>\r\n</vdr-action-bar>\r\n<form class=\"form\" [formGroup]=\"detailForm\" *ngIf=\"optionGroups$ | async as optionGroups\">\r\n <div formGroupName=\"optionGroups\" class=\"clr-row\">\r\n <div class=\"clr-col-12 clr-col-xl-6\" *ngFor=\"let optionGroup of getOptionGroups(); index as i\">\r\n <section class=\"card\" [formArrayName]=\"i\">\r\n <div class=\"card-header option-group-header\">\r\n <vdr-entity-info [entity]=\"optionGroup.value\"></vdr-entity-info>\r\n <div class=\"ml2\">{{ optionGroup.value.code }}</div>\r\n </div>\r\n <div class=\"card-block\">\r\n <vdr-form-field [label]=\"'common.name' | translate\" for=\"name\">\r\n <input\r\n [id]=\"'name-' + i\"\r\n type=\"text\"\r\n formControlName=\"name\"\r\n [readonly]=\"!(updatePermission | hasPermission)\"\r\n />\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'common.code' | translate\" for=\"code\">\r\n <input\r\n [id]=\"'code-' + i\"\r\n type=\"text\"\r\n [readonly]=\"!(updatePermission | hasPermission)\"\r\n formControlName=\"code\"\r\n />\r\n </vdr-form-field>\r\n </div>\r\n <section class=\"card-block\">\r\n <table class=\"facet-values-list table mt2 mb4\" formGroupName=\"options\">\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>{{ 'common.name' | translate }}</th>\r\n <th>{{ 'common.code' | translate }}</th>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr\r\n class=\"facet-value\"\r\n *ngFor=\"let option of getOptions(optionGroup); let i = index\"\r\n [formGroupName]=\"i\"\r\n >\r\n <td class=\"align-middle\">\r\n <vdr-entity-info [entity]=\"option.value\"></vdr-entity-info>\r\n </td>\r\n <td class=\"align-middle\">\r\n <input\r\n type=\"text\"\r\n formControlName=\"name\"\r\n [readonly]=\"!(updatePermission | hasPermission)\"\r\n />\r\n </td>\r\n <td class=\"align-middle\"><input type=\"text\" formControlName=\"code\" /></td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </section>\r\n </section>\r\n </div>\r\n </div>\r\n</form>\r\n",
|
|
2191
|
+
template: "<vdr-action-bar>\r\n <vdr-ab-left>\r\n <vdr-language-selector\r\n [availableLanguageCodes]=\"availableLanguages$ | async\"\r\n [currentLanguageCode]=\"languageCode$ | async\"\r\n (languageCodeChange)=\"setLanguage($event)\"\r\n ></vdr-language-selector>\r\n </vdr-ab-left>\r\n\r\n <vdr-ab-right>\r\n <div class=\"flex center\">\r\n <div class=\"mr2\">\r\n <clr-checkbox-wrapper>\r\n <input\r\n clrCheckbox\r\n type=\"checkbox\"\r\n id=\"auto-update\"\r\n [(ngModel)]=\"autoUpdateVariantNames\"\r\n />\r\n <label>{{ 'catalog.auto-update-product-variant-name' | translate }}</label>\r\n </clr-checkbox-wrapper>\r\n </div>\r\n <button\r\n *vdrIfPermissions=\"updatePermission\"\r\n class=\"btn btn-primary\"\r\n (click)=\"save()\"\r\n [disabled]=\"detailForm.pristine || detailForm.invalid\"\r\n >\r\n {{ 'common.update' | translate }}\r\n </button>\r\n </div>\r\n </vdr-ab-right>\r\n</vdr-action-bar>\r\n<form class=\"form\" [formGroup]=\"detailForm\" *ngIf=\"optionGroups$ | async as optionGroups\">\r\n <div formGroupName=\"optionGroups\" class=\"clr-row\">\r\n <div class=\"clr-col-12 clr-col-xl-6\" *ngFor=\"let optionGroup of getOptionGroups(); index as i\">\r\n <section class=\"card\" [formArrayName]=\"i\">\r\n <div class=\"card-header option-group-header\">\r\n <vdr-entity-info [entity]=\"optionGroup.value\"></vdr-entity-info>\r\n <div class=\"ml2\">{{ optionGroup.value.code }}</div>\r\n </div>\r\n <div class=\"card-block\">\r\n <vdr-form-field [label]=\"'common.name' | translate\" for=\"name\">\r\n <input\r\n [id]=\"'name-' + i\"\r\n type=\"text\"\r\n formControlName=\"name\"\r\n [readonly]=\"!(updatePermission | hasPermission)\"\r\n />\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'common.code' | translate\" for=\"code\">\r\n <input\r\n [id]=\"'code-' + i\"\r\n type=\"text\"\r\n [readonly]=\"!(updatePermission | hasPermission)\"\r\n formControlName=\"code\"\r\n />\r\n </vdr-form-field>\r\n <section formGroupName=\"customFields\" *ngIf=\"optionGroupCustomFields.length\">\r\n <label>{{ 'common.custom-fields' | translate }}</label>\r\n <vdr-tabbed-custom-fields\r\n entityName=\"ProductOptionGroup\"\r\n [customFields]=\"optionGroupCustomFields\"\r\n [customFieldsFormGroup]=\"optionGroup.get('customFields')\"\r\n [readonly]=\"!(updatePermission | hasPermission)\"\r\n ></vdr-tabbed-custom-fields>\r\n </section>\r\n </div>\r\n <section class=\"card-block\">\r\n <table class=\"facet-values-list table mt2 mb4\" formGroupName=\"options\">\r\n <thead>\r\n <tr>\r\n <th></th>\r\n <th>{{ 'common.name' | translate }}</th>\r\n <th>{{ 'common.code' | translate }}</th>\r\n <ng-container *ngIf=\"optionCustomFields.length\">\r\n <th>{{ 'common.custom-fields' | translate }}</th>\r\n </ng-container>\r\n </tr>\r\n </thead>\r\n <tbody>\r\n <tr\r\n class=\"facet-value\"\r\n *ngFor=\"let option of getOptions(optionGroup); let i = index\"\r\n [formGroupName]=\"i\"\r\n >\r\n <td class=\"align-middle\">\r\n <vdr-entity-info [entity]=\"option.value\"></vdr-entity-info>\r\n </td>\r\n <td class=\"align-middle\">\r\n <input\r\n type=\"text\"\r\n formControlName=\"name\"\r\n [readonly]=\"!(updatePermission | hasPermission)\"\r\n />\r\n </td>\r\n <td class=\"align-middle\"><input type=\"text\" formControlName=\"code\" /></td>\r\n <td class=\"\" *ngIf=\"optionCustomFields.length\">\r\n <vdr-tabbed-custom-fields\r\n entityName=\"ProductOption\"\r\n [customFields]=\"optionCustomFields\"\r\n [compact]=\"true\"\r\n [customFieldsFormGroup]=\"option.get('customFields')\"\r\n [readonly]=\"!(updatePermission | hasPermission)\"\r\n ></vdr-tabbed-custom-fields>\r\n </td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </section>\r\n </section>\r\n </div>\r\n </div>\r\n</form>\r\n",
|
|
2147
2192
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
2148
2193
|
styles: [".option-group-header{display:flex;align-items:baseline}\n"]
|
|
2149
2194
|
},] }
|