2019-11-13 07:00:25 +00:00
|
|
|
/**
|
2019-02-10 13:06:05 +00:00
|
|
|
* Widget are responsible for accepting the abstraction layer inputs, interpretting them into rederable props and
|
|
|
|
|
* spawing components based on those props
|
|
|
|
|
* Widgets are also responsible for dispatching actions and updating the state tree
|
|
|
|
|
*/
|
2023-03-04 07:25:54 +00:00
|
|
|
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";
|
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 { BatchPropertyUpdatePayload } from "actions/controlActions";
|
2023-03-04 07:25:54 +00:00
|
|
|
import AutoHeightContainerWrapper from "components/autoHeight/AutoHeightContainerWrapper";
|
|
|
|
|
import AutoHeightOverlayContainer from "components/autoHeightOverlay";
|
|
|
|
|
import FlexComponent from "components/designSystems/appsmith/autoLayout/FlexComponent";
|
|
|
|
|
import PositionedContainer from "components/designSystems/appsmith/PositionedContainer";
|
|
|
|
|
import DraggableComponent from "components/editorComponents/DraggableComponent";
|
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 { EditorContextType } from "components/editorComponents/EditorContextProvider";
|
|
|
|
|
import { EditorContext } from "components/editorComponents/EditorContextProvider";
|
2023-03-04 07:25:54 +00:00
|
|
|
import ErrorBoundary from "components/editorComponents/ErrorBoundry";
|
|
|
|
|
import ResizableComponent from "components/editorComponents/ResizableComponent";
|
|
|
|
|
import SnipeableComponent from "components/editorComponents/SnipeableComponent";
|
|
|
|
|
import WidgetNameComponent from "components/editorComponents/WidgetNameComponent";
|
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 { ExecuteTriggerPayload } from "constants/AppsmithActionConstants/ActionConstants";
|
|
|
|
|
import type { PropertyPaneConfig } from "constants/PropertyControlConstants";
|
|
|
|
|
import type {
|
2021-06-21 11:09:51 +00:00
|
|
|
CSSUnit,
|
|
|
|
|
PositionType,
|
2019-03-18 15:10:30 +00:00
|
|
|
RenderMode,
|
2021-06-21 11:09:51 +00:00
|
|
|
WidgetType,
|
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
|
|
|
} from "constants/WidgetConstants";
|
2023-04-07 13:51:35 +00:00
|
|
|
import { FLEXBOX_PADDING } from "constants/WidgetConstants";
|
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 {
|
|
|
|
|
GridDefaults,
|
|
|
|
|
RenderModes,
|
2022-11-23 09:48:23 +00:00
|
|
|
WIDGET_PADDING,
|
2019-11-25 05:07:27 +00:00
|
|
|
} from "constants/WidgetConstants";
|
2023-03-04 07:25:54 +00:00
|
|
|
import { ENTITY_TYPE } from "entities/AppsmithConsole";
|
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 { Stylesheet } from "entities/AppTheming";
|
2023-04-07 13:51:35 +00:00
|
|
|
import { get, isFunction, memoize } from "lodash";
|
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 { Context, ReactNode, RefObject } from "react";
|
|
|
|
|
import React, { Component } from "react";
|
|
|
|
|
import type {
|
2023-03-04 07:25:54 +00:00
|
|
|
ModifyMetaWidgetPayload,
|
|
|
|
|
UpdateMetaWidgetPropertyPayload,
|
|
|
|
|
} from "reducers/entityReducers/metaWidgetsReducer";
|
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 { AppPositioningTypes } from "reducers/entityReducers/pageListReducer";
|
|
|
|
|
import type { SelectionRequestType } from "sagas/WidgetSelectUtils";
|
2019-11-04 14:22:50 +00:00
|
|
|
import shallowequal from "shallowequal";
|
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 { CSSProperties } from "styled-components";
|
2023-03-04 07:25:54 +00:00
|
|
|
import AnalyticsUtil from "utils/AnalyticsUtil";
|
|
|
|
|
import AppsmithConsole from "utils/AppsmithConsole";
|
2023-04-07 13:51:35 +00:00
|
|
|
import { ResponsiveBehavior } from "utils/autoLayout/constants";
|
|
|
|
|
import {
|
|
|
|
|
FlexVerticalAlignment,
|
2023-03-04 07:25:54 +00:00
|
|
|
LayoutDirection,
|
|
|
|
|
} from "utils/autoLayout/constants";
|
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 {
|
2021-06-21 11:09:51 +00:00
|
|
|
DataTreeEvaluationProps,
|
|
|
|
|
EvaluationError,
|
2020-11-12 11:23:32 +00:00
|
|
|
WidgetDynamicPathListProps,
|
2021-06-21 11:09:51 +00:00
|
|
|
} from "utils/DynamicBindingUtils";
|
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 { EVAL_ERROR_PATH } from "utils/DynamicBindingUtils";
|
|
|
|
|
import type { DerivedPropertiesMap } from "utils/WidgetFactory";
|
|
|
|
|
import type { CanvasWidgetStructure, FlattenedWidgetProps } from "./constants";
|
2023-03-04 07:25:54 +00:00
|
|
|
import Skeleton from "./Skeleton";
|
2022-11-23 09:48:23 +00:00
|
|
|
import {
|
|
|
|
|
getWidgetMaxAutoHeight,
|
|
|
|
|
getWidgetMinAutoHeight,
|
|
|
|
|
isAutoHeightEnabledForWidget,
|
2023-04-03 06:11:10 +00:00
|
|
|
isAutoHeightEnabledForWidgetWithLimits,
|
2022-11-23 09:48:23 +00:00
|
|
|
shouldUpdateWidgetHeightAutomatically,
|
|
|
|
|
} from "./WidgetUtils";
|
2023-04-07 13:51:35 +00:00
|
|
|
import AutoLayoutDimensionObserver from "components/designSystems/appsmith/autoLayout/AutoLayoutDimensionObeserver";
|
|
|
|
|
import WidgetFactory from "utils/WidgetFactory";
|
2023-03-20 11:04:02 +00:00
|
|
|
import type { WidgetEntity } from "entities/DataTree/dataTreeFactory";
|
2023-04-14 13:55:44 +00:00
|
|
|
import WidgetComponentBoundary from "components/editorComponents/WidgetComponentBoundary";
|
2023-04-14 06:27:49 +00:00
|
|
|
import type { AutocompletionDefinitions } from "./constants";
|
2020-03-06 09:45:21 +00:00
|
|
|
|
2019-11-13 07:00:25 +00:00
|
|
|
/***
|
|
|
|
|
* BaseWidget
|
|
|
|
|
*
|
|
|
|
|
* The abstract class which is extended/implemented by all widgets.
|
|
|
|
|
* Widgets must adhere to the abstractions provided by BaseWidget.
|
|
|
|
|
*
|
|
|
|
|
* Do not:
|
|
|
|
|
* 1) Use the context directly in the widgets
|
|
|
|
|
* 2) Update or access the dsl in the widgets
|
|
|
|
|
* 3) Call actions in widgets or connect the widgets to the entity reducers
|
|
|
|
|
*
|
|
|
|
|
*/
|
Initialise comments (#3328)
* Initial scaffolding for comments CRUD APIs
* add actions
* add assets
* state management for existing comments and creating new
* add ui components
* add overlay comments wrapper to baseWidget
* add toggle comment mode button at editor header
* trigger tests
* Disallow commenting as someone else
* Add applicationId for comments
* lint
* Add overlay blacklist to prevent component interaction while adding comments
* Comment thread style updates
* Placeholder comment context menu
* Controlled comment thread visibility for making new comments visible by default
* Update comment type description
* Reset input on save
* Resolve comment thread button ui
* fix close on esc key, dont create new comment on outside click
* Submit on enter
* add emoji picker
* Attempt at adding a websocket server in Java
* CRUD APIs for comment threads
* Add API for getting all threads in application
* Move types to a separate file
* Initial commit for real time server (RTS)
* Add script to start RTS
* Fix position property
* Use create comment thread API
* Use add comment to thread API
* Add custom cursor
* Dispatch logout init on 401 errors
* Allow CORS for real time connection
* Add more logs to RTS
* Fix construction of MongoClient
* WIP: Real time comments
* Enable comments
* Minor updates
* Read backend API base URL from environment
* Escape to reset comments mode
* Set popover position as auto and boundary as scroll parent
* Disable warning
* Added permissions for comment threads
* Add resolved API for comment threads
* Migration to set commenting permission on existing apps
* Fix updates bringing the RTS down
* Show view latest button, scroll to bottom on creating a new comment
* Cleanup comment reducer
* Move to typescript for RTS
* Add missing server.ts and tsconfig files
* Resolve / unresolve comment
* Scaffold app comments
* Minor fixes: comment on top of all widgets, add toggle button at viewer header
* Reconnect socket on creating a new app, set connected status in store
* Retry socket connection flow
* Integration tests for comments with api mocks using msw
* Fix circular depependency
* rm file
* Minor cleanup and comments
* Minor refactors: move isScrolledToBottom to common hooks, decouple prevent interactions overlay from comments wrapper
* Use policies when pushing updates in RTS
* ENV var to set if comments are enabled
* Fix: check if editor/viewer is initialised before waiting for init action
* Add tests for comments reducer
* Revert "ENV var to set if comments are enabled"
This reverts commit 988efeaa69d378d943a387e1e73510334958adc5.
* Enable comments for users with appsmith email
* lint
* fix
* Try running a socket.io server inside backend
* Update comment reducer tests
* Init mentions within comments
* Fix comment thread updates with email rooms
* Minor fixes
* Refactors / review suggestions
* lint
* increase cache limit for builds
* Comment out tests for feature that's under development
* Add Dockerfile for RTS
* Fix policies missing for first comment in threads
* Use draftJS for comments input with mentions support
* fix fixtures
* Use thread's policies when querying for threads
* Update socket.io to v4
* Add support for richer body with mentions
* Update comment body type to RawDraftContentState
* fix stale method
* Fix mentions search
* Minor cleanups
* Comment context menu and thread UI updates
* revert: Scaffold app comments
* Yarn dependencies
* Delete comment using id api added
* Init app comments
* Add test for creating thread
* Api for delete comment with id
* Test comment creation response and policies
* Copy comment links
* Fix reset editor state
* Delete valid comment testcase added
* Delete comment TC : code refactor
* Don't allow creating comments with an empty body
* Pin comments WIP[]
* Ignore dependency-reduced-pom.xml files from VCS
* Cleanup of some dev-only files, for review
* Delete comment
* Update socket.io to v4 in RTS
* Pin and resolve comment thread object added in commentThread
* Pin and resolve comment thread object added in commentThread
* Update comment thread API
* Added creationTime and updationTime in comment thread response
* Added creationTime and updationTime in comment thread response
* Added human readable id to comment threads, fallback to username for null name in user document
* Refactor
* lint
* fix test, rm duplicate selector
* comment out saga used for dev
* CommentThread viewed status, username fallback for getName=null, username field added in pin & resolve status
* lint
* trigger tests
Co-authored-by: Shrikant Sharat Kandula <shrikant@appsmith.com>
Co-authored-by: Abhijeet <abhi.nagarnaik@gmail.com>
2021-04-29 10:33:51 +00:00
|
|
|
|
2023-02-14 16:07:31 +00:00
|
|
|
const REFERENCE_KEY = "$$refs$$";
|
|
|
|
|
|
2019-02-11 18:22:23 +00:00
|
|
|
abstract class BaseWidget<
|
2019-10-03 16:24:29 +00:00
|
|
|
T extends WidgetProps,
|
2023-02-14 16:07:31 +00:00
|
|
|
K extends WidgetState,
|
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
|
|
|
TCache = unknown,
|
2019-04-02 16:12:08 +00:00
|
|
|
> extends Component<T, K> {
|
2019-11-13 07:00:25 +00:00
|
|
|
static contextType = EditorContext;
|
2023-02-14 16:07:31 +00:00
|
|
|
context!: React.ContextType<Context<EditorContextType<TCache>>>;
|
2019-11-13 07:00:25 +00:00
|
|
|
|
2021-03-24 22:05:04 +00:00
|
|
|
static getPropertyPaneConfig(): PropertyPaneConfig[] {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
2019-11-19 12:44:58 +00:00
|
|
|
|
2022-09-29 05:24:49 +00:00
|
|
|
static getPropertyPaneContentConfig(): PropertyPaneConfig[] {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static getPropertyPaneStyleConfig(): PropertyPaneConfig[] {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-17 09:28:26 +00:00
|
|
|
static getDerivedPropertiesMap(): DerivedPropertiesMap {
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-18 07:42:57 +00:00
|
|
|
static getDefaultPropertiesMap(): Record<string, any> {
|
2020-04-17 16:15:09 +00:00
|
|
|
return {};
|
|
|
|
|
}
|
2023-01-28 02:17:06 +00:00
|
|
|
|
2021-01-04 10:16:08 +00:00
|
|
|
// TODO Find a way to enforce this, (dont let it be set)
|
2020-04-21 07:54:23 +00:00
|
|
|
static getMetaPropertiesMap(): Record<string, any> {
|
2020-04-17 16:15:09 +00:00
|
|
|
return {};
|
2020-02-18 10:41:52 +00:00
|
|
|
}
|
|
|
|
|
|
2022-11-28 04:44:31 +00:00
|
|
|
static getStylesheetConfig(): Stylesheet {
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 06:27:49 +00:00
|
|
|
static getAutocompleteDefinitions(): AutocompletionDefinitions {
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-13 05:40:08 +00:00
|
|
|
/**
|
|
|
|
|
* getLoadingProperties returns a list of regexp's used to specify bindingPaths,
|
|
|
|
|
* which can set the isLoading prop of the widget.
|
|
|
|
|
* When:
|
|
|
|
|
* 1. the path is bound to an action (API/Query)
|
|
|
|
|
* 2. the action is currently in-progress
|
|
|
|
|
*
|
|
|
|
|
* if undefined, all paths can set the isLoading state
|
|
|
|
|
* if empty array, no paths can set the isLoading state
|
|
|
|
|
*/
|
|
|
|
|
static getLoadingProperties(): Array<RegExp> | undefined {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-13 07:00:25 +00:00
|
|
|
/**
|
|
|
|
|
* Widget abstraction to register the widget type
|
|
|
|
|
* ```javascript
|
|
|
|
|
* getWidgetType() {
|
|
|
|
|
* return "MY_AWESOME_WIDGET",
|
|
|
|
|
* }
|
|
|
|
|
* ```
|
|
|
|
|
*/
|
2019-10-03 16:24:29 +00:00
|
|
|
|
2019-11-13 07:00:25 +00:00
|
|
|
/**
|
|
|
|
|
* Widgets can execute actions using this `executeAction` method.
|
|
|
|
|
* Triggers may be specific to the widget
|
|
|
|
|
*/
|
2021-09-15 05:11:13 +00:00
|
|
|
executeAction(actionPayload: ExecuteTriggerPayload): void {
|
2019-10-03 16:24:29 +00:00
|
|
|
const { executeAction } = this.context;
|
2021-09-15 05:11:13 +00:00
|
|
|
executeAction &&
|
|
|
|
|
executeAction({
|
|
|
|
|
...actionPayload,
|
|
|
|
|
source: {
|
|
|
|
|
id: this.props.widgetId,
|
|
|
|
|
name: this.props.widgetName,
|
|
|
|
|
},
|
|
|
|
|
});
|
2021-04-23 13:50:55 +00:00
|
|
|
|
|
|
|
|
actionPayload.triggerPropertyName &&
|
|
|
|
|
AppsmithConsole.info({
|
|
|
|
|
text: `${actionPayload.triggerPropertyName} triggered`,
|
|
|
|
|
source: {
|
|
|
|
|
type: ENTITY_TYPE.WIDGET,
|
|
|
|
|
id: this.props.widgetId,
|
|
|
|
|
name: this.props.widgetName,
|
|
|
|
|
},
|
|
|
|
|
});
|
2019-10-03 16:24:29 +00:00
|
|
|
}
|
|
|
|
|
|
2020-01-09 11:39:26 +00:00
|
|
|
disableDrag(disable: boolean) {
|
|
|
|
|
const { disableDrag } = this.context;
|
|
|
|
|
disableDrag && disable !== undefined && disableDrag(disable);
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-15 11:42:11 +00:00
|
|
|
updateWidget(
|
|
|
|
|
operationName: string,
|
|
|
|
|
widgetId: string,
|
|
|
|
|
widgetProperties: any,
|
|
|
|
|
): void {
|
|
|
|
|
const { updateWidget } = this.context;
|
|
|
|
|
updateWidget && updateWidget(operationName, widgetId, widgetProperties);
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-16 10:29:08 +00:00
|
|
|
deleteWidgetProperty(propertyPaths: string[]): void {
|
|
|
|
|
const { deleteWidgetProperty } = this.context;
|
|
|
|
|
const { widgetId } = this.props;
|
|
|
|
|
if (deleteWidgetProperty && widgetId) {
|
|
|
|
|
deleteWidgetProperty(widgetId, propertyPaths);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-21 07:55:56 +00:00
|
|
|
batchUpdateWidgetProperty(
|
|
|
|
|
updates: BatchPropertyUpdatePayload,
|
|
|
|
|
shouldReplay = true,
|
|
|
|
|
): void {
|
2021-02-16 10:29:08 +00:00
|
|
|
const { batchUpdateWidgetProperty } = this.context;
|
|
|
|
|
const { widgetId } = this.props;
|
|
|
|
|
if (batchUpdateWidgetProperty && widgetId) {
|
2021-09-21 07:55:56 +00:00
|
|
|
batchUpdateWidgetProperty(widgetId, updates, shouldReplay);
|
2021-02-16 10:29:08 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-11 10:13:06 +00:00
|
|
|
updateWidgetProperty(propertyName: string, propertyValue: any): void {
|
2021-03-09 05:30:57 +00:00
|
|
|
this.batchUpdateWidgetProperty({
|
|
|
|
|
modify: { [propertyName]: propertyValue },
|
|
|
|
|
});
|
2019-11-07 11:17:53 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-06 09:45:21 +00:00
|
|
|
resetChildrenMetaProperty(widgetId: string) {
|
|
|
|
|
const { resetChildrenMetaProperty } = this.context;
|
2022-05-25 09:46:14 +00:00
|
|
|
if (resetChildrenMetaProperty) resetChildrenMetaProperty(widgetId);
|
2020-03-06 09:45:21 +00:00
|
|
|
}
|
|
|
|
|
|
2022-11-23 09:48:23 +00:00
|
|
|
/*
|
|
|
|
|
This method calls the action to update widget height
|
|
|
|
|
We're not using `updateWidgetProperty`, because, the workflow differs
|
|
|
|
|
We will be computing properties of all widgets which are effected by
|
|
|
|
|
this change.
|
|
|
|
|
@param height number: Height of the widget's contents in pixels
|
|
|
|
|
@return void
|
|
|
|
|
|
|
|
|
|
TODO (abhinav): Make sure that this isn't called for scenarios which do not require it
|
|
|
|
|
This is for performance. We don't want unnecessary code to run
|
|
|
|
|
*/
|
|
|
|
|
updateAutoHeight = (height: number): void => {
|
|
|
|
|
const paddedHeight =
|
|
|
|
|
Math.ceil(
|
|
|
|
|
Math.ceil(height + WIDGET_PADDING * 2) /
|
|
|
|
|
GridDefaults.DEFAULT_GRID_ROW_HEIGHT,
|
|
|
|
|
) * GridDefaults.DEFAULT_GRID_ROW_HEIGHT;
|
|
|
|
|
|
|
|
|
|
const shouldUpdate = shouldUpdateWidgetHeightAutomatically(
|
|
|
|
|
paddedHeight,
|
|
|
|
|
this.props,
|
|
|
|
|
);
|
|
|
|
|
const { updateWidgetAutoHeight } = this.context;
|
|
|
|
|
|
|
|
|
|
if (updateWidgetAutoHeight) {
|
|
|
|
|
const { widgetId } = this.props;
|
|
|
|
|
shouldUpdate && updateWidgetAutoHeight(widgetId, paddedHeight);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2023-01-28 02:17:06 +00:00
|
|
|
selectWidgetRequest = (
|
|
|
|
|
selectionRequestType: SelectionRequestType,
|
|
|
|
|
payload?: string[],
|
|
|
|
|
) => {
|
|
|
|
|
const { selectWidgetRequest } = this.context;
|
|
|
|
|
if (selectWidgetRequest) {
|
|
|
|
|
selectWidgetRequest(selectionRequestType, payload);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
2023-01-28 02:17:06 +00:00
|
|
|
|
Feature/entity browse (#220)
# New Feature: Entity Explorer
- Entities are actions (apis and queries), datasources, pages, and widgets
- With this new feature, all entities in the application will be available
to view in the new entity explorer sidebar
- All existing application features from the api sidebar, query sidebar, datasource sidebar and pages sidebar
now are avialable on the entity explorer sidebar
- Users are now able to quickly switch to any entity in the application from the entity explorer sidebar.
- Users can also search all entities in the application from the new sidebar. Use cmd + f or ctrl + f to focus on the search input
- Users can rename entities from the new sidebar
- Users can also perform contextual actions on these entities like set a page as home page, copy/move actions, delete entity, etc from the context menu available alongside the entities in the sidebar
- Users can view the properties of the entities in the sidebar, as well as copy bindings to use in the application.
2020-08-10 08:52:45 +00:00
|
|
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
2023-02-14 16:07:31 +00:00
|
|
|
componentDidUpdate(prevProps: T, prevState?: K) {
|
2023-02-08 11:23:39 +00:00
|
|
|
if (
|
|
|
|
|
!this.props.deferRender &&
|
|
|
|
|
this.props.deferRender !== prevProps.deferRender
|
|
|
|
|
) {
|
|
|
|
|
this.deferredComponentDidRender();
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-27 09:02:11 +00:00
|
|
|
|
|
|
|
|
componentDidMount(): void {}
|
2023-01-28 02:17:06 +00:00
|
|
|
|
2023-02-08 11:23:39 +00:00
|
|
|
/*
|
|
|
|
|
* With lazy rendering, skeleton loaders are rendered for below fold widgets.
|
|
|
|
|
* This Appsmith widget life cycle method that gets called when the actual widget
|
|
|
|
|
* component renders instead of the skeleton loader.
|
|
|
|
|
*/
|
|
|
|
|
deferredComponentDidRender(): void {}
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
/* eslint-enable @typescript-eslint/no-empty-function */
|
|
|
|
|
|
2023-02-14 16:07:31 +00:00
|
|
|
modifyMetaWidgets = (modifications: ModifyMetaWidgetPayload) => {
|
|
|
|
|
this.context.modifyMetaWidgets?.({
|
|
|
|
|
...modifications,
|
|
|
|
|
creatorId: this.props.widgetId,
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
deleteMetaWidgets = () => {
|
|
|
|
|
this.context?.deleteMetaWidgets?.({
|
|
|
|
|
creatorIds: [this.props.widgetId],
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
setWidgetCache = (data: TCache) => {
|
|
|
|
|
const key = this.getWidgetCacheKey();
|
|
|
|
|
|
|
|
|
|
if (key) {
|
|
|
|
|
this.context?.setWidgetCache?.(key, data);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
updateMetaWidgetProperty = (payload: UpdateMetaWidgetPropertyPayload) => {
|
|
|
|
|
const { widgetId } = this.props;
|
|
|
|
|
|
|
|
|
|
this.context.updateMetaWidgetProperty?.({
|
|
|
|
|
...payload,
|
|
|
|
|
creatorId: widgetId,
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
getWidgetCache = () => {
|
|
|
|
|
const key = this.getWidgetCacheKey();
|
|
|
|
|
|
|
|
|
|
if (key) {
|
|
|
|
|
return this.context?.getWidgetCache?.(key);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
getWidgetCacheKey = () => {
|
|
|
|
|
return this.props.metaWidgetId || this.props.widgetId;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
setWidgetReferenceCache = <TRefCache,>(data: TRefCache) => {
|
|
|
|
|
const key = this.getWidgetCacheReferenceKey();
|
|
|
|
|
|
|
|
|
|
this.context?.setWidgetCache?.(`${key}.${REFERENCE_KEY}`, data);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
getWidgetReferenceCache = <TRefCache,>() => {
|
|
|
|
|
const key = this.getWidgetCacheReferenceKey();
|
|
|
|
|
|
|
|
|
|
return this.context?.getWidgetCache?.<TRefCache>(`${key}.${REFERENCE_KEY}`);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
getWidgetCacheReferenceKey = () => {
|
|
|
|
|
return this.props.referencedWidgetId || this.props.widgetId;
|
|
|
|
|
};
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
getComponentDimensions = () => {
|
|
|
|
|
return this.calculateWidgetBounds(
|
2019-03-19 14:47:18 +00:00
|
|
|
this.props.rightColumn,
|
|
|
|
|
this.props.leftColumn,
|
|
|
|
|
this.props.topRow,
|
|
|
|
|
this.props.bottomRow,
|
|
|
|
|
this.props.parentColumnSpace,
|
2019-09-09 09:08:54 +00:00
|
|
|
this.props.parentRowSpace,
|
2023-03-04 07:25:54 +00:00
|
|
|
this.props.mobileLeftColumn,
|
|
|
|
|
this.props.mobileRightColumn,
|
|
|
|
|
this.props.mobileTopRow,
|
|
|
|
|
this.props.mobileBottomRow,
|
|
|
|
|
this.props.isMobile,
|
|
|
|
|
this.props.isFlexChild,
|
2019-09-09 09:08:54 +00:00
|
|
|
);
|
2020-03-27 09:02:11 +00:00
|
|
|
};
|
2019-02-10 13:06:05 +00:00
|
|
|
|
2019-02-11 18:22:23 +00:00
|
|
|
calculateWidgetBounds(
|
|
|
|
|
rightColumn: number,
|
|
|
|
|
leftColumn: number,
|
|
|
|
|
topRow: number,
|
|
|
|
|
bottomRow: number,
|
|
|
|
|
parentColumnSpace: number,
|
2019-09-09 09:08:54 +00:00
|
|
|
parentRowSpace: number,
|
2023-03-04 07:25:54 +00:00
|
|
|
mobileLeftColumn?: number,
|
|
|
|
|
mobileRightColumn?: number,
|
|
|
|
|
mobileTopRow?: number,
|
|
|
|
|
mobileBottomRow?: number,
|
|
|
|
|
isMobile?: boolean,
|
|
|
|
|
isFlexChild?: boolean,
|
2020-04-03 04:48:40 +00:00
|
|
|
): {
|
|
|
|
|
componentWidth: number;
|
|
|
|
|
componentHeight: number;
|
|
|
|
|
} {
|
2023-03-04 07:25:54 +00:00
|
|
|
let left = leftColumn;
|
|
|
|
|
let right = rightColumn;
|
|
|
|
|
let top = topRow;
|
|
|
|
|
let bottom = bottomRow;
|
|
|
|
|
if (isFlexChild && isMobile) {
|
|
|
|
|
if (mobileLeftColumn !== undefined && parentColumnSpace !== 1) {
|
|
|
|
|
left = mobileLeftColumn;
|
|
|
|
|
}
|
|
|
|
|
if (mobileRightColumn !== undefined && parentColumnSpace !== 1) {
|
|
|
|
|
right = mobileRightColumn;
|
|
|
|
|
}
|
|
|
|
|
if (mobileTopRow !== undefined && parentRowSpace !== 1) {
|
|
|
|
|
top = mobileTopRow;
|
|
|
|
|
}
|
|
|
|
|
if (mobileBottomRow !== undefined && parentRowSpace !== 1) {
|
|
|
|
|
bottom = mobileBottomRow;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
return {
|
2023-03-04 07:25:54 +00:00
|
|
|
componentWidth: (right - left) * parentColumnSpace,
|
|
|
|
|
componentHeight: (bottom - top) * parentRowSpace,
|
2019-09-09 09:08:54 +00:00
|
|
|
};
|
2019-02-11 18:22:23 +00:00
|
|
|
}
|
|
|
|
|
|
feat: Controls for labels in widgets to align the widgets in forms and other places (#10600)
* feat: When there are multiple input widgets with different label lengths then the input box looks misaligned
-- Create a new property control for a label position
-- Create a new property control for a label alignment
-- Prototype a label section for Input widget
* feat: When there are multiple input widgets with different label lengths then the input box looks misaligned
-- Add a property, labelWidth in the property pane
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Input widget: Implement all the requirements in case its type is Text
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Adapt the functionalty on other types of the input widget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into DropdownWidget
-- Clean up for the input widget and DRY
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into MultiSelectWidget
-- Eliminate unnecessary component prop, columns
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalties into Tree Select widget
-- Add styles for alignment between lable and input control over the widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into MultiSelectTreeWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Introduce label functionalities into DatePickerWidget2
-- Use width instead of columns prop in InputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into RichTextEditorWidget
-- Eliminate compactMode from StyledLabel
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into CheckboxGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement switch group for the correct meaning of right alignment
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into RadioGroupWidget
-- Add new properties, alignment and inline for consistency
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Adjust cols and rows for RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused StyledRadioProps
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Complete first MVP of enhanced SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Complete the first MVP of enhanced RadioGroupWidget
-- Eliminate unused StyledSwitch component for SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add min-height, align-self rules for LabelContainer
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Use original label property for RadioGroupWidget
-- Add a migration for adding isInline and alignment properties for RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Update version to latest one in DSLMigrationsUtils.test.ts
* fix failing jest test
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement label functionalities on BaseInputWidget, InputWidgetV2, CurrencyInputWidget, PhoneInputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused imports in DSLMigrationsUtils
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the label related test case which is failed in Input_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on #10119: The label text truncates on resizing the input widget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix scroll issue when shrink with MultiSelectWidget and MultiSelectTreeWidget
* fix: Widget Popup test
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement width and alginment features on the level of label element
-- Prevent actual inputs from DropdownWidget, MultiSelectWidget, SingleSelectTreeWidget, MultiSelectTreeWidget from overflow when resizing
-- Enable label feature on a RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set label container's default width to 33% when width is not set
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix crash issue when labelWidth is filled by non-numeric value, eliminating passing NaN as its value
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set flex-grow to zero on input types other than TEXT
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Implement label features on newly created MultiSelectWidgetV2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate LabelPositionTypes, directly using enum LabelPosition
-- Add a comment for a constant LABEL_MAX_WIDTH_RATE
-- Directly import React for LabelAlignmentOptionsControl
-- Remove unnecessary constructor for LabelAlignmentOptionsControl
-- Define handleAlign instance method as a higher-order function
-- Only migrate alignment property for RadioGroupWidget
-- Use Object.hasOwnProperty instead of in operator
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Migrate alignment property of RadioGroupWidget in case of currentDSL.version is 52
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Revert currentDSL.version to 52
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add a Jest test case for RadioGroupWidget's alignment property migration
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Replace all nested ternary operators with if statements
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Implement label feature on new version of SelectWidget
-- Add Cypress tests for widgets' label section
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor code for BaseInputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change CSS selector for step buttons for Numeric BaseInputWidget
-- Directly use migrateRadioGroupAlignmentProperty migration function without using transformDSL
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on typo about migrateRadioGroupAlignmentProperty
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add data-testid attributes for Cypress selectors
* feat: Deprecate form button widget
-- Assert flex-direction to row in CheckboxGroup_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add a missing data-testid for SelectWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on failed test cases: CheckboxGroup_spec, DatePicker_2_spec, MultiSelectWidgetV2
* fix: Select popup DSL
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Create a new property control, NumericInputControl
-- Replace all the label properties with the newly created controls
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Create a new Cypress command, checkLabelWidth and apply to all related test cases
-- Increase width in checkboxgroupDsl.json
-- Rename className for label in MultiSelectWidgetV2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement the tooltip feature for labels
-- Add missing props for labels in DateField, MultiSelectField, RadioGroupField, SelectField fields for JSONFormWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor property controls, including LabelPositionOptionsControl, LabelAlignmentOptionsControl, NumericInputControl to keep consistency
-- Apply default values into label section
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Extract the label related parts from the various widgets as an independent component
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate TypeScript any type from BaseInputComponent
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change labelPosition property type to DROP_DOWN
-- Modify LabelAlignmentOptionsControl to use ButtonTabComponent
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Define getLabelWidth method into BaseWidget
-- Extract the common CSS rules for the widget containers
-- Revert rows and columns for SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the failed test case in DSLMigrationsUtils.test.ts
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on overflow issue on CheckboxGroupWidget
-- Create a distinctive spec file for label feature
-- Eliminate the redundant label specs with the relevant widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Delete unnecessary files, including Select_spec.js, LabelButton.tsx and LabelPositionOptionsControl.tsx
-- Revise wrong comment for checkLabelForWidget Cypress command
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Do not set the label width only if its value is 0
-- Clean up the component for DatePickerWidget2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused imports in DatePickerWidget2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Make RadioGroupWidget's layout flexible in all modes
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on Cypress test case for RadioGroupWidget in Widgets_Labels_spec
-- Change Cypress commands, including addAction, addSuccessMessage, enterActionValue to accept parentSelector
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change getLabelWidth method to not have any argument
-- Define some constants for label numbers
-- Extract the common styles for SwitchGroupWidget and RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor some constants
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused width prop from RadioGroupWidget
-- Get labelWidth from getLabelWidth
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate the min-height restriction on a label
-- Eliminate the scroll on the earlier InputWidgetV2 which was not in compact mode
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add one more condition checking if the current input type is text
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Extract common code base for MultiSelectTreeWidget and MultiSelectWidgetV2
-- Apply a few CSS fixes on the scrollbar issue select related widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply some tweaks for earlier widgets with labels so as not to be broken UX
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the failed Cypress test case in Widget_Popup_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add constants, LABEL_DEFAULT_WIDTH_RATE, SELECT_DEFAULT_HEIGHT, LABEL_MARGIN_OLD_SELECT
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Increase the widths of CheckboxGroupWidget and SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set the font size to 14px for NumericInputControl
Co-authored-by: ohansFavour <fohanekwu@gmail.com>
Co-authored-by: Tolulope Adetula <31691737+Tooluloope@users.noreply.github.com>
2022-04-14 08:47:25 +00:00
|
|
|
getLabelWidth = () => {
|
|
|
|
|
return (Number(this.props.labelWidth) || 0) * this.props.parentColumnSpace;
|
|
|
|
|
};
|
|
|
|
|
|
2021-06-21 11:09:51 +00:00
|
|
|
getErrorCount = memoize((evalErrors: Record<string, EvaluationError[]>) => {
|
|
|
|
|
return Object.values(evalErrors).reduce(
|
2022-11-03 09:23:15 +00:00
|
|
|
(prev, curr) => curr.length + prev,
|
2021-06-21 11:09:51 +00:00
|
|
|
0,
|
|
|
|
|
);
|
2021-05-18 13:54:40 +00:00
|
|
|
}, JSON.stringify);
|
|
|
|
|
|
2019-02-11 18:22:23 +00:00
|
|
|
render() {
|
2020-03-17 09:01:29 +00:00
|
|
|
return this.getWidgetView();
|
2019-02-11 18:22:23 +00:00
|
|
|
}
|
2019-02-10 13:06:05 +00:00
|
|
|
|
2021-04-23 05:43:13 +00:00
|
|
|
/**
|
|
|
|
|
* this function is responsive for making the widget resizable.
|
|
|
|
|
* A widget can be made by non-resizable by passing resizeDisabled prop.
|
|
|
|
|
*
|
|
|
|
|
* @param content
|
|
|
|
|
*/
|
2020-03-27 09:02:11 +00:00
|
|
|
makeResizable(content: ReactNode) {
|
|
|
|
|
return (
|
2023-02-08 11:23:39 +00:00
|
|
|
<ResizableComponent {...this.props} paddingOffset={WIDGET_PADDING}>
|
2020-03-27 09:02:11 +00:00
|
|
|
{content}
|
|
|
|
|
</ResizableComponent>
|
|
|
|
|
);
|
|
|
|
|
}
|
2021-04-23 05:43:13 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* this functions wraps the widget in a component that shows a setting control at the top right
|
|
|
|
|
* which gets shown on hover. A widget can enable/disable this by setting `disablePropertyPane` prop
|
|
|
|
|
*
|
|
|
|
|
* @param content
|
|
|
|
|
* @param showControls
|
|
|
|
|
*/
|
2020-03-27 09:02:11 +00:00
|
|
|
showWidgetName(content: ReactNode, showControls = false) {
|
2023-04-07 13:51:35 +00:00
|
|
|
const { componentWidth } = this.getComponentDimensions();
|
|
|
|
|
|
|
|
|
|
return !this.props.disablePropertyPane ? (
|
2021-04-23 05:43:13 +00:00
|
|
|
<>
|
2023-04-07 13:51:35 +00:00
|
|
|
<WidgetNameComponent
|
|
|
|
|
errorCount={this.getErrorCount(get(this.props, EVAL_ERROR_PATH, {}))}
|
|
|
|
|
parentId={this.props.parentId}
|
|
|
|
|
showControls={showControls}
|
|
|
|
|
topRow={this.props.detachFromLayout ? 4 : this.props.topRow}
|
|
|
|
|
type={this.props.type}
|
|
|
|
|
widgetId={this.props.widgetId}
|
|
|
|
|
widgetName={this.props.widgetName}
|
|
|
|
|
widgetWidth={componentWidth}
|
|
|
|
|
/>
|
2020-03-27 09:02:11 +00:00
|
|
|
{content}
|
2021-04-23 05:43:13 +00:00
|
|
|
</>
|
2023-04-07 13:51:35 +00:00
|
|
|
) : (
|
|
|
|
|
content
|
2020-03-27 09:02:11 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-23 05:43:13 +00:00
|
|
|
/**
|
|
|
|
|
* wraps the widget in a draggable component.
|
|
|
|
|
* Note: widget drag can be disabled by setting `dragDisabled` prop to true
|
|
|
|
|
*
|
|
|
|
|
* @param content
|
|
|
|
|
*/
|
2020-03-27 09:02:11 +00:00
|
|
|
makeDraggable(content: ReactNode) {
|
|
|
|
|
return <DraggableComponent {...this.props}>{content}</DraggableComponent>;
|
|
|
|
|
}
|
2023-01-28 02:17:06 +00:00
|
|
|
|
2021-07-26 16:44:10 +00:00
|
|
|
/**
|
|
|
|
|
* wraps the widget in a draggable component.
|
|
|
|
|
* Note: widget drag can be disabled by setting `dragDisabled` prop to true
|
|
|
|
|
*
|
|
|
|
|
* @param content
|
|
|
|
|
*/
|
|
|
|
|
makeSnipeable(content: ReactNode) {
|
|
|
|
|
return <SnipeableComponent {...this.props}>{content}</SnipeableComponent>;
|
|
|
|
|
}
|
2020-03-27 09:02:11 +00:00
|
|
|
|
|
|
|
|
makePositioned(content: ReactNode) {
|
2022-09-14 06:55:08 +00:00
|
|
|
const { componentHeight, componentWidth } = this.getComponentDimensions();
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
return (
|
2020-05-21 06:15:12 +00:00
|
|
|
<PositionedContainer
|
2022-09-14 06:55:08 +00:00
|
|
|
componentHeight={componentHeight}
|
|
|
|
|
componentWidth={componentWidth}
|
2021-05-27 06:41:38 +00:00
|
|
|
focused={this.props.focused}
|
2022-12-30 14:52:11 +00:00
|
|
|
isDisabled={this.props.isDisabled}
|
|
|
|
|
isVisible={this.props.isVisible}
|
2022-09-14 06:55:08 +00:00
|
|
|
leftColumn={this.props.leftColumn}
|
|
|
|
|
noContainerOffset={this.props.noContainerOffset}
|
|
|
|
|
parentColumnSpace={this.props.parentColumnSpace}
|
2022-01-13 13:21:57 +00:00
|
|
|
parentId={this.props.parentId}
|
2022-09-14 06:55:08 +00:00
|
|
|
parentRowSpace={this.props.parentRowSpace}
|
2023-02-08 11:23:39 +00:00
|
|
|
ref={this.props.wrapperRef}
|
2021-05-27 06:41:38 +00:00
|
|
|
resizeDisabled={this.props.resizeDisabled}
|
|
|
|
|
selected={this.props.selected}
|
2022-09-14 06:55:08 +00:00
|
|
|
topRow={this.props.topRow}
|
2020-05-21 06:15:12 +00:00
|
|
|
widgetId={this.props.widgetId}
|
2023-02-14 16:07:31 +00:00
|
|
|
widgetName={this.props.widgetName}
|
2020-05-21 06:15:12 +00:00
|
|
|
widgetType={this.props.type}
|
|
|
|
|
>
|
2020-03-27 09:02:11 +00:00
|
|
|
{content}
|
|
|
|
|
</PositionedContainer>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-21 06:14:50 +00:00
|
|
|
addErrorBoundary(content: ReactNode) {
|
|
|
|
|
return <ErrorBoundary>{content}</ErrorBoundary>;
|
2020-03-27 09:02:11 +00:00
|
|
|
}
|
|
|
|
|
|
2022-11-23 09:48:23 +00:00
|
|
|
addAutoHeightOverlay(content: ReactNode, style?: CSSProperties) {
|
2022-12-22 12:48:47 +00:00
|
|
|
// required when the limits have to be updated
|
|
|
|
|
// simultaneosuly when they move together
|
|
|
|
|
// to maintain the undo/redo stack
|
|
|
|
|
const onBatchUpdate = ({
|
|
|
|
|
maxHeight,
|
|
|
|
|
minHeight,
|
|
|
|
|
}: {
|
|
|
|
|
maxHeight?: number;
|
|
|
|
|
minHeight?: number;
|
|
|
|
|
}) => {
|
2022-11-23 09:48:23 +00:00
|
|
|
const modifyObj: Record<string, unknown> = {};
|
2022-12-22 12:48:47 +00:00
|
|
|
|
|
|
|
|
if (maxHeight !== undefined) {
|
|
|
|
|
modifyObj["maxDynamicHeight"] = Math.floor(
|
|
|
|
|
maxHeight / GridDefaults.DEFAULT_GRID_ROW_HEIGHT,
|
2022-11-23 09:48:23 +00:00
|
|
|
);
|
2022-12-22 12:48:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (minHeight !== undefined) {
|
|
|
|
|
modifyObj["minDynamicHeight"] = Math.floor(
|
|
|
|
|
minHeight / GridDefaults.DEFAULT_GRID_ROW_HEIGHT,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-23 09:48:23 +00:00
|
|
|
this.batchUpdateWidgetProperty({
|
|
|
|
|
modify: modifyObj,
|
|
|
|
|
postUpdateAction: ReduxActionTypes.CHECK_CONTAINERS_FOR_AUTO_HEIGHT,
|
|
|
|
|
});
|
|
|
|
|
AnalyticsUtil.logEvent("AUTO_HEIGHT_OVERLAY_HANDLES_UPDATE", modifyObj);
|
|
|
|
|
};
|
|
|
|
|
|
2022-12-22 12:48:47 +00:00
|
|
|
const onMaxHeightSet = (maxHeight: number) => onBatchUpdate({ maxHeight });
|
2022-11-23 09:48:23 +00:00
|
|
|
|
2022-12-22 12:48:47 +00:00
|
|
|
const onMinHeightSet = (minHeight: number) => onBatchUpdate({ minHeight });
|
2022-11-23 09:48:23 +00:00
|
|
|
|
2022-02-23 04:52:04 +00:00
|
|
|
return (
|
2022-11-23 09:48:23 +00:00
|
|
|
<>
|
|
|
|
|
<AutoHeightOverlayContainer
|
|
|
|
|
{...this.props}
|
|
|
|
|
batchUpdate={onBatchUpdate}
|
|
|
|
|
maxDynamicHeight={getWidgetMaxAutoHeight(this.props)}
|
|
|
|
|
minDynamicHeight={getWidgetMinAutoHeight(this.props)}
|
|
|
|
|
onMaxHeightSet={onMaxHeightSet}
|
|
|
|
|
onMinHeightSet={onMinHeightSet}
|
|
|
|
|
style={style}
|
|
|
|
|
/>
|
2022-02-23 04:52:04 +00:00
|
|
|
{content}
|
2022-11-23 09:48:23 +00:00
|
|
|
</>
|
2022-02-23 04:52:04 +00:00
|
|
|
);
|
|
|
|
|
}
|
2023-01-28 02:17:06 +00:00
|
|
|
|
2023-03-04 07:25:54 +00:00
|
|
|
makeFlex(content: ReactNode) {
|
|
|
|
|
const { componentHeight, componentWidth } = this.getComponentDimensions();
|
|
|
|
|
return (
|
|
|
|
|
<FlexComponent
|
2023-04-07 13:51:35 +00:00
|
|
|
alignment={this.props.alignment}
|
2023-03-04 07:25:54 +00:00
|
|
|
componentHeight={componentHeight}
|
|
|
|
|
componentWidth={componentWidth}
|
2023-04-07 13:51:35 +00:00
|
|
|
direction={this.props.direction || LayoutDirection.Horizontal}
|
2023-03-04 07:25:54 +00:00
|
|
|
flexVerticalAlignment={
|
|
|
|
|
this.props.flexVerticalAlignment || FlexVerticalAlignment.Top
|
|
|
|
|
}
|
|
|
|
|
focused={this.props.focused}
|
2023-04-07 13:51:35 +00:00
|
|
|
isMobile={this.props.isMobile || false}
|
2023-03-04 07:25:54 +00:00
|
|
|
parentColumnSpace={this.props.parentColumnSpace}
|
|
|
|
|
parentId={this.props.parentId}
|
2023-04-07 13:51:35 +00:00
|
|
|
renderMode={this.props.renderMode}
|
2023-03-04 07:25:54 +00:00
|
|
|
responsiveBehavior={this.props.responsiveBehavior}
|
|
|
|
|
selected={this.props.selected}
|
|
|
|
|
widgetId={this.props.widgetId}
|
|
|
|
|
widgetName={this.props.widgetName}
|
|
|
|
|
widgetType={this.props.type}
|
|
|
|
|
>
|
|
|
|
|
{content}
|
|
|
|
|
</FlexComponent>
|
|
|
|
|
);
|
|
|
|
|
}
|
2023-04-14 13:55:44 +00:00
|
|
|
addWidgetComponentBoundary = (
|
|
|
|
|
content: ReactNode,
|
|
|
|
|
widgetProps: WidgetProps,
|
|
|
|
|
) => (
|
|
|
|
|
<WidgetComponentBoundary widgetType={widgetProps.type}>
|
|
|
|
|
{content}
|
|
|
|
|
</WidgetComponentBoundary>
|
|
|
|
|
);
|
|
|
|
|
|
2022-08-19 10:10:36 +00:00
|
|
|
getWidgetComponent = () => {
|
|
|
|
|
const { renderMode, type } = this.props;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The widget mount calls the withWidgetProps with the widgetId and type to fetch the
|
|
|
|
|
* widget props. During the computation of the props (in withWidgetProps) if the evaluated
|
|
|
|
|
* values are not present (which will not be during mount), the widget type is changed to
|
|
|
|
|
* SKELETON_WIDGET.
|
|
|
|
|
*
|
2022-11-23 09:48:23 +00:00
|
|
|
* Note:- This is done to retain the old rendering flow without any breaking changes.
|
2022-08-19 10:10:36 +00:00
|
|
|
* This could be refactored into not changing the widget type but to have a boolean flag.
|
|
|
|
|
*/
|
2023-02-08 11:23:39 +00:00
|
|
|
if (type === "SKELETON_WIDGET" || this.props.deferRender) {
|
2022-08-19 10:10:36 +00:00
|
|
|
return <Skeleton />;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-14 13:55:44 +00:00
|
|
|
let content =
|
2022-11-23 09:48:23 +00:00
|
|
|
renderMode === RenderModes.CANVAS
|
|
|
|
|
? this.getCanvasView()
|
|
|
|
|
: this.getPageView();
|
|
|
|
|
|
2022-12-11 15:21:46 +00:00
|
|
|
// This `if` code is responsible for the unmount of the widgets
|
|
|
|
|
// while toggling the dynamicHeight property
|
|
|
|
|
// Adding a check for the Modal Widget early
|
|
|
|
|
// to avoid deselect Modal in its unmount effect.
|
fix: list widget remove autoLayoutContainer for list widget template children (#18441)
* added an experiment to overflow the content if maxHEight is less
* removed the ref of Textwidget by mistake, added it back
* fixed text widget height overflow problem with a little hack
* added long labels with text
* fixed the table scroll issue
* overflow fixed for json form widget
* added extra 8px height for Switch, Rating and Checkbox Height
* (WIP): Resolve issues
* (WIP): Fix widget padding issue
* added overflow container for Radio and Switch group widgets
* (WIP): Have modals work with dynamic height
* added the overlay and the handles
* added dragging behavior to the dots
* fixed the overlapping with the selection tool
* (WIP): Fix issues reported
* now we can update the property pane values back from overlay handles
* now we can update the property pane values back from overlay handles
* (WIP): Fix table widget
* Fix package.json
* Remove unit tests temporarily
* Fix unit test
* (WIP): Fix modal resize. Fix cursors. Fix border issue on non-resizable widgets
* fetch component heights using the requestAnimationFrame callback
* behavioural changes
* (WIP): Fix issues on the platform
* Update main container size appropriately
* more behavioural changes
* overlay now only be visible when hovering over the dots
* grid showing and widget reselecting
* added onfocus and onblur events to property pane listeners
* added onfocus and onblur events to property pane listeners
* added a range slider for min and max
* added demarcations for slider values
* (WIP): Fix platform workflows for dynamic height
* Fix issues with widgets
* Fix removed import
* - Add missing cypress files
* set the limits
* limit increase on change
* Fix z-index of min max limit indicators. Fix unused-vars warnings
* Fix Table Widget and Text Widget issues
* Fix: all the bugs in the bug master list for DH (#16268)
* changed the zindex for the signifiers
* showing signifiers only when the widget is selected
* made changes suggested by Momcilo
* activate the dots when the fields are active
* created a new centered dot handle
* removed overlays on focus and made the border more like deisgn
* handles on top of other widgets
* hide the overlay when multiple widgets are selected
* added a white border
* added a white border
* bug #15509 resolved
* changed the minDynamicHeightLimit to 2 instead of 4 to fix the Bug #15527
* removed the height auto fix from BaseInputComponent to fix the Bug #15388
* removed the condition to not ccalculate dynamic height when the row difference is less than 2 to fix the bug 15353
* made fixes for the bug #16307
* made fixes for the bug #16308
* made fixes for bug 16310
* made fixes for the bug #16402
* removed some log statements
* made fixes for the bug #16407
* fixed label problem found in the issue #16543
* made fixes for the issue #16547
* made fixes for the bug #16492
* redeploy
* (WIP): Fix to make this branch functional
* imported LabelWithTooltip back from design system
* signifier is now centered
* filled the signifier with primary color
* overlay hidden while dragging
* made the signifier dashed border also draggable
* Fix issue #16590 (#16798)
* set the limits to 4 rows
* replaced the static 40 value
* added signifiers for modal widget
* added signifiers for modal widget
* tried solving the scroll issue for widgets when there are limits
* solved the height problem using ResizeObserver
* (WIP): Fix maxDynamicHeight issue with container widgets:
* made the changes as per the review
* fixed the issue for input widget when label gets out of border
* hide text widget overflow options if auto height is enabled
* (WIP): In view mode, invisible widgets now donot take space (#16920)
* (WIP): In view mode, invisible widgets now donot take space
* (WIP): Enable the feature where invisible widgets in view mode don't take space to all widgets irrespective of the dynamic height feature
* Remove Replay conditional
* removed the scroll container for container type widgets
* removed the scroll container for container type widgets
* updated the hook to set overflow none for text widget
* fixed the should dynamic height logic to respect the min height limit
* Modal widget adheres to dynamic height (#16995)
* Modal widget adheres to dynamic height
* WIP: POC: fix dynamic height issues (#16996)
Fix height less than 4 issue. Fix JSONForm adherence to min and max height
* POC: Dynamic height undo redo issue (#17085)
* Revert debouce timeout
* (WIP): Fix issue with undo-redo in dynamic height
* fix: Dynamic height issue fixes (#17153)
* Dynamic height issue fixes
==
- Fix issue where nested widgets did not ensure parent dynamic height updates
- Fix issue where Modal widget updates came in subsequent renders
- Fix issue where JSONForm collapses
- Fix performance issue for independent updates
* Use functions to get min and max dynamic height
* Fix issue where variable might have been undefined
* added the dynamic container into the deploy mode as well
* added overflow-x hidden when overflow-y is active in the dynamic height container
* fix: Dynamic height Issue fixes (#17204)
Fix preview mode invisible widgets. Fix Tabs widget dynamic height.
* removed a console.log statement
* removed the slider control file
* imported the LabelWithTooltip from the repo rather than ds
* word-break CSS rules added for Switch and Checkbox widget when Dynamic Height is enabled
* abstracted the check for dynamic height with limits enabled as isDynamicHeightWithLimitsEnabledForWidget
* abstracted the static value of 10 in dynamic height overlay to GridDefaults
* abstracted min and max dynamic height limits to getters
* fix: replaced all the refs for simpler widgets (#17353)
* replaced all the refs for simpler widgets
* removed the updateDynamicHeight from componentDidUpdate in BaseWidget
* added back lifecycle methods back to BaseWidget
* removed the contentRef from SwitchGroup and Table
* updating the height from the auto height with limits as well
* some hacks to make the limits work
* working solution
* used setTimeout to send an update to updateDynamicHeight from overlay update
* removed a log
* added requestanimationframe in settimeout
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* Fix issues caused during merge
* Remove unneeded derived property
* removed more unnecessary code which should have been removed after removing the ref dependency
* fixed the maxDynamicHeight issue
* Fix issue where property configs were not being sent
* fix: Auto Height Feature - add selectors for tests (#17687)
Add selectors for auto height cypress tests
* fix: removed height auto default theme (#17415)
removed height auto css rule from the default theme
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
* fix: Auto Height Feature - Resolve issues and restructure code (#17686)
* Fix issues in dynamic height. Restructure code and reduce abstraction leaks
* Fix typescript issues
* Update based on review comments. Comment migrations, as a cyclic import is causing the jest tests to fail.
* Remove unused imports
* Decrease code nesting
* added the base styles for the overlay like position and z-index in its styled component css
* used the isDynamicHeightEnabled prop to set the height of SwitchGroup and RadioGroup widgets from 32px to 100% in case of inline mode
* fix: Auto Height - Resolve issues (#17737)
* Fix Tabs Widget showTabs toggle based auto height. Revert removal of BaseWidget code. Remove box-intersect and use a bruteforce algorithm. Add base logic for having containers collapse due to hidden child widgets
* Hide scroll contents and overflow property pane controls when dynamic height is enabled
* Removed the class property expectedHeight from BaseWidget as it is not useful in the overlay logic after some changes
* fixed the left alignment issue of label in the rich text editor by adding some styles applied only when the dynamic height is enabled
* fixed the input field stretching issue in case of Dynamic height by adding some CSS styles when isDynamicHeight is true
* Fix failing modal widget cypress tests
* Fix issue with scrollContents and Tabs Widget defaulTab
* added a little bit padding of 4px to the right of scroll container of dynamic height with limit
* Add test locators for resize handles
* removed the dynamic height logic from the table widget
* fix: Auto-Height invisible widgets (#17849)
* Fix issue where invisible widgets were still taking space
* Make sure to collapse only if dynamic height is enabled
* Fix issues with reflow (not the invisible widgets)
* Fix container min height issues
* Fix reflow with original bottom and top values. Testing needed
* Fix invisible widgets
* fix: enabled dynamic height for stat box widget (#17971)
enabled dynamic height for stat box widget
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: added a min height to rich text editor so that it does not collapse (#17970)
added a min height to rich text editor so that it does not collapse
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* Fix issue with resizing auto height widget
* Add helper text to educate users regarding the scroll disconnect in WYSIWYG
* fix: Auto Height Fixes (#18111)
AUTO HEIGHT FIXES
- Fix JSONForm height discrepancy
- Fix issue where widgets moved below the other
- Fix droptarget height after parent container resize
* fix: sliced up the DynamicHeightOverlay component a little bit (#18100)
* sliced up the DynamicHeightOverlay component a little bit
* more refactoring
* more refactoring
* used release event emitter and refactored more
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: rich text editor center alignment issue (#18142)
* removed the center alignment from rich text editor
* dummy commit
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: old DSL container collapse (#18160)
* Fix issue where old containers from old DSLs used to collapse when auto height was enabled
* Fix issue where old containers don't allow new widgets to be added when auto height is enabled, this is because the shouldScrollContents is undefined
* fix: input widgets issue (#18172)
fixed the auto height not working issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: preview deploy mode (#18174)
fixed the preview and deploy mode
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits label intersection with handle dot (#18186)
fixed the position of the limits label to the right so that it will not intersect with the handle dot
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits rich text editor min height (#18187)
decrease the min height of the RTE so that it does not have the boundary issue with the max limit when auto height with limits is enabled
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: grammatical error in the help text (#18188)
changed react to reacts in the helpText of the dynamic height property in the proeprty pane
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height tabs double scroll (#18210)
solved the issue by disabling the scroll for the child canvas widget in the tabs widget
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits resizing (#18213)
* fixed the auto height limits resizing issue
* made the auto height overlay independent of isResizing and used its own property to show the grid
* some more refactoring
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* dummy commit
* fix: old apps container issue (#18255)
filtered out the widgets which are detached from layout
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: fixing auto height in childless containers. (#18263)
fixing auto height in childless containers.
* task: Dynamic height reflow fixes in Branch (#18244)
dynamic height reflow fixes
* fix: compact label issue and min and max limits numeric input (#18282)
fixed compact label issue and turned min and max limits to numeric input
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: LabelWithTooltip help icon fix
* fix: NaN and min limit for min and max (#18284)
* fixed compact label issue and turned min and max limits to numeric input
* fixed NaN and set min to be 4
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: validation issues for min max (#18286)
* fixed compact label issue and turned min and max limits to numeric input
* fixed NaN and set min to be 4
* validations start working min max
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* added a full stop to container scroll helper text
* validations start working min max
* dummy commit
* feat: stop resizing auto height widgets vertically because of Drag n Drop Reflow (#18267)
* reflow fixes
* stop resizing auto height widgets vertically because of Drag n Drop Reflow
* feat: Analytics for Dynamic height (#18279)
* Fix canvas min height issue and invisible widgets issue and remove logs and fix issue where widgets overlapped when coming back from preview mode to edit mode
* Fix issue with containers not respecting auto height and decreasing height
* Fix issue with modal widget not hugging contents, and container widgets never become visible after going invisible
* Fix issue where existing containers don't have correct min height for child canvas
* fix: canvasLevelsReducers test (#18301)
fixed the canvasLevelsReducers test
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: removed auto height min max config from widget features (#18316)
removed auto height min max config from widget features
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: Fixing Modal Height updates (#18317)
Fixing Modal Height updates
* fix: text widget background auto height (#18319)
added background color of Text widget back to the auto height container
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* test: cypress tests for auto height (#17676)
* Added tests for dynamic height
* updated tests for another usecase
* moved locators into commonfile
* updated common method
* added tests for some more widgets
* Added tests for jsonForm / Form widget
* Updated the test
* updated test for multiple text widgets
* updated test with few more usecases
* updated the dsl
* updated tests for text change
* updated tests based on new changes
* updated cypress test fixes
* fix: auto height container merge poc wrt release (#18334)
updated the poc wrt PR already merged in the release regarding the auto height container
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: renamed auto height overlay components and added some tests (#18333)
* renamed auto height overlay components and added some tests
* replaced the 10 value with GridDefaults
* avoiding event to reach drop target
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* updated tests
* Merge all code into one branch
* Fix failing AutoHeightcontainer test
* fix: Fix reflow computations which were causing widget overlap (#18300)
* Fix reflow computations which were causing widget overlap
* Fix issues with parent container height and overlapping widgets
* Remove console logs
* Revert comment
* Fix issues related to reflow of containers
* feat: Making getEffectedBoxes a Recursive function in autoHeight Reflow (#18336)
Making getEffectedBoxes a Recursive function in autoHeight Reflow
* Return null for invisible widgets from withWidgetProps
* Remove duplicate import
Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com>
* Remove missed console log
* fix: Label position gets deselected on selecting already selected option (#18298)
* fix: Label position gets deselected on selecting the already selected value
* Added migration for Currency & Phone input widgets
* simplify migration function using a utility
* combine conditions
* Increments LATEST_PAGE_VERSION
* Update DynamicHeight_Visibility_spec.js
updated a check wrt auto height
* Handling Modals for canvas size calculations
* fix: migrate label position test failing issue (#18365)
fixed migrate label postition test failing issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* removed the two unwanted imports from DSLMigrations to fix client build
* fix: Auto height zero and limits issue (#18366)
fixed the auto height zero and limits issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: Auto height regression issues (#18367)
* Fix auto height regression issues #18367
* feat: auto height migrations (#18368)
Add auto height migrations
* Increase file caching size
* Use manual array for list of auto height enabled widgets
* Fix cypress test dsl versions
* Revert changes to shouldUpdateHeightDynamically
* Update test results based on code changes
* Marginally increase the workbox file size cache
* review comment incorporated for test spec
* Update container auto height property on drop
* Remove auto height for container Inside List widget
* remove unneccessary changes
* removed block and added flex consistent in the alignment case of left and right
* fixed radio group which broke because of display block
* default enabled auto height for every widget
* added reivew changes
* reverted the switch group style changes and added the check for Text widget background in the AutoHeightContainer
* changed the scroll helper text for containers
* reverted the default enable for all the widgets
* test: fixed DH flaky test (#18415)
fixed DH flaky test
* fix: auto height container computations (#18408)
* Fix auto height container computations
* fix: Invisible Widgets Overlap while switching back and forth between edit and preview modes in rare cases (#18398)
sort Space based on original position if dynamic positions are equal while generating tree
* fix: group widgets label alignment. (#18360)
* fix: group widgets label alignment.
* fix: switch and radio fix transform styles for auto height.
* feat: disable auto height limits for modal (#18386)
* added multi select back
* (WIP): Complete the dynamc height update logic
* (WIP): Dynamic height logic
* (WIP): Container computation logic, Next steps: Prevent reflow when resize is disabled. Fix logic of widgets randomly changing positions (Debug)
* Fix logic in container computations
* Integrate for PoC
* fixed the no initial load dynamic height updates
* Stop vertical resize and reflow when dynamic height is enabled for a widget
* added another container in text widget
* enabled dynamic height for container widgets
* removed dynamic height feature from list widget
* Fixed Button and Input components height increase
* added an experiment to overflow the content if maxHEight is less
* removed the ref of Textwidget by mistake, added it back
* fixed text widget height overflow problem with a little hack
* added long labels with text
* fixed the table scroll issue
* overflow fixed for json form widget
* added extra 8px height for Switch, Rating and Checkbox Height
* (WIP): Resolve issues
* (WIP): Fix widget padding issue
* added overflow container for Radio and Switch group widgets
* (WIP): Have modals work with dynamic height
* added the overlay and the handles
* added dragging behavior to the dots
* fixed the overlapping with the selection tool
* (WIP): Fix issues reported
* now we can update the property pane values back from overlay handles
* now we can update the property pane values back from overlay handles
* (WIP): Fix table widget
* Fix package.json
* Remove unit tests temporarily
* Fix unit test
* (WIP): Fix modal resize. Fix cursors. Fix border issue on non-resizable widgets
* fetch component heights using the requestAnimationFrame callback
* behavioural changes
* (WIP): Fix issues on the platform
* Update main container size appropriately
* more behavioural changes
* overlay now only be visible when hovering over the dots
* grid showing and widget reselecting
* added onfocus and onblur events to property pane listeners
* added onfocus and onblur events to property pane listeners
* added a range slider for min and max
* added demarcations for slider values
* (WIP): Fix platform workflows for dynamic height
* Fix issues with widgets
* Fix removed import
* - Add missing cypress files
* set the limits
* limit increase on change
* Fix z-index of min max limit indicators. Fix unused-vars warnings
* Fix Table Widget and Text Widget issues
* Fix: all the bugs in the bug master list for DH (#16268)
* changed the zindex for the signifiers
* showing signifiers only when the widget is selected
* made changes suggested by Momcilo
* activate the dots when the fields are active
* created a new centered dot handle
* removed overlays on focus and made the border more like deisgn
* handles on top of other widgets
* hide the overlay when multiple widgets are selected
* added a white border
* added a white border
* bug #15509 resolved
* changed the minDynamicHeightLimit to 2 instead of 4 to fix the Bug #15527
* removed the height auto fix from BaseInputComponent to fix the Bug #15388
* removed the condition to not ccalculate dynamic height when the row difference is less than 2 to fix the bug 15353
* made fixes for the bug #16307
* made fixes for the bug #16308
* made fixes for bug 16310
* made fixes for the bug #16402
* removed some log statements
* made fixes for the bug #16407
* fixed label problem found in the issue #16543
* made fixes for the issue #16547
* made fixes for the bug #16492
* redeploy
* (WIP): Fix to make this branch functional
* imported LabelWithTooltip back from design system
* signifier is now centered
* filled the signifier with primary color
* overlay hidden while dragging
* made the signifier dashed border also draggable
* Fix issue #16590 (#16798)
* set the limits to 4 rows
* replaced the static 40 value
* added signifiers for modal widget
* added signifiers for modal widget
* tried solving the scroll issue for widgets when there are limits
* solved the height problem using ResizeObserver
* (WIP): Fix maxDynamicHeight issue with container widgets:
* made the changes as per the review
* fixed the issue for input widget when label gets out of border
* hide text widget overflow options if auto height is enabled
* (WIP): In view mode, invisible widgets now donot take space (#16920)
* (WIP): In view mode, invisible widgets now donot take space
* (WIP): Enable the feature where invisible widgets in view mode don't take space to all widgets irrespective of the dynamic height feature
* Remove Replay conditional
* removed the scroll container for container type widgets
* removed the scroll container for container type widgets
* updated the hook to set overflow none for text widget
* fixed the should dynamic height logic to respect the min height limit
* Modal widget adheres to dynamic height (#16995)
* Modal widget adheres to dynamic height
* WIP: POC: fix dynamic height issues (#16996)
Fix height less than 4 issue. Fix JSONForm adherence to min and max height
* POC: Dynamic height undo redo issue (#17085)
* Revert debouce timeout
* (WIP): Fix issue with undo-redo in dynamic height
* fix: Dynamic height issue fixes (#17153)
* Dynamic height issue fixes
==
- Fix issue where nested widgets did not ensure parent dynamic height updates
- Fix issue where Modal widget updates came in subsequent renders
- Fix issue where JSONForm collapses
- Fix performance issue for independent updates
* Use functions to get min and max dynamic height
* Fix issue where variable might have been undefined
* added the dynamic container into the deploy mode as well
* added overflow-x hidden when overflow-y is active in the dynamic height container
* fix: Dynamic height Issue fixes (#17204)
Fix preview mode invisible widgets. Fix Tabs widget dynamic height.
* removed a console.log statement
* removed the slider control file
* imported the LabelWithTooltip from the repo rather than ds
* word-break CSS rules added for Switch and Checkbox widget when Dynamic Height is enabled
* abstracted the check for dynamic height with limits enabled as isDynamicHeightWithLimitsEnabledForWidget
* abstracted the static value of 10 in dynamic height overlay to GridDefaults
* abstracted min and max dynamic height limits to getters
* fix: replaced all the refs for simpler widgets (#17353)
* replaced all the refs for simpler widgets
* removed the updateDynamicHeight from componentDidUpdate in BaseWidget
* added back lifecycle methods back to BaseWidget
* removed the contentRef from SwitchGroup and Table
* updating the height from the auto height with limits as well
* some hacks to make the limits work
* working solution
* used setTimeout to send an update to updateDynamicHeight from overlay update
* removed a log
* added requestanimationframe in settimeout
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* Fix issues caused during merge
* Remove unneeded derived property
* removed more unnecessary code which should have been removed after removing the ref dependency
* fixed the maxDynamicHeight issue
* Fix issue where property configs were not being sent
* fix: Auto Height Feature - add selectors for tests (#17687)
Add selectors for auto height cypress tests
* fix: removed height auto default theme (#17415)
removed height auto css rule from the default theme
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
* fix: Auto Height Feature - Resolve issues and restructure code (#17686)
* Fix issues in dynamic height. Restructure code and reduce abstraction leaks
* Fix typescript issues
* Update based on review comments. Comment migrations, as a cyclic import is causing the jest tests to fail.
* Remove unused imports
* Decrease code nesting
* added the base styles for the overlay like position and z-index in its styled component css
* used the isDynamicHeightEnabled prop to set the height of SwitchGroup and RadioGroup widgets from 32px to 100% in case of inline mode
* fix: Auto Height - Resolve issues (#17737)
* Fix Tabs Widget showTabs toggle based auto height. Revert removal of BaseWidget code. Remove box-intersect and use a bruteforce algorithm. Add base logic for having containers collapse due to hidden child widgets
* Hide scroll contents and overflow property pane controls when dynamic height is enabled
* Removed the class property expectedHeight from BaseWidget as it is not useful in the overlay logic after some changes
* fixed the left alignment issue of label in the rich text editor by adding some styles applied only when the dynamic height is enabled
* fixed the input field stretching issue in case of Dynamic height by adding some CSS styles when isDynamicHeight is true
* Fix failing modal widget cypress tests
* Fix issue with scrollContents and Tabs Widget defaulTab
* added a little bit padding of 4px to the right of scroll container of dynamic height with limit
* Add test locators for resize handles
* removed the dynamic height logic from the table widget
* fix: Auto-Height invisible widgets (#17849)
* Fix issue where invisible widgets were still taking space
* Make sure to collapse only if dynamic height is enabled
* Fix issues with reflow (not the invisible widgets)
* Fix container min height issues
* Fix reflow with original bottom and top values. Testing needed
* Fix invisible widgets
* fix: enabled dynamic height for stat box widget (#17971)
enabled dynamic height for stat box widget
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: added a min height to rich text editor so that it does not collapse (#17970)
added a min height to rich text editor so that it does not collapse
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* Fix issue with resizing auto height widget
* Add helper text to educate users regarding the scroll disconnect in WYSIWYG
* fix: Auto Height Fixes (#18111)
AUTO HEIGHT FIXES
- Fix JSONForm height discrepancy
- Fix issue where widgets moved below the other
- Fix droptarget height after parent container resize
* fix: sliced up the DynamicHeightOverlay component a little bit (#18100)
* sliced up the DynamicHeightOverlay component a little bit
* more refactoring
* more refactoring
* used release event emitter and refactored more
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: rich text editor center alignment issue (#18142)
* removed the center alignment from rich text editor
* dummy commit
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: old DSL container collapse (#18160)
* Fix issue where old containers from old DSLs used to collapse when auto height was enabled
* Fix issue where old containers don't allow new widgets to be added when auto height is enabled, this is because the shouldScrollContents is undefined
* fix: input widgets issue (#18172)
fixed the auto height not working issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: preview deploy mode (#18174)
fixed the preview and deploy mode
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits label intersection with handle dot (#18186)
fixed the position of the limits label to the right so that it will not intersect with the handle dot
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits rich text editor min height (#18187)
decrease the min height of the RTE so that it does not have the boundary issue with the max limit when auto height with limits is enabled
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: grammatical error in the help text (#18188)
changed react to reacts in the helpText of the dynamic height property in the proeprty pane
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height tabs double scroll (#18210)
solved the issue by disabling the scroll for the child canvas widget in the tabs widget
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits resizing (#18213)
* fixed the auto height limits resizing issue
* made the auto height overlay independent of isResizing and used its own property to show the grid
* some more refactoring
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* dummy commit
* fix: old apps container issue (#18255)
filtered out the widgets which are detached from layout
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: fixing auto height in childless containers. (#18263)
fixing auto height in childless containers.
* task: Dynamic height reflow fixes in Branch (#18244)
dynamic height reflow fixes
* fix: compact label issue and min and max limits numeric input (#18282)
fixed compact label issue and turned min and max limits to numeric input
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: LabelWithTooltip help icon fix
* fix: NaN and min limit for min and max (#18284)
* fixed compact label issue and turned min and max limits to numeric input
* fixed NaN and set min to be 4
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: validation issues for min max (#18286)
* fixed compact label issue and turned min and max limits to numeric input
* fixed NaN and set min to be 4
* validations start working min max
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* added a full stop to container scroll helper text
* validations start working min max
* dummy commit
* feat: stop resizing auto height widgets vertically because of Drag n Drop Reflow (#18267)
* reflow fixes
* stop resizing auto height widgets vertically because of Drag n Drop Reflow
* feat: Analytics for Dynamic height (#18279)
* Fix canvas min height issue and invisible widgets issue and remove logs and fix issue where widgets overlapped when coming back from preview mode to edit mode
* Fix issue with containers not respecting auto height and decreasing height
* Fix issue with modal widget not hugging contents, and container widgets never become visible after going invisible
* Fix issue where existing containers don't have correct min height for child canvas
* fix: canvasLevelsReducers test (#18301)
fixed the canvasLevelsReducers test
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: removed auto height min max config from widget features (#18316)
removed auto height min max config from widget features
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: Fixing Modal Height updates (#18317)
Fixing Modal Height updates
* fix: text widget background auto height (#18319)
added background color of Text widget back to the auto height container
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* test: cypress tests for auto height (#17676)
* Added tests for dynamic height
* updated tests for another usecase
* moved locators into commonfile
* updated common method
* added tests for some more widgets
* Added tests for jsonForm / Form widget
* Updated the test
* updated test for multiple text widgets
* updated test with few more usecases
* updated the dsl
* updated tests for text change
* updated tests based on new changes
* updated cypress test fixes
* fix: auto height container merge poc wrt release (#18334)
updated the poc wrt PR already merged in the release regarding the auto height container
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: renamed auto height overlay components and added some tests (#18333)
* renamed auto height overlay components and added some tests
* replaced the 10 value with GridDefaults
* avoiding event to reach drop target
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* updated tests
* Merge all code into one branch
* Fix failing AutoHeightcontainer test
* fix: Fix reflow computations which were causing widget overlap (#18300)
* Fix reflow computations which were causing widget overlap
* Fix issues with parent container height and overlapping widgets
* Remove console logs
* Revert comment
* Fix issues related to reflow of containers
* feat: Making getEffectedBoxes a Recursive function in autoHeight Reflow (#18336)
Making getEffectedBoxes a Recursive function in autoHeight Reflow
* Return null for invisible widgets from withWidgetProps
* Remove duplicate import
Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com>
* Remove missed console log
* fix: Label position gets deselected on selecting already selected option (#18298)
* fix: Label position gets deselected on selecting the already selected value
* Added migration for Currency & Phone input widgets
* simplify migration function using a utility
* combine conditions
* Increments LATEST_PAGE_VERSION
* Update DynamicHeight_Visibility_spec.js
updated a check wrt auto height
* Handling Modals for canvas size calculations
* fix: migrate label position test failing issue (#18365)
fixed migrate label postition test failing issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* removed the two unwanted imports from DSLMigrations to fix client build
* fix: Auto height zero and limits issue (#18366)
fixed the auto height zero and limits issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: Auto height regression issues (#18367)
* Fix auto height regression issues #18367
* feat: auto height migrations (#18368)
Add auto height migrations
* Increase file caching size
* Use manual array for list of auto height enabled widgets
* Fix cypress test dsl versions
* Revert changes to shouldUpdateHeightDynamically
* Update test results based on code changes
* Marginally increase the workbox file size cache
* review comment incorporated for test spec
* Update container auto height property on drop
* Disable auto height with limits for modal
Co-authored-by: Ankur Singhal <ankur@appsmith.com>
Co-authored-by: rahulramesha <rahul@appsmith.com>
Co-authored-by: Abhinav Jha <zatanna@Abhinavs-iMac.lan>
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com>
Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com>
Co-authored-by: Albin <albin@appsmith.com>
Co-authored-by: Aswath K <aswath.sana@gmail.com>
Co-authored-by: NandanAnantharamu <67676905+NandanAnantharamu@users.noreply.github.com>
Co-authored-by: Apple <nandan@thinkify.io>
* chore: Moved height property to General section (#18402)
* fix: Height property is moved to General section
* Logs an Error if section is not General
* fix: Cypress
* enabled auto height for all the widgets except json form
* removes accidentally committed files
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* disabled default auto height for input widgets and select widgets and datepicker widget
* disable feature at generalConfig instead of firstConfig
* add todo comment
* feat: Disable auto height for widgets in List Widget (#18381)
* Remove auto height for container Inside List widget
* remove unneccessary changes
* disable feature at generalConfig instead of firstConfig
* add todo comment
* skipped the get min limit tests
* fixed AutoHeightLimitHandleDot tests
* list widget remove autoLayoutContainer for list widget template children
Co-authored-by: Ankur Singhal <ankur@appsmith.com>
Co-authored-by: Abhinav Jha <abhinav@appsmith.com>
Co-authored-by: Abhinav Jha <zatanna@Abhinavs-iMac.lan>
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com>
Co-authored-by: Albin <albin@appsmith.com>
Co-authored-by: Aswath K <aswath.sana@gmail.com>
Co-authored-by: NandanAnantharamu <67676905+NandanAnantharamu@users.noreply.github.com>
Co-authored-by: Apple <nandan@thinkify.io>
Co-authored-by: Arsalan Yaldram <arsalanyaldram0211@outlook.com>
2022-11-24 21:00:32 +00:00
|
|
|
if (
|
2023-04-07 13:51:35 +00:00
|
|
|
!this.props.isFlexChild &&
|
fix: list widget remove autoLayoutContainer for list widget template children (#18441)
* added an experiment to overflow the content if maxHEight is less
* removed the ref of Textwidget by mistake, added it back
* fixed text widget height overflow problem with a little hack
* added long labels with text
* fixed the table scroll issue
* overflow fixed for json form widget
* added extra 8px height for Switch, Rating and Checkbox Height
* (WIP): Resolve issues
* (WIP): Fix widget padding issue
* added overflow container for Radio and Switch group widgets
* (WIP): Have modals work with dynamic height
* added the overlay and the handles
* added dragging behavior to the dots
* fixed the overlapping with the selection tool
* (WIP): Fix issues reported
* now we can update the property pane values back from overlay handles
* now we can update the property pane values back from overlay handles
* (WIP): Fix table widget
* Fix package.json
* Remove unit tests temporarily
* Fix unit test
* (WIP): Fix modal resize. Fix cursors. Fix border issue on non-resizable widgets
* fetch component heights using the requestAnimationFrame callback
* behavioural changes
* (WIP): Fix issues on the platform
* Update main container size appropriately
* more behavioural changes
* overlay now only be visible when hovering over the dots
* grid showing and widget reselecting
* added onfocus and onblur events to property pane listeners
* added onfocus and onblur events to property pane listeners
* added a range slider for min and max
* added demarcations for slider values
* (WIP): Fix platform workflows for dynamic height
* Fix issues with widgets
* Fix removed import
* - Add missing cypress files
* set the limits
* limit increase on change
* Fix z-index of min max limit indicators. Fix unused-vars warnings
* Fix Table Widget and Text Widget issues
* Fix: all the bugs in the bug master list for DH (#16268)
* changed the zindex for the signifiers
* showing signifiers only when the widget is selected
* made changes suggested by Momcilo
* activate the dots when the fields are active
* created a new centered dot handle
* removed overlays on focus and made the border more like deisgn
* handles on top of other widgets
* hide the overlay when multiple widgets are selected
* added a white border
* added a white border
* bug #15509 resolved
* changed the minDynamicHeightLimit to 2 instead of 4 to fix the Bug #15527
* removed the height auto fix from BaseInputComponent to fix the Bug #15388
* removed the condition to not ccalculate dynamic height when the row difference is less than 2 to fix the bug 15353
* made fixes for the bug #16307
* made fixes for the bug #16308
* made fixes for bug 16310
* made fixes for the bug #16402
* removed some log statements
* made fixes for the bug #16407
* fixed label problem found in the issue #16543
* made fixes for the issue #16547
* made fixes for the bug #16492
* redeploy
* (WIP): Fix to make this branch functional
* imported LabelWithTooltip back from design system
* signifier is now centered
* filled the signifier with primary color
* overlay hidden while dragging
* made the signifier dashed border also draggable
* Fix issue #16590 (#16798)
* set the limits to 4 rows
* replaced the static 40 value
* added signifiers for modal widget
* added signifiers for modal widget
* tried solving the scroll issue for widgets when there are limits
* solved the height problem using ResizeObserver
* (WIP): Fix maxDynamicHeight issue with container widgets:
* made the changes as per the review
* fixed the issue for input widget when label gets out of border
* hide text widget overflow options if auto height is enabled
* (WIP): In view mode, invisible widgets now donot take space (#16920)
* (WIP): In view mode, invisible widgets now donot take space
* (WIP): Enable the feature where invisible widgets in view mode don't take space to all widgets irrespective of the dynamic height feature
* Remove Replay conditional
* removed the scroll container for container type widgets
* removed the scroll container for container type widgets
* updated the hook to set overflow none for text widget
* fixed the should dynamic height logic to respect the min height limit
* Modal widget adheres to dynamic height (#16995)
* Modal widget adheres to dynamic height
* WIP: POC: fix dynamic height issues (#16996)
Fix height less than 4 issue. Fix JSONForm adherence to min and max height
* POC: Dynamic height undo redo issue (#17085)
* Revert debouce timeout
* (WIP): Fix issue with undo-redo in dynamic height
* fix: Dynamic height issue fixes (#17153)
* Dynamic height issue fixes
==
- Fix issue where nested widgets did not ensure parent dynamic height updates
- Fix issue where Modal widget updates came in subsequent renders
- Fix issue where JSONForm collapses
- Fix performance issue for independent updates
* Use functions to get min and max dynamic height
* Fix issue where variable might have been undefined
* added the dynamic container into the deploy mode as well
* added overflow-x hidden when overflow-y is active in the dynamic height container
* fix: Dynamic height Issue fixes (#17204)
Fix preview mode invisible widgets. Fix Tabs widget dynamic height.
* removed a console.log statement
* removed the slider control file
* imported the LabelWithTooltip from the repo rather than ds
* word-break CSS rules added for Switch and Checkbox widget when Dynamic Height is enabled
* abstracted the check for dynamic height with limits enabled as isDynamicHeightWithLimitsEnabledForWidget
* abstracted the static value of 10 in dynamic height overlay to GridDefaults
* abstracted min and max dynamic height limits to getters
* fix: replaced all the refs for simpler widgets (#17353)
* replaced all the refs for simpler widgets
* removed the updateDynamicHeight from componentDidUpdate in BaseWidget
* added back lifecycle methods back to BaseWidget
* removed the contentRef from SwitchGroup and Table
* updating the height from the auto height with limits as well
* some hacks to make the limits work
* working solution
* used setTimeout to send an update to updateDynamicHeight from overlay update
* removed a log
* added requestanimationframe in settimeout
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* Fix issues caused during merge
* Remove unneeded derived property
* removed more unnecessary code which should have been removed after removing the ref dependency
* fixed the maxDynamicHeight issue
* Fix issue where property configs were not being sent
* fix: Auto Height Feature - add selectors for tests (#17687)
Add selectors for auto height cypress tests
* fix: removed height auto default theme (#17415)
removed height auto css rule from the default theme
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
* fix: Auto Height Feature - Resolve issues and restructure code (#17686)
* Fix issues in dynamic height. Restructure code and reduce abstraction leaks
* Fix typescript issues
* Update based on review comments. Comment migrations, as a cyclic import is causing the jest tests to fail.
* Remove unused imports
* Decrease code nesting
* added the base styles for the overlay like position and z-index in its styled component css
* used the isDynamicHeightEnabled prop to set the height of SwitchGroup and RadioGroup widgets from 32px to 100% in case of inline mode
* fix: Auto Height - Resolve issues (#17737)
* Fix Tabs Widget showTabs toggle based auto height. Revert removal of BaseWidget code. Remove box-intersect and use a bruteforce algorithm. Add base logic for having containers collapse due to hidden child widgets
* Hide scroll contents and overflow property pane controls when dynamic height is enabled
* Removed the class property expectedHeight from BaseWidget as it is not useful in the overlay logic after some changes
* fixed the left alignment issue of label in the rich text editor by adding some styles applied only when the dynamic height is enabled
* fixed the input field stretching issue in case of Dynamic height by adding some CSS styles when isDynamicHeight is true
* Fix failing modal widget cypress tests
* Fix issue with scrollContents and Tabs Widget defaulTab
* added a little bit padding of 4px to the right of scroll container of dynamic height with limit
* Add test locators for resize handles
* removed the dynamic height logic from the table widget
* fix: Auto-Height invisible widgets (#17849)
* Fix issue where invisible widgets were still taking space
* Make sure to collapse only if dynamic height is enabled
* Fix issues with reflow (not the invisible widgets)
* Fix container min height issues
* Fix reflow with original bottom and top values. Testing needed
* Fix invisible widgets
* fix: enabled dynamic height for stat box widget (#17971)
enabled dynamic height for stat box widget
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: added a min height to rich text editor so that it does not collapse (#17970)
added a min height to rich text editor so that it does not collapse
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* Fix issue with resizing auto height widget
* Add helper text to educate users regarding the scroll disconnect in WYSIWYG
* fix: Auto Height Fixes (#18111)
AUTO HEIGHT FIXES
- Fix JSONForm height discrepancy
- Fix issue where widgets moved below the other
- Fix droptarget height after parent container resize
* fix: sliced up the DynamicHeightOverlay component a little bit (#18100)
* sliced up the DynamicHeightOverlay component a little bit
* more refactoring
* more refactoring
* used release event emitter and refactored more
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: rich text editor center alignment issue (#18142)
* removed the center alignment from rich text editor
* dummy commit
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: old DSL container collapse (#18160)
* Fix issue where old containers from old DSLs used to collapse when auto height was enabled
* Fix issue where old containers don't allow new widgets to be added when auto height is enabled, this is because the shouldScrollContents is undefined
* fix: input widgets issue (#18172)
fixed the auto height not working issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: preview deploy mode (#18174)
fixed the preview and deploy mode
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits label intersection with handle dot (#18186)
fixed the position of the limits label to the right so that it will not intersect with the handle dot
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits rich text editor min height (#18187)
decrease the min height of the RTE so that it does not have the boundary issue with the max limit when auto height with limits is enabled
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: grammatical error in the help text (#18188)
changed react to reacts in the helpText of the dynamic height property in the proeprty pane
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height tabs double scroll (#18210)
solved the issue by disabling the scroll for the child canvas widget in the tabs widget
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits resizing (#18213)
* fixed the auto height limits resizing issue
* made the auto height overlay independent of isResizing and used its own property to show the grid
* some more refactoring
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* dummy commit
* fix: old apps container issue (#18255)
filtered out the widgets which are detached from layout
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: fixing auto height in childless containers. (#18263)
fixing auto height in childless containers.
* task: Dynamic height reflow fixes in Branch (#18244)
dynamic height reflow fixes
* fix: compact label issue and min and max limits numeric input (#18282)
fixed compact label issue and turned min and max limits to numeric input
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: LabelWithTooltip help icon fix
* fix: NaN and min limit for min and max (#18284)
* fixed compact label issue and turned min and max limits to numeric input
* fixed NaN and set min to be 4
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: validation issues for min max (#18286)
* fixed compact label issue and turned min and max limits to numeric input
* fixed NaN and set min to be 4
* validations start working min max
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* added a full stop to container scroll helper text
* validations start working min max
* dummy commit
* feat: stop resizing auto height widgets vertically because of Drag n Drop Reflow (#18267)
* reflow fixes
* stop resizing auto height widgets vertically because of Drag n Drop Reflow
* feat: Analytics for Dynamic height (#18279)
* Fix canvas min height issue and invisible widgets issue and remove logs and fix issue where widgets overlapped when coming back from preview mode to edit mode
* Fix issue with containers not respecting auto height and decreasing height
* Fix issue with modal widget not hugging contents, and container widgets never become visible after going invisible
* Fix issue where existing containers don't have correct min height for child canvas
* fix: canvasLevelsReducers test (#18301)
fixed the canvasLevelsReducers test
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: removed auto height min max config from widget features (#18316)
removed auto height min max config from widget features
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: Fixing Modal Height updates (#18317)
Fixing Modal Height updates
* fix: text widget background auto height (#18319)
added background color of Text widget back to the auto height container
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* test: cypress tests for auto height (#17676)
* Added tests for dynamic height
* updated tests for another usecase
* moved locators into commonfile
* updated common method
* added tests for some more widgets
* Added tests for jsonForm / Form widget
* Updated the test
* updated test for multiple text widgets
* updated test with few more usecases
* updated the dsl
* updated tests for text change
* updated tests based on new changes
* updated cypress test fixes
* fix: auto height container merge poc wrt release (#18334)
updated the poc wrt PR already merged in the release regarding the auto height container
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: renamed auto height overlay components and added some tests (#18333)
* renamed auto height overlay components and added some tests
* replaced the 10 value with GridDefaults
* avoiding event to reach drop target
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* updated tests
* Merge all code into one branch
* Fix failing AutoHeightcontainer test
* fix: Fix reflow computations which were causing widget overlap (#18300)
* Fix reflow computations which were causing widget overlap
* Fix issues with parent container height and overlapping widgets
* Remove console logs
* Revert comment
* Fix issues related to reflow of containers
* feat: Making getEffectedBoxes a Recursive function in autoHeight Reflow (#18336)
Making getEffectedBoxes a Recursive function in autoHeight Reflow
* Return null for invisible widgets from withWidgetProps
* Remove duplicate import
Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com>
* Remove missed console log
* fix: Label position gets deselected on selecting already selected option (#18298)
* fix: Label position gets deselected on selecting the already selected value
* Added migration for Currency & Phone input widgets
* simplify migration function using a utility
* combine conditions
* Increments LATEST_PAGE_VERSION
* Update DynamicHeight_Visibility_spec.js
updated a check wrt auto height
* Handling Modals for canvas size calculations
* fix: migrate label position test failing issue (#18365)
fixed migrate label postition test failing issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* removed the two unwanted imports from DSLMigrations to fix client build
* fix: Auto height zero and limits issue (#18366)
fixed the auto height zero and limits issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: Auto height regression issues (#18367)
* Fix auto height regression issues #18367
* feat: auto height migrations (#18368)
Add auto height migrations
* Increase file caching size
* Use manual array for list of auto height enabled widgets
* Fix cypress test dsl versions
* Revert changes to shouldUpdateHeightDynamically
* Update test results based on code changes
* Marginally increase the workbox file size cache
* review comment incorporated for test spec
* Update container auto height property on drop
* Remove auto height for container Inside List widget
* remove unneccessary changes
* removed block and added flex consistent in the alignment case of left and right
* fixed radio group which broke because of display block
* default enabled auto height for every widget
* added reivew changes
* reverted the switch group style changes and added the check for Text widget background in the AutoHeightContainer
* changed the scroll helper text for containers
* reverted the default enable for all the widgets
* test: fixed DH flaky test (#18415)
fixed DH flaky test
* fix: auto height container computations (#18408)
* Fix auto height container computations
* fix: Invisible Widgets Overlap while switching back and forth between edit and preview modes in rare cases (#18398)
sort Space based on original position if dynamic positions are equal while generating tree
* fix: group widgets label alignment. (#18360)
* fix: group widgets label alignment.
* fix: switch and radio fix transform styles for auto height.
* feat: disable auto height limits for modal (#18386)
* added multi select back
* (WIP): Complete the dynamc height update logic
* (WIP): Dynamic height logic
* (WIP): Container computation logic, Next steps: Prevent reflow when resize is disabled. Fix logic of widgets randomly changing positions (Debug)
* Fix logic in container computations
* Integrate for PoC
* fixed the no initial load dynamic height updates
* Stop vertical resize and reflow when dynamic height is enabled for a widget
* added another container in text widget
* enabled dynamic height for container widgets
* removed dynamic height feature from list widget
* Fixed Button and Input components height increase
* added an experiment to overflow the content if maxHEight is less
* removed the ref of Textwidget by mistake, added it back
* fixed text widget height overflow problem with a little hack
* added long labels with text
* fixed the table scroll issue
* overflow fixed for json form widget
* added extra 8px height for Switch, Rating and Checkbox Height
* (WIP): Resolve issues
* (WIP): Fix widget padding issue
* added overflow container for Radio and Switch group widgets
* (WIP): Have modals work with dynamic height
* added the overlay and the handles
* added dragging behavior to the dots
* fixed the overlapping with the selection tool
* (WIP): Fix issues reported
* now we can update the property pane values back from overlay handles
* now we can update the property pane values back from overlay handles
* (WIP): Fix table widget
* Fix package.json
* Remove unit tests temporarily
* Fix unit test
* (WIP): Fix modal resize. Fix cursors. Fix border issue on non-resizable widgets
* fetch component heights using the requestAnimationFrame callback
* behavioural changes
* (WIP): Fix issues on the platform
* Update main container size appropriately
* more behavioural changes
* overlay now only be visible when hovering over the dots
* grid showing and widget reselecting
* added onfocus and onblur events to property pane listeners
* added onfocus and onblur events to property pane listeners
* added a range slider for min and max
* added demarcations for slider values
* (WIP): Fix platform workflows for dynamic height
* Fix issues with widgets
* Fix removed import
* - Add missing cypress files
* set the limits
* limit increase on change
* Fix z-index of min max limit indicators. Fix unused-vars warnings
* Fix Table Widget and Text Widget issues
* Fix: all the bugs in the bug master list for DH (#16268)
* changed the zindex for the signifiers
* showing signifiers only when the widget is selected
* made changes suggested by Momcilo
* activate the dots when the fields are active
* created a new centered dot handle
* removed overlays on focus and made the border more like deisgn
* handles on top of other widgets
* hide the overlay when multiple widgets are selected
* added a white border
* added a white border
* bug #15509 resolved
* changed the minDynamicHeightLimit to 2 instead of 4 to fix the Bug #15527
* removed the height auto fix from BaseInputComponent to fix the Bug #15388
* removed the condition to not ccalculate dynamic height when the row difference is less than 2 to fix the bug 15353
* made fixes for the bug #16307
* made fixes for the bug #16308
* made fixes for bug 16310
* made fixes for the bug #16402
* removed some log statements
* made fixes for the bug #16407
* fixed label problem found in the issue #16543
* made fixes for the issue #16547
* made fixes for the bug #16492
* redeploy
* (WIP): Fix to make this branch functional
* imported LabelWithTooltip back from design system
* signifier is now centered
* filled the signifier with primary color
* overlay hidden while dragging
* made the signifier dashed border also draggable
* Fix issue #16590 (#16798)
* set the limits to 4 rows
* replaced the static 40 value
* added signifiers for modal widget
* added signifiers for modal widget
* tried solving the scroll issue for widgets when there are limits
* solved the height problem using ResizeObserver
* (WIP): Fix maxDynamicHeight issue with container widgets:
* made the changes as per the review
* fixed the issue for input widget when label gets out of border
* hide text widget overflow options if auto height is enabled
* (WIP): In view mode, invisible widgets now donot take space (#16920)
* (WIP): In view mode, invisible widgets now donot take space
* (WIP): Enable the feature where invisible widgets in view mode don't take space to all widgets irrespective of the dynamic height feature
* Remove Replay conditional
* removed the scroll container for container type widgets
* removed the scroll container for container type widgets
* updated the hook to set overflow none for text widget
* fixed the should dynamic height logic to respect the min height limit
* Modal widget adheres to dynamic height (#16995)
* Modal widget adheres to dynamic height
* WIP: POC: fix dynamic height issues (#16996)
Fix height less than 4 issue. Fix JSONForm adherence to min and max height
* POC: Dynamic height undo redo issue (#17085)
* Revert debouce timeout
* (WIP): Fix issue with undo-redo in dynamic height
* fix: Dynamic height issue fixes (#17153)
* Dynamic height issue fixes
==
- Fix issue where nested widgets did not ensure parent dynamic height updates
- Fix issue where Modal widget updates came in subsequent renders
- Fix issue where JSONForm collapses
- Fix performance issue for independent updates
* Use functions to get min and max dynamic height
* Fix issue where variable might have been undefined
* added the dynamic container into the deploy mode as well
* added overflow-x hidden when overflow-y is active in the dynamic height container
* fix: Dynamic height Issue fixes (#17204)
Fix preview mode invisible widgets. Fix Tabs widget dynamic height.
* removed a console.log statement
* removed the slider control file
* imported the LabelWithTooltip from the repo rather than ds
* word-break CSS rules added for Switch and Checkbox widget when Dynamic Height is enabled
* abstracted the check for dynamic height with limits enabled as isDynamicHeightWithLimitsEnabledForWidget
* abstracted the static value of 10 in dynamic height overlay to GridDefaults
* abstracted min and max dynamic height limits to getters
* fix: replaced all the refs for simpler widgets (#17353)
* replaced all the refs for simpler widgets
* removed the updateDynamicHeight from componentDidUpdate in BaseWidget
* added back lifecycle methods back to BaseWidget
* removed the contentRef from SwitchGroup and Table
* updating the height from the auto height with limits as well
* some hacks to make the limits work
* working solution
* used setTimeout to send an update to updateDynamicHeight from overlay update
* removed a log
* added requestanimationframe in settimeout
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* Fix issues caused during merge
* Remove unneeded derived property
* removed more unnecessary code which should have been removed after removing the ref dependency
* fixed the maxDynamicHeight issue
* Fix issue where property configs were not being sent
* fix: Auto Height Feature - add selectors for tests (#17687)
Add selectors for auto height cypress tests
* fix: removed height auto default theme (#17415)
removed height auto css rule from the default theme
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
* fix: Auto Height Feature - Resolve issues and restructure code (#17686)
* Fix issues in dynamic height. Restructure code and reduce abstraction leaks
* Fix typescript issues
* Update based on review comments. Comment migrations, as a cyclic import is causing the jest tests to fail.
* Remove unused imports
* Decrease code nesting
* added the base styles for the overlay like position and z-index in its styled component css
* used the isDynamicHeightEnabled prop to set the height of SwitchGroup and RadioGroup widgets from 32px to 100% in case of inline mode
* fix: Auto Height - Resolve issues (#17737)
* Fix Tabs Widget showTabs toggle based auto height. Revert removal of BaseWidget code. Remove box-intersect and use a bruteforce algorithm. Add base logic for having containers collapse due to hidden child widgets
* Hide scroll contents and overflow property pane controls when dynamic height is enabled
* Removed the class property expectedHeight from BaseWidget as it is not useful in the overlay logic after some changes
* fixed the left alignment issue of label in the rich text editor by adding some styles applied only when the dynamic height is enabled
* fixed the input field stretching issue in case of Dynamic height by adding some CSS styles when isDynamicHeight is true
* Fix failing modal widget cypress tests
* Fix issue with scrollContents and Tabs Widget defaulTab
* added a little bit padding of 4px to the right of scroll container of dynamic height with limit
* Add test locators for resize handles
* removed the dynamic height logic from the table widget
* fix: Auto-Height invisible widgets (#17849)
* Fix issue where invisible widgets were still taking space
* Make sure to collapse only if dynamic height is enabled
* Fix issues with reflow (not the invisible widgets)
* Fix container min height issues
* Fix reflow with original bottom and top values. Testing needed
* Fix invisible widgets
* fix: enabled dynamic height for stat box widget (#17971)
enabled dynamic height for stat box widget
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: added a min height to rich text editor so that it does not collapse (#17970)
added a min height to rich text editor so that it does not collapse
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* Fix issue with resizing auto height widget
* Add helper text to educate users regarding the scroll disconnect in WYSIWYG
* fix: Auto Height Fixes (#18111)
AUTO HEIGHT FIXES
- Fix JSONForm height discrepancy
- Fix issue where widgets moved below the other
- Fix droptarget height after parent container resize
* fix: sliced up the DynamicHeightOverlay component a little bit (#18100)
* sliced up the DynamicHeightOverlay component a little bit
* more refactoring
* more refactoring
* used release event emitter and refactored more
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: rich text editor center alignment issue (#18142)
* removed the center alignment from rich text editor
* dummy commit
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: old DSL container collapse (#18160)
* Fix issue where old containers from old DSLs used to collapse when auto height was enabled
* Fix issue where old containers don't allow new widgets to be added when auto height is enabled, this is because the shouldScrollContents is undefined
* fix: input widgets issue (#18172)
fixed the auto height not working issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: preview deploy mode (#18174)
fixed the preview and deploy mode
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits label intersection with handle dot (#18186)
fixed the position of the limits label to the right so that it will not intersect with the handle dot
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits rich text editor min height (#18187)
decrease the min height of the RTE so that it does not have the boundary issue with the max limit when auto height with limits is enabled
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: grammatical error in the help text (#18188)
changed react to reacts in the helpText of the dynamic height property in the proeprty pane
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height tabs double scroll (#18210)
solved the issue by disabling the scroll for the child canvas widget in the tabs widget
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits resizing (#18213)
* fixed the auto height limits resizing issue
* made the auto height overlay independent of isResizing and used its own property to show the grid
* some more refactoring
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* dummy commit
* fix: old apps container issue (#18255)
filtered out the widgets which are detached from layout
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: fixing auto height in childless containers. (#18263)
fixing auto height in childless containers.
* task: Dynamic height reflow fixes in Branch (#18244)
dynamic height reflow fixes
* fix: compact label issue and min and max limits numeric input (#18282)
fixed compact label issue and turned min and max limits to numeric input
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: LabelWithTooltip help icon fix
* fix: NaN and min limit for min and max (#18284)
* fixed compact label issue and turned min and max limits to numeric input
* fixed NaN and set min to be 4
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: validation issues for min max (#18286)
* fixed compact label issue and turned min and max limits to numeric input
* fixed NaN and set min to be 4
* validations start working min max
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* added a full stop to container scroll helper text
* validations start working min max
* dummy commit
* feat: stop resizing auto height widgets vertically because of Drag n Drop Reflow (#18267)
* reflow fixes
* stop resizing auto height widgets vertically because of Drag n Drop Reflow
* feat: Analytics for Dynamic height (#18279)
* Fix canvas min height issue and invisible widgets issue and remove logs and fix issue where widgets overlapped when coming back from preview mode to edit mode
* Fix issue with containers not respecting auto height and decreasing height
* Fix issue with modal widget not hugging contents, and container widgets never become visible after going invisible
* Fix issue where existing containers don't have correct min height for child canvas
* fix: canvasLevelsReducers test (#18301)
fixed the canvasLevelsReducers test
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: removed auto height min max config from widget features (#18316)
removed auto height min max config from widget features
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: Fixing Modal Height updates (#18317)
Fixing Modal Height updates
* fix: text widget background auto height (#18319)
added background color of Text widget back to the auto height container
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* test: cypress tests for auto height (#17676)
* Added tests for dynamic height
* updated tests for another usecase
* moved locators into commonfile
* updated common method
* added tests for some more widgets
* Added tests for jsonForm / Form widget
* Updated the test
* updated test for multiple text widgets
* updated test with few more usecases
* updated the dsl
* updated tests for text change
* updated tests based on new changes
* updated cypress test fixes
* fix: auto height container merge poc wrt release (#18334)
updated the poc wrt PR already merged in the release regarding the auto height container
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: renamed auto height overlay components and added some tests (#18333)
* renamed auto height overlay components and added some tests
* replaced the 10 value with GridDefaults
* avoiding event to reach drop target
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* updated tests
* Merge all code into one branch
* Fix failing AutoHeightcontainer test
* fix: Fix reflow computations which were causing widget overlap (#18300)
* Fix reflow computations which were causing widget overlap
* Fix issues with parent container height and overlapping widgets
* Remove console logs
* Revert comment
* Fix issues related to reflow of containers
* feat: Making getEffectedBoxes a Recursive function in autoHeight Reflow (#18336)
Making getEffectedBoxes a Recursive function in autoHeight Reflow
* Return null for invisible widgets from withWidgetProps
* Remove duplicate import
Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com>
* Remove missed console log
* fix: Label position gets deselected on selecting already selected option (#18298)
* fix: Label position gets deselected on selecting the already selected value
* Added migration for Currency & Phone input widgets
* simplify migration function using a utility
* combine conditions
* Increments LATEST_PAGE_VERSION
* Update DynamicHeight_Visibility_spec.js
updated a check wrt auto height
* Handling Modals for canvas size calculations
* fix: migrate label position test failing issue (#18365)
fixed migrate label postition test failing issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* removed the two unwanted imports from DSLMigrations to fix client build
* fix: Auto height zero and limits issue (#18366)
fixed the auto height zero and limits issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: Auto height regression issues (#18367)
* Fix auto height regression issues #18367
* feat: auto height migrations (#18368)
Add auto height migrations
* Increase file caching size
* Use manual array for list of auto height enabled widgets
* Fix cypress test dsl versions
* Revert changes to shouldUpdateHeightDynamically
* Update test results based on code changes
* Marginally increase the workbox file size cache
* review comment incorporated for test spec
* Update container auto height property on drop
* Disable auto height with limits for modal
Co-authored-by: Ankur Singhal <ankur@appsmith.com>
Co-authored-by: rahulramesha <rahul@appsmith.com>
Co-authored-by: Abhinav Jha <zatanna@Abhinavs-iMac.lan>
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com>
Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com>
Co-authored-by: Albin <albin@appsmith.com>
Co-authored-by: Aswath K <aswath.sana@gmail.com>
Co-authored-by: NandanAnantharamu <67676905+NandanAnantharamu@users.noreply.github.com>
Co-authored-by: Apple <nandan@thinkify.io>
* chore: Moved height property to General section (#18402)
* fix: Height property is moved to General section
* Logs an Error if section is not General
* fix: Cypress
* enabled auto height for all the widgets except json form
* removes accidentally committed files
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* disabled default auto height for input widgets and select widgets and datepicker widget
* disable feature at generalConfig instead of firstConfig
* add todo comment
* feat: Disable auto height for widgets in List Widget (#18381)
* Remove auto height for container Inside List widget
* remove unneccessary changes
* disable feature at generalConfig instead of firstConfig
* add todo comment
* skipped the get min limit tests
* fixed AutoHeightLimitHandleDot tests
* list widget remove autoLayoutContainer for list widget template children
Co-authored-by: Ankur Singhal <ankur@appsmith.com>
Co-authored-by: Abhinav Jha <abhinav@appsmith.com>
Co-authored-by: Abhinav Jha <zatanna@Abhinavs-iMac.lan>
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com>
Co-authored-by: Albin <albin@appsmith.com>
Co-authored-by: Aswath K <aswath.sana@gmail.com>
Co-authored-by: NandanAnantharamu <67676905+NandanAnantharamu@users.noreply.github.com>
Co-authored-by: Apple <nandan@thinkify.io>
Co-authored-by: Arsalan Yaldram <arsalanyaldram0211@outlook.com>
2022-11-24 21:00:32 +00:00
|
|
|
isAutoHeightEnabledForWidget(this.props) &&
|
2022-12-11 15:21:46 +00:00
|
|
|
!this.props.isAutoGeneratedWidget && // To skip list widget's auto generated widgets
|
|
|
|
|
!this.props.detachFromLayout // To skip Modal widget issue #18697
|
fix: list widget remove autoLayoutContainer for list widget template children (#18441)
* added an experiment to overflow the content if maxHEight is less
* removed the ref of Textwidget by mistake, added it back
* fixed text widget height overflow problem with a little hack
* added long labels with text
* fixed the table scroll issue
* overflow fixed for json form widget
* added extra 8px height for Switch, Rating and Checkbox Height
* (WIP): Resolve issues
* (WIP): Fix widget padding issue
* added overflow container for Radio and Switch group widgets
* (WIP): Have modals work with dynamic height
* added the overlay and the handles
* added dragging behavior to the dots
* fixed the overlapping with the selection tool
* (WIP): Fix issues reported
* now we can update the property pane values back from overlay handles
* now we can update the property pane values back from overlay handles
* (WIP): Fix table widget
* Fix package.json
* Remove unit tests temporarily
* Fix unit test
* (WIP): Fix modal resize. Fix cursors. Fix border issue on non-resizable widgets
* fetch component heights using the requestAnimationFrame callback
* behavioural changes
* (WIP): Fix issues on the platform
* Update main container size appropriately
* more behavioural changes
* overlay now only be visible when hovering over the dots
* grid showing and widget reselecting
* added onfocus and onblur events to property pane listeners
* added onfocus and onblur events to property pane listeners
* added a range slider for min and max
* added demarcations for slider values
* (WIP): Fix platform workflows for dynamic height
* Fix issues with widgets
* Fix removed import
* - Add missing cypress files
* set the limits
* limit increase on change
* Fix z-index of min max limit indicators. Fix unused-vars warnings
* Fix Table Widget and Text Widget issues
* Fix: all the bugs in the bug master list for DH (#16268)
* changed the zindex for the signifiers
* showing signifiers only when the widget is selected
* made changes suggested by Momcilo
* activate the dots when the fields are active
* created a new centered dot handle
* removed overlays on focus and made the border more like deisgn
* handles on top of other widgets
* hide the overlay when multiple widgets are selected
* added a white border
* added a white border
* bug #15509 resolved
* changed the minDynamicHeightLimit to 2 instead of 4 to fix the Bug #15527
* removed the height auto fix from BaseInputComponent to fix the Bug #15388
* removed the condition to not ccalculate dynamic height when the row difference is less than 2 to fix the bug 15353
* made fixes for the bug #16307
* made fixes for the bug #16308
* made fixes for bug 16310
* made fixes for the bug #16402
* removed some log statements
* made fixes for the bug #16407
* fixed label problem found in the issue #16543
* made fixes for the issue #16547
* made fixes for the bug #16492
* redeploy
* (WIP): Fix to make this branch functional
* imported LabelWithTooltip back from design system
* signifier is now centered
* filled the signifier with primary color
* overlay hidden while dragging
* made the signifier dashed border also draggable
* Fix issue #16590 (#16798)
* set the limits to 4 rows
* replaced the static 40 value
* added signifiers for modal widget
* added signifiers for modal widget
* tried solving the scroll issue for widgets when there are limits
* solved the height problem using ResizeObserver
* (WIP): Fix maxDynamicHeight issue with container widgets:
* made the changes as per the review
* fixed the issue for input widget when label gets out of border
* hide text widget overflow options if auto height is enabled
* (WIP): In view mode, invisible widgets now donot take space (#16920)
* (WIP): In view mode, invisible widgets now donot take space
* (WIP): Enable the feature where invisible widgets in view mode don't take space to all widgets irrespective of the dynamic height feature
* Remove Replay conditional
* removed the scroll container for container type widgets
* removed the scroll container for container type widgets
* updated the hook to set overflow none for text widget
* fixed the should dynamic height logic to respect the min height limit
* Modal widget adheres to dynamic height (#16995)
* Modal widget adheres to dynamic height
* WIP: POC: fix dynamic height issues (#16996)
Fix height less than 4 issue. Fix JSONForm adherence to min and max height
* POC: Dynamic height undo redo issue (#17085)
* Revert debouce timeout
* (WIP): Fix issue with undo-redo in dynamic height
* fix: Dynamic height issue fixes (#17153)
* Dynamic height issue fixes
==
- Fix issue where nested widgets did not ensure parent dynamic height updates
- Fix issue where Modal widget updates came in subsequent renders
- Fix issue where JSONForm collapses
- Fix performance issue for independent updates
* Use functions to get min and max dynamic height
* Fix issue where variable might have been undefined
* added the dynamic container into the deploy mode as well
* added overflow-x hidden when overflow-y is active in the dynamic height container
* fix: Dynamic height Issue fixes (#17204)
Fix preview mode invisible widgets. Fix Tabs widget dynamic height.
* removed a console.log statement
* removed the slider control file
* imported the LabelWithTooltip from the repo rather than ds
* word-break CSS rules added for Switch and Checkbox widget when Dynamic Height is enabled
* abstracted the check for dynamic height with limits enabled as isDynamicHeightWithLimitsEnabledForWidget
* abstracted the static value of 10 in dynamic height overlay to GridDefaults
* abstracted min and max dynamic height limits to getters
* fix: replaced all the refs for simpler widgets (#17353)
* replaced all the refs for simpler widgets
* removed the updateDynamicHeight from componentDidUpdate in BaseWidget
* added back lifecycle methods back to BaseWidget
* removed the contentRef from SwitchGroup and Table
* updating the height from the auto height with limits as well
* some hacks to make the limits work
* working solution
* used setTimeout to send an update to updateDynamicHeight from overlay update
* removed a log
* added requestanimationframe in settimeout
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* Fix issues caused during merge
* Remove unneeded derived property
* removed more unnecessary code which should have been removed after removing the ref dependency
* fixed the maxDynamicHeight issue
* Fix issue where property configs were not being sent
* fix: Auto Height Feature - add selectors for tests (#17687)
Add selectors for auto height cypress tests
* fix: removed height auto default theme (#17415)
removed height auto css rule from the default theme
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
* fix: Auto Height Feature - Resolve issues and restructure code (#17686)
* Fix issues in dynamic height. Restructure code and reduce abstraction leaks
* Fix typescript issues
* Update based on review comments. Comment migrations, as a cyclic import is causing the jest tests to fail.
* Remove unused imports
* Decrease code nesting
* added the base styles for the overlay like position and z-index in its styled component css
* used the isDynamicHeightEnabled prop to set the height of SwitchGroup and RadioGroup widgets from 32px to 100% in case of inline mode
* fix: Auto Height - Resolve issues (#17737)
* Fix Tabs Widget showTabs toggle based auto height. Revert removal of BaseWidget code. Remove box-intersect and use a bruteforce algorithm. Add base logic for having containers collapse due to hidden child widgets
* Hide scroll contents and overflow property pane controls when dynamic height is enabled
* Removed the class property expectedHeight from BaseWidget as it is not useful in the overlay logic after some changes
* fixed the left alignment issue of label in the rich text editor by adding some styles applied only when the dynamic height is enabled
* fixed the input field stretching issue in case of Dynamic height by adding some CSS styles when isDynamicHeight is true
* Fix failing modal widget cypress tests
* Fix issue with scrollContents and Tabs Widget defaulTab
* added a little bit padding of 4px to the right of scroll container of dynamic height with limit
* Add test locators for resize handles
* removed the dynamic height logic from the table widget
* fix: Auto-Height invisible widgets (#17849)
* Fix issue where invisible widgets were still taking space
* Make sure to collapse only if dynamic height is enabled
* Fix issues with reflow (not the invisible widgets)
* Fix container min height issues
* Fix reflow with original bottom and top values. Testing needed
* Fix invisible widgets
* fix: enabled dynamic height for stat box widget (#17971)
enabled dynamic height for stat box widget
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: added a min height to rich text editor so that it does not collapse (#17970)
added a min height to rich text editor so that it does not collapse
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* Fix issue with resizing auto height widget
* Add helper text to educate users regarding the scroll disconnect in WYSIWYG
* fix: Auto Height Fixes (#18111)
AUTO HEIGHT FIXES
- Fix JSONForm height discrepancy
- Fix issue where widgets moved below the other
- Fix droptarget height after parent container resize
* fix: sliced up the DynamicHeightOverlay component a little bit (#18100)
* sliced up the DynamicHeightOverlay component a little bit
* more refactoring
* more refactoring
* used release event emitter and refactored more
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: rich text editor center alignment issue (#18142)
* removed the center alignment from rich text editor
* dummy commit
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: old DSL container collapse (#18160)
* Fix issue where old containers from old DSLs used to collapse when auto height was enabled
* Fix issue where old containers don't allow new widgets to be added when auto height is enabled, this is because the shouldScrollContents is undefined
* fix: input widgets issue (#18172)
fixed the auto height not working issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: preview deploy mode (#18174)
fixed the preview and deploy mode
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits label intersection with handle dot (#18186)
fixed the position of the limits label to the right so that it will not intersect with the handle dot
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits rich text editor min height (#18187)
decrease the min height of the RTE so that it does not have the boundary issue with the max limit when auto height with limits is enabled
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: grammatical error in the help text (#18188)
changed react to reacts in the helpText of the dynamic height property in the proeprty pane
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height tabs double scroll (#18210)
solved the issue by disabling the scroll for the child canvas widget in the tabs widget
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits resizing (#18213)
* fixed the auto height limits resizing issue
* made the auto height overlay independent of isResizing and used its own property to show the grid
* some more refactoring
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* dummy commit
* fix: old apps container issue (#18255)
filtered out the widgets which are detached from layout
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: fixing auto height in childless containers. (#18263)
fixing auto height in childless containers.
* task: Dynamic height reflow fixes in Branch (#18244)
dynamic height reflow fixes
* fix: compact label issue and min and max limits numeric input (#18282)
fixed compact label issue and turned min and max limits to numeric input
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: LabelWithTooltip help icon fix
* fix: NaN and min limit for min and max (#18284)
* fixed compact label issue and turned min and max limits to numeric input
* fixed NaN and set min to be 4
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: validation issues for min max (#18286)
* fixed compact label issue and turned min and max limits to numeric input
* fixed NaN and set min to be 4
* validations start working min max
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* added a full stop to container scroll helper text
* validations start working min max
* dummy commit
* feat: stop resizing auto height widgets vertically because of Drag n Drop Reflow (#18267)
* reflow fixes
* stop resizing auto height widgets vertically because of Drag n Drop Reflow
* feat: Analytics for Dynamic height (#18279)
* Fix canvas min height issue and invisible widgets issue and remove logs and fix issue where widgets overlapped when coming back from preview mode to edit mode
* Fix issue with containers not respecting auto height and decreasing height
* Fix issue with modal widget not hugging contents, and container widgets never become visible after going invisible
* Fix issue where existing containers don't have correct min height for child canvas
* fix: canvasLevelsReducers test (#18301)
fixed the canvasLevelsReducers test
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: removed auto height min max config from widget features (#18316)
removed auto height min max config from widget features
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: Fixing Modal Height updates (#18317)
Fixing Modal Height updates
* fix: text widget background auto height (#18319)
added background color of Text widget back to the auto height container
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* test: cypress tests for auto height (#17676)
* Added tests for dynamic height
* updated tests for another usecase
* moved locators into commonfile
* updated common method
* added tests for some more widgets
* Added tests for jsonForm / Form widget
* Updated the test
* updated test for multiple text widgets
* updated test with few more usecases
* updated the dsl
* updated tests for text change
* updated tests based on new changes
* updated cypress test fixes
* fix: auto height container merge poc wrt release (#18334)
updated the poc wrt PR already merged in the release regarding the auto height container
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: renamed auto height overlay components and added some tests (#18333)
* renamed auto height overlay components and added some tests
* replaced the 10 value with GridDefaults
* avoiding event to reach drop target
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* updated tests
* Merge all code into one branch
* Fix failing AutoHeightcontainer test
* fix: Fix reflow computations which were causing widget overlap (#18300)
* Fix reflow computations which were causing widget overlap
* Fix issues with parent container height and overlapping widgets
* Remove console logs
* Revert comment
* Fix issues related to reflow of containers
* feat: Making getEffectedBoxes a Recursive function in autoHeight Reflow (#18336)
Making getEffectedBoxes a Recursive function in autoHeight Reflow
* Return null for invisible widgets from withWidgetProps
* Remove duplicate import
Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com>
* Remove missed console log
* fix: Label position gets deselected on selecting already selected option (#18298)
* fix: Label position gets deselected on selecting the already selected value
* Added migration for Currency & Phone input widgets
* simplify migration function using a utility
* combine conditions
* Increments LATEST_PAGE_VERSION
* Update DynamicHeight_Visibility_spec.js
updated a check wrt auto height
* Handling Modals for canvas size calculations
* fix: migrate label position test failing issue (#18365)
fixed migrate label postition test failing issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* removed the two unwanted imports from DSLMigrations to fix client build
* fix: Auto height zero and limits issue (#18366)
fixed the auto height zero and limits issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: Auto height regression issues (#18367)
* Fix auto height regression issues #18367
* feat: auto height migrations (#18368)
Add auto height migrations
* Increase file caching size
* Use manual array for list of auto height enabled widgets
* Fix cypress test dsl versions
* Revert changes to shouldUpdateHeightDynamically
* Update test results based on code changes
* Marginally increase the workbox file size cache
* review comment incorporated for test spec
* Update container auto height property on drop
* Remove auto height for container Inside List widget
* remove unneccessary changes
* removed block and added flex consistent in the alignment case of left and right
* fixed radio group which broke because of display block
* default enabled auto height for every widget
* added reivew changes
* reverted the switch group style changes and added the check for Text widget background in the AutoHeightContainer
* changed the scroll helper text for containers
* reverted the default enable for all the widgets
* test: fixed DH flaky test (#18415)
fixed DH flaky test
* fix: auto height container computations (#18408)
* Fix auto height container computations
* fix: Invisible Widgets Overlap while switching back and forth between edit and preview modes in rare cases (#18398)
sort Space based on original position if dynamic positions are equal while generating tree
* fix: group widgets label alignment. (#18360)
* fix: group widgets label alignment.
* fix: switch and radio fix transform styles for auto height.
* feat: disable auto height limits for modal (#18386)
* added multi select back
* (WIP): Complete the dynamc height update logic
* (WIP): Dynamic height logic
* (WIP): Container computation logic, Next steps: Prevent reflow when resize is disabled. Fix logic of widgets randomly changing positions (Debug)
* Fix logic in container computations
* Integrate for PoC
* fixed the no initial load dynamic height updates
* Stop vertical resize and reflow when dynamic height is enabled for a widget
* added another container in text widget
* enabled dynamic height for container widgets
* removed dynamic height feature from list widget
* Fixed Button and Input components height increase
* added an experiment to overflow the content if maxHEight is less
* removed the ref of Textwidget by mistake, added it back
* fixed text widget height overflow problem with a little hack
* added long labels with text
* fixed the table scroll issue
* overflow fixed for json form widget
* added extra 8px height for Switch, Rating and Checkbox Height
* (WIP): Resolve issues
* (WIP): Fix widget padding issue
* added overflow container for Radio and Switch group widgets
* (WIP): Have modals work with dynamic height
* added the overlay and the handles
* added dragging behavior to the dots
* fixed the overlapping with the selection tool
* (WIP): Fix issues reported
* now we can update the property pane values back from overlay handles
* now we can update the property pane values back from overlay handles
* (WIP): Fix table widget
* Fix package.json
* Remove unit tests temporarily
* Fix unit test
* (WIP): Fix modal resize. Fix cursors. Fix border issue on non-resizable widgets
* fetch component heights using the requestAnimationFrame callback
* behavioural changes
* (WIP): Fix issues on the platform
* Update main container size appropriately
* more behavioural changes
* overlay now only be visible when hovering over the dots
* grid showing and widget reselecting
* added onfocus and onblur events to property pane listeners
* added onfocus and onblur events to property pane listeners
* added a range slider for min and max
* added demarcations for slider values
* (WIP): Fix platform workflows for dynamic height
* Fix issues with widgets
* Fix removed import
* - Add missing cypress files
* set the limits
* limit increase on change
* Fix z-index of min max limit indicators. Fix unused-vars warnings
* Fix Table Widget and Text Widget issues
* Fix: all the bugs in the bug master list for DH (#16268)
* changed the zindex for the signifiers
* showing signifiers only when the widget is selected
* made changes suggested by Momcilo
* activate the dots when the fields are active
* created a new centered dot handle
* removed overlays on focus and made the border more like deisgn
* handles on top of other widgets
* hide the overlay when multiple widgets are selected
* added a white border
* added a white border
* bug #15509 resolved
* changed the minDynamicHeightLimit to 2 instead of 4 to fix the Bug #15527
* removed the height auto fix from BaseInputComponent to fix the Bug #15388
* removed the condition to not ccalculate dynamic height when the row difference is less than 2 to fix the bug 15353
* made fixes for the bug #16307
* made fixes for the bug #16308
* made fixes for bug 16310
* made fixes for the bug #16402
* removed some log statements
* made fixes for the bug #16407
* fixed label problem found in the issue #16543
* made fixes for the issue #16547
* made fixes for the bug #16492
* redeploy
* (WIP): Fix to make this branch functional
* imported LabelWithTooltip back from design system
* signifier is now centered
* filled the signifier with primary color
* overlay hidden while dragging
* made the signifier dashed border also draggable
* Fix issue #16590 (#16798)
* set the limits to 4 rows
* replaced the static 40 value
* added signifiers for modal widget
* added signifiers for modal widget
* tried solving the scroll issue for widgets when there are limits
* solved the height problem using ResizeObserver
* (WIP): Fix maxDynamicHeight issue with container widgets:
* made the changes as per the review
* fixed the issue for input widget when label gets out of border
* hide text widget overflow options if auto height is enabled
* (WIP): In view mode, invisible widgets now donot take space (#16920)
* (WIP): In view mode, invisible widgets now donot take space
* (WIP): Enable the feature where invisible widgets in view mode don't take space to all widgets irrespective of the dynamic height feature
* Remove Replay conditional
* removed the scroll container for container type widgets
* removed the scroll container for container type widgets
* updated the hook to set overflow none for text widget
* fixed the should dynamic height logic to respect the min height limit
* Modal widget adheres to dynamic height (#16995)
* Modal widget adheres to dynamic height
* WIP: POC: fix dynamic height issues (#16996)
Fix height less than 4 issue. Fix JSONForm adherence to min and max height
* POC: Dynamic height undo redo issue (#17085)
* Revert debouce timeout
* (WIP): Fix issue with undo-redo in dynamic height
* fix: Dynamic height issue fixes (#17153)
* Dynamic height issue fixes
==
- Fix issue where nested widgets did not ensure parent dynamic height updates
- Fix issue where Modal widget updates came in subsequent renders
- Fix issue where JSONForm collapses
- Fix performance issue for independent updates
* Use functions to get min and max dynamic height
* Fix issue where variable might have been undefined
* added the dynamic container into the deploy mode as well
* added overflow-x hidden when overflow-y is active in the dynamic height container
* fix: Dynamic height Issue fixes (#17204)
Fix preview mode invisible widgets. Fix Tabs widget dynamic height.
* removed a console.log statement
* removed the slider control file
* imported the LabelWithTooltip from the repo rather than ds
* word-break CSS rules added for Switch and Checkbox widget when Dynamic Height is enabled
* abstracted the check for dynamic height with limits enabled as isDynamicHeightWithLimitsEnabledForWidget
* abstracted the static value of 10 in dynamic height overlay to GridDefaults
* abstracted min and max dynamic height limits to getters
* fix: replaced all the refs for simpler widgets (#17353)
* replaced all the refs for simpler widgets
* removed the updateDynamicHeight from componentDidUpdate in BaseWidget
* added back lifecycle methods back to BaseWidget
* removed the contentRef from SwitchGroup and Table
* updating the height from the auto height with limits as well
* some hacks to make the limits work
* working solution
* used setTimeout to send an update to updateDynamicHeight from overlay update
* removed a log
* added requestanimationframe in settimeout
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* Fix issues caused during merge
* Remove unneeded derived property
* removed more unnecessary code which should have been removed after removing the ref dependency
* fixed the maxDynamicHeight issue
* Fix issue where property configs were not being sent
* fix: Auto Height Feature - add selectors for tests (#17687)
Add selectors for auto height cypress tests
* fix: removed height auto default theme (#17415)
removed height auto css rule from the default theme
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
* fix: Auto Height Feature - Resolve issues and restructure code (#17686)
* Fix issues in dynamic height. Restructure code and reduce abstraction leaks
* Fix typescript issues
* Update based on review comments. Comment migrations, as a cyclic import is causing the jest tests to fail.
* Remove unused imports
* Decrease code nesting
* added the base styles for the overlay like position and z-index in its styled component css
* used the isDynamicHeightEnabled prop to set the height of SwitchGroup and RadioGroup widgets from 32px to 100% in case of inline mode
* fix: Auto Height - Resolve issues (#17737)
* Fix Tabs Widget showTabs toggle based auto height. Revert removal of BaseWidget code. Remove box-intersect and use a bruteforce algorithm. Add base logic for having containers collapse due to hidden child widgets
* Hide scroll contents and overflow property pane controls when dynamic height is enabled
* Removed the class property expectedHeight from BaseWidget as it is not useful in the overlay logic after some changes
* fixed the left alignment issue of label in the rich text editor by adding some styles applied only when the dynamic height is enabled
* fixed the input field stretching issue in case of Dynamic height by adding some CSS styles when isDynamicHeight is true
* Fix failing modal widget cypress tests
* Fix issue with scrollContents and Tabs Widget defaulTab
* added a little bit padding of 4px to the right of scroll container of dynamic height with limit
* Add test locators for resize handles
* removed the dynamic height logic from the table widget
* fix: Auto-Height invisible widgets (#17849)
* Fix issue where invisible widgets were still taking space
* Make sure to collapse only if dynamic height is enabled
* Fix issues with reflow (not the invisible widgets)
* Fix container min height issues
* Fix reflow with original bottom and top values. Testing needed
* Fix invisible widgets
* fix: enabled dynamic height for stat box widget (#17971)
enabled dynamic height for stat box widget
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: added a min height to rich text editor so that it does not collapse (#17970)
added a min height to rich text editor so that it does not collapse
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* Fix issue with resizing auto height widget
* Add helper text to educate users regarding the scroll disconnect in WYSIWYG
* fix: Auto Height Fixes (#18111)
AUTO HEIGHT FIXES
- Fix JSONForm height discrepancy
- Fix issue where widgets moved below the other
- Fix droptarget height after parent container resize
* fix: sliced up the DynamicHeightOverlay component a little bit (#18100)
* sliced up the DynamicHeightOverlay component a little bit
* more refactoring
* more refactoring
* used release event emitter and refactored more
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: rich text editor center alignment issue (#18142)
* removed the center alignment from rich text editor
* dummy commit
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: old DSL container collapse (#18160)
* Fix issue where old containers from old DSLs used to collapse when auto height was enabled
* Fix issue where old containers don't allow new widgets to be added when auto height is enabled, this is because the shouldScrollContents is undefined
* fix: input widgets issue (#18172)
fixed the auto height not working issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: preview deploy mode (#18174)
fixed the preview and deploy mode
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits label intersection with handle dot (#18186)
fixed the position of the limits label to the right so that it will not intersect with the handle dot
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits rich text editor min height (#18187)
decrease the min height of the RTE so that it does not have the boundary issue with the max limit when auto height with limits is enabled
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: grammatical error in the help text (#18188)
changed react to reacts in the helpText of the dynamic height property in the proeprty pane
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height tabs double scroll (#18210)
solved the issue by disabling the scroll for the child canvas widget in the tabs widget
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: auto height limits resizing (#18213)
* fixed the auto height limits resizing issue
* made the auto height overlay independent of isResizing and used its own property to show the grid
* some more refactoring
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* dummy commit
* fix: old apps container issue (#18255)
filtered out the widgets which are detached from layout
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: fixing auto height in childless containers. (#18263)
fixing auto height in childless containers.
* task: Dynamic height reflow fixes in Branch (#18244)
dynamic height reflow fixes
* fix: compact label issue and min and max limits numeric input (#18282)
fixed compact label issue and turned min and max limits to numeric input
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: LabelWithTooltip help icon fix
* fix: NaN and min limit for min and max (#18284)
* fixed compact label issue and turned min and max limits to numeric input
* fixed NaN and set min to be 4
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: validation issues for min max (#18286)
* fixed compact label issue and turned min and max limits to numeric input
* fixed NaN and set min to be 4
* validations start working min max
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* added a full stop to container scroll helper text
* validations start working min max
* dummy commit
* feat: stop resizing auto height widgets vertically because of Drag n Drop Reflow (#18267)
* reflow fixes
* stop resizing auto height widgets vertically because of Drag n Drop Reflow
* feat: Analytics for Dynamic height (#18279)
* Fix canvas min height issue and invisible widgets issue and remove logs and fix issue where widgets overlapped when coming back from preview mode to edit mode
* Fix issue with containers not respecting auto height and decreasing height
* Fix issue with modal widget not hugging contents, and container widgets never become visible after going invisible
* Fix issue where existing containers don't have correct min height for child canvas
* fix: canvasLevelsReducers test (#18301)
fixed the canvasLevelsReducers test
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: removed auto height min max config from widget features (#18316)
removed auto height min max config from widget features
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: Fixing Modal Height updates (#18317)
Fixing Modal Height updates
* fix: text widget background auto height (#18319)
added background color of Text widget back to the auto height container
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* test: cypress tests for auto height (#17676)
* Added tests for dynamic height
* updated tests for another usecase
* moved locators into commonfile
* updated common method
* added tests for some more widgets
* Added tests for jsonForm / Form widget
* Updated the test
* updated test for multiple text widgets
* updated test with few more usecases
* updated the dsl
* updated tests for text change
* updated tests based on new changes
* updated cypress test fixes
* fix: auto height container merge poc wrt release (#18334)
updated the poc wrt PR already merged in the release regarding the auto height container
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: renamed auto height overlay components and added some tests (#18333)
* renamed auto height overlay components and added some tests
* replaced the 10 value with GridDefaults
* avoiding event to reach drop target
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* updated tests
* Merge all code into one branch
* Fix failing AutoHeightcontainer test
* fix: Fix reflow computations which were causing widget overlap (#18300)
* Fix reflow computations which were causing widget overlap
* Fix issues with parent container height and overlapping widgets
* Remove console logs
* Revert comment
* Fix issues related to reflow of containers
* feat: Making getEffectedBoxes a Recursive function in autoHeight Reflow (#18336)
Making getEffectedBoxes a Recursive function in autoHeight Reflow
* Return null for invisible widgets from withWidgetProps
* Remove duplicate import
Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com>
* Remove missed console log
* fix: Label position gets deselected on selecting already selected option (#18298)
* fix: Label position gets deselected on selecting the already selected value
* Added migration for Currency & Phone input widgets
* simplify migration function using a utility
* combine conditions
* Increments LATEST_PAGE_VERSION
* Update DynamicHeight_Visibility_spec.js
updated a check wrt auto height
* Handling Modals for canvas size calculations
* fix: migrate label position test failing issue (#18365)
fixed migrate label postition test failing issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* removed the two unwanted imports from DSLMigrations to fix client build
* fix: Auto height zero and limits issue (#18366)
fixed the auto height zero and limits issue
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* fix: Auto height regression issues (#18367)
* Fix auto height regression issues #18367
* feat: auto height migrations (#18368)
Add auto height migrations
* Increase file caching size
* Use manual array for list of auto height enabled widgets
* Fix cypress test dsl versions
* Revert changes to shouldUpdateHeightDynamically
* Update test results based on code changes
* Marginally increase the workbox file size cache
* review comment incorporated for test spec
* Update container auto height property on drop
* Disable auto height with limits for modal
Co-authored-by: Ankur Singhal <ankur@appsmith.com>
Co-authored-by: rahulramesha <rahul@appsmith.com>
Co-authored-by: Abhinav Jha <zatanna@Abhinavs-iMac.lan>
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com>
Co-authored-by: rahulramesha <71900764+rahulramesha@users.noreply.github.com>
Co-authored-by: Albin <albin@appsmith.com>
Co-authored-by: Aswath K <aswath.sana@gmail.com>
Co-authored-by: NandanAnantharamu <67676905+NandanAnantharamu@users.noreply.github.com>
Co-authored-by: Apple <nandan@thinkify.io>
* chore: Moved height property to General section (#18402)
* fix: Height property is moved to General section
* Logs an Error if section is not General
* fix: Cypress
* enabled auto height for all the widgets except json form
* removes accidentally committed files
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
* disabled default auto height for input widgets and select widgets and datepicker widget
* disable feature at generalConfig instead of firstConfig
* add todo comment
* feat: Disable auto height for widgets in List Widget (#18381)
* Remove auto height for container Inside List widget
* remove unneccessary changes
* disable feature at generalConfig instead of firstConfig
* add todo comment
* skipped the get min limit tests
* fixed AutoHeightLimitHandleDot tests
* list widget remove autoLayoutContainer for list widget template children
Co-authored-by: Ankur Singhal <ankur@appsmith.com>
Co-authored-by: Abhinav Jha <abhinav@appsmith.com>
Co-authored-by: Abhinav Jha <zatanna@Abhinavs-iMac.lan>
Co-authored-by: Ankur Singhal <ankursinghal@Ankurs-MacBook-Pro-2.local>
Co-authored-by: Ankur Singhal <ankurrsinghal@gmail.com>
Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com>
Co-authored-by: Albin <albin@appsmith.com>
Co-authored-by: Aswath K <aswath.sana@gmail.com>
Co-authored-by: NandanAnantharamu <67676905+NandanAnantharamu@users.noreply.github.com>
Co-authored-by: Apple <nandan@thinkify.io>
Co-authored-by: Arsalan Yaldram <arsalanyaldram0211@outlook.com>
2022-11-24 21:00:32 +00:00
|
|
|
) {
|
2022-11-23 09:48:23 +00:00
|
|
|
return (
|
|
|
|
|
<AutoHeightContainerWrapper
|
|
|
|
|
onUpdateDynamicHeight={(height) => this.updateAutoHeight(height)}
|
|
|
|
|
widgetProps={this.props}
|
|
|
|
|
>
|
|
|
|
|
{content}
|
|
|
|
|
</AutoHeightContainerWrapper>
|
|
|
|
|
);
|
|
|
|
|
}
|
2023-04-07 13:51:35 +00:00
|
|
|
if (this.props.isFlexChild && !this.props.detachFromLayout) {
|
|
|
|
|
const autoDimensionConfig = WidgetFactory.getWidgetAutoLayoutConfig(
|
|
|
|
|
this.props.type,
|
|
|
|
|
).autoDimension;
|
|
|
|
|
|
|
|
|
|
const shouldObserveWidth = isFunction(autoDimensionConfig)
|
|
|
|
|
? autoDimensionConfig(this.props).width
|
|
|
|
|
: autoDimensionConfig?.width;
|
|
|
|
|
const shouldObserveHeight = isFunction(autoDimensionConfig)
|
|
|
|
|
? autoDimensionConfig(this.props).height
|
|
|
|
|
: autoDimensionConfig?.height;
|
|
|
|
|
|
|
|
|
|
if (!shouldObserveHeight && !shouldObserveWidth) return content;
|
|
|
|
|
|
|
|
|
|
const { componentHeight, componentWidth } = this.getComponentDimensions();
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<AutoLayoutDimensionObserver
|
|
|
|
|
height={componentHeight}
|
|
|
|
|
isFillWidget={
|
|
|
|
|
this.props.responsiveBehavior === ResponsiveBehavior.Fill
|
|
|
|
|
}
|
|
|
|
|
onDimensionUpdate={this.updateWidgetDimensions}
|
|
|
|
|
width={componentWidth}
|
|
|
|
|
>
|
|
|
|
|
{content}
|
|
|
|
|
</AutoLayoutDimensionObserver>
|
|
|
|
|
);
|
|
|
|
|
}
|
2023-04-14 13:55:44 +00:00
|
|
|
|
|
|
|
|
content = this.addWidgetComponentBoundary(content, this.props);
|
2022-11-23 09:48:23 +00:00
|
|
|
return this.addErrorBoundary(content);
|
2022-08-19 10:10:36 +00:00
|
|
|
};
|
|
|
|
|
|
2023-04-07 13:51:35 +00:00
|
|
|
private updateWidgetDimensions = (width: number, height: number) => {
|
|
|
|
|
const { updateWidgetDimension } = this.context;
|
|
|
|
|
if (!updateWidgetDimension) return;
|
|
|
|
|
updateWidgetDimension(
|
|
|
|
|
this.props.widgetId,
|
|
|
|
|
width + 2 * FLEXBOX_PADDING,
|
|
|
|
|
height + 2 * FLEXBOX_PADDING,
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
private getWidgetView(): ReactNode {
|
|
|
|
|
let content: ReactNode;
|
2023-03-04 07:25:54 +00:00
|
|
|
|
2019-03-18 15:10:30 +00:00
|
|
|
switch (this.props.renderMode) {
|
|
|
|
|
case RenderModes.CANVAS:
|
2022-08-19 10:10:36 +00:00
|
|
|
content = this.getWidgetComponent();
|
2020-03-27 09:02:11 +00:00
|
|
|
if (!this.props.detachFromLayout) {
|
2023-04-07 13:51:35 +00:00
|
|
|
if (
|
|
|
|
|
!this.props.resizeDisabled &&
|
|
|
|
|
this.props.type !== "SKELETON_WIDGET"
|
|
|
|
|
)
|
|
|
|
|
content = this.makeResizable(content);
|
2020-03-27 09:02:11 +00:00
|
|
|
content = this.showWidgetName(content);
|
|
|
|
|
content = this.makeDraggable(content);
|
2021-07-26 16:44:10 +00:00
|
|
|
content = this.makeSnipeable(content);
|
|
|
|
|
// NOTE: In sniping mode we are not blocking onClick events from PositionWrapper.
|
2023-03-04 07:25:54 +00:00
|
|
|
if (this.props.isFlexChild) {
|
|
|
|
|
content = this.makeFlex(content);
|
|
|
|
|
} else {
|
|
|
|
|
content = this.makePositioned(content);
|
|
|
|
|
}
|
2023-04-03 06:11:10 +00:00
|
|
|
if (isAutoHeightEnabledForWidgetWithLimits(this.props)) {
|
2022-11-23 09:48:23 +00:00
|
|
|
content = this.addAutoHeightOverlay(content);
|
|
|
|
|
}
|
2019-11-13 07:00:25 +00:00
|
|
|
}
|
2022-11-23 09:48:23 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
return content;
|
|
|
|
|
|
|
|
|
|
// return this.getCanvasView();
|
2019-03-18 15:10:30 +00:00
|
|
|
case RenderModes.PAGE:
|
2022-08-19 10:10:36 +00:00
|
|
|
content = this.getWidgetComponent();
|
2023-04-07 13:51:35 +00:00
|
|
|
if (!this.props.detachFromLayout) {
|
|
|
|
|
if (this.props.isFlexChild) content = this.makeFlex(content);
|
|
|
|
|
else content = this.makePositioned(content);
|
2019-11-13 07:00:25 +00:00
|
|
|
}
|
2023-03-23 05:43:07 +00:00
|
|
|
return content;
|
2019-03-18 15:10:30 +00:00
|
|
|
default:
|
2019-11-13 07:00:25 +00:00
|
|
|
throw Error("RenderMode not defined");
|
2019-03-18 15:10:30 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
abstract getPageView(): ReactNode;
|
2019-03-18 15:10:30 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
getCanvasView(): ReactNode {
|
2022-11-23 09:48:23 +00:00
|
|
|
return this.getPageView();
|
2019-03-18 15:10:30 +00:00
|
|
|
}
|
2019-02-10 13:06:05 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
// TODO(abhinav): Maybe make this a pure component to bailout from updating altogether.
|
|
|
|
|
// This would involve making all widgets which have "states" to not have states,
|
|
|
|
|
// as they're extending this one.
|
2020-04-13 08:24:13 +00:00
|
|
|
shouldComponentUpdate(nextProps: WidgetProps, nextState: WidgetState) {
|
|
|
|
|
return (
|
|
|
|
|
!shallowequal(nextProps, this.props) ||
|
|
|
|
|
!shallowequal(nextState, this.state)
|
|
|
|
|
);
|
2019-11-04 14:22:50 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
// TODO(abhinav): These defaultProps seem unneccessary. Check it out.
|
|
|
|
|
static defaultProps: Partial<WidgetProps> | undefined = {
|
2019-09-19 22:25:37 +00:00
|
|
|
parentRowSpace: 1,
|
|
|
|
|
parentColumnSpace: 1,
|
2019-03-19 14:47:18 +00:00
|
|
|
topRow: 0,
|
2019-09-09 09:08:54 +00:00
|
|
|
leftColumn: 0,
|
2021-03-04 05:24:47 +00:00
|
|
|
isLoading: false,
|
|
|
|
|
renderMode: RenderModes.CANVAS,
|
2021-04-23 05:43:13 +00:00
|
|
|
dragDisabled: false,
|
|
|
|
|
dropDisabled: false,
|
|
|
|
|
isDeletable: true,
|
|
|
|
|
resizeDisabled: false,
|
|
|
|
|
disablePropertyPane: false,
|
2023-03-04 07:25:54 +00:00
|
|
|
isFlexChild: false,
|
|
|
|
|
isMobile: false,
|
2019-09-09 09:08:54 +00:00
|
|
|
};
|
2019-02-11 18:22:23 +00:00
|
|
|
}
|
2019-02-10 13:06:05 +00:00
|
|
|
|
2019-11-13 07:00:25 +00:00
|
|
|
export interface BaseStyle {
|
|
|
|
|
componentHeight: number;
|
|
|
|
|
componentWidth: number;
|
|
|
|
|
positionType: PositionType;
|
|
|
|
|
xPosition: number;
|
|
|
|
|
yPosition: number;
|
|
|
|
|
xPositionUnit: CSSUnit;
|
|
|
|
|
yPositionUnit: CSSUnit;
|
|
|
|
|
heightUnit?: CSSUnit;
|
|
|
|
|
widthUnit?: CSSUnit;
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-12 13:06:05 +00:00
|
|
|
export type WidgetState = Record<string, unknown>;
|
2019-02-10 13:06:05 +00:00
|
|
|
|
2022-08-19 10:10:36 +00:00
|
|
|
export interface WidgetBuilder<
|
|
|
|
|
T extends CanvasWidgetStructure,
|
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
|
|
|
S extends WidgetState,
|
2022-08-19 10:10:36 +00:00
|
|
|
> {
|
2019-09-17 10:11:50 +00:00
|
|
|
buildWidget(widgetProps: T): JSX.Element;
|
2019-02-10 13:06:05 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
export interface WidgetBaseProps {
|
2019-09-12 08:11:25 +00:00
|
|
|
widgetId: string;
|
2023-02-14 16:07:31 +00:00
|
|
|
metaWidgetId?: string;
|
2019-09-17 10:09:00 +00:00
|
|
|
type: WidgetType;
|
2019-09-12 08:11:25 +00:00
|
|
|
widgetName: string;
|
2021-03-04 05:24:47 +00:00
|
|
|
parentId?: string;
|
2020-03-27 09:02:11 +00:00
|
|
|
renderMode: RenderMode;
|
2021-02-23 12:35:09 +00:00
|
|
|
version: number;
|
2023-03-20 11:04:02 +00:00
|
|
|
childWidgets?: WidgetEntity[];
|
2023-02-14 16:07:31 +00:00
|
|
|
flattenedChildCanvasWidgets?: Record<string, FlattenedWidgetProps>;
|
|
|
|
|
metaWidgetChildrenStructure?: CanvasWidgetStructure[];
|
|
|
|
|
referencedWidgetId?: string;
|
|
|
|
|
requiresFlatWidgetChildren?: boolean;
|
|
|
|
|
hasMetaWidgets?: boolean;
|
|
|
|
|
creatorId?: string;
|
|
|
|
|
isMetaWidget?: boolean;
|
|
|
|
|
suppressAutoComplete?: boolean;
|
|
|
|
|
suppressDebuggerError?: boolean;
|
|
|
|
|
disallowCopy?: boolean;
|
|
|
|
|
/**
|
|
|
|
|
* The keys of the props mentioned here would always be picked from the canvas widget
|
|
|
|
|
* rather than the evaluated values in withWidgetProps HOC.
|
|
|
|
|
* */
|
|
|
|
|
additionalStaticProps?: string[];
|
2020-03-27 09:02:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export type WidgetRowCols = {
|
2019-08-29 11:22:09 +00:00
|
|
|
leftColumn: number;
|
|
|
|
|
rightColumn: number;
|
2020-03-27 09:02:11 +00:00
|
|
|
topRow: number;
|
|
|
|
|
bottomRow: number;
|
|
|
|
|
minHeight?: number; // Required to reduce the size of CanvasWidgets.
|
2023-03-04 07:25:54 +00:00
|
|
|
mobileLeftColumn?: number;
|
|
|
|
|
mobileRightColumn?: number;
|
|
|
|
|
mobileTopRow?: number;
|
|
|
|
|
mobileBottomRow?: number;
|
2022-11-23 09:48:23 +00:00
|
|
|
height?: number;
|
2020-03-27 09:02:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export interface WidgetPositionProps extends WidgetRowCols {
|
2019-08-29 11:22:09 +00:00
|
|
|
parentColumnSpace: number;
|
|
|
|
|
parentRowSpace: number;
|
2020-03-27 09:02:11 +00:00
|
|
|
// The detachFromLayout flag tells use about the following properties when enabled
|
|
|
|
|
// 1) Widget does not drag/resize
|
|
|
|
|
// 2) Widget CAN (but not neccessarily) be a dropTarget
|
|
|
|
|
// Examples: MainContainer is detached from layout,
|
|
|
|
|
// MODAL_WIDGET is also detached from layout.
|
|
|
|
|
detachFromLayout?: boolean;
|
2021-04-23 05:43:13 +00:00
|
|
|
noContainerOffset?: boolean; // This won't offset the child in parent
|
2023-03-04 07:25:54 +00:00
|
|
|
isFlexChild?: boolean;
|
|
|
|
|
direction?: LayoutDirection;
|
|
|
|
|
responsiveBehavior?: ResponsiveBehavior;
|
|
|
|
|
minWidth?: number; // Required to avoid squishing of widgets on mobile viewport.
|
|
|
|
|
isMobile?: boolean;
|
|
|
|
|
flexVerticalAlignment?: FlexVerticalAlignment;
|
|
|
|
|
appPositioningType?: AppPositioningTypes;
|
2023-04-07 13:51:35 +00:00
|
|
|
widthInPercentage?: number; // Stores the widget's width set by the user
|
|
|
|
|
mobileWidthInPercentage?: number;
|
2020-03-27 09:02:11 +00:00
|
|
|
}
|
|
|
|
|
|
2021-06-18 07:42:57 +00:00
|
|
|
export const WIDGET_DISPLAY_PROPS = {
|
|
|
|
|
isVisible: true,
|
|
|
|
|
isLoading: true,
|
|
|
|
|
isDisabled: true,
|
|
|
|
|
backgroundColor: true,
|
|
|
|
|
};
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
export interface WidgetDisplayProps {
|
|
|
|
|
//TODO(abhinav): Some of these props are mandatory
|
2019-09-13 10:45:49 +00:00
|
|
|
isVisible?: boolean;
|
2019-11-20 08:10:01 +00:00
|
|
|
isLoading: boolean;
|
2019-11-13 07:00:25 +00:00
|
|
|
isDisabled?: boolean;
|
2019-10-08 09:09:30 +00:00
|
|
|
backgroundColor?: string;
|
2021-12-14 07:55:58 +00:00
|
|
|
animateLoading?: boolean;
|
2023-02-08 11:23:39 +00:00
|
|
|
deferRender?: boolean;
|
|
|
|
|
wrapperRef?: RefObject<HTMLDivElement>;
|
2023-03-23 05:43:07 +00:00
|
|
|
selectedWidgetAncestry?: string[];
|
2019-02-10 13:06:05 +00:00
|
|
|
}
|
|
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
export interface WidgetDataProps
|
|
|
|
|
extends WidgetBaseProps,
|
|
|
|
|
WidgetPositionProps,
|
|
|
|
|
WidgetDisplayProps {}
|
|
|
|
|
|
2020-11-12 11:23:32 +00:00
|
|
|
export interface WidgetProps
|
|
|
|
|
extends WidgetDataProps,
|
|
|
|
|
WidgetDynamicPathListProps,
|
2021-06-21 11:09:51 +00:00
|
|
|
DataTreeEvaluationProps {
|
2020-03-27 09:02:11 +00:00
|
|
|
key?: string;
|
|
|
|
|
isDefaultClickDisabled?: boolean;
|
2023-01-28 02:17:06 +00:00
|
|
|
|
2020-03-27 09:02:11 +00:00
|
|
|
[key: string]: any;
|
|
|
|
|
}
|
2019-09-17 10:11:50 +00:00
|
|
|
|
2019-09-06 09:30:22 +00:00
|
|
|
export interface WidgetCardProps {
|
2023-04-07 13:51:35 +00:00
|
|
|
rows: number;
|
|
|
|
|
columns: number;
|
2019-09-17 10:09:00 +00:00
|
|
|
type: WidgetType;
|
2019-08-29 11:22:09 +00:00
|
|
|
key?: string;
|
2021-09-09 15:10:22 +00:00
|
|
|
displayName: string;
|
|
|
|
|
icon: string;
|
2021-04-23 05:43:13 +00:00
|
|
|
isBeta?: boolean;
|
2019-08-21 12:49:16 +00:00
|
|
|
}
|
|
|
|
|
|
2019-09-19 22:25:37 +00:00
|
|
|
export const WidgetOperations = {
|
|
|
|
|
MOVE: "MOVE",
|
|
|
|
|
RESIZE: "RESIZE",
|
|
|
|
|
ADD_CHILD: "ADD_CHILD",
|
|
|
|
|
UPDATE_PROPERTY: "UPDATE_PROPERTY",
|
|
|
|
|
DELETE: "DELETE",
|
2020-09-16 10:28:01 +00:00
|
|
|
ADD_CHILDREN: "ADD_CHILDREN",
|
2019-09-17 15:09:55 +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 WidgetOperation =
|
|
|
|
|
(typeof WidgetOperations)[keyof typeof WidgetOperations];
|
2019-09-17 15:09:55 +00:00
|
|
|
|
2019-09-09 09:08:54 +00:00
|
|
|
export default BaseWidget;
|