@zat-design/sisyphus-react 3.6.0-beta.12 → 3.6.0-beta.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.
Files changed (52) hide show
  1. package/dist/index.esm.css +0 -6
  2. package/dist/less.esm.css +0 -6
  3. package/es/ProConfigProvider/index.d.ts +1 -0
  4. package/es/ProConfigProvider/index.js +6 -1
  5. package/es/ProEnum/hooks/useEnumRequest.d.ts +1 -1
  6. package/es/ProEnum/hooks/useEnumRequest.js +113 -113
  7. package/es/ProTooltip/style/index.less +0 -8
  8. package/lib/ProConfigProvider/index.d.ts +1 -0
  9. package/lib/ProConfigProvider/index.js +6 -1
  10. package/lib/ProEnum/hooks/useEnumRequest.d.ts +1 -1
  11. package/lib/ProEnum/hooks/useEnumRequest.js +113 -113
  12. package/lib/ProTooltip/style/index.less +0 -8
  13. package/package.json +1 -1
  14. package/coverage/lcov-report/src/.umi/core/devScripts.ts.html +0 -241
  15. package/coverage/lcov-report/src/.umi/core/history.ts.html +0 -148
  16. package/coverage/lcov-report/src/.umi/core/index.html +0 -206
  17. package/coverage/lcov-report/src/.umi/core/plugin.ts.html +0 -109
  18. package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +0 -160
  19. package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +0 -97
  20. package/coverage/lcov-report/src/.umi/core/routes.ts.html +0 -26050
  21. package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +0 -112
  22. package/coverage/lcov-report/src/.umi/dumi/demos/index.html +0 -116
  23. package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +0 -6340
  24. package/coverage/lcov-report/src/.umi/dumi/index.html +0 -116
  25. package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +0 -109
  26. package/coverage/lcov-report/src/.umi/index.html +0 -116
  27. package/coverage/lcov-report/src/.umi/plugin-antd/index.html +0 -116
  28. package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +0 -172
  29. package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +0 -94
  30. package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +0 -116
  31. package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +0 -196
  32. package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +0 -106
  33. package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +0 -146
  34. package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +0 -116
  35. package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +0 -88
  36. package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +0 -124
  37. package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +0 -1246
  38. package/coverage/lcov-report/src/.umi/plugin-locale/index.html +0 -161
  39. package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +0 -268
  40. package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +0 -778
  41. package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +0 -115
  42. package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +0 -202
  43. package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +0 -97
  44. package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +0 -142
  45. package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +0 -334
  46. package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +0 -146
  47. package/coverage/lcov-report/src/.umi/plugin-model/index.html +0 -146
  48. package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +0 -121
  49. package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +0 -298
  50. package/coverage/lcov-report/src/.umi/plugin-request/index.html +0 -116
  51. package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +0 -919
  52. package/coverage/lcov-report/src/.umi/umi.ts.html +0 -268
@@ -2141,12 +2141,6 @@
2141
2141
  .pro-edit-table-drag table tr th.ant-table-selection-column.ant-table-cell-fix-left {
2142
2142
  text-align: right;
2143
2143
  }
2144
- .ant-table-cell-fix-right {
2145
- z-index: 999 !important;
2146
- }
2147
- .ant-table-cell-fix-left {
2148
- z-index: 999 !important;
2149
- }
2150
2144
  .pro-tooltip {
2151
2145
  cursor: pointer;
2152
2146
  }
package/dist/less.esm.css CHANGED
@@ -2141,12 +2141,6 @@
2141
2141
  .pro-edit-table-drag table tr th.ant-table-selection-column.ant-table-cell-fix-left {
2142
2142
  text-align: right;
2143
2143
  }
2144
- .ant-table-cell-fix-right {
2145
- z-index: 999 !important;
2146
- }
2147
- .ant-table-cell-fix-left {
2148
- z-index: 999 !important;
2149
- }
2150
2144
  .pro-tooltip {
2151
2145
  cursor: pointer;
2152
2146
  }
