ls-pro-common 3.1.44 → 3.1.46
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/dist/common.css +16 -0
- package/dist/common.js +1 -1
- package/dist/common.less +2 -1
- package/dist/common.min.css +16 -0
- package/dist/common.min.js +1 -1
- package/es/components/Select/AreaCitySelect.d.ts +5 -0
- package/es/components/Select/AreaCitySelect.js +25 -0
- package/es/components/Select/AreaDistrictSelect.d.ts +5 -0
- package/es/components/Select/AreaDistrictSelect.js +25 -0
- package/es/components/Select/AreaProvinceSelect.d.ts +5 -0
- package/es/components/Select/AreaProvinceSelect.js +25 -0
- package/es/components/Select/Base.d.ts +11 -0
- package/es/components/Select/Base.js +128 -0
- package/es/components/Select/BrandDeptSelect.d.ts +5 -0
- package/es/components/Select/BrandDeptSelect.js +12 -0
- package/es/components/Select/CategorySelect.d.ts +5 -0
- package/es/components/Select/CategorySelect.js +12 -0
- package/es/components/Select/ColorSelect.d.ts +5 -0
- package/es/components/Select/ColorSelect.js +12 -0
- package/es/components/Select/ExpressCompanyPageSelect.d.ts +5 -0
- package/es/components/Select/ExpressCompanyPageSelect.js +12 -0
- package/es/components/Select/ExpressCompanySelect.d.ts +5 -0
- package/es/components/Select/ExpressCompanySelect.js +12 -0
- package/es/components/Select/GenderSelect.d.ts +5 -0
- package/es/components/Select/GenderSelect.js +12 -0
- package/es/components/Select/LogisticCategorySelect.d.ts +5 -0
- package/es/components/Select/LogisticCategorySelect.js +12 -0
- package/es/components/Select/LogisticRegionSelect.d.ts +5 -0
- package/es/components/Select/LogisticRegionSelect.js +12 -0
- package/es/components/Select/ManagingCitySelect.d.ts +5 -0
- package/es/components/Select/ManagingCitySelect.js +12 -0
- package/es/components/Select/OwnerSelect.d.ts +5 -0
- package/es/components/Select/OwnerSelect.js +12 -0
- package/es/components/Select/PhysicalStoreSelect.d.ts +5 -0
- package/es/components/Select/PhysicalStoreSelect.js +12 -0
- package/es/components/Select/PowerUnitSelect.d.ts +5 -0
- package/es/components/Select/PowerUnitSelect.js +12 -0
- package/es/components/Select/ProfitLossMainSelect.d.ts +5 -0
- package/es/components/Select/ProfitLossMainSelect.js +12 -0
- package/es/components/Select/SeasonSelect.d.ts +5 -0
- package/es/components/Select/SeasonSelect.js +12 -0
- package/es/components/Select/SettleAccountSelect.d.ts +5 -0
- package/es/components/Select/SettleAccountSelect.js +12 -0
- package/es/components/Select/SettleCategorySelect.d.ts +5 -0
- package/es/components/Select/SettleCategorySelect.js +12 -0
- package/es/components/Select/SettleCompanySelect.d.ts +5 -0
- package/es/components/Select/SettleCompanySelect.js +12 -0
- package/es/components/Select/ShopPageSelect.d.ts +5 -0
- package/es/components/Select/ShopPageSelect.js +12 -0
- package/es/components/Select/SizeTypeSelect.d.ts +5 -0
- package/es/components/Select/SizeTypeSelect.js +12 -0
- package/es/components/Select/StoreSelect.d.ts +5 -0
- package/es/components/Select/StoreSelect.js +12 -0
- package/es/components/Select/SupplierSelect.d.ts +5 -0
- package/es/components/Select/SupplierSelect.js +12 -0
- package/es/components/Select/TransportLocnoSelect.d.ts +5 -0
- package/es/components/Select/TransportLocnoSelect.js +12 -0
- package/es/components/Select/TransportPointPageSelect.d.ts +5 -0
- package/es/components/Select/TransportPointPageSelect.js +12 -0
- package/es/components/Select/UploadPointPageSelect.d.ts +5 -0
- package/es/components/Select/UploadPointPageSelect.js +12 -0
- package/es/components/Select/YearSelect.d.ts +5 -0
- package/es/components/Select/YearSelect.js +12 -0
- package/es/components/Select/common.d.ts +32 -0
- package/es/components/Select/common.js +20 -0
- package/es/components/Select/index.less +17 -0
- package/es/components/ViewOffice.js +6 -5
- package/es/components/index.d.ts +28 -0
- package/es/components/index.js +29 -1
- package/es/hooks/useMdm.d.ts +11 -2
- package/es/hooks/useMdm.js +26 -11
- package/es/http/index.d.ts +21 -0
- package/es/http/index.js +246 -2
- package/es/http/mdmCache.d.ts +19 -0
- package/es/http/mdmCache.js +157 -0
- package/es/http/mdmRequest.d.ts +148 -73
- package/es/http/mdmRequest.js +223 -93
- package/es/utils/index.d.ts +1 -0
- package/es/utils/index.js +1 -0
- package/es/utils/modal.js +1 -1
- package/es/utils/pasteUpload.d.ts +27 -0
- package/es/utils/pasteUpload.js +118 -0
- package/lib/components/Select/AreaCitySelect.d.ts +5 -0
- package/lib/components/Select/AreaCitySelect.js +25 -0
- package/lib/components/Select/AreaDistrictSelect.d.ts +5 -0
- package/lib/components/Select/AreaDistrictSelect.js +25 -0
- package/lib/components/Select/AreaProvinceSelect.d.ts +5 -0
- package/lib/components/Select/AreaProvinceSelect.js +25 -0
- package/lib/components/Select/Base.d.ts +11 -0
- package/lib/components/Select/Base.js +128 -0
- package/lib/components/Select/BrandDeptSelect.d.ts +5 -0
- package/lib/components/Select/BrandDeptSelect.js +12 -0
- package/lib/components/Select/CategorySelect.d.ts +5 -0
- package/lib/components/Select/CategorySelect.js +12 -0
- package/lib/components/Select/ColorSelect.d.ts +5 -0
- package/lib/components/Select/ColorSelect.js +12 -0
- package/lib/components/Select/ExpressCompanyPageSelect.d.ts +5 -0
- package/lib/components/Select/ExpressCompanyPageSelect.js +12 -0
- package/lib/components/Select/ExpressCompanySelect.d.ts +5 -0
- package/lib/components/Select/ExpressCompanySelect.js +12 -0
- package/lib/components/Select/GenderSelect.d.ts +5 -0
- package/lib/components/Select/GenderSelect.js +12 -0
- package/lib/components/Select/LogisticCategorySelect.d.ts +5 -0
- package/lib/components/Select/LogisticCategorySelect.js +12 -0
- package/lib/components/Select/LogisticRegionSelect.d.ts +5 -0
- package/lib/components/Select/LogisticRegionSelect.js +12 -0
- package/lib/components/Select/ManagingCitySelect.d.ts +5 -0
- package/lib/components/Select/ManagingCitySelect.js +12 -0
- package/lib/components/Select/OwnerSelect.d.ts +5 -0
- package/lib/components/Select/OwnerSelect.js +12 -0
- package/lib/components/Select/PhysicalStoreSelect.d.ts +5 -0
- package/lib/components/Select/PhysicalStoreSelect.js +12 -0
- package/lib/components/Select/PowerUnitSelect.d.ts +5 -0
- package/lib/components/Select/PowerUnitSelect.js +12 -0
- package/lib/components/Select/ProfitLossMainSelect.d.ts +5 -0
- package/lib/components/Select/ProfitLossMainSelect.js +12 -0
- package/lib/components/Select/SeasonSelect.d.ts +5 -0
- package/lib/components/Select/SeasonSelect.js +12 -0
- package/lib/components/Select/SettleAccountSelect.d.ts +5 -0
- package/lib/components/Select/SettleAccountSelect.js +12 -0
- package/lib/components/Select/SettleCategorySelect.d.ts +5 -0
- package/lib/components/Select/SettleCategorySelect.js +12 -0
- package/lib/components/Select/SettleCompanySelect.d.ts +5 -0
- package/lib/components/Select/SettleCompanySelect.js +12 -0
- package/lib/components/Select/ShopPageSelect.d.ts +5 -0
- package/lib/components/Select/ShopPageSelect.js +12 -0
- package/lib/components/Select/SizeTypeSelect.d.ts +5 -0
- package/lib/components/Select/SizeTypeSelect.js +12 -0
- package/lib/components/Select/StoreSelect.d.ts +5 -0
- package/lib/components/Select/StoreSelect.js +12 -0
- package/lib/components/Select/SupplierSelect.d.ts +5 -0
- package/lib/components/Select/SupplierSelect.js +12 -0
- package/lib/components/Select/TransportLocnoSelect.d.ts +5 -0
- package/lib/components/Select/TransportLocnoSelect.js +12 -0
- package/lib/components/Select/TransportPointPageSelect.d.ts +5 -0
- package/lib/components/Select/TransportPointPageSelect.js +12 -0
- package/lib/components/Select/UploadPointPageSelect.d.ts +5 -0
- package/lib/components/Select/UploadPointPageSelect.js +12 -0
- package/lib/components/Select/YearSelect.d.ts +5 -0
- package/lib/components/Select/YearSelect.js +12 -0
- package/lib/components/Select/common.d.ts +32 -0
- package/lib/components/Select/common.js +20 -0
- package/lib/components/Select/index.less +17 -0
- package/lib/components/ViewOffice.js +6 -5
- package/lib/components/index.d.ts +28 -0
- package/lib/components/index.js +29 -1
- package/lib/hooks/useMdm.d.ts +11 -2
- package/lib/hooks/useMdm.js +26 -11
- package/lib/http/index.d.ts +21 -0
- package/lib/http/index.js +246 -2
- package/lib/http/mdmCache.d.ts +19 -0
- package/lib/http/mdmCache.js +157 -0
- package/lib/http/mdmRequest.d.ts +148 -73
- package/lib/http/mdmRequest.js +223 -93
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/lib/utils/modal.js +1 -1
- package/lib/utils/pasteUpload.d.ts +27 -0
- package/lib/utils/pasteUpload.js +118 -0
- package/package.json +1 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { httpUpload } from '../http';
|
|
4
|
+
/**
|
|
5
|
+
* 粘贴上传图片,监听粘贴事件,支持从剪贴板中获取图片(如截图工具复制后粘贴)并上传
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx // 在 TextArea 组件中使用
|
|
9
|
+
* const handlePaste = async (event: React.ClipboardEvent<HTMLTextAreaElement>) => {
|
|
10
|
+
* event.preventDefault(); // 阻止默认粘贴行为
|
|
11
|
+
* try {
|
|
12
|
+
* const result = await pasteUpload(event, { userId: '123' }, 'imgs');
|
|
13
|
+
* // 处理上传结果
|
|
14
|
+
* console.log('图片URL:', result.rows?.[0]?.shareUrl);
|
|
15
|
+
* } catch (error) {
|
|
16
|
+
* message.error('图片上传失败');
|
|
17
|
+
* }
|
|
18
|
+
* };
|
|
19
|
+
*
|
|
20
|
+
* <Input.TextArea onPaste={handlePaste} />
|
|
21
|
+
* ```;
|
|
22
|
+
*
|
|
23
|
+
* @param event 粘贴事件对象
|
|
24
|
+
* @param params 附加其它参数 {key:value}
|
|
25
|
+
* @param catalogName 文件目录名称,默认为 'imgs'
|
|
26
|
+
* @param onProgress 上传进度回调函数,参数为 0-100 的进度百分比
|
|
27
|
+
* @returns 返回上传结果的 Promise,resolve 时返回上传成功的数据,reject 时返回错误信息
|
|
28
|
+
*/
|
|
29
|
+
export var pasteUpload = /*#__PURE__*/function () {
|
|
30
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
|
|
31
|
+
var params,
|
|
32
|
+
catalogName,
|
|
33
|
+
onProgress,
|
|
34
|
+
clipboardData,
|
|
35
|
+
items,
|
|
36
|
+
file,
|
|
37
|
+
i,
|
|
38
|
+
item,
|
|
39
|
+
files,
|
|
40
|
+
uploadUrl,
|
|
41
|
+
_httpUpload,
|
|
42
|
+
promise,
|
|
43
|
+
_args = arguments;
|
|
44
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
45
|
+
while (1) switch (_context.prev = _context.next) {
|
|
46
|
+
case 0:
|
|
47
|
+
params = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
48
|
+
catalogName = _args.length > 2 && _args[2] !== undefined ? _args[2] : 'imgs';
|
|
49
|
+
onProgress = _args.length > 3 ? _args[3] : undefined;
|
|
50
|
+
clipboardData = event.clipboardData;
|
|
51
|
+
if (clipboardData) {
|
|
52
|
+
_context.next = 6;
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
return _context.abrupt("return");
|
|
56
|
+
case 6:
|
|
57
|
+
// 优先从剪贴板 items 中获取文件
|
|
58
|
+
items = clipboardData.items;
|
|
59
|
+
file = null;
|
|
60
|
+
if (!items) {
|
|
61
|
+
_context.next = 19;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
i = 0;
|
|
65
|
+
case 10:
|
|
66
|
+
if (!(i < items.length)) {
|
|
67
|
+
_context.next = 19;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
item = items[i]; // 检查是否为图片类型
|
|
71
|
+
if (!(item.kind === 'file' && item.type.startsWith('image/'))) {
|
|
72
|
+
_context.next = 16;
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
file = item.getAsFile();
|
|
76
|
+
if (!file) {
|
|
77
|
+
_context.next = 16;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
return _context.abrupt("break", 19);
|
|
81
|
+
case 16:
|
|
82
|
+
i++;
|
|
83
|
+
_context.next = 10;
|
|
84
|
+
break;
|
|
85
|
+
case 19:
|
|
86
|
+
// 如果 items 中没有找到,尝试从 files 属性获取
|
|
87
|
+
if (!file && clipboardData.files && clipboardData.files.length > 0) {
|
|
88
|
+
files = Array.from(clipboardData.files); // 查找第一个图片文件
|
|
89
|
+
file = files.find(function (f) {
|
|
90
|
+
return f.type.startsWith('image/');
|
|
91
|
+
}) || null;
|
|
92
|
+
}
|
|
93
|
+
if (file) {
|
|
94
|
+
_context.next = 22;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
return _context.abrupt("return");
|
|
98
|
+
case 22:
|
|
99
|
+
if (file.type.startsWith('image/')) {
|
|
100
|
+
_context.next = 24;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
return _context.abrupt("return");
|
|
104
|
+
case 24:
|
|
105
|
+
// 构建上传 URL
|
|
106
|
+
uploadUrl = "/petrel/petrel-file-center-api/lesoon/oss/file/upload/RETAIL-PUBLIC?catalogName=".concat(catalogName); // 调用上传接口
|
|
107
|
+
_httpUpload = httpUpload(uploadUrl, file, params, 'file', false, onProgress), promise = _httpUpload.promise;
|
|
108
|
+
return _context.abrupt("return", promise);
|
|
109
|
+
case 27:
|
|
110
|
+
case "end":
|
|
111
|
+
return _context.stop();
|
|
112
|
+
}
|
|
113
|
+
}, _callee);
|
|
114
|
+
}));
|
|
115
|
+
return function pasteUpload(_x) {
|
|
116
|
+
return _ref.apply(this, arguments);
|
|
117
|
+
};
|
|
118
|
+
}();
|