@robot-admin/naive-ui-components 0.11.8 → 0.13.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.
- package/CHANGELOG.md +26 -0
- package/README.md +172 -29
- package/README_EN.md +171 -28
- package/SECURITY.md +1 -0
- package/dist/C_ActionBar.cjs +1 -1
- package/dist/C_ActionBar.css +67 -67
- package/dist/C_ActionBar.d.cts +2 -2
- package/dist/C_ActionBar.d.ts +2 -2
- package/dist/C_ActionBar.js +1 -1
- package/dist/C_ActionBar2.cjs +1 -1
- package/dist/C_ActionBar2.js +1 -1
- package/dist/C_AntV.css +70 -70
- package/dist/C_AntV2.cjs +3 -3
- package/dist/C_AntV2.js +3 -3
- package/dist/C_AudioPlayer.css +81 -66
- package/dist/C_AudioPlayer.d.cts +1 -1
- package/dist/C_AudioPlayer.d.ts +1 -1
- package/dist/C_AudioPlayer2.cjs +1 -1
- package/dist/C_AudioPlayer2.js +1 -1
- package/dist/C_AvatarGroup.css +40 -25
- package/dist/C_AvatarGroup.d.cts +1 -1
- package/dist/C_AvatarGroup.d.ts +1 -1
- package/dist/C_AvatarGroup2.cjs +1 -1
- package/dist/C_AvatarGroup2.js +1 -1
- package/dist/C_Barcode.css +6 -6
- package/dist/C_Barcode.d.cts +1 -1
- package/dist/C_Barcode.d.ts +1 -1
- package/dist/C_Barcode2.cjs +1 -1
- package/dist/C_Barcode2.js +1 -1
- package/dist/C_Breadcrumb.css +14 -14
- package/dist/C_Breadcrumb.d.cts +1 -1
- package/dist/C_Breadcrumb.d.ts +1 -1
- package/dist/C_Breadcrumb2.cjs +1 -1
- package/dist/C_Breadcrumb2.js +1 -1
- package/dist/C_Captcha.cjs +1 -1
- package/dist/C_Captcha.css +193 -51
- package/dist/C_Captcha.d.cts +2 -3
- package/dist/C_Captcha.d.ts +2 -3
- package/dist/C_Captcha.js +1 -1
- package/dist/C_Captcha2.cjs +1 -1
- package/dist/C_Captcha2.js +1 -1
- package/dist/C_Cascade.css +2 -2
- package/dist/C_Cascade.d.cts +1 -1
- package/dist/C_Cascade.d.ts +1 -1
- package/dist/C_Cascade2.cjs +1 -1
- package/dist/C_Cascade2.js +1 -1
- package/dist/C_Chat.css +96 -78
- package/dist/C_Chat.d.cts +1 -1
- package/dist/C_Chat.d.ts +1 -1
- package/dist/C_Chat2.cjs +1 -1
- package/dist/C_Chat2.js +1 -1
- package/dist/C_City.css +52 -28
- package/dist/C_City.d.cts +1 -1
- package/dist/C_City.d.ts +1 -1
- package/dist/C_City2.cjs +1 -1
- package/dist/C_City2.js +1 -1
- package/dist/C_Code.css +48 -42
- package/dist/C_Code.d.cts +1 -1
- package/dist/C_Code.d.ts +1 -1
- package/dist/C_Code2.cjs +1 -1
- package/dist/C_Code2.js +1 -1
- package/dist/C_CollapsePanel.css +14 -14
- package/dist/C_CollapsePanel2.cjs +1 -1
- package/dist/C_CollapsePanel2.js +1 -1
- package/dist/C_ContextMenu.css +14 -14
- package/dist/C_ContextMenu.d.cts +1 -1
- package/dist/C_ContextMenu.d.ts +1 -1
- package/dist/C_ContextMenu2.cjs +1 -1
- package/dist/C_ContextMenu2.js +1 -1
- package/dist/C_Cron.css +94 -55
- package/dist/C_Cron2.cjs +1 -1
- package/dist/C_Cron2.js +1 -1
- package/dist/C_Date.d.cts +1 -1
- package/dist/C_Date.d.ts +1 -1
- package/dist/C_Date2.cjs +1 -1
- package/dist/C_Date2.js +1 -1
- package/dist/C_Draggable.css +48 -48
- package/dist/C_Draggable2.cjs +1 -1
- package/dist/C_Draggable2.js +1 -1
- package/dist/C_Editor.css +13 -14
- package/dist/C_Editor.d.cts +1 -1
- package/dist/C_Editor.d.ts +1 -1
- package/dist/C_Editor2.cjs +1 -1
- package/dist/C_Editor2.js +1 -1
- package/dist/C_FilePreview.css +18 -18
- package/dist/C_FilePreview2.cjs +1 -1
- package/dist/C_FilePreview2.js +1 -1
- package/dist/C_Form.base.css +36 -36
- package/dist/C_Form.css +49 -50
- package/dist/C_Form2.cjs +1 -1
- package/dist/C_Form2.js +1 -1
- package/dist/C_FormModal.cjs +1 -0
- package/dist/C_FormModal.css +41 -0
- package/dist/C_FormModal.d.cts +2 -0
- package/dist/C_FormModal.d.ts +3 -0
- package/dist/C_FormModal.js +1 -0
- package/dist/C_FormModal2.cjs +1 -0
- package/dist/C_FormModal2.js +1 -0
- package/dist/C_FormSearch.css +45 -45
- package/dist/C_FormSearch2.cjs +1 -1
- package/dist/C_FormSearch2.js +1 -1
- package/dist/C_FormulaEditor.css +94 -55
- package/dist/C_FormulaEditor2.cjs +2 -2
- package/dist/C_FormulaEditor2.js +2 -2
- package/dist/C_FullCalendar.css +8 -1
- package/dist/C_FullCalendar2.cjs +1 -1
- package/dist/C_FullCalendar2.js +1 -1
- package/dist/C_GlobalSearch2.cjs +1 -1
- package/dist/C_GlobalSearch2.js +1 -1
- package/dist/C_Guide.css +14 -14
- package/dist/C_Guide2.cjs +1 -1
- package/dist/C_Guide2.js +1 -1
- package/dist/C_Icon.css +14 -14
- package/dist/C_Icon2.cjs +1 -1
- package/dist/C_Icon2.js +1 -1
- package/dist/C_ImageCropper.css +22 -22
- package/dist/C_ImageCropper2.cjs +1 -1
- package/dist/C_ImageCropper2.js +1 -1
- package/dist/C_Language.css +14 -14
- package/dist/C_Language2.cjs +1 -1
- package/dist/C_Language2.js +1 -1
- package/dist/C_Login.css +232 -149
- package/dist/C_Login2.cjs +1 -1
- package/dist/C_Login2.js +1 -1
- package/dist/C_Map.css +3 -3
- package/dist/C_Map2.cjs +1 -1
- package/dist/C_Map2.js +1 -1
- package/dist/C_Markdown.css +35 -35
- package/dist/C_Markdown2.cjs +1 -1
- package/dist/C_Markdown2.js +1 -1
- package/dist/C_Menu.d.cts +1 -1
- package/dist/C_Menu2.cjs +1 -1
- package/dist/C_Menu2.js +1 -1
- package/dist/C_NotificationCenter.css +30 -30
- package/dist/C_NotificationCenter2.cjs +1 -1
- package/dist/C_NotificationCenter2.js +1 -1
- package/dist/C_OrgChart.css +4 -0
- package/dist/C_OrgChart2.cjs +1 -1
- package/dist/C_OrgChart2.js +1 -1
- package/dist/C_Progress2.cjs +1 -1
- package/dist/C_Progress2.js +1 -1
- package/dist/C_QRCode.css +8 -8
- package/dist/C_QRCode2.cjs +1 -1
- package/dist/C_QRCode2.js +1 -1
- package/dist/C_Signature.css +14 -14
- package/dist/C_Signature2.cjs +1 -1
- package/dist/C_Signature2.js +1 -1
- package/dist/C_Skeleton2.cjs +1 -1
- package/dist/C_Skeleton2.js +1 -1
- package/dist/C_SplitPane.css +39 -39
- package/dist/C_SplitPane2.cjs +1 -1
- package/dist/C_SplitPane2.js +1 -1
- package/dist/C_Steps.css +48 -38
- package/dist/C_Steps2.cjs +1 -1
- package/dist/C_Steps2.js +1 -1
- package/dist/C_Table.base.css +160 -160
- package/dist/C_Table.cjs +1 -1
- package/dist/C_Table.css +173 -174
- package/dist/C_Table.d.ts +4 -3
- package/dist/C_Table.js +1 -1
- package/dist/C_Tabs.cjs +1 -0
- package/dist/C_Tabs.css +1 -0
- package/dist/C_Tabs.d.cts +2 -0
- package/dist/C_Tabs.d.ts +2 -0
- package/dist/C_Tabs.js +1 -0
- package/dist/C_TagsView.css +52 -52
- package/dist/C_TagsView2.cjs +1 -1
- package/dist/C_TagsView2.js +1 -1
- package/dist/C_Theme.css +14 -14
- package/dist/C_Theme2.cjs +1 -1
- package/dist/C_Theme2.js +1 -1
- package/dist/C_Time.css +4 -4
- package/dist/C_Time2.cjs +1 -1
- package/dist/C_Time2.js +1 -1
- package/dist/C_Timeline.css +76 -58
- package/dist/C_Timeline2.cjs +1 -1
- package/dist/C_Timeline2.js +1 -1
- package/dist/C_Transfer.css +51 -51
- package/dist/C_Transfer2.cjs +1 -1
- package/dist/C_Transfer2.js +1 -1
- package/dist/C_Tree.css +35 -32
- package/dist/C_Tree2.cjs +1 -1
- package/dist/C_Tree2.js +1 -1
- package/dist/C_Upload.css +53 -50
- package/dist/C_Upload2.cjs +1 -1
- package/dist/C_Upload2.js +1 -1
- package/dist/C_VideoPlayer.css +17 -13
- package/dist/C_VideoPlayer2.cjs +2 -2
- package/dist/C_VideoPlayer2.js +2 -2
- package/dist/C_VtableGantt.css +19 -19
- package/dist/C_VtableGantt2.cjs +1 -1
- package/dist/C_VtableGantt2.js +1 -1
- package/dist/C_WaterFall.css +19 -15
- package/dist/C_WaterFall2.cjs +1 -1
- package/dist/C_WaterFall2.js +1 -1
- package/dist/C_WorkFlow.css +123 -123
- package/dist/C_WorkFlow2.cjs +1 -1
- package/dist/C_WorkFlow2.js +1 -1
- package/dist/constants.d.cts +2 -2
- package/dist/constants.d.ts +2 -2
- package/dist/constants2.d.cts +3 -3
- package/dist/constants2.d.ts +3 -3
- package/dist/constants3.d.cts +8 -4
- package/dist/constants3.d.ts +8 -4
- package/dist/constants4.d.cts +6 -6
- package/dist/constants4.d.ts +6 -6
- package/dist/constants5.d.cts +2 -2
- package/dist/constants5.d.ts +2 -2
- package/dist/data.d.cts +108 -0
- package/dist/data.d.ts +108 -0
- package/dist/data2.cjs +1 -0
- package/dist/data2.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +49 -49
- package/dist/index.d.ts +51 -49
- package/dist/index.js +1 -1
- package/dist/index.vue.d.cts +74 -69
- package/dist/index.vue.d.ts +74 -69
- package/dist/index10.vue.d.cts +80 -39
- package/dist/index10.vue.d.ts +68 -77
- package/dist/index11.vue.d.cts +68 -77
- package/dist/index11.vue.d.ts +54 -69
- package/dist/index12.vue.d.cts +54 -69
- package/dist/index12.vue.d.ts +52 -58
- package/dist/index13.vue.d.cts +52 -58
- package/dist/index13.vue.d.ts +1 -1
- package/dist/index14.vue.d.cts +1 -1
- package/dist/index14.vue.d.ts +14 -47
- package/dist/index15.vue.d.cts +14 -47
- package/dist/index16.vue.d.ts +15 -12
- package/dist/index17.vue.d.cts +15 -12
- package/dist/index17.vue.d.ts +4 -4
- package/dist/index18.vue.d.cts +4 -4
- package/dist/index18.vue.d.ts +2 -2
- package/dist/index19.vue.d.cts +1 -1
- package/dist/index19.vue.d.ts +1 -1
- package/dist/index2.vue.d.cts +70 -65
- package/dist/index2.vue.d.ts +70 -65
- package/dist/index20.vue.d.cts +1 -1
- package/dist/index20.vue.d.ts +1 -1
- package/dist/index24.vue.d.cts +3 -3
- package/dist/index24.vue.d.ts +3 -3
- package/dist/index25.vue.d.cts +1 -1
- package/dist/index25.vue.d.ts +1 -1
- package/dist/index26.vue.d.cts +5 -5
- package/dist/index26.vue.d.ts +5 -5
- package/dist/index27.vue.d.cts +1 -1
- package/dist/index27.vue.d.ts +1 -1
- package/dist/index3.vue.d.cts +30 -80
- package/dist/index3.vue.d.ts +30 -80
- package/dist/index4.vue.d.cts +130 -30
- package/dist/index4.vue.d.ts +22 -30
- package/dist/index5.vue.d.cts +18 -126
- package/dist/index5.vue.d.ts +22 -19
- package/dist/index6.vue.d.cts +22 -19
- package/dist/index6.vue.d.ts +117 -22
- package/dist/index7.vue.d.cts +117 -22
- package/dist/index7.vue.d.ts +17 -110
- package/dist/index8.vue.d.cts +17 -110
- package/dist/index8.vue.d.ts +37 -24
- package/dist/index9.vue.d.cts +37 -24
- package/dist/index9.vue.d.ts +80 -39
- package/dist/mapUtils.d.cts +2 -2
- package/dist/mapUtils.d.ts +2 -2
- package/dist/presets.d.cts +96 -0
- package/dist/presets.d.ts +96 -0
- package/dist/resolver.cjs +1 -1
- package/dist/resolver.d.cts +1 -1
- package/dist/resolver.d.ts +1 -1
- package/dist/resolver.js +1 -1
- package/dist/style.css +1735 -1400
- package/dist/useCalendarEvents.d.cts +23 -18
- package/dist/useCalendarEvents.d.ts +23 -18
- package/dist/useCollapsePanel.d.cts +4 -3
- package/dist/useCollapsePanel.d.ts +4 -3
- package/dist/useCropperCore.d.cts +32 -17
- package/dist/useCropperCore.d.ts +32 -17
- package/dist/useDraggableLayout.d.cts +2 -2
- package/dist/useDraggableLayout.d.ts +2 -2
- package/dist/useDynamicFormState.d.cts +7 -2
- package/dist/useDynamicFormState.d.ts +7 -2
- package/dist/useEdgeInteraction.d.cts +20 -19
- package/dist/useEdgeInteraction.d.ts +20 -19
- package/dist/useFullscreen.d.cts +6 -6
- package/dist/useFullscreen.d.ts +6 -6
- package/dist/useInfiniteScroll.d.cts +1 -1
- package/dist/useInfiniteScroll.d.ts +1 -1
- package/dist/useQRCode.d.cts +5 -4
- package/dist/useQRCode.d.ts +5 -4
- package/dist/useSearchState.d.cts +9 -9
- package/dist/useSearchState.d.ts +9 -9
- package/dist/useSignatureHistory.d.cts +18 -10
- package/dist/useSignatureHistory.d.ts +18 -10
- package/dist/useSplitResize.d.cts +7 -7
- package/dist/useSplitResize.d.ts +7 -7
- package/dist/useTableQuery.cjs +3 -3
- package/dist/useTableQuery.d.cts +12 -5
- package/dist/useTableQuery.d.ts +12 -5
- package/dist/useTableQuery.js +3 -3
- package/dist/useTimeSelection.d.cts +6 -3
- package/dist/useTimeSelection.d.ts +6 -3
- package/dist/useTreeOperations.d.cts +8 -8
- package/dist/useTreeOperations.d.ts +8 -8
- package/dist/useWorkflowValidation.d.cts +6 -4
- package/dist/useWorkflowValidation.d.ts +6 -4
- package/dist/verification.d.cts +71 -6
- package/dist/verification.d.ts +71 -6
- package/package.json +5 -3
- package/dist/types.d.ts +0 -58
- package/dist/types2.d.cts +0 -58
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @robot-admin/naive-ui-components
|
|
2
2
|
|
|
3
|
+
## 0.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fc872e4: Release C_GlobalSearch's keyboard shortcut listener on unmount.
|
|
8
|
+
|
|
9
|
+
Keep CRUD delete feedback consistent with structured `{ data, error }` results and make tree `defaultExpandAll` work with controlled row expansion. Restore C_Table summaries in Naive UI's keyed-row format, validate persisted column settings, and avoid mutating caller-owned columns. Expose submit state and action in C_Form step slots, and harden C_FilePreview URL, auto-preview, loading, object-URL, and spreadsheet value handling. Tighten C_Icon's public types, isolate C_Editor focus styling to the component, make C_Chat preview, file, and retry actions keyboard accessible, and keep C_AudioPlayer state honest when playback fails or its playlist changes. Repair C_AntV BPMN domain-data round-trips and honor initial external BPMN/UML data. Make C_VtableGantt option merging prototype-safe and synchronize fullscreen state with the actual DOM lifecycle. Validate persisted C_CollapsePanel/C_TagsView state and avoid path interpolation in tag selectors. Isolate C_Upload's initial file list, consistently filter accepted picker/drop/paste files, label image actions, show per-file hashing progress, and make chunk cancellation effective throughout resume lookup, requests, and merging. Load initial C_WorkFlow models, isolate emitted snapshots and condition edits, honor readonly boundaries, prevent ID collisions, and clean up deferred view actions. Support timestamp and formatted string date ranges in C_FormSearch, hide decorative C_ActionBar icons from accessible names, and include Vue source templates in the verification gate.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- fc872e4: Harden smaller interaction components: keep login's remembered username current and reject malformed SMS recipients, load city data only when opened and scope letter navigation to each instance, make code actions keyboard-accessible and report modal close events, bound skeleton render counts, and synchronize menu expansion when route options arrive. Improve markdown, organization chart, timeline, tree, transfer, date/time, cascade, context menu, split pane, progress, avatar and step state and accessibility behavior.
|
|
14
|
+
- fc872e4: Make image crop exports use one canvas snapshot, report failures, honor disabled state, and apply flips to the actual image. Make signature readonly mode effective, preserve imported/background images across redraws, and replace placeholder SVG output with a raster-backed SVG. Fix calendar local-date saving and reactive editable mode. Prevent stale QR renders, keep logo-bearing SVG exports consistent with previews, and relayout waterfall images by aspect ratio while suppressing duplicate infinite-load requests.
|
|
15
|
+
- fc872e4: Keep C_NotificationCenter server read state authoritative, avoid duplicate popover toggles, forward WebSocket events, and validate action links before navigation. Prevent C_VideoPlayer from creating a player after unmount, remove duplicate shortcut/cleanup paths, and make mini-player controls keyboard accessible. Reject malformed C_Cron expressions without rewriting them, preview second-level schedules across the full search horizon, and honor disabled controls. Fix C_FormulaEditor logical operator evaluation, read-only input behavior, and keyboard accessibility.
|
|
16
|
+
|
|
17
|
+
## 0.12.1
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- Enhance `C_ActionBar` with semantic action presets, getter-based reactive states, guarded async loading, and icon-first compact `tiny` defaults, including consistent create/save/cancel/close actions for forms and details. Allow `C_Table` toolbars to consume the same left/right action model while preserving existing slots, configurable sizing, and independent table engines.
|
|
22
|
+
|
|
23
|
+
- Polish the C_Captcha and C_Login verification flow with package-owned SVG state icons, explicit verification copy, theme variables, a visibility event for pausing expensive host effects, and a clearer verification-before-submit layout. Add an opt-in, lazily loaded ALTCHA provider for free self-hosted proof-of-work challenges while preserving the existing puzzle provider by default.
|
|
24
|
+
|
|
25
|
+
- 新增公开的 `C_Tabs` 数据驱动紧凑标签页,支持 render、插槽、异步切换守卫、徽标、图标、关闭和 tabs-only 场景,并接入按需 Resolver 与独立样式入口。
|
|
26
|
+
|
|
27
|
+
- Add `C_FormModal`, a compact data-driven create/edit modal that reuses `C_Form` and `C_ActionBar`, accepts any structurally compatible headless CRUD editor without coupling the component package to a request library, and keeps fields, validation, loading and footer actions out of business templates.
|
|
28
|
+
|
|
3
29
|
## 0.11.8
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**基于 Naive UI 的 Vue 3 企业级组件库**
|
|
6
6
|
|
|
7
|
-
从 Robot Admin 中提炼的
|
|
7
|
+
从 Robot Admin 中提炼的 53 个高质量业务组件,支持全量注册、按需导入(Tree-Shaking)和子路径独立导入。
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/@robot-admin/naive-ui-components)
|
|
10
10
|
[](./LICENSE)
|
|
@@ -167,6 +167,42 @@ import '@robot-admin/naive-ui-components/C_Table/base.css'
|
|
|
167
167
|
</template>
|
|
168
168
|
```
|
|
169
169
|
|
|
170
|
+
自定义操作栏应调用 `action` 插槽的 `submit()`,不要用 `validate()` 代替提交。步骤布局的 `step-actions` 插槽同时提供 `isLastStep`、`submit()` 和 `submitting`,可在最后一步直接放置提交按钮。异步保存放在 `config.onSubmit` 中并等待完成;`@submit` 是保存成功后的通知事件,不承诺等待监听器返回的 Promise。
|
|
171
|
+
|
|
172
|
+
新增/编辑场景推荐用 `C_FormModal` 直接消费 Headless CRUD 的结构化 `editor`。字段、校验和布局继续由 `C_Form` 配置驱动,页面不再重复编写 Modal、按钮、loading 和草稿状态;默认采用紧凑小尺寸表单和右下角带图标操作按钮,宽度、表单尺寸与动作文案仍可覆盖:
|
|
173
|
+
|
|
174
|
+
```vue
|
|
175
|
+
<script setup lang="ts">
|
|
176
|
+
import { C_FormModal } from '@robot-admin/naive-ui-components/C_FormModal'
|
|
177
|
+
import type { FormModalEditor } from '@robot-admin/naive-ui-components/C_FormModal'
|
|
178
|
+
import {
|
|
179
|
+
defineFormConfig,
|
|
180
|
+
defineFormOptions,
|
|
181
|
+
} from '@robot-admin/naive-ui-components/C_Form'
|
|
182
|
+
|
|
183
|
+
interface UserForm {
|
|
184
|
+
name: string
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
defineProps<{ editor: FormModalEditor<UserForm> }>()
|
|
188
|
+
|
|
189
|
+
const fields = defineFormOptions<UserForm>([
|
|
190
|
+
{ type: 'input', prop: 'name', label: '名称', required: true },
|
|
191
|
+
])
|
|
192
|
+
const formConfig = defineFormConfig<UserForm>({ labelPlacement: 'top' })
|
|
193
|
+
</script>
|
|
194
|
+
|
|
195
|
+
<template>
|
|
196
|
+
<C_FormModal
|
|
197
|
+
:editor="editor"
|
|
198
|
+
:options="fields"
|
|
199
|
+
:config="formConfig"
|
|
200
|
+
/>
|
|
201
|
+
</template>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
`editor` 采用结构类型,不要求组件库依赖某个请求库;任何提供 `visible/mode/model/title/loading/setModel/close/submit` 的 Headless 控制器都可接入。弹窗默认保留关闭按钮、遮罩关闭和 Esc 行为,也可按高风险表单显式关闭。
|
|
205
|
+
|
|
170
206
|
远程表格推荐交给 `useTableQuery` 管理请求取消、竞态、分页和 loading;只需把 `bindings` 绑定给组件。`rowKey` 必须稳定且唯一,默认会检测缺失和重复键。
|
|
171
207
|
|
|
172
208
|
```vue
|
|
@@ -216,6 +252,69 @@ import '@robot-admin/naive-ui-components/C_Table/base.css'
|
|
|
216
252
|
</template>
|
|
217
253
|
```
|
|
218
254
|
|
|
255
|
+
将 Headless CRUD 绑定到 `:crud` 时,表格会识别操作结果中的 `{ error }`:失败不会触发删除成功事件,也不会重复展示 CRUD 控制器已经展示的反馈。自定义 `actions.delete` 可返回 Promise,或返回 `{ data, error }` 结构。
|
|
256
|
+
|
|
257
|
+
树形数据可直接使用 `<C_Table :data="rows" :columns="columns" :config="{ tree: { defaultExpandAll: true }, pagination: false }" />`;`children` 是默认子节点字段,也可通过 `tree.childrenKey` 指定。默认展开会初始化所有父节点,并在异步追加新父节点时展开新节点,不会重新展开用户手动收起的旧节点。
|
|
258
|
+
|
|
259
|
+
`C_Tabs` 是面向页面场景切换的统一数据驱动标签页,名称与全局 `C_*` 体系保持一致。默认使用紧凑
|
|
260
|
+
`small` 尺寸、延迟呈现面板并支持受控/非受控状态;只做筛选或视图切换时启用 `tabsOnly`,组件
|
|
261
|
+
不会执行面板内容,避免隐藏内容产生渲染开销或副作用。常规场景只维护数组,复杂内容可以按需使用 `render`、`pane` 或
|
|
262
|
+
`pane-{key}` 插槽:
|
|
263
|
+
|
|
264
|
+
```vue
|
|
265
|
+
<script setup lang="ts">
|
|
266
|
+
import { ref } from 'vue'
|
|
267
|
+
import { C_Tabs, defineTabs } from '@robot-admin/naive-ui-components/C_Tabs'
|
|
268
|
+
|
|
269
|
+
const activeView = ref('basic')
|
|
270
|
+
const views = defineTabs([
|
|
271
|
+
{ key: 'basic', label: '基础表格', icon: 'mdi:table' },
|
|
272
|
+
{ key: 'tree', label: '树形表格', icon: 'mdi:file-tree-outline' },
|
|
273
|
+
])
|
|
274
|
+
</script>
|
|
275
|
+
|
|
276
|
+
<template>
|
|
277
|
+
<C_Tabs
|
|
278
|
+
v-model="activeView"
|
|
279
|
+
:items="views"
|
|
280
|
+
type="segment"
|
|
281
|
+
tabs-only
|
|
282
|
+
/>
|
|
283
|
+
</template>
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
| API | 说明 |
|
|
287
|
+
| ----------------------------- | ------------------------------------------------------------------------- |
|
|
288
|
+
| `items` | `key/label` 为必填,支持 `icon`、`badge`、禁用、关闭及 `renderTab/render` |
|
|
289
|
+
| `modelValue` / `defaultValue` | 同时支持受控和非受控状态 |
|
|
290
|
+
| `type` / `size` / `placement` | `line/card/bar/segment` 与常用尺寸、方向;默认 `line/small/top` |
|
|
291
|
+
| `tabsOnly` | 只呈现标签导航,适合表格场景和查询条件切换 |
|
|
292
|
+
| `beforeChange` | 支持同步或异步切换守卫;返回 `false` 或抛错均保留当前页 |
|
|
293
|
+
| 插槽 | `tab`、`pane` 和 `pane-{key}`,均提供当前 item 与 active 状态 |
|
|
294
|
+
| 事件 | `change`、`close`、`add` 及标准 `update:modelValue` |
|
|
295
|
+
|
|
296
|
+
页面级和表格级按钮统一使用 `C_ActionBar`,无需再维护另一套 Toolbar。操作栏默认采用带图标的 `tiny` 紧凑按钮和 `6px` 间距;`add`、`refresh`、`export`、`columns`、`settings` 等语义 key 会自动补齐一致的文案、图标与按钮类型,自定义动作未传图标时使用中性操作图标。`show`、`disabled`、`loading` 可直接传布尔值、`Ref` 或 getter,异步操作默认防重复点击并自动展示 loading。`C_Table` 可在 `toolbar.actions` / `toolbar.rightActions` 中直接复用同一份动作配置,同时保留原有左右插槽;需要更大按钮时,通过 `actionBar.size` 或单个动作的 `size` 覆盖:
|
|
297
|
+
|
|
298
|
+
```ts
|
|
299
|
+
import { defineActions } from '@robot-admin/naive-ui-components/C_ActionBar'
|
|
300
|
+
import { defineTableConfig } from '@robot-admin/naive-ui-components/C_Table'
|
|
301
|
+
|
|
302
|
+
const actions = defineActions([
|
|
303
|
+
{ key: 'add', onClick: openCreate },
|
|
304
|
+
{ key: 'refresh', disabled: () => loading.value, onClick: refresh },
|
|
305
|
+
{ key: 'settings', group: 'right', onClick: openSettings },
|
|
306
|
+
])
|
|
307
|
+
|
|
308
|
+
const config = defineTableConfig({
|
|
309
|
+
toolbar: {
|
|
310
|
+
actions,
|
|
311
|
+
actionBar: { size: 'small' }, // 可选;默认是 tiny
|
|
312
|
+
},
|
|
313
|
+
})
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
`C_Table` 继续由当前 Naive UI 表格实现负责;需要 MachTable 时应由业务入口完整渲染 MachTable 及其原生配置,避免在两套列定义、事件和实例 API 之间做隐式转换。二者只共享 `C_ActionBar` 这类框架无关的页面动作模型,不互相污染。
|
|
317
|
+
|
|
219
318
|
### C_Map 推荐用法
|
|
220
319
|
|
|
221
320
|
`C_Map` 统一以 `[纬度, 经度]` 接收中心点和标记坐标;切换高德地图时会在组件内部转换为其要求的 `[经度, 纬度]`,使用侧无需维护两套数据。非法标记会被隔离,组件只清理自己创建的 Marker,不会误删通过 `ready` 事件添加的业务图层。
|
|
@@ -254,8 +353,30 @@ import '@robot-admin/naive-ui-components/C_Table/base.css'
|
|
|
254
353
|
|
|
255
354
|
### C_Captcha 服务端校验
|
|
256
355
|
|
|
356
|
+
验证码入口使用组件库内置 SVG 状态图标,不依赖操作系统 Emoji 或在线图标服务;默认、校验中、成功和失败状态均保持一致的尺寸与语义颜色。`C_Login` 会把验证入口放在提交按钮之前并显示明确操作文案,同时透传 `captcha-visible-change`,宿主可在拼图交互期间暂停高开销背景动画。品牌接入可在外层通过 `--cc-height`、`--cc-radius`、`--cc-color`、`--cc-icon-color`、`--cc-bg`、`--cc-bg-hover`、`--cc-border`、`--cc-border-hover` 和 `--cc-focus` 调整外观,无需穿透组件内部 DOM。
|
|
357
|
+
|
|
257
358
|
默认本地模式仅证明浏览器内的拼图交互已经完成,不能作为登录、支付等敏感操作的安全凭证。生产场景应传入 `verifier`,并开启 `require-server-verification`;组件会处理超时、取消和竞态,只在独立的服务端/验证码提供商确认后发出 `success`。请求中的 `token`、`timestamp` 都由客户端生成,只能用于关联和日志,服务端绝不能把它们本身当作可信证明。
|
|
258
359
|
|
|
360
|
+
需要国内网络可用且长期免费的方案时,可显式选择开源 MIT 的 ALTCHA 自托管模式。该模式仅在使用时懒加载,不增加默认拼图入口的首屏执行成本;组件会强制服务端校验,缺少 `challenge-url` 或 `verifier` 时失败关闭。应用后端必须签发新鲜的一次性挑战、验证 PoW payload、阻止重放并限流;密钥只存于服务端。
|
|
361
|
+
|
|
362
|
+
```vue
|
|
363
|
+
<C_Captcha
|
|
364
|
+
provider="altcha"
|
|
365
|
+
challenge-url="/api/auth/captcha/challenge"
|
|
366
|
+
:verifier="
|
|
367
|
+
async ({ token, signal }) => {
|
|
368
|
+
const response = await fetch('/api/auth/captcha/verify', {
|
|
369
|
+
method: 'POST',
|
|
370
|
+
headers: { 'content-type': 'application/json' },
|
|
371
|
+
body: JSON.stringify({ payload: token }),
|
|
372
|
+
signal,
|
|
373
|
+
})
|
|
374
|
+
return response.json() // { valid: boolean, token: '服务端一次性登录令牌' }
|
|
375
|
+
}
|
|
376
|
+
"
|
|
377
|
+
/>
|
|
378
|
+
```
|
|
379
|
+
|
|
259
380
|
```vue
|
|
260
381
|
<C_Captcha
|
|
261
382
|
require-server-verification
|
|
@@ -277,36 +398,39 @@ import '@robot-admin/naive-ui-components/C_Table/base.css'
|
|
|
277
398
|
/>
|
|
278
399
|
```
|
|
279
400
|
|
|
280
|
-
开启 `require-server-verification` 后,成功响应必须包含服务端 token。该 token 应短期、一次性使用,并绑定当前会话或业务请求。`C_Login` 可通过 `captchaVerifier`、`requireCaptchaServerVerification` 和 `captchaVerificationTimeout` 透传同一安全策略,并在 `submit` 数据中通过 `captchaVerifiedBy`
|
|
401
|
+
开启 `require-server-verification` 后,成功响应必须包含服务端 token。该 token 应短期、一次性使用,并绑定当前会话或业务请求。`C_Login` 可通过 `captchaProvider`、`captchaChallengeUrl`、`captchaVerifier`、`requireCaptchaServerVerification` 和 `captchaVerificationTimeout` 透传同一安全策略,并在 `submit` 数据中通过 `captchaType` 与 `captchaVerifiedBy` 标识验证类型和来源。更多边界说明见 [SECURITY.md](./SECURITY.md)。
|
|
281
402
|
|
|
282
|
-
|
|
403
|
+
`C_Login` 的“记住我”只保存用户名,不保存密码。短信验证码仅对格式正确的手机号触发事件;组件会立即开始本地倒计时,发送结果和服务端限流仍由宿主处理。`C_City` 在首次打开时才加载城市索引,字母跳转只作用于当前实例;默认触发器、字母和城市项均可用键盘操作。
|
|
404
|
+
|
|
405
|
+
### 📋 组件清单(53 个)
|
|
283
406
|
|
|
284
407
|
> 💡 所有组件均提供 **在线交互演示**,访问 [组件文档](https://www.tzagileteam.com/robot/components/preface) 可直接在页面中体验真实效果(通过 iframe 嵌入 Robot Admin 生产环境)。
|
|
285
408
|
|
|
286
409
|
#### 基础组件
|
|
287
410
|
|
|
288
|
-
| 组件 | 说明
|
|
289
|
-
| ---------------- |
|
|
290
|
-
| `C_Icon` | Iconify 图标封装
|
|
291
|
-
| `C_Code` | 代码高亮显示
|
|
292
|
-
| `C_Barcode` | 条形码生成器
|
|
293
|
-
| `C_Captcha` |
|
|
294
|
-
| `C_Cascade` | 级联面板选择器
|
|
295
|
-
| `C_Guide` | 新手引导
|
|
296
|
-
| `C_Progress` | 增强进度条
|
|
297
|
-
| `C_Steps` | 步骤条
|
|
298
|
-
| `C_ActionBar` | 操作按钮栏
|
|
299
|
-
| `C_Theme` | 主题切换器
|
|
300
|
-
| `C_Language` | 语言切换器
|
|
301
|
-
| `C_Date` | 日期选择器增强
|
|
302
|
-
| `C_City` | 省市区三级联动
|
|
303
|
-
| `C_Breadcrumb` | 面包屑导航
|
|
304
|
-
| `C_Menu` | 导航菜单
|
|
305
|
-
| `
|
|
306
|
-
| `
|
|
307
|
-
| `
|
|
308
|
-
| `
|
|
309
|
-
| `
|
|
411
|
+
| 组件 | 说明 | 外部依赖 |
|
|
412
|
+
| ---------------- | ----------------------- | ----------------------------- |
|
|
413
|
+
| `C_Icon` | Iconify 图标封装 | `@iconify/vue` |
|
|
414
|
+
| `C_Code` | 代码高亮显示 | `highlight.js` |
|
|
415
|
+
| `C_Barcode` | 条形码生成器 | `@chenfengyuan/vue-barcode` |
|
|
416
|
+
| `C_Captcha` | 拼图/ALTCHA 人机验证 | `vue3-puzzle-vcode`、`altcha` |
|
|
417
|
+
| `C_Cascade` | 级联面板选择器 | - |
|
|
418
|
+
| `C_Guide` | 新手引导 | `driver.js` |
|
|
419
|
+
| `C_Progress` | 增强进度条 | - |
|
|
420
|
+
| `C_Steps` | 步骤条 | - |
|
|
421
|
+
| `C_ActionBar` | 操作按钮栏 | - |
|
|
422
|
+
| `C_Theme` | 主题切换器 | - |
|
|
423
|
+
| `C_Language` | 语言切换器 | - |
|
|
424
|
+
| `C_Date` | 日期选择器增强 | - |
|
|
425
|
+
| `C_City` | 省市区三级联动 | - |
|
|
426
|
+
| `C_Breadcrumb` | 面包屑导航 | - |
|
|
427
|
+
| `C_Menu` | 导航菜单 | - |
|
|
428
|
+
| `C_Tabs` | 数据驱动标签页/场景切换 | - |
|
|
429
|
+
| `C_TagsView` | 标签页导航 | - |
|
|
430
|
+
| `C_GlobalSearch` | 全局搜索面板 | - |
|
|
431
|
+
| `C_AvatarGroup` | 头像组合展示 | - |
|
|
432
|
+
| `C_OrgChart` | 组织架构图 | - |
|
|
433
|
+
| `C_Skeleton` | 骨架屏占位组件 | - |
|
|
310
434
|
|
|
311
435
|
#### 内容 & 编辑组件
|
|
312
436
|
|
|
@@ -334,11 +458,14 @@ import '@robot-admin/naive-ui-components/C_Table/base.css'
|
|
|
334
458
|
| `C_FilePreview` | 文件预览(PDF/Word/Excel) | `xlsx`、`mammoth` |
|
|
335
459
|
| `C_Timeline` | 时间线(垂直/水平/可折叠) | - |
|
|
336
460
|
|
|
461
|
+
图片/日历类组件的使用边界:`C_ImageCropper` 翻转会更新实际图片源并重置当前裁剪位置,加载和导出失败通过 `error: Error` 报告;`C_Signature` 的 `readonly` 只禁止用户交互,暴露方法仍可用于加载历史数据,其 SVG 导出是保留画布效果的栅格嵌入 SVG;`C_QRCode` 带 Logo 的 SVG 同样采用栅格嵌入,以保持预览与导出一致。`C_FullCalendar` 使用本地日历日期创建当日事件;`C_WaterFall` 会根据图片实际宽高比自动重排,建议以稳定唯一的 `id` 标识每项。
|
|
462
|
+
|
|
337
463
|
#### 表单 & 布局组件
|
|
338
464
|
|
|
339
465
|
| 组件 | 说明 | 外部依赖 |
|
|
340
466
|
| ----------------- | ------------------------------------------------- | -------------------- |
|
|
341
467
|
| `C_Form` | 动态表单引擎(Grid/Tabs/Steps/Card/Dynamic 布局) | - |
|
|
468
|
+
| `C_FormModal` | 数据驱动的新增/编辑表单弹窗 | - |
|
|
342
469
|
| `C_FormSearch` | 搜索表单 | - |
|
|
343
470
|
| `C_CollapsePanel` | 折叠面板 | - |
|
|
344
471
|
| `C_SplitPane` | 分割面板 | - |
|
|
@@ -354,7 +481,7 @@ import '@robot-admin/naive-ui-components/C_Table/base.css'
|
|
|
354
481
|
| --------------- | -------------------------------------- | -------- |
|
|
355
482
|
| `C_Chat` | 聊天组件(联系人/消息气泡/输入框) | - |
|
|
356
483
|
| `C_ContextMenu` | 右键菜单(嵌套子菜单/快捷键/危险操作) | - |
|
|
357
|
-
| `C_Login` | 登录组件(5
|
|
484
|
+
| `C_Login` | 登录组件(5种模式/验证码/记住用户名) | - |
|
|
358
485
|
|
|
359
486
|
#### 流程 & 通知组件
|
|
360
487
|
|
|
@@ -366,6 +493,22 @@ import '@robot-admin/naive-ui-components/C_Table/base.css'
|
|
|
366
493
|
|
|
367
494
|
### 🔌 依赖说明
|
|
368
495
|
|
|
496
|
+
`C_FilePreview` 的 URL 入口仅接受 HTTPS 或当前站点同源 HTTP(便于本地开发);不接受脚本、数据 URL、带凭据 URL 或跨站明文 HTTP。`autoPreview` 会在有文件源时自动打开预览,已打开时切换文件源会刷新内容。重复预览会释放旧 PDF 对象 URL,并忽略过期加载结果。Excel 单元格的 `0` 与 `false` 会原样保留。
|
|
497
|
+
|
|
498
|
+
`C_AntV` 的 BPMN 对外数据保持 `{ nodes, flows }` 领域结构;组件内部转换为 X6 单元格,并在 `data-change` / `getData()` 中还原节点位置、类型、属性和连线条件。BPMN/UML 仅在未提供 `data` 时加载内置示例;显式传入空数据会显示空画布。
|
|
499
|
+
|
|
500
|
+
`C_VtableGantt` 合并预设与 `options` 时会保留未覆盖的嵌套配置、以新数组整体替换旧数组,并忽略原型相关键;全屏按钮状态仅反映该甘特图容器的实际全屏状态。
|
|
501
|
+
|
|
502
|
+
`C_AudioPlayer` 只在浏览器确认 `play()` 成功后进入播放状态并触发 `play`;自动播放被拒绝时会触发 `error`,空播放列表不会产生虚假的播放事件。静音、曲目和进度条均可用键盘操作。
|
|
503
|
+
|
|
504
|
+
`C_CollapsePanel` 与 `C_TagsView` 会校验本地持久化数据结构;损坏或旧格式数据会安全回退,不会阻断组件初始化。持久化标签仅恢复站内路径,特殊字符路径的定位不会拼接 CSS 选择器。
|
|
505
|
+
|
|
506
|
+
`C_Table` 列设置只恢复有效的列键、可见性、列宽和固定方向;损坏的 `persistKey` 存储会回退到传入列。列设置在本地副本上操作,不会修改调用方的列对象。`C_Upload` 的默认文件列表同样会复制后再管理,文件选择、拖拽和粘贴共用 `accept` 过滤,图片操作可通过键盘识别和访问;并发计算哈希时,各文件显示自己的进度。分片上传在查询断点、请求或合并阶段取消后,不会继续派发请求或发出过期的完成事件。自定义上传请求的 `abort()` 即使不回调,也会释放分片等待任务。
|
|
507
|
+
|
|
508
|
+
`C_WorkFlow` 会在首次渲染时加载传入的 `modelValue`,并在 `getCurrentWorkflowData()` / `save` / `change` / `node-click` 中输出隔离的数据快照,避免调用方意外修改内部节点。条件编辑弹窗在保存前不会修改画布数据,未填完整的条件不会被静默丢弃。`readonly` 禁止节点拖拽、连线、配置、增删与保存,但仍允许预览、验证和适应视图;节点与条件 ID 在同一时刻连续创建时保持唯一。
|
|
509
|
+
|
|
510
|
+
类型验证同时覆盖 TypeScript 源码、Vue 单文件组件模板和发布后的使用侧示例。`C_Table` 合计行的 `summary.render` 应返回按列键组织的对象(`{ columnKey: { value, colSpan? } }`);`C_FormSearch` 的日期范围兼容原有数字时间戳数组,也支持格式化字符串数组,两种值会分别绑定 Naive UI 对应的值接口。
|
|
511
|
+
|
|
369
512
|
组件运行依赖已由本包声明,安装组件库时会自动解析。所有场景都需要:
|
|
370
513
|
|
|
371
514
|
```bash
|
|
@@ -380,7 +523,7 @@ bun add vue naive-ui
|
|
|
380
523
|
|
|
381
524
|
```
|
|
382
525
|
bun run build
|
|
383
|
-
├── 1. tsdown → 多入口打包(
|
|
526
|
+
├── 1. tsdown → 多入口打包(53 组件 ESM/CJS/DTS)
|
|
384
527
|
├── 2. sass CLI → 编译共享变量入口 → global-scss.css
|
|
385
528
|
├── 3. merge-css.js → 合并 Vue 编译后的 SFC CSS + 全局变量 → style.css
|
|
386
529
|
├── 4. gen-exports.js → 自动生成 package.json exports 映射
|
|
@@ -390,7 +533,7 @@ bun run build
|
|
|
390
533
|
|
|
391
534
|
#### 技术要点
|
|
392
535
|
|
|
393
|
-
- **构建引擎**:[tsdown](https://github.com/rolldown/tsdown)(基于 Rolldown),
|
|
536
|
+
- **构建引擎**:[tsdown](https://github.com/rolldown/tsdown)(基于 Rolldown),53 个独立入口并行编译
|
|
394
537
|
- **SCSS 处理**:自定义 `scssTransformPlugin` 在 Rolldown 管线内编译 SFC SCSS,独立 Sass CLI 仅编译共享变量入口
|
|
395
538
|
- **CSS 合并**:构建后将 Vue 已完成 scoped 转换的 per-chunk CSS 与共享变量合并为单一 `style.css`,避免重复样式和原始 `:deep()` 选择器泄漏
|
|
396
539
|
- **类型导出**:统一 `export *` barrel 模式,自动生成完整 `.d.ts`
|
|
@@ -405,7 +548,7 @@ bun run build
|
|
|
405
548
|
```
|
|
406
549
|
dist/
|
|
407
550
|
├── index.js / index.cjs / index.d.ts # 主入口
|
|
408
|
-
├── C_Form.js / C_Form.cjs / C_Form.d.ts # 子路径入口(
|
|
551
|
+
├── C_Form.js / C_Form.cjs / C_Form.d.ts # 子路径入口(53 组件)
|
|
409
552
|
├── C_Form.base.css / C_Form.full.css # 基础/完整样式层级
|
|
410
553
|
├── C_Table.base.css / C_Table.full.css # 基础/完整样式层级
|
|
411
554
|
├── style.css # 合并后的全量样式
|
package/README_EN.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**Enterprise-grade Vue 3 component library built on Naive UI**
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
53 production-ready business components extracted from Robot Admin, supporting global registration, on-demand imports (Tree-Shaking), and subpath imports.
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/@robot-admin/naive-ui-components)
|
|
10
10
|
[](./LICENSE)
|
|
@@ -135,6 +135,42 @@ const { model, formRef, bindings } = useCForm({
|
|
|
135
135
|
})
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
+
Custom action bars should call the `action` slot's `submit()` rather than treating `validate()` as submission. The step-layout `step-actions` slot also provides `isLastStep`, `submit()`, and `submitting`. Put asynchronous persistence in `config.onSubmit`; the `@submit` event is a post-success notification and does not await an event listener's promise.
|
|
139
|
+
|
|
140
|
+
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:
|
|
141
|
+
|
|
142
|
+
```vue
|
|
143
|
+
<script setup lang="ts">
|
|
144
|
+
import { C_FormModal } from '@robot-admin/naive-ui-components/C_FormModal'
|
|
145
|
+
import type { FormModalEditor } from '@robot-admin/naive-ui-components/C_FormModal'
|
|
146
|
+
import {
|
|
147
|
+
defineFormConfig,
|
|
148
|
+
defineFormOptions,
|
|
149
|
+
} from '@robot-admin/naive-ui-components/C_Form'
|
|
150
|
+
|
|
151
|
+
interface UserForm {
|
|
152
|
+
name: string
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
defineProps<{ editor: FormModalEditor<UserForm> }>()
|
|
156
|
+
|
|
157
|
+
const fields = defineFormOptions<UserForm>([
|
|
158
|
+
{ type: 'input', prop: 'name', label: 'Name', required: true },
|
|
159
|
+
])
|
|
160
|
+
const formConfig = defineFormConfig<UserForm>({ labelPlacement: 'top' })
|
|
161
|
+
</script>
|
|
162
|
+
|
|
163
|
+
<template>
|
|
164
|
+
<C_FormModal
|
|
165
|
+
:editor="editor"
|
|
166
|
+
:options="fields"
|
|
167
|
+
:config="formConfig"
|
|
168
|
+
/>
|
|
169
|
+
</template>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
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.
|
|
173
|
+
|
|
138
174
|
For remote tables, `useTableQuery` owns cancellation, latest-request-wins behavior, pagination, and loading. Destructure its `bindings` and use `<C_Table v-bind="bindings" />`:
|
|
139
175
|
|
|
140
176
|
```ts
|
|
@@ -157,6 +193,69 @@ const { bindings } = useTableQuery<UserRow, { keyword: string }>({
|
|
|
157
193
|
})
|
|
158
194
|
```
|
|
159
195
|
|
|
196
|
+
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.
|
|
197
|
+
|
|
198
|
+
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.
|
|
199
|
+
|
|
200
|
+
`C_Tabs` is the data-driven page-scenario switcher for the global `C_*` system. It defaults to the compact
|
|
201
|
+
`small` size, lazy pane display, and supports controlled or uncontrolled state. Set `tabsOnly` for filters or
|
|
202
|
+
view switching; pane content is not executed, avoiding hidden render work and side effects. Most pages only maintain an item array; complex
|
|
203
|
+
content can opt into `render`, `pane`, or `pane-{key}` slots:
|
|
204
|
+
|
|
205
|
+
```vue
|
|
206
|
+
<script setup lang="ts">
|
|
207
|
+
import { ref } from 'vue'
|
|
208
|
+
import { C_Tabs, defineTabs } from '@robot-admin/naive-ui-components/C_Tabs'
|
|
209
|
+
|
|
210
|
+
const activeView = ref('basic')
|
|
211
|
+
const views = defineTabs([
|
|
212
|
+
{ key: 'basic', label: 'Basic table', icon: 'mdi:table' },
|
|
213
|
+
{ key: 'tree', label: 'Tree table', icon: 'mdi:file-tree-outline' },
|
|
214
|
+
])
|
|
215
|
+
</script>
|
|
216
|
+
|
|
217
|
+
<template>
|
|
218
|
+
<C_Tabs
|
|
219
|
+
v-model="activeView"
|
|
220
|
+
:items="views"
|
|
221
|
+
type="segment"
|
|
222
|
+
tabs-only
|
|
223
|
+
/>
|
|
224
|
+
</template>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
| API | Description |
|
|
228
|
+
| ----------------------------- | --------------------------------------------------------------------------------------------- |
|
|
229
|
+
| `items` | Requires `key/label`; supports icons, badges, disabled/closable state, and `renderTab/render` |
|
|
230
|
+
| `modelValue` / `defaultValue` | Controlled and uncontrolled state |
|
|
231
|
+
| `type` / `size` / `placement` | `line/card/bar/segment`, common sizes and placements; defaults to `line/small/top` |
|
|
232
|
+
| `tabsOnly` | Renders navigation only for table scenarios and query switches |
|
|
233
|
+
| `beforeChange` | Sync/async guard; `false` or an error keeps the current tab |
|
|
234
|
+
| Slots | `tab`, `pane`, and `pane-{key}`, each with item and active state |
|
|
235
|
+
| Events | `change`, `close`, `add`, and standard `update:modelValue` |
|
|
236
|
+
|
|
237
|
+
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:
|
|
238
|
+
|
|
239
|
+
```ts
|
|
240
|
+
import { defineActions } from '@robot-admin/naive-ui-components/C_ActionBar'
|
|
241
|
+
import { defineTableConfig } from '@robot-admin/naive-ui-components/C_Table'
|
|
242
|
+
|
|
243
|
+
const actions = defineActions([
|
|
244
|
+
{ key: 'add', onClick: openCreate },
|
|
245
|
+
{ key: 'refresh', disabled: () => loading.value, onClick: refresh },
|
|
246
|
+
{ key: 'settings', group: 'right', onClick: openSettings },
|
|
247
|
+
])
|
|
248
|
+
|
|
249
|
+
const config = defineTableConfig({
|
|
250
|
+
toolbar: {
|
|
251
|
+
actions,
|
|
252
|
+
actionBar: { size: 'small' }, // optional; tiny by default
|
|
253
|
+
},
|
|
254
|
+
})
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
`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`.
|
|
258
|
+
|
|
160
259
|
### Recommended C_Map setup
|
|
161
260
|
|
|
162
261
|
`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.
|
|
@@ -195,8 +294,30 @@ The exposed instance provides `getMap()`, `refresh()`, and `fitToMarkers()` for
|
|
|
195
294
|
|
|
196
295
|
### C_Captcha Server Verification
|
|
197
296
|
|
|
297
|
+
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.
|
|
298
|
+
|
|
198
299
|
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.
|
|
199
300
|
|
|
301
|
+
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.
|
|
302
|
+
|
|
303
|
+
```vue
|
|
304
|
+
<C_Captcha
|
|
305
|
+
provider="altcha"
|
|
306
|
+
challenge-url="/api/auth/captcha/challenge"
|
|
307
|
+
:verifier="
|
|
308
|
+
async ({ token, signal }) => {
|
|
309
|
+
const response = await fetch('/api/auth/captcha/verify', {
|
|
310
|
+
method: 'POST',
|
|
311
|
+
headers: { 'content-type': 'application/json' },
|
|
312
|
+
body: JSON.stringify({ payload: token }),
|
|
313
|
+
signal,
|
|
314
|
+
})
|
|
315
|
+
return response.json() // { valid: boolean, token: 'single-use-server-token' }
|
|
316
|
+
}
|
|
317
|
+
"
|
|
318
|
+
/>
|
|
319
|
+
```
|
|
320
|
+
|
|
200
321
|
```vue
|
|
201
322
|
<C_Captcha
|
|
202
323
|
require-server-verification
|
|
@@ -218,36 +339,39 @@ The default local mode only proves that the browser-side puzzle interaction comp
|
|
|
218
339
|
/>
|
|
219
340
|
```
|
|
220
341
|
|
|
221
|
-
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 `captchaVerifier`, `requireCaptchaServerVerification`, and `captchaVerificationTimeout
|
|
342
|
+
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.
|
|
222
343
|
|
|
223
|
-
|
|
344
|
+
`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.
|
|
345
|
+
|
|
346
|
+
### 📋 Component List (53 Components)
|
|
224
347
|
|
|
225
348
|
> 💡 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).
|
|
226
349
|
|
|
227
350
|
#### Basic Components
|
|
228
351
|
|
|
229
|
-
| Component | Description
|
|
230
|
-
| ---------------- |
|
|
231
|
-
| `C_Icon` | Iconify icon wrapper
|
|
232
|
-
| `C_Code` | Code highlighting
|
|
233
|
-
| `C_Barcode` | Barcode generator
|
|
234
|
-
| `C_Captcha` | Puzzle captcha
|
|
235
|
-
| `C_Cascade` | Cascade panel selector
|
|
236
|
-
| `C_Guide` | User guide / tour
|
|
237
|
-
| `C_Progress` | Enhanced progress bar
|
|
238
|
-
| `C_Steps` | Step bar
|
|
239
|
-
| `C_ActionBar` | Action button bar
|
|
240
|
-
| `C_Theme` | Theme switcher
|
|
241
|
-
| `C_Language` | Language switcher
|
|
242
|
-
| `C_Date` | Enhanced date picker
|
|
243
|
-
| `C_City` | Province / city selector
|
|
244
|
-
| `C_Breadcrumb` | Breadcrumb navigation
|
|
245
|
-
| `C_Menu` | Navigation menu
|
|
246
|
-
| `
|
|
247
|
-
| `
|
|
248
|
-
| `
|
|
249
|
-
| `
|
|
250
|
-
| `
|
|
352
|
+
| Component | Description | External Deps |
|
|
353
|
+
| ---------------- | ------------------------- | ----------------------------- |
|
|
354
|
+
| `C_Icon` | Iconify icon wrapper | `@iconify/vue` |
|
|
355
|
+
| `C_Code` | Code highlighting | `highlight.js` |
|
|
356
|
+
| `C_Barcode` | Barcode generator | `@chenfengyuan/vue-barcode` |
|
|
357
|
+
| `C_Captcha` | Puzzle / ALTCHA captcha | `vue3-puzzle-vcode`, `altcha` |
|
|
358
|
+
| `C_Cascade` | Cascade panel selector | - |
|
|
359
|
+
| `C_Guide` | User guide / tour | `driver.js` |
|
|
360
|
+
| `C_Progress` | Enhanced progress bar | - |
|
|
361
|
+
| `C_Steps` | Step bar | - |
|
|
362
|
+
| `C_ActionBar` | Action button bar | - |
|
|
363
|
+
| `C_Theme` | Theme switcher | - |
|
|
364
|
+
| `C_Language` | Language switcher | - |
|
|
365
|
+
| `C_Date` | Enhanced date picker | - |
|
|
366
|
+
| `C_City` | Province / city selector | - |
|
|
367
|
+
| `C_Breadcrumb` | Breadcrumb navigation | - |
|
|
368
|
+
| `C_Menu` | Navigation menu | - |
|
|
369
|
+
| `C_Tabs` | Data-driven scenario tabs | - |
|
|
370
|
+
| `C_TagsView` | Tab-based navigation | - |
|
|
371
|
+
| `C_GlobalSearch` | Global search panel | - |
|
|
372
|
+
| `C_AvatarGroup` | Avatar group display | - |
|
|
373
|
+
| `C_OrgChart` | Organization chart | - |
|
|
374
|
+
| `C_Skeleton` | Skeleton placeholder | - |
|
|
251
375
|
|
|
252
376
|
#### Content & Editor Components
|
|
253
377
|
|
|
@@ -275,11 +399,14 @@ With `require-server-verification`, a successful response must include a server
|
|
|
275
399
|
| `C_FilePreview` | File preview (PDF/Word/Excel) | `xlsx`, `mammoth` |
|
|
276
400
|
| `C_Timeline` | Timeline (vertical/horizontal/collapsible) | - |
|
|
277
401
|
|
|
402
|
+
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`.
|
|
403
|
+
|
|
278
404
|
#### Form & Layout Components
|
|
279
405
|
|
|
280
406
|
| Component | Description | External Deps |
|
|
281
407
|
| ----------------- | ------------------------------------------------- | -------------------- |
|
|
282
408
|
| `C_Form` | Dynamic form engine (Grid/Tabs/Steps/Card layout) | - |
|
|
409
|
+
| `C_FormModal` | Data-driven create/edit form modal | - |
|
|
283
410
|
| `C_FormSearch` | Search form | - |
|
|
284
411
|
| `C_CollapsePanel` | Collapse panel | - |
|
|
285
412
|
| `C_SplitPane` | Split pane | - |
|
|
@@ -307,6 +434,22 @@ With `require-server-verification`, a successful response must include a server
|
|
|
307
434
|
|
|
308
435
|
### 🔌 Dependency Notes
|
|
309
436
|
|
|
437
|
+
`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.
|
|
438
|
+
|
|
439
|
+
`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.
|
|
440
|
+
|
|
441
|
+
`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.
|
|
442
|
+
|
|
443
|
+
`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.
|
|
444
|
+
|
|
445
|
+
`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.
|
|
446
|
+
|
|
447
|
+
`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.
|
|
448
|
+
|
|
449
|
+
`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.
|
|
450
|
+
|
|
451
|
+
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.
|
|
452
|
+
|
|
310
453
|
Runtime component dependencies are declared by this package and resolved automatically. Every consumer needs:
|
|
311
454
|
|
|
312
455
|
```bash
|
|
@@ -321,7 +464,7 @@ Install optional peers per feature: `vue-router` for `C_Breadcrumb`/`C_TagsView`
|
|
|
321
464
|
|
|
322
465
|
```
|
|
323
466
|
bun run build
|
|
324
|
-
├── 1. tsdown → Multi-entry bundling (
|
|
467
|
+
├── 1. tsdown → Multi-entry bundling (53 components ESM/CJS/DTS)
|
|
325
468
|
├── 2. sass CLI → Compile the shared-variable entry → global-scss.css
|
|
326
469
|
├── 3. merge-css.js → Merge Vue-compiled SFC CSS + global variables → style.css
|
|
327
470
|
├── 4. gen-exports.js → Auto-generate package.json exports map
|
|
@@ -331,7 +474,7 @@ bun run build
|
|
|
331
474
|
|
|
332
475
|
#### Key Technical Details
|
|
333
476
|
|
|
334
|
-
- **Build engine**: [tsdown](https://github.com/rolldown/tsdown) (Rolldown-based),
|
|
477
|
+
- **Build engine**: [tsdown](https://github.com/rolldown/tsdown) (Rolldown-based), 53 independent entries compiled in parallel
|
|
335
478
|
- **SCSS processing**: Custom `scssTransformPlugin` compiles SFC SCSS within the Rolldown pipeline; standalone Sass CLI only compiles the shared-variable entry
|
|
336
479
|
- **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
|
|
337
480
|
- **Type exports**: Unified `export *` barrel pattern with auto-generated `.d.ts`
|
|
@@ -346,7 +489,7 @@ bun run build
|
|
|
346
489
|
```
|
|
347
490
|
dist/
|
|
348
491
|
├── index.js / index.cjs / index.d.ts # Main entry
|
|
349
|
-
├── C_Form.js / C_Form.cjs / C_Form.d.ts # Subpath entries (
|
|
492
|
+
├── C_Form.js / C_Form.cjs / C_Form.d.ts # Subpath entries (53 components)
|
|
350
493
|
├── C_Form.base.css / C_Form.full.css # Base/full style tiers
|
|
351
494
|
├── C_Table.base.css / C_Table.full.css # Base/full style tiers
|
|
352
495
|
├── style.css # Merged full styles
|
package/SECURITY.md
CHANGED
|
@@ -11,6 +11,7 @@ Please use GitHub's private security-advisory flow for the repository. Include t
|
|
|
11
11
|
## Trust boundaries
|
|
12
12
|
|
|
13
13
|
- `C_Captcha` local mode is a UI interaction check, not authentication. Its client token and timestamp are untrusted telemetry. Sensitive flows must configure `verifier` with `requireServerVerification`, validate an independent server/provider-issued challenge, and return a short-lived, single-use token bound to the session or operation. Fail-closed mode rejects successful responses that omit this token.
|
|
14
|
+
- `C_Captcha` ALTCHA mode is self-hosted and forces server verification. The application server must sign fresh challenges, validate payloads with a server-only secret, enforce expiration and single use, bind the returned token to the session or operation, and apply rate limits. The browser must never receive the HMAC secret.
|
|
14
15
|
- Rich HTML is sanitized by the library, but applications must still apply server-side validation, output encoding, CSP, and authorization. Client-side sanitization is not an authorization boundary.
|
|
15
16
|
- Formula evaluation uses a bounded parser and does not execute arbitrary JavaScript. Do not replace it with `eval` or `Function` for untrusted input.
|
|
16
17
|
- Upload type, size, hashing, and chunk checks improve UX and integrity but do not replace server-side content validation, malware scanning, quotas, or access control.
|
package/dist/C_ActionBar.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./C_Icon2.cjs`);const e=require(`./C_ActionBar2.cjs`);exports.C_ActionBar=e.t;
|
|
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;
|