Skip to content

Commit

Permalink
chore(setters): improve DataSourceSetter ui
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Jul 9, 2021
1 parent dd611b9 commit 1c12f54
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
26 changes: 16 additions & 10 deletions designable/setters/src/DataSourceSetter/TreePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Header } from './Header'
import { traverseTree } from './shared'
import { ITreeDataSource, INodeItem } from './types'
import './styles.less'
import { GlobalRegistry } from '@designable/core'

export interface ITreePanelProps {
treeDataSource: ITreeDataSource
Expand Down Expand Up @@ -75,16 +76,21 @@ export const TreePanel: React.FC<ITreePanelProps> = observer((props) => {
type="text"
onClick={() => {
const uuid = uid()
props.treeDataSource.dataSource =
props.treeDataSource.dataSource.concat({
key: uuid,
duplicateKey: uuid,
map: [
{ label: 'label', value: 'Label Text' },
{ label: 'value', value: 'Actual Value' },
],
children: [],
})
const dataSource = props.treeDataSource.dataSource
props.treeDataSource.dataSource = dataSource.concat({
key: uuid,
duplicateKey: uuid,
map: [
{
label: 'label',
value: `${GlobalRegistry.getDesignerMessage(
`SettingComponents.DataSourceSetter.item`
)} ${dataSource.length + 1}`,
},
{ label: 'value', value: uuid },
],
children: [],
})
}}
icon={<IconWidget infer="Add" />}
>
Expand Down
1 change: 1 addition & 0 deletions designable/setters/src/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default {
addNode: 'Add Node',
label: 'label',
value: 'value',
item: 'Item',
},
},
},
Expand Down
1 change: 1 addition & 0 deletions designable/setters/src/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default {
addNode: '新增节点',
label: '键名',
value: '键值',
item: '选项',
},
},
},
Expand Down

0 comments on commit 1c12f54

Please sign in to comment.