Skip to content

Commit fab5301

Browse files
author
FalkWolsky
committed
Reverted changes for Workspaces.
1 parent 9595937 commit fab5301

File tree

19 files changed

+140
-1578
lines changed

19 files changed

+140
-1578
lines changed

client/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export default {
22
projects: ["<rootDir>/packages/lowcoder", "<rootDir>/packages/lowcoder-core"],
33
};
4+
// we use this for testing.

client/packages/create-lowcoder-plugin/package.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@
77
"chalk": "4",
88
"commander": "^9.4.1",
99
"cross-spawn": "^7.0.3",
10-
"fs-extra": "^10.1.0"
11-
},
12-
"peerDependencies": {
13-
"lowcoder-cli": "*",
14-
"lowcoder-dev-utils": "*",
15-
"lowcoder-sdk": "*"
10+
"fs-extra": "^10.1.0",
11+
"lowcoder-dev-utils": "workspace:^"
1612
},
1713
"license": "MIT",
1814
"keywords": [

client/packages/lowcoder-cli-template-typescript/package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,10 @@
1616
}
1717
},
1818
"devDependencies": {
19+
"lowcoder-cli": "workspace:^",
20+
"lowcoder-sdk": "workspace:^",
1921
"typescript": "^4.8.4",
20-
"vite": "^4.5.1"
21-
},
22-
"peerDependencies": {
23-
"lowcoder-cli": "*",
24-
"lowcoder-dev-utils": "*",
25-
"lowcoder-sdk": "*"
22+
"vite": "^4.3.9"
2623
},
2724
"keywords": [
2825
"Lowcoder, Component, Template, Plugin"

client/packages/lowcoder-cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@
2929
"commander": "^9.4.1",
3030
"cross-spawn": "^7.0.3",
3131
"fs-extra": "^10.1.0",
32+
"lowcoder-dev-utils": "workspace:^",
3233
"react": "^17",
3334
"react-dom": "^17",
3435
"react-json-view": "^1.21.3",
3536
"rollup-plugin-external-globals": "^0.7.1",
36-
"vite": "^4.5.1",
37+
"vite": "^4.3.9",
3738
"vite-plugin-css-injected-by-js": "^2.1.1",
3839
"vite-plugin-svgr": "^2.2.2"
3940
},
@@ -42,7 +43,6 @@
4243
"typescript": "^4.8.4"
4344
},
4445
"peerDependencies": {
45-
"lowcoder-dev-utils": "*",
4646
"lowcoder-sdk": "*"
4747
},
4848
"keywords": [

client/packages/lowcoder-comps/package.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
"big.js": "^6.2.1",
1717
"echarts-extension-gmap": "^1.6.0",
1818
"echarts-wordcloud": "^2.1.0",
19+
"lowcoder-cli": "workspace:^",
20+
"lowcoder-sdk": "workspace:^",
1921
"mermaid": "^10.2.4",
2022
"react": "17",
2123
"react-dom": "17",
22-
"react-resize-detector": "^7.0.0",
2324
"typescript": "4.8.4"
2425
},
2526
"lowcoder": {
@@ -69,12 +70,7 @@
6970
"devDependencies": {
7071
"jest": "29.3.0",
7172
"jest-canvas-mock": "^2.5.2",
72-
"vite": "^4.5.1",
73+
"vite": "^4.3.9",
7374
"vite-tsconfig-paths": "^3.6.0"
74-
},
75-
"peerDependencies": {
76-
"lowcoder-cli": "*",
77-
"lowcoder-dev-utils": "*",
78-
"lowcoder-sdk": "*"
7975
}
8076
}
Loading

client/packages/lowcoder-plugin-demo/icons/demo-icon.svg

Lines changed: 0 additions & 10 deletions
This file was deleted.

client/packages/lowcoder-plugin-demo/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { CompIDE } from "lowcoder-sdk";
33
import { name, version, lowcoder } from "./package.json";
44
import compMap from "./src/index";
55

6-
import "lowcoder-sdk/dist/style.css";
6+
import "../lowcoder-sdk/dist/style.css";
77

