foldkit-mixins-form 0.1.1 → 0.1.2
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 +24 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -44,6 +44,27 @@ a Style can depend on `input.invalid` or `input.control`.
|
|
|
44
44
|
pnpm add effect foldkit foldkit-bundle foldkit-form foldkit-mixins foldkit-mixins-form
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
+
## Start without customization
|
|
48
|
+
|
|
49
|
+
Given `Edit`, a `Form.make` result from the
|
|
50
|
+
[Form example](../form/README.md#example), the default rendering path is:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { Bundle } from 'foldkit-bundle'
|
|
54
|
+
import { FormView } from 'foldkit-mixins-form'
|
|
55
|
+
|
|
56
|
+
const Drawn = Edit.bundle.pipe(
|
|
57
|
+
Bundle.withView(FormView.submodel(Edit, FormView.define(Edit))),
|
|
58
|
+
)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Declare and place `Drawn` using the normal Bundle API, with the form's `onOut`
|
|
62
|
+
handler. Rendering that placement shows the controls; typing routes the form's
|
|
63
|
+
Messages to its reducer; submitting a valid form sends its decoded value to
|
|
64
|
+
`onOut`. No request is made unless that handler returns one.
|
|
65
|
+
|
|
66
|
+
The next example replaces this unstyled `Drawn` with field and form styles.
|
|
67
|
+
|
|
47
68
|
## Example
|
|
48
69
|
|
|
49
70
|
`Edit` is a `Form.make` result, as in the
|
|
@@ -71,7 +92,9 @@ const View = FormView.define(Edit, { field: Field }).pipe(
|
|
|
71
92
|
const Drawn = Edit.bundle.pipe(Bundle.withView(FormView.submodel(Edit, View)))
|
|
72
93
|
```
|
|
73
94
|
|
|
74
|
-
|
|
95
|
+
In the following integration fragment, `EditForm` is the placement of `Drawn`,
|
|
96
|
+
`model` and `h` are the parent view arguments, and `authors` is the loaded picker
|
|
97
|
+
data. Where the parent draws the placement:
|
|
75
98
|
|
|
76
99
|
```ts
|
|
77
100
|
EditForm.view(model, h, {
|
|
@@ -98,7 +121,6 @@ EditForm.view(model, h, {
|
|
|
98
121
|
| `Select` | `select` of the control's own options, with a blank while nothing is chosen | `select` |
|
|
99
122
|
| `RelationOne` | `select` of `options[key]`, with a blank | `select` |
|
|
100
123
|
| `RelationMany` | a `role="group"` of checkboxes over `options[key]` | `choices`, `choice` |
|
|
101
|
-
|
|
102
124
|
| `Nested` | a `fieldset` with a `legend`, a `div` per row holding the nested form's fields, and `button type="button"`s to add and remove a row | `group`, `legend`, `row`, `add`, `remove` |
|
|
103
125
|
|
|
104
126
|
A `RelationOne` or `RelationMany` that searches (`Input.search()`) gets an
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit-mixins-form",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "A foldkit-form form drawn through foldkit-mixins slots: styleable, extensible, and accessible by contract.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foldkit",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"foldkit-bundle": "0.2.0",
|
|
42
|
-
"foldkit-form": "0.1.
|
|
42
|
+
"foldkit-form": "0.1.2",
|
|
43
43
|
"foldkit-mixins": "0.3.0"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"jsdom": "26.1.0",
|
|
53
53
|
"tsdown": "^0.23.0",
|
|
54
54
|
"typescript": "5.9.3",
|
|
55
|
-
"foldkit-entity": "0.
|
|
55
|
+
"foldkit-entity": "0.3.0"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"build": "tsdown",
|