ls-pro-common 3.0.97 → 3.0.99

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.
Files changed (54) hide show
  1. package/dist/common.css +63 -0
  2. package/dist/common.js +1 -1
  3. package/dist/common.less +2 -1
  4. package/dist/common.min.css +63 -0
  5. package/dist/common.min.js +1 -1
  6. package/es/components/InputTable.js +59 -27
  7. package/es/components/ProButton/index.d.ts +10 -0
  8. package/es/components/ProButton/index.js +40 -0
  9. package/es/components/RecordLog/index.d.ts +16 -0
  10. package/es/components/RecordLog/index.js +114 -0
  11. package/es/components/RecordLog/index.less +71 -0
  12. package/es/hooks/useMdm.d.ts +7 -0
  13. package/es/hooks/useMdm.js +47 -0
  14. package/es/http/index.d.ts +2 -1
  15. package/es/http/index.js +2 -7
  16. package/es/http/mdmRequest.d.ts +184 -0
  17. package/es/http/mdmRequest.js +351 -0
  18. package/es/index.d.ts +6 -2
  19. package/es/index.js +6 -2
  20. package/es/utils/array.d.ts +26 -0
  21. package/es/utils/array.js +74 -0
  22. package/es/utils/format.d.ts +82 -0
  23. package/es/utils/format.js +148 -0
  24. package/es/utils/index.d.ts +6 -132
  25. package/es/utils/index.js +9 -511
  26. package/es/utils/modal.d.ts +43 -0
  27. package/es/utils/modal.js +225 -0
  28. package/es/utils/size.d.ts +9 -0
  29. package/es/utils/size.js +81 -0
  30. package/lib/components/InputTable.js +59 -27
  31. package/lib/components/ProButton/index.d.ts +10 -0
  32. package/lib/components/ProButton/index.js +40 -0
  33. package/lib/components/RecordLog/index.d.ts +16 -0
  34. package/lib/components/RecordLog/index.js +114 -0
  35. package/lib/components/RecordLog/index.less +71 -0
  36. package/lib/hooks/useMdm.d.ts +7 -0
  37. package/lib/hooks/useMdm.js +47 -0
  38. package/lib/http/index.d.ts +2 -1
  39. package/lib/http/index.js +2 -7
  40. package/lib/http/mdmRequest.d.ts +184 -0
  41. package/lib/http/mdmRequest.js +351 -0
  42. package/lib/index.d.ts +6 -2
  43. package/lib/index.js +6 -2
  44. package/lib/utils/array.d.ts +26 -0
  45. package/lib/utils/array.js +74 -0
  46. package/lib/utils/format.d.ts +82 -0
  47. package/lib/utils/format.js +148 -0
  48. package/lib/utils/index.d.ts +6 -132
  49. package/lib/utils/index.js +9 -511
  50. package/lib/utils/modal.d.ts +43 -0
  51. package/lib/utils/modal.js +225 -0
  52. package/lib/utils/size.d.ts +9 -0
  53. package/lib/utils/size.js +81 -0
  54. package/package.json +2 -1
