mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-11-30 22:42:09 +08:00
feat(design, element-plus-adapter, tdesign-vue-next-adapter): 添加adapterType, 完善tdesign useZIndex
This commit is contained in:
parent
cbec52936d
commit
12e6dd18b4
@ -712,6 +712,7 @@ export interface Components {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface DesignPluginOptions {
|
export interface DesignPluginOptions {
|
||||||
|
adapterType?: string;
|
||||||
message?: TMagicMessage;
|
message?: TMagicMessage;
|
||||||
messageBox?: TMagicMessageBox;
|
messageBox?: TMagicMessageBox;
|
||||||
components?: Components;
|
components?: Components;
|
||||||
|
|||||||
@ -94,6 +94,7 @@ import FormItem from './FormItem.vue';
|
|||||||
import Table from './Table.vue';
|
import Table from './Table.vue';
|
||||||
|
|
||||||
const adapter: DesignPluginOptions = {
|
const adapter: DesignPluginOptions = {
|
||||||
|
adapterType: 'element-plus',
|
||||||
useZIndex,
|
useZIndex,
|
||||||
message: ElMessage,
|
message: ElMessage,
|
||||||
messageBox: ElMessageBox,
|
messageBox: ElMessageBox,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { h } from 'vue';
|
import { computed, h, Ref, ref, unref } from 'vue';
|
||||||
import {
|
import {
|
||||||
Badge as TBadge,
|
Badge as TBadge,
|
||||||
Button as TButton,
|
Button as TButton,
|
||||||
@ -104,7 +104,31 @@ messageBox.error = MessagePlugin.error;
|
|||||||
messageBox.warning = MessagePlugin.warning;
|
messageBox.warning = MessagePlugin.warning;
|
||||||
messageBox.info = MessagePlugin.info;
|
messageBox.info = MessagePlugin.info;
|
||||||
|
|
||||||
|
const zIndex = ref(0);
|
||||||
|
const DEFAULT_INITIAL_Z_INDEX = 2500;
|
||||||
|
|
||||||
|
const useZIndex = (zIndexOverrides?: Ref<number>) => {
|
||||||
|
const zIndexInjection = zIndexOverrides;
|
||||||
|
const initialZIndex = computed(() => {
|
||||||
|
const zIndexFromInjection = unref(zIndexInjection);
|
||||||
|
return zIndexFromInjection ?? DEFAULT_INITIAL_Z_INDEX;
|
||||||
|
});
|
||||||
|
const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
|
||||||
|
|
||||||
|
const nextZIndex = () => {
|
||||||
|
zIndex.value += 1;
|
||||||
|
return currentZIndex.value;
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
initialZIndex,
|
||||||
|
currentZIndex,
|
||||||
|
nextZIndex,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const adapter: any = {
|
const adapter: any = {
|
||||||
|
adapterType: 'tdesign-vue-next',
|
||||||
message: messageBox,
|
message: messageBox,
|
||||||
messageBox: {
|
messageBox: {
|
||||||
alert: (msg: string, title?: string) => {
|
alert: (msg: string, title?: string) => {
|
||||||
@ -502,6 +526,7 @@ const adapter: any = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
loading: LoadingDirective,
|
loading: LoadingDirective,
|
||||||
|
useZIndex,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default adapter;
|
export default adapter;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user