@azrico/webobject 1.3.4 → 1.3.6
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 +52 -52
- package/dist/index.d.ts +1 -0
- package/dist/index.js +16 -0
- package/dist/src/WebObjects/ParentWebObject.d.ts +10 -0
- package/dist/src/WebObjects/ParentWebObject.js +53 -0
- package/dist/src/WebObjects/WebObject.d.ts +86 -0
- package/dist/src/WebObjects/WebObject.js +630 -0
- package/dist/src/WebObjects/WebObjectManager.d.ts +48 -0
- package/dist/src/WebObjects/WebObjectManager.js +340 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.js +104 -0
- package/dist/src/structs/DummyObject.d.ts +5 -0
- package/dist/src/structs/DummyObject.js +35 -0
- package/dist/src/structs/MapableObject.d.ts +43 -0
- package/dist/src/structs/MapableObject.js +115 -0
- package/dist/src/structs/MetaObject.d.ts +15 -0
- package/dist/src/structs/MetaObject.js +125 -0
- package/dist/src/structs/ObjectArray.d.ts +10 -0
- package/dist/src/structs/ObjectArray.js +72 -0
- package/dist/src/structs/ObjectManager.d.ts +90 -0
- package/dist/src/structs/ObjectManager.js +560 -0
- package/dist/src/structs/SimpleObject.d.ts +121 -0
- package/dist/src/structs/SimpleObject.js +874 -0
- package/package.json +1 -1
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { MapableObject } from "./MapableObject";
|
|
2
|
+
import ObjectManager from "./ObjectManager";
|
|
3
|
+
export type saveResultType = "normal" | "nothing" | "error" | "canceled";
|
|
4
|
+
export type saveType = "normal" | "quick";
|
|
5
|
+
export type sendChangesType = boolean | "auto";
|
|
6
|
+
export type PropOf<obj> = keyof obj;
|
|
7
|
+
export type WriteablePropOf<obj> = keyof obj;
|
|
8
|
+
export type PropType<obj, prop extends keyof obj> = obj[prop];
|
|
9
|
+
export declare class SimpleObject extends MapableObject {
|
|
10
|
+
#private;
|
|
11
|
+
static readonly __cache_name?: string;
|
|
12
|
+
static readonly __unchangeables?: string[];
|
|
13
|
+
static readonly __changeables?: string[];
|
|
14
|
+
static readonly __extraProperties?: string[];
|
|
15
|
+
static readonly __use_delta: boolean;
|
|
16
|
+
_static(): Function;
|
|
17
|
+
__originalobject?: this;
|
|
18
|
+
__delta: Partial<this>;
|
|
19
|
+
__temp: any;
|
|
20
|
+
__changed: boolean;
|
|
21
|
+
__lastChanged: string;
|
|
22
|
+
__is_readonly: boolean;
|
|
23
|
+
__throw_errors: boolean;
|
|
24
|
+
__errors?: any[];
|
|
25
|
+
__showErrors?: boolean;
|
|
26
|
+
__saveResultObject?: any;
|
|
27
|
+
__saveResultIsSuccess: boolean;
|
|
28
|
+
__saveResultType?: saveResultType;
|
|
29
|
+
_index_key: string;
|
|
30
|
+
_index_value: number;
|
|
31
|
+
constructor(is_readonly?: boolean);
|
|
32
|
+
loadValues(initObject: any, fullUpdate?: boolean): boolean;
|
|
33
|
+
static loadValues(obj: SimpleObject, initObject: any, fullUpdate?: boolean): boolean;
|
|
34
|
+
static getValue<T extends SimpleObject, MKey extends PropOf<T>>(o: T, key: MKey, original?: boolean): PropType<T, MKey> | undefined;
|
|
35
|
+
getValue: <MKey extends keyof this>(key: MKey, original?: boolean) => PropType<this, MKey>;
|
|
36
|
+
get: <MKey extends keyof this>(key: MKey, original?: boolean) => PropType<this, MKey>;
|
|
37
|
+
getTemp: (key: string) => any;
|
|
38
|
+
/**
|
|
39
|
+
* set value
|
|
40
|
+
* @param key
|
|
41
|
+
* @param value
|
|
42
|
+
* @return true if changed , false otherwise
|
|
43
|
+
*/
|
|
44
|
+
setValue(key: WriteablePropOf<this>, value: any, sendChanges?: sendChangesType): Promise<boolean>;
|
|
45
|
+
set: (key: WriteablePropOf<this>, value: any, sendChanges?: sendChangesType) => Promise<boolean>;
|
|
46
|
+
setTemp: (key: string, value: any) => any;
|
|
47
|
+
setDefaultValue(key: WriteablePropOf<this>, value: any): boolean;
|
|
48
|
+
setDefault: (key: WriteablePropOf<this>, value: any) => boolean;
|
|
49
|
+
/**
|
|
50
|
+
* set key of subObject
|
|
51
|
+
* @param key
|
|
52
|
+
* @param value
|
|
53
|
+
* @param subvalue
|
|
54
|
+
* @return true if changed , false otherwise
|
|
55
|
+
*/
|
|
56
|
+
setSubValue(key: PropOf<this>, objKey: string, subvalue: any, sendChanges?: sendChangesType): Promise<boolean>;
|
|
57
|
+
pushValue<MKey extends PropOf<this>>(key: MKey, value: any, sendChanges?: sendChangesType): Promise<this[MKey] | false>;
|
|
58
|
+
notifyChanged(type: string, key: string, value: any, subvalue?: any): Promise<void>;
|
|
59
|
+
static canChangeKey(object: SimpleObject, key: string, useExtraProps: boolean): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Apply the changes and empty the delta object
|
|
62
|
+
*/
|
|
63
|
+
apply_changes(): boolean;
|
|
64
|
+
clear_changes(): boolean;
|
|
65
|
+
clear_cache(): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Sets readonly property on given objects
|
|
68
|
+
* @param objs array of given objects or a single object
|
|
69
|
+
* @param readonlyval readonly
|
|
70
|
+
* @param clearChanges should we clean the changes after setting readonly
|
|
71
|
+
*/
|
|
72
|
+
static setReadonly(objs?: SimpleObject[] | SimpleObject, readonlyval?: boolean, clearChanges?: boolean): void;
|
|
73
|
+
static setThrowErrors(objs?: SimpleObject[] | SimpleObject, throwErr?: boolean): void;
|
|
74
|
+
get isChanged(): boolean;
|
|
75
|
+
get isDeleted(): boolean;
|
|
76
|
+
get d(): Partial<this>;
|
|
77
|
+
get allproperties(): this & Partial<this>;
|
|
78
|
+
get canModify(): boolean;
|
|
79
|
+
get __cache_name(): string;
|
|
80
|
+
get __changeables(): string[];
|
|
81
|
+
get __unchangeables(): string[];
|
|
82
|
+
get __use_delta(): boolean;
|
|
83
|
+
get isSaved(): boolean;
|
|
84
|
+
get isNew(): boolean;
|
|
85
|
+
get_lastChanged(): boolean;
|
|
86
|
+
get manager(): ObjectManager<any> | null;
|
|
87
|
+
get_managerClass: () => ObjectManager<any> | null;
|
|
88
|
+
static isDeleted<T extends SimpleObject>(obj: T): boolean;
|
|
89
|
+
getIndexOrID(): number | string;
|
|
90
|
+
getIndex(): number;
|
|
91
|
+
getID(): string;
|
|
92
|
+
static getIndexOrID(o: any): number;
|
|
93
|
+
static getIndex(o: any): number;
|
|
94
|
+
static getID(o: any): string;
|
|
95
|
+
getOriginal(): this | undefined;
|
|
96
|
+
setOriginal(toObj?: null | 0 | any): this | undefined;
|
|
97
|
+
static setOriginal<T>(obj: T, toObj?: null | 0 | any): T | undefined;
|
|
98
|
+
static getOriginal<T extends SimpleObject>(obj: T): T | undefined;
|
|
99
|
+
static addError(o?: SimpleObject, title?: string, message?: string, sendToRegister?: boolean | "auto"): any[] | undefined;
|
|
100
|
+
static getErrors(o: SimpleObject): any[];
|
|
101
|
+
static clearErrors(o: SimpleObject): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Checks if the given object is a valid and truthy save result
|
|
104
|
+
* @param result_object
|
|
105
|
+
* @returns
|
|
106
|
+
*/
|
|
107
|
+
static isResultValid(result_object: any, sub?: boolean): any;
|
|
108
|
+
/**
|
|
109
|
+
* set the response of last save from site
|
|
110
|
+
* and its type
|
|
111
|
+
* @param toObj
|
|
112
|
+
*/
|
|
113
|
+
setSaveResult(toObj: any, type: saveResultType | "auto"): void;
|
|
114
|
+
getSaveResult(original?: boolean): any;
|
|
115
|
+
getSaveResultType(): saveResultType;
|
|
116
|
+
static factoryClear(obj: SimpleObject): void;
|
|
117
|
+
static delete_cache(): void;
|
|
118
|
+
static get_canModify(o: SimpleObject): boolean;
|
|
119
|
+
static equals(a?: SimpleObject | any, b?: SimpleObject | any): boolean;
|
|
120
|
+
}
|
|
121
|
+
export default SimpleObject;
|