adminforth 2.4.0-next.211 → 2.4.0-next.213

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.
@@ -76,6 +76,7 @@ interface DialogProps {
76
76
  clickToCloseOutside?: boolean
77
77
  beforeCloseFunction?: (() => void | Promise<void>) | null
78
78
  beforeOpenFunction?: (() => void | Promise<void>) | null
79
+ closable?: boolean
79
80
  }
80
81
 
81
82
  const props = withDefaults(defineProps<DialogProps>(), {
@@ -87,6 +88,7 @@ const props = withDefaults(defineProps<DialogProps>(), {
87
88
  clickToCloseOutside: true,
88
89
  beforeCloseFunction: null,
89
90
  beforeOpenFunction: null,
91
+ closable: true,
90
92
  })
91
93
 
92
94
  onMounted(async () => {
@@ -95,6 +97,7 @@ onMounted(async () => {
95
97
  modal.value = new Modal(
96
98
  modalEl.value,
97
99
  {
100
+ closable: props.closable,
98
101
  backdrop: props.clickToCloseOutside ? 'dynamic' : 'static',
99
102
  onHide: async () => {
100
103
  if (props.beforeCloseFunction) {
@@ -1,29 +1,34 @@
1
1
  <template>
2
- <div ref="triggerEl" class="afcl-tooltip inline-flex items-center">
2
+ <div ref="triggerEl" class="afcl-tooltip inline-flex items-center" @mouseenter="mouseOn" @mouseleave="mouseOff">
3
3
  <slot></slot>
4
4
  </div>
5
- <div
6
- role="tooltip"
7
- class="absolute z-20 invisible inline-block px-3 py-2 text-sm font-medium text-lightTooltipText dark:darkTooltipText transition-opacity duration-300 bg-lightTooltipBackground rounded-lg shadow-sm opacity-0 tooltip dark:bg-darkTooltipBackground"
8
- ref="tooltip"
9
- >
10
- <slot name="tooltip"></slot>
11
- <div class="tooltip-arrow" data-popper-arrow></div>
12
- </div>
5
+ <teleport to="body" v-if="showTooltip">
6
+ <div
7
+ role="tooltip"
8
+ class="absolute z-20 invisible inline-block px-3 py-2 text-sm font-medium text-lightTooltipText dark:darkTooltipText transition-opacity duration-300 bg-lightTooltipBackground rounded-lg shadow-sm opacity-0 tooltip dark:bg-darkTooltipBackground"
9
+ ref="tooltip"
10
+ >
11
+ <slot name="tooltip"></slot>
12
+ <div class="tooltip-arrow" data-popper-arrow></div>
13
+ </div>
14
+ </teleport>
13
15
  </template>
14
16
 
15
17
  <script setup lang="ts">
16
- import { ref, onMounted, nextTick, onUnmounted, type Ref } from 'vue';
18
+ import { ref, nextTick, type Ref } from 'vue';
17
19
  import { Tooltip } from 'flowbite';
18
20
 
19
21
  const triggerEl = ref(null);
20
22
  const tooltip = ref(null);
21
-
23
+ const showTooltip = ref(false);
22
24
  const tp: Ref<Tooltip|null> = ref(null);
23
25
 
24
- onMounted(async () => {
25
- //await one tick when all is mounted
26
+ async function mouseOn() {
27
+ showTooltip.value = true;
26
28
  await nextTick();
29
+
30
+ tp.value?.destroy();
31
+
27
32
  tp.value = new Tooltip(
28
33
  tooltip.value,
29
34
  triggerEl.value,
@@ -32,11 +37,15 @@ onMounted(async () => {
32
37
  triggerType: 'hover',
33
38
  },
34
39
  );
35
- })
36
40
 
41
+ tp.value.show();
42
+ }
37
43
 
38
- onUnmounted(() => {
39
- //destroy tooltip
44
+ function mouseOff() {
45
+ tp.value?.hide();
40
46
  tp.value?.destroy();
41
- })
47
+ tp.value = null;
48
+ showTooltip.value = false;
49
+ }
50
+
42
51
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "2.4.0-next.211",
3
+ "version": "2.4.0-next.213",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",