Skip to content

Commit 9eb33af

Browse files
authored
Merge branch 'main' into layout-component
2 parents 0fcf771 + 730c161 commit 9eb33af

File tree

20 files changed

+210
-64
lines changed

20 files changed

+210
-64
lines changed

client/packages/lowcoder-design/src/components/customSelect.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,29 @@ const SelectWrapper = styled.div<{ border?: boolean }>`
7171
}
7272
`;
7373

74-
export type CustomSelectProps = {
74+
export interface CustomSelectProps extends AntdSelectProps {
7575
children?: JSX.Element | React.ReactNode;
76-
innerRef?: React.Ref<HTMLDivElement> | undefined;
7776
border?: boolean;
7877
};
7978

80-
function CustomSelect(props: CustomSelectProps & AntdSelectProps) {
79+
interface CustomSelectInterface extends React.ForwardRefExoticComponent<
80+
CustomSelectProps & React.RefAttributes<HTMLDivElement>
81+
> {
82+
Option: any;
83+
}
84+
const CustomSelect = React.forwardRef<HTMLDivElement, CustomSelectProps>((
85+
props,
86+
ref,
87+
) => {
8188
const {
8289
children,
83-
innerRef,
8490
className,
8591
border,
8692
popupClassName = "custom-ant-select-dropdown",
8793
...restProps
8894
} = props;
8995
return (
90-
<SelectWrapper className={className} ref={innerRef} border={border}>
96+
<SelectWrapper className={className} ref={ref} border={border}>
9197
<AntdSelect
9298
popupClassName={popupClassName}
9399
popupMatchSelectWidth={false}
@@ -96,9 +102,10 @@ function CustomSelect(props: CustomSelectProps & AntdSelectProps) {
96102
>
97103
{children}
98104
</AntdSelect>
105+
<div></div>
99106
</SelectWrapper>
100107
);
101-
}
108+
}) as CustomSelectInterface;
102109

103110
CustomSelect.Option = AntdSelect.Option;
104111
export { CustomSelect };

client/packages/lowcoder/src/components/PermissionDialog/Permission.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ const PermissionSelector = (props: {
328328
<PermissionSelectWrapper>
329329
<AddPermissionsSelect
330330
open
331-
innerRef={selectRef}
331+
ref={selectRef}
332332
placeholder={trans("home.addPermissionPlaceholder")}
333333
mode="multiple"
334334
getPopupContainer={() => document.getElementById("add-app-user-permission-dropdown")!}

client/packages/lowcoder/src/comps/comps/tableComp/column/columnTypeComp.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@ import { RatingComp } from "./columnTypeComps/columnRatingComp";
1515
import { BadgeStatusComp } from "./columnTypeComps/columnStatusComp";
1616
import { ColumnTagsComp } from "./columnTypeComps/columnTagsComp";
1717
import { SimpleTextComp } from "./columnTypeComps/simpleTextComp";
18+
import { ColumnNumberComp } from "./columnTypeComps/ColumnNumberComp";
1819

1920
const actionOptions = [
2021
{
2122
label: trans("table.text"),
2223
value: "text",
2324
},
25+
{
26+
label: trans("table.number"),
27+
value: "number",
28+
},
2429
{
2530
label: trans("table.link"),
2631
value: "link",
@@ -73,6 +78,7 @@ const actionOptions = [
7378

7479
export const ColumnTypeCompMap = {
7580
text: SimpleTextComp,
81+
number: ColumnNumberComp,
7682
button: ButtonComp,
7783
badgeStatus: BadgeStatusComp,
7884
link: LinkComp,
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import { Input } from "antd";
2+
import { NumberControl, StringControl } from "comps/controls/codeControl";
3+
import { BoolControl } from "comps/controls/boolControl";
4+
import { trans } from "i18n";
5+
import { ColumnTypeCompBuilder, ColumnTypeViewFn } from "../columnTypeCompBuilder";
6+
import { ColumnValueTooltip } from "../simpleColumnTypeComps";
7+
8+
const childrenMap = {
9+
text: NumberControl,
10+
float: BoolControl,
11+
prefix: StringControl,
12+
suffix: StringControl,
13+
};
14+
15+
let float = false;
16+
const getBaseValue: ColumnTypeViewFn<typeof childrenMap, number, number> = (
17+
props
18+
) => {
19+
return props.text
20+
};
21+
22+
export const ColumnNumberComp = (function () {
23+
return new ColumnTypeCompBuilder(
24+
childrenMap,
25+
(props, dispatch) => {
26+
float = props.float;
27+
const value = !float ? Math.floor(props.changeValue ?? getBaseValue(props, dispatch)) : props.changeValue ?? getBaseValue(props, dispatch);
28+
return props.prefix + value + props.suffix;
29+
},
30+
(nodeValue) => nodeValue.text.value,
31+
getBaseValue,
32+
)
33+
.setEditViewFn((props) => {
34+
return (
35+
<Input
36+
type="number"
37+
step={float?"0.01": "1"}
38+
defaultValue={props.value}
39+
autoFocus
40+
bordered={false}
41+
onChange={(e) => {
42+
props.onChange(!float ? Math.floor(e.target.valueAsNumber) : e.target.valueAsNumber);
43+
}}
44+
onBlur={props.onChangeEnd}
45+
onPressEnter={props.onChangeEnd}
46+
/>
47+
)})
48+
.setPropertyViewFn((children) => {
49+
return (
50+
<>
51+
{children.text.propertyView({
52+
label: trans("table.columnValue"),
53+
tooltip: ColumnValueTooltip,
54+
})}
55+
{children.prefix.propertyView({
56+
label: trans("table.prefix"),
57+
// tooltip: ColumnValueTooltip,
58+
})}
59+
{children.suffix.propertyView({
60+
label: trans("table.suffix"),
61+
// tooltip: ColumnValueTooltip,
62+
})}
63+
{children.float.propertyView({
64+
label: trans("table.float"),
65+
// tooltip: ColumnValueTooltip,
66+
})}
67+
</>
68+
);
69+
})
70+
.build();
71+
})();

client/packages/lowcoder/src/comps/controls/styleControlConstants.tsx

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -959,45 +959,42 @@ export type ResponsiveLayoutRowStyleType = StyleConfigType<typeof ResponsiveLayo
959959
export type ResponsiveLayoutColStyleType = StyleConfigType<typeof ResponsiveLayoutColStyle>;
960960

961961
export function widthCalculator(margin: string) {
962-
const marginArr = margin?.trim().split(" ") || "";
962+
const marginArr = margin?.trim().replace(/\s+/g,' ').split(" ") || "";
963963
if (marginArr.length === 1) {
964964
return `calc(100% - ${
965-
parseInt(margin.replace(/[^\d.]/g, "")) * 2 + margin.replace(/[0-9]/g, "")
965+
parseInt(margin.replace(/[^\d.]/g, "")) * 2 +
966+
(margin.replace(/[0-9]/g, "") || "px")
966967
})`;
967968
} else if (marginArr.length === 2 || marginArr.length === 3) {
968969
return `calc(100% - ${
969970
parseInt(marginArr[1].replace(/[^\d.]/g, "")) * 2 +
970-
marginArr[1].replace(/[0-9]/g, "")
971+
(marginArr[1].replace(/[0-9]/g, "") || 'px')
971972
})`;
972973
} else {
973974
return `calc(100% - ${
974975
parseInt(marginArr[1]?.replace(/[^\d.]/g, "") || "0") +
975-
marginArr[1]?.replace(/[0-9]/g, "" || "px")
976+
(marginArr[1]?.replace(/[0-9]/g, "") || "px")
976977
} - ${
977978
parseInt(marginArr[3]?.replace(/[^\d.]/g, "") || "0") +
978-
marginArr[3]?.replace(/[0-9]/g, "" || "px")
979+
(marginArr[3]?.replace(/[0-9]/g, "") || "px")
979980
})`;
980981
}
981982
}
982983

983984
export function heightCalculator(margin: string) {
984985
const marginArr = margin?.trim().split(" ") || "";
985-
if (marginArr.length === 1) {
986-
return `calc(100% - ${
987-
parseInt(margin.replace(/[^\d.]/g, "")) * 2 + margin.replace(/[0-9]/g, "")
988-
})`;
989-
} else if (marginArr.length === 2) {
986+
if (marginArr.length === 1 || marginArr.length === 2) {
990987
return `calc(100% - ${
991-
parseInt(marginArr[0].replace(/[^\d.]/g, "")) * 2 +
992-
marginArr[0].replace(/[0-9]/g, "")
988+
parseInt(marginArr[0].replace(/[^\d.]/g, "")) * 2 +
989+
(marginArr[0].replace(/[0-9]/g, "") || 'px')
993990
})`;
994-
} else {
991+
}else if(marginArr.length >2){
995992
return `calc(100% - ${
996993
parseInt(marginArr[0]?.replace(/[^\d.]/g, "") || "0") +
997-
marginArr[0]?.replace(/[0-9]/g, "") || "px"
994+
(marginArr[0]?.replace(/[0-9]/g, "") || "px")
998995
} - ${
999996
parseInt(marginArr[2]?.replace(/[^\d.]/g, "") || "0") +
1000-
marginArr[2]?.replace(/[0-9]/g, "") || "px"
997+
(marginArr[2]?.replace(/[0-9]/g, "") || "px")
1001998
})`;
1002999
}
10031000
}

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,11 @@ export const en = {
11531153
auto: "Auto",
11541154
fixed: "Fixed",
11551155
columnType: "Column type",
1156+
float: "Float",
1157+
prefix: "Prefix",
1158+
suffix: "Suffix",
11561159
text: "Text",
1160+
number: "Number",
11571161
link: "Link",
11581162
links: "Links",
11591163
tag: "Tag",

client/packages/lowcoder/src/i18n/locales/zh.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,11 @@ table: {
11341134
auto: "自动",
11351135
fixed: "固定",
11361136
columnType: "列类型",
1137+
float: "分数",
1138+
prefix: "字首",
1139+
suffix: "后缀",
11371140
text: "文本",
1141+
number: "数字",
11381142
link: "链接",
11391143
links: "多链接",
11401144
tag: "标签",

deploy/docker/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Image can be configured by setting environment variables.
3737
| `ENCRYPTION_SALT` | Salt used for encrypting password | `lowcoder.org` |
3838
| `CORS_ALLOWED_DOMAINS` | CORS allowed domains | `*` |
3939
| `LOWCODER_MAX_REQUEST_SIZE` | Lowcoder max request size | `20m` |
40+
| `LOWCODER_MAX_QUERY_TIMEOUT` | Lowcoder max query timeout (in seconds) | `120` |
4041
| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` |
4142
| `LOWCODER_NODE_SERVICE_URL` | Lowcoder Node service (js executor) URL | `http://localhost:6060` |
4243
| `DEFAULT_ORGS_PER_USER` | Default maximum organizations per user | `100` |
@@ -77,6 +78,8 @@ Image can be configured by setting environment variables.
7778
| `DEFAULT_ORG_GROUP_COUNT` | Default maximum groups per organization | `100` |
7879
| `DEFAULT_ORG_APP_COUNT` | Default maximum applications per organization | `1000` |
7980
| `DEFAULT_DEVELOPER_COUNT` | Default maximum developers | `100` |
81+
| `LOWCODER_MAX_QUERY_TIMEOUT` | Lowcoder max query timeout (in seconds) | `120` |
82+
| `LOWCODER_MAX_REQUEST_SIZE` | Lowcoder max request size | `20m` |
8083

8184

8285

@@ -122,6 +125,7 @@ Image can be configured by setting environment variables.
122125
| --------------------------------| --------------------------------------------------------------------| ------------------------------------------------------- |
123126
| `PUID` | ID of user running services. It will own all created logs and data. | `9001` |
124127
| `PGID` | ID of group of the user running services. | `9001` |
128+
| `LOWCODER_MAX_QUERY_TIMEOUT` | Lowcoder max query timeout (in seconds) | `120` |
125129
| `LOWCODER_MAX_REQUEST_SIZE` | Lowcoder max request size | `20m` |
126130
| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` |
127131
| `LOWCODER_NODE_SERVICE_URL` | Lowcoder Node service (js executor) URL | `http://localhost:6060` |

deploy/docker/docker-compose-multi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ services:
3636
MONGODB_URL: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin"
3737
REDIS_URL: "redis://redis:6379"
3838
LOWCODER_NODE_SERVICE_URL: "http://lowcoder-node-service:6060"
39+
LOWCODER_MAX_QUERY_TIMEOUT: 120
3940
ENABLE_USER_SIGN_UP: "true"
4041
ENCRYPTION_PASSWORD: "lowcoder.org"
4142
ENCRYPTION_SALT: "lowcoder.org"
@@ -76,6 +77,7 @@ services:
7677
PUID: "9001"
7778
PGID: "9001"
7879
LOWCODER_MAX_REQUEST_SIZE: 20m
80+
LOWCODER_MAX_QUERY_TIMEOUT: 120
7981
LOWCODER_API_SERVICE_URL: "http://lowcoder-api-service:8080"
8082
LOWCODER_NODE_SERVICE_URL: "http://lowcoder-node-service:6060"
8183
restart: unless-stopped

deploy/docker/docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ services:
3838
LOWCODER_NODE_SERVICE_URL: "http://localhost:6060"
3939
# frontend parameters
4040
LOWCODER_MAX_REQUEST_SIZE: 20m
41+
LOWCODER_MAX_QUERY_TIMEOUT: 120
4142
volumes:
4243
- ./lowcoder-stacks:/lowcoder-stacks
4344
restart: unless-stopped

0 commit comments

Comments
 (0)