@kong-ui-public/freeform 0.11.1 → 0.12.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 +5 -2
- package/dist/filler/cypress/index.js +1 -1
- package/dist/filler/{field-walker-Br7Nv34c.js → field-walker-D8i4HBJh.js} +4860 -6371
- package/dist/filler/packages/core/freeform/src/composables/errors.d.ts +7 -1
- package/dist/filler/packages/core/freeform/src/composables/errors.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/composables/field.d.ts +7 -1
- 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 +2 -0
- package/dist/filler/packages/core/freeform/src/composables/form-context.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/composables/index.d.ts +1 -0
- package/dist/filler/packages/core/freeform/src/composables/index.d.ts.map +1 -1
- package/dist/filler/packages/core/freeform/src/composables/reveal-open.d.ts +15 -0
- package/dist/filler/packages/core/freeform/src/composables/reveal-open.d.ts.map +1 -0
- package/dist/filler/packages/core/freeform/src/composables/reveal.d.ts +7 -0
- package/dist/filler/packages/core/freeform/src/composables/reveal.d.ts.map +1 -1
- package/dist/filler/playwright/index.js +1 -1
- package/dist/freeform.es.js +1606 -1563
- package/dist/freeform.umd.js +5 -5
- package/dist/style.css +1 -1
- package/dist/types/composables/errors.d.ts +7 -1
- package/dist/types/composables/errors.d.ts.map +1 -1
- package/dist/types/composables/field.d.ts +7 -1
- package/dist/types/composables/field.d.ts.map +1 -1
- package/dist/types/composables/form-context.d.ts +2 -0
- package/dist/types/composables/form-context.d.ts.map +1 -1
- package/dist/types/composables/index.d.ts +1 -0
- package/dist/types/composables/index.d.ts.map +1 -1
- package/dist/types/composables/reveal-open.d.ts +15 -0
- package/dist/types/composables/reveal-open.d.ts.map +1 -0
- package/dist/types/composables/reveal.d.ts +7 -0
- package/dist/types/composables/reveal.d.ts.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -132,6 +132,7 @@ All exports below are re-exported from the package root (`render-rules.ts` only
|
|
|
132
132
|
| File | Exports | Purpose |
|
|
133
133
|
|---|---|---|
|
|
134
134
|
| `form-context.ts` | `provideFormShared()`, `useFormShared()` | Central form state: reactive data, schema, config, render rules, getValue/setValue, getEmptyOrDefault/getEmptyValue |
|
|
135
|
+
| `reveal-open.ts` | `useRevealOpen(container, open)` | Opens a section that keeps its fields mounted while closed (e.g. `KCollapse`) when a reveal heads for a field inside it |
|
|
135
136
|
| `field.ts` | `useField(name)` | Individual field state: value, schema, path, renderer, error, ancestors, emptyOrDefaultValue, emptyValue |
|
|
136
137
|
| `field-path.ts` | `useFieldPath()` | Calculates absolute dot-notation path from parent context via provide/inject |
|
|
137
138
|
| `schema.ts` | `useSchemaHelpers()` | Schema introspection: getSchema, getDefault, getEmptyOrDefault, getEmptyValue, getSelectItems, getLabelAttributes |
|
|
@@ -353,7 +354,9 @@ const result = await formRef.value?.reveal('config.redis.host')
|
|
|
353
354
|
|
|
354
355
|
The field names in an entity checks alert (`EntityChecksAlert`, shown at the top of a record) are links that reveal the field, resolved against the record's path, e.g. `redis.host` on `config` reveals `config.redis.host`.
|
|
355
356
|
|
|
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.
|
|
357
|
+
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.
|
|
358
|
+
|
|
359
|
+
A section that is not a field path but keeps its fields mounted while closed (e.g. `KCollapse`, which uses `v-show`) opens itself with `useRevealOpen(container, open)`: `open` is called when the field that renders the target is inside `container`. The form knows which field that is because every mounted field registers itself, and a record split with `omit` covers only the fields it renders. Try it in the sandbox's **Split fields** page. A section that unmounts its fields while closed is not supported.
|
|
357
360
|
|
|
358
361
|
### Field Errors
|
|
359
362
|
|
|
@@ -369,7 +372,7 @@ A custom container opens itself for a reveal through `useField(name).revealTarge
|
|
|
369
372
|
| 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
373
|
| 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
374
|
| 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,
|
|
375
|
+
| 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, is hidden by a render rule, or is rendered by no mounted field (e.g. every record that could show it leaves it out with `omit`) — is left out of the form and listed in the exposed `unmatchedErrors`, for the host to show elsewhere |
|
|
373
376
|
|
|
374
377
|
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
378
|
|
|
@@ -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-D8i4HBJh.js";
|
|
2
2
|
import "lodash-es";
|
|
3
3
|
const a = { scrollBehavior: "center" };
|
|
4
4
|
function m(o) {
|