Skip to content

Commit

Permalink
feat(pro:table): support layoutable (#1364)
Browse files Browse the repository at this point in the history
  • Loading branch information
danranVm committed Dec 16, 2022
1 parent 19e6f68 commit 2e7533c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/components/radio/src/Radio.tsx
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
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
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
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
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
@@ -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

0 comments on commit 2e7533c

Please sign in to comment.