1
- import { CompParams } from "lowcoder-core" ;
2
- import { ToDataType } from "comps/generators/multi" ;
3
- import { NameConfigHidden , withExposingConfigs } from "comps/generators/withExposing" ;
4
- import { NameGenerator } from "comps/utils/nameGenerator" ;
5
- import { Section , sectionNames } from "lowcoder-design" ;
6
- import { oldContainerParamsToNew } from "../containerBase" ;
7
- import { toSimpleContainerData } from "../containerBase/simpleContainerComp" ;
8
- import { TriContainer } from "../triContainerComp/triContainer" ;
1
+ import { CompParams } from 'lowcoder-core' ;
2
+ import { ToDataType } from 'comps/generators/multi' ;
3
+ import {
4
+ NameConfigHidden ,
5
+ withExposingConfigs ,
6
+ } from 'comps/generators/withExposing' ;
7
+ import { NameGenerator } from 'comps/utils/nameGenerator' ;
8
+ import { Section , sectionNames } from 'lowcoder-design' ;
9
+ import { oldContainerParamsToNew } from '../containerBase' ;
10
+ import { toSimpleContainerData } from '../containerBase/simpleContainerComp' ;
11
+ import { TriContainer } from '../triContainerComp/triContainer' ;
9
12
import {
10
13
ContainerChildren ,
11
14
ContainerCompBuilder ,
12
- } from "../triContainerComp/triContainerCompBuilder" ;
13
- import { disabledPropertyView , hiddenPropertyView } from "comps/utils/propertyUtils" ;
14
- import { trans } from "i18n" ;
15
- import { BoolCodeControl } from "comps/controls/codeControl" ;
16
- import { DisabledContext } from "comps/generators/uiCompBuilder" ;
17
- import React , { useContext } from "react" ;
18
- import { EditorContext } from "comps/editorState" ;
15
+ } from '../triContainerComp/triContainerCompBuilder' ;
16
+ import {
17
+ disabledPropertyView ,
18
+ hiddenPropertyView ,
19
+ } from 'comps/utils/propertyUtils' ;
20
+ import { trans } from 'i18n' ;
21
+ import { BoolCodeControl } from 'comps/controls/codeControl' ;
22
+ import { DisabledContext } from 'comps/generators/uiCompBuilder' ;
23
+ import React , { useContext } from 'react' ;
24
+ import { EditorContext } from 'comps/editorState' ;
25
+ import { AnimationStyle , styleControl } from '@lowcoder-ee/index.sdk' ;
19
26
20
27
export const ContainerBaseComp = ( function ( ) {
21
28
const childrenMap = {
22
29
disabled : BoolCodeControl ,
30
+ animationStyle : styleControl ( AnimationStyle ) ,
23
31
} ;
24
32
return new ContainerCompBuilder ( childrenMap , ( props , dispatch ) => {
25
33
return (
26
34
< DisabledContext . Provider value = { props . disabled } >
27
- < TriContainer { ...props } />
35
+ < TriContainer { ...props } />
28
36
</ DisabledContext . Provider >
29
37
) ;
30
38
} )
31
39
. setPropertyViewFn ( ( children ) => {
32
40
return (
33
41
< >
34
- { ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
42
+ { ( useContext ( EditorContext ) . editorModeStatus === 'logic' ||
43
+ useContext ( EditorContext ) . editorModeStatus === 'both' ) && (
35
44
< Section name = { sectionNames . interaction } >
36
45
{ disabledPropertyView ( children ) }
37
46
{ hiddenPropertyView ( children ) }
38
47
</ Section >
39
48
) }
40
49
41
- { ( useContext ( EditorContext ) . editorModeStatus === "layout" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
42
- < > < Section name = { sectionNames . layout } >
43
- { children . container . getPropertyView ( ) }
44
- </ Section >
45
- < Section name = { sectionNames . style } >
46
- { children . container . stylePropertyView ( ) }
47
- </ Section >
48
- { children . container . children . showHeader . getView ( ) && (
49
- < Section name = { "Header Style" } >
50
- { children . container . headerStylePropertyView ( ) }
50
+ { ( useContext ( EditorContext ) . editorModeStatus === 'layout' ||
51
+ useContext ( EditorContext ) . editorModeStatus === 'both' ) && (
52
+ < >
53
+ < Section name = { sectionNames . layout } >
54
+ { children . container . getPropertyView ( ) }
51
55
</ Section >
52
- ) }
53
- { children . container . children . showBody . getView ( ) && (
54
- < Section name = { "Body Style" } >
55
- { children . container . bodyStylePropertyView ( ) }
56
+ < Section name = { sectionNames . style } >
57
+ { children . container . stylePropertyView ( ) }
56
58
</ Section >
57
- ) }
58
- { children . container . children . showFooter . getView ( ) && (
59
- < Section name = { "Footer Style" } >
60
- { children . container . footerStylePropertyView ( ) }
59
+ < Section name = { sectionNames . animationStyle } >
60
+ { children . animationStyle . getPropertyView ( ) }
61
61
</ Section >
62
- ) }
62
+ { children . container . children . showHeader . getView ( ) && (
63
+ < Section name = { 'Header Style' } >
64
+ { children . container . headerStylePropertyView ( ) }
65
+ </ Section >
66
+ ) }
67
+ { children . container . children . showBody . getView ( ) && (
68
+ < Section name = { 'Body Style' } >
69
+ { children . container . bodyStylePropertyView ( ) }
70
+ </ Section >
71
+ ) }
72
+ { children . container . children . showFooter . getView ( ) && (
73
+ < Section name = { 'Footer Style' } >
74
+ { children . container . footerStylePropertyView ( ) }
75
+ </ Section >
76
+ ) }
63
77
</ >
64
78
) }
65
79
</ >
66
80
) ;
67
81
} )
68
82
. build ( ) ;
69
- } ) ( ) ;
83
+ } ) ( ) ;
70
84
71
85
// Compatible with old data
72
86
function convertOldContainerParams ( params : CompParams < any > ) {
@@ -76,15 +90,18 @@ function convertOldContainerParams(params: CompParams<any>) {
76
90
if ( tempParams . value ) {
77
91
const container = tempParams . value . container ;
78
92
// old params
79
- if ( container && ( container . hasOwnProperty ( "layout" ) || container . hasOwnProperty ( "items" ) ) ) {
93
+ if (
94
+ container &&
95
+ ( container . hasOwnProperty ( 'layout' ) || container . hasOwnProperty ( 'items' ) )
96
+ ) {
80
97
const autoHeight = tempParams . value . autoHeight ;
81
98
const scrollbars = tempParams . value . scrollbars ;
82
99
return {
83
100
...tempParams ,
84
101
value : {
85
102
container : {
86
103
showHeader : true ,
87
- body : { 0 : { view : container } } ,
104
+ body : { 0 : { view : container } } ,
88
105
showBody : true ,
89
106
showFooter : false ,
90
107
autoHeight : autoHeight ,
@@ -103,7 +120,9 @@ class ContainerTmpComp extends ContainerBaseComp {
103
120
}
104
121
}
105
122
106
- export const ContainerComp = withExposingConfigs ( ContainerTmpComp , [ NameConfigHidden ] ) ;
123
+ export const ContainerComp = withExposingConfigs ( ContainerTmpComp , [
124
+ NameConfigHidden ,
125
+ ] ) ;
107
126
108
127
type ContainerDataType = ToDataType < ContainerChildren < { } > > ;
109
128
@@ -116,14 +135,14 @@ export function defaultContainerData(
116
135
header : toSimpleContainerData ( [
117
136
{
118
137
item : {
119
- compType : " text" ,
120
- name : nameGenerator . genItemName ( " containerTitle" ) ,
138
+ compType : ' text' ,
139
+ name : nameGenerator . genItemName ( ' containerTitle' ) ,
121
140
comp : {
122
- text : " ### " + trans ( " container.title" ) ,
141
+ text : ' ### ' + trans ( ' container.title' ) ,
123
142
} ,
124
143
} ,
125
144
layoutItem : {
126
- i : "" ,
145
+ i : '' ,
127
146
h : 5 ,
128
147
w : 24 ,
129
148
x : 0 ,
0 commit comments