@vendure/admin-ui 1.4.0 → 1.4.4

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 (37) hide show
  1. package/bundles/vendure-admin-ui-core.umd.js +35 -15
  2. package/bundles/vendure-admin-ui-core.umd.js.map +1 -1
  3. package/bundles/vendure-admin-ui-customer.umd.js +1 -1
  4. package/bundles/vendure-admin-ui-dashboard.umd.js +1 -0
  5. package/bundles/vendure-admin-ui-dashboard.umd.js.map +1 -1
  6. package/bundles/vendure-admin-ui-settings.umd.js +1 -1
  7. package/bundles/vendure-admin-ui-settings.umd.js.map +1 -1
  8. package/core/common/version.d.ts +1 -1
  9. package/core/shared/pipes/locale-base.pipe.d.ts +5 -0
  10. package/core/vendure-admin-ui-core.metadata.json +1 -1
  11. package/customer/vendure-admin-ui-customer.metadata.json +1 -1
  12. package/dashboard/vendure-admin-ui-dashboard.metadata.json +1 -1
  13. package/esm2015/core/app.component.js +2 -2
  14. package/esm2015/core/common/generated-types.js +1 -1
  15. package/esm2015/core/common/introspection-result.js +1 -1
  16. package/esm2015/core/common/version.js +2 -2
  17. package/esm2015/core/shared/dynamic-form-inputs/dynamic-form-input/dynamic-form-input.component.js +3 -3
  18. package/esm2015/core/shared/pipes/locale-base.pipe.js +23 -1
  19. package/esm2015/core/shared/pipes/locale-currency-name.pipe.js +4 -4
  20. package/esm2015/core/shared/pipes/locale-currency.pipe.js +2 -2
  21. package/esm2015/core/shared/pipes/locale-date.pipe.js +2 -2
  22. package/esm2015/core/shared/pipes/locale-language-name.pipe.js +2 -3
  23. package/esm2015/core/shared/pipes/locale-region-name.pipe.js +2 -3
  24. package/esm2015/customer/components/customer-group-detail-dialog/customer-group-detail-dialog.component.js +1 -1
  25. package/esm2015/dashboard/widgets/latest-orders-widget/latest-orders-widget.component.js +2 -1
  26. package/esm2015/settings/components/zone-detail-dialog/zone-detail-dialog.component.js +2 -2
  27. package/fesm2015/vendure-admin-ui-core.js +33 -13
  28. package/fesm2015/vendure-admin-ui-core.js.map +1 -1
  29. package/fesm2015/vendure-admin-ui-customer.js +1 -1
  30. package/fesm2015/vendure-admin-ui-dashboard.js +1 -0
  31. package/fesm2015/vendure-admin-ui-dashboard.js.map +1 -1
  32. package/fesm2015/vendure-admin-ui-settings.js +1 -1
  33. package/fesm2015/vendure-admin-ui-settings.js.map +1 -1
  34. package/package.json +2 -2
  35. package/settings/vendure-admin-ui-settings.metadata.json +1 -1
  36. package/static/i18n-messages/pt_PT.json +22 -22
  37. package/static/styles/global/_utilities.scss +3 -1
@@ -3343,7 +3343,7 @@
3343
3343
  };
