@zat-design/sisyphus-react 3.13.16-beta.4 → 3.13.16-beta.6

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,5 +1,6 @@
1
1
  import React, { FC } from 'react';
2
2
  import { FormInstance } from 'antd';
3
+ import 'moment/locale/zh-cn';
3
4
  import type { PropSelectType } from '../ProSelect/propsType';
4
5
  import type { ProModalSelectType } from '../ProForm/components/combination/ProModalSelect/propsType';
5
6
  import type { ProCascaderType } from '../ProForm/components/combination/ProCascader/propsType';
@@ -6,6 +6,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import React, { useContext, useEffect, useReducer } from 'react';
7
7
  import zhCN from 'antd/es/locale/zh_CN';
8
8
  import enUS from 'antd/es/locale/en_US';
9
+ import 'moment/locale/zh-cn';
9
10
  import merge from 'lodash/merge';
10
11
  import useEnumRequest from '../ProEnum/hooks/useEnumRequest';
11
12
  import { setLanguage } from '../locale';
@@ -83,11 +84,9 @@ export var ProConfigProvider = function ProConfigProvider(props) {
83
84
  var cacheLang = localStorage.getItem('locale');
84
85
  // 如果是用户切换了语言那么优先使用用户切换的,否则从缓存中取用户语言,在取默认值
85
86
  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
- }
87
+ useEffect(function () {
88
+ if (lang) setLanguage(lang);
89
+ }, [lang]);
91
90
  useEffect(function () {
92
91
  if (enumRes === null || enumRes === void 0 ? void 0 : enumRes.data) {
93
92
  (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));
@@ -1,5 +1,6 @@
1
1
  import React, { FC } from 'react';
2
2
  import { FormInstance } from 'antd';
3
+ import 'moment/locale/zh-cn';
3
4
  import type { PropSelectType } from '../ProSelect/propsType';
4
5
  import type { ProModalSelectType } from '../ProForm/components/combination/ProModalSelect/propsType';
5
6
  import type { ProCascaderType } from '../ProForm/components/combination/ProCascader/propsType';
@@ -15,6 +15,7 @@ var _jsxRuntime = require("react/jsx-runtime");
15
15
  var _react = _interopRequireWildcard(require("react"));
16
16
  var _zh_CN = _interopRequireDefault(require("antd/es/locale/zh_CN"));
17
17
  var _en_US = _interopRequireDefault(require("antd/es/locale/en_US"));
18
+ require("moment/locale/zh-cn");
18
19
  var _merge = _interopRequireDefault(require("lodash/merge"));
19
20
  var _useEnumRequest = _interopRequireDefault(require("../ProEnum/hooks/useEnumRequest"));
20
21
  var _locale = require("../locale");
@@ -92,11 +93,9 @@ var ProConfigProvider = exports.ProConfigProvider = function ProConfigProvider(p
92
93
  var cacheLang = localStorage.getItem('locale');
93
94
  // 如果是用户切换了语言那么优先使用用户切换的,否则从缓存中取用户语言,在取默认值
94
95
  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
- }
96
+ (0, _react.useEffect)(function () {
97
+ if (lang) (0, _locale.setLanguage)(lang);
98
+ }, [lang]);
100
99
  (0, _react.useEffect)(function () {
101
100
  if (enumRes === null || enumRes === void 0 ? void 0 : enumRes.data) {
102
101
  (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));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.13.16-beta.4",
3
+ "version": "3.13.16-beta.6",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",