cx 24.3.8 → 24.3.9
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/charts.js +35 -35
- package/dist/data.js +37 -27
- package/dist/manifest.js +765 -741
- package/dist/svg.js +11 -11
- package/dist/ui.js +213 -86
- package/dist/util.js +6 -1
- package/dist/widgets.js +141 -147
- package/package.json +1 -1
- package/src/data/Expression.d.ts +17 -16
- package/src/data/Expression.js +220 -212
- package/src/data/StringTemplate.d.ts +15 -14
- package/src/data/StringTemplate.js +92 -85
- package/src/ui/Culture.d.ts +47 -23
- package/src/ui/Culture.js +132 -76
- package/src/ui/CultureScope.d.ts +10 -0
- package/src/ui/CultureScope.js +53 -0
- package/src/ui/Format.js +107 -87
- package/src/ui/index.d.ts +43 -42
- package/src/ui/index.js +45 -44
- package/src/util/Format.d.ts +18 -14
- package/src/util/Format.js +234 -242
package/src/ui/Format.js
CHANGED
|
@@ -1,87 +1,107 @@
|
|
|
1
|
-
import { Culture } from "./Culture";
|
|
2
|
-
import { Format as Fmt, resolveMinMaxFractionDigits } from "../util/Format";
|
|
3
|
-
import { GlobalCacheIdentifier } from "../util/GlobalCacheIdentifier";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (flags
|
|
13
|
-
|
|
14
|
-
if (flags.indexOf("
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
cultureSensitiveFormatsRegistered
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
let
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
1
|
+
import { Culture, getCurrentCultureCache } from "./Culture";
|
|
2
|
+
import { Format as Fmt, resolveMinMaxFractionDigits, setGetFormatCacheCallback } from "../util/Format";
|
|
3
|
+
import { GlobalCacheIdentifier } from "../util/GlobalCacheIdentifier";
|
|
4
|
+
import { setGetExpressionCacheCallback } from "../data/Expression";
|
|
5
|
+
import { setGetStringTemplateCacheCallback } from "../data/StringTemplate";
|
|
6
|
+
|
|
7
|
+
export const Format = Fmt;
|
|
8
|
+
|
|
9
|
+
let cultureSensitiveFormatsRegistered = false;
|
|
10
|
+
|
|
11
|
+
export function resolveNumberFormattingFlags(flags) {
|
|
12
|
+
if (!flags) return null;
|
|
13
|
+
let result = {};
|
|
14
|
+
if (flags.indexOf("+") >= 0) result.signDisplay = "exceptZero";
|
|
15
|
+
if (flags.indexOf("c") >= 0) result.notation = "compact";
|
|
16
|
+
if (flags.indexOf("a") >= 0) result.currencySign = "accounting";
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function enableCultureSensitiveFormatting() {
|
|
21
|
+
if (cultureSensitiveFormatsRegistered) return;
|
|
22
|
+
|
|
23
|
+
cultureSensitiveFormatsRegistered = true;
|
|
24
|
+
|
|
25
|
+
Fmt.registerFactory(["number", "n"], (format, minimumFractionDigits, maximumFractionDigits, flags) => {
|
|
26
|
+
let culture = Culture.getNumberCulture();
|
|
27
|
+
|
|
28
|
+
let formatter = culture.getFormatter({
|
|
29
|
+
...resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits),
|
|
30
|
+
...resolveNumberFormattingFlags(flags),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return (value) => formatter.format(value);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
Fmt.registerFactory("currency", (format, currency, minimumFractionDigits, maximumFractionDigits, flags) => {
|
|
37
|
+
let culture = Culture.getNumberCulture();
|
|
38
|
+
currency = currency || Culture.defaultCurrency;
|
|
39
|
+
|
|
40
|
+
let formatter = culture.getFormatter({
|
|
41
|
+
style: "currency",
|
|
42
|
+
currency: currency,
|
|
43
|
+
...resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits),
|
|
44
|
+
...resolveNumberFormattingFlags(flags),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return (value) => formatter.format(value);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
Fmt.registerFactory(["percentage", "p", "%"], (format, minimumFractionDigits, maximumFractionDigits, flags) => {
|
|
51
|
+
let culture = Culture.getNumberCulture();
|
|
52
|
+
let formatter = culture.getFormatter({
|
|
53
|
+
style: "percent",
|
|
54
|
+
...resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits),
|
|
55
|
+
...resolveNumberFormattingFlags(flags),
|
|
56
|
+
});
|
|
57
|
+
return (value) => formatter.format(value);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
Fmt.registerFactory(["percentSign", "ps"], (format, minimumFractionDigits, maximumFractionDigits, flags) => {
|
|
61
|
+
let culture = Culture.getNumberCulture();
|
|
62
|
+
let formatter = culture.getFormatter({
|
|
63
|
+
style: "percent",
|
|
64
|
+
...resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits),
|
|
65
|
+
...resolveNumberFormattingFlags(flags),
|
|
66
|
+
});
|
|
67
|
+
return (value) => formatter.format(value / 100);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
Fmt.registerFactory(["date", "d"], (fmt, format = "yyyyMMdd") => {
|
|
71
|
+
let culture = Culture.getDateTimeCulture();
|
|
72
|
+
let formatter = culture.getFormatter(format);
|
|
73
|
+
return (value) => formatter.format(new Date(value));
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
Fmt.registerFactory(["time", "t"], (fmt, format = "hhmmss") => {
|
|
77
|
+
let culture = Culture.getDateTimeCulture();
|
|
78
|
+
let formatter = culture.getFormatter(format);
|
|
79
|
+
return (value) => formatter.format(new Date(value));
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
Fmt.registerFactory(["datetime", "dt"], (fmt, format = "yyyyMd hhmm") => {
|
|
83
|
+
let culture = Culture.getDateTimeCulture();
|
|
84
|
+
let formatter = culture.getFormatter(format);
|
|
85
|
+
return (value) => formatter.format(new Date(value));
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
setGetFormatCacheCallback(() => {
|
|
89
|
+
let cache = getCurrentCultureCache();
|
|
90
|
+
if (!cache.formatCache) cache.formatCache = {};
|
|
91
|
+
return cache.formatCache;
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
setGetExpressionCacheCallback(() => {
|
|
95
|
+
let cache = getCurrentCultureCache();
|
|
96
|
+
if (!cache.exprCache) cache.exprCache = {};
|
|
97
|
+
return cache.exprCache;
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
setGetStringTemplateCacheCallback(() => {
|
|
101
|
+
let cache = getCurrentCultureCache();
|
|
102
|
+
if (!cache.strTplCache) cache.strTplCache = {};
|
|
103
|
+
return cache.strTplCache;
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
GlobalCacheIdentifier.change();
|
|
107
|
+
}
|
package/src/ui/index.d.ts
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
export * from "./Controller";
|
|
2
|
-
export * from "./Widget";
|
|
3
|
-
export * from "./Container";
|
|
4
|
-
export * from "./PureContainer";
|
|
5
|
-
export * from "./Repeater";
|
|
6
|
-
export * from "./Rescope";
|
|
7
|
-
export * from "./StaticText";
|
|
8
|
-
export * from "./Text";
|
|
9
|
-
export * from "./CSS";
|
|
10
|
-
export * from "./CSSHelper";
|
|
11
|
-
export * from "./FocusManager";
|
|
12
|
-
export * from "./ResizeManager";
|
|
13
|
-
export * from "./ZIndexManager";
|
|
14
|
-
export * from "./Format";
|
|
15
|
-
export * from "./Culture";
|
|
16
|
-
export * from "./Localization";
|
|
17
|
-
export * from "./Cx";
|
|
18
|
-
export * from "./Instance";
|
|
19
|
-
export * from "./RenderingContext";
|
|
20
|
-
export * from "./ContentResolver";
|
|
21
|
-
export * from "./batchUpdates";
|
|
22
|
-
export * from "./IsolatedScope";
|
|
23
|
-
export * from "./DetachedScope";
|
|
24
|
-
export * from "./Restate";
|
|
25
|
-
export * from "./DataProxy";
|
|
26
|
-
export * from "./keyboardShortcuts";
|
|
27
|
-
export * from "./createFunctionalComponent";
|
|
28
|
-
export * from "./StructuredInstanceDataAccessor";
|
|
29
|
-
export * from "./HoverSync";
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export * from "./
|
|
33
|
-
export * from "./
|
|
34
|
-
export * from "./
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export * from "./
|
|
38
|
-
export * from "./
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
export * from "./Controller";
|
|
2
|
+
export * from "./Widget";
|
|
3
|
+
export * from "./Container";
|
|
4
|
+
export * from "./PureContainer";
|
|
5
|
+
export * from "./Repeater";
|
|
6
|
+
export * from "./Rescope";
|
|
7
|
+
export * from "./StaticText";
|
|
8
|
+
export * from "./Text";
|
|
9
|
+
export * from "./CSS";
|
|
10
|
+
export * from "./CSSHelper";
|
|
11
|
+
export * from "./FocusManager";
|
|
12
|
+
export * from "./ResizeManager";
|
|
13
|
+
export * from "./ZIndexManager";
|
|
14
|
+
export * from "./Format";
|
|
15
|
+
export * from "./Culture";
|
|
16
|
+
export * from "./Localization";
|
|
17
|
+
export * from "./Cx";
|
|
18
|
+
export * from "./Instance";
|
|
19
|
+
export * from "./RenderingContext";
|
|
20
|
+
export * from "./ContentResolver";
|
|
21
|
+
export * from "./batchUpdates";
|
|
22
|
+
export * from "./IsolatedScope";
|
|
23
|
+
export * from "./DetachedScope";
|
|
24
|
+
export * from "./Restate";
|
|
25
|
+
export * from "./DataProxy";
|
|
26
|
+
export * from "./keyboardShortcuts";
|
|
27
|
+
export * from "./createFunctionalComponent";
|
|
28
|
+
export * from "./StructuredInstanceDataAccessor";
|
|
29
|
+
export * from "./HoverSync";
|
|
30
|
+
export * from "./CultureScope";
|
|
31
|
+
|
|
32
|
+
export * from "./selection/index";
|
|
33
|
+
export * from "./layout/index";
|
|
34
|
+
export * from "./app/index";
|
|
35
|
+
export * from "./adapter/index";
|
|
36
|
+
|
|
37
|
+
export * from "./bind";
|
|
38
|
+
export * from "./tpl";
|
|
39
|
+
export * from "./expr";
|
|
40
|
+
|
|
41
|
+
//re-export computable here
|
|
42
|
+
import { computable } from "../data/computable";
|
|
43
|
+
export { computable };
|
package/src/ui/index.js
CHANGED
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
22
|
-
export * from
|
|
23
|
-
export * from
|
|
24
|
-
export * from
|
|
25
|
-
export * from
|
|
26
|
-
export * from
|
|
27
|
-
export * from "./StructuredInstanceDataAccessor";
|
|
28
|
-
export * from "./HoverSync";
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export * from "./
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
export * from "./
|
|
35
|
-
export * from "./
|
|
36
|
-
export * from "./
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
export * from "./
|
|
40
|
-
export * from "./
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
export * from "./Controller";
|
|
2
|
+
export * from "./Widget";
|
|
3
|
+
export * from "./Container";
|
|
4
|
+
export * from "./PureContainer";
|
|
5
|
+
export * from "./Repeater";
|
|
6
|
+
export * from "./Rescope";
|
|
7
|
+
export * from "./StaticText";
|
|
8
|
+
export * from "./Text";
|
|
9
|
+
export * from "./CSS";
|
|
10
|
+
export * from "./CSSHelper";
|
|
11
|
+
export * from "./FocusManager";
|
|
12
|
+
export * from "./ResizeManager";
|
|
13
|
+
export * from "./ZIndexManager";
|
|
14
|
+
export * from "./Format";
|
|
15
|
+
export * from "./Culture";
|
|
16
|
+
export * from "./Localization";
|
|
17
|
+
export * from "./Cx";
|
|
18
|
+
export * from "./Instance";
|
|
19
|
+
export * from "./RenderingContext";
|
|
20
|
+
export * from "./ContentResolver";
|
|
21
|
+
export * from "./batchUpdates";
|
|
22
|
+
export * from "./IsolatedScope";
|
|
23
|
+
export * from "./DetachedScope";
|
|
24
|
+
export * from "./Restate";
|
|
25
|
+
export * from "./DataProxy";
|
|
26
|
+
export * from "./keyboardShortcuts";
|
|
27
|
+
export * from "./StructuredInstanceDataAccessor";
|
|
28
|
+
export * from "./HoverSync";
|
|
29
|
+
export * from "./CultureScope";
|
|
30
|
+
|
|
31
|
+
export * from "./createFunctionalComponent";
|
|
32
|
+
export * from "./flattenProps";
|
|
33
|
+
|
|
34
|
+
export * from "./selection/index";
|
|
35
|
+
export * from "./layout/index";
|
|
36
|
+
export * from "./app/index";
|
|
37
|
+
export * from "./adapter/index";
|
|
38
|
+
|
|
39
|
+
export * from "./bind";
|
|
40
|
+
export * from "./tpl";
|
|
41
|
+
export * from "./expr";
|
|
42
|
+
|
|
43
|
+
//re-export computable here
|
|
44
|
+
import { computable } from "../data/computable";
|
|
45
|
+
export { computable };
|
package/src/util/Format.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
declare type Formatter = (any) => string;
|
|
2
|
-
|
|
3
|
-
export class Format {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
declare type Formatter = (any) => string;
|
|
2
|
+
|
|
3
|
+
export class Format {
|
|
4
|
+
static value(v: any, format: string): string;
|
|
5
|
+
|
|
6
|
+
static parse(format: string): Formatter;
|
|
7
|
+
|
|
8
|
+
static register(format: string | string[], formatter: Formatter): void;
|
|
9
|
+
|
|
10
|
+
static registerFactory(format: string | string[], factory: (...args) => Formatter): void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function resolveMinMaxFractionDigits(
|
|
14
|
+
minimumFractionDigits: number,
|
|
15
|
+
maximumFractionDigits: number,
|
|
16
|
+
): { minimumFractionDigits: number; maximumFractionDigits: number };
|
|
17
|
+
|
|
18
|
+
export function setGetFormatCacheCallback(callback: () => {}): void;
|