@robot-admin/naive-ui-components 0.13.6 → 0.13.8

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.
Files changed (113) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +37 -2
  3. package/README_EN.md +37 -2
  4. package/dist/C_Form.base.css +174 -169
  5. package/dist/C_Form.cjs +1 -1
  6. package/dist/C_Form.css +174 -169
  7. package/dist/C_Form.d.cts +2 -2
  8. package/dist/C_Form.d.ts +2 -2
  9. package/dist/C_Form.js +1 -1
  10. package/dist/C_Form2.cjs +1 -1
  11. package/dist/C_Form2.js +1 -1
  12. package/dist/C_FormModal.css +15 -15
  13. package/dist/C_FormModal2.cjs +1 -1
  14. package/dist/C_FormModal2.js +1 -1
  15. package/dist/C_Loading.css +54 -71
  16. package/dist/C_Loading2.cjs +1 -1
  17. package/dist/C_Loading2.js +1 -1
  18. package/dist/C_Table.base.css +340 -352
  19. package/dist/C_Table.css +340 -352
  20. package/dist/constants.d.cts +1 -1
  21. package/dist/constants.d.ts +1 -1
  22. package/dist/constants2.d.cts +3 -3
  23. package/dist/constants2.d.ts +3 -3
  24. package/dist/constants3.d.cts +5 -5
  25. package/dist/constants3.d.ts +5 -5
  26. package/dist/constants4.d.cts +4 -4
  27. package/dist/constants4.d.ts +4 -4
  28. package/dist/constants5.d.cts +2 -2
  29. package/dist/constants5.d.ts +2 -2
  30. package/dist/data.d.cts +9 -9
  31. package/dist/data.d.ts +9 -9
  32. package/dist/index.cjs +1 -1
  33. package/dist/index.d.cts +2 -2
  34. package/dist/index.d.ts +2 -2
  35. package/dist/index.js +1 -1
  36. package/dist/index.vue.d.cts +4 -4
  37. package/dist/index.vue.d.ts +4 -4
  38. package/dist/index10.vue.d.cts +4 -4
  39. package/dist/index10.vue.d.ts +2 -2
  40. package/dist/index11.vue.d.cts +2 -2
  41. package/dist/index11.vue.d.ts +5 -5
  42. package/dist/index12.vue.d.cts +5 -5
  43. package/dist/index12.vue.d.ts +1 -1
  44. package/dist/index13.vue.d.cts +1 -1
  45. package/dist/index13.vue.d.ts +3 -3
  46. package/dist/index14.vue.d.cts +3 -3
  47. package/dist/index14.vue.d.ts +3 -3
  48. package/dist/index15.vue.d.cts +3 -3
  49. package/dist/index17.vue.d.ts +1 -1
  50. package/dist/index18.vue.d.cts +1 -1
  51. package/dist/index18.vue.d.ts +3 -3
  52. package/dist/index19.vue.d.cts +3 -3
  53. package/dist/index19.vue.d.ts +1 -1
  54. package/dist/index2.vue.d.cts +1 -1
  55. package/dist/index2.vue.d.ts +1 -1
  56. package/dist/index20.vue.d.cts +1 -1
  57. package/dist/index20.vue.d.ts +1 -1
  58. package/dist/index21.vue.d.cts +3 -3
  59. package/dist/index21.vue.d.ts +3 -3
  60. package/dist/index22.vue.d.cts +2 -2
  61. package/dist/index22.vue.d.ts +2 -2
  62. package/dist/index23.vue.d.cts +2 -2
  63. package/dist/index23.vue.d.ts +2 -2
  64. package/dist/index25.vue.d.cts +2 -2
  65. package/dist/index25.vue.d.ts +2 -2
  66. package/dist/index27.vue.d.cts +3 -3
  67. package/dist/index27.vue.d.ts +3 -3
  68. package/dist/index28.vue.d.cts +3 -3
  69. package/dist/index28.vue.d.ts +3 -3
  70. package/dist/index3.vue.d.cts +3 -3
  71. package/dist/index3.vue.d.ts +3 -3
  72. package/dist/index4.vue.d.cts +1 -1
  73. package/dist/index6.vue.d.ts +3 -3
  74. package/dist/index7.vue.d.cts +3 -3
  75. package/dist/index8.vue.d.ts +3 -3
  76. package/dist/index9.vue.d.cts +3 -3
  77. package/dist/index9.vue.d.ts +4 -4
  78. package/dist/mapUtils.d.cts +1 -1
  79. package/dist/mapUtils.d.ts +1 -1
  80. package/dist/presets.d.cts +1 -1
  81. package/dist/presets.d.ts +1 -1
  82. package/dist/style.css +355 -367
  83. package/dist/useCollapsePanel.d.cts +2 -2
  84. package/dist/useCollapsePanel.d.ts +2 -2
  85. package/dist/useCropperCore.d.cts +9 -9
  86. package/dist/useCropperCore.d.ts +9 -9
  87. package/dist/useDraggableLayout.d.cts +8 -8
  88. package/dist/useDraggableLayout.d.ts +8 -8
  89. package/dist/useDynamicFormState.d.cts +25 -5
  90. package/dist/useDynamicFormState.d.ts +25 -5
  91. package/dist/useEdgeInteraction.d.cts +1 -1
  92. package/dist/useEdgeInteraction.d.ts +1 -1
  93. package/dist/useQRCode.d.cts +3 -3
  94. package/dist/useQRCode.d.ts +3 -3
  95. package/dist/useSearchState.d.cts +5 -5
  96. package/dist/useSearchState.d.ts +5 -5
  97. package/dist/useSignatureHistory.d.cts +4 -4
  98. package/dist/useSignatureHistory.d.ts +4 -4
  99. package/dist/useSplitResize.d.cts +3 -3
  100. package/dist/useSplitResize.d.ts +3 -3
  101. package/dist/useTableQuery.cjs +2 -2
  102. package/dist/useTableQuery.d.cts +6 -2
  103. package/dist/useTableQuery.d.ts +6 -2
  104. package/dist/useTableQuery.js +2 -2
  105. package/dist/useTimeSelection.d.cts +1 -1
  106. package/dist/useTimeSelection.d.ts +1 -1
  107. package/dist/useTreeOperations.d.cts +7 -7
  108. package/dist/useTreeOperations.d.ts +7 -7
  109. package/dist/useWorkflowValidation.d.cts +1 -1
  110. package/dist/useWorkflowValidation.d.ts +1 -1
  111. package/dist/verification.d.cts +3 -3
  112. package/dist/verification.d.ts +3 -3
  113. package/package.json +2 -1
