diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index eb5add8..d1e361f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,7 +5,7 @@ on: - master jobs: - deploy: + depoly: runs-on: ubuntu-latest steps: @@ -35,12 +35,12 @@ jobs: run: pnpm install - name: Install Playwright Browsers - - npx playwright install --with-deps + run: npx playwright install --with-deps - name: Test run: pnpm test - - - uses actions/upload-artifact@v3 + + - uses: actions/upload-artifact@v3 if: always() with: name: playwright-report diff --git a/package.json b/package.json index 5d7503b..34b896b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mui-easy-cascader", - "version": "0.3.6", + "version": "0.4.0", "main": "dist/index.js", "module": "dist/index.es.js", "types": "dist/src/index.d.ts", diff --git a/src/EasyCascader/index.tsx b/src/EasyCascader/index.tsx index be19140..4a51db8 100644 --- a/src/EasyCascader/index.tsx +++ b/src/EasyCascader/index.tsx @@ -7,11 +7,12 @@ import { EasyCascaderBaseNode, EasyCascaderProps, EasyId } from '../types' export const EasyCascader = forwardRef(EasyCascaderRaw) as < T extends EasyCascaderBaseNode, >( - props: EasyCascaderProps, - ref?: ForwardedRef>, + props: EasyCascaderProps & { + ref?: ForwardedRef> + }, ) => JSX.Element -export function EasyCascaderRaw( +function EasyCascaderRaw( props: EasyCascaderProps, ref?: ForwardedRef>, ) { diff --git a/src/EasyCascaderInput/index.tsx b/src/EasyCascaderInput/index.tsx index 2541a0e..9d284a1 100644 --- a/src/EasyCascaderInput/index.tsx +++ b/src/EasyCascaderInput/index.tsx @@ -59,14 +59,11 @@ export function EasyCascaderInput( setSelectedId(id) setHoverId(id) if (isLeaf) { - setFocused(false) - onChange(node) + setFocused(false) setIsSearch(false) - setSearch('') - } else { - setSelectedId(id) } + setSearch('') } const [hoverId, setHoverId] = useState(defaultSelectedId) diff --git a/src/mock.ts b/src/mock.ts index 76c90cb..ff9d089 100644 --- a/src/mock.ts +++ b/src/mock.ts @@ -16,7 +16,7 @@ export const mockObjectNodes: MockObject[] = [ id: 1, name: 'children-0', pathId: [0], - childrenId: [], + childrenId: [5], }, { id: 2, @@ -33,4 +33,9 @@ export const mockObjectNodes: MockObject[] = [ id: 3, name: 'parent-1', }, + { + id: 5, + name: 'leaf', + pathId: [0, 1], + }, ]