diff --git a/packages/design/src/Badge.vue b/packages/design/src/Badge.vue new file mode 100644 index 00000000..046c3bbe --- /dev/null +++ b/packages/design/src/Badge.vue @@ -0,0 +1,23 @@ + + + diff --git a/packages/design/src/Input.vue b/packages/design/src/Input.vue index 14e21e45..4613243d 100644 --- a/packages/design/src/Input.vue +++ b/packages/design/src/Input.vue @@ -13,6 +13,12 @@ + + diff --git a/packages/design/src/RadioButton.vue b/packages/design/src/RadioButton.vue new file mode 100644 index 00000000..717d89fb --- /dev/null +++ b/packages/design/src/RadioButton.vue @@ -0,0 +1,21 @@ + + + diff --git a/packages/design/src/Select.vue b/packages/design/src/Select.vue index cb378441..f33cc3fc 100644 --- a/packages/design/src/Select.vue +++ b/packages/design/src/Select.vue @@ -32,6 +32,7 @@ const props = defineProps<{ allowCreate?: boolean; valueKey?: string; remoteMethod?: any; + loading?: boolean; size?: 'large' | 'default' | 'small'; }>(); diff --git a/packages/design/src/defaultAdapter.ts b/packages/design/src/defaultAdapter.ts index 39857033..1d740771 100644 --- a/packages/design/src/defaultAdapter.ts +++ b/packages/design/src/defaultAdapter.ts @@ -1,5 +1,10 @@ export default { components: { + badge: { + component: 'el-badge', + props: (props: any) => props, + }, + button: { component: 'el-button', props: (props: any) => props, @@ -130,6 +135,11 @@ export default { props: (props: any) => props, }, + radioButton: { + component: 'el-radio-button', + props: (props: any) => props, + }, + radioGroup: { component: 'el-radio-group', props: (props: any) => props, diff --git a/packages/design/src/index.ts b/packages/design/src/index.ts index 899ed840..478662e6 100644 --- a/packages/design/src/index.ts +++ b/packages/design/src/index.ts @@ -7,6 +7,7 @@ export * from './type'; export * from './config'; /* eslint-disable @typescript-eslint/no-unused-vars */ +export { default as TMagicBadge } from './Badge.vue'; export { default as TMagicButton } from './Button.vue'; export { default as TMagicCard } from './Card.vue'; export { default as TMagicCascader } from './Cascader.vue'; @@ -33,6 +34,7 @@ export { default as TMagicOptionGroup } from './OptionGroup.vue'; export { default as TMagicPagination } from './Pagination.vue'; export { default as TMagicPopover } from './Popover.vue'; export { default as TMagicRadio } from './Radio.vue'; +export { default as TMagicRadioButton } from './RadioButton.vue'; export { default as TMagicRadioGroup } from './RadioGroup.vue'; export { default as TMagicRow } from './Row.vue'; export { default as TMagicScrollbar } from './Scrollbar.vue'; @@ -95,6 +97,10 @@ export default { tMagicMessageBox.close = options.messageBox?.close; } + if (options.loading) { + app.directive('loading', options.loading); + } + app.config.globalProperties.$MAGIC_DESIGN = options; setConfig(options); }, diff --git a/packages/design/src/type.ts b/packages/design/src/type.ts index 99db7c2e..a3e8df81 100644 --- a/packages/design/src/type.ts +++ b/packages/design/src/type.ts @@ -1,3 +1,5 @@ +import { Directive } from 'vue'; + export interface CascaderOption { /** 指定选项的值为选项对象的某个属性值 */ value: any; @@ -33,9 +35,20 @@ export interface TMagicMessageBox { close(): void; } +export type LoadingBinding = boolean; + +const INSTANCE_KEY = Symbol('TdesignLoading'); + +export interface ElementLoading extends HTMLElement { + [INSTANCE_KEY]?: { + instance: any; + }; +} + export interface PluginOptions { message?: TMagicMessage; messageBox?: TMagicMessageBox; components?: Record; + loading?: Directive; [key: string]: any; } diff --git a/packages/editor/src/components/SearchInput.vue b/packages/editor/src/components/SearchInput.vue index 1c2b24f7..51b4038c 100644 --- a/packages/editor/src/components/SearchInput.vue +++ b/packages/editor/src/components/SearchInput.vue @@ -5,16 +5,19 @@ size="small" placeholder="输入关键字进行过滤" clearable - :prefix-icon="Search" @input="filterTextChangeHandler" - > + > + + diff --git a/packages/tdesign-vue-next-adapter/src/Input.vue b/packages/tdesign-vue-next-adapter/src/Input.vue index be58e49e..c2205eb7 100644 --- a/packages/tdesign-vue-next-adapter/src/Input.vue +++ b/packages/tdesign-vue-next-adapter/src/Input.vue @@ -18,7 +18,14 @@ @keypress="inputHandler" @change="changeHandler" @update:modelValue="updateModelValue" - > + > + + + diff --git a/playground/src/pages/Editor.vue b/playground/src/pages/Editor.vue index d21abadf..f6596054 100644 --- a/playground/src/pages/Editor.vue +++ b/playground/src/pages/Editor.vue @@ -19,7 +19,7 @@ - - + @@ -41,9 +41,9 @@ import { computed, nextTick, ref, toRaw } from 'vue'; import { useRouter } from 'vue-router'; import { Coin, Connection, Document } from '@element-plus/icons-vue'; -import { ElMessage, ElMessageBox } from 'element-plus'; import serialize from 'serialize-javascript'; +import { TMagicDialog, tMagicMessage, tMagicMessageBox } from '@tmagic/design'; import { editorService, MenuBarData, MoveableOptions, TMagicEditor } from '@tmagic/editor'; import type { MContainer, MNode } from '@tmagic/schema'; import { NodeType } from '@tmagic/schema'; @@ -104,13 +104,13 @@ const menu: MenuBarData = { handler: async (services) => { if (services?.editorService.get('modifiedNodeIds').size > 0) { try { - await ElMessageBox.confirm('有修改未保存,是否先保存再预览', '提示', { + await tMagicMessageBox.confirm('有修改未保存,是否先保存再预览', '提示', { confirmButtonText: '保存并预览', cancelButtonText: '预览', type: 'warning', }); save(); - ElMessage.success('保存成功'); + tMagicMessage.success('保存成功'); } catch (e) { console.error(e); } @@ -132,7 +132,7 @@ const menu: MenuBarData = { icon: Coin, handler: () => { save(); - ElMessage.success('保存成功'); + tMagicMessage.success('保存成功'); }, }, '/', diff --git a/playground/src/pages/Form.vue b/playground/src/pages/Form.vue index 35af4895..4eb7c0e9 100644 --- a/playground/src/pages/Form.vue +++ b/playground/src/pages/Form.vue @@ -20,17 +20,17 @@ - +
-
+ diff --git a/playground/src/pages/Table.vue b/playground/src/pages/Table.vue index e5c5e84c..0d0c3feb 100644 --- a/playground/src/pages/Table.vue +++ b/playground/src/pages/Table.vue @@ -18,8 +18,8 @@ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 47e185cd..38d49280 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -523,8 +523,8 @@ importers: specifier: ^2.2.32 version: 2.2.32(vue@3.2.37) tdesign-vue-next: - specifier: ^0.26.0 - version: 0.26.0(vue@3.2.37) + specifier: ^1.3.1 + version: 1.3.1(vue@3.2.37) vue: specifier: ^3.2.37 version: 3.2.37 @@ -8653,8 +8653,8 @@ packages: vue: 3.2.37 dev: false - /tdesign-vue-next@0.26.0(vue@3.2.37): - resolution: {integrity: sha512-s5/vSn5JGgR+FofBoauCbNli8hXZ+RnwcwHIHNH1CgpI8tnHKpYBU3qteSy7DsKs3nsti58lAbVbNAJT5Izf6w==} + /tdesign-vue-next@1.3.1(vue@3.2.37): + resolution: {integrity: sha512-KHnDu9DX20mEIXIXM6jrYTbeD5mIxyDIsUUjXBY2cdyXn1oAneQJwg6Ceph8Ih7a3sm4/Q8dQVFpqo1/12aWGw==} peerDependencies: vue: '>=3.1.0' dependencies: