@geelato/gl-runtime-core 0.0.1

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.
Files changed (117) hide show
  1. package/dist/gl-runtime-core.css +1 -0
  2. package/dist/gl-runtime-core.css.gz +0 -0
  3. package/dist/gl-runtime-core.js +169768 -0
  4. package/dist/gl-runtime-core.js.gz +0 -0
  5. package/dist/gl-runtime-core.umd.cjs +35 -0
  6. package/dist/iconfont-BJ2VOOKJ.js +35 -0
  7. package/dist/iconfont-BJ2VOOKJ.js.gz +0 -0
  8. package/dist/types/actions/JsScriptExecutor.d.ts +291 -0
  9. package/dist/types/actions/fns/datetime.d.ts +22 -0
  10. package/dist/types/actions/fns/device.d.ts +23 -0
  11. package/dist/types/actions/fns/math.d.ts +27 -0
  12. package/dist/types/api/EntityApi.d.ts +143 -0
  13. package/dist/types/api/EntityDataSource.d.ts +272 -0
  14. package/dist/types/api/EntityDeleteService.d.ts +47 -0
  15. package/dist/types/api/EntityQueryCache.d.ts +62 -0
  16. package/dist/types/api/EntityQueryService.d.ts +71 -0
  17. package/dist/types/api/EntityResultMapping.d.ts +11 -0
  18. package/dist/types/api/EntitySaveService.d.ts +46 -0
  19. package/dist/types/api/EntityTypes.d.ts +135 -0
  20. package/dist/types/api/EntityUtilService.d.ts +42 -0
  21. package/dist/types/assets/globalConfig.d.ts +5 -0
  22. package/dist/types/components/AppProvideProxy.d.ts +21 -0
  23. package/dist/types/components/ComponentTreeParser.d.ts +17 -0
  24. package/dist/types/components/FormProvideProxy.d.ts +35 -0
  25. package/dist/types/components/Hooks.d.ts +7 -0
  26. package/dist/types/components/PageDataSourceManager.d.ts +28 -0
  27. package/dist/types/components/PageLoader.d.ts +6 -0
  28. package/dist/types/components/PageProvideProxy.d.ts +413 -0
  29. package/dist/types/components/UiEventNames.d.ts +15 -0
  30. package/dist/types/components/gl-chart/GlChart.vue.d.ts +135 -0
  31. package/dist/types/components/gl-component/GlComponent.vue.d.ts +191 -0
  32. package/dist/types/components/gl-component/GlComponentSupport.d.ts +49 -0
  33. package/dist/types/components/gl-component/GlInsts.vue.d.ts +19 -0
  34. package/dist/types/components/gl-div/GlDiv.vue.d.ts +107 -0
  35. package/dist/types/components/gl-dnd-placeholder/Index.vue.d.ts +112 -0
  36. package/dist/types/components/gl-html/Index.vue.d.ts +7 -0
  37. package/dist/types/components/gl-iconfont/IconsJson.d.ts +15 -0
  38. package/dist/types/components/gl-iconfont/Index.vue.d.ts +19 -0
  39. package/dist/types/components/gl-loader/GlLoader.vue.d.ts +3 -0
  40. package/dist/types/components/gl-login/FloatingActionButton.vue.d.ts +9 -0
  41. package/dist/types/components/gl-login/LoginDialog.vue.d.ts +9 -0
  42. package/dist/types/components/gl-loop/GlLoop.vue.d.ts +230 -0
  43. package/dist/types/components/gl-page-viewer/GlPageViewer.vue.d.ts +221 -0
  44. package/dist/types/components/gl-scanner/GlScanner.vue.d.ts +44 -0
  45. package/dist/types/components/gl-template/GlTemplate.vue.d.ts +154 -0
  46. package/dist/types/components/gl-template/Typs.d.ts +4 -0
  47. package/dist/types/components/gl-virtual/Index.vue.d.ts +3 -0
  48. package/dist/types/components/mixins.d.ts +86 -0
  49. package/dist/types/components/ui-mixins.d.ts +16 -0
  50. package/dist/types/composables/useApiUrl.d.ts +30 -0
  51. package/dist/types/composables/useGlobal.d.ts +21 -0
  52. package/dist/types/composables/useLoading.d.ts +6 -0
  53. package/dist/types/composables/useLogger.d.ts +32 -0
  54. package/dist/types/composables/useMessages.d.ts +15 -0
  55. package/dist/types/composables/useRole.d.ts +5 -0
  56. package/dist/types/locales/index.d.ts +21 -0
  57. package/dist/types/locales/lang/en-US.d.ts +4 -0
  58. package/dist/types/locales/lang/zh-CN.d.ts +4 -0
  59. package/dist/types/m/datasource/ApplicationApi.d.ts +163 -0
  60. package/dist/types/m/datasource/ArcoApi.d.ts +76 -0
  61. package/dist/types/m/datasource/Base.d.ts +99 -0
  62. package/dist/types/m/datasource/BranchApi.d.ts +2 -0
  63. package/dist/types/m/datasource/CompanyApi.d.ts +49 -0
  64. package/dist/types/m/datasource/DictApi.d.ts +127 -0
  65. package/dist/types/m/datasource/DictionaryApi.d.ts +16 -0
  66. package/dist/types/m/datasource/EncodingApi.d.ts +59 -0
  67. package/dist/types/m/datasource/Entry.d.ts +5 -0
  68. package/dist/types/m/datasource/FieldMeta.d.ts +6 -0
  69. package/dist/types/m/datasource/FileApi.d.ts +273 -0
  70. package/dist/types/m/datasource/FileTemplateApi.d.ts +114 -0
  71. package/dist/types/m/datasource/InterApi.d.ts +104 -0
  72. package/dist/types/m/datasource/MarketApi.d.ts +191 -0
  73. package/dist/types/m/datasource/MessageApi.d.ts +27 -0
  74. package/dist/types/m/datasource/ModelApi.d.ts +327 -0
  75. package/dist/types/m/datasource/NoticeApi.d.ts +37 -0
  76. package/dist/types/m/datasource/OcrPdfApi.d.ts +145 -0
  77. package/dist/types/m/datasource/PluginApi.d.ts +35 -0
  78. package/dist/types/m/datasource/ScheduleApi.d.ts +67 -0
  79. package/dist/types/m/datasource/SecurityApi.d.ts +253 -0
  80. package/dist/types/m/datasource/SiteApi.d.ts +38 -0
  81. package/dist/types/m/datasource/SqlApi.d.ts +45 -0
  82. package/dist/types/m/datasource/SysConfigApi.d.ts +52 -0
  83. package/dist/types/m/datasource/TenantApi.d.ts +107 -0
  84. package/dist/types/m/datasource/UserApi.d.ts +173 -0
  85. package/dist/types/m/datasource/VersionApi.d.ts +59 -0
  86. package/dist/types/m/datasource/WeChatApi.d.ts +34 -0
  87. package/dist/types/m/datasource/WorkflowApi.d.ts +317 -0
  88. package/dist/types/m/datasource/ZxingApi.d.ts +38 -0
  89. package/dist/types/main.d.ts +114 -0
  90. package/dist/types/store/index.d.ts +2 -0
  91. package/dist/types/store/modules/user/index.d.ts +16 -0
  92. package/dist/types/types/Operators.d.ts +19 -0
  93. package/dist/types/types/global.d.ts +198 -0
  94. package/dist/types/types/options.d.ts +35 -0
  95. package/dist/types/utils/Auth.d.ts +37 -0
  96. package/dist/types/utils/CacheManager.d.ts +110 -0
  97. package/dist/types/utils/CheckUtil.d.ts +5 -0
  98. package/dist/types/utils/ClipboardUtil.d.ts +24 -0
  99. package/dist/types/utils/ConvertUtil.d.ts +81 -0
  100. package/dist/types/utils/Event.d.ts +2 -0
  101. package/dist/types/utils/FileUtil.d.ts +7 -0
  102. package/dist/types/utils/GenerateUtil.d.ts +14 -0
  103. package/dist/types/utils/IsUtil.d.ts +126 -0
  104. package/dist/types/utils/MixUtil.d.ts +49 -0
  105. package/dist/types/utils/Monitor.d.ts +2 -0
  106. package/dist/types/utils/PageUtil.d.ts +14 -0
  107. package/dist/types/utils/PluginUtil.d.ts +9 -0
  108. package/dist/types/utils/RecordsUtil.d.ts +3 -0
  109. package/dist/types/utils/SseClient.d.ts +34 -0
  110. package/dist/types/utils/StoreUtil.d.ts +8 -0
  111. package/dist/types/utils/StringUtil.d.ts +29 -0
  112. package/dist/types/utils/Utils.d.ts +217 -0
  113. package/dist/types/utils/emitter.d.ts +3 -0
  114. package/dist/types/utils/renderTemplate.d.ts +6 -0
  115. package/dist/types/utils/toChineseCurrency.d.ts +5 -0
  116. package/package.json +76 -0
  117. package/src/main.ts +498 -0
