@robot-admin/naive-ui-components 0.41.1 → 0.42.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 (326) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +46 -5
  3. package/README_EN.md +54 -13
  4. package/dist/ActionOverflow.cjs +1 -1
  5. package/dist/ActionOverflow.js +1 -1
  6. package/dist/C_ActionBar.cjs +1 -1
  7. package/dist/C_ActionBar.css +54 -54
  8. package/dist/C_ActionBar.js +1 -1
  9. package/dist/C_ActionBar2.cjs +1 -1
  10. package/dist/C_ActionBar2.js +1 -1
  11. package/dist/C_AntV.css +10 -10
  12. package/dist/C_AntV2.cjs +1 -1
  13. package/dist/C_AntV2.js +1 -1
  14. package/dist/C_ApprovalViewer.css +15 -15
  15. package/dist/C_ApprovalViewer2.cjs +1 -1
  16. package/dist/C_ApprovalViewer2.js +1 -1
  17. package/dist/C_AudioPlayer.css +53 -53
  18. package/dist/C_AudioPlayer2.cjs +1 -1
  19. package/dist/C_AudioPlayer2.js +1 -1
  20. package/dist/C_AutoComplete.css +2 -2
  21. package/dist/C_AutoComplete2.cjs +1 -1
  22. package/dist/C_AutoComplete2.js +1 -1
  23. package/dist/C_AvatarGroup.css +29 -29
  24. package/dist/C_AvatarGroup2.cjs +1 -1
  25. package/dist/C_AvatarGroup2.js +1 -1
  26. package/dist/C_BatchResult.css +10 -10
  27. package/dist/C_BatchResult2.cjs +1 -1
  28. package/dist/C_BatchResult2.js +1 -1
  29. package/dist/C_Breadcrumb.css +40 -40
  30. package/dist/C_Breadcrumb2.cjs +1 -1
  31. package/dist/C_Breadcrumb2.js +1 -1
  32. package/dist/C_Captcha.d.cts +2 -2
  33. package/dist/C_Captcha.d.ts +2 -2
  34. package/dist/C_Captcha2.cjs +1 -1
  35. package/dist/C_Captcha2.js +1 -1
  36. package/dist/C_Cascade.css +4 -4
  37. package/dist/C_Cascade2.cjs +1 -1
  38. package/dist/C_Cascade2.js +1 -1
  39. package/dist/C_Chat2.cjs +1 -1
  40. package/dist/C_Chat2.js +1 -1
  41. package/dist/C_City.css +35 -35
  42. package/dist/C_City2.cjs +1 -1
  43. package/dist/C_City2.js +1 -1
  44. package/dist/C_Code.css +27 -27
  45. package/dist/C_Code2.cjs +1 -1
  46. package/dist/C_Code2.js +2 -2
  47. package/dist/C_CollapsePanel2.cjs +1 -1
  48. package/dist/C_CollapsePanel2.js +1 -1
  49. package/dist/C_ContextMenu.css +3 -3
  50. package/dist/C_ContextMenu2.cjs +1 -1
  51. package/dist/C_ContextMenu2.js +1 -1
  52. package/dist/C_Cron.css +18 -18
  53. package/dist/C_Cron2.cjs +1 -1
  54. package/dist/C_Cron2.js +1 -1
  55. package/dist/C_DataPicker.css +52 -52
  56. package/dist/C_DataPicker2.cjs +1 -1
  57. package/dist/C_DataPicker2.js +1 -1
  58. package/dist/C_Date.css +5 -5
  59. package/dist/C_Date2.cjs +1 -1
  60. package/dist/C_Date2.js +1 -1
  61. package/dist/C_Density2.cjs +1 -1
  62. package/dist/C_Density2.js +1 -1
  63. package/dist/C_Draggable.css +66 -53
  64. package/dist/C_Draggable2.cjs +1 -1
  65. package/dist/C_Draggable2.js +1 -1
  66. package/dist/C_Editor.css +13 -13
  67. package/dist/C_Editor.d.cts +2 -2
  68. package/dist/C_Editor.d.ts +2 -2
  69. package/dist/C_Editor2.cjs +1 -1
  70. package/dist/C_Editor2.js +1 -1
  71. package/dist/C_FilePreview.css +49 -49
  72. package/dist/C_FilePreview2.cjs +1 -1
  73. package/dist/C_FilePreview2.js +1 -1
  74. package/dist/C_Form.base.css +242 -242
  75. package/dist/C_Form.css +242 -242
  76. package/dist/C_Form.d.cts +1 -1
  77. package/dist/C_Form.d.ts +1 -1
  78. package/dist/C_FormModal.css +55 -55
  79. package/dist/C_FormModal2.cjs +1 -1
  80. package/dist/C_FormModal2.js +1 -1
  81. package/dist/C_FormSearch.css +75 -75
  82. package/dist/C_FormSearch.d.ts +1 -1
  83. package/dist/C_FormulaEditor.cjs +1 -1
  84. package/dist/C_FormulaEditor.css +41 -41
  85. package/dist/C_FormulaEditor.d.cts +2 -2
  86. package/dist/C_FormulaEditor.d.ts +2 -2
  87. package/dist/C_FormulaEditor.js +1 -1
  88. package/dist/C_GlobalSearch2.cjs +1 -1
  89. package/dist/C_GlobalSearch2.js +1 -1
  90. package/dist/C_Guide.css +13 -13
  91. package/dist/C_Guide2.cjs +1 -1
  92. package/dist/C_Guide2.js +1 -1
  93. package/dist/C_ImageCropper.css +27 -27
  94. package/dist/C_ImageCropper2.cjs +1 -1
  95. package/dist/C_ImageCropper2.js +1 -1
  96. package/dist/C_ImportWizard.css +8 -8
  97. package/dist/C_ImportWizard2.cjs +1 -1
  98. package/dist/C_ImportWizard2.js +1 -1
  99. package/dist/C_Language.css +2 -2
  100. package/dist/C_Language2.cjs +1 -1
  101. package/dist/C_Language2.js +1 -1
  102. package/dist/C_Loading.css +18 -18
  103. package/dist/C_Loading2.cjs +1 -1
  104. package/dist/C_Loading2.js +1 -1
  105. package/dist/C_Login.css +94 -94
  106. package/dist/C_Login2.cjs +1 -1
  107. package/dist/C_Login2.js +1 -1
  108. package/dist/C_Markdown.css +37 -37
  109. package/dist/C_Markdown2.cjs +1 -1
  110. package/dist/C_Markdown2.js +1 -1
  111. package/dist/C_NotificationCenter.css +24 -24
  112. package/dist/C_NotificationCenter2.cjs +1 -1
  113. package/dist/C_NotificationCenter2.js +1 -1
  114. package/dist/C_OrgChart.d.cts +2 -8
  115. package/dist/C_OrgChart.d.ts +2 -8
  116. package/dist/C_Progress2.cjs +1 -1
  117. package/dist/C_Progress2.js +1 -1
  118. package/dist/C_QRCode.css +9 -9
  119. package/dist/C_QRCode2.cjs +1 -1
  120. package/dist/C_QRCode2.js +1 -1
  121. package/dist/C_RecurrenceEditor.cjs +1 -1
  122. package/dist/C_RecurrenceEditor.d.cts +2 -2
  123. package/dist/C_RecurrenceEditor.d.ts +2 -2
  124. package/dist/C_RecurrenceEditor.js +1 -1
  125. package/dist/C_RecurrenceEditor2.cjs +1 -1
  126. package/dist/C_RecurrenceEditor2.js +1 -1
  127. package/dist/C_ResourceSchedule2.cjs +1 -1
  128. package/dist/C_ResourceSchedule2.js +1 -1
  129. package/dist/C_ScanInput2.cjs +1 -1
  130. package/dist/C_ScanInput2.js +1 -1
  131. package/dist/C_SectionNav.css +8 -8
  132. package/dist/C_SectionNav2.cjs +1 -1
  133. package/dist/C_SectionNav2.js +1 -1
  134. package/dist/C_Select.css +1 -1
  135. package/dist/C_Select2.cjs +1 -1
  136. package/dist/C_Select2.js +1 -1
  137. package/dist/C_Signature.css +15 -15
  138. package/dist/C_Signature2.cjs +1 -1
  139. package/dist/C_Signature2.js +1 -1
  140. package/dist/C_SplitPane2.cjs +1 -1
  141. package/dist/C_SplitPane2.js +1 -1
  142. package/dist/C_Table.base.css +429 -429
  143. package/dist/C_Table.css +187 -187
  144. package/dist/C_Table.d.cts +1 -1
  145. package/dist/C_Table.d.ts +1 -1
  146. package/dist/C_Table2.cjs +4 -4
  147. package/dist/C_Table2.js +4 -4
  148. package/dist/C_Timeline.css +50 -50
  149. package/dist/C_Timeline2.cjs +1 -1
  150. package/dist/C_Timeline2.js +1 -1
  151. package/dist/C_Transfer.css +25 -25
  152. package/dist/C_Transfer2.cjs +1 -1
  153. package/dist/C_Transfer2.js +1 -1
  154. package/dist/C_Tree.css +30 -30
  155. package/dist/C_Tree2.cjs +1 -1
  156. package/dist/C_Tree2.js +1 -1
  157. package/dist/C_Upload.css +5 -5
  158. package/dist/C_Upload2.cjs +1 -1
  159. package/dist/C_Upload2.js +1 -1
  160. package/dist/C_UserPicker.css +1 -1
  161. package/dist/C_VideoPlayer2.cjs +1 -1
  162. package/dist/C_VideoPlayer2.js +1 -1
  163. package/dist/C_VtableGantt.css +34 -34
  164. package/dist/C_WorkFlow.css +93 -93
  165. package/dist/C_WorkFlow2.cjs +1 -1
  166. package/dist/C_WorkFlow2.js +1 -1
  167. package/dist/Card.cjs +1 -1
  168. package/dist/Card.js +1 -1
  169. package/dist/ColumnSettingsDrawer.cjs +1 -0
  170. package/dist/ColumnSettingsDrawer.js +1 -0
  171. package/dist/Custom.cjs +1 -1
  172. package/dist/Custom.js +1 -1
  173. package/dist/Dynamic.cjs +1 -1
  174. package/dist/Dynamic.js +1 -1
  175. package/dist/OptionStatus.cjs +1 -1
  176. package/dist/OptionStatus.js +1 -1
  177. package/dist/Steps.cjs +1 -1
  178. package/dist/Steps.js +1 -1
  179. package/dist/Tabs.cjs +1 -1
  180. package/dist/Tabs.js +1 -1
  181. package/dist/actionIcon.cjs +1 -1
  182. package/dist/actionIcon.js +1 -1
  183. package/dist/component-config.d.ts +1 -1
  184. package/dist/config.d.cts +1 -1
  185. package/dist/config.d.ts +1 -1
  186. package/dist/constants.d.cts +6 -6
  187. package/dist/constants.d.ts +6 -6
  188. package/dist/constants2.d.cts +10 -3
  189. package/dist/constants2.d.ts +10 -3
  190. package/dist/constants3.d.cts +5 -5
  191. package/dist/constants3.d.ts +5 -5
  192. package/dist/constants4.d.cts +10 -9
  193. package/dist/constants4.d.ts +10 -9
  194. package/dist/context.d.cts +1 -1
  195. package/dist/data2.d.cts +10 -10
  196. package/dist/data2.d.ts +10 -10
  197. package/dist/editors.d.cts +17 -15
  198. package/dist/editors.d.ts +17 -15
  199. package/dist/fieldNode.cjs +1 -0
  200. package/dist/fieldNode.js +1 -0
  201. package/dist/fieldRenderers.cjs +1 -1
  202. package/dist/fieldRenderers.js +1 -1
  203. package/dist/graphics.cjs +1 -1
  204. package/dist/graphics.js +1 -1
  205. package/dist/index.cjs +1 -1
  206. package/dist/index.d.cts +7 -6
  207. package/dist/index.d.ts +6 -6
  208. package/dist/index.js +1 -1
  209. package/dist/index10.vue.d.cts +2 -2
  210. package/dist/index11.vue.d.ts +3 -3
  211. package/dist/index12.vue.d.cts +3 -3
  212. package/dist/index12.vue.d.ts +2 -2
  213. package/dist/index13.vue.d.cts +2 -2
  214. package/dist/index13.vue.d.ts +2 -2
  215. package/dist/index14.vue.d.cts +2 -2
  216. package/dist/index14.vue.d.ts +3 -3
  217. package/dist/index15.vue.d.cts +3 -3
  218. package/dist/index17.vue.d.ts +17 -10
  219. package/dist/index18.vue.d.cts +17 -10
  220. package/dist/index19.vue.d.ts +3 -3
  221. package/dist/index2.vue.d.cts +2 -2
  222. package/dist/index2.vue.d.ts +2 -2
  223. package/dist/index20.vue.d.cts +3 -3
  224. package/dist/index20.vue.d.ts +3 -3
  225. package/dist/index21.vue.d.cts +3 -3
  226. package/dist/index21.vue.d.ts +7 -7
  227. package/dist/index22.vue.d.cts +7 -7
  228. package/dist/index24.vue.d.ts +2 -2
  229. package/dist/index25.vue.d.cts +2 -2
  230. package/dist/index26.vue.d.ts +1 -1
  231. package/dist/index27.vue.d.cts +1 -1
  232. package/dist/index27.vue.d.ts +3 -3
  233. package/dist/index28.vue.d.cts +3 -3
  234. package/dist/index3.vue.d.cts +17 -19
  235. package/dist/index3.vue.d.ts +17 -19
  236. package/dist/index31.vue.d.cts +1 -1
  237. package/dist/index31.vue.d.ts +1 -1
  238. package/dist/index34.vue.d.cts +2 -0
  239. package/dist/index34.vue.d.ts +2 -0
  240. package/dist/index35.vue.d.cts +4 -4
  241. package/dist/index35.vue.d.ts +4 -4
  242. package/dist/index36.vue.d.cts +20 -11
  243. package/dist/index36.vue.d.ts +20 -11
  244. package/dist/index37.vue.d.cts +2 -2
  245. package/dist/index37.vue.d.ts +2 -2
  246. package/dist/index38.vue.d.cts +2 -2
  247. package/dist/index38.vue.d.ts +2 -2
  248. package/dist/index39.vue.d.cts +1 -1
  249. package/dist/index39.vue.d.ts +1 -1
  250. package/dist/index4.vue.d.cts +7 -4
  251. package/dist/index4.vue.d.ts +7 -4
  252. package/dist/index42.vue.d.cts +3 -3
  253. package/dist/index42.vue.d.ts +3 -3
  254. package/dist/index43.vue.d.cts +2 -2
  255. package/dist/index43.vue.d.ts +2 -2
  256. package/dist/index5.vue.d.cts +4 -16
  257. package/dist/index5.vue.d.ts +4 -16
  258. package/dist/index6.vue.d.cts +5 -5
  259. package/dist/index6.vue.d.ts +5 -5
  260. package/dist/index7.vue.d.cts +18 -12
  261. package/dist/index7.vue.d.ts +18 -12
  262. package/dist/index9.vue.d.ts +2 -2
  263. package/dist/localSource.d.cts +8 -8
  264. package/dist/localSource.d.ts +8 -8
  265. package/dist/locale.cjs +1 -1
  266. package/dist/locale.js +1 -1
  267. package/dist/mapUtils.d.cts +1 -1
  268. package/dist/mapUtils.d.ts +1 -1
  269. package/dist/persistence.cjs +1 -0
  270. package/dist/persistence.js +1 -0
  271. package/dist/rule.d.cts +4 -1
  272. package/dist/rule.d.ts +4 -1
  273. package/dist/serializeSearch.cjs +1 -1
  274. package/dist/serializeSearch.js +1 -1
  275. package/dist/source.cjs +1 -1
  276. package/dist/source.js +1 -1
  277. package/dist/style.css +1390 -1377
  278. package/dist/types.d.cts +5 -1
  279. package/dist/types.d.ts +5 -1
  280. package/dist/types10.d.cts +2 -0
  281. package/dist/types10.d.ts +1 -1
  282. package/dist/types11.d.cts +1 -1
  283. package/dist/types3.d.cts +14 -5
  284. package/dist/types3.d.ts +14 -5
  285. package/dist/types5.d.ts +12 -10
  286. package/dist/types6.d.cts +12 -10
  287. package/dist/types6.d.ts +1 -1
  288. package/dist/types9.d.ts +2 -0
  289. package/dist/useCalendarEvents.d.cts +4 -16
  290. package/dist/useCalendarEvents.d.ts +4 -16
  291. package/dist/useCollapsePanel.d.cts +1 -0
  292. package/dist/useCollapsePanel.d.ts +1 -0
  293. package/dist/useCropperCore.d.cts +6 -17
  294. package/dist/useCropperCore.d.ts +6 -17
  295. package/dist/useDynamicFormState.d.cts +3 -3
  296. package/dist/useDynamicFormState.d.ts +3 -3
  297. package/dist/useEdgeInteraction.d.cts +3 -12
  298. package/dist/useEdgeInteraction.d.ts +3 -12
  299. package/dist/useFormRenderer.d.cts +1 -1
  300. package/dist/useFormRenderer.d.ts +1 -1
  301. package/dist/useFormulaEvaluator.cjs +2 -2
  302. package/dist/useFormulaEvaluator.js +2 -2
  303. package/dist/useFullscreen.d.cts +23 -5
  304. package/dist/useFullscreen.d.ts +23 -5
  305. package/dist/useQRCode.d.cts +5 -18
  306. package/dist/useQRCode.d.ts +5 -18
  307. package/dist/useSignatureHistory.d.cts +4 -3
  308. package/dist/useSignatureHistory.d.ts +4 -3
  309. package/dist/useSplitResize.d.cts +2 -2
  310. package/dist/useSplitResize.d.ts +2 -2
  311. package/dist/useTimeSelection.d.cts +4 -3
  312. package/dist/useTimeSelection.d.ts +4 -3
  313. package/dist/useWorkflowValidation.d.cts +43 -37
  314. package/dist/useWorkflowValidation.d.ts +43 -37
  315. package/dist/verification.d.cts +8 -8
  316. package/dist/verification.d.ts +8 -8
  317. package/docs/engineering.en.md +1 -0
  318. package/docs/engineering.md +1 -0
  319. package/docs/guides/batch-results.md +3 -3
  320. package/docs/guides/data-picker.md +2 -0
  321. package/docs/guides/resource-schedule.md +1 -0
  322. package/docs/guides/runtime-performance.md +2 -0
  323. package/docs/guides/scene-components.md +1 -1
  324. package/docs/guides/usage.en.md +15 -4
  325. package/docs/guides/usage.md +13 -4
  326. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @robot-admin/naive-ui-components
