@robot-admin/naive-ui-components 0.32.0 → 0.33.0

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 (162) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +3 -1
  3. package/README_EN.md +3 -1
  4. package/dist/C_DataPicker.css +60 -23
  5. package/dist/C_Form.base.css +1 -1
  6. package/dist/C_Form.css +1 -1
  7. package/dist/C_FormSearch.css +93 -72
  8. package/dist/C_FormSearch.d.cts +2 -2
  9. package/dist/C_FormSearch.d.ts +2 -2
  10. package/dist/C_GlobalSearch2.cjs +1 -1
  11. package/dist/C_GlobalSearch2.js +1 -1
  12. package/dist/C_Select.css +1 -1
  13. package/dist/C_Select.d.cts +2 -2
  14. package/dist/C_Select.d.ts +2 -2
  15. package/dist/C_Select2.cjs +1 -1
  16. package/dist/C_Select2.js +1 -1
  17. package/dist/C_Table.base.css +147 -147
  18. package/dist/C_Table.cjs +1 -1
  19. package/dist/C_Table.css +146 -146
  20. package/dist/C_Table.d.cts +3 -3
  21. package/dist/C_Table.d.ts +3 -3
  22. package/dist/C_Table.js +1 -1
  23. package/dist/C_Table2.cjs +4 -3
  24. package/dist/C_Table2.js +4 -3
  25. package/dist/C_TagsView.css +51 -51
  26. package/dist/C_TagsView2.cjs +1 -1
  27. package/dist/C_TagsView2.js +1 -1
  28. package/dist/C_Tree.css +60 -23
  29. package/dist/C_Tree.d.cts +2 -2
  30. package/dist/C_Tree.d.ts +2 -2
  31. package/dist/C_Tree2.cjs +1 -1
  32. package/dist/C_Tree2.js +1 -1
  33. package/dist/SearchFieldSettings.cjs +1 -0
  34. package/dist/SearchFieldSettings.js +1 -0
  35. package/dist/constants.d.cts +2 -2
  36. package/dist/constants.d.ts +2 -2
  37. package/dist/constants2.d.cts +2 -2
  38. package/dist/constants2.d.ts +2 -2
  39. package/dist/constants4.d.cts +8 -8
  40. package/dist/constants4.d.ts +8 -8
  41. package/dist/constants5.d.cts +2 -2
  42. package/dist/constants5.d.ts +2 -2
  43. package/dist/data2.d.cts +8 -8
  44. package/dist/data2.d.ts +8 -8
  45. package/dist/dateRange.d.cts +44 -4
  46. package/dist/dateRange.d.ts +44 -4
  47. package/dist/editors.cjs +1 -0
  48. package/dist/{useTableQuery.d.cts → editors.d.cts} +123 -14
  49. package/dist/{useTableQuery.d.ts → editors.d.ts} +123 -14
  50. package/dist/editors.js +1 -0
  51. package/dist/fieldRenderers.cjs +1 -1
  52. package/dist/fieldRenderers.js +1 -1
  53. package/dist/formField.cjs +1 -1
  54. package/dist/formField.d.cts +35 -12
  55. package/dist/formField.d.ts +35 -12
  56. package/dist/formField.js +1 -1
  57. package/dist/helpers.cjs +1 -1
  58. package/dist/helpers.js +1 -1
  59. package/dist/index.cjs +1 -1
  60. package/dist/index.d.cts +6 -6
  61. package/dist/index.d.ts +6 -6
  62. package/dist/index.js +1 -1
  63. package/dist/index.vue.d.cts +4 -4
  64. package/dist/index.vue.d.ts +4 -4
  65. package/dist/index10.vue.d.cts +2 -2
  66. package/dist/index10.vue.d.ts +4 -4
  67. package/dist/index11.vue.d.cts +4 -4
  68. package/dist/index11.vue.d.ts +1 -1
  69. package/dist/index12.vue.d.cts +1 -1
  70. package/dist/index13.vue.d.ts +4 -4
  71. package/dist/index14.vue.d.cts +4 -4
  72. package/dist/index16.vue.d.ts +3 -3
  73. package/dist/index17.vue.d.cts +3 -3
  74. package/dist/index17.vue.d.ts +7 -7
  75. package/dist/index18.vue.d.cts +7 -7
  76. package/dist/index18.vue.d.ts +2 -2
  77. package/dist/index19.vue.d.cts +2 -2
  78. package/dist/index2.vue.d.cts +2 -2
  79. package/dist/index2.vue.d.ts +2 -2
  80. package/dist/index21.vue.d.ts +5 -5
  81. package/dist/index22.vue.d.cts +5 -5
  82. package/dist/index22.vue.d.ts +3 -3
  83. package/dist/index23.vue.d.cts +1 -1
  84. package/dist/index23.vue.d.ts +1 -1
  85. package/dist/index25.vue.d.cts +2 -2
  86. package/dist/index25.vue.d.ts +2 -2
  87. package/dist/index26.vue.d.cts +3 -3
  88. package/dist/index26.vue.d.ts +3 -3
  89. package/dist/index27.vue.d.cts +1 -1
  90. package/dist/index27.vue.d.ts +1 -1
  91. package/dist/index28.vue.d.cts +2 -2
  92. package/dist/index28.vue.d.ts +2 -2
  93. package/dist/index3.vue.d.cts +2 -2
  94. package/dist/index3.vue.d.ts +2 -2
  95. package/dist/index30.vue.d.cts +1 -1
  96. package/dist/index30.vue.d.ts +1 -1
  97. package/dist/index31.vue.d.cts +2 -2
  98. package/dist/index31.vue.d.ts +2 -2
  99. package/dist/index32.vue.d.cts +2 -2
  100. package/dist/index32.vue.d.ts +2 -2
  101. package/dist/index4.vue.d.cts +3 -3
  102. package/dist/index4.vue.d.ts +3 -3
  103. package/dist/index6.vue.d.cts +3 -3
  104. package/dist/index7.vue.d.ts +2 -2
  105. package/dist/index8.vue.d.cts +2 -2
  106. package/dist/index8.vue.d.ts +3 -3
  107. package/dist/index9.vue.d.cts +3 -3
  108. package/dist/index9.vue.d.ts +2 -2
  109. package/dist/presets.d.cts +1 -1
  110. package/dist/presets.d.ts +1 -1
  111. package/dist/public.d.ts +2 -0
  112. package/dist/selectPresentation.cjs +1 -1
  113. package/dist/selectPresentation.js +1 -1
  114. package/dist/serializeSearch.cjs +1 -1
  115. package/dist/serializeSearch.js +1 -1
  116. package/dist/sourceControls.cjs +1 -0
  117. package/dist/sourceControls.js +1 -0
  118. package/dist/style.css +351 -293
  119. package/dist/types3.d.cts +2 -0
  120. package/dist/types4.d.ts +10 -2
  121. package/dist/types5.d.cts +10 -2
  122. package/dist/useCalendarEvents.d.cts +1 -1
  123. package/dist/useCalendarEvents.d.ts +1 -1
  124. package/dist/useCollapsePanel.d.cts +4 -4
  125. package/dist/useCollapsePanel.d.ts +4 -4
  126. package/dist/useComponentLocale.cjs +1 -1
  127. package/dist/useComponentLocale.js +1 -1
  128. package/dist/useCropperCore.d.cts +9 -9
  129. package/dist/useCropperCore.d.ts +9 -9
  130. package/dist/useDynamicFormState.d.cts +3 -3
  131. package/dist/useDynamicFormState.d.ts +3 -3
  132. package/dist/useEdgeInteraction.d.cts +2 -2
  133. package/dist/useEdgeInteraction.d.ts +2 -2
  134. package/dist/useFullscreen.d.cts +3 -3
  135. package/dist/useFullscreen.d.ts +3 -3
  136. package/dist/useGlobalSearch.d.cts +8 -0
  137. package/dist/useGlobalSearch.d.ts +8 -0
  138. package/dist/useGridWidth.cjs +1 -1
  139. package/dist/useGridWidth.js +1 -1
  140. package/dist/useInfiniteScroll.d.cts +1 -1
  141. package/dist/useInfiniteScroll.d.ts +1 -1
  142. package/dist/useQRCode.d.cts +1 -1
  143. package/dist/useQRCode.d.ts +1 -1
  144. package/dist/useSignatureHistory.d.cts +5 -5
  145. package/dist/useSignatureHistory.d.ts +5 -5
  146. package/dist/useSplitResize.d.cts +7 -7
  147. package/dist/useSplitResize.d.ts +7 -7
  148. package/dist/useWorkflowValidation.d.cts +37 -37
  149. package/dist/useWorkflowValidation.d.ts +37 -37
  150. package/dist/verification.d.cts +8 -8
  151. package/dist/verification.d.ts +8 -8
  152. package/docs/guides/component-contracts.md +72 -0
  153. package/docs/guides/remote-options.md +24 -0
  154. package/docs/guides/search-workflows.md +63 -0
  155. package/docs/guides/table-editing.md +79 -0
  156. package/docs/guides/tree.en.md +41 -0
  157. package/docs/guides/tree.md +80 -1
  158. package/package.json +1 -1
  159. package/dist/temporalField.cjs +0 -1
  160. package/dist/temporalField.js +0 -1
  161. package/dist/useTableQuery.cjs +0 -1
  162. package/dist/useTableQuery.js +0 -1
