Skip to content

Commit 906df19

Browse files
Merge branch 'dev' into dynamic-style-fixes
2 parents 7929e20 + a28726f commit 906df19

File tree

18 files changed

+139
-31
lines changed

18 files changed

+139
-31
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ And we mean it... Day by day!
9090
## 💻 Deployment Options
9191
[![Deploy to AWS using Stitch](https://img.shields.io/badge/deploy_with-Stitch-%23E369F7?logo=amazonaws&color=%23E369F7)](https://deploy.stitch.tech/lowcoder/lowcoder)
9292

93-
[![Deploy in minutes on Elest.io](https://raw.githubusercontent.com/elestio-examples/element/main/deploy-on-elestio.png)](https://elest.io/open-source/lowcoder)
93+
[![Deploy to Elestio](https://img.shields.io/badge/Deploy_to-Elestio-%23E369F7?color=orange)](https://elest.io/open-source/lowcoder)
9494

9595
You can access Lowcoder from [cloud-hosted version](https://app.lowcoder.cloud/) at any time, or use the following resources for self-host Lowcoder on different platforms:
9696
- [Docker](https://docs.lowcoder.cloud/lowcoder-documentation/setup-and-run/self-hosting)
@@ -110,4 +110,4 @@ Like ... [@Darkjamin](https://github.com/Darkjamin), [@spacegoats-io](https://g
110110

111111
## Intro Video
112112

113-
[![Watch the video](https://i.ytimg.com/vi/s4ltAqS0hzM/maxresdefault.jpg?sqp=-oaymwEmCIAKENAF8quKqQMa8AEB-AH-CYAC0AWKAgwIABABGD0gSShyMA8=&rs=AOn4CLAlPOIFdtauythoBKNPXhi6XGwlDQ)](https://youtu.be/s4ltAqS0hzM?feature=shared)
113+
[![Watch the video](https://i.ytimg.com/vi/s4ltAqS0hzM/maxresdefault.jpg?sqp=-oaymwEmCIAKENAF8quKqQMa8AEB-AH-CYAC0AWKAgwIABABGD0gSShyMA8=&rs=AOn4CLAlPOIFdtauythoBKNPXhi6XGwlDQ)](https://youtu.be/s4ltAqS0hzM?feature=shared)

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"chalk": "4",
8181
"flag-icons": "^7.2.1",
8282
"number-precision": "^1.6.0",
83-
"posthog-js": "^1.144.2",
83+
"posthog-js": "^1.155.4",
8484
"react-countup": "^6.5.3",
8585
"react-player": "^2.11.0",
8686
"resize-observer-polyfill": "^1.5.1",

client/packages/lowcoder/src/comps/generators/list.tsx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ export type CustomListAction<CompCtor extends CompConstructor = CompConstructor>
2626
>;
2727

2828
type ListAction<CompCtor extends CompConstructor = CompConstructor> =
29+
| {
30+
type: "setChildrens";
31+
value: Array<ConstructorToDataType<CompCtor>>;
32+
}
2933
| {
3034
type: "push";
3135
value: ConstructorToDataType<CompCtor>;
@@ -145,7 +149,19 @@ export function list<ChildCompCtor extends CompConstructor<any, any>>(
145149

146150
private reduceCustom(action: ListAction<ChildCompCtor>): this {
147151
switch (action.type) {
148-
case "push":
152+
case "setChildrens": {
153+
const childrenMap: Record<number, ConstructorToComp<ChildCompCtor>> = {};
154+
const childrenOrder: number[] = [];
155+
action.value.forEach((children: any, key: number) => {
156+
childrenMap[key] = newChild(this.dispatch, String(key), children);
157+
childrenOrder.push(key);
158+
})
159+
return setFieldsNoTypeCheck(this, {
160+
children: childrenMap,
161+
childrenOrder: childrenOrder,
162+
});
163+
}
164+
case "push": {
149165
const key = this.genKey();
150166
const newChildren = {
151167
...this.children,
@@ -155,6 +171,7 @@ export function list<ChildCompCtor extends CompConstructor<any, any>>(
155171
children: newChildren,
156172
childrenOrder: [...this.childrenOrder, key],
157173
});
174+
}
158175
case "pushComp": {
159176
const key = this.genKey();
160177
const newChildren = {
@@ -209,6 +226,17 @@ export function list<ChildCompCtor extends CompConstructor<any, any>>(
209226
}
210227
}
211228
}
229+
230+
setChildrensAction(value: Array<ConstructorToDataType<ChildCompCtor>>) {
231+
return customAction<ListAction<ChildCompCtor>>(
232+
{
233+
type: "setChildrens",
234+
value: value,
235+
},
236+
true
237+
);
238+
}
239+
212240
pushAction(value: ConstructorToDataType<ChildCompCtor>) {
213241
return customAction<ListAction<ChildCompCtor>>(
214242
{

client/yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13822,7 +13822,7 @@ coolshapes-react@lowcoder-org/coolshapes-react:
1382213822
lowcoder-cli: "workspace:^"
1382313823
mq-polyfill: ^1.1.8
1382413824
number-precision: ^1.6.0
13825-
posthog-js: ^1.144.2
13825+
posthog-js: ^1.155.4
1382613826
prettier: ^3.1.0
1382713827
react-countup: ^6.5.3
1382813828
react-player: ^2.11.0
@@ -16126,14 +16126,14 @@ coolshapes-react@lowcoder-org/coolshapes-react:
1612616126
languageName: node
1612716127
linkType: hard
1612816128

16129-
"posthog-js@npm:^1.144.2":
16130-
version: 1.144.2
16131-
resolution: "posthog-js@npm:1.144.2"
16129+
"posthog-js@npm:^1.155.4":
16130+
version: 1.155.4
16131+
resolution: "posthog-js@npm:1.155.4"
1613216132
dependencies:
1613316133
fflate: ^0.4.8
1613416134
preact: ^10.19.3
1613516135
web-vitals: ^4.0.1
16136-
checksum: c856f49a34b825eb0678b40e137affa4a79a29ff64205f059a9a0ad78ce6ac8b3d8413f955e3fa72b08cf91e923e443aedb7e41b2e40c76c1cab20b88fe1c3d7
16136+
checksum: 749d180a4bfda0cb89307bad81eb230523c3e8f03dc94ac35dde212a130593a23dd98768bbff64753931dc501bca345397d7b39157dcc6eb174d57bd647c33d5
1613716137
languageName: node
1613816138
linkType: hard
1613916139

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/application/model/Application.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ public class Application extends HasIdAndAuditing {
5252
private Boolean publicToMarketplace;
5353
@Setter
5454
private Boolean agencyProfile;
55+
@Getter
56+
@Setter
57+
private String editingUserId;
5558

5659
public Application(
5760
@JsonProperty("orgId") String organizationId,
@@ -63,7 +66,8 @@ public Application(
6366
@JsonProperty("editingApplicationDSL") Map<String, Object> editingApplicationDSL,
6467
@JsonProperty("publicToAll") Boolean publicToAll,
6568
@JsonProperty("publicToMarketplace") Boolean publicToMarketplace,
66-
@JsonProperty("agencyProfile") Boolean agencyProfile
69+
@JsonProperty("agencyProfile") Boolean agencyProfile,
70+
@JsonProperty("editingUserId") String editingUserId
6771
) {
6872
this.gid = gid;
6973
this.organizationId = organizationId;
@@ -75,6 +79,7 @@ public Application(
7579
this.publicToMarketplace = publicToMarketplace;
7680
this.agencyProfile = agencyProfile;
7781
this.editingApplicationDSL = editingApplicationDSL;
82+
this.editingUserId = editingUserId;
7883
}
7984

8085
@Transient

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/application/service/ApplicationHistorySnapshotService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ public interface ApplicationHistorySnapshotService {
1818

1919
Mono<ApplicationHistorySnapshot> getHistorySnapshotDetail(String historySnapshotId);
2020

21+
Mono<ApplicationHistorySnapshot> getLastSnapshotByApp(String applicationId);
2122
}

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/application/service/ApplicationService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ public interface ApplicationService {
2323

2424
Mono<Application> publish(String applicationId);
2525

26+
Mono<Boolean> updateEditState(String applicationId, Boolean editingFinished);
27+
2628
Mono<Application> create(Application newApplication, String visitorId);
2729

2830
Flux<Application> findByOrganizationIdWithDsl(String organizationId);

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/application/service/ApplicationServiceImpl.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,16 @@ public Mono<Application> publish(String applicationId) {
9393
});
9494
}
9595

96+
@Override
97+
public Mono<Boolean> updateEditState(String applicationId, Boolean editingFinished) {
98+
return findById(applicationId)
99+
.flatMap(newApplication -> {
100+
Application application = Application.builder().editingUserId("").build();
101+
if(editingFinished) return mongoUpsertHelper.updateById(application, applicationId);
102+
return Mono.just(true);
103+
});
104+
}
105+
96106
@Override
97107
public Mono<Application> create(Application newApplication, String visitorId) {
98108
return repository.save(newApplication)

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/application/service/impl/ApplicationHistorySnapshotServiceImpl.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import static org.lowcoder.sdk.util.ExceptionUtils.deferredError;
55
import static org.lowcoder.sdk.util.ExceptionUtils.ofException;
66

7+
import java.time.Instant;
78
import java.util.List;
89
import java.util.Map;
910

@@ -57,4 +58,13 @@ public Mono<ApplicationHistorySnapshot> getHistorySnapshotDetail(String historyS
5758
return repository.findById(historySnapshotId)
5859
.switchIfEmpty(deferredError(INVALID_HISTORY_SNAPSHOT, "INVALID_HISTORY_SNAPSHOT", historySnapshotId));
5960
}
61+
62+
@Override
63+
public Mono<ApplicationHistorySnapshot> getLastSnapshotByApp(String applicationId) {
64+
ApplicationHistorySnapshot _default = new ApplicationHistorySnapshot();
65+
_default.setCreatedAt(Instant.ofEpochMilli(0));
66+
_default.setCreatedBy("");
67+
return repository.findAllByApplicationId(applicationId, PageRequest.of(0, 1).withSort(Direction.DESC, "createdAt"))
68+
.switchIfEmpty(Mono.just(_default)).next();
69+
}
6070
}

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/application/ApplicationApiService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ public interface ApplicationApiService {
3535

3636
Mono<ApplicationView> publish(String applicationId);
3737

38+
Mono<Boolean> updateEditState(String applicationId, ApplicationEndpoints.UpdateEditStateRequest updateEditStateRequest);
39+
3840
Mono<Boolean> grantPermission(String applicationId,
3941
Set<String> userIds,
4042
Set<String> groupIds, ResourceRole role);

0 commit comments

Comments
 (0)