sy-page-sdk 0.1.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.
- package/README.md +444 -0
- package/dist/chunk-R77DYKUJ.js +1034 -0
- package/dist/index.cjs +1060 -0
- package/dist/index.d.cts +729 -0
- package/dist/index.d.ts +729 -0
- package/dist/index.js +6 -0
- package/dist/react/index.cjs +1383 -0
- package/dist/react/index.d.cts +77 -0
- package/dist/react/index.d.ts +77 -0
- package/dist/react/index.js +307 -0
- package/package.json +40 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,1060 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
createPageSdk: () => createPageSdk
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
|
+
|
|
27
|
+
// src/core/client.ts
|
|
28
|
+
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
29
|
+
var isSearchRuleLike = (value) => isRecord(value) && typeof value.key === "string" && (value.componentName === void 0 || typeof value.componentName === "string");
|
|
30
|
+
var isBlobLike = (value) => typeof Blob !== "undefined" && value instanceof Blob;
|
|
31
|
+
var normalizeMethod = (value) => {
|
|
32
|
+
const method = String(value || "get").toLowerCase();
|
|
33
|
+
if (method === "get" || method === "post" || method === "put" || method === "delete" || method === "patch") {
|
|
34
|
+
return method;
|
|
35
|
+
}
|
|
36
|
+
return "get";
|
|
37
|
+
};
|
|
38
|
+
var resolveAppType = (context, explicitAppType) => {
|
|
39
|
+
const appType = String(explicitAppType || context.app.appType || "").trim();
|
|
40
|
+
if (!appType) {
|
|
41
|
+
throw new Error("appType \u4E0D\u80FD\u4E3A\u7A7A");
|
|
42
|
+
}
|
|
43
|
+
return appType;
|
|
44
|
+
};
|
|
45
|
+
var buildAppPath = (context, explicitAppType, suffix) => `/${resolveAppType(context, explicitAppType)}${suffix}`;
|
|
46
|
+
var encodePathSegment = (value) => encodeURIComponent(String(value));
|
|
47
|
+
var getHeaderValue = (headers, name) => {
|
|
48
|
+
if (!headers) {
|
|
49
|
+
return void 0;
|
|
50
|
+
}
|
|
51
|
+
const target = name.toLowerCase();
|
|
52
|
+
const entry = Object.entries(headers).find(
|
|
53
|
+
([key]) => key.toLowerCase() === target
|
|
54
|
+
);
|
|
55
|
+
return entry ? String(entry[1]) : void 0;
|
|
56
|
+
};
|
|
57
|
+
var parseContentDispositionFileName = (contentDisposition) => {
|
|
58
|
+
if (!contentDisposition) {
|
|
59
|
+
return void 0;
|
|
60
|
+
}
|
|
61
|
+
const utf8Match = contentDisposition.match(/filename\*=UTF-8''([^;]+)/i);
|
|
62
|
+
if (utf8Match?.[1]) {
|
|
63
|
+
try {
|
|
64
|
+
return decodeURIComponent(utf8Match[1]);
|
|
65
|
+
} catch {
|
|
66
|
+
return utf8Match[1];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const quotedMatch = contentDisposition.match(/filename="([^"]+)"/i);
|
|
70
|
+
if (quotedMatch?.[1]) {
|
|
71
|
+
return quotedMatch[1];
|
|
72
|
+
}
|
|
73
|
+
const plainMatch = contentDisposition.match(/filename=([^;]+)/i);
|
|
74
|
+
if (plainMatch?.[1]) {
|
|
75
|
+
return plainMatch[1].trim();
|
|
76
|
+
}
|
|
77
|
+
return void 0;
|
|
78
|
+
};
|
|
79
|
+
var serializeQuery = (query) => {
|
|
80
|
+
if (!query) {
|
|
81
|
+
return void 0;
|
|
82
|
+
}
|
|
83
|
+
const params = new URLSearchParams();
|
|
84
|
+
const appendValue = (key, value) => {
|
|
85
|
+
if (value === void 0 || value === null || value === "") {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (Array.isArray(value)) {
|
|
89
|
+
value.forEach((item) => appendValue(key, item));
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (value instanceof Date) {
|
|
93
|
+
params.append(key, value.toISOString());
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
params.append(key, String(value));
|
|
97
|
+
};
|
|
98
|
+
Object.entries(query).forEach(([key, value]) => {
|
|
99
|
+
appendValue(key, value);
|
|
100
|
+
});
|
|
101
|
+
const serialized = params.toString();
|
|
102
|
+
return serialized || void 0;
|
|
103
|
+
};
|
|
104
|
+
var toLegacyRules = (value) => Object.entries(value).flatMap(([key, itemValue]) => {
|
|
105
|
+
if (itemValue === void 0) {
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
return [
|
|
109
|
+
{
|
|
110
|
+
key,
|
|
111
|
+
operator: Array.isArray(itemValue) ? "IN" : "EQ",
|
|
112
|
+
value: itemValue
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
});
|
|
116
|
+
var toSearchGroup = (value) => {
|
|
117
|
+
if (value === void 0 || value === null || value === "") {
|
|
118
|
+
return void 0;
|
|
119
|
+
}
|
|
120
|
+
if (typeof value === "string") {
|
|
121
|
+
try {
|
|
122
|
+
return toSearchGroup(JSON.parse(value));
|
|
123
|
+
} catch {
|
|
124
|
+
return void 0;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (Array.isArray(value)) {
|
|
128
|
+
const rules = [];
|
|
129
|
+
const conditions = [];
|
|
130
|
+
value.forEach((item) => {
|
|
131
|
+
const group = toSearchGroup(item);
|
|
132
|
+
if (group) {
|
|
133
|
+
if (group.rules?.length) {
|
|
134
|
+
rules.push(...group.rules);
|
|
135
|
+
}
|
|
136
|
+
if (group.conditions?.length) {
|
|
137
|
+
conditions.push(...group.conditions);
|
|
138
|
+
}
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (isSearchRuleLike(item)) {
|
|
142
|
+
rules.push(item);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (isRecord(item)) {
|
|
146
|
+
rules.push(...toLegacyRules(item));
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
if (rules.length === 0 && conditions.length === 0) {
|
|
150
|
+
return void 0;
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
logic: "AND",
|
|
154
|
+
...rules.length > 0 ? { rules } : {},
|
|
155
|
+
...conditions.length > 0 ? { conditions } : {}
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
if (isRecord(value)) {
|
|
159
|
+
if (isSearchRuleLike(value)) {
|
|
160
|
+
return {
|
|
161
|
+
logic: "AND",
|
|
162
|
+
rules: [value]
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
if ("rules" in value || "conditions" in value || "logic" in value) {
|
|
166
|
+
const nextGroup = {
|
|
167
|
+
logic: value.logic === "OR" || value.logic === "AND" ? value.logic : "AND"
|
|
168
|
+
};
|
|
169
|
+
if (Array.isArray(value.rules)) {
|
|
170
|
+
nextGroup.rules = value.rules.filter(isSearchRuleLike);
|
|
171
|
+
}
|
|
172
|
+
if (Array.isArray(value.conditions)) {
|
|
173
|
+
nextGroup.conditions = value.conditions.map((item) => toSearchGroup(item)).filter((item) => Boolean(item));
|
|
174
|
+
}
|
|
175
|
+
if (!nextGroup.rules?.length && !nextGroup.conditions?.length) {
|
|
176
|
+
return void 0;
|
|
177
|
+
}
|
|
178
|
+
return nextGroup;
|
|
179
|
+
}
|
|
180
|
+
const rules = toLegacyRules(value);
|
|
181
|
+
if (rules.length === 0) {
|
|
182
|
+
return void 0;
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
logic: "AND",
|
|
186
|
+
rules
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
return void 0;
|
|
190
|
+
};
|
|
191
|
+
var mergeSearchExpressions = (base, extra) => {
|
|
192
|
+
const baseGroup = toSearchGroup(base);
|
|
193
|
+
const extraGroup = toSearchGroup(extra);
|
|
194
|
+
if (!baseGroup) {
|
|
195
|
+
return extraGroup;
|
|
196
|
+
}
|
|
197
|
+
if (!extraGroup) {
|
|
198
|
+
return baseGroup;
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
logic: "AND",
|
|
202
|
+
conditions: [baseGroup, extraGroup]
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
var serializeSearchExpression = (value) => {
|
|
206
|
+
if (value === void 0 || value === null || value === "") {
|
|
207
|
+
return void 0;
|
|
208
|
+
}
|
|
209
|
+
if (typeof value === "string") {
|
|
210
|
+
return value;
|
|
211
|
+
}
|
|
212
|
+
const group = toSearchGroup(value);
|
|
213
|
+
return group ? JSON.stringify(group) : void 0;
|
|
214
|
+
};
|
|
215
|
+
var normalizeAdvancedOrder = (value) => {
|
|
216
|
+
if (!value) {
|
|
217
|
+
return void 0;
|
|
218
|
+
}
|
|
219
|
+
const nextValue = Array.isArray(value) ? value : [value];
|
|
220
|
+
return JSON.stringify(nextValue);
|
|
221
|
+
};
|
|
222
|
+
var normalizeDynamicOrder = (value) => {
|
|
223
|
+
if (!value) {
|
|
224
|
+
return void 0;
|
|
225
|
+
}
|
|
226
|
+
if (typeof value === "string") {
|
|
227
|
+
return value;
|
|
228
|
+
}
|
|
229
|
+
return `${value.id}:${value.isAsc === "n" ? "-" : "+"}`;
|
|
230
|
+
};
|
|
231
|
+
var normalizeJsonResponse = (rawResponse) => {
|
|
232
|
+
const topLevelCode = Number(rawResponse?.code);
|
|
233
|
+
const nestedCode = Number(
|
|
234
|
+
rawResponse?.data?.code
|
|
235
|
+
);
|
|
236
|
+
const code = Number.isFinite(topLevelCode) ? topLevelCode : Number.isFinite(nestedCode) ? nestedCode : 200;
|
|
237
|
+
const topLevelResult = isRecord(rawResponse) && "result" in rawResponse ? rawResponse.result : void 0;
|
|
238
|
+
const nestedResult = isRecord(rawResponse?.data) && "result" in (rawResponse.data || {}) ? rawResponse.data?.result : void 0;
|
|
239
|
+
const topLevelData = isRecord(rawResponse) && "data" in rawResponse ? rawResponse.data : void 0;
|
|
240
|
+
const result = topLevelResult !== void 0 ? topLevelResult : nestedResult !== void 0 ? nestedResult : topLevelData !== void 0 ? topLevelData : isRecord(rawResponse) ? rawResponse : null;
|
|
241
|
+
const nestedSuccess = typeof rawResponse?.data?.success === "boolean" ? rawResponse.data?.success : void 0;
|
|
242
|
+
const success = typeof rawResponse?.success === "boolean" ? Boolean(rawResponse.success) : typeof nestedSuccess === "boolean" ? Boolean(nestedSuccess) : code >= 200 && code < 300;
|
|
243
|
+
return {
|
|
244
|
+
code,
|
|
245
|
+
success,
|
|
246
|
+
message: typeof rawResponse?.message === "string" ? rawResponse.message : typeof rawResponse?.data?.message === "string" ? rawResponse.data?.message : void 0,
|
|
247
|
+
result,
|
|
248
|
+
data: topLevelData !== void 0 ? topLevelData : topLevelResult !== void 0 ? topLevelResult : void 0,
|
|
249
|
+
raw: rawResponse
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
var normalizeBinaryResponse = (rawResponse) => {
|
|
253
|
+
if (isRecord(rawResponse) && isBlobLike(rawResponse.blob)) {
|
|
254
|
+
return rawResponse;
|
|
255
|
+
}
|
|
256
|
+
if (isBlobLike(rawResponse)) {
|
|
257
|
+
return {
|
|
258
|
+
blob: rawResponse,
|
|
259
|
+
raw: rawResponse
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
const responseData = rawResponse?.data;
|
|
263
|
+
const responseHeaders = isRecord(
|
|
264
|
+
rawResponse?.headers
|
|
265
|
+
) ? rawResponse.headers : void 0;
|
|
266
|
+
if (!isBlobLike(responseData)) {
|
|
267
|
+
throw new Error("transport.download \u672A\u8FD4\u56DE Blob \u6570\u636E");
|
|
268
|
+
}
|
|
269
|
+
const contentDisposition = getHeaderValue(
|
|
270
|
+
responseHeaders,
|
|
271
|
+
"content-disposition"
|
|
272
|
+
);
|
|
273
|
+
return {
|
|
274
|
+
blob: responseData,
|
|
275
|
+
fileName: parseContentDispositionFileName(contentDisposition),
|
|
276
|
+
contentType: getHeaderValue(responseHeaders, "content-type") || responseData.type,
|
|
277
|
+
headers: responseHeaders ? Object.fromEntries(
|
|
278
|
+
Object.entries(responseHeaders).map(([key, value]) => [
|
|
279
|
+
key,
|
|
280
|
+
value === void 0 ? void 0 : String(value)
|
|
281
|
+
])
|
|
282
|
+
) : void 0,
|
|
283
|
+
raw: rawResponse
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
var toSdkError = (input, payload) => {
|
|
287
|
+
const normalizedResponse = isRecord(input) ? normalizeJsonResponse(input) : void 0;
|
|
288
|
+
const nextError = input instanceof Error ? input : new Error(
|
|
289
|
+
normalizedResponse?.message || `\u8BF7\u6C42\u5931\u8D25: ${String(payload.method).toUpperCase()} ${payload.path}`
|
|
290
|
+
);
|
|
291
|
+
const sdkError = nextError;
|
|
292
|
+
sdkError.method = String(payload.method).toUpperCase();
|
|
293
|
+
sdkError.path = payload.path;
|
|
294
|
+
sdkError.response = normalizedResponse;
|
|
295
|
+
sdkError.raw = input;
|
|
296
|
+
return sdkError;
|
|
297
|
+
};
|
|
298
|
+
var ensureSuccess = (response, payload) => {
|
|
299
|
+
if (!response.success) {
|
|
300
|
+
throw toSdkError(response, payload);
|
|
301
|
+
}
|
|
302
|
+
return response;
|
|
303
|
+
};
|
|
304
|
+
var resolveFormInstanceId = (params) => {
|
|
305
|
+
const formInstanceId = String(
|
|
306
|
+
params.formInstId || params.formInstanceId || ""
|
|
307
|
+
).trim();
|
|
308
|
+
if (!formInstanceId) {
|
|
309
|
+
throw new Error("formInstanceId \u4E0D\u80FD\u4E3A\u7A7A");
|
|
310
|
+
}
|
|
311
|
+
return formInstanceId;
|
|
312
|
+
};
|
|
313
|
+
var withDefaultAppType = (context, params) => {
|
|
314
|
+
if (!params) {
|
|
315
|
+
return params;
|
|
316
|
+
}
|
|
317
|
+
if (params.appType) {
|
|
318
|
+
return params;
|
|
319
|
+
}
|
|
320
|
+
if (params.scope === "app") {
|
|
321
|
+
return {
|
|
322
|
+
...params,
|
|
323
|
+
appType: context.app.appType
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
return params;
|
|
327
|
+
};
|
|
328
|
+
var createPageSdk = (context) => {
|
|
329
|
+
const request = async (options) => {
|
|
330
|
+
const payload = {
|
|
331
|
+
path: options.path,
|
|
332
|
+
method: normalizeMethod(options.method),
|
|
333
|
+
query: serializeQuery(options.query),
|
|
334
|
+
body: options.body,
|
|
335
|
+
headers: options.headers
|
|
336
|
+
};
|
|
337
|
+
try {
|
|
338
|
+
const rawResponse = await context.bridge.invoke(
|
|
339
|
+
"transport.request",
|
|
340
|
+
payload
|
|
341
|
+
);
|
|
342
|
+
return ensureSuccess(
|
|
343
|
+
normalizeJsonResponse(rawResponse),
|
|
344
|
+
payload
|
|
345
|
+
);
|
|
346
|
+
} catch (error) {
|
|
347
|
+
throw toSdkError(error, payload);
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
const download = async (options) => {
|
|
351
|
+
const payload = {
|
|
352
|
+
path: options.path,
|
|
353
|
+
method: normalizeMethod(options.method),
|
|
354
|
+
query: serializeQuery(options.query),
|
|
355
|
+
body: options.body,
|
|
356
|
+
headers: options.headers
|
|
357
|
+
};
|
|
358
|
+
try {
|
|
359
|
+
const rawResponse = await context.bridge.invoke(
|
|
360
|
+
"transport.download",
|
|
361
|
+
payload
|
|
362
|
+
);
|
|
363
|
+
return normalizeBinaryResponse(rawResponse);
|
|
364
|
+
} catch (error) {
|
|
365
|
+
throw toSdkError(error, payload);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
const form = {
|
|
369
|
+
getDetail: (params) => request({
|
|
370
|
+
path: buildAppPath(
|
|
371
|
+
context,
|
|
372
|
+
params.appType,
|
|
373
|
+
"/v1/form/getFormDataById.json"
|
|
374
|
+
),
|
|
375
|
+
method: "get",
|
|
376
|
+
query: {
|
|
377
|
+
formUuid: params.formUuid,
|
|
378
|
+
formInstId: resolveFormInstanceId(params)
|
|
379
|
+
}
|
|
380
|
+
}),
|
|
381
|
+
create: (params) => request({
|
|
382
|
+
path: buildAppPath(
|
|
383
|
+
context,
|
|
384
|
+
params.appType,
|
|
385
|
+
"/v1/form/saveFormData.json"
|
|
386
|
+
),
|
|
387
|
+
method: "post",
|
|
388
|
+
body: {
|
|
389
|
+
formUuid: params.formUuid,
|
|
390
|
+
formDataJson: JSON.stringify(params.data || {})
|
|
391
|
+
}
|
|
392
|
+
}),
|
|
393
|
+
update: (params) => request({
|
|
394
|
+
path: buildAppPath(
|
|
395
|
+
context,
|
|
396
|
+
params.appType,
|
|
397
|
+
"/v1/form/updateFormData.json"
|
|
398
|
+
),
|
|
399
|
+
method: "post",
|
|
400
|
+
body: {
|
|
401
|
+
formUuid: params.formUuid,
|
|
402
|
+
formInstId: resolveFormInstanceId(params),
|
|
403
|
+
updateFormDataJson: params.updateFormDataJson || JSON.stringify(params.data || {})
|
|
404
|
+
}
|
|
405
|
+
}),
|
|
406
|
+
remove: (params) => request({
|
|
407
|
+
path: buildAppPath(
|
|
408
|
+
context,
|
|
409
|
+
params.appType,
|
|
410
|
+
"/v1/form/deleteFormData.json"
|
|
411
|
+
),
|
|
412
|
+
method: "post",
|
|
413
|
+
body: {
|
|
414
|
+
formUuid: params.formUuid,
|
|
415
|
+
formInstId: resolveFormInstanceId(params)
|
|
416
|
+
}
|
|
417
|
+
}),
|
|
418
|
+
getChangeRecords: (params) => request({
|
|
419
|
+
path: buildAppPath(
|
|
420
|
+
context,
|
|
421
|
+
params.appType,
|
|
422
|
+
"/v1/form/getFormDataChangeRecords.json"
|
|
423
|
+
),
|
|
424
|
+
method: "get",
|
|
425
|
+
query: {
|
|
426
|
+
formUuid: params.formUuid,
|
|
427
|
+
formInstId: resolveFormInstanceId(params),
|
|
428
|
+
page: params.page,
|
|
429
|
+
pageSize: params.pageSize
|
|
430
|
+
}
|
|
431
|
+
}),
|
|
432
|
+
search: (params) => request({
|
|
433
|
+
path: buildAppPath(
|
|
434
|
+
context,
|
|
435
|
+
params.appType,
|
|
436
|
+
"/v1/form/searchFormDatas.json"
|
|
437
|
+
),
|
|
438
|
+
method: "get",
|
|
439
|
+
query: {
|
|
440
|
+
formUuid: params.formUuid,
|
|
441
|
+
searchFieldJson: serializeSearchExpression(params.search),
|
|
442
|
+
currentPage: params.currentPage,
|
|
443
|
+
pageSize: params.pageSize,
|
|
444
|
+
originatorId: params.originatorId,
|
|
445
|
+
createFrom: params.createFrom,
|
|
446
|
+
createTo: params.createTo,
|
|
447
|
+
modifiedFrom: params.modifiedFrom,
|
|
448
|
+
modifiedTo: params.modifiedTo,
|
|
449
|
+
dynamicOrder: normalizeDynamicOrder(params.dynamicOrder),
|
|
450
|
+
instanceStatus: params.instanceStatus
|
|
451
|
+
}
|
|
452
|
+
}),
|
|
453
|
+
searchIds: (params) => request({
|
|
454
|
+
path: buildAppPath(
|
|
455
|
+
context,
|
|
456
|
+
params.appType,
|
|
457
|
+
"/v1/form/searchFormDataIds.json"
|
|
458
|
+
),
|
|
459
|
+
method: "get",
|
|
460
|
+
query: {
|
|
461
|
+
formUuid: params.formUuid,
|
|
462
|
+
searchFieldJson: serializeSearchExpression(params.search),
|
|
463
|
+
currentPage: params.currentPage,
|
|
464
|
+
pageSize: params.pageSize,
|
|
465
|
+
originatorId: params.originatorId,
|
|
466
|
+
createFrom: params.createFrom,
|
|
467
|
+
createTo: params.createTo,
|
|
468
|
+
modifiedFrom: params.modifiedFrom,
|
|
469
|
+
modifiedTo: params.modifiedTo,
|
|
470
|
+
dynamicOrder: normalizeDynamicOrder(params.dynamicOrder),
|
|
471
|
+
instanceStatus: params.instanceStatus
|
|
472
|
+
}
|
|
473
|
+
}),
|
|
474
|
+
advancedSearch: (params) => request({
|
|
475
|
+
path: buildAppPath(
|
|
476
|
+
context,
|
|
477
|
+
params.appType,
|
|
478
|
+
"/v1/form/advancedSearch.json"
|
|
479
|
+
),
|
|
480
|
+
method: "get",
|
|
481
|
+
query: {
|
|
482
|
+
formUuid: params.formUuid,
|
|
483
|
+
filters: serializeSearchExpression(params.filters),
|
|
484
|
+
conditionType: params.conditionType,
|
|
485
|
+
searchKeyWord: params.searchKeyWord,
|
|
486
|
+
currentPage: params.currentPage,
|
|
487
|
+
pageSize: params.pageSize,
|
|
488
|
+
order: normalizeAdvancedOrder(params.order),
|
|
489
|
+
instanceStatus: params.instanceStatus
|
|
490
|
+
}
|
|
491
|
+
}),
|
|
492
|
+
advancedExport: (params) => download({
|
|
493
|
+
path: buildAppPath(
|
|
494
|
+
context,
|
|
495
|
+
params.appType,
|
|
496
|
+
"/v1/form/advancedExport.xlsx"
|
|
497
|
+
),
|
|
498
|
+
method: "get",
|
|
499
|
+
query: {
|
|
500
|
+
formUuid: params.formUuid,
|
|
501
|
+
filters: serializeSearchExpression(params.filters),
|
|
502
|
+
conditionType: params.conditionType,
|
|
503
|
+
searchKeyWord: params.searchKeyWord,
|
|
504
|
+
currentPage: params.currentPage,
|
|
505
|
+
pageSize: params.pageSize,
|
|
506
|
+
order: normalizeAdvancedOrder(params.order),
|
|
507
|
+
instanceStatus: params.instanceStatus,
|
|
508
|
+
exportAll: params.exportAll,
|
|
509
|
+
embedImages: params.embedImages,
|
|
510
|
+
exportFields: params.exportFields?.join(",")
|
|
511
|
+
}
|
|
512
|
+
}),
|
|
513
|
+
downloadImportTemplate: (params) => download({
|
|
514
|
+
path: buildAppPath(
|
|
515
|
+
context,
|
|
516
|
+
params.appType,
|
|
517
|
+
"/v1/form/advancedExportTemplate.xlsx"
|
|
518
|
+
),
|
|
519
|
+
method: "get",
|
|
520
|
+
query: {
|
|
521
|
+
formUuid: params.formUuid
|
|
522
|
+
}
|
|
523
|
+
}),
|
|
524
|
+
importPreview: (params) => request({
|
|
525
|
+
path: buildAppPath(
|
|
526
|
+
context,
|
|
527
|
+
params.appType,
|
|
528
|
+
"/v1/form/importPreview.xlsx"
|
|
529
|
+
),
|
|
530
|
+
method: "post",
|
|
531
|
+
body: {
|
|
532
|
+
formUuid: params.formUuid,
|
|
533
|
+
fileBase64: params.fileBase64,
|
|
534
|
+
fileName: params.fileName
|
|
535
|
+
}
|
|
536
|
+
}),
|
|
537
|
+
importExcel: (params) => request({
|
|
538
|
+
path: buildAppPath(context, params.appType, "/v1/form/import.xlsx"),
|
|
539
|
+
method: "post",
|
|
540
|
+
body: {
|
|
541
|
+
formUuid: params.formUuid,
|
|
542
|
+
fileBase64: params.fileBase64,
|
|
543
|
+
fileName: params.fileName
|
|
544
|
+
}
|
|
545
|
+
}),
|
|
546
|
+
getImportRecords: (params) => request({
|
|
547
|
+
path: buildAppPath(
|
|
548
|
+
context,
|
|
549
|
+
params.appType,
|
|
550
|
+
"/v1/form/importRecords.json"
|
|
551
|
+
),
|
|
552
|
+
method: "get",
|
|
553
|
+
query: {
|
|
554
|
+
formUuid: params.formUuid,
|
|
555
|
+
currentPage: params.currentPage,
|
|
556
|
+
pageSize: params.pageSize
|
|
557
|
+
}
|
|
558
|
+
}),
|
|
559
|
+
getExportRecords: (params) => request({
|
|
560
|
+
path: buildAppPath(
|
|
561
|
+
context,
|
|
562
|
+
params.appType,
|
|
563
|
+
"/v1/form/exportRecords.json"
|
|
564
|
+
),
|
|
565
|
+
method: "get",
|
|
566
|
+
query: {
|
|
567
|
+
formUuid: params.formUuid,
|
|
568
|
+
currentPage: params.currentPage,
|
|
569
|
+
pageSize: params.pageSize
|
|
570
|
+
}
|
|
571
|
+
}),
|
|
572
|
+
downloadImportSource: (params) => download({
|
|
573
|
+
path: buildAppPath(
|
|
574
|
+
context,
|
|
575
|
+
params.appType,
|
|
576
|
+
"/v1/form/importRecord/downloadSource.xlsx"
|
|
577
|
+
),
|
|
578
|
+
method: "get",
|
|
579
|
+
query: {
|
|
580
|
+
recordId: params.recordId
|
|
581
|
+
}
|
|
582
|
+
}),
|
|
583
|
+
downloadImportFailed: (params) => download({
|
|
584
|
+
path: buildAppPath(
|
|
585
|
+
context,
|
|
586
|
+
params.appType,
|
|
587
|
+
"/v1/form/importRecord/downloadFailed.xlsx"
|
|
588
|
+
),
|
|
589
|
+
method: "get",
|
|
590
|
+
query: {
|
|
591
|
+
recordId: params.recordId
|
|
592
|
+
}
|
|
593
|
+
}),
|
|
594
|
+
downloadExportRecord: (params) => download({
|
|
595
|
+
path: buildAppPath(
|
|
596
|
+
context,
|
|
597
|
+
params.appType,
|
|
598
|
+
"/v1/form/exportRecord/download.xlsx"
|
|
599
|
+
),
|
|
600
|
+
method: "get",
|
|
601
|
+
query: {
|
|
602
|
+
recordId: params.recordId
|
|
603
|
+
}
|
|
604
|
+
}),
|
|
605
|
+
getDataManagementConfig: (params) => request({
|
|
606
|
+
path: buildAppPath(
|
|
607
|
+
context,
|
|
608
|
+
params.appType,
|
|
609
|
+
"/v1/form/dataManagement/config/get.json"
|
|
610
|
+
),
|
|
611
|
+
method: "get",
|
|
612
|
+
query: {
|
|
613
|
+
formUuid: params.formUuid
|
|
614
|
+
}
|
|
615
|
+
}),
|
|
616
|
+
saveDataManagementConfig: (params) => request({
|
|
617
|
+
path: buildAppPath(
|
|
618
|
+
context,
|
|
619
|
+
params.appType,
|
|
620
|
+
"/v1/form/dataManagement/config/save.json"
|
|
621
|
+
),
|
|
622
|
+
method: "post",
|
|
623
|
+
body: {
|
|
624
|
+
formUuid: params.formUuid,
|
|
625
|
+
config: params.config
|
|
626
|
+
}
|
|
627
|
+
})
|
|
628
|
+
};
|
|
629
|
+
const user = {
|
|
630
|
+
create: (params) => request({
|
|
631
|
+
path: "/user/create",
|
|
632
|
+
method: "post",
|
|
633
|
+
body: params
|
|
634
|
+
}),
|
|
635
|
+
update: (params) => request({
|
|
636
|
+
path: "/user/update",
|
|
637
|
+
method: "put",
|
|
638
|
+
body: params
|
|
639
|
+
}),
|
|
640
|
+
remove: (id) => request({
|
|
641
|
+
path: `/user/${encodePathSegment(id)}`,
|
|
642
|
+
method: "delete"
|
|
643
|
+
}),
|
|
644
|
+
get: (id = "current") => request({
|
|
645
|
+
path: `/user/${encodePathSegment(id)}`,
|
|
646
|
+
method: "get"
|
|
647
|
+
}),
|
|
648
|
+
getCurrent: () => request({
|
|
649
|
+
path: "/user/current",
|
|
650
|
+
method: "get"
|
|
651
|
+
}),
|
|
652
|
+
getByUsername: (username) => request({
|
|
653
|
+
path: `/user/username/${encodePathSegment(username)}`,
|
|
654
|
+
method: "get"
|
|
655
|
+
}),
|
|
656
|
+
list: (params) => request({
|
|
657
|
+
path: "/user/list",
|
|
658
|
+
method: "get",
|
|
659
|
+
query: {
|
|
660
|
+
ids: params?.ids,
|
|
661
|
+
departmentIds: params?.departmentIds,
|
|
662
|
+
name: params?.name,
|
|
663
|
+
username: params?.username,
|
|
664
|
+
phone: params?.phone,
|
|
665
|
+
email: params?.email,
|
|
666
|
+
page: params?.page,
|
|
667
|
+
pageSize: params?.pageSize
|
|
668
|
+
}
|
|
669
|
+
}),
|
|
670
|
+
search: (keyword) => request({
|
|
671
|
+
path: "/user/search",
|
|
672
|
+
method: "get",
|
|
673
|
+
query: {
|
|
674
|
+
keyword
|
|
675
|
+
}
|
|
676
|
+
}),
|
|
677
|
+
listAll: () => request({
|
|
678
|
+
path: "/user/all",
|
|
679
|
+
method: "get"
|
|
680
|
+
}),
|
|
681
|
+
listByDepartment: (departmentId) => request({
|
|
682
|
+
path: `/user/department/${encodePathSegment(departmentId)}`,
|
|
683
|
+
method: "get"
|
|
684
|
+
}),
|
|
685
|
+
validate: (params) => request({
|
|
686
|
+
path: "/user/validate",
|
|
687
|
+
method: "post",
|
|
688
|
+
body: params
|
|
689
|
+
})
|
|
690
|
+
};
|
|
691
|
+
const role = {
|
|
692
|
+
create: (params) => request({
|
|
693
|
+
path: "/role/",
|
|
694
|
+
method: "post",
|
|
695
|
+
body: params
|
|
696
|
+
}),
|
|
697
|
+
update: (id, params) => request({
|
|
698
|
+
path: `/role/${encodePathSegment(id)}`,
|
|
699
|
+
method: "put",
|
|
700
|
+
body: params
|
|
701
|
+
}),
|
|
702
|
+
remove: (id) => request({
|
|
703
|
+
path: `/role/${encodePathSegment(id)}`,
|
|
704
|
+
method: "delete"
|
|
705
|
+
}),
|
|
706
|
+
get: (id) => request({
|
|
707
|
+
path: `/role/${encodePathSegment(id)}`,
|
|
708
|
+
method: "get"
|
|
709
|
+
}),
|
|
710
|
+
list: (params) => request({
|
|
711
|
+
path: "/role/",
|
|
712
|
+
method: "get",
|
|
713
|
+
query: withDefaultAppType(context, params)
|
|
714
|
+
}),
|
|
715
|
+
listUsers: (roleId, params) => request({
|
|
716
|
+
path: `/role/${encodePathSegment(roleId)}/users`,
|
|
717
|
+
method: "get",
|
|
718
|
+
query: params
|
|
719
|
+
}),
|
|
720
|
+
assignRoles: (params) => request({
|
|
721
|
+
path: "/role/assign",
|
|
722
|
+
method: "post",
|
|
723
|
+
body: params
|
|
724
|
+
}),
|
|
725
|
+
addUserRole: (params) => request({
|
|
726
|
+
path: "/role/add",
|
|
727
|
+
method: "post",
|
|
728
|
+
body: params
|
|
729
|
+
}),
|
|
730
|
+
removeUserRole: (params) => request({
|
|
731
|
+
path: "/role/remove",
|
|
732
|
+
method: "post",
|
|
733
|
+
body: params
|
|
734
|
+
}),
|
|
735
|
+
batchAddUsers: (params) => request({
|
|
736
|
+
path: "/role/batch-add-users",
|
|
737
|
+
method: "post",
|
|
738
|
+
body: params
|
|
739
|
+
}),
|
|
740
|
+
getMyRoles: (params) => request({
|
|
741
|
+
path: "/role/my/roles",
|
|
742
|
+
method: "get",
|
|
743
|
+
query: withDefaultAppType(context, params)
|
|
744
|
+
}),
|
|
745
|
+
getCurrentRole: (params) => request({
|
|
746
|
+
path: "/role/my/current",
|
|
747
|
+
method: "get",
|
|
748
|
+
query: withDefaultAppType(context, params)
|
|
749
|
+
}),
|
|
750
|
+
switchPlatformRole: (params) => request({
|
|
751
|
+
path: "/role/switch/platform",
|
|
752
|
+
method: "post",
|
|
753
|
+
body: params
|
|
754
|
+
}),
|
|
755
|
+
switchAppRole: (params) => request({
|
|
756
|
+
path: "/role/switch/app",
|
|
757
|
+
method: "post",
|
|
758
|
+
body: {
|
|
759
|
+
...params,
|
|
760
|
+
appType: resolveAppType(context, params.appType)
|
|
761
|
+
}
|
|
762
|
+
})
|
|
763
|
+
};
|
|
764
|
+
const permission = {
|
|
765
|
+
formGroup: {
|
|
766
|
+
create: (params) => request({
|
|
767
|
+
path: "/permission/form-group/",
|
|
768
|
+
method: "post",
|
|
769
|
+
body: {
|
|
770
|
+
...params,
|
|
771
|
+
appType: resolveAppType(context, params.appType)
|
|
772
|
+
}
|
|
773
|
+
}),
|
|
774
|
+
update: (id, params) => request({
|
|
775
|
+
path: `/permission/form-group/${encodePathSegment(id)}`,
|
|
776
|
+
method: "put",
|
|
777
|
+
body: {
|
|
778
|
+
...params,
|
|
779
|
+
...params.appType ? { appType: resolveAppType(context, params.appType) } : {}
|
|
780
|
+
}
|
|
781
|
+
}),
|
|
782
|
+
remove: (id) => request({
|
|
783
|
+
path: `/permission/form-group/${encodePathSegment(id)}`,
|
|
784
|
+
method: "delete"
|
|
785
|
+
}),
|
|
786
|
+
get: (id) => request({
|
|
787
|
+
path: `/permission/form-group/${encodePathSegment(id)}`,
|
|
788
|
+
method: "get"
|
|
789
|
+
}),
|
|
790
|
+
list: (params) => request({
|
|
791
|
+
path: "/permission/form-group/",
|
|
792
|
+
method: "get",
|
|
793
|
+
query: {
|
|
794
|
+
...params,
|
|
795
|
+
appType: resolveAppType(context, params?.appType)
|
|
796
|
+
}
|
|
797
|
+
}),
|
|
798
|
+
getViewFieldPermissions: (params) => request({
|
|
799
|
+
path: "/permission/form-group/field-permissions",
|
|
800
|
+
method: "get",
|
|
801
|
+
query: {
|
|
802
|
+
appType: resolveAppType(context, params.appType),
|
|
803
|
+
formUuid: params.formUuid
|
|
804
|
+
}
|
|
805
|
+
}),
|
|
806
|
+
getViewPermissionSummary: (params) => request({
|
|
807
|
+
path: "/permission/form-group/view-permissions",
|
|
808
|
+
method: "get",
|
|
809
|
+
query: {
|
|
810
|
+
appType: resolveAppType(context, params.appType),
|
|
811
|
+
formUuid: params.formUuid
|
|
812
|
+
}
|
|
813
|
+
})
|
|
814
|
+
},
|
|
815
|
+
pageGroup: {
|
|
816
|
+
create: (params) => request({
|
|
817
|
+
path: "/permission/page-group/",
|
|
818
|
+
method: "post",
|
|
819
|
+
body: {
|
|
820
|
+
...params,
|
|
821
|
+
appType: resolveAppType(context, params.appType)
|
|
822
|
+
}
|
|
823
|
+
}),
|
|
824
|
+
update: (id, params) => request({
|
|
825
|
+
path: `/permission/page-group/${encodePathSegment(id)}`,
|
|
826
|
+
method: "put",
|
|
827
|
+
body: {
|
|
828
|
+
...params,
|
|
829
|
+
...params.appType ? { appType: resolveAppType(context, params.appType) } : {}
|
|
830
|
+
}
|
|
831
|
+
}),
|
|
832
|
+
remove: (id) => request({
|
|
833
|
+
path: `/permission/page-group/${encodePathSegment(id)}`,
|
|
834
|
+
method: "delete"
|
|
835
|
+
}),
|
|
836
|
+
get: (id) => request({
|
|
837
|
+
path: `/permission/page-group/${encodePathSegment(id)}`,
|
|
838
|
+
method: "get"
|
|
839
|
+
}),
|
|
840
|
+
list: (params) => request({
|
|
841
|
+
path: "/permission/page-group/",
|
|
842
|
+
method: "get",
|
|
843
|
+
query: {
|
|
844
|
+
...params,
|
|
845
|
+
appType: resolveAppType(context, params?.appType)
|
|
846
|
+
}
|
|
847
|
+
}),
|
|
848
|
+
getUserMenuPermissions: (appType) => request({
|
|
849
|
+
path: "/permission/page-group/user-menu-permissions",
|
|
850
|
+
method: "get",
|
|
851
|
+
query: {
|
|
852
|
+
appType: resolveAppType(context, appType)
|
|
853
|
+
}
|
|
854
|
+
})
|
|
855
|
+
},
|
|
856
|
+
api: {
|
|
857
|
+
create: (params) => request({
|
|
858
|
+
path: "/permission/api",
|
|
859
|
+
method: "post",
|
|
860
|
+
body: params
|
|
861
|
+
}),
|
|
862
|
+
update: (id, params) => request({
|
|
863
|
+
path: `/permission/api/${encodePathSegment(id)}`,
|
|
864
|
+
method: "put",
|
|
865
|
+
body: params
|
|
866
|
+
}),
|
|
867
|
+
remove: (id) => request({
|
|
868
|
+
path: `/permission/api/${encodePathSegment(id)}`,
|
|
869
|
+
method: "delete"
|
|
870
|
+
}),
|
|
871
|
+
list: (params) => request({
|
|
872
|
+
path: "/permission/api",
|
|
873
|
+
method: "get",
|
|
874
|
+
query: withDefaultAppType(context, params)
|
|
875
|
+
}),
|
|
876
|
+
assign: (params) => request({
|
|
877
|
+
path: "/permission/api/assign",
|
|
878
|
+
method: "post",
|
|
879
|
+
body: params
|
|
880
|
+
}),
|
|
881
|
+
getByRole: (roleId) => request({
|
|
882
|
+
path: `/permission/api/role/${encodePathSegment(roleId)}`,
|
|
883
|
+
method: "get"
|
|
884
|
+
}),
|
|
885
|
+
getRolesByPermission: (permissionId) => request({
|
|
886
|
+
path: `/permission/api/${encodePathSegment(permissionId)}/roles`,
|
|
887
|
+
method: "get"
|
|
888
|
+
})
|
|
889
|
+
},
|
|
890
|
+
ui: {
|
|
891
|
+
create: (params) => request({
|
|
892
|
+
path: "/permission/api/ui",
|
|
893
|
+
method: "post",
|
|
894
|
+
body: params
|
|
895
|
+
}),
|
|
896
|
+
update: (id, params) => request({
|
|
897
|
+
path: `/permission/api/ui/${encodePathSegment(id)}`,
|
|
898
|
+
method: "put",
|
|
899
|
+
body: params
|
|
900
|
+
}),
|
|
901
|
+
remove: (id) => request({
|
|
902
|
+
path: `/permission/api/ui/${encodePathSegment(id)}`,
|
|
903
|
+
method: "delete"
|
|
904
|
+
}),
|
|
905
|
+
list: (params) => request({
|
|
906
|
+
path: "/permission/api/ui",
|
|
907
|
+
method: "get",
|
|
908
|
+
query: withDefaultAppType(context, params)
|
|
909
|
+
}),
|
|
910
|
+
assign: (params) => request({
|
|
911
|
+
path: "/permission/api/ui/assign",
|
|
912
|
+
method: "post",
|
|
913
|
+
body: params
|
|
914
|
+
}),
|
|
915
|
+
getMyPlatform: () => request({
|
|
916
|
+
path: "/permission/api/ui/me/platform",
|
|
917
|
+
method: "get"
|
|
918
|
+
}),
|
|
919
|
+
getMyApp: (appType) => request({
|
|
920
|
+
path: "/permission/api/ui/me/app",
|
|
921
|
+
method: "get",
|
|
922
|
+
query: {
|
|
923
|
+
appType: resolveAppType(context, appType)
|
|
924
|
+
}
|
|
925
|
+
})
|
|
926
|
+
}
|
|
927
|
+
};
|
|
928
|
+
const process = {
|
|
929
|
+
getInstance: (params) => request({
|
|
930
|
+
path: buildAppPath(context, params.appType, "/v1/process/instance"),
|
|
931
|
+
method: "get",
|
|
932
|
+
query: {
|
|
933
|
+
instanceId: params.instanceId
|
|
934
|
+
}
|
|
935
|
+
}),
|
|
936
|
+
terminateInstance: (params) => request({
|
|
937
|
+
path: buildAppPath(
|
|
938
|
+
context,
|
|
939
|
+
params.appType,
|
|
940
|
+
"/v1/process/terminateInstance.json"
|
|
941
|
+
),
|
|
942
|
+
method: "post",
|
|
943
|
+
body: {
|
|
944
|
+
processInstanceId: params.processInstanceId,
|
|
945
|
+
reason: params.reason
|
|
946
|
+
}
|
|
947
|
+
}),
|
|
948
|
+
approveTask: (params) => request({
|
|
949
|
+
path: buildAppPath(
|
|
950
|
+
context,
|
|
951
|
+
params.appType,
|
|
952
|
+
"/v1/process/approveTask.json"
|
|
953
|
+
),
|
|
954
|
+
method: "post",
|
|
955
|
+
body: {
|
|
956
|
+
...params,
|
|
957
|
+
appType: resolveAppType(context, params.appType)
|
|
958
|
+
}
|
|
959
|
+
}),
|
|
960
|
+
triggerCallbackTask: (params) => request({
|
|
961
|
+
path: buildAppPath(
|
|
962
|
+
context,
|
|
963
|
+
params.appType,
|
|
964
|
+
"/v1/process/triggerCallback.json"
|
|
965
|
+
),
|
|
966
|
+
method: "post",
|
|
967
|
+
body: {
|
|
968
|
+
taskId: params.taskId,
|
|
969
|
+
payload: params.payload
|
|
970
|
+
}
|
|
971
|
+
})
|
|
972
|
+
};
|
|
973
|
+
const notification = {
|
|
974
|
+
sendByType: (params) => request({
|
|
975
|
+
path: "/api/notification-config/send-by-type",
|
|
976
|
+
method: "post",
|
|
977
|
+
body: {
|
|
978
|
+
...params,
|
|
979
|
+
appType: resolveAppType(context, params.appType)
|
|
980
|
+
}
|
|
981
|
+
}),
|
|
982
|
+
batchSendByType: (params) => request({
|
|
983
|
+
path: "/api/notification-config/batch-send-by-type",
|
|
984
|
+
method: "post",
|
|
985
|
+
body: {
|
|
986
|
+
...params,
|
|
987
|
+
appType: resolveAppType(context, params.appType)
|
|
988
|
+
}
|
|
989
|
+
})
|
|
990
|
+
};
|
|
991
|
+
const sdk = {
|
|
992
|
+
context,
|
|
993
|
+
request,
|
|
994
|
+
download,
|
|
995
|
+
transport: {
|
|
996
|
+
request,
|
|
997
|
+
download
|
|
998
|
+
},
|
|
999
|
+
form,
|
|
1000
|
+
user,
|
|
1001
|
+
role,
|
|
1002
|
+
permission,
|
|
1003
|
+
process,
|
|
1004
|
+
notification,
|
|
1005
|
+
dataSource: {
|
|
1006
|
+
run: async (name, params = {}) => {
|
|
1007
|
+
const descriptor = (context.page.dataSources || []).find(
|
|
1008
|
+
(item) => item.key === name
|
|
1009
|
+
);
|
|
1010
|
+
if (!descriptor) {
|
|
1011
|
+
throw new Error(`\u672A\u627E\u5230\u6570\u636E\u6E90: ${String(name || "")}`);
|
|
1012
|
+
}
|
|
1013
|
+
const runtimeParams = params;
|
|
1014
|
+
const resolvedFormUuid = String(
|
|
1015
|
+
runtimeParams.formUuid || descriptor.formUuid || ""
|
|
1016
|
+
).trim();
|
|
1017
|
+
switch (descriptor.type) {
|
|
1018
|
+
case "form.list":
|
|
1019
|
+
return form.advancedSearch({
|
|
1020
|
+
...runtimeParams,
|
|
1021
|
+
formUuid: resolvedFormUuid,
|
|
1022
|
+
filters: mergeSearchExpressions(
|
|
1023
|
+
descriptor.defaultFilter,
|
|
1024
|
+
runtimeParams.filters
|
|
1025
|
+
)
|
|
1026
|
+
});
|
|
1027
|
+
case "form.detail":
|
|
1028
|
+
return form.getDetail({
|
|
1029
|
+
...runtimeParams,
|
|
1030
|
+
formUuid: resolvedFormUuid
|
|
1031
|
+
});
|
|
1032
|
+
case "form.create":
|
|
1033
|
+
return form.create({
|
|
1034
|
+
...runtimeParams,
|
|
1035
|
+
formUuid: resolvedFormUuid
|
|
1036
|
+
});
|
|
1037
|
+
case "form.update":
|
|
1038
|
+
return form.update({
|
|
1039
|
+
...runtimeParams,
|
|
1040
|
+
formUuid: resolvedFormUuid
|
|
1041
|
+
});
|
|
1042
|
+
case "form.delete":
|
|
1043
|
+
return form.remove({
|
|
1044
|
+
...runtimeParams,
|
|
1045
|
+
formUuid: resolvedFormUuid
|
|
1046
|
+
});
|
|
1047
|
+
default:
|
|
1048
|
+
throw new Error(`\u6682\u4E0D\u652F\u6301\u7684\u6570\u636E\u6E90\u7C7B\u578B: ${String(descriptor.type)}`);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
},
|
|
1052
|
+
navigation: context.navigation,
|
|
1053
|
+
ui: context.ui
|
|
1054
|
+
};
|
|
1055
|
+
return sdk;
|
|
1056
|
+
};
|
|
1057
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1058
|
+
0 && (module.exports = {
|
|
1059
|
+
createPageSdk
|
|
1060
|
+
});
|