-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from Jaspersoft/date-textfield-input-control
Date/DateTime/Time based on text field input controls
- Loading branch information
Showing
24 changed files
with
761 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
packages/jv-input-controls/src/controls/DatePickerTextFieldInputControl.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright © 2005-2024. Cloud Software Group, Inc. All rights reserved. Confidential & Proprietary. | ||
* Licensed pursuant to commercial Cloud Software Group, Inc End User License Agreement. | ||
*/ | ||
|
||
import { DateTimeTextField as JVDateTimeTextField } from "@jaspersoft/jv-ui-components/material-ui/DateTimeTextField/DateTimeTextField"; | ||
import { BaseInputControlProps } from "./BaseInputControl"; | ||
import { useControlClasses } from "./hooks/useControlClasses"; | ||
import { useLiveState } from "./hooks/useLiveState"; | ||
|
||
export type DateICType = "default"; | ||
|
||
export interface DateTextFieldICProps extends BaseInputControlProps { | ||
variant?: "standard" | "filled" | "outlined" | undefined; | ||
className?: string; | ||
disabled?: boolean; | ||
} | ||
|
||
export const DatePickerTextFieldInputControl = ( | ||
props: DateTextFieldICProps, | ||
) => { | ||
const { readOnly, mandatory, visible, validationRules, ...remainingProps } = | ||
props; | ||
const liveState = useLiveState(props.state?.value || ""); | ||
const controlClasses = useControlClasses([], props); | ||
const inputProps: any = {}; | ||
if (readOnly) { | ||
inputProps.readOnly = true; | ||
} | ||
const theInputProps = { ...inputProps, ...liveState }; | ||
return ( | ||
<JVDateTimeTextField | ||
{...remainingProps} | ||
type="date" | ||
variant={props.variant || "outlined"} | ||
className={`jv-mInputDate ${controlClasses.join(" ")} ${props.className || ""}`} | ||
InputProps={theInputProps} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
packages/jv-input-controls/src/controls/DateTimePickerTextFieldInputControl.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright © 2005-2024. Cloud Software Group, Inc. All rights reserved. Confidential & Proprietary. | ||
* Licensed pursuant to commercial Cloud Software Group, Inc End User License Agreement. | ||
*/ | ||
|
||
import { DateTimeTextField as JVDateTimeTextField } from "@jaspersoft/jv-ui-components/material-ui/DateTimeTextField/DateTimeTextField"; | ||
import { BaseInputControlProps } from "./BaseInputControl"; | ||
import { useControlClasses } from "./hooks/useControlClasses"; | ||
import { useLiveState } from "./hooks/useLiveState"; | ||
|
||
export type DateTimeICType = "default"; | ||
|
||
export interface DateTimeTextFieldICProps extends BaseInputControlProps { | ||
variant?: "standard" | "filled" | "outlined" | undefined; | ||
className?: string; | ||
disabled?: boolean; | ||
} | ||
|
||
export const DateTimePickerTextFieldInputControl = ( | ||
props: DateTimeTextFieldICProps, | ||
) => { | ||
const { readOnly, mandatory, visible, validationRules, ...remainingProps } = | ||
props; | ||
const liveState = useLiveState(props.state?.value || ""); | ||
const controlClasses = useControlClasses([], props); | ||
const inputProps: any = {}; | ||
if (readOnly) { | ||
inputProps.readOnly = true; | ||
} | ||
const theInputProps = { ...inputProps, ...liveState }; | ||
return ( | ||
<JVDateTimeTextField | ||
{...remainingProps} | ||
type="datetime-local" | ||
variant={props.variant || "outlined"} | ||
className={`jv-mInputDatetime ${controlClasses.join(" ")} ${props.className || ""}`} | ||
InputProps={theInputProps} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
packages/jv-input-controls/src/controls/TimePickerTextFieldInputControl.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright © 2005-2024. Cloud Software Group, Inc. All rights reserved. Confidential & Proprietary. | ||
* Licensed pursuant to commercial Cloud Software Group, Inc End User License Agreement. | ||
*/ | ||
|
||
import { DateTimeTextField as JVDateTimeTextField } from "@jaspersoft/jv-ui-components/material-ui/DateTimeTextField/DateTimeTextField"; | ||
import { BaseInputControlProps } from "./BaseInputControl"; | ||
import { useControlClasses } from "./hooks/useControlClasses"; | ||
import { useLiveState } from "./hooks/useLiveState"; | ||
|
||
export type TimeICType = "default"; | ||
|
||
export interface TimeTextFieldICProps extends BaseInputControlProps { | ||
variant?: "standard" | "filled" | "outlined" | undefined; | ||
className?: string; | ||
disabled?: boolean; | ||
} | ||
|
||
export const TimePickerTextFieldInputControl = ( | ||
props: TimeTextFieldICProps, | ||
) => { | ||
const { readOnly, mandatory, visible, validationRules, ...remainingProps } = | ||
props; | ||
const liveState = useLiveState(props.state?.value || ""); | ||
const controlClasses = useControlClasses([], props); | ||
const inputProps: any = {}; | ||
if (readOnly) { | ||
inputProps.readOnly = true; | ||
} | ||
const theInputProps = { ...inputProps, ...liveState }; | ||
return ( | ||
<JVDateTimeTextField | ||
{...remainingProps} | ||
type="time" | ||
variant={props.variant || "outlined"} | ||
className={`jv-mInputTime ${controlClasses.join(" ")} ${props.className || ""}`} | ||
InputProps={theInputProps} | ||
/> | ||
); | ||
}; |
Oops, something went wrong.