sy-form-components 0.2.0 → 0.2.2
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/README.md +5 -5
- package/dist/index.d.mts +538 -1
- package/dist/index.d.ts +538 -1
- package/dist/index.js +2287 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2250 -14
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
#
|
|
1
|
+
# sy-form-components
|
|
2
2
|
|
|
3
3
|
SY 表单组件库 2.0 —— AI-First + 测试驱动的企业级表单解决方案。
|
|
4
4
|
|
|
5
5
|
## 安装
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install
|
|
8
|
+
npm install sy-form-components
|
|
9
9
|
# 或
|
|
10
|
-
pnpm add
|
|
10
|
+
pnpm add sy-form-components
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## 使用
|
|
14
14
|
|
|
15
15
|
```tsx
|
|
16
|
-
import { FormRenderer } from '
|
|
16
|
+
import { FormRenderer } from 'sy-form-components';
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Tailwind CSS 预设
|
|
@@ -22,7 +22,7 @@ import { FormRenderer } from '@sy/form-components';
|
|
|
22
22
|
|
|
23
23
|
```js
|
|
24
24
|
// tailwind.config.js
|
|
25
|
-
const formPreset = require('
|
|
25
|
+
const formPreset = require('sy-form-components/tailwind-preset');
|
|
26
26
|
|
|
27
27
|
module.exports = {
|
|
28
28
|
presets: [formPreset],
|
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
|
/** 字段联动效果 */
|
|
@@ -390,6 +393,192 @@ interface DigitalSignatureFieldProps extends BaseFieldProps {
|
|
|
390
393
|
interface JSONFieldProps extends BaseFieldProps {
|
|
391
394
|
defaultValue?: any;
|
|
392
395
|
}
|
|
396
|
+
/** 流程状态 */
|
|
397
|
+
type ProcessStatus = 'running' | 'waiting' | 'exception' | 'completed' | 'terminated' | 'withdrawn' | 'pending' | 'cancelled';
|
|
398
|
+
/** 任务状态 */
|
|
399
|
+
type TaskStatus = 'pending' | 'approved' | 'rejected' | 'returned' | 'suspended' | 'cancelled' | 'copied' | 'waiting' | 'simulated';
|
|
400
|
+
/** 流程任务节点类型 */
|
|
401
|
+
type ProcessNodeType = 'start' | 'approval' | 'copy' | 'end' | 'system' | 'originator_return' | 'callback_wait';
|
|
402
|
+
/** 审批操作类型 */
|
|
403
|
+
type ApprovalActionType = 'agree' | 'rejected' | 'transfer' | 'return' | 'save' | 'withdraw';
|
|
404
|
+
/** 流程操作动作定义 */
|
|
405
|
+
interface ProcessAction {
|
|
406
|
+
action: ApprovalActionType;
|
|
407
|
+
name: {
|
|
408
|
+
zh_CN: string;
|
|
409
|
+
en_US?: string;
|
|
410
|
+
};
|
|
411
|
+
remark?: {
|
|
412
|
+
popUp: boolean;
|
|
413
|
+
content?: {
|
|
414
|
+
zh_CN: string;
|
|
415
|
+
en_US?: string;
|
|
416
|
+
};
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
/** 流程任务 */
|
|
420
|
+
interface ProcessTask {
|
|
421
|
+
taskId: string;
|
|
422
|
+
nodeId: string;
|
|
423
|
+
nodeVisitId?: string;
|
|
424
|
+
nodeType: ProcessNodeType;
|
|
425
|
+
nodeName: string;
|
|
426
|
+
status: TaskStatus;
|
|
427
|
+
assigneeId?: string;
|
|
428
|
+
assigneeName?: string;
|
|
429
|
+
departmentName?: string;
|
|
430
|
+
comments?: string;
|
|
431
|
+
createdAt?: string;
|
|
432
|
+
actionAt?: string;
|
|
433
|
+
actions?: ProcessAction[];
|
|
434
|
+
}
|
|
435
|
+
/** 流程基本信息 */
|
|
436
|
+
interface ProcessBasicInfo {
|
|
437
|
+
instanceId: string;
|
|
438
|
+
processStatus: ProcessStatus;
|
|
439
|
+
formUuid: string;
|
|
440
|
+
appType: string;
|
|
441
|
+
title?: string;
|
|
442
|
+
originatorId: string;
|
|
443
|
+
originatorName: string;
|
|
444
|
+
originatorDepartment?: string;
|
|
445
|
+
createdAt: string;
|
|
446
|
+
currentTask?: ProcessTask;
|
|
447
|
+
}
|
|
448
|
+
/** 审批权限 */
|
|
449
|
+
interface ApprovalPermission {
|
|
450
|
+
hasPermission: boolean;
|
|
451
|
+
canUndo: boolean;
|
|
452
|
+
isApprover: boolean;
|
|
453
|
+
}
|
|
454
|
+
/** 可退回节点 */
|
|
455
|
+
interface ReturnableNode {
|
|
456
|
+
nodeId: string;
|
|
457
|
+
nodeName: string;
|
|
458
|
+
}
|
|
459
|
+
/** 流程预览路由 */
|
|
460
|
+
interface ProcessRoute {
|
|
461
|
+
nodeId: string;
|
|
462
|
+
nodeName: string;
|
|
463
|
+
nodeType: ProcessNodeType;
|
|
464
|
+
assignees: Array<{
|
|
465
|
+
id: string;
|
|
466
|
+
name: string;
|
|
467
|
+
}>;
|
|
468
|
+
}
|
|
469
|
+
/** 流程定义 */
|
|
470
|
+
interface ProcessDefinition {
|
|
471
|
+
processId: string;
|
|
472
|
+
flowConfig?: Record<string, Record<string, FieldBehavior>>;
|
|
473
|
+
startNodeId?: string;
|
|
474
|
+
}
|
|
475
|
+
/** 视图权限摘要 */
|
|
476
|
+
interface ViewPermissionSummary {
|
|
477
|
+
fieldPermissions: Record<string, 'FORM_FILED_HIDDEN' | 'FORM_FILED_VIEW' | 'FORM_FILED_EDIT'>;
|
|
478
|
+
operations: string[];
|
|
479
|
+
}
|
|
480
|
+
/** 表单实例数据 */
|
|
481
|
+
interface FormInstanceData {
|
|
482
|
+
formInstanceId: string;
|
|
483
|
+
formUuid: string;
|
|
484
|
+
appType: string;
|
|
485
|
+
title?: string;
|
|
486
|
+
data: Record<string, any>;
|
|
487
|
+
creator?: {
|
|
488
|
+
userId: string;
|
|
489
|
+
name: string;
|
|
490
|
+
avatar?: string;
|
|
491
|
+
department?: string;
|
|
492
|
+
};
|
|
493
|
+
createdAt: string;
|
|
494
|
+
updatedAt?: string;
|
|
495
|
+
}
|
|
496
|
+
/** 变更记录 */
|
|
497
|
+
interface ChangeRecord {
|
|
498
|
+
id: string;
|
|
499
|
+
fieldId: string;
|
|
500
|
+
fieldLabel: string;
|
|
501
|
+
oldValue: any;
|
|
502
|
+
newValue: any;
|
|
503
|
+
operatorId: string;
|
|
504
|
+
operatorName: string;
|
|
505
|
+
operatedAt: string;
|
|
506
|
+
}
|
|
507
|
+
/** 变更记录列表响应 */
|
|
508
|
+
interface ChangeRecordListResponse {
|
|
509
|
+
records: ChangeRecord[];
|
|
510
|
+
total: number;
|
|
511
|
+
page: number;
|
|
512
|
+
pageSize: number;
|
|
513
|
+
}
|
|
514
|
+
interface ApproveParams {
|
|
515
|
+
instanceId: string;
|
|
516
|
+
action: 'approved' | 'rejected';
|
|
517
|
+
comments?: string;
|
|
518
|
+
appType?: string;
|
|
519
|
+
formUuid?: string;
|
|
520
|
+
updateFormDataJson?: string;
|
|
521
|
+
}
|
|
522
|
+
interface TransferParams {
|
|
523
|
+
taskId: string;
|
|
524
|
+
newAssignee: string;
|
|
525
|
+
reason?: string;
|
|
526
|
+
}
|
|
527
|
+
interface ReturnParams {
|
|
528
|
+
taskId: string;
|
|
529
|
+
targetNodeId: string;
|
|
530
|
+
reason?: string;
|
|
531
|
+
}
|
|
532
|
+
interface WithdrawParams {
|
|
533
|
+
instanceId: string;
|
|
534
|
+
reason?: string;
|
|
535
|
+
}
|
|
536
|
+
interface SaveTaskParams {
|
|
537
|
+
instanceId: string;
|
|
538
|
+
formUuid: string;
|
|
539
|
+
appType: string;
|
|
540
|
+
updateFormDataJson: string;
|
|
541
|
+
}
|
|
542
|
+
interface ResubmitParams {
|
|
543
|
+
taskId: string;
|
|
544
|
+
formUuid: string;
|
|
545
|
+
appType: string;
|
|
546
|
+
updateFormDataJson: string;
|
|
547
|
+
comments?: string;
|
|
548
|
+
}
|
|
549
|
+
interface PreviewParams {
|
|
550
|
+
formUuid: string;
|
|
551
|
+
appType: string;
|
|
552
|
+
data: Record<string, any>;
|
|
553
|
+
submissionDepartmentId?: string;
|
|
554
|
+
}
|
|
555
|
+
interface FormDataQueryParams {
|
|
556
|
+
formInstanceId: string;
|
|
557
|
+
appType: string;
|
|
558
|
+
formUuid: string;
|
|
559
|
+
}
|
|
560
|
+
interface FormDataDeleteParams {
|
|
561
|
+
formInstanceId: string;
|
|
562
|
+
appType: string;
|
|
563
|
+
formUuid: string;
|
|
564
|
+
}
|
|
565
|
+
interface ChangeRecordQueryParams {
|
|
566
|
+
formUuid: string;
|
|
567
|
+
appType: string;
|
|
568
|
+
formInstanceId: string;
|
|
569
|
+
page?: number;
|
|
570
|
+
pageSize?: number;
|
|
571
|
+
}
|
|
572
|
+
interface ViewPermissionQueryParams {
|
|
573
|
+
formUuid: string;
|
|
574
|
+
appType: string;
|
|
575
|
+
formInstanceId?: string;
|
|
576
|
+
}
|
|
577
|
+
/** 状态元信息(用于 UI 渲染) */
|
|
578
|
+
interface StatusMeta {
|
|
579
|
+
label: string;
|
|
580
|
+
tone: 'brand' | 'success' | 'danger' | 'neutral' | 'warning';
|
|
581
|
+
}
|
|
393
582
|
|
|
394
583
|
interface FormContextValue {
|
|
395
584
|
mode: 'submit' | 'edit' | 'readonly';
|
|
@@ -493,6 +682,44 @@ declare function FormContainer({ title, description, children, maxWidth, classNa
|
|
|
493
682
|
|
|
494
683
|
declare function createFormRuntimeApi(config?: FormRuntimeApiConfig): FormRuntimeApi;
|
|
495
684
|
|
|
685
|
+
/** 流程状态元映射 */
|
|
686
|
+
declare const PROCESS_STATUS_META: Record<ProcessStatus, StatusMeta>;
|
|
687
|
+
/** 任务状态元映射 */
|
|
688
|
+
declare const TASK_STATUS_META: Record<TaskStatus, StatusMeta>;
|
|
689
|
+
|
|
690
|
+
/** 获取流程基本信息 */
|
|
691
|
+
declare function getProcessBasic(request: FormRuntimeApi['request'], formInstId: string): Promise<ProcessBasicInfo>;
|
|
692
|
+
/** 获取流程进度(任务列表) */
|
|
693
|
+
declare function getProcessProgress(request: FormRuntimeApi['request'], formInstId: string): Promise<ProcessTask[]>;
|
|
694
|
+
/** 检查当前用户审批权限 */
|
|
695
|
+
declare function checkUserApproval(request: FormRuntimeApi['request'], formInstId: string): Promise<ApprovalPermission>;
|
|
696
|
+
/** 审批(同意/拒绝) */
|
|
697
|
+
declare function handleApproval(request: FormRuntimeApi['request'], params: ApproveParams): Promise<any>;
|
|
698
|
+
/** 撤销流程 */
|
|
699
|
+
declare function withdrawProcess(request: FormRuntimeApi['request'], params: WithdrawParams): Promise<any>;
|
|
700
|
+
/** 转交任务 */
|
|
701
|
+
declare function transferTask(request: FormRuntimeApi['request'], params: TransferParams): Promise<any>;
|
|
702
|
+
/** 退回任务 */
|
|
703
|
+
declare function returnTask(request: FormRuntimeApi['request'], params: ReturnParams): Promise<any>;
|
|
704
|
+
/** 重新提交任务 */
|
|
705
|
+
declare function resubmitTask(request: FormRuntimeApi['request'], params: ResubmitParams): Promise<any>;
|
|
706
|
+
/** 暂存任务 */
|
|
707
|
+
declare function saveTask(request: FormRuntimeApi['request'], params: SaveTaskParams): Promise<any>;
|
|
708
|
+
/** 获取可退回节点 */
|
|
709
|
+
declare function getReturnableNodes(request: FormRuntimeApi['request'], taskId: string): Promise<ReturnableNode[]>;
|
|
710
|
+
/** 预览流程路由 */
|
|
711
|
+
declare function previewProcess(request: FormRuntimeApi['request'], params: PreviewParams): Promise<ProcessRoute[]>;
|
|
712
|
+
/** 获取流程定义 */
|
|
713
|
+
declare function getProcessDefinition(request: FormRuntimeApi['request'], formUuid: string): Promise<ProcessDefinition>;
|
|
714
|
+
/** 获取表单实例数据 */
|
|
715
|
+
declare function getFormData(request: FormRuntimeApi['request'], params: FormDataQueryParams): Promise<FormInstanceData>;
|
|
716
|
+
/** 删除表单数据 */
|
|
717
|
+
declare function deleteFormData(request: FormRuntimeApi['request'], params: FormDataDeleteParams): Promise<any>;
|
|
718
|
+
/** 获取表单变更记录 */
|
|
719
|
+
declare function getChangeRecords(request: FormRuntimeApi['request'], params: ChangeRecordQueryParams): Promise<ChangeRecordListResponse>;
|
|
720
|
+
/** 获取视图权限摘要 */
|
|
721
|
+
declare function getViewPermission(request: FormRuntimeApi['request'], params: ViewPermissionQueryParams): Promise<ViewPermissionSummary>;
|
|
722
|
+
|
|
496
723
|
declare function TextField(props: TextFieldProps): react_jsx_runtime.JSX.Element | null;
|
|
497
724
|
|
|
498
725
|
declare function NumberField(props: NumberFieldProps): react_jsx_runtime.JSX.Element | null;
|
|
@@ -646,10 +873,320 @@ interface DeviceDetectResult {
|
|
|
646
873
|
}
|
|
647
874
|
declare function useDeviceDetect(): DeviceDetectResult;
|
|
648
875
|
|
|
876
|
+
interface UseFieldPermissionOptions {
|
|
877
|
+
viewPermissions?: ViewPermissionSummary;
|
|
878
|
+
processDefinition?: ProcessDefinition;
|
|
879
|
+
currentTask?: ProcessTask;
|
|
880
|
+
isApprover?: boolean;
|
|
881
|
+
mode: 'readonly' | 'edit';
|
|
882
|
+
}
|
|
883
|
+
interface UseFieldPermissionReturn {
|
|
884
|
+
fieldBehaviors: Record<string, FieldBehavior>;
|
|
885
|
+
computeBehaviors: () => Record<string, FieldBehavior>;
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* 字段权限计算 hook
|
|
889
|
+
* 根据不同场景(普通详情、流程审批等)计算字段行为映射
|
|
890
|
+
*/
|
|
891
|
+
declare function useFieldPermission(options: UseFieldPermissionOptions): UseFieldPermissionReturn;
|
|
892
|
+
|
|
893
|
+
interface UseFormDetailOptions {
|
|
894
|
+
formUuid: string;
|
|
895
|
+
appType: string;
|
|
896
|
+
formInstanceId: string;
|
|
897
|
+
onPermissionDenied?: () => void;
|
|
898
|
+
}
|
|
899
|
+
interface UseFormDetailReturn {
|
|
900
|
+
loading: boolean;
|
|
901
|
+
mode: 'readonly' | 'edit';
|
|
902
|
+
formData: Record<string, any> | null;
|
|
903
|
+
instanceInfo: FormInstanceData | null;
|
|
904
|
+
permissions: ViewPermissionSummary | null;
|
|
905
|
+
fieldBehaviors: Record<string, FieldBehavior>;
|
|
906
|
+
switchToEdit: () => void;
|
|
907
|
+
switchToReadonly: () => void;
|
|
908
|
+
saveChanges: (values: Record<string, any>) => Promise<boolean>;
|
|
909
|
+
deleteInstance: () => Promise<boolean>;
|
|
910
|
+
canEdit: boolean;
|
|
911
|
+
canDelete: boolean;
|
|
912
|
+
canViewChangeRecords: boolean;
|
|
913
|
+
}
|
|
914
|
+
/**
|
|
915
|
+
* 详情页核心逻辑 hook
|
|
916
|
+
* 处理数据加载、权限计算、模式切换、保存和删除
|
|
917
|
+
*/
|
|
918
|
+
declare function useFormDetail(options: UseFormDetailOptions): UseFormDetailReturn;
|
|
919
|
+
|
|
920
|
+
interface UseProcessDetailOptions {
|
|
921
|
+
formUuid: string;
|
|
922
|
+
appType: string;
|
|
923
|
+
formInstanceId: string;
|
|
924
|
+
}
|
|
925
|
+
interface UseProcessDetailReturn {
|
|
926
|
+
loading: boolean;
|
|
927
|
+
processInfo: ProcessBasicInfo | null;
|
|
928
|
+
processStatus: ProcessStatus | null;
|
|
929
|
+
currentTask: ProcessTask | null;
|
|
930
|
+
progressList: ProcessTask[];
|
|
931
|
+
formData: Record<string, any> | null;
|
|
932
|
+
instanceInfo: FormInstanceData | null;
|
|
933
|
+
isApprover: boolean;
|
|
934
|
+
activeActions: ProcessAction[];
|
|
935
|
+
fieldBehaviors: Record<string, FieldBehavior>;
|
|
936
|
+
mode: 'readonly' | 'edit';
|
|
937
|
+
isOriginatorReturn: boolean;
|
|
938
|
+
isProcessCompleted: boolean;
|
|
939
|
+
canWithdraw: boolean;
|
|
940
|
+
switchToEdit: () => void;
|
|
941
|
+
switchToReadonly: () => void;
|
|
942
|
+
refreshProgress: () => Promise<void>;
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* 流程详情核心逻辑 hook
|
|
946
|
+
*/
|
|
947
|
+
declare function useProcessDetail(options: UseProcessDetailOptions): UseProcessDetailReturn;
|
|
948
|
+
|
|
949
|
+
interface UseApprovalActionsOptions {
|
|
950
|
+
formInstanceId: string;
|
|
951
|
+
formUuid: string;
|
|
952
|
+
appType: string;
|
|
953
|
+
currentTaskId?: string;
|
|
954
|
+
onActionComplete?: (action: string) => void;
|
|
955
|
+
getFormValues?: () => Record<string, any>;
|
|
956
|
+
}
|
|
957
|
+
interface UseApprovalActionsReturn {
|
|
958
|
+
approve: (comments?: string) => Promise<boolean>;
|
|
959
|
+
reject: (comments?: string) => Promise<boolean>;
|
|
960
|
+
transfer: (userId: string, reason?: string) => Promise<boolean>;
|
|
961
|
+
returnTo: (nodeId: string, reason?: string) => Promise<boolean>;
|
|
962
|
+
withdraw: (reason?: string) => Promise<boolean>;
|
|
963
|
+
save: () => Promise<boolean>;
|
|
964
|
+
resubmit: (comments?: string) => Promise<boolean>;
|
|
965
|
+
isLoading: boolean;
|
|
966
|
+
currentAction: string | null;
|
|
967
|
+
returnableNodes: ReturnableNode[];
|
|
968
|
+
loadReturnableNodes: () => Promise<void>;
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* 审批操作逻辑 hook
|
|
972
|
+
*/
|
|
973
|
+
declare function useApprovalActions(options: UseApprovalActionsOptions): UseApprovalActionsReturn;
|
|
974
|
+
|
|
975
|
+
interface UseChangeRecordsOptions {
|
|
976
|
+
formUuid: string;
|
|
977
|
+
appType: string;
|
|
978
|
+
formInstanceId: string;
|
|
979
|
+
pageSize?: number;
|
|
980
|
+
autoLoad?: boolean;
|
|
981
|
+
}
|
|
982
|
+
interface UseChangeRecordsReturn {
|
|
983
|
+
records: ChangeRecord[];
|
|
984
|
+
loading: boolean;
|
|
985
|
+
total: number;
|
|
986
|
+
page: number;
|
|
987
|
+
loadMore: () => Promise<void>;
|
|
988
|
+
refresh: () => Promise<void>;
|
|
989
|
+
hasMore: boolean;
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* 变更记录加载 hook
|
|
993
|
+
*/
|
|
994
|
+
declare function useChangeRecords(options: UseChangeRecordsOptions): UseChangeRecordsReturn;
|
|
995
|
+
|
|
996
|
+
interface UseFormNavigationOptions {
|
|
997
|
+
appType: string;
|
|
998
|
+
formUuid: string;
|
|
999
|
+
formType?: 'form' | 'process';
|
|
1000
|
+
mode?: 'redirect' | 'stay' | 'callback';
|
|
1001
|
+
redirectDelay?: number;
|
|
1002
|
+
basePath?: string;
|
|
1003
|
+
onStay?: (formInstId: string) => void;
|
|
1004
|
+
}
|
|
1005
|
+
interface UseFormNavigationReturn {
|
|
1006
|
+
navigateToDetail: (formInstId: string) => void;
|
|
1007
|
+
navigateToProcessDetail: (formInstId: string) => void;
|
|
1008
|
+
handlePostSubmit: (formInstId: string) => void;
|
|
1009
|
+
isRedirecting: boolean;
|
|
1010
|
+
countdown: number;
|
|
1011
|
+
cancelRedirect: () => void;
|
|
1012
|
+
}
|
|
1013
|
+
declare function useFormNavigation(options: UseFormNavigationOptions): UseFormNavigationReturn;
|
|
1014
|
+
|
|
1015
|
+
interface UseDraftStorageOptions {
|
|
1016
|
+
appType: string;
|
|
1017
|
+
formUuid: string;
|
|
1018
|
+
autoRestore?: boolean;
|
|
1019
|
+
}
|
|
1020
|
+
interface UseDraftStorageReturn {
|
|
1021
|
+
hasDraft: boolean;
|
|
1022
|
+
draftData: Record<string, any> | null;
|
|
1023
|
+
draftTimestamp: number | null;
|
|
1024
|
+
saveDraft: (data: Record<string, any>) => void;
|
|
1025
|
+
restoreDraft: () => Record<string, any> | null;
|
|
1026
|
+
clearDraft: () => void;
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* 草稿暂存 hook
|
|
1030
|
+
* 使用 localStorage 存储表单草稿数据
|
|
1031
|
+
*/
|
|
1032
|
+
declare function useDraftStorage(options: UseDraftStorageOptions): UseDraftStorageReturn;
|
|
1033
|
+
|
|
649
1034
|
/**
|
|
650
1035
|
* 类型安全的表单 Schema 定义辅助函数
|
|
651
1036
|
* 提供 TypeScript 类型推导和编辑器智能提示
|
|
652
1037
|
*/
|
|
653
1038
|
declare function defineFormSchema(schema: FormSchema): FormSchema;
|
|
654
1039
|
|
|
655
|
-
|
|
1040
|
+
interface FormSummaryCardProps {
|
|
1041
|
+
title?: string;
|
|
1042
|
+
formInstanceId?: string;
|
|
1043
|
+
creator?: {
|
|
1044
|
+
name: string;
|
|
1045
|
+
avatar?: string;
|
|
1046
|
+
department?: string;
|
|
1047
|
+
};
|
|
1048
|
+
createdAt?: string;
|
|
1049
|
+
status?: {
|
|
1050
|
+
label: string;
|
|
1051
|
+
tone: 'brand' | 'success' | 'danger' | 'neutral' | 'warning';
|
|
1052
|
+
};
|
|
1053
|
+
className?: string;
|
|
1054
|
+
children?: React__default.ReactNode;
|
|
1055
|
+
}
|
|
1056
|
+
declare const FormSummaryCard: React__default.FC<FormSummaryCardProps>;
|
|
1057
|
+
|
|
1058
|
+
interface ChangeRecordsProps {
|
|
1059
|
+
records?: ChangeRecord[];
|
|
1060
|
+
loading?: boolean;
|
|
1061
|
+
defaultExpanded?: boolean;
|
|
1062
|
+
hasMore?: boolean;
|
|
1063
|
+
onLoadMore?: () => void;
|
|
1064
|
+
onExpand?: () => void;
|
|
1065
|
+
className?: string;
|
|
1066
|
+
renderItem?: (record: ChangeRecord) => React__default.ReactNode;
|
|
1067
|
+
}
|
|
1068
|
+
declare const ChangeRecords: React__default.FC<ChangeRecordsProps>;
|
|
1069
|
+
|
|
1070
|
+
interface ApprovalTimelineProps {
|
|
1071
|
+
tasks: ProcessTask[];
|
|
1072
|
+
className?: string;
|
|
1073
|
+
renderNode?: (task: ProcessTask, index: number) => React__default.ReactNode;
|
|
1074
|
+
showRemarks?: boolean;
|
|
1075
|
+
compactMode?: boolean;
|
|
1076
|
+
}
|
|
1077
|
+
declare const ApprovalTimeline: React__default.FC<ApprovalTimelineProps>;
|
|
1078
|
+
|
|
1079
|
+
interface ApprovalActionsProps {
|
|
1080
|
+
actions: ProcessAction[];
|
|
1081
|
+
onApprove?: (comments?: string) => Promise<void>;
|
|
1082
|
+
onReject?: (comments?: string) => Promise<void>;
|
|
1083
|
+
onTransfer?: () => void;
|
|
1084
|
+
onReturn?: () => void;
|
|
1085
|
+
onWithdraw?: (reason?: string) => Promise<void>;
|
|
1086
|
+
onSave?: () => Promise<void>;
|
|
1087
|
+
layout?: 'horizontal' | 'vertical';
|
|
1088
|
+
maxVisible?: number;
|
|
1089
|
+
className?: string;
|
|
1090
|
+
}
|
|
1091
|
+
declare const ApprovalActions: React__default.FC<ApprovalActionsProps>;
|
|
1092
|
+
|
|
1093
|
+
interface ActionConfig {
|
|
1094
|
+
key: string;
|
|
1095
|
+
label: string;
|
|
1096
|
+
type?: 'primary' | 'default' | 'danger' | 'text';
|
|
1097
|
+
onClick: () => void | Promise<void>;
|
|
1098
|
+
loading?: boolean;
|
|
1099
|
+
disabled?: boolean;
|
|
1100
|
+
visible?: boolean;
|
|
1101
|
+
confirm?: {
|
|
1102
|
+
title: string;
|
|
1103
|
+
content: string;
|
|
1104
|
+
};
|
|
1105
|
+
icon?: React__default.ReactNode;
|
|
1106
|
+
}
|
|
1107
|
+
interface FormActionBarProps {
|
|
1108
|
+
actions: ActionConfig[];
|
|
1109
|
+
position?: 'bottom-fixed' | 'inline';
|
|
1110
|
+
className?: string;
|
|
1111
|
+
}
|
|
1112
|
+
declare const FormActionBar: React__default.FC<FormActionBarProps>;
|
|
1113
|
+
|
|
1114
|
+
interface DraftManagerProps {
|
|
1115
|
+
hasDraft: boolean;
|
|
1116
|
+
draftTimestamp?: number | null;
|
|
1117
|
+
onRestore: () => void;
|
|
1118
|
+
onDiscard: () => void;
|
|
1119
|
+
className?: string;
|
|
1120
|
+
}
|
|
1121
|
+
declare const DraftManager: React__default.FC<DraftManagerProps>;
|
|
1122
|
+
|
|
1123
|
+
interface ProcessPreviewProps {
|
|
1124
|
+
open: boolean;
|
|
1125
|
+
onClose: () => void;
|
|
1126
|
+
onConfirm: () => void;
|
|
1127
|
+
routes: ProcessRoute[];
|
|
1128
|
+
loading?: boolean;
|
|
1129
|
+
}
|
|
1130
|
+
declare const ProcessPreview: React__default.FC<ProcessPreviewProps>;
|
|
1131
|
+
|
|
1132
|
+
interface SubmitSuccessInfo {
|
|
1133
|
+
formInstanceId: string;
|
|
1134
|
+
message?: string;
|
|
1135
|
+
}
|
|
1136
|
+
interface FormSubmitTemplateProps {
|
|
1137
|
+
schema: FormSchema;
|
|
1138
|
+
config: FormEngineConfig;
|
|
1139
|
+
formType?: 'form' | 'process';
|
|
1140
|
+
submitSuccessMode?: 'redirect' | 'stay' | 'continue';
|
|
1141
|
+
enableDraft?: boolean;
|
|
1142
|
+
enableProcessPreview?: boolean;
|
|
1143
|
+
header?: React__default.ReactNode;
|
|
1144
|
+
footer?: React__default.ReactNode;
|
|
1145
|
+
beforeForm?: React__default.ReactNode;
|
|
1146
|
+
afterForm?: React__default.ReactNode;
|
|
1147
|
+
renderForm?: (props: {
|
|
1148
|
+
schema: FormSchema;
|
|
1149
|
+
config: FormEngineConfig;
|
|
1150
|
+
}) => React__default.ReactNode;
|
|
1151
|
+
renderSuccess?: (info: SubmitSuccessInfo) => React__default.ReactNode;
|
|
1152
|
+
onSubmitSuccess?: (formInstId: string) => void;
|
|
1153
|
+
}
|
|
1154
|
+
declare const FormSubmitTemplate: React__default.FC<FormSubmitTemplateProps>;
|
|
1155
|
+
|
|
1156
|
+
interface FormDetailTemplateProps {
|
|
1157
|
+
schema: FormSchema;
|
|
1158
|
+
formUuid: string;
|
|
1159
|
+
appType: string;
|
|
1160
|
+
formInstanceId: string;
|
|
1161
|
+
enableEdit?: boolean;
|
|
1162
|
+
enableDelete?: boolean;
|
|
1163
|
+
enableChangeRecords?: boolean;
|
|
1164
|
+
header?: React__default.ReactNode;
|
|
1165
|
+
footer?: React__default.ReactNode;
|
|
1166
|
+
renderSummary?: (data: FormInstanceData) => React__default.ReactNode;
|
|
1167
|
+
renderActions?: (actions: ActionConfig[]) => React__default.ReactNode;
|
|
1168
|
+
onDelete?: () => void;
|
|
1169
|
+
onSave?: (values: Record<string, any>) => void;
|
|
1170
|
+
}
|
|
1171
|
+
declare const FormDetailTemplate: React__default.FC<FormDetailTemplateProps>;
|
|
1172
|
+
|
|
1173
|
+
interface ProcessDetailTemplateProps {
|
|
1174
|
+
schema: FormSchema;
|
|
1175
|
+
formUuid: string;
|
|
1176
|
+
appType: string;
|
|
1177
|
+
formInstanceId: string;
|
|
1178
|
+
header?: React__default.ReactNode;
|
|
1179
|
+
renderTimeline?: (tasks: ProcessTask[]) => React__default.ReactNode;
|
|
1180
|
+
renderActions?: (actions: ProcessAction[]) => React__default.ReactNode;
|
|
1181
|
+
beforeForm?: React__default.ReactNode;
|
|
1182
|
+
afterForm?: React__default.ReactNode;
|
|
1183
|
+
onActionComplete?: (action: string) => void;
|
|
1184
|
+
}
|
|
1185
|
+
declare const ProcessDetailTemplate: React__default.FC<ProcessDetailTemplateProps>;
|
|
1186
|
+
|
|
1187
|
+
interface PageSkeletonProps {
|
|
1188
|
+
type: 'submit' | 'detail' | 'process';
|
|
1189
|
+
}
|
|
1190
|
+
declare const PageSkeleton: React__default.FC<PageSkeletonProps>;
|
|
1191
|
+
|
|
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 };
|