PromucFlow_constructor/app/client/src/widgets/ButtonWidget/index.ts
Rajat Agrawal e775e300e6
chore: Move autocomplete suggestions from entityDefinitions to individual widget components (#21818)
Fixes #21718 

This is a PR for review of approach that I have come up with refactor
for issue : #21718.

We can discuss the approach in the comments.

This PR moves autocomplete suggestions from a static utility file,
entityDefinitions, to widget/index.ts file of each widget.

This refactor will help in the long term project of moving widgets into
its own module as well as support for custom widgets.
2023-04-14 11:57:49 +05:30

73 lines
1.8 KiB
TypeScript

import {
ButtonPlacementTypes,
ButtonVariantTypes,
RecaptchaTypes,
} from "components/constants";
import { BUTTON_MIN_WIDTH } from "constants/minWidthConstants";
import { ResponsiveBehavior } from "utils/autoLayout/constants";
import IconSVG from "./icon.svg";
import Widget from "./widget";
export const CONFIG = {
type: Widget.getWidgetType(),
name: "Button",
iconSVG: IconSVG,
needsMeta: true,
searchTags: ["click", "submit"],
defaults: {
animateLoading: true,
text: "Submit",
buttonVariant: ButtonVariantTypes.PRIMARY,
placement: ButtonPlacementTypes.CENTER,
rows: 4,
columns: 16,
widgetName: "Button",
isDisabled: false,
isVisible: true,
isDefaultClickDisabled: true,
disabledWhenInvalid: false,
resetFormOnClick: false,
recaptchaType: RecaptchaTypes.V3,
version: 1,
responsiveBehavior: ResponsiveBehavior.Hug,
minWidth: BUTTON_MIN_WIDTH,
},
properties: {
derived: Widget.getDerivedPropertiesMap(),
default: Widget.getDefaultPropertiesMap(),
meta: Widget.getMetaPropertiesMap(),
config: Widget.getPropertyPaneConfig(),
contentConfig: Widget.getPropertyPaneContentConfig(),
styleConfig: Widget.getPropertyPaneStyleConfig(),
stylesheetConfig: Widget.getStylesheetConfig(),
autocompleteDefinitions: Widget.getAutocompleteDefinitions(),
},
autoLayout: {
defaults: {
rows: 4,
columns: 6.453,
},
autoDimension: {
width: true,
},
widgetSize: [
{
viewportMinWidth: 0,
configuration: () => {
return {
minWidth: "120px",
maxWidth: "360px",
};
},
},
],
disableResizeHandles: {
horizontal: true,
vertical: true,
},
},
};
export default Widget;