Binary file
@@ -0,0 +1,291 @@
1
+ import { App, ComponentPublicInstance, ComponentOptionsBase, ComponentProvideOptions, ComponentInternalInstance, VNode, RendererNode, RendererElement } from 'vue';
2
+ import { IAction } from '@geelato/gl-types';
3
+ import { default as PageProvideProxy } from '../components/PageProvideProxy.ts';
4
+ import { Param, Geelato } from '../types/global.ts';
5
+ import { EntityReader, EntitySaver } from '../api/EntityDataSource.ts';
6
+ type OptionsType = {
7
+ [key: string]: any;
8
+ };
9
+ export declare class Ctx {
10
+ pageProxy?: PageProvideProxy;
11
+ [key: string]: any;
12
+ }
13
+ export declare class JsScriptExecutor {
14
+ app: App | undefined;
15
+ pageIds: string[];
16
+ $gl: {};
17
+ private activePageId;
18
+ constructor();
19
+ /**
20
+ * 设置整个vue的应用信息,一般在组件库插件初始化时调用
21
+ * @param app
22
+ */
23
+ setApp(app: App): void;
24
+ /**
25
+ * 设置当前执行页面的代理对象
26
+ * 一般在执行页面中调用该方法
27
+ * 支持多页面嵌套场景,每个页面是一个pageProxy,以pageComponentId进行标识区分
28
+ * @param pageComponentId 组件名为GlPage的组件id
29
+ * @param pageProxy
30
+ */
31
+ addPageProxy(pageComponentId: string, pageProxy: PageProvideProxy): void;
32
+ getPageProxy(pageComponentId: string): PageProvideProxy | undefined;
33
+ getPageProxyMapSize(): number;
34
+ getPageProxyMapKeys(): string[];
35
+ getPageProxyDebugStats(): {
36
+ size: number;
37
+ keys: string[];
38
+ pageIds: string[];
39
+ pages: Record<string, any>;
40
+ activePageId: string;
41
+ };
42
+ /**
43
+ * 设置当前激活的页面(多标签场景下)
44
+ * 在多标签切换时调用,用于解决组件ID重复时的事件映射问题
45
+ * @param pageComponentId 组件名为GlPage的组件id
46
+ */
47
+ setActivePage(pageComponentId: string): void;
48
+ /**
49
+ * 获取当前激活的页面ID
50
+ * @returns 当前激活页面的pageComponentId
51
+ */
52
+ getActivePageId(): string;
53
+ /**
54
+ * 清除当前激活的页面
55
+ * 在页面关闭时调用
56
+ */
57
+ clearActivePage(): void;
58
+ /**
59
+ * 删除当前执行页面的代理对象
60
+ * 一般在页面关闭时执行
61
+ * @param pageComponentId 组件名为GlPage的组件id
62
+ */
63
+ removePageProxy(pageComponentId: string): void;
64
+ /**
65
+ * 获取组件名称
66
+ * @param componentId
67
+ */
68
+ getComponentName(componentId: string): any;
69
+ /**
70
+ * 获取组件的方法
71
+ * 先从真实的组件中获取方法,获取不到,则从包装的组件GlComponent中获取公共方法
72
+ * @param componentId
73
+ * @param methodName
74
+ */
75
+ getComponentMethod(componentId: string, methodName: string): any;
76
+ /**
77
+ * 设置组件属性
78
+ * @param componentId
79
+ * @param props
80
+ */
81
+ setComponentProps(componentId: string, props: {
82
+ [key: string]: any;
83
+ }): void;
84
+ /**
85
+ * 获取组件属性
86
+ * @param componentId
87
+ */
88
+ getComponentProps(componentId: string): any;
89
+ /**
90
+ * 获取页面的参数
91
+ * @param pageComponentId
92
+ */
93
+ getParams(pageComponentId: string): Param[] | null;
94
+ /**
95
+ * 获取当前页面所有的参数
96
+ */
97
+ getPageParams($gl: Geelato): Param[] | null;
98
+ /**
99
+ * 获取当前页面的参数
100
+ * @param paramName
101
+ * @param $gl
102
+ */
103
+ getPageParam(paramName: string, $gl: Geelato): any;
104
+ /**
105
+ * 是否存在参数
106
+ * @param paramName
107
+ * @param $gl
108
+ */
109
+ hasPageParam(paramName: string, $gl: Geelato): boolean;
110
+ /**
111
+ * 触发组件的动作事件
112
+ * @param componentId
113
+ * @param actionName 动名名(注意,非事件名eventName,一个事件可以触发多个动作)
114
+ * @param ctx 上下文,用于传递参数,在ctx中不可以传入参数pageProxy
115
+ * @param callback
116
+ * @param gl
117
+ */
118
+ triggerComponentAction(componentId: string, actionName: string, ctx?: {
119
+ _triggerParam: any;
120
+ [key: string]: any;
121
+ }, callback?: Function, gl?: Geelato): Promise<any> | undefined;
122
+ /**
123
+ * 获取组件值
124
+ * @param componentId
125
+ */
126
+ getComponentValue(componentId: string): any;
127
+ private getVarsConvertFns;
128
+ private getFeedbackFns;
129
+ private getOtherFns;
130
+ private getI18nFns;
131
+ private getLogicFns;
132
+ private getComponentFns;
133
+ /**
134
+ * 获取组件值
135
+ * @param componentId
136
+ * @param value
137
+ */
138
+ setComponentValue(componentId: string, value: any): ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}, {}, {}, string, ComponentProvideOptions>, {}, {}, "", {}, any> | null | undefined;
139
+ /**
140
+ * 点击等事件
141
+ * @param action 组件中的事件配置信息
142
+ * @param ctx 调用该方法的组件所在的上下文信息,如列表的行信息
143
+ * @param callback
144
+ * @param gl 如果多个表达式需要用同一下$gl时,可以传进来,不在本方法内创建
145
+ */
146
+ doAction(action: IAction, ctx: Ctx, callback?: Function, gl?: Geelato): Promise<any>;
147
+ /**
148
+ * 执行表达式
149
+ * @param expression 脚本信息,方法体
150
+ * @param ctx 调用该方法的组件所在的上下文信息,如列表的行信息
151
+ * @param callback
152
+ * @param gl 如果多个表达式需要用同一下$gl时,可以传进来,不在本方法内创建
153
+ * @param errorMessage 错误信息
154
+ * @param solutionDescription 错误的解决方案描述
155
+ */
156
+ evalExpression(expression: string, ctx: Ctx, callback?: Function, gl?: Geelato, errorMessage?: string, solutionDescription?: string): any;
157
+ /**
158
+ * 执行函数
159
+ * @param fnBodyScript 脚本信息,方法体
160
+ * @param ctx 调用该方法的组件所在的上下文信息,如列表的行信息
161
+ * @param callback
162
+ * @param gl 如果多个表达式需要用同一下$gl时,可以传进来,不在本方法内创建
163
+ * @param async 对于fnBody里有wait的场景,可以设置async为true
164
+ */
165
+ evalFn(fnBodyScript: string, ctx: Ctx, callback?: Function, gl?: Geelato, async?: boolean): any;
166
+ /**
167
+ * 执行参数,valueExpression值优先,将参数中的valueExpression值表达式计算结果保存到value中
168
+ * @param params
169
+ * @param ctx
170
+ * @param gl 如果多个表达式需要用同一下$gl时,可以传进来,不在本方法内创建
171
+ */
172
+ evalParams(params: Array<Param>, ctx: Ctx, gl?: Geelato): Param[];
173
+ /**
174
+ * 打开页面模板时,可动态设置模板的属性
175
+ * @param props 示例如下:
176
+ * {
177
+ * "label": "订单调账申请流程",
178
+ * "procInstId": "1044706817799999999",
179
+ * "procDefId": "5044706817716916224",
180
+ * "_propsExpressions": {
181
+ * "bizId": "$gl.ctx.record.id"
182
+ * }
183
+ * }
184
+ * @param ctx
185
+ * @param gl
186
+ * @return Record 输出结果示例:
187
+ * {
188
+ * "label": "订单调账申请流程",
189
+ * "procInstId": "1044706817799999999",
190
+ * "procDefId": "5044706817716916224",
191
+ * "bizId":"1231968177169162131",
192
+ * "_propsExpressions": {
193
+ * "bizId": "$gl.ctx.record.id"
194
+ * }
195
+ * }
196
+ */
197
+ evalProps(props: Record<string, any>, ctx: Ctx, gl?: Geelato): Record<string, any>;
198
+ /**
199
+ * 数组参数格式转成对象参数格式
200
+ * 注意参数名不要重复
201
+ * @param params
202
+ */
203
+ convertParamsToObject(params: Array<Param>): Record<string, any>;
204
+ /**
205
+ *
206
+ * @param items
207
+ * @param ctx {pageProxy,...} 上下文中需要传输pageProxy
208
+ * @param gl 如果多个表达式需要用同一下$gl时,可以传进来,不在本方法内创建
209
+ */
210
+ evalValueExpressions(items: Array<{
211
+ value?: any;
212
+ valueExpression?: string;
213
+ [key: string]: any;
214
+ }>, ctx: Ctx, gl?: Geelato): {
215
+ [key: string]: any;
216
+ value?: any;
217
+ valueExpression?: string;
218
+ }[];
219
+ /**
220
+ * 转换选项中的表达式
221
+ * @param options
222
+ * @param ctx
223
+ * @param evalKeys 指定需要转换值的选项keys,如:['title', 'content']
224
+ * @param gl 如果多个表达式需要用同一下$gl时,可以传进来,不在本方法内创建
225
+ */
226
+ evalOptions(options: OptionsType, ctx: Ctx, evalKeys: string[], gl?: Geelato): OptionsType;
227
+ /**
228
+ * entityReader 的参数存在变量的情况,需要先进行转换
229
+ * @param entityReader
230
+ */
231
+ convertEntityReader(entityReader: EntityReader, $gl: Geelato): EntityReader;
232
+ /**
233
+ * entitySaver 的参数存在变量的情况,需要先进行转换
234
+ * @param entitySaver
235
+ * @param $gl
236
+ */
237
+ convertEntitySaver(entitySaver: EntitySaver, $gl: Geelato): EntitySaver;
238
+ /**
239
+ * 从多个pageProxy中获取ref
240
+ * 优先从当前激活页面获取(多标签场景下),解决组件ID重复问题
241
+ * @param componentId
242
+ */
243
+ getRef(componentId: string): ComponentInternalInstance | null;
244
+ /**
245
+ * 获取组件实例信息
246
+ * 提供两种组织方式,inst和insts,对于inst,key为组件id,对于insts的key为页面id
247
+ */
248
+ getRefs(): {
249
+ ref: object;
250
+ refs: object;
251
+ };
252
+ /**
253
+ * 获取组件配置实例信息
254
+ * 优先从当前激活页面获取(多标签场景下),解决组件ID重复问题
255
+ * @param componentId
256
+ */
257
+ getComponentInst(componentId: string): any;
258
+ /**
259
+ * 获取组件实例信息
260
+ * 提供两种组织方式,inst和insts,对于inst,key为组件id,对于insts的key为页面id
261
+ */
262
+ getComponentInsts(): {
263
+ inst: Record<string, any>;
264
+ insts: Record<string, any>;
265
+ };
266
+ /**
267
+ * 获取当前环境下,可执行的方法、全局变量
268
+ *
269
+ */
270
+ getGl(pageProxy?: PageProvideProxy): Geelato;
271
+ /**
272
+ * 加载页面
273
+ * @param pageId 页面ID
274
+ * @param extendId 应用页面树节点ID
275
+ * @param params
276
+ * @param pageStatus 页面状态
277
+ * @param pageTemplateName
278
+ * @param pageTemplateProps
279
+ */
280
+ loadPage(pageId: string, extendId: string, params: Array<Param>, pageStatus?: string, pageTemplateName?: string, pageTemplateProps?: object): VNode<RendererNode, RendererElement, {
281
+ [key: string]: any;
282
+ }>;
283
+ /**
284
+ * 加载全局注册的组件
285
+ */
286
+ loadComponent(componentName: string, props: Record<string, any>): VNode<RendererNode, RendererElement, {
287
+ [key: string]: any;
288
+ }>;
289
+ }
290
+ declare const jsScriptExecutor: JsScriptExecutor;
291
+ export default jsScriptExecutor;
@@ -0,0 +1,22 @@
1
+ export declare const useDateTimeFns: () => {
2
+ /**
3
+ * 格式化日期
4
+ * 没有参数,返回当前格式化时间。
5
+ * 有效时间,返回格式化后的日期。
6
+ * 无效时间、无效默认值,返回当前格式化时间。
7
+ * 无效时间、有效默认值,返回默认值。
8
+ * @param date 日期
9
+ * @param format 格式
10
+ * @param defaultValue 默认值
11
+ * @returns 格式化后的日期
12
+ */
13
+ dateText(date?: Date, format?: string, defaultValue?: string): string;
14
+ /**
15
+ * 获取日期范围,默认返回当前日期和当前日期加1天的范围。
16
+ * @param startDate 开始日期
17
+ * @param addSeconds 增加的秒数
18
+ * @param format 格式,默认'YYYY-MM-DD HH:mm:ss'
19
+ * @returns 格式化后的日期范围
20
+ */
21
+ dateBetween(startDate?: Date, addSeconds?: number, format?: string): string[];
22
+ };
@@ -0,0 +1,23 @@
1
+ import { Geelato } from '../../types/global';
2
+ type ScanBarCodeResult = {
3
+ text: string | null;
4
+ result: unknown | null;
5
+ status: 'cancelled' | 'success';
6
+ };
7
+ type ScanBarCodeOptions = {
8
+ title?: string;
9
+ multiple?: boolean;
10
+ separator?: string;
11
+ scanKinds?: Array<'qr' | 'barcode'>;
12
+ barcodeFormats?: string[];
13
+ onSuccess?: (text: string, result: unknown) => void;
14
+ onScan?: (text: string, result: unknown, meta: {
15
+ duplicated: boolean;
16
+ index: number;
17
+ }) => void;
18
+ onComplete?: (text: string, result: unknown) => void;
19
+ };
20
+ export declare const useDeviceFns: ($gl: Geelato) => {
21
+ scanBarCode: (options?: ScanBarCodeOptions) => Promise<ScanBarCodeResult>;
22
+ };
23
+ export {};
@@ -0,0 +1,27 @@
1
+ import { default as Big, BigSource } from 'big.js';
2
+ export declare const useMathFns: () => {
3
+ newBig(value: BigSource): Big.Big;
4
+ plus(value1: BigSource, value2: BigSource): Big.Big;
5
+ minus(value1: BigSource, value2: BigSource): Big.Big;
6
+ times(value1: BigSource, value2: BigSource): Big.Big;
7
+ div(value1: BigSource, value2: BigSource): Big.Big;
8
+ abs(value: BigSource): Big.Big;
9
+ eq(value1: BigSource, value2: BigSource): boolean;
10
+ gt(value1: BigSource, value2: BigSource): boolean;
11
+ gte(value1: BigSource, value2: BigSource): boolean;
12
+ lt(value1: BigSource, value2: BigSource): boolean;
13
+ lte(value1: BigSource, value2: BigSource): boolean;
14
+ mod(value: BigSource, value2: BigSource): Big.Big;
15
+ neg(value: BigSource): Big.Big;
16
+ pow(value: BigSource, value2: number): Big.Big;
17
+ prec(sd: number, rm: number): Big.Big;
18
+ round(dp: number, rm: number): Big.Big;
19
+ sqrt(value: BigSource): Big.Big;
20
+ toExponential(dp: number, rm: number): string;
21
+ toFixed(dp: number, rm: number): string;
22
+ toFixedAsNumber(dp: number, rm: number): number;
23
+ toPrecision(sd: number, rm: number): string;
24
+ toNumber(value: BigSource): number;
25
+ toString(value: BigSource): string;
26
+ valueOf(value: BigSource): string;
27
+ };
@@ -0,0 +1,143 @@
1
+ import { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosStatic } from 'axios';
2
+ import { EntityReader, EntitySaver, EntityDeleter } from './EntityDataSource.ts';
3
+ import { MqlObject, EntityFullMetadata } from './EntityTypes';
4
+ import { Geelato, ApiResult } from '../types/global.ts';
5
+ export declare class EntityApi {
6
+ private readonly url;
7
+ private service;
8
+ private readonly VITE_API_BASE_URL;
9
+ private options?;
10
+ private queryService;
11
+ private saveService;
12
+ private deleteService;
13
+ private utilService;
14
+ constructor();
15
+ getAuthorization(): string | undefined;
16
+ setup(axios: AxiosStatic | AxiosInstance): void;
17
+ getAxios(): AxiosStatic | AxiosInstance;
18
+ queryByMql(mql: MqlObject | Array<MqlObject>, withMeta?: boolean, disabledClientQueryCache?: boolean, bizCode?: string): Promise<any>;
19
+ /**
20
+ * 对entityReader.params中的表达式进行求值
21
+ * 直接将修改后的值赋值给entityReader.params
22
+ * @param entityReader
23
+ */
24
+ parseEntityReaderParams(entityReader: EntityReader, ctx: Record<string, any>, gl?: Geelato): void;
25
+ /**
26
+ * 将entityReader转换为MqlObject
27
+ * !! 注意:转换后的MqlObject中,params中的表达式未被求值,若需转换参数表达式的值,需要先调用evalEntityReaderParams方法
28
+ * @param entityReader
29
+ */
30
+ convertEntityReaderToMql(entityReader: EntityReader): MqlObject;
31
+ queryById(entityName: string, id: string, fieldNames: string, withMeta?: boolean, disabledClientQueryCache?: boolean, bizCode?: string): Promise<any>;
32
+ queryByEntityReader(entityReader: EntityReader, disabledClientQueryCache?: boolean, bizCode?: string): Promise<any>;
33
+ queryOneByEntityReader(entityReader: EntityReader, disabledClientQueryCache?: boolean, bizCode?: string): Promise<any>;
34
+ getFirstRecordFromRes(res: any): any;
35
+ getRecordsFromRes(res: any): any;
36
+ query(entityName: string, fieldNames: string, params: Record<string, any>, withMeta?: boolean, disabledClientQueryCache?: boolean, bizCode?: string, order?: string): Promise<any>;
37
+ queryBatch(queryParamArray: Array<object>, withMeta: boolean): Promise<any>;
38
+ saveEntity(entitySaver: EntitySaver, biz?: string): Promise<AxiosResponse<any, any>>;
39
+ saveBatchEntity(entitySavers: EntitySaver[], biz?: string): Promise<AxiosResponse<any, any>>;
40
+ save(entityName: string, keyValues: object, biz?: string, successMsg?: string, errorMsg?: string): Promise<AxiosResponse<any, any>>;
41
+ saveByMql(biz: string, mql: MqlObject | Array<MqlObject>): Promise<AxiosResponse<any, any>>;
42
+ saveBatch(entityName: string, records: Array<Record<string, any>>, biz?: string): Promise<AxiosResponse<any, any>>;
43
+ delete(entityName: string, keyValues: object, biz?: string): Promise<ApiResult>;
44
+ deleteById(entityName: string, id: string, biz?: string): Promise<ApiResult>;
45
+ deleteByIds(entityName: string, ids: string[], biz?: string): Promise<ApiResult>;
46
+ deleteBatch(items: Array<{
47
+ entityName: string;
48
+ keyValues: object;
49
+ }>, biz?: string): Promise<ApiResult[]>;
50
+ deleteByDeleter(entityDeleter: EntityDeleter, biz?: string): Promise<ApiResult>;
51
+ deleteBatchDeleter(entityDeleters: EntityDeleter[], biz?: string): Promise<ApiResult[]>;
52
+ entityDataMappingHandler(data: Record<string, any>, dataMapping?: Record<string, any>): Record<string, any>;
53
+ queryMeta(entityName: string): Promise<AxiosResponse<any, any>>;
54
+ queryEntityNames(): Promise<AxiosResponse<any, any>>;
55
+ queryMetaFullDefined(entityName: string): Promise<AxiosResponse<ApiResult<EntityFullMetadata>>>;
56
+ queryEntityLiteMetas(appCode?: string): Promise<AxiosResponse<any, any>>;
57
+ removeCache(keys: string): Promise<AxiosResponse<any, any>> | undefined;
58
+ checkFieldUniqueness(entityName: string, filedName: string, fieldValue: any, id?: string): Promise<AxiosResponse<any, any>>;
59
+ executeSqlKey(sqlKey: string, connectId: string, params: Record<string, any>): Promise<AxiosResponse<any, any>>;
60
+ /**
61
+ * 用于运行时,返回不带源码的数据
62
+ * 带个性化页面配置信息、权限信息
63
+ * @param idType
64
+ * @param id
65
+ */
66
+ queryPageAndCustomById(idType: 'pageId' | 'extendId', id: string): Promise<AxiosResponse<any, any>>;
67
+ /**
68
+ * 用于运行时,返回不带源码的数据
69
+ * 带个性化页面配置信息、权限信息
70
+ * @param idType
71
+ * @param id
72
+ */
73
+ queryPageCustomById(idType: 'pageId' | 'extendId', id: string): Promise<AxiosResponse<any, any>>;
74
+ /**
75
+ * 用于运行时,返回带语言的页面数据
76
+ * @param idType
77
+ * @param id
78
+ */
79
+ queryPageLangById(idType: 'pageId' | 'extendId', id: string): Promise<AxiosResponse<any, any>>;
80
+ /**
81
+ * 查询当前租户所有的字典
82
+ * @param allStatus 是否查询全部状态,默认为false,即只查询启用状态的字典
83
+ */
84
+ queryAllDict(allStatus?: boolean): Promise<any>;
85
+ /**
86
+ * 查询某dictId下的字典项
87
+ * @param dictId 字典ID
88
+ * @param allStatus 查询全部状态,默认为false,即只查询启用状态的字典项
89
+ */
90
+ queryDictItems(dictId: string, allStatus?: boolean): Promise<any>;
91
+ /**
92
+ * 查询多个dictId下的字典项
93
+ * @param dictIds
94
+ * @param allStatus 查询全部状态,默认为false,即只查询启用状态的字典项
95
+ */
96
+ queryMultiDictItems(dictIds: string[], allStatus?: boolean): Promise<any>;
97
+ /**
98
+ * 查询字典项
99
+ * @param dictId 字典ID
100
+ * @param dictItemCode 字典项编码
101
+ */
102
+ queryDictItem(dictId: string, dictItemCode: string): Promise<any>;
103
+ /**
104
+ * 用于设计时,返回带有源码的数据
105
+ * 不带个性化页面配置信息、权限信息
106
+ * @param extendId
107
+ */
108
+ queryPageByExtendId(extendId: string): Promise<AxiosResponse<any, any>>;
109
+ /**
110
+ * 用于设计时,返回带有源码的数据
111
+ * 不带个性化页面配置信息、权限信息
112
+ * @param pageId
113
+ */
114
+ queryPageById(pageId: string): Promise<AxiosResponse<any, any>>;
115
+ getService(): AxiosStatic | AxiosInstance;
116
+ getHeader(): Record<string, string>;
117
+ /**
118
+ * 解析URL
119
+ * 1. 如果url以http或https开头,直接返回
120
+ * 2. 否则,将url拼接到api基地址后,处理多余的斜杠
121
+ * @param url
122
+ */
123
+ resolveUrl(url: string): string;
124
+ /**
125
+ * 变更实体所有者
126
+ * 当前这条记录的所有者有这个变更权限,还有管理员有这个变更权限
127
+ * 例:
128
+ * changeOwner('1234567890123456789', {
129
+ * 'platform_dict': ['dict1', 'dict2'],
130
+ * 'platform_dict_item': ['item1', 'item2']
131
+ * })
132
+ * @param owner 新的所有者
133
+ * @param entityIdsMap 实体ID映射表,key为实体类型,value为实体ID数组
134
+ * @param config Axios请求配置
135
+ * @returns
136
+ */
137
+ changeOwner(owner: string, entityIdsMap: Record<string, Array<string>>, config?: AxiosRequestConfig): Promise<ApiResult>;
138
+ post<T = any, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<ApiResult>;
139
+ get<T = any, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<ApiResult>;
140
+ }
141
+ declare const entityApi: EntityApi;
142
+ export { entityApi };
143
+ export default EntityApi;