@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.
- package/README.md +1 -0
- package/auto-imports.d.ts +15 -0
- package/auto-imports.js +34 -0
- package/locale.d.ts +74 -0
- package/package.json +99 -0
- package/src/components.d.ts +435 -0
- package/src/design.d.ts +234 -0
- package/src/directives.d.ts +42 -0
- package/src/index.d.ts +19 -0
- package/src/index.js +1361 -0
- package/src/page.d.ts +153 -0
- package/src/use-style.d.ts +10 -0
- package/unocss.d.ts +5 -0
- package/unocss.js +95 -0
package/src/page.d.ts
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CheckboxProps, DatePickerProps, DatePickerSlots,
|
|
3
|
+
DrawerContentProps, DrawerProps,
|
|
4
|
+
InputNumberProps, InputNumberSlots, InputProps, InputSlots,
|
|
5
|
+
ModalOptions,
|
|
6
|
+
SelectGroupOption, SelectOption, SelectProps, SelectSlots,
|
|
7
|
+
UploadFileInfo,
|
|
8
|
+
} from 'ithinkdt-ui'
|
|
9
|
+
import { MaybeRef, VNode, VNodeProps } from 'vue'
|
|
10
|
+
|
|
11
|
+
import { DictItem, DictTypeKey } from '@ithinkdt/common/dict'
|
|
12
|
+
import { PageOptions } from '@ithinkdt/page'
|
|
13
|
+
|
|
14
|
+
import { CheckboxesProps, RadiosProps, UserDeptProps, UserGroupOption } from './components'
|
|
15
|
+
|
|
16
|
+
type DeepMaybeRef<T extends {}> = {
|
|
17
|
+
[Key in (keyof T)]: MaybeRef<T[Key]>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
declare module '@ithinkdt/page' {
|
|
21
|
+
interface FormComponentPresets {
|
|
22
|
+
input: {
|
|
23
|
+
props?: DeepMaybeRef<Omit<InputProps, 'value' | 'onUpdate:value' | 'disabled'>> & VNodeProps
|
|
24
|
+
slots?: InputSlots
|
|
25
|
+
}
|
|
26
|
+
number: {
|
|
27
|
+
props?: DeepMaybeRef<Omit<InputNumberProps, 'value' | 'onUpdate:value' | 'disabled'>> & VNodeProps
|
|
28
|
+
slots?: InputNumberSlots
|
|
29
|
+
}
|
|
30
|
+
select: {
|
|
31
|
+
props?: DeepMaybeRef<Omit<SelectProps, 'options' | 'value' | 'onUpdate:value' | 'disabled'> & VNodeProps
|
|
32
|
+
& {
|
|
33
|
+
dictType?: DictTypeKey | undefined
|
|
34
|
+
options?: DictItem[] | (SelectOption | SelectGroupOption)[] | undefined
|
|
35
|
+
}>
|
|
36
|
+
slots?: SelectSlots
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
checkbox: {
|
|
40
|
+
props?: DeepMaybeRef<Omit<CheckboxProps, 'checked' | 'onUpdate:checked' | 'disabled'>> & VNodeProps
|
|
41
|
+
slots?: {
|
|
42
|
+
default?: (() => VNode[]) | undefined
|
|
43
|
+
checked?: (() => VNode[]) | undefined
|
|
44
|
+
unchecked?: (() => VNode[]) | undefined
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
checkboxes: {
|
|
49
|
+
props?: DeepMaybeRef<Omit<CheckboxesProps, 'disabled'> & VNodeProps
|
|
50
|
+
& {
|
|
51
|
+
dictType?: DictTypeKey | undefined
|
|
52
|
+
options?: DictItem[] | undefined
|
|
53
|
+
}>
|
|
54
|
+
slots?: { }
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
radios: {
|
|
58
|
+
props?: DeepMaybeRef<Omit<RadiosProps, 'disabled'> & VNodeProps
|
|
59
|
+
& {
|
|
60
|
+
dictType?: DictTypeKey | undefined
|
|
61
|
+
options?: DictItem[] | undefined
|
|
62
|
+
}>
|
|
63
|
+
slots?: { }
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
datepicker: {
|
|
67
|
+
props?: DeepMaybeRef<Omit<DatePickerProps, 'value' | 'onUpdate:value' | 'disabled'>> & VNodeProps
|
|
68
|
+
slots?: DatePickerSlots
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
file: {
|
|
72
|
+
props?: DeepMaybeRef<{
|
|
73
|
+
type?: 'file' | 'image' | undefined
|
|
74
|
+
multiple?: boolean | undefined
|
|
75
|
+
max?: number | undefined
|
|
76
|
+
accept?: string | undefined
|
|
77
|
+
maxSize?: number | undefined
|
|
78
|
+
} & VNodeProps>
|
|
79
|
+
slots?: {
|
|
80
|
+
default?: (() => VNode[]) | undefined
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
user: {
|
|
85
|
+
props?: DeepMaybeRef<Omit<UserDeptProps<boolean>, 'modelValue' | 'onUpdate:modelValue' | 'disabled'
|
|
86
|
+
| 'users' | 'groups' | 'depts' | 'getUsersByGroup' | 'getUsersByDept'>> & VNodeProps
|
|
87
|
+
slots?: {}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface TableTypePresets {
|
|
92
|
+
number: {
|
|
93
|
+
/** 保留 n 位小数(保留 0) */
|
|
94
|
+
fixed?: number | undefined
|
|
95
|
+
/** 保留 n 位小数(不保留 0) */
|
|
96
|
+
round?: number | undefined
|
|
97
|
+
/** 保留 n 位数(不保留 0) */
|
|
98
|
+
precision?: number | undefined
|
|
99
|
+
/** 使用数字分隔符 */
|
|
100
|
+
separator?: boolean | undefined
|
|
101
|
+
/** 是否为百分数 */
|
|
102
|
+
percent?: boolean | undefined
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
date: {
|
|
106
|
+
formatter?: 'yyyy-MM-dd' | 'yyyy/MM/dd' | string & {} | undefined
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
datetime: {
|
|
110
|
+
formatter?: 'yyyy-MM-dd HH:mm' | 'yyyy-MM-dd HH:mm:ss' | string & {} | undefined
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
dict: {
|
|
114
|
+
dictType?: DictTypeKey | undefined
|
|
115
|
+
options?: DictItem[] | (SelectOption | SelectGroupOption)[] | undefined
|
|
116
|
+
multiple?: boolean | undefined
|
|
117
|
+
labelField?: string | undefined
|
|
118
|
+
valueField?: string | undefined
|
|
119
|
+
statusMap?: Record<string, 'primary' | 'success' | 'warning' | 'danger' | string & {} | undefined> | undefined
|
|
120
|
+
}
|
|
121
|
+
email: {}
|
|
122
|
+
url: {}
|
|
123
|
+
color: {}
|
|
124
|
+
file: { multiple?: boolean | undefined }
|
|
125
|
+
image: { multiple?: boolean | undefined }
|
|
126
|
+
user: { multiple?: boolean | undefined }
|
|
127
|
+
dept: { multiple?: boolean | undefined }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
type ModalOptionsKey = 'type' | keyof import('@ithinkdt/page').ModalOptions
|
|
131
|
+
interface ModalDrawerOptions extends DeepMaybeRef<Omit<DrawerContentProps, ModalOptionsKey>>, DeepMaybeRef<Omit<DrawerProps, ModalOptionsKey>> { }
|
|
132
|
+
|
|
133
|
+
interface ModalDialogOptions extends DeepMaybeRef<Omit<ModalOptions, ModalOptionsKey>> {}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export declare function createPageFormHelper(options?: {
|
|
137
|
+
getUserGroups?: (() => Promise<UserGroupOption[]>) | undefined
|
|
138
|
+
getUsersByGroup?: ((code: string) => Promise<{ username: string, nickname: string }[]>) | undefined
|
|
139
|
+
getUsersByDept?: ((code: string) => Promise<{ username: string, nickname: string }[]>) | undefined
|
|
140
|
+
getUsersByUsername?: ((usernames: string[]) => Promise<{ username: string, nickname: string }[]>) | undefined
|
|
141
|
+
getDeptsByCode?: (codes: string[]) => Promise<{ code: string, name: string }[]>
|
|
142
|
+
uploadFile?: (file: File, options?: {
|
|
143
|
+
onProgress?: ((percent: number) => void) | undefined
|
|
144
|
+
}) => Promise<string>
|
|
145
|
+
}): PageOptions['getFormItemRenderer']
|
|
146
|
+
export declare function createPageTableHelper(options?: {
|
|
147
|
+
getUsersByUsername?: (usernames: string[]) => Promise<{ username: string, nickname: string }[]>
|
|
148
|
+
getDeptsByCode?: (codes: string[]) => Promise<{ code: string, name: string }[]>
|
|
149
|
+
getFileInfos?: (fileIds: string[]) => Promise<UploadFileInfo[]>
|
|
150
|
+
previewFileUrl?: (fileId: string) => string
|
|
151
|
+
}): PageOptions['getCellRenderer']
|
|
152
|
+
export declare function createFormHelper(options?: { }): PageOptions['getFormRenderer']
|
|
153
|
+
export declare function createModalHelper(options?: { }): PageOptions['getModalRenderer']
|
|
@@ -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
|
package/unocss.d.ts
ADDED
package/unocss.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
const ithinkdt = () => {
|
|
2
|
+
return {
|
|
3
|
+
name: 'preset-ithinkdt',
|
|
4
|
+
theme: {
|
|
5
|
+
colors: {
|
|
6
|
+
...Object.fromEntries(
|
|
7
|
+
['primary', 'success', 'warning', 'danger'].map(name => [
|
|
8
|
+
name,
|
|
9
|
+
{
|
|
10
|
+
DEFAULT: `rgb(var(--color-${name}-rgb) / <alpha-value>)`,
|
|
11
|
+
...Object.fromEntries(
|
|
12
|
+
['hover', 'active'].map(level => [
|
|
13
|
+
level,
|
|
14
|
+
`rgb(var(--color-${name}-${level}-rgb) / <alpha-value>)`,
|
|
15
|
+
]),
|
|
16
|
+
),
|
|
17
|
+
},
|
|
18
|
+
]),
|
|
19
|
+
),
|
|
20
|
+
text: {
|
|
21
|
+
DEFAULT: `rgb(var(--color-text-rgb))`,
|
|
22
|
+
},
|
|
23
|
+
base: {
|
|
24
|
+
DEFAULT: `rgb(var(--color-base-rgb))`,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
borderRadius: Object.fromEntries(
|
|
28
|
+
['tiny', 'small', 'medium', 'large'].map(size => [size, `var(--rounded-${size})`]),
|
|
29
|
+
),
|
|
30
|
+
},
|
|
31
|
+
variants: [
|
|
32
|
+
// stuck:
|
|
33
|
+
(matcher) => {
|
|
34
|
+
const array = ['top', 'right', 'bottom', 'left']
|
|
35
|
+
const index = array.findIndex(it => matcher.startsWith(`stuck-${it}:`))
|
|
36
|
+
if (index === -1)
|
|
37
|
+
return matcher
|
|
38
|
+
return {
|
|
39
|
+
matcher: matcher.slice(7 + array[index].length),
|
|
40
|
+
handle: (input, next) => next({
|
|
41
|
+
...input,
|
|
42
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ''} @container scroll-state(stuck: ${array[index]})`,
|
|
43
|
+
}),
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
rules: [
|
|
48
|
+
['scroll-state', { 'container-type': 'scroll-state' }],
|
|
49
|
+
[
|
|
50
|
+
/^bg-img-(.*)$/,
|
|
51
|
+
([_, r]) => {
|
|
52
|
+
return {
|
|
53
|
+
'background-image': r[0] === '[' && r.at(-1) === ']' ? r.slice(1, -1) : r,
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
/^mask-(.*)$/,
|
|
59
|
+
([_, r]) => {
|
|
60
|
+
const mask = `var(--un-icon) no-repeat`
|
|
61
|
+
return {
|
|
62
|
+
'--un-icon': r[0] === '[' && r.at(-1) === ']' ? r.slice(1, -1) : r,
|
|
63
|
+
mask,
|
|
64
|
+
'mask-size': '100% 100%',
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
],
|
|
69
|
+
shortcuts: [
|
|
70
|
+
[
|
|
71
|
+
/^card-(.*)$/,
|
|
72
|
+
([_, size]) => {
|
|
73
|
+
const i = ['none', 'small', 'medium', 'large'].indexOf(size)
|
|
74
|
+
if (i === -1) return
|
|
75
|
+
const p = [0, 2, 4, 5][i]
|
|
76
|
+
return `rounded-${size} px-${p + 1} py-${p} bg-white dark:bg-dark ease-in-out transition-shadow
|
|
77
|
+
hover:shadow-[0_1px_2px_0_rgba(0_0_0_/_0.03),0_1px_6px_-1px_rgba(0_0_0_/_0.02),0_2px_4px_0_rgba(0_0_0_/_0.02)]`
|
|
78
|
+
},
|
|
79
|
+
{ autocomplete: ['card-none', 'card-small', 'card-medium', 'card-large'] },
|
|
80
|
+
],
|
|
81
|
+
{
|
|
82
|
+
'ell': 'truncate',
|
|
83
|
+
'ell-2': 'line-clamp-2',
|
|
84
|
+
'ell-3': 'line-clamp-3',
|
|
85
|
+
'flex-x-center': 'flex items-center',
|
|
86
|
+
'flex-y-center': 'flex justify-center',
|
|
87
|
+
'flex-center': 'flex justify-center items-center',
|
|
88
|
+
'page': 'flex flex-col p-5 gap-4',
|
|
89
|
+
'card': `card-medium`,
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export default ithinkdt
|