@shaonq/vue 1.3.2 → 1.4.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/lib/index.d.ts CHANGED
@@ -19,7 +19,9 @@ import { PublicProps } from 'vue';
19
19
  import { Ref } from 'vue';
20
20
  import { SelectOptionData } from '@arco-design/web-vue';
21
21
  import { Size } from '@arco-design/web-vue';
22
+ import { StoreDefinition } from 'pinia';
22
23
  import { TablePublicMethods } from 'vxe-table';
24
+ import { VNode } from 'vue';
23
25
  import { VxeColumnPropTypes } from 'vxe-table';
24
26
  import { VxeTable } from 'vxe-table';
25
27
  import { VxeTableDataRow } from 'vxe-table';
@@ -227,10 +229,13 @@ declare type __VLS_WithTemplateSlots_8<T, S> = T & {
227
229
 
228
230
  declare type ButtonInstance = InstanceType<typeof Button>;
229
231
 
230
- /** 组件属性处理函数签名 */
232
+ /**
233
+ * componentAttr 中函数属性的回调参数
234
+ * @description 当 `componentAttr` 的某个值为函数时,函数在渲染时执行,注入以下参数
235
+ */
231
236
  declare type ComponentAttrHandler = (util: OrcFormUtilBind, index?: any) => unknown;
232
237
 
233
- /** 组件属性允许的值类型 */
238
+ /** componentAttr 支持的静态值类型 */
234
239
  declare type ComponentAttrValue = null | boolean | number | string | RecordAny_3 | RecordAny_3[] | ComponentAttrHandler;
235
240
 
236
241
  export declare interface CssType extends Partial<CSSStyleDeclaration>, RecordAny_2 {
@@ -245,6 +250,8 @@ export default _default;
245
250
 
246
251
  export declare function delay(ms: number): Promise<unknown>;
247
252
 
253
+ declare type DictLoadFn = (code: string) => Promise<unknown[]>;
254
+
248
255
  export declare const download: (url: string, fileName?: string) => boolean;
249
256
 
250
257
  /**
@@ -410,396 +417,11 @@ declare const lang_2: {
410
417
  };
411
418
  };
412
419
 
413
- export declare const locale: {
414
- enUS: {
415
- fe: {
416
- panel: {
417
- title: string;
418
- model: string;
419
- bcid: string;
420
- padding: string;
421
- name: string;
422
- width: string;
423
- height: string;
424
- size: string;
425
- labelWidth: string;
426
- labelAlign: string;
427
- custom: string;
428
- placeholder: string;
429
- layout: string;
430
- block: string;
431
- inline: string;
432
- contentPosition: string;
433
- left: string;
434
- right: string;
435
- center: string;
436
- showInput: string;
437
- min: string;
438
- max: string;
439
- step: string;
440
- multiple: string;
441
- filterable: string;
442
- allowHalf: string;
443
- showAlpha: string;
444
- showLabel: string;
445
- option: string;
446
- options: string;
447
- staticData: string;
448
- remoteData: string;
449
- remoteFunc: string;
450
- value: string;
451
- label: string;
452
- childrenOption: string;
453
- defaultValue: string;
454
- showType: string;
455
- isRange: string;
456
- isTimestamp: string;
457
- startPlaceholder: string;
458
- endPlaceholder: string;
459
- format: string;
460
- limit: string;
461
- imageAction: string;
462
- tip: string;
463
- action: string;
464
- defaultType: string;
465
- string: string;
466
- object: string;
467
- array: string;
468
- number: string;
469
- boolean: string;
470
- integer: string;
471
- float: string;
472
- url: string;
473
- email: string;
474
- hex: string;
475
- gutter: string;
476
- columnOption: string;
477
- span: string;
478
- justify: string;
479
- justifyStart: string;
480
- justifyEnd: string;
481
- justifyCenter: string;
482
- justifySpaceAround: string;
483
- justifySpaceBetween: string;
484
- align: string;
485
- alignTop: string;
486
- alignMiddle: string;
487
- alignBottom: string;
488
- type: string;
489
- default: string;
490
- card: string;
491
- borderCard: string;
492
- tabPosition: string;
493
- top: string;
494
- bottom: string;
495
- tabOption: string;
496
- tabName: string;
497
- customClass: string;
498
- attribute: string;
499
- dataBind: string;
500
- hidden: string;
501
- readonly: string;
502
- disabled: string;
503
- editable: string;
504
- clearable: string;
505
- arrowControl: string;
506
- isDelete: string;
507
- isEdit: string;
508
- showPassword: string;
509
- validate: string;
510
- required: string;
511
- patternPlaceholder: string;
512
- newOption: string;
513
- tab: string;
514
- validatorRequired: string;
515
- validatorType: string;
516
- validatorPattern: string;
517
- showWordLimit: string;
518
- maxLength: string;
519
- textAlign: string;
520
- fontSize: string;
521
- fontFamily: string;
522
- rowspan: string;
523
- colspan: string;
524
- borderTop: string;
525
- borderLeft: string;
526
- };
527
- side: {
528
- fields: {
529
- input: string;
530
- textarea: string;
531
- number: string;
532
- radio: string;
533
- checkbox: string;
534
- time: string;
535
- date: string;
536
- rate: string;
537
- color: string;
538
- select: string;
539
- switch: string;
540
- slider: string;
541
- text: string;
542
- blank: string;
543
- fileupload: string;
544
- imgupload: string;
545
- editor: string;
546
- cascader: string;
547
- table: string;
548
- grid: string;
549
- tabs: string;
550
- divider: string;
551
- };
552
- basic: {
553
- title: string;
554
- };
555
- advance: {
556
- title: string;
557
- };
558
- layout: {
559
- title: string;
560
- };
561
- };
562
- description: {
563
- containerEmpty: string;
564
- configEmpty: string;
565
- tableEmpty: string;
566
- uploadJsonInfo: string;
567
- };
568
- message: {
569
- copySuccess: string;
570
- validError: string;
571
- };
572
- actions: {
573
- import: string;
574
- clear: string;
575
- preview: string;
576
- json: string;
577
- code: string;
578
- getData: string;
579
- reset: string;
580
- copyData: string;
581
- cancel: string;
582
- confirm: string;
583
- addOption: string;
584
- addColumn: string;
585
- addTab: string;
586
- upload: string;
587
- add: string;
588
- enabledEdit: string;
589
- disabledEdit: string;
590
- };
591
- config: {
592
- width: string;
593
- height: string;
594
- title: string;
595
- labelWidth: string;
596
- labelAlign: string;
597
- labelAlignLeft: string;
598
- labelAlignRight: string;
599
- labelAlignTop: string;
600
- size: string;
601
- customClass: string;
602
- };
603
- };
604
- };
605
- zhCN: {
606
- fe: {
607
- panel: {
608
- title: string;
609
- model: string;
610
- bcid: string;
611
- padding: string;
612
- name: string;
613
- width: string;
614
- height: string;
615
- size: string;
616
- labelWidth: string;
617
- labelAlign: string;
618
- custom: string;
619
- placeholder: string;
620
- layout: string;
621
- block: string;
622
- inline: string;
623
- contentPosition: string;
624
- left: string;
625
- right: string;
626
- center: string;
627
- showInput: string;
628
- min: string;
629
- max: string;
630
- step: string;
631
- multiple: string;
632
- filterable: string;
633
- allowHalf: string;
634
- showAlpha: string;
635
- showLabel: string;
636
- option: string;
637
- options: string;
638
- staticData: string;
639
- remoteData: string;
640
- remoteFunc: string;
641
- value: string;
642
- label: string;
643
- childrenOption: string;
644
- defaultValue: string;
645
- showType: string;
646
- isRange: string;
647
- isTimestamp: string;
648
- startPlaceholder: string;
649
- endPlaceholder: string;
650
- format: string;
651
- limit: string;
652
- imageAction: string;
653
- tip: string;
654
- action: string;
655
- defaultType: string;
656
- string: string;
657
- object: string;
658
- array: string;
659
- number: string;
660
- boolean: string;
661
- integer: string;
662
- float: string;
663
- url: string;
664
- email: string;
665
- hex: string;
666
- gutter: string;
667
- columnOption: string;
668
- span: string;
669
- justify: string;
670
- justifyStart: string;
671
- justifyEnd: string;
672
- justifyCenter: string;
673
- justifySpaceAround: string;
674
- justifySpaceBetween: string;
675
- align: string;
676
- alignTop: string;
677
- alignMiddle: string;
678
- alignBottom: string;
679
- type: string;
680
- default: string;
681
- card: string;
682
- borderCard: string;
683
- tabPosition: string;
684
- top: string;
685
- bottom: string;
686
- tabOption: string;
687
- tabName: string;
688
- customClass: string;
689
- attribute: string;
690
- dataBind: string;
691
- hidden: string;
692
- readonly: string;
693
- disabled: string;
694
- editable: string;
695
- clearable: string;
696
- arrowControl: string;
697
- isDelete: string;
698
- isEdit: string;
699
- showPassword: string;
700
- validate: string;
701
- required: string;
702
- patternPlaceholder: string;
703
- newOption: string;
704
- tab: string;
705
- validatorRequired: string;
706
- validatorType: string;
707
- validatorPattern: string;
708
- showWordLimit: string;
709
- maxLength: string;
710
- textAlign: string;
711
- fontSize: string;
712
- fontFamily: string;
713
- rowspan: string;
714
- colspan: string;
715
- borderTop: string;
716
- borderLeft: string;
717
- };
718
- side: {
719
- fields: {
720
- input: string;
721
- textarea: string;
722
- number: string;
723
- radio: string;
724
- checkbox: string;
725
- time: string;
726
- date: string;
727
- rate: string;
728
- color: string;
729
- select: string;
730
- switch: string;
731
- slider: string;
732
- text: string;
733
- blank: string;
734
- fileupload: string;
735
- imgupload: string;
736
- editor: string;
737
- cascader: string;
738
- table: string;
739
- grid: string;
740
- tabs: string;
741
- divider: string;
742
- };
743
- basic: {
744
- title: string;
745
- };
746
- advance: {
747
- title: string;
748
- };
749
- layout: {
750
- title: string;
751
- };
752
- };
753
- description: {
754
- containerEmpty: string;
755
- configEmpty: string;
756
- tableEmpty: string;
757
- uploadJsonInfo: string;
758
- };
759
- message: {
760
- copySuccess: string;
761
- validError: string;
762
- };
763
- actions: {
764
- import: string;
765
- clear: string;
766
- preview: string;
767
- json: string;
768
- code: string;
769
- getData: string;
770
- reset: string;
771
- copyData: string;
772
- cancel: string;
773
- confirm: string;
774
- addOption: string;
775
- addColumn: string;
776
- addTab: string;
777
- upload: string;
778
- add: string;
779
- enabledEdit: string;
780
- disabledEdit: string;
781
- };
782
- config: {
783
- width: string;
784
- height: string;
785
- title: string;
786
- labelWidth: string;
787
- labelAlign: string;
788
- labelAlignLeft: string;
789
- labelAlignRight: string;
790
- labelAlignTop: string;
791
- size: string;
792
- customClass: string;
793
- };
794
- };
795
- };
796
- };
797
-
798
420
  /** 日志 */
799
421
  export declare function log(...args: any[]): void;
800
422
 
801
423
  /** 合并配置文件 */
802
- export declare function mergeConfig(defaults: RecordAny, overrides: RecordAny, isRoot?: boolean): RecordAny;
424
+ export declare function mergeConfig(defaults: RecordAny, overrides: RecordAny): RecordAny;
803
425
 
804
426
  declare type ModalInstance = InstanceType<typeof Modal>;
805
427
 
@@ -812,61 +434,28 @@ declare function onSubmit(): Promise<[boolean, any]>;
812
434
 
813
435
  declare function onSubmit_2(): Promise<void>;
814
436
 
815
- export declare const OrcDesign: DefineComponent<ExtractPropTypes<{
816
- readonly: BooleanConstructor;
817
- data: {
818
- type: ObjectConstructor;
819
- default(): {};
820
- };
821
- models: {
822
- type: ObjectConstructor;
823
- default(): {};
824
- };
825
- remoteFuncs: {
826
- type: ObjectConstructor;
827
- default(): {};
828
- };
829
- moduleConfig: ArrayConstructor;
830
- }>, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
831
- save: (...args: any[]) => void;
832
- }, string, PublicProps, Readonly< ExtractPropTypes<{
833
- readonly: BooleanConstructor;
834
- data: {
835
- type: ObjectConstructor;
836
- default(): {};
837
- };
838
- models: {
839
- type: ObjectConstructor;
840
- default(): {};
841
- };
842
- remoteFuncs: {
843
- type: ObjectConstructor;
844
- default(): {};
845
- };
846
- moduleConfig: ArrayConstructor;
847
- }>> & Readonly<{
848
- onSave?: ((...args: any[]) => any) | undefined;
849
- }>, {
850
- data: Record<string, any>;
851
- readonly: boolean;
852
- models: Record<string, any>;
853
- remoteFuncs: Record<string, any>;
854
- }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
855
-
856
437
  export declare const OrcForm: __VLS_WithTemplateSlots_5< DefineComponent<ExtractPropTypes<__VLS_WithDefaults_5<__VLS_TypePropsToRuntimeProps_5<{
438
+ /** 表单字段配置数组 */
857
439
  config?: OrcFormItem[] | undefined;
440
+ /** 标签宽度,默认 '110px' */
858
441
  labelWidth?: string | undefined;
442
+ /** 标签对齐方式,默认 'right' */
859
443
  labelAlign?: "left" | "right" | undefined;
444
+ /** 提交按钮加载状态 */
860
445
  loading?: boolean | undefined;
446
+ /** 是否禁用整个表单 */
861
447
  disabled?: boolean | undefined;
448
+ /** 是否隐藏提交按钮 */
862
449
  hideSubmit?: boolean | undefined;
450
+ /** 表单数据(v-model) */
863
451
  modelValue?: Record<string, any> | undefined;
864
452
  /** 栅格间距 */
865
453
  gutter?: number | undefined;
866
- /** 栅格 24 */
454
+ /** 每行栅格数(基于 24 栅格),默认 24 */
867
455
  span?: number | undefined;
456
+ /** 透传到 Arco Form 组件的 props */
868
457
  formAttr?: Record<string, any> | undefined;
869
- /** 栅格grid 优先级低于行 span */
458
+ /** 栅格 grid 配置(优先级低于行内 span) */
870
459
  grid?: Record<string, any> | undefined;
871
460
  }>, {
872
461
  config: () => never[];
@@ -883,25 +472,33 @@ export declare const OrcForm: __VLS_WithTemplateSlots_5< DefineComponent<Extract
883
472
  }>>, {
884
473
  onSubmit: typeof onSubmit;
885
474
  onReset: (defValue?: Partial<any> | undefined) => void;
886
- resetFields(): void;
475
+ resetFields: typeof resetFields;
887
476
  }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
888
477
  error: (...args: any[]) => void;
889
478
  submit: (...args: any[]) => void;
890
479
  "update:modelValue": (...args: any[]) => void;
891
480
  }, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults_5<__VLS_TypePropsToRuntimeProps_5<{
481
+ /** 表单字段配置数组 */
892
482
  config?: OrcFormItem[] | undefined;
483
+ /** 标签宽度,默认 '110px' */
893
484
  labelWidth?: string | undefined;
485
+ /** 标签对齐方式,默认 'right' */
894
486
  labelAlign?: "left" | "right" | undefined;
487
+ /** 提交按钮加载状态 */
895
488
  loading?: boolean | undefined;
489
+ /** 是否禁用整个表单 */
896
490
  disabled?: boolean | undefined;
491
+ /** 是否隐藏提交按钮 */
897
492
  hideSubmit?: boolean | undefined;
493
+ /** 表单数据(v-model) */
898
494
  modelValue?: Record<string, any> | undefined;
899
495
  /** 栅格间距 */
900
496
  gutter?: number | undefined;
901
- /** 栅格 24 */
497
+ /** 每行栅格数(基于 24 栅格),默认 24 */
902
498
  span?: number | undefined;
499
+ /** 透传到 Arco Form 组件的 props */
903
500
  formAttr?: Record<string, any> | undefined;
904
- /** 栅格grid 优先级低于行 span */
501
+ /** 栅格 grid 配置(优先级低于行内 span) */
905
502
  grid?: Record<string, any> | undefined;
906
503
  }>, {
907
504
  config: () => never[];
@@ -921,8 +518,8 @@ export declare const OrcForm: __VLS_WithTemplateSlots_5< DefineComponent<Extract
921
518
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
922
519
  }>, {
923
520
  grid: Record<string, any>;
924
- loading: boolean;
925
521
  disabled: boolean;
522
+ loading: boolean;
926
523
  modelValue: Record<string, any>;
927
524
  span: number;
928
525
  config: OrcFormItem[];
@@ -936,10 +533,7 @@ export declare const OrcForm: __VLS_WithTemplateSlots_5< DefineComponent<Extract
936
533
  value?: any;
937
534
  setValue?: ((v: any) => void) | undefined;
938
535
  options?: any;
939
- utils: OrcFormUtil & {
940
- model: string;
941
- getFormItem: () => OrcFormItem;
942
- } & Pick<OrcFormUtil, "onChange" | "onMounted">;
536
+ utils: OrcFormUtilBind;
943
537
  componentAttr: RecordAny_3;
944
538
  }) => any>> & {
945
539
  row?(_: {
@@ -993,80 +587,148 @@ export declare const OrcFormButton: __VLS_WithTemplateSlots_6< DefineComponent<E
993
587
  }>;
994
588
 
995
589
  /**
996
- * 表单配置项类型定义
997
- * @description 描述表单字段的元数据和行为规则
590
+ * 表单配置项
591
+ * @description 通过 `:config` 传递给 `<orc-form>` 的数组项,描述每个字段
592
+ * @example
593
+ * ```ts
594
+ * { type: 'a-input', model: 'name', name: '姓名', defaultValue: '',
595
+ * options: { required: true, placeholder: '请输入' } }
596
+ * ```
998
597
  */
999
598
  export declare type OrcFormItem = {
1000
599
  /**
1001
600
  * 组件类型标识
1002
- * @description 支持 Arco 内置组件或自定义 Vue 组件
601
+ * @description
602
+ * - 字符串: Arco 内置组件名,如 `'a-input'`、`'a-select'`、`'a-date-picker'`、`'a-switch'` 等
603
+ * - 组件对象: 自定义 Vue 组件或 `defineAsyncComponent`
604
+ * - 自定义组件时自动注入 `modelValue` / `updateModelValue` 实现 v-model
605
+ * - 自定义组件额外注入 `utils` prop(类型为 `OrcFormUtilBind`)
1003
606
  * @example
1004
- * - 内置组件: 'a-input'
1005
- * - 自定义组件: defineAsyncComponent(() => import('./custom-component.vue'))
607
+ * ```ts
608
+ * type: 'a-input'
609
+ * type: 'a-select'
610
+ * type: 'a-date-picker'
611
+ * type: 'a-textarea'
612
+ * type: defineAsyncComponent(() => import('./CustomPicker.vue'))
613
+ * ```
1006
614
  */
1007
615
  type?: string | Component;
1008
616
  /** 表单项标签文本 */
1009
617
  name?: string;
1010
- /** 关联数据模型键名 */
1011
- model?: OrcFormUtil['model'];
1012
- /** 是否渲染该表单项 */
1013
- show?: boolean;
1014
618
  /**
1015
- * 字段默认值
1016
- * @description 根据组件类型自动进行类型推断
619
+ * 关联数据字段名
620
+ * @description 对应 model 对象中的 key
1017
621
  */
622
+ model?: string;
623
+ /** 是否渲染该字段,默认 true。可通过 `util.setShow(model, bool)` 动态控制 */
624
+ show?: boolean;
625
+ /** 字段初始值,不传则默认为 null */
1018
626
  defaultValue?: Exclude<ComponentAttrValue, ComponentAttrHandler>;
1019
- /** 验证触发时机 */
627
+ /** 校验触发时机(仅当 Arco 组件支持时有效) */
1020
628
  validateTrigger?: 'change' | 'input' | 'focus' | 'blur';
1021
- /** 组件原生属性配置 */
629
+ /**
630
+ * 组件原型属性透传
631
+ * @description 透传到 Arco 组件或自定义组件的 props
632
+ * @note
633
+ * - 值可以是静态值,也可以是一个函数 `(util, index?) => value`,函数会在渲染时执行
634
+ * - 当 `type` 为 Arco 字符串时,可传 Arco 组件对应的 props:
635
+ * - `'a-input'` → `maxLength`, `showWordLimit`, `allowClear` 等
636
+ * - `'a-select'` → `options`, `allowSearch`, `multiple`, `maxTagCount` 等
637
+ * - `'a-date-picker'` → `format`, `showTime`, `disabledDate` 等
638
+ * - `'a-input-number'` → `min`, `max`, `precision`, `step` 等
639
+ * - `'a-switch'` → `checkedValue`, `uncheckedValue` 等
640
+ * - `'a-radio-group'` → `options`, `direction` 等
641
+ * - `'a-textarea'` → `maxLength`, `showWordLimit`, `autoSize` 等
642
+ * - `'a-tree-select'` → `treeData`, `allowSearch`, `treeCheckable` 等
643
+ * @example
644
+ * ```ts
645
+ * // 静态值
646
+ * componentAttr: { min: 0, max: 100 }
647
+ * // 函数值(渲染时执行)
648
+ * componentAttr: { disabled: (util) => util.getModel('type') === 'readonly' }
649
+ * ```
650
+ */
1022
651
  componentAttr?: Record<string, ComponentAttrValue>;
1023
652
  /**
1024
- * 表单项容器属性
1025
- * @see FormItemInstance 查看可用属性
653
+ * Arco FormItem 容器属性透传
654
+ * @description 对应 FormItem 组件的 props,如 `labelColFlex`, `rules`, `disabled`, `help`, `extra` 等
655
+ * @see https://arco.design/vue/component/form#API
1026
656
  */
1027
657
  itemAttr?: FormItemInstance['$props'];
1028
658
  /**
1029
- * 自定义类名配置
1030
- * @description 支持响应式配置函数
1031
- * @param itemConfig - 当前表单项配置
1032
- * @param models - 表单数据模型
659
+ * 自定义行 class
660
+ * @description 支持静态字符串或动态函数
661
+ * @example
662
+ * ```ts
663
+ * customClass: 'my-field'
664
+ * customClass: (item, models) => models.age > 18 ? 'adult' : 'minor'
665
+ * ```
1033
666
  */
1034
667
  customClass?: string | ((itemConfig: OrcFormItem, models: RecordAny_3) => string);
1035
668
  /**
1036
- * 多值序列化配置
1037
- * @description 开启后自动将数组转换为逗号分隔字符串
1038
- * @note 需要组件原生支持多选模式 (需同时配置 componentAttr.multiple)
669
+ * 多值逗号序列化
670
+ * @description 开启后自动将 `string[]` 序列化为逗号分隔字符串存储,读取时反序列化为数组
671
+ * @note 组件需支持多选(如 `a-select` 需配置 `componentAttr: { multiple: true }`)
1039
672
  */
1040
673
  dotNotation?: boolean;
1041
- /** 数据字典系统编码 */
674
+ /** 数据字典编码(配合 OrcPinia 字典 store 使用) */
1042
675
  datadict?: string;
1043
- /** 字段级配置选项 */
676
+ /** 字段级配置 */
1044
677
  options?: {
1045
- /** 必填标识 */
678
+ /** 必填标识(显示红色星号) */
1046
679
  required?: boolean;
1047
- /** 栅格布局宽度 (基于24栅格系统) */
680
+ /** 栅格宽度(基于 24 栅格) */
1048
681
  span?: number;
1049
682
  /** 栅格偏移量 */
1050
683
  offset?: number;
1051
- /** 禁用状态 */
684
+ /** 禁用 */
1052
685
  disabled?: boolean;
1053
- /** 输入占位符 */
686
+ /** 占位文本 */
1054
687
  placeholder?: string;
1055
- /** 帮助说明文案 */
688
+ /** 帮助说明(显示在表单项下方) */
1056
689
  help?: string;
1057
- /** 悬浮提示内容 */
690
+ /** tooltip 提示 */
1058
691
  tooltip?: string;
1059
- /** 选择器选项列表 */
692
+ /** 选择器数据源(仅对 select / radio-group 等选择类组件有效) */
1060
693
  options?: SelectOptionData[];
1061
694
  };
1062
695
  /**
1063
- * 验证规则配置
1064
- * @description 支持静态配置或动态规则生成函数
696
+ * 校验规则
697
+ * @description 支持 Arco Form 校验规则数组,或返回规则数组的函数
698
+ * @example
699
+ * ```ts
700
+ * rules: [{ required: true, message: '必填' }]
701
+ * rules: (item, util) => [{ required: true, message: '请选择' }]
702
+ * ```
1065
703
  */
1066
704
  rules?: RecordAny_3[] | ((val: OrcFormItem, util: OrcFormUtil) => RecordAny_3[]);
1067
- /** 表单事件处理器 */
1068
- events?: Pick<OrcFormUtil, 'onMounted' | 'onChange'>;
1069
- /** 扩展说明字段 */
705
+ /**
706
+ * 字段事件
707
+ * @description
708
+ * - `onMounted`: 组件挂载时触发,可用于异步加载选项
709
+ * - `onChange`: 值变化时触发,可用于联动、清空等
710
+ * @example
711
+ * ```ts
712
+ * events: {
713
+ * async onMounted(util) {
714
+ * // 异步加载下拉选项
715
+ * const res = await fetchOptions();
716
+ * util.setModelOption(util.model, res);
717
+ * },
718
+ * onChange(val, util) {
719
+ * // radio 切换联动
720
+ * const isTypeA = util.getModel(util.model) === 'A';
721
+ * util.setShow('fieldX', isTypeA);
722
+ * util.setShow('fieldY', !isTypeA);
723
+ * },
724
+ * }
725
+ * ```
726
+ */
727
+ events?: {
728
+ onMounted?: (util: OrcFormUtilBind) => any | Promise<any>;
729
+ onChange?: (val: any, util: OrcFormUtilBind) => void | Promise<void>;
730
+ };
731
+ /** 内部备注字段 */
1070
732
  note?: string;
1071
733
  };
1072
734
 
@@ -1077,64 +739,93 @@ export declare const OrcFormSpace: __VLS_WithTemplateSlots_7< DefineComponent<{}
1077
739
  }>;
1078
740
 
1079
741
  /**
1080
- * 表单提交数据结构
742
+ * 表单提交事件数据结构
743
+ * @description OrcForm 的 `@submit` 事件回调参数
744
+ * @example
745
+ * ```ts
746
+ * @submit="({ data, utils }) => {
747
+ * utils.setLoading(true);
748
+ * await save(data);
749
+ * utils.setLoading(false);
750
+ * utils.setVisible(false);
751
+ * }"
752
+ * ```
1081
753
  */
1082
754
  export declare type OrcFormSubmit = {
1083
- /** 表单数据集合 */
755
+ /** 表单数据 */
1084
756
  data: RecordAny_3;
1085
- /** 表单工具方法 */
757
+ /** 表单工具 */
1086
758
  utils: {
1087
- /** 控制提交弹窗可见性 */
1088
- setVisible: (a: boolean) => void;
1089
- /** 控制加载状态 */
1090
- setLoading: (a: boolean) => void;
759
+ /** 关闭弹窗(弹窗表单模式下有效) */
760
+ setVisible: (visible: boolean) => void;
761
+ /** 设置加载状态,submit 按钮显示 loading */
762
+ setLoading: (loading: boolean) => void;
1091
763
  };
1092
764
  };
1093
765
 
1094
766
  export declare const OrcFormTable: Component<any, any, any, ComputedOptions, MethodOptions, {}, any>;
1095
767
 
768
+ /**
769
+ * 表单工具方法集合
770
+ * @description 通过 OrcForm 的 slot 或 OrcFormItem events 回调中获取
771
+ */
1096
772
  declare type OrcFormUtil = {
1097
773
  /**
1098
- * 获取/查询选项数据
1099
- * @overload@overload 获取指定模型的选项列表
1100
- * @param model - 模型标识符
774
+ * 获取已注册的选择器选项列表
775
+ * @param model - 字段 model
1101
776
  */
1102
777
  getModelOption(model: string): SelectOptionData[];
1103
778
  /**
1104
- * @overload@overload 根据值查找特定选项
1105
- * @param model - 模型标识符
1106
- * @param val - 要查找的选项值
1107
- * @returns 匹配的选项对象
779
+ * 根据值查找选项
780
+ * @param model - 字段 model
781
+ * @param val - 要查找的 value
1108
782
  */
1109
783
  getModelOption(model: string, val: string): SelectOptionData;
1110
- /** 读取所有内容 */
1111
- getModels: () => any;
1112
- /** 获取指定模型的值 */
784
+ /** 获取表单所有字段的当前值 */
785
+ getModels: () => RecordAny_3;
786
+ /** 获取指定字段的当前值 */
1113
787
  getModel: (model: string) => any;
1114
- /** 检查指定模型是否可见 */
788
+ /** 检查指定字段是否可见 */
1115
789
  getShow: (model: string) => boolean;
1116
- /** 设置指定模型的选项数据 */
1117
- setModelOption: (model: string, val: any) => void;
790
+ /** 动态更新指定字段的选择器选项 */
791
+ setModelOption: (model: string, val: SelectOptionData[]) => void;
792
+ /**
793
+ * 设置字段值
794
+ * @param model - 字段 model,或 `{ key: value }` 批量设置对象
795
+ * @param value - 当 model 为字符串时的值
796
+ * @example
797
+ * ```ts
798
+ * util.setModel('name', '张三')
799
+ * util.setModel({ name: '张三', age: 18 })
800
+ * ```
801
+ */
802
+ setModel: (model: string | RecordAny_3, value?: any) => void;
1118
803
  /**
1119
- * 设置模型值
1120
- * @param c - 模型键名或键值对对象
1121
- * @param v - 当第一个参数为键名时使用的值
804
+ * 控制字段的显示/隐藏
805
+ * @param model - 字段 model 或数组
806
+ * @param val - true 显示,false 隐藏
1122
807
  */
1123
- setModel: (c: string | RecordAny_3, v?: any) => void;
1124
- /** 控制模型可见性 */
1125
808
  setShow: (model: string | string[], val: boolean) => void;
1126
- /** 用于双向数据绑定的模型属性 */
809
+ /** 当前字段的 model 名(仅在 events 回调中可用) */
1127
810
  model?: string;
1128
- /** 组件挂载后执行 */
811
+ /** 组件挂载时触发(仅当定义在 events 中时) */
1129
812
  onMounted?: (util: OrcFormUtilBind) => any | Promise<any>;
1130
- /** 值改变时触发 */
813
+ /**
814
+ * 值变化时触发(仅当定义在 events 中时)
815
+ * @param val - 新值
816
+ * @param util - 表单工具
817
+ */
1131
818
  onChange?: (val: any, util: OrcFormUtilBind) => void | Promise<void>;
1132
819
  };
1133
820
 
821
+ /**
822
+ * OrcFormUtil 的绑定版
823
+ * @description 在 events 回调中获取,比 OrcFormUtil 多了 `model`(当前字段名)和 `getFormItem`(当前配置项)
824
+ */
1134
825
  declare type OrcFormUtilBind = OrcFormUtil & {
1135
826
  model: string;
1136
827
  getFormItem: () => OrcFormItem;
1137
- } & OrcFormItem['events'];
828
+ };
1138
829
 
