Merge remote-tracking branch 'amis/master'

This commit is contained in:
rickcole 2020-04-07 17:41:31 +08:00
commit 7cae5ab61b
15 changed files with 144 additions and 810 deletions

View File

@ -35,803 +35,7 @@ export default {
})
},
{
label: '渲染器手册',
icon: 'fa fa-diamond',
path: '/docs/renderers',
getComponent: (location, cb) =>
require(['../../docs/renderers.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
}),
children: [
{
label: 'Action',
path: '/docs/renderers/Action',
getComponent: (location, cb) =>
require(['../../docs/renderers/Action.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Alert',
path: '/docs/renderers/Alert',
getComponent: (location, cb) =>
require(['../../docs/renderers/Alert.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Audio',
path: '/docs/renderers/Audio',
getComponent: (location, cb) =>
require(['../../docs/renderers/Audio.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'ButtonGroup',
path: '/docs/renderers/ButtonGroup',
getComponent: (location, cb) =>
require(['../../docs/renderers/ButtonGroup.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Carousel',
path: '/docs/renderers/Carousel',
getComponent: (location, cb) =>
require(['../../docs/renderers/Carousel.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Card',
path: '/docs/renderers/Card',
getComponent: (location, cb) =>
require(['../../docs/renderers/Card.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Cards',
path: '/docs/renderers/Cards',
getComponent: (location, cb) =>
require(['../../docs/renderers/Cards.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Chart',
path: '/docs/renderers/Chart',
getComponent: (location, cb) =>
require(['../../docs/renderers/Chart.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Collapse',
path: '/docs/renderers/Collapse',
getComponent: (location, cb) =>
require(['../../docs/renderers/Collapse.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'CRUD',
path: '/docs/renderers/CRUD',
getComponent: (location, cb) =>
require(['../../docs/renderers/CRUD.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
}),
children: [
{
label: 'CRUD-Table',
path: '/docs/renderers/CRUD-Table',
getComponent: (location, cb) =>
require(['../../docs/renderers/CRUD-Table.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'CRUD-Cards',
path: '/docs/renderers/CRUD-Cards',
getComponent: (location, cb) =>
require(['../../docs/renderers/CRUD-Cards.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'CRUD-List',
path: '/docs/renderers/CRUD-List',
getComponent: (location, cb) =>
require(['../../docs/renderers/CRUD-List.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
}
]
},
{
label: 'Definitions',
path: '/docs/renderers/Definitions',
getComponent: (location, cb) =>
require(['../../docs/renderers/Definitions.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Divider',
path: '/docs/renderers/Divider',
getComponent: (location, cb) =>
require(['../../docs/renderers/Divider.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Dialog',
path: '/docs/renderers/Dialog',
getComponent: (location, cb) =>
require(['../../docs/renderers/Dialog.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Drawer',
path: '/docs/renderers/Drawer',
getComponent: (location, cb) =>
require(['../../docs/renderers/Drawer.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Each',
path: '/docs/renderers/Each',
getComponent: (location, cb) =>
require(['../../docs/renderers/Each.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Field',
path: '/docs/renderers/Field',
getComponent: (location, cb) =>
require(['../../docs/renderers/Field.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Form',
path: '/docs/renderers/Form/Form',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Form.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
}),
children: [
{
label: 'Array',
path: '/docs/renderers/Form/Array',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Array.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Button',
path: '/docs/renderers/Form/Button',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Button.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Button-Toolbar',
path: '/docs/renderers/Form/Button-Toolbar',
getComponent: (location, cb) =>
require([
'../../docs/renderers/Form/Button-Toolbar.md'
], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Button-Group',
path: '/docs/renderers/Form/Button-Group',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Button-Group.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Chained-Select',
path: '/docs/renderers/Form/Chained-Select',
getComponent: (location, cb) =>
require([
'../../docs/renderers/Form/Chained-Select.md'
], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Checkbox',
path: '/docs/renderers/Form/Checkbox',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Checkbox.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Checkboxes',
path: '/docs/renderers/Form/Checkboxes',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Checkboxes.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'City',
path: '/docs/renderers/Form/City',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/City.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Color',
path: '/docs/renderers/Form/Color',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Color.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Combo',
path: '/docs/renderers/Form/Combo',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Combo.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Date',
path: '/docs/renderers/Form/Date',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Date.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Datetime',
path: '/docs/renderers/Form/Datetime',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Datetime.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Date-Range',
path: '/docs/renderers/Form/Date-Range',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Date-Range.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Editor',
path: '/docs/renderers/Form/Editor',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Editor.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Email',
path: '/docs/renderers/Form/Email',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Email.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'File',
path: '/docs/renderers/Form/File',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/File.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'FieldSet',
path: '/docs/renderers/Form/FieldSet',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/FieldSet.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Formula',
path: '/docs/renderers/Form/Formula',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Formula.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'FormItem',
path: '/docs/renderers/Form/FormItem',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/FormItem.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Grid',
path: '/docs/renderers/Form/Grid',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Grid.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Group',
path: '/docs/renderers/Form/Group',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Group.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'HBox',
path: '/docs/renderers/Form/HBox',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/HBox.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Hidden',
path: '/docs/renderers/Form/Hidden',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Hidden.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Image',
path: '/docs/renderers/Form/Image',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Image.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Input-Group',
path: '/docs/renderers/Form/Input-Group',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Input-Group.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'List',
path: '/docs/renderers/Form/List',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/List.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Matrix',
path: '/docs/renderers/Form/Matrix',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Matrix.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'NestedSelect',
path: '/docs/renderers/Form/NestedSelect',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/NestedSelect.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Number',
path: '/docs/renderers/Form/Number',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Number.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Panel',
path: '/docs/renderers/Form/Panel',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Panel.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Password',
path: '/docs/renderers/Form/Password',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Password.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Picker',
path: '/docs/renderers/Form/Picker',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Picker.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Radios',
path: '/docs/renderers/Form/Radios',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Radios.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Rating',
path: '/docs/renderers/Form/Rating',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Rating.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Range',
path: '/docs/renderers/Form/Range',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Range.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Repeat',
path: '/docs/renderers/Form/Repeat',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Repeat.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Rich-Text',
path: '/docs/renderers/Form/Rich-Text',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Rich-Text.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Select',
path: '/docs/renderers/Form/Select',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Select.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Switch',
path: '/docs/renderers/Form/Switch',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Switch.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Service',
path: '/docs/renderers/Form/Service',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Service.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'SubForm',
path: '/docs/renderers/Form/SubForm',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/SubForm.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Static',
path: '/docs/renderers/Static',
getComponent: (location, cb) =>
require(['../../docs/renderers/Static.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Tabs',
path: '/docs/renderers/Form/Tabs',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Tabs.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Table',
path: '/docs/renderers/Form/Table',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Table.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Tag',
path: '/docs/renderers/Form/Tag',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Tag.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Text',
path: '/docs/renderers/Form/Text',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Text.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Textarea',
path: '/docs/renderers/Form/Textarea',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Textarea.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Time',
path: '/docs/renderers/Form/Time',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Time.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Tree',
path: '/docs/renderers/Form/Tree',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Tree.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'TreeSelect',
path: '/docs/renderers/Form/TreeSelect',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/TreeSelect.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Url',
path: '/docs/renderers/Form/Url',
getComponent: (location, cb) =>
require(['../../docs/renderers/Form/Url.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
}
]
},
{
label: 'Grid',
path: '/docs/renderers/Grid',
getComponent: (location, cb) =>
require(['../../docs/renderers/Grid.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'HBox',
path: '/docs/renderers/HBox',
getComponent: (location, cb) =>
require(['../../docs/renderers/HBox.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Html',
path: '/docs/renderers/Html',
getComponent: (location, cb) =>
require(['../../docs/renderers/Html.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'iFrame',
path: '/docs/renderers/iFrame',
getComponent: (location, cb) =>
require(['../../docs/renderers/iFrame.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'List',
path: '/docs/renderers/List',
getComponent: (location, cb) =>
require(['../../docs/renderers/List.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Nav',
path: '/docs/renderers/Nav',
getComponent: (location, cb) =>
require(['../../docs/renderers/Nav.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Panel',
path: '/docs/renderers/Panel',
getComponent: (location, cb) =>
require(['../../docs/renderers/Panel.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Page',
path: '/docs/renderers/Page',
getComponent: (location, cb) =>
require(['../../docs/renderers/Page.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Plain',
path: '/docs/renderers/Plain',
getComponent: (location, cb) =>
require(['../../docs/renderers/Plain.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'QRCode',
path: '/docs/renderers/QRCode',
getComponent: (location, cb) =>
require(['../../docs/renderers/QRCode.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Service',
path: '/docs/renderers/Service',
getComponent: (location, cb) =>
require(['../../docs/renderers/Service.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Table',
path: '/docs/renderers/Table',
getComponent: (location, cb) =>
require(['../../docs/renderers/Table.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
}),
children: [
{
label: 'Column',
path: '/docs/renderers/Column',
getComponent: (location, cb) =>
require(['../../docs/renderers/Column.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Operation',
path: '/docs/renderers/Operation',
getComponent: (location, cb) =>
require(['../../docs/renderers/Operation.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
}
]
},
{
label: 'Tabs',
path: '/docs/renderers/Tabs',
getComponent: (location, cb) =>
require(['../../docs/renderers/Tabs.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Tasks',
path: '/docs/renderers/Tasks',
getComponent: (location, cb) =>
require(['../../docs/renderers/Tasks.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Tpl',
path: '/docs/renderers/Tpl',
getComponent: (location, cb) =>
require(['../../docs/renderers/Tpl.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Video',
path: '/docs/renderers/Video',
getComponent: (location, cb) =>
require(['../../docs/renderers/Video.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Wrapper',
path: '/docs/renderers/Wrapper',
getComponent: (location, cb) =>
require(['../../docs/renderers/Wrapper.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: 'Wizard',
path: '/docs/renderers/Wizard',
getComponent: (location, cb) =>
require(['../../docs/renderers/Wizard.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
},
{
label: '类型说明',
path: '/docs/renderers/Types',
getComponent: (location, cb) =>
require(['../../docs/renderers/Types.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
}
]
},
// {{renderer-docs}}
{
label: 'API 说明',

View File

@ -2,6 +2,7 @@
* @file fis-conf.js 配置
*/
const path = require('path');
const fs = require('fs');
const package = require('./package.json');
const parserMarkdown = require('./build/md-parser');
fis.get('project.ignore').push('public/**', 'gh-pages/**', '.*/**');
@ -106,6 +107,7 @@ fis.match('monaco-editor/esm/**.js', {
fis.match('{*.ts,*.jsx,*.tsx,/src/**.js,/src/**.ts}', {
parser: [
docsGennerator,
fis.plugin('typescript', {
importHelpers: true,
esModuleInterop: true,
@ -177,6 +179,7 @@ if (fis.project.currentMedia() === 'publish') {
publishEnv.match('/src/**.{jsx,tsx,js,ts}', {
parser: [
docsGennerator,
fis.plugin('typescript', {
importHelpers: true,
sourceMap: true,
@ -283,6 +286,7 @@ if (fis.project.currentMedia() === 'publish') {
env.match('{*.ts,*.jsx,*.tsx,/src/**.js,/src/**.ts}', {
parser: [
docsGennerator,
fis.plugin('typescript', {
importHelpers: true,
esModuleInterop: true,
@ -681,3 +685,84 @@ if (fis.project.currentMedia() === 'publish') {
optimizer: null
});
}
function docsGennerator(contents, file) {
if (file.subpath !== '/examples/components/Doc.jsx') {
return contents;
}
return contents.replace('// {{renderer-docs}}', function() {
const dir = path.join(__dirname, 'docs/renderers');
const files = [];
let fn = (dir, colleciton, prefix = '') => {
const entries = fs.readdirSync(dir);
entries.forEach(entry => {
const subdir = path.join(dir, entry);
if (fs.lstatSync(subdir).isDirectory()) {
let files = [];
fn(subdir, files, path.join(prefix, entry));
colleciton.push({
name: entry,
children: files,
path: path.join(prefix, entry)
});
} else if (/\.md$/.test(entry)) {
colleciton.push({
name: path.basename(entry, '.md'),
path: path.join(prefix, entry)
});
}
});
};
let fn2 = item => {
if (item.children) {
const child = item.children.find(
child => child.name === `${item.name}.md`
);
return `{
label: '${item.name}',
${
child
? `path: '/docs/renderers/${child.path
.replace(/\.md$/, '')
.toLowerCase()}',`
: ''
}
children: [
${item.children.map(fn2).join(',\n')}
]
}`;
}
return `{
label: '${item.name}',
path: '/docs/renderers/${item.path
.replace(/\.md$/, '')
.toLowerCase()}',
getComponent: (location, cb) =>
require(['../../docs/renderers/${item.path}'], doc => {
cb(null, makeMarkdownRenderer(doc));
})
}`;
};
fn(dir, files);
return `{
label: '渲染器手册',
icon: 'fa fa-diamond',
path: '/docs/renderers',
getComponent: (location, cb) =>
require(['../../docs/renderers.md'], doc => {
cb(null, makeMarkdownRenderer(doc));
}),
children: [
${files.map(fn2).join(',\n')}
]
},`;
});
}

View File

@ -616,6 +616,7 @@ $Form--horizontal-label-widthLg: px2rem(200px) !default;
$Form-control-widthXs: px2rem(80px) !default;
$Form-control-widthSm: px2rem(160px) !default;
$Form-control-widthBase: px2rem(200px) !default;
$Form-control-widthMd: px2rem(240px) !default;
$Form-control-widthLg: px2rem(320px) !default;

View File

@ -1,4 +1,8 @@
.#{$ns}Combo {
&-placeholder {
color: $text--muted-color;
}
&-toolbarBtn {
line-height: $Combo-toolbarBtn-lineHeight;
height: $Combo-toolbarBtn-height;
@ -105,6 +109,12 @@
> .#{$ns}Combo-items {
margin: (-$Combo--vertical-item-gap * 2) (-$Combo--vertical-item-gap * 2)
0 (-$Combo--vertical-item-gap * 2);
> .#{$ns}Combo-placeholder {
padding: ($Combo--vertical-item-gap * 2) ($Combo--vertical-item-gap * 2)
0 ($Combo--vertical-item-gap * 2);
margin-bottom: $Combo--vertical-item-gap * 2;
}
}
.#{$ns}Combo-itemTag {

View File

@ -112,31 +112,46 @@
.#{$ns}Form-control--sizeXs {
// min-width: $Form-control-widthXs;
// width: auto;
width: $Form-control-widthXs;
min-width: $Form-control-widthXs;
max-width: 100%;
display: inline-block;
vertical-align: top;
// 非常难受number 类型的 input 不能设置size
&.#{$ns}NumberControl {
width: $Form-control-widthXs;
}
}
.#{$ns}Form-control--sizeSm {
width: $Form-control-widthSm;
min-width: $Form-control-widthSm;
max-width: 100%;
display: inline-block;
vertical-align: top;
// 非常难受number 类型的 input 不能设置size
&.#{$ns}NumberControl {
width: $Form-control-widthSm;
}
}
.#{$ns}Form-control--sizeMd {
width: $Form-control-widthMd;
min-width: $Form-control-widthMd;
max-width: 100%;
display: inline-block;
vertical-align: top;
}
.#{$ns}Form-control--sizeLg {
width: $Form-control-widthLg;
min-width: $Form-control-widthLg;
max-width: 100%;
display: inline-block;
vertical-align: top;
// 非常难受number 类型的 input 不能设置size
&.#{$ns}NumberControl {
width: $Form-control-widthLg;
}
}
.#{$ns}Form-item {
@ -270,6 +285,7 @@
> .#{$ns}Form-control {
flex-basis: 0;
flex-grow: 1;
min-width: unset;
}
}
}

View File

@ -19,6 +19,7 @@
@mixin input-text {
position: relative;
min-width: $Form-control-widthBase;
&.is-inline {
display: inline-block;

View File

@ -568,9 +568,9 @@ $Card-actions-onChecked-onHover-bg: $white;
@import '../components/form/qr-code';
@import '../components/form/tag';
@import '../components/form/rating';
@import '../components/form/form';
@import '../components/form/transfer-select';
@import '../components/form/nested-select';
@import '../components/form/icon-picker';
@import '../components/form/form';
@import '../utilities';

View File

@ -234,9 +234,9 @@ pre {
@import '../components/form/qr-code';
@import '../components/form/tag';
@import '../components/form/rating';
@import '../components/form/form';
@import '../components/form/transfer-select';
@import '../components/form/nested-select';
@import '../components/form/icon-picker';
@import '../components/form/form';
@import '../utilities';

View File

@ -99,9 +99,9 @@ $Form-input-borderColor: #cfdadd;
@import '../components/form/qr-code';
@import '../components/form/tag';
@import '../components/form/rating';
@import '../components/form/form';
@import '../components/form/transfer-select';
@import '../components/form/nested-select';
@import '../components/form/icon-picker';
@import '../components/form/form';
@import '../utilities';

View File

@ -234,10 +234,10 @@ export class ColorControl extends React.PureComponent<
)}
>
<input
size={10}
ref={this.input}
type="text"
autoComplete="off"
size={1}
className={cx('ColorPicker-input')}
value={this.state.inputValue || ''}
placeholder={placeholder}

View File

@ -27,7 +27,7 @@ export default class DropDownButton extends React.Component<
DropDownButtonState
> {
state: DropDownButtonState = {
isOpened: this.props.defaultIsOpened || false
isOpened: false
};
static defaultProps = {
@ -44,6 +44,14 @@ export default class DropDownButton extends React.Component<
this.domRef = this.domRef.bind(this);
}
componentDidMount() {
if (this.props.defaultIsOpened) {
this.setState({
isOpened: true
})
}
}
domRef(ref: any) {
this.target = ref;
}

View File

@ -94,7 +94,8 @@ export default class ComboControl extends React.Component<ComboProps> {
dragIcon: 'glyphicon glyphicon-sort',
deleteIcon: 'glyphicon glyphicon-remove',
tabsMode: false,
tabsStyle: ''
tabsStyle: '',
placeholder: '<空>'
};
static propsList: Array<string> = [
'minLength',
@ -865,7 +866,8 @@ export default class ComboControl extends React.Component<ComboProps> {
noBorder,
conditions,
lazyLoad,
changeImmediately
changeImmediately,
placeholder
} = this.props;
let controls = this.props.controls;
@ -890,7 +892,7 @@ export default class ComboControl extends React.Component<ComboProps> {
)}
>
<div className={cx(`Combo-items`)}>
{Array.isArray(value)
{Array.isArray(value) && value.length
? value.map((value, index, thelist) => {
const toolbar: Array<any> = [];
@ -1011,7 +1013,9 @@ export default class ComboControl extends React.Component<ComboProps> {
</div>
);
})
: null}
: placeholder ? (
<div className={cx(`Combo-placeholder`)}>{placeholder}</div>
) : null}
</div>
{!disabled ? (
<div className={cx(`Combo-toolbar`)}>

View File

@ -259,6 +259,7 @@ export default class IconPickerControl extends React.PureComponent<
value: this.state.inputValue
})}
autoComplete="off"
size={1}
/>
</div>
{isOpen ? (

View File

@ -508,6 +508,7 @@ export default class TextControl extends React.PureComponent<
onKeyDown: this.handleKeyDown
})}
autoComplete="off"
size={1}
/>
</div>
@ -591,6 +592,7 @@ export default class TextControl extends React.PureComponent<
onFocus={this.handleFocus}
onBlur={this.handleBlur}
autoComplete="off"
size={1}
onChange={this.handleNormalInputChange}
value={
typeof value === 'undefined' || value === null

View File

@ -189,6 +189,7 @@ export class TransferSelect extends React.Component<
<input
placeholder={searchPlaceholder}
autoComplete="off"
size={1}
value={this.state.keyword}
onChange={this.handleSearch}
/>
@ -290,6 +291,7 @@ export class TransferSelect extends React.Component<
<input
placeholder={searchPlaceholder}
autoComplete="off"
size={1}
onChange={this.handleSearch}
/>
<i className="fa fa-search" />