@@ -0,0 +1,82 @@
1
+ /**
2
+ * 千位符格式化数值,不处理小数点
3
+ *
4
+ * @param num 数值
5
+ * @returns Xx,xxx.xxxx
6
+ */
7
+ export declare const formatNumber: (num: number | string, decimal?: number | undefined) => string;
8
+ /**
9
+ * 千位符格式化数值
10
+ *
11
+ * @param num 数值
12
+ * @param dec 小数位数,默认为2位小数
13
+ * @returns Xx,xxx.xx
14
+ */
15
+ export declare const formatMoney: (num: number | string, dec?: number) => string;
16
+ /**
17
+ * 日期格式化
18
+ *
19
+ * @param dt 日期
20
+ * @param showTime 是否显示时间 默认为 true
21
+ * @returns YYYY-MM-DD
22
+ */
23
+ export declare const dateFormat: (dt?: Date | null | undefined, showTime?: boolean) => string;
24
+ /**
25
+ * 日期格式化
26
+ *
27
+ * @param dt 日期
28
+ * @param showTime 是否显示时间 默认true
29
+ * @returns YYYY-MM-DD hh:mm:ss
30
+ */
31
+ export declare const formatDate: (dt?: Date | null | undefined, showTime?: boolean) => string;
32
+ /**
33
+ * 返回当前日期
34
+ *
35
+ * @returns YYYY-MM-DD
36
+ */
37
+ export declare const today: () => string;
38
+ /**
39
+ * 返回当前日期时间
40
+ *
41
+ * @returns YYYY-MM-DD hh:mm:ss
42
+ */
43
+ export declare const now: () => string;
44
+ /**
45
+ * 时间加减
46
+ *
47
+ * @param dt 原始时间,传 null 为当前时间
48
+ * @param addDay 添加添数,可为负数
49
+ * @param addMonth 添加月数,可为负数
50
+ * @param addYear 添加年数,可以负责
51
+ * @returns YYYY-MM-DD hh:mm:ss
52
+ */
53
+ export declare const dateAdd: (dt: Date | null, addDay: number, addMonth?: number, addYear?: number) => string;
54
+ /**
55
+ * 当前时间加减
56
+ *
57
+ * @param addDay 添加添数,可为负数
58
+ * @param addMonth 添加月数,可为负数
59
+ * @param addYear 添加年数,可以负责
60
+ * @returns YYYY-MM-DD hh:mm:ss
61
+ */
62
+ export declare const nowAdd: (addDay: number, addMonth?: number, addYear?: number) => string;
63
+ /**
64
+ * 当前日期加减
65
+ *
66
+ * @param addDay 添加添数,可为负数
67
+ * @param addMonth 添加月数,可为负数
68
+ * @param addYear 添加年数,可以负责
69
+ * @returns YYYY-MM-DD
70
+ */
71
+ export declare const todayAdd: (addDay: number, addMonth?: number, addYear?: number) => string;
72
+ /**
73
+ * 加载下拉框的数据源
74
+ *
75
+ * @param rows 数组
76
+ * @param valueField 值字段
77
+ * @param labelField 显示字段
78
+ * @param showValue 显示值 默认为true
79
+ * @param showValueField 显示值字段 默认为valueField
80
+ * @returns 下拉框数据源
81
+ */
82
+ export declare const mapOptions: (rows: any[], valueField: string, labelField: string, showValue?: boolean, showValueField?: string) => any[];
@@ -0,0 +1,148 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ /**
3
+ * 千位符格式化数值,不处理小数点
4
+ *
5
+ * @param num 数值
6
+ * @returns Xx,xxx.xxxx
7
+ */
8
+ export var formatNumber = function formatNumber(num, decimal) {
9
+ if (typeof num !== 'number') {
10
+ num = Number(num);
11
+ if (Number.isNaN(num)) {
12
+ num = 0;
13
+ }
14
+ }
15
+ var numstr = decimal ? num.toFixed(decimal) : num.toString();
16
+ var parts = numstr.split('.');
17
+ var integerPart = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
18
+ var decimalPart = parts[1] ? '.' + parts[1] : '';
19
+ return integerPart + decimalPart;
20
+ };
21
+ /**
22
+ * 千位符格式化数值
23
+ *
24
+ * @param num 数值
25
+ * @param dec 小数位数,默认为2位小数
26
+ * @returns Xx,xxx.xx
27
+ */
28
+ export var formatMoney = function formatMoney(num) {
29
+ var dec = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
30
+ return formatNumber(num, dec);
31
+ };
32
+ /**
33
+ * 日期格式化
34
+ *
35
+ * @param dt 日期
36
+ * @param showTime 是否显示时间 默认为 true
37
+ * @returns YYYY-MM-DD
38
+ */
39
+ export var dateFormat = function dateFormat(dt) {
40
+ var showTime = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
41
+ var ct = dt ? dt : new Date(Date.now());
42
+ var str = ct.getFullYear() + '-' + ('' + (ct.getMonth() + 1)).padStart(2, '0') + '-' + ('' + ct.getDate()).padStart(2, '0');
43
+ if (showTime) {
44
+ str += ' ' + (ct.getHours() + '').padStart(2, '0') + ':' + (ct.getMinutes() + '').padStart(2, '0') + ':' + (ct.getSeconds() + '').padStart(2, '0');
45
+ }
46
+ return str;
47
+ };
48
+ /**
49
+ * 日期格式化
50
+ *
51
+ * @param dt 日期
52
+ * @param showTime 是否显示时间 默认true
53
+ * @returns YYYY-MM-DD hh:mm:ss
54
+ */
55
+ export var formatDate = dateFormat;
56
+ /**
57
+ * 返回当前日期
58
+ *
59
+ * @returns YYYY-MM-DD
60
+ */
61
+ export var today = function today() {
62
+ return dateFormat(null, false);
63
+ };
64
+ /**
65
+ * 返回当前日期时间
66
+ *
67
+ * @returns YYYY-MM-DD hh:mm:ss
68
+ */
69
+ export var now = function now() {
70
+ return dateFormat(null, true);
71
+ };
72
+ /**
73
+ * 时间加减
74
+ *
75
+ * @param dt 原始时间,传 null 为当前时间
76
+ * @param addDay 添加添数,可为负数
77
+ * @param addMonth 添加月数,可为负数
78
+ * @param addYear 添加年数,可以负责
79
+ * @returns YYYY-MM-DD hh:mm:ss
80
+ */
81
+ export var dateAdd = function dateAdd(dt, addDay) {
82
+ var addMonth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
83
+ var addYear = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
84
+ if (!dt) {
85
+ dt = new Date();
86
+ }
87
+ if (addDay) {
88
+ dt.setDate(dt.getDate() + addDay);
89
+ }
90
+ if (addMonth) {
91
+ dt.setMonth(dt.getMonth() + addMonth);
92
+ }
93
+ if (addYear) {
94
+ dt.setFullYear(dt.getFullYear() + addYear);
95
+ }
96
+ return dateFormat(dt, true);
97
+ };
98
+ /**
99
+ * 当前时间加减
100
+ *
101
+ * @param addDay 添加添数,可为负数
102
+ * @param addMonth 添加月数,可为负数
103
+ * @param addYear 添加年数,可以负责
104
+ * @returns YYYY-MM-DD hh:mm:ss
105
+ */
106
+ export var nowAdd = function nowAdd(addDay) {
107
+ var addMonth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
108
+ var addYear = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
109
+ return dateAdd(null, addDay, addMonth, addYear);
110
+ };
111
+ /**
112
+ * 当前日期加减
113
+ *
114
+ * @param addDay 添加添数,可为负数
115
+ * @param addMonth 添加月数,可为负数
116
+ * @param addYear 添加年数,可以负责
117
+ * @returns YYYY-MM-DD
118
+ */
119
+ export var todayAdd = function todayAdd(addDay) {
120
+ var addMonth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
121
+ var addYear = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
122
+ return nowAdd(addDay, addMonth, addYear).split(' ')[0];
123
+ };
124
+ /**
125
+ * 加载下拉框的数据源
126
+ *
127
+ * @param rows 数组
128
+ * @param valueField 值字段
129
+ * @param labelField 显示字段
130
+ * @param showValue 显示值 默认为true
131
+ * @param showValueField 显示值字段 默认为valueField
132
+ * @returns 下拉框数据源
133
+ */
134
+ export var mapOptions = function mapOptions(rows, valueField, labelField) {
135
+ var showValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
136
+ var showValueField = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : valueField;
137
+ if (!Array.isArray(rows)) {
138
+ return [];
139
+ }
140
+ var data = (rows || []).map(function (o) {
141
+ return _objectSpread(_objectSpread({}, o), {}, {
142
+ value: o[valueField],
143
+ text: o[labelField],
144
+ label: (showValue ? o[showValueField] + '→' : '') + o[labelField]
145
+ });
146
+ });
147
+ return data;
148
+ };
@@ -1,7 +1,9 @@
1
- import { ModalFuncProps } from 'antd';
2
- import ReactDOM from 'react-dom';
3
- import React from 'react';
4
- export { throttle, debounce } from 'lodash';
1
+ export { throttle, debounce, cloneDeep } from 'lodash';
2
+ export * from './modal';
3
+ export * from './array';
4
+ export * from './format';
5
+ export * from './size';
6
+ export { getBrowserId } from 'ls-pro-tools';
5
7
  /**
6
8
  * 获取 url 参数
7
9
  *
@@ -19,14 +21,6 @@ export declare const getResourceProps: (name: string) => any;
19
21
  * @returns
20
22
  */
