@azrico/webobject 1.3.22 → 1.3.23
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.
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import SimpleObject, { sendChangesType } from "../structs/SimpleObject";
|
|
2
2
|
import MetaObject from "../structs/MetaObject";
|
|
3
|
-
import WebObjectManager from "./WebObjectManager";
|
|
4
3
|
export type deltaParams = {
|
|
5
4
|
type?: string;
|
|
6
5
|
isChild?: boolean;
|
|
@@ -67,9 +66,6 @@ export declare class WebObject extends SimpleObject {
|
|
|
67
66
|
get_webtype: () => string;
|
|
68
67
|
get_webpath: () => string;
|
|
69
68
|
static get_webname(): string | undefined;
|
|
70
|
-
get manager(): WebObjectManager<any> | null;
|
|
71
|
-
get_managerClass: () => WebObjectManager<any> | null;
|
|
72
|
-
set_managerClass(mng: WebObjectManager<any> | any): void;
|
|
73
69
|
onDelete(...p: any): Promise<any>;
|
|
74
70
|
onLoad(...p: any): Promise<any>;
|
|
75
71
|
onSave(...p: any): Promise<any>;
|
|
@@ -192,13 +192,6 @@ export class WebObject extends SimpleObject {
|
|
|
192
192
|
static get_webname() {
|
|
193
193
|
return this.__web_path || this.__web_type || this.__cache_name;
|
|
194
194
|
}
|
|
195
|
-
get manager() {
|
|
196
|
-
return this.get_managerClass();
|
|
197
|
-
}
|
|
198
|
-
get_managerClass = () => null;
|
|
199
|
-
set_managerClass(mng) {
|
|
200
|
-
this.get_managerClass = () => mng;
|
|
201
|
-
}
|
|
202
195
|
/* -------------------------------------------------------------------------- */
|
|
203
196
|
async onDelete(...p) {
|
|
204
197
|
this.isDeleted = true;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { MapableObject } from "./MapableObject";
|
|
2
2
|
import ObjectManager from "./ObjectManager";
|
|
3
|
+
import WebObject from "../WebObjects/WebObject";
|
|
4
|
+
import WebObjectManager from "../WebObjects/WebObjectManager";
|
|
3
5
|
export type saveResultType = "normal" | "nothing" | "error" | "canceled";
|
|
4
6
|
export type saveType = "normal" | "quick";
|
|
5
7
|
export type sendChangesType = boolean | "auto";
|
|
@@ -137,8 +139,8 @@ export declare class SimpleObject extends MapableObject {
|
|
|
137
139
|
get isSaved(): boolean;
|
|
138
140
|
get isNew(): boolean;
|
|
139
141
|
get lastChanged(): string;
|
|
140
|
-
get manager(): ObjectManager<any> |
|
|
141
|
-
set_managerClass(mng: ObjectManager<any> | any): void;
|
|
142
|
+
get manager(): (this extends WebObject ? WebObjectManager<any> : ObjectManager<any>) | undefined;
|
|
143
|
+
set_managerClass(mng: (this extends WebObject ? WebObjectManager<any> : ObjectManager<any>) | any): void;
|
|
142
144
|
static isDeleted<T extends SimpleObject>(obj: T): boolean;
|
|
143
145
|
getIndexOrID(): number | string;
|
|
144
146
|
getIndex(): number;
|
|
@@ -2,6 +2,7 @@ import { gcache, gfunc } from "@azrico/global";
|
|
|
2
2
|
import { object_clone, object_equals, object_isEmpty, object_isTrue, object_removeKeys, } from "@azrico/object";
|
|
3
3
|
import { MapableObject } from "./MapableObject";
|
|
4
4
|
import ObjectManager from "./ObjectManager";
|
|
5
|
+
import WebObjectManager from "../WebObjects/WebObjectManager";
|
|
5
6
|
import { combine_if_not_blank } from "@azrico/string";
|
|
6
7
|
export class SimpleObject extends MapableObject {
|
|
7
8
|
static __cache_name;
|
|
@@ -305,7 +306,7 @@ export class SimpleObject extends MapableObject {
|
|
|
305
306
|
}
|
|
306
307
|
this.__lastChanged = lc;
|
|
307
308
|
/* --------------------------- notify the manager --------------------------- */
|
|
308
|
-
const manager_class = this.
|
|
309
|
+
const manager_class = this.manager;
|
|
309
310
|
if (manager_class instanceof ObjectManager) {
|
|
310
311
|
await manager_class.notifyChanged(type, key, value, subvalue);
|
|
311
312
|
}
|
|
@@ -502,11 +503,12 @@ export class SimpleObject extends MapableObject {
|
|
|
502
503
|
return this.__lastChanged || "";
|
|
503
504
|
}
|
|
504
505
|
get manager() {
|
|
505
|
-
return this.#get_managerClass();
|
|
506
|
+
return this.#get_managerClass() || undefined;
|
|
506
507
|
}
|
|
507
|
-
#get_managerClass = () =>
|
|
508
|
+
#get_managerClass = () => undefined;
|
|
508
509
|
set_managerClass(mng) {
|
|
509
|
-
if (mng instanceof ObjectManager
|
|
510
|
+
if ((mng instanceof ObjectManager || mng instanceof WebObjectManager) &&
|
|
511
|
+
typeof mng.event_run === "function")
|
|
510
512
|
this.#get_managerClass = () => mng;
|
|
511
513
|
else {
|
|
512
514
|
console.error("set_managerClass was used with a bad manager. make sure the input to this function is a correct ObjectManager");
|