index.js
1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import _extends from "@babel/runtime/helpers/extends";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _inherits from "@babel/runtime/helpers/inherits";
import _createSuper from "@babel/runtime/helpers/createSuper";
import * as React from 'react';
import devWarning from '../_util/devWarning';
import { changeConfirmLocale } from '../modal/locale';
import LocaleContext from './context';
export var ANT_MARK = 'internalMark';
var LocaleProvider = /*#__PURE__*/function (_React$Component) {
_inherits(LocaleProvider, _React$Component);
var _super = _createSuper(LocaleProvider);
function LocaleProvider(props) {
var _this;
_classCallCheck(this, LocaleProvider);
_this = _super.call(this, props);
changeConfirmLocale(props.locale && props.locale.Modal);
devWarning(props._ANT_MARK__ === ANT_MARK, 'LocaleProvider', '`LocaleProvider` is deprecated. Please use `locale` with `ConfigProvider` instead: http://u.ant.design/locale');
return _this;
}
_createClass(LocaleProvider, [{
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
var locale = this.props.locale;
if (prevProps.locale !== locale) {
changeConfirmLocale(locale && locale.Modal);
}
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
changeConfirmLocale();
}
}, {
key: "render",
value: function render() {
var _this$props = this.props,
locale = _this$props.locale,
children = _this$props.children;
return /*#__PURE__*/React.createElement(LocaleContext.Provider, {
value: _extends(_extends({}, locale), {
exist: true
})
}, children);
}
}]);
return LocaleProvider;
}(React.Component);
export { LocaleProvider as default };
LocaleProvider.defaultProps = {
locale: {}
};