ls-pro-common 3.0.12 → 3.0.14
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/README.md +22 -22
- package/dist/common.css +121 -21
- package/dist/common.js +1 -1
- package/dist/common.min.css +121 -21
- package/dist/common.min.js +1 -1
- package/package.json +48 -48
- package/CHANGELOG.md +0 -746
- package/es/components/404.d.ts +0 -3
- package/es/components/404.jpg +0 -0
- package/es/components/404.js +0 -9
- package/es/components/AreaCascader.d.ts +0 -4
- package/es/components/AreaCascader.js +0 -76
- package/es/components/AreaCascaderPanel.d.ts +0 -5
- package/es/components/AreaCascaderPanel.js +0 -230
- package/es/components/DescritionCard.d.ts +0 -11
- package/es/components/DescritionCard.js +0 -79
- package/es/components/DtlLayout.d.ts +0 -44
- package/es/components/DtlLayout.js +0 -115
- package/es/components/GroupTip.d.ts +0 -10
- package/es/components/GroupTip.js +0 -31
- package/es/components/IconBack.d.ts +0 -3
- package/es/components/IconBack.js +0 -20
- package/es/components/IconBell.d.ts +0 -3
- package/es/components/IconBell.js +0 -22
- package/es/components/IconQuestion.d.ts +0 -3
- package/es/components/IconQuestion.js +0 -26
- package/es/components/IconSearch.d.ts +0 -3
- package/es/components/IconSearch.js +0 -22
- package/es/components/IconSelector.d.ts +0 -14
- package/es/components/IconSelector.js +0 -222
- package/es/components/IconText.d.ts +0 -3
- package/es/components/IconText.js +0 -30
- package/es/components/ImageSelector.d.ts +0 -31
- package/es/components/ImageSelector.js +0 -437
- package/es/components/InputMultiLine.d.ts +0 -46
- package/es/components/InputMultiLine.js +0 -139
- package/es/components/InputTable.d.ts +0 -106
- package/es/components/InputTable.js +0 -476
- package/es/components/Loading.d.ts +0 -8
- package/es/components/Loading.js +0 -20
- package/es/components/Permission.d.ts +0 -6
- package/es/components/Permission.js +0 -13
- package/es/components/antd-custom.less +0 -262
- package/es/components/common.less +0 -469
- package/es/hooks/useDtl/index.d.ts +0 -48
- package/es/hooks/useDtl/index.js +0 -949
- package/es/hooks/useGetState.d.ts +0 -1
- package/es/hooks/useGetState.js +0 -17
- package/es/hooks/usePermission/index.d.ts +0 -15
- package/es/hooks/usePermission/index.js +0 -58
- package/es/hooks/useSingle/index.d.ts +0 -55
- package/es/hooks/useSingle/index.js +0 -662
- package/es/http/index.d.ts +0 -53
- package/es/http/index.js +0 -305
- package/es/index.d.ts +0 -32
- package/es/index.js +0 -26
- package/es/service/BaseService.d.ts +0 -24
- package/es/service/BaseService.js +0 -214
- package/es/typing.d.ts +0 -53
- package/es/typing.js +0 -1
- package/es/utils/index.d.ts +0 -258
- package/es/utils/index.js +0 -679
- package/lib/components/404.d.ts +0 -3
- package/lib/components/404.jpg +0 -0
- package/lib/components/404.js +0 -17
- package/lib/components/AreaCascader.d.ts +0 -4
- package/lib/components/AreaCascader.js +0 -85
- package/lib/components/AreaCascaderPanel.d.ts +0 -5
- package/lib/components/AreaCascaderPanel.js +0 -239
- package/lib/components/DescritionCard.d.ts +0 -11
- package/lib/components/DescritionCard.js +0 -88
- package/lib/components/DtlLayout.d.ts +0 -44
- package/lib/components/DtlLayout.js +0 -124
- package/lib/components/GroupTip.d.ts +0 -10
- package/lib/components/GroupTip.js +0 -39
- package/lib/components/IconBack.d.ts +0 -3
- package/lib/components/IconBack.js +0 -28
- package/lib/components/IconBell.d.ts +0 -3
- package/lib/components/IconBell.js +0 -30
- package/lib/components/IconQuestion.d.ts +0 -3
- package/lib/components/IconQuestion.js +0 -34
- package/lib/components/IconSearch.d.ts +0 -3
- package/lib/components/IconSearch.js +0 -30
- package/lib/components/IconSelector.d.ts +0 -14
- package/lib/components/IconSelector.js +0 -230
- package/lib/components/IconText.d.ts +0 -3
- package/lib/components/IconText.js +0 -38
- package/lib/components/ImageSelector.d.ts +0 -31
- package/lib/components/ImageSelector.js +0 -445
- package/lib/components/InputMultiLine.d.ts +0 -46
- package/lib/components/InputMultiLine.js +0 -148
- package/lib/components/InputTable.d.ts +0 -106
- package/lib/components/InputTable.js +0 -485
- package/lib/components/Loading.d.ts +0 -8
- package/lib/components/Loading.js +0 -28
- package/lib/components/Permission.d.ts +0 -6
- package/lib/components/Permission.js +0 -21
- package/lib/components/antd-custom.less +0 -262
- package/lib/components/common.less +0 -469
- package/lib/hooks/useDtl/index.d.ts +0 -48
- package/lib/hooks/useDtl/index.js +0 -957
- package/lib/hooks/useGetState.d.ts +0 -1
- package/lib/hooks/useGetState.js +0 -24
- package/lib/hooks/usePermission/index.d.ts +0 -15
- package/lib/hooks/usePermission/index.js +0 -65
- package/lib/hooks/useSingle/index.d.ts +0 -55
- package/lib/hooks/useSingle/index.js +0 -670
- package/lib/http/index.d.ts +0 -53
- package/lib/http/index.js +0 -319
- package/lib/index.d.ts +0 -32
- package/lib/service/BaseService.d.ts +0 -24
- package/lib/service/BaseService.js +0 -222
- package/lib/typing.d.ts +0 -53
- package/lib/typing.js +0 -5
- package/lib/utils/index.d.ts +0 -258
- package/lib/utils/index.js +0 -776
|
@@ -1,445 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
-
require("antd/es/modal/style");
|
|
11
|
-
var _modal = _interopRequireDefault(require("antd/es/modal"));
|
|
12
|
-
require("antd/es/empty/style");
|
|
13
|
-
var _empty = _interopRequireDefault(require("antd/es/empty"));
|
|
14
|
-
require("antd/es/card/style");
|
|
15
|
-
var _card = _interopRequireDefault(require("antd/es/card"));
|
|
16
|
-
require("antd/es/button/style");
|
|
17
|
-
var _button = _interopRequireDefault(require("antd/es/button"));
|
|
18
|
-
require("antd/es/upload/style");
|
|
19
|
-
var _upload = _interopRequireDefault(require("antd/es/upload"));
|
|
20
|
-
require("antd/es/input/style");
|
|
21
|
-
var _input = _interopRequireDefault(require("antd/es/input"));
|
|
22
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
23
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
24
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
25
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
26
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
27
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
28
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
29
|
-
var _lsProForm = require("ls-pro-form");
|
|
30
|
-
var _icons = require("@ant-design/icons");
|
|
31
|
-
var _http = require("../http");
|
|
32
|
-
var _utils = require("../utils");
|
|
33
|
-
var _excluded = ["type", "uploadable", "readonly", "allowClear", "title", "modalWidth", "name", "maxSize", "modalProps", "code", "isInput", "desc", "imageClass", "maxCount"];
|
|
34
|
-
var fileCenter = (0, _utils.getCache)('ossPath') || '/petrel/petrel-file-center-api/lesoon/oss/file/';
|
|
35
|
-
function ImageSelector(prop) {
|
|
36
|
-
var _rest$fieldProps3;
|
|
37
|
-
//@ts-ignore?
|
|
38
|
-
var _useContext = (0, _react.useContext)(_lsProForm.ProFormContext),
|
|
39
|
-
formRef = _useContext.formRef;
|
|
40
|
-
var _useState = (0, _react.useState)(false),
|
|
41
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
42
|
-
visible = _useState2[0],
|
|
43
|
-
setVisible = _useState2[1];
|
|
44
|
-
var _useState3 = (0, _react.useState)(''),
|
|
45
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
46
|
-
imgUrl = _useState4[0],
|
|
47
|
-
setImgUrl = _useState4[1];
|
|
48
|
-
var _useState5 = (0, _react.useState)([]),
|
|
49
|
-
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
50
|
-
list = _useState6[0],
|
|
51
|
-
setList = _useState6[1];
|
|
52
|
-
var _useState7 = (0, _react.useState)(''),
|
|
53
|
-
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
54
|
-
searchKey = _useState8[0],
|
|
55
|
-
setSearchKey = _useState8[1];
|
|
56
|
-
var _useState9 = (0, _react.useState)(''),
|
|
57
|
-
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
58
|
-
nextMarker = _useState10[0],
|
|
59
|
-
setNextMarker = _useState10[1];
|
|
60
|
-
var inputRef = (0, _react.useRef)();
|
|
61
|
-
var type = prop.type,
|
|
62
|
-
_prop$uploadable = prop.uploadable,
|
|
63
|
-
uploadable = _prop$uploadable === void 0 ? true : _prop$uploadable,
|
|
64
|
-
_prop$readonly = prop.readonly,
|
|
65
|
-
readonly = _prop$readonly === void 0 ? true : _prop$readonly,
|
|
66
|
-
_prop$allowClear = prop.allowClear,
|
|
67
|
-
allowClear = _prop$allowClear === void 0 ? true : _prop$allowClear,
|
|
68
|
-
_prop$title = prop.title,
|
|
69
|
-
title = _prop$title === void 0 ? "选择图标" : _prop$title,
|
|
70
|
-
_prop$modalWidth = prop.modalWidth,
|
|
71
|
-
modalWidth = _prop$modalWidth === void 0 ? '600px' : _prop$modalWidth,
|
|
72
|
-
name = prop.name,
|
|
73
|
-
_prop$maxSize = prop.maxSize,
|
|
74
|
-
maxSize = _prop$maxSize === void 0 ? 5 : _prop$maxSize,
|
|
75
|
-
modalProps = prop.modalProps,
|
|
76
|
-
_prop$code = prop.code,
|
|
77
|
-
code = _prop$code === void 0 ? 'RETAIL' : _prop$code,
|
|
78
|
-
_prop$isInput = prop.isInput,
|
|
79
|
-
isInput = _prop$isInput === void 0 ? true : _prop$isInput,
|
|
80
|
-
_prop$desc = prop.desc,
|
|
81
|
-
desc = _prop$desc === void 0 ? '支持 png | jpg | gif 格式图片' : _prop$desc,
|
|
82
|
-
_prop$imageClass = prop.imageClass,
|
|
83
|
-
imageClass = _prop$imageClass === void 0 ? '' : _prop$imageClass,
|
|
84
|
-
_prop$maxCount = prop.maxCount,
|
|
85
|
-
maxCount = _prop$maxCount === void 0 ? 1 : _prop$maxCount,
|
|
86
|
-
rest = (0, _objectWithoutProperties2.default)(prop, _excluded);
|
|
87
|
-
// 上传地址
|
|
88
|
-
var uploadImgApi = (0, _react.useMemo)(function () {
|
|
89
|
-
return fileCenter + 'upload/' + code + '?catalogName=' + type;
|
|
90
|
-
}, [code, type]);
|
|
91
|
-
// 分页加载列表地址
|
|
92
|
-
var pageImgApi = (0, _react.useMemo)(function () {
|
|
93
|
-
return fileCenter + 'page/' + code;
|
|
94
|
-
}, [code]);
|
|
95
|
-
// 展示地址
|
|
96
|
-
var showImgApi = (0, _react.useMemo)(function () {
|
|
97
|
-
return fileCenter + 'show/' + code;
|
|
98
|
-
}, [code]);
|
|
99
|
-
var _useState11 = (0, _react.useState)([]),
|
|
100
|
-
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
101
|
-
selectedUrl = _useState12[0],
|
|
102
|
-
setSelectedUrl = _useState12[1];
|
|
103
|
-
var loadData = /*#__PURE__*/function () {
|
|
104
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(keys) {
|
|
105
|
-
var _result$data, _result$data2;
|
|
106
|
-
var url, param, result, rows;
|
|
107
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
108
|
-
while (1) switch (_context.prev = _context.next) {
|
|
109
|
-
case 0:
|
|
110
|
-
url = pageImgApi;
|
|
111
|
-
param = {
|
|
112
|
-
prefix: type,
|
|
113
|
-
maxKeys: 16
|
|
114
|
-
};
|
|
115
|
-
if (keys) {
|
|
116
|
-
param.prefix = param.prefix + '/' + keys;
|
|
117
|
-
}
|
|
118
|
-
if (nextMarker) {
|
|
119
|
-
param.nextMarker = nextMarker;
|
|
120
|
-
}
|
|
121
|
-
_context.next = 6;
|
|
122
|
-
return (0, _http.httpGet)(url, param, false);
|
|
123
|
-
case 6:
|
|
124
|
-
result = _context.sent;
|
|
125
|
-
rows = (((_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.objectList) || []).filter(function (o) {
|
|
126
|
-
return o.dir == false && (!nextMarker || !list.find(function (e) {
|
|
127
|
-
return e.path === o.path;
|
|
128
|
-
}));
|
|
129
|
-
});
|
|
130
|
-
rows.forEach(function (row) {
|
|
131
|
-
row.url = showImgApi + '?fileName=' + row.path;
|
|
132
|
-
});
|
|
133
|
-
if (!nextMarker) {
|
|
134
|
-
setList(rows);
|
|
135
|
-
} else {
|
|
136
|
-
setList([].concat((0, _toConsumableArray2.default)(list), (0, _toConsumableArray2.default)(rows)));
|
|
137
|
-
}
|
|
138
|
-
setNextMarker((_result$data2 = result.data) === null || _result$data2 === void 0 ? void 0 : _result$data2.nextMarker);
|
|
139
|
-
case 11:
|
|
140
|
-
case "end":
|
|
141
|
-
return _context.stop();
|
|
142
|
-
}
|
|
143
|
-
}, _callee);
|
|
144
|
-
}));
|
|
145
|
-
return function loadData(_x) {
|
|
146
|
-
return _ref.apply(this, arguments);
|
|
147
|
-
};
|
|
148
|
-
}();
|
|
149
|
-
(0, _react.useEffect)(function () {
|
|
150
|
-
if (!visible) {
|
|
151
|
-
setNextMarker('');
|
|
152
|
-
setSearchKey('');
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
loadData(searchKey);
|
|
156
|
-
}, [visible, searchKey]);
|
|
157
|
-
(0, _react.useEffect)(function () {
|
|
158
|
-
var _formRef$current, _formRef$current$getF;
|
|
159
|
-
var val = (formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : (_formRef$current$getF = _formRef$current.getFieldsValue) === null || _formRef$current$getF === void 0 ? void 0 : _formRef$current$getF.call(_formRef$current)) || {};
|
|
160
|
-
var url = val === null || val === void 0 ? void 0 : val[name];
|
|
161
|
-
if (!url) {
|
|
162
|
-
var _formRef$current2, _formRef$current2$get;
|
|
163
|
-
url = formRef === null || formRef === void 0 ? void 0 : (_formRef$current2 = formRef.current) === null || _formRef$current2 === void 0 ? void 0 : (_formRef$current2$get = _formRef$current2.getFieldValue) === null || _formRef$current2$get === void 0 ? void 0 : _formRef$current2$get.call(_formRef$current2, name);
|
|
164
|
-
}
|
|
165
|
-
if (url) {
|
|
166
|
-
var urls = url.toString().split(',');
|
|
167
|
-
setImgUrl(urls[0]);
|
|
168
|
-
setSelectedUrl(urls);
|
|
169
|
-
}
|
|
170
|
-
}, []);
|
|
171
|
-
// 验证上传文件大小
|
|
172
|
-
var beforeUpload = function beforeUpload(file) {
|
|
173
|
-
var sizeLimit = file.size / 1024 / 1024 >= maxSize;
|
|
174
|
-
if (sizeLimit) {
|
|
175
|
-
(0, _utils.showError)("\u4E0A\u4F20\u7684\u6587\u4EF6\u4E0D\u80FD\u5927\u4E8E".concat(maxSize, "M"));
|
|
176
|
-
}
|
|
177
|
-
return !sizeLimit;
|
|
178
|
-
};
|
|
179
|
-
// 上传图片
|
|
180
|
-
var onUpload = function onUpload(info) {
|
|
181
|
-
var isDirect = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
182
|
-
if (info.file.status === 'done') {
|
|
183
|
-
var _result$flag;
|
|
184
|
-
var result = info.file.response;
|
|
185
|
-
if ((result === null || result === void 0 ? void 0 : (_result$flag = result.flag) === null || _result$flag === void 0 ? void 0 : _result$flag.retCode) === '0') {
|
|
186
|
-
(0, _utils.showSuccess)(result.flag.retMsg);
|
|
187
|
-
// 直接上传
|
|
188
|
-
if (isDirect) {
|
|
189
|
-
var _result$rows$, _formRef$current3, _formRef$current3$get, _formRef$current4, _formRef$current4$set;
|
|
190
|
-
var img = showImgApi + '?fileName=' + (result === null || result === void 0 ? void 0 : (_result$rows$ = result.rows[0]) === null || _result$rows$ === void 0 ? void 0 : _result$rows$.newFileId);
|
|
191
|
-
setImgUrl(img);
|
|
192
|
-
var formVal = formRef === null || formRef === void 0 ? void 0 : (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : (_formRef$current3$get = _formRef$current3.getFieldsValue) === null || _formRef$current3$get === void 0 ? void 0 : _formRef$current3$get.call(_formRef$current3);
|
|
193
|
-
var val = (0, _objectSpread2.default)({}, formVal);
|
|
194
|
-
//@ts-ignore
|
|
195
|
-
val[name] = img;
|
|
196
|
-
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, val);
|
|
197
|
-
}
|
|
198
|
-
} else {
|
|
199
|
-
var _result$flag2;
|
|
200
|
-
(0, _utils.showError)((result === null || result === void 0 ? void 0 : (_result$flag2 = result.flag) === null || _result$flag2 === void 0 ? void 0 : _result$flag2.retMsg) || '上传图片失败,请联系管理员');
|
|
201
|
-
}
|
|
202
|
-
} else if (info.file.status === 'error') {
|
|
203
|
-
(0, _utils.showError)('上传数据失败,请联系管理员');
|
|
204
|
-
}
|
|
205
|
-
if (!isDirect && !info.fileList.filter(function (o) {
|
|
206
|
-
return o.status === 'uploading';
|
|
207
|
-
}).length) {
|
|
208
|
-
loadData(searchKey);
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
var showSelect = function showSelect() {
|
|
212
|
-
var _rest$fieldProps;
|
|
213
|
-
if ((rest === null || rest === void 0 ? void 0 : rest.disabled) || (rest === null || rest === void 0 ? void 0 : (_rest$fieldProps = rest.fieldProps) === null || _rest$fieldProps === void 0 ? void 0 : _rest$fieldProps.disabled)) {
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
setVisible(true);
|
|
217
|
-
};
|
|
218
|
-
(0, _react.useEffect)(function () {
|
|
219
|
-
var _rest$fieldProps2;
|
|
220
|
-
if ((rest === null || rest === void 0 ? void 0 : rest.disabled) || (rest === null || rest === void 0 ? void 0 : (_rest$fieldProps2 = rest.fieldProps) === null || _rest$fieldProps2 === void 0 ? void 0 : _rest$fieldProps2.disabled)) return;
|
|
221
|
-
try {
|
|
222
|
-
if (!inputRef.current) return;
|
|
223
|
-
var el = inputRef.current.input.parentNode;
|
|
224
|
-
if (!el) return;
|
|
225
|
-
if (imgUrl) {
|
|
226
|
-
el.classList.add('ant-input-has-value');
|
|
227
|
-
} else {
|
|
228
|
-
el.classList.remove('ant-input-has-value');
|
|
229
|
-
}
|
|
230
|
-
} catch (e) {}
|
|
231
|
-
}, [imgUrl]);
|
|
232
|
-
var toggleSelectImage = function toggleSelectImage(url) {
|
|
233
|
-
if (selectedUrl.includes(url)) {
|
|
234
|
-
setSelectedUrl(function (val) {
|
|
235
|
-
return val.filter(function (o) {
|
|
236
|
-
return o !== url;
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
} else if (selectedUrl.length < maxCount && maxCount > 1) {
|
|
240
|
-
setSelectedUrl([].concat((0, _toConsumableArray2.default)(selectedUrl), [url]));
|
|
241
|
-
} else if (maxCount === 1) {
|
|
242
|
-
setSelectedUrl([url]);
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
var confirmImage = function confirmImage() {
|
|
246
|
-
var _formRef$current5, _formRef$current5$get;
|
|
247
|
-
var formVal = formRef === null || formRef === void 0 ? void 0 : (_formRef$current5 = formRef.current) === null || _formRef$current5 === void 0 ? void 0 : (_formRef$current5$get = _formRef$current5.getFieldsValue) === null || _formRef$current5$get === void 0 ? void 0 : _formRef$current5$get.call(_formRef$current5);
|
|
248
|
-
var val = (0, _objectSpread2.default)({}, formVal);
|
|
249
|
-
//@ts-ignore
|
|
250
|
-
val[name] = selectedUrl.join(',');
|
|
251
|
-
formRef.current.setFieldsValue(val);
|
|
252
|
-
setImgUrl(selectedUrl.join(','));
|
|
253
|
-
setVisible(false);
|
|
254
|
-
};
|
|
255
|
-
var clearValue = function clearValue(e) {
|
|
256
|
-
if (!e || !e.target.value) {
|
|
257
|
-
var _formRef$current6, _formRef$current6$get;
|
|
258
|
-
setImgUrl('');
|
|
259
|
-
var formValue = (formRef === null || formRef === void 0 ? void 0 : (_formRef$current6 = formRef.current) === null || _formRef$current6 === void 0 ? void 0 : (_formRef$current6$get = _formRef$current6.getFieldsValue) === null || _formRef$current6$get === void 0 ? void 0 : _formRef$current6$get.call(_formRef$current6)) || {};
|
|
260
|
-
formValue[name] = '';
|
|
261
|
-
formRef.current.setFieldsValue((0, _objectSpread2.default)({}, formValue));
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_lsProForm.ProFormText, (0, _extends2.default)({
|
|
265
|
-
name: name
|
|
266
|
-
}, rest), isInput ? /*#__PURE__*/_react.default.createElement(_input.default, (0, _extends2.default)({
|
|
267
|
-
addonAfter: imgUrl ? /*#__PURE__*/_react.default.createElement("img", {
|
|
268
|
-
style: {
|
|
269
|
-
maxWidth: 22,
|
|
270
|
-
maxHeight: 22
|
|
271
|
-
},
|
|
272
|
-
src: (imgUrl || '').split(',')[0],
|
|
273
|
-
onClick: function onClick() {
|
|
274
|
-
return showSelect();
|
|
275
|
-
}
|
|
276
|
-
}) : /*#__PURE__*/_react.default.createElement(_icons.PlusOutlined, {
|
|
277
|
-
onClick: function onClick() {
|
|
278
|
-
return showSelect();
|
|
279
|
-
}
|
|
280
|
-
})
|
|
281
|
-
}, rest.fieldProps, {
|
|
282
|
-
readOnly: readonly,
|
|
283
|
-
allowClear: allowClear,
|
|
284
|
-
ref: inputRef,
|
|
285
|
-
onChange: clearValue
|
|
286
|
-
})) : /*#__PURE__*/_react.default.createElement("div", {
|
|
287
|
-
className: "image-selector"
|
|
288
|
-
}, /*#__PURE__*/_react.default.createElement(_upload.default, {
|
|
289
|
-
beforeUpload: beforeUpload,
|
|
290
|
-
onChange: function onChange(info) {
|
|
291
|
-
return onUpload(info, true);
|
|
292
|
-
},
|
|
293
|
-
action: uploadImgApi,
|
|
294
|
-
showUploadList: false,
|
|
295
|
-
name: "file",
|
|
296
|
-
maxCount: 1,
|
|
297
|
-
multiple: false,
|
|
298
|
-
headers: {
|
|
299
|
-
token: localStorage.getItem('token') || ''
|
|
300
|
-
},
|
|
301
|
-
accept: ".png,.gif,.jpg,.jpeg,.bmp"
|
|
302
|
-
}, imgUrl ? /*#__PURE__*/_react.default.createElement("div", {
|
|
303
|
-
className: "img-wrapper"
|
|
304
|
-
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
305
|
-
className: "img-preview ".concat(imageClass),
|
|
306
|
-
src: (imgUrl || '').split(',')[0]
|
|
307
|
-
}), (rest === null || rest === void 0 ? void 0 : rest.disabled) !== true && (rest === null || rest === void 0 ? void 0 : (_rest$fieldProps3 = rest.fieldProps) === null || _rest$fieldProps3 === void 0 ? void 0 : _rest$fieldProps3.disabled) !== true && /*#__PURE__*/_react.default.createElement("div", {
|
|
308
|
-
className: "clear-btn"
|
|
309
|
-
}, /*#__PURE__*/_react.default.createElement(_icons.CloseOutlined, {
|
|
310
|
-
title: "\u6E05\u7A7A",
|
|
311
|
-
onClick: function onClick(e) {
|
|
312
|
-
e.preventDefault();
|
|
313
|
-
e.stopPropagation();
|
|
314
|
-
clearValue(undefined);
|
|
315
|
-
}
|
|
316
|
-
}))) : /*#__PURE__*/_react.default.createElement("img", {
|
|
317
|
-
className: "img-upload",
|
|
318
|
-
src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAYAAABxLuKEAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAEnQAABJ0Ad5mH3gAABB9SURBVHhe7ZyJV1THtsb5F1+Sm0Gj8SZOiVFUVBBFmhkZBGRukKmbbqbuZp5EJpFmUFEZFKPxOiT3Je8ac2OuCgLf21+dPs3p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ok/ji2Mp2GY4D/3VxLFRe06kISopB/nFZQJlRKA8xcLCggZmbm4OT578irv3/oHBSyNwuppQWFmLrFIn0vlCynAu+isoTcaUdc6JvDIn6ps6MDJ+BQ8f/eCHsrS0hP8HWEep3cNGCJsAAAAASUVORK5CYII="
|
|
319
|
-
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
320
|
-
className: "img-choose"
|
|
321
|
-
}, /*#__PURE__*/_react.default.createElement("a", {
|
|
322
|
-
onClick: function onClick() {
|
|
323
|
-
return showSelect();
|
|
324
|
-
}
|
|
325
|
-
}, "\u9009\u62E9\u5DF2\u6709\u56FE\u7247")), /*#__PURE__*/_react.default.createElement("div", {
|
|
326
|
-
className: "img-desc"
|
|
327
|
-
}, desc))), /*#__PURE__*/_react.default.createElement(_modal.default, (0, _extends2.default)({
|
|
328
|
-
title: /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("span", null, title), /*#__PURE__*/_react.default.createElement("span", {
|
|
329
|
-
style: {
|
|
330
|
-
display: 'inline-block',
|
|
331
|
-
width: 230,
|
|
332
|
-
marginLeft: 30
|
|
333
|
-
}
|
|
334
|
-
}, /*#__PURE__*/_react.default.createElement(_input.default, {
|
|
335
|
-
suffix: /*#__PURE__*/_react.default.createElement(_icons.SearchOutlined, null),
|
|
336
|
-
placeholder: "\u8F93\u5165\u56FE\u7247\u540D\u67E5\u8BE2",
|
|
337
|
-
onPressEnter: function onPressEnter(e) {
|
|
338
|
-
setNextMarker('');
|
|
339
|
-
setTimeout(function () {
|
|
340
|
-
setSearchKey(e.target.value || '');
|
|
341
|
-
}, 1);
|
|
342
|
-
}
|
|
343
|
-
}))),
|
|
344
|
-
visible: visible,
|
|
345
|
-
width: modalWidth,
|
|
346
|
-
destroyOnClose: true,
|
|
347
|
-
onCancel: function onCancel() {
|
|
348
|
-
return setVisible(false);
|
|
349
|
-
},
|
|
350
|
-
className: "image-selector",
|
|
351
|
-
centered: true,
|
|
352
|
-
footer: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
353
|
-
style: {
|
|
354
|
-
display: 'inline-block',
|
|
355
|
-
marginRight: 8
|
|
356
|
-
}
|
|
357
|
-
}, /*#__PURE__*/_react.default.createElement(_upload.default, {
|
|
358
|
-
beforeUpload: beforeUpload,
|
|
359
|
-
onChange: function onChange(info) {
|
|
360
|
-
return onUpload(info, false);
|
|
361
|
-
},
|
|
362
|
-
action: uploadImgApi,
|
|
363
|
-
showUploadList: false,
|
|
364
|
-
name: "file",
|
|
365
|
-
maxCount: 20,
|
|
366
|
-
multiple: true,
|
|
367
|
-
headers: {
|
|
368
|
-
token: localStorage.getItem('token') || ''
|
|
369
|
-
},
|
|
370
|
-
accept: ".png,.gif,.jpg,.jpeg,.bmp"
|
|
371
|
-
}, /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
372
|
-
icon: /*#__PURE__*/_react.default.createElement(_icons.UploadOutlined, null)
|
|
373
|
-
}, "\u4E0A\u4F20\u65B0\u56FE"))), /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
374
|
-
onClick: function onClick() {
|
|
375
|
-
return loadData(searchKey);
|
|
376
|
-
}
|
|
377
|
-
}, nextMarker ? '加载更多' : '刷新'), maxCount > 1 && /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
378
|
-
onClick: confirmImage
|
|
379
|
-
}, "\u786E\u8BA4")),
|
|
380
|
-
getContainer: function getContainer() {
|
|
381
|
-
return document.body;
|
|
382
|
-
}
|
|
383
|
-
}, modalProps), /*#__PURE__*/_react.default.createElement("div", {
|
|
384
|
-
style: {
|
|
385
|
-
minHeight: '120px',
|
|
386
|
-
display: 'flex',
|
|
387
|
-
marginLeft: 16,
|
|
388
|
-
gap: 16,
|
|
389
|
-
flexWrap: 'wrap'
|
|
390
|
-
}
|
|
391
|
-
}, list.map(function (o) {
|
|
392
|
-
return /*#__PURE__*/_react.default.createElement(_card.default, {
|
|
393
|
-
hoverable: true,
|
|
394
|
-
style: {
|
|
395
|
-
width: '125px',
|
|
396
|
-
height: '130px',
|
|
397
|
-
verticalAlign: 'middle',
|
|
398
|
-
background: selectedUrl.includes(o.url) ? '#efefef' : '#fff'
|
|
399
|
-
},
|
|
400
|
-
bodyStyle: {
|
|
401
|
-
padding: '15px 8px',
|
|
402
|
-
textAlign: 'center'
|
|
403
|
-
},
|
|
404
|
-
onDoubleClick: function onDoubleClick() {
|
|
405
|
-
if (!name) {
|
|
406
|
-
(0, _utils.showWarn)('选择图标组件未设置name属性');
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
var formVal = formRef.current.getFieldsValue();
|
|
410
|
-
var val = (0, _objectSpread2.default)({}, formVal);
|
|
411
|
-
//@ts-ignore
|
|
412
|
-
val[name] = o.url;
|
|
413
|
-
formRef.current.setFieldsValue(val);
|
|
414
|
-
setImgUrl(o.url);
|
|
415
|
-
setSelectedUrl([o.url]);
|
|
416
|
-
setVisible(false);
|
|
417
|
-
},
|
|
418
|
-
onClick: function onClick() {
|
|
419
|
-
toggleSelectImage(o.url);
|
|
420
|
-
},
|
|
421
|
-
key: o.path
|
|
422
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
423
|
-
style: {
|
|
424
|
-
height: 80
|
|
425
|
-
}
|
|
426
|
-
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
427
|
-
title: o.name,
|
|
428
|
-
style: {
|
|
429
|
-
maxWidth: '80px',
|
|
430
|
-
maxHeight: '80px'
|
|
431
|
-
},
|
|
432
|
-
src: o.url
|
|
433
|
-
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
434
|
-
style: {
|
|
435
|
-
whiteSpace: 'nowrap',
|
|
436
|
-
textOverflow: 'ellipsis',
|
|
437
|
-
overflow: 'hidden'
|
|
438
|
-
}
|
|
439
|
-
}, o.name));
|
|
440
|
-
}), list.length === 0 && /*#__PURE__*/_react.default.createElement(_empty.default, {
|
|
441
|
-
image: _empty.default.PRESENTED_IMAGE_SIMPLE
|
|
442
|
-
}))));
|
|
443
|
-
}
|
|
444
|
-
var _default = ImageSelector;
|
|
445
|
-
exports.default = _default;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { InputProps } from 'antd';
|
|
3
|
-
import type { TextAreaProps } from 'antd/lib/input';
|
|
4
|
-
import type { ProFormItemProps } from 'ls-pro-form';
|
|
5
|
-
export declare type InputMultiLineProps = ProFormItemProps<InputProps> & {
|
|
6
|
-
/**@name 表单项name, 跟 form.item 的 name一致 */
|
|
7
|
-
name: string;
|
|
8
|
-
/**@name 表单值*/
|
|
9
|
-
defaultValue?: string;
|
|
10
|
-
/**@name 弹框宽度,默认为400 */
|
|
11
|
-
popWidth?: string;
|
|
12
|
-
/**@name 弹框位置,默认为bottom */
|
|
13
|
-
placement?: string;
|
|
14
|
-
/**@name 多行文本框行数 */
|
|
15
|
-
rows?: number;
|
|
16
|
-
/** @name 最大输入行数 */
|
|
17
|
-
maxRows?: number;
|
|
18
|
-
getPopupContainer?: (triggerNode: any) => HTMLElement;
|
|
19
|
-
textAreaProps?: TextAreaProps;
|
|
20
|
-
};
|
|
21
|
-
declare const InputMultiLine: React.ForwardRefExoticComponent<{
|
|
22
|
-
fieldProps?: (import("../../../form/lib/interface").FieldProps & InputProps) | undefined;
|
|
23
|
-
placeholder?: string | string[] | undefined;
|
|
24
|
-
secondary?: boolean | undefined;
|
|
25
|
-
allowClear?: boolean | undefined;
|
|
26
|
-
disabled?: boolean | undefined;
|
|
27
|
-
width?: number | "sm" | "md" | "xl" | "xs" | "lg" | undefined;
|
|
28
|
-
proFieldProps?: import("../../../utils/lib").ProFieldProps | undefined;
|
|
29
|
-
footerRender?: import("../../../form/lib").LightFilterFooterRender | undefined;
|
|
30
|
-
} & Omit<import("../../../form/lib/components/FormItem").ProFormItemProps, "valueType"> & import("../../../form/lib/interface").ExtendsProps & {
|
|
31
|
-
/**@name 表单项name, 跟 form.item 的 name一致 */
|
|
32
|
-
name: string;
|
|
33
|
-
/**@name 表单值*/
|
|
34
|
-
defaultValue?: string | undefined;
|
|
35
|
-
/**@name 弹框宽度,默认为400 */
|
|
36
|
-
popWidth?: string | undefined;
|
|
37
|
-
/**@name 弹框位置,默认为bottom */
|
|
38
|
-
placement?: string | undefined;
|
|
39
|
-
/**@name 多行文本框行数 */
|
|
40
|
-
rows?: number | undefined;
|
|
41
|
-
/** @name 最大输入行数 */
|
|
42
|
-
maxRows?: number | undefined;
|
|
43
|
-
getPopupContainer?: ((triggerNode: any) => HTMLElement) | undefined;
|
|
44
|
-
textAreaProps?: TextAreaProps | undefined;
|
|
45
|
-
} & React.RefAttributes<unknown>>;
|
|
46
|
-
export default InputMultiLine;
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
require("antd/es/popover/style");
|
|
10
|
-
var _popover = _interopRequireDefault(require("antd/es/popover"));
|
|
11
|
-
require("antd/es/input/style");
|
|
12
|
-
var _input = _interopRequireDefault(require("antd/es/input"));
|
|
13
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
15
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
16
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
18
|
-
var _lsProForm = require("ls-pro-form");
|
|
19
|
-
var _icons = require("@ant-design/icons");
|
|
20
|
-
var _excluded = ["name", "rows", "maxRows", "placement", "popWidth", "fieldProps", "defaultValue", "allowClear", "getPopupContainer", "textAreaProps"];
|
|
21
|
-
var InputMultiLine = /*#__PURE__*/_react.default.forwardRef(function (prop, ref) {
|
|
22
|
-
//@ts-ignore
|
|
23
|
-
var _useContext = (0, _react.useContext)(_lsProForm.ProFormContext),
|
|
24
|
-
formRef = _useContext.formRef;
|
|
25
|
-
var _useState = (0, _react.useState)(''),
|
|
26
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
27
|
-
text = _useState2[0],
|
|
28
|
-
setText = _useState2[1];
|
|
29
|
-
var _useState3 = (0, _react.useState)(''),
|
|
30
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
31
|
-
lineText = _useState4[0],
|
|
32
|
-
setLineText = _useState4[1];
|
|
33
|
-
var _useState5 = (0, _react.useState)(false),
|
|
34
|
-
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
35
|
-
visible = _useState6[0],
|
|
36
|
-
setVisible = _useState6[1];
|
|
37
|
-
var inputRef = (0, _react.useRef)();
|
|
38
|
-
(0, _react.useImperativeHandle)(ref, function () {
|
|
39
|
-
return inputRef.current;
|
|
40
|
-
});
|
|
41
|
-
var name = prop.name,
|
|
42
|
-
_prop$rows = prop.rows,
|
|
43
|
-
rows = _prop$rows === void 0 ? 12 : _prop$rows,
|
|
44
|
-
_prop$maxRows = prop.maxRows,
|
|
45
|
-
maxRows = _prop$maxRows === void 0 ? 20 : _prop$maxRows,
|
|
46
|
-
_prop$placement = prop.placement,
|
|
47
|
-
placement = _prop$placement === void 0 ? 'bottom' : _prop$placement,
|
|
48
|
-
_prop$popWidth = prop.popWidth,
|
|
49
|
-
popWidth = _prop$popWidth === void 0 ? '400px' : _prop$popWidth,
|
|
50
|
-
fieldProps = prop.fieldProps,
|
|
51
|
-
defaultValue = prop.defaultValue,
|
|
52
|
-
_prop$allowClear = prop.allowClear,
|
|
53
|
-
allowClear = _prop$allowClear === void 0 ? true : _prop$allowClear,
|
|
54
|
-
_prop$getPopupContain = prop.getPopupContainer,
|
|
55
|
-
getPopupContainer = _prop$getPopupContain === void 0 ? function (triggerNode) {
|
|
56
|
-
return triggerNode.parentNode.parentNode.parentNode.parentNode;
|
|
57
|
-
} : _prop$getPopupContain,
|
|
58
|
-
textAreaProps = prop.textAreaProps,
|
|
59
|
-
rest = (0, _objectWithoutProperties2.default)(prop, _excluded);
|
|
60
|
-
// 设置初始值
|
|
61
|
-
(0, _react.useEffect)(function () {
|
|
62
|
-
if (defaultValue) {
|
|
63
|
-
setText(defaultValue);
|
|
64
|
-
} else if (name && (formRef === null || formRef === void 0 ? void 0 : formRef.current)) {
|
|
65
|
-
var _formRef$current, _formRef$current$getF;
|
|
66
|
-
var formValue = formRef === null || formRef === void 0 ? void 0 : (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : (_formRef$current$getF = _formRef$current.getFieldValue) === null || _formRef$current$getF === void 0 ? void 0 : _formRef$current$getF.call(_formRef$current, name);
|
|
67
|
-
setText(formValue);
|
|
68
|
-
}
|
|
69
|
-
}, []);
|
|
70
|
-
// 显示多行输入时,赋值给多行文本框
|
|
71
|
-
(0, _react.useEffect)(function () {
|
|
72
|
-
if (!visible) return;
|
|
73
|
-
var line = (text || '').split(',').join('\n');
|
|
74
|
-
setLineText(line);
|
|
75
|
-
}, [visible, text]);
|
|
76
|
-
// 输入框值变化时,赋值给表单项
|
|
77
|
-
(0, _react.useEffect)(function () {
|
|
78
|
-
var _formRef$current2, _formRef$current2$get, _formRef$current3, _formRef$current3$set;
|
|
79
|
-
var formValue = (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)) || {};
|
|
80
|
-
formValue[name] = text;
|
|
81
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : (_formRef$current3$set = _formRef$current3.setFieldsValue) === null || _formRef$current3$set === void 0 ? void 0 : _formRef$current3$set.call(_formRef$current3, (0, _objectSpread2.default)({}, formValue));
|
|
82
|
-
}, [text]);
|
|
83
|
-
var lineInput = function lineInput(e) {
|
|
84
|
-
var line = (e.target.value || '').split('\n').filter(function (o, i) {
|
|
85
|
-
return i <= (maxRows < 1 ? 1000 : maxRows);
|
|
86
|
-
}).join('\n');
|
|
87
|
-
var txt = line.split('\n').join(',');
|
|
88
|
-
setLineText(line);
|
|
89
|
-
setText(txt);
|
|
90
|
-
};
|
|
91
|
-
var textInput = function textInput(e) {
|
|
92
|
-
setText(e.target.value);
|
|
93
|
-
};
|
|
94
|
-
var clearValue = function clearValue(e) {
|
|
95
|
-
if (!e.target.value) {
|
|
96
|
-
setText('');
|
|
97
|
-
setLineText('');
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
var PopoverDom = (0, _react.useMemo)(function () {
|
|
101
|
-
return /*#__PURE__*/_react.default.createElement(_popover.default, {
|
|
102
|
-
content: /*#__PURE__*/_react.default.createElement("div", {
|
|
103
|
-
style: {
|
|
104
|
-
width: popWidth
|
|
105
|
-
}
|
|
106
|
-
}, /*#__PURE__*/_react.default.createElement(_input.default.TextArea, (0, _extends2.default)({
|
|
107
|
-
placeholder: "\u8BF7\u8F93\u5165"
|
|
108
|
-
}, textAreaProps, {
|
|
109
|
-
rows: rows,
|
|
110
|
-
value: lineText,
|
|
111
|
-
onInput: lineInput,
|
|
112
|
-
onKeyPress: function onKeyPress(e) {
|
|
113
|
-
if (e.key === 'Enter') e.stopPropagation();
|
|
114
|
-
}
|
|
115
|
-
}))),
|
|
116
|
-
trigger: "click",
|
|
117
|
-
visible: rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled) ? false : visible,
|
|
118
|
-
onVisibleChange: setVisible,
|
|
119
|
-
getPopupContainer: getPopupContainer
|
|
120
|
-
}, /*#__PURE__*/_react.default.createElement(_icons.UnorderedListOutlined, {
|
|
121
|
-
onClick: function onClick(e) {
|
|
122
|
-
setVisible(true);
|
|
123
|
-
}
|
|
124
|
-
}));
|
|
125
|
-
}, [visible, popWidth, lineText, rest]);
|
|
126
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, rest.label && name ? /*#__PURE__*/_react.default.createElement(_lsProForm.ProFormText, (0, _extends2.default)({
|
|
127
|
-
name: name
|
|
128
|
-
}, rest), /*#__PURE__*/_react.default.createElement(_input.default, (0, _extends2.default)({
|
|
129
|
-
suffix: PopoverDom,
|
|
130
|
-
placeholder: "\u8BF7\u8F93\u5165"
|
|
131
|
-
}, fieldProps, {
|
|
132
|
-
onChange: clearValue,
|
|
133
|
-
onInput: textInput,
|
|
134
|
-
allowClear: allowClear,
|
|
135
|
-
ref: inputRef
|
|
136
|
-
}))) : /*#__PURE__*/_react.default.createElement(_input.default, (0, _extends2.default)({
|
|
137
|
-
suffix: PopoverDom,
|
|
138
|
-
placeholder: "\u8BF7\u8F93\u5165",
|
|
139
|
-
allowClear: allowClear
|
|
140
|
-
}, fieldProps, {
|
|
141
|
-
onChange: clearValue,
|
|
142
|
-
onInput: textInput,
|
|
143
|
-
value: text,
|
|
144
|
-
ref: inputRef
|
|
145
|
-
})));
|
|
146
|
-
});
|
|
147
|
-
var _default = InputMultiLine;
|
|
148
|
-
exports.default = _default;
|