PromucFlow_constructor/app/client/src/widgets/NumberSliderWidget/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

79 lines
1.9 KiB
TypeScript

import { Alignment } from "@blueprintjs/core";
import { LabelPosition } from "components/constants";
import { ResponsiveBehavior } from "utils/autoLayout/constants";
import IconSVG from "./icon.svg";
import Widget from "./widget";
export const CONFIG = {
type: Widget.getWidgetType(),
name: "Number Slider",
needsMeta: true,
searchTags: ["range"],
iconSVG: IconSVG,
defaults: {
min: 0,
max: 100,
step: 1,
defaultValue: 10,
showMarksLabel: true,
marks: [
{ value: 25, label: "25%" },
{ value: 50, label: "50%" },
{ value: 75, label: "75%" },
],
isVisible: true,
isDisabled: false,
tooltipAlwaysOn: false,
rows: 8,
columns: 40,
widgetName: "NumberSlider",
shouldScroll: false,
shouldTruncate: false,
version: 1,
animateLoading: true,
labelText: "Percentage",
labelPosition: LabelPosition.Top,
labelAlignment: Alignment.LEFT,
labelWidth: 8,
labelTextSize: "0.875rem",
sliderSize: "m",
responsiveBehavior: ResponsiveBehavior.Fill,
},
properties: {
derived: Widget.getDerivedPropertiesMap(),
default: Widget.getDefaultPropertiesMap(),
meta: Widget.getMetaPropertiesMap(),
contentConfig: Widget.getPropertyPaneContentConfig(),
styleConfig: Widget.getPropertyPaneStyleConfig(),
stylesheetConfig: Widget.getStylesheetConfig(),
autocompleteDefinitions: Widget.getAutocompleteDefinitions(),
},
autoLayout: {
disabledPropsDefaults: {
labelPosition: LabelPosition.Top,
labelTextSize: "0.875rem",
},
defaults: {
rows: 7,
columns: 40,
},
widgetSize: [
{
viewportMinWidth: 0,
configuration: () => {
return {
minWidth: "180px",
minHeight: "70px",
};
},
},
],
disableResizeHandles: {
vertical: true,
},
},
};
export default Widget;