@robot-admin/naive-ui-components 0.41.2 → 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 (157) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +3 -1
  3. package/README_EN.md +11 -9
  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_ApprovalViewer.css +15 -15
  12. package/dist/C_ApprovalViewer2.cjs +1 -1
  13. package/dist/C_ApprovalViewer2.js +1 -1
  14. package/dist/C_ContextMenu.css +3 -3
  15. package/dist/C_ContextMenu2.cjs +1 -1
  16. package/dist/C_ContextMenu2.js +1 -1
  17. package/dist/C_DataPicker.css +22 -22
  18. package/dist/C_DataPicker2.cjs +1 -1
  19. package/dist/C_DataPicker2.js +1 -1
  20. package/dist/C_Density2.cjs +1 -1
  21. package/dist/C_Density2.js +1 -1
  22. package/dist/C_Draggable.css +66 -53
  23. package/dist/C_Draggable2.cjs +1 -1
  24. package/dist/C_Draggable2.js +1 -1
  25. package/dist/C_Form.base.css +1 -1
  26. package/dist/C_Form.css +1 -1
  27. package/dist/C_FormModal.css +55 -55
  28. package/dist/C_FormModal2.cjs +1 -1
  29. package/dist/C_FormModal2.js +1 -1
  30. package/dist/C_FormSearch.css +1 -1
  31. package/dist/C_GlobalSearch2.cjs +1 -1
  32. package/dist/C_GlobalSearch2.js +1 -1
  33. package/dist/C_Language.css +2 -2
  34. package/dist/C_Language2.cjs +1 -1
  35. package/dist/C_Language2.js +1 -1
  36. package/dist/C_Login.css +85 -85
  37. package/dist/C_Login2.cjs +1 -1
  38. package/dist/C_Login2.js +1 -1
  39. package/dist/C_Markdown.css +37 -37
  40. package/dist/C_Markdown2.cjs +1 -1
  41. package/dist/C_Markdown2.js +1 -1
  42. package/dist/C_NotificationCenter2.cjs +1 -1
  43. package/dist/C_NotificationCenter2.js +1 -1
  44. package/dist/C_Progress2.cjs +1 -1
  45. package/dist/C_Progress2.js +1 -1
  46. package/dist/C_ResourceSchedule2.cjs +1 -1
  47. package/dist/C_ResourceSchedule2.js +1 -1
  48. package/dist/C_Select.css +1 -1
  49. package/dist/C_Select2.cjs +1 -1
  50. package/dist/C_Select2.js +1 -1
  51. package/dist/C_Signature.css +15 -15
  52. package/dist/C_Signature2.cjs +1 -1
  53. package/dist/C_Signature2.js +1 -1
  54. package/dist/C_SplitPane2.cjs +1 -1
  55. package/dist/C_SplitPane2.js +1 -1
  56. package/dist/C_Table.base.css +55 -55
  57. package/dist/C_Table.css +54 -54
  58. package/dist/C_Transfer.css +25 -25
  59. package/dist/C_Transfer2.cjs +1 -1
  60. package/dist/C_Transfer2.js +1 -1
  61. package/dist/C_Upload2.cjs +1 -1
  62. package/dist/C_Upload2.js +1 -1
  63. package/dist/C_UserPicker.css +1 -1
  64. package/dist/OptionStatus.cjs +1 -1
  65. package/dist/OptionStatus.js +1 -1
  66. package/dist/actionIcon.cjs +1 -1
  67. package/dist/actionIcon.js +1 -1
  68. package/dist/constants.d.cts +3 -3
  69. package/dist/constants.d.ts +3 -3
  70. package/dist/constants2.d.cts +2 -2
  71. package/dist/constants2.d.ts +2 -2
  72. package/dist/constants3.d.cts +4 -4
  73. package/dist/constants3.d.ts +4 -4
  74. package/dist/constants4.d.cts +6 -5
  75. package/dist/constants4.d.ts +6 -5
  76. package/dist/data2.d.cts +8 -8
  77. package/dist/data2.d.ts +8 -8
  78. package/dist/editors.d.cts +5 -5
  79. package/dist/editors.d.ts +5 -5
  80. package/dist/index.d.cts +1 -0
  81. package/dist/index10.vue.d.cts +2 -2
  82. package/dist/index11.vue.d.ts +2 -2
  83. package/dist/index12.vue.d.cts +2 -2
  84. package/dist/index12.vue.d.ts +2 -2
  85. package/dist/index13.vue.d.cts +2 -2
  86. package/dist/index13.vue.d.ts +3 -3
  87. package/dist/index14.vue.d.cts +3 -3
  88. package/dist/index14.vue.d.ts +3 -3
  89. package/dist/index15.vue.d.cts +3 -3
  90. package/dist/index17.vue.d.ts +4 -4
  91. package/dist/index18.vue.d.cts +4 -4
  92. package/dist/index19.vue.d.ts +2 -2
  93. package/dist/index2.vue.d.cts +2 -2
  94. package/dist/index2.vue.d.ts +2 -2
  95. package/dist/index20.vue.d.cts +2 -2
  96. package/dist/index20.vue.d.ts +3 -3
  97. package/dist/index21.vue.d.cts +3 -3
  98. package/dist/index21.vue.d.ts +5 -5
  99. package/dist/index22.vue.d.cts +5 -5
  100. package/dist/index24.vue.d.ts +2 -2
  101. package/dist/index25.vue.d.cts +2 -2
  102. package/dist/index27.vue.d.ts +4 -4
  103. package/dist/index28.vue.d.cts +4 -4
  104. package/dist/index29.vue.d.cts +2 -2
  105. package/dist/index29.vue.d.ts +2 -2
  106. package/dist/index3.vue.d.cts +2 -2
  107. package/dist/index3.vue.d.ts +2 -2
  108. package/dist/index31.vue.d.cts +1 -1
  109. package/dist/index31.vue.d.ts +1 -1
  110. package/dist/index35.vue.d.cts +2 -2
  111. package/dist/index35.vue.d.ts +2 -2
  112. package/dist/index38.vue.d.cts +2 -2
  113. package/dist/index38.vue.d.ts +2 -2
  114. package/dist/index41.vue.d.cts +1 -1
  115. package/dist/index41.vue.d.ts +1 -1
  116. package/dist/index42.vue.d.cts +1 -1
  117. package/dist/index42.vue.d.ts +1 -1
  118. package/dist/index43.vue.d.cts +2 -2
  119. package/dist/index43.vue.d.ts +2 -2
  120. package/dist/index5.vue.d.cts +1 -1
  121. package/dist/index5.vue.d.ts +1 -1
  122. package/dist/index6.vue.d.cts +4 -4
  123. package/dist/index6.vue.d.ts +4 -4
  124. package/dist/index9.vue.d.ts +2 -2
  125. package/dist/mapUtils.d.cts +2 -2
  126. package/dist/mapUtils.d.ts +2 -2
  127. package/dist/presets.d.cts +1 -1
  128. package/dist/presets.d.ts +1 -1
  129. package/dist/source.cjs +1 -1
  130. package/dist/source.js +1 -1
  131. package/dist/style.css +327 -314
  132. package/dist/types.d.cts +4 -0
  133. package/dist/types.d.ts +4 -0
  134. package/dist/useCalendarEvents.d.cts +1 -1
  135. package/dist/useCalendarEvents.d.ts +1 -1
  136. package/dist/useCollapsePanel.d.cts +3 -3
  137. package/dist/useCollapsePanel.d.ts +3 -3
  138. package/dist/useCropperCore.d.cts +4 -4
  139. package/dist/useCropperCore.d.ts +4 -4
  140. package/dist/useFormulaEvaluator.cjs +1 -1
  141. package/dist/useFormulaEvaluator.js +1 -1
  142. package/dist/useInfiniteScroll.d.cts +2 -2
  143. package/dist/useInfiniteScroll.d.ts +2 -2
  144. package/dist/useQRCode.d.cts +3 -3
  145. package/dist/useQRCode.d.ts +3 -3
  146. package/dist/useSignatureHistory.d.cts +1 -0
  147. package/dist/useSignatureHistory.d.ts +1 -0
  148. package/dist/useSplitResize.d.cts +2 -2
  149. package/dist/useSplitResize.d.ts +2 -2
  150. package/dist/useWorkflowValidation.d.cts +32 -32
  151. package/dist/useWorkflowValidation.d.ts +32 -32
  152. package/dist/verification.d.cts +7 -7
  153. package/dist/verification.d.ts +7 -7
  154. package/docs/guides/resource-schedule.md +1 -0
  155. package/docs/guides/usage.en.md +15 -4
  156. package/docs/guides/usage.md +13 -4
  157. package/package.json +1 -1
