cx 24.0.0 → 24.0.1
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/dist/manifest.js +887 -887
- package/dist/ui.js +23 -3
- package/package.json +1 -1
- package/src/ui/Culture.d.ts +8 -4
- package/src/ui/Culture.js +29 -18
package/dist/ui.js
CHANGED
|
@@ -847,6 +847,8 @@ var Localization = /*#__PURE__*/ (function () {
|
|
|
847
847
|
})();
|
|
848
848
|
|
|
849
849
|
var culture = "en";
|
|
850
|
+
var numberCulture = null;
|
|
851
|
+
var dateTimeCulture = null;
|
|
850
852
|
var cultureCache = {};
|
|
851
853
|
var defaultCurrency = "USD";
|
|
852
854
|
var dateEncoding = function dateEncoding(date) {
|
|
@@ -860,6 +862,16 @@ var Culture = /*#__PURE__*/ (function () {
|
|
|
860
862
|
Localization.setCulture(cultureCode);
|
|
861
863
|
this.invalidateCache();
|
|
862
864
|
};
|
|
865
|
+
Culture.setNumberCulture = function setNumberCulture(cultureCode) {
|
|
866
|
+
numberCulture = cultureCode;
|
|
867
|
+
delete cultureCache.numberCulture;
|
|
868
|
+
this.invalidateCache();
|
|
869
|
+
};
|
|
870
|
+
Culture.setDateTimeCulture = function setDateTimeCulture(cultureCode) {
|
|
871
|
+
dateTimeCulture = cultureCode;
|
|
872
|
+
delete cultureCache.dateTimeCulture;
|
|
873
|
+
this.invalidateCache();
|
|
874
|
+
};
|
|
863
875
|
Culture.setDefaultCurrency = function setDefaultCurrency(currencyCode) {
|
|
864
876
|
defaultCurrency = currencyCode;
|
|
865
877
|
this.invalidateCache();
|
|
@@ -870,12 +882,20 @@ var Culture = /*#__PURE__*/ (function () {
|
|
|
870
882
|
invalidateStringTemplateCache();
|
|
871
883
|
};
|
|
872
884
|
Culture.getNumberCulture = function getNumberCulture() {
|
|
873
|
-
|
|
885
|
+
var _numberCulture;
|
|
886
|
+
if (!cultureCache.numberCulture)
|
|
887
|
+
cultureCache.numberCulture = new NumberCulture(
|
|
888
|
+
(_numberCulture = numberCulture) != null ? _numberCulture : culture
|
|
889
|
+
);
|
|
874
890
|
return cultureCache.numberCulture;
|
|
875
891
|
};
|
|
876
892
|
Culture.getDateTimeCulture = function getDateTimeCulture() {
|
|
877
|
-
|
|
878
|
-
|
|
893
|
+
var _dateTimeCulture;
|
|
894
|
+
if (!cultureCache.dateTimeCulture)
|
|
895
|
+
cultureCache.dateTimeCulture = new DateTimeCulture(
|
|
896
|
+
(_dateTimeCulture = dateTimeCulture) != null ? _dateTimeCulture : culture
|
|
897
|
+
);
|
|
898
|
+
return cultureCache.dateTimeCulture;
|
|
879
899
|
};
|
|
880
900
|
Culture.getDefaultDateEncoding = function getDefaultDateEncoding() {
|
|
881
901
|
return dateEncoding;
|
package/package.json
CHANGED
package/src/ui/Culture.d.ts
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
import * as Cx from
|
|
1
|
+
import * as Cx from "../core";
|
|
2
2
|
//import {NumberCulture, DateTimeCulture} from 'intl-io';
|
|
3
3
|
|
|
4
4
|
declare type DateEncoding = (date: Date) => any;
|
|
5
5
|
|
|
6
6
|
export class Culture {
|
|
7
|
-
static setCulture(cultureCode: string);
|
|
7
|
+
static setCulture(cultureCode: string): void;
|
|
8
8
|
|
|
9
|
-
static setDefaultCurrency(currencyCode: string);
|
|
9
|
+
static setDefaultCurrency(currencyCode: string): void;
|
|
10
10
|
|
|
11
11
|
static readonly defaultCurrency: string;
|
|
12
12
|
|
|
13
13
|
static readonly culture: string;
|
|
14
14
|
|
|
15
|
+
static setNumberCulture(cultureCode: string): void;
|
|
16
|
+
|
|
15
17
|
static getNumberCulture(): any;
|
|
16
18
|
|
|
19
|
+
static setDateTimeCulture(cultureCode: string): void;
|
|
20
|
+
|
|
17
21
|
static getDateTimeCulture(): any;
|
|
18
22
|
|
|
19
23
|
static getDefaultDateEncoding(): DateEncoding;
|
|
20
24
|
|
|
21
|
-
static setDefaultDateEncoding(encoding: DateEncoding);
|
|
25
|
+
static setDefaultDateEncoding(encoding: DateEncoding): void;
|
|
22
26
|
}
|
package/src/ui/Culture.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {NumberCulture, DateTimeCulture} from
|
|
2
|
-
import {Localization} from
|
|
3
|
-
import {GlobalCacheIdentifier} from
|
|
4
|
-
import {invalidateExpressionCache} from "../data/Expression";
|
|
5
|
-
import {invalidateStringTemplateCache} from "../data/StringTemplate";
|
|
6
|
-
import {defaultCompare} from "../data/defaultCompare";
|
|
1
|
+
import { NumberCulture, DateTimeCulture } from "intl-io";
|
|
2
|
+
import { Localization } from "./Localization";
|
|
3
|
+
import { GlobalCacheIdentifier } from "../util/GlobalCacheIdentifier";
|
|
4
|
+
import { invalidateExpressionCache } from "../data/Expression";
|
|
5
|
+
import { invalidateStringTemplateCache } from "../data/StringTemplate";
|
|
6
|
+
import { defaultCompare } from "../data/defaultCompare";
|
|
7
7
|
|
|
8
|
-
let culture =
|
|
8
|
+
let culture = "en";
|
|
9
|
+
let numberCulture = null;
|
|
10
|
+
let dateTimeCulture = null;
|
|
9
11
|
let cultureCache = {};
|
|
10
|
-
let defaultCurrency =
|
|
11
|
-
let dateEncoding = date => date.toISOString();
|
|
12
|
+
let defaultCurrency = "USD";
|
|
13
|
+
let dateEncoding = (date) => date.toISOString();
|
|
12
14
|
|
|
13
15
|
export class Culture {
|
|
14
16
|
static setCulture(cultureCode) {
|
|
@@ -18,6 +20,18 @@ export class Culture {
|
|
|
18
20
|
this.invalidateCache();
|
|
19
21
|
}
|
|
20
22
|
|
|
23
|
+
static setNumberCulture(cultureCode) {
|
|
24
|
+
numberCulture = cultureCode;
|
|
25
|
+
delete cultureCache.numberCulture;
|
|
26
|
+
this.invalidateCache();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static setDateTimeCulture(cultureCode) {
|
|
30
|
+
dateTimeCulture = cultureCode;
|
|
31
|
+
delete cultureCache.dateTimeCulture;
|
|
32
|
+
this.invalidateCache();
|
|
33
|
+
}
|
|
34
|
+
|
|
21
35
|
static setDefaultCurrency(currencyCode) {
|
|
22
36
|
defaultCurrency = currencyCode;
|
|
23
37
|
this.invalidateCache();
|
|
@@ -30,23 +44,21 @@ export class Culture {
|
|
|
30
44
|
}
|
|
31
45
|
|
|
32
46
|
static get defaultCurrency() {
|
|
33
|
-
return defaultCurrency
|
|
34
|
-
}
|
|
47
|
+
return defaultCurrency;
|
|
48
|
+
}
|
|
35
49
|
|
|
36
50
|
static get culture() {
|
|
37
51
|
return culture;
|
|
38
52
|
}
|
|
39
53
|
|
|
40
54
|
static getNumberCulture() {
|
|
41
|
-
if (!cultureCache.numberCulture)
|
|
42
|
-
cultureCache.numberCulture = new NumberCulture(culture);
|
|
55
|
+
if (!cultureCache.numberCulture) cultureCache.numberCulture = new NumberCulture(numberCulture ?? culture);
|
|
43
56
|
return cultureCache.numberCulture;
|
|
44
57
|
}
|
|
45
58
|
|
|
46
59
|
static getDateTimeCulture() {
|
|
47
|
-
if (!cultureCache.
|
|
48
|
-
|
|
49
|
-
return cultureCache.dateCulture;
|
|
60
|
+
if (!cultureCache.dateTimeCulture) cultureCache.dateTimeCulture = new DateTimeCulture(dateTimeCulture ?? culture);
|
|
61
|
+
return cultureCache.dateTimeCulture;
|
|
50
62
|
}
|
|
51
63
|
|
|
52
64
|
static getDefaultDateEncoding() {
|
|
@@ -58,8 +70,7 @@ export class Culture {
|
|
|
58
70
|
}
|
|
59
71
|
|
|
60
72
|
static getComparer(options) {
|
|
61
|
-
if (typeof Intl.Collator != "undefined")
|
|
62
|
-
return new Intl.Collator(culture, options).compare;
|
|
73
|
+
if (typeof Intl.Collator != "undefined") return new Intl.Collator(culture, options).compare;
|
|
63
74
|
return defaultCompare;
|
|
64
75
|
}
|
|
65
76
|
}
|