Skip to content

Actions in JS Console #1832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated structure and added support for nested components.
Action to rename components
  • Loading branch information
kamalqureshi committed Jul 2, 2025
commit 01ed7ddab4242c0c3510ad5320371887ea187f85
588 changes: 21 additions & 567 deletions client/packages/lowcoder/src/comps/comps/preLoadComp/actionConfigs.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { message } from "antd";
import { ActionConfig, ActionExecuteParams } from "../types";

export const configureComponentAction: ActionConfig = {
key: 'configure-components',
label: 'Configure a component',
category: 'component-configuration',
requiresEditorComponentSelection: true,
requiresInput: true,
inputPlaceholder: 'Enter configuration (JSON format)',
inputType: 'json',
validation: (value: string) => {
if (!value.trim()) return 'Configuration is required';
try {
JSON.parse(value);
return null;
} catch {
return 'Invalid JSON format';
}
},
execute: async (params: ActionExecuteParams) => {
const { selectedEditorComponent, actionValue } = params;

try {
const config = JSON.parse(actionValue);
console.log('Configuring component:', selectedEditorComponent, 'with config:', config);
message.info(`Configure action for component "${selectedEditorComponent}"`);

// TODO: Implement actual configuration logic
} catch (error) {
message.error('Invalid configuration format');
}
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { message } from "antd";
import { ActionConfig, ActionExecuteParams } from "../types";

export const addEventHandlerAction: ActionConfig = {
key: 'add-event-handler',
label: 'Add event handler',
category: 'events',
requiresEditorComponentSelection: true,
requiresInput: true,
inputPlaceholder: 'Enter event handler code (JavaScript)',
inputType: 'textarea',
execute: async (params: ActionExecuteParams) => {
const { selectedEditorComponent, actionValue } = params;

console.log('Adding event handler to component:', selectedEditorComponent, 'with code:', actionValue);
message.info(`Event handler added to component "${selectedEditorComponent}"`);

// TODO: Implement actual event handler logic
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { message } from "antd";
import { ActionConfig, ActionExecuteParams } from "../types";

export const changeLayoutAction: ActionConfig = {
key: 'change-layout',
label: 'Change layout',
category: 'layout',
requiresInput: true,
inputPlaceholder: 'Enter layout type (grid, flex, absolute)',
inputType: 'text',
execute: async (params: ActionExecuteParams) => {
const { actionValue } = params;

console.log('Changing layout to:', actionValue);
message.info(`Layout changed to: ${actionValue}`);

// TODO: Implement actual layout change logic
}
};
Loading
Loading