dataflux 1.10.0 → 1.10.3
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/README.md +1 -1
- package/dist/BasicObj.js +2 -2
- package/dist/Model.js +5 -4
- package/dist/Obj.js +7 -3
- package/dist/ObserverStore.js +4 -0
- package/dist/dataflux.min.js +1 -1
- package/dist/dataflux.min.js.map +1 -1
- package/package.json +7 -8
package/README.md
CHANGED
|
@@ -234,7 +234,7 @@ The method `findAll` returns always an array. The method `findOne` returns a sin
|
|
|
234
234
|
|
|
235
235
|
When the component will unmount, the `findAll` subscription will be automatically terminated without the need to unsubscribe. Be aware, `store.findAll()` injects the unsubscribe call inside `componentWillUnmount()`. If your component already implements `componentWillUnmount()`, then you will have to use `store.subscribe()` and `store.unsubscribe()` instead of `store.findAll()`, to avoid side effects when the component is unmounted.
|
|
236
236
|
|
|
237
|
-
> Note: handleChange allows for type casting. E.g., store.handleChange(book, "pages",
|
|
237
|
+
> Note: handleChange allows for type casting. E.g., store.handleChange(book, "pages", parseInt)
|
|
238
238
|
|
|
239
239
|
In case you prefer React hooks:
|
|
240
240
|
|
package/dist/BasicObj.js
CHANGED
|
@@ -96,12 +96,12 @@ var BasicObj = /*#__PURE__*/function () {
|
|
|
96
96
|
});
|
|
97
97
|
|
|
98
98
|
_defineProperty(this, "setId", function (id) {
|
|
99
|
-
|
|
99
|
+
_this.id = id;
|
|
100
100
|
});
|
|
101
101
|
|
|
102
102
|
_defineProperty(this, "getId", function () {
|
|
103
103
|
if (!_classPrivateFieldGet(_this, _id)) {
|
|
104
|
-
if (_this.id && (typeof _this.id === "string" || typeof _this.id === "number")) {
|
|
104
|
+
if (_this.id != null && (typeof _this.id === "string" || typeof _this.id === "number")) {
|
|
105
105
|
_classPrivateFieldSet(_this, _id, _this.id.toString());
|
|
106
106
|
|
|
107
107
|
delete _this.setId;
|
package/dist/Model.js
CHANGED
|
@@ -434,10 +434,11 @@ var Model = /*#__PURE__*/_createClass(function Model(name) {
|
|
|
434
434
|
_classPrivateFieldInitSpec(this, _assignId, {
|
|
435
435
|
writable: true,
|
|
436
436
|
value: function value(data, objects) {
|
|
437
|
-
if (data
|
|
438
|
-
var
|
|
439
|
-
|
|
440
|
-
|
|
437
|
+
if (Array.isArray(data) && Array.isArray(objects) && objects.length === data.length) {
|
|
438
|
+
for (var i = 0; i < data.length; i++) {
|
|
439
|
+
objects[i].setId(data[i].id);
|
|
440
|
+
delete objects[i].setId;
|
|
441
|
+
}
|
|
441
442
|
}
|
|
442
443
|
}
|
|
443
444
|
});
|
package/dist/Obj.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
@@ -15,6 +13,8 @@ var _SubObj = _interopRequireDefault(require("./SubObj"));
|
|
|
15
13
|
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
15
|
|
|
16
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
17
|
+
|
|
18
18
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
19
19
|
|
|
20
20
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -77,7 +77,11 @@ var Obj = /*#__PURE__*/function (_BasicObj) {
|
|
|
77
77
|
_defineProperty(_assertThisInitialized(_this), "set", function (attribute, value, hidden) {
|
|
78
78
|
if (Array.isArray(value) && _this.getModel().options.deep) {
|
|
79
79
|
value = value.map(function (i) {
|
|
80
|
-
|
|
80
|
+
if (["boolean", "string", "number"].includes(_typeof(i))) {
|
|
81
|
+
return i;
|
|
82
|
+
} else {
|
|
83
|
+
return i !== null && i !== void 0 && i.getId ? i : new _SubObj["default"](_assertThisInitialized(_this), "property", i, _this.getModel());
|
|
84
|
+
}
|
|
81
85
|
});
|
|
82
86
|
}
|
|
83
87
|
|
package/dist/ObserverStore.js
CHANGED
|
@@ -367,6 +367,10 @@ var ObserverStore = /*#__PURE__*/function (_PersistentStore) {
|
|
|
367
367
|
_createClass(ObserverStore, [{
|
|
368
368
|
key: "update",
|
|
369
369
|
value: function update(objects, skipSave) {
|
|
370
|
+
if (!skipSave) {
|
|
371
|
+
_classPrivateFieldGet(this, _propagateChange).call(this, objects);
|
|
372
|
+
}
|
|
373
|
+
|
|
370
374
|
return _get(_getPrototypeOf(ObserverStore.prototype), "update", this).call(this, objects, skipSave).then(_classPrivateFieldGet(this, _propagateChange));
|
|
371
375
|
}
|
|
372
376
|
}, {
|