@ithinkdt/ui 4.0.0-20 → 4.0.0-21
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/locale.d.ts +1 -0
- package/package.json +5 -5
- package/src/design/Account.jsx +2 -0
- package/src/design/Tenant.jsx +88 -0
- package/src/design/index.js +7 -6
- package/src/design.d.ts +9 -0
package/locale.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ithinkdt/ui",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "iThinkDT UI",
|
|
@@ -84,11 +84,11 @@
|
|
|
84
84
|
"@vitejs/plugin-vue-jsx": "^5.1.1",
|
|
85
85
|
"ithinkdt-ui": "^1.7.3",
|
|
86
86
|
"typescript": "~5.9.3",
|
|
87
|
-
"unocss": ">=66.5.
|
|
88
|
-
"vite": "npm:rolldown-vite@^7.1.
|
|
87
|
+
"unocss": ">=66.5.4",
|
|
88
|
+
"vite": "npm:rolldown-vite@^7.1.17",
|
|
89
89
|
"vue": "^3.5.22",
|
|
90
|
-
"vue-router": "^4.
|
|
91
|
-
"@ithinkdt/page": "^4.0.0-
|
|
90
|
+
"vue-router": "^4.6.0",
|
|
91
|
+
"@ithinkdt/page": "^4.0.0-13"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|
|
94
94
|
"release": "pnpm publish --no-git-checks"
|
package/src/design/Account.jsx
CHANGED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { NAvatar, NButton, NDropdown, NIcon } from 'ithinkdt-ui'
|
|
2
|
+
import { computed, defineComponent } from 'vue'
|
|
3
|
+
|
|
4
|
+
import { useI18n } from '../use-i18n.js'
|
|
5
|
+
|
|
6
|
+
const ICheck = props => (
|
|
7
|
+
<svg
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
10
|
+
role="img"
|
|
11
|
+
width="1em"
|
|
12
|
+
height="1em"
|
|
13
|
+
viewBox="0 0 24 24"
|
|
14
|
+
{...props}
|
|
15
|
+
>
|
|
16
|
+
<path fill="currentColor" d="m9.55 18l-5.7-5.7l1.425-1.425L9.55 15.15l9.175-9.175L20.15 7.4z" />
|
|
17
|
+
</svg>
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
export const AppTenant = /* @__PURE__ */ defineComponent({
|
|
21
|
+
name: 'AppTenant',
|
|
22
|
+
props: {
|
|
23
|
+
options: Array,
|
|
24
|
+
current: String,
|
|
25
|
+
},
|
|
26
|
+
emit: ['update:current'],
|
|
27
|
+
setup(props, { emit }) {
|
|
28
|
+
const { t } = useI18n()
|
|
29
|
+
|
|
30
|
+
const renderLabel = (op) => {
|
|
31
|
+
if (op.disabled) return <div>{op.name}</div>
|
|
32
|
+
return (
|
|
33
|
+
<div style="display: flex; align-items: center; justify-content: space-between; gap: 20px">
|
|
34
|
+
<div style="display: flex; align-items: center; gap: 8px">
|
|
35
|
+
<NAvatar round size={22} color="var(--color-primary-hover)">{op.icon?.() || op.name[0]}</NAvatar>
|
|
36
|
+
<span style={op.id === props.current ? 'color: var(--color-primary)' : ''}>{op.name}</span>
|
|
37
|
+
</div>
|
|
38
|
+
{op.id === props.current ? <ICheck style="color: var(--color-primary); font-size: 20px" /> : <div />}
|
|
39
|
+
</div>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const options = computed(() => [
|
|
44
|
+
{ id: '___', name: t('common.account.changeTenant'), disabled: true },
|
|
45
|
+
...(props.options ?? []),
|
|
46
|
+
])
|
|
47
|
+
return () => {
|
|
48
|
+
if (!props.options?.length) return
|
|
49
|
+
const current = props.options.find(it => it.id === props.current)
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<NDropdown
|
|
53
|
+
options={options.value}
|
|
54
|
+
placement="bottom-end"
|
|
55
|
+
keyField="id"
|
|
56
|
+
labelField="name"
|
|
57
|
+
showArrow
|
|
58
|
+
renderLabel={renderLabel}
|
|
59
|
+
onSelect={current => current !== props.current && emit('update:current', current)}
|
|
60
|
+
>
|
|
61
|
+
<NButton quaternary style="--n-padding: 0 6px">
|
|
62
|
+
{{
|
|
63
|
+
icon: () => (
|
|
64
|
+
<NIcon size="18">
|
|
65
|
+
<svg
|
|
66
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
67
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
68
|
+
viewBox="0 0 1024 1024"
|
|
69
|
+
width="1em"
|
|
70
|
+
height="1em"
|
|
71
|
+
role="img"
|
|
72
|
+
>
|
|
73
|
+
<path
|
|
74
|
+
d="M728 600.2c8.1-13.2 4-30.4-9.1-38.5-30.7-19-63.6-33.8-97.8-44.4 69.4-43 115.6-119.8 115.6-207.4C736.7 175.2 627.5 66 492.8 66S249 175.2 249 309.9c0 88.2 46.8 165.5 117 208.3-12.9 4.1-25.6 8.8-38.1 14.1-51.1 21.8-97 53-136.4 92.7-39.4 39.7-70.3 85.9-91.9 137.4-22.4 53.3-33.7 109.9-33.7 168.2 0 15.5 12.5 28 28 28s28-12.5 28-28c0-207.5 167.4-376.3 373.2-376.3 68.8 0 136.1 19 194.4 55 13.1 8.2 30.4 4.1 38.5-9.1zM305 309.9c0-50.2 19.5-97.4 55-132.8 35.5-35.5 82.7-55 132.8-55 50.2 0 97.4 19.5 132.8 55 35.5 35.5 55 82.7 55 132.8s-19.5 97.4-55 132.8c-35.5 35.5-82.7 55-132.8 55-50.2 0-97.4-19.5-132.8-55-35.5-35.5-55-82.6-55-132.8zM606.2 746.4h325.1c11.3 0 21.5-6.8 25.9-17.3s1.9-22.5-6.1-30.5L844.5 592.1c-10.9-10.9-28.7-10.9-39.6 0-10.9 10.9-10.9 28.7 0 39.6l58.7 58.6H606.2c-15.5 0-28 12.5-28 28s12.6 28.1 28 28.1zM931.4 794.6H606.3c-11.3 0-21.5 6.8-25.9 17.3s-1.9 22.5 6.1 30.5l106.6 106.4c5.5 5.5 12.6 8.2 19.8 8.2 7.2 0 14.4-2.7 19.8-8.2 10.9-10.9 10.9-28.7 0-39.6L674 850.6h257.4c15.5 0 28-12.5 28-28s-12.5-28-28-28z"
|
|
75
|
+
fill="currentColor"
|
|
76
|
+
>
|
|
77
|
+
</path>
|
|
78
|
+
</svg>
|
|
79
|
+
</NIcon>
|
|
80
|
+
),
|
|
81
|
+
default: () => current.shotName || current.name,
|
|
82
|
+
}}
|
|
83
|
+
</NButton>
|
|
84
|
+
</NDropdown>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
})
|
package/src/design/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export { AppContent, AppFooter, AppHeader, AppLayout, AppSider } from './Layout.jsx'
|
|
2
|
-
export { AppLogo } from './Logo.jsx'
|
|
3
|
-
export { AppMenu } from './Menu.jsx'
|
|
4
|
-
export { AppBreadcrumb } from './Breadcrumb.jsx'
|
|
5
1
|
export { AppAccount } from './Account.jsx'
|
|
6
|
-
export { AppFullscreen } from './Fullscreen.jsx'
|
|
7
2
|
export { AppAppearance } from './Appearance.jsx'
|
|
3
|
+
export { AppBreadcrumb } from './Breadcrumb.jsx'
|
|
4
|
+
export { AppFullscreen } from './Fullscreen.jsx'
|
|
8
5
|
export { AppLanguage } from './Language.jsx'
|
|
9
|
-
export {
|
|
6
|
+
export { AppContent, AppFooter, AppHeader, AppLayout, AppSider } from './Layout.jsx'
|
|
7
|
+
export { AppLogo } from './Logo.jsx'
|
|
8
|
+
export { AppMenu } from './Menu.jsx'
|
|
10
9
|
export { AppMultiTabs } from './MultiTabs.jsx'
|
|
10
|
+
export { AppNotification } from './Notification.jsx'
|
|
11
|
+
export { AppTenant } from './Tenant.jsx'
|
package/src/design.d.ts
CHANGED
|
@@ -154,6 +154,7 @@ export declare const AppAccount: (
|
|
|
154
154
|
},
|
|
155
155
|
context: {
|
|
156
156
|
slots: {
|
|
157
|
+
extra?: (() => VNode) | undefined
|
|
157
158
|
logoutButton?: (() => VNode) | undefined
|
|
158
159
|
dropdown?: ((binding: { ChangePwd: Component, Logout: Component }) => VNode) | undefined
|
|
159
160
|
dropdownExtra?: (() => VNode) | undefined
|
|
@@ -232,3 +233,11 @@ export interface NotificationProps {
|
|
|
232
233
|
}
|
|
233
234
|
|
|
234
235
|
export declare const AppNotification: (props: PublicProps & NotificationProps) => VNode
|
|
236
|
+
|
|
237
|
+
export interface TenantProps {
|
|
238
|
+
'options': { id: string, name: string, shotName?: string | undefined, icon?: () => VNodeChild }[] | undefined
|
|
239
|
+
'current': string | undefined
|
|
240
|
+
'onUpdate:current'?: ((current: string) => void) | undefined
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export declare const AppTenant: (props: PublicProps & TenantProps) => VNode
|