@tmagic/editor 1.4.0-beta.1 → 1.4.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +14 -6
- package/dist/tmagic-editor.js +259 -167
- package/dist/tmagic-editor.umd.cjs +258 -164
- package/package.json +11 -11
- package/src/components/CodeBlockEditor.vue +43 -46
- package/src/components/FloatingBox.vue +38 -33
- package/src/components/SplitView.vue +46 -35
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use-code-block-edit.ts +1 -1
- package/src/hooks/use-editor-content-height.ts +20 -0
- package/src/hooks/use-float-box.ts +8 -8
- package/src/hooks/use-window-rect.ts +20 -0
- package/src/layouts/Framework.vue +33 -34
- package/src/layouts/PropsPanel.vue +35 -0
- package/src/layouts/sidebar/Sidebar.vue +13 -8
- package/src/layouts/workspace/viewer/NodeListMenu.vue +1 -0
- package/src/services/stageOverlay.ts +2 -2
- package/src/services/ui.ts +6 -0
- package/src/theme/code-block.scss +0 -5
- package/src/theme/floating-box.scss +2 -2
- package/src/theme/props-panel.scss +14 -0
- package/src/type.ts +6 -0
- package/types/components/CodeBlockEditor.vue.d.ts +45 -24
- package/types/components/FloatingBox.vue.d.ts +42 -57
- package/types/components/SplitView.vue.d.ts +2 -0
- package/types/hooks/index.d.ts +2 -0
- package/types/hooks/use-code-block-edit.d.ts +16 -2
- package/types/hooks/use-data-source-method.d.ts +16 -2
- package/types/hooks/use-editor-content-height.d.ts +3 -0
- package/types/hooks/use-window-rect.d.ts +6 -0
- package/types/layouts/sidebar/Sidebar.vue.d.ts +1 -1
- package/types/services/stageOverlay.d.ts +1 -1
- package/types/services/ui.d.ts +6 -0
- package/types/type.d.ts +6 -0
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
:min-left="65"
|
|
25
25
|
:min-right="20"
|
|
26
26
|
:min-center="100"
|
|
27
|
+
:width="frameworkRect?.width || 0"
|
|
27
28
|
@change="columnWidthChange"
|
|
28
29
|
>
|
|
29
30
|
<template #left>
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
</template>
|
|
58
59
|
|
|
59
60
|
<script lang="ts" setup>
|
|
60
|
-
import { computed, inject, ref, watch } from 'vue';
|
|
61
|
+
import { computed, inject, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
|
61
62
|
|
|
62
63
|
import { TMagicScrollbar } from '@tmagic/design';
|
|
63
64
|
|
|
@@ -101,40 +102,15 @@ const RIGHT_COLUMN_WIDTH_STORAGE_KEY = '$MagicEditorRightColumnWidthData';
|
|
|
101
102
|
const getLeftColumnWidthCacheData = () =>
|
|
102
103
|
Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_LEFT_COLUMN_WIDTH;
|
|
103
104
|
|
|
104
|
-
const leftColumnWidthCacheData = getLeftColumnWidthCacheData();
|
|
105
|
-
const RightColumnWidthCacheData =
|
|
106
|
-
Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_RIGHT_COLUMN_WIDTH;
|
|
107
|
-
|
|
108
105
|
const columnWidth = ref<Partial<GetColumnWidth>>({
|
|
109
|
-
left:
|
|
106
|
+
left: getLeftColumnWidthCacheData(),
|
|
110
107
|
center: 0,
|
|
111
|
-
right:
|
|
108
|
+
right: Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY)) || DEFAULT_RIGHT_COLUMN_WIDTH,
|
|
112
109
|
});
|
|
113
110
|
|
|
114
|
-
watch(
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
splitView.value?.updateWidth();
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
immediate: true,
|
|
121
|
-
},
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
watch(
|
|
125
|
-
() => columnWidth.value.right,
|
|
126
|
-
(right) => {
|
|
127
|
-
if (typeof right === 'undefined') return;
|
|
128
|
-
globalThis.localStorage.setItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY, `${right}`);
|
|
129
|
-
},
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
watch(
|
|
133
|
-
() => columnWidth.value.left,
|
|
134
|
-
(left) => {
|
|
135
|
-
globalThis.localStorage.setItem(LEFT_COLUMN_WIDTH_STORAGE_KEY, `${left}`);
|
|
136
|
-
},
|
|
137
|
-
);
|
|
111
|
+
watch(pageLength, () => {
|
|
112
|
+
splitView.value?.updateWidth();
|
|
113
|
+
});
|
|
138
114
|
|
|
139
115
|
watch(
|
|
140
116
|
() => uiService?.get('hideSlideBar'),
|
|
@@ -144,12 +120,35 @@ watch(
|
|
|
144
120
|
);
|
|
145
121
|
|
|
146
122
|
const columnWidthChange = (columnW: GetColumnWidth) => {
|
|
147
|
-
columnWidth.value
|
|
148
|
-
|
|
149
|
-
|
|
123
|
+
columnWidth.value = columnW;
|
|
124
|
+
|
|
125
|
+
globalThis.localStorage.setItem(LEFT_COLUMN_WIDTH_STORAGE_KEY, `${columnW.left}`);
|
|
126
|
+
globalThis.localStorage.setItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY, `${columnW.right}`);
|
|
150
127
|
uiService?.set('columnWidth', columnW);
|
|
151
128
|
};
|
|
152
129
|
|
|
130
|
+
const frameworkRect = computed(() => uiService?.get('frameworkRect'));
|
|
131
|
+
|
|
132
|
+
const resizerObserver = new ResizeObserver((entries) => {
|
|
133
|
+
const { contentRect } = entries[0];
|
|
134
|
+
uiService?.set('frameworkRect', {
|
|
135
|
+
width: contentRect.width,
|
|
136
|
+
height: contentRect.height,
|
|
137
|
+
left: contentRect.left,
|
|
138
|
+
top: contentRect.top,
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
onMounted(() => {
|
|
143
|
+
if (content.value) {
|
|
144
|
+
resizerObserver.observe(content.value);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
onBeforeUnmount(() => {
|
|
149
|
+
resizerObserver.disconnect();
|
|
150
|
+
});
|
|
151
|
+
|
|
153
152
|
const saveCode = (value: string) => {
|
|
154
153
|
try {
|
|
155
154
|
const parseDSL = getConfig('parseDSL');
|
|
@@ -12,17 +12,42 @@
|
|
|
12
12
|
@change="submit"
|
|
13
13
|
@error="errorHandler"
|
|
14
14
|
></MForm>
|
|
15
|
+
|
|
16
|
+
<TMagicButton
|
|
17
|
+
class="m-editor-props-panel-src-icon"
|
|
18
|
+
circle
|
|
19
|
+
size="large"
|
|
20
|
+
title="源码"
|
|
21
|
+
:icon="DocumentIcon"
|
|
22
|
+
:type="showSrc ? 'primary' : ''"
|
|
23
|
+
@click="showSrc = !showSrc"
|
|
24
|
+
></TMagicButton>
|
|
25
|
+
|
|
26
|
+
<CodeEditor
|
|
27
|
+
v-if="showSrc"
|
|
28
|
+
:height="`${editorContentHeight}px`"
|
|
29
|
+
:init-values="values"
|
|
30
|
+
:options="codeOptions"
|
|
31
|
+
:parse="true"
|
|
32
|
+
@save="saveCode"
|
|
33
|
+
></CodeEditor>
|
|
15
34
|
</div>
|
|
16
35
|
</template>
|
|
17
36
|
|
|
18
37
|
<script lang="ts" setup>
|
|
19
38
|
import { computed, getCurrentInstance, inject, onBeforeUnmount, onMounted, ref, watchEffect } from 'vue';
|
|
39
|
+
import { Document as DocumentIcon } from '@element-plus/icons-vue';
|
|
20
40
|
|
|
41
|
+
import { TMagicButton } from '@tmagic/design';
|
|
21
42
|
import type { FormState, FormValue } from '@tmagic/form';
|
|
22
43
|
import { MForm } from '@tmagic/form';
|
|
44
|
+
import type { MNode } from '@tmagic/schema';
|
|
23
45
|
|
|
46
|
+
import { useEditorContentHeight } from '@editor/hooks/use-editor-content-height';
|
|
24
47
|
import type { PropsPanelSlots, Services } from '@editor/type';
|
|
25
48
|
|
|
49
|
+
import CodeEditor from './CodeEditor.vue';
|
|
50
|
+
|
|
26
51
|
defineSlots<PropsPanelSlots>();
|
|
27
52
|
|
|
28
53
|
defineOptions({
|
|
@@ -33,8 +58,12 @@ defineProps<{
|
|
|
33
58
|
extendState?: (state: FormState) => Record<string, any> | Promise<Record<string, any>>;
|
|
34
59
|
}>();
|
|
35
60
|
|
|
61
|
+
const codeOptions = inject('codeOptions', {});
|
|
62
|
+
|
|
36
63
|
const emit = defineEmits(['mounted', 'submit-error', 'form-error']);
|
|
37
64
|
|
|
65
|
+
const showSrc = ref(false);
|
|
66
|
+
|
|
38
67
|
const internalInstance = getCurrentInstance();
|
|
39
68
|
const values = ref<FormValue>({});
|
|
40
69
|
const configForm = ref<InstanceType<typeof MForm>>();
|
|
@@ -46,6 +75,8 @@ const nodes = computed(() => services?.editorService.get('nodes') || []);
|
|
|
46
75
|
const propsPanelSize = computed(() => services?.uiService.get('propsPanelSize') || 'small');
|
|
47
76
|
const stage = computed(() => services?.editorService.get('stage'));
|
|
48
77
|
|
|
78
|
+
const { height: editorContentHeight } = useEditorContentHeight();
|
|
79
|
+
|
|
49
80
|
const init = async () => {
|
|
50
81
|
if (!node.value) {
|
|
51
82
|
curFormConfig.value = [];
|
|
@@ -87,5 +118,9 @@ const errorHandler = (e: any) => {
|
|
|
87
118
|
emit('form-error', e);
|
|
88
119
|
};
|
|
89
120
|
|
|
121
|
+
const saveCode = (values: MNode) => {
|
|
122
|
+
services?.editorService.update(values);
|
|
123
|
+
};
|
|
124
|
+
|
|
90
125
|
defineExpose({ configForm, submit });
|
|
91
126
|
</script>
|
|
@@ -111,6 +111,8 @@
|
|
|
111
111
|
:key="config.$key ?? index"
|
|
112
112
|
v-if="floatBoxStates[config.$key]?.status"
|
|
113
113
|
v-model:visible="floatBoxStates[config.$key].status"
|
|
114
|
+
:width="columnLeftWitch"
|
|
115
|
+
:height="600"
|
|
114
116
|
:title="config.text"
|
|
115
117
|
:position="{
|
|
116
118
|
left: floatBoxStates[config.$key].left,
|
|
@@ -139,14 +141,15 @@ import { Coin, EditPen, Goods, List } from '@element-plus/icons-vue';
|
|
|
139
141
|
import FloatingBox from '@editor/components/FloatingBox.vue';
|
|
140
142
|
import MIcon from '@editor/components/Icon.vue';
|
|
141
143
|
import { useFloatBox } from '@editor/hooks/use-float-box';
|
|
142
|
-
import
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
144
|
+
import {
|
|
145
|
+
ColumnLayout,
|
|
146
|
+
type MenuButton,
|
|
147
|
+
type MenuComponent,
|
|
148
|
+
type Services,
|
|
149
|
+
type SideBarData,
|
|
150
|
+
type SidebarSlots,
|
|
151
|
+
type SideComponent,
|
|
152
|
+
type SideItem,
|
|
150
153
|
} from '@editor/type';
|
|
151
154
|
|
|
152
155
|
import CodeBlockListPanel from './code-block/CodeBlockListPanel.vue';
|
|
@@ -173,6 +176,8 @@ const props = withDefaults(
|
|
|
173
176
|
|
|
174
177
|
const services = inject<Services>('services');
|
|
175
178
|
|
|
179
|
+
const columnLeftWitch = computed(() => services?.uiService.get('columnWidth')[ColumnLayout.LEFT] || 0);
|
|
180
|
+
|
|
176
181
|
const activeTabName = ref(props.data?.status);
|
|
177
182
|
|
|
178
183
|
const getItemConfig = (data: SideItem): SideComponent => {
|
|
@@ -41,7 +41,7 @@ class StageOverlay extends BaseService {
|
|
|
41
41
|
this.state[name] = value;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
public openOverlay(el: HTMLElement |
|
|
44
|
+
public openOverlay(el: HTMLElement | null) {
|
|
45
45
|
const stageOptions = this.get('stageOptions');
|
|
46
46
|
if (!el || !stageOptions) return;
|
|
47
47
|
|
|
@@ -168,7 +168,7 @@ class StageOverlay extends BaseService {
|
|
|
168
168
|
});
|
|
169
169
|
|
|
170
170
|
if (await stageOptions?.canSelect?.(contentEl)) {
|
|
171
|
-
subStage?.select(contentEl);
|
|
171
|
+
subStage?.select(contentEl.id);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
package/src/services/ui.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
.m-editor-props-panel {
|
|
2
2
|
padding: 0 10px;
|
|
3
3
|
|
|
4
|
+
.m-editor-props-panel-src-icon {
|
|
5
|
+
position: absolute;
|
|
6
|
+
right: 15px;
|
|
7
|
+
bottom: 15px;
|
|
8
|
+
z-index: 30;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.magic-code-editor {
|
|
12
|
+
position: absolute;
|
|
13
|
+
left: 0;
|
|
14
|
+
top: 0;
|
|
15
|
+
z-index: 10;
|
|
16
|
+
}
|
|
17
|
+
|
|
4
18
|
&.small {
|
|
5
19
|
.el-form-item__label {
|
|
6
20
|
font-size: 12px;
|
package/src/type.ts
CHANGED
|
@@ -1,32 +1,53 @@
|
|
|
1
1
|
import type { CodeBlockContent } from '@tmagic/schema';
|
|
2
2
|
import type { SlideType } from '../type';
|
|
3
|
-
declare const _default: import("vue").DefineComponent<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
3
|
+
declare const _default: import("vue").DefineComponent<{
|
|
4
|
+
width: import("vue").PropType<number>;
|
|
5
|
+
visible: import("vue").PropType<boolean>;
|
|
6
|
+
content: {
|
|
7
|
+
type: import("vue").PropType<CodeBlockContent>;
|
|
8
|
+
required: true;
|
|
9
|
+
};
|
|
10
|
+
disabled: {
|
|
11
|
+
type: import("vue").PropType<boolean>;
|
|
12
|
+
};
|
|
13
|
+
isDataSource: {
|
|
14
|
+
type: import("vue").PropType<boolean>;
|
|
15
|
+
};
|
|
16
|
+
dataSourceType: {
|
|
17
|
+
type: import("vue").PropType<string>;
|
|
18
|
+
};
|
|
19
|
+
slideType: {
|
|
20
|
+
type: import("vue").PropType<SlideType>;
|
|
21
|
+
};
|
|
22
|
+
}, {
|
|
10
23
|
show(): Promise<void>;
|
|
11
|
-
hide(): void
|
|
24
|
+
hide(): Promise<void>;
|
|
12
25
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
26
|
+
"update:width": (width: number) => void;
|
|
27
|
+
"update:visible": (visible: boolean) => void;
|
|
13
28
|
submit: (values: CodeBlockContent) => void;
|
|
14
|
-
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
29
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
30
|
+
width: import("vue").PropType<number>;
|
|
31
|
+
visible: import("vue").PropType<boolean>;
|
|
32
|
+
content: {
|
|
33
|
+
type: import("vue").PropType<CodeBlockContent>;
|
|
34
|
+
required: true;
|
|
35
|
+
};
|
|
36
|
+
disabled: {
|
|
37
|
+
type: import("vue").PropType<boolean>;
|
|
38
|
+
};
|
|
39
|
+
isDataSource: {
|
|
40
|
+
type: import("vue").PropType<boolean>;
|
|
41
|
+
};
|
|
42
|
+
dataSourceType: {
|
|
43
|
+
type: import("vue").PropType<string>;
|
|
44
|
+
};
|
|
45
|
+
slideType: {
|
|
46
|
+
type: import("vue").PropType<SlideType>;
|
|
47
|
+
};
|
|
48
|
+
}>> & {
|
|
21
49
|
onSubmit?: ((values: CodeBlockContent) => any) | undefined;
|
|
50
|
+
"onUpdate:width"?: ((width: number) => any) | undefined;
|
|
51
|
+
"onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
22
52
|
}, {}, {}>;
|
|
23
53
|
export default _default;
|
|
24
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
25
|
-
type __VLS_TypePropsToOption<T> = {
|
|
26
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
27
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
28
|
-
} : {
|
|
29
|
-
type: import('vue').PropType<T[K]>;
|
|
30
|
-
required: true;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
@@ -2,79 +2,64 @@ interface Position {
|
|
|
2
2
|
left: number;
|
|
3
3
|
top: number;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
width: number
|
|
7
|
-
height: number
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
left: number;
|
|
20
|
-
top: number;
|
|
5
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
6
|
+
width: import("vue").PropType<number>;
|
|
7
|
+
height: import("vue").PropType<number>;
|
|
8
|
+
visible: import("vue").PropType<boolean>;
|
|
9
|
+
title: {
|
|
10
|
+
type: import("vue").PropType<string>;
|
|
11
|
+
default: string;
|
|
12
|
+
};
|
|
13
|
+
position: {
|
|
14
|
+
type: import("vue").PropType<Position>;
|
|
15
|
+
default: () => {
|
|
16
|
+
left: number;
|
|
17
|
+
top: number;
|
|
18
|
+
};
|
|
21
19
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
height: string;
|
|
20
|
+
beforeClose: {
|
|
21
|
+
type: import("vue").PropType<(done: (cancel?: boolean | undefined) => void) => void>;
|
|
25
22
|
};
|
|
26
|
-
}
|
|
23
|
+
}, {
|
|
24
|
+
bodyHeight: import("vue").ComputedRef<number | "auto">;
|
|
27
25
|
target: import("vue").Ref<HTMLDivElement | undefined>;
|
|
26
|
+
titleEl: import("vue").Ref<HTMLDivElement | undefined>;
|
|
28
27
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
29
|
-
"update:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
position: () => {
|
|
40
|
-
left: number;
|
|
41
|
-
top: number;
|
|
28
|
+
"update:width": (width: number) => void;
|
|
29
|
+
"update:visible": (visible: boolean) => void;
|
|
30
|
+
"update:height": (height: number) => void;
|
|
31
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
32
|
+
width: import("vue").PropType<number>;
|
|
33
|
+
height: import("vue").PropType<number>;
|
|
34
|
+
visible: import("vue").PropType<boolean>;
|
|
35
|
+
title: {
|
|
36
|
+
type: import("vue").PropType<string>;
|
|
37
|
+
default: string;
|
|
42
38
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
position: {
|
|
40
|
+
type: import("vue").PropType<Position>;
|
|
41
|
+
default: () => {
|
|
42
|
+
left: number;
|
|
43
|
+
top: number;
|
|
44
|
+
};
|
|
46
45
|
};
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
beforeClose: {
|
|
47
|
+
type: import("vue").PropType<(done: (cancel?: boolean | undefined) => void) => void>;
|
|
48
|
+
};
|
|
49
|
+
}>> & {
|
|
50
|
+
"onUpdate:width"?: ((width: number) => any) | undefined;
|
|
51
|
+
"onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
52
|
+
"onUpdate:height"?: ((height: number) => any) | undefined;
|
|
49
53
|
}, {
|
|
50
54
|
title: string;
|
|
51
55
|
position: Position;
|
|
52
|
-
visible: boolean;
|
|
53
|
-
rect: Rect;
|
|
54
56
|
}, {}>, {
|
|
55
57
|
title?(_: {}): any;
|
|
56
58
|
body?(_: {}): any;
|
|
57
59
|
}>;
|
|
58
60
|
export default _default;
|
|
59
|
-
type __VLS_WithDefaults<P, D> = {
|
|
60
|
-
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
61
|
-
default: D[K];
|
|
62
|
-
}> : P[K];
|
|
63
|
-
};
|
|
64
|
-
type __VLS_Prettify<T> = {
|
|
65
|
-
[K in keyof T]: T[K];
|
|
66
|
-
} & {};
|
|
67
61
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
68
62
|
new (): {
|
|
69
63
|
$slots: S;
|
|
70
64
|
};
|
|
71
65
|
};
|
|
72
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
73
|
-
type __VLS_TypePropsToOption<T> = {
|
|
74
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
75
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
76
|
-
} : {
|
|
77
|
-
type: import('vue').PropType<T[K]>;
|
|
78
|
-
required: true;
|
|
79
|
-
};
|
|
80
|
-
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<{
|
|
2
|
+
width?: number | undefined;
|
|
2
3
|
left?: number | undefined;
|
|
3
4
|
right?: number | undefined;
|
|
4
5
|
minLeft?: number | undefined;
|
|
@@ -18,6 +19,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
18
19
|
"update:left": (...args: any[]) => void;
|
|
19
20
|
"update:right": (...args: any[]) => void;
|
|
20
21
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
|
|
22
|
+
width?: number | undefined;
|
|
21
23
|
left?: number | undefined;
|
|
22
24
|
right?: number | undefined;
|
|
23
25
|
minLeft?: number | undefined;
|
package/types/hooks/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export declare const useCodeBlockEdit: (codeBlockService?: CodeBlockService) =>
|
|
|
4
4
|
codeId: import("vue").Ref<string | undefined>;
|
|
5
5
|
codeConfig: import("vue").Ref<CodeBlockContent | undefined>;
|
|
6
6
|
codeBlockEditor: import("vue").Ref<import("vue").CreateComponentPublicInstance<Readonly<import("vue").ExtractPropTypes<{
|
|
7
|
+
width: import("vue").PropType<number>;
|
|
8
|
+
visible: import("vue").PropType<boolean>;
|
|
7
9
|
content: {
|
|
8
10
|
type: import("vue").PropType<CodeBlockContent>;
|
|
9
11
|
required: true;
|
|
@@ -22,12 +24,18 @@ export declare const useCodeBlockEdit: (codeBlockService?: CodeBlockService) =>
|
|
|
22
24
|
};
|
|
23
25
|
}>> & {
|
|
24
26
|
onSubmit?: ((values: CodeBlockContent) => any) | undefined;
|
|
27
|
+
"onUpdate:width"?: ((width: number) => any) | undefined;
|
|
28
|
+
"onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
25
29
|
}, {
|
|
26
30
|
show(): Promise<void>;
|
|
27
|
-
hide(): void
|
|
31
|
+
hide(): Promise<void>;
|
|
28
32
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
33
|
+
"update:width": (width: number) => void;
|
|
34
|
+
"update:visible": (visible: boolean) => void;
|
|
29
35
|
submit: (values: CodeBlockContent) => void;
|
|
30
36
|
}, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
|
|
37
|
+
width: import("vue").PropType<number>;
|
|
38
|
+
visible: import("vue").PropType<boolean>;
|
|
31
39
|
content: {
|
|
32
40
|
type: import("vue").PropType<CodeBlockContent>;
|
|
33
41
|
required: true;
|
|
@@ -46,6 +54,8 @@ export declare const useCodeBlockEdit: (codeBlockService?: CodeBlockService) =>
|
|
|
46
54
|
};
|
|
47
55
|
}>> & {
|
|
48
56
|
onSubmit?: ((values: CodeBlockContent) => any) | undefined;
|
|
57
|
+
"onUpdate:width"?: ((width: number) => any) | undefined;
|
|
58
|
+
"onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
49
59
|
}, {}, true, {}, {}, {
|
|
50
60
|
P: {};
|
|
51
61
|
B: {};
|
|
@@ -54,6 +64,8 @@ export declare const useCodeBlockEdit: (codeBlockService?: CodeBlockService) =>
|
|
|
54
64
|
M: {};
|
|
55
65
|
Defaults: {};
|
|
56
66
|
}, Readonly<import("vue").ExtractPropTypes<{
|
|
67
|
+
width: import("vue").PropType<number>;
|
|
68
|
+
visible: import("vue").PropType<boolean>;
|
|
57
69
|
content: {
|
|
58
70
|
type: import("vue").PropType<CodeBlockContent>;
|
|
59
71
|
required: true;
|
|
@@ -72,9 +84,11 @@ export declare const useCodeBlockEdit: (codeBlockService?: CodeBlockService) =>
|
|
|
72
84
|
};
|
|
73
85
|
}>> & {
|
|
74
86
|
onSubmit?: ((values: CodeBlockContent) => any) | undefined;
|
|
87
|
+
"onUpdate:width"?: ((width: number) => any) | undefined;
|
|
88
|
+
"onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
75
89
|
}, {
|
|
76
90
|
show(): Promise<void>;
|
|
77
|
-
hide(): void
|
|
91
|
+
hide(): Promise<void>;
|
|
78
92
|
}, {}, {}, {}, {}> | undefined>;
|
|
79
93
|
createCodeBlock: () => Promise<void>;
|
|
80
94
|
editCode: (id: string) => Promise<void>;
|
|
@@ -2,6 +2,8 @@ import type { CodeBlockContent, DataSourceSchema } from '@tmagic/schema';
|
|
|
2
2
|
export declare const useDataSourceMethod: () => {
|
|
3
3
|
codeConfig: import("vue").Ref<CodeBlockContent | undefined>;
|
|
4
4
|
codeBlockEditor: import("vue").Ref<import("vue").CreateComponentPublicInstance<Readonly<import("vue").ExtractPropTypes<{
|
|
5
|
+
width: import("vue").PropType<number>;
|
|
6
|
+
visible: import("vue").PropType<boolean>;
|
|
5
7
|
content: {
|
|
6
8
|
type: import("vue").PropType<CodeBlockContent>;
|
|
7
9
|
required: true;
|
|
@@ -20,12 +22,18 @@ export declare const useDataSourceMethod: () => {
|
|
|
20
22
|
};
|
|
21
23
|
}>> & {
|
|
22
24
|
onSubmit?: ((values: CodeBlockContent) => any) | undefined;
|
|
25
|
+
"onUpdate:width"?: ((width: number) => any) | undefined;
|
|
26
|
+
"onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
23
27
|
}, {
|
|
24
28
|
show(): Promise<void>;
|
|
25
|
-
hide(): void
|
|
29
|
+
hide(): Promise<void>;
|
|
26
30
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
31
|
+
"update:width": (width: number) => void;
|
|
32
|
+
"update:visible": (visible: boolean) => void;
|
|
27
33
|
submit: (values: CodeBlockContent) => void;
|
|
28
34
|
}, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
|
|
35
|
+
width: import("vue").PropType<number>;
|
|
36
|
+
visible: import("vue").PropType<boolean>;
|
|
29
37
|
content: {
|
|
30
38
|
type: import("vue").PropType<CodeBlockContent>;
|
|
31
39
|
required: true;
|
|
@@ -44,6 +52,8 @@ export declare const useDataSourceMethod: () => {
|
|
|
44
52
|
};
|
|
45
53
|
}>> & {
|
|
46
54
|
onSubmit?: ((values: CodeBlockContent) => any) | undefined;
|
|
55
|
+
"onUpdate:width"?: ((width: number) => any) | undefined;
|
|
56
|
+
"onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
47
57
|
}, {}, true, {}, {}, {
|
|
48
58
|
P: {};
|
|
49
59
|
B: {};
|
|
@@ -52,6 +62,8 @@ export declare const useDataSourceMethod: () => {
|
|
|
52
62
|
M: {};
|
|
53
63
|
Defaults: {};
|
|
54
64
|
}, Readonly<import("vue").ExtractPropTypes<{
|
|
65
|
+
width: import("vue").PropType<number>;
|
|
66
|
+
visible: import("vue").PropType<boolean>;
|
|
55
67
|
content: {
|
|
56
68
|
type: import("vue").PropType<CodeBlockContent>;
|
|
57
69
|
required: true;
|
|
@@ -70,9 +82,11 @@ export declare const useDataSourceMethod: () => {
|
|
|
70
82
|
};
|
|
71
83
|
}>> & {
|
|
72
84
|
onSubmit?: ((values: CodeBlockContent) => any) | undefined;
|
|
85
|
+
"onUpdate:width"?: ((width: number) => any) | undefined;
|
|
86
|
+
"onUpdate:visible"?: ((visible: boolean) => any) | undefined;
|
|
73
87
|
}, {
|
|
74
88
|
show(): Promise<void>;
|
|
75
|
-
hide(): void
|
|
89
|
+
hide(): Promise<void>;
|
|
76
90
|
}, {}, {}, {}, {}> | undefined>;
|
|
77
91
|
createCode: (model: DataSourceSchema) => Promise<void>;
|
|
78
92
|
editCode: (model: DataSourceSchema, methodName: string) => Promise<void>;
|