@ithinkdt/ui 4.0.0-9 → 4.0.0

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.
@@ -1,21 +1,27 @@
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'
6
+ import { TableBaseColumn } from 'ithinkdt-ui/es/data-table/src/interface'
7
7
  import Sortable from 'sortablejs'
8
8
  import { AllowedComponentProps, MaybeRef, MaybeRefOrGetter, VNodeChild } from 'vue'
9
- import type { CSSProperties, HTMLAttributes, TemplateRef } from 'vue'
9
+ import type { CSSProperties, ComponentPublicInstance, HTMLAttributes, InjectionKey, TemplateRef } from 'vue'
10
10
 
11
11
  import { GenericCtx, GenericExposed, GenericReturn, MaybeArray, MaybePromise, PublicProps } from '@ithinkdt/common'
12
12
  import { DictItem } from '@ithinkdt/common/dict'
13
- import { FormItem, PageParams, PresetKeyField, SortParams, TableActionRenderParam, TableColumn, ValidationResults, _DataWithPresetKeyField } from '@ithinkdt/page'
13
+ import { DescriptionItem, FormItem, PageParams, PresetKeyField, SortParams, TableActionRenderParam, TableColumn, ValidationResults, _DataWithPresetKeyField } from '@ithinkdt/page'
14
14
 
15
15
  declare module '@ithinkdt/page' {
16
16
 
17
17
  interface FormRenderExtraOptions {
18
18
  showColon?: MaybeRef<boolean | undefined>
19
+ labelWidth?: MaybeRef<string | number | undefined>
20
+ labelAlign?: MaybeRef<'left' | 'right' | 'center' | undefined>
21
+ labelPlacement?: MaybeRef<'left' | 'top' | undefined>
22
+ showRequireMark?: MaybeRef<boolean | undefined>
23
+ requireMarkPlacement?: MaybeRef<'left' | 'right' | 'right-hanging' | undefined>
24
+ showFeedback?: MaybeRef<boolean | undefined>
19
25
  }
20
26
 
21
27
  type FormItemOptionKeys = 'size' | 'showLabel' | 'labelWidth' | 'labelStyle' | 'labelAlign' | 'labelPlacement' | 'labelProps'
@@ -46,18 +52,48 @@ declare module '@ithinkdt/page' {
46
52
  size?: 'small' | 'medium' | 'large' | undefined
47
53
  }
48
54
 
55
+ type TableColumnOptionKeys = 'cellProps' | 'className' | 'tree' | 'allowExport' | 'customNextSortOrder' | 'filter' | 'filterMode' | 'filterMultiple'
56
+ | 'defaultFilterOptionValue' | 'defaultFilterOptionValues' | 'filterOptionValue' | 'filterOptionValues' | 'filterOptions' | 'renderFilter' | 'renderFilterIcon' | 'renderFilterMenu'
57
+ type TableColumnOptionExtra = {
58
+ [K in TableColumnOptionKeys]?: MaybeRef<TableBaseColumn[K]>
59
+ }
60
+
61
+ // eslint-disable-next-line ts/no-unused-vars
62
+ interface TableColumnOptions<Model extends {}> extends TableColumnOptionExtra {
63
+ }
64
+
65
+ // eslint-disable-next-line ts/no-unused-vars
66
+ interface TableColumn<Model extends {}>extends Pick<TableBaseColumn, TableColumnOptionKeys> {
67
+ }
49
68
  }
50
69
 