88
function CompDevApp() {
99
return (

client/packages/lowcoder-plugin-demo/locales/en.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

client/packages/lowcoder-plugin-demo/locales/zh_CN.json

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,40 @@
11
{
22
"name": "lowcoder-plugin-demo",
3-
"version": "0.0.1",
3+
"version": "0.0.4",
44
"type": "module",
55
"license": "MIT",
66
"dependencies": {
7-
"@types/react": "17",
8-
"@types/react-dom": "17",
9-
"lowcoder-sdk": "2.1.9",
7+
"lowcoder-core": "^0.0.1",
8+
"lowcoder-design": "^0.0.1",
109
"react": "17",
11-
"react-dom": "17",
12-
"typescript": "5.3.3",
13-
"vite": "^5.0.6"
10+
"react-dom": "17"
1411
},
15-
"devDependencies": {
16-
"@types/node": "16",
17-
"@types/react": "17",
18-
"@types/react-dom": "17",
19-
"react": "17",
20-
"react-dom": "17",
21-
"typescript": "5.3.3",
22-
"vite": "^5.0.6"
23-
},
24-
"peerDependencies": {
25-
"lowcoder-cli": "*",
26-
"lowcoder-dev-utils": "*",
27-
"lowcoder-sdk": "*"
12+
"publishConfig": {
13+
"registry": "https://registry.npmjs.com"
2814
},
2915
"lowcoder": {
3016
"description": "",
3117
"comps": {
3218
"hello_world": {
33-
"name": "__i18n_helloWorldCompName__",
34-
"icon": "./icons/demo-icon.svg"
19+
"name": "Hello World",
20+
"icon": "./icons/demo-icon.png"
21+
},
22+
"counter": {
23+
"name": "Counter",
24+
"icon": "./icons/demo-icon.png"
3525
}
3626
}
3727
},
3828
"scripts": {
3929
"start": "vite",
4030
"build": "lowcoder-cli build"
31+
},
32+
"devDependencies": {
33+
"@types/react": "17",
34+
"@types/react-dom": "17",
35+
"lowcoder-cli": "workspace:^",
36+
"lowcoder-sdk": "workspace:^",
37+
"typescript": "4.8.4",
38+
"vite": "^4.3.9"
4139
}
4240
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import {
2+
antd,
3+
UICompBuilder,
4+
numberExposingStateControl,
5+
Section,
6+
withDefault,
7+
withExposingConfigs,
8+
NumberControl,
9+
NameConfig,
10+
eventHandlerControl,
11+
withMethodExposing,
12+
} from "lowcoder-sdk";
13+
import styles from "./style.module.css";
14+
15+
const { Button } = antd;
16+
17+
const childrenMap = {
18+
value: numberExposingStateControl("value", 10),
19+
step: withDefault(NumberControl, 1),
20+
onEvent: eventHandlerControl([
21+
{
22+
label: "onChange",
23+
value: "change",
24+
description: "",
25+
},
26+
]),
27+
};
28+
29+
const CounterCompBase = new UICompBuilder(childrenMap, (props: any) => {
30+
const currentValue = props.value.value;
31+
return (
32+
<div className={styles.wrapper}>
33+
<Button
34+
onClick={() => {
35+
props.value.onChange(currentValue - props.step);
36+
props.onEvent("change");
37+
}}
38+
>
39+
-
40+
</Button>
41+
<span style={{ padding: "0 8px" }}>{currentValue}</span>
42+
<Button
43+
onClick={() => {
44+
props.value.onChange(currentValue + props.step);
45+
props.onEvent("change");
46+
}}
47+
>
48+
+
49+
</Button>
50+
</div>
51+
);
52+
})
53+
.setPropertyViewFn((children: any) => {
54+
return (
55+
<>
56+
<Section name="Basic">
57+
{children.value.propertyView({ label: "Initial Value" })}
58+
{children.step.propertyView({ label: "Step" })}
59+
</Section>
60+
<Section name="Interaction">{children.onEvent.propertyView()}</Section>
61+
</>
62+
);
63+
})
64+
.build();
65+
66+
const CounterCompTemp = withMethodExposing(CounterCompBase, [
67+
{
68+
method: {
69+
name: "random",
70+
params: [],
71+
},
72+
execute(comp: any) {
73+
comp.children.value.getView().onChange(Math.floor(Math.random() * 100));
74+
},
75+
},
76+
]);
77+
78+
export default withExposingConfigs(CounterCompTemp, [
79+
new NameConfig("value", ""),
80+
new NameConfig("step", ""),
81+
]);
Lines changed: 7 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,24 @@
11
import {
2-
antd,
32
UICompBuilder,
4-
numberExposingStateControl,
3+
stringExposingStateControl,
54
Section,
6-
withDefault,
75
withExposingConfigs,
8-
NumberControl,
96
NameConfig,
10-
eventHandlerControl,
11-
withMethodExposing,
12-
EditorContext,
137
} from "lowcoder-sdk";
14-
import React, { useContext } from "react";
158

16-
import styles from "./styles.module.css";
17-
18-
const { Button } = antd;
9+
import styles from "./style.module.css";
1910

2011
const childrenMap = {
21-
value: numberExposingStateControl("value", 10),
22-
step: withDefault(NumberControl, 1),
23-
onEvent: eventHandlerControl([
24-
{
25-
label: "onChange",
26-
value: "change",
27-
description: "",
28-
},
29-
]),
12+
text: stringExposingStateControl("text", "world"),
3013
};
3114

3215
const HelloWorldCompBase = new UICompBuilder(childrenMap, (props: any) => {
33-
const currentValue = props.value.value;
34-
return (
35-
<div className={styles.wrapper}>
36-
<Button
37-
onClick={() => {
38-
props.value.onChange(currentValue - props.step);
39-
props.onEvent("change");
40-
}}
41-
>
42-
-
43-
</Button>
44-
<span style={{ padding: "0 8px" }}>{currentValue}</span>
45-
<Button
46-
onClick={() => {
47-
props.value.onChange(currentValue + props.step);
48-
props.onEvent("change");
49-
}}
50-
>
51-
+
52-
</Button>
53-
</div>
54-
);
16+
const text = props.text.value;
17+
return <div className={styles.wrapper}>Hello {text}</div>;
5518
})
5619
.setPropertyViewFn((children: any) => {
57-
return (
58-
<>
59-
<Section name="Basic">
60-
{children.value.propertyView({ label: "Initial Value" })}
61-
{children.step.propertyView({ label: "Step" })}
62-
</Section>
63-
{/* {["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && ( */}
64-
<Section name="Interaction">{children.onEvent.propertyView()}</Section>
65-
{/* {[ )} */}
66-
</>
67-
);
20+
return <Section name="Basic">{children.text.propertyView({ label: "Text" })}</Section>;
6821
})
6922
.build();
7023

71-
const HelloWorldCompTemp = withMethodExposing(HelloWorldCompBase, [
72-
{
73-
method: {
74-
name: "random",
75-
params: [],
76-
},
77-
execute(comp: any) {
78-
comp.children.value.getView().onChange(Math.floor(Math.random() * 100));
79-
},
80-
},
81-
]);
82-
83-
export default withExposingConfigs(HelloWorldCompTemp, [
84-
new NameConfig("value", ""),
85-
new NameConfig("step", ""),
86-
]);
24+
export default withExposingConfigs(HelloWorldCompBase, [new NameConfig("text", "")]);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import CounterComp from "./CounterComp";
12
import HelloWorldComp from "./HelloWorldComp";
23

34
export default {
45
hello_world: HelloWorldComp,
6+
counter: CounterComp,
57
};
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
.wrapper {
2-
padding: 5px;
2+
color: red;
33
display: flex;
44
justify-content: center;
55
align-items: center;
66
height: 100%;
77
border: 1px solid #dddddd;
88
background-color: white;
9+
padding: 8px 0;
910
}

client/packages/lowcoder-plugin-demo/tsconfig.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,19 @@
1616
"isolatedModules": true,
1717
"noEmit": true,
1818
"jsx": "react-jsx",
19-
"baseUrl": "src"
19+
"baseUrl": "src",
20+
"paths": {
21+
"lowcoder-sdk": [
22+
"../../lowcoder/src/index.sdk.ts",
23+
"../node_modules/lowcoder-sdk/src/lowcoder/index.sdk.ts"
24+
],
25+
"*": [
26+
"*",
27+
"../../lowcoder/src/*",
28+
"../../lowcoder-sdk/src/*",
29+
"../node_modules/lowcoder-sdk/src/lowcoder/*"
30+
]
31+
}
2032
},
2133
"include": ["src", "index.tsx"]
2234
}

0 commit comments

Comments
 (0)