import './demo3.css'; import ConfigProvider from '..'; import React from 'react'; import ReactDOM from 'react-dom'; import enUS from '../../locale/en-us'; import jaJP from '../../locale/ja-jp'; import ptPT from '../../locale/pt-pt'; import viVN from '../../locale/vi-vn'; import zhCN from '../../locale/zh-cn'; import { Box, Button, Calendar2, Card, Cascader, CascaderSelect, Collapse, DatePicker, DatePicker2, Dialog, Input, NumberPicker, Pagination, Radio, Search, Select, Tab, Table, Tag, TimePicker2, Timeline, Transfer, TreeSelect, Upload, } from '../..'; const localeMap = { 'zh-cn': zhCN, 'en-us': enUS, 'ja-jp': jaJP, 'vi-vn': viVN, 'pt-pt': ptPT, }; // If the application directly imports the next-with-locales.js file from cdn // it need to import locale file in the following way // import { locales } from '@alifd/next'; // const enUS = locales['en-us']; // const zhCN = locales['zh-cn']; const RangePicker = DatePicker.RangePicker; const RangePicker2 = DatePicker2.RangePicker; const Panel = Collapse.Panel; const TreeNode = TreeSelect.Node; const transferDataSource = (() => { const dataSource = []; for (let i = 0; i < 10; i++) { dataSource.push({ label: `content ${i}`, value: `${i}`, disabled: i % 4 === 0, }); } return dataSource; })(); interface IState { lang: string; label: string; theme: 'white' | 'grey'; data: Array; value1: string; } class Demo extends React.Component<{}, IState> { constructor(props) { super(props); this.state = { label: '', lang: 'en-us', theme: 'white', data: [], value1: 'apple', }; this.changeLang = this.changeLang.bind(this); this.showDialog = this.showDialog.bind(this); this.changeTheme = this.changeTheme.bind(this); this.handleChange = this.handleChange.bind(this); this.onChange = this.onChange.bind(this); this.onSmallChange = this.onSmallChange.bind(this); } componentDidMount() { fetch('https://os.alipayobjects.com/rmsportal/ODDwqcDFTLAguOvWEolX.json') .then(response => response.json()) .then(data => { data[1].disabled = true; this.setState({ data }); }) .catch(e => console.log(e)); } handleChange(value, data, extra) { console.log(value, data, extra); this.setState({ label: extra.selectedPath.map(d => d.label).join(' / '), }); } onChange(value, e) { console.log(value, e.type, e.triggerType); } onSmallChange(value) { this.setState({ value1: value, }); } changeLang(lang) { this.setState({ lang, }); } changeTheme(theme) { this.setState({ theme, }); } showDialog() { Dialog.confirm({ title: 'Confirm', content: 'Are you sure you want to delete all alert e-mails waiting in queue?', }); } render() { const locale = localeMap[this.state.lang]; const { theme } = this.state; return (
Change locale of components: English 中文 日本語 ViệtName Português

Change theme of components: White Grey