1139
830
  export declare const OrcHiddenView: __VLS_WithTemplateSlots_2< DefineComponent<ExtractPropTypes<__VLS_WithDefaults_2<__VLS_TypePropsToRuntimeProps_2<{
1140
831
  isShow?: boolean | undefined;
@@ -1503,36 +1194,54 @@ export declare const OrcSearch: __VLS_WithTemplateSlots_4< DefineComponent<Extra
1503
1194
  default?(_: {}): any;
1504
1195
  }>;
1505
1196
 
1197
+ /**
1198
+ * OrcSearch 搜索项配置
1199
+ * @description 定义搜索栏每一维度的字段类型、默认值、选项数据
1200
+ * @example
1201
+ * ```ts
1202
+ * { type: 'input', name: 'name', label: '名称' }
1203
+ * { type: 'select', name: 'status', label: '状态', options: [{ label: '启用', value: '1' }] }
1204
+ * { type: 'date', name: 'range', label: '日期范围', multiple: true }
1205
+ * { type: 'number', name: 'num', label: '数字', min: 0, max: 100 }
1206
+ * ```
1207
+ */
1506
1208
  export declare interface OrcSearchItem extends RecordAny {
1507
- /** input 类型 */
1508
- type?: string;
1509
- /** 同form [name] */
1209
+ /**
1210
+ * 搜索组件类型
1211
+ * @description 支持以下类型:
1212
+ * - `'input'` — 文本输入框
1213
+ * - `'select'` — 下拉选择器(配合 `options` 传入选项列表)
1214
+ * - `'date'` — 日期选择器(配合 `multiple: true` 可实现日期范围)
1215
+ * - `'number'` — 数字输入框(配合 `min`/`max` 限制范围)
1216
+ */
1217
+ type?: 'input' | 'select' | 'date' | 'number';
1218
+ /** 字段名(对应提交数据的 key) */
1510
1219
  name: string;
1511
- /** 标签名称 */
1220
+ /** 显示标签 */
1512
1221
  label: string;
1513
- /** 初始值 */
1222
+ /** 初始值。`multiple: true` 时支持逗号分隔字符串如 `'2024-01,2024-12'` */
1514
1223
  defaultValue?: string | boolean | number | string[];
1515
- /** 默认是显示 */
1224
+ /** 是否显示该搜索项,默认 true */
1516
1225
  show?: boolean;
1517
- /** type =number 最小值 */
1226
+ /** 数字最小值(type=number) */
1518
1227
  min?: number;
1519
- /** type =number 最大值 */
1228
+ /** 数字最大值(type=number) */
1520
1229
  max?: number;
1521
- /** type=select | type=date */
1230
+ /** 是否开启多选/范围模式(type=select 或 type=date) */
1522
1231
  multiple?: boolean;
1523
- /** type=select */
1232
+ /** 选择器选项列表(type=select) */
1524
1233
  options?: {
1525
1234
  label: string;
1526
1235
  value: string;
1527
1236
  disabled?: boolean;
1528
1237
  }[];
1529
- /** type=date */
1238
+ /** 日期格式化(type=date),如 `'YYYY-MM-DD'` */
1530
1239
  format?: string;
1531
- /** type=date */
1240
+ /** 日期是否包含时间选择(type=date) */
1532
1241
  showTime?: boolean;
1533
- /** 必填 */
1242
+ /** 是否必填 */
1534
1243
  required?: boolean;
1535
- /** 表单验证 */
1244
+ /** 校验规则 */
1536
1245
  rules?: RecordAny | RecordAny[];
1537
1246
  }
