sy-form-components 0.2.2 → 0.2.4

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/dist/index.d.mts CHANGED
@@ -894,6 +894,7 @@ interface UseFormDetailOptions {
894
894
  formUuid: string;
895
895
  appType: string;
896
896
  formInstanceId: string;
897
+ fieldIds?: readonly string[];
897
898
  onPermissionDenied?: () => void;
898
899
  }
899
900
  interface UseFormDetailReturn {
@@ -921,6 +922,7 @@ interface UseProcessDetailOptions {
921
922
  formUuid: string;
922
923
  appType: string;
923
924
  formInstanceId: string;
925
+ fieldIds?: readonly string[];
924
926
  }
925
927
  interface UseProcessDetailReturn {
926
928
  loading: boolean;
@@ -1037,6 +1039,8 @@ declare function useDraftStorage(options: UseDraftStorageOptions): UseDraftStora
1037
1039
  */
1038
1040
  declare function defineFormSchema(schema: FormSchema): FormSchema;
1039
1041
 
1042
+ declare const extractFormValues: (formInstance: unknown, fieldIds?: readonly string[]) => Record<string, any> | null;
1043
+
1040
1044
  interface FormSummaryCardProps {
1041
1045
  title?: string;
1042
1046
  formInstanceId?: string;
@@ -1189,4 +1193,4 @@ interface PageSkeletonProps {
1189
1193
  }
1190
1194
  declare const PageSkeleton: React__default.FC<PageSkeletonProps>;
1191
1195
 
1192
- export { type ActionConfig, AddressField, type AddressFieldProps, type AddressValue, type ApprovalActionType, ApprovalActions, type ApprovalActionsProps, type ApprovalPermission, ApprovalTimeline, type ApprovalTimelineProps, type ApproveParams, type AssociationFormConfig, AssociationFormField, type AssociationFormFieldProps, type AssociationValue, AttachmentField, type AttachmentFieldProps, type AttachmentItem, type BaseFieldProps, CascadeDateField, type CascadeDateFieldProps, CascadeSelectField, type CascadeSelectFieldProps, type ChangeRecord, type ChangeRecordListResponse, type ChangeRecordQueryParams, ChangeRecords, type ChangeRecordsProps, CheckboxField, type CheckboxFieldProps, ComponentRegistryContext, type ComponentRegistryContextValue, ComponentRegistryProvider, DateField, type DateFieldProps, DepartmentSelectField, type DepartmentSelectFieldProps, type DepartmentTreeNode, type DeviceDetectResult, DigitalSignatureField, type DigitalSignatureFieldProps, type DigitalSignatureValue, DraftManager, type DraftManagerProps, EditorField, type EditorFieldProps, UserSelectField as EmployeeSelectField, type FieldBehavior, type FieldDefinition, FieldWrapper, type FieldWrapperProps, FormActionBar, type FormActionBarProps, FormActions, type FormActionsProps, FormContainer, type FormContainerProps, FormContext, type FormContextValue, type FormDataDeleteParams, type FormDataQueryParams, FormDetailTemplate, type FormDetailTemplateProps, type FormEffect, type FormEngineConfig, FormGrid, type FormGridProps, type FormInstanceData, FormProvider, type FormProviderProps, FormRenderer, type FormRendererProps, type FormRuntimeApi, type FormRuntimeApiConfig, type FormSchema, FormSection, type FormSectionProps, type FormStepItem, FormSteps, type FormStepsProps, FormSubmitTemplate, type FormSubmitTemplateProps, FormSummary, FormSummaryCard, type FormSummaryCardProps, type FormSummaryProps, type FormTabItem, FormTabs, type FormTabsProps, ImageField, type ImageFieldProps, JSONField, type JSONFieldProps, LocationField, type LocationFieldProps, type LocationValue, MultiSelectField, type MultiSelectFieldProps, NumberField, type NumberFieldProps, type OptionItem, PROCESS_STATUS_META, PageSkeleton, type PageSkeletonProps, type PreviewParams, type ProcessAction, type ProcessBasicInfo, type ProcessDefinition, ProcessDetailTemplate, type ProcessDetailTemplateProps, type ProcessNodeType, ProcessPreview, type ProcessPreviewProps, type ProcessRoute, type ProcessStatus, type ProcessTask, RadioField, type RadioFieldProps, type ResubmitParams, type ReturnParams, type ReturnableNode, type RuntimeRequestConfig, type RuntimeResponse, type SaveTaskParams, SelectField, type SelectFieldProps, SerialNumberField, type SerialNumberFieldProps, type SignaturePoint, type StatusMeta, type SubFormColumn, SubFormField, type SubFormFieldProps, type SubmitConfig, type SubmitSuccessInfo, TASK_STATUS_META, type TaskStatus, TextAreaField, type TextAreaFieldProps, TextField, type TextFieldProps, TextAreaField as TextareaField, type TransferParams, type UseApprovalActionsOptions, type UseApprovalActionsReturn, type UseChangeRecordsOptions, type UseChangeRecordsReturn, type UseDraftStorageOptions, type UseDraftStorageReturn, type UseFieldBehaviorOptions, type UseFieldPermissionOptions, type UseFieldPermissionReturn, type UseFormDataReturn, type UseFormDetailOptions, type UseFormDetailReturn, type UseFormEngineReturn, type UseFormNavigationOptions, type UseFormNavigationReturn, type UseFormSubmitReturn, type UseProcessDetailOptions, type UseProcessDetailReturn, type UserItem, UserSelectField, type UserSelectFieldProps, type ValidationRule, type ViewPermissionQueryParams, type ViewPermissionSummary, type WithdrawParams, checkUserApproval, createFormRuntimeApi, defaultComponentRegistry, defineFormSchema, deleteFormData, evaluateEffects, getChangeRecords, getFormData, getProcessBasic, getProcessDefinition, getProcessProgress, getReturnableNodes, getViewPermission, handleApproval, previewProcess, resubmitTask, returnTask, saveTask, transferTask, useApprovalActions, useChangeRecords, useComponent, useDeviceDetect, useDraftStorage, useFieldBehavior, useFieldPermission, useFormContext, useFormData, useFormDetail, useFormEngine, useFormNavigation, useFormSubmit, useProcessDetail, validateAllFields, validateField, withdrawProcess };
1196
+ export { type ActionConfig, AddressField, type AddressFieldProps, type AddressValue, type ApprovalActionType, ApprovalActions, type ApprovalActionsProps, type ApprovalPermission, ApprovalTimeline, type ApprovalTimelineProps, type ApproveParams, type AssociationFormConfig, AssociationFormField, type AssociationFormFieldProps, type AssociationValue, AttachmentField, type AttachmentFieldProps, type AttachmentItem, type BaseFieldProps, CascadeDateField, type CascadeDateFieldProps, CascadeSelectField, type CascadeSelectFieldProps, type ChangeRecord, type ChangeRecordListResponse, type ChangeRecordQueryParams, ChangeRecords, type ChangeRecordsProps, CheckboxField, type CheckboxFieldProps, ComponentRegistryContext, type ComponentRegistryContextValue, ComponentRegistryProvider, DateField, type DateFieldProps, DepartmentSelectField, type DepartmentSelectFieldProps, type DepartmentTreeNode, type DeviceDetectResult, DigitalSignatureField, type DigitalSignatureFieldProps, type DigitalSignatureValue, DraftManager, type DraftManagerProps, EditorField, type EditorFieldProps, UserSelectField as EmployeeSelectField, type FieldBehavior, type FieldDefinition, FieldWrapper, type FieldWrapperProps, FormActionBar, type FormActionBarProps, FormActions, type FormActionsProps, FormContainer, type FormContainerProps, FormContext, type FormContextValue, type FormDataDeleteParams, type FormDataQueryParams, FormDetailTemplate, type FormDetailTemplateProps, type FormEffect, type FormEngineConfig, FormGrid, type FormGridProps, type FormInstanceData, FormProvider, type FormProviderProps, FormRenderer, type FormRendererProps, type FormRuntimeApi, type FormRuntimeApiConfig, type FormSchema, FormSection, type FormSectionProps, type FormStepItem, FormSteps, type FormStepsProps, FormSubmitTemplate, type FormSubmitTemplateProps, FormSummary, FormSummaryCard, type FormSummaryCardProps, type FormSummaryProps, type FormTabItem, FormTabs, type FormTabsProps, ImageField, type ImageFieldProps, JSONField, type JSONFieldProps, LocationField, type LocationFieldProps, type LocationValue, MultiSelectField, type MultiSelectFieldProps, NumberField, type NumberFieldProps, type OptionItem, PROCESS_STATUS_META, PageSkeleton, type PageSkeletonProps, type PreviewParams, type ProcessAction, type ProcessBasicInfo, type ProcessDefinition, ProcessDetailTemplate, type ProcessDetailTemplateProps, type ProcessNodeType, ProcessPreview, type ProcessPreviewProps, type ProcessRoute, type ProcessStatus, type ProcessTask, RadioField, type RadioFieldProps, type ResubmitParams, type ReturnParams, type ReturnableNode, type RuntimeRequestConfig, type RuntimeResponse, type SaveTaskParams, SelectField, type SelectFieldProps, SerialNumberField, type SerialNumberFieldProps, type SignaturePoint, type StatusMeta, type SubFormColumn, SubFormField, type SubFormFieldProps, type SubmitConfig, type SubmitSuccessInfo, TASK_STATUS_META, type TaskStatus, TextAreaField, type TextAreaFieldProps, TextField, type TextFieldProps, TextAreaField as TextareaField, type TransferParams, type UseApprovalActionsOptions, type UseApprovalActionsReturn, type UseChangeRecordsOptions, type UseChangeRecordsReturn, type UseDraftStorageOptions, type UseDraftStorageReturn, type UseFieldBehaviorOptions, type UseFieldPermissionOptions, type UseFieldPermissionReturn, type UseFormDataReturn, type UseFormDetailOptions, type UseFormDetailReturn, type UseFormEngineReturn, type UseFormNavigationOptions, type UseFormNavigationReturn, type UseFormSubmitReturn, type UseProcessDetailOptions, type UseProcessDetailReturn, type UserItem, UserSelectField, type UserSelectFieldProps, type ValidationRule, type ViewPermissionQueryParams, type ViewPermissionSummary, type WithdrawParams, checkUserApproval, createFormRuntimeApi, defaultComponentRegistry, defineFormSchema, deleteFormData, evaluateEffects, extractFormValues, getChangeRecords, getFormData, getProcessBasic, getProcessDefinition, getProcessProgress, getReturnableNodes, getViewPermission, handleApproval, previewProcess, resubmitTask, returnTask, saveTask, transferTask, useApprovalActions, useChangeRecords, useComponent, useDeviceDetect, useDraftStorage, useFieldBehavior, useFieldPermission, useFormContext, useFormData, useFormDetail, useFormEngine, useFormNavigation, useFormSubmit, useProcessDetail, validateAllFields, validateField, withdrawProcess };
package/dist/index.d.ts CHANGED
@@ -894,6 +894,7 @@ interface UseFormDetailOptions {
894
894
  formUuid: string;
895
895
  appType: string;
896
896
  formInstanceId: string;
897
+ fieldIds?: readonly string[];
897
898
  onPermissionDenied?: () => void;
898
899
  }
899
900
  interface UseFormDetailReturn {
@@ -921,6 +922,7 @@ interface UseProcessDetailOptions {
921
922
  formUuid: string;
922
923
  appType: string;
923
924
  formInstanceId: string;
925
+ fieldIds?: readonly string[];
924
926
  }
925
927
  interface UseProcessDetailReturn {
926
928
  loading: boolean;
@@ -1037,6 +1039,8 @@ declare function useDraftStorage(options: UseDraftStorageOptions): UseDraftStora
1037
1039
  */
1038
1040
  declare function defineFormSchema(schema: FormSchema): FormSchema;
1039
1041
 
1042
+ declare const extractFormValues: (formInstance: unknown, fieldIds?: readonly string[]) => Record<string, any> | null;
1043
+
1040
1044
  interface FormSummaryCardProps {
1041
1045
  title?: string;
1042
1046
  formInstanceId?: string;
@@ -1189,4 +1193,4 @@ interface PageSkeletonProps {
1189
1193
  }
1190
1194
  declare const PageSkeleton: React__default.FC<PageSkeletonProps>;
1191
1195
 
1192
- export { type ActionConfig, AddressField, type AddressFieldProps, type AddressValue, type ApprovalActionType, ApprovalActions, type ApprovalActionsProps, type ApprovalPermission, ApprovalTimeline, type ApprovalTimelineProps, type ApproveParams, type AssociationFormConfig, AssociationFormField, type AssociationFormFieldProps, type AssociationValue, AttachmentField, type AttachmentFieldProps, type AttachmentItem, type BaseFieldProps, CascadeDateField, type CascadeDateFieldProps, CascadeSelectField, type CascadeSelectFieldProps, type ChangeRecord, type ChangeRecordListResponse, type ChangeRecordQueryParams, ChangeRecords, type ChangeRecordsProps, CheckboxField, type CheckboxFieldProps, ComponentRegistryContext, type ComponentRegistryContextValue, ComponentRegistryProvider, DateField, type DateFieldProps, DepartmentSelectField, type DepartmentSelectFieldProps, type DepartmentTreeNode, type DeviceDetectResult, DigitalSignatureField, type DigitalSignatureFieldProps, type DigitalSignatureValue, DraftManager, type DraftManagerProps, EditorField, type EditorFieldProps, UserSelectField as EmployeeSelectField, type FieldBehavior, type FieldDefinition, FieldWrapper, type FieldWrapperProps, FormActionBar, type FormActionBarProps, FormActions, type FormActionsProps, FormContainer, type FormContainerProps, FormContext, type FormContextValue, type FormDataDeleteParams, type FormDataQueryParams, FormDetailTemplate, type FormDetailTemplateProps, type FormEffect, type FormEngineConfig, FormGrid, type FormGridProps, type FormInstanceData, FormProvider, type FormProviderProps, FormRenderer, type FormRendererProps, type FormRuntimeApi, type FormRuntimeApiConfig, type FormSchema, FormSection, type FormSectionProps, type FormStepItem, FormSteps, type FormStepsProps, FormSubmitTemplate, type FormSubmitTemplateProps, FormSummary, FormSummaryCard, type FormSummaryCardProps, type FormSummaryProps, type FormTabItem, FormTabs, type FormTabsProps, ImageField, type ImageFieldProps, JSONField, type JSONFieldProps, LocationField, type LocationFieldProps, type LocationValue, MultiSelectField, type MultiSelectFieldProps, NumberField, type NumberFieldProps, type OptionItem, PROCESS_STATUS_META, PageSkeleton, type PageSkeletonProps, type PreviewParams, type ProcessAction, type ProcessBasicInfo, type ProcessDefinition, ProcessDetailTemplate, type ProcessDetailTemplateProps, type ProcessNodeType, ProcessPreview, type ProcessPreviewProps, type ProcessRoute, type ProcessStatus, type ProcessTask, RadioField, type RadioFieldProps, type ResubmitParams, type ReturnParams, type ReturnableNode, type RuntimeRequestConfig, type RuntimeResponse, type SaveTaskParams, SelectField, type SelectFieldProps, SerialNumberField, type SerialNumberFieldProps, type SignaturePoint, type StatusMeta, type SubFormColumn, SubFormField, type SubFormFieldProps, type SubmitConfig, type SubmitSuccessInfo, TASK_STATUS_META, type TaskStatus, TextAreaField, type TextAreaFieldProps, TextField, type TextFieldProps, TextAreaField as TextareaField, type TransferParams, type UseApprovalActionsOptions, type UseApprovalActionsReturn, type UseChangeRecordsOptions, type UseChangeRecordsReturn, type UseDraftStorageOptions, type UseDraftStorageReturn, type UseFieldBehaviorOptions, type UseFieldPermissionOptions, type UseFieldPermissionReturn, type UseFormDataReturn, type UseFormDetailOptions, type UseFormDetailReturn, type UseFormEngineReturn, type UseFormNavigationOptions, type UseFormNavigationReturn, type UseFormSubmitReturn, type UseProcessDetailOptions, type UseProcessDetailReturn, type UserItem, UserSelectField, type UserSelectFieldProps, type ValidationRule, type ViewPermissionQueryParams, type ViewPermissionSummary, type WithdrawParams, checkUserApproval, createFormRuntimeApi, defaultComponentRegistry, defineFormSchema, deleteFormData, evaluateEffects, getChangeRecords, getFormData, getProcessBasic, getProcessDefinition, getProcessProgress, getReturnableNodes, getViewPermission, handleApproval, previewProcess, resubmitTask, returnTask, saveTask, transferTask, useApprovalActions, useChangeRecords, useComponent, useDeviceDetect, useDraftStorage, useFieldBehavior, useFieldPermission, useFormContext, useFormData, useFormDetail, useFormEngine, useFormNavigation, useFormSubmit, useProcessDetail, validateAllFields, validateField, withdrawProcess };
1196
+ export { type ActionConfig, AddressField, type AddressFieldProps, type AddressValue, type ApprovalActionType, ApprovalActions, type ApprovalActionsProps, type ApprovalPermission, ApprovalTimeline, type ApprovalTimelineProps, type ApproveParams, type AssociationFormConfig, AssociationFormField, type AssociationFormFieldProps, type AssociationValue, AttachmentField, type AttachmentFieldProps, type AttachmentItem, type BaseFieldProps, CascadeDateField, type CascadeDateFieldProps, CascadeSelectField, type CascadeSelectFieldProps, type ChangeRecord, type ChangeRecordListResponse, type ChangeRecordQueryParams, ChangeRecords, type ChangeRecordsProps, CheckboxField, type CheckboxFieldProps, ComponentRegistryContext, type ComponentRegistryContextValue, ComponentRegistryProvider, DateField, type DateFieldProps, DepartmentSelectField, type DepartmentSelectFieldProps, type DepartmentTreeNode, type DeviceDetectResult, DigitalSignatureField, type DigitalSignatureFieldProps, type DigitalSignatureValue, DraftManager, type DraftManagerProps, EditorField, type EditorFieldProps, UserSelectField as EmployeeSelectField, type FieldBehavior, type FieldDefinition, FieldWrapper, type FieldWrapperProps, FormActionBar, type FormActionBarProps, FormActions, type FormActionsProps, FormContainer, type FormContainerProps, FormContext, type FormContextValue, type FormDataDeleteParams, type FormDataQueryParams, FormDetailTemplate, type FormDetailTemplateProps, type FormEffect, type FormEngineConfig, FormGrid, type FormGridProps, type FormInstanceData, FormProvider, type FormProviderProps, FormRenderer, type FormRendererProps, type FormRuntimeApi, type FormRuntimeApiConfig, type FormSchema, FormSection, type FormSectionProps, type FormStepItem, FormSteps, type FormStepsProps, FormSubmitTemplate, type FormSubmitTemplateProps, FormSummary, FormSummaryCard, type FormSummaryCardProps, type FormSummaryProps, type FormTabItem, FormTabs, type FormTabsProps, ImageField, type ImageFieldProps, JSONField, type JSONFieldProps, LocationField, type LocationFieldProps, type LocationValue, MultiSelectField, type MultiSelectFieldProps, NumberField, type NumberFieldProps, type OptionItem, PROCESS_STATUS_META, PageSkeleton, type PageSkeletonProps, type PreviewParams, type ProcessAction, type ProcessBasicInfo, type ProcessDefinition, ProcessDetailTemplate, type ProcessDetailTemplateProps, type ProcessNodeType, ProcessPreview, type ProcessPreviewProps, type ProcessRoute, type ProcessStatus, type ProcessTask, RadioField, type RadioFieldProps, type ResubmitParams, type ReturnParams, type ReturnableNode, type RuntimeRequestConfig, type RuntimeResponse, type SaveTaskParams, SelectField, type SelectFieldProps, SerialNumberField, type SerialNumberFieldProps, type SignaturePoint, type StatusMeta, type SubFormColumn, SubFormField, type SubFormFieldProps, type SubmitConfig, type SubmitSuccessInfo, TASK_STATUS_META, type TaskStatus, TextAreaField, type TextAreaFieldProps, TextField, type TextFieldProps, TextAreaField as TextareaField, type TransferParams, type UseApprovalActionsOptions, type UseApprovalActionsReturn, type UseChangeRecordsOptions, type UseChangeRecordsReturn, type UseDraftStorageOptions, type UseDraftStorageReturn, type UseFieldBehaviorOptions, type UseFieldPermissionOptions, type UseFieldPermissionReturn, type UseFormDataReturn, type UseFormDetailOptions, type UseFormDetailReturn, type UseFormEngineReturn, type UseFormNavigationOptions, type UseFormNavigationReturn, type UseFormSubmitReturn, type UseProcessDetailOptions, type UseProcessDetailReturn, type UserItem, UserSelectField, type UserSelectFieldProps, type ValidationRule, type ViewPermissionQueryParams, type ViewPermissionSummary, type WithdrawParams, checkUserApproval, createFormRuntimeApi, defaultComponentRegistry, defineFormSchema, deleteFormData, evaluateEffects, extractFormValues, getChangeRecords, getFormData, getProcessBasic, getProcessDefinition, getProcessProgress, getReturnableNodes, getViewPermission, handleApproval, previewProcess, resubmitTask, returnTask, saveTask, transferTask, useApprovalActions, useChangeRecords, useComponent, useDeviceDetect, useDraftStorage, useFieldBehavior, useFieldPermission, useFormContext, useFormData, useFormDetail, useFormEngine, useFormNavigation, useFormSubmit, useProcessDetail, validateAllFields, validateField, withdrawProcess };
package/dist/index.js CHANGED
@@ -86,6 +86,7 @@ __export(index_exports, {
86
86
  defineFormSchema: () => defineFormSchema,
87
87
  deleteFormData: () => deleteFormData,
88
88
  evaluateEffects: () => evaluateEffects,
89
+ extractFormValues: () => extractFormValues,
89
90
  getChangeRecords: () => getChangeRecords,
90
91
  getFormData: () => getFormData,
91
92
  getProcessBasic: () => getProcessBasic,
@@ -4452,6 +4453,15 @@ var TASK_STATUS_META = {
4452
4453
  };
4453
4454
 
4454
4455
  // src/core/processApi.ts
4456
+ var normalizeProcessTasks = (value) => {
4457
+ if (Array.isArray(value)) return value;
4458
+ if (!value || typeof value !== "object") return [];
4459
+ if (Array.isArray(value.tasks)) return value.tasks;
4460
+ if (Array.isArray(value.list)) return value.list;
4461
+ if (Array.isArray(value.items)) return value.items;
4462
+ if (Array.isArray(value.records)) return value.records;
4463
+ return [];
4464
+ };
4455
4465
  async function getProcessBasic(request, formInstId) {
4456
4466
  const response = await request({
4457
4467
  url: `/workflow/instance/${formInstId}/basic`,
@@ -4461,10 +4471,10 @@ async function getProcessBasic(request, formInstId) {
4461
4471
  }
4462
4472
  async function getProcessProgress(request, formInstId) {
4463
4473
  const response = await request({
4464
- url: `/workflow/instance/${formInstId}`,
4474
+ url: `/workflow/instance/${formInstId}/all-tasks`,
4465
4475
  method: "get"
4466
4476
  });
4467
- return response.data || response.result || [];
4477
+ return normalizeProcessTasks(response.data || response.result);
4468
4478
  }
4469
4479
  async function checkUserApproval(request, formInstId) {
4470
4480
  const response = await request({
@@ -5066,6 +5076,75 @@ function useFieldPermission(options) {
5066
5076
 
5067
5077
  // src/hooks/useFormDetail.ts
5068
5078
  var import_react45 = require("react");
5079
+
5080
+ // src/utils/formInstanceData.ts
5081
+ var FORM_INSTANCE_METADATA_KEYS = /* @__PURE__ */ new Set([
5082
+ "appType",
5083
+ "code",
5084
+ "createdAt",
5085
+ "createdBy",
5086
+ "createdByDepartmentId",
5087
+ "createdByDepartmentName",
5088
+ "createdByName",
5089
+ "creator",
5090
+ "data",
5091
+ "error",
5092
+ "formInstId",
5093
+ "formInstanceId",
5094
+ "formUuid",
5095
+ "instanceTitle",
5096
+ "message",
5097
+ "result",
5098
+ "success",
5099
+ "title",
5100
+ "updatedAt"
5101
+ ]);
5102
+ var isPlainRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
5103
+ var parseJsonRecord = (value) => {
5104
+ if (typeof value !== "string" || value.trim() === "") return null;
5105
+ try {
5106
+ const parsed = JSON.parse(value);
5107
+ return isPlainRecord(parsed) ? parsed : null;
5108
+ } catch {
5109
+ return null;
5110
+ }
5111
+ };
5112
+ var pickKnownFields = (source, fieldIds) => {
5113
+ if (fieldIds?.length) {
5114
+ const values = {};
5115
+ for (const fieldId of fieldIds) {
5116
+ if (Object.prototype.hasOwnProperty.call(source, fieldId)) {
5117
+ values[fieldId] = source[fieldId];
5118
+ }
5119
+ }
5120
+ return values;
5121
+ }
5122
+ return Object.fromEntries(
5123
+ Object.entries(source).filter(([key]) => !FORM_INSTANCE_METADATA_KEYS.has(key))
5124
+ );
5125
+ };
5126
+ var extractFormValues = (formInstance, fieldIds) => {
5127
+ if (!isPlainRecord(formInstance)) return null;
5128
+ const nestedCandidates = [
5129
+ formInstance.data,
5130
+ parseJsonRecord(formInstance.data),
5131
+ formInstance.formData,
5132
+ parseJsonRecord(formInstance.formData),
5133
+ formInstance.values,
5134
+ formInstance.fieldValues,
5135
+ parseJsonRecord(formInstance.formDataJson),
5136
+ parseJsonRecord(formInstance.dataJson)
5137
+ ];
5138
+ for (const candidate of nestedCandidates) {
5139
+ if (isPlainRecord(candidate)) {
5140
+ return pickKnownFields(candidate, fieldIds);
5141
+ }
5142
+ }
5143
+ const flatValues = pickKnownFields(formInstance, fieldIds);
5144
+ return Object.keys(flatValues).length > 0 ? flatValues : null;
5145
+ };
5146
+
5147
+ // src/hooks/useFormDetail.ts
5069
5148
  function buildFieldBehaviors(permissions, mode) {
5070
5149
  const behaviors = {};
5071
5150
  if (!permissions) return behaviors;
@@ -5081,7 +5160,7 @@ function buildFieldBehaviors(permissions, mode) {
5081
5160
  return behaviors;
5082
5161
  }
5083
5162
  function useFormDetail(options) {
5084
- const { formUuid, appType, formInstanceId, onPermissionDenied } = options;
5163
+ const { formUuid, appType, formInstanceId, fieldIds, onPermissionDenied } = options;
5085
5164
  const { api } = useFormContext();
5086
5165
  const request = api.request;
5087
5166
  const [loading, setLoading] = (0, import_react45.useState)(true);
@@ -5110,7 +5189,7 @@ function useFormDetail(options) {
5110
5189
  }
5111
5190
  setPermissions(permResult);
5112
5191
  setInstanceInfo(formResult);
5113
- setFormData(formResult?.data ?? null);
5192
+ setFormData(extractFormValues(formResult, fieldIds));
5114
5193
  } catch (error) {
5115
5194
  console.error("[useFormDetail] Failed to load data:", error);
5116
5195
  if (mountedRef.current) {
@@ -5123,7 +5202,7 @@ function useFormDetail(options) {
5123
5202
  setLoading(false);
5124
5203
  }
5125
5204
  }
5126
- }, [request, formUuid, appType, formInstanceId, onPermissionDenied]);
5205
+ }, [request, formUuid, appType, formInstanceId, fieldIds, onPermissionDenied]);
5127
5206
  (0, import_react45.useEffect)(() => {
5128
5207
  loadData();
5129
5208
  }, [loadData]);
@@ -5188,7 +5267,7 @@ function useFormDetail(options) {
5188
5267
  // src/hooks/useProcessDetail.ts
5189
5268
  var import_react46 = require("react");
5190
5269
  function useProcessDetail(options) {
5191
- const { formUuid, appType, formInstanceId } = options;
5270
+ const { formUuid, appType, formInstanceId, fieldIds } = options;
5192
5271
  const { api } = useFormContext();
5193
5272
  const request = api.request;
5194
5273
  const [loading, setLoading] = (0, import_react46.useState)(true);
@@ -5236,7 +5315,7 @@ function useProcessDetail(options) {
5236
5315
  setCanWithdraw(approvalResult?.canUndo ?? false);
5237
5316
  setPermissions(permResult);
5238
5317
  setInstanceInfo(formResult);
5239
- setFormData(formResult?.data ?? null);
5318
+ setFormData(extractFormValues(formResult, fieldIds));
5240
5319
  if (permResult?.operations?.includes("VIEW_PROCESS") || permResult?.operations?.length > 0) {
5241
5320
  try {
5242
5321
  const progress = await getProcessProgress(request, formInstanceId);
@@ -5270,7 +5349,7 @@ function useProcessDetail(options) {
5270
5349
  setLoading(false);
5271
5350
  }
5272
5351
  }
5273
- }, [request, formUuid, appType, formInstanceId]);
5352
+ }, [request, formUuid, appType, formInstanceId, fieldIds]);
5274
5353
  (0, import_react46.useEffect)(() => {
5275
5354
  loadData();
5276
5355
  }, [loadData]);
@@ -5989,15 +6068,16 @@ var ApprovalTimeline = ({
5989
6068
  showRemarks = true,
5990
6069
  compactMode = false
5991
6070
  }) => {
5992
- if (!tasks || tasks.length === 0) {
6071
+ const taskList = Array.isArray(tasks) ? tasks : [];
6072
+ if (taskList.length === 0) {
5993
6073
  return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: `bg-white rounded-xl shadow-sm border border-gray-100 p-6 ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("p", { className: "text-sm text-gray-400 text-center", children: "\u6682\u65E0\u5BA1\u6279\u8BB0\u5F55" }) });
5994
6074
  }
5995
- return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: `${className}`, children: tasks.map((task, index) => {
6075
+ return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: `${className}`, children: taskList.map((task, index) => {
5996
6076
  if (renderNode) {
5997
6077
  return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { children: renderNode(task, index) }, task.taskId);
5998
6078
  }
5999
6079
  const phase = getNodePhase(task);
6000
- const isLast = index === tasks.length - 1;
6080
+ const isLast = index === taskList.length - 1;
6001
6081
  const statusMeta = TASK_STATUS_META[task.status];
6002
6082
  return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex gap-4", children: [
6003
6083
  /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex flex-col items-center", children: [
@@ -6727,6 +6807,7 @@ var InnerDetailContent = ({
6727
6807
  onDelete,
6728
6808
  onSave
6729
6809
  }) => {
6810
+ const fieldIds = (0, import_react55.useMemo)(() => schema.fields.map((field) => field.fieldId), [schema.fields]);
6730
6811
  const {
6731
6812
  loading,
6732
6813
  mode,
@@ -6740,7 +6821,7 @@ var InnerDetailContent = ({
6740
6821
  canEdit,
6741
6822
  canDelete,
6742
6823
  canViewChangeRecords
6743
- } = useFormDetail({ formUuid, appType, formInstanceId });
6824
+ } = useFormDetail({ formUuid, appType, formInstanceId, fieldIds });
6744
6825
  const {
6745
6826
  records,
6746
6827
  loading: recordsLoading,
@@ -6873,6 +6954,7 @@ var InnerProcessContent = ({
6873
6954
  onActionComplete
6874
6955
  }) => {
6875
6956
  const formDataRef = (0, import_react56.useRef)(void 0);
6957
+ const fieldIds = (0, import_react56.useMemo)(() => schema.fields.map((field) => field.fieldId), [schema.fields]);
6876
6958
  const {
6877
6959
  loading,
6878
6960
  processInfo,
@@ -6889,7 +6971,7 @@ var InnerProcessContent = ({
6889
6971
  switchToEdit,
6890
6972
  switchToReadonly,
6891
6973
  refreshProgress
6892
- } = useProcessDetail({ formUuid, appType, formInstanceId });
6974
+ } = useProcessDetail({ formUuid, appType, formInstanceId, fieldIds });
6893
6975
  const { approve, reject, withdraw, save, resubmit } = useApprovalActions({
6894
6976
  formInstanceId,
6895
6977
  formUuid,
@@ -7089,6 +7171,7 @@ var ProcessDetailTemplate = (props) => {
7089
7171
  defineFormSchema,
7090
7172
  deleteFormData,
7091
7173
  evaluateEffects,
7174
+ extractFormValues,
7092
7175
  getChangeRecords,
7093
7176
  getFormData,
7094
7177
  getProcessBasic,