@@ -29,5 +29,6 @@ interface Actions {
29
29
  export declare const ProConfigProvider: FC<{
30
30
  value?: ProConfigState;
31
31
  locale?: string;
32
+ onSuccess?: (data: any, params: any) => void;
32
33
  }>;
33
34
  export default ProConfigProvider;
@@ -75,7 +75,7 @@ export var ProConfigProvider = function ProConfigProvider(props) {
75
75
  _useReducer2 = _slicedToArray(_useReducer, 2),
76
76
  state = _useReducer2[0],
77
77
  dispatch = _useReducer2[1];
78
- useEnumRequest(_objectSpread(_objectSpread(_objectSpread({}, state.ProEnum), props === null || props === void 0 ? void 0 : (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.ProEnum), props === null || props === void 0 ? void 0 : (_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.globalConfig), dispatch);
78
+ var enumRes = useEnumRequest(_objectSpread(_objectSpread(_objectSpread({}, state.ProEnum), props === null || props === void 0 ? void 0 : (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.ProEnum), props === null || props === void 0 ? void 0 : (_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.globalConfig), dispatch);
79
79
  useEffect(function () {
80
80
  // 本地配置取出
81
81
  var localConfigStr = localStorage.getItem('localConfig');
@@ -93,6 +93,11 @@ export var ProConfigProvider = function ProConfigProvider(props) {
93
93
  // 设置默认语言
94
94
  setLanguage(props === null || props === void 0 ? void 0 : props.locale);
95
95
  }
96
+ useEffect(function () {
97
+ if (enumRes === null || enumRes === void 0 ? void 0 : enumRes.data) {
98
+ (props === null || props === void 0 ? void 0 : props.onSuccess) && (props === null || props === void 0 ? void 0 : props.onSuccess(enumRes === null || enumRes === void 0 ? void 0 : enumRes.data, enumRes === null || enumRes === void 0 ? void 0 : enumRes.params));
99
+ }
100
+ }, [enumRes === null || enumRes === void 0 ? void 0 : enumRes.loading]);
96
101
  return _jsx(ProConfigContext.Provider, {
97
102
  value: {
98
103
  state: merge(state, props.value),
@@ -1,4 +1,4 @@
1
1
  import { ProEnumConfig } from '../propsType';
2
2
  import '../utils/eventCenter';
3
- declare const useEnumRequest: (props: ProEnumConfig, dispatch: any) => void;
3
+ declare const useEnumRequest: (props: ProEnumConfig, dispatch: any) => import("ahooks/lib/useRequest/src/types").Result<any, any>;
4
4
  export default useEnumRequest;
@@ -45,120 +45,119 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
45
45
  console.info('proEnum:', msg);
46
46
  }
47
47
  };
48
- var _useRequestFunc = useRequestFunc(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, _objectSpread(_objectSpread({
49
- manual: true,
50
- cacheKey: cacheKey,
51
- cacheTime: -1,
52
- staleTime: 6e4 * 60
53
- }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
54
- setCache: function () {
55
- var _setCache = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
56
- var response, _locale$ProEnum2, _useRequest$options, ignoreCodes, cacheData;
57
- return _regeneratorRuntime().wrap(function _callee$(_context) {
58
- while (1) switch (_context.prev = _context.next) {
59
- case 0:
60
- response = res.data;
61
- if (!(transformResponse && typeof transformResponse === 'function')) {
62
- _context.next = 10;
63
- break;
64
- }
65
- _context.next = 4;
66
- return transformResponse(res.data);
67
- case 4:
68
- response = _context.sent;
69
- if (!(_typeof(response) !== 'object' || response == null)) {
70
- _context.next = 9;
71
- break;
72
- }
73
- throw new Error(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum2 = locale.ProEnum) === null || _locale$ProEnum2 === void 0 ? void 0 : _locale$ProEnum2.errorMessage);
74
- case 9:
75
- res.data = response;
76
- case 10:
77
- if (!(_typeof(response) !== 'object' || response === null)) {
78
- _context.next = 12;
79
- break;
80
- }
81
- throw Error('response enum data must be object');
82
- case 12:
83
- if (!(Object.keys(response).length === 0)) {
84
- _context.next = 14;
85
- break;
86
- }
87
- throw Error('Please return valid enumeration data');
88
- case 14:
89
- // 只返回fieldNames对象的key
90
- if (clear) {
91
- // 忽略清洗的 codes
92
- ignoreCodes = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : _useRequest$options.ignoreCodes) || [];
93
- Object.keys(response).forEach(function (key) {
94
- var options = _toConsumableArray(response[key]) || [];
95
- if (ignoreCodes.includes(key)) {
96
- response[key] = options;
97
- } else {
98
- response[key] = options.map(function (item) {
99
- return cacheFieldNames(fieldNames, item);
100
- });
101
- }
102
- });
103
- res.data = response;
104
- }
105
- cacheData = getEnumData(storage, cacheKey, baseEnumStorage) || {
106
- data: {}
107
- }; // 合并缓存数据
108
- res.data = _objectSpread(_objectSpread({}, cacheData === null || cacheData === void 0 ? void 0 : cacheData.data), res.data);
109
- setEnumData(storage, cacheKey, res);
110
- // 同步数据到全局
111
- dispatch({
112
- type: 'setProEnumDic',
113
- payload: _objectSpread(_objectSpread(_objectSpread({}, dics), dataSource), res.data)
48
+ var enumRes = useRequestFunc(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, _objectSpread(_objectSpread({
49
+ manual: true,
50
+ cacheKey: cacheKey,
51
+ cacheTime: -1,
52
+ staleTime: 6e4 * 60
53
+ }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
54
+ setCache: function () {
55
+ var _setCache = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(res) {
56
+ var response, _locale$ProEnum2, _useRequest$options, ignoreCodes, cacheData;
57
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
58
+ while (1) switch (_context.prev = _context.next) {
59
+ case 0:
60
+ response = res.data;
61
+ if (!(transformResponse && typeof transformResponse === 'function')) {
62
+ _context.next = 10;
63
+ break;
64
+ }
65
+ _context.next = 4;
66
+ return transformResponse(res.data);
67
+ case 4:
68
+ response = _context.sent;
69
+ if (!(_typeof(response) !== 'object' || response == null)) {
70
+ _context.next = 9;
71
+ break;
72
+ }
73
+ throw new Error(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum2 = locale.ProEnum) === null || _locale$ProEnum2 === void 0 ? void 0 : _locale$ProEnum2.errorMessage);
74
+ case 9:
75
+ res.data = response;
76
+ case 10:
77
+ if (!(_typeof(response) !== 'object' || response === null)) {
78
+ _context.next = 12;
79
+ break;
80
+ }
81
+ throw Error('response enum data must be object');
82
+ case 12:
83
+ if (!(Object.keys(response).length === 0)) {
84
+ _context.next = 14;
85
+ break;
86
+ }
87
+ throw Error('Please return valid enumeration data');
88
+ case 14:
89
+ // 只返回fieldNames对象的key
90
+ if (clear) {
91
+ // 忽略清洗的 codes
92
+ ignoreCodes = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : _useRequest$options.ignoreCodes) || [];
93
+ Object.keys(response).forEach(function (key) {
94
+ var options = _toConsumableArray(response[key]) || [];
95
+ if (ignoreCodes.includes(key)) {
96
+ response[key] = options;
97
+ } else {
98
+ response[key] = options.map(function (item) {
99
+ return cacheFieldNames(fieldNames, item);
100
+ });
101
+ }
114
102
  });
115
- if (main) {
116
- setTimeout(function () {
117
- var _locale$ProEnum3;
118
- window.eventCenter.publish('zat-design-pro-component-event', res.data);
119
- logDebug(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum3 = locale.ProEnum) === null || _locale$ProEnum3 === void 0 ? void 0 : _locale$ProEnum3.mainInitByRequest);
120
- }, 10000);
121
- }
122
- return _context.abrupt("return", res);
123
- case 21:
124
- case "end":
125
- return _context.stop();
126
- }
127
- }, _callee);
128
- }));
129
- function setCache(_x) {
130
- return _setCache.apply(this, arguments);
131
- }
132
- return setCache;
133
- }(),
134
- getCache: function getCache() {
135
- var res = getEnumData(storage, cacheKey, baseEnumStorage) || {
136
- data: {}
137
- };
138
- dispatch({
139
- type: 'setProEnumDic',
140
- payload: _objectSpread(_objectSpread(_objectSpread({}, dics), dataSource), res === null || res === void 0 ? void 0 : res.data)
141
- });
142
- if (main) {
143
- setTimeout(function () {
144
- var _locale$ProEnum4;
145
- window.eventCenter.publish('zat-design-pro-component-event', res.data);
146
- logDebug(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum4 = locale.ProEnum) === null || _locale$ProEnum4 === void 0 ? void 0 : _locale$ProEnum4.mainInitByCache);
147
- }, 10000);
148
- }
149
- return res;
150
- },
151
- onSuccess: function onSuccess(res) {
152
- var _res$status = res.status,
153
- status = _res$status === void 0 ? 200 : _res$status,
154
- msg = res.message;
155
- if (status !== 200) {
156
- var _locale$ProEnum5;
157
- throw new Error(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum5 = locale.ProEnum) === null || _locale$ProEnum5 === void 0 ? void 0 : _locale$ProEnum5.requestError);
158
- }
103
+ res.data = response;
104
+ }
105
+ cacheData = getEnumData(storage, cacheKey, baseEnumStorage) || {
106
+ data: {}
107
+ }; // 合并缓存数据
108
+ res.data = _objectSpread(_objectSpread({}, cacheData === null || cacheData === void 0 ? void 0 : cacheData.data), res.data);
109
+ setEnumData(storage, cacheKey, res);
110
+ // 同步数据到全局
111
+ dispatch({
112
+ type: 'setProEnumDic',
113
+ payload: _objectSpread(_objectSpread(_objectSpread({}, dics), dataSource), res.data)
114
+ });
115
+ if (main) {
116
+ setTimeout(function () {
117
+ var _locale$ProEnum3;
118
+ window.eventCenter.publish('zat-design-pro-component-event', res.data);
119
+ logDebug(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum3 = locale.ProEnum) === null || _locale$ProEnum3 === void 0 ? void 0 : _locale$ProEnum3.mainInitByRequest);
120
+ }, 10000);
121
+ }
122
+ return _context.abrupt("return", res);
123
+ case 21:
124
+ case "end":
125
+ return _context.stop();
126
+ }
127
+ }, _callee);
128
+ }));
129
+ function setCache(_x) {
130
+ return _setCache.apply(this, arguments);
159
131
  }
160
- })),
161
- run = _useRequestFunc.run;
132
+ return setCache;
133
+ }(),
134
+ getCache: function getCache() {
135
+ var res = getEnumData(storage, cacheKey, baseEnumStorage) || {
136
+ data: {}
137
+ };
138
+ dispatch({
139
+ type: 'setProEnumDic',
140
+ payload: _objectSpread(_objectSpread(_objectSpread({}, dics), dataSource), res === null || res === void 0 ? void 0 : res.data)
141
+ });
142
+ if (main) {
143
+ setTimeout(function () {
144
+ var _locale$ProEnum4;
145
+ window.eventCenter.publish('zat-design-pro-component-event', res.data);
146
+ logDebug(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum4 = locale.ProEnum) === null || _locale$ProEnum4 === void 0 ? void 0 : _locale$ProEnum4.mainInitByCache);
147
+ }, 10000);
148
+ }
149
+ return res;
150
+ },
151
+ onSuccess: function onSuccess(res) {
152
+ var _res$status = res.status,
153
+ status = _res$status === void 0 ? 200 : _res$status,
154
+ msg = res.message;
155
+ if (status !== 200) {
156
+ var _locale$ProEnum5;
157
+ throw new Error(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum5 = locale.ProEnum) === null || _locale$ProEnum5 === void 0 ? void 0 : _locale$ProEnum5.requestError);
158
+ }
159
+ }
160
+ }));
162
161
  var mergeData = /*#__PURE__*/function () {
163
162
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
164
163
  var cacheData, _useRequest$options2, _useRequest$options3, enumData, cacheCodes, codes, ignoreCodes, diff, response, res, _locale$ProEnum6;
@@ -258,7 +257,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
258
257
  window.localStorage.removeItem(cacheKey);
259
258
  window.sessionStorage.removeItem(cacheKey);
260
259
  }
