File tree Expand file tree Collapse file tree 6 files changed +66
-50
lines changed
client/packages/lowcoder/src/comps/comps Expand file tree Collapse file tree 6 files changed +66
-50
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ // client/packages/lowcoder/src/comps/comps/chatComp/chatComp.tsx
2
+ import { UICompBuilder } from "comps/generators" ;
3
+ import { NameConfig , withExposingConfigs } from "comps/generators/withExposing" ;
4
+ import { chatChildrenMap } from "./chatCompTypes" ;
5
+ import { ChatView } from "./chatView" ;
6
+ import { ChatPropertyView } from "./chatPropertyView" ;
7
+
8
+ // Build the component
9
+ const ChatTmpComp = new UICompBuilder (
10
+ chatChildrenMap ,
11
+ ( props ) => < ChatView { ...props } />
12
+ )
13
+ . setPropertyViewFn ( ( children ) => < ChatPropertyView children = { children } /> )
14
+ . build ( ) ;
15
+
16
+ // Export the component
17
+ export const ChatComp = withExposingConfigs ( ChatTmpComp , [
18
+ new NameConfig ( "text" , "Chat component text" ) ,
19
+ ] ) ;
Original file line number Diff line number Diff line change
1
+ // client/packages/lowcoder/src/comps/comps/chatComp/chatCompTypes.ts
2
+ import { StringControl } from "comps/controls/codeControl" ;
3
+ import { withDefault } from "comps/generators" ;
4
+
5
+ export const chatChildrenMap = {
6
+ text : withDefault ( StringControl , "Chat Component Placeholder" ) ,
7
+ } ;
8
+
9
+ export type ChatCompProps = {
10
+ text : string ;
11
+ } ;
Original file line number Diff line number Diff line change
1
+ // client/packages/lowcoder/src/comps/comps/chatComp/chatPropertyView.tsx
2
+ import React from "react" ;
3
+ import { Section , sectionNames } from "lowcoder-design" ;
4
+
5
+ export const ChatPropertyView = React . memo ( ( props : any ) => {
6
+ return (
7
+ < Section name = { sectionNames . basic } >
8
+ { props . children . text . propertyView ( {
9
+ label : "Text"
10
+ } ) }
11
+ </ Section >
12
+ ) ;
13
+ } ) ;
14
+
15
+ ChatPropertyView . displayName = 'ChatPropertyView' ;
Original file line number Diff line number Diff line change
1
+ // client/packages/lowcoder/src/comps/comps/chatComp/chatView.tsx
2
+ import React from "react" ;
3
+ import { ChatCompProps } from "./chatCompTypes" ;
4
+
5
+ export const ChatView = React . memo ( ( props : ChatCompProps ) => {
6
+ return (
7
+ < div style = { {
8
+ height : '100%' ,
9
+ border : '1px solid #ccc' ,
10
+ padding : '16px' ,
11
+ borderRadius : '4px'
12
+ } } >
13
+ { props . text }
14
+ </ div >
15
+ ) ;
16
+ } ) ;
17
+
18
+ ChatView . displayName = 'ChatView' ;
Original file line number Diff line number Diff line change
1
+ // client/packages/lowcoder/src/comps/comps/chatComp/index.ts
2
+ export { ChatComp } from "./chatComp" ;
3
+ export type { ChatCompProps } from "./chatCompTypes" ;
You can’t perform that action at this time.
0 commit comments