@robot-admin/naive-ui-components 0.22.1 → 0.23.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 (308) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +7 -5
  3. package/README_EN.md +7 -5
  4. package/dist/C_ActionBar.d.cts +2 -1
  5. package/dist/C_ActionBar.d.ts +2 -1
  6. package/dist/C_AntV2.cjs +3 -3
  7. package/dist/C_AntV2.js +3 -3
  8. package/dist/C_BatchResult.cjs +1 -0
  9. package/dist/C_BatchResult.css +32 -0
  10. package/dist/C_BatchResult.d.cts +2 -0
  11. package/dist/C_BatchResult.d.ts +2 -0
  12. package/dist/C_BatchResult.js +1 -0
  13. package/dist/C_BatchResult2.cjs +1 -0
  14. package/dist/C_BatchResult2.js +1 -0
  15. package/dist/C_Breadcrumb.d.cts +2 -2
  16. package/dist/C_Breadcrumb.d.ts +1 -1
  17. package/dist/C_Cascade.d.cts +1 -1
  18. package/dist/C_Cascade.d.ts +1 -1
  19. package/dist/C_Chat.d.cts +1 -1
  20. package/dist/C_Chat.d.ts +1 -1
  21. package/dist/C_City.d.cts +1 -1
  22. package/dist/C_City.d.ts +1 -1
  23. package/dist/C_Code.d.cts +1 -1
  24. package/dist/C_Code.d.ts +1 -1
  25. package/dist/C_ContextMenu.d.cts +1 -1
  26. package/dist/C_ContextMenu.d.ts +1 -1
  27. package/dist/C_DataPicker.cjs +1 -0
  28. package/dist/C_DataPicker.css +54 -0
  29. package/dist/C_DataPicker.d.cts +2 -0
  30. package/dist/C_DataPicker.d.ts +5 -0
  31. package/dist/C_DataPicker.js +1 -0
  32. package/dist/C_DataPicker2.cjs +1 -0
  33. package/dist/C_DataPicker2.js +1 -0
  34. package/dist/C_Date.d.cts +1 -1
  35. package/dist/C_Date.d.ts +1 -1
  36. package/dist/C_Density.cjs +1 -0
  37. package/dist/C_Density.css +1 -0
  38. package/dist/C_Density.d.cts +3 -0
  39. package/dist/C_Density.d.ts +3 -0
  40. package/dist/C_Density.js +1 -0
  41. package/dist/C_Density2.cjs +1 -0
  42. package/dist/C_Density2.js +1 -0
  43. package/dist/C_Editor.d.cts +1 -1
  44. package/dist/C_Editor.d.ts +1 -1
  45. package/dist/C_ErrorSummary.cjs +1 -0
  46. package/dist/C_ErrorSummary.css +29 -0
  47. package/dist/C_ErrorSummary.d.cts +3 -0
  48. package/dist/C_ErrorSummary.d.ts +3 -0
  49. package/dist/C_ErrorSummary.js +1 -0
  50. package/dist/C_ErrorSummary2.cjs +1 -0
  51. package/dist/C_ErrorSummary2.js +1 -0
  52. package/dist/C_Form.base.css +150 -148
  53. package/dist/C_Form.css +151 -253
  54. package/dist/C_Form.d.cts +1 -1
  55. package/dist/C_Form.d.ts +19 -2
  56. package/dist/C_FormModal.css +1 -2
  57. package/dist/C_FormModal.d.cts +1 -1
  58. package/dist/C_FormModal.d.ts +17 -2
  59. package/dist/C_FormSearch.cjs +1 -1
  60. package/dist/C_FormSearch.css +124 -52
  61. package/dist/C_FormSearch.d.cts +3 -3
  62. package/dist/C_FormSearch.d.ts +5 -4
  63. package/dist/C_FormSearch.js +1 -1
  64. package/dist/C_FormulaEditor.d.cts +1 -1
  65. package/dist/C_FormulaEditor.d.ts +1 -1
  66. package/dist/C_Guide.d.cts +1 -1
  67. package/dist/C_Guide.d.ts +1 -1
  68. package/dist/C_Icon.d.cts +1 -1
  69. package/dist/C_Icon.d.ts +1 -1
  70. package/dist/C_Language.d.cts +1 -1
  71. package/dist/C_Language.d.ts +1 -1
  72. package/dist/C_Loading.d.cts +1 -1
  73. package/dist/C_Loading.d.ts +1 -1
  74. package/dist/C_Login.d.cts +1 -1
  75. package/dist/C_Login.d.ts +1 -1
  76. package/dist/C_Markdown.d.cts +1 -1
  77. package/dist/C_Markdown.d.ts +1 -1
  78. package/dist/C_Menu.d.cts +2 -2
  79. package/dist/C_Menu.d.ts +1 -1
  80. package/dist/C_OrgChart.d.cts +1 -1
  81. package/dist/C_OrgChart.d.ts +1 -1
  82. package/dist/C_Progress.d.cts +1 -1
  83. package/dist/C_Progress.d.ts +1 -1
  84. package/dist/C_SectionNav.cjs +1 -0
  85. package/dist/C_SectionNav.css +46 -0
  86. package/dist/C_SectionNav.d.cts +2 -0
  87. package/dist/C_SectionNav.d.ts +2 -0
  88. package/dist/C_SectionNav.js +1 -0
  89. package/dist/C_SectionNav2.cjs +1 -0
  90. package/dist/C_SectionNav2.js +1 -0
  91. package/dist/C_Skeleton.d.cts +1 -1
  92. package/dist/C_Skeleton.d.ts +1 -1
  93. package/dist/C_Steps.d.cts +1 -1
  94. package/dist/C_Steps.d.ts +1 -1
  95. package/dist/C_Table.base.css +258 -256
  96. package/dist/C_Table.cjs +1 -1
  97. package/dist/C_Table.css +109 -1283
  98. package/dist/C_Table.d.cts +2 -1
  99. package/dist/C_Table.d.ts +9 -8
  100. package/dist/C_Table.js +1 -1
  101. package/dist/C_Table2.cjs +3 -0
  102. package/dist/C_Table2.js +3 -0
  103. package/dist/C_Tabs.cjs +1 -1
  104. package/dist/C_Tabs.d.cts +1 -1
  105. package/dist/C_Tabs.d.ts +1 -1
  106. package/dist/C_Tabs.js +1 -1
  107. package/dist/C_TagsView.d.cts +1 -1
  108. package/dist/C_Theme.d.cts +1 -1
  109. package/dist/C_Theme.d.ts +1 -1
  110. package/dist/C_Timeline.d.cts +1 -1
  111. package/dist/C_Timeline.d.ts +1 -1
  112. package/dist/C_Transfer.d.cts +1 -1
  113. package/dist/C_Transfer.d.ts +1 -1
  114. package/dist/C_Tree.d.cts +1 -1
  115. package/dist/C_Tree.d.ts +9 -8
  116. package/dist/C_Upload.d.cts +1 -1
  117. package/dist/C_Upload.d.ts +1 -1
  118. package/dist/C_WorkFlow2.cjs +1 -1
  119. package/dist/C_WorkFlow2.js +1 -1
  120. package/dist/Card.cjs +1 -1
  121. package/dist/Card.js +1 -1
  122. package/dist/Steps.cjs +1 -1
  123. package/dist/Steps.js +1 -1
  124. package/dist/Tabs.cjs +1 -1
  125. package/dist/Tabs.js +1 -1
  126. package/dist/batchPatch.cjs +1 -0
  127. package/dist/batchPatch.d.cts +26 -0
  128. package/dist/batchPatch.d.ts +26 -0
  129. package/dist/batchPatch.js +1 -0
  130. package/dist/config.cjs +1 -1
  131. package/dist/config.d.cts +4 -1
  132. package/dist/config.d.ts +6 -2
  133. package/dist/config.js +1 -1
  134. package/dist/config2.d.ts +1 -1
  135. package/dist/constants.d.cts +3 -3
  136. package/dist/constants.d.ts +3 -3
  137. package/dist/constants2.d.cts +402 -173
  138. package/dist/constants2.d.ts +402 -173
  139. package/dist/constants3.d.cts +4 -4
  140. package/dist/constants3.d.ts +4 -4
  141. package/dist/constants4.d.cts +173 -402
  142. package/dist/constants4.d.ts +173 -402
  143. package/dist/constants5.d.cts +2 -2
  144. package/dist/constants5.d.ts +2 -2
  145. package/dist/contracts.d.ts +24 -0
  146. package/dist/data.cjs +1 -1
  147. package/dist/data.d.cts +5 -108
  148. package/dist/data.d.ts +5 -108
  149. package/dist/data.js +1 -1
  150. package/dist/data2.cjs +1 -1
  151. package/dist/data2.d.cts +108 -0
  152. package/dist/data2.d.ts +108 -0
  153. package/dist/data2.js +1 -1
  154. package/dist/data3.cjs +1 -0
  155. package/dist/data3.js +1 -0
  156. package/dist/dateRange.d.cts +108 -13
  157. package/dist/dateRange.d.ts +110 -14
  158. package/dist/density.d.ts +15 -0
  159. package/dist/dictionary.cjs +1 -0
  160. package/dist/dictionary.d.cts +38 -0
  161. package/dist/dictionary.d.ts +38 -0
  162. package/dist/dictionary.js +1 -0
  163. package/dist/helpers.cjs +1 -1
  164. package/dist/helpers.js +1 -1
  165. package/dist/index.cjs +1 -1
  166. package/dist/index.d.cts +63 -52
  167. package/dist/index.d.ts +71 -57
  168. package/dist/index.js +1 -1
  169. package/dist/index.vue.d.cts +5 -5
  170. package/dist/index.vue.d.ts +5 -5
  171. package/dist/index10.vue.d.cts +37 -80
  172. package/dist/index10.vue.d.ts +77 -53
  173. package/dist/index11.vue.d.cts +77 -53
  174. package/dist/index11.vue.d.ts +1117 -45
  175. package/dist/index12.vue.d.cts +1117 -45
  176. package/dist/index12.vue.d.ts +17 -128
  177. package/dist/index13.vue.d.cts +17 -128
  178. package/dist/index13.vue.d.ts +57 -53
  179. package/dist/index14.vue.d.cts +57 -53
  180. package/dist/index14.vue.d.ts +16 -25
  181. package/dist/index15.vue.d.cts +16 -25
  182. package/dist/index15.vue.d.ts +52 -12
  183. package/dist/index16.vue.d.cts +52 -12
  184. package/dist/index16.vue.d.ts +13 -129
  185. package/dist/index17.vue.d.cts +13 -129
  186. package/dist/index17.vue.d.ts +123 -74
  187. package/dist/index18.vue.d.cts +123 -74
  188. package/dist/index18.vue.d.ts +48 -71
  189. package/dist/index19.vue.d.cts +40 -91
  190. package/dist/index19.vue.d.ts +36 -96
  191. package/dist/index2.vue.d.cts +2 -2
  192. package/dist/index2.vue.d.ts +2 -2
  193. package/dist/index20.vue.d.cts +38 -47
  194. package/dist/index20.vue.d.ts +13 -48
  195. package/dist/index21.vue.d.cts +12 -96
  196. package/dist/index21.vue.d.ts +25 -95
  197. package/dist/index22.vue.d.cts +20 -32
  198. package/dist/index22.vue.d.ts +75 -37
  199. package/dist/index23.vue.d.cts +77 -13
  200. package/dist/index23.vue.d.ts +71 -13
  201. package/dist/index24.vue.d.cts +1 -1
  202. package/dist/index25.vue.d.cts +116 -90
  203. package/dist/index25.vue.d.ts +116 -90
  204. package/dist/index26.vue.d.cts +94 -59
  205. package/dist/index26.vue.d.ts +94 -59
  206. package/dist/index27.vue.d.cts +75 -0
  207. package/dist/index27.vue.d.ts +75 -0
  208. package/dist/index28.vue.d.cts +103 -0
  209. package/dist/index28.vue.d.ts +103 -0
  210. package/dist/index29.vue.d.cts +105 -0
  211. package/dist/index29.vue.d.ts +105 -0
  212. package/dist/index3.vue.d.cts +5 -5
  213. package/dist/index3.vue.d.ts +5 -5
  214. package/dist/index30.vue.d.cts +28 -0
  215. package/dist/index30.vue.d.ts +28 -0
  216. package/dist/index4.vue.d.cts +19 -128
  217. package/dist/index4.vue.d.ts +17 -34
  218. package/dist/index5.vue.d.cts +127 -35
  219. package/dist/index5.vue.d.ts +30 -19
  220. package/dist/index6.vue.d.cts +30 -19
  221. package/dist/index6.vue.d.ts +22 -118
  222. package/dist/index7.vue.d.cts +22 -118
  223. package/dist/index7.vue.d.ts +112 -18
  224. package/dist/index8.vue.d.cts +112 -18
  225. package/dist/index8.vue.d.ts +24 -35
  226. package/dist/index9.vue.d.cts +24 -35
  227. package/dist/index9.vue.d.ts +37 -80
  228. package/dist/mapUtils.d.cts +4 -4
  229. package/dist/mapUtils.d.ts +4 -4
  230. package/dist/numberCodec.cjs +1 -0
  231. package/dist/numberCodec.d.cts +25 -0
  232. package/dist/numberCodec.d.ts +25 -0
  233. package/dist/numberCodec.js +1 -0
  234. package/dist/observer.cjs +1 -0
  235. package/dist/observer.js +1 -0
  236. package/dist/presets.d.cts +3 -66
  237. package/dist/presets.d.ts +3 -66
  238. package/dist/resolver.cjs +1 -1
  239. package/dist/resolver.d.cts +1 -1
  240. package/dist/resolver.d.ts +1 -1
  241. package/dist/resolver.js +1 -1
  242. package/dist/serializeSearch.cjs +1 -0
  243. package/dist/serializeSearch.js +1 -0
  244. package/dist/style.css +547 -308
  245. package/dist/types.d.cts +60 -103
  246. package/dist/types.d.ts +62 -52
  247. package/dist/types2.d.cts +104 -51
  248. package/dist/types2.d.ts +56 -0
  249. package/dist/types3.d.cts +56 -0
  250. package/dist/useCollapsePanel.d.cts +6 -6
  251. package/dist/useCollapsePanel.d.ts +6 -6
  252. package/dist/useComponentLocale.cjs +1 -1
  253. package/dist/useComponentLocale.js +1 -1
  254. package/dist/useCropperCore.d.cts +13 -13
  255. package/dist/useCropperCore.d.ts +13 -13
  256. package/dist/useDataResource.cjs +1 -0
  257. package/dist/useDataResource.js +1 -0
  258. package/dist/useDictionary.cjs +1 -0
  259. package/dist/useDictionary.js +1 -0
  260. package/dist/useDynamicFormState.d.cts +960 -10
  261. package/dist/useDynamicFormState.d.ts +951 -11
  262. package/dist/useEdgeInteraction.d.cts +3 -3
  263. package/dist/useEdgeInteraction.d.ts +3 -3
  264. package/dist/useFormArray.cjs +1 -0
  265. package/dist/useFormArray.d.cts +69 -0
  266. package/dist/useFormArray.d.ts +69 -0
  267. package/dist/useFormArray.js +1 -0
  268. package/dist/useFormConfig.d.cts +14 -0
  269. package/dist/useFormConfig.d.ts +17 -38
  270. package/dist/useGridWidth.cjs +1 -0
  271. package/dist/useGridWidth.js +1 -0
  272. package/dist/useInfiniteScroll.d.cts +3 -3
  273. package/dist/useInfiniteScroll.d.ts +3 -3
  274. package/dist/useQRCode.d.cts +5 -5
  275. package/dist/useQRCode.d.ts +5 -5
  276. package/dist/useSignatureHistory.d.cts +7 -7
  277. package/dist/useSignatureHistory.d.ts +7 -7
  278. package/dist/useSplitResize.d.cts +9 -9
  279. package/dist/useSplitResize.d.ts +9 -9
  280. package/dist/useTableGlobalConfig.cjs +1 -0
  281. package/dist/useTableGlobalConfig.js +1 -0
  282. package/dist/useTableQuery.cjs +1 -3
  283. package/dist/useTableQuery.js +1 -3
  284. package/dist/useWorkflowValidation.d.cts +5 -5
  285. package/dist/useWorkflowValidation.d.ts +5 -5
  286. package/dist/validation.cjs +1 -0
  287. package/dist/validation.d.cts +18 -0
  288. package/dist/validation.d.ts +18 -0
  289. package/dist/validation.js +1 -0
  290. package/dist/verification.d.cts +4 -4
  291. package/dist/verification.d.ts +5 -5
  292. package/dist/workflows.cjs +1 -0
  293. package/dist/workflows.d.cts +2 -0
  294. package/dist/workflows.d.ts +2 -0
  295. package/dist/workflows.js +1 -0
  296. package/docs/components.en.md +13 -1
  297. package/docs/components.md +13 -1
  298. package/docs/guides/batch-results.md +47 -0
  299. package/docs/guides/data-picker.md +65 -0
  300. package/docs/guides/data-workflows.md +123 -0
  301. package/docs/guides/form-density.en.md +39 -0
  302. package/docs/guides/form-density.md +39 -0
  303. package/docs/guides/search-workflows.md +164 -0
  304. package/package.json +21 -1
  305. package/dist/C_FormSearch2.cjs +0 -1
  306. package/dist/C_FormSearch2.js +0 -1
  307. package/dist/useTableQuery.d.cts +0 -1957
  308. package/dist/useTableQuery.d.ts +0 -1946
