openxiangda 1.0.57 → 1.0.59

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.
@@ -4181,377 +4181,6 @@ function createFormRuntimeApi(config3) {
4181
4181
  return { ...defaults2, ...overrides, request };
4182
4182
  }
4183
4183
 
4184
- // packages/sdk/src/components/core/dataManagementApi.ts
4185
- var unwrap = (response) => {
4186
- if (response instanceof Blob) return response;
4187
- if (response?.data?.result !== void 0) return response.data.result;
4188
- if (response?.result !== void 0) return response.result;
4189
- if (response?.data !== void 0) return response.data;
4190
- return response;
4191
- };
4192
- var pickData = (value) => value?.data ?? value?.result ?? value;
4193
- var normalizeComponentName = (field) => field?.componentName || field?.component_name || field?.component_type || field?.componentType || field?.type || "TextField";
4194
- var normalizeField = (key, field, system = false) => ({
4195
- ...field,
4196
- id: field?.id || field?.fieldId || key,
4197
- fieldId: field?.fieldId || field?.id || key,
4198
- componentName: normalizeComponentName(field),
4199
- label: field?.label || field?.title || field?.name || key,
4200
- width: field?.width,
4201
- system
4202
- });
4203
- var SYSTEM_VALUE_ALIASES = {
4204
- formInstanceId: ["formInstanceId", "formInstId", "form_instance_id", "processInstanceId"],
4205
- instanceTitle: ["instanceTitle", "instance_title", "processInstanceTitle", "title"],
4206
- createdBy: ["createdBy", "created_by", "originator"],
4207
- createdByName: ["createdByName", "created_by_name", "originatorName", "creatorName"],
4208
- createdByDepartmentId: ["createdByDepartmentId", "created_by_department_id", "originatorCorp"],
4209
- createdByDepartmentName: [
4210
- "createdByDepartmentName",
4211
- "created_by_department_name",
4212
- "originatorDepartmentName",
4213
- "originatorCorpName"
4214
- ],
4215
- createdAt: ["createdAt", "created_at", "createTime", "gmtCreate"],
4216
- updatedAt: ["updatedAt", "updated_at", "modifiedTime", "modifyTime", "gmtModified"]
4217
- };
4218
- var pickAliasValue = (record2, aliases) => {
4219
- for (const alias of aliases) {
4220
- const value = record2?.[alias];
4221
- if (value !== void 0 && value !== null && value !== "") return value;
4222
- }
4223
- return void 0;
4224
- };
4225
- var normalizeDataManagementRecord = (record2) => {
4226
- if (!record2 || typeof record2 !== "object" || Array.isArray(record2)) return record2;
4227
- const normalized = { ...record2 };
4228
- Object.entries(SYSTEM_VALUE_ALIASES).forEach(([targetKey, aliases]) => {
4229
- if (normalized[targetKey] !== void 0 && normalized[targetKey] !== null) return;
4230
- const aliasValue = pickAliasValue(record2, aliases);
4231
- if (aliasValue !== void 0) normalized[targetKey] = aliasValue;
4232
- });
4233
- return normalized;
4234
- };
4235
- var PROCESS_INSTANCE_STATUS_OPTIONS = [
4236
- { label: "\u5F85\u5904\u7406", value: "pending" },
4237
- { label: "\u5BA1\u6279\u4E2D", value: "running" },
4238
- { label: "\u7B49\u5F85\u4E2D", value: "waiting" },
4239
- { label: "\u6D41\u7A0B\u5F02\u5E38", value: "exception" },
4240
- { label: "\u5DF2\u5B8C\u6210", value: "completed" },
4241
- { label: "\u5DF2\u62D2\u7EDD", value: "terminated" },
4242
- { label: "\u5DF2\u64A4\u9500", value: "withdrawn" }
4243
- ];
4244
- var APPROVAL_RESULT_OPTIONS = [
4245
- { label: "\u5BA1\u6279\u4E2D", value: "processing" },
4246
- { label: "\u540C\u610F", value: "approved" },
4247
- { label: "\u62D2\u7EDD", value: "rejected" },
4248
- { label: "\u64A4\u9500", value: "withdrawn" },
4249
- { label: "\u5F02\u5E38", value: "exception" }
4250
- ];
4251
- var PROCESS_SYSTEM_FIELDS = [
4252
- normalizeField(
4253
- "currentApprovalNodeName",
4254
- {
4255
- label: "\u5F53\u524D\u5BA1\u6279\u8282\u70B9",
4256
- componentName: "TextField",
4257
- width: 140,
4258
- processOnly: true,
4259
- displayable: true
4260
- },
4261
- true
4262
- ),
4263
- normalizeField(
4264
- "processInstanceStatus",
4265
- {
4266
- label: "\u5B9E\u4F8B\u72B6\u6001",
4267
- componentName: "SelectField",
4268
- width: 110,
4269
- options: PROCESS_INSTANCE_STATUS_OPTIONS,
4270
- processOnly: true,
4271
- displayable: true
4272
- },
4273
- true
4274
- ),
4275
- normalizeField(
4276
- "approvalResult",
4277
- {
4278
- label: "\u5BA1\u6279\u7ED3\u679C",
4279
- componentName: "SelectField",
4280
- width: 110,
4281
- options: APPROVAL_RESULT_OPTIONS,
4282
- processOnly: true,
4283
- displayable: true
4284
- },
4285
- true
4286
- )
4287
- ];
4288
- var BASE_SYSTEM_FIELDS = [
4289
- normalizeField(
4290
- "instanceTitle",
4291
- { label: "\u5B9E\u4F8B\u6807\u9898", componentName: "TextField", width: 220, displayable: true },
4292
- true
4293
- ),
4294
- normalizeField(
4295
- "createdByName",
4296
- { label: "\u521B\u5EFA\u4EBA", componentName: "TextField", width: 130, displayable: true },
4297
- true
4298
- ),
4299
- normalizeField(
4300
- "createdByDepartmentName",
4301
- { label: "\u521B\u5EFA\u4EBA\u90E8\u95E8", componentName: "TextField", width: 150, displayable: true },
4302
- true
4303
- ),
4304
- normalizeField(
4305
- "createdAt",
4306
- { label: "\u521B\u5EFA\u65F6\u95F4", componentName: "DateField", width: 170, displayable: true },
4307
- true
4308
- ),
4309
- normalizeField(
4310
- "updatedAt",
4311
- { label: "\u66F4\u65B0\u65F6\u95F4", componentName: "DateField", width: 170, displayable: true },
4312
- true
4313
- )
4314
- ];
4315
- var getSystemFieldsForFormType = (formType) => formType === "process" ? [...BASE_SYSTEM_FIELDS, ...PROCESS_SYSTEM_FIELDS] : BASE_SYSTEM_FIELDS;
4316
- var normalizeDataManagementFields = (payload) => {
4317
- const data = pickData(payload);
4318
- const rawSchema = data?.schema || data?.formSchema || data?.publishedSchema || data;
4319
- const schemaAppType = rawSchema?.formMeta?.appType || data?.appType;
4320
- const schemaFormUuid = rawSchema?.formMeta?.formUuid || data?.formUuid;
4321
- const schemaTitle = rawSchema?.formMeta?.title || data?.title || data?.name || data?.formName || schemaFormUuid;
4322
- const formType = data?.formType || data?.schema?.formType || data?.schema?.template?.formType || rawSchema?.template?.formType || data?.type;
4323
- const rawFields = data?.formFields || data?.schema?.formFields || data?.fields || data?.schema?.fields || data?.formSchema?.fields || [];
4324
- const fields = Array.isArray(rawFields) ? rawFields.map((field) => normalizeField(field?.fieldId || field?.id, field)) : Object.entries(rawFields).map(([key, field]) => normalizeField(key, field));
4325
- return {
4326
- fields: fields.filter((field) => field.componentName !== "PageSection"),
4327
- formType,
4328
- schema: rawSchema && Array.isArray(rawSchema.fields) && schemaAppType && schemaFormUuid ? {
4329
- ...rawSchema,
4330
- formMeta: {
4331
- formUuid: schemaFormUuid,
4332
- appType: schemaAppType,
4333
- title: schemaTitle,
4334
- ...rawSchema.formMeta || {}
4335
- },
4336
- template: {
4337
- type: "standard",
4338
- ...rawSchema.template || {},
4339
- formType: rawSchema.template?.formType || formType
4340
- }
4341
- } : void 0
4342
- };
4343
- };
4344
- var normalizeDataManagementList = (payload) => {
4345
- const data = unwrap(payload);
4346
- const body = data?.result || data;
4347
- const records = body?.data || body?.records || body?.list || body?.items || [];
4348
- const total = body?.totalCount ?? body?.total ?? body?.count ?? records.length;
4349
- return {
4350
- records: Array.isArray(records) ? records.map(normalizeDataManagementRecord) : [],
4351
- total: Number(total) || 0
4352
- };
4353
- };
4354
- var buildFilterPayload = (group) => {
4355
- if (!group) return void 0;
4356
- const normalizeOperator2 = (operator) => {
4357
- const raw = String(operator || "").trim();
4358
- const aliases = {
4359
- contains: "CONTAINS",
4360
- eq: "EQ",
4361
- ne: "NEQ",
4362
- neq: "NEQ",
4363
- gt: "GT",
4364
- gte: "GTE",
4365
- lt: "LT",
4366
- lte: "LTE",
4367
- between: "BETWEEN",
4368
- in: "IN",
4369
- is_null: "IS_NULL",
4370
- is_not_null: "IS_NOT_NULL",
4371
- empty: "IS_NULL",
4372
- not_empty: "IS_NOT_NULL",
4373
- notEmpty: "IS_NOT_NULL"
4374
- };
4375
- return aliases[raw] || aliases[raw.toLowerCase()] || raw.toUpperCase();
4376
- };
4377
- const isNoValueOperator = (operator) => ["IS_NULL", "IS_NOT_NULL"].includes(normalizeOperator2(operator));
4378
- const hasRuleValue = (rule) => {
4379
- if (isNoValueOperator(rule.operator)) return true;
4380
- if (Array.isArray(rule.value)) {
4381
- return rule.value.some((item) => item !== void 0 && item !== null && item !== "");
4382
- }
4383
- return rule.value !== void 0 && rule.value !== null && rule.value !== "";
4384
- };
4385
- const trimGroup = (current) => ({
4386
- ...current,
4387
- rules: (current.rules || []).filter((rule) => rule.key && rule.operator && hasRuleValue(rule)).map((rule) => ({
4388
- ...rule,
4389
- operator: normalizeOperator2(rule.operator),
4390
- value: isNoValueOperator(rule.operator) ? null : rule.value
4391
- })),
4392
- conditions: (current.conditions || []).map(trimGroup).filter((item) => item.rules.length > 0 || item.conditions.length > 0)
4393
- });
4394
- const payload = trimGroup(group);
4395
- if (payload.rules.length === 0 && payload.conditions.length === 0) return void 0;
4396
- return JSON.stringify(payload);
4397
- };
4398
- var normalizeColumnConfig = (cfg, fields) => {
4399
- const allowed = new Set(fields.map((field) => field.fieldId));
4400
- const configured = Array.isArray(cfg?.showFields) ? cfg.showFields.filter((fieldId) => allowed.has(fieldId)) : [];
4401
- const defaultBusinessFields = fields.filter((field) => !field.system).slice(0, 8).map((field) => field.fieldId);
4402
- const defaultSystemFields = fields.filter((field) => field.system && field.displayable).map((field) => field.fieldId);
4403
- const defaultShow = [...defaultBusinessFields, ...defaultSystemFields];
4404
- return {
4405
- showFields: configured.length > 0 ? configured : defaultShow,
4406
- widths: cfg?.widths || {},
4407
- lockFieldIds: cfg?.lockFieldIds || [],
4408
- sort: Array.isArray(cfg?.sort) ? cfg.sort : [],
4409
- density: cfg?.density || "middle",
4410
- detailOpenMode: cfg?.detailOpenMode === "newPage" ? "newPage" : "drawer",
4411
- pageSize: cfg?.pageSize || 10
4412
- };
4413
- };
4414
- async function getDataManagementSchema(request, params) {
4415
- const response = await request({
4416
- url: "/form/getFormSchemaAndPackages",
4417
- method: "get",
4418
- params
4419
- });
4420
- const result = normalizeDataManagementFields(response);
4421
- if (result.schema) {
4422
- result.schema = {
4423
- ...result.schema,
4424
- formMeta: {
4425
- ...result.schema.formMeta,
4426
- appType: result.schema.formMeta?.appType || params.appType,
4427
- formUuid: result.schema.formMeta?.formUuid || params.formUuid,
4428
- title: result.schema.formMeta?.title || params.formUuid
4429
- }
4430
- };
4431
- }
4432
- return result;
4433
- }
4434
- async function getDataManagementConfig(request, options) {
4435
- const targetFormUuid = options.menuFormUuid || options.formUuid;
4436
- const personal = options.scope === "personal";
4437
- const response = await request({
4438
- url: `/${options.appType}/v1/form/dataManagement/config/${personal ? "personal/" : ""}get.json`,
4439
- method: "get",
4440
- params: { formUuid: targetFormUuid }
4441
- });
4442
- return unwrap(response);
4443
- }
4444
- async function saveDataManagementConfig(request, options) {
4445
- const targetFormUuid = options.menuFormUuid || options.formUuid;
4446
- const personal = options.scope === "personal";
4447
- const response = await request({
4448
- url: `/${options.appType}/v1/form/dataManagement/config/${personal ? "personal/" : ""}save.json`,
4449
- method: "post",
4450
- data: { formUuid: targetFormUuid, config: options.config }
4451
- });
4452
- return unwrap(response);
4453
- }
4454
- async function advancedSearchDataManagement(request, query) {
4455
- const response = await request({
4456
- url: `/${query.appType}/v1/form/advancedSearch.json`,
4457
- method: "get",
4458
- params: {
4459
- appType: query.appType,
4460
- formUuid: query.formUuid,
4461
- filters: query.rawFilters ?? buildFilterPayload(query.filters),
4462
- conditionType: query.conditionType,
4463
- searchKeyWord: query.searchKeyWord,
4464
- currentPage: query.currentPage || 1,
4465
- pageSize: query.pageSize || 10,
4466
- order: JSON.stringify(query.order || []),
4467
- instanceStatus: query.instanceStatus
4468
- }
4469
- });
4470
- return normalizeDataManagementList(response);
4471
- }
4472
- async function deleteDataManagementRows(request, params) {
4473
- const formInstId = params.formInstanceIds.length === 1 ? params.formInstanceIds[0] : params.formInstanceIds;
4474
- const response = await request({
4475
- url: `/${params.appType}/v1/form/deleteFormData.json`,
4476
- method: "post",
4477
- data: {
4478
- appType: params.appType,
4479
- formUuid: params.formUuid,
4480
- formInstId,
4481
- formInstIds: params.formInstanceIds,
4482
- formInstanceIds: params.formInstanceIds
4483
- }
4484
- });
4485
- return unwrap(response);
4486
- }
4487
- async function batchApproveDataManagementRows(request, params) {
4488
- const response = await request({
4489
- url: "/workflow/approve/batch",
4490
- method: "post",
4491
- data: {
4492
- instanceIds: params.formInstanceIds,
4493
- action: params.action,
4494
- comments: params.comments
4495
- }
4496
- });
4497
- return unwrap(response);
4498
- }
4499
- async function exportDataManagementRows(request, params) {
4500
- return request({
4501
- url: `/${params.appType}/v1/form/advancedExport.xlsx`,
4502
- method: "get",
4503
- responseType: "blob",
4504
- params: {
4505
- appType: params.appType,
4506
- formUuid: params.formUuid,
4507
- filters: params.rawFilters ?? buildFilterPayload(params.filters),
4508
- conditionType: params.conditionType,
4509
- searchKeyWord: params.searchKeyWord,
4510
- currentPage: params.currentPage,
4511
- pageSize: params.pageSize,
4512
- order: JSON.stringify(params.order || []),
4513
- instanceStatus: params.instanceStatus,
4514
- exportAll: params.exportAll || "n",
4515
- embedImages: params.embedImages || "n",
4516
- exportFields: (params.exportFields || []).join(",")
4517
- }
4518
- });
4519
- }
4520
- async function downloadDataManagementImportTemplate(request, params) {
4521
- return request({
4522
- url: `/${params.appType}/v1/form/advancedExportTemplate.xlsx`,
4523
- method: "get",
4524
- responseType: "blob",
4525
- params: {
4526
- formUuid: params.formUuid
4527
- }
4528
- });
4529
- }
4530
- async function importPreviewDataManagementRows(request, params) {
4531
- const response = await request({
4532
- url: `/${params.appType}/v1/form/importPreview.xlsx`,
4533
- method: "post",
4534
- data: { formUuid: params.formUuid, fileBase64: params.fileBase64 }
4535
- });
4536
- return unwrap(response);
4537
- }
4538
- async function importDataManagementRows(request, params) {
4539
- const response = await request({
4540
- url: `/${params.appType}/v1/form/import.xlsx`,
4541
- method: "post",
4542
- data: { formUuid: params.formUuid, fileBase64: params.fileBase64 }
4543
- });
4544
- return unwrap(response);
4545
- }
4546
- async function getDataManagementTransferRecords(request, params) {
4547
- const response = await request({
4548
- url: `/${params.appType}/v1/form/${params.type}Records.json`,
4549
- method: "get",
4550
- params
4551
- });
4552
- return normalizeDataManagementList(response);
4553
- }
4554
-
4555
4184
  // packages/sdk/src/components/modules/DataManagementList.tsx
