openxiangda 1.0.56 → 1.0.58
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/package.json +1 -1
- package/packages/sdk/dist/runtime/index.cjs +481 -460
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.d.mts +9 -2
- package/packages/sdk/dist/runtime/index.d.ts +9 -2
- package/packages/sdk/dist/runtime/index.mjs +478 -459
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/react.cjs +9 -1
- package/packages/sdk/dist/runtime/react.cjs.map +1 -1
- package/packages/sdk/dist/runtime/react.mjs +9 -1
- package/packages/sdk/dist/runtime/react.mjs.map +1 -1
- package/templates/openxiangda-react-spa/src/layouts/AdminShell.tsx +107 -62
- package/templates/openxiangda-react-spa/src/layouts/UserShell.tsx +42 -14
- package/templates/openxiangda-react-spa/src/main.tsx +1 -0
- package/templates/openxiangda-react-spa/src/pages/defaults/FormRoutePage.tsx +6 -1
|
@@ -833,11 +833,13 @@ __export(runtime_exports, {
|
|
|
833
833
|
createBuiltinRouteRequest: () => createBuiltinRouteRequest,
|
|
834
834
|
createPageSdk: () => createPageSdk,
|
|
835
835
|
createReactPage: () => createReactPage,
|
|
836
|
+
extractFieldsFromComponentsTree: () => extractFieldsFromComponentsTree,
|
|
836
837
|
fetchBrowserRuntimeBootstrap: () => fetchBrowserRuntimeBootstrap,
|
|
837
838
|
loadCustomPageModule: () => loadCustomPageModule,
|
|
838
839
|
loadRuntimeScriptModules: () => loadRuntimeScriptModules,
|
|
839
840
|
mountBrowserPageRuntime: () => mountBrowserPageRuntime,
|
|
840
841
|
mountCustomPageRuntime: () => mountCustomPageRuntime,
|
|
842
|
+
normalizeRuntimeFormSchema: () => normalizeRuntimeFormSchema,
|
|
841
843
|
resolveBrowserRuntimeRoute: () => resolveBrowserRuntimeRoute,
|
|
842
844
|
resolveRuntimeAssets: () => resolveRuntimeAssets,
|
|
843
845
|
useAppMenus: () => useAppMenus,
|
|
@@ -3316,6 +3318,15 @@ var usePageRoute = () => {
|
|
|
3316
3318
|
// packages/sdk/src/runtime/react/openxiangdaProvider.tsx
|
|
3317
3319
|
init_cjs_shims();
|
|
3318
3320
|
var import_react7 = require("react");
|
|
3321
|
+
|
|
3322
|
+
// packages/sdk/src/runtime/core/fetch.ts
|
|
3323
|
+
init_cjs_shims();
|
|
3324
|
+
var createBoundFetch = (fetchImpl) => {
|
|
3325
|
+
const baseFetch = fetchImpl || globalThis.fetch;
|
|
3326
|
+
return ((input, init) => baseFetch.call(globalThis, input, init));
|
|
3327
|
+
};
|
|
3328
|
+
|
|
3329
|
+
// packages/sdk/src/runtime/react/openxiangdaProvider.tsx
|
|
3319
3330
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
3320
3331
|
var OpenXiangdaRuntimeContext = (0, import_react7.createContext)(null);
|
|
3321
3332
|
var OpenXiangdaProvider = ({
|
|
@@ -3324,7 +3335,7 @@ var OpenXiangdaProvider = ({
|
|
|
3324
3335
|
fetchImpl,
|
|
3325
3336
|
children
|
|
3326
3337
|
}) => {
|
|
3327
|
-
const resolvedFetch = fetchImpl
|
|
3338
|
+
const resolvedFetch = (0, import_react7.useMemo)(() => createBoundFetch(fetchImpl), [fetchImpl]);
|
|
3328
3339
|
const resolvedAppType = (0, import_react7.useMemo)(
|
|
3329
3340
|
() => appType || resolveAppTypeFromLocation(),
|
|
3330
3341
|
[appType]
|
|
@@ -3579,7 +3590,7 @@ var parseJsonResponse = async (response) => {
|
|
|
3579
3590
|
};
|
|
3580
3591
|
var createBrowserPageBridge = (options = {}) => {
|
|
3581
3592
|
const servicePrefix = options.servicePrefix || getDefaultServicePrefix();
|
|
3582
|
-
const fetchImpl = options.fetchImpl
|
|
3593
|
+
const fetchImpl = createBoundFetch(options.fetchImpl);
|
|
3583
3594
|
const request = async (payload) => {
|
|
3584
3595
|
if (!payload?.path) {
|
|
3585
3596
|
throw new Error("transport.request \u9700\u8981 path");
|
|
@@ -3705,6 +3716,7 @@ var createBrowserPageContext = (bootstrap, options = {}) => {
|
|
|
3705
3716
|
};
|
|
3706
3717
|
};
|
|
3707
3718
|
var resolveRuntimeAssets = async (bootstrap, fetchImpl = fetch) => {
|
|
3719
|
+
const boundFetch = createBoundFetch(fetchImpl);
|
|
3708
3720
|
const fallback = {
|
|
3709
3721
|
entryUrl: bootstrap.runtimeAssets?.entryUrl || bootstrap.asset?.entryUrl || "",
|
|
3710
3722
|
cssUrls: bootstrap.runtimeAssets?.cssUrls || bootstrap.asset?.cssAssets || [],
|
|
@@ -3717,7 +3729,7 @@ var resolveRuntimeAssets = async (bootstrap, fetchImpl = fetch) => {
|
|
|
3717
3729
|
return fallback;
|
|
3718
3730
|
}
|
|
3719
3731
|
try {
|
|
3720
|
-
const response = await
|
|
3732
|
+
const response = await boundFetch(bootstrap.asset.manifestUrl, {
|
|
3721
3733
|
credentials: "omit"
|
|
3722
3734
|
});
|
|
3723
3735
|
if (!response.ok) return fallback;
|
|
@@ -3752,7 +3764,8 @@ var fetchBrowserRuntimeBootstrap = async ({
|
|
|
3752
3764
|
const path = bootstrapPath || `/openxiangda-api/v1/apps/${encodeURIComponent(
|
|
3753
3765
|
appType
|
|
3754
3766
|
)}/pages/${encodeURIComponent(pageKey)}/bootstrap`;
|
|
3755
|
-
const
|
|
3767
|
+
const boundFetch = createBoundFetch(fetchImpl);
|
|
3768
|
+
const response = await boundFetch(
|
|
3756
3769
|
joinServicePath(servicePrefix || getDefaultServicePrefix(), path),
|
|
3757
3770
|
{
|
|
3758
3771
|
method: "GET",
|
|
@@ -3787,7 +3800,8 @@ var resolveBrowserRuntimeRoute = async ({
|
|
|
3787
3800
|
const endpoint = resolvePath || `/openxiangda-api/v1/apps/${encodeURIComponent(
|
|
3788
3801
|
appType
|
|
3789
3802
|
)}/runtime/routes/resolve`;
|
|
3790
|
-
const
|
|
3803
|
+
const boundFetch = createBoundFetch(fetchImpl);
|
|
3804
|
+
const response = await boundFetch(
|
|
3791
3805
|
joinServicePath(servicePrefix || getDefaultServicePrefix(), endpoint),
|
|
3792
3806
|
{
|
|
3793
3807
|
method: "POST",
|
|
@@ -4273,378 +4287,6 @@ function createFormRuntimeApi(config3) {
|
|
|
4273
4287
|
return { ...defaults2, ...overrides, request };
|
|
4274
4288
|
}
|
|
4275
4289
|
|
|
4276
|
-
// packages/sdk/src/components/core/dataManagementApi.ts
|
|
4277
|
-
init_cjs_shims();
|
|
4278
|
-
var unwrap = (response) => {
|
|
4279
|
-
if (response instanceof Blob) return response;
|
|
4280
|
-
if (response?.data?.result !== void 0) return response.data.result;
|
|
4281
|
-
if (response?.result !== void 0) return response.result;
|
|
4282
|
-
if (response?.data !== void 0) return response.data;
|
|
4283
|
-
return response;
|
|
4284
|
-
};
|
|
4285
|
-
var pickData = (value) => value?.data ?? value?.result ?? value;
|
|
4286
|
-
var normalizeComponentName = (field) => field?.componentName || field?.component_name || field?.component_type || field?.componentType || field?.type || "TextField";
|
|
4287
|
-
var normalizeField = (key, field, system = false) => ({
|
|
4288
|
-
...field,
|
|
4289
|
-
id: field?.id || field?.fieldId || key,
|
|
4290
|
-
fieldId: field?.fieldId || field?.id || key,
|
|
4291
|
-
componentName: normalizeComponentName(field),
|
|
4292
|
-
label: field?.label || field?.title || field?.name || key,
|
|
4293
|
-
width: field?.width,
|
|
4294
|
-
system
|
|
4295
|
-
});
|
|
4296
|
-
var SYSTEM_VALUE_ALIASES = {
|
|
4297
|
-
formInstanceId: ["formInstanceId", "formInstId", "form_instance_id", "processInstanceId"],
|
|
4298
|
-
instanceTitle: ["instanceTitle", "instance_title", "processInstanceTitle", "title"],
|
|
4299
|
-
createdBy: ["createdBy", "created_by", "originator"],
|
|
4300
|
-
createdByName: ["createdByName", "created_by_name", "originatorName", "creatorName"],
|
|
4301
|
-
createdByDepartmentId: ["createdByDepartmentId", "created_by_department_id", "originatorCorp"],
|
|
4302
|
-
createdByDepartmentName: [
|
|
4303
|
-
"createdByDepartmentName",
|
|
4304
|
-
"created_by_department_name",
|
|
4305
|
-
"originatorDepartmentName",
|
|
4306
|
-
"originatorCorpName"
|
|
4307
|
-
],
|
|
4308
|
-
createdAt: ["createdAt", "created_at", "createTime", "gmtCreate"],
|
|
4309
|
-
updatedAt: ["updatedAt", "updated_at", "modifiedTime", "modifyTime", "gmtModified"]
|
|
4310
|
-
};
|
|
4311
|
-
var pickAliasValue = (record2, aliases) => {
|
|
4312
|
-
for (const alias of aliases) {
|
|
4313
|
-
const value = record2?.[alias];
|
|
4314
|
-
if (value !== void 0 && value !== null && value !== "") return value;
|
|
4315
|
-
}
|
|
4316
|
-
return void 0;
|
|
4317
|
-
};
|
|
4318
|
-
var normalizeDataManagementRecord = (record2) => {
|
|
4319
|
-
if (!record2 || typeof record2 !== "object" || Array.isArray(record2)) return record2;
|
|
4320
|
-
const normalized = { ...record2 };
|
|
4321
|
-
Object.entries(SYSTEM_VALUE_ALIASES).forEach(([targetKey, aliases]) => {
|
|
4322
|
-
if (normalized[targetKey] !== void 0 && normalized[targetKey] !== null) return;
|
|
4323
|
-
const aliasValue = pickAliasValue(record2, aliases);
|
|
4324
|
-
if (aliasValue !== void 0) normalized[targetKey] = aliasValue;
|
|
4325
|
-
});
|
|
4326
|
-
return normalized;
|
|
4327
|
-
};
|
|
4328
|
-
var PROCESS_INSTANCE_STATUS_OPTIONS = [
|
|
4329
|
-
{ label: "\u5F85\u5904\u7406", value: "pending" },
|
|
4330
|
-
{ label: "\u5BA1\u6279\u4E2D", value: "running" },
|
|
4331
|
-
{ label: "\u7B49\u5F85\u4E2D", value: "waiting" },
|
|
4332
|
-
{ label: "\u6D41\u7A0B\u5F02\u5E38", value: "exception" },
|
|
4333
|
-
{ label: "\u5DF2\u5B8C\u6210", value: "completed" },
|
|
4334
|
-
{ label: "\u5DF2\u62D2\u7EDD", value: "terminated" },
|
|
4335
|
-
{ label: "\u5DF2\u64A4\u9500", value: "withdrawn" }
|
|
4336
|
-
];
|
|
4337
|
-
var APPROVAL_RESULT_OPTIONS = [
|
|
4338
|
-
{ label: "\u5BA1\u6279\u4E2D", value: "processing" },
|
|
4339
|
-
{ label: "\u540C\u610F", value: "approved" },
|
|
4340
|
-
{ label: "\u62D2\u7EDD", value: "rejected" },
|
|
4341
|
-
{ label: "\u64A4\u9500", value: "withdrawn" },
|
|
4342
|
-
{ label: "\u5F02\u5E38", value: "exception" }
|
|
4343
|
-
];
|
|
4344
|
-
var PROCESS_SYSTEM_FIELDS = [
|
|
4345
|
-
normalizeField(
|
|
4346
|
-
"currentApprovalNodeName",
|
|
4347
|
-
{
|
|
4348
|
-
label: "\u5F53\u524D\u5BA1\u6279\u8282\u70B9",
|
|
4349
|
-
componentName: "TextField",
|
|
4350
|
-
width: 140,
|
|
4351
|
-
processOnly: true,
|
|
4352
|
-
displayable: true
|
|
4353
|
-
},
|
|
4354
|
-
true
|
|
4355
|
-
),
|
|
4356
|
-
normalizeField(
|
|
4357
|
-
"processInstanceStatus",
|
|
4358
|
-
{
|
|
4359
|
-
label: "\u5B9E\u4F8B\u72B6\u6001",
|
|
4360
|
-
componentName: "SelectField",
|
|
4361
|
-
width: 110,
|
|
4362
|
-
options: PROCESS_INSTANCE_STATUS_OPTIONS,
|
|
4363
|
-
processOnly: true,
|
|
4364
|
-
displayable: true
|
|
4365
|
-
},
|
|
4366
|
-
true
|
|
4367
|
-
),
|
|
4368
|
-
normalizeField(
|
|
4369
|
-
"approvalResult",
|
|
4370
|
-
{
|
|
4371
|
-
label: "\u5BA1\u6279\u7ED3\u679C",
|
|
4372
|
-
componentName: "SelectField",
|
|
4373
|
-
width: 110,
|
|
4374
|
-
options: APPROVAL_RESULT_OPTIONS,
|
|
4375
|
-
processOnly: true,
|
|
4376
|
-
displayable: true
|
|
4377
|
-
},
|
|
4378
|
-
true
|
|
4379
|
-
)
|
|
4380
|
-
];
|
|
4381
|
-
var BASE_SYSTEM_FIELDS = [
|
|
4382
|
-
normalizeField(
|
|
4383
|
-
"instanceTitle",
|
|
4384
|
-
{ label: "\u5B9E\u4F8B\u6807\u9898", componentName: "TextField", width: 220, displayable: true },
|
|
4385
|
-
true
|
|
4386
|
-
),
|
|
4387
|
-
normalizeField(
|
|
4388
|
-
"createdByName",
|
|
4389
|
-
{ label: "\u521B\u5EFA\u4EBA", componentName: "TextField", width: 130, displayable: true },
|
|
4390
|
-
true
|
|
4391
|
-
),
|
|
4392
|
-
normalizeField(
|
|
4393
|
-
"createdByDepartmentName",
|
|
4394
|
-
{ label: "\u521B\u5EFA\u4EBA\u90E8\u95E8", componentName: "TextField", width: 150, displayable: true },
|
|
4395
|
-
true
|
|
4396
|
-
),
|
|
4397
|
-
normalizeField(
|
|
4398
|
-
"createdAt",
|
|
4399
|
-
{ label: "\u521B\u5EFA\u65F6\u95F4", componentName: "DateField", width: 170, displayable: true },
|
|
4400
|
-
true
|
|
4401
|
-
),
|
|
4402
|
-
normalizeField(
|
|
4403
|
-
"updatedAt",
|
|
4404
|
-
{ label: "\u66F4\u65B0\u65F6\u95F4", componentName: "DateField", width: 170, displayable: true },
|
|
4405
|
-
true
|
|
4406
|
-
)
|
|
4407
|
-
];
|
|
4408
|
-
var getSystemFieldsForFormType = (formType) => formType === "process" ? [...BASE_SYSTEM_FIELDS, ...PROCESS_SYSTEM_FIELDS] : BASE_SYSTEM_FIELDS;
|
|
4409
|
-
var normalizeDataManagementFields = (payload) => {
|
|
4410
|
-
const data = pickData(payload);
|
|
4411
|
-
const rawSchema = data?.schema || data?.formSchema || data?.publishedSchema || data;
|
|
4412
|
-
const schemaAppType = rawSchema?.formMeta?.appType || data?.appType;
|
|
4413
|
-
const schemaFormUuid = rawSchema?.formMeta?.formUuid || data?.formUuid;
|
|
4414
|
-
const schemaTitle = rawSchema?.formMeta?.title || data?.title || data?.name || data?.formName || schemaFormUuid;
|
|
4415
|
-
const formType = data?.formType || data?.schema?.formType || data?.schema?.template?.formType || rawSchema?.template?.formType || data?.type;
|
|
4416
|
-
const rawFields = data?.formFields || data?.schema?.formFields || data?.fields || data?.schema?.fields || data?.formSchema?.fields || [];
|
|
4417
|
-
const fields = Array.isArray(rawFields) ? rawFields.map((field) => normalizeField(field?.fieldId || field?.id, field)) : Object.entries(rawFields).map(([key, field]) => normalizeField(key, field));
|
|
4418
|
-
return {
|
|
4419
|
-
fields: fields.filter((field) => field.componentName !== "PageSection"),
|
|
4420
|
-
formType,
|
|
4421
|
-
schema: rawSchema && Array.isArray(rawSchema.fields) && schemaAppType && schemaFormUuid ? {
|
|
4422
|
-
...rawSchema,
|
|
4423
|
-
formMeta: {
|
|
4424
|
-
formUuid: schemaFormUuid,
|
|
4425
|
-
appType: schemaAppType,
|
|
4426
|
-
title: schemaTitle,
|
|
4427
|
-
...rawSchema.formMeta || {}
|
|
4428
|
-
},
|
|
4429
|
-
template: {
|
|
4430
|
-
type: "standard",
|
|
4431
|
-
...rawSchema.template || {},
|
|
4432
|
-
formType: rawSchema.template?.formType || formType
|
|
4433
|
-
}
|
|
4434
|
-
} : void 0
|
|
4435
|
-
};
|
|
4436
|
-
};
|
|
4437
|
-
var normalizeDataManagementList = (payload) => {
|
|
4438
|
-
const data = unwrap(payload);
|
|
4439
|
-
const body = data?.result || data;
|
|
4440
|
-
const records = body?.data || body?.records || body?.list || body?.items || [];
|
|
4441
|
-
const total = body?.totalCount ?? body?.total ?? body?.count ?? records.length;
|
|
4442
|
-
return {
|
|
4443
|
-
records: Array.isArray(records) ? records.map(normalizeDataManagementRecord) : [],
|
|
4444
|
-
total: Number(total) || 0
|
|
4445
|
-
};
|
|
4446
|
-
};
|
|
4447
|
-
var buildFilterPayload = (group) => {
|
|
4448
|
-
if (!group) return void 0;
|
|
4449
|
-
const normalizeOperator2 = (operator) => {
|
|
4450
|
-
const raw = String(operator || "").trim();
|
|
4451
|
-
const aliases = {
|
|
4452
|
-
contains: "CONTAINS",
|
|
4453
|
-
eq: "EQ",
|
|
4454
|
-
ne: "NEQ",
|
|
4455
|
-
neq: "NEQ",
|
|
4456
|
-
gt: "GT",
|
|
4457
|
-
gte: "GTE",
|
|
4458
|
-
lt: "LT",
|
|
4459
|
-
lte: "LTE",
|
|
4460
|
-
between: "BETWEEN",
|
|
4461
|
-
in: "IN",
|
|
4462
|
-
is_null: "IS_NULL",
|
|
4463
|
-
is_not_null: "IS_NOT_NULL",
|
|
4464
|
-
empty: "IS_NULL",
|
|
4465
|
-
not_empty: "IS_NOT_NULL",
|
|
4466
|
-
notEmpty: "IS_NOT_NULL"
|
|
4467
|
-
};
|
|
4468
|
-
return aliases[raw] || aliases[raw.toLowerCase()] || raw.toUpperCase();
|
|
4469
|
-
};
|
|
4470
|
-
const isNoValueOperator = (operator) => ["IS_NULL", "IS_NOT_NULL"].includes(normalizeOperator2(operator));
|
|
4471
|
-
const hasRuleValue = (rule) => {
|
|
4472
|
-
if (isNoValueOperator(rule.operator)) return true;
|
|
4473
|
-
if (Array.isArray(rule.value)) {
|
|
4474
|
-
return rule.value.some((item) => item !== void 0 && item !== null && item !== "");
|
|
4475
|
-
}
|
|
4476
|
-
return rule.value !== void 0 && rule.value !== null && rule.value !== "";
|
|
4477
|
-
};
|
|
4478
|
-
const trimGroup = (current) => ({
|
|
4479
|
-
...current,
|
|
4480
|
-
rules: (current.rules || []).filter((rule) => rule.key && rule.operator && hasRuleValue(rule)).map((rule) => ({
|
|
4481
|
-
...rule,
|
|
4482
|
-
operator: normalizeOperator2(rule.operator),
|
|
4483
|
-
value: isNoValueOperator(rule.operator) ? null : rule.value
|
|
4484
|
-
})),
|
|
4485
|
-
conditions: (current.conditions || []).map(trimGroup).filter((item) => item.rules.length > 0 || item.conditions.length > 0)
|
|
4486
|
-
});
|
|
4487
|
-
const payload = trimGroup(group);
|
|
4488
|
-
if (payload.rules.length === 0 && payload.conditions.length === 0) return void 0;
|
|
4489
|
-
return JSON.stringify(payload);
|
|
4490
|
-
};
|
|
4491
|
-
var normalizeColumnConfig = (cfg, fields) => {
|
|
4492
|
-
const allowed = new Set(fields.map((field) => field.fieldId));
|
|
4493
|
-
const configured = Array.isArray(cfg?.showFields) ? cfg.showFields.filter((fieldId) => allowed.has(fieldId)) : [];
|
|
4494
|
-
const defaultBusinessFields = fields.filter((field) => !field.system).slice(0, 8).map((field) => field.fieldId);
|
|
4495
|
-
const defaultSystemFields = fields.filter((field) => field.system && field.displayable).map((field) => field.fieldId);
|
|
4496
|
-
const defaultShow = [...defaultBusinessFields, ...defaultSystemFields];
|
|
4497
|
-
return {
|
|
4498
|
-
showFields: configured.length > 0 ? configured : defaultShow,
|
|
4499
|
-
widths: cfg?.widths || {},
|
|
4500
|
-
lockFieldIds: cfg?.lockFieldIds || [],
|
|
4501
|
-
sort: Array.isArray(cfg?.sort) ? cfg.sort : [],
|
|
4502
|
-
density: cfg?.density || "middle",
|
|
4503
|
-
detailOpenMode: cfg?.detailOpenMode === "newPage" ? "newPage" : "drawer",
|
|
4504
|
-
pageSize: cfg?.pageSize || 10
|
|
4505
|
-
};
|
|
4506
|
-
};
|
|
4507
|
-
async function getDataManagementSchema(request, params) {
|
|
4508
|
-
const response = await request({
|
|
4509
|
-
url: "/form/getFormSchemaAndPackages",
|
|
4510
|
-
method: "get",
|
|
4511
|
-
params
|
|
4512
|
-
});
|
|
4513
|
-
const result = normalizeDataManagementFields(response);
|
|
4514
|
-
if (result.schema) {
|
|
4515
|
-
result.schema = {
|
|
4516
|
-
...result.schema,
|
|
4517
|
-
formMeta: {
|
|
4518
|
-
...result.schema.formMeta,
|
|
4519
|
-
appType: result.schema.formMeta?.appType || params.appType,
|
|
4520
|
-
formUuid: result.schema.formMeta?.formUuid || params.formUuid,
|
|
4521
|
-
title: result.schema.formMeta?.title || params.formUuid
|
|
4522
|
-
}
|
|
4523
|
-
};
|
|
4524
|
-
}
|
|
4525
|
-
return result;
|
|
4526
|
-
}
|
|
4527
|
-
async function getDataManagementConfig(request, options) {
|
|
4528
|
-
const targetFormUuid = options.menuFormUuid || options.formUuid;
|
|
4529
|
-
const personal = options.scope === "personal";
|
|
4530
|
-
const response = await request({
|
|
4531
|
-
url: `/${options.appType}/v1/form/dataManagement/config/${personal ? "personal/" : ""}get.json`,
|
|
4532
|
-
method: "get",
|
|
4533
|
-
params: { formUuid: targetFormUuid }
|
|
4534
|
-
});
|
|
4535
|
-
return unwrap(response);
|
|
4536
|
-
}
|
|
4537
|
-
async function saveDataManagementConfig(request, options) {
|
|
4538
|
-
const targetFormUuid = options.menuFormUuid || options.formUuid;
|
|
4539
|
-
const personal = options.scope === "personal";
|
|
4540
|
-
const response = await request({
|
|
4541
|
-
url: `/${options.appType}/v1/form/dataManagement/config/${personal ? "personal/" : ""}save.json`,
|
|
4542
|
-
method: "post",
|
|
4543
|
-
data: { formUuid: targetFormUuid, config: options.config }
|
|
4544
|
-
});
|
|
4545
|
-
return unwrap(response);
|
|
4546
|
-
}
|
|
4547
|
-
async function advancedSearchDataManagement(request, query) {
|
|
4548
|
-
const response = await request({
|
|
4549
|
-
url: `/${query.appType}/v1/form/advancedSearch.json`,
|
|
4550
|
-
method: "get",
|
|
4551
|
-
params: {
|
|
4552
|
-
appType: query.appType,
|
|
4553
|
-
formUuid: query.formUuid,
|
|
4554
|
-
filters: query.rawFilters ?? buildFilterPayload(query.filters),
|
|
4555
|
-
conditionType: query.conditionType,
|
|
4556
|
-
searchKeyWord: query.searchKeyWord,
|
|
4557
|
-
currentPage: query.currentPage || 1,
|
|
4558
|
-
pageSize: query.pageSize || 10,
|
|
4559
|
-
order: JSON.stringify(query.order || []),
|
|
4560
|
-
instanceStatus: query.instanceStatus
|
|
4561
|
-
}
|
|
4562
|
-
});
|
|
4563
|
-
return normalizeDataManagementList(response);
|
|
4564
|
-
}
|
|
4565
|
-
async function deleteDataManagementRows(request, params) {
|
|
4566
|
-
const formInstId = params.formInstanceIds.length === 1 ? params.formInstanceIds[0] : params.formInstanceIds;
|
|
4567
|
-
const response = await request({
|
|
4568
|
-
url: `/${params.appType}/v1/form/deleteFormData.json`,
|
|
4569
|
-
method: "post",
|
|
4570
|
-
data: {
|
|
4571
|
-
appType: params.appType,
|
|
4572
|
-
formUuid: params.formUuid,
|
|
4573
|
-
formInstId,
|
|
4574
|
-
formInstIds: params.formInstanceIds,
|
|
4575
|
-
formInstanceIds: params.formInstanceIds
|
|
4576
|
-
}
|
|
4577
|
-
});
|
|
4578
|
-
return unwrap(response);
|
|
4579
|
-
}
|
|
4580
|
-
async function batchApproveDataManagementRows(request, params) {
|
|
4581
|
-
const response = await request({
|
|
4582
|
-
url: "/workflow/approve/batch",
|
|
4583
|
-
method: "post",
|
|
4584
|
-
data: {
|
|
4585
|
-
instanceIds: params.formInstanceIds,
|
|
4586
|
-
action: params.action,
|
|
4587
|
-
comments: params.comments
|
|
4588
|
-
}
|
|
4589
|
-
});
|
|
4590
|
-
return unwrap(response);
|
|
4591
|
-
}
|
|
4592
|
-
async function exportDataManagementRows(request, params) {
|
|
4593
|
-
return request({
|
|
4594
|
-
url: `/${params.appType}/v1/form/advancedExport.xlsx`,
|
|
4595
|
-
method: "get",
|
|
4596
|
-
responseType: "blob",
|
|
4597
|
-
params: {
|
|
4598
|
-
appType: params.appType,
|
|
4599
|
-
formUuid: params.formUuid,
|
|
4600
|
-
filters: params.rawFilters ?? buildFilterPayload(params.filters),
|
|
4601
|
-
conditionType: params.conditionType,
|
|
4602
|
-
searchKeyWord: params.searchKeyWord,
|
|
4603
|
-
currentPage: params.currentPage,
|
|
4604
|
-
pageSize: params.pageSize,
|
|
4605
|
-
order: JSON.stringify(params.order || []),
|
|
4606
|
-
instanceStatus: params.instanceStatus,
|
|
4607
|
-
exportAll: params.exportAll || "n",
|
|
4608
|
-
embedImages: params.embedImages || "n",
|
|
4609
|
-
exportFields: (params.exportFields || []).join(",")
|
|
4610
|
-
}
|
|
4611
|
-
});
|
|
4612
|
-
}
|
|
4613
|
-
async function downloadDataManagementImportTemplate(request, params) {
|
|
4614
|
-
return request({
|
|
4615
|
-
url: `/${params.appType}/v1/form/advancedExportTemplate.xlsx`,
|
|
4616
|
-
method: "get",
|
|
4617
|
-
responseType: "blob",
|
|
4618
|
-
params: {
|
|
4619
|
-
formUuid: params.formUuid
|
|
4620
|
-
}
|
|
4621
|
-
});
|
|
4622
|
-
}
|
|
4623
|
-
async function importPreviewDataManagementRows(request, params) {
|
|
4624
|
-
const response = await request({
|
|
4625
|
-
url: `/${params.appType}/v1/form/importPreview.xlsx`,
|
|
4626
|
-
method: "post",
|
|
4627
|
-
data: { formUuid: params.formUuid, fileBase64: params.fileBase64 }
|
|
4628
|
-
});
|
|
4629
|
-
return unwrap(response);
|
|
4630
|
-
}
|
|
4631
|
-
async function importDataManagementRows(request, params) {
|
|
4632
|
-
const response = await request({
|
|
4633
|
-
url: `/${params.appType}/v1/form/import.xlsx`,
|
|
4634
|
-
method: "post",
|
|
4635
|
-
data: { formUuid: params.formUuid, fileBase64: params.fileBase64 }
|
|
4636
|
-
});
|
|
4637
|
-
return unwrap(response);
|
|
4638
|
-
}
|
|
4639
|
-
async function getDataManagementTransferRecords(request, params) {
|
|
4640
|
-
const response = await request({
|
|
4641
|
-
url: `/${params.appType}/v1/form/${params.type}Records.json`,
|
|
4642
|
-
method: "get",
|
|
4643
|
-
params
|
|
4644
|
-
});
|
|
4645
|
-
return normalizeDataManagementList(response);
|
|
4646
|
-
}
|
|
4647
|
-
|
|
4648
4290
|
// packages/sdk/src/components/modules/DataManagementList.tsx
|
|
4649
4291
|
init_cjs_shims();
|
|
4650
4292
|
var import_react281 = require("react");
|
|
@@ -47996,6 +47638,378 @@ var StandardFormPage = ({
|
|
|
47996
47638
|
);
|
|
47997
47639
|
};
|
|
47998
47640
|
|
|
47641
|
+
// packages/sdk/src/components/core/dataManagementApi.ts
|
|
47642
|
+
init_cjs_shims();
|
|
47643
|
+
var unwrap = (response) => {
|
|
47644
|
+
if (response instanceof Blob) return response;
|
|
47645
|
+
if (response?.data?.result !== void 0) return response.data.result;
|
|
47646
|
+
if (response?.result !== void 0) return response.result;
|
|
47647
|
+
if (response?.data !== void 0) return response.data;
|
|
47648
|
+
return response;
|
|
47649
|
+
};
|
|
47650
|
+
var pickData = (value) => value?.data ?? value?.result ?? value;
|
|
47651
|
+
var normalizeComponentName = (field) => field?.componentName || field?.component_name || field?.component_type || field?.componentType || field?.type || "TextField";
|
|
47652
|
+
var normalizeField = (key, field, system = false) => ({
|
|
47653
|
+
...field,
|
|
47654
|
+
id: field?.id || field?.fieldId || key,
|
|
47655
|
+
fieldId: field?.fieldId || field?.id || key,
|
|
47656
|
+
componentName: normalizeComponentName(field),
|
|
47657
|
+
label: field?.label || field?.title || field?.name || key,
|
|
47658
|
+
width: field?.width,
|
|
47659
|
+
system
|
|
47660
|
+
});
|
|
47661
|
+
var SYSTEM_VALUE_ALIASES = {
|
|
47662
|
+
formInstanceId: ["formInstanceId", "formInstId", "form_instance_id", "processInstanceId"],
|
|
47663
|
+
instanceTitle: ["instanceTitle", "instance_title", "processInstanceTitle", "title"],
|
|
47664
|
+
createdBy: ["createdBy", "created_by", "originator"],
|
|
47665
|
+
createdByName: ["createdByName", "created_by_name", "originatorName", "creatorName"],
|
|
47666
|
+
createdByDepartmentId: ["createdByDepartmentId", "created_by_department_id", "originatorCorp"],
|
|
47667
|
+
createdByDepartmentName: [
|
|
47668
|
+
"createdByDepartmentName",
|
|
47669
|
+
"created_by_department_name",
|
|
47670
|
+
"originatorDepartmentName",
|
|
47671
|
+
"originatorCorpName"
|
|
47672
|
+
],
|
|
47673
|
+
createdAt: ["createdAt", "created_at", "createTime", "gmtCreate"],
|
|
47674
|
+
updatedAt: ["updatedAt", "updated_at", "modifiedTime", "modifyTime", "gmtModified"]
|
|
47675
|
+
};
|
|
47676
|
+
var pickAliasValue = (record2, aliases) => {
|
|
47677
|
+
for (const alias of aliases) {
|
|
47678
|
+
const value = record2?.[alias];
|
|
47679
|
+
if (value !== void 0 && value !== null && value !== "") return value;
|
|
47680
|
+
}
|
|
47681
|
+
return void 0;
|
|
47682
|
+
};
|
|
47683
|
+
var normalizeDataManagementRecord = (record2) => {
|
|
47684
|
+
if (!record2 || typeof record2 !== "object" || Array.isArray(record2)) return record2;
|
|
47685
|
+
const normalized = { ...record2 };
|
|
47686
|
+
Object.entries(SYSTEM_VALUE_ALIASES).forEach(([targetKey, aliases]) => {
|
|
47687
|
+
if (normalized[targetKey] !== void 0 && normalized[targetKey] !== null) return;
|
|
47688
|
+
const aliasValue = pickAliasValue(record2, aliases);
|
|
47689
|
+
if (aliasValue !== void 0) normalized[targetKey] = aliasValue;
|
|
47690
|
+
});
|
|
47691
|
+
return normalized;
|
|
47692
|
+
};
|
|
47693
|
+
var PROCESS_INSTANCE_STATUS_OPTIONS = [
|
|
47694
|
+
{ label: "\u5F85\u5904\u7406", value: "pending" },
|
|
47695
|
+
{ label: "\u5BA1\u6279\u4E2D", value: "running" },
|
|
47696
|
+
{ label: "\u7B49\u5F85\u4E2D", value: "waiting" },
|
|
47697
|
+
{ label: "\u6D41\u7A0B\u5F02\u5E38", value: "exception" },
|
|
47698
|
+
{ label: "\u5DF2\u5B8C\u6210", value: "completed" },
|
|
47699
|
+
{ label: "\u5DF2\u62D2\u7EDD", value: "terminated" },
|
|
47700
|
+
{ label: "\u5DF2\u64A4\u9500", value: "withdrawn" }
|
|
47701
|
+
];
|
|
47702
|
+
var APPROVAL_RESULT_OPTIONS = [
|
|
47703
|
+
{ label: "\u5BA1\u6279\u4E2D", value: "processing" },
|
|
47704
|
+
{ label: "\u540C\u610F", value: "approved" },
|
|
47705
|
+
{ label: "\u62D2\u7EDD", value: "rejected" },
|
|
47706
|
+
{ label: "\u64A4\u9500", value: "withdrawn" },
|
|
47707
|
+
{ label: "\u5F02\u5E38", value: "exception" }
|
|
47708
|
+
];
|
|
47709
|
+
var PROCESS_SYSTEM_FIELDS = [
|
|
47710
|
+
normalizeField(
|
|
47711
|
+
"currentApprovalNodeName",
|
|
47712
|
+
{
|
|
47713
|
+
label: "\u5F53\u524D\u5BA1\u6279\u8282\u70B9",
|
|
47714
|
+
componentName: "TextField",
|
|
47715
|
+
width: 140,
|
|
47716
|
+
processOnly: true,
|
|
47717
|
+
displayable: true
|
|
47718
|
+
},
|
|
47719
|
+
true
|
|
47720
|
+
),
|
|
47721
|
+
normalizeField(
|
|
47722
|
+
"processInstanceStatus",
|
|
47723
|
+
{
|
|
47724
|
+
label: "\u5B9E\u4F8B\u72B6\u6001",
|
|
47725
|
+
componentName: "SelectField",
|
|
47726
|
+
width: 110,
|
|
47727
|
+
options: PROCESS_INSTANCE_STATUS_OPTIONS,
|
|
47728
|
+
processOnly: true,
|
|
47729
|
+
displayable: true
|
|
47730
|
+
},
|
|
47731
|
+
true
|
|
47732
|
+
),
|
|
47733
|
+
normalizeField(
|
|
47734
|
+
"approvalResult",
|
|
47735
|
+
{
|
|
47736
|
+
label: "\u5BA1\u6279\u7ED3\u679C",
|
|
47737
|
+
componentName: "SelectField",
|
|
47738
|
+
width: 110,
|
|
47739
|
+
options: APPROVAL_RESULT_OPTIONS,
|
|
47740
|
+
processOnly: true,
|
|
47741
|
+
displayable: true
|
|
47742
|
+
},
|
|
47743
|
+
true
|
|
47744
|
+
)
|
|
47745
|
+
];
|
|
47746
|
+
var BASE_SYSTEM_FIELDS = [
|
|
47747
|
+
normalizeField(
|
|
47748
|
+
"instanceTitle",
|
|
47749
|
+
{ label: "\u5B9E\u4F8B\u6807\u9898", componentName: "TextField", width: 220, displayable: true },
|
|
47750
|
+
true
|
|
47751
|
+
),
|
|
47752
|
+
normalizeField(
|
|
47753
|
+
"createdByName",
|
|
47754
|
+
{ label: "\u521B\u5EFA\u4EBA", componentName: "TextField", width: 130, displayable: true },
|
|
47755
|
+
true
|
|
47756
|
+
),
|
|
47757
|
+
normalizeField(
|
|
47758
|
+
"createdByDepartmentName",
|
|
47759
|
+
{ label: "\u521B\u5EFA\u4EBA\u90E8\u95E8", componentName: "TextField", width: 150, displayable: true },
|
|
47760
|
+
true
|
|
47761
|
+
),
|
|
47762
|
+
normalizeField(
|
|
47763
|
+
"createdAt",
|
|
47764
|
+
{ label: "\u521B\u5EFA\u65F6\u95F4", componentName: "DateField", width: 170, displayable: true },
|
|
47765
|
+
true
|
|
47766
|
+
),
|
|
47767
|
+
normalizeField(
|
|
47768
|
+
"updatedAt",
|
|
47769
|
+
{ label: "\u66F4\u65B0\u65F6\u95F4", componentName: "DateField", width: 170, displayable: true },
|
|
47770
|
+
true
|
|
47771
|
+
)
|
|
47772
|
+
];
|
|
47773
|
+
var getSystemFieldsForFormType = (formType) => formType === "process" ? [...BASE_SYSTEM_FIELDS, ...PROCESS_SYSTEM_FIELDS] : BASE_SYSTEM_FIELDS;
|
|
47774
|
+
var normalizeDataManagementFields = (payload) => {
|
|
47775
|
+
const data = pickData(payload);
|
|
47776
|
+
const rawSchema = data?.schema || data?.formSchema || data?.publishedSchema || data;
|
|
47777
|
+
const schemaAppType = rawSchema?.formMeta?.appType || data?.appType;
|
|
47778
|
+
const schemaFormUuid = rawSchema?.formMeta?.formUuid || data?.formUuid;
|
|
47779
|
+
const schemaTitle = rawSchema?.formMeta?.title || data?.title || data?.name || data?.formName || schemaFormUuid;
|
|
47780
|
+
const formType = data?.formType || data?.schema?.formType || data?.schema?.template?.formType || rawSchema?.template?.formType || data?.type;
|
|
47781
|
+
const rawFields = data?.formFields || data?.schema?.formFields || data?.fields || data?.schema?.fields || data?.formSchema?.fields || [];
|
|
47782
|
+
const fields = Array.isArray(rawFields) ? rawFields.map((field) => normalizeField(field?.fieldId || field?.id, field)) : Object.entries(rawFields).map(([key, field]) => normalizeField(key, field));
|
|
47783
|
+
return {
|
|
47784
|
+
fields: fields.filter((field) => field.componentName !== "PageSection"),
|
|
47785
|
+
formType,
|
|
47786
|
+
schema: rawSchema && Array.isArray(rawSchema.fields) && schemaAppType && schemaFormUuid ? {
|
|
47787
|
+
...rawSchema,
|
|
47788
|
+
formMeta: {
|
|
47789
|
+
formUuid: schemaFormUuid,
|
|
47790
|
+
appType: schemaAppType,
|
|
47791
|
+
title: schemaTitle,
|
|
47792
|
+
...rawSchema.formMeta || {}
|
|
47793
|
+
},
|
|
47794
|
+
template: {
|
|
47795
|
+
type: "standard",
|
|
47796
|
+
...rawSchema.template || {},
|
|
47797
|
+
formType: rawSchema.template?.formType || formType
|
|
47798
|
+
}
|
|
47799
|
+
} : void 0
|
|
47800
|
+
};
|
|
47801
|
+
};
|
|
47802
|
+
var normalizeDataManagementList = (payload) => {
|
|
47803
|
+
const data = unwrap(payload);
|
|
47804
|
+
const body = data?.result || data;
|
|
47805
|
+
const records = body?.data || body?.records || body?.list || body?.items || [];
|
|
47806
|
+
const total = body?.totalCount ?? body?.total ?? body?.count ?? records.length;
|
|
47807
|
+
return {
|
|
47808
|
+
records: Array.isArray(records) ? records.map(normalizeDataManagementRecord) : [],
|
|
47809
|
+
total: Number(total) || 0
|
|
47810
|
+
};
|
|
47811
|
+
};
|
|
47812
|
+
var buildFilterPayload = (group) => {
|
|
47813
|
+
if (!group) return void 0;
|
|
47814
|
+
const normalizeOperator2 = (operator) => {
|
|
47815
|
+
const raw = String(operator || "").trim();
|
|
47816
|
+
const aliases = {
|
|
47817
|
+
contains: "CONTAINS",
|
|
47818
|
+
eq: "EQ",
|
|
47819
|
+
ne: "NEQ",
|
|
47820
|
+
neq: "NEQ",
|
|
47821
|
+
gt: "GT",
|
|
47822
|
+
gte: "GTE",
|
|
47823
|
+
lt: "LT",
|
|
47824
|
+
lte: "LTE",
|
|
47825
|
+
between: "BETWEEN",
|
|
47826
|
+
in: "IN",
|
|
47827
|
+
is_null: "IS_NULL",
|
|
47828
|
+
is_not_null: "IS_NOT_NULL",
|
|
47829
|
+
empty: "IS_NULL",
|
|
47830
|
+
not_empty: "IS_NOT_NULL",
|
|
47831
|
+
notEmpty: "IS_NOT_NULL"
|
|
47832
|
+
};
|
|
47833
|
+
return aliases[raw] || aliases[raw.toLowerCase()] || raw.toUpperCase();
|
|
47834
|
+
};
|
|
47835
|
+
const isNoValueOperator = (operator) => ["IS_NULL", "IS_NOT_NULL"].includes(normalizeOperator2(operator));
|
|
47836
|
+
const hasRuleValue = (rule) => {
|
|
47837
|
+
if (isNoValueOperator(rule.operator)) return true;
|
|
47838
|
+
if (Array.isArray(rule.value)) {
|
|
47839
|
+
return rule.value.some((item) => item !== void 0 && item !== null && item !== "");
|
|
47840
|
+
}
|
|
47841
|
+
return rule.value !== void 0 && rule.value !== null && rule.value !== "";
|
|
47842
|
+
};
|
|
47843
|
+
const trimGroup = (current) => ({
|
|
47844
|
+
...current,
|
|
47845
|
+
rules: (current.rules || []).filter((rule) => rule.key && rule.operator && hasRuleValue(rule)).map((rule) => ({
|
|
47846
|
+
...rule,
|
|
47847
|
+
operator: normalizeOperator2(rule.operator),
|
|
47848
|
+
value: isNoValueOperator(rule.operator) ? null : rule.value
|
|
47849
|
+
})),
|
|
47850
|
+
conditions: (current.conditions || []).map(trimGroup).filter((item) => item.rules.length > 0 || item.conditions.length > 0)
|
|
47851
|
+
});
|
|
47852
|
+
const payload = trimGroup(group);
|
|
47853
|
+
if (payload.rules.length === 0 && payload.conditions.length === 0) return void 0;
|
|
47854
|
+
return JSON.stringify(payload);
|
|
47855
|
+
};
|
|
47856
|
+
var normalizeColumnConfig = (cfg, fields) => {
|
|
47857
|
+
const allowed = new Set(fields.map((field) => field.fieldId));
|
|
47858
|
+
const configured = Array.isArray(cfg?.showFields) ? cfg.showFields.filter((fieldId) => allowed.has(fieldId)) : [];
|
|
47859
|
+
const defaultBusinessFields = fields.filter((field) => !field.system).slice(0, 8).map((field) => field.fieldId);
|
|
47860
|
+
const defaultSystemFields = fields.filter((field) => field.system && field.displayable).map((field) => field.fieldId);
|
|
47861
|
+
const defaultShow = [...defaultBusinessFields, ...defaultSystemFields];
|
|
47862
|
+
return {
|
|
47863
|
+
showFields: configured.length > 0 ? configured : defaultShow,
|
|
47864
|
+
widths: cfg?.widths || {},
|
|
47865
|
+
lockFieldIds: cfg?.lockFieldIds || [],
|
|
47866
|
+
sort: Array.isArray(cfg?.sort) ? cfg.sort : [],
|
|
47867
|
+
density: cfg?.density || "middle",
|
|
47868
|
+
detailOpenMode: cfg?.detailOpenMode === "newPage" ? "newPage" : "drawer",
|
|
47869
|
+
pageSize: cfg?.pageSize || 10
|
|
47870
|
+
};
|
|
47871
|
+
};
|
|
47872
|
+
async function getDataManagementSchema(request, params) {
|
|
47873
|
+
const response = await request({
|
|
47874
|
+
url: "/form/getFormSchemaAndPackages",
|
|
47875
|
+
method: "get",
|
|
47876
|
+
params
|
|
47877
|
+
});
|
|
47878
|
+
const result = normalizeDataManagementFields(response);
|
|
47879
|
+
if (result.schema) {
|
|
47880
|
+
result.schema = {
|
|
47881
|
+
...result.schema,
|
|
47882
|
+
formMeta: {
|
|
47883
|
+
...result.schema.formMeta,
|
|
47884
|
+
appType: result.schema.formMeta?.appType || params.appType,
|
|
47885
|
+
formUuid: result.schema.formMeta?.formUuid || params.formUuid,
|
|
47886
|
+
title: result.schema.formMeta?.title || params.formUuid
|
|
47887
|
+
}
|
|
47888
|
+
};
|
|
47889
|
+
}
|
|
47890
|
+
return result;
|
|
47891
|
+
}
|
|
47892
|
+
async function getDataManagementConfig(request, options) {
|
|
47893
|
+
const targetFormUuid = options.menuFormUuid || options.formUuid;
|
|
47894
|
+
const personal = options.scope === "personal";
|
|
47895
|
+
const response = await request({
|
|
47896
|
+
url: `/${options.appType}/v1/form/dataManagement/config/${personal ? "personal/" : ""}get.json`,
|
|
47897
|
+
method: "get",
|
|
47898
|
+
params: { formUuid: targetFormUuid }
|
|
47899
|
+
});
|
|
47900
|
+
return unwrap(response);
|
|
47901
|
+
}
|
|
47902
|
+
async function saveDataManagementConfig(request, options) {
|
|
47903
|
+
const targetFormUuid = options.menuFormUuid || options.formUuid;
|
|
47904
|
+
const personal = options.scope === "personal";
|
|
47905
|
+
const response = await request({
|
|
47906
|
+
url: `/${options.appType}/v1/form/dataManagement/config/${personal ? "personal/" : ""}save.json`,
|
|
47907
|
+
method: "post",
|
|
47908
|
+
data: { formUuid: targetFormUuid, config: options.config }
|
|
47909
|
+
});
|
|
47910
|
+
return unwrap(response);
|
|
47911
|
+
}
|
|
47912
|
+
async function advancedSearchDataManagement(request, query) {
|
|
47913
|
+
const response = await request({
|
|
47914
|
+
url: `/${query.appType}/v1/form/advancedSearch.json`,
|
|
47915
|
+
method: "get",
|
|
47916
|
+
params: {
|
|
47917
|
+
appType: query.appType,
|
|
47918
|
+
formUuid: query.formUuid,
|
|
47919
|
+
filters: query.rawFilters ?? buildFilterPayload(query.filters),
|
|
47920
|
+
conditionType: query.conditionType,
|
|
47921
|
+
searchKeyWord: query.searchKeyWord,
|
|
47922
|
+
currentPage: query.currentPage || 1,
|
|
47923
|
+
pageSize: query.pageSize || 10,
|
|
47924
|
+
order: JSON.stringify(query.order || []),
|
|
47925
|
+
instanceStatus: query.instanceStatus
|
|
47926
|
+
}
|
|
47927
|
+
});
|
|
47928
|
+
return normalizeDataManagementList(response);
|
|
47929
|
+
}
|
|
47930
|
+
async function deleteDataManagementRows(request, params) {
|
|
47931
|
+
const formInstId = params.formInstanceIds.length === 1 ? params.formInstanceIds[0] : params.formInstanceIds;
|
|
47932
|
+
const response = await request({
|
|
47933
|
+
url: `/${params.appType}/v1/form/deleteFormData.json`,
|
|
47934
|
+
method: "post",
|
|
47935
|
+
data: {
|
|
47936
|
+
appType: params.appType,
|
|
47937
|
+
formUuid: params.formUuid,
|
|
47938
|
+
formInstId,
|
|
47939
|
+
formInstIds: params.formInstanceIds,
|
|
47940
|
+
formInstanceIds: params.formInstanceIds
|
|
47941
|
+
}
|
|
47942
|
+
});
|
|
47943
|
+
return unwrap(response);
|
|
47944
|
+
}
|
|
47945
|
+
async function batchApproveDataManagementRows(request, params) {
|
|
47946
|
+
const response = await request({
|
|
47947
|
+
url: "/workflow/approve/batch",
|
|
47948
|
+
method: "post",
|
|
47949
|
+
data: {
|
|
47950
|
+
instanceIds: params.formInstanceIds,
|
|
47951
|
+
action: params.action,
|
|
47952
|
+
comments: params.comments
|
|
47953
|
+
}
|
|
47954
|
+
});
|
|
47955
|
+
return unwrap(response);
|
|
47956
|
+
}
|
|
47957
|
+
async function exportDataManagementRows(request, params) {
|
|
47958
|
+
return request({
|
|
47959
|
+
url: `/${params.appType}/v1/form/advancedExport.xlsx`,
|
|
47960
|
+
method: "get",
|
|
47961
|
+
responseType: "blob",
|
|
47962
|
+
params: {
|
|
47963
|
+
appType: params.appType,
|
|
47964
|
+
formUuid: params.formUuid,
|
|
47965
|
+
filters: params.rawFilters ?? buildFilterPayload(params.filters),
|
|
47966
|
+
conditionType: params.conditionType,
|
|
47967
|
+
searchKeyWord: params.searchKeyWord,
|
|
47968
|
+
currentPage: params.currentPage,
|
|
47969
|
+
pageSize: params.pageSize,
|
|
47970
|
+
order: JSON.stringify(params.order || []),
|
|
47971
|
+
instanceStatus: params.instanceStatus,
|
|
47972
|
+
exportAll: params.exportAll || "n",
|
|
47973
|
+
embedImages: params.embedImages || "n",
|
|
47974
|
+
exportFields: (params.exportFields || []).join(",")
|
|
47975
|
+
}
|
|
47976
|
+
});
|
|
47977
|
+
}
|
|
47978
|
+
async function downloadDataManagementImportTemplate(request, params) {
|
|
47979
|
+
return request({
|
|
47980
|
+
url: `/${params.appType}/v1/form/advancedExportTemplate.xlsx`,
|
|
47981
|
+
method: "get",
|
|
47982
|
+
responseType: "blob",
|
|
47983
|
+
params: {
|
|
47984
|
+
formUuid: params.formUuid
|
|
47985
|
+
}
|
|
47986
|
+
});
|
|
47987
|
+
}
|
|
47988
|
+
async function importPreviewDataManagementRows(request, params) {
|
|
47989
|
+
const response = await request({
|
|
47990
|
+
url: `/${params.appType}/v1/form/importPreview.xlsx`,
|
|
47991
|
+
method: "post",
|
|
47992
|
+
data: { formUuid: params.formUuid, fileBase64: params.fileBase64 }
|
|
47993
|
+
});
|
|
47994
|
+
return unwrap(response);
|
|
47995
|
+
}
|
|
47996
|
+
async function importDataManagementRows(request, params) {
|
|
47997
|
+
const response = await request({
|
|
47998
|
+
url: `/${params.appType}/v1/form/import.xlsx`,
|
|
47999
|
+
method: "post",
|
|
48000
|
+
data: { formUuid: params.formUuid, fileBase64: params.fileBase64 }
|
|
48001
|
+
});
|
|
48002
|
+
return unwrap(response);
|
|
48003
|
+
}
|
|
48004
|
+
async function getDataManagementTransferRecords(request, params) {
|
|
48005
|
+
const response = await request({
|
|
48006
|
+
url: `/${params.appType}/v1/form/${params.type}Records.json`,
|
|
48007
|
+
method: "get",
|
|
48008
|
+
params
|
|
48009
|
+
});
|
|
48010
|
+
return normalizeDataManagementList(response);
|
|
48011
|
+
}
|
|
48012
|
+
|
|
47999
48013
|
// packages/sdk/src/components/modules/DataManagementList.tsx
|
|
48000
48014
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
48001
48015
|
var DEFAULT_MAX_VISIBLE_ROW_ACTIONS = 4;
|
|
@@ -50075,6 +50089,93 @@ var DataManagementList = ({
|
|
|
50075
50089
|
) });
|
|
50076
50090
|
};
|
|
50077
50091
|
|
|
50092
|
+
// packages/sdk/src/runtime/host/formSchema.ts
|
|
50093
|
+
init_cjs_shims();
|
|
50094
|
+
var normalizePlatformComponentName = (componentName) => {
|
|
50095
|
+
const value = String(componentName || "").trim();
|
|
50096
|
+
return value || "TextField";
|
|
50097
|
+
};
|
|
50098
|
+
var extractSlotNodes = (value) => {
|
|
50099
|
+
if (!value) return [];
|
|
50100
|
+
if (Array.isArray(value)) {
|
|
50101
|
+
return value.flatMap((item) => extractSlotNodes(item));
|
|
50102
|
+
}
|
|
50103
|
+
if (typeof value !== "object") return [];
|
|
50104
|
+
if (value.type === "JSSlot" && value.value) {
|
|
50105
|
+
return extractSlotNodes(value.value);
|
|
50106
|
+
}
|
|
50107
|
+
if (value.componentName || Array.isArray(value.children)) {
|
|
50108
|
+
return [value];
|
|
50109
|
+
}
|
|
50110
|
+
return Object.values(value).flatMap((item) => extractSlotNodes(item));
|
|
50111
|
+
};
|
|
50112
|
+
var extractFieldsFromComponentsTree = (componentsTree) => {
|
|
50113
|
+
const roots = Array.isArray(componentsTree) ? componentsTree : [componentsTree];
|
|
50114
|
+
const fields = [];
|
|
50115
|
+
const seen = /* @__PURE__ */ new Set();
|
|
50116
|
+
const walk = (components) => {
|
|
50117
|
+
if (!Array.isArray(components)) return;
|
|
50118
|
+
components.forEach((component) => {
|
|
50119
|
+
if (!component || typeof component !== "object") return;
|
|
50120
|
+
const props = component.props || {};
|
|
50121
|
+
const fieldId = String(props.fieldId || component.fieldId || component.id || "").trim();
|
|
50122
|
+
if (props.isFormComponent === true && fieldId && !seen.has(fieldId)) {
|
|
50123
|
+
seen.add(fieldId);
|
|
50124
|
+
fields.push({
|
|
50125
|
+
...props,
|
|
50126
|
+
id: props.id || component.id || fieldId,
|
|
50127
|
+
fieldId,
|
|
50128
|
+
componentName: normalizePlatformComponentName(
|
|
50129
|
+
props.componentName || component.componentName
|
|
50130
|
+
),
|
|
50131
|
+
label: props.label || component.title || props.title || fieldId,
|
|
50132
|
+
title: props.title || component.title || props.label || fieldId,
|
|
50133
|
+
required: props.required ?? component.required
|
|
50134
|
+
});
|
|
50135
|
+
}
|
|
50136
|
+
if (component.componentName === "SubFormField") return;
|
|
50137
|
+
if (Array.isArray(component.children)) {
|
|
50138
|
+
walk(component.children);
|
|
50139
|
+
}
|
|
50140
|
+
Object.values(props).forEach((propValue) => {
|
|
50141
|
+
walk(extractSlotNodes(propValue));
|
|
50142
|
+
});
|
|
50143
|
+
});
|
|
50144
|
+
};
|
|
50145
|
+
walk(roots);
|
|
50146
|
+
return fields;
|
|
50147
|
+
};
|
|
50148
|
+
var createDefaultLayout = (fields) => fields.map((field) => ({
|
|
50149
|
+
id: `layout_${field.fieldId}`,
|
|
50150
|
+
type: "field",
|
|
50151
|
+
fieldId: field.fieldId
|
|
50152
|
+
}));
|
|
50153
|
+
var normalizeRuntimeFormSchema = (payload, options) => {
|
|
50154
|
+
const normalized = normalizeDataManagementFields(payload);
|
|
50155
|
+
if (normalized.schema) return normalized.schema;
|
|
50156
|
+
const body = payload?.data ?? payload?.result ?? payload;
|
|
50157
|
+
const rawSchema = body?.schema || body?.formSchema || body?.publishedSchema || body;
|
|
50158
|
+
if (!rawSchema) return void 0;
|
|
50159
|
+
const fields = Array.isArray(rawSchema.fields) ? rawSchema.fields : extractFieldsFromComponentsTree(rawSchema.componentsTree);
|
|
50160
|
+
if (!Array.isArray(fields) || fields.length === 0) return void 0;
|
|
50161
|
+
return {
|
|
50162
|
+
...rawSchema,
|
|
50163
|
+
fields,
|
|
50164
|
+
layout: rawSchema.layout || createDefaultLayout(fields),
|
|
50165
|
+
formMeta: {
|
|
50166
|
+
appType: options.appType,
|
|
50167
|
+
formUuid: options.formUuid,
|
|
50168
|
+
title: rawSchema.formMeta?.title || body?.title || body?.name || options.formUuid,
|
|
50169
|
+
...rawSchema.formMeta || {}
|
|
50170
|
+
},
|
|
50171
|
+
template: {
|
|
50172
|
+
type: "standard",
|
|
50173
|
+
...rawSchema.template || {},
|
|
50174
|
+
formType: rawSchema.template?.formType || body?.formType
|
|
50175
|
+
}
|
|
50176
|
+
};
|
|
50177
|
+
};
|
|
50178
|
+
|
|
50078
50179
|
// packages/sdk/src/runtime/host/builtinRouteRenderer.tsx
|
|
50079
50180
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
50080
50181
|
var DEFAULT_SERVICE_PREFIX = "/service";
|
|
@@ -50116,6 +50217,7 @@ var parseRuntimeResponse = async (response) => {
|
|
|
50116
50217
|
return await response.json();
|
|
50117
50218
|
};
|
|
50118
50219
|
var createBuiltinRouteRequest = (servicePrefix = DEFAULT_SERVICE_PREFIX, fetchImpl = fetch) => async (config3) => {
|
|
50220
|
+
const boundFetch = createBoundFetch(fetchImpl);
|
|
50119
50221
|
const headers = new Headers(config3.headers);
|
|
50120
50222
|
let body;
|
|
50121
50223
|
if (config3.data !== void 0) {
|
|
@@ -50126,7 +50228,7 @@ var createBuiltinRouteRequest = (servicePrefix = DEFAULT_SERVICE_PREFIX, fetchIm
|
|
|
50126
50228
|
body = JSON.stringify(config3.data);
|
|
50127
50229
|
}
|
|
50128
50230
|
}
|
|
50129
|
-
const response = await
|
|
50231
|
+
const response = await boundFetch(appendQuery3(joinServicePath2(servicePrefix, config3.url), config3.params), {
|
|
50130
50232
|
method: normalizeMethod3(config3.method),
|
|
50131
50233
|
headers,
|
|
50132
50234
|
body,
|
|
@@ -50155,89 +50257,8 @@ var isProcessKind = (kind, formType) => {
|
|
|
50155
50257
|
const raw = String(formType || "").toLowerCase();
|
|
50156
50258
|
return kind === "process-submit" || kind === "process-detail" || raw === "process" || raw === "flow";
|
|
50157
50259
|
};
|
|
50158
|
-
var normalizePlatformComponentName = (componentName) => {
|
|
50159
|
-
const value = String(componentName || "").trim();
|
|
50160
|
-
return value || "TextField";
|
|
50161
|
-
};
|
|
50162
|
-
var extractSlotNodes = (value) => {
|
|
50163
|
-
if (!value) return [];
|
|
50164
|
-
if (Array.isArray(value)) {
|
|
50165
|
-
return value.flatMap((item) => extractSlotNodes(item));
|
|
50166
|
-
}
|
|
50167
|
-
if (typeof value !== "object") return [];
|
|
50168
|
-
if (value.type === "JSSlot" && value.value) {
|
|
50169
|
-
return extractSlotNodes(value.value);
|
|
50170
|
-
}
|
|
50171
|
-
if (value.componentName || Array.isArray(value.children)) {
|
|
50172
|
-
return [value];
|
|
50173
|
-
}
|
|
50174
|
-
return Object.values(value).flatMap((item) => extractSlotNodes(item));
|
|
50175
|
-
};
|
|
50176
|
-
var extractFieldsFromComponentsTree = (componentsTree) => {
|
|
50177
|
-
const roots = Array.isArray(componentsTree) ? componentsTree : [componentsTree];
|
|
50178
|
-
const fields = [];
|
|
50179
|
-
const seen = /* @__PURE__ */ new Set();
|
|
50180
|
-
const walk = (components) => {
|
|
50181
|
-
if (!Array.isArray(components)) return;
|
|
50182
|
-
components.forEach((component) => {
|
|
50183
|
-
if (!component || typeof component !== "object") return;
|
|
50184
|
-
const props = component.props || {};
|
|
50185
|
-
const fieldId = String(props.fieldId || component.fieldId || component.id || "").trim();
|
|
50186
|
-
if (props.isFormComponent === true && fieldId && !seen.has(fieldId)) {
|
|
50187
|
-
seen.add(fieldId);
|
|
50188
|
-
fields.push({
|
|
50189
|
-
...props,
|
|
50190
|
-
id: props.id || component.id || fieldId,
|
|
50191
|
-
fieldId,
|
|
50192
|
-
componentName: normalizePlatformComponentName(
|
|
50193
|
-
props.componentName || component.componentName
|
|
50194
|
-
),
|
|
50195
|
-
label: props.label || component.title || props.title || fieldId,
|
|
50196
|
-
title: props.title || component.title || props.label || fieldId,
|
|
50197
|
-
required: props.required ?? component.required
|
|
50198
|
-
});
|
|
50199
|
-
}
|
|
50200
|
-
if (component.componentName === "SubFormField") return;
|
|
50201
|
-
if (Array.isArray(component.children)) {
|
|
50202
|
-
walk(component.children);
|
|
50203
|
-
}
|
|
50204
|
-
Object.values(props).forEach((propValue) => {
|
|
50205
|
-
walk(extractSlotNodes(propValue));
|
|
50206
|
-
});
|
|
50207
|
-
});
|
|
50208
|
-
};
|
|
50209
|
-
walk(roots);
|
|
50210
|
-
return fields;
|
|
50211
|
-
};
|
|
50212
|
-
var createDefaultLayout = (fields) => fields.map((field) => ({
|
|
50213
|
-
id: `layout_${field.fieldId}`,
|
|
50214
|
-
type: "field",
|
|
50215
|
-
fieldId: field.fieldId
|
|
50216
|
-
}));
|
|
50217
50260
|
var normalizeSchema = (payload, appType, formUuid) => {
|
|
50218
|
-
|
|
50219
|
-
if (normalized.schema) return normalized.schema;
|
|
50220
|
-
const body = payload?.data ?? payload?.result ?? payload;
|
|
50221
|
-
const rawSchema = body?.schema || body?.formSchema || body?.publishedSchema || body;
|
|
50222
|
-
if (!rawSchema) return void 0;
|
|
50223
|
-
const fields = Array.isArray(rawSchema.fields) ? rawSchema.fields : extractFieldsFromComponentsTree(rawSchema.componentsTree);
|
|
50224
|
-
if (!Array.isArray(fields) || fields.length === 0) return void 0;
|
|
50225
|
-
return {
|
|
50226
|
-
...rawSchema,
|
|
50227
|
-
fields,
|
|
50228
|
-
layout: rawSchema.layout || createDefaultLayout(fields),
|
|
50229
|
-
formMeta: {
|
|
50230
|
-
appType,
|
|
50231
|
-
formUuid,
|
|
50232
|
-
title: rawSchema.formMeta?.title || body?.title || body?.name || formUuid,
|
|
50233
|
-
...rawSchema.formMeta || {}
|
|
50234
|
-
},
|
|
50235
|
-
template: {
|
|
50236
|
-
type: "standard",
|
|
50237
|
-
...rawSchema.template || {},
|
|
50238
|
-
formType: rawSchema.template?.formType || body?.formType
|
|
50239
|
-
}
|
|
50240
|
-
};
|
|
50261
|
+
return normalizeRuntimeFormSchema(payload, { appType, formUuid });
|
|
50241
50262
|
};
|
|
50242
50263
|
var applyRouteConfigToSchema = (schema, kind, config3) => {
|
|
50243
50264
|
const formType = config3.formType || schema.template?.formType;
|