code-monkey-ui
Version:
A Component Library for Vue 3
1 lines • 6.84 kB
Source Map (JSON)
{"version":3,"file":"dsh-cascader.mjs","sources":["../../../../../../packages/components/dsh-cascader/src/dsh-cascader.ts"],"sourcesContent":["import { DshCommonProps } from '@code-monkey-ui/components/dsh-cascader-panel'\nimport { buildProps, definePropType, isBoolean } from '@code-monkey-ui/utils'\nimport { useSizeProp } from '@code-monkey-ui/hooks'\nimport { useTooltipContentProps } from '@code-monkey-ui/components/tooltip'\nimport { tagProps } from '@code-monkey-ui/components/tag'\nimport { CHANGE_EVENT, UPDATE_MODEL_EVENT } from '@code-monkey-ui/constants'\nimport type {\n DshCascaderNode,\n DshCascaderValue,\n} from '@code-monkey-ui/components/dsh-cascader-panel'\n\nexport const dshCascaderProps = buildProps({\n ...DshCommonProps,\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: DshCascaderNode, keyword: string) => boolean>(\n Function\n ),\n default: (node: DshCascaderNode, 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 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 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 * @description 显示底部按钮\n */\n showFoot: {\n type: Boolean,\n default: true,\n },\n /**\n * @description 显示只选此项\n */\n onlyThis: {\n type: Boolean,\n default: true,\n },\n /**\n * @description 未选值时默认宽度\n */\n emptyWidth: {\n type: String,\n default: '',\n },\n /**\n * @description 宽度\n */\n width: {\n type: String,\n default: '100%',\n },\n /**\n * @description 聚焦时宽度\n */\n focusWidth: {\n type: String,\n default: '',\n },\n})\n\nexport const dshCascaderEmits = {\n [UPDATE_MODEL_EVENT]: (val: DshCascaderValue) => !!val || val === null,\n [CHANGE_EVENT]: (val: DshCascaderValue) => !!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: DshCascaderValue) => !!val,\n removeTag: (val: DshCascaderNode['valueByOption']) => !!val,\n confirm: (val: DshCascaderValue) => !!val || val === null,\n cancel: (val: DshCascaderValue) => !!val || val === null,\n}\n\n// Type name is taken(cascader-panel/src/node), needs discussion\n// export type dshCascaderProps = ExtractPropTypes<typeof dshCascaderProps>\n\nexport type DshCascaderEmits = typeof dshCascaderEmits\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAMY,MAAC,gBAAgB,GAAG,UAAU,CAAC;AAC3C,EAAE,GAAG,cAAc;AACnB,EAAE,IAAI,EAAE,WAAW;AACnB,EAA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