@@ -533,22 +533,27 @@ The `reset(params)` event carries the reset snapshot after the synchronous v-mod
533
533
 
534
534
  ### Action configuration and asynchronous work
535
535
 
536
- Stable semantic keys and Promise callbacks provide labels, icons, and mutual exclusion without a loading ref for every button:
536
+ Stable semantic keys provide the default labels and icons. The component manages loading and execution locks for callbacks that return promises.
537
537
 
538
538
  ```ts
539
539
  const actions = defineActions([
540
540
  { key: 'save', onClick: () => saveCurrentUser() },
541
541
  { key: 'refresh', disabled: () => loading.value, onClick: reload },
542
+ { key: 'publish', label: 'Publish', cooldownMs: 500, onClick: publishUsers },
542
543
  {
543
544
  key: 'more',
544
- dropdown: [{ key: 'export', label: 'Export', onClick: exportUsers }],
545
+ dropdown: [
546
+ { key: 'delete', label: 'Delete selection', onClick: deleteUsers },
547
+ ],
545
548
  },
546
549
  ])
547
550
  ```
548
551
 
549
- Duplicate keys in one ActionBar share a task lock. Replacing action objects or moving them between left/right groups preserves that key's busy state. Unkeyed actions use their group and position, so dynamic lists should supply explicit keys. Dropdown items follow the same disabled/loading guards and async mutual exclusion as regular buttons. `autoLoading: false` only hides the automatic spinner; duplicate execution remains blocked.
552
+ Actions and dropdown items whose `key` exactly matches `save`, `submit`, `confirm`, `delete`, or `remove` have a 300 ms cooldown by default. The first activation runs immediately, and repeat activations during the window are discarded. Other actions support consecutive activations. Set `cooldownMs` on an action or dropdown item to a positive, finite number of milliseconds. A value of `0` or an invalid value skips starting the cooldown for that activation. A failed action can be retried immediately.
550
553
 
