@sealcode/sealgen 0.12.4 → 0.12.6
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/@types/src/forms/controls/multiple-files.d.ts +10 -10
- package/@types/src/forms/fields/file.d.ts +4 -4
- package/@types/src/index.d.ts +1 -2
- package/@types/src/page/page.d.ts +1 -1
- package/dist/forms/fields/file.js +1 -1
- package/dist/index.js +1 -3
- package/package.json +3 -3
- package/src/forms/fields/file.ts +1 -1
- package/src/forms/form.test.ts +2 -1
- package/src/index.ts +1 -2
- package/src/page/page.ts +1 -1
- package/@types/add-collection.d.ts +0 -1
- package/@types/add-jdd-component.d.ts +0 -1
- package/@types/add-route.d.ts +0 -3
- package/@types/add-route.test.d.ts +0 -1
- package/@types/build.d.ts +0 -3
- package/@types/cli.d.ts +0 -2
- package/@types/components/components.d.ts +0 -2
- package/@types/components/tabs.d.ts +0 -2
- package/@types/components/toggle-modal.d.ts +0 -7
- package/@types/example.test.d.ts +0 -1
- package/@types/find-css-includes.d.ts +0 -1
- package/@types/find-scss-includes.d.ts +0 -1
- package/@types/forms/controls/array.d.ts +0 -35
- package/@types/forms/controls/autocomplete.d.ts +0 -22
- package/@types/forms/controls/big-radio-group.d.ts +0 -14
- package/@types/forms/controls/checkbox-group.d.ts +0 -21
- package/@types/forms/controls/checkbox.d.ts +0 -15
- package/@types/forms/controls/checkboxed-list-input.d.ts +0 -14
- package/@types/forms/controls/collapsible-checkbox-group.d.ts +0 -11
- package/@types/forms/controls/collapsible-field-group.d.ts +0 -21
- package/@types/forms/controls/controls.d.ts +0 -29
- package/@types/forms/controls/derived-frame.d.ts +0 -22
- package/@types/forms/controls/derived.d.ts +0 -13
- package/@types/forms/controls/dropdown.d.ts +0 -29
- package/@types/forms/controls/editable-collection-subset.d.ts +0 -20
- package/@types/forms/controls/field-group.d.ts +0 -23
- package/@types/forms/controls/file.d.ts +0 -16
- package/@types/forms/controls/form-control.d.ts +0 -19
- package/@types/forms/controls/form-field-control.d.ts +0 -13
- package/@types/forms/controls/form-header.d.ts +0 -9
- package/@types/forms/controls/form-paragraph.d.ts +0 -7
- package/@types/forms/controls/frame.d.ts +0 -17
- package/@types/forms/controls/hidden-input.d.ts +0 -9
- package/@types/forms/controls/html.d.ts +0 -12
- package/@types/forms/controls/multiple-files.d.ts +0 -40
- package/@types/forms/controls/multiple-photos.d.ts +0 -18
- package/@types/forms/controls/number.d.ts +0 -13
- package/@types/forms/controls/photo.d.ts +0 -21
- package/@types/forms/controls/radio.d.ts +0 -16
- package/@types/forms/controls/reverse-single-reference.d.ts +0 -1
- package/@types/forms/controls/simple-input.d.ts +0 -32
- package/@types/forms/controls/textarea.d.ts +0 -25
- package/@types/forms/controls/tickable.d.ts +0 -24
- package/@types/forms/fields/boolean.d.ts +0 -17
- package/@types/forms/fields/boolean.test.d.ts +0 -1
- package/@types/forms/fields/checkboxed-list.d.ts +0 -20
- package/@types/forms/fields/collection-field.d.ts +0 -15
- package/@types/forms/fields/email.d.ts +0 -7
- package/@types/forms/fields/email.test.d.ts +0 -1
- package/@types/forms/fields/enum-multiple.d.ts +0 -18
- package/@types/forms/fields/enum-multiple.test.d.ts +0 -1
- package/@types/forms/fields/enum.d.ts +0 -18
- package/@types/forms/fields/enum.test.d.ts +0 -1
- package/@types/forms/fields/existing-sealious-value.d.ts +0 -6
- package/@types/forms/fields/field.d.ts +0 -58
- package/@types/forms/fields/file.d.ts +0 -16
- package/@types/forms/fields/multiple-files.d.ts +0 -14
- package/@types/forms/fields/number.d.ts +0 -23
- package/@types/forms/fields/number.test.d.ts +0 -1
- package/@types/forms/fields/pick-from-list.d.ts +0 -14
- package/@types/forms/fields/pick-from-list.test.d.ts +0 -1
- package/@types/forms/fields/proxy-field.d.ts +0 -13
- package/@types/forms/fields/regexp.d.ts +0 -16
- package/@types/forms/fields/regexp.test.d.ts +0 -1
- package/@types/forms/fields/reverse-single-reference.d.ts +0 -13
- package/@types/forms/fields/simple-form-field.d.ts +0 -9
- package/@types/forms/fields/structured-array.d.ts +0 -14
- package/@types/forms/form.d.ts +0 -55
- package/@types/forms/form.test.d.ts +0 -6
- package/@types/forms/multiform.d.ts +0 -23
- package/@types/forms/multiform.test.d.ts +0 -1
- package/@types/generate-collections.d.ts +0 -2
- package/@types/generate-components.d.ts +0 -1
- package/@types/generate-routes.d.ts +0 -1
- package/@types/index.d.ts +0 -25
- package/@types/make-env.d.ts +0 -1
- package/@types/make-hidden-inputs.d.ts +0 -5
- package/@types/mount.d.ts +0 -6
- package/@types/notifier.d.ts +0 -1
- package/@types/page/access-control.d.ts +0 -6
- package/@types/page/default-list-filters.d.ts +0 -6
- package/@types/page/list.d.ts +0 -45
- package/@types/page/mountable-with-fields.d.ts +0 -36
- package/@types/page/mountable.d.ts +0 -11
- package/@types/page/page.d.ts +0 -19
- package/@types/page/props-parser.d.ts +0 -15
- package/@types/page/sealious-list.d.ts +0 -19
- package/@types/page/stateful-page.d.ts +0 -34
- package/@types/run.d.ts +0 -1
- package/@types/sanitize.d.ts +0 -1
- package/@types/src/hehe.test.d.ts +0 -1
- package/@types/src/sample-index.d.ts +0 -1
- package/@types/src/sample-lib.d.ts +0 -3
- package/@types/templates/collection.d.ts +0 -1
- package/@types/templates/form.d.ts +0 -1
- package/@types/templates/jdd-component.d.ts +0 -1
- package/@types/templates/list.d.ts +0 -1
- package/@types/templates/long-running-process.d.ts +0 -1
- package/@types/templates/multiform.d.ts +0 -1
- package/@types/templates/page.d.ts +0 -1
- package/@types/templates/post.d.ts +0 -1
- package/@types/templates/redirect.d.ts +0 -1
- package/@types/templates/route-test.d.ts +0 -1
- package/@types/templates/stateful-page.d.ts +0 -1
- package/@types/templates/templates.d.ts +0 -19
- package/@types/test_utils/locator_is_visible.d.ts +0 -2
- package/@types/utils/assert-throws.d.ts +0 -1
- package/@types/utils/base64.d.ts +0 -2
- package/@types/utils/browser-creator.d.ts +0 -1
- package/@types/utils/escape-url-params.d.ts +0 -2
- package/@types/utils/exec.d.ts +0 -5
- package/@types/utils/extract-fields-from-collection.d.ts +0 -4
- package/@types/utils/format-external-url.d.ts +0 -1
- package/@types/utils/import-path.d.ts +0 -2
- package/@types/utils/input-wrapper.d.ts +0 -5
- package/@types/utils/list-collections.d.ts +0 -1
- package/@types/utils/make-slug.d.ts +0 -1
- package/@types/utils/natural-numbers.d.ts +0 -1
- package/@types/utils/prettier.d.ts +0 -2
- package/@types/utils/question.d.ts +0 -1
- package/@types/utils/render-attributes.d.ts +0 -1
- package/@types/utils/sleep.d.ts +0 -1
- package/@types/utils/translate.d.ts +0 -3
- package/@types/utils/url-with-new-params.d.ts +0 -2
- package/@types/utils/utils.d.ts +0 -16
- package/@types/utils/walk.d.ts +0 -1
- package/@types/vitest.config.d.ts +0 -2
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { FlatTemplatable } from "tempstream";
|
|
2
|
-
import { FormControl } from "./controls.js";
|
|
3
|
-
/**
|
|
4
|
-
* This class will render `turbo-frame` tag so that u can
|
|
5
|
-
* embed other route inside your form. This will require
|
|
6
|
-
* to add value to `data: FormData` (inside your master form
|
|
7
|
-
* render function) with key `Frame.FRAME_PATH_KEY`. Value
|
|
8
|
-
* needs to be url to route that you want to embed. If you
|
|
9
|
-
* this value wont be provided frame will redner empty string.
|
|
10
|
-
* See `src/back/routes/profile/[id].form.ts` for an example.
|
|
11
|
-
*/
|
|
12
|
-
export declare class Frame extends FormControl {
|
|
13
|
-
src: string;
|
|
14
|
-
constructor(src: string);
|
|
15
|
-
render(): FlatTemplatable | Promise<FlatTemplatable>;
|
|
16
|
-
role: "decoration";
|
|
17
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FlatTemplatable } from "tempstream";
|
|
2
|
-
import { FormField } from "../fields/field.js";
|
|
3
|
-
import { FormControlContext } from "./form-control.js";
|
|
4
|
-
import { FormFieldControl } from "./form-field-control.js";
|
|
5
|
-
export declare class HiddenInput extends FormFieldControl {
|
|
6
|
-
field: FormField;
|
|
7
|
-
constructor(field: FormField);
|
|
8
|
-
render(fctx: FormControlContext): Promise<FlatTemplatable>;
|
|
9
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FlatTemplatable } from "tempstream";
|
|
2
|
-
import { FormControl } from "./controls.js";
|
|
3
|
-
import { FormControlContext } from "./form-control.js";
|
|
4
|
-
type Renderer = ((fctx: FormControlContext) => FlatTemplatable) | FlatTemplatable;
|
|
5
|
-
export declare class HTML extends FormControl {
|
|
6
|
-
role: "decoration" | "submit";
|
|
7
|
-
renderer: Renderer;
|
|
8
|
-
constructor(role: "decoration" | "submit", renderer: Renderer);
|
|
9
|
-
constructor(renderer: Renderer);
|
|
10
|
-
render(fctx: FormControlContext): Promise<FlatTemplatable>;
|
|
11
|
-
}
|
|
12
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/// <reference types="koa__router" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import Router from "@koa/router";
|
|
4
|
-
import { Collection, CollectionItem, File as SealiousFile, Field as SealiousField } from "sealious";
|
|
5
|
-
import { Context } from "koa";
|
|
6
|
-
import { FlatTemplatable } from "tempstream";
|
|
7
|
-
import { MultipleFiles as MultipleFilesField } from "../fields/multiple-files.js";
|
|
8
|
-
import { FormFieldControl } from "./form-field-control.js";
|
|
9
|
-
import { FormControlContext } from "./form-control.js";
|
|
10
|
-
export type MultipleFilesOptions = {
|
|
11
|
-
label?: string;
|
|
12
|
-
uploadLabel?: string;
|
|
13
|
-
getAdditionalFields: (ctx: Context, file: SealiousFile) => Promise<Record<string, unknown>>;
|
|
14
|
-
};
|
|
15
|
-
export declare class MultipleFiles extends FormFieldControl {
|
|
16
|
-
field: MultipleFilesField;
|
|
17
|
-
options: MultipleFilesOptions;
|
|
18
|
-
constructor(field: MultipleFilesField, options?: Partial<MultipleFilesOptions>);
|
|
19
|
-
getClassModifiers(): string[];
|
|
20
|
-
mount(router: Router): void;
|
|
21
|
-
deleteFileAssociation(ctx: Context, file_item_id: string): Promise<void>;
|
|
22
|
-
addFileAssociation(ctx: Context, file: SealiousFile): Promise<void>;
|
|
23
|
-
getFrameRelativeURL(): string;
|
|
24
|
-
getFrameID(): string;
|
|
25
|
-
renderFrame(ctx: Context, content?: FlatTemplatable): import("stream").Readable;
|
|
26
|
-
render(fctx: FormControlContext): FlatTemplatable | Promise<FlatTemplatable>;
|
|
27
|
-
getReferencingCollection(): Collection;
|
|
28
|
-
getFileField(): SealiousField | null;
|
|
29
|
-
extractFileFromItem(item: CollectionItem): Promise<SealiousFile | null>;
|
|
30
|
-
renderFileItemPreview(_fileItem: CollectionItem, file: SealiousFile): Promise<FlatTemplatable>;
|
|
31
|
-
renderFileItem(fileItem: CollectionItem, file: SealiousFile): Promise<FlatTemplatable>;
|
|
32
|
-
renderFileRemoveButton(fileItem: CollectionItem): FlatTemplatable;
|
|
33
|
-
getFileItems(ctx: Context): Promise<CollectionItem<any>[]>;
|
|
34
|
-
getInputAttributes(): {
|
|
35
|
-
type: string;
|
|
36
|
-
name: string;
|
|
37
|
-
multiple: boolean;
|
|
38
|
-
};
|
|
39
|
-
renderFrameContent(ctx: Context): Promise<FlatTemplatable>;
|
|
40
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { File as SealiousFile, CollectionItem } from "sealious";
|
|
2
|
-
import { FlatTemplatable } from "tempstream";
|
|
3
|
-
import { MultipleFiles, MultipleFilesOptions } from "./multiple-files.js";
|
|
4
|
-
import { MultipleFiles as MultipleFilesField } from "../fields/multiple-files.js";
|
|
5
|
-
import * as KoaResponsiveImageRouter from "koa-responsive-image-router";
|
|
6
|
-
export declare class MultiplePhotos extends MultipleFiles {
|
|
7
|
-
field: MultipleFilesField;
|
|
8
|
-
imageRouter: KoaResponsiveImageRouter.default;
|
|
9
|
-
constructor(field: MultipleFilesField, imageRouter: KoaResponsiveImageRouter.default, options?: Partial<MultipleFilesOptions>);
|
|
10
|
-
getClassModifiers(): string[];
|
|
11
|
-
getInputAttributes(): {
|
|
12
|
-
accept: string;
|
|
13
|
-
type: string;
|
|
14
|
-
name: string;
|
|
15
|
-
multiple: boolean;
|
|
16
|
-
};
|
|
17
|
-
renderFileItem(fileItem: CollectionItem, file: SealiousFile): Promise<FlatTemplatable>;
|
|
18
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { NumberField } from "../fields/field.js";
|
|
2
|
-
import { FormControlContext } from "./form-control.js";
|
|
3
|
-
import { SimpleInput, SimpleInputOptions } from "./simple-input.js";
|
|
4
|
-
export type NumberOptions = SimpleInputOptions & Partial<{
|
|
5
|
-
step: number;
|
|
6
|
-
}>;
|
|
7
|
-
export declare class Number extends SimpleInput<number | null> {
|
|
8
|
-
field: NumberField;
|
|
9
|
-
options: NumberOptions;
|
|
10
|
-
constructor(field: NumberField, options: NumberOptions);
|
|
11
|
-
getType(): string;
|
|
12
|
-
getInputAttributes(fctx: FormControlContext): Promise<Record<string, string | boolean>>;
|
|
13
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { FlatTemplatable } from "tempstream";
|
|
3
|
-
import { File } from "./file.js";
|
|
4
|
-
import { FileContainer, FormField } from "../fields/field.js";
|
|
5
|
-
import { SimpleInputOptions } from "./simple-input.js";
|
|
6
|
-
import { FormControlContext } from "./form-control.js";
|
|
7
|
-
import * as KoaResponsiveImageRouter from "koa-responsive-image-router";
|
|
8
|
-
export declare class Photo extends File {
|
|
9
|
-
field: FormField<boolean, FileContainer>;
|
|
10
|
-
imageRouter: KoaResponsiveImageRouter.default;
|
|
11
|
-
constructor(field: FormField<boolean, FileContainer>, imageRouter: KoaResponsiveImageRouter.default, options?: SimpleInputOptions);
|
|
12
|
-
getImgStyle(): Promise<string>;
|
|
13
|
-
renderFilePreview(ctx: Context, file_data: {
|
|
14
|
-
id?: string;
|
|
15
|
-
filename?: string;
|
|
16
|
-
} | null): Promise<FlatTemplatable>;
|
|
17
|
-
getInputAttributes(fctx: FormControlContext): Promise<{
|
|
18
|
-
accept: string;
|
|
19
|
-
onchange: string;
|
|
20
|
-
}>;
|
|
21
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { FormField } from "../fields/field.js";
|
|
3
|
-
import { FormDataValue } from "../form.js";
|
|
4
|
-
import { Tickable } from "./tickable.js";
|
|
5
|
-
export declare class Radio extends Tickable<string> {
|
|
6
|
-
field: FormField<boolean, string>;
|
|
7
|
-
value: string;
|
|
8
|
-
type: "radio";
|
|
9
|
-
constructor(field: FormField<boolean, string>, value: string, options: {
|
|
10
|
-
label?: string;
|
|
11
|
-
});
|
|
12
|
-
makeInputID(): string;
|
|
13
|
-
getValueAttribute(): string;
|
|
14
|
-
getWrapperClasses(ctx: Context, data: Record<string, FormDataValue>, value: string): string[];
|
|
15
|
-
isChecked(_ctx: Context, _data: Record<string, FormDataValue>, value: string): boolean;
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { FlatTemplatable } from "tempstream";
|
|
3
|
-
import { FormField } from "../fields/field.js";
|
|
4
|
-
import { FormDataValue } from "../form.js";
|
|
5
|
-
import { FormFieldControl } from "./controls.js";
|
|
6
|
-
import { FormControlContext } from "./form-control.js";
|
|
7
|
-
export type SimpleInputOptions = {
|
|
8
|
-
id?: string;
|
|
9
|
-
label?: string;
|
|
10
|
-
autocomplete?: boolean;
|
|
11
|
-
hide_errors?: boolean;
|
|
12
|
-
type?: "color" | "date" | "email" | "file" | "month" | "number" | "password" | "search" | "tel" | "text" | "time" | "url" | "week";
|
|
13
|
-
value?: string;
|
|
14
|
-
placeholder?: string;
|
|
15
|
-
readonly?: boolean;
|
|
16
|
-
step?: number;
|
|
17
|
-
suffix?: string;
|
|
18
|
-
};
|
|
19
|
-
export declare class SimpleInput<ParsedValue, Options extends SimpleInputOptions = SimpleInputOptions> extends FormFieldControl {
|
|
20
|
-
field: FormField<boolean, ParsedValue>;
|
|
21
|
-
options: SimpleInputOptions;
|
|
22
|
-
constructor(field: FormField<boolean, ParsedValue>, options?: Options);
|
|
23
|
-
preInput(_ctx: Context, _data: Record<string, FormDataValue>): Promise<FlatTemplatable>;
|
|
24
|
-
getType(): string;
|
|
25
|
-
getLabel(): string;
|
|
26
|
-
getID(): string;
|
|
27
|
-
getPlaceholder(): string;
|
|
28
|
-
getInputAttributes(fctx: FormControlContext): Promise<Record<string, string | boolean>>;
|
|
29
|
-
postInput(_: Context): Promise<FlatTemplatable>;
|
|
30
|
-
renderInput(_ctx: Context, attributes_str: string, _data: Record<string, FormDataValue>): Promise<FlatTemplatable>;
|
|
31
|
-
render<Fields extends Record<string, FormField>>(fctx: FormControlContext): Promise<FlatTemplatable>;
|
|
32
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { FormField } from "../fields/field.js";
|
|
3
|
-
import { FormDataValue } from "../form.js";
|
|
4
|
-
import { FormControlContext } from "./form-control.js";
|
|
5
|
-
import { SimpleInput, SimpleInputOptions } from "./simple-input.js";
|
|
6
|
-
export declare class Textarea<Required extends boolean> extends SimpleInput<string | null> {
|
|
7
|
-
field: FormField<boolean, string | null>;
|
|
8
|
-
options: SimpleInputOptions & {
|
|
9
|
-
label?: string;
|
|
10
|
-
rows?: number;
|
|
11
|
-
cols?: number;
|
|
12
|
-
description?: string;
|
|
13
|
-
autogrow?: boolean;
|
|
14
|
-
};
|
|
15
|
-
constructor(field: FormField<boolean, string | null>, options?: SimpleInputOptions & {
|
|
16
|
-
label?: string;
|
|
17
|
-
rows?: number;
|
|
18
|
-
cols?: number;
|
|
19
|
-
description?: string;
|
|
20
|
-
autogrow?: boolean;
|
|
21
|
-
});
|
|
22
|
-
renderDescription(): string;
|
|
23
|
-
getInputAttributes(fctx: FormControlContext): Promise<Record<string, string | boolean>>;
|
|
24
|
-
renderInput(ctx: Context, attributes: string, data: Record<string, FormDataValue>): Promise<string>;
|
|
25
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { FlatTemplatable } from "tempstream";
|
|
3
|
-
import { FormField } from "../fields/field.js";
|
|
4
|
-
import { FormDataValue } from "../form.js";
|
|
5
|
-
import { FormFieldControl } from "./controls.js";
|
|
6
|
-
import { FormControlContext } from "./form-control.js";
|
|
7
|
-
export type TickableOptions = {
|
|
8
|
-
id?: string;
|
|
9
|
-
name?: string;
|
|
10
|
-
label?: string;
|
|
11
|
-
hide_errors?: boolean;
|
|
12
|
-
readonly?: boolean;
|
|
13
|
-
};
|
|
14
|
-
export declare abstract class Tickable<T extends unknown> extends FormFieldControl {
|
|
15
|
-
field: FormField<boolean, T>;
|
|
16
|
-
options: TickableOptions;
|
|
17
|
-
constructor(field: FormField<boolean, T>, options?: TickableOptions);
|
|
18
|
-
type: "checkbox" | "radio";
|
|
19
|
-
abstract getValueAttribute(ctx: Context, data: Record<string, FormDataValue>, value: T): string;
|
|
20
|
-
abstract isChecked(ctx: Context, data: Record<string, FormDataValue>, value: T): boolean;
|
|
21
|
-
makeInputID(ctx: Context, data: Record<string, FormDataValue>, value: T): string;
|
|
22
|
-
getWrapperClasses(ctx: Context, data: Record<string, FormDataValue>, value: T): string[];
|
|
23
|
-
render<Fields extends Record<string, FormField>>(fctx: FormControlContext): Promise<FlatTemplatable>;
|
|
24
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { FormDataValue } from "../form.js";
|
|
3
|
-
import { FieldParseResult, FormField } from "./field.js";
|
|
4
|
-
export declare class Boolean<Required extends boolean> extends FormField<Required, boolean> {
|
|
5
|
-
error_message: string;
|
|
6
|
-
predicate: (v: unknown, w: unknown) => {
|
|
7
|
-
readonly match: boolean;
|
|
8
|
-
readonly wildcard: boolean;
|
|
9
|
-
};
|
|
10
|
-
constructor(required: Required, error_message?: string);
|
|
11
|
-
isValueValid(_: Context, value: boolean): Promise<{
|
|
12
|
-
valid: boolean;
|
|
13
|
-
message: string;
|
|
14
|
-
}>;
|
|
15
|
-
parse(_: Context, value: FormDataValue): Promise<FieldParseResult<boolean>>;
|
|
16
|
-
getEmptyValue(): boolean;
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { FormDataValue } from "../form.js";
|
|
3
|
-
import { FieldParseResult, FormField, FormFieldValidationResponse } from "./field.js";
|
|
4
|
-
export declare class ChekboxedListField<Required extends boolean> extends FormField<Required, Record<string, "on">> {
|
|
5
|
-
required: Required;
|
|
6
|
-
generateOptions: (ctx: Context) => Promise<Record<string, string> | {
|
|
7
|
-
[i: string]: string;
|
|
8
|
-
}>;
|
|
9
|
-
isVisible: (ctx: Context) => Promise<boolean>;
|
|
10
|
-
constructor(required: Required, generateOptions: (ctx: Context) => Promise<Record<string, string> | {
|
|
11
|
-
[i: string]: string;
|
|
12
|
-
}>, isVisible?: (ctx: Context) => Promise<boolean>);
|
|
13
|
-
predicate: (v: unknown, w: unknown) => {
|
|
14
|
-
readonly match: boolean;
|
|
15
|
-
readonly wildcard: string[];
|
|
16
|
-
};
|
|
17
|
-
isValueValid(_: Context, value: unknown): Promise<FormFieldValidationResponse>;
|
|
18
|
-
parse(_: Context, raw_value: FormDataValue): Promise<FieldParseResult<Record<string, "on">>>;
|
|
19
|
-
getEmptyValue(): Record<string, "on">;
|
|
20
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { Depromisify, Field, FieldOutput } from "sealious";
|
|
3
|
-
import { FormDataValue } from "../form.js";
|
|
4
|
-
import { FieldParseResult, FormField, FormFieldValidationResponse } from "./field.js";
|
|
5
|
-
export declare class CollectionField<F extends Field, Required extends boolean> extends FormField<Required, FieldOutput<F> | null> {
|
|
6
|
-
sealiousField: F;
|
|
7
|
-
constructor(required: Required, sealiousField: F);
|
|
8
|
-
predicate: (v: unknown, w: unknown) => {
|
|
9
|
-
readonly match: true;
|
|
10
|
-
readonly wildcard: unknown;
|
|
11
|
-
};
|
|
12
|
-
parse(ctx: Context, raw_value: FormDataValue): Promise<FieldParseResult<FieldOutput<F> | null>>;
|
|
13
|
-
isValueValid(ctx: Context, value: FieldOutput<F>): Promise<FormFieldValidationResponse>;
|
|
14
|
-
getEmptyValue(): Depromisify<ReturnType<F["decode"]>>;
|
|
15
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { RegExpField } from "./regexp.js";
|
|
2
|
-
export declare class EmailField<Required extends boolean> extends RegExpField<Required> {
|
|
3
|
-
error_message: string;
|
|
4
|
-
default_value: string;
|
|
5
|
-
predicate: import("@sealcode/ts-predicates").Predicate<string>;
|
|
6
|
-
constructor(required: Required, error_message?: string, default_value?: string);
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { FormDataValue } from "../form.js";
|
|
3
|
-
import { FieldParseResult, FormField } from "./field.js";
|
|
4
|
-
export declare class EnumMultipleField<Options extends readonly string[], Required extends boolean> extends FormField<Required, string[]> {
|
|
5
|
-
options: Options;
|
|
6
|
-
error_message: (options: Options) => string;
|
|
7
|
-
constructor(required: Required, options: Options, error_message?: (options: Options) => string);
|
|
8
|
-
predicate: (v: unknown, w: unknown) => {
|
|
9
|
-
readonly match: boolean;
|
|
10
|
-
readonly wildcard: Options[number];
|
|
11
|
-
};
|
|
12
|
-
isValueValid(_: Context, values: string[]): Promise<{
|
|
13
|
-
valid: boolean;
|
|
14
|
-
message: string;
|
|
15
|
-
}>;
|
|
16
|
-
parse(_: Context, value: FormDataValue): Promise<FieldParseResult<string[]>>;
|
|
17
|
-
getEmptyValue(): string[];
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { FormDataValue } from "../form.js";
|
|
3
|
-
import { FieldParseResult, FormField } from "./field.js";
|
|
4
|
-
export declare class EnumField<Options extends readonly string[], Required extends boolean> extends FormField<Required, string> {
|
|
5
|
-
options: Options;
|
|
6
|
-
error_message: (options: Options) => string;
|
|
7
|
-
constructor(required: Required, options: Options, error_message?: (options: Options) => string);
|
|
8
|
-
predicate: (v: unknown, w: unknown) => {
|
|
9
|
-
readonly match: boolean;
|
|
10
|
-
readonly wildcard: Options[number];
|
|
11
|
-
};
|
|
12
|
-
isValueValid(_: Context, value: unknown): Promise<{
|
|
13
|
-
valid: boolean;
|
|
14
|
-
message: string;
|
|
15
|
-
}>;
|
|
16
|
-
parse(_: Context, value: FormDataValue): Promise<FieldParseResult<string>>;
|
|
17
|
-
getEmptyValue(): string;
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Field } from "sealious";
|
|
2
|
-
import { PickFromListField } from "./pick-from-list.js";
|
|
3
|
-
export declare class ExistingSealiousValue<Required extends boolean> extends PickFromListField<Required> {
|
|
4
|
-
constructor(required: Required, field: Field);
|
|
5
|
-
getEmptyValue(): string;
|
|
6
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Predicate, predicates } from "@sealcode/ts-predicates";
|
|
2
|
-
import { Context } from "koa";
|
|
3
|
-
import { FormDataValue } from "../form.js";
|
|
4
|
-
export type FormFieldValidationResponse = {
|
|
5
|
-
valid: boolean;
|
|
6
|
-
message: string;
|
|
7
|
-
};
|
|
8
|
-
export type FormFieldValidationFn<ValueType> = (ctx: Context, value: ValueType, field: FormField<boolean, ValueType>) => Promise<FormFieldValidationResponse>;
|
|
9
|
-
export type FieldParsedValue<T> = T extends FormField<infer R> ? R : never;
|
|
10
|
-
export type GetPredicate<F extends FormField> = F extends FormField<true> ? F["predicate"] : F["predicate"] | typeof predicates.undefined;
|
|
11
|
-
export type FieldsToShape<T extends Record<string, FormField>> = {
|
|
12
|
-
[property in keyof T]: GetPredicate<T[property]>;
|
|
13
|
-
};
|
|
14
|
-
export declare function fieldsToShape<Fields extends Record<string, FormField>>(obj: Fields): FieldsToShape<Fields>;
|
|
15
|
-
export type FieldParseResult<T> = {
|
|
16
|
-
parsable: true;
|
|
17
|
-
error: null;
|
|
18
|
-
parsed_value: T;
|
|
19
|
-
} | {
|
|
20
|
-
parsable: false;
|
|
21
|
-
error: string;
|
|
22
|
-
parsed_value: null;
|
|
23
|
-
};
|
|
24
|
-
export declare abstract class FormField<Required extends boolean = boolean, ParsedValue extends unknown = unknown> {
|
|
25
|
-
readonly required: Required;
|
|
26
|
-
name: string;
|
|
27
|
-
constructor(required: Required);
|
|
28
|
-
predicate: Predicate;
|
|
29
|
-
mapToFilter: (parsed: ParsedValue) => unknown;
|
|
30
|
-
init(fieldname: string): Promise<void>;
|
|
31
|
-
_validate(ctx: Context, value: ParsedValue): Promise<FormFieldValidationResponse>;
|
|
32
|
-
abstract getEmptyValue(): ParsedValue;
|
|
33
|
-
isValueValid(ctx: Context, value: ParsedValue): Promise<FormFieldValidationResponse>;
|
|
34
|
-
abstract parse(ctx: Context, raw_value: FormDataValue): Promise<FieldParseResult<ParsedValue>>;
|
|
35
|
-
getValue(ctx: Context, all_form_values: Record<string, FormDataValue>): Promise<{
|
|
36
|
-
valid: boolean;
|
|
37
|
-
message: string;
|
|
38
|
-
parsed: ParsedValue;
|
|
39
|
-
raw: FormDataValue;
|
|
40
|
-
}>;
|
|
41
|
-
setMapToFilter(fn: (parsed: ParsedValue) => unknown): this;
|
|
42
|
-
getDatabaseValue(ctx: Context, data: Record<string, FormDataValue>): Promise<unknown>;
|
|
43
|
-
}
|
|
44
|
-
export * from "./simple-form-field.js";
|
|
45
|
-
export * from "./checkboxed-list.js";
|
|
46
|
-
export * from "./collection-field.js";
|
|
47
|
-
export * from "./number.js";
|
|
48
|
-
export * from "./pick-from-list.js";
|
|
49
|
-
export * from "./regexp.js";
|
|
50
|
-
export * from "./email.js";
|
|
51
|
-
export * from "./enum.js";
|
|
52
|
-
export * from "./boolean.js";
|
|
53
|
-
export * from "./enum-multiple.js";
|
|
54
|
-
export * from "./existing-sealious-value.js";
|
|
55
|
-
export * from "./file.js";
|
|
56
|
-
export * from "./multiple-files.js";
|
|
57
|
-
export * from "./reverse-single-reference.js";
|
|
58
|
-
export * from "./structured-array.js";
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { File as SealiousFile } from "sealious";
|
|
3
|
-
import { FormDataValue } from "../form.js";
|
|
4
|
-
import { FieldParseResult, FormField } from "./field.js";
|
|
5
|
-
export type FileContainer = {
|
|
6
|
-
old: SealiousFile | null;
|
|
7
|
-
new: SealiousFile | null;
|
|
8
|
-
};
|
|
9
|
-
export declare class File<Required extends boolean> extends FormField<Required, FileContainer> {
|
|
10
|
-
parse(ctx: Context, raw_value: FormDataValue): Promise<FieldParseResult<FileContainer>>;
|
|
11
|
-
getDatabaseValue(ctx: Context, data: Record<string, FormDataValue>): Promise<SealiousFile | undefined>;
|
|
12
|
-
getEmptyValue(): {
|
|
13
|
-
old: null;
|
|
14
|
-
new: null;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { FieldTypes as SealiousFieldTypes } from "sealious";
|
|
3
|
-
import { FormField } from "./field.js";
|
|
4
|
-
export declare class MultipleFiles extends FormField<false> {
|
|
5
|
-
collection_field: SealiousFieldTypes.ReverseSingleReference;
|
|
6
|
-
getItemId: (ctx: Context) => Promise<string> | string;
|
|
7
|
-
constructor(collection_field: SealiousFieldTypes.ReverseSingleReference, getItemId: (ctx: Context) => Promise<string> | string);
|
|
8
|
-
getEmptyValue(): undefined;
|
|
9
|
-
parse(): Promise<{
|
|
10
|
-
readonly parsed_value: undefined;
|
|
11
|
-
readonly parsable: true;
|
|
12
|
-
readonly error: null;
|
|
13
|
-
}>;
|
|
14
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { FormDataValue } from "../form.js";
|
|
3
|
-
import { FieldParseResult, FormField } from "./field.js";
|
|
4
|
-
export declare class NumberField<DefaultValue extends number | null = number, Required extends boolean = boolean> extends FormField<Required, number | DefaultValue> {
|
|
5
|
-
default_value: DefaultValue;
|
|
6
|
-
options: Partial<{
|
|
7
|
-
max: number;
|
|
8
|
-
min: number;
|
|
9
|
-
decimalDigits: number;
|
|
10
|
-
}>;
|
|
11
|
-
constructor(required: Required, default_value: DefaultValue, options?: Partial<{
|
|
12
|
-
max: number;
|
|
13
|
-
min: number;
|
|
14
|
-
decimalDigits: number;
|
|
15
|
-
}>);
|
|
16
|
-
predicate: import("@sealcode/ts-predicates").Predicate<number>;
|
|
17
|
-
isValueValid(_: Context, value: unknown): Promise<{
|
|
18
|
-
valid: boolean;
|
|
19
|
-
message: string;
|
|
20
|
-
}>;
|
|
21
|
-
parse(_: Context, value: FormDataValue): Promise<FieldParseResult<number>>;
|
|
22
|
-
getEmptyValue(): DefaultValue;
|
|
23
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { DropdownOption } from "../controls/dropdown.js";
|
|
3
|
-
import { FormFieldValidationResponse } from "./field.js";
|
|
4
|
-
import { SimpleFormField } from "./simple-form-field.js";
|
|
5
|
-
export declare class PickFromListField<Required extends boolean> extends SimpleFormField<Required> {
|
|
6
|
-
required: Required;
|
|
7
|
-
generateOptions: (ctx: Context) => Promise<DropdownOption[]>;
|
|
8
|
-
customValidation: (ctx: Context, value: unknown, instance: PickFromListField<Required>) => Promise<FormFieldValidationResponse>;
|
|
9
|
-
constructor(required: Required, generateOptions: (ctx: Context) => Promise<DropdownOption[]>, customValidation?: (ctx: Context, value: unknown, instance: PickFromListField<Required>) => Promise<FormFieldValidationResponse>);
|
|
10
|
-
predicate: import("@sealcode/ts-predicates").Predicate<string>;
|
|
11
|
-
isValueValid(ctx: Context, value: string): Promise<FormFieldValidationResponse>;
|
|
12
|
-
valueInList(ctx: Context, value: unknown): Promise<FormFieldValidationResponse>;
|
|
13
|
-
getEmptyValue(): string;
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { FormField } from "./field.js";
|
|
2
|
-
export declare class ProxyFormField<T> extends FormField<boolean, T> {
|
|
3
|
-
name: string;
|
|
4
|
-
empty_value: T;
|
|
5
|
-
parsed_value: T;
|
|
6
|
-
constructor(required: boolean, name: string, empty_value: T, parsed_value: T);
|
|
7
|
-
getEmptyValue(): T;
|
|
8
|
-
parse(): Promise<{
|
|
9
|
-
readonly parsable: true;
|
|
10
|
-
readonly error: null;
|
|
11
|
-
readonly parsed_value: T;
|
|
12
|
-
}>;
|
|
13
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { FormDataValue } from "../form.js";
|
|
3
|
-
import { FieldParseResult, FormField } from "./field.js";
|
|
4
|
-
export declare class RegExpField<Required extends boolean> extends FormField<Required> {
|
|
5
|
-
regexp: RegExp;
|
|
6
|
-
error_message: string;
|
|
7
|
-
default_value: string;
|
|
8
|
-
constructor(required: Required, regexp: RegExp, error_message: string, default_value?: string);
|
|
9
|
-
predicate: import("@sealcode/ts-predicates").Predicate<string>;
|
|
10
|
-
isValueValid(_: Context, value: unknown): Promise<{
|
|
11
|
-
valid: boolean;
|
|
12
|
-
message: string;
|
|
13
|
-
}>;
|
|
14
|
-
parse(_: Context, value: FormDataValue): Promise<FieldParseResult<string>>;
|
|
15
|
-
getEmptyValue(): string;
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { FormField } from "./field.js";
|
|
2
|
-
import { FieldTypes as SealiousFields } from "sealious";
|
|
3
|
-
import { Context } from "koa";
|
|
4
|
-
export declare class ReverseSingleReference extends FormField {
|
|
5
|
-
sealious_field: SealiousFields.ReverseSingleReference;
|
|
6
|
-
constructor(required: boolean, sealious_field: SealiousFields.ReverseSingleReference);
|
|
7
|
-
parse(ctx: Context, raw_value: unknown): Promise<{
|
|
8
|
-
parsable: true;
|
|
9
|
-
error: null;
|
|
10
|
-
parsed_value: unknown;
|
|
11
|
-
}>;
|
|
12
|
-
getEmptyValue(): never[];
|
|
13
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FieldParseResult, FormField } from "./field.js";
|
|
2
|
-
import { FormDataValue } from "../form.js";
|
|
3
|
-
import { Context } from "koa";
|
|
4
|
-
export declare class SimpleFormField<Required extends boolean> extends FormField<Required, string | null> {
|
|
5
|
-
parse(_: Context, raw_value: FormDataValue): Promise<FieldParseResult<string>>;
|
|
6
|
-
predicate: import("@sealcode/ts-predicates").Predicate<string>;
|
|
7
|
-
getEmptyValue(): string;
|
|
8
|
-
constructor(required: Required);
|
|
9
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Context } from "koa";
|
|
2
|
-
import { Field, FieldsetOutput, FieldTypes } from "sealious";
|
|
3
|
-
import { FormDataValue } from "../form.js";
|
|
4
|
-
import { FormField } from "./field.js";
|
|
5
|
-
export declare class StructuredArrayField<Fields extends Record<string, Field>> extends FormField<true, FieldTypes.ArrayStorageInput<FieldsetOutput<Fields>>> {
|
|
6
|
-
sealious_field: FieldTypes.StructuredArray<Fields>;
|
|
7
|
-
constructor(sealious_field: FieldTypes.StructuredArray<Fields>);
|
|
8
|
-
parse(context: Context, value: FormDataValue): Promise<{
|
|
9
|
-
parsable: true;
|
|
10
|
-
error: null;
|
|
11
|
-
parsed_value: FieldsetOutput<Fields>;
|
|
12
|
-
}>;
|
|
13
|
-
getEmptyValue(): FieldTypes.ArrayStorageInput<FieldsetOutput<Fields>>;
|
|
14
|
-
}
|