ls-pro-common 1.0.33 → 1.0.36
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 +9 -0
- package/dist/common.js +1 -1
- package/dist/common.min.css +9 -0
- package/dist/common.min.js +1 -1
- package/es/components/IconSelector.js +8 -1
- package/es/components/InputMultiLine.d.ts +41 -0
- package/es/components/InputMultiLine.js +142 -0
- package/es/hooks/useDtl/index.js +17 -8
- package/es/hooks/useSingle/index.js +17 -8
- package/es/http/index.js +2 -5
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/lib/components/IconSelector.js +8 -1
- package/lib/components/InputMultiLine.d.ts +41 -0
- package/lib/components/InputMultiLine.js +165 -0
- package/lib/hooks/useDtl/index.js +17 -8
- package/lib/hooks/useSingle/index.js +17 -8
- package/lib/http/index.js +2 -5
- package/lib/index.d.ts +2 -1
- package/lib/index.js +8 -0
- package/package.json +3 -3
|
@@ -129,7 +129,14 @@ function IconSelector(prop) {
|
|
|
129
129
|
var totalPage = useMemo(function () {
|
|
130
130
|
if (total === 0) return 1;
|
|
131
131
|
return Math.ceil(total / pageSize);
|
|
132
|
-
}, [total]);
|
|
132
|
+
}, [total]);
|
|
133
|
+
useEffect(function () {
|
|
134
|
+
var val = formRef.current.getFieldsValue();
|
|
135
|
+
|
|
136
|
+
if (val && val[name]) {
|
|
137
|
+
setImgUrl(toGatewayUrl(val[name]));
|
|
138
|
+
}
|
|
139
|
+
}, []); // 验证上传文件大小
|
|
133
140
|
|
|
134
141
|
var beforeUpload = function beforeUpload(file) {
|
|
135
142
|
var sizeLimit = file.size / 1024 / 1024 >= maxSize;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { InputProps } from 'antd';
|
|
3
|
+
import type { ProFormItemProps } from 'ls-pro-form';
|
|
4
|
+
export declare type InputMultiLineProps = ProFormItemProps<InputProps> & {
|
|
5
|
+
/**@name 表单项name, 跟 form.item 的 name一致 */
|
|
6
|
+
name: string;
|
|
7
|
+
/**@name 表单值*/
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
/**@name 弹框宽度,默认为400 */
|
|
10
|
+
popWidth?: string;
|
|
11
|
+
/**@name 弹框位置,默认为bottom */
|
|
12
|
+
placement?: string;
|
|
13
|
+
/**@name 多行文本框行数 */
|
|
14
|
+
rows?: number;
|
|
15
|
+
/** @name 最大输入行数 */
|
|
16
|
+
maxRows?: number;
|
|
17
|
+
};
|
|
18
|
+
declare const InputMultiLine: React.ForwardRefExoticComponent<{
|
|
19
|
+
fieldProps?: (import("../../../form/lib/interface").FieldProps & InputProps) | undefined;
|
|
20
|
+
placeholder?: string | string[] | undefined;
|
|
21
|
+
secondary?: boolean | undefined;
|
|
22
|
+
allowClear?: boolean | undefined;
|
|
23
|
+
disabled?: boolean | undefined;
|
|
24
|
+
width?: number | "sm" | "md" | "xl" | "xs" | "lg" | undefined;
|
|
25
|
+
proFieldProps?: import("../../../utils/lib").ProFieldProps | undefined;
|
|
26
|
+
footerRender?: import("../../../form/lib").LightFilterFooterRender | undefined;
|
|
27
|
+
} & Omit<import("../../../form/lib/components/FormItem").ProFormItemProps, "valueType"> & import("../../../form/lib/interface").ExtendsProps & {
|
|
28
|
+
/**@name 表单项name, 跟 form.item 的 name一致 */
|
|
29
|
+
name: string;
|
|
30
|
+
/**@name 表单值*/
|
|
31
|
+
defaultValue?: string | undefined;
|
|
32
|
+
/**@name 弹框宽度,默认为400 */
|
|
33
|
+
popWidth?: string | undefined;
|
|
34
|
+
/**@name 弹框位置,默认为bottom */
|
|
35
|
+
placement?: string | undefined;
|
|
36
|
+
/**@name 多行文本框行数 */
|
|
37
|
+
rows?: number | undefined;
|
|
38
|
+
/** @name 最大输入行数 */
|
|
39
|
+
maxRows?: number | undefined;
|
|
40
|
+
} & React.RefAttributes<unknown>>;
|
|
41
|
+
export default InputMultiLine;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import "antd/es/popover/style";
|
|
3
|
+
import _Popover from "antd/es/popover";
|
|
4
|
+
import "antd/es/input/style";
|
|
5
|
+
import _Input from "antd/es/input";
|
|
6
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
7
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
8
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
9
|
+
var _excluded = ["name", "rows", "maxRows", "placement", "popWidth", "fieldProps", "defaultValue", "allowClear"];
|
|
10
|
+
import React, { useRef, useState, useEffect, useContext, useMemo, useImperativeHandle } from 'react';
|
|
11
|
+
import { ProFormText, ProFormContext } from 'ls-pro-form';
|
|
12
|
+
import { UnorderedListOutlined } from '@ant-design/icons';
|
|
13
|
+
var InputMultiLine = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
14
|
+
//@ts-ignore
|
|
15
|
+
var _useContext = useContext(ProFormContext),
|
|
16
|
+
formRef = _useContext.formRef;
|
|
17
|
+
|
|
18
|
+
var _useState = useState(''),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
text = _useState2[0],
|
|
21
|
+
setText = _useState2[1];
|
|
22
|
+
|
|
23
|
+
var _useState3 = useState(''),
|
|
24
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
25
|
+
lineText = _useState4[0],
|
|
26
|
+
setLineText = _useState4[1];
|
|
27
|
+
|
|
28
|
+
var _useState5 = useState(false),
|
|
29
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
30
|
+
visible = _useState6[0],
|
|
31
|
+
setVisible = _useState6[1];
|
|
32
|
+
|
|
33
|
+
var inputRef = useRef();
|
|
34
|
+
useImperativeHandle(ref, function () {
|
|
35
|
+
return inputRef.current;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
var name = prop.name,
|
|
39
|
+
_prop$rows = prop.rows,
|
|
40
|
+
rows = _prop$rows === void 0 ? 12 : _prop$rows,
|
|
41
|
+
_prop$maxRows = prop.maxRows,
|
|
42
|
+
maxRows = _prop$maxRows === void 0 ? 20 : _prop$maxRows,
|
|
43
|
+
_prop$placement = prop.placement,
|
|
44
|
+
placement = _prop$placement === void 0 ? 'bottom' : _prop$placement,
|
|
45
|
+
_prop$popWidth = prop.popWidth,
|
|
46
|
+
popWidth = _prop$popWidth === void 0 ? '400px' : _prop$popWidth,
|
|
47
|
+
fieldProps = prop.fieldProps,
|
|
48
|
+
defaultValue = prop.defaultValue,
|
|
49
|
+
_prop$allowClear = prop.allowClear,
|
|
50
|
+
allowClear = _prop$allowClear === void 0 ? true : _prop$allowClear,
|
|
51
|
+
rest = _objectWithoutProperties(prop, _excluded); // 设置初始值
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
useEffect(function () {
|
|
55
|
+
if (defaultValue) {
|
|
56
|
+
setText(defaultValue);
|
|
57
|
+
} else if (name) {
|
|
58
|
+
var _formRef$current;
|
|
59
|
+
|
|
60
|
+
var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.getFieldsValue();
|
|
61
|
+
setText(formValue[name]);
|
|
62
|
+
}
|
|
63
|
+
}, []); // 显示多行输入时,赋值给多行文本框
|
|
64
|
+
|
|
65
|
+
useEffect(function () {
|
|
66
|
+
if (!visible) return;
|
|
67
|
+
var line = (text || '').split(',').join('\n');
|
|
68
|
+
setLineText(line);
|
|
69
|
+
}, [visible, text]); // 输入框值变化时,赋值给表单项
|
|
70
|
+
|
|
71
|
+
useEffect(function () {
|
|
72
|
+
var _formRef$current2, _formRef$current3;
|
|
73
|
+
|
|
74
|
+
var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.getFieldsValue();
|
|
75
|
+
formValue[name] = text;
|
|
76
|
+
(_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : _formRef$current3.setFieldsValue(_objectSpread({}, formValue));
|
|
77
|
+
}, [text]);
|
|
78
|
+
|
|
79
|
+
var lineInput = function lineInput(e) {
|
|
80
|
+
var line = (e.target.value || '').split('\n').filter(function (o, i) {
|
|
81
|
+
return i <= (maxRows < 1 ? 1000 : maxRows);
|
|
82
|
+
}).join('\n');
|
|
83
|
+
var txt = line.split('\n').join(',');
|
|
84
|
+
setLineText(line);
|
|
85
|
+
setText(txt);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
var textInput = function textInput(e) {
|
|
89
|
+
setText(e.target.value);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
var clearValue = function clearValue(e) {
|
|
93
|
+
if (!e.target.value) {
|
|
94
|
+
setText('');
|
|
95
|
+
setLineText('');
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
var PopoverDom = useMemo(function () {
|
|
100
|
+
return /*#__PURE__*/React.createElement(_Popover, {
|
|
101
|
+
content: /*#__PURE__*/React.createElement("div", {
|
|
102
|
+
style: {
|
|
103
|
+
width: popWidth
|
|
104
|
+
}
|
|
105
|
+
}, /*#__PURE__*/React.createElement(_Input.TextArea, {
|
|
106
|
+
rows: rows,
|
|
107
|
+
value: lineText,
|
|
108
|
+
onInput: lineInput,
|
|
109
|
+
onKeyPress: function onKeyPress(e) {
|
|
110
|
+
if (e.key === 'Enter') e.stopPropagation();
|
|
111
|
+
}
|
|
112
|
+
})),
|
|
113
|
+
trigger: "click",
|
|
114
|
+
visible: visible,
|
|
115
|
+
onVisibleChange: setVisible
|
|
116
|
+
}, /*#__PURE__*/React.createElement(UnorderedListOutlined, {
|
|
117
|
+
onClick: function onClick(e) {
|
|
118
|
+
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
|
|
119
|
+
setVisible(true);
|
|
120
|
+
}
|
|
121
|
+
}));
|
|
122
|
+
}, [visible, popWidth, lineText, rest]);
|
|
123
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, rest.label && name ? /*#__PURE__*/React.createElement(ProFormText, _extends({
|
|
124
|
+
name: name
|
|
125
|
+
}, rest), /*#__PURE__*/React.createElement(_Input, _extends({
|
|
126
|
+
suffix: PopoverDom
|
|
127
|
+
}, fieldProps, {
|
|
128
|
+
onChange: clearValue,
|
|
129
|
+
onInput: textInput,
|
|
130
|
+
allowClear: allowClear,
|
|
131
|
+
ref: inputRef
|
|
132
|
+
}))) : /*#__PURE__*/React.createElement(_Input, _extends({
|
|
133
|
+
suffix: PopoverDom,
|
|
134
|
+
allowClear: allowClear
|
|
135
|
+
}, fieldProps, {
|
|
136
|
+
onChange: clearValue,
|
|
137
|
+
onInput: textInput,
|
|
138
|
+
value: text,
|
|
139
|
+
ref: inputRef
|
|
140
|
+
})));
|
|
141
|
+
});
|
|
142
|
+
export default InputMultiLine;
|
package/es/hooks/useDtl/index.js
CHANGED
|
@@ -736,35 +736,44 @@ function useDtl(dtlParam) {
|
|
|
736
736
|
case 9:
|
|
737
737
|
result = _context8.sent;
|
|
738
738
|
|
|
739
|
+
if (!(result.data && typeof result.data === 'string')) {
|
|
740
|
+
_context8.next = 13;
|
|
741
|
+
break;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
window.open(result.data);
|
|
745
|
+
return _context8.abrupt("return", true);
|
|
746
|
+
|
|
747
|
+
case 13:
|
|
739
748
|
if (!(((_result$flag5 = result.flag) === null || _result$flag5 === void 0 ? void 0 : _result$flag5.retCode) === '0')) {
|
|
740
|
-
_context8.next =
|
|
749
|
+
_context8.next = 18;
|
|
741
750
|
break;
|
|
742
751
|
}
|
|
743
752
|
|
|
744
753
|
showSuccess(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retMsg) || '导出成功');
|
|
745
754
|
return _context8.abrupt("return", true);
|
|
746
755
|
|
|
747
|
-
case
|
|
756
|
+
case 18:
|
|
748
757
|
showError(((_result$flag7 = result.flag) === null || _result$flag7 === void 0 ? void 0 : _result$flag7.retMsg) || '导出失败,请联系系统管理员');
|
|
749
758
|
return _context8.abrupt("return", false);
|
|
750
759
|
|
|
751
|
-
case
|
|
752
|
-
_context8.next =
|
|
760
|
+
case 20:
|
|
761
|
+
_context8.next = 27;
|
|
753
762
|
break;
|
|
754
763
|
|
|
755
|
-
case
|
|
756
|
-
_context8.prev =
|
|
764
|
+
case 22:
|
|
765
|
+
_context8.prev = 22;
|
|
757
766
|
_context8.t0 = _context8["catch"](6);
|
|
758
767
|
console.log(_context8.t0);
|
|
759
768
|
showError(_context8.t0.message);
|
|
760
769
|
return _context8.abrupt("return", false);
|
|
761
770
|
|
|
762
|
-
case
|
|
771
|
+
case 27:
|
|
763
772
|
case "end":
|
|
764
773
|
return _context8.stop();
|
|
765
774
|
}
|
|
766
775
|
}
|
|
767
|
-
}, _callee8, null, [[6,
|
|
776
|
+
}, _callee8, null, [[6, 22]]);
|
|
768
777
|
}));
|
|
769
778
|
|
|
770
779
|
return function onExportDtl(_x6, _x7) {
|
|
@@ -607,35 +607,44 @@ function useSingle(inParam) {
|
|
|
607
607
|
case 9:
|
|
608
608
|
result = _context7.sent;
|
|
609
609
|
|
|
610
|
+
if (!(result.data && typeof result.data === 'string')) {
|
|
611
|
+
_context7.next = 13;
|
|
612
|
+
break;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
window.open(result.data);
|
|
616
|
+
return _context7.abrupt("return", true);
|
|
617
|
+
|
|
618
|
+
case 13:
|
|
610
619
|
if (!(((_result$flag4 = result.flag) === null || _result$flag4 === void 0 ? void 0 : _result$flag4.retCode) === '0')) {
|
|
611
|
-
_context7.next =
|
|
620
|
+
_context7.next = 18;
|
|
612
621
|
break;
|
|
613
622
|
}
|
|
614
623
|
|
|
615
624
|
showSuccess(((_result$flag5 = result.flag) === null || _result$flag5 === void 0 ? void 0 : _result$flag5.retMsg) || '导出成功');
|
|
616
625
|
return _context7.abrupt("return", true);
|
|
617
626
|
|
|
618
|
-
case
|
|
627
|
+
case 18:
|
|
619
628
|
showError(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retMsg) || '导出失败,请联系系统管理员');
|
|
620
629
|
return _context7.abrupt("return", false);
|
|
621
630
|
|
|
622
|
-
case
|
|
623
|
-
_context7.next =
|
|
631
|
+
case 20:
|
|
632
|
+
_context7.next = 27;
|
|
624
633
|
break;
|
|
625
634
|
|
|
626
|
-
case
|
|
627
|
-
_context7.prev =
|
|
635
|
+
case 22:
|
|
636
|
+
_context7.prev = 22;
|
|
628
637
|
_context7.t0 = _context7["catch"](6);
|
|
629
638
|
console.log(_context7.t0);
|
|
630
639
|
showError(_context7.t0.message);
|
|
631
640
|
return _context7.abrupt("return", false);
|
|
632
641
|
|
|
633
|
-
case
|
|
642
|
+
case 27:
|
|
634
643
|
case "end":
|
|
635
644
|
return _context7.stop();
|
|
636
645
|
}
|
|
637
646
|
}
|
|
638
|
-
}, _callee7, null, [[6,
|
|
647
|
+
}, _callee7, null, [[6, 22]]);
|
|
639
648
|
}));
|
|
640
649
|
|
|
641
650
|
return function onExport(_x8, _x9) {
|
package/es/http/index.js
CHANGED
|
@@ -283,12 +283,9 @@ function _getDict() {
|
|
|
283
283
|
case 0:
|
|
284
284
|
showValue = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : true;
|
|
285
285
|
needGateWay = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : true;
|
|
286
|
-
api = '/lesoon-integration/sysDictDtl';
|
|
286
|
+
api = '/lesoon-integration/sysDictDtl/listByProperties';
|
|
287
287
|
param = {
|
|
288
|
-
|
|
289
|
-
dictCode: dictCode
|
|
290
|
-
},
|
|
291
|
-
ifPage: 0
|
|
288
|
+
dictCode: dictCode
|
|
292
289
|
};
|
|
293
290
|
return _context6.abrupt("return", fetchOptions(api, param, 'dictValue', 'displayName', showValue, needGateWay));
|
|
294
291
|
|
package/es/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import InputTable from './components/InputTable';
|
|
|
3
3
|
import Page404 from './components/404';
|
|
4
4
|
import Loading from './components/Loading';
|
|
5
5
|
import IconSelector from './components/IconSelector';
|
|
6
|
+
import InputMultiLine from './components/InputMultiLine';
|
|
6
7
|
import BaseService from './service/BaseService';
|
|
7
8
|
import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
|
|
8
9
|
import * as utils from './utils';
|
|
@@ -14,4 +15,4 @@ import usePermission from './hooks/usePermission';
|
|
|
14
15
|
import type { ApiResponse, TableToolbar, BaseApiType, MethodType } from './typing';
|
|
15
16
|
import type { DtlLyaoutProps } from './components/DtlLayout';
|
|
16
17
|
export type { ApiResponse, TableToolbar, BaseApiType, MethodType, DtlLyaoutProps };
|
|
17
|
-
export { DtlLayout, InputTable, Page404, Loading, IconSelector, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission };
|
|
18
|
+
export { DtlLayout, InputTable, Page404, Loading, IconSelector, InputMultiLine, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission };
|
package/es/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import InputTable from './components/InputTable';
|
|
|
3
3
|
import Page404 from './components/404';
|
|
4
4
|
import Loading from './components/Loading';
|
|
5
5
|
import IconSelector from './components/IconSelector';
|
|
6
|
+
import InputMultiLine from './components/InputMultiLine';
|
|
6
7
|
import BaseService from './service/BaseService';
|
|
7
8
|
import request, { httpGet, httpPut, httpPost, httpDelete, getDict, fetchOptions } from './http';
|
|
8
9
|
import * as utils from './utils';
|
|
@@ -11,4 +12,4 @@ import * as utils from './utils';
|
|
|
11
12
|
import useSingle from './hooks/useSingle';
|
|
12
13
|
import useDtl from './hooks/useDtl';
|
|
13
14
|
import usePermission from './hooks/usePermission';
|
|
14
|
-
export { DtlLayout, InputTable, Page404, Loading, IconSelector, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission };
|
|
15
|
+
export { DtlLayout, InputTable, Page404, Loading, IconSelector, InputMultiLine, BaseService, request, httpDelete, httpGet, httpPost, httpPut, getDict, fetchOptions, utils, useSingle, useDtl, usePermission };
|
|
@@ -159,7 +159,14 @@ function IconSelector(prop) {
|
|
|
159
159
|
var totalPage = (0, _react.useMemo)(function () {
|
|
160
160
|
if (total === 0) return 1;
|
|
161
161
|
return Math.ceil(total / pageSize);
|
|
162
|
-
}, [total]);
|
|
162
|
+
}, [total]);
|
|
163
|
+
(0, _react.useEffect)(function () {
|
|
164
|
+
var val = formRef.current.getFieldsValue();
|
|
165
|
+
|
|
166
|
+
if (val && val[name]) {
|
|
167
|
+
setImgUrl((0, _utils.toGatewayUrl)(val[name]));
|
|
168
|
+
}
|
|
169
|
+
}, []); // 验证上传文件大小
|
|
163
170
|
|
|
164
171
|
var beforeUpload = function beforeUpload(file) {
|
|
165
172
|
var sizeLimit = file.size / 1024 / 1024 >= maxSize;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { InputProps } from 'antd';
|
|
3
|
+
import type { ProFormItemProps } from 'ls-pro-form';
|
|
4
|
+
export declare type InputMultiLineProps = ProFormItemProps<InputProps> & {
|
|
5
|
+
/**@name 表单项name, 跟 form.item 的 name一致 */
|
|
6
|
+
name: string;
|
|
7
|
+
/**@name 表单值*/
|
|
8
|
+
defaultValue?: string;
|
|
9
|
+
/**@name 弹框宽度,默认为400 */
|
|
10
|
+
popWidth?: string;
|
|
11
|
+
/**@name 弹框位置,默认为bottom */
|
|
12
|
+
placement?: string;
|
|
13
|
+
/**@name 多行文本框行数 */
|
|
14
|
+
rows?: number;
|
|
15
|
+
/** @name 最大输入行数 */
|
|
16
|
+
maxRows?: number;
|
|
17
|
+
};
|
|
18
|
+
declare const InputMultiLine: React.ForwardRefExoticComponent<{
|
|
19
|
+
fieldProps?: (import("../../../form/lib/interface").FieldProps & InputProps) | undefined;
|
|
20
|
+
placeholder?: string | string[] | undefined;
|
|
21
|
+
secondary?: boolean | undefined;
|
|
22
|
+
allowClear?: boolean | undefined;
|
|
23
|
+
disabled?: boolean | undefined;
|
|
24
|
+
width?: number | "sm" | "md" | "xl" | "xs" | "lg" | undefined;
|
|
25
|
+
proFieldProps?: import("../../../utils/lib").ProFieldProps | undefined;
|
|
26
|
+
footerRender?: import("../../../form/lib").LightFilterFooterRender | undefined;
|
|
27
|
+
} & Omit<import("../../../form/lib/components/FormItem").ProFormItemProps, "valueType"> & import("../../../form/lib/interface").ExtendsProps & {
|
|
28
|
+
/**@name 表单项name, 跟 form.item 的 name一致 */
|
|
29
|
+
name: string;
|
|
30
|
+
/**@name 表单值*/
|
|
31
|
+
defaultValue?: string | undefined;
|
|
32
|
+
/**@name 弹框宽度,默认为400 */
|
|
33
|
+
popWidth?: string | undefined;
|
|
34
|
+
/**@name 弹框位置,默认为bottom */
|
|
35
|
+
placement?: string | undefined;
|
|
36
|
+
/**@name 多行文本框行数 */
|
|
37
|
+
rows?: number | undefined;
|
|
38
|
+
/** @name 最大输入行数 */
|
|
39
|
+
maxRows?: number | undefined;
|
|
40
|
+
} & React.RefAttributes<unknown>>;
|
|
41
|
+
export default InputMultiLine;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
require("antd/es/popover/style");
|
|
15
|
+
|
|
16
|
+
var _popover = _interopRequireDefault(require("antd/es/popover"));
|
|
17
|
+
|
|
18
|
+
require("antd/es/input/style");
|
|
19
|
+
|
|
20
|
+
var _input = _interopRequireDefault(require("antd/es/input"));
|
|
21
|
+
|
|
22
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
23
|
+
|
|
24
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
25
|
+
|
|
26
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
27
|
+
|
|
28
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
29
|
+
|
|
30
|
+
var _lsProForm = require("ls-pro-form");
|
|
31
|
+
|
|
32
|
+
var _icons = require("@ant-design/icons");
|
|
33
|
+
|
|
34
|
+
var _excluded = ["name", "rows", "maxRows", "placement", "popWidth", "fieldProps", "defaultValue", "allowClear"];
|
|
35
|
+
|
|
36
|
+
var InputMultiLine = /*#__PURE__*/_react.default.forwardRef(function (prop, ref) {
|
|
37
|
+
//@ts-ignore
|
|
38
|
+
var _useContext = (0, _react.useContext)(_lsProForm.ProFormContext),
|
|
39
|
+
formRef = _useContext.formRef;
|
|
40
|
+
|
|
41
|
+
var _useState = (0, _react.useState)(''),
|
|
42
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
43
|
+
text = _useState2[0],
|
|
44
|
+
setText = _useState2[1];
|
|
45
|
+
|
|
46
|
+
var _useState3 = (0, _react.useState)(''),
|
|
47
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
48
|
+
lineText = _useState4[0],
|
|
49
|
+
setLineText = _useState4[1];
|
|
50
|
+
|
|
51
|
+
var _useState5 = (0, _react.useState)(false),
|
|
52
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
53
|
+
visible = _useState6[0],
|
|
54
|
+
setVisible = _useState6[1];
|
|
55
|
+
|
|
56
|
+
var inputRef = (0, _react.useRef)();
|
|
57
|
+
(0, _react.useImperativeHandle)(ref, function () {
|
|
58
|
+
return inputRef.current;
|
|
59
|
+
});
|
|
60
|
+
var name = prop.name,
|
|
61
|
+
_prop$rows = prop.rows,
|
|
62
|
+
rows = _prop$rows === void 0 ? 12 : _prop$rows,
|
|
63
|
+
_prop$maxRows = prop.maxRows,
|
|
64
|
+
maxRows = _prop$maxRows === void 0 ? 20 : _prop$maxRows,
|
|
65
|
+
_prop$placement = prop.placement,
|
|
66
|
+
placement = _prop$placement === void 0 ? 'bottom' : _prop$placement,
|
|
67
|
+
_prop$popWidth = prop.popWidth,
|
|
68
|
+
popWidth = _prop$popWidth === void 0 ? '400px' : _prop$popWidth,
|
|
69
|
+
fieldProps = prop.fieldProps,
|
|
70
|
+
defaultValue = prop.defaultValue,
|
|
71
|
+
_prop$allowClear = prop.allowClear,
|
|
72
|
+
allowClear = _prop$allowClear === void 0 ? true : _prop$allowClear,
|
|
73
|
+
rest = (0, _objectWithoutProperties2.default)(prop, _excluded); // 设置初始值
|
|
74
|
+
|
|
75
|
+
(0, _react.useEffect)(function () {
|
|
76
|
+
if (defaultValue) {
|
|
77
|
+
setText(defaultValue);
|
|
78
|
+
} else if (name) {
|
|
79
|
+
var _formRef$current;
|
|
80
|
+
|
|
81
|
+
var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.getFieldsValue();
|
|
82
|
+
setText(formValue[name]);
|
|
83
|
+
}
|
|
84
|
+
}, []); // 显示多行输入时,赋值给多行文本框
|
|
85
|
+
|
|
86
|
+
(0, _react.useEffect)(function () {
|
|
87
|
+
if (!visible) return;
|
|
88
|
+
var line = (text || '').split(',').join('\n');
|
|
89
|
+
setLineText(line);
|
|
90
|
+
}, [visible, text]); // 输入框值变化时,赋值给表单项
|
|
91
|
+
|
|
92
|
+
(0, _react.useEffect)(function () {
|
|
93
|
+
var _formRef$current2, _formRef$current3;
|
|
94
|
+
|
|
95
|
+
var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : _formRef$current2.getFieldsValue();
|
|
96
|
+
formValue[name] = text;
|
|
97
|
+
(_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : _formRef$current3.setFieldsValue((0, _objectSpread2.default)({}, formValue));
|
|
98
|
+
}, [text]);
|
|
99
|
+
|
|
100
|
+
var lineInput = function lineInput(e) {
|
|
101
|
+
var line = (e.target.value || '').split('\n').filter(function (o, i) {
|
|
102
|
+
return i <= (maxRows < 1 ? 1000 : maxRows);
|
|
103
|
+
}).join('\n');
|
|
104
|
+
var txt = line.split('\n').join(',');
|
|
105
|
+
setLineText(line);
|
|
106
|
+
setText(txt);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
var textInput = function textInput(e) {
|
|
110
|
+
setText(e.target.value);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
var clearValue = function clearValue(e) {
|
|
114
|
+
if (!e.target.value) {
|
|
115
|
+
setText('');
|
|
116
|
+
setLineText('');
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
var PopoverDom = (0, _react.useMemo)(function () {
|
|
121
|
+
return /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
122
|
+
content: /*#__PURE__*/_react.default.createElement("div", {
|
|
123
|
+
style: {
|
|
124
|
+
width: popWidth
|
|
125
|
+
}
|
|
126
|
+
}, /*#__PURE__*/_react.default.createElement(_input.default.TextArea, {
|
|
127
|
+
rows: rows,
|
|
128
|
+
value: lineText,
|
|
129
|
+
onInput: lineInput,
|
|
130
|
+
onKeyPress: function onKeyPress(e) {
|
|
131
|
+
if (e.key === 'Enter') e.stopPropagation();
|
|
132
|
+
}
|
|
133
|
+
})),
|
|
134
|
+
trigger: "click",
|
|
135
|
+
visible: visible,
|
|
136
|
+
onVisibleChange: setVisible
|
|
137
|
+
}, /*#__PURE__*/_react.default.createElement(_icons.UnorderedListOutlined, {
|
|
138
|
+
onClick: function onClick(e) {
|
|
139
|
+
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
|
|
140
|
+
setVisible(true);
|
|
141
|
+
}
|
|
142
|
+
}));
|
|
143
|
+
}, [visible, popWidth, lineText, rest]);
|
|
144
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, rest.label && name ? /*#__PURE__*/_react.default.createElement(_lsProForm.ProFormText, (0, _extends2.default)({
|
|
145
|
+
name: name
|
|
146
|
+
}, rest), /*#__PURE__*/_react.default.createElement(_input.default, (0, _extends2.default)({
|
|
147
|
+
suffix: PopoverDom
|
|
148
|
+
}, fieldProps, {
|
|
149
|
+
onChange: clearValue,
|
|
150
|
+
onInput: textInput,
|
|
151
|
+
allowClear: allowClear,
|
|
152
|
+
ref: inputRef
|
|
153
|
+
}))) : /*#__PURE__*/_react.default.createElement(_input.default, (0, _extends2.default)({
|
|
154
|
+
suffix: PopoverDom,
|
|
155
|
+
allowClear: allowClear
|
|
156
|
+
}, fieldProps, {
|
|
157
|
+
onChange: clearValue,
|
|
158
|
+
onInput: textInput,
|
|
159
|
+
value: text,
|
|
160
|
+
ref: inputRef
|
|
161
|
+
})));
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
var _default = InputMultiLine;
|
|
165
|
+
exports.default = _default;
|
|
@@ -757,35 +757,44 @@ function useDtl(dtlParam) {
|
|
|
757
757
|
case 9:
|
|
758
758
|
result = _context8.sent;
|
|
759
759
|
|
|
760
|
+
if (!(result.data && typeof result.data === 'string')) {
|
|
761
|
+
_context8.next = 13;
|
|
762
|
+
break;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
window.open(result.data);
|
|
766
|
+
return _context8.abrupt("return", true);
|
|
767
|
+
|
|
768
|
+
case 13:
|
|
760
769
|
if (!(((_result$flag5 = result.flag) === null || _result$flag5 === void 0 ? void 0 : _result$flag5.retCode) === '0')) {
|
|
761
|
-
_context8.next =
|
|
770
|
+
_context8.next = 18;
|
|
762
771
|
break;
|
|
763
772
|
}
|
|
764
773
|
|
|
765
774
|
(0, _utils.showSuccess)(((_result$flag6 = result.flag) === null || _result$flag6 === void 0 ? void 0 : _result$flag6.retMsg) || '导出成功');
|
|
766
775
|
return _context8.abrupt("return", true);
|
|
767
776
|
|
|
768
|
-
case
|
|
777
|
+
case 18:
|
|
769
778
|
(0, _utils.showError)(((_result$flag7 = result.flag) === null || _result$flag7 === void 0 ? void 0 : _result$flag7.retMsg) || '导出失败,请联系系统管理员');
|
|
770
779
|
return _context8.abrupt("return", false);
|
|
771
780
|
|
|
772
|
-
case
|
|
773
|
-
_context8.next =
|
|
781
|
+
case 20:
|
|
782
|
+
_context8.next = 27;
|
|
774
783
|
break;
|
|
775
784
|
|
|
776
|
-
case
|
|
777
|
-
_context8.prev =
|
|
785
|
+
case 22:
|
|
786
|
+
_context8.prev = 22;
|
|
778
787
|
_context8.t0 = _context8["catch"](6);
|
|
779
788
|
console.log(_context8.t0);
|
|
780
789
|
(0, _utils.showError)(_context8.t0.message);
|
|
781
790
|
return _context8.abrupt("return", false);
|
|
782
791
|
|
|
783
|
-
case
|
|
792
|
+
case 27:
|
|
784
793
|
case "end":
|
|
785
794
|
return _context8.stop();
|
|
786
795
|
}
|
|
787
796
|
}
|
|
788
|
-
}, _callee8, null, [[6,
|
|
797
|
+
}, _callee8, null, [[6, 22]]);
|
|
789
798
|
}));
|
|
790
799
|
|
|
791
800
|
return function onExportDtl(_x6, _x7) {
|