551
- `action-click` and `dropdown-click` are notifications and do not await listeners' promises; put async commands in the action's `onClick`. Failures emit `action-error(error, action, item?)` and continue to Vue's `errorHandler` or error-capture boundary. `buttonProps.disabled/loading` merge with action state and cannot override internal busy protection. `buttonProps.onClick` remains a native click observer rather than replacing the executor. Table row actions reuse lightweight task locks without mounting a complete action bar per row.
554
+ Duplicate keys in one ActionBar share a task lock and cooldown. A stable key preserves state when its action object is replaced or moved between groups. Unkeyed actions use their group and position, so give dynamic lists explicit keys. Sibling dropdown items have independent cooldowns and share their parent action's async lock. The automatic spinner reflects in-flight work. `autoLoading: false` hides the spinner and keeps the lock active.
555
+
556
+ `action-click` and `dropdown-click` notify observers of accepted activations. Put async commands in the action's `onClick` so the component can await them. Failures emit `action-error(error, action, item?)` and propagate to Vue's `errorHandler` or error-capture boundary. `buttonProps.disabled/loading` merge with action state. For regular buttons, `buttonProps.onClick` observes accepted native clicks. The dropdown trigger stays usable while an item cools down, subject to the usual disabled and loading guards. Table row actions reuse lightweight task locks.
552
557
 
553
558
  ## Recommended C_Map setup
554
559
 
@@ -639,6 +644,10 @@ With `require-server-verification`, a successful response must include a server
639
644
 
640
645
  `C_Login` remembers only the username, never the password. SMS events require a valid phone number; the local countdown starts immediately, while delivery results and server-side rate limits remain the host's responsibility. `C_City` loads its city index on first open and scopes letter navigation to its own instance; the default trigger, letters, and city items are keyboard-operable.