2
2
 
3
+ ## 0.42.0
4
+
5
+ ### Minor Changes
6
+
7
+ - `C_Draggable` 默认列表提供键盘调序,复用现有受控模型和排序事件。`C_ResourceSchedule` 优化高重叠资源的轨道分配,保留轨道编号与冲突判定。
8
+ - `C_ActionBar` 为保存、提交、确认和删除等常见写操作提供 300 ms 连点冷却,支持配置 `cooldownMs`。操作图标和溢出菜单继续按需加载。
9
+ - 修复缓存页的弹窗、焦点、快捷键和拖拽状态,补齐账号切换、实体选择会话、上传续传与编辑器异步回调的隔离。
10
+ - 为远程选项回显建立键索引,保持密度子树对父级默认值的响应式继承。完善语言菜单的键盘操作和进度条的减少动态效果支持。
11
+
12
+ ## 0.41.2
13
+
14
+ ### Patch Changes
15
+
16
+ - `C_DataPicker` 从数据源推断业务值,按单选或多选输出对应形状。`C_BatchResult` 和 `C_SectionNav` 从输入数据推断事件键,表格、表单和操作栏复用内部契约。
17
+ - `C_Table` 在用户打开列设置时加载抽屉,降低普通表格首屏和表格选择器首次打开的加载量。
18
+ - 修复扫码取消重入、缓存页菜单遮罩残留、引导实例争用遮罩和搜索取消重发旧查询。补齐选择器、编辑器、上传和持久化的会话边界,重复规则提供独立的草稿预览序列化。
19
+ - 更新中英文接入文档,验证发布包的类型推断、组件按需入口和生产构建下的交互。
20
+
3
21
  ## 0.41.1
4
22
 
5
23
  ### Patch Changes
package/README.md CHANGED
@@ -16,6 +16,7 @@
16
16
  <a href="#快速开始">快速开始</a> ·
17
17
  <a href="#能力地图">能力地图</a> ·
18
18
  <a href="#场景接入">场景接入</a> ·
19
+ <a href="#按需加载与样式">按需加载</a> ·
19
20
  <a href="./docs/components.md">组件目录</a> ·
20
21
  <a href="https://www.tzagileteam.com/robot/components/preface">在线文档</a> ·
21
22
  <a href="https://robotadmin.cn">在线体验</a> ·
@@ -27,7 +28,7 @@
27
28
 