21
23
  export declare const setUrlQuery: (url: string, keyvals?: Record<string, any>) => string;
22
- /**
23
- * 日期格式化
24
- *
25
- * @param dt 日期
26
- * @param showTime 是否显示时间 默认为 true
27
- * @returns YYYY-MM-DD
28
- */
29
- export declare const dateFormat: (dt?: Date | null | undefined, showTime?: boolean) => string;
30
24
  /**
31
25
  * 给 url 添加网关
32
26
  *
@@ -43,62 +37,6 @@ export declare const toGatewayUrl: (url: string, gatewayKey?: string, defGateway
43
37
  * @returns
44
38
  */
45
39
  export declare const setTitle: (title: string) => void;
46
- /**
47
- * 日期格式化
48
- *
49
- * @param dt 日期
50
- * @param showTime 是否显示时间 默认true
51
- * @returns YYYY-MM-DD hh:mm:ss
52
- */
53
- export declare const formatDate: (dt?: Date | null | undefined, showTime?: boolean) => string;
54
- /**
55
- * 返回当前日期
56
- *
57
- * @returns YYYY-MM-DD
58
- */
59
- export declare const today: () => string;
60
- /**
61
- * 返回当前日期时间
62
- *
63
- * @returns YYYY-MM-DD hh:mm:ss
64
- */
65
- export declare const now: () => string;
66
- /**
67
- * 时间加减
68
- *
69
- * @param dt 原始时间,传 null 为当前时间
70
- * @param addDay 添加添数,可为负数
71
- * @param addMonth 添加月数,可为负数
72
- * @param addYear 添加年数,可以负责
73
- * @returns YYYY-MM-DD hh:mm:ss
74
- */
75
- export declare const dateAdd: (dt: Date | null, addDay: number, addMonth?: number, addYear?: number) => string;
76
- /**
77
- * 当前时间加减
78
- *
79
- * @param addDay 添加添数,可为负数
80
- * @param addMonth 添加月数,可为负数
81
- * @param addYear 添加年数,可以负责
82
- * @returns YYYY-MM-DD hh:mm:ss
83
- */
84
- export declare const nowAdd: (addDay: number, addMonth?: number, addYear?: number) => string;
85
- /**
86
- * 当前日期加减
87
- *
88
- * @param addDay 添加添数,可为负数
89
- * @param addMonth 添加月数,可为负数
90
- * @param addYear 添加年数,可以负责
91
- * @returns YYYY-MM-DD
92
- */
93
- export declare const todayAdd: (addDay: number, addMonth?: number, addYear?: number) => string;
94
- /**
95
- * 千位符格式化数值
96
- *
97
- * @param num 数值
98
- * @param dec 小数位数,默认为2位小数
99
- * @returns Xx,xxx.xx
100
- */
101
- export declare const formatMoney: (num: number | string, dec?: number) => string;
102
40
  /**
103
41
  * 获取Cookie
104
42
  *
@@ -120,7 +58,6 @@ export declare const setCookie: (key: string, value: string | number, day?: numb
120
58
  * @returns
121
59
  */
