@vendure/admin-ui 1.4.2 → 1.4.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.
Files changed (44) hide show
  1. package/bundles/vendure-admin-ui-catalog.umd.js +1 -1
  2. package/bundles/vendure-admin-ui-catalog.umd.js.map +1 -1
  3. package/bundles/vendure-admin-ui-core.umd.js +56 -29
  4. package/bundles/vendure-admin-ui-core.umd.js.map +1 -1
  5. package/bundles/vendure-admin-ui-dashboard.umd.js +1 -0
  6. package/bundles/vendure-admin-ui-dashboard.umd.js.map +1 -1
  7. package/bundles/vendure-admin-ui-settings.umd.js +1 -1
  8. package/bundles/vendure-admin-ui-settings.umd.js.map +1 -1
  9. package/catalog/vendure-admin-ui-catalog.metadata.json +1 -1
  10. package/core/common/generated-types.d.ts +1 -1
  11. package/core/common/version.d.ts +1 -1
  12. package/core/providers/i18n/i18n.service.d.ts +3 -1
  13. package/core/shared/pipes/locale-base.pipe.d.ts +5 -0
  14. package/core/vendure-admin-ui-core.metadata.json +1 -1
  15. package/dashboard/vendure-admin-ui-dashboard.metadata.json +1 -1
  16. package/esm2015/catalog/components/product-list/product-list.component.js +2 -2
  17. package/esm2015/core/common/base-detail.component.js +4 -4
  18. package/esm2015/core/common/generated-types.js +1 -1
  19. package/esm2015/core/common/introspection-result.js +1 -1
  20. package/esm2015/core/common/version.js +2 -2
  21. package/esm2015/core/components/main-nav/main-nav.component.js +3 -3
  22. package/esm2015/core/providers/i18n/i18n.service.js +14 -5
  23. package/esm2015/core/shared/components/rich-text-editor/prosemirror/prosemirror.service.js +2 -2
  24. package/esm2015/core/shared/dynamic-form-inputs/select-form-input/select-form-input.component.js +2 -2
  25. package/esm2015/core/shared/pipes/asset-preview.pipe.js +2 -2
  26. package/esm2015/core/shared/pipes/locale-base.pipe.js +23 -1
  27. package/esm2015/core/shared/pipes/locale-currency-name.pipe.js +4 -4
  28. package/esm2015/core/shared/pipes/locale-currency.pipe.js +2 -2
  29. package/esm2015/core/shared/pipes/locale-date.pipe.js +2 -2
  30. package/esm2015/core/shared/pipes/locale-language-name.pipe.js +2 -3
  31. package/esm2015/core/shared/pipes/locale-region-name.pipe.js +2 -3
  32. package/esm2015/dashboard/widgets/latest-orders-widget/latest-orders-widget.component.js +2 -1
  33. package/esm2015/settings/components/zone-detail-dialog/zone-detail-dialog.component.js +2 -2
  34. package/fesm2015/vendure-admin-ui-catalog.js +1 -1
  35. package/fesm2015/vendure-admin-ui-catalog.js.map +1 -1
  36. package/fesm2015/vendure-admin-ui-core.js +48 -21
  37. package/fesm2015/vendure-admin-ui-core.js.map +1 -1
  38. package/fesm2015/vendure-admin-ui-dashboard.js +1 -0
  39. package/fesm2015/vendure-admin-ui-dashboard.js.map +1 -1
  40. package/fesm2015/vendure-admin-ui-settings.js +1 -1
  41. package/fesm2015/vendure-admin-ui-settings.js.map +1 -1
  42. package/package.json +2 -2
  43. package/settings/vendure-admin-ui-settings.metadata.json +1 -1
  44. package/static/i18n-messages/pt_PT.json +22 -22
@@ -3506,9 +3506,11 @@
3506
3506
  { type: ServerConfigService }
3507
3507
  ]; };
3508
3508
 
