@stonecrop/stonecrop 0.4.0 → 0.4.1
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/dist/composable.js +16 -18
- package/dist/src/composable.d.ts +1 -2
- package/dist/src/composable.d.ts.map +1 -1
- package/dist/stonecrop.d.ts +1 -2
- package/dist/stonecrop.js +139 -139
- package/dist/stonecrop.js.map +1 -1
- package/dist/stonecrop.umd.cjs +6 -6
- package/dist/stonecrop.umd.cjs.map +1 -1
- package/package.json +4 -4
- package/src/composable.ts +17 -20
package/dist/composable.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { inject,
|
|
1
|
+
import { inject, onMounted, ref } from 'vue';
|
|
2
2
|
import { Stonecrop } from './stonecrop';
|
|
3
3
|
import { useDataStore } from './stores/data';
|
|
4
4
|
/**
|
|
@@ -9,20 +9,20 @@ import { useDataStore } from './stores/data';
|
|
|
9
9
|
* @public
|
|
10
10
|
*/
|
|
11
11
|
export function useStonecrop(registry) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
store
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
const stonecrop = ref();
|
|
13
|
+
onMounted(async () => {
|
|
14
|
+
if (!registry) {
|
|
15
|
+
registry = inject('$registry');
|
|
16
|
+
}
|
|
17
|
+
let store;
|
|
18
|
+
try {
|
|
19
|
+
store = useDataStore();
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
throw new Error('Please enable the Stonecrop plugin before using the Stonecrop composable');
|
|
23
|
+
}
|
|
24
|
+
// @ts-expect-error TODO: handle empty registry passed to Stonecrop
|
|
25
|
+
stonecrop.value = new Stonecrop(registry, store);
|
|
26
26
|
if (!registry || !registry.router)
|
|
27
27
|
return;
|
|
28
28
|
const route = registry.router.currentRoute.value;
|
|
@@ -47,8 +47,6 @@ export function useStonecrop(registry) {
|
|
|
47
47
|
}
|
|
48
48
|
stonecrop.value.runAction(doctype, 'LOAD', recordId ? [recordId] : undefined);
|
|
49
49
|
}
|
|
50
|
-
isReady.value = true;
|
|
51
50
|
});
|
|
52
|
-
|
|
53
|
-
return { stonecrop, isReady };
|
|
51
|
+
return { stonecrop };
|
|
54
52
|
}
|
package/dist/src/composable.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composable.d.ts","sourceRoot":"","sources":["../../src/composable.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"composable.d.ts","sourceRoot":"","sources":["../../src/composable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,GAAG,EAAO,MAAM,KAAK,CAAA;AAEjD,OAAO,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGvC;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC7B,SAAS,EAAE,GAAG,CAAC,SAAS,GAAG,SAAS,CAAC,CAAA;CACrC,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,eAAe,CAgDjE"}
|
package/dist/stonecrop.d.ts
CHANGED