From ac68cb94d231c48251fde964664201f366f07410 Mon Sep 17 00:00:00 2001 From: aalizzwell Date: Mon, 3 Oct 2022 16:00:14 +0800 Subject: [PATCH 1/6] chore: change enum prop type name --- .../combo-list/src/combo-list.props.ts | 22 +++++++- .../ui-vue/components/combo-list/src/types.ts | 3 +- packages/ui-vue/src/App.vue | 56 +++++++++---------- 3 files changed, 50 insertions(+), 31 deletions(-) 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 b79b737ac4a..ba374b7b414 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,6 +1,9 @@ import { ExtractPropTypes } from "vue"; -import { ViewType, EnumTypeProp } from './types'; +import { ViewType, EnumType } from './types'; +/** + * 下拉列表属性 + */ export const comboListProps = { /** * 组件标识 @@ -50,6 +53,21 @@ export const comboListProps = { * 可选,下拉列表值展示方式 * 支持text | tag,即文本或标签,默认为ViewType.Text,即文本方式 */ - viewType: EnumTypeProp(ViewType.Text, ViewType), + viewType: EnumType(ViewType.Text, ViewType), + /** + * 可选,字段映射 + */ + mapFields: Object, + /** + * 下拉数据源 + */ + data: Array, + idField: { + type: String, + default: 'id' + }, + valueField: { + + } }; 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 3d760765303..06dd8edcfa8 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 Constructor, { } from 'vue'; /** * 下拉列表展现方式 */ @@ -11,7 +12,7 @@ export enum ViewType { * @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/src/App.vue b/packages/ui-vue/src/App.vue index 0748aa7a29b..dea3644a4da 100644 --- a/packages/ui-vue/src/App.vue +++ b/packages/ui-vue/src/App.vue @@ -20,46 +20,46 @@ const canAutoComplete = ref(false); -- Gitee From 5ee4b35efcf65bd32584345b2c7f60665bc441da Mon Sep 17 00:00:00 2001 From: aalizzwell Date: Mon, 3 Oct 2022 16:26:44 +0800 Subject: [PATCH 2/6] chore: add base props type & update props define --- .../combo-list/src/combo-list.props.ts | 49 ++++++++----------- .../ui-vue/components/combo-list/src/types.ts | 12 ++++- 2 files changed, 30 insertions(+), 31 deletions(-) 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 ba374b7b414..271c4cc73be 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,5 +1,5 @@ import { ExtractPropTypes } from "vue"; -import { ViewType, EnumType } from './types'; +import { ViewType, EnumType, Type } from './types'; /** * 下拉列表属性 @@ -8,47 +8,35 @@ export const comboListProps = { /** * 组件标识 */ - id: String, + id: Type(String), /** * 可选,是否禁用 * 默认为false */ - disabled: { - type: Boolean, - default: false - }, + disabled: Type({ default: false, type: Boolean }), /** * 可选,是否只读 * 默认为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,即文本方式 @@ -57,17 +45,20 @@ export const comboListProps = { /** * 可选,字段映射 */ - mapFields: Object, + mapFields: Type(Object), /** * 下拉数据源 */ - data: Array, - idField: { - type: String, - default: 'id' - }, - valueField: { - - } + data: Type(Array), + /** + * 可选,数据源id字段 + * 默认为id + */ + idField: Type({ default: 'id', type: String }), + /** + * 可选,数据源值字段 + * 默认为id + */ + valueField: Type({ default: 'id', 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 06dd8edcfa8..130e906f0cb 100644 --- a/packages/ui-vue/components/combo-list/src/types.ts +++ b/packages/ui-vue/components/combo-list/src/types.ts @@ -1,4 +1,4 @@ -import Constructor, { } from 'vue'; +import { Prop } from 'vue'; /** * 下拉列表展现方式 */ @@ -7,7 +7,15 @@ export enum ViewType { Tag = 'tag' }; /** - * 枚举类型属性描述 + * 原始类型 + * @param options options + * @returns + */ +export function Type(options: Prop) { + return options; +} +/** + * 枚举类型 * @param defaultValue 默认值 * @param enumType 枚举类型 * @returns -- Gitee From f9906c48448da10fca1d1488c3842eba06c8e2cf Mon Sep 17 00:00:00 2001 From: aalizzwell Date: Mon, 3 Oct 2022 16:39:50 +0800 Subject: [PATCH 3/6] chore: add props --- .../combo-list/src/combo-list.props.ts | 47 ++++++++++++++++--- 1 file changed, 41 insertions(+), 6 deletions(-) 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 271c4cc73be..fc49c3fb2b2 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 @@ -11,12 +11,12 @@ export const comboListProps = { id: Type(String), /** * 可选,是否禁用 - * 默认为false + * 默认为`false` */ disabled: Type({ default: false, type: Boolean }), /** * 可选,是否只读 - * 默认为false + * 默认为`false` */ readonly: Type({ default: false, type: Boolean }), /** @@ -39,7 +39,7 @@ export const comboListProps = { enableTitle: Type({ default: true, type: Boolean }), /** * 可选,下拉列表值展示方式 - * 支持text | tag,即文本或标签,默认为ViewType.Text,即文本方式 + * 支持text | tag,即文本或标签,默认为`ViewType.Text`,即文本方式`text` */ viewType: EnumType(ViewType.Text, ViewType), /** @@ -52,13 +52,48 @@ export const comboListProps = { data: Type(Array), /** * 可选,数据源id字段 - * 默认为id + * 默认为`id` */ idField: Type({ default: 'id', type: String }), /** * 可选,数据源值字段 - * 默认为id + * 默认为`id` */ - valueField: Type({ default: 'id', type: String }) + 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: Boolean}), + }; export type ComboListProps = ExtractPropTypes; \ No newline at end of file -- Gitee From 6f693c245f3547ea33c4f87344cffcefcbe0e14c Mon Sep 17 00:00:00 2001 From: aalizzwell Date: Mon, 3 Oct 2022 16:42:28 +0800 Subject: [PATCH 4/6] chore: fix separator prop type --- packages/ui-vue/components/combo-list/src/combo-list.props.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 fc49c3fb2b2..6ba9f4b0e36 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 @@ -93,7 +93,7 @@ export const comboListProps = { * 可选,分隔符 * 默认`,` */ - separator: Type({default: ',', type: Boolean}), - + separator: Type({default: ',', type: String}), + }; export type ComboListProps = ExtractPropTypes; \ No newline at end of file -- Gitee From f64a6b76ea734a94400d9e679ddedccb3f838fb6 Mon Sep 17 00:00:00 2001 From: aalizzwell Date: Mon, 3 Oct 2022 17:24:31 +0800 Subject: [PATCH 5/6] chore: import button-edit component --- .../components/combo-list/src/combo-list.component.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 40f62354ae3..e758afe2a38 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
+ <> + + ); }; } -- Gitee From 8d4534b6bad9e05a76ac3e4c5486ad0d2ba28438 Mon Sep 17 00:00:00 2001 From: jiangsion Date: Tue, 4 Oct 2022 08:06:52 +0800 Subject: [PATCH 6/6] chore: repair the problem of html template error in tsx file under components directory --- packages/ui-vue/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui-vue/tsconfig.json b/packages/ui-vue/tsconfig.json index 2d25c29d12c..5945d6f143a 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" }] } -- Gitee