diff --git a/packages/ui-vue/components/combo-list/src/combo-list.component.tsx b/packages/ui-vue/components/combo-list/src/combo-list.component.tsx index 40f62354ae35527ee41ea526eb21fb4f30483f19..e758afe2a384bc89b8908a72e4d8e77043e9b230 100644 --- a/packages/ui-vue/components/combo-list/src/combo-list.component.tsx +++ b/packages/ui-vue/components/combo-list/src/combo-list.component.tsx @@ -1,5 +1,6 @@ import { defineComponent, SetupContext } from 'vue'; import { comboListProps, ComboListProps } from './combo-list.props'; +import { ButtonEdit } from '../../button-edit'; export default defineComponent({ name: 'FComboList', props: comboListProps, @@ -7,7 +8,9 @@ export default defineComponent({ setup(props: ComboListProps, context: SetupContext) { return () => { return ( -
combo-list
+ <> + + ); }; } diff --git a/packages/ui-vue/components/combo-list/src/combo-list.props.ts b/packages/ui-vue/components/combo-list/src/combo-list.props.ts index b79b737ac4a9edb3942cb462125fb94c3320f549..6ba9f4b0e367d3fd5628431b994137535f5b23b2 100644 --- a/packages/ui-vue/components/combo-list/src/combo-list.props.ts +++ b/packages/ui-vue/components/combo-list/src/combo-list.props.ts @@ -1,55 +1,99 @@ import { ExtractPropTypes } from "vue"; -import { ViewType, EnumTypeProp } from './types'; +import { ViewType, EnumType, Type } from './types'; +/** + * 下拉列表属性 + */ export const comboListProps = { /** * 组件标识 */ - id: String, + id: Type(String), /** * 可选,是否禁用 - * 默认为false + * 默认为`false` */ - disabled: { - type: Boolean, - default: false - }, + disabled: Type({ default: false, type: Boolean }), /** * 可选,是否只读 - * 默认为false + * 默认为`false` */ - readonly: { - type: Boolean, - default: false - }, + readonly: Type({ default: false, type: Boolean }), /** * 最大输入长度 */ - maxLength: Number, + maxLength: Type(Number), /** * 占位符 */ - placeholder: String, + placeholder: Type(String), /** * 可选,是否启用清空 * 默认启用 */ - enableClear: { - type: Boolean, - default: true - }, + enableClear: Type({ default: true, type: Boolean }), /** * 可选,鼠标悬停时是否显示控件值 * 默认显示 */ - enableTitle: { - type: Boolean, - default: true - }, + enableTitle: Type({ default: true, type: Boolean }), /** * 可选,下拉列表值展示方式 - * 支持text | tag,即文本或标签,默认为ViewType.Text,即文本方式 + * 支持text | tag,即文本或标签,默认为`ViewType.Text`,即文本方式`text` */ - viewType: EnumTypeProp(ViewType.Text, ViewType), + viewType: EnumType(ViewType.Text, ViewType), + /** + * 可选,字段映射 + */ + mapFields: Type(Object), + /** + * 下拉数据源 + */ + data: Type(Array), + /** + * 可选,数据源id字段 + * 默认为`id` + */ + idField: Type({ default: 'id', type: String }), + /** + * 可选,数据源值字段 + * 默认为`id` + */ + valueField: Type({ default: 'id', type: String }), + /** + * 可选,数据源显示字段 + * 默认为`label` + */ + textField: Type({ default: 'label', type: String }), + /** + * 可选,是否支持多选 + * 默认`false` + */ + multiSelect: Type({default: false, type: Boolean}), + /** + * 数据源地址 + */ + uri: Type(String), + /** + * 可选,最大高度 + * 默认`200` + */ + maxHeight: Type({default: 200, type: Number}), + /** + * 可选,是否支持远端过滤 + * 默认`false` + */ + remoteSearch: Type({default: false, type: Boolean}), + /** + * 可选,清空值时隐藏面板 + * 默认`true` + */ + hidePanelOnClear: Type({default: true, type: Boolean}), + /** + * 可选,分隔符 + * 默认`,` + */ + separator: Type({default: ',', type: String}), + }; export type ComboListProps = ExtractPropTypes; \ No newline at end of file diff --git a/packages/ui-vue/components/combo-list/src/types.ts b/packages/ui-vue/components/combo-list/src/types.ts index 3d760765303a46a5b293cb3611b8683506e32c58..130e906f0cbe8aad30446b5c8df2000eb3d109db 100644 --- a/packages/ui-vue/components/combo-list/src/types.ts +++ b/packages/ui-vue/components/combo-list/src/types.ts @@ -1,3 +1,4 @@ +import { Prop } from 'vue'; /** * 下拉列表展现方式 */ @@ -6,12 +7,20 @@ export enum ViewType { Tag = 'tag' }; /** - * 枚举类型属性描述 + * 原始类型 + * @param options options + * @returns + */ +export function Type(options: Prop) { + return options; +} +/** + * 枚举类型 * @param defaultValue 默认值 * @param enumType 枚举类型 * @returns */ -export function EnumTypeProp(defaultValue: T, enumType: Record) { +export function EnumType(defaultValue: T, enumType: Record) { return { default: defaultValue, validator: (value: T) => Object.values(enumType).includes(value) diff --git a/packages/ui-vue/tsconfig.json b/packages/ui-vue/tsconfig.json index 2d25c29d12ca29a229556eb5c6b11f996f97670c..5945d6f143a2f18e7dba98811dfb179dc0798c0e 100644 --- a/packages/ui-vue/tsconfig.json +++ b/packages/ui-vue/tsconfig.json @@ -17,6 +17,6 @@ "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true }, - "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"], + "include": ["components/**/*", "src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"], "references": [{ "path": "./tsconfig.node.json" }] }