dmx-admin-ui 1.2.210 → 1.2.211

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/types/admin.d.ts CHANGED
@@ -13,17 +13,24 @@ import {
13
13
  type TransferProps,
14
14
  type AutocompleteProps,
15
15
  type ButtonProps,
16
- type FormItemRule
16
+ type FormItemRule,
17
+ type TagProps,
18
+ type ImageProps,
17
19
  } from 'element-plus'
18
- import { Component } from 'vue'
20
+ import { Component, StyleValue } from 'vue'
19
21
  /** 表单字段 */
20
22
  interface ColField {
21
23
  /** 字段名 */
22
- field: string;
24
+ field?: string;
23
25
  /** 字段标题 */
24
26
  title?: string | false;
25
27
  /** title 别名 */
26
28
  label?: string | false;
29
+ tab?: number | number[];
30
+ labelWidth?: string;
31
+ class?: string;
32
+ colClass?: string;
33
+ colWidth?: string;
27
34
  slot?: string | true;
28
35
  placeholder?: string;
29
36
  clearable?: boolean;
@@ -31,39 +38,85 @@ interface ColField {
31
38
  required?: boolean;
32
39
  width?: number;
33
40
  disabled?: boolean;
41
+ /** 缺省默认值 */
42
+ value?: any;
34
43
  rules?: FormItemRule | FormItemRule[];
35
- change?: (e: any) => void;
44
+ change?: (e: {
45
+ data: any, input: {
46
+ onChange: (e: any) => void;
47
+ setValue: (e: any) => void;
48
+ relatedUpdate: (field: any, e: any) => void;
49
+ prop: Record<string, any>;
50
+ }
51
+ }) => void;
36
52
  changeField?: string[];
53
+ format?: Function
37
54
  }
38
- type ColsTypes = 'hidden' | 'input-auto' | 'input-select' | 'radio-button' | 'editor' | 'tags' | 'map' | 'pickerMap' | 'region' | 'url' | 'input-button' | 'img' | 'image' | 'file' | 'video' | 'audio' | 'group' | 'group-table' | 'group-tabs' | 'group-tabs-plus'
55
+ type ColsTypes = 'hidden' | 'text' | 'input-select' | 'radio-button' | 'editor' | 'tags' | 'map' | 'pickerMap' | 'region' | 'url' | 'img' | 'image' | 'file' | 'video' | 'audio'
56
+ type KnownTypes = ColsTypes | 'input-button' | 'input-auto' | 'imgs' | 'group-table' | 'group' | 'group-tabs' | 'group-tabs-plus' | 'selects' | 'password' | 'textarea' | 'number' | 'color' | 'switch' | 'checkbox' | 'radio' | 'slider' | 'datetimes' | 'dates' | 'datetime' | 'date' | 'time' | 'times';
57
+
39
58
  interface AnyColField extends ColField {
40
- type: ColsTypes
41
- props?: Record<string, any>;
59
+ type: ColsTypes;
42
60
  }
43
61
  interface OtherColField extends ColField {
44
- props?: Record<string, any>;
45
62
  /** 用户自定义类型 */
46
- type: Omit<string, ColsTypes>
63
+ type: Omit<string, KnownTypes>;
47
64
  }
48
65
  interface DiyField extends ColField {
49
66
  /** 自定义组件 */
50
67
  component: string | Component
51
- props?: Record<string, any>;
68
+ }
69
+ interface inputAutoField extends ColField {
70
+ type: 'input-auto';
71
+ /** input-auto 配置信息 */
72
+ list?: Record<string | number, string>;
73
+ /** el-autocomplete props属性
74
+ * @see https://element-plus.org/zh-CN/component/autocomplete#attributes
75
+ */
76
+ props?: AutocompleteProps;
77
+
78
+ }
79
+ interface inputBtnField extends ColField {
80
+ type: 'input-button'
81
+ /** input-button Props */
82
+ props: {
83
+ /** el-input props属性
84
+ * @see https://element-plus.org/zh-CN/component/input#attributes
85
+ */
86
+ props?: InputProps;
87
+ btn: {
88
+ icon?: string
89
+ text: string
90
+ click: (value: any) => any | Promise<any>
91
+ }
92
+ }
52
93
  }
53
94
  interface ImgsField extends ColField {
54
95
  type: 'imgs' | 'images';
55
96
  limit?: number;
97
+ tips?: string;
98
+ cateId?: Number;
56
99
  props?: Record<string, any>;
57
100
  }
58
101
  interface GroupTableField extends ColField {
59
- type: 'group-table' | 'group-tabs' | 'group-tabs-plus' | 'group';
102
+ type: 'group-table' | 'group';
60
103
  limit?: number;
61
- cols?: FormCol[];
104
+ cols?: (FormCol & { inputWidth?: string })[];
105
+ props?: Record<string, any>;
106
+ }
107
+ interface GroupTabsField extends ColField {
108
+ type: 'group-tabs' | 'group-tabs-plus';
109
+ limit?: number;
110
+ tabs?: Function | Record<string, any>;
111
+ cols?: (FormCol & { inputWidth?: string })[] | (FormCol & { inputWidth?: string });
62
112
  props?: Record<string, any>;
63
113
  }
64
114
  interface InputField extends ColField {
65
115
  type?: 'input';
66
- props?: Omit<InputProps, 'modelValue'>;
116
+ /** el-input props属性
117
+ * @see https://element-plus.org/zh-CN/component/input#attributes
118
+ */
119
+ props?: InputProps
67
120
  }
68
121
  interface SelectField extends ColField {
69
122
  type: 'select';
@@ -74,53 +127,89 @@ interface SelectField extends ColField {
74
127
  * 数组或对象模式 url是兼容处理 请使用cols配置
75
128
  */
76
129
  url?: { value: number | string | boolean, label: string }[] | Record<string, number | string | boolean> | string[] | string;
77
- props?: Omit<SelectPropsPublic, 'modelValue'>;
130
+ /** el-select props属性
131
+ * @see https://element-plus.org/zh-CN/component/select#select-attributes
132
+ */
133
+ props?: SelectPropsPublic
78
134
  }
79
135
  interface SliderField extends ColField {
80
136
  type: 'slider';
81
- props?: Omit<SliderPropsPublic, 'modelValue'>;
137
+ /** el-slider props属性
138
+ * @see https://element-plus.org/zh-CN/component/slider#%E5%B1%9E%E6%80%A7
139
+ */
140
+ props?: SliderPropsPublic
82
141
  }
83
142
  interface TextareaField extends ColField {
84
143
  type: 'textarea';
85
- props?: Omit<InputProps, 'type' | 'modelValue'>;
144
+ /** el-input props属性
145
+ * @see https://element-plus.org/zh-CN/component/input#attributes
146
+ */
147
+ props?: InputProps
86
148
  }
87
149
  interface PassField extends ColField {
88
150
  type: 'password';
89
- props?: Omit<InputProps, 'type' | 'modelValue'>;
151
+ /** el-input props属性
152
+ * @see https://element-plus.org/zh-CN/component/input#attributes
153
+ */
154
+ props?: InputProps
90
155
  }
91
156
  interface SwitchField extends ColField {
92
157
  type: 'switch';
93
- props?: Omit<SwitchProps, 'type' | 'modelValue'>;
158
+ cols?: [0 | false, 1 | true] | [0 | false, 1 | true, string, string];
159
+ /** el-switch props属性
160
+ * @see https://element-plus.org/zh-CN/component/switch#attributes
161
+ */
162
+ props?: SwitchProps
94
163
  }
95
164
  interface CheckboxField extends ColField {
96
165
  type: 'checkbox';
97
- props?: Omit<CheckboxProps, 'modelValue'>;
166
+ /** el-checkbox props属性
167
+ * @see https://element-plus.org/zh-CN/component/checkbox#checkbox-attributes
168
+ */
169
+ props?: CheckboxProps;
98
170
  }
99
171
  interface RadioField extends ColField {
100
172
  type: 'radio';
101
- props?: Omit<RadioProps, 'modelValue'>;
102
- /** 配置信息 */
173
+ /** el-radio props属性
174
+ * @see https://element-plus.org/zh-CN/component/radio#radio-attributes
175
+ */
176
+ props?: RadioProps;
177
+ /** 配置信息 */
103
178
  cols?: { value: number | string | boolean, label: string }[] | Record<string, number | string | boolean> | string[];
104
179
  }
105
180
  interface ColorField extends ColField {
106
181
  type: 'color';
107
- props?: Omit<ColorPickerProps, 'modelValue'>;
182
+ /** el-color-picker props属性
183
+ * @see https://element-plus.org/zh-CN/component/color-picker#attributes
184
+ */
185
+ props?: ColorPickerProps;
108
186
  }
109
187
  interface NumberField extends ColField {
110
188
  type: 'number';
111
- props?: Omit<InputNumberProps, 'modelValue'>;
189
+ /** el-input-number props属性
190
+ * @see https://element-plus.org/zh-CN/component/input-number#attributes
191
+ */
192
+ props?: InputNumberProps;
112
193
  }
113
194
  interface DateField extends ColField {
114
195
  type: 'datetimes' | 'dates' | 'datetime' | 'date';
115
- props?: Omit<DatePickerPropsPublic, 'modelValue'>;
196
+ /** el-date-picker props属性
197
+ * @see https://element-plus.org/zh-CN/component/date-picker#%E5%B1%9E%E6%80%A7
198
+ */
199
+ props?: DatePickerPropsPublic;
116
200
  }
117
201
  interface TimeField extends ColField {
118
202
  type: 'time' | 'times';
119
- props?: Omit<TimePickerDefaultPropsPublic, 'modelValue'>;
203
+ /** el-time-picker props属性
204
+ * @see https://element-plus.org/zh-CN/component/time-picker#attributes
205
+ */
206
+ props?: TimePickerDefaultPropsPublic;
120
207
  }
121
208
  interface CascaderField extends ColField {
122
209
  type: 'selects';
123
- /** el-cascader props 级联选择器属性 */
210
+ /** el-cascader props属性
211
+ * @see https://element-plus.org/zh-CN/component/cascader#cascader-attributes
212
+ */
124
213
  props?: CascaderComponentProps;
125
214
  /** api接口 或者配置信息
126
215
  * @example
@@ -131,10 +220,10 @@ interface CascaderField extends ColField {
131
220
  */
132
221
  url: string | string[] | { title: string, id: number | string, pid?: number | string }[] | { [key: string]: string };
133
222
  }
134
- export type FormCol = CascaderField | PassField | ImgsField | GroupTableField | NumberField | SelectField | SliderField | InputField | TextareaField | DateField | TimeField | SwitchField | ColorField | RadioField | CheckboxField | AnyColField | DiyField | OtherColField;
223
+ export type FormCol = CascaderField | PassField | ImgsField | GroupTableField | NumberField | SelectField | SliderField | InputField | TextareaField | DateField | TimeField | SwitchField | ColorField | RadioField | CheckboxField | GroupTabsField | inputBtnField | inputAutoField | AnyColField | DiyField | OtherColField;
135
224
  export interface AdminFormInit {
136
225
  confirmButton?: Record<string, any>;
137
- url: string | Function;
226
+ url?: string | Function;
138
227
  /** 表单宽度 字符串
139
228
  * @example
140
229
  * '50%'
@@ -144,9 +233,14 @@ export interface AdminFormInit {
144
233
  width?: string;
145
234
  /** 数据未改变时是否提示 默认true */
146
235
  noChangeTip?: boolean;
147
- beforeSubmit?: (data: Record<string, any>)=> void;
236
+ beforeSubmit?: (data: Record<string, any>) => void;
148
237
  /** 表单字段列表 */
149
238
  cols?: FormCol[];
239
+ colWidth?: string
240
+ colClass?: string
241
+ buttonFixed?: true
242
+ buttonText?: string
243
+ tabs?: string[];
150
244
  btns?: {
151
245
  title: string;
152
246
  type?: ButtonType;
@@ -174,7 +268,7 @@ interface BaseCol {
174
268
  title?: string;
175
269
  /** 列子标题 */
176
270
  subTitle?: string;
177
- slot?: string|true;
271
+ slot?: string | true;
178
272
  width?: number;
179
273
  edit?: boolean;
180
274
  /**
@@ -182,13 +276,20 @@ interface BaseCol {
182
276
  * @param row - 当前行的数据对象
183
277
  */
184
278
  on?: (row: Record<string, any>) => void;
185
- /** 列类型 */
186
- type?: string;
187
279
  sort?: boolean;
188
280
  color?: string;
189
281
  class?: string;
282
+ format?: (value: any) => any;
190
283
  /** tabs索引 */
191
284
  tab?: number | number[];
285
+ align?: 'left' | 'center' | 'right';
286
+ /** 缺省默认值 */
287
+ default?: string | number | boolean;
288
+ }
289
+ /** 基础列 */
290
+ interface AnyCol {
291
+ /** 列类型 */
292
+ type?: 'index' | 'region' | 'time' | 'times' | 'link' | 'img-info' | 'text' | 'imgs' | 'img' | 'checkbox';
192
293
  }
193
294
  /** 操作按钮 */
194
295
  interface ToolButton {
@@ -208,10 +309,56 @@ interface ToolCol {
208
309
  btn: ToolButton[];
209
310
 
210
311
  }
312
+ type CSSColor =
313
+ | `#${string}` // 十六进制
314
+ | `rgb(${number}, ${number}, ${number})`
315
+ | `rgba(${number}, ${number}, ${number}, ${number})`
316
+ | `hsl(${number}, ${number}%, ${number}%)`
317
+ | `hsla(${number}, ${number}%, ${number}%, ${number})`
318
+ | `var(--${string})`
319
+ ;
211
320
  /** 状态列 */
212
321
  interface StatusCol {
213
322
  type: 'status';
214
- cols?: { [key: number | string]: [string, '' | 'primary' | 'on' | 'info' | 'end' | 'info' | 'warning' | 'danger' | 'success'] };
323
+ cols?: { [key: number | string]: [string, '' | 'primary' | 'on' | 'info' | 'end' | 'info' | 'warning' | 'danger' | 'success' | CSSColor] };
324
+ }
325
+ /** (text)文本列 */
326
+ interface TextCol {
327
+ type: 'text';
328
+ /** 文本样式 */
329
+ textClass?: string;
330
+ cols?: Record<string | number, string>;
331
+ }
332
+ /** 图片列 */
333
+ interface ImgCol {
334
+ type: 'img' | 'imgs' | 'image' | 'images';
335
+ /** 图片宽度 图片类型使用这个参数 避免和列宽度冲突,可用此值设置图片宽度 */
336
+ imgWidth?: string;
337
+ /**
338
+ * 图片高度 请使用 imgWidth
339
+ * @deprecated
340
+ * */
341
+ width?: string;
342
+ height?: string;
343
+ /** el-image props属性
344
+ * @see https://element-plus.org/zh-CN/component/image#image-attributes
345
+ */
346
+ props: ImageProps;
347
+ }
348
+ /** (tags)标签列 */
349
+ interface TagsCol {
350
+ type: 'tags';
351
+ tagsType?: TagProps['type'];
352
+ cols: Record<string | number, string | [string, TagProps['type']]>;
353
+ }
354
+ /** (switch)开关列 */
355
+ interface SwitchCol {
356
+ type: 'switch';
357
+ cols?: [0 | false, 1 | true] | [0 | false, 1 | true, string, string];
358
+ /** el-switch props属性
359
+ * @see https://element-plus.org/zh-CN/component/switch#attributes
360
+ */
361
+ props?: SwitchProps;
215
362
  }
216
363
  /** cate列 */
217
364
  interface CateCol {
@@ -219,7 +366,7 @@ interface CateCol {
219
366
  url?: string;
220
367
  }
221
368
  /** 表格列类型 */
222
- type TableCol = BaseCol | ToolCol | StatusCol | CateCol;
369
+ type TableCol = BaseCol | ToolCol | StatusCol | CateCol | SwitchCol | TagsCol | TextCol | ImgCol | AnyCol;
223
370
 
224
371
  /** 工具栏按钮 */
225
372
  interface ToolItem {
@@ -235,11 +382,21 @@ interface ToolItem {
235
382
  interface SearchConfig {
236
383
  cols: FormCol[];
237
384
  }
238
-
385
+ /** api请求 */
386
+ type BatchActionUrl = string | ((data) => { code: number, msg: string })
239
387
  /** 批量操作 */
240
388
  interface BatchAction {
241
389
  title: string;
242
- action: 'del' | Function | { data: any, api?: string, url?: string };
390
+ action: 'del' | ((data) => void) | {
391
+ /** 批量操作附加数据 */
392
+ data: any
393
+ /** 批量操作api 已废弃 请使用url
394
+ * @deprecated
395
+ */
396
+ api?: string
397
+ /** 批量操作api */
398
+ url?: string
399
+ };
243
400
  confirm?: boolean;
244
401
  }
245
402
  interface adminTableFrom extends AdminFormInit {
@@ -248,8 +405,14 @@ interface adminTableFrom extends AdminFormInit {
248
405
  /** admin-table init */
249
406
  export interface AdminTableInit {
250
407
  url?: string;
251
- data?: any[];
408
+ data?: Record<string, any>[] | ((data: {
409
+ page: number;
410
+ limit: number;
411
+ where?: Record<string, any>;
412
+ sort?: string;
413
+ }) => { data: Record<string, any>[], count: number });
252
414
  title?: string | false;
415
+ rowHeight?: number;
253
416
  page?: boolean | number;
254
417
  limit?: number;
255
418
  pageSizes?: number[]
@@ -264,17 +427,21 @@ export interface AdminTableInit {
264
427
  * @returns 返回false则取消请求 返回对象替换请求数据 返回字符串提示错误 不返回则正常请求
265
428
  *
266
429
  */
267
- apiBefore?: (url: string, data: Record<string, any>) => string | undefined | false | Record<string, any>;
430
+ apiBefore?: (url: string, data: Record<string, any>) => string | void | false | Record<string, any>;
268
431
  /** api请求成功后监听
269
432
  * @param type api操作类型
270
- * @param data 参数1 uniApi|cellEdit|dialogSubmit类型 返回提交的数据
271
- * @param data2 参数2 uniApi|dialogSubmit类型 返回提交的url cellEdit类型 返回当前行索引
433
+ * @param data 参数1 uniApi|cellEdit|dialogSubmit类型->准备提交的数据
434
+ * @param data2 参数2 uniApi|dialogSubmit类型 -> url cellEdit类型 ->当前行索引
272
435
  */
273
436
  apiSuccess?: (type: string, data: any, data2?: any) => void;
274
437
  tabs?: TabConfig[];
275
438
  edit?: adminTableFrom;
439
+ detail?: adminTableFrom;
276
440
  del?: DeleteConfig;
277
441
  add?: adminTableFrom;
442
+ /** 表格列
443
+ * @see https://dmx-docs.netlify.app/admin/admin-table.html#_1-basecol-%E5%9F%BA%E7%A1%80%E5%88%97
444
+ */
278
445
  cols: TableCol[];
279
446
  tools?: ToolItem[];
280
447
  search?: SearchConfig;
package/types/global.d.ts CHANGED
@@ -75,6 +75,39 @@ declare global {
75
75
  /** admin-table组件 init */
76
76
  const adminTableInit: (init: AdminTableInit) => AdminTableInit
77
77
  const adminFormInit: (init: AdminFormInit) => AdminFormInit
78
+ /** 比较操作符类型 */
79
+ type ComparisonOperator =
80
+ | '=' // 等于
81
+ | '!=' // 不等于
82
+ | '>' // 大于
83
+ | '>=' // 大于等于
84
+ | '<' // 小于
85
+ | '<=' // 小于等于
86
+ | 'in' // 在数组中
87
+ | '!in' // 不在数组中
88
+ | 'contains' // 包含字符串
89
+ | 'startsWith' // 以...开头
90
+ | 'endsWith' // 以...结尾
91
+ | '>time' // 日期大于
92
+ | '<time'; // 日期小于
93
+ /**
94
+ * 数据搜索函数
95
+ *
96
+ * @param data - 数据数组
97
+ * @param option - 搜索选项
98
+ * - page: 页码
99
+ * - limit: 每页数量
100
+ * - where: 过滤条件
101
+ * - sort: 排序字段
102
+ * @param comparisonOperators - 比较运算符映射
103
+ */
104
+ const dataSearch: (data: Record<string, any>[], option: {
105
+ page: number;
106
+ limit: number;
107
+ where?: Record<string, any>;
108
+ sort?: string;
109
+ },
110
+ comparisonOperators?: Record<string,((itemValue:any, targetValue:any)=>boolean) | ComparisonOperator>) => { data: Record<string, any>[], count: number }
78
111
  }
79
112
  declare module 'vue' {
80
113
  interface ComponentCustomProperties {
@@ -598,7 +631,77 @@ interface _default {
598
631
  locale: string;
599
632
  threshold: unknown[];
600
633
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
601
- AImage: import('vue').DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import('vue').PublicProps>;
634
+ AImage: import('vue').DefineComponent<globalThis.ExtractPropTypes<{
635
+ src: StringConstructor;
636
+ width: {
637
+ type: (StringConstructor | NumberConstructor)[];
638
+ };
639
+ height: {
640
+ type: (StringConstructor | NumberConstructor)[];
641
+ };
642
+ background: {
643
+ type: StringConstructor;
644
+ default: string;
645
+ };
646
+ borderRadius: StringConstructor;
647
+ css: StringConstructor;
648
+ process: {
649
+ type: StringConstructor;
650
+ default: string;
651
+ };
652
+ lazy: {
653
+ type: BooleanConstructor;
654
+ default: boolean;
655
+ };
656
+ index: {
657
+ type: NumberConstructor;
658
+ default: number;
659
+ };
660
+ preview: {
661
+ type: (ArrayConstructor | BooleanConstructor)[];
662
+ default: boolean;
663
+ };
664
+ }>, {}, {
665
+ previewSrcList: never[];
666
+ }, {}, {
667
+ addUnit(value: string | number): string;
668
+ }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<globalThis.ExtractPropTypes<{
669
+ src: StringConstructor;
670
+ width: {
671
+ type: (StringConstructor | NumberConstructor)[];
672
+ };
673
+ height: {
674
+ type: (StringConstructor | NumberConstructor)[];
675
+ };
676
+ background: {
677
+ type: StringConstructor;
678
+ default: string;
679
+ };
680
+ borderRadius: StringConstructor;
681
+ css: StringConstructor;
682
+ process: {
683
+ type: StringConstructor;
684
+ default: string;
685
+ };
686
+ lazy: {
687
+ type: BooleanConstructor;
688
+ default: boolean;
689
+ };
690
+ index: {
691
+ type: NumberConstructor;
692
+ default: number;
693
+ };
694
+ preview: {
695
+ type: (ArrayConstructor | BooleanConstructor)[];
696
+ default: boolean;
697
+ };
698
+ }>> & Readonly<{}>, {
699
+ background: string;
700
+ process: string;
701
+ lazy: boolean;
702
+ index: number;
703
+ preview: boolean | unknown[];
704
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
602
705
  AImageText: import('vue').DefineComponent<globalThis.ExtractPropTypes<{
603
706
  modelValue: {
604
707
  type: (ObjectConstructor | ArrayConstructor)[];
@@ -1,4 +0,0 @@
1
- import { a as f } from "./index-DFfplvww.js";
2
- export {
3
- f as default
4
- };