@robot-admin/naive-ui-components 0.13.6 → 0.13.7
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 +6 -0
- package/README.md +36 -1
- package/README_EN.md +36 -1
- package/dist/C_Form.base.css +174 -169
- package/dist/C_Form.cjs +1 -1
- package/dist/C_Form.css +174 -169
- package/dist/C_Form.d.cts +2 -2
- package/dist/C_Form.d.ts +2 -2
- package/dist/C_Form.js +1 -1
- package/dist/C_Form2.cjs +1 -1
- package/dist/C_Form2.js +1 -1
- package/dist/C_FormModal.css +15 -15
- package/dist/C_FormModal2.cjs +1 -1
- package/dist/C_FormModal2.js +1 -1
- package/dist/C_Table.base.css +174 -169
- package/dist/C_Table.css +174 -169
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants2.d.cts +4 -4
- package/dist/constants2.d.ts +4 -4
- package/dist/constants3.d.cts +1 -1
- package/dist/constants3.d.ts +1 -1
- package/dist/constants4.d.cts +4 -4
- package/dist/constants4.d.ts +4 -4
- package/dist/data.d.cts +10 -10
- package/dist/data.d.ts +10 -10
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.vue.d.cts +2 -2
- package/dist/index.vue.d.ts +2 -2
- package/dist/index10.vue.d.cts +1 -1
- package/dist/index10.vue.d.ts +1 -1
- package/dist/index11.vue.d.cts +1 -1
- package/dist/index11.vue.d.ts +2 -2
- package/dist/index12.vue.d.cts +2 -2
- package/dist/index12.vue.d.ts +1 -1
- package/dist/index13.vue.d.cts +1 -1
- package/dist/index13.vue.d.ts +5 -5
- package/dist/index14.vue.d.cts +5 -5
- package/dist/index14.vue.d.ts +3 -3
- package/dist/index15.vue.d.cts +3 -3
- package/dist/index15.vue.d.ts +1 -1
- package/dist/index16.vue.d.cts +1 -1
- package/dist/index17.vue.d.ts +1 -1
- package/dist/index18.vue.d.cts +1 -1
- package/dist/index18.vue.d.ts +3 -3
- package/dist/index19.vue.d.cts +3 -3
- package/dist/index2.vue.d.cts +1 -1
- package/dist/index2.vue.d.ts +1 -1
- package/dist/index20.vue.d.cts +1 -1
- package/dist/index20.vue.d.ts +1 -1
- package/dist/index21.vue.d.cts +3 -3
- package/dist/index21.vue.d.ts +3 -3
- package/dist/index22.vue.d.cts +2 -2
- package/dist/index22.vue.d.ts +2 -2
- package/dist/index23.vue.d.cts +1 -1
- package/dist/index23.vue.d.ts +1 -1
- package/dist/index25.vue.d.cts +3 -3
- package/dist/index25.vue.d.ts +3 -3
- package/dist/index27.vue.d.cts +3 -3
- package/dist/index27.vue.d.ts +3 -3
- package/dist/index28.vue.d.cts +4 -4
- package/dist/index28.vue.d.ts +4 -4
- package/dist/index3.vue.d.cts +2 -2
- package/dist/index3.vue.d.ts +2 -2
- package/dist/index6.vue.d.ts +2 -2
- package/dist/index7.vue.d.cts +2 -2
- package/dist/index9.vue.d.ts +1 -1
- package/dist/presets.d.cts +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/style.css +189 -184
- package/dist/useCalendarEvents.d.cts +1 -1
- package/dist/useCalendarEvents.d.ts +1 -1
- package/dist/useCollapsePanel.d.cts +2 -2
- package/dist/useCollapsePanel.d.ts +2 -2
- package/dist/useCropperCore.d.cts +6 -6
- package/dist/useCropperCore.d.ts +6 -6
- package/dist/useDraggableLayout.d.cts +5 -5
- package/dist/useDraggableLayout.d.ts +5 -5
- package/dist/useDynamicFormState.d.cts +27 -7
- package/dist/useDynamicFormState.d.ts +27 -7
- package/dist/useEdgeInteraction.d.cts +2 -2
- package/dist/useEdgeInteraction.d.ts +2 -2
- package/dist/useInfiniteScroll.d.cts +2 -2
- package/dist/useInfiniteScroll.d.ts +2 -2
- package/dist/useQRCode.d.cts +2 -2
- package/dist/useQRCode.d.ts +2 -2
- package/dist/useSearchState.d.cts +19 -19
- package/dist/useSearchState.d.ts +19 -19
- package/dist/useSignatureHistory.d.cts +2 -2
- package/dist/useSignatureHistory.d.ts +2 -2
- package/dist/useSplitResize.d.cts +4 -4
- package/dist/useSplitResize.d.ts +4 -4
- package/dist/useTableQuery.d.cts +1 -1
- package/dist/useTableQuery.d.ts +1 -1
- package/dist/useTreeOperations.d.cts +9 -9
- package/dist/useTreeOperations.d.ts +9 -9
- package/dist/useWorkflowValidation.d.cts +2 -2
- package/dist/useWorkflowValidation.d.ts +2 -2
- package/dist/verification.d.cts +2 -2
- package/dist/verification.d.ts +2 -2
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @robot-admin/naive-ui-components
|
|
2
2
|
|
|
3
|
+
## 0.13.7
|
|
4
|
+
|
|
5
|
+
- `C_Form` 正式集成 `@robot-admin/form-validate@3.4.2`,统一消费原生规则、验证库规则和 `RuleSpec`,并通过表单入口导出已适配的 `PRESET_RULES`、`NAIVE_COMBOS` 与 `SPEC_RULES`。
|
|
6
|
+
- 提供默认步骤提交按钮和 `action-extra` 业务操作插槽,复用组件内部的校验、防重复提交、加载与错误反馈;成功/重置提示由业务按需配置。
|
|
7
|
+
- 修复规则回调异常后提交跳过校验的问题;提交支持取消信号,组件卸载后不继续触发提交事件或成功提示,禁用/只读状态不能通过实例方法绕过。
|
|
8
|
+
|
|
3
9
|
## 0.13.6
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -198,7 +198,42 @@ import '@robot-admin/naive-ui-components/C_Table/base.css'
|
|
|
198
198
|
</template>
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
|
|
201
|
+
表单已内置 `@robot-admin/form-validate`,使用侧无需另写类型适配,也不用重复安装验证依赖。`rules` / `rulesWhen` 直接接受 Naive UI 原生规则、验证库的 `NaiveRule` 和框架无关的 `RuleSpec`,可以混用;`required: true` 同样复用验证库的空值判断,`0` 和 `false` 不会被误判为空。
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
import {
|
|
205
|
+
defineFormOptions,
|
|
206
|
+
PRESET_RULES,
|
|
207
|
+
NAIVE_COMBOS,
|
|
208
|
+
SPEC_RULES,
|
|
209
|
+
} from '@robot-admin/naive-ui-components/C_Form'
|
|
210
|
+
|
|
211
|
+
const fields = defineFormOptions([
|
|
212
|
+
{
|
|
213
|
+
type: 'input',
|
|
214
|
+
prop: 'name',
|
|
215
|
+
label: '名称',
|
|
216
|
+
required: true,
|
|
217
|
+
rules: [SPEC_RULES.length('名称', 2, 20)],
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
type: 'input',
|
|
221
|
+
prop: 'email',
|
|
222
|
+
label: '邮箱',
|
|
223
|
+
rules: NAIVE_COMBOS.email('邮箱'),
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
type: 'input',
|
|
227
|
+
prop: 'mobile',
|
|
228
|
+
label: '手机号',
|
|
229
|
+
rules: [PRESET_RULES.mobile('手机号')],
|
|
230
|
+
},
|
|
231
|
+
])
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
普通表单默认提供提交与重置,步骤表单最后一步默认提供提交按钮。只需配置 `submitText`、`resetText` 和 `onSubmit`;要增加预览等业务操作,使用 `action-extra` 插槽即可保留默认按钮和加载管理。需要完全定制时仍可覆盖 `action` / `step-actions`,并调用插槽的 `submit()`,不要用 `validate()` 代替提交。
|
|
235
|
+
|
|
236
|
+
异步保存放在 `config.onSubmit` 中并等待完成;`@submit` 是完成后的通知事件,不等待监听器返回的 Promise。第二参数提供 `context?.signal`,可直接传给支持取消的请求;组件卸载会发出取消信号,并停止晚到的提交事件和提示。`submitSuccessText` / `resetSuccessText` 为可选反馈文案,默认不显示成功提示,也不代表数据已持久化。
|
|
202
237
|
|
|
203
238
|
新增/编辑场景推荐用 `C_FormModal` 直接消费 Headless CRUD 的结构化 `editor`。字段、校验和布局继续由 `C_Form` 配置驱动,页面不再重复编写 Modal、按钮、loading 和草稿状态;默认采用紧凑小尺寸表单和右下角带图标操作按钮,宽度、表单尺寸与动作文案仍可覆盖:
|
|
204
239
|
|
package/README_EN.md
CHANGED
|
@@ -166,7 +166,42 @@ const { model, formRef, bindings } = useCForm({
|
|
|
166
166
|
})
|
|
167
167
|
```
|
|
168
168
|
|
|
169
|
-
|
|
169
|
+
`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.
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
import {
|
|
173
|
+
defineFormOptions,
|
|
174
|
+
PRESET_RULES,
|
|
175
|
+
NAIVE_COMBOS,
|
|
176
|
+
SPEC_RULES,
|
|
177
|
+
} from '@robot-admin/naive-ui-components/C_Form'
|
|
178
|
+
|
|
179
|
+
const fields = defineFormOptions([
|
|
180
|
+
{
|
|
181
|
+
type: 'input',
|
|
182
|
+
prop: 'name',
|
|
183
|
+
label: 'Name',
|
|
184
|
+
required: true,
|
|
185
|
+
rules: [SPEC_RULES.length('Name', 2, 20)],
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
type: 'input',
|
|
189
|
+
prop: 'email',
|
|
190
|
+
label: 'Email',
|
|
191
|
+
rules: NAIVE_COMBOS.email('Email'),
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
type: 'input',
|
|
195
|
+
prop: 'mobile',
|
|
196
|
+
label: 'Mobile',
|
|
197
|
+
rules: [PRESET_RULES.mobile('Mobile')],
|
|
198
|
+
},
|
|
199
|
+
])
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
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.
|
|
203
|
+
|
|
204
|
+
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.
|
|
170
205
|
|
|
171
206
|
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:
|
|
172
207
|
|