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