Skip to content

Commit

Permalink
fix: 🐛 (arco) Suggestion lazyLoad
Browse files Browse the repository at this point in the history
  • Loading branch information
charlzyx committed Feb 21, 2024
1 parent 26c1890 commit b1428c0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
Binary file modified bun.lockb
Binary file not shown.
13 changes: 3 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@
"main": "./dist/lib",
"module": "./dist/esm",
"types": "./dist/esm/index.d.ts",
"sideEffects": [
"dist/*",
"src/*.ts",
"*.less",
"**/*/style.js"
],
"sideEffects": ["dist", "src/*.ts", "*.less", "**/*/style.js"],
"scripts": {
"dev": "rspress dev",
"v4": "bun scripts/switch.ts antd doc",
Expand Down Expand Up @@ -68,7 +63,5 @@
"rimraf": "^5.0.5",
"rspress": "latest"
},
"files": [
"dist"
]
}
"files": ["dist"]
}
20 changes: 18 additions & 2 deletions src/cascader-plus/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export type LinkageValueType = LabelValueType[] | ValueType[];

type CascaderProps = React.ComponentProps<typeof BaseCascader>;

const display: CascaderProps["displayRender"] = (label) => {
const display: CascaderProps["displayRender"] = (label: string[]) => {
return label.join("/");
};

Expand Down Expand Up @@ -212,7 +212,23 @@ const Cascader = observer(
const _loadData =
all || !loadData
? undefined
: (options: CascaderPlusOption<ValueType>[]) => {
: (ooptions: CascaderPlusOption<ValueType>[]) => {
const options = ooptions[0]?.label
? ooptions
: // for arco loadMore
ooptions.reduce(
(info, val: any) => {
// biome-ignore lint/suspicious/noDoubleEquals: <explanation>
const me = info.parent.find((x) => x.value == val);
if (me) {
info.chain.push(me);
info.parent = me.children!;
}
return info;
},
{ parent: state.options, chain: [] as typeof ooptions },
).chain;

const last = options[options.length - 1];
if (last.children) return;
last.loading = true;
Expand Down

0 comments on commit b1428c0

Please sign in to comment.