641
646
 
647
+ ## Keyboard sorting in C_Draggable
648
+
649
+ In a sortable list with multiple items, press Tab to focus an item and use Alt+Up or Alt+Down to change its position. When the host accepts the `v-model` update, focus follows the item and the new position is announced. Keyboard moves use `update:modelValue` and `list-change`. Controls inside custom item slots keep their own keyboard behavior.
650
+
642
651
  ## Table loading
643
652
 
644
653
  `C_Table` uses a data-orbit SVG indicator in the theme's primary color, with an orbit, data rows, and a subtle beam to indicate waiting. It retains existing data and respects reduced-motion preferences without page configuration. Built-in asynchronous expansion also uses `C_Loading`; custom expansion renderers retain control of their content. Override the `loading` slot for custom content. The standalone `C_Loading` accepts `size` (16–120, default 48), optional `label`, and optional `color`. Disable rotation when using it with native `NSpin`:
@@ -711,6 +720,8 @@ With `C_FullCalendar` and `v-model:events`, listen for `@event-dropped` or `@eve
711
720
 
712
721
  Upload `concurrency` applies across normal and chunk upload requests. Cancellation stops subsequent hash reads; a Blob read already in progress is discarded on completion. Application-provided check/merge callbacks retain responsibility for their own network lifecycle.
713
722
 
723
+ Pausing and resuming a file or retrying its transfer reuses the file prepared by `beforeUpload` and the chunk size of its first transfer. When `uploadedChunksQuery` returns existing chunk indices, the server must ensure they use the same chunk size, including across separate upload instances.
724
+
714
725
  Excel previews preserve raw values, cell types and workbook display formatting. Sheets expand on demand. Defaults are 32 MiB per file and 100000 cells per sheet. `previewLimits: { maxBytes, maxCells }` accepts finite safe positive integers. Remote Excel previews stop reading the response once the byte limit is exceeded. Over-budget previews ask users to download the original file. Memory used to decompress a workbook depends on its contents.
715
726
 
716
727
  WaterFall fills a visible sentinel for at most five consecutive pages, then exposes a manual continuation. Custom `footer` slots receive `paused` and `loadMore`. Continue updating `loading` and `noMore` in the host. Draggable instances sort independently by default; cross-list transfers require an explicitly shared `group`.
@@ -650,22 +650,25 @@ const filters: SearchFormItem[] = [
650
650
 
651
651
  ### 动作配置与异步执行
652
652
 
653
- 保留稳定语义 key 和 Promise 回调即可获得文案、图标与互斥执行,不必为每个按钮维护 loading:
653
+ 使用稳定的语义 key 继承文案和图标。返回 Promise 的回调由组件管理加载状态和执行锁。
654
654
 
655
655
  ```ts
656
656
  const actions = defineActions([
657
657
  { key: 'save', onClick: () => saveCurrentUser() },
658
658
  { key: 'refresh', disabled: () => loading.value, onClick: reload },
659
+ { key: 'publish', label: '发布', cooldownMs: 500, onClick: publishUsers },
659
660
  {
660
661
  key: 'more',
661
- dropdown: [{ key: 'export', label: '导出', onClick: exportUsers }],
662
+ dropdown: [{ key: 'delete', label: '删除选中项', onClick: deleteUsers }],
662
663
  },
663
664
  ])
664
665
  ```
665
666
 
666
- 同一 ActionBar 中重复 key 共享执行锁;重建动作对象、切换左右分组都保留该 key 的 busy 状态。未提供 key 时按分组和位置识别,因此动态列表应显式提供 key。更多菜单与普通按钮遵守相同的 disabled、loading 和异步互斥规则;`autoLoading: false` 只关闭自动 spinner,执行期间继续阻止重复触发。
667
+ 普通动作和下拉子项的 `key` 精确匹配 `save`、`submit`、`confirm`、`delete` 或 `remove` 时,默认启用 300 ms 冷却。首次激活立即执行,窗口内的重复操作直接忽略。其他动作支持连续操作。可在动作或下拉子项上用 `cooldownMs` 指定正的有限毫秒值。设置 `0` 或无效值时,本次激活跳过冷却计时。失败后可立即重试。
667
668
 
668
- `action-click`/`dropdown-click` 是通知,不等待事件监听器的 Promise;异步命令应放在动作 `onClick`。失败发出 `action-error(error, action, item?)`,原始错误继续交给 Vue `errorHandler`/错误捕获边界。`buttonProps.disabled/loading` 与动作状态合并,不能关闭内部 busy 保护;`buttonProps.onClick` 保留为原生点击观察者,不覆盖动作执行器。表格行操作复用轻量执行锁,无需为每行再包一层完整操作栏。
669
+ 同一 ActionBar 中的重复 key 共享执行锁和冷却,重建动作对象或切换左右分组会保留稳定 key 的状态。无 key 时按分组和位置识别,动态列表应显式提供 key。下拉子项独立冷却,并共享父动作的异步执行锁。加载指示只跟随执行中的任务,`autoLoading: false` 可隐藏自动加载指示,执行锁继续生效。
670
+
671
+ `action-click`/`dropdown-click` 通知已接受的激活,异步命令放在会等待 Promise 的动作 `onClick`。失败发出 `action-error(error, action, item?)`,原始错误继续交给 Vue `errorHandler`/错误捕获边界。`buttonProps.disabled/loading` 与动作状态合并。普通按钮的 `buttonProps.onClick` 观察已接受的原生点击。下拉触发按钮的打开和关闭继续遵循禁用和加载状态,子项冷却期间仍可操作触发按钮。表格行操作复用轻量执行锁。
669
672
 
670
673
  ## C_Map 推荐用法
671
674
 
@@ -771,6 +774,10 @@ const actions = defineActions([
771
774
  </NSpin>
772
775
  ```
773
776
 
777
+ ## C_Draggable 键盘排序
778
+
779
+ 有多项且允许排序时,按 Tab 聚焦项目,再用 Alt + ↑ / ↓ 按列表顺序移动。组件在宿主接收 `v-model` 后把焦点移到新位置,并读出排序结果。键盘移动沿用 `update:modelValue` 和 `list-change`,自定义插槽中的输入框和按钮继续接收自己的按键。
780
+
774
781
  ## C_Login 扩展表单
775
782
 
776
783
  `password-fields` 插槽位于密码输入框下方,提供 `username`、`loading`,可配置工作空间或其他业务字段。`username-change` 在初始预填、恢复记住的账号和输入变化时同步触发。宿主通过 `submitDisabled` 阻止扩展字段尚未就绪时的按钮与回车提交;`loading` 期间凭据输入禁用。公司查询、成员关系和权限始终由宿主认证服务处理,组件不保存业务上下文。
@@ -849,6 +856,8 @@ CRUD 控制器只需满足结构契约;`@robot-admin/request-core` 0.6.3 起
849
856
 
850
857
  `C_Upload.concurrency` 统一限制普通上传与分片上传请求。取消、移除和卸载会停止后续哈希读取并释放排队任务;已经开始的单次 Blob 读取完成后不再处理结果。业务自行提供的校验、合并回调仍由业务负责其网络生命周期。
851
858
 
859
+ 同一文件的恢复与传输重试复用 `beforeUpload` 处理后的文件和首次传输的分片尺寸。服务端通过 `uploadedChunksQuery` 返回已上传索引时,须保证这些索引使用同一分片尺寸,跨上传实例也遵循此约定。
860
+
852
861
  在同一编辑弹窗切换记录时,调用上传实例的 `replaceFileList(record.attachments)`。它会废弃上一条记录尚未返回的文件选择结果和拖入目录,取消上传任务,再回填新记录的附件。`defaultFileList` 用于首次初始化。`clearAll()` 使用同样的取消路径。
853
862
 
854
863
  普通单文件模式一次只接收一个符合 `accept` 的文件,点击、拖放和粘贴一致。需要接收整个目录时开启 `directory`;需要限制整个列表的数量时使用 `maxCount`。
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.41.2",
6
+ "version": "0.42.0",
7
7
  "description": "基于 Naive UI 的 Vue 3 组件库",
8
8
  "packageManager": "bun@1.4.2",
9
9
  "engines": {