@chaoswise/business 1.1.0 → 2.1.0
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.
- package/lib/I18nInput/index.d.ts +31 -0
- package/lib/I18nInput/index.js +159 -58
- package/lib/index.d.ts +1 -0
- package/lib/index.js +0 -4
- package/lib/locales/en_US.json +1 -1
- package/lib/locales/index.d.ts +7 -0
- package/lib/locales/index.js +15 -19
- package/lib/locales/intl.d.ts +11 -0
- package/lib/locales/intl.js +18 -58
- package/lib/locales/ja_JP.json +1 -1
- package/lib/locales/normalizeLocale.d.ts +2 -0
- package/lib/locales/normalizeLocale.js +27 -0
- package/lib/locales/withLocale.d.ts +28 -0
- package/lib/locales/withLocale.js +1 -1
- package/lib/locales/zh_CN.json +1 -1
- package/lib/locales/zh_HK.json +1 -1
- package/lib/locales/zh_TW.json +1 -1
- package/package.json +8 -6
- package/lib/AggregateSearch/CLSPL/CLQLLexer.js +0 -78
- package/lib/AggregateSearch/CLSPL/CLQLParser.js +0 -2724
- package/lib/AggregateSearch/CLSPL/CLQLParserListener.js +0 -347
- package/lib/AggregateSearch/CLSPL/CLQLParserVisitor.js +0 -251
- package/lib/AggregateSearch/CLSPL/SPLStagy.js +0 -197
- package/lib/AggregateSearch/CLSPL/index.js +0 -196
- package/lib/AggregateSearch/CLSPL/makeTokenizeFn.js +0 -18
- package/lib/AggregateSearch/CLSPL/token.js +0 -7
- package/lib/AggregateSearch/components/CloseAllIcon/index.js +0 -13
- package/lib/AggregateSearch/components/CloseAllIcon/index.less +0 -11
- package/lib/AggregateSearch/components/DropDown/assets/combined.svg +0 -22
- package/lib/AggregateSearch/components/DropDown/assets/copy.svg +0 -22
- package/lib/AggregateSearch/components/DropDown/assets/delete.svg +0 -24
- package/lib/AggregateSearch/components/DropDown/assets/home.svg +0 -20
- package/lib/AggregateSearch/components/DropDown/assets/key.svg +0 -21
- package/lib/AggregateSearch/components/DropDown/assets/star.svg +0 -22
- package/lib/AggregateSearch/components/DropDown/assets/time-circle.svg +0 -20
- package/lib/AggregateSearch/components/DropDown/assets/value.svg +0 -23
- package/lib/AggregateSearch/components/DropDown/config.js +0 -54
- package/lib/AggregateSearch/components/DropDown/index.js +0 -576
- package/lib/AggregateSearch/components/DropDown/index.less +0 -118
- package/lib/AggregateSearch/components/SwitchBtn/assets/tag-icon.svg +0 -17
- package/lib/AggregateSearch/components/SwitchBtn/assets/text-icon.svg +0 -18
- package/lib/AggregateSearch/components/SwitchBtn/index.js +0 -27
- package/lib/AggregateSearch/components/SwitchBtn/index.less +0 -31
- package/lib/AggregateSearch/hooks/useDropDown.js +0 -428
- package/lib/AggregateSearch/index.js +0 -503
- package/lib/AggregateSearch/index.less +0 -225
- package/lib/AggregateSearch/utils/index.js +0 -391
- package/lib/ContentEditableSearch/components/CloseAllIcon/index.js +0 -13
- package/lib/ContentEditableSearch/components/CloseAllIcon/index.less +0 -11
- package/lib/ContentEditableSearch/index.js +0 -155
- package/lib/ContentEditableSearch/index.less +0 -65
- package/lib/ContentEditableSearch/utils/index.js +0 -98
- package/lib/PropertyControlViewer/assets/doCommon.less +0 -75
- package/lib/PropertyControlViewer/assets/doSelect.less +0 -74
- package/lib/PropertyControlViewer/assets/index.less +0 -189
- package/lib/PropertyControlViewer/components/DoAppIcon/CustomIcon/iconfont.js +0 -1
- package/lib/PropertyControlViewer/components/DoAppIcon/CustomIcon/index.js +0 -29
- package/lib/PropertyControlViewer/components/DoAppIcon/iconData/IconJson.js +0 -0
- package/lib/PropertyControlViewer/components/DoAppIcon/index.js +0 -41
- package/lib/PropertyControlViewer/components/DoCiUnitBitmap.js +0 -50
- package/lib/PropertyControlViewer/components/DoCommon.js +0 -36
- package/lib/PropertyControlViewer/components/DoDefaultPlaceholder.js +0 -9
- package/lib/PropertyControlViewer/components/DoImage.js +0 -107
- package/lib/PropertyControlViewer/components/DoQuote/components/QuoteView.js +0 -63
- package/lib/PropertyControlViewer/components/DoQuote/components/TableQuoteView.js +0 -18
- package/lib/PropertyControlViewer/components/DoQuote/index.js +0 -16
- package/lib/PropertyControlViewer/components/DoSelect.js +0 -80
- package/lib/PropertyControlViewer/components/DoTable.js +0 -44
- package/lib/PropertyControlViewer/components/DoUser.js +0 -61
- package/lib/PropertyControlViewer/components/TagShowMoreList/index.js +0 -132
- package/lib/PropertyControlViewer/components/TagShowMoreList/index.less +0 -106
- package/lib/PropertyControlViewer/config/constants.js +0 -84
- package/lib/PropertyControlViewer/config/utils.js +0 -353
- package/lib/PropertyControlViewer/index.js +0 -195
- package/lib/PropertyControlViewer/index.less +0 -107
- package/lib/Watermark/index.js +0 -184
- package/lib/Watermark/index.less +0 -17
- package/lib/demo.js +0 -0
- package/lib/locale/en_US.js +0 -9
- package/lib/locale/index.js +0 -12
- package/lib/locale/zh_CN.js +0 -9
- package/lib/locales/localeCode.js +0 -13
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export default I18nInput;
|
|
2
|
+
declare function I18nInput(props: any): React.JSX.Element;
|
|
3
|
+
declare namespace I18nInput {
|
|
4
|
+
namespace propTypes {
|
|
5
|
+
const value: PropTypes.Requireable<NonNullable<string | object>>;
|
|
6
|
+
const onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
7
|
+
const placeholder: PropTypes.Requireable<string>;
|
|
8
|
+
const maxLength: PropTypes.Requireable<number>;
|
|
9
|
+
const allowClear: PropTypes.Requireable<boolean>;
|
|
10
|
+
const onSyncChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
11
|
+
const i18nValue: PropTypes.Requireable<object>;
|
|
12
|
+
const locale: PropTypes.Validator<string>;
|
|
13
|
+
const language: PropTypes.Requireable<PropTypes.InferProps<{
|
|
14
|
+
value: PropTypes.Validator<string>;
|
|
15
|
+
name: PropTypes.Requireable<string>;
|
|
16
|
+
}>[]>;
|
|
17
|
+
const drawerProps: PropTypes.Requireable<object>;
|
|
18
|
+
const formProps: PropTypes.Requireable<object>;
|
|
19
|
+
const enableI18n: PropTypes.Requireable<boolean>;
|
|
20
|
+
const required: PropTypes.Requireable<boolean>;
|
|
21
|
+
const requiredLocales: PropTypes.Requireable<{
|
|
22
|
+
[x: string]: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
const requiredMessage: PropTypes.Requireable<string>;
|
|
25
|
+
const rules: PropTypes.Requireable<NonNullable<object[] | {
|
|
26
|
+
[x: string]: object[];
|
|
27
|
+
}>>;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
import React from "react";
|
|
31
|
+
import PropTypes from "prop-types";
|
package/lib/I18nInput/index.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
import _Drawer from "@chaoswise/ui/lib/Drawer";
|
|
3
|
-
import _CustomScrollBar from "@chaoswise/ui/lib/CustomScrollBar";
|
|
4
1
|
import _Empty from "@chaoswise/ui/lib/Empty";
|
|
5
|
-
import
|
|
2
|
+
import _CustomScrollBar from "@chaoswise/ui/lib/CustomScrollBar";
|
|
6
3
|
import _Button from "@chaoswise/ui/lib/Button";
|
|
4
|
+
import _Space from "@chaoswise/ui/lib/Space";
|
|
5
|
+
import _Drawer from "@chaoswise/ui/lib/Drawer";
|
|
7
6
|
import _Input from "@chaoswise/ui/lib/Input";
|
|
8
|
-
import _Form from "@chaoswise/ui/lib/
|
|
9
|
-
|
|
10
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
7
|
+
import _Form from "@chaoswise/ui/lib/Form";
|
|
8
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
11
9
|
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
12
10
|
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
13
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
14
|
-
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
15
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
11
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
18
12
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
19
13
|
function _toPrimitive(t, e) { if ("object" != _typeof(t) || !t) return t; var r; if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) { var i = r.call(t, e || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === e ? String : Number)(t); }
|
|
@@ -23,17 +17,50 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
|
|
|
23
17
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
24
18
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
25
19
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
26
|
-
|
|
27
|
-
function
|
|
20
|
+
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
21
|
+
function adopt(value) {
|
|
22
|
+
return value instanceof P ? value : new P(function (resolve) {
|
|
23
|
+
resolve(value);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
27
|
+
function fulfilled(value) {
|
|
28
|
+
try {
|
|
29
|
+
step(generator.next(value));
|
|
30
|
+
} catch (e) {
|
|
31
|
+
reject(e);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function rejected(value) {
|
|
35
|
+
try {
|
|
36
|
+
step(generator["throw"](value));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
reject(e);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function step(result) {
|
|
42
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
43
|
+
}
|
|
44
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
48
|
+
var t = {};
|
|
49
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
50
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
51
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
52
|
+
}
|
|
53
|
+
return t;
|
|
54
|
+
};
|
|
28
55
|
import React, { useState } from 'react';
|
|
29
56
|
import PropTypes from 'prop-types';
|
|
30
57
|
import { International } from '@icon-park/react';
|
|
31
58
|
import { useIntl } from '../locales';
|
|
32
|
-
import { normalizeLocale } from '../locales/
|
|
59
|
+
import { normalizeLocale, normalizeLocaleRecord } from '../locales/normalizeLocale';
|
|
33
60
|
import './index.less';
|
|
34
61
|
var I18nInput = function I18nInput(props) {
|
|
35
62
|
var intl = useIntl();
|
|
36
|
-
var
|
|
63
|
+
var inputValue = props.value,
|
|
37
64
|
onChange = props.onChange,
|
|
38
65
|
placeholder = props.placeholder,
|
|
39
66
|
_props$maxLength = props.maxLength,
|
|
@@ -41,14 +68,18 @@ var I18nInput = function I18nInput(props) {
|
|
|
41
68
|
_props$allowClear = props.allowClear,
|
|
42
69
|
allowClear = _props$allowClear === void 0 ? true : _props$allowClear,
|
|
43
70
|
onSyncChange = props.onSyncChange,
|
|
44
|
-
|
|
45
|
-
|
|
71
|
+
inputI18nValue = props.i18nValue,
|
|
72
|
+
inputLocale = props.locale,
|
|
46
73
|
_props$language = props.language,
|
|
47
|
-
|
|
74
|
+
inputLanguage = _props$language === void 0 ? [] : _props$language,
|
|
75
|
+
inputRequiredLocales = props.requiredLocales,
|
|
76
|
+
inputRules = props.rules,
|
|
48
77
|
drawerProps = props.drawerProps,
|
|
49
78
|
formProps = props.formProps,
|
|
50
|
-
|
|
51
|
-
|
|
79
|
+
_props$enableI18n = props.enableI18n,
|
|
80
|
+
enableI18n = _props$enableI18n === void 0 ? true : _props$enableI18n,
|
|
81
|
+
restProps = __rest(props, ["value", "onChange", "placeholder", "maxLength", "allowClear", "onSyncChange", "i18nValue", "locale", "language", "requiredLocales", "rules", "drawerProps", "formProps", "enableI18n"]);
|
|
82
|
+
var locale = normalizeLocale(inputLocale);
|
|
52
83
|
var _useState = useState(false),
|
|
53
84
|
_useState2 = _slicedToArray(_useState, 2),
|
|
54
85
|
drawerVisible = _useState2[0],
|
|
@@ -58,6 +89,19 @@ var I18nInput = function I18nInput(props) {
|
|
|
58
89
|
drawerForm = _Form$useForm2[0];
|
|
59
90
|
var isDisabled = restProps.disabled || restProps.readOnly;
|
|
60
91
|
var isSyncMode = !!onSyncChange;
|
|
92
|
+
var value = isSyncMode ? inputValue : normalizeLocaleRecord(inputValue);
|
|
93
|
+
var i18nValue = normalizeLocaleRecord(inputI18nValue);
|
|
94
|
+
var requiredLocales = normalizeLocaleRecord(inputRequiredLocales);
|
|
95
|
+
var rules = normalizeLocaleRecord(inputRules);
|
|
96
|
+
var language = inputLanguage.map(function (lang) {
|
|
97
|
+
return Object.assign(Object.assign({}, lang), {
|
|
98
|
+
value: normalizeLocale(lang.value)
|
|
99
|
+
});
|
|
100
|
+
}).filter(function (lang, index, list) {
|
|
101
|
+
return list.findIndex(function (item) {
|
|
102
|
+
return item.value === lang.value;
|
|
103
|
+
}) === index;
|
|
104
|
+
});
|
|
61
105
|
var getDisplayValue = function getDisplayValue() {
|
|
62
106
|
if (isSyncMode) {
|
|
63
107
|
return value || '';
|
|
@@ -78,7 +122,7 @@ var I18nInput = function I18nInput(props) {
|
|
|
78
122
|
var inputValue = e.target.value;
|
|
79
123
|
if (isSyncMode) {
|
|
80
124
|
var currentI18nValue = i18nValue || {};
|
|
81
|
-
var newI18nValue =
|
|
125
|
+
var newI18nValue = Object.assign(Object.assign({}, currentI18nValue), _defineProperty({}, locale, inputValue));
|
|
82
126
|
if (onSyncChange) {
|
|
83
127
|
onSyncChange(inputValue, newI18nValue);
|
|
84
128
|
}
|
|
@@ -86,7 +130,7 @@ var I18nInput = function I18nInput(props) {
|
|
|
86
130
|
onChange(inputValue);
|
|
87
131
|
}
|
|
88
132
|
} else {
|
|
89
|
-
var _newI18nValue =
|
|
133
|
+
var _newI18nValue = Object.assign(Object.assign({}, value || {}), _defineProperty({}, locale, inputValue));
|
|
90
134
|
if (onChange) {
|
|
91
135
|
onChange(_newI18nValue);
|
|
92
136
|
}
|
|
@@ -98,24 +142,25 @@ var I18nInput = function I18nInput(props) {
|
|
|
98
142
|
if (isSyncMode) {
|
|
99
143
|
var currentI18nValue = i18nValue || {};
|
|
100
144
|
var currentValue = value || '';
|
|
101
|
-
initialValues =
|
|
145
|
+
initialValues = Object.assign(Object.assign({}, currentI18nValue), _defineProperty({}, locale, currentValue));
|
|
102
146
|
} else {
|
|
103
147
|
initialValues = value || {};
|
|
104
148
|
}
|
|
105
149
|
drawerForm.setFieldsValue(initialValues);
|
|
106
150
|
setDrawerVisible(true);
|
|
107
151
|
};
|
|
108
|
-
var handleConfirm =
|
|
109
|
-
|
|
110
|
-
var formValues, currentValue, _t;
|
|
152
|
+
var handleConfirm = function handleConfirm() {
|
|
153
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regenerator().m(function _callee() {
|
|
154
|
+
var formValues, currentValue, _t, _t2;
|
|
111
155
|
return _regenerator().w(function (_context) {
|
|
112
156
|
while (1) switch (_context.p = _context.n) {
|
|
113
157
|
case 0:
|
|
114
158
|
_context.p = 0;
|
|
159
|
+
_t = normalizeLocaleRecord;
|
|
115
160
|
_context.n = 1;
|
|
116
161
|
return drawerForm.validateFields();
|
|
117
162
|
case 1:
|
|
118
|
-
formValues = _context.v;
|
|
163
|
+
formValues = _t(_context.v);
|
|
119
164
|
currentValue = formValues[locale] || '';
|
|
120
165
|
if (isSyncMode) {
|
|
121
166
|
if (onSyncChange) {
|
|
@@ -134,22 +179,19 @@ var I18nInput = function I18nInput(props) {
|
|
|
134
179
|
break;
|
|
135
180
|
case 2:
|
|
136
181
|
_context.p = 2;
|
|
137
|
-
|
|
182
|
+
_t2 = _context.v;
|
|
138
183
|
case 3:
|
|
139
184
|
return _context.a(2);
|
|
140
185
|
}
|
|
141
186
|
}, _callee, null, [[0, 2]]);
|
|
142
187
|
}));
|
|
143
|
-
|
|
144
|
-
return _ref.apply(this, arguments);
|
|
145
|
-
};
|
|
146
|
-
}();
|
|
188
|
+
};
|
|
147
189
|
var handleCancel = function handleCancel() {
|
|
148
190
|
var initialValues = {};
|
|
149
191
|
if (isSyncMode) {
|
|
150
192
|
var currentI18nValue = i18nValue || {};
|
|
151
193
|
var currentValue = value || '';
|
|
152
|
-
initialValues =
|
|
194
|
+
initialValues = Object.assign(Object.assign({}, currentI18nValue), _defineProperty({}, locale, currentValue));
|
|
153
195
|
} else {
|
|
154
196
|
initialValues = value || {};
|
|
155
197
|
}
|
|
@@ -159,45 +201,69 @@ var I18nInput = function I18nInput(props) {
|
|
|
159
201
|
var getLanguageName = function getLanguageName(lang) {
|
|
160
202
|
return lang.name || lang.value;
|
|
161
203
|
};
|
|
162
|
-
var
|
|
163
|
-
|
|
204
|
+
var getRules = function getRules(langValue) {
|
|
205
|
+
var required = props.required,
|
|
206
|
+
requiredMessage = props.requiredMessage;
|
|
207
|
+
// rules 对象:按语言返回对应规则
|
|
208
|
+
if (rules && _typeof(rules) === 'object' && !Array.isArray(rules)) {
|
|
209
|
+
return rules[langValue] || [];
|
|
210
|
+
}
|
|
211
|
+
// rules 数组:统一应用所有语言
|
|
212
|
+
if (Array.isArray(rules) && rules.length > 0) {
|
|
213
|
+
return rules;
|
|
214
|
+
}
|
|
215
|
+
// 判断是否必填
|
|
216
|
+
var isRequired = false;
|
|
217
|
+
if (requiredLocales) {
|
|
218
|
+
isRequired = requiredLocales[langValue] === true;
|
|
219
|
+
} else if (required !== undefined) {
|
|
220
|
+
isRequired = required;
|
|
221
|
+
} else {
|
|
222
|
+
isRequired = langValue === locale; // 默认:仅当前语言必填
|
|
223
|
+
}
|
|
224
|
+
if (!isRequired) return [];
|
|
225
|
+
// 返回必填规则
|
|
226
|
+
return [{
|
|
164
227
|
required: true,
|
|
165
228
|
whitespace: true,
|
|
166
|
-
message: intl.get('99b301b7-f153-4861-8ca3-22371b6b95d9').d('请输入')
|
|
167
|
-
};
|
|
229
|
+
message: requiredMessage || intl.get('99b301b7-f153-4861-8ca3-22371b6b95d9').d('请输入')
|
|
230
|
+
}];
|
|
168
231
|
};
|
|
169
|
-
|
|
232
|
+
var drawerTitle = intl.get('e25f1462-c823-434a-a6b2-4258dd57930a').d('多语言配置');
|
|
233
|
+
var confirmText = intl.get('632edd96-893f-4599-b1a3-0406e2146010').d('确定');
|
|
234
|
+
var cancelText = intl.get('19d6c313-9540-4042-b642-ebc6396ca0c7').d('取消');
|
|
235
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Input, Object.assign({
|
|
170
236
|
value: getDisplayValue(),
|
|
171
237
|
onChange: handleInputChange,
|
|
172
238
|
placeholder: placeholder,
|
|
173
|
-
addonAfter: /*#__PURE__*/React.createElement(International, {
|
|
239
|
+
addonAfter: enableI18n ? (/*#__PURE__*/React.createElement(International, {
|
|
174
240
|
style: {
|
|
175
241
|
display: 'flex',
|
|
176
242
|
alignItems: 'center',
|
|
177
243
|
cursor: isDisabled ? 'not-allowed' : 'pointer',
|
|
178
244
|
opacity: isDisabled ? 0.5 : 1
|
|
179
245
|
},
|
|
180
|
-
theme:
|
|
181
|
-
size:
|
|
182
|
-
fill:
|
|
246
|
+
theme: 'outline',
|
|
247
|
+
size: '16',
|
|
248
|
+
fill: '#333',
|
|
183
249
|
onClick: handleIconClick
|
|
184
|
-
})
|
|
185
|
-
}, restProps)), /*#__PURE__*/React.createElement(_Drawer,
|
|
250
|
+
})) : null
|
|
251
|
+
}, restProps)), /*#__PURE__*/React.createElement(_Drawer, Object.assign({
|
|
186
252
|
visible: drawerVisible,
|
|
187
253
|
onClose: handleCancel,
|
|
188
|
-
title:
|
|
254
|
+
title: drawerTitle,
|
|
189
255
|
width: 500,
|
|
190
256
|
destroyOnClose: true,
|
|
191
257
|
maskClosable: false,
|
|
192
258
|
footer: /*#__PURE__*/React.createElement(_Space, null, /*#__PURE__*/React.createElement(_Button, {
|
|
193
259
|
mainType: true,
|
|
194
|
-
type:
|
|
260
|
+
type: 'primary',
|
|
195
261
|
onClick: handleConfirm
|
|
196
|
-
},
|
|
262
|
+
}, confirmText), /*#__PURE__*/React.createElement(_Button, {
|
|
197
263
|
mainType: true,
|
|
198
264
|
onClick: handleCancel
|
|
199
|
-
},
|
|
200
|
-
}, drawerProps), /*#__PURE__*/React.createElement(_CustomScrollBar, null, /*#__PURE__*/React.createElement(_Form,
|
|
265
|
+
}, cancelText))
|
|
266
|
+
}, drawerProps), /*#__PURE__*/React.createElement(_CustomScrollBar, null, /*#__PURE__*/React.createElement(_Form, Object.assign({
|
|
201
267
|
form: drawerForm,
|
|
202
268
|
labelCol: {
|
|
203
269
|
span: 6
|
|
@@ -205,21 +271,21 @@ var I18nInput = function I18nInput(props) {
|
|
|
205
271
|
wrapperCol: {
|
|
206
272
|
span: 18
|
|
207
273
|
},
|
|
208
|
-
labelAlign:
|
|
274
|
+
labelAlign: 'left',
|
|
209
275
|
colon: true
|
|
210
276
|
}, formProps), language.length > 0 ? language.map(function (lang) {
|
|
211
277
|
return /*#__PURE__*/React.createElement(_Form.Item, {
|
|
212
|
-
key:
|
|
213
|
-
name:
|
|
278
|
+
key: lang.value,
|
|
279
|
+
name: lang.value,
|
|
214
280
|
label: getLanguageName(lang),
|
|
215
|
-
className:
|
|
216
|
-
rules:
|
|
281
|
+
className: 'languageItem',
|
|
282
|
+
rules: getRules(lang.value)
|
|
217
283
|
}, /*#__PURE__*/React.createElement(_Input, {
|
|
218
284
|
maxLength: maxLength,
|
|
219
285
|
showCount: true,
|
|
220
286
|
allowClear: allowClear
|
|
221
287
|
}));
|
|
222
|
-
}) : /*#__PURE__*/React.createElement(_Empty, null)))));
|
|
288
|
+
}) : (/*#__PURE__*/React.createElement(_Empty, null))))));
|
|
223
289
|
};
|
|
224
290
|
I18nInput.propTypes = {
|
|
225
291
|
/**
|
|
@@ -254,8 +320,8 @@ I18nInput.propTypes = {
|
|
|
254
320
|
*/
|
|
255
321
|
i18nValue: PropTypes.object,
|
|
256
322
|
/**
|
|
257
|
-
* 当前语言环境,如 'zh_CN'、'en_US'、'zh_TW'、'zh_HK'
|
|
258
|
-
*
|
|
323
|
+
* 当前语言环境,如 'zh_CN'、'en_US'、'zh_TW'、'zh_HK';兼容连字符别名。
|
|
324
|
+
* 多语言数据、language 和规则键同步规范化,回调统一返回下划线键;标准键优先。
|
|
259
325
|
*/
|
|
260
326
|
locale: PropTypes.string.isRequired,
|
|
261
327
|
/**
|
|
@@ -273,6 +339,41 @@ I18nInput.propTypes = {
|
|
|
273
339
|
/**
|
|
274
340
|
* Form 组件的额外属性配置
|
|
275
341
|
*/
|
|
276
|
-
formProps: PropTypes.object
|
|
342
|
+
formProps: PropTypes.object,
|
|
343
|
+
/**
|
|
344
|
+
* 是否启用国际化功能,默认为 true
|
|
345
|
+
* 当设置为 false 时,不显示国际化图标
|
|
346
|
+
*/
|
|
347
|
+
enableI18n: PropTypes.bool,
|
|
348
|
+
/**
|
|
349
|
+
* 是否必填,默认情况下只有当前语言(locale)必填
|
|
350
|
+
* - undefined: 默认行为,当前语言必填,其他非必填
|
|
351
|
+
* - true: 所有语言项必填
|
|
352
|
+
* - false: 所有语言项非必填
|
|
353
|
+
*/
|
|
354
|
+
required: PropTypes.bool,
|
|
355
|
+
/**
|
|
356
|
+
* 指定哪些语言必填,优先级高于 required
|
|
357
|
+
* 例如:{ zh_CN: true, en_US: false, zh_TW: true }
|
|
358
|
+
*/
|
|
359
|
+
requiredLocales: PropTypes.objectOf(PropTypes.bool),
|
|
360
|
+
/**
|
|
361
|
+
* 自定义必填错误提示消息
|
|
362
|
+
*/
|
|
363
|
+
requiredMessage: PropTypes.string,
|
|
364
|
+
/**
|
|
365
|
+
* 完全自定义校验规则,优先级最高
|
|
366
|
+
* 支持两种格式:
|
|
367
|
+
* 1. 数组格式:统一应用到所有语言项
|
|
368
|
+
* [{ required: true, message: '请输入' }, { max: 50, message: '最多50个字符' }]
|
|
369
|
+
* 2. 对象格式:为每种语言指定不同规则
|
|
370
|
+
* {
|
|
371
|
+
* zh_CN: [{ required: true, message: '请输入中文' }],
|
|
372
|
+
* en_US: [{ required: true, max: 100, message: 'Required' }],
|
|
373
|
+
* zh_TW: [{ max: 50, message: '最多50個字符' }],
|
|
374
|
+
* ja_JP: [] // 日语非必填
|
|
375
|
+
* }
|
|
376
|
+
*/
|
|
377
|
+
rules: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.objectOf(PropTypes.arrayOf(PropTypes.object))])
|
|
277
378
|
};
|
|
278
379
|
export default I18nInput;
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as I18nInput } from "./I18nInput";
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
export { default as PropertyControlViewer } from "./PropertyControlViewer";
|
|
2
|
-
export { default as AggregateSearch } from "./AggregateSearch";
|
|
3
|
-
export { default as Watermark } from "./Watermark";
|
|
4
|
-
export { default as ContentEditableSearch } from "./ContentEditableSearch";
|
|
5
1
|
export { default as I18nInput } from "./I18nInput";
|
package/lib/locales/en_US.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"19d6c313-9540-4042-b642-ebc6396ca0c7":"Cancel","632edd96-893f-4599-b1a3-0406e2146010":"Confirm","99b301b7-f153-4861-8ca3-22371b6b95d9":"Please enter","e25f1462-c823-434a-a6b2-4258dd57930a":"Multi-language Configuration"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function useIntl(): import("react-intl-universal/lib/ReactIntlUniversal").default;
|
|
2
|
+
export default intl;
|
|
3
|
+
import { TagInitInstance } from "./intl";
|
|
4
|
+
import { useForceUpdate } from "./intl";
|
|
5
|
+
import withLocale from "./withLocale";
|
|
6
|
+
import intl from "./intl";
|
|
7
|
+
export { TagInitInstance, useForceUpdate, withLocale };
|
package/lib/locales/index.js
CHANGED
|
@@ -8,8 +8,7 @@ import { useEffect, useContext, useMemo, useState } from "react";
|
|
|
8
8
|
import intl, { useForceUpdate, TagInitInstance, injectLocale } from "./intl";
|
|
9
9
|
import { intlContext } from '@chaoswise/ui/lib/ConfigProvider/ConfigProvider';
|
|
10
10
|
import withLocale from "./withLocale";
|
|
11
|
-
import { normalizeLocale } from './
|
|
12
|
-
|
|
11
|
+
import { normalizeLocale } from './normalizeLocale';
|
|
13
12
|
// 初始化默认值取消warning
|
|
14
13
|
intl.init({
|
|
15
14
|
currentLocale: 'default',
|
|
@@ -18,7 +17,6 @@ intl.init({
|
|
|
18
17
|
return null;
|
|
19
18
|
}
|
|
20
19
|
});
|
|
21
|
-
|
|
22
20
|
// 导出TagInitInstance
|
|
23
21
|
export { TagInitInstance, useForceUpdate, withLocale };
|
|
24
22
|
export var useIntl = function useIntl() {
|
|
@@ -30,31 +28,29 @@ export var useIntl = function useIntl() {
|
|
|
30
28
|
var forceUpdate = useForceUpdate();
|
|
31
29
|
var _useState = useState(null),
|
|
32
30
|
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
failure = _useState2[0],
|
|
32
|
+
setFailure = _useState2[1];
|
|
35
33
|
useEffect(function () {
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
TagInitInstance.setCurrentLocale(
|
|
43
|
-
forceUpdate();
|
|
34
|
+
// 有组件注册过就不再注册
|
|
35
|
+
if (TagInitInstance.getCurrentLocale() === currentLocale) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
var active = true;
|
|
39
|
+
injectLocale(currentLocale, function (loadedLocale) {
|
|
40
|
+
TagInitInstance.setCurrentLocale(loadedLocale);
|
|
41
|
+
if (active) forceUpdate();
|
|
44
42
|
})["catch"](function (error) {
|
|
45
|
-
if (
|
|
46
|
-
// 在 render 阶段交给宿主 ErrorBoundary,不能静默展示其他地区文案。
|
|
47
|
-
setLocaleError({
|
|
43
|
+
if (active) setFailure({
|
|
48
44
|
locale: currentLocale,
|
|
49
45
|
error: error
|
|
50
46
|
});
|
|
51
47
|
});
|
|
52
48
|
return function () {
|
|
53
|
-
|
|
49
|
+
active = false;
|
|
54
50
|
};
|
|
55
51
|
}, [currentLocale]);
|
|
56
|
-
if (
|
|
57
|
-
throw
|
|
52
|
+
if (failure && failure.locale === currentLocale) {
|
|
53
|
+
throw failure.error;
|
|
58
54
|
}
|
|
59
55
|
return intl;
|
|
60
56
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function useForceUpdate(): () => void;
|
|
2
|
+
export function injectLocale(currentLocale: any, cb?: () => void): any;
|
|
3
|
+
export const TagInitInstance: TagInit;
|
|
4
|
+
export default IntlInstance;
|
|
5
|
+
declare class TagInit {
|
|
6
|
+
currentLocale: string;
|
|
7
|
+
setCurrentLocale(currentLocale: any): void;
|
|
8
|
+
getCurrentLocale(): string;
|
|
9
|
+
}
|
|
10
|
+
declare const IntlInstance: ReactIntlUniversal;
|
|
11
|
+
import { ReactIntlUniversal } from "react-intl-universal";
|
package/lib/locales/intl.js
CHANGED
|
@@ -12,14 +12,9 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
12
12
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
13
13
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
14
14
|
import { useCallback, useState } from 'react';
|
|
15
|
-
import { normalizeLocale } from './
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// 1) 底层走 intl-messageformat v7,兼容 zh_CN 下划线 locale,避免外部 riu 2.14
|
|
19
|
-
// 拉入 v11 后 zh_CN 被判非法、ICU 变量不替换;
|
|
20
|
-
// 2) 与宿主共享类但不共享实例,不会污染宿主 @chaoswise/intl 单例的 init 状态。
|
|
21
|
-
import { intl } from '@chaoswise/intl';
|
|
22
|
-
var IntlInstance = new intl.constructor();
|
|
15
|
+
import { normalizeLocale } from './normalizeLocale';
|
|
16
|
+
import { ReactIntlUniversal } from 'react-intl-universal';
|
|
17
|
+
var IntlInstance = new ReactIntlUniversal();
|
|
23
18
|
var createNewObject = function createNewObject() {
|
|
24
19
|
return {};
|
|
25
20
|
};
|
|
@@ -48,67 +43,39 @@ var TagInit = /*#__PURE__*/function () {
|
|
|
48
43
|
return this.currentLocale;
|
|
49
44
|
}
|
|
50
45
|
}]);
|
|
51
|
-
}(); //
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
en_US: function en_US() {
|
|
57
|
-
return import('./en_US.json');
|
|
58
|
-
},
|
|
59
|
-
zh_TW: function zh_TW() {
|
|
60
|
-
return import('./zh_TW.json');
|
|
61
|
-
},
|
|
62
|
-
zh_HK: function zh_HK() {
|
|
63
|
-
return import('./zh_HK.json');
|
|
64
|
-
},
|
|
65
|
-
ja_JP: function ja_JP() {
|
|
66
|
-
return import('./ja_JP.json');
|
|
67
|
-
}
|
|
46
|
+
}(); // 支持范围独立于格式规范化。平台资源由构建工具收集为异步模块。
|
|
47
|
+
var supportedLocales = ['zh_CN', 'en_US', 'zh_TW', 'zh_HK', 'ja_JP'];
|
|
48
|
+
var loadLocaleFile = function loadLocaleFile(locale) {
|
|
49
|
+
return import("./".concat(locale, ".json"));
|
|
68
50
|
};
|
|
69
|
-
|
|
70
51
|
// 默认语言(不支持的语言时回退到此)
|
|
71
52
|
var DEFAULT_LOCALE = 'zh_CN';
|
|
72
|
-
|
|
73
|
-
// 多个组件共享同一实例:同语言复用请求,切换后旧请求不得再初始化实例。
|
|
74
|
-
var activeRequest = null;
|
|
75
53
|
export var injectLocale = function injectLocale(currentLocale) {
|
|
76
54
|
var cb = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
|
|
77
|
-
var locale = normalizeLocale(currentLocale);
|
|
78
|
-
if (activeRequest && activeRequest.locale === locale) {
|
|
79
|
-
var _request = activeRequest;
|
|
80
|
-
return _request.promise.then(function () {
|
|
81
|
-
if (activeRequest === _request) cb();
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
var request = {
|
|
85
|
-
locale: locale,
|
|
86
|
-
promise: null
|
|
87
|
-
};
|
|
88
|
-
activeRequest = request;
|
|
89
55
|
var initFunc = function initFunc(locale, data) {
|
|
90
56
|
return IntlInstance.init({
|
|
91
57
|
currentLocale: locale,
|
|
92
58
|
locales: _defineProperty({}, locale, data)
|
|
93
59
|
});
|
|
94
60
|
};
|
|
95
|
-
|
|
96
61
|
// 加载语言文件的函数
|
|
97
62
|
var _loadLocale = function loadLocale(locale) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return loader().then(function (res) {
|
|
101
|
-
if (activeRequest !== request) return;
|
|
63
|
+
if (supportedLocales.includes(locale)) {
|
|
64
|
+
return loadLocaleFile(locale).then(function (res) {
|
|
102
65
|
return initFunc(locale, res["default"]);
|
|
66
|
+
}).then(function () {
|
|
67
|
+
cb(locale);
|
|
68
|
+
return locale;
|
|
103
69
|
})["catch"](function (error) {
|
|
104
|
-
if (activeRequest !== request) return;
|
|
105
70
|
console.warn("Failed to load locale file for ".concat(locale, ":"), error);
|
|
106
|
-
//
|
|
107
|
-
if (locale === 'zh_HK')
|
|
108
|
-
|
|
71
|
+
// 繁体资源缺失不可伪装成简体初始化成功。
|
|
72
|
+
if (locale === 'zh_HK' || locale === 'zh_TW') {
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
109
75
|
if (locale !== DEFAULT_LOCALE) {
|
|
110
76
|
return _loadLocale(DEFAULT_LOCALE);
|
|
111
77
|
}
|
|
78
|
+
throw error;
|
|
112
79
|
});
|
|
113
80
|
} else {
|
|
114
81
|
// 如果语言不支持,回退到默认语言(中文)
|
|
@@ -116,14 +83,7 @@ export var injectLocale = function injectLocale(currentLocale) {
|
|
|
116
83
|
return _loadLocale(DEFAULT_LOCALE);
|
|
117
84
|
}
|
|
118
85
|
};
|
|
119
|
-
|
|
120
|
-
// 当前请求失败后允许错误边界重挂载、重新加载同一语言。
|
|
121
|
-
if (activeRequest === request) activeRequest = null;
|
|
122
|
-
throw error;
|
|
123
|
-
});
|
|
124
|
-
return request.promise.then(function () {
|
|
125
|
-
if (activeRequest === request) cb();
|
|
126
|
-
});
|
|
86
|
+
return _loadLocale(normalizeLocale(currentLocale));
|
|
127
87
|
};
|
|
128
88
|
export var TagInitInstance = new TagInit();
|
|
129
89
|
export default IntlInstance;
|
package/lib/locales/ja_JP.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"
|
|
1
|
+
{"19d6c313-9540-4042-b642-ebc6396ca0c7":"キャンセル","632edd96-893f-4599-b1a3-0406e2146010":"確認","99b301b7-f153-4861-8ca3-22371b6b95d9":"入力してください","e25f1462-c823-434a-a6b2-4258dd57930a":"多言語設定"}
|