261
- run(defaultParams);
260
+ enumRes.run(defaultParams);
262
261
  // TODO 这段代码目前看起来是没啥用的、没起到作用
263
262
  mergeData();
264
263
  } else if (Object.keys(dataSource)) {
@@ -304,5 +303,6 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
304
303
  window.eventCenter.unsubscribe('zat-design-pro-component-event', shareProEnumDic);
305
304
  };
306
305
  }, []);
306
+ return enumRes;
307
307
  };
308
308
  export default useEnumRequest;
@@ -1,14 +1,6 @@
1
1
  @root-entry-name: 'default';
2
2
  @import (reference) '~antd/es/style/themes/index.less';
3
3
 
4
- .@{ant-prefix}-table-cell-fix-right {
5
- z-index: 999 !important;
6
- }
7
-
8
- .@{ant-prefix}-table-cell-fix-left {
9
- z-index: 999 !important;
10
- }
11
-
12
4
  .pro-tooltip {
13
5
  cursor: pointer;
14
6
 
@@ -29,5 +29,6 @@ interface Actions {
29
29
  export declare const ProConfigProvider: FC<{
30
30
  value?: ProConfigState;
31
31
  locale?: string;
32
+ onSuccess?: (data: any, params: any) => void;
32
33
  }>;
33
34
  export default ProConfigProvider;
@@ -84,7 +84,7 @@ var ProConfigProvider = exports.ProConfigProvider = function ProConfigProvider(p
84
84
  _useReducer2 = (0, _slicedToArray2.default)(_useReducer, 2),
85
85
  state = _useReducer2[0],
86
86
  dispatch = _useReducer2[1];
87
- (0, _useEnumRequest.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, state.ProEnum), props === null || props === void 0 ? void 0 : (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.ProEnum), props === null || props === void 0 ? void 0 : (_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.globalConfig), dispatch);
87
+ var enumRes = (0, _useEnumRequest.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, state.ProEnum), props === null || props === void 0 ? void 0 : (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.ProEnum), props === null || props === void 0 ? void 0 : (_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.globalConfig), dispatch);
88
88
  (0, _react.useEffect)(function () {
89
89
  // 本地配置取出
90
90
  var localConfigStr = localStorage.getItem('localConfig');
@@ -102,6 +102,11 @@ var ProConfigProvider = exports.ProConfigProvider = function ProConfigProvider(p
102
102
  // 设置默认语言
103
103
  (0, _locale.setLanguage)(props === null || props === void 0 ? void 0 : props.locale);
104
104
  }
105
+ (0, _react.useEffect)(function () {
106
+ if (enumRes === null || enumRes === void 0 ? void 0 : enumRes.data) {
107
+ (props === null || props === void 0 ? void 0 : props.onSuccess) && (props === null || props === void 0 ? void 0 : props.onSuccess(enumRes === null || enumRes === void 0 ? void 0 : enumRes.data, enumRes === null || enumRes === void 0 ? void 0 : enumRes.params));
108
+ }
109
+ }, [enumRes === null || enumRes === void 0 ? void 0 : enumRes.loading]);
105
110
  return (0, _jsxRuntime.jsx)(ProConfigContext.Provider, {
106
111
  value: {
107
112
  state: (0, _merge.default)(state, props.value),
@@ -1,4 +1,4 @@
1
1
  import { ProEnumConfig } from '../propsType';
2
2
  import '../utils/eventCenter';
3
- declare const useEnumRequest: (props: ProEnumConfig, dispatch: any) => void;
3
+ declare const useEnumRequest: (props: ProEnumConfig, dispatch: any) => import("ahooks/lib/useRequest/src/types").Result<any, any>;
4
4
  export default useEnumRequest;
@@ -52,120 +52,119 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
52
52
  console.info('proEnum:', msg);
53
53
  }
54
54
  };
55
- var _useRequestFunc = (0, _ahooks.useRequest)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, (0, _objectSpread2.default)((0, _objectSpread2.default)({
56
- manual: true,
57
- cacheKey: cacheKey,
58
- cacheTime: -1,
59
- staleTime: 6e4 * 60
60
- }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
61
- setCache: function () {
62
- var _setCache = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(res) {
63
- var response, _locale$ProEnum2, _useRequest$options, ignoreCodes, cacheData;
64
- return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
65
- while (1) switch (_context.prev = _context.next) {
66
- case 0:
67
- response = res.data;
68
- if (!(transformResponse && typeof transformResponse === 'function')) {
69
- _context.next = 10;
70
- break;
71
- }
72
- _context.next = 4;
73
- return transformResponse(res.data);
74
- case 4:
75
- response = _context.sent;
76
- if (!((0, _typeof2.default)(response) !== 'object' || response == null)) {
77
- _context.next = 9;
78
- break;
79
- }
80
- throw new Error(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProEnum2 = _locale.default.ProEnum) === null || _locale$ProEnum2 === void 0 ? void 0 : _locale$ProEnum2.errorMessage);
81
- case 9:
82
- res.data = response;
83
- case 10:
84
- if (!((0, _typeof2.default)(response) !== 'object' || response === null)) {
85
- _context.next = 12;
86
- break;
87
- }
88
- throw Error('response enum data must be object');
89
- case 12:
90
- if (!(Object.keys(response).length === 0)) {
91
- _context.next = 14;
92
- break;
93
- }
94
- throw Error('Please return valid enumeration data');
95
- case 14:
96
- // 只返回fieldNames对象的key
97
- if (clear) {
98
- // 忽略清洗的 codes
99
- ignoreCodes = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : _useRequest$options.ignoreCodes) || [];
100
- Object.keys(response).forEach(function (key) {
101
- var options = (0, _toConsumableArray2.default)(response[key]) || [];
102
- if (ignoreCodes.includes(key)) {
103
- response[key] = options;
104
- } else {
105
- response[key] = options.map(function (item) {
106
- return (0, _utils.cacheFieldNames)(fieldNames, item);
107
- });
108
- }
109
- });
110
- res.data = response;
111
- }
112
- cacheData = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage) || {
113
- data: {}
114
- }; // 合并缓存数据
115
- res.data = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, cacheData === null || cacheData === void 0 ? void 0 : cacheData.data), res.data);
116
- (0, _utils.setEnumData)(storage, cacheKey, res);
117
- // 同步数据到全局
118
- dispatch({
119
- type: 'setProEnumDic',
120
- payload: (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, dics), dataSource), res.data)
55
+ var enumRes = (0, _ahooks.useRequest)(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, (0, _objectSpread2.default)((0, _objectSpread2.default)({
56
+ manual: true,
57
+ cacheKey: cacheKey,
58
+ cacheTime: -1,
59
+ staleTime: 6e4 * 60
60
+ }, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
61
+ setCache: function () {
62
+ var _setCache = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(res) {
63
+ var response, _locale$ProEnum2, _useRequest$options, ignoreCodes, cacheData;
64
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
65
+ while (1) switch (_context.prev = _context.next) {
66
+ case 0:
67
+ response = res.data;
68
+ if (!(transformResponse && typeof transformResponse === 'function')) {
69
+ _context.next = 10;
70
+ break;
71
+ }
72
+ _context.next = 4;
73
+ return transformResponse(res.data);
74
+ case 4:
75
+ response = _context.sent;
76
+ if (!((0, _typeof2.default)(response) !== 'object' || response == null)) {
77
+ _context.next = 9;
78
+ break;
79
+ }
80
+ throw new Error(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProEnum2 = _locale.default.ProEnum) === null || _locale$ProEnum2 === void 0 ? void 0 : _locale$ProEnum2.errorMessage);
81
+ case 9:
82
+ res.data = response;
83
+ case 10:
84
+ if (!((0, _typeof2.default)(response) !== 'object' || response === null)) {
85
+ _context.next = 12;
86
+ break;
87
+ }
88
+ throw Error('response enum data must be object');
89
+ case 12:
90
+ if (!(Object.keys(response).length === 0)) {
91
+ _context.next = 14;
92
+ break;
93
+ }
94
+ throw Error('Please return valid enumeration data');
95
+ case 14:
96
+ // 只返回fieldNames对象的key
97
+ if (clear) {
98
+ // 忽略清洗的 codes
99
+ ignoreCodes = (useRequest === null || useRequest === void 0 ? void 0 : (_useRequest$options = useRequest.options) === null || _useRequest$options === void 0 ? void 0 : _useRequest$options.ignoreCodes) || [];
100
+ Object.keys(response).forEach(function (key) {
101
+ var options = (0, _toConsumableArray2.default)(response[key]) || [];
102
+ if (ignoreCodes.includes(key)) {
103
+ response[key] = options;
104
+ } else {
105
+ response[key] = options.map(function (item) {
106
+ return (0, _utils.cacheFieldNames)(fieldNames, item);
107
+ });
108
+ }
121
109
  });
122
- if (main) {
123
- setTimeout(function () {
124
- var _locale$ProEnum3;
125
- window.eventCenter.publish('zat-design-pro-component-event', res.data);
126
- logDebug(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProEnum3 = _locale.default.ProEnum) === null || _locale$ProEnum3 === void 0 ? void 0 : _locale$ProEnum3.mainInitByRequest);
127
- }, 10000);
128
- }
129
- return _context.abrupt("return", res);
130
- case 21:
131
- case "end":
132
- return _context.stop();
133
- }
134
- }, _callee);
135
- }));
136
- function setCache(_x) {
137
- return _setCache.apply(this, arguments);
138
- }
139
- return setCache;
140
- }(),
141
- getCache: function getCache() {
142
- var res = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage) || {
143
- data: {}
144
- };
145
- dispatch({
146
- type: 'setProEnumDic',
147
- payload: (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, dics), dataSource), res === null || res === void 0 ? void 0 : res.data)
148
- });
149
- if (main) {
150
- setTimeout(function () {
151
- var _locale$ProEnum4;
152
- window.eventCenter.publish('zat-design-pro-component-event', res.data);
153
- logDebug(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProEnum4 = _locale.default.ProEnum) === null || _locale$ProEnum4 === void 0 ? void 0 : _locale$ProEnum4.mainInitByCache);
154
- }, 10000);
155
- }
156
- return res;
157
- },
158
- onSuccess: function onSuccess(res) {
159
- var _res$status = res.status,
160
- status = _res$status === void 0 ? 200 : _res$status,
161
- msg = res.message;
162
- if (status !== 200) {
163
- var _locale$ProEnum5;
164
- throw new Error(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProEnum5 = _locale.default.ProEnum) === null || _locale$ProEnum5 === void 0 ? void 0 : _locale$ProEnum5.requestError);
165
- }
110
+ res.data = response;
111
+ }
112
+ cacheData = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage) || {
113
+ data: {}
114
+ }; // 合并缓存数据
115
+ res.data = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, cacheData === null || cacheData === void 0 ? void 0 : cacheData.data), res.data);
116
+ (0, _utils.setEnumData)(storage, cacheKey, res);
117
+ // 同步数据到全局
118
+ dispatch({
119
+ type: 'setProEnumDic',
120
+ payload: (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, dics), dataSource), res.data)
121
+ });
122
+ if (main) {
123
+ setTimeout(function () {
124
+ var _locale$ProEnum3;
125
+ window.eventCenter.publish('zat-design-pro-component-event', res.data);
126
+ logDebug(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProEnum3 = _locale.default.ProEnum) === null || _locale$ProEnum3 === void 0 ? void 0 : _locale$ProEnum3.mainInitByRequest);
127
+ }, 10000);
128
+ }
129
+ return _context.abrupt("return", res);
130
+ case 21:
131
+ case "end":
132
+ return _context.stop();
133
+ }
134
+ }, _callee);
135
+ }));
136
+ function setCache(_x) {
137
+ return _setCache.apply(this, arguments);
166
138
  }
