forked from p96170835/amis
Merge remote-tracking branch 'baidu/master'
This commit is contained in:
commit
59417650d4
|
@ -67,15 +67,19 @@ interface TreeSelectorProps {
|
|||
// 是否为内建 增、改、删。当有复杂表单的时候直接抛出去让外层能统一处理
|
||||
bultinCUD?: boolean;
|
||||
rootCreatable?: boolean;
|
||||
rootCreateTip?: string;
|
||||
creatable?: boolean;
|
||||
createTip?: string;
|
||||
onAdd?: (
|
||||
idx?: number | Array<number>,
|
||||
value?: any,
|
||||
skipForm?: boolean
|
||||
) => void;
|
||||
editable?: boolean;
|
||||
editTip?: string;
|
||||
onEdit?: (value: Option, origin?: Option, skipForm?: boolean) => void;
|
||||
removable?: boolean;
|
||||
deleteTip?: string;
|
||||
onDelete?: (value: Option) => void;
|
||||
}
|
||||
|
||||
|
@ -116,7 +120,11 @@ export class TreeSelector extends React.Component<
|
|||
rootLabel: '顶级',
|
||||
rootValue: 0,
|
||||
cascade: false,
|
||||
selfDisabledAffectChildren: true
|
||||
selfDisabledAffectChildren: true,
|
||||
rootCreateTip: '添加一级节点',
|
||||
createTip: '添加孩子节点',
|
||||
editTip: '编辑该节点',
|
||||
deleteTip: '移除该节点'
|
||||
};
|
||||
|
||||
componentWillMount() {
|
||||
|
@ -466,7 +474,10 @@ export class TreeSelector extends React.Component<
|
|||
minLength,
|
||||
creatable,
|
||||
editable,
|
||||
removable
|
||||
removable,
|
||||
createTip,
|
||||
editTip,
|
||||
deleteTip
|
||||
} = this.props;
|
||||
const {
|
||||
unfolded,
|
||||
|
@ -602,7 +613,7 @@ export class TreeSelector extends React.Component<
|
|||
{creatable && hasAbility(item, 'creatable') ? (
|
||||
<a
|
||||
onClick={this.handleAdd.bind(this, item)}
|
||||
data-tooltip="添加孩子节点"
|
||||
data-tooltip={createTip}
|
||||
>
|
||||
<Icon icon="plus" className="icon" />
|
||||
</a>
|
||||
|
@ -611,7 +622,7 @@ export class TreeSelector extends React.Component<
|
|||
{removable && hasAbility(item, 'removable') ? (
|
||||
<a
|
||||
onClick={this.handleRemove.bind(this, item)}
|
||||
data-tooltip="移除该节点"
|
||||
data-tooltip={deleteTip}
|
||||
>
|
||||
<Icon icon="minus" className="icon" />
|
||||
</a>
|
||||
|
@ -620,7 +631,7 @@ export class TreeSelector extends React.Component<
|
|||
{editable && hasAbility(item, 'editable') ? (
|
||||
<a
|
||||
onClick={this.handleEdit.bind(this, item)}
|
||||
data-tooltip="编辑该节点"
|
||||
data-tooltip={editTip}
|
||||
>
|
||||
<Icon icon="pencil" className="icon" />
|
||||
</a>
|
||||
|
@ -676,6 +687,7 @@ export class TreeSelector extends React.Component<
|
|||
classnames: cx,
|
||||
creatable,
|
||||
rootCreatable,
|
||||
rootCreateTip,
|
||||
disabled
|
||||
} = this.props;
|
||||
let options = this.props.options;
|
||||
|
@ -692,7 +704,7 @@ export class TreeSelector extends React.Component<
|
|||
onClick={this.handleAdd.bind(this, null)}
|
||||
>
|
||||
<Icon icon="plus" className="icon" />
|
||||
<span>添加一级节点</span>
|
||||
<span>{rootCreateTip}</span>
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
@ -731,7 +743,7 @@ export class TreeSelector extends React.Component<
|
|||
{creatable ? (
|
||||
<a
|
||||
onClick={this.handleAdd.bind(this, null)}
|
||||
data-tooltip="添加一级节点"
|
||||
data-tooltip={rootCreateTip}
|
||||
>
|
||||
<Icon icon="plus" className="icon" />
|
||||
</a>
|
||||
|
|
|
@ -500,7 +500,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|||
replaceLocation: boolean = false,
|
||||
search: boolean = true
|
||||
) {
|
||||
const {store, syncLocation, env, pageField, perPageField} = this.props;
|
||||
const {store, syncLocation, env, pageField, perPageField, loadDataOnceFetchOnFilter} = this.props;
|
||||
values = syncLocation ? qs.parse(qsstringify(values)) : values;
|
||||
|
||||
store.updateQuery(
|
||||
|
@ -515,7 +515,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|||
perPageField
|
||||
);
|
||||
this.lastQuery = store.query;
|
||||
search && this.search();
|
||||
search && this.search(undefined, undefined, undefined, loadDataOnceFetchOnFilter);
|
||||
}
|
||||
|
||||
handleBulkGo(
|
||||
|
@ -673,7 +673,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|||
values?: any,
|
||||
silent?: boolean,
|
||||
clearSelection?: boolean,
|
||||
forceReload = true
|
||||
forceReload = false
|
||||
) {
|
||||
const {
|
||||
store,
|
||||
|
@ -782,7 +782,8 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|||
pageField,
|
||||
perPageField
|
||||
);
|
||||
this.search(undefined, undefined, undefined, false);
|
||||
|
||||
this.search(undefined, undefined, undefined);
|
||||
|
||||
if (autoJumpToTopOnPagerChange && this.control) {
|
||||
(findDOMNode(this.control) as HTMLElement).scrollIntoView();
|
||||
|
@ -1060,7 +1061,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|||
if (query) {
|
||||
return this.receive(query);
|
||||
} else {
|
||||
this.search(undefined, undefined, true);
|
||||
this.search(undefined, undefined, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -774,9 +774,9 @@ export function registerOptionsControl(config: OptionsConfig) {
|
|||
setOptions={this.setOptions}
|
||||
syncOptions={this.syncOptions}
|
||||
reloadOptions={this.reload}
|
||||
creatable={creatable || isEffectiveApi(addApi)}
|
||||
editable={editable || isEffectiveApi(editApi)}
|
||||
removable={removable || isEffectiveApi(deleteApi)}
|
||||
creatable={creatable || creatable !== false && isEffectiveApi(addApi)}
|
||||
editable={editable || editable !== false && isEffectiveApi(editApi)}
|
||||
removable={removable || removable !== false && isEffectiveApi(deleteApi)}
|
||||
onAdd={this.handleOptionAdd}
|
||||
onEdit={this.handleOptionEdit}
|
||||
onDelete={this.handleOptionDelete}
|
||||
|
|
|
@ -59,13 +59,17 @@ export default class TreeControl extends React.Component<TreeProps> {
|
|||
showRadio,
|
||||
onAdd,
|
||||
creatable,
|
||||
createTip,
|
||||
addControls,
|
||||
onEdit,
|
||||
editable,
|
||||
editTip,
|
||||
editControls,
|
||||
removable,
|
||||
deleteTip,
|
||||
onDelete,
|
||||
rootCreatable
|
||||
rootCreatable,
|
||||
rootCreateTip
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
|
@ -99,10 +103,14 @@ export default class TreeControl extends React.Component<TreeProps> {
|
|||
selfDisabledAffectChildren={false}
|
||||
onAdd={onAdd}
|
||||
creatable={creatable}
|
||||
createTip={createTip}
|
||||
rootCreatable={rootCreatable}
|
||||
rootCreateTip={rootCreateTip}
|
||||
onEdit={onEdit}
|
||||
editable={editable}
|
||||
editTip={editTip}
|
||||
removable={removable}
|
||||
deleteTip={deleteTip}
|
||||
onDelete={onDelete}
|
||||
bultinCUD={!addControls && !editControls}
|
||||
/>
|
||||
|
|
|
@ -129,8 +129,7 @@ export const CRUDStore = ServiceStore.named('CRUDStore')
|
|||
) {
|
||||
try {
|
||||
if (
|
||||
(options.forceReload === false ||
|
||||
options.loadDataOnceFetchOnFilter === false) &&
|
||||
!options.forceReload &&
|
||||
options.loadDataOnce &&
|
||||
self.total
|
||||
) {
|
||||
|
|
Loading…
Reference in New Issue