122
60
  export declare const isLogin: () => boolean;
123
- export declare const getFullScreenElement: () => any;
124
61
  /**
125
62
  * 设置本地缓存
126
63
  *
@@ -149,32 +86,6 @@ export declare const getCacheSessionFirst: (key: string) => string | null;
149
86
  * @param session 是否session storage , 默认 localStorage
150
87
  */
151
88
  export declare const clearCache: (key?: string | undefined, session?: boolean) => void;
152
- /** @name 显示错误 */
153
- export declare const showError: (text: string, duration?: number) => void;
154
- /** @name 显示警示 */
155
- export declare const showWarn: (text: string, duration?: number) => void;
156
- /** @name 显示成功 */
157
- export declare const showSuccess: (text: string, duration?: number) => void;
158
- /**
159
- * 弹框提示
160
- *
161
- * @param text 提示信息
162
- * @param title 标题,默认 系统提示
163
- * @param type 类型
164
- * @param opts 附加参数
165
- * @returns Promise<Boolean>
166
- */
167
- export declare const showAlert: (text: React.ReactDOM | string, title?: string, type?: 'error' | 'info' | 'success' | 'warn', opts?: ModalFuncProps) => Promise<unknown>;
168
- export declare const httpError: (retMsg?: string | undefined, retCode?: string | undefined, faultCode?: string | undefined, opts?: ModalFuncProps) => Promise<unknown>;
169
- export declare const exitAlert: () => void;
170
- /** @name 显示确认 */
171
- export declare const showConfirm: (text: string, title?: string) => Promise<unknown>;
172
- /**
173
- * Token过期重新登录
174
- *
175
- * @returns
176
- */
177
- export declare const reLogin: () => void;
178
89
  /**
179
90
  * 日期组选择转换
180
91
  *
@@ -197,33 +108,6 @@ export declare const yesnoList: {
197
108
  text: string;
198
109
  label: string;
199
110
  }[];
200
- /**
201
- * 遍历树
202
- *
203
- * @param list 树对象
204
- * @param fn 回调函数
205
- * @param children 树属性字段
206
- */
207
- export declare const treeEach: (list: any[], fn: (item: any, index: any, list: any[]) => void, children?: string) => void;
208
- /**
209
- * 查询数
210
- *
211
- * @param list 树对象
212
- * @param key 查询属性
213
- * @param val 查询值
214
- * @param children 树属性字段
215
- * @returns 返回符合条件的第一条对象
216
- */
217
- export declare const treeFind: (list: any[], key: string, val: any, children?: string) => any;
218
- /**
219
- * 处理普通的尺码横排
220
- *
221
- * @param orgSizeHeader 后端返回的原始尺码组表头
222
- * @param typeWidth 尺码组宽 sizeTypeNo,默认120
223
- * @param sizeWidth 尺码宽f1~f100, 默认100
224
- * @returns 返回已处理好的表头[{dataIndex:sizeTypeNo,title:'国标码',width:120,children[...]},{dataIndex:'f1',...}...]
225
- */
226
- export declare const handleSizeCols: (orgSizeHeader: any[], typeWidth?: number, sizeWidth?: number) => any[];
227
111
  /**
228
112
  * 绑定事件
229
113
  *
@@ -311,10 +195,6 @@ export declare const openPageInMain: (option: {
311
195
  data?: any;
312
196
  ifRefreshTarget?: boolean;
313
197
  }) => void;
314
- /** 显示加载 */
315
- export declare const showLoading: (text?: string) => void;
316
- /** 退出加载 */
317
- export declare const exitLoading: () => void;
318
198
  /** 处理主题 */
319
199
  export declare const handleTheme: () => void;
320
200
  /**
@@ -331,9 +211,3 @@ export declare const sleep: (secord: number) => Promise<unknown>;
331
211
  * @param fileName 文件名
332
212
  */
333
213
  export declare const downloadFile: (url: string, fileName?: string | undefined) => void;
334
- /**
335
- * 获取浏览器指纹 基于fingerprintjs
336
- *
337
- * @returns 浏览器指纹
338
- */
339
- export declare const getBrowserId: () => Promise<string>;