This commit is contained in:
liaoxuezhi 2020-06-16 22:39:51 +08:00
commit 21ccfc20e8
17 changed files with 96 additions and 18 deletions

View File

@ -34,3 +34,29 @@
```
如果不希望 File 控件接管上传,可以配置 `asBlob` 或者 `asBase64` 这两个属性二选一采用这种方式后File 控件不再自己上传了,而是直接把文件数据作为表单项的值,文件内容会在 Form 表单提交的接口里面一起带上。
### 接口说明
开始之前请你先阅读[整体要求](../api.md)。
#### reciever
用来自己实现文件接收
**发送:**
POST 方式,内容体为 form-data/multipart 格式。文件的字段名为 file。
**响应:**
常规返回格式如下:
```json
{
"status": 0,
"msg": "",
"data": {
"value": "一般为文件的下载地址"
}
}
```

View File

@ -1,9 +1,11 @@
import React from 'react';
import NotFound from '../../src/components/404';
import NotFound from '../../src/components/404';
import Layout from '../../src/components/Layout';
import AsideNav from '../../src/components/AsideNav';
import {AlertComponent, ToastComponent} from '../../src/components/index';
import {mapTree} from '../../src/utils/helper';
import {Icon} from '../../src/components/icons';
import '../../src/locale/en';
import {
Router,
@ -668,7 +670,9 @@ export class App extends React.PureComponent {
key="expand-toggle"
className={cx('AsideNav-itemArrow')}
onClick={e => toggleExpand(link, e)}
/>
>
<Icon icon="right-arrow-bold" className="icon" />
</span>
);
}

View File

@ -1,6 +1,6 @@
{
"name": "amis",
"version": "1.0.12",
"version": "1.0.14",
"description": "一种MIS页面生成工具",
"main": "lib/index.js",
"scripts": {

View File

@ -948,7 +948,7 @@ $DropDown-menuItem-paddingY: (
) / 2 !default;
$DropDown-menuItem-paddingX: $gap-sm !default;
$DropDown-menuItem-onHover-color: inherit !default;
$DropDown-menuItem-onHover-bg: $Button--default-onHover-bg !default;
$DropDown-menuItem-onHover-bg: $ListMenu-item--onHover-bg !default;
// Checks
$Checkbox-gap: $gap-sm !default;

View File

@ -85,4 +85,8 @@
border: none;
box-shadow: none;
}
> .#{$ns}Button {
min-width: unset;
}
}

View File

@ -10,6 +10,7 @@
> a,
> span {
user-select: none;
cursor: pointer;
position: relative;
float: left;
text-decoration: none;

View File

@ -24,7 +24,7 @@
line-height: px2rem(17px);
margin-top: px2rem(2px);
&::before {
&:empty:before {
content: '';
display: inline-block;
transform-origin: center;
@ -36,10 +36,22 @@
background-repeat: no-repeat;
}
.#{$ns}AsideNav-item.is-open > a > &::before {
.#{$ns}AsideNav-item.is-open > a > &:empty:before {
transform: rotate(90deg);
color: $Layout-asideLink-onActive-arrowColor;
}
> svg {
color: $Layout-asideLink-color;
width: px2rem(10px);
height: px2rem(10px);
transform-origin: center;
transition: transform 0.2s ease;
}
.#{$ns}AsideNav-item.is-open > a > & > svg {
transform: rotate(90deg);
}
}
&-itemBadge {

View File

@ -415,7 +415,7 @@ $Toast-border-width: px2rem(1px);
$Toast-icon-width: px2rem(16px);
$Toast-icon-height: px2rem(16px);
$Toast-opacity: 1;
$Toast-title-display: inline-block;
$Toast-title-display: inline;
// Toast color
$Toast-color: $white;

View File

@ -6,7 +6,7 @@ import {Icon} from './icons';
export interface InputBoxProps
extends ThemeProps,
Omit<React.InputHTMLAttributes<HTMLInputElement>, 'prefix' | 'onChange'> {
Omit<React.DOMAttributes<HTMLInputElement>, 'prefix' | 'onChange'> {
value?: string;
onChange?: (value: string) => void;
onClear?: (e: React.MouseEvent<any>) => void;

View File

@ -126,6 +126,17 @@ export default class TinymceEditor extends React.Component<TinymceEditorProps> {
tinymce.init(this.config);
}
componentDidUpdate(prevProps: TinymceEditorProps) {
const props = this.props;
if (
props.model !== prevProps.model &&
props.model !== this.currentContent
) {
this.editor?.setContent(props.model || '');
}
}
componentWillUnmount() {
tinymce.remove(this.editor);
}

View File

@ -799,6 +799,7 @@ export function HocStoreFactory(renderer: {
props.data.__super,
false
)) &&
// nextProps.data.__super !== props.data.__super) &&
store.initData(
createObject(nextProps.data.__super, {
...nextProps.data,

View File

@ -1,6 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 16 16" version="1.1">
<g fill="currentColor" fill-rule="nonzero">
<path d="M11.496,1.834 L14.168,4.506 C14.48,4.818 14.48,5.322 14.168,5.634 L11.904,7.898 L5.4,14.402 L1.6,14.402 L1.6,10.602 L8.848,3.354 L8.848,3.354 L10.368,1.834 C10.68,1.522 11.184,1.522 11.496,1.834 Z M8.67,4.663 L2.4,10.9333708 L2.4,13.602 L5.06862915,13.602 L11.338,7.331 L8.67,4.663 Z M10.932,2.40137085 L9.23537085,4.098 L11.904,6.76662915 L13.6006292,5.07 L10.932,2.40137085 Z M8,13.6 L12.8,13.6 L12.8,14.4 L8,14.4 L8,13.6 Z">
<?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 14 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="pencil" fill="currentColor" fill-rule="nonzero">
<path d="M10.496,0.834 L13.168,3.506 C13.48,3.818 13.48,4.322 13.168,4.634 L10.904,6.898 L4.4,13.402 L0.6,13.402 L0.6,9.602 L7.848,2.354 L7.848,2.354 L9.368,0.834 C9.68,0.522 10.184,0.522 10.496,0.834 Z M7.67,3.663 L1.4,9.9333708 L1.4,12.602 L4.06862915,12.602 L10.338,6.331 L7.67,3.663 Z M9.932,1.40137085 L8.23537085,3.098 L10.904,5.76662915 L12.6006292,4.07 L9.932,1.40137085 Z M7,12.6 L11.8,12.6 L11.8,13.4 L7,13.4 L7,12.6 Z" id="形状">
</path>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 625 B

After

Width:  |  Height:  |  Size: 682 B

View File

@ -359,7 +359,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
redirect && !action.blank && env.jumpTo(redirect, action);
action.reload
? this.reloadTarget(action.reload, data)
: this.search(undefined, undefined, true);
: this.search(undefined, undefined, true, true);
})
.catch(() => {});
} else if (
@ -630,6 +630,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
this.search(
dialogAction.__from ? {[pageField || 'page']: 1} : undefined,
undefined,
true,
true
);
} else if (
@ -757,7 +758,15 @@ export default class CRUD extends React.Component<CRUDProps, any> {
evalExpression(stopAutoRefreshWhen, data)
)) &&
(this.timer = setTimeout(
silentPolling ? this.silentSearch : this.search,
silentPolling
? this.silentSearch.bind(this, undefined, undefined, true)
: this.search.bind(
this,
undefined,
undefined,
undefined,
true
),
Math.max(interval, 3000)
));
return value;
@ -765,8 +774,8 @@ export default class CRUD extends React.Component<CRUDProps, any> {
: source && store.initFromScope(data, source);
}
silentSearch(values?: object) {
return this.search(values, true);
silentSearch(values?: object, clearSelection?: boolean, forceReload = false) {
return this.search(values, true, clearSelection, forceReload);
}
handleChangePage(page: number, perPage?: number) {

View File

@ -434,6 +434,7 @@ export class CardItemFieldRenderer extends TableCell {
render() {
let {
type,
className,
render,
style,

View File

@ -169,6 +169,7 @@ export default class RichTextControl extends React.Component<
} else {
const fetcher = props.env.fetcher;
this.config = {
...props.options,
images_upload_url: props.reciever,
images_upload_handler: async (
blobInfo: any,

View File

@ -9,7 +9,13 @@ import {
import {iRendererStore} from './iRenderer';
import isEqual from 'lodash/isEqual';
import find from 'lodash/find';
import {createObject, isObject, guid, immutableExtends} from '../utils/helper';
import {
createObject,
isObject,
guid,
immutableExtends,
extendObject
} from '../utils/helper';
import {evalExpression} from '../utils/tpl';
export const Item = types
@ -41,7 +47,7 @@ export const Item = types
get locals(): any {
return createObject(
createObject((getParent(self, 2) as IListStore).data, {
extendObject((getParent(self, 2) as IListStore).data, {
index: self.index
}),
self.data

View File

@ -22,7 +22,8 @@ import {
flattenTree,
eachTree,
difference,
immutableExtends
immutableExtends,
extendObject
} from '../utils/helper';
import {evalExpression} from '../utils/tpl';
@ -128,7 +129,7 @@ export const Row = types
get locals(): any {
return createObject(
createObject((getParent(self, self.depth * 2) as ITableStore).data, {
extendObject((getParent(self, self.depth * 2) as ITableStore).data, {
index: self.index
}),
self.data