ls-pro-common 3.0.89 → 3.0.90
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/InputMultiLine.js +15 -25
- package/es/components/InputTable.d.ts +1 -1
- package/es/components/InputTable.js +113 -163
- package/es/http/index.js +13 -8
- package/lib/components/InputMultiLine.js +15 -25
- package/lib/components/InputTable.d.ts +1 -1
- package/lib/components/InputTable.js +113 -163
- package/lib/http/index.js +13 -8
- package/package.json +1 -1
|
@@ -7,9 +7,9 @@ import "antd/es/button/style";
|
|
|
7
7
|
import _Button from "antd/es/button";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
9
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
10
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
11
10
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
12
11
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
12
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
13
13
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
14
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", "rowKey", "method", "changeOnSelect", "record"],
|
|
15
15
|
_excluded2 = ["current", "pageSize"];
|
|
@@ -40,7 +40,9 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
40
40
|
setText = _useState6[1];
|
|
41
41
|
var inputRef = useRef();
|
|
42
42
|
useImperativeHandle(ref, function () {
|
|
43
|
-
return inputRef.current
|
|
43
|
+
return _objectSpread(_objectSpread({}, inputRef.current), {}, {
|
|
44
|
+
clear: handleClear
|
|
45
|
+
});
|
|
44
46
|
});
|
|
45
47
|
var columns = prop.columns,
|
|
46
48
|
url = prop.url,
|
|
@@ -101,7 +103,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
101
103
|
var tableKey = (tableConfig === null || tableConfig === void 0 ? void 0 : tableConfig.rowKey) || valueField || 'id';
|
|
102
104
|
//显示输入框绑定的name,如果不设置textName,设置为$name__text
|
|
103
105
|
var textNameProp = useMemo(function () {
|
|
104
|
-
return textName
|
|
106
|
+
return textName ? textName : name + '__text';
|
|
105
107
|
}, [textName, name]);
|
|
106
108
|
// 输入框回车时,调用查询参数字段
|
|
107
109
|
var searchKey = useMemo(function () {
|
|
@@ -124,11 +126,11 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
124
126
|
}, [columns, searchField, valueField, textField]);
|
|
125
127
|
var loadData = /*#__PURE__*/function () {
|
|
126
128
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
|
|
127
|
-
var current, pageSize,
|
|
129
|
+
var current, pageSize, restParams, data, _tableRef$current, _tableRef$current$cle, result, rows, formValue, val, _selectRowRef$current, arr, pageSelectedRows;
|
|
128
130
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
129
131
|
while (1) switch (_context.prev = _context.next) {
|
|
130
132
|
case 0:
|
|
131
|
-
current = param.current, pageSize = param.pageSize,
|
|
133
|
+
current = param.current, pageSize = param.pageSize, restParams = _objectWithoutProperties(param, _excluded2);
|
|
132
134
|
data = {};
|
|
133
135
|
if (isV2) {
|
|
134
136
|
data['page.pn'] = current;
|
|
@@ -137,10 +139,10 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
137
139
|
data.page = current;
|
|
138
140
|
data.pageSize = pageSize;
|
|
139
141
|
}
|
|
140
|
-
if (Object.keys(
|
|
141
|
-
data.where =
|
|
142
|
+
if (Object.keys(restParams).length && !isV2) {
|
|
143
|
+
data.where = restParams;
|
|
142
144
|
} else {
|
|
143
|
-
data = _objectSpread(_objectSpread({}, data),
|
|
145
|
+
data = _objectSpread(_objectSpread({}, data), restParams);
|
|
144
146
|
}
|
|
145
147
|
if (!keepSelect) {
|
|
146
148
|
selectRowRef.current = [];
|
|
@@ -171,10 +173,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
171
173
|
}
|
|
172
174
|
// 多选时,找出当前页的默认选中项
|
|
173
175
|
if (multiple) {
|
|
174
|
-
formValue = (
|
|
175
|
-
if (rowKey) {
|
|
176
|
-
formValue = formValue[rowKey] || {};
|
|
177
|
-
}
|
|
176
|
+
formValue = getFormValue();
|
|
178
177
|
val = formValue[name] || (record === null || record === void 0 ? void 0 : record[name]);
|
|
179
178
|
if (val) {
|
|
180
179
|
arr = val.split(',');
|
|
@@ -208,48 +207,69 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
208
207
|
return _ref.apply(this, arguments);
|
|
209
208
|
};
|
|
210
209
|
}();
|
|
211
|
-
|
|
210
|
+
var getFormValue = function getFormValue() {
|
|
211
|
+
var _formRef$current2, _formRef$current2$get;
|
|
212
|
+
if (rowKey) {
|
|
213
|
+
var _formRef$current, _formRef$current$getF, _formRef$current$getF2;
|
|
214
|
+
return 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$getF2 = _formRef$current$getF.call(_formRef$current)) === null || _formRef$current$getF2 === void 0 ? void 0 : _formRef$current$getF2[rowKey];
|
|
215
|
+
}
|
|
216
|
+
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);
|
|
217
|
+
};
|
|
218
|
+
var setFormValue = function setFormValue(formValue) {
|
|
219
|
+
if (rowKey) {
|
|
220
|
+
var _formRef$current3, _formRef$current3$set;
|
|
221
|
+
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, _defineProperty({}, rowKey, formValue));
|
|
222
|
+
} else {
|
|
223
|
+
var _formRef$current4, _formRef$current4$set;
|
|
224
|
+
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);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
// 初始化数据,主要设置名称
|
|
212
228
|
useEffect(function () {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
} else {
|
|
226
|
-
var _formRef$current3, _formRef$current3$get, _formRef$current4, _formRef$current4$get;
|
|
227
|
-
txt = formRef === null || formRef === void 0 ? void 0 : (_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 ? void 0 : (_formRef$current3$get = _formRef$current3.getFieldValue) === null || _formRef$current3$get === void 0 ? void 0 : _formRef$current3$get.call(_formRef$current3, textNameProp);
|
|
228
|
-
val = formRef === null || formRef === void 0 ? void 0 : (_formRef$current4 = formRef.current) === null || _formRef$current4 === void 0 ? void 0 : (_formRef$current4$get = _formRef$current4.getFieldValue) === null || _formRef$current4$get === void 0 ? void 0 : _formRef$current4$get.call(_formRef$current4, name);
|
|
229
|
-
}
|
|
230
|
-
if (txt) {
|
|
231
|
-
setText(txt);
|
|
232
|
-
} else if (val) {
|
|
233
|
-
setText(val);
|
|
234
|
-
if (rowKey) {
|
|
235
|
-
var _formRef$current5, _formRef$current5$set;
|
|
236
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current5 = formRef.current) === null || _formRef$current5 === void 0 ? void 0 : (_formRef$current5$set = _formRef$current5.setFieldsValue) === null || _formRef$current5$set === void 0 ? void 0 : _formRef$current5$set.call(_formRef$current5, _defineProperty({}, rowKey, _objectSpread(_objectSpread({}, row), {}, _defineProperty({}, textNameProp, val))));
|
|
237
|
-
} else {
|
|
238
|
-
var _formRef$current6, _formRef$current6$set;
|
|
239
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current6 = formRef.current) === null || _formRef$current6 === void 0 ? void 0 : (_formRef$current6$set = _formRef$current6.setFieldsValue) === null || _formRef$current6$set === void 0 ? void 0 : _formRef$current6$set.call(_formRef$current6, _defineProperty({}, textNameProp, val));
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
(_rest$onChange = rest.onChange) === null || _rest$onChange === void 0 ? void 0 : _rest$onChange.call(rest, text || val);
|
|
243
|
-
}, 0);
|
|
229
|
+
var _formValue$textNamePr, _formValue$name;
|
|
230
|
+
var formValue = getFormValue();
|
|
231
|
+
var txt = (_formValue$textNamePr = formValue === null || formValue === void 0 ? void 0 : formValue[textNameProp]) !== null && _formValue$textNamePr !== void 0 ? _formValue$textNamePr : record === null || record === void 0 ? void 0 : record[textNameProp];
|
|
232
|
+
var val = (_formValue$name = formValue === null || formValue === void 0 ? void 0 : formValue[name]) !== null && _formValue$name !== void 0 ? _formValue$name : record === null || record === void 0 ? void 0 : record[name];
|
|
233
|
+
setText(txt !== null && txt !== void 0 ? txt : val);
|
|
234
|
+
if (val && !txt) {
|
|
235
|
+
formValue[textNameProp] = val;
|
|
236
|
+
setFormValue(formValue);
|
|
237
|
+
// if (textField !== valueField) {
|
|
238
|
+
// initName(val);
|
|
239
|
+
//}
|
|
240
|
+
}
|
|
244
241
|
}, [rowKey]);
|
|
242
|
+
// 跨页显示有问题
|
|
243
|
+
var initName = function initName(val) {
|
|
244
|
+
var _columns$find;
|
|
245
|
+
if (!val) return;
|
|
246
|
+
var fieldName = ((_columns$find = columns.find(function (o) {
|
|
247
|
+
return o.dataIndex === valueField;
|
|
248
|
+
})) === null || _columns$find === void 0 ? void 0 : _columns$find.searchField) || valueField;
|
|
249
|
+
var param = {
|
|
250
|
+
current: 1,
|
|
251
|
+
pageSize: 10
|
|
252
|
+
};
|
|
253
|
+
if (Array.isArray(val)) val = val.join(',');
|
|
254
|
+
if (val.toString().includes(',')) {
|
|
255
|
+
fieldName += '_in';
|
|
256
|
+
}
|
|
257
|
+
param[fieldName] = val;
|
|
258
|
+
loadData(param).then(function (result) {
|
|
259
|
+
var rows = result.data || [];
|
|
260
|
+
var txt = rows.map(function (o) {
|
|
261
|
+
return o[textField];
|
|
262
|
+
}).join(',') || val;
|
|
263
|
+
var formValue = getFormValue(); //重新取一次
|
|
264
|
+
formValue[textNameProp] = txt;
|
|
265
|
+
setText(txt);
|
|
266
|
+
setFormValue(formValue);
|
|
267
|
+
});
|
|
268
|
+
};
|
|
245
269
|
// 处理返回数据
|
|
246
270
|
var handleValue = function handleValue(row) {
|
|
247
|
-
var _formRef$current7, _formRef$current7$get, _rest$onChange2;
|
|
248
271
|
var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
249
|
-
var formValue = (
|
|
250
|
-
if (rowKey) {
|
|
251
|
-
formValue = formValue[rowKey] || {};
|
|
252
|
-
}
|
|
272
|
+
var formValue = getFormValue();
|
|
253
273
|
if (!formValue) return;
|
|
254
274
|
var txt;
|
|
255
275
|
//支持多选
|
|
@@ -284,23 +304,22 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
284
304
|
}
|
|
285
305
|
formValue[textNameProp] = txt;
|
|
286
306
|
setText(txt);
|
|
287
|
-
(
|
|
307
|
+
setFormValue(formValue);
|
|
308
|
+
onSelectChange === null || onSelectChange === void 0 ? void 0 : onSelectChange(row, formRef);
|
|
288
309
|
if (close) {
|
|
289
310
|
setVisible(false);
|
|
290
311
|
}
|
|
291
|
-
if (rowKey) {
|
|
292
|
-
var _formRef$current8, _formRef$current8$set;
|
|
293
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current8 = formRef.current) === null || _formRef$current8 === void 0 ? void 0 : (_formRef$current8$set = _formRef$current8.setFieldsValue) === null || _formRef$current8$set === void 0 ? void 0 : _formRef$current8$set.call(_formRef$current8, _defineProperty({}, rowKey, formValue));
|
|
294
|
-
} else {
|
|
295
|
-
var _formRef$current9, _formRef$current9$set;
|
|
296
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current9 = formRef.current) === null || _formRef$current9 === void 0 ? void 0 : (_formRef$current9$set = _formRef$current9.setFieldsValue) === null || _formRef$current9$set === void 0 ? void 0 : _formRef$current9$set.call(_formRef$current9, _objectSpread({}, formValue));
|
|
297
|
-
}
|
|
298
|
-
onSelectChange === null || onSelectChange === void 0 ? void 0 : onSelectChange(row, formRef);
|
|
299
312
|
};
|
|
300
313
|
var handleClear = function handleClear() {
|
|
301
314
|
var _tableRef$current2, _tableRef$current2$cl;
|
|
302
315
|
selectRowRef.current = [];
|
|
316
|
+
setSelectedKeys([]);
|
|
303
317
|
(_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : (_tableRef$current2$cl = _tableRef$current2.clearSelected) === null || _tableRef$current2$cl === void 0 ? void 0 : _tableRef$current2$cl.call(_tableRef$current2);
|
|
318
|
+
setText('');
|
|
319
|
+
var formValue = getFormValue();
|
|
320
|
+
formValue[name] = undefined;
|
|
321
|
+
formValue[textNameProp] = undefined;
|
|
322
|
+
setFormValue(formValue);
|
|
304
323
|
};
|
|
305
324
|
// 可输入时,回车或失去焦点调接口查询数据
|
|
306
325
|
var onQuery = function onQuery(e) {
|
|
@@ -329,47 +348,21 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
329
348
|
};
|
|
330
349
|
//直接输入不回车,value 和 text 为同一个值
|
|
331
350
|
var onInput = function onInput(e) {
|
|
332
|
-
var
|
|
333
|
-
var formValue = (formRef === null || formRef === void 0 ? void 0 : (_formRef$current10 = formRef.current) === null || _formRef$current10 === void 0 ? void 0 : (_formRef$current10$ge = _formRef$current10.getFieldsValue) === null || _formRef$current10$ge === void 0 ? void 0 : _formRef$current10$ge.call(_formRef$current10)) || {};
|
|
334
|
-
if (rowKey) {
|
|
335
|
-
formValue = formValue[rowKey] || {};
|
|
336
|
-
}
|
|
351
|
+
var formValue = getFormValue();
|
|
337
352
|
var val = e.target.value;
|
|
338
353
|
formValue[name] = val;
|
|
339
354
|
formValue[textNameProp] = val;
|
|
340
355
|
setText(val);
|
|
341
|
-
(
|
|
342
|
-
if (rowKey) {
|
|
343
|
-
var _formRef$current11, _formRef$current11$se;
|
|
344
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current11 = formRef.current) === null || _formRef$current11 === void 0 ? void 0 : (_formRef$current11$se = _formRef$current11.setFieldsValue) === null || _formRef$current11$se === void 0 ? void 0 : _formRef$current11$se.call(_formRef$current11, _defineProperty({}, rowKey, formValue));
|
|
345
|
-
} else {
|
|
346
|
-
var _formRef$current12, _formRef$current12$se;
|
|
347
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current12 = formRef.current) === null || _formRef$current12 === void 0 ? void 0 : (_formRef$current12$se = _formRef$current12.setFieldsValue) === null || _formRef$current12$se === void 0 ? void 0 : _formRef$current12$se.call(_formRef$current12, _objectSpread({}, formValue));
|
|
348
|
-
}
|
|
356
|
+
setFormValue(formValue);
|
|
349
357
|
};
|
|
350
358
|
// 当表单重置或点clear时,处理值
|
|
351
359
|
var clearValue = function clearValue(e) {
|
|
352
360
|
if (!e.target.value) {
|
|
353
|
-
|
|
354
|
-
setText('');
|
|
355
|
-
(_rest$onChange4 = rest.onChange) === null || _rest$onChange4 === void 0 ? void 0 : _rest$onChange4.call(rest, '');
|
|
356
|
-
var formValue = (formRef === null || formRef === void 0 ? void 0 : (_formRef$current13 = formRef.current) === null || _formRef$current13 === void 0 ? void 0 : (_formRef$current13$ge = _formRef$current13.getFieldsValue) === null || _formRef$current13$ge === void 0 ? void 0 : _formRef$current13$ge.call(_formRef$current13)) || {};
|
|
357
|
-
if (rowKey) {
|
|
358
|
-
formValue = formValue[rowKey] || {};
|
|
359
|
-
}
|
|
360
|
-
formValue[name] = '';
|
|
361
|
-
formValue[textNameProp] = '';
|
|
362
|
-
if (rowKey) {
|
|
363
|
-
var _formRef$current14, _formRef$current14$se;
|
|
364
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current14 = formRef.current) === null || _formRef$current14 === void 0 ? void 0 : (_formRef$current14$se = _formRef$current14.setFieldsValue) === null || _formRef$current14$se === void 0 ? void 0 : _formRef$current14$se.call(_formRef$current14, _defineProperty({}, rowKey, formValue));
|
|
365
|
-
} else {
|
|
366
|
-
var _formRef$current15, _formRef$current15$se;
|
|
367
|
-
formRef === null || formRef === void 0 ? void 0 : (_formRef$current15 = formRef.current) === null || _formRef$current15 === void 0 ? void 0 : (_formRef$current15$se = _formRef$current15.setFieldsValue) === null || _formRef$current15$se === void 0 ? void 0 : _formRef$current15$se.call(_formRef$current15, _objectSpread({}, formValue));
|
|
368
|
-
}
|
|
361
|
+
handleClear();
|
|
369
362
|
if (onSelectChange) {
|
|
370
363
|
try {
|
|
371
364
|
onSelectChange(null, formRef);
|
|
372
|
-
} catch (
|
|
365
|
+
} catch (error) {}
|
|
373
366
|
}
|
|
374
367
|
}
|
|
375
368
|
};
|
|
@@ -407,11 +400,11 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
407
400
|
},
|
|
408
401
|
height: 'full',
|
|
409
402
|
rowKey: tableKey,
|
|
410
|
-
onRow: function onRow(
|
|
403
|
+
onRow: function onRow(rowData) {
|
|
411
404
|
return {
|
|
412
405
|
onDoubleClick: function onDoubleClick() {
|
|
413
406
|
if (!multiple) {
|
|
414
|
-
handleValue(
|
|
407
|
+
handleValue(rowData);
|
|
415
408
|
}
|
|
416
409
|
}
|
|
417
410
|
};
|
|
@@ -447,28 +440,7 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
447
440
|
showClear: true,
|
|
448
441
|
selectedTagField: textField || valueField
|
|
449
442
|
}));
|
|
450
|
-
|
|
451
|
-
useEffect(function () {
|
|
452
|
-
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
|
|
453
|
-
try {
|
|
454
|
-
var el = inputRef.current.input.parentNode;
|
|
455
|
-
if (!el) return;
|
|
456
|
-
if (text) {
|
|
457
|
-
el.classList.add('ant-input-has-value');
|
|
458
|
-
} else {
|
|
459
|
-
el.classList.remove('ant-input-has-value');
|
|
460
|
-
}
|
|
461
|
-
} catch (e) {}
|
|
462
|
-
}, [text, rest, fieldProps]);
|
|
463
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
464
|
-
style: {
|
|
465
|
-
display: 'none'
|
|
466
|
-
}
|
|
467
|
-
}, /*#__PURE__*/React.createElement(ProFormText, {
|
|
468
|
-
name: name
|
|
469
|
-
})), rest.label ? /*#__PURE__*/React.createElement(ProFormText, _extends({
|
|
470
|
-
name: textNameProp
|
|
471
|
-
}, rest), /*#__PURE__*/React.createElement(_Input, _extends({
|
|
443
|
+
var InputDom = /*#__PURE__*/React.createElement(_Input, _extends({
|
|
472
444
|
suffix: /*#__PURE__*/React.createElement(_Popover, {
|
|
473
445
|
content: /*#__PURE__*/React.createElement("div", {
|
|
474
446
|
style: {
|
|
@@ -485,13 +457,13 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
485
457
|
overlayStyle: {
|
|
486
458
|
width: 'max-content'
|
|
487
459
|
},
|
|
488
|
-
|
|
489
|
-
|
|
460
|
+
open: rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled) ? false : visible,
|
|
461
|
+
onOpenChange: setVisible,
|
|
490
462
|
getPopupContainer: getPopupContainer,
|
|
491
463
|
placement: placement,
|
|
492
464
|
arrowPointAtCenter: arrowPointAtCenter
|
|
493
465
|
}, /*#__PURE__*/React.createElement(MoreOutlined, {
|
|
494
|
-
onClick: function onClick(
|
|
466
|
+
onClick: function onClick() {
|
|
495
467
|
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
|
|
496
468
|
setVisible(true);
|
|
497
469
|
}
|
|
@@ -516,54 +488,32 @@ var InputTable = /*#__PURE__*/React.forwardRef(function (prop, ref) {
|
|
|
516
488
|
readOnly: readonly,
|
|
517
489
|
allowClear: allowClear,
|
|
518
490
|
ref: inputRef
|
|
519
|
-
},
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
},
|
|
533
|
-
overlayStyle: {
|
|
534
|
-
width: 'max-content'
|
|
535
|
-
},
|
|
536
|
-
visible: rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled) ? false : visible,
|
|
537
|
-
onVisibleChange: setVisible,
|
|
538
|
-
getPopupContainer: getPopupContainer,
|
|
539
|
-
placement: placement,
|
|
540
|
-
arrowPointAtCenter: arrowPointAtCenter
|
|
541
|
-
}, /*#__PURE__*/React.createElement(MoreOutlined, {
|
|
542
|
-
onClick: function onClick(e) {
|
|
543
|
-
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
|
|
544
|
-
setVisible(true);
|
|
545
|
-
}
|
|
546
|
-
})),
|
|
547
|
-
onClick: function onClick() {
|
|
548
|
-
if (!readonly) return;
|
|
549
|
-
setVisible(true);
|
|
550
|
-
},
|
|
551
|
-
onInput: onInput,
|
|
552
|
-
onPressEnter: function onPressEnter(e) {
|
|
553
|
-
if (triggerCheck === 'entry') {
|
|
554
|
-
onQuery(e);
|
|
555
|
-
}
|
|
556
|
-
},
|
|
557
|
-
onBlur: function onBlur(e) {
|
|
558
|
-
if (triggerCheck === 'blur') {
|
|
559
|
-
onQuery(e);
|
|
491
|
+
}, rest.label ? {} : {
|
|
492
|
+
value: text
|
|
493
|
+
}, fieldProps));
|
|
494
|
+
// 处理有值时,可清空
|
|
495
|
+
useEffect(function () {
|
|
496
|
+
if (rest.disabled || (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled)) return;
|
|
497
|
+
try {
|
|
498
|
+
var el = inputRef.current.input.parentNode;
|
|
499
|
+
if (!el) return;
|
|
500
|
+
if (text) {
|
|
501
|
+
el.classList.add('ant-input-has-value');
|
|
502
|
+
} else {
|
|
503
|
+
el.classList.remove('ant-input-has-value');
|
|
560
504
|
}
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
},
|
|
505
|
+
} catch (e) {}
|
|
506
|
+
}, [text, rest, fieldProps]);
|
|
507
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
508
|
+
style: {
|
|
509
|
+
display: 'none'
|
|
510
|
+
}
|
|
511
|
+
}, /*#__PURE__*/React.createElement(ProFormText, {
|
|
512
|
+
name: name
|
|
513
|
+
})), /*#__PURE__*/React.createElement(ProFormText, _extends({
|
|
514
|
+
name: textNameProp
|
|
515
|
+
}, rest, {
|
|
516
|
+
noStyle: !rest.label
|
|
517
|
+
}), InputDom));
|
|
568
518
|
});
|
|
569
519
|
export default InputTable;
|
package/lib/http/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
1
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
4
|
import { extend } from 'umi-request';
|
|
@@ -15,6 +16,7 @@ var httpStatus = {
|
|
|
15
16
|
};
|
|
16
17
|
/** 请求拦截器,统一添加token */
|
|
17
18
|
request.interceptors.request.use(function (url, options) {
|
|
19
|
+
var _options$params;
|
|
18
20
|
var token = getCookie('token');
|
|
19
21
|
options.headers = options.headers || {};
|
|
20
22
|
// 处理 token
|
|
@@ -47,12 +49,14 @@ request.interceptors.request.use(function (url, options) {
|
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
url = url.replace('&noToken=1', '').replace('noToken=1', '');
|
|
52
|
+
var resCode = getUrlQuery('resCode', url) || getUrlQuery('resCode') || getUrlQuery('resourceId') || getResourceProps('resourceId');
|
|
50
53
|
var param = {
|
|
51
|
-
resCode: getUrlQuery('resCode', url) || getUrlQuery('resCode') || getUrlQuery('resourceId') || getResourceProps('resourceId'),
|
|
52
54
|
_t1: Date.now()
|
|
53
55
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
// 当没有明文参数resCode的时候,添加resCode参数为资源Id
|
|
57
|
+
//@ts-ignore
|
|
58
|
+
if (resCode && !((_options$params = options.params) === null || _options$params === void 0 ? void 0 : _options$params.resCode)) {
|
|
59
|
+
param.resCode = resCode;
|
|
56
60
|
}
|
|
57
61
|
url = setUrlQuery(url, param);
|
|
58
62
|
return {
|
|
@@ -204,7 +208,9 @@ function ajax(url) {
|
|
|
204
208
|
timeout: timeout,
|
|
205
209
|
requestType: isJson ? 'json' : 'form'
|
|
206
210
|
}).finally(function () {
|
|
207
|
-
|
|
211
|
+
if (loadText) {
|
|
212
|
+
exitLoading();
|
|
213
|
+
}
|
|
208
214
|
});
|
|
209
215
|
}
|
|
210
216
|
}
|
|
@@ -322,12 +328,11 @@ function _fetchOptions() {
|
|
|
322
328
|
_yield$httpGet$rows = _yield$httpGet.rows;
|
|
323
329
|
rows = _yield$httpGet$rows === void 0 ? [] : _yield$httpGet$rows;
|
|
324
330
|
data = (rows || []).map(function (o) {
|
|
325
|
-
return {
|
|
331
|
+
return _objectSpread(_objectSpread({}, o), {}, {
|
|
326
332
|
value: o[valueField],
|
|
327
333
|
text: o[labelField],
|
|
328
|
-
label: (showValue ? o[valueField] + '→' : '') + o[labelField]
|
|
329
|
-
|
|
330
|
-
};
|
|
334
|
+
label: (showValue ? o[valueField] + '→' : '') + o[labelField]
|
|
335
|
+
});
|
|
331
336
|
});
|
|
332
337
|
return _context2.abrupt("return", data);
|
|
333
338
|
case 10:
|