Skip to content

Commit

Permalink
chore(Table): simplify expose related code (#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
tolking authored Dec 20, 2024
1 parent 20aca8d commit 83a607d
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 124 deletions.
6 changes: 6 additions & 0 deletions docs/en-US/components/Crud.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ Other attributes are the same as <pro-link to="/en-US/components/table#columns">
| Name | Description | Type |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| clearSelection | used in multiple selection Table, clear user selection | () => void |
| getSelectionRows | returns the currently selected rows | () => any[] |
| toggleRowSelection | used in multiple selection Table, toggle if a certain row is selected. With the second parameter, you can directly set if this row is selected | (row: any, selected?: boolean, ignoreSelectable = true) => void |
| toggleAllSelection | used in multiple selection Table, toggle select all and deselect all | () => void |
| toggleRowExpansion | used in expandable Table or tree Table, toggle if a certain row is expanded. With the second parameter, you can directly set if this row is expanded or collapsed | (row: any, expanded?: boolean) => void |
Expand All @@ -452,6 +453,11 @@ Other attributes are the same as <pro-link to="/en-US/components/table#columns">
| clearFilter | clear filters of the columns whose `columnKey` are passed in. If no params, clear all filters | (columnKeys?: string[]) => void |
| doLayout | refresh the layout of Table. When the visibility of Table changes, you may need to call this method to get a correct layout | () => void |
| sort | sort Table manually. Property `prop` is used to set sort column, property `order` is used to set sort order | (prop: string, order: string) => void |
| scrollTo | scrolls to a particular set of coordinates | `(options: number \| ScrollToOptions, yCoord?: number) => void` |
| setScrollTop | set vertical scroll position | `(top?: number) => void` |
| setScrollLeft | set horizontal scroll position | `(left?: number) => void` |
| columns | Get table columns context. | `TableColumnCtx<T>[]` |
| updateKeyChildren | used in lazy Table, must set `rowKey`, update key children | `(key: string, data: T[]) => void` |
| validate | validate the whole form. Takes a callback as a param. After validation, the callback will be executed with two params: a boolean indicating if the validation has passed, and an object containing all fields that fail the validation. Returns a promise if callback is omitted | (callback?: FormValidateCallback) => void |
| validateField | validate one or several form items | (props?: string \| string[], callback?: FormValidateCallback) => FormValidationResult |
| resetFields | reset all the fields and remove validation result | (props?: string \| string[]) => void |
Expand Down
6 changes: 6 additions & 0 deletions docs/en-US/components/Table.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ The function `defineTableColumns` supports passing in a Generics type to infer t
| Name | Description | Type |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| clearSelection | used in multiple selection Table, clear user selection | () => void |
| getSelectionRows | returns the currently selected rows | () => any[] |
| toggleRowSelection | used in multiple selection Table, toggle if a certain row is selected. With the second parameter, you can directly set if this row is selected | (row: any, selected?: boolean, ignoreSelectable = true) => void |
| toggleAllSelection | used in multiple selection Table, toggle select all and deselect all | () => void |
| toggleRowExpansion | used in expandable Table or tree Table, toggle if a certain row is expanded. With the second parameter, you can directly set if this row is expanded or collapsed | (row: any, expanded?: boolean) => void |
Expand All @@ -258,6 +259,11 @@ The function `defineTableColumns` supports passing in a Generics type to infer t
| clearFilter | clear filters of the columns whose `columnKey` are passed in. If no params, clear all filters | (columnKeys?: string[]) => void |
| doLayout | refresh the layout of Table. When the visibility of Table changes, you may need to call this method to get a correct layout | () => void |
| sort | sort Table manually. Property `prop` is used to set sort column, property `order` is used to set sort order | (prop: string, order: string) => void |
| scrollTo | scrolls to a particular set of coordinates | `(options: number \| ScrollToOptions, yCoord?: number) => void` |
| setScrollTop | set vertical scroll position | `(top?: number) => void` |
| setScrollLeft | set horizontal scroll position | `(left?: number) => void` |
| columns | Get table columns context. | `TableColumnCtx<T>[]` |
| updateKeyChildren | used in lazy Table, must set `rowKey`, update key children | `(key: string, data: T[]) => void` |

### Slots

Expand Down
6 changes: 6 additions & 0 deletions docs/zh-CN/components/Crud.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,7 @@ Crud columns 支持 <pro-link to="/zh-CN/components/table#columns">Table columns
| 方法名 | 说明 | 类型 |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| clearSelection | 用于多选表格,清空用户的选择 | () => void |
| getSelectionRows | 返回当前选中的行 | () => any[] |
| toggleRowSelection | 用于多选表格,切换某一行的选中状态,如果使用了第二个参数,则是设置这一行选中与否(selected 为 true 则选中) | (row: any, selected?: boolean, ignoreSelectable = true) => void |
| toggleAllSelection | 用于多选表格,切换全选和全不选 | () => void |
| toggleRowExpansion | 用于可展开表格与树形表格,切换某一行的展开状态,如果使用了第二个参数,则是设置这一行展开与否(expanded 为 true 则展开) | (row: any, expanded?: boolean) => void |
Expand All @@ -452,6 +453,11 @@ Crud columns 支持 <pro-link to="/zh-CN/components/table#columns">Table columns
| clearFilter | 不传入参数时用于清空所有过滤条件,数据会恢复成未过滤的状态,也可传入由 columnKey 组成的数组以清除指定列的过滤条件 | (columnKeys?: string[]) => void |
| doLayout | 对 Table 进行重新布局。当 Table 或其祖先元素由隐藏切换为显示时,可能需要调用此方法 | () => void |
| sort | 手动对 Table 进行排序。参数`prop`属性指定排序列,`order`指定排序顺序。 | (prop: string, order: string) => void |
| scrollTo | 滚动到一组特定坐标 | `(options: number \| ScrollToOptions, yCoord?: number) => void` |
| setScrollTop | 设置垂直滚动位置 | `(top?: number) => void` |
| setScrollLeft | 设置水平滚动位置 | `(left?: number) => void` |
| columns | 获取表列的 context | `TableColumnCtx<T>[]` |
| updateKeyChildren | 适用于 lazy Table, 需要设置 `rowKey`, 更新 key children | `(key: string, data: T[]) => void` |
| validate | 对整个表单进行校验的方法,参数为一个回调函数。该回调函数会在校验结束后被调用,并传入两个参数:是否校验成功和未通过校验的字段。若不传入回调函数,则会返回一个 promise | (callback?: FormValidateCallback) => void |
| validateField | 对部分表单字段进行校验的方法 | (props?: string \| string[], callback?: FormValidateCallback) => FormValidationResult |
| resetFields | 对整个表单进行重置,将所有字段值重置为初始值并移除校验结果 | (props?: string \| string[]) => void |
Expand Down
6 changes: 6 additions & 0 deletions docs/zh-CN/components/Table.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ meta:
| 方法名 | 说明 | 类型 |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| clearSelection | 用于多选表格,清空用户的选择 | () => void |
| getSelectionRows | 返回当前选中的行 | () => any[] |
| toggleRowSelection | 用于多选表格,切换某一行的选中状态,如果使用了第二个参数,则是设置这一行选中与否(selected 为 true 则选中) | (row: any, selected?: boolean, ignoreSelectable = true) => void |
| toggleAllSelection | 用于多选表格,切换全选和全不选 | () => void |
| toggleRowExpansion | 用于可展开表格与树形表格,切换某一行的展开状态,如果使用了第二个参数,则是设置这一行展开与否(expanded 为 true 则展开) | (row: any, expanded?: boolean) => void |
Expand All @@ -258,6 +259,11 @@ meta:
| clearFilter | 不传入参数时用于清空所有过滤条件,数据会恢复成未过滤的状态,也可传入由 columnKey 组成的数组以清除指定列的过滤条件 | (columnKeys?: string[]) => void |
| doLayout | 对 Table 进行重新布局。当 Table 或其祖先元素由隐藏切换为显示时,可能需要调用此方法 | () => void |
| sort | 手动对 Table 进行排序。参数`prop`属性指定排序列,`order`指定排序顺序。 | (prop: string, order: string) => void |
| scrollTo | 滚动到一组特定坐标 | `(options: number \| ScrollToOptions, yCoord?: number) => void` |
| setScrollTop | 设置垂直滚动位置 | `(top?: number) => void` |
| setScrollLeft | 设置水平滚动位置 | `(left?: number) => void` |
| columns | 获取表列的 context | `TableColumnCtx<T>[]` |
| updateKeyChildren | 适用于 lazy Table, 需要设置 `rowKey`, 更新 key children | `(key: string, data: T[]) => void` |

### 插槽

Expand Down
Loading

0 comments on commit 83a607d

Please sign in to comment.