Skip to content

Commit

Permalink
fix: pick 添加table行拖拽aed78f6 a08d7d3 去除axios依赖项9f8f569
Browse files Browse the repository at this point in the history
  • Loading branch information
haohao_peng committed Nov 18, 2024
1 parent 0fc164e commit cfcd978
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 26 deletions.
4 changes: 2 additions & 2 deletions COMPONENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default Button
+ const buttonLangMsg = locale.getCompLangMsg({ componentName: 'Button' })
```

进行国际化前你需要现在 `components/locale/zh-CN.tsx` 文件内定义 Button 组件,比如定义 Button.text 然后你就可以使用 `buttonLangMsg.text` 进行赋值操作
进行国际化前你需要先在 `components/locale/zh-CN.tsx` 文件内定义 Button 组件,比如定义 Button.text 然后你就可以使用 `buttonLangMsg.text` 进行赋值操作

### 2. 样式文件说明
KDesign 使用less作为css预处理器,创建模板内的 style 文件夹存放的就是所有的样式文件。
Expand Down Expand Up @@ -197,7 +197,7 @@ KDesign 的demo采用实时编译,用户可以直接在编辑器中编辑代
- order: demo的排序规则
- 文档在页面中的呈现顺序按照order正序排列
- jsx代码示例是固定的模板,大家不需要对模板的主体结构进行修改 只需要修改Demo组件中的代码即可。
- 对于需要使用其他npm包来演示代码的,KDesign也提供了 `lodash``date-fns``axios`来进行演示,具体使用办法如下:
- 对于需要使用其他npm包来演示代码的,KDesign也提供了 `lodash``date-fns``fetch`来进行演示,具体使用办法如下:

```diff
+ import _ from 'lodash'
Expand Down
11 changes: 4 additions & 7 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,6 @@ Copyright (c) 2019 Federico Zivolo
async-validator
Copyright (c) 2014-present yiminghe

axios
Copyright (c) 2014-present Matt Zabriskie

big.js
Copyright © <2021> Michael Mclaughlin

Expand Down Expand Up @@ -457,7 +454,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OU
IN THE SOFTWARE.


Open Source Software Licensed Under the BSD-2-Clause License:
Open Source Software Licensed Under the BSD-2-Clause License:
--------------------------------------------------------------------
@typescript-eslint/parser
Copyright JS Foundation and other contributors, https://js.foundation
Expand Down Expand Up @@ -490,7 +487,7 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Open Source Software Licensed Under the BSD-3-Clause License:
Open Source Software Licensed Under the BSD-3-Clause License:
--------------------------------------------------------------------
eslint-config-prettier-standard
Copyright (c) 2017, Nick Petruzzelli
Expand Down Expand Up @@ -523,7 +520,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Open Source Software Licensed Under the ISC License:
Open Source Software Licensed Under the ISC License:
--------------------------------------------------------------------
conventional-changelog-cli
Copyright © conventional-changelog team
Expand All @@ -542,7 +539,7 @@ Terms of the ISC License:
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Open Source Software Licensed Under the Apache-2.0 License License:
Open Source Software Licensed Under the Apache-2.0 License License:
--------------------------------------------------------------------
jest-image-snapshot
https://americanexpress.io
Expand Down
3 changes: 1 addition & 2 deletions components/table/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,9 @@ export default function getApi(pipelineRef: React.MutableRefObject<TablePipeline
return pipeline.ref?.current.rowHeightManager.cache
}

function getFeatureApi(featureName:string){
function getFeatureApi(featureName: string) {
const pipeline = pipelineRef.current
return pipeline.getFeatureApi(featureName)

}

return {
Expand Down
2 changes: 1 addition & 1 deletion components/table/interface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export type TableApi = {
getHeightCache: () => number[]
ensureRowIndexVisible: (rowIndex: number, position?: string | undefined) => void
ensureColumnVisible: (code: string) => void
getFeatureApi:(featureName:string) => any
getFeatureApi: (featureName: string) => any
}

export type TableInstance = {
Expand Down
9 changes: 4 additions & 5 deletions components/upload/demo/upload-manually.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ title: 手动上传
import React from 'react'
import ReactDOM from 'react-dom'
import { Upload, Button, Icon, Alert } from '@kdcloudjs/kdesign'
import axios from 'axios'

function Demo() {
const [fileList, setFileList] = React.useState([])
Expand All @@ -26,11 +25,11 @@ function Demo() {
setUploading(true)

// You can use any AJAX library you like
axios({
url: 'https://www.mocky.io/v2/5cc8019d300000980a055e76',
method: 'post',
data: formData,
fetch('https://www.mocky.io/v2/5cc8019d300000980a055e76',{
method: 'POST',
body: formData,
})
.then((res) => res.json())
.then(() => {
setFileList([])
setUploading(false)
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
"@popperjs/core": "^2.5.4",
"@types/js-cookie": "^3.0.3",
"async-validator": "^3.5.1",
"axios": "^0.21.1",
"big.js": "^6.0.2",
"classnames": "^2.2.6",
"color": "^4.2.3",
Expand Down
2 changes: 0 additions & 2 deletions site/src/template/content/live-demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import * as kdesign from 'kdesign'
import { Icon, Message } from 'kdesign'
import lodash from 'lodash'
import copy from 'copy-to-clipboard'
import axios from 'axios'
import { Language } from 'prism-react-renderer'

import { Utils } from './article'
Expand Down Expand Up @@ -49,7 +48,6 @@ const errorCodeStyle = {
const allScope: Record<string, any> = {
ReactDOM,
React,
axios,
copy,
react: { ...React },
'@kdcloudjs/kdesign': { ...kdesign },
Expand Down
4 changes: 2 additions & 2 deletions site/src/template/layout/header/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Login = () => {
}

const loginMethods = async (token?: string, autoLogin?: boolean) => {
const res = await request.get('/currentUser', {
const res = await request('/currentUser', {
headers: { Authorization: 'Bearer ' + token },
})
const { data } = res
Expand All @@ -26,7 +26,7 @@ const Login = () => {
}
}
const logoutMethods = () => {
request.get('/loginOut')
request('/loginOut')
delInfo()
window.location.reload()
}
Expand Down
22 changes: 18 additions & 4 deletions site/src/template/layout/service/request.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import axios from 'axios'

// 开发环境
const DEV_ENVIRONMENT_ADDRESS = 'http://172.20.166.92:7002/api'
// 生产环境
Expand All @@ -15,8 +13,24 @@ if (process.env.NODE_ENV === 'production') {
displayIlluAddress = tempAddress + '/static/illustration/develop'
}

const request = axios.create({
baseURL: tempAddress,
const createFetchInstance = (baseURL: string, defaultOptions: any = {}) => {
return (endpoint: string, options: any = {}) => {
const combinedOptions = {
...defaultOptions,
...options,
headers: {
...defaultOptions.headers,
...options.headers,
},
}

return fetch(`${baseURL}${endpoint}`, combinedOptions)
.then((response) => response.json())
.catch((error) => console.error('Error:', error))
}
}

const request = createFetchInstance(tempAddress, {
headers: { 'Content-type': 'application/x-www-form-urlencoded' },
})

Expand Down

0 comments on commit cfcd978

Please sign in to comment.