{"version":3,"file":"search2.mjs","sources":["../../../../../../../packages/components/search/src/search.ts"],"sourcesContent":["import { ICommonColumn } from '@m-eleplus-crud/components/common'\r\nimport { useSizeProp } from '@m-eleplus-crud/hooks'\r\nimport { buildProps, definePropType, isObject } from '@m-eleplus-crud/utils'\r\n\r\nimport { ColumnType } from '../../common'\r\nimport type { ExtractPropTypes } from 'vue'\r\nimport type { FormItemRule } from 'element-plus'\r\n\r\n/**\r\n * @description 公开的search column配置\r\n */\r\nexport interface ISearchCommonColumn {\r\n  /**\r\n   * @description label宽度\r\n   */\r\n  labelWidth?: string\r\n  /**\r\n   * @description 搜索排序\r\n   */\r\n  order?: number\r\n  /**\r\n   * @description 搜索校验规则\r\n   */\r\n  rules?: FormItemRule[]\r\n  /**\r\n   * @description 栅栏宽度\r\n   */\r\n  span?: number\r\n  /**\r\n   * @description 最大长度\r\n   */\r\n  maxlength?: number\r\n  /**\r\n   * @description 搜索默认值\r\n   */\r\n  value?: any\r\n  /**\r\n   * @description 输入框占位文本\r\n   */\r\n  placeholder?: string\r\n  /**\r\n   * @description 可清除\r\n   */\r\n  clearable?: boolean\r\n}\r\n\r\n/**\r\n * @description 搜索列配置\r\n */\r\nexport interface ISearchColumn extends ICommonColumn, ISearchCommonColumn {\r\n  /**\r\n   * @description 类型\r\n   */\r\n  type?: ColumnType\r\n}\r\n\r\n/**\r\n * @description 公开的search配置\r\n */\r\nexport interface ISearchCommonOption {\r\n  /**\r\n   * @description 搜索按钮文本\r\n   */\r\n  searchBtnText?: string\r\n  /**\r\n   * @description 重置按钮文本\r\n   */\r\n  resetBtnText?: string\r\n  /**\r\n   * @description 搜索按钮icon\r\n   */\r\n  searchBtnIcon?: string\r\n  /**\r\n   * @description 重置按钮icon\r\n   */\r\n  resetBtnIcon?: string\r\n  /**\r\n   * @description label宽度\r\n   */\r\n  labelWidth?: string\r\n  /**\r\n   * @description 收缩展示个数\r\n   */\r\n  colIndex?: number\r\n  /**\r\n   * @description 是否开启收缩\r\n   */\r\n  col?: boolean\r\n}\r\n\r\n/**\r\n * @description 搜索信息配置\r\n */\r\nexport interface ISearchOption extends ISearchCommonOption {\r\n  /**\r\n   * @description 搜索列配置\r\n   */\r\n  column: ISearchColumn[]\r\n}\r\n\r\nexport const searchProps = buildProps({\r\n  /**\r\n   * @description 尺寸大小\r\n   */\r\n  size: useSizeProp,\r\n  /**\r\n   * @description 查询加载状态\r\n   */\r\n  loading: {\r\n    type: Boolean,\r\n    default: false,\r\n  },\r\n  /**\r\n   * @description 搜索权限配置\r\n   */\r\n  permission: {\r\n    type: Object,\r\n    default: {},\r\n  },\r\n  /**\r\n   * @description 搜索表单数据\r\n   */\r\n  model: {\r\n    type: Object,\r\n    required: true,\r\n  },\r\n  /**\r\n   * @description 搜索配置\r\n   */\r\n  option: {\r\n    type: definePropType<ISearchOption>(Object),\r\n    required: false,\r\n  },\r\n} as const)\r\nexport type SearchProps = ExtractPropTypes<typeof searchProps>\r\n\r\nexport const searchEmits = {\r\n  /**\r\n   * 搜索\r\n   * @param model 搜索表单数据\r\n   * @returns\r\n   */\r\n  search: (model: any) => isObject(model),\r\n  /**\r\n   * 重置\r\n   * @returns\r\n   */\r\n  reset: () => true,\r\n}\r\nexport type SearchEmits = typeof searchEmits\r\n"],"names":[],"mappings":";;;;AAoGO,MAAM,cAAc,UAAW,CAAA;AAAA,EAIpC,IAAM,EAAA,WAAA;AAAA,EAIN,OAAS,EAAA;AAAA,IACP,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,KAAA;AAAA,GACX;AAAA,EAIA,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,MAAA;AAAA,IACN,SAAS,EAAC;AAAA,GACZ;AAAA,EAIA,KAAO,EAAA;AAAA,IACL,IAAM,EAAA,MAAA;AAAA,IACN,QAAU,EAAA,IAAA;AAAA,GACZ;AAAA,EAIA,MAAQ,EAAA;AAAA,IACN,IAAA,EAAM,eAA8B,MAAM,CAAA;AAAA,IAC1C,QAAU,EAAA,KAAA;AAAA,GACZ;AACF,CAAU,EAAA;AAGH,MAAM,WAAc,GAAA;AAAA,EAMzB,MAAQ,EAAA,CAAC,KAAe,KAAA,QAAA,CAAS,KAAK,CAAA;AAAA,EAKtC,OAAO,MAAM,IAAA;AACf;;;;"}