@@ -1,6 +1,9 @@
1
+ import { i as OptionValue, r as OptionSource } from "./optionSource.cjs";
1
2
  import { n as ResolvedComponentDensity, t as ComponentDensity } from "./density.cjs";
2
3
  import { n as ComponentLocale, t as ComponentFeedback } from "./contracts.cjs";
3
- import { $ as TreeConfig, B as UseTableExpandReturn, C as ParentChildLinkMode, D as SimpleTableActions, F as TableRowKeyIssue, G as EditConfig, H as ColumnDragConfig, I as TableRuntimeProps, J as ResolvedConfig, K as ErrorConfig, L as UseTableActionsOptions, O as StrictTableColumn, P as TableRowKey, Q as ToolbarConfig, R as UseTableActionsReturn, S as PaginationConfig, St as DynamicRowsReturn, V as BatchActionsConfig, W as DisplayConfig, X as SummaryConfig, Y as SelectionConfig, Z as TableConfig, _ as DataRecord, _t as RowDragConfig, et as VirtualScrollConfig, j as TableInstance, k as TableColumn, ot as FormatterConfig, pt as CrossPageSelectionConfig, q as ExpandConfig, rt as ExportConfig, v as EditMode, xt as DynamicRowsOptions, z as UseTableExpandOptions } from "./formField.cjs";
4
+ import { n as AutoCompleteProps$1, t as AutoCompleteOptionItem } from "./types2.cjs";
5
+ import { $ as TableConfig, A as StrictTableColumn, B as UseTableActionsReturn, Ct as DynamicRowsOptions, H as UseTableExpandReturn, I as TableRowKey, J as ErrorConfig, K as DisplayConfig, L as TableRowKeyIssue, N as TableInstance, Q as SummaryConfig, R as TableRuntimeProps, T as ParentChildLinkMode, U as BatchActionsConfig, V as UseTableExpandOptions, W as ColumnDragConfig, X as ResolvedConfig, Y as ExpandConfig, Z as SelectionConfig, _ as DataRecord, at as ExportConfig, ct as FormatterConfig, et as ToolbarConfig, ht as CrossPageSelectionConfig, j as TableColumn, k as SimpleTableActions, nt as VirtualScrollConfig, q as EditConfig, tt as TreeConfig, v as EditMode, w as PaginationConfig, wt as DynamicRowsReturn, yt as RowDragConfig, z as UseTableActionsOptions } from "./formField.cjs";
6
+ import { a as SelectProps$1, o as SelectSelection, r as SelectOptionItem, s as SelectValue, t as SelectModelValue } from "./types5.cjs";
4
7
  import * as vue from "vue";
5
8
  import { App, ComputedRef, MaybeRefOrGetter, Ref, VNodeChild } from "vue";
6
9
  import { DataTableColumn, DataTableRowKey, PaginationProps, TreeInst, TreeOption, TreeProps } from "naive-ui";
@@ -97,6 +100,9 @@ interface TableManagerRef {
97
100
  getTableColumns: (originalColumns: TableColumn[]) => DataTableColumn[];
98
101
  } | null;
99
102
  }
