Skip to content

Commit 3779fa0

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/client/clsx-2.0.0
2 parents 2bd434c + 0d9726f commit 3779fa0

File tree

120 files changed

+2237
-320
lines changed

Some content is hidden

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

120 files changed

+2237
-320
lines changed

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@ updates:
66
directory: "/server/api-service"
77
schedule:
88
interval: "monthly"
9+
target-branch: "dev"
910
- package-ecosystem: "npm"
1011
directory: "/server/node-service"
1112
schedule:
1213
interval: "monthly"
14+
target-branch: "dev"
1315
- package-ecosystem: "npm"
1416
directory: "/client"
1517
schedule:
1618
interval: "monthly"
19+
target-branch: "dev"
1720
- package-ecosystem: "docker"
1821
directory: "/deploy/docker"
1922
schedule:
2023
interval: "monthly"
24+
target-branch: "dev"

client/README.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66

77
#### Use prebuilt docker image
88

9-
Simply run below command to start a backend server.
9+
Simply run the below command to start a backend server.
1010

1111
```bash
1212
docker run -d --name lowcoder -p 3000:3000 -v "$PWD/stacks:/lowcoder-stacks" lowcoderorg/lowcoder-ce
1313
```
1414

15-
For more information, view our [docs](../docs/self-hosting)
15+
For more information, view our [docs](https://docs.lowcoder.cloud/lowcoder-documentation/setup-and-run/self-hosting)
1616

1717
#### Build Docker image from source
1818

19-
1. Check out source code and change to source dir.
20-
2. Use the command below to build Docker image :
19+
1. Check out the source code and change to source dir.
20+
2. Use the command below to build a Docker image :
2121

2222
```bash
2323
docker build -f ./deploy/docker/Dockerfile -t lowcoder-dev .
@@ -31,11 +31,21 @@ docker run -d --name lowcoder-dev -p 3000:3000 -v "$PWD/stacks:/lowcoder-stacks"
3131

3232
### Start develop
3333

34-
1. Check out source code.
34+
1. Check out the source code.
3535
2. Change to client dir in the repository root via cd client.
36-
3. Run yarn to install dependencies: .
37-
4. Start dev server: `LOWCODER_API_SERVICE_URL=http://localhost:3000 yarn start`.
38-
5. After dev server starts successfully, it will be automatically opened in the default browser.
36+
37+
```bash
38+
cd client
39+
```
40+
41+
4. Run yarn to install dependencies: .
42+
43+
```bash
44+
yarn install
45+
```
46+
47+
5. Start dev server: `LOWCODER_API_SERVICE_URL=http://localhost:3000 yarn start`.
48+
6. After the dev server starts successfully, it will be automatically opened in the default browser.
3949

4050
### Before submitting a pull request
4151

client/packages/lowcoder-comps/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder-comps",
3-
"version": "0.0.12",
3+
"version": "0.0.13",
44
"type": "module",
55
"license": "MIT",
66
"dependencies": {
@@ -14,6 +14,7 @@
1414
"@types/react": "17",
1515
"@types/react-dom": "17",
1616
"big.js": "^6.2.1",
17+
"echarts-extension-gmap": "^1.6.0",
1718
"lowcoder-cli": "workspace:^",
1819
"lowcoder-sdk": "workspace:^",
1920
"mermaid": "^10.2.4",

client/packages/lowcoder-comps/src/comps/calendarComp/calendarComp.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ let CalendarBasicComp = (function () {
125125
isList={isList}
126126
bg={eventInfo.backgroundColor}
127127
theme={theme?.theme}
128+
allDay={showAllDay}
128129
$style={props.style}
129130
>
130131
<div className="event-time">{eventInfo.timeText}</div>

client/packages/lowcoder-comps/src/comps/calendarComp/calendarConstants.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ export const Wrapper = styled.div<{
388388
389389
.fc-scrollgrid-liquid > tbody {
390390
& > tr:nth-of-type(2) {
391-
display: none;
391+
display: ${(props) => props.allDay && 1};
392392
}
393393
}
394394
.fc .fc-timegrid-slot-label-cushion {
@@ -639,6 +639,7 @@ export const Event = styled.div<{
639639
bg: string;
640640
theme: Object;
641641
isList: boolean;
642+
allDay: boolean;
642643
$style: CalendarStyleType;
643644
}>`
644645
height: 100%;

client/packages/lowcoder-comps/src/comps/chartComp/chartComp.tsx

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@ import {
2626
withViewFn,
2727
ThemeContext,
2828
chartColorPalette,
29+
loadScript,
2930
} from "lowcoder-sdk";
3031
import { getEchartsLocale, trans } from "i18n/comps";
3132
import { ItemColorComp } from "comps/chartComp/chartConfigs/lineChartConfig";
3233
import {
3334
echartsConfigOmitChildren,
3435
getEchartsConfig,
3536
getSelectedPoints,
37+
loadGoogleMapsScript,
3638
} from "comps/chartComp/chartUtils";
39+
import 'echarts-extension-gmap';
3740
import log from "loglevel";
3841

3942
let ChartTmpComp = (function () {
@@ -45,6 +48,7 @@ let ChartTmpComp = (function () {
4548
ChartTmpComp = withViewFn(ChartTmpComp, (comp) => {
4649
const echartsCompRef = useRef<ReactECharts | null>();
4750
const [chartSize, setChartSize] = useState<ChartSize>();
51+
const [mapScriptLoaded, setMapScriptLoaded] = useState(false);
4852
const firstResize = useRef(true);
4953
const theme = useContext(ThemeContext);
5054
const defaultChartTheme = {
@@ -87,6 +91,34 @@ ChartTmpComp = withViewFn(ChartTmpComp, (comp) => {
8791
);
8892
}, [chartSize, ...Object.values(echartsConfigChildren)]);
8993

94+
const isMapScriptLoaded = useMemo(() => {
95+
return mapScriptLoaded || window?.google;
96+
}, [mapScriptLoaded])
97+
98+
const loadGoogleMapsData = () => {
99+
const echartsCompInstance = echartsCompRef?.current?.getEchartsInstance();
100+
if (!echartsCompInstance) {
101+
return _.noop;
102+
}
103+
echartsCompInstance.getModel().getComponent("gmap").getGoogleMap();
104+
}
105+
106+
const apiKey = comp.children.mapApiKey.getView();
107+
const mode = comp.children.mode.getView();
108+
useEffect(() => {
109+
if(mode === 'map') {
110+
const gMapScript = loadGoogleMapsScript('');
111+
if(isMapScriptLoaded) {
112+
loadGoogleMapsData();
113+
return;
114+
}
115+
gMapScript.addEventListener('load', function () {
116+
setMapScriptLoaded(true);
117+
loadGoogleMapsData();
118+
});
119+
}
120+
}, [mode, apiKey, option])
121+
90122
return (
91123
<ReactResizeDetector
92124
onResize={(w, h) => {
@@ -101,15 +133,17 @@ ChartTmpComp = withViewFn(ChartTmpComp, (comp) => {
101133
}
102134
}}
103135
>
104-
<ReactECharts
105-
ref={(e) => (echartsCompRef.current = e)}
106-
style={{ height: "100%" }}
107-
notMerge
108-
lazyUpdate
109-
opts={{ locale: getEchartsLocale() }}
110-
option={option}
111-
theme={themeConfig}
112-
/>
136+
{(mode !== 'map' || (mode === 'map' && isMapScriptLoaded)) && (
137+
<ReactECharts
138+
ref={(e) => (echartsCompRef.current = e)}
139+
style={{ height: "100%" }}
140+
notMerge
141+
lazyUpdate
142+
opts={{ locale: getEchartsLocale() }}
143+
option={option}
144+
theme={mode !== 'map' ? themeConfig : undefined}
145+
/>
146+
)}
113147
</ReactResizeDetector>
114148
);
115149
});

client/packages/lowcoder-comps/src/comps/chartComp/chartConfigs/chartUrls.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ const echartsUrlLocale = language === "zh" ? "zh" : "en";
44
export const optionUrl = `https://echarts.apache.org/${echartsUrlLocale}/option.html`;
55
export const examplesUrl = `https://echarts.apache.org/examples/${echartsUrlLocale}/index.html`;
66
export const xAxisTypeUrl = `${optionUrl}#xAxis.type`;
7+
export const googleMapsApiUrl = `https://maps.googleapis.com/maps/api/js`;
8+
export const mapOptionUrl = `https://github.com/plainheart/echarts-extension-gmap`;
9+
export const mapExamplesUrl = `https://codepen.io/plainheart/pen/VweLGbR`;

client/packages/lowcoder-comps/src/comps/chartComp/chartConstants.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { jsonControl, JSONObject, stateComp, toJSONObjectArray, toObject } from "lowcoder-sdk";
2-
import { StringControl } from "lowcoder-sdk";
2+
import { withDefault, BooleanControl, StringControl, NumberControl, JSONObjectControl } from "lowcoder-sdk";
33
import { dropdownControl } from "lowcoder-sdk";
44
import { eventHandlerControl } from "lowcoder-sdk";
55
import { valueComp, withType } from "lowcoder-sdk";
@@ -15,7 +15,6 @@ import { ScatterChartConfig } from "./chartConfigs/scatterChartConfig";
1515
import { SeriesListComp } from "./seriesComp";
1616
import { EChartsOption } from "echarts";
1717
import { i18nObjs, trans } from "i18n/comps";
18-
import { JSONValue } from "lowcoder";
1918

2019
export const ChartTypeOptions = [
2120
{
@@ -45,6 +44,10 @@ const chartModeOptions = [
4544
label: "ECharts JSON",
4645
value: "json",
4746
},
47+
{
48+
label: "Map",
49+
value: "map",
50+
},
4851
] as const;
4952

5053
export const EventOptions = [
@@ -221,6 +224,14 @@ export const chartUiModeChildren = {
221224
chartConfig: ChartOptionComp,
222225
};
223226

227+
const chartMapModeChildren = {
228+
mapApiKey: withDefault(StringControl, ''),
229+
mapZoomLevel: withDefault(NumberControl, 3),
230+
mapCenterLng: withDefault(NumberControl, 15.932644),
231+
mapCenterLat: withDefault(NumberControl, 50.942063),
232+
mapOptions: jsonControl(toObject, i18nObjs.defaultMapJsonOption),
233+
}
234+
224235
export const chartChildrenMap = {
225236
mode: dropdownControl(chartModeOptions, "ui"),
226237
echartsOption: jsonControl(toObject, i18nObjs.defaultEchartsJsonOption),
@@ -236,6 +247,7 @@ export const chartChildrenMap = {
236247
}>
237248
>([]),
238249
...chartUiModeChildren,
250+
...chartMapModeChildren,
239251
};
240252

241253
const chartUiChildrenMap = uiChildren(chartChildrenMap);

client/packages/lowcoder-comps/src/comps/chartComp/chartPropertyView.tsx

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ import {
99
RedButton,
1010
Section,
1111
sectionNames,
12+
controlItem,
1213
} from "lowcoder-sdk";
1314
import { trans } from "i18n/comps";
14-
import { examplesUrl, optionUrl } from "./chartConfigs/chartUrls";
15+
import { examplesUrl, mapExamplesUrl, mapOptionUrl, optionUrl } from "./chartConfigs/chartUrls";
1516

1617
export function chartPropertyView(
1718
children: ChartCompChildrenType,
@@ -147,6 +148,58 @@ export function chartPropertyView(
147148
</>
148149
);
149150

151+
const mapModePropertyView = (
152+
<>
153+
<Section name={'Map Configuration'}>
154+
{children.mapApiKey.propertyView({
155+
label: "API Key"
156+
})}
157+
{children.mapZoomLevel.propertyView({
158+
label: "Zoom Level"
159+
})}
160+
{controlItem({}, (
161+
<b style={{marginTop: '8px'}}>
162+
{'Center Position'}
163+
</b>
164+
))}
165+
{children.mapCenterLng.propertyView({
166+
label: "Longitude"
167+
})}
168+
{children.mapCenterLat.propertyView({
169+
label: "Latitude"
170+
})}
171+
</Section>
172+
<Section name={'Map Data'}>
173+
{children.mapOptions.propertyView({
174+
label: trans("chart.echartsOptionLabel"),
175+
styleName: "higher",
176+
tooltip: (
177+
<div>
178+
<a href={mapOptionUrl} target="_blank" rel="noopener noreferrer">
179+
{trans("chart.echartsMapOptionTooltip")}
180+
</a>
181+
<br />
182+
<a href={mapExamplesUrl} target="_blank" rel="noopener noreferrer">
183+
{trans("chart.echartsMapOptionExamples")}
184+
</a>
185+
</div>
186+
),
187+
})}
188+
</Section>
189+
<Section name={sectionNames.layout}>{hiddenPropertyView(children)}</Section>
190+
</>
191+
);
192+
193+
const getChatConfigByMode = (mode: string) => {
194+
switch(mode) {
195+
case "ui":
196+
return uiModePropertyView;
197+
case "json":
198+
return jsonModePropertyView;
199+
case "map":
200+
return mapModePropertyView;
201+
}
202+
}
150203
return (
151204
<>
152205
<Section name={trans("chart.mode")}>
@@ -155,7 +208,7 @@ export function chartPropertyView(
155208
radioButton: true,
156209
})}
157210
</Section>
158-
{children.mode.getView() === "ui" ? uiModePropertyView : jsonModePropertyView}
211+
{getChatConfigByMode(children.mode.getView())}
159212
</>
160213
);
161214
}

0 commit comments

Comments
 (0)