Skip to content

Commit 149ed67

Browse files
committed
update sdk version and add offline app demo
1 parent 8379dff commit 149ed67

File tree

215 files changed

+199
-11
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+199
-11
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
23.1 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"dependencies": {
1212
"history": "^5.3.0",
1313
"less": "^4.1.3",
14-
"openblocks-sdk": "^0.0.28",
14+
"openblocks-sdk": "^0.0.31",
1515
"react": "17",
1616
"react-dom": "17",
1717
"react-router": "^6.4.3",

src/App.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from "react-router-dom";
1111
import { AppDemo } from "./AppDemo";
1212
import { ModuleDemo } from "./ModuleDemo";
13+
import formDsl from "./dsl/form.json";
1314

1415
const demos = [
1516
{
@@ -31,6 +32,11 @@ const demos = [
3132
initialMethodName: "clearForm",
3233
initialInputs: { formTitle: "Student info" },
3334
},
35+
{
36+
title: "Use offline application dsl",
37+
dsl: formDsl,
38+
isModule: true,
39+
},
3440
];
3541

3642
function titleToPath(title: string) {
@@ -71,12 +77,13 @@ const routes: RouteObject[] = [
7177
path: titleToPath(i.title),
7278
element: i.isModule ? (
7379
<ModuleDemo
74-
appId={i.appId}
80+
appId={i.appId || ""}
81+
appDsl={i.dsl}
7582
initialModuleInputs={i.initialInputs}
76-
initialMethodName={i.initialMethodName}
83+
initialMethodName={i.initialMethodName || ""}
7784
/>
7885
) : (
79-
<AppDemo appId={i.appId} />
86+
<AppDemo appId={i.appId || ""} appDsl={i.dsl} />
8087
),
8188
})),
8289
},

src/AppDemo.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import { OpenblocksAppView } from "openblocks-sdk";
22

3-
export function AppDemo(props: { appId: string }) {
4-
return <OpenblocksAppView className="ob-app" appId={props.appId} />;
3+
export function AppDemo(props: { appId: string; appDsl?: any }) {
4+
return (
5+
<OpenblocksAppView
6+
baseUrl=""
7+
className="ob-app"
8+
appId={props.appId}
9+
appDsl={props.appDsl}
10+
/>
11+
);
512
}

src/ModuleDemo.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useRef, useState } from "react";
33

