Skip to content

Commit

Permalink
refactor: input
Browse files Browse the repository at this point in the history
  • Loading branch information
proclml committed Apr 5, 2024
1 parent 713ba83 commit 9b400f9
Show file tree
Hide file tree
Showing 50 changed files with 1,957 additions and 2,093 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Test using Node.js
uses: actions/setup-node@v1
with:
node-version: "17"
node-version: "18"
- run: yarn install
- run: yarn test

Expand Down
2 changes: 2 additions & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
registry "https://registry.npmmirror.com/"
strict-ssl false
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@
"@types/webpack": "^5.28.0",
"@types/webpack-dev-server": "^4.7.2",
"@wasm-tool/wasm-pack-plugin": "^1.6.0",
"ahooks": "^3.7.11",
"antd": "^5.8.3",
"craco-plugin-scoped-css": "^1.1.1",
"css-loader": "^6.6.0",
"eslint-plugin-react-hooks": "^4.3.0",
"html-webpack-plugin": "^5.5.0",
"mobx": "^6.12.3",
"mobx-react": "^9.1.1",
"node-sass": "^7.0.1",
"numfmt": "2.1.0",
"react": "^17.0.2",
Expand Down Expand Up @@ -42,7 +45,7 @@
"webpack-dev-server": "^4.7.4"
},
"scripts": {
"test": "jest -c jest.config.ts",
"test": "vitest run",
"run-scripts": "ts-node scripts/index.ts",
"start:react": "react-scripts start",
"start:dev": "webpack serve --config=webpack.config.ts --hot --env=dev",
Expand Down Expand Up @@ -102,6 +105,7 @@
"react-toastify": "^9.0.5",
"reflect-metadata": "^0.1.13",
"ts-jest": "^27.1.3",
"vitest": "^1.4.0",
"webpack-cli": "^4.9.2"
}
}
}
30 changes: 15 additions & 15 deletions src/components/canvas/contextmenu.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {Range, StandardBlock} from '@/core/standable'
import {SelectBlockComponent} from './select-block'
import {Cell} from './defs'
import {useState, ReactElement, MouseEvent} from 'react'
import {useInjection} from '@/core/ioc/provider'
import {ContextMenuComponent, ContextMenuItem} from '@/ui/contextmenu'
import { Range, StandardBlock } from '@/core/standable'
import { SelectBlockComponent } from './select-block'
import { Cell } from './defs'
import { useState, ReactElement, MouseEvent } from 'react'
import { useInjection } from '@/core/ioc/provider'
import { ContextMenuComponent, ContextMenuItem } from '@/ui/contextmenu'
import {
DeleteBlockColsBuilder,
DeleteColsBuilder,
Expand All @@ -16,8 +16,8 @@ import {
DeleteRowsBuilder,
CreateBlockBuilder,
} from '@logisheets_bg'
import {TYPES} from '@/core/ioc/types'
import {Backend, SheetService} from '@/core/data'
import { TYPES } from '@/core/ioc/types'
import { Backend, SheetService } from '@/core/data'

export interface ContextmenuProps {
mouseevent: MouseEvent
Expand All @@ -28,7 +28,7 @@ export interface ContextmenuProps {
}

export const ContextmenuComponent = (props: ContextmenuProps) => {
const {mouseevent, startCell, isOpen, setIsOpen, endCell} = props
const { mouseevent, startCell, isOpen, setIsOpen, endCell } = props
const [blockMenuOpened, setBlockMenuOpened] = useState(false)
const BACKEND_SERVICE = useInjection<Backend>(TYPES.Backend)
const SHEET_SERVICE = useInjection<SheetService>(TYPES.Sheet)
Expand Down Expand Up @@ -56,7 +56,7 @@ export const ContextmenuComponent = (props: ContextmenuProps) => {
const _addCol = () => {
const sheet = SHEET_SERVICE.getActiveSheet()
const {
coordinate: {startCol: start},
coordinate: { startCol: start },
} = startCell
const blocks = _checkBlock()
if (blocks.length !== 0) {
Expand All @@ -83,7 +83,7 @@ export const ContextmenuComponent = (props: ContextmenuProps) => {

const _removeCol = () => {
const {
coordinate: {startCol: start},
coordinate: { startCol: start },
} = startCell
const sheet = SHEET_SERVICE.getActiveSheet()
const blocks = _checkBlock()
Expand Down Expand Up @@ -111,7 +111,7 @@ export const ContextmenuComponent = (props: ContextmenuProps) => {

const _addRow = () => {
const {
coordinate: {startRow: start},
coordinate: { startRow: start },
} = startCell
const sheet = SHEET_SERVICE.getActiveSheet()
const blocks = _checkBlock()
Expand All @@ -138,7 +138,7 @@ export const ContextmenuComponent = (props: ContextmenuProps) => {

const _removeRow = () => {
const {
coordinate: {startRow: start},
coordinate: { startRow: start },
} = startCell
const sheet = SHEET_SERVICE.getActiveSheet()
const blocks = _checkBlock()
Expand Down Expand Up @@ -179,8 +179,8 @@ export const ContextmenuComponent = (props: ContextmenuProps) => {
}

const _checkBlock = () => {
const {coordinate: start} = startCell
const {coordinate: end} = endCell ?? startCell
const { coordinate: start } = startCell
const { coordinate: end } = endCell ?? startCell
const curr = new Range()
.setStartRow(start.startRow)
.setStartCol(start.startCol)
Expand Down
Loading

0 comments on commit 9b400f9

Please sign in to comment.