mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
Merge remote-tracking branch 'baidu/master'
This commit is contained in:
commit
f4b6dc80b2
@ -1684,6 +1684,10 @@ crud 组件支持通过配置`headerToolbar`和`footerToolbar`属性,实现在
|
||||
}
|
||||
```
|
||||
|
||||
## 总结行
|
||||
|
||||
如果是默认的表格模式,还支持增加总结行,具体请参考 [table](./table#总结行) 的文档。
|
||||
|
||||
## 弹框与数据链
|
||||
|
||||
一般 CRUD 中会有弹框,然后进行数据展示或进行二次编辑的需求,通过在列中配置按钮,然后配置弹框,弹框内配置相应的组件即可。
|
||||
|
@ -12,6 +12,10 @@ export interface NumberProps extends ThemeProps {
|
||||
showSteps?: boolean;
|
||||
precision?: number;
|
||||
disabled?: boolean;
|
||||
/**
|
||||
* 只读
|
||||
*/
|
||||
readOnly?: boolean;
|
||||
value?: number;
|
||||
onChange?: (value: number) => void;
|
||||
/**
|
||||
@ -30,7 +34,9 @@ export interface NumberProps extends ThemeProps {
|
||||
|
||||
export class NumberInput extends React.Component<NumberProps, any> {
|
||||
static defaultProps = {
|
||||
step: 1
|
||||
step: 1,
|
||||
readOnly: false,
|
||||
borderMode: 'full'
|
||||
};
|
||||
|
||||
@autobind
|
||||
@ -66,7 +72,8 @@ export class NumberInput extends React.Component<NumberProps, any> {
|
||||
showSteps,
|
||||
formatter,
|
||||
parser,
|
||||
borderMode
|
||||
borderMode,
|
||||
readOnly
|
||||
} = this.props;
|
||||
|
||||
let precisionProps: any = {};
|
||||
@ -81,6 +88,7 @@ export class NumberInput extends React.Component<NumberProps, any> {
|
||||
showSteps === false ? 'no-steps' : '',
|
||||
{[`Number--border${ucFirst(borderMode)}`]: borderMode}
|
||||
)}
|
||||
readOnly={readOnly}
|
||||
prefixCls={`${ns}Number`}
|
||||
value={value}
|
||||
step={step}
|
||||
|
@ -290,7 +290,7 @@ export class TreeSelector extends React.Component<
|
||||
let child = children.shift();
|
||||
let index = value.indexOf(child);
|
||||
|
||||
if (child.children) {
|
||||
if (child.children && child.children.length) {
|
||||
children.push.apply(children, child.children);
|
||||
} else if (!~index && child.value !== 'undefined') {
|
||||
value.push(child);
|
||||
|
@ -220,19 +220,20 @@ export function withRemoteConfig<P = any>(
|
||||
);
|
||||
} else if (env && isEffectiveApi(source, data)) {
|
||||
this.loadConfig();
|
||||
this.toDispose.push(
|
||||
reaction(
|
||||
() => {
|
||||
const api = normalizeApi(source as string);
|
||||
return api.trackExpression
|
||||
? tokenize(api.trackExpression, store.data)
|
||||
: buildApi(api, store.data, {
|
||||
ignoreData: true
|
||||
}).url;
|
||||
},
|
||||
() => this.loadConfig()
|
||||
)
|
||||
);
|
||||
source.autoRefresh !== false &&
|
||||
this.toDispose.push(
|
||||
reaction(
|
||||
() => {
|
||||
const api = normalizeApi(source as string);
|
||||
return api.trackExpression
|
||||
? tokenize(api.trackExpression, store.data)
|
||||
: buildApi(api, store.data, {
|
||||
ignoreData: true
|
||||
}).url;
|
||||
},
|
||||
() => this.loadConfig()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -931,8 +931,9 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
if (component && component.props.type === 'form') {
|
||||
// 数据保存了,说明列表数据已经无效了,重新刷新。
|
||||
if (value && (value as any).__saved) {
|
||||
const reload = action.reload ?? dialogAction.reload;
|
||||
// 配置了 reload 则跳过自动更新。
|
||||
dialogAction.reload ||
|
||||
reload ||
|
||||
this.search(
|
||||
dialogAction.__from ? {[pageField || 'page']: 1} : undefined,
|
||||
undefined,
|
||||
@ -950,11 +951,13 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
}
|
||||
}
|
||||
|
||||
if (dialogAction.reload) {
|
||||
this.reloadTarget(dialogAction.reload, ctx);
|
||||
const reload = action.reload ?? dialogAction.reload;
|
||||
if (reload) {
|
||||
this.reloadTarget(reload, ctx);
|
||||
}
|
||||
|
||||
const redirect = dialogAction.redirect && filter(action.redirect, ctx);
|
||||
let redirect = action.redirect ?? dialogAction.redirect;
|
||||
redirect = redirect && filter(redirect, ctx);
|
||||
redirect && env.jumpTo(redirect, dialogAction);
|
||||
}
|
||||
|
||||
|
@ -847,11 +847,10 @@ export class DialogRenderer extends Dialog {
|
||||
const scoped = this.context as IScopedContext;
|
||||
const store = this.props.store;
|
||||
const dialogAction = store.action as Action;
|
||||
const reload = action.reload ?? dialogAction.reload;
|
||||
|
||||
if (dialogAction.reload) {
|
||||
scoped.reload(dialogAction.reload, store.data);
|
||||
} else if (action.reload) {
|
||||
scoped.reload(action.reload, store.data);
|
||||
if (reload) {
|
||||
scoped.reload(reload, store.data);
|
||||
} else {
|
||||
// 没有设置,则自动让页面中 crud 刷新。
|
||||
scoped
|
||||
|
@ -866,11 +866,10 @@ export class DrawerRenderer extends Drawer {
|
||||
const scoped = this.context as IScopedContext;
|
||||
const store = this.props.store;
|
||||
const dialogAction = store.action as Action;
|
||||
const reload = action.reload ?? dialogAction.reload;
|
||||
|
||||
if (dialogAction.reload) {
|
||||
scoped.reload(dialogAction.reload, store.data);
|
||||
} else if (action.reload) {
|
||||
scoped.reload(action.reload, store.data);
|
||||
if (reload) {
|
||||
scoped.reload(reload, store.data);
|
||||
} else {
|
||||
// 没有设置,则自动让页面中 crud 刷新。
|
||||
scoped
|
||||
|
@ -51,7 +51,11 @@ export interface NumberControlSchema extends FormBaseControl {
|
||||
/**
|
||||
* 是否千分分隔
|
||||
*/
|
||||
kilobitSeparator?: boolean;
|
||||
kilobitSeparator?: boolean;
|
||||
/**
|
||||
* 只读
|
||||
*/
|
||||
readOnly?: boolean
|
||||
}
|
||||
|
||||
export interface NumberProps extends FormControlProps {
|
||||
@ -76,6 +80,10 @@ export interface NumberProps extends FormControlProps {
|
||||
* 是否千分分隔
|
||||
*/
|
||||
kilobitSeparator?: boolean;
|
||||
/**
|
||||
* 只读
|
||||
*/
|
||||
readOnly?: boolean
|
||||
}
|
||||
|
||||
export default class NumberControl extends React.Component<NumberProps, any> {
|
||||
@ -123,7 +131,8 @@ export default class NumberControl extends React.Component<NumberProps, any> {
|
||||
borderMode,
|
||||
suffix,
|
||||
prefix,
|
||||
kilobitSeparator
|
||||
kilobitSeparator,
|
||||
readOnly
|
||||
} = this.props;
|
||||
|
||||
let precisionProps: any = {};
|
||||
@ -166,6 +175,7 @@ export default class NumberControl extends React.Component<NumberProps, any> {
|
||||
precision={finalPrecision}
|
||||
showSteps={showSteps}
|
||||
borderMode={borderMode}
|
||||
readOnly={readOnly}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
@ -722,9 +722,10 @@ export class PageRenderer extends Page {
|
||||
const scoped = this.context;
|
||||
const store = this.props.store;
|
||||
const dialogAction = store.action as Action;
|
||||
const reload = action.reload ?? dialogAction.reload;
|
||||
|
||||
if (dialogAction.reload) {
|
||||
scoped.reload(dialogAction.reload, store.data);
|
||||
if (reload) {
|
||||
scoped.reload(reload, store.data);
|
||||
} else {
|
||||
// 没有设置,则自动让页面中 crud 刷新。
|
||||
scoped
|
||||
@ -739,11 +740,12 @@ export class PageRenderer extends Page {
|
||||
const scoped = this.context as IScopedContext;
|
||||
const store = this.props.store;
|
||||
const drawerAction = store.action as Action;
|
||||
const reload = action.reload ?? drawerAction.reload;
|
||||
|
||||
// 稍等会,等动画结束。
|
||||
setTimeout(() => {
|
||||
if (drawerAction.reload) {
|
||||
scoped.reload(drawerAction.reload, store.data);
|
||||
if (reload) {
|
||||
scoped.reload(reload, store.data);
|
||||
} else {
|
||||
// 没有设置,则自动让页面中 crud 刷新。
|
||||
scoped
|
||||
|
Loading…
Reference in New Issue
Block a user