ls-pro-common 3.1.46 → 3.1.48
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.js +1 -1
- package/dist/common.min.js +1 -1
- package/es/components/InputTable.d.ts +2 -2
- package/es/components/InputTable.js +67 -21
- package/es/components/Select/Base.js +3 -4
- package/es/utils/index.d.ts +4 -3
- package/es/utils/index.js +14 -3
- package/es/utils/pasteUpload.d.ts +13 -13
- package/es/utils/pasteUpload.js +14 -15
- package/lib/components/InputTable.d.ts +2 -2
- package/lib/components/InputTable.js +67 -21
- package/lib/components/Select/Base.js +3 -4
- package/lib/utils/index.d.ts +4 -3
- package/lib/utils/index.js +14 -3
- package/lib/utils/pasteUpload.d.ts +13 -13
- package/lib/utils/pasteUpload.js +14 -15
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ export declare type InputTableProps = ProFormItemProps<InputProps> & {
|
|
|
14
14
|
/** @name 是否支持多选 */
|
|
15
15
|
multiple?: boolean;
|
|
16
16
|
/** @name 表单项name, 跟 form.item 的 name一致 */
|
|
17
|
-
name
|
|
17
|
+
name?: string;
|
|
18
18
|
/** @name 返回的值字段,表格中valueField配置的字段时返回给name */
|
|
19
19
|
valueField: string;
|
|
20
20
|
/** @name 返回输入框显示的字段,textField字段值返回给textName */
|
|
@@ -74,7 +74,7 @@ declare const InputTable: React.ForwardRefExoticComponent<{
|
|
|
74
74
|
/** @name 是否支持多选 */
|
|
75
75
|
multiple?: boolean | undefined;
|
|
76
76
|
/** @name 表单项name, 跟 form.item 的 name一致 */
|
|
77
|
-
name
|
|
77
|
+
name?: string | undefined;
|
|
78
78
|
/** @name 返回的值字段,表格中valueField配置的字段时返回给name */
|
|
79
79
|
valueField: string;
|
|
80
80
|
/** @name 返回输入框显示的字段,textField字段值返回给textName */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "antd/es/form/style";
|
|
2
|
+
import _Form from "antd/es/form";
|
|
1
3
|
import "antd/es/input/style";
|
|
2
4
|
import _Input from "antd/es/input";
|
|
3
5
|
import "antd/es/popover/style";
|
|
@@ -11,7 +13,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
11
13
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
12
14
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
13
15
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
14
|
-
var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect", "fieldProps", "searchField", "fillMap", "loadOnShow", "triggerCheck", "getPopupContainer", "placement", "arrowPointAtCenter", "
|
|
16
|
+
var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect", "fieldProps", "searchField", "fillMap", "loadOnShow", "triggerCheck", "getPopupContainer", "placement", "arrowPointAtCenter", "method", "changeOnSelect", "rowKey", "record", "id"],
|
|
15
17
|
_excluded2 = ["current", "pageSize"];
|
|
16
18
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
17
19
|
import React, { useRef, useState, useEffect, useContext, useMemo, useImperativeHandle } from 'react';
|
|
@@ -43,7 +45,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
43
45
|
var columns = prop.columns,
|
|
44
46
|
url = prop.url,
|
|
45
47
|
textName = prop.textName,
|
|
46
|
-
|
|
48
|
+
itemName = prop.name,
|
|
47
49
|
tableConfig = prop.tableConfig,
|
|
48
50
|
_prop$tableHeight = prop.tableHeight,
|
|
49
51
|
tableHeight = _prop$tableHeight === void 0 ? 400 : _prop$tableHeight,
|
|
@@ -80,12 +82,13 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
80
82
|
placement = _prop$placement === void 0 ? 'bottom' : _prop$placement,
|
|
81
83
|
_prop$arrowPointAtCen = prop.arrowPointAtCenter,
|
|
82
84
|
arrowPointAtCenter = _prop$arrowPointAtCen === void 0 ? true : _prop$arrowPointAtCen,
|
|
83
|
-
rowKey = prop.rowKey,
|
|
84
85
|
_prop$method = prop.method,
|
|
85
86
|
method = _prop$method === void 0 ? 'GET' : _prop$method,
|
|
86
87
|
_prop$changeOnSelect = prop.changeOnSelect,
|
|
87
88
|
changeOnSelect = _prop$changeOnSelect === void 0 ? true : _prop$changeOnSelect,
|
|
89
|
+
rowKey = prop.rowKey,
|
|
88
90
|
record = prop.record,
|
|
91
|
+
id = prop.id,
|
|
89
92
|
rest = _objectWithoutProperties(prop, _excluded);
|
|
90
93
|
if (!valueField && isDev) {
|
|
91
94
|
console.error('valueField 属性必须设置');
|
|
@@ -93,10 +96,21 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
93
96
|
if (!url && isDev) {
|
|
94
97
|
console.error('url 属性必须设置');
|
|
95
98
|
}
|
|
99
|
+
var tableKey = (tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.rowKey) || valueField || 'id';
|
|
100
|
+
// 处理表单name, 如果不传入通过id来处理。在表格中,自动会添加Id
|
|
101
|
+
var name = useMemo(function () {
|
|
102
|
+
if (itemName) return itemName;
|
|
103
|
+
if (id) {
|
|
104
|
+
if (id.includes('_')) {
|
|
105
|
+
return id.slice(id.indexOf('_') + 1);
|
|
106
|
+
}
|
|
107
|
+
return id;
|
|
108
|
+
}
|
|
109
|
+
return '';
|
|
110
|
+
}, [itemName, id]);
|
|
96
111
|
if (!name && isDev) {
|
|
97
112
|
console.error('name 属性必须设置');
|
|
98
113
|
}
|
|
99
|
-
var tableKey = (tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.rowKey) || valueField || 'id';
|
|
100
114
|
//显示输入框绑定的name,如果不设置textName,设置为$name__text
|
|
101
115
|
var textNameProp = useMemo(function () {
|
|
102
116
|
return textName ? textName : name + '__text';
|
|
@@ -120,6 +134,11 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
120
134
|
if (col) return col.searchField || col.dataIndex;
|
|
121
135
|
return textField || valueField;
|
|
122
136
|
}, [columns, searchField, valueField, textField]);
|
|
137
|
+
/**
|
|
138
|
+
* 获取表单值
|
|
139
|
+
*
|
|
140
|
+
* @returns
|
|
141
|
+
*/
|
|
123
142
|
var getFormValue = function getFormValue() {
|
|
124
143
|
var _formRef$current2, _formRef$current2$get;
|
|
125
144
|
if (rowKey) {
|
|
@@ -128,6 +147,11 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
128
147
|
}
|
|
129
148
|
return formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : (_formRef$current2$get = _formRef$current2.getFieldsValue) === null || _formRef$current2$get === void 0 ? void 0 : _formRef$current2$get.call(_formRef$current2);
|
|
130
149
|
};
|
|
150
|
+
/**
|
|
151
|
+
* 设置表单值
|
|
152
|
+
*
|
|
153
|
+
* @param formValue
|
|
154
|
+
*/
|
|
131
155
|
var setFormValue = function setFormValue(formValue) {
|
|
132
156
|
var _prop$onChange;
|
|
133
157
|
(_prop$onChange = prop.onChange) === null || _prop$onChange === void 0 ? void 0 : _prop$onChange.call(prop, formValue[name]);
|
|
@@ -139,6 +163,12 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
139
163
|
formRef === null || formRef === void 0 ? void 0 : (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : (_formRef$current4$set = _formRef$current4.setFieldsValue) === null || _formRef$current4$set === void 0 ? void 0 : _formRef$current4$set.call(_formRef$current4, formValue);
|
|
140
164
|
}
|
|
141
165
|
};
|
|
166
|
+
/**
|
|
167
|
+
* 加载面板数据
|
|
168
|
+
*
|
|
169
|
+
* @param param
|
|
170
|
+
* @returns
|
|
171
|
+
*/
|
|
142
172
|
var loadData = /*#__PURE__*/function () {
|
|
143
173
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
|
|
144
174
|
var current, pageSize, restParams, _selectRowRef$current, _rows, data, _tableRef$current2, _tableRef$current2$cl, _param, result, rows, formValue, val, _selectRowRef$current2, arr, pageSelectedRows;
|
|
@@ -254,6 +284,13 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
254
284
|
return _ref.apply(this, arguments);
|
|
255
285
|
};
|
|
256
286
|
}();
|
|
287
|
+
/**
|
|
288
|
+
* 如果初始有值时,调用此方法初始化名称
|
|
289
|
+
*
|
|
290
|
+
* @param val
|
|
291
|
+
* @param updateTxt
|
|
292
|
+
* @returns
|
|
293
|
+
*/
|
|
257
294
|
var initName = function initName(val) {
|
|
258
295
|
var updateTxt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
259
296
|
if (!val) return;
|
|
@@ -288,6 +325,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
288
325
|
var formValue = getFormValue();
|
|
289
326
|
if (!formValue) return;
|
|
290
327
|
formValue[textNameProp] = txt;
|
|
328
|
+
console.log('formValue', formValue);
|
|
291
329
|
setFormValue(formValue);
|
|
292
330
|
});
|
|
293
331
|
};
|
|
@@ -433,6 +471,19 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
433
471
|
(_tableRef$current5 = tableRef.current) === null || _tableRef$current5 === void 0 ? void 0 : (_tableRef$current5$re = _tableRef$current5.reload) === null || _tableRef$current5$re === void 0 ? void 0 : _tableRef$current5$re.call(_tableRef$current5);
|
|
434
472
|
}
|
|
435
473
|
}, [visible, loadOnShow]);
|
|
474
|
+
// 处理有值时,可清空
|
|
475
|
+
useEffect(function () {
|
|
476
|
+
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
|
|
477
|
+
try {
|
|
478
|
+
var el = inputRef.current.input.parentNode;
|
|
479
|
+
if (!el) return;
|
|
480
|
+
if (text) {
|
|
481
|
+
el.classList.add('ant-input-has-value');
|
|
482
|
+
} else {
|
|
483
|
+
el.classList.remove('ant-input-has-value');
|
|
484
|
+
}
|
|
485
|
+
} catch (e) {}
|
|
486
|
+
}, [text, rest, fieldProps]);
|
|
436
487
|
var tableDom = /*#__PURE__*/React.createElement(ProTable, _extends({
|
|
437
488
|
className: "ls-input-table",
|
|
438
489
|
columns: columns,
|
|
@@ -549,31 +600,26 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
549
600
|
readOnly: readonly,
|
|
550
601
|
allowClear: allowClear,
|
|
551
602
|
ref: inputRef
|
|
552
|
-
},
|
|
603
|
+
}, !rowKey ? {} : {
|
|
553
604
|
value: text
|
|
554
605
|
}, fieldProps));
|
|
555
|
-
|
|
556
|
-
useEffect(function () {
|
|
557
|
-
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
|
|
558
|
-
try {
|
|
559
|
-
var el = inputRef.current.input.parentNode;
|
|
560
|
-
if (!el) return;
|
|
561
|
-
if (text) {
|
|
562
|
-
el.classList.add('ant-input-has-value');
|
|
563
|
-
} else {
|
|
564
|
-
el.classList.remove('ant-input-has-value');
|
|
565
|
-
}
|
|
566
|
-
} catch (e) {}
|
|
567
|
-
}, [text, rest, fieldProps]);
|
|
606
|
+
console.log('textNameProp', prop);
|
|
568
607
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
569
608
|
style: {
|
|
570
609
|
display: 'none'
|
|
571
610
|
}
|
|
572
611
|
}, /*#__PURE__*/React.createElement(ProFormText, {
|
|
573
|
-
name: name
|
|
574
|
-
})), /*#__PURE__*/React.createElement(ProFormText, _extends({
|
|
612
|
+
name: rowKey ? id : name
|
|
613
|
+
})), rest.label || rowKey ? /*#__PURE__*/React.createElement(ProFormText, _extends({
|
|
614
|
+
name: textNameProp
|
|
615
|
+
}, rest, rowKey ? {
|
|
616
|
+
noStyle: true
|
|
617
|
+
} : {}), InputDom) :
|
|
618
|
+
/*#__PURE__*/
|
|
619
|
+
// 在ProTable的查询面板中
|
|
620
|
+
React.createElement(_Form.Item, _extends({
|
|
575
621
|
name: textNameProp
|
|
576
|
-
}, rest,
|
|
622
|
+
}, rest, {
|
|
577
623
|
noStyle: true
|
|
578
624
|
}), InputDom));
|
|
579
625
|
});
|
|
@@ -8,7 +8,7 @@ import "antd/es/checkbox/style";
|
|
|
8
8
|
import _Checkbox from "antd/es/checkbox";
|
|
9
9
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
10
10
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
11
|
-
var _excluded = ["params", "getOptions", "mode", "selectAll", "
|
|
11
|
+
var _excluded = ["params", "getOptions", "mode", "selectAll", "showReload", "showTotal", "type", "labelField", "valueField", "filterOptions"];
|
|
12
12
|
import React from "react";
|
|
13
13
|
import { useState, useEffect, forwardRef } from 'react';
|
|
14
14
|
import { ReloadOutlined } from '@ant-design/icons';
|
|
@@ -21,8 +21,6 @@ export default /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
21
21
|
getOptions = props.getOptions,
|
|
22
22
|
mode = props.mode,
|
|
23
23
|
selectAll = props.selectAll,
|
|
24
|
-
_props$optionFilterPr = props.optionFilterProp,
|
|
25
|
-
optionFilterProp = _props$optionFilterPr === void 0 ? 'label' : _props$optionFilterPr,
|
|
26
24
|
_props$showReload = props.showReload,
|
|
27
25
|
showReload = _props$showReload === void 0 ? true : _props$showReload,
|
|
28
26
|
_props$showTotal = props.showTotal,
|
|
@@ -71,7 +69,8 @@ export default /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
71
69
|
return /*#__PURE__*/React.createElement(_Select, _extends({
|
|
72
70
|
allowClear: true,
|
|
73
71
|
showSearch: true,
|
|
74
|
-
|
|
72
|
+
showArrow: true,
|
|
73
|
+
optionFilterProp: "label",
|
|
75
74
|
mode: mode,
|
|
76
75
|
maxTagCount: "responsive",
|
|
77
76
|
ref: ref,
|
package/es/utils/index.d.ts
CHANGED
|
@@ -135,11 +135,12 @@ export declare const off: (eventName: string, fn: Function, el: any | undefined)
|
|
|
135
135
|
* @param bodyParam Post传参数
|
|
136
136
|
* @param param Get传参数
|
|
137
137
|
* @param method 请求方式,默认post
|
|
138
|
+
* @param isNewPrintCenter 是否是新的打印中心,默认false
|
|
138
139
|
* @returns
|
|
139
140
|
*/
|
|
140
|
-
export declare const printView: (templateNo: string, reqUrl: string, bodyParam?: any, param?: any, method?: 'POST' | 'GET') => any;
|
|
141
|
+
export declare const printView: (templateNo: string, reqUrl: string, bodyParam?: any, param?: any, method?: 'POST' | 'GET', isNewPrintCenter?: boolean) => any;
|
|
141
142
|
/**
|
|
142
|
-
*
|
|
143
|
+
* 直接打印,通过打印组件进行打印。
|
|
143
144
|
*
|
|
144
145
|
* @param taskName 打印任务名
|
|
145
146
|
* @param templateNo 打印模板
|
|
@@ -149,7 +150,7 @@ export declare const printView: (templateNo: string, reqUrl: string, bodyParam?:
|
|
|
149
150
|
* @param method 请求方式,默认post
|
|
150
151
|
* @returns
|
|
151
152
|
*/
|
|
152
|
-
export declare const printAsync: (taskName: string, templateNo: string, reqUrl: string, bodyParam?: any, param?: any, method?: 'POST' | 'GET') => Promise<any>;
|
|
153
|
+
export declare const printAsync: (taskName: string, templateNo: string, reqUrl: string, bodyParam?: any, param?: any, method?: 'POST' | 'GET', isNewPrintCenter?: boolean) => Promise<any>;
|
|
153
154
|
export declare const isDev: boolean;
|
|
154
155
|
export declare type UserType = {
|
|
155
156
|
id?: string;
|
package/es/utils/index.js
CHANGED
|
@@ -313,13 +313,19 @@ export var off = function off(eventName, fn, el) {
|
|
|
313
313
|
* @param bodyParam Post传参数
|
|
314
314
|
* @param param Get传参数
|
|
315
315
|
* @param method 请求方式,默认post
|
|
316
|
+
* @param isNewPrintCenter 是否是新的打印中心,默认false
|
|
316
317
|
* @returns
|
|
317
318
|
*/
|
|
318
319
|
export var printView = function printView(templateNo, reqUrl) {
|
|
319
320
|
var bodyParam = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
320
321
|
var param = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
|
|
321
322
|
var method = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'POST';
|
|
322
|
-
var
|
|
323
|
+
var isNewPrintCenter = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
324
|
+
var api = '/petrel-print-center-api/report/remote/print/dataStr';
|
|
325
|
+
if (isNewPrintCenter) {
|
|
326
|
+
api = '/lesoon-basic-api/basic/ireport/preview/print/dataStr';
|
|
327
|
+
}
|
|
328
|
+
var printCenterUrl = toGatewayUrl(api);
|
|
323
329
|
reqUrl = toGatewayUrl(reqUrl);
|
|
324
330
|
if (!reqUrl.includes(location.origin)) {
|
|
325
331
|
reqUrl = location.origin + reqUrl;
|
|
@@ -339,7 +345,7 @@ export var printView = function printView(templateNo, reqUrl) {
|
|
|
339
345
|
return openWin;
|
|
340
346
|
};
|
|
341
347
|
/**
|
|
342
|
-
*
|
|
348
|
+
* 直接打印,通过打印组件进行打印。
|
|
343
349
|
*
|
|
344
350
|
* @param taskName 打印任务名
|
|
345
351
|
* @param templateNo 打印模板
|
|
@@ -353,7 +359,12 @@ export var printAsync = function printAsync(taskName, templateNo, reqUrl) {
|
|
|
353
359
|
var bodyParam = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
354
360
|
var param = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : undefined;
|
|
355
361
|
var method = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'POST';
|
|
356
|
-
var
|
|
362
|
+
var isNewPrintCenter = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
363
|
+
var api = '/petrel-print-center-api/report/client/print';
|
|
364
|
+
if (isNewPrintCenter) {
|
|
365
|
+
api = '/lesoon-basic-api/basic/report/client/template/print';
|
|
366
|
+
}
|
|
367
|
+
var printCenterUrl = toGatewayUrl(api);
|
|
357
368
|
if (!printCenterUrl.includes(location.origin)) {
|
|
358
369
|
printCenterUrl = location.origin + printCenterUrl;
|
|
359
370
|
}
|
|
@@ -4,19 +4,19 @@ import { UploadProgressCallback } from '../http';
|
|
|
4
4
|
*
|
|
5
5
|
* @example
|
|
6
6
|
* ```tsx // 在 TextArea 组件中使用
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
7
|
+
* const handlePaste = async (event: React.ClipboardEvent<HTMLTextAreaElement>) => {
|
|
8
|
+
* event.preventDefault(); // 阻止默认粘贴行为
|
|
9
|
+
* try {
|
|
10
|
+
* const result = await pasteUpload(event, { userId: '123' }, 'imgs');
|
|
11
|
+
* // 处理上传结果
|
|
12
|
+
* console.log('图片URL:', result.rows?.[0]?.shareUrl);
|
|
13
|
+
* } catch (error) {
|
|
14
|
+
* message.error('图片上传失败');
|
|
15
|
+
* }
|
|
16
|
+
* };
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
* <Input.TextArea onPaste={handlePaste} />
|
|
19
|
+
* ```;
|
|
20
20
|
*
|
|
21
21
|
* @param event 粘贴事件对象
|
|
22
22
|
* @param params 附加其它参数 {key:value}
|
|
@@ -24,4 +24,4 @@ import { UploadProgressCallback } from '../http';
|
|
|
24
24
|
* @param onProgress 上传进度回调函数,参数为 0-100 的进度百分比
|
|
25
25
|
* @returns 返回上传结果的 Promise,resolve 时返回上传成功的数据,reject 时返回错误信息
|
|
26
26
|
*/
|
|
27
|
-
export declare const pasteUpload: (event: React.ClipboardEvent<any
|
|
27
|
+
export declare const pasteUpload: (event: React.ClipboardEvent<any> | ClipboardEvent, params?: Record<string, any>, catalogName?: string, onProgress?: UploadProgressCallback | undefined) => Promise<any>;
|
package/es/utils/pasteUpload.js
CHANGED
|
@@ -6,19 +6,19 @@ import { httpUpload } from '../http';
|
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```tsx // 在 TextArea 组件中使用
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
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
19
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* <Input.TextArea onPaste={handlePaste} />
|
|
21
|
+
* ```;
|
|
22
22
|
*
|
|
23
23
|
* @param event 粘贴事件对象
|
|
24
24
|
* @param params 附加其它参数 {key:value}
|
|
@@ -32,8 +32,8 @@ export var pasteUpload = /*#__PURE__*/function () {
|
|
|
32
32
|
catalogName,
|
|
33
33
|
onProgress,
|
|
34
34
|
clipboardData,
|
|
35
|
-
items,
|
|
36
35
|
file,
|
|
36
|
+
items,
|
|
37
37
|
i,
|
|
38
38
|
item,
|
|
39
39
|
files,
|
|
@@ -54,9 +54,8 @@ export var pasteUpload = /*#__PURE__*/function () {
|
|
|
54
54
|
}
|
|
55
55
|
return _context.abrupt("return");
|
|
56
56
|
case 6:
|
|
57
|
-
// 优先从剪贴板 items 中获取文件
|
|
57
|
+
file = null; // 优先从剪贴板 items 中获取文件
|
|
58
58
|
items = clipboardData.items;
|
|
59
|
-
file = null;
|
|
60
59
|
if (!items) {
|
|
61
60
|
_context.next = 19;
|
|
62
61
|
break;
|
|
@@ -14,7 +14,7 @@ export declare type InputTableProps = ProFormItemProps<InputProps> & {
|
|
|
14
14
|
/** @name 是否支持多选 */
|
|
15
15
|
multiple?: boolean;
|
|
16
16
|
/** @name 表单项name, 跟 form.item 的 name一致 */
|
|
17
|
-
name
|
|
17
|
+
name?: string;
|
|
18
18
|
/** @name 返回的值字段,表格中valueField配置的字段时返回给name */
|
|
19
19
|
valueField: string;
|
|
20
20
|
/** @name 返回输入框显示的字段,textField字段值返回给textName */
|
|
@@ -74,7 +74,7 @@ declare const InputTable: React.ForwardRefExoticComponent<{
|
|
|
74
74
|
/** @name 是否支持多选 */
|
|
75
75
|
multiple?: boolean | undefined;
|
|
76
76
|
/** @name 表单项name, 跟 form.item 的 name一致 */
|
|
77
|
-
name
|
|
77
|
+
name?: string | undefined;
|
|
78
78
|
/** @name 返回的值字段,表格中valueField配置的字段时返回给name */
|
|
79
79
|
valueField: string;
|
|
80
80
|
/** @name 返回输入框显示的字段,textField字段值返回给textName */
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "antd/es/form/style";
|
|
2
|
+
import _Form from "antd/es/form";
|
|
1
3
|
import "antd/es/input/style";
|
|
2
4
|
import _Input from "antd/es/input";
|
|
3
5
|
import "antd/es/popover/style";
|
|
@@ -11,7 +13,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
11
13
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
12
14
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
13
15
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
14
|
-
var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect", "fieldProps", "searchField", "fillMap", "loadOnShow", "triggerCheck", "getPopupContainer", "placement", "arrowPointAtCenter", "
|
|
16
|
+
var _excluded = ["columns", "url", "textName", "name", "tableConfig", "tableHeight", "tableWidth", "readonly", "multiple", "valueField", "labelWidth", "textField", "onSelectChange", "beforeLoad", "afterLoad", "isV2", "allowClear", "keepSelect", "fieldProps", "searchField", "fillMap", "loadOnShow", "triggerCheck", "getPopupContainer", "placement", "arrowPointAtCenter", "method", "changeOnSelect", "rowKey", "record", "id"],
|
|
15
17
|
_excluded2 = ["current", "pageSize"];
|
|
16
18
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
17
19
|
import React, { useRef, useState, useEffect, useContext, useMemo, useImperativeHandle } from 'react';
|
|
@@ -43,7 +45,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
43
45
|
var columns = prop.columns,
|
|
44
46
|
url = prop.url,
|
|
45
47
|
textName = prop.textName,
|
|
46
|
-
|
|
48
|
+
itemName = prop.name,
|
|
47
49
|
tableConfig = prop.tableConfig,
|
|
48
50
|
_prop$tableHeight = prop.tableHeight,
|
|
49
51
|
tableHeight = _prop$tableHeight === void 0 ? 400 : _prop$tableHeight,
|
|
@@ -80,12 +82,13 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
80
82
|
placement = _prop$placement === void 0 ? 'bottom' : _prop$placement,
|
|
81
83
|
_prop$arrowPointAtCen = prop.arrowPointAtCenter,
|
|
82
84
|
arrowPointAtCenter = _prop$arrowPointAtCen === void 0 ? true : _prop$arrowPointAtCen,
|
|
83
|
-
rowKey = prop.rowKey,
|
|
84
85
|
_prop$method = prop.method,
|
|
85
86
|
method = _prop$method === void 0 ? 'GET' : _prop$method,
|
|
86
87
|
_prop$changeOnSelect = prop.changeOnSelect,
|
|
87
88
|
changeOnSelect = _prop$changeOnSelect === void 0 ? true : _prop$changeOnSelect,
|
|
89
|
+
rowKey = prop.rowKey,
|
|
88
90
|
record = prop.record,
|
|
91
|
+
id = prop.id,
|
|
89
92
|
rest = _objectWithoutProperties(prop, _excluded);
|
|
90
93
|
if (!valueField && isDev) {
|
|
91
94
|
console.error('valueField 属性必须设置');
|
|
@@ -93,10 +96,21 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
93
96
|
if (!url && isDev) {
|
|
94
97
|
console.error('url 属性必须设置');
|
|
95
98
|
}
|
|
99
|
+
var tableKey = (tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.rowKey) || valueField || 'id';
|
|
100
|
+
// 处理表单name, 如果不传入通过id来处理。在表格中,自动会添加Id
|
|
101
|
+
var name = useMemo(function () {
|
|
102
|
+
if (itemName) return itemName;
|
|
103
|
+
if (id) {
|
|
104
|
+
if (id.includes('_')) {
|
|
105
|
+
return id.slice(id.indexOf('_') + 1);
|
|
106
|
+
}
|
|
107
|
+
return id;
|
|
108
|
+
}
|
|
109
|
+
return '';
|
|
110
|
+
}, [itemName, id]);
|
|
96
111
|
if (!name && isDev) {
|
|
97
112
|
console.error('name 属性必须设置');
|
|
98
113
|
}
|
|
99
|
-
var tableKey = (tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.rowKey) || valueField || 'id';
|
|
100
114
|
//显示输入框绑定的name,如果不设置textName,设置为$name__text
|
|
101
115
|
var textNameProp = useMemo(function () {
|
|
102
116
|
return textName ? textName : name + '__text';
|
|
@@ -120,6 +134,11 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
120
134
|
if (col) return col.searchField || col.dataIndex;
|
|
121
135
|
return textField || valueField;
|
|
122
136
|
}, [columns, searchField, valueField, textField]);
|
|
137
|
+
/**
|
|
138
|
+
* 获取表单值
|
|
139
|
+
*
|
|
140
|
+
* @returns
|
|
141
|
+
*/
|
|
123
142
|
var getFormValue = function getFormValue() {
|
|
124
143
|
var _formRef$current2, _formRef$current2$get;
|
|
125
144
|
if (rowKey) {
|
|
@@ -128,6 +147,11 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
128
147
|
}
|
|
129
148
|
return formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : (_formRef$current2$get = _formRef$current2.getFieldsValue) === null || _formRef$current2$get === void 0 ? void 0 : _formRef$current2$get.call(_formRef$current2);
|
|
130
149
|
};
|
|
150
|
+
/**
|
|
151
|
+
* 设置表单值
|
|
152
|
+
*
|
|
153
|
+
* @param formValue
|
|
154
|
+
*/
|
|
131
155
|
var setFormValue = function setFormValue(formValue) {
|
|
132
156
|
var _prop$onChange;
|
|
133
157
|
(_prop$onChange = prop.onChange) === null || _prop$onChange === void 0 ? void 0 : _prop$onChange.call(prop, formValue[name]);
|
|
@@ -139,6 +163,12 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
139
163
|
formRef === null || formRef === void 0 ? void 0 : (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : (_formRef$current4$set = _formRef$current4.setFieldsValue) === null || _formRef$current4$set === void 0 ? void 0 : _formRef$current4$set.call(_formRef$current4, formValue);
|
|
140
164
|
}
|
|
141
165
|
};
|
|
166
|
+
/**
|
|
167
|
+
* 加载面板数据
|
|
168
|
+
*
|
|
169
|
+
* @param param
|
|
170
|
+
* @returns
|
|
171
|
+
*/
|
|
142
172
|
var loadData = /*#__PURE__*/function () {
|
|
143
173
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
|
|
144
174
|
var current, pageSize, restParams, _selectRowRef$current, _rows, data, _tableRef$current2, _tableRef$current2$cl, _param, result, rows, formValue, val, _selectRowRef$current2, arr, pageSelectedRows;
|
|
@@ -254,6 +284,13 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
254
284
|
return _ref.apply(this, arguments);
|
|
255
285
|
};
|
|
256
286
|
}();
|
|
287
|
+
/**
|
|
288
|
+
* 如果初始有值时,调用此方法初始化名称
|
|
289
|
+
*
|
|
290
|
+
* @param val
|
|
291
|
+
* @param updateTxt
|
|
292
|
+
* @returns
|
|
293
|
+
*/
|
|
257
294
|
var initName = function initName(val) {
|
|
258
295
|
var updateTxt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
259
296
|
if (!val) return;
|
|
@@ -288,6 +325,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
288
325
|
var formValue = getFormValue();
|
|
289
326
|
if (!formValue) return;
|
|
290
327
|
formValue[textNameProp] = txt;
|
|
328
|
+
console.log('formValue', formValue);
|
|
291
329
|
setFormValue(formValue);
|
|
292
330
|
});
|
|
293
331
|
};
|
|
@@ -433,6 +471,19 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
433
471
|
(_tableRef$current5 = tableRef.current) === null || _tableRef$current5 === void 0 ? void 0 : (_tableRef$current5$re = _tableRef$current5.reload) === null || _tableRef$current5$re === void 0 ? void 0 : _tableRef$current5$re.call(_tableRef$current5);
|
|
434
472
|
}
|
|
435
473
|
}, [visible, loadOnShow]);
|
|
474
|
+
// 处理有值时,可清空
|
|
475
|
+
useEffect(function () {
|
|
476
|
+
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
|
|
477
|
+
try {
|
|
478
|
+
var el = inputRef.current.input.parentNode;
|
|
479
|
+
if (!el) return;
|
|
480
|
+
if (text) {
|
|
481
|
+
el.classList.add('ant-input-has-value');
|
|
482
|
+
} else {
|
|
483
|
+
el.classList.remove('ant-input-has-value');
|
|
484
|
+
}
|
|
485
|
+
} catch (e) {}
|
|
486
|
+
}, [text, rest, fieldProps]);
|
|
436
487
|
var tableDom = /*#__PURE__*/React.createElement(ProTable, _extends({
|
|
437
488
|
className: "ls-input-table",
|
|
438
489
|
columns: columns,
|
|
@@ -549,31 +600,26 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
549
600
|
readOnly: readonly,
|
|
550
601
|
allowClear: allowClear,
|
|
551
602
|
ref: inputRef
|
|
552
|
-
},
|
|
603
|
+
}, !rowKey ? {} : {
|
|
553
604
|
value: text
|
|
554
605
|
}, fieldProps));
|
|
555
|
-
|
|
556
|
-
useEffect(function () {
|
|
557
|
-
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
|
|
558
|
-
try {
|
|
559
|
-
var el = inputRef.current.input.parentNode;
|
|
560
|
-
if (!el) return;
|
|
561
|
-
if (text) {
|
|
562
|
-
el.classList.add('ant-input-has-value');
|
|
563
|
-
} else {
|
|
564
|
-
el.classList.remove('ant-input-has-value');
|
|
565
|
-
}
|
|
566
|
-
} catch (e) {}
|
|
567
|
-
}, [text, rest, fieldProps]);
|
|
606
|
+
console.log('textNameProp', prop);
|
|
568
607
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
569
608
|
style: {
|
|
570
609
|
display: 'none'
|
|
571
610
|
}
|
|
572
611
|
}, /*#__PURE__*/React.createElement(ProFormText, {
|
|
573
|
-
name: name
|
|
574
|
-
})), /*#__PURE__*/React.createElement(ProFormText, _extends({
|
|
612
|
+
name: rowKey ? id : name
|
|
613
|
+
})), rest.label || rowKey ? /*#__PURE__*/React.createElement(ProFormText, _extends({
|
|
614
|
+
name: textNameProp
|
|
615
|
+
}, rest, rowKey ? {
|
|
616
|
+
noStyle: true
|
|
617
|
+
} : {}), InputDom) :
|
|
618
|
+
/*#__PURE__*/
|
|
619
|
+
// 在ProTable的查询面板中
|
|
620
|
+
React.createElement(_Form.Item, _extends({
|
|
575
621
|
name: textNameProp
|
|
576
|
-
}, rest,
|
|
622
|
+
}, rest, {
|
|
577
623
|
noStyle: true
|
|
578
624
|
}), InputDom));
|
|
579
625
|
});
|
|
@@ -8,7 +8,7 @@ import "antd/es/checkbox/style";
|
|
|
8
8
|
import _Checkbox from "antd/es/checkbox";
|
|
9
9
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
10
10
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
11
|
-
var _excluded = ["params", "getOptions", "mode", "selectAll", "
|
|
11
|
+
var _excluded = ["params", "getOptions", "mode", "selectAll", "showReload", "showTotal", "type", "labelField", "valueField", "filterOptions"];
|
|
12
12
|
import React from "react";
|
|
13
13
|
import { useState, useEffect, forwardRef } from 'react';
|
|
14
14
|
import { ReloadOutlined } from '@ant-design/icons';
|
|
@@ -21,8 +21,6 @@ export default /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
21
21
|
getOptions = props.getOptions,
|
|
22
22
|
mode = props.mode,
|
|
23
23
|
selectAll = props.selectAll,
|
|
24
|
-
_props$optionFilterPr = props.optionFilterProp,
|
|
25
|
-
optionFilterProp = _props$optionFilterPr === void 0 ? 'label' : _props$optionFilterPr,
|
|
26
24
|
_props$showReload = props.showReload,
|
|
27
25
|
showReload = _props$showReload === void 0 ? true : _props$showReload,
|
|
28
26
|
_props$showTotal = props.showTotal,
|
|
@@ -71,7 +69,8 @@ export default /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
71
69
|
return /*#__PURE__*/React.createElement(_Select, _extends({
|
|
72
70
|
allowClear: true,
|
|
73
71
|
showSearch: true,
|
|
74
|
-
|
|
72
|
+
showArrow: true,
|
|
73
|
+
optionFilterProp: "label",
|
|
75
74
|
mode: mode,
|
|
76
75
|
maxTagCount: "responsive",
|
|
77
76
|
ref: ref,
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -135,11 +135,12 @@ export declare const off: (eventName: string, fn: Function, el: any | undefined)
|
|
|
135
135
|
* @param bodyParam Post传参数
|
|
136
136
|
* @param param Get传参数
|
|
137
137
|
* @param method 请求方式,默认post
|
|
138
|
+
* @param isNewPrintCenter 是否是新的打印中心,默认false
|
|
138
139
|
* @returns
|
|
139
140
|
*/
|
|
140
|
-
export declare const printView: (templateNo: string, reqUrl: string, bodyParam?: any, param?: any, method?: 'POST' | 'GET') => any;
|
|
141
|
+
export declare const printView: (templateNo: string, reqUrl: string, bodyParam?: any, param?: any, method?: 'POST' | 'GET', isNewPrintCenter?: boolean) => any;
|
|
141
142
|
/**
|
|
142
|
-
*
|
|
143
|
+
* 直接打印,通过打印组件进行打印。
|
|
143
144
|
*
|
|
144
145
|
* @param taskName 打印任务名
|
|
145
146
|
* @param templateNo 打印模板
|
|
@@ -149,7 +150,7 @@ export declare const printView: (templateNo: string, reqUrl: string, bodyParam?:
|
|
|
149
150
|
* @param method 请求方式,默认post
|
|
150
151
|
* @returns
|
|
151
152
|
*/
|
|
152
|
-
export declare const printAsync: (taskName: string, templateNo: string, reqUrl: string, bodyParam?: any, param?: any, method?: 'POST' | 'GET') => Promise<any>;
|
|
153
|
+
export declare const printAsync: (taskName: string, templateNo: string, reqUrl: string, bodyParam?: any, param?: any, method?: 'POST' | 'GET', isNewPrintCenter?: boolean) => Promise<any>;
|
|
153
154
|
export declare const isDev: boolean;
|
|
154
155
|
export declare type UserType = {
|
|
155
156
|
id?: string;
|