@kdesigner/core 0.0.0-alpha.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.
- package/README.md +56 -0
- package/dist/index.cjs +2373 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +627 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2281 -0
- package/dist/index.js.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/package.json +81 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
import { Pinia, Store } from "pinia";
|
|
2
|
+
import { Router } from "vue-router";
|
|
3
|
+
import { AxiosRequestConfig } from "axios";
|
|
4
|
+
import { Options } from "lru-cache";
|
|
5
|
+
import { Component } from "vue";
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/types/index.d.ts
|
|
8
|
+
interface TreeBean {
|
|
9
|
+
$type: string;
|
|
10
|
+
$body?: any;
|
|
11
|
+
[name: string]: any;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 后端服务返回的标准结果类型,一般情况下http响应码都是200.
|
|
15
|
+
* 后台出错时status不为0,且code和msg字段有值.
|
|
16
|
+
* 成功时status==0, 此时data字段用于传输返回数据
|
|
17
|
+
*/
|
|
18
|
+
interface ApiResponse {
|
|
19
|
+
status: number;
|
|
20
|
+
code?: string;
|
|
21
|
+
msg?: string;
|
|
22
|
+
msgTimeout?: number;
|
|
23
|
+
data: any;
|
|
24
|
+
bizFatal?: boolean;
|
|
25
|
+
errors?: {
|
|
26
|
+
[propName: string]: string;
|
|
27
|
+
};
|
|
28
|
+
headers?: {
|
|
29
|
+
[name: string]: any;
|
|
30
|
+
};
|
|
31
|
+
[propName: string]: any;
|
|
32
|
+
}
|
|
33
|
+
interface FetcherResult {
|
|
34
|
+
data?: ApiResponse;
|
|
35
|
+
status: number;
|
|
36
|
+
headers: any;
|
|
37
|
+
}
|
|
38
|
+
type FetcherRequest = ApiObject & {
|
|
39
|
+
config?: AjaxConfig;
|
|
40
|
+
delimiter?: string;
|
|
41
|
+
valueField?: string;
|
|
42
|
+
labelField?: string;
|
|
43
|
+
filter?: TreeBean;
|
|
44
|
+
responseKey?: string;
|
|
45
|
+
'gql:selection'?: string;
|
|
46
|
+
_page?: BasePage;
|
|
47
|
+
_scoped?: any;
|
|
48
|
+
};
|
|
49
|
+
interface AjaxConfig {
|
|
50
|
+
silent?: boolean;
|
|
51
|
+
withCredentials?: boolean;
|
|
52
|
+
cancelExecutor?: (cancel: Function) => void;
|
|
53
|
+
rawResponse?: boolean;
|
|
54
|
+
useAlert?: boolean;
|
|
55
|
+
useApiUrl?: boolean;
|
|
56
|
+
withToken?: boolean;
|
|
57
|
+
}
|
|
58
|
+
interface BasePage {
|
|
59
|
+
getAction(actionName: string): Function;
|
|
60
|
+
registerAction(actionName: string, fn: Function): void;
|
|
61
|
+
resetActions(): void;
|
|
62
|
+
}
|
|
63
|
+
interface BaseApiObject {
|
|
64
|
+
/**
|
|
65
|
+
* API 发送类型
|
|
66
|
+
*/
|
|
67
|
+
method?: 'get' | 'post' | 'put' | 'delete' | 'patch' | 'jsonp' | 'js';
|
|
68
|
+
/**
|
|
69
|
+
* API 发送目标地址
|
|
70
|
+
*/
|
|
71
|
+
url: string;
|
|
72
|
+
/**
|
|
73
|
+
* 用来控制携带数据. 当key 为 `&` 值为 `$$` 时, 将所有原始数据打平设置到 data 中. 当值为 $$ 将所有原始数据赋值到对应的 key 中. 当值为 $ 打头时, 将变量值设置到 key 中.
|
|
74
|
+
*/
|
|
75
|
+
data?: {
|
|
76
|
+
[propName: string]: any;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* 默认数据映射中的key如果带点,或者带大括号,会转成对象比如:
|
|
80
|
+
*
|
|
81
|
+
* {
|
|
82
|
+
* 'a.b': '123'
|
|
83
|
+
* }
|
|
84
|
+
*
|
|
85
|
+
* 经过数据映射后变成
|
|
86
|
+
* {
|
|
87
|
+
* a: {
|
|
88
|
+
* b: '123
|
|
89
|
+
* }
|
|
90
|
+
* }
|
|
91
|
+
*
|
|
92
|
+
* 如果想要关闭此功能,请设置 convertKeyToPath 为 false
|
|
93
|
+
*/
|
|
94
|
+
convertKeyToPath?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* 用来做接口返回的数据映射。
|
|
97
|
+
*/
|
|
98
|
+
responseData?: {
|
|
99
|
+
[propName: string]: any;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* 如果 method 为 get 的接口,设置了 data 信息。
|
|
103
|
+
* 默认 data 会自动附带在 query 里面发送给后端。
|
|
104
|
+
*
|
|
105
|
+
* 如果想通过 body 发送给后端,那么请把这个配置成 false。
|
|
106
|
+
*
|
|
107
|
+
* 但是,浏览器还不支持啊,设置了只是摆设。除非服务端支持 method-override
|
|
108
|
+
*/
|
|
109
|
+
attachDataToQuery?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* 发送体的格式
|
|
112
|
+
*/
|
|
113
|
+
dataType?: 'json' | 'form-data' | 'form';
|
|
114
|
+
/**
|
|
115
|
+
* 如果是文件下载接口,请配置这个。
|
|
116
|
+
*/
|
|
117
|
+
responseType?: 'blob';
|
|
118
|
+
/**
|
|
119
|
+
* 携带 headers,用法和 data 一样,可以用变量。
|
|
120
|
+
*/
|
|
121
|
+
headers?: {
|
|
122
|
+
[propName: string]: string | number;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* 设置发送条件
|
|
126
|
+
*/
|
|
127
|
+
sendOn?: string;
|
|
128
|
+
/**
|
|
129
|
+
* 默认都是追加模式,如果想完全替换把这个配置成 true
|
|
130
|
+
*/
|
|
131
|
+
replaceData?: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* 是否自动刷新,当 url 中的取值结果变化时,自动刷新数据。
|
|
134
|
+
*
|
|
135
|
+
* @default true
|
|
136
|
+
*/
|
|
137
|
+
autoRefresh?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* 当开启自动刷新的时候,默认是 api 的 url 来自动跟踪变量变化的。
|
|
140
|
+
* 如果你希望监控 url 外的变量,请配置 traceExpression。
|
|
141
|
+
*/
|
|
142
|
+
trackExpression?: string;
|
|
143
|
+
/**
|
|
144
|
+
* 如果设置了值,同一个接口,相同参数,指定的时间(单位:ms)内请求将直接走缓存。
|
|
145
|
+
*/
|
|
146
|
+
cache?: number;
|
|
147
|
+
/**
|
|
148
|
+
* 强制将数据附加在 query,默认只有 api 地址中没有用变量的时候 crud 查询接口才会
|
|
149
|
+
* 自动附加数据到 query 部分,如果想强制附加请设置这个属性。
|
|
150
|
+
* 对于那种临时加了个变量但是又不想全部参数写一遍的时候配置很有用。
|
|
151
|
+
*/
|
|
152
|
+
forceAppendDataToQuery?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* qs 配置项
|
|
155
|
+
*/
|
|
156
|
+
qsOptions?: {
|
|
157
|
+
arrayFormat?: 'indices' | 'brackets' | 'repeat' | 'comma';
|
|
158
|
+
indices?: boolean;
|
|
159
|
+
allowDots?: boolean;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* autoFill 是否显示自动填充错误提示
|
|
163
|
+
*/
|
|
164
|
+
silent?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* 提示信息
|
|
167
|
+
*/
|
|
168
|
+
messages?: {
|
|
169
|
+
success?: string;
|
|
170
|
+
failed?: string;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
interface PlainObject$1 {
|
|
174
|
+
[propsName: string]: any;
|
|
175
|
+
}
|
|
176
|
+
interface ApiObject extends BaseApiObject {
|
|
177
|
+
config?: {
|
|
178
|
+
withCredentials?: boolean;
|
|
179
|
+
cancelExecutor?: (cancel: Function) => void;
|
|
180
|
+
};
|
|
181
|
+
graphql?: string;
|
|
182
|
+
operationName?: string;
|
|
183
|
+
body?: PlainObject$1;
|
|
184
|
+
query?: PlainObject$1;
|
|
185
|
+
adaptor?: (payload: object, response: FetcherResult, api: ApiObject) => any;
|
|
186
|
+
requestAdaptor?: (api: ApiObject) => ApiObject;
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/adapter/link.d.ts
|
|
190
|
+
declare function default_jumpTo(router: Router, to: string): void;
|
|
191
|
+
declare function openWindow(url: string, opt?: {
|
|
192
|
+
target?: string;
|
|
193
|
+
noopener?: boolean;
|
|
194
|
+
noreferrer?: boolean;
|
|
195
|
+
}): void;
|
|
196
|
+
declare function isPageUrl(url: string): boolean;
|
|
197
|
+
declare function default_updateLocation(to: any, replace: boolean): void;
|
|
198
|
+
declare function default_isCurrentUrl(to: string, ctx?: any): true | import("path-to-regexp").Match<Partial<Record<string, string | string[]>>>;
|
|
199
|
+
//#endregion
|
|
200
|
+
//#region src/adapter/index.d.ts
|
|
201
|
+
interface Settings {
|
|
202
|
+
apiUrl: string;
|
|
203
|
+
}
|
|
204
|
+
interface I18nOperation {
|
|
205
|
+
t(msg: string): string;
|
|
206
|
+
}
|
|
207
|
+
type ToastLevel = 'info' | 'success' | 'error' | 'warning';
|
|
208
|
+
interface ToastConf {
|
|
209
|
+
position?: 'top-right' | 'top-center' | 'top-left' | 'bottom-center' | 'bottom-left' | 'bottom-right' | 'center';
|
|
210
|
+
closeButton: boolean;
|
|
211
|
+
showIcon?: boolean;
|
|
212
|
+
timeout?: number;
|
|
213
|
+
errorTimeout?: number;
|
|
214
|
+
className?: string;
|
|
215
|
+
items?: any[];
|
|
216
|
+
useMobileUI?: boolean;
|
|
217
|
+
}
|
|
218
|
+
interface PlainObject {
|
|
219
|
+
[propsName: string]: any;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* nop-chaos对外部框架的依赖都集中在adapter对象中
|
|
223
|
+
*/
|
|
224
|
+
declare const adapter: {
|
|
225
|
+
globalVersion: string;
|
|
226
|
+
configUpgrade(_configName: string, _version: number, _prevVersion: number, _config: any): any;
|
|
227
|
+
/**
|
|
228
|
+
* 返回当前的locale
|
|
229
|
+
*/
|
|
230
|
+
useLocale(): string;
|
|
231
|
+
useI18n(): I18nOperation;
|
|
232
|
+
usePinia(): Pinia;
|
|
233
|
+
/**
|
|
234
|
+
* 返回指定的Store
|
|
235
|
+
*/
|
|
236
|
+
useStore(_name: string): Store;
|
|
237
|
+
useRouter(): Router;
|
|
238
|
+
useSettings(): Settings;
|
|
239
|
+
/**
|
|
240
|
+
* 返回当前的认证token
|
|
241
|
+
*/
|
|
242
|
+
useAuthToken(): string;
|
|
243
|
+
setAuthToken(_token?: string): void;
|
|
244
|
+
isUserInRole(_role: string): boolean;
|
|
245
|
+
useTenantId(): string;
|
|
246
|
+
useAppId(): string;
|
|
247
|
+
/**
|
|
248
|
+
* 自动退出时执行的回调
|
|
249
|
+
*/
|
|
250
|
+
logout(_reason: string): void;
|
|
251
|
+
/**
|
|
252
|
+
* 根据组件名加载Vue组件
|
|
253
|
+
*/
|
|
254
|
+
resolveVueComponent(_name: string): any;
|
|
255
|
+
processRequest(request: any): any;
|
|
256
|
+
processResponse(response: any): any;
|
|
257
|
+
compileFunction(code: string, page: any): Function;
|
|
258
|
+
jumpTo(to: string, _action?: any, _ctx?: object): void;
|
|
259
|
+
isCurrentUrl: typeof default_isCurrentUrl;
|
|
260
|
+
updateLocation: typeof default_updateLocation;
|
|
261
|
+
notify(_type: ToastLevel, _msg: any, _conf?: ToastConf): void;
|
|
262
|
+
alert(_msg: string, _title?: string): Promise<void>;
|
|
263
|
+
confirm(_msg: string, _title?: string): Promise<boolean>;
|
|
264
|
+
dataMapping(_to: any, _from?: PlainObject, _ignoreFunction?: boolean | ((key: string, value: any) => boolean), _convertKeyToPath?: boolean, _ignoreIfNotMatch?: boolean): any;
|
|
265
|
+
fetchDict(_dictName: string, _options: FetcherRequest): Promise<FetcherResult>;
|
|
266
|
+
fetchPageAndTransform(_pageName: string, _options: FetcherRequest): Promise<FetcherResult>;
|
|
267
|
+
getPage(_pageUrl: string): Promise<any>;
|
|
268
|
+
};
|
|
269
|
+
declare function registerAdapter(data: Partial<typeof adapter>): void;
|
|
270
|
+
declare function useAdapter(): {
|
|
271
|
+
globalVersion: string;
|
|
272
|
+
configUpgrade(_configName: string, _version: number, _prevVersion: number, _config: any): any;
|
|
273
|
+
/**
|
|
274
|
+
* 返回当前的locale
|
|
275
|
+
*/
|
|
276
|
+
useLocale(): string;
|
|
277
|
+
useI18n(): I18nOperation;
|
|
278
|
+
usePinia(): Pinia;
|
|
279
|
+
/**
|
|
280
|
+
* 返回指定的Store
|
|
281
|
+
*/
|
|
282
|
+
useStore(_name: string): Store;
|
|
283
|
+
useRouter(): Router;
|
|
284
|
+
useSettings(): Settings;
|
|
285
|
+
/**
|
|
286
|
+
* 返回当前的认证token
|
|
287
|
+
*/
|
|
288
|
+
useAuthToken(): string;
|
|
289
|
+
setAuthToken(_token?: string): void;
|
|
290
|
+
isUserInRole(_role: string): boolean;
|
|
291
|
+
useTenantId(): string;
|
|
292
|
+
useAppId(): string;
|
|
293
|
+
/**
|
|
294
|
+
* 自动退出时执行的回调
|
|
295
|
+
*/
|
|
296
|
+
logout(_reason: string): void;
|
|
297
|
+
/**
|
|
298
|
+
* 根据组件名加载Vue组件
|
|
299
|
+
*/
|
|
300
|
+
resolveVueComponent(_name: string): any;
|
|
301
|
+
processRequest(request: any): any;
|
|
302
|
+
processResponse(response: any): any;
|
|
303
|
+
compileFunction(code: string, page: any): Function;
|
|
304
|
+
jumpTo(to: string, _action?: any, _ctx?: object): void;
|
|
305
|
+
isCurrentUrl: typeof default_isCurrentUrl;
|
|
306
|
+
updateLocation: typeof default_updateLocation;
|
|
307
|
+
notify(_type: ToastLevel, _msg: any, _conf?: ToastConf): void;
|
|
308
|
+
alert(_msg: string, _title?: string): Promise<void>;
|
|
309
|
+
confirm(_msg: string, _title?: string): Promise<boolean>;
|
|
310
|
+
dataMapping(_to: any, _from?: PlainObject, _ignoreFunction?: boolean | ((key: string, value: any) => boolean), _convertKeyToPath?: boolean, _ignoreIfNotMatch?: boolean): any;
|
|
311
|
+
fetchDict(_dictName: string, _options: FetcherRequest): Promise<FetcherResult>;
|
|
312
|
+
fetchPageAndTransform(_pageName: string, _options: FetcherRequest): Promise<FetcherResult>;
|
|
313
|
+
getPage(_pageUrl: string): Promise<any>;
|
|
314
|
+
};
|
|
315
|
+
type AdapterType = typeof adapter;
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region src/api/cache.d.ts
|
|
318
|
+
declare function clearLocalCache(): void;
|
|
319
|
+
declare function clearPageCache(): void;
|
|
320
|
+
declare function clearDictCache(): void;
|
|
321
|
+
declare function deletePageCache(path: string): void;
|
|
322
|
+
declare function withPageCache(path: string, fn: () => Promise<any>): Promise<any>;
|
|
323
|
+
declare function withDictCache(dictName: string, fn: () => Promise<any>): Promise<any>;
|
|
324
|
+
//#endregion
|
|
325
|
+
//#region src/api/page-api.d.ts
|
|
326
|
+
declare const PageApis: {
|
|
327
|
+
DevTool__clearComponentCache: typeof DevTool__clearComponentCache;
|
|
328
|
+
PageProvider__getPage: typeof PageProvider__getPage;
|
|
329
|
+
PageProvider__getPageSource: typeof PageProvider__getPageSource;
|
|
330
|
+
PageProvider__rollbackPageSource: typeof PageProvider__rollbackPageSource;
|
|
331
|
+
PageProvider__savePageSource: typeof PageProvider__savePageSource;
|
|
332
|
+
DictProvider__getDict: typeof DictProvider__getDict;
|
|
333
|
+
};
|
|
334
|
+
declare function DevTool__clearComponentCache(): Promise<any>;
|
|
335
|
+
declare function PageProvider__getPage(path: string): Promise<any>;
|
|
336
|
+
declare function PageProvider__getPageSource(path: string, silent?: boolean): Promise<any>;
|
|
337
|
+
declare function PageProvider__rollbackPageSource(path: string, silent?: boolean): Promise<any>;
|
|
338
|
+
declare function PageProvider__savePageSource(path: string, data: any, silent?: boolean): Promise<any>;
|
|
339
|
+
declare function DictProvider__getDict(dictName: string, silent: boolean): Promise<any>;
|
|
340
|
+
//#endregion
|
|
341
|
+
//#region src/api/user-api.d.ts
|
|
342
|
+
declare const UserApis: {
|
|
343
|
+
SiteMapApi__getSiteMap: typeof SiteMapApi__getSiteMap;
|
|
344
|
+
LoginApi__login: typeof LoginApi__login;
|
|
345
|
+
LoginApi__getLoginUserInfo: typeof LoginApi__getLoginUserInfo;
|
|
346
|
+
LoginApi__logout: typeof LoginApi__logout;
|
|
347
|
+
LoginApi__generateVerifyCode: typeof LoginApi__generateVerifyCode;
|
|
348
|
+
CommonApi__getGlobalData: typeof CommonApi__getGlobalData;
|
|
349
|
+
};
|
|
350
|
+
/** @deprecated 此功能已废弃,将在后续版本中移除 */
|
|
351
|
+
declare function CommonApi__getGlobalData(): Promise<{
|
|
352
|
+
roles: string[];
|
|
353
|
+
configInfo: {
|
|
354
|
+
[key: string]: string;
|
|
355
|
+
};
|
|
356
|
+
}>;
|
|
357
|
+
declare function SiteMapApi__getSiteMap(): Promise<any>;
|
|
358
|
+
type LoginRequest = {
|
|
359
|
+
loginType: number;
|
|
360
|
+
principalId: string;
|
|
361
|
+
principalSecret: string;
|
|
362
|
+
verifyCode?: string;
|
|
363
|
+
verifySecret?: string;
|
|
364
|
+
};
|
|
365
|
+
declare function LoginApi__login(req: LoginRequest): Promise<any>;
|
|
366
|
+
declare function LoginApi__getLoginUserInfo(): Promise<any>;
|
|
367
|
+
declare function LoginApi__logout(): Promise<any>;
|
|
368
|
+
declare function LoginApi__generateVerifyCode(verifySecret: string): Promise<any>;
|
|
369
|
+
//#endregion
|
|
370
|
+
//#region src/page/action.d.ts
|
|
371
|
+
/**
|
|
372
|
+
* 通过xui:import可以引入SystemJs格式的js模块,通过@action:xxx,@fn:(a,b)=>expr这种形式可以调用js模块中的函数
|
|
373
|
+
*
|
|
374
|
+
* 例如 {
|
|
375
|
+
* "xui:import": "a.lib"
|
|
376
|
+
* "page": {
|
|
377
|
+
* dialog: {
|
|
378
|
+
* "xui:import": "b.lib"
|
|
379
|
+
* api: "@action:a.f1"
|
|
380
|
+
* }
|
|
381
|
+
* }
|
|
382
|
+
* }
|
|
383
|
+
*
|
|
384
|
+
* 上面的例子中@action:a.f1首先向上查找最近的xui:import引入的js库,如果没有找到,则继续向上查找直到顶层的节点。
|
|
385
|
+
*
|
|
386
|
+
* @action:xxx与 @fn:(a,b)=> expr的区别在于 @action:xxx对应函数名,@fn:(a,b)=>expr则是直接定义匿名函数实现
|
|
387
|
+
*
|
|
388
|
+
* @param json json schema
|
|
389
|
+
*/
|
|
390
|
+
declare function bindActions(pageUrl: string, json: any, page: BasePage): Promise<void>;
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region src/page/processor.d.ts
|
|
393
|
+
/**
|
|
394
|
+
* 如果返回undefined,表示该节点需要被删除
|
|
395
|
+
*/
|
|
396
|
+
type XuiDirectiveProcessor = (type: string // 类型信息
|
|
397
|
+
, json: any // 节点数据
|
|
398
|
+
, processProps: (json: any) => any) => any;
|
|
399
|
+
/**
|
|
400
|
+
* 查找所有具有typeProp指定的属性的节点,并调用processor进行处理,返回结果将会替换原节点。
|
|
401
|
+
* 例如识别xui:roles属性,自动删除没有对应权限的节点
|
|
402
|
+
*
|
|
403
|
+
* @param json json对象
|
|
404
|
+
* @param typeProp 类型字段名
|
|
405
|
+
* @param processor 处理器
|
|
406
|
+
* @returns 经过处理替换后得到的节点
|
|
407
|
+
*/
|
|
408
|
+
declare function processXuiDirective(json: any, typeProp: string, processor: XuiDirectiveProcessor): Promise<any>;
|
|
409
|
+
type XuiValueProcessor = (value: string, key: any, o: any) => any;
|
|
410
|
+
/**
|
|
411
|
+
* 对json对象中的字符串值调用processor来处理
|
|
412
|
+
* @param json 待处理的对象
|
|
413
|
+
* @param processor 处理器
|
|
414
|
+
* @returns
|
|
415
|
+
*/
|
|
416
|
+
declare function processXuiValue(json: any, processor: XuiValueProcessor): any;
|
|
417
|
+
//#endregion
|
|
418
|
+
//#region src/page/registry.d.ts
|
|
419
|
+
type XuiComponent = (json: any) => any | Promise<any>;
|
|
420
|
+
declare function registerXuiComponent(type: string, component: XuiComponent): void;
|
|
421
|
+
declare function unregisterXuiComponent(type: string): void;
|
|
422
|
+
declare function resolveXuiComponent(type: string, json: any): any;
|
|
423
|
+
//#endregion
|
|
424
|
+
//#region src/page/transform.d.ts
|
|
425
|
+
declare function transformPageJson(pageUrl: string, json: any): Promise<any>;
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region src/page/page.d.ts
|
|
428
|
+
/**
|
|
429
|
+
* scoped对应当前amis的scope。只有page/crud/service/form/等少数组件才具有scope
|
|
430
|
+
*/
|
|
431
|
+
type PageAction = (page: PageObject, scoped: any, options: FetcherRequest) => Promise<FetcherResult>;
|
|
432
|
+
type OnOkCallback = (value?: any) => Promise<boolean | void> | boolean | void;
|
|
433
|
+
type OnCancelCallback = () => void;
|
|
434
|
+
type OnChangeCallback = (value: any) => void;
|
|
435
|
+
type RegisterPage = (page: PageObject) => void;
|
|
436
|
+
/**
|
|
437
|
+
* 在action函数中可以访问到的页面对象,包括router, amis的store和pinia store等
|
|
438
|
+
*/
|
|
439
|
+
type PageObject = BasePage & {
|
|
440
|
+
id: string;
|
|
441
|
+
getScopedStore(name: string): any;
|
|
442
|
+
getComponent(name: string): any;
|
|
443
|
+
getState(name: string): any;
|
|
444
|
+
setState(name: string, value: any): void;
|
|
445
|
+
};
|
|
446
|
+
interface PageOptions {
|
|
447
|
+
/**
|
|
448
|
+
* 获取amis的component
|
|
449
|
+
*/
|
|
450
|
+
getComponent(name: string): any;
|
|
451
|
+
getScopedStore(name: string): any;
|
|
452
|
+
getState(name: string): any;
|
|
453
|
+
setState(name: string, value: any): void;
|
|
454
|
+
actions?: Record<string, Function>;
|
|
455
|
+
}
|
|
456
|
+
declare function createPage(options: PageOptions): PageObject;
|
|
457
|
+
//#endregion
|
|
458
|
+
//#region src/ajax/ajax.d.ts
|
|
459
|
+
declare const ajax: import("axios").AxiosInstance;
|
|
460
|
+
declare const isCancel: typeof import("axios").isCancel;
|
|
461
|
+
declare function createCancelToken(cancelExecutor: any): import("axios").CancelToken;
|
|
462
|
+
declare function fetcherOk(data: any): FetcherResult;
|
|
463
|
+
declare function responseOk(data: any): ApiResponse;
|
|
464
|
+
declare function ajaxRequest(options: FetcherRequest): Promise<any>;
|
|
465
|
+
/**
|
|
466
|
+
* 提供的对外接口符合amis框架的要求
|
|
467
|
+
*/
|
|
468
|
+
declare function ajaxFetch(options: FetcherRequest): Promise<FetcherResult>;
|
|
469
|
+
//#endregion
|
|
470
|
+
//#region src/graphql/gql.d.ts
|
|
471
|
+
type OperationType = 'query' | 'mutation' | 'subscription';
|
|
472
|
+
interface OperationDefinition {
|
|
473
|
+
arguments: ArgumentDefinition[];
|
|
474
|
+
}
|
|
475
|
+
interface ArgumentDefinition {
|
|
476
|
+
name: string;
|
|
477
|
+
type: string;
|
|
478
|
+
builder?: (data: any, arg: ArgumentDefinition, options: FetcherRequest) => any;
|
|
479
|
+
}
|
|
480
|
+
declare function handleGraphQL(config: AxiosRequestConfig<any>, graphqlUrl: string, options: FetcherRequest): boolean;
|
|
481
|
+
declare function registerOperation(name: string, op: OperationDefinition): void;
|
|
482
|
+
//#endregion
|
|
483
|
+
//#region src/loader/module.d.ts
|
|
484
|
+
/**
|
|
485
|
+
* 动态加载js文件
|
|
486
|
+
* @param path js文件路径
|
|
487
|
+
* @returns
|
|
488
|
+
*/
|
|
489
|
+
declare function importModule(path: string): any;
|
|
490
|
+
declare function deleteDynamicModules(): void;
|
|
491
|
+
declare function registerModule(name: string, lib: any): void;
|
|
492
|
+
declare function addSystemImportMap(imports: Record<string, string>): void;
|
|
493
|
+
//#endregion
|
|
494
|
+
//#region src/debug/debug.d.ts
|
|
495
|
+
declare function toggleDebug(): void;
|
|
496
|
+
declare function setDebug(b: boolean): void;
|
|
497
|
+
/**
|
|
498
|
+
* 是否进入开发调试状态。调试状态下显示在线编辑器按钮,并设置amisDebug=1,启用AMIS内置的调试器。
|
|
499
|
+
* 根据后台返回的SiteMap.supportDebug属性进行初始化
|
|
500
|
+
*/
|
|
501
|
+
declare function useDebug(): {
|
|
502
|
+
debug: import("vue").Ref<boolean, boolean>;
|
|
503
|
+
supportDebug: import("vue").Ref<boolean, boolean>;
|
|
504
|
+
toggleDebug: typeof toggleDebug;
|
|
505
|
+
setDebug: typeof setDebug;
|
|
506
|
+
};
|
|
507
|
+
declare namespace constants_d_exports {
|
|
508
|
+
export { HEADER_ACCESS_TOKEN, HEADER_APP_ID, HEADER_TENANT_ID, HEADER_TIMESTAMP, HEADER_VERSION };
|
|
509
|
+
}
|
|
510
|
+
declare const HEADER_TENANT_ID = "x-tenant-id";
|
|
511
|
+
declare const HEADER_ACCESS_TOKEN = "x-access-token";
|
|
512
|
+
declare const HEADER_TIMESTAMP = "x-timestamp";
|
|
513
|
+
declare const HEADER_APP_ID = "nop-app-id";
|
|
514
|
+
declare const HEADER_VERSION = "x-version";
|
|
515
|
+
//#endregion
|
|
516
|
+
//#region src/shared/utils.d.ts
|
|
517
|
+
declare function absolutePath(path: string, basePath: string): string;
|
|
518
|
+
type ResolveFunction = (name: string) => any;
|
|
519
|
+
declare function format(msg: string, placeholderStart: string, placeholdeEnd: string, resolver: ResolveFunction): string;
|
|
520
|
+
/**
|
|
521
|
+
* 从后台的TreeBean转换为前台Condition
|
|
522
|
+
* @param node
|
|
523
|
+
*/
|
|
524
|
+
declare function treeToCondition(node: any): {
|
|
525
|
+
condjunction: any;
|
|
526
|
+
children: any;
|
|
527
|
+
op?: undefined;
|
|
528
|
+
left?: undefined;
|
|
529
|
+
right?: undefined;
|
|
530
|
+
} | {
|
|
531
|
+
op: any;
|
|
532
|
+
left: {
|
|
533
|
+
type: string;
|
|
534
|
+
field: any;
|
|
535
|
+
};
|
|
536
|
+
right: any;
|
|
537
|
+
condjunction?: undefined;
|
|
538
|
+
children?: undefined;
|
|
539
|
+
};
|
|
540
|
+
declare function conditionToTree(cond: any): {
|
|
541
|
+
$type: any;
|
|
542
|
+
$body: any;
|
|
543
|
+
name?: undefined;
|
|
544
|
+
value?: undefined;
|
|
545
|
+
} | {
|
|
546
|
+
$type: any;
|
|
547
|
+
name: any;
|
|
548
|
+
value: any;
|
|
549
|
+
$body?: undefined;
|
|
550
|
+
};
|
|
551
|
+
interface ValueHolder<T> {
|
|
552
|
+
getRaw(): T | undefined;
|
|
553
|
+
get(): T | undefined;
|
|
554
|
+
set(value: T): void;
|
|
555
|
+
}
|
|
556
|
+
declare function refHolder<T>(): ValueHolder<T>;
|
|
557
|
+
//#endregion
|
|
558
|
+
//#region src/shared/cache.d.ts
|
|
559
|
+
type AsyncCacheLoader<T> = (key: string) => Promise<T>;
|
|
560
|
+
interface AsyncCache<T> {
|
|
561
|
+
get(key: string, loader: AsyncCacheLoader<T>): Promise<T>;
|
|
562
|
+
delete(key: string): void;
|
|
563
|
+
clear(): void;
|
|
564
|
+
}
|
|
565
|
+
type AsyncCacheOptions<T> = Options<string, T>;
|
|
566
|
+
declare function createAsyncCache<T>(options: AsyncCacheOptions<any>): AsyncCache<T>;
|
|
567
|
+
//#endregion
|
|
568
|
+
//#region src/shared/index.d.ts
|
|
569
|
+
declare function splitPrefixUrl(url: string): string[] | undefined;
|
|
570
|
+
//#endregion
|
|
571
|
+
//#region src/scope.d.ts
|
|
572
|
+
declare function usePage(): PageObject | undefined;
|
|
573
|
+
declare function providePage(page: PageObject): void;
|
|
574
|
+
declare function useScoped(): any;
|
|
575
|
+
declare function provideScoped(scoped: any): void;
|
|
576
|
+
declare function useScopedStore(): any;
|
|
577
|
+
declare function provideScopedStore(store: any): void;
|
|
578
|
+
declare function clearScoped(): void;
|
|
579
|
+
//#endregion
|
|
580
|
+
//#region src/schema-type.d.ts
|
|
581
|
+
interface SchemaProcessorType {
|
|
582
|
+
componentType: Component;
|
|
583
|
+
editorComponentType: Component;
|
|
584
|
+
transformSchemaIn?(schema: any): any;
|
|
585
|
+
transformSchemaOut?(schema: any): any;
|
|
586
|
+
}
|
|
587
|
+
declare function registerSchemaProcessorType(typeName: string, schemaProcessorType: SchemaProcessorType): void;
|
|
588
|
+
declare function getSchemaProcessorType(typeName: string): SchemaProcessorType;
|
|
589
|
+
//#endregion
|
|
590
|
+
//#region src/renderer/types.d.ts
|
|
591
|
+
interface OptionsType {
|
|
592
|
+
[propName: string]: any;
|
|
593
|
+
}
|
|
594
|
+
interface SchemaType {
|
|
595
|
+
type: string;
|
|
596
|
+
[propName: string]: any;
|
|
597
|
+
}
|
|
598
|
+
type SchemaCollectionType = SchemaType | SchemaType[];
|
|
599
|
+
type VDomType = any;
|
|
600
|
+
type OnEventType = (event: string, data: any, ctx: any) => any;
|
|
601
|
+
interface EventCallbacks {
|
|
602
|
+
[source: string]: OnEventType[];
|
|
603
|
+
}
|
|
604
|
+
type EventCleanup = () => void;
|
|
605
|
+
interface RenderContext {
|
|
606
|
+
/**
|
|
607
|
+
* 将json对象渲染为虚拟DOM类型。不同的框架实现不同
|
|
608
|
+
*/
|
|
609
|
+
render: (name: string, schema: SchemaType, props: OptionsType, ctx: any) => VDomType;
|
|
610
|
+
/**
|
|
611
|
+
* 动态执行ajax调用,
|
|
612
|
+
*/
|
|
613
|
+
executor: (api: ApiObject, data: any, ctx: any) => Promise<ApiResponse> | undefined;
|
|
614
|
+
/**
|
|
615
|
+
* 向上冒泡触发自定义动作
|
|
616
|
+
*/
|
|
617
|
+
onEvent?: OnEventType;
|
|
618
|
+
/**
|
|
619
|
+
* 监听兄弟节点或者父节点触发的事件
|
|
620
|
+
* @param source 兄弟节点或者父节点的标识
|
|
621
|
+
* @param handler 回调函数
|
|
622
|
+
*/
|
|
623
|
+
observeEvent?: (source: string, handler: OnEventType) => EventCleanup;
|
|
624
|
+
}
|
|
625
|
+
//#endregion
|
|
626
|
+
export { AdapterType, ArgumentDefinition, AsyncCache, AsyncCacheLoader, AsyncCacheOptions, constants_d_exports as CONSTANTS, EventCallbacks, EventCleanup, type FetcherRequest, type FetcherResult, I18nOperation, LoginRequest, OnCancelCallback, OnChangeCallback, OnEventType, OnOkCallback, OperationDefinition, OperationType, OptionsType, PageAction, PageApis, PageObject, PageOptions, RegisterPage, RenderContext, SchemaCollectionType, SchemaProcessorType, SchemaType, Settings, ToastConf, ToastLevel, UserApis, VDomType, ValueHolder, XuiComponent, XuiDirectiveProcessor, XuiValueProcessor, absolutePath, addSystemImportMap, ajax, ajaxFetch, ajaxRequest, bindActions, clearDictCache, clearLocalCache, clearPageCache, clearScoped, conditionToTree, createAsyncCache, createCancelToken, createPage, default_isCurrentUrl, default_jumpTo, default_updateLocation, deleteDynamicModules, deletePageCache, fetcherOk, format, getSchemaProcessorType, handleGraphQL, importModule, isCancel, isPageUrl, openWindow, processXuiDirective, processXuiValue, providePage, provideScoped, provideScopedStore, refHolder, registerAdapter, registerModule, registerOperation, registerSchemaProcessorType, registerXuiComponent, resolveXuiComponent, responseOk, splitPrefixUrl, transformPageJson, treeToCondition, unregisterXuiComponent, useAdapter, useDebug, usePage, useScoped, useScopedStore, withDictCache, withPageCache };
|
|
627
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types/index.ts","../src/adapter/link.ts","../src/adapter/index.ts","../src/api/cache.ts","../src/api/page-api.ts","../src/api/user-api.ts","../src/page/action.ts","../src/page/processor.ts","../src/page/registry.ts","../src/page/transform.ts","../src/page/page.ts","../src/ajax/ajax.ts","../src/graphql/gql.ts","../src/loader/module.ts","../src/debug/debug.ts","../src/shared/constants.ts","../src/shared/utils.ts","../src/shared/cache.ts","../src/shared/index.ts","../src/scope.ts","../src/schema-type.ts","../src/renderer/types.ts"],"mappings":";;;;;;;UAeiB;EACf;EACA;GACC;;;;;;;UAsBc;EACf;EACA;EACA;EACA;EACA;EACA;EACA;KACG;;EAEH;KAAa;;GACZ;;UAGc;EACf,OAAO;EACP;EACA;;KAGU,iBAAiB;EAC3B,SAAS;EACT;EACA;EACA;EACA,SAAS;EACT;EACA;EAEA,QAAQ;EACR;;UAKe;EACf;EACA;EACA,kBAAkB,QAAQ;EAE1B;EACA;EACA;EACA;;UAGe;EACf,UAAU,qBAAqB;EAC/B,eAAe,oBAAoB,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