@@ -1,12 +1,31 @@
1
1
  import { n as ComponentLocale, t as ComponentFeedback } from "./contracts.cjs";
2
+ import { t as DictionaryBinding } from "./dictionary.cjs";
2
3
  import { t as ComponentDensity } from "./density.cjs";
3
4
  import * as vue from "vue";
4
- import { MaybeRefOrGetter, Ref } from "vue";
5
+ import { MaybeRefOrGetter, Ref, VNodeChild } from "vue";
5
6
  import { FormInst, FormItemRule } from "naive-ui";
6
7
 
7
8
  //#region src/components/C_FormSearch/types.d.ts
8
9
  /** 搜索字段支持的控件类型 */
9
- type SearchFieldType = 'input' | 'select' | 'date-range' | 'spacer';
10
+ type SearchFieldType = 'input' | 'select' | 'number' | 'number-range' | 'date' | 'month' | 'date-range' | 'custom' | 'spacer';
11
+ /** 允许只输入一端;空控件仍发布 null。 */
12
+ type SearchNumberRangeValue = [number | null, number | null] | null;
13
+ /** 显式调用 serializeSearch 时才应用,组件不会悄悄改变 onSearch 的业务模型。 */
14
+ interface SearchQueryEncoding {
15
+ name?: string;
16
+ keys?: readonly [string, string];
17
+ serialize?: (value: unknown) => unknown;
18
+ }
19
+ /** 自定义字段与具名插槽共用同一受控边界;updateValue 尊重 fixed/readonly/disabled。 */
20
+ interface SearchFieldContext<T extends object = SearchFormParams> {
21
+ value: unknown;
22
+ model: Readonly<T>;
23
+ prop: Extract<keyof T, string>;
24
+ disabled: boolean;
25
+ readonly: boolean;
26
+ size: 'small' | 'medium' | 'large';
27
+ updateValue: (value: unknown) => void;
28
+ }
10
29
  type SearchOptionValue = string | number | boolean;
