Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(datetimepickerv2): datetimepickerV2 hide back button props #3835

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
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const DateTimePicker = ({
showRelativeOption,
showCustomRangeLink,
hasTimeInput,
hideBackButton,
renderPresetTooltipText,
onCancel,
onApply,
Expand Down Expand Up @@ -47,6 +48,7 @@ const DateTimePicker = ({
expanded={expanded}
disabled={disabled}
invalid={invalid}
hideBackButton={hideBackButton}
showRelativeOption={showRelativeOption}
showCustomRangeLink={showCustomRangeLink}
hasTimeInput={hasTimeInput}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ export const SelectedAbsoluteWithNewTimeSpinner = () => {
hasTimeInput={boolean('hasTimeInput', true)}
onApply={action('onApply')}
onCancel={action('onCancel')}
showCustomRangeLink={boolean('show custom range link', true)}
hideBackButton={boolean('hide back button', false)}
showRelativeOption={boolean('show the relative option', true)}
style={{ zIndex: number('zIndex', 0) }}
i18n={object('i18n', {
startTimeLabel: 'Start',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ export const propTypes = {
),
/** show the picker in the expanded state */
expanded: PropTypes.bool,
/** hide the back button and display cancel button while only using absolute range selector */
hideBackButton: PropTypes.bool,
/** disable the input */
disabled: PropTypes.bool,
/** specify the input in invalid state */
Expand Down Expand Up @@ -248,6 +250,7 @@ export const defaultProps = {
disabled: false,
invalid: false,
showRelativeOption: true,
hideBackButton: false,
showCustomRangeLink: true,
hasTimeInput: true,
renderPresetTooltipText: null,
Expand Down Expand Up @@ -312,6 +315,7 @@ const DateTimePicker = ({
showCustomRangeLink,
hasTimeInput,
renderPresetTooltipText,
hideBackButton,
onCancel,
onApply,
onClear,
Expand Down Expand Up @@ -749,7 +753,6 @@ const DateTimePicker = ({

const onApplyClick = () => {
const value = renderValue();
setLastAppliedValue(value);
const returnValue = {
timeRangeKind: value.kind,
timeRangeValue: null,
Expand Down Expand Up @@ -802,6 +805,7 @@ const DateTimePicker = ({
};
break;
}
setLastAppliedValue(returnValue);

if (onApply && isValid) {
setIsExpanded(false);
Expand Down Expand Up @@ -872,7 +876,7 @@ const DateTimePicker = ({
const CustomFooter = () => {
return (
<div className={`${iotPrefix}--date-time-picker__menu-btn-set`}>
{isCustomRange && !isSingleSelect ? (
{isCustomRange && !isSingleSelect && !hideBackButton ? (
<Button
kind="secondary"
className={`${iotPrefix}--date-time-picker__menu-btn ${iotPrefix}--date-time-picker__menu-btn-back`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9797,6 +9797,7 @@ Map {
"expanded": false,
"hasIconOnly": false,
"hasTimeInput": true,
"hideBackButton": false,
"i18n": Object {
"absoluteLabel": "Absolute",
"amString": "AM",
Expand Down Expand Up @@ -10135,6 +10136,9 @@ Map {
"hasTimeInput": Object {
"type": "bool",
},
"hideBackButton": Object {
"type": "bool",
},
"i18n": Object {
"args": Array [
Object {
Expand Down
Loading