Skip to content

Commit 1f652bf

Browse files
committed
chore: of it
1 parent dba1414 commit 1f652bf

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

docs/examples/basic.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,16 @@ export default () => {
5151
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
5252
<div style={{ margin: '0 8px' }}>
5353
<h3>Basic</h3>
54-
<Picker<Moment> {...sharedProps} locale={zhCN} suffixIcon="SUFFIX" />
54+
<Picker<Moment>
55+
{...sharedProps}
56+
locale={zhCN}
57+
suffixIcon="SUFFIX"
58+
rootClassName="bamboo"
59+
className="little"
60+
classNames={{
61+
root: 'light',
62+
}}
63+
/>
5564
<Picker<Moment> {...sharedProps} locale={enUS} />
5665
</div>
5766
<div style={{ margin: '0 8px' }}>

src/PickerInput/RangePicker.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useEvent, useMergedState } from '@rc-component/util';
2+
import cls from 'classnames';
23
import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect';
34
import omit from '@rc-component/util/lib/omit';
45
import pickAttrs from '@rc-component/util/lib/pickAttrs';
@@ -159,6 +160,7 @@ function RangePicker<DateType extends object = any>(
159160
const {
160161
// Style
161162
prefixCls,
163+
rootClassName,
162164
styles: propStyles,
163165
classNames: propClassNames,
164166

@@ -770,7 +772,7 @@ function RangePicker<DateType extends object = any>(
770772
{...pickTriggerProps(filledProps)}
771773
popupElement={panel}
772774
popupStyle={mergedStyles.popup.root}
773-
popupClassName={mergedClassNames.popup.root}
775+
popupClassName={cls(rootClassName, mergedClassNames.popup.root)}
774776
// Visible
775777
visible={mergedOpen}
776778
onClose={onPopupClose}
@@ -782,6 +784,12 @@ function RangePicker<DateType extends object = any>(
782784
{...filledProps}
783785
// Ref
784786
ref={selectorRef}
787+
// Style
788+
className={cls(filledProps.className, rootClassName, mergedClassNames.root)}
789+
style={{
790+
...mergedStyles.root,
791+
...filledProps.style,
792+
}}
785793
// Icon
786794
suffixIcon={suffixIcon}
787795
// Active

src/PickerInput/SinglePicker.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useEvent, useMergedState } from '@rc-component/util';
2+
import cls from 'classnames';
23
import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect';
34
import omit from '@rc-component/util/lib/omit';
45
import pickAttrs from '@rc-component/util/lib/pickAttrs';
@@ -123,6 +124,7 @@ function Picker<DateType extends object = any>(
123124
const {
124125
// Style
125126
prefixCls,
127+
rootClassName,
126128
styles: propStyles,
127129
classNames: propClassNames,
128130

@@ -630,7 +632,7 @@ function Picker<DateType extends object = any>(
630632
{...pickTriggerProps(filledProps)}
631633
popupElement={panel}
632634
popupStyle={mergedStyles.popup.root}
633-
popupClassName={mergedClassNames.popup.root}
635+
popupClassName={cls(rootClassName, mergedClassNames.popup.root)}
634636
// Visible
635637
visible={mergedOpen}
636638
onClose={onPopupClose}
@@ -640,6 +642,12 @@ function Picker<DateType extends object = any>(
640642
{...filledProps}
641643
// Ref
642644
ref={selectorRef}
645+
// Style
646+
className={cls(filledProps.className, rootClassName, mergedClassNames.root)}
647+
style={{
648+
...mergedStyles.root,
649+
...filledProps.style,
650+
}}
643651
// Icon
644652
suffixIcon={suffixIcon}
645653
removeIcon={removeIcon}

src/interface.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,12 +329,13 @@ export interface SharedPickerProps<DateType extends object = any>
329329
prefixCls?: string;
330330
className?: string;
331331
style?: React.CSSProperties;
332+
rootClassName?: string;
332333

333334
styles?: Partial<Record<SemanticName, React.CSSProperties>> & {
334-
popup: Partial<Record<PanelSemanticName, React.CSSProperties>>;
335+
popup?: Partial<Record<PanelSemanticName, React.CSSProperties>>;
335336
};
336337
classNames?: Partial<Record<SemanticName, string>> & {
337-
popup: Partial<Record<PanelSemanticName, string>>;
338+
popup?: Partial<Record<PanelSemanticName, string>>;
338339
};
339340

340341
// Config

0 commit comments

Comments
 (0)