@dative-gpi/foundation-shared-services 1.1.12-test-1 → 1.1.13

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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "url": "https://github.com/Dative-GPI/foundation-shared-ui.git"
5
5
  },
6
6
  "sideEffects": false,
7
- "version": "1.1.12-test-1",
7
+ "version": "1.1.13",
8
8
  "description": "",
9
9
  "publishConfig": {
10
10
  "access": "public"
@@ -13,7 +13,7 @@
13
13
  "author": "",
14
14
  "license": "ISC",
15
15
  "dependencies": {
16
- "@dative-gpi/foundation-shared-domain": "1.1.12-test-1",
16
+ "@dative-gpi/foundation-shared-domain": "1.1.13",
17
17
  "@vueuse/core": "^14.0.0"
18
18
  },
19
19
  "peerDependencies": {
@@ -22,5 +22,5 @@
22
22
  "vue": "3.5.26",
23
23
  "vue-router": "^4.3.0"
24
24
  },
25
- "gitHead": "cbd8470a7f1d0321bb29dde2da2b6c693e146980"
25
+ "gitHead": "808ff91c2715ee0c9201227529471b0a428861c1"
26
26
  }
@@ -0,0 +1,18 @@
1
+ import { type AddOrUpdateCallback, type AllCallback, type DeleteCallback, type NotifyEvent } from "@dative-gpi/bones-ui";
2
+
3
+ export const createCollectionHandler = <T>(
4
+ onCollectionChangedHandler: AllCallback<T>,
5
+ createElementHandler: (el: any) => T
6
+ ) => {
7
+ return (ev: NotifyEvent, el: any) => {
8
+ switch (ev) {
9
+ case "add":
10
+ case "update":
11
+ (onCollectionChangedHandler as AddOrUpdateCallback<T>)(ev, createElementHandler(el));
12
+ break;
13
+ case "delete":
14
+ (onCollectionChangedHandler as DeleteCallback)(ev, el);
15
+ break;
16
+ }
17
+ };
18
+ };
package/tools/index.ts CHANGED
@@ -1,2 +1,3 @@
1
+ export * from "./collectionTools";
1
2
  export * from "./hubFactory";
2
3
  export * from "./translate";