1538
1247
 
@@ -1551,16 +1260,17 @@ export declare const OrcTable: __VLS_WithTemplateSlots_3< DefineComponent<Extrac
1551
1260
  getSelection(): RecordAny_2[];
1552
1261
  getCheckboxKeySelection(keys?: string[] | undefined): RecordAny_2[];
1553
1262
  getReserveSelection(): RecordAny_2[];
1554
- clearSelection(): void;
1263
+ clearSelection(): void; /** 计算分页信息 */
1555
1264
  insertRow(record: RecordAny_2, row?: number | RecordAny_2 | undefined, isNext?: boolean | undefined): Promise<{
1556
- row: any;
1557
- rows: any;
1265
+ row: RecordAny_2;
1266
+ rows: RecordAny_2[];
1558
1267
  }>;
1559
1268
  removeRows(): void;
1560
1269
  validate(list?: RecordAny_2[] | undefined): Promise<[string, RecordAny_2[]]>;
1561
1270
  getRowSeq(row: any): string | number;
1562
1271
  getRowIndex(row: any): number;
1563
1272
  removerRowIndex(rowIndex: number): void;
1273
+ setSelectionRow(row: any, bool?: boolean | undefined): void;
1564
1274
  loading: Ref<boolean, boolean>;
1565
1275
  setLoading: typeof setLoading;
