-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
chore: add wds datepicker widget #37711
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
11 changes: 11 additions & 0 deletions
11
app/client/src/modules/ui-builder/ui/wds/WDSDatePickerWidget/config/anvilConfig.ts
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,11 @@ | ||
import type { AnvilConfig } from "WidgetProvider/constants"; | ||
|
||
export const anvilConfig: AnvilConfig = { | ||
isLargeWidget: false, | ||
widgetSize: { | ||
minWidth: { | ||
base: "100%", | ||
"180px": "sizing-30", | ||
}, | ||
}, | ||
}; |
11 changes: 11 additions & 0 deletions
11
app/client/src/modules/ui-builder/ui/wds/WDSDatePickerWidget/config/autocompleteConfig.ts
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,11 @@ | ||
import { DefaultAutocompleteDefinitions } from "widgets/WidgetUtils"; | ||
|
||
export const autocompleteConfig = { | ||
"!doc": | ||
"Datepicker is used to capture the date and time from a user. It can be used to filter data base on the input date range as well as to capture personal information such as date of birth", | ||
"!url": "https://docs.appsmith.com/widget-reference/datepicker", | ||
isVisible: DefaultAutocompleteDefinitions.isVisible, | ||
selectedDate: "string", | ||
formattedDate: "string", | ||
isDisabled: "bool", | ||
}; |
20 changes: 20 additions & 0 deletions
20
app/client/src/modules/ui-builder/ui/wds/WDSDatePickerWidget/config/defaultsConfig.ts
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,20 @@ | ||
import { ResponsiveBehavior } from "layoutSystems/common/utils/constants"; | ||
import type { WidgetDefaultProps } from "WidgetProvider/constants"; | ||
import { INPUT_TYPES } from "modules/ui-builder/ui/wds/WDSBaseInputWidget"; | ||
|
||
export const defaultsConfig = { | ||
animateLoading: true, | ||
label: "Label", | ||
dateFormat: "YYYY-MM-DD HH:mm", | ||
defaultOptionValue: "", | ||
isRequired: false, | ||
isDisabled: false, | ||
isVisible: true, | ||
isInline: false, | ||
widgetName: "DatePicker", | ||
widgetType: "WDS_DATE_PICKER", | ||
version: 1, | ||
timePrecision: "day", | ||
responsiveBehavior: ResponsiveBehavior.Fill, | ||
inputType: INPUT_TYPES.DATE, | ||
} as unknown as WidgetDefaultProps; |
7 changes: 7 additions & 0 deletions
7
app/client/src/modules/ui-builder/ui/wds/WDSDatePickerWidget/config/index.ts
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,7 @@ | ||
export * from "./propertyPaneConfig"; | ||
export { metaConfig } from "./metaConfig"; | ||
export { anvilConfig } from "./anvilConfig"; | ||
export { defaultsConfig } from "./defaultsConfig"; | ||
export { settersConfig } from "./settersConfig"; | ||
export { methodsConfig } from "./methodsConfig"; | ||
export { autocompleteConfig } from "./autocompleteConfig"; |
21 changes: 21 additions & 0 deletions
21
app/client/src/modules/ui-builder/ui/wds/WDSDatePickerWidget/config/metaConfig.ts
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,21 @@ | ||
import { WIDGET_TAGS } from "constants/WidgetConstants"; | ||
|
||
export const metaConfig = { | ||
name: "DatePicker", | ||
tags: [WIDGET_TAGS.INPUTS], | ||
needsMeta: true, | ||
searchTags: [ | ||
"datepicker", | ||
"appointment", | ||
"calendar", | ||
"date", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ichik Could you check this please? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@KelvinOm @jsartisan pushed an update to metaconfig. |
||
"day", | ||
"hour", | ||
"meeting", | ||
"moment", | ||
"schedule", | ||
"time", | ||
"week", | ||
"year", | ||
], | ||
}; |
6 changes: 6 additions & 0 deletions
6
app/client/src/modules/ui-builder/ui/wds/WDSDatePickerWidget/config/methodsConfig.ts
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,6 @@ | ||
import { DatePickerIcon, DatePickerThumbnail } from "appsmith-icons"; | ||
|
||
export const methodsConfig = { | ||
IconCmp: DatePickerIcon, | ||
ThumbnailCmp: DatePickerThumbnail, | ||
}; |
191 changes: 191 additions & 0 deletions
191
.../modules/ui-builder/ui/wds/WDSDatePickerWidget/config/propertyPaneConfig/contentConfig.ts
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,191 @@ | ||
import { ValidationTypes } from "constants/WidgetValidation"; | ||
import { DATE_FORMAT_OPTIONS } from "../../constants"; | ||
|
||
import { propertyPaneContentConfig as WdsInputWidgetPropertyPaneContentConfig } from "modules/ui-builder/ui/wds/WDSInputWidget/config/propertyPaneConfig/contentConfig"; | ||
import type { PropertyPaneConfig } from "constants/PropertyControlConstants"; | ||
|
||
const inputTypeSectionConfig = WdsInputWidgetPropertyPaneContentConfig.find( | ||
(config) => config.sectionName === "Type", | ||
); | ||
|
||
export const propertyPaneContentConfig = [ | ||
inputTypeSectionConfig, | ||
{ | ||
sectionName: "Data", | ||
children: [ | ||
{ | ||
helpText: "Sets the format of the selected date", | ||
propertyName: "dateFormat", | ||
label: "Date format", | ||
controlType: "DROP_DOWN", | ||
isJSConvertible: true, | ||
optionWidth: "340px", | ||
options: DATE_FORMAT_OPTIONS, | ||
isBindProperty: true, | ||
isTriggerProperty: false, | ||
validation: { type: ValidationTypes.TEXT }, | ||
hideSubText: true, | ||
}, | ||
{ | ||
propertyName: "defaultDate", | ||
label: "Default Date", | ||
helpText: | ||
"Sets the default date of the widget. The date is updated if the default date changes", | ||
controlType: "DATE_PICKER", | ||
placeholderText: "Enter Default Date", | ||
useValidationMessage: true, | ||
isJSConvertible: true, | ||
isBindProperty: true, | ||
isTriggerProperty: false, | ||
validation: { type: ValidationTypes.DATE_ISO_STRING }, | ||
}, | ||
{ | ||
propertyName: "timePrecision", | ||
label: "Time Precision", | ||
controlType: "DROP_DOWN", | ||
helpText: "Sets the time precision or hides the time picker.", | ||
defaultValue: "day", | ||
options: [ | ||
{ | ||
label: "Day", | ||
value: "day", | ||
}, | ||
{ | ||
label: "Hour", | ||
value: "hour", | ||
}, | ||
{ | ||
label: "Minute", | ||
value: "minute", | ||
}, | ||
{ | ||
label: "Second", | ||
value: "second", | ||
}, | ||
], | ||
isJSConvertible: true, | ||
isBindProperty: true, | ||
isTriggerProperty: false, | ||
validation: { | ||
type: ValidationTypes.TEXT, | ||
params: { | ||
allowedValues: ["day", "hour", "minute", "second"], | ||
default: "day", | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
sectionName: "Label", | ||
children: [ | ||
{ | ||
helpText: "Sets the label text of the date picker widget", | ||
propertyName: "label", | ||
label: "Text", | ||
controlType: "INPUT_TEXT", | ||
placeholderText: "Label", | ||
isBindProperty: true, | ||
isTriggerProperty: false, | ||
validation: { type: ValidationTypes.TEXT }, | ||
}, | ||
], | ||
}, | ||
{ | ||
sectionName: "Validations", | ||
children: [ | ||
{ | ||
propertyName: "isRequired", | ||
label: "Required", | ||
helpText: "Makes input to the widget mandatory", | ||
controlType: "SWITCH", | ||
isJSConvertible: true, | ||
isBindProperty: true, | ||
isTriggerProperty: false, | ||
validation: { type: ValidationTypes.BOOLEAN }, | ||
}, | ||
{ | ||
propertyName: "minDate", | ||
label: "Minimum Date", | ||
helpText: "Sets the minimum date that can be selected", | ||
controlType: "DATE_PICKER", | ||
placeholderText: "Enter Minimum Date", | ||
isJSConvertible: true, | ||
isBindProperty: true, | ||
isTriggerProperty: false, | ||
validation: { type: ValidationTypes.DATE_ISO_STRING }, | ||
}, | ||
{ | ||
propertyName: "maxDate", | ||
label: "Maximum Date", | ||
helpText: "Sets the maximum date that can be selected", | ||
controlType: "DATE_PICKER", | ||
placeholderText: "Enter Maximum Date", | ||
isJSConvertible: true, | ||
isBindProperty: true, | ||
isTriggerProperty: false, | ||
validation: { type: ValidationTypes.DATE_ISO_STRING }, | ||
}, | ||
], | ||
}, | ||
KelvinOm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
sectionName: "General", | ||
children: [ | ||
{ | ||
helpText: "Shows help text or details about the current input", | ||
propertyName: "labelTooltip", | ||
label: "Tooltip", | ||
controlType: "INPUT_TEXT", | ||
placeholderText: "", | ||
isBindProperty: true, | ||
isTriggerProperty: false, | ||
validation: { type: ValidationTypes.TEXT }, | ||
}, | ||
{ | ||
helpText: "Controls the visibility of the widget", | ||
propertyName: "isVisible", | ||
label: "Visible", | ||
controlType: "SWITCH", | ||
isJSConvertible: true, | ||
isBindProperty: true, | ||
isTriggerProperty: false, | ||
validation: { type: ValidationTypes.BOOLEAN }, | ||
}, | ||
{ | ||
propertyName: "isDisabled", | ||
label: "Disabled", | ||
helpText: "Disables input to this widget", | ||
controlType: "SWITCH", | ||
isJSConvertible: true, | ||
isBindProperty: true, | ||
isTriggerProperty: false, | ||
validation: { type: ValidationTypes.BOOLEAN }, | ||
}, | ||
{ | ||
propertyName: "animateLoading", | ||
label: "Animate loading", | ||
controlType: "SWITCH", | ||
helpText: "Controls the loading of the widget", | ||
defaultValue: true, | ||
isJSConvertible: true, | ||
isBindProperty: true, | ||
isTriggerProperty: false, | ||
validation: { type: ValidationTypes.BOOLEAN }, | ||
}, | ||
], | ||
}, | ||
{ | ||
sectionName: "Events", | ||
children: [ | ||
{ | ||
propertyName: "onDateSelected", | ||
label: "onDateSelected", | ||
helpText: "when a date is selected in the calendar", | ||
controlType: "ACTION_SELECTOR", | ||
isJSConvertible: true, | ||
isBindProperty: true, | ||
isTriggerProperty: true, | ||
}, | ||
KelvinOm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
], | ||
}, | ||
] as PropertyPaneConfig[]; |
1 change: 1 addition & 0 deletions
1
...ient/src/modules/ui-builder/ui/wds/WDSDatePickerWidget/config/propertyPaneConfig/index.ts
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 @@ | ||
export { propertyPaneContentConfig } from "./contentConfig"; |
12 changes: 12 additions & 0 deletions
12
app/client/src/modules/ui-builder/ui/wds/WDSDatePickerWidget/config/settersConfig.ts
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,12 @@ | ||
export const settersConfig = { | ||
__setters: { | ||
setVisibility: { | ||
path: "isVisible", | ||
type: "boolean", | ||
}, | ||
setDisabled: { | ||
path: "isDisabled", | ||
type: "boolean", | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the drop, date picker widget has an empty Data type. Could you please fix this?