@zat-design/sisyphus-react 3.4.11-beta.12 → 3.4.11-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.
@@ -1,6 +1,8 @@
1
+ var _ref;
1
2
  /* eslint-disable no-redeclare */
2
3
  import { useProConfig } from '../../ProConfigProvider';
3
4
  import { getEnumData } from '../utils';
5
+ var baseEnumStorage = (_ref = window.localStorage.getItem('zat-design-pro-component-cacheKey') && JSON.parse(window.localStorage.getItem('zat-design-pro-component-cacheKey'))) !== null && _ref !== void 0 ? _ref : null;
4
6
  /**
5
7
  * 根据 code 从枚举缓存取出对应的 options 、以及回显
6
8
  * @param codes
@@ -9,17 +11,17 @@ import { getEnumData } from '../utils';
9
11
  * @returns
10
12
  */
11
13
  function useEnum(codes, value, compose) {
12
- var _ref = useProConfig('globalConfig') || {},
13
- _ref$storage = _ref.storage,
14
- storage = _ref$storage === void 0 ? 'localStorage' : _ref$storage;
15
- var _ref2 = useProConfig('ProEnum') || {},
16
- _ref2$cacheKey = _ref2.cacheKey,
17
- cacheKey = _ref2$cacheKey === void 0 ? 'zat-design-pro-component-cacheKey' : _ref2$cacheKey,
18
- _ref2$fieldNames = _ref2.fieldNames,
19
- fieldNames = _ref2$fieldNames === void 0 ? {} : _ref2$fieldNames,
20
- _ref2$clear = _ref2.clear,
21
- clear = _ref2$clear === void 0 ? true : _ref2$clear;
22
- var catchData = getEnumData(storage, cacheKey);
14
+ var _ref2 = useProConfig('globalConfig') || {},
15
+ _ref2$storage = _ref2.storage,
16
+ storage = _ref2$storage === void 0 ? 'localStorage' : _ref2$storage;
17
+ var _ref3 = useProConfig('ProEnum') || {},
18
+ _ref3$cacheKey = _ref3.cacheKey,
19
+ cacheKey = _ref3$cacheKey === void 0 ? 'zat-design-pro-component-cacheKey' : _ref3$cacheKey,
20
+ _ref3$fieldNames = _ref3.fieldNames,
21
+ fieldNames = _ref3$fieldNames === void 0 ? {} : _ref3$fieldNames,
22
+ _ref3$clear = _ref3.clear,
23
+ clear = _ref3$clear === void 0 ? true : _ref3$clear;
24
+ var catchData = getEnumData(storage, cacheKey, baseEnumStorage);
23
25
  if (!codes) {
24
26
  return catchData;
25
27
  }
@@ -3,37 +3,39 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
3
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
4
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
5
5
  import _typeof from "@babel/runtime/helpers/esm/typeof";
6
+ var _ref;
6
7
  import { useEffect } from 'react';
7
8
  import { useDeepCompareEffect, useRequest as useRequestFunc } from 'ahooks';
8
9
  import { diffCode, getEnumData, setEnumData, cacheFieldNames } from '../utils';
9
10
  import locale from '../../locale';
10
11
  import '../utils/eventCenter';
12
+ var baseEnumStorage = (_ref = window.localStorage.getItem('zat-design-pro-component-cacheKey') && JSON.parse(window.localStorage.getItem('zat-design-pro-component-cacheKey'))) !== null && _ref !== void 0 ? _ref : null;
11
13
  var useEnumRequest = function useEnumRequest(props, dispatch) {
12
- var _ref = props || {},
13
- _ref$main = _ref.main,
14
- main = _ref$main === void 0 ? false : _ref$main,
15
- _ref$share = _ref.share,
16
- share = _ref$share === void 0 ? false : _ref$share,
17
- _ref$clear = _ref.clear,
18
- clear = _ref$clear === void 0 ? true : _ref$clear,
19
- _ref$fieldNames = _ref.fieldNames,
20
- fieldNames = _ref$fieldNames === void 0 ? {
14
+ var _ref2 = props || {},
15
+ _ref2$main = _ref2.main,
16
+ main = _ref2$main === void 0 ? false : _ref2$main,
17
+ _ref2$share = _ref2.share,
18
+ share = _ref2$share === void 0 ? false : _ref2$share,
19
+ _ref2$clear = _ref2.clear,
20
+ clear = _ref2$clear === void 0 ? true : _ref2$clear,
21
+ _ref2$fieldNames = _ref2.fieldNames,
22
+ fieldNames = _ref2$fieldNames === void 0 ? {
21
23
  label: 'label',
22
24
  value: 'value',
23
25
  children: 'children'
24
- } : _ref$fieldNames,
25
- _ref$cacheKey = _ref.cacheKey,
26
- cacheKey = _ref$cacheKey === void 0 ? 'zat-design-pro-component-cacheKey' : _ref$cacheKey,
27
- _ref$requestRefresh = _ref.requestRefresh,
28
- requestRefresh = _ref$requestRefresh === void 0 ? false : _ref$requestRefresh,
29
- _ref$storage = _ref.storage,
30
- storage = _ref$storage === void 0 ? 'localStorage' : _ref$storage,
31
- _ref$dataSource = _ref.dataSource,
32
- dataSource = _ref$dataSource === void 0 ? {} : _ref$dataSource,
33
- useRequest = _ref.useRequest,
34
- transformResponse = _ref.transformResponse,
35
- _ref$dics = _ref.dics,
36
- dics = _ref$dics === void 0 ? {} : _ref$dics;
26
+ } : _ref2$fieldNames,
27
+ _ref2$cacheKey = _ref2.cacheKey,
28
+ cacheKey = _ref2$cacheKey === void 0 ? 'zat-design-pro-component-cacheKey' : _ref2$cacheKey,
29
+ _ref2$requestRefresh = _ref2.requestRefresh,
30
+ requestRefresh = _ref2$requestRefresh === void 0 ? false : _ref2$requestRefresh,
31
+ _ref2$storage = _ref2.storage,
32
+ storage = _ref2$storage === void 0 ? 'localStorage' : _ref2$storage,
33
+ _ref2$dataSource = _ref2.dataSource,
34
+ dataSource = _ref2$dataSource === void 0 ? {} : _ref2$dataSource,
35
+ useRequest = _ref2.useRequest,
36
+ transformResponse = _ref2.transformResponse,
37
+ _ref2$dics = _ref2.dics,
38
+ dics = _ref2$dics === void 0 ? {} : _ref2$dics;
37
39
  if (_typeof(dataSource) === 'object' && dataSource === null) {
38
40
  var _locale$ProEnum;
39
41
  throw new Error(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum = locale.ProEnum) === null || _locale$ProEnum === void 0 ? void 0 : _locale$ProEnum.errorDataSource);
@@ -100,7 +102,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
100
102
  });
