@rs-x/state-manager 0.4.11 → 0.4.12
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/index.d.ts +52 -47
- package/dist/index.js +323 -300
- package/package.json +2 -2
- package/readme.md +605 -529
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
|
|
4
4
|
// lib/abstract-observer.ts
|
|
5
|
-
import { Type } from "@rs-x/core";
|
|
6
5
|
import { Subject } from "rxjs";
|
|
6
|
+
import { Type } from "@rs-x/core";
|
|
7
7
|
var AbstractObserver = class {
|
|
8
8
|
static {
|
|
9
9
|
__name(this, "AbstractObserver");
|
|
@@ -73,6 +73,9 @@ var GroupedChangeSubscriptionsForContextManager = class extends SingletonFactory
|
|
|
73
73
|
constructor(_context, releaseContext, _errorLog, guidFactory) {
|
|
74
74
|
super(guidFactory), this._context = _context, this.releaseContext = releaseContext, this._errorLog = _errorLog;
|
|
75
75
|
}
|
|
76
|
+
get context() {
|
|
77
|
+
return this._context;
|
|
78
|
+
}
|
|
76
79
|
getSubsriptionData(id) {
|
|
77
80
|
return this._subscriptions.get(id)?.data;
|
|
78
81
|
}
|
|
@@ -107,12 +110,30 @@ var GroupedChangeSubscriptionsForContextManager = class extends SingletonFactory
|
|
|
107
110
|
}
|
|
108
111
|
};
|
|
109
112
|
|
|
110
|
-
// lib/
|
|
113
|
+
// lib/index-watch-rule-registry/index-watch-rule.ts
|
|
111
114
|
import { truePredicate } from "@rs-x/core";
|
|
115
|
+
var IndexWatchRule = class {
|
|
116
|
+
static {
|
|
117
|
+
__name(this, "IndexWatchRule");
|
|
118
|
+
}
|
|
119
|
+
context;
|
|
120
|
+
predicate;
|
|
121
|
+
constructor(context, predicate) {
|
|
122
|
+
this.context = context;
|
|
123
|
+
this.predicate = predicate;
|
|
124
|
+
}
|
|
125
|
+
test(index, target) {
|
|
126
|
+
return this.predicate(index, target, this.context);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
var watchIndexRecursiveRule = new IndexWatchRule(void 0, truePredicate);
|
|
130
|
+
|
|
131
|
+
// lib/object-observer/factories/abstract-object-observer-proxy-pair.factory.ts
|
|
132
|
+
import { truePredicate as truePredicate2 } from "@rs-x/core";
|
|
112
133
|
|
|
113
134
|
// lib/observer-group.ts
|
|
114
|
-
import { Type as Type2 } from "@rs-x/core";
|
|
115
135
|
import { ReplaySubject } from "rxjs";
|
|
136
|
+
import { Type as Type2 } from "@rs-x/core";
|
|
116
137
|
var ObserverGroup = class _ObserverGroup extends AbstractObserver {
|
|
117
138
|
static {
|
|
118
139
|
__name(this, "ObserverGroup");
|
|
@@ -184,11 +205,11 @@ var ObserverGroup = class _ObserverGroup extends AbstractObserver {
|
|
|
184
205
|
target: this.target,
|
|
185
206
|
chain: [
|
|
186
207
|
{
|
|
187
|
-
|
|
188
|
-
|
|
208
|
+
context: this.target,
|
|
209
|
+
index: this.id
|
|
189
210
|
}
|
|
190
211
|
],
|
|
191
|
-
|
|
212
|
+
index: this.id,
|
|
192
213
|
newValue
|
|
193
214
|
});
|
|
194
215
|
}
|
|
@@ -215,8 +236,8 @@ var ObserverGroup = class _ObserverGroup extends AbstractObserver {
|
|
|
215
236
|
const isThisTarget = change.target === this.target;
|
|
216
237
|
const chain = isThisTarget || Type2.isNullOrUndefined(this.id) ? change.chain : [
|
|
217
238
|
{
|
|
218
|
-
|
|
219
|
-
|
|
239
|
+
context: this.target,
|
|
240
|
+
index: this.id
|
|
220
241
|
},
|
|
221
242
|
...change.chain ?? []
|
|
222
243
|
];
|
|
@@ -252,8 +273,8 @@ var AbstractObjectObserverProxyPairFactory = class {
|
|
|
252
273
|
this._objectPropertyObserverProxyPairManager = _objectPropertyObserverProxyPairManager;
|
|
253
274
|
}
|
|
254
275
|
create(owner, data) {
|
|
255
|
-
const observerGroup = new ObserverGroup(this.createDisposableOwner(owner, data), data.target, data.target,
|
|
256
|
-
this.onObserverGroupCreate(data.target, observerGroup, data.
|
|
276
|
+
const observerGroup = new ObserverGroup(this.createDisposableOwner(owner, data), data.target, data.target, truePredicate2, this._errorLog, void 0, () => rootObserver?.observer, this._observerRootObserver);
|
|
277
|
+
this.onObserverGroupCreate(data.target, observerGroup, data.indexWatchRule);
|
|
257
278
|
const rootObserver = this.createRootObserver(data);
|
|
258
279
|
if (!data.initializeManually) {
|
|
259
280
|
observerGroup.init();
|
|
@@ -267,19 +288,19 @@ var AbstractObjectObserverProxyPairFactory = class {
|
|
|
267
288
|
createDisposableOwner(owner, _data) {
|
|
268
289
|
return owner;
|
|
269
290
|
}
|
|
270
|
-
onObserverGroupCreate(target, observerGroup,
|
|
271
|
-
if (!
|
|
291
|
+
onObserverGroupCreate(target, observerGroup, indexWatchRule) {
|
|
292
|
+
if (!indexWatchRule) {
|
|
272
293
|
return;
|
|
273
294
|
}
|
|
274
295
|
const observers = [];
|
|
275
296
|
const indexes = this._indexAccessor.getIndexes(target);
|
|
276
297
|
for (const index of indexes) {
|
|
277
|
-
if (!
|
|
298
|
+
if (!indexWatchRule.test(index, target)) {
|
|
278
299
|
continue;
|
|
279
300
|
}
|
|
280
301
|
const { observer } = this._objectPropertyObserverProxyPairManager.create(target).instance.create({
|
|
281
|
-
|
|
282
|
-
|
|
302
|
+
index,
|
|
303
|
+
indexWatchRule
|
|
283
304
|
}).instance;
|
|
284
305
|
observers.push(observer);
|
|
285
306
|
}
|
|
@@ -290,7 +311,7 @@ var AbstractObjectObserverProxyPairFactory = class {
|
|
|
290
311
|
// lib/object-observer/factories/array-observer-proxy-pair.factory.ts
|
|
291
312
|
import { Inject, Injectable, RsXCoreInjectionTokens } from "@rs-x/core";
|
|
292
313
|
|
|
293
|
-
// lib/rs-x-state-manager-injection-
|
|
314
|
+
// lib/rs-x-state-manager-injection-tokens.ts
|
|
294
315
|
var RsXStateManagerInjectionTokens = {
|
|
295
316
|
IArrayProxyFactory: Symbol("IArrayProxyFactory"),
|
|
296
317
|
IMapProxyFactory: Symbol("IMapProxyFactory"),
|
|
@@ -318,7 +339,6 @@ var RsXStateManagerInjectionTokens = {
|
|
|
318
339
|
IPropertyObserverProxyPairFactoryList: Symbol("IPropertyObserverProxyPairFactoryList"),
|
|
319
340
|
NonIterableObjectPropertyObserverProxyPairFactory: Symbol("NonIterableObjectPropertyObserverProxyPairFactory"),
|
|
320
341
|
ICollectionItemObserverProxyPairFactory: Symbol("ICollectionItemObserverProxyPairFactory"),
|
|
321
|
-
IMustProxifyItemHandlerFactory: Symbol("IMustProxifyItemHandlerFactory"),
|
|
322
342
|
IObjectStateManager: Symbol("IObjectStateManager"),
|
|
323
343
|
IPropertyObserverProxyPairFactoryProvider: Symbol("IPropertyObserverProxyPairFactoryProvider"),
|
|
324
344
|
IPropertyObserverProxyPairFactoryProviderFactory: Symbol("IPropertyObserverProxyPairFactoryProviderFactory"),
|
|
@@ -475,8 +495,8 @@ MapObserverProxyPairFactory = _ts_decorate3([
|
|
|
475
495
|
], MapObserverProxyPairFactory);
|
|
476
496
|
|
|
477
497
|
// lib/object-observer/factories/observable-observer-proxy-pair.factory.ts
|
|
478
|
-
import { Inject as Inject4, Injectable as Injectable4 } from "@rs-x/core";
|
|
479
498
|
import { isObservable } from "rxjs";
|
|
499
|
+
import { Inject as Inject4, Injectable as Injectable4 } from "@rs-x/core";
|
|
480
500
|
function _ts_decorate4(decorators, target, key, desc) {
|
|
481
501
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
482
502
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -523,7 +543,7 @@ ObservableObserverProxyPairFactory = _ts_decorate4([
|
|
|
523
543
|
], ObservableObserverProxyPairFactory);
|
|
524
544
|
|
|
525
545
|
// lib/object-observer/factories/plain-object-observer-proxy-pair.factory.ts
|
|
526
|
-
import { Inject as Inject5, Injectable as Injectable5, RsXCoreInjectionTokens as RsXCoreInjectionTokens3, truePredicate as
|
|
546
|
+
import { Inject as Inject5, Injectable as Injectable5, RsXCoreInjectionTokens as RsXCoreInjectionTokens3, truePredicate as truePredicate3, Type as Type3 } from "@rs-x/core";
|
|
527
547
|
function _ts_decorate5(decorators, target, key, desc) {
|
|
528
548
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
529
549
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -552,21 +572,24 @@ var PlainObjectObserverProxyPairFactory = class extends AbstractObjectObserverPr
|
|
|
552
572
|
return Type3.isPlainObject(object);
|
|
553
573
|
}
|
|
554
574
|
createRootObserver(data) {
|
|
555
|
-
if (data.
|
|
575
|
+
if (!data.indexWatchRule) {
|
|
556
576
|
return void 0;
|
|
557
577
|
}
|
|
558
578
|
const target = data.target;
|
|
559
579
|
const observers = [];
|
|
560
580
|
for (const index of this._indexAccessor.getIndexes(target)) {
|
|
581
|
+
if (!data.indexWatchRule.test(index, target)) {
|
|
582
|
+
continue;
|
|
583
|
+
}
|
|
561
584
|
const { observer } = this._objectPropertyObserverProxyPairManager.create(target).instance.create({
|
|
562
|
-
|
|
585
|
+
index
|
|
563
586
|
}).instance;
|
|
564
587
|
observers.push(observer);
|
|
565
588
|
}
|
|
566
589
|
if (observers.length === 0) {
|
|
567
590
|
return void 0;
|
|
568
591
|
}
|
|
569
|
-
const observerGroup = new ObserverGroup(void 0, data.target, data.target,
|
|
592
|
+
const observerGroup = new ObserverGroup(void 0, data.target, data.target, truePredicate3, this._errorLog);
|
|
570
593
|
observerGroup.replaceObservers(observers);
|
|
571
594
|
return {
|
|
572
595
|
observer: observerGroup
|
|
@@ -755,7 +778,7 @@ var ObjectObserverProxyPairManager = class extends SingletonFactoryWithGuid2 {
|
|
|
755
778
|
return data.target;
|
|
756
779
|
}
|
|
757
780
|
getGroupMemberId(data) {
|
|
758
|
-
return data.
|
|
781
|
+
return data.indexWatchRule;
|
|
759
782
|
}
|
|
760
783
|
create(data) {
|
|
761
784
|
if (this._proxyRegistry.isProxy(data.target)) {
|
|
@@ -817,10 +840,10 @@ var PropertyObserverProxyPairManager = class PropertyObserverProxyPairManager2 e
|
|
|
817
840
|
super(guidFactory), this._object = _object, this._observerFactories = _observerFactories, this.releaseContext = releaseContext;
|
|
818
841
|
}
|
|
819
842
|
getGroupId(data) {
|
|
820
|
-
return data.
|
|
843
|
+
return data.index;
|
|
821
844
|
}
|
|
822
845
|
getGroupMemberId(data) {
|
|
823
|
-
return data.
|
|
846
|
+
return data.indexWatchRule;
|
|
824
847
|
}
|
|
825
848
|
createInstance(propertyInfo, id) {
|
|
826
849
|
return this.getObserverFactory(propertyInfo).create({
|
|
@@ -840,7 +863,7 @@ var PropertyObserverProxyPairManager = class PropertyObserverProxyPairManager2 e
|
|
|
840
863
|
getObserverFactory(propertyInfo) {
|
|
841
864
|
const observerFactory = this._observerFactories.find((observerFactory2) => observerFactory2.applies(this._object, propertyInfo));
|
|
842
865
|
if (!observerFactory) {
|
|
843
|
-
throw new UnsupportedException(`No observer factory found for given object of type ${Type5.getConstructorName(this._object)} for given id ${propertyInfo.
|
|
866
|
+
throw new UnsupportedException(`No observer factory found for given object of type ${Type5.getConstructorName(this._object)} for given id ${propertyInfo.index}`);
|
|
844
867
|
}
|
|
845
868
|
return observerFactory;
|
|
846
869
|
}
|
|
@@ -924,7 +947,7 @@ var CollectionIndexObserver = class CollectionIndexObserver2 extends AbstractObs
|
|
|
924
947
|
this._collectionObserver.dispose();
|
|
925
948
|
}
|
|
926
949
|
onChanged = /* @__PURE__ */ __name((change) => {
|
|
927
|
-
if (change.
|
|
950
|
+
if (change.index !== this.id) {
|
|
928
951
|
return;
|
|
929
952
|
}
|
|
930
953
|
if (!this._indexValueAccessor.hasValue(this.target, this.id)) {
|
|
@@ -1013,7 +1036,7 @@ CollectionItemObserverManager = _ts_decorate11([
|
|
|
1013
1036
|
import { Inject as Inject11, Injectable as Injectable12, RsXCoreInjectionTokens as RsXCoreInjectionTokens8, truePredicate as truePredicate4 } from "@rs-x/core";
|
|
1014
1037
|
|
|
1015
1038
|
// lib/property-observer/factories/indexed-value-observer-proxy-pair/indexed-value-observer-proxy-pair.factory.ts
|
|
1016
|
-
import {
|
|
1039
|
+
import { Type as Type6, UnexpectedException } from "@rs-x/core";
|
|
1017
1040
|
|
|
1018
1041
|
// lib/property-observer/factories/indexed-value-observer-proxy-pair/index-change-subscription-manager.ts
|
|
1019
1042
|
import { SingletonFactory as SingletonFactory3 } from "@rs-x/core";
|
|
@@ -1029,7 +1052,7 @@ var IndexChangeSubscriptionsForContextManager = class IndexChangeSubscriptionsFo
|
|
|
1029
1052
|
return data.index;
|
|
1030
1053
|
}
|
|
1031
1054
|
getGroupMemberId(data) {
|
|
1032
|
-
return data.
|
|
1055
|
+
return data.indexWatchRule;
|
|
1033
1056
|
}
|
|
1034
1057
|
createObserver(context, data, id) {
|
|
1035
1058
|
const indexSetObserver = this._indexSetObserverManager.create(context).instance.create({
|
|
@@ -1049,7 +1072,7 @@ var IndexChangeSubscriptionsForContextManager = class IndexChangeSubscriptionsFo
|
|
|
1049
1072
|
data.owner.release();
|
|
1050
1073
|
this.release(id);
|
|
1051
1074
|
}, "release")
|
|
1052
|
-
}, this.
|
|
1075
|
+
}, this.context, data.initialValue, data.mustHandleChange, this._errorLog, data.index, () => indexSetObserver).addObservers(data.indexValueObserver ? [
|
|
1053
1076
|
data.indexValueObserver
|
|
1054
1077
|
] : []);
|
|
1055
1078
|
if (!data.initializeManually) {
|
|
@@ -1091,12 +1114,14 @@ var IndexObserverProxyPairFactory = class {
|
|
|
1091
1114
|
_objectObserveryManager;
|
|
1092
1115
|
_indexValueAccessor;
|
|
1093
1116
|
_proxyRegister;
|
|
1117
|
+
_valueMetadata;
|
|
1094
1118
|
mustHandleChange;
|
|
1095
1119
|
_indexChangeSubscriptionManager;
|
|
1096
|
-
constructor(_objectObserveryManager, indexSetObserverManager, errorLog, guidFactory, _indexValueAccessor, _proxyRegister, mustHandleChange) {
|
|
1120
|
+
constructor(_objectObserveryManager, indexSetObserverManager, errorLog, guidFactory, _indexValueAccessor, _proxyRegister, _valueMetadata, mustHandleChange) {
|
|
1097
1121
|
this._objectObserveryManager = _objectObserveryManager;
|
|
1098
1122
|
this._indexValueAccessor = _indexValueAccessor;
|
|
1099
1123
|
this._proxyRegister = _proxyRegister;
|
|
1124
|
+
this._valueMetadata = _valueMetadata;
|
|
1100
1125
|
this.mustHandleChange = mustHandleChange;
|
|
1101
1126
|
this._indexChangeSubscriptionManager = new IndexChangeSubscriptionManager(indexSetObserverManager, errorLog, guidFactory);
|
|
1102
1127
|
}
|
|
@@ -1104,45 +1129,39 @@ var IndexObserverProxyPairFactory = class {
|
|
|
1104
1129
|
this._indexChangeSubscriptionManager.dispose();
|
|
1105
1130
|
}
|
|
1106
1131
|
create(owner, object, propertyInfo) {
|
|
1107
|
-
const index = propertyInfo.
|
|
1132
|
+
const index = propertyInfo.index;
|
|
1108
1133
|
const valueAtIndex = this._indexValueAccessor.getValue(object, index);
|
|
1109
|
-
const
|
|
1110
|
-
const indexValueObserverProxyPair =
|
|
1134
|
+
const needProxy = this._valueMetadata.isAsync(valueAtIndex) || propertyInfo.indexWatchRule?.test?.(index, object);
|
|
1135
|
+
const indexValueObserverProxyPair = needProxy ? this.createIndexValueProxy(propertyInfo, object, index, valueAtIndex, propertyInfo.indexWatchRule) : void 0;
|
|
1111
1136
|
const initialValue = indexValueObserverProxyPair ? indexValueObserverProxyPair.observer.value : valueAtIndex;
|
|
1112
|
-
;
|
|
1113
|
-
const groupObserver = this.createGroupObserver(owner, object, index, initialValue, propertyInfo.initializeManually, indexValueObserverProxyPair?.observer, mustProxify);
|
|
1137
|
+
const groupObserver = this.createGroupObserver(owner, object, index, initialValue, propertyInfo.initializeManually, indexValueObserverProxyPair?.observer, propertyInfo.indexWatchRule);
|
|
1114
1138
|
return {
|
|
1115
1139
|
observer: groupObserver,
|
|
1116
1140
|
proxy: indexValueObserverProxyPair?.proxy,
|
|
1117
1141
|
proxyTarget: valueAtIndex
|
|
1118
1142
|
};
|
|
1119
1143
|
}
|
|
1120
|
-
|
|
1121
|
-
if (mustProxify) {
|
|
1122
|
-
return mustProxify;
|
|
1123
|
-
}
|
|
1124
|
-
return this._indexValueAccessor.isAsync(context, index) ? truePredicate3 : void 0;
|
|
1125
|
-
}
|
|
1126
|
-
createIndexValueProxy(propertyInfo, object, index, value, mustProxify) {
|
|
1144
|
+
createIndexValueProxy(propertyInfo, object, index, value, indexWatchRule) {
|
|
1127
1145
|
const setValue = propertyInfo.setValue ?? ((v) => this._indexValueAccessor.setValue(object, index, v));
|
|
1128
|
-
return this.proxifyIndexValue(value,
|
|
1146
|
+
return this.proxifyIndexValue(value, indexWatchRule, propertyInfo.initializeManually, setValue);
|
|
1129
1147
|
}
|
|
1130
|
-
createGroupObserver(owner, object, index, initialValue, initializeManually, indexValueObserver,
|
|
1148
|
+
createGroupObserver(owner, object, index, initialValue, initializeManually, indexValueObserver, indexWatchRule) {
|
|
1131
1149
|
const indexChangeSubscriptionsForContextManager = this._indexChangeSubscriptionManager.create(object).instance;
|
|
1132
1150
|
const { id } = indexChangeSubscriptionsForContextManager.create({
|
|
1133
1151
|
index,
|
|
1134
1152
|
initialValue,
|
|
1135
1153
|
indexValueObserver,
|
|
1136
|
-
|
|
1154
|
+
indexWatchRule,
|
|
1137
1155
|
initializeManually,
|
|
1138
1156
|
mustHandleChange: this.mustHandleChange,
|
|
1139
|
-
onChanged: /* @__PURE__ */ __name((change) => this.onIndexSet(change, id,
|
|
1157
|
+
onChanged: /* @__PURE__ */ __name((change) => this.onIndexSet(change, id, indexWatchRule), "onChanged"),
|
|
1140
1158
|
owner
|
|
1141
1159
|
});
|
|
1142
1160
|
return Type6.cast(indexChangeSubscriptionsForContextManager.getSubsriptionData(id));
|
|
1143
1161
|
}
|
|
1144
|
-
onIndexSet(change, subsriptionId,
|
|
1145
|
-
const
|
|
1162
|
+
onIndexSet(change, subsriptionId, indexWatchRule) {
|
|
1163
|
+
const isAsync = this._valueMetadata.isAsync(change.newValue);
|
|
1164
|
+
const emitValue = Type6.isNullOrUndefined(change.newValue) || !isAsync;
|
|
1146
1165
|
const observerGroup = this._indexChangeSubscriptionManager.getFromId(change.target)?.getSubsriptionData(subsriptionId);
|
|
1147
1166
|
if (!observerGroup) {
|
|
1148
1167
|
throw new UnexpectedException(`Observer group not found for subscription id ${subsriptionId}`);
|
|
@@ -1150,17 +1169,16 @@ var IndexObserverProxyPairFactory = class {
|
|
|
1150
1169
|
if (emitValue) {
|
|
1151
1170
|
observerGroup.emitValue(change.newValue);
|
|
1152
1171
|
}
|
|
1153
|
-
const observers = this.getNestedObservers(change,
|
|
1172
|
+
const observers = this.getNestedObservers(change, isAsync, indexWatchRule);
|
|
1154
1173
|
observerGroup.replaceObservers(observers);
|
|
1155
1174
|
}
|
|
1156
|
-
getNestedObservers(change,
|
|
1157
|
-
const mustProxifyHandler = this.getMustProxifyHandler(mustProxify, change.target, change.id);
|
|
1175
|
+
getNestedObservers(change, isAsync, indexWatchRule) {
|
|
1158
1176
|
let observers = [];
|
|
1159
|
-
if (
|
|
1160
|
-
const observerProxyPair = this.proxifyIndexValue(change.newValue,
|
|
1177
|
+
if (isAsync || indexWatchRule && indexWatchRule.test(change.index, change.target)) {
|
|
1178
|
+
const observerProxyPair = this.proxifyIndexValue(change.newValue, indexWatchRule, true, change.setValue ?? ((value) => {
|
|
1161
1179
|
const obj = Type6.toObject(change.target);
|
|
1162
1180
|
if (obj) {
|
|
1163
|
-
obj[change.
|
|
1181
|
+
obj[change.index] = value;
|
|
1164
1182
|
}
|
|
1165
1183
|
}));
|
|
1166
1184
|
if (observerProxyPair) {
|
|
@@ -1169,11 +1187,11 @@ var IndexObserverProxyPairFactory = class {
|
|
|
1169
1187
|
}
|
|
1170
1188
|
return observers;
|
|
1171
1189
|
}
|
|
1172
|
-
proxifyIndexValue(value,
|
|
1190
|
+
proxifyIndexValue(value, indexWatchRule, initializeManually, setValue) {
|
|
1173
1191
|
const target = this._proxyRegister.getProxyTarget(value) ?? value;
|
|
1174
1192
|
const observerProxyPair = this._objectObserveryManager.create({
|
|
1175
1193
|
target,
|
|
1176
|
-
|
|
1194
|
+
indexWatchRule,
|
|
1177
1195
|
initializeManually
|
|
1178
1196
|
}).instance;
|
|
1179
1197
|
if (!observerProxyPair) {
|
|
@@ -1208,8 +1226,8 @@ var CollectionItemObserverProxyPairFactory = class extends IndexObserverProxyPai
|
|
|
1208
1226
|
static {
|
|
1209
1227
|
__name(this, "CollectionItemObserverProxyPairFactory");
|
|
1210
1228
|
}
|
|
1211
|
-
constructor(objectObserverManager, collectionItemObserverManager, errorLog, guidFactory, indexValueAccessor, proxyRegister) {
|
|
1212
|
-
super(objectObserverManager, collectionItemObserverManager, errorLog, guidFactory, indexValueAccessor, proxyRegister, truePredicate4);
|
|
1229
|
+
constructor(objectObserverManager, collectionItemObserverManager, errorLog, guidFactory, indexValueAccessor, proxyRegister, valueMetadata) {
|
|
1230
|
+
super(objectObserverManager, collectionItemObserverManager, errorLog, guidFactory, indexValueAccessor, proxyRegister, valueMetadata, truePredicate4);
|
|
1213
1231
|
}
|
|
1214
1232
|
applies(object) {
|
|
1215
1233
|
return object instanceof Map || object instanceof Array || object instanceof Set;
|
|
@@ -1223,6 +1241,7 @@ CollectionItemObserverProxyPairFactory = _ts_decorate12([
|
|
|
1223
1241
|
_ts_param12(3, Inject11(RsXCoreInjectionTokens8.IGuidFactory)),
|
|
1224
1242
|
_ts_param12(4, Inject11(RsXCoreInjectionTokens8.IIndexValueAccessor)),
|
|
1225
1243
|
_ts_param12(5, Inject11(RsXStateManagerInjectionTokens.IProxyRegistry)),
|
|
1244
|
+
_ts_param12(6, Inject11(RsXCoreInjectionTokens8.IValueMetadata)),
|
|
1226
1245
|
_ts_metadata12("design:type", Function),
|
|
1227
1246
|
_ts_metadata12("design:paramtypes", [
|
|
1228
1247
|
typeof IObjectObserverProxyPairManager === "undefined" ? Object : IObjectObserverProxyPairManager,
|
|
@@ -1230,7 +1249,8 @@ CollectionItemObserverProxyPairFactory = _ts_decorate12([
|
|
|
1230
1249
|
typeof IErrorLog === "undefined" ? Object : IErrorLog,
|
|
1231
1250
|
typeof IGuidFactory === "undefined" ? Object : IGuidFactory,
|
|
1232
1251
|
typeof IIndexValueAccessor === "undefined" ? Object : IIndexValueAccessor,
|
|
1233
|
-
typeof IProxyRegistry === "undefined" ? Object : IProxyRegistry
|
|
1252
|
+
typeof IProxyRegistry === "undefined" ? Object : IProxyRegistry,
|
|
1253
|
+
typeof IValueMetadata === "undefined" ? Object : IValueMetadata
|
|
1234
1254
|
])
|
|
1235
1255
|
], CollectionItemObserverProxyPairFactory);
|
|
1236
1256
|
|
|
@@ -1253,9 +1273,9 @@ function _ts_param13(paramIndex, decorator) {
|
|
|
1253
1273
|
};
|
|
1254
1274
|
}
|
|
1255
1275
|
__name(_ts_param13, "_ts_param");
|
|
1256
|
-
var
|
|
1276
|
+
var DatePropertyObserver = class DatePropertyObserver2 extends AbstractObserver {
|
|
1257
1277
|
static {
|
|
1258
|
-
__name(this, "
|
|
1278
|
+
__name(this, "DatePropertyObserver");
|
|
1259
1279
|
}
|
|
1260
1280
|
_dateObserver;
|
|
1261
1281
|
_errorLog;
|
|
@@ -1279,7 +1299,7 @@ var DatePropertybserver = class DatePropertybserver2 extends AbstractObserver {
|
|
|
1279
1299
|
this._dateChangeSubscription.unsubscribe();
|
|
1280
1300
|
}
|
|
1281
1301
|
onDateChanged = /* @__PURE__ */ __name((change) => {
|
|
1282
|
-
if (change.
|
|
1302
|
+
if (change.index !== this.id || change.newValue === this._oldValue) {
|
|
1283
1303
|
return;
|
|
1284
1304
|
}
|
|
1285
1305
|
this.emitChange(change);
|
|
@@ -1294,10 +1314,9 @@ var ProperForDataObserverManager = class ProperForDataObserverManager2 extends S
|
|
|
1294
1314
|
_dateProxyFactory;
|
|
1295
1315
|
_datePropertyAccessor;
|
|
1296
1316
|
_errorLog;
|
|
1297
|
-
_mustProxifyItemHandlerFactory;
|
|
1298
1317
|
releaseObject;
|
|
1299
|
-
constructor(_date, _dateProxyFactory, _datePropertyAccessor, _errorLog,
|
|
1300
|
-
super(), this._date = _date, this._dateProxyFactory = _dateProxyFactory, this._datePropertyAccessor = _datePropertyAccessor, this._errorLog = _errorLog, this.
|
|
1318
|
+
constructor(_date, _dateProxyFactory, _datePropertyAccessor, _errorLog, releaseObject) {
|
|
1319
|
+
super(), this._date = _date, this._dateProxyFactory = _dateProxyFactory, this._datePropertyAccessor = _datePropertyAccessor, this._errorLog = _errorLog, this.releaseObject = releaseObject;
|
|
1301
1320
|
}
|
|
1302
1321
|
getId(data) {
|
|
1303
1322
|
return data.index;
|
|
@@ -1305,14 +1324,16 @@ var ProperForDataObserverManager = class ProperForDataObserverManager2 extends S
|
|
|
1305
1324
|
createId(data) {
|
|
1306
1325
|
return data.index;
|
|
1307
1326
|
}
|
|
1308
|
-
createInstance(data,
|
|
1327
|
+
createInstance(data, index) {
|
|
1328
|
+
const indexWatchPredicate = /* @__PURE__ */ __name((targetIndex, target, context) => targetIndex === index && target === context, "indexWatchPredicate");
|
|
1329
|
+
const indexWatchRule = new IndexWatchRule(this._date, indexWatchPredicate);
|
|
1309
1330
|
const dateObserver = this._dateProxyFactory.create({
|
|
1310
1331
|
date: this._date,
|
|
1311
|
-
|
|
1332
|
+
indexWatchRule
|
|
1312
1333
|
}).instance.observer;
|
|
1313
|
-
return new
|
|
1314
|
-
canDispose: /* @__PURE__ */ __name(() => this.getReferenceCount(
|
|
1315
|
-
release: /* @__PURE__ */ __name(() => this.release(
|
|
1334
|
+
return new DatePropertyObserver({
|
|
1335
|
+
canDispose: /* @__PURE__ */ __name(() => this.getReferenceCount(index) === 1, "canDispose"),
|
|
1336
|
+
release: /* @__PURE__ */ __name(() => this.release(index), "release")
|
|
1316
1337
|
}, this._date, data.index, this._datePropertyAccessor, dateObserver, this._errorLog);
|
|
1317
1338
|
}
|
|
1318
1339
|
releaseInstance(observer) {
|
|
@@ -1329,9 +1350,8 @@ var DatePropertyObserverManager = class extends SingletonFactory4 {
|
|
|
1329
1350
|
_dateProxyFactory;
|
|
1330
1351
|
_errorLog;
|
|
1331
1352
|
_datePropertyAccessor;
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
super(), this._dateProxyFactory = _dateProxyFactory, this._errorLog = _errorLog, this._datePropertyAccessor = _datePropertyAccessor, this._mustProxifyItemHandlerFactory = _mustProxifyItemHandlerFactory;
|
|
1353
|
+
constructor(_dateProxyFactory, _errorLog, _datePropertyAccessor) {
|
|
1354
|
+
super(), this._dateProxyFactory = _dateProxyFactory, this._errorLog = _errorLog, this._datePropertyAccessor = _datePropertyAccessor;
|
|
1335
1355
|
}
|
|
1336
1356
|
getId(date) {
|
|
1337
1357
|
return date;
|
|
@@ -1340,7 +1360,7 @@ var DatePropertyObserverManager = class extends SingletonFactory4 {
|
|
|
1340
1360
|
return date;
|
|
1341
1361
|
}
|
|
1342
1362
|
createInstance(date) {
|
|
1343
|
-
return new ProperForDataObserverManager(date, this._dateProxyFactory, this._datePropertyAccessor, this._errorLog,
|
|
1363
|
+
return new ProperForDataObserverManager(date, this._dateProxyFactory, this._datePropertyAccessor, this._errorLog, () => this.release(date));
|
|
1344
1364
|
}
|
|
1345
1365
|
releaseInstance(properForDataObserverManager) {
|
|
1346
1366
|
properForDataObserverManager.dispose();
|
|
@@ -1351,13 +1371,11 @@ DatePropertyObserverManager = _ts_decorate13([
|
|
|
1351
1371
|
_ts_param13(0, Inject12(RsXStateManagerInjectionTokens.IDateProxyFactory)),
|
|
1352
1372
|
_ts_param13(1, Inject12(RsXCoreInjectionTokens9.IErrorLog)),
|
|
1353
1373
|
_ts_param13(2, Inject12(RsXCoreInjectionTokens9.IDatePropertyAccessor)),
|
|
1354
|
-
_ts_param13(3, Inject12(RsXStateManagerInjectionTokens.IMustProxifyItemHandlerFactory)),
|
|
1355
1374
|
_ts_metadata13("design:type", Function),
|
|
1356
1375
|
_ts_metadata13("design:paramtypes", [
|
|
1357
1376
|
typeof IDateProxyFactory === "undefined" ? Object : IDateProxyFactory,
|
|
1358
1377
|
typeof IErrorLog === "undefined" ? Object : IErrorLog,
|
|
1359
|
-
typeof IDatePropertyAccessor === "undefined" ? Object : IDatePropertyAccessor
|
|
1360
|
-
typeof IMustProxifyItemHandlerFactory === "undefined" ? Object : IMustProxifyItemHandlerFactory
|
|
1378
|
+
typeof IDatePropertyAccessor === "undefined" ? Object : IDatePropertyAccessor
|
|
1361
1379
|
])
|
|
1362
1380
|
], DatePropertyObserverManager);
|
|
1363
1381
|
|
|
@@ -1384,8 +1402,8 @@ var DatePropertyObserverProxyPairFactory = class extends IndexObserverProxyPairF
|
|
|
1384
1402
|
static {
|
|
1385
1403
|
__name(this, "DatePropertyObserverProxyPairFactory");
|
|
1386
1404
|
}
|
|
1387
|
-
constructor(objectObserverManager, datePropertyObserverManager, errorLog, guidFactory, datePropertyAccessor, proxyRegister) {
|
|
1388
|
-
super(objectObserverManager, datePropertyObserverManager, errorLog, guidFactory, datePropertyAccessor, proxyRegister, truePredicate5);
|
|
1405
|
+
constructor(objectObserverManager, datePropertyObserverManager, errorLog, guidFactory, datePropertyAccessor, proxyRegister, valueMetadata) {
|
|
1406
|
+
super(objectObserverManager, datePropertyObserverManager, errorLog, guidFactory, datePropertyAccessor, proxyRegister, valueMetadata, truePredicate5);
|
|
1389
1407
|
}
|
|
1390
1408
|
applies(object) {
|
|
1391
1409
|
return object instanceof Date;
|
|
@@ -1399,6 +1417,7 @@ DatePropertyObserverProxyPairFactory = _ts_decorate14([
|
|
|
1399
1417
|
_ts_param14(3, Inject13(RsXCoreInjectionTokens10.IGuidFactory)),
|
|
1400
1418
|
_ts_param14(4, Inject13(RsXCoreInjectionTokens10.IIndexValueAccessor)),
|
|
1401
1419
|
_ts_param14(5, Inject13(RsXStateManagerInjectionTokens.IProxyRegistry)),
|
|
1420
|
+
_ts_param14(6, Inject13(RsXCoreInjectionTokens10.IValueMetadata)),
|
|
1402
1421
|
_ts_metadata14("design:type", Function),
|
|
1403
1422
|
_ts_metadata14("design:paramtypes", [
|
|
1404
1423
|
typeof IObjectObserverProxyPairManager === "undefined" ? Object : IObjectObserverProxyPairManager,
|
|
@@ -1406,7 +1425,8 @@ DatePropertyObserverProxyPairFactory = _ts_decorate14([
|
|
|
1406
1425
|
typeof IErrorLog === "undefined" ? Object : IErrorLog,
|
|
1407
1426
|
typeof IGuidFactory === "undefined" ? Object : IGuidFactory,
|
|
1408
1427
|
typeof IIndexValueAccessor === "undefined" ? Object : IIndexValueAccessor,
|
|
1409
|
-
typeof IProxyRegistry === "undefined" ? Object : IProxyRegistry
|
|
1428
|
+
typeof IProxyRegistry === "undefined" ? Object : IProxyRegistry,
|
|
1429
|
+
typeof IValueMetadata === "undefined" ? Object : IValueMetadata
|
|
1410
1430
|
])
|
|
1411
1431
|
], DatePropertyObserverProxyPairFactory);
|
|
1412
1432
|
|
|
@@ -1433,11 +1453,11 @@ var NonIterableObjectPropertyObserverProxyPairFactory = class extends IndexObser
|
|
|
1433
1453
|
static {
|
|
1434
1454
|
__name(this, "NonIterableObjectPropertyObserverProxyPairFactory");
|
|
1435
1455
|
}
|
|
1436
|
-
constructor(objectObserveryManager, objectPropertyObserverManager, errorLog, guidFactory, indexValueAccessor, proxyRegister) {
|
|
1437
|
-
super(objectObserveryManager, objectPropertyObserverManager, errorLog, guidFactory, indexValueAccessor, proxyRegister);
|
|
1456
|
+
constructor(objectObserveryManager, objectPropertyObserverManager, errorLog, guidFactory, indexValueAccessor, proxyRegister, valueMetadata) {
|
|
1457
|
+
super(objectObserveryManager, objectPropertyObserverManager, errorLog, guidFactory, indexValueAccessor, proxyRegister, valueMetadata);
|
|
1438
1458
|
}
|
|
1439
1459
|
applies(object, propertyInfo) {
|
|
1440
|
-
return !(Array.isArray(object) || object instanceof Date || object instanceof Map || object instanceof Set) && Type7.isString(propertyInfo.
|
|
1460
|
+
return !(Array.isArray(object) || object instanceof Date || object instanceof Map || object instanceof Set) && Type7.isString(propertyInfo.index) && !Type7.isMethod((Type7.toObject(object) ?? {})[propertyInfo.index]);
|
|
1441
1461
|
}
|
|
1442
1462
|
setIndexValue(object, key, value) {
|
|
1443
1463
|
object[key] = value;
|
|
@@ -1451,6 +1471,7 @@ NonIterableObjectPropertyObserverProxyPairFactory = _ts_decorate15([
|
|
|
1451
1471
|
_ts_param15(3, Inject14(RsXCoreInjectionTokens11.IGuidFactory)),
|
|
1452
1472
|
_ts_param15(4, Inject14(RsXCoreInjectionTokens11.IIndexValueAccessor)),
|
|
1453
1473
|
_ts_param15(5, Inject14(RsXStateManagerInjectionTokens.IProxyRegistry)),
|
|
1474
|
+
_ts_param15(6, Inject14(RsXCoreInjectionTokens11.IValueMetadata)),
|
|
1454
1475
|
_ts_metadata15("design:type", Function),
|
|
1455
1476
|
_ts_metadata15("design:paramtypes", [
|
|
1456
1477
|
typeof IObjectObserverProxyPairManager === "undefined" ? Object : IObjectObserverProxyPairManager,
|
|
@@ -1458,13 +1479,14 @@ NonIterableObjectPropertyObserverProxyPairFactory = _ts_decorate15([
|
|
|
1458
1479
|
typeof IErrorLog === "undefined" ? Object : IErrorLog,
|
|
1459
1480
|
typeof IGuidFactory === "undefined" ? Object : IGuidFactory,
|
|
1460
1481
|
typeof IIndexValueAccessor === "undefined" ? Object : IIndexValueAccessor,
|
|
1461
|
-
typeof IProxyRegistry === "undefined" ? Object : IProxyRegistry
|
|
1482
|
+
typeof IProxyRegistry === "undefined" ? Object : IProxyRegistry,
|
|
1483
|
+
typeof IValueMetadata === "undefined" ? Object : IValueMetadata
|
|
1462
1484
|
])
|
|
1463
1485
|
], NonIterableObjectPropertyObserverProxyPairFactory);
|
|
1464
1486
|
|
|
1465
1487
|
// lib/property-observer/factories/non-iterable-object-property/object-property-observer-manager.ts
|
|
1466
|
-
import { Inject as Inject15, Injectable as Injectable16, InvalidOperationException as InvalidOperationException2, PropertyDescriptorType, SingletonFactory as SingletonFactory5, Type as Type8 } from "@rs-x/core";
|
|
1467
1488
|
import { Subject as Subject2 } from "rxjs";
|
|
1489
|
+
import { Inject as Inject15, Injectable as Injectable16, InvalidOperationException as InvalidOperationException2, PropertyDescriptorType, SingletonFactory as SingletonFactory5, Type as Type8 } from "@rs-x/core";
|
|
1468
1490
|
function _ts_decorate16(decorators, target, key, desc) {
|
|
1469
1491
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1470
1492
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1550,12 +1572,12 @@ var PropertObserver = class PropertObserver2 extends AbstractObserver {
|
|
|
1550
1572
|
...change,
|
|
1551
1573
|
chain: [
|
|
1552
1574
|
{
|
|
1553
|
-
|
|
1554
|
-
|
|
1575
|
+
context: this.target,
|
|
1576
|
+
index: this.id
|
|
1555
1577
|
}
|
|
1556
1578
|
],
|
|
1557
1579
|
target: this.target,
|
|
1558
|
-
id,
|
|
1580
|
+
index: id,
|
|
1559
1581
|
setValue: this.setValue
|
|
1560
1582
|
});
|
|
1561
1583
|
this._emitingChange = false;
|
|
@@ -1655,8 +1677,9 @@ ObjectPropertyObserverManager = _ts_decorate16([
|
|
|
1655
1677
|
])
|
|
1656
1678
|
], ObjectPropertyObserverManager);
|
|
1657
1679
|
|
|
1658
|
-
// lib/
|
|
1659
|
-
import {
|
|
1680
|
+
// lib/proxies/array-proxy/array-proxy.factory.ts
|
|
1681
|
+
import { Subject as Subject3 } from "rxjs";
|
|
1682
|
+
import { Inject as Inject16, Injectable as Injectable17, SingletonFactory as SingletonFactory6, Type as Type9 } from "@rs-x/core";
|
|
1660
1683
|
function _ts_decorate17(decorators, target, key, desc) {
|
|
1661
1684
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1662
1685
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1668,43 +1691,6 @@ function _ts_metadata17(k, v) {
|
|
|
1668
1691
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1669
1692
|
}
|
|
1670
1693
|
__name(_ts_metadata17, "_ts_metadata");
|
|
1671
|
-
var MustProxifyItemHandlerFactory = class extends SingletonFactory6 {
|
|
1672
|
-
static {
|
|
1673
|
-
__name(this, "MustProxifyItemHandlerFactory");
|
|
1674
|
-
}
|
|
1675
|
-
constructor() {
|
|
1676
|
-
super();
|
|
1677
|
-
}
|
|
1678
|
-
getId(index) {
|
|
1679
|
-
return index;
|
|
1680
|
-
}
|
|
1681
|
-
createInstance(_, id) {
|
|
1682
|
-
return (index) => index === id;
|
|
1683
|
-
}
|
|
1684
|
-
createId(index) {
|
|
1685
|
-
return index;
|
|
1686
|
-
}
|
|
1687
|
-
};
|
|
1688
|
-
MustProxifyItemHandlerFactory = _ts_decorate17([
|
|
1689
|
-
Injectable17(),
|
|
1690
|
-
_ts_metadata17("design:type", Function),
|
|
1691
|
-
_ts_metadata17("design:paramtypes", [])
|
|
1692
|
-
], MustProxifyItemHandlerFactory);
|
|
1693
|
-
|
|
1694
|
-
// lib/proxies/array-proxy/array-proxy.factory.ts
|
|
1695
|
-
import { Inject as Inject16, Injectable as Injectable18, SingletonFactory as SingletonFactory7, Type as Type9 } from "@rs-x/core";
|
|
1696
|
-
import { Subject as Subject3 } from "rxjs";
|
|
1697
|
-
function _ts_decorate18(decorators, target, key, desc) {
|
|
1698
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1699
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1700
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1701
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1702
|
-
}
|
|
1703
|
-
__name(_ts_decorate18, "_ts_decorate");
|
|
1704
|
-
function _ts_metadata18(k, v) {
|
|
1705
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1706
|
-
}
|
|
1707
|
-
__name(_ts_metadata18, "_ts_metadata");
|
|
1708
1694
|
function _ts_param17(paramIndex, decorator) {
|
|
1709
1695
|
return function(target, key) {
|
|
1710
1696
|
decorator(target, key, paramIndex);
|
|
@@ -1832,11 +1818,11 @@ var ArrayProxy = class ArrayProxy2 extends AbstractObserver {
|
|
|
1832
1818
|
arguments: [],
|
|
1833
1819
|
chain: [
|
|
1834
1820
|
{
|
|
1835
|
-
|
|
1836
|
-
|
|
1821
|
+
context: originaArray,
|
|
1822
|
+
index
|
|
1837
1823
|
}
|
|
1838
1824
|
],
|
|
1839
|
-
|
|
1825
|
+
index,
|
|
1840
1826
|
target: originaArray,
|
|
1841
1827
|
newValue: value
|
|
1842
1828
|
});
|
|
@@ -1848,7 +1834,7 @@ var ArrayProxy = class ArrayProxy2 extends AbstractObserver {
|
|
|
1848
1834
|
}
|
|
1849
1835
|
}
|
|
1850
1836
|
};
|
|
1851
|
-
var ArrayProxyFactory = class extends
|
|
1837
|
+
var ArrayProxyFactory = class extends SingletonFactory6 {
|
|
1852
1838
|
static {
|
|
1853
1839
|
__name(this, "ArrayProxyFactory");
|
|
1854
1840
|
}
|
|
@@ -1881,29 +1867,29 @@ var ArrayProxyFactory = class extends SingletonFactory7 {
|
|
|
1881
1867
|
arrayObserverWithProxy.observer.dispose();
|
|
1882
1868
|
}
|
|
1883
1869
|
};
|
|
1884
|
-
ArrayProxyFactory =
|
|
1885
|
-
|
|
1870
|
+
ArrayProxyFactory = _ts_decorate17([
|
|
1871
|
+
Injectable17(),
|
|
1886
1872
|
_ts_param17(0, Inject16(RsXStateManagerInjectionTokens.IProxyRegistry)),
|
|
1887
|
-
|
|
1888
|
-
|
|
1873
|
+
_ts_metadata17("design:type", Function),
|
|
1874
|
+
_ts_metadata17("design:paramtypes", [
|
|
1889
1875
|
typeof IProxyRegistry === "undefined" ? Object : IProxyRegistry
|
|
1890
1876
|
])
|
|
1891
1877
|
], ArrayProxyFactory);
|
|
1892
1878
|
|
|
1893
1879
|
// lib/proxies/date-proxy/date-proxy.factory.ts
|
|
1894
|
-
import { Inject as Inject17, Injectable as Injectable19, RsXCoreInjectionTokens as RsXCoreInjectionTokens12, SingletonFactoryWithGuid as SingletonFactoryWithGuid4, Type as Type10 } from "@rs-x/core";
|
|
1895
1880
|
import { Subject as Subject4 } from "rxjs";
|
|
1896
|
-
|
|
1881
|
+
import { Inject as Inject17, Injectable as Injectable18, RsXCoreInjectionTokens as RsXCoreInjectionTokens12, SingletonFactoryWithGuid as SingletonFactoryWithGuid4, Type as Type10 } from "@rs-x/core";
|
|
1882
|
+
function _ts_decorate18(decorators, target, key, desc) {
|
|
1897
1883
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1898
1884
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1899
1885
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1900
1886
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1901
1887
|
}
|
|
1902
|
-
__name(
|
|
1903
|
-
function
|
|
1888
|
+
__name(_ts_decorate18, "_ts_decorate");
|
|
1889
|
+
function _ts_metadata18(k, v) {
|
|
1904
1890
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1905
1891
|
}
|
|
1906
|
-
__name(
|
|
1892
|
+
__name(_ts_metadata18, "_ts_metadata");
|
|
1907
1893
|
function _ts_param18(paramIndex, decorator) {
|
|
1908
1894
|
return function(target, key) {
|
|
1909
1895
|
decorator(target, key, paramIndex);
|
|
@@ -1915,7 +1901,7 @@ var DateProxy = class DateProxy2 extends AbstractObserver {
|
|
|
1915
1901
|
__name(this, "DateProxy");
|
|
1916
1902
|
}
|
|
1917
1903
|
_proxyRegistry;
|
|
1918
|
-
|
|
1904
|
+
indexWatchRule;
|
|
1919
1905
|
_dateSetterMetadata = /* @__PURE__ */ new Map([
|
|
1920
1906
|
[
|
|
1921
1907
|
"setFullYear",
|
|
@@ -2038,8 +2024,8 @@ var DateProxy = class DateProxy2 extends AbstractObserver {
|
|
|
2038
2024
|
}
|
|
2039
2025
|
]
|
|
2040
2026
|
]);
|
|
2041
|
-
constructor(owner, initialValue, _proxyRegistry,
|
|
2042
|
-
super(owner, Type10.cast(void 0), initialValue, new Subject4(), void 0), this._proxyRegistry = _proxyRegistry, this.
|
|
2027
|
+
constructor(owner, initialValue, _proxyRegistry, indexWatchRule) {
|
|
2028
|
+
super(owner, Type10.cast(void 0), initialValue, new Subject4(), void 0), this._proxyRegistry = _proxyRegistry, this.indexWatchRule = indexWatchRule;
|
|
2043
2029
|
this.target = new Proxy(initialValue, this);
|
|
2044
2030
|
this._proxyRegistry.register(initialValue, this.target);
|
|
2045
2031
|
}
|
|
@@ -2062,40 +2048,40 @@ var DateProxy = class DateProxy2 extends AbstractObserver {
|
|
|
2062
2048
|
}
|
|
2063
2049
|
return value;
|
|
2064
2050
|
}
|
|
2065
|
-
emitChanges(oldTimestamp,
|
|
2051
|
+
emitChanges(oldTimestamp, date, propertyName) {
|
|
2066
2052
|
const oldDate = new Date(oldTimestamp);
|
|
2067
|
-
if (!this.
|
|
2053
|
+
if (!this.indexWatchRule) {
|
|
2068
2054
|
this.emitChange({
|
|
2069
2055
|
arguments: [],
|
|
2070
2056
|
chain: [
|
|
2071
2057
|
{
|
|
2072
|
-
|
|
2073
|
-
|
|
2058
|
+
context: date,
|
|
2059
|
+
index: propertyName
|
|
2074
2060
|
}
|
|
2075
2061
|
],
|
|
2076
|
-
|
|
2077
|
-
target:
|
|
2078
|
-
newValue:
|
|
2062
|
+
index: propertyName,
|
|
2063
|
+
target: date,
|
|
2064
|
+
newValue: date
|
|
2079
2065
|
});
|
|
2080
2066
|
return;
|
|
2081
2067
|
}
|
|
2082
2068
|
for (const setterMetaData of this._dateSetterMetadata.values()) {
|
|
2083
|
-
if (!this.
|
|
2069
|
+
if (!this.indexWatchRule.test(setterMetaData.name, date)) {
|
|
2084
2070
|
continue;
|
|
2085
2071
|
}
|
|
2086
2072
|
const oldValue = oldDate[setterMetaData.getterName].call(oldDate);
|
|
2087
|
-
const newValue =
|
|
2073
|
+
const newValue = date[setterMetaData.getterName].call(date);
|
|
2088
2074
|
if (oldValue !== newValue) {
|
|
2089
2075
|
this.emitChange({
|
|
2090
2076
|
arguments: [],
|
|
2091
2077
|
chain: [
|
|
2092
2078
|
{
|
|
2093
|
-
|
|
2094
|
-
|
|
2079
|
+
context: date,
|
|
2080
|
+
index: setterMetaData.name
|
|
2095
2081
|
}
|
|
2096
2082
|
],
|
|
2097
|
-
|
|
2098
|
-
target:
|
|
2083
|
+
index: setterMetaData.name,
|
|
2084
|
+
target: date,
|
|
2099
2085
|
newValue
|
|
2100
2086
|
});
|
|
2101
2087
|
}
|
|
@@ -2111,11 +2097,11 @@ var DateProxy = class DateProxy2 extends AbstractObserver {
|
|
|
2111
2097
|
],
|
|
2112
2098
|
chain: [
|
|
2113
2099
|
{
|
|
2114
|
-
|
|
2115
|
-
|
|
2100
|
+
context: target,
|
|
2101
|
+
index: 0
|
|
2116
2102
|
}
|
|
2117
2103
|
],
|
|
2118
|
-
|
|
2104
|
+
index: 0,
|
|
2119
2105
|
target,
|
|
2120
2106
|
newValue: target
|
|
2121
2107
|
});
|
|
@@ -2139,7 +2125,7 @@ var DateProxyFactory = class extends SingletonFactoryWithGuid4 {
|
|
|
2139
2125
|
return data.date;
|
|
2140
2126
|
}
|
|
2141
2127
|
getGroupMemberId(data) {
|
|
2142
|
-
return data.
|
|
2128
|
+
return data.indexWatchRule;
|
|
2143
2129
|
}
|
|
2144
2130
|
createInstance(dateProxyData, id) {
|
|
2145
2131
|
const observer = new DateProxy({
|
|
@@ -2148,7 +2134,7 @@ var DateProxyFactory = class extends SingletonFactoryWithGuid4 {
|
|
|
2148
2134
|
this.release(id);
|
|
2149
2135
|
dateProxyData.owner?.release();
|
|
2150
2136
|
}, "release")
|
|
2151
|
-
}, dateProxyData.date, this._proxyRegistry, dateProxyData.
|
|
2137
|
+
}, dateProxyData.date, this._proxyRegistry, dateProxyData.indexWatchRule);
|
|
2152
2138
|
return {
|
|
2153
2139
|
observer,
|
|
2154
2140
|
proxy: observer.target,
|
|
@@ -2156,30 +2142,30 @@ var DateProxyFactory = class extends SingletonFactoryWithGuid4 {
|
|
|
2156
2142
|
};
|
|
2157
2143
|
}
|
|
2158
2144
|
};
|
|
2159
|
-
DateProxyFactory =
|
|
2160
|
-
|
|
2145
|
+
DateProxyFactory = _ts_decorate18([
|
|
2146
|
+
Injectable18(),
|
|
2161
2147
|
_ts_param18(0, Inject17(RsXCoreInjectionTokens12.IGuidFactory)),
|
|
2162
2148
|
_ts_param18(1, Inject17(RsXStateManagerInjectionTokens.IProxyRegistry)),
|
|
2163
|
-
|
|
2164
|
-
|
|
2149
|
+
_ts_metadata18("design:type", Function),
|
|
2150
|
+
_ts_metadata18("design:paramtypes", [
|
|
2165
2151
|
typeof IGuidFactory === "undefined" ? Object : IGuidFactory,
|
|
2166
2152
|
typeof IProxyRegistry === "undefined" ? Object : IProxyRegistry
|
|
2167
2153
|
])
|
|
2168
2154
|
], DateProxyFactory);
|
|
2169
2155
|
|
|
2170
2156
|
// lib/proxies/map-proxy/map-proxy.factory.ts
|
|
2171
|
-
import { Inject as Inject18, Injectable as
|
|
2172
|
-
function
|
|
2157
|
+
import { Inject as Inject18, Injectable as Injectable19, SingletonFactory as SingletonFactory7, Type as Type11 } from "@rs-x/core";
|
|
2158
|
+
function _ts_decorate19(decorators, target, key, desc) {
|
|
2173
2159
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2174
2160
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2175
2161
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2176
2162
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2177
2163
|
}
|
|
2178
|
-
__name(
|
|
2179
|
-
function
|
|
2164
|
+
__name(_ts_decorate19, "_ts_decorate");
|
|
2165
|
+
function _ts_metadata19(k, v) {
|
|
2180
2166
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2181
2167
|
}
|
|
2182
|
-
__name(
|
|
2168
|
+
__name(_ts_metadata19, "_ts_metadata");
|
|
2183
2169
|
function _ts_param19(paramIndex, decorator) {
|
|
2184
2170
|
return function(target, key) {
|
|
2185
2171
|
decorator(target, key, paramIndex);
|
|
@@ -2216,7 +2202,6 @@ var MapProxy = class extends AbstractObserver {
|
|
|
2216
2202
|
}
|
|
2217
2203
|
disposeInternal() {
|
|
2218
2204
|
this._proxyRegistry.unregister(this.value);
|
|
2219
|
-
;
|
|
2220
2205
|
}
|
|
2221
2206
|
isUpdateMapKey(property) {
|
|
2222
2207
|
return typeof property === "string" && property in this.updateMap;
|
|
@@ -2250,17 +2235,17 @@ var MapProxy = class extends AbstractObserver {
|
|
|
2250
2235
|
arguments: [],
|
|
2251
2236
|
chain: [
|
|
2252
2237
|
{
|
|
2253
|
-
|
|
2254
|
-
|
|
2238
|
+
context: originalMap,
|
|
2239
|
+
index: key
|
|
2255
2240
|
}
|
|
2256
2241
|
],
|
|
2257
|
-
|
|
2242
|
+
index: key,
|
|
2258
2243
|
target: originalMap,
|
|
2259
2244
|
newValue: value
|
|
2260
2245
|
});
|
|
2261
2246
|
}
|
|
2262
2247
|
};
|
|
2263
|
-
var MapProxyFactory = class extends
|
|
2248
|
+
var MapProxyFactory = class extends SingletonFactory7 {
|
|
2264
2249
|
static {
|
|
2265
2250
|
__name(this, "MapProxyFactory");
|
|
2266
2251
|
}
|
|
@@ -2292,29 +2277,29 @@ var MapProxyFactory = class extends SingletonFactory8 {
|
|
|
2292
2277
|
mapObserverWithProxy.observer.dispose();
|
|
2293
2278
|
}
|
|
2294
2279
|
};
|
|
2295
|
-
MapProxyFactory =
|
|
2296
|
-
|
|
2280
|
+
MapProxyFactory = _ts_decorate19([
|
|
2281
|
+
Injectable19(),
|
|
2297
2282
|
_ts_param19(0, Inject18(RsXStateManagerInjectionTokens.IProxyRegistry)),
|
|
2298
|
-
|
|
2299
|
-
|
|
2283
|
+
_ts_metadata19("design:type", Function),
|
|
2284
|
+
_ts_metadata19("design:paramtypes", [
|
|
2300
2285
|
typeof IProxyRegistry === "undefined" ? Object : IProxyRegistry
|
|
2301
2286
|
])
|
|
2302
2287
|
], MapProxyFactory);
|
|
2303
2288
|
|
|
2304
2289
|
// lib/proxies/observable-proxy/observable-proxy.factory.ts
|
|
2305
|
-
import { Inject as Inject19, Injectable as Injectable21, RsXCoreInjectionTokens as RsXCoreInjectionTokens13, SingletonFactory as SingletonFactory9 } from "@rs-x/core";
|
|
2306
2290
|
import { ReplaySubject as ReplaySubject2 } from "rxjs";
|
|
2307
|
-
|
|
2291
|
+
import { Inject as Inject19, Injectable as Injectable20, RsXCoreInjectionTokens as RsXCoreInjectionTokens13, SingletonFactory as SingletonFactory8 } from "@rs-x/core";
|
|
2292
|
+
function _ts_decorate20(decorators, target, key, desc) {
|
|
2308
2293
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2309
2294
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2310
2295
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2311
2296
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2312
2297
|
}
|
|
2313
|
-
__name(
|
|
2314
|
-
function
|
|
2298
|
+
__name(_ts_decorate20, "_ts_decorate");
|
|
2299
|
+
function _ts_metadata20(k, v) {
|
|
2315
2300
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2316
2301
|
}
|
|
2317
|
-
__name(
|
|
2302
|
+
__name(_ts_metadata20, "_ts_metadata");
|
|
2318
2303
|
function _ts_param20(paramIndex, decorator) {
|
|
2319
2304
|
return function(target, key) {
|
|
2320
2305
|
decorator(target, key, paramIndex);
|
|
@@ -2353,12 +2338,12 @@ var ObservableProxy = class ObservableProxy2 extends AbstractObserver {
|
|
|
2353
2338
|
arguments: [],
|
|
2354
2339
|
chain: [],
|
|
2355
2340
|
target: this.target,
|
|
2356
|
-
|
|
2341
|
+
index: this.id,
|
|
2357
2342
|
newValue
|
|
2358
2343
|
});
|
|
2359
2344
|
}, "emitObservableChange");
|
|
2360
2345
|
};
|
|
2361
|
-
var ObservableProxyFactory = class extends
|
|
2346
|
+
var ObservableProxyFactory = class extends SingletonFactory8 {
|
|
2362
2347
|
static {
|
|
2363
2348
|
__name(this, "ObservableProxyFactory");
|
|
2364
2349
|
}
|
|
@@ -2390,29 +2375,29 @@ var ObservableProxyFactory = class extends SingletonFactory9 {
|
|
|
2390
2375
|
observableObserverWithProxy.observer.dispose();
|
|
2391
2376
|
}
|
|
2392
2377
|
};
|
|
2393
|
-
ObservableProxyFactory =
|
|
2394
|
-
|
|
2378
|
+
ObservableProxyFactory = _ts_decorate20([
|
|
2379
|
+
Injectable20(),
|
|
2395
2380
|
_ts_param20(0, Inject19(RsXCoreInjectionTokens13.IObservableAccessor)),
|
|
2396
|
-
|
|
2397
|
-
|
|
2381
|
+
_ts_metadata20("design:type", Function),
|
|
2382
|
+
_ts_metadata20("design:paramtypes", [
|
|
2398
2383
|
typeof IObservableAccessor === "undefined" ? Object : IObservableAccessor
|
|
2399
2384
|
])
|
|
2400
2385
|
], ObservableProxyFactory);
|
|
2401
2386
|
|
|
2402
2387
|
// lib/proxies/promise-proxy/promise-proxy.factory.ts
|
|
2403
|
-
import { Inject as Inject20, Injectable as Injectable22, RsXCoreInjectionTokens as RsXCoreInjectionTokens14, SingletonFactory as SingletonFactory10 } from "@rs-x/core";
|
|
2404
2388
|
import { ReplaySubject as ReplaySubject3 } from "rxjs";
|
|
2405
|
-
|
|
2389
|
+
import { Inject as Inject20, Injectable as Injectable21, RsXCoreInjectionTokens as RsXCoreInjectionTokens14, SingletonFactory as SingletonFactory9 } from "@rs-x/core";
|
|
2390
|
+
function _ts_decorate21(decorators, target, key, desc) {
|
|
2406
2391
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2407
2392
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2408
2393
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2409
2394
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2410
2395
|
}
|
|
2411
|
-
__name(
|
|
2412
|
-
function
|
|
2396
|
+
__name(_ts_decorate21, "_ts_decorate");
|
|
2397
|
+
function _ts_metadata21(k, v) {
|
|
2413
2398
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2414
2399
|
}
|
|
2415
|
-
__name(
|
|
2400
|
+
__name(_ts_metadata21, "_ts_metadata");
|
|
2416
2401
|
function _ts_param21(paramIndex, decorator) {
|
|
2417
2402
|
return function(target, key) {
|
|
2418
2403
|
decorator(target, key, paramIndex);
|
|
@@ -2444,7 +2429,7 @@ var PromiseObserver = class PromiseObserver2 extends AbstractObserver {
|
|
|
2444
2429
|
});
|
|
2445
2430
|
}, "onValueResolved");
|
|
2446
2431
|
};
|
|
2447
|
-
var PromiseProxyFactory = class extends
|
|
2432
|
+
var PromiseProxyFactory = class extends SingletonFactory9 {
|
|
2448
2433
|
static {
|
|
2449
2434
|
__name(this, "PromiseProxyFactory");
|
|
2450
2435
|
}
|
|
@@ -2476,24 +2461,24 @@ var PromiseProxyFactory = class extends SingletonFactory10 {
|
|
|
2476
2461
|
promiseObserverWithProxy.observer.dispose();
|
|
2477
2462
|
}
|
|
2478
2463
|
};
|
|
2479
|
-
PromiseProxyFactory =
|
|
2480
|
-
|
|
2464
|
+
PromiseProxyFactory = _ts_decorate21([
|
|
2465
|
+
Injectable21(),
|
|
2481
2466
|
_ts_param21(0, Inject20(RsXCoreInjectionTokens14.IPromiseAccessor)),
|
|
2482
|
-
|
|
2483
|
-
|
|
2467
|
+
_ts_metadata21("design:type", Function),
|
|
2468
|
+
_ts_metadata21("design:paramtypes", [
|
|
2484
2469
|
typeof IPromiseAccessor === "undefined" ? Object : IPromiseAccessor
|
|
2485
2470
|
])
|
|
2486
2471
|
], PromiseProxyFactory);
|
|
2487
2472
|
|
|
2488
2473
|
// lib/proxies/proxy-registry/proxy-registry.ts
|
|
2489
|
-
import { Injectable as
|
|
2490
|
-
function
|
|
2474
|
+
import { Injectable as Injectable22 } from "@rs-x/core";
|
|
2475
|
+
function _ts_decorate22(decorators, target, key, desc) {
|
|
2491
2476
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2492
2477
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2493
2478
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2494
2479
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2495
2480
|
}
|
|
2496
|
-
__name(
|
|
2481
|
+
__name(_ts_decorate22, "_ts_decorate");
|
|
2497
2482
|
var ProxyRegistry = class {
|
|
2498
2483
|
static {
|
|
2499
2484
|
__name(this, "ProxyRegistry");
|
|
@@ -2515,23 +2500,23 @@ var ProxyRegistry = class {
|
|
|
2515
2500
|
return !!this.getProxyTarget(object);
|
|
2516
2501
|
}
|
|
2517
2502
|
};
|
|
2518
|
-
ProxyRegistry =
|
|
2519
|
-
|
|
2503
|
+
ProxyRegistry = _ts_decorate22([
|
|
2504
|
+
Injectable22()
|
|
2520
2505
|
], ProxyRegistry);
|
|
2521
2506
|
|
|
2522
2507
|
// lib/proxies/set-proxy/set-proxy.factory.ts
|
|
2523
|
-
import { Inject as Inject21, Injectable as
|
|
2524
|
-
function
|
|
2508
|
+
import { Inject as Inject21, Injectable as Injectable23, SingletonFactory as SingletonFactory10, Type as Type12 } from "@rs-x/core";
|
|
2509
|
+
function _ts_decorate23(decorators, target, key, desc) {
|
|
2525
2510
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2526
2511
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2527
2512
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2528
2513
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2529
2514
|
}
|
|
2530
|
-
__name(
|
|
2531
|
-
function
|
|
2515
|
+
__name(_ts_decorate23, "_ts_decorate");
|
|
2516
|
+
function _ts_metadata22(k, v) {
|
|
2532
2517
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2533
2518
|
}
|
|
2534
|
-
__name(
|
|
2519
|
+
__name(_ts_metadata22, "_ts_metadata");
|
|
2535
2520
|
function _ts_param22(paramIndex, decorator) {
|
|
2536
2521
|
return function(target, key) {
|
|
2537
2522
|
decorator(target, key, paramIndex);
|
|
@@ -2589,17 +2574,17 @@ var SetProxy = class extends AbstractObserver {
|
|
|
2589
2574
|
arguments: [],
|
|
2590
2575
|
chain: [
|
|
2591
2576
|
{
|
|
2592
|
-
|
|
2593
|
-
id
|
|
2577
|
+
context: originalSet,
|
|
2578
|
+
index: id
|
|
2594
2579
|
}
|
|
2595
2580
|
],
|
|
2596
|
-
id,
|
|
2581
|
+
index: id,
|
|
2597
2582
|
target: originalSet,
|
|
2598
2583
|
newValue: value
|
|
2599
2584
|
});
|
|
2600
2585
|
}
|
|
2601
2586
|
};
|
|
2602
|
-
var SetProxyFactory = class extends
|
|
2587
|
+
var SetProxyFactory = class extends SingletonFactory10 {
|
|
2603
2588
|
static {
|
|
2604
2589
|
__name(this, "SetProxyFactory");
|
|
2605
2590
|
}
|
|
@@ -2631,11 +2616,11 @@ var SetProxyFactory = class extends SingletonFactory11 {
|
|
|
2631
2616
|
setObserverWithProxy.observer.dispose();
|
|
2632
2617
|
}
|
|
2633
2618
|
};
|
|
2634
|
-
SetProxyFactory =
|
|
2635
|
-
|
|
2619
|
+
SetProxyFactory = _ts_decorate23([
|
|
2620
|
+
Injectable23(),
|
|
2636
2621
|
_ts_param22(0, Inject21(RsXStateManagerInjectionTokens.IProxyRegistry)),
|
|
2637
|
-
|
|
2638
|
-
|
|
2622
|
+
_ts_metadata22("design:type", Function),
|
|
2623
|
+
_ts_metadata22("design:paramtypes", [
|
|
2639
2624
|
typeof IProxyRegistry === "undefined" ? Object : IProxyRegistry
|
|
2640
2625
|
])
|
|
2641
2626
|
], SetProxyFactory);
|
|
@@ -2644,25 +2629,25 @@ SetProxyFactory = _ts_decorate24([
|
|
|
2644
2629
|
import { ContainerModule, InjectionContainer, registerMultiInjectServices, RsXCoreModule } from "@rs-x/core";
|
|
2645
2630
|
|
|
2646
2631
|
// lib/state-manager/object-state-manager.ts
|
|
2647
|
-
import { Inject as Inject22, Injectable as
|
|
2648
|
-
function
|
|
2632
|
+
import { Inject as Inject22, Injectable as Injectable24, RsXCoreInjectionTokens as RsXCoreInjectionTokens15, SingletonFactory as SingletonFactory11, UnsupportedException as UnsupportedException2 } from "@rs-x/core";
|
|
2633
|
+
function _ts_decorate24(decorators, target, key, desc) {
|
|
2649
2634
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2650
2635
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2651
2636
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2652
2637
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2653
2638
|
}
|
|
2654
|
-
__name(
|
|
2655
|
-
function
|
|
2639
|
+
__name(_ts_decorate24, "_ts_decorate");
|
|
2640
|
+
function _ts_metadata23(k, v) {
|
|
2656
2641
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2657
2642
|
}
|
|
2658
|
-
__name(
|
|
2643
|
+
__name(_ts_metadata23, "_ts_metadata");
|
|
2659
2644
|
function _ts_param23(paramIndex, decorator) {
|
|
2660
2645
|
return function(target, key) {
|
|
2661
2646
|
decorator(target, key, paramIndex);
|
|
2662
2647
|
};
|
|
2663
2648
|
}
|
|
2664
2649
|
__name(_ts_param23, "_ts_param");
|
|
2665
|
-
var StateForObjectManager = class extends
|
|
2650
|
+
var StateForObjectManager = class extends SingletonFactory11 {
|
|
2666
2651
|
static {
|
|
2667
2652
|
__name(this, "StateForObjectManager");
|
|
2668
2653
|
}
|
|
@@ -2708,7 +2693,7 @@ var StateForObjectManager = class extends SingletonFactory12 {
|
|
|
2708
2693
|
this.releaseContext();
|
|
2709
2694
|
}
|
|
2710
2695
|
};
|
|
2711
|
-
var ObjectStateManager = class extends
|
|
2696
|
+
var ObjectStateManager = class extends SingletonFactory11 {
|
|
2712
2697
|
static {
|
|
2713
2698
|
__name(this, "ObjectStateManager");
|
|
2714
2699
|
}
|
|
@@ -2752,21 +2737,21 @@ var ObjectStateManager = class extends SingletonFactory12 {
|
|
|
2752
2737
|
return new StateForObjectManager(this._deepClone, () => this.release(context));
|
|
2753
2738
|
}
|
|
2754
2739
|
};
|
|
2755
|
-
ObjectStateManager =
|
|
2756
|
-
|
|
2740
|
+
ObjectStateManager = _ts_decorate24([
|
|
2741
|
+
Injectable24(),
|
|
2757
2742
|
_ts_param23(0, Inject22(RsXCoreInjectionTokens15.IDeepClone)),
|
|
2758
|
-
|
|
2759
|
-
|
|
2743
|
+
_ts_metadata23("design:type", Function),
|
|
2744
|
+
_ts_metadata23("design:paramtypes", [
|
|
2760
2745
|
typeof IDeepClone === "undefined" ? Object : IDeepClone
|
|
2761
2746
|
])
|
|
2762
2747
|
], ObjectStateManager);
|
|
2763
2748
|
|
|
2764
2749
|
// lib/state-manager/state-manager.ts
|
|
2765
|
-
import { Inject as Inject23, Injectable as Injectable26, PENDING, RsXCoreInjectionTokens as RsXCoreInjectionTokens16 } from "@rs-x/core";
|
|
2766
2750
|
import { Subject as Subject5 } from "rxjs";
|
|
2751
|
+
import { Assertion, Inject as Inject23, Injectable as Injectable25, PENDING, RsXCoreInjectionTokens as RsXCoreInjectionTokens16, truePredicate as truePredicate6 } from "@rs-x/core";
|
|
2767
2752
|
|
|
2768
2753
|
// lib/state-manager/state-change-subscription-manager/state-change-subsription-manager.ts
|
|
2769
|
-
import { SingletonFactory as
|
|
2754
|
+
import { SingletonFactory as SingletonFactory12 } from "@rs-x/core";
|
|
2770
2755
|
var StateChangeSubscriptionsForContextManager = class StateChangeSubscriptionsForContextManager2 extends GroupedChangeSubscriptionsForContextManager {
|
|
2771
2756
|
static {
|
|
2772
2757
|
__name(this, "StateChangeSubscriptionsForContextManager");
|
|
@@ -2776,17 +2761,17 @@ var StateChangeSubscriptionsForContextManager = class StateChangeSubscriptionsFo
|
|
|
2776
2761
|
super(context, releaseContext, errorLog, guidFactory), this._objectObserverManager = _objectObserverManager;
|
|
2777
2762
|
}
|
|
2778
2763
|
getGroupId(data) {
|
|
2779
|
-
return data.
|
|
2764
|
+
return data.index;
|
|
2780
2765
|
}
|
|
2781
2766
|
getGroupMemberId(data) {
|
|
2782
|
-
return data.
|
|
2767
|
+
return data.indexWatchRule;
|
|
2783
2768
|
}
|
|
2784
2769
|
createObserver(context, data, id) {
|
|
2785
2770
|
const objectObserver = this._objectObserverManager.create(context).instance;
|
|
2786
2771
|
const observer = objectObserver.create({
|
|
2787
|
-
|
|
2772
|
+
index: data.index,
|
|
2788
2773
|
initializeManually: true,
|
|
2789
|
-
|
|
2774
|
+
indexWatchRule: data.indexWatchRule,
|
|
2790
2775
|
owner: {
|
|
2791
2776
|
release: /* @__PURE__ */ __name(() => this.release(id), "release")
|
|
2792
2777
|
}
|
|
@@ -2797,7 +2782,7 @@ var StateChangeSubscriptionsForContextManager = class StateChangeSubscriptionsFo
|
|
|
2797
2782
|
};
|
|
2798
2783
|
}
|
|
2799
2784
|
};
|
|
2800
|
-
var StateChangeSubscriptionManager = class extends
|
|
2785
|
+
var StateChangeSubscriptionManager = class extends SingletonFactory12 {
|
|
2801
2786
|
static {
|
|
2802
2787
|
__name(this, "StateChangeSubscriptionManager");
|
|
2803
2788
|
}
|
|
@@ -2810,6 +2795,9 @@ var StateChangeSubscriptionManager = class extends SingletonFactory13 {
|
|
|
2810
2795
|
getId(context) {
|
|
2811
2796
|
return context;
|
|
2812
2797
|
}
|
|
2798
|
+
instanceGroupInfoEntriesForContext(context) {
|
|
2799
|
+
return this.getFromId(context)?.instanceGroupInfoEntries() ?? [][Symbol.iterator]();
|
|
2800
|
+
}
|
|
2813
2801
|
isRegistered(context, key) {
|
|
2814
2802
|
const stateChangeSubscriptionsForContextManager = this.getFromId(context);
|
|
2815
2803
|
if (!stateChangeSubscriptionsForContextManager) {
|
|
@@ -2830,17 +2818,17 @@ var StateChangeSubscriptionManager = class extends SingletonFactory13 {
|
|
|
2830
2818
|
};
|
|
2831
2819
|
|
|
2832
2820
|
// lib/state-manager/state-manager.ts
|
|
2833
|
-
function
|
|
2821
|
+
function _ts_decorate25(decorators, target, key, desc) {
|
|
2834
2822
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2835
2823
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2836
2824
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2837
2825
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2838
2826
|
}
|
|
2839
|
-
__name(
|
|
2840
|
-
function
|
|
2827
|
+
__name(_ts_decorate25, "_ts_decorate");
|
|
2828
|
+
function _ts_metadata24(k, v) {
|
|
2841
2829
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2842
2830
|
}
|
|
2843
|
-
__name(
|
|
2831
|
+
__name(_ts_metadata24, "_ts_metadata");
|
|
2844
2832
|
function _ts_param24(paramIndex, decorator) {
|
|
2845
2833
|
return function(target, key) {
|
|
2846
2834
|
decorator(target, key, paramIndex);
|
|
@@ -2881,31 +2869,34 @@ var StateManager = class {
|
|
|
2881
2869
|
toString() {
|
|
2882
2870
|
return this._objectStateManager.toString();
|
|
2883
2871
|
}
|
|
2884
|
-
|
|
2872
|
+
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
2873
|
+
return `${this.constructor.name}`;
|
|
2874
|
+
}
|
|
2875
|
+
isWatched(context, index, indexWatchRule) {
|
|
2885
2876
|
const stateChangeSubscriptionsForContextManager = this._stateChangeSubscriptionManager.getFromId(context);
|
|
2886
2877
|
if (!stateChangeSubscriptionsForContextManager) {
|
|
2887
2878
|
return false;
|
|
2888
2879
|
}
|
|
2889
2880
|
const id = stateChangeSubscriptionsForContextManager.getId({
|
|
2890
|
-
|
|
2891
|
-
|
|
2881
|
+
index,
|
|
2882
|
+
indexWatchRule
|
|
2892
2883
|
});
|
|
2893
2884
|
return id ? stateChangeSubscriptionsForContextManager.has(id) : false;
|
|
2894
2885
|
}
|
|
2895
|
-
watchState(context, index,
|
|
2896
|
-
if (!this.isWatched(context, index,
|
|
2886
|
+
watchState(context, index, indexWatchRule) {
|
|
2887
|
+
if (!this.isWatched(context, index, indexWatchRule)) {
|
|
2897
2888
|
const value = this.getState(context, index);
|
|
2898
|
-
this.tryToSubscribeToChange(context, index,
|
|
2889
|
+
this.tryToSubscribeToChange(context, index, indexWatchRule);
|
|
2899
2890
|
return value;
|
|
2900
2891
|
} else {
|
|
2901
2892
|
return this.increaseStateReferenceCount(context, index, true);
|
|
2902
2893
|
}
|
|
2903
2894
|
}
|
|
2904
|
-
releaseState(context, index,
|
|
2895
|
+
releaseState(context, index, indexWatchRule) {
|
|
2905
2896
|
if (!this._objectStateManager.getFromId(context)?.has(index)) {
|
|
2906
2897
|
return;
|
|
2907
2898
|
}
|
|
2908
|
-
this.internalUnregister(context, index,
|
|
2899
|
+
this.internalUnregister(context, index, indexWatchRule);
|
|
2909
2900
|
}
|
|
2910
2901
|
clear() {
|
|
2911
2902
|
this._stateChangeSubscriptionManager.dispose();
|
|
@@ -2917,31 +2908,34 @@ var StateManager = class {
|
|
|
2917
2908
|
setState(context, index, value) {
|
|
2918
2909
|
this.internalSetState(context, index, value, {
|
|
2919
2910
|
context,
|
|
2920
|
-
value: this.getState(context, index)
|
|
2911
|
+
value: this.getState(context, index),
|
|
2912
|
+
shouldEmitChange: truePredicate6
|
|
2921
2913
|
});
|
|
2922
2914
|
}
|
|
2923
2915
|
internalSetState(context, index, value, transferValue) {
|
|
2924
2916
|
this.tryRebindingNestedState(value, transferValue.value);
|
|
2925
2917
|
this._objectStateManager.replaceState(index, context, value, transferValue.context, false);
|
|
2926
|
-
|
|
2918
|
+
if (!transferValue?.shouldEmitChange || transferValue.shouldEmitChange(context, index)) {
|
|
2919
|
+
this.emitChange(context, index, value, transferValue.value, transferValue.context);
|
|
2920
|
+
}
|
|
2927
2921
|
}
|
|
2928
2922
|
getOldValue(context, index) {
|
|
2929
2923
|
return this._objectStateManager.getFromId(context)?.getFromId(index)?.valueCopy;
|
|
2930
2924
|
}
|
|
2931
|
-
unnsubscribeToObserverEvents(context, index,
|
|
2925
|
+
unnsubscribeToObserverEvents(context, index, indexWatchRule) {
|
|
2932
2926
|
const subscriptionsForKey = this._stateChangeSubscriptionManager.getFromId(context);
|
|
2933
2927
|
const observer = subscriptionsForKey?.getFromData({
|
|
2934
|
-
|
|
2935
|
-
|
|
2928
|
+
index,
|
|
2929
|
+
indexWatchRule
|
|
2936
2930
|
});
|
|
2937
2931
|
if (!observer) {
|
|
2938
2932
|
return;
|
|
2939
2933
|
}
|
|
2940
2934
|
observer.dispose();
|
|
2941
2935
|
}
|
|
2942
|
-
internalUnregister(context, index,
|
|
2936
|
+
internalUnregister(context, index, indexWatchRule) {
|
|
2943
2937
|
if (this.canReleaseState(context, index)) {
|
|
2944
|
-
this.unnsubscribeToObserverEvents(context, index,
|
|
2938
|
+
this.unnsubscribeToObserverEvents(context, index, indexWatchRule);
|
|
2945
2939
|
}
|
|
2946
2940
|
}
|
|
2947
2941
|
emitChange(context, index, newValue, oldValue, oldContext) {
|
|
@@ -2951,7 +2945,7 @@ var StateManager = class {
|
|
|
2951
2945
|
this._changed.next({
|
|
2952
2946
|
oldContext: oldContext ?? context,
|
|
2953
2947
|
context,
|
|
2954
|
-
|
|
2948
|
+
index,
|
|
2955
2949
|
oldValue,
|
|
2956
2950
|
newValue
|
|
2957
2951
|
});
|
|
@@ -2971,11 +2965,11 @@ var StateManager = class {
|
|
|
2971
2965
|
});
|
|
2972
2966
|
return state;
|
|
2973
2967
|
}
|
|
2974
|
-
tryToSubscribeToChange(context, index,
|
|
2968
|
+
tryToSubscribeToChange(context, index, indexWatchRule, transferedValue) {
|
|
2975
2969
|
this._stateChangeSubscriptionManager.create(context).instance.create({
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
onChanged: /* @__PURE__ */ __name((change) => this.onChange(change,
|
|
2970
|
+
index,
|
|
2971
|
+
indexWatchRule,
|
|
2972
|
+
onChanged: /* @__PURE__ */ __name((change) => this.onChange(change, true), "onChanged"),
|
|
2979
2973
|
init: /* @__PURE__ */ __name((observer) => {
|
|
2980
2974
|
if (observer.value !== void 0) {
|
|
2981
2975
|
this.setInitialValue(context, index, observer.value, transferedValue, true);
|
|
@@ -2996,22 +2990,21 @@ var StateManager = class {
|
|
|
2996
2990
|
if (!oldState) {
|
|
2997
2991
|
return [];
|
|
2998
2992
|
}
|
|
2999
|
-
return Array.from(oldState.ids()).map((
|
|
3000
|
-
const { value: oldValue, watched } = oldState.getFromId(
|
|
3001
|
-
const newValue = this.getValue(newContext,
|
|
2993
|
+
return Array.from(oldState.ids()).map((index) => {
|
|
2994
|
+
const { value: oldValue, watched } = oldState.getFromId(index) ?? {};
|
|
2995
|
+
const newValue = this.getValue(newContext, index);
|
|
3002
2996
|
if (oldContext === newContext && this._equalityService.isEqual(oldValue, newValue)) {
|
|
3003
2997
|
return [];
|
|
3004
2998
|
}
|
|
3005
|
-
let pendingId = null;
|
|
3006
2999
|
if (newValue === PENDING) {
|
|
3007
3000
|
this._pending.set(newContext, oldValue);
|
|
3008
3001
|
}
|
|
3009
3002
|
const stateInfo = {
|
|
3010
3003
|
oldContext,
|
|
3011
3004
|
context: newContext,
|
|
3012
|
-
|
|
3005
|
+
index,
|
|
3013
3006
|
oldValue,
|
|
3014
|
-
newValue
|
|
3007
|
+
newValue,
|
|
3015
3008
|
watched
|
|
3016
3009
|
};
|
|
3017
3010
|
return newValue === PENDING ? [
|
|
@@ -3022,38 +3015,68 @@ var StateManager = class {
|
|
|
3022
3015
|
];
|
|
3023
3016
|
}).reduce((a, b) => a.concat(b), []);
|
|
3024
3017
|
}
|
|
3025
|
-
tryRebindingNestedState(newValue, oldValue
|
|
3018
|
+
tryRebindingNestedState(newValue, oldValue) {
|
|
3026
3019
|
const stateChanges = this.getStateChanges(oldValue, newValue);
|
|
3027
|
-
stateChanges.
|
|
3028
|
-
|
|
3029
|
-
}
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3020
|
+
if (stateChanges.length === 0) {
|
|
3021
|
+
return;
|
|
3022
|
+
}
|
|
3023
|
+
const emitted = [];
|
|
3024
|
+
const shouldEmitChange = /* @__PURE__ */ __name((context, index) => {
|
|
3025
|
+
if (emitted.some(([c, i]) => c === context && i === index)) {
|
|
3026
|
+
return false;
|
|
3027
|
+
}
|
|
3028
|
+
emitted.push([
|
|
3029
|
+
context,
|
|
3030
|
+
index
|
|
3031
|
+
]);
|
|
3032
|
+
return true;
|
|
3033
|
+
}, "shouldEmitChange");
|
|
3034
|
+
for (const stateChange of stateChanges) {
|
|
3035
|
+
Assertion.assert(() => stateChange.context !== stateChange.oldContext, "Expected old and new context not to be equal");
|
|
3036
|
+
this._contextChanged.next({
|
|
3037
|
+
context: stateChange.context,
|
|
3038
|
+
oldContext: stateChange.oldContext,
|
|
3039
|
+
index: stateChange.index
|
|
3040
|
+
});
|
|
3041
|
+
if (!stateChange.watched) {
|
|
3042
|
+
this.internalUnregister(stateChange.oldContext, stateChange.index, void 0);
|
|
3043
|
+
this.internalSetState(stateChange.context, stateChange.index, stateChange.newValue, {
|
|
3044
|
+
context: stateChange.oldContext,
|
|
3045
|
+
value: stateChange.oldValue
|
|
3046
|
+
});
|
|
3047
|
+
continue;
|
|
3048
|
+
}
|
|
3049
|
+
const instanceGroupInfos = this._stateChangeSubscriptionManager.instanceGroupInfoEntriesForContext(stateChange.oldContext);
|
|
3050
|
+
const rebindingOptions = {
|
|
3051
|
+
context: stateChange.oldContext,
|
|
3052
|
+
value: stateChange.oldValue,
|
|
3053
|
+
shouldEmitChange
|
|
3054
|
+
};
|
|
3055
|
+
for (const { groupMemberId } of instanceGroupInfos) {
|
|
3056
|
+
const indexWatchRule = groupMemberId;
|
|
3057
|
+
this.internalUnregister(stateChange.oldContext, stateChange.index, indexWatchRule);
|
|
3058
|
+
if (indexWatchRule) {
|
|
3059
|
+
indexWatchRule.context = stateChange.context;
|
|
3060
|
+
}
|
|
3061
|
+
this.tryToSubscribeToChange(stateChange.context, stateChange.index, indexWatchRule, rebindingOptions);
|
|
3062
|
+
}
|
|
3063
|
+
}
|
|
3043
3064
|
}
|
|
3044
3065
|
setInitialValue(context, index, initialValue, transferedValue, watched) {
|
|
3045
3066
|
this.updateState(context, transferedValue?.context ?? context, index, initialValue, watched);
|
|
3046
|
-
|
|
3067
|
+
if (!transferedValue?.shouldEmitChange || transferedValue.shouldEmitChange(context, index)) {
|
|
3068
|
+
this.emitChange(context, index, initialValue, transferedValue?.value, transferedValue?.context);
|
|
3069
|
+
}
|
|
3047
3070
|
}
|
|
3048
3071
|
getChainChanges(chain) {
|
|
3049
3072
|
if (!chain) {
|
|
3050
3073
|
return [];
|
|
3051
3074
|
}
|
|
3052
|
-
const registeredChainParts = chain.filter((chainPart) => this._stateChangeSubscriptionManager.isRegistered(chainPart.
|
|
3075
|
+
const registeredChainParts = chain.filter((chainPart) => this._stateChangeSubscriptionManager.isRegistered(chainPart.context, chainPart.index));
|
|
3053
3076
|
return registeredChainParts.map((chainPart) => ({
|
|
3054
3077
|
...chainPart,
|
|
3055
|
-
oldValue: this.getOldValue(chainPart.
|
|
3056
|
-
value: this.getValue(chainPart.
|
|
3078
|
+
oldValue: this.getOldValue(chainPart.context, chainPart.index),
|
|
3079
|
+
value: this.getValue(chainPart.context, chainPart.index)
|
|
3057
3080
|
}));
|
|
3058
3081
|
}
|
|
3059
3082
|
getCurrentValue(context, id) {
|
|
@@ -3064,7 +3087,7 @@ var StateManager = class {
|
|
|
3064
3087
|
}
|
|
3065
3088
|
return this.getState(context, id);
|
|
3066
3089
|
}
|
|
3067
|
-
onChange(change,
|
|
3090
|
+
onChange(change, watched = false) {
|
|
3068
3091
|
const chainChanges = this.getChainChanges(change.chain);
|
|
3069
3092
|
if (chainChanges.length === 0) {
|
|
3070
3093
|
return;
|
|
@@ -3072,25 +3095,25 @@ var StateManager = class {
|
|
|
3072
3095
|
this._startChangeCycle.next();
|
|
3073
3096
|
try {
|
|
3074
3097
|
const chainLeaf = chainChanges[chainChanges.length - 1];
|
|
3075
|
-
const currentValue = this.getCurrentValue(chainLeaf.
|
|
3076
|
-
this.tryRebindingNestedState(change.newValue, currentValue
|
|
3077
|
-
this.updateState(chainLeaf.
|
|
3078
|
-
chainChanges.forEach((chainChange) => this.emitChange(chainChange.
|
|
3098
|
+
const currentValue = this.getCurrentValue(chainLeaf.context, chainLeaf.index);
|
|
3099
|
+
this.tryRebindingNestedState(change.newValue, currentValue);
|
|
3100
|
+
this.updateState(chainLeaf.context, chainLeaf.context, chainLeaf.index, chainLeaf.value, watched);
|
|
3101
|
+
chainChanges.forEach((chainChange) => this.emitChange(chainChange.context, chainChange.index, chainChange.value, chainChange.oldValue));
|
|
3079
3102
|
} finally {
|
|
3080
3103
|
this._endChangeCycle.next();
|
|
3081
3104
|
}
|
|
3082
3105
|
}
|
|
3083
3106
|
};
|
|
3084
|
-
StateManager =
|
|
3085
|
-
|
|
3107
|
+
StateManager = _ts_decorate25([
|
|
3108
|
+
Injectable25(),
|
|
3086
3109
|
_ts_param24(0, Inject23(RsXStateManagerInjectionTokens.IObjectPropertyObserverProxyPairManager)),
|
|
3087
3110
|
_ts_param24(1, Inject23(RsXStateManagerInjectionTokens.IObjectStateManager)),
|
|
3088
3111
|
_ts_param24(2, Inject23(RsXCoreInjectionTokens16.IErrorLog)),
|
|
3089
3112
|
_ts_param24(3, Inject23(RsXCoreInjectionTokens16.IGuidFactory)),
|
|
3090
3113
|
_ts_param24(4, Inject23(RsXCoreInjectionTokens16.IIndexValueAccessor)),
|
|
3091
3114
|
_ts_param24(5, Inject23(RsXCoreInjectionTokens16.IEqualityService)),
|
|
3092
|
-
|
|
3093
|
-
|
|
3115
|
+
_ts_metadata24("design:type", Function),
|
|
3116
|
+
_ts_metadata24("design:paramtypes", [
|
|
3094
3117
|
typeof IObjectPropertyObserverProxyPairManager === "undefined" ? Object : IObjectPropertyObserverProxyPairManager,
|
|
3095
3118
|
typeof IObjectStateManager === "undefined" ? Object : IObjectStateManager,
|
|
3096
3119
|
typeof IErrorLog === "undefined" ? Object : IErrorLog,
|
|
@@ -3162,7 +3185,6 @@ var RsXStateManagerModule = new ContainerModule((options) => {
|
|
|
3162
3185
|
options.bind(RsXStateManagerInjectionTokens.IObjectPropertyObserverManager).to(ObjectPropertyObserverManager).inSingletonScope();
|
|
3163
3186
|
options.bind(RsXStateManagerInjectionTokens.ICollectionItemObserverManager).to(CollectionItemObserverManager).inSingletonScope();
|
|
3164
3187
|
options.bind(RsXStateManagerInjectionTokens.IDatePropertyObserverManager).to(DatePropertyObserverManager).inSingletonScope();
|
|
3165
|
-
options.bind(RsXStateManagerInjectionTokens.IMustProxifyItemHandlerFactory).to(MustProxifyItemHandlerFactory).inSingletonScope();
|
|
3166
3188
|
options.bind(RsXStateManagerInjectionTokens.IObjectStateManager).to(ObjectStateManager).inTransientScope();
|
|
3167
3189
|
options.bind(RsXStateManagerInjectionTokens.IObjectObserverProxyPairFactoryProviderFactory).toFactory((context) => {
|
|
3168
3190
|
return () => context.get(RsXStateManagerInjectionTokens.IObjectObserverProxyPairFactoryProvider);
|
|
@@ -3188,10 +3210,10 @@ export {
|
|
|
3188
3210
|
GroupedChangeSubscriptionsForContextManager,
|
|
3189
3211
|
IndexChangeSubscriptionManager,
|
|
3190
3212
|
IndexObserverProxyPairFactory,
|
|
3213
|
+
IndexWatchRule,
|
|
3191
3214
|
MapObserverProxyPairFactory,
|
|
3192
3215
|
MapProxy,
|
|
3193
3216
|
MapProxyFactory,
|
|
3194
|
-
MustProxifyItemHandlerFactory,
|
|
3195
3217
|
NonIterableObjectPropertyObserverProxyPairFactory,
|
|
3196
3218
|
ObjectObserverProxyPairFactoryProvider,
|
|
3197
3219
|
ObjectObserverProxyPairManager,
|
|
@@ -3215,5 +3237,6 @@ export {
|
|
|
3215
3237
|
StateManager,
|
|
3216
3238
|
defaultObjectObserverProxyPairFactoryList,
|
|
3217
3239
|
defaultPropertyObserverProxyPairFactoryList,
|
|
3218
|
-
unloadRsXStateManagerModule
|
|
3240
|
+
unloadRsXStateManagerModule,
|
|
3241
|
+
watchIndexRecursiveRule
|
|
3219
3242
|
};
|