sy-form-components 0.2.2 → 0.2.3

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,
@@ -5066,6 +5067,75 @@ function useFieldPermission(options) {
5066
5067
 
5067
5068
  // src/hooks/useFormDetail.ts
5068
5069
  var import_react45 = require("react");
5070
+
5071
+ // src/utils/formInstanceData.ts
5072
+ var FORM_INSTANCE_METADATA_KEYS = /* @__PURE__ */ new Set([
5073
+ "appType",
5074
+ "code",
5075
+ "createdAt",
5076
+ "createdBy",
5077
+ "createdByDepartmentId",
5078
+ "createdByDepartmentName",
5079
+ "createdByName",
5080
+ "creator",
5081
+ "data",
5082
+ "error",
5083
+ "formInstId",
5084
+ "formInstanceId",
5085
+ "formUuid",
5086
+ "instanceTitle",
5087
+ "message",
5088
+ "result",
5089
+ "success",
5090
+ "title",
5091
+ "updatedAt"
5092
+ ]);
5093
+ var isPlainRecord = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
5094
+ var parseJsonRecord = (value) => {
5095
+ if (typeof value !== "string" || value.trim() === "") return null;
5096
+ try {
5097
+ const parsed = JSON.parse(value);
5098
+ return isPlainRecord(parsed) ? parsed : null;
5099
+ } catch {
5100
+ return null;
5101
+ }
5102
+ };
5103
+ var pickKnownFields = (source, fieldIds) => {
5104
+ if (fieldIds?.length) {
5105
+ const values = {};
5106
+ for (const fieldId of fieldIds) {
5107
+ if (Object.prototype.hasOwnProperty.call(source, fieldId)) {
5108
+ values[fieldId] = source[fieldId];
5109
+ }
5110
+ }
5111
+ return values;
5112
+ }
5113
+ return Object.fromEntries(
5114
+ Object.entries(source).filter(([key]) => !FORM_INSTANCE_METADATA_KEYS.has(key))
5115
+ );
5116
+ };
5117
+ var extractFormValues = (formInstance, fieldIds) => {
5118
+ if (!isPlainRecord(formInstance)) return null;
5119
+ const nestedCandidates = [
5120
+ formInstance.data,
5121
+ parseJsonRecord(formInstance.data),
5122
+ formInstance.formData,
5123
+ parseJsonRecord(formInstance.formData),
5124
+ formInstance.values,
5125
+ formInstance.fieldValues,
5126
+ parseJsonRecord(formInstance.formDataJson),
5127
+ parseJsonRecord(formInstance.dataJson)
5128
+ ];
5129
+ for (const candidate of nestedCandidates) {
5130
+ if (isPlainRecord(candidate)) {
5131
+ return pickKnownFields(candidate, fieldIds);
5132
+ }
5133
+ }
5134
+ const flatValues = pickKnownFields(formInstance, fieldIds);
5135
+ return Object.keys(flatValues).length > 0 ? flatValues : null;
5136
+ };
5137
+
5138
+ // src/hooks/useFormDetail.ts
5069
5139
  function buildFieldBehaviors(permissions, mode) {
5070
5140
  const behaviors = {};
5071
5141
  if (!permissions) return behaviors;
@@ -5081,7 +5151,7 @@ function buildFieldBehaviors(permissions, mode) {
5081
5151
  return behaviors;
5082
5152
  }
5083
5153
  function useFormDetail(options) {
5084
- const { formUuid, appType, formInstanceId, onPermissionDenied } = options;
5154
+ const { formUuid, appType, formInstanceId, fieldIds, onPermissionDenied } = options;
5085
5155
  const { api } = useFormContext();
5086
5156
  const request = api.request;
5087
5157
  const [loading, setLoading] = (0, import_react45.useState)(true);
@@ -5110,7 +5180,7 @@ function useFormDetail(options) {
5110
5180
  }
5111
5181
  setPermissions(permResult);
5112
5182
  setInstanceInfo(formResult);
5113
- setFormData(formResult?.data ?? null);
5183
+ setFormData(extractFormValues(formResult, fieldIds));
5114
5184
  } catch (error) {
5115
5185
  console.error("[useFormDetail] Failed to load data:", error);
5116
5186
  if (mountedRef.current) {
@@ -5123,7 +5193,7 @@ function useFormDetail(options) {
5123
5193
  setLoading(false);
5124
5194
  }
5125
5195
  }
5126
- }, [request, formUuid, appType, formInstanceId, onPermissionDenied]);
5196
+ }, [request, formUuid, appType, formInstanceId, fieldIds, onPermissionDenied]);
5127
5197
  (0, import_react45.useEffect)(() => {
5128
5198
  loadData();
5129
5199
  }, [loadData]);
