mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-06-23 18:39:20 +08:00
feat: 完善tdesign-vue-next适配
This commit is contained in:
parent
0c746aa3d9
commit
92b7a2aecf
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { getConfig } from './config';
|
import { getConfig } from './config';
|
||||||
|
import { IconProps } from './types';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'TMIcon',
|
name: 'TMIcon',
|
||||||
@ -13,4 +14,5 @@ defineOptions({
|
|||||||
|
|
||||||
const ui = getConfig('components')?.icon;
|
const ui = getConfig('components')?.icon;
|
||||||
const uiComponent = ui?.component || 'el-icon';
|
const uiComponent = ui?.component || 'el-icon';
|
||||||
|
defineProps<IconProps>();
|
||||||
</script>
|
</script>
|
||||||
|
@ -29,6 +29,7 @@ export interface ButtonProps {
|
|||||||
size?: FieldSize;
|
size?: FieldSize;
|
||||||
link?: boolean;
|
link?: boolean;
|
||||||
text?: boolean;
|
text?: boolean;
|
||||||
|
circle?: boolean;
|
||||||
icon?: any;
|
icon?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -380,6 +381,10 @@ export interface CascaderOption {
|
|||||||
children?: CascaderOption[];
|
children?: CascaderOption[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface IconProps {
|
||||||
|
size?: string;
|
||||||
|
}
|
||||||
|
|
||||||
export interface TMagicMessage {
|
export interface TMagicMessage {
|
||||||
success: (msg: string) => void;
|
success: (msg: string) => void;
|
||||||
warning: (msg: string) => void;
|
warning: (msg: string) => void;
|
||||||
@ -526,8 +531,8 @@ export interface Components {
|
|||||||
};
|
};
|
||||||
|
|
||||||
icon: {
|
icon: {
|
||||||
component: DefineComponent<{}, {}, any> | string;
|
component: DefineComponent<IconProps, {}, any> | string;
|
||||||
props: () => {};
|
props: (props: IconProps) => IconProps;
|
||||||
};
|
};
|
||||||
|
|
||||||
input: {
|
input: {
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<span>{{ title }}</span>
|
<span>{{ title }}</span>
|
||||||
</slot>
|
</slot>
|
||||||
<div>
|
<div>
|
||||||
<TMagicButton link size="small" :icon="Close" @click="closeHandler"></TMagicButton>
|
<TMagicButton link size="small" @click="closeHandler"><MIcon :icon="Close"></MIcon></TMagicButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="m-editor-float-box-body" :style="{ height: `${bodyHeight}px` }">
|
<div class="m-editor-float-box-body" :style="{ height: `${bodyHeight}px` }">
|
||||||
@ -23,6 +23,8 @@ import VanillaMoveable from 'moveable';
|
|||||||
|
|
||||||
import { TMagicButton, useZIndex } from '@tmagic/design';
|
import { TMagicButton, useZIndex } from '@tmagic/design';
|
||||||
|
|
||||||
|
import MIcon from '@editor/components/Icon.vue';
|
||||||
|
|
||||||
interface Position {
|
interface Position {
|
||||||
left: number;
|
left: number;
|
||||||
top: number;
|
top: number;
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
style="margin-left: 5px"
|
style="margin-left: 5px"
|
||||||
link
|
link
|
||||||
:type="showDataSourceFieldSelect ? 'primary' : 'default'"
|
:type="showDataSourceFieldSelect ? 'primary' : 'default'"
|
||||||
:icon="Coin"
|
|
||||||
:size="size"
|
:size="size"
|
||||||
@click="showDataSourceFieldSelect = !showDataSourceFieldSelect"
|
@click="showDataSourceFieldSelect = !showDataSourceFieldSelect"
|
||||||
|
><MIcon :icon="Coin"></MIcon
|
||||||
></TMagicButton>
|
></TMagicButton>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -36,6 +36,7 @@ import { MCascader } from '@tmagic/form';
|
|||||||
import type { DataSchema, DataSourceFieldType } from '@tmagic/schema';
|
import type { DataSchema, DataSourceFieldType } from '@tmagic/schema';
|
||||||
import { DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX } from '@tmagic/utils';
|
import { DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX } from '@tmagic/utils';
|
||||||
|
|
||||||
|
import MIcon from '@editor/components/Icon.vue';
|
||||||
import type { DataSourceFieldSelectConfig, Services } from '@editor/type';
|
import type { DataSourceFieldSelectConfig, Services } from '@editor/type';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
|
@ -29,9 +29,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</component>
|
</component>
|
||||||
<div :class="`tmagic-data-source-input-text el-input el-input--${size}`" @mouseup="mouseupHandler" v-else>
|
<div
|
||||||
|
:class="`tmagic-data-source-input-text el-input t-input t-size-${size?.[0]} el-input--${size}`"
|
||||||
|
@mouseup="mouseupHandler"
|
||||||
|
v-else
|
||||||
|
>
|
||||||
<div :class="`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused ? ' is-focus' : ''}`">
|
<div :class="`tmagic-data-source-input-text-wrapper el-input__wrapper ${isFocused ? ' is-focus' : ''}`">
|
||||||
<div class="el-input__inner">
|
<div class="el-input__inner t-input__inner">
|
||||||
<template v-for="(item, index) in displayState">
|
<template v-for="(item, index) in displayState">
|
||||||
<span :key="index" v-if="item.type === 'text'" style="margin-right: 2px">{{ item.value }}</span>
|
<span :key="index" v-if="item.type === 'text'" style="margin-right: 2px">{{ item.value }}</span>
|
||||||
<TMagicTag :key="index" :size="size" v-if="item.type === 'var'">{{ item.value }}</TMagicTag>
|
<TMagicTag :key="index" :size="size" v-if="item.type === 'var'">{{ item.value }}</TMagicTag>
|
||||||
|
@ -5,12 +5,8 @@
|
|||||||
:class="`magic-code-editor-wrapper${fullScreen ? ' full-screen' : ''}`"
|
:class="`magic-code-editor-wrapper${fullScreen ? ' full-screen' : ''}`"
|
||||||
:style="!fullScreen && height ? `height: ${height}` : '100%'"
|
:style="!fullScreen && height ? `height: ${height}` : '100%'"
|
||||||
>
|
>
|
||||||
<TMagicButton
|
<TMagicButton class="magic-code-editor-full-screen-icon" circle size="small" @click="fullScreenHandler"
|
||||||
class="magic-code-editor-full-screen-icon"
|
><MIcon :icon="FullScreen"></MIcon
|
||||||
circle
|
|
||||||
size="small"
|
|
||||||
:icon="FullScreen"
|
|
||||||
@click="fullScreenHandler"
|
|
||||||
></TMagicButton>
|
></TMagicButton>
|
||||||
<div ref="codeEditor" class="magic-code-editor-content"></div>
|
<div ref="codeEditor" class="magic-code-editor-content"></div>
|
||||||
</div>
|
</div>
|
||||||
@ -26,6 +22,7 @@ import serialize from 'serialize-javascript';
|
|||||||
|
|
||||||
import { TMagicButton } from '@tmagic/design';
|
import { TMagicButton } from '@tmagic/design';
|
||||||
|
|
||||||
|
import MIcon from '@editor/components/Icon.vue';
|
||||||
import { getConfig } from '@editor/utils/config';
|
import { getConfig } from '@editor/utils/config';
|
||||||
import monaco from '@editor/utils/monaco-editor';
|
import monaco from '@editor/utils/monaco-editor';
|
||||||
|
|
||||||
|
@ -18,10 +18,11 @@
|
|||||||
circle
|
circle
|
||||||
size="large"
|
size="large"
|
||||||
title="源码"
|
title="源码"
|
||||||
:icon="DocumentIcon"
|
|
||||||
:type="showSrc ? 'primary' : ''"
|
:type="showSrc ? 'primary' : ''"
|
||||||
@click="showSrc = !showSrc"
|
@click="showSrc = !showSrc"
|
||||||
></TMagicButton>
|
>
|
||||||
|
<MIcon :icon="DocumentIcon"></MIcon>
|
||||||
|
</TMagicButton>
|
||||||
|
|
||||||
<CodeEditor
|
<CodeEditor
|
||||||
v-if="showSrc"
|
v-if="showSrc"
|
||||||
@ -43,6 +44,7 @@ import type { FormState, FormValue } from '@tmagic/form';
|
|||||||
import { MForm } from '@tmagic/form';
|
import { MForm } from '@tmagic/form';
|
||||||
import type { MNode } from '@tmagic/schema';
|
import type { MNode } from '@tmagic/schema';
|
||||||
|
|
||||||
|
import MIcon from '@editor/components/Icon.vue';
|
||||||
import { useEditorContentHeight } from '@editor/hooks/use-editor-content-height';
|
import { useEditorContentHeight } from '@editor/hooks/use-editor-content-height';
|
||||||
import type { PropsPanelSlots, Services } from '@editor/type';
|
import type { PropsPanelSlots, Services } from '@editor/type';
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div v-if="stageOverlayVisible" class="m-editor-stage-overlay" @click="closeOverlayHandler">
|
<div v-if="stageOverlayVisible" class="m-editor-stage-overlay" @click="closeOverlayHandler">
|
||||||
<TMagicIcon class="m-editor-stage-overlay-close" :size="20" @click="closeOverlayHandler"><CloseBold /></TMagicIcon>
|
<TMagicIcon class="m-editor-stage-overlay-close" :size="'20'" @click="closeOverlayHandler"
|
||||||
|
><CloseBold
|
||||||
|
/></TMagicIcon>
|
||||||
<div ref="stageOverlay" class="m-editor-stage-overlay-container" :style="style" @click.stop></div>
|
<div ref="stageOverlay" class="m-editor-stage-overlay-container" :style="style" @click.stop></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
.m-editor-code-block-list {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.m-fields-code-select {
|
.m-fields-code-select {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
.el-card__header {
|
.el-card__header {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
.ui-component-panel {
|
.ui-component-panel {
|
||||||
&.tmagic-design-collapse {
|
&.tmagic-design-collapse {
|
||||||
height: 100%;
|
|
||||||
border-top: 0 !important;
|
border-top: 0 !important;
|
||||||
margin-top: 48px;
|
margin-top: 48px;
|
||||||
background-color: $--sidebar-content-background-color;
|
background-color: $--sidebar-content-background-color;
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
.magic-editor-icon {
|
.tmagic-design-icon {
|
||||||
|
--color: inherit;
|
||||||
|
height: 1em;
|
||||||
|
width: 1em;
|
||||||
|
position: relative;
|
||||||
|
fill: currentColor;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
.m-editor-layer-panel {
|
.m-editor-layer-panel {
|
||||||
background: $--sidebar-content-background-color;
|
background: $--sidebar-content-background-color;
|
||||||
position: relative;
|
|
||||||
|
|
||||||
.m-editor-tree {
|
.m-editor-tree {
|
||||||
padding-top: 48px;
|
padding-top: 48px;
|
||||||
|
@ -50,10 +50,6 @@
|
|||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tmagic-design-scrollbar {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fold-icon {
|
.fold-icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 8px;
|
bottom: 8px;
|
||||||
|
@ -69,6 +69,7 @@ import type {
|
|||||||
DropdownProps,
|
DropdownProps,
|
||||||
FormItemProps,
|
FormItemProps,
|
||||||
FormProps,
|
FormProps,
|
||||||
|
IconProps,
|
||||||
InputNumberProps,
|
InputNumberProps,
|
||||||
InputProps,
|
InputProps,
|
||||||
OptionGroupProps,
|
OptionGroupProps,
|
||||||
@ -200,8 +201,8 @@ const adapter: PluginOptions = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
icon: {
|
icon: {
|
||||||
component: ElIcon,
|
component: ElIcon as any,
|
||||||
props: () => ({}),
|
props: (props: IconProps) => props,
|
||||||
},
|
},
|
||||||
|
|
||||||
input: {
|
input: {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="m-fields-group-list-item">
|
<div class="m-fields-group-list-item">
|
||||||
<div>
|
<div>
|
||||||
<TMagicButton link :disabled="disabled" :icon="expand ? CaretBottom : CaretRight" @click="expandHandler">{{
|
<TMagicButton link :disabled="disabled" @click="expandHandler">
|
||||||
title
|
<TMagicIcon><CaretBottom v-if="expand" /><CaretRight v-else /></TMagicIcon>{{ title }}
|
||||||
}}</TMagicButton>
|
</TMagicButton>
|
||||||
|
|
||||||
<TMagicButton
|
<TMagicButton
|
||||||
v-show="showDelete(parseInt(String(index)))"
|
v-show="showDelete(parseInt(String(index)))"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<i style="width: 1em; height: 1em">
|
<i>
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</i>
|
</i>
|
||||||
</template>
|
</template>
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="tdesign-scrollbar" style="overflow: hidden; height: 100%">
|
<div class="tdesign-scrollbar" style="overflow: hidden; position: relative; height: 100%">
|
||||||
<div style="overflow: auto; height: 100%">
|
<div class="tdesign-scrollbar-wrap" style="overflow: auto; height: 100%">
|
||||||
<slot></slot>
|
<div class="tdesign-scrollbar-view">
|
||||||
|
<slot></slot>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -59,6 +59,7 @@ import type {
|
|||||||
DropdownProps,
|
DropdownProps,
|
||||||
FormItemProps,
|
FormItemProps,
|
||||||
FormProps,
|
FormProps,
|
||||||
|
IconProps,
|
||||||
InputNumberProps,
|
InputNumberProps,
|
||||||
InputProps,
|
InputProps,
|
||||||
OptionGroupProps,
|
OptionGroupProps,
|
||||||
@ -125,6 +126,7 @@ const adapter: any = {
|
|||||||
size: props.size === 'default' ? 'medium' : props.size,
|
size: props.size === 'default' ? 'medium' : props.size,
|
||||||
icon: () => (props.icon ? h(props.icon) : null),
|
icon: () => (props.icon ? h(props.icon) : null),
|
||||||
variant: props.link || props.text ? 'text' : 'base',
|
variant: props.link || props.text ? 'text' : 'base',
|
||||||
|
shape: props.circle ? 'circle' : 'rectangle',
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -303,7 +305,7 @@ const adapter: any = {
|
|||||||
|
|
||||||
icon: {
|
icon: {
|
||||||
component: Icon,
|
component: Icon,
|
||||||
props: () => ({}),
|
props: (props: IconProps) => props,
|
||||||
},
|
},
|
||||||
|
|
||||||
input: {
|
input: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user