Document auto-increment form visibility
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
# Hide Auto-Increment IDs in Create Forms
|
||||
|
||||
## Goal
|
||||
|
||||
Generated Qing management pages must not ask users to enter an auto-increment primary key when creating a record.
|
||||
|
||||
## Chosen behavior
|
||||
|
||||
- Create mode: hide every column whose `isIncrement` value is `"1"`.
|
||||
- Edit mode: show the auto-increment primary key as read-only.
|
||||
- View mode: show the auto-increment primary key as read-only.
|
||||
- List and detail displays remain unchanged.
|
||||
- Non-auto-increment primary keys keep their existing form behavior.
|
||||
|
||||
This preserves record identity during editing and viewing while removing an invalid input from creation.
|
||||
|
||||
## Considered approaches
|
||||
|
||||
1. Hide auto-increment IDs only in create mode. This is the selected approach because it fixes the usability problem without removing useful record identity from edit and view dialogs.
|
||||
2. Hide auto-increment IDs in every form mode. This is simpler but makes edit and view dialogs less informative.
|
||||
3. Remove auto-increment columns from generated form metadata. This would also remove them from edit and view modes and would make page-designer overrides harder to honor.
|
||||
|
||||
## Template behavior
|
||||
|
||||
The Qing Vue template will decide field visibility at runtime:
|
||||
|
||||
- A form field still needs to qualify under the existing designed/default form rules.
|
||||
- If the field is auto-increment and the dialog is in create mode, it is not rendered.
|
||||
- If the field is auto-increment and the dialog is in edit or view mode, it is rendered with a disabled input.
|
||||
- Required-field validation must not be attached to an auto-increment field.
|
||||
|
||||
The existing `form.<primaryKey>` value distinguishes create mode from edit/view mode.
|
||||
|
||||
## Scope
|
||||
|
||||
The change applies to generated Qing frontend and admin-frontend CRUD pages that use `qing/index.vue.vm`.
|
||||
|
||||
It does not change:
|
||||
|
||||
- database schemas;
|
||||
- entity or controller generation;
|
||||
- insert/update payload handling;
|
||||
- list columns;
|
||||
- detail pages;
|
||||
- manually authored applications.
|
||||
|
||||
## Tests
|
||||
|
||||
Template rendering tests will verify:
|
||||
|
||||
- an auto-increment primary key is conditionally hidden in create mode;
|
||||
- the same field is present and disabled in edit/view mode;
|
||||
- it has no required validation rule;
|
||||
- a non-auto-increment primary key keeps its existing behavior;
|
||||
- ordinary editable fields continue to render normally.
|
||||
|
||||
After template tests pass, regenerate or patch the current project 106 preview and verify the book create dialog no longer shows the ID field.
|
||||
Reference in New Issue
Block a user