mtxt-ui3 0.0.2

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,127 @@
1
+ import * as vue from 'vue';
2
+ import { Ref } from 'vue';
3
+ import { Dayjs } from 'dayjs';
4
+ import _ from 'lodash';
5
+ import { MaybeRef, MaybeComputedRef } from '@vueuse/core';
6
+ import { Key } from 'ant-design-vue/lib/table/interface';
7
+
8
+ /**
9
+ * 获取当前时间并格式化
10
+ * @param pattern 格式化字符串 不传返回dayjs对象
11
+ */
12
+ declare function useNow(): Ref<Dayjs>;
13
+ declare function useNow(pattern: string): Ref<string>;
14
+
15
+ /**
16
+ * 通用表格查询hook
17
+ * @param getData 获取数据的函数 返回Promise
18
+ * @param listProp 数据列表在data中的属性 不传代表不分页
19
+ * @param totalName 总数在data中的属性 默认为totalCount
20
+ * @param pageNum 自定义每页条数 默认为10
21
+ */
22
+ declare function useTableList(getData: () => Promise<any>, listProp?: string, totalName?: string, pageNum?: number): {
23
+ isLoading: vue.Ref<boolean>;
24
+ tableList: any;
25
+ currPage: vue.Ref<number>;
26
+ handlePageChange: (page: number) => void;
27
+ pageSize: vue.Ref<number>;
28
+ hanldePageSizeChange: (size: number) => void;
29
+ total: vue.Ref<number>;
30
+ refresh: _.DebouncedFunc<() => Promise<void>>;
31
+ pagination: {
32
+ current: number;
33
+ pageSize: number;
34
+ total: number;
35
+ showSizeChanger: boolean;
36
+ showQuickJumper: boolean;
37
+ showTotal: (total: number) => string;
38
+ "onUpdate:current": (page: number) => void;
39
+ "onUpdate:pageSize": (size: number) => void;
40
+ };
41
+ };
42
+
43
+ type UseModalVisibleOption = {
44
+ clone?: boolean;
45
+ defaultVisible?: boolean;
46
+ };
47
+ /**
48
+ * 控制是否展示对话框
49
+ * @param defaultVisible 默认是否展示
50
+ * @returns {[boolean, function, object]} [是否显示,处理点击(传入row),传入的对象]
51
+ * @example
52
+ * const [isVisible, handleDetailClick, detailRecord] = useModalVisible();
53
+ * // 表格或列表中
54
+ * <a-button onClick={() => handleDetailClick(row)}>编辑</a-button>
55
+ */
56
+ declare function useModalVisible<T = any>(option?: UseModalVisibleOption): [Ref<Boolean>, (r?: T) => void, Ref<T | undefined>];
57
+
58
+ /**
59
+ * 事件hook
60
+ * 监听: useEvent('xxx', handleEvent);
61
+ * 触发: const emitXXX = useEvent('xxx'); emitXXX(...any);
62
+ * @param name 时间名称
63
+ * @param listener 回调
64
+ */
65
+ declare function useEvent(name: string, listener?: (...ard: any[]) => any): (event?: unknown, payload?: any) => void;
66
+
67
+ /**
68
+ * 自适应zoom 根据设计尺寸和实际window宽度计算
69
+ * @param designWidth 设计尺寸宽度 可以传数字或ref
70
+ * @returns zoom值
71
+ * @example
72
+ * const zoom = useZoomAdaptation(1920);
73
+ * () => <div style={{zoom: zoom.value}}><div/>
74
+ */
75
+ declare function useZoomAdaptation(designWidth?: MaybeRef<number>): vue.Ref<number>;
76
+
77
+ type RequetFunction = (...args: any[]) => any;
78
+ /**
79
+ * 卡片轮询
80
+ * @param reqFn 获取数据函数
81
+ * @param isInterval 轮询开始/停止 @default true
82
+ * @param interval 间隔 @default 5000
83
+ * @param immediate 是否立即执行 @default true
84
+ * @param immediateCallback 是否立即执行回调 @default true
85
+ */
86
+ declare function usePoolingReq(reqFn: RequetFunction, isInterval?: MaybeComputedRef<Boolean>, interval?: number, immediate?: true, immediateCallback?: true): void;
87
+
88
+ interface PlayVideoArgs {
89
+ videoElm: string;
90
+ videoDom?: Document;
91
+ mediaServerAddr: string;
92
+ cameraUserName: string;
93
+ cameraPwd: string;
94
+ cameraIp: string;
95
+ cameraRtspPort: string;
96
+ cameraChannel: string;
97
+ cameraStream: string;
98
+ addRtspProxyUrl: string;
99
+ }
100
+ declare const playOneWebRtcMt: (uuid: string, domId: string, dom?: Document, token?: string) => Promise<any>;
101
+
102
+ interface useSelectVo<T> {
103
+ onSelect: (record: T, selected: boolean) => void;
104
+ onSelectAll: (selected: boolean, selectedRows: T[], changeRows: T[]) => void;
105
+ resetSelectKey: () => void;
106
+ selectedRecords: Ref<T[]>;
107
+ selectedKeys: Ref<Key[]>;
108
+ selectedRowKeys: Ref<Key[]>;
109
+ }
110
+ /**
111
+ * Ant Table 跨页多选
112
+ * @param key 定义多选 key 值字段名 默认为 id
113
+ * 注意设置 rowKey 与 rowSelection.selectedRowKeys
114
+ */
115
+ declare const useTableSelec: <T>(key?: Key) => useSelectVo<T>;
116
+
117
+ /**
118
+ * 获取班次信息
119
+ * @param deptId 部门ID
120
+ * @param jobPostId 岗位ID
121
+ * @returns
122
+ * @example
123
+ * const shiftTime = useShiftTime(502166152148713472,457847136966696960);
124
+ */
125
+ declare function useShiftTime(deptId: any, jobPostId: any): any;
126
+
127
+ export { PlayVideoArgs, playOneWebRtcMt, useEvent, useModalVisible, useNow, usePoolingReq, useShiftTime, useTableList, useTableSelec, useZoomAdaptation };