mirror of
https://github.com/smartxworks/sunmao-ui.git
synced 2024-11-21 03:15:49 +08:00
feat: optimise modal and pagination
This commit is contained in:
parent
a49e7d0d53
commit
d37986a19d
@ -18,7 +18,8 @@ const exampleProperties: Static<typeof ModalPropsSpec> = {
|
||||
closable: true,
|
||||
maskClosable: true,
|
||||
confirmLoading: false,
|
||||
defaultOpen:true
|
||||
defaultOpen: true,
|
||||
unmountOnExit: true,
|
||||
};
|
||||
export const Modal = implementRuntimeComponent({
|
||||
version: 'arco/v1',
|
||||
@ -89,7 +90,6 @@ export const Modal = implementRuntimeComponent({
|
||||
footer={slotsElements.footer}
|
||||
className={css(customStyle?.content)}
|
||||
mountOnEnter={true}
|
||||
unmountOnExit={true}
|
||||
{...cProps}
|
||||
>
|
||||
<div ref={contentRef}>{slotsElements.content}</div>
|
||||
|
@ -4,7 +4,7 @@ import { css, cx } from '@emotion/css';
|
||||
import { Type, Static } from '@sinclair/typebox';
|
||||
import { FALLBACK_METADATA, getComponentProps } from '../sunmao-helper';
|
||||
import { PaginationPropsSpec as BasePaginationPropsSpec } from '../generated/types/Pagination';
|
||||
import { useState } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
const PaginationPropsSpec = Type.Object(BasePaginationPropsSpec);
|
||||
const PaginationStateSpec = Type.Object({
|
||||
@ -21,6 +21,7 @@ const exampleProperties: Static<typeof PaginationPropsSpec> = {
|
||||
sizeCanChange: false,
|
||||
simple: false,
|
||||
showJumper: false,
|
||||
showTotal: false,
|
||||
};
|
||||
|
||||
const options = {
|
||||
@ -54,6 +55,10 @@ export const Pagination = implementRuntimeComponent(options)(props => {
|
||||
Reflect.deleteProperty(cProps, 'pageSize');
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
mergeState({ currentPage: current });
|
||||
}, []);
|
||||
|
||||
const handleChange = (pageNum: number) => {
|
||||
setCurrent(pageNum);
|
||||
mergeState({ currentPage: current });
|
||||
|
@ -29,7 +29,7 @@ export const DropdownPropsSpec = {
|
||||
}),
|
||||
unmountOnExit:Type.Boolean({
|
||||
title:'Unmount On Exit',
|
||||
category: Category.Basic
|
||||
category: Category.Behavior
|
||||
}),
|
||||
list: Type.Array(
|
||||
Type.Object({
|
||||
|
@ -42,4 +42,8 @@ export const ModalPropsSpec = {
|
||||
title: 'Confirm Loading',
|
||||
category: Category.Basic,
|
||||
}),
|
||||
unmountOnExit:Type.Boolean({
|
||||
title:'Unmount On Exit',
|
||||
category: Category.Behavior
|
||||
}),
|
||||
};
|
||||
|
@ -40,4 +40,8 @@ export const PaginationPropsSpec = {
|
||||
category: Category.Basic,
|
||||
description: 'Whether to display quick jump',
|
||||
}),
|
||||
showTotal: Type.Boolean({
|
||||
title: 'Show Total',
|
||||
category: Category.Basic,
|
||||
}),
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user