Skip to content

Commit ed1a330

Browse files
authored
Merge branch 'dev' into subscription-handling
2 parents 6153ddf + c771ef9 commit ed1a330

File tree

101 files changed

+24990
-624
lines changed

Some content is hidden

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

101 files changed

+24990
-624
lines changed

client/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.12
1+
2.4.13

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.4.12",
3+
"version": "2.4.13",
44
"type": "module",
55
"private": true,
66
"workspaces": [

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder-cli-template-typescript",
3-
"version": "0.0.20",
3+
"version": "0.0.22",
44
"type": "module",
55
"scripts": {
66
"start": "NODE_OPTIONS=--max_old_space_size=6144 vite",
@@ -22,7 +22,9 @@
2222
}
2323
},
2424
"dependencies": {
25+
"@observablehq/inspector": "^5.0.1",
2526
"@observablehq/runtime": "^4.8.2",
27+
"@observablehq/stdlib": "^5.8.8",
2628
"@types/react": "^18.2.45",
2729
"@types/react-dom": "^18.2.18",
2830
"lowcoder-cli": "^0.0.30",

client/packages/lowcoder-cli-template-typescript/src/vendors/Chart.jsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import React from 'react';
22
import PropTypes from 'prop-types'
3-
import { Runtime, Inspector } from '@observablehq/runtime';
3+
import { Runtime } from '@observablehq/runtime';
4+
import { Inspector } from "@observablehq/inspector";
5+
import { Library } from "@observablehq/stdlib";
6+
7+
const library = new Library();
48

59
function Chart(props) {
610
const [chartRef, setChartRef] = React.useState();
@@ -16,21 +20,20 @@ function Chart(props) {
1620
main.variable().define('translateXtoY', function() {
1721
return x => 50 * Math.sin((Math.PI / 50) * x - (1 / 2) * Math.PI) + 50;
1822
});
19-
main.variable().define('d3', ['require'], function(require) {
20-
return require('https://d3js.org/d3.v5.min.js');
23+
main.variable().define('d3', [], function() {
24+
return Library.require('https://d3js.org/d3.v5.min.js');
2125
});
2226

2327
// Define the HillChart class
24-
main.variable().define('HillChart', ['d3', 'DOM', 'translateXtoY'], function(d3, DOM, translateXtoY) {
28+
main.variable().define('HillChart', ['d3', 'translateXtoY'], function(d3, translateXtoY) {
2529
return class HillChart {
2630
constructor(chart_height, chart_width, items) {
2731
this.chart_height = chart_height;
2832
this.chart_width = chart_width;
2933
this.items = items;
30-
31-
this.svg = d3.select(DOM.svg(this.chart_width, this.chart_height)).attr('viewBox', `-20 -20 ${this.chart_width + 80} ${this.chart_height + 20}`);
34+
35+
this.svg = d3.select(library.DOM.svg(this.chart_width, this.chart_height)).attr('viewBox', `-20 -20 ${this.chart_width + 80} ${this.chart_height + 20}`);
3236
}
33-
3437

3538
render() {
3639
const xScale = d3

client/packages/lowcoder/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"react-sortable-hoc": "^2.0.0",
8787
"react-test-renderer": "^18.1.0",
8888
"react-use": "^17.3.2",
89+
"react-webcam": "^7.2.0",
8990
"really-relaxed-json": "^0.3.2",
9091
"redux-devtools-extension": "^2.13.9",
9192
"redux-saga": "^1.1.3",

client/packages/lowcoder/src/base/codeEditor/codeEditor.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,13 @@ function useCodeMirror(
220220
const showLineNum = props.showLineNum ?? getStyle(props.styleName).showLineNum;
221221

222222
const handleChange = useCallback(
223-
debounce((state: EditorState) => {
223+
(state: EditorState) => {
224224
window.clearTimeout(isTypingRef.current);
225-
isTypingRef.current = window.setTimeout(() => (isTypingRef.current = 0), 100);
226-
onChange?.(state);
227-
}, 1000)
225+
isTypingRef.current = window.setTimeout(() => {
226+
isTypingRef.current = 0;
227+
onChange?.(state);
228+
}, 500);
229+
}
228230
, [onChange]
229231
);
230232

client/packages/lowcoder/src/components/ThemeSettingsSelector.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,8 @@ export default function ThemeSettingsSelector(props: ColorConfigProps) {
576576

577577
<Slider
578578
style={{ width: "90%", margin: "8px 5% 0 5%"}}
579-
min={6} // Define the minimum value for the slider
580-
max={20} // Define the maximum value for the slider
579+
min={4} // Define the minimum value for the slider
580+
max={100} // Define the maximum value for the slider
581581
value={parseInt(gridRowHeight || "8")}
582582
onChange={(value) => setGridRowHeight(value.toString())}
583583
onChangeComplete={(value) => gridSizeInputBlur(value.toString())}

client/packages/lowcoder/src/components/layout/SideBarSection.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export const SideBarSection = (props: SideBarSectionProps) => {
2424
const user = useSelector<AppState, User>(getUser);
2525
const applications = useSelector<AppState, ApplicationMeta[]>(normalAppListSelector);
2626
const currentPath = useLocation().pathname;
27-
27+
const isShow = props.items.map(item => item.visible ? item.visible({ user: user, applications: applications }) : true).includes(true);
2828
return (
29-
<Wrapper className={CNSidebarSection} style={props.style}>
29+
<Wrapper className={ isShow ? CNSidebarSection : ''} style={props.style}>
3030
{props.title}
3131
{props.items
3232
.filter((item) =>

client/packages/lowcoder/src/components/table/columnTypeView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const ColumnTypeHoverView = styled.div<{
3838
max-height: 150px;
3939
max-width: 300px;
4040
overflow: auto;
41-
background: inherit;
41+
background: #fafafa;
4242
z-index: 3;
4343
padding: ${(props) => props.$padding};
4444
top: ${(props) => `${props.$adjustTop || 0}px`};

client/packages/lowcoder/src/comps/comps/appSettingsComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ const childrenMap = {
216216
lowcoderCompVersion: withDefault(StringControl, 'latest'),
217217
maxWidth: dropdownInputSimpleControl(OPTIONS, USER_DEFINE, "1920"),
218218
gridColumns: RangeControl.closed(8, 48, 24),
219-
gridRowHeight: RangeControl.closed(6, 20, 8),
219+
gridRowHeight: RangeControl.closed(4, 100, 8),
220220
gridRowCount: withDefault(NumberControl, DEFAULT_ROW_COUNT),
221221
gridPaddingX: withDefault(NumberControl, 20),
222222
gridPaddingY: withDefault(NumberControl, 20),

client/packages/lowcoder/src/comps/comps/containerComp/containerView.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ import { selectCompModifierKeyPressed } from "util/keyUtils";
6262
import { defaultLayout, GridItemComp, GridItemDataType } from "../gridItemComp";
6363
import { ThemeContext } from "comps/utils/themeContext";
6464
import { defaultTheme } from "@lowcoder-ee/constants/themeConstants";
65+
import { ExpandViewContext } from "../tableComp/expansionControl";
6566

6667
const childrenMap = {
6768
layout: valueComp<Layout>({}),
@@ -357,11 +358,12 @@ export const InnerGrid = React.memo((props: ViewPropsWithSelect) => {
357358
|| String(DEFAULT_GRID_COLUMNS);
358359
}, [horizontalGridCells, positionParams.cols]);
359360

361+
const isExpandView = useContext(ExpandViewContext);
360362
const isDroppable =
361-
useContext(IsDroppable) && (_.isNil(props.isDroppable) || props.isDroppable) && !readOnly;
362-
const isDraggable = !readOnly && (_.isNil(props.isDraggable) || props.isDraggable);
363-
const isResizable = !readOnly && (_.isNil(props.isResizable) || props.isResizable);
364-
const isSelectable = !readOnly && (_.isNil(props.isSelectable) || props.isSelectable);
363+
useContext(IsDroppable) && (_.isNil(props.isDroppable) || props.isDroppable) && !readOnly && !isExpandView;
364+
const isDraggable = !readOnly && !isExpandView && (_.isNil(props.isDraggable) || props.isDraggable);
365+
const isResizable = !readOnly && !isExpandView && (_.isNil(props.isResizable) || props.isResizable);
366+
const isSelectable = !readOnly && !isExpandView && (_.isNil(props.isSelectable) || props.isSelectable);
365367
const extraLayout = useMemo(
366368
() =>
367369
getExtraLayout(
@@ -484,7 +486,7 @@ export const InnerGrid = React.memo((props: ViewPropsWithSelect) => {
484486
setRowCount(Infinity);
485487
onRowCountChange?.(0);
486488
}
487-
}, [isRowCountLocked, onRowCountChange]);
489+
}, [isRowCountLocked, positionParams.rowHeight, onRowCountChange]);
488490

489491
// log.info("rowCount:", currentRowCount, "rowHeight:", currentRowHeight);
490492

client/packages/lowcoder/src/comps/comps/dateComp/dateComp.tsx

Lines changed: 68 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ import { DateRangeUIView } from "comps/comps/dateComp/dateRangeUIView";
5050
import { EditorContext } from "comps/editorState";
5151
import { dropdownControl } from "comps/controls/dropdownControl";
5252
import { timeZoneOptions } from "./timeZone";
53+
import { migrateOldData } from "@lowcoder-ee/comps/generators/simpleGenerators";
54+
import { fixOldInputCompData } from "../textInputComp/textInputConstants";
5355

5456

5557

@@ -142,6 +144,7 @@ function validate(
142144
}
143145

144146
const childrenMap = {
147+
defaultValue: stringExposingStateControl("defaultValue"),
145148
value: stringExposingStateControl("value"),
146149
userTimeZone: stringExposingStateControl("userTimeZone", Intl.DateTimeFormat().resolvedOptions().timeZone),
147150
...commonChildren,
@@ -170,18 +173,25 @@ export type DateCompViewProps = Pick<
170173
placeholder?: string | [string, string];
171174
};
172175

173-
export const datePickerControl = new UICompBuilder(childrenMap, (props) => {
176+
const DatePickerTmpCmp = new UICompBuilder(childrenMap, (props) => {
177+
const defaultValue = { ...props.defaultValue }.value;
178+
const value = { ...props.value }.value;
179+
174180
let time: dayjs.Dayjs | null = null;
175-
if (props.value.value !== '') {
176-
time = dayjs(props.value.value, DateParser);
181+
if (value !== '') {
182+
time = dayjs(value, DateParser);
177183
}
178184

179185
const [tempValue, setTempValue] = useState<dayjs.Dayjs | null>(time);
180186

181187
useEffect(() => {
182-
const value = props.value.value ? dayjs(props.value.value, DateParser) : null;
183-
setTempValue(value);
184-
}, [props.value.value])
188+
props.value.onChange(defaultValue);
189+
}, [defaultValue]);
190+
191+
useEffect(() => {
192+
const newValue = value ? dayjs(value, DateParser) : null;
193+
setTempValue(newValue);
194+
}, [value])
185195

186196
const handleDateZoneChange = (newTimeZone: any) => {
187197
props.userTimeZone.onChange(newTimeZone)
@@ -234,7 +244,7 @@ export const datePickerControl = new UICompBuilder(childrenMap, (props) => {
234244
return (
235245
<>
236246
<Section name={sectionNames.basic}>
237-
{children.value.propertyView({
247+
{children.defaultValue.propertyView({
238248
label: trans("prop.defaultValue"),
239249
placeholder: "2022-04-07 21:39:59",
240250
tooltip: trans("date.formatTip")
@@ -304,38 +314,76 @@ export const datePickerControl = new UICompBuilder(childrenMap, (props) => {
304314
.setExposeMethodConfigs(dateRefMethods)
305315
.build();
306316

307-
export const dateRangeControl = (function () {
317+
export const datePickerControl = migrateOldData(DatePickerTmpCmp, fixOldInputCompData);
318+
319+
export function fixOldDateOrTimeRangeData(oldData: any) {
320+
if (!oldData) return oldData;
321+
322+
let {defaultStart, defaultEnd} = oldData
323+
if (Boolean(oldData.start) && !Boolean(oldData.defaultStart)) {
324+
defaultStart = oldData.start;
325+
}
326+
if (Boolean(oldData.end) && !Boolean(oldData.defaultEnd)) {
327+
defaultEnd = oldData.end;
328+
}
329+
return {
330+
...oldData,
331+
defaultStart,
332+
defaultEnd,
333+
start: '',
334+
end: '',
335+
};
336+
// return oldData;
337+
}
338+
339+
let DateRangeTmpCmp = (function () {
308340
const childrenMap = {
341+
defaultStart: stringExposingStateControl("defaultStart"),
309342
start: stringExposingStateControl("start"),
343+
defaultEnd: stringExposingStateControl("defaultEnd"),
310344
end: stringExposingStateControl("end"),
311345
userRangeTimeZone: stringExposingStateControl("userRangeTimeZone" , Intl.DateTimeFormat().resolvedOptions().timeZone),
312346
...formDataChildren,
313347
...commonChildren,
314348
};
315349

316350
return new UICompBuilder(childrenMap, (props) => {
351+
const defaultStart = { ...props.defaultStart }.value;
352+
const startValue = { ...props.start }.value;
353+
354+
const defaultEnd = { ...props.defaultEnd }.value;
355+
const endValue = { ...props.end }.value;
356+
317357
let start: dayjs.Dayjs | null = null;
318-
if (props.start.value !== '') {
319-
start = dayjs(props.start.value, DateParser);
358+
if (startValue !== '') {
359+
start = dayjs(startValue, DateParser);
320360
}
321361

322362
let end: dayjs.Dayjs | null = null;
323-
if (props.end.value !== '') {
324-
end = dayjs(props.end.value, DateParser);
363+
if (endValue !== '') {
364+
end = dayjs(endValue, DateParser);
325365
}
326366

327367
const [tempStartValue, setTempStartValue] = useState<dayjs.Dayjs | null>(start);
328368
const [tempEndValue, setTempEndValue] = useState<dayjs.Dayjs | null>(end);
329369

330370
useEffect(() => {
331-
const value = props.start.value ? dayjs(props.start.value, DateParser) : null;
371+
props.start.onChange(defaultStart);
372+
}, [defaultStart]);
373+
374+
useEffect(() => {
375+
props.end.onChange(defaultEnd);
376+
}, [defaultEnd]);
377+
378+
useEffect(() => {
379+
const value = startValue ? dayjs(startValue, DateParser) : null;
332380
setTempStartValue(value);
333-
}, [props.start.value])
381+
}, [startValue])
334382

335383
useEffect(() => {
336-
const value = props.end.value ? dayjs(props.end.value, DateParser) : null;
384+
const value = endValue ? dayjs(endValue, DateParser) : null;
337385
setTempEndValue(value);
338-
}, [props.end.value])
386+
}, [endValue])
339387

340388

341389
const handleDateRangeZoneChange = (newTimeZone: any) => {
@@ -399,12 +447,12 @@ export const dateRangeControl = (function () {
399447
return (
400448
<>
401449
<Section name={sectionNames.basic}>
402-
{children.start.propertyView({
450+
{children.defaultStart.propertyView({
403451
label: trans("date.start"),
404452
placeholder: "2022-04-07 21:39:59",
405453
tooltip: trans("date.formatTip"),
406454
})}
407-
{children.end.propertyView({
455+
{children.defaultEnd.propertyView({
408456
label: trans("date.end"),
409457
placeholder: "2022-04-07 21:39:59",
410458
tooltip: trans("date.formatTip"),
@@ -471,6 +519,8 @@ export const dateRangeControl = (function () {
471519
.build();
472520
})();
473521

522+
export const dateRangeControl = migrateOldData(DateRangeTmpCmp, fixOldDateOrTimeRangeData);
523+
474524
const getTimeZoneInfo = (timeZone: any, otherTimeZone: any) => {
475525
const tz = timeZone === 'UserChoice' ? otherTimeZone : timeZone;
476526

0 commit comments

Comments
 (0)