Skip to content

Commit

Permalink
Update libchai
Browse files Browse the repository at this point in the history
  • Loading branch information
tansongchen committed Aug 6, 2024
1 parent 6f720a6 commit c55c4f4
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 15 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "chai",
"private": true,
"version": "0.1.13",
"version": "0.1.14",
"type": "module",
"scripts": {
"start": "vite --mode CF",
Expand Down Expand Up @@ -45,7 +45,7 @@
"jotai-optics": "^0.4.0",
"js-md5": "^0.8.3",
"js-yaml": "4.1.0",
"libchai": "^0.1.13",
"libchai": "^0.1.14",
"lodash-es": "^4.17.21",
"mathjs": "^13.0.1",
"nanoid": "^5.0.7",
Expand Down
32 changes: 27 additions & 5 deletions src/components/Algebra.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import {
ProFormText,
} from "@ant-design/pro-components";
import { Button, Form, Space, notification } from "antd";
import { CloseCircleOutlined, CopyOutlined } from "@ant-design/icons";
import type { Rule } from "~/lib";
import { algebraAtom, useAddAtom } from "~/atoms";
import { defaultAlgebra } from "~/lib";
import { ArrowDownOutlined, ArrowUpOutlined } from "@ant-design/icons";

interface AlgebraForm {
name: string;
Expand Down Expand Up @@ -69,10 +69,32 @@ export default function Algebra({
<ProFormList
name="rules"
label="拼写运算"
copyIconProps={{ Icon: CopyOutlined, tooltipText: "复制此项到末尾" }}
deleteIconProps={{
Icon: CloseCircleOutlined,
tooltipText: "删除这条运算",
actionRender={(field, action, defaultActionDom, count) => {
return [
...defaultActionDom,
<ArrowUpOutlined
key="up_arrow"
style={{ marginLeft: "5px" }}
onClick={() => {
if (field.name === 0) {
action.move(field.name, count - 1);
} else {
action.move(field.name, field.name - 1);
}
}}
/>,
<ArrowDownOutlined
key="down_arrow"
style={{ marginLeft: "5px" }}
onClick={() => {
if (field.name === count - 1) {
action.move(field.name, 0);
} else {
action.move(field.name, field.name + 1);
}
}}
/>,
];
}}
>
<ProFormGroup key="group">
Expand Down
4 changes: 2 additions & 2 deletions src/lib/assembly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,8 @@ export const assemble = (
const priorityMap = getPriorityMap(config.priority);
return result.map((x) => {
const hash = `${x.name}-${x.pinyin_list.join(",")}`;
const level = priorityMap.get(hash) ?? -1;
return { ...x, level };
const level = priorityMap.get(hash);
return level !== undefined ? { ...x, level } : x;
});
};

Expand Down

0 comments on commit c55c4f4

Please sign in to comment.