ds-web-all 1.0.1-beta.90 → 1.0.1-beta.92

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.
@@ -15,7 +15,7 @@ var _react = _interopRequireWildcard(require("react"));
15
15
  var _fileRequest = _interopRequireDefault(require("../../common/fileRequest"));
16
16
  require("./index.less");
17
17
  var _Confirm = _interopRequireDefault(require("../Confirm"));
18
- var _excluded = ["onFinish", "listType", "multiple", "accept", "value", "text", "buttonProps", "requestUrl", "confirmProps", "onError"];
18
+ var _excluded = ["onFinish", "listType", "multiple", "accept", "value", "text", "buttonProps", "requestUrl", "confirmProps", "onError", "requestTimeout", "defaultErrorMsg"];
19
19
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
20
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
21
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
@@ -49,6 +49,10 @@ var BaseUpload = function BaseUpload(_ref) {
49
49
  requestUrl = _ref.requestUrl,
50
50
  confirmProps = _ref.confirmProps,
51
51
  onError = _ref.onError,
52
+ _ref$requestTimeout = _ref.requestTimeout,
53
+ requestTimeout = _ref$requestTimeout === void 0 ? 30000 : _ref$requestTimeout,
54
+ _ref$defaultErrorMsg = _ref.defaultErrorMsg,
55
+ defaultErrorMsg = _ref$defaultErrorMsg === void 0 ? '上传失败' : _ref$defaultErrorMsg,
52
56
  props = _objectWithoutProperties(_ref, _excluded);
53
57
  var headers = {
54
58
  Authorization: window.token
@@ -114,7 +118,8 @@ var BaseUpload = function BaseUpload(_ref) {
114
118
  headers: {
115
119
  'Content-Type': 'multipart/form-data'
116
120
  },
117
- data: formData
121
+ data: formData,
122
+ timeout: requestTimeout
118
123
  });
119
124
  case 6:
120
125
  res = _context.sent;
@@ -124,7 +129,7 @@ var BaseUpload = function BaseUpload(_ref) {
124
129
  case 10:
125
130
  _context.prev = 10;
126
131
  _context.t0 = _context["catch"](3);
127
- errorMessage = (_context.t0 === null || _context.t0 === void 0 ? void 0 : (_error$response = _context.t0.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.message) || (_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || '上传失败';
132
+ errorMessage = (_context.t0 === null || _context.t0 === void 0 ? void 0 : (_error$response = _context.t0.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.message) || (_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message) || defaultErrorMsg;
128
133
  _message2.default.error(errorMessage);
129
134
  onError === null || onError === void 0 ? void 0 : onError(_context.t0);
130
135
  console.error('Upload error:', _context.t0);
@@ -98,10 +98,7 @@ var ComposeManage = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
98
98
  emptyText = _ref$emptyText === void 0 ? '暂无数据' : _ref$emptyText,
99
99
  _ref$staticDataSource = _ref.staticDataSource,
100
100
  staticDataSource = _ref$staticDataSource === void 0 ? [] : _ref$staticDataSource,
101
- _ref$staticFilter = _ref.staticFilter,
102
- staticFilter = _ref$staticFilter === void 0 ? function () {
103
- return true;
104
- } : _ref$staticFilter,
101
+ staticFilter = _ref.staticFilter,
105
102
  _ref$staticSearch = _ref.staticSearch,
106
103
  staticSearch = _ref$staticSearch === void 0 ? function () {} : _ref$staticSearch,
107
104
  _ref$outerLoading = _ref.outerLoading,
@@ -421,6 +418,13 @@ var ComposeManage = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
421
418
  }
422
419
  formRef.current.resetFields(); // 重置搜索框中表单
423
420
  formRef.current.setFieldsValue(initialFilterValues);
421
+ if (!dataRequest && typeof staticFilter === 'function') {
422
+ var newData = staticDataSourceCache.current.filter(function (el, i) {
423
+ return staticFilter(initialFilterValues, el, i);
424
+ });
425
+ setTableSource(_toConsumableArray(newData));
426
+ setTotal(newData.length);
427
+ }
424
428
  if (!dataRequest && typeof staticSearch === 'function') {
425
429
  staticSearch(initialFilterValues);
426
430
  }
@@ -633,15 +637,23 @@ var ComposeManage = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
633
637
  newTotal = _ref6.total,
634
638
  newPageNo = _ref6.pageNo,
635
639
  newPageSize = _ref6.pageSize;
636
- setTableSource(dataSorce);
637
- setTotal(newTotal !== null && newTotal !== void 0 ? newTotal : dataSorce.length);
640
+ staticDataSourceCache.current = dataSorce;
641
+ if (!dataRequest && typeof staticFilter === 'function') {
642
+ var newData = staticDataSourceCache.current.filter(function (el, i) {
643
+ return staticFilter(search, el, i);
644
+ });
645
+ setTableSource(_toConsumableArray(newData));
646
+ setTotal(newTotal !== null && newTotal !== void 0 ? newTotal : newData.length);
647
+ } else {
648
+ setTableSource(dataSorce);
649
+ setTotal(newTotal !== null && newTotal !== void 0 ? newTotal : dataSorce.length);
650
+ }
638
651
  if (typeof newPageNo === 'number') {
639
652
  setPageNo(newPageNo);
640
653
  }
641
654
  if (typeof newPageSize === 'number') {
642
655
  setPageSize(newPageSize);
643
656
  }
644
- staticDataSourceCache.current = dataSorce;
645
657
  };
646
658
  var scrollTableRefCb = function scrollTableRefCb(ref) {
647
659
  if (scrollTableRef.current) {
@@ -474,19 +474,21 @@ function CFTable(_ref2) {
474
474
  return JSON.stringify(simpleColumns);
475
475
  }, [simpleColumns]);
476
476
  (0, _react.useEffect)(function () {
477
- columnWidthMapRef.current = columnWidthMap;
478
- var sum = rowSelectWidth;
479
- var _loopForEach = function loopForEach(arr) {
480
- arr.forEach(function (col) {
481
- if (col.children && col.children.length > 0) {
482
- _loopForEach(col.children);
483
- } else {
484
- sum += columnWidthMap[col.name] || 0;
485
- }
486
- });
487
- };
488
- _loopForEach(columns);
489
- setResizeScrollX(sum);
477
+ if (resizeable) {
478
+ columnWidthMapRef.current = columnWidthMap;
479
+ var sum = rowSelectWidth;
480
+ var _loopForEach = function loopForEach(arr) {
481
+ arr.forEach(function (col) {
482
+ if (col.children && col.children.length > 0) {
483
+ _loopForEach(col.children);
484
+ } else {
485
+ sum += columnWidthMap[col.name] || 0;
486
+ }
487
+ });
488
+ };
489
+ _loopForEach(columns);
490
+ setResizeScrollX(sum);
491
+ }
490
492
  }, [columnWidthMap, rowSelectWidth]);
491
493
  (0, _react.useEffect)(function () {
492
494
  columnConfigWidthMapOld.current = _objectSpread({}, columnConfigWidthMap.current);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "ds-web-all",
4
- "version": "1.0.1-beta.90",
4
+ "version": "1.0.1-beta.92",
5
5
  "scripts": {
6
6
  "start": "cross-env BUILD_ENV=dev && dumi dev",
7
7
  "docs:build": "cross-env BUILD_ENV=production && dumi build",