@ithinkdt/ui 4.0.0-50 → 4.0.0-501
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/auto-imports.js +5 -2
- package/dist/components-C-o-dBCE.js +1893 -0
- package/dist/components.js +5 -5
- package/dist/{directives-DUuJW647.js → directives-Bpfh9AKg.js} +73 -62
- package/dist/directives.js +2 -2
- package/dist/index.js +6 -18
- package/dist/page.js +310 -277
- package/dist/use-style.js +1 -1
- package/esm/components.d.ts +104 -19
- package/esm/page.d.ts +55 -36
- package/package.json +12 -12
- package/unocss-preset.d.ts +5 -0
- package/unocss-preset.js +163 -0
- package/dist/components-BC8oa62b.js +0 -1612
- package/unocss.d.ts +0 -5
- package/unocss.js +0 -94
- /package/dist/{use-i18n-Dx7V4KrY.js → use-i18n-D-AJ8KbA.js} +0 -0
- /package/dist/{use-style-DcT-1dj4.js → use-style-mj2B1q0l.js} +0 -0
package/dist/use-style.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as flex, c as flexDirCol, d as flexJustifySB, f as fullHeight, g as useStyle, h as useMergedClsPrefix, i as cM, l as flexGap, m as fullWidth, n as cB, o as flexAlignCenter, p as fullWH, r as cE, s as flexCenter, t as c, u as flexJustifyCenter } from "./use-style-
|
|
1
|
+
import { a as flex, c as flexDirCol, d as flexJustifySB, f as fullHeight, g as useStyle, h as useMergedClsPrefix, i as cM, l as flexGap, m as fullWidth, n as cB, o as flexAlignCenter, p as fullWH, r as cE, s as flexCenter, t as c, u as flexJustifyCenter } from "./use-style-mj2B1q0l.js";
|
|
2
2
|
export { c, cB, cE, cM, useStyle as default, flex, flexAlignCenter, flexCenter, flexDirCol, flexGap, flexJustifyCenter, flexJustifySB, fullHeight, fullWH, fullWidth, useMergedClsPrefix as useClsPrefix };
|
package/esm/components.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
AnchorProps,
|
|
3
|
+
ButtonProps,
|
|
4
|
+
ButtonSlots,
|
|
5
|
+
CheckboxGroupProps, DataTableInst as NDataTableInst, DataTableProps as NDataTableProps, FlexProps,
|
|
3
6
|
FormItemGiProps as NFormItemGiProps, FormProps as NFormProps, GridItemProps as NGridItemProps, GridProps as NGridProps,
|
|
4
7
|
PopoverProps,
|
|
5
8
|
RadioGroupProps, TransferProps,
|
|
@@ -10,12 +13,18 @@ import type { CSSProperties, HTMLAttributes, TemplateRef } from 'vue'
|
|
|
10
13
|
|
|
11
14
|
import { GenericCtx, GenericExposed, GenericReturn, MaybeArray, MaybePromise, PublicProps } from '@ithinkdt/common'
|
|
12
15
|
import { DictItem } from '@ithinkdt/common/dict'
|
|
13
|
-
import { FormItem, PageParams, PresetKeyField, SortParams, TableActionRenderParam, TableColumn, ValidationResults, _DataWithPresetKeyField } from '@ithinkdt/page'
|
|
16
|
+
import { DescriptionItem, FormItem, PageParams, PresetKeyField, SortParams, TableActionRenderParam, TableColumn, TableTypePresets, ValidationResults, _DataWithPresetKeyField } from '@ithinkdt/page'
|
|
14
17
|
|
|
15
18
|
declare module '@ithinkdt/page' {
|
|
16
19
|
|
|
17
20
|
interface FormRenderExtraOptions {
|
|
18
21
|
showColon?: MaybeRef<boolean | undefined>
|
|
22
|
+
labelWidth?: MaybeRef<string | number | undefined>
|
|
23
|
+
labelAlign?: MaybeRef<'left' | 'right' | 'center' | undefined>
|
|
24
|
+
labelPlacement?: MaybeRef<'left' | 'top' | undefined>
|
|
25
|
+
showRequireMark?: MaybeRef<boolean | undefined>
|
|
26
|
+
requireMarkPlacement?: MaybeRef<'left' | 'right' | 'right-hanging' | undefined>
|
|
27
|
+
showFeedback?: MaybeRef<boolean | undefined>
|
|
19
28
|
}
|
|
20
29
|
|
|
21
30
|
type FormItemOptionKeys = 'size' | 'showLabel' | 'labelWidth' | 'labelStyle' | 'labelAlign' | 'labelPlacement' | 'labelProps'
|
|
@@ -45,19 +54,35 @@ declare module '@ithinkdt/page' {
|
|
|
45
54
|
interface FormItemRenderExtraParams {
|
|
46
55
|
size?: 'small' | 'medium' | 'large' | undefined
|
|
47
56
|
}
|
|
57
|
+
}
|
|
48
58
|
|
|
59
|
+
export type NStateButtonProps = ButtonProps & {
|
|
60
|
+
succeeded?: boolean | null | undefined
|
|
61
|
+
successText?: string | undefined
|
|
62
|
+
failureText?: string | undefined
|
|
49
63
|
}
|
|
50
64
|
|
|
51
|
-
export type
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
65
|
+
export type NStateButtonEmits = {
|
|
66
|
+
(e: 'click', evt: MouseEvent): void
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type NStateButtonSlots = ButtonSlots & {
|
|
70
|
+
success?: () => VNodeChild
|
|
71
|
+
failure?: () => VNodeChild
|
|
72
|
+
successIcon?: () => VNodeChild
|
|
73
|
+
failureIcon?: () => VNodeChild
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export declare function NStateButton(
|
|
77
|
+
props: NStateButtonProps & PublicProps,
|
|
78
|
+
ctx?: Pick<GenericCtx<NStateButtonProps, NStateButtonEmits, NStateButtonSlots>, 'attrs' | 'emit' | 'slots'>,
|
|
79
|
+
expose?: (exposed?: GenericExposed) => void,
|
|
80
|
+
setup?: GenericCtx<NStateButtonProps, NStateButtonEmits, NStateButtonSlots>,
|
|
81
|
+
): GenericReturn<NStateButtonProps, NStateButtonEmits, NStateButtonSlots>
|
|
82
|
+
|
|
83
|
+
export type DataFormActionsProps = Pick<FlexProps, 'align' | 'justify' | 'vertical' | 'reverse'> & {
|
|
84
|
+
size?: 'small' | 'medium' | 'large' | undefined
|
|
85
|
+
gap?: number | string | undefined
|
|
61
86
|
submitText?: VNodeChild | undefined
|
|
62
87
|
resetText?: VNodeChild | undefined
|
|
63
88
|
cancelText?: VNodeChild | undefined
|
|
@@ -65,21 +90,61 @@ export type DataFormProps<Data extends {}> = Omit<NFormProps, 'model' | 'rules'
|
|
|
65
90
|
showResetBtn?: boolean | undefined
|
|
66
91
|
showCancelBtn?: boolean | undefined
|
|
67
92
|
submitDisabled?: boolean | undefined
|
|
93
|
+
submitLoading?: boolean | undefined
|
|
68
94
|
succeeded?: boolean | undefined
|
|
69
95
|
successText?: VNodeChild | undefined
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
onSubmit?: MaybeArray<(model: Data) => void> | undefined
|
|
96
|
+
failureText?: VNodeChild | undefined
|
|
97
|
+
onSubmit?: MaybeArray<() => void> | undefined
|
|
73
98
|
onRest?: MaybeArray<() => void> | undefined
|
|
99
|
+
onCancel?: MaybeArray<() => void> | undefined
|
|
100
|
+
nativeButtonType?: boolean | undefined
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export type DataFormActionsEmits = {
|
|
104
|
+
(e: 'submit'): void
|
|
105
|
+
(e: 'reset'): void
|
|
106
|
+
(e: 'cancel'): void
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export type DataFormActionsSlots = {
|
|
110
|
+
prefix?: () => VNodeChild
|
|
111
|
+
suffix?: () => VNodeChild
|
|
74
112
|
}
|
|
75
113
|
|
|
114
|
+
export declare function DataFormActions(
|
|
115
|
+
props: DataFormActionsProps & PublicProps,
|
|
116
|
+
ctx?: Pick<GenericCtx<DataFormActionsProps, DataFormActionsEmits, DataFormActionsSlots>, 'attrs' | 'emit' | 'slots'>,
|
|
117
|
+
expose?: (exposed?: GenericExposed) => void,
|
|
118
|
+
setup?: GenericCtx<DataFormActionsProps, DataFormActionsEmits, DataFormActionsSlots>,
|
|
119
|
+
): GenericReturn<DataFormActionsProps, DataFormActionsEmits, DataFormActionsSlots>
|
|
120
|
+
|
|
121
|
+
export type DataFormProps<Data extends {}> = Omit<NFormProps, 'model' | 'rules' | 'onSubmit' | 'validateMessages'>
|
|
122
|
+
& Omit<DataFormActionsProps, 'onSubmit' | 'size' | 'gap' | 'justify' | 'direction' | 'submitloading'> & {
|
|
123
|
+
items: FormItem<Data>[]
|
|
124
|
+
model: Data
|
|
125
|
+
readonly?: boolean | undefined
|
|
126
|
+
grid?: boolean | NGridProps | undefined
|
|
127
|
+
validation?: { [k in keyof Data]?: ValidationResults } | undefined
|
|
128
|
+
showColon?: boolean | undefined
|
|
129
|
+
tooltipPlacement?: 'bottom' | 'icon' | undefined
|
|
130
|
+
loading?: boolean | undefined
|
|
131
|
+
showAction?: boolean | NGridItemProps & AllowedComponentProps | undefined
|
|
132
|
+
actionJustify?: DataFormActionsProps['justify']
|
|
133
|
+
actionAlign?: DataFormActionsProps['align']
|
|
134
|
+
actionGap?: DataFormActionsProps['gap']
|
|
135
|
+
onSubmit?: MaybeArray<(model: Data) => void> | undefined
|
|
136
|
+
}
|
|
137
|
+
|
|
76
138
|
export type DataFormEmits<Data extends {}> = {
|
|
77
139
|
(e: 'submit', model: Data): void
|
|
78
140
|
(e: 'reset'): void
|
|
141
|
+
(e: 'cancel'): void
|
|
79
142
|
}
|
|
80
143
|
|
|
81
144
|
export type DataFormSlots<_Data extends {}> = {
|
|
82
145
|
action?: (params: { cols: number, spans: number, overflow: boolean }) => VNodeChild
|
|
146
|
+
actionPrefix?: () => VNodeChild
|
|
147
|
+
actionSuffix?: () => VNodeChild
|
|
83
148
|
}
|
|
84
149
|
|
|
85
150
|
export type DataFormInst = {
|
|
@@ -367,6 +432,7 @@ export interface UserGroupOption {
|
|
|
367
432
|
name: string
|
|
368
433
|
}
|
|
369
434
|
export interface DeptOption {
|
|
435
|
+
id?: string | undefined
|
|
370
436
|
code: string
|
|
371
437
|
name: string
|
|
372
438
|
children?: DeptOption[]
|
|
@@ -381,8 +447,9 @@ interface UserDeptProps<Multiple extends boolean> {
|
|
|
381
447
|
'defaultExpandAll'?: boolean | undefined
|
|
382
448
|
'filterable'?: boolean | undefined
|
|
383
449
|
'disabled'?: boolean | undefined
|
|
384
|
-
'size'?: TransferProps['size']
|
|
385
|
-
'
|
|
450
|
+
'size'?: TransferProps['size']
|
|
451
|
+
'valueField'?: 'id' | 'username' | 'code' | undefined
|
|
452
|
+
'users'?: { id?: string | undefined, username: string, nickname: string }[] | undefined
|
|
386
453
|
'groups'?: UserGroupOption[] | undefined
|
|
387
454
|
'depts'?: DeptOption[] | undefined
|
|
388
455
|
'getUsersByGroup'?: ((code: string) => Promise<{ username: string, nickname: string }[]>) | undefined
|
|
@@ -397,12 +464,12 @@ interface UserDeptEmits<Multiple extends boolean> {
|
|
|
397
464
|
(e: 'updateModelValue', value: Multiple extends true ? string[] : string): void
|
|
398
465
|
}
|
|
399
466
|
|
|
400
|
-
export declare
|
|
467
|
+
export declare function DtUserDept<Multiple extends boolean>(
|
|
401
468
|
props: UserDeptProps<Multiple> & PublicProps,
|
|
402
469
|
ctx?: Pick<GenericCtx<UserDeptProps<Multiple>, UserDeptEmits<Multiple>>, 'attrs' | 'emit' | 'slots'>,
|
|
403
470
|
expose?: (exposed?: GenericExposed<{}>) => void,
|
|
404
471
|
setup?: GenericCtx<UserDeptProps<Multiple>, UserDeptEmits<Multiple>, {}, {}>,
|
|
405
|
-
)
|
|
472
|
+
): GenericReturn<UserDeptProps<Multiple>, UserDeptEmits<Multiple>, {}, {}>
|
|
406
473
|
|
|
407
474
|
interface UserRenderProps {
|
|
408
475
|
value?: string | string[] | null | undefined
|
|
@@ -438,3 +505,21 @@ export declare const DtDeptRender: (
|
|
|
438
505
|
expose?: (exposed?: GenericExposed<{}>) => void,
|
|
439
506
|
setup?: GenericCtx<DeptRenderProps, DeptRenderEmits, {}, {}>,
|
|
440
507
|
) => GenericReturn<DeptRenderProps, DeptRenderEmits, {}, {}>
|
|
508
|
+
|
|
509
|
+
export interface DataDescriptionsProps<Data extends object> {
|
|
510
|
+
cols?: number
|
|
511
|
+
data: Data | undefined | null
|
|
512
|
+
items: DescriptionItem<Data>[]
|
|
513
|
+
title?: VNodeChild | ((data: Data | undefined) => VNodeChild)
|
|
514
|
+
anchor?: boolean | AnchorProps & AllowedComponentProps | undefined
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
export interface DataDescriptionsEmits {
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
export declare function DataDescriptions<Data extends {}>(
|
|
521
|
+
props: DataDescriptionsProps<Data> & PublicProps,
|
|
522
|
+
ctx?: Pick<GenericCtx<DataDescriptionsProps<Data>, DataDescriptionsEmits>, 'attrs' | 'emit' | 'slots'>,
|
|
523
|
+
expose?: (exposed?: GenericExposed<{}>) => void,
|
|
524
|
+
setup?: GenericCtx<DataDescriptionsProps<Data>, DataDescriptionsEmits, {}, {}>,
|
|
525
|
+
): GenericReturn<DataDescriptionsProps<Data>, DataDescriptionsEmits, {}, {}>
|
package/esm/page.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CheckboxProps,
|
|
3
|
-
DatePickerProps, DatePickerSlots,
|
|
4
|
-
DrawerContentProps, DrawerProps,
|
|
2
|
+
CheckboxProps, DatePickerProps, DatePickerSlots, DrawerContentProps, DrawerProps,
|
|
5
3
|
InputNumberProps, InputNumberSlots, InputProps, InputSlots,
|
|
6
|
-
ModalOptions,
|
|
7
|
-
SelectGroupOption, SelectOption, SelectProps, SelectSlots,
|
|
4
|
+
ModalOptions, SelectGroupOption, SelectOption, SelectProps, SelectSlots,
|
|
8
5
|
UploadFileInfo, UploadProps,
|
|
9
6
|
} from 'ithinkdt-ui'
|
|
10
7
|
import { MaybeRef, VNode } from 'vue'
|
|
@@ -26,7 +23,9 @@ declare module '@ithinkdt/page' {
|
|
|
26
23
|
inputSlots?: InputSlots
|
|
27
24
|
}
|
|
28
25
|
number: {
|
|
29
|
-
numberProps?: ShallowMaybeRef<Omit<InputNumberProps, 'value' | 'onUpdate:value' | 'disabled'
|
|
26
|
+
numberProps?: ShallowMaybeRef<Omit<InputNumberProps, 'value' | 'onUpdate:value' | 'disabled'> & PublicProps & {
|
|
27
|
+
valueType?: 'string' | 'number' | undefined
|
|
28
|
+
}>
|
|
30
29
|
numberSlots?: InputNumberSlots
|
|
31
30
|
}
|
|
32
31
|
select: {
|
|
@@ -34,12 +33,13 @@ declare module '@ithinkdt/page' {
|
|
|
34
33
|
& {
|
|
35
34
|
dictType?: DictTypeKey | undefined
|
|
36
35
|
options?: DictItem[] | (SelectOption | SelectGroupOption)[] | undefined
|
|
36
|
+
valueType?: 'string' | 'number' | undefined
|
|
37
37
|
}>
|
|
38
38
|
selectSlots?: SelectSlots
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
checkbox: {
|
|
42
|
-
checkboxProps?: ShallowMaybeRef<Omit<CheckboxProps, 'checked' | 'onUpdate:checked' | 'disabled'
|
|
42
|
+
checkboxProps?: ShallowMaybeRef<Omit<CheckboxProps, 'checked' | 'onUpdate:checked' | 'disabled'> & PublicProps>
|
|
43
43
|
checkboxSlots?: {
|
|
44
44
|
default?: (() => VNode[]) | undefined
|
|
45
45
|
checked?: (() => VNode[]) | undefined
|
|
@@ -52,6 +52,7 @@ declare module '@ithinkdt/page' {
|
|
|
52
52
|
& {
|
|
53
53
|
dictType?: DictTypeKey | undefined
|
|
54
54
|
options?: DictItem[] | undefined
|
|
55
|
+
valueType?: 'string' | 'number' | undefined
|
|
55
56
|
}>
|
|
56
57
|
checkboxesSlots?: { }
|
|
57
58
|
}
|
|
@@ -61,12 +62,13 @@ declare module '@ithinkdt/page' {
|
|
|
61
62
|
& {
|
|
62
63
|
dictType?: DictTypeKey | undefined
|
|
63
64
|
options?: DictItem[] | undefined
|
|
65
|
+
valueType?: 'string' | 'number' | undefined
|
|
64
66
|
}>
|
|
65
67
|
radiosSlots?: { }
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
datepicker: {
|
|
69
|
-
datepickerProps?: ShallowMaybeRef<Omit<DatePickerProps, 'value' | 'onUpdate:value' | 'disabled'
|
|
71
|
+
datepickerProps?: ShallowMaybeRef<Omit<DatePickerProps, 'value' | 'onUpdate:value' | 'disabled'> & PublicProps>
|
|
70
72
|
datepickerSlots?: DatePickerSlots
|
|
71
73
|
}
|
|
72
74
|
|
|
@@ -98,52 +100,69 @@ declare module '@ithinkdt/page' {
|
|
|
98
100
|
}
|
|
99
101
|
|
|
100
102
|
user: {
|
|
101
|
-
|
|
103
|
+
userProps?: ShallowMaybeRef<Omit<UserDeptProps<boolean>, 'modelValue' | 'onUpdate:modelValue' | 'disabled'
|
|
102
104
|
| 'users' | 'groups' | 'depts' | 'getUsersByGroup' | 'getUsersByDept'>> & PublicProps
|
|
103
|
-
|
|
105
|
+
userSlots?: {}
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
interface
|
|
109
|
+
interface DescriptionTypePresets {
|
|
108
110
|
number: {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
+
}>
|
|
119
123
|
}
|
|
120
124
|
|
|
121
125
|
date: {
|
|
122
|
-
|
|
126
|
+
dateParams: ShallowMaybeRef<{
|
|
127
|
+
formatter?: 'yyyy-MM-dd' | 'yyyy/MM/dd' | string & {} | undefined
|
|
128
|
+
}>
|
|
123
129
|
}
|
|
124
130
|
|
|
125
131
|
datetime: {
|
|
126
|
-
|
|
132
|
+
datetimeParams: ShallowMaybeRef<{
|
|
133
|
+
formatter?: 'yyyy-MM-dd HH:mm' | 'yyyy-MM-dd HH:mm:ss' | string & {} | undefined
|
|
134
|
+
}>
|
|
127
135
|
}
|
|
128
136
|
|
|
129
137
|
dict: {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
+
}>
|
|
136
146
|
}
|
|
137
147
|
email: {}
|
|
138
148
|
url: {}
|
|
139
149
|
color: {}
|
|
140
|
-
file: {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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
|
+
}
|
|
144
162
|
}
|
|
145
163
|
|
|
146
|
-
type ModalOptionsKey = 'type' | keyof import('@ithinkdt/page').
|
|
164
|
+
type ModalOptionsKey = 'type' | keyof import('@ithinkdt/page').ModalOptionsBase
|
|
165
|
+
|
|
147
166
|
interface ModalDrawerOptions extends ShallowMaybeRef<Omit<DrawerContentProps, ModalOptionsKey>>, ShallowMaybeRef<Omit<DrawerProps, ModalOptionsKey>> { }
|
|
148
167
|
|
|
149
168
|
interface ModalDialogOptions extends ShallowMaybeRef<Omit<ModalOptions, ModalOptionsKey>> {}
|
|
@@ -160,11 +179,11 @@ export declare function createPageFormHelper(options?: {
|
|
|
160
179
|
}) => Promise<string>
|
|
161
180
|
getFileInfos?: (files: string[]) => Promise<UploadFileInfo[]>
|
|
162
181
|
}): PageOptions['getFormItemRenderer']
|
|
163
|
-
export declare function
|
|
182
|
+
export declare function createDescriptionHelper(options?: {
|
|
164
183
|
getUsersByUsername?: (usernames: string[]) => Promise<{ username: string, nickname: string }[]>
|
|
165
184
|
getDeptsByCode?: (codes: string[]) => Promise<{ code: string, name: string }[]>
|
|
166
185
|
getFileInfos?: (fileIds: string[]) => Promise<UploadFileInfo[]>
|
|
167
186
|
previewFileUrl?: (fileId: string) => string
|
|
168
|
-
}): PageOptions['
|
|
187
|
+
}): PageOptions['getDescriptionRenderer']
|
|
169
188
|
export declare function createFormHelper(options?: { }): PageOptions['getFormRenderer']
|
|
170
189
|
export declare function createModalHelper(options?: { }): PageOptions['getModalRenderer']
|
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-501",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "iThinkDT UI",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"esm",
|
|
15
15
|
"auto-imports.*",
|
|
16
16
|
"locale.*",
|
|
17
|
-
"unocss
|
|
17
|
+
"unocss*"
|
|
18
18
|
],
|
|
19
19
|
"main": "./esm/index.js",
|
|
20
20
|
"module": "./esm/index.js",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"default": "./auto-imports.js"
|
|
49
49
|
},
|
|
50
50
|
"./unocss": {
|
|
51
|
-
"types": "./unocss.d.ts",
|
|
52
|
-
"default": "./unocss.js"
|
|
51
|
+
"types": "./unocss-preset.d.ts",
|
|
52
|
+
"default": "./unocss-preset.js"
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
@@ -58,13 +58,13 @@
|
|
|
58
58
|
},
|
|
59
59
|
"sideEffects": false,
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@vueuse/core": "^14.
|
|
61
|
+
"@vueuse/core": "^14.1.0",
|
|
62
62
|
"date-fns": "^4.1.0",
|
|
63
63
|
"vueuc": "^0.4.65",
|
|
64
64
|
"sortablejs": "^1.15.6",
|
|
65
65
|
"@types/sortablejs": "^1.15.9",
|
|
66
66
|
"nanoid": "^5.1.6",
|
|
67
|
-
"@ithinkdt/common": "^4.0.0-
|
|
67
|
+
"@ithinkdt/common": "^4.0.0-500"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@ithinkdt/page": ">=4.0",
|
|
@@ -82,14 +82,14 @@
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@vitejs/plugin-vue-jsx": "^5.1.
|
|
86
|
-
"ithinkdt-ui": "^1.8.
|
|
85
|
+
"@vitejs/plugin-vue-jsx": "^5.1.2",
|
|
86
|
+
"ithinkdt-ui": "^1.8.1",
|
|
87
87
|
"typescript": "~5.9.3",
|
|
88
|
-
"unocss": ">=66.5.
|
|
89
|
-
"vite": "npm:rolldown-vite@^7.
|
|
90
|
-
"vue": "^3.5.
|
|
88
|
+
"unocss": ">=66.5.9",
|
|
89
|
+
"vite": "npm:rolldown-vite@^7.2.8",
|
|
90
|
+
"vue": "^3.5.25",
|
|
91
91
|
"vue-router": "^4.6.3",
|
|
92
|
-
"@ithinkdt/page": "^4.0.0-
|
|
92
|
+
"@ithinkdt/page": "^4.0.0-502"
|
|
93
93
|
},
|
|
94
94
|
"scripts": {
|
|
95
95
|
"dev": "vite build --watch",
|
package/unocss-preset.js
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { presetWind4, transformerDirectives, transformerVariantGroup } from 'unocss'
|
|
2
|
+
|
|
3
|
+
const ithinkdt = (options = {}) => {
|
|
4
|
+
const { namespace: ns } = options
|
|
5
|
+
|
|
6
|
+
let wind4, postprocess
|
|
7
|
+
if (ns) {
|
|
8
|
+
wind4 = () => {
|
|
9
|
+
const plugin = presetWind4({
|
|
10
|
+
variablePrefix: `${ns}-`,
|
|
11
|
+
preflights: {
|
|
12
|
+
reset: false,
|
|
13
|
+
property: {
|
|
14
|
+
selector: `.${ns} :where(*, ::before, ::after)`,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
...plugin,
|
|
21
|
+
preflights: plugin.preflights?.map((preflight) => {
|
|
22
|
+
if (preflight.layer === 'theme') {
|
|
23
|
+
return {
|
|
24
|
+
...preflight,
|
|
25
|
+
async getCSS(ctx) {
|
|
26
|
+
let result = await preflight.getCSS?.(ctx)
|
|
27
|
+
if (result) {
|
|
28
|
+
result = result.replace(':root, :host', `.${ns}`)
|
|
29
|
+
}
|
|
30
|
+
return result
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
} else if (preflight.layer === 'properties') {
|
|
34
|
+
return {
|
|
35
|
+
...preflight,
|
|
36
|
+
async getCSS(ctx) {
|
|
37
|
+
let result = await preflight.getCSS?.(ctx)
|
|
38
|
+
if (result) {
|
|
39
|
+
result = result
|
|
40
|
+
.replaceAll('--un-', `--${ns}-`)
|
|
41
|
+
}
|
|
42
|
+
return result
|
|
43
|
+
},
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return preflight
|
|
47
|
+
}),
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
postprocess = [
|
|
51
|
+
(p) => {
|
|
52
|
+
if (p.selector.includes('--un-')) {
|
|
53
|
+
p.selector = p.selector.replaceAll('--un-', `--${ns}-`)
|
|
54
|
+
} else if (p.selector.endsWith(String.raw`.\-`)) {
|
|
55
|
+
if (p.selector.startsWith('.dark ')) {
|
|
56
|
+
p.selector = `.dark & ${p.selector.slice(6)}`
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
p.selector = p.selector.startsWith('.dark ') ? `.dark .${ns} ${p.selector.slice(6)}` : `.${ns} ${p.selector}`
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
]
|
|
63
|
+
} else { wind4 = presetWind4 }
|
|
64
|
+
|
|
65
|
+
const alphas = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950]
|
|
66
|
+
const ithinkdt = {
|
|
67
|
+
name: 'preset-ithinkdt',
|
|
68
|
+
options,
|
|
69
|
+
theme: {
|
|
70
|
+
colors: {
|
|
71
|
+
...Object.fromEntries(
|
|
72
|
+
['primary', 'success', 'warning', 'danger'].map(name => [
|
|
73
|
+
name,
|
|
74
|
+
{
|
|
75
|
+
DEFAULT: `var(--color-${name})`,
|
|
76
|
+
...Object.fromEntries(alphas.map(alpha => [`${alpha}`, `color-mix(in oklab, var(--color-${name}) ${alpha / 10}%, #fff ${(1000 - alpha) / 10}%)`])),
|
|
77
|
+
...Object.fromEntries(
|
|
78
|
+
['hover', 'active'].flatMap(level => [
|
|
79
|
+
[level, `var(--color-${name}-${level})`],
|
|
80
|
+
...alphas.map(alpha => [`${level}-${alpha}`, `color-mix(in oklab, var(--color-${name}-${level}) ${alpha / 10}%, #fff ${(1000 - alpha) / 10}%)`]),
|
|
81
|
+
]),
|
|
82
|
+
),
|
|
83
|
+
},
|
|
84
|
+
]),
|
|
85
|
+
),
|
|
86
|
+
text: {
|
|
87
|
+
DEFAULT: `var(--color-text)`,
|
|
88
|
+
...Object.fromEntries(alphas.map(alpha => [`${alpha}`, `color-mix(in oklab, var(--color-text) ${alpha / 10}%, #fff ${(1000 - alpha) / 10}%)`])),
|
|
89
|
+
},
|
|
90
|
+
base: { DEFAULT: `var(--color-base)` },
|
|
91
|
+
},
|
|
92
|
+
radius: Object.fromEntries(
|
|
93
|
+
['xs', 'sm', 'md', 'lg'].map(size => [size, `var(--rounded-${size})`]),
|
|
94
|
+
),
|
|
95
|
+
},
|
|
96
|
+
variants: [
|
|
97
|
+
// stuck:
|
|
98
|
+
(matcher) => {
|
|
99
|
+
const array = ['top', 'right', 'bottom', 'left']
|
|
100
|
+
const index = array.findIndex(it => matcher.startsWith(`stuck-${it}:`))
|
|
101
|
+
if (index === -1)
|
|
102
|
+
return matcher
|
|
103
|
+
return {
|
|
104
|
+
matcher: matcher.slice(7 + array[index].length),
|
|
105
|
+
handle: (input, next) => next({
|
|
106
|
+
...input,
|
|
107
|
+
parent: `${input.parent ? `${input.parent} $$ ` : ''} @container scroll-state(stuck: ${array[index]})`,
|
|
108
|
+
}),
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
rules: [
|
|
113
|
+
['scroll-state', { 'container-type': 'scroll-state' }],
|
|
114
|
+
[
|
|
115
|
+
/^bg-img-(.*)$/,
|
|
116
|
+
([_, r]) => {
|
|
117
|
+
return {
|
|
118
|
+
'background-image': r[0] === '[' && r.at(-1) === ']' ? r.slice(1, -1) : r,
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
[
|
|
123
|
+
/^mask-(.*)$/,
|
|
124
|
+
([_, r]) => {
|
|
125
|
+
const mask = `var(--un-icon) no-repeat`
|
|
126
|
+
return {
|
|
127
|
+
'--un-icon': r[0] === '[' && r.at(-1) === ']' ? r.slice(1, -1) : r,
|
|
128
|
+
mask,
|
|
129
|
+
'mask-size': '100% 100%',
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
],
|
|
134
|
+
shortcuts: [
|
|
135
|
+
[
|
|
136
|
+
/^card-(.*)$/,
|
|
137
|
+
([_, size]) => {
|
|
138
|
+
const i = ['none', 'sm', 'md', 'lg'].indexOf(size)
|
|
139
|
+
if (i === -1) return
|
|
140
|
+
const p = [0, 2, 4, 5][i]
|
|
141
|
+
return `rounded-${size} px-${p + 1} py-${p} bg-white dark:bg-dark ease-in-out transition-shadow
|
|
142
|
+
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)]`
|
|
143
|
+
},
|
|
144
|
+
{ autocomplete: ['card-none', 'card-sm', 'card-md', 'card-lg'] },
|
|
145
|
+
],
|
|
146
|
+
{
|
|
147
|
+
'ell': 'truncate',
|
|
148
|
+
'ell-2': 'line-clamp-2',
|
|
149
|
+
'ell-3': 'line-clamp-3',
|
|
150
|
+
'flex-center': 'flex justify-center items-center',
|
|
151
|
+
'card': `card-md`,
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
transformers: [transformerDirectives(), transformerVariantGroup()],
|
|
155
|
+
postprocess: postprocess,
|
|
156
|
+
}
|
|
157
|
+
return [
|
|
158
|
+
wind4(),
|
|
159
|
+
ithinkdt,
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export default ithinkdt
|