Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 65111f9

Browse files
added dotlottie option in lottie comp
1 parent 6879f3b commit 65111f9

File tree

3 files changed

+76
-23
lines changed

3 files changed

+76
-23
lines changed

‎client/packages/lowcoder/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"@fortawesome/free-regular-svg-icons": "^6.5.1",
2525
"@fortawesome/free-solid-svg-icons": "^6.5.1",
2626
"@fortawesome/react-fontawesome": "latest",
27+
"@lottiefiles/dotlottie-react": "^0.13.0",
2728
"@manaflair/redux-batch": "^1.0.0",
2829
"@rjsf/antd": "^5.21.2",
2930
"@rjsf/core": "^5.21.2",

‎client/packages/lowcoder/src/comps/comps/jsonComp/jsonLottieComp.tsx

Lines changed: 56 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ const Player = lazy(
2929
.then(module => ({default: module.Player}))
3030
);
3131

32+
const DotLottiePlayer = lazy(
33+
() => import('@lottiefiles/dotlottie-react')
34+
.then(module => ({default: module.DotLottieReact}))
35+
);
36+
3237
/**
3338
* JsonLottie Comp
3439
*/
@@ -90,8 +95,9 @@ const speedOptions = [
9095
] as const;
9196

9297
const ModeOptions = [
93-
{ label: "Data", value: "standard" },
94-
{ label: "Advanced", value: "advanced" },
98+
{ label: "Lottie JSON", value: "standard" },
99+
{ label: "DotLottie", value: "dotLottie" },
100+
{ label: "IconScout", value: "advanced" },
95101
] as const;
96102

97103
let JsonLottieTmpComp = (function () {
@@ -102,6 +108,7 @@ let JsonLottieTmpComp = (function () {
102108
JSON.stringify(defaultLottie, null, 2)
103109
),
104110
srcIconScout: IconscoutControl(IconScoutAssetType.LOTTIE),
111+
srcDotLottie: withDefault(StringControl, 'https://assets-v2.lottiefiles.com/a/9e7d8a50-1180-11ee-89a6-3b0ab1ca8a0e/hUfEwc6xNt.lottie'),
105112
uuidIconScout: StringControl,
106113
valueIconScout: withDefault(ArrayOrJSONObjectControl, JSON.stringify({})),
107114
speed: dropdownControl(speedOptions, "1"),
@@ -162,27 +169,50 @@ let JsonLottieTmpComp = (function () {
162169
rotate: props.container.rotation,
163170
}}
164171
>
165-
<Player
166-
key={
167-
[props.speed, props.animationStart, props.loop, props.value, props.keepLastFrame] as any
168-
}
169-
keepLastFrame={props.keepLastFrame}
170-
autoplay={props.animationStart === "auto" && true}
171-
hover={props.animationStart === "on hover" && true}
172-
loop={props.loop === "single" ? false : true}
173-
speed={Number(props.speed)}
174-
src={
175-
props.sourceMode === 'advanced'
176-
? (isEmpty(props.valueIconScout) ? '' : props.valueIconScout)
177-
: props.value
178-
}
179-
style={{
180-
height: "100%",
181-
width: "100%",
182-
maxWidth: "100%",
183-
maxHeight: "100%",
184-
}}
185-
/>
172+
{props.sourceMode === 'dotLottie'
173+
? (
174+
<DotLottiePlayer
175+
key={
176+
[props.speed, props.animationStart, props.loop, props.value, props.keepLastFrame] as any
177+
}
178+
// keepLastFrame={props.keepLastFrame}
179+
autoplay={props.animationStart === "auto" && true}
180+
playOnHover={props.animationStart === "on hover" && true}
181+
loop={props.loop === "single" ? false : true}
182+
speed={Number(props.speed)}
183+
src={props.srcDotLottie}
184+
style={{
185+
height: "100%",
186+
width: "100%",
187+
maxWidth: "100%",
188+
maxHeight: "100%",
189+
}}
190+
/>
191+
)
192+
: (
193+
<Player
194+
key={
195+
[props.speed, props.animationStart, props.loop, props.value, props.keepLastFrame] as any
196+
}
197+
keepLastFrame={props.keepLastFrame}
198+
autoplay={props.animationStart === "auto" && true}
199+
hover={props.animationStart === "on hover" && true}
200+
loop={props.loop === "single" ? false : true}
201+
speed={Number(props.speed)}
202+
src={
203+
props.sourceMode === 'advanced'
204+
? (isEmpty(props.valueIconScout) ? '' : props.valueIconScout)
205+
: props.value
206+
}
207+
style={{
208+
height: "100%",
209+
width: "100%",
210+
maxWidth: "100%",
211+
maxHeight: "100%",
212+
}}
213+
/>
214+
)
215+
}
186216
</div>
187217
</div>
188218
);
@@ -198,6 +228,9 @@ let JsonLottieTmpComp = (function () {
198228
{children.sourceMode.getView() === 'standard' && children.value.propertyView({
199229
label: trans("jsonLottie.lottieJson"),
200230
})}
231+
{children.sourceMode.getView() === 'dotLottie' && children.srcDotLottie.propertyView({
232+
label: "Source",
233+
})}
201234
{children.sourceMode.getView() === 'advanced' && children.srcIconScout.propertyView({
202235
label: "Lottie Source",
203236
})}

‎client/yarn.lock

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3113,6 +3113,24 @@ __metadata:
31133113
languageName: node
31143114
linkType: hard
31153115

3116+
"@lottiefiles/dotlottie-react@npm:^0.13.0":
3117+
version: 0.13.0
3118+
resolution: "@lottiefiles/dotlottie-react@npm:0.13.0"
3119+
dependencies:
3120+
"@lottiefiles/dotlottie-web": 0.40.1
3121+
peerDependencies:
3122+
react: ^17 || ^18 || ^19
3123+
checksum: bafe6ded727aab991ff03f6ff5a2fd1a41b1f429b36175f34140017fc684e0a8ef7f7b713d189bd49948c4b728fe1d05c7d8c20a0bea0d8c1ae1ed87614fe843
3124+
languageName: node
3125+
linkType: hard
3126+
3127+
"@lottiefiles/dotlottie-web@npm:0.40.1":
3128+
version: 0.40.1
3129+
resolution: "@lottiefiles/dotlottie-web@npm:0.40.1"
3130+
checksum: a79e60c33845311cb055ea661abb2f4211063e149788aea724afbed05a09ae569d50b4c0e5825d13eb5fc62a33c3dc74f2f3900fdb1e99f8594feddc72d2cc27
3131+
languageName: node
3132+
linkType: hard
3133+
31163134
"@lottiefiles/react-lottie-player@npm:^3.5.3":
31173135
version: 3.5.3
31183136
resolution: "@lottiefiles/react-lottie-player@npm:3.5.3"
@@ -14232,6 +14250,7 @@ coolshapes-react@lowcoder-org/coolshapes-react:
1423214250
"@fortawesome/free-regular-svg-icons": ^6.5.1
1423314251
"@fortawesome/free-solid-svg-icons": ^6.5.1
1423414252
"@fortawesome/react-fontawesome": latest
14253+
"@lottiefiles/dotlottie-react": ^0.13.0
1423514254
"@manaflair/redux-batch": ^1.0.0
1423614255
"@rjsf/antd": ^5.21.2
1423714256
"@rjsf/core": ^5.21.2

0 commit comments

Comments
 (0)