@vendure/admin-ui 1.4.3 → 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.
- package/bundles/vendure-admin-ui-core.umd.js +32 -12
- package/bundles/vendure-admin-ui-core.umd.js.map +1 -1
- package/bundles/vendure-admin-ui-dashboard.umd.js.map +1 -1
- package/core/common/version.d.ts +1 -1
- package/core/shared/pipes/locale-base.pipe.d.ts +5 -0
- package/core/vendure-admin-ui-core.metadata.json +1 -1
- package/esm2015/core/common/generated-types.js +1 -1
- package/esm2015/core/common/introspection-result.js +1 -1
- package/esm2015/core/common/version.js +2 -2
- package/esm2015/core/shared/pipes/locale-base.pipe.js +23 -1
- package/esm2015/core/shared/pipes/locale-currency-name.pipe.js +4 -4
- package/esm2015/core/shared/pipes/locale-currency.pipe.js +2 -2
- package/esm2015/core/shared/pipes/locale-date.pipe.js +2 -2
- package/esm2015/core/shared/pipes/locale-language-name.pipe.js +2 -3
- package/esm2015/core/shared/pipes/locale-region-name.pipe.js +2 -3
- package/esm2015/dashboard/widgets/latest-orders-widget/latest-orders-widget.component.js +1 -1
- package/fesm2015/vendure-admin-ui-core.js +30 -10
- package/fesm2015/vendure-admin-ui-core.js.map +1 -1
- package/fesm2015/vendure-admin-ui-dashboard.js.map +1 -1
- package/package.json +2 -2
- package/static/i18n-messages/pt_PT.json +22 -22
|
@@ -12736,8 +12736,8 @@
|
|
|
12736
12736
|
this.subscription = dataService.client
|
|
12737
12737
|
.uiState()
|
|
12738
12738
|
.mapStream(function (data) { return data.uiState; })
|
|
12739
|
-
.subscribe(function (
|
|
12740
|
-
var language =
|
|
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
|
|
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 =
|
|
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 = ((
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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.
|
|
14008
|
+
var ADMIN_UI_VERSION = '1.4.4';
|
|
13989
14009
|
|
|
13990
14010
|
/**
|
|
13991
14011
|
* Responsible for registering dashboard widget components and querying for layouts.
|