Skip to content

Commit 01ed7dd

Browse files
committed
Updated structure and added support for nested components.
Action to rename components
1 parent 1583b5c commit 01ed7dd

File tree

8 files changed

+668
-568
lines changed

8 files changed

+668
-568
lines changed

client/packages/lowcoder/src/comps/comps/preLoadComp/actionConfigs.ts

Lines changed: 21 additions & 567 deletions
Large diffs are not rendered by default.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { message } from "antd";
2+
import { ActionConfig, ActionExecuteParams } from "../types";
3+
4+
export const configureComponentAction: ActionConfig = {
5+
key: 'configure-components',
6+
label: 'Configure a component',
7+
category: 'component-configuration',
8+
requiresEditorComponentSelection: true,
9+
requiresInput: true,
10+
inputPlaceholder: 'Enter configuration (JSON format)',
11+
inputType: 'json',
12+
validation: (value: string) => {
13+
if (!value.trim()) return 'Configuration is required';
14+
try {
15+
JSON.parse(value);
16+
return null;
17+
} catch {
18+
return 'Invalid JSON format';
19+
}
20+
},
21+
execute: async (params: ActionExecuteParams) => {
22+
const { selectedEditorComponent, actionValue } = params;
23+
24+
try {
25+
const config = JSON.parse(actionValue);
26+
console.log('Configuring component:', selectedEditorComponent, 'with config:', config);
27+
message.info(`Configure action for component "${selectedEditorComponent}"`);
28+
29+
// TODO: Implement actual configuration logic
30+
} catch (error) {
31+
message.error('Invalid configuration format');
32+
}
33+
}
34+
};
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { message } from "antd";
2+
import { ActionConfig, ActionExecuteParams } from "../types";
3+
4+
export const addEventHandlerAction: ActionConfig = {
5+
key: 'add-event-handler',
6+
label: 'Add event handler',
7+
category: 'events',
8+
requiresEditorComponentSelection: true,
9+
requiresInput: true,
10+
inputPlaceholder: 'Enter event handler code (JavaScript)',
11+
inputType: 'textarea',
12+
execute: async (params: ActionExecuteParams) => {
13+
const { selectedEditorComponent, actionValue } = params;
14+
15+
console.log('Adding event handler to component:', selectedEditorComponent, 'with code:', actionValue);
16+
message.info(`Event handler added to component "${selectedEditorComponent}"`);
17+
18+
// TODO: Implement actual event handler logic
19+
}
20+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { message } from "antd";
2+
import { ActionConfig, ActionExecuteParams } from "../types";
3+
4+
export const changeLayoutAction: ActionConfig = {
5+
key: 'change-layout',
6+
label: 'Change layout',
7+
category: 'layout',
8+
requiresInput: true,
9+
inputPlaceholder: 'Enter layout type (grid, flex, absolute)',
10+
inputType: 'text',
11+
execute: async (params: ActionExecuteParams) => {
12+
const { actionValue } = params;
13+
14+
console.log('Changing layout to:', actionValue);
15+
message.info(`Layout changed to: ${actionValue}`);
16+
17+
// TODO: Implement actual layout change logic
18+
}
19+
};

0 commit comments

Comments
 (0)