2020-05-20 11:30:53 +00:00
import { generateTypeDef } from "utils/autocomplete/dataTreeTypeDefCreator" ;
2021-12-07 10:19:33 +00:00
import {
DataTreeAction ,
DataTreeAppsmith ,
} from "entities/DataTree/dataTreeFactory" ;
2020-06-04 13:49:22 +00:00
import _ from "lodash" ;
2021-12-07 10:19:33 +00:00
import { EVALUATION_PATH } from "utils/DynamicBindingUtils" ;
2022-04-07 20:37:03 +00:00
import { JSCollectionData } from "reducers/entityReducers/jsActionsReducer" ;
2020-05-20 11:30:53 +00:00
const isVisible = {
"!type" : "bool" ,
"!doc" : "Boolean value indicating if the widget is in visible state" ,
} ;
2022-06-21 13:57:34 +00:00
export const entityDefinitions = {
2021-12-07 10:19:33 +00:00
APPSMITH : ( entity : DataTreeAppsmith ) = > {
const generatedTypeDef = generateTypeDef (
_ . omit ( entity , "ENTITY_TYPE" , EVALUATION_PATH ) ,
) ;
if (
typeof generatedTypeDef === "object" &&
typeof generatedTypeDef . geolocation === "object"
) {
return {
. . . generatedTypeDef ,
geolocation : {
. . . generatedTypeDef . geolocation ,
"!doc" :
"The user's geo location information. Only available when requested" ,
"!url" :
"https://docs.appsmith.com/v/v1.2.1/framework-reference/geolocation" ,
getCurrentPosition :
"fn(onSuccess: fn() -> void, onError: fn() -> void, options: object) -> void" ,
watchPosition : "fn(options: object) -> void" ,
clearWatch : "fn() -> void" ,
} ,
} ;
}
return generatedTypeDef ;
} ,
2020-06-04 13:49:22 +00:00
ACTION : ( entity : DataTreeAction ) = > {
const dataDef = generateTypeDef ( entity . data ) ;
let data : Record < string , any > = {
"!doc" : "The response of the action" ,
} ;
if ( _ . isString ( dataDef ) ) {
data [ "!type" ] = dataDef ;
} else {
data = { . . . data , . . . dataDef } ;
}
return {
"!doc" :
"Actions allow you to connect your widgets to your backend data in a secure manner." ,
2021-02-03 15:15:16 +00:00
"!url" : "https://docs.appsmith.com/v/v1.2.1/framework-reference/run" ,
2020-06-04 13:49:22 +00:00
isLoading : "bool" ,
data ,
2021-07-20 10:02:56 +00:00
responseMeta : {
"!doc" : "The response meta of the action" ,
"!type" : "?" ,
} ,
2021-12-23 14:17:20 +00:00
run :
"fn(onSuccess: fn() -> void, onError: fn() -> void) -> +Promise[:t=[!0.<i>.:t]]" ,
clear : "fn() -> +Promise[:t=[!0.<i>.:t]]" ,
2020-06-04 13:49:22 +00:00
} ;
} ,
2021-09-24 16:05:53 +00:00
AUDIO_WIDGET : {
"!doc" :
"Audio widget can be used for playing a variety of audio formats like MP3, AAC etc." ,
"!url" : "https://docs.appsmith.com/widget-reference/audio" ,
playState : "number" ,
autoPlay : "bool" ,
} ,
2020-05-20 11:30:53 +00:00
CONTAINER_WIDGET : {
"!doc" :
"Containers are used to group widgets together to form logical higher order widgets. Containers let you organize your page better and move all the widgets inside them together." ,
2021-02-03 15:15:16 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/container" ,
2020-05-20 11:30:53 +00:00
backgroundColor : {
"!type" : "string" ,
2021-02-03 15:15:16 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/container" ,
2020-05-20 11:30:53 +00:00
} ,
isVisible : isVisible ,
} ,
INPUT_WIDGET : {
"!doc" :
"An input text field is used to capture a users textual input such as their names, numbers, emails etc. Inputs are used in forms and can have custom validations." ,
"!url" : "https://docs.appsmith.com/widget-reference/input" ,
text : {
"!type" : "string" ,
"!doc" : "The text value of the input" ,
"!url" : "https://docs.appsmith.com/widget-reference/input" ,
} ,
isValid : "bool" ,
isVisible : isVisible ,
2020-05-22 12:46:11 +00:00
isDisabled : "bool" ,
2021-08-26 10:52:45 +00:00
countryCode : {
"!type" : "string" ,
"!doc" : "Selected country code for Phone Number type input" ,
} ,
2021-07-15 12:50:01 +00:00
currencyCountryCode : {
"!type" : "string" ,
"!doc" : "Selected country code for Currency type input" ,
} ,
2020-05-20 11:30:53 +00:00
} ,
TABLE_WIDGET : ( widget : any ) = > ( {
"!doc" :
"The Table is the hero widget of Appsmith. You can display data from an API in a table, trigger an action when a user selects a row and even work with large paginated data sets" ,
"!url" : "https://docs.appsmith.com/widget-reference/table" ,
selectedRow : generateTypeDef ( widget . selectedRow ) ,
2020-09-08 13:04:51 +00:00
selectedRows : generateTypeDef ( widget . selectedRows ) ,
2021-12-15 12:14:50 +00:00
selectedRowIndices : generateTypeDef ( widget . selectedRowIndices ) ,
2021-09-23 11:46:47 +00:00
triggeredRow : generateTypeDef ( widget . triggeredRow ) ,
2020-05-20 11:30:53 +00:00
selectedRowIndex : "number" ,
tableData : generateTypeDef ( widget . tableData ) ,
2022-03-24 12:12:22 +00:00
filteredTableData : generateTypeDef ( widget . filteredTableData ) ,
2020-05-28 06:12:04 +00:00
pageNo : "number" ,
pageSize : "number" ,
2020-05-22 12:46:11 +00:00
isVisible : isVisible ,
2020-07-24 13:58:28 +00:00
searchText : "string" ,
2021-08-30 09:24:59 +00:00
totalRecordsCount : "number" ,
2021-08-25 13:20:06 +00:00
sortOrder : {
column : "string" ,
order : [ "asc" , "desc" ] ,
} ,
2020-05-20 11:30:53 +00:00
} ) ,
2022-07-14 07:02:35 +00:00
TABLE_WIDGET_V2 : ( widget : any ) = > ( {
"!doc" :
"The Table is the hero widget of Appsmith. You can display data from an API in a table, trigger an action when a user selects a row and even work with large paginated data sets" ,
"!url" : "https://docs.appsmith.com/widget-reference/table" ,
selectedRow : generateTypeDef ( widget . selectedRow ) ,
selectedRows : generateTypeDef ( widget . selectedRows ) ,
selectedRowIndices : generateTypeDef ( widget . selectedRowIndices ) ,
triggeredRow : generateTypeDef ( widget . triggeredRow ) ,
updatedRow : generateTypeDef ( widget . updatedRow ) ,
selectedRowIndex : "number" ,
tableData : generateTypeDef ( widget . tableData ) ,
pageNo : "number" ,
pageSize : "number" ,
isVisible : isVisible ,
searchText : "string" ,
totalRecordsCount : "number" ,
sortOrder : {
column : "string" ,
order : [ "asc" , "desc" ] ,
} ,
updatedRows : generateTypeDef ( widget . updatedRows ) ,
updatedRowIndices : generateTypeDef ( widget . updatedRowIndices ) ,
triggeredRowIndex : generateTypeDef ( widget . triggeredRowIndex ) ,
} ) ,
2021-01-12 01:22:31 +00:00
VIDEO_WIDGET : {
2020-09-26 12:59:33 +00:00
"!doc" :
"Video widget can be used for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia, Mixcloud, and DailyMotion." ,
"!url" : "https://docs.appsmith.com/widget-reference/video" ,
playState : "number" ,
autoPlay : "bool" ,
2021-01-12 01:22:31 +00:00
} ,
2020-05-20 11:30:53 +00:00
DROP_DOWN_WIDGET : {
"!doc" :
2022-02-02 14:15:07 +00:00
"Select is used to capture user input/s from a specified list of permitted inputs. A Select can capture a single choice" ,
"!url" : "https://docs.appsmith.com/widget-reference/dropdown" ,
isVisible : isVisible ,
filterText : {
2022-03-22 11:31:07 +00:00
"!type" : "string" ,
2022-02-02 14:15:07 +00:00
"!doc" : "The filter text for Server side filtering" ,
} ,
selectedOptionValue : {
"!type" : "string" ,
"!doc" : "The value selected in a single select dropdown" ,
"!url" : "https://docs.appsmith.com/widget-reference/dropdown" ,
} ,
selectedOptionLabel : {
"!type" : "string" ,
"!doc" : "The selected option label in a single select dropdown" ,
"!url" : "https://docs.appsmith.com/widget-reference/dropdown" ,
} ,
isDisabled : "bool" ,
options : "[dropdownOption]" ,
} ,
SELECT_WIDGET : {
"!doc" :
"Select is used to capture user input/s from a specified list of permitted inputs. A Select can capture a single choice" ,
2020-05-20 11:30:53 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/dropdown" ,
2020-05-22 12:46:11 +00:00
isVisible : isVisible ,
2021-08-16 06:56:09 +00:00
filterText : {
2022-03-22 11:31:07 +00:00
"!type" : "string" ,
2021-08-16 06:56:09 +00:00
"!doc" : "The filter text for Server side filtering" ,
} ,
2020-05-22 12:46:11 +00:00
selectedOptionValue : {
"!type" : "string" ,
"!doc" : "The value selected in a single select dropdown" ,
"!url" : "https://docs.appsmith.com/widget-reference/dropdown" ,
} ,
2021-02-26 06:24:25 +00:00
selectedOptionLabel : {
"!type" : "string" ,
"!doc" : "The selected option label in a single select dropdown" ,
"!url" : "https://docs.appsmith.com/widget-reference/dropdown" ,
} ,
2021-08-03 06:38:01 +00:00
isDisabled : "bool" ,
options : "[dropdownOption]" ,
} ,
MULTI_SELECT_WIDGET : {
"!doc" :
"MultiSelect is used to capture user input/s from a specified list of permitted inputs. A MultiSelect captures multiple choices from a list of options" ,
"!url" : "https://docs.appsmith.com/widget-reference/dropdown" ,
isVisible : isVisible ,
2021-08-16 06:56:09 +00:00
filterText : {
2022-03-22 11:36:21 +00:00
"!type" : "string" ,
2021-08-16 06:56:09 +00:00
"!doc" : "The filter text for Server side filtering" ,
} ,
2021-08-03 06:38:01 +00:00
selectedOptionValues : {
2020-05-22 12:46:11 +00:00
"!type" : "[string]" ,
"!doc" : "The array of values selected in a multi select dropdown" ,
2021-02-26 06:24:25 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/dropdown" ,
} ,
selectedOptionLabels : {
"!type" : "[string]" ,
"!doc" : "The array of selected option labels in a multi select dropdown" ,
2020-05-22 12:46:11 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/dropdown" ,
} ,
isDisabled : "bool" ,
2020-05-20 11:30:53 +00:00
options : "[dropdownOption]" ,
} ,
2022-02-02 14:15:07 +00:00
MULTI_SELECT_WIDGET_V2 : {
"!doc" :
"MultiSelect is used to capture user input/s from a specified list of permitted inputs. A MultiSelect captures multiple choices from a list of options" ,
"!url" : "https://docs.appsmith.com/widget-reference/dropdown" ,
isVisible : isVisible ,
filterText : {
2022-03-22 11:36:21 +00:00
"!type" : "string" ,
2022-02-02 14:15:07 +00:00
"!doc" : "The filter text for Server side filtering" ,
} ,
selectedOptionValues : {
"!type" : "[string]" ,
"!doc" : "The array of values selected in a multi select dropdown" ,
"!url" : "https://docs.appsmith.com/widget-reference/dropdown" ,
} ,
selectedOptionLabels : {
"!type" : "[string]" ,
"!doc" : "The array of selected option labels in a multi select dropdown" ,
"!url" : "https://docs.appsmith.com/widget-reference/dropdown" ,
} ,
isDisabled : "bool" ,
options : "[dropdownOption]" ,
} ,
2020-05-20 11:30:53 +00:00
IMAGE_WIDGET : {
"!doc" :
"Image widget is used to display images in your app. Images must be either a URL or a valid base64." ,
"!url" : "https://docs.appsmith.com/widget-reference/image" ,
image : "string" ,
isVisible : isVisible ,
} ,
TEXT_WIDGET : {
"!doc" :
" Text widget is used to display textual information. Whether you want to display a paragraph or information or add a heading to a container, a text widget makes it easy to style and display text" ,
"!url" : "https://docs.appsmith.com/widget-reference/text" ,
isVisible : isVisible ,
text : "string" ,
} ,
BUTTON_WIDGET : {
"!doc" :
"Buttons are used to capture user intent and trigger actions based on that intent" ,
"!url" : "https://docs.appsmith.com/widget-reference/button" ,
isVisible : isVisible ,
text : "string" ,
isDisabled : "bool" ,
2022-01-02 16:27:39 +00:00
recaptchaToken : "string" ,
2020-05-20 11:30:53 +00:00
} ,
DATE_PICKER_WIDGET : {
"!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 : isVisible ,
selectedDate : "string" ,
isDisabled : "bool" ,
} ,
2021-02-23 12:35:09 +00:00
DATE_PICKER_WIDGET2 : {
"!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 : isVisible ,
selectedDate : "string" ,
formattedDate : "string" ,
isDisabled : "bool" ,
} ,
2020-05-20 11:30:53 +00:00
CHECKBOX_WIDGET : {
"!doc" :
"Checkbox is a simple UI widget you can use when you want users to make a binary choice" ,
"!url" : "https://docs.appsmith.com/widget-reference/checkbox" ,
isVisible : isVisible ,
isChecked : "bool" ,
isDisabled : "bool" ,
} ,
2021-02-16 12:15:17 +00:00
SWITCH_WIDGET : {
"!doc" :
"Switch is a simple UI widget you can use when you want users to make a binary choice" ,
"!url" : "https://docs.appsmith.com/widget-reference/switch" ,
isVisible : isVisible ,
isSwitchedOn : "bool" ,
isDisabled : "bool" ,
} ,
2020-05-20 11:30:53 +00:00
RADIO_GROUP_WIDGET : {
"!doc" :
"Radio widget lets the user choose only one option from a predefined set of options. It is quite similar to a SingleSelect Dropdown in its functionality" ,
"!url" : "https://docs.appsmith.com/widget-reference/radio" ,
isVisible : isVisible ,
options : "[dropdownOption]" ,
selectedOptionValue : "string" ,
isRequired : "bool" ,
} ,
TABS_WIDGET : {
isVisible : isVisible ,
selectedTab : "string" ,
} ,
MODAL_WIDGET : {
isVisible : isVisible ,
isOpen : "bool" ,
} ,
RICH_TEXT_EDITOR_WIDGET : {
isVisible : isVisible ,
text : "string" ,
isDisabled : "string" ,
} ,
CHART_WIDGET : {
"!doc" :
"Chart widget is used to view the graphical representation of your data. Chart is the go-to widget for your data visualisation needs." ,
"!url" : "https://docs.appsmith.com/widget-reference/chart" ,
isVisible : isVisible ,
chartData : "chartData" ,
xAxisName : "string" ,
yAxisName : "string" ,
2021-02-22 16:31:13 +00:00
selectedDataPoint : "chartDataPoint" ,
2020-05-20 11:30:53 +00:00
} ,
2020-06-09 13:10:42 +00:00
FORM_WIDGET : ( widget : any ) = > ( {
2020-05-20 11:30:53 +00:00
"!doc" :
"Form is used to capture a set of data inputs from a user. Forms are used specifically because they reset the data inputs when a form is submitted and disable submission for invalid data inputs" ,
"!url" : "https://docs.appsmith.com/widget-reference/form" ,
isVisible : isVisible ,
2020-06-09 13:10:42 +00:00
data : generateTypeDef ( widget . data ) ,
feat: Internal property to detect changes in a form
-- Implement dirty check logic for a form
-- Expose an form property, hasChanges for checking if the user has changed any values in the form
-- Add isDirty derived property for the following widgets: AudioRecorderWidget, CameraWidget, CheckboxGroupWidget, CheckboxWidget, CurrencyInputWidget, DatePickerWidget2, FilePickerWidgetV2, InputWidgetV2, MultiSelectTreeWidget, MultiSelectWidgetV2, PhoneInputWidget, RadioGroupWidget, RichTextEditorWidget, SelectWidget, SingleSelectTreeWidget, SwitchGroupWidget, SwitchWidget
2022-02-23 08:03:51 +00:00
hasChanges : "bool" ,
2020-06-09 13:10:42 +00:00
} ) ,
2020-05-20 11:30:53 +00:00
FORM_BUTTON_WIDGET : {
"!doc" :
"Form button is provided by default to every form. It is used for form submission and resetting form inputs" ,
"!url" : "https://docs.appsmith.com/widget-reference/form" ,
isVisible : isVisible ,
text : "string" ,
isDisabled : "bool" ,
2022-01-02 16:27:39 +00:00
recaptchaToken : "string" ,
2020-05-20 11:30:53 +00:00
} ,
MAP_WIDGET : {
isVisible : isVisible ,
center : "latLong" ,
markers : "[mapMarker]" ,
selectedMarker : "mapMarker" ,
} ,
FILE_PICKER_WIDGET : {
"!doc" :
"Filepicker widget is used to allow users to upload files from their local machines to any cloud storage via API. Cloudinary and Amazon S3 have simple APIs for cloud storage uploads" ,
2021-08-24 03:38:57 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/filepicker" ,
isVisible : isVisible ,
files : "[file]" ,
isDisabled : "bool" ,
} ,
FILE_PICKER_WIDGET_V2 : {
"!doc" :
"Filepicker widget is used to allow users to upload files from their local machines to any cloud storage via API. Cloudinary and Amazon S3 have simple APIs for cloud storage uploads" ,
2020-05-20 11:30:53 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/filepicker" ,
isVisible : isVisible ,
2021-03-12 08:14:32 +00:00
files : "[file]" ,
2020-05-22 12:46:11 +00:00
isDisabled : "bool" ,
2020-05-20 11:30:53 +00:00
} ,
2021-04-23 05:43:13 +00:00
LIST_WIDGET : ( widget : any ) = > ( {
"!doc" :
"Containers are used to group widgets together to form logical higher order widgets. Containers let you organize your page better and move all the widgets inside them together." ,
"!url" : "https://docs.appsmith.com/widget-reference/list" ,
backgroundColor : {
"!type" : "string" ,
"!url" : "https://docs.appsmith.com/widget-reference/how-to-use-widgets" ,
} ,
isVisible : isVisible ,
2021-05-03 05:01:47 +00:00
gridGap : "number" ,
2021-04-23 05:43:13 +00:00
selectedItem : generateTypeDef ( widget . selectedItem ) ,
2021-06-18 07:42:57 +00:00
items : generateTypeDef ( widget . items ) ,
listData : generateTypeDef ( widget . listData ) ,
2021-09-22 08:46:51 +00:00
pageNo : generateTypeDef ( widget . pageNo ) ,
pageSize : generateTypeDef ( widget . pageSize ) ,
2021-04-23 05:43:13 +00:00
} ) ,
2021-07-02 09:55:50 +00:00
RATE_WIDGET : {
"!doc" : "Rating widget is used to display ratings in your app." ,
"!url" : "https://docs.appsmith.com/widget-reference/rate" ,
isVisible : isVisible ,
value : "number" ,
maxCount : "number" ,
} ,
2021-07-30 06:36:00 +00:00
IFRAME_WIDGET : ( widget : any ) = > ( {
2021-06-12 16:08:10 +00:00
"!doc" : "Iframe widget is used to display iframes in your app." ,
"!url" : "https://docs.appsmith.com/widget-reference/iframe" ,
2021-06-09 09:39:17 +00:00
isVisible : isVisible ,
2021-06-12 16:08:10 +00:00
source : "string" ,
title : "string" ,
2021-07-30 06:36:00 +00:00
message : generateTypeDef ( widget . message ) ,
2022-07-22 05:12:57 +00:00
messageMetadata : generateTypeDef ( widget . messageMetadata ) ,
2021-07-30 06:36:00 +00:00
} ) ,
2021-07-07 09:30:06 +00:00
DIVIDER_WIDGET : {
"!doc" : "Divider is a simple UI widget used as a separator" ,
"!url" : "https://docs.appsmith.com/widget-reference/divider" ,
isVisible : isVisible ,
orientation : "string" ,
capType : "string" ,
capSide : "number" ,
strokeStyle : "string" ,
dividerColor : "string" ,
thickness : "number" ,
} ,
2021-07-13 08:05:09 +00:00
MENU_BUTTON_WIDGET : {
"!doc" :
"Menu button widget is used to represent a set of actions in a group." ,
"!url" : "https://docs.appsmith.com/widget-reference/menu-button" ,
isVisible : isVisible ,
label : "string" ,
} ,
2021-09-17 09:08:35 +00:00
//TODO: fix this after development
SINGLE_SELECT_TREE_WIDGET : {
"!doc" :
2021-09-20 15:18:10 +00:00
"TreeSelect is used to capture user input from a specified list of permitted inputs/Nested Inputs." ,
2021-09-17 09:08:35 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/treeselect" ,
isVisible : isVisible ,
selectedOptionValue : {
"!type" : "string" ,
2021-09-20 15:18:10 +00:00
"!doc" : "The value selected in a treeselect dropdown" ,
2021-09-17 09:08:35 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/treeselect" ,
} ,
selectedOptionLabel : {
"!type" : "string" ,
2021-09-20 15:18:10 +00:00
"!doc" : "The selected option label in a treeselect dropdown" ,
2021-09-17 09:08:35 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/treeselect" ,
} ,
isDisabled : "bool" ,
isValid : "bool" ,
options : "[dropdownOption]" ,
} ,
MULTI_SELECT_TREE_WIDGET : {
"!doc" :
2021-09-20 15:18:10 +00:00
"Multi TreeSelect is used to capture user inputs from a specified list of permitted inputs/Nested Inputs. A TreeSelect can capture a single choice as well as multiple choices" ,
2021-09-17 09:08:35 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/treeselect" ,
isVisible : isVisible ,
selectedOptionValues : {
"!type" : "[string]" ,
2021-09-20 15:18:10 +00:00
"!doc" : "The array of values selected in a treeselect dropdown" ,
2021-09-17 09:08:35 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/treeselect" ,
} ,
selectedOptionLabels : {
"!type" : "[string]" ,
2021-09-20 15:18:10 +00:00
"!doc" : "The array of selected option labels in a treeselect dropdown" ,
2021-09-17 09:08:35 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/treeselect" ,
} ,
isDisabled : "bool" ,
isValid : "bool" ,
options : "[dropdownOption]" ,
} ,
2021-08-05 11:16:26 +00:00
ICON_BUTTON_WIDGET : {
"!doc" :
"Icon button widget is just an icon, along with all other button properties." ,
"!url" : "https://docs.appsmith.com/widget-reference/icon-button" ,
isVisible : isVisible ,
} ,
2021-08-17 09:11:38 +00:00
CHECKBOX_GROUP_WIDGET : {
"!doc" :
"Checkbox group widget allows users to easily configure multiple checkboxes together." ,
"!url" : "https://docs.appsmith.com/widget-reference/checkbox-group" ,
isVisible : isVisible ,
isDisabled : "bool" ,
isValid : "bool" ,
options : "[dropdownOption]" ,
selectedValues : "[string]" ,
} ,
2021-09-03 10:15:04 +00:00
STATBOX_WIDGET : {
"!doc" : "Show and highlight stats from your data sources" ,
"!url" : "https://docs.appsmith.com/widget-reference/stat-box" ,
isVisible : isVisible ,
} ,
2021-09-08 11:00:36 +00:00
AUDIO_RECORDER_WIDGET : {
"!doc" :
"Audio recorder widget allows users to record using their microphone, listen to the playback, and export the data to a data source." ,
"!url" : "https://docs.appsmith.com/widget-reference/recorder" ,
isVisible : isVisible ,
2022-03-08 15:30:59 +00:00
blobURL : "string" ,
2021-11-11 14:46:08 +00:00
dataURL : "string" ,
rawBinary : "string" ,
2021-09-08 11:00:36 +00:00
} ,
2021-12-29 12:01:19 +00:00
PROGRESSBAR_WIDGET : {
"!doc" : "Progress bar is a simple UI widget used to show progress" ,
"!url" : "https://docs.appsmith.com/widget-reference/progressbar" ,
isVisible : isVisible ,
progress : "number" ,
} ,
2021-12-09 12:02:47 +00:00
SWITCH_GROUP_WIDGET : {
"!doc" :
"Switch group widget allows users to create many switch components which can easily by used in a form" ,
"!url" : "https://docs.appsmith.com/widget-reference/switch-group" ,
selectedValues : "[string]" ,
} ,
feat: camera widget (#8069)
* feat: Camera Widget
-- Scaffold the basic structure of the widget
* feat: Camera Widget
-- Prototype a feature, taking picture
* feat: Camera Widget
-- Add types for MediaRecorder
-- Define media capture status and action types
-- Prototype basic video recording, playing features
* feat: Camera Widget
-- Implement video player
-- Add timer for recording and playing video
-- Add permission and error handling logic
-- Add device selectors
* feat: Camera Widget
-- Place control buttons above device inputs layer
-- Make the widget fully responsive
* feat: Camera Widget
-- Change the color of caret-down icon to white
-- Remove overlaying of web cam and video player
-- Add some padding for device inputs
* feat: Camera Widget
-- Add black background to the container of the widget
* feat: Camera Widget
-- Change the widget icon
* feat: Camera Widget
-- Implement the mute feature of a mic or a camera
* feat: Camera Widget
-- Check media device permissions before getting started
* feat: Camera Widget
-- Add a fullscreen control
* feat: Camera Widget
-- Set error text color to white
-- Change the layout of control panel
* feat: Camera Widget
-- Apply layout change for control panel according to app layout change
* feat: Camera Widget
-- Add a new derived property, videoURL
* feat: Switch Group Widget
-- Adopt theme changes
* feat: Camera Widget
-- Make background grey in case of both error and disabled status
* feat: Camera Widget
-- Update npm dependencies
* feat: Camera Widget
-- Fix on #8788, using muted property
* feat: Camera Widget
-- Show off the microphone setting icon only if the current mode is video
-- Set isMirrored property to true by default
* feat: Camera Widget
-- Add photo viewer
* feat: Camera Widget
-- Add onImageCapture, onRecordingStart, onRecordingStop actions instead of onMediaCapture
* feat: Camera Widget
-- Expose meta properties for the widget
* feat: Camera Widget
-- Fix on responsiveness issue
* feat: Camera Widget
-- Add type definitions for MediaStream recording
* feat: Camera Widget
-- Hide isMirroed property for video mode
* feat: Camera Widget
-- Wrap all the controls with TooltipComponent
* feat: Camera Widget
-- Implement enter, exit full screen feature
* feat: Camera Widget
-- Add a widget icon for entity explorer
* feat: Camera Widget
-- Fix on the typo for the label of onRecordingStop property
* feat: Camera Widget
-- Enable/disable media tracks
* feat: Camera Widget
-- Set the video's height to 100% in fullscreen mode
* feat: Camera Widget
-- Add overlayers on Webcam
* feat: Camera Widget
-- Set position to relative on fullscreen wrapper div
-- Set the photo viewer's height to 100%
* feat: Camera Widget
-- Add image, mediaCaptureStatus, timer meta properties to keep UI states when the widget is dragged
* feat: Camera Widget
-- Refactor code base, eliminating commented code blocks
* feat: Camera Widget
-- Revert all the changes needed for keeping status when the widget is dragged
-- Set mirroed property to false for video mode
2021-12-24 14:06:59 +00:00
CAMERA_WIDGET : {
"!doc" :
"Camera widget allows users to take a picture or record videos through their system camera using browser permissions." ,
"!url" : "https://docs.appsmith.com/widget-reference/camera" ,
imageBlobURL : "string" ,
imageDataURL : "string" ,
imageRawBinary : "string" ,
videoBlobURL : "string" ,
videoDataURL : "string" ,
videoRawBinary : "string" ,
} ,
2022-01-07 09:57:45 +00:00
MAP_CHART_WIDGET : {
"!doc" :
"Map Chart widget shows the graphical representation of your data on the map." ,
"!url" : "https://docs.appsmith.com/widget-reference/map-chart" ,
isVisible : isVisible ,
selectedDataPoint : "mapChartDataPoint" ,
} ,
2022-01-18 07:52:24 +00:00
INPUT_WIDGET_V2 : {
"!doc" :
"An input text field is used to capture a users textual input such as their names, numbers, emails etc. Inputs are used in forms and can have custom validations." ,
"!url" : "https://docs.appsmith.com/widget-reference/input" ,
text : {
"!type" : "string" ,
"!doc" : "The text value of the input" ,
"!url" : "https://docs.appsmith.com/widget-reference/input" ,
} ,
isValid : "bool" ,
isVisible : isVisible ,
isDisabled : "bool" ,
} ,
CURRENCY_INPUT_WIDGET : {
"!doc" :
"An input text field is used to capture a currency value. Inputs are used in forms and can have custom validations." ,
2022-03-18 16:48:16 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/currency-input" ,
2022-01-18 07:52:24 +00:00
text : {
"!type" : "string" ,
"!doc" : "The formatted text value of the input" ,
2022-03-18 16:48:16 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/currency-input" ,
2022-01-18 07:52:24 +00:00
} ,
value : {
"!type" : "number" ,
"!doc" : "The value of the input" ,
2022-03-18 16:48:16 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/currency-input" ,
2022-01-18 07:52:24 +00:00
} ,
isValid : "bool" ,
isVisible : isVisible ,
isDisabled : "bool" ,
countryCode : {
"!type" : "string" ,
"!doc" : "Selected country code for Currency" ,
} ,
currencyCode : {
"!type" : "string" ,
"!doc" : "Selected Currency code" ,
} ,
} ,
PHONE_INPUT_WIDGET : {
"!doc" :
"An input text field is used to capture a phone number. Inputs are used in forms and can have custom validations." ,
2022-03-18 16:48:16 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/phone-input" ,
2022-01-18 07:52:24 +00:00
text : {
"!type" : "string" ,
"!doc" : "The text value of the input" ,
2022-03-18 16:48:16 +00:00
"!url" : "https://docs.appsmith.com/widget-reference/phone-input" ,
} ,
value : {
"!type" : "string" ,
"!doc" : "The unformatted text value of the input" ,
"!url" : "https://docs.appsmith.com/widget-reference/phone-input" ,
2022-01-18 07:52:24 +00:00
} ,
isValid : "bool" ,
isVisible : isVisible ,
isDisabled : "bool" ,
countryCode : {
"!type" : "string" ,
"!doc" : "Selected country code for Phone Number" ,
} ,
dialCode : {
"!type" : "string" ,
"!doc" : "Selected dialing code for Phone Number" ,
} ,
} ,
2022-01-18 14:36:14 +00:00
CIRCULAR_PROGRESS_WIDGET : {
"!doc" : "Circular Progress is a simple UI widget used to show progress" ,
"!url" : "https://docs.appsmith.com/widget-reference/circular-progress" ,
isVisible : isVisible ,
progress : "number" ,
} ,
feat: JSON Form widget (#8472)
* initial layout
* updated parser to support nested array
* array field rendering
* changes
* ts fix
* minor revert FormWidget
* modified schema structure
* select and switch fields
* added checkbox field
* added RadioGroupField
* partial DateField and defaults, typing refactoring
* added label and field type change
* minor ts changes
* changes
* modified widget/utils for nested panelConfig, modified schema to object approach
* array/object label support
* hide field configuration when children not present
* added tooltip
* field visibility option
* disabled state
* upgraded tslib, form initial values
* custom field configuration - add/hide/edit
* field configuration - label change
* return input when field configuration reaches max depth
* minor changes
* form - scroll, fixedfooter, enitity defn and other minior changes
* form title
* unregister on unmount
* fixes
* zero state
* fix field padding
* patched updating form values, removed linting warnings
* configured action buttons
* minor fix
* minor change
* property pane - sort fields in field configuration
* refactor include all properties
* checkbox properties
* date properties
* refactor typings and radio group properties
* switch, multselect, select, array, object properties
* minor changes
* default value
* ts fixes
* checkbox field properties implementation
* date field prop implementation
* switch field
* select field and fix deep nested meta properties
* multiselect implementation
* minor change
* input field implementation
* fix position jump on field type change
* initial accordian
* field state property and auto-complete of JSONFormComputeControl
* merge fixes
* renamed FormBuilder to JSONForm
* source data validation minor change
* custom field default value fix
* Editable keys for custom field
* minor fixes
* replaced useFieldArray with custom logic, added widget icon
* array and object accordian with border/background styling
* minor change
* disabled states for array and objects
* default value minor fix
* form level styles
* modified logic for isDisabled for array and object, added disabledWhenInvalid, exposed isValid to fieldState for text input, removed useDisableChildren
* added isValid for all field types
* fixed reset to default values
* debounce form values update
* minor change
* minor change
* fix crash - source data change multi-select to array, fix crash - change of options
* fix positioning
* detect date type in source data
* fix crash - when object is passed to regex input field
* fixed default sourceData path for fields
* accodion keep children mounted on collapse
* jest test for schemaParser
* widget/helper and useRegisterFieldInvalid test
* tests for property config helper and generatePanelPropertyConfig
* fix input field validation not appearing
* fix date field type detection
* rename data -> formData
* handle null/undefined field value change in sourceData
* added null/undefined as valid values for defaultValue text field
* auto detect email field
* set formData default value on initial load
* switch field inline positioning
* field margin fix for row direction
* select full width
* fiex date field default value - out of range
* fix any field type to array
* array default value logic change
* base cypress test changes
* initial json form render cy test
* key sanitization
* fix fieldState update logic
* required design, object/array background color, accordion changes, fix - add new custom field
* minor change
* cypress tests
* fix date formatted value, field state cypress test
* cypress - field properties test and fixes
* rename test file
* fix accessort change to blank value, cypress tests
* fix array field default value for modified accessor
* minor fix
* added animate loading
* fix empty state, add new custom field
* test data fix
* fix warnings
* fix timePrecision visibility
* button styling
* ported input v2
* fix jest tests
* fix cypress tests
* perf changes
* perf improvement
* added comments
* multiselect changes
* input field perf refactor
* array field, object field refactor performance
* checkbox field refactor
* refectored date, radio, select and switch
* fixes
* test fixes
* fixes
* minor fix
* rename field renderer
* remove tracked fieldRenderer field
* cypress test fixes
* cypress changes
* array default value fixes
* arrayfield passedDefaultValue
* auto enabled JS mode for few properties, reverted swith and date property controls
* cypress changes
* added widget sniping mode and fixed object passedDefaultValue
* multiselect v2
* select v2
* fix jest tests
* test fixes
* field limit
* rename field type dropdown texts
* field type changes fixes
* jest fixes
* loading state submit button
* default source data for new widget
* modify limit message
* multiseelct default value changes and cypress fix
* select default value
* keep default value intact on field type change
* TextTable cypress text fix
* review changes
* fixed footer changes
* collapse styles section by default
* fixed footer changes
* form modes
* custom field key rentention
* fixed footer fix in view mode
* non ascii characters
* fix meta merge in dataTreeWidget
* minor fixes
* rename useRegisterFieldInvalid.ts -> useRegisterFieldValidity.ts
* modified dependency injection into evaluated values
* refactored fixedfooter logic
* minor change
* accessor update
* minor change
* fixes
* QA fixes date field, scroll content
* fix phone number field, removed visiblity option from array item
* fix sourceData autocomplete
* reset logic
* fix multiselect reset
* form values hydration on widget drag
* code review changes
* reverted order of merge dataTreeWidget
* fixes
* added button titles, fixed hydration issue
* default value fixes
* upgraded react hook form, modified array-level/field-level default value logic
* fixed select validation
* added icon entity explorer, modified icon align control
* modify accessor validation for mongo db _id
* update email field regex
* review changes
* explicitly handle empty source data validation
2022-03-24 07:13:25 +00:00
JSON_FORM_WIDGET : ( widget : any ) = > ( {
"!doc" :
"JSON Form widget can be used to auto-generate forms by providing a JSON source data." ,
// TODO: Update the url
"!url" : "https://docs.appsmith.com/widget-reference" ,
formData : generateTypeDef ( widget . formData ) ,
sourceData : generateTypeDef ( widget . sourceData ) ,
fieldState : generateTypeDef ( widget . fieldState ) ,
2022-04-22 11:50:51 +00:00
isValid : "bool" ,
feat: JSON Form widget (#8472)
* initial layout
* updated parser to support nested array
* array field rendering
* changes
* ts fix
* minor revert FormWidget
* modified schema structure
* select and switch fields
* added checkbox field
* added RadioGroupField
* partial DateField and defaults, typing refactoring
* added label and field type change
* minor ts changes
* changes
* modified widget/utils for nested panelConfig, modified schema to object approach
* array/object label support
* hide field configuration when children not present
* added tooltip
* field visibility option
* disabled state
* upgraded tslib, form initial values
* custom field configuration - add/hide/edit
* field configuration - label change
* return input when field configuration reaches max depth
* minor changes
* form - scroll, fixedfooter, enitity defn and other minior changes
* form title
* unregister on unmount
* fixes
* zero state
* fix field padding
* patched updating form values, removed linting warnings
* configured action buttons
* minor fix
* minor change
* property pane - sort fields in field configuration
* refactor include all properties
* checkbox properties
* date properties
* refactor typings and radio group properties
* switch, multselect, select, array, object properties
* minor changes
* default value
* ts fixes
* checkbox field properties implementation
* date field prop implementation
* switch field
* select field and fix deep nested meta properties
* multiselect implementation
* minor change
* input field implementation
* fix position jump on field type change
* initial accordian
* field state property and auto-complete of JSONFormComputeControl
* merge fixes
* renamed FormBuilder to JSONForm
* source data validation minor change
* custom field default value fix
* Editable keys for custom field
* minor fixes
* replaced useFieldArray with custom logic, added widget icon
* array and object accordian with border/background styling
* minor change
* disabled states for array and objects
* default value minor fix
* form level styles
* modified logic for isDisabled for array and object, added disabledWhenInvalid, exposed isValid to fieldState for text input, removed useDisableChildren
* added isValid for all field types
* fixed reset to default values
* debounce form values update
* minor change
* minor change
* fix crash - source data change multi-select to array, fix crash - change of options
* fix positioning
* detect date type in source data
* fix crash - when object is passed to regex input field
* fixed default sourceData path for fields
* accodion keep children mounted on collapse
* jest test for schemaParser
* widget/helper and useRegisterFieldInvalid test
* tests for property config helper and generatePanelPropertyConfig
* fix input field validation not appearing
* fix date field type detection
* rename data -> formData
* handle null/undefined field value change in sourceData
* added null/undefined as valid values for defaultValue text field
* auto detect email field
* set formData default value on initial load
* switch field inline positioning
* field margin fix for row direction
* select full width
* fiex date field default value - out of range
* fix any field type to array
* array default value logic change
* base cypress test changes
* initial json form render cy test
* key sanitization
* fix fieldState update logic
* required design, object/array background color, accordion changes, fix - add new custom field
* minor change
* cypress tests
* fix date formatted value, field state cypress test
* cypress - field properties test and fixes
* rename test file
* fix accessort change to blank value, cypress tests
* fix array field default value for modified accessor
* minor fix
* added animate loading
* fix empty state, add new custom field
* test data fix
* fix warnings
* fix timePrecision visibility
* button styling
* ported input v2
* fix jest tests
* fix cypress tests
* perf changes
* perf improvement
* added comments
* multiselect changes
* input field perf refactor
* array field, object field refactor performance
* checkbox field refactor
* refectored date, radio, select and switch
* fixes
* test fixes
* fixes
* minor fix
* rename field renderer
* remove tracked fieldRenderer field
* cypress test fixes
* cypress changes
* array default value fixes
* arrayfield passedDefaultValue
* auto enabled JS mode for few properties, reverted swith and date property controls
* cypress changes
* added widget sniping mode and fixed object passedDefaultValue
* multiselect v2
* select v2
* fix jest tests
* test fixes
* field limit
* rename field type dropdown texts
* field type changes fixes
* jest fixes
* loading state submit button
* default source data for new widget
* modify limit message
* multiseelct default value changes and cypress fix
* select default value
* keep default value intact on field type change
* TextTable cypress text fix
* review changes
* fixed footer changes
* collapse styles section by default
* fixed footer changes
* form modes
* custom field key rentention
* fixed footer fix in view mode
* non ascii characters
* fix meta merge in dataTreeWidget
* minor fixes
* rename useRegisterFieldInvalid.ts -> useRegisterFieldValidity.ts
* modified dependency injection into evaluated values
* refactored fixedfooter logic
* minor change
* accessor update
* minor change
* fixes
* QA fixes date field, scroll content
* fix phone number field, removed visiblity option from array item
* fix sourceData autocomplete
* reset logic
* fix multiselect reset
* form values hydration on widget drag
* code review changes
* reverted order of merge dataTreeWidget
* fixes
* added button titles, fixed hydration issue
* default value fixes
* upgraded react hook form, modified array-level/field-level default value logic
* fixed select validation
* added icon entity explorer, modified icon align control
* modify accessor validation for mongo db _id
* update email field regex
* review changes
* explicitly handle empty source data validation
2022-03-24 07:13:25 +00:00
} ) ,
2022-04-07 08:07:09 +00:00
PROGRESS_WIDGET : {
"!doc" :
"Progress indicators commonly known as spinners, express an unspecified wait time or display the length of a process." ,
"!url" : "https://docs.appsmith.com/widget-reference/progress" ,
isVisible : isVisible ,
progress : "number" ,
} ,
2020-05-20 11:30:53 +00:00
} ;
export const GLOBAL_DEFS = {
dropdownOption : {
label : "string" ,
value : "string" ,
} ,
tabs : {
id : "string" ,
label : "string" ,
} ,
chartDataPoint : {
x : "string" ,
y : "string" ,
} ,
chartData : {
seriesName : "string" ,
data : "[chartDataPoint]" ,
} ,
latLong : {
lat : "number" ,
long : "number" ,
2022-04-22 06:14:42 +00:00
title : "string" ,
2020-05-20 11:30:53 +00:00
} ,
mapMarker : {
lat : "number" ,
long : "number" ,
title : "string" ,
description : "string" ,
} ,
2021-03-12 08:14:32 +00:00
file : {
data : "string" ,
2022-04-21 10:39:24 +00:00
dataFormat : "string" ,
2021-03-12 09:04:05 +00:00
name : "text" ,
type : "file" ,
2021-03-12 08:14:32 +00:00
} ,
2022-01-07 09:57:45 +00:00
mapChartDataPoint : {
id : "string" ,
label : "string" ,
originalId : "string" ,
shortLabel : "string" ,
value : "number" ,
} ,
2020-05-20 11:30:53 +00:00
} ;
export const GLOBAL_FUNCTIONS = {
2021-07-20 10:02:56 +00:00
"!name" : "DATA_TREE.APPSMITH.FUNCTIONS" ,
2020-05-20 11:30:53 +00:00
navigateTo : {
"!doc" : "Action to navigate the user to another page or url" ,
2021-12-23 14:17:20 +00:00
"!type" :
"fn(pageNameOrUrl: string, params: {}, target?: string) -> +Promise[:t=[!0.<i>.:t]]" ,
2020-05-20 11:30:53 +00:00
} ,
showAlert : {
"!doc" : "Show a temporary notification style message to the user" ,
2021-12-23 14:17:20 +00:00
"!type" : "fn(message: string, style: string) -> +Promise[:t=[!0.<i>.:t]]" ,
2020-05-20 11:30:53 +00:00
} ,
showModal : {
"!doc" : "Open a modal" ,
2021-12-23 14:17:20 +00:00
"!type" : "fn(modalName: string) -> +Promise[:t=[!0.<i>.:t]]" ,
2020-05-20 11:30:53 +00:00
} ,
closeModal : {
"!doc" : "Close a modal" ,
2021-12-23 14:17:20 +00:00
"!type" : "fn(modalName: string) -> +Promise[:t=[!0.<i>.:t]]" ,
2020-05-20 11:30:53 +00:00
} ,
2020-08-24 12:09:17 +00:00
storeValue : {
"!doc" : "Store key value data locally" ,
2021-12-23 14:17:20 +00:00
"!type" : "fn(key: string, value: any) -> +Promise[:t=[!0.<i>.:t]]" ,
2020-08-24 12:09:17 +00:00
} ,
2020-08-28 12:07:37 +00:00
download : {
"!doc" : "Download anything as a file" ,
2021-12-23 14:17:20 +00:00
"!type" :
"fn(data: any, fileName: string, fileType?: string) -> +Promise[:t=[!0.<i>.:t]]" ,
2020-08-28 12:07:37 +00:00
} ,
2021-01-07 04:44:30 +00:00
copyToClipboard : {
"!doc" : "Copy text to clipboard" ,
2021-12-23 14:17:20 +00:00
"!type" : "fn(data: string, options: object) -> +Promise[:t=[!0.<i>.:t]]" ,
2021-01-07 04:44:30 +00:00
} ,
2021-03-02 12:49:36 +00:00
resetWidget : {
"!doc" : "Reset widget values" ,
2021-12-23 14:17:20 +00:00
"!type" :
"fn(widgetName: string, resetChildren: boolean) -> +Promise[:t=[!0.<i>.:t]]" ,
2021-03-02 12:49:36 +00:00
} ,
2021-10-11 12:55:03 +00:00
setInterval : {
"!doc" : "Execute triggers at a given interval" ,
"!type" : "fn(callback: fn, interval: number, id?: string) -> void" ,
} ,
clearInterval : {
"!doc" : "Stop executing a setInterval with id" ,
"!type" : "fn(id: string) -> void" ,
} ,
2020-05-20 11:30:53 +00:00
} ;
2021-09-08 17:32:22 +00:00
2022-04-07 20:37:03 +00:00
export const getPropsForJSActionEntity = ( {
config ,
data ,
} : JSCollectionData ) : Record < string , string > = > {
const properties : Record < string , any > = { } ;
const actions = config . actions ;
2021-09-08 17:32:22 +00:00
if ( actions && actions . length > 0 )
2022-04-07 20:37:03 +00:00
for ( let i = 0 ; i < config . actions . length ; i ++ ) {
const action = config . actions [ i ] ;
2021-09-08 17:32:22 +00:00
properties [ action . name + "()" ] = "Function" ;
2022-04-07 20:37:03 +00:00
if ( data && action . id in data ) {
properties [ action . name + ".data" ] = data [ action . id ] ;
}
2021-09-08 17:32:22 +00:00
}
2022-04-07 20:37:03 +00:00
const variablesProps = config . variables ;
2021-09-08 17:32:22 +00:00
if ( variablesProps && variablesProps . length > 0 ) {
for ( let i = 0 ; i < variablesProps . length ; i ++ ) {
const variableProp = variablesProps [ i ] ;
properties [ variableProp . name ] = variableProp . value ;
}
}
return properties ;
} ;
2022-06-21 13:57:34 +00:00
export type EntityDefinitionsOptions = keyof typeof entityDefinitions ;