3344
3344
  AppComponent.prototype.handleGlobalHotkeys = function (event) {
3345
3345
  var _this = this;
3346
- if (event.ctrlKey === true && event.key === 'u') {
3346
+ if ((event.ctrlKey === true || event.metaKey === true) && event.key === 'u') {
3347
3347
  event.preventDefault();
3348
3348
  if (i0.isDevMode()) {
3349
3349
  this.dataService.client
@@ -11949,7 +11949,7 @@
11949
11949
  };
11950
11950
  DynamicFormInputComponent.prototype.updateBindings = function (changes, componentRef) {
11951
11951
  if ('def' in changes) {
11952
- componentRef.instance.config = this.isConfigArgDef(this.def) ? this.def.ui : this.def;
11952
+ componentRef.instance.config = simpleDeepClone.simpleDeepClone(this.def);
11953
11953
  }
11954
11954
  if ('readonly' in changes) {
11955
11955
  componentRef.instance.readonly = this.readonly;
@@ -11991,7 +11991,7 @@
11991
11991
  DynamicFormInputComponent.prototype.renderInputComponent = function (factory, viewContainerRef, formControl) {
11992
11992
  var componentRef = viewContainerRef.createComponent(factory);
11993
11993
  var instance = componentRef.instance;
11994
- instance.config = simpleDeepClone.simpleDeepClone(this.isConfigArgDef(this.def) ? this.def.ui : this.def);
11994
+ instance.config = simpleDeepClone.simpleDeepClone(this.def);
11995
11995
  instance.formControl = formControl;
11996
11996
  instance.readonly = this.readonly;
11997
11997
  componentRef.injector.get(i0.ChangeDetectorRef).markForCheck();
@@ -12736,8 +12736,8 @@
12736
12736
  this.subscription = dataService.client
12737
12737
  .uiState()
12738
12738
  .mapStream(function (data) { return data.uiState; })
12739
- .subscribe(function (_a) {
12740
- var language = _a.language, locale = _a.locale;
12739
+ .subscribe(function (_b) {
12740
+ var language = _b.language, locale = _b.locale;
12741
12741
  _this.locale = language.replace(/_/g, '-');
12742
12742
  if (locale) {
12743
12743
  _this.locale += "-" + locale;
@@ -12751,6 +12751,28 @@
12751
12751
  this.subscription.unsubscribe();
12752
12752
  }
12753
12753
  };
12754
+ /**
12755
+ * Returns the active locale after attempting to ensure that the locale string
12756
+ * is valid for the Intl API.
12757
+ */
12758
+ LocaleBasePipe.prototype.getActiveLocale = function (localeOverride) {
12759
+ var _a;
12760
+ var locale = typeof localeOverride === 'string' ? localeOverride : (_a = this.locale) !== null && _a !== void 0 ? _a : 'en';
12761
+ var hyphenated = locale === null || locale === void 0 ? void 0 : locale.replace(/_/g, '-');
12762
+ // Check for a double-region string, containing 2 region codes like
12763
+ // pt-BR-BR, which is invalid. In this case, the second region is used
12764
+ // and the first region discarded. This would only ever be an issue for
12765
+ // those languages where the translation file itself encodes the region,
12766
+ // as in pt_BR & pt_PT.
12767
+ var matches = hyphenated === null || hyphenated === void 0 ? void 0 : hyphenated.match(/^([a-zA-Z_-]+)(-[A-Z][A-Z])(-[A-Z][A-z])$/);
12768
+ if (matches === null || matches === void 0 ? void 0 : matches.length) {
12769
+ var overriddenLocale = matches[1] + matches[3];
12770
+ return overriddenLocale;
12771
+ }
12772
+ else {
12773
+ return hyphenated;
12774
+ }
12775
+ };
12754
12776
  return LocaleBasePipe;
12755
12777
  }());
12756
12778
  LocaleBasePipe.decorators = [
@@ -12779,7 +12801,7 @@
12779
12801
  }
12780
12802
  LocaleCurrencyNamePipe.prototype.transform = function (value, display, locale) {
12781
12803
  if (display === void 0) { display = 'full'; }
12782
- var _a, _b;
12804
+ var _a;
12783
12805
  if (value == null || value === '') {
12784
12806
  return '';
12785
12807
  }
@@ -12788,7 +12810,7 @@
12788
12810
  }
12789
12811
  var name = '';
12790
12812
  var symbol = '';
12791
- var activeLocale = typeof locale === 'string' ? locale : (_a = this.locale) !== null && _a !== void 0 ? _a : 'en';
12813
+ var activeLocale = this.getActiveLocale(locale);
12792
12814
  // Awaiting TS types for this API: https://github.com/microsoft/TypeScript/pull/44022/files
12793
12815
  var DisplayNames = Intl.DisplayNames;
12794
12816
  if (display === 'full' || display === 'name') {
@@ -12802,7 +12824,7 @@
12802
12824
  currency: value,
12803
12825
  currencyDisplay: 'symbol',
12804
12826
  }).formatToParts();
12805
- symbol = ((_b = parts.find(function (p) { return p.type === 'currency'; })) === null || _b === void 0 ? void 0 : _b.value) || value;
12827
+ symbol = ((_a = parts.find(function (p) { return p.type === 'currency'; })) === null || _a === void 0 ? void 0 : _a.value) || value;
12806
12828
  }
12807
12829
  return display === 'full' ? name + " (" + symbol + ")" : display === 'name' ? name : symbol;
12808
12830
  };
@@ -12843,7 +12865,7 @@
12843
12865
  }
12844
12866
  var _a = __read(args, 2), currencyCode = _a[0], locale = _a[1];
12845
12867
  if (typeof value === 'number' && typeof currencyCode === 'string') {
12846
- var activeLocale = typeof locale === 'string' ? locale : this.locale;
12868
+ var activeLocale = this.getActiveLocale(locale);
12847
12869
  var majorUnits = value / 100;
12848
12870
  return new Intl.NumberFormat(activeLocale, { style: 'currency', currency: currencyCode }).format(majorUnits);
12849
12871
  }
@@ -12886,7 +12908,7 @@
12886
12908
  }
12887
12909
  var _a = __read(args, 2), format = _a[0], locale = _a[1];
12888
12910
  if (this.locale || typeof locale === 'string') {
12889
- var activeLocale = typeof locale === 'string' ? locale : this.locale;
12911
+ var activeLocale = this.getActiveLocale(locale);
12890
12912
  var date = value instanceof Date ? value : typeof value === 'string' ? new Date(value) : undefined;
12891
12913
  if (date) {
12892
12914
  var options = this.getOptionsForFormat(typeof format === 'string' ? format : 'medium');
@@ -12962,14 +12984,13 @@
12962
12984
  return _super.call(this, dataService, changeDetectorRef) || this;
12963
12985
  }
12964
12986
  LocaleLanguageNamePipe.prototype.transform = function (value, locale) {
12965
- var _a;
12966
12987
  if (value == null || value === '') {
12967
12988
  return '';
12968
12989
  }
12969
12990
  if (typeof value !== 'string') {
12970
12991
  return "Invalid language code \"" + value + "\"";
12971
12992
  }
12972
- var activeLocale = typeof locale === 'string' ? locale : (_a = this.locale) !== null && _a !== void 0 ? _a : 'en';
12993
+ var activeLocale = this.getActiveLocale(locale);
12973
12994
  // Awaiting TS types for this API: https://github.com/microsoft/TypeScript/pull/44022/files
12974
12995
  var DisplayNames = Intl.DisplayNames;
12975
12996
  try {
@@ -13009,14 +13030,13 @@
13009
13030
  return _super.call(this, dataService, changeDetectorRef) || this;
13010
13031
  }
13011
13032
  LocaleRegionNamePipe.prototype.transform = function (value, locale) {
13012
- var _a;
13013
13033
  if (value == null || value === '') {
13014
13034
  return '';
13015
13035
  }
13016
13036
  if (typeof value !== 'string') {
13017
13037
  return "Invalid region code \"" + value + "\"";
13018
13038
  }
13019
- var activeLocale = typeof locale === 'string' ? locale : (_a = this.locale) !== null && _a !== void 0 ? _a : 'en';
13039
+ var activeLocale = this.getActiveLocale(locale);
13020
13040
  // Awaiting TS types for this API: https://github.com/microsoft/TypeScript/pull/44022/files
13021
13041
  var DisplayNames = Intl.DisplayNames;
13022
13042
  try {
@@ -13985,7 +14005,7 @@
13985
14005
  }
13986
14006
 
13987
14007
  // Auto-generated by the set-version.js script.
13988
- var ADMIN_UI_VERSION = '1.4.0';
14008
+ var ADMIN_UI_VERSION = '1.4.4';
13989
14009
 
13990
14010
  /**
13991
14011
  * Responsible for registering dashboard widget components and querying for layouts.