Skip to content

Commit b96b468

Browse files
authored
Merge branch 'dev' into dependabot/npm_and_yarn/client/word-wrap-1.2.4
2 parents 2f500fd + 93a0023 commit b96b468

File tree

383 files changed

+15310
-1655
lines changed

Some content is hidden

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

383 files changed

+15310
-1655
lines changed

.DS_Store

6 KB
Binary file not shown.

.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-cli/client.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ declare var LOWCODER_NODE_SERVICE_URL: string;
3434
declare var LOWCODER_SHOW_BRAND: string;
3535
declare var LOWCODER_CUSTOM_LOGO: string;
3636
declare var LOWCODER_CUSTOM_LOGO_SQUARE: string;
37+
declare var LOWCODER_CUSTOM_AUTH_WELCOME_TEXT: string;
3738
declare var REACT_APP_ENV: string;
3839
declare var REACT_APP_BUILD_ID: string;
3940
declare var REACT_APP_LOG_LEVEL: string;

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: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ import {
4949
viewClassNames,
5050
FormWrapper,
5151
} from "./calendarConstants";
52-
import moment from "moment";
52+
import dayjs from "dayjs";
5353

5454
const childrenMap = {
5555
events: jsonValueExposingStateControl("events", defaultData),
@@ -79,8 +79,8 @@ let CalendarBasicComp = (function () {
7979
return {
8080
title: item.title,
8181
id: item.id,
82-
start: moment(item.start, DateParser).format(),
83-
end: moment(item.end, DateParser).format(),
82+
start: dayjs(item.start, DateParser).format(),
83+
end: dayjs(item.end, DateParser).format(),
8484
allDay: item.allDay,
8585
color: isValidColor(item.color || "") ? item.color : theme?.theme?.primary,
8686
...(item.groupId ? { groupId: item.groupId } : null),
@@ -104,7 +104,7 @@ let CalendarBasicComp = (function () {
104104
const isList = eventInfo.view.type === "listWeek";
105105
let sizeClass = "";
106106
if ([ViewType.WEEK, ViewType.DAY].includes(eventInfo.view.type as ViewType)) {
107-
const duration = moment(eventInfo.event.end).diff(moment(eventInfo.event.start), "minutes");
107+
const duration = dayjs(eventInfo.event.end).diff(dayjs(eventInfo.event.start), "minutes");
108108
if (duration <= 30 || eventInfo.event.allDay) {
109109
sizeClass = "small";
110110
} else if (duration <= 60) {
@@ -114,7 +114,7 @@ let CalendarBasicComp = (function () {
114114
}
115115
}
116116
const stateClass =
117-
moment().isAfter(moment(eventInfo.event.end)) &&
117+
dayjs().isAfter(dayjs(eventInfo.event.end)) &&
118118
(eventInfo.view.type as ViewType) !== ViewType.MONTH
119119
? "past"
120120
: "";
@@ -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>
@@ -177,7 +178,7 @@ let CalendarBasicComp = (function () {
177178
end: info.endStr,
178179
};
179180
const view = info.view.type as ViewType;
180-
const duration = moment(info.end).diff(moment(info.start), "minutes");
181+
const duration = dayjs(info.end).diff(dayjs(info.start), "minutes");
181182
const singleClick =
182183
(view === ViewType.MONTH && duration === 1440) ||
183184
([ViewType.WEEK, ViewType.DAY].includes(view) && duration === 30) ||
@@ -355,8 +356,8 @@ let CalendarBasicComp = (function () {
355356
let changeEvents: EventType[] = [];
356357
info.forEach((item) => {
357358
const event = events.find((i: EventType) => i.id === item.id);
358-
const start = moment(item.start, DateParser).format();
359-
const end = moment(item.end, DateParser).format();
359+
const start = dayjs(item.start, DateParser).format();
360+
const end = dayjs(item.end, DateParser).format();
360361
if (
361362
start !== event?.start ||
362363
end !== event?.end ||

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
UnderlineCss,
1818
} from "lowcoder-sdk";
1919
import styled from "styled-components";
20-
import moment from "moment";
20+
import dayjs from "dayjs";
2121
import {
2222
DayHeaderContentArg,
2323
FormatterInput,
@@ -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%;
@@ -813,15 +814,15 @@ export const defaultData = [
813814
{
814815
id: "1",
815816
title: "Coding",
816-
start: moment().hours(10).minutes(0).second(0).format(DATE_TIME_FORMAT),
817-
end: moment().hours(11).minutes(30).second(0).format(DATE_TIME_FORMAT),
817+
start: dayjs().hour(10).minute(0).second(0).format(DATE_TIME_FORMAT),
818+
end: dayjs().hour(11).minute(30).second(0).format(DATE_TIME_FORMAT),
818819
color: "#079968",
819820
},
820821
{
821822
id: "2",
822823
title: "Rest",
823-
start: moment().hours(24).format(DATE_FORMAT),
824-
end: moment().hours(48).format(DATE_FORMAT),
824+
start: dayjs().hour(24).format(DATE_FORMAT),
825+
end: dayjs().hour(48).format(DATE_FORMAT),
825826
allDay: true,
826827
},
827828
];
@@ -852,10 +853,10 @@ const weekHeadContent = (info: DayHeaderContentArg) => {
852853
const leftTimeContent = (info: SlotLabelContentArg) => {
853854
let isPast = false;
854855
if (info.view.type === ViewType.WEEK) {
855-
isPast = moment().isAfter(moment(moment().format("YYYY MM DD " + info.text)));
856+
isPast = dayjs().isAfter(dayjs(dayjs().format("YYYY MM DD " + info.text)));
856857
} else if (info.view.type === ViewType.DAY) {
857-
isPast = moment().isAfter(
858-
moment(moment(info.view.activeStart).format("YYYY MM DD " + info.text))
858+
isPast = dayjs().isAfter(
859+
dayjs(dayjs(info.view.activeStart).format("YYYY MM DD " + info.text))
859860
);
860861
}
861862
return {
@@ -887,9 +888,9 @@ export const slotLabelFormat = [
887888
export const viewClassNames = (info: ViewContentArg) => {
888889
let className = "";
889890
if ([ViewType.WEEK, ViewType.DAY].includes(info.view.type as ViewType)) {
890-
if (moment().isAfter(info.view.activeEnd)) {
891+
if (dayjs().isAfter(info.view.activeEnd)) {
891892
className = "past";
892-
} else if (moment().isBefore(info.view.activeStart)) {
893+
} else if (dayjs().isBefore(info.view.activeStart)) {
893894
className = "future";
894895
}
895896
}

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);

0 commit comments

Comments
 (0)