@dative-gpi/foundation-shared-components 1.0.194-dynamic-vue-app → 1.0.194-filled-check
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.
|
@@ -28,10 +28,18 @@ export default defineComponent({
|
|
|
28
28
|
type: Boolean,
|
|
29
29
|
required: false,
|
|
30
30
|
default: true
|
|
31
|
+
},
|
|
32
|
+
variant: {
|
|
33
|
+
type: String as () => "fill" | "outline",
|
|
34
|
+
required: false,
|
|
35
|
+
default: "outline"
|
|
31
36
|
}
|
|
32
37
|
},
|
|
33
38
|
setup(props) {
|
|
34
39
|
const icon = computed((): string => {
|
|
40
|
+
if (props.variant === "fill") {
|
|
41
|
+
return props.value ? "mdi-check-circle" : "mdi-close-circle";
|
|
42
|
+
}
|
|
35
43
|
return props.value ? "mdi-check-circle-outline" : "mdi-close-circle-outline";
|
|
36
44
|
});
|
|
37
45
|
|
package/composables/index.ts
CHANGED
|
@@ -5,7 +5,6 @@ export * from "./useBreakpoints";
|
|
|
5
5
|
export * from "./useColors";
|
|
6
6
|
export * from "./useCountUp";
|
|
7
7
|
export * from "./useDebounce";
|
|
8
|
-
export * from "./useDynamicVueApp";
|
|
9
8
|
export * from "./useElementVisibility";
|
|
10
9
|
export * from "./useMapLayers";
|
|
11
10
|
export * from "./useRules";
|
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.0.194-
|
|
7
|
+
"version": "1.0.194-filled-check",
|
|
8
8
|
"description": "",
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"author": "",
|
|
14
14
|
"license": "ISC",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@dative-gpi/foundation-shared-domain": "1.0.194-
|
|
17
|
-
"@dative-gpi/foundation-shared-services": "1.0.194-
|
|
16
|
+
"@dative-gpi/foundation-shared-domain": "1.0.194-filled-check",
|
|
17
|
+
"@dative-gpi/foundation-shared-services": "1.0.194-filled-check"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@dative-gpi/bones-ui": "^1.0.0",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"sass": "1.71.1",
|
|
39
39
|
"sass-loader": "13.3.2"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "65817130f747be929b4f052352e468be4f6272c6"
|
|
42
42
|
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { uuidv4 } from "@dative-gpi/bones-ui";
|
|
2
|
-
import { createApp, nextTick, onBeforeUnmount, type App, type Component } from "vue";
|
|
3
|
-
|
|
4
|
-
export function useDynamicVueApp<TProps extends Record<string, any>>(
|
|
5
|
-
component: Component,
|
|
6
|
-
options?: { registerPlugins?: (app: App) => void }
|
|
7
|
-
) {
|
|
8
|
-
let app: App | null = null;
|
|
9
|
-
let isMounting = false;
|
|
10
|
-
|
|
11
|
-
const id = uuidv4();
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const mount = async (props: TProps): Promise<void> => {
|
|
15
|
-
if (isMounting) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
isMounting = true;
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
await nextTick();
|
|
23
|
-
|
|
24
|
-
const mountPoint = document.getElementById(id);
|
|
25
|
-
if (!mountPoint) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
unmount();
|
|
30
|
-
|
|
31
|
-
app = createApp(component, props);
|
|
32
|
-
options?.registerPlugins?.(app);
|
|
33
|
-
app.mount(mountPoint);
|
|
34
|
-
} finally {
|
|
35
|
-
isMounting = false;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const unmount = () => {
|
|
40
|
-
if (!app) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
app.unmount();
|
|
44
|
-
app = null;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
const sanitizeStyle = (style?: string): string => {
|
|
48
|
-
if (!style) {
|
|
49
|
-
return "";
|
|
50
|
-
}
|
|
51
|
-
return style
|
|
52
|
-
.replace(/"/g, """)
|
|
53
|
-
.replace(/</g, "<")
|
|
54
|
-
.replace(/>/g, ">");
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const getHtml = (style?: string) => {
|
|
58
|
-
const safeStyle = sanitizeStyle(style);
|
|
59
|
-
const styleAttribute = safeStyle ? ` style="${safeStyle}"` : "";
|
|
60
|
-
return `<div id="${id}"${styleAttribute}></div>`;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
onBeforeUnmount(() => {
|
|
64
|
-
unmount();
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
return { mount, unmount, getHtml };
|
|
68
|
-
}
|