4556
4185
  import { useCallback as useCallback36, useEffect as useEffect98, useMemo as useMemo64, useRef as useRef96, useState as useState90 } from "react";
4557
4186
  import {
@@ -47117,6 +46746,377 @@ var StandardFormPage = ({
47117
46746
  );
47118
46747
  };
47119
46748
 
46749
+ // packages/sdk/src/components/core/dataManagementApi.ts
46750
+ var unwrap = (response) => {
46751
+ if (response instanceof Blob) return response;
46752
+ if (response?.data?.result !== void 0) return response.data.result;
46753
+ if (response?.result !== void 0) return response.result;
46754
+ if (response?.data !== void 0) return response.data;
46755
+ return response;
46756
+ };
46757
+ var pickData = (value) => value?.data ?? value?.result ?? value;
46758
+ var normalizeComponentName = (field) => field?.componentName || field?.component_name || field?.component_type || field?.componentType || field?.type || "TextField";
46759
+ var normalizeField = (key, field, system = false) => ({
46760
+ ...field,
46761
+ id: field?.id || field?.fieldId || key,
46762
+ fieldId: field?.fieldId || field?.id || key,
46763
+ componentName: normalizeComponentName(field),
46764
+ label: field?.label || field?.title || field?.name || key,
46765
+ width: field?.width,
46766
+ system
46767
+ });
46768
+ var SYSTEM_VALUE_ALIASES = {
46769
+ formInstanceId: ["formInstanceId", "formInstId", "form_instance_id", "processInstanceId"],
46770
+ instanceTitle: ["instanceTitle", "instance_title", "processInstanceTitle", "title"],
46771
+ createdBy: ["createdBy", "created_by", "originator"],
46772
+ createdByName: ["createdByName", "created_by_name", "originatorName", "creatorName"],
46773
+ createdByDepartmentId: ["createdByDepartmentId", "created_by_department_id", "originatorCorp"],
46774
+ createdByDepartmentName: [
46775
+ "createdByDepartmentName",
46776
+ "created_by_department_name",
46777
+ "originatorDepartmentName",
46778
+ "originatorCorpName"
46779
+ ],
46780
+ createdAt: ["createdAt", "created_at", "createTime", "gmtCreate"],
46781
+ updatedAt: ["updatedAt", "updated_at", "modifiedTime", "modifyTime", "gmtModified"]
46782
+ };
46783
+ var pickAliasValue = (record2, aliases) => {
46784
+ for (const alias of aliases) {
46785
+ const value = record2?.[alias];
46786
+ if (value !== void 0 && value !== null && value !== "") return value;
46787
+ }
46788
+ return void 0;
46789
+ };
46790
+ var normalizeDataManagementRecord = (record2) => {
46791
+ if (!record2 || typeof record2 !== "object" || Array.isArray(record2)) return record2;
46792
+ const normalized = { ...record2 };
46793
+ Object.entries(SYSTEM_VALUE_ALIASES).forEach(([targetKey, aliases]) => {
46794
+ if (normalized[targetKey] !== void 0 && normalized[targetKey] !== null) return;
46795
+ const aliasValue = pickAliasValue(record2, aliases);
46796
+ if (aliasValue !== void 0) normalized[targetKey] = aliasValue;
46797
+ });
46798
+ return normalized;
46799
+ };
46800
+ var PROCESS_INSTANCE_STATUS_OPTIONS = [
46801
+ { label: "\u5F85\u5904\u7406", value: "pending" },
46802
+ { label: "\u5BA1\u6279\u4E2D", value: "running" },
46803
+ { label: "\u7B49\u5F85\u4E2D", value: "waiting" },
46804
+ { label: "\u6D41\u7A0B\u5F02\u5E38", value: "exception" },
46805
+ { label: "\u5DF2\u5B8C\u6210", value: "completed" },
46806
+ { label: "\u5DF2\u62D2\u7EDD", value: "terminated" },
46807
+ { label: "\u5DF2\u64A4\u9500", value: "withdrawn" }
46808
+ ];
46809
+ var APPROVAL_RESULT_OPTIONS = [
46810
+ { label: "\u5BA1\u6279\u4E2D", value: "processing" },
46811
+ { label: "\u540C\u610F", value: "approved" },
46812
+ { label: "\u62D2\u7EDD", value: "rejected" },
46813
+ { label: "\u64A4\u9500", value: "withdrawn" },
46814
+ { label: "\u5F02\u5E38", value: "exception" }
46815
+ ];
46816
+ var PROCESS_SYSTEM_FIELDS = [
46817
+ normalizeField(
46818
+ "currentApprovalNodeName",
46819
+ {
46820
+ label: "\u5F53\u524D\u5BA1\u6279\u8282\u70B9",
46821
+ componentName: "TextField",
46822
+ width: 140,
46823
+ processOnly: true,
46824
+ displayable: true
46825
+ },
46826
+ true
46827
+ ),
46828
+ normalizeField(
46829
+ "processInstanceStatus",
46830
+ {
46831
+ label: "\u5B9E\u4F8B\u72B6\u6001",
46832
+ componentName: "SelectField",
46833
+ width: 110,
46834
+ options: PROCESS_INSTANCE_STATUS_OPTIONS,
46835
+ processOnly: true,
46836
+ displayable: true
46837
+ },
46838
+ true
46839
+ ),
46840
+ normalizeField(
46841
+ "approvalResult",
46842
+ {
46843
+ label: "\u5BA1\u6279\u7ED3\u679C",
46844
+ componentName: "SelectField",
46845
+ width: 110,
46846
+ options: APPROVAL_RESULT_OPTIONS,
46847
+ processOnly: true,
46848
+ displayable: true
46849
+ },
46850
+ true
46851
+ )
46852
+ ];
46853
+ var BASE_SYSTEM_FIELDS = [
46854
+ normalizeField(
46855
+ "instanceTitle",
46856
+ { label: "\u5B9E\u4F8B\u6807\u9898", componentName: "TextField", width: 220, displayable: true },
46857
+ true
46858
+ ),
46859
+ normalizeField(
46860
+ "createdByName",
46861
+ { label: "\u521B\u5EFA\u4EBA", componentName: "TextField", width: 130, displayable: true },
46862
+ true
46863
+ ),
46864
+ normalizeField(
46865
+ "createdByDepartmentName",
46866
+ { label: "\u521B\u5EFA\u4EBA\u90E8\u95E8", componentName: "TextField", width: 150, displayable: true },
46867
+ true
46868
+ ),
46869
+ normalizeField(
46870
+ "createdAt",
46871
+ { label: "\u521B\u5EFA\u65F6\u95F4", componentName: "DateField", width: 170, displayable: true },
46872
+ true
46873
+ ),
46874
+ normalizeField(
46875
+ "updatedAt",
46876
+ { label: "\u66F4\u65B0\u65F6\u95F4", componentName: "DateField", width: 170, displayable: true },
46877
+ true
46878
+ )
46879
+ ];
46880
+ var getSystemFieldsForFormType = (formType) => formType === "process" ? [...BASE_SYSTEM_FIELDS, ...PROCESS_SYSTEM_FIELDS] : BASE_SYSTEM_FIELDS;
46881
+ var normalizeDataManagementFields = (payload) => {
46882
+ const data = pickData(payload);
46883
+ const rawSchema = data?.schema || data?.formSchema || data?.publishedSchema || data;
46884
+ const schemaAppType = rawSchema?.formMeta?.appType || data?.appType;
46885
+ const schemaFormUuid = rawSchema?.formMeta?.formUuid || data?.formUuid;
46886
+ const schemaTitle = rawSchema?.formMeta?.title || data?.title || data?.name || data?.formName || schemaFormUuid;
46887
+ const formType = data?.formType || data?.schema?.formType || data?.schema?.template?.formType || rawSchema?.template?.formType || data?.type;
46888
+ const rawFields = data?.formFields || data?.schema?.formFields || data?.fields || data?.schema?.fields || data?.formSchema?.fields || [];
46889
+ const fields = Array.isArray(rawFields) ? rawFields.map((field) => normalizeField(field?.fieldId || field?.id, field)) : Object.entries(rawFields).map(([key, field]) => normalizeField(key, field));
46890
+ return {
46891
+ fields: fields.filter((field) => field.componentName !== "PageSection"),
46892
+ formType,
46893
+ schema: rawSchema && Array.isArray(rawSchema.fields) && schemaAppType && schemaFormUuid ? {
46894
+ ...rawSchema,
46895
+ formMeta: {
46896
+ formUuid: schemaFormUuid,
46897
+ appType: schemaAppType,
46898
+ title: schemaTitle,
46899
+ ...rawSchema.formMeta || {}
46900
+ },
46901
+ template: {
46902
+ type: "standard",
46903
+ ...rawSchema.template || {},
46904
+ formType: rawSchema.template?.formType || formType
46905
+ }
46906
+ } : void 0
46907
+ };
46908
+ };
46909
+ var normalizeDataManagementList = (payload) => {
46910
+ const data = unwrap(payload);
46911
+ const body = data?.result || data;
46912
+ const records = body?.data || body?.records || body?.list || body?.items || [];
46913
+ const total = body?.totalCount ?? body?.total ?? body?.count ?? records.length;
46914
+ return {
46915
+ records: Array.isArray(records) ? records.map(normalizeDataManagementRecord) : [],
46916
+ total: Number(total) || 0
46917
+ };
46918
+ };
46919
+ var buildFilterPayload = (group) => {
46920
+ if (!group) return void 0;
46921
+ const normalizeOperator2 = (operator) => {
46922
+ const raw = String(operator || "").trim();
46923
+ const aliases = {
46924
+ contains: "CONTAINS",
46925
+ eq: "EQ",
46926
+ ne: "NEQ",
46927
+ neq: "NEQ",
46928
+ gt: "GT",
46929
+ gte: "GTE",
46930
+ lt: "LT",
46931
+ lte: "LTE",
46932
+ between: "BETWEEN",
46933
+ in: "IN",
46934
+ is_null: "IS_NULL",
46935
+ is_not_null: "IS_NOT_NULL",
46936
+ empty: "IS_NULL",
46937
+ not_empty: "IS_NOT_NULL",
46938
+ notEmpty: "IS_NOT_NULL"
46939
+ };
46940
+ return aliases[raw] || aliases[raw.toLowerCase()] || raw.toUpperCase();
46941
+ };
46942
+ const isNoValueOperator = (operator) => ["IS_NULL", "IS_NOT_NULL"].includes(normalizeOperator2(operator));
46943
+ const hasRuleValue = (rule) => {
46944
+ if (isNoValueOperator(rule.operator)) return true;
46945
+ if (Array.isArray(rule.value)) {
46946
+ return rule.value.some((item) => item !== void 0 && item !== null && item !== "");
46947
+ }
46948
+ return rule.value !== void 0 && rule.value !== null && rule.value !== "";
46949
+ };
46950
+ const trimGroup = (current) => ({
46951
+ ...current,
46952
+ rules: (current.rules || []).filter((rule) => rule.key && rule.operator && hasRuleValue(rule)).map((rule) => ({
46953
+ ...rule,
46954
+ operator: normalizeOperator2(rule.operator),
46955
+ value: isNoValueOperator(rule.operator) ? null : rule.value
46956
+ })),
46957
+ conditions: (current.conditions || []).map(trimGroup).filter((item) => item.rules.length > 0 || item.conditions.length > 0)
46958
+ });
46959
+ const payload = trimGroup(group);
46960
+ if (payload.rules.length === 0 && payload.conditions.length === 0) return void 0;
46961
+ return JSON.stringify(payload);
46962
+ };
46963
+ var normalizeColumnConfig = (cfg, fields) => {
46964
+ const allowed = new Set(fields.map((field) => field.fieldId));
46965
+ const configured = Array.isArray(cfg?.showFields) ? cfg.showFields.filter((fieldId) => allowed.has(fieldId)) : [];
46966
+ const defaultBusinessFields = fields.filter((field) => !field.system).slice(0, 8).map((field) => field.fieldId);
46967
+ const defaultSystemFields = fields.filter((field) => field.system && field.displayable).map((field) => field.fieldId);
46968
+ const defaultShow = [...defaultBusinessFields, ...defaultSystemFields];
46969
+ return {
46970
+ showFields: configured.length > 0 ? configured : defaultShow,
46971
+ widths: cfg?.widths || {},
46972
+ lockFieldIds: cfg?.lockFieldIds || [],
46973
+ sort: Array.isArray(cfg?.sort) ? cfg.sort : [],
46974
+ density: cfg?.density || "middle",
46975
+ detailOpenMode: cfg?.detailOpenMode === "newPage" ? "newPage" : "drawer",
46976
+ pageSize: cfg?.pageSize || 10
46977
+ };
46978
+ };
46979
+ async function getDataManagementSchema(request, params) {
46980
+ const response = await request({
46981
+ url: "/form/getFormSchemaAndPackages",
46982
+ method: "get",
46983
+ params
46984
+ });
46985
+ const result = normalizeDataManagementFields(response);
46986
+ if (result.schema) {
46987
+ result.schema = {
46988
+ ...result.schema,
46989
+ formMeta: {
46990
+ ...result.schema.formMeta,
46991
+ appType: result.schema.formMeta?.appType || params.appType,
46992
+ formUuid: result.schema.formMeta?.formUuid || params.formUuid,
46993
+ title: result.schema.formMeta?.title || params.formUuid
46994
+ }
46995
+ };
46996
+ }
46997
+ return result;
46998
+ }
46999
+ async function getDataManagementConfig(request, options) {
47000
+ const targetFormUuid = options.menuFormUuid || options.formUuid;
47001
+ const personal = options.scope === "personal";
47002
+ const response = await request({
47003
+ url: `/${options.appType}/v1/form/dataManagement/config/${personal ? "personal/" : ""}get.json`,
47004
+ method: "get",
47005
+ params: { formUuid: targetFormUuid }
47006
+ });
47007
+ return unwrap(response);
47008
+ }
47009
+ async function saveDataManagementConfig(request, options) {
47010
+ const targetFormUuid = options.menuFormUuid || options.formUuid;
47011
+ const personal = options.scope === "personal";
47012
+ const response = await request({
47013
+ url: `/${options.appType}/v1/form/dataManagement/config/${personal ? "personal/" : ""}save.json`,
47014
+ method: "post",
47015
+ data: { formUuid: targetFormUuid, config: options.config }
47016
+ });
47017
+ return unwrap(response);
47018
+ }
47019
+ async function advancedSearchDataManagement(request, query) {
47020
+ const response = await request({
47021
+ url: `/${query.appType}/v1/form/advancedSearch.json`,
47022
+ method: "get",
47023
+ params: {
47024
+ appType: query.appType,
47025
+ formUuid: query.formUuid,
47026
+ filters: query.rawFilters ?? buildFilterPayload(query.filters),
47027
+ conditionType: query.conditionType,
47028
+ searchKeyWord: query.searchKeyWord,
47029
+ currentPage: query.currentPage || 1,
47030
+ pageSize: query.pageSize || 10,
47031
+ order: JSON.stringify(query.order || []),
47032
+ instanceStatus: query.instanceStatus
47033
+ }
47034
+ });
47035
+ return normalizeDataManagementList(response);
47036
+ }
47037
+ async function deleteDataManagementRows(request, params) {
47038
+ const formInstId = params.formInstanceIds.length === 1 ? params.formInstanceIds[0] : params.formInstanceIds;
47039
+ const response = await request({
47040
+ url: `/${params.appType}/v1/form/deleteFormData.json`,
47041
+ method: "post",
47042
+ data: {
47043
+ appType: params.appType,
47044
+ formUuid: params.formUuid,
47045
+ formInstId,
47046
+ formInstIds: params.formInstanceIds,
47047
+ formInstanceIds: params.formInstanceIds
47048
+ }
47049
+ });
47050
+ return unwrap(response);
47051
+ }
47052
+ async function batchApproveDataManagementRows(request, params) {
47053
+ const response = await request({
47054
+ url: "/workflow/approve/batch",
47055
+ method: "post",
47056
+ data: {
47057
+ instanceIds: params.formInstanceIds,
47058
+ action: params.action,
47059
+ comments: params.comments
47060
+ }
47061
+ });
47062
+ return unwrap(response);
47063
+ }
47064
+ async function exportDataManagementRows(request, params) {
47065
+ return request({
47066
+ url: `/${params.appType}/v1/form/advancedExport.xlsx`,
47067
+ method: "get",
47068
+ responseType: "blob",
47069
+ params: {
47070
+ appType: params.appType,
47071
+ formUuid: params.formUuid,
47072
+ filters: params.rawFilters ?? buildFilterPayload(params.filters),
47073
+ conditionType: params.conditionType,
47074
+ searchKeyWord: params.searchKeyWord,
47075
+ currentPage: params.currentPage,
47076
+ pageSize: params.pageSize,
47077
+ order: JSON.stringify(params.order || []),
47078
+ instanceStatus: params.instanceStatus,
47079
+ exportAll: params.exportAll || "n",
47080
+ embedImages: params.embedImages || "n",
47081
+ exportFields: (params.exportFields || []).join(",")
47082
+ }
47083
+ });
47084
+ }
47085
+ async function downloadDataManagementImportTemplate(request, params) {
47086
+ return request({
47087
+ url: `/${params.appType}/v1/form/advancedExportTemplate.xlsx`,
47088
+ method: "get",
47089
+ responseType: "blob",
47090
+ params: {
47091
+ formUuid: params.formUuid
47092
+ }
47093
+ });
47094
+ }
47095
+ async function importPreviewDataManagementRows(request, params) {
47096
+ const response = await request({
47097
+ url: `/${params.appType}/v1/form/importPreview.xlsx`,
47098
+ method: "post",
47099
+ data: { formUuid: params.formUuid, fileBase64: params.fileBase64 }
47100
+ });
47101
+ return unwrap(response);
47102
+ }
47103
+ async function importDataManagementRows(request, params) {
47104
+ const response = await request({
47105
+ url: `/${params.appType}/v1/form/import.xlsx`,
47106
+ method: "post",
47107
+ data: { formUuid: params.formUuid, fileBase64: params.fileBase64 }
47108
+ });
47109
+ return unwrap(response);
47110
+ }
47111
+ async function getDataManagementTransferRecords(request, params) {
47112
+ const response = await request({
47113
+ url: `/${params.appType}/v1/form/${params.type}Records.json`,
47114
+ method: "get",
47115
+ params
47116
+ });
47117
+ return normalizeDataManagementList(response);
47118
+ }
47119
+
47120
47120
  // packages/sdk/src/components/modules/DataManagementList.tsx
47121
47121
  import { jsx as jsx97, jsxs as jsxs48 } from "react/jsx-runtime";
47122
47122
  var DEFAULT_MAX_VISIBLE_ROW_ACTIONS = 4;
@@ -49196,6 +49196,92 @@ var DataManagementList = ({
49196
49196
  ) });
