@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
|
@@ -1,71 +1,43 @@
|
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
this.addObjects(initObject, mapto_type);
|
|
45
|
-
}
|
|
46
|
-
}, {
|
|
47
|
-
key: "getObjects",
|
|
48
|
-
value: function getObjects() {
|
|
49
|
-
return this.objArray;
|
|
50
|
-
}
|
|
51
|
-
}], [{
|
|
52
|
-
key: "flattenWebObjects",
|
|
53
|
-
value: function flattenWebObjects(inputData) {
|
|
54
|
-
if (inputData instanceof ObjectArray) {
|
|
55
|
-
return ObjectArray.flattenWebObjects(inputData.objArray);
|
|
56
|
-
} else if (Array.isArray(inputData)) {
|
|
57
|
-
var final_result = [];
|
|
58
|
-
inputData.map(function (ind) {
|
|
59
|
-
ObjectArray.flattenWebObjects(ind).map(function (s) {
|
|
60
|
-
return final_result.push(s);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
return final_result;
|
|
64
|
-
} else return [inputData];
|
|
65
|
-
}
|
|
66
|
-
}]);
|
|
67
|
-
return ObjectArray;
|
|
68
|
-
}();
|
|
69
|
-
exports.ObjectArray = ObjectArray;
|
|
70
|
-
var _default = ObjectArray;
|
|
71
|
-
exports["default"] = _default;
|
|
1
|
+
export class ObjectArray {
|
|
2
|
+
/* -------------------------------------------------------------------------- */
|
|
3
|
+
/* Values */
|
|
4
|
+
/* -------------------------------------------------------------------------- */
|
|
5
|
+
objArray = [];
|
|
6
|
+
/* -------------------------------------------------------------------------- */
|
|
7
|
+
/* Base */
|
|
8
|
+
/* -------------------------------------------------------------------------- */
|
|
9
|
+
constructor(initObject, mapto_type) {
|
|
10
|
+
this.setObjects(initObject, mapto_type);
|
|
11
|
+
}
|
|
12
|
+
addObjects(initObject, mapto_type) {
|
|
13
|
+
if (initObject == null)
|
|
14
|
+
return false;
|
|
15
|
+
let resultObjects = ObjectArray.flattenWebObjects(initObject);
|
|
16
|
+
if (mapto_type)
|
|
17
|
+
resultObjects = resultObjects.map((r) => r instanceof mapto_type ? r : new mapto_type(r));
|
|
18
|
+
resultObjects.map((s) => this.objArray.push(s));
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
setObjects(initObject, mapto_type) {
|
|
22
|
+
this.objArray = [];
|
|
23
|
+
this.addObjects(initObject, mapto_type);
|
|
24
|
+
}
|
|
25
|
+
getObjects() {
|
|
26
|
+
return this.objArray;
|
|
27
|
+
}
|
|
28
|
+
static flattenWebObjects(inputData) {
|
|
29
|
+
if (inputData instanceof ObjectArray) {
|
|
30
|
+
return ObjectArray.flattenWebObjects(inputData.objArray);
|
|
31
|
+
}
|
|
32
|
+
else if (Array.isArray(inputData)) {
|
|
33
|
+
let final_result = [];
|
|
34
|
+
inputData.map((ind) => {
|
|
35
|
+
ObjectArray.flattenWebObjects(ind).map((s) => final_result.push(s));
|
|
36
|
+
});
|
|
37
|
+
return final_result;
|
|
38
|
+
}
|
|
39
|
+
else
|
|
40
|
+
return [inputData];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export default ObjectArray;
|
|
@@ -43,8 +43,8 @@ export declare class ObjectManager<ObjType extends SimpleObject> extends RawObje
|
|
|
43
43
|
getSaveResultType(): saveResultType | null;
|
|
44
44
|
setSaveResult(toObj: any, type: saveResultType): saveResultType | undefined;
|
|
45
45
|
apply_changes(): boolean;
|
|
46
|
-
getValue(key: PropOf<ObjType>, original?: boolean): import("
|
|
47
|
-
get: (key: PropOf<ObjType>, original?: boolean) => import("
|
|
46
|
+
getValue(key: PropOf<ObjType>, original?: boolean): import("@azrico/types").PropType<ObjType, any> | null;
|
|
47
|
+
get: (key: PropOf<ObjType>, original?: boolean) => import("@azrico/types").PropType<ObjType, any> | null;
|
|
48
48
|
/**
|
|
49
49
|
* set value
|
|
50
50
|
* @param key
|