@azrico/webobject 1.4.128 → 1.4.129
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 +9 -9
- package/dist/index.js +1 -16
- package/dist/src/WebObjects/ParentWebObject.js +20 -51
- package/dist/src/WebObjects/WebObject.js +452 -1032
- package/dist/src/WebObjects/WebObjectManager.js +194 -509
- package/dist/src/index.js +9 -104
- package/dist/src/structs/DummyObject.js +8 -35
- package/dist/src/structs/MapableObject.js +76 -126
- package/dist/src/structs/MetaObject.js +35 -113
- package/dist/src/structs/ObjectArray.js +43 -71
- package/dist/src/structs/ObjectManager.d.ts +2 -2
- package/dist/src/structs/ObjectManager.js +252 -648
- package/dist/src/structs/ObjectWithTemp.js +25 -65
- package/dist/src/structs/SimpleObject.d.ts +3 -4
- package/dist/src/structs/SimpleObject.js +889 -1399
- package/package.json +4 -4
package/dist/src/index.js
CHANGED
|
@@ -1,104 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function get() {
|
|
13
|
-
return _SimpleObject[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
var _ObjectArray = require("./structs/ObjectArray");
|
|
18
|
-
Object.keys(_ObjectArray).forEach(function (key) {
|
|
19
|
-
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (key in exports && exports[key] === _ObjectArray[key]) return;
|
|
21
|
-
Object.defineProperty(exports, key, {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function get() {
|
|
24
|
-
return _ObjectArray[key];
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
var _MapableObject = require("./structs/MapableObject");
|
|
29
|
-
Object.keys(_MapableObject).forEach(function (key) {
|
|
30
|
-
if (key === "default" || key === "__esModule") return;
|
|
31
|
-
if (key in exports && exports[key] === _MapableObject[key]) return;
|
|
32
|
-
Object.defineProperty(exports, key, {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
get: function get() {
|
|
35
|
-
return _MapableObject[key];
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
var _MetaObject = require("./structs/MetaObject");
|
|
40
|
-
Object.keys(_MetaObject).forEach(function (key) {
|
|
41
|
-
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (key in exports && exports[key] === _MetaObject[key]) return;
|
|
43
|
-
Object.defineProperty(exports, key, {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function get() {
|
|
46
|
-
return _MetaObject[key];
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
var _DummyObject = require("./structs/DummyObject");
|
|
51
|
-
Object.keys(_DummyObject).forEach(function (key) {
|
|
52
|
-
if (key === "default" || key === "__esModule") return;
|
|
53
|
-
if (key in exports && exports[key] === _DummyObject[key]) return;
|
|
54
|
-
Object.defineProperty(exports, key, {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function get() {
|
|
57
|
-
return _DummyObject[key];
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
var _ObjectManager = require("./structs/ObjectManager");
|
|
62
|
-
Object.keys(_ObjectManager).forEach(function (key) {
|
|
63
|
-
if (key === "default" || key === "__esModule") return;
|
|
64
|
-
if (key in exports && exports[key] === _ObjectManager[key]) return;
|
|
65
|
-
Object.defineProperty(exports, key, {
|
|
66
|
-
enumerable: true,
|
|
67
|
-
get: function get() {
|
|
68
|
-
return _ObjectManager[key];
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
var _WebObjectManager = require("./WebObjects/WebObjectManager");
|
|
73
|
-
Object.keys(_WebObjectManager).forEach(function (key) {
|
|
74
|
-
if (key === "default" || key === "__esModule") return;
|
|
75
|
-
if (key in exports && exports[key] === _WebObjectManager[key]) return;
|
|
76
|
-
Object.defineProperty(exports, key, {
|
|
77
|
-
enumerable: true,
|
|
78
|
-
get: function get() {
|
|
79
|
-
return _WebObjectManager[key];
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
var _WebObject = require("./WebObjects/WebObject");
|
|
84
|
-
Object.keys(_WebObject).forEach(function (key) {
|
|
85
|
-
if (key === "default" || key === "__esModule") return;
|
|
86
|
-
if (key in exports && exports[key] === _WebObject[key]) return;
|
|
87
|
-
Object.defineProperty(exports, key, {
|
|
88
|
-
enumerable: true,
|
|
89
|
-
get: function get() {
|
|
90
|
-
return _WebObject[key];
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
var _ParentWebObject = require("./WebObjects/ParentWebObject");
|
|
95
|
-
Object.keys(_ParentWebObject).forEach(function (key) {
|
|
96
|
-
if (key === "default" || key === "__esModule") return;
|
|
97
|
-
if (key in exports && exports[key] === _ParentWebObject[key]) return;
|
|
98
|
-
Object.defineProperty(exports, key, {
|
|
99
|
-
enumerable: true,
|
|
100
|
-
get: function get() {
|
|
101
|
-
return _ParentWebObject[key];
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
});
|
|
1
|
+
export * from "./structs/SimpleObject";
|
|
2
|
+
export * from "./structs/ObjectArray";
|
|
3
|
+
export * from "./structs/MapableObject";
|
|
4
|
+
export * from "./structs/MetaObject";
|
|
5
|
+
export * from "./structs/DummyObject";
|
|
6
|
+
export * from "./structs/ObjectManager";
|
|
7
|
+
export * from "./WebObjects/WebObjectManager";
|
|
8
|
+
export * from "./WebObjects/WebObject";
|
|
9
|
+
export * from "./WebObjects/ParentWebObject";
|
|
@@ -1,35 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
10
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
11
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
12
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
14
|
-
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); }
|
|
15
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
16
|
-
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); }; }
|
|
17
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
18
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
19
|
-
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; } }
|
|
20
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
21
|
-
var DummyObject = /*#__PURE__*/function (_SimpleObject) {
|
|
22
|
-
_inherits(DummyObject, _SimpleObject);
|
|
23
|
-
var _super = _createSuper(DummyObject);
|
|
24
|
-
function DummyObject(initObject) {
|
|
25
|
-
var _this;
|
|
26
|
-
_classCallCheck(this, DummyObject);
|
|
27
|
-
_this = _super.call(this, false);
|
|
28
|
-
_this.loadValues(initObject, true);
|
|
29
|
-
return _this;
|
|
30
|
-
}
|
|
31
|
-
return _createClass(DummyObject);
|
|
32
|
-
}(_SimpleObject2.SimpleObject);
|
|
33
|
-
exports.DummyObject = DummyObject;
|
|
34
|
-
var _default = DummyObject;
|
|
35
|
-
exports["default"] = _default;
|
|
1
|
+
import { SimpleObject } from "./SimpleObject";
|
|
2
|
+
export class DummyObject extends SimpleObject {
|
|
3
|
+
constructor(initObject) {
|
|
4
|
+
super(false);
|
|
5
|
+
this.loadValues(initObject, true);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export default DummyObject;
|
|
@@ -1,128 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports["default"] = exports.MapableObject = void 0;
|
|
7
|
-
var _object = require("@azrico/object");
|
|
8
|
-
var _ObjectArray = _interopRequireDefault(require("./ObjectArray"));
|
|
9
|
-
var _string = require("@azrico/string");
|
|
10
|
-
var _uid = require("@azrico/uid");
|
|
11
|
-
var _ObjectWithTemp2 = _interopRequireDefault(require("./ObjectWithTemp"));
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
14
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
-
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, _toPropertyKey(descriptor.key), descriptor); } }
|
|
16
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
17
|
-
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); }
|
|
18
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
19
|
-
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); }; }
|
|
20
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
21
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
22
|
-
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; } }
|
|
23
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
26
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1
|
+
import { object_ensure, object_isEmpty } from "@azrico/object";
|
|
2
|
+
import ObjectArray from "./ObjectArray";
|
|
3
|
+
import { string_equals_ignorecase } from "@azrico/string";
|
|
4
|
+
import { uid } from "@azrico/uid";
|
|
5
|
+
import ObjectWithTemp from "./ObjectWithTemp";
|
|
27
6
|
/**
|
|
28
7
|
* This object can be mapped and converted
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return r;
|
|
101
|
-
})) !== null && _objectlist$map !== void 0 ? _objectlist$map : [];
|
|
102
|
-
}
|
|
103
|
-
}, {
|
|
104
|
-
key: "map_tableid",
|
|
105
|
-
value: function map_tableid(objectlist) {
|
|
106
|
-
var _objectlist$map2;
|
|
107
|
-
var index = 0;
|
|
108
|
-
return (_objectlist$map2 = objectlist === null || objectlist === void 0 ? void 0 : objectlist.map(function (r, i) {
|
|
109
|
-
var _r$__uid;
|
|
110
|
-
r.__table_id = (_r$__uid = r.__uid) !== null && _r$__uid !== void 0 ? _r$__uid : String(++index);
|
|
111
|
-
return r;
|
|
112
|
-
})) !== null && _objectlist$map2 !== void 0 ? _objectlist$map2 : [];
|
|
113
|
-
}
|
|
114
|
-
}, {
|
|
115
|
-
key: "equals",
|
|
116
|
-
value: function equals(a, b) {
|
|
117
|
-
console.warn("Dont use the default equals method !");
|
|
118
|
-
if (a == undefined || b == undefined) return false;
|
|
119
|
-
if (_typeof(a) === "object") a = a.__uid;
|
|
120
|
-
if (_typeof(b) === "object") b = b.__uid;
|
|
121
|
-
return (0, _string.string_equals_ignorecase)(a, b);
|
|
122
|
-
}
|
|
123
|
-
}]);
|
|
124
|
-
return MapableObject;
|
|
125
|
-
}(_ObjectWithTemp2["default"]);
|
|
126
|
-
exports.MapableObject = MapableObject;
|
|
127
|
-
var _default = MapableObject;
|
|
128
|
-
exports["default"] = _default;
|
|
8
|
+
*/
|
|
9
|
+
export class MapableObject extends ObjectWithTemp {
|
|
10
|
+
__uid;
|
|
11
|
+
__data_id;
|
|
12
|
+
__table_id;
|
|
13
|
+
__parent__table_id;
|
|
14
|
+
__row_number;
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
this.__uid = uid.localuid();
|
|
18
|
+
this.__table_id = this.__uid;
|
|
19
|
+
}
|
|
20
|
+
getUID() {
|
|
21
|
+
return MapableObject.getUID(this);
|
|
22
|
+
}
|
|
23
|
+
/* -------------------------------------------------------------------------- */
|
|
24
|
+
static getUID(o) {
|
|
25
|
+
return o.__uid;
|
|
26
|
+
}
|
|
27
|
+
static mapto(maptoType, objectlist, is_readonly = true, ...p) {
|
|
28
|
+
if (objectlist === undefined) {
|
|
29
|
+
if (maptoType === undefined)
|
|
30
|
+
return [];
|
|
31
|
+
if (maptoType instanceof Object)
|
|
32
|
+
return [];
|
|
33
|
+
objectlist = maptoType;
|
|
34
|
+
maptoType = this;
|
|
35
|
+
}
|
|
36
|
+
if (object_isEmpty(objectlist))
|
|
37
|
+
return [];
|
|
38
|
+
if (objectlist instanceof ObjectArray)
|
|
39
|
+
objectlist = objectlist.getObjects();
|
|
40
|
+
if (!Array.isArray(objectlist)) {
|
|
41
|
+
objectlist = [objectlist];
|
|
42
|
+
}
|
|
43
|
+
return objectlist.map((r) => this.ensure(maptoType, r, is_readonly, ...p));
|
|
44
|
+
}
|
|
45
|
+
static ensure(maptoType, object, is_readonly, ...p) {
|
|
46
|
+
if (object === undefined) {
|
|
47
|
+
object = maptoType;
|
|
48
|
+
maptoType = this;
|
|
49
|
+
}
|
|
50
|
+
return object_ensure(maptoType, object, is_readonly, ...p);
|
|
51
|
+
}
|
|
52
|
+
/* -------------------------------------------------------------------------- */
|
|
53
|
+
static map_rowindex(objectlist) {
|
|
54
|
+
let index = 0;
|
|
55
|
+
return (objectlist?.map((r, i) => {
|
|
56
|
+
r.__row_number = ++index;
|
|
57
|
+
return r;
|
|
58
|
+
}) ?? []);
|
|
59
|
+
}
|
|
60
|
+
static map_tableid(objectlist) {
|
|
61
|
+
let index = 0;
|
|
62
|
+
return (objectlist?.map((r, i) => {
|
|
63
|
+
r.__table_id = r.__uid ?? String(++index);
|
|
64
|
+
return r;
|
|
65
|
+
}) ?? []);
|
|
66
|
+
}
|
|
67
|
+
static equals(a, b) {
|
|
68
|
+
console.warn("Dont use the default equals method !");
|
|
69
|
+
if (a == undefined || b == undefined)
|
|
70
|
+
return false;
|
|
71
|
+
if (typeof a === "object")
|
|
72
|
+
a = a.__uid;
|
|
73
|
+
if (typeof b === "object")
|
|
74
|
+
b = b.__uid;
|
|
75
|
+
return string_equals_ignorecase(a, b);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export default MapableObject;
|
|
@@ -1,113 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
_defineProperty(_assertThisInitialized(_this), "value", void 0);
|
|
37
|
-
if (_typeof(initObject) === "object") {
|
|
38
|
-
_this.id = initObject.id;
|
|
39
|
-
_this.key = initObject.key;
|
|
40
|
-
_this.value = initObject.value;
|
|
41
|
-
} else if (typeof initObject === "string") {
|
|
42
|
-
_this.key = initObject;
|
|
43
|
-
_this.value = value;
|
|
44
|
-
}
|
|
45
|
-
_this.setOriginal();
|
|
46
|
-
return _this;
|
|
47
|
-
}
|
|
48
|
-
_createClass(MetaObject, [{
|
|
49
|
-
key: "get_saveObject",
|
|
50
|
-
value: function get_saveObject() {
|
|
51
|
-
return (_get_saveObject = _get_saveObject || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
52
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
53
|
-
while (1) switch (_context.prev = _context.next) {
|
|
54
|
-
case 0:
|
|
55
|
-
_context.next = 2;
|
|
56
|
-
return MetaObject.get_saveObject(this);
|
|
57
|
-
case 2:
|
|
58
|
-
return _context.abrupt("return", _context.sent);
|
|
59
|
-
case 3:
|
|
60
|
-
case "end":
|
|
61
|
-
return _context.stop();
|
|
62
|
-
}
|
|
63
|
-
}, _callee, this);
|
|
64
|
-
}))).apply(this, arguments);
|
|
65
|
-
}
|
|
66
|
-
}, {
|
|
67
|
-
key: "Prepare",
|
|
68
|
-
value: function Prepare() {
|
|
69
|
-
return (_Prepare = _Prepare || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
70
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
71
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
72
|
-
case 0:
|
|
73
|
-
this.key = String(this.key);
|
|
74
|
-
_context2.next = 3;
|
|
75
|
-
return Promise.resolve(true);
|
|
76
|
-
case 3:
|
|
77
|
-
return _context2.abrupt("return", _context2.sent);
|
|
78
|
-
case 4:
|
|
79
|
-
case "end":
|
|
80
|
-
return _context2.stop();
|
|
81
|
-
}
|
|
82
|
-
}, _callee2, this);
|
|
83
|
-
}))).apply(this, arguments);
|
|
84
|
-
}
|
|
85
|
-
}, {
|
|
86
|
-
key: "isNew",
|
|
87
|
-
get: function get() {
|
|
88
|
-
return this.id == null || Number(this.id) <= 0;
|
|
89
|
-
}
|
|
90
|
-
}, {
|
|
91
|
-
key: "isDeleted",
|
|
92
|
-
get: function get() {
|
|
93
|
-
return (0, _object.object_isExactlyEmpty)(this.value);
|
|
94
|
-
}
|
|
95
|
-
}], [{
|
|
96
|
-
key: "get_saveObject",
|
|
97
|
-
value: function get_saveObject(_x) {
|
|
98
|
-
return (_get_saveObject2 = _get_saveObject2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(obj) {
|
|
99
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
100
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
101
|
-
case 0:
|
|
102
|
-
case "end":
|
|
103
|
-
return _context3.stop();
|
|
104
|
-
}
|
|
105
|
-
}, _callee3);
|
|
106
|
-
}))).apply(this, arguments);
|
|
107
|
-
}
|
|
108
|
-
}]);
|
|
109
|
-
return MetaObject;
|
|
110
|
-
}(_SimpleObject2["default"]);
|
|
111
|
-
exports.MetaObject = MetaObject;
|
|
112
|
-
var _default = MetaObject;
|
|
113
|
-
exports["default"] = _default;
|
|
1
|
+
import { object_isExactlyEmpty } from "@azrico/object";
|
|
2
|
+
import SimpleObject from "./SimpleObject";
|
|
3
|
+
export class MetaObject extends SimpleObject {
|
|
4
|
+
id;
|
|
5
|
+
key = "";
|
|
6
|
+
value;
|
|
7
|
+
constructor(initObject, value) {
|
|
8
|
+
super(false);
|
|
9
|
+
if (typeof initObject === "object") {
|
|
10
|
+
this.id = initObject.id;
|
|
11
|
+
this.key = initObject.key;
|
|
12
|
+
this.value = initObject.value;
|
|
13
|
+
}
|
|
14
|
+
else if (typeof initObject === "string") {
|
|
15
|
+
this.key = initObject;
|
|
16
|
+
this.value = value;
|
|
17
|
+
}
|
|
18
|
+
this.setOriginal();
|
|
19
|
+
}
|
|
20
|
+
async get_saveObject() {
|
|
21
|
+
return await MetaObject.get_saveObject(this);
|
|
22
|
+
}
|
|
23
|
+
static async get_saveObject(obj) { }
|
|
24
|
+
async Prepare() {
|
|
25
|
+
this.key = String(this.key);
|
|
26
|
+
return await Promise.resolve(true);
|
|
27
|
+
}
|
|
28
|
+
get isNew() {
|
|
29
|
+
return this.id == null || Number(this.id) <= 0;
|
|
30
|
+
}
|
|
31
|
+
get isDeleted() {
|
|
32
|
+
return object_isExactlyEmpty(this.value);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export default MetaObject;
|