103
+ /**
104
+ * 渲染只读单元格
105
+ */
100
106
  interface UseTableColumnsOptions {
101
107
  /** 原始列配置 */
102
108
  rawColumns: ComputedRef<TableColumn[]>;
@@ -120,7 +126,7 @@ interface UseTableColumnsOptions {
120
126
  actionsRenderer: (row: DataRecord, index: number) => VNodeChild;
121
127
  /** 编辑模式检查器 */
122
128
  editModeChecker: ComputedRef<{
123
- isNonEditable: (column: TableColumn) => boolean;
129
+ isNonEditable: (column: TableColumn, row?: DataRecord, index?: number) => boolean;
124
130
  isRowEditMode: () => boolean;
125
131
  isCellEditMode: () => boolean;
126
132
  }>;
@@ -175,6 +181,7 @@ declare function useRowEdit(options: RowEditOptions): {
175
181
  isSaving: vue.Ref<boolean, boolean>;
176
182
  isEditingRow: (rowKey: DataTableRowKey) => boolean;
177
183
  startEditRow: (rowKey: DataTableRowKey) => boolean;
184
+ canEditRow: (key: DataTableRowKey) => boolean;
178
185
  cancelEditRow: () => Promise<void>;
179
186
  saveEditRow: () => Promise<{
180
187
  updatedData: DataRecord;
@@ -269,6 +276,7 @@ declare function useTableManager(params: TableManagerParams): {
269
276
  isSaving: vue.Ref<boolean, boolean>;
270
277
  isEditingRow: (rowKey: DataTableRowKey) => boolean;
271
278
  startEditRow: (rowKey: DataTableRowKey) => boolean;
279
+ canEditRow: (key: DataTableRowKey) => boolean;
272
280
  cancelEditRow: () => Promise<void>;
273
281
  saveEditRow: () => Promise<{
274
282
  updatedData: DataRecord;
@@ -323,9 +331,11 @@ declare function useTableManager(params: TableManagerParams): {
323
331
  editingData: vue.Ref<DataRecord, DataRecord>;
324
332
  editingRowKey: vue.Ref<DataTableRowKey | null, DataTableRowKey | null>;
325
333
  editingRowIndex: vue.ComputedRef<number>;
334
+ originalData: vue.ComputedRef<DataRecord>;
326
335
  startEdit: (rowKey: DataTableRowKey, sourceData?: DataRecord | undefined) => boolean;
336
+ canEditRow: (key: DataTableRowKey) => boolean;
327
337
  saveEdit: (formData?: DataRecord | undefined) => Promise<{
328
- updatedData: any;
338
+ updatedData: DataRecord;
329
339
  rowIndex: number;
330
340
  } | undefined>;
331
341
  cancelEdit: () => Promise<boolean>;
@@ -474,6 +484,7 @@ type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
474
484
  interface ModalEditOptions<T extends object = DataRecord> {
475
485
  data: () => T[];
476
486
  rowKey: (row: T) => DataTableRowKey;
487
+ columns?: () => TableColumn<T>[];
477
488
  onSave?: (editingData: T, rowIndex: number, originalKey?: DataTableRowKey) => unknown;
478
489
  onCancel?: (originalData: T, rowIndex: number) => unknown;
479
490
  }
@@ -484,9 +495,11 @@ declare function useModalEdit<T extends object = DataRecord>(options: ModalEditO
484
495
  editingData: [T] extends [vue.Ref<any, any>] ? IfAny<T, vue.Ref<T, T>, T> : vue.Ref<vue.UnwrapRef<T>, T | vue.UnwrapRef<T>>;
485
496
  editingRowKey: vue.Ref<DataTableRowKey | null, DataTableRowKey | null>;
486
497
  editingRowIndex: vue.ComputedRef<number>;
498
+ originalData: vue.ComputedRef<T>;
487
499
  startEdit: (rowKey: DataTableRowKey, sourceData?: T) => boolean;
500
+ canEditRow: (key: DataTableRowKey) => boolean;
488
501
  saveEdit: (formData?: T) => Promise<{
489
- updatedData: any;
502
+ updatedData: T;
490
503
  rowIndex: number;
491
504
  } | undefined>;
492
505
  cancelEdit: () => Promise<boolean>;
@@ -570,6 +583,25 @@ interface IconConfig {
570
583
  typeMap?: Record<string, string>;
571
584
  colorMap?: Record<string, string>;
572
585
  }
586
+ /** 路径按根节点到命中节点排列;路径不代表各级的完整子项列表。 */
587
+ interface TreeSearchSource<T extends object = TreeNodeData> {
588
+ request: (context: {
589
+ search: string;
590
+ signal: AbortSignal;
591
+ limit: number;
592
+ }) => Promise<readonly (readonly T[])[]>;
593
+ /** 根据唯一键恢复一个尚未加载的节点及其祖先。 */
594
+ resolve?: (key: TreeKey, signal: AbortSignal) => Promise<readonly T[] | null>;
595
+ /** 返回该节点的完整直接子项;与搜索补入的部分路径严格区分。 */
596
+ load?: (node: T, context: {
597
+ signal: AbortSignal;
598
+ }) => Promise<readonly T[]>;
599
+ debounce?: number;
600
+ minChars?: number;
601
+ limit?: number;
602
+ /** 身份或业务范围改变时取消旧请求并丢弃远程覆盖层。 */
603
+ scope?: string | number;
604
+ }
573
605
  type MaybeArray<T> = T | T[];
574
606
  type TreeUpdateHandler<T extends object, A extends TreeUpdateMeta['action']> = (keys: TreeKey[], options: Array<T | null>, meta: TreeUpdateMeta<T, A>) => void;
575
607
  type TreeDragHandler<T extends object> = (info: {
@@ -638,6 +670,17 @@ interface TreeProps$1<T extends object = TreeNodeData> {
638
670
  searchPattern?: string;
639
671
  searchable?: boolean;
640
672
  searchPlaceholder?: string;
673
+ searchSource?: TreeSearchSource<T>;
674
+ /** 常用原生能力可直接配置;未传时继续使用 treeProps 和原生默认值。 */
675
+ checkable?: boolean;
676
+ multiple?: boolean;
677
+ cascade?: boolean;
678
+ checkStrategy?: TreeProps['checkStrategy'];
679
+ selectable?: boolean;
680
+ disabled?: boolean;
681
+ virtualScroll?: boolean;
682
+ accordion?: boolean;
683
+ expandOnClick?: boolean;
641
684
  draggable?: boolean;
642
685
  showLine?: boolean;
643
686
  showToolbar?: boolean;
@@ -673,6 +716,16 @@ interface TreeExpose<T extends object = TreeNodeData> {
673
716
  options: Array<T | null>;
674
717
  };
675
718
  scrollTo: TreeInst['scrollTo'];
719
+ /** 展开已知路径,或经 searchSource.resolve 恢复未知节点。 */
720
+ locate: (key: TreeKey) => Promise<boolean>;
721
+ locateMatch: (index: number) => Promise<boolean>;
722
+ nextMatch: () => Promise<boolean>;
723
+ previousMatch: () => Promise<boolean>;
724
+ retrySearch: () => Promise<void>;
725
+ searchLoading: boolean;
726
+ searchError: unknown;
727
+ searchMatchCount: number;
728
+ searchMatchIndex: number;
676
729
  /** Vue 公开实例会解包顶层 Ref;这些属性直接读取数组。 */
677
730
  expandedKeys: TreeKey[];
678
731
  selectedKeys: TreeKey[];
@@ -687,6 +740,7 @@ interface TreeEmits<T extends object = TreeNodeData> {
687
740
  'node-action': [action: string, node: T];
688
741
  'node-drop': [info: DropInfo<T>];
689
742
  'load-error': [error: unknown, node: T];
743
+ 'search-error': [error: unknown];
690
744
  add: [parentNode?: T];
691
745
  refresh: [];
692
746
  }
@@ -701,27 +755,32 @@ interface TreeSlots<T extends object = TreeOption$1> {
701
755
  //#region src/components/C_Tree/index.vue.d.ts
702
756
  declare const __VLS_export: <T extends object = TreeNodeData>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
703
757
  props: vue.PublicProps & __VLS_PrettifyLocal<TreeProps$1<T> & {
758
+ "onLoad-error"?: ((error: unknown, node: T) => any) | undefined;
704
759
  onAdd?: ((parentNode?: T | undefined) => any) | undefined;
760
+ "onUpdate:expandedKeys"?: ((keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "filter" | "select" | "expand" | "unselect" | "collapse" | "check" | "uncheck">) => any) | undefined;
705
761
  onRefresh?: (() => any) | undefined;
706
- "onNode-drop"?: ((info: DropInfo<T>) => any) | undefined;
762
+ "onSearch-error"?: ((error: unknown) => any) | undefined;
707
763
  "onUpdate:searchPattern"?: ((pattern: string) => any) | undefined;
708
- "onUpdate:expandedKeys"?: ((keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "select" | "filter" | "expand" | "collapse" | "unselect" | "check" | "uncheck">) => any) | undefined;
709
- "onUpdate:selectedKeys"?: ((keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "select" | "filter" | "expand" | "collapse" | "unselect" | "check" | "uncheck">) => any) | undefined;
710
- "onUpdate:checkedKeys"?: ((keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "select" | "filter" | "expand" | "collapse" | "unselect" | "check" | "uncheck">) => any) | undefined;
764
+ "onUpdate:selectedKeys"?: ((keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "filter" | "select" | "expand" | "unselect" | "collapse" | "check" | "uncheck">) => any) | undefined;
765
+ "onUpdate:checkedKeys"?: ((keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "filter" | "select" | "expand" | "unselect" | "collapse" | "check" | "uncheck">) => any) | undefined;
711
766
  "onNode-select"?: ((node: T | null, selectedKeys: TreeKey[]) => any) | undefined;
712
767
  "onNode-action"?: ((action: string, node: T) => any) | undefined;
713
- "onLoad-error"?: ((error: unknown, node: T) => any) | undefined;
768
+ "onNode-drop"?: ((info: DropInfo<T>) => any) | undefined;
714
769
  }> & (typeof globalThis extends {
715
770
  __VLS_PROPS_FALLBACK: infer P;
716
771
  } ? P : {});
717
- expose: (exposed: vue.ShallowUnwrapRef<Omit<TreeExpose<T>, "selectedKeys" | "expandedKeys" | "checkedKeys"> & {
772
+ expose: (exposed: vue.ShallowUnwrapRef<Omit<TreeExpose<T>, "expandedKeys" | "checkedKeys" | "selectedKeys" | "searchLoading" | "searchError" | "searchMatchCount" | "searchMatchIndex"> & {
718
773
  expandedKeys: vue.Ref<TreeKey[]>;
719
774
  selectedKeys: vue.Ref<TreeKey[]>;
720
775
  checkedKeys: vue.Ref<TreeKey[]>;
776
+ searchLoading: vue.Ref<boolean>;
777
+ searchError: vue.Ref<unknown>;
778
+ searchMatchCount: vue.Ref<number>;
779
+ searchMatchIndex: vue.Ref<number>;
721
780
  }>) => void;
722
781
  attrs: any;
723
782
  slots: TreeSlots<T>;
724
- emit: ((evt: "add", parentNode?: T | undefined) => void) & ((evt: "refresh") => void) & ((evt: "node-drop", info: DropInfo<T>) => void) & ((evt: "update:searchPattern", pattern: string) => void) & ((evt: "update:expandedKeys", keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "select" | "filter" | "expand" | "collapse" | "unselect" | "check" | "uncheck">) => void) & ((evt: "update:selectedKeys", keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "select" | "filter" | "expand" | "collapse" | "unselect" | "check" | "uncheck">) => void) & ((evt: "update:checkedKeys", keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "select" | "filter" | "expand" | "collapse" | "unselect" | "check" | "uncheck">) => void) & ((evt: "node-select", node: T | null, selectedKeys: TreeKey[]) => void) & ((evt: "node-action", action: string, node: T) => void) & ((evt: "load-error", error: unknown, node: T) => void);
783
+ emit: ((evt: "load-error", error: unknown, node: T) => void) & ((evt: "add", parentNode?: T | undefined) => void) & ((evt: "update:expandedKeys", keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "filter" | "select" | "expand" | "unselect" | "collapse" | "check" | "uncheck">) => void) & ((evt: "refresh") => void) & ((evt: "search-error", error: unknown) => void) & ((evt: "update:searchPattern", pattern: string) => void) & ((evt: "update:selectedKeys", keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "filter" | "select" | "expand" | "unselect" | "collapse" | "check" | "uncheck">) => void) & ((evt: "update:checkedKeys", keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "filter" | "select" | "expand" | "unselect" | "collapse" | "check" | "uncheck">) => void) & ((evt: "node-select", node: T | null, selectedKeys: TreeKey[]) => void) & ((evt: "node-action", action: string, node: T) => void) & ((evt: "node-drop", info: DropInfo<T>) => void);
725
784
  }>) => vue.VNode & {
726
785
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
727
786
  };
@@ -743,9 +802,36 @@ declare function useTreeOperations<T extends object = TreeNodeData>(props: TreeP
743
802
  checkedKeys: vue.WritableComputedRef<TreeKey[], TreeKey[]>;
744
803
  isAllExpanded: vue.ComputedRef<boolean>;
745
804
  treeData: vue.ComputedRef<readonly T[]>;
805
+ search: {
806
+ projection: vue.ComputedRef<{
807
+ data: readonly T[];
808
+ partialKeys: Set<TreeKey>;
809
+ projected: boolean;
810
+ error: unknown;
811
+ }>;
812
+ matches: vue.ShallowRef<readonly (readonly T[])[], readonly (readonly T[])[]>;
813
+ loading: Ref<boolean, boolean>;
814
+ error: vue.ShallowRef<unknown, unknown>;
815
+ matchIndex: Ref<number, number>;
816
+ ready: vue.ComputedRef<boolean>;
817
+ minChars: vue.ComputedRef<number>;
818
+ active: Ref<boolean, boolean>;
819
+ loadingKeys: vue.ShallowRef<ReadonlySet<TreeKey>, ReadonlySet<TreeKey>>;
820
+ run: () => Promise<void>;
821
+ locate: (key: TreeKey) => Promise<boolean>;
822
+ locateMatch: (index: number) => Promise<boolean>;
823
+ load: (node: T) => Promise<boolean>;
824
+ acceptBranch: (key: TreeKey, children: readonly T[]) => void;
825
+ cancelLocate: () => void;
826
+ retainAndReveal: (path: readonly T[]) => Promise<boolean>;
827
+ nextMatch: () => Promise<boolean>;
828
+ previousMatch: () => Promise<boolean>;
829
+ };
746
830
  currentSearchPattern: vue.WritableComputedRef<string, string>;
747
831
  renderPrefix: (info: TreeRenderContext<T>) => any;
748
- renderLabel: (info: TreeRenderContext<T>) => vue.VNodeChild;
832
+ renderLabel: (info: TreeRenderContext<T>) => string | number | boolean | void | vue.VNode<vue.RendererNode, vue.RendererElement, {
833
+ [key: string]: any;
834
+ }> | vue.VNodeArrayChildren | null;
749
835
  renderSuffix: (info: TreeRenderContext<T>) => any;
750
836
  treeBindings: vue.ComputedRef<TreeProps>;
751
837
  treeRef: vue.ShallowRef<TreeInst | undefined, TreeInst | undefined>;
@@ -757,10 +843,14 @@ declare function useTreeOperations<T extends object = TreeNodeData>(props: TreeP
757
843
  handleDrop: (info: DropInfo<T>) => void;
758
844
  handleAdd: () => void;
759
845
  handleRefresh: () => void;
760
- expose: Omit<TreeExpose<T>, "selectedKeys" | "expandedKeys" | "checkedKeys"> & {
846
+ expose: Omit<TreeExpose<T>, "expandedKeys" | "checkedKeys" | "selectedKeys" | "searchLoading" | "searchError" | "searchMatchCount" | "searchMatchIndex"> & {
761
847
  expandedKeys: Ref<TreeKey[]>;
762
848
  selectedKeys: Ref<TreeKey[]>;
763
849
  checkedKeys: Ref<TreeKey[]>;
850
+ searchLoading: Ref<boolean>;
851
+ searchError: Ref<unknown>;
852
+ searchMatchCount: Ref<number>;
853
+ searchMatchIndex: Ref<number>;
764
854
  };
765
855
  };
766
856
  //#endregion
@@ -905,4 +995,23 @@ declare function useTableQuery<T extends object, Q extends object = Record<strin
905
995
  cancel: () => void;
906
996
  };
907
997
  //#endregion
908
- export { HighlightPluginOptions as A, useRowEdit as B, TreeNodeData as C, TreeSlots as D, TreeRenderContext as E, useCellEdit as F, _default$1 as G, defineTableColumns as H, usePagination as I, useComponentFeedback as K, useTableActions as L, setupHighlight as M, useHighlight as N, TreeUpdateMeta as O, useModalEdit as P, useTableExpand as R, TreeNativeProps as S, TreeProps$1 as T, defineTableConfig as U, useTableColumns as V, validateTableRowKeys as W, StatusType as _, getItem as a, TreeKey as b, setItem as c, _default as d, ActionConfig as f, StatusConfig as g, IconConfig as h, useTableQuery as i, createHighlight as j, HighlightAPI as k, useTreeOperations as l, DropInfo as m, TableQueryResult as n, removeAllItem as o, ButtonType as p, useComponentLocale as q, UseTableQueryOptions as r, removeItem as s, TableQueryContext as t, presetConfigs as u, TreeEmits as v, TreeOption$1 as w, TreeMode as x, TreeExpose as y, useTableManager as z };
998
+ //#region src/components/C_Table/editors.d.ts
999
+ /** 类型化候选回调只读业务行,模型更新继续经过表格自己的草稿入口。 */
1000
+ interface TableEditorContext<T extends object, V = unknown> {
1001
+ row: Readonly<T>;
1002
+ index: number;
1003
+ updateValue: (value: V) => void;
1004
+ }
1005
+ type RowSource<T extends object, R extends object, V extends OptionValue, F extends object> = OptionSource<R, V, F> | ((row: Readonly<T>, index: number) => OptionSource<R, V, F>);
1006
+ /** 返回现有 editRender;来源与完整候选记录从传入对象推导。 */
1007
+ declare function createTableSelectEditor<T extends object = object, R extends object = SelectOptionItem, V extends SelectValue = SelectValue, M extends boolean = false, Tag extends boolean = false, F extends object = Record<string, unknown>>(options: Omit<SelectProps$1<V, M, Tag, R, F>, 'modelValue' | 'source'> & {
1008
+ source?: RowSource<T, R, V, F>;
1009
+ onSelect?: (selection: SelectSelection<NoInfer<R>, M>, context: TableEditorContext<T, SelectModelValue<V, M, Tag>>) => void;
1010
+ }): NonNullable<TableColumn<T>['editRender']>;
1011
+ /** 自由文本与候选记录保持分离,复用自动补全的原始来源及渲染契约。 */
1012
+ declare function createTableAutoCompleteEditor<T extends object = object, R extends object = AutoCompleteOptionItem, F extends object = Record<string, unknown>>(options: Omit<AutoCompleteProps$1<R, F>, 'modelValue' | 'source'> & {
1013
+ source?: RowSource<T, R, OptionValue, F>;
1014
+ onSelect?: (record: NoInfer<R>, context: TableEditorContext<T, string>) => void;
1015
+ }): NonNullable<TableColumn<T>['editRender']>;
1016
+ //#endregion
1017
+ export { TreeSearchSource as A, usePagination as B, TreeKey as C, TreeOption$1 as D, TreeNodeData as E, createHighlight as F, useTableColumns as G, useTableExpand as H, setupHighlight as I, validateTableRowKeys as J, defineTableColumns as K, useHighlight as L, TreeUpdateMeta as M, HighlightAPI as N, TreeProps$1 as O, HighlightPluginOptions as P, useModalEdit as R, TreeExpose as S, TreeNativeProps as T, useTableManager as U, useTableActions as V, useRowEdit as W, useComponentFeedback as X, _default$1 as Y, useComponentLocale as Z, DropInfo as _, TableQueryResult as a, StatusType as b, getItem as c, setItem as d, useTreeOperations as f, ButtonType as g, ActionConfig as h, TableQueryContext as i, TreeSlots as j, TreeRenderContext as k, removeAllItem as l, _default as m, createTableAutoCompleteEditor as n, UseTableQueryOptions as o, presetConfigs as p, defineTableConfig as q, createTableSelectEditor as r, useTableQuery as s, TableEditorContext as t, removeItem as u, IconConfig as v, TreeMode as w, TreeEmits as x, StatusConfig as y, useCellEdit as z };
@@ -1,6 +1,9 @@
1
+ import { i as OptionValue, r as OptionSource } from "./optionSource.js";
1
2
  import { n as ResolvedComponentDensity, t as ComponentDensity } from "./density.js";
2
3
  import { n as ComponentLocale, t as ComponentFeedback } from "./contracts.js";
3
- import { $ as TreeConfig, B as UseTableExpandReturn, C as ParentChildLinkMode, D as SimpleTableActions, F as TableRowKeyIssue, G as EditConfig, H as ColumnDragConfig, I as TableRuntimeProps, J as ResolvedConfig, K as ErrorConfig, L as UseTableActionsOptions, O as StrictTableColumn, P as TableRowKey, Q as ToolbarConfig, R as UseTableActionsReturn, S as PaginationConfig, St as DynamicRowsReturn, V as BatchActionsConfig, W as DisplayConfig, X as SummaryConfig, Y as SelectionConfig, Z as TableConfig, _ as DataRecord, _t as RowDragConfig, et as VirtualScrollConfig, j as TableInstance, k as TableColumn, ot as FormatterConfig, pt as CrossPageSelectionConfig, q as ExpandConfig, rt as ExportConfig, v as EditMode, xt as DynamicRowsOptions, z as UseTableExpandOptions } from "./formField.js";
4
+ import { n as AutoCompleteProps$1, t as AutoCompleteOptionItem } from "./types2.js";
5
+ import { $ as TableConfig, A as StrictTableColumn, B as UseTableActionsReturn, Ct as DynamicRowsOptions, H as UseTableExpandReturn, I as TableRowKey, J as ErrorConfig, K as DisplayConfig, L as TableRowKeyIssue, N as TableInstance, Q as SummaryConfig, R as TableRuntimeProps, T as ParentChildLinkMode, U as BatchActionsConfig, V as UseTableExpandOptions, W as ColumnDragConfig, X as ResolvedConfig, Y as ExpandConfig, Z as SelectionConfig, _ as DataRecord, at as ExportConfig, ct as FormatterConfig, et as ToolbarConfig, ht as CrossPageSelectionConfig, j as TableColumn, k as SimpleTableActions, nt as VirtualScrollConfig, q as EditConfig, tt as TreeConfig, v as EditMode, w as PaginationConfig, wt as DynamicRowsReturn, yt as RowDragConfig, z as UseTableActionsOptions } from "./formField.js";
6
+ import { a as SelectProps$1, o as SelectSelection, r as SelectOptionItem, s as SelectValue, t as SelectModelValue } from "./types4.js";
4
7
  import * as vue from "vue";
5
8
  import { App, ComputedRef, MaybeRefOrGetter, Ref, VNodeChild } from "vue";
6
9
  import { DataTableColumn, DataTableRowKey, PaginationProps, TreeInst, TreeOption, TreeProps } from "naive-ui";
@@ -87,6 +90,9 @@ interface TableManagerRef {
87
90
  getTableColumns: (originalColumns: TableColumn[]) => DataTableColumn[];
88
91
  } | null;
89
92
  }
93
+ /**
94
+ * 渲染只读单元格
95
+ */
90
96
  interface UseTableColumnsOptions {
91
97
  /** 原始列配置 */
92
98
  rawColumns: ComputedRef<TableColumn[]>;
@@ -110,7 +116,7 @@ interface UseTableColumnsOptions {
110
116
  actionsRenderer: (row: DataRecord, index: number) => VNodeChild;
111
117
  /** 编辑模式检查器 */
112
118
  editModeChecker: ComputedRef<{
113
- isNonEditable: (column: TableColumn) => boolean;
119
+ isNonEditable: (column: TableColumn, row?: DataRecord, index?: number) => boolean;
114
120
  isRowEditMode: () => boolean;
115
121
  isCellEditMode: () => boolean;
116
122
  }>;
@@ -165,6 +171,7 @@ declare function useRowEdit(options: RowEditOptions): {
165
171
  isSaving: vue.Ref<boolean, boolean>;
166
172
  isEditingRow: (rowKey: DataTableRowKey) => boolean;
167
173
  startEditRow: (rowKey: DataTableRowKey) => boolean;
174
+ canEditRow: (key: DataTableRowKey) => boolean;
168
175
  cancelEditRow: () => Promise<void>;
169
176
  saveEditRow: () => Promise<{
170
177
  updatedData: DataRecord;
@@ -259,6 +266,7 @@ declare function useTableManager(params: TableManagerParams): {
259
266
  isSaving: vue.Ref<boolean, boolean>;
260
267
  isEditingRow: (rowKey: DataTableRowKey) => boolean;
261
268
  startEditRow: (rowKey: DataTableRowKey) => boolean;
269
+ canEditRow: (key: DataTableRowKey) => boolean;
262
270
  cancelEditRow: () => Promise<void>;
263
271
  saveEditRow: () => Promise<{
264
272
  updatedData: DataRecord;
@@ -313,9 +321,11 @@ declare function useTableManager(params: TableManagerParams): {
313
321
  editingData: vue.Ref<DataRecord, DataRecord>;
314
322
  editingRowKey: vue.Ref<DataTableRowKey | null, DataTableRowKey | null>;
315
323
  editingRowIndex: vue.ComputedRef<number>;
324
+ originalData: vue.ComputedRef<DataRecord>;
316
325
  startEdit: (rowKey: DataTableRowKey, sourceData?: DataRecord | undefined) => boolean;
326
+ canEditRow: (key: DataTableRowKey) => boolean;
317
327
  saveEdit: (formData?: DataRecord | undefined) => Promise<{
318
- updatedData: any;
328
+ updatedData: DataRecord;
319
329
  rowIndex: number;
320
330
  } | undefined>;
321
331
  cancelEdit: () => Promise<boolean>;
@@ -464,6 +474,7 @@ type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
464
474
  interface ModalEditOptions<T extends object = DataRecord> {
465
475
  data: () => T[];
466
476
  rowKey: (row: T) => DataTableRowKey;
477
+ columns?: () => TableColumn<T>[];
467
478
  onSave?: (editingData: T, rowIndex: number, originalKey?: DataTableRowKey) => unknown;
468
479
  onCancel?: (originalData: T, rowIndex: number) => unknown;
469
480
  }
@@ -474,9 +485,11 @@ declare function useModalEdit<T extends object = DataRecord>(options: ModalEditO
474
485
  editingData: [T] extends [vue.Ref<any, any>] ? IfAny<T, vue.Ref<T, T>, T> : vue.Ref<vue.UnwrapRef<T>, T | vue.UnwrapRef<T>>;
475
486
  editingRowKey: vue.Ref<DataTableRowKey | null, DataTableRowKey | null>;
476
487
  editingRowIndex: vue.ComputedRef<number>;
488
+ originalData: vue.ComputedRef<T>;
477
489
  startEdit: (rowKey: DataTableRowKey, sourceData?: T) => boolean;
490
+ canEditRow: (key: DataTableRowKey) => boolean;
478
491
  saveEdit: (formData?: T) => Promise<{
479
- updatedData: any;
492
+ updatedData: T;
480
493
  rowIndex: number;
481
494
  } | undefined>;
482
495
  cancelEdit: () => Promise<boolean>;
@@ -560,6 +573,25 @@ interface IconConfig {
560
573
  typeMap?: Record<string, string>;
561
574
  colorMap?: Record<string, string>;
562
575
  }
576
+ /** 路径按根节点到命中节点排列;路径不代表各级的完整子项列表。 */
577
+ interface TreeSearchSource<T extends object = TreeNodeData> {
578
+ request: (context: {
579
+ search: string;
580
+ signal: AbortSignal;
581
+ limit: number;
582
+ }) => Promise<readonly (readonly T[])[]>;
583
+ /** 根据唯一键恢复一个尚未加载的节点及其祖先。 */
584
+ resolve?: (key: TreeKey, signal: AbortSignal) => Promise<readonly T[] | null>;
585
+ /** 返回该节点的完整直接子项;与搜索补入的部分路径严格区分。 */
586
+ load?: (node: T, context: {
587
+ signal: AbortSignal;
588
+ }) => Promise<readonly T[]>;
589
+ debounce?: number;
590
+ minChars?: number;
591
+ limit?: number;
592
+ /** 身份或业务范围改变时取消旧请求并丢弃远程覆盖层。 */
593
+ scope?: string | number;
594
+ }
563
595
  type MaybeArray<T> = T | T[];
564
596
  type TreeUpdateHandler<T extends object, A extends TreeUpdateMeta['action']> = (keys: TreeKey[], options: Array<T | null>, meta: TreeUpdateMeta<T, A>) => void;
565
597
  type TreeDragHandler<T extends object> = (info: {
@@ -628,6 +660,17 @@ interface TreeProps$1<T extends object = TreeNodeData> {
628
660
  searchPattern?: string;
629
661
  searchable?: boolean;
630
662
  searchPlaceholder?: string;
663
+ searchSource?: TreeSearchSource<T>;
664
+ /** 常用原生能力可直接配置;未传时继续使用 treeProps 和原生默认值。 */
665
+ checkable?: boolean;
666
+ multiple?: boolean;
667
+ cascade?: boolean;
668
+ checkStrategy?: TreeProps['checkStrategy'];
669
+ selectable?: boolean;
670
+ disabled?: boolean;
671
+ virtualScroll?: boolean;
672
+ accordion?: boolean;
673
+ expandOnClick?: boolean;
631
674
  draggable?: boolean;
632
675
  showLine?: boolean;
633
676
  showToolbar?: boolean;
@@ -663,6 +706,16 @@ interface TreeExpose<T extends object = TreeNodeData> {
663
706
  options: Array<T | null>;
664
707
  };
665
708
  scrollTo: TreeInst['scrollTo'];
709
+ /** 展开已知路径,或经 searchSource.resolve 恢复未知节点。 */
710
+ locate: (key: TreeKey) => Promise<boolean>;
711
+ locateMatch: (index: number) => Promise<boolean>;
712
+ nextMatch: () => Promise<boolean>;
713
+ previousMatch: () => Promise<boolean>;
714
+ retrySearch: () => Promise<void>;
715
+ searchLoading: boolean;
716
+ searchError: unknown;
717
+ searchMatchCount: number;
718
+ searchMatchIndex: number;
666
719
  /** Vue 公开实例会解包顶层 Ref;这些属性直接读取数组。 */
667
720
  expandedKeys: TreeKey[];
668
721
  selectedKeys: TreeKey[];
@@ -677,6 +730,7 @@ interface TreeEmits<T extends object = TreeNodeData> {
677
730
  'node-action': [action: string, node: T];
678
731
  'node-drop': [info: DropInfo<T>];
679
732
  'load-error': [error: unknown, node: T];
733
+ 'search-error': [error: unknown];
680
734
  add: [parentNode?: T];
681
735
  refresh: [];
682
736
  }
@@ -691,27 +745,32 @@ interface TreeSlots<T extends object = TreeOption$1> {
691
745
  //#region src/components/C_Tree/index.vue.d.ts
692
746
  declare const __VLS_export: <T extends object = TreeNodeData>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
693
747
  props: vue.PublicProps & __VLS_PrettifyLocal<TreeProps$1<T> & {
748
+ "onLoad-error"?: ((error: unknown, node: T) => any) | undefined;
694
749
  onAdd?: ((parentNode?: T | undefined) => any) | undefined;
750
+ "onUpdate:expandedKeys"?: ((keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "filter" | "select" | "expand" | "unselect" | "collapse" | "check" | "uncheck">) => any) | undefined;
695
751
  onRefresh?: (() => any) | undefined;
696
- "onNode-drop"?: ((info: DropInfo<T>) => any) | undefined;
752
+ "onSearch-error"?: ((error: unknown) => any) | undefined;
697
753
  "onUpdate:searchPattern"?: ((pattern: string) => any) | undefined;
698
- "onUpdate:expandedKeys"?: ((keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "select" | "filter" | "expand" | "collapse" | "unselect" | "check" | "uncheck">) => any) | undefined;
699
- "onUpdate:selectedKeys"?: ((keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "select" | "filter" | "expand" | "collapse" | "unselect" | "check" | "uncheck">) => any) | undefined;
700
- "onUpdate:checkedKeys"?: ((keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "select" | "filter" | "expand" | "collapse" | "unselect" | "check" | "uncheck">) => any) | undefined;
754
+ "onUpdate:selectedKeys"?: ((keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "filter" | "select" | "expand" | "unselect" | "collapse" | "check" | "uncheck">) => any) | undefined;
755
+ "onUpdate:checkedKeys"?: ((keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "filter" | "select" | "expand" | "unselect" | "collapse" | "check" | "uncheck">) => any) | undefined;
701
756
  "onNode-select"?: ((node: T | null, selectedKeys: TreeKey[]) => any) | undefined;
702
757
  "onNode-action"?: ((action: string, node: T) => any) | undefined;
703
- "onLoad-error"?: ((error: unknown, node: T) => any) | undefined;
758
+ "onNode-drop"?: ((info: DropInfo<T>) => any) | undefined;
704
759
  }> & (typeof globalThis extends {
705
760
  __VLS_PROPS_FALLBACK: infer P;
706
761
  } ? P : {});
707
- expose: (exposed: vue.ShallowUnwrapRef<Omit<TreeExpose<T>, "selectedKeys" | "expandedKeys" | "checkedKeys"> & {
762
+ expose: (exposed: vue.ShallowUnwrapRef<Omit<TreeExpose<T>, "expandedKeys" | "checkedKeys" | "selectedKeys" | "searchLoading" | "searchError" | "searchMatchCount" | "searchMatchIndex"> & {
708
763
  expandedKeys: vue.Ref<TreeKey[]>;
709
764
  selectedKeys: vue.Ref<TreeKey[]>;
710
765
  checkedKeys: vue.Ref<TreeKey[]>;
766
+ searchLoading: vue.Ref<boolean>;
767
+ searchError: vue.Ref<unknown>;
768
+ searchMatchCount: vue.Ref<number>;
769
+ searchMatchIndex: vue.Ref<number>;
711
770
  }>) => void;
712
771
  attrs: any;
713
772
  slots: TreeSlots<T>;
714
- emit: ((evt: "add", parentNode?: T | undefined) => void) & ((evt: "refresh") => void) & ((evt: "node-drop", info: DropInfo<T>) => void) & ((evt: "update:searchPattern", pattern: string) => void) & ((evt: "update:expandedKeys", keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "select" | "filter" | "expand" | "collapse" | "unselect" | "check" | "uncheck">) => void) & ((evt: "update:selectedKeys", keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "select" | "filter" | "expand" | "collapse" | "unselect" | "check" | "uncheck">) => void) & ((evt: "update:checkedKeys", keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "select" | "filter" | "expand" | "collapse" | "unselect" | "check" | "uncheck">) => void) & ((evt: "node-select", node: T | null, selectedKeys: TreeKey[]) => void) & ((evt: "node-action", action: string, node: T) => void) & ((evt: "load-error", error: unknown, node: T) => void);
773
+ emit: ((evt: "load-error", error: unknown, node: T) => void) & ((evt: "add", parentNode?: T | undefined) => void) & ((evt: "update:expandedKeys", keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "filter" | "select" | "expand" | "unselect" | "collapse" | "check" | "uncheck">) => void) & ((evt: "refresh") => void) & ((evt: "search-error", error: unknown) => void) & ((evt: "update:searchPattern", pattern: string) => void) & ((evt: "update:selectedKeys", keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "filter" | "select" | "expand" | "unselect" | "collapse" | "check" | "uncheck">) => void) & ((evt: "update:checkedKeys", keys: TreeKey[], options: (T | null)[], meta: TreeUpdateMeta<T, "filter" | "select" | "expand" | "unselect" | "collapse" | "check" | "uncheck">) => void) & ((evt: "node-select", node: T | null, selectedKeys: TreeKey[]) => void) & ((evt: "node-action", action: string, node: T) => void) & ((evt: "node-drop", info: DropInfo<T>) => void);
715
774
  }>) => vue.VNode & {
716
775
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
717
776
  };
@@ -733,9 +792,36 @@ declare function useTreeOperations<T extends object = TreeNodeData>(props: TreeP
733
792
  checkedKeys: vue.WritableComputedRef<TreeKey[], TreeKey[]>;
734
793
  isAllExpanded: vue.ComputedRef<boolean>;
735
794
  treeData: vue.ComputedRef<readonly T[]>;
795
+ search: {
796
+ projection: vue.ComputedRef<{
797
+ data: readonly T[];
798
+ partialKeys: Set<TreeKey>;
799
+ projected: boolean;
800
+ error: unknown;
801
+ }>;
802
+ matches: vue.ShallowRef<readonly (readonly T[])[], readonly (readonly T[])[]>;
803
+ loading: Ref<boolean, boolean>;
804
+ error: vue.ShallowRef<unknown, unknown>;
805
+ matchIndex: Ref<number, number>;
806
+ ready: vue.ComputedRef<boolean>;
807
+ minChars: vue.ComputedRef<number>;
808
+ active: Ref<boolean, boolean>;
809
+ loadingKeys: vue.ShallowRef<ReadonlySet<TreeKey>, ReadonlySet<TreeKey>>;
810
+ run: () => Promise<void>;
811
+ locate: (key: TreeKey) => Promise<boolean>;
812
+ locateMatch: (index: number) => Promise<boolean>;
813
+ load: (node: T) => Promise<boolean>;
814
+ acceptBranch: (key: TreeKey, children: readonly T[]) => void;
815
+ cancelLocate: () => void;
816
+ retainAndReveal: (path: readonly T[]) => Promise<boolean>;
817
+ nextMatch: () => Promise<boolean>;
818
+ previousMatch: () => Promise<boolean>;
819
+ };
736
820
  currentSearchPattern: vue.WritableComputedRef<string, string>;
737
821
  renderPrefix: (info: TreeRenderContext<T>) => any;
738
- renderLabel: (info: TreeRenderContext<T>) => vue.VNodeChild;
822
+ renderLabel: (info: TreeRenderContext<T>) => string | number | boolean | void | vue.VNode<vue.RendererNode, vue.RendererElement, {
823
+ [key: string]: any;
824
+ }> | vue.VNodeArrayChildren | null;
739
825
  renderSuffix: (info: TreeRenderContext<T>) => any;
740
826
  treeBindings: vue.ComputedRef<TreeProps>;
741
827
  treeRef: vue.ShallowRef<TreeInst | undefined, TreeInst | undefined>;
@@ -747,10 +833,14 @@ declare function useTreeOperations<T extends object = TreeNodeData>(props: TreeP
747
833
  handleDrop: (info: DropInfo<T>) => void;
748
834
  handleAdd: () => void;
749
835
  handleRefresh: () => void;
750
- expose: Omit<TreeExpose<T>, "selectedKeys" | "expandedKeys" | "checkedKeys"> & {
836
+ expose: Omit<TreeExpose<T>, "expandedKeys" | "checkedKeys" | "selectedKeys" | "searchLoading" | "searchError" | "searchMatchCount" | "searchMatchIndex"> & {
751
837
  expandedKeys: Ref<TreeKey[]>;
752
838
  selectedKeys: Ref<TreeKey[]>;
753
839
  checkedKeys: Ref<TreeKey[]>;
840
+ searchLoading: Ref<boolean>;
841
+ searchError: Ref<unknown>;
842
+ searchMatchCount: Ref<number>;
843
+ searchMatchIndex: Ref<number>;
754
844
  };
755
845
  };
756
846
  //#endregion
@@ -895,4 +985,23 @@ declare function useTableQuery<T extends object, Q extends object = Record<strin
895
985
  cancel: () => void;
896
986
  };
897
987
  //#endregion
898
- export { HighlightPluginOptions as A, useRowEdit as B, TreeNodeData as C, TreeSlots as D, TreeRenderContext as E, useCellEdit as F, _default$1 as G, defineTableColumns as H, usePagination as I, useTableActions as L, setupHighlight as M, useHighlight as N, TreeUpdateMeta as O, useModalEdit as P, useTableExpand as R, TreeNativeProps as S, TreeProps$1 as T, defineTableConfig as U, useTableColumns as V, validateTableRowKeys as W, StatusType as _, getItem as a, TreeKey as b, setItem as c, _default as d, ActionConfig as f, StatusConfig as g, IconConfig as h, useTableQuery as i, createHighlight as j, HighlightAPI as k, useTreeOperations as l, DropInfo as m, TableQueryResult as n, removeAllItem as o, ButtonType as p, UseTableQueryOptions as r, removeItem as s, TableQueryContext as t, presetConfigs as u, TreeEmits as v, TreeOption$1 as w, TreeMode as x, TreeExpose as y, useTableManager as z };
988
+ //#region src/components/C_Table/editors.d.ts
989
+ /** 类型化候选回调只读业务行,模型更新继续经过表格自己的草稿入口。 */
990
+ interface TableEditorContext<T extends object, V = unknown> {
991
+ row: Readonly<T>;
992
+ index: number;
993
+ updateValue: (value: V) => void;
994
+ }
995
+ type RowSource<T extends object, R extends object, V extends OptionValue, F extends object> = OptionSource<R, V, F> | ((row: Readonly<T>, index: number) => OptionSource<R, V, F>);
996
+ /** 返回现有 editRender;来源与完整候选记录从传入对象推导。 */
997
+ declare function createTableSelectEditor<T extends object = object, R extends object = SelectOptionItem, V extends SelectValue = SelectValue, M extends boolean = false, Tag extends boolean = false, F extends object = Record<string, unknown>>(options: Omit<SelectProps$1<V, M, Tag, R, F>, 'modelValue' | 'source'> & {
998
+ source?: RowSource<T, R, V, F>;
999
+ onSelect?: (selection: SelectSelection<NoInfer<R>, M>, context: TableEditorContext<T, SelectModelValue<V, M, Tag>>) => void;
1000
+ }): NonNullable<TableColumn<T>['editRender']>;
1001
+ /** 自由文本与候选记录保持分离,复用自动补全的原始来源及渲染契约。 */
1002
+ declare function createTableAutoCompleteEditor<T extends object = object, R extends object = AutoCompleteOptionItem, F extends object = Record<string, unknown>>(options: Omit<AutoCompleteProps$1<R, F>, 'modelValue' | 'source'> & {
1003
+ source?: RowSource<T, R, OptionValue, F>;
1004
+ onSelect?: (record: NoInfer<R>, context: TableEditorContext<T, string>) => void;
1005
+ }): NonNullable<TableColumn<T>['editRender']>;
1006
+ //#endregion
1007
+ export { TreeSearchSource as A, usePagination as B, TreeKey as C, TreeOption$1 as D, TreeNodeData as E, createHighlight as F, useTableColumns as G, useTableExpand as H, setupHighlight as I, validateTableRowKeys as J, defineTableColumns as K, useHighlight as L, TreeUpdateMeta as M, HighlightAPI as N, TreeProps$1 as O, HighlightPluginOptions as P, useModalEdit as R, TreeExpose as S, TreeNativeProps as T, useTableManager as U, useTableActions as V, useRowEdit as W, _default$1 as Y, DropInfo as _, TableQueryResult as a, StatusType as b, getItem as c, setItem as d, useTreeOperations as f, ButtonType as g, ActionConfig as h, TableQueryContext as i, TreeSlots as j, TreeRenderContext as k, removeAllItem as l, _default as m, createTableAutoCompleteEditor as n, UseTableQueryOptions as o, presetConfigs as p, defineTableConfig as q, createTableSelectEditor as r, useTableQuery as s, TableEditorContext as t, removeItem as u, IconConfig as v, TreeMode as w, TreeEmits as x, StatusConfig as y, useCellEdit as z };
@@ -0,0 +1 @@
1
+ import{t as e}from"./data2.js";import{n as t,t as n}from"./sourceControls.js";import{computed as r,createVNode as i,nextTick as a,onMounted as o,onScopeDispose as s,ref as c,shallowRef as l,toValue as u}from"vue";const d=(e,t)=>Number.isFinite(e)?Math.max(1,Math.floor(e)):t;function f(t){let n=l([]),i=c(!1),a=l(),f=c(0),p=e(t.initialQuery),m=c(d(t.initialPage,1)),h=c(d(t.pageSize,20)),g=l(e(p)),_=0,v=null,y=async()=>{let r=++_;v?.abort(),v=new AbortController,i.value=!0,a.value=void 0;try{let i=await t.request({page:m.value,pageSize:h.value,query:e(g.value),signal:v.signal});if(r!==_||v.signal.aborted)return!1;if(!Array.isArray(i.data)||!Number.isFinite(i.total))throw TypeError(`[C_Table] request 必须返回 { data: T[], total: number }`);return n.value=e([...i.data]),f.value=Math.max(0,Math.floor(i.total)),t.onSuccess?.({data:n.value,total:f.value}),!0}catch(e){return r!==_||v.signal.aborted?!1:(a.value=e,t.onError?.(e),!1)}finally{r===_&&(i.value=!1)}},b=async(t,n=!0)=>(g.value=e(typeof t==`function`?t(g.value):{...g.value,...t}),m.value=1,n?y():!0),x=async(e,t)=>(m.value=d(e,m.value),h.value=d(t,h.value),y()),S=async(t=!0)=>(g.value=e(p),m.value=1,t?y():!0),C=r(()=>{let e=u(t.config)??{},r=typeof e.pagination==`object`?e.pagination:{};return{data:n.value,loading:i.value,columns:u(t.columns),rowKey:t.rowKey??`id`,config:{...e,pagination:{...r,enabled:!0,remote:!0,page:m.value,pageSize:h.value,total:f.value}}}}),w=r(()=>({...C.value,onPaginationChange:x})),T=()=>{_+=1,v?.abort(),v=null,i.value=!1};return t.immediate!==!1&&o(()=>void y()),s(T),{data:n,loading:i,error:a,total:f,page:m,pageSize:h,query:g,tableProps:C,execute:y,reload:y,setQuery:b,resetQuery:S,handlePaginationChange:x,bindings:w,cancel:T}}function p(e){let{source:n,onSelect:r,...o}=e;return(e,s,c,l)=>i(t,{...o,modelValue:e,size:o.size??l.size,source:typeof n==`function`?n(s,c):n,disabled:l.disabled||o.disabled,"onUpdate:modelValue":l.onUpdate,onSelect:async e=>{await a(),r?.(e,{row:s,index:c,updateValue:l.onUpdate})}})}function m(e){let{source:t,onSelect:r,...o}=e;return(e,s,c,l)=>i(n,{...o,modelValue:e,size:o.size??l.size,source:typeof t==`function`?t(s,c):t,disabled:l.disabled||o.disabled,"onUpdate:modelValue":l.onUpdate,onSelect:async e=>{await a(),r?.(e,{row:s,index:c,updateValue:l.onUpdate})}})}export{p as n,f as r,m as t};