3509
+ /** @dynamic */
3509
3510
  var I18nService = /** @class */ (function () {
3510
- function I18nService(ngxTranslate) {
3511
+ function I18nService(ngxTranslate, document) {
3511
3512
  this.ngxTranslate = ngxTranslate;
3513
+ this.document = document;
3512
3514
  this._availableLanguages = [];
3513
3515
  }
3514
3516
  Object.defineProperty(I18nService.prototype, "availableLanguages", {
@@ -3528,7 +3530,11 @@
3528
3530
  * Set the UI language
3529
3531
  */
3530
3532
  I18nService.prototype.setLanguage = function (language) {
3533
+ var _a;
3531
3534
  this.ngxTranslate.use(language);
3535
+ if ((_a = this.document) === null || _a === void 0 ? void 0 : _a.documentElement) {
3536
+ this.document.documentElement.lang = language;
3537
+ }
3532
3538
  };
3533
3539
  /**
3534
3540
  * Set the available UI languages
@@ -3544,14 +3550,15 @@
3544
3550
  };
3545
3551
  return I18nService;
3546
3552
  }());
3547
- I18nService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function I18nService_Factory() { return new I18nService(i0__namespace.ɵɵinject(i1__namespace$1.TranslateService)); }, token: I18nService, providedIn: "root" });
3553
+ I18nService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function I18nService_Factory() { return new I18nService(i0__namespace.ɵɵinject(i1__namespace$1.TranslateService), i0__namespace.ɵɵinject(i1__namespace.DOCUMENT)); }, token: I18nService, providedIn: "root" });
3548
3554
  I18nService.decorators = [
3549
3555
  { type: i0.Injectable, args: [{
3550
3556
  providedIn: 'root',
3551
3557
  },] }
3552
3558
  ];
3553
3559
  I18nService.ctorParameters = function () { return [
3554
- { type: i1$2.TranslateService }
3560
+ { type: i1$2.TranslateService },
3561
+ { type: Document, decorators: [{ type: i0.Inject, args: [i1.DOCUMENT,] }] }
3555
3562
  ]; };
3556
3563
 
3557
3564
  /**
@@ -5025,8 +5032,8 @@
5025
5032
  MainNavComponent.decorators = [
5026
5033
  { type: i0.Component, args: [{
5027
5034
  selector: 'vdr-main-nav',
5028
- template: "<nav class=\"sidenav\" [clr-nav-level]=\"2\">\r\n <section class=\"sidenav-content\">\r\n <ng-container *ngFor=\"let section of navBuilderService.navMenuConfig$ | async\">\r\n <section\r\n class=\"nav-group\"\r\n [attr.data-section-id]=\"section.id\"\r\n [class.collapsible]=\"section.collapsible\"\r\n *ngIf=\"shouldDisplayLink(section)\"\r\n >\r\n <vdr-ui-extension-point [locationId]=\"section.id\" api=\"navMenu\" [topPx]=\"-6\" [leftPx]=\"8\">\r\n <ng-container *ngIf=\"navBuilderService.sectionBadges[section.id] | async as sectionBadge\">\r\n <vdr-status-badge\r\n *ngIf=\"sectionBadge !== 'none'\"\r\n [type]=\"sectionBadge\"\r\n ></vdr-status-badge>\r\n </ng-container>\r\n <input [id]=\"section.id\" type=\"checkbox\" [checked]=\"section.collapsedByDefault\" />\r\n <label [for]=\"section.id\">{{ section.label | translate }}</label>\r\n <ul class=\"nav-list\">\r\n <ng-container *ngFor=\"let item of section.items\">\r\n <li *ngIf=\"shouldDisplayLink(item)\">\r\n <a\r\n class=\"nav-link\"\r\n [attr.data-item-id]=\"section.id\"\r\n [routerLink]=\"getRouterLink(item)\"\r\n routerLinkActive=\"active\"\r\n >\r\n <ng-container *ngIf=\"item.statusBadge | async as itemBadge\">\r\n <vdr-status-badge\r\n *ngIf=\"itemBadge.type !== 'none'\"\r\n [type]=\"itemBadge.type\"\r\n ></vdr-status-badge>\r\n </ng-container>\r\n <clr-icon [attr.shape]=\"item.icon || 'block'\" size=\"20\"></clr-icon>\r\n {{ item.label | translate }}\r\n </a>\r\n </li>\r\n </ng-container>\r\n </ul>\r\n </vdr-ui-extension-point>\r\n </section>\r\n </ng-container>\r\n </section>\r\n</nav>\r\n",
5029
- styles: [":host{order:-1;background-color:var(--clr-nav-background-color)}nav.sidenav{height:100%;width:10.8rem;border-right-color:var(--clr-sidenav-border-color)}.nav-list clr-icon{margin-right:12px}.nav-group,.nav-link{position:relative}.nav-group vdr-status-badge{left:10px;top:6px}.nav-link vdr-status-badge{left:25px;top:3px}\n"]
5035
+ template: "<nav class=\"sidenav\" [clr-nav-level]=\"2\">\r\n <section class=\"sidenav-content\">\r\n <ng-container *ngFor=\"let section of navBuilderService.navMenuConfig$ | async\">\r\n <section\r\n class=\"nav-group\"\r\n [attr.data-section-id]=\"section.id\"\r\n [class.collapsible]=\"section.collapsible\"\r\n *ngIf=\"shouldDisplayLink(section)\"\r\n >\r\n <vdr-ui-extension-point [locationId]=\"section.id\" api=\"navMenu\" [topPx]=\"-6\" [leftPx]=\"8\">\r\n <ng-container *ngIf=\"navBuilderService.sectionBadges[section.id] | async as sectionBadge\">\r\n <vdr-status-badge\r\n *ngIf=\"sectionBadge !== 'none'\"\r\n [type]=\"sectionBadge\"\r\n ></vdr-status-badge>\r\n </ng-container>\r\n <input [id]=\"section.id\" type=\"checkbox\" [checked]=\"section.collapsedByDefault\" />\r\n <label class=\"nav-group-header\" [for]=\"section.id\">{{ section.label | translate }}</label>\r\n <ul class=\"nav-list\">\r\n <ng-container *ngFor=\"let item of section.items\">\r\n <li *ngIf=\"shouldDisplayLink(item)\">\r\n <a\r\n class=\"nav-link\"\r\n [attr.data-item-id]=\"section.id\"\r\n [routerLink]=\"getRouterLink(item)\"\r\n routerLinkActive=\"active\"\r\n >\r\n <ng-container *ngIf=\"item.statusBadge | async as itemBadge\">\r\n <vdr-status-badge\r\n *ngIf=\"itemBadge.type !== 'none'\"\r\n [type]=\"itemBadge.type\"\r\n ></vdr-status-badge>\r\n </ng-container>\r\n <clr-icon [attr.shape]=\"item.icon || 'block'\" size=\"20\"></clr-icon>\r\n {{ item.label | translate }}\r\n </a>\r\n </li>\r\n </ng-container>\r\n </ul>\r\n </vdr-ui-extension-point>\r\n </section>\r\n </ng-container>\r\n </section>\r\n</nav>\r\n",
5036
+ styles: [":host{order:-1;background-color:var(--clr-nav-background-color)}nav.sidenav{height:100%;width:10.8rem;border-right-color:var(--clr-sidenav-border-color)}.sidenav .nav-group .nav-list{margin:0}.sidenav .nav-group .nav-group-header{margin:0;line-height:1.2}.sidenav .nav-group .nav-link{display:inline-flex;line-height:1rem;padding-right:.6rem}.nav-list clr-icon{flex-shrink:0;margin-right:12px}.nav-group{-webkit-hyphens:auto;hyphens:auto}.nav-group,.nav-link{position:relative}.nav-group vdr-status-badge{left:10px;top:6px}.nav-link vdr-status-badge{left:25px;top:3px}\n"]
5030
5037
  },] }
5031
5038
  ];
5032
5039
  MainNavComponent.ctorParameters = function () { return [
@@ -6769,7 +6776,7 @@
6769
6776
  SelectFormInputComponent.decorators = [
6770
6777
  { type: i0.Component, args: [{
6771
6778
  selector: 'vdr-select-form-input',
6772
- template: "<select clrSelect [formControl]=\"formControl\" [vdrDisabled]=\"readonly\">\r\n <option *ngIf=\"config.nullable\" [ngValue]=\"null\"></option>\r\n <option *ngFor=\"let option of options\" [value]=\"option.value\">\r\n {{ (option | customFieldLabel) || option.label || option.value }}\r\n </option>\r\n</select>\r\n",
6779
+ template: "<select clrSelect [formControl]=\"formControl\" [vdrDisabled]=\"readonly\">\r\n <option *ngIf=\"config.nullable\" [ngValue]=\"null\"></option>\r\n <option *ngFor=\"let option of options\" [ngValue]=\"option.value\">\r\n {{ (option | customFieldLabel) || option.label || option.value }}\r\n </option>\r\n</select>\r\n",
6773
6780
  changeDetection: i0.ChangeDetectionStrategy.OnPush,
6774
6781
  styles: ["select{width:100%}\n"]
6775
6782
  },] }
@@ -11106,7 +11113,7 @@
11106
11113
  };
11107
11114
  ProsemirrorService.prototype.getStateFromText = function (text) {
11108
11115
  var div = document.createElement('div');
11109
- div.innerHTML = text;
11116
+ div.innerHTML = text !== null && text !== void 0 ? text : '';
11110
11117
  return prosemirrorState.EditorState.create({
11111
11118
  doc: prosemirrorModel.DOMParser.fromSchema(this.mySchema).parse(div),
11112
11119
  plugins: this.configurePlugins({ schema: this.mySchema, floatingMenu: false }),
@@ -12468,7 +12475,7 @@
12468
12475
  if (!asset) {
12469
12476
  return '';
12470
12477
  }
12471
- if (!asset.preview || typeof asset.preview !== 'string') {
12478
+ if (asset.preview == null || typeof asset.preview !== 'string') {
12472
12479
  throw new Error("Expected an Asset, got " + JSON.stringify(asset));
12473
12480
  }
12474
12481
  var fp = asset.focalPoint ? "&fpx=" + asset.focalPoint.x + "&fpy=" + asset.focalPoint.y : '';
@@ -12736,8 +12743,8 @@
12736
12743
  this.subscription = dataService.client
12737
12744
  .uiState()
12738
12745
  .mapStream(function (data) { return data.uiState; })
12739
- .subscribe(function (_a) {
12740
- var language = _a.language, locale = _a.locale;
12746
+ .subscribe(function (_b) {
12747
+ var language = _b.language, locale = _b.locale;
12741
12748
  _this.locale = language.replace(/_/g, '-');
12742
12749
  if (locale) {
12743
12750
  _this.locale += "-" + locale;
@@ -12751,6 +12758,28 @@
12751
12758
  this.subscription.unsubscribe();
12752
12759
  }
12753
12760
  };
12761
+ /**
12762
+ * Returns the active locale after attempting to ensure that the locale string
12763
+ * is valid for the Intl API.
12764
+ */
12765
+ LocaleBasePipe.prototype.getActiveLocale = function (localeOverride) {
12766
+ var _a;
12767
+ var locale = typeof localeOverride === 'string' ? localeOverride : (_a = this.locale) !== null && _a !== void 0 ? _a : 'en';
12768
+ var hyphenated = locale === null || locale === void 0 ? void 0 : locale.replace(/_/g, '-');
12769
+ // Check for a double-region string, containing 2 region codes like
12770
+ // pt-BR-BR, which is invalid. In this case, the second region is used
12771
+ // and the first region discarded. This would only ever be an issue for
12772
+ // those languages where the translation file itself encodes the region,
12773
+ // as in pt_BR & pt_PT.
12774
+ var matches = hyphenated === null || hyphenated === void 0 ? void 0 : hyphenated.match(/^([a-zA-Z_-]+)(-[A-Z][A-Z])(-[A-Z][A-z])$/);
12775
+ if (matches === null || matches === void 0 ? void 0 : matches.length) {
12776
+ var overriddenLocale = matches[1] + matches[3];
12777
+ return overriddenLocale;
12778
+ }
12779
+ else {
12780
+ return hyphenated;
12781
+ }
12782
+ };
12754
12783
  return LocaleBasePipe;
12755
12784
  }());
12756
12785
  LocaleBasePipe.decorators = [
@@ -12779,7 +12808,7 @@
12779
12808
  }
12780
12809
  LocaleCurrencyNamePipe.prototype.transform = function (value, display, locale) {
12781
12810
  if (display === void 0) { display = 'full'; }
12782
- var _a, _b;
12811
+ var _a;
12783
12812
  if (value == null || value === '') {
12784
12813
  return '';
12785
12814
  }
@@ -12788,7 +12817,7 @@
12788
12817
  }
12789
12818
  var name = '';
12790
12819
  var symbol = '';
12791
- var activeLocale = typeof locale === 'string' ? locale : (_a = this.locale) !== null && _a !== void 0 ? _a : 'en';
12820
+ var activeLocale = this.getActiveLocale(locale);
12792
12821
  // Awaiting TS types for this API: https://github.com/microsoft/TypeScript/pull/44022/files
12793
12822
  var DisplayNames = Intl.DisplayNames;
12794
12823
  if (display === 'full' || display === 'name') {
@@ -12802,7 +12831,7 @@
12802
12831
  currency: value,
12803
12832
  currencyDisplay: 'symbol',
12804
12833
  }).formatToParts();
12805
- symbol = ((_b = parts.find(function (p) { return p.type === 'currency'; })) === null || _b === void 0 ? void 0 : _b.value) || value;
12834
+ symbol = ((_a = parts.find(function (p) { return p.type === 'currency'; })) === null || _a === void 0 ? void 0 : _a.value) || value;
12806
12835
  }
12807
12836
  return display === 'full' ? name + " (" + symbol + ")" : display === 'name' ? name : symbol;
12808
12837
  };
