{"version":3,"file":"defaults.mjs","names":[],"sources":["../../../../../../../packages/components/table/src/table-column/defaults.ts"],"sourcesContent":["import type { ComponentInternalInstance, PropType, Ref, VNode } from 'vue'\nimport type { DefaultRow, Table, TableSortOrder } from '../table/defaults'\nimport type {\n  TableOverflowTooltipFormatter,\n  TableOverflowTooltipOptions,\n} from '../util'\nimport type { Store } from '../store'\n\ntype CI<T extends DefaultRow> = {\n  column: TableColumnCtx<T>\n  $index: number\n  store: Store<T>\n  _self: any\n}\n\ntype Filters = {\n  text: string\n  value: string\n}[]\n\ntype FilterMethods<T extends DefaultRow> = (\n  value: string,\n  row: T,\n  column: TableColumnCtx<T>\n) => void\n\ntype ValueOf<T> = T[keyof T]\n\ntype TableColumnCtx<T extends DefaultRow = DefaultRow> = {\n  id: string\n  realWidth: number | null\n  type: string\n  label: string\n  className: string\n  labelClassName: string\n  property: string\n  prop: string\n  width?: string | number\n  minWidth: string | number\n  renderHeader: (data: CI<T>) => VNode\n  sortable: boolean | string\n  sortMethod: (a: T, b: T) => number\n  sortBy: string | ((row: T, index: number, array?: T[]) => string) | string[]\n  resizable: boolean\n  columnKey: string\n  rawColumnKey: string\n  align: string\n  headerAlign: string\n  showOverflowTooltip?: boolean | TableOverflowTooltipOptions\n  tooltipFormatter?: TableOverflowTooltipFormatter<T>\n  fixed: boolean | string\n  formatter: (\n    row: T,\n    column: TableColumnCtx<T>,\n    cellValue: any,\n    index: number\n  ) => VNode | string\n  selectable: (row: T, index: number) => boolean\n  reserveSelection: boolean\n  filterMethod: FilterMethods<T>\n  filteredValue: string[]\n  filters: Filters\n  filterPlacement: string\n  filterMultiple: boolean\n  filterClassName: string\n  index: number | ((index: number) => number)\n  sortOrders: (TableSortOrder | null)[]\n  renderCell: (data: any) => VNode | VNode[]\n  colSpan: number\n  rowSpan: number\n  children?: TableColumnCtx<T>[]\n  level: number\n  filterable: boolean | FilterMethods<T> | Filters\n  order: TableSortOrder | null\n  isColumnGroup: boolean\n  isSubColumn: boolean\n  columns: TableColumnCtx<T>[]\n  getColumnIndex: () => number\n  no: number\n  filterOpened?: boolean\n  renderFilterIcon?: (scope: any) => VNode\n  renderExpand?: (scope: any) => VNode\n}\n\ninterface TableColumn<T extends DefaultRow> extends ComponentInternalInstance {\n  vnode: {\n    vParent: TableColumn<T> | Table<T>\n  } & VNode\n  vParent: TableColumn<T> | Table<T>\n  columnId: string\n  columnConfig: Ref<Partial<TableColumnCtx<T>>>\n}\n\nexport type { Filters, FilterMethods, TableColumnCtx, TableColumn, ValueOf }\n\nexport default {\n  /**\n   * @description type of the column. If set to `selection`, the column will display checkbox. If set to `index`, the column will display index of the row (staring from 1). If set to `expand`, the column will display expand icon\n   */\n  type: {\n    type: String,\n    default: 'default',\n  },\n  /**\n   * @description column label\n   */\n  label: String,\n  /**\n   * @description class name of cells in the column\n   */\n  className: String,\n  /**\n   * @description class name of the label of this column\n   */\n  labelClassName: String,\n  /**\n   * @description\n   */\n  property: String,\n  /**\n   * @description field name. You can also use its alias: `property`\n   */\n  prop: String,\n  /**\n   * @description column width\n   */\n  width: {\n    type: [String, Number],\n    default: '',\n  },\n  /**\n   * @description column minimum width. Columns with `width` has a fixed width, while columns with `min-width` has a width that is distributed in proportion\n   */\n  minWidth: {\n    type: [String, Number],\n    default: '',\n  },\n  /**\n   * @description render function for table header of this column\n   */\n  renderHeader: Function as PropType<TableColumnCtx<any>['renderHeader']>,\n  /**\n   * @description whether column can be sorted. Remote sorting can be done by setting this attribute to 'custom' and listening to the `sort-change` event of Table\n   */\n  sortable: {\n    type: [Boolean, String],\n    default: false,\n  },\n  /**\n   * @description sorting method, works when `sortable` is `true`. Should return a number, just like Array.sort\n   */\n  sortMethod: Function as PropType<TableColumnCtx<any>['sortMethod']>,\n  /**\n   * @description specify which property to sort by, works when `sortable` is `true` and `sort-method` is `undefined`. If set to an Array, the column will sequentially sort by the next property if the previous one is equal\n   */\n  sortBy: [String, Function, Array] as PropType<TableColumnCtx<any>['sortBy']>,\n  /**\n   * @description whether column width can be resized, works when `border` of `el-table` is `true`\n   */\n  resizable: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description column's key. If you need to use the filter-change event, you need this attribute to identify which column is being filtered\n   */\n  columnKey: String,\n  /**\n   * @description alignment, the value should be 'left' \\/ 'center' \\/ 'right'\n   */\n  align: String,\n  /**\n   * @description alignment of the table header. If omitted, the value of the above `align` attribute will be applied, the value should be 'left' \\/ 'center' \\/ 'right'\n   */\n  headerAlign: String,\n  /**\n   * @description whether to hide extra content and show them in a tooltip when hovering on the cell\n   */\n  showOverflowTooltip: {\n    type: [Boolean, Object] as PropType<\n      TableColumnCtx<any>['showOverflowTooltip']\n    >,\n    default: undefined,\n  },\n  /**\n   * @description function that formats cell tooltip content, works when `show-overflow-tooltip` is `true`\n   */\n  tooltipFormatter: Function as PropType<\n    TableColumnCtx<any>['tooltipFormatter']\n  >,\n  /**\n   * @description whether column is fixed at left / right. Will be fixed at left if `true`\n   */\n  fixed: [Boolean, String],\n  /**\n   * @description function that formats cell content\n   */\n  formatter: Function as PropType<TableColumnCtx<any>['formatter']>,\n  /**\n   * @description function that determines if a certain row can be selected, works when `type` is 'selection'\n   */\n  selectable: Function as PropType<TableColumnCtx<any>['selectable']>,\n  /**\n   * @description whether to reserve selection after data refreshing, works when `type` is 'selection'. Note that `row-key` is required for this to work\n   */\n  reserveSelection: Boolean,\n  /**\n   * @description data filtering method. If `filter-multiple` is on, this method will be called multiple times for each row, and a row will display if one of the calls returns `true`\n   */\n  filterMethod: Function as PropType<TableColumnCtx<any>['filterMethod']>,\n  /**\n   * @description filter value for selected data, might be useful when table header is rendered with `render-header`\n   */\n  filteredValue: Array as PropType<TableColumnCtx<any>['filteredValue']>,\n  /**\n   * @description an array of data filtering options. For each element in this array, `text` and `value` are required\n   */\n  filters: Array as PropType<TableColumnCtx<any>['filters']>,\n  /**\n   * @description placement for the filter dropdown\n   */\n  filterPlacement: String,\n  /**\n   * @description whether data filtering supports multiple options\n   */\n  filterMultiple: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description className for the filter dropdown\n   */\n  filterClassName: String,\n  /**\n   * @description customize indices for each row, works on columns with `type=index`\n   */\n  index: [Number, Function] as PropType<TableColumnCtx<any>['index']>,\n  /**\n   * @description the order of the sorting strategies used when sorting the data, works when `sortable` is `true`. Accepts an array, as the user clicks on the header, the column is sorted in order of the elements in the array\n   */\n  sortOrders: {\n    type: Array as PropType<TableColumnCtx<any>['sortOrders']>,\n    default: () => {\n      return ['ascending', 'descending', null]\n    },\n    validator: (val: TableColumnCtx<any>['sortOrders']) => {\n      return val.every((order: TableSortOrder | null) =>\n        ['ascending', 'descending', null].includes(order)\n      )\n    },\n  },\n}\n"],"mappings":";AA+FA,uBAAe;CAIb,MAAM;EACJ,MAAM;EACN,SAAS;EACV;CAID,OAAO;CAIP,WAAW;CAIX,gBAAgB;CAIhB,UAAU;CAIV,MAAM;CAIN,OAAO;EACL,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS;EACV;CAID,UAAU;EACR,MAAM,CAAC,QAAQ,OAAO;EACtB,SAAS;EACV;CAID,cAAc;CAId,UAAU;EACR,MAAM,CAAC,SAAS,OAAO;EACvB,SAAS;EACV;CAID,YAAY;CAIZ,QAAQ;EAAC;EAAQ;EAAU;EAAM;CAIjC,WAAW;EACT,MAAM;EACN,SAAS;EACV;CAID,WAAW;CAIX,OAAO;CAIP,aAAa;CAIb,qBAAqB;EACnB,MAAM,CAAC,SAAS,OAAO;EAGvB,SAAS;EACV;CAID,kBAAkB;CAMlB,OAAO,CAAC,SAAS,OAAO;CAIxB,WAAW;CAIX,YAAY;CAIZ,kBAAkB;CAIlB,cAAc;CAId,eAAe;CAIf,SAAS;CAIT,iBAAiB;CAIjB,gBAAgB;EACd,MAAM;EACN,SAAS;EACV;CAID,iBAAiB;CAIjB,OAAO,CAAC,QAAQ,SAAS;CAIzB,YAAY;EACV,MAAM;EACN,eAAe;AACb,UAAO;IAAC;IAAa;IAAc;IAAK;;EAE1C,YAAY,QAA2C;AACrD,UAAO,IAAI,OAAO,UAChB;IAAC;IAAa;IAAc;IAAK,CAAC,SAAS,MAAM,CAClD;;EAEJ;CACF"}