28
29
  **Naive UI Components** 是从 [Robot Admin](https://github.com/ChenyCHENYU/Robot_Admin) 提炼的 Vue 3 组件库,以 `@robot-admin/naive-ui-components` 独立发布。表单、表格、实体选择和工作台可以通过类型化的配置接入。业务接口、权限和任务执行由宿主应用负责。
29
30
 
30
- 当前仓库版本 **0.41.1**,各版本的变化见[变更记录](./CHANGELOG.md)。
31
+ 当前仓库版本 **0.42.0**。本版为默认拖拽列表补齐键盘调序,优化排班冲突密集时的轨道分配,并完善缓存页面、账号切换和异步编辑的状态隔离。 [变更记录](./CHANGELOG.md)
31
32
 
32
33
  ## 快速开始
33
34
 
@@ -50,7 +51,7 @@ bun add @robot-admin/naive-ui-components vue@^3.5.3 naive-ui@^2.35.0
50
51
  C_Form,
51
52
  defineFormOptions,
52
53
  } from '@robot-admin/naive-ui-components/C_Form'
53
- import '@robot-admin/naive-ui-components/C_Form/style.css'
54
+ import '@robot-admin/naive-ui-components/C_Form/base.css'
54
55
 
55
56
  const draft = ref({ name: '' })
