feat(bee-table): 加多语
This commit is contained in:
parent
1e8eaf28a3
commit
ffc232d47c
|
@ -24,6 +24,12 @@ var _beeIcon = require('bee-icon');
|
|||
|
||||
var _beeIcon2 = _interopRequireDefault(_beeIcon);
|
||||
|
||||
var _i18n = require('./i18n');
|
||||
|
||||
var _i18n2 = _interopRequireDefault(_i18n);
|
||||
|
||||
var _tool = require('bee-locale/build/tool');
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
||||
|
@ -77,6 +83,11 @@ var FilterDropDown = function (_Component) {
|
|||
FilterDropDown.prototype.render = function render() {
|
||||
var isShowCondition = this.props.isShowCondition;
|
||||
|
||||
|
||||
var locale = (0, _tool.getComponentLocale)(this.props, this.context, 'Table', function () {
|
||||
return _i18n2["default"];
|
||||
});
|
||||
|
||||
var dropmenu = _react2["default"].createElement(
|
||||
_beeMenus2["default"],
|
||||
{
|
||||
|
@ -86,32 +97,32 @@ var FilterDropDown = function (_Component) {
|
|||
_react2["default"].createElement(
|
||||
Item,
|
||||
{ key: '2' },
|
||||
'\u5305\u542B'
|
||||
locale['include']
|
||||
),
|
||||
_react2["default"].createElement(
|
||||
Item,
|
||||
{ key: '6' },
|
||||
'\u4E0D\u5305\u542B'
|
||||
locale['exclusive']
|
||||
),
|
||||
_react2["default"].createElement(
|
||||
Item,
|
||||
{ key: '1' },
|
||||
'\u7B49\u4E8E'
|
||||
locale['equal']
|
||||
),
|
||||
_react2["default"].createElement(
|
||||
Item,
|
||||
{ key: '5' },
|
||||
'\u4E0D\u7B49\u4E8E'
|
||||
locale['unequal']
|
||||
),
|
||||
_react2["default"].createElement(
|
||||
Item,
|
||||
{ key: '7' },
|
||||
'\u4EE5\u5F00\u59CB'
|
||||
locale['begin']
|
||||
),
|
||||
_react2["default"].createElement(
|
||||
Item,
|
||||
{ key: '3' },
|
||||
'\u4EE5\u7ED3\u5C3E'
|
||||
locale['end']
|
||||
)
|
||||
);
|
||||
return _react2["default"].createElement(
|
||||
|
|
|
@ -126,7 +126,8 @@ var FilterType = function (_Component) {
|
|||
className = _this$props.className,
|
||||
onChange = _this$props.onChange,
|
||||
onSelectDropdown = _this$props.onSelectDropdown,
|
||||
clsPrefix = _this$props.clsPrefix;
|
||||
clsPrefix = _this$props.clsPrefix,
|
||||
locale = _this$props.locale;
|
||||
|
||||
switch (rendertype) {
|
||||
case 'text':
|
||||
|
@ -144,6 +145,7 @@ var FilterType = function (_Component) {
|
|||
onBlur: _this.changeTextCallBlur
|
||||
}),
|
||||
_react2["default"].createElement(_FilterDropDown2["default"], {
|
||||
locale: locale,
|
||||
onSelectDropdown: onSelectDropdown,
|
||||
onClickClear: _this.clearText,
|
||||
isShowClear: _this.state.text,
|
||||
|
@ -159,6 +161,7 @@ var FilterType = function (_Component) {
|
|||
onChange: _this.changeSelect
|
||||
})),
|
||||
_react2["default"].createElement(_FilterDropDown2["default"], {
|
||||
locale: locale,
|
||||
onSelectDropdown: onSelectDropdown,
|
||||
onClickClear: _this.clearSelectValue,
|
||||
isShowCondition: filterDropdown,
|
||||
|
@ -175,6 +178,7 @@ var FilterType = function (_Component) {
|
|||
open: _this.state.open
|
||||
})),
|
||||
filterDropdown == 'show' && _react2["default"].createElement(_FilterDropDown2["default"], {
|
||||
locale: locale,
|
||||
onSelectDropdown: onSelectDropdown,
|
||||
onClickClear: _this.clearDateValue,
|
||||
isShowCondition: filterDropdown,
|
||||
|
@ -189,7 +193,7 @@ var FilterType = function (_Component) {
|
|||
className: className,
|
||||
onChange: onChange
|
||||
}),
|
||||
filterDropdown == 'show' && _react2["default"].createElement(_FilterDropDown2["default"], {
|
||||
filterDropdown == 'show' && _react2["default"].createElement(_FilterDropDown2["default"], { locale: locale,
|
||||
onSelectDropdown: onSelectDropdown
|
||||
})
|
||||
);
|
||||
|
|
|
@ -127,7 +127,8 @@ var defaultProps = {
|
|||
return 'No Data';
|
||||
},
|
||||
columns: [],
|
||||
minColumnWidth: 80
|
||||
minColumnWidth: 80,
|
||||
locale: {}
|
||||
};
|
||||
|
||||
var Table = function (_Component) {
|
||||
|
@ -389,6 +390,7 @@ var Table = function (_Component) {
|
|||
contentWidthDiff = this.state.contentWidthDiff;
|
||||
}
|
||||
return showHeader ? _react2["default"].createElement(_TableHeader2["default"], _extends({}, drop, dragBorder, {
|
||||
locale: this.props.locale,
|
||||
minColumnWidth: minColumnWidth,
|
||||
contentWidthDiff: contentWidthDiff,
|
||||
contentWidth: this.contentWidth,
|
||||
|
|
|
@ -249,12 +249,14 @@ var TableHeader = function (_Component) {
|
|||
var _this$props4 = _this.props,
|
||||
clsPrefix = _this$props4.clsPrefix,
|
||||
rows = _this$props4.rows,
|
||||
filterDelay = _this$props4.filterDelay;
|
||||
filterDelay = _this$props4.filterDelay,
|
||||
locale = _this$props4.locale;
|
||||
|
||||
switch (type) {
|
||||
//文本输入
|
||||
case 'text':
|
||||
return _react2["default"].createElement(_FilterType2["default"], {
|
||||
locale: locale,
|
||||
rendertype: type,
|
||||
clsPrefix: clsPrefix,
|
||||
className: clsPrefix + ' filter-text',
|
||||
|
@ -280,6 +282,7 @@ var TableHeader = function (_Component) {
|
|||
selectDataSource = rows[1][index]['filterdropdowndata'];
|
||||
}
|
||||
return _react2["default"].createElement(_FilterType2["default"], {
|
||||
locale: locale,
|
||||
rendertype: type,
|
||||
className: clsPrefix + ' filter-dropdown',
|
||||
data: selectDataSource,
|
||||
|
@ -291,6 +294,7 @@ var TableHeader = function (_Component) {
|
|||
//日期
|
||||
case 'date':
|
||||
return _react2["default"].createElement(_FilterType2["default"], {
|
||||
locale: locale,
|
||||
rendertype: type,
|
||||
className: 'filter-date',
|
||||
onClick: function onClick() {},
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
'lang': 'zh-cn',
|
||||
'resetSettings': '还原设置',
|
||||
'include': '包含',
|
||||
'exclusive': '不包含',
|
||||
'equal': '等于',
|
||||
'unequal': '不等于',
|
||||
'begin': '以开始',
|
||||
'end': '以结尾',
|
||||
'en-us': {
|
||||
'resetSettings': 'reset settings',
|
||||
'include': 'include',
|
||||
'exclusive': 'exclusive',
|
||||
'equal': 'equal',
|
||||
'unequal': 'unequal',
|
||||
'begin': 'begin',
|
||||
'end': 'end'
|
||||
},
|
||||
'zh-tw': {
|
||||
'resetSettings': '還原設置',
|
||||
'include': '包含',
|
||||
'exclusive': '不包含',
|
||||
'equal': '等於',
|
||||
'unequal': '不等於',
|
||||
'begin': '以開始',
|
||||
'end': '以結尾'
|
||||
}
|
||||
};
|
|
@ -22,6 +22,12 @@ var _beeIcon2 = _interopRequireDefault(_beeIcon);
|
|||
|
||||
var _util = require("./util");
|
||||
|
||||
var _i18n = require("../i18n");
|
||||
|
||||
var _i18n2 = _interopRequireDefault(_i18n);
|
||||
|
||||
var _tool = require("bee-locale/build/tool");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
||||
|
@ -84,6 +90,10 @@ function filterColumn(Table, Popover) {
|
|||
showModal = _state.showModal;
|
||||
|
||||
|
||||
var locale = (0, _tool.getComponentLocale)(this.props, this.context, 'Table', function () {
|
||||
return _i18n2["default"];
|
||||
});
|
||||
|
||||
var _columns = [],
|
||||
widthState = 0,
|
||||
scroll = scrollPro;
|
||||
|
@ -105,7 +115,7 @@ function filterColumn(Table, Popover) {
|
|||
_react2["default"].createElement(
|
||||
"span",
|
||||
{ className: prefixCls + "-clear-setting", onClick: this.clear },
|
||||
"\u8FD8\u539F\u8BBE\u7F6E"
|
||||
locale['resetSettings']
|
||||
),
|
||||
_react2["default"].createElement(
|
||||
"div",
|
||||
|
|
|
@ -2420,9 +2420,6 @@ i.uf {
|
|||
/*
|
||||
* 选择时删除文本阴影,及设置默认选中颜色
|
||||
*/
|
||||
::-moz-selection {
|
||||
background: rgb(187,222,251);
|
||||
text-shadow: none; }
|
||||
::selection {
|
||||
background: rgb(187,222,251);
|
||||
text-shadow: none; }
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bee-table",
|
||||
"version": "1.4.31",
|
||||
"version": "1.4.32",
|
||||
"description": "Table ui component for react",
|
||||
"keywords": [
|
||||
"react",
|
||||
|
@ -53,6 +53,7 @@
|
|||
"bee-form-control": "latest",
|
||||
"bee-icon": "^1.0.5",
|
||||
"bee-loading": "^1.0.3",
|
||||
"bee-locale": "0.0.11",
|
||||
"bee-menus": "^1.0.7",
|
||||
"bee-popover": "^1.0.2",
|
||||
"bee-select": "^1.0.21",
|
||||
|
|
|
@ -3,6 +3,8 @@ import Dropdown from 'bee-dropdown';
|
|||
import Menu from 'bee-menus';
|
||||
import Button from 'bee-button';
|
||||
import Icon from 'bee-icon';
|
||||
import i18n from './i18n';
|
||||
import { getComponentLocale } from 'bee-locale/build/tool';
|
||||
const { Item } = Menu;
|
||||
|
||||
class FilterDropDown extends Component {
|
||||
|
@ -34,17 +36,20 @@ class FilterDropDown extends Component {
|
|||
}
|
||||
render() {
|
||||
let { isShowCondition } = this.props;
|
||||
|
||||
let locale = getComponentLocale(this.props, this.context, 'Table', () => i18n);
|
||||
|
||||
let dropmenu = (
|
||||
<Menu
|
||||
onSelect={this.onSelectDropdown}
|
||||
selectedKeys={this.state.selectValue}
|
||||
>
|
||||
<Item key="2">包含</Item>
|
||||
<Item key="6">不包含</Item>
|
||||
<Item key="1">等于</Item>
|
||||
<Item key="5">不等于</Item>
|
||||
<Item key="7">以开始</Item>
|
||||
<Item key="3">以结尾</Item>
|
||||
<Item key="2">{locale['include']}</Item>
|
||||
<Item key="6">{locale['exclusive']}</Item>
|
||||
<Item key="1">{locale['equal']}</Item>
|
||||
<Item key="5">{locale['unequal']}</Item>
|
||||
<Item key="7">{locale['begin']}</Item>
|
||||
<Item key="3">{locale['end']}</Item>
|
||||
</Menu>
|
||||
);
|
||||
return (<div>
|
||||
|
|
|
@ -85,7 +85,7 @@ class FilterType extends Component {
|
|||
}
|
||||
//组件渲染
|
||||
renderControl = (rendertype) => {
|
||||
let { filterDropdown, className, onChange, onSelectDropdown, clsPrefix } = this.props;
|
||||
let { filterDropdown, className, onChange, onSelectDropdown, clsPrefix, locale } = this.props;
|
||||
switch (rendertype) {
|
||||
case 'text':
|
||||
return <div className={`${clsPrefix} filter-wrap`}><FormControl
|
||||
|
@ -97,6 +97,7 @@ class FilterType extends Component {
|
|||
onBlur={this.changeTextCallBlur}
|
||||
/>
|
||||
<FilterDropDown
|
||||
locale={locale}
|
||||
onSelectDropdown={onSelectDropdown}
|
||||
onClickClear={this.clearText}
|
||||
isShowClear={this.state.text}
|
||||
|
@ -110,6 +111,7 @@ class FilterType extends Component {
|
|||
value={this.state.selectValue}
|
||||
onChange={this.changeSelect}
|
||||
/><FilterDropDown
|
||||
locale={locale}
|
||||
onSelectDropdown={onSelectDropdown}
|
||||
onClickClear={this.clearSelectValue}
|
||||
isShowCondition={filterDropdown}
|
||||
|
@ -123,6 +125,7 @@ class FilterType extends Component {
|
|||
onChange={this.changeDate}
|
||||
open={this.state.open}
|
||||
/>{filterDropdown == 'show' && <FilterDropDown
|
||||
locale={locale}
|
||||
onSelectDropdown={onSelectDropdown}
|
||||
onClickClear={this.clearDateValue}
|
||||
isShowCondition={filterDropdown}
|
||||
|
@ -135,7 +138,7 @@ class FilterType extends Component {
|
|||
className={className}
|
||||
onChange={onChange}
|
||||
/>
|
||||
{filterDropdown == 'show' && <FilterDropDown
|
||||
{filterDropdown == 'show' && <FilterDropDown locale={locale}
|
||||
onSelectDropdown={onSelectDropdown}
|
||||
>
|
||||
</FilterDropDown>}
|
||||
|
|
|
@ -69,7 +69,8 @@ const defaultProps = {
|
|||
getBodyWrapper: body => body,
|
||||
emptyText: () => 'No Data',
|
||||
columns:[],
|
||||
minColumnWidth: 80
|
||||
minColumnWidth: 80,
|
||||
locale:{}
|
||||
};
|
||||
|
||||
class Table extends Component {
|
||||
|
@ -301,6 +302,7 @@ class Table extends Component {
|
|||
<TableHeader
|
||||
{...drop}
|
||||
{...dragBorder}
|
||||
locale={this.props.locale}
|
||||
minColumnWidth={minColumnWidth}
|
||||
contentWidthDiff={contentWidthDiff}
|
||||
contentWidth={this.contentWidth}
|
||||
|
|
|
@ -237,11 +237,12 @@ class TableHeader extends Component {
|
|||
* @description 过滤渲染的组件类型
|
||||
*/
|
||||
filterRenderType = (type, dataIndex, index) => {
|
||||
const { clsPrefix, rows, filterDelay } = this.props;
|
||||
const { clsPrefix, rows, filterDelay,locale } = this.props;
|
||||
switch (type) {
|
||||
//文本输入
|
||||
case 'text':
|
||||
return <FilterType
|
||||
locale={locale}
|
||||
rendertype={type}
|
||||
clsPrefix={clsPrefix}
|
||||
className={`${clsPrefix} filter-text`}
|
||||
|
@ -265,6 +266,7 @@ class TableHeader extends Component {
|
|||
selectDataSource = rows[1][index]['filterdropdowndata']
|
||||
}
|
||||
return <FilterType
|
||||
locale={locale}
|
||||
rendertype={type}
|
||||
className={`${clsPrefix} filter-dropdown`}
|
||||
data={selectDataSource}
|
||||
|
@ -276,6 +278,7 @@ class TableHeader extends Component {
|
|||
//日期
|
||||
case 'date':
|
||||
return <FilterType
|
||||
locale={locale}
|
||||
rendertype={type}
|
||||
className={`filter-date`}
|
||||
onClick={() => { }}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
module.exports = {
|
||||
'lang': 'zh-cn',
|
||||
'resetSettings': '还原设置',
|
||||
'include': '包含',
|
||||
'exclusive': '不包含',
|
||||
'equal': '等于',
|
||||
'unequal':'不等于',
|
||||
'begin':'以开始',
|
||||
'end':'以结尾',
|
||||
'en-us': {
|
||||
'resetSettings': 'reset settings',
|
||||
'include': 'include',
|
||||
'exclusive': 'exclusive',
|
||||
'equal': 'equal',
|
||||
'unequal':'unequal',
|
||||
'begin':'begin',
|
||||
'end':'end',
|
||||
},
|
||||
'zh-tw': {
|
||||
'resetSettings': '還原設置',
|
||||
'include': '包含',
|
||||
'exclusive': '不包含',
|
||||
'equal': '等於',
|
||||
'unequal':'不等於',
|
||||
'begin':'以開始',
|
||||
'end':'以結尾',
|
||||
}
|
||||
}
|
|
@ -2,6 +2,9 @@ import React, { Component } from "react";
|
|||
import Checkbox from 'bee-checkbox';
|
||||
import Icon from "bee-icon";
|
||||
import {ObjectAssign} from './util';
|
||||
import i18n from '../i18n'
|
||||
import { getComponentLocale } from 'bee-locale/build/tool';
|
||||
|
||||
function noop() {}
|
||||
/**
|
||||
* 参数: 过滤表头
|
||||
|
@ -121,6 +124,8 @@ export default function filterColumn(Table,Popover) {
|
|||
const {data,prefixCls,scroll:scrollPro} = this.props;
|
||||
const {columns,showModal} = this.state;
|
||||
|
||||
let locale = getComponentLocale(this.props, this.context, 'Table', () => i18n);
|
||||
|
||||
let _columns = [],widthState=0,scroll=scrollPro;
|
||||
columns.forEach((da)=>{
|
||||
if(da.ifshow){
|
||||
|
@ -136,7 +141,7 @@ export default function filterColumn(Table,Popover) {
|
|||
|
||||
let content = (
|
||||
<div className={`${prefixCls}-pop-cont`}>
|
||||
<span className={`${prefixCls}-clear-setting`} onClick={this.clear}>还原设置</span>
|
||||
<span className={`${prefixCls}-clear-setting`} onClick={this.clear}>{locale['resetSettings']}</span>
|
||||
<div>
|
||||
{
|
||||
this.getCloumItem()
|
||||
|
|
Loading…
Reference in New Issue