@@ -12843,7 +12872,7 @@
12843
12872
  }
12844
12873
  var _a = __read(args, 2), currencyCode = _a[0], locale = _a[1];
12845
12874
  if (typeof value === 'number' && typeof currencyCode === 'string') {
12846
- var activeLocale = typeof locale === 'string' ? locale : this.locale;
12875
+ var activeLocale = this.getActiveLocale(locale);
12847
12876
  var majorUnits = value / 100;
12848
12877
  return new Intl.NumberFormat(activeLocale, { style: 'currency', currency: currencyCode }).format(majorUnits);
12849
12878
  }
@@ -12886,7 +12915,7 @@
12886
12915
  }
12887
12916
  var _a = __read(args, 2), format = _a[0], locale = _a[1];
12888
12917
  if (this.locale || typeof locale === 'string') {
12889
- var activeLocale = typeof locale === 'string' ? locale : this.locale;
12918
+ var activeLocale = this.getActiveLocale(locale);
12890
12919
  var date = value instanceof Date ? value : typeof value === 'string' ? new Date(value) : undefined;
12891
12920
  if (date) {
12892
12921
  var options = this.getOptionsForFormat(typeof format === 'string' ? format : 'medium');
@@ -12962,14 +12991,13 @@
12962
12991
  return _super.call(this, dataService, changeDetectorRef) || this;
12963
12992
  }
12964
12993
  LocaleLanguageNamePipe.prototype.transform = function (value, locale) {
12965
- var _a;
12966
12994
  if (value == null || value === '') {
12967
12995
  return '';
12968
12996
  }
12969
12997
  if (typeof value !== 'string') {
12970
12998
  return "Invalid language code \"" + value + "\"";
12971
12999
  }
12972
- var activeLocale = typeof locale === 'string' ? locale : (_a = this.locale) !== null && _a !== void 0 ? _a : 'en';
13000
+ var activeLocale = this.getActiveLocale(locale);
12973
13001
  // Awaiting TS types for this API: https://github.com/microsoft/TypeScript/pull/44022/files
12974
13002
  var DisplayNames = Intl.DisplayNames;
12975
13003
  try {
@@ -13009,14 +13037,13 @@
13009
13037
  return _super.call(this, dataService, changeDetectorRef) || this;
13010
13038
  }
13011
13039
  LocaleRegionNamePipe.prototype.transform = function (value, locale) {
13012
- var _a;
13013
13040
  if (value == null || value === '') {
13014
13041
  return '';
13015
13042
  }
13016
13043
  if (typeof value !== 'string') {
13017
13044
  return "Invalid region code \"" + value + "\"";
13018
13045
  }
13019
- var activeLocale = typeof locale === 'string' ? locale : (_a = this.locale) !== null && _a !== void 0 ? _a : 'en';
13046
+ var activeLocale = this.getActiveLocale(locale);
13020
13047
  // Awaiting TS types for this API: https://github.com/microsoft/TypeScript/pull/44022/files
13021
13048
  var DisplayNames = Intl.DisplayNames;
13022
13049
  try {
@@ -13599,8 +13626,8 @@
13599
13626
  this.availableLanguages$ = this.serverConfigService.getAvailableLanguages();
13600
13627
  rxjs.combineLatest(this.entity$, this.languageCode$)
13601
13628
  .pipe(operators.takeUntil(this.destroy$))
13602
- .subscribe(function (_c) {
13603
- var _d = __read(_c, 2), entity = _d[0], languageCode = _d[1];
13629
+ .subscribe(function (_d) {
13630
+ var _e = __read(_d, 2), entity = _e[0], languageCode = _e[1];
13604
13631
  _this.setFormValues(entity, languageCode);
13605
13632
  _this.detailForm.markAsPristine();
13606
13633
  });
@@ -13617,15 +13644,15 @@
13617
13644
  return this.detailForm && this.detailForm.pristine;
13618
13645
  };
13619
13646
  BaseDetailComponent.prototype.setCustomFieldFormValues = function (customFields, formGroup, entity, currentTranslation) {
13620
- var e_1, _c;
13621
- var _a, _b;
13647
+ var e_1, _d;
13648
+ var _a, _b, _c;
13622
13649
  try {
13623
13650
  for (var customFields_1 = __values(customFields), customFields_1_1 = customFields_1.next(); !customFields_1_1.done; customFields_1_1 = customFields_1.next()) {
13624
13651
  var fieldDef = customFields_1_1.value;
13625
13652
  var key = fieldDef.name;
13626
13653
  var value = fieldDef.type === 'localeString'
13627
- ? (_a = currentTranslation.customFields) === null || _a === void 0 ? void 0 : _a[key]
13628
- : (_b = entity.customFields) === null || _b === void 0 ? void 0 : _b[key];
13654
+ ? (_b = (_a = currentTranslation) === null || _a === void 0 ? void 0 : _a.customFields) === null || _b === void 0 ? void 0 : _b[key]
13655
+ : (_c = entity.customFields) === null || _c === void 0 ? void 0 : _c[key];
13629
13656
  var control = formGroup === null || formGroup === void 0 ? void 0 : formGroup.get(key);
13630
13657
  if (control) {
13631
13658
  control.patchValue(value);
@@ -13635,7 +13662,7 @@
13635
13662
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
13636
13663
  finally {
13637
13664
  try {
13638
- if (customFields_1_1 && !customFields_1_1.done && (_c = customFields_1.return)) _c.call(customFields_1);
13665
+ if (customFields_1_1 && !customFields_1_1.done && (_d = customFields_1.return)) _d.call(customFields_1);
13639
13666
  }
13640
13667
  finally { if (e_1) throw e_1.error; }
13641
13668
  }
@@ -13644,10 +13671,10 @@
13644
13671
  return this.serverConfigService.getCustomFieldsFor(key);
13645
13672
  };
13646
13673
  BaseDetailComponent.prototype.setQueryParam = function (key, value) {
13647
- var _c;
13674
+ var _d;
13648
13675
  this.router.navigate([
13649
13676
  './',
13650
- Object.assign(Object.assign({}, this.route.snapshot.params), (_c = {}, _c[key] = value, _c)),
13677
+ Object.assign(Object.assign({}, this.route.snapshot.params), (_d = {}, _d[key] = value, _d)),
13651
13678
  ], {
13652
13679
  relativeTo: this.route,
13653
13680
  queryParamsHandling: 'merge',
@@ -13985,7 +14012,7 @@
13985
14012
  }
13986
14013
 
13987
14014
  // Auto-generated by the set-version.js script.
13988
- var ADMIN_UI_VERSION = '1.4.2';
14015
+ var ADMIN_UI_VERSION = '1.4.6';
13989
14016
 
13990
14017
  /**
13991
14018
  * Responsible for registering dashboard widget components and querying for layouts.