56
57
  const fields = defineFormOptions<typeof draft.value>([
@@ -68,9 +69,41 @@ bun add @robot-admin/naive-ui-components vue@^3.5.3 naive-ui@^2.35.0
68
69
 
69
70
  保存请求可以直接交给 `config.onSubmit`。需要在模板外读写表单或主动验证时,使用 `useCForm()`。完整示例见[表单与表格](./docs/guides/usage.md#c_form--c_table-推荐用法)。
70
71
 
71
- ### 直接使用公开 Props
72
+ ### 通过表格选择物料
72
73
 
73
- 普通组件直接传属性,例如 `<C_Progress :percentage="62.5" />`。把属性抽成对象时,可从组件子路径导入 `ProgressProps` 等公开类型,用 `satisfies` 检查配置。需要在插槽中保留业务字段时,参考[瀑布流的类型推导](./docs/guides/waterfall.md)。
74
+ ```vue
75
+ <script setup lang="ts">
76
+ import { ref } from 'vue'
77
+ import {
78
+ C_DataPicker,
79
+ createLocalDataPickerSource,
80
+ } from '@robot-admin/naive-ui-components/C_DataPicker'
81
+ import '@robot-admin/naive-ui-components/C_DataPicker/style.css'
82
+
83
+ const selected = ref<number[]>([])
84
+ const source = createLocalDataPickerSource({
85
+ rows: [{ id: 1, name: '热轧卷板' }],
86
+ rowKey: 'id',
87
+ value: row => row.id,
88
+ label: row => row.name,
89
+ })
90
+ const columns = [{ key: 'name', title: '物料' }]
91
+ </script>
92
+
93
+ <template>
94
+ <C_DataPicker
95
+ v-model="selected"
96
+ :source="source"
97
+ :columns="columns"
98
+ title="选择物料"
99
+ multiple
100
+ />
101
+ </template>
102
+ ```
103
+
104
+ `source.value` 决定业务值类型。开启 `multiple` 时回写数组,单选回写单值或 `null`。远程候选提供同样的数据源接口,接入分页、回显和字段回填的方式见[实体选择指南](./docs/guides/data-picker.md)。
105
+
106
+ `C_BatchResult` 从结果行推断重试键,`C_SectionNav` 从导航项推断 `select` 事件的键。配置需跨页面复用时,可以从各组件子路径导入公开类型。 [批量结果](./docs/guides/batch-results.md) · [分区导航](./docs/guides/data-workflows.md#多区域校验和导航)
74
107
 
75
108
  ## 能力地图
76
109
 
@@ -95,6 +128,8 @@ bun add @robot-admin/naive-ui-components vue@^3.5.3 naive-ui@^2.35.0
95
128
  | 编辑或切换记录时保护草稿 | 给 `C_FormModal` 配置 `beforeClose` 处理未保存确认;同一弹窗切换记录可复用 `requestDiscard()` 与 `sessionKey`。[表单弹窗](./docs/guides/usage.md#c_form--c_table-推荐用法) |
96
129
  | 查看审批历史 | 为 `C_ApprovalViewer` 提供业务键和数据源,查看历次提交和处理记录。消息入口可传 `instance-id` 直接定位,可选流程图按需加载。[审批查看器](./docs/guides/approval-viewer.md) |
97
130
  | 查看后台任务 | 给 `C_TaskPanel` 传任务列表并接入下载、重试事件。运行中的任务区分已知和未知进度,展开时再加载分项结果。[后台任务面板](./docs/guides/task-panel.md) |
131
+ | 用键盘调序 | `C_Draggable` 的默认列表在条目获得焦点后支持 `Alt + ↑` / `Alt + ↓`。继续用 `v-model` 接收排序结果。 [键盘排序](./docs/guides/usage.md#c_draggable-键盘排序) |
132
+ | 展示资源占用和冲突 | `C_ResourceSchedule` 接收资源、时间范围与预约,自动分配重叠轨道并标记冲突。 [资源排班](./docs/guides/resource-schedule.md) |
98
133
 
99
134
  ### 表格偏好按账号隔离
100
135
 
@@ -110,6 +145,8 @@ bun add @robot-admin/naive-ui-components vue@^3.5.3 naive-ui@^2.35.0
110
145
 
111
146
  使用内置富文本字段时导入完整样式。普通表单与表格可以选用 `C_Form/base.css` 和 `C_Table/base.css`,自动导入对应的选项为 `importStyle: 'base'`。配置方式见[导入指南](./docs/guides/usage.md#导入方式)。
112
147
 
148
+ `C_Table` 在首次打开列设置时加载设置面板,`C_DataPicker` 在打开选择器时加载候选表格。`check:consumer-size` 分别检查消费端首屏和打开选择器新增的 JavaScript。 [运行时性能指南](./docs/guides/runtime-performance.md)
149
+
113
150
  ## 文档导航
114
151
 
115
152
  | 文档 | 内容 |
@@ -127,9 +164,13 @@ bun add @robot-admin/naive-ui-components vue@^3.5.3 naive-ui@^2.35.0
127
164
  ```bash
128
165
  bun install --frozen-lockfile
129
166
  bun run verify
167
+ bun run test:browser
168
+ bun run test:performance
130
169
  ```
131
170
 
132
- `verify` 包含静态检查、单测、组件测试、打包消费检查与体积门禁。交互演示可先运行 `bun run build`,再运行 `bun run dev:search-workflows`,打开 [本地场景演示](http://127.0.0.1:4188/scenes.html)。浏览器回归在 `verify` 完成后通过 `bun run test:browser` 运行。
171
+ `verify` 检查类型、单测、组件测试、打包消费和入口体积。随后在构建产物上运行 Chromium、Firefox、WebKit 回归,以及 Chromium 下的多表、编辑和组织图性能用例。首次运行浏览器测试前,执行 `bun run playwright install chromium firefox webkit`。 [验证与发布](./docs/engineering.md#发布)
172
+
173
+ 本地查看场景时,先运行 `bun run build`,再运行 `bun run dev:search-workflows`。 [本地场景演示](http://127.0.0.1:4188/scenes.html)
133
174
 
134
175
  ## Robot 生态
135
176
 
package/README_EN.md CHANGED
@@ -16,6 +16,7 @@
16
16
  <a href="#quick-start">Quick start</a> ·
17
17
  <a href="#capability-map">Capabilities</a> ·
18
18
  <a href="#integration-recipes">Integration recipes</a> ·
19
+ <a href="#imports-and-styles">Imports</a> ·
19
20
  <a href="./docs/components.en.md">Component catalog</a> ·
20
21
  <a href="https://www.tzagileteam.com/robot/components/preface">Online docs</a> ·
21
22
  <a href="https://robotadmin.cn">Live demo</a> ·
@@ -27,7 +28,7 @@
27
28
 
28
29
  **Naive UI Components** is a Vue 3 library extracted from [Robot Admin](https://github.com/ChenyCHENYU/Robot_Admin) and published independently as `@robot-admin/naive-ui-components`. It provides typed configuration for forms, tables, entity pickers, and workspaces. The host application owns endpoints, permissions, and task execution.
29
30
 
30
- The current repository version is **0.41.1**. See the [changelog](./CHANGELOG.md) for release details.
31
+ The current repository version is **0.42.0**. The release adds keyboard reordering to the default draggable list, improves track assignment for overlapping bookings, and isolates state across cached pages, account switches, and asynchronous edits. [Changelog](./CHANGELOG.md)
31
32
 
32
33
  ## Quick start
33
34
 
@@ -50,7 +51,7 @@ The package root, `C_Breadcrumb`, and `C_TagsView` require `vue-router@^4.6.4` o
50
51
  C_Form,
51
52
  defineFormOptions,
52
53
  } from '@robot-admin/naive-ui-components/C_Form'
53
- import '@robot-admin/naive-ui-components/C_Form/style.css'
54
+ import '@robot-admin/naive-ui-components/C_Form/base.css'
54
55
 
55
56
  const draft = ref({ name: '' })
56
57
  const fields = defineFormOptions<typeof draft.value>([
@@ -68,9 +69,41 @@ The package root, `C_Breadcrumb`, and `C_TagsView` require `vue-router@^4.6.4` o
68
69
 
69
70
  Pass a save handler to `config.onSubmit`. Use `useCForm()` when code outside the template needs to read, update, or validate the form. See [forms and tables](./docs/guides/usage.en.md#recommended-c_form--c_table-setup) for full examples.
70
71
 
71
- ### Use public props directly
72
+ ### Select materials from a table
72
73
 
73
- Pass simple props directly, as in `<C_Progress :percentage="62.5" />`. When you extract props into a configuration object, import its public type, such as `ProgressProps`, from the component subpath and check it with `satisfies`. See the [waterfall guide](./docs/guides/waterfall.md) for business fields inferred in slots.
74
+ ```vue
75
+ <script setup lang="ts">
76
+ import { ref } from 'vue'
77
+ import {
78
+ C_DataPicker,
79
+ createLocalDataPickerSource,
80
+ } from '@robot-admin/naive-ui-components/C_DataPicker'
81
+ import '@robot-admin/naive-ui-components/C_DataPicker/style.css'
82
+
83
+ const selected = ref<number[]>([])
84
+ const source = createLocalDataPickerSource({
85
+ rows: [{ id: 1, name: 'Hot-rolled coil' }],
86
+ rowKey: 'id',
87
+ value: row => row.id,
88
+ label: row => row.name,
89
+ })
90
+ const columns = [{ key: 'name', title: 'Material' }]
91
+ </script>
92
+
93
+ <template>
94
+ <C_DataPicker
95
+ v-model="selected"
96
+ :source="source"
97
+ :columns="columns"
98
+ title="Select materials"
99
+ multiple
100
+ />
101
+ </template>
102
+ ```
103
+
104
+ `source.value` determines the selected value type. With `multiple`, the component writes an array. Single selection writes a value or `null`. The guide covers remote pagination, label resolution, and form field mapping. [Entity picker guide](./docs/guides/data-picker.md)
105
+
106
+ `C_BatchResult` infers the retry keys from the result rows. `C_SectionNav` infers the `select` event key from the navigation items. Import public types from component subpaths when sharing configuration across pages. [Batch results](./docs/guides/batch-results.md) · [Section navigation](./docs/guides/data-workflows.md#多区域校验和导航)
74
107
 
75
108
  ## Capability map
76
109
 
@@ -87,14 +120,16 @@ See the [component catalog](./docs/components.en.md) for the remaining component
87
120
 
88
121
  ## Integration recipes
89
122
 
90
- | Goal | Public entry |
91
- | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
92
- | Export a chosen range | Set `C_Table`'s `export.scopes` for current page, selected rows, or all matching results. Use `requestData` or `onExportMatching` for remote export and pass the last successful query to the host. [Export guide](./docs/guides/table-density.md#异步导出的快照与卸载) |
93
- | Share a query across tabs | Import `useTabbedQuery` from `/workflows` and provide the active tab, initial criteria, and a request callback. Each tab keeps its pagination, and a newly submitted query resets all pages. [Tabbed queries](./docs/guides/data-workflows.md#多页签共享查询) |
94
- | Fill fields from a selected record | Use `createDataPickerField({ source, columns, mapFields })`. The source determines the row type. The selected value and related fields commit together. Selecting the same entity preserves manual edits. [Entity selection and field mapping](./docs/guides/data-picker.md#表单内嵌选择) |
95
- | Protect an unsaved draft | Configure `beforeClose` on `C_FormModal`. Use `requestDiscard()` and `sessionKey` to apply the same guard when switching records in an open dialog. [Form dialogs](./docs/guides/usage.en.md#recommended-c_form--c_table-setup) |
96
- | Review approval history | Pass a business key and data source to `C_ApprovalViewer`. It displays submissions and handling records. An inbox can pass `instance-id` to open a specific instance. The optional diagram loads on demand. [Approval viewer](./docs/guides/approval-viewer.md) |
97
- | Track background jobs | Pass tasks to `C_TaskPanel` and handle download and retry events. Running tasks distinguish known progress from unknown progress, and itemized results load when opened. [Task panel](./docs/guides/task-panel.md) |
123
+ | Goal | Public entry |
124
+ | ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
125
+ | Export a chosen range | Set `C_Table`'s `export.scopes` for current page, selected rows, or all matching results. Use `requestData` or `onExportMatching` for remote export and pass the last successful query to the host. [Export guide](./docs/guides/table-density.md#异步导出的快照与卸载) |
126
+ | Share a query across tabs | Import `useTabbedQuery` from `/workflows` and provide the active tab, initial criteria, and a request callback. Each tab keeps its pagination, and a newly submitted query resets all pages. [Tabbed queries](./docs/guides/data-workflows.md#多页签共享查询) |
127
+ | Fill fields from a selected record | Use `createDataPickerField({ source, columns, mapFields })`. The source determines the row type. The selected value and related fields commit together. Selecting the same entity preserves manual edits. [Entity selection and field mapping](./docs/guides/data-picker.md#表单内嵌选择) |
128
+ | Protect an unsaved draft | Configure `beforeClose` on `C_FormModal`. Use `requestDiscard()` and `sessionKey` to apply the same guard when switching records in an open dialog. [Form dialogs](./docs/guides/usage.en.md#recommended-c_form--c_table-setup) |
129
+ | Review approval history | Pass a business key and data source to `C_ApprovalViewer`. It displays submissions and handling records. An inbox can pass `instance-id` to open a specific instance. The optional diagram loads on demand. [Approval viewer](./docs/guides/approval-viewer.md) |
130
+ | Track background jobs | Pass tasks to `C_TaskPanel` and handle download and retry events. Running tasks distinguish known progress from unknown progress, and itemized results load when opened. [Task panel](./docs/guides/task-panel.md) |
131
+ | Reorder by keyboard | Focus a row in the default `C_Draggable` list and press `Alt + ↑` or `Alt + ↓`. The new order is reported through `v-model`. [Keyboard sorting](./docs/guides/usage.en.md#keyboard-sorting-in-c_draggable) |
132
+ | Show resource bookings and conflicts | Give `C_ResourceSchedule` the resources, time range, and bookings. It assigns overlapping tracks and marks conflicts. [Resource scheduling](./docs/guides/resource-schedule.md) |
98
133
 
99
134
  ### Scope table preferences per account
100
135
 
@@ -110,6 +145,8 @@ Provide a reactive `persistPrefix` via `TABLE_GLOBAL_CONFIG_KEY`, then give each
110
145
 
111
146
  Use full styles for built-in rich-text fields. Ordinary forms and tables can use `C_Form/base.css` and `C_Table/base.css`, or `importStyle: 'base'` with the resolver. See [import strategies](./docs/guides/usage.en.md#import-strategies) for configuration examples.
112
147
 
148
+ `C_Table` loads its column settings panel the first time it opens. `C_DataPicker` loads its candidate table when the picker opens. `check:consumer-size` measures the initial bundle and the JavaScript loaded when opening the picker separately. [Runtime performance guide](./docs/guides/runtime-performance.md)
149
+
113
150
  ## Documentation
114
151
 
115
152
  | Document | Coverage |
@@ -127,9 +164,13 @@ Use Node.js 20.19+ and the Bun version pinned in the repository's `packageManage
127
164
  ```bash
128
165
  bun install --frozen-lockfile
129
166
  bun run verify
167
+ bun run test:browser
168
+ bun run test:performance
130
169
  ```
131
170
 
132
- `verify` runs static checks, unit and component tests, packaged-consumer checks, and bundle budget checks. For interactive demos, run `bun run build` followed by `bun run dev:search-workflows` and open the [local scene gallery](http://127.0.0.1:4188/scenes.html). Run `bun run test:browser` after `verify` to check browser interactions.
171
+ `verify` runs type checks, unit and component tests, packaged-consumer checks, and bundle budget checks. Run the Chromium, Firefox, and WebKit regressions against the resulting build, followed by the Chromium performance cases for multiple tables, editable fields, and organization charts. Before your first browser run, execute `bun run playwright install chromium firefox webkit`. [Verification and releases](./docs/engineering.en.md#publishing)
172
+
173
+ For interactive demos, run `bun run build` and then `bun run dev:search-workflows`. [Local scene gallery](http://127.0.0.1:4188/scenes.html)
133
174
 
134
175
  ## Robot ecosystem
135
176
 
@@ -1 +1 @@
1
- require(`./chunk.cjs`);const e=require(`./useComponentLocale.cjs`),t=require(`./export-helper.cjs`);require(`./C_Icon2.cjs`);const n=require(`./actionIcon.cjs`);let r=require(`vue`),i=require(`naive-ui`);const a=(0,r.defineComponent)({__name:`ActionOverflow`,props:{anchor:{},threshold:{},entries:{},size:{},resolve:{type:Function}},emits:[`narrow`,`select`],setup(t,{emit:a}){let o=t,s=a,{t:c}=e.t();(0,r.watch)(()=>[o.anchor,o.threshold],([e,t],n,r)=>{if(s(`narrow`,!1),!e)return;let i=()=>{let{width:n}=e.getBoundingClientRect();n>0&&s(`narrow`,n<t)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);a.observe(e),r(()=>a.disconnect())},{immediate:!0,flush:`post`}),(0,r.onBeforeUnmount)(()=>s(`narrow`,!1));let l=(0,r.computed)(()=>o.entries.map(e=>{let{label:t,icon:r,disabled:i}=o.resolve(e);return{key:e.renderKey,label:t,disabled:i,icon:()=>n.t(r,14)}}));function u(e){let t=o.entries.find(t=>t.renderKey===e);t&&s(`select`,t)}return(e,a)=>t.entries.length?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(i.NDropdown),{key:0,trigger:`click`,options:l.value,onSelect:u},{default:(0,r.withCtx)(()=>[(0,r.createVNode)((0,r.unref)(i.NButton),{class:`actions-overflow`,size:t.size,"render-icon":()=>(0,r.unref)(n.t)(`mdi:dots-horizontal`,14),"aria-haspopup":`menu`},{default:(0,r.withCtx)(()=>[(0,r.createTextVNode)((0,r.toDisplayString)((0,r.unref)(c)(`common.more`)),1)]),_:1},8,[`size`,`render-icon`])]),_:1},8,[`options`])):(0,r.createCommentVNode)(`v-if`,!0)}});var o=t.t(a,[[`__scopeId`,`data-v-41d2044a`]]);exports.default=o;
1
+ require(`./chunk.cjs`);const e=require(`./useComponentLocale.cjs`),t=require(`./export-helper.cjs`),n=require(`./actionIcon.cjs`);let r=require(`vue`),i=require(`naive-ui`);const a=(0,r.defineComponent)({__name:`ActionOverflow`,props:{anchor:{},threshold:{},entries:{},size:{},resolve:{type:Function}},emits:[`narrow`,`select`],setup(t,{emit:a}){let o=t,s=a,{t:c}=e.t();(0,r.watch)(()=>[o.anchor,o.threshold],([e,t],n,r)=>{if(s(`narrow`,!1),!e)return;let i=()=>{let{width:n}=e.getBoundingClientRect();n>0&&s(`narrow`,n<t)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);a.observe(e),r(()=>a.disconnect())},{immediate:!0,flush:`post`}),(0,r.onBeforeUnmount)(()=>s(`narrow`,!1));let l=(0,r.computed)(()=>o.entries.map(e=>{let{label:t,icon:r,disabled:i}=o.resolve(e);return{key:e.renderKey,label:t,disabled:i,icon:()=>n.t(r,14)}}));function u(e){let t=o.entries.find(t=>t.renderKey===e);t&&s(`select`,t)}return(e,a)=>t.entries.length?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(i.NDropdown),{key:0,trigger:`click`,options:l.value,onSelect:u},{default:(0,r.withCtx)(()=>[(0,r.createVNode)((0,r.unref)(i.NButton),{class:`actions-overflow`,size:t.size,"render-icon":()=>(0,r.unref)(n.t)(`mdi:dots-horizontal`,14),"aria-haspopup":`menu`},{default:(0,r.withCtx)(()=>[(0,r.createTextVNode)((0,r.toDisplayString)((0,r.unref)(c)(`common.more`)),1)]),_:1},8,[`size`,`render-icon`])]),_:1},8,[`options`])):(0,r.createCommentVNode)(`v-if`,!0)}});var o=t.t(a,[[`__scopeId`,`data-v-41d2044a`]]);exports.default=o;
@@ -1 +1 @@
1
- import{t as e}from"./useComponentLocale.js";import{t}from"./export-helper.js";import"./C_Icon2.js";import{t as n}from"./actionIcon.js";import{computed as r,createBlock as i,createCommentVNode as a,createTextVNode as o,createVNode as s,defineComponent as c,onBeforeUnmount as l,openBlock as u,toDisplayString as d,unref as f,watch as p,withCtx as m}from"vue";import{NButton as h,NDropdown as g}from"naive-ui";var _=t(c({__name:`ActionOverflow`,props:{anchor:{},threshold:{},entries:{},size:{},resolve:{type:Function}},emits:[`narrow`,`select`],setup(t,{emit:c}){let _=t,v=c,{t:y}=e();p(()=>[_.anchor,_.threshold],([e,t],n,r)=>{if(v(`narrow`,!1),!e)return;let i=()=>{let{width:n}=e.getBoundingClientRect();n>0&&v(`narrow`,n<t)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);a.observe(e),r(()=>a.disconnect())},{immediate:!0,flush:`post`}),l(()=>v(`narrow`,!1));let b=r(()=>_.entries.map(e=>{let{label:t,icon:r,disabled:i}=_.resolve(e);return{key:e.renderKey,label:t,disabled:i,icon:()=>n(r,14)}}));function x(e){let t=_.entries.find(t=>t.renderKey===e);t&&v(`select`,t)}return(e,r)=>t.entries.length?(u(),i(f(g),{key:0,trigger:`click`,options:b.value,onSelect:x},{default:m(()=>[s(f(h),{class:`actions-overflow`,size:t.size,"render-icon":()=>f(n)(`mdi:dots-horizontal`,14),"aria-haspopup":`menu`},{default:m(()=>[o(d(f(y)(`common.more`)),1)]),_:1},8,[`size`,`render-icon`])]),_:1},8,[`options`])):a(`v-if`,!0)}}),[[`__scopeId`,`data-v-41d2044a`]]);export{_ as default};
1
+ import{t as e}from"./useComponentLocale.js";import{t}from"./export-helper.js";import{t as n}from"./actionIcon.js";import{computed as r,createBlock as i,createCommentVNode as a,createTextVNode as o,createVNode as s,defineComponent as c,onBeforeUnmount as l,openBlock as u,toDisplayString as d,unref as f,watch as p,withCtx as m}from"vue";import{NButton as h,NDropdown as g}from"naive-ui";var _=t(c({__name:`ActionOverflow`,props:{anchor:{},threshold:{},entries:{},size:{},resolve:{type:Function}},emits:[`narrow`,`select`],setup(t,{emit:c}){let _=t,v=c,{t:y}=e();p(()=>[_.anchor,_.threshold],([e,t],n,r)=>{if(v(`narrow`,!1),!e)return;let i=()=>{let{width:n}=e.getBoundingClientRect();n>0&&v(`narrow`,n<t)};if(i(),typeof ResizeObserver>`u`)return;let a=new ResizeObserver(i);a.observe(e),r(()=>a.disconnect())},{immediate:!0,flush:`post`}),l(()=>v(`narrow`,!1));let b=r(()=>_.entries.map(e=>{let{label:t,icon:r,disabled:i}=_.resolve(e);return{key:e.renderKey,label:t,disabled:i,icon:()=>n(r,14)}}));function x(e){let t=_.entries.find(t=>t.renderKey===e);t&&v(`select`,t)}return(e,r)=>t.entries.length?(u(),i(f(g),{key:0,trigger:`click`,options:b.value,onSelect:x},{default:m(()=>[s(f(h),{class:`actions-overflow`,size:t.size,"render-icon":()=>f(n)(`mdi:dots-horizontal`,14),"aria-haspopup":`menu`},{default:m(()=>[o(d(f(y)(`common.more`)),1)]),_:1},8,[`size`,`render-icon`])]),_:1},8,[`options`])):a(`v-if`,!0)}}),[[`__scopeId`,`data-v-41d2044a`]]);export{_ as default};
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./C_Icon2.cjs`);const e=require(`./C_ActionBar2.cjs`);exports.ACTION_BAR_DEFAULT_CONFIG=e.n,exports.ACTION_PRESETS=e.r,exports.C_ActionBar=e.t,exports.DEFAULT_ACTION_ICON=e.i,exports.defineActions=e.a,exports.resolveActionPreset=e.o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./C_ActionBar2.cjs`);exports.ACTION_BAR_DEFAULT_CONFIG=e.n,exports.ACTION_PRESETS=e.r,exports.C_ActionBar=e.t,exports.DEFAULT_ACTION_ICON=e.i,exports.defineActions=e.a,exports.resolveActionPreset=e.o;
@@ -86,7 +86,7 @@
86
86
 
87
87
  /* 通用操作按钮组件样式 */
88
88
  /* ================= 主容器 ================= */
89
- .c-action-bar[data-v-c814a213] {
89
+ .c-action-bar[data-v-043daea2] {
90
90
  display: flex;
91
91
  min-width: 0;
92
92
  align-items: center;
@@ -98,26 +98,26 @@
98
98
  border: 1px solid var(--c-border, var(--c-theme-border));
99
99
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
100
100
  }
101
- .c-action-bar.is-align-left[data-v-c814a213] {
101
+ .c-action-bar.is-align-left[data-v-043daea2] {
102
102
  justify-content: flex-start;
103
103
  }
104
- .c-action-bar.is-align-center[data-v-c814a213] {
104
+ .c-action-bar.is-align-center[data-v-043daea2] {
105
105
  justify-content: center;
106
106
  }
107
- .c-action-bar.is-align-right[data-v-c814a213] {
107
+ .c-action-bar.is-align-right[data-v-043daea2] {
108
108
  justify-content: flex-end;
109
109
  }
110
- .c-action-bar.is-align-space-between[data-v-c814a213] {
110
+ .c-action-bar.is-align-space-between[data-v-043daea2] {
111
111
  justify-content: space-between;
112
112
  }
113
- .c-action-bar.is-align-space-around[data-v-c814a213] {
113
+ .c-action-bar.is-align-space-around[data-v-043daea2] {
114
114
  justify-content: space-around;
115
115
  }
116
- .c-action-bar.is-compact[data-v-c814a213] {
116
+ .c-action-bar.is-compact[data-v-043daea2] {
117
117
  padding: 8px;
118
118
  margin-bottom: 8px;
119
119
  }
120
- .c-action-bar.is-inline[data-v-c814a213] {
120
+ .c-action-bar.is-inline[data-v-043daea2] {
121
121
  padding: 0;
122
122
  margin-bottom: 0;
123
123
  background: transparent;
@@ -125,107 +125,107 @@
125
125
  border-radius: 0;
126
126
  box-shadow: none;
127
127
  }
128
- .c-action-bar.has-overflow[data-v-c814a213] {
128
+ .c-action-bar.has-overflow[data-v-043daea2] {
129
129
  gap: 8px;
130
130
  }
131
- .c-action-bar.is-wrap[data-v-c814a213] {
131
+ .c-action-bar.is-wrap[data-v-043daea2] {
132
132
  flex-wrap: wrap;
133
133
  gap: 8px;
134
134
  }
135
- .c-action-bar.is-wrap .actions-group[data-v-c814a213] {
135
+ .c-action-bar.is-wrap .actions-group[data-v-043daea2] {
136
136
  flex-wrap: wrap;
137
137
  min-width: 0;
138
138
  max-width: 100%;
139
139
  }
140
140
  @media (max-width: 768px) {
141
- .c-action-bar[data-v-c814a213] {
141
+ .c-action-bar[data-v-043daea2] {
142
142
  flex-direction: column;
143
143
  gap: 12px;
144
144
  }
145
- .c-action-bar .actions-group[data-v-c814a213] {
145
+ .c-action-bar .actions-group[data-v-043daea2] {
146
146
  width: 100%;
147
147
  justify-content: center;
148
148
  }
149
149
  }
150
150
 
151
151
  /* ================= 按钮组 ================= */
152
- .actions-group[data-v-c814a213] {
152
+ .actions-group[data-v-043daea2] {
153
153
  display: flex;
154
154
  align-items: center;
155
155
  gap: 12px;
156
156
  flex-wrap: nowrap;
157
157
  flex-shrink: 0;
158
158
  }
159
- .actions-group.actions-left[data-v-c814a213] {
159
+ .actions-group.actions-left[data-v-043daea2] {
160
160
  justify-content: flex-start;
161
161
  }
162
- .actions-group.actions-right[data-v-c814a213] {
162
+ .actions-group.actions-right[data-v-043daea2] {
163
163
  justify-content: flex-end;
164
164
  }
165
- .c-action-bar.has-only-left.is-align-center .actions-group.actions-left[data-v-c814a213], .c-action-bar.has-only-right.is-align-center .actions-group.actions-right[data-v-c814a213] {
165
+ .c-action-bar.has-only-left.is-align-center .actions-group.actions-left[data-v-043daea2], .c-action-bar.has-only-right.is-align-center .actions-group.actions-right[data-v-043daea2] {
166
166
  width: 100%;
167
167
  justify-content: center;
168
168
  }
169
- .c-action-bar.has-only-left.is-align-space-between .actions-group.actions-left[data-v-c814a213], .c-action-bar.has-only-right.is-align-space-between .actions-group.actions-right[data-v-c814a213] {
169
+ .c-action-bar.has-only-left.is-align-space-between .actions-group.actions-left[data-v-043daea2], .c-action-bar.has-only-right.is-align-space-between .actions-group.actions-right[data-v-043daea2] {
170
170
  width: 100%;
171
171
  justify-content: space-between;
172
172
  }
173
- .c-action-bar.has-only-left.is-align-space-around .actions-group.actions-left[data-v-c814a213], .c-action-bar.has-only-right.is-align-space-around .actions-group.actions-right[data-v-c814a213] {
173
+ .c-action-bar.has-only-left.is-align-space-around .actions-group.actions-left[data-v-043daea2], .c-action-bar.has-only-right.is-align-space-around .actions-group.actions-right[data-v-043daea2] {
174
174
  width: 100%;
175
175
  justify-content: space-around;
176
176
  }
177
- .c-action-bar.has-only-left.is-align-right .actions-group.actions-left[data-v-c814a213] {
177
+ .c-action-bar.has-only-left.is-align-right .actions-group.actions-left[data-v-043daea2] {
178
178
  width: 100%;
179
179
  justify-content: flex-end;
180
180
  }
181
- .c-action-bar.has-only-right.is-align-left .actions-group.actions-right[data-v-c814a213] {
181
+ .c-action-bar.has-only-right.is-align-left .actions-group.actions-right[data-v-043daea2] {
182
182
  width: 100%;
183
183
  justify-content: flex-start;
184
184
  }
185
- .actions-group[data-v-c814a213] .n-button {
185
+ .actions-group[data-v-043daea2] .n-button {
186
186
  flex-shrink: 0;
187
187
  transition: color 0.16s ease, background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
188
188
  font-weight: 500;
189
189
  }
190
- .actions-group[data-v-c814a213] .n-button .n-icon {
190
+ .actions-group[data-v-043daea2] .n-button .n-icon {
191
191
  transition: transform 0.3s ease;
192
192
  }
193
- .actions-group[data-v-c814a213] .n-button:hover:not(:disabled) {
193
+ .actions-group[data-v-043daea2] .n-button:hover:not(:disabled) {
194
194
  transform: translateY(-1px);
195
195
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
196
196
  }
197
- .actions-group[data-v-c814a213] .n-button:hover:not(:disabled) .n-icon {
197
+ .actions-group[data-v-043daea2] .n-button:hover:not(:disabled) .n-icon {
198
198
  transform: scale(1.1);
199
199
  }
200
- .actions-group[data-v-c814a213] .n-button:active:not(:disabled) {
200
+ .actions-group[data-v-043daea2] .n-button:active:not(:disabled) {
201
201
  transform: translateY(0);
202
202
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
203
203
  }
204
- .actions-group[data-v-c814a213] .n-button:disabled {
204
+ .actions-group[data-v-043daea2] .n-button:disabled {
205
205
  cursor: not-allowed;
206
206
  opacity: 0.5;
207
207
  }
208
- .actions-group[data-v-c814a213] .n-button.n-button--loading {
208
+ .actions-group[data-v-043daea2] .n-button.n-button--loading {
209
209
  pointer-events: none;
210
210
  }
211
- .actions-group[data-v-c814a213] .n-button--primary-type:hover:not(:disabled) {
211
+ .actions-group[data-v-043daea2] .n-button--primary-type:hover:not(:disabled) {
212
212
  box-shadow: 0 4px 12px rgba(24, 160, 88, 0.3);
213
213
  }
214
- .actions-group[data-v-c814a213] .n-button--info-type:hover:not(:disabled) {
214
+ .actions-group[data-v-043daea2] .n-button--info-type:hover:not(:disabled) {
215
215
  box-shadow: 0 4px 12px rgba(42, 148, 125, 0.3);
216
216
  }
217
- .actions-group[data-v-c814a213] .n-button--success-type:hover:not(:disabled) {
217
+ .actions-group[data-v-043daea2] .n-button--success-type:hover:not(:disabled) {
218
218
  box-shadow: 0 4px 12px rgba(99, 226, 183, 0.3);
219
219
  }
220
- .actions-group[data-v-c814a213] .n-button--warning-type:hover:not(:disabled) {
220
+ .actions-group[data-v-043daea2] .n-button--warning-type:hover:not(:disabled) {
221
221
  box-shadow: 0 4px 12px rgba(240, 138, 0, 0.3);
222
222
  }
223
- .actions-group[data-v-c814a213] .n-button--error-type:hover:not(:disabled) {
223
+ .actions-group[data-v-043daea2] .n-button--error-type:hover:not(:disabled) {
224
224
  box-shadow: 0 4px 12px rgba(208, 48, 80, 0.3);
225
225
  }
226
226
 
227
227
  /* ================= 中间插槽区域 ================= */
228
- .actions-center[data-v-c814a213] {
228
+ .actions-center[data-v-043daea2] {
229
229
  display: flex;
230
230
  align-items: center;
231
231
  justify-content: center;
@@ -235,38 +235,38 @@
235
235
  }
236
236
 
237
237
  /* ================= 分隔线 ================= */
238
- .action-divider[data-v-c814a213] {
238
+ .action-divider[data-v-043daea2] {
239
239
  margin: 0 8px !important;
240
240
  height: 20px;
241
241
  opacity: 0.3;
242
242
  transition: opacity 0.3s ease;
243
243
  }
244
- .action-divider--horizontal[data-v-c814a213] {
244
+ .action-divider--horizontal[data-v-043daea2] {
245
245
  width: 20px;
246
246
  min-width: 20px;
247
247
  height: auto;
248
248
  flex: 0 0 20px;
249
249
  }
250
- .action-divider[data-v-c814a213]:hover {
250
+ .action-divider[data-v-043daea2]:hover {
251
251
  opacity: 0.6;
252
252
  }
253
253
 
254
254
  /* ================= 下拉菜单优化 ================= */
255
- [data-v-c814a213] .n-dropdown-option {
255
+ [data-v-043daea2] .n-dropdown-option {
256
256
  transition: all 0.2s ease;
257
257
  }
258
- [data-v-c814a213] .n-dropdown-option:hover {
258
+ [data-v-043daea2] .n-dropdown-option:hover {
259
259
  transform: translateX(4px);
260
260
  }
261
- [data-v-c814a213] .n-dropdown-option .n-icon {
261
+ [data-v-043daea2] .n-dropdown-option .n-icon {
262
262
  transition: transform 0.2s ease;
263
263
  }
264
- [data-v-c814a213] .n-dropdown-option:hover .n-icon {
264
+ [data-v-043daea2] .n-dropdown-option:hover .n-icon {
265
265
  transform: scale(1.15);
266
266
  }
267
267
 
268
268
  /* ================= 加载动画 ================= */
269
- @keyframes button-loading-c814a213 {
269
+ @keyframes button-loading-043daea2 {
270
270
  0% {
271
271
  opacity: 0.6;
272
272
  }
@@ -277,12 +277,12 @@
277
277
  opacity: 0.6;
278
278
  }
279
279
  }
280
- [data-v-c814a213] .n-button--loading {
281
- animation: button-loading-c814a213 1.5s ease-in-out infinite;
280
+ [data-v-043daea2] .n-button--loading {
281
+ animation: button-loading-043daea2 1.5s ease-in-out infinite;
282
282
  }
283
283
 
284
284
  /* ================= Tooltip 样式 ================= */
285
- [data-v-c814a213] .n-tooltip .n-tooltip__content {
285
+ [data-v-043daea2] .n-tooltip .n-tooltip__content {
286
286
  font-size: 12px;
287
287
  padding: 6px 10px;
288
288
  border-radius: 4px;
@@ -291,23 +291,23 @@
291
291
  }
292
292
 
293
293
  /* ================= 暗黑模式适配 ================= */
294
- html.dark .c-action-bar[data-v-c814a213] {
294
+ html.dark .c-action-bar[data-v-043daea2] {
295
295
  border-color: rgba(255, 255, 255, 0.09);
296
296
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
297
297
  }
298
- html.dark .actions-group[data-v-c814a213] .n-button:hover:not(:disabled) {
298
+ html.dark .actions-group[data-v-043daea2] .n-button:hover:not(:disabled) {
299
299
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
300
300
  }
301
- html.dark .action-divider[data-v-c814a213] {
301
+ html.dark .action-divider[data-v-043daea2] {
302
302
  opacity: 0.15;
303
303
  }
304
- html.dark .action-divider[data-v-c814a213]:hover {
304
+ html.dark .action-divider[data-v-043daea2]:hover {
305
305
  opacity: 0.4;
306
306
  }
307
307
 
308
308
  /* layer: default */
309
- .m4[data-v-c814a213]{margin:1rem;}
310
- .m5[data-v-c814a213]{margin:1.25rem;}
311
- .m6[data-v-c814a213]{margin:1.5rem;}
312
- .inline[data-v-c814a213]{display:inline;}
313
- .px[data-v-c814a213]{padding-left:1rem;padding-right:1rem;}
309
+ .m4[data-v-043daea2]{margin:1rem;}
310
+ .m5[data-v-043daea2]{margin:1.25rem;}
311
+ .m6[data-v-043daea2]{margin:1.5rem;}
312
+ .inline[data-v-043daea2]{display:inline;}
313
+ .px[data-v-043daea2]{padding-left:1rem;padding-right:1rem;}
@@ -1 +1 @@
1
- import"./C_Icon2.js";import{a as e,i as t,n,o as r,r as i,t as a}from"./C_ActionBar2.js";export{n as ACTION_BAR_DEFAULT_CONFIG,i as ACTION_PRESETS,a as C_ActionBar,t as DEFAULT_ACTION_ICON,e as defineActions,r as resolveActionPreset};
1
+ import{a as e,i as t,n,o as r,r as i,t as a}from"./C_ActionBar2.js";export{n as ACTION_BAR_DEFAULT_CONFIG,i as ACTION_PRESETS,a as C_ActionBar,t as DEFAULT_ACTION_ICON,e as defineActions,r as resolveActionPreset};
@@ -1 +1 @@
1
- require(`./chunk.cjs`);const e=require(`./density.cjs`),t=require(`./useComponentLocale.cjs`),n=require(`./useComponentTheme.cjs`),r=require(`./export-helper.cjs`),i=require(`./useComponentDensity.cjs`),a=require(`./actionIcon.cjs`),o=require(`./useActionTask.cjs`);let s=require(`vue`),c=require(`naive-ui`);const l=`mdi:gesture-tap-button`,u={align:`left`,size:`tiny`,gap:6,wrap:!1,showDivider:!1,dividerType:`vertical`,compact:!0,inline:!0,overflowAt:0},d={add:{label:`新增`,icon:`mdi:plus`,type:`primary`},create:{label:`新增`,icon:`mdi:plus`,type:`primary`},save:{label:`保存`,icon:`mdi:content-save-outline`,type:`primary`},confirm:{label:`确认`,icon:`mdi:check`,type:`primary`},cancel:{label:`取消`,icon:`mdi:close`},close:{label:`关闭`,icon:`mdi:close`},view:{label:`查看`,icon:`mdi:eye-outline`},edit:{label:`编辑`,icon:`mdi:pencil-outline`},delete:{label:`删除`,icon:`mdi:delete-outline`,type:`error`},remove:{label:`删除`,icon:`mdi:delete-outline`,type:`error`},refresh:{label:`刷新`,icon:`mdi:refresh`},import:{label:`导入`,icon:`mdi:file-import-outline`},export:{label:`导出`,icon:`mdi:file-export-outline`},print:{label:`打印`,icon:`mdi:printer-outline`},reset:{label:`重置`,icon:`mdi:restore`},columns:{label:`列设置`,icon:`mdi:view-column-outline`},fullscreen:{label:`全屏`,icon:`mdi:fullscreen`},settings:{label:`功能配置`,icon:`mdi:tune-variant`},more:{label:`更多`,icon:`mdi:dots-horizontal`}},f=e=>{let t=d[e.key??``]??{};return{...t,...e,label:e.label||t.label||e.key||`操作`,icon:e.icon||t.icon||l,type:e.type??t.type}},p=e=>typeof e==`function`?e():(0,s.unref)(e),m=e=>e;function h(e,t){let n=new Map,r=[];return e.forEach((e,i)=>{let a=e.key===void 0?`position:${t}:${i}`:`key:${e.key}`,o=n.get(a)??0;n.set(a,o+1),p(e.show)!==!1&&r.push({action:e,taskKey:a,renderKey:`${t}:${a}:${o}`})}),r}function g({action:e}){return e.overflow===!0&&!e.buttonProps&&!e.directives?.length&&!e.dropdown?.length&&!e.tooltip}function _(e,t){let n=(0,s.ref)(!1),r=(0,s.computed)(()=>{let e=t();return Number.isFinite(e)&&e>0?e:0});return{buttonGroups:(0,s.computed)(()=>{let t=e.actions??[],i=h(e.leftActions?.length?e.leftActions:t.filter(e=>e.group!==`right`),`left`),a=h(e.rightActions?.length?e.rightActions:t.filter(e=>e.group===`right`),`right`),o=[];if(!r.value||!n.value)return{left:i,right:a,overflow:o};let s=e=>g(e)?(o.push(e),!1):!0;return{left:i.filter(s),right:a.filter(s),overflow:o}}),narrow:n,overflowAt:r}}const v={key:0,class:`actions-center`},y=(0,s.defineComponent)({name:`C_ActionBar`,__name:`index`,props:{actions:{default:()=>[]},leftActions:{default:()=>[]},rightActions:{default:()=>[]},config:{default:()=>({})}},emits:[`action-click`,`dropdown-click`,`action-error`],setup(r,{emit:l}){let d=n.n(),m=i.t(),{t:h}=t.t(),g={add:`common.add`,create:`common.add`,save:`common.save`,confirm:`action.confirm`,cancel:`common.cancel`,close:`common.close`,view:`common.view`,edit:`common.edit`,delete:`common.delete`,remove:`common.delete`,refresh:`common.refresh`,import:`common.import`,export:`common.export`,print:`common.print`,reset:`common.reset`,columns:`table.columnSettings`,fullscreen:`common.fullscreen`,settings:`common.settings`,more:`common.more`},y=e=>{let t=f(e);if(e.label)return t;let{key:n}=e,r=n&&Object.prototype.hasOwnProperty.call(g,n)?g[n]:void 0;return{...t,label:r?h(r):n||h(`common.action`)}},b=r,x=l,S=(0,s.computed)(()=>({...u,...b.config,size:b.config.size??(m.value?e.t(m.value).size:u.size),gap:b.config.gap??(b.config.compact===!1?12:u.gap)})),C=(0,s.defineAsyncComponent)({loader:()=>Promise.resolve().then(()=>require(`./ActionOverflow.cjs`)),suspensible:!1}),w=(0,s.ref)(),{buttonGroups:T,narrow:E,overflowAt:D}=_(b,()=>S.value.overflowAt),O=[`left`,`center`,`right`],k=o.t(),A=(e,t)=>!!(p(e.disabled)||e.buttonProps?.disabled||k.isRunning(t)),j=(e,t)=>!!(p(e.loading)||e.buttonProps?.loading||e.autoLoading!==!1&&k.isRunning(t)),M=async({action:e,taskKey:t})=>{if(!(e.dropdown&&e.dropdown.length>0))try{await k.run(t,async()=>{x(`action-click`,e),await e.onClick?.()},()=>!A(e,t)&&!j(e,t))}catch(t){throw x(`action-error`,t,e),t}},N=async(e,{action:t,taskKey:n})=>{try{await k.run(n,async()=>{x(`dropdown-click`,e,t),await e.onClick?.()},()=>!A(t,n)&&!j(t,n)&&p(e.disabled)!==!0&&p(e.show)!==!1)}catch(n){throw x(`action-error`,n,t,e),n}},P=({action:e,taskKey:t})=>{let{label:n,icon:r}=y(e);return{label:n,icon:r,disabled:A(e,t)||j(e,t)}},F=(0,s.defineComponent)({name:`ActionButton`,props:{action:{type:Object,required:!0},taskKey:{type:String,required:!0}},emits:[`click`,`dropdown-select`],setup(e,{emit:t}){let n=(0,s.computed)(()=>e.action),r=(0,s.computed)(()=>y(n.value)),i=(0,s.computed)(()=>r.value.buttonProps?.size||r.value.size||S.value.size),o=(0,s.computed)(()=>({tiny:14,small:15,medium:16,large:18})[i.value]),l=(0,s.computed)(()=>r.value.dropdown?r.value.dropdown.filter(e=>e.show===void 0?!0:p(e.show)).map(t=>{let{icon:r}=t;return{key:t.key,label:t.label,icon:r?()=>a.t(r,14):void 0,disabled:A(n.value,e.taskKey)||j(n.value,e.taskKey)||p(t.disabled)}}):[]),u=i=>{let a=r.value.dropdown?.find(e=>e.key===i);a&&!A(n.value,e.taskKey)&&!j(n.value,e.taskKey)&&p(a.disabled)!==!0&&p(a.show)!==!1&&t(`dropdown-select`,a)},d=t=>{let{icon:l,buttonProps:u}=r.value,d=r=>{if(A(n.value,e.taskKey)||j(n.value,e.taskKey))return;t?.();let i=u?.onClick;Array.isArray(i)?i.forEach(e=>e(r)):i?.(r)},f=(0,s.h)(c.NButton,{type:r.value.type||`default`,size:i.value,...u,loading:j(n.value,e.taskKey),disabled:A(n.value,e.taskKey),onClick:d},{default:()=>r.value.label,icon:l&&!u?.renderIcon?()=>a.t(l,o.value):void 0});return r.value.directives&&r.value.directives.length>0?(0,s.withDirectives)(f,r.value.directives):f},f=()=>{let e=d(()=>t(`click`));return r.value.tooltip?(0,s.h)(c.NTooltip,{placement:`top`},{trigger:()=>e,default:()=>r.value.tooltip}):e},m=()=>{let t=d();return(0,s.h)(c.NDropdown,{disabled:A(n.value,e.taskKey)||j(n.value,e.taskKey),options:l.value,onSelect:u},{default:()=>t})};return()=>r.value.dropdown&&r.value.dropdown.length>0?m():f()}});return(e,t)=>((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{ref_key:`bar`,ref:w,class:(0,s.normalizeClass)([`c-action-bar`,{"is-compact":S.value.compact,"is-inline":S.value.inline,"is-wrap":S.value.wrap,"has-overflow":(0,s.unref)(T).overflow.length>0,[`is-align-${S.value.align}`]:!0,"has-only-left":(0,s.unref)(T).left.length>0&&(0,s.unref)(T).right.length===0&&!(0,s.unref)(T).overflow.length&&!e.$slots.center,"has-only-right":(0,s.unref)(T).right.length>0&&(0,s.unref)(T).left.length===0&&!(0,s.unref)(T).overflow.length&&!e.$slots.center}]),style:(0,s.normalizeStyle)((0,s.unref)(d))},[((0,s.openBlock)(),(0,s.createElementBlock)(s.Fragment,null,(0,s.renderList)(O,t=>((0,s.openBlock)(),(0,s.createElementBlock)(s.Fragment,{key:t},[t===`center`?((0,s.openBlock)(),(0,s.createElementBlock)(s.Fragment,{key:0},[e.$slots.center?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,v,[(0,s.renderSlot)(e.$slots,`center`,{},void 0,!0)])):(0,s.createCommentVNode)(`v-if`,!0)],64)):(0,s.unref)(T)[t].length>0?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{key:1,class:(0,s.normalizeClass)([`actions-group`,`actions-${t}`]),style:(0,s.normalizeStyle)({gap:`${S.value.gap}px`})},[((0,s.openBlock)(!0),(0,s.createElementBlock)(s.Fragment,null,(0,s.renderList)((0,s.unref)(T)[t],(e,n)=>((0,s.openBlock)(),(0,s.createElementBlock)(s.Fragment,{key:e.renderKey},[(0,s.createVNode)((0,s.unref)(F),{action:e.action,"task-key":e.taskKey,onClick:t=>M(e),onDropdownSelect:t=>N(t,e)},null,8,[`action`,`task-key`,`onClick`,`onDropdownSelect`]),S.value.showDivider&&n<(0,s.unref)(T)[t].length-1?((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(c.NDivider),{key:0,vertical:S.value.dividerType===`vertical`,class:(0,s.normalizeClass)([`action-divider`,{"action-divider--horizontal":S.value.dividerType===`horizontal`}])},null,8,[`vertical`,`class`])):(0,s.createCommentVNode)(`v-if`,!0)],64))),128))],6)):(0,s.createCommentVNode)(`v-if`,!0)],64))),64)),(0,s.unref)(D)?((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(C),{key:0,anchor:w.value,threshold:(0,s.unref)(D),entries:(0,s.unref)(T).overflow,size:S.value.size,resolve:P,onNarrow:t[0]||=e=>E.value=e,onSelect:M},null,8,[`anchor`,`threshold`,`entries`,`size`])):(0,s.createCommentVNode)(`v-if`,!0)],6))}});var b=r.t(y,[[`__scopeId`,`data-v-c814a213`]]);Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return b}});
1
+ require(`./chunk.cjs`);const e=require(`./density.cjs`),t=require(`./useComponentLocale.cjs`),n=require(`./useComponentTheme.cjs`),r=require(`./export-helper.cjs`),i=require(`./useComponentDensity.cjs`),a=require(`./actionIcon.cjs`),o=require(`./useActionTask.cjs`);let s=require(`vue`),c=require(`naive-ui`);const l=`mdi:gesture-tap-button`,u={align:`left`,size:`tiny`,gap:6,wrap:!1,showDivider:!1,dividerType:`vertical`,compact:!0,inline:!0,overflowAt:0},d={add:{label:`新增`,icon:`mdi:plus`,type:`primary`},create:{label:`新增`,icon:`mdi:plus`,type:`primary`},save:{label:`保存`,icon:`mdi:content-save-outline`,type:`primary`},confirm:{label:`确认`,icon:`mdi:check`,type:`primary`},cancel:{label:`取消`,icon:`mdi:close`},close:{label:`关闭`,icon:`mdi:close`},view:{label:`查看`,icon:`mdi:eye-outline`},edit:{label:`编辑`,icon:`mdi:pencil-outline`},delete:{label:`删除`,icon:`mdi:delete-outline`,type:`error`},remove:{label:`删除`,icon:`mdi:delete-outline`,type:`error`},refresh:{label:`刷新`,icon:`mdi:refresh`},import:{label:`导入`,icon:`mdi:file-import-outline`},export:{label:`导出`,icon:`mdi:file-export-outline`},print:{label:`打印`,icon:`mdi:printer-outline`},reset:{label:`重置`,icon:`mdi:restore`},columns:{label:`列设置`,icon:`mdi:view-column-outline`},fullscreen:{label:`全屏`,icon:`mdi:fullscreen`},settings:{label:`功能配置`,icon:`mdi:tune-variant`},more:{label:`更多`,icon:`mdi:dots-horizontal`}},f=e=>{let t=d[e.key??``]??{};return{...t,...e,label:e.label||t.label||e.key||`操作`,icon:e.icon||t.icon||l,type:e.type??t.type}},p=e=>typeof e==`function`?e():(0,s.unref)(e),m=e=>e;function h(e,t){let n=new Map,r=[];return e.forEach((e,i)=>{let a=e.key===void 0?`position:${t}:${i}`:`key:${e.key}`,o=n.get(a)??0;n.set(a,o+1),p(e.show)!==!1&&r.push({action:e,taskKey:a,renderKey:`${t}:${a}:${o}`})}),r}function g({action:e}){return e.overflow===!0&&!e.buttonProps&&!e.directives?.length&&!e.dropdown?.length&&!e.tooltip}function _(e,t){let n=(0,s.ref)(!1),r=(0,s.computed)(()=>{let e=t();return Number.isFinite(e)&&e>0?e:0});return{buttonGroups:(0,s.computed)(()=>{let t=e.actions??[],i=h(e.leftActions?.length?e.leftActions:t.filter(e=>e.group!==`right`),`left`),a=h(e.rightActions?.length?e.rightActions:t.filter(e=>e.group===`right`),`right`),o=[];if(!r.value||!n.value)return{left:i,right:a,overflow:o};let s=e=>g(e)?(o.push(e),!1):!0;return{left:i.filter(s),right:a.filter(s),overflow:o}}),narrow:n,overflowAt:r}}const v={key:0,class:`actions-center`},y=(0,s.defineComponent)({name:`C_ActionBar`,__name:`index`,props:{actions:{default:()=>[]},leftActions:{default:()=>[]},rightActions:{default:()=>[]},config:{default:()=>({})}},emits:[`action-click`,`dropdown-click`,`action-error`],setup(r,{emit:l}){let d=n.n(),m=i.t(),{t:h}=t.t(),g={add:`common.add`,create:`common.add`,save:`common.save`,confirm:`action.confirm`,cancel:`common.cancel`,close:`common.close`,view:`common.view`,edit:`common.edit`,delete:`common.delete`,remove:`common.delete`,refresh:`common.refresh`,import:`common.import`,export:`common.export`,print:`common.print`,reset:`common.reset`,columns:`table.columnSettings`,fullscreen:`common.fullscreen`,settings:`common.settings`,more:`common.more`},y=e=>{let t=f(e);if(e.label)return t;let{key:n}=e,r=n&&Object.prototype.hasOwnProperty.call(g,n)?g[n]:void 0;return{...t,label:r?h(r):n||h(`common.action`)}},b=r,x=l,S=(0,s.computed)(()=>({...u,...b.config,size:b.config.size??(m.value?e.t(m.value).size:u.size),gap:b.config.gap??(b.config.compact===!1?12:u.gap)})),C=(0,s.defineAsyncComponent)({loader:()=>Promise.resolve().then(()=>require(`./ActionOverflow.cjs`)),suspensible:!1}),w=(0,s.ref)(),{buttonGroups:T,narrow:E,overflowAt:D}=_(b,()=>S.value.overflowAt),O=[`left`,`center`,`right`],k={tiny:14,small:15,medium:16,large:18},A=o.t(),j=new Map,M=[`save`,`submit`,`confirm`,`delete`,`remove`];function N(e,t,n){let r=performance.now();if((j.get(e)?.deadline??0)>r)return!1;let i=t.cooldownMs??(M.some(e=>e===t.key)?300:0);if(i>0&&Number.isFinite(i)){for(let[e,t]of j)t.deadline<=r&&j.delete(e);n.deadline=r+i,j.set(e,n)}return!0}let P=(e,t)=>!!(p(e.disabled)||e.buttonProps?.disabled||A.isRunning(t)),F=(e,t)=>!!(p(e.loading)||e.buttonProps?.loading||e.autoLoading!==!1&&A.isRunning(t)),I=(e,t)=>p(e.show)!==!1&&!P(e,t)&&!F(e,t),L=e=>p(e.disabled)!==!0&&p(e.show)!==!1,R=async({action:e,taskKey:t},n,r={accepted:!1,deadline:0})=>{if(!n&&e.dropdown?.length)return;let i=n??e,a=n?JSON.stringify([t,n.key]):t;try{await A.run(t,async()=>{r.accepted=!0,n?x(`dropdown-click`,n,e):x(`action-click`,e),await i.onClick?.()},()=>I(e,t)&&(!n||L(n))&&N(a,i,r))}catch(t){throw j.get(a)===r&&j.delete(a),n?x(`action-error`,t,e,n):x(`action-error`,t,e),t}},z=({action:e,taskKey:t})=>{let{label:n,icon:r}=y(e);return{label:n,icon:r,disabled:!I(e,t)}},B=(0,s.defineComponent)({name:`ActionButton`,props:{action:{type:Object,required:!0},taskKey:{type:String,required:!0}},emits:[`click`,`dropdown-select`],setup(e,{emit:t}){let n=()=>I(e.action,e.taskKey),r=(0,s.computed)(()=>y(e.action)),i=(0,s.ref)(!1);(0,s.watchEffect)(()=>{i.value&&(!r.value.dropdown?.length||!n())&&(i.value=!1)});let o=(0,s.computed)(()=>r.value.buttonProps?.size||r.value.size||S.value.size),l=(0,s.computed)(()=>{let{dropdown:e}=r.value;if(!e)return[];let t=!n();return e.filter(e=>e.show===void 0||p(e.show)).map(e=>{let{icon:n}=e;return{key:e.key,label:e.label,icon:n?()=>a.t(n,14):void 0,disabled:t||p(e.disabled)}})}),u=e=>{let n=r.value.dropdown?.find(t=>t.key===e);n&&t(`dropdown-select`,n)},d=(l=!1)=>{let{icon:u,buttonProps:d}=r.value,f=e=>{let r={accepted:!1,deadline:0};if(l?n()&&(i.value=!0,r.accepted=!0):t(`click`,r),!r.accepted){e.preventDefault();return}let a=d?.onClick;Array.isArray(a)?a.forEach(t=>t(e)):a?.(e)},p=(0,s.h)(c.NButton,{type:r.value.type||`default`,size:o.value,...l&&{"aria-expanded":i.value,onKeydown:e=>{e.key===`Tab`&&(i.value=!1)}},...d,loading:F(e.action,e.taskKey),disabled:P(e.action,e.taskKey),onClick:f},{default:()=>r.value.label,icon:u&&!d?.renderIcon?()=>a.t(u,k[o.value]):void 0}),{directives:m}=r.value;return m?.length?(0,s.withDirectives)(p,m):p};return()=>{let{dropdown:e,tooltip:t}=r.value,a=!!e?.length,o=d(a);return a?(0,s.h)(c.NDropdown,{disabled:!n(),options:l.value,show:i.value,"onUpdate:show":e=>i.value=e,onClickoutside:()=>i.value=!1,onSelect:u},()=>o):t?(0,s.h)(c.NTooltip,{placement:`top`},{trigger:()=>o,default:()=>t}):o}}});return(e,t)=>((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{ref_key:`bar`,ref:w,class:(0,s.normalizeClass)([`c-action-bar`,{"is-compact":S.value.compact,"is-inline":S.value.inline,"is-wrap":S.value.wrap,"has-overflow":(0,s.unref)(T).overflow.length>0,[`is-align-${S.value.align}`]:!0,"has-only-left":(0,s.unref)(T).left.length>0&&(0,s.unref)(T).right.length===0&&!(0,s.unref)(T).overflow.length&&!e.$slots.center,"has-only-right":(0,s.unref)(T).right.length>0&&(0,s.unref)(T).left.length===0&&!(0,s.unref)(T).overflow.length&&!e.$slots.center}]),style:(0,s.normalizeStyle)((0,s.unref)(d))},[((0,s.openBlock)(),(0,s.createElementBlock)(s.Fragment,null,(0,s.renderList)(O,t=>((0,s.openBlock)(),(0,s.createElementBlock)(s.Fragment,{key:t},[t===`center`?((0,s.openBlock)(),(0,s.createElementBlock)(s.Fragment,{key:0},[e.$slots.center?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,v,[(0,s.renderSlot)(e.$slots,`center`,{},void 0,!0)])):(0,s.createCommentVNode)(`v-if`,!0)],64)):(0,s.unref)(T)[t].length>0?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{key:1,class:(0,s.normalizeClass)([`actions-group`,`actions-${t}`]),style:(0,s.normalizeStyle)({gap:`${S.value.gap}px`})},[((0,s.openBlock)(!0),(0,s.createElementBlock)(s.Fragment,null,(0,s.renderList)((0,s.unref)(T)[t],(e,n)=>((0,s.openBlock)(),(0,s.createElementBlock)(s.Fragment,{key:e.renderKey},[(0,s.createVNode)((0,s.unref)(B),{action:e.action,"task-key":e.taskKey,onClick:t=>R(e,void 0,t),onDropdownSelect:t=>R(e,t)},null,8,[`action`,`task-key`,`onClick`,`onDropdownSelect`]),S.value.showDivider&&n<(0,s.unref)(T)[t].length-1?((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(c.NDivider),{key:0,vertical:S.value.dividerType===`vertical`,class:(0,s.normalizeClass)([`action-divider`,{"action-divider--horizontal":S.value.dividerType===`horizontal`}])},null,8,[`vertical`,`class`])):(0,s.createCommentVNode)(`v-if`,!0)],64))),128))],6)):(0,s.createCommentVNode)(`v-if`,!0)],64))),64)),(0,s.unref)(D)?((0,s.openBlock)(),(0,s.createBlock)((0,s.unref)(C),{key:0,anchor:w.value,threshold:(0,s.unref)(D),entries:(0,s.unref)(T).overflow,size:S.value.size,resolve:z,onNarrow:t[0]||=e=>E.value=e,onSelect:t[1]||=e=>R(e)},null,8,[`anchor`,`threshold`,`entries`,`size`])):(0,s.createCommentVNode)(`v-if`,!0)],6))}});var b=r.t(y,[[`__scopeId`,`data-v-043daea2`]]);Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return b}});