cx 24.3.10 → 24.3.11
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 +656 -650
- package/dist/ui.js +64 -52
- package/package.json +1 -1
- package/src/ui/Culture.d.ts +5 -1
- package/src/ui/Culture.js +24 -17
- package/src/ui/CultureScope.js +1 -3
- package/src/ui/Cx.js +25 -23
- package/src/ui/Restate.d.ts +21 -18
- package/src/ui/Restate.js +3 -3
package/dist/ui.js
CHANGED
|
@@ -833,20 +833,20 @@ var stack = [
|
|
|
833
833
|
},
|
|
834
834
|
},
|
|
835
835
|
];
|
|
836
|
-
function
|
|
836
|
+
function getDefaultCulture() {
|
|
837
837
|
return stack[0];
|
|
838
838
|
}
|
|
839
|
-
function
|
|
839
|
+
function getCurrentCulture() {
|
|
840
840
|
return stack[stack.length - 1];
|
|
841
841
|
}
|
|
842
842
|
function getCurrentCultureCache() {
|
|
843
|
-
return
|
|
843
|
+
return getCurrentCulture().cache;
|
|
844
844
|
}
|
|
845
845
|
function pushCulture(cultureInfo) {
|
|
846
846
|
stack.push(cultureInfo);
|
|
847
847
|
}
|
|
848
848
|
function createCulture(cultureSpecs) {
|
|
849
|
-
var current =
|
|
849
|
+
var current = getCurrentCulture();
|
|
850
850
|
var info = {
|
|
851
851
|
culture: current.culture,
|
|
852
852
|
dateEncoding: current.dateEncoding,
|
|
@@ -859,38 +859,45 @@ function createCulture(cultureSpecs) {
|
|
|
859
859
|
}
|
|
860
860
|
return info;
|
|
861
861
|
}
|
|
862
|
-
function popCulture() {
|
|
862
|
+
function popCulture(cultureSpecs) {
|
|
863
863
|
if (stack.length == 1) throw new Error("Cannot pop the last culture object.");
|
|
864
|
-
|
|
864
|
+
if (cultureSpecs && stack[stack.length - 1] !== cultureSpecs) {
|
|
865
|
+
console.warn("Popped culture object does not match the current one.");
|
|
866
|
+
}
|
|
867
|
+
try {
|
|
868
|
+
return stack.pop();
|
|
869
|
+
} finally {
|
|
870
|
+
console.log(stack);
|
|
871
|
+
}
|
|
865
872
|
}
|
|
866
873
|
var Culture = /*#__PURE__*/ (function () {
|
|
867
874
|
function Culture() {}
|
|
868
875
|
Culture.setCulture = function setCulture(cultureCode) {
|
|
869
|
-
var cultureSpecs =
|
|
876
|
+
var cultureSpecs = getDefaultCulture();
|
|
870
877
|
cultureSpecs.culture = cultureCode;
|
|
871
878
|
cultureSpecs.cache = {};
|
|
872
879
|
Localization.setCulture(cultureCode);
|
|
873
880
|
this.invalidateCache();
|
|
874
881
|
};
|
|
875
882
|
Culture.setNumberCulture = function setNumberCulture(cultureCode) {
|
|
876
|
-
var cultureSpecs =
|
|
883
|
+
var cultureSpecs = getDefaultCulture();
|
|
877
884
|
cultureSpecs.numberCulture = cultureCode;
|
|
878
885
|
delete cultureSpecs.cache.numberCulture;
|
|
879
886
|
this.invalidateCache();
|
|
880
887
|
};
|
|
881
888
|
Culture.setDateTimeCulture = function setDateTimeCulture(cultureCode) {
|
|
882
|
-
var cultureSpecs =
|
|
889
|
+
var cultureSpecs = getDefaultCulture();
|
|
883
890
|
cultureSpecs.dateTimeCulture = cultureCode;
|
|
884
891
|
delete cultureSpecs.cache.dateTimeCulture;
|
|
885
892
|
this.invalidateCache();
|
|
886
893
|
};
|
|
887
894
|
Culture.setDefaultCurrency = function setDefaultCurrency(currencyCode) {
|
|
888
|
-
var cultureSpecs =
|
|
895
|
+
var cultureSpecs = getDefaultCulture();
|
|
889
896
|
cultureSpecs.defaultCurrency = currencyCode;
|
|
890
897
|
this.invalidateCache();
|
|
891
898
|
};
|
|
892
899
|
Culture.setDefaultDateEncoding = function setDefaultDateEncoding(encoding) {
|
|
893
|
-
var cultureSpecs =
|
|
900
|
+
var cultureSpecs = getDefaultCulture();
|
|
894
901
|
cultureSpecs.dateEncoding = encoding;
|
|
895
902
|
this.invalidateCache();
|
|
896
903
|
};
|
|
@@ -900,28 +907,28 @@ var Culture = /*#__PURE__*/ (function () {
|
|
|
900
907
|
invalidateStringTemplateCache();
|
|
901
908
|
};
|
|
902
909
|
Culture.getNumberCulture = function getNumberCulture() {
|
|
903
|
-
var
|
|
904
|
-
cache =
|
|
905
|
-
numberCulture =
|
|
906
|
-
culture =
|
|
910
|
+
var _getCurrentCulture = getCurrentCulture(),
|
|
911
|
+
cache = _getCurrentCulture.cache,
|
|
912
|
+
numberCulture = _getCurrentCulture.numberCulture,
|
|
913
|
+
culture = _getCurrentCulture.culture;
|
|
907
914
|
if (!cache.numberCulture) cache.numberCulture = new NumberCulture(numberCulture != null ? numberCulture : culture);
|
|
908
915
|
return cache.numberCulture;
|
|
909
916
|
};
|
|
910
917
|
Culture.getDateTimeCulture = function getDateTimeCulture() {
|
|
911
|
-
var
|
|
912
|
-
cache =
|
|
913
|
-
dateTimeCulture =
|
|
914
|
-
culture =
|
|
918
|
+
var _getCurrentCulture2 = getCurrentCulture(),
|
|
919
|
+
cache = _getCurrentCulture2.cache,
|
|
920
|
+
dateTimeCulture = _getCurrentCulture2.dateTimeCulture,
|
|
921
|
+
culture = _getCurrentCulture2.culture;
|
|
915
922
|
if (!cache.dateTimeCulture)
|
|
916
923
|
cache.dateTimeCulture = new DateTimeCulture(dateTimeCulture != null ? dateTimeCulture : culture);
|
|
917
924
|
return cache.dateTimeCulture;
|
|
918
925
|
};
|
|
919
926
|
Culture.getDefaultDateEncoding = function getDefaultDateEncoding() {
|
|
920
|
-
return
|
|
927
|
+
return getCurrentCulture().dateEncoding;
|
|
921
928
|
};
|
|
922
929
|
Culture.getComparer = function getComparer(options) {
|
|
923
|
-
var
|
|
924
|
-
culture =
|
|
930
|
+
var _getCurrentCulture3 = getCurrentCulture(),
|
|
931
|
+
culture = _getCurrentCulture3.culture;
|
|
925
932
|
if (typeof Intl.Collator != "undefined") return new Intl.Collator(culture, options).compare;
|
|
926
933
|
return defaultCompare;
|
|
927
934
|
};
|
|
@@ -929,13 +936,13 @@ var Culture = /*#__PURE__*/ (function () {
|
|
|
929
936
|
{
|
|
930
937
|
key: "defaultCurrency",
|
|
931
938
|
get: function get() {
|
|
932
|
-
return
|
|
939
|
+
return getCurrentCulture().defaultCurrency;
|
|
933
940
|
},
|
|
934
941
|
},
|
|
935
942
|
{
|
|
936
943
|
key: "culture",
|
|
937
944
|
get: function get() {
|
|
938
|
-
return
|
|
945
|
+
return getCurrentCulture().culture;
|
|
939
946
|
},
|
|
940
947
|
},
|
|
941
948
|
]);
|
|
@@ -2296,7 +2303,10 @@ var Cx = /*#__PURE__*/ (function (_VDOM$Component) {
|
|
|
2296
2303
|
throw new Error("Could not resolve a widget instance in the Cx component.");
|
|
2297
2304
|
};
|
|
2298
2305
|
_proto.render = function render() {
|
|
2306
|
+
var _this$props$cultureIn;
|
|
2299
2307
|
if (this.props.deferredUntilIdle && this.state.deferToken < this.deferCounter) return null;
|
|
2308
|
+
var cultureInfo =
|
|
2309
|
+
(_this$props$cultureIn = this.props.cultureInfo) != null ? _this$props$cultureIn : getCurrentCulture();
|
|
2300
2310
|
return /*#__PURE__*/ jsx(CxContext, {
|
|
2301
2311
|
instance: this.getInstance(),
|
|
2302
2312
|
flags: this.flags,
|
|
@@ -2304,7 +2314,7 @@ var Cx = /*#__PURE__*/ (function (_VDOM$Component) {
|
|
|
2304
2314
|
buster: ++this.renderCount,
|
|
2305
2315
|
contentFactory: this.props.contentFactory,
|
|
2306
2316
|
forceUpdate: this.forceUpdateCallback,
|
|
2307
|
-
cultureInfo:
|
|
2317
|
+
cultureInfo: cultureInfo,
|
|
2308
2318
|
});
|
|
2309
2319
|
};
|
|
2310
2320
|
_proto.componentDidMount = function componentDidMount() {
|
|
@@ -2431,32 +2441,32 @@ var CxContext = /*#__PURE__*/ (function (_VDOM$Component2) {
|
|
|
2431
2441
|
break;
|
|
2432
2442
|
}
|
|
2433
2443
|
} while (this.props.flags.dirty && ++count <= 3 && Widget.optimizePrepare && now() - this.timings.start < 8);
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
this.timings.afterExplore = now();
|
|
2439
|
-
for (var i = 0; i < context.prepareList.length; i++) context.prepareList[i].prepare(context);
|
|
2440
|
-
this.timings.afterPrepare = now();
|
|
2444
|
+
if (visible) {
|
|
2445
|
+
this.timings.afterExplore = now();
|
|
2446
|
+
for (var i = 0; i < context.prepareList.length; i++) context.prepareList[i].prepare(context);
|
|
2447
|
+
this.timings.afterPrepare = now();
|
|
2441
2448
|
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2449
|
+
//walk in reverse order so children get rendered first
|
|
2450
|
+
var renderList = context.getRootRenderList();
|
|
2451
|
+
while (renderList) {
|
|
2452
|
+
for (var _i = renderList.data.length - 1; _i >= 0; _i--) {
|
|
2453
|
+
renderList.data[_i].render(context);
|
|
2454
|
+
}
|
|
2455
|
+
renderList = renderList.right;
|
|
2447
2456
|
}
|
|
2448
|
-
|
|
2457
|
+
this.content = getContent(instance.vdom);
|
|
2458
|
+
if (contentFactory)
|
|
2459
|
+
this.content = contentFactory({
|
|
2460
|
+
children: this.content,
|
|
2461
|
+
});
|
|
2462
|
+
this.timings.afterRender = now();
|
|
2463
|
+
for (var _i2 = 0; _i2 < context.cleanupList.length; _i2++) context.cleanupList[_i2].cleanup(context);
|
|
2464
|
+
} else {
|
|
2465
|
+
this.content = null;
|
|
2466
|
+
this.timings.afterExplore = this.timings.afterPrepare = this.timings.afterRender = now();
|
|
2449
2467
|
}
|
|
2450
|
-
|
|
2451
|
-
if (
|
|
2452
|
-
this.content = contentFactory({
|
|
2453
|
-
children: this.content,
|
|
2454
|
-
});
|
|
2455
|
-
this.timings.afterRender = now();
|
|
2456
|
-
for (var _i2 = 0; _i2 < context.cleanupList.length; _i2++) context.cleanupList[_i2].cleanup(context);
|
|
2457
|
-
} else {
|
|
2458
|
-
this.content = null;
|
|
2459
|
-
this.timings.afterExplore = this.timings.afterPrepare = this.timings.afterRender = now();
|
|
2468
|
+
} finally {
|
|
2469
|
+
if (this.props.cultureInfo) popCulture(this.props.cultureInfo);
|
|
2460
2470
|
}
|
|
2461
2471
|
this.timings.beforeVDOMRender = now();
|
|
2462
2472
|
this.props.flags.preparing = false;
|
|
@@ -2822,9 +2832,10 @@ var Restate = /*#__PURE__*/ (function (_PureContainer) {
|
|
|
2822
2832
|
}
|
|
2823
2833
|
};
|
|
2824
2834
|
_proto.explore = function explore(context, instance) {
|
|
2835
|
+
var _this$culture;
|
|
2825
2836
|
if (!instance.subStore) this.initSubStore(context, instance);
|
|
2826
2837
|
if (instance.subStore.parentDataCheck()) instance.markShouldUpdate();
|
|
2827
|
-
instance.cultureInfo =
|
|
2838
|
+
instance.cultureInfo = (_this$culture = this.culture) != null ? _this$culture : getCurrentCulture();
|
|
2828
2839
|
if (instance.cache("cultureInfo", instance.culture)) instance.markShouldUpdate();
|
|
2829
2840
|
_PureContainer.prototype.explore.call(this, context, instance);
|
|
2830
2841
|
};
|
|
@@ -2859,6 +2870,7 @@ var Restate = /*#__PURE__*/ (function (_PureContainer) {
|
|
|
2859
2870
|
Restate.prototype.detached = false;
|
|
2860
2871
|
Restate.prototype.waitForIdle = false;
|
|
2861
2872
|
Restate.prototype.immediate = false;
|
|
2873
|
+
Restate.prototype.culture = null;
|
|
2862
2874
|
var PrivateStore = Restate;
|
|
2863
2875
|
var RestateStore = /*#__PURE__*/ (function (_Store) {
|
|
2864
2876
|
function RestateStore(config) {
|
|
@@ -3209,12 +3221,10 @@ var CultureScope = /*#__PURE__*/ (function (_PureContainer) {
|
|
|
3209
3221
|
var culture = instance.culture;
|
|
3210
3222
|
pushCulture(culture);
|
|
3211
3223
|
if (this.items.length == 0 && this.initialItems) this.add(this.initialItems);
|
|
3212
|
-
context.push("cultureInfo", culture);
|
|
3213
3224
|
_PureContainer.prototype.explore.call(this, context, instance);
|
|
3214
3225
|
};
|
|
3215
3226
|
_proto.exploreCleanup = function exploreCleanup(context, instance) {
|
|
3216
|
-
|
|
3217
|
-
popCulture();
|
|
3227
|
+
popCulture(instance.culture);
|
|
3218
3228
|
};
|
|
3219
3229
|
return CultureScope;
|
|
3220
3230
|
})(PureContainer);
|
|
@@ -4576,8 +4586,10 @@ export {
|
|
|
4576
4586
|
flattenProps,
|
|
4577
4587
|
getContent,
|
|
4578
4588
|
getContentArray,
|
|
4589
|
+
getCurrentCulture,
|
|
4579
4590
|
getCurrentCultureCache,
|
|
4580
4591
|
getCurrentInstance,
|
|
4592
|
+
getDefaultCulture,
|
|
4581
4593
|
isBatchingUpdates,
|
|
4582
4594
|
notifyBatchedUpdateCompleted,
|
|
4583
4595
|
notifyBatchedUpdateStarting,
|
package/package.json
CHANGED
package/src/ui/Culture.d.ts
CHANGED
|
@@ -42,6 +42,10 @@ export function createCulture(cultureSpecs: CultureSpecs): CultureInfo;
|
|
|
42
42
|
|
|
43
43
|
export function pushCulture(cultureSpecs: CultureInfo): void;
|
|
44
44
|
|
|
45
|
-
export function popCulture(): CultureInfo;
|
|
45
|
+
export function popCulture(cultureSpecs?: CultureInfo): CultureInfo;
|
|
46
46
|
|
|
47
47
|
export function getCurrentCultureCache(): any;
|
|
48
|
+
|
|
49
|
+
export function getCurrentCulture(): CultureInfo;
|
|
50
|
+
|
|
51
|
+
export function getDefaultCulture(): CultureInfo;
|
package/src/ui/Culture.js
CHANGED
|
@@ -23,16 +23,16 @@ let stack = [
|
|
|
23
23
|
},
|
|
24
24
|
];
|
|
25
25
|
|
|
26
|
-
function
|
|
26
|
+
export function getDefaultCulture() {
|
|
27
27
|
return stack[0];
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
function
|
|
30
|
+
export function getCurrentCulture() {
|
|
31
31
|
return stack[stack.length - 1];
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export function getCurrentCultureCache() {
|
|
35
|
-
return
|
|
35
|
+
return getCurrentCulture().cache;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export function pushCulture(cultureInfo) {
|
|
@@ -40,7 +40,7 @@ export function pushCulture(cultureInfo) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
export function createCulture(cultureSpecs) {
|
|
43
|
-
let current =
|
|
43
|
+
let current = getCurrentCulture();
|
|
44
44
|
let info = {
|
|
45
45
|
culture: current.culture,
|
|
46
46
|
dateEncoding: current.dateEncoding,
|
|
@@ -54,14 +54,21 @@ export function createCulture(cultureSpecs) {
|
|
|
54
54
|
return info;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
export function popCulture() {
|
|
57
|
+
export function popCulture(cultureSpecs) {
|
|
58
58
|
if (stack.length == 1) throw new Error("Cannot pop the last culture object.");
|
|
59
|
-
|
|
59
|
+
if (cultureSpecs && stack[stack.length - 1] !== cultureSpecs) {
|
|
60
|
+
console.warn("Popped culture object does not match the current one.");
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
return stack.pop();
|
|
64
|
+
} finally {
|
|
65
|
+
console.log(stack);
|
|
66
|
+
}
|
|
60
67
|
}
|
|
61
68
|
|
|
62
69
|
export class Culture {
|
|
63
70
|
static setCulture(cultureCode) {
|
|
64
|
-
let cultureSpecs =
|
|
71
|
+
let cultureSpecs = getDefaultCulture();
|
|
65
72
|
cultureSpecs.culture = cultureCode;
|
|
66
73
|
cultureSpecs.cache = {};
|
|
67
74
|
Localization.setCulture(cultureCode);
|
|
@@ -69,27 +76,27 @@ export class Culture {
|
|
|
69
76
|
}
|
|
70
77
|
|
|
71
78
|
static setNumberCulture(cultureCode) {
|
|
72
|
-
let cultureSpecs =
|
|
79
|
+
let cultureSpecs = getDefaultCulture();
|
|
73
80
|
cultureSpecs.numberCulture = cultureCode;
|
|
74
81
|
delete cultureSpecs.cache.numberCulture;
|
|
75
82
|
this.invalidateCache();
|
|
76
83
|
}
|
|
77
84
|
|
|
78
85
|
static setDateTimeCulture(cultureCode) {
|
|
79
|
-
let cultureSpecs =
|
|
86
|
+
let cultureSpecs = getDefaultCulture();
|
|
80
87
|
cultureSpecs.dateTimeCulture = cultureCode;
|
|
81
88
|
delete cultureSpecs.cache.dateTimeCulture;
|
|
82
89
|
this.invalidateCache();
|
|
83
90
|
}
|
|
84
91
|
|
|
85
92
|
static setDefaultCurrency(currencyCode) {
|
|
86
|
-
let cultureSpecs =
|
|
93
|
+
let cultureSpecs = getDefaultCulture();
|
|
87
94
|
cultureSpecs.defaultCurrency = currencyCode;
|
|
88
95
|
this.invalidateCache();
|
|
89
96
|
}
|
|
90
97
|
|
|
91
98
|
static setDefaultDateEncoding(encoding) {
|
|
92
|
-
let cultureSpecs =
|
|
99
|
+
let cultureSpecs = getDefaultCulture();
|
|
93
100
|
cultureSpecs.dateEncoding = encoding;
|
|
94
101
|
this.invalidateCache();
|
|
95
102
|
}
|
|
@@ -101,31 +108,31 @@ export class Culture {
|
|
|
101
108
|
}
|
|
102
109
|
|
|
103
110
|
static get defaultCurrency() {
|
|
104
|
-
return
|
|
111
|
+
return getCurrentCulture().defaultCurrency;
|
|
105
112
|
}
|
|
106
113
|
|
|
107
114
|
static get culture() {
|
|
108
|
-
return
|
|
115
|
+
return getCurrentCulture().culture;
|
|
109
116
|
}
|
|
110
117
|
|
|
111
118
|
static getNumberCulture() {
|
|
112
|
-
let { cache, numberCulture, culture } =
|
|
119
|
+
let { cache, numberCulture, culture } = getCurrentCulture();
|
|
113
120
|
if (!cache.numberCulture) cache.numberCulture = new NumberCulture(numberCulture ?? culture);
|
|
114
121
|
return cache.numberCulture;
|
|
115
122
|
}
|
|
116
123
|
|
|
117
124
|
static getDateTimeCulture() {
|
|
118
|
-
let { cache, dateTimeCulture, culture } =
|
|
125
|
+
let { cache, dateTimeCulture, culture } = getCurrentCulture();
|
|
119
126
|
if (!cache.dateTimeCulture) cache.dateTimeCulture = new DateTimeCulture(dateTimeCulture ?? culture);
|
|
120
127
|
return cache.dateTimeCulture;
|
|
121
128
|
}
|
|
122
129
|
|
|
123
130
|
static getDefaultDateEncoding() {
|
|
124
|
-
return
|
|
131
|
+
return getCurrentCulture().dateEncoding;
|
|
125
132
|
}
|
|
126
133
|
|
|
127
134
|
static getComparer(options) {
|
|
128
|
-
let { culture } =
|
|
135
|
+
let { culture } = getCurrentCulture();
|
|
129
136
|
if (typeof Intl.Collator != "undefined") return new Intl.Collator(culture, options).compare;
|
|
130
137
|
return defaultCompare;
|
|
131
138
|
}
|
package/src/ui/CultureScope.js
CHANGED
|
@@ -38,13 +38,11 @@ export class CultureScope extends PureContainer {
|
|
|
38
38
|
let { culture } = instance;
|
|
39
39
|
pushCulture(culture);
|
|
40
40
|
if (this.items.length == 0 && this.initialItems) this.add(this.initialItems);
|
|
41
|
-
context.push("cultureInfo", culture);
|
|
42
41
|
super.explore(context, instance);
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
exploreCleanup(context, instance) {
|
|
46
|
-
|
|
47
|
-
popCulture();
|
|
45
|
+
popCulture(instance.culture);
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
48
|
|
package/src/ui/Cx.js
CHANGED
|
@@ -7,7 +7,7 @@ import { isBatchingUpdates, notifyBatchedUpdateStarting, notifyBatchedUpdateComp
|
|
|
7
7
|
import { shallowEquals } from "../util/shallowEquals";
|
|
8
8
|
import { PureContainer } from "./PureContainer";
|
|
9
9
|
import { onIdleCallback } from "../util/onIdleCallback";
|
|
10
|
-
import {
|
|
10
|
+
import { getCurrentCulture, pushCulture, popCulture } from "./Culture";
|
|
11
11
|
|
|
12
12
|
export class Cx extends VDOM.Component {
|
|
13
13
|
constructor(props) {
|
|
@@ -85,6 +85,8 @@ export class Cx extends VDOM.Component {
|
|
|
85
85
|
render() {
|
|
86
86
|
if (this.props.deferredUntilIdle && this.state.deferToken < this.deferCounter) return null;
|
|
87
87
|
|
|
88
|
+
let cultureInfo = this.props.cultureInfo ?? getCurrentCulture();
|
|
89
|
+
|
|
88
90
|
return (
|
|
89
91
|
<CxContext
|
|
90
92
|
instance={this.getInstance()}
|
|
@@ -93,7 +95,7 @@ export class Cx extends VDOM.Component {
|
|
|
93
95
|
buster={++this.renderCount}
|
|
94
96
|
contentFactory={this.props.contentFactory}
|
|
95
97
|
forceUpdate={this.forceUpdateCallback}
|
|
96
|
-
cultureInfo={
|
|
98
|
+
cultureInfo={cultureInfo}
|
|
97
99
|
/>
|
|
98
100
|
);
|
|
99
101
|
}
|
|
@@ -219,32 +221,32 @@ class CxContext extends VDOM.Component {
|
|
|
219
221
|
break;
|
|
220
222
|
}
|
|
221
223
|
} while (this.props.flags.dirty && ++count <= 3 && Widget.optimizePrepare && now() - this.timings.start < 8);
|
|
222
|
-
} finally {
|
|
223
|
-
if (this.props.cultureInfo) popCulture();
|
|
224
|
-
}
|
|
225
224
|
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
if (visible) {
|
|
226
|
+
this.timings.afterExplore = now();
|
|
228
227
|
|
|
229
|
-
|
|
230
|
-
|
|
228
|
+
for (let i = 0; i < context.prepareList.length; i++) context.prepareList[i].prepare(context);
|
|
229
|
+
this.timings.afterPrepare = now();
|
|
231
230
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
231
|
+
//walk in reverse order so children get rendered first
|
|
232
|
+
let renderList = context.getRootRenderList();
|
|
233
|
+
while (renderList) {
|
|
234
|
+
for (let i = renderList.data.length - 1; i >= 0; i--) {
|
|
235
|
+
renderList.data[i].render(context);
|
|
236
|
+
}
|
|
237
|
+
renderList = renderList.right;
|
|
237
238
|
}
|
|
238
|
-
renderList = renderList.right;
|
|
239
|
-
}
|
|
240
239
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
240
|
+
this.content = getContent(instance.vdom);
|
|
241
|
+
if (contentFactory) this.content = contentFactory({ children: this.content });
|
|
242
|
+
this.timings.afterRender = now();
|
|
243
|
+
for (let i = 0; i < context.cleanupList.length; i++) context.cleanupList[i].cleanup(context);
|
|
244
|
+
} else {
|
|
245
|
+
this.content = null;
|
|
246
|
+
this.timings.afterExplore = this.timings.afterPrepare = this.timings.afterRender = now();
|
|
247
|
+
}
|
|
248
|
+
} finally {
|
|
249
|
+
if (this.props.cultureInfo) popCulture(this.props.cultureInfo);
|
|
248
250
|
}
|
|
249
251
|
|
|
250
252
|
this.timings.beforeVDOMRender = now();
|
package/src/ui/Restate.d.ts
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import { Instance } from "./Instance";
|
|
2
|
-
import * as Cx from "../core";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { Instance } from "./Instance";
|
|
2
|
+
import * as Cx from "../core";
|
|
3
|
+
import { CultureInfo } from "./Culture";
|
|
4
|
+
|
|
5
|
+
interface RestateProps extends Cx.PureContainerProps {
|
|
6
|
+
data?: Cx.StructuredProp;
|
|
7
|
+
detached?: boolean;
|
|
8
|
+
deferredUntilIdle?: Cx.BooleanProp;
|
|
9
|
+
idleTimeout?: Cx.NumberProp;
|
|
10
|
+
cacheKey?: Cx.StringProp;
|
|
11
|
+
|
|
12
|
+
/* Set to true to disable batching of updates. */
|
|
13
|
+
immediate?: boolean;
|
|
14
|
+
|
|
15
|
+
onError?: (err: Error, instance: Instance) => void;
|
|
16
|
+
|
|
17
|
+
culture?: CultureInfo;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class Restate extends Cx.Widget<RestateProps> {}
|
|
21
|
+
export class PrivateStore extends Cx.Widget<RestateProps> {}
|
package/src/ui/Restate.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { PureContainer } from "./PureContainer";
|
|
2
2
|
import { Store } from "../data/Store";
|
|
3
3
|
import { Cx } from "./Cx";
|
|
4
|
-
import { isString } from "../util/isString";
|
|
5
4
|
import { VDOM } from "./VDOM";
|
|
6
|
-
import { isFunction } from "../util/isFunction";
|
|
7
5
|
import { isObject } from "../util/isObject";
|
|
8
6
|
import { isUndefined } from "../util/isUndefined";
|
|
9
7
|
import { Binding } from "../data/Binding";
|
|
10
8
|
import { StructuredSelector } from "../data/StructuredSelector";
|
|
9
|
+
import { getCurrentCulture } from "./Culture";
|
|
11
10
|
|
|
12
11
|
let persistenceCache = {};
|
|
13
12
|
|
|
@@ -70,7 +69,7 @@ export class Restate extends PureContainer {
|
|
|
70
69
|
explore(context, instance) {
|
|
71
70
|
if (!instance.subStore) this.initSubStore(context, instance);
|
|
72
71
|
if (instance.subStore.parentDataCheck()) instance.markShouldUpdate();
|
|
73
|
-
instance.cultureInfo =
|
|
72
|
+
instance.cultureInfo = this.culture ?? getCurrentCulture();
|
|
74
73
|
if (instance.cache("cultureInfo", instance.culture)) instance.markShouldUpdate();
|
|
75
74
|
super.explore(context, instance);
|
|
76
75
|
}
|
|
@@ -107,6 +106,7 @@ export class Restate extends PureContainer {
|
|
|
107
106
|
Restate.prototype.detached = false;
|
|
108
107
|
Restate.prototype.waitForIdle = false;
|
|
109
108
|
Restate.prototype.immediate = false;
|
|
109
|
+
Restate.prototype.culture = null;
|
|
110
110
|
|
|
111
111
|
export const PrivateStore = Restate;
|
|
112
112
|
|