@zat-design/sisyphus-react 3.13.16-beta.3 → 3.13.16-beta.5

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.
@@ -83,11 +83,9 @@ export var ProConfigProvider = function ProConfigProvider(props) {
83
83
  var cacheLang = localStorage.getItem('locale');
84
84
  // 如果是用户切换了语言那么优先使用用户切换的,否则从缓存中取用户语言,在取默认值
85
85
  var lang = (state === null || state === void 0 ? void 0 : state.locale) || cacheLang || (props === null || props === void 0 ? void 0 : props.locale);
86
- // 如果缓存里没有语言,那么将配置的语言设置为当前系统语言
87
- if (!(state === null || state === void 0 ? void 0 : state.locale) && !cacheLang && (props === null || props === void 0 ? void 0 : props.locale)) {
88
- // 设置默认语言
89
- setLanguage(props === null || props === void 0 ? void 0 : props.locale);
90
- }
86
+ useEffect(function () {
87
+ if (lang) setLanguage(lang);
88
+ }, [lang]);
91
89
  useEffect(function () {
92
90
  if (enumRes === null || enumRes === void 0 ? void 0 : enumRes.data) {
93
91
  (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));
@@ -21,10 +21,6 @@ function useEnum(codes, value, compose) {
21
21
  fieldNames = _ref3$fieldNames === void 0 ? {} : _ref3$fieldNames,
22
22
  _ref3$clear = _ref3.clear,
23
23
  clear = _ref3$clear === void 0 ? true : _ref3$clear;
24
- // 存在子应用自管理枚举时,需要根据其指定的cacheKey进行缓存
25
- if (cacheKey !== 'zat-design-pro-component-cacheKey') {
26
- baseEnumStorage = null;
27
- }
28
24
  var catchData = getEnumData(storage, cacheKey, baseEnumStorage);
29
25
  // 默认枚举缓存数据
30
26
  baseEnumStorage = catchData;
@@ -10,8 +10,13 @@ var _excluded = ["children"];
10
10
  * @returns
11
11
  */
12
12
  export function getEnumData(storage, cacheKey, baseEnumStorage) {
13
- if (baseEnumStorage && window.localStorage.getItem(cacheKey)) {
14
- return baseEnumStorage;
13
+ var _baseEnumStorage = baseEnumStorage;
14
+ // 存在子应用自管理枚举时,需要根据其指定的cacheKey进行缓存
15
+ if (cacheKey !== 'zat-design-pro-component-cacheKey') {
16
+ _baseEnumStorage = null;
17
+ }
18
+ if (_baseEnumStorage && window.localStorage.getItem(cacheKey)) {
19
+ return _baseEnumStorage;
15
20
  }
16
21
  if (storage === 'localStorage') {
17
22
  return JSON.parse(window.localStorage.getItem(cacheKey) || '{}');
@@ -92,11 +92,9 @@ var ProConfigProvider = exports.ProConfigProvider = function ProConfigProvider(p
92
92
  var cacheLang = localStorage.getItem('locale');
93
93
  // 如果是用户切换了语言那么优先使用用户切换的,否则从缓存中取用户语言,在取默认值
94
94
  var lang = (state === null || state === void 0 ? void 0 : state.locale) || cacheLang || (props === null || props === void 0 ? void 0 : props.locale);
95
- // 如果缓存里没有语言,那么将配置的语言设置为当前系统语言
96
- if (!(state === null || state === void 0 ? void 0 : state.locale) && !cacheLang && (props === null || props === void 0 ? void 0 : props.locale)) {
97
- // 设置默认语言
98
- (0, _locale.setLanguage)(props === null || props === void 0 ? void 0 : props.locale);
99
- }
95
+ (0, _react.useEffect)(function () {
96
+ if (lang) (0, _locale.setLanguage)(lang);
97
+ }, [lang]);
100
98
  (0, _react.useEffect)(function () {
101
99
  if (enumRes === null || enumRes === void 0 ? void 0 : enumRes.data) {
102
100
  (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));
@@ -27,10 +27,6 @@ function useEnum(codes, value, compose) {
27
27
  fieldNames = _ref3$fieldNames === void 0 ? {} : _ref3$fieldNames,
28
28
  _ref3$clear = _ref3.clear,
29
29
  clear = _ref3$clear === void 0 ? true : _ref3$clear;
30
- // 存在子应用自管理枚举时,需要根据其指定的cacheKey进行缓存
31
- if (cacheKey !== 'zat-design-pro-component-cacheKey') {
32
- baseEnumStorage = null;
33
- }
34
30
  var catchData = (0, _utils.getEnumData)(storage, cacheKey, baseEnumStorage);
35
31
  // 默认枚举缓存数据
36
32
  baseEnumStorage = catchData;
@@ -23,8 +23,13 @@ var _excluded = ["children"];
23
23
  * @returns
24
24
  */
25
25
  function getEnumData(storage, cacheKey, baseEnumStorage) {
26
- if (baseEnumStorage && window.localStorage.getItem(cacheKey)) {
27
- return baseEnumStorage;
26
+ var _baseEnumStorage = baseEnumStorage;
27
+ // 存在子应用自管理枚举时,需要根据其指定的cacheKey进行缓存
28
+ if (cacheKey !== 'zat-design-pro-component-cacheKey') {
29
+ _baseEnumStorage = null;
30
+ }
31
+ if (_baseEnumStorage && window.localStorage.getItem(cacheKey)) {
32
+ return _baseEnumStorage;
28
33
  }
29
34
  if (storage === 'localStorage') {
30
35
  return JSON.parse(window.localStorage.getItem(cacheKey) || '{}');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.13.16-beta.3",
3
+ "version": "3.13.16-beta.5",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",