@ithinkdt/ui 4.0.0-37 → 4.0.0-40
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/components-BC8oa62b.js +1612 -0
- package/dist/components.js +5 -0
- package/dist/directives-DUuJW647.js +183 -0
- package/dist/directives.js +3 -0
- package/dist/index.js +1222 -0
- package/dist/page.js +511 -0
- package/dist/use-i18n-Dx7V4KrY.js +6 -0
- package/dist/use-style-DcT-1dj4.js +29 -0
- package/dist/use-style.js +2 -0
- package/esm/components.js +1 -0
- package/esm/directives.js +1 -0
- package/esm/index.js +1 -0
- package/esm/page.js +1 -0
- package/esm/use-style.js +1 -0
- package/package.json +21 -18
- package/src/components/Checkboxes.jsx +0 -130
- package/src/components/DataActions.jsx +0 -105
- package/src/components/DataCustom.jsx +0 -187
- package/src/components/DataFilter.jsx +0 -119
- package/src/components/DataForm.jsx +0 -264
- package/src/components/DataLocaleInput.jsx +0 -121
- package/src/components/DataPagination.jsx +0 -62
- package/src/components/DataSelection.jsx +0 -57
- package/src/components/DataTable.jsx +0 -302
- package/src/components/Radios.jsx +0 -134
- package/src/components/UserDept.jsx +0 -643
- package/src/components/assets.jsx +0 -274
- package/src/components/index.js +0 -11
- package/src/design/Account.jsx +0 -154
- package/src/design/Appearance.jsx +0 -89
- package/src/design/Breadcrumb.jsx +0 -67
- package/src/design/Fullscreen.jsx +0 -65
- package/src/design/Language.jsx +0 -45
- package/src/design/Layout.jsx +0 -241
- package/src/design/Logo.jsx +0 -92
- package/src/design/Menu.jsx +0 -133
- package/src/design/MultiTabs.jsx +0 -501
- package/src/design/Notification.jsx +0 -311
- package/src/design/Tenant.jsx +0 -88
- package/src/design/common.jsx +0 -21
- package/src/design/index.js +0 -11
- package/src/directives/index.js +0 -2
- package/src/directives/spin.js +0 -181
- package/src/directives/tooltip.jsx +0 -121
- package/src/index.js +0 -18
- package/src/page.jsx +0 -740
- package/src/use-i18n.js +0 -8
- package/src/use-style.js +0 -58
- package/src/utils.js +0 -20
- /package/{src → esm}/components.d.ts +0 -0
- /package/{src → esm}/design.d.ts +0 -0
- /package/{src → esm}/directives.d.ts +0 -0
- /package/{src → esm}/index.d.ts +0 -0
- /package/{src → esm}/page.d.ts +0 -0
- /package/{src → esm}/use-style.d.ts +0 -0
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { promiseTimeout, useEventListener } from '@vueuse/core'
|
|
2
|
-
import { NTooltip } from 'ithinkdt-ui'
|
|
3
|
-
import { defineComponent, reactive, shallowRef } from 'vue'
|
|
4
|
-
|
|
5
|
-
const Tooltip = /* @__PURE__ */ Symbol('tooltip-dir')
|
|
6
|
-
const current = /* @__PURE__ */ shallowRef()
|
|
7
|
-
|
|
8
|
-
let _update
|
|
9
|
-
export const TooltipDirectiveProvider = /* @__PURE__ */ defineComponent({
|
|
10
|
-
name: 'TooltipDirectiveProvider',
|
|
11
|
-
props: {
|
|
12
|
-
delay: { type: Number, default: 180 },
|
|
13
|
-
},
|
|
14
|
-
setup(props) {
|
|
15
|
-
const tip = shallowRef()
|
|
16
|
-
const data = reactive({ show: false, tip: undefined, placement: 'top', x: 0, y: 0 })
|
|
17
|
-
|
|
18
|
-
_update = async () => {
|
|
19
|
-
if (!current.value) return
|
|
20
|
-
if (props.delay > 0) await promiseTimeout(props.delay)
|
|
21
|
-
const el = current.value
|
|
22
|
-
const tooltip = el?.[Tooltip]
|
|
23
|
-
if (!tooltip) return
|
|
24
|
-
const _tip = tooltip.tip
|
|
25
|
-
tip.value
|
|
26
|
-
= typeof _tip === 'function' ? _tip : () => _tip || el.attributes.getNamedItem('title') || el.textContent
|
|
27
|
-
|
|
28
|
-
const { auto } = tooltip.binding.modifiers
|
|
29
|
-
if (
|
|
30
|
-
!auto
|
|
31
|
-
|| el.firstChild.offsetWidth > el.clientWidth
|
|
32
|
-
|| el.firstChild.offsetHeight > el.clientHeight
|
|
33
|
-
) {
|
|
34
|
-
data.show = true
|
|
35
|
-
|
|
36
|
-
const rect = el.getBoundingClientRect()
|
|
37
|
-
data.placement
|
|
38
|
-
= Object.keys(tooltip.binding.modifiers).find(m =>
|
|
39
|
-
['top', 'right', 'left', 'bottom'].find(k => m.startsWith(k)),
|
|
40
|
-
) ?? 'top'
|
|
41
|
-
switch (data.placement.split('-')[0]) {
|
|
42
|
-
case 'top': {
|
|
43
|
-
data.x = rect.left + rect.width / 2
|
|
44
|
-
data.y = rect.top
|
|
45
|
-
break
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
case 'right': {
|
|
49
|
-
data.x = rect.left + rect.width
|
|
50
|
-
data.y = rect.top + rect.height / 2
|
|
51
|
-
break
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
case 'left': {
|
|
55
|
-
data.x = rect.left
|
|
56
|
-
data.y = rect.top + rect.height / 2
|
|
57
|
-
break
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
case 'bottom': {
|
|
61
|
-
data.x = rect.left + rect.width / 2
|
|
62
|
-
data.y = rect.bottom
|
|
63
|
-
break
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
} else if (data.show) {
|
|
67
|
-
data.show = false
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
useEventListener(
|
|
72
|
-
'mouseover',
|
|
73
|
-
(ev) => {
|
|
74
|
-
const el = ev.target
|
|
75
|
-
if (!current.value || current.value?.contains(el)) return
|
|
76
|
-
data.show = false
|
|
77
|
-
current.value = undefined
|
|
78
|
-
},
|
|
79
|
-
{ capture: true },
|
|
80
|
-
)
|
|
81
|
-
|
|
82
|
-
return () => (
|
|
83
|
-
<NTooltip
|
|
84
|
-
trigger="manual"
|
|
85
|
-
show={!!current.value && data.show}
|
|
86
|
-
x={data.x}
|
|
87
|
-
y={data.y}
|
|
88
|
-
placement={data.placement}
|
|
89
|
-
keepAliveOnHover
|
|
90
|
-
>
|
|
91
|
-
{tip.value?.()}
|
|
92
|
-
</NTooltip>
|
|
93
|
-
)
|
|
94
|
-
},
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
const _listener = (ev) => {
|
|
98
|
-
current.value = ev.target
|
|
99
|
-
_update?.()
|
|
100
|
-
}
|
|
101
|
-
export const vTooltip = {
|
|
102
|
-
mounted(el, binding) {
|
|
103
|
-
el[Tooltip] = {
|
|
104
|
-
binding,
|
|
105
|
-
tip: binding.value,
|
|
106
|
-
}
|
|
107
|
-
el.addEventListener('mouseenter', _listener)
|
|
108
|
-
},
|
|
109
|
-
updated(el, binding) {
|
|
110
|
-
el[Tooltip].binding = binding
|
|
111
|
-
el[Tooltip].tip = binding.value
|
|
112
|
-
_update()
|
|
113
|
-
},
|
|
114
|
-
beforeUnmount(el) {
|
|
115
|
-
if (el[Tooltip]) el.removeEventListener('mouseenter', _listener)
|
|
116
|
-
if (current.value === el) {
|
|
117
|
-
current.value = undefined
|
|
118
|
-
}
|
|
119
|
-
delete el[Tooltip]
|
|
120
|
-
},
|
|
121
|
-
}
|
package/src/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineComponent, provide, toRef } from 'vue'
|
|
2
|
-
|
|
3
|
-
import { UI_I18N_INJECTION } from './use-i18n.js'
|
|
4
|
-
|
|
5
|
-
export { SpinDirectiveProvider, TooltipDirectiveProvider, vSpin, vTooltip } from './directives/index.js'
|
|
6
|
-
export * from './design/index.js'
|
|
7
|
-
|
|
8
|
-
export const UIProvider = /* @__PURE__ */ defineComponent({
|
|
9
|
-
name: 'UIProvider',
|
|
10
|
-
props: {
|
|
11
|
-
i18n: Function,
|
|
12
|
-
},
|
|
13
|
-
setup(props, { slots }) {
|
|
14
|
-
provide(UI_I18N_INJECTION, toRef(props, 'i18n'))
|
|
15
|
-
|
|
16
|
-
return () => slots.default()
|
|
17
|
-
},
|
|
18
|
-
})
|