Skip to content

chore: add customs in wds custom widget.#38037

Closed
jsartisan wants to merge 14 commits intoreleasefrom
chore/wds-custom-widget-refactor
Closed

chore: add customs in wds custom widget.#38037
jsartisan wants to merge 14 commits intoreleasefrom
chore/wds-custom-widget-refactor

Conversation

@jsartisan
Copy link
Contributor

@jsartisan jsartisan commented Dec 9, 2024

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a custom widget component that supports dynamic interactions and layout configurations.
    • Added support for various code templates (React, Vue, Vanilla JS) for custom widget creation.
    • Implemented a console messaging system for improved debugging and monitoring.
    • Enhanced the property pane configuration for better user interaction with widget properties.
  • Bug Fixes

    • Fixed issues related to widget height adjustments and resizing behavior.
  • Documentation

    • Updated documentation to reflect new features and configuration options for custom widgets.
  • Style

    • Added CSS reset styles for consistent rendering across browsers.
    • Enhanced styling for the custom widget component and its layout.

@jsartisan jsartisan requested a review from a team as a code owner December 9, 2024 08:26
@jsartisan jsartisan requested review from AnaghHegde and removed request for a team December 9, 2024 08:26
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 9, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The pull request introduces several new files and modifications primarily focused on enhancing the functionality and configuration of custom widgets within the UI builder. Key changes include the addition of configuration files for widget properties, a custom console implementation, and the establishment of communication channels between the widget and its parent application. The updates also involve CSS adjustments for better styling and layout management, as well as the introduction of utility functions and hooks to manage widget behavior effectively.

Changes

File Change Summary
app/client/packages/design-system/theming/src/utils/cssRule.ts Modified cssRule function to use objectKeys(tokens) for iterating over token keys; expanded typography handling logic.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/component/appsmithConsole.js Introduced a custom console implementation to intercept console methods and send messages to the parent window.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/component/constants.ts Added CUSTOM_WIDGET_LOAD_EVENTS constants and getAppsmithScriptSchema function for widget loading stages and schema generation.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/component/createHtmlTemplate.ts Introduced createHtmlTemplate function for generating HTML templates with embedded CSS and JavaScript.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/component/customWidgetscript.js Added custom widget communication system with event handling and messaging capabilities.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/component/index.tsx Introduced CustomWidgetComponent React component for managing iframe and communication with the widget.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/component/reset.css Added a CSS reset stylesheet to standardize styles across browsers.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/component/styles.module.css Added styles for .container and .iframe classes to manage layout and responsiveness.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/component/useCustomWidgetHeight.ts Introduced useCustomWidgetHeight hook for managing widget height based on size and embed status.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/anvilConfig.ts Added anvilConfig object for widget size configuration.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/autocompleteConfig.ts Introduced autocompleteConfig function for managing autocomplete settings in custom widgets.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/defaultsConfig.ts Added defaultsConfig object for custom widget default settings and event handlers.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/index.ts Updated to export various configuration settings for custom widgets.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/metaConfig.ts Added metaConfig object defining widget characteristics.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/propertyPaneConfig/contentConfig.tsx Introduced configuration for property pane settings of the custom widget.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/propertyPaneConfig/index.ts Updated to export property pane configurations.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/propertyPaneConfig/styleConfig.ts Added propertyPaneStyleConfig for styling options in the property pane.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/setterConfig.ts Introduced setterConfig for managing visibility settings.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/constants.ts Added constants for default model and component size.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/helpers/index.ts Introduced utility functions for calculating widget height and managing sandbox permissions.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/index.ts Exported WDSCustomWidget for easier access in other modules.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/services/IframeMessenger.ts Added IframeMessenger class for handling communication between parent and iframe.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/types.ts Introduced new TypeScript interfaces for custom widget properties and messages.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/widget/defaultApp.ts Added custom widget implementation with HTML, CSS, and JavaScript content.
app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/widget/index.tsx Introduced WDSCustomWidget class for rendering custom widgets with communication capabilities.
app/client/src/modules/ui-builder/ui/wds/constants.ts Updated WDS_V2_WIDGET_MAP to include WDS_CUSTOM_WIDGET.
app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/anvilTemplates/index.ts Added entry point for anvil templates.
app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/anvilTemplates/react.ts Introduced React template for custom widget.
app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/anvilTemplates/vanillaJs.ts Added Vanilla JS template for custom widget.
app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/anvilTemplates/vue.ts Introduced Vue.js template for custom widget.
app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/index.tsx Updated template selection logic to accommodate new layout-specific templates.
app/client/src/pages/Editor/CustomWidgetBuilder/Preview/index.tsx Enhanced Preview component to conditionally render based on layout type.
app/client/src/pages/Editor/CustomWidgetBuilder/Preview/styles.module.css Added .themeProvider class for styling.
app/client/src/pages/Editor/CustomWidgetBuilder/index.tsx Streamlined resizing functionality by removing overlay and improving Preview component integration.
app/client/src/pages/Editor/CustomWidgetBuilder/styles.module.css Added CSS rule to manage pointer events during resizing.
app/client/src/utils/CustomWidgetBuilderService.ts Modified URL construction logic in Builder class constructor.
app/client/src/widgets/index.ts Added WDSCustomWidget to the widgets array for export.