101
103
  res.data = response;
102
104
  }
103
- cacheData = getEnumData(storage, cacheKey) || {
105
+ cacheData = getEnumData(storage, cacheKey, baseEnumStorage) || {
104
106
  data: {}
105
107
  }; // 合并缓存数据
106
108
  res.data = _objectSpread(_objectSpread({}, cacheData === null || cacheData === void 0 ? void 0 : cacheData.data), res.data);
@@ -130,7 +132,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
130
132
  return setCache;
131
133
  }(),
132
134
  getCache: function getCache() {
133
- var res = getEnumData(storage, cacheKey) || {
135
+ var res = getEnumData(storage, cacheKey, baseEnumStorage) || {
134
136
  data: {}
135
137
  };
136
138
  dispatch({
@@ -158,12 +160,12 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
158
160
  })),
159
161
  run = _useRequestFunc.run;
160
162
  var mergeData = /*#__PURE__*/function () {
161
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
163
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
162
164
  var cacheData, _useRequest$options2, _useRequest$options3, enumData, cacheCodes, codes, ignoreCodes, diff, response, res, _locale$ProEnum6;
163
165
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
164
166
  while (1) switch (_context2.prev = _context2.next) {
165
167
  case 0:
166
- cacheData = getEnumData(storage, cacheKey) || {
168
+ cacheData = getEnumData(storage, cacheKey, baseEnumStorage) || {
167
169
  data: {}
168
170
  };
169
171
  if (!(_typeof(cacheData) === 'object')) {
@@ -245,13 +247,13 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
245
247
  }, _callee2);
246
248
  }));
247
249
  return function mergeData() {
248
- return _ref2.apply(this, arguments);
250
+ return _ref3.apply(this, arguments);
249
251
  };
250
252
  }();
