Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions packages/amis-ui/src/components/ConfirmBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface ConfirmBoxProps extends LocaleProps, ThemeProps {
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
position?: 'top' | 'right' | 'bottom' | 'left';
resizable?: boolean;
type: 'dialog' | 'drawer';
type?: 'dialog' | 'drawer';
className?: string;
headerClassName?: string;
bodyClassName?: string;
Expand All @@ -46,7 +46,7 @@ export interface ConfirmBoxProps extends LocaleProps, ThemeProps {
}

export function ConfirmBox({
type,
type = 'dialog',
size,
closeOnEsc,
show,
Expand All @@ -60,7 +60,7 @@ export function ConfirmBox({
onConfirm,
beforeConfirm,
popOverContainer,
position,
position = 'right',
resizable,
classnames: cx,
className,
Expand Down Expand Up @@ -242,10 +242,4 @@ export function ConfirmBox({

return type === 'drawer' ? renderDrawer() : renderDialog();
}

ConfirmBox.defaultProps = {
type: 'dialog' as 'dialog',
position: 'right' as 'right'
};

export default localeable(themeable(ConfirmBox));
12 changes: 3 additions & 9 deletions packages/amis-ui/src/components/DndContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ const DndContainer: React.FC<DndContainerProps> = (
className,
classnames: cx,
children,
axis,
axis = 'both',
position,
defaultPosition,
bounds,
grid,
handle,
cancel,
draggable,
scale,
enableUserSelect,
scale = 1,
enableUserSelect = false,
nodeRef,
onDrag,
onStart,
Expand Down Expand Up @@ -93,10 +93,4 @@ const DndContainer: React.FC<DndContainerProps> = (
);
};

DndContainer.defaultProps = {
axis: 'both',
scale: 1,
enableUserSelect: false
};

export default localeable(themeable(DndContainer));
26 changes: 16 additions & 10 deletions packages/amis-ui/src/components/GridNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,21 +201,34 @@ const GridNav: React.FC<GridNavProps> = ({
classnames: cx,
itemClassName,
style,
direction = 'vertical',
center = true,
border = true,
columnNum = 4,
...props
}) => {
const parentProps = {
...props,
direction,
center,
border,
columnNum,
style
};

return (
<div
style={{paddingLeft: addUnit(props.gutter), ...style}}
style={{paddingLeft: addUnit(parentProps.gutter), ...style}}
className={cx(`GridNav ${className || ''}`, {
'GridNav-top u-hairline': props.border && !props.gutter
'GridNav-top u-hairline': parentProps.border && !parentProps.gutter
})}
>
{React.Children.toArray(children)
.filter(Boolean)
.map((child: React.ReactElement, index: number) =>
React.cloneElement(child, {
index,
parent: props,
parent: parentProps,
className: itemClassName,
classnames: cx
})
Expand All @@ -224,11 +237,4 @@ const GridNav: React.FC<GridNavProps> = ({
);
};

GridNav.defaultProps = {
direction: 'vertical',
center: true,
border: true,
columnNum: 4
};

export default GridNav;
4 changes: 0 additions & 4 deletions packages/amis-ui/src/components/OverflowTpl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,4 @@ const OverflowTpl: React.FC<OverflowTplProps> = props => {
);
};

OverflowTpl.defaultProps = {
inline: true
};

export default themeable(OverflowTpl);
8 changes: 0 additions & 8 deletions packages/amis-ui/src/components/PickerColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -389,14 +389,6 @@ const PickerColumn = forwardRef<{}, PickerColumnProps>((props, ref) => {
</div>
);
});

PickerColumn.defaultProps = {
options: [],
visibleItemCount: 5,
swipeDuration: 1000,
itemHeight: 48
};

export default themeable(
uncontrollable(PickerColumn, {
value: 'onChange'
Expand Down
30 changes: 6 additions & 24 deletions packages/amis-ui/src/components/PullRefresh.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,36 +51,20 @@ export interface PullRefreshState {
offsetY: number;
}

const defaultProps: {
successDuration: number;
loadingDuration: number;
direction?: 'up' | 'down';
showIcon: boolean;
showText: boolean;
iconType: string;
} = {
successDuration: 0,
loadingDuration: 0,
direction: 'down',
showIcon: true,
showText: true,
iconType: 'loading-outline'
};

const defaultHeaderHeight = 28;

const PullRefresh = forwardRef<{}, PullRefreshProps>((props, ref) => {
const {
classnames: cx,
translate: __,
children,
successDuration,
loadingDuration,
direction,
successDuration = 0,
loadingDuration = 0,
direction = 'down',
completed,
showIcon,
showText,
iconType,
showIcon = true,
showText = true,
iconType = 'loading-outline',
color,
contentText
} = props;
Expand Down Expand Up @@ -272,6 +256,4 @@ const PullRefresh = forwardRef<{}, PullRefreshProps>((props, ref) => {
);
});

PullRefresh.defaultProps = defaultProps;

export default themeable(PullRefresh);
Loading