51
- export type DataFormProps<Data extends {}> = Omit<NFormProps, 'model' | 'rules' | 'onSubmit' | 'validateMessages'> & {
52
- items: FormItem<Data>[]
53
- model: Data
54
- readonly?: boolean | undefined
55
- grid?: boolean | NGridProps | undefined
56
- validation?: { [k in keyof Data]?: ValidationResults } | undefined
57
- showColon?: boolean | undefined
58
- loading?: boolean | undefined
59
- showAction?: boolean | NGridItemProps & AllowedComponentProps | undefined
60
- actionAlign?: 'start' | 'center' | 'end'
70
+ export type NStateButtonProps = ButtonProps & {
71
+ succeeded?: boolean | null | undefined
72
+ successText?: string | undefined
73
+ failureText?: string | undefined
74
+ }
75
+
76
+ export type NStateButtonEmits = {
77
+ (e: 'click', evt: MouseEvent): void
78
+ }
79
+
80
+ export type NStateButtonSlots = ButtonSlots & {
81
+ success?: () => VNodeChild
82
+ failure?: () => VNodeChild
83
+ successIcon?: () => VNodeChild
84
+ failureIcon?: () => VNodeChild
85
+ }
86
+
87
+ export declare function NStateButton(
88
+ props: NStateButtonProps & PublicProps,
89
+ ctx?: Pick<GenericCtx<NStateButtonProps, NStateButtonEmits, NStateButtonSlots>, 'attrs' | 'emit' | 'slots'>,
90
+ expose?: (exposed?: GenericExposed) => void,
91
+ setup?: GenericCtx<NStateButtonProps, NStateButtonEmits, NStateButtonSlots>,
92
+ ): GenericReturn<NStateButtonProps, NStateButtonEmits, NStateButtonSlots>
93
+
94
+ export type DataFormActionsProps = Pick<FlexProps, 'align' | 'justify' | 'vertical' | 'reverse'> & {
95
+ size?: 'small' | 'medium' | 'large' | undefined
96
+ gap?: number | string | undefined
61
97
  submitText?: VNodeChild | undefined
62
98
  resetText?: VNodeChild | undefined
63
99
  cancelText?: VNodeChild | undefined
@@ -65,21 +101,61 @@ export type DataFormProps<Data extends {}> = Omit<NFormProps, 'model' | 'rules'
65
101
  showResetBtn?: boolean | undefined
66
102
  showCancelBtn?: boolean | undefined
67
103
  submitDisabled?: boolean | undefined
104
+ submitLoading?: boolean | undefined
68
105
  succeeded?: boolean | undefined
69
106
  successText?: VNodeChild | undefined
107
+ failureText?: VNodeChild | undefined
108
+ onSubmit?: MaybeArray<() => void> | undefined
109
+ onReset?: MaybeArray<() => void> | undefined
110
+ onCancel?: MaybeArray<() => void> | undefined
111
+ nativeButtonType?: boolean | undefined
112
+ }
70
113
 
71
- tooltipPlacement?: 'bottom' | 'icon' | undefined
72
- onSubmit?: MaybeArray<(model: Data) => void> | undefined
73
- onRest?: MaybeArray<() => void> | undefined
114
+ export type DataFormActionsEmits = {
115
+ (e: 'submit'): void
116
+ (e: 'reset'): void
117
+ (e: 'cancel'): void
118
+ }
119
+
120
+ export type DataFormActionsSlots = {
121
+ prefix?: () => VNodeChild
122
+ suffix?: () => VNodeChild
74
123
  }
75
124
 
125
+ export declare function DataFormActions(
126
+ props: DataFormActionsProps & PublicProps,
127
+ ctx?: Pick<GenericCtx<DataFormActionsProps, DataFormActionsEmits, DataFormActionsSlots>, 'attrs' | 'emit' | 'slots'>,
128
+ expose?: (exposed?: GenericExposed) => void,
129
+ setup?: GenericCtx<DataFormActionsProps, DataFormActionsEmits, DataFormActionsSlots>,
130
+ ): GenericReturn<DataFormActionsProps, DataFormActionsEmits, DataFormActionsSlots>
131
+
132
+ export type DataFormProps<Data extends {}> = Omit<NFormProps, 'model' | 'rules' | 'onSubmit' | 'validateMessages'>
133
+ & Omit<DataFormActionsProps, 'onSubmit' | 'size' | 'gap' | 'justify' | 'direction' | 'submitLoading'> & {
134
+ items: FormItem<Data>[]
135
+ model: Data
136
+ readonly?: boolean | undefined
137
+ grid?: boolean | NGridProps | undefined
138
+ validation?: { [k in keyof Data]?: ValidationResults } | undefined
139
+ showColon?: boolean | undefined
140
+ tooltipPlacement?: 'bottom' | 'icon' | undefined
141
+ loading?: boolean | undefined
142
+ showAction?: boolean | NGridItemProps & AllowedComponentProps | undefined
143
+ actionJustify?: DataFormActionsProps['justify']
144
+ actionAlign?: DataFormActionsProps['align']
145
+ actionGap?: DataFormActionsProps['gap']
146
+ onSubmit?: MaybeArray<(model: Data) => void> | undefined
147
+ }
148
+
76
149
  export type DataFormEmits<Data extends {}> = {
77
150
  (e: 'submit', model: Data): void
78
151
  (e: 'reset'): void
152
+ (e: 'cancel'): void
79
153
  }
80
154
 
81
155
  export type DataFormSlots<_Data extends {}> = {
82
- action?: (params: { cols: number, spans: number, overflow: boolean }) => VNodeChild
156
+ action?: (params: { overflow: boolean, grid: ComponentPublicInstance | undefined }) => VNodeChild
157
+ actionPrefix?: () => VNodeChild
158
+ actionSuffix?: () => VNodeChild
83
159
  }
84
160
 
85
161
  export type DataFormInst = {
@@ -107,7 +183,7 @@ export type DataFilterProps<Data extends {}> = Omit<NFormProps, 'model' | 'rules
107
183
  tooltipPlacement?: 'bottom' | 'icon' | undefined
108
184
  customizable?: boolean | undefined
109
185
  onFilter?: MaybeArray<(model: Data) => void> | undefined
110
- onRest?: MaybeArray<() => void> | undefined
186
+ onReset?: MaybeArray<() => void> | undefined
111
187
  onCustom?: MaybeArray<
112
188
  ((reset: true) => void)
113
189
  | ((sort: string[]) => void)
@@ -129,7 +205,7 @@ export type DataFilterEmits<Data extends {}> = {
129
205
  key: string
130
206
  hidden?: boolean
131
207
  }): void
132
- (e: 'collpase', collapsed: boolean): void
208
+ (e: 'collapse', collapsed: boolean): void
133
209
  }
