Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pro:table): support layoutable #1364

Merged
merged 1 commit into from
Dec 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/components/radio/src/Radio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default defineComponent({
/>
{!isButtoned.value && (
<span class={`${prefixCls}-input-box`} tabindex={tabindex as number}>
{!mergedWaveless.value && <ɵWave ref="waveRef" />}
{!mergedWaveless.value && <ɵWave ref={waveRef} />}
</span>
)}
</span>
Expand Down
2 changes: 1 addition & 1 deletion packages/pro/table/demo/Basic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const onColumnsChange = console.log
const columns: ProTableColumn<Data>[] = [
{
type: 'indexable',
changeVisible: false,
layoutable: false,
},
{
title: 'Name',
Expand Down
3 changes: 2 additions & 1 deletion packages/pro/table/docs/Api.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ export type ProTableColumn<T = any, V = any, CT = 'input'> =

| 名称 | 说明 | 类型 | 默认值 | 全局配置 | 备注 |
| --- | --- | --- | --- | --- | --- |
| `layoutable` | 是否在布局设置菜单中显示此列 | `boolean` | - | - | 为 `false` 时,将不显示此列 |
| `changeFixed` | 是否可以改变列的固定状态 | `boolean` | - | - | 为 `false` 时,此列将不能调整固定状态,但依旧可以设置 `fixed` |
| `changeIndex` | 是否可以改变列的顺序 | `boolean` | - | - | 为 `false` 时,将不可调整列的顺序 |
| `changeVisible` | 是否可以改变列的显示状态 | `boolean` | - | - | 为 `false` 时,此列将不能调整显示状态,但依旧可以设置 `visible` |
| `visible` | 是否显示此列 | `boolean` | - | - | 为 `false` 时,将不显示此列 |
| `visible` | 是否在表格中渲染此列 | `boolean` | - | - | 为 `false` 时,将不渲染此列 |

##### ProTableColumnResizable

Expand Down
2 changes: 1 addition & 1 deletion packages/pro/table/src/contents/LayoutToolTree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default defineComponent({
checkable: true,
checkedKeys: checkedKeys.value,
draggable: true,
dataSource: columns,
dataSource: columns.filter(column => column.layoutable !== false),
disabled: disableColumn,
empty: '',
childrenKey: 'children',
Expand Down
1 change: 1 addition & 0 deletions packages/pro/table/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export interface ProTableColumnIndexable<T = any, K = VKey> extends ProTableColu
}

export type ProTableColumnLayoutConfig = {
layoutable?: boolean
changeFixed?: boolean
changeIndex?: boolean
changeVisible?: boolean
Expand Down
13 changes: 7 additions & 6 deletions scripts/gulp/build/less.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck

import path from 'path'

import { copy, copyFile, pathExists, readFile, readdirSync, remove, writeFile } from 'fs-extra'

// @ts-ignore
import less from 'less'

import { gulpConfig } from '../gulpConfig'

const { themes } = gulpConfig.build

export async function compile(content: string, savePath: string, rootPath?: string): Promise<void> {
const plugins: any[] = []
const plugins = []

const lessOptions: any = { plugins, javascriptEnabled: true }
const lessOptions = { plugins, javascriptEnabled: true }

if (rootPath) {
lessOptions.paths = [path.dirname(rootPath)]
Expand All @@ -21,8 +22,8 @@ export async function compile(content: string, savePath: string, rootPath?: stri

return less
.render(content, lessOptions)
.then(({ css }: any) => writeFile(savePath, css))
.catch((err: any) => Promise.reject(err))
.then(({ css }) => writeFile(savePath, css))
.catch(err => Promise.reject(err))
}

function compileTheme(content: string, saveDirname: string, themeName: string) {
Expand Down