167
- })),
168
- run = _useRequestFunc.run;
139
+ return setCache;
140
+ }(),
141
+ getCache: function getCache() {
142
+ var res = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage) || {
143
+ data: {}
144
+ };
145
+ dispatch({
146
+ type: 'setProEnumDic',
147
+ payload: (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, dics), dataSource), res === null || res === void 0 ? void 0 : res.data)
148
+ });
149
+ if (main) {
150
+ setTimeout(function () {
151
+ var _locale$ProEnum4;
152
+ window.eventCenter.publish('zat-design-pro-component-event', res.data);
153
+ logDebug(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProEnum4 = _locale.default.ProEnum) === null || _locale$ProEnum4 === void 0 ? void 0 : _locale$ProEnum4.mainInitByCache);
154
+ }, 10000);
155
+ }
156
+ return res;
157
+ },
158
+ onSuccess: function onSuccess(res) {
159
+ var _res$status = res.status,
160
+ status = _res$status === void 0 ? 200 : _res$status,
161
+ msg = res.message;
162
+ if (status !== 200) {
163
+ var _locale$ProEnum5;
164
+ throw new Error(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProEnum5 = _locale.default.ProEnum) === null || _locale$ProEnum5 === void 0 ? void 0 : _locale$ProEnum5.requestError);
165
+ }
166
+ }
167
+ }));
169
168
  var mergeData = /*#__PURE__*/function () {
170
169
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
171
170
  var cacheData, _useRequest$options2, _useRequest$options3, enumData, cacheCodes, codes, ignoreCodes, diff, response, res, _locale$ProEnum6;
@@ -265,7 +264,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
265
264
  window.localStorage.removeItem(cacheKey);
266
265
  window.sessionStorage.removeItem(cacheKey);
267
266
  }
268
- run(defaultParams);
267
+ enumRes.run(defaultParams);
269
268
  // TODO 这段代码目前看起来是没啥用的、没起到作用
270
269
  mergeData();
271
270
  } else if (Object.keys(dataSource)) {
@@ -311,5 +310,6 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
311
310
  window.eventCenter.unsubscribe('zat-design-pro-component-event', shareProEnumDic);
312
311
  };
313
312
  }, []);
313
+ return enumRes;
314
314
  };
315
315
  var _default = exports.default = useEnumRequest;
@@ -1,14 +1,6 @@
1
1
  @root-entry-name: 'default';
2
2
  @import (reference) '~antd/es/style/themes/index.less';
3
3
 
4
- .@{ant-prefix}-table-cell-fix-right {
5
- z-index: 999 !important;
6
- }
7
-
8
- .@{ant-prefix}-table-cell-fix-left {
9
- z-index: 999 !important;
10
- }
11
-
12
4
  .pro-tooltip {
13
5
  cursor: pointer;
14
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.6.0-beta.12",
3
+ "version": "3.6.0-beta.14",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",