134
210
 
135
211
  export type DataFilterInst = {
@@ -149,14 +225,20 @@ export type DataTableProps<Data extends {}, KeyField extends keyof Data>
149
225
  data?: Data[] | undefined
150
226
  keyField?: KeyField | undefined
151
227
  selectedKeys?: Data[KeyField][] | undefined
228
+ highlight?: boolean | Data[KeyField] | undefined
229
+ highlightColor?: string | undefined
230
+ appear?: 'normal' | 'sticky' | undefined
152
231
  sorter?: SortParams<Data> | undefined
153
232
  onSort?: MaybeArray<(param: SortParams<Data>) => void> | undefined
154
233
  onSelect?: MaybeArray<(param: NonNullable<Data[KeyField]>[]) => void> | undefined
234
+
155
235
  }
156
236
 
157
237
  export type DataTableEmits<Data extends {}, KeyField extends keyof Data> = {
158
238
  (e: 'sort', param: SortParams<Data>): void
159
239
  (e: 'select', param: Data[KeyField][]): void
240
+ (e: 'highlight', rowKey: Data[KeyField]): void
241
+ (e: 'custom', params: { key: string, width: number }): void
160
242
  }
161
243
 
162
244
  export type DataTableInst<Data extends {}, KeyField extends keyof Data> = NDataTableInst & {
@@ -182,13 +264,14 @@ export declare function useDataTableDrag<T>(
182
264
  { data, onSort, ...options }: {
183
265
  data: MaybeRef<T[]>
184
266
  onSort: (info: { from: number, to: number }) => void
185
- } & Omit<Sortable.Options, 'onSort'>
267
+ } & Omit<Sortable.Options, 'onSort'>,
186
268
  ): void
187
269
 
188
270
  export type DataPaginationProps = (PageParams | { page: PageParams }) & {
189
271
  simple?: boolean | undefined
190
272
  total: number
191
273
  pageSizes?: number[] | undefined
274
+ resetPageOnSizeChange?: boolean | undefined
192
275
  onChange?: MaybeArray<(value: PageParams) => void> | undefined
193
276
  }
194
277
 
@@ -196,12 +279,18 @@ export type DataPaginationEmits = {
196
279
  (e: 'change', value: PageParams): void
197
280
  }
198
281
 
