From 5b16ec00e1de45ed50f1c206de10ad48f9d71275 Mon Sep 17 00:00:00 2001 From: roymondchen Date: Tue, 21 Oct 2025 18:59:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(design,editor,element-plus-adapter,form,ta?= =?UTF-8?q?ble,tdesign-vue-next-adapter):=20=E9=87=8D=E6=9E=84table?= =?UTF-8?q?=E7=BB=84=E4=BB=B6,=E9=80=82=E9=85=8Dtdesign?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/design/src/Button.vue | 8 + packages/design/src/Icon.vue | 13 + packages/design/src/Table.vue | 20 +- packages/design/src/TableColumn.vue | 27 - packages/design/src/Tree.vue | 110 --- packages/design/src/index.ts | 2 - packages/design/src/types.ts | 84 +-- .../editor/src/fields/StyleSetter/Index.vue | 2 +- .../layouts/sidebar/ComponentListPanel.vue | 21 +- .../src/theme/style-setter/background.scss | 13 +- packages/editor/src/utils/props.ts | 1 + .../element-plus-adapter/src/FormItem.vue | 26 + packages/element-plus-adapter/src/Table.vue | 92 +++ packages/element-plus-adapter/src/index.ts | 23 +- packages/form-schema/src/base.ts | 1 + packages/form/src/containers/Container.vue | 9 +- packages/form/src/containers/Table.vue | 681 ------------------ packages/form/src/fields/RadioGroup.vue | 2 +- packages/form/src/index.ts | 4 +- packages/form/src/table/ActionsColumn.vue | 84 +++ packages/form/src/table/SortColumn.vue | 101 +++ packages/form/src/table/Table.vue | 170 +++++ packages/form/src/table/type.ts | 18 + packages/form/src/table/useAdd.ts | 111 +++ packages/form/src/table/useFullscreen.ts | 28 + packages/form/src/table/useImport.ts | 68 ++ packages/form/src/table/usePagination.ts | 30 + packages/form/src/table/useSelection.ts | 34 + packages/form/src/table/useSortable.ts | 48 ++ packages/form/src/table/useTableColumns.ts | 193 +++++ packages/form/src/theme/form.scss | 14 +- packages/form/src/utils/form.ts | 46 ++ packages/form/tests/unit/utils/form.spec.ts | 83 ++- packages/table/src/ActionsColumn.vue | 89 +-- packages/table/src/ComponentColumn.vue | 25 +- packages/table/src/ExpandColumn.vue | 33 +- packages/table/src/PopoverColumn.vue | 43 +- packages/table/src/Table.vue | 124 ++-- packages/table/src/TextColumn.vue | 99 ++- .../tdesign-vue-next-adapter/package.json | 2 +- .../tdesign-vue-next-adapter/src/Checkbox.vue | 47 ++ .../src/DatePicker.vue | 6 +- .../tdesign-vue-next-adapter/src/Dialog.vue | 43 ++ .../tdesign-vue-next-adapter/src/Icon.vue | 8 +- .../tdesign-vue-next-adapter/src/Radio.vue | 23 + .../src/RadioButton.vue | 23 + .../tdesign-vue-next-adapter/src/Table.vue | 124 ++++ .../src/TableColumn.vue | 5 - .../tdesign-vue-next-adapter/src/index.ts | 59 +- playground/src/components/NavMenu.vue | 15 +- playground/vite.config.ts | 4 + 51 files changed, 1733 insertions(+), 1206 deletions(-) delete mode 100644 packages/design/src/TableColumn.vue delete mode 100644 packages/design/src/Tree.vue create mode 100644 packages/element-plus-adapter/src/FormItem.vue create mode 100644 packages/element-plus-adapter/src/Table.vue delete mode 100644 packages/form/src/containers/Table.vue create mode 100644 packages/form/src/table/ActionsColumn.vue create mode 100644 packages/form/src/table/SortColumn.vue create mode 100644 packages/form/src/table/Table.vue create mode 100644 packages/form/src/table/type.ts create mode 100644 packages/form/src/table/useAdd.ts create mode 100644 packages/form/src/table/useFullscreen.ts create mode 100644 packages/form/src/table/useImport.ts create mode 100644 packages/form/src/table/usePagination.ts create mode 100644 packages/form/src/table/useSelection.ts create mode 100644 packages/form/src/table/useSortable.ts create mode 100644 packages/form/src/table/useTableColumns.ts create mode 100644 packages/tdesign-vue-next-adapter/src/Checkbox.vue create mode 100644 packages/tdesign-vue-next-adapter/src/Dialog.vue create mode 100644 packages/tdesign-vue-next-adapter/src/Radio.vue create mode 100644 packages/tdesign-vue-next-adapter/src/RadioButton.vue create mode 100644 packages/tdesign-vue-next-adapter/src/Table.vue delete mode 100644 packages/tdesign-vue-next-adapter/src/TableColumn.vue diff --git a/packages/design/src/Button.vue b/packages/design/src/Button.vue index 54b4d2aa..564ebbe0 100644 --- a/packages/design/src/Button.vue +++ b/packages/design/src/Button.vue @@ -30,3 +30,11 @@ const clickHandler = (...args: any[]) => { emit('click', ...args); }; + + diff --git a/packages/design/src/Icon.vue b/packages/design/src/Icon.vue index c588dd6d..d7cfc755 100644 --- a/packages/design/src/Icon.vue +++ b/packages/design/src/Icon.vue @@ -19,3 +19,16 @@ const uiComponent = ui?.component || 'el-icon'; const props = defineProps(); const uiProps = computed(() => ui?.props(props) || props); + + diff --git a/packages/design/src/Table.vue b/packages/design/src/Table.vue index 73d8190c..054f109b 100644 --- a/packages/design/src/Table.vue +++ b/packages/design/src/Table.vue @@ -16,7 +16,7 @@ diff --git a/packages/design/src/TableColumn.vue b/packages/design/src/TableColumn.vue deleted file mode 100644 index eb4be119..00000000 --- a/packages/design/src/TableColumn.vue +++ /dev/null @@ -1,27 +0,0 @@ - - - diff --git a/packages/design/src/Tree.vue b/packages/design/src/Tree.vue deleted file mode 100644 index 6b9e75e5..00000000 --- a/packages/design/src/Tree.vue +++ /dev/null @@ -1,110 +0,0 @@ - - - diff --git a/packages/design/src/index.ts b/packages/design/src/index.ts index 406f3815..088e2802 100644 --- a/packages/design/src/index.ts +++ b/packages/design/src/index.ts @@ -46,13 +46,11 @@ export { default as TMagicStep } from './Step.vue'; export { default as TMagicSteps } from './Steps.vue'; export { default as TMagicSwitch } from './Switch.vue'; export { default as TMagicTable } from './Table.vue'; -export { default as TMagicTableColumn } from './TableColumn.vue'; export { default as TMagicTabPane } from './TabPane.vue'; export { default as TMagicTabs } from './Tabs.vue'; export { default as TMagicTag } from './Tag.vue'; export { default as TMagicTimePicker } from './TimePicker.vue'; export { default as TMagicTooltip } from './Tooltip.vue'; -export { default as TMagicTree } from './Tree.vue'; export { default as TMagicUpload } from './Upload.vue'; export const tMagicMessage = { diff --git a/packages/design/src/types.ts b/packages/design/src/types.ts index 9c35dd5e..773d0e7c 100644 --- a/packages/design/src/types.ts +++ b/packages/design/src/types.ts @@ -182,6 +182,7 @@ export interface FormItemProps { prop?: string; labelWidth?: string | number; rules?: any; + extra?: string; } export interface InputProps { @@ -295,17 +296,36 @@ export interface SwitchProps { } export interface TableProps { + columns?: TableColumnOptions[]; data?: any[]; border?: boolean; maxHeight?: number | string; defaultExpandAll?: boolean; + showHeader?: boolean; + rowKey?: string; + treeProps?: Record; + emptyText?: string; + tooltipEffect?: string; + tooltipOptions?: any; + showOverflowTooltip?: boolean; + spanMethod?: (data: any) => any; } -export interface TableColumnProps { - label?: string; - align?: string; - fixed?: string | boolean; - width?: string | number; +export interface TableColumnOptions { + props: { + class?: string; + label?: string; + fixed?: 'left' | 'right' | boolean; + width?: number | string; + type?: 'default' | 'selection' | 'index' | 'expand'; + prop?: string; + align?: string; + headerAlign?: string; + sortable?: boolean; + sortOrders?: Array<'ascending' | 'descending'>; + selectable?: (row: T, index: number) => boolean; + }; + cell?: (scope: { row: T; $index: number }) => any; } export interface TabPaneProps { @@ -342,33 +362,6 @@ export interface TooltipProps { offset?: number; } -export interface TreeProps { - data?: any[]; - emptyText?: string; - nodeKey?: string; - props?: any; - renderAfterExpand?: boolean; - load?: any; - renderContent?: any; - highlightCurrent?: boolean; - defaultExpandAll?: boolean; - checkOnClickNode?: boolean; - autoExpandParent?: boolean; - defaultExpandedKeys?: any[]; - showCheckbox?: boolean; - checkStrictly?: boolean; - defaultCheckedKeys?: any[]; - currentNodeKey?: string | number; - filterNodeMethod?: (value: any, data: any, node: any) => boolean; - accordion?: boolean; - indent?: number; - icon?: any; - lazy?: boolean; - draggable?: boolean; - allowDrag?: (node: any) => boolean; - allowDrop?: any; -} - export interface UploadProps { action?: string; autoUpload?: boolean; @@ -635,8 +628,8 @@ export interface Components { | DefineComponent< TableProps, { - instance: any; - $el: HTMLDivElement | undefined; + getEl: () => HTMLElement | undefined; + getTableRef: () => any; clearSelection: (...args: any[]) => void; toggleRowSelection: (...args: any[]) => void; toggleRowExpansion: (...args: any[]) => void; @@ -647,11 +640,6 @@ export interface Components { props: (props: TableProps) => TableProps; }; - tableColumn: { - component: DefineComponent | string; - props: (props: TableColumnProps) => TableColumnProps; - }; - tabPane: { component: DefineComponent | string; props: (props: TabPaneProps) => TabPaneProps; @@ -677,24 +665,6 @@ export interface Components { props: (props: TooltipProps) => TooltipProps; }; - tree: { - component: - | DefineComponent< - TreeProps, - { - getData: () => TreeProps['data']; - getStore: () => any; - filter: (...args: any[]) => any; - getNode: (...args: any[]) => any; - setCheckedKeys: (...args: any[]) => any; - setCurrentKey: (...args: any[]) => any; - }, - any - > - | string; - props: (props: TreeProps) => TreeProps; - }; - upload: { component: | DefineComponent< diff --git a/packages/editor/src/fields/StyleSetter/Index.vue b/packages/editor/src/fields/StyleSetter/Index.vue index 85ddf057..90f5e093 100644 --- a/packages/editor/src/fields/StyleSetter/Index.vue +++ b/packages/editor/src/fields/StyleSetter/Index.vue @@ -1,5 +1,5 @@