@@ -71,13 +71,13 @@ declare var __VLS_7: `header-${string}`, __VLS_8: {
71
71
  type __VLS_Slots = {} & { [K in NonNullable<typeof __VLS_7>]?: (props: typeof __VLS_8) => any } & { [K in NonNullable<typeof __VLS_16>]?: (props: typeof __VLS_17) => any } & { [K in NonNullable<typeof __VLS_31>]?: (props: typeof __VLS_32) => any };
72
72
  declare const __VLS_base: vue.DefineComponent<Props, CollapsePanelExpose, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
73
73
  change: (activeKeys: string[]) => any;
74
- "update:activeKeys": (keys: string[]) => any;
75
74
  expand: (key: string) => any;
75
+ "update:activeKeys": (keys: string[]) => any;
76
76
  collapse: (key: string) => any;
77
77
  }, string, vue.PublicProps, Readonly<Props> & Readonly<{
78
78
  onChange?: ((activeKeys: string[]) => any) | undefined;
79
- "onUpdate:activeKeys"?: ((keys: string[]) => any) | undefined;
80
79
  onExpand?: ((key: string) => any) | undefined;
80
+ "onUpdate:activeKeys"?: ((keys: string[]) => any) | undefined;
81
81
  onCollapse?: ((key: string) => any) | undefined;
82
82
  }>, {
83
83
  bordered: boolean;
@@ -71,13 +71,13 @@ declare var __VLS_7: `header-${string}`, __VLS_8: {
71
71
  type __VLS_Slots = {} & { [K in NonNullable<typeof __VLS_7>]?: (props: typeof __VLS_8) => any } & { [K in NonNullable<typeof __VLS_16>]?: (props: typeof __VLS_17) => any } & { [K in NonNullable<typeof __VLS_31>]?: (props: typeof __VLS_32) => any };
72
72
  declare const __VLS_base: vue.DefineComponent<Props, CollapsePanelExpose, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
73
73
  change: (activeKeys: string[]) => any;
74
- "update:activeKeys": (keys: string[]) => any;
75
74
  expand: (key: string) => any;
75
+ "update:activeKeys": (keys: string[]) => any;
76
76
  collapse: (key: string) => any;
77
77
  }, string, vue.PublicProps, Readonly<Props> & Readonly<{
78
78
  onChange?: ((activeKeys: string[]) => any) | undefined;
79
- "onUpdate:activeKeys"?: ((keys: string[]) => any) | undefined;
80
79
  onExpand?: ((key: string) => any) | undefined;
80
+ "onUpdate:activeKeys"?: ((keys: string[]) => any) | undefined;
81
81
  onCollapse?: ((key: string) => any) | undefined;
82
82
  }>, {
83
83
  bordered: boolean;
@@ -52,30 +52,30 @@ interface ImageCropperEmits {
52
52
  //#region src/components/C_ImageCropper/index.vue.d.ts
53
53
  declare const __VLS_export: vue.DefineComponent<ImageCropperProps, ImageCropperExpose, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
54
54
  error: (error: Error) => any;
55
- cancel: () => any;
56
- confirm: (result: CropResult) => any;
57
55
  ready: () => any;
58
56
  crop: (result: CropResult) => any;
57
+ confirm: (result: CropResult) => any;
58
+ cancel: () => any;
59
59
  }, string, vue.PublicProps, Readonly<ImageCropperProps> & Readonly<{
60
60
  onError?: ((error: Error) => any) | undefined;
61
- onCancel?: (() => any) | undefined;
62
- onConfirm?: ((result: CropResult) => any) | undefined;
63
61
  onReady?: (() => any) | undefined;
64
62
  onCrop?: ((result: CropResult) => any) | undefined;
63
+ onConfirm?: ((result: CropResult) => any) | undefined;
64
+ onCancel?: (() => any) | undefined;
65
65
  }>, {
66
- height: string | number;
67
66
  disabled: boolean;
68
- modalTitle: string;
69
- aspectRatio: number;
67
+ height: string | number;
70
68
  src: string;
69
+ showPreview: boolean;
70
+ showToolbar: boolean;
71
+ aspectRatio: number;
71
72
  outputFormat: CropOutputFormat;
72
73
  outputQuality: number;
73
74
  maxOutputWidth: number;
74
75
  maxOutputHeight: number;
75
- showPreview: boolean;
76
- showToolbar: boolean;
77
76
  circular: boolean;
78
77
  modal: boolean;
78
+ modalTitle: string;
79
79
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
80
80
  declare const _default: typeof __VLS_export;
81
81
  //#endregion
@@ -52,30 +52,30 @@ interface ImageCropperEmits {
52
52
  //#region src/components/C_ImageCropper/index.vue.d.ts
53
53
  declare const __VLS_export: vue.DefineComponent<ImageCropperProps, ImageCropperExpose, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
54
54
  error: (error: Error) => any;
55
- cancel: () => any;
56
- confirm: (result: CropResult) => any;
57
55
  ready: () => any;
58
56
  crop: (result: CropResult) => any;
57
+ confirm: (result: CropResult) => any;
58
+ cancel: () => any;
59
59
  }, string, vue.PublicProps, Readonly<ImageCropperProps> & Readonly<{
60
60
  onError?: ((error: Error) => any) | undefined;
61
- onCancel?: (() => any) | undefined;
62
- onConfirm?: ((result: CropResult) => any) | undefined;
63
61
  onReady?: (() => any) | undefined;
64
62
  onCrop?: ((result: CropResult) => any) | undefined;
63
+ onConfirm?: ((result: CropResult) => any) | undefined;
64
+ onCancel?: (() => any) | undefined;
65
65
  }>, {
66
- height: string | number;
67
66
  disabled: boolean;
68
- modalTitle: string;
69
- aspectRatio: number;
67
+ height: string | number;
70
68
  src: string;
69
+ showPreview: boolean;
70
+ showToolbar: boolean;
71
+ aspectRatio: number;
71
72
  outputFormat: CropOutputFormat;
72
73
  outputQuality: number;
73
74
  maxOutputWidth: number;
74
75
  maxOutputHeight: number;
75
- showPreview: boolean;
76
- showToolbar: boolean;
77
76
  circular: boolean;
78
77
  modal: boolean;
78
+ modalTitle: string;
79
79
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
80
80
  declare const _default: typeof __VLS_export;
81
81
  //#endregion
@@ -116,15 +116,18 @@ declare const __VLS_base: vue.DefineComponent<DraggableProps, {
116
116
  "onItem-remove"?: ((item: DraggableItem, index: number) => any) | undefined;
117
117
  "onList-change"?: ((list: DraggableItem[]) => any) | undefined;
118
118
  }>, {
119
- sort: boolean;
120
119
  modelValue: DraggableItem[];
121
- justifyContent: JustifyContent;
122
120
  disabled: boolean;
123
- layout: LayoutMode;
121
+ sort: boolean;
122
+ emptyText: string;
123
+ gap: string | number;
124
+ delay: number;
125
+ itemClass: string;
124
126
  direction: "vertical" | "horizontal";
125
- group: string | GroupOptions;
127
+ layout: LayoutMode;
126
128
  animation: number;
127
- delay: number;
129
+ justifyContent: JustifyContent;
130
+ group: string | GroupOptions;
128
131
  handle: string;
129
132
  showHandle: boolean;
130
133
  ghostClass: string;
@@ -132,14 +135,11 @@ declare const __VLS_base: vue.DefineComponent<DraggableProps, {
132
135
  dragClass: string;
133
136
  wrapperClass: string;
134
137
  listClass: string;
135
- itemClass: string;
136
138
  showEmptyState: boolean;
137
- emptyText: string;
138
139
  swapThreshold: number;
139
140
  invertSwap: boolean;
140
141
  gridColumns: number;
141
142
  gridRows: number;
142
- gap: string | number;
143
143
  flexWrap: boolean;
144
144
  alignItems: AlignItems;
145
145
  customStyles: Record<string, string | number>;
@@ -116,15 +116,18 @@ declare const __VLS_base: vue.DefineComponent<DraggableProps, {
116
116
  "onItem-remove"?: ((item: DraggableItem, index: number) => any) | undefined;
117
117
  "onList-change"?: ((list: DraggableItem[]) => any) | undefined;
118
118
  }>, {
119
- sort: boolean;
120
119
  modelValue: DraggableItem[];
121
- justifyContent: JustifyContent;
122
120
  disabled: boolean;
123
- layout: LayoutMode;
121
+ sort: boolean;
122
+ emptyText: string;
123
+ gap: string | number;
124
+ delay: number;
125
+ itemClass: string;
124
126
  direction: "vertical" | "horizontal";
125
- group: string | GroupOptions;
127
+ layout: LayoutMode;
126
128
  animation: number;
127
- delay: number;
129
+ justifyContent: JustifyContent;
130
+ group: string | GroupOptions;
128
131
  handle: string;
129
132
  showHandle: boolean;
130
133
  ghostClass: string;
@@ -132,14 +135,11 @@ declare const __VLS_base: vue.DefineComponent<DraggableProps, {
132
135
  dragClass: string;
133
136
  wrapperClass: string;
134
137
  listClass: string;
135
- itemClass: string;
136
138
  showEmptyState: boolean;
137
- emptyText: string;
138
139
  swapThreshold: number;
139
140
  invertSwap: boolean;
140
141
  gridColumns: number;
141
142
  gridRows: number;
142
- gap: string | number;
143
143
  flexWrap: boolean;
144
144
  alignItems: AlignItems;
145
145
  customStyles: Record<string, string | number>;
@@ -3,8 +3,18 @@ import * as vue from "vue";
3
3
  import { CSSProperties, Component, ComputedRef, DeepReadonly, InjectionKey, MaybeRefOrGetter, Ref, Slots, VNode } from "vue";
4
4
  import { FormInst, FormItemInst, FormItemRule, FormRules } from "naive-ui";
5
5
  import * as naive_ui_es_form_src_interface0 from "naive-ui/es/form/src/interface";
6
+ import { NAIVE_COMBOS, NaiveRule, PRESET_RULES, RuleSpec, RuleSpec as RuleSpec$1, SPEC_RULES } from "@robot-admin/form-validate";
6
7
  import * as _vue_shared0 from "@vue/shared";
7
8
 
9
+ //#region src/components/C_Form/utils/formValidation.d.ts
10
+ /** 原生规则、验证库规则和框架无关规则均可直接作为字段配置。 */
11
+ type FormValidationRule = FormItemRule | NaiveRule | RuleSpec;
12
+ type NativePresetRule = FormItemRule & Pick<NaiveRule, 'trigger' | 'validator' | 'required' | 'message'>;
13
+ type NativeRuleFactories<T> = { readonly [Key in keyof T]: T[Key] extends ((...args: infer Args) => infer Result) ? (...args: Args) => Result extends readonly NaiveRule[] ? NativePresetRule[] : Result extends NaiveRule ? NativePresetRule : Result : T[Key] };
14
+ /** 运行时保持验证库的工厂对象,只有公开类型在组件包内统一适配。 */
15
+ declare const PRESET_RULES$1: NativeRuleFactories<typeof PRESET_RULES>;
16
+ declare const NAIVE_COMBOS$1: NativeRuleFactories<typeof NAIVE_COMBOS>;
17
+ //#endregion
8
18
  //#region src/components/C_Form/types.d.ts
9
19
  type MaybePromise<T> = T | Promise<T>;
10
20
  type FormRecord = Record<string, unknown>;
@@ -52,6 +62,10 @@ interface FormErrorContext {
52
62
  source: 'initialize' | 'async-options' | 'callback' | 'render' | 'submit';
53
63
  field?: string;
54
64
  }
65
+ /** 组件卸载时取消当前提交,业务请求可直接使用 signal。 */
66
+ interface FormSubmitContext {
67
+ signal: AbortSignal;
68
+ }
55
69
  /**
56
70
  * 标签页配置接口
57
71
  * @description 用于标签页布局的单个标签页配置
@@ -106,7 +120,7 @@ interface DynamicFieldConfig {
106
120
  layout?: {
107
121
  span?: number;
108
122
  };
109
- rules?: FormItemRule[];
123
+ rules?: readonly FormValidationRule[];
110
124
  }
111
125
  /**
112
126
  * 表单项布局配置
@@ -251,7 +265,7 @@ interface FormOption<T extends object = FormRecord> {
251
265
  label?: string;
252
266
  value?: unknown;
253
267
  placeholder?: string;
254
- rules?: FormItemRule[];
268
+ rules?: readonly FormValidationRule[];
255
269
  attrs?: Record<string, unknown>;
256
270
  children?: OptionItem[];
257
271
  show?: boolean;
@@ -269,7 +283,7 @@ interface FormOption<T extends object = FormRecord> {
269
283
  /** 异步数据源:select / cascader / checkbox / radio 的远程选项加载 */
270
284
  asyncOptions?: (formModel: FormModel<T>, context?: AsyncOptionsContext) => Promise<readonly OptionItem[]>;
271
285
  /** 联动校验规则:根据表单数据动态返回校验规则 */
272
- rulesWhen?: (formModel: FormModel<T>) => FormItemRule[];
286
+ rulesWhen?: (formModel: FormModel<T>) => readonly FormValidationRule[];
273
287
  /** 跨字段校验:需要引用多个字段值的验证函数,返回错误消息或 null */
274
288
  crossFieldValidator?: (formModel: FormModel<T>) => MaybePromise<string | null>;
275
289
  }
@@ -361,6 +375,8 @@ interface FormSlots<T extends object = FormRecord> {
361
375
  /** Field-specific named slots are intentionally open-ended. */
362
376
  [slotName: string]: ((props: any) => unknown) | undefined;
363
377
  action?: (props: FormActionSlotProps<T>) => unknown;
378
+ /** 增加业务按钮,保留组件默认的提交、重置和加载管理。 */
379
+ 'action-extra'?: (props: FormActionSlotProps<T>) => unknown;
364
380
  'tab-actions'?: (props: FormTabActionsSlotProps) => unknown;
365
381
  'step-actions'?: (props: FormStepActionsSlotProps) => unknown;
366
382
  }
@@ -436,7 +452,7 @@ interface LayoutCallbacks<T extends object = FormRecord> {
436
452
  onGroupToggle?: (groupKey: string, collapsed: boolean) => void;
437
453
  onGroupReset?: (groupKey: string) => void;
438
454
  onFieldsChange?: (fields: FormOption<T>[]) => void;
439
- onSubmit?: (payload: SubmitEventPayload<T>) => MaybePromise<void>;
455
+ onSubmit?: (payload: SubmitEventPayload<T>, context?: FormSubmitContext) => MaybePromise<void>;
440
456
  onError?: (error: unknown, context: FormErrorContext) => void;
441
457
  }
442
458
  /**
@@ -469,6 +485,10 @@ interface FormConfig<T extends object = FormRecord> extends LayoutCallbacks<T> {
469
485
  submitText?: string;
470
486
  /** 默认重置按钮文案 */
471
487
  resetText?: string;
488
+ /** 提交完成后的提示;默认不显示,由业务明确配置。 */
489
+ submitSuccessText?: string;
490
+ /** 重置完成后的提示;默认不显示。 */
491
+ resetSuccessText?: string;
472
492
  /** 表单模式:create = 新建(默认),edit = 编辑(配合 initialValues 实现回填 + 脏检查) */
473
493
  mode?: FormMode;
474
494
  /** 编辑模式初始值:设置后自动作为脏检查基准 */
@@ -761,4 +781,4 @@ type DynamicFormStateType = DynamicFormController;
761
781
  */
762
782
  declare const DYNAMIC_FORM_STATE_KEY: unique symbol;
763
783
  //#endregion
764
- export { LabelPlacement as $, useFormGlobalConfig as A, FieldPathValue as B, FormConfig as C, mergeFormConfig as D, ResolvedFormConfig as E, DynamicFieldConfig as F, FormModel as G, FormErrorContext as H, DynamicFormConfig as I, FormSlots as J, FormOption as K, DynamicFormController as L, CardLayoutConfig as M, ComponentType as N, resolveFormConfig as O, CustomLayoutConfig as P, InlineLayoutConfig as Q, DynamicFormState as R, FORM_GLOBAL_CONFIG_KEY as S, LayoutCallbacks as T, FormInstance as U, FormActionSlotProps as V, FormMode as W, FormTabActionsSlotProps as X, FormStepActionsSlotProps as Y, GridLayoutConfig as Z, UseFormRendererOptions as _, UseFormDirtyReturn as a, SubmitEventPayload as at, useFormRenderer as b, UseCFormOptions as c, useCForm as d, LayoutConfig as et, _default as f, RendererProps as g, FormRendererContext as h, useDynamicFormState as i, StepsLayoutConfig as it, AsyncOptionsContext as j, shouldShowActions as k, defineFormConfig as l, FormRenderer as m, DynamicFormStateType as n, MaybePromise as nt, useFormDirty as o, TabsLayoutConfig as ot, ComponentMap as p, FormRecord as q, FIELD_TYPE_OPTIONS as r, OptionItem as rt, useFormState as s, DYNAMIC_FORM_STATE_KEY as t, LayoutType as tt, defineFormOptions as u, registerRenderer as v, LAYOUTS_WITH_OWN_CONTROLS as w, FORM_DEFAULTS as x, unregisterRenderer as y, FieldPath as z };
784
+ export { InlineLayoutConfig as $, useFormGlobalConfig as A, FieldPathValue as B, FormConfig as C, mergeFormConfig as D, ResolvedFormConfig as E, DynamicFieldConfig as F, FormModel as G, FormErrorContext as H, DynamicFormConfig as I, FormSlots as J, FormOption as K, DynamicFormController as L, CardLayoutConfig as M, ComponentType as N, resolveFormConfig as O, CustomLayoutConfig as P, GridLayoutConfig as Q, DynamicFormState as R, FORM_GLOBAL_CONFIG_KEY as S, LayoutCallbacks as T, FormInstance as U, FormActionSlotProps as V, FormMode as W, FormSubmitContext as X, FormStepActionsSlotProps as Y, FormTabActionsSlotProps as Z, UseFormRendererOptions as _, UseFormDirtyReturn as a, StepsLayoutConfig as at, useFormRenderer as b, UseCFormOptions as c, FormValidationRule as ct, useCForm as d, RuleSpec$1 as dt, LabelPlacement as et, _default as f, SPEC_RULES as ft, RendererProps as g, FormRendererContext as h, useDynamicFormState as i, OptionItem as it, AsyncOptionsContext as j, shouldShowActions as k, defineFormConfig as l, NAIVE_COMBOS$1 as lt, FormRenderer as m, DynamicFormStateType as n, LayoutType as nt, useFormDirty as o, SubmitEventPayload as ot, ComponentMap as p, FormRecord as q, FIELD_TYPE_OPTIONS as r, MaybePromise as rt, useFormState as s, TabsLayoutConfig as st, DYNAMIC_FORM_STATE_KEY as t, LayoutConfig as tt, defineFormOptions as u, PRESET_RULES$1 as ut, registerRenderer as v, LAYOUTS_WITH_OWN_CONTROLS as w, FORM_DEFAULTS as x, unregisterRenderer as y, FieldPath as z };
@@ -2,9 +2,19 @@ import { i as ComponentLocale, r as ComponentFeedback } from "./config.js";
2
2
  import * as vue from "vue";
3
3
  import { CSSProperties, Component, ComputedRef, DeepReadonly, InjectionKey, MaybeRefOrGetter, Ref, Slots, VNode } from "vue";
4
4
  import { FormInst, FormItemInst, FormItemRule, FormRules } from "naive-ui";
5
+ import { NAIVE_COMBOS, NaiveRule, PRESET_RULES, RuleSpec, RuleSpec as RuleSpec$1, SPEC_RULES } from "@robot-admin/form-validate";
5
6
  import * as naive_ui_es_form_src_interface0 from "naive-ui/es/form/src/interface";
6
7
  import * as _vue_shared0 from "@vue/shared";
7
8
 
9
+ //#region src/components/C_Form/utils/formValidation.d.ts
10
+ /** 原生规则、验证库规则和框架无关规则均可直接作为字段配置。 */
11
+ type FormValidationRule = FormItemRule | NaiveRule | RuleSpec;
12
+ type NativePresetRule = FormItemRule & Pick<NaiveRule, 'trigger' | 'validator' | 'required' | 'message'>;
13
+ type NativeRuleFactories<T> = { readonly [Key in keyof T]: T[Key] extends ((...args: infer Args) => infer Result) ? (...args: Args) => Result extends readonly NaiveRule[] ? NativePresetRule[] : Result extends NaiveRule ? NativePresetRule : Result : T[Key] };
14
+ /** 运行时保持验证库的工厂对象,只有公开类型在组件包内统一适配。 */
15
+ declare const PRESET_RULES$1: NativeRuleFactories<typeof PRESET_RULES>;
16
+ declare const NAIVE_COMBOS$1: NativeRuleFactories<typeof NAIVE_COMBOS>;
17
+ //#endregion
8
18
  //#region src/components/C_Form/types.d.ts
9
19
  type MaybePromise<T> = T | Promise<T>;
10
20
  type FormRecord = Record<string, unknown>;
@@ -52,6 +62,10 @@ interface FormErrorContext {
52
62
  source: 'initialize' | 'async-options' | 'callback' | 'render' | 'submit';
53
63
  field?: string;
54
64
  }
65
+ /** 组件卸载时取消当前提交,业务请求可直接使用 signal。 */
66
+ interface FormSubmitContext {
67
+ signal: AbortSignal;
68
+ }
55
69
  /**
56
70
  * 标签页配置接口
57
71
  * @description 用于标签页布局的单个标签页配置
@@ -106,7 +120,7 @@ interface DynamicFieldConfig {
106
120
  layout?: {
107
121
  span?: number;
108
122
  };
109
- rules?: FormItemRule[];
123
+ rules?: readonly FormValidationRule[];
110
124
  }
111
125
  /**
112
126
  * 表单项布局配置
@@ -251,7 +265,7 @@ interface FormOption<T extends object = FormRecord> {
251
265
  label?: string;
252
266
  value?: unknown;
253
267
  placeholder?: string;
254
- rules?: FormItemRule[];
268
+ rules?: readonly FormValidationRule[];
255
269
  attrs?: Record<string, unknown>;
256
270
  children?: OptionItem[];
257
271
  show?: boolean;
@@ -269,7 +283,7 @@ interface FormOption<T extends object = FormRecord> {
269
283
  /** 异步数据源:select / cascader / checkbox / radio 的远程选项加载 */
270
284
  asyncOptions?: (formModel: FormModel<T>, context?: AsyncOptionsContext) => Promise<readonly OptionItem[]>;
271
285
  /** 联动校验规则:根据表单数据动态返回校验规则 */
272
- rulesWhen?: (formModel: FormModel<T>) => FormItemRule[];
286
+ rulesWhen?: (formModel: FormModel<T>) => readonly FormValidationRule[];
273
287
  /** 跨字段校验:需要引用多个字段值的验证函数,返回错误消息或 null */
274
288
  crossFieldValidator?: (formModel: FormModel<T>) => MaybePromise<string | null>;
275
289
  }
@@ -361,6 +375,8 @@ interface FormSlots<T extends object = FormRecord> {
361
375
  /** Field-specific named slots are intentionally open-ended. */
362
376
  [slotName: string]: ((props: any) => unknown) | undefined;
363
377
  action?: (props: FormActionSlotProps<T>) => unknown;
378
+ /** 增加业务按钮,保留组件默认的提交、重置和加载管理。 */
379
+ 'action-extra'?: (props: FormActionSlotProps<T>) => unknown;
364
380
  'tab-actions'?: (props: FormTabActionsSlotProps) => unknown;
365
381
  'step-actions'?: (props: FormStepActionsSlotProps) => unknown;
366
382
  }
@@ -436,7 +452,7 @@ interface LayoutCallbacks<T extends object = FormRecord> {
436
452
  onGroupToggle?: (groupKey: string, collapsed: boolean) => void;
437
453
  onGroupReset?: (groupKey: string) => void;
438
454
  onFieldsChange?: (fields: FormOption<T>[]) => void;
439
- onSubmit?: (payload: SubmitEventPayload<T>) => MaybePromise<void>;
455
+ onSubmit?: (payload: SubmitEventPayload<T>, context?: FormSubmitContext) => MaybePromise<void>;
440
456
  onError?: (error: unknown, context: FormErrorContext) => void;
441
457
  }
442
458
  /**
@@ -469,6 +485,10 @@ interface FormConfig<T extends object = FormRecord> extends LayoutCallbacks<T> {
469
485
  submitText?: string;
470
486
  /** 默认重置按钮文案 */
471
487
  resetText?: string;
488
+ /** 提交完成后的提示;默认不显示,由业务明确配置。 */
489
+ submitSuccessText?: string;
490
+ /** 重置完成后的提示;默认不显示。 */
491
+ resetSuccessText?: string;
472
492
  /** 表单模式:create = 新建(默认),edit = 编辑(配合 initialValues 实现回填 + 脏检查) */
473
493
  mode?: FormMode;
474
494
  /** 编辑模式初始值:设置后自动作为脏检查基准 */
@@ -761,4 +781,4 @@ type DynamicFormStateType = DynamicFormController;
761
781
  */
762
782
  declare const DYNAMIC_FORM_STATE_KEY: unique symbol;
763
783
  //#endregion
764
- export { LabelPlacement as $, useFormGlobalConfig as A, FieldPathValue as B, FormConfig as C, mergeFormConfig as D, ResolvedFormConfig as E, DynamicFieldConfig as F, FormModel as G, FormErrorContext as H, DynamicFormConfig as I, FormSlots as J, FormOption as K, DynamicFormController as L, CardLayoutConfig as M, ComponentType as N, resolveFormConfig as O, CustomLayoutConfig as P, InlineLayoutConfig as Q, DynamicFormState as R, FORM_GLOBAL_CONFIG_KEY as S, LayoutCallbacks as T, FormInstance as U, FormActionSlotProps as V, FormMode as W, FormTabActionsSlotProps as X, FormStepActionsSlotProps as Y, GridLayoutConfig as Z, UseFormRendererOptions as _, UseFormDirtyReturn as a, SubmitEventPayload as at, useFormRenderer as b, UseCFormOptions as c, useCForm as d, LayoutConfig as et, _default as f, RendererProps as g, FormRendererContext as h, useDynamicFormState as i, StepsLayoutConfig as it, AsyncOptionsContext as j, shouldShowActions as k, defineFormConfig as l, FormRenderer as m, DynamicFormStateType as n, MaybePromise as nt, useFormDirty as o, TabsLayoutConfig as ot, ComponentMap as p, FormRecord as q, FIELD_TYPE_OPTIONS as r, OptionItem as rt, useFormState as s, DYNAMIC_FORM_STATE_KEY as t, LayoutType as tt, defineFormOptions as u, registerRenderer as v, LAYOUTS_WITH_OWN_CONTROLS as w, FORM_DEFAULTS as x, unregisterRenderer as y, FieldPath as z };
784
+ export { InlineLayoutConfig as $, useFormGlobalConfig as A, FieldPathValue as B, FormConfig as C, mergeFormConfig as D, ResolvedFormConfig as E, DynamicFieldConfig as F, FormModel as G, FormErrorContext as H, DynamicFormConfig as I, FormSlots as J, FormOption as K, DynamicFormController as L, CardLayoutConfig as M, ComponentType as N, resolveFormConfig as O, CustomLayoutConfig as P, GridLayoutConfig as Q, DynamicFormState as R, FORM_GLOBAL_CONFIG_KEY as S, LayoutCallbacks as T, FormInstance as U, FormActionSlotProps as V, FormMode as W, FormSubmitContext as X, FormStepActionsSlotProps as Y, FormTabActionsSlotProps as Z, UseFormRendererOptions as _, UseFormDirtyReturn as a, StepsLayoutConfig as at, useFormRenderer as b, UseCFormOptions as c, FormValidationRule as ct, useCForm as d, RuleSpec$1 as dt, LabelPlacement as et, _default as f, SPEC_RULES as ft, RendererProps as g, FormRendererContext as h, useDynamicFormState as i, OptionItem as it, AsyncOptionsContext as j, shouldShowActions as k, defineFormConfig as l, NAIVE_COMBOS$1 as lt, FormRenderer as m, DynamicFormStateType as n, LayoutType as nt, useFormDirty as o, SubmitEventPayload as ot, ComponentMap as p, FormRecord as q, FIELD_TYPE_OPTIONS as r, MaybePromise as rt, useFormState as s, TabsLayoutConfig as st, DYNAMIC_FORM_STATE_KEY as t, LayoutConfig as tt, defineFormOptions as u, PRESET_RULES$1 as ut, registerRenderer as v, LAYOUTS_WITH_OWN_CONTROLS as w, FORM_DEFAULTS as x, unregisterRenderer as y, FieldPath as z };
@@ -259,10 +259,10 @@ declare const __VLS_export: vue.DefineComponent<Props, {
259
259
  onReady?: ((graph: Graph) => any) | undefined;
260
260
  "onData-change"?: ((data: DiagramData) => any) | undefined;
261
261
  }>, {
262
+ readonly: boolean;
262
263
  height: string | number;
263
264
  theme: "light" | "dark";
264
265
  width: string | number;
265
- readonly: boolean;
266
266
  showToolbar: boolean;
267
267
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
268
268
  declare const _default: typeof __VLS_export;
@@ -259,10 +259,10 @@ declare const __VLS_export: vue.DefineComponent<Props, {
259
259
  onReady?: ((graph: Graph) => any) | undefined;
260
260
  "onData-change"?: ((data: DiagramData) => any) | undefined;
261
261
  }>, {
262
+ readonly: boolean;
262
263
  height: string | number;
263
264
  theme: "light" | "dark";
264
265
  width: string | number;
265
- readonly: boolean;
266
266
  showToolbar: boolean;
267
267
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
268
268
  declare const _default: typeof __VLS_export;
@@ -50,15 +50,15 @@ declare const __VLS_export: vue.DefineComponent<Props, QRCodeExpose, {}, {}, {},
50
50
  }, string, vue.PublicProps, Readonly<Props> & Readonly<{
51
51
  onError?: ((error: Error) => any) | undefined;
52
52
  }>, {
53
- color: string;
54
53
  size: number;
54
+ color: string;
55
55
  label: string;
56
56
  mode: RenderMode;
57
+ margin: number;
58
+ showBorder: boolean;
57
59
  bgColor: string;
58
60
  errorCorrectionLevel: ErrorCorrectionLevel;
59
- margin: number;
60
61
  logo: LogoOptions;
61
- showBorder: boolean;
62
62
  showLabel: boolean;
63
63
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
64
64
  declare const _default: typeof __VLS_export;
@@ -50,15 +50,15 @@ declare const __VLS_export: vue.DefineComponent<Props, QRCodeExpose, {}, {}, {},
50
50
  }, string, vue.PublicProps, Readonly<Props> & Readonly<{
51
51
  onError?: ((error: Error) => any) | undefined;
52
52
  }>, {
53
- color: string;
54
53
  size: number;
54
+ color: string;
55
55
  label: string;
56
56
  mode: RenderMode;
57
+ margin: number;
58
+ showBorder: boolean;
57
59
  bgColor: string;
58
60
  errorCorrectionLevel: ErrorCorrectionLevel;
59
- margin: number;
60
61
  logo: LogoOptions;
61
- showBorder: boolean;
62
62
  showLabel: boolean;
63
63
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
64
64
  declare const _default: typeof __VLS_export;
@@ -83,13 +83,13 @@ declare const __VLS_export: vue.DefineComponent<FormSearchProps, {
83
83
  cleanFn: () => void;
84
84
  changeFoldState: () => void;
85
85
  }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
86
- search: (params: SearchFormParams) => any;
87
86
  "update:modelValue": (params: SearchFormParams) => any;
87
+ search: (params: SearchFormParams) => any;
88
88
  reset: () => any;
89
89
  "change-params": (params: SearchFormParams) => any;
90
90
  }, string, vue.PublicProps, Readonly<FormSearchProps> & Readonly<{
91
- onSearch?: ((params: SearchFormParams) => any) | undefined;
92
91
  "onUpdate:modelValue"?: ((params: SearchFormParams) => any) | undefined;
92
+ onSearch?: ((params: SearchFormParams) => any) | undefined;
93
93
  onReset?: (() => any) | undefined;
94
94
  "onChange-params"?: ((params: SearchFormParams) => any) | undefined;
95
95
  }>, {
@@ -164,7 +164,6 @@ declare function useSearchState(emits: {
164
164
  rules?: {
165
165
  type?: async_validator0.RuleType | undefined;
166
166
  required?: boolean | undefined;
167
- max?: number | undefined;
168
167
  options?: {
169
168
  suppressWarning?: boolean | undefined;
170
169
  suppressValidatorError?: boolean | undefined;
@@ -222,6 +221,7 @@ declare function useSearchState(emits: {
222
221
  } | undefined;
223
222
  pattern?: (RegExp | string) | undefined;
224
223
  min?: number | undefined;
224
+ max?: number | undefined;
225
225
  len?: number | undefined;
226
226
  enum?: Array<string | number | boolean | null | undefined> | undefined;
227
227
  whitespace?: boolean | undefined;
@@ -395,7 +395,6 @@ declare function useSearchState(emits: {
395
395
  rules?: {
396
396
  type?: async_validator0.RuleType | undefined;
397
397
  required?: boolean | undefined;
398
- max?: number | undefined;
399
398
  options?: {
400
399
  suppressWarning?: boolean | undefined;
401
400
  suppressValidatorError?: boolean | undefined;
@@ -453,6 +452,7 @@ declare function useSearchState(emits: {
453
452
  } | undefined;
454
453
  pattern?: (RegExp | string) | undefined;
455
454
  min?: number | undefined;
455
+ max?: number | undefined;
456
456
  len?: number | undefined;
457
457
  enum?: Array<string | number | boolean | null | undefined> | undefined;
458
458
  whitespace?: boolean | undefined;
@@ -638,7 +638,6 @@ declare function useSearchState(emits: {
638
638
  rules?: {
639
639
  type?: async_validator0.RuleType | undefined;
640
640
  required?: boolean | undefined;
641
- max?: number | undefined;
642
641
  options?: {
643
642
  suppressWarning?: boolean | undefined;
644
643
  suppressValidatorError?: boolean | undefined;
@@ -696,6 +695,7 @@ declare function useSearchState(emits: {
696
695
  } | undefined;
697
696
  pattern?: (RegExp | string) | undefined;
698
697
  min?: number | undefined;
698
+ max?: number | undefined;
699
699
  len?: number | undefined;
700
700
  enum?: Array<string | number | boolean | null | undefined> | undefined;
701
701
  whitespace?: boolean | undefined;
@@ -82,13 +82,13 @@ declare const __VLS_export: vue.DefineComponent<FormSearchProps, {
82
82
  cleanFn: () => void;
83
83
  changeFoldState: () => void;
84
84
  }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
85
- search: (params: SearchFormParams) => any;
86
85
  "update:modelValue": (params: SearchFormParams) => any;
86
+ search: (params: SearchFormParams) => any;
87
87
  reset: () => any;
88
88
  "change-params": (params: SearchFormParams) => any;
89
89
  }, string, vue.PublicProps, Readonly<FormSearchProps> & Readonly<{
90
- onSearch?: ((params: SearchFormParams) => any) | undefined;
91
90
  "onUpdate:modelValue"?: ((params: SearchFormParams) => any) | undefined;
91
+ onSearch?: ((params: SearchFormParams) => any) | undefined;
92
92
  onReset?: (() => any) | undefined;
93
93
  "onChange-params"?: ((params: SearchFormParams) => any) | undefined;
94
94
  }>, {
@@ -273,7 +273,6 @@ declare function useSearchState(emits: {
273
273
  rules?: {
274
274
  type?: RuleType | undefined;
275
275
  required?: boolean | undefined;
276
- max?: number | undefined;
277
276
  options?: {
278
277
  suppressWarning?: boolean | undefined;
279
278
  suppressValidatorError?: boolean | undefined;
@@ -331,6 +330,7 @@ declare function useSearchState(emits: {
331
330
  } | undefined;
332
331
  pattern?: (RegExp | string) | undefined;
333
332
  min?: number | undefined;
333
+ max?: number | undefined;
334
334
  len?: number | undefined;
335
335
  enum?: Array<string | number | boolean | null | undefined> | undefined;
336
336
  whitespace?: boolean | undefined;
@@ -504,7 +504,6 @@ declare function useSearchState(emits: {
504
504
  rules?: {
505
505
  type?: RuleType | undefined;
506
506
  required?: boolean | undefined;
507
- max?: number | undefined;
508
507
  options?: {
509
508
  suppressWarning?: boolean | undefined;
510
509
  suppressValidatorError?: boolean | undefined;
@@ -562,6 +561,7 @@ declare function useSearchState(emits: {
562
561
  } | undefined;
563
562
  pattern?: (RegExp | string) | undefined;
564
563
  min?: number | undefined;
564
+ max?: number | undefined;
565
565
  len?: number | undefined;
566
566
  enum?: Array<string | number | boolean | null | undefined> | undefined;
567
567
  whitespace?: boolean | undefined;
@@ -747,7 +747,6 @@ declare function useSearchState(emits: {
747
747
  rules?: {
748
748
  type?: RuleType | undefined;
749
749
  required?: boolean | undefined;
750
- max?: number | undefined;
751
750
  options?: {
752
751
  suppressWarning?: boolean | undefined;
753
752
  suppressValidatorError?: boolean | undefined;
@@ -805,6 +804,7 @@ declare function useSearchState(emits: {
805
804
  } | undefined;
806
805
  pattern?: (RegExp | string) | undefined;
807
806
  min?: number | undefined;
807
+ max?: number | undefined;
808
808
  len?: number | undefined;
809
809
  enum?: Array<string | number | boolean | null | undefined> | undefined;
810
810
  whitespace?: boolean | undefined;
@@ -92,28 +92,28 @@ interface SignatureEmits {
92
92
  //#endregion
93
93
  //#region src/components/C_Signature/index.vue.d.ts
94
94
  declare const __VLS_export: vue.DefineComponent<SignatureProps, SignatureExpose, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
95
+ clear: () => any;
95
96
  error: (error: Error) => any;
96
97
  change: (data: SignatureStroke[]) => any;
97
- clear: () => any;
98
98
  "start-draw": () => any;
99
99
  drawing: (point: SignaturePoint) => any;
100
100
  "end-draw": (stroke: SignatureStroke) => any;
101
101
  undo: () => any;
102
102
  redo: () => any;
103
103
  }, string, vue.PublicProps, Readonly<SignatureProps> & Readonly<{
104
+ onClear?: (() => any) | undefined;
104
105
  onError?: ((error: Error) => any) | undefined;
105
106
  onChange?: ((data: SignatureStroke[]) => any) | undefined;
106
- onClear?: (() => any) | undefined;
107
107
  "onStart-draw"?: (() => any) | undefined;
108
108
  onDrawing?: ((point: SignaturePoint) => any) | undefined;
109
109
  "onEnd-draw"?: ((stroke: SignatureStroke) => any) | undefined;
110
110
  onUndo?: (() => any) | undefined;
111
111
  onRedo?: (() => any) | undefined;
112
112
  }>, {
113
- height: number | string;
114
113
  disabled: boolean;
115
- width: number | string;
116
114
  readonly: boolean;
115
+ height: number | string;
116
+ width: number | string;
117
117
  showToolbar: boolean;
118
118
  maxHistory: number;
119
119
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
@@ -92,28 +92,28 @@ interface SignatureEmits {
92
92
  //#endregion
93
93
  //#region src/components/C_Signature/index.vue.d.ts
94
94
  declare const __VLS_export: vue.DefineComponent<SignatureProps, SignatureExpose, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
95
+ clear: () => any;
95
96
  error: (error: Error) => any;
96
97
  change: (data: SignatureStroke[]) => any;
97
- clear: () => any;
98
98
  "start-draw": () => any;
99
99
  drawing: (point: SignaturePoint) => any;
100
100
  "end-draw": (stroke: SignatureStroke) => any;
101
101
  undo: () => any;
102
102
  redo: () => any;
103
103
  }, string, vue.PublicProps, Readonly<SignatureProps> & Readonly<{
104
+ onClear?: (() => any) | undefined;
104
105
  onError?: ((error: Error) => any) | undefined;
105
106
  onChange?: ((data: SignatureStroke[]) => any) | undefined;
106
- onClear?: (() => any) | undefined;
107
107
  "onStart-draw"?: (() => any) | undefined;
108
108
  onDrawing?: ((point: SignaturePoint) => any) | undefined;
109
109
  "onEnd-draw"?: ((stroke: SignatureStroke) => any) | undefined;
110
110
  onUndo?: (() => any) | undefined;
111
111
  onRedo?: (() => any) | undefined;
112
112
  }>, {
113
- height: number | string;
114
113
  disabled: boolean;
115
- width: number | string;
116
114
  readonly: boolean;
115
+ height: number | string;
116
+ width: number | string;
117
117
  showToolbar: boolean;
118
118
  maxHistory: number;
119
119
  }, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;