Skip to content

Commit

Permalink
pass trigger api
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Nov 25, 2019
1 parent 5856322 commit 8e3e0af
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import * as React from 'react';
import KeyCode from 'rc-util/lib/KeyCode';
import classNames from 'classnames';
import { AlignType } from 'rc-trigger/lib/interface';
import PickerPanel, { PickerPanelProps } from './PickerPanel';
import PickerTrigger from './PickerTrigger';
import { isEqual } from './utils/dateUtil';
Expand All @@ -25,7 +26,9 @@ import PanelContext, { ContextOperationRefProps } from './PanelContext';
export interface PickerProps<DateType>
extends Omit<PickerPanelProps<DateType>, 'onChange'> {
dropdownClassName?: string;
dropdownAlign?: AlignType;
popupStyle?: React.CSSProperties;
transitionName?: string;
placeholder?: string;
allowClear?: boolean;
autoFocus?: boolean;
Expand Down Expand Up @@ -55,7 +58,9 @@ function InnerPicker<DateType>(props: PickerProps<DateType>) {
style,
className,
dropdownClassName,
dropdownAlign,
popupStyle,
transitionName,
generateConfig,
locale,
allowClear,
Expand Down Expand Up @@ -334,7 +339,9 @@ function InnerPicker<DateType>(props: PickerProps<DateType>) {
popupStyle={popupStyle}
prefixCls={prefixCls}
dropdownClassName={dropdownClassName}
dropdownAlign={dropdownAlign}
getPopupContainer={getPopupContainer}
transitionName={transitionName}
>
<div className={`${prefixCls}-input`}>
<input
Expand Down
9 changes: 9 additions & 0 deletions src/PickerTrigger.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import Trigger from 'rc-trigger';
import { AlignType } from 'rc-trigger/lib/interface';

const BUILT_IN_PLACEMENTS = {
bottomLeft: {
Expand Down Expand Up @@ -27,7 +28,9 @@ export interface PickerTriggerProps {
popupStyle?: React.CSSProperties;
children: React.ReactElement;
dropdownClassName?: string;
transitionName?: string;
getPopupContainer?: (node: HTMLElement) => HTMLElement;
dropdownAlign?: AlignType;
}

function PickerTrigger({
Expand All @@ -36,17 +39,23 @@ function PickerTrigger({
popupStyle,
visible,
dropdownClassName,
dropdownAlign,
transitionName,
getPopupContainer,
children,
}: PickerTriggerProps) {
const dropdownPrefixCls = `${prefixCls}-dropdown`;

return (
<Trigger
showAction={[]}
hideAction={[]}
popupPlacement="bottomLeft"
builtinPlacements={BUILT_IN_PLACEMENTS}
prefixCls={dropdownPrefixCls}
popupTransitionName={transitionName}
popup={popupElement}
popupAlign={dropdownAlign}
popupVisible={visible}
popupClassName={dropdownClassName}
popupStyle={popupStyle}
Expand Down

1 comment on commit 8e3e0af

@vercel
Copy link

@vercel vercel bot commented on 8e3e0af Nov 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.