openxiangda 1.0.57 → 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 +462 -454
- 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 +460 -453
- package/packages/sdk/dist/runtime/index.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,
|
|
@@ -4285,378 +4287,6 @@ function createFormRuntimeApi(config3) {
|
|
|
4285
4287
|
return { ...defaults2, ...overrides, request };
|
|
4286
4288
|
}
|
|
4287
4289
|
|
|
4288
|
-
// packages/sdk/src/components/core/dataManagementApi.ts
|
|
4289
|
-
init_cjs_shims();
|
|
4290
|
-
var unwrap = (response) => {
|
|
4291
|
-
if (response instanceof Blob) return response;
|
|
4292
|
-
if (response?.data?.result !== void 0) return response.data.result;
|
|
4293
|
-
if (response?.result !== void 0) return response.result;
|
|
4294
|
-
if (response?.data !== void 0) return response.data;
|
|
4295
|
-
return response;
|
|
4296
|
-
};
|
|
4297
|
-
var pickData = (value) => value?.data ?? value?.result ?? value;
|
|
4298
|
-
var normalizeComponentName = (field) => field?.componentName || field?.component_name || field?.component_type || field?.componentType || field?.type || "TextField";
|
|
4299
|
-
var normalizeField = (key, field, system = false) => ({
|
|
4300
|
-
...field,
|
|
4301
|
-
id: field?.id || field?.fieldId || key,
|
|
4302
|
-
fieldId: field?.fieldId || field?.id || key,
|
|
4303
|
-
componentName: normalizeComponentName(field),
|
|
4304
|
-
label: field?.label || field?.title || field?.name || key,
|
|
4305
|
-
width: field?.width,
|
|
4306
|
-
system
|
|
4307
|
-
});
|
|
4308
|
-
var SYSTEM_VALUE_ALIASES = {
|
|
4309
|
-
formInstanceId: ["formInstanceId", "formInstId", "form_instance_id", "processInstanceId"],
|
|
4310
|
-
instanceTitle: ["instanceTitle", "instance_title", "processInstanceTitle", "title"],
|
|
4311
|
-
createdBy: ["createdBy", "created_by", "originator"],
|
|
4312
|
-
createdByName: ["createdByName", "created_by_name", "originatorName", "creatorName"],
|
|
4313
|
-
createdByDepartmentId: ["createdByDepartmentId", "created_by_department_id", "originatorCorp"],
|
|
4314
|
-
createdByDepartmentName: [
|
|
4315
|
-
"createdByDepartmentName",
|
|
4316
|
-
"created_by_department_name",
|
|
4317
|
-
"originatorDepartmentName",
|
|
4318
|
-
"originatorCorpName"
|
|
4319
|
-
],
|
|
4320
|
-
createdAt: ["createdAt", "created_at", "createTime", "gmtCreate"],
|
|
4321
|
-
updatedAt: ["updatedAt", "updated_at", "modifiedTime", "modifyTime", "gmtModified"]
|
|
4322
|
-
};
|
|
4323
|
-
var pickAliasValue = (record2, aliases) => {
|
|
4324
|
-
for (const alias of aliases) {
|
|
4325
|
-
const value = record2?.[alias];
|
|
4326
|
-
if (value !== void 0 && value !== null && value !== "") return value;
|
|
4327
|
-
}
|
|
4328
|
-
return void 0;
|
|
4329
|
-
};
|
|
4330
|
-
var normalizeDataManagementRecord = (record2) => {
|
|
4331
|
-
if (!record2 || typeof record2 !== "object" || Array.isArray(record2)) return record2;
|
|
4332
|
-
const normalized = { ...record2 };
|
|
4333
|
-
Object.entries(SYSTEM_VALUE_ALIASES).forEach(([targetKey, aliases]) => {
|
|
4334
|
-
if (normalized[targetKey] !== void 0 && normalized[targetKey] !== null) return;
|
|
4335
|
-
const aliasValue = pickAliasValue(record2, aliases);
|
|
4336
|
-
if (aliasValue !== void 0) normalized[targetKey] = aliasValue;
|
|
4337
|
-
});
|
|
4338
|
-
return normalized;
|
|
4339
|
-
};
|
|
4340
|
-
var PROCESS_INSTANCE_STATUS_OPTIONS = [
|
|
4341
|
-
{ label: "\u5F85\u5904\u7406", value: "pending" },
|
|
4342
|
-
{ label: "\u5BA1\u6279\u4E2D", value: "running" },
|
|
4343
|
-
{ label: "\u7B49\u5F85\u4E2D", value: "waiting" },
|
|
4344
|
-
{ label: "\u6D41\u7A0B\u5F02\u5E38", value: "exception" },
|
|
4345
|
-
{ label: "\u5DF2\u5B8C\u6210", value: "completed" },
|
|
4346
|
-
{ label: "\u5DF2\u62D2\u7EDD", value: "terminated" },
|
|
4347
|
-
{ label: "\u5DF2\u64A4\u9500", value: "withdrawn" }
|
|
4348
|
-
];
|
|
4349
|
-
var APPROVAL_RESULT_OPTIONS = [
|
|
4350
|
-
{ label: "\u5BA1\u6279\u4E2D", value: "processing" },
|
|
4351
|
-
{ label: "\u540C\u610F", value: "approved" },
|
|
4352
|
-
{ label: "\u62D2\u7EDD", value: "rejected" },
|
|
4353
|
-
{ label: "\u64A4\u9500", value: "withdrawn" },
|
|
4354
|
-
{ label: "\u5F02\u5E38", value: "exception" }
|
|
4355
|
-
];
|
|
4356
|
-
var PROCESS_SYSTEM_FIELDS = [
|
|
4357
|
-
normalizeField(
|
|
4358
|
-
"currentApprovalNodeName",
|
|
4359
|
-
{
|
|
4360
|
-
label: "\u5F53\u524D\u5BA1\u6279\u8282\u70B9",
|
|
4361
|
-
componentName: "TextField",
|
|
4362
|
-
width: 140,
|
|
4363
|
-
processOnly: true,
|
|
4364
|
-
displayable: true
|
|
4365
|
-
},
|
|
4366
|
-
true
|
|
4367
|
-
),
|
|
4368
|
-
normalizeField(
|
|
4369
|
-
"processInstanceStatus",
|
|
4370
|
-
{
|
|
4371
|
-
label: "\u5B9E\u4F8B\u72B6\u6001",
|
|
4372
|
-
componentName: "SelectField",
|
|
4373
|
-
width: 110,
|
|
4374
|
-
options: PROCESS_INSTANCE_STATUS_OPTIONS,
|
|
4375
|
-
processOnly: true,
|
|
4376
|
-
displayable: true
|
|
4377
|
-
},
|
|
4378
|
-
true
|
|
4379
|
-
),
|
|
4380
|
-
normalizeField(
|
|
4381
|
-
"approvalResult",
|
|
4382
|
-
{
|
|
4383
|
-
label: "\u5BA1\u6279\u7ED3\u679C",
|
|
4384
|
-
componentName: "SelectField",
|
|
4385
|
-
width: 110,
|
|
4386
|
-
options: APPROVAL_RESULT_OPTIONS,
|
|
4387
|
-
processOnly: true,
|
|
4388
|
-
displayable: true
|
|
4389
|
-
},
|
|
4390
|
-
true
|
|
4391
|
-
)
|
|
4392
|
-
];
|
|
4393
|
-
var BASE_SYSTEM_FIELDS = [
|
|
4394
|
-
normalizeField(
|
|
4395
|
-
"instanceTitle",
|
|
4396
|
-
{ label: "\u5B9E\u4F8B\u6807\u9898", componentName: "TextField", width: 220, displayable: true },
|
|
4397
|
-
true
|
|
4398
|
-
),
|
|
4399
|
-
normalizeField(
|
|
4400
|
-
"createdByName",
|
|
4401
|
-
{ label: "\u521B\u5EFA\u4EBA", componentName: "TextField", width: 130, displayable: true },
|
|
4402
|
-
true
|
|
4403
|
-
),
|
|
4404
|
-
normalizeField(
|
|
4405
|
-
"createdByDepartmentName",
|
|
4406
|
-
{ label: "\u521B\u5EFA\u4EBA\u90E8\u95E8", componentName: "TextField", width: 150, displayable: true },
|
|
4407
|
-
true
|
|
4408
|
-
),
|
|
4409
|
-
normalizeField(
|
|
4410
|
-
"createdAt",
|
|
4411
|
-
{ label: "\u521B\u5EFA\u65F6\u95F4", componentName: "DateField", width: 170, displayable: true },
|
|
4412
|
-
true
|
|
4413
|
-
),
|
|
4414
|
-
normalizeField(
|
|
4415
|
-
"updatedAt",
|
|
4416
|
-
{ label: "\u66F4\u65B0\u65F6\u95F4", componentName: "DateField", width: 170, displayable: true },
|
|
4417
|
-
true
|
|
4418
|
-
)
|
|
4419
|
-
];
|
|
4420
|
-
var getSystemFieldsForFormType = (formType) => formType === "process" ? [...BASE_SYSTEM_FIELDS, ...PROCESS_SYSTEM_FIELDS] : BASE_SYSTEM_FIELDS;
|
|
4421
|
-
var normalizeDataManagementFields = (payload) => {
|
|
4422
|
-
const data = pickData(payload);
|
|
4423
|
-
const rawSchema = data?.schema || data?.formSchema || data?.publishedSchema || data;
|
|
4424
|
-
const schemaAppType = rawSchema?.formMeta?.appType || data?.appType;
|
|
4425
|
-
const schemaFormUuid = rawSchema?.formMeta?.formUuid || data?.formUuid;
|
|
4426
|
-
const schemaTitle = rawSchema?.formMeta?.title || data?.title || data?.name || data?.formName || schemaFormUuid;
|
|
4427
|
-
const formType = data?.formType || data?.schema?.formType || data?.schema?.template?.formType || rawSchema?.template?.formType || data?.type;
|
|
4428
|
-
const rawFields = data?.formFields || data?.schema?.formFields || data?.fields || data?.schema?.fields || data?.formSchema?.fields || [];
|
|
4429
|
-
const fields = Array.isArray(rawFields) ? rawFields.map((field) => normalizeField(field?.fieldId || field?.id, field)) : Object.entries(rawFields).map(([key, field]) => normalizeField(key, field));
|
|
4430
|
-
return {
|
|
4431
|
-
fields: fields.filter((field) => field.componentName !== "PageSection"),
|
|
4432
|
-
formType,
|
|
4433
|
-
schema: rawSchema && Array.isArray(rawSchema.fields) && schemaAppType && schemaFormUuid ? {
|
|
4434
|
-
...rawSchema,
|
|
4435
|
-
formMeta: {
|
|
4436
|
-
formUuid: schemaFormUuid,
|
|
4437
|
-
appType: schemaAppType,
|
|
4438
|
-
title: schemaTitle,
|
|
4439
|
-
...rawSchema.formMeta || {}
|
|
4440
|
-
},
|
|
4441
|
-
template: {
|
|
4442
|
-
type: "standard",
|
|
4443
|
-
...rawSchema.template || {},
|
|
4444
|
-
formType: rawSchema.template?.formType || formType
|
|
4445
|
-
}
|
|
4446
|
-
} : void 0
|
|
4447
|
-
};
|
|
4448
|
-
};
|
|
4449
|
-
var normalizeDataManagementList = (payload) => {
|
|
4450
|
-
const data = unwrap(payload);
|
|
4451
|
-
const body = data?.result || data;
|
|
4452
|
-
const records = body?.data || body?.records || body?.list || body?.items || [];
|
|
4453
|
-
const total = body?.totalCount ?? body?.total ?? body?.count ?? records.length;
|
|
4454
|
-
return {
|
|
4455
|
-
records: Array.isArray(records) ? records.map(normalizeDataManagementRecord) : [],
|
|
4456
|
-
total: Number(total) || 0
|
|
4457
|
-
};
|
|
4458
|
-
};
|
|
4459
|
-
var buildFilterPayload = (group) => {
|
|
4460
|
-
if (!group) return void 0;
|
|
4461
|
-
const normalizeOperator2 = (operator) => {
|
|
4462
|
-
const raw = String(operator || "").trim();
|
|
4463
|
-
const aliases = {
|
|
4464
|
-
contains: "CONTAINS",
|
|
4465
|
-
eq: "EQ",
|
|
4466
|
-
ne: "NEQ",
|
|
4467
|
-
neq: "NEQ",
|
|
4468
|
-
gt: "GT",
|
|
4469
|
-
gte: "GTE",
|
|
4470
|
-
lt: "LT",
|
|
4471
|
-
lte: "LTE",
|
|
4472
|
-
between: "BETWEEN",
|
|
4473
|
-
in: "IN",
|
|
4474
|
-
is_null: "IS_NULL",
|
|
4475
|
-
is_not_null: "IS_NOT_NULL",
|
|
4476
|
-
empty: "IS_NULL",
|
|
4477
|
-
not_empty: "IS_NOT_NULL",
|
|
4478
|
-
notEmpty: "IS_NOT_NULL"
|
|
4479
|
-
};
|
|
4480
|
-
return aliases[raw] || aliases[raw.toLowerCase()] || raw.toUpperCase();
|
|
4481
|
-
};
|
|
4482
|
-
const isNoValueOperator = (operator) => ["IS_NULL", "IS_NOT_NULL"].includes(normalizeOperator2(operator));
|
|
4483
|
-
const hasRuleValue = (rule) => {
|
|
4484
|
-
if (isNoValueOperator(rule.operator)) return true;
|
|
4485
|
-
if (Array.isArray(rule.value)) {
|
|
4486
|
-
return rule.value.some((item) => item !== void 0 && item !== null && item !== "");
|
|
4487
|
-
}
|
|
4488
|
-
return rule.value !== void 0 && rule.value !== null && rule.value !== "";
|
|
4489
|
-
};
|
|
4490
|
-
const trimGroup = (current) => ({
|
|
4491
|
-
...current,
|
|
4492
|
-
rules: (current.rules || []).filter((rule) => rule.key && rule.operator && hasRuleValue(rule)).map((rule) => ({
|
|
4493
|
-
...rule,
|
|
4494
|
-
operator: normalizeOperator2(rule.operator),
|
|
4495
|
-
value: isNoValueOperator(rule.operator) ? null : rule.value
|
|
4496
|
-
})),
|
|
4497
|
-
conditions: (current.conditions || []).map(trimGroup).filter((item) => item.rules.length > 0 || item.conditions.length > 0)
|
|
4498
|
-
});
|
|
4499
|
-
const payload = trimGroup(group);
|
|
4500
|
-
if (payload.rules.length === 0 && payload.conditions.length === 0) return void 0;
|
|
4501
|
-
return JSON.stringify(payload);
|
|
4502
|
-
};
|
|
4503
|
-
var normalizeColumnConfig = (cfg, fields) => {
|
|
4504
|
-
const allowed = new Set(fields.map((field) => field.fieldId));
|
|
4505
|
-
const configured = Array.isArray(cfg?.showFields) ? cfg.showFields.filter((fieldId) => allowed.has(fieldId)) : [];
|
|
4506
|
-
const defaultBusinessFields = fields.filter((field) => !field.system).slice(0, 8).map((field) => field.fieldId);
|
|
4507
|
-
const defaultSystemFields = fields.filter((field) => field.system && field.displayable).map((field) => field.fieldId);
|
|
4508
|
-
const defaultShow = [...defaultBusinessFields, ...defaultSystemFields];
|
|
4509
|
-
return {
|
|
4510
|
-
showFields: configured.length > 0 ? configured : defaultShow,
|
|
4511
|
-
widths: cfg?.widths || {},
|
|
4512
|
-
lockFieldIds: cfg?.lockFieldIds || [],
|
|
4513
|
-
sort: Array.isArray(cfg?.sort) ? cfg.sort : [],
|
|
4514
|
-
density: cfg?.density || "middle",
|
|
4515
|
-
detailOpenMode: cfg?.detailOpenMode === "newPage" ? "newPage" : "drawer",
|
|
4516
|
-
pageSize: cfg?.pageSize || 10
|
|
4517
|
-
};
|
|
4518
|
-
};
|
|
4519
|
-
async function getDataManagementSchema(request, params) {
|
|
4520
|
-
const response = await request({
|
|
4521
|
-
url: "/form/getFormSchemaAndPackages",
|
|
4522
|
-
method: "get",
|
|
4523
|
-
params
|
|
4524
|
-
});
|
|
4525
|
-
const result = normalizeDataManagementFields(response);
|
|
4526
|
-
if (result.schema) {
|
|
4527
|
-
result.schema = {
|
|
4528
|
-
...result.schema,
|
|
4529
|
-
formMeta: {
|
|
4530
|
-
...result.schema.formMeta,
|
|
4531
|
-
appType: result.schema.formMeta?.appType || params.appType,
|
|
4532
|
-
formUuid: result.schema.formMeta?.formUuid || params.formUuid,
|
|
4533
|
-
title: result.schema.formMeta?.title || params.formUuid
|
|
4534
|
-
}
|
|
4535
|
-
};
|
|
4536
|
-
}
|
|
4537
|
-
return result;
|
|
4538
|
-
}
|
|
4539
|
-
async function getDataManagementConfig(request, options) {
|
|
4540
|
-
const targetFormUuid = options.menuFormUuid || options.formUuid;
|
|
4541
|
-
const personal = options.scope === "personal";
|
|
4542
|
-
const response = await request({
|
|
4543
|
-
url: `/${options.appType}/v1/form/dataManagement/config/${personal ? "personal/" : ""}get.json`,
|
|
4544
|
-
method: "get",
|
|
4545
|
-
params: { formUuid: targetFormUuid }
|
|
4546
|
-
});
|
|
4547
|
-
return unwrap(response);
|
|
4548
|
-
}
|
|
4549
|
-
async function saveDataManagementConfig(request, options) {
|
|
4550
|
-
const targetFormUuid = options.menuFormUuid || options.formUuid;
|
|
4551
|
-
const personal = options.scope === "personal";
|
|
4552
|
-
const response = await request({
|
|
4553
|
-
url: `/${options.appType}/v1/form/dataManagement/config/${personal ? "personal/" : ""}save.json`,
|
|
4554
|
-
method: "post",
|
|
4555
|
-
data: { formUuid: targetFormUuid, config: options.config }
|
|
4556
|
-
});
|
|
4557
|
-
return unwrap(response);
|
|
4558
|
-
}
|
|
4559
|
-
async function advancedSearchDataManagement(request, query) {
|
|
4560
|
-
const response = await request({
|
|
4561
|
-
url: `/${query.appType}/v1/form/advancedSearch.json`,
|
|
4562
|
-
method: "get",
|
|
4563
|
-
params: {
|
|
4564
|
-
appType: query.appType,
|
|
4565
|
-
formUuid: query.formUuid,
|
|
4566
|
-
filters: query.rawFilters ?? buildFilterPayload(query.filters),
|
|
4567
|
-
conditionType: query.conditionType,
|
|
4568
|
-
searchKeyWord: query.searchKeyWord,
|
|
4569
|
-
currentPage: query.currentPage || 1,
|
|
4570
|
-
pageSize: query.pageSize || 10,
|
|
4571
|
-
order: JSON.stringify(query.order || []),
|
|
4572
|
-
instanceStatus: query.instanceStatus
|
|
4573
|
-
}
|
|
4574
|
-
});
|
|
4575
|
-
return normalizeDataManagementList(response);
|
|
4576
|
-
}
|
|
4577
|
-
async function deleteDataManagementRows(request, params) {
|
|
4578
|
-
const formInstId = params.formInstanceIds.length === 1 ? params.formInstanceIds[0] : params.formInstanceIds;
|
|
4579
|
-
const response = await request({
|
|
4580
|
-
url: `/${params.appType}/v1/form/deleteFormData.json`,
|
|
4581
|
-
method: "post",
|
|
4582
|
-
data: {
|
|
4583
|
-
appType: params.appType,
|
|
4584
|
-
formUuid: params.formUuid,
|
|
4585
|
-
formInstId,
|
|
4586
|
-
formInstIds: params.formInstanceIds,
|
|
4587
|
-
formInstanceIds: params.formInstanceIds
|
|
4588
|
-
}
|
|
4589
|
-
});
|
|
4590
|
-
return unwrap(response);
|
|
4591
|
-
}
|
|
4592
|
-
async function batchApproveDataManagementRows(request, params) {
|
|
4593
|
-
const response = await request({
|
|
4594
|
-
url: "/workflow/approve/batch",
|
|
4595
|
-
method: "post",
|
|
4596
|
-
data: {
|
|
4597
|
-
instanceIds: params.formInstanceIds,
|
|
4598
|
-
action: params.action,
|
|
4599
|
-
comments: params.comments
|
|
4600
|
-
}
|
|
4601
|
-
});
|
|
4602
|
-
return unwrap(response);
|
|
4603
|
-
}
|
|
4604
|
-
async function exportDataManagementRows(request, params) {
|
|
4605
|
-
return request({
|
|
4606
|
-
url: `/${params.appType}/v1/form/advancedExport.xlsx`,
|
|
4607
|
-
method: "get",
|
|
4608
|
-
responseType: "blob",
|
|
4609
|
-
params: {
|
|
4610
|
-
appType: params.appType,
|
|
4611
|
-
formUuid: params.formUuid,
|
|
4612
|
-
filters: params.rawFilters ?? buildFilterPayload(params.filters),
|
|
4613
|
-
conditionType: params.conditionType,
|
|
4614
|
-
searchKeyWord: params.searchKeyWord,
|
|
4615
|
-
currentPage: params.currentPage,
|
|
4616
|
-
pageSize: params.pageSize,
|
|
4617
|
-
order: JSON.stringify(params.order || []),
|
|
4618
|
-
instanceStatus: params.instanceStatus,
|
|
4619
|
-
exportAll: params.exportAll || "n",
|
|
4620
|
-
embedImages: params.embedImages || "n",
|
|
4621
|
-
exportFields: (params.exportFields || []).join(",")
|
|
4622
|
-
}
|
|
4623
|
-
});
|
|
4624
|
-
}
|
|
4625
|
-
async function downloadDataManagementImportTemplate(request, params) {
|
|
4626
|
-
return request({
|
|
4627
|
-
url: `/${params.appType}/v1/form/advancedExportTemplate.xlsx`,
|
|
4628
|
-
method: "get",
|
|
4629
|
-
responseType: "blob",
|
|
4630
|
-
params: {
|
|
4631
|
-
formUuid: params.formUuid
|
|
4632
|
-
}
|
|
4633
|
-
});
|
|
4634
|
-
}
|
|
4635
|
-
async function importPreviewDataManagementRows(request, params) {
|
|
4636
|
-
const response = await request({
|
|
4637
|
-
url: `/${params.appType}/v1/form/importPreview.xlsx`,
|
|
4638
|
-
method: "post",
|
|
4639
|
-
data: { formUuid: params.formUuid, fileBase64: params.fileBase64 }
|
|
4640
|
-
});
|
|
4641
|
-
return unwrap(response);
|
|
4642
|
-
}
|
|
4643
|
-
async function importDataManagementRows(request, params) {
|
|
4644
|
-
const response = await request({
|
|
4645
|
-
url: `/${params.appType}/v1/form/import.xlsx`,
|
|
4646
|
-
method: "post",
|
|
4647
|
-
data: { formUuid: params.formUuid, fileBase64: params.fileBase64 }
|
|
4648
|
-
});
|
|
4649
|
-
return unwrap(response);
|
|
4650
|
-
}
|
|
4651
|
-
async function getDataManagementTransferRecords(request, params) {
|
|
4652
|
-
const response = await request({
|
|
4653
|
-
url: `/${params.appType}/v1/form/${params.type}Records.json`,
|
|
4654
|
-
method: "get",
|
|
4655
|
-
params
|
|
4656
|
-
});
|
|
4657
|
-
return normalizeDataManagementList(response);
|
|
4658
|
-
}
|
|
4659
|
-
|
|
4660
4290
|
// packages/sdk/src/components/modules/DataManagementList.tsx
|
|
4661
4291
|
init_cjs_shims();
|
|
4662
4292
|
var import_react281 = require("react");
|
|
@@ -48008,6 +47638,378 @@ var StandardFormPage = ({
|
|
|
48008
47638
|
);
|
|
48009
47639
|
};
|
|
48010
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
|
+
|
|
48011
48013
|
// packages/sdk/src/components/modules/DataManagementList.tsx
|
|
48012
48014
|
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
48013
48015
|
var DEFAULT_MAX_VISIBLE_ROW_ACTIONS = 4;
|
|
@@ -50087,6 +50089,93 @@ var DataManagementList = ({
|
|
|
50087
50089
|
) });
|
|
50088
50090
|
};
|
|
50089
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
|
+
|
|
50090
50179
|
// packages/sdk/src/runtime/host/builtinRouteRenderer.tsx
|
|
50091
50180
|
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
50092
50181
|
var DEFAULT_SERVICE_PREFIX = "/service";
|
|
@@ -50168,89 +50257,8 @@ var isProcessKind = (kind, formType) => {
|
|
|
50168
50257
|
const raw = String(formType || "").toLowerCase();
|
|
50169
50258
|
return kind === "process-submit" || kind === "process-detail" || raw === "process" || raw === "flow";
|
|
50170
50259
|
};
|
|
50171
|
-
var normalizePlatformComponentName = (componentName) => {
|
|
50172
|
-
const value = String(componentName || "").trim();
|
|
50173
|
-
return value || "TextField";
|
|
50174
|
-
};
|
|
50175
|
-
var extractSlotNodes = (value) => {
|
|
50176
|
-
if (!value) return [];
|
|
50177
|
-
if (Array.isArray(value)) {
|
|
50178
|
-
return value.flatMap((item) => extractSlotNodes(item));
|
|
50179
|
-
}
|
|
50180
|
-
if (typeof value !== "object") return [];
|
|
50181
|
-
if (value.type === "JSSlot" && value.value) {
|
|
50182
|
-
return extractSlotNodes(value.value);
|
|
50183
|
-
}
|
|
50184
|
-
if (value.componentName || Array.isArray(value.children)) {
|
|
50185
|
-
return [value];
|
|
50186
|
-
}
|
|
50187
|
-
return Object.values(value).flatMap((item) => extractSlotNodes(item));
|
|
50188
|
-
};
|
|
50189
|
-
var extractFieldsFromComponentsTree = (componentsTree) => {
|
|
50190
|
-
const roots = Array.isArray(componentsTree) ? componentsTree : [componentsTree];
|
|
50191
|
-
const fields = [];
|
|
50192
|
-
const seen = /* @__PURE__ */ new Set();
|
|
50193
|
-
const walk = (components) => {
|
|
50194
|
-
if (!Array.isArray(components)) return;
|
|
50195
|
-
components.forEach((component) => {
|
|
50196
|
-
if (!component || typeof component !== "object") return;
|
|
50197
|
-
const props = component.props || {};
|
|
50198
|
-
const fieldId = String(props.fieldId || component.fieldId || component.id || "").trim();
|
|
50199
|
-
if (props.isFormComponent === true && fieldId && !seen.has(fieldId)) {
|
|
50200
|
-
seen.add(fieldId);
|
|
50201
|
-
fields.push({
|
|
50202
|
-
...props,
|
|
50203
|
-
id: props.id || component.id || fieldId,
|
|
50204
|
-
fieldId,
|
|
50205
|
-
componentName: normalizePlatformComponentName(
|
|
50206
|
-
props.componentName || component.componentName
|
|
50207
|
-
),
|
|
50208
|
-
label: props.label || component.title || props.title || fieldId,
|
|
50209
|
-
title: props.title || component.title || props.label || fieldId,
|
|
50210
|
-
required: props.required ?? component.required
|
|
50211
|
-
});
|
|
50212
|
-
}
|
|
50213
|
-
if (component.componentName === "SubFormField") return;
|
|
50214
|
-
if (Array.isArray(component.children)) {
|
|
50215
|
-
walk(component.children);
|
|
50216
|
-
}
|
|
50217
|
-
Object.values(props).forEach((propValue) => {
|
|
50218
|
-
walk(extractSlotNodes(propValue));
|
|
50219
|
-
});
|
|
50220
|
-
});
|
|
50221
|
-
};
|
|
50222
|
-
walk(roots);
|
|
50223
|
-
return fields;
|
|
50224
|
-
};
|
|
50225
|
-
var createDefaultLayout = (fields) => fields.map((field) => ({
|
|
50226
|
-
id: `layout_${field.fieldId}`,
|
|
50227
|
-
type: "field",
|
|
50228
|
-
fieldId: field.fieldId
|
|
50229
|
-
}));
|
|
50230
50260
|
var normalizeSchema = (payload, appType, formUuid) => {
|
|
50231
|
-
|
|
50232
|
-
if (normalized.schema) return normalized.schema;
|
|
50233
|
-
const body = payload?.data ?? payload?.result ?? payload;
|
|
50234
|
-
const rawSchema = body?.schema || body?.formSchema || body?.publishedSchema || body;
|
|
50235
|
-
if (!rawSchema) return void 0;
|
|
50236
|
-
const fields = Array.isArray(rawSchema.fields) ? rawSchema.fields : extractFieldsFromComponentsTree(rawSchema.componentsTree);
|
|
50237
|
-
if (!Array.isArray(fields) || fields.length === 0) return void 0;
|
|
50238
|
-
return {
|
|
50239
|
-
...rawSchema,
|
|
50240
|
-
fields,
|
|
50241
|
-
layout: rawSchema.layout || createDefaultLayout(fields),
|
|
50242
|
-
formMeta: {
|
|
50243
|
-
appType,
|
|
50244
|
-
formUuid,
|
|
50245
|
-
title: rawSchema.formMeta?.title || body?.title || body?.name || formUuid,
|
|
50246
|
-
...rawSchema.formMeta || {}
|
|
50247
|
-
},
|
|
50248
|
-
template: {
|
|
50249
|
-
type: "standard",
|
|
50250
|
-
...rawSchema.template || {},
|
|
50251
|
-
formType: rawSchema.template?.formType || body?.formType
|
|
50252
|
-
}
|
|
50253
|
-
};
|
|
50261
|
+
return normalizeRuntimeFormSchema(payload, { appType, formUuid });
|
|
50254
50262
|
};
|
|
50255
50263
|
var applyRouteConfigToSchema = (schema, kind, config3) => {
|
|
50256
50264
|
const formType = config3.formType || schema.template?.formType;
|