44
interface IProps {
55
appId: string;
6+
appDsl?: any;
67
initialModuleInputs: any;
78
initialMethodName: string;
89
}
@@ -84,6 +85,7 @@ export function ModuleDemo(props: IProps) {
8485
onModuleEventTriggered={handleEventTriggered}
8586
moduleInputs={inputs}
8687
appId={props.appId}
88+
appDsl={props.appDsl}
8789
ref={instanceRef}
8890
/>
8991
</div>

src/dsl/form.json

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
{
2+
"ui": {
3+
"compType": "module",
4+
"comp": {
5+
"io": {
6+
"inputs": [],
7+
"outputs": [
8+
{
9+
"description": "",
10+
"value": "{{input1.value}}",
11+
"name": "nameFieldValue"
12+
},
13+
{
14+
"description": "",
15+
"value": "{{input2.value}}",
16+
"name": "ageFieldValue"
17+
}
18+
]
19+
},
20+
"methods": [],
21+
"events": {
22+
"list": [{ "name": "onSubmit", "description": "" }],
23+
"enableEventTestMessage": true
24+
},
25+
"autoScaleCompHeight": false,
26+
"container": {
27+
"layout": {
28+
"fd981a80": { "i": "fd981a80", "h": 5, "w": 24, "x": 0, "y": 0 },
29+
"6efa557b": { "i": "6efa557b", "h": 5, "w": 24, "x": 0, "y": 6 },
30+
"f8cf25a1": { "i": "f8cf25a1", "h": 5, "w": 10, "x": 14, "y": 12 }
31+
},
32+
"items": {
33+
"fd981a80": {
34+
"compType": "input",
35+
"comp": {
36+
"value": "",
37+
"disabled": "",
38+
"label": {
39+
"text": "Name",
40+
"tooltip": "",
41+
"hidden": false,
42+
"width": "33",
43+
"widthUnit": "%",
44+
"position": "column",
45+
"align": "left"
46+
},
47+
"placeholder": "Please input your name",
48+
"onEvent": [],
49+
"readOnly": false,
50+
"required": false,
51+
"minLength": "",
52+
"maxLength": "",
53+
"validationType": "Text",
54+
"regex": "",
55+
"customRule": "",
56+
"formDataKey": "",
57+
"showCount": false,
58+
"allowClear": false,
59+
"style": {
60+
"label": "",
61+
"background": "",
62+
"border": "",
63+
"radius": "",
64+
"text": "",
65+
"accent": "",
66+
"validate": ""
67+
},
68+
"prefixIcon": "",
69+
"suffixIcon": "",
70+
"hidden": ""
71+
},
72+
"name": "input1"
73+
},
74+
"6efa557b": {
75+
"compType": "input",
76+
"comp": {
77+
"value": "",
78+
"disabled": "",
79+
"label": {
80+
"text": "Age",
81+
"tooltip": "",
82+
"hidden": false,
83+
"width": "33",
84+
"widthUnit": "%",
85+
"position": "column",
86+
"align": "left"
87+
},
88+
"placeholder": "Please input your age",
89+
"onEvent": [],
90+
"readOnly": false,
91+
"required": false,
92+
"minLength": "",
93+
"maxLength": "",
94+
"validationType": "Text",
95+
"regex": "",
96+
"customRule": "",
97+
"formDataKey": "",
98+
"showCount": false,
99+
"allowClear": false,
100+
"style": {
101+
"label": "",
102+
"background": "",
103+
"border": "",
104+
"radius": "",
105+
"text": "",
106+
"accent": "",
107+
"validate": ""
108+
},
109+
"prefixIcon": "",
110+
"suffixIcon": "",
111+
"hidden": ""
112+
},
113+
"name": "input2"
114+
},
115+
"f8cf25a1": {
116+
"compType": "button",
117+
"comp": {
118+
"text": "Submit",
119+
"type": "",
120+
"onEvent": [
121+
{
122+
"name": "click",
123+
"handler": {
124+
"compType": "triggerModuleEvent",
125+
"comp": { "name": "onSubmit" },
126+
"condition": "",
127+
"slowdown": "debounce",
128+
"delay": ""
129+
}
130+
}
131+
],
132+
"disabled": "",
133+
"loading": "",
134+
"form": "",
135+
"prefixIcon": "",
136+
"suffixIcon": "",
137+
"style": {
138+
"background": "",
139+
"border": "",
140+
"radius": "",
141+
"text": ""
142+
},
143+
"hidden": ""
144+
},
145+
"name": "button1"
146+
}
147+
}
148+
},
149+
"containerSize": { "height": 57, "width": 24 },
150+
"containerRowCount": 0,
151+
"hidden": ""
152+
}
153+
},
154+
"queries": [],
155+
"tempStates": [],
156+
"transformers": [],
157+
"hooks": [
158+
{ "compType": "urlParams", "comp": {}, "name": "url" },
159+
{ "compType": "momentJsLib", "comp": {}, "name": "moment" },
160+
{ "compType": "lodashJsLib", "comp": {}, "name": "_" },
161+
{ "compType": "utils", "comp": {}, "name": "utils" },
162+
{ "compType": "message", "comp": {}, "name": "message" },
163+
{ "compType": "localStorage", "comp": {}, "name": "localStorage" },
164+
{ "compType": "currentUser", "comp": {}, "name": "currentUser" }
165+
],
166+
"settings": {
167+
"maxWidth": { "dropdown": "1920", "input": "" },
168+
"themeId": "default",
169+
"customShortcuts": []
170+
},
171+
"preload": { "libs": [], "script": "", "css": "" }
172+
}

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ __metadata:
555555
"@vitejs/plugin-react": ^2.2.0
556556
history: ^5.3.0
557557
less: ^4.1.3
558-
openblocks-sdk: ^0.0.28
558+
openblocks-sdk: ^0.0.31
559559
react: 17
560560
react-dom: 17
561561
react-router: ^6.4.3
@@ -1685,13 +1685,13 @@ __metadata:
16851685
languageName: node
16861686
linkType: hard
16871687

1688-
"openblocks-sdk@npm:^0.0.28":
1689-
version: 0.0.28
1690-
resolution: "openblocks-sdk@npm:0.0.28::__archiveUrl=https%3A%2F%2Fregistry.npmjs.org%2Fopenblocks-sdk%2F-%2Fopenblocks-sdk-0.0.28.tgz"
1688+
"openblocks-sdk@npm:^0.0.31":
1689+
version: 0.0.31
1690+
resolution: "openblocks-sdk@npm:0.0.31::__archiveUrl=https%3A%2F%2Fregistry.npmjs.org%2Fopenblocks-sdk%2F-%2Fopenblocks-sdk-0.0.31.tgz"
16911691
peerDependencies:
16921692
react: ^17
16931693
react-dom: ^17
1694-
checksum: 470fac0b8c434f554ae043944c4f92661b1933732d99e16188565aae4f207954be6d588aae5e8622318808d49bc651c6db09df6a99d2f19e502faae2d89b8b22
1694+
checksum: 3b72c14d730e0d09ebe3903d32b2b53a5c4e042b633d6ee6d2c3c0f93d317b60ba2000651f251bfae6f149c8724c74e190239e20bcf19524b2748d8a9378c087
16951695
languageName: node
16961696
linkType: hard
16971697

0 commit comments

Comments
 (0)