Skip to content

Antd Upgrade #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: updated timeline
  • Loading branch information
raheeliftikhar5 committed Jul 26, 2023
commit a19df5959b1a61b26933ce948055d0f22c9df6aa
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useEffect, useState } from "react";
import { Button } from "antd";
// 渲染组件到编辑器
import {
changeChildAction,
Expand Down Expand Up @@ -87,6 +88,42 @@ const TimelineComp = (
}
) => {
const { value, dispatch, style, mode, reverse, onEvent } = props;
const timelineItems = value.map((value: timelineNode, index: number) => ({
key: index,
color: value?.color,
dot: value?.dot && ANTDICON.hasOwnProperty(value?.dot.toLowerCase())
? ANTDICON[value?.dot.toLowerCase() as keyof typeof ANTDICON]
: "",
label: (
<span style={{ color: value?.lableColor || style?.lableColor }}>
{value?.label}
</span>
),
children: (
<>
<Button
type="link"
onClick={(e) => {
e.preventDefault();
dispatch(changeChildAction("clickedObject", value, false));
dispatch(changeChildAction("clickedIndex", index, false));
onEvent("click");
}}
style={{
cursor: "pointer",
color: value?.titleColor || style?.titleColor,
}}
>
<b>{value?.title}</b>
</Button>
<p style={{ color: value?.subTitleColor || style?.subTitleColor }}>
{value?.subTitle}
</p>
</>
)
}
))

// TODO:parse px string
return (
<div
Expand All @@ -112,43 +149,8 @@ const TimelineComp = (
</span>
)
}
>
{value.map((value: timelineNode, index: number) => (
<Timeline.Item
key={index}
color={value?.color}
dot={
value?.dot && ANTDICON.hasOwnProperty(value?.dot.toLowerCase())
? ANTDICON[value?.dot.toLowerCase() as keyof typeof ANTDICON]
: ""
}
label={
<span style={{ color: value?.lableColor || style?.lableColor }}>
{value?.label}
</span>
}
>
<a
href=""
onClick={(e) => {
e.preventDefault();
dispatch(changeChildAction("clickedObject", value, false));
dispatch(changeChildAction("clickedIndex", index, false));
onEvent("click");
}}
style={{
cursor: "pointer",
color: value?.titleColor || style?.titleColor,
}}
>
<b>{value?.title}</b>
</a>
<p style={{ color: value?.subTitleColor || style?.subTitleColor }}>
{value?.subTitle}
</p>
</Timeline.Item>
))}
</Timeline>
items={timelineItems}
/>
</div>
);
};
Expand Down
2 changes: 1 addition & 1 deletion client/packages/lowcoder/src/util/keyUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function normalizeKey(e: React.KeyboardEvent | KeyboardEvent) {
return v;
}
for (const p of codePrefixes) {
if (code.length === p.length + 1 && code.startsWith(p)) {
if (code?.length === p.length + 1 && code?.startsWith(p)) {
return code.slice(p.length);
}
}
Expand Down