1566
1276
  /** 执行搜索 ,是否返回第一页 */
@@ -1613,49 +1323,120 @@ export declare const OrcTable: __VLS_WithTemplateSlots_3< DefineComponent<Extrac
1613
1323
  footer?(_: {}): any;
1614
1324
  }>;
1615
1325
 
1326
+ /**
1327
+ * 表格组件暴露方法
1328
+ * @description `<orc-table ref="tableRef">` 可调用的方法
1329
+ */
1616
1330
  declare interface OrcTableExpose extends TableGridTwoType {
1331
+ /** 是否正在加载数据 */
1617
1332
  loading: boolean;
1333
+ /** 手动设置加载状态 */
1618
1334
  setLoading: (loading?: boolean) => void;
1619
- /** 请求数据 */
1620
- dataInit: () => Promise<void>;
1621
- /** 重置表单数据 */
1335
+ /** 请求服务端数据(如配置 url),可传 true 跳回第一页 */
1336
+ dataInit: (isFirst?: boolean) => Promise<void>;
1337
+ /** 加载静态数据并刷新表格 */
1622
1338
  loadData: (list: RecordAny_2[]) => void;
1623
1339
  }
1624
1340
 
1625
- /** column type */
1341
+ /**
1342
+ * 表格列配置
1343
+ * @description 定义每一列的数据映射、显示格式、编辑方式
1344
+ */
1626
1345
  export declare interface OrcTableItem extends RecordAny_2 {
1346
+ /** 是否显示该列,默认 true */
1627
1347
  show?: boolean;
1348
+ /** 数据字段名(必填) */
1628
1349
  dataIndex: string;
1350
+ /** 列标题 */
1629
1351
  title?: string;
1352
+ /** 列宽度(像素) */
1630
1353
  width?: number;
1354
+ /** 是否可排序 */
1631
1355
  sort?: boolean;
1632
- /** 开启编辑 */
1633
- cell?: boolean | Component;
1634
- /** @example
1635
- * <a-badge status="normal" text="Normal" />
1636
- * status: normal|processing|success|warning|danger
1356
+ /**
1357
+ * 单元格渲染模式
1358
+ * @description
1359
+ * - `true` — 开启行内编辑模式(配合 edit-render)
1360
+ * - `Component` — 渲染为指定组件(如 Badge、Tag),配合 `cellAttr` 传参
1361
+ * - `VNode` — 渲染为 VNode 内容
1362
+ * @example
1363
+ * ```ts
1364
+ * // 行内编辑
1365
+ * { cell: true }
1366
+ * // 渲染为组件
1367
+ * { cell: Badge, div: true, cellAttr: { text: (v) => v.value, status: (v) => 'success' } }
1368
+ * // 渲染为 VNode
1369
+ * { cell: h('div', '自定义内容') }
1370
+ * ```
1371
+ */
1372
+ cell?: boolean | Component | VNode;
1373
+ /**
1374
+ * 组件属性(当 cell 为 Component 时使用)
1375
+ * @description 每个 key 可以是静态值或函数,函数接收 `{ record, value, rowIndex, columnIndex, updateValue, formatValue }`
1376
+ * @example
1377
+ * ```ts
1378
+ * { cell: Badge, div: true, cellAttr: {
1379
+ * text: ({ value }) => value ? '启用' : '禁用',
1380
+ * status: ({ value }) => value ? 'success' : 'normal',
1381
+ * } }
1382
+ * ```
1637
1383
  */
1638
1384
  cellAttr?: {
1639
- [key: string]: (v1: Record<'record' | 'dataIndex' | 'rowIndex' | 'columnIndex' | 'value' | 'updateValue' | 'formatValue', any>) => unknown;
1385
+ [key: string]: (v1: {
1386
+ record: RecordAny_2;
1387
+ value: any;
1388
+ rowIndex: number;
1389
+ columnIndex: number;
1390
+ updateValue: (val: any) => void;
1391
+ formatValue: string;
1392
+ }) => unknown;
1640
1393
  } | {
1641
1394
  [key: string]: unknown;
1642
1395
  };
1396
+ /**
1397
+ * 渲染模式(仅在 cell 为 Component 时有效)
1398
+ * @description `true` 时在 `#default` 插槽渲染组件,而非仅在编辑模式下显示
1399
+ */
1643
1400
  div?: boolean;
1644
- /** 没内容时候得提示 */
1401
+ /** 空数据占位文本 */
1645
1402
  placeholder?: string;
1403
+ /** 单元格文字超出是否以 tooltip 展示 */
1646
1404
  tooltip?: boolean;
1405
+ /** 是否显示省略号 */
1647
1406
  ellipsis?: boolean;
1407
+ /** 列对齐方式 */
1648
1408
  align?: VxeColumnPropTypes.Align;
1409
+ /** 表头对齐方式 */
1649
1410
  headerAlign?: VxeColumnPropTypes.HeaderAlign;
1411
+ /** 表尾对齐方式 */
1650
1412
  footerAlign?: VxeColumnPropTypes.FooterAlign;
1413
+ /** 固定列方向 */
1414
+ fixed?: 'left' | 'right';
1415
+ /**
1416
+ * 行数据格式化
1417
+ * @param val 原始值
1418
+ * @param record 整行数据
1419
+ * @returns 格式化后的显示文本
1420
+ */
1651
1421
  format?: (val: any, record?: RecordAny_2) => string;
1422
+ /**
1423
+ * 行内样式
1424
+ * @description 支持静态对象或根据行数据动态返回
1425
+ */
1652
1426
  style?: CssType | ((record: RecordAny_2) => CssType);
1653
- /** 同 :title-prefix "{ content: '必填', icon: 'vxe-cell--required-icon' }" */
1427
+ /** 标题帮助提示(同 vxe-table title-prefix) */
1654
1428
  help?: VxeColumnPropTypes.TitlePrefix;
1429
+ /** 列过滤条件列表 */
1430
+ filters?: VxeColumnPropTypes.Filters;
1431
+ /** 是否支持多选过滤 */
1432
+ filterMultiple?: boolean;
1433
+ /** 自定义过滤方法 */
1434
+ filterMethod?: VxeColumnPropTypes.FilterMethod;
1655
1435
  }
