@ithinkdt/ui 4.0.0-10

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.
@@ -0,0 +1,234 @@
1
+ import { Component, FunctionalComponent, VNode, VNodeChild } from 'vue'
2
+
3
+ import { MaybePromise, PublicProps } from '@ithinkdt/common'
4
+
5
+ export declare const AppLayout: (
6
+ props: PublicProps & {
7
+ /**
8
+ * 布局模式
9
+ * - left2right 左右布局,侧栏占据整个高度
10
+ * - top2bottom 上下布局,头部占据所有宽度
11
+ */
12
+ layout?: 'left2right' | 'top2bottom' | undefined
13
+
14
+ /** 最大化内容 */
15
+ fullContent?: boolean | undefined
16
+ },
17
+ context: {
18
+ slots: {
19
+ default?: (() => VNode) | undefined
20
+ }
21
+ },
22
+ ) => VNode
23
+
24
+ export declare const AppHeader: (
25
+ props: PublicProps & {
26
+ height?: number | undefined
27
+ },
28
+ context: {
29
+ slots: {
30
+ default?: (() => VNode) | undefined
31
+ }
32
+ },
33
+ ) => VNode
34
+
35
+ export declare const AppContent: (
36
+ props: PublicProps & {
37
+ scrollbar?: 'naive' | 'native' | undefined
38
+ },
39
+ context: {
40
+ slots: {
41
+ default?: (() => VNode) | undefined
42
+ }
43
+ },
44
+ ) => VNode
45
+
46
+ export declare const AppSider: (
47
+ props: PublicProps & {
48
+ 'collapsed'?: boolean | undefined
49
+ 'width'?: number | undefined
50
+ 'collapsedWidth'?: number | undefined
51
+ 'showCollapseBtn'?: boolean | undefined
52
+ 'hidden'?: boolean | undefined
53
+ 'onUpdate:collapsed'?: ((collapsed: boolean) => void) | undefined
54
+ },
55
+ context: {
56
+ slots: {
57
+ default?: (() => VNode) | undefined
58
+ }
59
+ },
60
+ ) => VNode
61
+
62
+ export declare const AppFooter: (
63
+ props: PublicProps & {},
64
+ context: {
65
+ slots: {
66
+ default?: (() => VNode) | undefined
67
+ }
68
+ },
69
+ ) => VNode
70
+
71
+ export declare const AppLogo: (
72
+ props: PublicProps & {
73
+ src?: string | (() => MaybePromise<string | undefined>) | undefined
74
+ name?: string | undefined
75
+ center?: boolean | undefined
76
+ link?: boolean | undefined
77
+ collapsed?: boolean | undefined
78
+ onClick?: ((event: MouseEvent) => void) | undefined
79
+ },
80
+ context: {
81
+ slots: {
82
+ default?: (() => VNode) | undefined
83
+ icon?: (() => VNode) | undefined
84
+ }
85
+ },
86
+ ) => VNode
87
+
88
+ /** 应用模块基础公共部分 */
89
+ interface ModuleOptionBase {
90
+ /** 唯一键 */
91
+ key: string
92
+ /** 名称 */
93
+ name: string
94
+ }
95
+ /** 应用模块组 */
96
+ export interface ModuleOptionGroup extends ModuleOptionBase {
97
+ type: 'group'
98
+ /** 图标 */
99
+ icon?: string
100
+ /** 子模块 */
101
+ children?: (ModuleOptionGroup | ModuleOptionView)[]
102
+ }
103
+ /** 应用视图模块 */
104
+ export interface ModuleOptionView extends ModuleOptionBase {
105
+ type: 'view'
106
+ /** 路径 */
107
+ path: string
108
+ /** 图标 */
109
+ icon?: string
110
+ }
111
+
112
+ export type ModuleOption = ModuleOptionGroup | ModuleOptionView
113
+ export declare const AppMenu: (
114
+ props: PublicProps & {
115
+ current?: string | undefined
116
+ menus?: ModuleOption[] | undefined
117
+ collapsed?: boolean | undefined
118
+ accordion?: boolean | undefined
119
+ getIcon?: ((key: string | undefined) => FunctionalComponent) | undefined
120
+ horizontal?: boolean | undefined
121
+ single?: boolean | undefined
122
+ width?: number | undefined
123
+ collapsedWidth?: number | undefined
124
+ renderLabel?: ((menu: ModuleOption) => VNodeChild) | undefined
125
+ },
126
+ ) => VNode
127
+
128
+ export interface BreadcrumbOption {
129
+ /** 标题 */
130
+ title: string | (() => string)
131
+ /** 图标 */
132
+ icon?: string | Component | undefined
133
+ /** 链接地址 */
134
+ href?: string | undefined
135
+ /** 子项之间的分隔符 */
136
+ separator?: string | undefined
137
+ }
138
+ export declare const AppBreadcrumb: (
139
+ props: PublicProps & {
140
+ items?: BreadcrumbOption[] | undefined
141
+ getIcon?: ((key: string) => FunctionalComponent) | undefined
142
+ },
143
+ ) => VNode
144
+
145
+ export declare const AppAccount: (
146
+ props: PublicProps & {
147
+ username?: string | undefined
148
+ nickname?: string | undefined
149
+ head?: string | undefined
150
+ showLogoutButton?: boolean | undefined
151
+ showChangePwd?: boolean | undefined
152
+ onChangePwd?: (() => void) | undefined
153
+ onLogout?: (() => void) | undefined
154
+ },
155
+ context: {
156
+ slots: {
157
+ logoutButton?: (() => VNode) | undefined
158
+ dropdown?: ((binding: { ChangePwd: Component, Logout: Component }) => VNode) | undefined
159
+ dropdownExtra?: (() => VNode) | undefined
160
+ }
161
+ },
162
+ ) => VNode
163
+
164
+ export declare const AppFullscreen: (
165
+ props: PublicProps & {
166
+ onChange?: ((isFullscreen: boolean) => void) | undefined
167
+ },
168
+ ) => VNode
169
+
170
+ export declare const AppAppearance: (
171
+ props: PublicProps & {
172
+ 'mode'?: 'auto' | 'light' | 'dark' | undefined
173
+ 'onUpdate:mode'?: ((mode: 'auto' | 'light' | 'dark') => void) | undefined
174
+ },
175
+ ) => VNode
176
+
177
+ export declare const AppLanguage: (
178
+ props: PublicProps & {
179
+ 'supports'?: ({ label: string, value: string, icon?: () => VNodeChild }[]) | undefined
180
+ 'lang'?: string | undefined
181
+ 'onUpdate:lang'?: ((lang: string) => void) | undefined
182
+ },
183
+ ) => VNode
184
+
185
+ export interface MultiTabItem {
186
+ key: string
187
+ title: string
188
+ path: string
189
+ fullPath: string
190
+ href: string
191
+ reloading?: boolean | undefined
192
+ closable: boolean
193
+ close: (navigate?: boolean) => Promise<void>
194
+ }
195
+
196
+ export declare const AppMultiTabs: (
197
+ props: PublicProps & {
198
+ 'showBreadcrumb'?: boolean | undefined
199
+ 'fullTab'?: boolean | undefined
200
+ 'tabs': MultiTabItem[]
201
+ 'current'?: MultiTabItem | undefined
202
+ 'dark'?: boolean | undefined
203
+ 'onUpdate:fullTab'?: ((fullTab: boolean) => void) | undefined
204
+ },
205
+ context: {
206
+ slots: {
207
+ name?: ((binding: { isCurrent: boolean, name: string, tab: MultiTabItem }) => VNodeChild) | undefined
208
+ }
209
+ },
210
+ ) => VNode
211
+
212
+ export interface NotificationProps {
213
+ getUnreadCount: () => Promise<number>
214
+ getPage: (
215
+ type: 'all' | 'unread',
216
+ page: number,
217
+ size: number,
218
+ ) => Promise<{
219
+ records: {
220
+ key: string
221
+ title: string
222
+ content: () => VNodeChild
223
+ date: number
224
+ status: 'read' | 'unread'
225
+ link?: string
226
+ }[]
227
+ total: number
228
+ }>
229
+ markRead: (keys: string[]) => Promise<void>
230
+ markDelete: (keys: string[]) => Promise<void>
231
+ interval?: number | undefined
232
+ }
233
+
234
+ export declare const AppNotification: (props: PublicProps & NotificationProps) => VNode
@@ -0,0 +1,42 @@
1
+ import { Directive, VNode, VNodeChild } from 'vue'
2
+
3
+ export declare const SpinDirectiveProvider: (props: { dark?: boolean }) => VNode
4
+
5
+ /**
6
+ * directive 加载效果
7
+ *
8
+ * 支持 dom dataset 参数 'data-spin-tip'
9
+ *
10
+ * 将在容器最后 append 元素,如果容器的 position 是 static,将修改为 relative。如出现样式问题请注意排查
11
+ *
12
+ * 支持的修饰符
13
+ * - 'light' | 'dark' | 'auto' 暗色|亮色|自动模式
14
+ */
15
+ export declare const vSpin: Directive<HTMLElement, void | undefined | string | boolean | number, 'light' | 'dark'>
16
+
17
+ export declare const TooltipDirectiveProvider: (props: { delay?: number }) => VNode
18
+
19
+ /**
20
+ * directive 弹出提示
21
+ *
22
+ * 支持的修饰符
23
+ * - 'auto' 当内容溢出来容器时自动展示,否则隐藏
24
+ * - 'left-end'、'left'、'left-start'、'top-start'、'top'、'top-end'、'right-start'、'right'、'right-end'、'bottom-end'、'bottom'、'bottom-start' 弹出内容的位置
25
+ */
26
+ export declare const vTooltip: Directive<
27
+ HTMLElement,
28
+ VNodeChild,
29
+ | 'auto'
30
+ | 'left-end'
31
+ | 'left'
32
+ | 'left-start'
33
+ | 'top-start'
34
+ | 'top'
35
+ | 'top-end'
36
+ | 'right-start'
37
+ | 'right'
38
+ | 'right-end'
39
+ | 'bottom-end'
40
+ | 'bottom'
41
+ | 'bottom-start'
42
+ >
package/src/index.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import { VNode } from 'vue'
2
+
3
+ import { I18nComposable, ParseMessage } from '@ithinkdt/common/i18n'
4
+
5
+ import { UILocale } from '../locale.js'
6
+
7
+ import '../shims.js'
8
+
9
+ export * from './directives.js'
10
+ export * from './design.js'
11
+
12
+ export { UILocale }
13
+
14
+ /** Props for {@link UIProvider} */
15
+ export interface UIProviderProps {
16
+ i18n?: I18nComposable<ParseMessage<UILocale, 'common'>>
17
+ }
18
+
19
+ export declare const UIProvider: (props: UIProviderProps) => VNode