@ttkj/avue 2.10.11 → 2.10.13

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,142 @@
1
+ /**
2
+ * 图片裁剪
3
+ * @see https://github.com/xyxiao001/vue-cropper
4
+ */
5
+ export declare class CropperImage {
6
+ /**
7
+ * 图片缩放
8
+ * @private
9
+ */
10
+ changeScale: (num: number) => void;
11
+ /**
12
+ * 向左旋转
13
+ * @private
14
+ */
15
+ rotateLeft: () => void;
16
+ /**
17
+ * 向右旋转
18
+ * @private
19
+ */
20
+ rotateRight: () => void;
21
+ /** 提交 */
22
+ submit: () => void;
23
+ /**
24
+ * 取消并关闭
25
+ * @param done el-dialog中before-close的done,用于关闭Dialog
26
+ * @private
27
+ */
28
+ cancel: (done: () => void) => void;
29
+ }
30
+
31
+ /** 图片裁剪配置项 */
32
+ export interface ImageCropperOption {
33
+ /**
34
+ * 裁剪图片的地址
35
+ */
36
+ img: string | Blob;
37
+ /**
38
+ * 裁剪生成图片的质量
39
+ * @description 可选值: 0.1 ~ 1
40
+ * @default 1
41
+ */
42
+ outputSize: number;
43
+ /**
44
+ * 裁剪生成图片的格式
45
+ * @default 'jpeg'
46
+ */
47
+ outputType: 'jpeg' | 'png' | 'webp';
48
+ /**
49
+ * 裁剪框的大小信息
50
+ * @default true
51
+ */
52
+ info: boolean;
53
+ /**
54
+ * 图片是否允许滚轮缩放
55
+ * @default true
56
+ */
57
+ canScale: boolean;
58
+ /**
59
+ * 是否默认生成截图框
60
+ * @default false
61
+ */
62
+ autoCrop: boolean;
63
+ /**
64
+ * 默认生成截图框宽度
65
+ * @description 可选值: 0 ~ max
66
+ * @default 容器的80%
67
+ */
68
+ autoCropWidth: number;
69
+ /**
70
+ * 默认生成截图框高度
71
+ * @description 可选值: 0 ~ max
72
+ * @default 容器的80%
73
+ */
74
+ autoCropHeight: number;
75
+ /**
76
+ * 是否开启截图框宽高固定比例
77
+ * @default false
78
+ */
79
+ fixed: boolean;
80
+ /**
81
+ * 截图框的宽高比例
82
+ * @description 可选值: [ 宽度 , 高度 ]
83
+ */
84
+ fixedNumber: number[];
85
+ /**
86
+ * 是否输出原图比例的截图
87
+ * @default false
88
+ */
89
+ full: boolean;
90
+ /**
91
+ * 固定截图框大小
92
+ * @default false
93
+ */
94
+ fixedBox: false;
95
+ /**
96
+ * 上传图片是否可以移动
97
+ * @default true
98
+ */
99
+ canMove: boolean;
100
+ /**
101
+ * 截图框能否拖动
102
+ * @default true
103
+ */
104
+ canMoveBox: boolean;
105
+ /**
106
+ * 上传图片按照原始比例渲染
107
+ * @default false
108
+ */
109
+ original: boolean;
110
+ /**
111
+ * 截图框是否被限制在图片里面
112
+ * @default false
113
+ */
114
+ centerBox: boolean;
115
+ /**
116
+ * 是否按照设备的dpr 输出等比例图片
117
+ * @default true
118
+ */
119
+ high: boolean;
120
+ /**
121
+ * true 为展示真实输出图片宽高 false 展示看到的截图框宽高
122
+ * @default false
123
+ */
124
+ infoTrue: boolean;
125
+ /**
126
+ * 限制图片最大宽度和高度
127
+ * @description 可选值: 0 ~ max
128
+ * @default 2000
129
+ */
130
+ maxImgSize: number;
131
+ /**
132
+ * 图片根据截图框输出比例倍数
133
+ * @description 可选值: 0 ~ max(建议不要太大不然会卡死的呢)
134
+ * @default 1
135
+ */
136
+ enlarge: number;
137
+ /**
138
+ * 图片默认渲染方式
139
+ * @default 'contain'
140
+ */
141
+ mode: 'contain' | 'cover' | '100px' | '100%' | 'auto';
142
+ }
@@ -0,0 +1,52 @@
1
+ /** 图片预览 */
2
+ export declare class ImagePreview {
3
+ /** 打印 */
4
+ handlePrint: () => void;
5
+ /** 逆时针旋转90° */
6
+ handlePrev: () => void;
7
+ /** 顺时针旋转90° */
8
+ handleNext: () => void;
9
+ /** 缩小 */
10
+ subScale: () => void;
11
+ /** 放大 */
12
+ addScale: () => void;
13
+ /** 关闭预览 */
14
+ close: () => void;
15
+ }
16
+
17
+ /** 预览内容的配置 */
18
+ export interface ImagePreviewData {
19
+ /**
20
+ * 图片URL
21
+ * @description 支持图片视频
22
+ */
23
+ url: string;
24
+ /** url不是图片和视频时生效 */
25
+ name?: string;
26
+ }
27
+
28
+ /** 图片预览方法 */
29
+ export interface ImagePreviewFn {
30
+ (
31
+ /** 图片数组 */
32
+ data: ImagePreviewData[] = [],
33
+ /** 默认打开序号 */
34
+ index = 0,
35
+ ops: Record<{
36
+ /**
37
+ * 点击modal时是否关闭
38
+ * @default false
39
+ */
40
+ closeOnClickModal: boolean;
41
+ /** 关闭前执行事件 */
42
+ beforeClose: (data: ImagePreviewData[], index: number) => void;
43
+ /** 点击事件 */
44
+ click: (item: ImagePreviewData, index: number) => void;
45
+ /**
46
+ * 是否显示modal
47
+ * @default true
48
+ */
49
+ modal: boolean;
50
+ }> = {}
51
+ ): ImagePreview;
52
+ }
@@ -0,0 +1,37 @@
1
+ import { AvueAlignment } from '../global';
2
+
3
+ /** 水印 */
4
+ export declare class WaterMark {
5
+ /** 唯一编号 */
6
+ CONTAINERID: string;
7
+ /** 配置项 */
8
+ option: Required<WaterMarkOption>;
9
+ /** 是否不监听水印 */
10
+ isOberserve: boolean;
11
+ /** 画水印 */
12
+ drawCanvas: () => void;
13
+ /** 水印视图监听 */
14
+ parentObserver: () => void;
15
+ /** 水印重置 */
16
+ Repaint: () => void;
17
+ /** 移除水印 */
18
+ remove: () => void;
19
+ }
20
+
21
+ /** 水印配置项 */
22
+ export interface WaterMarkOption {
23
+ /** 水印文字 */
24
+ text: string;
25
+ /** 水印字体font, 默认: 30px 黑体 */
26
+ font?: string;
27
+ /** 水印canvas宽度, 默认: 500 */
28
+ canvasWidth?: number;
29
+ /** 水印canvas高度, 默认: 200 */
30
+ canvasHeight?: number;
31
+ /** 水印文字对齐方式, 默认: 'center' */
32
+ textAlign?: AvueAlignment;
33
+ /** 水印文字样式, 默认: 'rgba(100,100,100,0.15)' */
34
+ textStyle?: string;
35
+ /** 水印文字旋转角度, 默认: -20 */
36
+ degree?: number;
37
+ }
@@ -0,0 +1,315 @@
1
+ import Vue from 'vue';
2
+ import { ButtonType } from 'element-ui/types/button';
3
+
4
+ import { DialogFormPlugin } from './global-component/dialog-form';
5
+ import { CropperImage, ImageCropperOption } from './global-component/image-cropper';
6
+ import { ImagePreviewFn } from './global-component/image-preview';
7
+ import { Export } from './global-component/export';
8
+ import { WaterMark, WaterMarkOption } from './global-component/watermark';
9
+ import { AvueCrudColumn } from './crud/column';
10
+ import { AvueFormColumn } from './form/column';
11
+
12
+ /** Avue组件公共定义 */
13
+ export declare class AvueComponent extends Vue {
14
+ /** 将组件注册到Vue中 */
15
+ static install(vue: typeof Vue): void;
16
+ }
17
+
18
+ /** 组件尺寸,仅对ElementUI支持的组件有效(button, input) */
19
+ export type AvueComponentSize = 'medium' | 'small' | 'mini';
20
+
21
+ /** 对齐方式 */
22
+ export type AvueAlignment = 'left' | 'center' | 'right';
23
+
24
+ /** 菜单类型 */
25
+ export type AvueMenuType = 'button' | 'text' | 'icon' | 'menu';
26
+
27
+ /**
28
+ * 对象定义
29
+ */
30
+ export declare type Obj<T = any> = Record<string, T> & Object;
31
+
32
+ /** log日志类型 */
33
+ type LogType = 'primary' | 'success' | 'warning' | 'danger' | 'text';
34
+
35
+ /** 字典Props配置 */
36
+ export interface DicProps {
37
+ /** 行主键, 默认: 'id' */
38
+ rowKey: string;
39
+ /** 行上级主键, 默认: 'parentId' */
40
+ rowParentKey: string;
41
+ /** 节点主键, 默认: 'id' */
42
+ nodeKey: string;
43
+ /** 名称属性值, 默认: 'label' */
44
+ label: string;
45
+ /** 值属性值, 默认: 'value' */
46
+ value: string;
47
+ /** 降序, 默认: 'desc' */
48
+ desc: string;
49
+ /** 分组, 默认: 'groups' */
50
+ groups: string;
51
+ /** 标题, 默认: 'title' */
52
+ title: string;
53
+ /** 是否为叶子节点, 默认: 'leaf' */
54
+ leaf: string;
55
+ /** 子属性值, 默认: 'children' */
56
+ children: string;
57
+ /** 是否有子节点, 默认: 'hasChildren' */
58
+ hasChildren: string;
59
+ /** label文字, 默认: '名称' */
60
+ labelText: string;
61
+ /** 禁用, 默认: 'disabled' */
62
+ disabled: string;
63
+ }
64
+
65
+ /** 接口请求Props配置 */
66
+ export interface DicHttpProps {
67
+ /** 文件名Key, 默认: 'name' */
68
+ name: string;
69
+ /** 文件路径Key, 默认: 'url' */
70
+ url: string;
71
+ /** 文件上传时的文件字段名Key, 默认: 'file' */
72
+ fileName: string;
73
+ /** 返回的数据格式, 默认: '' */
74
+ res: string;
75
+ /** 文件路径前缀, 默认: '' */
76
+ home: string;
77
+ }
78
+
79
+ // window属性扩展
80
+ declare global {
81
+ interface Window {
82
+ /** 日志 */
83
+ $Log: {
84
+ /**
85
+ * @description 打印一个 [ title | text ] 样式的信息
86
+ * @param {String} title title text
87
+ * @param {String} info info text
88
+ * @param {String} type style
89
+ */
90
+ capsule: (title: string, info: string, type?: ButtonType) => void;
91
+ /**
92
+ * @description 打印彩色文字
93
+ */
94
+ colorful: (text: string) => void;
95
+ /**
96
+ * @description 打印 default 样式的文字
97
+ */
98
+ default: (text: string) => void;
99
+ /**
100
+ * @description 打印 primary 样式的文字
101
+ */
102
+ primary: (text: string) => void;
103
+ /**
104
+ * @description 打印 success 样式的文字
105
+ */
106
+ success: (text: string) => void;
107
+ /**
108
+ * @description 打印 warning 样式的文字
109
+ */
110
+ warning: (text: string) => void;
111
+ /**
112
+ * @description 打印 danger 样式的文字
113
+ */
114
+ danger: (text: string) => void;
115
+ };
116
+ }
117
+ }
118
+
119
+ // 全局方法定义
120
+ declare module 'vue/types/vue' {
121
+ interface Vue {
122
+ /**
123
+ * 弹窗表单
124
+ * @since 2.9.0
125
+ */
126
+ $DialogForm: DialogFormPlugin;
127
+ /**
128
+ * 图片裁剪
129
+ * @since 2.9.9
130
+ */
131
+ $ImageCropper: (params: ImageCropperOption) => CropperImage;
132
+ /**
133
+ * 预览
134
+ * @param data 需要预览的数组
135
+ * @param {string} data[].url 需要预览的地址
136
+ * @param {string} [data[].name] url不是图片和视频时生效
137
+ * @param {number} index 默认打开序号
138
+ * @param {object} ops 其他配置
139
+ * @param {boolean} [ops.closeOnClickModal = false] 点击modal时是否关闭
140
+ * @param {Function} [ops.beforeClose] 关闭前执行事件
141
+ * @param {Function} [ops.click] 点击事件
142
+ * @param {boolean} [ops.modal = true] 是否显示modal
143
+ * @since 2.9.0
144
+ */
145
+ $ImagePreview: ImagePreviewFn;
146
+ /**
147
+ * 从对象数组查找符合条件的对象
148
+ * @param list 对象数组
149
+ * @param value 查找的关键词
150
+ * @param [key] 关键词对应的属性名
151
+ * @since 2.10.10
152
+ */
153
+ findObject: <T = Obj>(
154
+ /** 对象数组 */
155
+ list: T[],
156
+ /** 查找的关键词 */
157
+ value: string,
158
+ /** 关键词对应的属性名 */
159
+ key = 'prop'
160
+ ) => T;
161
+ /**
162
+ * 打印
163
+ * @description 打印方法在2.8.7重写,配置项与之前不同
164
+ * @since 2.8.7
165
+ */
166
+ $Print: (dom: HTMLElement | Vue | string, option?: { noPrint?: string }) => void;
167
+ /**
168
+ * 导出相关
169
+ * @since 2.8.8
170
+ */
171
+ $Export: Export;
172
+ /**
173
+ * excel导出
174
+ * @deprecated 2.8.8
175
+ */
176
+ $export: (options: {
177
+ /** excel标题 */
178
+ title: string;
179
+ /** 数据列配置 */
180
+ columns: {
181
+ /** 列名称 */
182
+ label: string;
183
+ /** 列ID */
184
+ prop: string;
185
+ }[];
186
+ /** 数据 */
187
+ data: Obj[];
188
+ }) => void;
189
+ /** 全局水印 */
190
+ watermark: (options: WaterMarkOption) => WaterMark;
191
+ /**
192
+ * 文件下载
193
+ * @param url 下载地址
194
+ */
195
+ downFile: (url: string) => void;
196
+ /**
197
+ * 加载外部链接
198
+ * @param type 链接类型,可选值为css和js
199
+ */
200
+ loadScript: (type: 'css' | 'js', url: string) => Promise;
201
+ /** 对象深拷贝 */
202
+ deepClone: <T extends Obj | Obj[]>(data: T) => T;
203
+ /**
204
+ * 设置css像素方法
205
+ * @param num css像素,数字默认加px属性
206
+ * @param defaultValue 默认值,当num为空时生效
207
+ */
208
+ setPx: (num: unknown, defaultValue = '') => string;
209
+ /**
210
+ * 判断对象、数组、字符串是否为空
211
+ */
212
+ validatenull: <T = unknown>(v: T | undefined | null) => v is undefined | null;
213
+ /**
214
+ * 根据对象属性在数组中找到符合的下标返回,没有则为-1
215
+ * @param arr 对象数组
216
+ * @param value 数组项对象的某个属性值
217
+ * @param key 数组项对象的属性名,默认为value
218
+ */
219
+ findArray: (arr: Obj[], value: any, key = 'value') => number;
220
+ /**
221
+ * 判断是否包含权限
222
+ * @param valid 是否包含权限
223
+ * @param defaultValid 默认是否包含
224
+ */
225
+ vaildData: <T = boolean>(valid?: T, defaultValid: boolean) => boolean;
226
+ /**
227
+ * 将表单项所层列表转换为一层列
228
+ * @since 2.10.10
229
+ */
230
+ flattenColumns: <T = AvueCrudColumn | AvueFormColumn>(list: T[]) => T[];
231
+ /**
232
+ * 获取所有表单项
233
+ * @description 过滤基础类型和容器类型组件
234
+ * @since 2.10.10
235
+ */
236
+ findFormColumns: <T = AvueCrudColumn | AvueFormColumn>(list: T[]) => T[];
237
+ /**
238
+ * 比较两个值是否相等
239
+ * @description 比较两个值在内容上是否相等(不仅限指针相等),仅针对基本类型
240
+ * @since 2.10.10
241
+ */
242
+ valueEquals: (a: any, b: any) => boolean;
243
+ /** 日志打印,可以打印不同颜色和标注的日志 */
244
+ $Log: {
245
+ /**
246
+ * 打印一个 [ title | text ] 样式的信息
247
+ * @param title 标题
248
+ * @param info 信息
249
+ * @param type style
250
+ */
251
+ capsule: (title: string, info: string, type: LogType = 'primary') => void;
252
+ /**
253
+ * 打印彩色文字
254
+ */
255
+ colorful: (
256
+ textArr: {
257
+ /** 日志内容 */
258
+ text: string;
259
+ /** 日志类型 */
260
+ type: LogType = 'primary';
261
+ }[]
262
+ ) => void;
263
+ /**
264
+ * 打印 default 样式的文字
265
+ * @param text 日志文字
266
+ */
267
+ default: (text: string) => void;
268
+ /**
269
+ * 打印 primary 样式的文字
270
+ * @param text 日志文字
271
+ */
272
+ primary: (text: string) => void;
273
+ /**
274
+ * 打印 success 样式的文字
275
+ * @param text 日志文字
276
+ */
277
+ success: (text: string) => void;
278
+ /**
279
+ * 打印 warning 样式的文字
280
+ * @param text 日志文字
281
+ */
282
+ warning: (text: string) => void;
283
+ /**
284
+ * 打印 danger 样式的文字
285
+ * @param text 日志文字
286
+ */
287
+ danger: (text: string) => void;
288
+ };
289
+ /**
290
+ * 复制文本到剪切板
291
+ * @param text 需要复制的文本
292
+ */
293
+ $Clipboard: (option: { text: string }) => Promise<void>;
294
+ /**
295
+ * 查找节点
296
+ * @param {object[]} list 需要查找的对象数组
297
+ * @param {object} props 搜索配置
298
+ * @param {string} [props.value='value'] 搜索值对应的字段
299
+ * @param {string} [props.children='children'] 子节点
300
+ * @param {any} value 被搜索的值
301
+ * @returns {object | undefined} 节点
302
+ * @since 2.10.10
303
+ */
304
+ findNode: (list?: Obj[], props?: Partial<DicProps>, value?: any) => Obj | undefined;
305
+ /**
306
+ * 获取当前表单项值的label
307
+ * @param row 表单数据
308
+ * @param column 表单项配置
309
+ * @param option 表单配置
310
+ * @param dic DIC配置
311
+ * @since 2.10.10
312
+ */
313
+ getLabel: (row?: Obj, column?: Obj, option?: Obj, dic?: Obj[]) => string;
314
+ }
315
+ }
@@ -0,0 +1,4 @@
1
+ export * from './avue';
2
+
3
+ import * as Avue from './avue';
4
+ export default Avue;