Skip to content

Commit 9683aba

Browse files
authored
Merge pull request #1988 from lowcoder-org/dev
Dev -> Main for v2.7.4
2 parents 509405d + 262a60b commit 9683aba

File tree

66 files changed

+677
-285
lines changed

Some content is hidden

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

66 files changed

+677
-285
lines changed

client/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.7.3
1+
2.7.4

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder-frontend",
3-
"version": "2.7.3",
3+
"version": "2.7.4",
44
"type": "module",
55
"private": true,
66
"workspaces": [

client/packages/lowcoder-comps/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder-comps",
3-
"version": "2.7.3",
3+
"version": "2.7.4",
44
"type": "module",
55
"license": "MIT",
66
"dependencies": {

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

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ BarChartTmpComp = withViewFn(BarChartTmpComp, (comp) => {
6161
const [chartSize, setChartSize] = useState<ChartSize>();
6262
const firstResize = useRef(true);
6363
const theme = useContext(ThemeContext);
64+
const [chartKey, setChartKey] = useState(0);
65+
const prevRaceMode = useRef<boolean>();
6466
const defaultChartTheme = {
6567
color: chartColorPalette,
6668
backgroundColor: "#fff",
@@ -73,6 +75,16 @@ BarChartTmpComp = withViewFn(BarChartTmpComp, (comp) => {
7375
log.error('theme chart error: ', error);
7476
}
7577

78+
// Detect race mode changes and force chart recreation
79+
const currentRaceMode = comp.children.chartConfig?.children?.comp?.children?.race?.getView();
80+
useEffect(() => {
81+
if (prevRaceMode.current !== undefined && prevRaceMode.current !== currentRaceMode) {
82+
// Force chart recreation when race mode changes
83+
setChartKey(prev => prev + 1);
84+
}
85+
prevRaceMode.current = currentRaceMode;
86+
}, [currentRaceMode]);
87+
7688
const triggerClickEvent = async (dispatch: any, action: CompAction<JSONValue>) => {
7789
await getPromiseAfterDispatch(
7890
dispatch,
@@ -176,10 +188,11 @@ BarChartTmpComp = withViewFn(BarChartTmpComp, (comp) => {
176188
return (
177189
<div ref={containerRef} style={{height: '100%'}}>
178190
<ReactECharts
191+
key={chartKey}
179192
ref={(e) => (echartsCompRef.current = e)}
180193
style={{ height: "100%" }}
181-
notMerge
182-
lazyUpdate
194+
notMerge={!currentRaceMode}
195+
lazyUpdate={!currentRaceMode}
183196
opts={{ locale: getEchartsLocale() }}
184197
option={option}
185198
mode={mode}

client/packages/lowcoder-comps/src/comps/barChartComp/barChartUtils.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,15 @@ export function getEchartsConfig(
201201
animationEasing: 'linear',
202202
animationEasingUpdate: 'linear',
203203
}
204+
} else {
205+
// Ensure proper animation settings when race is disabled
206+
config = {
207+
...config,
208+
animationDuration: 1000,
209+
animationDurationUpdate: 1000,
210+
animationEasing: 'cubicOut',
211+
animationEasingUpdate: 'cubicOut',
212+
}
204213
}
205214
if (props.data.length <= 0) {
206215
// no data
@@ -333,6 +342,21 @@ export function getEchartsConfig(
333342
animationDurationUpdate: 300
334343
},
335344
}
345+
} else {
346+
// Reset axis animations when race is disabled
347+
config = {
348+
...config,
349+
xAxis: {
350+
...config.xAxis,
351+
animationDuration: undefined,
352+
animationDurationUpdate: undefined
353+
},
354+
yAxis: {
355+
...config.yAxis,
356+
animationDuration: undefined,
357+
animationDurationUpdate: undefined
358+
},
359+
}
336360
}
337361
}
338362
// console.log("Echarts transformedData and config", transformedData, config);

client/packages/lowcoder-comps/src/comps/basicChartComp/chartConfigs/barChartConfig.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const BarChartConfig = (function () {
5353
type: "bar",
5454
subtype: props.type,
5555
realtimeSort: props.race,
56-
seriesLayoutBy: props.race?'column':undefined,
56+
seriesLayoutBy: props.race?'column':'row',
5757
label: {
5858
show: props.showLabel,
5959
position: "top",

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

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ let CalendarBasicComp = (function () {
268268
const ref = createRef<HTMLDivElement>();
269269
const editEvent = useRef<EventInput>();
270270
const initData = useRef<boolean>(false);
271+
const clickTimeout = useRef<NodeJS.Timeout | null>(null);
271272
const [form] = Form.useForm();
272273
const [left, setLeft] = useState<number | undefined>(undefined);
273274
const [licensed, setLicensed] = useState<boolean>(props.licenseKey !== "");
@@ -370,6 +371,15 @@ let CalendarBasicComp = (function () {
370371
initData.current = true;
371372
}
372373
}, [JSON.stringify(initialEvents), comp?.children?.comp?.children?.initialData]);
374+
375+
// Cleanup timeout on unmount
376+
useEffect(() => {
377+
return () => {
378+
if (clickTimeout.current) {
379+
clearTimeout(clickTimeout.current);
380+
}
381+
};
382+
}, []);
373383

374384
const resources = useMemo(() => props.resources.value, [props.resources.value]);
375385

@@ -850,22 +860,30 @@ let CalendarBasicComp = (function () {
850860
handleEventDataChange,
851861
]);
852862

863+
const handleSingleClick = useCallback(() => {
864+
// Prevent double click from triggering the event
865+
// Use a timeout to debounce rapid clicks
866+
if (clickTimeout.current) {
867+
clearTimeout(clickTimeout.current);
868+
clickTimeout.current = null;
869+
return; // This was a double click, don't trigger
870+
}
871+
872+
clickTimeout.current = setTimeout(() => {
873+
props.onEvent('click');
874+
clickTimeout.current = null;
875+
}, 150); // Small delay to catch double clicks
876+
}, [props.onEvent]);
877+
853878
const handleDbClick = useCallback(() => {
854-
const event = props.updatedEventsData.find(
855-
(item: EventType) => item.id === editEvent.current?.id
856-
) as EventType;
857879
if (!props.editable || !editEvent.current) {
858880
return;
859881
}
860-
if (event) {
861-
showModal(event, true);
882+
if (onEventVal && onEventVal.some((e: any) => e.name === 'doubleClick')) {
883+
// Check if 'doubleClick' is included in the array
884+
props.onEvent('doubleClick');
862885
} else {
863-
if (onEventVal && onEventVal.some((e: any) => e.name === 'doubleClick')) {
864-
// Check if 'doubleClick' is included in the array
865-
props.onEvent('doubleClick');
866-
} else {
867-
showModal(editEvent.current as EventType, false);
868-
}
886+
showModal(editEvent.current as EventType, false);
869887
}
870888
}, [
871889
editEvent,
@@ -974,6 +992,9 @@ let CalendarBasicComp = (function () {
974992
allDaySlot={props.showAllDay}
975993
eventContent={renderEventContent}
976994
select={(info) => handleCreate(info)}
995+
dateClick={() => {
996+
handleSingleClick();
997+
}}
977998
eventClick={(info) => {
978999
const event = events.find(
9791000
(item: EventInput) => item.id === info.event.id
@@ -982,6 +1003,7 @@ let CalendarBasicComp = (function () {
9821003
setTimeout(() => {
9831004
editEvent.current = undefined;
9841005
}, 500);
1006+
handleSingleClick();
9851007
}}
9861008
moreLinkClick={(info) => {
9871009
let left = 0;

client/packages/lowcoder-core/lib/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,11 +1692,12 @@ class CodeNode extends AbstractNode {
16921692
// if query is dependent on itself, mark as ready
16931693
if (pathsArr?.[0] === options?.queryName)
16941694
return;
1695+
// TODO: check if this is needed after removing lazy load
16951696
// wait for lazy loaded comps to load before executing query on page load
1696-
if (value && !Object.keys(value).length && paths.size) {
1697-
isFetching = true;
1698-
ready = false;
1699-
}
1697+
// if (value && !Object.keys(value).length && paths.size) {
1698+
// isFetching = true;
1699+
// ready = false;
1700+
// }
17001701
if (_.has(value, IS_FETCHING_FIELD)) {
17011702
isFetching = isFetching || value.isFetching === true;
17021703
}

client/packages/lowcoder-core/src/eval/codeNode.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,12 @@ export class CodeNode extends AbstractNode<ValueAndMsg<unknown>> {
176176
// if query is dependent on itself, mark as ready
177177
if (pathsArr?.[0] === options?.queryName) return;
178178

179+
// TODO: check if this is needed after removing lazy load
179180
// wait for lazy loaded comps to load before executing query on page load
180-
if (value && !Object.keys(value).length && paths.size) {
181-
isFetching = true;
182-
ready = false;
183-
}
181+
// if (value && !Object.keys(value).length && paths.size) {
182+
// isFetching = true;
183+
// ready = false;
184+
// }
184185
if (_.has(value, IS_FETCHING_FIELD)) {
185186
isFetching = isFetching || value.isFetching === true;
186187
}

client/packages/lowcoder/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder",
3-
"version": "2.7.3",
3+
"version": "2.7.4",
44
"private": true,
55
"type": "module",
66
"main": "src/index.sdk.ts",

0 commit comments

Comments
 (0)