浏览代码

Types: complete method declarations in the documentation (#10233)

* Chore: complete the method declarations specified in the document

* Fix: fix a misspell mistake
Bo Zhang 7 年之前
父节点
当前提交
d0809e4915
共有 5 个文件被更改,包括 91 次插入1 次删除
  1. 6 0
      types/menu.d.ts
  2. 17 0
      types/table.d.ts
  3. 5 0
      types/transfer.d.ts
  4. 57 1
      types/tree.d.ts
  5. 6 0
      types/upload.d.ts

+ 6 - 0
types/menu.d.ts

@@ -37,4 +37,10 @@ export declare class ElMenu extends ElementUIComponent {
 
   /** Whether the menu collapse transition is active */
   collapseTransition: boolean
+  
+  /** Open the specified sub-menu */
+  open (index: string): void
+
+  /** Close the specified sub-menu */
+  close (index: string): void
 }

+ 17 - 0
types/table.d.ts

@@ -99,4 +99,21 @@ export declare class ElTable extends ElementUIComponent {
    * @param row The row that is going to set as selected
    */
   setCurrentRow (row?: object): void
+  
+  /**
+   * Toggle or set if a certain row is expanded
+   *
+   * @param row The row that is going to set its expanded state
+   * @param expanded Whether the row is expanded. The expanded state will be toggled if not set
+   */
+  toggleRowExpansion (row: object, expanded?: boolean): void
+
+  /** Clear sort status, reset the table to unsorted  */
+  clearSort (): void
+
+  /** Clear filter, reset the table to unfiltered  */
+  clearFilter (): void
+
+  /** Relayout the table, maybe needed when change the table or it's ancestors visibility */
+  doLayout (): void
 }

+ 5 - 0
types/transfer.d.ts

@@ -1,6 +1,8 @@
 import { CreateElement, VNode } from 'vue'
 import { ElementUIComponent } from './component'
 
+export type TransferPanelPosition = 'left' | 'right'
+
 export interface TransferData {
   key: any,
   label: string,
@@ -65,4 +67,7 @@ export declare class ElTransfer extends ElementUIComponent {
 
   /** Key array of initially checked data items of the right list */
   rightDefaultChecked: any[]
+
+  /** Clear the query text in specified panel */
+  clearQuery (which: TransferPanelPosition): void
 }

+ 57 - 1
types/tree.d.ts

@@ -84,12 +84,20 @@ export declare class ElTree extends ElementUIComponent {
   indent: number
 
   /**
-   * Filter all tree nodes.Ffiltered nodes will be hidden
+   * Filter all tree nodes. Filtered nodes will be hidden
    *
    * @param value The value to be used as first parameter for `filter-node-method`
    */
   filter (value: any): void
 
+  /**
+   * Update the children of the node which specified by the key
+   * 
+   * @param key the key of the node which children will be updated
+   * @param data the children data
+   */
+  updateKeyChildren (key: any, data: TreeNode[]): void
+
   /**
    * If the node can be selected (`show-checkbox` is `true`), it returns the currently selected array of nodes
    *
@@ -129,6 +137,16 @@ export declare class ElTree extends ElementUIComponent {
    */
   setChecked (data: TreeNode | any, checked: boolean, deep: boolean): void
 
+  /**
+   * If the node can be selected (`show-checkbox` is `true`), it returns the currently half selected array of nodes
+   */
+  getHalfCheckedNodes (): void
+
+  /**
+   * If the node can be selected (`show-checkbox` is `true`), it returns the currently half selected array of nodes' keys
+   */
+  getHalfCheckedKeys (): void;
+
   /**
    * Return the highlight node's key (null if no node is highlighted)
    */
@@ -152,4 +170,42 @@ export declare class ElTree extends ElementUIComponent {
    * @param node The node to be highlighted
    */
   setCurrentNode (node: TreeNode): void
+
+  /**
+   * Get node by node key or node data
+   * 
+   * @param by node key or node data
+   */
+  getNode (by: TreeNode | any): TreeNode
+
+  /**
+   * Remove node by key or node data or node instance
+   * 
+   * @param by key or node data or node instance
+   */
+  remove (by: TreeNode | any): void
+
+  /**
+   * Append a child node to specified node
+   * 
+   * @param childData the data of appended node
+   * @param parent key or node data or node instance of the parent node
+   */
+  append (childData: TreeNode, parent: TreeNode | any): void
+
+  /**
+   * insert a node before specified node
+   * 
+   * @param data the data of inserted node
+   * @param ref key or node data or node instance of the reference node
+   */
+  insertBefore (data: TreeNode, ref: TreeNode | any): void
+
+  /**
+   * insert a node after specified node
+   * 
+   * @param data the data of inserted node
+   * @param ref key or node data or node instance of the reference node
+   */
+  insertAfter (data: TreeNode, ref: TreeNode | any): void
 }

+ 6 - 0
types/upload.d.ts

@@ -108,4 +108,10 @@ export declare class ElUpload extends ElementUIComponent {
 
   /** Hook function when limit is exceeded */
   onExceed: (file: ElUploadInternalFileDetail, fileList: ElUploadInternalFileDetail[]) => void
+
+  /** Clear the upload file list */
+  clearFiles (): void;
+
+  /** Abort specified file */
+  abort (file: ElUploadInternalFileDetail): void
 }