PromucFlow_constructor/app/client/src/utils/WidgetRegistry.tsx

182 lines
6.5 KiB
TypeScript
Raw Normal View History

import { registerWidget, WidgetConfiguration } from "./WidgetRegisterHelpers";
import CanvasWidget, {
CONFIG as CANVAS_WIDGET_CONFIG,
} from "widgets/CanvasWidget";
import SkeletonWidget, {
CONFIG as SKELETON_WIDGET_CONFIG,
} from "widgets/SkeletonWidget";
import TextWidget, { CONFIG as TEXT_WIDGET_CONFIG } from "widgets/TextWidget";
import TableWidget, {
CONFIG as TABLE_WIDGET_CONFIG,
} from "widgets/TableWidget";
import ContainerWidget, {
CONFIG as CONTAINER_WIDGET_CONFIG,
} from "widgets/ContainerWidget";
import CheckboxWidget, {
CONFIG as CHECKBOX_WIDGET_CONFIG,
} from "widgets/CheckboxWidget";
2019-03-21 12:10:32 +00:00
import RadioGroupWidget, {
CONFIG as RADIO_GROUP_WIDGET_CONFIG,
2019-11-25 05:07:27 +00:00
} from "widgets/RadioGroupWidget";
import ButtonWidget, {
CONFIG as BUTTON_WIDGET_CONFIG,
} from "widgets/ButtonWidget";
import DropdownWidget, {
CONFIG as DROPDOWN_WIDGET_CONFIG,
} from "widgets/DropdownWidget";
import ImageWidget, {
CONFIG as IMAGE_WIDGET_CONFIG,
} from "widgets/ImageWidget";
import VideoWidget, {
CONFIG as VIDEO_WIDGET_CONFIG,
} from "widgets/VideoWidget";
import TabsWidget, { CONFIG as TABS_WIDGET_CONFIG } from "widgets/TabsWidget";
import InputWidget, {
CONFIG as INPUT_WIDGET_CONFIG,
} from "widgets/InputWidget";
import ModalWidget, {
CONFIG as MODAL_WIDGET_CONFIG,
} from "widgets/ModalWidget";
import ChartWidget, {
CONFIG as CHART_WIDGET_CONFIG,
} from "widgets/ChartWidget";
import MapWidget, { CONFIG as MAP_WIDGET_CONFIG } from "widgets/MapWidget";
2019-11-04 14:22:50 +00:00
import FilePickerWidget, {
CONFIG as FILEPICKER_WIDGET_CONFIG,
2019-11-25 05:07:27 +00:00
} from "widgets/FilepickerWidget";
import RichTextEditorWidget, {
CONFIG as RICH_TEXT_EDITOR_WIDGET_CONFIG,
} from "widgets/RichTextEditorWidget";
2019-11-06 12:12:41 +00:00
import DatePickerWidget, {
CONFIG as DATE_PICKER_WIDGET_CONFIG,
2019-11-25 05:07:27 +00:00
} from "widgets/DatePickerWidget";
import DatePickerWidget2, {
CONFIG as DATE_PICKER_WIDGET_2_CONFIG,
} from "widgets/DatePickerWidget2";
import ListWidget, { CONFIG as LIST_WIDGET_CONFIG } from "widgets/ListWidget";
import SwitchWidget, {
CONFIG as SWITCH_WIDGET_CONFIG,
} from "widgets/SwitchWidget";
import DividerWidget, {
CONFIG as DIVIDER_WIDGET_CONFIG,
} from "widgets/DividerWidget";
import TabsMigratorWidget, {
CONFIG as TABS_MIGRATOR_WIDGET_CONFIG,
} from "widgets/TabsMigrator";
import RateWidget, { CONFIG as RATE_WIDGET_CONFIG } from "widgets/RateWidget";
import IframeWidget, {
CONFIG as IFRAME_WIDGET_CONFIG,
} from "widgets/IframeWidget";
import MenuButtonWidget, {
CONFIG as MENU_BUTTON_WIDGET_CONFIG,
} from "widgets/MenuButtonWidget";
import MultiSelectWidget, {
CONFIG as MULTI_SELECT_WIDGET_CONFIG,
} from "widgets/MultiSelectWidget";
import FormWidget, { CONFIG as FORM_WIDGET_CONFIG } from "widgets/FormWidget";
import FormButtonWidget, {
CONFIG as FORM_BUTTON_WIDGET_CONFIG,
} from "widgets/FormButtonWidget";
import IconWidget, { CONFIG as ICON_WIDGET_CONFIG } from "widgets/IconWidget";
import IconButtonWidget, {
CONFIG as ICON_BUTTON_WIDGET_CONFIG,
} from "widgets/IconButtonWidget";
import CheckboxGroupWidget, {
CONFIG as CHECKBOX_GROUP_WIDGET_CONFIG,
} from "widgets/CheckboxGroupWidget";
import StatboxWidget, {
CONFIG as STATBOX_WIDGET_CONFIG,
} from "widgets/StatboxWidget";
import FilePickerWidgetV2, {
CONFIG as FILEPICKER_WIDGET_V2_CONFIG,
} from "widgets/FilePickerWidgetV2";
import AudioWidget, {
CONFIG as AUDIO_WIDGET_CONFIG,
} from "widgets/AudioWidget";
import AudioRecorderWidget, {
CONFIG as AUDIO_RECORDER_WIDGET_CONFIG,
} from "widgets/AudioRecorderWidget";
import DocumentViewerWidget, {
CONFIG as DOCUMENT_VIEWER_WIDGET_CONFIG,
} from "widgets/DocumentViewerWidget";
import ButtonGroupWidget, {
CONFIG as BUTTON_GROUP_CONFIG,
} from "widgets/ButtonGroupWidget";
import SingleSelectTreeWidget, {
CONFIG as SINGLE_SELECT_TREE_WIDGET_CONFIG,
} from "widgets/SingleSelectTreeWidget";
import MultiSelectTreeWidget, {
CONFIG as MULTI_SELECT_TREE_WIDGET_CONFIG,
} from "widgets/MultiSelectTreeWidget";
2021-12-29 12:01:19 +00:00
import ProgressBarWidget, {
CONFIG as PROGRESSBAR_WIDGET_CONFIG,
} from "widgets/ProgressBarWidget";
feat: Switch Group widget (#7590) * Feat: Switch Group Widget -- The first MVP of the widget * feat: Switch Group Widget -- Follow the same config and implementation as the other group widgets * feat: Switch Group Widget -- Elaborate the help text for defaultSelectedValues * feat: Switch Group Widget -- Add a widget icon * feat: Switch Group Widget -- Remove unnecessary property control at ItemsControl.tsx -- Refactor some code snippets for higher code quality -- Add basic cypress test cases * fix: icon for the widget optimised & replaced * feat: Switch Group Widget -- Add a unit test for defaultSelectedValuesValidation * feat: Switch Group Widget -- Make the validation type for defaultSelectedValues property to ValidationTypes.ARRAY -- Remove original validation function and its unit test * feat: Switch Group Widget -- Fix on typo -- Fix on formatting issue -- Change the help text for isRequired property * feat: Switch Group Widget -- Revert help text for isRequired property to the original one * feat: Switch Group Widget -- Set strict property to true on defaultSelectedValues * feat: Switch group widget -- Refactor utility function, getCamelCaseString -- Add the corresponding test case * feat: Switch group widget -- Implement options property as a plain JS field -- Reimplement update logic for selectedValues when options changes -- Add a new utility function for checking equality of object arrays -- Add a unit test for the above function -- Rewrite the corresponding Cypress test cases * feat: Switch Group Widget -- Remove isArrayEqual utility function and directly use functions from lodash * feat: Swtich Group Widget -- Make selectedValues as a derived property * feat: Switch Group Widget -- Replace the widget icon * feat: Switch Group Widget -- Rewrite a test case for onSelectionChange property * feat: Switch Group Widget -- Remove redundant calls for openPropertyPane * feat: Switch Group Widget -- Remove closePropertyPane call from afterEach hook * feat: Switch Group Widget -- Change the selector for every switch element in onSelectionChange test case * feat: Switch Group Widget -- Fix on failed Cypress test case, adding closePropertyPane command to onSelectionChange * feat: Switch Group Widget -- Remove template literal from a selector * feat: Switch Group Widget -- Make click on onSelectionChange test case forced * feat: Switch Group Widget -- Fix on crash issue when editing on Options property * feat: Switch Group Widget -- Add the widget icon to show in entity explorer * feat: Switch Group Widget -- Fix on blue color on mouse down -- Add a new property for alignment Co-authored-by: somangshu <somangshu.goswami1508@gmail.com>
2021-12-09 12:02:47 +00:00
import SwitchGroupWidget, {
CONFIG as SWITCH_GROUP_WIDGET_CONFIG,
} from "widgets/SwitchGroupWidget";
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
import CameraWidget, {
CONFIG as CAMERA_WIDGET_CONFIG,
} from "widgets/CameraWidget";
feat: Map Chart widget (#6929) * FEATURE-6314 : Map Chart Widget -- Scaffold the widget * FEATURE-6314 : Map Chart Widget -- Add a new widget icon -- Proptotype the property pane for the first time * FEATURE-6314 : Map Chart Widget -- Install fusionmaps -- Draw naive world map for the PoC * FEATURE-6314 : Map Chart Widget -- Integrate the limited number of FusionMaps into the widget -- Bind basic properties and a action into the map * FEATURE-6314 : Map Chart Widget -- Comment out the console statements for linting error * FEATURE-6314 : Map Chart Widget -- Update dependency versioning * feat: Map Chart Widget -- Fix on linting errors, including unused variables, console statement * Feat: Map Chart Widget -- Install dependencies from scratch * fix: increased max chink size allowed in the build config * Feat: Map Chart Widget -- Refactor code base according to the changed widget structure -- Add cleanup for removing event listener -- Eliminate the unnecessary codes, comments * Feat: Map Chart Widget -- Remove unnecessary icon -- Refactor on constants * Feat: Map Chart Widget -- Add a cypress test case for map type changes -- Add a cypress test case for title change -- Add a cypress test case for toggling show labels -- Add a cypress test case for onEntityClick event listener * feat: Map Chart Widget -- Scaffold the setup for custom map config * feat: Map Chart Widget -- Dynamically import map definition files * feat: Map Chart Widget -- Eliminate unnecessary comments * feat: Fusion Maps Widget -- Update base dependencies * partial map chart changes. * feat: Map Chart Widget -- Refactor entire code base, removing custom configs -- Disable prefetching on mapCharts chunk * feat: Map Chart Widget -- Comment onEntityClick test case out * feat: Map Chart Widget -- Fix on onEntityClick test case * feat: Map Chart Widget -- Change the widget icon -- Rename onEnityClick to onDataPointClick -- Expose selectedDataPoint -- Add a new Cypress test case for the toast message on onDataPointClick * feat: Map Chart Widget -- Add a new property colorRange -- Add default values for data and colorRange properties -- Eliminate unnecessary constant colorRange * feat: Map Chart Widget -- update selectedDataPoint meta property unconditionally * feat: Map Chart Widget -- Update initial map type config to be consistent with the corresponding property * feat: Map Chart Widget -- Add widget icon for entity explorer * feat: Map Chart Widget -- Make array elements of data, colorRange properties unique * feat: Map Chart Widget -- Prevent re-render when disabling color codes and double-clicking on entities * feat: Map Chart Widget -- Declare defaultChartConfigs variable inside component class -- Replace deprecated substr method with substring * feat: Map Chart widget -- Complement validation rules for data property * feat: Map Chart widget -- Define rows and cols without using GRID_DENSITY_MIGRATION_V1 -- Change updateDataSet hook by replacing switch statement with object mapping * feat: Map Chart widget -- Pull out dataSetMapping from the updateDataSet hook * feat: Map Chart widget -- Force click events with regard to onDataPointClick test cases * feat: Map Chart widget -- Update fusioncharts and fusionmaps npm packages to the latest version * feat: Map Chart widget -- Make contents responsive using CSS styles instead of directly changing width, height attributes of the chart Co-authored-by: somangshu <somangshu.goswami1508@gmail.com> Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com> Co-authored-by: Arpit Mohan <arpit@appsmith.com>
2022-01-07 09:57:45 +00:00
import MapChartWidget, {
CONFIG as MAP_CHART_WIDGET_CONFIG,
} from "widgets/MapChartWidget";
import log from "loglevel";
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
export const ALL_WDIGETS_AND_CONFIG = [
[CanvasWidget, CANVAS_WIDGET_CONFIG],
[SkeletonWidget, SKELETON_WIDGET_CONFIG],
[ContainerWidget, CONTAINER_WIDGET_CONFIG],
[TextWidget, TEXT_WIDGET_CONFIG],
[TableWidget, TABLE_WIDGET_CONFIG],
[CheckboxWidget, CHECKBOX_WIDGET_CONFIG],
[RadioGroupWidget, RADIO_GROUP_WIDGET_CONFIG],
[ButtonWidget, BUTTON_WIDGET_CONFIG],
[DropdownWidget, DROPDOWN_WIDGET_CONFIG],
[ImageWidget, IMAGE_WIDGET_CONFIG],
[VideoWidget, VIDEO_WIDGET_CONFIG],
[TabsWidget, TABS_WIDGET_CONFIG],
[InputWidget, INPUT_WIDGET_CONFIG],
[ModalWidget, MODAL_WIDGET_CONFIG],
[ChartWidget, CHART_WIDGET_CONFIG],
[MapWidget, MAP_WIDGET_CONFIG],
[FilePickerWidget, FILEPICKER_WIDGET_CONFIG],
[RichTextEditorWidget, RICH_TEXT_EDITOR_WIDGET_CONFIG],
[DatePickerWidget, DATE_PICKER_WIDGET_CONFIG],
[DatePickerWidget2, DATE_PICKER_WIDGET_2_CONFIG],
[SwitchWidget, SWITCH_WIDGET_CONFIG],
[FormWidget, FORM_WIDGET_CONFIG],
[FormButtonWidget, FORM_BUTTON_WIDGET_CONFIG],
[IconWidget, ICON_WIDGET_CONFIG],
[ListWidget, LIST_WIDGET_CONFIG],
[RateWidget, RATE_WIDGET_CONFIG],
[IframeWidget, IFRAME_WIDGET_CONFIG],
[TabsMigratorWidget, TABS_MIGRATOR_WIDGET_CONFIG],
[DividerWidget, DIVIDER_WIDGET_CONFIG],
[MenuButtonWidget, MENU_BUTTON_WIDGET_CONFIG],
[MultiSelectWidget, MULTI_SELECT_WIDGET_CONFIG],
[IconButtonWidget, ICON_BUTTON_WIDGET_CONFIG],
[CheckboxGroupWidget, CHECKBOX_GROUP_WIDGET_CONFIG],
[FilePickerWidgetV2, FILEPICKER_WIDGET_V2_CONFIG],
[StatboxWidget, STATBOX_WIDGET_CONFIG],
[AudioRecorderWidget, AUDIO_RECORDER_WIDGET_CONFIG],
[DocumentViewerWidget, DOCUMENT_VIEWER_WIDGET_CONFIG],
[ButtonGroupWidget, BUTTON_GROUP_CONFIG],
[MultiSelectTreeWidget, MULTI_SELECT_TREE_WIDGET_CONFIG],
[SingleSelectTreeWidget, SINGLE_SELECT_TREE_WIDGET_CONFIG],
[SwitchGroupWidget, SWITCH_GROUP_WIDGET_CONFIG],
[AudioWidget, AUDIO_WIDGET_CONFIG],
[ProgressBarWidget, PROGRESSBAR_WIDGET_CONFIG],
[CameraWidget, CAMERA_WIDGET_CONFIG],
[MapChartWidget, MAP_CHART_WIDGET_CONFIG],
];
export const registerWidgets = () => {
const start = performance.now();
for (const widget of ALL_WDIGETS_AND_CONFIG) {
registerWidget(widget[0], widget[1] as WidgetConfiguration);
}
log.debug("Widget registration took: ", performance.now() - start, "ms");
};