Merge remote-tracking branch 'baidu/master'

This commit is contained in:
2betop 2020-08-03 14:40:12 +08:00
commit ce5b249b50
14 changed files with 124 additions and 19 deletions

View File

@ -159,5 +159,5 @@ order: 24
| label | `string` | | group 的标签 |
| controls | Array<[表单项](./formitem)> | | 表单项集合 |
| mode | `string` | | 展示默认,同 [Form](./form/index) 中的模式 |
| gap | `string` | | 表单项之间的间距,可选: |
| gap | `string` | | 表单项之间的间距,可选:`xs`、`sm`、`normal` |
| direction | `string` | `"horizontal"` | 可以配置水平展示还是垂直展示。对应的配置项分别是:`vertical`、`horizontal` |

View File

@ -385,6 +385,7 @@ export class App extends React.PureComponent {
</div>
{React.cloneElement(this.props.children, {
key: theme.value,
...this.props.children.props,
setNavigations: this.setNavigations,
setAsideFolded: this.setAsideFolded,

View File

@ -916,7 +916,7 @@ export const docs = [
},
{
label: 'Tabs 选项卡',
path: '/docs/components/tabstabs',
path: '/docs/components/tabs',
getComponent: (location, cb) =>
require(['../../docs/components/tabs.md'], doc => {
cb(null, makeMarkdownRenderer(doc));

View File

@ -46,6 +46,7 @@ class CodePreview extends React.Component {
show
>
<PopOver
theme={(rest as any).theme}
offset={{x: 0, y: -height}}
style={{height}}
className=":MDPreview-shcema-preview-popover"

View File

@ -85,6 +85,7 @@ export default class PlayGround extends React.Component {
}
};
this.env = {
session: 'doc',
updateLocation: () => {},
fetcher: config => {
config = {
@ -182,7 +183,9 @@ export default class PlayGround extends React.Component {
const props = {
...this.schemaProps,
theme: this.props.theme,
locale: this.props.locale
locale: this.props.locale,
affixHeader: false,
affixFooter: false
};
if (!this.props.useIFrame) {

View File

@ -229,7 +229,8 @@ if (fis.project.currentMedia() === 'publish') {
importHelpers: true,
sourceMap: true,
experimentalDecorators: true,
esModuleInterop: true
esModuleInterop: true,
allowUmdGlobalAccess: true
}),
function (contents) {
return contents.replace(

View File

@ -116,8 +116,10 @@
"fis-parser-node-sass": "^1.0.5",
"fis-parser-svgr": "^1.0.0",
"fis3": "^3.4.41",
"fis3-deploy-skip-packed": "0.0.5",
"fis3-hook-commonjs": "^0.1.31",
"fis3-hook-node_modules": "^2.3.1",
"fis3-packager-deps-pack": "^0.1.2",
"fis3-parser-typescript": "^1.3.0",
"fis3-postpackager-loader": "^2.1.11",
"fis3-prepackager-stand-alone-pack": "^1.0.0",

View File

@ -3,7 +3,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{
"$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item"
"$ref": "https://houtai.baidu.com/v2/schemas/form/date-range.json#/definitions/common"
},
{
"additionalProperties": false,
@ -32,7 +32,7 @@
"description": "日期范围格式说明",
"allOf": [
{
"$ref": "https://houtai.baidu.com/v2/schemas/form/date-range.json#/definitions/common"
"$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item"
},
{
"properties": {

View File

@ -3,7 +3,7 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"allOf": [
{
"$ref": "https://houtai.baidu.com/v2/schemas/form.json#/definitions/item"
"$ref": "https://houtai.baidu.com/v2/schemas/form/email.json#/definitions/common"
},
{
"additionalProperties": false,

View File

@ -215,7 +215,7 @@ $Modal-bg: $background !default;
$Modal-overlay-bg: rgba(0, 0, 0, 0.6) !default;
$Modal-content-startMarginTop: px2rem(60px) !default;
$Modal-content-stepMarginTop: px2rem(30px) !default;
$Modal-content-minHeight: px2rem(200px) !default;
$Modal-content-minHeight: unset !default;
$Modal-content-borderWidth: $borderWidth !default;
$Modal-content-borderColor: $borderColor !default;
$Modal-content-borderRadius: $borderRadius !default;
@ -507,6 +507,10 @@ $TableCell-sortBtn-width: px2rem(8px) !default;
$TableCell-sortBtn--default-opacity: 0 !default;
$TableCell-sortBtn--default-onActive-opacity: 1 !default;
$TableCell-searchBtn--onActive-color: $primary !default;
$TableCell-filterBtn--onActive-color: $primary !default;
$TableCell-sortBtn--onActive-color: $primary !default;
// Cards
$Cards-fixedTop-boxShadow: $boxShadow !default;
$Cards-toolbar-paddingY: 0 !default;

View File

@ -549,10 +549,16 @@
&.is-active {
color: $text--muted-color;
&:hover {
color: $icon-onHover-color;
color: $text-color;
}
}
}
&--up,
&--down {
&.is-active {
color: $TableCell-sortBtn--onActive-color;
}
}
}
&Cell-searchBtn {
@ -572,6 +578,9 @@
&:hover {
color: $text-color;
}
&.is-active {
color: $TableCell-searchBtn--onActive-color;
}
}
&Cell-searchPopOver {
@ -602,6 +611,10 @@
color: $text-color;
}
&.is-active {
color: $TableCell-filterBtn--onActive-color;
}
.#{$ns}Remark {
display: inline;
}

View File

@ -205,5 +205,6 @@ register('en', {
'保存并下一步': 'Save & Next',
'完成': 'Finish',
'点击选择图片或者将图片拖入该区域':
'Click to select the picture or drag the picture into the area'
'Click to select the picture or drag the picture into the area',
'重置': 'Reset'
});

View File

@ -1108,10 +1108,19 @@ export default class Table extends React.Component<TableProps, object> {
className={cx('TableCell-sortBtn')}
onClick={() => {
if (column.name === store.orderBy) {
store.setOrderByInfo(
column.name,
store.orderDir === 'desc' ? 'asc' : 'desc'
);
if (store.orderDir === 'desc') {
// 降序之后取消排序
store.setOrderByInfo(
'',
'asc'
);
} else {
// 升序之后降序
store.setOrderByInfo(
column.name,
'desc'
);
}
} else {
store.setOrderByInfo(column.name as string, 'asc');
}
@ -2175,6 +2184,7 @@ export class HeadCellSearchDropDown extends React.Component<
isOpened: false
};
formItems: Array<string> = [];
constructor(props: HeadCellSearchProps) {
super(props);
@ -2249,11 +2259,26 @@ export class HeadCellSearchDropDown extends React.Component<
}
if (schema) {
const formItems = [];
if (schema.controls) {
for (let item of schema.controls) {
if (item.name) {
formItems.push(item.name);
}
}
}
this.formItems = formItems;
schema = {
...schema,
type: 'form',
wrapperComponent: 'div',
actions: [
{
type: 'button',
label: __('重置'),
actionType: 'reset'
},
{
type: 'button',
label: __('取消'),
@ -2296,9 +2321,32 @@ export class HeadCellSearchDropDown extends React.Component<
return;
}
if (action.actionType === 'reset') {
this.close();
this.handleReset();
return;
}
onAction && onAction(e, action, ctx);
}
handleReset() {
const {onQuery, data, name} = this.props;
const values = {...data};
for (let item of this.formItems) {
if (item !== 'orderBy' && item !== 'orderDir') {
if (values[item]) {
values[item] = undefined;
}
}
}
if (values.orderBy && values.orderBy === name) {
values.orderBy = '';
values.orderDir = 'asc';
}
onQuery(values);
}
handleSubmit(values: any) {
const {onQuery, name} = this.props;
@ -2314,6 +2362,21 @@ export class HeadCellSearchDropDown extends React.Component<
onQuery(values);
}
isActive() {
const {data, name} = this.props;
if (data.orderBy === name) {
return true;
}
for (let item of this.formItems) {
if (item !== 'orderBy' && item !== 'orderDir') {
if (data[`${item}`]) {
return true;
}
}
}
return false;
}
render() {
const {
render,
@ -2326,8 +2389,11 @@ export class HeadCellSearchDropDown extends React.Component<
classPrefix: ns
} = this.props;
const formSchema = this.buildSchema();
const isActive = this.isActive();
return (
<span className={cx(`${ns}TableCell-searchBtn`)}>
<span className={cx(`${ns}TableCell-searchBtn`, isActive ? 'is-active' : '')}>
<span onClick={this.open}>
<Icon icon="search" className="icon" />
</span>
@ -2350,7 +2416,7 @@ export class HeadCellSearchDropDown extends React.Component<
overlay
>
{
render('quick-search-form', this.buildSchema(), {
render('quick-search-form', formSchema, {
data: {
...data,
orderBy: orderBy,
@ -2518,17 +2584,28 @@ export class HeadCellFilterDropDown extends React.Component<
});
}
handleReset() {
const {name, onQuery} = this.props;
onQuery({
[name]: undefined
})
this.close();
}
render() {
const {isOpened, filterOptions} = this.state;
const {
data,
name,
filterable,
popOverContainer,
classPrefix: ns,
classnames: cx
classnames: cx,
translate: __
} = this.props;
return (
<span className={cx(`${ns}TableCell-filterBtn`)}>
<span className={cx(`${ns}TableCell-filterBtn`, data[name] ? 'is-active' : '')}>
<span onClick={this.open}>
<Icon icon="column-filter" className="icon" />
</span>
@ -2575,6 +2652,7 @@ export class HeadCellFilterDropDown extends React.Component<
</Checkbox>
</li>
))}
<li key="DropDown-menu-reset" className={cx('DropDown-divider')} onClick={this.handleReset.bind(this)}>{__('重置')}</li>
</ul>
) : null}
</PopOver>

View File

@ -100,7 +100,8 @@ export interface Action extends Button {
| 'cancel'
| 'close'
| 'next'
| 'prev';
| 'prev'
| 'reset';
api?: Api;
asyncApi?: Api;
payload?: any;