@kong-ui-public/freeform 0.10.0 → 0.11.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/README.md +19 -0
- package/dist/filler/cypress/index.js +1 -1
- package/dist/filler/{field-walker-DB8aXUj-.js → field-walker-BmTo4SFN.js} +4991 -4870
- package/dist/filler/packages/core/freeform/src/composables/errors.d.ts +27 -0
- package/dist/filler/packages/core/freeform/src/composables/errors.d.ts.map +1 -0
- package/dist/filler/packages/core/freeform/src/composables/field.d.ts +6 -0
- package/dist/filler/packages/core/freeform/src/composables/field.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/composables/form-context.d.ts +13 -1
- package/dist/filler/packages/core/freeform/src/composables/form-context.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/composables/useMapField.d.ts +6 -0
- package/dist/filler/packages/core/freeform/src/composables/useMapField.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/types.d.ts +8 -0
- package/dist/filler/packages/core/freeform/src/types.d.ts.map +1 -1
- package/dist/filler/playwright/index.js +1 -1
- package/dist/freeform.es.js +1940 -1740
- package/dist/freeform.umd.js +5 -5
- package/dist/style.css +1 -1
- package/dist/types/components/ArrayField.vue.d.ts.map +1 -1
- package/dist/types/components/BooleanField.vue.d.ts +2 -2
- package/dist/types/components/BooleanField.vue.d.ts.map +1 -1
- package/dist/types/components/EnumField.vue.d.ts.map +1 -1
- package/dist/types/components/FieldErrors.vue.d.ts +10 -0
- package/dist/types/components/FieldErrors.vue.d.ts.map +1 -0
- package/dist/types/components/Form.vue.d.ts +15 -2
- package/dist/types/components/Form.vue.d.ts.map +1 -1
- package/dist/types/components/JsonField.vue.d.ts.map +1 -1
- package/dist/types/components/MapField.vue.d.ts.map +1 -1
- package/dist/types/components/NumberField.vue.d.ts.map +1 -1
- package/dist/types/components/ObjectField.vue.d.ts.map +1 -1
- package/dist/types/components/StringArrayField.vue.d.ts.map +1 -1
- package/dist/types/components/StringField.vue.d.ts.map +1 -1
- package/dist/types/components/SwitchField.vue.d.ts.map +1 -1
- package/dist/types/composables/errors.d.ts +27 -0
- package/dist/types/composables/errors.d.ts.map +1 -0
- package/dist/types/composables/field.d.ts +6 -0
- package/dist/types/composables/field.d.ts.map +1 -1
- package/dist/types/composables/form-context.d.ts +13 -1
- package/dist/types/composables/form-context.d.ts.map +1 -1
- package/dist/types/composables/useMapField.d.ts +6 -0
- package/dist/types/composables/useMapField.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +8 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,6 +44,7 @@ src/
|
|
|
44
44
|
├── ForeignField.vue # Foreign entity reference (stores {id: string})
|
|
45
45
|
├── ExpressionEditor.vue # The collapsible expression editor; StringField/NumberField render one inline, or a host places it itself
|
|
46
46
|
├── EnhancedInput.vue # Base input wrapper (help text, errors, tooltips)
|
|
47
|
+
├── FieldErrors.vue # The list of a field's errors, rendered under its control
|
|
47
48
|
├── SwitchField.vue # Boolean toggle switch (KInputSwitch)
|
|
48
49
|
├── SlideTransition.vue # Height-animated collapse transition
|
|
49
50
|
├── EntityChecksAlert.vue (+ .spec.ts) # Validation constraint alerts
|
|
@@ -354,6 +355,24 @@ The field names in an entity checks alert (`EntityChecksAlert`, shown at the top
|
|
|
354
355
|
|
|
355
356
|
A custom container opens itself for a reveal through `useField(name).revealTarget`: the path being revealed while it is the field itself or inside it, `null` otherwise. Containers that are not field paths (custom tabs and sections) are not supported yet.
|
|
356
357
|
|
|
358
|
+
### Field Errors
|
|
359
|
+
|
|
360
|
+
`Form` takes `errors`, a list of `{ path, message }` with data paths in the [Field Navigation](#field-navigation) format, and shows each one under the field it belongs to. Try it in the sandbox's **Field errors** page.
|
|
361
|
+
|
|
362
|
+
```vue
|
|
363
|
+
<Form v-model:errors="errors" :schema="schema" :data="data" />
|
|
364
|
+
<!-- errors: [{ path: 'config.redis.host', message: 'required field missing' }] -->
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
| Rule | Detail |
|
|
368
|
+
|---|---|
|
|
369
|
+
| Display only | The form only shows the errors. Turning a server response into `errors`, and when to set or clear them, is up to the host. Showing errors and revealing fields are separate: a host that lists the errors can call `reveal(error.path)` when one is clicked |
|
|
370
|
+
| Where an error shows | A field shows its own errors. A record, array or map shows only errors on itself, never a count of the ones inside. A set or a JSON field is one field, so it also shows the errors of its items (`tags.1`) |
|
|
371
|
+
| Structure changes | An error belongs to the item it was raised on, not to its index. When an array item or a map entry is removed through the form, its errors are dropped and the errors of later array items move to their new index; when a map key is renamed, its errors follow it. The form emits the new list through `update:errors`, so bind `v-model:errors`. Whether an error still holds after the user edits the value is not decided here: that is up to the host |
|
|
372
|
+
| Unmatched errors | An error no field can show in the current state — its path is malformed or not in the schema, names a map key that isn't in the data, sits under a record or array item without a value, or is hidden by a render rule — is left out of the form and listed in the exposed `unmatchedErrors`, for the host to show elsewhere |
|
|
373
|
+
|
|
374
|
+
A custom field component gets its errors from `useField(name)`: `fieldErrors` (its own and those below it), `ownFieldErrors`, and `fieldErrorMessage` (`fieldErrors` as one line). The `FieldErrors` component renders a list of them.
|
|
375
|
+
|
|
357
376
|
## Filler (test utilities)
|
|
358
377
|
|
|
359
378
|
Auto-fill utilities for Cypress and Playwright tests. A framework-agnostic core with framework-specific adapters — depends only on `form-schema.ts` and other generic primitives, no plugin/layout knowledge.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as l, i as w, c as S, g as k, E as A, w as v, a as x, b as E, d as I } from "../field-walker-
|
|
1
|
+
import { s as l, i as w, c as S, g as k, E as A, w as v, a as x, b as E, d as I } from "../field-walker-BmTo4SFN.js";
|
|
2
2
|
import "lodash-es";
|
|
3
3
|
const a = { scrollBehavior: "center" };
|
|
4
4
|
function m(o) {
|