1656
1436
 
1657
1437
  /**
1658
- * table option type
1438
+ * 表格配置项
1439
+ * @description 传递给 `<orc-table :option>` 的完整配置
1659
1440
  * @example
1660
1441
  * ```ts
1661
1442
  * {
@@ -1663,88 +1444,133 @@ export declare interface OrcTableItem extends RecordAny_2 {
1663
1444
  * scrollY: { enabled: true },
1664
1445
  * columns: [
1665
1446
  * { dataIndex: 'index', title: '序', width: 26 },
1666
- * ]
1447
+ * ],
1448
+ * selectedType: 'checkbox',
1449
+ * selectedTrigger: 'row',
1667
1450
  * }
1668
1451
  * ```
1669
1452
  */
1670
1453
  export declare interface OrcTableOption extends RecordAny_2 {
1671
- /** 可使用 `orc-provider` 全局注入 */
1454
+ /**
1455
+ * 异步请求封装函数
1456
+ * @description 需通过 `orc-provider` 全局注入,或直接传入
1457
+ */
1672
1458
  useErrData?: <T = RecordAny_2>(config: RecordAny_2) => Promise<[boolean, T]>;
1673
- /** 请求地址 */
1459
+ /** 服务端分页请求地址,不传则使用静态数据 */
1674
1460
  url?: string;
1675
- /** 请求类型 */
1461
+ /** 请求方法 */
1676
1462
  method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
1677
- /** 是否保留多选状态 */
1463
+ /** 是否保留跨页多选状态 */
1678
1464
  reserve?: boolean;
1679
- /** 原 checkbox-config.checkField 在行中存储 bool 值,不存在则无效 */
1465
+ /** 原 vxe-table checkbox-config.checkField,行中存储多选 bool 值的字段名 */
1680
1466
  checkKey?: string;
1681
- /** 行主键[自动生成] */
1467
+ /**
1468
+ * 行主键字段名
1469
+ * @default '_X_ROW_KEY'
1470
+ */
1682
1471
  rowKey?: string;
1683
- /** 多选时 同kay选择 */
1472
+ /**
1473
+ * 多选联动 key
1474
+ * @description 有此值时,同一 key 的行会联动选中/取消
1475
+ */
1684
1476
  checkboxKey?: string;
1685
- /** 自定义列 同 resolveColumns() */
1477
+ /** 列配置 */
1686
1478
  columns: OrcTableItem[];
1687
- /** 默认分页条数 */
1479
+ /** 默认每页条数 */
1688
1480
  pageSize?: number;
1689
- /** 默认分页列表 */
1481
+ /** 每页条数选项列表 */
1690
1482
  pageSizeOptions?: number[];
1691
- /** 开启行选中 */
1483
+ /** 行选中类型 */
1692
1484
  selectedType?: 'checkbox' | 'radio';
1693
- /** 触发方式 */
1485
+ /** 选中触发方式 */
1694
1486
  selectedTrigger?: 'cell' | 'row' | 'default';
1695
- /** 行必填数据 指定 [dataIndex] */
1487
+ /** 行必填字段名列表(用于行校验高亮) */
1696
1488
  requiredKeys?: string[];
1697
- /** 表单组件第一次自动请求接口 */
1489
+ /** 首次自动请求数据(url 模式),默认 true */
1698
1490
  firstLoad?: boolean;
1699
- /** 原来 show-overflow ellipsis(只显示省略号), title(并且显示为原生 title), tooltip(并且显示为 tooltip 提示) */
1491
+ /**
1492
+ * 单元格溢出行为
1493
+ * @description 'ellipsis' — 省略号,'title' — 原生 title,'tooltip' — tooltip 提示
1494
+ */
1700
1495
  tooltip?: ('ellipsis' | 'title' | 'tooltip') | boolean;
1701
- /** 原来 show-footer-overflow ellipsis(只显示省略号), title(并且显示为原生 title), tooltip(并且显示为 tooltip 提示) */
1496
+ /** 表尾单元格溢出行为,同 tooltip 参数 */
1702
1497
  footerTooltip?: ('ellipsis' | 'title' | 'tooltip') | boolean;
1703
- /** 给表头单元添加 style : ({ column, columnIndex })=> {} , dataIndex as column.property */
1704
- headerStyle?: (record: RecordAny_2 & {
1498
+ /**
1499
+ * 表头样式
1500
+ * @param record - 包含 `{ column, columnIndex }`,dataIndex 在 column.property 中
1501
+ */
1502
+ headerStyle?: (record: {
1705
1503
  column: {
1706
1504
  property: string;
1707
1505
  } & RecordAny_2;
1506
+ columnIndex: number;
1708
1507
  }) => CssType;
1709
- /** 给表尾单元添加 style : any | (({ $rowIndex, column, columnIndex, $columnIndex }) => any) */
1710
- footerStyle?: (record: RecordAny_2 & {
1508
+ /**
1509
+ * 表尾样式
1510
+ * @param record - 包含 `{ $rowIndex, column, columnIndex, $columnIndex }`
1511
+ */
1512
+ footerStyle?: (record: {
1513
+ $rowIndex: number;
1711
1514
  column: {
1712
1515
  property: string;
1713
1516
  } & RecordAny_2;
1517
+ columnIndex: number;
1518
+ $columnIndex: number;
1714
1519
  }) => CssType;
1715
- /** 表尾的数据获取方法,返回一个二维数组 (columns, data) => string[][] */
1520
+ /**
1521
+ * 表尾合计方法
1522
+ * @returns 二维数组,外层对应表尾行,内层对应每列
1523
+ * @see useOrcTableFooter 快速使用
1524
+ */
1716
1525
  footerMethod?: VxeTablePropTypes.FooterMethod;
1717
- /** 同 merge-footer-items 临时合并表尾 (不能用于展开行,不建议用于固定列、树形结构) */
1526
+ /** 表尾合并配置(不能与展开行、固定列、树形结构同时使用) */
1718
1527
  mergeFooter?: VxeTablePropTypes.MergeFooterItems;
1719
- /** 自定义列 同 columns */
1528
+ /** 列预处理函数,在 columns 渲染前执行 */
1720
1529
  resolveColumns?: (columns?: OrcTableItem[]) => OrcTableItem[];
1721
- /** 计算总条目 */
1530
+ /** 计算总条目数(服务端分页) */
1722
1531
  resolveTotal?: (e: RecordAny_2) => number;
1723
- /** 请求超时时间 */
1532
+ /** 请求超时时间(毫秒) */
1724
1533
  timeout?: number;
1725
- /** 静态参数 */
1534
+ /** 固定请求参数,会与分页参数合并发送 */
1726
1535
  data?: RecordAny_2;
1727
- /** 自定义分页 */
1728
- resolvePage?: (page?: RecordAny_2) => any;
1729
- /** 自定义数据 */
1536
+ /**
1537
+ * 自定义分页参数
1538
+ * @param page - `{ page, size }` 分页信息,可扩展额外参数
1539
+ * @returns 发送到接口的分页参数对象
1540
+ */
1541
+ resolvePage?: (page: RecordAny_2) => any;
1542
+ /**
1543
+ * 解析接口返回的数据列表
1544
+ * @param data - 接口原始返回值
1545
+ * @param page - `{ page, size }` 当前分页信息
1546
+ * @returns 表格行数据数组
1547
+ */
1730
1548
  resolveData?: (data: RecordAny_2, page?: RecordAny_2) => RecordAny_2[];
1731
- /** 数据请求成功 */
1549
+ /** 数据请求成功回调 */
1732
1550
  success?: (data?: any) => void;
1733
- /** 数据请求失败 */
1551
+ /** 数据请求失败回调 */
1734
1552
  error?: (data?: any) => void;
1735
- /** 开启重复行省略 group by */
1553
+ /**
1554
+ * 皮肤行分组字段
1555
+ * @description 相同值的行合并显示,开启后重复行隐藏相同内容
1556
+ */
1736
1557
  skinRow?: string;
1737
- /** 非重复行且未被跳过的样式 */
1558
+ /** 皮肤行样式(非重复行且未被跳过时应用) */
1738
1559
  skinRowStyle?: CssType;
1739
- /** 重复行显示内容 */
1560
+ /** 被隐藏的重复行显示文字 */
1740
1561
  skinRowText?: string;
1741
- /** 同 edit-rules , demo : { sex: [ { required: true, message: '性别必须填写' } ] } */
1562
+ /**
1563
+ * 行编辑校验规则
1564
+ * @example { sex: [{ required: true, message: '性别必须填写' }] }
1565
+ */
1742
1566
  rules?: VxeTablePropTypes.EditRules;
1743
- /** 横向虚拟滚动配置 { enabled, gt } */
1567
+ /** 横向虚拟滚动 */
1744
1568
  scrollX?: VxeTablePropTypes.ScrollX;
1745
- /** 纵向虚拟滚动配置 { enabled, gt } */
1569
+ /** 纵向虚拟滚动 */
1746
1570
  scrollY?: VxeTablePropTypes.ScrollY;
1571
+ /** 选中模式附加属性 */
1747
1572
  selectedProps?: any;
1573
+ /** 透传 vxe-table 原生 props */
1748
1574
  tableProps?: TableInstance['$props'];
1749
1575
  }
1750
1576
 
@@ -1753,32 +1579,32 @@ declare interface Props {
1753
1579
  }
1754
1580
 
1755
1581
  declare type Props_2 = {
1756
- /** 表格标题 */
1582
+ /** 表格标题,显示在工具栏左侧 */
1757
1583
  title?: string;
1758
- /** 高 */
1584
+ /** 表格高度(像素或百分比) */
1759
1585
  height?: number | string;
1760
1586
  /** 多语言 */
1761
1587
  locale?: I18nType;
1762
1588
  /** 是否隐藏工具栏 */
1763
1589
  hideToolbar?: boolean;
1764
- /** 是否隐藏设置按钮 */
1590
+ /** 是否隐藏列设置按钮 */
1765
1591
  hideSetting?: boolean;
1766
- /** 是否隐藏分页 */
1592
+ /** 是否隐藏底部分页 */
1767
1593
  hidePagination?: boolean;
1768
- /** 是否启用悬停效果,默认值为 true */
1594
+ /** 是否启用行悬停效果,默认 true */
1769
1595
  isHover?: boolean;
1770
- /** 表格尺寸,可选值为 'medium' | 'small' | 'mini',默认值为 'mini' */
1596
+ /** 表格尺寸 */
1771
1597
  size?: 'large' | 'medium' | 'small' | 'mini';
1772
- /** 用户选择的列表,默认值为空数组 */
1598
+ /** 选中行 key 列表(v-model) */
1773
1599
  selectedKeys?: string[];
1774
- /** 数据源,默认值为空数组 */
1600
+ /** 静态数据源 */
1775
1601
  data?: RecordAny_2[];
1776
- /** 配置文件,默认值为 { columns: [] } */
1602
+ /** 表格配置 */
1777
1603
  option?: OrcTableOption;
1778
1604
  /**
1779
- * 用户保存数据钩子函数
1780
- * - getColumn: 异步获取列配置,返回一个包含布尔值和列数据的元组
1781
- * - setColumn: 设置列配置
1605
+ * 列配置持久化钩子
1606
+ * - getColumn: 异步获取用户保存的列配置,返回 `[err, columns]`
1607
+ * - setColumn: 保存用户调整后的列配置
1782
1608
  */
1783
1609
  hook?: {
1784
1610
  getColumn: () => Promise<[boolean, RecordAny_2[]]>;
@@ -1838,6 +1664,8 @@ declare type RecordAny_2 = Record<string, any>;
1838
1664
  /** 通用对象类型 (键值对形式) */
1839
1665
  declare type RecordAny_3 = Record<string, any>;
1840
1666
 
1667
+ declare function resetFields(): void;
1668
+
1841
1669
  /**
1842
1670
  * set path object
1843
1671
  * @example
@@ -1851,45 +1679,63 @@ export declare function setData(object: RecordAny, path: string, defaultValue?:
1851
1679
 
1852
1680
  declare function setLoading(val?: boolean): void;
1853
1681
 
1854
- declare interface TableGridTwoType extends RecordAny_2 {
1855
- /** 读取配置的rowKey 默认 _X_ROW_KEY */
1682
+ /**
1683
+ * 表格工具方法
1684
+ * @description 通过 `useOrcTable()` 返回的 `tableUtils` 或 `tableRef` 暴露的方法
1685
+ */
1686
+ declare interface TableGridTwoType {
1687
+ /** 读取配置的 rowKey,默认 `_X_ROW_KEY` */
1856
1688
  getRowKey(): string;
1857
- /** 读取当前页数据 */
1689
+ /** 读取当前页全部数据 */
1858
1690
  getTableData(): RecordAny_2[];
1859
- /** 读取选中行 */
1691
+ /** 读取当前选中的行数据 */
1860
1692
  getSelection(): RecordAny_2[];
1861
- /** 不支持夸行选择,可读取rowKey重复的数据 */
1693
+ /**
1694
+ * 按 checkboxKey 获取选中行
1695
+ * @param keys - 要匹配的 key 列表,默认当前选中行
1696
+ */
1862
1697
  getCheckboxKeySelection(keys?: string[]): RecordAny_2[];
1863
- /** option.reserve = true 读取所有跨页选中数据 */
1698
+ /** 读取跨页选中数据(需开启 `option.reserve`) */
1864
1699
  getReserveSelection(): RecordAny_2[];
1865
- /** 清空选中行 */
1700
+ /** 清空所有选中行 */
1866
1701
  clearSelection(): void;
1867
- /** 原insertAt 往表格插入临时数据,从指定位置插入一行或多行;第二个参数:row 指定( isNext +1 )位置、null从第一行插入、-1 从最后插入 */
1702
+ /**
1703
+ * 插入一行数据
1704
+ * @param record - 行数据
1705
+ * @param row - 插入位置参照行(number 为索引、目标行对象、null 为首行、-1 为末尾)
1706
+ * @param isNext - 是否插入在参照行之后(仅当 row 为对象时有效)
1707
+ * @returns 插入结果 `{ row, rows }`
1708
+ */
1868
1709
  insertRow(record: RecordAny_2, row?: RecordAny_2 | number, isNext?: boolean): Promise<{
1869
- row: any;
1870
- rows: any;
1710
+ row: RecordAny_2;
1711
+ rows: RecordAny_2[];
1871
1712
  }>;
1872
- /** 删除复选框选中的行数据 */
1713
+ /** 删除 Checkbox 选中的行 */
1873
1714
  removeRows(): void;
1874
1715
  /**
1875
1716
  * 选中行数据校验
1876
- * @param list 默认 所有选择的数据
1717
+ * @param list - 默认校验当前所有选中行
1718
+ * @returns `[errMsg, validatedList]` — 空字符串表示无错误
1877
1719
  */
1878
1720
  validate(list?: RecordAny_2[]): Promise<[string, RecordAny_2[]]>;
1879
1721
  /**
1880
- * 根据 row 获取行的序号
1881
- * @param row 行对象
1722
+ * 根据 row 获取行序号(从 1 开始)
1723
+ * @param row - 行对象
1882
1724
  */
1883
1725
  getRowSeq(row: any): string | number;
1884
1726
  /**
1885
- * 根据 row 获取相对于 data 中的索引
1886
- * @param row 行对象
1727
+ * 根据 row 获取行索引(从 0 开始)
1728
+ * @param row - 行对象
1887
1729
  */
1888
1730
  getRowIndex(row: any): number;
1731
+ /** 删除指定索引的行 */
1732
+ removerRowIndex(rowIndex: number): void;
1889
1733
  /**
1890
- * 删除RowIndex这一行
1734
+ * 选中/取消选中指定行
1735
+ * @param row - 行对象
1736
+ * @param bool - true 选中,false 取消
1891
1737
  */
1892
- removerRowIndex(rowIndex: number): void;
1738
+ setSelectionRow(row: any, bool?: boolean): void;
1893
1739
  }
1894
1740
 
1895
1741
  declare type TableInstance = InstanceType<typeof VxeTable>;
@@ -1900,6 +1746,41 @@ export declare function toArray<T>(target: T | T[]): T[];
1900
1746
  /** 读取数据类型 */
1901
1747
  export declare function typeName(o: unknown): string;
1902
1748
 
1749
+ /**
1750
+ * 字典缓存 Store
1751
+ *
1752
+ * @example
1753
+ * // 1. 初始化(在 main.ts 或 App.vue 中执行一次)
1754
+ * const dictStore = useDictStore();
1755
+ * dictStore.registerLoadFn(async (code) => {
1756
+ * const res = await fetch(`/api/dict/${code}`);
1757
+ * return res.json();
1758
+ * });
1759
+ *
1760
+ * @example
1761
+ * // 2. 在组件中使用
1762
+ * const dictStore = useDictStore();
1763
+ * const genders = await dictStore.getDict('gender');
1764
+ * const freshData = await dictStore.getDict('gender', true); // 强制刷新
1765
+ * dictStore.clearCache('gender'); // 清除缓存
1766
+ */
1767
+ export declare const useDictStore: StoreDefinition<"orc-dict", Pick<{
1768
+ dicts: Ref<Record<string, unknown[]>, Record<string, unknown[]>>;
1769
+ registerLoadFn: (fn: DictLoadFn) => void;
1770
+ getDict: <T = unknown[]>(code: string, force?: boolean) => Promise<T>;
1771
+ clearCache: (code?: string) => void;
1772
+ }, "dicts">, Pick<{
1773
+ dicts: Ref<Record<string, unknown[]>, Record<string, unknown[]>>;
1774
+ registerLoadFn: (fn: DictLoadFn) => void;
1775
+ getDict: <T = unknown[]>(code: string, force?: boolean) => Promise<T>;
1776
+ clearCache: (code?: string) => void;
1777
+ }, never>, Pick<{
1778
+ dicts: Ref<Record<string, unknown[]>, Record<string, unknown[]>>;
1779
+ registerLoadFn: (fn: DictLoadFn) => void;
1780
+ getDict: <T = unknown[]>(code: string, force?: boolean) => Promise<T>;
1781
+ clearCache: (code?: string) => void;
1782
+ }, "registerLoadFn" | "getDict" | "clearCache">>;
1783
+
1903
1784
  /**
1904
1785
  * @example
1905
1786
  * ```
@@ -1921,7 +1802,7 @@ export declare function typeName(o: unknown): string;
1921
1802
  */
1922
1803
  export declare function useOrcSearch(initialList: OrcSearchItem[] | (() => OrcSearchItem[]), local?: Ref<string>): readonly [Ref<{
1923
1804
  [x: string]: any;
1924
- type?: string | undefined;
1805
+ type?: "number" | "input" | "select" | "date" | undefined;
1925
1806
  name: string;
1926
1807
  label: string;
1927
1808
  defaultValue?: string | number | boolean | string[] | undefined;
@@ -1940,7 +1821,7 @@ export declare function useOrcSearch(initialList: OrcSearchItem[] | (() => OrcSe
1940
1821
  rules?: RecordAny | RecordAny[] | undefined;
1941
1822
  }[], OrcSearchItem[] | {
1942
1823
  [x: string]: any;
1943
- type?: string | undefined;
1824
+ type?: "number" | "input" | "select" | "date" | undefined;
1944
1825
  name: string;
1945
1826
  label: string;
1946
1827
  defaultValue?: string | number | boolean | string[] | undefined;
@@ -1961,10 +1842,9 @@ export declare function useOrcSearch(initialList: OrcSearchItem[] | (() => OrcSe
1961
1842
 
1962
1843
  export declare const useOrcTable: (option: OrcTableOption) => {
1963
1844
  tableRef: Ref<{
1964
- [x: string]: any;
1965
1845
  loading: boolean;
1966
1846
  setLoading: (loading?: boolean | undefined) => void;
1967
- dataInit: () => Promise<void>;
1847
+ dataInit: (isFirst?: boolean | undefined) => Promise<void>;
1968
1848
  loadData: (list: RecordAny_2[]) => void;
1969
1849
  getRowKey: () => string;
1970
1850
  getTableData: () => RecordAny_2[];
@@ -1973,19 +1853,19 @@ export declare const useOrcTable: (option: OrcTableOption) => {
1973
1853
  getReserveSelection: () => RecordAny_2[];
1974
1854
  clearSelection: () => void;
1975
1855
  insertRow: (record: RecordAny_2, row?: number | RecordAny_2 | undefined, isNext?: boolean | undefined) => Promise<{
1976
- row: any;
1977
- rows: any;
1856
+ row: RecordAny_2;
1857
+ rows: RecordAny_2[];
1978
1858
  }>;
1979
1859
  removeRows: () => void;
1980
1860
  validate: (list?: RecordAny_2[] | undefined) => Promise<[string, RecordAny_2[]]>;
1981
1861
  getRowSeq: (row: any) => string | number;
1982
1862
  getRowIndex: (row: any) => number;
1983
1863
  removerRowIndex: (rowIndex: number) => void;
1864
+ setSelectionRow: (row: any, bool?: boolean | undefined) => void;
1984
1865
  }, OrcTableExpose | {
1985
- [x: string]: any;
1986
1866
  loading: boolean;
1987
1867
  setLoading: (loading?: boolean | undefined) => void;
1988
- dataInit: () => Promise<void>;
1868
+ dataInit: (isFirst?: boolean | undefined) => Promise<void>;
1989
1869
  loadData: (list: RecordAny_2[]) => void;
1990
1870
  getRowKey: () => string;
1991
1871
  getTableData: () => RecordAny_2[];
@@ -1994,14 +1874,15 @@ export declare const useOrcTable: (option: OrcTableOption) => {
1994
1874
  getReserveSelection: () => RecordAny_2[];
1995
1875
  clearSelection: () => void;
1996
1876
  insertRow: (record: RecordAny_2, row?: number | RecordAny_2 | undefined, isNext?: boolean | undefined) => Promise<{
1997
- row: any;
1998
- rows: any;
1877
+ row: RecordAny_2;
1878
+ rows: RecordAny_2[];
1999
1879
  }>;
2000
1880
  removeRows: () => void;
2001
1881
  validate: (list?: RecordAny_2[] | undefined) => Promise<[string, RecordAny_2[]]>;
2002
1882
  getRowSeq: (row: any) => string | number;
2003
1883
  getRowIndex: (row: any) => number;
2004
1884
  removerRowIndex: (rowIndex: number) => void;
1885
+ setSelectionRow: (row: any, bool?: boolean | undefined) => void;
2005
1886
  }>;
2006
1887
  tableOptions: {
2007
1888
  ref: (el: any) => void;
@@ -2021,15 +1902,19 @@ export declare const useOrcTable: (option: OrcTableOption) => {
2021
1902
  firstLoad?: boolean | undefined;
2022
1903
  tooltip?: boolean | "title" | "tooltip" | "ellipsis" | undefined;
2023
1904
  footerTooltip?: boolean | "title" | "tooltip" | "ellipsis" | undefined;
2024
- headerStyle?: ((record: RecordAny_2 & {
1905
+ headerStyle?: ((record: {
2025
1906
  column: {
2026
1907
  property: string;
2027
1908
  } & RecordAny_2;
1909
+ columnIndex: number;
2028
1910
  }) => CssType) | undefined;
2029
- footerStyle?: ((record: RecordAny_2 & {
1911
+ footerStyle?: ((record: {
1912
+ $rowIndex: number;
2030
1913
  column: {
2031
1914
  property: string;
2032
1915
  } & RecordAny_2;
1916
+ columnIndex: number;
1917
+ $columnIndex: number;
2033
1918
  }) => CssType) | undefined;
2034
1919
  footerMethod?: VxeTablePropTypes<VxeTableDataRow> | undefined;
2035
1920
  mergeFooter?: VxeTablePropTypes<VxeTableDataRow> | undefined;
@@ -2037,7 +1922,7 @@ export declare const useOrcTable: (option: OrcTableOption) => {
2037
1922
  resolveTotal?: ((e: RecordAny_2) => number) | undefined;
2038
1923
  timeout?: number | undefined;
2039
1924
  data?: RecordAny_2 | undefined;
2040
- resolvePage?: ((page?: RecordAny_2 | undefined) => any) | undefined;
1925
+ resolvePage?: ((page: RecordAny_2) => any) | undefined;
2041
1926
  resolveData?: ((data: RecordAny_2, page?: RecordAny_2 | undefined) => RecordAny_2[]) | undefined;
2042
1927
  success?: ((data?: any) => void) | undefined;
2043
1928
  error?: ((data?: any) => void) | undefined;
@@ -2058,14 +1943,15 @@ export declare const useOrcTable: (option: OrcTableOption) => {
2058
1943
  getReserveSelection(): RecordAny_2[];
2059
1944
  clearSelection(): void;
2060
1945
  insertRow(record: RecordAny_2, row?: number | RecordAny_2 | undefined, isNext?: boolean | undefined): Promise<{
2061
- row: any;
2062
- rows: any;
1946
+ row: RecordAny_2;
1947
+ rows: RecordAny_2[];
2063
1948
  }>;
2064
1949
  removeRows(): void;
2065
1950
  validate(list?: RecordAny_2[] | undefined): Promise<[string, RecordAny_2[]]>;
2066
1951
  getRowSeq(row: any): string | number;
2067
1952
  getRowIndex(row: any): number;
2068
1953
  removerRowIndex(rowIndex: number): void;
1954
+ setSelectionRow(row: any, bool?: boolean | undefined): void;
2069
1955
  rowKey: string;
2070
1956
  addKey(rowIndex: number): void;
2071
1957
  setTableData(list: RecordAny_2[]): void;