49197
49197
  };
49198
49198
 
49199
+ // packages/sdk/src/runtime/host/formSchema.ts
49200
+ var normalizePlatformComponentName = (componentName) => {
49201
+ const value = String(componentName || "").trim();
49202
+ return value || "TextField";
49203
+ };
49204
+ var extractSlotNodes = (value) => {
49205
+ if (!value) return [];
49206
+ if (Array.isArray(value)) {
49207
+ return value.flatMap((item) => extractSlotNodes(item));
49208
+ }
49209
+ if (typeof value !== "object") return [];
49210
+ if (value.type === "JSSlot" && value.value) {
49211
+ return extractSlotNodes(value.value);
49212
+ }
49213
+ if (value.componentName || Array.isArray(value.children)) {
49214
+ return [value];
49215
+ }
49216
+ return Object.values(value).flatMap((item) => extractSlotNodes(item));
49217
+ };
49218
+ var extractFieldsFromComponentsTree = (componentsTree) => {
49219
+ const roots = Array.isArray(componentsTree) ? componentsTree : [componentsTree];
49220
+ const fields = [];
49221
+ const seen = /* @__PURE__ */ new Set();
49222
+ const walk = (components) => {
49223
+ if (!Array.isArray(components)) return;
49224
+ components.forEach((component) => {
49225
+ if (!component || typeof component !== "object") return;
49226
+ const props = component.props || {};
49227
+ const fieldId = String(props.fieldId || component.fieldId || component.id || "").trim();
49228
+ if (props.isFormComponent === true && fieldId && !seen.has(fieldId)) {
49229
+ seen.add(fieldId);
49230
+ fields.push({
49231
+ ...props,
49232
+ id: props.id || component.id || fieldId,
49233
+ fieldId,
49234
+ componentName: normalizePlatformComponentName(
49235
+ props.componentName || component.componentName
49236
+ ),
49237
+ label: props.label || component.title || props.title || fieldId,
49238
+ title: props.title || component.title || props.label || fieldId,
49239
+ required: props.required ?? component.required
49240
+ });
49241
+ }
49242
+ if (component.componentName === "SubFormField") return;
49243
+ if (Array.isArray(component.children)) {
49244
+ walk(component.children);
49245
+ }
49246
+ Object.values(props).forEach((propValue) => {
49247
+ walk(extractSlotNodes(propValue));
49248
+ });
49249
+ });
49250
+ };
49251
+ walk(roots);
49252
+ return fields;
49253
+ };
49254
+ var createDefaultLayout = (fields) => fields.map((field) => ({
49255
+ id: `layout_${field.fieldId}`,
49256
+ type: "field",
49257
+ fieldId: field.fieldId
49258
+ }));
49259
+ var normalizeRuntimeFormSchema = (payload, options) => {
49260
+ const normalized = normalizeDataManagementFields(payload);
49261
+ if (normalized.schema) return normalized.schema;
49262
+ const body = payload?.data ?? payload?.result ?? payload;
49263
+ const rawSchema = body?.schema || body?.formSchema || body?.publishedSchema || body;
49264
+ if (!rawSchema) return void 0;
49265
+ const fields = Array.isArray(rawSchema.fields) ? rawSchema.fields : extractFieldsFromComponentsTree(rawSchema.componentsTree);
49266
+ if (!Array.isArray(fields) || fields.length === 0) return void 0;
49267
+ return {
49268
+ ...rawSchema,
49269
+ fields,
49270
+ layout: rawSchema.layout || createDefaultLayout(fields),
49271
+ formMeta: {
49272
+ appType: options.appType,
49273
+ formUuid: options.formUuid,
49274
+ title: rawSchema.formMeta?.title || body?.title || body?.name || options.formUuid,
49275
+ ...rawSchema.formMeta || {}
49276
+ },
49277
+ template: {
49278
+ type: "standard",
49279
+ ...rawSchema.template || {},
49280
+ formType: rawSchema.template?.formType || body?.formType
49281
+ }
49282
+ };
49283
+ };
49284
+
49199
49285
  // packages/sdk/src/runtime/host/builtinRouteRenderer.tsx
