dmx-admin-ui 1.2.208 → 1.2.210

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.
@@ -0,0 +1,282 @@
1
+ import {
2
+ type InputProps,
3
+ type InputNumberProps,
4
+ type SelectPropsPublic,
5
+ type CascaderComponentProps,
6
+ type DatePickerPropsPublic,
7
+ type TimePickerDefaultPropsPublic,
8
+ type SwitchProps,
9
+ type CheckboxProps,
10
+ type RadioProps,
11
+ type SliderPropsPublic,
12
+ type ColorPickerProps,
13
+ type TransferProps,
14
+ type AutocompleteProps,
15
+ type ButtonProps,
16
+ type FormItemRule
17
+ } from 'element-plus'
18
+ import { Component } from 'vue'
19
+ /** 表单字段 */
20
+ interface ColField {
21
+ /** 字段名 */
22
+ field: string;
23
+ /** 字段标题 */
24
+ title?: string | false;
25
+ /** title 别名 */
26
+ label?: string | false;
27
+ slot?: string | true;
28
+ placeholder?: string;
29
+ clearable?: boolean;
30
+ info?: string;
31
+ required?: boolean;
32
+ width?: number;
33
+ disabled?: boolean;
34
+ rules?: FormItemRule | FormItemRule[];
35
+ change?: (e: any) => void;
36
+ changeField?: string[];
37
+ }
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'
39
+ interface AnyColField extends ColField {
40
+ type: ColsTypes
41
+ props?: Record<string, any>;
42
+ }
43
+ interface OtherColField extends ColField {
44
+ props?: Record<string, any>;
45
+ /** 用户自定义类型 */
46
+ type: Omit<string, ColsTypes>
47
+ }
48
+ interface DiyField extends ColField {
49
+ /** 自定义组件 */
50
+ component: string | Component
51
+ props?: Record<string, any>;
52
+ }
53
+ interface ImgsField extends ColField {
54
+ type: 'imgs' | 'images';
55
+ limit?: number;
56
+ props?: Record<string, any>;
57
+ }
58
+ interface GroupTableField extends ColField {
59
+ type: 'group-table' | 'group-tabs' | 'group-tabs-plus' | 'group';
60
+ limit?: number;
61
+ cols?: FormCol[];
62
+ props?: Record<string, any>;
63
+ }
64
+ interface InputField extends ColField {
65
+ type?: 'input';
66
+ props?: Omit<InputProps, 'modelValue'>;
67
+ }
68
+ interface SelectField extends ColField {
69
+ type: 'select';
70
+ /** 配置信息 */
71
+ cols?: { value: number | string | boolean, label: string }[] | Record<string, number | string | boolean> | string[];
72
+ /** api接口 或者配置信息
73
+ * 字符串模式 只在admin-table下的表单有效
74
+ * 数组或对象模式 url是兼容处理 请使用cols配置
75
+ */
76
+ url?: { value: number | string | boolean, label: string }[] | Record<string, number | string | boolean> | string[] | string;
77
+ props?: Omit<SelectPropsPublic, 'modelValue'>;
78
+ }
79
+ interface SliderField extends ColField {
80
+ type: 'slider';
81
+ props?: Omit<SliderPropsPublic, 'modelValue'>;
82
+ }
83
+ interface TextareaField extends ColField {
84
+ type: 'textarea';
85
+ props?: Omit<InputProps, 'type' | 'modelValue'>;
86
+ }
87
+ interface PassField extends ColField {
88
+ type: 'password';
89
+ props?: Omit<InputProps, 'type' | 'modelValue'>;
90
+ }
91
+ interface SwitchField extends ColField {
92
+ type: 'switch';
93
+ props?: Omit<SwitchProps, 'type' | 'modelValue'>;
94
+ }
95
+ interface CheckboxField extends ColField {
96
+ type: 'checkbox';
97
+ props?: Omit<CheckboxProps, 'modelValue'>;
98
+ }
99
+ interface RadioField extends ColField {
100
+ type: 'radio';
101
+ props?: Omit<RadioProps, 'modelValue'>;
102
+ /** 配置信息 */
103
+ cols?: { value: number | string | boolean, label: string }[] | Record<string, number | string | boolean> | string[];
104
+ }
105
+ interface ColorField extends ColField {
106
+ type: 'color';
107
+ props?: Omit<ColorPickerProps, 'modelValue'>;
108
+ }
109
+ interface NumberField extends ColField {
110
+ type: 'number';
111
+ props?: Omit<InputNumberProps, 'modelValue'>;
112
+ }
113
+ interface DateField extends ColField {
114
+ type: 'datetimes' | 'dates' | 'datetime' | 'date';
115
+ props?: Omit<DatePickerPropsPublic, 'modelValue'>;
116
+ }
117
+ interface TimeField extends ColField {
118
+ type: 'time' | 'times';
119
+ props?: Omit<TimePickerDefaultPropsPublic, 'modelValue'>;
120
+ }
121
+ interface CascaderField extends ColField {
122
+ type: 'selects';
123
+ /** el-cascader props 级联选择器属性 */
124
+ props?: CascaderComponentProps;
125
+ /** api接口 或者配置信息
126
+ * @example
127
+ * url: 'api/goods_cate'
128
+ * url: ['分类1', '分类2']
129
+ * url: [{title:'分类1',id:1},{title:'分类2',id:2},{title:'分类1-1',id:3,pid:1}]
130
+ * url: {cate1: '分类1', cate2: '分类1' }
131
+ */
132
+ url: string | string[] | { title: string, id: number | string, pid?: number | string }[] | { [key: string]: string };
133
+ }
134
+ export type FormCol = CascaderField | PassField | ImgsField | GroupTableField | NumberField | SelectField | SliderField | InputField | TextareaField | DateField | TimeField | SwitchField | ColorField | RadioField | CheckboxField | AnyColField | DiyField | OtherColField;
135
+ export interface AdminFormInit {
136
+ confirmButton?: Record<string, any>;
137
+ url: string | Function;
138
+ /** 表单宽度 字符串
139
+ * @example
140
+ * '50%'
141
+ * '500px'
142
+ *
143
+ */
144
+ width?: string;
145
+ /** 数据未改变时是否提示 默认true */
146
+ noChangeTip?: boolean;
147
+ beforeSubmit?: (data: Record<string, any>)=> void;
148
+ /** 表单字段列表 */
149
+ cols?: FormCol[];
150
+ btns?: {
151
+ title: string;
152
+ type?: ButtonType;
153
+ action: Function;
154
+ confirm?: boolean;
155
+
156
+ }[]
157
+ }
158
+ export type ButtonType = ButtonProps['type']
159
+ /** 删除配置 */
160
+ interface DeleteConfig {
161
+ url: string | ((e: Record<string, any>) => void);
162
+ }
163
+
164
+ /** 标签页配置 */
165
+ interface TabConfig {
166
+ title: string;
167
+ where?: Record<string, any>;
168
+ }
169
+ /** 表格列基础类型 */
170
+ interface BaseCol {
171
+ /** 字段名 */
172
+ field?: string;
173
+ /** 列标题 */
174
+ title?: string;
175
+ /** 列子标题 */
176
+ subTitle?: string;
177
+ slot?: string|true;
178
+ width?: number;
179
+ edit?: boolean;
180
+ /**
181
+ * 列点击事件
182
+ * @param row - 当前行的数据对象
183
+ */
184
+ on?: (row: Record<string, any>) => void;
185
+ /** 列类型 */
186
+ type?: string;
187
+ sort?: boolean;
188
+ color?: string;
189
+ class?: string;
190
+ /** tabs索引 */
191
+ tab?: number | number[];
192
+ }
193
+ /** 操作按钮 */
194
+ interface ToolButton {
195
+ title?: string;
196
+ action: 'edit' | 'del' | 'detail' | ((row: Record<string, any>, index: number) => void);
197
+ /** tabs索引 */
198
+ tab?: number | number[];
199
+ /** 是否显示确认框 */
200
+ confirm?: boolean;
201
+ }
202
+
203
+ /** 操作栏列 */
204
+ interface ToolCol {
205
+ type: 'tool';
206
+ before?: (row: Record<string, any>) => void;
207
+ /** 工具栏按钮 */
208
+ btn: ToolButton[];
209
+
210
+ }
211
+ /** 状态列 */
212
+ interface StatusCol {
213
+ type: 'status';
214
+ cols?: { [key: number | string]: [string, '' | 'primary' | 'on' | 'info' | 'end' | 'info' | 'warning' | 'danger' | 'success'] };
215
+ }
216
+ /** cate列 */
217
+ interface CateCol {
218
+ type: 'cate';
219
+ url?: string;
220
+ }
221
+ /** 表格列类型 */
222
+ type TableCol = BaseCol | ToolCol | StatusCol | CateCol;
223
+
224
+ /** 工具栏按钮 */
225
+ interface ToolItem {
226
+ title?: string;
227
+ icon?: string;
228
+ type?: ButtonType;
229
+ action?: 'add' | Function;
230
+ confirm?: boolean;
231
+ }
232
+
233
+
234
+ /** 搜索配置 */
235
+ interface SearchConfig {
236
+ cols: FormCol[];
237
+ }
238
+
239
+ /** 批量操作 */
240
+ interface BatchAction {
241
+ title: string;
242
+ action: 'del' | Function | { data: any, api?: string, url?: string };
243
+ confirm?: boolean;
244
+ }
245
+ interface adminTableFrom extends AdminFormInit {
246
+ title?: string | false;
247
+ }
248
+ /** admin-table init */
249
+ export interface AdminTableInit {
250
+ url?: string;
251
+ data?: any[];
252
+ title?: string | false;
253
+ page?: boolean | number;
254
+ limit?: number;
255
+ pageSizes?: number[]
256
+ pk?: string
257
+ /** 操作缓存标识 */
258
+ name?: string;
259
+ /** 是否树形结构 */
260
+ tree?: boolean;
261
+ /** api请求前处理 包含表格里的删除 修改 添加 等APi请求
262
+ * @param url 请求url
263
+ * @param data 请求参数
264
+ * @returns 返回false则取消请求 返回对象替换请求数据 返回字符串提示错误 不返回则正常请求
265
+ *
266
+ */
267
+ apiBefore?: (url: string, data: Record<string, any>) => string | undefined | false | Record<string, any>;
268
+ /** api请求成功后监听
269
+ * @param type api操作类型
270
+ * @param data 参数1 uniApi|cellEdit|dialogSubmit类型 返回提交的数据
271
+ * @param data2 参数2 uniApi|dialogSubmit类型 返回提交的url cellEdit类型 返回当前行索引
272
+ */
273
+ apiSuccess?: (type: string, data: any, data2?: any) => void;
274
+ tabs?: TabConfig[];
275
+ edit?: adminTableFrom;
276
+ del?: DeleteConfig;
277
+ add?: adminTableFrom;
278
+ cols: TableCol[];
279
+ tools?: ToolItem[];
280
+ search?: SearchConfig;
281
+ batch?: BatchAction[];
282
+ }
package/types/global.d.ts CHANGED
@@ -8,6 +8,7 @@ const reqs = new req({})
8
8
  const pages = new page({})