199
- export declare function DataPagination(
200
- props: DataPaginationProps & PublicProps,
201
- ctx?: Pick<GenericCtx<DataPaginationProps, DataPaginationEmits, {}, {}>, 'attrs' | 'emit' | 'slots'>,
202
- expose?: (exposed?: GenericExposed<{}>) => void,
203
- setup?: GenericCtx<DataPaginationProps, DataPaginationEmits, {}, {}>,
204
- ): GenericReturn<DataPaginationProps, DataPaginationEmits, {}, {}>
282
+ export declare interface IDataPagination {
283
+ /** 注入默认的分页大小数组 */
284
+ DEFAULT_PAGE_SIZES_INJECTION_KEY: InjectionKey<number[] | { value: number, label: string }[]>
285
+ (
286
+ props: DataPaginationProps & PublicProps,
287
+ ctx?: Pick<GenericCtx<DataPaginationProps, DataPaginationEmits, {}, {}>, 'attrs' | 'emit' | 'slots'>,
288
+ expose?: (exposed?: GenericExposed<{}>) => void,
289
+ setup?: GenericCtx<DataPaginationProps, DataPaginationEmits, {}, {}>,
290
+ ): GenericReturn<DataPaginationProps, DataPaginationEmits, {}, {}>
291
+ }
292
+
293
+ declare const DataPagination: IDataPagination
205
294
 
