{"version":3,"file":"select.mjs","sources":["../../../../../../../packages/components/select/src/select.ts"],"sourcesContent":["import { placements } from '@popperjs/core'\nimport { scrollbarEmits } from '@hd-front-end/components/scrollbar'\nimport {\n  useAriaProps,\n  useEmptyValuesProps,\n  useSizeProp,\n} from '@hd-front-end/hooks'\nimport { buildProps, definePropType, iconPropType } from '@hd-front-end/utils'\nimport { useTooltipContentProps } from '@hd-front-end/components/tooltip'\nimport { ArrowDown, CircleClose } from '@element-plus/icons-vue'\nimport { tagProps } from '@hd-front-end/components/tag'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@hd-front-end/constants'\nimport { defaultProps } from '@hd-front-end/components/select-v2/src/useProps'\n\nimport type { EmitFn } from '@hd-front-end/utils'\nimport type {\n  CSSProperties,\n  ExtractPropTypes,\n  __ExtractPublicPropTypes,\n} from 'vue'\nimport type Select from './select.vue'\nimport type {\n  Options,\n  Placement,\n  PopperEffect,\n} from '@hd-front-end/components/popper'\nimport type { OptionValue } from './type'\nimport type { Props } from '@hd-front-end/components/select-v2/src/useProps'\n\nexport const selectProps = buildProps({\n  /**\n   * @description the name attribute of select input\n   */\n  name: String,\n  /**\n   * @description native input id\n   */\n  id: String,\n  /**\n   * @description binding value\n   */\n  modelValue: {\n    type: definePropType<OptionValue | OptionValue[] | null>([\n      Array,\n      String,\n      Number,\n      Boolean,\n      Object,\n    ]),\n    default: undefined,\n  },\n  /**\n   * @description the autocomplete attribute of select input\n   */\n  autocomplete: {\n    type: String,\n    default: 'off',\n  },\n  /**\n   * @description for non-filterable Select, this prop decides if the option menu pops up when the input is focused\n   */\n  automaticDropdown: Boolean,\n  /**\n   * @description size of Input\n   */\n  size: useSizeProp,\n  /**\n   * @description tooltip theme, built-in theme: `dark` / `light`\n   */\n  effect: {\n    type: definePropType<PopperEffect>(String),\n    default: 'light',\n  },\n  /**\n   * @description whether Select is disabled\n   */\n  disabled: Boolean,\n  /**\n   * @description whether select can be cleared\n   */\n  clearable: Boolean,\n  /**\n   * @description whether Select is filterable\n   */\n  filterable: Boolean,\n  /**\n   * @description whether creating new items is allowed. To use this, `filterable` must be true\n   */\n  allowCreate: Boolean,\n  /**\n   * @description whether Select is loading data from server\n   */\n  loading: Boolean,\n  /**\n   * @description custom class name for Select's dropdown\n   */\n  popperClass: {\n    type: String,\n    default: '',\n  },\n  /**\n   * @description custom style for Select's dropdown\n   */\n  popperStyle: {\n    type: definePropType<string | CSSProperties>([String, Object]),\n  },\n  /**\n   * @description [popper.js](https://popper.js.org/docs/v2/) parameters\n   */\n  popperOptions: {\n    type: definePropType<Partial<Options>>(Object),\n    default: () => ({} as Partial<Options>),\n  },\n  /**\n   * @description whether options are loaded from server\n   */\n  remote: Boolean,\n  /**\n   * @description displayed text while loading data from server, default is 'Loading'\n   */\n  loadingText: String,\n  /**\n   * @description displayed text when no data matches the filtering query, you can also use slot `empty`, default is 'No matching data'\n   */\n  noMatchText: String,\n  /**\n   * @description displayed text when there is no options, you can also use slot `empty`, default is 'No data'\n   */\n  noDataText: String,\n  /**\n   * @description function that gets called when the input value changes. Its parameter is the current input value. To use this, `filterable` must be true\n   */\n  remoteMethod: {\n    type: definePropType<(query: string) => void>(Function),\n  },\n  /**\n   * @description custom filter method, the first parameter is the current input value. To use this, `filterable` must be true\n   */\n  filterMethod: {\n    type: definePropType<(query: string) => void>(Function),\n  },\n  /**\n   * @description whether multiple-select is activated\n   */\n  multiple: Boolean,\n  /**\n   * @description maximum number of options user can select when `multiple` is `true`. No limit when set to 0\n   */\n  multipleLimit: {\n    type: Number,\n    default: 0,\n  },\n  /**\n   * @description placeholder, default is 'Select'\n   */\n  placeholder: {\n    type: String,\n  },\n  /**\n   * @description select first matching option on enter key. Use with `filterable` or `remote`\n   */\n  defaultFirstOption: Boolean,\n  /**\n   * @description when `multiple` and `filter` is true, whether to reserve current keyword after selecting an option\n   */\n  reserveKeyword: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description unique identity key name for value, required when value is an object\n   */\n  valueKey: {\n    type: String,\n    default: 'value',\n  },\n  /**\n   * @description whether to collapse tags to a text when multiple selecting\n   */\n  collapseTags: Boolean,\n  /**\n   * @description whether show all selected tags when mouse hover text of collapse-tags. To use this, `collapse-tags` must be true\n   */\n  collapseTagsTooltip: Boolean,\n  /**\n   * @description the max tags number to be shown. To use this, `collapse-tags` must be true\n   */\n  maxCollapseTags: {\n    type: Number,\n    default: 1,\n  },\n  /**\n   * @description whether select dropdown is teleported, if `true` it will be teleported to where `append-to` sets\n   */\n  teleported: useTooltipContentProps.teleported,\n  /**\n   * @description when select dropdown is inactive and `persistent` is `false`, select dropdown will be destroyed\n   */\n  persistent: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description custom clear icon component\n   */\n  clearIcon: {\n    type: iconPropType,\n    default: CircleClose,\n  },\n  /**\n   * @description whether the width of the dropdown is the same as the input\n   */\n  fitInputWidth: Boolean,\n  /**\n   * @description custom suffix icon component\n   */\n  suffixIcon: {\n    type: iconPropType,\n    default: ArrowDown,\n  },\n  /**\n   * @description tag type\n   */\n  // eslint-disable-next-line vue/require-prop-types\n  tagType: { ...tagProps.type, default: 'info' },\n  /**\n   * @description tag effect\n   */\n  tagEffect: { ...tagProps.effect, default: 'light' },\n  /**\n   * @description whether to trigger form validation\n   */\n  validateEvent: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description in remote search method show suffix icon\n   */\n  remoteShowSuffix: Boolean,\n  /**\n   * @description determines whether the arrow is displayed\n   */\n  showArrow: {\n    type: Boolean,\n    default: true,\n  },\n  /**\n   * @description offset of the dropdown\n   */\n  offset: {\n    type: Number,\n    default: 12,\n  },\n  /**\n   * @description position of dropdown\n   */\n  placement: {\n    type: definePropType<Placement>(String),\n    values: placements,\n    default: 'bottom-start',\n  },\n  /**\n   * @description list of possible positions for dropdown\n   */\n  fallbackPlacements: {\n    type: definePropType<Placement[]>(Array),\n    default: ['bottom-start', 'top-start', 'right', 'left'],\n  },\n  /**\n   * @description tabindex for input\n   */\n  tabindex: {\n    type: [String, Number],\n    default: 0,\n  },\n  /**\n   * @description which element the selection dropdown appends to\n   */\n  appendTo: useTooltipContentProps.appendTo,\n  options: {\n    type: definePropType<Record<string, any>[]>(Array),\n  },\n  props: {\n    type: definePropType<SelectOptionProps>(Object),\n    default: () => defaultProps,\n  },\n  ...useEmptyValuesProps,\n  ...useAriaProps(['ariaLabel']),\n})\n/* eslint-disable @typescript-eslint/no-unused-vars */\nexport const selectEmits = {\n  [UPDATE_MODEL_EVENT]: (val: SelectProps['modelValue']) => true,\n  [CHANGE_EVENT]: (val: SelectProps['modelValue']) => true,\n  'popup-scroll': scrollbarEmits.scroll,\n  'remove-tag': (val: unknown) => true,\n  'visible-change': (visible: boolean) => true,\n  focus: (evt: FocusEvent) => evt instanceof FocusEvent,\n  blur: (evt: FocusEvent) => evt instanceof FocusEvent,\n  clear: () => true,\n}\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\nexport type SelectProps = ExtractPropTypes<typeof selectProps>\nexport type SelectPropsPublic = __ExtractPublicPropTypes<typeof selectProps>\nexport type SelectEmits = EmitFn<typeof selectEmits>\nexport type SelectInstance = InstanceType<typeof Select> & unknown\nexport type SelectOptionProps = Props\n"],"names":[],"mappings":";;;;;;;;;;;;;AA6BO,MAAM,cAAc,UAAW,CAAA;AAAA,EAIpC,IAAM,EAAA,MAAA;AAAA,EAIN,EAAI,EAAA,MAAA;AAAA,EAIJ,UAAY,EAAA;AAAA,IACV,MAAM,cAAmD,CAAA;AAAA,MACvD,KAAA;AAAA,MACA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,OAAA;AAAA,MACA,MAAA;AAAA,KACD,CAAA;AAAA,IACD,OAAS,EAAA,KAAA,CAAA;AAAA,GACX;AAAA,EAIA,YAAc,EAAA;AAAA,IACZ,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,KAAA;AAAA,GACX;AAAA,EAIA,iBAAmB,EAAA,OAAA;AAAA,EAInB,IAAM,EAAA,WAAA;AAAA,EAIN,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