native-document 1.0.46 → 1.0.47
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/package.json
CHANGED
|
@@ -54,7 +54,7 @@ Observable.init = function(initialValue, { propagation= false, deep = true } = {
|
|
|
54
54
|
const itemValue = initialValue[key];
|
|
55
55
|
if(Array.isArray(itemValue)) {
|
|
56
56
|
if(deep) {
|
|
57
|
-
|
|
57
|
+
const mappedItemValue = itemValue.map(item => {
|
|
58
58
|
if(Validator.isJson(item)) {
|
|
59
59
|
return Observable.json(item, { propagation, deep });
|
|
60
60
|
}
|
|
@@ -63,6 +63,7 @@ Observable.init = function(initialValue, { propagation= false, deep = true } = {
|
|
|
63
63
|
}
|
|
64
64
|
return Observable(item);
|
|
65
65
|
});
|
|
66
|
+
data[key] = Observable.array(mappedItemValue, { propagation });
|
|
66
67
|
continue;
|
|
67
68
|
}
|
|
68
69
|
data[key] = Observable.array(itemValue, { propagation });
|
|
@@ -108,6 +109,9 @@ Observable.init = function(initialValue, { propagation= false, deep = true } = {
|
|
|
108
109
|
if(property === '$get') {
|
|
109
110
|
return $get;
|
|
110
111
|
}
|
|
112
|
+
if(property === '$val') {
|
|
113
|
+
return $val;
|
|
114
|
+
}
|
|
111
115
|
if(target[property] !== undefined) {
|
|
112
116
|
return target[property];
|
|
113
117
|
}
|
package/types/observable.d.ts
CHANGED
|
@@ -73,8 +73,10 @@ export interface ObservableArray<T> extends ObservableItem<T[]> {
|
|
|
73
73
|
export type ObservableProxy<T extends Record<string, any>> = {
|
|
74
74
|
readonly __isProxy__: true;
|
|
75
75
|
readonly $value: T;
|
|
76
|
+
$val(): T;
|
|
76
77
|
$clone(): ObservableProxy<T>;
|
|
77
78
|
$updateWith(values: Partial<T>): void;
|
|
79
|
+
$set(values: Partial<T>): void;
|
|
78
80
|
} & {
|
|
79
81
|
[K in keyof T]: T[K] extends (infer U)[]
|
|
80
82
|
? ObservableArray<U>
|