{"version":3,"file":"transfer2.js","sources":["../../../../../../packages/components/transfer/src/transfer.ts"],"sourcesContent":["import { isNil } from 'lodash-unified'\nimport {\n buildProps,\n definePropType,\n isArray,\n mutable,\n} from '@element-plus/utils'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\n\nimport type { ExtractPropTypes, h as H, VNode } from 'vue'\nimport type Transfer from './transfer.vue'\n\nexport type TransferKey = string | number\nexport type TransferDirection = 'left' | 'right'\n\nexport type TransferDataItem = Record\n\nexport type renderContent = (\n h: typeof H,\n option: TransferDataItem\n) => VNode | VNode[]\n\nexport interface TransferFormat {\n noChecked?: string\n hasChecked?: string\n}\n\nexport interface TransferPropsAlias {\n label?: string\n key?: string\n disabled?: string\n}\n\nexport interface TransferCheckedState {\n leftChecked: TransferKey[]\n rightChecked: TransferKey[]\n}\n\nexport const LEFT_CHECK_CHANGE_EVENT = 'left-check-change'\nexport const RIGHT_CHECK_CHANGE_EVENT = 'right-check-change'\n\nexport const transferProps = buildProps({\n /**\n * @description data source\n */\n data: {\n type: definePropType(Array),\n default: () => [],\n },\n /**\n * @description custom list titles\n */\n titles: {\n type: definePropType<[string, string]>(Array),\n default: () => [],\n },\n /**\n * @description custom button texts\n */\n buttonTexts: {\n type: definePropType<[string, string]>(Array),\n default: () => [],\n },\n /**\n * @description placeholder for the filter input\n */\n filterPlaceholder: String,\n /**\n * @description custom filter method\n */\n filterMethod: {\n type: definePropType<(query: string, item: TransferDataItem) => boolean>(\n Function\n ),\n },\n /**\n * @description key array of initially checked data items of the left list\n */\n leftDefaultChecked: {\n type: definePropType(Array),\n default: () => [],\n },\n /**\n * @description key array of initially checked data items of the right list\n */\n rightDefaultChecked: {\n type: definePropType(Array),\n default: () => [],\n },\n /**\n * @description custom render function for data items\n */\n renderContent: {\n type: definePropType(Function),\n },\n /**\n * @description binding value\n */\n modelValue: {\n type: definePropType(Array),\n default: () => [],\n },\n /**\n * @description texts for checking status in list header\n */\n format: {\n type: definePropType(Object),\n default: () => ({}),\n },\n /**\n * @description whether Transfer is filterable\n */\n filterable: Boolean,\n /**\n * @description prop aliases for data source\n */\n props: {\n type: definePropType(Object),\n default: () =>\n mutable({\n label: 'label',\n key: 'key',\n disabled: 'disabled',\n } as const),\n },\n /**\n * @description order strategy for elements in the target list. If set to `original`, the elements will keep the same order as the data source. If set to `push`, the newly added elements will be pushed to the bottom. If set to `unshift`, the newly added elements will be inserted on the top\n */\n targetOrder: {\n type: String,\n values: ['original', 'push', 'unshift'],\n default: 'original',\n },\n /**\n * @description whether to trigger form validation\n */\n validateEvent: {\n type: Boolean,\n default: true,\n },\n} as const)\nexport type TransferProps = ExtractPropTypes\n\nexport const transferCheckedChangeFn = (\n value: TransferKey[],\n movedKeys?: TransferKey[]\n) => [value, movedKeys].every(isArray) || (isArray(value) && isNil(movedKeys))\n\nexport const transferEmits = {\n [CHANGE_EVENT]: (\n value: TransferKey[],\n direction: TransferDirection,\n movedKeys: TransferKey[]\n ) =>\n [value, movedKeys].every(isArray) && ['left', 'right'].includes(direction),\n [UPDATE_MODEL_EVENT]: (value: TransferKey[]) => isArray(value),\n [LEFT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn,\n [RIGHT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn,\n}\nexport type TransferEmits = typeof transferEmits\n\nexport type TransferInstance = InstanceType\n"],"names":["buildProps","definePropType","mutable","isArray","isNil","CHANGE_EVENT","UPDATE_MODEL_EVENT"],"mappings":";;;;;;;;;;;;AAQY,MAAC,uBAAuB,GAAG,oBAAoB;AAC/C,MAAC,wBAAwB,GAAG,qBAAqB;AACjD,MAAC,aAAa,GAAGA,kBAAU,CAAC;AACxC,EAAE,IAAI,EAAE;AACR,IAAI,IAAI,EAAEC,sBAAc,CAAC,KAAK,CAAC;AAC/B,IAAI,OAAO,EAAE,MAAM,EAAE;AACrB,GAAG;AACH,EAAE,MAAM,EAAE;AACV,IAAI,IAAI,EAAEA,sBAAc,CAAC,KAAK,CAAC;AAC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