Merge remote-tracking branch 'baidu/master'

This commit is contained in:
2betop 2020-04-10 11:47:39 +08:00
commit 670769f275
4 changed files with 69 additions and 14 deletions

View File

@ -1,16 +1,17 @@
## Nav
| 属性名 | 类型 | 默认值 | 说明 |
| ----------------- | --------- | -------- | -------------------------------------- |
| type | `string` | `"tabs"` | 指定为 Nav 渲染器 |
| className | `string` | | 外层 Dom 的类名 |
| stacked | `boolean` | `true` | 设置成 false 可以以 tabs 的形式展示 |
| links | `Array` | | 链接集合 |
| links[x].label | `string` | | 名称 |
| links[x].to | `string` | | 链接地址 |
| links[x].icon | `string` | | 图标 |
| links[x].active | `boolean` | | 是否高亮 |
| links[x].activeOn | `表达式` | | 是否高亮的条件,留空将自动分析链接地址 |
| 属性名 | 类型 | 默认值 | 说明 |
| ----------------- | ----------------- | -------- | ------------------------------------------- |
| type | `string` | `"tabs"` | 指定为 Nav 渲染器 |
| className | `string` | | 外层 Dom 的类名 |
| stacked | `boolean` | `true` | 设置成 false 可以以 tabs 的形式展示 |
| source | `Api``string` | | 动态拉取的 api 地址,也支持`${xxx}`获取变量 |
| links | `Array` | | 链接集合 |
| links[x].label | `string` | | 名称 |
| links[x].to | `string` | | 链接地址 |
| links[x].icon | `string` | | 图标 |
| links[x].active | `boolean` | | 是否高亮 |
| links[x].activeOn | `表达式` | | 是否高亮的条件,留空将自动分析链接地址 |
链接集合。
@ -63,3 +64,57 @@
]
}
```
## source 返回格式
```json
{
"status": 0,
"msg": "",
"data": [
{
"label": "Nav 1",
"to": "/docs/index",
"icon": "fa fa-user"
},
{
"label": "Nav 2",
"to": "/docs/api"
},
{
"label": "Nav 3",
"to": "/docs/renderers"
}
]
}
```
或者
```json
{
"status": 0,
"msg": "",
"data": {
"links": [ // 可选字段值options, items, rows
{
"label": "Nav 1",
"to": "/docs/index",
"icon": "fa fa-user"
},
{
"label": "Nav 2",
"to": "/docs/api"
},
{
"label": "Nav 3",
"to": "/docs/renderers"
}
]
}
}
```

View File

@ -40,7 +40,7 @@ const availableShortcuts: {[propName: string]: any} = {
thisweek: {
label: '本周一',
date: (now: moment.Moment) => {
return now.startOf('week').add(-1, 'weeks');
return now.startOf('week').startOf('day');
}
},

View File

@ -1025,7 +1025,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
popOver &&
~['dialog', 'drawer'].indexOf(popOver.mode)
) {
clearTimeout(this.timer);
this.props.stopAutoRefreshWhenModalIsOpen && clearTimeout(this.timer);
this.props.store.setInnerModalOpened(true);
}
}

View File

@ -4,7 +4,7 @@ const isEmpty = (value: any) => value === '';
const makeRegexp = (reg: string | RegExp) => {
if (reg instanceof RegExp) {
return reg;
} else if (/^\/(.+)\/([gimuy]*)$/.test(reg)) {
} else if (/^(?:matchRegexp\:)?\/(.+)\/([gimuy]*)$/.test(reg)) {
return new RegExp(RegExp.$1, RegExp.$2 || '');
} else if (typeof reg === 'string') {
return new RegExp(reg);