49200
49286
  import { jsx as jsx98, jsxs as jsxs49 } from "react/jsx-runtime";
49201
49287
  var DEFAULT_SERVICE_PREFIX = "/service";
@@ -49277,89 +49363,8 @@ var isProcessKind = (kind, formType) => {
49277
49363
  const raw = String(formType || "").toLowerCase();
49278
49364
  return kind === "process-submit" || kind === "process-detail" || raw === "process" || raw === "flow";
49279
49365
  };
49280
- var normalizePlatformComponentName = (componentName) => {
49281
- const value = String(componentName || "").trim();
49282
- return value || "TextField";
49283
- };
49284
- var extractSlotNodes = (value) => {
49285
- if (!value) return [];
49286
- if (Array.isArray(value)) {
49287
- return value.flatMap((item) => extractSlotNodes(item));
49288
- }
49289
- if (typeof value !== "object") return [];
49290
- if (value.type === "JSSlot" && value.value) {
49291
- return extractSlotNodes(value.value);
49292
- }
49293
- if (value.componentName || Array.isArray(value.children)) {
49294
- return [value];
49295
- }
49296
- return Object.values(value).flatMap((item) => extractSlotNodes(item));
49297
- };
49298
- var extractFieldsFromComponentsTree = (componentsTree) => {
49299
- const roots = Array.isArray(componentsTree) ? componentsTree : [componentsTree];
49300
- const fields = [];
49301
- const seen = /* @__PURE__ */ new Set();
49302
- const walk = (components) => {
49303
- if (!Array.isArray(components)) return;
49304
- components.forEach((component) => {
49305
- if (!component || typeof component !== "object") return;
49306
- const props = component.props || {};
49307
- const fieldId = String(props.fieldId || component.fieldId || component.id || "").trim();
49308
- if (props.isFormComponent === true && fieldId && !seen.has(fieldId)) {
49309
- seen.add(fieldId);
49310
- fields.push({
49311
- ...props,
49312
- id: props.id || component.id || fieldId,
49313
- fieldId,
49314
- componentName: normalizePlatformComponentName(
49315
- props.componentName || component.componentName
49316
- ),
49317
- label: props.label || component.title || props.title || fieldId,
49318
- title: props.title || component.title || props.label || fieldId,
49319
- required: props.required ?? component.required
49320
- });
49321
- }
49322
- if (component.componentName === "SubFormField") return;
49323
- if (Array.isArray(component.children)) {
49324
- walk(component.children);
49325
- }
49326
- Object.values(props).forEach((propValue) => {
49327
- walk(extractSlotNodes(propValue));
49328
- });
49329
- });
49330
- };
49331
- walk(roots);
49332
- return fields;
49333
- };
49334
- var createDefaultLayout = (fields) => fields.map((field) => ({
49335
- id: `layout_${field.fieldId}`,
49336
- type: "field",
49337
- fieldId: field.fieldId
49338
- }));
49339
49366
  var normalizeSchema = (payload, appType, formUuid) => {
49340
- const normalized = normalizeDataManagementFields(payload);
49341
- if (normalized.schema) return normalized.schema;
49342
- const body = payload?.data ?? payload?.result ?? payload;
49343
- const rawSchema = body?.schema || body?.formSchema || body?.publishedSchema || body;
49344
- if (!rawSchema) return void 0;
49345
- const fields = Array.isArray(rawSchema.fields) ? rawSchema.fields : extractFieldsFromComponentsTree(rawSchema.componentsTree);
49346
- if (!Array.isArray(fields) || fields.length === 0) return void 0;
49347
- return {
49348
- ...rawSchema,
49349
- fields,
49350
- layout: rawSchema.layout || createDefaultLayout(fields),
49351
- formMeta: {
49352
- appType,
49353
- formUuid,
49354
- title: rawSchema.formMeta?.title || body?.title || body?.name || formUuid,
49355
- ...rawSchema.formMeta || {}
49356
- },
49357
- template: {
49358
- type: "standard",
49359
- ...rawSchema.template || {},
49360
- formType: rawSchema.template?.formType || body?.formType
49361
- }
49362
- };
49367
+ return normalizeRuntimeFormSchema(payload, { appType, formUuid });
49363
49368
  };
49364
49369
  var applyRouteConfigToSchema = (schema, kind, config3) => {
49365
49370
  const formType = config3.formType || schema.template?.formType;
@@ -49632,11 +49637,13 @@ export {
49632
49637
  createBuiltinRouteRequest,
49633
49638
  createPageSdk,
49634
49639
  createReactPage,
49640
+ extractFieldsFromComponentsTree,
49635
49641
  fetchBrowserRuntimeBootstrap,
49636
49642
  loadCustomPageModule,
49637
49643
  loadRuntimeScriptModules,
49638
49644
  mountBrowserPageRuntime,
49639
49645
  mountCustomPageRuntime,
49646
+ normalizeRuntimeFormSchema,
49640
49647
  resolveBrowserRuntimeRoute,
49641
49648
  resolveRuntimeAssets,
49642
49649
  useAppMenus,