9
9
  import np from "number-precision";
10
10
  import { dayjs as dayjss } from 'element-plus'
11
+ import { AdminTableInit, AdminFormInit } from './admin';
11
12
  export { };
12
13
  interface Config {
13
14
  apis: {
@@ -63,27 +64,30 @@ declare global {
63
64
  const $prompt: typeof layer.prompt
64
65
  const $theme: { [key: string]: string }
65
66
  const $store: { [key: string]: string }
66
- const $cache:typeof cache
67
+ const $cache: typeof cache
67
68
  const $config: Config
68
69
  const dayjs: typeof dayjss
69
70
  const $langs: { [key: string]: string }
70
71
  const $fileUrl: (url: string) => string
71
- const loadjs:typeof load
72
+ const loadjs: typeof load
72
73
  /** [宏]导入指定文件下的vue组件 从项目根目录开始 */
73
- const $macroComponents : (dir:string)=>{}
74
+ const $macroComponents: (dir: string) => {}
75
+ /** admin-table组件 init */
76
+ const adminTableInit: (init: AdminTableInit) => AdminTableInit
77
+ const adminFormInit: (init: AdminFormInit) => AdminFormInit
74
78
  }
75
79
  declare module 'vue' {
76
80
  interface ComponentCustomProperties {
77
- $root:InstanceType<typeof root>
78
- $config: typeof config
79
- $go: typeof pages
80
- }
81
+ $root: InstanceType<typeof root>
82
+ $config: typeof config
83
+ $go: typeof pages
84
+ }
81
85
  }
82
86
 
83
- import {ElImage} from "element-plus";
84
- interface _default {
87
+ import { ElImage } from "element-plus";
88
+ interface _default {
85
89
  AdminTable: {
86
- new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<globalThis.ExtractPropTypes<{
90
+ new(...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<globalThis.ExtractPropTypes<{
87
91
  init: ObjectConstructor;
88
92
  }>> & Readonly<{
89
93
  onChange?: (...args: any[]) => any;
@@ -732,7 +736,7 @@ interface _default {
732
736
  status: string;
733
737
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
734
738
  ADraggable: {
735
- new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<globalThis.ExtractPropTypes<{
739
+ new(...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<globalThis.ExtractPropTypes<{
736
740
  options: ObjectConstructor;
737
741
  list: {
738
742
  type: ArrayConstructor;
@@ -993,7 +997,7 @@ interface _default {
993
997
  };
994
998
  });
995
999
  AChart: {
996
- new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<globalThis.ExtractPropTypes<{
1000
+ new(...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<globalThis.ExtractPropTypes<{
997
1001
  init: {
998
1002
  type: ObjectConstructor;
999
1003
  default: () => {};
@@ -1110,28 +1114,28 @@ interface _default {
1110
1114
  }
1111
1115
  declare module 'vue' {
1112
1116
  interface GlobalComponents {
1113
- AdminTable: _default['AdminTable']
1114
- AdminForm: _default['AdminForm']
1115
- DataApi: _default['DataApi']
1116
- ASearch: _default['ASearch']
1117
- AInputs: _default['AInputs']
1118
- InputButton: _default['InputButton']
1119
- ASearchBox: _default['ASearchBox']
1120
- ATip: _default['ATip']
1121
- ATextEdit: _default['ATextEdit']
1122
- ACateText: _default['ACateText']
1123
- ACascader: _default['ACascader']
1124
- ATags: _default['ATags']
1125
- ATime: _default['ATime']
1126
- AImage:_default['AImage'] & typeof ElImage
1127
- AImageText: _default['AImageText']
1128
- AColorPicker: _default['AColorPicker']
1129
- ARegionPicker: _default['ARegionPicker']
1130
- ARegionText: _default['ARegionText']
1131
- ARegionMap: _default['ARegionMap']
1132
- ATextStatus: _default['ATextStatus']
1133
- ADraggable: _default['ADraggable']
1134
- AChart: _default['AChart']
1135
- AEditor: _default['AEditor']
1136
- }
1117
+ AdminTable: _default['AdminTable']
1118
+ AdminForm: _default['AdminForm']
1119
+ DataApi: _default['DataApi']
1120
+ ASearch: _default['ASearch']
1121
+ AInputs: _default['AInputs']
1122
+ InputButton: _default['InputButton']
1123
+ ASearchBox: _default['ASearchBox']
1124
+ ATip: _default['ATip']
1125
+ ATextEdit: _default['ATextEdit']
1126
+ ACateText: _default['ACateText']
1127
+ ACascader: _default['ACascader']
1128
+ ATags: _default['ATags']
1129
+ ATime: _default['ATime']
1130
+ AImage: _default['AImage'] & typeof ElImage
1131
+ AImageText: _default['AImageText']
1132
+ AColorPicker: _default['AColorPicker']
1133
+ ARegionPicker: _default['ARegionPicker']
1134
+ ARegionText: _default['ARegionText']
1135
+ ARegionMap: _default['ARegionMap']
1136
+ ATextStatus: _default['ATextStatus']
1137
+ ADraggable: _default['ADraggable']
1138
+ AChart: _default['AChart']
1139
+ AEditor: _default['AEditor']
1140
+ }
1137
1141
  }
@@ -1,8 +1,8 @@
1
- declare const _default: {
2
- list: () => any[];
3
- set: (key: any, value: any, time?: number | string) => void;
4
- remove: (key: any) => void;
5
- clear: () => void;
6
- get: (key: any, type?: boolean) => any;
7
- };
8
- export default _default;
1
+ declare const _default: {
2
+ list: () => any[];
3
+ set: (key: any, value: any, time?: number | string) => void;
4
+ remove: (key: any) => void;
5
+ clear: () => void;
6
+ get: (key: any, type?: boolean) => any;
7
+ };
8
+ export default _default;
@@ -1,2 +1,2 @@
1
- declare const copy: (value: any, tips?: string) => void;
2
- export default copy;
1
+ declare const copy: (value: any, tips?: string) => void;
2
+ export default copy;
@@ -1,7 +1,7 @@
1
- export { default as cache } from './cache';
2
- export { default as layer } from './layer';
3
- export { default as page } from './page';
4
- export { default as req } from './req';
5
- export { default as copy } from './copy';
6
- export { default as util } from './util';
7
- export { default as loadjs } from './loadjs';
1
+ export { default as cache } from './cache';
2
+ export { default as layer } from './layer';
3
+ export { default as page } from './page';
4
+ export { default as req } from './req';
5
+ export { default as copy } from './copy';
6
+ export { default as util } from './util';
7
+ export { default as loadjs } from './loadjs';
@@ -1,42 +1,42 @@
1
- import { MessageParams } from 'element-plus';
2
- declare const $msg: {
3
- (options?: MessageParams): import('element-plus').MessageHandler;
4
- info(msg: any): import('element-plus').MessageHandler;
5
- success(msg: any): import('element-plus').MessageHandler;
6
- error(msg: any): import('element-plus').MessageHandler;
7
- warning(msg: any): import('element-plus').MessageHandler;
8
- confirm(msg: any, title?: string, options?: {}): Promise<import('element-plus').MessageBoxData>;
9
- prompt(msg: any, title?: string, options?: {}): Promise<import('element-plus').MessageBoxData>;
10
- loading(title?: true | string): {
11
- setText: (text: string | VNode | VNode[]) => void;
12
- removeElLoadingChild: () => void;
13
- close: () => void;
14
- handleAfterLeave: () => void;
15
- vm: globalThis.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import('vue').ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}, {}, {}, string, import('vue').ComponentProvideOptions>, {}, {}, "", {}, any>;
16
- $el: HTMLElement;
17
- originalPosition: globalThis.Ref<string, string>;
18
- originalOverflow: globalThis.Ref<string, string>;
19
- visible: globalThis.Ref<boolean, boolean>;
20
- parent: globalThis.Ref<import('element-plus').LoadingParentElement, import('element-plus').LoadingParentElement>;
21
- background: globalThis.Ref<string, string>;
22
- svg: globalThis.Ref<string, string>;
23
- svgViewBox: globalThis.Ref<string, string>;
24
- spinner: globalThis.Ref<string | boolean, string | boolean>;
25
- text: globalThis.Ref<string | VNode<import('vue').RendererNode, import('vue').RendererElement, {
26
- [key: string]: any;
27
- }> | VNode<import('vue').RendererNode, import('vue').RendererElement, {
28
- [key: string]: any;
29
- }>[], string | VNode<import('vue').RendererNode, import('vue').RendererElement, {
30
- [key: string]: any;
31
- }> | VNode<import('vue').RendererNode, import('vue').RendererElement, {
32
- [key: string]: any;
33
- }>[]>;
34
- fullscreen: globalThis.Ref<boolean, boolean>;
35
- lock: globalThis.Ref<boolean, boolean>;
36
- customClass: globalThis.Ref<string, string>;
37
- target: globalThis.Ref<HTMLElement, HTMLElement>;
38
- beforeClose?: globalThis.Ref<(() => boolean) | undefined, (() => boolean) | undefined> | undefined;
39
- closed?: globalThis.Ref<(() => void) | undefined, (() => void) | undefined> | undefined;
40
- };
41
- };
42
- export default $msg;
1
+ import { MessageParams } from 'element-plus';
2
+ declare const $msg: {
3
+ (options?: MessageParams): import('element-plus').MessageHandler;
4
+ info(msg: any): import('element-plus').MessageHandler;
5
+ success(msg: any): import('element-plus').MessageHandler;
6
+ error(msg: any): import('element-plus').MessageHandler;
7
+ warning(msg: any): import('element-plus').MessageHandler;
8
+ confirm(msg: any, title?: string, options?: {}): Promise<import('element-plus').MessageBoxData>;
9
+ prompt(msg: any, title?: string, options?: {}): Promise<import('element-plus').MessageBoxData>;
10
+ loading(title?: true | string): {
11
+ setText: (text: string | VNode | VNode[]) => void;
12
+ removeElLoadingChild: () => void;
13
+ close: () => void;
14
+ handleAfterLeave: () => void;
15
+ vm: globalThis.ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import('vue').ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}, {}, {}, string, import('vue').ComponentProvideOptions>, {}, {}, "", {}, any>;
16
+ $el: HTMLElement;
17
+ originalPosition: globalThis.Ref<string, string>;
18
+ originalOverflow: globalThis.Ref<string, string>;
19
+ visible: globalThis.Ref<boolean, boolean>;
20
+ parent: globalThis.Ref<import('element-plus').LoadingParentElement, import('element-plus').LoadingParentElement>;
21
+ background: globalThis.Ref<string, string>;
22
+ svg: globalThis.Ref<string, string>;
23
+ svgViewBox: globalThis.Ref<string, string>;
24
+ spinner: globalThis.Ref<string | boolean, string | boolean>;
25
+ text: globalThis.Ref<string | VNode<import('vue').RendererNode, import('vue').RendererElement, {
26
+ [key: string]: any;
27
+ }> | VNode<import('vue').RendererNode, import('vue').RendererElement, {
28
+ [key: string]: any;
29
+ }>[], string | VNode<import('vue').RendererNode, import('vue').RendererElement, {
30
+ [key: string]: any;
31
+ }> | VNode<import('vue').RendererNode, import('vue').RendererElement, {
32
+ [key: string]: any;
33
+ }>[]>;
34
+ fullscreen: globalThis.Ref<boolean, boolean>;
35
+ lock: globalThis.Ref<boolean, boolean>;
36
+ customClass: globalThis.Ref<string, string>;
37
+ target: globalThis.Ref<HTMLElement, HTMLElement>;
38
+ beforeClose?: globalThis.Ref<(() => boolean) | undefined, (() => boolean) | undefined> | undefined;
39
+ closed?: globalThis.Ref<(() => void) | undefined, (() => void) | undefined> | undefined;
40
+ };
41
+ };
42
+ export default $msg;
@@ -1 +1 @@
1
- export default function loadScript(globalName: string, src: string, callback?: () => void): void;
1
+ export default function loadScript(globalName: string, src: string, callback?: () => void): void;
@@ -1,9 +1,9 @@
1
- declare function query(data: any, name?: string): any;
2
- export default class Page {
3
- data: any;
4
- router: any;
5
- query: typeof query;
6
- constructor(routers: any);
7
- to(url: any, data?: any): any;
8
- }
9
- export {};
1
+ declare function query(data: any, name?: string): any;
2
+ export default class Page {
3
+ data: any;
4
+ router: any;
5
+ query: typeof query;
6
+ constructor(routers: any);
7
+ to(url: any, data?: any): any;
8
+ }
9
+ export {};