zhangyong
2023-08-22 1353e87cb21a4032d585d7404bae9042f2ebcf08
1
{"version":3,"file":"cascader.mjs","sources":["../../../../../../packages/components/cascader/src/cascader.ts"],"sourcesContent":["import { CommonProps } from '@element-plus/components/cascader-panel'\nimport { buildProps, definePropType, isBoolean } from '@element-plus/utils'\nimport { useSizeProp } from '@element-plus/hooks'\nimport { useTooltipContentProps } from '@element-plus/components/tooltip'\nimport { tagProps } from '@element-plus/components/tag'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@element-plus/constants'\nimport type {\n  CascaderNode,\n  CascaderValue,\n} from '@element-plus/components/cascader-panel'\n\nexport const cascaderProps = buildProps({\n  ...CommonProps,\n  /**\n   * @description size of input\n   */\n  size: useSizeProp,\n  /**\n   * @description placeholder of input\n   */\n  placeholder: String,\n  /**\n   * @description whether Cascader is disabled\n   */\n  disabled: Boolean,\n  /**\n   * @description whether selected value can be cleared\n   */\n  clearable: Boolean,\n  /**\n   * @description whether the options can be searched\n   */\n  filterable: Boolean,\n  /**\n   * @description customize search logic, the first parameter is `node`, the second is `keyword`, and need return a boolean value indicating whether it hits.\n   */\n  filterMethod: {\n    type: definePropType<(node: CascaderNode, keyword: string) => boolean>(\n      Function\n    ),\n    default: (node: CascaderNode, keyword: string) =>\n      node.text.includes(keyword),\n  },\n  /**\n   * @description option label separator\n   */\n  separator: {\n    type: String,\n    default: ' / ',\n  },\n  /**\n   * @description whether to display all levels of the selected value in the input\n   */\n  showAllLevels: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description whether to collapse tags in multiple selection mode\n   */\n  collapseTags: Boolean,\n  /**\n   * @description native input id\n   */\n  collapseTagsTooltip: {\n    type: Boolean,\n    default: false,\n  },\n  /**\n   * @description debounce delay when typing filter keyword, in milliseconds\n   */\n  debounce: {\n    type: Number,\n    default: 300,\n  },\n  /**\n   * @description hook function before filtering with the value to be filtered as its parameter. If `false` is returned or a `Promise` is returned and then is rejected, filtering will be aborted\n   */\n  beforeFilter: {\n    type: definePropType<(value: string) => boolean | Promise<any>>(Function),\n    default: () => true,\n  },\n  /**\n   * @description custom class name for Cascader's dropdown\n   */\n  popperClass: {\n    type: String,\n    default: '',\n  },\n  /**\n   * @description whether cascader popup is teleported\n   */\n  teleported: useTooltipContentProps.teleported,\n  /**\n   * @description tag type\n   */\n  // eslint-disable-next-line vue/require-prop-types\n  tagType: { ...tagProps.type, default: 'info' },\n  /**\n   * @description whether to trigger form validation\n   */\n  validateEvent: {\n    type: Boolean,\n    default: true,\n  },\n})\n\nexport const cascaderEmits = {\n  [UPDATE_MODEL_EVENT]: (val: CascaderValue) => !!val || val === null,\n  [CHANGE_EVENT]: (val: CascaderValue) => !!val || val === null,\n  focus: (evt: FocusEvent) => evt instanceof FocusEvent,\n  blur: (evt: FocusEvent) => evt instanceof FocusEvent,\n  visibleChange: (val: boolean) => isBoolean(val),\n  expandChange: (val: CascaderValue) => !!val,\n  removeTag: (val: CascaderNode['valueByOption']) => !!val,\n}\n\n// Type name is taken(cascader-panel/src/node), needs discussion\n// export type CascaderProps = ExtractPropTypes<typeof cascaderProps>\n\nexport type CascaderEmits = typeof cascaderEmits\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAMY,MAAC,aAAa,GAAG,UAAU,CAAC;AACxC,EAAE,GAAG,WAAW;AAChB,EAAE,IAAI,EAAE,WAAW;AACnB,EAAE,WAAW,EAAE,MAAM;AACrB,EAAE,QAAQ,EAAE,OAAO;AACnB,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,UAAU,EAAE,OAAO;AACrB,EAAE,YAAY,EAAE;AAChB,IAAI,IAAI,EAAE,cAAc,CAAC,QAAQ,CAAC;AAClC,IAAI,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;AAC3D,GAAG;AACH,EAAE,SAAS,EAAE;AACb,IAAI,IAAI,EAAE,MAAM;AAChB,IAAI,OAAO,EAAE,KAAK;AAClB,GAA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