mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
fix: 修复由#8822引入的crud多选问题 (#8852)
Co-authored-by: wanglinfang <wanglinfang@baidu.com>
This commit is contained in:
parent
73ef317e2c
commit
e3527b376e
@ -1050,13 +1050,7 @@ export const TableStore = iRendererStore
|
||||
);
|
||||
}
|
||||
|
||||
if (config.multiple !== undefined) {
|
||||
self.multiple = config.multiple;
|
||||
} else {
|
||||
// 如果通过crud或picker,multiple始终设置了true或false
|
||||
// 如果仅使用table,默认multiple为true,但props未设置multiple的情况下其实是展示单选
|
||||
self.multiple = false;
|
||||
}
|
||||
config.multiple !== undefined && (self.multiple = config.multiple);
|
||||
config.footable !== undefined && (self.footable = config.footable);
|
||||
config.expandConfig !== undefined &&
|
||||
(self.expandConfig = config.expandConfig);
|
||||
|
@ -958,19 +958,7 @@ describe('Renderer:table selectable & itemCheckableOn', () => {
|
||||
]
|
||||
};
|
||||
|
||||
test('radio style', async () => {
|
||||
const {container} = render(amisRender(schema, {}, makeEnv({})));
|
||||
await waitFor(() => {
|
||||
expect(container.querySelector('[type=radio]')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
expect(
|
||||
container.querySelector('[data-id="1"] [type=radio][disabled=""]')!
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('checkbox style', async () => {
|
||||
schema.multiple = true;
|
||||
const {container} = render(amisRender(schema, {}, makeEnv({})));
|
||||
await waitFor(() => {
|
||||
expect(container.querySelector('[type=checkbox]')).toBeInTheDocument();
|
||||
@ -980,6 +968,18 @@ describe('Renderer:table selectable & itemCheckableOn', () => {
|
||||
container.querySelector('[data-id="1"] [type=checkbox][disabled=""]')!
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('radio style', async () => {
|
||||
schema.multiple = false;
|
||||
const {container} = render(amisRender(schema, {}, makeEnv({})));
|
||||
await waitFor(() => {
|
||||
expect(container.querySelector('[type=radio]')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
expect(
|
||||
container.querySelector('[data-id="1"] [type=radio][disabled=""]')!
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('dbClick', () => {
|
||||
|
@ -1760,8 +1760,6 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
store,
|
||||
query,
|
||||
onQuery,
|
||||
multiple,
|
||||
env,
|
||||
render,
|
||||
classPrefix: ns,
|
||||
resizable,
|
||||
@ -1805,7 +1803,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
style={style}
|
||||
className={cx(column.pristine.className, stickyClassName)}
|
||||
>
|
||||
{store.rows.length && multiple ? (
|
||||
{store.rows.length && store.multiple ? (
|
||||
<Checkbox
|
||||
classPrefix={ns}
|
||||
partial={store.someChecked && !store.allChecked}
|
||||
@ -2038,11 +2036,8 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
const {
|
||||
render,
|
||||
store,
|
||||
multiple,
|
||||
classPrefix: ns,
|
||||
classnames: cx,
|
||||
checkOnItemClick,
|
||||
popOverContainer,
|
||||
canAccessSuperData,
|
||||
itemBadge,
|
||||
translate
|
||||
@ -2058,7 +2053,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
ignoreDrag={ignoreDrag}
|
||||
render={render}
|
||||
store={store}
|
||||
multiple={multiple}
|
||||
multiple={store.multiple}
|
||||
canAccessSuperData={canAccessSuperData}
|
||||
classnames={cx}
|
||||
classPrefix={ns}
|
||||
|
Loading…
Reference in New Issue
Block a user