transfer-panel.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { buildProps, definePropType } from '@element-plus/utils'
  2. import { transferCheckedChangeFn, transferProps } from './transfer'
  3. import type { ExtractPropTypes, VNode } from 'vue'
  4. import type { TransferDataItem, TransferKey } from './transfer'
  5. import type TransferPanel from './transfer-panel.vue'
  6. export interface TransferPanelState {
  7. checked: TransferKey[]
  8. allChecked: boolean
  9. query: string
  10. checkChangeByUser: boolean
  11. }
  12. export const CHECKED_CHANGE_EVENT = 'checked-change'
  13. export const transferPanelProps = buildProps({
  14. data: transferProps.data,
  15. optionRender: {
  16. type: definePropType<(option: TransferDataItem) => VNode | VNode[]>(
  17. Function
  18. ),
  19. },
  20. placeholder: String,
  21. title: String,
  22. filterable: Boolean,
  23. format: transferProps.format,
  24. filterMethod: transferProps.filterMethod,
  25. defaultChecked: transferProps.leftDefaultChecked,
  26. props: transferProps.props,
  27. } as const)
  28. export type TransferPanelProps = ExtractPropTypes<typeof transferPanelProps>
  29. export const transferPanelEmits = {
  30. [CHECKED_CHANGE_EVENT]: transferCheckedChangeFn,
  31. }
  32. export type TransferPanelEmits = typeof transferPanelEmits
  33. export type TransferPanelInstance = InstanceType<typeof TransferPanel>