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.
82 lines
2.2 KiB
TypeScript
82 lines
2.2 KiB
TypeScript
import { Alignment } from "@blueprintjs/core";
|
|
import { LabelPosition } from "components/constants";
|
|
import { FILL_WIDGET_MIN_WIDTH } from "constants/minWidthConstants";
|
|
import moment from "moment";
|
|
import { ResponsiveBehavior } from "utils/autoLayout/constants";
|
|
import { DynamicHeight } from "utils/WidgetFeatures";
|
|
|
|
import { TimePrecision } from "./constants";
|
|
import IconSVG from "./icon.svg";
|
|
import Widget from "./widget";
|
|
|
|
export const CONFIG = {
|
|
features: {
|
|
dynamicHeight: {
|
|
sectionIndex: 3,
|
|
defaultValue: DynamicHeight.FIXED,
|
|
active: true,
|
|
},
|
|
},
|
|
type: Widget.getWidgetType(),
|
|
name: "DatePicker",
|
|
iconSVG: IconSVG,
|
|
needsMeta: true,
|
|
searchTags: ["calendar"],
|
|
defaults: {
|
|
isDisabled: false,
|
|
datePickerType: "DATE_PICKER",
|
|
rows: 7,
|
|
label: "Label",
|
|
labelPosition: LabelPosition.Top,
|
|
labelAlignment: Alignment.LEFT,
|
|
labelWidth: 5,
|
|
labelTextSize: "0.875rem",
|
|
dateFormat: "YYYY-MM-DD HH:mm",
|
|
columns: 20,
|
|
widgetName: "DatePicker",
|
|
defaultDate: moment().toISOString(),
|
|
minDate: "1920-12-31T18:30:00.000Z",
|
|
maxDate: "2121-12-31T18:29:00.000Z",
|
|
version: 2,
|
|
isRequired: false,
|
|
closeOnSelection: true,
|
|
shortcuts: false,
|
|
firstDayOfWeek: 0,
|
|
timePrecision: TimePrecision.MINUTE,
|
|
animateLoading: true,
|
|
responsiveBehavior: ResponsiveBehavior.Fill,
|
|
minWidth: FILL_WIDGET_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: {
|
|
disabledPropsDefaults: {
|
|
labelPosition: LabelPosition.Top,
|
|
labelTextSize: "0.875rem",
|
|
},
|
|
widgetSize: [
|
|
{
|
|
viewportMinWidth: 0,
|
|
configuration: () => {
|
|
return {
|
|
minWidth: "120px",
|
|
};
|
|
},
|
|
},
|
|
],
|
|
disableResizeHandles: {
|
|
vertical: true,
|
|
},
|
|
},
|
|
};
|
|
|
|
export default Widget;
|