@geosdi/ngx-model 1.2.4 → 2.0.0
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 +11 -2
- package/fesm2022/geosdi-ngx-model.mjs +23 -52
- package/fesm2022/geosdi-ngx-model.mjs.map +1 -1
- package/package.json +1 -1
- package/types/geosdi-ngx-model.d.ts +32 -38
package/README.md
CHANGED
|
@@ -66,7 +66,8 @@ mediator.getColleague("delete"); // the DeleteAction
|
|
|
66
66
|
mediator.getColleague("missing"); // null
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
- the colleagues are indexed once, in the constructor: to change them, build a new mediator
|
|
69
|
+
- the colleagues are indexed once, in the constructor: to change them, build a new mediator.
|
|
70
|
+
`initColleagues()` is public, but calling it again only re-adds the same array to the map;
|
|
70
71
|
- **two colleagues with the same key**: the last one wins, with no warning;
|
|
71
72
|
- `getColleague` returns `null` for an unknown key;
|
|
72
73
|
- `NgxMediator` is a plain class, not an Angular service: to inject it, provide it yourself (for
|
|
@@ -74,7 +75,15 @@ mediator.getColleague("missing"); // null
|
|
|
74
75
|
|
|
75
76
|
## Model
|
|
76
77
|
|
|
77
|
-
`Model` is the base interface of an entity: an optional `id`, a string
|
|
78
|
+
`Model` is the base interface of an entity: an optional `id`, a string, a number or `null`.
|
|
79
|
+
|
|
80
|
+
## Changes in 2.0.0
|
|
81
|
+
|
|
82
|
+
- **A major version**, released together with the other `@geosdi` libraries rebuilt for Angular 22.
|
|
83
|
+
For this library nothing changes: it has no peer dependencies and its API is the same.
|
|
84
|
+
- Compiled with Angular 22. The library still has no dependencies.
|
|
85
|
+
- This README: `initColleagues()` and the `null` id.
|
|
86
|
+
- The code is unchanged.
|
|
78
87
|
|
|
79
88
|
## Changes in 1.2.4
|
|
80
89
|
|
|
@@ -1,53 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
constructor(colleagues) {
|
|
23
|
-
this.colleagues = colleagues;
|
|
24
|
-
this.colleaguesMap = new Map();
|
|
25
|
-
this.initColleagues();
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
*
|
|
29
|
-
*/
|
|
30
|
-
initColleagues() {
|
|
31
|
-
this.colleagues.forEach((c) => {
|
|
32
|
-
this.colleaguesMap.set(c.getKey(), c);
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* @param key
|
|
38
|
-
*/
|
|
39
|
-
getColleague(key) {
|
|
40
|
-
return this.colleaguesMap.has(key) ? this.colleaguesMap.get(key) : null;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/*
|
|
45
|
-
* Public API Surface of ngx-model
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Generated bundle index. Do not edit.
|
|
50
|
-
*/
|
|
51
|
-
|
|
1
|
+
var NgxChainHandler = class {
|
|
2
|
+
set successor(_successor) {
|
|
3
|
+
this._successor = _successor;
|
|
4
|
+
}
|
|
5
|
+
};
|
|
6
|
+
var NgxColleague = class {};
|
|
7
|
+
var NgxMediator = class {
|
|
8
|
+
constructor(colleagues) {
|
|
9
|
+
this.colleagues = colleagues;
|
|
10
|
+
this.colleaguesMap = /* @__PURE__ */ new Map();
|
|
11
|
+
this.initColleagues();
|
|
12
|
+
}
|
|
13
|
+
initColleagues() {
|
|
14
|
+
this.colleagues.forEach((c) => {
|
|
15
|
+
this.colleaguesMap.set(c.getKey(), c);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
getColleague(key) {
|
|
19
|
+
return this.colleaguesMap.has(key) ? this.colleaguesMap.get(key) : null;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
52
22
|
export { NgxChainHandler, NgxColleague, NgxMediator };
|
|
53
|
-
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=geosdi-ngx-model.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geosdi-ngx-model.mjs","sources":["../../../../projects/geosdi/support/ngx-model/src/lib/ngx-chain-handler.ts","../../../../projects/geosdi/support/ngx-model/src/lib/ngx-colleague.ts","../../../../projects/geosdi/support/ngx-model/src/lib/ngx-mediator.service.ts"
|
|
1
|
+
{"version":3,"file":"geosdi-ngx-model.mjs","names":[],"sources":["../../../../projects/geosdi/support/ngx-model/src/lib/ngx-chain-handler.ts","../../../../projects/geosdi/support/ngx-model/src/lib/ngx-colleague.ts","../../../../projects/geosdi/support/ngx-model/src/lib/ngx-mediator.service.ts"],"sourcesContent":["/**\n * @author Vito Salvia - CNR IMAA geoSDI Group\n * @email vito.salvia@gmail.com\n */\nexport abstract class NgxChainHandler<B extends NgxChainHandler<B>> {\n protected _successor: B;\n\n /**\n *\n */\n public set successor(_successor: B) {\n this._successor = _successor;\n }\n}\n","/**\n * @author Vito Salvia - CNR IMAA geoSDI Group\n * @email vito.salvia@gmail.com\n */\nexport interface INgxColleague {\n /**\n *\n */\n getKey(): any;\n}\n\nexport abstract class NgxColleague implements INgxColleague {\n /**\n *\n */\n abstract getKey(): any;\n}\n","import { INgxColleague } from \"./ngx-colleague\";\n\n/**\n * @author Vito Salvia - CNR IMAA geoSDI Group\n * @email vito.salvia@gmail.com\n */\nexport class NgxMediator<C extends INgxColleague> {\n protected colleaguesMap: Map<string, C> = new Map();\n\n constructor(private colleagues: ReadonlyArray<C>) {\n this.initColleagues();\n }\n\n /**\n *\n */\n initColleagues() {\n this.colleagues.forEach((c) => {\n this.colleaguesMap.set(c.getKey(), c);\n });\n }\n\n /**\n *\n * @param key\n */\n getColleague(key: string) {\n return this.colleaguesMap.has(key) ? this.colleaguesMap.get(key) : null;\n }\n}\n"],"mappings":"AAIA,IAAsB,kBAAtB,MAAqC;CAMjC,IAAW,UAAU,YAAa;EAC9B,KAAK,aAAa;CACtB;AACH;ACFD,IAAsB,eAAtB,MAAkC,CAKjC;ACVD,IAAa,cAAb,MAAwB;CAGpB,YAAoB,YAA4B;EAA5B,KAAA,aAAA;EAFV,KAAA,gCAAgC,IAAI,IAAG;EAG7C,KAAK,eAAc;CACvB;CAKA,iBAAc;EACV,KAAK,WAAW,SAAS,MAAK;GAC1B,KAAK,cAAc,IAAI,EAAE,OAAM,GAAI,CAAC;EACxC,CAAC;CACL;CAMA,aAAa,KAAW;EACpB,OAAO,KAAK,cAAc,IAAI,GAAG,IAAI,KAAK,cAAc,IAAI,GAAG,IAAI;CACvE;AACH"}
|
package/package.json
CHANGED
|
@@ -2,57 +2,51 @@
|
|
|
2
2
|
* @author Vito Salvia - CNR IMAA geoSDI Group
|
|
3
3
|
* @email vito.salvia@gmail.com
|
|
4
4
|
*/
|
|
5
|
-
interface Model {
|
|
6
|
-
|
|
5
|
+
export interface Model {
|
|
6
|
+
id?: string | number | null;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
8
|
/**
|
|
10
9
|
* @author Vito Salvia - CNR IMAA geoSDI Group
|
|
11
10
|
* @email vito.salvia@gmail.com
|
|
12
11
|
*/
|
|
13
|
-
declare abstract class NgxChainHandler<B extends NgxChainHandler<B>> {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
export declare abstract class NgxChainHandler<B extends NgxChainHandler<B>> {
|
|
13
|
+
protected _successor: B;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
set successor(_successor: B);
|
|
19
18
|
}
|
|
20
|
-
|
|
21
19
|
/**
|
|
22
20
|
* @author Vito Salvia - CNR IMAA geoSDI Group
|
|
23
21
|
* @email vito.salvia@gmail.com
|
|
24
22
|
*/
|
|
25
|
-
interface INgxColleague {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
export interface INgxColleague {
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
getKey(): any;
|
|
30
28
|
}
|
|
31
|
-
declare abstract class NgxColleague implements INgxColleague {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
export declare abstract class NgxColleague implements INgxColleague {
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
abstract getKey(): any;
|
|
36
34
|
}
|
|
37
|
-
|
|
38
35
|
/**
|
|
39
36
|
* @author Vito Salvia - CNR IMAA geoSDI Group
|
|
40
37
|
* @email vito.salvia@gmail.com
|
|
41
38
|
*/
|
|
42
|
-
declare class NgxMediator<C extends INgxColleague> {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export { NgxChainHandler, NgxColleague, NgxMediator };
|
|
58
|
-
export type { INgxColleague, Model };
|
|
39
|
+
export declare class NgxMediator<C extends INgxColleague> {
|
|
40
|
+
private colleagues;
|
|
41
|
+
protected colleaguesMap: Map<string, C>;
|
|
42
|
+
constructor(colleagues: ReadonlyArray<C>);
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
initColleagues(): void;
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @param key
|
|
50
|
+
*/
|
|
51
|
+
getColleague(key: string): C;
|
|
52
|
+
}
|