native-document 1.0.48 → 1.0.50
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/native-document.dev.js +13 -7
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.devtools.min.js +1 -1
- package/dist/native-document.min.js +1 -1
- package/index.d.ts +2 -0
- package/package.json +1 -1
- package/src/data/Observable.js +3 -0
- package/src/data/ObservableArray.js +2 -1
|
@@ -1183,6 +1183,9 @@ var NativeDocument = (function (exports) {
|
|
|
1183
1183
|
return new ObservableItem(value);
|
|
1184
1184
|
}
|
|
1185
1185
|
|
|
1186
|
+
const $ = Observable;
|
|
1187
|
+
const obs = Observable;
|
|
1188
|
+
|
|
1186
1189
|
/**
|
|
1187
1190
|
*
|
|
1188
1191
|
* @param {string} propertyName
|
|
@@ -2145,10 +2148,11 @@ var NativeDocument = (function (exports) {
|
|
|
2145
2148
|
throw new NativeDocumentError('Observable.array : target must be an array');
|
|
2146
2149
|
}
|
|
2147
2150
|
|
|
2148
|
-
ObservableItem.
|
|
2151
|
+
ObservableItem.call(this, target);
|
|
2149
2152
|
PluginsManager.emit('CreateObservableArray', this);
|
|
2150
2153
|
};
|
|
2151
2154
|
|
|
2155
|
+
ObservableArray.prototype = Object.create(ObservableItem.prototype);
|
|
2152
2156
|
ObservableArray.prototype.__$isObservableArray = true;
|
|
2153
2157
|
|
|
2154
2158
|
mutationMethods.forEach((method) => {
|
|
@@ -3008,7 +3012,7 @@ var NativeDocument = (function (exports) {
|
|
|
3008
3012
|
* @param {{comment?: string|null, shouldKeepInCache?: Boolean}} configs
|
|
3009
3013
|
* @returns {DocumentFragment}
|
|
3010
3014
|
*/
|
|
3011
|
-
const ShowIf
|
|
3015
|
+
const ShowIf = function(condition, child, { comment = null, shouldKeepInCache = true} = {}) {
|
|
3012
3016
|
if(!(Validator.isObservable(condition)) && !Validator.isObservableWhenResult(condition)) {
|
|
3013
3017
|
return DebugManager.warn('ShowIf', "ShowIf : condition must be an Observable / "+comment, condition);
|
|
3014
3018
|
}
|
|
@@ -3053,7 +3057,7 @@ var NativeDocument = (function (exports) {
|
|
|
3053
3057
|
const hideCondition = Observable(!condition.val());
|
|
3054
3058
|
condition.subscribe(value => hideCondition.set(!value));
|
|
3055
3059
|
|
|
3056
|
-
return ShowIf
|
|
3060
|
+
return ShowIf(hideCondition, child, configs);
|
|
3057
3061
|
};
|
|
3058
3062
|
|
|
3059
3063
|
/**
|
|
@@ -3065,7 +3069,7 @@ var NativeDocument = (function (exports) {
|
|
|
3065
3069
|
* @returns {DocumentFragment}
|
|
3066
3070
|
*/
|
|
3067
3071
|
const HideIfNot = function(condition, child, configs) {
|
|
3068
|
-
return ShowIf
|
|
3072
|
+
return ShowIf(condition, child, configs);
|
|
3069
3073
|
};
|
|
3070
3074
|
|
|
3071
3075
|
const ShowWhen = function() {
|
|
@@ -3077,7 +3081,7 @@ var NativeDocument = (function (exports) {
|
|
|
3077
3081
|
'help': 'Use observer.when(target) to create an ObservableWhenResult'
|
|
3078
3082
|
});
|
|
3079
3083
|
}
|
|
3080
|
-
return ShowIf
|
|
3084
|
+
return ShowIf(observer, target);
|
|
3081
3085
|
}
|
|
3082
3086
|
if(arguments.length === 3) {
|
|
3083
3087
|
const [observer, target, view] = arguments;
|
|
@@ -3086,7 +3090,7 @@ var NativeDocument = (function (exports) {
|
|
|
3086
3090
|
data: observer,
|
|
3087
3091
|
});
|
|
3088
3092
|
}
|
|
3089
|
-
return ShowIf
|
|
3093
|
+
return ShowIf(observer.when(target), view);
|
|
3090
3094
|
}
|
|
3091
3095
|
throw new NativeDocumentError('showWhen must have 2 or 3 arguments', {
|
|
3092
3096
|
data: [
|
|
@@ -3478,7 +3482,7 @@ var NativeDocument = (function (exports) {
|
|
|
3478
3482
|
SearchInput: SearchInput,
|
|
3479
3483
|
Section: Section,
|
|
3480
3484
|
Select: Select,
|
|
3481
|
-
ShowIf: ShowIf
|
|
3485
|
+
ShowIf: ShowIf,
|
|
3482
3486
|
ShowWhen: ShowWhen,
|
|
3483
3487
|
SimpleButton: SimpleButton,
|
|
3484
3488
|
Small: Small,
|
|
@@ -4219,6 +4223,7 @@ var NativeDocument = (function (exports) {
|
|
|
4219
4223
|
Router: Router
|
|
4220
4224
|
});
|
|
4221
4225
|
|
|
4226
|
+
exports.$ = $;
|
|
4222
4227
|
exports.ElementCreator = ElementCreator;
|
|
4223
4228
|
exports.HtmlElementWrapper = HtmlElementWrapper;
|
|
4224
4229
|
exports.NDElement = NDElement;
|
|
@@ -4237,6 +4242,7 @@ var NativeDocument = (function (exports) {
|
|
|
4237
4242
|
exports.elements = elements;
|
|
4238
4243
|
exports.memoize = memoize;
|
|
4239
4244
|
exports.normalizeComponentArgs = normalizeComponentArgs;
|
|
4245
|
+
exports.obs = obs;
|
|
4240
4246
|
exports.once = once;
|
|
4241
4247
|
exports.router = router;
|
|
4242
4248
|
exports.useCache = useCache;
|