sy-form-components 0.2.1 → 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 +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +149 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +150 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -93,6 +93,9 @@ interface FormEngineConfig {
|
|
|
93
93
|
redirectUrl?: string;
|
|
94
94
|
};
|
|
95
95
|
api?: FormRuntimeApiConfig;
|
|
96
|
+
navigation?: {
|
|
97
|
+
basePath?: string;
|
|
98
|
+
};
|
|
96
99
|
effects?: FormEffect[];
|
|
97
100
|
}
|
|
98
101
|
/** 字段联动效果 */
|
|
@@ -891,6 +894,7 @@ interface UseFormDetailOptions {
|
|
|
891
894
|
formUuid: string;
|
|
892
895
|
appType: string;
|
|
893
896
|
formInstanceId: string;
|
|
897
|
+
fieldIds?: readonly string[];
|
|
894
898
|
onPermissionDenied?: () => void;
|
|
895
899
|
}
|
|
896
900
|
interface UseFormDetailReturn {
|
|
@@ -918,6 +922,7 @@ interface UseProcessDetailOptions {
|
|
|
918
922
|
formUuid: string;
|
|
919
923
|
appType: string;
|
|
920
924
|
formInstanceId: string;
|
|
925
|
+
fieldIds?: readonly string[];
|
|
921
926
|
}
|
|
922
927
|
interface UseProcessDetailReturn {
|
|
923
928
|
loading: boolean;
|
|
@@ -996,6 +1001,7 @@ interface UseFormNavigationOptions {
|
|
|
996
1001
|
formType?: 'form' | 'process';
|
|
997
1002
|
mode?: 'redirect' | 'stay' | 'callback';
|
|
998
1003
|
redirectDelay?: number;
|
|
1004
|
+
basePath?: string;
|
|
999
1005
|
onStay?: (formInstId: string) => void;
|
|
1000
1006
|
}
|
|
1001
1007
|
interface UseFormNavigationReturn {
|
|
@@ -1006,9 +1012,6 @@ interface UseFormNavigationReturn {
|
|
|
1006
1012
|
countdown: number;
|
|
1007
1013
|
cancelRedirect: () => void;
|
|
1008
1014
|
}
|
|
1009
|
-
/**
|
|
1010
|
-
* 页面导航 hook
|
|
1011
|
-
*/
|
|
1012
1015
|
declare function useFormNavigation(options: UseFormNavigationOptions): UseFormNavigationReturn;
|
|
1013
1016
|
|
|
1014
1017
|
interface UseDraftStorageOptions {
|
|
@@ -1036,6 +1039,8 @@ declare function useDraftStorage(options: UseDraftStorageOptions): UseDraftStora
|
|
|
1036
1039
|
*/
|
|
1037
1040
|
declare function defineFormSchema(schema: FormSchema): FormSchema;
|
|
1038
1041
|
|
|
1042
|
+
declare const extractFormValues: (formInstance: unknown, fieldIds?: readonly string[]) => Record<string, any> | null;
|
|
1043
|
+
|
|
1039
1044
|
interface FormSummaryCardProps {
|
|
1040
1045
|
title?: string;
|
|
1041
1046
|
formInstanceId?: string;
|
|
@@ -1188,4 +1193,4 @@ interface PageSkeletonProps {
|
|
|
1188
1193
|
}
|
|
1189
1194
|
declare const PageSkeleton: React__default.FC<PageSkeletonProps>;
|
|
1190
1195
|
|
|
1191
|
-
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
|
@@ -93,6 +93,9 @@ interface FormEngineConfig {
|
|
|
93
93
|
redirectUrl?: string;
|
|
94
94
|
};
|
|
95
95
|
api?: FormRuntimeApiConfig;
|
|
96
|
+
navigation?: {
|
|
97
|
+
basePath?: string;
|
|
98
|
+
};
|
|
96
99
|
effects?: FormEffect[];
|
|
97
100
|
}
|
|
98
101
|
/** 字段联动效果 */
|
|
@@ -891,6 +894,7 @@ interface UseFormDetailOptions {
|
|
|
891
894
|
formUuid: string;
|
|
892
895
|
appType: string;
|
|
893
896
|
formInstanceId: string;
|
|
897
|
+
fieldIds?: readonly string[];
|
|
894
898
|
onPermissionDenied?: () => void;
|
|
895
899
|
}
|
|
896
900
|
interface UseFormDetailReturn {
|
|
@@ -918,6 +922,7 @@ interface UseProcessDetailOptions {
|
|
|
918
922
|
formUuid: string;
|
|
919
923
|
appType: string;
|
|
920
924
|
formInstanceId: string;
|
|
925
|
+
fieldIds?: readonly string[];
|
|
921
926
|
}
|
|
922
927
|
interface UseProcessDetailReturn {
|
|
923
928
|
loading: boolean;
|
|
@@ -996,6 +1001,7 @@ interface UseFormNavigationOptions {
|
|
|
996
1001
|
formType?: 'form' | 'process';
|
|
997
1002
|
mode?: 'redirect' | 'stay' | 'callback';
|
|
998
1003
|
redirectDelay?: number;
|
|
1004
|
+
basePath?: string;
|
|
999
1005
|
onStay?: (formInstId: string) => void;
|
|
1000
1006
|
}
|
|
1001
1007
|
interface UseFormNavigationReturn {
|
|
@@ -1006,9 +1012,6 @@ interface UseFormNavigationReturn {
|
|
|
1006
1012
|
countdown: number;
|
|
1007
1013
|
cancelRedirect: () => void;
|
|
1008
1014
|
}
|
|
1009
|
-
/**
|
|
1010
|
-
* 页面导航 hook
|
|
1011
|
-
*/
|
|
1012
1015
|
declare function useFormNavigation(options: UseFormNavigationOptions): UseFormNavigationReturn;
|
|
1013
1016
|
|
|
1014
1017
|
interface UseDraftStorageOptions {
|
|
@@ -1036,6 +1039,8 @@ declare function useDraftStorage(options: UseDraftStorageOptions): UseDraftStora
|
|
|
1036
1039
|
*/
|
|
1037
1040
|
declare function defineFormSchema(schema: FormSchema): FormSchema;
|
|
1038
1041
|
|
|
1042
|
+
declare const extractFormValues: (formInstance: unknown, fieldIds?: readonly string[]) => Record<string, any> | null;
|
|
1043
|
+
|
|
1039
1044
|
interface FormSummaryCardProps {
|
|
1040
1045
|
title?: string;
|
|
1041
1046
|
formInstanceId?: string;
|
|
@@ -1188,4 +1193,4 @@ interface PageSkeletonProps {
|
|
|
1188
1193
|
}
|
|
1189
1194
|
declare const PageSkeleton: React__default.FC<PageSkeletonProps>;
|
|
1190
1195
|
|
|
1191
|
-
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,
|
|
@@ -3793,7 +3794,12 @@ var CHUNK_UPLOAD_THRESHOLD = 10 * 1024 * 1024;
|
|
|
3793
3794
|
var trimTrailingSlash = (value) => String(value || "").replace(/\/$/, "");
|
|
3794
3795
|
var getDefaultBaseUrl = () => {
|
|
3795
3796
|
const globalEnv = globalThis.process?.env;
|
|
3796
|
-
|
|
3797
|
+
const envBaseUrl = globalEnv?.FORM_API_BASE_URL || globalEnv?.BASE_API_URL;
|
|
3798
|
+
if (envBaseUrl) return trimTrailingSlash(envBaseUrl);
|
|
3799
|
+
const browserGlobal = typeof window !== "undefined" ? window : void 0;
|
|
3800
|
+
const windowBaseUrl = browserGlobal?.FORM_API_BASE_URL || browserGlobal?.BASE_API_URL || browserGlobal?.__FORM_API_BASE_URL__ || browserGlobal?.__LOWCODE_API_BASE_URL__;
|
|
3801
|
+
if (windowBaseUrl) return trimTrailingSlash(windowBaseUrl);
|
|
3802
|
+
return typeof window !== "undefined" ? "/service" : "";
|
|
3797
3803
|
};
|
|
3798
3804
|
var appendQuery = (url, params) => {
|
|
3799
3805
|
if (!params) return url;
|
|
@@ -5061,6 +5067,75 @@ function useFieldPermission(options) {
|
|
|
5061
5067
|
|
|
5062
5068
|
// src/hooks/useFormDetail.ts
|
|
5063
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
|
|
5064
5139
|
function buildFieldBehaviors(permissions, mode) {
|
|
5065
5140
|
const behaviors = {};
|
|
5066
5141
|
if (!permissions) return behaviors;
|
|
@@ -5076,7 +5151,7 @@ function buildFieldBehaviors(permissions, mode) {
|
|
|
5076
5151
|
return behaviors;
|
|
5077
5152
|
}
|
|
5078
5153
|
function useFormDetail(options) {
|
|
5079
|
-
const { formUuid, appType, formInstanceId, onPermissionDenied } = options;
|
|
5154
|
+
const { formUuid, appType, formInstanceId, fieldIds, onPermissionDenied } = options;
|
|
5080
5155
|
const { api } = useFormContext();
|
|
5081
5156
|
const request = api.request;
|
|
5082
5157
|
const [loading, setLoading] = (0, import_react45.useState)(true);
|
|
@@ -5105,7 +5180,7 @@ function useFormDetail(options) {
|
|
|
5105
5180
|
}
|
|
5106
5181
|
setPermissions(permResult);
|
|
5107
5182
|
setInstanceInfo(formResult);
|
|
5108
|
-
setFormData(formResult
|
|
5183
|
+
setFormData(extractFormValues(formResult, fieldIds));
|
|
5109
5184
|
} catch (error) {
|
|
5110
5185
|
console.error("[useFormDetail] Failed to load data:", error);
|
|
5111
5186
|
if (mountedRef.current) {
|
|
@@ -5118,7 +5193,7 @@ function useFormDetail(options) {
|
|
|
5118
5193
|
setLoading(false);
|
|
5119
5194
|
}
|
|
5120
5195
|
}
|
|
5121
|
-
}, [request, formUuid, appType, formInstanceId, onPermissionDenied]);
|
|
5196
|
+
}, [request, formUuid, appType, formInstanceId, fieldIds, onPermissionDenied]);
|
|
5122
5197
|
(0, import_react45.useEffect)(() => {
|
|
5123
5198
|
loadData();
|
|
5124
5199
|
}, [loadData]);
|
|
@@ -5183,7 +5258,7 @@ function useFormDetail(options) {
|
|
|
5183
5258
|
// src/hooks/useProcessDetail.ts
|
|
5184
5259
|
var import_react46 = require("react");
|
|
5185
5260
|
function useProcessDetail(options) {
|
|
5186
|
-
const { formUuid, appType, formInstanceId } = options;
|
|
5261
|
+
const { formUuid, appType, formInstanceId, fieldIds } = options;
|
|
5187
5262
|
const { api } = useFormContext();
|
|
5188
5263
|
const request = api.request;
|
|
5189
5264
|
const [loading, setLoading] = (0, import_react46.useState)(true);
|
|
@@ -5231,7 +5306,7 @@ function useProcessDetail(options) {
|
|
|
5231
5306
|
setCanWithdraw(approvalResult?.canUndo ?? false);
|
|
5232
5307
|
setPermissions(permResult);
|
|
5233
5308
|
setInstanceInfo(formResult);
|
|
5234
|
-
setFormData(formResult
|
|
5309
|
+
setFormData(extractFormValues(formResult, fieldIds));
|
|
5235
5310
|
if (permResult?.operations?.includes("VIEW_PROCESS") || permResult?.operations?.length > 0) {
|
|
5236
5311
|
try {
|
|
5237
5312
|
const progress = await getProcessProgress(request, formInstanceId);
|
|
@@ -5265,7 +5340,7 @@ function useProcessDetail(options) {
|
|
|
5265
5340
|
setLoading(false);
|
|
5266
5341
|
}
|
|
5267
5342
|
}
|
|
5268
|
-
}, [request, formUuid, appType, formInstanceId]);
|
|
5343
|
+
}, [request, formUuid, appType, formInstanceId, fieldIds]);
|
|
5269
5344
|
(0, import_react46.useEffect)(() => {
|
|
5270
5345
|
loadData();
|
|
5271
5346
|
}, [loadData]);
|
|
@@ -5602,6 +5677,22 @@ function useChangeRecords(options) {
|
|
|
5602
5677
|
|
|
5603
5678
|
// src/hooks/useFormNavigation.ts
|
|
5604
5679
|
var import_react49 = require("react");
|
|
5680
|
+
var normalizeBasePath = (basePath) => {
|
|
5681
|
+
const normalized = String(basePath || "").replace(/^\/+|\/+$/g, "");
|
|
5682
|
+
return normalized ? `/${normalized}` : "";
|
|
5683
|
+
};
|
|
5684
|
+
var inferBasePath = (appType) => {
|
|
5685
|
+
if (typeof window === "undefined") return "";
|
|
5686
|
+
const pathname = window.location?.pathname || "";
|
|
5687
|
+
const marker = `/${appType}/`;
|
|
5688
|
+
const markerIndex = pathname.indexOf(marker);
|
|
5689
|
+
if (markerIndex <= 0) return "";
|
|
5690
|
+
return pathname.slice(0, markerIndex);
|
|
5691
|
+
};
|
|
5692
|
+
var buildDetailUrl = (appType, formUuid, formInstId, detailType, basePath) => {
|
|
5693
|
+
const prefix = normalizeBasePath(basePath ?? inferBasePath(appType));
|
|
5694
|
+
return `${prefix}/${appType}/${detailType}/${formUuid}?formInstId=${encodeURIComponent(formInstId)}`;
|
|
5695
|
+
};
|
|
5605
5696
|
function useFormNavigation(options) {
|
|
5606
5697
|
const {
|
|
5607
5698
|
appType,
|
|
@@ -5609,6 +5700,7 @@ function useFormNavigation(options) {
|
|
|
5609
5700
|
formType = "form",
|
|
5610
5701
|
mode = "redirect",
|
|
5611
5702
|
redirectDelay = 3e3,
|
|
5703
|
+
basePath,
|
|
5612
5704
|
onStay
|
|
5613
5705
|
} = options;
|
|
5614
5706
|
const [isRedirecting, setIsRedirecting] = (0, import_react49.useState)(false);
|
|
@@ -5628,15 +5720,21 @@ function useFormNavigation(options) {
|
|
|
5628
5720
|
}, []);
|
|
5629
5721
|
const navigateToDetail = (0, import_react49.useCallback)(
|
|
5630
5722
|
(formInstId) => {
|
|
5631
|
-
window.location.href =
|
|
5723
|
+
window.location.href = buildDetailUrl(appType, formUuid, formInstId, "formDetail", basePath);
|
|
5632
5724
|
},
|
|
5633
|
-
[appType, formUuid]
|
|
5725
|
+
[appType, basePath, formUuid]
|
|
5634
5726
|
);
|
|
5635
5727
|
const navigateToProcessDetail = (0, import_react49.useCallback)(
|
|
5636
5728
|
(formInstId) => {
|
|
5637
|
-
window.location.href =
|
|
5729
|
+
window.location.href = buildDetailUrl(
|
|
5730
|
+
appType,
|
|
5731
|
+
formUuid,
|
|
5732
|
+
formInstId,
|
|
5733
|
+
"processDetail",
|
|
5734
|
+
basePath
|
|
5735
|
+
);
|
|
5638
5736
|
},
|
|
5639
|
-
[appType, formUuid]
|
|
5737
|
+
[appType, basePath, formUuid]
|
|
5640
5738
|
);
|
|
5641
5739
|
const startRedirectCountdown = (0, import_react49.useCallback)(
|
|
5642
5740
|
(targetUrl) => {
|
|
@@ -5690,10 +5788,16 @@ function useFormNavigation(options) {
|
|
|
5690
5788
|
onStay?.(formInstId);
|
|
5691
5789
|
return;
|
|
5692
5790
|
}
|
|
5693
|
-
const targetUrl =
|
|
5791
|
+
const targetUrl = buildDetailUrl(
|
|
5792
|
+
appType,
|
|
5793
|
+
formUuid,
|
|
5794
|
+
formInstId,
|
|
5795
|
+
formType === "process" ? "processDetail" : "formDetail",
|
|
5796
|
+
basePath
|
|
5797
|
+
);
|
|
5694
5798
|
startRedirectCountdown(targetUrl);
|
|
5695
5799
|
},
|
|
5696
|
-
[mode, formType, appType, formUuid, onStay, startRedirectCountdown]
|
|
5800
|
+
[mode, formType, appType, formUuid, basePath, onStay, startRedirectCountdown]
|
|
5697
5801
|
);
|
|
5698
5802
|
return {
|
|
5699
5803
|
navigateToDetail,
|
|
@@ -6371,6 +6475,12 @@ var import_react54 = require("react");
|
|
|
6371
6475
|
var import_antd27 = require("antd");
|
|
6372
6476
|
var import_icons5 = require("@ant-design/icons");
|
|
6373
6477
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
6478
|
+
var pickFormInstanceId = (value) => {
|
|
6479
|
+
if (!value) return void 0;
|
|
6480
|
+
if (typeof value === "string") return value;
|
|
6481
|
+
if (typeof value !== "object") return void 0;
|
|
6482
|
+
return value.formInstanceId || value.formInstId || value.instanceId || value.id || pickFormInstanceId(value.result) || pickFormInstanceId(value.data);
|
|
6483
|
+
};
|
|
6374
6484
|
var SubmitSuccessCard = ({
|
|
6375
6485
|
info,
|
|
6376
6486
|
mode,
|
|
@@ -6420,7 +6530,7 @@ var InnerFormContent = ({
|
|
|
6420
6530
|
renderSuccess,
|
|
6421
6531
|
onSubmitSuccess
|
|
6422
6532
|
}) => {
|
|
6423
|
-
const { validateAll, getFormData: getFormData2, resetForm } = useFormContext();
|
|
6533
|
+
const { validateAll, getFormData: getFormData2, resetForm, api } = useFormContext();
|
|
6424
6534
|
const [submitted, setSubmitted] = (0, import_react54.useState)(false);
|
|
6425
6535
|
const [successInfo, setSuccessInfo] = (0, import_react54.useState)(null);
|
|
6426
6536
|
const [submitting, setSubmitting] = (0, import_react54.useState)(false);
|
|
@@ -6432,7 +6542,8 @@ var InnerFormContent = ({
|
|
|
6432
6542
|
appType: config.appType,
|
|
6433
6543
|
formUuid: config.formUuid,
|
|
6434
6544
|
formType,
|
|
6435
|
-
mode: submitSuccessMode === "continue" ? "stay" : submitSuccessMode
|
|
6545
|
+
mode: submitSuccessMode === "continue" ? "stay" : submitSuccessMode,
|
|
6546
|
+
basePath: config.navigation?.basePath
|
|
6436
6547
|
});
|
|
6437
6548
|
const handleSubmit = (0, import_react54.useCallback)(async () => {
|
|
6438
6549
|
const valid = await validateAll();
|
|
@@ -6447,9 +6558,24 @@ var InnerFormContent = ({
|
|
|
6447
6558
|
return;
|
|
6448
6559
|
}
|
|
6449
6560
|
}
|
|
6450
|
-
const
|
|
6561
|
+
const submitResponse = config.mode === "edit" && config.formInstanceId ? await api.updateFormData({
|
|
6562
|
+
appType: config.appType,
|
|
6563
|
+
formUuid: config.formUuid,
|
|
6564
|
+
formInstId: config.formInstanceId,
|
|
6565
|
+
formInstanceId: config.formInstanceId,
|
|
6566
|
+
updateFormDataJson: JSON.stringify(formData)
|
|
6567
|
+
}) : await api.submitFormData({
|
|
6568
|
+
appType: config.appType,
|
|
6569
|
+
formUuid: config.formUuid,
|
|
6570
|
+
data: formData
|
|
6571
|
+
});
|
|
6572
|
+
const formInstId = pickFormInstanceId(submitResponse) || config.formInstanceId || `inst_${Date.now()}`;
|
|
6451
6573
|
if (config.submit?.afterSubmit) {
|
|
6452
|
-
await config.submit.afterSubmit({
|
|
6574
|
+
await config.submit.afterSubmit({
|
|
6575
|
+
formInstanceId: formInstId,
|
|
6576
|
+
data: formData,
|
|
6577
|
+
response: submitResponse
|
|
6578
|
+
});
|
|
6453
6579
|
}
|
|
6454
6580
|
if (enableDraft) {
|
|
6455
6581
|
clearDraft();
|
|
@@ -6471,6 +6597,7 @@ var InnerFormContent = ({
|
|
|
6471
6597
|
validateAll,
|
|
6472
6598
|
getFormData2,
|
|
6473
6599
|
config,
|
|
6600
|
+
api,
|
|
6474
6601
|
enableDraft,
|
|
6475
6602
|
clearDraft,
|
|
6476
6603
|
onSubmitSuccess,
|
|
@@ -6670,6 +6797,7 @@ var InnerDetailContent = ({
|
|
|
6670
6797
|
onDelete,
|
|
6671
6798
|
onSave
|
|
6672
6799
|
}) => {
|
|
6800
|
+
const fieldIds = (0, import_react55.useMemo)(() => schema.fields.map((field) => field.fieldId), [schema.fields]);
|
|
6673
6801
|
const {
|
|
6674
6802
|
loading,
|
|
6675
6803
|
mode,
|
|
@@ -6683,7 +6811,7 @@ var InnerDetailContent = ({
|
|
|
6683
6811
|
canEdit,
|
|
6684
6812
|
canDelete,
|
|
6685
6813
|
canViewChangeRecords
|
|
6686
|
-
} = useFormDetail({ formUuid, appType, formInstanceId });
|
|
6814
|
+
} = useFormDetail({ formUuid, appType, formInstanceId, fieldIds });
|
|
6687
6815
|
const {
|
|
6688
6816
|
records,
|
|
6689
6817
|
loading: recordsLoading,
|
|
@@ -6816,6 +6944,7 @@ var InnerProcessContent = ({
|
|
|
6816
6944
|
onActionComplete
|
|
6817
6945
|
}) => {
|
|
6818
6946
|
const formDataRef = (0, import_react56.useRef)(void 0);
|
|
6947
|
+
const fieldIds = (0, import_react56.useMemo)(() => schema.fields.map((field) => field.fieldId), [schema.fields]);
|
|
6819
6948
|
const {
|
|
6820
6949
|
loading,
|
|
6821
6950
|
processInfo,
|
|
@@ -6832,7 +6961,7 @@ var InnerProcessContent = ({
|
|
|
6832
6961
|
switchToEdit,
|
|
6833
6962
|
switchToReadonly,
|
|
6834
6963
|
refreshProgress
|
|
6835
|
-
} = useProcessDetail({ formUuid, appType, formInstanceId });
|
|
6964
|
+
} = useProcessDetail({ formUuid, appType, formInstanceId, fieldIds });
|
|
6836
6965
|
const { approve, reject, withdraw, save, resubmit } = useApprovalActions({
|
|
6837
6966
|
formInstanceId,
|
|
6838
6967
|
formUuid,
|
|
@@ -7032,6 +7161,7 @@ var ProcessDetailTemplate = (props) => {
|
|
|
7032
7161
|
defineFormSchema,
|
|
7033
7162
|
deleteFormData,
|
|
7034
7163
|
evaluateEffects,
|
|
7164
|
+
extractFormValues,
|
|
7035
7165
|
getChangeRecords,
|
|
7036
7166
|
getFormData,
|
|
7037
7167
|
getProcessBasic,
|