@maxax/x-builder-designer 1.0.0

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.
@@ -0,0 +1,1908 @@
1
+ import { CSSProperties, Component, VNode, DefineComponent } from 'vue';
2
+ import * as mitt from 'mitt';
3
+ import { Recordable } from '@maxax/types';
4
+
5
+ /**
6
+ * 拖拽数据
7
+ */
8
+ interface DragBoxData {
9
+ event: DragEvent;
10
+ item: MaterialDescription;
11
+ }
12
+ /**
13
+ * 设计器元素
14
+ */
15
+ interface DesignerElement extends Element {
16
+ 'data-max-id'?: string;
17
+ }
18
+
19
+ /**
20
+ * 节点放置位置
21
+ */
22
+ type DropPosition = 'left' | 'right' | 'top' | 'bottom' | 'inner';
23
+ /**
24
+ * 设计器辅助样式
25
+ */
26
+ interface DesignerHelper {
27
+ /**
28
+ * 模型
29
+ */
30
+ model: NodeModel | BlockModel;
31
+ /**
32
+ * 元素
33
+ */
34
+ el: HTMLElement | Element;
35
+ /**
36
+ * 元素位置
37
+ */
38
+ rect: DOMRect;
39
+ /**
40
+ * 放置类型
41
+ */
42
+ type?: DropPosition;
43
+ /**
44
+ * 元素路径
45
+ */
46
+ path?: Array<NodeModel | BlockModel>;
47
+ }
48
+ /**
49
+ * 当前辅助样式
50
+ */
51
+ interface CurrentDesignerHelper extends DesignerHelper {
52
+ /**
53
+ * 样式对象
54
+ */
55
+ style: CSSProperties;
56
+ /**
57
+ * 元素位置
58
+ */
59
+ position?: string;
60
+ }
61
+ interface DesignerRect {
62
+ left: number;
63
+ top: number;
64
+ width: number;
65
+ height: number;
66
+ }
67
+
68
+ /**
69
+ * 区域类型
70
+ */
71
+ declare enum RegionType {
72
+ Brand = "Brand",
73
+ Toolbar = "Toolbar",
74
+ Actions = "Actions",
75
+ Apps = "Apps",
76
+ Config = "Config",
77
+ Workspace = "Workspace",
78
+ Settings = "Settings",
79
+ Status = "Status",
80
+ Preview = "Preview"
81
+ }
82
+
83
+ interface ApiConfig {
84
+ id: number;
85
+ requestMethod: string;
86
+ apiUrl: string;
87
+ apiDescription?: string;
88
+ requestParams?: string;
89
+ responseParams?: string;
90
+ requestParamsJava?: string;
91
+ responseParamsJava?: string;
92
+ moduleCode?: string;
93
+ requestName?: string;
94
+ projectId: string;
95
+ moduleId: string;
96
+ relatedApiId?: number;
97
+ version?: string;
98
+ tags?: string[];
99
+ author?: string;
100
+ createTime?: Date;
101
+ updateTime?: Date;
102
+ }
103
+
104
+ /**
105
+ * 数据源类型,目前仅实现api类型
106
+ */
107
+ type DataSourceType = 'api' | 'cube' | 'meta' | 'mock';
108
+ /**
109
+ * 请求方法
110
+ */
111
+ type ApiMethod = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'jsonp';
112
+ /**
113
+ * 项目级API类型数据源
114
+ */
115
+ interface ApiSchema {
116
+ /**
117
+ * 唯一标识
118
+ */
119
+ id: string;
120
+ /**
121
+ * 接口名称
122
+ */
123
+ name: string;
124
+ /**
125
+ * 接口描述说明
126
+ */
127
+ label?: string;
128
+ /**
129
+ * 接口请求url
130
+ */
131
+ url: string;
132
+ /**
133
+ * 分组
134
+ */
135
+ category?: string;
136
+ /**
137
+ * 接口请求方法
138
+ */
139
+ method?: ApiMethod;
140
+ /**
141
+ * 请求 设置配置
142
+ */
143
+ settings?: Record<string, any>;
144
+ /**
145
+ * 请求头配置
146
+ */
147
+ headers?: JSExpression | JSFunction;
148
+ /**
149
+ * jsonp请求配置
150
+ */
151
+ jsonpOptions?: Record<string, any>;
152
+ /**
153
+ * 模拟数据模板
154
+ */
155
+ mockTemplate?: JSFunction;
156
+ /**
157
+ * 是否开启模拟数据
158
+ */
159
+ mock?: boolean;
160
+ }
161
+ /**
162
+ * 配置化查询数据源
163
+ */
164
+ interface MetaSchema {
165
+ /**
166
+ * 唯一标识
167
+ */
168
+ id: string;
169
+ /**
170
+ * 功能号
171
+ */
172
+ code: string;
173
+ /**
174
+ * 报表名称
175
+ */
176
+ title: string;
177
+ /**
178
+ * 查询方案编号
179
+ */
180
+ queryCode: string;
181
+ }
182
+ /**
183
+ * 页面级引用数据源
184
+ */
185
+ interface DataSourceSchema {
186
+ /**
187
+ * 数据源类型
188
+ */
189
+ type: DataSourceType;
190
+ /**
191
+ * 数据源引用唯一标识, type为 mock时,无需引用
192
+ */
193
+ ref?: string;
194
+ /**
195
+ * 数据源名称
196
+ */
197
+ name: string;
198
+ /**
199
+ * 描述标题
200
+ */
201
+ label?: string;
202
+ /**
203
+ * 数据转换函数
204
+ */
205
+ transform?: JSFunction;
206
+ /**
207
+ * 测试用例
208
+ */
209
+ test?: JSFunction;
210
+ /**
211
+ * 模拟数据模版, 当type为mock时,是必填项
212
+ */
213
+ mockTemplate?: JSFunction;
214
+ }
215
+
216
+ type FlowNodeType = 'STATE' | 'FUNCTION' | 'EMPTY' | 'PACKAGE' | 'TYPE';
217
+
218
+ interface ImportStatement {
219
+ /**
220
+ * 导入来源
221
+ */
222
+ from: string;
223
+ /**
224
+ * 唯一标识
225
+ */
226
+ id?: string;
227
+ /**
228
+ * 导入语句源代码
229
+ */
230
+ raw: string;
231
+ /**
232
+ * 导入类型
233
+ */
234
+ type: 'type' | 'value';
235
+ /**
236
+ * 节点类型
237
+ */
238
+ nodeType?: FlowNodeType;
239
+ }
240
+
241
+ /**
242
+ * 低代码组件协议
243
+ */
244
+ interface NodeSchema {
245
+ /**
246
+ * 节点标识
247
+ */
248
+ id?: string;
249
+ /**
250
+ * 节点名称
251
+ */
252
+ name: string;
253
+ /**
254
+ * 来源
255
+ */
256
+ from?: NodeFrom;
257
+ /**
258
+ * 锁定
259
+ */
260
+ locked?: boolean;
261
+ /**
262
+ * 不可见的
263
+ */
264
+ invisible?: boolean;
265
+ /**
266
+ * 组件属性, 当 name 为 slot 时 props 是 插槽的参数
267
+ */
268
+ props?: NodeProps;
269
+ /**
270
+ * 绑定事件
271
+ */
272
+ events?: NodeEvents;
273
+ /**
274
+ * 内置指令
275
+ */
276
+ directives?: NodeDirective[];
277
+ /**
278
+ * 子组件
279
+ */
280
+ children?: NodeChildren;
281
+ /**
282
+ * 放置在组件的插槽
283
+ */
284
+ slot?: string | NodeSlot;
285
+ }
286
+ /**
287
+ * 组件来源, 字符串是依赖包名
288
+ */
289
+ type NodeFrom = string | NodeFromSchema | NodeFromUrlSchema | NodeFromPlugin;
290
+ /**
291
+ * 来源于其他Schema对象
292
+ */
293
+ interface NodeFromSchema {
294
+ type: 'Schema';
295
+ /**
296
+ * Block Id
297
+ */
298
+ id: string;
299
+ }
300
+ /**
301
+ * 来源于远程的Schema文件
302
+ */
303
+ interface NodeFromUrlSchema {
304
+ type: 'UrlSchema';
305
+ url: string;
306
+ }
307
+ /**
308
+ * 来源远程组件
309
+ */
310
+ interface NodeFromPlugin {
311
+ type: 'Plugin';
312
+ urls: string[];
313
+ library?: string;
314
+ }
315
+ /**
316
+ * 组件属性描述
317
+ */
318
+ interface NodeProps {
319
+ key?: string | number | JSExpression;
320
+ ref?: string | JSExpression | JSFunction;
321
+ style?: Record<string, any>;
322
+ class?: string | string[] | JSExpression;
323
+ [index: string]: JSONValue | JSExpression | JSFunction;
324
+ }
325
+ /**
326
+ * 事件描述
327
+ */
328
+ interface NodeEvent {
329
+ name: string;
330
+ handler: JSFunction;
331
+ modifiers?: Record<string, boolean>;
332
+ }
333
+ type NodeEvents = Record<string, NodeEvent>;
334
+ /**
335
+ * 子组件描述
336
+ */
337
+ type NodeChildren = string | JSExpression | NodeSchema[];
338
+ /**
339
+ * 插槽描述
340
+ */
341
+ interface NodeSlot {
342
+ name: string;
343
+ params?: string | string[];
344
+ }
345
+ /**
346
+ * 插槽内容描述
347
+ */
348
+ interface NodeSlotContent {
349
+ /**
350
+ * 插槽内容节点
351
+ */
352
+ nodes: NodeSchema[];
353
+ /**
354
+ * 作用域插槽参数(如 { row })
355
+ */
356
+ params?: string;
357
+ }
358
+ /**
359
+ * 组件指令定义
360
+ */
361
+ interface NodeDirective {
362
+ id?: string;
363
+ name: string | JSExpression;
364
+ rawName?: string;
365
+ arg?: string | JSExpression;
366
+ modifiers?: NodeModifiers;
367
+ value?: JSExpression;
368
+ iterator?: {
369
+ item: string;
370
+ index: string;
371
+ };
372
+ }
373
+ /**
374
+ * 循环指令迭代器
375
+ */
376
+ interface NodeDirectiveIterator {
377
+ item: string;
378
+ index: string;
379
+ }
380
+ /**
381
+ * 事件/指令修饰符
382
+ */
383
+ type NodeModifiers = Record<string, boolean>;
384
+ /**
385
+ * 动态插槽信息
386
+ */
387
+ interface DynamicSlotInfo {
388
+ name: string;
389
+ label?: string;
390
+ description?: string;
391
+ params?: string[];
392
+ source: 'static' | 'dynamic';
393
+ sourceField?: string;
394
+ sourceValue?: any;
395
+ }
396
+
397
+ interface BlockMethod {
398
+ id: string;
399
+ name: string;
400
+ type: 'normal' | 'async';
401
+ methodName?: string;
402
+ methodBody?: string;
403
+ methodParameter?: string;
404
+ }
405
+ interface BlockSchema {
406
+ /**
407
+ * 是否转换
408
+ */
409
+ isTransformed?: boolean;
410
+ /**
411
+ * 源代码
412
+ */
413
+ sourceCode?: string;
414
+ /**
415
+ * 导入的依赖
416
+ */
417
+ imports?: ImportStatement[];
418
+ /**
419
+ * 唯一标识
420
+ */
421
+ id?: string;
422
+ /**
423
+ * 组件名
424
+ */
425
+ name: string;
426
+ /**
427
+ * 锁定
428
+ */
429
+ locked?: boolean;
430
+ /**
431
+ * 注入
432
+ */
433
+ inject?: Record<string, string>;
434
+ /**
435
+ * 状态数据
436
+ */
437
+ state?: BlockState;
438
+ /**
439
+ * 生命周期集
440
+ */
441
+ lifeCycles?: Record<string, any>;
442
+ /**
443
+ * 自定义方法
444
+ */
445
+ methods?: Record<string, BlockMethod>;
446
+ /**
447
+ * 计算属性
448
+ */
449
+ computed?: Record<string, any>;
450
+ /**
451
+ * 侦听器
452
+ */
453
+ watch?: Record<string, string>;
454
+ /**
455
+ * 提供
456
+ */
457
+ provide?: Record<string, string>;
458
+ /**
459
+ * 样式
460
+ */
461
+ css?: string;
462
+ /**
463
+ * 样式代码片段集合(每个style块编译后的CSS字符串)
464
+ */
465
+ style?: string[];
466
+ /**
467
+ * 定义属性参数
468
+ */
469
+ props?: string;
470
+ /**
471
+ * 定义事件
472
+ */
473
+ emits?: string;
474
+ /**
475
+ * 定义插槽
476
+ */
477
+ slots?: Array<string | BlockSlot>;
478
+ /**
479
+ * 节点树
480
+ */
481
+ nodes?: NodeSchema[];
482
+ /**
483
+ * 数据源
484
+ */
485
+ dataSources?: Record<string, DataSourceSchema>;
486
+ /**
487
+ * 使用attrs
488
+ */
489
+ useAttrs?: string;
490
+ /**
491
+ * 使用emit
492
+ */
493
+ useSlots?: string;
494
+ /**
495
+ * 类型
496
+ */
497
+ interfaces?: string[];
498
+ /**
499
+ * 类型
500
+ */
501
+ types?: string[];
502
+ /**
503
+ * 运行时方法
504
+ */
505
+ runs?: Array<{
506
+ name: string;
507
+ value: string;
508
+ }>;
509
+ /**
510
+ * babel代码转换缓存
511
+ */
512
+ transform?: Record<string, string>;
513
+ /**
514
+ * 标记
515
+ */
516
+ __MAX_BLOCK__?: boolean;
517
+ /**
518
+ * 版本
519
+ */
520
+ __VERSION__?: string;
521
+ /**
522
+ * 模板id
523
+ */
524
+ __TEMPLATE_ID__?: string;
525
+ /**
526
+ * 事件方法流程数据
527
+ */
528
+ flow?: Record<string, any>;
529
+ /**
530
+ * 弹窗页面配置
531
+ */
532
+ popups?: NodeSchema[];
533
+ /**
534
+ * 定义暴露
535
+ */
536
+ defineExpose?: string;
537
+ }
538
+ /**
539
+ * 弹窗页面配置
540
+ */
541
+ interface PopupPageConfig {
542
+ props?: Record<string, any>;
543
+ /**
544
+ * 唯一标识
545
+ */
546
+ id: string;
547
+ /**
548
+ * 页面名称
549
+ */
550
+ name: string;
551
+ /**
552
+ * 页面标题
553
+ */
554
+ title?: string;
555
+ /**
556
+ * 页面类型
557
+ */
558
+ type?: 'internal' | 'external' | 'component';
559
+ /**
560
+ * 页面URL或路径
561
+ */
562
+ url?: string;
563
+ /**
564
+ * 是否可见
565
+ */
566
+ visible?: boolean;
567
+ /**
568
+ * 弹窗配置
569
+ */
570
+ config?: PopupDisplayConfig;
571
+ /**
572
+ * 创建时间
573
+ */
574
+ createTime?: string;
575
+ /**
576
+ * 更新时间
577
+ */
578
+ updateTime?: string;
579
+ }
580
+ /**
581
+ * 弹窗显示配置
582
+ */
583
+ interface PopupDisplayConfig {
584
+ /**
585
+ * 宽度
586
+ */
587
+ width?: string | number;
588
+ /**
589
+ * 高度
590
+ */
591
+ height?: string | number;
592
+ /**
593
+ * 是否可关闭
594
+ */
595
+ closable?: boolean;
596
+ /**
597
+ * 点击遮罩是否可关闭
598
+ */
599
+ maskClosable?: boolean;
600
+ /**
601
+ * 弹窗位置
602
+ */
603
+ position?: 'center' | 'top' | 'bottom';
604
+ /**
605
+ * 层级
606
+ */
607
+ zIndex?: number;
608
+ /**
609
+ * 自定义样式类名
610
+ */
611
+ className?: string;
612
+ /**
613
+ * 自定义样式
614
+ */
615
+ style?: Record<string, any>;
616
+ }
617
+ /**
618
+ * 注入描述
619
+ */
620
+ interface BlockInject {
621
+ name: string;
622
+ from?: string | JSExpression;
623
+ default?: JSONValue | JSExpression;
624
+ options?: string;
625
+ }
626
+ /**
627
+ * 提供描述
628
+ */
629
+ interface BlockProvide {
630
+ key: string;
631
+ value: string;
632
+ options?: string;
633
+ }
634
+ /**
635
+ * 组件状态描述
636
+ */
637
+ type BlockState = Record<string, any>;
638
+ /**
639
+ * 侦听器描述
640
+ */
641
+ interface BlockWatch {
642
+ id?: string;
643
+ source: JSFunction | JSExpression;
644
+ handler: JSFunction;
645
+ options?: Record<string, any>;
646
+ }
647
+ interface BlockPropTypeImport {
648
+ typeName: string;
649
+ from: string;
650
+ isDefault?: boolean;
651
+ as?: string;
652
+ }
653
+ interface BlockProp {
654
+ name: string;
655
+ /** Vue 3 + TypeScript 编译时类型定义 */
656
+ tsType: string;
657
+ required?: boolean;
658
+ default?: JSONValue | JSExpression;
659
+ /** 自定义类型导入(支持多个) */
660
+ typeImports?: BlockPropTypeImport[];
661
+ }
662
+ interface BlockEmit {
663
+ name: string;
664
+ params: string[];
665
+ }
666
+ interface BlockSlot {
667
+ name: string;
668
+ params?: string[];
669
+ args?: string[] | string;
670
+ }
671
+
672
+ /**
673
+ * 文件类型
674
+ */
675
+ type FileType = 'block' | 'page';
676
+ interface MarketInstallInfo {
677
+ /**
678
+ * 物料标识
679
+ */
680
+ id: string;
681
+ /**
682
+ * 安装版本号
683
+ */
684
+ version?: string;
685
+ }
686
+ interface BlockFile {
687
+ /**
688
+ * 文件类型
689
+ */
690
+ type: FileType;
691
+ /**
692
+ * 唯一标识
693
+ */
694
+ id: string;
695
+ /**
696
+ * 文件名
697
+ */
698
+ name: string;
699
+ /**
700
+ * 页面标题
701
+ */
702
+ title: string;
703
+ /**
704
+ * 分组
705
+ */
706
+ category?: string;
707
+ /**
708
+ * 从物料市场安装
709
+ */
710
+ market?: MarketInstallInfo;
711
+ /**
712
+ * 区块来源,默认为Schema,一旦确定,不允许更改
713
+ */
714
+ fromType?: 'Schema' | 'UrlSchema' | 'Plugin';
715
+ /**
716
+ * 是否预设,预设的插件不能编辑和删除
717
+ */
718
+ preset?: boolean;
719
+ /**
720
+ * 资源url,
721
+ * Schema: 无url
722
+ * UrlSchema: 只允许一个json文件
723
+ * Plugin:支持多个文件(.css或.js),多个文件用逗号分隔
724
+ */
725
+ urls?: string;
726
+ /**
727
+ * Plugin 时的插件名称
728
+ */
729
+ library?: string;
730
+ /**
731
+ * 文件内容
732
+ */
733
+ schema?: BlockSchema;
734
+ /**
735
+ * 模块ID
736
+ */
737
+ moduleId?: string;
738
+ }
739
+ interface PageFile extends BlockFile {
740
+ /**
741
+ * 是否目录
742
+ */
743
+ dir?: boolean;
744
+ /**
745
+ * 目录包含的页面
746
+ */
747
+ children?: PageFile[];
748
+ /**
749
+ * 元信息
750
+ */
751
+ meta?: Record<string, any>;
752
+ }
753
+
754
+ /**
755
+ * 历史记录描述
756
+ */
757
+ interface HistorySchema {
758
+ /**
759
+ * 页面或区块文件id
760
+ */
761
+ id: string;
762
+ /**
763
+ * 历史记录项
764
+ */
765
+ items?: HistoryItem[];
766
+ }
767
+ /**
768
+ * 记录项
769
+ */
770
+ interface HistoryItem {
771
+ /**
772
+ * 记录项唯一标识
773
+ */
774
+ id: string;
775
+ /**
776
+ * 记录项描述
777
+ */
778
+ label: string;
779
+ /**
780
+ * 记录项内容
781
+ */
782
+ dsl?: BlockSchema;
783
+ }
784
+
785
+ /**
786
+ * 项目描述信息
787
+ */
788
+ interface ProjectSchema {
789
+ /**
790
+ * 项目唯一标识
791
+ */
792
+ id: string;
793
+ /**
794
+ * 项目名称
795
+ */
796
+ name: string;
797
+ /**
798
+ * 项目页面
799
+ */
800
+ pages?: PageFile[];
801
+ /**
802
+ * 项目共用区块组件
803
+ */
804
+ blocks?: BlockFile[];
805
+ /**
806
+ * 项目标识
807
+ */
808
+ __MAX_PROJECT__: boolean;
809
+ /**
810
+ * 项目版本
811
+ */
812
+ __VERSION__: string;
813
+ }
814
+
815
+ interface TemplateDto {
816
+ id: string;
817
+ name: string;
818
+ label: string;
819
+ vip: boolean;
820
+ share: boolean;
821
+ cover: string;
822
+ author: string;
823
+ userId: string;
824
+ category: string;
825
+ latest: string;
826
+ platform: string;
827
+ thumbnail?: string;
828
+ }
829
+
830
+ /**
831
+ * 渲染器上下文
832
+ */
833
+ interface RendererContext {
834
+ /**
835
+ * 是否是设计模式
836
+ */
837
+ designable: boolean;
838
+ /**
839
+ * 组件列表
840
+ */
841
+ components: Record<string, Component>;
842
+ /**
843
+ * 获取组件
844
+ */
845
+ getComponent: (name: string) => string | Component | undefined;
846
+ }
847
+ /**
848
+ * 渲染器节点属性
849
+ */
850
+ interface RendererNodeProps {
851
+ /**
852
+ * 节点schema
853
+ */
854
+ schema: NodeSchema;
855
+ }
856
+
857
+ type VueComponent = Record<string, any> | VNode | DefineComponent<any, any, any, any>;
858
+ /**
859
+ * json属性值
860
+ */
861
+ type JSONValue = boolean | string | number | null | undefined | JSONArray | JSONObject;
862
+ /**
863
+ * json 数组
864
+ */
865
+ type JSONArray = JSONValue[];
866
+ /**
867
+ * json 对象
868
+ */
869
+ interface JSONObject {
870
+ [key: string]: JSONValue;
871
+ }
872
+ /**
873
+ * 表达式代码
874
+ */
875
+ interface JSExpression {
876
+ type: 'JSExpression';
877
+ id?: string;
878
+ value: string;
879
+ }
880
+ /**
881
+ * 函数代码
882
+ */
883
+ interface JSFunction {
884
+ type: 'JSFunction';
885
+ id?: string;
886
+ value: string;
887
+ params?: string;
888
+ }
889
+ /**
890
+ * 数据类型
891
+ */
892
+ type DataType = 'String' | 'Boolean' | 'Number' | 'Date' | 'Object' | 'Array' | 'Function';
893
+ /**
894
+ * 静态文件
895
+ */
896
+ interface StaticFileInfo {
897
+ filename?: string;
898
+ filepath: string;
899
+ }
900
+ interface ExtensionConfig {
901
+ /**
902
+ * 扩展资源文件路径:js、css文件,js文件要求 umd 格式
903
+ */
904
+ urls: string[];
905
+ /**
906
+ * js库导出名
907
+ */
908
+ library: string;
909
+ /**
910
+ * 附加参数/数据,用作个性需求
911
+ */
912
+ params?: Array<Record<string, any>>;
913
+ }
914
+ interface EnhanceConfig {
915
+ name: string;
916
+ urls: string[];
917
+ }
918
+ /**
919
+ * 平台类型
920
+ */
921
+ type PlatformType = 'web' | 'h5' | 'uniapp';
922
+ /**
923
+ * 解析 Vue 文件选项
924
+ */
925
+ interface ParseVueOptions {
926
+ id: string;
927
+ name: string;
928
+ source: string;
929
+ }
930
+
931
+ /**
932
+ * 设置器配置
933
+ */
934
+ interface Setter {
935
+ /**
936
+ * 设置器名称
937
+ */
938
+ name: string;
939
+ /**
940
+ * 设置器组件
941
+ */
942
+ component: VueComponent;
943
+ /**
944
+ * 设置器数据类型
945
+ */
946
+ tsType: string;
947
+ /**
948
+ * 设计器参数
949
+ */
950
+ props?: Record<string, any>;
951
+ }
952
+
953
+ /**
954
+ * 基础器件
955
+ */
956
+ interface Widget {
957
+ /**
958
+ * 器件名称
959
+ */
960
+ name: string;
961
+ /**
962
+ * 放置区域
963
+ */
964
+ region: keyof typeof RegionType;
965
+ /**
966
+ * 组件默认参数
967
+ */
968
+ props?: Record<string, any>;
969
+ /**
970
+ * 不可见,停用
971
+ */
972
+ invisible?: boolean;
973
+ /**
974
+ * 分组名称
975
+ */
976
+ group?: string;
977
+ /**
978
+ * 排序
979
+ */
980
+ order?: number;
981
+ /**
982
+ * 需要remote支持
983
+ */
984
+ remote?: boolean;
985
+ /**
986
+ * 应用图标
987
+ */
988
+ icon: string;
989
+ /**
990
+ * 应用名称
991
+ */
992
+ label?: string;
993
+ /**
994
+ * 应用打开方式
995
+ */
996
+ openType?: 'panel' | 'link' | 'dialog';
997
+ /**
998
+ * 链接url,openType 为 link 时有效
999
+ */
1000
+ url?: string;
1001
+ }
1002
+
1003
+ /**
1004
+ * 物料描述
1005
+ */
1006
+ interface Material {
1007
+ /**
1008
+ * 版本号
1009
+ */
1010
+ version: string;
1011
+ /**
1012
+ * 物料名称标识
1013
+ */
1014
+ name: string;
1015
+ /**
1016
+ * 产出导出变量名称
1017
+ */
1018
+ library: string;
1019
+ /**
1020
+ * 物料中文名称
1021
+ */
1022
+ label: string;
1023
+ /**
1024
+ * 分类配置
1025
+ */
1026
+ categories: MaterialCategory[];
1027
+ /**
1028
+ * 组件描述
1029
+ */
1030
+ components: MaterialDescription[];
1031
+ /**
1032
+ * 排序号,物料在组件库的排序,数字小的在前
1033
+ */
1034
+ order: number;
1035
+ /**
1036
+ * 不显示在组件库面板
1037
+ */
1038
+ hidden?: boolean;
1039
+ }
1040
+ interface MaterialCategory {
1041
+ id: number | string;
1042
+ category: string;
1043
+ }
1044
+ interface MaterialDescription {
1045
+ /**
1046
+ * 组件名称
1047
+ */
1048
+ name: string;
1049
+ /**
1050
+ * 组件别名,即组件库导出的原始名称 如 import { Button } from 'ant-design-vue'
1051
+ */
1052
+ alias?: string;
1053
+ /**
1054
+ * 组件库导出的名称 如 import { Button } from 'ant-design-vue'
1055
+ * parent: Button
1056
+ * alias: Group
1057
+ * name: AButtonGroup
1058
+ * const AButtonGroup = Button.Group;
1059
+ * 当 parent 有值时 alias 可以设置多级,如 Group.Item
1060
+ *
1061
+ */
1062
+ parent?: string;
1063
+ /**
1064
+ * 组件预览图标
1065
+ */
1066
+ icon?: string;
1067
+ /**
1068
+ * 组件中文名称描述
1069
+ */
1070
+ label?: string;
1071
+ /**
1072
+ * 组件文档Url
1073
+ */
1074
+ doc?: string;
1075
+ /**
1076
+ * 分类Id
1077
+ */
1078
+ categoryId?: number | string;
1079
+ /**
1080
+ * 组件支持属性,待定义
1081
+ */
1082
+ props?: any[];
1083
+ /**
1084
+ * 组件支持事件
1085
+ */
1086
+ events?: Array<string | MaterialEvent>;
1087
+ /**
1088
+ * 组件支持的插槽
1089
+ */
1090
+ slots?: Array<string | MaterialSlot>;
1091
+ /**
1092
+ * 初始化时的低代码片段
1093
+ */
1094
+ snippet?: Partial<NodeSchema>;
1095
+ /**
1096
+ * 只能放置在哪些组件内, 如果不设置,则表示可以放置在任何组件内, false表示不能放置在任何组件内
1097
+ */
1098
+ parentIncludes?: boolean | string[];
1099
+ /**
1100
+ * 只能允许哪些子组件, 如果不设置,则表示可以放置任何子组件, false表示不能放置在任何子组件
1101
+ */
1102
+ childIncludes?: boolean | string[];
1103
+ /**
1104
+ * 不显示在组件面板
1105
+ */
1106
+ hidden?: boolean;
1107
+ /**
1108
+ * 组件来源
1109
+ */
1110
+ from?: NodeFrom;
1111
+ /**
1112
+ * Block Id
1113
+ */
1114
+ id?: string;
1115
+ /**
1116
+ * 所属包名
1117
+ */
1118
+ package?: string;
1119
+ }
1120
+ /**
1121
+ * 组件支持的属性
1122
+ */
1123
+ interface MaterialProp {
1124
+ /**
1125
+ * 属性名称
1126
+ */
1127
+ name: string;
1128
+ /**
1129
+ * 属性名称 中文
1130
+ */
1131
+ label?: string;
1132
+ /**
1133
+ * 提示说明
1134
+ */
1135
+ title?: string;
1136
+ /**
1137
+ * 默认值
1138
+ */
1139
+ defaultValue?: JSONValue;
1140
+ /**
1141
+ * 设置器
1142
+ */
1143
+ setters?: string | MaterialSetter | Array<string | MaterialSetter>;
1144
+ /**
1145
+ * 值可选项
1146
+ */
1147
+ options?: string[] | Array<{
1148
+ label: string;
1149
+ value: JSONValue;
1150
+ }>;
1151
+ /**
1152
+ * 数据类型
1153
+ */
1154
+ type?: DataType[];
1155
+ }
1156
+ /**
1157
+ * 属性设置器
1158
+ */
1159
+ interface MaterialSetter {
1160
+ /**
1161
+ * 设置器名称标识
1162
+ */
1163
+ name: string;
1164
+ /**
1165
+ * 实现组件
1166
+ */
1167
+ component?: any;
1168
+ /**
1169
+ * 显示描述文本
1170
+ */
1171
+ label?: string;
1172
+ /**
1173
+ * 组件配置参数
1174
+ */
1175
+ props?: Record<string, any>;
1176
+ }
1177
+ /**
1178
+ * 组件支持的事件
1179
+ */
1180
+ interface MaterialEvent {
1181
+ /**
1182
+ * 事件名称
1183
+ */
1184
+ name: string;
1185
+ /**
1186
+ * 事件描述
1187
+ */
1188
+ description?: string;
1189
+ /**
1190
+ * 事件回调参数名
1191
+ */
1192
+ params?: string[];
1193
+ }
1194
+ /**
1195
+ * 组件支持的插槽
1196
+ */
1197
+ interface MaterialSlot {
1198
+ /**
1199
+ * 插槽名称
1200
+ */
1201
+ name: string;
1202
+ /**
1203
+ * 插槽描述
1204
+ */
1205
+ description?: string;
1206
+ /**
1207
+ * 插槽回传的参数名
1208
+ */
1209
+ params?: string[];
1210
+ }
1211
+
1212
+ type AssetType = 'system' | 'custom';
1213
+ interface AssetTabItem {
1214
+ type: AssetType;
1215
+ title: string;
1216
+ }
1217
+ interface AssetGroup {
1218
+ type: AssetType;
1219
+ name: string;
1220
+ label: string;
1221
+ count: number;
1222
+ library?: string;
1223
+ names?: string[];
1224
+ components: MaterialDescription[];
1225
+ hidden?: boolean;
1226
+ }
1227
+
1228
+ /**
1229
+ * 依赖包
1230
+ */
1231
+ interface Dependency {
1232
+ /**
1233
+ * 包名
1234
+ */
1235
+ package: string;
1236
+ /**
1237
+ * 支持平台
1238
+ */
1239
+ platform?: PlatformType | PlatformType[];
1240
+ /**
1241
+ * 版本号
1242
+ */
1243
+ version: string;
1244
+ /**
1245
+ * 必须依赖
1246
+ */
1247
+ required?: boolean;
1248
+ /**
1249
+ * 官方内置提供
1250
+ */
1251
+ official?: boolean;
1252
+ /**
1253
+ * 启用
1254
+ */
1255
+ enabled?: boolean;
1256
+ /**
1257
+ * 库导出名称
1258
+ */
1259
+ library: string;
1260
+ /**
1261
+ * 语言包库导出名称
1262
+ */
1263
+ localeLibrary?: string;
1264
+ /**
1265
+ * 加载资源url
1266
+ */
1267
+ urls: string[];
1268
+ /**
1269
+ * 资产配置url
1270
+ */
1271
+ assetsUrl?: string;
1272
+ /**
1273
+ * 资产配置导出名称
1274
+ */
1275
+ assetsLibrary?: string;
1276
+ }
1277
+
1278
+ type TemplateType = 'system' | 'custom';
1279
+ interface TemplateTabItem {
1280
+ type: TemplateType;
1281
+ title: string;
1282
+ }
1283
+ interface TemplateGroup {
1284
+ type: TemplateType;
1285
+ name: string;
1286
+ label: string;
1287
+ count: number;
1288
+ library?: string;
1289
+ names?: string[];
1290
+ templates: TemplateDescription[];
1291
+ hidden?: boolean;
1292
+ }
1293
+ interface TemplateDescription {
1294
+ /**
1295
+ * 模板名称
1296
+ */
1297
+ name: string;
1298
+ /**
1299
+ * 模板预览图标
1300
+ */
1301
+ icon?: string;
1302
+ /**
1303
+ * 模板中文名称描述
1304
+ */
1305
+ templateName?: string;
1306
+ /**
1307
+ * 模板文本
1308
+ */
1309
+ templateText?: string;
1310
+ /**
1311
+ * 模板文档Url
1312
+ */
1313
+ doc?: string;
1314
+ /**
1315
+ * 分类Id
1316
+ */
1317
+ categoryId?: number | string;
1318
+ /**
1319
+ * 不显示在模板面板
1320
+ */
1321
+ hidden?: boolean;
1322
+ /**
1323
+ * 模板来源
1324
+ */
1325
+ from?: string;
1326
+ /**
1327
+ * Block Id
1328
+ */
1329
+ id?: string;
1330
+ /**
1331
+ * 模板Schema
1332
+ */
1333
+ schema: NodeSchema;
1334
+ /**
1335
+ * 模板缩略图
1336
+ */
1337
+ thumbnail?: string;
1338
+ }
1339
+
1340
+ declare class DirectiveModel {
1341
+ /**
1342
+ * 唯一标识
1343
+ */
1344
+ id: string;
1345
+ /**
1346
+ * 指令名称
1347
+ */
1348
+ name: string | JSExpression;
1349
+ /**
1350
+ * 指令参数
1351
+ */
1352
+ arg?: string | JSExpression;
1353
+ /**
1354
+ * 指令修饰符
1355
+ */
1356
+ modifiers?: NodeModifiers;
1357
+ /**
1358
+ * 指令值
1359
+ */
1360
+ value?: JSExpression;
1361
+ /**
1362
+ * 是否为迭代器
1363
+ */
1364
+ iterator?: NodeDirectiveIterator;
1365
+ constructor(schema: NodeDirective);
1366
+ update(schema: Partial<NodeDirective>): void;
1367
+ static toSchema(directives: DirectiveModel[]): NodeDirective[];
1368
+ static parse(directives?: NodeDirective[]): DirectiveModel[];
1369
+ }
1370
+
1371
+ declare class EventModel {
1372
+ name: string;
1373
+ handler: JSFunction;
1374
+ modifiers: NodeModifiers;
1375
+ constructor(schema: NodeEvent);
1376
+ update(schema: Partial<NodeEvent>): void;
1377
+ static toSchema(events: Record<string, EventModel>): NodeEvents;
1378
+ static parse(events: NodeEvents): Record<string, EventModel>;
1379
+ }
1380
+
1381
+ declare class PropModel {
1382
+ name: string;
1383
+ value: JSONValue | JSExpression | JSFunction;
1384
+ defaultValue: JSONValue | JSExpression | JSFunction;
1385
+ constructor(name: string, value: JSONValue | JSExpression | JSFunction, defaultValue?: JSONValue | JSExpression | JSFunction);
1386
+ setDefaultValue(defaultValue: JSONValue | JSExpression | JSFunction): void;
1387
+ getDefaultValue(): JSExpression | JSFunction | JSONValue;
1388
+ setValue(value: JSONValue | JSExpression | JSFunction): void;
1389
+ getValue(): JSExpression | JSFunction | JSONValue;
1390
+ /**
1391
+ * 转换为节点属性
1392
+ * @param props 属性
1393
+ * @returns 节点属性
1394
+ */
1395
+ static toSchema(props: Record<string, PropModel>): NodeProps;
1396
+ /**
1397
+ * 解析属性
1398
+ * @param props 属性
1399
+ * @returns 属性
1400
+ */
1401
+ static parse(props: NodeProps): Record<string, PropModel>;
1402
+ }
1403
+
1404
+ declare class NodeModel {
1405
+ /**
1406
+ * 标记
1407
+ */
1408
+ readonly __MAX_NODE__: boolean;
1409
+ /**
1410
+ * 锁定
1411
+ */
1412
+ locked: boolean;
1413
+ /**
1414
+ * 记录所有节点的实例
1415
+ */
1416
+ static nodes: Record<string, NodeModel>;
1417
+ /**
1418
+ * 节点唯一标识
1419
+ */
1420
+ readonly id: string;
1421
+ /**
1422
+ * 名称,即组件的名称或html的标签名
1423
+ */
1424
+ readonly name: string;
1425
+ /**
1426
+ * 组件来源
1427
+ */
1428
+ readonly from: NodeFrom;
1429
+ /**
1430
+ * 是否不可见
1431
+ */
1432
+ invisible: boolean;
1433
+ /**
1434
+ * 子节点
1435
+ */
1436
+ children: NodeModel[] | string | JSExpression;
1437
+ /**
1438
+ * 放置在父组件的插槽
1439
+ */
1440
+ slot?: string | NodeSlot;
1441
+ /**
1442
+ * 节点属性
1443
+ */
1444
+ props: Record<string, PropModel>;
1445
+ /**
1446
+ * 节点事件
1447
+ */
1448
+ events: Record<string, EventModel>;
1449
+ /**
1450
+ * 指令
1451
+ */
1452
+ directives: DirectiveModel[];
1453
+ /**
1454
+ * 销毁标识
1455
+ */
1456
+ disposed: boolean;
1457
+ /**
1458
+ * 父节点
1459
+ */
1460
+ parent?: NodeModel | null;
1461
+ /**
1462
+ * 插槽
1463
+ */
1464
+ slots: Record<string, NodeSlotContent>;
1465
+ constructor(schema: NodeSchema, parent?: NodeModel | null);
1466
+ resisterNode(node: NodeModel): void;
1467
+ unregisterNode(node: NodeModel): void;
1468
+ update(schema: Partial<NodeSchema>, silent?: boolean): void;
1469
+ /**
1470
+ * 更新节点属性
1471
+ * @param props 属性
1472
+ * @param silent 是否静默
1473
+ */
1474
+ updateProps(props: Record<string, PropModel>, silent?: boolean): void;
1475
+ /**
1476
+ * 更新节点属性
1477
+ * @param props 属性
1478
+ * @param silent 是否静默
1479
+ */
1480
+ updatePropsOrigin(props: Record<string, JSONValue | JSExpression | JSFunction>, silent?: boolean): void;
1481
+ setProp(name: string, value: JSONValue | JSExpression | JSFunction, defaultValue?: JSONValue | JSExpression | JSFunction, silent?: boolean): void;
1482
+ removeProp(name: string, silent?: boolean): void;
1483
+ getPropValue(name: string): JSExpression | JSFunction | JSONValue;
1484
+ setEvent(schema: NodeEvent, silent?: boolean): void;
1485
+ removeEvent(name: string, silent?: boolean): void;
1486
+ setDirective(schema: NodeDirective | DirectiveModel, silent?: boolean): void;
1487
+ removeDirective(directive: DirectiveModel, silent?: boolean): void;
1488
+ setChildren(children: NodeSchema[] | string | JSExpression, silent?: boolean): void;
1489
+ setSlot(slot?: string | NodeSlot, silent?: boolean): void;
1490
+ removeChild(child: NodeModel, silent?: boolean): void;
1491
+ appendChild(child: NodeModel, silent?: boolean): void;
1492
+ /**
1493
+ * 在当前节点的后面插入节点
1494
+ * @param child 要插入的节点
1495
+ */
1496
+ insertAfter(child: NodeModel, silent?: boolean): void;
1497
+ /**
1498
+ * 在当前节点的前面插入节点
1499
+ * @param child 要插入的节点
1500
+ */
1501
+ insertBefore(child: NodeModel, silent?: boolean): void;
1502
+ movePrev(silent?: boolean): void;
1503
+ moveNext(silent?: boolean): void;
1504
+ /**
1505
+ * 锁定节点,防止被修改或删除
1506
+ */
1507
+ lock(silent?: boolean): void;
1508
+ /**
1509
+ * 解锁节点,允许被修改或删除
1510
+ */
1511
+ unlock(silent?: boolean): void;
1512
+ /**
1513
+ * 设置节点可见性
1514
+ * @param visible 是否可见
1515
+ */
1516
+ setVisible(visible: boolean, silent?: boolean): void;
1517
+ /**
1518
+ * 检查指定节点是否为当前节点的子节点
1519
+ * @param node 要检查的节点
1520
+ * @returns 如果是子节点返回 true,否则返回 false
1521
+ */
1522
+ isChild(node: NodeModel): boolean;
1523
+ /**
1524
+ * 销毁节点,清理资源并标记为已销毁
1525
+ */
1526
+ dispose(silent?: boolean): void;
1527
+ toSchema(): NodeSchema;
1528
+ }
1529
+
1530
+ declare class BlockModel {
1531
+ /**
1532
+ * 标记
1533
+ */
1534
+ readonly __MAX_BLOCK__: boolean;
1535
+ /**
1536
+ * 唯一标识
1537
+ */
1538
+ id?: string;
1539
+ /**
1540
+ * 组件名
1541
+ */
1542
+ name: string;
1543
+ /**
1544
+ * 锁定
1545
+ */
1546
+ locked?: boolean;
1547
+ /**
1548
+ * 版本
1549
+ */
1550
+ imports?: ImportStatement[];
1551
+ /**
1552
+ * 注入
1553
+ */
1554
+ inject?: Record<string, string>;
1555
+ /**
1556
+ * 状态数据
1557
+ */
1558
+ state?: BlockState;
1559
+ /**
1560
+ * 生命周期集
1561
+ */
1562
+ lifeCycles?: Record<string, any>;
1563
+ /**
1564
+ * 自定义方法
1565
+ */
1566
+ methods?: Record<string, any>;
1567
+ /**
1568
+ * 计算属性
1569
+ */
1570
+ computed?: Record<string, any>;
1571
+ /**
1572
+ * 侦听器
1573
+ */
1574
+ watch: Record<string, string>;
1575
+ /**
1576
+ * 样式
1577
+ */
1578
+ css: string;
1579
+ /**
1580
+ * 定义属性参数
1581
+ */
1582
+ props?: string;
1583
+ /**
1584
+ * 定义事件
1585
+ */
1586
+ emits: string;
1587
+ /**
1588
+ * 定义插槽
1589
+ */
1590
+ slots: Array<string | BlockSlot>;
1591
+ /**
1592
+ * 节点树
1593
+ */
1594
+ nodes: NodeModel[];
1595
+ /**
1596
+ * 数据源
1597
+ */
1598
+ dataSources: Record<string, DataSourceSchema>;
1599
+ /**
1600
+ * __TEMPLATE_ID__
1601
+ */
1602
+ __TEMPLATE_ID__?: string;
1603
+ /**
1604
+ * 销毁标识
1605
+ */
1606
+ disposed: boolean;
1607
+ /**
1608
+ * 事件方法流程数据
1609
+ */
1610
+ flow?: Record<string, any>;
1611
+ /**
1612
+ * 弹窗页面配置列表
1613
+ */
1614
+ popups?: NodeSchema[];
1615
+ /**
1616
+ * 定义暴露
1617
+ */
1618
+ defineExpose?: string;
1619
+ constructor(schema: BlockSchema);
1620
+ update(schema: BlockSchema, silent?: boolean): void;
1621
+ toSchema(): BlockSchema;
1622
+ dispose(silent?: boolean): void;
1623
+ setImport(imports: ImportStatement[], silent?: boolean): void;
1624
+ setDefineExpose(defineExpose: string, silent?: boolean): void;
1625
+ removeDefineExpose(silent?: boolean): void;
1626
+ updateImport(imports: ImportStatement[], silent?: boolean): void;
1627
+ removeImport(im: string): false | undefined;
1628
+ updatePopup(popups: any[], silent?: boolean): void;
1629
+ removePopup(popup: any, silent?: boolean): void;
1630
+ updateFlow(name: string, flow: any[], silent?: boolean): void;
1631
+ removeFlow(name: string, silent?: boolean): void;
1632
+ setFunction(type: 'method' | 'computed' | 'lifeCycles', name: string, fn: Record<string, any>, silent?: boolean): void;
1633
+ removeFunction(type: 'method' | 'computed' | 'lifeCycles', name: string, silent?: boolean): void;
1634
+ setState(name: string, value: any, silent?: boolean): void;
1635
+ removeState(name: string, silent?: boolean): void;
1636
+ updateState(name: string, value: any, silent?: boolean): void;
1637
+ updateStateProps(statePropsKey: string, name: string, value: any, silent?: boolean): void;
1638
+ setCss(css: string, silent?: boolean): void;
1639
+ setWatch(name: string, value: string, silent?: boolean): void;
1640
+ removeWatch(name: string, silent?: boolean): void;
1641
+ /**
1642
+ * 插入到节点后
1643
+ * @param node 要插入的节点
1644
+ * @param target 目标节点
1645
+ * @returns 是否插入成功
1646
+ */
1647
+ insertAfter(node: NodeModel, target: NodeModel, silent?: boolean): boolean;
1648
+ /**
1649
+ * 插入到节点前
1650
+ * @param node 要插入的节点
1651
+ * @param target 目标节点
1652
+ * @returns 是否插入成功
1653
+ */
1654
+ insertBefore(node: NodeModel, target: NodeModel, silent?: boolean): boolean;
1655
+ appendNode(node: NodeModel, silent?: boolean): void;
1656
+ prependNode(node: NodeModel, silent?: boolean): void;
1657
+ __removeNode(node: NodeModel, silent?: boolean): void;
1658
+ removeNode(node: NodeModel, silent?: boolean): void;
1659
+ /**
1660
+ * 根据位置添加节点
1661
+ * @param node 要添加的节点
1662
+ * @param target 目标节点
1663
+ * @param position 放置位置
1664
+ * @returns 是否添加成功
1665
+ */
1666
+ addNode(node: NodeModel, target?: NodeModel, position?: DropPosition, silent?: boolean): boolean;
1667
+ moveNode(node: NodeModel, target?: NodeModel, position?: DropPosition, silent?: boolean): void;
1668
+ movePrev(node: NodeModel, silent?: boolean): void;
1669
+ moveNext(node: NodeModel, silent?: boolean): void;
1670
+ move(node: NodeModel, target?: NodeModel, position?: DropPosition, silent?: boolean): void;
1671
+ cloneNode(target: NodeModel, silent?: boolean): NodeModel;
1672
+ lock(silent?: boolean): void;
1673
+ unlock(silent?: boolean): void;
1674
+ isChild(node: NodeModel): boolean;
1675
+ }
1676
+
1677
+ declare class ProjectModel {
1678
+ /**
1679
+ * 项目唯一标识
1680
+ */
1681
+ id: string;
1682
+ /**
1683
+ * 项目名称
1684
+ */
1685
+ name: string;
1686
+ /**
1687
+ * 当前文件
1688
+ */
1689
+ currentFile: PageFile | BlockFile | null;
1690
+ /**
1691
+ * 页面文件列表
1692
+ */
1693
+ pages: PageFile[];
1694
+ /**
1695
+ * 区块文件列表
1696
+ */
1697
+ blocks: BlockFile[];
1698
+ /**
1699
+ * 页面查找缓存,提高查找性能
1700
+ */
1701
+ private pageCache;
1702
+ /**
1703
+ * 页面查找缓存,提高查找性能
1704
+ */
1705
+ private pagesCache;
1706
+ /**
1707
+ * 是否锁定
1708
+ */
1709
+ locked: string | null;
1710
+ constructor(schema: ProjectSchema);
1711
+ update(schema: Partial<ProjectSchema>, silent?: boolean): void;
1712
+ reloadPages(pages: PageFile[], silent?: boolean): void;
1713
+ /**
1714
+ * 清理页面查找缓存
1715
+ */
1716
+ private clearPageCache;
1717
+ isPageFile(file: PageFile | BlockFile): file is PageFile;
1718
+ cleanPagesSchema(files: PageFile[]): void;
1719
+ getPagesSchema(pages?: PageFile[]): PageFile[];
1720
+ getBlocksSchema(blocks?: BlockFile[]): BlockFile[];
1721
+ toSchema(): ProjectSchema;
1722
+ active(file: PageFile | BlockFile, silent?: boolean): void;
1723
+ inactive(silent?: boolean): void;
1724
+ getPage(id: string): PageFile | null;
1725
+ getPages(): PageFile[];
1726
+ createPage(page: PageFile, parentId?: string, silent?: boolean): void;
1727
+ updatePage(page: PageFile, silent?: boolean): void;
1728
+ clonePage(page: PageFile, parentId?: string, silent?: boolean): void;
1729
+ removePage(id: string, silent?: boolean): boolean;
1730
+ /**
1731
+ * 创建区块
1732
+ * @param block 区块
1733
+ */
1734
+ createBlock(block: BlockFile, silent?: boolean): void;
1735
+ updateBlock(block: BlockFile, silent?: boolean): void;
1736
+ cloneBlock(block: BlockFile, silent?: boolean): void;
1737
+ removeBlock(id: string, silent?: boolean): void;
1738
+ existBlockName(name: string): boolean;
1739
+ existPageName(name: string): boolean;
1740
+ getBlock(id: string): BlockFile | null;
1741
+ getFile(id: string): PageFile | BlockFile | null;
1742
+ lock(id: string): void;
1743
+ unlock(id: string): void;
1744
+ }
1745
+
1746
+ /**
1747
+ * 指令类型配置
1748
+ */
1749
+ /**
1750
+ * 内置指令类型集合
1751
+ */
1752
+ declare const BUILTIN_DIRECTIVES: readonly ["v-if", "v-show", "v-bind", "v-html"];
1753
+ /**
1754
+ * 循环指令类型集合
1755
+ */
1756
+ declare const LOOP_DIRECTIVES: readonly ["v-for"];
1757
+ /**
1758
+ * 双向绑定指令类型集合
1759
+ */
1760
+ declare const TWO_WAY_DIRECTIVES: readonly ["v-model", "v-model:value"];
1761
+ /**
1762
+ * 所有内置指令类型(包括循环和双向绑定)
1763
+ */
1764
+ declare const ALL_BUILTIN_DIRECTIVES: readonly ["v-if", "v-show", "v-bind", "v-html", "v-for", "v-model", "v-model:value"];
1765
+ /**
1766
+ * 指令类型
1767
+ */
1768
+ type DirectiveType = (typeof ALL_BUILTIN_DIRECTIVES)[number];
1769
+ /**
1770
+ * 指令分组配置
1771
+ */
1772
+ interface DirectiveGroup {
1773
+ key: string;
1774
+ title: string;
1775
+ types: readonly string[];
1776
+ maxCount?: number;
1777
+ defaultValues?: Record<string, any>;
1778
+ }
1779
+ /**
1780
+ * 指令分组定义
1781
+ */
1782
+ declare const DIRECTIVE_GROUPS: DirectiveGroup[];
1783
+ /**
1784
+ * 获取指令的默认值
1785
+ */
1786
+ declare function getDirectiveDefaultValue(directiveName: string): any;
1787
+ /**
1788
+ * 判断指令是否属于指定分组
1789
+ */
1790
+ declare function isDirectiveInGroup(directiveName: string, groupKey: string): boolean;
1791
+ /**
1792
+ * 获取指令所属的分组
1793
+ */
1794
+ declare function getDirectiveGroup(directiveName: string): string | null;
1795
+
1796
+ /**
1797
+ * HTML标签集合
1798
+ */
1799
+ declare const HTML_TAGS: string[];
1800
+
1801
+ type ModelEventType = 'create' | 'update' | 'delete' | 'clone' | 'clear' | 'load' | 'publish' | 'gen';
1802
+ /**
1803
+ * 项目信息更新时触发事件
1804
+ */
1805
+ declare const EVENT_PROJECT_CHANGE = "EVENT_PROJECT_CHANGE";
1806
+ declare const EVENT_PROJECT_ACTIVE = "EVENT_PROJECT_ACTIVE";
1807
+ declare const EVENT_PROJECT_DEPS_CHANGE = "EVENT_PROJECT_DEPS_CHANGE";
1808
+ declare const EVENT_PROJECT_PAGES_CHANGE = "EVENT_PROJECT_PAGES_CHANGE";
1809
+ declare const EVENT_PROJECT_BLOCKS_CHANGE = "EVENT_PROJECT_BLOCKS_CHANGE";
1810
+ declare const EVENT_PROJECT_APIS_CHANGE = "EVENT_PROJECT_APIS_CHANGE";
1811
+ declare const EVENT_PROJECT_META_CHANGE = "EVENT_PROJECT_META_CHANGE";
1812
+ declare const EVENT_PROJECT_PUBLISH = "EVENT_PROJECT_PUBLISH";
1813
+ declare const EVENT_PROJECT_FILE_PUBLISH = "EVENT_PROJECT_FILE_PUBLISH";
1814
+ declare const EVENT_PROJECT_GEN_SOURCE = "EVENT_PROJECT_GEN_SOURCE";
1815
+ declare const EVENT_BLOCK_CHANGE = "EVENT_BLOCK_CHANGE";
1816
+ declare const EVENT_NODE_CHANGE = "EVENT_NODE_CHANGE";
1817
+ interface ProjectModelEvent {
1818
+ model: ProjectModel;
1819
+ type: ModelEventType;
1820
+ data: any;
1821
+ }
1822
+ interface Events extends Record<string | symbol, unknown> {
1823
+ [EVENT_PROJECT_CHANGE]: ProjectModelEvent;
1824
+ [EVENT_PROJECT_ACTIVE]: ProjectModelEvent;
1825
+ [EVENT_PROJECT_DEPS_CHANGE]: ProjectModelEvent;
1826
+ [EVENT_PROJECT_PAGES_CHANGE]: ProjectModelEvent;
1827
+ [EVENT_PROJECT_BLOCKS_CHANGE]: ProjectModelEvent;
1828
+ [EVENT_PROJECT_APIS_CHANGE]: ProjectModelEvent;
1829
+ [EVENT_PROJECT_META_CHANGE]: ProjectModelEvent;
1830
+ [EVENT_PROJECT_PUBLISH]: ProjectModelEvent;
1831
+ [EVENT_PROJECT_FILE_PUBLISH]: ProjectModelEvent;
1832
+ [EVENT_PROJECT_GEN_SOURCE]: ProjectModelEvent;
1833
+ [EVENT_BLOCK_CHANGE]: BlockModel;
1834
+ [EVENT_NODE_CHANGE]: NodeModel;
1835
+ }
1836
+ declare const emitter: mitt.Emitter<Events>;
1837
+
1838
+ declare const assetTabConfig: AssetTabItem[];
1839
+ /**
1840
+ * 系统资产组
1841
+ */
1842
+ declare const systemAssetGroups: AssetGroup[];
1843
+ /**
1844
+ * 自定义资产组
1845
+ */
1846
+ declare const customAssetGroups: AssetGroup[];
1847
+
1848
+ declare const templateTabConfig: TemplateTabItem[];
1849
+
1850
+ /**
1851
+ * 应用配置
1852
+ */
1853
+ declare const widgetAppsConfig: Widget[];
1854
+ /**
1855
+ * 应用配置
1856
+ */
1857
+ declare const widgetDialogConfig: Widget[];
1858
+ /**
1859
+ * 配置导航配置
1860
+ */
1861
+ declare const widgetConfigNavConfig: Widget[];
1862
+ /**
1863
+ * 配置导航配置
1864
+ */
1865
+ declare const widgetConfigTabsConfig: Widget[];
1866
+
1867
+ declare const naiveUIComponents: MaterialDescription[];
1868
+
1869
+ declare const systemComponents: MaterialDescription[];
1870
+
1871
+ declare const ximaxUIComponents: MaterialDescription[];
1872
+ declare const ximaxUIComponentsBasic: MaterialDescription[];
1873
+ declare const ximaxUIComponentsContainer: MaterialDescription[];
1874
+ declare const ximaxUIComponentsInput: MaterialDescription[];
1875
+ declare const ximaxUIComponentsDisplay: MaterialDescription[];
1876
+ declare const ximaxUIComponentsCallback: MaterialDescription[];
1877
+
1878
+ /**
1879
+ * 构建树形数据
1880
+ * @param items 数据
1881
+ * @returns 树形数据
1882
+ */
1883
+ declare const buildTreeData: (items: Recordable[]) => any[];
1884
+
1885
+ /**
1886
+ * 检查值是否为 JSExpression 类型
1887
+ */
1888
+ declare function isJSExpression(value: any): value is JSExpression;
1889
+ /**
1890
+ * 检查值是否为 JSFunction 类型
1891
+ */
1892
+ declare function isJSFunction(value: any): value is JSFunction;
1893
+ /**
1894
+ * 获取属性值
1895
+ * 如果值是 JSExpression 或 JSFunction 类型,则返回其 value 属性
1896
+ * @param value 属性值
1897
+ * @param blockState 块级状态,用于 JSExpression 和 JSFunction 的执行上下文
1898
+ * @returns 处理后的值
1899
+ */
1900
+ declare function getPropValue(key: string, value: JSONValue | JSExpression | JSFunction, context?: Recordable): any;
1901
+ /**
1902
+ * 批量获取属性值
1903
+ * @param props 属性对象
1904
+ * @returns 处理后的属性对象
1905
+ */
1906
+ declare function getPropsValues(props: Record<string, any>, context?: Recordable): Record<string, any>;
1907
+
1908
+ export { ALL_BUILTIN_DIRECTIVES, type ApiConfig, type ApiMethod, type ApiSchema, type AssetGroup, type AssetTabItem, type AssetType, BUILTIN_DIRECTIVES, type BlockEmit, type BlockFile, type BlockInject, type BlockMethod, BlockModel, type BlockProp, type BlockPropTypeImport, type BlockProvide, type BlockSchema, type BlockSlot, type BlockState, type BlockWatch, type CurrentDesignerHelper, DIRECTIVE_GROUPS, type DataSourceSchema, type DataSourceType, type DataType, type Dependency, type DesignerElement, type DesignerHelper, type DesignerRect, type DirectiveGroup, DirectiveModel, type DirectiveType, type DragBoxData, type DropPosition, type DynamicSlotInfo, EVENT_BLOCK_CHANGE, EVENT_NODE_CHANGE, EVENT_PROJECT_ACTIVE, EVENT_PROJECT_APIS_CHANGE, EVENT_PROJECT_BLOCKS_CHANGE, EVENT_PROJECT_CHANGE, EVENT_PROJECT_DEPS_CHANGE, EVENT_PROJECT_FILE_PUBLISH, EVENT_PROJECT_GEN_SOURCE, EVENT_PROJECT_META_CHANGE, EVENT_PROJECT_PAGES_CHANGE, EVENT_PROJECT_PUBLISH, type EnhanceConfig, EventModel, type ExtensionConfig, type FileType, type FlowNodeType, HTML_TAGS, type HistoryItem, type HistorySchema, type ImportStatement, type JSExpression, type JSFunction, type JSONArray, type JSONObject, type JSONValue, LOOP_DIRECTIVES, type MarketInstallInfo, type Material, type MaterialCategory, type MaterialDescription, type MaterialEvent, type MaterialProp, type MaterialSetter, type MaterialSlot, type MetaSchema, type ModelEventType, type NodeChildren, type NodeDirective, type NodeDirectiveIterator, type NodeEvent, type NodeEvents, type NodeFrom, type NodeFromPlugin, type NodeFromSchema, type NodeFromUrlSchema, NodeModel, type NodeModifiers, type NodeProps, type NodeSchema, type NodeSlot, type NodeSlotContent, type PageFile, type ParseVueOptions, type PlatformType, type PopupDisplayConfig, type PopupPageConfig, ProjectModel, type ProjectModelEvent, type ProjectSchema, PropModel, RegionType, type RendererContext, type RendererNodeProps, type Setter, type StaticFileInfo, TWO_WAY_DIRECTIVES, type TemplateDescription, type TemplateDto, type TemplateGroup, type TemplateTabItem, type TemplateType, type VueComponent, type Widget, assetTabConfig, buildTreeData, customAssetGroups, emitter, getDirectiveDefaultValue, getDirectiveGroup, getPropValue, getPropsValues, isDirectiveInGroup, isJSExpression, isJSFunction, naiveUIComponents, systemAssetGroups, systemComponents, templateTabConfig, widgetAppsConfig, widgetConfigNavConfig, widgetConfigTabsConfig, widgetDialogConfig, ximaxUIComponents, ximaxUIComponentsBasic, ximaxUIComponentsCallback, ximaxUIComponentsContainer, ximaxUIComponentsDisplay, ximaxUIComponentsInput };