chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
|
|
|
import type { SupportedLayouts } from "reducers/entityReducers/pageListReducer";
|
|
|
|
|
import type { WidgetType as FactoryWidgetType } from "utils/WidgetFactory";
|
2022-05-04 09:45:57 +00:00
|
|
|
import { THEMEING_TEXT_SIZES } from "./ThemeConstants";
|
2023-07-22 05:57:18 +00:00
|
|
|
import type { WidgetCardProps } from "widgets/BaseWidget";
|
2021-09-09 15:10:22 +00:00
|
|
|
export type WidgetType = FactoryWidgetType;
|
2021-03-11 02:21:48 +00:00
|
|
|
|
2021-09-09 15:10:22 +00:00
|
|
|
export const SKELETON_WIDGET_TYPE = "SKELETON_WIDGET";
|
2019-08-26 12:41:21 +00:00
|
|
|
|
2019-09-09 09:08:54 +00:00
|
|
|
export type ContainerOrientation = "HORIZONTAL" | "VERTICAL";
|
2019-11-13 07:00:25 +00:00
|
|
|
|
|
|
|
|
export const PositionTypes: { [id: string]: string } = {
|
|
|
|
|
ABSOLUTE: "ABSOLUTE",
|
2020-03-06 09:45:21 +00:00
|
|
|
CONTAINER_DIRECTION: "CONTAINER_DIRECTION",
|
2019-11-13 07:00:25 +00:00
|
|
|
};
|
chore: upgrade to prettier v2 + enforce import types (#21013)Co-authored-by: Satish Gandham <hello@satishgandham.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
## Description
This PR upgrades Prettier to v2 + enforces TypeScript’s [`import
type`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
syntax where applicable. It’s submitted as a separate PR so we can merge
it easily.
As a part of this PR, we reformat the codebase heavily:
- add `import type` everywhere where it’s required, and
- re-format the code to account for Prettier 2’s breaking changes:
https://prettier.io/blog/2020/03/21/2.0.0.html#breaking-changes
This PR is submitted against `release` to make sure all new code by team
members will adhere to new formatting standards, and we’ll have fewer
conflicts when merging `bundle-optimizations` into `release`. (I’ll
merge `release` back into `bundle-optimizations` once this PR is
merged.)
### Why is this needed?
This PR is needed because, for the Lodash optimization from
https://github.com/appsmithorg/appsmith/commit/7cbb12af886621256224be0c93e6a465dd710ad3,
we need to use `import type`. Otherwise, `babel-plugin-lodash` complains
that `LoDashStatic` is not a lodash function.
However, just using `import type` in the current codebase will give you
this:
<img width="962" alt="Screenshot 2023-03-08 at 17 45 59"
src="https://user-images.githubusercontent.com/2953267/223775744-407afa0c-e8b9-44a1-90f9-b879348da57f.png">
That’s because Prettier 1 can’t parse `import type` at all. To parse it,
we need to upgrade to Prettier 2.
### Why enforce `import type`?
Apart from just enabling `import type` support, this PR enforces
specifying `import type` everywhere it’s needed. (Developers will get
immediate TypeScript and ESLint errors when they forget to do so.)
I’m doing this because I believe `import type` improves DX and makes
refactorings easier.
Let’s say you had a few imports like below. Can you tell which of these
imports will increase the bundle size? (Tip: it’s not all of them!)
```ts
// app/client/src/workers/Linting/utils.ts
import { Position } from "codemirror";
import { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
It’s pretty hard, right?
What about now?
```ts
// app/client/src/workers/Linting/utils.ts
import type { Position } from "codemirror";
import type { LintError as JSHintError, LintOptions } from "jshint";
import { get, isEmpty, isNumber, keys, last, set } from "lodash";
```
Now, it’s clear that only `lodash` will be bundled.
This helps developers to see which imports are problematic, but it
_also_ helps with refactorings. Now, if you want to see where
`codemirror` is bundled, you can just grep for `import \{.*\} from
"codemirror"` – and you won’t get any type-only imports.
This also helps (some) bundlers. Upon transpiling, TypeScript erases
type-only imports completely. In some environment (not ours), this makes
the bundle smaller, as the bundler doesn’t need to bundle type-only
imports anymore.
## Type of change
- Chore (housekeeping or task changes that don't impact user perception)
## How Has This Been Tested?
This was tested to not break the build.
### Test Plan
> Add Testsmith test cases links that relate to this PR
### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
## Checklist:
### Dev activity
- [x] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag
### QA activity:
- [ ] Test plan has been approved by relevant developers
- [ ] Test plan has been peer reviewed by QA
- [ ] Cypress test cases have been added and approved by either SDET or
manual QA
- [ ] Organized project review call with relevant stakeholders after
Round 1/2 of QA
- [ ] Added Test Plan Approved label after reveiwing all Cypress test
---------
Co-authored-by: Satish Gandham <hello@satishgandham.com>
Co-authored-by: Satish Gandham <satish.iitg@gmail.com>
2023-03-16 11:41:47 +00:00
|
|
|
export type PositionType = (typeof PositionTypes)[keyof typeof PositionTypes];
|
2019-11-13 07:00:25 +00:00
|
|
|
|
2019-03-13 15:05:24 +00:00
|
|
|
export type CSSUnit =
|
2019-03-16 13:08:45 +00:00
|
|
|
| "px"
|
|
|
|
|
| "cm"
|
|
|
|
|
| "mm"
|
|
|
|
|
| "in"
|
|
|
|
|
| "pt"
|
|
|
|
|
| "pc"
|
|
|
|
|
| "em"
|
|
|
|
|
| "ex"
|
|
|
|
|
| "ch"
|
|
|
|
|
| "rem"
|
|
|
|
|
| "vw"
|
|
|
|
|
| "vh"
|
|
|
|
|
| "vmin"
|
|
|
|
|
| "vmax"
|
2019-09-09 09:08:54 +00:00
|
|
|
| "%";
|
2019-02-11 18:22:23 +00:00
|
|
|
|
2019-03-21 12:10:32 +00:00
|
|
|
export type RenderMode =
|
|
|
|
|
| "COMPONENT_PANE"
|
|
|
|
|
| "CANVAS"
|
|
|
|
|
| "PAGE"
|
2022-11-27 17:12:00 +00:00
|
|
|
| "CANVAS_SELECTED";
|
2019-03-18 15:10:30 +00:00
|
|
|
|
2023-02-14 16:07:31 +00:00
|
|
|
export enum RenderModes {
|
|
|
|
|
COMPONENT_PANE = "COMPONENT_PANE",
|
|
|
|
|
CANVAS = "CANVAS",
|
|
|
|
|
PAGE = "PAGE",
|
|
|
|
|
CANVAS_SELECTED = "CANVAS_SELECTED",
|
|
|
|
|
}
|
2019-03-18 15:10:30 +00:00
|
|
|
|
2019-02-11 18:22:23 +00:00
|
|
|
export const CSSUnits: { [id: string]: CSSUnit } = {
|
2019-03-16 13:08:45 +00:00
|
|
|
PIXEL: "px",
|
2019-08-29 11:22:09 +00:00
|
|
|
RELATIVE_FONTSIZE: "rem",
|
2019-09-09 09:08:54 +00:00
|
|
|
RELATIVE_PARENT: "%",
|
|
|
|
|
};
|
2019-09-22 20:25:05 +00:00
|
|
|
|
2021-11-23 08:01:46 +00:00
|
|
|
export interface LayoutConfig {
|
2021-03-11 02:21:48 +00:00
|
|
|
minWidth: number;
|
|
|
|
|
maxWidth: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type LayoutConfigurations = Record<SupportedLayouts, LayoutConfig>;
|
2021-11-23 08:01:46 +00:00
|
|
|
export const DefaultLayoutType: SupportedLayouts = "FLUID";
|
2021-03-11 02:21:48 +00:00
|
|
|
export const layoutConfigurations: LayoutConfigurations = {
|
|
|
|
|
TABLET_LARGE: {
|
|
|
|
|
minWidth: 960,
|
|
|
|
|
maxWidth: 1080,
|
|
|
|
|
},
|
|
|
|
|
MOBILE: {
|
|
|
|
|
minWidth: 350,
|
|
|
|
|
maxWidth: 450,
|
|
|
|
|
},
|
|
|
|
|
DESKTOP: { minWidth: 1160, maxWidth: 1280 },
|
|
|
|
|
TABLET: { minWidth: 650, maxWidth: 800 },
|
|
|
|
|
FLUID: { minWidth: -1, maxWidth: -1 },
|
|
|
|
|
};
|
|
|
|
|
|
2023-06-01 17:26:05 +00:00
|
|
|
export const LATEST_PAGE_VERSION = 80;
|
2021-05-18 18:29:39 +00:00
|
|
|
|
2019-09-22 20:25:05 +00:00
|
|
|
export const GridDefaults = {
|
|
|
|
|
DEFAULT_CELL_SIZE: 1,
|
|
|
|
|
DEFAULT_WIDGET_WIDTH: 200,
|
|
|
|
|
DEFAULT_WIDGET_HEIGHT: 100,
|
2021-05-18 18:29:39 +00:00
|
|
|
DEFAULT_GRID_COLUMNS: 64,
|
|
|
|
|
DEFAULT_GRID_ROW_HEIGHT: 10,
|
2020-03-27 09:02:11 +00:00
|
|
|
CANVAS_EXTENSION_OFFSET: 2,
|
2022-09-30 08:19:52 +00:00
|
|
|
VIEW_MODE_MAIN_CANVAS_EXTENSION_OFFSET: 5,
|
|
|
|
|
MAIN_CANVAS_EXTENSION_OFFSET: 8,
|
2019-09-22 20:25:05 +00:00
|
|
|
};
|
2020-01-02 11:04:36 +00:00
|
|
|
|
2022-11-23 09:48:23 +00:00
|
|
|
export const CANVAS_MIN_HEIGHT = 380;
|
|
|
|
|
|
2023-04-07 13:51:35 +00:00
|
|
|
export const DefaultDimensionMap = {
|
|
|
|
|
leftColumn: "leftColumn",
|
|
|
|
|
rightColumn: "rightColumn",
|
|
|
|
|
topRow: "topRow",
|
|
|
|
|
bottomRow: "bottomRow",
|
|
|
|
|
};
|
|
|
|
|
|
2021-06-17 13:26:54 +00:00
|
|
|
// Note: Widget Padding + Container Padding === DEFAULT_GRID_ROW_HEIGHT to gracefully lose one row when a container is used,
|
2021-09-09 15:10:22 +00:00
|
|
|
// which wud allow the user to place elements centered inside a container(columns are rendered proportionally so it take cares of itself).
|
2021-06-17 13:26:54 +00:00
|
|
|
|
2020-01-16 11:46:21 +00:00
|
|
|
export const CONTAINER_GRID_PADDING =
|
2021-06-17 13:26:54 +00:00
|
|
|
GridDefaults.DEFAULT_GRID_ROW_HEIGHT * 0.6;
|
2020-01-16 11:46:21 +00:00
|
|
|
|
2023-04-26 17:39:11 +00:00
|
|
|
/**
|
|
|
|
|
* Padding introduced by container-like widgets in AutoLayout mode.
|
|
|
|
|
* FlexComponent - margin: 2px (2 * 2 = 4px) [Deploy mode = 4px ( 4 * 2 = 8px)]
|
|
|
|
|
* ResizeWrapper - padding: 1px, border: 1px (2 * 2 = 4px) [Deploy mode = 0px]
|
|
|
|
|
* ContainerComponent - border: 1px (1 * 2 = 2px) [Deploy mode = 2px]
|
|
|
|
|
* Total - 5px (5 * 2 = 10px)
|
|
|
|
|
*/
|
|
|
|
|
export const AUTO_LAYOUT_CONTAINER_PADDING = 5;
|
|
|
|
|
|
2021-05-18 18:29:39 +00:00
|
|
|
export const WIDGET_PADDING = GridDefaults.DEFAULT_GRID_ROW_HEIGHT * 0.4;
|
2020-01-16 11:46:21 +00:00
|
|
|
|
2020-01-02 11:04:36 +00:00
|
|
|
export const WIDGET_CLASSNAME_PREFIX = "WIDGET_";
|
2020-01-16 11:46:21 +00:00
|
|
|
export const MAIN_CONTAINER_WIDGET_ID = "0";
|
|
|
|
|
export const MAIN_CONTAINER_WIDGET_NAME = "MainContainer";
|
2021-08-03 06:38:01 +00:00
|
|
|
export const MODAL_PORTAL_CLASSNAME = "bp3-modal-widget";
|
2022-12-14 08:13:43 +00:00
|
|
|
export const MODAL_PORTAL_OVERLAY_CLASSNAME = "bp3-overlay-zindex";
|
2022-06-09 08:56:31 +00:00
|
|
|
export const CANVAS_SELECTOR = "canvas";
|
2020-09-16 10:28:01 +00:00
|
|
|
|
2021-01-19 07:29:15 +00:00
|
|
|
export const DEFAULT_CENTER = { lat: -34.397, lng: 150.644 };
|
2021-04-01 08:30:33 +00:00
|
|
|
|
|
|
|
|
export enum FontStyleTypes {
|
|
|
|
|
BOLD = "BOLD",
|
|
|
|
|
ITALIC = "ITALIC",
|
|
|
|
|
REGULAR = "REGULAR",
|
|
|
|
|
UNDERLINE = "UNDERLINE",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export enum TextSizes {
|
|
|
|
|
HEADING1 = "HEADING1",
|
|
|
|
|
HEADING2 = "HEADING2",
|
|
|
|
|
HEADING3 = "HEADING3",
|
|
|
|
|
PARAGRAPH = "PARAGRAPH",
|
|
|
|
|
PARAGRAPH2 = "PARAGRAPH2",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const TEXT_SIZES = {
|
|
|
|
|
HEADING1: "24px",
|
|
|
|
|
HEADING2: "18px",
|
|
|
|
|
HEADING3: "16px",
|
|
|
|
|
PARAGRAPH: "14px",
|
|
|
|
|
PARAGRAPH2: "12px",
|
|
|
|
|
};
|
|
|
|
|
|
2021-09-09 15:10:22 +00:00
|
|
|
export const WIDGET_STATIC_PROPS = {
|
|
|
|
|
leftColumn: true,
|
|
|
|
|
rightColumn: true,
|
|
|
|
|
topRow: true,
|
|
|
|
|
bottomRow: true,
|
2023-04-07 13:51:35 +00:00
|
|
|
mobileTopRow: true,
|
|
|
|
|
mobileBottomRow: true,
|
|
|
|
|
mobileLeftColumn: true,
|
|
|
|
|
mobileRightColumn: true,
|
2021-09-09 15:10:22 +00:00
|
|
|
minHeight: true,
|
|
|
|
|
parentColumnSpace: true,
|
|
|
|
|
parentRowSpace: true,
|
|
|
|
|
children: true,
|
|
|
|
|
type: true,
|
|
|
|
|
widgetId: true,
|
|
|
|
|
widgetName: true,
|
|
|
|
|
parentId: true,
|
|
|
|
|
renderMode: true,
|
|
|
|
|
detachFromLayout: true,
|
|
|
|
|
noContainerOffset: false,
|
2022-11-23 09:48:23 +00:00
|
|
|
height: false,
|
feat: Non auto height invisible widgets (#20118)
## Description
This PR adds another feature update we had planned for Auto Height
- [ ] For new applications, in View and Preview mode, any widget which
is invisible will let go of its space and collapse if it's either on the
main Canvas or a container-like widget which has Auto-height enabled.
- [ ] Widgets within a container-like Widget, say Tabs, that doesn't
have Auto-height enabled, will now let go of their space if they're
invisible.
- [ ] The experience in Edit mode has not changed.
TL;DR: In new applications, in the Preview and Published _AKA_ View
modes, if a widget is invisible and within an Auto-height-enabled
container like a Tab, a Modal, a Form, or the main Canvas, it will fully
collapse, allowing widgets below it to move up and take its space. This
changes the behavior today prior to the release of this PR for
Auto-height-enabled widgets.
Fixes #19983
Fixes #18681
2023-02-14 13:36:19 +00:00
|
|
|
topRowBeforeCollapse: false,
|
|
|
|
|
bottomRowBeforeCollapse: false,
|
2021-07-02 09:55:50 +00:00
|
|
|
};
|
|
|
|
|
|
2022-08-19 10:10:36 +00:00
|
|
|
export const WIDGET_DSL_STRUCTURE_PROPS = {
|
2023-02-14 16:07:31 +00:00
|
|
|
bottomRow: true,
|
2022-08-19 10:10:36 +00:00
|
|
|
children: true,
|
2023-02-14 16:07:31 +00:00
|
|
|
requiresFlatWidgetChildren: true,
|
|
|
|
|
hasMetaWidgets: true,
|
2023-03-20 08:06:28 +00:00
|
|
|
isMetaWidget: true,
|
2022-08-19 10:10:36 +00:00
|
|
|
parentId: true,
|
2023-02-14 16:07:31 +00:00
|
|
|
referencedWidgetId: true,
|
2022-08-19 10:10:36 +00:00
|
|
|
topRow: true,
|
2023-02-14 16:07:31 +00:00
|
|
|
type: true,
|
|
|
|
|
widgetId: true,
|
2022-08-19 10:10:36 +00:00
|
|
|
};
|
|
|
|
|
|
2021-09-09 15:10:22 +00:00
|
|
|
export type TextSize = keyof typeof TextSizes;
|
2022-05-04 09:45:57 +00:00
|
|
|
|
|
|
|
|
export const DEFAULT_FONT_SIZE = THEMEING_TEXT_SIZES.base;
|
2022-11-23 09:48:23 +00:00
|
|
|
|
|
|
|
|
// The max and min height limits for widgets in rows.
|
|
|
|
|
// 9000 is an arbitrarily large value for the height of a widget
|
|
|
|
|
// In pixels this would be 90000px, which is a fairly large number.
|
|
|
|
|
|
|
|
|
|
// 4 is the minimum for any widget, as we donot support zero height widgets today.
|
|
|
|
|
// This also makes sure that widgets have sufficient area in which users can interact.
|
|
|
|
|
export const WidgetHeightLimits = {
|
|
|
|
|
MAX_HEIGHT_IN_ROWS: 9000,
|
|
|
|
|
MIN_HEIGHT_IN_ROWS: 4,
|
2022-11-24 18:40:06 +00:00
|
|
|
MIN_CANVAS_HEIGHT_IN_ROWS: 10,
|
2022-11-23 09:48:23 +00:00
|
|
|
};
|
2022-12-02 12:45:11 +00:00
|
|
|
|
|
|
|
|
export const WIDGET_PROPS_TO_SKIP_FROM_EVAL = {
|
|
|
|
|
children: true,
|
|
|
|
|
parentId: true,
|
|
|
|
|
renderMode: true,
|
|
|
|
|
detachFromLayout: true,
|
|
|
|
|
noContainerOffset: false,
|
|
|
|
|
hideCard: true,
|
|
|
|
|
isDeprecated: true,
|
|
|
|
|
searchTags: true,
|
|
|
|
|
iconSVG: true,
|
|
|
|
|
version: true,
|
|
|
|
|
displayName: true,
|
feat: Non auto height invisible widgets (#20118)
## Description
This PR adds another feature update we had planned for Auto Height
- [ ] For new applications, in View and Preview mode, any widget which
is invisible will let go of its space and collapse if it's either on the
main Canvas or a container-like widget which has Auto-height enabled.
- [ ] Widgets within a container-like Widget, say Tabs, that doesn't
have Auto-height enabled, will now let go of their space if they're
invisible.
- [ ] The experience in Edit mode has not changed.
TL;DR: In new applications, in the Preview and Published _AKA_ View
modes, if a widget is invisible and within an Auto-height-enabled
container like a Tab, a Modal, a Form, or the main Canvas, it will fully
collapse, allowing widgets below it to move up and take its space. This
changes the behavior today prior to the release of this PR for
Auto-height-enabled widgets.
Fixes #19983
Fixes #18681
2023-02-14 13:36:19 +00:00
|
|
|
topRowBeforeCollapse: false,
|
|
|
|
|
bottomRowBeforeCollapse: false,
|
2023-07-22 05:57:18 +00:00
|
|
|
tags: false,
|
2022-12-02 12:45:11 +00:00
|
|
|
};
|
2023-03-04 07:25:54 +00:00
|
|
|
|
2023-04-07 13:51:35 +00:00
|
|
|
/**
|
|
|
|
|
* This is the padding that is applied to the flexbox container.
|
|
|
|
|
* It is also used to calculate widget positions and highlight placements.
|
|
|
|
|
*/
|
2023-03-04 07:25:54 +00:00
|
|
|
export const FLEXBOX_PADDING = 4;
|
2023-04-27 03:33:32 +00:00
|
|
|
|
2023-05-03 04:26:52 +00:00
|
|
|
/**
|
|
|
|
|
* max width of modal widget constant as a multiplier of Main canvasWidth
|
|
|
|
|
*/
|
|
|
|
|
export const MAX_MODAL_WIDTH_FROM_MAIN_WIDTH = 0.95;
|
|
|
|
|
|
2023-04-27 03:33:32 +00:00
|
|
|
export const FILE_SIZE_LIMIT_FOR_BLOBS = 5000 * 1024; // 5MB
|
2023-07-22 05:57:18 +00:00
|
|
|
|
|
|
|
|
export const WIDGET_TAGS = {
|
|
|
|
|
SUGGESTED_WIDGETS: "Suggested",
|
|
|
|
|
INPUTS: "Inputs",
|
|
|
|
|
BUTTONS: "Buttons",
|
|
|
|
|
SELECT: "Select",
|
|
|
|
|
DISPLAY: "Display",
|
|
|
|
|
LAYOUT: "Layout",
|
|
|
|
|
MEDIA: "Media",
|
|
|
|
|
TOGGLES: "Toggles",
|
|
|
|
|
SLIDERS: "Sliders",
|
|
|
|
|
CONTENT: "Content",
|
|
|
|
|
EXTERNAL: "External",
|
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
|
|
export type WidgetTags = (typeof WIDGET_TAGS)[keyof typeof WIDGET_TAGS];
|
|
|
|
|
|
|
|
|
|
export type WidgetCardsGroupedByTags = Record<WidgetTags, WidgetCardProps[]>;
|
|
|
|
|
|
|
|
|
|
export const SUGGESTED_WIDGETS_ORDER: Record<WidgetType, number> = {
|
|
|
|
|
TABLE_WIDGET_V2: 1,
|
|
|
|
|
JSON_FORM_WIDGET: 2,
|
|
|
|
|
INPUT_WIDGET_V2: 3,
|
|
|
|
|
TEXT_WIDGET: 4,
|
|
|
|
|
SELECT_WIDGET: 5,
|
|
|
|
|
LIST_WIDGET_V2: 6,
|
|
|
|
|
};
|