251
253
  useDeepCompareEffect(function () {
252
254
  if (useRequest && (useRequest === null || useRequest === void 0 ? void 0 : useRequest.service)) {
253
- var _ref3 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
254
- defaultParams = _ref3.defaultParams;
255
+ var _ref4 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
256
+ defaultParams = _ref4.defaultParams;
255
257
  if (requestRefresh) {
256
258
  window.localStorage.removeItem(cacheKey);
257
259
  window.sessionStorage.removeItem(cacheKey);
@@ -260,7 +262,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
260
262
  // TODO 这段代码目前看起来是没啥用的、没起到作用
261
263
  mergeData();
262
264
  } else if (Object.keys(dataSource)) {
263
- var res = getEnumData(storage, cacheKey) || {
265
+ var res = getEnumData(storage, cacheKey, baseEnumStorage) || {
264
266
  data: {}
265
267
  };
266
268
  dispatch({
@@ -268,7 +270,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
268
270
  payload: _objectSpread(_objectSpread({}, dataSource), res === null || res === void 0 ? void 0 : res.data)
269
271
  });
270
272
  } else {
271
- var _res = getEnumData(storage, cacheKey) || {
273
+ var _res = getEnumData(storage, cacheKey, baseEnumStorage) || {
272
274
  data: {}
273
275
  };
274
276
  dispatch({
@@ -279,7 +281,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
279
281
  }, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options]);
280
282
  var shareProEnumDic = function shareProEnumDic(cacheData) {
281
283
  logDebug(cacheData);
282
- var storageData = getEnumData(storage, cacheKey) || {
284
+ var storageData = getEnumData(storage, cacheKey, baseEnumStorage) || {
283
285
  data: {}
284
286
  };
285
287
  dispatch({
@@ -166,7 +166,7 @@ var ProEnum = function ProEnum(props) {
166
166
  }
167
167
  switch (type) {
168
168
  case 'ProSelect':
169
- return _jsx(ProSelect, _objectSpread(_objectSpread({}, enumProps), {}, {
169
+ return _jsx(ProSelect, _objectSpread(_objectSpread({}, omit(enumProps, ['showCodeName'])), {}, {
170
170
  otherProps: otherProps,
171
171
  dataSource: list,
172
172
  fieldNames: {
@@ -177,7 +177,7 @@ var ProEnum = function ProEnum(props) {
177
177
  onChange: onChange
178
178
  }));
179
179
  case 'Radio':
180
- return _jsx(_Radio.Group, _objectSpread(_objectSpread({}, omit(enumProps, ['fieldNames'])), {}, {
180
+ return _jsx(_Radio.Group, _objectSpread(_objectSpread({}, omit(enumProps, ['fieldNames', 'showCodeName'])), {}, {
181
181
  options: list,
182
182
  value: value,
183
183
  onChange: onChange,
@@ -190,7 +190,7 @@ var ProEnum = function ProEnum(props) {
190
190
  })
191
191
  }));
192
192
  case 'Checkbox':
193
- return _jsx(_Checkbox.Group, _objectSpread(_objectSpread({}, omit(enumProps, ['fieldNames'])), {}, {
193
+ return _jsx(_Checkbox.Group, _objectSpread(_objectSpread({}, omit(enumProps, ['fieldNames', 'showCodeName'])), {}, {
194
194
  options: list,
195
195
  value: value,
196
196
  onChange: onChange,
@@ -211,7 +211,7 @@ var ProEnum = function ProEnum(props) {
211
211
  dataSource: list
212
212
  });
213
213
  case 'Group':
214
- return _jsx(ProEnumGroup, _objectSpread(_objectSpread({}, enumProps), {}, {
214
+ return _jsx(ProEnumGroup, _objectSpread(_objectSpread({}, omit(enumProps, ['showCodeName'])), {}, {
215
215
  value: value,
216
216
  onChange: onChange,
217
217
  fieldLabel: label,
@@ -4,7 +4,7 @@ interface EnumRes {
4
4
  data: Record<string, DataOption[]>;
5
5
  [key: string]: any;
6
6
  }
7
- export declare function getEnumData(storage: StorageType, cacheKey: string): EnumRes;
7
+ export declare function getEnumData(storage: StorageType, cacheKey: string, baseEnumStorage?: any): EnumRes;
8
8
  export declare function setEnumData(storage: StorageType, cacheKey: string, data: Object): void;
9
9
  export declare function hasEnumList(storage: StorageType, cacheKey: any, code: string): DataOption[];
10
10
  export declare function isObject(obj: any): boolean;
@@ -1,7 +1,10 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  var _excluded = ["children"];
3
3
  import { isNull, isUndefined } from 'lodash';
4
- export function getEnumData(storage, cacheKey) {
4
+ export function getEnumData(storage, cacheKey, baseEnumStorage) {
5
+ if (baseEnumStorage) {
6
+ return baseEnumStorage;
7
+ }
5
8
  if (storage === 'localStorage') {
6
9
  return JSON.parse(window.localStorage.getItem(cacheKey) || '{}');
7
10
  }
@@ -49,12 +49,12 @@ var getViewLabel = function getViewLabel(_ref) {
49
49
  return viewLabel;
50
50
  };
51
51
  var ProCascader = function ProCascader(props) {
52
- var _value$slice, _ref7, _ref7$filter, _defaultLabel$filter, _locale$ProAddressBar, _locale$ProAddressBar2;
52
+ var _props$otherProps, _value$slice, _ref7, _ref7$filter, _defaultLabel$filter, _locale$ProAddressBar, _locale$ProAddressBar2;
53
53
  var _ref2 = useProConfig('ProAddressBar') || {},
54
54
  configDetailMaxLength = _ref2.detailMaxLength,
55
55
  configEnumCode = _ref2.enumCode,
56
56
  configCode = _ref2.code;
57
- var isAddressMode = (props === null || props === void 0 ? void 0 : props.mode) === 'address';
57
+ var isAddressMode = (props === null || props === void 0 ? void 0 : props.mode) === 'address' || (props === null || props === void 0 ? void 0 : (_props$otherProps = props.otherProps) === null || _props$otherProps === void 0 ? void 0 : _props$otherProps.type) === 'ProAddressBar';
58
58
  var _props$className = props.className,
59
59
  className = _props$className === void 0 ? '' : _props$className,
60
60
  _props$hasDetail = props.hasDetail,
@@ -12,6 +12,7 @@ export { default as TimePicker } from './base/TimePicker';
12
12
  export { default as FormList } from './combination/FormList';
13
13
  export { default as ProEditTable } from '../../ProEditTable';
14
14
  export { default as ProCascader } from './combination/ProCascader';
15
+ export { default as ProAddressBar } from './combination/ProCascader';
15
16
  export { default as ProCombination } from './combination/ProCombination';
16
17
  export { default as ProNumberRange } from './combination/ProNumberRange';
17
18
  export { default as ProModalSelect } from './combination/ProModalSelect';
@@ -14,6 +14,7 @@ export { default as FormList } from './combination/FormList';
14
14
  export { default as ProEditTable } from '../../ProEditTable';
15
15
  // combination 组合组件
16
16
  export { default as ProCascader } from './combination/ProCascader';
17
+ export { default as ProAddressBar } from './combination/ProCascader';
17
18
  export { default as ProCombination } from './combination/ProCombination';
18
19
  export { default as ProNumberRange } from './combination/ProNumberRange';
19
20
  export { default as ProModalSelect } from './combination/ProModalSelect';
@@ -276,7 +276,7 @@ var Render = function Render(props) {
276
276
  }, 60);
277
277
  }
278
278
  // ProTreeSelect返回option
279
- if (['ProTree'].includes(type)) {
279
+ if (['ProTree'].includes(type) && !_args[2].option) {
280
280
  var _args2, _args2$;
281
281
  _args[2].option = findOptionByValue(lastComponentProps === null || lastComponentProps === void 0 ? void 0 : lastComponentProps.dataSource, (_args2 = _args) === null || _args2 === void 0 ? void 0 : (_args2$ = _args2[0]) === null || _args2$ === void 0 ? void 0 : _args2$[0], (lastComponentProps === null || lastComponentProps === void 0 ? void 0 : lastComponentProps.fieldNames) || {});
282
282
  }
@@ -257,12 +257,15 @@ var ProTree = function ProTree(props) {
257
257
  onChange && onChange(allValue);
258
258
  } else {
259
259
  var values = checkedValues;
260
+ var options = state.flatTreeData.filter(function (item) {
261
+ return values.includes(item[fieldNameValue]);
262
+ });
260
263
  if (labelInValue) {
261
264
  values = state.flatTreeData.filter(function (item) {
262
265
  return values.includes(item[fieldNameValue]);
263
266
  });
264
267
  }
265
- onChange && onChange(values);
268
+ onChange && onChange(values, options);
266
269
  }
267
270
  };
268
271
  // 该方法只有复选框,在勾中checkbox后才会走到这个方法
@@ -348,7 +351,7 @@ var ProTree = function ProTree(props) {
348
351
  /** 点击了树节点开始loading,改变自身state并将值通过onchange上传到form */
349
352
  var onSelectTreeNode = /*#__PURE__*/function () {
350
353
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(props, info) {
351
- var values;
354
+ var values, options;
352
355
  return _regeneratorRuntime().wrap(function _callee$(_context) {
353
356
  while (1) switch (_context.prev = _context.next) {
354
357
  case 0:
@@ -372,17 +375,22 @@ var ProTree = function ProTree(props) {
372
375
  clickShowLoading: false
373
376
  });
374
377
  case 7:
378
+ values = props;
379
+ options = state.flatTreeData.filter(function (item) {
380
+ return values === item[fieldNameValue];
381
+ });
382
+ if (labelInValue) {
383
+ values = state.flatTreeData.filter(function (item) {
384
+ return values === item[fieldNameValue];
385
+ });
386
+ }
375
387
  if (!(other === null || other === void 0 ? void 0 : other.checkable)) {
376
- // 单选将选中节点值冒泡到form
377
- values = props;
378
- if (labelInValue) {
379
- values = state.flatTreeData.filter(function (item) {
380
- return values === item[fieldNameValue];
381
- });
382
- }
383
- onChange && onChange(values);
388
+ // 单选将选中节点值冒泡到form, 给onFieldChange添加options
389
+ onChange && onChange(values, options === null || options === void 0 ? void 0 : options[0]);
390
+ } else {
391
+ onChange && onChange(value, options === null || options === void 0 ? void 0 : options[0]);
384
392
  }
385
- case 8:
393
+ case 11:
386
394
  case "end":
387
395
  return _context.stop();
388
396
  }
@@ -60,7 +60,7 @@ export interface ProTreeProps extends PropTreeSelectProps {
60
60
  /** 树节点文本宽度 */
61
61
  ellipseWidth?: string;
62
62
  /** value改变的回调 */
63
- onChange?: (values: string[] | AllValueType) => void;
63
+ onChange?: (values: string[] | AllValueType, options?: object[]) => void;
64
64
  /** 点击树节点触发 */
65
65
  onSelect?: (values: string[] | AllValueType, info?: any) => any;
66
66
  /** 复选情况下点击checkbox触发,参照antd */
@@ -1,4 +1,15 @@
1
+ @root-entry-name: 'default';
2
+ @import (reference) '~antd/es/style/themes/index.less';
3
+
1
4
  .pro-upload {
5
+ .@{ant-prefix}-upload-disabled{
6
+ .file-action-box{
7
+ .file-name, .file-del{
8
+ color: #ccc;
9
+ cursor: not-allowed !important;
10
+ }
11
+ }
12
+ }
2
13
 
3
14
  .filelist-item-wrapper {
4
15
  .file-info-box {
@@ -6,8 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _ProConfigProvider = require("../../ProConfigProvider");
8
8
  var _utils = require("../utils");
9
+ var _ref;
9
10
  /* eslint-disable no-redeclare */
10
-
11
+ var baseEnumStorage = (_ref = window.localStorage.getItem('zat-design-pro-component-cacheKey') && JSON.parse(window.localStorage.getItem('zat-design-pro-component-cacheKey'))) !== null && _ref !== void 0 ? _ref : null;
11
12
  /**
12
13
  * 根据 code 从枚举缓存取出对应的 options 、以及回显
13
14
  * @param codes
@@ -16,17 +17,17 @@ var _utils = require("../utils");
16
17
  * @returns
17
18
  */
18
19
  function useEnum(codes, value, compose) {
19
- var _ref = (0, _ProConfigProvider.useProConfig)('globalConfig') || {},
20
- _ref$storage = _ref.storage,
21
- storage = _ref$storage === void 0 ? 'localStorage' : _ref$storage;
22
- var _ref2 = (0, _ProConfigProvider.useProConfig)('ProEnum') || {},
23
- _ref2$cacheKey = _ref2.cacheKey,
24
- cacheKey = _ref2$cacheKey === void 0 ? 'zat-design-pro-component-cacheKey' : _ref2$cacheKey,
25
- _ref2$fieldNames = _ref2.fieldNames,
26
- fieldNames = _ref2$fieldNames === void 0 ? {} : _ref2$fieldNames,
27
- _ref2$clear = _ref2.clear,
28
- clear = _ref2$clear === void 0 ? true : _ref2$clear;
29
- var catchData = (0, _utils.getEnumData)(storage, cacheKey);
20
+ var _ref2 = (0, _ProConfigProvider.useProConfig)('globalConfig') || {},
21
+ _ref2$storage = _ref2.storage,
22
+ storage = _ref2$storage === void 0 ? 'localStorage' : _ref2$storage;
23
+ var _ref3 = (0, _ProConfigProvider.useProConfig)('ProEnum') || {},
24
+ _ref3$cacheKey = _ref3.cacheKey,
25
+ cacheKey = _ref3$cacheKey === void 0 ? 'zat-design-pro-component-cacheKey' : _ref3$cacheKey,
26
+ _ref3$fieldNames = _ref3.fieldNames,
27
+ fieldNames = _ref3$fieldNames === void 0 ? {} : _ref3$fieldNames,
28
+ _ref3$clear = _ref3.clear,
29
+ clear = _ref3$clear === void 0 ? true : _ref3$clear;
30
+ var catchData = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage);
30
31
  if (!codes) {
31
32
  return catchData;
32
33
  }
@@ -15,32 +15,34 @@ var _ahooks = require("ahooks");
15
15
  var _utils = require("../utils");
16
16
  var _locale = _interopRequireDefault(require("../../locale"));
17
17
  require("../utils/eventCenter");
18
+ var _ref;
19
+ var baseEnumStorage = (_ref = window.localStorage.getItem('zat-design-pro-component-cacheKey') && JSON.parse(window.localStorage.getItem('zat-design-pro-component-cacheKey'))) !== null && _ref !== void 0 ? _ref : null;
18
20
  var useEnumRequest = function useEnumRequest(props, dispatch) {
19
- var _ref = props || {},
20
- _ref$main = _ref.main,
21
- main = _ref$main === void 0 ? false : _ref$main,
22
- _ref$share = _ref.share,
23
- share = _ref$share === void 0 ? false : _ref$share,
24
- _ref$clear = _ref.clear,
25
- clear = _ref$clear === void 0 ? true : _ref$clear,
26
- _ref$fieldNames = _ref.fieldNames,
27
- fieldNames = _ref$fieldNames === void 0 ? {
21
+ var _ref2 = props || {},
22
+ _ref2$main = _ref2.main,
23
+ main = _ref2$main === void 0 ? false : _ref2$main,
24
+ _ref2$share = _ref2.share,
25
+ share = _ref2$share === void 0 ? false : _ref2$share,
26
+ _ref2$clear = _ref2.clear,
27
+ clear = _ref2$clear === void 0 ? true : _ref2$clear,
28
+ _ref2$fieldNames = _ref2.fieldNames,
29
+ fieldNames = _ref2$fieldNames === void 0 ? {
28
30
  label: 'label',
29
31
  value: 'value',
30
32
  children: 'children'
31
- } : _ref$fieldNames,
32
- _ref$cacheKey = _ref.cacheKey,
33
- cacheKey = _ref$cacheKey === void 0 ? 'zat-design-pro-component-cacheKey' : _ref$cacheKey,
34
- _ref$requestRefresh = _ref.requestRefresh,
35
- requestRefresh = _ref$requestRefresh === void 0 ? false : _ref$requestRefresh,
36
- _ref$storage = _ref.storage,
37
- storage = _ref$storage === void 0 ? 'localStorage' : _ref$storage,
38
- _ref$dataSource = _ref.dataSource,
39
- dataSource = _ref$dataSource === void 0 ? {} : _ref$dataSource,
40
- useRequest = _ref.useRequest,
41
- transformResponse = _ref.transformResponse,
42
- _ref$dics = _ref.dics,
43
- dics = _ref$dics === void 0 ? {} : _ref$dics;
33
+ } : _ref2$fieldNames,
34
+ _ref2$cacheKey = _ref2.cacheKey,
35
+ cacheKey = _ref2$cacheKey === void 0 ? 'zat-design-pro-component-cacheKey' : _ref2$cacheKey,
36
+ _ref2$requestRefresh = _ref2.requestRefresh,
37
+ requestRefresh = _ref2$requestRefresh === void 0 ? false : _ref2$requestRefresh,
38
+ _ref2$storage = _ref2.storage,
39
+ storage = _ref2$storage === void 0 ? 'localStorage' : _ref2$storage,
40
+ _ref2$dataSource = _ref2.dataSource,
41
+ dataSource = _ref2$dataSource === void 0 ? {} : _ref2$dataSource,
42
+ useRequest = _ref2.useRequest,
43
+ transformResponse = _ref2.transformResponse,
44
+ _ref2$dics = _ref2.dics,
45
+ dics = _ref2$dics === void 0 ? {} : _ref2$dics;
44
46
  if ((0, _typeof2.default)(dataSource) === 'object' && dataSource === null) {
45
47
  var _locale$ProEnum;
46
48
  throw new Error(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProEnum = _locale.default.ProEnum) === null || _locale$ProEnum === void 0 ? void 0 : _locale$ProEnum.errorDataSource);
@@ -107,7 +109,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
107
109
  });
108
110
  res.data = response;
109
111
  }
110
- cacheData = (0, _utils.getEnumData)(storage, cacheKey) || {
112
+ cacheData = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage) || {
111
113
  data: {}
112
114
  }; // 合并缓存数据
113
115
  res.data = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, cacheData === null || cacheData === void 0 ? void 0 : cacheData.data), res.data);
@@ -137,7 +139,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
137
139
  return setCache;
138
140
  }(),
139
141
  getCache: function getCache() {
140
- var res = (0, _utils.getEnumData)(storage, cacheKey) || {
142
+ var res = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage) || {
141
143
  data: {}
142
144
  };
143
145
  dispatch({
@@ -165,12 +167,12 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
165
167
  })),
166
168
  run = _useRequestFunc.run;
167
169
  var mergeData = /*#__PURE__*/function () {
168
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
170
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
169
171
  var cacheData, _useRequest$options2, _useRequest$options3, enumData, cacheCodes, codes, ignoreCodes, diff, response, res, _locale$ProEnum6;
170
172
  return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
171
173
  while (1) switch (_context2.prev = _context2.next) {
172
174
  case 0:
173
- cacheData = (0, _utils.getEnumData)(storage, cacheKey) || {
175
+ cacheData = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage) || {
174
176
  data: {}
175
177
  };
176
178
  if (!((0, _typeof2.default)(cacheData) === 'object')) {
@@ -252,13 +254,13 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
252
254
  }, _callee2);
253
255
  }));
254
256
  return function mergeData() {
255
- return _ref2.apply(this, arguments);
257
+ return _ref3.apply(this, arguments);
256
258
  };
257
259
  }();
258
260
  (0, _ahooks.useDeepCompareEffect)(function () {
259
261
  if (useRequest && (useRequest === null || useRequest === void 0 ? void 0 : useRequest.service)) {
260
- var _ref3 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
261
- defaultParams = _ref3.defaultParams;
262
+ var _ref4 = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
263
+ defaultParams = _ref4.defaultParams;
262
264
  if (requestRefresh) {
263
265
  window.localStorage.removeItem(cacheKey);
264
266
  window.sessionStorage.removeItem(cacheKey);
@@ -267,7 +269,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
267
269
  // TODO 这段代码目前看起来是没啥用的、没起到作用
268
270
  mergeData();
269
271
  } else if (Object.keys(dataSource)) {
270
- var res = (0, _utils.getEnumData)(storage, cacheKey) || {
272
+ var res = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage) || {
271
273
  data: {}
272
274
  };
273
275
  dispatch({
@@ -275,7 +277,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
275
277
  payload: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, dataSource), res === null || res === void 0 ? void 0 : res.data)
276
278
  });
277
279
  } else {
278
- var _res = (0, _utils.getEnumData)(storage, cacheKey) || {
280
+ var _res = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage) || {
279
281
  data: {}
280
282
  };
281
283
  dispatch({
@@ -286,7 +288,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
286
288
  }, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options]);
287
289
  var shareProEnumDic = function shareProEnumDic(cacheData) {
288
290
  logDebug(cacheData);
289
- var storageData = (0, _utils.getEnumData)(storage, cacheKey) || {
291
+ var storageData = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage) || {
290
292
  data: {}
291
293
  };
292
294
  dispatch({
@@ -167,7 +167,7 @@ var ProEnum = function ProEnum(props) {
167
167
  }
168
168
  switch (type) {
169
169
  case 'ProSelect':
170
- return (0, _jsxRuntime.jsx)(_ProSelect.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, enumProps), {}, {
170
+ return (0, _jsxRuntime.jsx)(_ProSelect.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(enumProps, ['showCodeName'])), {}, {
171
171
  otherProps: otherProps,
172
172
  dataSource: list,
173
173
  fieldNames: {
@@ -178,7 +178,7 @@ var ProEnum = function ProEnum(props) {
178
178
  onChange: onChange
179
179
  }));
180
180
  case 'Radio':
181
- return (0, _jsxRuntime.jsx)(_antd.Radio.Group, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(enumProps, ['fieldNames'])), {}, {
181
+ return (0, _jsxRuntime.jsx)(_antd.Radio.Group, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(enumProps, ['fieldNames', 'showCodeName'])), {}, {
182
182
  options: list,
183
183
  value: value,
184
184
  onChange: onChange,
@@ -191,7 +191,7 @@ var ProEnum = function ProEnum(props) {
191
191
  })
192
192
  }));
193
193
  case 'Checkbox':
194
- return (0, _jsxRuntime.jsx)(_antd.Checkbox.Group, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(enumProps, ['fieldNames'])), {}, {
194
+ return (0, _jsxRuntime.jsx)(_antd.Checkbox.Group, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(enumProps, ['fieldNames', 'showCodeName'])), {}, {
195
195
  options: list,
196
196
  value: value,
197
197
  onChange: onChange,
@@ -212,7 +212,7 @@ var ProEnum = function ProEnum(props) {
212
212
  dataSource: list
213
213
  });
214
214
  case 'Group':
215
- return (0, _jsxRuntime.jsx)(_Group.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, enumProps), {}, {
215
+ return (0, _jsxRuntime.jsx)(_Group.default, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(enumProps, ['showCodeName'])), {}, {
216
216
  value: value,
217
217
  onChange: onChange,
218
218
  fieldLabel: label,
@@ -4,7 +4,7 @@ interface EnumRes {
4
4
  data: Record<string, DataOption[]>;
5
5
  [key: string]: any;
6
6
  }
7
- export declare function getEnumData(storage: StorageType, cacheKey: string): EnumRes;
7
+ export declare function getEnumData(storage: StorageType, cacheKey: string, baseEnumStorage?: any): EnumRes;
8
8
  export declare function setEnumData(storage: StorageType, cacheKey: string, data: Object): void;
9
9
  export declare function hasEnumList(storage: StorageType, cacheKey: any, code: string): DataOption[];
10
10
  export declare function isObject(obj: any): boolean;
@@ -14,7 +14,10 @@ exports.setEnumData = setEnumData;
14
14
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
15
  var _lodash = require("lodash");
16
16
  var _excluded = ["children"];
17
- function getEnumData(storage, cacheKey) {
17
+ function getEnumData(storage, cacheKey, baseEnumStorage) {
18
+ if (baseEnumStorage) {
19
+ return baseEnumStorage;
20
+ }
18
21
  if (storage === 'localStorage') {
19
22
  return JSON.parse(window.localStorage.getItem(cacheKey) || '{}');
20
23
  }
@@ -49,12 +49,12 @@ var getViewLabel = function getViewLabel(_ref) {
49
49
  return viewLabel;
50
50
  };
51
51
  var ProCascader = function ProCascader(props) {
52
- var _value$slice, _ref7, _ref7$filter, _defaultLabel$filter, _locale$ProAddressBar, _locale$ProAddressBar2;
52
+ var _props$otherProps, _value$slice, _ref7, _ref7$filter, _defaultLabel$filter, _locale$ProAddressBar, _locale$ProAddressBar2;
53
53
  var _ref2 = (0, _ProConfigProvider.useProConfig)('ProAddressBar') || {},
54
54
  configDetailMaxLength = _ref2.detailMaxLength,
55
55
  configEnumCode = _ref2.enumCode,
56
56
  configCode = _ref2.code;
57
- var isAddressMode = (props === null || props === void 0 ? void 0 : props.mode) === 'address';
57
+ var isAddressMode = (props === null || props === void 0 ? void 0 : props.mode) === 'address' || (props === null || props === void 0 ? void 0 : (_props$otherProps = props.otherProps) === null || _props$otherProps === void 0 ? void 0 : _props$otherProps.type) === 'ProAddressBar';
58
58
  var _props$className = props.className,
59
59
  className = _props$className === void 0 ? '' : _props$className,
60
60
  _props$hasDetail = props.hasDetail,
@@ -12,6 +12,7 @@ export { default as TimePicker } from './base/TimePicker';
12
12
  export { default as FormList } from './combination/FormList';
13
13
  export { default as ProEditTable } from '../../ProEditTable';
14
14
  export { default as ProCascader } from './combination/ProCascader';
15
+ export { default as ProAddressBar } from './combination/ProCascader';
15
16
  export { default as ProCombination } from './combination/ProCombination';
16
17
  export { default as ProNumberRange } from './combination/ProNumberRange';
17
18
  export { default as ProModalSelect } from './combination/ProModalSelect';
@@ -71,6 +71,12 @@ Object.defineProperty(exports, "ProAddress", {
71
71
  return _ProAddress.default;
72
72
  }
73
73
  });
74
+ Object.defineProperty(exports, "ProAddressBar", {
75
+ enumerable: true,
76
+ get: function get() {
77
+ return _ProCascader.default;
78
+ }
79
+ });
74
80
  Object.defineProperty(exports, "ProCascader", {
75
81
  enumerable: true,
76
82
  get: function get() {
@@ -274,7 +274,7 @@ var Render = function Render(props) {
274
274
  }, 60);
275
275
  }
276
276
  // ProTreeSelect返回option
277
- if (['ProTree'].includes(type)) {
277
+ if (['ProTree'].includes(type) && !_args[2].option) {
278
278
  var _args2, _args2$;
279
279
  _args[2].option = (0, _index.findOptionByValue)(lastComponentProps === null || lastComponentProps === void 0 ? void 0 : lastComponentProps.dataSource, (_args2 = _args) === null || _args2 === void 0 ? void 0 : (_args2$ = _args2[0]) === null || _args2$ === void 0 ? void 0 : _args2$[0], (lastComponentProps === null || lastComponentProps === void 0 ? void 0 : lastComponentProps.fieldNames) || {});
280
280
  }
@@ -257,12 +257,15 @@ var ProTree = function ProTree(props) {
257
257
  onChange && onChange(allValue);
258
258
  } else {
259
259
  var values = checkedValues;
260
+ var options = state.flatTreeData.filter(function (item) {
261
+ return values.includes(item[fieldNameValue]);
262
+ });
260
263
  if (labelInValue) {
261
264
  values = state.flatTreeData.filter(function (item) {
262
265
  return values.includes(item[fieldNameValue]);
263
266
  });
264
267
  }
265
- onChange && onChange(values);
268
+ onChange && onChange(values, options);
266
269
  }
267
270
  };
268
271
  // 该方法只有复选框,在勾中checkbox后才会走到这个方法
@@ -348,7 +351,7 @@ var ProTree = function ProTree(props) {
348
351
  /** 点击了树节点开始loading,改变自身state并将值通过onchange上传到form */
349
352
  var onSelectTreeNode = /*#__PURE__*/function () {
350
353
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(props, info) {
351
- var values;
354
+ var values, options;
352
355
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
353
356
  while (1) switch (_context.prev = _context.next) {
354
357
  case 0:
@@ -372,17 +375,22 @@ var ProTree = function ProTree(props) {
372
375
  clickShowLoading: false
373
376
  });
374
377
  case 7:
378
+ values = props;
379
+ options = state.flatTreeData.filter(function (item) {
380
+ return values === item[fieldNameValue];
381
+ });
382
+ if (labelInValue) {
383
+ values = state.flatTreeData.filter(function (item) {
384
+ return values === item[fieldNameValue];
385
+ });
386
+ }
375
387
  if (!(other === null || other === void 0 ? void 0 : other.checkable)) {
376
- // 单选将选中节点值冒泡到form
377
- values = props;
378
- if (labelInValue) {
379
- values = state.flatTreeData.filter(function (item) {
380
- return values === item[fieldNameValue];
381
- });
382
- }
383
- onChange && onChange(values);
388
+ // 单选将选中节点值冒泡到form, 给onFieldChange添加options
389
+ onChange && onChange(values, options === null || options === void 0 ? void 0 : options[0]);
390
+ } else {
391
+ onChange && onChange(value, options === null || options === void 0 ? void 0 : options[0]);
384
392
  }
385
- case 8:
393
+ case 11:
386
394
  case "end":
387
395
  return _context.stop();
388
396
  }
@@ -60,7 +60,7 @@ export interface ProTreeProps extends PropTreeSelectProps {
60
60
  /** 树节点文本宽度 */
61
61
  ellipseWidth?: string;
62
62
  /** value改变的回调 */
63
- onChange?: (values: string[] | AllValueType) => void;
63
+ onChange?: (values: string[] | AllValueType, options?: object[]) => void;
64
64
  /** 点击树节点触发 */
65
65
  onSelect?: (values: string[] | AllValueType, info?: any) => any;
66
66
  /** 复选情况下点击checkbox触发,参照antd */
@@ -1,4 +1,15 @@
1
+ @root-entry-name: 'default';
2
+ @import (reference) '~antd/es/style/themes/index.less';
3
+
1
4
  .pro-upload {
5
+ .@{ant-prefix}-upload-disabled{
6
+ .file-action-box{
7
+ .file-name, .file-del{
8
+ color: #ccc;
9
+ cursor: not-allowed !important;
10
+ }
11
+ }
12
+ }
2
13
 
3
14
  .filelist-item-wrapper {
4
15
  .file-info-box {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.4.11-beta.12",
3
+ "version": "3.4.11-beta.14",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",