foldkit-crud 0.7.2 → 0.8.1
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/dist/index.d.mts +22 -19
- package/dist/index.d.mts.map +1 -1
- package/package.json +13 -13
package/dist/index.d.mts
CHANGED
|
@@ -52,6 +52,12 @@ interface DisplayWords {
|
|
|
52
52
|
/** Between the items of a list, and between the members of a nested value. Default `, `. */
|
|
53
53
|
readonly separator?: string;
|
|
54
54
|
}
|
|
55
|
+
/** A kind of Display. The kinds below are made with it, and so is an application's. */
|
|
56
|
+
declare const kind: <Data = Record<string, never>>(name: string, spec: {
|
|
57
|
+
readonly shown?: boolean;
|
|
58
|
+
readonly text: (data: Data, value: unknown, words: DisplayWords) => string;
|
|
59
|
+
}) => DisplayKind<Data>;
|
|
60
|
+
declare const show: (display: Display, value: unknown, words?: DisplayWords) => string;
|
|
55
61
|
export declare const Display: {
|
|
56
62
|
/**
|
|
57
63
|
* A kind of Display. `Display.kind<{ tone: string }>('Badge', { text: (_, value) => String(value) })`
|
|
@@ -59,10 +65,7 @@ export declare const Display: {
|
|
|
59
65
|
* kinds below were made. `text` is the floor; a view draws it specially once
|
|
60
66
|
* it is given a renderer for `Badge`.
|
|
61
67
|
*/
|
|
62
|
-
kind:
|
|
63
|
-
readonly shown?: boolean;
|
|
64
|
-
readonly text: (data: Data, value: unknown, words: DisplayWords) => string;
|
|
65
|
-
}) => DisplayKind<Data>;
|
|
68
|
+
kind: typeof kind;
|
|
66
69
|
Text: DisplayKind<{
|
|
67
70
|
readonly format?: ((value: unknown) => string) | undefined;
|
|
68
71
|
}>;
|
|
@@ -77,7 +80,7 @@ export declare const Display: {
|
|
|
77
80
|
}>;
|
|
78
81
|
Nested: DisplayKind<{
|
|
79
82
|
readonly target: AnyEntity;
|
|
80
|
-
readonly shape:
|
|
83
|
+
readonly shape: 'one' | 'many' | 'page';
|
|
81
84
|
readonly columns: ReadonlyArray<DisplayColumn>;
|
|
82
85
|
}>;
|
|
83
86
|
text: (format?: (value: unknown) => string) => Display;
|
|
@@ -97,7 +100,7 @@ export declare const Display: {
|
|
|
97
100
|
* with `shape` saying how many the relation yields.
|
|
98
101
|
*/
|
|
99
102
|
resolve: (member: EntityMember, nested?: {
|
|
100
|
-
readonly shape:
|
|
103
|
+
readonly shape: 'one' | 'many' | 'page';
|
|
101
104
|
readonly columns: ReadonlyArray<DisplayColumn>;
|
|
102
105
|
}) => Display;
|
|
103
106
|
/**
|
|
@@ -105,7 +108,7 @@ export declare const Display: {
|
|
|
105
108
|
* draws it specially. A view that wants a link or a badge reads the Display
|
|
106
109
|
* and the value itself; this is the floor every view can stand on.
|
|
107
110
|
*/
|
|
108
|
-
show:
|
|
111
|
+
show: typeof show;
|
|
109
112
|
};
|
|
110
113
|
//#endregion
|
|
111
114
|
//#region src/sort.d.ts
|
|
@@ -307,9 +310,9 @@ export declare const Crud: {
|
|
|
307
310
|
readonly id: Key & (Input extends Readonly<Record<Key, string>> ? Key : never);
|
|
308
311
|
}) => {
|
|
309
312
|
bundle: Bundle.Bundle<Name, void, RemoverModel, {
|
|
310
|
-
readonly _tag: "Confirmed";
|
|
311
|
-
} | {
|
|
312
313
|
readonly _tag: "Cancelled";
|
|
314
|
+
} | {
|
|
315
|
+
readonly _tag: "Confirmed";
|
|
313
316
|
}, ConfirmedRemoval, never, never, void, {}, {
|
|
314
317
|
/** Asks whether to delete `id`. Nothing is deleted until `Confirmed`. */
|
|
315
318
|
ask: (_: RemoverModel, id: [Key] extends [never] ? Id : Input[Key] & string) => {
|
|
@@ -354,15 +357,15 @@ export declare const Crud: {
|
|
|
354
357
|
* that identify it to a person. Give it to a list that feeds pickers.
|
|
355
358
|
*/
|
|
356
359
|
readonly choice?: {
|
|
357
|
-
readonly value: (row: S[
|
|
358
|
-
readonly label: (row: S[
|
|
360
|
+
readonly value: (row: S['Type']) => string;
|
|
361
|
+
readonly label: (row: S['Type']) => string;
|
|
359
362
|
};
|
|
360
363
|
}) => {
|
|
361
364
|
name: Name;
|
|
362
365
|
/** The selected members in the Selection's order, each with its label. */
|
|
363
366
|
columns: readonly ListColumn<keyof Members & string>[];
|
|
364
367
|
/** Type-only: a row, for a view to be typed by. Never read. */
|
|
365
|
-
Row: S[
|
|
368
|
+
Row: S['Type'];
|
|
366
369
|
/**
|
|
367
370
|
* The list where it lives. `input` is the query's input as the Model has
|
|
368
371
|
* it (filters, a search term), or `undefined` while the list is not shown.
|
|
@@ -374,7 +377,7 @@ export declare const Crud: {
|
|
|
374
377
|
}) => {
|
|
375
378
|
/** For `Data.subscriptions`: the page and its rows are fetched and retained while shown. */
|
|
376
379
|
active: ActiveSurface<Root, unknown>;
|
|
377
|
-
page: (root: Root) => RemoteData<Page<S[
|
|
380
|
+
page: (root: Root) => RemoteData<Page<S['Type']>>;
|
|
378
381
|
/**
|
|
379
382
|
* "Load more": the Model with the list showing one page more, for the
|
|
380
383
|
* read entry to fetch; none when it shows every row there is.
|
|
@@ -463,7 +466,7 @@ export declare const Crud: {
|
|
|
463
466
|
*/
|
|
464
467
|
actives: <const Pieces extends Readonly<Record<string, {
|
|
465
468
|
readonly active: unknown;
|
|
466
|
-
}>>>(pieces: Pieces) => { readonly [K in keyof Pieces]: Pieces[K][
|
|
469
|
+
}>>>(pieces: Pieces) => { readonly [K in keyof Pieces]: Pieces[K]['active']; };
|
|
467
470
|
/**
|
|
468
471
|
* An editor for one form and the mutation its value feeds. The form's value
|
|
469
472
|
* must be the mutation's input, which is what declaring the input once and
|
|
@@ -485,8 +488,6 @@ export declare const Crud: {
|
|
|
485
488
|
/** Edits `id`: the form is emptied, and filled once the current values arrive. */
|
|
486
489
|
open: (_: EditorModel<FormModel>, id: IdOf<E>) => {
|
|
487
490
|
model: {
|
|
488
|
-
mode: "edit";
|
|
489
|
-
target: IdOf<E>;
|
|
490
491
|
form: FormModel;
|
|
491
492
|
filled: boolean;
|
|
492
493
|
requestId: string | null;
|
|
@@ -495,13 +496,13 @@ export declare const Crud: {
|
|
|
495
496
|
settledFor: Option.Option<string>;
|
|
496
497
|
refusedFor: Option.Option<string>;
|
|
497
498
|
filledWith: Option.Option<Readonly<Record<string, unknown>>>;
|
|
499
|
+
mode: 'edit';
|
|
500
|
+
target: IdOf<E>;
|
|
498
501
|
};
|
|
499
502
|
};
|
|
500
503
|
/** A blank form for a new one: nothing to load. */
|
|
501
504
|
blank: () => {
|
|
502
505
|
model: {
|
|
503
|
-
mode: "new";
|
|
504
|
-
filled: boolean;
|
|
505
506
|
form: FormModel;
|
|
506
507
|
target: string | null;
|
|
507
508
|
requestId: string | null;
|
|
@@ -510,6 +511,8 @@ export declare const Crud: {
|
|
|
510
511
|
settledFor: Option.Option<string>;
|
|
511
512
|
refusedFor: Option.Option<string>;
|
|
512
513
|
filledWith: Option.Option<Readonly<Record<string, unknown>>>;
|
|
514
|
+
mode: 'new';
|
|
515
|
+
filled: boolean;
|
|
513
516
|
};
|
|
514
517
|
};
|
|
515
518
|
close: () => {
|
|
@@ -517,7 +520,7 @@ export declare const Crud: {
|
|
|
517
520
|
};
|
|
518
521
|
}>;
|
|
519
522
|
/** What the editor loads before it shows the form: every member the form writes. */
|
|
520
|
-
selection: Selection<E["name"], import("foldkit-entity").WrittenSpec<Members>, Schema.Struct<{ readonly [K in keyof import("foldkit-entity").WrittenSpec<Members> & keyof E["members"]]: E["members"][K] extends (infer T) ? T extends E["members"][K] ? T extends import("foldkit-entity").
|
|
523
|
+
selection: Selection<E["name"], import("foldkit-entity").WrittenSpec<Members>, Schema.Struct<{ readonly [K in keyof import("foldkit-entity").WrittenSpec<Members> & keyof E["members"]]: E["members"][K] extends (infer T) ? T extends E["members"][K] ? T extends import("foldkit-entity").EntityDerived<any, any, infer S extends Schema.Constraint> | import("foldkit-entity").EntityField<any, any, infer S extends Schema.Constraint> ? S : T extends import("foldkit-entity").EntityRelation<any, any, infer Target extends AnyEntity, infer C extends import("foldkit-entity").Cardinality, infer Optional extends boolean> ? import("foldkit-entity").WrittenSpec<Members>[K] extends (infer T_1) ? T_1 extends import("foldkit-entity").WrittenSpec<Members>[K] ? T_1 extends SelectionPage<any, infer S_1 extends Schema.Constraint> ? Schema.Struct<{
|
|
521
524
|
readonly items: Schema.$Array<S_1>;
|
|
522
525
|
readonly hasNext: Schema.Boolean;
|
|
523
526
|
readonly hasPrevious: Schema.Boolean;
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/display.ts","../src/sort.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;iBAgBiB,QAAQ;;WAEd;;WAEA;;WAEA,MAAM;;;;;WAKN,OAAO,gBAAgB,OAAO;;;UAIxB,YAAY;WAClB;WACA,KAAK,MAAM,SAAS,QAAQ;WAC5B,KAAK,SAAS,YAAY,WAAW,QAAQ;;;UAIvC,cAAc;WACpB,KAAK;WACL;WACA,QAAQ;WACR,SAAS;;;UAIH;;WAEN;;WAEA;;WAEA;;WAEA
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/display.ts","../src/sort.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;iBAgBiB,QAAQ;;WAEd;;WAEA;;WAEA,MAAM;;;;;WAKN,OAAO,gBAAgB,OAAO;;;UAIxB,YAAY;WAClB;WACA,KAAK,MAAM,SAAS,QAAQ;WAC5B,KAAK,SAAS,YAAY,WAAW,QAAQ;;;UAIvC,cAAc;WACpB,KAAK;WACL;WACA,QAAQ;WACR,SAAS;;;UAIH;;WAEN;;WAEA;;WAEA;;WAEA;;;cAoBL,OAAQ,OAAO,uBAAqB,cAC5B;WAED;WACA,OAAO,MAAM,MAAM,gBAAgB,OAAO;MAEpD,YAAY;cAYT,OAAI,SAAa,SAAO,gBAAgB,QAAS;qBAyD1C;;;;;;;;;aAtDyB,WAAE;;;aAGC,WAAE;;;;;aASP,QAAA;aAA0B;;;aAa3C,QAAA;aACD;aACE,SAAA,cAAc;;EA4ChB,OAAA,UA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,GAAG,QAAQ,SAAS;aAChF,UAAU,2BAA2B;;;;;;aAMrC,QAAQ;;;;MAoEM,OAAA,GAAA,YAAA,YAAA,IAAA,KAAK;;;UAroBf;UACG;UAEH;UAEF,MAAA,OAAO,OAAO,SAAS;UAEjB,YAAA,OAAO;UAEP,YAAA,OAAO;UAMP,YAAA,OAAO,OAAO,SAAS;UAunBV;;;;;;;;UAvoBjB;UAEG;UAEH;UAEF,MAAA,OAAO,OAAO,SAAS;UAEjB,YAAA,OAAO;UAEP,YAAA,OAAO;UAMP,YAAA,OAAO,OAAO,SAAS;UA0nBI;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAyCvC,KAAA,MAAI;eACE,MAAM,WAAW;eACjB,OAAO,SAAS,MAAI,YAAA;;;MAwKb,QAAA,WAAA,UAAU,WAAS,KAAK;;;;;;;;;;;MAyCnC,QAAA,SAAS;iBAA0B,OAAO;SAAM,SACtC,OAAO,MAAM,SAAS,YAAY,YAAM,OAE3C,MAAI,SAAW,YAAU;;;;;;MAUnB,UAAA,MAAA,SAAO;;MAQL,YAAA,MAAA,SAAO;;;;;;MAUV,SAAA,MAAA,SAAO,oBAAoB;;MAU3B,SAAA,MAAA,SAAO,KAAK;MACZ,SAAA,MAAA,SAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit-crud",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Create, read, update and delete screens for Foldkit Plus, assembled from a form, a Remote operation, and the Entity they share. Each capability is declared, never implied.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foldkit",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"url": "git+https://github.com/doeixd/foldkit-plus.git",
|
|
23
23
|
"directory": "packages/crud"
|
|
24
24
|
},
|
|
25
|
-
"homepage": "https://
|
|
25
|
+
"homepage": "https://foldkit-plus.pages.dev/crud",
|
|
26
26
|
"bugs": {
|
|
27
27
|
"url": "https://github.com/doeixd/foldkit-plus/issues"
|
|
28
28
|
},
|
|
@@ -40,23 +40,23 @@
|
|
|
40
40
|
"LICENSE"
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"foldkit-bundle": "0.
|
|
44
|
-
"foldkit-form": "0.
|
|
45
|
-
"foldkit-entity": "0.
|
|
43
|
+
"foldkit-bundle": "0.8.0",
|
|
44
|
+
"foldkit-form": "0.6.0",
|
|
45
|
+
"foldkit-entity": "0.10.0",
|
|
46
|
+
"foldkit-remote": "0.17.0",
|
|
46
47
|
"foldkit-metadata": "0.1.0",
|
|
47
|
-
"foldkit-
|
|
48
|
-
"foldkit-surface": "0.8.0"
|
|
48
|
+
"foldkit-surface": "0.10.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"effect": "^4.0.0",
|
|
52
|
-
"foldkit": "^0.
|
|
52
|
+
"foldkit": "^0.168.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@effect/platform-browser": "4.0.
|
|
56
|
-
"effect": "4.0.
|
|
57
|
-
"foldkit": "0.
|
|
58
|
-
"tsdown": "^0.23.
|
|
59
|
-
"typescript": "
|
|
55
|
+
"@effect/platform-browser": "^4.0.4",
|
|
56
|
+
"effect": "^4.0.4",
|
|
57
|
+
"foldkit": "0.168.0",
|
|
58
|
+
"tsdown": "^0.23.1",
|
|
59
|
+
"typescript": "7.0.2"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"build": "tsdown",
|