foldkit-form 0.11.0 → 0.13.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 +149 -15
- package/dist/index.d.ts +30 -15
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +44 -10
- package/dist/index.js.map +1 -1
- package/dist/input.d.ts +5 -1
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -96,7 +96,8 @@ const RenameForm = Page.children.rename
|
|
|
96
96
|
list, both to the draft as it stands when the Message lands, so a view sends
|
|
97
97
|
them for a press: two presses before the next draw both count. `FollowedIssue({ id })`
|
|
98
98
|
says a view's link to a field was followed, and `AskedForMore({ key })` that a
|
|
99
|
-
relation picker's reader wants more choices
|
|
99
|
+
relation picker's reader wants more choices (its `key` is typed by the
|
|
100
|
+
form's relation keys); the form changes nothing for
|
|
100
101
|
either, and the page that owns the list answers the second.
|
|
101
102
|
- `Rename.controls` lists the keys in the input's order, each with its
|
|
102
103
|
`control`, `label`, `description`, `required`, and the Entity `member`.
|
|
@@ -174,6 +175,55 @@ drawn alike (`'1'` and `1`) are refused when the control is made.
|
|
|
174
175
|
|
|
175
176
|
### Your own kind of control
|
|
176
177
|
|
|
178
|
+
<!-- docs-check standalone
|
|
179
|
+
import { Schema } from 'effect'
|
|
180
|
+
import { Bundle } from 'foldkit-bundle'
|
|
181
|
+
import { Entity, Relation } from 'foldkit-entity'
|
|
182
|
+
import { Form, Input } from 'foldkit-form'
|
|
183
|
+
import { defineMessageUnion } from 'foldkit/message'
|
|
184
|
+
|
|
185
|
+
const ColorModel = Schema.Struct({
|
|
186
|
+
open: Schema.Boolean,
|
|
187
|
+
hex: Schema.String,
|
|
188
|
+
recent: Schema.Array(Schema.String),
|
|
189
|
+
})
|
|
190
|
+
const ColorMessage = defineMessageUnion({ Opened: {}, Chose: { hex: Schema.String } })
|
|
191
|
+
const ColorPicker = Bundle.make({
|
|
192
|
+
name: 'ColorPicker',
|
|
193
|
+
Model: ColorModel,
|
|
194
|
+
Message: ColorMessage,
|
|
195
|
+
init: () => ({ model: { open: false, hex: '#000000', recent: [] } }),
|
|
196
|
+
update: (model: typeof ColorModel.Type, message: typeof ColorMessage.Type) =>
|
|
197
|
+
message._tag === 'Opened'
|
|
198
|
+
? { model: { ...model, open: true } }
|
|
199
|
+
: { model: { ...model, hex: message.hex } },
|
|
200
|
+
})
|
|
201
|
+
const Writer = Entity.define('Writer', Schema.Struct({ id: Schema.String, name: Schema.String }))
|
|
202
|
+
const Article = Entity.define(
|
|
203
|
+
'Article',
|
|
204
|
+
Schema.Struct({
|
|
205
|
+
id: Schema.String,
|
|
206
|
+
title: Schema.String,
|
|
207
|
+
slug: Schema.String,
|
|
208
|
+
cents: Schema.Number,
|
|
209
|
+
color: Schema.String,
|
|
210
|
+
}),
|
|
211
|
+
)
|
|
212
|
+
const Blog = Entity.relate({ Writer, Article }, { Article: { author: Relation.one(Writer) } })
|
|
213
|
+
const input = Entity.input(
|
|
214
|
+
Blog.Article,
|
|
215
|
+
Schema.Struct({
|
|
216
|
+
title: Schema.String,
|
|
217
|
+
slug: Schema.String,
|
|
218
|
+
cents: Schema.Number,
|
|
219
|
+
color: Schema.String,
|
|
220
|
+
authorId: Schema.String,
|
|
221
|
+
}),
|
|
222
|
+
{ authorId: Relation.input(Blog.Article.relations.author) },
|
|
223
|
+
)
|
|
224
|
+
const slugify = (text: string): string => text.toLowerCase()
|
|
225
|
+
-->
|
|
226
|
+
|
|
177
227
|
The kinds above are made with `Input.kind`, and so is a date picker, a rich text
|
|
178
228
|
editor, or a price:
|
|
179
229
|
|
|
@@ -188,8 +238,9 @@ const Cents = Input.kind<{ readonly currency: string }>('Cents', {
|
|
|
188
238
|
unparsed: 'Enter an amount',
|
|
189
239
|
})
|
|
190
240
|
|
|
191
|
-
Form.make('Price', input, { inputs: { cents: Cents.of({ currency: 'USD' }) } })
|
|
241
|
+
const Price = Form.make('Price', input, { inputs: { cents: Cents.of({ currency: 'USD' }) } })
|
|
192
242
|
|
|
243
|
+
const { control } = Price.controlsByKey.cents
|
|
193
244
|
Cents.is(control) && control.data.currency // 'USD'
|
|
194
245
|
```
|
|
195
246
|
|
|
@@ -231,7 +282,7 @@ const ColorInput = Input.bundle('ColorPicker', {
|
|
|
231
282
|
const PostForm = Form.make('PostForm', input, { inputs: { color: ColorInput } })
|
|
232
283
|
const color = PostForm.control('color')
|
|
233
284
|
|
|
234
|
-
color.field(
|
|
285
|
+
color.field(PostForm.initial) // { _tag, value: { open, hex, recent } }: validation state, the Model as value
|
|
235
286
|
color.send(ColorMessage.Opened()) // the form's Message carrying one of the picker's own
|
|
236
287
|
```
|
|
237
288
|
|
|
@@ -256,8 +307,9 @@ What the form does with it:
|
|
|
256
307
|
without one the key is validated (a required key then says `Required`) and
|
|
257
308
|
nothing is submitted. A control in a row holds the submit the same way. Give
|
|
258
309
|
a busy control `settled` too, which says whether a stored value shown again
|
|
259
|
-
needs work: `
|
|
260
|
-
for
|
|
310
|
+
needs work: `busy` without it is a type error (reported at the call), and
|
|
311
|
+
`Input.bundle` throws on it for an untyped caller, since such a form would
|
|
312
|
+
wait for good.
|
|
261
313
|
- **Nothing entered** is `value` giving `undefined` or `null`, which a required
|
|
262
314
|
key refuses as it would an empty text box.
|
|
263
315
|
- **Types follow the control.** `model.fields.color.value` is the picker's
|
|
@@ -275,14 +327,14 @@ A slug is its title until the author decides otherwise. `Input.following` keeps
|
|
|
275
327
|
the key's own control and writes its draft from another key:
|
|
276
328
|
|
|
277
329
|
```ts
|
|
278
|
-
const
|
|
330
|
+
const SlugForm = Form.make('SlugForm', input, {
|
|
279
331
|
inputs: { slug: Input.following('title', slugify) },
|
|
280
332
|
})
|
|
281
333
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
334
|
+
SlugForm.isFollowing(SlugForm.initial, 'slug') // false once the author has written it
|
|
335
|
+
SlugForm.partial(SlugForm.initial) // what decodes as it stands, by key: for saving unfinished work
|
|
336
|
+
SlugForm.settled(SlugForm.initial) // a stored Model, shown again with no check or submit in flight
|
|
337
|
+
SlugForm.Message.Refused({ key: 'slug', error: 'That address is taken', value: 'hello' }) // a server's word on the value sent
|
|
286
338
|
```
|
|
287
339
|
|
|
288
340
|
- While the author has not written the key, each edit of the key it follows
|
|
@@ -305,7 +357,8 @@ key's picker and gives it a search:
|
|
|
305
357
|
```ts
|
|
306
358
|
const EditPost = Form.make('EditPost', input, { inputs: { authorId: Input.search() } })
|
|
307
359
|
|
|
308
|
-
EditPost.Message.Searched({ key: 'authorId', text: 'ad' })
|
|
360
|
+
const searched = EditPost.Message.Searched({ key: 'authorId', text: 'ad' })
|
|
361
|
+
const { model } = EditPost.bundle.update(EditPost.initial, searched, undefined)
|
|
309
362
|
EditPost.search(model, 'authorId') // 'ad'
|
|
310
363
|
```
|
|
311
364
|
|
|
@@ -399,7 +452,24 @@ is [Errors and failures](../../docs/errors.md#forms).
|
|
|
399
452
|
Whether a slug is taken is not in the schema. A check is an Effect the form is
|
|
400
453
|
given; it answers with what is wrong, or nothing:
|
|
401
454
|
|
|
455
|
+
<!-- docs-check standalone
|
|
456
|
+
import { Effect, Schema } from 'effect'
|
|
457
|
+
import { Entity } from 'foldkit-entity'
|
|
458
|
+
import { Form } from 'foldkit-form'
|
|
459
|
+
|
|
460
|
+
const Post = Entity.define(
|
|
461
|
+
'Post',
|
|
462
|
+
Schema.Struct({ id: Schema.String, title: Schema.String, slug: Schema.String }),
|
|
463
|
+
)
|
|
464
|
+
const PostInput = Schema.Struct({ id: Schema.String, slug: Schema.String })
|
|
465
|
+
const RenameInput = Schema.Struct({ id: Schema.String, title: Post.fields.title.schema })
|
|
466
|
+
declare const isSlugTaken: (slug: string, except: string | undefined) => Effect.Effect<boolean>
|
|
467
|
+
declare const isAddressFree: (slug: string) => Effect.Effect<string | undefined>
|
|
468
|
+
-->
|
|
469
|
+
|
|
402
470
|
```ts
|
|
471
|
+
import { Effect } from 'effect'
|
|
472
|
+
|
|
403
473
|
const PostForm = Form.make('PostForm', Entity.input(Post, PostInput), {
|
|
404
474
|
checks: {
|
|
405
475
|
// The decoded value, and whatever else in the form decodes right now.
|
|
@@ -412,6 +482,12 @@ const PostForm = Form.make('PostForm', Entity.input(Post, PostInput), {
|
|
|
412
482
|
})
|
|
413
483
|
```
|
|
414
484
|
|
|
485
|
+
`submitWaits: false` refuses a submit made while a check runs instead of
|
|
486
|
+
holding it for the answer (the default); `canSubmit` is then false until the
|
|
487
|
+
checks answer. A checked key that has never been checked, as in a form filled
|
|
488
|
+
from an existing record, cannot submit at rest then: the first submit only
|
|
489
|
+
starts its check and is refused, and the reader submits again after the answer.
|
|
490
|
+
|
|
415
491
|
- A check runs **after** the key's own schema passes, never instead of it, so it
|
|
416
492
|
receives a decoded value: a number, not the text that was typed.
|
|
417
493
|
- While it runs the key reads `Validating`, which is Foldkit core's own state for
|
|
@@ -424,7 +500,7 @@ const PostForm = Form.make('PostForm', Entity.input(Post, PostInput), {
|
|
|
424
500
|
`never`"). The step reads the requirement off the functions it is given.
|
|
425
501
|
|
|
426
502
|
```ts
|
|
427
|
-
const
|
|
503
|
+
const CheckedForm = Form.make('PostForm', Entity.input(Post, PostInput), {
|
|
428
504
|
debounce: 0,
|
|
429
505
|
}).pipe(Form.checks({ slug: isAddressFree }))
|
|
430
506
|
```
|
|
@@ -466,7 +542,7 @@ The form has three things to say for itself, and `messages` words them, or
|
|
|
466
542
|
rewrites what Schema says by default, which is also how a form is translated:
|
|
467
543
|
|
|
468
544
|
```ts
|
|
469
|
-
const
|
|
545
|
+
const Localized = Form.make('Rename', Entity.input(Post, RenameInput), {
|
|
470
546
|
messages: {
|
|
471
547
|
required: field => `${field.label} is missing`,
|
|
472
548
|
unparsed: field => `${field.label} must be a number`,
|
|
@@ -505,7 +581,11 @@ export const words = {
|
|
|
505
581
|
yes: 'Live', // foldkit-mixins-crud
|
|
506
582
|
empty: 'No posts yet.',
|
|
507
583
|
} satisfies FormMessages & FormViewWords & ViewWords
|
|
584
|
+
```
|
|
585
|
+
|
|
586
|
+
Each package takes the one object:
|
|
508
587
|
|
|
588
|
+
```ts sketch
|
|
509
589
|
Form.make('EditPost', input, { messages: words })
|
|
510
590
|
placed.view(model, h, { options, words })
|
|
511
591
|
PostTable({ page, words }, h)
|
|
@@ -518,6 +598,21 @@ PostTable({ page, words }, h)
|
|
|
518
598
|
Every option is also a pipe step that gives a new form, made from the same input
|
|
519
599
|
with that option added to:
|
|
520
600
|
|
|
601
|
+
<!-- docs-check standalone
|
|
602
|
+
import { Effect, Schema } from 'effect'
|
|
603
|
+
import { Entity } from 'foldkit-entity'
|
|
604
|
+
import { Form, Input } from 'foldkit-form'
|
|
605
|
+
|
|
606
|
+
const NewAuthor = Entity.input(
|
|
607
|
+
Entity.define(
|
|
608
|
+
'Writer',
|
|
609
|
+
Schema.Struct({ id: Schema.String, name: Schema.String, bio: Schema.String }),
|
|
610
|
+
),
|
|
611
|
+
Schema.Struct({ name: Schema.String, bio: Schema.String }),
|
|
612
|
+
)
|
|
613
|
+
const isNameTaken = (name: string): Effect.Effect<string | undefined> => Effect.succeed(undefined)
|
|
614
|
+
-->
|
|
615
|
+
|
|
521
616
|
```ts
|
|
522
617
|
const AuthorForm = Form.make('Author', NewAuthor) // as a library might hand it over
|
|
523
618
|
|
|
@@ -540,6 +635,21 @@ A key mapped with [`Relation.nested`](../entity/README.md#an-input-that-holds-th
|
|
|
540
635
|
holds the relation's target, not an id. **A nested form is a form**: the key
|
|
541
636
|
holds rows, each a Model of the form built from the nested input.
|
|
542
637
|
|
|
638
|
+
<!-- docs-check standalone
|
|
639
|
+
import { Schema } from 'effect'
|
|
640
|
+
import { Entity, Relation } from 'foldkit-entity'
|
|
641
|
+
import { Form, Input } from 'foldkit-form'
|
|
642
|
+
|
|
643
|
+
const Comment = Entity.define('Comment', Schema.Struct({ id: Schema.String, body: Schema.String }))
|
|
644
|
+
const Blog = Entity.relate(
|
|
645
|
+
{
|
|
646
|
+
Comment,
|
|
647
|
+
Post: Entity.define('BlogPost', Schema.Struct({ id: Schema.String, title: Schema.String })),
|
|
648
|
+
},
|
|
649
|
+
{ Post: { comments: Relation.many(Comment) } },
|
|
650
|
+
)
|
|
651
|
+
-->
|
|
652
|
+
|
|
543
653
|
```ts
|
|
544
654
|
const NewComment = Entity.input(Blog.Comment, Schema.Struct({ body: Schema.String }))
|
|
545
655
|
const CreatePost = Entity.input(
|
|
@@ -630,6 +740,29 @@ Listing.shows(Listing.initial, 'price') // false until Available is chosen
|
|
|
630
740
|
`fill` shows values as drafts, for an edit form. Keys you do not pass keep their
|
|
631
741
|
draft.
|
|
632
742
|
|
|
743
|
+
<!-- docs-check standalone
|
|
744
|
+
import { Schema } from 'effect'
|
|
745
|
+
import { Bundle } from 'foldkit-bundle'
|
|
746
|
+
import { Entity } from 'foldkit-entity'
|
|
747
|
+
import { Form } from 'foldkit-form'
|
|
748
|
+
|
|
749
|
+
const Post = Entity.define(
|
|
750
|
+
'Post',
|
|
751
|
+
Schema.Struct({ id: Schema.String, title: Schema.String }),
|
|
752
|
+
)
|
|
753
|
+
const RenameInput = Schema.Struct({ id: Schema.String, title: Post.fields.title.schema })
|
|
754
|
+
const Rename = Form.make('Rename', Entity.input(Post, RenameInput))
|
|
755
|
+
const Page = Bundle.compose({ saved: Schema.Array(RenameInput) }).pipe(
|
|
756
|
+
Bundle.withChild('rename', Rename.bundle, {
|
|
757
|
+
onOut: submitted => model => ({
|
|
758
|
+
model: { ...model, saved: [...model.saved, submitted.value] },
|
|
759
|
+
}),
|
|
760
|
+
}),
|
|
761
|
+
)
|
|
762
|
+
const RenameForm = Page.children.rename
|
|
763
|
+
declare const scheduleAutosave: () => void
|
|
764
|
+
-->
|
|
765
|
+
|
|
633
766
|
```ts
|
|
634
767
|
const load = RenameForm.helpers.fill({ id: 'p1', title: 'Hello' }) // an Update.Step of the page
|
|
635
768
|
```
|
|
@@ -654,8 +787,9 @@ A relation is loaded as a ref and read back as the id the form holds. See
|
|
|
654
787
|
what the author wrote:
|
|
655
788
|
|
|
656
789
|
```ts
|
|
657
|
-
const
|
|
658
|
-
|
|
790
|
+
const message = Rename.Message.Changed({ key: 'title', value: 'Hello' })
|
|
791
|
+
const next = Rename.bundle.update(Rename.initial, message, undefined)
|
|
792
|
+
if (Rename.authoredChanged(Rename.initial, next.model)) scheduleAutosave()
|
|
659
793
|
```
|
|
660
794
|
|
|
661
795
|
It compares the two Models, not the Message: validation state, search text, the
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BundleControl, BundleControlSpec, BundleData, Control, ControlChange, ControlKind, Draft, DraftKind, Follows, FormRow, Input, NestedData, NestedForm, RelationData } from "./input.js";
|
|
2
2
|
import { Duration, Effect, Option, Schema } from "effect";
|
|
3
3
|
import { Bundle } from "foldkit-bundle";
|
|
4
|
-
import { AnyEntity, Entity, EntityInput, InputMember, InputMembers, MemoryOperators, NestedInput } from "foldkit-entity";
|
|
4
|
+
import { AnyEntity, Entity, EntityInput, InputMember, InputMembers, MemoryOperators, NestedInput, RelationInput } from "foldkit-entity";
|
|
5
5
|
import { Metadata } from "foldkit-metadata";
|
|
6
6
|
import { Command } from "foldkit/command";
|
|
7
7
|
import * as FieldValidation from "foldkit/fieldValidation";
|
|
@@ -9,6 +9,8 @@ import * as FieldValidation from "foldkit/fieldValidation";
|
|
|
9
9
|
export type DraftOf<Value> = [Exclude<Value, null | undefined>] extends [boolean] ? boolean : [Exclude<Value, null | undefined>] extends [ReadonlyArray<unknown>] ? ReadonlyArray<string> : string;
|
|
10
10
|
/** The keys of an input that hold a nested input (`Relation.nested`): rows of a form, not a draft. */
|
|
11
11
|
export type NestedKey<Members> = { [K in keyof Members]: Members[K] extends NestedInput<any, any> ? K : never; }[keyof Members];
|
|
12
|
+
/** The keys of an input that pick a related row (a relation, not nested): its pickers. */
|
|
13
|
+
type RelationKey<Members> = { [K in keyof Members]: Members[K] extends RelationInput<any> ? K : never; }[keyof Members];
|
|
12
14
|
/** The Model of the form a nested key's rows hold. */
|
|
13
15
|
export type NestedModel<Member> = Member extends NestedInput<any, EntityInput<any, infer Fields, infer Members>> ? FormModel<Fields, Members> : never;
|
|
14
16
|
/** The controls a form may be given under `inputs`, by key. */
|
|
@@ -191,6 +193,17 @@ export interface FormOptions<Fields extends Schema.Struct.Fields, Members, R, Ne
|
|
|
191
193
|
readonly checks?: { readonly [K in Exclude<keyof Fields, NestedKey<Members>>]?: FormCheck<Schema.Schema.Type<Fields[K]>, Partial<Schema.Struct.Type<Fields>>, R>; };
|
|
192
194
|
/** How long a key rests before its check runs, so typing does not ask per keystroke. Default 300ms. */
|
|
193
195
|
readonly debounce?: Duration.Input;
|
|
196
|
+
/**
|
|
197
|
+
* Whether a submit made while a check runs waits for its answer (default
|
|
198
|
+
* `true`). `false` refuses it instead: nothing is handed out and nothing
|
|
199
|
+
* waits, the checks go on, and `canSubmit` is `false` until they answer. The
|
|
200
|
+
* refusal is the form's own, decided from the Model, so a submit sent before
|
|
201
|
+
* the frame that drew the button disabled is refused too. A checked key that
|
|
202
|
+
* has never been checked (a form filled from an existing record) therefore
|
|
203
|
+
* cannot submit at rest: the first submit only starts its check and is
|
|
204
|
+
* refused, and the reader submits again after the answer.
|
|
205
|
+
*/
|
|
206
|
+
readonly submitWaits?: boolean;
|
|
194
207
|
/**
|
|
195
208
|
* The form of a nested key, made with `Form.make` from the input the key nests
|
|
196
209
|
* (`Relation.nested(relation, input)`): the same form that edits the target
|
|
@@ -272,7 +285,7 @@ declare const Core: {
|
|
|
272
285
|
};
|
|
273
286
|
} | {
|
|
274
287
|
readonly _tag: "AskedForMore";
|
|
275
|
-
readonly key: Exclude<keyof Fields & string, NestedKey<Members
|
|
288
|
+
readonly key: Exclude<Extract<Exclude<keyof Fields & string, NestedKey<Members>>, RelationKey<Members>>, keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>>;
|
|
276
289
|
} | {
|
|
277
290
|
readonly _tag: "Blurred";
|
|
278
291
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -451,7 +464,7 @@ declare const Core: {
|
|
|
451
464
|
* `Crud.options`); the form changes nothing.
|
|
452
465
|
*/
|
|
453
466
|
AskedForMore: {
|
|
454
|
-
key: Schema.Literals<readonly [Exclude<keyof Fields & string, NestedKey<Members>>, ...Exclude<keyof Fields & string, NestedKey<Members
|
|
467
|
+
key: Schema.Literals<readonly [Exclude<Extract<Exclude<keyof Fields & string, NestedKey<Members>>, RelationKey<Members>>, keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>>, ...Exclude<Extract<Exclude<keyof Fields & string, NestedKey<Members>>, RelationKey<Members>>, keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>>[]]>;
|
|
455
468
|
};
|
|
456
469
|
}>;
|
|
457
470
|
/** The Command a key's check runs as, for a test to resolve (`Command.resolve(form.Check, …)`). */
|
|
@@ -519,7 +532,7 @@ declare const Core: {
|
|
|
519
532
|
};
|
|
520
533
|
} | {
|
|
521
534
|
readonly _tag: "AskedForMore";
|
|
522
|
-
readonly key: Exclude<keyof Fields & string, NestedKey<Members
|
|
535
|
+
readonly key: Exclude<Extract<Exclude<keyof Fields & string, NestedKey<Members>>, RelationKey<Members>>, keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>>;
|
|
523
536
|
} | {
|
|
524
537
|
readonly _tag: "Blurred";
|
|
525
538
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -599,7 +612,7 @@ declare const Core: {
|
|
|
599
612
|
};
|
|
600
613
|
} | {
|
|
601
614
|
readonly _tag: "AskedForMore";
|
|
602
|
-
readonly key: Exclude<keyof Fields & string, NestedKey<Members
|
|
615
|
+
readonly key: Exclude<Extract<Exclude<keyof Fields & string, NestedKey<Members>>, RelationKey<Members>>, keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>>;
|
|
603
616
|
} | {
|
|
604
617
|
readonly _tag: "Blurred";
|
|
605
618
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -667,7 +680,8 @@ declare const Core: {
|
|
|
667
680
|
rows: (model: FormModel<Fields, Members, ControlsOf<Inputs>>, key: Extract<keyof Fields & string, NestedKey<Members>>) => { readonly [K in keyof Fields as K extends NestedKey<Members> ? K : never]: readonly FormRow<NestedModel<Members[K & keyof Members]>>[]; }[Extract<keyof Fields & string, NestedKey<Members>>];
|
|
668
681
|
/**
|
|
669
682
|
* Whether a submit now could go through: nothing is invalid. A check still
|
|
670
|
-
* running does not stop it; the submit waits for the answer
|
|
683
|
+
* running does not stop it; the submit waits for the answer, unless the
|
|
684
|
+
* form was made with `submitWaits: false`, which refuses it.
|
|
671
685
|
*/
|
|
672
686
|
canSubmit: (model: FormModel<Fields, Members, ControlsOf<Inputs>>) => boolean;
|
|
673
687
|
/** Whether a submit was asked since the form started, was filled or was reset. */
|
|
@@ -713,7 +727,7 @@ declare const Core: {
|
|
|
713
727
|
};
|
|
714
728
|
} | {
|
|
715
729
|
readonly _tag: "AskedForMore";
|
|
716
|
-
readonly key: Exclude<keyof Fields & string, NestedKey<Members
|
|
730
|
+
readonly key: Exclude<Extract<Exclude<keyof Fields & string, NestedKey<Members>>, RelationKey<Members>>, keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>>;
|
|
717
731
|
} | {
|
|
718
732
|
readonly _tag: "Blurred";
|
|
719
733
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -787,7 +801,7 @@ declare const Core: {
|
|
|
787
801
|
};
|
|
788
802
|
} | {
|
|
789
803
|
readonly _tag: "AskedForMore";
|
|
790
|
-
readonly key: Exclude<keyof Fields & string, NestedKey<Members
|
|
804
|
+
readonly key: Exclude<Extract<Exclude<keyof Fields & string, NestedKey<Members>>, RelationKey<Members>>, keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>>;
|
|
791
805
|
} | {
|
|
792
806
|
readonly _tag: "Blurred";
|
|
793
807
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -945,7 +959,7 @@ export declare const Form: {
|
|
|
945
959
|
};
|
|
946
960
|
} | {
|
|
947
961
|
readonly _tag: "AskedForMore";
|
|
948
|
-
readonly key: Exclude<keyof Fields & string, NestedKey<Members
|
|
962
|
+
readonly key: Exclude<Extract<Exclude<keyof Fields & string, NestedKey<Members>>, RelationKey<Members>>, keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>>;
|
|
949
963
|
} | {
|
|
950
964
|
readonly _tag: "Blurred";
|
|
951
965
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -1124,7 +1138,7 @@ export declare const Form: {
|
|
|
1124
1138
|
* `Crud.options`); the form changes nothing.
|
|
1125
1139
|
*/
|
|
1126
1140
|
AskedForMore: {
|
|
1127
|
-
key: Schema.Literals<readonly [Exclude<keyof Fields & string, NestedKey<Members>>, ...Exclude<keyof Fields & string, NestedKey<Members
|
|
1141
|
+
key: Schema.Literals<readonly [Exclude<Extract<Exclude<keyof Fields & string, NestedKey<Members>>, RelationKey<Members>>, keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>>, ...Exclude<Extract<Exclude<keyof Fields & string, NestedKey<Members>>, RelationKey<Members>>, keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>>[]]>;
|
|
1128
1142
|
};
|
|
1129
1143
|
}>;
|
|
1130
1144
|
/** The Command a key's check runs as, for a test to resolve (`Command.resolve(form.Check, …)`). */
|
|
@@ -1192,7 +1206,7 @@ export declare const Form: {
|
|
|
1192
1206
|
};
|
|
1193
1207
|
} | {
|
|
1194
1208
|
readonly _tag: "AskedForMore";
|
|
1195
|
-
readonly key: Exclude<keyof Fields & string, NestedKey<Members
|
|
1209
|
+
readonly key: Exclude<Extract<Exclude<keyof Fields & string, NestedKey<Members>>, RelationKey<Members>>, keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>>;
|
|
1196
1210
|
} | {
|
|
1197
1211
|
readonly _tag: "Blurred";
|
|
1198
1212
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -1272,7 +1286,7 @@ export declare const Form: {
|
|
|
1272
1286
|
};
|
|
1273
1287
|
} | {
|
|
1274
1288
|
readonly _tag: "AskedForMore";
|
|
1275
|
-
readonly key: Exclude<keyof Fields & string, NestedKey<Members
|
|
1289
|
+
readonly key: Exclude<Extract<Exclude<keyof Fields & string, NestedKey<Members>>, RelationKey<Members>>, keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>>;
|
|
1276
1290
|
} | {
|
|
1277
1291
|
readonly _tag: "Blurred";
|
|
1278
1292
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -1340,7 +1354,8 @@ export declare const Form: {
|
|
|
1340
1354
|
rows: (model: FormModel<Fields, Members, ControlsOf<Inputs>>, key: Extract<keyof Fields & string, NestedKey<Members>>) => { readonly [K in keyof Fields as K extends NestedKey<Members> ? K : never]: readonly FormRow<NestedModel<Members[K & keyof Members]>>[]; }[Extract<keyof Fields & string, NestedKey<Members>>];
|
|
1341
1355
|
/**
|
|
1342
1356
|
* Whether a submit now could go through: nothing is invalid. A check still
|
|
1343
|
-
* running does not stop it; the submit waits for the answer
|
|
1357
|
+
* running does not stop it; the submit waits for the answer, unless the
|
|
1358
|
+
* form was made with `submitWaits: false`, which refuses it.
|
|
1344
1359
|
*/
|
|
1345
1360
|
canSubmit: (model: FormModel<Fields, Members, ControlsOf<Inputs>>) => boolean;
|
|
1346
1361
|
/** Whether a submit was asked since the form started, was filled or was reset. */
|
|
@@ -1386,7 +1401,7 @@ export declare const Form: {
|
|
|
1386
1401
|
};
|
|
1387
1402
|
} | {
|
|
1388
1403
|
readonly _tag: "AskedForMore";
|
|
1389
|
-
readonly key: Exclude<keyof Fields & string, NestedKey<Members
|
|
1404
|
+
readonly key: Exclude<Extract<Exclude<keyof Fields & string, NestedKey<Members>>, RelationKey<Members>>, keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>>;
|
|
1390
1405
|
} | {
|
|
1391
1406
|
readonly _tag: "Blurred";
|
|
1392
1407
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
|
@@ -1460,7 +1475,7 @@ export declare const Form: {
|
|
|
1460
1475
|
};
|
|
1461
1476
|
} | {
|
|
1462
1477
|
readonly _tag: "AskedForMore";
|
|
1463
|
-
readonly key: Exclude<keyof Fields & string, NestedKey<Members
|
|
1478
|
+
readonly key: Exclude<Extract<Exclude<keyof Fields & string, NestedKey<Members>>, RelationKey<Members>>, keyof ControlsOf<Inputs> & Exclude<keyof Fields & string, NestedKey<Members>>>;
|
|
1464
1479
|
} | {
|
|
1465
1480
|
readonly _tag: "Blurred";
|
|
1466
1481
|
readonly key: Exclude<keyof Fields & string, NestedKey<Members>>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;YAuEY,QAAQ,UAAU,QAAQ,yDAEjC,QAAQ,mCAAmC,0BAC1C;;YAIM,UAAU,cACnB,WAAW,UAAU,QAAQ,WAAW,wBAAwB,mBAC3D;;YAGI,YAAY,UACtB,eAAe,iBAAiB,uBAAuB,cAAc,YACjE,UAAU,QAAQ;;YAIZ,UAAU,eAAe,OAAO,OAAO,QAAQ,uBAC/C,KAAK,cAAc,QAAQ,UAAU,aAAa,UAAU;;YAI5D,WAAW,sBAEnB,WAAW,UAAU,OAAO,WAAW,+BAA+B,YACrE,OAAO,WAAW,oBAAoB,mBAAmB;;;;;YAOlD,mBAAmB,mCACnB,WAAW,SAAS,OAAO,WAAW,mCAAmC,oBACxE,2DAIL,UACJ,SAAS;;YAID,iBAAiB,KAAK,UAAU,yBA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B,kBAAgB,OAElF,OAAC,MAGF,MACL;aACQ,MAAM;aACN,GAAG;aACH,QAAQ;aACR,SAAS;aACT,GAAG;aACH,MAAM,qBAAqB;aAC3B,QAAQ"}
|
package/dist/index.js
CHANGED
|
@@ -64,7 +64,7 @@ const edits = {
|
|
|
64
64
|
AskedForMore: false
|
|
65
65
|
};
|
|
66
66
|
/** An edit, however deep. */
|
|
67
|
-
const isEdit = (message) => message._tag
|
|
67
|
+
const isEdit = (message) => Match.value(message._tag).pipe(Match.when("Nested", () => isEdit(message.message)), Match.orElse((tag) => edits[tag]));
|
|
68
68
|
const kindOf = (draft) => typeof draft === "string" ? "text" : typeof draft === "boolean" ? "flag" : Array.isArray(draft) && draft.every((item) => typeof item === "string") ? "list" : void 0;
|
|
69
69
|
const sameDraft = (left, right) => Array.isArray(left) && Array.isArray(right) ? left.length === right.length && left.every((item, index) => item === right[index]) : left === right;
|
|
70
70
|
const isEmpty = (draft) => draft === "" || Array.isArray(draft) && draft.length === 0;
|
|
@@ -82,9 +82,26 @@ const optionOf = (schema) => {
|
|
|
82
82
|
};
|
|
83
83
|
/** The schema's `title`, else `Form.label` metadata on the member, else the key. */
|
|
84
84
|
const wordsOf = (key, schema, member) => {
|
|
85
|
-
const own
|
|
85
|
+
const { own, fieldSchemas } = Match.valueTags(member, {
|
|
86
|
+
Unmapped: () => ({
|
|
87
|
+
own: void 0,
|
|
88
|
+
fieldSchemas: []
|
|
89
|
+
}),
|
|
90
|
+
Field: (field) => ({
|
|
91
|
+
own: field,
|
|
92
|
+
fieldSchemas: [field.schema]
|
|
93
|
+
}),
|
|
94
|
+
RelationInput: ({ relation }) => ({
|
|
95
|
+
own: relation,
|
|
96
|
+
fieldSchemas: []
|
|
97
|
+
}),
|
|
98
|
+
NestedInput: ({ relation }) => ({
|
|
99
|
+
own: relation,
|
|
100
|
+
fieldSchemas: []
|
|
101
|
+
})
|
|
102
|
+
});
|
|
86
103
|
const [labelled] = own === void 0 ? [] : labelKey.get(own.metadata);
|
|
87
|
-
const words = [schema, ...
|
|
104
|
+
const words = [schema, ...fieldSchemas].map(Words.of);
|
|
88
105
|
const first = (pick) => Option.firstSomeOf(words.map(pick));
|
|
89
106
|
return {
|
|
90
107
|
label: Option.getOrElse(first((entry) => entry.title), () => labelled?.label ?? key),
|
|
@@ -311,6 +328,8 @@ const Core = {
|
|
|
311
328
|
Schema.Array(Schema.String)
|
|
312
329
|
]);
|
|
313
330
|
const ControlKeySchema = controlKeys.length === 0 ? Schema.Never : Schema.Literals(controlKeys);
|
|
331
|
+
const pickerKeys = keys.filter((key) => members[key]._tag === "RelationInput" && plans[key].bundled === void 0);
|
|
332
|
+
const PickerKeySchema = pickerKeys.length === 0 ? Schema.Never : Schema.Literals(pickerKeys);
|
|
314
333
|
const Message = defineMessageUnion({
|
|
315
334
|
Changed: {
|
|
316
335
|
key: KeySchema,
|
|
@@ -416,7 +435,7 @@ const Core = {
|
|
|
416
435
|
* list is the page's, so the page answers (`Crud.screen` does, given
|
|
417
436
|
* `Crud.options`); the form changes nothing.
|
|
418
437
|
*/
|
|
419
|
-
AskedForMore: { key:
|
|
438
|
+
AskedForMore: { key: PickerKeySchema }
|
|
420
439
|
});
|
|
421
440
|
const fieldsFrom = (draft) => Object.fromEntries(keys.map((key) => [key, draft(plans[key])]));
|
|
422
441
|
const rowsOf = (model) => model.rows;
|
|
@@ -474,6 +493,7 @@ const Core = {
|
|
|
474
493
|
};
|
|
475
494
|
const checks = options.checks ?? {};
|
|
476
495
|
const debounce = options.debounce ?? "300 millis";
|
|
496
|
+
const submitWaits = options.submitWaits ?? true;
|
|
477
497
|
/**
|
|
478
498
|
* A key's check, after the debounce: a Command definition, so a test matches
|
|
479
499
|
* it as it would any other (`Command.resolve(form.Check, form.Message.Checked(…))`).
|
|
@@ -553,7 +573,10 @@ const Core = {
|
|
|
553
573
|
key,
|
|
554
574
|
message
|
|
555
575
|
});
|
|
556
|
-
const fromParentMessage = (message) =>
|
|
576
|
+
const fromParentMessage = (message) => {
|
|
577
|
+
if (message._tag !== "Control" || message.key !== key || !accepts(message.message)) return Option.none();
|
|
578
|
+
return Option.some(message.message);
|
|
579
|
+
};
|
|
557
580
|
const link = Link.make({
|
|
558
581
|
read: (model) => Option.some(drafts(model)[key].value),
|
|
559
582
|
write: (model, child) => withField(model, key, {
|
|
@@ -793,10 +816,10 @@ const Core = {
|
|
|
793
816
|
attempted: true
|
|
794
817
|
}, (form, row) => form.engine.submit(row));
|
|
795
818
|
if (isValidating(next)) return {
|
|
796
|
-
model: {
|
|
819
|
+
model: submitWaits ? {
|
|
797
820
|
...next,
|
|
798
821
|
submitPending: true
|
|
799
|
-
},
|
|
822
|
+
} : next,
|
|
800
823
|
commands
|
|
801
824
|
};
|
|
802
825
|
return {
|
|
@@ -887,7 +910,12 @@ const Core = {
|
|
|
887
910
|
});
|
|
888
911
|
case "Validated": {
|
|
889
912
|
const state = drafts(model)[message.key];
|
|
890
|
-
return
|
|
913
|
+
return FieldValidation.match(state, {
|
|
914
|
+
onNotValidated: (value) => validateKey(model, message.key, value),
|
|
915
|
+
onValidating: () => ({ model }),
|
|
916
|
+
onValid: () => ({ model }),
|
|
917
|
+
onInvalid: () => ({ model })
|
|
918
|
+
});
|
|
891
919
|
}
|
|
892
920
|
case "ValidatedAll": return validateAll(model);
|
|
893
921
|
case "Refused": {
|
|
@@ -1144,7 +1172,8 @@ const Core = {
|
|
|
1144
1172
|
rows: (model, key) => rowsOf(model)[key] ?? fail(name, `"${key}" holds a draft, not rows`),
|
|
1145
1173
|
/**
|
|
1146
1174
|
* Whether a submit now could go through: nothing is invalid. A check still
|
|
1147
|
-
* running does not stop it; the submit waits for the answer
|
|
1175
|
+
* running does not stop it; the submit waits for the answer, unless the
|
|
1176
|
+
* form was made with `submitWaits: false`, which refuses it.
|
|
1148
1177
|
*/
|
|
1149
1178
|
canSubmit: (model) => {
|
|
1150
1179
|
const next = submit(model);
|
|
@@ -1180,7 +1209,12 @@ const Core = {
|
|
|
1180
1209
|
...field,
|
|
1181
1210
|
value: plan.bundled.settled(field.value)
|
|
1182
1211
|
};
|
|
1183
|
-
return
|
|
1212
|
+
return FieldValidation.match(held, {
|
|
1213
|
+
onNotValidated: () => held,
|
|
1214
|
+
onValidating: (value) => FieldValidation.NotValidated({ value }),
|
|
1215
|
+
onValid: () => held,
|
|
1216
|
+
onInvalid: () => held
|
|
1217
|
+
});
|
|
1184
1218
|
}),
|
|
1185
1219
|
rows: Object.fromEntries(rowsKeys.map((key) => [key, rowsOf(model)[key].map((row) => ({
|
|
1186
1220
|
...row,
|