@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
@@ -5615,7 +5615,7 @@ class AppComponent {
5615
5615
  }
5616
5616
  }
5617
5617
  handleGlobalHotkeys(event) {
5618
- if (event.ctrlKey === true && event.key === 'u') {
5618
+ if ((event.ctrlKey === true || event.metaKey === true) && event.key === 'u') {
5619
5619
  event.preventDefault();
5620
5620
  if (isDevMode()) {
5621
5621
  this.dataService.client
@@ -13600,7 +13600,7 @@ class DynamicFormInputComponent {
13600
13600
  }
13601
13601
  updateBindings(changes, componentRef) {
13602
13602
  if ('def' in changes) {
13603
- componentRef.instance.config = this.isConfigArgDef(this.def) ? this.def.ui : this.def;
13603
+ componentRef.instance.config = simpleDeepClone(this.def);
13604
13604
  }
13605
13605
  if ('readonly' in changes) {
13606
13606
  componentRef.instance.readonly = this.readonly;
@@ -13642,7 +13642,7 @@ class DynamicFormInputComponent {
13642
13642
  renderInputComponent(factory, viewContainerRef, formControl) {
13643
13643
  const componentRef = viewContainerRef.createComponent(factory);
13644
13644
  const { instance } = componentRef;
13645
- instance.config = simpleDeepClone(this.isConfigArgDef(this.def) ? this.def.ui : this.def);
13645
+ instance.config = simpleDeepClone(this.def);
13646
13646
  instance.formControl = formControl;
13647
13647
  instance.readonly = this.readonly;
13648
13648
  componentRef.injector.get(ChangeDetectorRef).markForCheck();
@@ -14340,6 +14340,28 @@ class LocaleBasePipe {
14340
14340
  this.subscription.unsubscribe();
14341
14341
  }
14342
14342
  }
14343
+ /**
14344
+ * Returns the active locale after attempting to ensure that the locale string
14345
+ * is valid for the Intl API.
14346
+ */
14347
+ getActiveLocale(localeOverride) {
14348
+ var _a;
14349
+ const locale = typeof localeOverride === 'string' ? localeOverride : (_a = this.locale) !== null && _a !== void 0 ? _a : 'en';
14350
+ const hyphenated = locale === null || locale === void 0 ? void 0 : locale.replace(/_/g, '-');
14351
+ // Check for a double-region string, containing 2 region codes like
14352
+ // pt-BR-BR, which is invalid. In this case, the second region is used
14353
+ // and the first region discarded. This would only ever be an issue for
14354
+ // those languages where the translation file itself encodes the region,
14355
+ // as in pt_BR & pt_PT.
14356
+ const matches = hyphenated === null || hyphenated === void 0 ? void 0 : hyphenated.match(/^([a-zA-Z_-]+)(-[A-Z][A-Z])(-[A-Z][A-z])$/);
14357
+ if (matches === null || matches === void 0 ? void 0 : matches.length) {
14358
+ const overriddenLocale = matches[1] + matches[3];
14359
+ return overriddenLocale;
14360
+ }
14361
+ else {
14362
+ return hyphenated;
14363
+ }
14364
+ }
14343
14365
  }
14344
14366
  LocaleBasePipe.decorators = [
14345
14367
  { type: Injectable }
@@ -14365,7 +14387,7 @@ class LocaleCurrencyNamePipe extends LocaleBasePipe {
14365
14387
  super(dataService, changeDetectorRef);
14366
14388
  }
14367
14389
  transform(value, display = 'full', locale) {
14368
- var _a, _b;
14390
+ var _a;
14369
14391
  if (value == null || value === '') {
14370
14392
  return '';
14371
14393
  }
@@ -14374,7 +14396,7 @@ class LocaleCurrencyNamePipe extends LocaleBasePipe {
14374
14396
  }
14375
14397
  let name = '';
14376
14398
  let symbol = '';
14377
- const activeLocale = typeof locale === 'string' ? locale : (_a = this.locale) !== null && _a !== void 0 ? _a : 'en';
14399
+ const activeLocale = this.getActiveLocale(locale);
14378
14400
  // Awaiting TS types for this API: https://github.com/microsoft/TypeScript/pull/44022/files
14379
14401
  const DisplayNames = Intl.DisplayNames;
14380
14402
  if (display === 'full' || display === 'name') {
@@ -14388,7 +14410,7 @@ class LocaleCurrencyNamePipe extends LocaleBasePipe {
14388
14410
  currency: value,
14389
14411
  currencyDisplay: 'symbol',
14390
14412
  }).formatToParts();
14391
- symbol = ((_b = parts.find(p => p.type === 'currency')) === null || _b === void 0 ? void 0 : _b.value) || value;
14413
+ symbol = ((_a = parts.find(p => p.type === 'currency')) === null || _a === void 0 ? void 0 : _a.value) || value;
14392
14414
  }
14393
14415
  return display === 'full' ? `${name} (${symbol})` : display === 'name' ? name : symbol;
14394
14416
  }
@@ -14423,7 +14445,7 @@ class LocaleCurrencyPipe extends LocaleBasePipe {
14423
14445
  transform(value, ...args) {
14424
14446
  const [currencyCode, locale] = args;
14425
14447
  if (typeof value === 'number' && typeof currencyCode === 'string') {
14426
- const activeLocale = typeof locale === 'string' ? locale : this.locale;
14448
+ const activeLocale = this.getActiveLocale(locale);
14427
14449
  const majorUnits = value / 100;
14428
14450
  return new Intl.NumberFormat(activeLocale, { style: 'currency', currency: currencyCode }).format(majorUnits);
14429
14451
  }
@@ -14460,7 +14482,7 @@ class LocaleDatePipe extends LocaleBasePipe {
14460
14482
  transform(value, ...args) {
14461
14483
  const [format, locale] = args;
14462
14484
  if (this.locale || typeof locale === 'string') {
14463
- const activeLocale = typeof locale === 'string' ? locale : this.locale;
14485
+ const activeLocale = this.getActiveLocale(locale);
14464
14486
  const date = value instanceof Date ? value : typeof value === 'string' ? new Date(value) : undefined;
14465
14487
  if (date) {
14466
14488
  const options = this.getOptionsForFormat(typeof format === 'string' ? format : 'medium');
@@ -14534,14 +14556,13 @@ class LocaleLanguageNamePipe extends LocaleBasePipe {
14534
14556
  super(dataService, changeDetectorRef);
14535
14557
  }
14536
14558
  transform(value, locale) {
14537
- var _a;
14538
14559
  if (value == null || value === '') {
14539
14560
  return '';
14540
14561
  }
14541
14562
  if (typeof value !== 'string') {
14542
14563
  return `Invalid language code "${value}"`;
14543
14564
  }
14544
- const activeLocale = typeof locale === 'string' ? locale : (_a = this.locale) !== null && _a !== void 0 ? _a : 'en';
14565
+ const activeLocale = this.getActiveLocale(locale);
14545
14566
  // Awaiting TS types for this API: https://github.com/microsoft/TypeScript/pull/44022/files
14546
14567
  const DisplayNames = Intl.DisplayNames;
14547
14568
  try {
@@ -14579,14 +14600,13 @@ class LocaleRegionNamePipe extends LocaleBasePipe {
14579
14600
  super(dataService, changeDetectorRef);
14580
14601
  }
14581
14602
  transform(value, locale) {
14582
- var _a;
14583
14603
  if (value == null || value === '') {
14584
14604
  return '';
14585
14605
  }
14586
14606
  if (typeof value !== 'string') {
14587
14607
  return `Invalid region code "${value}"`;
14588
14608
  }
14589
- const activeLocale = typeof locale === 'string' ? locale : (_a = this.locale) !== null && _a !== void 0 ? _a : 'en';
14609
+ const activeLocale = this.getActiveLocale(locale);
14590
14610
  // Awaiting TS types for this API: https://github.com/microsoft/TypeScript/pull/44022/files
14591
14611
  const DisplayNames = Intl.DisplayNames;
14592
14612
  try {
@@ -15493,7 +15513,7 @@ function patchObject(obj, patch) {
15493
15513
  }
15494
15514
 
15495
15515
  // Auto-generated by the set-version.js script.
15496
- const ADMIN_UI_VERSION = '1.4.0';
15516
+ const ADMIN_UI_VERSION = '1.4.4';
15497
15517
 
15498
15518
  /**
15499
15519
  * Responsible for registering dashboard widget components and querying for layouts.