@rc-component/picker 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -43,12 +43,15 @@ export interface SinglePickerPanelProps<DateType extends object = any> extends B
|
|
|
43
43
|
value?: DateType | null;
|
|
44
44
|
onChange?: (date: DateType) => void;
|
|
45
45
|
}
|
|
46
|
+
type PanelSemanticName = 'popupBody' | 'popupContent';
|
|
46
47
|
export type PickerPanelProps<DateType extends object = any> = BasePickerPanelProps<DateType> & {
|
|
47
48
|
/** multiple selection. Not support time or datetime picker */
|
|
48
49
|
multiple?: boolean;
|
|
49
50
|
defaultValue?: DateType | DateType[] | null;
|
|
50
51
|
value?: DateType | DateType[] | null;
|
|
51
52
|
onChange?: (date: DateType | DateType[]) => void;
|
|
53
|
+
styles?: Partial<Record<PanelSemanticName, React.CSSProperties>>;
|
|
54
|
+
classNames?: Partial<Record<PanelSemanticName, string>>;
|
|
52
55
|
};
|
|
53
56
|
declare const _default: <DateType extends object = any>(props: BasePickerPanelProps<DateType> & {
|
|
54
57
|
/** multiple selection. Not support time or datetime picker */
|
|
@@ -56,5 +59,7 @@ declare const _default: <DateType extends object = any>(props: BasePickerPanelPr
|
|
|
56
59
|
defaultValue?: DateType | DateType[];
|
|
57
60
|
value?: DateType | DateType[];
|
|
58
61
|
onChange?: (date: DateType | DateType[]) => void;
|
|
62
|
+
styles?: Partial<Record<PanelSemanticName, React.CSSProperties>>;
|
|
63
|
+
classNames?: Partial<Record<PanelSemanticName, string>>;
|
|
59
64
|
} & React.RefAttributes<PickerPanelRef>) => React.ReactElement;
|
|
60
65
|
export default _default;
|
package/es/PickerPanel/index.js
CHANGED
|
@@ -45,7 +45,9 @@ var DefaultComponents = {
|
|
|
45
45
|
time: TimePanel
|
|
46
46
|
};
|
|
47
47
|
function PickerPanel(props, ref) {
|
|
48
|
-
var
|
|
48
|
+
var panelClassNames = props.classNames,
|
|
49
|
+
panelStyles = props.styles,
|
|
50
|
+
locale = props.locale,
|
|
49
51
|
generateConfig = props.generateConfig,
|
|
50
52
|
direction = props.direction,
|
|
51
53
|
prefixCls = props.prefixCls,
|
|
@@ -77,7 +79,7 @@ function PickerPanel(props, ref) {
|
|
|
77
79
|
var _ref = React.useContext(PickerContext) || {},
|
|
78
80
|
contextPrefixCls = _ref.prefixCls,
|
|
79
81
|
pickerClassNames = _ref.classNames,
|
|
80
|
-
|
|
82
|
+
pickerStyles = _ref.styles;
|
|
81
83
|
|
|
82
84
|
// ======================== prefixCls ========================
|
|
83
85
|
var mergedPrefixCls = contextPrefixCls || prefixCls || 'rc-picker';
|
|
@@ -253,14 +255,16 @@ function PickerPanel(props, ref) {
|
|
|
253
255
|
var PanelComponent = components[internalMode] || DefaultComponents[internalMode] || DatePanel;
|
|
254
256
|
|
|
255
257
|
// ======================== Context =========================
|
|
258
|
+
var mergedStyles = pickerStyles !== null && pickerStyles !== void 0 ? pickerStyles : panelStyles;
|
|
259
|
+
var mergedClassNames = pickerClassNames !== null && pickerClassNames !== void 0 ? pickerClassNames : panelClassNames;
|
|
256
260
|
var parentHackContext = React.useContext(PickerHackContext);
|
|
257
261
|
var pickerPanelContext = React.useMemo(function () {
|
|
258
262
|
return _objectSpread(_objectSpread({}, parentHackContext), {}, {
|
|
259
263
|
hideHeader: hideHeader,
|
|
260
|
-
classNames:
|
|
261
|
-
styles:
|
|
264
|
+
classNames: mergedClassNames,
|
|
265
|
+
styles: mergedStyles
|
|
262
266
|
});
|
|
263
|
-
}, [parentHackContext, hideHeader,
|
|
267
|
+
}, [parentHackContext, hideHeader, mergedClassNames, mergedStyles]);
|
|
264
268
|
|
|
265
269
|
// ======================== Warnings ========================
|
|
266
270
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -43,12 +43,15 @@ export interface SinglePickerPanelProps<DateType extends object = any> extends B
|
|
|
43
43
|
value?: DateType | null;
|
|
44
44
|
onChange?: (date: DateType) => void;
|
|
45
45
|
}
|
|
46
|
+
type PanelSemanticName = 'popupBody' | 'popupContent';
|
|
46
47
|
export type PickerPanelProps<DateType extends object = any> = BasePickerPanelProps<DateType> & {
|
|
47
48
|
/** multiple selection. Not support time or datetime picker */
|
|
48
49
|
multiple?: boolean;
|
|
49
50
|
defaultValue?: DateType | DateType[] | null;
|
|
50
51
|
value?: DateType | DateType[] | null;
|
|
51
52
|
onChange?: (date: DateType | DateType[]) => void;
|
|
53
|
+
styles?: Partial<Record<PanelSemanticName, React.CSSProperties>>;
|
|
54
|
+
classNames?: Partial<Record<PanelSemanticName, string>>;
|
|
52
55
|
};
|
|
53
56
|
declare const _default: <DateType extends object = any>(props: BasePickerPanelProps<DateType> & {
|
|
54
57
|
/** multiple selection. Not support time or datetime picker */
|
|
@@ -56,5 +59,7 @@ declare const _default: <DateType extends object = any>(props: BasePickerPanelPr
|
|
|
56
59
|
defaultValue?: DateType | DateType[];
|
|
57
60
|
value?: DateType | DateType[];
|
|
58
61
|
onChange?: (date: DateType | DateType[]) => void;
|
|
62
|
+
styles?: Partial<Record<PanelSemanticName, React.CSSProperties>>;
|
|
63
|
+
classNames?: Partial<Record<PanelSemanticName, string>>;
|
|
59
64
|
} & React.RefAttributes<PickerPanelRef>) => React.ReactElement;
|
|
60
65
|
export default _default;
|
package/lib/PickerPanel/index.js
CHANGED
|
@@ -54,7 +54,9 @@ var DefaultComponents = {
|
|
|
54
54
|
time: _TimePanel.default
|
|
55
55
|
};
|
|
56
56
|
function PickerPanel(props, ref) {
|
|
57
|
-
var
|
|
57
|
+
var panelClassNames = props.classNames,
|
|
58
|
+
panelStyles = props.styles,
|
|
59
|
+
locale = props.locale,
|
|
58
60
|
generateConfig = props.generateConfig,
|
|
59
61
|
direction = props.direction,
|
|
60
62
|
prefixCls = props.prefixCls,
|
|
@@ -86,7 +88,7 @@ function PickerPanel(props, ref) {
|
|
|
86
88
|
var _ref = React.useContext(_context.default) || {},
|
|
87
89
|
contextPrefixCls = _ref.prefixCls,
|
|
88
90
|
pickerClassNames = _ref.classNames,
|
|
89
|
-
|
|
91
|
+
pickerStyles = _ref.styles;
|
|
90
92
|
|
|
91
93
|
// ======================== prefixCls ========================
|
|
92
94
|
var mergedPrefixCls = contextPrefixCls || prefixCls || 'rc-picker';
|
|
@@ -262,14 +264,16 @@ function PickerPanel(props, ref) {
|
|
|
262
264
|
var PanelComponent = components[internalMode] || DefaultComponents[internalMode] || _DatePanel.default;
|
|
263
265
|
|
|
264
266
|
// ======================== Context =========================
|
|
267
|
+
var mergedStyles = pickerStyles !== null && pickerStyles !== void 0 ? pickerStyles : panelStyles;
|
|
268
|
+
var mergedClassNames = pickerClassNames !== null && pickerClassNames !== void 0 ? pickerClassNames : panelClassNames;
|
|
265
269
|
var parentHackContext = React.useContext(_context2.PickerHackContext);
|
|
266
270
|
var pickerPanelContext = React.useMemo(function () {
|
|
267
271
|
return _objectSpread(_objectSpread({}, parentHackContext), {}, {
|
|
268
272
|
hideHeader: hideHeader,
|
|
269
|
-
classNames:
|
|
270
|
-
styles:
|
|
273
|
+
classNames: mergedClassNames,
|
|
274
|
+
styles: mergedStyles
|
|
271
275
|
});
|
|
272
|
-
}, [parentHackContext, hideHeader,
|
|
276
|
+
}, [parentHackContext, hideHeader, mergedClassNames, mergedStyles]);
|
|
273
277
|
|
|
274
278
|
// ======================== Warnings ========================
|
|
275
279
|
if (process.env.NODE_ENV !== 'production') {
|