@ithinkdt/ui 4.0.0-5 → 4.0.0-500

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,243 @@
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
+ extra?: (() => VNode) | undefined
158
+ logoutButton?: (() => VNode) | undefined
159
+ dropdown?: ((binding: { ChangePwd: Component, Logout: Component }) => VNode) | undefined
160
+ dropdownExtra?: (() => VNode) | undefined
161
+ }
162
+ },
163
+ ) => VNode
164
+
165
+ export declare const AppFullscreen: (
166
+ props: PublicProps & {
167
+ onChange?: ((isFullscreen: boolean) => void) | undefined
168
+ },
169
+ ) => VNode
170
+
171
+ export declare const AppAppearance: (
172
+ props: PublicProps & {
173
+ 'mode'?: 'auto' | 'light' | 'dark' | undefined
174
+ 'onUpdate:mode'?: ((mode: 'auto' | 'light' | 'dark') => void) | undefined
175
+ },
176
+ ) => VNode
177
+
178
+ export declare const AppLanguage: (
179
+ props: PublicProps & {
180
+ 'supports'?: ({ label: string, value: string, icon?: () => VNodeChild }[]) | undefined
181
+ 'lang'?: string | undefined
182
+ 'onUpdate:lang'?: ((lang: string) => void) | undefined
183
+ },
184
+ ) => VNode
185
+
186
+ export interface MultiTabItem {
187
+ key: string
188
+ title: string
189
+ path: string
190
+ fullPath: string
191
+ href: string
192
+ reloading?: boolean | undefined
193
+ closable: boolean
194
+ close: (navigate?: boolean) => Promise<void>
195
+ }
196
+
197
+ export declare const AppMultiTabs: (
198
+ props: PublicProps & {
199
+ 'showBreadcrumb'?: boolean | undefined
200
+ 'fullTab'?: boolean | undefined
201
+ 'tabs': MultiTabItem[]
202
+ 'current'?: MultiTabItem | undefined
203
+ 'dark'?: boolean | undefined
204
+ 'onUpdate:fullTab'?: ((fullTab: boolean) => void) | undefined
205
+ },
206
+ context: {
207
+ slots: {
208
+ name?: ((binding: { isCurrent: boolean, name: string, tab: MultiTabItem }) => VNodeChild) | undefined
209
+ }
210
+ },
211
+ ) => VNode
212
+
213
+ export interface NotificationProps {
214
+ getUnreadCount: () => Promise<number>
215
+ getPage: (
216
+ type: 'all' | 'unread',
217
+ page: number,
218
+ size: number,
219
+ ) => Promise<{
220
+ records: {
221
+ key: string
222
+ title: string
223
+ content: () => VNodeChild
224
+ date: number
225
+ status: 'read' | 'unread'
226
+ link?: string
227
+ }[]
228
+ total: number
229
+ }>
230
+ markRead: (keys: string[]) => Promise<void>
231
+ markDelete: (keys: string[]) => Promise<void>
232
+ interval?: number | undefined
233
+ }
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
@@ -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
+ >
@@ -0,0 +1 @@
1
+ export * from '../dist/directives.js'
package/esm/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
package/esm/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from '../dist/index.js'
package/esm/page.d.ts ADDED
@@ -0,0 +1,189 @@
1
+ import {
2
+ CheckboxProps, DatePickerProps, DatePickerSlots, DrawerContentProps, DrawerProps,
3
+ InputNumberProps, InputNumberSlots, InputProps, InputSlots,
4
+ ModalOptions, SelectGroupOption, SelectOption, SelectProps, SelectSlots,
5
+ UploadFileInfo, UploadProps,
6
+ } from 'ithinkdt-ui'
7
+ import { MaybeRef, VNode } from 'vue'
8
+
9
+ import { PublicProps } from '@ithinkdt/common'
10
+ import { DictItem, DictTypeKey } from '@ithinkdt/common/dict'
11
+ import { PageOptions } from '@ithinkdt/page'
12
+
13
+ import { CheckboxesProps, RadiosProps, UserDeptProps, UserGroupOption } from './components'
14
+
15
+ type ShallowMaybeRef<T extends {}> = {
16
+ [Key in (keyof T)]: MaybeRef<T[Key]>
17
+ }
18
+
19
+ declare module '@ithinkdt/page' {
20
+ interface FormComponentPresets {
21
+ input: {
22
+ inputProps?: ShallowMaybeRef<Omit<InputProps, 'value' | 'onUpdate:value' | 'disabled'>> & PublicProps
23
+ inputSlots?: InputSlots
24
+ }
25
+ number: {
26
+ numberProps?: ShallowMaybeRef<Omit<InputNumberProps, 'value' | 'onUpdate:value' | 'disabled'> & PublicProps & {
27
+ valueType?: 'string' | 'number' | undefined
28
+ }>
29
+ numberSlots?: InputNumberSlots
30
+ }
31
+ select: {
32
+ selectProps?: ShallowMaybeRef<Omit<SelectProps, 'options' | 'value' | 'onUpdate:value' | 'disabled'> & PublicProps
33
+ & {
34
+ dictType?: DictTypeKey | undefined
35
+ options?: DictItem[] | (SelectOption | SelectGroupOption)[] | undefined
36
+ valueType?: 'string' | 'number' | undefined
37
+ }>
38
+ selectSlots?: SelectSlots
39
+ }
40
+
41
+ checkbox: {
42
+ checkboxProps?: ShallowMaybeRef<Omit<CheckboxProps, 'checked' | 'onUpdate:checked' | 'disabled'> & PublicProps>
43
+ checkboxSlots?: {
44
+ default?: (() => VNode[]) | undefined
45
+ checked?: (() => VNode[]) | undefined
46
+ unchecked?: (() => VNode[]) | undefined
47
+ }
48
+ }
49
+
50
+ checkboxes: {
51
+ checkboxesProps?: ShallowMaybeRef<Omit<CheckboxesProps, 'disabled'> & PublicProps
52
+ & {
53
+ dictType?: DictTypeKey | undefined
54
+ options?: DictItem[] | undefined
55
+ valueType?: 'string' | 'number' | undefined
56
+ }>
57
+ checkboxesSlots?: { }
58
+ }
59
+
60
+ radios: {
61
+ radiosProps?: ShallowMaybeRef<Omit<RadiosProps, 'disabled'> & PublicProps
62
+ & {
63
+ dictType?: DictTypeKey | undefined
64
+ options?: DictItem[] | undefined
65
+ valueType?: 'string' | 'number' | undefined
66
+ }>
67
+ radiosSlots?: { }
68
+ }
69
+
70
+ datepicker: {
71
+ datepickerProps?: ShallowMaybeRef<Omit<DatePickerProps, 'value' | 'onUpdate:value' | 'disabled'> & PublicProps>
72
+ datepickerSlots?: DatePickerSlots
73
+ }
74
+
75
+ file: {
76
+ fileProps?: ShallowMaybeRef<{
77
+ type?: 'file' | 'image' | undefined
78
+ multiple?: boolean | undefined
79
+ max?: number | undefined
80
+ accept?: string | undefined
81
+ maxSize?: number | undefined
82
+ onBeforeUpload?: UploadProps['onBeforeUpload']
83
+ } & PublicProps>
84
+ fileSlots?: {
85
+ default?: (() => VNode[]) | undefined
86
+ }
87
+ }
88
+ upload: {
89
+ uploadProps?: ShallowMaybeRef<{
90
+ type?: 'file' | 'image' | undefined
91
+ multiple?: boolean | undefined
92
+ max?: number | undefined
93
+ accept?: string | undefined
94
+ maxSize?: number | undefined
95
+ onBeforeUpload?: UploadProps['onBeforeUpload']
96
+ } & PublicProps>
97
+ uploadSlots?: {
98
+ default?: (() => VNode[]) | undefined
99
+ }
100
+ }
101
+
102
+ user: {
103
+ userProps?: ShallowMaybeRef<Omit<UserDeptProps<boolean>, 'modelValue' | 'onUpdate:modelValue' | 'disabled'
104
+ | 'users' | 'groups' | 'depts' | 'getUsersByGroup' | 'getUsersByDept'>> & PublicProps
105
+ userSlots?: {}
106
+ }
107
+ }
108
+
109
+ interface DescriptionTypePresets {
110
+ number: {
111
+ numberParams: ShallowMaybeRef<{
112
+ /** 保留 n 位小数(保留 0) */
113
+ fixed?: number | undefined
114
+ /** 保留 n 位小数(不保留 0) */
115
+ round?: number | undefined
116
+ /** 保留 n 位数(不保留 0) */
117
+ precision?: number | undefined
118
+ /** 使用数字分隔符 */
119
+ separator?: boolean | undefined
120
+ /** 是否为百分数 */
121
+ percent?: boolean | undefined
122
+ }>
123
+ }
124
+
125
+ date: {
126
+ dateParams: ShallowMaybeRef<{
127
+ formatter?: 'yyyy-MM-dd' | 'yyyy/MM/dd' | string & {} | undefined
128
+ }>
129
+ }
130
+
131
+ datetime: {
132
+ datetimeParams: ShallowMaybeRef<{
133
+ formatter?: 'yyyy-MM-dd HH:mm' | 'yyyy-MM-dd HH:mm:ss' | string & {} | undefined
134
+ }>
135
+ }
136
+
137
+ dict: {
138
+ dictParams: ShallowMaybeRef<{
139
+ dictType?: DictTypeKey | undefined
140
+ options?: DictItem[] | (SelectOption | SelectGroupOption)[] | undefined
141
+ multiple?: boolean | undefined
142
+ labelField?: string | undefined
143
+ valueField?: string | undefined
144
+ statusMap?: Record<string, 'primary' | 'success' | 'warning' | 'danger' | string & {} | undefined> | undefined
145
+ }>
146
+ }
147
+ email: {}
148
+ url: {}
149
+ color: {}
150
+ file: {
151
+ fileParams: ShallowMaybeRef<{ multiple?: boolean | undefined }>
152
+ }
153
+ image: {
154
+ fileParams: ShallowMaybeRef<{ multiple?: boolean | undefined }>
155
+ }
156
+ user: {
157
+ fileParams: ShallowMaybeRef<{ multiple?: boolean | undefined }>
158
+ }
159
+ dept: {
160
+ fileParams: ShallowMaybeRef<{ multiple?: boolean | undefined }>
161
+ }
162
+ }
163
+
164
+ type ModalOptionsKey = 'type' | keyof import('@ithinkdt/page').ModalOptionsBase
165
+
166
+ interface ModalDrawerOptions extends ShallowMaybeRef<Omit<DrawerContentProps, ModalOptionsKey>>, ShallowMaybeRef<Omit<DrawerProps, ModalOptionsKey>> { }
167
+
168
+ interface ModalDialogOptions extends ShallowMaybeRef<Omit<ModalOptions, ModalOptionsKey>> {}
169
+ }
170
+
171
+ export declare function createPageFormHelper(options?: {
172
+ getUserGroups?: (() => Promise<UserGroupOption[]>) | undefined
173
+ getUsersByGroup?: ((code: string) => Promise<{ username: string, nickname: string }[]>) | undefined
174
+ getUsersByDept?: ((code: string) => Promise<{ username: string, nickname: string }[]>) | undefined
175
+ getUsersByUsername?: ((usernames: string[]) => Promise<{ username: string, nickname: string }[]>) | undefined
176
+ getDeptsByCode?: (codes: string[]) => Promise<{ code: string, name: string }[]>
177
+ uploadFile?: (file: File, options?: {
178
+ onProgress?: ((percent: number) => void) | undefined
179
+ }) => Promise<string>
180
+ getFileInfos?: (files: string[]) => Promise<UploadFileInfo[]>
181
+ }): PageOptions['getFormItemRenderer']
182
+ export declare function createDescriptionHelper(options?: {
183
+ getUsersByUsername?: (usernames: string[]) => Promise<{ username: string, nickname: string }[]>
184
+ getDeptsByCode?: (codes: string[]) => Promise<{ code: string, name: string }[]>
185
+ getFileInfos?: (fileIds: string[]) => Promise<UploadFileInfo[]>
186
+ previewFileUrl?: (fileId: string) => string
187
+ }): PageOptions['getDescriptionRenderer']
188
+ export declare function createFormHelper(options?: { }): PageOptions['getFormRenderer']
189
+ export declare function createModalHelper(options?: { }): PageOptions['getModalRenderer']
package/esm/page.js ADDED
@@ -0,0 +1 @@
1
+ export * from '../dist/page.js'
@@ -0,0 +1,10 @@
1
+ import _useStyle from 'ithinkdt-ui/es/_mixins/use-style'
2
+ import { Ref } from 'vue'
3
+
4
+ export { c, cB, cE, cM } from 'ithinkdt-ui/es/_utils/cssr/index'
5
+
6
+ export declare function useClsPrefix(): Ref<string>
7
+
8
+ declare function useStyle(...params: Parameters<typeof _useStyle>): Ref<string>
9
+
10
+ export default useStyle
@@ -0,0 +1 @@
1
+ export { c, cB, cE, cM, default, useClsPrefix } from '../dist/use-style.js'
package/locale.d.ts ADDED
@@ -0,0 +1,78 @@
1
+ export interface UILocale {
2
+ all: string
3
+ back: string
4
+ layout: {
5
+ sider: {
6
+ collapse: string
7
+ expand: string
8
+ }
9
+ screen: {
10
+ full: string
11
+ exitfull: string
12
+ }
13
+ mode: {
14
+ auto: string
15
+ light: string
16
+ dark: string
17
+ }
18
+ tabs: {
19
+ exitFullTab: string
20
+ fullTab: string
21
+ reloadTab: string
22
+ openTabBlank: string
23
+ closeAllTabs: string
24
+ closeLeftTabs: string
25
+ closeRightTabs: string
26
+ closeOtherTabs: string
27
+ }
28
+ }
29
+ account: {
30
+ logout: string
31
+ changePwd: string
32
+ changeTenant: string
33
+ }
34
+ notification: {
35
+ tip: (params: { count?: number | null }) => string
36
+ title: string
37
+ all: string
38
+ unread: (params: { count: string }) => string
39
+ markPageRead: string
40
+ markRead: string
41
+ markDelete: string
42
+ time: string
43
+ }
44
+ timeago: (params: { time: string | number | Date }) => string
45
+ page: {
46
+ selection: {
47
+ countText: (params: { count: number }) => string
48
+ back: string
49
+ view: string
50
+ clear: string
51
+ }
52
+ pagination: {
53
+ prefix: (params: { total: number }) => string
54
+ suffix: string
55
+ }
56
+ custom: {
57
+ tooltip: string
58
+ reset: string
59
+ }
60
+ form: {
61
+ submitText: string
62
+ resetText: string
63
+ cancelText: string
64
+ selectFileText: string
65
+ validate: {
66
+ fileErrorMessage: string
67
+ }
68
+ }
69
+ filter: {
70
+ submitText: string
71
+ expand: string
72
+ collapse: string
73
+ }
74
+ }
75
+ }
76
+
77
+ declare const locale: UILocale
78
+ export default locale