fan-standard-comp 4.1.12 → 4.1.13
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/dist/fan-standard-comp.min.js +1 -1
- package/es/ButtonGroup/index.js +4 -2
- package/es/ConfigContext/index.d.ts +1 -1
- package/es/ConfigContext/index.js +2 -1
- package/es/FormComp/FieldComponent/RefactorTreeSelect.js +3 -1
- package/es/FormComp/FieldComponent/index.js +15 -12
- package/es/FormComp/Uploader/index.js +5 -3
- package/es/FormComp/VarTemplate/index.js +4 -2
- package/es/RefactorTree/index.js +3 -1
- package/es/StandardFilter/index.js +7 -5
- package/es/StandardForm/StepForm.js +11 -9
- package/es/StandardForm/index.js +4 -2
- package/es/StandardModal/index.js +4 -2
- package/es/StandardTable/index.js +13 -8
- package/es/hooks/use-language.d.ts +2 -0
- package/es/hooks/use-language.js +50 -0
- package/es/locales/bn-BD/settings.d.ts +22 -0
- package/es/locales/bn-BD/settings.js +24 -0
- package/es/locales/bn-BD.d.ts +23 -0
- package/es/locales/bn-BD.js +10 -0
- package/es/locales/en-US/settings.d.ts +29 -0
- package/es/locales/en-US/settings.js +31 -0
- package/es/locales/en-US.d.ts +30 -0
- package/es/locales/en-US.js +10 -0
- package/es/locales/fa-IR/settings.d.ts +22 -0
- package/es/locales/fa-IR/settings.js +24 -0
- package/es/locales/fa-IR.d.ts +23 -0
- package/es/locales/fa-IR.js +10 -0
- package/es/locales/id-ID/settings.d.ts +22 -0
- package/es/locales/id-ID/settings.js +24 -0
- package/es/locales/id-ID.d.ts +23 -0
- package/es/locales/id-ID.js +10 -0
- package/es/locales/ja-JP/settings.d.ts +22 -0
- package/es/locales/ja-JP/settings.js +24 -0
- package/es/locales/ja-JP.d.ts +23 -0
- package/es/locales/ja-JP.js +10 -0
- package/es/locales/pt-BR/settings.d.ts +22 -0
- package/es/locales/pt-BR/settings.js +24 -0
- package/es/locales/pt-BR.d.ts +23 -0
- package/es/locales/pt-BR.js +10 -0
- package/es/locales/zh-CN/settings.d.ts +29 -0
- package/es/locales/zh-CN/settings.js +31 -0
- package/es/locales/zh-CN.d.ts +30 -0
- package/es/locales/zh-CN.js +10 -0
- package/es/locales/zh-TW/settings.d.ts +22 -0
- package/es/locales/zh-TW/settings.js +24 -0
- package/es/locales/zh-TW.d.ts +22 -0
- package/es/locales/zh-TW.js +8 -0
- package/lib/ButtonGroup/index.js +4 -2
- package/lib/ConfigContext/index.d.ts +1 -1
- package/lib/ConfigContext/index.js +3 -1
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +3 -1
- package/lib/FormComp/FieldComponent/index.js +15 -12
- package/lib/FormComp/Uploader/index.js +5 -3
- package/lib/FormComp/VarTemplate/index.js +4 -2
- package/lib/RefactorTree/index.js +3 -1
- package/lib/StandardFilter/index.js +7 -5
- package/lib/StandardForm/StepForm.js +11 -9
- package/lib/StandardForm/index.js +4 -2
- package/lib/StandardModal/index.js +4 -2
- package/lib/StandardTable/index.js +13 -8
- package/lib/hooks/use-language.d.ts +2 -0
- package/lib/hooks/use-language.js +57 -0
- package/lib/locales/bn-BD/settings.d.ts +22 -0
- package/lib/locales/bn-BD/settings.js +30 -0
- package/lib/locales/bn-BD.d.ts +23 -0
- package/lib/locales/bn-BD.js +17 -0
- package/lib/locales/en-US/settings.d.ts +29 -0
- package/lib/locales/en-US/settings.js +37 -0
- package/lib/locales/en-US.d.ts +30 -0
- package/lib/locales/en-US.js +17 -0
- package/lib/locales/fa-IR/settings.d.ts +22 -0
- package/lib/locales/fa-IR/settings.js +30 -0
- package/lib/locales/fa-IR.d.ts +23 -0
- package/lib/locales/fa-IR.js +17 -0
- package/lib/locales/id-ID/settings.d.ts +22 -0
- package/lib/locales/id-ID/settings.js +30 -0
- package/lib/locales/id-ID.d.ts +23 -0
- package/lib/locales/id-ID.js +17 -0
- package/lib/locales/ja-JP/settings.d.ts +22 -0
- package/lib/locales/ja-JP/settings.js +30 -0
- package/lib/locales/ja-JP.d.ts +23 -0
- package/lib/locales/ja-JP.js +17 -0
- package/lib/locales/pt-BR/settings.d.ts +22 -0
- package/lib/locales/pt-BR/settings.js +30 -0
- package/lib/locales/pt-BR.d.ts +23 -0
- package/lib/locales/pt-BR.js +17 -0
- package/lib/locales/zh-CN/settings.d.ts +29 -0
- package/lib/locales/zh-CN/settings.js +37 -0
- package/lib/locales/zh-CN.d.ts +30 -0
- package/lib/locales/zh-CN.js +17 -0
- package/lib/locales/zh-TW/settings.d.ts +22 -0
- package/lib/locales/zh-TW/settings.js +30 -0
- package/lib/locales/zh-TW.d.ts +22 -0
- package/lib/locales/zh-TW.js +15 -0
- package/package.json +2 -2
package/es/ButtonGroup/index.js
CHANGED
|
@@ -30,10 +30,12 @@ import { removeNoPermission, btnIsDisabled } from "../utils/filterPermission";
|
|
|
30
30
|
import useStyle from "./styles";
|
|
31
31
|
import classNames from "classnames";
|
|
32
32
|
import { FanContext } from "../ConfigContext";
|
|
33
|
+
import { useLanguageObject } from "../hooks/use-language";
|
|
33
34
|
|
|
34
35
|
// 参数API
|
|
35
36
|
|
|
36
37
|
var ButtonGroup = function ButtonGroup(props) {
|
|
38
|
+
var lang = useLanguageObject(); // 当前使用的语言包
|
|
37
39
|
var InitFanContext = useContext(FanContext);
|
|
38
40
|
var providerConfig = InitFanContext['ButtonGroup'] || {}; // 使用上下文(全局配置)设置扩展的配置项
|
|
39
41
|
var _providerConfig$props = _objectSpread(_objectSpread({}, providerConfig), props),
|
|
@@ -451,7 +453,7 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
451
453
|
}, dropdownConfig), /*#__PURE__*/React.createElement(Button, {
|
|
452
454
|
type: "primary",
|
|
453
455
|
size: size
|
|
454
|
-
}, moreText || '更多', moreIcon || /*#__PURE__*/React.createElement(DownOutlined, null))) : /*#__PURE__*/React.createElement(Popconfirm, _extends({
|
|
456
|
+
}, moreText || (lang === null || lang === void 0 ? void 0 : lang['global.more.text']) || '更多', moreIcon || /*#__PURE__*/React.createElement(DownOutlined, null))) : /*#__PURE__*/React.createElement(Popconfirm, _extends({
|
|
455
457
|
placement: "topRight",
|
|
456
458
|
open: popVisibleIndex === rowParams.rowIndex,
|
|
457
459
|
icon: /*#__PURE__*/React.createElement(QuestionCircleOutlined, null),
|
|
@@ -492,7 +494,7 @@ var ButtonGroup = function ButtonGroup(props) {
|
|
|
492
494
|
placement: "bottomRight"
|
|
493
495
|
}, dropdownConfig), /*#__PURE__*/React.createElement("a", {
|
|
494
496
|
className: 'spec-button-group-text'
|
|
495
|
-
}, moreText || '更多', moreIcon || /*#__PURE__*/React.createElement(DownOutlined, null)))));
|
|
497
|
+
}, moreText || (lang === null || lang === void 0 ? void 0 : lang['global.more.text']) || '更多', moreIcon || /*#__PURE__*/React.createElement(DownOutlined, null)))));
|
|
496
498
|
}
|
|
497
499
|
return /*#__PURE__*/React.createElement("span", {
|
|
498
500
|
className: classNames(componentName, className || '', hashId),
|
|
@@ -5,6 +5,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import { createContext } from 'react';
|
|
8
|
+
import zhCN from 'antd/locale/zh_CN';
|
|
8
9
|
// import type { Locale } from '../locale';
|
|
9
10
|
|
|
10
11
|
// export type LocaleContextProps = Partial<Locale> & { exist?: boolean };
|
|
@@ -12,7 +13,7 @@ import { createContext } from 'react';
|
|
|
12
13
|
// const FanLocaleContext = createContext<LocaleContextProps | undefined>(undefined);
|
|
13
14
|
// const FanLocaleProvider = FanLocaleContext.Provider
|
|
14
15
|
var FanDefaultConfig = {
|
|
15
|
-
locale:
|
|
16
|
+
locale: zhCN // 格式替换成对象
|
|
16
17
|
};
|
|
17
18
|
var FanContext = /*#__PURE__*/createContext(_objectSpread({}, FanDefaultConfig));
|
|
18
19
|
var FanProvider = FanContext.Provider;
|
|
@@ -22,6 +22,7 @@ import { getParentNodes, getNodePaths } from "../../utils";
|
|
|
22
22
|
import { UpOutlined, DownOutlined } from "@ant-design/icons";
|
|
23
23
|
import useStyle from "./style/TreeSelect";
|
|
24
24
|
import classNames from 'classnames';
|
|
25
|
+
import { useLanguageObject } from "../../hooks/use-language";
|
|
25
26
|
var TreeNode = TreeSelect.TreeNode;
|
|
26
27
|
var RefactorTreeSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
27
28
|
var _props$treeData = props.treeData,
|
|
@@ -45,6 +46,7 @@ var RefactorTreeSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
45
46
|
_onSelect = props.onSelect,
|
|
46
47
|
labelInValue = props.labelInValue,
|
|
47
48
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
49
|
+
var lang = useLanguageObject(); // 当前使用的语言包
|
|
48
50
|
var componentName = 'refactor-tree-select';
|
|
49
51
|
var _useStyle = useStyle(componentName),
|
|
50
52
|
_useStyle2 = _slicedToArray(_useStyle, 2),
|
|
@@ -202,7 +204,7 @@ var RefactorTreeSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
202
204
|
}), pathNodes.length > 2 ? /*#__PURE__*/React.createElement("div", {
|
|
203
205
|
className: "toggle-icon",
|
|
204
206
|
onClick: togglePath
|
|
205
|
-
}, !showAllPath ? /*#__PURE__*/React.createElement(React.Fragment, null, "
|
|
207
|
+
}, !showAllPath ? /*#__PURE__*/React.createElement(React.Fragment, null, (lang === null || lang === void 0 ? void 0 : lang['field.expand']) || '展开', " ", /*#__PURE__*/React.createElement(DownOutlined, null)) : /*#__PURE__*/React.createElement(React.Fragment, null, (lang === null || lang === void 0 ? void 0 : lang['field.collapse']) || '收起', " ", /*#__PURE__*/React.createElement(UpOutlined, null))) : null));
|
|
206
208
|
} else {
|
|
207
209
|
return '-';
|
|
208
210
|
}
|
|
@@ -19,6 +19,7 @@ import ReUpload from "./ReUpload";
|
|
|
19
19
|
import ExtensionField from "./ExtensionField";
|
|
20
20
|
// import UploaderViewer from './UploaderViewer'
|
|
21
21
|
import { FanContext } from "../../ConfigContext";
|
|
22
|
+
import { useLanguageObject } from "../../hooks/use-language";
|
|
22
23
|
var TextArea = Input.TextArea,
|
|
23
24
|
Password = Input.Password;
|
|
24
25
|
var Option = Select.Option;
|
|
@@ -27,6 +28,7 @@ var RangePicker = DatePicker.RangePicker;
|
|
|
27
28
|
// @ts-ignore
|
|
28
29
|
var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
29
30
|
var InitFanContext = useContext(FanContext);
|
|
31
|
+
var lang = useLanguageObject(); // 当前使用的语言包
|
|
30
32
|
var providerConfig = InitFanContext['Field'] || {}; // 使用上下文(全局配置)设置扩展的配置项
|
|
31
33
|
var _providerConfig$props = _objectSpread(_objectSpread({}, providerConfig), props),
|
|
32
34
|
type = _providerConfig$props.type,
|
|
@@ -101,11 +103,12 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
101
103
|
}
|
|
102
104
|
// 设置纯展示模式下的“下拉树”控件返回值
|
|
103
105
|
var viewOnly = fieldStatus === 'viewOnly'; // 是否纯展示
|
|
104
|
-
|
|
106
|
+
// 输入框显示的placeholder
|
|
107
|
+
var inputPlaceholder = fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || (lang === null || lang === void 0 ? void 0 : lang['field.input.placeholder']) || '请输入';
|
|
105
108
|
switch (type) {
|
|
106
109
|
case 'input':
|
|
107
110
|
compContent = viewOnly ? value || '-' : /*#__PURE__*/React.createElement(Input, _extends({
|
|
108
|
-
placeholder:
|
|
111
|
+
placeholder: inputPlaceholder,
|
|
109
112
|
autoComplete: "off",
|
|
110
113
|
title: fieldStatus === 'disabled' || defaultProps.disabled ? value : null,
|
|
111
114
|
maxLength: defaultProps.maxLength || 50
|
|
@@ -122,7 +125,7 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
122
125
|
case 'password':
|
|
123
126
|
compContent = viewOnly ? value ? "\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF" : '-' : /*#__PURE__*/React.createElement(Password, _extends({
|
|
124
127
|
autoComplete: "off",
|
|
125
|
-
placeholder:
|
|
128
|
+
placeholder: inputPlaceholder,
|
|
126
129
|
maxLength: defaultProps.maxLength || 50
|
|
127
130
|
}, defaultProps, {
|
|
128
131
|
style: _objectSpread(_objectSpread({}, defaultStyle), defaultProps.style)
|
|
@@ -130,7 +133,7 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
130
133
|
break;
|
|
131
134
|
case 'textarea':
|
|
132
135
|
compContent = viewOnly ? value || '-' : /*#__PURE__*/React.createElement(TextArea, _extends({
|
|
133
|
-
placeholder:
|
|
136
|
+
placeholder: inputPlaceholder,
|
|
134
137
|
maxLength: defaultProps.maxLength || 500,
|
|
135
138
|
title: fieldStatus === 'disabled' || defaultProps.disabled ? value : null
|
|
136
139
|
}, defaultProps, {
|
|
@@ -139,7 +142,7 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
139
142
|
break;
|
|
140
143
|
case 'inputNumber':
|
|
141
144
|
compContent = viewOnly ? value || 0 : /*#__PURE__*/React.createElement(InputNumber, _extends({
|
|
142
|
-
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请输入数字'
|
|
145
|
+
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || (lang === null || lang === void 0 ? void 0 : lang['field.inputNumber.placeholder']) || '请输入数字'
|
|
143
146
|
}, sortLimitRule, defaultProps, {
|
|
144
147
|
style: _objectSpread(_objectSpread({}, defaultStyle), defaultProps.style) // 去掉width: '120px',
|
|
145
148
|
}));
|
|
@@ -165,7 +168,7 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
165
168
|
type: type
|
|
166
169
|
}) : /*#__PURE__*/React.createElement(Select, _extends({
|
|
167
170
|
allowClear: true,
|
|
168
|
-
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || "".concat(defaultProps.showSearch ? '请输入选择' : '请选择'),
|
|
171
|
+
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || "".concat(defaultProps.showSearch ? (lang === null || lang === void 0 ? void 0 : lang['field.select.search.placeholder']) || '请输入选择' : (lang === null || lang === void 0 ? void 0 : lang['field.select.placeholder']) || '请选择'),
|
|
169
172
|
filterOption: function filterOption(inputValue, option) {
|
|
170
173
|
var _defaultProps$fieldNa;
|
|
171
174
|
return defaultProps.showSearch ? ((option === null || option === void 0 ? void 0 : option[(defaultProps === null || defaultProps === void 0 || (_defaultProps$fieldNa = defaultProps.fieldNames) === null || _defaultProps$fieldNa === void 0 ? void 0 : _defaultProps$fieldNa.label) || (selectOptionName === null || selectOptionName === void 0 ? void 0 : selectOptionName.label) || 'label']) || '').toLowerCase().includes(inputValue.toLowerCase()) : false;
|
|
@@ -193,7 +196,7 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
193
196
|
allowClear: true,
|
|
194
197
|
separator: separator,
|
|
195
198
|
showFullLevel: showFullLevel,
|
|
196
|
-
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请选择',
|
|
199
|
+
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || (lang === null || lang === void 0 ? void 0 : lang['field.select.placeholder']) || '请选择',
|
|
197
200
|
protoTreeNode: protoConfig && protoConfig.TreeNode || {},
|
|
198
201
|
fieldStatus: fieldStatus,
|
|
199
202
|
disabledFields: disabledFields
|
|
@@ -253,7 +256,7 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
253
256
|
protoConfig: protoConfig
|
|
254
257
|
}) : /*#__PURE__*/React.createElement(DatePicker, _extends({
|
|
255
258
|
showTime: defaultProps.showTime || type === 'dateTimePicker',
|
|
256
|
-
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请选择'
|
|
259
|
+
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || (lang === null || lang === void 0 ? void 0 : lang['field.calendar.placeholder']) || '请选择'
|
|
257
260
|
}, defaultProps, {
|
|
258
261
|
style: _objectSpread(_objectSpread({
|
|
259
262
|
width: 'auto'
|
|
@@ -305,9 +308,9 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
305
308
|
name: "plus"
|
|
306
309
|
}), /*#__PURE__*/React.createElement("div", {
|
|
307
310
|
className: "ant-upload-text"
|
|
308
|
-
},
|
|
311
|
+
}, (lang === null || lang === void 0 ? void 0 : lang['field.upload.select']) || '点击选择')) : /*#__PURE__*/React.createElement(Button, null, /*#__PURE__*/React.createElement(SpecIcon, {
|
|
309
312
|
name: "upload"
|
|
310
|
-
}), "
|
|
313
|
+
}), " ", (lang === null || lang === void 0 ? void 0 : lang['field.upload.import']) || '点击上传')));
|
|
311
314
|
break;
|
|
312
315
|
case 'uploader':
|
|
313
316
|
// compContent = viewOnly ? <UploaderViewer value={value}/> : <Uploader {...defaultProps} size={protoConfig?.size}/>
|
|
@@ -325,7 +328,7 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
325
328
|
options: selectOptions,
|
|
326
329
|
allowClear: true,
|
|
327
330
|
fieldNames: (defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.fieldNames) || selectOptionName,
|
|
328
|
-
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || '请选择'
|
|
331
|
+
placeholder: fieldStatus === 'disabled' || defaultProps.disabled ? '' : defaultProps.placeholder || placeholder || (lang === null || lang === void 0 ? void 0 : lang['field.select.placeholder']) || '请选择'
|
|
329
332
|
}, defaultProps, {
|
|
330
333
|
style: _objectSpread(_objectSpread({}, defaultStyle), defaultProps.style)
|
|
331
334
|
}));
|
|
@@ -347,7 +350,7 @@ var FieldComponent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
347
350
|
break;
|
|
348
351
|
case 'mentions':
|
|
349
352
|
compContent = viewOnly ? value : /*#__PURE__*/React.createElement(Mentions, _extends({
|
|
350
|
-
placeholder: "
|
|
353
|
+
placeholder: "".concat((lang === null || lang === void 0 ? void 0 : lang['field.mentions.input.placeholder']) || '请输入', " ").concat(defaultProps.prefix || '@', " ").concat((lang === null || lang === void 0 ? void 0 : lang['field.mentions.select.placeholder']) || '选择', " "),
|
|
351
354
|
options: (selectOptions || []).map(function (val) {
|
|
352
355
|
return _objectSpread(_objectSpread({}, val), {}, {
|
|
353
356
|
label: selectOptionRender ? selectOptionRender(val) : val.label
|
|
@@ -31,7 +31,9 @@ import { createPortal } from 'react-dom';
|
|
|
31
31
|
import "./style/index.less";
|
|
32
32
|
import ImagePreview from "../../ImageGallery/ImagePreview";
|
|
33
33
|
import ImgCrop from 'antd-img-crop';
|
|
34
|
+
import { useLanguageObject } from "../../hooks/use-language";
|
|
34
35
|
var Uploader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
36
|
+
var lang = useLanguageObject(); // 当前使用的语言包
|
|
35
37
|
var accept = props.accept,
|
|
36
38
|
extraExt = props.extraExt,
|
|
37
39
|
fileType = props.fileType,
|
|
@@ -321,7 +323,7 @@ var Uploader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
321
323
|
_context3.next = 4;
|
|
322
324
|
break;
|
|
323
325
|
}
|
|
324
|
-
message.error("
|
|
326
|
+
message.error("".concat((lang === null || lang === void 0 ? void 0 : lang['filed.upload.limit.tips']) || '文件大小不能超过 ').concat(Math.round(size / 1024 / 1024 * 100) / 100, "MB!"));
|
|
325
327
|
// 如果直接返回false或者true,还是会触发额外的onChange,所以需要改成 Upload.LIST_IGNORE
|
|
326
328
|
return _context3.abrupt("return", Upload.LIST_IGNORE);
|
|
327
329
|
case 4:
|
|
@@ -459,11 +461,11 @@ var Uploader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
459
461
|
className: 'spec-uploader-control'
|
|
460
462
|
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("div", {
|
|
461
463
|
className: "ant-upload-text"
|
|
462
|
-
},
|
|
464
|
+
}, (lang === null || lang === void 0 ? void 0 : lang['field.upload.select']) || '点击选择'));
|
|
463
465
|
}
|
|
464
466
|
return /*#__PURE__*/React.createElement(Button, {
|
|
465
467
|
className: 'spec-uploader-button'
|
|
466
|
-
}, /*#__PURE__*/React.createElement(PlusOutlined, null),
|
|
468
|
+
}, /*#__PURE__*/React.createElement(PlusOutlined, null), (lang === null || lang === void 0 ? void 0 : lang['field.upload.select']) || '点击选择');
|
|
467
469
|
};
|
|
468
470
|
if (maxCountLimit && uploaderFileList.length === maxCountLimit) {
|
|
469
471
|
return null;
|
|
@@ -15,6 +15,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
15
15
|
*/
|
|
16
16
|
import React, { useRef, useState, useEffect, useCallback } from 'react';
|
|
17
17
|
import { Input, Tag } from 'antd';
|
|
18
|
+
import { useLanguageObject } from "../../hooks/use-language";
|
|
18
19
|
var TextArea = Input.TextArea;
|
|
19
20
|
var isIE = !!document.all;
|
|
20
21
|
var VarTemplate = function VarTemplate(props) {
|
|
@@ -32,6 +33,7 @@ var VarTemplate = function VarTemplate(props) {
|
|
|
32
33
|
} : _props$tagsOptionName,
|
|
33
34
|
showCountTip = props.showCountTip,
|
|
34
35
|
onChange = props.onChange;
|
|
36
|
+
var lang = useLanguageObject(); // 当前使用的语言包
|
|
35
37
|
var contentRef = useRef();
|
|
36
38
|
var _useState = useState({
|
|
37
39
|
currentContent: '',
|
|
@@ -258,7 +260,7 @@ var VarTemplate = function VarTemplate(props) {
|
|
|
258
260
|
, {
|
|
259
261
|
size: size,
|
|
260
262
|
value: vartData.currentContent,
|
|
261
|
-
placeholder: "
|
|
263
|
+
placeholder: (lang === null || lang === void 0 ? void 0 : lang['field.input.placeholder']) || "请输入",
|
|
262
264
|
onFocus: handleFocus,
|
|
263
265
|
onBlur: handleBlur,
|
|
264
266
|
onChange: function onChange(e) {
|
|
@@ -271,6 +273,6 @@ var VarTemplate = function VarTemplate(props) {
|
|
|
271
273
|
marginTop: '4px',
|
|
272
274
|
fontSize: '12px'
|
|
273
275
|
}
|
|
274
|
-
},
|
|
276
|
+
}, (lang === null || lang === void 0 ? void 0 : lang['filed.varTemplate.enter']) || '您已录入', " ", /*#__PURE__*/React.createElement("b", null, vartData.wordCount), " ", (lang === null || lang === void 0 ? void 0 : lang['filed.varTemplate.words']) || '个字'));
|
|
275
277
|
};
|
|
276
278
|
export default VarTemplate;
|
package/es/RefactorTree/index.js
CHANGED
|
@@ -14,10 +14,12 @@ import { Tree, Empty, Popconfirm } from 'antd';
|
|
|
14
14
|
import SpecIcon from "../SpecIcon/index";
|
|
15
15
|
import { transDataParam, resetDataWithLimit, resetDataWithDisabled } from "./util";
|
|
16
16
|
import "./style/index.less";
|
|
17
|
+
import { useLanguageObject } from "../hooks/use-language";
|
|
17
18
|
|
|
18
19
|
// @ts-ignore
|
|
19
20
|
|
|
20
21
|
var RefactorTree = function RefactorTree(props) {
|
|
22
|
+
var lang = useLanguageObject(); // 当前使用的语言包
|
|
21
23
|
var treeData = props.treeData,
|
|
22
24
|
rootName = props.rootName,
|
|
23
25
|
rootKey = props.rootKey,
|
|
@@ -107,7 +109,7 @@ var RefactorTree = function RefactorTree(props) {
|
|
|
107
109
|
name: 'edit'
|
|
108
110
|
})), /*#__PURE__*/React.createElement(Popconfirm, {
|
|
109
111
|
placement: 'top',
|
|
110
|
-
title: "\
|
|
112
|
+
title: "".concat((lang === null || lang === void 0 ? void 0 : lang['global.delete.confirm']) || '确定要删除', "\uFF1A").concat(item[optionName.title || 'title'], "\uFF1F"),
|
|
111
113
|
icon: /*#__PURE__*/React.createElement(SpecIcon, {
|
|
112
114
|
name: "question"
|
|
113
115
|
}),
|
|
@@ -23,8 +23,10 @@ import { FanContext } from "../ConfigContext";
|
|
|
23
23
|
import dayjs from "dayjs";
|
|
24
24
|
import useStyle from "./style/FilterStyle";
|
|
25
25
|
import SpecIcon from "../SpecIcon";
|
|
26
|
+
import { useLanguageObject } from "../hooks/use-language";
|
|
26
27
|
var FormItem = Form.Item;
|
|
27
28
|
var StandardFilter = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
29
|
+
var lang = useLanguageObject(); // 当前使用的语言包
|
|
28
30
|
var InitFanContext = useContext(FanContext);
|
|
29
31
|
var providerConfig = InitFanContext['StandardFilter'] || {}; // 使用上下文(全局配置)设置扩展的配置项
|
|
30
32
|
var _providerConfig$props = _objectSpread(_objectSpread({}, providerConfig), props),
|
|
@@ -142,9 +144,9 @@ var StandardFilter = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
142
144
|
var formValues = filterFormRef === null || filterFormRef === void 0 ? void 0 : filterFormRef.getFieldValue();
|
|
143
145
|
var colsArr = [];
|
|
144
146
|
groups.forEach(function (gItem) {
|
|
145
|
-
if (!(gItem !== null && gItem !== void 0 && gItem.isHidden || (gItem.hasOwnProperty('isHide') ? gItem.isHide(_objectSpread({}, formValues), _objectSpread({
|
|
147
|
+
if (!(gItem !== null && gItem !== void 0 && gItem.isHidden || (gItem.hasOwnProperty('isHide') ? typeof gItem.isHide === 'function' ? gItem.isHide(_objectSpread({}, formValues), _objectSpread({
|
|
146
148
|
current: filterFormRef
|
|
147
|
-
}, filterFormRef)) : false))) {
|
|
149
|
+
}, filterFormRef)) : gItem.isHide : false))) {
|
|
148
150
|
if (gItem.hasOwnProperty('colSpan')) {
|
|
149
151
|
colsArr.push(gItem.colSpan);
|
|
150
152
|
} else {
|
|
@@ -251,7 +253,7 @@ var StandardFilter = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
251
253
|
},
|
|
252
254
|
onClick: handleReset,
|
|
253
255
|
ghost: true
|
|
254
|
-
}, cancelButtonProps), cancelText || '重置');
|
|
256
|
+
}, cancelButtonProps), cancelText || (lang === null || lang === void 0 ? void 0 : lang['filter.reset']) || '重置');
|
|
255
257
|
}
|
|
256
258
|
if (item === 'confirm') {
|
|
257
259
|
return onFilterSearch && /*#__PURE__*/React.createElement(Button, _extends({
|
|
@@ -261,7 +263,7 @@ var StandardFilter = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
261
263
|
marginLeft: 8
|
|
262
264
|
},
|
|
263
265
|
htmlType: "submit"
|
|
264
|
-
}, confirmButtonProps), confirmText || '查询');
|
|
266
|
+
}, confirmButtonProps), confirmText || (lang === null || lang === void 0 ? void 0 : lang['filter.submit']) || '查询');
|
|
265
267
|
}
|
|
266
268
|
if (item === 'collapse') {
|
|
267
269
|
return filterFormLayout === 'horizontal' && collapseable && reFormItemGroup.length > columnNumberAndSize.columnNumber - 1 ? /*#__PURE__*/React.createElement(Button, {
|
|
@@ -275,7 +277,7 @@ var StandardFilter = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
275
277
|
paddingInlineStart: 0,
|
|
276
278
|
paddingInlineEnd: 0
|
|
277
279
|
}
|
|
278
|
-
}, collapsed ? '收起' : '展开', /*#__PURE__*/React.createElement(SpecIcon, {
|
|
280
|
+
}, collapsed ? (lang === null || lang === void 0 ? void 0 : lang['field.collapse']) || '收起' : (lang === null || lang === void 0 ? void 0 : lang['field.expand']) || '展开', /*#__PURE__*/React.createElement(SpecIcon, {
|
|
279
281
|
noPrefix: true,
|
|
280
282
|
name: collapsed ? 'speci-up' : 'speci-down'
|
|
281
283
|
})) : null;
|
|
@@ -19,9 +19,11 @@ import ActionList from "./ActionList";
|
|
|
19
19
|
import "./style/index.less";
|
|
20
20
|
import classNames from 'classnames';
|
|
21
21
|
import { FanContext } from "../ConfigContext";
|
|
22
|
+
import { useLanguageObject } from "../hooks/use-language";
|
|
22
23
|
// import { BreadcrumbProps as AntdBreadcrumbProps } from 'antd/es/form';
|
|
23
24
|
var Step = Steps.Step;
|
|
24
25
|
var StepForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
26
|
+
var lang = useLanguageObject(); // 当前使用的语言包
|
|
25
27
|
var InitFanContext = useContext(FanContext);
|
|
26
28
|
var providerConfig = InitFanContext['StepForm'] || {}; // 使用上下文(全局配置)设置扩展的配置项
|
|
27
29
|
var _providerConfig$props = _objectSpread(_objectSpread({}, providerConfig), props),
|
|
@@ -139,11 +141,11 @@ var StepForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
139
141
|
onClick: function onClick() {
|
|
140
142
|
return handleStepType('submit');
|
|
141
143
|
}
|
|
142
|
-
},
|
|
144
|
+
}, (lang === null || lang === void 0 ? void 0 : lang['global.confirm.text']) || '确认'), /*#__PURE__*/React.createElement(Button, {
|
|
143
145
|
onClick: function onClick() {
|
|
144
146
|
return handleStepType('cancel');
|
|
145
147
|
}
|
|
146
|
-
},
|
|
148
|
+
}, (lang === null || lang === void 0 ? void 0 : lang['global.cancel.text']) || '取消'));
|
|
147
149
|
}
|
|
148
150
|
var buttonList = function buttonList(itemIndex) {
|
|
149
151
|
if (itemIndex === 0) {
|
|
@@ -152,11 +154,11 @@ var StepForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
152
154
|
onClick: function onClick() {
|
|
153
155
|
return handleStepType('next');
|
|
154
156
|
}
|
|
155
|
-
},
|
|
157
|
+
}, (lang === null || lang === void 0 ? void 0 : lang['global.next.text']) || '下一步'), /*#__PURE__*/React.createElement(Button, {
|
|
156
158
|
onClick: function onClick() {
|
|
157
159
|
return handleStepType('cancel');
|
|
158
160
|
}
|
|
159
|
-
},
|
|
161
|
+
}, (lang === null || lang === void 0 ? void 0 : lang['global.cancel.text']) || '取消'));
|
|
160
162
|
} else if (itemIndex === formItemGroup.length - 1) {
|
|
161
163
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
162
164
|
type: "primary",
|
|
@@ -169,27 +171,27 @@ var StepForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
169
171
|
onClick: function onClick() {
|
|
170
172
|
return handleStepType('submit');
|
|
171
173
|
}
|
|
172
|
-
},
|
|
174
|
+
}, (lang === null || lang === void 0 ? void 0 : lang['global.confirm.text']) || '确认'), /*#__PURE__*/React.createElement(Button, {
|
|
173
175
|
onClick: function onClick() {
|
|
174
176
|
return handleStepType('cancel');
|
|
175
177
|
}
|
|
176
|
-
},
|
|
178
|
+
}, (lang === null || lang === void 0 ? void 0 : lang['global.cancel.text']) || '取消'));
|
|
177
179
|
} else {
|
|
178
180
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
179
181
|
type: "primary",
|
|
180
182
|
onClick: function onClick() {
|
|
181
183
|
return handleStepType('prev');
|
|
182
184
|
}
|
|
183
|
-
},
|
|
185
|
+
}, (lang === null || lang === void 0 ? void 0 : lang['global.prev.text']) || '上一步'), /*#__PURE__*/React.createElement(Button, {
|
|
184
186
|
type: "primary",
|
|
185
187
|
onClick: function onClick() {
|
|
186
188
|
return handleStepType('next');
|
|
187
189
|
}
|
|
188
|
-
},
|
|
190
|
+
}, (lang === null || lang === void 0 ? void 0 : lang['global.next.text']) || '下一步'), /*#__PURE__*/React.createElement(Button, {
|
|
189
191
|
onClick: function onClick() {
|
|
190
192
|
return handleStepType('cancel');
|
|
191
193
|
}
|
|
192
|
-
},
|
|
194
|
+
}, (lang === null || lang === void 0 ? void 0 : lang['global.cancel.text']) || '取消'));
|
|
193
195
|
}
|
|
194
196
|
};
|
|
195
197
|
return /*#__PURE__*/React.createElement("div", {
|
package/es/StandardForm/index.js
CHANGED
|
@@ -24,7 +24,9 @@ import ActionList from "./ActionList";
|
|
|
24
24
|
import useStyle from "./style/index";
|
|
25
25
|
import { FanContext } from "../ConfigContext";
|
|
26
26
|
import { UtilValueFormat } from "../utils";
|
|
27
|
+
import { useLanguageObject } from "../hooks/use-language";
|
|
27
28
|
var StandardForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
29
|
+
var lang = useLanguageObject(); // 当前使用的语言包
|
|
28
30
|
var InitFanContext = useContext(FanContext);
|
|
29
31
|
var providerConfig = InitFanContext['StandardForm'] || {}; // 使用上下文(全局配置)设置扩展的配置项
|
|
30
32
|
var ConcatFormProps = _objectSpread(_objectSpread({}, providerConfig), props);
|
|
@@ -154,12 +156,12 @@ var StandardForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
154
156
|
type: "primary",
|
|
155
157
|
htmlType: "submit",
|
|
156
158
|
size: fieldSize
|
|
157
|
-
}, confirmButtonProps), confirmText), cancelText && /*#__PURE__*/React.createElement(Button, _extends({
|
|
159
|
+
}, confirmButtonProps), (lang === null || lang === void 0 ? void 0 : lang['global.confirm.text']) || confirmText), cancelText && /*#__PURE__*/React.createElement(Button, _extends({
|
|
158
160
|
onClick: function onClick() {
|
|
159
161
|
return onFormCancel();
|
|
160
162
|
},
|
|
161
163
|
size: fieldSize
|
|
162
|
-
}, cancelButtonProps), cancelText));
|
|
164
|
+
}, cancelButtonProps), (lang === null || lang === void 0 ? void 0 : lang['global.cancel.text']) || cancelText));
|
|
163
165
|
};
|
|
164
166
|
return wrapSSR( /*#__PURE__*/React.createElement(Form, _extends({
|
|
165
167
|
className: classNames(componentName, 'standardForm', layout ? "standard-form-".concat(layout) : '', className, hashId),
|
|
@@ -31,12 +31,14 @@ import useStyle from "./style/index";
|
|
|
31
31
|
import classNames from "classnames";
|
|
32
32
|
import { FanContext } from "../ConfigContext";
|
|
33
33
|
import "./style/index.less";
|
|
34
|
+
import { useLanguageObject } from "../hooks/use-language";
|
|
34
35
|
var StandardModal = function StandardModal(props) {
|
|
35
36
|
var componentName = 'spec-standard-modal';
|
|
36
37
|
var _useStyle = useStyle(componentName),
|
|
37
38
|
_useStyle2 = _slicedToArray(_useStyle, 2),
|
|
38
39
|
wrapSSR = _useStyle2[0],
|
|
39
40
|
hashId = _useStyle2[1];
|
|
41
|
+
var lang = useLanguageObject(); // 当前使用的语言包
|
|
40
42
|
var InitFanContext = useContext(FanContext);
|
|
41
43
|
var providerConfig = InitFanContext['StandardModal'] || {}; // 使用上下文(全局配置)设置扩展的配置项
|
|
42
44
|
var ConcatModalProps = _objectSpread(_objectSpread({}, providerConfig), props);
|
|
@@ -390,10 +392,10 @@ var StandardModal = function StandardModal(props) {
|
|
|
390
392
|
type: 'primary',
|
|
391
393
|
loading: confirmLoading,
|
|
392
394
|
onClick: handleSubmit
|
|
393
|
-
}, confirmButtonProps, okButtonProps), confirmText || okText || '确定'), /*#__PURE__*/React.createElement(Button, _extends({
|
|
395
|
+
}, confirmButtonProps, okButtonProps), confirmText || okText || (lang === null || lang === void 0 ? void 0 : lang['global.confirm.text']) || '确定'), /*#__PURE__*/React.createElement(Button, _extends({
|
|
394
396
|
key: "back",
|
|
395
397
|
onClick: handleCancel
|
|
396
|
-
}, cancelButtonProps), cancelText || '取消'));
|
|
398
|
+
}, cancelButtonProps), cancelText || (lang === null || lang === void 0 ? void 0 : lang['global.cancel.text']) || '取消'));
|
|
397
399
|
};
|
|
398
400
|
var renderFooter = function renderFooter() {
|
|
399
401
|
if (type === 'stepForm') {
|
|
@@ -22,8 +22,12 @@ import "./style/index.less";
|
|
|
22
22
|
import { FanContext } from "../ConfigContext";
|
|
23
23
|
import _ from 'lodash';
|
|
24
24
|
import useStyle from "./style/index";
|
|
25
|
+
import { useLanguageObject } from "../hooks/use-language";
|
|
25
26
|
var StandardTable = function StandardTable(props) {
|
|
27
|
+
var _InitFanContext$local;
|
|
28
|
+
var lang = useLanguageObject(); // 当前使用的语言包
|
|
26
29
|
var InitFanContext = useContext(FanContext);
|
|
30
|
+
var language = (InitFanContext === null || InitFanContext === void 0 || (_InitFanContext$local = InitFanContext.locale) === null || _InitFanContext$local === void 0 ? void 0 : _InitFanContext$local.locale) || 'zh-CN';
|
|
27
31
|
var providerConfig = InitFanContext['StandardTable'] || {}; // 使用上下文(全局配置)设置扩展的配置项
|
|
28
32
|
|
|
29
33
|
var componentName = 'spec-standard-table';
|
|
@@ -60,9 +64,9 @@ var StandardTable = function StandardTable(props) {
|
|
|
60
64
|
rest = _objectWithoutProperties(_providerConfig$props, _excluded);
|
|
61
65
|
// 加上类型修复 TS:2322 报警
|
|
62
66
|
var resetColumns = [_objectSpread(_objectSpread({
|
|
63
|
-
width: 76,
|
|
67
|
+
width: language === 'en' || language === 'en-US' ? 100 : 76,
|
|
64
68
|
align: 'center',
|
|
65
|
-
title: '序号',
|
|
69
|
+
title: (lang === null || lang === void 0 ? void 0 : lang['table.column.order']) || '序号',
|
|
66
70
|
key: 'orderNum',
|
|
67
71
|
// fixed: 'left',
|
|
68
72
|
// render: (text, o, index) => pagination ? (pagination.current - 1) * pagination.pageSize + index + 1 : index + 1,
|
|
@@ -91,7 +95,7 @@ var StandardTable = function StandardTable(props) {
|
|
|
91
95
|
var _colItem, _colItem2, _colItem3;
|
|
92
96
|
colItem.width = ((_colItem = colItem) === null || _colItem === void 0 ? void 0 : _colItem.width) || (action === null || action === void 0 ? void 0 : action.width) || (colItem.buttonGroup.length > 1 ? 130 : 80);
|
|
93
97
|
colItem.align = ((_colItem2 = colItem) === null || _colItem2 === void 0 ? void 0 : _colItem2.align) || (action === null || action === void 0 ? void 0 : action.align) || 'center';
|
|
94
|
-
colItem.title = ((_colItem3 = colItem) === null || _colItem3 === void 0 ? void 0 : _colItem3.title) || (action === null || action === void 0 ? void 0 : action.title) || '操作';
|
|
98
|
+
colItem.title = ((_colItem3 = colItem) === null || _colItem3 === void 0 ? void 0 : _colItem3.title) || (action === null || action === void 0 ? void 0 : action.title) || (lang === null || lang === void 0 ? void 0 : lang['table.column.action']) || '操作';
|
|
95
99
|
colItem.key = 'control';
|
|
96
100
|
colItem = _objectSpread(_objectSpread(_objectSpread({}, action || {}), colItem), {}, {
|
|
97
101
|
ellipsis: false
|
|
@@ -188,11 +192,12 @@ var StandardTable = function StandardTable(props) {
|
|
|
188
192
|
var placeTitle = title ? /*#__PURE__*/React.createElement("span", {
|
|
189
193
|
className: 'ant-card-head-title-name'
|
|
190
194
|
}, title) : null;
|
|
195
|
+
var notShowHead = !extra && !placeButtonGroup && !placeTitle; // 不显示ant-card-head
|
|
191
196
|
return wrapSSR( /*#__PURE__*/React.createElement(Card, {
|
|
192
197
|
className: classNames(componentName, 'standard-table', className, hashId),
|
|
193
198
|
bordered: false,
|
|
194
|
-
title: buttonGroupPlacement === 'left' ? /*#__PURE__*/React.createElement(React.Fragment, null, placeTitle, placeButtonGroup) : placeTitle,
|
|
195
|
-
extra: buttonGroupPlacement === 'left' ? extra : /*#__PURE__*/React.createElement(React.Fragment, null, placeButtonGroup, extra)
|
|
199
|
+
title: notShowHead ? null : buttonGroupPlacement === 'left' ? /*#__PURE__*/React.createElement(React.Fragment, null, placeTitle, placeButtonGroup) : placeTitle,
|
|
200
|
+
extra: notShowHead ? null : buttonGroupPlacement === 'left' ? extra : /*#__PURE__*/React.createElement(React.Fragment, null, placeButtonGroup, extra)
|
|
196
201
|
}, /*#__PURE__*/React.createElement(Table, _extends({
|
|
197
202
|
rowKey: rowKey || 'id',
|
|
198
203
|
rowSelection: rowSelection ? _objectSpread({
|
|
@@ -202,9 +207,9 @@ var StandardTable = function StandardTable(props) {
|
|
|
202
207
|
pagination: !pagination ? false : paginationProps,
|
|
203
208
|
columns: resetColumns,
|
|
204
209
|
locale: {
|
|
205
|
-
filterConfirm: '确定',
|
|
206
|
-
filterReset: '重置',
|
|
207
|
-
emptyText: emptyText || '暂无数据'
|
|
210
|
+
filterConfirm: (lang === null || lang === void 0 ? void 0 : lang['global.confirm.text']) || '确定',
|
|
211
|
+
filterReset: (lang === null || lang === void 0 ? void 0 : lang['global.reset.text']) || '重置',
|
|
212
|
+
emptyText: emptyText || (lang === null || lang === void 0 ? void 0 : lang['global.empty.text']) || '暂无数据'
|
|
208
213
|
}
|
|
209
214
|
}, rest, {
|
|
210
215
|
// @ts-ignore
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { useContext } from "react";
|
|
8
|
+
import { FanContext } from "../ConfigContext";
|
|
9
|
+
import bnBD from "../locales/bn-BD";
|
|
10
|
+
import enUS from "../locales/en-US";
|
|
11
|
+
import faIR from "../locales/fa-IR";
|
|
12
|
+
import idID from "../locales/id-ID";
|
|
13
|
+
import jaJP from "../locales/ja-JP";
|
|
14
|
+
import ptBR from "../locales/pt-BR";
|
|
15
|
+
import zhCN from "../locales/zh-CN";
|
|
16
|
+
import zhTW from "../locales/zh-TW";
|
|
17
|
+
var langCompare = {
|
|
18
|
+
'bn': 'bn-BD',
|
|
19
|
+
'en': 'en-US',
|
|
20
|
+
'fa': 'fa-IR',
|
|
21
|
+
'id': 'id-ID',
|
|
22
|
+
'ja': 'ja-JP',
|
|
23
|
+
'pt': 'pt-BR',
|
|
24
|
+
'zh-cn': 'zh-CN',
|
|
25
|
+
'zh-tw': 'zh-TW'
|
|
26
|
+
};
|
|
27
|
+
// 'bn-BD', 'en-US', 'fa-IR', 'id-ID', 'ja-JP', 'pt-BR', 'zh-CN', 'zh-TW'
|
|
28
|
+
export var renderLangObject = function renderLangObject(obj, language) {
|
|
29
|
+
if (!obj) return {};
|
|
30
|
+
if (obj !== null && obj !== void 0 && obj[language.replace('-', '')]) return obj[language.replace('-', '')];
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
if (langCompare !== null && langCompare !== void 0 && langCompare[language] && obj !== null && obj !== void 0 && obj[langCompare === null || langCompare === void 0 ? void 0 : langCompare[language].replace('-', '')]) return obj[langCompare[language].replace('-', '')];
|
|
33
|
+
return obj.zhCN; // Object.values(obj)[0] // 默认使用中文
|
|
34
|
+
};
|
|
35
|
+
export var useLanguageObject = function useLanguageObject() {
|
|
36
|
+
var _InitFanContext$local;
|
|
37
|
+
var InitFanContext = useContext(FanContext);
|
|
38
|
+
var language = (InitFanContext === null || InitFanContext === void 0 || (_InitFanContext$local = InitFanContext.locale) === null || _InitFanContext$local === void 0 ? void 0 : _InitFanContext$local.locale) || 'zh-CN';
|
|
39
|
+
var customObj = (InitFanContext === null || InitFanContext === void 0 ? void 0 : InitFanContext.locale) || {}; // 里面可以配置扩展语言包或者替换原来的语言包
|
|
40
|
+
return renderLangObject(_objectSpread({
|
|
41
|
+
zhCN: zhCN,
|
|
42
|
+
enUS: enUS,
|
|
43
|
+
bnBD: bnBD,
|
|
44
|
+
faIR: faIR,
|
|
45
|
+
idID: idID,
|
|
46
|
+
jaJP: jaJP,
|
|
47
|
+
ptBR: ptBR,
|
|
48
|
+
zhTW: zhTW
|
|
49
|
+
}, customObj), language);
|
|
50
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
'field.input.placeholder': string;
|
|
3
|
+
'field.inputNumber.placeholder': string;
|
|
4
|
+
'field.select.placeholder': string;
|
|
5
|
+
'field.select.search.placeholder': string;
|
|
6
|
+
'field.calendar.placeholder': string;
|
|
7
|
+
'field.mentions.input.placeholder': string;
|
|
8
|
+
'field.mentions.select.placeholder': string;
|
|
9
|
+
'field.upload.select': string;
|
|
10
|
+
'field.upload.import': string;
|
|
11
|
+
'field.expand': string;
|
|
12
|
+
'field.collapse': string;
|
|
13
|
+
'filter.submit': string;
|
|
14
|
+
'filter.reset': string;
|
|
15
|
+
'table.order': string;
|
|
16
|
+
'table.column.action': string;
|
|
17
|
+
'global.confirm.text': string;
|
|
18
|
+
'global.reset.text': string;
|
|
19
|
+
'global.cancel.text': string;
|
|
20
|
+
'global.empty.text': string;
|
|
21
|
+
};
|
|
22
|
+
export default _default;
|