206
295
  export type DataSelectionProps = {
207
296
  'count': number
@@ -230,8 +319,10 @@ export type DataCustomProps<Data extends {}> = {
230
319
  keyField?: keyof Data | undefined
231
320
  showFixed?: boolean | undefined
232
321
  disabledField?: keyof Data | undefined
233
- visiblityField?: keyof Data | undefined
322
+ visibleField?: keyof Data | undefined
234
323
  labelTitle?: VNodeChild | undefined
324
+ size?: number | undefined
325
+ type?: 'primary' | 'default' | undefined
235
326
  onCustom?: MaybeArray<
236
327
  ((reset: true) => void)
237
328
  | ((sort: string[]) => void)
@@ -278,6 +369,8 @@ export type DataLocaleInputProps = {
278
369
  'modelValue'?: Record<string, string | undefined> | null | undefined
279
370
  'supports'?: { label: string, value: string }[] | undefined
280
371
  'defaultLang'?: string | undefined
372
+ 'mode'?: 'dialog' | 'list' | undefined
373
+ 'defaultExpanded'?: boolean | undefined
281
374
  'showLang'?: string | undefined
282
375
  'disabled'?: boolean | undefined
283
376
  'defaultRows'?: number | undefined
@@ -300,7 +393,7 @@ export declare function DataLocaleInput(
300
393
  export declare function useLocaleEdit(
301
394
  title: VNodeChild | (() => VNodeChild),
302
395
  onSubmit: (data: Record<string, string | undefined>) => void,
303
- defaultRows?: MaybeRef<number | undefined>
396
+ defaultRows?: MaybeRef<number | undefined>,
304
397
  ): {
305
398
  open(this: void, data: MaybePromise<Record<string, string | undefined>>, readonly?: boolean): PromiseLike<Record<string, string | undefined>>
306
399
  setSupports(this: void, supports: { label: string, value: string, required?: boolean }[]): void
@@ -362,6 +455,7 @@ export interface UserGroupOption {
362
455
  name: string
363
456
  }
364
457
  export interface DeptOption {
458
+ id?: string | undefined
365
459
  code: string
366
460
  name: string
367
461
  children?: DeptOption[]
@@ -376,8 +470,9 @@ interface UserDeptProps<Multiple extends boolean> {
376
470
  'defaultExpandAll'?: boolean | undefined
377
471
  'filterable'?: boolean | undefined
378
472
  'disabled'?: boolean | undefined
379
- 'size'?: TransferProps['size'] | undefined
380
- 'users'?: { username: string, nickname: string }[] | undefined
473
+ 'size'?: TransferProps['size']
474
+ 'valueField'?: 'id' | 'username' | 'code' | undefined
475
+ 'users'?: { id?: string | undefined, username: string, nickname: string }[] | undefined
381
476
  'groups'?: UserGroupOption[] | undefined
382
477
  'depts'?: DeptOption[] | undefined
383
478
  'getUsersByGroup'?: ((code: string) => Promise<{ username: string, nickname: string }[]>) | undefined
@@ -385,6 +480,7 @@ interface UserDeptProps<Multiple extends boolean> {
385
480
  'modelValue'?: Multiple extends true ? (string[] | null | undefined) : (string | null | undefined)
386
481
  'onUpdate:modelValue'?: MaybeArray<(value: Multiple extends true ? string[] : string) => void> | undefined
387
482
  'onUpdateModelValue'?: MaybeArray<(value: Multiple extends true ? string[] : string) => void> | undefined
483
+ 'renderUserInfo'?: (user: { username: string, nickname: string }) => VNodeChild | undefined
388
484
  }
389
485
 
390
486
  interface UserDeptEmits<Multiple extends boolean> {
@@ -392,12 +488,12 @@ interface UserDeptEmits<Multiple extends boolean> {
392
488
  (e: 'updateModelValue', value: Multiple extends true ? string[] : string): void
393
489
  }
394
490
 
395
- export declare const DtUserDept: <Multiple extends boolean>(
491
+ export declare function DtUserDept<Multiple extends boolean>(
396
492
  props: UserDeptProps<Multiple> & PublicProps,
397
493
  ctx?: Pick<GenericCtx<UserDeptProps<Multiple>, UserDeptEmits<Multiple>>, 'attrs' | 'emit' | 'slots'>,
398
494
  expose?: (exposed?: GenericExposed<{}>) => void,
399
495
  setup?: GenericCtx<UserDeptProps<Multiple>, UserDeptEmits<Multiple>, {}, {}>,
400
- ) => GenericReturn<UserDeptProps<Multiple>, UserDeptEmits<Multiple>, {}, {}>
496
+ ): GenericReturn<UserDeptProps<Multiple>, UserDeptEmits<Multiple>, {}, {}>
401
497
 
402
498
  interface UserRenderProps {
403
499
  value?: string | string[] | null | undefined
@@ -406,6 +502,7 @@ interface UserRenderProps {
406
502
  size?: number | undefined
407
503
  placement?: PopoverProps['placement']
408
504
  getUsersByUsername?: ((usernames: string[]) => Promise<{ username: string, nickname: string }[]>) | undefined
505
+ renderInfo?: (user: { username: string, nickname: string }) => VNodeChild
409
506
  }
410
507
 
411
508
  interface UserRenderEmits {
@@ -433,3 +530,21 @@ export declare const DtDeptRender: (
433
530
  expose?: (exposed?: GenericExposed<{}>) => void,
434
531
  setup?: GenericCtx<DeptRenderProps, DeptRenderEmits, {}, {}>,
435
532
  ) => GenericReturn<DeptRenderProps, DeptRenderEmits, {}, {}>
533
+
534
+ export interface DataDescriptionsProps<Data extends object> {
535
+ cols?: number
536
+ data: Data | undefined | null
537
+ items: DescriptionItem<Data>[]
538
+ title?: VNodeChild | ((data: Data | undefined) => VNodeChild)
539
+ anchor?: boolean | AnchorProps & AllowedComponentProps | undefined
540
+ }
541
+
542
+ export interface DataDescriptionsEmits {
543
+ }
544
+
545
+ export declare function DataDescriptions<Data extends {}>(
546
+ props: DataDescriptionsProps<Data> & PublicProps,
547
+ ctx?: Pick<GenericCtx<DataDescriptionsProps<Data>, DataDescriptionsEmits>, 'attrs' | 'emit' | 'slots'>,
548
+ expose?: (exposed?: GenericExposed<{}>) => void,
549
+ setup?: GenericCtx<DataDescriptionsProps<Data>, DataDescriptionsEmits, {}, {}>,
550
+ ): GenericReturn<DataDescriptionsProps<Data>, DataDescriptionsEmits, {}, {}>
@@ -0,0 +1 @@
1
+ export * from '../dist/components.js'
@@ -43,7 +43,7 @@ export declare const AppContent: (
43
43
  },
44
44
  ) => VNode
45
45
 
46
- export declare const AppSider: (
46
+ export declare const AppSidebar: (
47
47
  props: PublicProps & {
48
48
  'collapsed'?: boolean | undefined
49
49
  'width'?: number | undefined
@@ -154,6 +154,7 @@ export declare const AppAccount: (
154
154
  },
155
155
  context: {
156
156
  slots: {
157
+ extra?: (() => VNode) | undefined
157
158
  logoutButton?: (() => VNode) | undefined
158
159
  dropdown?: ((binding: { ChangePwd: Component, Logout: Component }) => VNode) | undefined
159
160
  dropdownExtra?: (() => VNode) | undefined
@@ -232,3 +233,11 @@ export interface NotificationProps {
232
233
  }
233
234
 
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
@@ -21,12 +21,18 @@ export declare const TooltipDirectiveProvider: (props: { delay?: number }) => VN
21
21
  *
22
22
  * 支持的修饰符
23
23
  * - 'auto' 当内容溢出来容器时自动展示,否则隐藏
24
+ * - 'expandable' 当内容溢出来容器时支持展开
25
+ * - `ell${number}` 多行省略
24
26
  * - 'left-end'、'left'、'left-start'、'top-start'、'top'、'top-end'、'right-start'、'right'、'right-end'、'bottom-end'、'bottom'、'bottom-start' 弹出内容的位置
25
27
  */
26
28
  export declare const vTooltip: Directive<
27
29
  HTMLElement,
28
30
  VNodeChild,
29
31
  | 'auto'
32
+ | 'expandable'
33
+ | 'ell2'
34
+ | 'ell3'
35
+ | 'ell5'
30
36
  | 'left-end'
31
37
  | 'left'
32
38
  | 'left-start'
@@ -0,0 +1 @@
1
+ export * from '../dist/directives.js'
package/esm/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from '../dist/index.js'
package/esm/page.d.ts ADDED
@@ -0,0 +1,203 @@
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, VNodeChild } 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, UserRenderProps } 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
+ /** 最大文件大小(单位:KB) */
82
+ maxSize?: number | undefined
83
+ onBeforeUpload?: UploadProps['onBeforeUpload']
84
+ } & PublicProps>
85
+ fileSlots?: {
86
+ default?: (() => VNode[]) | undefined
87
+ }
88
+ }
89
+ upload: {
90
+ uploadProps?: ShallowMaybeRef<{
91
+ type?: 'file' | 'image' | undefined
92
+ multiple?: boolean | undefined
93
+ max?: number | undefined
94
+ accept?: string | undefined
95
+ /** 最大文件大小(单位:KB) */
96
+ maxSize?: number | undefined
97
+ onBeforeUpload?: UploadProps['onBeforeUpload']
98
+ defaultUpload?: boolean | undefined
99
+ } & PublicProps>
100
+ uploadSlots?: {
101
+ default?: (() => VNode[]) | undefined
102
+ }
103
+ }
104
+
105
+ user: {
106
+ userProps?: ShallowMaybeRef<Omit<UserDeptProps<boolean>, 'modelValue' | 'onUpdate:modelValue' | 'disabled'
107
+ | 'users' | 'groups' | 'depts' | 'getUsersByGroup' | 'getUsersByDept' | 'renderUserInfo'> & {
108
+ renderInfo: UserRenderProps['renderInfo']
109
+ }> & PublicProps
110
+ userSlots?: {}
111
+ }
112
+ }
113
+
114
+ interface DescriptionTypePresets {
115
+ longtext: {
116
+ longtextParams: {
117
+ title?: VNodeChild
118
+ showText?: ((value: string) => void) | undefined
119
+ formatText?: ((value: string) => VNodeChild) | undefined
120
+ copyable?: boolean | undefined
121
+ onCopy?: (value: string) => void | undefined
122
+ }
123
+ }
124
+ number: {
125
+ numberParams: ShallowMaybeRef<{
126
+ /** 保留 n 位小数(保留 0) */
127
+ fixed?: number | undefined
128
+ /** 保留 n 位小数(不保留 0) */
129
+ round?: number | undefined
130
+ /** 保留 n 位数(不保留 0) */
131
+ precision?: number | undefined
132
+ /** 使用数字分隔符 */
133
+ separator?: boolean | undefined
134
+ /** 是否为百分数 */
135
+ percent?: boolean | undefined
136
+ }>
137
+ }
138
+
139
+ date: {
140
+ dateParams: ShallowMaybeRef<{
141
+ formatter?: 'yyyy-MM-dd' | 'yyyy/MM/dd' | string & {} | undefined
142
+ }>
143
+ }
144
+
145
+ datetime: {
146
+ datetimeParams: ShallowMaybeRef<{
147
+ formatter?: 'yyyy-MM-dd HH:mm' | 'yyyy-MM-dd HH:mm:ss' | string & {} | undefined
148
+ }>
149
+ }
150
+
151
+ dict: {
152
+ dictParams: ShallowMaybeRef<{
153
+ dictType?: DictTypeKey | undefined
154
+ options?: DictItem[] | (SelectOption | SelectGroupOption)[] | undefined
155
+ multiple?: boolean | undefined
156
+ labelField?: string | undefined
157
+ valueField?: string | undefined
158
+ statusMap?: Record<string, 'primary' | 'success' | 'warning' | 'danger' | string & {} | undefined> | undefined
159
+ }>
160
+ }
161
+ email: {}
162
+ url: {}
163
+ color: {}
164
+ file: {
165
+ fileParams: ShallowMaybeRef<{ multiple?: boolean | undefined }>
166
+ }
167
+ image: {
168
+ fileParams: ShallowMaybeRef<{ multiple?: boolean | undefined }>
169
+ }
170
+ user: {
171
+ fileParams: ShallowMaybeRef<{ multiple?: boolean | undefined, renderInfo?: UserRenderProps['renderInfo'] }>
172
+ }
173
+ dept: {
174
+ fileParams: ShallowMaybeRef<{ multiple?: boolean | undefined }>
175
+ }
176
+ }
177
+
178
+ type ModalOptionsKey = 'type' | keyof import('@ithinkdt/page').ModalOptionsBase
179
+
180
+ interface ModalDrawerOptions extends ShallowMaybeRef<Omit<DrawerContentProps, ModalOptionsKey>>, ShallowMaybeRef<Omit<DrawerProps, ModalOptionsKey>> { }
181
+
182
+ interface ModalDialogOptions extends ShallowMaybeRef<Omit<ModalOptions, ModalOptionsKey>> {}
183
+ }
184
+
185
+ export declare function createPageFormHelper(options?: {
186
+ getUserGroups?: (() => Promise<UserGroupOption[]>) | undefined
187
+ getUsersByGroup?: ((code: string) => Promise<{ username: string, nickname: string }[]>) | undefined
188
+ getUsersByDept?: ((code: string) => Promise<{ username: string, nickname: string }[]>) | undefined
189
+ getUsersByUsername?: ((usernames: string[]) => Promise<{ username: string, nickname: string }[]>) | undefined
190
+ getDeptsByCode?: (codes: string[]) => Promise<{ code: string, name: string }[]>
191
+ uploadFile?: (file: File, options?: {
192
+ onProgress?: ((percent: number) => void) | undefined
193
+ }) => Promise<string>
194
+ getFileInfos?: (files: string[]) => Promise<UploadFileInfo[]>
195
+ }): PageOptions['getFormItemRenderer']
196
+ export declare function createDescriptionHelper(options?: {
197
+ getUsersByUsername?: (usernames: string[]) => Promise<{ username: string, nickname: string }[]>
198
+ getDeptsByCode?: (codes: string[]) => Promise<{ code: string, name: string }[]>
199
+ getFileInfos?: (fileIds: string[]) => Promise<UploadFileInfo[]>
200
+ previewFileUrl?: (fileId: string) => string
201
+ }): PageOptions['getDescriptionRenderer']
202
+ export declare function createFormHelper(options?: { }): PageOptions['getFormRenderer']
203
+ export declare function createModalHelper(options?: { }): PageOptions['getModalRenderer']
package/esm/page.js ADDED
@@ -0,0 +1 @@
1
+ export * from '../dist/page.js'
@@ -0,0 +1 @@
1
+ export { c, cB, cE, cM, default, useClsPrefix } from '../dist/use-style.js'