11
30
  interface SearchOptionItem<V extends SearchOptionValue = SearchOptionValue> {
12
31
  labelDefault?: string;
@@ -19,6 +38,19 @@ interface SearchOptionItem<V extends SearchOptionValue = SearchOptionValue> {
19
38
  interface SearchFormItemBase {
20
39
  type: SearchFieldType;
21
40
  prop: string;
41
+ label?: string;
42
+ span?: number;
43
+ minWidth?: number;
44
+ /** 固定条件继续参与查询,但不允许控件修改或 reset 清除。 */
45
+ fixed?: boolean;
46
+ disabled?: boolean;
47
+ readonly?: boolean;
48
+ dictionary?: DictionaryBinding;
49
+ /** 日期初值为 null 时显式声明格式化模型,避免清空后切换模型类型。 */
50
+ valueMode?: 'timestamp' | 'formatted';
51
+ query?: SearchQueryEncoding;
52
+ slot?: string;
53
+ render?: (context: SearchFieldContext) => VNodeChild;
22
54
  placeholder?: string;
23
55
  list?: SearchOptionItem[];
24
56
  hisList?: string[];
@@ -32,16 +64,54 @@ type FieldOptions<V> = Array<Omit<SearchOptionItem, 'value'> & {
32
64
  value: Extract<V, SearchOptionValue>;
33
65
  }>;
34
66
  type FieldAttributes = Record<string, unknown>;
67
+ type TypedSingleDate<V> = null extends V ? number extends V ? string extends V ? {
68
+ type: 'date' | 'month';
69
+ valueMode?: 'timestamp' | 'formatted';
70
+ } : {
71
+ type: 'date' | 'month';
72
+ valueMode?: 'timestamp';
73
+ } : string extends V ? {
74
+ type: 'date' | 'month';
75
+ valueMode: 'formatted';
76
+ } : never : never;
77
+ type TypedDateRange<V> = null extends V ? [number, number] extends V ? [string, string] extends V ? {
78
+ type: 'date-range';
79
+ valueMode?: 'timestamp' | 'formatted';
80
+ } : {
81
+ type: 'date-range';
82
+ valueMode?: 'timestamp';
83
+ } : [string, string] extends V ? {
84
+ type: 'date-range';
85
+ valueMode: 'formatted';
86
+ } : never : never;
35
87
  type TypedSearchControl<V> = {
36
88
  type: 'spacer';
37
89
  list?: never;
38
90
  } | (string extends V ? {
39
91
  type: 'input';
40
92
  list?: never;
41
- } : never) | (null extends V ? [number, number] extends V ? {
42
- type: 'date-range';
93
+ } : never) | (number extends V ? null extends V ? {
94
+ type: 'number';
95
+ list?: never;
96
+ } : {
97
+ type: 'number';
98
+ attrs: FieldAttributes & {
99
+ clearable: false;
100
+ };
101
+ defaultValue: V;
102
+ list?: never;
103
+ } : never) | (null extends V ? SearchNumberRangeValue extends V ? {
104
+ type: 'number-range';
105
+ list?: never;
106
+ } : never : never) | (TypedSingleDate<V> & {
107
+ list?: never;
108
+ }) | (TypedDateRange<V> & {
109
+ list?: never;
110
+ }) | {
111
+ type: 'custom';
112
+ defaultValue: V;
43
113
  list?: never;
44
- } : never : never) | (NonNullable<V> extends readonly (infer Item)[] ? [] extends NonNullable<V> ? {
114
+ } | (NonNullable<V> extends readonly (infer Item)[] ? [] extends NonNullable<V> ? {
45
115
  type: 'select';
46
116
  attrs: FieldAttributes & {
47
117
  multiple: true;
@@ -68,9 +138,10 @@ type TypedSearchControl<V> = {
68
138
  */
69
139
  type SearchFormItem<T extends object = SearchFormParams> = {
70
140
  prop: Extract<keyof T, string>;
71
- } & (string extends keyof T ? SearchFormItemBase : { [P in Extract<keyof T, string>]: Omit<SearchFormItemBase, 'type' | 'prop' | 'defaultValue' | 'list'> & {
141
+ } & (string extends keyof T ? SearchFormItemBase : { [P in Extract<keyof T, string>]: Omit<SearchFormItemBase, 'type' | 'prop' | 'defaultValue' | 'list' | 'render'> & {
72
142
  prop: P;
73
143
  defaultValue?: T[P];
144
+ render?: (context: SearchFieldContext<T>) => VNodeChild;
74
145
  } & TypedSearchControl<T[P]> }[Extract<keyof T, string>]);
75
146
  interface SearchFormParams {
76
147
  pageNum?: number;
@@ -80,6 +151,12 @@ interface SearchFormParams {
80
151
  interface SearchConfig<T extends object = SearchFormParams> {
81
152
  /** 与 C_Form、C_Table 统一的布局密度,显式 size 和字段 attrs.size 优先。 */
82
153
  density?: ComponentDensity;
154
+ /** inline 保持原有接入;grid 按实际容器宽度重排,columns 为最大列数。 */
155
+ layout?: 'inline' | 'grid';
156
+ columns?: number;
157
+ fieldMinWidth?: number;
158
+ labelPlacement?: 'left' | 'top';
159
+ labelWidth?: number | string | 'auto';
83
160
  foldThreshold?: number;
84
161
  historyMaxItems?: number;
85
162
  requireValue?: boolean;
@@ -114,24 +191,37 @@ interface FormSearchEmits<T extends object = SearchFormParams> {
114
191
  reset: [params: T];
115
192
  'change-params': [params: T];
116
193
  'update:modelValue': [params: T];
194
+ applied: [params: T];
117
195
  }
118
196
  /** 公开实例的顶层 Ref 已由 Vue 解包。 */
119
197
  interface FormSearchExpose<T extends object = SearchFormParams> {
120
198
  formRef: FormInst | null;
121
199
  formParams: T;
200
+ /** 仅成功的 onSearch 更新;没有执行时为 null,重置草稿不伪造查询成功。 */
201
+ appliedParams: T | null;
202
+ hasUnappliedChanges: boolean;
203
+ hiddenActiveCount: number;
122
204
  searchFn: () => Promise<boolean>;
123
205
  cleanFn: () => void;
206
+ /** 应用常用条件,不改固定/隐藏/只读字段,不自动查询或更新成功快照。 */
207
+ applyPreset: (values: Partial<T>) => boolean;
124
208
  changeFoldState: () => void;
125
209
  }
126
210
  //#endregion
211
+ //#region src/components/C_FormSearch/serializeSearch.d.ts
212
+ interface SerializeSearchOptions {
213
+ /** 仅清理查询载荷,不影响草稿;0/false/前导零均保留。默认 true。 */
214
+ omitEmpty?: boolean;
215
+ }
216
+ /** 显式将搜索模型编码为请求载荷;onSearch/事件始终保留原始 T,不隐式调用此函数。 */
217
+ declare function serializeSearch<T extends object = SearchFormParams>(params: T, fields: readonly SearchFormItem<T>[], options?: SerializeSearchOptions): Record<string, unknown>;
218
+ //#endregion
127
219
  //#region src/components/C_FormSearch/composables/useSearchHistory.d.ts
128
220
  interface SearchHistoryOptions {
129
221
  storageKey?: string;
130
222
  maxItems?: number;
131
223
  }
132
- /**
133
- *
134
- */
224
+ /** 按控件保存有限条文本历史;固定与只读条件不能由历史选择绕过防写边界。 */
135
225
  declare function useSearchHistory<T extends object = SearchFormParams>(fields: Ref<SearchFormItem<T>[]>, formParams: Ref<T>, options?: MaybeRefOrGetter<SearchHistoryOptions>): {
136
226
  enabled: vue.ComputedRef<boolean>;
137
227
  handleFocus: (prop: string) => void;
@@ -150,10 +240,9 @@ interface UseSearchStateOptions<T extends object = SearchFormParams> {
150
240
  config?: MaybeRefOrGetter<SearchConfig<T> | undefined>;
151
241
  loading?: MaybeRefOrGetter<boolean>;
152
242
  historyOptions?: MaybeRefOrGetter<SearchHistoryOptions>;
243
+ onApplied?: (params: T) => void;
153
244
  }
154
- /**
155
- *
156
- */
245
+ /** 搜索草稿、校验锁与成功快照;字段元数据同步不回滚输入,作用域失效不接受迟到结果。 */
157
246
  declare function useSearchState<T extends object = SearchFormParams>(emits: {
158
247
  (event: 'search', params: T): void;
159
248
  (event: 'reset', params: T): void;
@@ -163,6 +252,9 @@ declare function useSearchState<T extends object = SearchFormParams>(emits: {
163
252
  formRef: Ref<FormInst | null, FormInst | null>;
164
253
  fields: Ref<SearchFormItem<T>[], SearchFormItem<T>[]>;
165
254
  formParams: Ref<T, T>;
255
+ appliedParams: Ref<T | null, T | null>;
256
+ hasUnappliedChanges: vue.ComputedRef<boolean>;
257
+ hiddenActiveCount: vue.ComputedRef<number>;
166
258
  expanded: Ref<boolean, boolean>;
167
259
  searching: vue.ComputedRef<boolean>;
168
260
  visibleFields: vue.ComputedRef<SearchFormItem<T>[]>;
@@ -181,8 +273,11 @@ declare function useSearchState<T extends object = SearchFormParams>(emits: {
181
273
  };
182
274
  searchFn: () => Promise<boolean>;
183
275
  resetFn: () => void;
276
+ applyPreset: (values: Partial<T>) => boolean;
184
277
  toggleFold: () => void;
185
278
  syncFromProps: (newItems: SearchFormItem<T>[], newParams: T) => void;
279
+ syncFields: (newItems: SearchFormItem<T>[]) => void;
280
+ syncModel: (newParams: T) => void;
186
281
  };
187
282
  //#endregion
188
283
  //#region src/components/C_FormSearch/dateRange.d.ts
@@ -196,4 +291,4 @@ type DateRangeInput = {
196
291
  /** 搜索日期范围模型,同时支持时间戳和显式格式化日期。 */
197
292
  type SearchDateRangeValue = DateRangeInput['value'];
198
293
  //#endregion
199
- export { FormSearchEmits as a, SearchConfig as c, SearchFormParams as d, SearchOptionItem as f, useSearchHistory as i, SearchFieldType as l, SearchDateRangeValue as n, FormSearchExpose as o, useSearchState as r, FormSearchProps as s, DateRangeInput as t, SearchFormItem as u };
294
+ export { SearchQueryEncoding as _, SerializeSearchOptions as a, FormSearchExpose as c, SearchFieldContext as d, SearchFieldType as f, SearchOptionItem as g, SearchNumberRangeValue as h, useSearchHistory as i, FormSearchProps as l, SearchFormParams as m, SearchDateRangeValue as n, serializeSearch as o, SearchFormItem as p, useSearchState as r, FormSearchEmits as s, DateRangeInput as t, SearchConfig as u };
@@ -1,11 +1,31 @@
1
- import { X as ComponentLocale, Y as ComponentFeedback, u as ComponentDensity } from "./useFormConfig.js";
1
+ import { n as ComponentLocale, t as ComponentFeedback } from "./contracts.js";
2
+ import { t as DictionaryBinding } from "./dictionary.js";
3
+ import { t as ComponentDensity } from "./density.js";
2
4
  import * as vue from "vue";
3
- import { MaybeRefOrGetter, Ref } from "vue";
5
+ import { MaybeRefOrGetter, Ref, VNodeChild } from "vue";
4
6
  import { FormInst, FormItemRule } from "naive-ui";
5
7
 
6
8
  //#region src/components/C_FormSearch/types.d.ts
7
9
  /** 搜索字段支持的控件类型 */
8
- type SearchFieldType = 'input' | 'select' | 'date-range' | 'spacer';
10
+ type SearchFieldType = 'input' | 'select' | 'number' | 'number-range' | 'date' | 'month' | 'date-range' | 'custom' | 'spacer';
11
+ /** 允许只输入一端;空控件仍发布 null。 */
12
+ type SearchNumberRangeValue = [number | null, number | null] | null;
13
+ /** 显式调用 serializeSearch 时才应用,组件不会悄悄改变 onSearch 的业务模型。 */
14
+ interface SearchQueryEncoding {
15
+ name?: string;
16
+ keys?: readonly [string, string];
17
+ serialize?: (value: unknown) => unknown;
18
+ }
19
+ /** 自定义字段与具名插槽共用同一受控边界;updateValue 尊重 fixed/readonly/disabled。 */
20
+ interface SearchFieldContext<T extends object = SearchFormParams> {
21
+ value: unknown;
22
+ model: Readonly<T>;
23
+ prop: Extract<keyof T, string>;
24
+ disabled: boolean;
25
+ readonly: boolean;
26
+ size: 'small' | 'medium' | 'large';
27
+ updateValue: (value: unknown) => void;
28
+ }
9
29
  type SearchOptionValue = string | number | boolean;
10
30
  interface SearchOptionItem<V extends SearchOptionValue = SearchOptionValue> {
11
31
  labelDefault?: string;
@@ -18,6 +38,19 @@ interface SearchOptionItem<V extends SearchOptionValue = SearchOptionValue> {
18
38
  interface SearchFormItemBase {
19
39
  type: SearchFieldType;
20
40
  prop: string;
41
+ label?: string;
42
+ span?: number;
43
+ minWidth?: number;
44
+ /** 固定条件继续参与查询,但不允许控件修改或 reset 清除。 */
45
+ fixed?: boolean;
46
+ disabled?: boolean;
47
+ readonly?: boolean;
48
+ dictionary?: DictionaryBinding;
49
+ /** 日期初值为 null 时显式声明格式化模型,避免清空后切换模型类型。 */
50
+ valueMode?: 'timestamp' | 'formatted';
51
+ query?: SearchQueryEncoding;
52
+ slot?: string;
53
+ render?: (context: SearchFieldContext) => VNodeChild;
21
54
  placeholder?: string;
22
55
  list?: SearchOptionItem[];
23
56
  hisList?: string[];
@@ -31,16 +64,54 @@ type FieldOptions<V> = Array<Omit<SearchOptionItem, 'value'> & {
31
64
  value: Extract<V, SearchOptionValue>;
32
65
  }>;
33
66
  type FieldAttributes = Record<string, unknown>;
67
+ type TypedSingleDate<V> = null extends V ? number extends V ? string extends V ? {
68
+ type: 'date' | 'month';
69
+ valueMode?: 'timestamp' | 'formatted';
70
+ } : {
71
+ type: 'date' | 'month';
72
+ valueMode?: 'timestamp';
73
+ } : string extends V ? {
74
+ type: 'date' | 'month';
75
+ valueMode: 'formatted';
76
+ } : never : never;
77
+ type TypedDateRange<V> = null extends V ? [number, number] extends V ? [string, string] extends V ? {
78
+ type: 'date-range';
79
+ valueMode?: 'timestamp' | 'formatted';
80
+ } : {
81
+ type: 'date-range';
82
+ valueMode?: 'timestamp';
83
+ } : [string, string] extends V ? {
84
+ type: 'date-range';
85
+ valueMode: 'formatted';
86
+ } : never : never;
34
87
  type TypedSearchControl<V> = {
35
88
  type: 'spacer';
36
89
  list?: never;
37
90
  } | (string extends V ? {
38
91
  type: 'input';
39
92
  list?: never;
40
- } : never) | (null extends V ? [number, number] extends V ? {
41
- type: 'date-range';
93
+ } : never) | (number extends V ? null extends V ? {
94
+ type: 'number';
95
+ list?: never;
96
+ } : {
97
+ type: 'number';
98
+ attrs: FieldAttributes & {
99
+ clearable: false;
100
+ };
101
+ defaultValue: V;
102
+ list?: never;
103
+ } : never) | (null extends V ? SearchNumberRangeValue extends V ? {
104
+ type: 'number-range';
105
+ list?: never;
106
+ } : never : never) | (TypedSingleDate<V> & {
107
+ list?: never;
108
+ }) | (TypedDateRange<V> & {
109
+ list?: never;
110
+ }) | {
111
+ type: 'custom';
112
+ defaultValue: V;
42
113
  list?: never;
43
- } : never : never) | (NonNullable<V> extends readonly (infer Item)[] ? [] extends NonNullable<V> ? {
114
+ } | (NonNullable<V> extends readonly (infer Item)[] ? [] extends NonNullable<V> ? {
44
115
  type: 'select';
45
116
  attrs: FieldAttributes & {
46
117
  multiple: true;
@@ -67,9 +138,10 @@ type TypedSearchControl<V> = {
67
138
  */
68
139
  type SearchFormItem<T extends object = SearchFormParams> = {
69
140
  prop: Extract<keyof T, string>;
70
- } & (string extends keyof T ? SearchFormItemBase : { [P in Extract<keyof T, string>]: Omit<SearchFormItemBase, 'type' | 'prop' | 'defaultValue' | 'list'> & {
141
+ } & (string extends keyof T ? SearchFormItemBase : { [P in Extract<keyof T, string>]: Omit<SearchFormItemBase, 'type' | 'prop' | 'defaultValue' | 'list' | 'render'> & {
71
142
  prop: P;
72
143
  defaultValue?: T[P];
144
+ render?: (context: SearchFieldContext<T>) => VNodeChild;
73
145
  } & TypedSearchControl<T[P]> }[Extract<keyof T, string>]);
74
146
  interface SearchFormParams {
75
147
  pageNum?: number;
@@ -79,6 +151,12 @@ interface SearchFormParams {
79
151
  interface SearchConfig<T extends object = SearchFormParams> {
80
152
  /** 与 C_Form、C_Table 统一的布局密度,显式 size 和字段 attrs.size 优先。 */
81
153
  density?: ComponentDensity;
154
+ /** inline 保持原有接入;grid 按实际容器宽度重排,columns 为最大列数。 */
155
+ layout?: 'inline' | 'grid';
156
+ columns?: number;
157
+ fieldMinWidth?: number;
158
+ labelPlacement?: 'left' | 'top';
159
+ labelWidth?: number | string | 'auto';
82
160
  foldThreshold?: number;
83
161
  historyMaxItems?: number;
84
162
  requireValue?: boolean;
@@ -113,24 +191,37 @@ interface FormSearchEmits<T extends object = SearchFormParams> {
113
191
  reset: [params: T];
114
192
  'change-params': [params: T];
115
193
  'update:modelValue': [params: T];
194
+ applied: [params: T];
116
195
  }
117
196
  /** 公开实例的顶层 Ref 已由 Vue 解包。 */
118
197
  interface FormSearchExpose<T extends object = SearchFormParams> {
119
198
  formRef: FormInst | null;
120
199
  formParams: T;
200
+ /** 仅成功的 onSearch 更新;没有执行时为 null,重置草稿不伪造查询成功。 */
201
+ appliedParams: T | null;
202
+ hasUnappliedChanges: boolean;
203
+ hiddenActiveCount: number;
121
204
  searchFn: () => Promise<boolean>;
122
205
  cleanFn: () => void;
206
+ /** 应用常用条件,不改固定/隐藏/只读字段,不自动查询或更新成功快照。 */
207
+ applyPreset: (values: Partial<T>) => boolean;
123
208
  changeFoldState: () => void;
124
209
  }
125
210
  //#endregion
211
+ //#region src/components/C_FormSearch/serializeSearch.d.ts
212
+ interface SerializeSearchOptions {
213
+ /** 仅清理查询载荷,不影响草稿;0/false/前导零均保留。默认 true。 */
214
+ omitEmpty?: boolean;
215
+ }
216
+ /** 显式将搜索模型编码为请求载荷;onSearch/事件始终保留原始 T,不隐式调用此函数。 */
217
+ declare function serializeSearch<T extends object = SearchFormParams>(params: T, fields: readonly SearchFormItem<T>[], options?: SerializeSearchOptions): Record<string, unknown>;
218
+ //#endregion
126
219
  //#region src/components/C_FormSearch/composables/useSearchHistory.d.ts
127
220
  interface SearchHistoryOptions {
128
221
  storageKey?: string;
129
222
  maxItems?: number;
130
223
  }
131
- /**
132
- *
133
- */
224
+ /** 按控件保存有限条文本历史;固定与只读条件不能由历史选择绕过防写边界。 */
134
225
  declare function useSearchHistory<T extends object = SearchFormParams>(fields: Ref<SearchFormItem<T>[]>, formParams: Ref<T>, options?: MaybeRefOrGetter<SearchHistoryOptions>): {
135
226
  enabled: vue.ComputedRef<boolean>;
136
227
  handleFocus: (prop: string) => void;
@@ -149,10 +240,9 @@ interface UseSearchStateOptions<T extends object = SearchFormParams> {
149
240
  config?: MaybeRefOrGetter<SearchConfig<T> | undefined>;
150
241
  loading?: MaybeRefOrGetter<boolean>;
151
242
  historyOptions?: MaybeRefOrGetter<SearchHistoryOptions>;
243
+ onApplied?: (params: T) => void;
152
244
  }
153
- /**
154
- *
155
- */
245
+ /** 搜索草稿、校验锁与成功快照;字段元数据同步不回滚输入,作用域失效不接受迟到结果。 */
156
246
  declare function useSearchState<T extends object = SearchFormParams>(emits: {
157
247
  (event: 'search', params: T): void;
158
248
  (event: 'reset', params: T): void;
@@ -162,6 +252,9 @@ declare function useSearchState<T extends object = SearchFormParams>(emits: {
162
252
  formRef: Ref<FormInst | null, FormInst | null>;
163
253
  fields: Ref<SearchFormItem<T>[], SearchFormItem<T>[]>;
164
254
  formParams: Ref<T, T>;
255
+ appliedParams: Ref<T | null, T | null>;
256
+ hasUnappliedChanges: vue.ComputedRef<boolean>;
257
+ hiddenActiveCount: vue.ComputedRef<number>;
165
258
  expanded: Ref<boolean, boolean>;
166
259
  searching: vue.ComputedRef<boolean>;
167
260
  visibleFields: vue.ComputedRef<SearchFormItem<T>[]>;
@@ -180,8 +273,11 @@ declare function useSearchState<T extends object = SearchFormParams>(emits: {
180
273
  };
181
274
  searchFn: () => Promise<boolean>;
182
275
  resetFn: () => void;
276
+ applyPreset: (values: Partial<T>) => boolean;
183
277
  toggleFold: () => void;
184
278
  syncFromProps: (newItems: SearchFormItem<T>[], newParams: T) => void;
279
+ syncFields: (newItems: SearchFormItem<T>[]) => void;
280
+ syncModel: (newParams: T) => void;
185
281
  };
186
282
  //#endregion
187
283
  //#region src/components/C_FormSearch/dateRange.d.ts
@@ -195,4 +291,4 @@ type DateRangeInput = {
195
291
  /** 搜索日期范围模型,同时支持时间戳和显式格式化日期。 */
196
292
  type SearchDateRangeValue = DateRangeInput['value'];
197
293
  //#endregion
198
- export { FormSearchEmits as a, SearchConfig as c, SearchFormParams as d, SearchOptionItem as f, useSearchHistory as i, SearchFieldType as l, SearchDateRangeValue as n, FormSearchExpose as o, useSearchState as r, FormSearchProps as s, DateRangeInput as t, SearchFormItem as u };
294
+ export { SearchQueryEncoding as _, SerializeSearchOptions as a, FormSearchExpose as c, SearchFieldContext as d, SearchFieldType as f, SearchOptionItem as g, SearchNumberRangeValue as h, useSearchHistory as i, FormSearchProps as l, SearchFormParams as m, SearchDateRangeValue as n, serializeSearch as o, SearchFormItem as p, useSearchState as r, FormSearchEmits as s, DateRangeInput as t, SearchConfig as u };
@@ -0,0 +1,15 @@
1
+ //#region src/core/density.d.ts
2
+ /** UI 密度协议与纯数据预设,不依赖 Vue、Naive UI 或浏览器。 */
3
+ type ComponentDensity = 'default' | 'compact' | 'comfortable';
4
+ interface ResolvedComponentDensity {
5
+ density: ComponentDensity;
6
+ size: 'small' | 'medium' | 'large';
7
+ gap: number;
8
+ rowGap: number;
9
+ padding: number;
10
+ formItemGap: number;
11
+ }
12
+ /** 每次返回独立预设,显式控件尺寸与布局配置由消费组件在上层覆盖。 */
13
+ declare const resolveComponentDensity: (density?: ComponentDensity) => ResolvedComponentDensity;
14
+ //#endregion
15
+ export { ResolvedComponentDensity as n, resolveComponentDensity as r, ComponentDensity as t };
@@ -0,0 +1 @@
1
+ function e(e){let t=new Map;for(let n of e)t.has(n.value)||t.set(n.value,n.label);return e=>t.get(e)??String(e??``)}function t(e,t){return t.find(t=>Object.is(t.value,e))?.label??String(e??``)}function n(e,t){let n=t.find(t=>Object.is(t.value,e));if(n)return{ok:!0,value:n.value};if(typeof e!=`string`)return{ok:!1,reason:`unknown`,input:e};let r=t.filter(t=>String(t.value)===e),i=r.length?r:t.filter(t=>t.label===e);return i.length===1?{ok:!0,value:i[0].value}:{ok:!1,reason:i.length?`ambiguous`:`unknown`,input:e}}function r(e){return Array.isArray(e)?e.map(r):typeof e==`string`||typeof e==`number`||typeof e==`boolean`?JSON.stringify([typeof e,e]):e}function i(e){if(Array.isArray(e))return e.map(i);if(typeof e!=`string`)return e;try{let t=JSON.parse(e);if(Array.isArray(t)&&t.length===2&&[`string`,`number`,`boolean`].includes(t[0])&&typeof t[1]===t[0])return t[1]}catch{}return e}function a(e){return e.map(e=>({...e,value:r(e.value)}))}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return e}});
@@ -0,0 +1,38 @@
1
+ //#region src/core/dictionary.d.ts
2
+ /**
3
+ * 字典值协议与纯转换工具。数据缓存、请求与租户隔离由应用 Provider 负责。
4
+ * 此模块不依赖 Vue、UI、DOM 或任何表格实现,可用于导入、导出和适配层。
5
+ */
6
+ type DictionaryValue = string | number | boolean;
7
+ interface DictionaryOption {
8
+ value: DictionaryValue;
9
+ label: string;
10
+ disabled?: boolean;
11
+ }
12
+ interface DictionarySource {
13
+ getOptions(): readonly DictionaryOption[];
14
+ load?(context: {
15
+ signal: AbortSignal;
16
+ }): Promise<readonly DictionaryOption[]>;
17
+ subscribe?(listener: () => void): () => void;
18
+ }
19
+ interface DictionaryProvider {
20
+ getDictionary(name: string): DictionarySource | undefined;
21
+ }
22
+ type DictionaryBinding = string | DictionarySource;
23
+ type DictionaryParseResult = {
24
+ ok: true;
25
+ value: DictionaryValue;
26
+ } | {
27
+ ok: false;
28
+ reason: 'unknown' | 'ambiguous';
29
+ input: unknown;
30
+ };
31
+ /** 每份选项快照只建一次索引,表格单元格解析不重复遍历整份字典。 */
32
+ declare function createDictionaryLabelResolver(options: readonly DictionaryOption[]): (value: unknown) => string;
33
+ /** 原值比较保留 boolean、数值和带前导零的字符串编码,不回写展示标签。 */
34
+ declare function getDictionaryLabel(value: unknown, options: readonly DictionaryOption[]): string;
35
+ /** 原码优先于标签;多义标签或字符串化编码必须交由使用侧明确处理。 */
36
+ declare function parseDictionaryValue(input: unknown, options: readonly DictionaryOption[]): DictionaryParseResult;
37
+ //#endregion
38
+ export { DictionarySource as a, getDictionaryLabel as c, DictionaryProvider as i, parseDictionaryValue as l, DictionaryOption as n, DictionaryValue as o, DictionaryParseResult as r, createDictionaryLabelResolver as s, DictionaryBinding as t };
@@ -0,0 +1,38 @@
1
+ //#region src/core/dictionary.d.ts
2
+ /**
3
+ * 字典值协议与纯转换工具。数据缓存、请求与租户隔离由应用 Provider 负责。
4
+ * 此模块不依赖 Vue、UI、DOM 或任何表格实现,可用于导入、导出和适配层。
5
+ */
6
+ type DictionaryValue = string | number | boolean;
7
+ interface DictionaryOption {
8
+ value: DictionaryValue;
9
+ label: string;
10
+ disabled?: boolean;
11
+ }
12
+ interface DictionarySource {
13
+ getOptions(): readonly DictionaryOption[];
14
+ load?(context: {
15
+ signal: AbortSignal;
16
+ }): Promise<readonly DictionaryOption[]>;
17
+ subscribe?(listener: () => void): () => void;
18
+ }
19
+ interface DictionaryProvider {
20
+ getDictionary(name: string): DictionarySource | undefined;
21
+ }
22
+ type DictionaryBinding = string | DictionarySource;
23
+ type DictionaryParseResult = {
24
+ ok: true;
25
+ value: DictionaryValue;
26
+ } | {
27
+ ok: false;
28
+ reason: 'unknown' | 'ambiguous';
29
+ input: unknown;
30
+ };
31
+ /** 每份选项快照只建一次索引,表格单元格解析不重复遍历整份字典。 */
32
+ declare function createDictionaryLabelResolver(options: readonly DictionaryOption[]): (value: unknown) => string;
33
+ /** 原值比较保留 boolean、数值和带前导零的字符串编码,不回写展示标签。 */
34
+ declare function getDictionaryLabel(value: unknown, options: readonly DictionaryOption[]): string;
35
+ /** 原码优先于标签;多义标签或字符串化编码必须交由使用侧明确处理。 */
36
+ declare function parseDictionaryValue(input: unknown, options: readonly DictionaryOption[]): DictionaryParseResult;
37
+ //#endregion
38
+ export { DictionarySource as a, getDictionaryLabel as c, DictionaryProvider as i, parseDictionaryValue as l, DictionaryOption as n, DictionaryValue as o, DictionaryParseResult as r, createDictionaryLabelResolver as s, DictionaryBinding as t };
@@ -0,0 +1 @@
1
+ function e(e){let t=new Map;for(let n of e)t.has(n.value)||t.set(n.value,n.label);return e=>t.get(e)??String(e??``)}function t(e,t){return t.find(t=>Object.is(t.value,e))?.label??String(e??``)}function n(e,t){let n=t.find(t=>Object.is(t.value,e));if(n)return{ok:!0,value:n.value};if(typeof e!=`string`)return{ok:!1,reason:`unknown`,input:e};let r=t.filter(t=>String(t.value)===e),i=r.length?r:t.filter(t=>t.label===e);return i.length===1?{ok:!0,value:i[0].value}:{ok:!1,reason:i.length?`ambiguous`:`unknown`,input:e}}function r(e){return Array.isArray(e)?e.map(r):typeof e==`string`||typeof e==`number`||typeof e==`boolean`?JSON.stringify([typeof e,e]):e}function i(e){if(Array.isArray(e))return e.map(i);if(typeof e!=`string`)return e;try{let t=JSON.parse(e);if(Array.isArray(t)&&t.length===2&&[`string`,`number`,`boolean`].includes(t[0])&&typeof t[1]===t[0])return t[1]}catch{}return e}function a(e){return e.map(e=>({...e,value:r(e.value)}))}export{n as a,t as i,i as n,a as o,r,e as t};