Possibly related issues

  • Describe the configs for Anvil widgets #35809: The changes include the addition of configuration files like anvilConfig.ts, autocompleteConfig.ts, and defaultsConfig.ts, which align with the issue's focus on necessary configurations for Anvil widgets.

Possibly related PRs

Suggested labels

skip-changelog, ok-to-test

Suggested reviewers

  • sagar-qa007

"In the realm of code where widgets play,
New configurations brighten the day.
With styles and scripts all set to flow,
Custom creations are ready to grow!
So here’s to the builders, both near and far,
Crafting their magic, like a shining star!" 🌟


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between fb9e2e1 and 36294e6.

⛔ Files ignored due to path filters (2)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/icon.svg is excluded by !**/*.svg
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/thumbnail.svg is excluded by !**/*.svg
📒 Files selected for processing (37)
  • app/client/packages/design-system/theming/src/utils/cssRule.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/component/appsmithConsole.js (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/component/constants.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/component/createHtmlTemplate.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/component/customWidgetscript.js (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/component/index.tsx (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/component/reset.css (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/component/styles.module.css (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/component/useCustomWidgetHeight.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/anvilConfig.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/autocompleteConfig.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/defaultsConfig.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/index.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/metaConfig.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/propertyPaneConfig/contentConfig.tsx (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/propertyPaneConfig/index.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/propertyPaneConfig/styleConfig.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/config/setterConfig.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/constants.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/helpers/index.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/index.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/services/IframeMessenger.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/types.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/widget/defaultApp.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSCustomWidget/widget/index.tsx (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/constants.ts (1 hunks)
  • app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/anvilTemplates/index.ts (1 hunks)
  • app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/anvilTemplates/react.ts (1 hunks)
  • app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/anvilTemplates/vanillaJs.ts (1 hunks)
  • app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/anvilTemplates/vue.ts (1 hunks)
  • app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/index.tsx (2 hunks)
  • app/client/src/pages/Editor/CustomWidgetBuilder/Preview/index.tsx (4 hunks)
  • app/client/src/pages/Editor/CustomWidgetBuilder/Preview/styles.module.css (1 hunks)
  • app/client/src/pages/Editor/CustomWidgetBuilder/index.tsx (2 hunks)
  • app/client/src/pages/Editor/CustomWidgetBuilder/styles.module.css (1 hunks)
  • app/client/src/utils/CustomWidgetBuilderService.ts (1 hunks)
  • app/client/src/widgets/index.ts (2 hunks)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jsartisan jsartisan closed this Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant