@robot-admin/naive-ui-components 0.14.3 → 0.15.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 (257) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +130 -741
  3. package/README_EN.md +137 -678
  4. package/dist/C_ActionBar.css +57 -58
  5. package/dist/C_ActionBar2.cjs +1 -1
  6. package/dist/C_ActionBar2.js +1 -1
  7. package/dist/C_AntV.css +232 -238
  8. package/dist/C_AntV2.cjs +2 -2
  9. package/dist/C_AntV2.js +2 -2
  10. package/dist/C_AudioPlayer.css +9 -9
  11. package/dist/C_AvatarGroup.css +5 -6
  12. package/dist/C_Barcode.css +1 -1
  13. package/dist/C_Breadcrumb.css +15 -18
  14. package/dist/C_Breadcrumb2.cjs +1 -1
  15. package/dist/C_Breadcrumb2.js +1 -1
  16. package/dist/C_Captcha.css +46 -49
  17. package/dist/C_Captcha2.cjs +1 -1
  18. package/dist/C_Captcha2.js +1 -1
  19. package/dist/C_Cascade.css +5 -6
  20. package/dist/C_Chat.css +8 -8
  21. package/dist/C_City.css +2 -2
  22. package/dist/C_Code.css +9 -9
  23. package/dist/C_CollapsePanel.css +9 -9
  24. package/dist/C_ContextMenu.css +31 -31
  25. package/dist/C_Cron.css +271 -274
  26. package/dist/C_Date.css +1 -1
  27. package/dist/C_Draggable.css +10 -11
  28. package/dist/C_Editor.css +2 -2
  29. package/dist/C_FilePreview.css +423 -423
  30. package/dist/C_Form.base.css +608 -602
  31. package/dist/C_Form.cjs +1 -1
  32. package/dist/C_Form.css +610 -604
  33. package/dist/C_Form.d.cts +2 -2
  34. package/dist/C_Form.d.ts +2 -2
  35. package/dist/C_Form.js +1 -1
  36. package/dist/C_FormModal.cjs +1 -1
  37. package/dist/C_FormModal.css +12 -17
  38. package/dist/C_FormModal.js +1 -1
  39. package/dist/C_FormModal2.cjs +1 -1
  40. package/dist/C_FormModal2.js +1 -1
  41. package/dist/C_FormSearch.css +53 -55
  42. package/dist/C_FormSearch2.cjs +1 -1
  43. package/dist/C_FormSearch2.js +1 -1
  44. package/dist/C_FormulaEditor.css +204 -205
  45. package/dist/C_FullCalendar.css +13 -15
  46. package/dist/C_FullCalendar2.cjs +1 -1
  47. package/dist/C_FullCalendar2.js +1 -1
  48. package/dist/C_GlobalSearch.css +11 -12
  49. package/dist/C_Guide.css +10 -10
  50. package/dist/C_Icon.css +7 -8
  51. package/dist/C_ImageCropper.css +69 -69
  52. package/dist/C_Language.css +8 -8
  53. package/dist/C_Loading.css +22 -25
  54. package/dist/C_Loading2.cjs +1 -1
  55. package/dist/C_Loading2.js +1 -1
  56. package/dist/C_Login.css +130 -135
  57. package/dist/C_Login2.cjs +1 -1
  58. package/dist/C_Login2.js +1 -1
  59. package/dist/C_Map.css +22 -23
  60. package/dist/C_Markdown.css +6 -7
  61. package/dist/C_Menu.css +2 -5
  62. package/dist/C_Menu2.cjs +1 -1
  63. package/dist/C_Menu2.js +1 -1
  64. package/dist/C_NotificationCenter.css +252 -253
  65. package/dist/C_OrgChart.css +8 -8
  66. package/dist/C_PageLoading.css +34 -39
  67. package/dist/C_QRCode.css +5 -6
  68. package/dist/C_Signature.css +5 -6
  69. package/dist/C_Skeleton.css +2 -2
  70. package/dist/C_SplitPane.css +2 -2
  71. package/dist/C_Steps.css +5 -6
  72. package/dist/C_Table.base.css +1090 -879
  73. package/dist/C_Table.cjs +1 -1
  74. package/dist/C_Table.css +1096 -885
  75. package/dist/C_Table.d.cts +1 -1
  76. package/dist/C_Table.d.ts +1 -1
  77. package/dist/C_Table.js +1 -1
  78. package/dist/C_Tabs.css +5 -6
  79. package/dist/C_TagsView.css +60 -63
  80. package/dist/C_TagsView2.cjs +1 -1
  81. package/dist/C_TagsView2.js +1 -1
  82. package/dist/C_Theme.css +7 -8
  83. package/dist/C_Time.css +1 -1
  84. package/dist/C_Timeline.css +8 -8
  85. package/dist/C_Transfer.css +10 -11
  86. package/dist/C_Tree.css +16 -17
  87. package/dist/C_Upload.css +156 -157
  88. package/dist/C_VideoPlayer.css +267 -267
  89. package/dist/C_VtableGantt.css +2 -2
  90. package/dist/C_WaterFall.css +2 -2
  91. package/dist/C_WorkFlow.css +466 -470
  92. package/dist/C_WorkFlow2.cjs +1 -1
  93. package/dist/C_WorkFlow2.js +1 -1
  94. package/dist/Card.cjs +1 -0
  95. package/dist/Card.js +1 -0
  96. package/dist/Custom.cjs +1 -0
  97. package/dist/Custom.js +1 -0
  98. package/dist/Dynamic.cjs +1 -0
  99. package/dist/Dynamic.js +1 -0
  100. package/dist/Steps.cjs +1 -0
  101. package/dist/Steps.js +1 -0
  102. package/dist/Tabs.cjs +1 -0
  103. package/dist/Tabs.js +1 -0
  104. package/dist/cascader.cjs +1 -0
  105. package/dist/cascader.js +1 -0
  106. package/dist/color-picker.cjs +1 -0
  107. package/dist/color-picker.js +1 -0
  108. package/dist/constants.d.cts +1 -1
  109. package/dist/constants.d.ts +1 -1
  110. package/dist/constants3.d.cts +2 -2
  111. package/dist/constants3.d.ts +2 -2
  112. package/dist/constants4.d.cts +4 -4
  113. package/dist/constants4.d.ts +4 -4
  114. package/dist/constants5.d.cts +2 -2
  115. package/dist/constants5.d.ts +2 -2
  116. package/dist/context.cjs +1 -0
  117. package/dist/context.js +1 -0
  118. package/dist/contracts.d.cts +24 -0
  119. package/dist/contracts.d.ts +24 -0
  120. package/dist/createPageLoading.cjs +1 -1
  121. package/dist/createPageLoading.js +1 -1
  122. package/dist/data.cjs +1 -1
  123. package/dist/data.d.cts +4 -4
  124. package/dist/data.d.ts +4 -4
  125. package/dist/data.js +1 -1
  126. package/dist/date-picker.cjs +1 -0
  127. package/dist/date-picker.js +1 -0
  128. package/dist/feedback.cjs +1 -0
  129. package/dist/feedback.js +1 -0
  130. package/dist/helpers.cjs +1 -1
  131. package/dist/helpers.js +1 -1
  132. package/dist/index.cjs +1 -1
  133. package/dist/index.d.cts +6 -4
  134. package/dist/index.d.ts +6 -4
  135. package/dist/index.js +1 -1
  136. package/dist/index.vue.d.cts +4 -4
  137. package/dist/index.vue.d.ts +4 -4
  138. package/dist/index10.vue.d.cts +3 -3
  139. package/dist/index10.vue.d.ts +3 -3
  140. package/dist/index11.vue.d.cts +3 -3
  141. package/dist/index11.vue.d.ts +2 -2
  142. package/dist/index12.vue.d.cts +2 -2
  143. package/dist/index12.vue.d.ts +1 -1
  144. package/dist/index13.vue.d.cts +1 -1
  145. package/dist/index13.vue.d.ts +2 -2
  146. package/dist/index14.vue.d.cts +2 -2
  147. package/dist/index14.vue.d.ts +7 -7
  148. package/dist/index15.vue.d.cts +7 -7
  149. package/dist/index16.vue.d.ts +1 -1
  150. package/dist/index17.vue.d.cts +1 -1
  151. package/dist/index17.vue.d.ts +2 -2
  152. package/dist/index18.vue.d.cts +2 -2
  153. package/dist/index18.vue.d.ts +2 -2
  154. package/dist/index19.vue.d.cts +2 -2
  155. package/dist/index19.vue.d.ts +1 -8
  156. package/dist/index2.vue.d.cts +1 -1
  157. package/dist/index2.vue.d.ts +1 -1
  158. package/dist/index20.vue.d.cts +1 -1
  159. package/dist/index20.vue.d.ts +1 -1
  160. package/dist/index21.vue.d.cts +2 -2
  161. package/dist/index21.vue.d.ts +2 -2
  162. package/dist/index22.vue.d.cts +3 -3
  163. package/dist/index22.vue.d.ts +3 -3
  164. package/dist/index23.vue.d.cts +1 -1
  165. package/dist/index23.vue.d.ts +1 -1
  166. package/dist/index25.vue.d.cts +4 -4
  167. package/dist/index25.vue.d.ts +4 -4
  168. package/dist/index26.vue.d.cts +1 -1
  169. package/dist/index26.vue.d.ts +1 -1
  170. package/dist/index27.vue.d.cts +3 -3
  171. package/dist/index27.vue.d.ts +3 -3
  172. package/dist/index3.vue.d.cts +4 -4
  173. package/dist/index3.vue.d.ts +4 -4
  174. package/dist/index4.vue.d.cts +1 -8
  175. package/dist/index6.vue.d.ts +2 -2
  176. package/dist/index7.vue.d.cts +2 -2
  177. package/dist/index8.vue.d.ts +3 -3
  178. package/dist/index9.vue.d.cts +3 -3
  179. package/dist/index9.vue.d.ts +3 -3
  180. package/dist/mapUtils.d.cts +2 -2
  181. package/dist/mapUtils.d.ts +2 -2
  182. package/dist/presets.d.cts +8 -2
  183. package/dist/presets.d.ts +8 -2
  184. package/dist/rate.cjs +1 -0
  185. package/dist/rate.js +1 -0
  186. package/dist/slider.cjs +1 -0
  187. package/dist/slider.js +1 -0
  188. package/dist/style.css +10671 -10704
  189. package/dist/time-picker.cjs +1 -0
  190. package/dist/time-picker.js +1 -0
  191. package/dist/upload.cjs +1 -0
  192. package/dist/upload.js +1 -0
  193. package/dist/useActionTask.cjs +1 -0
  194. package/dist/useActionTask.js +1 -0
  195. package/dist/useCalendarEvents.d.cts +1 -1
  196. package/dist/useCalendarEvents.d.ts +1 -1
  197. package/dist/useCollapsePanel.d.cts +6 -6
  198. package/dist/useCollapsePanel.d.ts +6 -6
  199. package/dist/useComponentLocale.cjs +1 -0
  200. package/dist/useComponentLocale.js +1 -0
  201. package/dist/useCropperCore.d.cts +4 -4
  202. package/dist/useCropperCore.d.ts +4 -4
  203. package/dist/useDraggableLayout.d.cts +8 -8
  204. package/dist/useDraggableLayout.d.ts +8 -8
  205. package/dist/useDynamicFormState.cjs +1 -0
  206. package/dist/useDynamicFormState.d.cts +62 -38
  207. package/dist/useDynamicFormState.d.ts +62 -38
  208. package/dist/useDynamicFormState.js +1 -0
  209. package/dist/useEdgeInteraction.d.cts +2 -2
  210. package/dist/useEdgeInteraction.d.ts +2 -2
  211. package/dist/useFullscreen.d.cts +2 -2
  212. package/dist/useFullscreen.d.ts +2 -2
  213. package/dist/useInfiniteScroll.d.cts +1 -1
  214. package/dist/useInfiniteScroll.d.ts +1 -1
  215. package/dist/useQRCode.d.cts +3 -3
  216. package/dist/useQRCode.d.ts +3 -3
  217. package/dist/useSearchState.d.cts +16 -726
  218. package/dist/useSearchState.d.ts +16 -835
  219. package/dist/useSignatureHistory.d.cts +2 -2
  220. package/dist/useSignatureHistory.d.ts +2 -2
  221. package/dist/useSplitResize.d.cts +9 -9
  222. package/dist/useSplitResize.d.ts +9 -9
  223. package/dist/useTableQuery.cjs +3 -3
  224. package/dist/useTableQuery.d.cts +66 -33
  225. package/dist/useTableQuery.d.ts +66 -33
  226. package/dist/useTableQuery.js +3 -3
  227. package/dist/useTimeSelection.d.cts +2 -2
  228. package/dist/useTimeSelection.d.ts +2 -2
  229. package/dist/useTreeOperations.d.cts +4 -4
  230. package/dist/useTreeOperations.d.ts +4 -4
  231. package/dist/useWorkflowValidation.d.cts +3 -3
  232. package/dist/useWorkflowValidation.d.ts +3 -3
  233. package/dist/verification.d.cts +2 -2
  234. package/dist/verification.d.ts +2 -2
  235. package/docs/architecture.en.md +83 -0
  236. package/docs/architecture.md +83 -0
  237. package/docs/assets/README.md +47 -0
  238. package/docs/assets/naive-ui-components-banner.png +0 -0
  239. package/docs/assets/naive-ui-components-banner.svg +69 -0
  240. package/docs/assets/naive-ui-components-logo.png +0 -0
  241. package/docs/assets/naive-ui-components-logo.svg +22 -0
  242. package/docs/components.en.md +118 -0
  243. package/docs/components.md +118 -0
  244. package/docs/engineering.en.md +132 -0
  245. package/docs/engineering.md +133 -0
  246. package/docs/guides/usage.en.md +638 -0
  247. package/docs/guides/usage.md +699 -0
  248. package/docs/performance-0.15.0.md +20 -0
  249. package/docs/security-scan-2026-10-06.md +11 -0
  250. package/docs/security-scan-2026-10-18.md +16 -0
  251. package/package.json +29 -11
  252. package/dist/C_Form2.cjs +0 -1
  253. package/dist/C_Form2.js +0 -1
  254. package/dist/config.cjs +0 -1
  255. package/dist/config.d.cts +0 -33
  256. package/dist/config.d.ts +0 -33
  257. package/dist/config.js +0 -1
package/README_EN.md CHANGED
@@ -1,747 +1,206 @@
1
- <div align="center">
2
-
3
- # @robot-admin/naive-ui-components
4
-
5
- **Enterprise-grade Vue 3 component library built on Naive UI**
6
-
7
- 55 production-ready business components extracted from Robot Admin, supporting global registration, on-demand imports (Tree-Shaking), and subpath imports.
8
-
9
- [![NPM Version](https://img.shields.io/npm/v/@robot-admin/naive-ui-components)](https://www.npmjs.com/package/@robot-admin/naive-ui-components)
10
- [![License](https://img.shields.io/npm/l/@robot-admin/naive-ui-components)](./LICENSE)
11
-
12
- [Live Demo](https://www.tzagileteam.com/robot/components/preface) · [GitHub](https://github.com/ChenyCHENYU/naive-ui-components) · [NPM](https://www.npmjs.com/package/@robot-admin/naive-ui-components)
1
+ <!-- Banner source and export instructions: docs/assets/README.md -->
13
2
 
14
- [中文](./README.md)
3
+ ![Naive UI Components — Vue 3 business components in the Robot ecosystem](./docs/assets/naive-ui-components-banner.png)
15
4
 
5
+ <div align="center">
6
+ <p><strong>Turn recurring business interactions into composable components.</strong></p>
7
+ <p>Vue 3 · Naive UI · TypeScript · 55 business components</p>
8
+ <p>
9
+ <a href="https://www.npmjs.com/package/@robot-admin/naive-ui-components"><img src="https://img.shields.io/npm/v/@robot-admin/naive-ui-components?style=flat-square&amp;color=249D70&amp;labelColor=183C2E" alt="npm version"></a>
10
+ <a href="./package.json"><img src="https://img.shields.io/badge/Vue-3.5+-249D70?style=flat-square&amp;logo=vue.js&amp;logoColor=white&amp;labelColor=183C2E" alt="Vue 3.5+"></a>
11
+ <a href="./package.json"><img src="https://img.shields.io/badge/TypeScript-5.9-3178C6?style=flat-square&amp;logo=typescript&amp;logoColor=white&amp;labelColor=183C2E" alt="TypeScript 5.9"></a>
12
+ <a href="https://github.com/ChenyCHENYU/naive-ui-components/actions/workflows/ci.yml"><img src="https://github.com/ChenyCHENYU/naive-ui-components/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
13
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/License-MIT-64748B?style=flat-square&amp;labelColor=183C2E" alt="MIT License"></a>
14
+ </p>
15
+ <p>
16
+ <a href="#quick-start">Quick start</a> ·
17
+ <a href="#capability-map">Capabilities</a> ·
18
+ <a href="./docs/components.en.md">Component catalog</a> ·
19
+ <a href="https://www.tzagileteam.com/robot/components/preface">Online docs</a> ·
20
+ <a href="https://robotadmin.cn">Live demo</a> ·
21
+ <a href="./README.md">简体中文</a>
22
+ </p>
16
23
  </div>
17
24
 
18
- ---
19
-
20
- ## 📦 Installation
21
-
22
- ```bash
23
- bun add @robot-admin/naive-ui-components
24
- ```
25
-
26
- Required peer dependencies:
27
-
28
- ```bash
29
- bun add vue@^3.5.0 naive-ui@^2.35.0
30
- ```
31
-
32
- ### 🚀 Quick Start
33
-
34
- #### Global Registration
35
-
36
- ```typescript
37
- import { createApp } from 'vue'
38
- import NaiveUIComponents from '@robot-admin/naive-ui-components'
39
- import '@robot-admin/naive-ui-components/style.css'
40
-
41
- const app = createApp(App)
42
- app.use(NaiveUIComponents)
43
- app.mount('#app')
44
- ```
45
-
46
- #### On-demand Import (Tree-Shaking)
25
+ ## Overview
47
26
 
48
- ```vue
49
- <script setup lang="ts">
50
- import { C_Icon, C_Table, C_Form } from '@robot-admin/naive-ui-components'
51
- import '@robot-admin/naive-ui-components/style.css'
52
- </script>
53
- ```
27
+ **Naive UI Components** is a Vue 3 business component library extracted from [Robot Admin](https://github.com/ChenyCHENYU/Robot_Admin), published independently as `@robot-admin/naive-ui-components`. Built on Naive UI, it provides `C_*` components and composables for forms, tables, editors, workflows, files and media. It can also be used in other Vue 3 applications.
54
28
 
55
- #### Subpath Import (Recommended, Smallest Bundle)
29
+ | Design focus | Available today |
30
+ | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
31
+ | Configuration | Typed configuration for fields, columns, actions and dialogs; 8 form layouts |
32
+ | Connected types | Field paths, columns, events and instance methods, with helpers such as `defineFormOptions`, `useCForm` and `useTableQuery` |
33
+ | Selective loading | 55 component entries, an auto-import resolver, component CSS and base styles for forms and tables |
34
+ | Application integration | Global registration or local imports; injectable feedback, locale and defaults; form dialogs compatible with structurally matching headless CRUD controllers |
56
35
 
57
- Each component provides an independent subpath entry that loads only the target component's code and types:
36
+ The library handles UI and interaction. Applications supply business APIs, authentication, authorization, upload services and platform configuration. The current repository version is **0.15.0**; see the [changelog](./CHANGELOG.md) for release details.
58
37
 
59
- ```vue
60
- <script setup lang="ts">
61
- import { C_Form } from '@robot-admin/naive-ui-components/C_Form'
62
- import { C_Table } from '@robot-admin/naive-ui-components/C_Table'
63
- import { C_Icon } from '@robot-admin/naive-ui-components/C_Icon'
64
- import { createMenuOptions } from '@robot-admin/naive-ui-components/C_Menu'
65
- import '@robot-admin/naive-ui-components/style.css'
66
- </script>
67
- ```
38
+ ## Capability map
68
39
 
69
- > Subpath imports provide full TypeScript support (`.d.ts`) with IDE auto-completion for props / emits / slots. Component-specific utilities such as `createMenuOptions` are exported from the same component subpath, so consumers do not need the root entry for one helper.
40
+ | Scenario | Representative components | Capabilities |
41
+ | --------------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
42
+ | Data entry | `C_Form` · `C_FormModal` · `C_FormSearch` | Dynamic fields, validation, async submission, search and create/edit dialogs |
43
+ | Data operations | `C_Table` · `C_ActionBar` · `C_Tree` · `C_Transfer` | Pagination, trees, row/cell editing, cross-page selection, exports and batch actions |
44
+ | Editing | `C_Editor` · `C_Markdown` · `C_Cron` · `C_FormulaEditor` | Rich text, Markdown, Cron previews and local formula evaluation |
45
+ | Workflow and planning | `C_AntV` · `C_WorkFlow` · `C_VtableGantt` · `C_FullCalendar` | ER/BPMN/UML, approval flows, Gantt charts and calendars |
46
+ | Files and media | `C_Upload` · `C_FilePreview` · `C_VideoPlayer` · `C_AudioPlayer` | Chunked uploads, PDF/Word/Excel previews and audio/video playback |
47
+ | Images and maps | `C_Signature` · `C_ImageCropper` · `C_QRCode` · `C_Map` | Signatures, cropping, QR codes, OpenStreetMap and AMap |
48
+ | Workspace | `C_Menu` · `C_Tabs` · `C_TagsView` · `C_GlobalSearch` | Menus, view switching, tab navigation and global search |
49
+ | Common interactions | `C_Login` · `C_Captcha` · `C_Guide` · `C_PageLoading` | Login UI, human verification, onboarding and navigation feedback |
70
50
 
71
- #### Standalone Composables
72
-
73
- ```typescript
74
- import {
75
- useTableManager,
76
- useFormState,
77
- usePlayerCore,
78
- } from '@robot-admin/naive-ui-components'
79
- ```
51
+ Browse [all 55 components and dependencies](./docs/components.en.md), or explore scenarios in [Robot Admin](https://robotadmin.cn). Cron previews calculate times only; formulas run locally. Production human verification requires server validation. See the [usage guide](./docs/guides/usage.en.md).
80
52
 
81
- #### Automatic On-demand Imports (Recommended)
53
+ ## Quick start
82
54
 
83
- The resolver loads component subpaths by default, preventing unused components and heavyweight runtime dependencies from entering the initial bundle:
55
+ ### Install
84
56
 
85
- ```typescript
86
- import Components from 'unplugin-vue-components/vite'
87
- import { RobotNaiveUiResolver } from '@robot-admin/naive-ui-components/resolver'
57
+ Add the library and required peer dependencies to an existing Vue 3 application:
88
58
 
89
- Components({
90
- resolvers: [RobotNaiveUiResolver({ importStyle: true })],
91
- })
59
+ ```bash
60
+ bun add @robot-admin/naive-ui-components
61
+ bun add vue@^3.5.0 naive-ui@^2.35.0
92
62
  ```
93
63
 
94
- `importStyle: true` (an alias of `'full'`) preserves the existing complete style behavior. When C_Form/C_Table only use base fields and no built-in rich-text editor, set `importStyle: 'base'` to avoid editor CSS; other components safely fall back to their standard style entry. Set `importOnDemand: false` only when a legacy project still requires the package root.
64
+ You can also use your project's npm or pnpm setup. Install optional peers only for the features that need them:
95
65
 
96
- Every `C_*/style.css` file is a self-contained component style entry. When a component composes public components such as `C_Icon` or `C_Captcha`, their required styles are included automatically, so consumers do not need duplicate imports or the global `style.css` fallback.
66
+ | Feature | Additional dependency |
67
+ | -------------------------------------------- | --------------------- |
68
+ | Root imports / `C_Breadcrumb` / `C_TagsView` | `vue-router@^4.6.4` |
69
+ | `C_Table` row/column dragging | `sortablejs@^1.15.7` |
97
70
 
98
- `C_Menu` emits a non-mutating `intent` event when a leaf item is hovered or keyboard-focused. Hosts may connect it to route prefetching without changing the existing `select` behavior.
71
+ ### Build a form from configuration
99
72
 
100
- The style tiers can also be imported explicitly:
101
-
102
- ```typescript
103
- import '@robot-admin/naive-ui-components/C_Form/base.css'
104
- import '@robot-admin/naive-ui-components/C_Table/base.css'
105
- // Full mode is also available as C_Form/full.css and C_Table/full.css.
106
- ```
107
-
108
- ### Cron and formula workspaces
109
-
110
- Use a model and one flat config. Existing individual props remain supported; templates, validation, previews and initial-state reset are owned by the components.
73
+ Place this example in `App.vue`. It uses a component subpath and its CSS entry, with no global registration required:
111
74
 
112
75
  ```vue
113
76
  <script setup lang="ts">
114
77
  import { ref } from 'vue'
115
78
  import {
116
- C_Cron,
117
- type CronConfig,
118
- } from '@robot-admin/naive-ui-components/C_Cron'
119
- import {
120
- C_FormulaEditor,
121
- type FormulaEditorConfig,
122
- } from '@robot-admin/naive-ui-components/C_FormulaEditor'
123
- import '@robot-admin/naive-ui-components/C_Cron/style.css'
124
- import '@robot-admin/naive-ui-components/C_FormulaEditor/style.css'
125
-
126
- const expression = ref('0 30 8 * * ?')
127
- const cronConfig: CronConfig = { previewCount: 5 }
128
- const formula = ref('IF([完成值] > 0, 100 / [完成值], 0)')
129
- const formulaConfig: FormulaEditorConfig = {
130
- variables: [{ name: '完成值', field: 'completed', type: 'number' }],
131
- sampleData: { completed: 5 },
132
- editableSampleData: true,
133
- }
134
- </script>
135
- <template>
136
- <C_Cron
137
- v-model="expression"
138
- :config="cronConfig"
139
- />
140
- <C_FormulaEditor
141
- v-model="formula"
142
- :config="formulaConfig"
143
- />
144
- </template>
145
- ```
146
-
147
- Cron supports six numeric fields, ranges, steps, lists and day/weekday exclusion with `?`; L/W/# extensions are not supported. Preview dates use the browser local timezone and never schedule jobs. Formula trials do not mutate caller `sampleData`; validation and calculation share a bounded parser with lazy conditions. Compact modes use `showPreview`, `showKeyboard` and `showVariablePanel`. Read-only mode protects trial inputs too. Reset restores the initial model and data; remount with a new key when switching independent records.
148
-
149
- ### Configure C_Guide
150
-
151
- Provide targets and steps; the component owns its theme, optional SVG illustrations, and cleanup without depending on a host router or store:
152
-
153
- ```vue
154
- <script setup lang="ts">
155
- import {
156
- C_Guide,
157
- type GuideStep,
158
- } from '@robot-admin/naive-ui-components/C_Guide'
159
- import '@robot-admin/naive-ui-components/C_Guide/style.css'
160
-
161
- const steps: GuideStep[] = [
162
- {
163
- element: '[data-guide="search"]',
164
- popover: {
165
- title: 'Search',
166
- description: 'Find a feature.',
167
- illustration: 'search',
168
- },
169
- },
170
- ]
171
- </script>
172
-
173
- <template>
174
- <C_Guide :steps="steps" />
175
- </template>
176
- ```
177
-
178
- Inside `NConfigProvider`, the popover follows its light/dark theme and primary color. Targets accept selectors, elements, or resolver functions; invisible targets are skipped by default and omitting a target creates a centered step. The engine loads when opened. With `persistence` enabled, only completion is remembered; the trigger always allows replay. Every step shows a skip button by default. Skipping emits `skip` and `close` without recording completion; configure it with `showSkipButton` and `skipBtnText`. `GuideExpose` provides `startGuide(force?)`, `stopGuide()`, `isCompleted()`, and `resetCompleted()` for host lifecycle integration.
179
-
180
- ### Recommended C_Form / C_Table setup
181
-
182
- Declare the business model once and keep nested field paths, values, column keys, callbacks, and exposed methods type-safe:
183
-
184
- ```ts
185
- import {
186
- defineFormConfig,
187
- defineFormOptions,
188
- useCForm,
189
- } from '@robot-admin/naive-ui-components/C_Form'
190
-
191
- interface UserForm {
192
- name: string
193
- profile: { email: string }
194
- }
195
-
196
- const options = defineFormOptions<UserForm>([
197
- { type: 'input', prop: 'name', required: true },
198
- { type: 'input', prop: 'profile.email' },
199
- ])
200
- const config = defineFormConfig<UserForm>({
201
- onSubmit: ({ model }) => save(model),
202
- })
203
- const { model, formRef, bindings } = useCForm({
204
- initialValues: { name: '', profile: { email: '' } },
205
- options,
206
- config,
207
- })
208
- ```
209
-
210
- `C_Form` includes `@robot-admin/form-validate`; consumers need no local type adapter or separate validation installation. `rules` and `rulesWhen` accept native Naive UI rules, the package's `NaiveRule`, and framework-independent `RuleSpec` objects, including mixed lists. `required: true` uses the same empty-value rules and preserves valid `0` and `false` values.
211
-
212
- ```ts
213
- import {
214
- defineFormOptions,
215
- PRESET_RULES,
216
- NAIVE_COMBOS,
217
- SPEC_RULES,
218
- } from '@robot-admin/naive-ui-components/C_Form'
219
-
220
- const fields = defineFormOptions([
221
- {
222
- type: 'input',
223
- prop: 'name',
224
- label: 'Name',
225
- required: true,
226
- rules: [SPEC_RULES.length('Name', 2, 20)],
227
- },
228
- {
229
- type: 'input',
230
- prop: 'email',
231
- label: 'Email',
232
- rules: NAIVE_COMBOS.email('Email'),
233
- },
234
- {
235
- type: 'input',
236
- prop: 'mobile',
237
- label: 'Mobile',
238
- rules: [PRESET_RULES.mobile('Mobile')],
239
- },
240
- ])
241
- ```
242
-
243
- Normal forms provide submit/reset controls; step forms provide a submit button on their last step. Configure `submitText`, `resetText`, and `onSubmit`. Use `action-extra` for business controls such as previews while retaining the built-in buttons and loading state. Full customization remains available through `action` and `step-actions`; call the slot's `submit()` rather than treating `validate()` as submission.
244
-
245
- Put asynchronous work in `config.onSubmit`; `@submit` is a completion notification and does not await an event listener's promise. The second argument provides `context?.signal` for cancellable requests. Unmount aborts that signal and suppresses late submit events and feedback. `submitSuccessText` and `resetSuccessText` opt in to feedback; no success message is shown by default, and validation alone does not imply persistence.
246
-
247
- For create/edit flows, `C_FormModal` consumes a structural headless `editor` directly. Fields, validation, and layout remain data-driven by `C_Form`, while pages no longer own duplicate modal, draft, or loading state:
248
-
249
- ```vue
250
- <script setup lang="ts">
251
- import { C_FormModal } from '@robot-admin/naive-ui-components/C_FormModal'
252
- import type { FormModalEditor } from '@robot-admin/naive-ui-components/C_FormModal'
253
- import {
254
- defineFormConfig,
79
+ C_Form,
255
80
  defineFormOptions,
81
+ useCForm,
256
82
  } from '@robot-admin/naive-ui-components/C_Form'
83
+ import '@robot-admin/naive-ui-components/C_Form/style.css'
257
84
 
258
- interface UserForm {
85
+ interface Contact {
259
86
  name: string
87
+ email: string
260
88
  }
261
89
 
262
- defineProps<{ editor: FormModalEditor<UserForm> }>()
263
-
264
- const fields = defineFormOptions<UserForm>([
265
- { type: 'input', prop: 'name', label: 'Name', required: true },
266
- ])
267
- const formConfig = defineFormConfig<UserForm>({ labelPlacement: 'top' })
90
+ const result = ref('')
91
+ const { formRef, bindings } = useCForm<Contact>({
92
+ initialValues: { name: '', email: '' },
93
+ options: defineFormOptions<Contact>([
94
+ { type: 'input', prop: 'name', label: 'Name', required: true },
95
+ { type: 'input', prop: 'email', label: 'Email' },
96
+ ]),
97
+ config: {
98
+ labelPlacement: 'top',
99
+ onSubmit: ({ model }) => {
100
+ result.value = `Validated: ${model.name}`
101
+ },
102
+ },
103
+ })
268
104
  </script>
269
105
 
270
106
  <template>
271
- <C_FormModal
272
- :editor="editor"
273
- :options="fields"
274
- :config="formConfig"
107
+ <C_Form
108
+ ref="formRef"
109
+ v-bind="bindings"
275
110
  />
111
+ <p v-if="result">{{ result }}</p>
276
112
  </template>
277
113
  ```
278
114
 
279
- The editor contract is structural: the component package does not depend on a request library. Any controller exposing `visible/mode/model/title/loading/setModel/close/submit` can drive it. The default uses a responsive 620px width, `small` form controls, and a right-aligned icon-based `C_ActionBar` for a compact admin workflow. Close button, mask close, and Escape remain enabled by default and can be disabled for high-risk forms.
115
+ The form includes submission, reset and validation. For persistence, await your async request inside `config.onSubmit`; use `@submit` for completion notifications. See the [usage guide](./docs/guides/usage.en.md) for layouts, validation rules, dialogs and remote tables.
280
116
 
281
- For remote tables, `useTableQuery` owns cancellation, latest-request-wins behavior, pagination, and loading. Destructure its `bindings` and use `<C_Table v-bind="bindings" />`:
117
+ ## Imports and styles
282
118
 
283
- ```ts
284
- import {
285
- defineTableColumns,
286
- useTableQuery,
287
- } from '@robot-admin/naive-ui-components/C_Table'
288
-
289
- interface UserRow {
290
- id: string
291
- name: string
292
- }
293
- const columns = defineTableColumns<UserRow>([{ key: 'name', title: 'Name' }])
294
- const { bindings } = useTableQuery<UserRow, { keyword: string }>({
295
- initialQuery: { keyword: '' },
296
- columns,
297
- rowKey: 'id',
298
- request: ({ page, pageSize, query, signal }) =>
299
- fetchUsers({ page, pageSize, ...query }, signal),
300
- })
301
- ```
119
+ ### Choose an import strategy
302
120
 
303
- When binding a headless CRUD controller through `:crud`, the table recognizes `{ error }` action results: failed deletes do not emit a successful-deletion event, and feedback already shown by the controller is not duplicated. Custom `actions.delete` callbacks may return a promise or a `{ data, error }` result.
121
+ | Strategy | Use case | Styles |
122
+ | -------------------- | ------------------------------------------ | ------------------------------------------- |
123
+ | Component subpaths | Explicit control over each component entry | Import `C_Component/style.css` |
124
+ | Auto-import resolver | Use components directly in templates | Set `importStyle: true` explicitly |
125
+ | Named root imports | Existing Tree-Shaking setups | Import the required CSS or full `style.css` |
126
+ | Global `app.use()` | Register the entire library | Import full `style.css` |
304
127
 
305
- Tree data can use `<C_Table :data="rows" :columns="columns" :config="{ tree: { defaultExpandAll: true }, pagination: false }" />` directly. `children` is the default child key and can be changed with `tree.childrenKey`. Default expansion includes parent rows added later without reopening rows the user collapsed.
128
+ ### Automatic imports
306
129
 
307
- `C_Tabs` is the data-driven page-scenario switcher for the global `C_*` system. It defaults to the compact
308
- `small` size, lazy pane display, and supports controlled or uncontrolled state. Set `tabsOnly` for filters or
309
- view switching; pane content is not executed, avoiding hidden render work and side effects. Most pages only maintain an item array; complex
310
- content can opt into `render`, `pane`, or `pane-{key}` slots:
130
+ Install `unplugin-vue-components`, then add the resolver to your Vite configuration:
311
131
 
312
- ```vue
313
- <script setup lang="ts">
314
- import { ref } from 'vue'
315
- import { C_Tabs, defineTabs } from '@robot-admin/naive-ui-components/C_Tabs'
316
-
317
- const activeView = ref('basic')
318
- const views = defineTabs([
319
- { key: 'basic', label: 'Basic table', icon: 'mdi:table' },
320
- { key: 'tree', label: 'Tree table', icon: 'mdi:file-tree-outline' },
321
- ])
322
- </script>
323
-
324
- <template>
325
- <C_Tabs
326
- v-model="activeView"
327
- :items="views"
328
- type="segment"
329
- tabs-only
330
- />
331
- </template>
132
+ ```bash
133
+ bun add -d unplugin-vue-components
332
134
  ```
333
135
 
334
- | API | Description |
335
- | ----------------------------- | --------------------------------------------------------------------------------------------- |
336
- | `items` | Requires `key/label`; supports icons, badges, disabled/closable state, and `renderTab/render` |
337
- | `modelValue` / `defaultValue` | Controlled and uncontrolled state |
338
- | `type` / `size` / `placement` | `line/card/bar/segment`, common sizes and placements; defaults to `line/small/top` |
339
- | `tabsOnly` | Renders navigation only for table scenarios and query switches |
340
- | `beforeChange` | Sync/async guard; `false` or an error keeps the current tab |
341
- | Slots | `tab`, `pane`, and `pane-{key}`, each with item and active state |
342
- | Events | `change`, `close`, `add`, and standard `update:modelValue` |
343
-
344
- Use `C_ActionBar` as the single page/table action model instead of maintaining another toolbar abstraction. It defaults to compact `tiny` buttons with icons and a `6px` gap. Semantic keys such as `add`, `refresh`, `export`, `columns`, and `settings` supply consistent labels, icons, and button types; custom actions receive a neutral icon when none is provided. `show`, `disabled`, and `loading` accept booleans, refs, or getters; async handlers are guarded against duplicate clicks and receive automatic loading feedback. `C_Table` consumes the same actions through `toolbar.actions` / `toolbar.rightActions` while preserving its existing toolbar slots. Override `actionBar.size` or an individual action's `size` when a larger control is required:
345
-
346
136
  ```ts
347
- import { defineActions } from '@robot-admin/naive-ui-components/C_ActionBar'
348
- import { defineTableConfig } from '@robot-admin/naive-ui-components/C_Table'
349
-
350
- const actions = defineActions([
351
- { key: 'add', onClick: openCreate },
352
- { key: 'refresh', disabled: () => loading.value, onClick: refresh },
353
- { key: 'settings', group: 'right', onClick: openSettings },
354
- ])
355
-
356
- const config = defineTableConfig({
357
- toolbar: {
358
- actions,
359
- actionBar: { size: 'small' }, // optional; tiny by default
360
- },
361
- })
362
- ```
363
-
364
- For fixed-height tables, use `flex-height` with `wrapper-class`. The root wrapper allocates height between toolbars, the table and pagination. Give the wrapper or its parent a definite height; the component does not guess the page height. `wrapper-class` accepts Vue string, array and object class bindings, so scoped consumer styles can target the root directly. Existing `class`, `style` and native table attributes continue to reach the internal `NDataTable`.
365
-
366
- ```vue
367
- <template>
368
- <C_Table
369
- wrapper-class="inventory-table"
370
- flex-height
371
- :columns="columns"
372
- :data="rows"
373
- />
374
- </template>
375
- <style scoped>
376
- .inventory-table {
377
- height: 480px;
378
- }
379
- </style>
380
- ```
381
-
382
- Add `{ type: 'selection' }` explicitly. Receive keys and rows through `@selection-change="(keys, rows) => ..."`; use the public `clearSelection()` instance method instead of observing internal manager state.
383
-
384
- `C_Table` remains owned by its current Naive UI table implementation. A MachTable mode should render MachTable with its native columns, events, and instance API as a complete engine boundary rather than translating between the two engines. They only share engine-neutral page actions such as `C_ActionBar`.
385
-
386
- ### Recommended C_Map setup
387
-
388
- `C_Map` consistently accepts `[latitude, longitude]` for centers and markers. It converts coordinates to AMap's `[longitude, latitude]` order internally, filters invalid markers, and only removes markers owned by the component.
389
-
390
- ```vue
391
- <script setup lang="ts">
392
- import { ref } from 'vue'
393
- import {
394
- C_Map,
395
- type MapExpose,
396
- type MapMarker,
397
- } from '@robot-admin/naive-ui-components/C_Map'
398
- import '@robot-admin/naive-ui-components/C_Map/style.css'
399
-
400
- const mapRef = ref<MapExpose>()
401
- const markers: MapMarker[] = [
402
- { id: 'beijing', lat: 39.9042, lng: 116.4074, popup: 'Beijing' },
403
- ]
404
- </script>
405
-
406
- <template>
407
- <C_Map
408
- ref="mapRef"
409
- :markers="markers"
410
- fit-markers-on-init
411
- :tile-config="{ maxZoom: 18 }"
412
- @error="reportError"
413
- />
414
- <button @click="mapRef?.fitToMarkers({ maxZoom: 14 })">Fit markers</button>
415
- </template>
416
- ```
417
-
418
- The exposed instance provides `getMap()`, `refresh()`, and `fitToMarkers()` for tab visibility changes, container resizes, and custom business layers. OpenStreetMap mode normalizes both the Leaflet ESM namespace and CommonJS `default` shape internally, so hosts do not need whole-package prebundling for correctness. `map-type="amap"` requires `amap-key`; keys created after 2021-12-02 also require `:amap-security-config="{ serviceHost: '/_AMapService' }"` (recommended in production so the server proxy retains the security secret), or `{ securityJsCode: '...' }` for development only, as described by the [official AMap security guidance](https://lbs.amap.com/api/javascript-api-v2/guide/abc/jscode). The config is installed before the SDK script and conflicting keys on one page are rejected. The host CSP must also allow `https://webapi.amap.com` in `script-src`, with domain allowlists and quotas enforced in the AMap console.
419
-
420
- `C_Date`, `C_Time`, `C_Menu`, and `C_FormSearch` support standard `v-model`. Message/dialog providers are optional; application-wide feedback, locale, form defaults, and `table.defaults` can be supplied through plugin options.
421
-
422
- ### C_Captcha Server Verification
423
-
424
- The captcha trigger uses package-owned SVG status icons and does not depend on platform emoji or an online icon service. Idle, verifying, success, and error states keep consistent sizing and semantic colors. `C_Login` places the verification action before submit, keeps the action label explicit, and forwards `captcha-visible-change` so hosts can pause expensive background animation during puzzle interaction. Brand styling can be adjusted from the host with `--cc-height`, `--cc-radius`, `--cc-color`, `--cc-icon-color`, `--cc-bg`, `--cc-bg-hover`, `--cc-border`, `--cc-border-hover`, and `--cc-focus`, without reaching into internal DOM.
425
-
426
- The default local mode only proves that the browser-side puzzle interaction completed. It is not a security credential for login, payment, or other sensitive actions. In production, provide a `verifier` and enable `require-server-verification`. Timeout, cancellation, and stale attempts are handled by the component, and `success` is emitted only after approval by an independent server/provider challenge. Request `token` and `timestamp` values are client-generated telemetry and must never be trusted as proof by the server.
427
-
428
- For a permanently free, network-independent option, explicitly select the open-source MIT ALTCHA self-hosted provider. It is lazy-loaded only when selected, so the default puzzle path keeps its startup cost. ALTCHA mode always fails closed through server verification: the application server must issue fresh single-use challenges, verify the PoW payload, prevent replay, and rate-limit attempts while retaining all secrets server-side.
429
-
430
- ```vue
431
- <C_Captcha
432
- provider="altcha"
433
- challenge-url="/api/auth/captcha/challenge"
434
- :verifier="
435
- async ({ token, signal }) => {
436
- const response = await fetch('/api/auth/captcha/verify', {
437
- method: 'POST',
438
- headers: { 'content-type': 'application/json' },
439
- body: JSON.stringify({ payload: token }),
440
- signal,
441
- })
442
- return response.json() // { valid: boolean, token: 'single-use-server-token' }
443
- }
444
- "
445
- />
446
- ```
447
-
448
- ```vue
449
- <C_Captcha
450
- require-server-verification
451
- :verification-timeout="8000"
452
- :verifier="
453
- async ({ signal }) => {
454
- // This proof must come from a trusted server/provider challenge.
455
- const providerProof = await obtainTrustedCaptchaProof({ signal })
456
- const response = await fetch('/api/captcha/verify', {
457
- method: 'POST',
458
- headers: { 'content-type': 'application/json' },
459
- body: JSON.stringify({ providerProof }),
460
- signal,
461
- })
462
- return response.json() // { valid: boolean, token: 'server-issued-token' }
463
- }
464
- "
465
- @verify-error="reportError"
466
- />
467
- ```
468
-
469
- With `require-server-verification`, a successful response must include a server token. Server tokens should be short-lived, single-use, and bound to the current session or operation. `C_Login` forwards the same policy through `captchaProvider`, `captchaChallengeUrl`, `captchaVerifier`, `requireCaptchaServerVerification`, and `captchaVerificationTimeout`; its `submit` payload identifies the result through `captchaType` and `captchaVerifiedBy`. See [SECURITY.md](./SECURITY.md) for trust-boundary details.
470
-
471
- `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.
472
-
473
- ### Table loading
474
-
475
- `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`:
137
+ // vite.config.ts
138
+ import { defineConfig } from 'vite'
139
+ import vue from '@vitejs/plugin-vue'
140
+ import Components from 'unplugin-vue-components/vite'
141
+ import { RobotNaiveUiResolver } from '@robot-admin/naive-ui-components/resolver'
476
142
 
477
- ```vue
478
- <NSpin :show="loading" :size="48" :rotate="false">
479
- <template #icon><C_Loading /></template>
480
- <section>Page content</section>
481
- </NSpin>
143
+ export default defineConfig({
144
+ plugins: [
145
+ vue(),
146
+ Components({
147
+ resolvers: [RobotNaiveUiResolver({ importStyle: true })],
148
+ }),
149
+ ],
150
+ })
482
151
  ```
483
152
 
484
- ### 📋 Component List (55 Components)
485
-
486
- > 💡 All components provide **interactive live demos**. Visit the [Component Docs](https://www.tzagileteam.com/robot/components/preface) to try them out in real-time (rendered via iframe from Robot Admin production).
487
-
488
- #### Basic Components
489
-
490
- | Component | Description | External Deps |
491
- | ---------------- | ------------------------- | ----------------------------- |
492
- | `C_Icon` | Iconify icon wrapper | `@iconify/vue` |
493
- | `C_Loading` | Theme-aware SVG loading | - |
494
- | `C_PageLoading` | Theme-aware page loading | - |
495
- | `C_Code` | Code highlighting | `highlight.js` |
496
- | `C_Barcode` | Barcode generator | `@chenfengyuan/vue-barcode` |
497
- | `C_Captcha` | Puzzle / ALTCHA captcha | `vue3-puzzle-vcode`, `altcha` |
498
- | `C_Cascade` | Cascade panel selector | - |
499
- | `C_Guide` | User guide / tour | `driver.js` |
500
- | `C_Progress` | Enhanced progress bar | - |
501
- | `C_Steps` | Step bar | - |
502
- | `C_ActionBar` | Action button bar | - |
503
- | `C_Theme` | Theme switcher | - |
504
- | `C_Language` | Language switcher | - |
505
- | `C_Date` | Enhanced date picker | - |
506
- | `C_City` | Province / city selector | - |
507
- | `C_Breadcrumb` | Breadcrumb navigation | - |
508
- | `C_Menu` | Navigation menu | - |
509
- | `C_Tabs` | Data-driven scenario tabs | - |
510
- | `C_TagsView` | Tab-based navigation | - |
511
- | `C_GlobalSearch` | Global search panel | - |
512
- | `C_AvatarGroup` | Avatar group display | - |
513
- | `C_OrgChart` | Organization chart | - |
514
- | `C_Skeleton` | Skeleton placeholder | - |
515
-
516
- #### Content & Editor Components
517
-
518
- | Component | Description | External Deps |
519
- | ----------------- | ---------------------------- | ------------------------- |
520
- | `C_Editor` | Rich text editor | `@wangeditor-next/editor` |
521
- | `C_Markdown` | Markdown editor/preview | `md-editor-v3` |
522
- | `C_FormulaEditor` | Formula editor (safe parser) | Built in |
523
- | `C_Signature` | Electronic signature | - |
524
- | `C_QRCode` | QR code generator | `qrcode` |
525
- | `C_ImageCropper` | Image cropper | `vue-cropper` |
526
-
527
- #### Data Display Components
528
-
529
- | Component | Description | External Deps |
530
- | ---------------- | -------------------------------------------- | -------------------------- |
531
- | `C_Table` | Advanced data table (CRUD/inline edit/print) | `print-js`, `html2canvas` |
532
- | `C_Map` | Map component (OSM/AMap) | `leaflet` |
533
- | `C_VtableGantt` | Gantt chart | `@visactor/vtable-gantt` |
534
- | `C_AntV` | Graph editor (ER/BPMN/UML) | `@antv/x6`, `html2canvas` |
535
- | `C_WaterFall` | Waterfall layout | - |
536
- | `C_FullCalendar` | Calendar events | `@fullcalendar/*` |
537
- | `C_VideoPlayer` | Video player (HLS/subtitles/bookmarks) | `xgplayer`, `xgplayer-hls` |
538
- | `C_AudioPlayer` | Audio player (waveform/progress/playlist) | - |
539
- | `C_FilePreview` | File preview (PDF/Word/Excel) | `xlsx`, `mammoth` |
540
- | `C_Timeline` | Timeline (vertical/horizontal/collapsible) | - |
541
-
542
- Image/calendar behavior notes: `C_ImageCropper` flips the actual source and resets the current crop position; load/export failures emit `error: Error`. `C_Signature` readonly mode blocks user interaction but keeps exposed methods available for loading saved data. Its SVG export embeds the rendered raster canvas. `C_QRCode` uses the same raster-in-SVG approach when a logo is present so preview and export match. `C_FullCalendar` creates same-day events in local calendar time. `C_WaterFall` relayouts from actual image aspect ratios; give each item a stable unique `id`.
543
-
544
- #### Form & Layout Components
545
-
546
- | Component | Description | External Deps |
547
- | ----------------- | ------------------------------------------------- | -------------------- |
548
- | `C_Form` | Dynamic form engine (Grid/Tabs/Steps/Card layout) | - |
549
- | `C_FormModal` | Data-driven create/edit form modal | - |
550
- | `C_FormSearch` | Search form | - |
551
- | `C_CollapsePanel` | Collapse panel | - |
552
- | `C_SplitPane` | Split pane | - |
553
- | `C_Draggable` | Drag & drop sorting | `vue-draggable-plus` |
554
- | `C_Tree` | Advanced tree control | - |
555
- | `C_Time` | Enhanced time picker | - |
556
- | `C_Cron` | Cron expression editor | - |
557
- | `C_Transfer` | Transfer / shuttle box | - |
558
-
559
- #### Interactive & Business Components
560
-
561
- | Component | Description | External Deps |
562
- | --------------- | --------------------------------------------- | ------------- |
563
- | `C_Chat` | Chat (contacts / message bubbles / input box) | - |
564
- | `C_ContextMenu` | Context menu (nested / shortcuts / danger) | - |
565
- | `C_Login` | Login panel (5 modes / captcha / remember me) | - |
566
-
567
- #### Workflow & Notification Components
568
-
569
- | Component | Description | External Deps |
570
- | ---------------------- | ---------------------------------------- | ---------------- |
571
- | `C_WorkFlow` | Workflow editor (approval/CC/conditions) | `@vue-flow/core` |
572
- | `C_NotificationCenter` | Notification center (WebSocket/polling) | - |
573
- | `C_Upload` | Large file upload (chunked/resumable) | `spark-md5` |
574
-
575
- ### 🔌 Dependency Notes
576
-
577
- `C_FilePreview` accepts HTTPS URLs and same-origin HTTP URLs for local development. Script/data URLs, credential-bearing URLs, and cross-origin plain HTTP are rejected. `autoPreview` opens a supplied file automatically, and changing the source refreshes an open preview. Repeated previews release the previous PDF object URL and ignore stale loading results. Excel values `0` and `false` remain intact.
578
-
579
- `C_AntV` keeps the public BPMN model as `{ nodes, flows }`. It converts that model to X6 cells internally and restores node positions, types, properties, and flow conditions in `data-change` and `getData()`. BPMN and UML load built-in samples only when `data` is absent; an explicit empty model produces an empty canvas.
580
-
581
- `C_VtableGantt` merges presets and `options` without dropping untouched nested settings, replaces arrays as a whole, and ignores prototype-related keys. Its fullscreen button reflects the actual fullscreen state of that Gantt container.
582
-
583
- `C_AudioPlayer` enters the playing state and emits `play` only after the browser accepts `play()`. A rejected autoplay emits `error`, and an empty playlist cannot emit a false play event. Mute, playlist tracks, and seeking are keyboard operable.
584
-
585
- `C_CollapsePanel` and `C_TagsView` validate persisted data before restoring it, so corrupt or outdated JSON cannot break initialization. Persisted tags restore only in-app paths, and special characters in a path are no longer interpolated into CSS selectors.
586
-
587
- `C_Table` column settings restore only valid keys, visibility, widths, and fixed directions; corrupt `persistKey` storage falls back to the supplied columns. Settings operate on local column copies rather than mutating caller-owned objects. `C_Upload` copies its initial file list before managing it, applies the same `accept` filter to picker, drop, and paste input, labels image actions for keyboard users, and shows per-file progress during concurrent hashing. Cancelling a chunked upload during resume lookup, an active request, or merging cannot start later requests or emit stale completion; a custom request's `abort()` releases the pending chunk even if it never calls back.
588
-
589
- `C_WorkFlow` loads the supplied `modelValue` on first render and returns isolated snapshots from `getCurrentWorkflowData()`, `save`, `change`, and `node-click`, so callers cannot accidentally mutate its internal nodes. Editing conditions cannot change canvas data before Save, and incomplete conditions are not silently dropped. `readonly` blocks dragging, connecting, configuring, adding/removing, and saving while leaving preview, validation, and fit-to-view available. Node and condition IDs remain unique when created in the same tick.
590
-
591
- Type verification covers TypeScript source, Vue SFC templates, and consumer examples built against the package. `C_Table` summary rendering expects an object keyed by column (`{ columnKey: { value, colSpan? } }`). `C_FormSearch` preserves existing numeric timestamp ranges and also supports formatted string ranges, binding each to the matching Naive UI value API.
592
-
593
- Runtime component dependencies are declared by this package and resolved automatically. Every consumer needs:
153
+ The resolver uses component subpaths by default. `importStyle` defaults to `false`, so enable automatic CSS explicitly. Both `true` and `'full'` load full component styles. `'base'` excludes built-in rich-text editor styles for `C_Form` / `C_Table`; other components retain full styles. Choose base styles only when not using built-in rich-text fields.
594
154
 
595
- ```bash
596
- bun add vue naive-ui
597
- ```
155
+ Each component CSS entry includes styles for its composed components. Manual imports can use `C_Form/base.css` and `C_Table/base.css`; full styles also have `full.css` aliases. Load heavy editors, flows, maps and media with their business routes. See [import strategies](./docs/guides/usage.en.md#import-strategies) for details and global registration examples.
598
156
 
599
- Install optional peers per feature: `vue-router` for `C_Breadcrumb`/`C_TagsView`, and `sortablejs` for C_Table row/column dragging. Subpath imports do not require unrelated optional peers. The formula editor uses a bounded built-in parser and does not execute dynamic JavaScript.
157
+ Minimal consumer builds reduced initial JS gzip by 36.1% for the base form and 34.6% for the display table, including Vue and Naive UI. See the [measurement and automated budgets](./docs/performance-0.15.0.md) (Chinese) for scope and limitations.
600
158
 
601
- ### 🏗️ Build Architecture
159
+ Root imports aggregate navigation components and require `vue-router` at runtime. Applications without it should use component subpaths; their unrelated optional peers are not required.
602
160
 
603
- #### Six-stage Build Pipeline
161
+ ## Documentation
604
162
 
605
- ```
606
- bun run build
607
- ├── 1. tsdown → Multi-entry bundling (55 components ESM/CJS/DTS)
608
- ├── 2. sass CLI → Compile the shared-variable entry → global-scss.css
609
- ├── 3. merge-css.js → Merge Vue-compiled SFC CSS + global variables → style.css
610
- ├── 4. gen-exports.js → Auto-generate package.json exports map
611
- ├── 5. check:dist → Validate root, subpath, SSR, and DTS public exports
612
- └── 6. check:size → Enforce full/base CSS and package-size budgets
613
- ```
163
+ | Document | Contents |
164
+ | ------------------------------------------------------- | --------------------------------------------------------------------------------------- |
165
+ | [Architecture and isolation](./docs/architecture.en.md) | Dependency boundaries, instance ownership and the independent Element Plus roadmap |
166
+ | [Component catalog](./docs/components.en.md) | All 55 components, dependencies and behavior boundaries |
167
+ | [Usage guide](./docs/guides/usage.en.md) | Imports, forms/tables, Cron/formulas, maps, onboarding, captcha, login and page loading |
168
+ | [Development and build](./docs/engineering.en.md) | Source structure, six-stage build, adding components, checks and releases |
169
+ | [Brand assets](./docs/assets/README.md) | Robot family logo, editable SVG sources and high-resolution PNGs |
170
+ | [Changelog](./CHANGELOG.md) | Releases and compatibility changes |
171
+ | [Security policy](./SECURITY.md) | Vulnerability reporting and maintenance policy |
614
172
 
615
- #### Key Technical Details
173
+ The [2026-10-18 scan record](./docs/security-scan-2026-10-18.md) documents two outstanding upstream advisories; the [2026-10-06 record](./docs/security-scan-2026-10-06.md) is a historical archive. Both are in Chinese. Run `bun run check:audit` to assess the current dependency state.
616
174
 
617
- - **Build engine**: [tsdown](https://github.com/rolldown/tsdown) (Rolldown-based), 55 independent entries compiled in parallel
618
- - **SCSS processing**: Custom `scssTransformPlugin` compiles SFC SCSS within the Rolldown pipeline; standalone Sass CLI only compiles the shared-variable entry
619
- - **CSS merging**: Post-build merges Vue scoped-compiled per-chunk CSS with shared variables into a single `style.css`, avoiding duplicate styles and leaked raw `:deep()` selectors
620
- - **Type exports**: Unified `export *` barrel pattern with auto-generated `.d.ts`
621
- - **Subpath exports**: `gen-exports.js` auto-scans `dist/` and writes the `exports` field in `package.json`
622
- - **Export conflict detection**: `check-export-conflicts.js` ensures no naming collisions between components
623
- - **Artifact entry validation**: `check-dist-entries.js` prevents internal chunks from replacing root declarations and verifies component utility subpath types
624
- - **Package contract validation**: blocks Naive UI internal type paths, hidden optional installs, and plugin console side effects
625
- - **Size budgets**: `check-size-budget.js` prevents accidental growth of global, C_Form/C_Table, and total dist output
175
+ ## Local development
626
176
 
627
- #### Build Output
628
-
629
- ```
630
- dist/
631
- ├── index.js / index.cjs / index.d.ts # Main entry
632
- ├── C_Form.js / C_Form.cjs / C_Form.d.ts # Subpath entries (55 components)
633
- ├── C_Form.base.css / C_Form.full.css # Base/full style tiers
634
- ├── C_Table.base.css / C_Table.full.css # Base/full style tiers
635
- ├── style.css # Merged full styles
636
- └── [chunk].js # Shared code chunks
637
- ```
638
-
639
- ### 🔧 Development
640
-
641
- The environment baseline is Node.js 20.19.0+ and Bun 1.3.14. `.node-version`, `packageManager`, `engines`, and the frozen lockfile keep local and CI installs aligned.
177
+ Maintaining this repository requires **Node.js ≥20.19.0** and **Bun ≥1.3.14**. The package manager is pinned to `bun@1.3.14`; CI uses `.node-version` and the frozen lockfile.
642
178
 
643
179
  ```bash
644
- bun install --frozen-lockfile # Install exactly from the lockfile
645
- bun run dev # Dev mode (SCSS watch + tsdown watch)
646
- bun run build # Full build
647
- bun run build:scss # Compile global SCSS only
648
- bun run build:css # Merge fresh tsdown CSS chunks; safely skips a finalized dist
649
- bun run build:exports # Generate exports map only
650
- bun run check:exports # Check export naming conflicts
651
- bun run check:dist # Validate built JS / DTS public entries
652
- bun run check:package # Validate dependencies, exports, and public source boundaries
653
- bun run check:quality # Prevent any, console, and type-suppression debt regressions
654
- bun run check:audit # Audit direct and transitive dependency vulnerabilities
655
- bun run check:size # Enforce publish artifact size budgets
656
- bun run type-check # TypeScript type checking
657
- bun run test # Run Bun unit tests
658
- bun run lint:check # Required Oxlint correctness checks
659
- bun run lint:eslint # Audit the existing ESLint rule backlog
660
- bun run verify # Type, test, export, and build verification
180
+ git clone https://github.com/ChenyCHENYU/naive-ui-components.git
181
+ cd naive-ui-components
182
+ bun install --frozen-lockfile
183
+ bun run dev
661
184
  ```
662
185
 
663
- #### Project Structure
664
-
665
- ```
666
- naive-ui-components/
667
- ├── src/
668
- │ ├── index.ts # Library entry (global registration + export * barrel)
669
- │ ├── styles/
670
- │ │ ├── variables.scss # CSS variables (--c-*)
671
- │ │ └── global.scss # Auto-generated shared-variable entry
672
- │ ├── components/
673
- │ │ └── C_[Name]/
674
- │ │ ├── index.vue # Main component file
675
- │ │ ├── index.ts # Barrel export
676
- │ │ ├── index.scss # Component styles
677
- │ │ ├── types.ts # Type definitions
678
- │ │ ├── constants.ts # Constants
679
- │ │ ├── data.ts # Static data
680
- │ │ ├── composables/ # Composable functions
681
- │ │ ├── components/ # Sub-components
682
- │ │ └── layouts/ # Layout variants (C_Form/C_AntV)
683
- │ ├── plugins/ # highlight.js and other plugins
684
- │ └── utils/ # Utility functions
685
- ├── scripts/
686
- │ ├── gen-global-scss.js # Generate global.scss (shared variables only)
687
- │ ├── watch-global-scss.js # Dev mode SCSS watcher
688
- │ ├── merge-css.js # Merge CSS artifacts
689
- │ ├── gen-exports.js # Auto-generate package.json exports
690
- │ └── check-export-conflicts.js # Export naming conflict detection
691
- ├── types/
692
- │ └── env.d.ts # .vue / .scss module declarations
693
- ├── tsdown.config.ts # Build config (multi-entry + SCSS plugin + Vue plugin)
694
- └── tsconfig.json
695
- ```
696
-
697
- #### Adding a New Component
698
-
699
- 1. Create `src/components/C_NewComponent/` directory
700
- 2. Write `index.vue`, `index.ts` (barrel), `types.ts`
701
- 3. Add `export * from './components/C_NewComponent'` in `src/index.ts`
702
- 4. Run `bun run build` — build scripts will auto-generate subpath entries and exports mapping
703
-
704
- #### Publishing
186
+ `dev` watches library builds and shared SCSS. Interactive demonstrations are provided by Robot Admin, which consumes the library.
705
187
 
706
188
  ```bash
707
- bun run changeset # Record changes and release level
708
- bun run version # Update package version and CHANGELOG
709
- bun run verify # Run all pre-publish checks
710
- bun run release # Publish pending Changesets releases
189
+ bun run verify # Lint, types, logic/component tests, exports, build and consumer types
190
+ bun run check:audit # Separate dependency audit; CI runs this before verify
711
191
  ```
712
192
 
713
- The GitHub changelog generator requires `GITHUB_TOKEN` for `bun run version`; never commit the token. On Windows, if `bun run release` stalls while npm repeats `prepublishOnly`, first confirm `bun run verify` succeeds, then publish from PowerShell with `$env:npm_config_ignore_scripts='true'; bun run release`. This skips only the repeated lifecycle check, not the prerequisite verification.
714
-
715
- ## 📄 License
193
+ See [development and build](./docs/engineering.en.md) for individual checks and publishing. The CI workflow is defined in [ci.yml](./.github/workflows/ci.yml).
716
194
 
717
- MIT License
195
+ ## Robot ecosystem
718
196
 
719
- ---
197
+ | Project | Responsibility |
198
+ | --------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
199
+ | **Naive UI Components** | Independently consumable Vue 3 business components and composables |
200
+ | [Robot Admin](https://github.com/ChenyCHENYU/Robot_Admin) | PC Web application template, business pages and interactive demos |
201
+ | [robot-admin-packages](https://github.com/ChenyCHENYU/robot-admin-packages) | Requests, validation, themes, layouts, directives, file utilities and Git tooling |
202
+ | [Robot Cloud](https://github.com/ChenyCHENYU/Robot_Cloud) | Authentication, company context, system management and authorization services |
720
203
 
721
- ## 🔗 Links
204
+ ## License
722
205
 
723
- - [Component Docs with Interactive Demos](https://www.tzagileteam.com/robot/components/preface)
724
- - [Robot Admin Main Project](https://github.com/ChenyCHENYU/robot_admin)
725
- - [Robot Admin Live Demo](https://www.robotadmin.cn)
726
- - [GitHub](https://github.com/ChenyCHENYU/naive-ui-components)
727
- - [NPM](https://www.npmjs.com/package/@robot-admin/naive-ui-components)
728
-
729
- ### C_Login form extension
730
-
731
- The `password-fields` slot appears below the password field and exposes `username` and `loading`. The synchronous `username-change` event covers initial defaults, remembered usernames and input changes. Use `submitDisabled` to block clicks and Enter while application fields are incomplete. Credential inputs are disabled while `loading`. Workspace discovery and authorization remain in the host application.
732
-
733
- ### Page navigation loading
734
-
735
- Connect navigation lifecycles through `start()` / `finish(id)`. The component handles visuals, themes and reduced motion. A 160ms default delay avoids flashes; stale completions cannot hide a newer task.
736
-
737
- ```vue
738
- <C_PageLoading :show="loading.visible.value" />
739
- ```
740
-
741
- ```ts
742
- import { createPageLoading } from '@robot-admin/naive-ui-components/C_PageLoading'
743
- const loading = createPageLoading({ delay: 160 })
744
- const id = loading.start()
745
- // After completion, cancellation or failure
746
- loading.finish(id)
747
- ```
206
+ [MIT License](./LICENSE) · Made by [CHENY](https://github.com/ChenyCHENYU)