@tmagic/editor 1.4.3 → 1.4.5
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 +17 -3
- package/dist/tmagic-editor.js +1309 -1208
- package/dist/tmagic-editor.umd.cjs +1327 -1224
- package/package.json +19 -24
- package/src/Editor.vue +6 -1
- package/src/editorProps.ts +3 -0
- package/src/fields/CodeSelectCol.vue +26 -18
- package/src/fields/DataSourceFieldSelect.vue +23 -61
- package/src/fields/DataSourceMethodSelect.vue +25 -31
- package/src/fields/DataSourceSelect.vue +49 -13
- package/src/fields/EventSelect.vue +37 -14
- package/src/hooks/use-editor-content-height.ts +11 -5
- package/src/layouts/PropsPanel.vue +3 -1
- package/src/layouts/sidebar/Sidebar.vue +24 -8
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +6 -1
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +6 -1
- package/src/layouts/workspace/viewer/Stage.vue +7 -6
- package/src/services/editor.ts +2 -2
- package/src/services/ui.ts +1 -0
- package/src/theme/data-source-field.scss +12 -0
- package/src/theme/props-panel.scss +1 -1
- package/src/theme/theme.scss +1 -0
- package/src/type.ts +31 -2
- package/src/utils/content-menu.ts +7 -3
- package/src/utils/data-source/index.ts +39 -3
- package/src/utils/editor.ts +14 -7
- package/types/components/CodeBlockEditor.vue.d.ts +21 -34
- package/types/components/CodeParams.vue.d.ts +2 -2
- package/types/components/ContentMenu.vue.d.ts +4 -4
- package/types/components/FloatingBox.vue.d.ts +41 -38
- package/types/components/ScrollViewer.vue.d.ts +1 -1
- package/types/components/ToolButton.vue.d.ts +6 -6
- package/types/components/Tree.vue.d.ts +2 -2
- package/types/editorProps.d.ts +3 -0
- package/types/fields/CodeLink.vue.d.ts +2 -2
- package/types/fields/DataSourceFields.vue.d.ts +32 -78
- package/types/fields/DataSourceInput.vue.d.ts +2 -2
- package/types/fields/DataSourceMethods.vue.d.ts +2 -2
- package/types/fields/DataSourceMocks.vue.d.ts +31 -76
- package/types/fields/KeyValue.vue.d.ts +2 -2
- package/types/fields/UISelect.vue.d.ts +2 -2
- package/types/hooks/use-code-block-edit.d.ts +18 -6
- package/types/hooks/use-data-source-edit.d.ts +18 -6
- package/types/hooks/use-data-source-method.d.ts +18 -6
- package/types/layouts/CodeEditor.vue.d.ts +1 -1
- package/types/layouts/PropsPanel.vue.d.ts +40 -38
- package/types/layouts/sidebar/Sidebar.vue.d.ts +7 -7
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +1 -1
- package/types/layouts/sidebar/data-source/DataSourceConfigPanel.vue.d.ts +20 -30
- package/types/layouts/sidebar/data-source/DataSourceList.vue.d.ts +1 -1
- package/types/layouts/sidebar/layer/LayerMenu.vue.d.ts +8 -8
- package/types/layouts/sidebar/layer/LayerPanel.vue.d.ts +4 -4
- package/types/layouts/sidebar/layer/use-click.d.ts +13 -13
- package/types/layouts/workspace/Workspace.vue.d.ts +4 -4
- package/types/layouts/workspace/viewer/Stage.vue.d.ts +4 -4
- package/types/layouts/workspace/viewer/ViewerMenu.vue.d.ts +8 -8
- package/types/services/dataSource.d.ts +1 -0
- package/types/services/ui.d.ts +19 -1
- package/types/type.d.ts +26 -2
- package/types/utils/data-source/index.d.ts +3 -2
package/types/type.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import type { Component } from 'vue';
|
|
3
|
+
import type EventEmitter from 'events';
|
|
2
4
|
import type { PascalCasedProperties } from 'type-fest';
|
|
3
5
|
import type { ChildConfig, ColumnConfig, FilterFunction, FormConfig, FormItem, Input } from '@tmagic/form';
|
|
4
6
|
import type { CodeBlockContent, CodeBlockDSL, DataSourceFieldType, Id, MApp, MContainer, MNode, MPage, MPageFragment } from '@tmagic/schema';
|
|
@@ -194,6 +196,8 @@ export interface UiState {
|
|
|
194
196
|
showAddPageButton: boolean;
|
|
195
197
|
/** 是否隐藏侧边栏 */
|
|
196
198
|
hideSlideBar: boolean;
|
|
199
|
+
/** 侧边栏面板配置 */
|
|
200
|
+
sideBarItems: SideComponent[];
|
|
197
201
|
navMenuRect: {
|
|
198
202
|
left: number;
|
|
199
203
|
top: number;
|
|
@@ -302,8 +306,10 @@ export interface MenuBarData {
|
|
|
302
306
|
export interface SideComponent extends MenuComponent {
|
|
303
307
|
/** 显示文案 */
|
|
304
308
|
text: string;
|
|
309
|
+
/** tab样式 */
|
|
310
|
+
tabStyle?: string | Record<string, any>;
|
|
305
311
|
/** vue组件或url */
|
|
306
|
-
icon
|
|
312
|
+
icon?: any;
|
|
307
313
|
/** slide 唯一标识 key */
|
|
308
314
|
$key: string;
|
|
309
315
|
/** 组件扩展参数 */
|
|
@@ -314,12 +320,18 @@ export interface SideComponent extends MenuComponent {
|
|
|
314
320
|
props?: Record<string, any>;
|
|
315
321
|
};
|
|
316
322
|
}
|
|
323
|
+
export declare enum SideItemKey {
|
|
324
|
+
COMPONENT_LIST = "component-list",
|
|
325
|
+
LAYER = "layer",
|
|
326
|
+
CODE_BLOCK = "code-block",
|
|
327
|
+
DATA_SOURCE = "data-source"
|
|
328
|
+
}
|
|
317
329
|
/**
|
|
318
330
|
* component-list: 组件列表
|
|
319
331
|
* layer: 已选组件树
|
|
320
332
|
* code-block: 代码块
|
|
321
333
|
*/
|
|
322
|
-
export type SideItem =
|
|
334
|
+
export type SideItem = `${SideItemKey}` | SideComponent;
|
|
323
335
|
/** 工具栏 */
|
|
324
336
|
export interface SideBarData {
|
|
325
337
|
/** 容器类型 */
|
|
@@ -524,6 +536,8 @@ export interface DataSourceSelect extends FormItem, Input {
|
|
|
524
536
|
* value: 要编译(数据源data)
|
|
525
537
|
* */
|
|
526
538
|
value?: 'id' | 'value';
|
|
539
|
+
/** 是否可以编辑数据源,disable表示的是是否可以选择数据源 */
|
|
540
|
+
notEditable?: boolean | FilterFunction;
|
|
527
541
|
}
|
|
528
542
|
export interface DataSourceMethodSelectConfig extends FormItem {
|
|
529
543
|
type: 'data-source-method-select';
|
|
@@ -541,6 +555,8 @@ export interface DataSourceFieldSelectConfig extends FormItem {
|
|
|
541
555
|
checkStrictly?: boolean;
|
|
542
556
|
dataSourceFieldType?: DataSourceFieldType[];
|
|
543
557
|
fieldConfig?: ChildConfig;
|
|
558
|
+
/** 是否可以编辑数据源,disable表示的是是否可以选择数据源 */
|
|
559
|
+
notEditable?: boolean | FilterFunction;
|
|
544
560
|
}
|
|
545
561
|
/** 可新增的数据源类型选项 */
|
|
546
562
|
export interface DatasourceTypeOption {
|
|
@@ -592,3 +608,11 @@ export type AddPrefixToObject<T, P extends string> = {
|
|
|
592
608
|
};
|
|
593
609
|
export type AsyncHookPlugin<T extends Array<string>, C extends Record<T[number], (...args: any) => any>> = AddPrefixToObject<PascalCasedProperties<AsyncBeforeHook<T, C>>, 'before'> & AddPrefixToObject<PascalCasedProperties<AsyncAfterHook<T, C>>, 'after'>;
|
|
594
610
|
export type SyncHookPlugin<T extends Array<string>, C extends Record<T[number], (...args: any) => any>> = AddPrefixToObject<PascalCasedProperties<SyncBeforeHook<T, C>>, 'before'> & AddPrefixToObject<PascalCasedProperties<SyncAfterHook<T, C>>, 'after'>;
|
|
611
|
+
export interface EventBusEvent {
|
|
612
|
+
'edit-data-source': [id: string];
|
|
613
|
+
'edit-code': [id: string];
|
|
614
|
+
}
|
|
615
|
+
export interface EventBus extends EventEmitter {
|
|
616
|
+
on<Name extends keyof EventBusEvent, Param extends EventBusEvent[Name]>(eventName: Name, listener: (...args: Param) => void): this;
|
|
617
|
+
emit<Name extends keyof EventBusEvent, Param extends EventBusEvent[Name]>(eventName: Name, ...args: Param): boolean;
|
|
618
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { FormConfig } from '@tmagic/form';
|
|
2
|
-
import { DataSourceSchema } from '@tmagic/schema';
|
|
1
|
+
import { CascaderOption, FormConfig } from '@tmagic/form';
|
|
2
|
+
import { DataSchema, DataSourceFieldType, DataSourceSchema } from '@tmagic/schema';
|
|
3
3
|
export declare const getFormConfig: (type: string, configs: Record<string, FormConfig>) => FormConfig;
|
|
4
4
|
export declare const getFormValue: (type: string, values: Partial<DataSourceSchema>) => Partial<DataSourceSchema>;
|
|
5
5
|
export declare const getDisplayField: (dataSources: DataSourceSchema[], key: string) => {
|
|
6
6
|
value: string;
|
|
7
7
|
type: 'var' | 'text';
|
|
8
8
|
}[];
|
|
9
|
+
export declare const getCascaderOptionsFromFields: (fields?: DataSchema[], dataSourceFieldType?: DataSourceFieldType[]) => CascaderOption[];
|