@ithinkdt/ui 4.0.0-54 → 4.0.0-600
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-BMKQsJ4d.js +2000 -0
- package/dist/components.js +5 -5
- package/dist/directives-CB8tcZsk.js +203 -0
- package/dist/directives.js +2 -2
- package/dist/index.js +81 -93
- package/dist/page.js +314 -287
- package/dist/use-style.js +1 -1
- package/esm/components.d.ts +96 -21
- package/esm/page.d.ts +53 -34
- package/package.json +12 -12
- package/unocss-preset.d.ts +5 -0
- package/unocss-preset.js +163 -0
- package/dist/components-BdbuJNhZ.js +0 -1650
- package/dist/directives-DUuJW647.js +0 -183
- /package/dist/{use-i18n-Dx7V4KrY.js → use-i18n-D-AJ8KbA.js} +0 -0
- /package/dist/{use-style-DcT-1dj4.js → use-style-DrH-89qR.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-DrH-89qR.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,8 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
CheckboxGroupProps, DataTableInst as NDataTableInst, DataTableProps as NDataTableProps,
|
|
3
|
-
FormItemGiProps as NFormItemGiProps, FormProps as NFormProps, GridItemProps as NGridItemProps, GridProps as NGridProps,
|
|
4
|
-
PopoverProps,
|
|
5
|
-
RadioGroupProps, TransferProps,
|
|
2
|
+
AnchorProps, ButtonProps, ButtonSlots, CheckboxGroupProps, DataTableInst as NDataTableInst, DataTableProps as NDataTableProps,
|
|
3
|
+
FlexProps, FormItemGiProps as NFormItemGiProps, FormProps as NFormProps, GridItemProps as NGridItemProps, GridProps as NGridProps,
|
|
4
|
+
PopoverProps, RadioGroupProps, TransferProps,
|
|
6
5
|
} from 'ithinkdt-ui'
|
|
7
6
|
import Sortable from 'sortablejs'
|
|
8
7
|
import { AllowedComponentProps, MaybeRef, MaybeRefOrGetter, VNodeChild } from 'vue'
|
|
@@ -10,7 +9,7 @@ import type { CSSProperties, HTMLAttributes, TemplateRef } from 'vue'
|
|
|
10
9
|
|
|
11
10
|
import { GenericCtx, GenericExposed, GenericReturn, MaybeArray, MaybePromise, PublicProps } from '@ithinkdt/common'
|
|
12
11
|
import { DictItem } from '@ithinkdt/common/dict'
|
|
13
|
-
import { FormItem, PageParams, PresetKeyField, SortParams, TableActionRenderParam, TableColumn, ValidationResults, _DataWithPresetKeyField } from '@ithinkdt/page'
|
|
12
|
+
import { DescriptionItem, FormItem, PageParams, PresetKeyField, SortParams, TableActionRenderParam, TableColumn, ValidationResults, _DataWithPresetKeyField } from '@ithinkdt/page'
|
|
14
13
|
|
|
15
14
|
declare module '@ithinkdt/page' {
|
|
16
15
|
|
|
@@ -51,19 +50,35 @@ declare module '@ithinkdt/page' {
|
|
|
51
50
|
interface FormItemRenderExtraParams {
|
|
52
51
|
size?: 'small' | 'medium' | 'large' | undefined
|
|
53
52
|
}
|
|
53
|
+
}
|
|
54
54
|
|
|
55
|
+
export type NStateButtonProps = ButtonProps & {
|
|
56
|
+
succeeded?: boolean | null | undefined
|
|
57
|
+
successText?: string | undefined
|
|
58
|
+
failureText?: string | undefined
|
|
55
59
|
}
|
|
56
60
|
|
|
57
|
-
export type
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
export type NStateButtonEmits = {
|
|
62
|
+
(e: 'click', evt: MouseEvent): void
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type NStateButtonSlots = ButtonSlots & {
|
|
66
|
+
success?: () => VNodeChild
|
|
67
|
+
failure?: () => VNodeChild
|
|
68
|
+
successIcon?: () => VNodeChild
|
|
69
|
+
failureIcon?: () => VNodeChild
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export declare function NStateButton(
|
|
73
|
+
props: NStateButtonProps & PublicProps,
|
|
74
|
+
ctx?: Pick<GenericCtx<NStateButtonProps, NStateButtonEmits, NStateButtonSlots>, 'attrs' | 'emit' | 'slots'>,
|
|
75
|
+
expose?: (exposed?: GenericExposed) => void,
|
|
76
|
+
setup?: GenericCtx<NStateButtonProps, NStateButtonEmits, NStateButtonSlots>,
|
|
77
|
+
): GenericReturn<NStateButtonProps, NStateButtonEmits, NStateButtonSlots>
|
|
78
|
+
|
|
79
|
+
export type DataFormActionsProps = Pick<FlexProps, 'align' | 'justify' | 'vertical' | 'reverse'> & {
|
|
80
|
+
size?: 'small' | 'medium' | 'large' | undefined
|
|
81
|
+
gap?: number | string | undefined
|
|
67
82
|
submitText?: VNodeChild | undefined
|
|
68
83
|
resetText?: VNodeChild | undefined
|
|
69
84
|
cancelText?: VNodeChild | undefined
|
|
@@ -71,21 +86,61 @@ export type DataFormProps<Data extends {}> = Omit<NFormProps, 'model' | 'rules'
|
|
|
71
86
|
showResetBtn?: boolean | undefined
|
|
72
87
|
showCancelBtn?: boolean | undefined
|
|
73
88
|
submitDisabled?: boolean | undefined
|
|
89
|
+
submitLoading?: boolean | undefined
|
|
74
90
|
succeeded?: boolean | undefined
|
|
75
91
|
successText?: VNodeChild | undefined
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
onSubmit?: MaybeArray<(model: Data) => void> | undefined
|
|
92
|
+
failureText?: VNodeChild | undefined
|
|
93
|
+
onSubmit?: MaybeArray<() => void> | undefined
|
|
79
94
|
onRest?: MaybeArray<() => void> | undefined
|
|
95
|
+
onCancel?: MaybeArray<() => void> | undefined
|
|
96
|
+
nativeButtonType?: boolean | undefined
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export type DataFormActionsEmits = {
|
|
100
|
+
(e: 'submit'): void
|
|
101
|
+
(e: 'reset'): void
|
|
102
|
+
(e: 'cancel'): void
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type DataFormActionsSlots = {
|
|
106
|
+
prefix?: () => VNodeChild
|
|
107
|
+
suffix?: () => VNodeChild
|
|
80
108
|
}
|
|
81
109
|
|
|
110
|
+
export declare function DataFormActions(
|
|
111
|
+
props: DataFormActionsProps & PublicProps,
|
|
112
|
+
ctx?: Pick<GenericCtx<DataFormActionsProps, DataFormActionsEmits, DataFormActionsSlots>, 'attrs' | 'emit' | 'slots'>,
|
|
113
|
+
expose?: (exposed?: GenericExposed) => void,
|
|
114
|
+
setup?: GenericCtx<DataFormActionsProps, DataFormActionsEmits, DataFormActionsSlots>,
|
|
115
|
+
): GenericReturn<DataFormActionsProps, DataFormActionsEmits, DataFormActionsSlots>
|
|
116
|
+
|
|
117
|
+
export type DataFormProps<Data extends {}> = Omit<NFormProps, 'model' | 'rules' | 'onSubmit' | 'validateMessages'>
|
|
118
|
+
& Omit<DataFormActionsProps, 'onSubmit' | 'size' | 'gap' | 'justify' | 'direction' | 'submitloading'> & {
|
|
119
|
+
items: FormItem<Data>[]
|
|
120
|
+
model: Data
|
|
121
|
+
readonly?: boolean | undefined
|
|
122
|
+
grid?: boolean | NGridProps | undefined
|
|
123
|
+
validation?: { [k in keyof Data]?: ValidationResults } | undefined
|
|
124
|
+
showColon?: boolean | undefined
|
|
125
|
+
tooltipPlacement?: 'bottom' | 'icon' | undefined
|
|
126
|
+
loading?: boolean | undefined
|
|
127
|
+
showAction?: boolean | NGridItemProps & AllowedComponentProps | undefined
|
|
128
|
+
actionJustify?: DataFormActionsProps['justify']
|
|
129
|
+
actionAlign?: DataFormActionsProps['align']
|
|
130
|
+
actionGap?: DataFormActionsProps['gap']
|
|
131
|
+
onSubmit?: MaybeArray<(model: Data) => void> | undefined
|
|
132
|
+
}
|
|
133
|
+
|
|
82
134
|
export type DataFormEmits<Data extends {}> = {
|
|
83
135
|
(e: 'submit', model: Data): void
|
|
84
136
|
(e: 'reset'): void
|
|
137
|
+
(e: 'cancel'): void
|
|
85
138
|
}
|
|
86
139
|
|
|
87
140
|
export type DataFormSlots<_Data extends {}> = {
|
|
88
141
|
action?: (params: { cols: number, spans: number, overflow: boolean }) => VNodeChild
|
|
142
|
+
actionPrefix?: () => VNodeChild
|
|
143
|
+
actionSuffix?: () => VNodeChild
|
|
89
144
|
}
|
|
90
145
|
|
|
91
146
|
export type DataFormInst = {
|
|
@@ -289,6 +344,8 @@ export type DataLocaleInputProps = {
|
|
|
289
344
|
'modelValue'?: Record<string, string | undefined> | null | undefined
|
|
290
345
|
'supports'?: { label: string, value: string }[] | undefined
|
|
291
346
|
'defaultLang'?: string | undefined
|
|
347
|
+
'mode'?: 'dialog' | 'list' | undefined
|
|
348
|
+
'defaultExpanded'?: boolean | undefined
|
|
292
349
|
'showLang'?: string | undefined
|
|
293
350
|
'disabled'?: boolean | undefined
|
|
294
351
|
'defaultRows'?: number | undefined
|
|
@@ -388,7 +445,7 @@ interface UserDeptProps<Multiple extends boolean> {
|
|
|
388
445
|
'defaultExpandAll'?: boolean | undefined
|
|
389
446
|
'filterable'?: boolean | undefined
|
|
390
447
|
'disabled'?: boolean | undefined
|
|
391
|
-
'size'?: TransferProps['size']
|
|
448
|
+
'size'?: TransferProps['size']
|
|
392
449
|
'valueField'?: 'id' | 'username' | 'code' | undefined
|
|
393
450
|
'users'?: { id?: string | undefined, username: string, nickname: string }[] | undefined
|
|
394
451
|
'groups'?: UserGroupOption[] | undefined
|
|
@@ -405,12 +462,12 @@ interface UserDeptEmits<Multiple extends boolean> {
|
|
|
405
462
|
(e: 'updateModelValue', value: Multiple extends true ? string[] : string): void
|
|
406
463
|
}
|
|
407
464
|
|
|
408
|
-
export declare
|
|
465
|
+
export declare function DtUserDept<Multiple extends boolean>(
|
|
409
466
|
props: UserDeptProps<Multiple> & PublicProps,
|
|
410
467
|
ctx?: Pick<GenericCtx<UserDeptProps<Multiple>, UserDeptEmits<Multiple>>, 'attrs' | 'emit' | 'slots'>,
|
|
411
468
|
expose?: (exposed?: GenericExposed<{}>) => void,
|
|
412
469
|
setup?: GenericCtx<UserDeptProps<Multiple>, UserDeptEmits<Multiple>, {}, {}>,
|
|
413
|
-
)
|
|
470
|
+
): GenericReturn<UserDeptProps<Multiple>, UserDeptEmits<Multiple>, {}, {}>
|
|
414
471
|
|
|
415
472
|
interface UserRenderProps {
|
|
416
473
|
value?: string | string[] | null | undefined
|
|
@@ -446,3 +503,21 @@ export declare const DtDeptRender: (
|
|
|
446
503
|
expose?: (exposed?: GenericExposed<{}>) => void,
|
|
447
504
|
setup?: GenericCtx<DeptRenderProps, DeptRenderEmits, {}, {}>,
|
|
448
505
|
) => GenericReturn<DeptRenderProps, DeptRenderEmits, {}, {}>
|
|
506
|
+
|
|
507
|
+
export interface DataDescriptionsProps<Data extends object> {
|
|
508
|
+
cols?: number
|
|
509
|
+
data: Data | undefined | null
|
|
510
|
+
items: DescriptionItem<Data>[]
|
|
511
|
+
title?: VNodeChild | ((data: Data | undefined) => VNodeChild)
|
|
512
|
+
anchor?: boolean | AnchorProps & AllowedComponentProps | undefined
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
export interface DataDescriptionsEmits {
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
export declare function DataDescriptions<Data extends {}>(
|
|
519
|
+
props: DataDescriptionsProps<Data> & PublicProps,
|
|
520
|
+
ctx?: Pick<GenericCtx<DataDescriptionsProps<Data>, DataDescriptionsEmits>, 'attrs' | 'emit' | 'slots'>,
|
|
521
|
+
expose?: (exposed?: GenericExposed<{}>) => void,
|
|
522
|
+
setup?: GenericCtx<DataDescriptionsProps<Data>, DataDescriptionsEmits, {}, {}>,
|
|
523
|
+
): 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
|
|
|
@@ -104,46 +106,63 @@ declare module '@ithinkdt/page' {
|
|
|
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-600",
|
|
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-600"
|
|
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
|
|
90
|
-
"vue": "^3.5.
|
|
88
|
+
"unocss": ">=66.5.10",
|
|
89
|
+
"vite": "npm:rolldown-vite@7.2.7",
|
|
90
|
+
"vue": "^3.5.25",
|
|
91
91
|
"vue-router": "^4.6.3",
|
|
92
|
-
"@ithinkdt/page": "^4.0.0-
|
|
92
|
+
"@ithinkdt/page": "^4.0.0-600"
|
|
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 whitespace-normal',
|
|
149
|
+
'ell-3': 'line-clamp-3 whitespace-normal',
|
|
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
|