@@ -5188,7 +5258,7 @@ function useFormDetail(options) {
5188
5258
  // src/hooks/useProcessDetail.ts
5189
5259
  var import_react46 = require("react");
5190
5260
  function useProcessDetail(options) {
5191
- const { formUuid, appType, formInstanceId } = options;
5261
+ const { formUuid, appType, formInstanceId, fieldIds } = options;
5192
5262
  const { api } = useFormContext();
5193
5263
  const request = api.request;
5194
5264
  const [loading, setLoading] = (0, import_react46.useState)(true);
@@ -5236,7 +5306,7 @@ function useProcessDetail(options) {
5236
5306
  setCanWithdraw(approvalResult?.canUndo ?? false);
5237
5307
  setPermissions(permResult);
5238
5308
  setInstanceInfo(formResult);
5239
- setFormData(formResult?.data ?? null);
5309
+ setFormData(extractFormValues(formResult, fieldIds));
5240
5310
  if (permResult?.operations?.includes("VIEW_PROCESS") || permResult?.operations?.length > 0) {
5241
5311
  try {
5242
5312
  const progress = await getProcessProgress(request, formInstanceId);
@@ -5270,7 +5340,7 @@ function useProcessDetail(options) {
5270
5340
  setLoading(false);
5271
5341
  }
5272
5342
  }
5273
- }, [request, formUuid, appType, formInstanceId]);
5343
+ }, [request, formUuid, appType, formInstanceId, fieldIds]);
5274
5344
  (0, import_react46.useEffect)(() => {
5275
5345
  loadData();
5276
5346
  }, [loadData]);
@@ -6727,6 +6797,7 @@ var InnerDetailContent = ({
6727
6797
  onDelete,
6728
6798
  onSave
6729
6799
  }) => {
6800
+ const fieldIds = (0, import_react55.useMemo)(() => schema.fields.map((field) => field.fieldId), [schema.fields]);
6730
6801
  const {
6731
6802
  loading,
6732
6803
  mode,
@@ -6740,7 +6811,7 @@ var InnerDetailContent = ({
6740
6811
  canEdit,
6741
6812
  canDelete,
6742
6813
  canViewChangeRecords
6743
- } = useFormDetail({ formUuid, appType, formInstanceId });
6814
+ } = useFormDetail({ formUuid, appType, formInstanceId, fieldIds });
6744
6815
  const {
6745
6816
  records,
6746
6817
  loading: recordsLoading,
@@ -6873,6 +6944,7 @@ var InnerProcessContent = ({
6873
6944
  onActionComplete
6874
6945
  }) => {
6875
6946
  const formDataRef = (0, import_react56.useRef)(void 0);
6947
+ const fieldIds = (0, import_react56.useMemo)(() => schema.fields.map((field) => field.fieldId), [schema.fields]);
6876
6948
  const {
6877
6949
  loading,
6878
6950
  processInfo,
@@ -6889,7 +6961,7 @@ var InnerProcessContent = ({
6889
6961
  switchToEdit,
6890
6962
  switchToReadonly,
6891
6963
  refreshProgress
6892
- } = useProcessDetail({ formUuid, appType, formInstanceId });
6964
+ } = useProcessDetail({ formUuid, appType, formInstanceId, fieldIds });
6893
6965
  const { approve, reject, withdraw, save, resubmit } = useApprovalActions({
6894
6966
  formInstanceId,
6895
6967
  formUuid,
@@ -7089,6 +7161,7 @@ var ProcessDetailTemplate = (props) => {
7089
7161
  defineFormSchema,
7090
7162
  deleteFormData,
7091
7163
  evaluateEffects,
7164
+ extractFormValues,
7092
7165
  getChangeRecords,
7093
7166
  getFormData,
7094
7167
  getProcessBasic,