dataflux 1.9.4 → 1.10.1
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 +2 -0
- package/dist/BasicObj.js +121 -114
- package/dist/Obj.js +17 -3
- package/dist/ObserverStore.js +7 -3
- package/dist/PersistentStore.js +3 -3
- package/dist/ReactStore.js +5 -6
- package/dist/SubObj.js +11 -3
- package/dist/dataflux.min.js +1 -1
- package/dist/dataflux.min.js.map +1 -1
- package/package.json +13 -14
package/README.md
CHANGED
|
@@ -234,6 +234,8 @@ 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", parseInt)
|
|
238
|
+
|
|
237
239
|
In case you prefer React hooks:
|
|
238
240
|
|
|
239
241
|
```js
|
package/dist/BasicObj.js
CHANGED
|
@@ -12,12 +12,12 @@ var _uuid = require("uuid");
|
|
|
12
12
|
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
14
|
|
|
15
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
|
+
|
|
15
17
|
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); } }
|
|
16
18
|
|
|
17
19
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
18
20
|
|
|
19
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
20
|
-
|
|
21
21
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
22
22
|
|
|
23
23
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
|
@@ -69,137 +69,144 @@ var _error = /*#__PURE__*/new WeakMap();
|
|
|
69
69
|
|
|
70
70
|
var _model = /*#__PURE__*/new WeakMap();
|
|
71
71
|
|
|
72
|
-
var BasicObj = /*#__PURE__*/
|
|
73
|
-
|
|
72
|
+
var BasicObj = /*#__PURE__*/function () {
|
|
73
|
+
function BasicObj(values, model) {
|
|
74
|
+
var _this = this;
|
|
75
|
+
|
|
76
|
+
_classCallCheck(this, BasicObj);
|
|
77
|
+
|
|
78
|
+
_classPrivateFieldInitSpec(this, _setHidden, {
|
|
79
|
+
writable: true,
|
|
80
|
+
value: {}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
_classPrivateFieldInitSpec(this, _id, {
|
|
84
|
+
writable: true,
|
|
85
|
+
value: null
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
_classPrivateFieldInitSpec(this, _error, {
|
|
89
|
+
writable: true,
|
|
90
|
+
value: {}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
_classPrivateFieldInitSpec(this, _model, {
|
|
94
|
+
writable: true,
|
|
95
|
+
value: void 0
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
_defineProperty(this, "setId", function (id) {
|
|
99
|
+
_classPrivateFieldSet(_this, _id, id);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
_defineProperty(this, "getId", function () {
|
|
103
|
+
if (!_classPrivateFieldGet(_this, _id)) {
|
|
104
|
+
if (_this.id && (typeof _this.id === "string" || typeof _this.id === "number")) {
|
|
105
|
+
_classPrivateFieldSet(_this, _id, _this.id.toString());
|
|
106
|
+
|
|
107
|
+
delete _this.setId;
|
|
108
|
+
} else {
|
|
109
|
+
_classPrivateFieldSet(_this, _id, (0, _uuid.v4)());
|
|
110
|
+
}
|
|
111
|
+
}
|
|
74
112
|
|
|
75
|
-
|
|
113
|
+
return _classPrivateFieldGet(_this, _id);
|
|
114
|
+
});
|
|
76
115
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
value: {}
|
|
80
|
-
});
|
|
116
|
+
_defineProperty(this, "get", function (attribute, defaultValue) {
|
|
117
|
+
var _ref, _classPrivateFieldGet2;
|
|
81
118
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
value: null
|
|
85
|
-
});
|
|
119
|
+
return (_ref = (_classPrivateFieldGet2 = _classPrivateFieldGet(_this, _setHidden)[attribute]) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : _this[attribute]) !== null && _ref !== void 0 ? _ref : defaultValue;
|
|
120
|
+
});
|
|
86
121
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
value: {}
|
|
90
|
-
});
|
|
122
|
+
_defineProperty(this, "getError", function () {
|
|
123
|
+
var _classPrivateFieldGet3;
|
|
91
124
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
125
|
+
var attribute = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
126
|
+
var key = attribute ? attribute : globalError;
|
|
127
|
+
return (_classPrivateFieldGet3 = _classPrivateFieldGet(_this, _error)[key]) !== null && _classPrivateFieldGet3 !== void 0 ? _classPrivateFieldGet3 : false;
|
|
128
|
+
});
|
|
96
129
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
});
|
|
130
|
+
_defineProperty(this, "setError", function (error) {
|
|
131
|
+
var attribute = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
100
132
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
delete _this
|
|
133
|
+
if (error && attribute) {
|
|
134
|
+
_classPrivateFieldGet(_this, _error)[attribute] = error;
|
|
135
|
+
} else if (error && !attribute) {
|
|
136
|
+
_classPrivateFieldGet(_this, _error)[globalError] = error;
|
|
137
|
+
} else if (!error && attribute) {
|
|
138
|
+
delete _classPrivateFieldGet(_this, _error)[attribute];
|
|
107
139
|
} else {
|
|
108
|
-
_classPrivateFieldSet(_this,
|
|
140
|
+
_classPrivateFieldSet(_this, _error, {});
|
|
109
141
|
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
_defineProperty(this, "setConstant", function (attribute, value) {
|
|
145
|
+
var _classPrivateFieldGet4;
|
|
146
|
+
|
|
147
|
+
_classPrivateFieldGet(_this, _setHidden)[attribute] = (_classPrivateFieldGet4 = _classPrivateFieldGet(_this, _setHidden)[attribute]) !== null && _classPrivateFieldGet4 !== void 0 ? _classPrivateFieldGet4 : value;
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
_defineProperty(this, "toJSON", function () {
|
|
151
|
+
var attrs = Object.keys(_this);
|
|
152
|
+
var out = {};
|
|
153
|
+
|
|
154
|
+
for (var _i = 0, _attrs = attrs; _i < _attrs.length; _i++) {
|
|
155
|
+
var a = _attrs[_i];
|
|
156
|
+
|
|
157
|
+
if (_this[a] == null) {
|
|
158
|
+
out[a] = _this[a];
|
|
159
|
+
} else if (_this[a] instanceof _moment["default"]) {
|
|
160
|
+
out[a] = _this[a].toISOString();
|
|
161
|
+
} else if (_this[a] instanceof Date) {
|
|
162
|
+
out[a] = (0, _moment["default"])(_this[a]).toISOString();
|
|
163
|
+
} else if (_typeof(_this[a]) === "object" && _this[a].toJSON) {
|
|
164
|
+
out[a] = _this[a].toJSON();
|
|
165
|
+
} else if (Array.isArray(_this[a]) && _this[a].every(function (i) {
|
|
166
|
+
return _typeof(i) === "object" && i.toJSON;
|
|
167
|
+
})) {
|
|
168
|
+
out[a] = _this[a].map(function (i) {
|
|
169
|
+
return i.toJSON();
|
|
170
|
+
});
|
|
171
|
+
} else if (typeof _this[a] !== "function") {
|
|
172
|
+
out[a] = _this[a];
|
|
173
|
+
}
|
|
127
174
|
}
|
|
128
175
|
|
|
129
|
-
|
|
176
|
+
return out;
|
|
177
|
+
});
|
|
130
178
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return _this.update();
|
|
135
|
-
});
|
|
179
|
+
_defineProperty(this, "toString", function () {
|
|
180
|
+
return JSON.stringify(_this.toJSON());
|
|
181
|
+
});
|
|
136
182
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
var attribute = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
141
|
-
var key = attribute ? attribute : globalError;
|
|
142
|
-
return (_classPrivateFieldGet3 = _classPrivateFieldGet(_this, _error)[key]) !== null && _classPrivateFieldGet3 !== void 0 ? _classPrivateFieldGet3 : false;
|
|
143
|
-
});
|
|
183
|
+
_defineProperty(this, "update", function () {
|
|
184
|
+
return Promise.resolve();
|
|
185
|
+
});
|
|
144
186
|
|
|
145
|
-
|
|
146
|
-
|
|
187
|
+
_classPrivateFieldSet(this, _model, model);
|
|
188
|
+
}
|
|
147
189
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
});
|
|
190
|
+
_createClass(BasicObj, [{
|
|
191
|
+
key: "set",
|
|
192
|
+
value: function set(attribute, value, hidden) {
|
|
193
|
+
if (hidden) {
|
|
194
|
+
_classPrivateFieldGet(this, _setHidden)[attribute] = value;
|
|
195
|
+
} else {
|
|
196
|
+
if (attribute === "id") {
|
|
197
|
+
throw new Error("You cannot change the ID");
|
|
198
|
+
}
|
|
158
199
|
|
|
159
|
-
|
|
160
|
-
var _classPrivateFieldGet4;
|
|
200
|
+
this[attribute] = value;
|
|
161
201
|
|
|
162
|
-
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
_defineProperty(this, "toJSON", function () {
|
|
166
|
-
var attrs = Object.keys(_this);
|
|
167
|
-
var out = {};
|
|
168
|
-
|
|
169
|
-
for (var _i = 0, _attrs = attrs; _i < _attrs.length; _i++) {
|
|
170
|
-
var a = _attrs[_i];
|
|
171
|
-
|
|
172
|
-
if (_this[a] == null) {
|
|
173
|
-
out[a] = _this[a];
|
|
174
|
-
} else if (_this[a] instanceof _moment["default"]) {
|
|
175
|
-
out[a] = _this[a].toISOString();
|
|
176
|
-
} else if (_this[a] instanceof Date) {
|
|
177
|
-
out[a] = (0, _moment["default"])(_this[a]).toISOString();
|
|
178
|
-
} else if (_typeof(_this[a]) === "object" && _this[a].toJSON) {
|
|
179
|
-
out[a] = _this[a].toJSON();
|
|
180
|
-
} else if (Array.isArray(_this[a]) && _this[a].every(function (i) {
|
|
181
|
-
return _typeof(i) === "object" && i.toJSON;
|
|
182
|
-
})) {
|
|
183
|
-
out[a] = _this[a].map(function (i) {
|
|
184
|
-
return i.toJSON();
|
|
185
|
-
});
|
|
186
|
-
} else if (typeof _this[a] !== "function") {
|
|
187
|
-
out[a] = _this[a];
|
|
202
|
+
_classPrivateFieldGet(this, _model).validateObjectAttribute(this, attribute);
|
|
188
203
|
}
|
|
189
|
-
}
|
|
190
204
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
_defineProperty(this, "toString", function () {
|
|
195
|
-
return JSON.stringify(_this.toJSON());
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
_defineProperty(this, "update", function () {
|
|
199
|
-
return Promise.resolve();
|
|
200
|
-
});
|
|
205
|
+
return this.update();
|
|
206
|
+
}
|
|
207
|
+
}]);
|
|
201
208
|
|
|
202
|
-
|
|
203
|
-
});
|
|
209
|
+
return BasicObj;
|
|
210
|
+
}();
|
|
204
211
|
|
|
205
212
|
exports.BasicObj = BasicObj;
|
package/dist/Obj.js
CHANGED
|
@@ -23,7 +23,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
23
23
|
|
|
24
24
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
25
25
|
|
|
26
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
26
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
27
27
|
|
|
28
28
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
29
29
|
|
|
@@ -33,7 +33,11 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
33
33
|
|
|
34
34
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
35
35
|
|
|
36
|
-
function
|
|
36
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
37
|
+
|
|
38
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
39
|
+
|
|
40
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
37
41
|
|
|
38
42
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
39
43
|
|
|
@@ -59,7 +63,7 @@ var Obj = /*#__PURE__*/function (_BasicObj) {
|
|
|
59
63
|
var _super = _createSuper(Obj);
|
|
60
64
|
|
|
61
65
|
function Obj(values, _model) {
|
|
62
|
-
var _this;
|
|
66
|
+
var _thisSuper, _this;
|
|
63
67
|
|
|
64
68
|
_classCallCheck(this, Obj);
|
|
65
69
|
|
|
@@ -70,6 +74,16 @@ var Obj = /*#__PURE__*/function (_BasicObj) {
|
|
|
70
74
|
value: false
|
|
71
75
|
});
|
|
72
76
|
|
|
77
|
+
_defineProperty(_assertThisInitialized(_this), "set", function (attribute, value, hidden) {
|
|
78
|
+
if (Array.isArray(value) && _this.getModel().options.deep) {
|
|
79
|
+
value = value.map(function (i) {
|
|
80
|
+
return i !== null && i !== void 0 && i.getId ? i : new _SubObj["default"](_assertThisInitialized(_this), "property", i, _this.getModel());
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return _get((_thisSuper = _assertThisInitialized(_this), _getPrototypeOf(Obj.prototype)), "set", _thisSuper).call(_thisSuper, attribute, value, hidden);
|
|
85
|
+
});
|
|
86
|
+
|
|
73
87
|
_defineProperty(_assertThisInitialized(_this), "load", function () {
|
|
74
88
|
if (_classPrivateFieldGet(_assertThisInitialized(_this), _loaded)) {
|
|
75
89
|
return Promise.resolve(_assertThisInitialized(_this));
|
package/dist/ObserverStore.js
CHANGED
|
@@ -35,13 +35,13 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
35
35
|
|
|
36
36
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
37
37
|
|
|
38
|
-
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
38
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
39
39
|
|
|
40
40
|
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
41
41
|
|
|
42
42
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
43
43
|
|
|
44
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
44
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
45
45
|
|
|
46
46
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
47
47
|
|
|
@@ -51,7 +51,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
51
51
|
|
|
52
52
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
53
53
|
|
|
54
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
54
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
55
55
|
|
|
56
56
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
|
57
57
|
|
|
@@ -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
|
}, {
|
package/dist/PersistentStore.js
CHANGED
|
@@ -23,13 +23,13 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
|
23
23
|
|
|
24
24
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
25
25
|
|
|
26
|
-
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
26
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
27
27
|
|
|
28
28
|
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
29
29
|
|
|
30
30
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
31
31
|
|
|
32
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
32
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
33
33
|
|
|
34
34
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
35
35
|
|
|
@@ -39,7 +39,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
39
39
|
|
|
40
40
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
41
41
|
|
|
42
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
42
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
43
43
|
|
|
44
44
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
45
45
|
|
package/dist/ReactStore.js
CHANGED
|
@@ -29,7 +29,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
29
29
|
|
|
30
30
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
31
31
|
|
|
32
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
32
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
33
33
|
|
|
34
34
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
35
35
|
|
|
@@ -39,7 +39,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
39
39
|
|
|
40
40
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
41
41
|
|
|
42
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
42
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
43
43
|
|
|
44
44
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
45
45
|
|
|
@@ -108,12 +108,11 @@ var ReactStore = /*#__PURE__*/function (_ObserverStore) {
|
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
|
|
111
|
-
_defineProperty(_assertThisInitialized(_this), "handleChange", function (object, name) {
|
|
111
|
+
_defineProperty(_assertThisInitialized(_this), "handleChange", function (object, name, cast) {
|
|
112
112
|
return function (event, rawValue) {
|
|
113
|
-
var _ref;
|
|
114
|
-
|
|
115
113
|
var value = event ? event.target.type === "checkbox" ? event.target.checked : event.target.value : "";
|
|
116
|
-
|
|
114
|
+
var finalValue = value !== null && value !== void 0 ? value : rawValue;
|
|
115
|
+
object.set(name, cast && finalValue != null ? cast(finalValue) : finalValue);
|
|
117
116
|
};
|
|
118
117
|
});
|
|
119
118
|
|
package/dist/SubObj.js
CHANGED
|
@@ -17,7 +17,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
17
17
|
|
|
18
18
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
19
19
|
|
|
20
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
20
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21
21
|
|
|
22
22
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
23
23
|
|
|
@@ -27,7 +27,11 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
27
27
|
|
|
28
28
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
29
29
|
|
|
30
|
-
function
|
|
30
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
31
|
+
|
|
32
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
33
|
+
|
|
34
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
31
35
|
|
|
32
36
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
33
37
|
|
|
@@ -57,7 +61,7 @@ var SubObj = /*#__PURE__*/function (_BasicObj) {
|
|
|
57
61
|
var _super = _createSuper(SubObj);
|
|
58
62
|
|
|
59
63
|
function SubObj(parent, field, values, model) {
|
|
60
|
-
var _this;
|
|
64
|
+
var _thisSuper, _this;
|
|
61
65
|
|
|
62
66
|
_classCallCheck(this, SubObj);
|
|
63
67
|
|
|
@@ -78,6 +82,10 @@ var SubObj = /*#__PURE__*/function (_BasicObj) {
|
|
|
78
82
|
value: void 0
|
|
79
83
|
});
|
|
80
84
|
|
|
85
|
+
_defineProperty(_assertThisInitialized(_this), "set", function (attribute, value, hidden) {
|
|
86
|
+
return _get((_thisSuper = _assertThisInitialized(_this), _getPrototypeOf(SubObj.prototype)), "set", _thisSuper).call(_thisSuper, attribute, value, hidden);
|
|
87
|
+
});
|
|
88
|
+
|
|
81
89
|
_defineProperty(_assertThisInitialized(_this), "save", function () {
|
|
82
90
|
return _classPrivateFieldGet(_assertThisInitialized(_this), _model).getStore().save([_classPrivateFieldGet(_assertThisInitialized(_this), _parent)]);
|
|
83
91
|
});
|