@xy-planning-network/trees 0.6.6 → 0.6.8
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/style.css +1 -1
- package/dist/trees.es.js +3616 -3183
- package/dist/trees.umd.js +8 -8
- package/package.json +8 -7
- package/src/lib-components/forms/BaseInput.vue +2 -2
- package/src/lib-components/forms/TextArea.vue +2 -2
- package/src/lib-components/lists/DataTable.vue +1 -1
- package/src/lib-components/lists/DynamicTable.vue +1 -1
- package/src/lib-components/navigation/ActionsDropdown.vue +42 -30
- package/src/lib-components/overlays/Popover/Popover.vue +35 -193
- package/src/lib-components/overlays/Tooltip.vue +39 -9
- package/types/composables/useActionItems.d.ts +1 -1
- package/types/composables/useTable.d.ts +1 -1
- package/types/lib-components/forms/BaseInput.vue.d.ts +10 -11
- package/types/lib-components/forms/Checkbox.vue.d.ts +7 -8
- package/types/lib-components/forms/DateRangePicker.vue.d.ts +9 -10
- package/types/lib-components/forms/FieldsetLegend.vue.d.ts +5 -5
- package/types/lib-components/forms/InputHelp.vue.d.ts +6 -6
- package/types/lib-components/forms/InputLabel.vue.d.ts +8 -8
- package/types/lib-components/forms/MultiCheckboxes.vue.d.ts +10 -13
- package/types/lib-components/forms/Radio.vue.d.ts +12 -14
- package/types/lib-components/forms/RadioCards.vue.d.ts +12 -14
- package/types/lib-components/forms/Select.vue.d.ts +13 -15
- package/types/lib-components/forms/TextArea.vue.d.ts +10 -10
- package/types/lib-components/forms/Toggle.vue.d.ts +5 -5
- package/types/lib-components/forms/YesOrNoRadio.vue.d.ts +10 -11
- package/types/lib-components/indicators/XYSpinner.vue.d.ts +1 -1
- package/types/lib-components/layout/DateFilter.vue.d.ts +4 -8
- package/types/lib-components/layout/SidebarLayout.vue.d.ts +6 -9
- package/types/lib-components/layout/StackedLayout.vue.d.ts +7 -11
- package/types/lib-components/lists/Cards.vue.d.ts +2 -4
- package/types/lib-components/lists/DataTable.vue.d.ts +9 -8
- package/types/lib-components/lists/DetailList.vue.d.ts +6 -8
- package/types/lib-components/lists/DownloadCell.vue.d.ts +2 -5
- package/types/lib-components/lists/DynamicTable.vue.d.ts +9 -8
- package/types/lib-components/lists/TableActionButtons.vue.d.ts +7 -7
- package/types/lib-components/navigation/ActionsDropdown.vue.d.ts +6 -6
- package/types/lib-components/navigation/Paginator.vue.d.ts +3 -5
- package/types/lib-components/navigation/Steps.vue.d.ts +9 -11
- package/types/lib-components/navigation/Tabs.vue.d.ts +8 -10
- package/types/lib-components/overlays/ContentModal.vue.d.ts +6 -7
- package/types/lib-components/overlays/Flash.vue.d.ts +1 -1
- package/types/lib-components/overlays/Modal.vue.d.ts +11 -12
- package/types/lib-components/overlays/Popover/Popover.vue.d.ts +10 -10
- package/types/lib-components/overlays/Popover/PopoverContent.vue.d.ts +1 -1
- package/types/lib-components/overlays/Slideover.vue.d.ts +4 -8
- package/types/lib-components/overlays/Spinner.vue.d.ts +1 -1
- package/types/lib-components/overlays/Tooltip.vue.d.ts +10 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xy-planning-network/trees",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "github:xy-planning-network/trees",
|
|
@@ -40,24 +40,25 @@
|
|
|
40
40
|
"@tailwindcss/line-clamp": "^0.4.2",
|
|
41
41
|
"@tailwindcss/typography": "^0.5.7",
|
|
42
42
|
"@types/node": "^18.15.11",
|
|
43
|
-
"@vitejs/plugin-vue": "^4.
|
|
43
|
+
"@vitejs/plugin-vue": "^4.2.3",
|
|
44
44
|
"@vue/eslint-config-prettier": "^7.1.0",
|
|
45
|
-
"@vue/eslint-config-typescript": "^11.0.
|
|
45
|
+
"@vue/eslint-config-typescript": "^11.0.3",
|
|
46
46
|
"autoprefixer": "^10.4.14",
|
|
47
47
|
"copyfiles": "^2.4.1",
|
|
48
48
|
"deepmerge": "^4.3.1",
|
|
49
|
-
"eslint": "^8.
|
|
50
|
-
"eslint-plugin-vue": "^9.
|
|
49
|
+
"eslint": "^8.42.0",
|
|
50
|
+
"eslint-plugin-vue": "^9.14.1",
|
|
51
51
|
"postcss": "^8.4.21",
|
|
52
52
|
"prettier": "^2.8.7",
|
|
53
53
|
"tailwindcss": "^3.2.1",
|
|
54
54
|
"tsc-alias": "^1.8.5",
|
|
55
55
|
"typescript": "^5.0.4",
|
|
56
|
-
"vite": "^4.
|
|
56
|
+
"vite": "^4.3.9",
|
|
57
57
|
"vite-plugin-environment": "^1.1.3",
|
|
58
58
|
"vue-tsc": "^1.2.0"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
+
"@floating-ui/vue": "^1.0.1",
|
|
61
62
|
"@headlessui/vue": "^1.4.2",
|
|
62
63
|
"@heroicons/vue": "^1.0.5",
|
|
63
64
|
"axios": "^0.27.2",
|
|
@@ -70,7 +71,7 @@
|
|
|
70
71
|
"autoprefixer": "^10.4.7",
|
|
71
72
|
"postcss": "^8.4.14",
|
|
72
73
|
"tailwindcss": "^3.1.4",
|
|
73
|
-
"vue": "^3.
|
|
74
|
+
"vue": "^3.3.4"
|
|
74
75
|
},
|
|
75
76
|
"engines": {
|
|
76
77
|
"node": ">=12"
|
|
@@ -19,7 +19,7 @@ const props = withDefaults(
|
|
|
19
19
|
}
|
|
20
20
|
)
|
|
21
21
|
|
|
22
|
-
const emit = defineEmits(["update:
|
|
22
|
+
const emit = defineEmits(["update:modelValue"])
|
|
23
23
|
|
|
24
24
|
const uuid = (attrs.id as string) || Uniques.CreateIdAttribute()
|
|
25
25
|
|
|
@@ -80,7 +80,7 @@ const isTextType = computed((): boolean => {
|
|
|
80
80
|
:value="modelValue"
|
|
81
81
|
v-bind="$attrs"
|
|
82
82
|
@input="
|
|
83
|
-
emit('update:
|
|
83
|
+
emit('update:modelValue', ($event.target as HTMLInputElement).value)
|
|
84
84
|
"
|
|
85
85
|
/>
|
|
86
86
|
<InputHelp :id="`${uuid}-help`" :text="help"></InputHelp>
|
|
@@ -16,7 +16,7 @@ withDefaults(
|
|
|
16
16
|
}
|
|
17
17
|
)
|
|
18
18
|
const attrs = useAttrs()
|
|
19
|
-
const emit = defineEmits(["update:
|
|
19
|
+
const emit = defineEmits(["update:modelValue"])
|
|
20
20
|
const uuid = (attrs.id as string) || Uniques.CreateIdAttribute()
|
|
21
21
|
</script>
|
|
22
22
|
|
|
@@ -47,7 +47,7 @@ const uuid = (attrs.id as string) || Uniques.CreateIdAttribute()
|
|
|
47
47
|
:value="modelValue"
|
|
48
48
|
v-bind="$attrs"
|
|
49
49
|
@input="
|
|
50
|
-
emit('update:
|
|
50
|
+
emit('update:modelValue', ($event.target as HTMLInputElement).value)
|
|
51
51
|
"
|
|
52
52
|
/>
|
|
53
53
|
<InputHelp :id="`${uuid}-help`" :text="help"></InputHelp>
|
|
@@ -73,7 +73,7 @@ const { columns, hasActions, isEmptyCellValue, rows } = useTable(
|
|
|
73
73
|
<!--Table Actions Cell-->
|
|
74
74
|
<td
|
|
75
75
|
v-if="hasActions"
|
|
76
|
-
class="px-6 py-
|
|
76
|
+
class="px-6 py-2 text-sm text-gray-700 whitespace-nowrap leading-5"
|
|
77
77
|
>
|
|
78
78
|
<ActionsDropdown
|
|
79
79
|
v-if="tableActions.type === 'dropdown'"
|
|
@@ -281,7 +281,7 @@ loadAndRender()
|
|
|
281
281
|
<!--Table Actions Cell-->
|
|
282
282
|
<td
|
|
283
283
|
v-if="hasActions"
|
|
284
|
-
class="px-6 py-
|
|
284
|
+
class="px-6 py-2 text-sm text-gray-700 whitespace-nowrap leading-5"
|
|
285
285
|
>
|
|
286
286
|
<ActionsDropdown
|
|
287
287
|
v-if="tableActions.type === 'dropdown'"
|
|
@@ -3,7 +3,8 @@ import { Menu, MenuButton, MenuItem, MenuItems } from "@headlessui/vue"
|
|
|
3
3
|
import { DotsVerticalIcon } from "@heroicons/vue/solid"
|
|
4
4
|
import type { ActionItem } from "@/composables/nav"
|
|
5
5
|
import { useActionItems } from "@/composables/useActionItems"
|
|
6
|
-
import { toRef } from "vue"
|
|
6
|
+
import { ref, toRef } from "vue"
|
|
7
|
+
import { useFloating, autoUpdate } from "@floating-ui/vue"
|
|
7
8
|
|
|
8
9
|
const props = withDefaults(
|
|
9
10
|
defineProps<{
|
|
@@ -15,10 +16,19 @@ const props = withDefaults(
|
|
|
15
16
|
)
|
|
16
17
|
|
|
17
18
|
const { actions, hasActions } = useActionItems(toRef(props, "actions"))
|
|
19
|
+
|
|
20
|
+
const trigger = ref<HTMLElement | null>(null)
|
|
21
|
+
const wrapper = ref<HTMLElement | null>(null)
|
|
22
|
+
const { floatingStyles } = useFloating(trigger, wrapper, {
|
|
23
|
+
placement: "bottom-end",
|
|
24
|
+
strategy: "fixed",
|
|
25
|
+
whileElementsMounted: autoUpdate,
|
|
26
|
+
})
|
|
18
27
|
</script>
|
|
19
28
|
<template>
|
|
20
29
|
<Menu as="div" class="relative flex justify-end items-center">
|
|
21
30
|
<MenuButton
|
|
31
|
+
ref="trigger"
|
|
22
32
|
class="w-8 h-8 bg-white inline-flex items-center justify-center text-gray-700 rounded-full hover:text-gray-900 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
23
33
|
:disabled="!hasActions"
|
|
24
34
|
>
|
|
@@ -33,35 +43,37 @@ const { actions, hasActions } = useActionItems(toRef(props, "actions"))
|
|
|
33
43
|
leave-from-class="transform opacity-100 scale-100"
|
|
34
44
|
leave-to-class="transform opacity-0 scale-95"
|
|
35
45
|
>
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
46
|
+
<div ref="wrapper" class="z-[5]" :style="floatingStyles">
|
|
47
|
+
<MenuItems
|
|
48
|
+
class="w-48 rounded-md shadow-lg bg-white ring-1 ring-black ring-opacity-5 divide-y divide-gray-200 focus:outline-none"
|
|
49
|
+
>
|
|
50
|
+
<div class="py-1">
|
|
51
|
+
<template v-for="(action, idx) in actions" :key="idx">
|
|
52
|
+
<MenuItem v-slot="{ active }: { active: boolean }" as="div">
|
|
53
|
+
<button
|
|
54
|
+
type="submit"
|
|
55
|
+
:disabled="action.disabled"
|
|
56
|
+
:class="[
|
|
57
|
+
active ? 'bg-gray-100 text-gray-900' : 'text-gray-700',
|
|
58
|
+
'block w-full text-left px-4 py-2 text-sm font-semibold disabled:cursor-not-allowed',
|
|
59
|
+
]"
|
|
60
|
+
@click="action.onClick"
|
|
61
|
+
>
|
|
62
|
+
<span class="relative inline-flex items-center gap-x-1.5">
|
|
63
|
+
<component
|
|
64
|
+
:is="action.icon"
|
|
65
|
+
v-if="action.icon"
|
|
66
|
+
class="-ml-0.5 h-4 w-4 text-gray-400"
|
|
67
|
+
aria-hidden="true"
|
|
68
|
+
/>
|
|
69
|
+
{{ action.label }}
|
|
70
|
+
</span>
|
|
71
|
+
</button>
|
|
72
|
+
</MenuItem>
|
|
73
|
+
</template>
|
|
74
|
+
</div>
|
|
75
|
+
</MenuItems>
|
|
76
|
+
</div>
|
|
65
77
|
</transition>
|
|
66
78
|
</Menu>
|
|
67
79
|
</template>
|
|
@@ -1,29 +1,23 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
export type PopoverPosition =
|
|
3
|
-
| "top-left"
|
|
4
|
-
| "top-center"
|
|
5
|
-
| "top-right"
|
|
6
|
-
| "bottom-left"
|
|
7
|
-
| "bottom-center"
|
|
8
|
-
| "bottom-right"
|
|
9
|
-
| "left"
|
|
10
|
-
| "right"
|
|
11
|
-
| "auto"
|
|
12
|
-
| "none"
|
|
13
|
-
</script>
|
|
14
1
|
<script lang="ts" setup>
|
|
15
|
-
import { throttle } from "@/helpers/Throttle"
|
|
16
2
|
import {
|
|
17
3
|
Popover as HeadlessPopover,
|
|
18
4
|
PopoverButton as HeadlessPopoverButton,
|
|
19
5
|
PopoverPanel as HeadlessPopoverPanel,
|
|
20
6
|
} from "@headlessui/vue"
|
|
21
|
-
import { computed,
|
|
7
|
+
import { computed, ref } from "vue"
|
|
8
|
+
import {
|
|
9
|
+
useFloating,
|
|
10
|
+
offset,
|
|
11
|
+
autoPlacement,
|
|
12
|
+
autoUpdate,
|
|
13
|
+
shift,
|
|
14
|
+
} from "@floating-ui/vue"
|
|
15
|
+
import type { Placement } from "@floating-ui/vue"
|
|
22
16
|
|
|
23
17
|
const props = withDefaults(
|
|
24
18
|
defineProps<{
|
|
25
19
|
as?: string
|
|
26
|
-
position?:
|
|
20
|
+
position?: Placement | "auto"
|
|
27
21
|
}>(),
|
|
28
22
|
{
|
|
29
23
|
as: "div",
|
|
@@ -31,199 +25,47 @@ const props = withDefaults(
|
|
|
31
25
|
}
|
|
32
26
|
)
|
|
33
27
|
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const trigger = ref<typeof HeadlessPopoverButton>()
|
|
42
|
-
const wrapper = ref<typeof HeadlessPopoverPanel>()
|
|
43
|
-
const viewport = ref<{ vw: number; vh: number }>(getViewportDimensions())
|
|
44
|
-
|
|
45
|
-
const classes = computed(() => {
|
|
46
|
-
const classes = {
|
|
47
|
-
wrapper: "",
|
|
48
|
-
content: "",
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (props.position === "none") {
|
|
52
|
-
return classes
|
|
28
|
+
const trigger = ref<HTMLElement | null>(null)
|
|
29
|
+
const wrapper = ref<HTMLElement | null>(null)
|
|
30
|
+
const middleware = computed(() => {
|
|
31
|
+
const middleware = [offset(5), shift()]
|
|
32
|
+
if (props.position === "auto") {
|
|
33
|
+
middleware.push(autoPlacement())
|
|
53
34
|
}
|
|
54
35
|
|
|
55
|
-
|
|
56
|
-
classes.wrapper = "h-0 flex w-screen"
|
|
57
|
-
classes.content = "absolute"
|
|
58
|
-
|
|
59
|
-
// merge static positioning classes
|
|
60
|
-
if (props.position !== "auto") {
|
|
61
|
-
classes.wrapper += ` ${staticPosition.value.wrapper}`
|
|
62
|
-
classes.content += ` ${staticPosition.value.content}`
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return classes
|
|
36
|
+
return middleware
|
|
66
37
|
})
|
|
67
38
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
contentClasses = "bottom-full"
|
|
76
|
-
break
|
|
77
|
-
case "top-center":
|
|
78
|
-
wrapperClasses =
|
|
79
|
-
"top-0 -translate-y-full -translate-x-full left-1/2 justify-end"
|
|
80
|
-
contentClasses = "bottom-full translate-x-1/2"
|
|
81
|
-
break
|
|
82
|
-
case "top-right":
|
|
83
|
-
wrapperClasses =
|
|
84
|
-
"top-0 -translate-y-full left-0 -translate-x-full justify-end"
|
|
85
|
-
contentClasses = "bottom-full translate-x-full"
|
|
86
|
-
break
|
|
87
|
-
case "bottom-left":
|
|
88
|
-
wrapperClasses = "top-full right-0 justify-end"
|
|
89
|
-
contentClasses = "top-full"
|
|
90
|
-
break
|
|
91
|
-
case "bottom-center":
|
|
92
|
-
wrapperClasses = "top-full -translate-x-full left-1/2 justify-end"
|
|
93
|
-
contentClasses = "top-full translate-x-1/2"
|
|
94
|
-
break
|
|
95
|
-
case "bottom-right":
|
|
96
|
-
wrapperClasses = "top-full left-0 -translate-x-full justify-end"
|
|
97
|
-
contentClasses = "top-full translate-x-full"
|
|
98
|
-
break
|
|
99
|
-
case "left":
|
|
100
|
-
wrapperClasses =
|
|
101
|
-
"top-1/2 left-0 -translate-y-1/2 -translate-x-full justify-end"
|
|
102
|
-
contentClasses = "-translate-y-1/2"
|
|
103
|
-
break
|
|
104
|
-
case "right":
|
|
105
|
-
wrapperClasses = "top-1/2 -translate-y-1/2 right-0 justify-end"
|
|
106
|
-
contentClasses = "translate-x-full -translate-y-1/2"
|
|
107
|
-
break
|
|
39
|
+
/**
|
|
40
|
+
* floating-ui's placement property does not support a direct "auto"
|
|
41
|
+
* mode. Passing undefined is expected when auto position is used.
|
|
42
|
+
*/
|
|
43
|
+
const placement = computed(() => {
|
|
44
|
+
if (props.position === "auto") {
|
|
45
|
+
return undefined
|
|
108
46
|
}
|
|
109
47
|
|
|
110
|
-
return
|
|
111
|
-
wrapper: wrapperClasses,
|
|
112
|
-
content: contentClasses,
|
|
113
|
-
}
|
|
48
|
+
return props.position
|
|
114
49
|
})
|
|
115
50
|
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const { vw, vh } = viewport.value
|
|
122
|
-
|
|
123
|
-
// avoid bumping up against the edge of the browser when possible
|
|
124
|
-
const offset = 10
|
|
125
|
-
|
|
126
|
-
// base the anchor rectangle off of the entire trigger dom element to move around it
|
|
127
|
-
const anchorRect: DOMRect = trigger.value.el.getBoundingClientRect()
|
|
128
|
-
// the content rectangle is best calculated by our first child (content) element inside the wrapper
|
|
129
|
-
const contentRect: DOMRect =
|
|
130
|
-
wrapper.value.el.firstChild.getBoundingClientRect()
|
|
131
|
-
const distToBottom = vh - anchorRect.bottom
|
|
132
|
-
// NOTE: edge case - there may be more space below in the viewport
|
|
133
|
-
// but less document space for display
|
|
134
|
-
// the inverse could also be true - but will be very rare
|
|
135
|
-
// occurring with unreasonably large popover content
|
|
136
|
-
const positionAbove = anchorRect.top > distToBottom
|
|
137
|
-
const distToRight = vw - anchorRect.left
|
|
138
|
-
const flowLeft = anchorRect.left > distToRight
|
|
139
|
-
|
|
140
|
-
// translate the content container on the x axis to the correct position
|
|
141
|
-
// considering the flow the content should take
|
|
142
|
-
let xPos = 0
|
|
143
|
-
if (flowLeft) {
|
|
144
|
-
if (contentRect.width > anchorRect.right) {
|
|
145
|
-
xPos =
|
|
146
|
-
anchorRect.right -
|
|
147
|
-
contentRect.width +
|
|
148
|
-
(contentRect.width - anchorRect.right)
|
|
149
|
-
} else {
|
|
150
|
-
xPos = anchorRect.right - contentRect.width
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (vw > contentRect.width + offset) {
|
|
154
|
-
xPos = xPos + offset
|
|
155
|
-
}
|
|
156
|
-
} else {
|
|
157
|
-
if (contentRect.width > distToRight) {
|
|
158
|
-
xPos = anchorRect.left - (contentRect.width - distToRight)
|
|
159
|
-
} else {
|
|
160
|
-
xPos = anchorRect.left
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
if (vw > contentRect.width + offset) {
|
|
164
|
-
xPos = xPos - offset
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
return {
|
|
169
|
-
wrapper: {
|
|
170
|
-
top: positionAbove ? "auto" : `100%`,
|
|
171
|
-
bottom: positionAbove ? "100%" : `auto`,
|
|
172
|
-
transform: `translate(${anchorRect.left * -1}px, 0)`, // pin to left of window
|
|
173
|
-
width: `${vw}px`,
|
|
174
|
-
},
|
|
175
|
-
content: {
|
|
176
|
-
top: positionAbove ? "auto" : `100%`,
|
|
177
|
-
bottom: positionAbove ? "100%" : `auto`,
|
|
178
|
-
transform: `translate(${xPos}px, 0)`,
|
|
179
|
-
},
|
|
180
|
-
}
|
|
51
|
+
const { floatingStyles } = useFloating(trigger, wrapper, {
|
|
52
|
+
middleware: middleware,
|
|
53
|
+
placement: placement,
|
|
54
|
+
strategy: "fixed",
|
|
55
|
+
whileElementsMounted: autoUpdate,
|
|
181
56
|
})
|
|
182
|
-
|
|
183
|
-
if (props.position === "auto") {
|
|
184
|
-
const throttledSetPositions = throttle(() => {
|
|
185
|
-
viewport.value = getViewportDimensions()
|
|
186
|
-
})
|
|
187
|
-
|
|
188
|
-
onMounted(() => {
|
|
189
|
-
window.addEventListener("resize", throttledSetPositions)
|
|
190
|
-
window.addEventListener("scroll", throttledSetPositions)
|
|
191
|
-
})
|
|
192
|
-
|
|
193
|
-
onUnmounted(() => {
|
|
194
|
-
window.removeEventListener("resize", throttledSetPositions)
|
|
195
|
-
window.removeEventListener("scroll", throttledSetPositions)
|
|
196
|
-
})
|
|
197
|
-
}
|
|
198
57
|
</script>
|
|
199
58
|
|
|
200
59
|
<template>
|
|
201
|
-
<HeadlessPopover v-slot="{ open, close }"
|
|
60
|
+
<HeadlessPopover v-slot="{ open, close }" :as="as" class="relative">
|
|
202
61
|
<HeadlessPopoverButton ref="trigger">
|
|
203
62
|
<slot name="button" :open="open" :close="close"></slot>
|
|
204
63
|
</HeadlessPopoverButton>
|
|
205
64
|
|
|
206
|
-
<
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
enter-from-class="opacity-0"
|
|
210
|
-
enter-to-class="opacity-100"
|
|
211
|
-
leave-from-class="opacity-100"
|
|
212
|
-
leave-to-class="opacity-0"
|
|
213
|
-
>
|
|
214
|
-
<HeadlessPopoverPanel
|
|
215
|
-
ref="wrapper"
|
|
216
|
-
class="absolute z-10"
|
|
217
|
-
:class="classes.wrapper"
|
|
218
|
-
:style="position === 'auto' ? autoPosition.wrapper : {}"
|
|
219
|
-
>
|
|
220
|
-
<div
|
|
221
|
-
:class="classes.content"
|
|
222
|
-
:style="position === 'auto' ? autoPosition.content : {}"
|
|
223
|
-
>
|
|
224
|
-
<slot :open="open" :close="close"></slot>
|
|
225
|
-
</div>
|
|
65
|
+
<div ref="wrapper" class="z-[5]" :style="floatingStyles">
|
|
66
|
+
<HeadlessPopoverPanel>
|
|
67
|
+
<slot :open="open" :close="close"></slot>
|
|
226
68
|
</HeadlessPopoverPanel>
|
|
227
|
-
</
|
|
69
|
+
</div>
|
|
228
70
|
</HeadlessPopover>
|
|
229
71
|
</template>
|
|
@@ -1,23 +1,47 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import Popover
|
|
2
|
+
import Popover from "./Popover/Popover.vue"
|
|
3
3
|
import { InformationCircleIcon } from "@heroicons/vue/outline"
|
|
4
|
+
import type { Placement } from "@floating-ui/vue"
|
|
4
5
|
|
|
6
|
+
// props
|
|
5
7
|
withDefaults(
|
|
6
8
|
defineProps<{
|
|
7
9
|
as?: string
|
|
8
|
-
position?:
|
|
10
|
+
position?: Placement | "auto"
|
|
9
11
|
}>(),
|
|
10
12
|
{
|
|
11
13
|
as: "span",
|
|
12
14
|
position: "auto",
|
|
13
15
|
}
|
|
14
16
|
)
|
|
17
|
+
|
|
18
|
+
// data
|
|
19
|
+
var popoverHover = false
|
|
20
|
+
var popoverTimeout: null | NodeJS.Timeout = null
|
|
21
|
+
|
|
22
|
+
// functions
|
|
23
|
+
const closePopover = (close: () => void): void => {
|
|
24
|
+
popoverHover = false
|
|
25
|
+
if (popoverTimeout) clearTimeout(popoverTimeout)
|
|
26
|
+
popoverTimeout = setTimeout(() => {
|
|
27
|
+
if (!popoverHover) close()
|
|
28
|
+
}, 100)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const hoverPopover = (e: MouseEvent, open: boolean): void => {
|
|
32
|
+
popoverHover = true
|
|
33
|
+
if (!open && e.target) (e.target as HTMLElement).click()
|
|
34
|
+
}
|
|
15
35
|
</script>
|
|
16
36
|
|
|
17
37
|
<template>
|
|
18
38
|
<Popover :position="position" :as="as">
|
|
19
|
-
<template #button>
|
|
20
|
-
<div
|
|
39
|
+
<template #button="{ open, close }: { open: boolean, close: () => void }">
|
|
40
|
+
<div
|
|
41
|
+
class="leading-none relative w-4 h-4"
|
|
42
|
+
@mouseover="hoverPopover($event, open)"
|
|
43
|
+
@mouseleave="closePopover(close)"
|
|
44
|
+
>
|
|
21
45
|
<InformationCircleIcon />
|
|
22
46
|
<!--creates a larger clickable surface area 40 x 40-->
|
|
23
47
|
<div
|
|
@@ -25,10 +49,16 @@ withDefaults(
|
|
|
25
49
|
></div>
|
|
26
50
|
</div>
|
|
27
51
|
</template>
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
52
|
+
<template #default="{ close }: { close: () => void }">
|
|
53
|
+
<div
|
|
54
|
+
class="sm:min-w-max bg-white rounded-md px-3 py-2 border border-gray-100 drop-shadow-md text-xs text-gray-900 leading-snug font-medium"
|
|
55
|
+
@mouseover.prevent="popoverHover = true"
|
|
56
|
+
@mouseleave.prevent="closePopover(close)"
|
|
57
|
+
>
|
|
58
|
+
<div class="max-w-xs">
|
|
59
|
+
<slot></slot>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
33
63
|
</Popover>
|
|
34
64
|
</template>
|
|
@@ -5,7 +5,7 @@ export declare const useActionItems: (items: ActionItem[] | Ref<ActionItem[]>) =
|
|
|
5
5
|
disabled: boolean;
|
|
6
6
|
show: boolean;
|
|
7
7
|
onClick: (...args: any[]) => void;
|
|
8
|
-
icon?: import("vue").RenderFunction | import("vue").FunctionalComponent<{}, {}> | undefined;
|
|
8
|
+
icon?: import("vue").RenderFunction | import("vue").FunctionalComponent<{}, {}, any> | undefined;
|
|
9
9
|
label: string;
|
|
10
10
|
}[]>;
|
|
11
11
|
hasActions: import("vue").ComputedRef<boolean>;
|
|
@@ -15,7 +15,7 @@ export declare const useTable: (rowData: TableRowsData | Ref<TableRowsData>, col
|
|
|
15
15
|
disabled: boolean | undefined;
|
|
16
16
|
onClick: () => void;
|
|
17
17
|
show: boolean | undefined;
|
|
18
|
-
icon?: import("vue").RenderFunction | import("vue").FunctionalComponent<{}, {}> | undefined;
|
|
18
|
+
icon?: import("vue").RenderFunction | import("vue").FunctionalComponent<{}, {}, any> | undefined;
|
|
19
19
|
label: string;
|
|
20
20
|
}[];
|
|
21
21
|
rowData: import("./table").TableRowData;
|
|
@@ -7,23 +7,22 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
7
7
|
help: string;
|
|
8
8
|
label: string;
|
|
9
9
|
modelValue: string;
|
|
10
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:
|
|
11
|
-
label?: unknown;
|
|
12
|
-
type?: unknown;
|
|
13
|
-
help?: unknown;
|
|
14
|
-
modelValue?: unknown;
|
|
15
|
-
} & {
|
|
16
|
-
label: string;
|
|
10
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
17
11
|
type: string;
|
|
12
|
+
help?: string | undefined;
|
|
13
|
+
label?: string | undefined;
|
|
14
|
+
modelValue?: string | number | undefined;
|
|
15
|
+
}>, {
|
|
18
16
|
help: string;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
label: string;
|
|
18
|
+
modelValue: string;
|
|
19
|
+
}>>> & {
|
|
20
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
22
21
|
}, {
|
|
23
22
|
label: string;
|
|
24
23
|
help: string;
|
|
25
24
|
modelValue: string | number;
|
|
26
|
-
}>;
|
|
25
|
+
}, {}>;
|
|
27
26
|
export default _default;
|
|
28
27
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
29
28
|
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
@@ -5,20 +5,19 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
5
5
|
}>, {
|
|
6
6
|
label: string;
|
|
7
7
|
help: string;
|
|
8
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
9
|
-
label?:
|
|
10
|
-
help?:
|
|
11
|
-
modelValue
|
|
12
|
-
}
|
|
8
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
9
|
+
label?: string | undefined;
|
|
10
|
+
help?: string | undefined;
|
|
11
|
+
modelValue: boolean;
|
|
12
|
+
}>, {
|
|
13
13
|
label: string;
|
|
14
14
|
help: string;
|
|
15
|
-
|
|
16
|
-
} & {}> & {
|
|
15
|
+
}>>> & {
|
|
17
16
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
18
17
|
}, {
|
|
19
18
|
label: string;
|
|
20
19
|
help: string;
|
|
21
|
-
}>;
|
|
20
|
+
}, {}>;
|
|
22
21
|
export default _default;
|
|
23
22
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
24
23
|
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
@@ -11,26 +11,25 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
11
11
|
startDate: number;
|
|
12
12
|
label: string;
|
|
13
13
|
help: string;
|
|
14
|
-
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
|
|
15
|
-
label?: unknown;
|
|
16
|
-
help?: unknown;
|
|
17
|
-
modelValue?: unknown;
|
|
18
|
-
startDate?: unknown;
|
|
19
|
-
} & {
|
|
20
|
-
label: string;
|
|
21
|
-
help: string;
|
|
14
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
22
15
|
modelValue: {
|
|
23
16
|
minDate: number;
|
|
24
17
|
maxDate: number;
|
|
25
18
|
};
|
|
19
|
+
startDate?: number | undefined;
|
|
20
|
+
label?: string | undefined;
|
|
21
|
+
help?: string | undefined;
|
|
22
|
+
}>, {
|
|
26
23
|
startDate: number;
|
|
27
|
-
|
|
24
|
+
label: string;
|
|
25
|
+
help: string;
|
|
26
|
+
}>>> & {
|
|
28
27
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
29
28
|
}, {
|
|
30
29
|
label: string;
|
|
31
30
|
help: string;
|
|
32
31
|
startDate: number;
|
|
33
|
-
}>;
|
|
32
|
+
}, {}>;
|
|
34
33
|
export default _default;
|
|
35
34
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
36
35
|
type __VLS_TypePropsToRuntimeProps<T> = {
|