cx 24.3.10 → 24.4.0
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.css +6 -0
- package/dist/charts.js +307 -62
- package/dist/manifest.js +748 -741
- package/dist/ui.js +58 -119
- package/package.json +1 -1
- package/src/charts/BarGraph.d.ts +7 -9
- package/src/charts/ColumnGraph.d.ts +10 -12
- package/src/charts/LineGraph.d.ts +1 -1
- package/src/charts/PieChart.d.ts +6 -0
- package/src/charts/PieChart.js +162 -82
- package/src/charts/RangeMarker.d.ts +35 -0
- package/src/charts/RangeMarker.js +155 -0
- package/src/charts/RangeMarker.scss +15 -0
- package/src/charts/ScatterGraph.d.ts +30 -32
- package/src/charts/index.d.ts +1 -0
- package/src/charts/index.js +1 -0
- package/src/charts/index.scss +1 -0
- package/src/charts/variables.scss +21 -20
- package/src/data/Expression.d.ts +17 -17
- package/src/data/Expression.js +220 -220
- package/src/data/StringTemplate.d.ts +15 -15
- package/src/data/StringTemplate.js +92 -92
- package/src/ui/Culture.d.ts +51 -47
- package/src/ui/Culture.js +129 -132
- package/src/ui/Cx.js +313 -311
- package/src/ui/Format.js +107 -107
- package/src/ui/Restate.d.ts +3 -0
- package/src/ui/Restate.js +163 -163
- package/src/ui/index.d.ts +0 -1
- package/src/ui/index.js +44 -45
- package/src/util/Console.d.ts +2 -7
- package/src/util/Format.d.ts +18 -18
- package/src/util/Format.js +234 -234
- package/src/widgets/drag-drop/DropZone.d.ts +9 -9
- package/src/widgets/grid/Grid.d.ts +12 -12
- package/src/ui/CultureScope.d.ts +0 -10
- package/src/ui/CultureScope.js +0 -55
package/src/ui/Format.js
CHANGED
|
@@ -1,107 +1,107 @@
|
|
|
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
|
-
}
|
|
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/Restate.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Instance } from "./Instance";
|
|
2
2
|
import * as Cx from "../core";
|
|
3
|
+
import { CultureInfo } from "./Culture";
|
|
3
4
|
|
|
4
5
|
interface RestateProps extends Cx.PureContainerProps {
|
|
5
6
|
data?: Cx.StructuredProp;
|
|
@@ -12,6 +13,8 @@ interface RestateProps extends Cx.PureContainerProps {
|
|
|
12
13
|
immediate?: boolean;
|
|
13
14
|
|
|
14
15
|
onError?: (err: Error, instance: Instance) => void;
|
|
16
|
+
|
|
17
|
+
culture?: CultureInfo;
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
export class Restate extends Cx.Widget<RestateProps> {}
|
package/src/ui/Restate.js
CHANGED
|
@@ -1,163 +1,163 @@
|
|
|
1
|
-
import { PureContainer } from "./PureContainer";
|
|
2
|
-
import { Store } from "../data/Store";
|
|
3
|
-
import { Cx } from "./Cx";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
delete this.
|
|
38
|
-
delete this.
|
|
39
|
-
delete this.
|
|
40
|
-
delete this.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
instance.store
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
instance.cultureInfo
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
instance.container
|
|
81
|
-
instance.container
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
Restate.prototype.
|
|
108
|
-
Restate.prototype.
|
|
109
|
-
Restate.prototype.
|
|
110
|
-
|
|
111
|
-
export const PrivateStore = Restate;
|
|
112
|
-
|
|
113
|
-
class RestateStore extends Store {
|
|
114
|
-
constructor(config) {
|
|
115
|
-
super(config);
|
|
116
|
-
this.parentDataVersion = -1;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
getData() {
|
|
120
|
-
this.silently(() => {
|
|
121
|
-
this.parentDataCheck();
|
|
122
|
-
});
|
|
123
|
-
return super.getData();
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
parentDataCheck() {
|
|
127
|
-
if (this.parentDataVersion == this.store.meta.version) return false;
|
|
128
|
-
this.parentDataVersion = this.store.meta.version;
|
|
129
|
-
this.parentData = this.dataSelector(this.store.getData());
|
|
130
|
-
return this.batch(() => {
|
|
131
|
-
for (let key in this.parentData) {
|
|
132
|
-
super.setItem(key, this.parentData[key]);
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
setItem(path, value) {
|
|
138
|
-
let binding = Binding.get(path);
|
|
139
|
-
let bindingRoot = binding.parts[0];
|
|
140
|
-
if (!isObject(this.privateData) || !this.privateData.hasOwnProperty(bindingRoot)) {
|
|
141
|
-
let changed = isUndefined(value) ? super.deleteItem(path) : super.setItem(path, value);
|
|
142
|
-
return changed;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
let newValue = value;
|
|
146
|
-
if (binding.parts.length > 1) newValue = binding.set(this.getData(), value)[bindingRoot];
|
|
147
|
-
this.onSet(bindingRoot, newValue);
|
|
148
|
-
this.batch(() => {
|
|
149
|
-
super.setItem(bindingRoot, newValue);
|
|
150
|
-
this.parentDataCheck();
|
|
151
|
-
});
|
|
152
|
-
return true;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
deleteItem(path) {
|
|
156
|
-
return this.setItem(path, undefined);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
doNotify() {
|
|
160
|
-
if (!this.detached) this.store.notify();
|
|
161
|
-
super.doNotify();
|
|
162
|
-
}
|
|
163
|
-
}
|
|
1
|
+
import { PureContainer } from "./PureContainer";
|
|
2
|
+
import { Store } from "../data/Store";
|
|
3
|
+
import { Cx } from "./Cx";
|
|
4
|
+
import { VDOM } from "./VDOM";
|
|
5
|
+
import { isObject } from "../util/isObject";
|
|
6
|
+
import { isUndefined } from "../util/isUndefined";
|
|
7
|
+
import { Binding } from "../data/Binding";
|
|
8
|
+
import { StructuredSelector } from "../data/StructuredSelector";
|
|
9
|
+
import { getCurrentCulture } from "./Culture";
|
|
10
|
+
|
|
11
|
+
let persistenceCache = {};
|
|
12
|
+
|
|
13
|
+
export class Restate extends PureContainer {
|
|
14
|
+
declareData() {
|
|
15
|
+
return super.declareData(...arguments, {
|
|
16
|
+
deferredUntilIdle: undefined,
|
|
17
|
+
idleTimeout: undefined,
|
|
18
|
+
cacheKey: undefined,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
init() {
|
|
23
|
+
this.container = PureContainer.create({
|
|
24
|
+
type: PureContainer,
|
|
25
|
+
items: this.children || this.items,
|
|
26
|
+
layout: this.layout,
|
|
27
|
+
controller: this.controller,
|
|
28
|
+
outerLayout: this.outerLayout,
|
|
29
|
+
useParentLayout: !this.detached,
|
|
30
|
+
ws: this.ws,
|
|
31
|
+
});
|
|
32
|
+
this.privateDataSelector = new StructuredSelector({
|
|
33
|
+
props: this.data || {},
|
|
34
|
+
values: this.data,
|
|
35
|
+
});
|
|
36
|
+
delete this.items;
|
|
37
|
+
delete this.children;
|
|
38
|
+
delete this.controller;
|
|
39
|
+
delete this.outerLayout;
|
|
40
|
+
delete this.layout;
|
|
41
|
+
if (this.useParentLayout == null) this.useParentLayout = !this.detached;
|
|
42
|
+
super.init();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
initSubStore(context, instance) {
|
|
46
|
+
let { cacheKey } = instance.data;
|
|
47
|
+
this.privateDataSelector.init(instance.store);
|
|
48
|
+
instance.subStore = new RestateStore({
|
|
49
|
+
store: instance.store,
|
|
50
|
+
detached: this.detached,
|
|
51
|
+
privateData: this.data || {},
|
|
52
|
+
data: cacheKey ? persistenceCache[cacheKey] || {} : {},
|
|
53
|
+
dataSelector: this.privateDataSelector.create(),
|
|
54
|
+
onSet: (path, value) => instance.nestedDataSet(path, value, this.data),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
instance.setStore = (store) => {
|
|
58
|
+
instance.store = store;
|
|
59
|
+
instance.subStore.setStore(store);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
if (cacheKey) {
|
|
63
|
+
instance.subscribeOnDestroy(() => {
|
|
64
|
+
persistenceCache[cacheKey] = instance.subStore.getData();
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
explore(context, instance) {
|
|
70
|
+
if (!instance.subStore) this.initSubStore(context, instance);
|
|
71
|
+
if (instance.subStore.parentDataCheck()) instance.markShouldUpdate();
|
|
72
|
+
instance.cultureInfo = this.culture ?? getCurrentCulture();
|
|
73
|
+
if (instance.cache("cultureInfo", instance.culture)) instance.markShouldUpdate();
|
|
74
|
+
super.explore(context, instance);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
exploreItems(context, instance, items) {
|
|
78
|
+
if (!this.detached) {
|
|
79
|
+
instance.container = instance.getChild(context, this.container, "container", instance.subStore);
|
|
80
|
+
instance.container.scheduleExploreIfVisible(context);
|
|
81
|
+
instance.children = [instance.container];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
render(context, instance, key) {
|
|
86
|
+
if (!this.detached) return instance.container.render(context);
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<Cx
|
|
90
|
+
key={key}
|
|
91
|
+
widget={this.container}
|
|
92
|
+
parentInstance={instance}
|
|
93
|
+
store={instance.subStore}
|
|
94
|
+
subscribe
|
|
95
|
+
options={this.options}
|
|
96
|
+
onError={this.onError}
|
|
97
|
+
deferredUntilIdle={instance.data.deferredUntilIdle}
|
|
98
|
+
idleTimeout={instance.data.idleTimeout}
|
|
99
|
+
immediate={this.immediate}
|
|
100
|
+
cultureInfo={instance.cultureInfo}
|
|
101
|
+
/>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
Restate.prototype.detached = false;
|
|
107
|
+
Restate.prototype.waitForIdle = false;
|
|
108
|
+
Restate.prototype.immediate = false;
|
|
109
|
+
Restate.prototype.culture = null;
|
|
110
|
+
|
|
111
|
+
export const PrivateStore = Restate;
|
|
112
|
+
|
|
113
|
+
class RestateStore extends Store {
|
|
114
|
+
constructor(config) {
|
|
115
|
+
super(config);
|
|
116
|
+
this.parentDataVersion = -1;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
getData() {
|
|
120
|
+
this.silently(() => {
|
|
121
|
+
this.parentDataCheck();
|
|
122
|
+
});
|
|
123
|
+
return super.getData();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
parentDataCheck() {
|
|
127
|
+
if (this.parentDataVersion == this.store.meta.version) return false;
|
|
128
|
+
this.parentDataVersion = this.store.meta.version;
|
|
129
|
+
this.parentData = this.dataSelector(this.store.getData());
|
|
130
|
+
return this.batch(() => {
|
|
131
|
+
for (let key in this.parentData) {
|
|
132
|
+
super.setItem(key, this.parentData[key]);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
setItem(path, value) {
|
|
138
|
+
let binding = Binding.get(path);
|
|
139
|
+
let bindingRoot = binding.parts[0];
|
|
140
|
+
if (!isObject(this.privateData) || !this.privateData.hasOwnProperty(bindingRoot)) {
|
|
141
|
+
let changed = isUndefined(value) ? super.deleteItem(path) : super.setItem(path, value);
|
|
142
|
+
return changed;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
let newValue = value;
|
|
146
|
+
if (binding.parts.length > 1) newValue = binding.set(this.getData(), value)[bindingRoot];
|
|
147
|
+
this.onSet(bindingRoot, newValue);
|
|
148
|
+
this.batch(() => {
|
|
149
|
+
super.setItem(bindingRoot, newValue);
|
|
150
|
+
this.parentDataCheck();
|
|
151
|
+
});
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
deleteItem(path) {
|
|
156
|
+
return this.setItem(path, undefined);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
doNotify() {
|
|
160
|
+
if (!this.detached) this.store.notify();
|
|
161
|
+
super.doNotify();
|
|
162
|
+
}
|
|
163
|
+
}
|
package/src/ui/index.d.ts
CHANGED
|
@@ -27,7 +27,6 @@ export * from "./keyboardShortcuts";
|
|
|
27
27
|
export * from "./createFunctionalComponent";
|
|
28
28
|
export * from "./StructuredInstanceDataAccessor";
|
|
29
29
|
export * from "./HoverSync";
|
|
30
|
-
export * from "./CultureScope";
|
|
31
30
|
|
|
32
31
|
export * from "./selection/index";
|
|
33
32
|
export * from "./layout/index";
|
package/src/ui/index.js
CHANGED
|
@@ -1,45 +1,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
|
-
|
|
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
|
-
|
|
45
|
-
export { computable };
|
|
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
|
+
|
|
30
|
+
export * from "./createFunctionalComponent";
|
|
31
|
+
export * from "./flattenProps";
|
|
32
|
+
|
|
33
|
+
export * from "./selection/index";
|
|
34
|
+
export * from "./layout/index";
|
|
35
|
+
export * from "./app/index";
|
|
36
|
+
export * from "./adapter/index";
|
|
37
|
+
|
|
38
|
+
export * from "./bind";
|
|
39
|
+
export * from "./tpl";
|
|
40
|
+
export * from "./expr";
|
|
41
|
+
|
|
42
|
+
//re-export computable here
|
|
43
|
+
import { computable } from "../data/computable";
|
|
44
|
+
export { computable };
|